From 496665afd92e0cb0919cb71887e627f34a6b9150 Mon Sep 17 00:00:00 2001 From: support Date: Tue, 5 Jul 2022 08:31:22 +0000 Subject: [PATCH] Built motion from commit 5554e4f7.|2.6.12 --- apidoc/api_project.js | 2 +- apidoc/api_project.json | 2 +- server/api/action/action.attributes.js | 2 +- server/api/action/action.controller.js | 2 +- server/api/action/action.model.js | 2 +- server/api/action/action.rpc.js | 2 +- server/api/action/index.js | 2 +- .../analyticCustomReport.attributes.js | 2 +- .../analyticCustomReport.controller.js | 2 +- .../analyticCustomReport.model.js | 2 +- .../analyticCustomReport.rpc.js | 2 +- server/api/analyticCustomReport/index.js | 2 +- .../analyticDefaultReport.attributes.js | 2 +- .../analyticDefaultReport.controller.js | 2 +- .../analyticDefaultReport.model.js | 2 +- .../analyticDefaultReport.rpc.js | 2 +- server/api/analyticDefaultReport/index.js | 2 +- .../analyticExtractedReport.attributes.js | 2 +- .../analyticExtractedReport.controller.js | 2 +- .../analyticExtractedReport.model.js | 2 +- .../analyticExtractedReport.rpc.js | 2 +- server/api/analyticExtractedReport/index.js | 2 +- .../analyticFieldReport.attributes.js | 2 +- .../analyticFieldReport.controller.js | 2 +- .../analyticFieldReport.model.js | 2 +- .../analyticFieldReport/analyticFieldReport.rpc.js | 2 +- server/api/analyticFieldReport/index.js | 2 +- .../analyticMetric/analyticMetric.attributes.js | 2 +- .../analyticMetric/analyticMetric.controller.js | 2 +- server/api/analyticMetric/analyticMetric.model.js | 2 +- server/api/analyticMetric/analyticMetric.rpc.js | 2 +- server/api/analyticMetric/index.js | 2 +- .../analyticTreeReport.attributes.js | 2 +- .../analyticTreeReport.controller.js | 2 +- .../analyticTreeReport/analyticTreeReport.model.js | 2 +- .../analyticTreeReport/analyticTreeReport.rpc.js | 2 +- server/api/analyticTreeReport/index.js | 2 +- server/api/attachment/attachment.attributes.js | 2 +- server/api/attachment/attachment.controller.js | 2 +- server/api/attachment/attachment.model.js | 2 +- server/api/attachment/attachment.rpc.js | 2 +- server/api/attachment/index.js | 2 +- .../authActiveDirectory.controller.js | 2 +- server/api/authActiveDirectory/index.js | 2 +- server/api/authGoogle/authGoogle.controller.js | 2 +- server/api/authGoogle/index.js | 2 +- server/api/authLocal/authLocal.controller.js | 2 +- server/api/authLocal/index.js | 2 +- server/api/automation/automation.attributes.js | 2 +- server/api/automation/automation.controller.js | 2 +- server/api/automation/automation.model.js | 2 +- server/api/automation/automation.rpc.js | 2 +- server/api/automation/index.js | 2 +- server/api/campaign/campaign.attributes.js | 2 +- server/api/campaign/campaign.controller.js | 2 +- server/api/campaign/campaign.model.js | 2 +- server/api/campaign/campaign.rpc.js | 2 +- server/api/campaign/index.js | 2 +- server/api/cannedAnswer/cannedAnswer.attributes.js | 2 +- server/api/cannedAnswer/cannedAnswer.controller.js | 2 +- server/api/cannedAnswer/cannedAnswer.model.js | 2 +- server/api/cannedAnswer/cannedAnswer.rpc.js | 2 +- server/api/cannedAnswer/index.js | 2 +- server/api/cdr/cdr.attributes.js | 2 +- server/api/cdr/cdr.controller.js | 2 +- server/api/cdr/cdr.model.js | 2 +- server/api/cdr/cdr.rpc.js | 2 +- server/api/cdr/index.js | 2 +- .../chatApplication/chatApplication.attributes.js | 2 +- .../chatApplication/chatApplication.controller.js | 2 +- .../api/chatApplication/chatApplication.model.js | 2 +- server/api/chatApplication/chatApplication.rpc.js | 2 +- server/api/chatApplication/index.js | 2 +- server/api/chatGroup/chatGroup.attributes.js | 2 +- server/api/chatGroup/chatGroup.controller.js | 2 +- server/api/chatGroup/chatGroup.events.js | 2 +- server/api/chatGroup/chatGroup.model.js | 2 +- server/api/chatGroup/chatGroup.rpc.js | 2 +- server/api/chatGroup/chatGroup.socket.js | 2 +- server/api/chatGroup/index.js | 2 +- .../chatInteraction/chatInteraction.attributes.js | 2 +- .../chatInteraction/chatInteraction.controller.js | 2 +- .../api/chatInteraction/chatInteraction.events.js | 2 +- .../api/chatInteraction/chatInteraction.model.js | 2 +- server/api/chatInteraction/chatInteraction.rpc.js | 2 +- .../api/chatInteraction/chatInteraction.socket.js | 2 +- server/api/chatInteraction/index.js | 2 +- .../chatInternalMessage.attributes.js | 2 +- .../chatInternalMessage.controller.js | 2 +- .../chatInternalMessage.events.js | 2 +- .../chatInternalMessage.model.js | 2 +- .../chatInternalMessage/chatInternalMessage.rpc.js | 2 +- .../chatInternalMessage.socket.js | 2 +- server/api/chatInternalMessage/index.js | 2 +- server/api/chatMessage/chatMessage.attributes.js | 2 +- server/api/chatMessage/chatMessage.controller.js | 2 +- server/api/chatMessage/chatMessage.events.js | 2 +- server/api/chatMessage/chatMessage.model.js | 2 +- server/api/chatMessage/chatMessage.rpc.js | 2 +- server/api/chatMessage/chatMessage.socket.js | 2 +- server/api/chatMessage/index.js | 2 +- .../chatOfflineMessage.attributes.js | 2 +- .../chatOfflineMessage.controller.js | 2 +- .../chatOfflineMessage.events.js | 2 +- .../chatOfflineMessage/chatOfflineMessage.model.js | 2 +- .../chatOfflineMessage/chatOfflineMessage.rpc.js | 2 +- server/api/chatOfflineMessage/index.js | 2 +- .../chatProactiveAction.attributes.js | 2 +- .../chatProactiveAction.controller.js | 2 +- .../chatProactiveAction.model.js | 2 +- .../chatProactiveAction/chatProactiveAction.rpc.js | 2 +- server/api/chatProactiveAction/index.js | 2 +- server/api/chatQueue/chatQueue.attributes.js | 2 +- server/api/chatQueue/chatQueue.controller.js | 2 +- server/api/chatQueue/chatQueue.events.js | 2 +- server/api/chatQueue/chatQueue.model.js | 2 +- server/api/chatQueue/chatQueue.rpc.js | 2 +- server/api/chatQueue/chatQueue.socket.js | 2 +- server/api/chatQueue/index.js | 2 +- .../chatQueueReport/chatQueueReport.attributes.js | 2 +- .../chatQueueReport/chatQueueReport.controller.js | 2 +- .../api/chatQueueReport/chatQueueReport.model.js | 2 +- server/api/chatQueueReport/chatQueueReport.rpc.js | 2 +- server/api/chatQueueReport/index.js | 2 +- .../chatTransferReport.attributes.js | 2 +- .../chatTransferReport.controller.js | 2 +- .../chatTransferReport/chatTransferReport.model.js | 2 +- .../chatTransferReport/chatTransferReport.rpc.js | 2 +- server/api/chatTransferReport/index.js | 2 +- server/api/chatWebsite/chatWebsite.attributes.js | 2 +- server/api/chatWebsite/chatWebsite.controller.js | 2 +- server/api/chatWebsite/chatWebsite.events.js | 2 +- server/api/chatWebsite/chatWebsite.model.js | 2 +- server/api/chatWebsite/chatWebsite.rpc.js | 2 +- server/api/chatWebsite/chatWebsite.socket.js | 2 +- server/api/chatWebsite/index.js | 2 +- server/api/client-side-logs.js | 2 +- .../api/cloudProvider/cloudProvider.attributes.js | 2 +- .../api/cloudProvider/cloudProvider.controller.js | 2 +- server/api/cloudProvider/cloudProvider.model.js | 2 +- server/api/cloudProvider/cloudProvider.oauth.js | 2 +- server/api/cloudProvider/cloudProvider.rpc.js | 2 +- server/api/cloudProvider/index.js | 2 +- server/api/cmCompany/cmCompany.attributes.js | 2 +- server/api/cmCompany/cmCompany.controller.js | 2 +- server/api/cmCompany/cmCompany.model.js | 2 +- server/api/cmCompany/cmCompany.rpc.js | 2 +- server/api/cmCompany/index.js | 2 +- server/api/cmContact/cmContact.attributes.js | 2 +- server/api/cmContact/cmContact.controller.js | 2 +- server/api/cmContact/cmContact.events.js | 2 +- server/api/cmContact/cmContact.model.js | 2 +- server/api/cmContact/cmContact.rpc.js | 2 +- server/api/cmContact/cmContact.socket.js | 2 +- server/api/cmContact/index.js | 2 +- .../cmContactHasItem.attributes.js | 2 +- .../cmContactHasItem.controller.js | 2 +- .../api/cmContactHasItem/cmContactHasItem.model.js | 2 +- .../api/cmContactHasItem/cmContactHasItem.rpc.js | 2 +- server/api/cmContactHasItem/index.js | 2 +- .../api/cmCustomField/cmCustomField.attributes.js | 2 +- .../api/cmCustomField/cmCustomField.controller.js | 2 +- server/api/cmCustomField/cmCustomField.model.js | 2 +- server/api/cmCustomField/cmCustomField.rpc.js | 2 +- server/api/cmCustomField/index.js | 2 +- server/api/cmHopper/cmHopper.attributes.js | 2 +- server/api/cmHopper/cmHopper.controller.js | 2 +- server/api/cmHopper/cmHopper.model.js | 2 +- server/api/cmHopper/cmHopper.rpc.js | 2 +- server/api/cmHopper/index.js | 2 +- .../cmHopperAdditionalPhone.attributes.js | 2 +- .../cmHopperAdditionalPhone.controller.js | 2 +- .../cmHopperAdditionalPhone.model.js | 2 +- .../cmHopperAdditionalPhone.rpc.js | 2 +- server/api/cmHopperAdditionalPhone/index.js | 2 +- .../api/cmHopperBlack/cmHopperBlack.attributes.js | 2 +- .../api/cmHopperBlack/cmHopperBlack.controller.js | 2 +- server/api/cmHopperBlack/cmHopperBlack.model.js | 2 +- server/api/cmHopperBlack/cmHopperBlack.rpc.js | 2 +- server/api/cmHopperBlack/index.js | 2 +- .../api/cmHopperFinal/cmHopperFinal.attributes.js | 2 +- .../api/cmHopperFinal/cmHopperFinal.controller.js | 2 +- server/api/cmHopperFinal/cmHopperFinal.model.js | 2 +- server/api/cmHopperFinal/cmHopperFinal.rpc.js | 2 +- server/api/cmHopperFinal/index.js | 2 +- .../cmHopperHistory/cmHopperHistory.attributes.js | 2 +- .../cmHopperHistory/cmHopperHistory.controller.js | 2 +- .../api/cmHopperHistory/cmHopperHistory.model.js | 2 +- server/api/cmHopperHistory/cmHopperHistory.rpc.js | 2 +- server/api/cmHopperHistory/index.js | 2 +- server/api/cmList/cmList.attributes.js | 2 +- server/api/cmList/cmList.controller.js | 2 +- server/api/cmList/cmList.events.js | 2 +- server/api/cmList/cmList.model.js | 2 +- server/api/cmList/cmList.rpc.js | 2 +- server/api/cmList/cmList.socket.js | 2 +- server/api/cmList/index.js | 2 +- server/api/condition/condition.attributes.js | 2 +- server/api/condition/condition.controller.js | 2 +- server/api/condition/condition.model.js | 2 +- server/api/condition/condition.rpc.js | 2 +- server/api/condition/index.js | 2 +- .../contactItemType/contactItemType.attributes.js | 2 +- .../contactItemType/contactItemType.controller.js | 2 +- .../api/contactItemType/contactItemType.model.js | 2 +- server/api/contactItemType/contactItemType.rpc.js | 2 +- server/api/contactItemType/index.js | 2 +- server/api/dashboard/dashboard.attributes.js | 2 +- server/api/dashboard/dashboard.controller.js | 2 +- server/api/dashboard/dashboard.events.js | 2 +- server/api/dashboard/dashboard.model.js | 2 +- server/api/dashboard/dashboard.rpc.js | 2 +- server/api/dashboard/dashboard.socket.js | 2 +- server/api/dashboard/index.js | 2 +- .../api/dashboardItem/dashboardItem.attributes.js | 2 +- .../api/dashboardItem/dashboardItem.controller.js | 2 +- server/api/dashboardItem/dashboardItem.events.js | 2 +- server/api/dashboardItem/dashboardItem.model.js | 2 +- server/api/dashboardItem/dashboardItem.rpc.js | 2 +- server/api/dashboardItem/dashboardItem.socket.js | 2 +- server/api/dashboardItem/index.js | 2 +- server/api/disposition/disposition.attributes.js | 2 +- server/api/disposition/disposition.controller.js | 2 +- server/api/disposition/disposition.model.js | 2 +- server/api/disposition/disposition.rpc.js | 2 +- server/api/disposition/index.js | 2 +- server/api/faxAccount/faxAccount.attributes.js | 2 +- server/api/faxAccount/faxAccount.controller.js | 2 +- server/api/faxAccount/faxAccount.events.js | 2 +- server/api/faxAccount/faxAccount.model.js | 2 +- server/api/faxAccount/faxAccount.rpc.js | 2 +- server/api/faxAccount/faxAccount.socket.js | 2 +- server/api/faxAccount/index.js | 2 +- .../faxApplication/faxApplication.attributes.js | 2 +- .../faxApplication/faxApplication.controller.js | 2 +- server/api/faxApplication/faxApplication.model.js | 2 +- server/api/faxApplication/faxApplication.rpc.js | 2 +- server/api/faxApplication/index.js | 2 +- .../faxInteraction/faxInteraction.attributes.js | 2 +- .../faxInteraction/faxInteraction.controller.js | 2 +- server/api/faxInteraction/faxInteraction.events.js | 2 +- server/api/faxInteraction/faxInteraction.model.js | 2 +- server/api/faxInteraction/faxInteraction.rpc.js | 2 +- server/api/faxInteraction/faxInteraction.socket.js | 2 +- server/api/faxInteraction/index.js | 2 +- server/api/faxMessage/faxMessage.attributes.js | 2 +- server/api/faxMessage/faxMessage.controller.js | 2 +- server/api/faxMessage/faxMessage.events.js | 2 +- server/api/faxMessage/faxMessage.model.js | 2 +- server/api/faxMessage/faxMessage.rpc.js | 2 +- server/api/faxMessage/faxMessage.socket.js | 2 +- server/api/faxMessage/index.js | 2 +- server/api/faxQueue/faxQueue.attributes.js | 2 +- server/api/faxQueue/faxQueue.controller.js | 2 +- server/api/faxQueue/faxQueue.events.js | 2 +- server/api/faxQueue/faxQueue.model.js | 2 +- server/api/faxQueue/faxQueue.rpc.js | 2 +- server/api/faxQueue/faxQueue.socket.js | 2 +- server/api/faxQueue/index.js | 2 +- .../faxQueueReport/faxQueueReport.attributes.js | 2 +- .../faxQueueReport/faxQueueReport.controller.js | 2 +- server/api/faxQueueReport/faxQueueReport.model.js | 2 +- server/api/faxQueueReport/faxQueueReport.rpc.js | 2 +- server/api/faxQueueReport/index.js | 2 +- .../faxTransferReport.attributes.js | 2 +- .../faxTransferReport.controller.js | 2 +- .../faxTransferReport/faxTransferReport.model.js | 2 +- .../api/faxTransferReport/faxTransferReport.rpc.js | 2 +- server/api/faxTransferReport/index.js | 2 +- server/api/intDeskAccount/index.js | 2 +- .../intDeskAccount/intDeskAccount.attributes.js | 2 +- .../intDeskAccount/intDeskAccount.controller.js | 2 +- server/api/intDeskAccount/intDeskAccount.model.js | 2 +- server/api/intDeskAccount/intDeskAccount.rpc.js | 2 +- server/api/intDeskConfiguration/index.js | 2 +- .../intDeskConfiguration.attributes.js | 2 +- .../intDeskConfiguration.controller.js | 2 +- .../intDeskConfiguration.model.js | 2 +- .../intDeskConfiguration.rpc.js | 2 +- server/api/intDeskField/index.js | 2 +- server/api/intDeskField/intDeskField.attributes.js | 2 +- server/api/intDeskField/intDeskField.controller.js | 2 +- server/api/intDeskField/intDeskField.model.js | 2 +- server/api/intDeskField/intDeskField.rpc.js | 2 +- server/api/intDynamics365Account/index.js | 2 +- .../intDynamics365Account.attributes.js | 2 +- .../intDynamics365Account.controller.js | 2 +- .../intDynamics365Account.model.js | 2 +- .../intDynamics365Account.rpc.js | 2 +- server/api/intDynamics365Configuration/index.js | 2 +- .../intDynamics365Configuration.attributes.js | 2 +- .../intDynamics365Configuration.controller.js | 2 +- .../intDynamics365Configuration.model.js | 2 +- .../intDynamics365Configuration.rpc.js | 2 +- server/api/intDynamics365Field/index.js | 2 +- .../intDynamics365Field.attributes.js | 2 +- .../intDynamics365Field.controller.js | 2 +- .../intDynamics365Field.model.js | 2 +- .../intDynamics365Field/intDynamics365Field.rpc.js | 2 +- server/api/intFreshdeskAccount/index.js | 2 +- .../intFreshdeskAccount.attributes.js | 2 +- .../intFreshdeskAccount.controller.js | 2 +- .../intFreshdeskAccount.model.js | 2 +- .../intFreshdeskAccount/intFreshdeskAccount.rpc.js | 2 +- server/api/intFreshdeskConfiguration/index.js | 2 +- .../intFreshdeskConfiguration.attributes.js | 2 +- .../intFreshdeskConfiguration.controller.js | 2 +- .../intFreshdeskConfiguration.model.js | 2 +- .../intFreshdeskConfiguration.rpc.js | 2 +- server/api/intFreshdeskField/index.js | 2 +- .../intFreshdeskField.attributes.js | 2 +- .../intFreshdeskField.controller.js | 2 +- .../intFreshdeskField/intFreshdeskField.model.js | 2 +- .../api/intFreshdeskField/intFreshdeskField.rpc.js | 2 +- server/api/intFreshsalesAccount/index.js | 2 +- .../intFreshsalesAccount.attributes.js | 2 +- .../intFreshsalesAccount.controller.js | 2 +- .../intFreshsalesAccount.model.js | 2 +- .../intFreshsalesAccount.rpc.js | 2 +- server/api/intFreshsalesConfiguration/index.js | 2 +- .../intFreshsalesConfiguration.attributes.js | 2 +- .../intFreshsalesConfiguration.controller.js | 2 +- .../intFreshsalesConfiguration.model.js | 2 +- .../intFreshsalesConfiguration.rpc.js | 2 +- server/api/intFreshsalesField/index.js | 2 +- .../intFreshsalesField.attributes.js | 2 +- .../intFreshsalesField.controller.js | 2 +- .../intFreshsalesField/intFreshsalesField.model.js | 2 +- .../intFreshsalesField/intFreshsalesField.rpc.js | 2 +- server/api/intSalesforceAccount/index.js | 2 +- .../intSalesforceAccount.attributes.js | 2 +- .../intSalesforceAccount.controller.js | 2 +- .../intSalesforceAccount.model.js | 2 +- .../intSalesforceAccount.rpc.js | 2 +- server/api/intSalesforceConfiguration/index.js | 2 +- .../intSalesforceConfiguration.attributes.js | 2 +- .../intSalesforceConfiguration.controller.js | 2 +- .../intSalesforceConfiguration.model.js | 2 +- .../intSalesforceConfiguration.rpc.js | 2 +- server/api/intSalesforceField/index.js | 2 +- .../intSalesforceField.attributes.js | 2 +- .../intSalesforceField.controller.js | 2 +- .../intSalesforceField/intSalesforceField.model.js | 2 +- .../intSalesforceField/intSalesforceField.rpc.js | 2 +- server/api/intServicenowAccount/index.js | 2 +- .../intServicenowAccount.attributes.js | 2 +- .../intServicenowAccount.controller.js | 2 +- .../intServicenowAccount.model.js | 2 +- .../intServicenowAccount.rpc.js | 2 +- server/api/intServicenowConfiguration/index.js | 2 +- .../intServicenowConfiguration.attributes.js | 2 +- .../intServicenowConfiguration.controller.js | 2 +- .../intServicenowConfiguration.model.js | 2 +- .../intServicenowConfiguration.rpc.js | 2 +- server/api/intServicenowField/index.js | 2 +- .../intServicenowField.attributes.js | 2 +- .../intServicenowField.controller.js | 2 +- .../intServicenowField/intServicenowField.model.js | 2 +- .../intServicenowField/intServicenowField.rpc.js | 2 +- server/api/intSugarcrmAccount/index.js | 2 +- .../intSugarcrmAccount.attributes.js | 2 +- .../intSugarcrmAccount.controller.js | 2 +- .../intSugarcrmAccount/intSugarcrmAccount.model.js | 2 +- .../intSugarcrmAccount/intSugarcrmAccount.rpc.js | 2 +- server/api/intSugarcrmConfiguration/index.js | 2 +- .../intSugarcrmConfiguration.attributes.js | 2 +- .../intSugarcrmConfiguration.controller.js | 2 +- .../intSugarcrmConfiguration.model.js | 2 +- .../intSugarcrmConfiguration.rpc.js | 2 +- server/api/intSugarcrmField/index.js | 2 +- .../intSugarcrmField.attributes.js | 2 +- .../intSugarcrmField.controller.js | 2 +- .../api/intSugarcrmField/intSugarcrmField.model.js | 2 +- .../api/intSugarcrmField/intSugarcrmField.rpc.js | 2 +- server/api/intVtigerAccount/index.js | 2 +- .../intVtigerAccount.attributes.js | 2 +- .../intVtigerAccount.controller.js | 2 +- .../api/intVtigerAccount/intVtigerAccount.model.js | 2 +- .../api/intVtigerAccount/intVtigerAccount.rpc.js | 2 +- server/api/intVtigerConfiguration/index.js | 2 +- .../intVtigerConfiguration.attributes.js | 2 +- .../intVtigerConfiguration.controller.js | 2 +- .../intVtigerConfiguration.model.js | 2 +- .../intVtigerConfiguration.rpc.js | 2 +- server/api/intVtigerField/index.js | 2 +- .../intVtigerField/intVtigerField.attributes.js | 2 +- .../intVtigerField/intVtigerField.controller.js | 2 +- server/api/intVtigerField/intVtigerField.model.js | 2 +- server/api/intVtigerField/intVtigerField.rpc.js | 2 +- server/api/intZendeskAccount/index.js | 2 +- .../intZendeskAccount.attributes.js | 2 +- .../intZendeskAccount.controller.js | 2 +- .../intZendeskAccount/intZendeskAccount.model.js | 2 +- .../api/intZendeskAccount/intZendeskAccount.rpc.js | 2 +- server/api/intZendeskConfiguration/index.js | 2 +- .../intZendeskConfiguration.attributes.js | 2 +- .../intZendeskConfiguration.controller.js | 2 +- .../intZendeskConfiguration.model.js | 2 +- .../intZendeskConfiguration.rpc.js | 2 +- server/api/intZendeskField/index.js | 2 +- .../intZendeskField/intZendeskField.attributes.js | 2 +- .../intZendeskField/intZendeskField.controller.js | 2 +- .../api/intZendeskField/intZendeskField.model.js | 2 +- server/api/intZendeskField/intZendeskField.rpc.js | 2 +- server/api/intZohoAccount/index.js | 2 +- .../intZohoAccount/intZohoAccount.attributes.js | 2 +- .../intZohoAccount/intZohoAccount.controller.js | 2 +- server/api/intZohoAccount/intZohoAccount.model.js | 2 +- server/api/intZohoAccount/intZohoAccount.rpc.js | 2 +- server/api/intZohoConfiguration/index.js | 2 +- .../intZohoConfiguration.attributes.js | 2 +- .../intZohoConfiguration.controller.js | 2 +- .../intZohoConfiguration.model.js | 2 +- .../intZohoConfiguration.rpc.js | 2 +- server/api/intZohoField/index.js | 2 +- server/api/intZohoField/intZohoField.attributes.js | 2 +- server/api/intZohoField/intZohoField.controller.js | 2 +- server/api/intZohoField/intZohoField.model.js | 2 +- server/api/intZohoField/intZohoField.rpc.js | 2 +- server/api/integration/index.js | 2 +- server/api/integration/integration.attributes.js | 2 +- server/api/integration/integration.controller.js | 2 +- server/api/integration/integration.model.js | 2 +- server/api/integration/integration.rpc.js | 2 +- server/api/integrationReport/index.js | 2 +- .../integrationReport.attributes.js | 2 +- .../integrationReport.controller.js | 2 +- .../integrationReport/integrationReport.model.js | 2 +- .../api/integrationReport/integrationReport.rpc.js | 2 +- server/api/interval/index.js | 2 +- server/api/interval/interval.attributes.js | 2 +- server/api/interval/interval.controller.js | 2 +- server/api/interval/interval.model.js | 2 +- server/api/interval/interval.rpc.js | 2 +- server/api/jira/index.js | 2 +- server/api/jira/jira.controller.js | 2 +- server/api/jscriptyAnswerReport/index.js | 2 +- .../jscriptyAnswerReport.attributes.js | 2 +- .../jscriptyAnswerReport.controller.js | 2 +- .../jscriptyAnswerReport.model.js | 2 +- .../jscriptyAnswerReport.rpc.js | 2 +- server/api/jscriptyProject/index.js | 2 +- .../jscriptyProject/jscriptyProject.attributes.js | 2 +- .../jscriptyProject/jscriptyProject.controller.js | 2 +- .../api/jscriptyProject/jscriptyProject.model.js | 2 +- server/api/jscriptyProject/jscriptyProject.rpc.js | 2 +- server/api/jscriptyQuestionReport/index.js | 2 +- .../jscriptyQuestionReport.attributes.js | 2 +- .../jscriptyQuestionReport.controller.js | 2 +- .../jscriptyQuestionReport.model.js | 2 +- .../jscriptyQuestionReport.rpc.js | 2 +- server/api/jscriptySessionReport/index.js | 2 +- .../jscriptySessionReport.attributes.js | 2 +- .../jscriptySessionReport.controller.js | 2 +- .../jscriptySessionReport.model.js | 2 +- .../jscriptySessionReport.rpc.js | 2 +- server/api/license/index.js | 2 +- server/api/license/license.attributes.js | 2 +- server/api/license/license.controller.js | 2 +- server/api/license/license.model.js | 2 +- server/api/license/license.rpc.js | 2 +- server/api/mailAccount/index.js | 2 +- server/api/mailAccount/mailAccount.attributes.js | 2 +- server/api/mailAccount/mailAccount.controller.js | 2 +- server/api/mailAccount/mailAccount.events.js | 2 +- server/api/mailAccount/mailAccount.model.js | 2 +- server/api/mailAccount/mailAccount.rpc.js | 2 +- server/api/mailAccount/mailAccount.socket.js | 2 +- server/api/mailApplication/index.js | 2 +- .../mailApplication/mailApplication.attributes.js | 2 +- .../mailApplication/mailApplication.controller.js | 2 +- .../api/mailApplication/mailApplication.model.js | 2 +- server/api/mailApplication/mailApplication.rpc.js | 2 +- server/api/mailInteraction/index.js | 2 +- .../mailInteraction/mailInteraction.attributes.js | 2 +- .../mailInteraction/mailInteraction.controller.js | 2 +- .../api/mailInteraction/mailInteraction.events.js | 2 +- .../api/mailInteraction/mailInteraction.model.js | 2 +- server/api/mailInteraction/mailInteraction.rpc.js | 2 +- .../api/mailInteraction/mailInteraction.socket.js | 2 +- server/api/mailMessage/index.js | 2 +- server/api/mailMessage/mailMessage.attributes.js | 2 +- server/api/mailMessage/mailMessage.controller.js | 2 +- server/api/mailMessage/mailMessage.events.js | 2 +- server/api/mailMessage/mailMessage.model.js | 2 +- server/api/mailMessage/mailMessage.rpc.js | 2 +- server/api/mailMessage/mailMessage.socket.js | 2 +- server/api/mailQueue/index.js | 2 +- server/api/mailQueue/mailQueue.attributes.js | 2 +- server/api/mailQueue/mailQueue.controller.js | 2 +- server/api/mailQueue/mailQueue.events.js | 2 +- server/api/mailQueue/mailQueue.model.js | 2 +- server/api/mailQueue/mailQueue.rpc.js | 2 +- server/api/mailQueue/mailQueue.socket.js | 2 +- server/api/mailQueueReport/index.js | 2 +- .../mailQueueReport/mailQueueReport.attributes.js | 2 +- .../mailQueueReport/mailQueueReport.controller.js | 2 +- .../api/mailQueueReport/mailQueueReport.model.js | 2 +- server/api/mailQueueReport/mailQueueReport.rpc.js | 2 +- server/api/mailServerIn/index.js | 2 +- server/api/mailServerIn/mailServerIn.attributes.js | 2 +- server/api/mailServerIn/mailServerIn.model.js | 2 +- server/api/mailServerIn/mailServerIn.rpc.js | 2 +- server/api/mailServerOut/index.js | 2 +- .../api/mailServerOut/mailServerOut.attributes.js | 2 +- .../api/mailServerOut/mailServerOut.controller.js | 2 +- server/api/mailServerOut/mailServerOut.model.js | 2 +- server/api/mailServerOut/mailServerOut.rpc.js | 2 +- server/api/mailSubstatus/index.js | 2 +- .../api/mailSubstatus/mailSubstatus.attributes.js | 2 +- .../api/mailSubstatus/mailSubstatus.controller.js | 2 +- server/api/mailSubstatus/mailSubstatus.events.js | 2 +- server/api/mailSubstatus/mailSubstatus.model.js | 2 +- server/api/mailSubstatus/mailSubstatus.rpc.js | 2 +- server/api/mailTransferReport/index.js | 2 +- .../mailTransferReport.attributes.js | 2 +- .../mailTransferReport.controller.js | 2 +- .../mailTransferReport/mailTransferReport.model.js | 2 +- .../mailTransferReport/mailTransferReport.rpc.js | 2 +- server/api/memberReport/index.js | 2 +- server/api/memberReport/memberReport.attributes.js | 2 +- server/api/memberReport/memberReport.controller.js | 2 +- server/api/memberReport/memberReport.model.js | 2 +- server/api/memberReport/memberReport.rpc.js | 2 +- server/api/migration/index.js | 2 +- server/api/migration/migration.attributes.js | 2 +- server/api/migration/migration.controller.js | 2 +- server/api/migration/migration.model.js | 2 +- server/api/migration/migration.rpc.js | 2 +- server/api/network/index.js | 2 +- server/api/network/network.attributes.js | 2 +- server/api/network/network.controller.js | 2 +- server/api/network/network.model.js | 2 +- server/api/network/network.rpc.js | 2 +- server/api/openchannelAccount/index.js | 2 +- .../openchannelAccount.attributes.js | 2 +- .../openchannelAccount.controller.js | 2 +- .../openchannelAccount.events.js | 2 +- .../openchannelAccount/openchannelAccount.model.js | 2 +- .../openchannelAccount/openchannelAccount.rpc.js | 2 +- .../openchannelAccount.socket.js | 2 +- server/api/openchannelApplication/index.js | 2 +- .../openchannelApplication.attributes.js | 2 +- .../openchannelApplication.controller.js | 2 +- .../openchannelApplication.model.js | 2 +- .../openchannelApplication.rpc.js | 2 +- server/api/openchannelInteraction/index.js | 2 +- .../openchannelInteraction.attributes.js | 2 +- .../openchannelInteraction.controller.js | 2 +- .../openchannelInteraction.events.js | 2 +- .../openchannelInteraction.model.js | 2 +- .../openchannelInteraction.rpc.js | 2 +- .../openchannelInteraction.socket.js | 2 +- server/api/openchannelMessage/index.js | 2 +- .../openchannelMessage.attributes.js | 2 +- .../openchannelMessage.controller.js | 2 +- .../openchannelMessage.events.js | 2 +- .../openchannelMessage/openchannelMessage.model.js | 2 +- .../openchannelMessage/openchannelMessage.rpc.js | 2 +- .../openchannelMessage.socket.js | 2 +- server/api/openchannelQueue/index.js | 2 +- .../openchannelQueue.attributes.js | 2 +- .../openchannelQueue.controller.js | 2 +- .../openchannelQueue/openchannelQueue.events.js | 2 +- .../api/openchannelQueue/openchannelQueue.model.js | 2 +- .../api/openchannelQueue/openchannelQueue.rpc.js | 2 +- .../openchannelQueue/openchannelQueue.socket.js | 2 +- server/api/openchannelQueueReport/index.js | 2 +- .../openchannelQueueReport.attributes.js | 2 +- .../openchannelQueueReport.controller.js | 2 +- .../openchannelQueueReport.model.js | 2 +- .../openchannelQueueReport.rpc.js | 2 +- server/api/openchannelTransferReport/index.js | 2 +- .../openchannelTransferReport.attributes.js | 2 +- .../openchannelTransferReport.controller.js | 2 +- .../openchannelTransferReport.model.js | 2 +- .../openchannelTransferReport.rpc.js | 2 +- server/api/pause/index.js | 2 +- server/api/pause/pause.attributes.js | 2 +- server/api/pause/pause.controller.js | 2 +- server/api/pause/pause.model.js | 2 +- server/api/pause/pause.rpc.js | 2 +- server/api/plugin/index.js | 2 +- server/api/plugin/plugin.attributes.js | 2 +- server/api/plugin/plugin.controller.js | 2 +- server/api/plugin/plugin.events.js | 2 +- server/api/plugin/plugin.model.js | 2 +- server/api/plugin/plugin.rpc.js | 2 +- server/api/plugin/plugin.socket.js | 2 +- server/api/pm2/index.js | 2 +- server/api/pm2/pm2.controller.js | 2 +- server/api/realtime/index.js | 2 +- server/api/realtime/realtime.controller.js | 2 +- server/api/reportAgentPreview/index.js | 2 +- .../reportAgentPreview.attributes.js | 2 +- .../reportAgentPreview/reportAgentPreview.model.js | 2 +- .../reportAgentPreview/reportAgentPreview.rpc.js | 2 +- server/api/rpc/index.js | 2 +- server/api/rpc/rpc.controller.js | 2 +- server/api/schedule/index.js | 2 +- server/api/schedule/schedule.attributes.js | 2 +- server/api/schedule/schedule.controller.js | 2 +- server/api/schedule/schedule.model.js | 2 +- server/api/schedule/schedule.rpc.js | 2 +- server/api/screenRecording/index.js | 2 +- .../screenRecording/screenRecording.attributes.js | 2 +- .../screenRecording/screenRecording.controller.js | 2 +- .../api/screenRecording/screenRecording.model.js | 2 +- server/api/screenRecording/screenRecording.rpc.js | 2 +- server/api/setting/index.js | 2 +- server/api/setting/setting.attributes.js | 2 +- server/api/setting/setting.controller.js | 2 +- server/api/setting/setting.model.js | 2 +- server/api/setting/setting.rpc.js | 2 +- server/api/smsAccount/index.js | 2 +- server/api/smsAccount/smsAccount.attributes.js | 2 +- server/api/smsAccount/smsAccount.controller.js | 2 +- server/api/smsAccount/smsAccount.events.js | 2 +- server/api/smsAccount/smsAccount.model.js | 2 +- server/api/smsAccount/smsAccount.rpc.js | 2 +- server/api/smsAccount/smsAccount.socket.js | 2 +- server/api/smsApplication/index.js | 2 +- .../smsApplication/smsApplication.attributes.js | 2 +- .../smsApplication/smsApplication.controller.js | 2 +- server/api/smsApplication/smsApplication.model.js | 2 +- server/api/smsApplication/smsApplication.rpc.js | 2 +- server/api/smsInteraction/index.js | 2 +- .../smsInteraction/smsInteraction.attributes.js | 2 +- .../smsInteraction/smsInteraction.controller.js | 2 +- server/api/smsInteraction/smsInteraction.events.js | 2 +- server/api/smsInteraction/smsInteraction.model.js | 2 +- server/api/smsInteraction/smsInteraction.rpc.js | 2 +- server/api/smsInteraction/smsInteraction.socket.js | 2 +- server/api/smsMessage/index.js | 2 +- server/api/smsMessage/smsMessage.attributes.js | 2 +- server/api/smsMessage/smsMessage.controller.js | 2 +- server/api/smsMessage/smsMessage.events.js | 2 +- server/api/smsMessage/smsMessage.model.js | 2 +- server/api/smsMessage/smsMessage.rpc.js | 2 +- server/api/smsMessage/smsMessage.socket.js | 2 +- server/api/smsQueue/index.js | 2 +- server/api/smsQueue/smsQueue.attributes.js | 2 +- server/api/smsQueue/smsQueue.controller.js | 2 +- server/api/smsQueue/smsQueue.events.js | 2 +- server/api/smsQueue/smsQueue.model.js | 2 +- server/api/smsQueue/smsQueue.rpc.js | 2 +- server/api/smsQueue/smsQueue.socket.js | 2 +- server/api/smsQueueReport/index.js | 2 +- .../smsQueueReport/smsQueueReport.attributes.js | 2 +- .../smsQueueReport/smsQueueReport.controller.js | 2 +- server/api/smsQueueReport/smsQueueReport.model.js | 2 +- server/api/smsQueueReport/smsQueueReport.rpc.js | 2 +- server/api/smsTransferReport/index.js | 2 +- .../smsTransferReport.attributes.js | 2 +- .../smsTransferReport.controller.js | 2 +- .../smsTransferReport/smsTransferReport.model.js | 2 +- .../api/smsTransferReport/smsTransferReport.rpc.js | 2 +- server/api/sound/index.js | 2 +- server/api/sound/sound.attributes.js | 2 +- server/api/sound/sound.controller.js | 2 +- server/api/sound/sound.model.js | 2 +- server/api/sound/sound.rpc.js | 2 +- server/api/squareMessage/index.js | 2 +- .../api/squareMessage/squareMessage.attributes.js | 2 +- .../api/squareMessage/squareMessage.controller.js | 2 +- server/api/squareMessage/squareMessage.model.js | 2 +- server/api/squareMessage/squareMessage.rpc.js | 2 +- server/api/squareOdbc/index.js | 2 +- server/api/squareOdbc/squareOdbc.attributes.js | 2 +- server/api/squareOdbc/squareOdbc.controller.js | 2 +- server/api/squareOdbc/squareOdbc.model.js | 2 +- server/api/squareOdbc/squareOdbc.rpc.js | 2 +- server/api/squareProject/index.js | 2 +- .../api/squareProject/squareProject.attributes.js | 2 +- .../api/squareProject/squareProject.controller.js | 2 +- server/api/squareProject/squareProject.events.js | 2 +- server/api/squareProject/squareProject.model.js | 2 +- server/api/squareProject/squareProject.rpc.js | 2 +- server/api/squareProject/squareProject.socket.js | 2 +- server/api/squareRecording/index.js | 2 +- .../squareRecording/squareRecording.attributes.js | 2 +- .../squareRecording/squareRecording.controller.js | 2 +- .../api/squareRecording/squareRecording.model.js | 2 +- server/api/squareRecording/squareRecording.rpc.js | 2 +- server/api/squareReport/index.js | 2 +- server/api/squareReport/squareReport.attributes.js | 2 +- server/api/squareReport/squareReport.controller.js | 2 +- server/api/squareReport/squareReport.model.js | 2 +- server/api/squareReport/squareReport.rpc.js | 2 +- server/api/squareReportDetail/index.js | 2 +- .../squareReportDetail.attributes.js | 2 +- .../squareReportDetail.controller.js | 2 +- .../squareReportDetail/squareReportDetail.model.js | 2 +- .../squareReportDetail/squareReportDetail.rpc.js | 2 +- server/api/system/index.js | 2 +- server/api/system/system.controller.js | 2 +- server/api/tag/index.js | 2 +- server/api/tag/tag.attributes.js | 2 +- server/api/tag/tag.controller.js | 2 +- server/api/tag/tag.model.js | 2 +- server/api/tag/tag.rpc.js | 2 +- server/api/team/index.js | 2 +- server/api/team/team.attributes.js | 2 +- server/api/team/team.controller.js | 2 +- server/api/team/team.events.js | 2 +- server/api/team/team.model.js | 2 +- server/api/team/team.rpc.js | 2 +- server/api/team/team.socket.js | 2 +- .../teamVoicePrefix/teamVoicePrefix.attributes.js | 2 +- .../api/teamVoicePrefix/teamVoicePrefix.model.js | 2 +- server/api/teamVoiceQueue/index.js | 2 +- .../teamVoiceQueue/teamVoiceQueue.attributes.js | 2 +- server/api/teamVoiceQueue/teamVoiceQueue.model.js | 2 +- server/api/teamVoiceQueue/teamVoiceQueue.rpc.js | 2 +- server/api/template/index.js | 2 +- server/api/template/template.attributes.js | 2 +- server/api/template/template.controller.js | 2 +- server/api/template/template.model.js | 2 +- server/api/template/template.rpc.js | 2 +- server/api/trigger/index.js | 2 +- server/api/trigger/trigger.attributes.js | 2 +- server/api/trigger/trigger.controller.js | 2 +- server/api/trigger/trigger.model.js | 2 +- server/api/trigger/trigger.rpc.js | 2 +- server/api/trunk/index.js | 2 +- server/api/trunk/trunk.attributes.js | 2 +- server/api/trunk/trunk.controller.js | 2 +- server/api/trunk/trunk.model.js | 2 +- server/api/trunk/trunk.rpc.js | 2 +- server/api/user-setting/index.js | 2 +- server/api/user-setting/user-setting.attributes.js | 2 +- server/api/user-setting/user-setting.controller.js | 2 +- server/api/user-setting/user-setting.events.js | 2 +- server/api/user-setting/user-setting.model.js | 2 +- server/api/user-setting/user-setting.socket.js | 2 +- server/api/user/index.js | 2 +- server/api/user/user.attributes.js | 2 +- server/api/user/user.controller.js | 2 +- server/api/user/user.events.js | 2 +- server/api/user/user.model.js | 2 +- server/api/user/user.rpc.js | 2 +- server/api/user/user.socket.js | 2 +- server/api/userChatQueue/index.js | 2 +- .../api/userChatQueue/userChatQueue.attributes.js | 2 +- server/api/userChatQueue/userChatQueue.model.js | 2 +- server/api/userChatQueue/userChatQueue.rpc.js | 2 +- server/api/userFaxQueue/index.js | 2 +- server/api/userFaxQueue/userFaxQueue.attributes.js | 2 +- server/api/userFaxQueue/userFaxQueue.model.js | 2 +- server/api/userFaxQueue/userFaxQueue.rpc.js | 2 +- server/api/userMailQueue/index.js | 2 +- .../api/userMailQueue/userMailQueue.attributes.js | 2 +- server/api/userMailQueue/userMailQueue.model.js | 2 +- server/api/userMailQueue/userMailQueue.rpc.js | 2 +- server/api/userNotification/index.js | 2 +- .../userNotification.attributes.js | 2 +- .../userNotification.controller.js | 2 +- .../userNotification/userNotification.events.js | 2 +- .../api/userNotification/userNotification.model.js | 2 +- .../api/userNotification/userNotification.rpc.js | 2 +- .../userNotification/userNotification.socket.js | 2 +- server/api/userOpenchannelQueue/index.js | 2 +- .../userOpenchannelQueue.attributes.js | 2 +- .../userOpenchannelQueue.model.js | 2 +- .../userOpenchannelQueue.rpc.js | 2 +- server/api/userProfile/index.js | 2 +- server/api/userProfile/userProfile.attributes.js | 2 +- server/api/userProfile/userProfile.controller.js | 2 +- server/api/userProfile/userProfile.events.js | 2 +- server/api/userProfile/userProfile.model.js | 2 +- server/api/userProfile/userProfile.rpc.js | 2 +- server/api/userProfile/userProfile.socket.js | 2 +- server/api/userProfileResource/index.js | 2 +- .../userProfileResource.attributes.js | 2 +- .../userProfileResource.controller.js | 2 +- .../userProfileResource.model.js | 2 +- .../userProfileResource/userProfileResource.rpc.js | 2 +- server/api/userProfileSection/index.js | 2 +- .../userProfileSection.attributes.js | 2 +- .../userProfileSection.controller.js | 2 +- .../userProfileSection/userProfileSection.model.js | 2 +- .../userProfileSection/userProfileSection.rpc.js | 2 +- server/api/userSmsQueue/index.js | 2 +- server/api/userSmsQueue/userSmsQueue.attributes.js | 2 +- server/api/userSmsQueue/userSmsQueue.model.js | 2 +- server/api/userSmsQueue/userSmsQueue.rpc.js | 2 +- .../userVoicePrefix/userVoicePrefix.attributes.js | 2 +- .../api/userVoicePrefix/userVoicePrefix.model.js | 2 +- server/api/userVoiceQueue/index.js | 2 +- .../userVoiceQueue/userVoiceQueue.attributes.js | 2 +- server/api/userVoiceQueue/userVoiceQueue.model.js | 2 +- server/api/userVoiceQueue/userVoiceQueue.rpc.js | 2 +- server/api/userVoiceQueueRt/index.js | 2 +- .../userVoiceQueueRt.attributes.js | 2 +- .../userVoiceQueueRt/userVoiceQueueRt.events.js | 2 +- .../api/userVoiceQueueRt/userVoiceQueueRt.model.js | 2 +- .../api/userVoiceQueueRt/userVoiceQueueRt.rpc.js | 2 +- .../userVoiceQueueRt/userVoiceQueueRt.socket.js | 2 +- server/api/userWhatsappQueue/index.js | 2 +- .../userWhatsappQueue.attributes.js | 2 +- .../userWhatsappQueue/userWhatsappQueue.model.js | 2 +- .../api/userWhatsappQueue/userWhatsappQueue.rpc.js | 2 +- server/api/variable/index.js | 2 +- server/api/variable/variable.attributes.js | 2 +- server/api/variable/variable.controller.js | 2 +- server/api/variable/variable.model.js | 2 +- server/api/variable/variable.rpc.js | 2 +- server/api/version/index.js | 2 +- server/api/version/version.controller.js | 2 +- server/api/voiceAgentReport/index.js | 2 +- .../voiceAgentReport.attributes.js | 2 +- .../voiceAgentReport.controller.js | 2 +- .../api/voiceAgentReport/voiceAgentReport.model.js | 2 +- .../api/voiceAgentReport/voiceAgentReport.rpc.js | 2 +- server/api/voiceCallReport/index.js | 2 +- .../voiceCallReport/voiceCallReport.attributes.js | 2 +- .../voiceCallReport/voiceCallReport.controller.js | 2 +- .../api/voiceCallReport/voiceCallReport.model.js | 2 +- server/api/voiceCallReport/voiceCallReport.rpc.js | 2 +- server/api/voiceChanSpy/index.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.attributes.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.controller.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.model.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.rpc.js | 2 +- server/api/voiceContext/index.js | 2 +- server/api/voiceContext/voiceContext.attributes.js | 2 +- server/api/voiceContext/voiceContext.controller.js | 2 +- server/api/voiceContext/voiceContext.model.js | 2 +- server/api/voiceContext/voiceContext.rpc.js | 2 +- server/api/voiceDialReport/index.js | 2 +- .../voiceDialReport/voiceDialReport.attributes.js | 2 +- .../voiceDialReport/voiceDialReport.controller.js | 2 +- .../api/voiceDialReport/voiceDialReport.model.js | 2 +- server/api/voiceDialReport/voiceDialReport.rpc.js | 2 +- server/api/voiceExtension/index.js | 2 +- .../voiceExtension/voiceExtension.attributes.js | 2 +- .../voiceExtension/voiceExtension.controller.js | 2 +- server/api/voiceExtension/voiceExtension.events.js | 2 +- server/api/voiceExtension/voiceExtension.model.js | 2 +- server/api/voiceExtension/voiceExtension.rpc.js | 2 +- server/api/voiceExtension/voiceExtension.socket.js | 2 +- server/api/voiceMail/index.js | 2 +- server/api/voiceMail/voiceMail.attributes.js | 2 +- server/api/voiceMail/voiceMail.controller.js | 2 +- server/api/voiceMail/voiceMail.model.js | 2 +- server/api/voiceMail/voiceMail.rpc.js | 2 +- server/api/voiceMailMessage/index.js | 2 +- .../voiceMailMessage.attributes.js | 2 +- .../voiceMailMessage.controller.js | 2 +- .../api/voiceMailMessage/voiceMailMessage.model.js | 2 +- .../api/voiceMailMessage/voiceMailMessage.rpc.js | 2 +- server/api/voiceMusicOnHold/index.js | 2 +- .../voiceMusicOnHold.attributes.js | 2 +- .../voiceMusicOnHold.controller.js | 2 +- .../api/voiceMusicOnHold/voiceMusicOnHold.model.js | 2 +- .../api/voiceMusicOnHold/voiceMusicOnHold.rpc.js | 2 +- server/api/voicePrefix/index.js | 2 +- server/api/voicePrefix/voicePrefix.attributes.js | 2 +- server/api/voicePrefix/voicePrefix.controller.js | 2 +- server/api/voicePrefix/voicePrefix.events.js | 2 +- server/api/voicePrefix/voicePrefix.model.js | 2 +- server/api/voicePrefix/voicePrefix.rpc.js | 2 +- server/api/voicePrefix/voicePrefix.socket.js | 2 +- server/api/voiceQueue/index.js | 2 +- server/api/voiceQueue/voiceQueue.attributes.js | 2 +- server/api/voiceQueue/voiceQueue.controller.js | 2 +- server/api/voiceQueue/voiceQueue.events.js | 2 +- server/api/voiceQueue/voiceQueue.model.js | 2 +- server/api/voiceQueue/voiceQueue.rpc.js | 2 +- server/api/voiceQueue/voiceQueue.socket.js | 2 +- server/api/voiceQueueReport/index.js | 2 +- .../voiceQueueReport.attributes.js | 2 +- .../voiceQueueReport.controller.js | 2 +- .../voiceQueueReport/voiceQueueReport.events.js | 2 +- .../api/voiceQueueReport/voiceQueueReport.model.js | 2 +- .../api/voiceQueueReport/voiceQueueReport.rpc.js | 2 +- .../voiceQueueReport/voiceQueueReport.socket.js | 2 +- server/api/voiceQueuesLog/index.js | 2 +- .../voiceQueuesLog/voiceQueuesLog.attributes.js | 2 +- .../voiceQueuesLog/voiceQueuesLog.controller.js | 2 +- server/api/voiceQueuesLog/voiceQueuesLog.model.js | 2 +- server/api/voiceQueuesLog/voiceQueuesLog.rpc.js | 2 +- server/api/voiceRecording/index.js | 2 +- .../voiceRecording/voiceRecording.attributes.js | 2 +- .../voiceRecording/voiceRecording.controller.js | 2 +- server/api/voiceRecording/voiceRecording.model.js | 2 +- server/api/voiceRecording/voiceRecording.rpc.js | 2 +- server/api/voiceTransferReport/index.js | 2 +- .../voiceTransferReport.attributes.js | 2 +- .../voiceTransferReport.controller.js | 2 +- .../voiceTransferReport.model.js | 2 +- .../voiceTransferReport/voiceTransferReport.rpc.js | 2 +- server/api/webbar/index.js | 2 +- server/api/webbar/webbar.controller.js | 2 +- server/api/whatsappAccount/index.js | 2 +- .../whatsappAccount/whatsappAccount.attributes.js | 2 +- .../whatsappAccount/whatsappAccount.controller.js | 2 +- .../api/whatsappAccount/whatsappAccount.events.js | 2 +- .../api/whatsappAccount/whatsappAccount.model.js | 2 +- server/api/whatsappAccount/whatsappAccount.rpc.js | 2 +- .../api/whatsappAccount/whatsappAccount.socket.js | 2 +- server/api/whatsappApplication/index.js | 2 +- .../whatsappApplication.attributes.js | 2 +- .../whatsappApplication.controller.js | 2 +- .../whatsappApplication.model.js | 2 +- .../whatsappApplication/whatsappApplication.rpc.js | 2 +- server/api/whatsappInteraction/index.js | 2 +- .../whatsappInteraction.attributes.js | 2 +- .../whatsappInteraction.controller.js | 2 +- .../whatsappInteraction.events.js | 2 +- .../whatsappInteraction.model.js | 2 +- .../whatsappInteraction/whatsappInteraction.rpc.js | 2 +- .../whatsappInteraction.socket.js | 2 +- server/api/whatsappMessage/index.js | 2 +- .../whatsappMessage/whatsappMessage.attributes.js | 2 +- .../whatsappMessage/whatsappMessage.controller.js | 2 +- .../api/whatsappMessage/whatsappMessage.events.js | 2 +- .../api/whatsappMessage/whatsappMessage.model.js | 2 +- server/api/whatsappMessage/whatsappMessage.rpc.js | 2 +- .../api/whatsappMessage/whatsappMessage.socket.js | 2 +- server/api/whatsappQueue/index.js | 2 +- .../api/whatsappQueue/whatsappQueue.attributes.js | 2 +- .../api/whatsappQueue/whatsappQueue.controller.js | 2 +- server/api/whatsappQueue/whatsappQueue.events.js | 2 +- server/api/whatsappQueue/whatsappQueue.model.js | 2 +- server/api/whatsappQueue/whatsappQueue.rpc.js | 2 +- server/api/whatsappQueue/whatsappQueue.socket.js | 2 +- server/api/whatsappQueueReport/index.js | 2 +- .../whatsappQueueReport.attributes.js | 2 +- .../whatsappQueueReport.controller.js | 2 +- .../whatsappQueueReport.model.js | 2 +- .../whatsappQueueReport/whatsappQueueReport.rpc.js | 2 +- server/api/whatsappTransferReport/index.js | 2 +- .../whatsappTransferReport.attributes.js | 2 +- .../whatsappTransferReport.controller.js | 2 +- .../whatsappTransferReport.model.js | 2 +- .../whatsappTransferReport.rpc.js | 2 +- server/app.js | 2 +- server/components/auth/service.js | 2 +- server/components/contacts/index.js | 2 +- server/components/contacts/sql-utils.js | 2 +- server/components/encryptor/index.js | 2 +- server/components/export/csv.js | 2 +- server/components/export/pdf.js | 2 +- server/components/export/xlsx.js | 2 +- server/components/extensions/rewrite.js | 2 +- server/components/import/cm/csv.js | 2 +- server/components/import/cm/csv2.js | 2 +- server/components/import/cm/csvUpdates.js | 2 +- server/components/integrations/configuration.js | 2 +- server/components/interaction/service.js | 2 +- server/components/interaction/sql-utils.js | 2 +- .../components/interaction/update-interaction.js | 2 +- server/components/interaction/utils.js | 2 +- server/components/license/service.js | 2 +- server/components/parsers/advancedSearch.js | 2 +- server/components/parsers/qs.js | 2 +- server/components/realtime/agents.js | 2 +- server/components/realtime/queues.js | 2 +- server/config/express.js | 2 +- server/config/license/hardware.js | 2 +- server/config/license/index.js | 2 +- server/config/license/util.js | 2 +- server/config/local.env.js | 2 +- server/config/logger.js | 2 +- server/config/pm2/config.js | 2 +- server/config/pm2/index.js | 2 +- server/config/schedule/chat.js | 2 +- server/config/schedule/cloud-provider.js | 2 +- server/config/schedule/index.js | 2 +- server/config/schedule/transcribe.js | 2 +- server/config/schedule/whatsapp.js | 2 +- server/config/seedContact.js | 2 +- server/config/seedUsers.js | 2 +- server/config/socketio.js | 2 +- server/config/triggers/index.js | 2 +- server/config/utils.js | 2 +- server/errors/api.js | 2 +- server/errors/index.js | 2 +- server/mysqldb/index.js | 2 +- server/routes.js | 2 +- server/rpc/index.js | 2 +- server/services/agi/channel.js | 2 +- server/services/agi/error.js | 2 +- server/services/agi/events.js | 2 +- server/services/agi/graph/index.js | 2 +- server/services/agi/index.js | 2 +- server/services/agi/mailRpc/index.js | 2 +- server/services/agi/project.js | 2 +- server/services/agi/reply.js | 2 +- server/services/agi/rpc/index.js | 2 +- server/services/agi/scripts/aws/index.js | 2 +- server/services/agi/scripts/aws/lex/index.js | 2 +- server/services/agi/scripts/aws/lex/lib/api.js | 2 +- server/services/agi/scripts/aws/polly/index.js | 2 +- server/services/agi/scripts/aws/polly/lib/api.js | 2 +- server/services/agi/scripts/google/asr/index.js | 2 +- server/services/agi/scripts/google/asr/lib/api.js | 2 +- server/services/agi/scripts/google/index.js | 2 +- server/services/agi/scripts/index.js | 2 +- server/services/agi/scripts/sestek/index.js | 2 +- server/services/agi/scripts/sestek/nda/index.js | 2 +- server/services/agi/scripts/tilde/asr/index.js | 2 +- server/services/agi/scripts/tilde/asr/lib/api.js | 2 +- server/services/agi/scripts/tilde/index.js | 2 +- server/services/agi/server.js | 2 +- server/services/agi/vertices.js | 2 +- server/services/ami/acw/index.js | 2 +- server/services/ami/ami.js | 2 +- server/services/ami/client.js | 2 +- server/services/ami/dialer/index.js | 2 +- server/services/ami/dialer/models/action.js | 2 +- server/services/ami/dialer/models/agentComplete.js | 2 +- server/services/ami/dialer/models/final.js | 2 +- server/services/ami/dialer/models/hangup.js | 2 +- server/services/ami/dialer/models/history.js | 2 +- .../ami/dialer/models/queueCallerAbandon.js | 2 +- server/services/ami/dialer/utils/hopper.js | 2 +- server/services/ami/dialer/utils/index.js | 2 +- server/services/ami/fax/action.js | 2 +- server/services/ami/fax/index.js | 2 +- server/services/ami/fax/rpcDb.js | 2 +- server/services/ami/fax/util/gs.js | 2 +- server/services/ami/fax/util/util.js | 2 +- server/services/ami/index.js | 2 +- server/services/ami/model/agent.js | 2 +- server/services/ami/model/campaign.js | 2 +- server/services/ami/model/channel.js | 2 +- server/services/ami/model/deskAccount.js | 2 +- server/services/ami/model/dynamics365Account.js | 2 +- server/services/ami/model/faxAccount.js | 2 +- server/services/ami/model/freshdeskAccount.js | 2 +- server/services/ami/model/freshsalesAccount.js | 2 +- server/services/ami/model/queueReport.js | 2 +- server/services/ami/model/salesforceAccount.js | 2 +- server/services/ami/model/servicenowAccount.js | 2 +- server/services/ami/model/sugarcrmAccount.js | 2 +- server/services/ami/model/telephone.js | 2 +- server/services/ami/model/template.js | 2 +- server/services/ami/model/trigger.js | 2 +- server/services/ami/model/trunk.js | 2 +- server/services/ami/model/voiceExtension.js | 2 +- server/services/ami/model/voiceQueue.js | 2 +- server/services/ami/model/voiceQueueSummary.js | 2 +- server/services/ami/model/vtigerAccount.js | 2 +- server/services/ami/model/zendeskAccount.js | 2 +- server/services/ami/model/zohoAccount.js | 2 +- server/services/ami/preview/action.js | 2 +- server/services/ami/preview/index.js | 2 +- server/services/ami/preview/rpcDb.js | 2 +- server/services/ami/preview/util/util.js | 2 +- server/services/ami/properties.js | 2 +- server/services/ami/realtime/index.js | 2 +- server/services/ami/realtime/utils.js | 2 +- server/services/ami/report/index.js | 2 +- server/services/ami/report/userReport.js | 2 +- server/services/ami/report/voiceAgentReport.js | 2 +- server/services/ami/report/voiceCallReport.js | 2 +- server/services/ami/report/voiceDialReport.js | 2 +- server/services/ami/report/voiceQueueReport.js | 2 +- server/services/ami/rpc/agentReportPreview.js | 2 +- server/services/ami/rpc/attachment.js | 2 +- server/services/ami/rpc/campaign.js | 2 +- server/services/ami/rpc/cmContact.js | 2 +- server/services/ami/rpc/cmHopper.js | 2 +- server/services/ami/rpc/cmHopperAdditionalPhone.js | 2 +- server/services/ami/rpc/cmHopperBlack.js | 2 +- server/services/ami/rpc/cmHopperFinal.js | 2 +- server/services/ami/rpc/cmHopperHistory.js | 2 +- server/services/ami/rpc/faxAccount.js | 2 +- server/services/ami/rpc/faxMessage.js | 2 +- server/services/ami/rpc/integrations/desk.js | 2 +- .../services/ami/rpc/integrations/dynamics365.js | 2 +- server/services/ami/rpc/integrations/freshdesk.js | 2 +- server/services/ami/rpc/integrations/freshsales.js | 2 +- server/services/ami/rpc/integrations/salesforce.js | 2 +- server/services/ami/rpc/integrations/servicenow.js | 2 +- server/services/ami/rpc/integrations/sugarcrm.js | 2 +- server/services/ami/rpc/integrations/vtiger.js | 2 +- server/services/ami/rpc/integrations/zendesk.js | 2 +- server/services/ami/rpc/integrations/zoho.js | 2 +- server/services/ami/rpc/interval.js | 2 +- server/services/ami/rpc/memberReport.js | 2 +- server/services/ami/rpc/setting.js | 2 +- server/services/ami/rpc/template.js | 2 +- server/services/ami/rpc/trigger.js | 2 +- server/services/ami/rpc/trunk.js | 2 +- server/services/ami/rpc/user.js | 2 +- server/services/ami/rpc/voiceAgentReport.js | 2 +- server/services/ami/rpc/voiceCallReport.js | 2 +- server/services/ami/rpc/voiceDialReport.js | 2 +- server/services/ami/rpc/voiceExtension.js | 2 +- server/services/ami/rpc/voiceQueue.js | 2 +- server/services/ami/rpc/voiceQueueReport.js | 2 +- server/services/ami/rpc/voiceQueueRt.js | 2 +- server/services/ami/rpc/voiceRecording.js | 2 +- server/services/ami/rpc/voiceTransferReport.js | 2 +- server/services/ami/server/index.js | 2 +- server/services/ami/trigger/cmContact/index.js | 2 +- server/services/ami/trigger/index.js | 2 +- server/services/ami/trigger/integration/desk.js | 2 +- .../ami/trigger/integration/dynamics365.js | 2 +- .../services/ami/trigger/integration/freshdesk.js | 2 +- .../services/ami/trigger/integration/freshsales.js | 2 +- server/services/ami/trigger/integration/index.js | 2 +- .../services/ami/trigger/integration/salesforce.js | 2 +- .../services/ami/trigger/integration/servicenow.js | 2 +- .../services/ami/trigger/integration/sugarcrm.js | 2 +- server/services/ami/trigger/integration/util.js | 2 +- server/services/ami/trigger/integration/vtiger.js | 2 +- server/services/ami/trigger/integration/zendesk.js | 2 +- server/services/ami/trigger/integration/zoho.js | 2 +- server/services/ami/trigger/script/index.js | 2 +- server/services/ami/trigger/urlforward/index.js | 2 +- server/services/email/client.js | 2 +- server/services/email/index.js | 2 +- server/services/email/lib/email.js | 2 +- server/services/email/lib/imap.js | 2 +- server/services/email/lib/smtp.js | 2 +- server/services/email/lib/utils.js | 2 +- server/services/email/model/mailAccount.js | 2 +- server/services/email/realtime/index.js | 2 +- server/services/email/rpc/mailAccount.js | 2 +- server/services/email/rpc/setting.js | 2 +- server/services/email/server/index.js | 2 +- server/services/express/index.js | 2 +- server/services/routing/client.js | 2 +- server/services/routing/index.js | 2 +- server/services/routing/lib/rule-engine.js | 2 +- server/services/routing/mailRpc/index.js | 2 +- server/services/routing/model/agent.js | 2 +- server/services/routing/model/chatQueue.js | 2 +- server/services/routing/model/faxQueue.js | 2 +- server/services/routing/model/interval.js | 2 +- server/services/routing/model/mailQueue.js | 2 +- server/services/routing/model/openchannelQueue.js | 2 +- server/services/routing/model/smsQueue.js | 2 +- server/services/routing/model/whatsappQueue.js | 2 +- server/services/routing/realtime/index.js | 2 +- server/services/routing/rpc/chatInteraction.js | 2 +- server/services/routing/rpc/chatMessage.js | 2 +- server/services/routing/rpc/chatQueue.js | 2 +- server/services/routing/rpc/chatQueueReport.js | 2 +- server/services/routing/rpc/faxInteraction.js | 2 +- server/services/routing/rpc/faxMessage.js | 2 +- server/services/routing/rpc/faxQueue.js | 2 +- server/services/routing/rpc/faxQueueReport.js | 2 +- server/services/routing/rpc/interval.js | 2 +- server/services/routing/rpc/mailInteraction.js | 2 +- server/services/routing/rpc/mailMessage.js | 2 +- server/services/routing/rpc/mailQueue.js | 2 +- server/services/routing/rpc/mailQueueReport.js | 2 +- .../services/routing/rpc/openchannelInteraction.js | 2 +- server/services/routing/rpc/openchannelMessage.js | 2 +- server/services/routing/rpc/openchannelQueue.js | 2 +- .../services/routing/rpc/openchannelQueueReport.js | 2 +- server/services/routing/rpc/smsInteraction.js | 2 +- server/services/routing/rpc/smsMessage.js | 2 +- server/services/routing/rpc/smsQueue.js | 2 +- server/services/routing/rpc/smsQueueReport.js | 2 +- server/services/routing/rpc/user.js | 2 +- server/services/routing/rpc/whatsappInteraction.js | 2 +- server/services/routing/rpc/whatsappMessage.js | 2 +- server/services/routing/rpc/whatsappQueue.js | 2 +- server/services/routing/rpc/whatsappQueueReport.js | 2 +- .../services/routing/server/applications/agent.js | 2 +- .../routing/server/applications/amazonlex.js | 2 +- .../routing/server/applications/autoreply.js | 2 +- .../services/routing/server/applications/close.js | 2 +- .../routing/server/applications/dialogflow.js | 2 +- .../routing/server/applications/dialogflowV2.js | 2 +- .../services/routing/server/applications/gotoif.js | 2 +- .../services/routing/server/applications/gotop.js | 2 +- .../routing/server/applications/message.js | 2 +- .../services/routing/server/applications/noop.js | 2 +- .../services/routing/server/applications/queue.js | 2 +- .../routing/server/applications/strategy/agent.js | 2 +- .../server/applications/strategy/beepall.js | 2 +- .../routing/server/applications/strategy/index.js | 2 +- .../server/applications/strategy/rrmemory.js | 2 +- .../routing/server/applications/strategy/util.js | 2 +- .../services/routing/server/applications/system.js | 2 +- server/services/routing/server/applications/tag.js | 2 +- .../services/routing/server/applications/tvox.js | 2 +- .../services/routing/server/applications/utils.js | 2 +- server/services/routing/server/index.js | 2 +- server/services/routing/server/interval.js | 2 +- server/services/xdr/agents.controller.js | 2 +- server/services/xdr/calls.controller.js | 2 +- server/services/xdr/core.controller.js | 2 +- server/services/xdr/dials.controller.js | 2 +- server/services/xdr/index.js | 2 +- server/services/xdr/members.controller.js | 2 +- server/services/xdr/queues.controller.js | 2 +- server/services/xdr/recordings.controller.js | 2 +- server/services/xdr/transfers.controller.js | 2 +- server/services/xdr/utils.js | 2 +- server/utils/client-side-logger.js | 2 +- server/utils/iftime.js | 2 +- server/utils/loggers.js | 2 +- server/utils/mask-sensitive-data.js | 2 +- server/utils/safe-template.js | 2 +- server/utils/update-app-config.js | 2 +- 1203 files changed, 1203 insertions(+), 1203 deletions(-) diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 744b0f6..254e9d3 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-07-05T07:11:01.013Z", + "time": "2022-07-05T08:23:27.507Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 2682258..c5859e2 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-07-05T07:11:01.013Z", + "time": "2022-07-05T08:23:27.507Z", "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 f78e7d7..92986e9 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 _0x56e3=['urlForward[body]','sequelize','exports','VIRTUAL','action','contactManager','integration','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','TEXT'];(function(_0x1a7550,_0x1edace){var _0x426e22=function(_0x1c10a1){while(--_0x1c10a1){_0x1a7550['push'](_0x1a7550['shift']());}};_0x426e22(++_0x1edace);}(_0x56e3,0xb5));var _0x356e=function(_0x2161fe,_0x160cbb){_0x2161fe=_0x2161fe-0x0;var _0x1758e0=_0x56e3[_0x2161fe];return _0x1758e0;};'use strict';var Sequelize=require(_0x356e('0x0'));module[_0x356e('0x1')]={'name':{'type':Sequelize[_0x356e('0x2')],'get':function(_0x2df176){return this['getDataValue'](_0x356e('0x3'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x356e('0x4'),_0x356e('0x5'),'motionbar','jscripty',_0x356e('0x6'),_0x356e('0x7'),_0x356e('0x8'),_0x356e('0x9')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x356e('0xa')},'data1':{'type':Sequelize[_0x356e('0xb')](0x1000),'comment':_0x356e('0xc')},'data2':{'type':Sequelize[_0x356e('0xb')](0x1000),'comment':_0x356e('0xd')},'data3':{'type':Sequelize[_0x356e('0xb')](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize[_0x356e('0xb')](0x1000),'comments':_0x356e('0xe')},'data5':{'type':Sequelize[_0x356e('0xb')](0x1000),'comments':_0x356e('0xf')},'data6':{'type':Sequelize['STRING'],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0x356e('0x10')],'comments':_0x356e('0x11')}}; \ No newline at end of file +var _0x5ede=['Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','TEXT','sequelize','getDataValue','STRING','contactManager','integration','motionbar','jscripty','script'];(function(_0x273e48,_0x4b4339){var _0x3b8e3f=function(_0x4ec17e){while(--_0x4ec17e){_0x273e48['push'](_0x273e48['shift']());}};_0x3b8e3f(++_0x4b4339);}(_0x5ede,0x13a));var _0xe5ed=function(_0x4386bb,_0x31bdd4){_0x4386bb=_0x4386bb-0x0;var _0xe5e733=_0x5ede[_0x4386bb];return _0xe5e733;};'use strict';var Sequelize=require(_0xe5ed('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2df64a){return this[_0xe5ed('0x1')]('action');}},'action':{'type':Sequelize[_0xe5ed('0x2')],'allowNull':![],'validate':{'isIn':{'args':[[_0xe5ed('0x3'),_0xe5ed('0x4'),_0xe5ed('0x5'),_0xe5ed('0x6'),'urlForward','browser','bot',_0xe5ed('0x7')]],'msg':_0xe5ed('0x8')}},'comment':_0xe5ed('0x8')},'data1':{'type':Sequelize[_0xe5ed('0x2')](0x1000),'comment':_0xe5ed('0x9')},'data2':{'type':Sequelize[_0xe5ed('0x2')](0x1000),'comment':_0xe5ed('0xa')},'data3':{'type':Sequelize[_0xe5ed('0x2')](0x1000),'comment':_0xe5ed('0xb')},'data4':{'type':Sequelize[_0xe5ed('0x2')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0xe5ed('0xc')},'data6':{'type':Sequelize['STRING'],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0xe5ed('0xd')],'comments':'urlForward[body]'}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 090ae27..9e86ea1 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 _0xbb27=['querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','undefined','count','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','body','Action','find','params','catch','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js'];(function(_0x43aee5,_0x11268b){var _0x76d1d0=function(_0x3faee6){while(--_0x3faee6){_0x43aee5['push'](_0x43aee5['shift']());}};_0x76d1d0(++_0x11268b);}(_0xbb27,0x170));var _0x7bb2=function(_0x2cd1e4,_0x23d906){_0x2cd1e4=_0x2cd1e4-0x0;var _0x167374=_0xbb27[_0x2cd1e4];return _0x167374;};'use strict';var emlformat=require(_0x7bb2('0x0'));var rimraf=require(_0x7bb2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7bb2('0x2'));var rp=require(_0x7bb2('0x3'));var moment=require(_0x7bb2('0x4'));var BPromise=require(_0x7bb2('0x5'));var Mustache=require(_0x7bb2('0x6'));var util=require(_0x7bb2('0x7'));var path=require('path');var sox=require(_0x7bb2('0x8'));var csv=require(_0x7bb2('0x9'));var ejs=require(_0x7bb2('0xa'));var fs=require('fs');var fs_extra=require(_0x7bb2('0xb'));var _=require(_0x7bb2('0xc'));var squel=require('squel');var crypto=require(_0x7bb2('0xd'));var jsforce=require(_0x7bb2('0xe'));var deskjs=require(_0x7bb2('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7bb2('0x10'));var Papa=require(_0x7bb2('0x11'));var Redis=require(_0x7bb2('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7bb2('0x13'));var as=require(_0x7bb2('0x14'));var hardwareService=require(_0x7bb2('0x15'));var logger=require(_0x7bb2('0x16'))('api');var utils=require(_0x7bb2('0x17'));var config=require(_0x7bb2('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x7bb2('0x19'))['db'];function respondWithStatusCode(_0x53491b,_0x9f000f){_0x9f000f=_0x9f000f||0xcc;return function(_0x41a0b9){if(_0x41a0b9){return _0x53491b['sendStatus'](_0x9f000f);}return _0x53491b[_0x7bb2('0x1a')](_0x9f000f)[_0x7bb2('0x1b')]();};}function respondWithResult(_0x500e2b,_0x409f64){_0x409f64=_0x409f64||0xc8;return function(_0x1c3eb7){if(_0x1c3eb7){return _0x500e2b['status'](_0x409f64)[_0x7bb2('0x1c')](_0x1c3eb7);}};}function respondWithFilteredResult(_0x1fe501,_0x385180){return function(_0x2c9048){if(_0x2c9048){var _0x2a994d=typeof _0x385180[_0x7bb2('0x1d')]==='undefined'&&typeof _0x385180[_0x7bb2('0x1e')]===_0x7bb2('0x1f');var _0x334d1f=_0x2c9048[_0x7bb2('0x20')];var _0x520bc2=_0x2a994d?0x0:_0x385180['offset'];var _0x318118=_0x2a994d?_0x2c9048[_0x7bb2('0x20')]:_0x385180['offset']+_0x385180[_0x7bb2('0x1e')];var _0x19e315;if(_0x318118>=_0x334d1f){_0x318118=_0x334d1f;_0x19e315=0xc8;}else{_0x19e315=0xce;}_0x1fe501[_0x7bb2('0x1a')](_0x19e315);return _0x1fe501['set']('Content-Range',_0x520bc2+'-'+_0x318118+'/'+_0x334d1f)[_0x7bb2('0x1c')](_0x2c9048);}return null;};}function patchUpdates(_0x108b9c){return function(_0x3d6f9f){try{jsonpatch[_0x7bb2('0x21')](_0x3d6f9f,_0x108b9c,!![]);}catch(_0x2ae8ad){return BPromise[_0x7bb2('0x22')](_0x2ae8ad);}return _0x3d6f9f['save']();};}function saveUpdates(_0x564128,_0x405117){return function(_0x5eff19){if(_0x5eff19){return _0x5eff19[_0x7bb2('0x23')](_0x564128)[_0x7bb2('0x24')](function(_0x27f53f){return _0x27f53f;});}return null;};}function removeEntity(_0x4c525d,_0x2df420){return function(_0x6fd6b7){if(_0x6fd6b7){return _0x6fd6b7[_0x7bb2('0x25')]()[_0x7bb2('0x24')](function(){_0x4c525d[_0x7bb2('0x1a')](0xcc)[_0x7bb2('0x1b')]();});}};}function handleEntityNotFound(_0x54254d,_0x375df3){return function(_0x30cbef){if(!_0x30cbef){_0x54254d[_0x7bb2('0x26')](0x194);}return _0x30cbef;};}function handleError(_0x5ea822,_0x389ee5){_0x389ee5=_0x389ee5||0x1f4;return function(_0x43b5ce){logger[_0x7bb2('0x27')](_0x43b5ce[_0x7bb2('0x28')]);if(_0x43b5ce[_0x7bb2('0x29')]){delete _0x43b5ce['name'];}_0x5ea822[_0x7bb2('0x1a')](_0x389ee5)[_0x7bb2('0x2a')](_0x43b5ce);};}exports[_0x7bb2('0x23')]=function(_0x5d3067,_0x2d17c4){if(_0x5d3067[_0x7bb2('0x2b')]['id']){delete _0x5d3067[_0x7bb2('0x2b')]['id'];}return db[_0x7bb2('0x2c')][_0x7bb2('0x2d')]({'where':{'id':_0x5d3067[_0x7bb2('0x2e')]['id']}})[_0x7bb2('0x24')](handleEntityNotFound(_0x2d17c4,null))[_0x7bb2('0x24')](saveUpdates(_0x5d3067[_0x7bb2('0x2b')],null))['then'](respondWithResult(_0x2d17c4,null))[_0x7bb2('0x2f')](handleError(_0x2d17c4,null));};exports[_0x7bb2('0x25')]=function(_0x3f36ea,_0x1bad1f){return db['Action'][_0x7bb2('0x2d')]({'where':{'id':_0x3f36ea[_0x7bb2('0x2e')]['id']}})[_0x7bb2('0x24')](handleEntityNotFound(_0x1bad1f,null))['then'](removeEntity(_0x1bad1f,null))[_0x7bb2('0x2f')](handleError(_0x1bad1f,null));}; \ No newline at end of file +var _0xee95=['status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','error','name','send','update','body','Action','find','catch','params','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xee95,0x150));var _0x5ee9=function(_0x2d1341,_0x36dce5){_0x2d1341=_0x2d1341-0x0;var _0x112b70=_0xee95[_0x2d1341];return _0x112b70;};'use strict';var emlformat=require(_0x5ee9('0x0'));var rimraf=require(_0x5ee9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5ee9('0x2'));var rp=require(_0x5ee9('0x3'));var moment=require(_0x5ee9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5ee9('0x5'));var util=require(_0x5ee9('0x6'));var path=require('path');var sox=require(_0x5ee9('0x7'));var csv=require('to-csv');var ejs=require(_0x5ee9('0x8'));var fs=require('fs');var fs_extra=require(_0x5ee9('0x9'));var _=require(_0x5ee9('0xa'));var squel=require('squel');var crypto=require(_0x5ee9('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5ee9('0xc'));var toCsv=require(_0x5ee9('0xd'));var querystring=require('querystring');var Papa=require(_0x5ee9('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5ee9('0xf'));var as=require(_0x5ee9('0x10'));var hardwareService=require(_0x5ee9('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x5ee9('0x12'));var config=require(_0x5ee9('0x13'));var licenseUtil=require(_0x5ee9('0x14'));var db=require(_0x5ee9('0x15'))['db'];function respondWithStatusCode(_0x58c6ff,_0x37abd2){_0x37abd2=_0x37abd2||0xcc;return function(_0x16e720){if(_0x16e720){return _0x58c6ff[_0x5ee9('0x16')](_0x37abd2);}return _0x58c6ff['status'](_0x37abd2)[_0x5ee9('0x17')]();};}function respondWithResult(_0x1c9362,_0xea5588){_0xea5588=_0xea5588||0xc8;return function(_0xc15afb){if(_0xc15afb){return _0x1c9362[_0x5ee9('0x18')](_0xea5588)[_0x5ee9('0x19')](_0xc15afb);}};}function respondWithFilteredResult(_0xb073fa,_0x58f01d){return function(_0x53622a){if(_0x53622a){var _0x5d6a0d=typeof _0x58f01d[_0x5ee9('0x1a')]===_0x5ee9('0x1b')&&typeof _0x58f01d[_0x5ee9('0x1c')]===_0x5ee9('0x1b');var _0x1ce21b=_0x53622a[_0x5ee9('0x1d')];var _0xa93d5f=_0x5d6a0d?0x0:_0x58f01d[_0x5ee9('0x1a')];var _0x4e8b4a=_0x5d6a0d?_0x53622a['count']:_0x58f01d[_0x5ee9('0x1a')]+_0x58f01d[_0x5ee9('0x1c')];var _0x117caa;if(_0x4e8b4a>=_0x1ce21b){_0x4e8b4a=_0x1ce21b;_0x117caa=0xc8;}else{_0x117caa=0xce;}_0xb073fa[_0x5ee9('0x18')](_0x117caa);return _0xb073fa['set'](_0x5ee9('0x1e'),_0xa93d5f+'-'+_0x4e8b4a+'/'+_0x1ce21b)['json'](_0x53622a);}return null;};}function patchUpdates(_0xc5d143){return function(_0x1e7ec1){try{jsonpatch[_0x5ee9('0x1f')](_0x1e7ec1,_0xc5d143,!![]);}catch(_0x5d13b4){return BPromise[_0x5ee9('0x20')](_0x5d13b4);}return _0x1e7ec1[_0x5ee9('0x21')]();};}function saveUpdates(_0x3eff2a,_0x1cea79){return function(_0x1ba592){if(_0x1ba592){return _0x1ba592['update'](_0x3eff2a)[_0x5ee9('0x22')](function(_0xc43a7b){return _0xc43a7b;});}return null;};}function removeEntity(_0x2545ff,_0x3a8bb9){return function(_0x5c6a4b){if(_0x5c6a4b){return _0x5c6a4b[_0x5ee9('0x23')]()[_0x5ee9('0x22')](function(){_0x2545ff['status'](0xcc)[_0x5ee9('0x17')]();});}};}function handleEntityNotFound(_0x57fc0c,_0x13e6ab){return function(_0x29ca92){if(!_0x29ca92){_0x57fc0c[_0x5ee9('0x16')](0x194);}return _0x29ca92;};}function handleError(_0x16ab6b,_0x1e2dc5){_0x1e2dc5=_0x1e2dc5||0x1f4;return function(_0x515640){logger[_0x5ee9('0x24')](_0x515640['stack']);if(_0x515640[_0x5ee9('0x25')]){delete _0x515640[_0x5ee9('0x25')];}_0x16ab6b[_0x5ee9('0x18')](_0x1e2dc5)[_0x5ee9('0x26')](_0x515640);};}exports[_0x5ee9('0x27')]=function(_0x3626a5,_0x56c29d){if(_0x3626a5[_0x5ee9('0x28')]['id']){delete _0x3626a5[_0x5ee9('0x28')]['id'];}return db[_0x5ee9('0x29')][_0x5ee9('0x2a')]({'where':{'id':_0x3626a5['params']['id']}})[_0x5ee9('0x22')](handleEntityNotFound(_0x56c29d,null))[_0x5ee9('0x22')](saveUpdates(_0x3626a5[_0x5ee9('0x28')],null))[_0x5ee9('0x22')](respondWithResult(_0x56c29d,null))[_0x5ee9('0x2b')](handleError(_0x56c29d,null));};exports[_0x5ee9('0x23')]=function(_0x124702,_0x1bab97){return db[_0x5ee9('0x29')][_0x5ee9('0x2a')]({'where':{'id':_0x124702[_0x5ee9('0x2c')]['id']}})[_0x5ee9('0x22')](handleEntityNotFound(_0x1bab97,null))['then'](removeEntity(_0x1bab97,null))['catch'](handleError(_0x1bab97,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 51fe5b5..c6ce16e 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 _0x318d=['bluebird','request-promise','path','./action.attributes','define','Action','tools_actions','lodash','util'];(function(_0x171f16,_0x25855a){var _0x52b76c=function(_0x310e6d){while(--_0x310e6d){_0x171f16['push'](_0x171f16['shift']());}};_0x52b76c(++_0x25855a);}(_0x318d,0xbb));var _0xd318=function(_0x1f5067,_0x2e995a){_0x1f5067=_0x1f5067-0x0;var _0x4c21d4=_0x318d[_0x1f5067];return _0x4c21d4;};'use strict';var _=require(_0xd318('0x0'));var util=require(_0xd318('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xd318('0x2'));var rp=require(_0xd318('0x3'));var fs=require('fs');var path=require(_0xd318('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd318('0x5'));module['exports']=function(_0x5aca2a,_0x4bb064){return _0x5aca2a[_0xd318('0x6')](_0xd318('0x7'),attributes,{'tableName':_0xd318('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x537a=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','exports','Action','tools_actions','util'];(function(_0x153d48,_0x13d8bd){var _0x1954cc=function(_0x3152bd){while(--_0x3152bd){_0x153d48['push'](_0x153d48['shift']());}};_0x1954cc(++_0x13d8bd);}(_0x537a,0x1ac));var _0xa537=function(_0x58e35f,_0x105022){_0x58e35f=_0x58e35f-0x0;var _0x475308=_0x537a[_0x58e35f];return _0x475308;};'use strict';var _=require('lodash');var util=require(_0xa537('0x0'));var logger=require(_0xa537('0x1'))(_0xa537('0x2'));var moment=require(_0xa537('0x3'));var BPromise=require(_0xa537('0x4'));var rp=require(_0xa537('0x5'));var fs=require('fs');var path=require(_0xa537('0x6'));var rimraf=require(_0xa537('0x7'));var config=require(_0xa537('0x8'));var attributes=require(_0xa537('0x9'));module[_0xa537('0xa')]=function(_0x5e7487,_0x1f8c26){return _0x5e7487['define'](_0xa537('0xb'),attributes,{'tableName':_0xa537('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 233a19a..5a99baf 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 _0x5fab=['../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Action,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1d4fb5,_0x205c2f){var _0x566c83=function(_0x33fe30){while(--_0x33fe30){_0x1d4fb5['push'](_0x1d4fb5['shift']());}};_0x566c83(++_0x205c2f);}(_0x5fab,0x177));var _0xb5fa=function(_0x4f08dd,_0x3784ec){_0x4f08dd=_0x4f08dd-0x0;var _0x3017ee=_0x5fab[_0x4f08dd];return _0x3017ee;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d70f6,_0x2e3804,_0x1aec3e){return new BPromise(function(_0x9c7bce,_0x56d018){return client[_0xb5fa('0xc')](_0x5d70f6,_0x1aec3e)[_0xb5fa('0xd')](function(_0x2cf4a5){logger['info']('Action,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));logger[_0xb5fa('0xf')](_0xb5fa('0x10'),_0x2e3804,_0xb5fa('0xe'),JSON[_0xb5fa('0x11')](_0x2cf4a5));if(_0x2cf4a5[_0xb5fa('0x12')]){if(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x13')]===0x1f4){logger[_0xb5fa('0x12')]('Action,\x20%s,\x20%s',_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x56d018(_0x2cf4a5['error'][_0xb5fa('0x14')]);}logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x9c7bce(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);}else{logger['info']('Action,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));_0x9c7bce(_0x2cf4a5[_0xb5fa('0x16')][_0xb5fa('0x14')]);}})[_0xb5fa('0x17')](function(_0x56fe10){logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x56fe10);_0x56d018(_0x56fe10);});});} \ No newline at end of file +var _0x53ec=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','stringify','code'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x53ec,0x192));var _0xc53e=function(_0x3f0b2a,_0x52f963){_0x3f0b2a=_0x3f0b2a-0x0;var _0x23bd63=_0x53ec[_0x3f0b2a];return _0x23bd63;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var moment=require(_0xc53e('0x2'));var BPromise=require(_0xc53e('0x3'));var rs=require(_0xc53e('0x4'));var fs=require('fs');var Redis=require(_0xc53e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc53e('0x6'));var logger=require('../../config/logger')(_0xc53e('0x7'));var config=require(_0xc53e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc53e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a9e8,_0x2de88b,_0x5d3b28){return new BPromise(function(_0x1616ac,_0x1ac6c0){return client[_0xc53e('0xa')](_0x41a9e8,_0x5d3b28)[_0xc53e('0xb')](function(_0xd9612){logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));logger[_0xc53e('0xf')]('Action,\x20%s,\x20%s,\x20%s',_0x2de88b,'request\x20sent',JSON[_0xc53e('0x10')](_0xd9612));if(_0xd9612['error']){if(_0xd9612['error'][_0xc53e('0x11')]===0x1f4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')]['message']);return _0x1ac6c0(_0xd9612['error'][_0xc53e('0x13')]);}logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);return _0x1616ac(_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);}else{logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));_0x1616ac(_0xd9612['result'][_0xc53e('0x13')]);}})[_0xc53e('0x14')](function(_0x535cd4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0x535cd4);_0x1ac6c0(_0x535cd4);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 4d5d0d4..a5a2a79 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 _0x0495=['../../components/interaction/service','../../config/environment','./action.controller','put','/:id','update','delete','isAuthenticated','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x3cf5a3,_0x5a4492){var _0x39ba2d=function(_0x3ed989){while(--_0x3ed989){_0x3cf5a3['push'](_0x3cf5a3['shift']());}};_0x39ba2d(++_0x5a4492);}(_0x0495,0x1a9));var _0x5049=function(_0x468a12,_0x4573){_0x468a12=_0x468a12-0x0;var _0x260052=_0x0495[_0x468a12];return _0x260052;};'use strict';var multer=require(_0x5049('0x0'));var util=require(_0x5049('0x1'));var path=require(_0x5049('0x2'));var timeout=require(_0x5049('0x3'));var express=require(_0x5049('0x4'));var router=express['Router']();var fs_extra=require(_0x5049('0x5'));var auth=require(_0x5049('0x6'));var interaction=require(_0x5049('0x7'));var config=require(_0x5049('0x8'));var controller=require(_0x5049('0x9'));router[_0x5049('0xa')](_0x5049('0xb'),auth['isAuthenticated'](),controller[_0x5049('0xc')]);router[_0x5049('0xd')](_0x5049('0xb'),auth[_0x5049('0xe')](),controller['destroy']);module[_0x5049('0xf')]=router; \ No newline at end of file +var _0x77ba=['delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','put','update'];(function(_0x25248b,_0x3c8491){var _0x509939=function(_0x457a27){while(--_0x457a27){_0x25248b['push'](_0x25248b['shift']());}};_0x509939(++_0x3c8491);}(_0x77ba,0x154));var _0xa77b=function(_0x207a02,_0x278c56){_0x207a02=_0x207a02-0x0;var _0xd995c3=_0x77ba[_0x207a02];return _0xd995c3;};'use strict';var multer=require(_0xa77b('0x0'));var util=require(_0xa77b('0x1'));var path=require(_0xa77b('0x2'));var timeout=require(_0xa77b('0x3'));var express=require('express');var router=express[_0xa77b('0x4')]();var fs_extra=require(_0xa77b('0x5'));var auth=require(_0xa77b('0x6'));var interaction=require(_0xa77b('0x7'));var config=require(_0xa77b('0x8'));var controller=require('./action.controller');router[_0xa77b('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xa77b('0xa')]);router[_0xa77b('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xa77b('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index c76fff3..1a8243e 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 _0xdbf5=['exports','STRING','TEXT'];(function(_0x255684,_0x10375e){var _0x54749e=function(_0x226132){while(--_0x226132){_0x255684['push'](_0x255684['shift']());}};_0x54749e(++_0x10375e);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x472918,_0x245ab0){_0x472918=_0x472918-0x0;var _0x17db19=_0xdbf5[_0x472918];return _0x17db19;};'use strict';var Sequelize=require('sequelize');module[_0x5dbf('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x5dbf('0x1')]},'table':{'type':Sequelize[_0x5dbf('0x1')]},'conditions':{'type':Sequelize[_0x5dbf('0x2')]},'joins':{'type':Sequelize[_0x5dbf('0x2')]}}; \ No newline at end of file +var _0x2675=['sequelize','STRING','TEXT'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0x2675,0x75));var _0x5267=function(_0x303f87,_0x1e0f6b){_0x303f87=_0x303f87-0x0;var _0x3c3226=_0x2675[_0x303f87];return _0x3c3226;};'use strict';var Sequelize=require(_0x5267('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x5267('0x1')]},'table':{'type':Sequelize[_0x5267('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x5267('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index e1249f8..afe0c40 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 _0x0f74=['crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','count','limit','set','apply','reject','save','update','then','get','CustomReports','UserProfileResource','destroy','end','error','stack','name','send','index','rawAttributes','type','key','model','map','query','filters','intersection','attributes','fields','length','order','sort','where','filter','merge','options','includeAll','include','AnalyticCustomReport','findAll','rows','catch','show','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','userProfileId','autoAssociation','find','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','from','table','MetricId','function','replace','format','orderBy','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','field','keyBy','groupBy','alias','clone','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','fork','../../components/export/','../../files/reports','savename','COUNT(*)','runReport','ValidationErrorItem','metric','DESC','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','ejs','lodash','squel'];(function(_0x3029b5,_0x4e58b7){var _0x2b7372=function(_0x1ec1a2){while(--_0x1ec1a2){_0x3029b5['push'](_0x3029b5['shift']());}};_0x2b7372(++_0x4e58b7);}(_0x0f74,0x13b));var _0x40f7=function(_0x1ab8a5,_0x3556e8){_0x1ab8a5=_0x1ab8a5-0x0;var _0x597912=_0x0f74[_0x1ab8a5];return _0x597912;};'use strict';var emlformat=require(_0x40f7('0x0'));var rimraf=require(_0x40f7('0x1'));var zipdir=require(_0x40f7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x40f7('0x3'));var moment=require(_0x40f7('0x4'));var BPromise=require(_0x40f7('0x5'));var Mustache=require(_0x40f7('0x6'));var util=require(_0x40f7('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x40f7('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x40f7('0x9'));var squel=require(_0x40f7('0xa'));var crypto=require(_0x40f7('0xb'));var jsforce=require(_0x40f7('0xc'));var deskjs=require(_0x40f7('0xd'));var toCsv=require(_0x40f7('0xe'));var querystring=require('querystring');var Papa=require(_0x40f7('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x40f7('0x10'));var as=require(_0x40f7('0x11'));var hardwareService=require(_0x40f7('0x12'));var logger=require('../../config/logger')(_0x40f7('0x13'));var utils=require(_0x40f7('0x14'));var config=require(_0x40f7('0x15'));var licenseUtil=require(_0x40f7('0x16'));var db=require(_0x40f7('0x17'))['db'];var dbH=require(_0x40f7('0x17'))['dbH'];function respondWithStatusCode(_0x105957,_0xe180c1){_0xe180c1=_0xe180c1||0xcc;return function(_0x44976f){if(_0x44976f){return _0x105957[_0x40f7('0x18')](_0xe180c1);}return _0x105957[_0x40f7('0x19')](_0xe180c1)['end']();};}function respondWithResult(_0xa8bd4e,_0x577559){_0x577559=_0x577559||0xc8;return function(_0x5398fa){if(_0x5398fa){return _0xa8bd4e[_0x40f7('0x19')](_0x577559)[_0x40f7('0x1a')](_0x5398fa);}};}function respondWithFilteredResult(_0x4bd5df,_0x5e9843){return function(_0x65f920){if(_0x65f920){var _0x3b4e83=typeof _0x5e9843[_0x40f7('0x1b')]==='undefined'&&typeof _0x5e9843['limit']==='undefined';var _0x397a8e=_0x65f920[_0x40f7('0x1c')];var _0x53f738=_0x3b4e83?0x0:_0x5e9843['offset'];var _0x48ac4f=_0x3b4e83?_0x65f920['count']:_0x5e9843['offset']+_0x5e9843[_0x40f7('0x1d')];var _0x5951ee;if(_0x48ac4f>=_0x397a8e){_0x48ac4f=_0x397a8e;_0x5951ee=0xc8;}else{_0x5951ee=0xce;}_0x4bd5df[_0x40f7('0x19')](_0x5951ee);return _0x4bd5df[_0x40f7('0x1e')]('Content-Range',_0x53f738+'-'+_0x48ac4f+'/'+_0x397a8e)[_0x40f7('0x1a')](_0x65f920);}return null;};}function patchUpdates(_0x132615){return function(_0x3ae7af){try{jsonpatch[_0x40f7('0x1f')](_0x3ae7af,_0x132615,!![]);}catch(_0x4a564e){return BPromise[_0x40f7('0x20')](_0x4a564e);}return _0x3ae7af[_0x40f7('0x21')]();};}function saveUpdates(_0x171bcf,_0x289783){return function(_0x37f83e){if(_0x37f83e){return _0x37f83e[_0x40f7('0x22')](_0x171bcf)[_0x40f7('0x23')](function(_0x8170ca){return _0x8170ca;});}return null;};}function removeEntity(_0xea1ed8,_0x341119){return function(_0x47c95b){if(_0x47c95b){return _0x47c95b['destroy']()['then'](function(){var _0x2f7ba2=_0x47c95b[_0x40f7('0x24')]({'plain':!![]});var _0x2dddee=_0x40f7('0x25');return db[_0x40f7('0x26')][_0x40f7('0x27')]({'where':{'type':_0x2dddee,'resourceId':_0x2f7ba2['id']}})[_0x40f7('0x23')](function(){return _0x47c95b;});})['then'](function(){_0xea1ed8['status'](0xcc)[_0x40f7('0x28')]();});}};}function handleEntityNotFound(_0x240a9c,_0x3ad66f){return function(_0x4e6257){if(!_0x4e6257){_0x240a9c[_0x40f7('0x18')](0x194);}return _0x4e6257;};}function handleError(_0x3d41b9,_0x5e9477){_0x5e9477=_0x5e9477||0x1f4;return function(_0x1c080d){logger[_0x40f7('0x29')](_0x1c080d[_0x40f7('0x2a')]);if(_0x1c080d[_0x40f7('0x2b')]){delete _0x1c080d[_0x40f7('0x2b')];}_0x3d41b9[_0x40f7('0x19')](_0x5e9477)[_0x40f7('0x2c')](_0x1c080d);};}exports[_0x40f7('0x2d')]=function(_0xd90d85,_0x465941){var _0xface3d={},_0x1af7e8={},_0x461d5f={'count':0x0,'rows':[]};var _0x4fb705=_['map'](db['AnalyticCustomReport'][_0x40f7('0x2e')],function(_0x4752b7){return{'name':_0x4752b7['fieldName'],'type':_0x4752b7[_0x40f7('0x2f')][_0x40f7('0x30')]};});_0x1af7e8[_0x40f7('0x31')]=_[_0x40f7('0x32')](_0x4fb705,_0x40f7('0x2b'));_0x1af7e8['query']=_['keys'](_0xd90d85[_0x40f7('0x33')]);_0x1af7e8[_0x40f7('0x34')]=_[_0x40f7('0x35')](_0x1af7e8[_0x40f7('0x31')],_0x1af7e8[_0x40f7('0x33')]);_0xface3d[_0x40f7('0x36')]=_[_0x40f7('0x35')](_0x1af7e8[_0x40f7('0x31')],qs[_0x40f7('0x37')](_0xd90d85['query'][_0x40f7('0x37')]));_0xface3d[_0x40f7('0x36')]=_0xface3d[_0x40f7('0x36')][_0x40f7('0x38')]?_0xface3d[_0x40f7('0x36')]:_0x1af7e8[_0x40f7('0x31')];if(!_0xd90d85[_0x40f7('0x33')]['hasOwnProperty']('nolimit')){_0xface3d['limit']=qs[_0x40f7('0x1d')](_0xd90d85[_0x40f7('0x33')][_0x40f7('0x1d')]);_0xface3d[_0x40f7('0x1b')]=qs['offset'](_0xd90d85['query']['offset']);}_0xface3d[_0x40f7('0x39')]=qs[_0x40f7('0x3a')](_0xd90d85['query']['sort']);_0xface3d[_0x40f7('0x3b')]=qs['filters'](_['pick'](_0xd90d85[_0x40f7('0x33')],_0x1af7e8[_0x40f7('0x34')]),_0x4fb705);if(_0xd90d85[_0x40f7('0x33')][_0x40f7('0x3c')]){_0xface3d[_0x40f7('0x3b')]=_[_0x40f7('0x3d')](_0xface3d['where'],{'$or':_['map'](_0x4fb705,function(_0x43ea35){if(_0x43ea35[_0x40f7('0x2f')]!=='VIRTUAL'){var _0x274bde={};_0x274bde[_0x43ea35[_0x40f7('0x2b')]]={'$like':'%'+_0xd90d85['query'][_0x40f7('0x3c')]+'%'};return _0x274bde;}})});}_0xface3d=_[_0x40f7('0x3d')]({},_0xface3d,_0xd90d85[_0x40f7('0x3e')]);var _0x27a7c2={'where':_0xface3d[_0x40f7('0x3b')]};return db['AnalyticCustomReport']['count'](_0x27a7c2)[_0x40f7('0x23')](function(_0x5a231e){_0x461d5f['count']=_0x5a231e;if(_0xd90d85[_0x40f7('0x33')][_0x40f7('0x3f')]){_0xface3d[_0x40f7('0x40')]=[{'all':!![]}];}return db[_0x40f7('0x41')][_0x40f7('0x42')](_0xface3d);})[_0x40f7('0x23')](function(_0x3e08c3){_0x461d5f[_0x40f7('0x43')]=_0x3e08c3;return _0x461d5f;})[_0x40f7('0x23')](respondWithFilteredResult(_0x465941,_0xface3d))[_0x40f7('0x44')](handleError(_0x465941,null));};exports[_0x40f7('0x45')]=function(_0x592f8f,_0x99ce29){var _0x4c7640={'raw':![],'where':{'id':_0x592f8f[_0x40f7('0x46')]['id']}},_0x2b583f={};_0x2b583f[_0x40f7('0x31')]=_[_0x40f7('0x47')](db[_0x40f7('0x41')]['rawAttributes']);_0x2b583f[_0x40f7('0x33')]=_[_0x40f7('0x47')](_0x592f8f[_0x40f7('0x33')]);_0x2b583f[_0x40f7('0x34')]=_['intersection'](_0x2b583f[_0x40f7('0x31')],_0x2b583f['query']);_0x4c7640[_0x40f7('0x36')]=_[_0x40f7('0x35')](_0x2b583f[_0x40f7('0x31')],qs[_0x40f7('0x37')](_0x592f8f[_0x40f7('0x33')]['fields']));_0x4c7640['attributes']=_0x4c7640[_0x40f7('0x36')]['length']?_0x4c7640[_0x40f7('0x36')]:_0x2b583f['model'];if(_0x592f8f[_0x40f7('0x33')][_0x40f7('0x3f')]){_0x4c7640[_0x40f7('0x40')]=[{'all':!![]}];}_0x4c7640=_[_0x40f7('0x3d')]({},_0x4c7640,_0x592f8f[_0x40f7('0x3e')]);return db[_0x40f7('0x41')]['find'](_0x4c7640)[_0x40f7('0x23')](handleEntityNotFound(_0x99ce29,null))[_0x40f7('0x23')](respondWithResult(_0x99ce29,null))[_0x40f7('0x44')](handleError(_0x99ce29,null));};exports[_0x40f7('0x48')]=function(_0x497287,_0x24d44d){return db[_0x40f7('0x41')]['create'](_0x497287[_0x40f7('0x49')],{})['then'](function(_0x52e2bb){var _0x34233d=_0x497287[_0x40f7('0x4a')][_0x40f7('0x24')]({'plain':!![]});if(!_0x34233d)throw new Error(_0x40f7('0x4b'));if(_0x34233d[_0x40f7('0x4c')]===_0x40f7('0x4a')){var _0x496eec=_0x52e2bb[_0x40f7('0x24')]({'plain':!![]});var _0x204150=_0x40f7('0x4d');return db['UserProfileSection']['find']({'where':{'name':_0x204150,'userProfileId':_0x34233d[_0x40f7('0x4e')]},'raw':!![]})[_0x40f7('0x23')](function(_0xef537a){if(_0xef537a&&_0xef537a[_0x40f7('0x4f')]===0x0){return db[_0x40f7('0x26')][_0x40f7('0x48')]({'name':_0x496eec[_0x40f7('0x2b')],'resourceId':_0x496eec['id'],'type':'CustomReports','sectionId':_0xef537a['id']},{})[_0x40f7('0x23')](function(){return _0x52e2bb;});}else{return _0x52e2bb;}})['catch'](function(_0x4ca501){logger[_0x40f7('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4ca501);throw _0x4ca501;});}return _0x52e2bb;})[_0x40f7('0x23')](respondWithResult(_0x24d44d,0xc9))[_0x40f7('0x44')](handleError(_0x24d44d,null));};exports[_0x40f7('0x22')]=function(_0x2ec4ed,_0x3e451c){if(_0x2ec4ed['body']['id']){delete _0x2ec4ed[_0x40f7('0x49')]['id'];}return db[_0x40f7('0x41')]['find']({'where':{'id':_0x2ec4ed[_0x40f7('0x46')]['id']}})[_0x40f7('0x23')](handleEntityNotFound(_0x3e451c,null))[_0x40f7('0x23')](saveUpdates(_0x2ec4ed[_0x40f7('0x49')],null))[_0x40f7('0x23')](respondWithResult(_0x3e451c,null))['catch'](handleError(_0x3e451c,null));};exports[_0x40f7('0x27')]=function(_0x46c25e,_0x5c439f){return db[_0x40f7('0x41')][_0x40f7('0x50')]({'where':{'id':_0x46c25e[_0x40f7('0x46')]['id']}})[_0x40f7('0x23')](handleEntityNotFound(_0x5c439f,null))[_0x40f7('0x23')](removeEntity(_0x5c439f,null))['catch'](handleError(_0x5c439f,null));};exports[_0x40f7('0x51')]=function(_0x41d370,_0x5b2ebd){var _0x2ab996=0xa;var _0x47030a=[_0x40f7('0x52'),_0x40f7('0x53'),_0x40f7('0x54'),_0x40f7('0x55')];var _0x446eef={'SUM':_0x40f7('0x56'),'COUNT':_0x40f7('0x57'),'COUNT DISTINCT':_0x40f7('0x58'),'MAX':'MAX(%s)','MIN':_0x40f7('0x59'),'AVG':_0x40f7('0x5a'),'GROUP_CONCAT':_0x40f7('0x5b'),'GROUP_CONCAT ASC':_0x40f7('0x5c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x1f1b26={'SEC_TO_TIME':_0x40f7('0x5d'),'DATE':_0x40f7('0x5e'),'HOUR':_0x40f7('0x5f'),'ROUND':_0x40f7('0x60'),'UNIX_TIMESTAMP':_0x40f7('0x61')};var _0x29ffdc=function(_0x466271){return!_[_0x40f7('0x62')]([_0x40f7('0x63'),_0x40f7('0x64'),_0x40f7('0x65'),_0x40f7('0x66')],_0x466271);};var _0x4c4fa5=function(_0x3a32e0){if(!_0x3a32e0||!_0x3a32e0['rules'][_0x40f7('0x38')]){return'';}for(var _0x3ac0d0='(',_0x4d87da=0x0;_0x4d87da<_0x3a32e0[_0x40f7('0x67')][_0x40f7('0x38')];_0x4d87da+=0x1){_0x4d87da>0x0&&(_0x3ac0d0+='\x20'+_0x3a32e0[_0x40f7('0x68')]+'\x20');_0x3ac0d0+=_0x3a32e0[_0x40f7('0x67')][_0x4d87da]['group']?_0x4c4fa5(_0x3a32e0[_0x40f7('0x67')][_0x4d87da][_0x40f7('0x69')]):_0x3a32e0['rules'][_0x4d87da]['field']+'\x20'+_0x3a32e0[_0x40f7('0x67')][_0x4d87da][_0x40f7('0x6a')]+(_0x29ffdc(_0x3a32e0['rules'][_0x4d87da]['condition'])?'\x20'+_0x3a32e0[_0x40f7('0x67')][_0x4d87da][_0x40f7('0x6b')]:'');}return _0x3ac0d0+')';};var _0x46b095={'where':{'id':_0x41d370[_0x40f7('0x46')]['id']}},_0x317250,_0x4d48a4,_0x4c1e8c,_0x27569e,_0x5e6cab;_0x46b095=_[_0x40f7('0x3d')]({},_0x46b095,_0x41d370[_0x40f7('0x3e')]);return db[_0x40f7('0x41')][_0x40f7('0x50')](_0x46b095)[_0x40f7('0x23')](function(_0x3e3351){if(_0x3e3351){_0x317250=_0x3e3351;return _0x3e3351[_0x40f7('0x6c')]();}return null;})['then'](function(_0x3a63f0){if(_0x3a63f0){if(!_0x3a63f0[_0x40f7('0x38')]){throw new db[(_0x40f7('0x6d'))]['ValidationErrorItem'](_0x40f7('0x6e'),0x193);}_0x4d48a4=_0x3a63f0;return db[_0x40f7('0x6f')][_0x40f7('0x42')]({'raw':!![]});}return null;})[_0x40f7('0x23')](function(_0x1c761a){if(_0x1c761a){_0x4c1e8c=_['keyBy'](_0x1c761a,'id');var _0x283e9e;var _0x4d8353=squel[_0x40f7('0x70')]();_0x4d8353[_0x40f7('0x71')](_0x317250[_0x40f7('0x72')]);for(var _0x31c1c9=0x0;_0x31c1c9<_0x4d48a4[_0x40f7('0x38')];_0x31c1c9+=0x1){_0x283e9e=_0x4d48a4[_0x31c1c9][_0x40f7('0x73')]?_0x4c1e8c[_0x4d48a4[_0x31c1c9][_0x40f7('0x73')]]['metric']:_0x4d48a4[_0x31c1c9]['field'];_0x283e9e=_0x4d48a4[_0x31c1c9][_0x40f7('0x74')]?_[_0x40f7('0x75')](_0x446eef[_0x4d48a4[_0x31c1c9][_0x40f7('0x74')]],'%s',_0x283e9e):_0x283e9e;_0x283e9e=_0x4d48a4[_0x31c1c9][_0x40f7('0x76')]?_[_0x40f7('0x75')](_0x1f1b26[_0x4d48a4[_0x31c1c9]['format']],'%s',_0x283e9e):_0x283e9e;if(_0x4d48a4[_0x31c1c9]['groupBy']){_0x4d8353[_0x40f7('0x69')](_0x283e9e);}_0x4d48a4[_0x31c1c9][_0x40f7('0x77')]&&_0x4d8353[_0x40f7('0x39')](_0x283e9e,_0x4d48a4[_0x31c1c9][_0x40f7('0x77')]==='DESC'?![]:!![]);_0x4d8353['field'](_0x283e9e,_0x4d48a4[_0x31c1c9]['alias']||_0x283e9e);}if(_0x317250[_0x40f7('0x78')]){_0x317250['joins']=JSON[_0x40f7('0x79')](_0x317250[_0x40f7('0x78')]);for(var _0x1ed240=0x0;_0x1ed240<_0x317250[_0x40f7('0x78')][_0x40f7('0x38')];_0x1ed240+=0x1){if(_0x317250[_0x40f7('0x78')][_0x1ed240][_0x40f7('0x2f')]&&_[_0x40f7('0x62')](_0x47030a,_0x317250['joins'][_0x1ed240][_0x40f7('0x2f')])&&_0x317250[_0x40f7('0x78')][_0x1ed240][_0x40f7('0x7a')]&&_0x317250['joins'][_0x1ed240][_0x40f7('0x7b')]&&_0x317250['joins'][_0x1ed240][_0x40f7('0x7c')]){_0x4d8353[_0x317250[_0x40f7('0x78')][_0x1ed240][_0x40f7('0x2f')]](_0x317250[_0x40f7('0x78')][_0x1ed240]['foreignTable'],null,util[_0x40f7('0x76')](_0x40f7('0x7d'),_0x317250['table'],_0x317250['joins'][_0x1ed240]['parentKey'],_0x317250[_0x40f7('0x78')][_0x1ed240]['foreignTable'],_0x317250[_0x40f7('0x78')][_0x1ed240][_0x40f7('0x7c')]));}}}if(_0x317250[_0x40f7('0x7e')]){_0x317250[_0x40f7('0x7e')]=JSON[_0x40f7('0x79')](_0x317250[_0x40f7('0x7e')]);_0x4d8353[_0x40f7('0x3b')](_0x4c4fa5(_0x317250[_0x40f7('0x7e')][_0x40f7('0x69')]));}_0x5e6cab=_0x4d8353['clone']();_0x4d8353['limit'](_0x2ab996);_0x4d8353[_0x40f7('0x1b')](0x0);logger[_0x40f7('0x7f')](_0x40f7('0x80'),_0x4d8353[_0x40f7('0x81')]());return dbH[_0x40f7('0x82')][_0x40f7('0x33')](_0x4d8353[_0x40f7('0x81')](),{'type':dbH[_0x40f7('0x82')][_0x40f7('0x83')][_0x40f7('0x84')]});}})[_0x40f7('0x23')](respondWithResult(_0x5b2ebd,null))['catch'](handleError(_0x5b2ebd,null));};function runReport(_0x1db63c,_0x23e2d1,_0x3d7ca6){var _0x5453e0=_0x23e2d1[_0x40f7('0x2b')];var _0x46e2d5=0xa;var _0x260578=['join',_0x40f7('0x53'),'right_join',_0x40f7('0x55')];var _0x38327f={'SUM':_0x40f7('0x56'),'COUNT':_0x40f7('0x57'),'COUNT DISTINCT':_0x40f7('0x58'),'MAX':_0x40f7('0x85'),'MIN':_0x40f7('0x59'),'AVG':_0x40f7('0x5a'),'GROUP_CONCAT':_0x40f7('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x40f7('0x86')};var _0xbc52a8={'SEC_TO_TIME':_0x40f7('0x5d'),'DATE':_0x40f7('0x5e'),'HOUR':'HOUR(%s)','ROUND':_0x40f7('0x60'),'UNIX_TIMESTAMP':_0x40f7('0x61')};var _0x290fdd=function(_0x56194c){return!_[_0x40f7('0x62')]([_0x40f7('0x63'),_0x40f7('0x64'),_0x40f7('0x65'),'IS\x20NOT\x20EMPTY'],_0x56194c);};var _0x1c8b80=function(_0x8273b8){if(!_0x8273b8||!_0x8273b8['rules'][_0x40f7('0x38')]){return'';}for(var _0x7d8890='(',_0x4f2de7=0x0;_0x4f2de7<_0x8273b8[_0x40f7('0x67')][_0x40f7('0x38')];_0x4f2de7+=0x1){_0x4f2de7>0x0&&(_0x7d8890+='\x20'+_0x8273b8[_0x40f7('0x68')]+'\x20');_0x7d8890+=_0x8273b8['rules'][_0x4f2de7]['group']?_0x1c8b80(_0x8273b8[_0x40f7('0x67')][_0x4f2de7]['group']):_0x8273b8[_0x40f7('0x67')][_0x4f2de7][_0x40f7('0x87')]+'\x20'+_0x8273b8[_0x40f7('0x67')][_0x4f2de7]['condition']+(_0x290fdd(_0x8273b8[_0x40f7('0x67')][_0x4f2de7][_0x40f7('0x6a')])?'\x20'+_0x8273b8['rules'][_0x4f2de7][_0x40f7('0x6b')]:'');}return _0x7d8890+')';};var _0x586c60={'where':{'id':_0x1db63c['id']}},_0x339798,_0x5a00f2,_0x2af3f2,_0x23c3b4,_0x4fa88e;_0x586c60=_['merge']({},_0x586c60,_0x3d7ca6);return db[_0x40f7('0x41')][_0x40f7('0x50')](_0x586c60)[_0x40f7('0x23')](function(_0x3dd2e6){if(_0x3dd2e6){_0x339798=_0x3dd2e6;return _0x3dd2e6[_0x40f7('0x6c')]();}return null;})[_0x40f7('0x23')](function(_0x98f010){if(_0x98f010){if(!_0x98f010['length']){throw new db[(_0x40f7('0x6d'))]['ValidationErrorItem'](_0x40f7('0x6e'),0x193);}_0x5a00f2=_0x98f010;return db[_0x40f7('0x6f')][_0x40f7('0x42')]({'raw':!![]});}return null;})[_0x40f7('0x23')](function(_0x5c551c){if(_0x5c551c){_0x2af3f2=_[_0x40f7('0x88')](_0x5c551c,'id');var _0x1e1a39;var _0x4ad965=squel[_0x40f7('0x70')]();_0x4ad965[_0x40f7('0x71')](_0x339798[_0x40f7('0x72')]);for(var _0x4e2a83=0x0;_0x4e2a83<_0x5a00f2['length'];_0x4e2a83+=0x1){_0x1e1a39=_0x5a00f2[_0x4e2a83][_0x40f7('0x73')]?_0x2af3f2[_0x5a00f2[_0x4e2a83][_0x40f7('0x73')]]['metric']:_0x5a00f2[_0x4e2a83][_0x40f7('0x87')];_0x1e1a39=_0x5a00f2[_0x4e2a83][_0x40f7('0x74')]?_[_0x40f7('0x75')](_0x38327f[_0x5a00f2[_0x4e2a83]['function']],'%s',_0x1e1a39):_0x1e1a39;_0x1e1a39=_0x5a00f2[_0x4e2a83]['format']?_[_0x40f7('0x75')](_0xbc52a8[_0x5a00f2[_0x4e2a83]['format']],'%s',_0x1e1a39):_0x1e1a39;if(_0x5a00f2[_0x4e2a83][_0x40f7('0x89')]){_0x4ad965['group'](_0x1e1a39);}_0x5a00f2[_0x4e2a83][_0x40f7('0x77')]&&_0x4ad965[_0x40f7('0x39')](_0x1e1a39,_0x5a00f2[_0x4e2a83][_0x40f7('0x77')]==='DESC'?![]:!![]);_0x4ad965[_0x40f7('0x87')](_0x1e1a39,_0x5a00f2[_0x4e2a83][_0x40f7('0x8a')]||_0x1e1a39);}if(_0x339798[_0x40f7('0x78')]){_0x339798[_0x40f7('0x78')]=JSON[_0x40f7('0x79')](_0x339798[_0x40f7('0x78')]);for(var _0x4f46ce=0x0;_0x4f46ce<_0x339798[_0x40f7('0x78')][_0x40f7('0x38')];_0x4f46ce+=0x1){if(_0x339798['joins'][_0x4f46ce][_0x40f7('0x2f')]&&_['includes'](_0x260578,_0x339798['joins'][_0x4f46ce][_0x40f7('0x2f')])&&_0x339798[_0x40f7('0x78')][_0x4f46ce][_0x40f7('0x7a')]&&_0x339798[_0x40f7('0x78')][_0x4f46ce][_0x40f7('0x7b')]&&_0x339798[_0x40f7('0x78')][_0x4f46ce]['foreignKey']){_0x4ad965[_0x339798['joins'][_0x4f46ce][_0x40f7('0x2f')]](_0x339798[_0x40f7('0x78')][_0x4f46ce]['foreignTable'],null,util[_0x40f7('0x76')]('%s.%s\x20=\x20%s.%s',_0x339798['table'],_0x339798[_0x40f7('0x78')][_0x4f46ce][_0x40f7('0x7a')],_0x339798[_0x40f7('0x78')][_0x4f46ce][_0x40f7('0x7b')],_0x339798[_0x40f7('0x78')][_0x4f46ce]['foreignKey']));}}}if(_0x339798[_0x40f7('0x7e')]){_0x339798[_0x40f7('0x7e')]=JSON[_0x40f7('0x79')](_0x339798[_0x40f7('0x7e')]);_0x4ad965[_0x40f7('0x3b')](_0x1c8b80(_0x339798['conditions'][_0x40f7('0x69')]));}_0x4fa88e=_0x4ad965[_0x40f7('0x8b')]();_0x4ad965[_0x40f7('0x1d')](_0x46e2d5);_0x4ad965[_0x40f7('0x1b')](0x0);return;}})[_0x40f7('0x23')](function(){if(_0x23e2d1[_0x40f7('0x8c')]===_0x40f7('0x8d')){return null;}var _0x5c30c6=_[_0x40f7('0x3d')](_0x23e2d1,{'name':_0x23e2d1[_0x40f7('0x8e')]||_0x23e2d1[_0x40f7('0x2b')]||_0x339798['name'],'basename':_0x5453e0,'savename':util[_0x40f7('0x76')](_0x40f7('0x8f'),_0x23e2d1[_0x40f7('0x2b')]||_0x339798[_0x40f7('0x2b')],require(_0x40f7('0x90'))[_0x40f7('0x91')](0x4),_0x23e2d1[_0x40f7('0x8c')]||_0x40f7('0x92')),'reportId':_0x339798['id'],'reportType':_0x40f7('0x93')});return db[_0x40f7('0x94')][_0x40f7('0x48')](_0x5c30c6,{'raw':!![]});})['then'](function(_0x5f0e38){if(_0x339798[_0x40f7('0x72')]==='cdr'){_0x4fa88e['where'](_0x339798[_0x40f7('0x72')]+_0x40f7('0x95'),_0x23e2d1[_0x40f7('0x96')],_0x23e2d1[_0x40f7('0x97')]);}else{_0x4fa88e[_0x40f7('0x3b')](_0x339798[_0x40f7('0x72')]+_0x40f7('0x98'),_0x23e2d1[_0x40f7('0x96')],_0x23e2d1[_0x40f7('0x97')]);}if(_0x5f0e38){logger['info'](_0x40f7('0x99'),_0x4fa88e[_0x40f7('0x81')]());require('child_process')[_0x40f7('0x9a')](path[_0x40f7('0x52')](__dirname,_0x40f7('0x9b'),_0x5f0e38[_0x40f7('0x8c')]),[_0x5f0e38['id'],_0x4fa88e[_0x40f7('0x81')](),path[_0x40f7('0x52')](__dirname,_0x40f7('0x9c'),_0x5f0e38[_0x40f7('0x9d')]),_0x5453e0]);return _0x5f0e38;}else{var _0x1b0bc5=squel[_0x40f7('0x70')]();_0x1b0bc5['from']('('+_0x4fa88e[_0x40f7('0x81')]()+')','countTable');_0x1b0bc5['field'](_0x40f7('0x9e'),_0x40f7('0x1c'));_0x4fa88e[_0x40f7('0x1d')](_0x23e2d1[_0x40f7('0x1d')]||_0x46e2d5);_0x4fa88e[_0x40f7('0x1b')](_0x23e2d1[_0x40f7('0x1b')]||0x0);return dbH[_0x40f7('0x82')][_0x40f7('0x33')](_0x1b0bc5[_0x40f7('0x81')](),{'type':dbH[_0x40f7('0x82')][_0x40f7('0x83')]['SELECT']})[_0x40f7('0x23')](function(_0x3950c1){if(!_0x3950c1[_0x40f7('0x38')]){_0x23c3b4=0x0;}else{_0x23c3b4=_0x3950c1[0x0]['count']||0x0;}return dbH[_0x40f7('0x82')][_0x40f7('0x33')](_0x4fa88e['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0x40f7('0x84')]});})[_0x40f7('0x23')](function(_0x4c9d1d){return{'rows':_0x4c9d1d||[],'count':_0x23c3b4};});}});}exports['run']=function(_0x45400a,_0x14fd98){return runReport(_0x45400a[_0x40f7('0x46')],_0x45400a[_0x40f7('0x33')],_0x45400a['options'])['then'](respondWithResult(_0x14fd98,null))[_0x40f7('0x44')](handleError(_0x14fd98,null));};exports[_0x40f7('0x9f')]=runReport;exports['query']=function(_0x23aab6,_0x30afe5){var _0x21c592=0xa;var _0x3da7a8=[_0x40f7('0x52'),'left_join',_0x40f7('0x54'),'cross_join'];var _0x416748={'SUM':_0x40f7('0x56'),'COUNT':_0x40f7('0x57'),'COUNT DISTINCT':_0x40f7('0x58'),'MAX':_0x40f7('0x85'),'MIN':_0x40f7('0x59'),'AVG':_0x40f7('0x5a'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x40f7('0x5c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x1ad55d={'SEC_TO_TIME':_0x40f7('0x5d'),'DATE':_0x40f7('0x5e'),'HOUR':_0x40f7('0x5f'),'ROUND':_0x40f7('0x60'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1cef83=function(_0x52d728){return!_['includes']([_0x40f7('0x63'),'IS\x20NOT\x20NULL',_0x40f7('0x65'),_0x40f7('0x66')],_0x52d728);};var _0x285892=function(_0x4fb462){if(!_0x4fb462||!_0x4fb462[_0x40f7('0x67')]['length']){return'';}for(var _0x2ae7d2='(',_0x1a3aed=0x0;_0x1a3aed<_0x4fb462[_0x40f7('0x67')]['length'];_0x1a3aed+=0x1){_0x1a3aed>0x0&&(_0x2ae7d2+='\x20'+_0x4fb462['operator']+'\x20');_0x2ae7d2+=_0x4fb462[_0x40f7('0x67')][_0x1a3aed][_0x40f7('0x69')]?_0x285892(_0x4fb462['rules'][_0x1a3aed][_0x40f7('0x69')]):_0x4fb462[_0x40f7('0x67')][_0x1a3aed][_0x40f7('0x87')]+'\x20'+_0x4fb462[_0x40f7('0x67')][_0x1a3aed][_0x40f7('0x6a')]+(_0x1cef83(_0x4fb462[_0x40f7('0x67')][_0x1a3aed][_0x40f7('0x6a')])?'\x20'+_0x4fb462[_0x40f7('0x67')][_0x1a3aed]['value']:'');}return _0x2ae7d2+')';};var _0x21dcb0={'where':{'id':_0x23aab6[_0x40f7('0x46')]['id']}},_0x45b3bf,_0x31d571,_0x26baa9,_0x1f4ce,_0x5daef5;_0x21dcb0=_['merge']({},_0x21dcb0,_0x23aab6[_0x40f7('0x3e')]);return db[_0x40f7('0x41')]['find'](_0x21dcb0)[_0x40f7('0x23')](function(_0x23dd2d){if(_0x23dd2d){_0x45b3bf=_0x23dd2d;return _0x23dd2d[_0x40f7('0x6c')]();}return null;})[_0x40f7('0x23')](function(_0x238d93){if(_0x238d93){if(!_0x238d93[_0x40f7('0x38')]){throw new db[(_0x40f7('0x6d'))][(_0x40f7('0xa0'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x31d571=_0x238d93;return db[_0x40f7('0x6f')][_0x40f7('0x42')]({'raw':!![]});}return null;})[_0x40f7('0x23')](function(_0x120c03){if(_0x120c03){_0x26baa9=_['keyBy'](_0x120c03,'id');var _0x1f2212;var _0x338049=squel[_0x40f7('0x70')]();_0x338049[_0x40f7('0x71')](_0x45b3bf[_0x40f7('0x72')]);for(var _0x31491d=0x0;_0x31491d<_0x31d571[_0x40f7('0x38')];_0x31491d+=0x1){_0x1f2212=_0x31d571[_0x31491d][_0x40f7('0x73')]?_0x26baa9[_0x31d571[_0x31491d][_0x40f7('0x73')]][_0x40f7('0xa1')]:_0x31d571[_0x31491d]['field'];_0x1f2212=_0x31d571[_0x31491d][_0x40f7('0x74')]?_[_0x40f7('0x75')](_0x416748[_0x31d571[_0x31491d]['function']],'%s',_0x1f2212):_0x1f2212;_0x1f2212=_0x31d571[_0x31491d][_0x40f7('0x76')]?_[_0x40f7('0x75')](_0x1ad55d[_0x31d571[_0x31491d][_0x40f7('0x76')]],'%s',_0x1f2212):_0x1f2212;if(_0x31d571[_0x31491d]['groupBy']){_0x338049['group'](_0x1f2212);}_0x31d571[_0x31491d]['orderBy']&&_0x338049[_0x40f7('0x39')](_0x1f2212,_0x31d571[_0x31491d]['orderBy']===_0x40f7('0xa2')?![]:!![]);_0x338049[_0x40f7('0x87')](_0x1f2212,_0x31d571[_0x31491d][_0x40f7('0x8a')]||_0x1f2212);}if(_0x45b3bf[_0x40f7('0x78')]){_0x45b3bf[_0x40f7('0x78')]=JSON[_0x40f7('0x79')](_0x45b3bf[_0x40f7('0x78')]);for(var _0x46b102=0x0;_0x46b102<_0x45b3bf[_0x40f7('0x78')][_0x40f7('0x38')];_0x46b102+=0x1){if(_0x45b3bf[_0x40f7('0x78')][_0x46b102]['type']&&_['includes'](_0x3da7a8,_0x45b3bf[_0x40f7('0x78')][_0x46b102][_0x40f7('0x2f')])&&_0x45b3bf['joins'][_0x46b102]['parentKey']&&_0x45b3bf[_0x40f7('0x78')][_0x46b102][_0x40f7('0x7b')]&&_0x45b3bf['joins'][_0x46b102][_0x40f7('0x7c')]){_0x338049[_0x45b3bf[_0x40f7('0x78')][_0x46b102]['type']](_0x45b3bf[_0x40f7('0x78')][_0x46b102][_0x40f7('0x7b')],null,util[_0x40f7('0x76')]('%s.%s\x20=\x20%s.%s',_0x45b3bf['table'],_0x45b3bf['joins'][_0x46b102][_0x40f7('0x7a')],_0x45b3bf['joins'][_0x46b102]['foreignTable'],_0x45b3bf[_0x40f7('0x78')][_0x46b102]['foreignKey']));}}}if(_0x45b3bf[_0x40f7('0x7e')]){_0x45b3bf[_0x40f7('0x7e')]=JSON[_0x40f7('0x79')](_0x45b3bf[_0x40f7('0x7e')]);_0x338049[_0x40f7('0x3b')](_0x285892(_0x45b3bf['conditions']['group']));}_0x5daef5=_0x338049[_0x40f7('0x8b')]();_0x338049['limit'](_0x21c592);_0x338049[_0x40f7('0x1b')](0x0);logger['debug']('Limited\x20Query:',_0x338049[_0x40f7('0x81')]());return dbH[_0x40f7('0x82')][_0x40f7('0x33')](_0x338049[_0x40f7('0x81')](),{'type':dbH[_0x40f7('0x82')][_0x40f7('0x83')]['SELECT']});}})[_0x40f7('0x23')](function(){return{'sql':_0x5daef5['toString']()};})[_0x40f7('0x23')](respondWithResult(_0x30afe5,null))[_0x40f7('0x44')](handleError(_0x30afe5,null));}; \ No newline at end of file +var _0xb2ed=['CustomReports','UserProfileResource','stack','name','index','map','AnalyticCustomReport','rawAttributes','fieldName','key','filters','model','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','rows','params','include','find','catch','create','body','user','UserProfileSection','userProfileId','autoAssociation','error','join','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','IS\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','order','DESC','alias','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','clone','debug','toString','sequelize','QueryTypes','SELECT','right_join','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','keyBy','select','output','web','fullPath','%s-%s.%s','randomstring','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','Run\x20Query:','child_process','../../files/reports','savename','COUNT(*)','runReport','Limited\x20Query:','rimraf','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/logger','api','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','then','destroy','get'];(function(_0x46f647,_0x33ee02){var _0x4e1af9=function(_0x25f7d7){while(--_0x25f7d7){_0x46f647['push'](_0x46f647['shift']());}};_0x4e1af9(++_0x33ee02);}(_0xb2ed,0x120));var _0xdb2e=function(_0xe0b81f,_0x1fb734){_0xe0b81f=_0xe0b81f-0x0;var _0x290e5e=_0xb2ed[_0xe0b81f];return _0x290e5e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdb2e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdb2e('0x1'));var rp=require(_0xdb2e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xdb2e('0x3'));var util=require(_0xdb2e('0x4'));var path=require(_0xdb2e('0x5'));var sox=require(_0xdb2e('0x6'));var csv=require(_0xdb2e('0x7'));var ejs=require(_0xdb2e('0x8'));var fs=require('fs');var fs_extra=require(_0xdb2e('0x9'));var _=require(_0xdb2e('0xa'));var squel=require(_0xdb2e('0xb'));var crypto=require('crypto');var jsforce=require(_0xdb2e('0xc'));var deskjs=require(_0xdb2e('0xd'));var toCsv=require(_0xdb2e('0x7'));var querystring=require(_0xdb2e('0xe'));var Papa=require(_0xdb2e('0xf'));var Redis=require(_0xdb2e('0x10'));var authService=require(_0xdb2e('0x11'));var qs=require(_0xdb2e('0x12'));var as=require(_0xdb2e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdb2e('0x14'))(_0xdb2e('0x15'));var utils=require(_0xdb2e('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xdb2e('0x17'));var db=require('../../mysqldb')['db'];var dbH=require(_0xdb2e('0x18'))[_0xdb2e('0x19')];function respondWithStatusCode(_0x247337,_0x74bdc4){_0x74bdc4=_0x74bdc4||0xcc;return function(_0x3ef2a0){if(_0x3ef2a0){return _0x247337[_0xdb2e('0x1a')](_0x74bdc4);}return _0x247337[_0xdb2e('0x1b')](_0x74bdc4)[_0xdb2e('0x1c')]();};}function respondWithResult(_0x2131c5,_0x9ffbbc){_0x9ffbbc=_0x9ffbbc||0xc8;return function(_0x487e85){if(_0x487e85){return _0x2131c5[_0xdb2e('0x1b')](_0x9ffbbc)[_0xdb2e('0x1d')](_0x487e85);}};}function respondWithFilteredResult(_0x4fa14b,_0x16e416){return function(_0x5a4f4d){if(_0x5a4f4d){var _0x25de74=typeof _0x16e416[_0xdb2e('0x1e')]==='undefined'&&typeof _0x16e416['limit']===_0xdb2e('0x1f');var _0x1eaa89=_0x5a4f4d[_0xdb2e('0x20')];var _0x4e1e9e=_0x25de74?0x0:_0x16e416[_0xdb2e('0x1e')];var _0x37cfe8=_0x25de74?_0x5a4f4d['count']:_0x16e416['offset']+_0x16e416['limit'];var _0x96841a;if(_0x37cfe8>=_0x1eaa89){_0x37cfe8=_0x1eaa89;_0x96841a=0xc8;}else{_0x96841a=0xce;}_0x4fa14b[_0xdb2e('0x1b')](_0x96841a);return _0x4fa14b[_0xdb2e('0x21')](_0xdb2e('0x22'),_0x4e1e9e+'-'+_0x37cfe8+'/'+_0x1eaa89)[_0xdb2e('0x1d')](_0x5a4f4d);}return null;};}function patchUpdates(_0x2b3c08){return function(_0x22256c){try{jsonpatch[_0xdb2e('0x23')](_0x22256c,_0x2b3c08,!![]);}catch(_0x37b042){return BPromise[_0xdb2e('0x24')](_0x37b042);}return _0x22256c['save']();};}function saveUpdates(_0x523262,_0x49d314){return function(_0x4a7ab6){if(_0x4a7ab6){return _0x4a7ab6['update'](_0x523262)[_0xdb2e('0x25')](function(_0x67c853){return _0x67c853;});}return null;};}function removeEntity(_0x22f932,_0x4e99bd){return function(_0x3e8c5f){if(_0x3e8c5f){return _0x3e8c5f[_0xdb2e('0x26')]()[_0xdb2e('0x25')](function(){var _0x5ba45c=_0x3e8c5f[_0xdb2e('0x27')]({'plain':!![]});var _0x40cf5a=_0xdb2e('0x28');return db[_0xdb2e('0x29')][_0xdb2e('0x26')]({'where':{'type':_0x40cf5a,'resourceId':_0x5ba45c['id']}})[_0xdb2e('0x25')](function(){return _0x3e8c5f;});})[_0xdb2e('0x25')](function(){_0x22f932[_0xdb2e('0x1b')](0xcc)[_0xdb2e('0x1c')]();});}};}function handleEntityNotFound(_0x4a5ee1,_0x4274f5){return function(_0x3b393b){if(!_0x3b393b){_0x4a5ee1[_0xdb2e('0x1a')](0x194);}return _0x3b393b;};}function handleError(_0x354c16,_0xaf4631){_0xaf4631=_0xaf4631||0x1f4;return function(_0xa5a88e){logger['error'](_0xa5a88e[_0xdb2e('0x2a')]);if(_0xa5a88e[_0xdb2e('0x2b')]){delete _0xa5a88e[_0xdb2e('0x2b')];}_0x354c16[_0xdb2e('0x1b')](_0xaf4631)['send'](_0xa5a88e);};}exports[_0xdb2e('0x2c')]=function(_0x4c05bd,_0x25ae45){var _0x55c8ac={},_0x9f5b4={},_0x1384a4={'count':0x0,'rows':[]};var _0x5454b0=_[_0xdb2e('0x2d')](db[_0xdb2e('0x2e')][_0xdb2e('0x2f')],function(_0x389f35){return{'name':_0x389f35[_0xdb2e('0x30')],'type':_0x389f35['type'][_0xdb2e('0x31')]};});_0x9f5b4['model']=_[_0xdb2e('0x2d')](_0x5454b0,_0xdb2e('0x2b'));_0x9f5b4['query']=_['keys'](_0x4c05bd['query']);_0x9f5b4[_0xdb2e('0x32')]=_['intersection'](_0x9f5b4[_0xdb2e('0x33')],_0x9f5b4['query']);_0x55c8ac['attributes']=_[_0xdb2e('0x34')](_0x9f5b4[_0xdb2e('0x33')],qs['fields'](_0x4c05bd[_0xdb2e('0x35')][_0xdb2e('0x36')]));_0x55c8ac[_0xdb2e('0x37')]=_0x55c8ac['attributes'][_0xdb2e('0x38')]?_0x55c8ac['attributes']:_0x9f5b4[_0xdb2e('0x33')];if(!_0x4c05bd[_0xdb2e('0x35')][_0xdb2e('0x39')](_0xdb2e('0x3a'))){_0x55c8ac['limit']=qs[_0xdb2e('0x3b')](_0x4c05bd['query'][_0xdb2e('0x3b')]);_0x55c8ac[_0xdb2e('0x1e')]=qs[_0xdb2e('0x1e')](_0x4c05bd[_0xdb2e('0x35')][_0xdb2e('0x1e')]);}_0x55c8ac['order']=qs[_0xdb2e('0x3c')](_0x4c05bd[_0xdb2e('0x35')][_0xdb2e('0x3c')]);_0x55c8ac[_0xdb2e('0x3d')]=qs[_0xdb2e('0x32')](_[_0xdb2e('0x3e')](_0x4c05bd[_0xdb2e('0x35')],_0x9f5b4[_0xdb2e('0x32')]),_0x5454b0);if(_0x4c05bd[_0xdb2e('0x35')][_0xdb2e('0x3f')]){_0x55c8ac[_0xdb2e('0x3d')]=_[_0xdb2e('0x40')](_0x55c8ac['where'],{'$or':_[_0xdb2e('0x2d')](_0x5454b0,function(_0x954a4e){if(_0x954a4e[_0xdb2e('0x41')]!==_0xdb2e('0x42')){var _0x13d0f7={};_0x13d0f7[_0x954a4e[_0xdb2e('0x2b')]]={'$like':'%'+_0x4c05bd[_0xdb2e('0x35')][_0xdb2e('0x3f')]+'%'};return _0x13d0f7;}})});}_0x55c8ac=_[_0xdb2e('0x40')]({},_0x55c8ac,_0x4c05bd[_0xdb2e('0x43')]);var _0x2d13ab={'where':_0x55c8ac[_0xdb2e('0x3d')]};return db['AnalyticCustomReport'][_0xdb2e('0x20')](_0x2d13ab)[_0xdb2e('0x25')](function(_0x3437a0){_0x1384a4[_0xdb2e('0x20')]=_0x3437a0;if(_0x4c05bd['query'][_0xdb2e('0x44')]){_0x55c8ac['include']=[{'all':!![]}];}return db['AnalyticCustomReport']['findAll'](_0x55c8ac);})[_0xdb2e('0x25')](function(_0x13f2fe){_0x1384a4[_0xdb2e('0x45')]=_0x13f2fe;return _0x1384a4;})[_0xdb2e('0x25')](respondWithFilteredResult(_0x25ae45,_0x55c8ac))['catch'](handleError(_0x25ae45,null));};exports['show']=function(_0x111f08,_0x3fc088){var _0x1d99a0={'raw':![],'where':{'id':_0x111f08[_0xdb2e('0x46')]['id']}},_0x552401={};_0x552401[_0xdb2e('0x33')]=_['keys'](db[_0xdb2e('0x2e')][_0xdb2e('0x2f')]);_0x552401['query']=_['keys'](_0x111f08[_0xdb2e('0x35')]);_0x552401['filters']=_[_0xdb2e('0x34')](_0x552401[_0xdb2e('0x33')],_0x552401[_0xdb2e('0x35')]);_0x1d99a0[_0xdb2e('0x37')]=_[_0xdb2e('0x34')](_0x552401[_0xdb2e('0x33')],qs[_0xdb2e('0x36')](_0x111f08[_0xdb2e('0x35')][_0xdb2e('0x36')]));_0x1d99a0[_0xdb2e('0x37')]=_0x1d99a0[_0xdb2e('0x37')][_0xdb2e('0x38')]?_0x1d99a0['attributes']:_0x552401['model'];if(_0x111f08[_0xdb2e('0x35')][_0xdb2e('0x44')]){_0x1d99a0[_0xdb2e('0x47')]=[{'all':!![]}];}_0x1d99a0=_[_0xdb2e('0x40')]({},_0x1d99a0,_0x111f08[_0xdb2e('0x43')]);return db[_0xdb2e('0x2e')][_0xdb2e('0x48')](_0x1d99a0)[_0xdb2e('0x25')](handleEntityNotFound(_0x3fc088,null))[_0xdb2e('0x25')](respondWithResult(_0x3fc088,null))[_0xdb2e('0x49')](handleError(_0x3fc088,null));};exports[_0xdb2e('0x4a')]=function(_0x4ae62a,_0xbbaf63){return db[_0xdb2e('0x2e')]['create'](_0x4ae62a[_0xdb2e('0x4b')],{})[_0xdb2e('0x25')](function(_0x43ba10){var _0x5152e8=_0x4ae62a['user'][_0xdb2e('0x27')]({'plain':!![]});if(!_0x5152e8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5152e8['role']===_0xdb2e('0x4c')){var _0x136203=_0x43ba10[_0xdb2e('0x27')]({'plain':!![]});var _0x50a7e5='Reports';return db[_0xdb2e('0x4d')][_0xdb2e('0x48')]({'where':{'name':_0x50a7e5,'userProfileId':_0x5152e8[_0xdb2e('0x4e')]},'raw':!![]})[_0xdb2e('0x25')](function(_0x654a03){if(_0x654a03&&_0x654a03[_0xdb2e('0x4f')]===0x0){return db[_0xdb2e('0x29')][_0xdb2e('0x4a')]({'name':_0x136203['name'],'resourceId':_0x136203['id'],'type':_0xdb2e('0x28'),'sectionId':_0x654a03['id']},{})[_0xdb2e('0x25')](function(){return _0x43ba10;});}else{return _0x43ba10;}})[_0xdb2e('0x49')](function(_0x543e7e){logger[_0xdb2e('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x543e7e);throw _0x543e7e;});}return _0x43ba10;})[_0xdb2e('0x25')](respondWithResult(_0xbbaf63,0xc9))['catch'](handleError(_0xbbaf63,null));};exports['update']=function(_0x6935bc,_0xbbcbeb){if(_0x6935bc[_0xdb2e('0x4b')]['id']){delete _0x6935bc['body']['id'];}return db['AnalyticCustomReport'][_0xdb2e('0x48')]({'where':{'id':_0x6935bc[_0xdb2e('0x46')]['id']}})[_0xdb2e('0x25')](handleEntityNotFound(_0xbbcbeb,null))[_0xdb2e('0x25')](saveUpdates(_0x6935bc['body'],null))['then'](respondWithResult(_0xbbcbeb,null))['catch'](handleError(_0xbbcbeb,null));};exports[_0xdb2e('0x26')]=function(_0x1b876a,_0x9accb6){return db[_0xdb2e('0x2e')]['find']({'where':{'id':_0x1b876a[_0xdb2e('0x46')]['id']}})[_0xdb2e('0x25')](handleEntityNotFound(_0x9accb6,null))[_0xdb2e('0x25')](removeEntity(_0x9accb6,null))[_0xdb2e('0x49')](handleError(_0x9accb6,null));};exports['preview']=function(_0x3d9df1,_0x4e1c83){var _0x296ec2=0xa;var _0x54d8b8=[_0xdb2e('0x51'),_0xdb2e('0x52'),'right_join',_0xdb2e('0x53')];var _0x194672={'SUM':_0xdb2e('0x54'),'COUNT':_0xdb2e('0x55'),'COUNT DISTINCT':_0xdb2e('0x56'),'MAX':_0xdb2e('0x57'),'MIN':'MIN(%s)','AVG':_0xdb2e('0x58'),'GROUP_CONCAT':_0xdb2e('0x59'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xdb2e('0x5a')};var _0x584168={'SEC_TO_TIME':_0xdb2e('0x5b'),'DATE':_0xdb2e('0x5c'),'HOUR':_0xdb2e('0x5d'),'ROUND':_0xdb2e('0x5e'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4ade26=function(_0x4af46d){return!_['includes']([_0xdb2e('0x5f'),'IS\x20NOT\x20NULL',_0xdb2e('0x60'),'IS\x20NOT\x20EMPTY'],_0x4af46d);};var _0x2a3936=function(_0x4c8699){if(!_0x4c8699||!_0x4c8699[_0xdb2e('0x61')]['length']){return'';}for(var _0x4cd4f2='(',_0x3a3c9c=0x0;_0x3a3c9c<_0x4c8699[_0xdb2e('0x61')][_0xdb2e('0x38')];_0x3a3c9c+=0x1){_0x3a3c9c>0x0&&(_0x4cd4f2+='\x20'+_0x4c8699[_0xdb2e('0x62')]+'\x20');_0x4cd4f2+=_0x4c8699['rules'][_0x3a3c9c][_0xdb2e('0x63')]?_0x2a3936(_0x4c8699[_0xdb2e('0x61')][_0x3a3c9c][_0xdb2e('0x63')]):_0x4c8699[_0xdb2e('0x61')][_0x3a3c9c][_0xdb2e('0x64')]+'\x20'+_0x4c8699['rules'][_0x3a3c9c][_0xdb2e('0x65')]+(_0x4ade26(_0x4c8699['rules'][_0x3a3c9c]['condition'])?'\x20'+_0x4c8699['rules'][_0x3a3c9c][_0xdb2e('0x66')]:'');}return _0x4cd4f2+')';};var _0x3aef1c={'where':{'id':_0x3d9df1[_0xdb2e('0x46')]['id']}},_0x55d5b6,_0xcd07be,_0x4ae7bf,_0x37410b,_0xf52371;_0x3aef1c=_[_0xdb2e('0x40')]({},_0x3aef1c,_0x3d9df1['options']);return db['AnalyticCustomReport']['find'](_0x3aef1c)[_0xdb2e('0x25')](function(_0x18e31e){if(_0x18e31e){_0x55d5b6=_0x18e31e;return _0x18e31e[_0xdb2e('0x67')]();}return null;})['then'](function(_0x4ef15a){if(_0x4ef15a){if(!_0x4ef15a[_0xdb2e('0x38')]){throw new db[(_0xdb2e('0x68'))][(_0xdb2e('0x69'))](_0xdb2e('0x6a'),0x193);}_0xcd07be=_0x4ef15a;return db[_0xdb2e('0x6b')][_0xdb2e('0x6c')]({'raw':!![]});}return null;})[_0xdb2e('0x25')](function(_0x410137){if(_0x410137){_0x4ae7bf=_['keyBy'](_0x410137,'id');var _0x2e70fb;var _0x39af88=squel['select']();_0x39af88[_0xdb2e('0x6d')](_0x55d5b6[_0xdb2e('0x6e')]);for(var _0x1e95fa=0x0;_0x1e95fa<_0xcd07be[_0xdb2e('0x38')];_0x1e95fa+=0x1){_0x2e70fb=_0xcd07be[_0x1e95fa][_0xdb2e('0x6f')]?_0x4ae7bf[_0xcd07be[_0x1e95fa][_0xdb2e('0x6f')]][_0xdb2e('0x70')]:_0xcd07be[_0x1e95fa]['field'];_0x2e70fb=_0xcd07be[_0x1e95fa][_0xdb2e('0x71')]?_[_0xdb2e('0x72')](_0x194672[_0xcd07be[_0x1e95fa][_0xdb2e('0x71')]],'%s',_0x2e70fb):_0x2e70fb;_0x2e70fb=_0xcd07be[_0x1e95fa][_0xdb2e('0x73')]?_[_0xdb2e('0x72')](_0x584168[_0xcd07be[_0x1e95fa]['format']],'%s',_0x2e70fb):_0x2e70fb;if(_0xcd07be[_0x1e95fa][_0xdb2e('0x74')]){_0x39af88[_0xdb2e('0x63')](_0x2e70fb);}_0xcd07be[_0x1e95fa][_0xdb2e('0x75')]&&_0x39af88[_0xdb2e('0x76')](_0x2e70fb,_0xcd07be[_0x1e95fa][_0xdb2e('0x75')]===_0xdb2e('0x77')?![]:!![]);_0x39af88[_0xdb2e('0x64')](_0x2e70fb,_0xcd07be[_0x1e95fa][_0xdb2e('0x78')]||_0x2e70fb);}if(_0x55d5b6[_0xdb2e('0x79')]){_0x55d5b6['joins']=JSON['parse'](_0x55d5b6[_0xdb2e('0x79')]);for(var _0x5dd40a=0x0;_0x5dd40a<_0x55d5b6[_0xdb2e('0x79')][_0xdb2e('0x38')];_0x5dd40a+=0x1){if(_0x55d5b6[_0xdb2e('0x79')][_0x5dd40a][_0xdb2e('0x41')]&&_['includes'](_0x54d8b8,_0x55d5b6['joins'][_0x5dd40a][_0xdb2e('0x41')])&&_0x55d5b6[_0xdb2e('0x79')][_0x5dd40a][_0xdb2e('0x7a')]&&_0x55d5b6['joins'][_0x5dd40a][_0xdb2e('0x7b')]&&_0x55d5b6[_0xdb2e('0x79')][_0x5dd40a][_0xdb2e('0x7c')]){_0x39af88[_0x55d5b6[_0xdb2e('0x79')][_0x5dd40a][_0xdb2e('0x41')]](_0x55d5b6[_0xdb2e('0x79')][_0x5dd40a][_0xdb2e('0x7b')],null,util[_0xdb2e('0x73')](_0xdb2e('0x7d'),_0x55d5b6[_0xdb2e('0x6e')],_0x55d5b6[_0xdb2e('0x79')][_0x5dd40a][_0xdb2e('0x7a')],_0x55d5b6[_0xdb2e('0x79')][_0x5dd40a][_0xdb2e('0x7b')],_0x55d5b6['joins'][_0x5dd40a][_0xdb2e('0x7c')]));}}}if(_0x55d5b6['conditions']){_0x55d5b6[_0xdb2e('0x7e')]=JSON[_0xdb2e('0x7f')](_0x55d5b6[_0xdb2e('0x7e')]);_0x39af88[_0xdb2e('0x3d')](_0x2a3936(_0x55d5b6[_0xdb2e('0x7e')][_0xdb2e('0x63')]));}_0xf52371=_0x39af88[_0xdb2e('0x80')]();_0x39af88[_0xdb2e('0x3b')](_0x296ec2);_0x39af88[_0xdb2e('0x1e')](0x0);logger[_0xdb2e('0x81')]('Limited\x20Query:',_0x39af88[_0xdb2e('0x82')]());return dbH[_0xdb2e('0x83')][_0xdb2e('0x35')](_0x39af88['toString'](),{'type':dbH['sequelize'][_0xdb2e('0x84')][_0xdb2e('0x85')]});}})[_0xdb2e('0x25')](respondWithResult(_0x4e1c83,null))[_0xdb2e('0x49')](handleError(_0x4e1c83,null));};function runReport(_0x383a6b,_0x4f5de4,_0x627b45){var _0xc8aaf1=_0x4f5de4[_0xdb2e('0x2b')];var _0x3f8e5a=0xa;var _0x27df56=[_0xdb2e('0x51'),'left_join',_0xdb2e('0x86'),_0xdb2e('0x53')];var _0x570777={'SUM':_0xdb2e('0x54'),'COUNT':_0xdb2e('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xdb2e('0x57'),'MIN':_0xdb2e('0x87'),'AVG':_0xdb2e('0x58'),'GROUP_CONCAT':_0xdb2e('0x59'),'GROUP_CONCAT ASC':_0xdb2e('0x88'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x485d3d={'SEC_TO_TIME':_0xdb2e('0x5b'),'DATE':_0xdb2e('0x5c'),'HOUR':_0xdb2e('0x5d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xdb2e('0x89')};var _0x3f005a=function(_0x3e7129){return!_[_0xdb2e('0x8a')]([_0xdb2e('0x5f'),_0xdb2e('0x8b'),'IS\x20EMPTY',_0xdb2e('0x8c')],_0x3e7129);};var _0x5dc883=function(_0x3ea83e){if(!_0x3ea83e||!_0x3ea83e[_0xdb2e('0x61')]['length']){return'';}for(var _0x5f2011='(',_0x313267=0x0;_0x313267<_0x3ea83e['rules'][_0xdb2e('0x38')];_0x313267+=0x1){_0x313267>0x0&&(_0x5f2011+='\x20'+_0x3ea83e[_0xdb2e('0x62')]+'\x20');_0x5f2011+=_0x3ea83e['rules'][_0x313267][_0xdb2e('0x63')]?_0x5dc883(_0x3ea83e[_0xdb2e('0x61')][_0x313267][_0xdb2e('0x63')]):_0x3ea83e['rules'][_0x313267][_0xdb2e('0x64')]+'\x20'+_0x3ea83e['rules'][_0x313267]['condition']+(_0x3f005a(_0x3ea83e[_0xdb2e('0x61')][_0x313267][_0xdb2e('0x65')])?'\x20'+_0x3ea83e[_0xdb2e('0x61')][_0x313267][_0xdb2e('0x66')]:'');}return _0x5f2011+')';};var _0x2ab1e1={'where':{'id':_0x383a6b['id']}},_0x2648f6,_0x56b2f6,_0x5041d0,_0x19f61a,_0x13c5d7;_0x2ab1e1=_['merge']({},_0x2ab1e1,_0x627b45);return db[_0xdb2e('0x2e')][_0xdb2e('0x48')](_0x2ab1e1)[_0xdb2e('0x25')](function(_0x2166c3){if(_0x2166c3){_0x2648f6=_0x2166c3;return _0x2166c3[_0xdb2e('0x67')]();}return null;})[_0xdb2e('0x25')](function(_0x5eb83f){if(_0x5eb83f){if(!_0x5eb83f[_0xdb2e('0x38')]){throw new db[(_0xdb2e('0x68'))][(_0xdb2e('0x69'))](_0xdb2e('0x6a'),0x193);}_0x56b2f6=_0x5eb83f;return db[_0xdb2e('0x6b')][_0xdb2e('0x6c')]({'raw':!![]});}return null;})[_0xdb2e('0x25')](function(_0x215b57){if(_0x215b57){_0x5041d0=_[_0xdb2e('0x8d')](_0x215b57,'id');var _0x11d9bb;var _0x4ac2e3=squel[_0xdb2e('0x8e')]();_0x4ac2e3['from'](_0x2648f6[_0xdb2e('0x6e')]);for(var _0x132c8f=0x0;_0x132c8f<_0x56b2f6[_0xdb2e('0x38')];_0x132c8f+=0x1){_0x11d9bb=_0x56b2f6[_0x132c8f][_0xdb2e('0x6f')]?_0x5041d0[_0x56b2f6[_0x132c8f][_0xdb2e('0x6f')]]['metric']:_0x56b2f6[_0x132c8f]['field'];_0x11d9bb=_0x56b2f6[_0x132c8f][_0xdb2e('0x71')]?_[_0xdb2e('0x72')](_0x570777[_0x56b2f6[_0x132c8f][_0xdb2e('0x71')]],'%s',_0x11d9bb):_0x11d9bb;_0x11d9bb=_0x56b2f6[_0x132c8f][_0xdb2e('0x73')]?_[_0xdb2e('0x72')](_0x485d3d[_0x56b2f6[_0x132c8f][_0xdb2e('0x73')]],'%s',_0x11d9bb):_0x11d9bb;if(_0x56b2f6[_0x132c8f][_0xdb2e('0x74')]){_0x4ac2e3['group'](_0x11d9bb);}_0x56b2f6[_0x132c8f][_0xdb2e('0x75')]&&_0x4ac2e3[_0xdb2e('0x76')](_0x11d9bb,_0x56b2f6[_0x132c8f][_0xdb2e('0x75')]==='DESC'?![]:!![]);_0x4ac2e3[_0xdb2e('0x64')](_0x11d9bb,_0x56b2f6[_0x132c8f][_0xdb2e('0x78')]||_0x11d9bb);}if(_0x2648f6['joins']){_0x2648f6[_0xdb2e('0x79')]=JSON[_0xdb2e('0x7f')](_0x2648f6[_0xdb2e('0x79')]);for(var _0x314cf2=0x0;_0x314cf2<_0x2648f6[_0xdb2e('0x79')][_0xdb2e('0x38')];_0x314cf2+=0x1){if(_0x2648f6['joins'][_0x314cf2]['type']&&_[_0xdb2e('0x8a')](_0x27df56,_0x2648f6[_0xdb2e('0x79')][_0x314cf2]['type'])&&_0x2648f6[_0xdb2e('0x79')][_0x314cf2]['parentKey']&&_0x2648f6[_0xdb2e('0x79')][_0x314cf2][_0xdb2e('0x7b')]&&_0x2648f6[_0xdb2e('0x79')][_0x314cf2]['foreignKey']){_0x4ac2e3[_0x2648f6['joins'][_0x314cf2][_0xdb2e('0x41')]](_0x2648f6[_0xdb2e('0x79')][_0x314cf2]['foreignTable'],null,util[_0xdb2e('0x73')](_0xdb2e('0x7d'),_0x2648f6[_0xdb2e('0x6e')],_0x2648f6[_0xdb2e('0x79')][_0x314cf2][_0xdb2e('0x7a')],_0x2648f6['joins'][_0x314cf2]['foreignTable'],_0x2648f6[_0xdb2e('0x79')][_0x314cf2][_0xdb2e('0x7c')]));}}}if(_0x2648f6[_0xdb2e('0x7e')]){_0x2648f6[_0xdb2e('0x7e')]=JSON[_0xdb2e('0x7f')](_0x2648f6[_0xdb2e('0x7e')]);_0x4ac2e3[_0xdb2e('0x3d')](_0x5dc883(_0x2648f6[_0xdb2e('0x7e')][_0xdb2e('0x63')]));}_0x13c5d7=_0x4ac2e3[_0xdb2e('0x80')]();_0x4ac2e3[_0xdb2e('0x3b')](_0x3f8e5a);_0x4ac2e3['offset'](0x0);return;}})[_0xdb2e('0x25')](function(){if(_0x4f5de4[_0xdb2e('0x8f')]===_0xdb2e('0x90')){return null;}var _0x18f6c4=_[_0xdb2e('0x40')](_0x4f5de4,{'name':_0x4f5de4[_0xdb2e('0x91')]||_0x4f5de4[_0xdb2e('0x2b')]||_0x2648f6['name'],'basename':_0xc8aaf1,'savename':util['format'](_0xdb2e('0x92'),_0x4f5de4[_0xdb2e('0x2b')]||_0x2648f6[_0xdb2e('0x2b')],require(_0xdb2e('0x93'))['generate'](0x4),_0x4f5de4['output']||_0xdb2e('0x94')),'reportId':_0x2648f6['id'],'reportType':_0xdb2e('0x95')});return db[_0xdb2e('0x96')][_0xdb2e('0x4a')](_0x18f6c4,{'raw':!![]});})[_0xdb2e('0x25')](function(_0x35a6cd){if(_0x2648f6[_0xdb2e('0x6e')]===_0xdb2e('0x97')){_0x13c5d7[_0xdb2e('0x3d')](_0x2648f6[_0xdb2e('0x6e')]+_0xdb2e('0x98'),_0x4f5de4['startDate'],_0x4f5de4[_0xdb2e('0x99')]);}else{_0x13c5d7[_0xdb2e('0x3d')](_0x2648f6[_0xdb2e('0x6e')]+_0xdb2e('0x9a'),_0x4f5de4[_0xdb2e('0x9b')],_0x4f5de4[_0xdb2e('0x99')]);}if(_0x35a6cd){logger[_0xdb2e('0x9c')](_0xdb2e('0x9d'),_0x13c5d7[_0xdb2e('0x82')]());require(_0xdb2e('0x9e'))['fork'](path[_0xdb2e('0x51')](__dirname,'../../components/export/',_0x35a6cd[_0xdb2e('0x8f')]),[_0x35a6cd['id'],_0x13c5d7[_0xdb2e('0x82')](),path[_0xdb2e('0x51')](__dirname,_0xdb2e('0x9f'),_0x35a6cd[_0xdb2e('0xa0')]),_0xc8aaf1]);return _0x35a6cd;}else{var _0x3796eb=squel[_0xdb2e('0x8e')]();_0x3796eb['from']('('+_0x13c5d7[_0xdb2e('0x82')]()+')','countTable');_0x3796eb[_0xdb2e('0x64')](_0xdb2e('0xa1'),'count');_0x13c5d7[_0xdb2e('0x3b')](_0x4f5de4['limit']||_0x3f8e5a);_0x13c5d7[_0xdb2e('0x1e')](_0x4f5de4['offset']||0x0);return dbH['sequelize'][_0xdb2e('0x35')](_0x3796eb['toString'](),{'type':dbH['sequelize'][_0xdb2e('0x84')][_0xdb2e('0x85')]})['then'](function(_0x52f959){if(!_0x52f959[_0xdb2e('0x38')]){_0x19f61a=0x0;}else{_0x19f61a=_0x52f959[0x0][_0xdb2e('0x20')]||0x0;}return dbH[_0xdb2e('0x83')][_0xdb2e('0x35')](_0x13c5d7['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0xdb2e('0x85')]});})[_0xdb2e('0x25')](function(_0x14e7c9){return{'rows':_0x14e7c9||[],'count':_0x19f61a};});}});}exports['run']=function(_0x18b044,_0x561a71){return runReport(_0x18b044['params'],_0x18b044[_0xdb2e('0x35')],_0x18b044[_0xdb2e('0x43')])['then'](respondWithResult(_0x561a71,null))[_0xdb2e('0x49')](handleError(_0x561a71,null));};exports[_0xdb2e('0xa2')]=runReport;exports[_0xdb2e('0x35')]=function(_0x45f862,_0x482d19){var _0x5027c4=0xa;var _0xf30a64=[_0xdb2e('0x51'),_0xdb2e('0x52'),'right_join',_0xdb2e('0x53')];var _0x12cbdb={'SUM':_0xdb2e('0x54'),'COUNT':_0xdb2e('0x55'),'COUNT DISTINCT':_0xdb2e('0x56'),'MAX':_0xdb2e('0x57'),'MIN':_0xdb2e('0x87'),'AVG':_0xdb2e('0x58'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xdb2e('0x88'),'GROUP_CONCAT DESC':_0xdb2e('0x5a')};var _0x35679c={'SEC_TO_TIME':_0xdb2e('0x5b'),'DATE':_0xdb2e('0x5c'),'HOUR':_0xdb2e('0x5d'),'ROUND':_0xdb2e('0x5e'),'UNIX_TIMESTAMP':_0xdb2e('0x89')};var _0x415b46=function(_0x1efd55){return!_[_0xdb2e('0x8a')]([_0xdb2e('0x5f'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0xdb2e('0x8c')],_0x1efd55);};var _0x357939=function(_0x35db1a){if(!_0x35db1a||!_0x35db1a[_0xdb2e('0x61')][_0xdb2e('0x38')]){return'';}for(var _0x455a00='(',_0x56d13c=0x0;_0x56d13c<_0x35db1a['rules'][_0xdb2e('0x38')];_0x56d13c+=0x1){_0x56d13c>0x0&&(_0x455a00+='\x20'+_0x35db1a[_0xdb2e('0x62')]+'\x20');_0x455a00+=_0x35db1a[_0xdb2e('0x61')][_0x56d13c][_0xdb2e('0x63')]?_0x357939(_0x35db1a[_0xdb2e('0x61')][_0x56d13c][_0xdb2e('0x63')]):_0x35db1a[_0xdb2e('0x61')][_0x56d13c][_0xdb2e('0x64')]+'\x20'+_0x35db1a[_0xdb2e('0x61')][_0x56d13c]['condition']+(_0x415b46(_0x35db1a[_0xdb2e('0x61')][_0x56d13c][_0xdb2e('0x65')])?'\x20'+_0x35db1a[_0xdb2e('0x61')][_0x56d13c][_0xdb2e('0x66')]:'');}return _0x455a00+')';};var _0x24b78e={'where':{'id':_0x45f862[_0xdb2e('0x46')]['id']}},_0x967c55,_0x11db14,_0x2cb682,_0x2adaed,_0x96c187;_0x24b78e=_[_0xdb2e('0x40')]({},_0x24b78e,_0x45f862['options']);return db['AnalyticCustomReport']['find'](_0x24b78e)[_0xdb2e('0x25')](function(_0xd0a841){if(_0xd0a841){_0x967c55=_0xd0a841;return _0xd0a841[_0xdb2e('0x67')]();}return null;})[_0xdb2e('0x25')](function(_0x3588dc){if(_0x3588dc){if(!_0x3588dc['length']){throw new db[(_0xdb2e('0x68'))][(_0xdb2e('0x69'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x11db14=_0x3588dc;return db[_0xdb2e('0x6b')][_0xdb2e('0x6c')]({'raw':!![]});}return null;})['then'](function(_0x4a992b){if(_0x4a992b){_0x2cb682=_[_0xdb2e('0x8d')](_0x4a992b,'id');var _0x54988b;var _0x127531=squel['select']();_0x127531[_0xdb2e('0x6d')](_0x967c55[_0xdb2e('0x6e')]);for(var _0x402c85=0x0;_0x402c85<_0x11db14[_0xdb2e('0x38')];_0x402c85+=0x1){_0x54988b=_0x11db14[_0x402c85][_0xdb2e('0x6f')]?_0x2cb682[_0x11db14[_0x402c85][_0xdb2e('0x6f')]][_0xdb2e('0x70')]:_0x11db14[_0x402c85][_0xdb2e('0x64')];_0x54988b=_0x11db14[_0x402c85][_0xdb2e('0x71')]?_[_0xdb2e('0x72')](_0x12cbdb[_0x11db14[_0x402c85][_0xdb2e('0x71')]],'%s',_0x54988b):_0x54988b;_0x54988b=_0x11db14[_0x402c85][_0xdb2e('0x73')]?_[_0xdb2e('0x72')](_0x35679c[_0x11db14[_0x402c85][_0xdb2e('0x73')]],'%s',_0x54988b):_0x54988b;if(_0x11db14[_0x402c85]['groupBy']){_0x127531[_0xdb2e('0x63')](_0x54988b);}_0x11db14[_0x402c85]['orderBy']&&_0x127531[_0xdb2e('0x76')](_0x54988b,_0x11db14[_0x402c85]['orderBy']===_0xdb2e('0x77')?![]:!![]);_0x127531[_0xdb2e('0x64')](_0x54988b,_0x11db14[_0x402c85]['alias']||_0x54988b);}if(_0x967c55['joins']){_0x967c55[_0xdb2e('0x79')]=JSON['parse'](_0x967c55[_0xdb2e('0x79')]);for(var _0x341715=0x0;_0x341715<_0x967c55[_0xdb2e('0x79')][_0xdb2e('0x38')];_0x341715+=0x1){if(_0x967c55[_0xdb2e('0x79')][_0x341715][_0xdb2e('0x41')]&&_['includes'](_0xf30a64,_0x967c55[_0xdb2e('0x79')][_0x341715][_0xdb2e('0x41')])&&_0x967c55['joins'][_0x341715]['parentKey']&&_0x967c55[_0xdb2e('0x79')][_0x341715][_0xdb2e('0x7b')]&&_0x967c55[_0xdb2e('0x79')][_0x341715][_0xdb2e('0x7c')]){_0x127531[_0x967c55['joins'][_0x341715]['type']](_0x967c55[_0xdb2e('0x79')][_0x341715]['foreignTable'],null,util[_0xdb2e('0x73')](_0xdb2e('0x7d'),_0x967c55[_0xdb2e('0x6e')],_0x967c55[_0xdb2e('0x79')][_0x341715][_0xdb2e('0x7a')],_0x967c55[_0xdb2e('0x79')][_0x341715][_0xdb2e('0x7b')],_0x967c55['joins'][_0x341715][_0xdb2e('0x7c')]));}}}if(_0x967c55[_0xdb2e('0x7e')]){_0x967c55[_0xdb2e('0x7e')]=JSON[_0xdb2e('0x7f')](_0x967c55[_0xdb2e('0x7e')]);_0x127531[_0xdb2e('0x3d')](_0x357939(_0x967c55[_0xdb2e('0x7e')]['group']));}_0x96c187=_0x127531[_0xdb2e('0x80')]();_0x127531[_0xdb2e('0x3b')](_0x5027c4);_0x127531[_0xdb2e('0x1e')](0x0);logger['debug'](_0xdb2e('0xa3'),_0x127531[_0xdb2e('0x82')]());return dbH['sequelize'][_0xdb2e('0x35')](_0x127531[_0xdb2e('0x82')](),{'type':dbH[_0xdb2e('0x83')][_0xdb2e('0x84')]['SELECT']});}})[_0xdb2e('0x25')](function(){return{'sql':_0x96c187['toString']()};})[_0xdb2e('0x25')](respondWithResult(_0x482d19,null))['catch'](handleError(_0x482d19,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 1703f37..2b0b420 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 _0x5b23=['../../config/environment','./analyticCustomReport.attributes','exports','AnalyticCustomReport','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x6a70b6,_0x1cc1ec){var _0x5815c9=function(_0x3e5ed5){while(--_0x3e5ed5){_0x6a70b6['push'](_0x6a70b6['shift']());}};_0x5815c9(++_0x1cc1ec);}(_0x5b23,0x1d8));var _0x35b2=function(_0x3f7e37,_0x32f790){_0x3f7e37=_0x3f7e37-0x0;var _0x2a3ec7=_0x5b23[_0x3f7e37];return _0x2a3ec7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x35b2('0x0'))(_0x35b2('0x1'));var moment=require(_0x35b2('0x2'));var BPromise=require('bluebird');var rp=require(_0x35b2('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x35b2('0x4'));var config=require(_0x35b2('0x5'));var attributes=require(_0x35b2('0x6'));module[_0x35b2('0x7')]=function(_0x34aead,_0x350ef7){return _0x34aead['define'](_0x35b2('0x8'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9e06=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','lodash','util'];(function(_0x473155,_0x2f4730){var _0x57525a=function(_0x14a8f2){while(--_0x14a8f2){_0x473155['push'](_0x473155['shift']());}};_0x57525a(++_0x2f4730);}(_0x9e06,0x106));var _0x69e0=function(_0x422d30,_0x5ec4b1){_0x422d30=_0x422d30-0x0;var _0x236072=_0x9e06[_0x422d30];return _0x236072;};'use strict';var _=require(_0x69e0('0x0'));var util=require(_0x69e0('0x1'));var logger=require(_0x69e0('0x2'))(_0x69e0('0x3'));var moment=require(_0x69e0('0x4'));var BPromise=require('bluebird');var rp=require(_0x69e0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x69e0('0x6'));var config=require(_0x69e0('0x7'));var attributes=require(_0x69e0('0x8'));module[_0x69e0('0x9')]=function(_0x47d2aa,_0x308873){return _0x47d2aa[_0x69e0('0xa')](_0x69e0('0xb'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 36a2be3..edafa04 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 _0x5781=['info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','AnalyticCustomReport,\x20%s,\x20%s','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x1f31f7,_0x7b0ec3){var _0x512140=function(_0x48cdc4){while(--_0x48cdc4){_0x1f31f7['push'](_0x1f31f7['shift']());}};_0x512140(++_0x7b0ec3);}(_0x5781,0xab));var _0x1578=function(_0x236eb5,_0x50fc4f){_0x236eb5=_0x236eb5-0x0;var _0x20582e=_0x5781[_0x236eb5];return _0x20582e;};'use strict';var _=require(_0x1578('0x0'));var util=require(_0x1578('0x1'));var moment=require(_0x1578('0x2'));var BPromise=require(_0x1578('0x3'));var rs=require(_0x1578('0x4'));var fs=require('fs');var Redis=require(_0x1578('0x5'));var db=require(_0x1578('0x6'))['db'];var utils=require(_0x1578('0x7'));var logger=require(_0x1578('0x8'))('rpc');var config=require(_0x1578('0x9'));var jayson=require(_0x1578('0xa'));var client=jayson['client'][_0x1578('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x447971,_0x14977d,_0x22f6e7){return new BPromise(function(_0x1b9b4d,_0x53ae4e){return client[_0x1578('0xc')](_0x447971,_0x22f6e7)['then'](function(_0x249cdd){logger['info'](_0x1578('0xd'),_0x14977d,'request\x20sent');logger[_0x1578('0xe')](_0x1578('0xf'),_0x14977d,_0x1578('0x10'),JSON[_0x1578('0x11')](_0x249cdd));if(_0x249cdd[_0x1578('0x12')]){if(_0x249cdd[_0x1578('0x12')][_0x1578('0x13')]===0x1f4){logger[_0x1578('0x12')](_0x1578('0xd'),_0x14977d,_0x249cdd[_0x1578('0x12')]['message']);return _0x53ae4e(_0x249cdd[_0x1578('0x12')][_0x1578('0x14')]);}logger[_0x1578('0x12')](_0x1578('0xd'),_0x14977d,_0x249cdd[_0x1578('0x12')][_0x1578('0x14')]);return _0x1b9b4d(_0x249cdd[_0x1578('0x12')][_0x1578('0x14')]);}else{logger[_0x1578('0x15')]('AnalyticCustomReport,\x20%s,\x20%s',_0x14977d,_0x1578('0x10'));_0x1b9b4d(_0x249cdd[_0x1578('0x16')][_0x1578('0x14')]);}})[_0x1578('0x17')](function(_0x519538){logger[_0x1578('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0x14977d,_0x519538);_0x53ae4e(_0x519538);});});} \ No newline at end of file +var _0xefe6=['rpc','../../config/environment','jayson/promise','http','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xefe6,0x8c));var _0x6efe=function(_0x58e09b,_0x6ef44c){_0x58e09b=_0x58e09b-0x0;var _0x243038=_0xefe6[_0x58e09b];return _0x243038;};'use strict';var _=require('lodash');var util=require(_0x6efe('0x0'));var moment=require(_0x6efe('0x1'));var BPromise=require(_0x6efe('0x2'));var rs=require(_0x6efe('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6efe('0x4'))['db'];var utils=require(_0x6efe('0x5'));var logger=require(_0x6efe('0x6'))(_0x6efe('0x7'));var config=require(_0x6efe('0x8'));var jayson=require(_0x6efe('0x9'));var client=jayson['client'][_0x6efe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28e0ae,_0xc70024,_0x4f71ee){return new BPromise(function(_0x2cc472,_0x102471){return client['request'](_0x28e0ae,_0x4f71ee)['then'](function(_0x1c383f){logger[_0x6efe('0xb')](_0x6efe('0xc'),_0xc70024,_0x6efe('0xd'));logger[_0x6efe('0xe')](_0x6efe('0xf'),_0xc70024,_0x6efe('0xd'),JSON[_0x6efe('0x10')](_0x1c383f));if(_0x1c383f[_0x6efe('0x11')]){if(_0x1c383f[_0x6efe('0x11')]['code']===0x1f4){logger[_0x6efe('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0xc70024,_0x1c383f['error'][_0x6efe('0x12')]);return _0x102471(_0x1c383f['error'][_0x6efe('0x12')]);}logger[_0x6efe('0x11')](_0x6efe('0xc'),_0xc70024,_0x1c383f[_0x6efe('0x11')][_0x6efe('0x12')]);return _0x2cc472(_0x1c383f[_0x6efe('0x11')][_0x6efe('0x12')]);}else{logger[_0x6efe('0xb')]('AnalyticCustomReport,\x20%s,\x20%s',_0xc70024,_0x6efe('0xd'));_0x2cc472(_0x1c383f[_0x6efe('0x13')][_0x6efe('0x12')]);}})[_0x6efe('0x14')](function(_0x2f9c19){logger[_0x6efe('0x11')](_0x6efe('0xc'),_0xc70024,_0x2f9c19);_0x102471(_0x2f9c19);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 879c131..a49aa23 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 _0xada0=['create','put','update','delete','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated','index','get','/:id','show','/:id/preview','preview','/:id/run','/:id/query','query'];(function(_0x5584ce,_0x341577){var _0x5761ab=function(_0x4bff84){while(--_0x4bff84){_0x5584ce['push'](_0x5584ce['shift']());}};_0x5761ab(++_0x341577);}(_0xada0,0x9f));var _0x0ada=function(_0x55f2ee,_0x52bffa){_0x55f2ee=_0x55f2ee-0x0;var _0x39e718=_0xada0[_0x55f2ee];return _0x39e718;};'use strict';var multer=require(_0x0ada('0x0'));var util=require('util');var path=require(_0x0ada('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0ada('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x0ada('0x3'));var interaction=require(_0x0ada('0x4'));var config=require(_0x0ada('0x5'));var controller=require(_0x0ada('0x6'));router['get']('/',auth[_0x0ada('0x7')](),controller[_0x0ada('0x8')]);router[_0x0ada('0x9')](_0x0ada('0xa'),auth[_0x0ada('0x7')](),controller[_0x0ada('0xb')]);router[_0x0ada('0x9')](_0x0ada('0xc'),auth[_0x0ada('0x7')](),controller[_0x0ada('0xd')]);router['get'](_0x0ada('0xe'),auth[_0x0ada('0x7')](),controller['run']);router[_0x0ada('0x9')](_0x0ada('0xf'),auth['isAuthenticated'](),controller[_0x0ada('0x10')]);router['post']('/',auth[_0x0ada('0x7')](),controller[_0x0ada('0x11')]);router[_0x0ada('0x12')](_0x0ada('0xa'),auth[_0x0ada('0x7')](),controller[_0x0ada('0x13')]);router[_0x0ada('0x14')](_0x0ada('0xa'),auth[_0x0ada('0x7')](),controller['destroy']);module[_0x0ada('0x15')]=router; \ No newline at end of file +var _0x0211=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','preview','/:id/run','/:id/query','isAuthenticated','query','post','/:id','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x23a6c3,_0xcbb1d3){var _0x30c897=function(_0x19168b){while(--_0x19168b){_0x23a6c3['push'](_0x23a6c3['shift']());}};_0x30c897(++_0xcbb1d3);}(_0x0211,0x1b6));var _0x1021=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x0211[_0x31e29a];return _0x32d892;};'use strict';var multer=require('multer');var util=require(_0x1021('0x0'));var path=require(_0x1021('0x1'));var timeout=require(_0x1021('0x2'));var express=require(_0x1021('0x3'));var router=express[_0x1021('0x4')]();var fs_extra=require(_0x1021('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1021('0x6'));var config=require(_0x1021('0x7'));var controller=require(_0x1021('0x8'));router[_0x1021('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1021('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x1021('0x9')]('/:id/preview',auth['isAuthenticated'](),controller[_0x1021('0xa')]);router[_0x1021('0x9')](_0x1021('0xb'),auth['isAuthenticated'](),controller['run']);router[_0x1021('0x9')](_0x1021('0xc'),auth[_0x1021('0xd')](),controller[_0x1021('0xe')]);router[_0x1021('0xf')]('/',auth[_0x1021('0xd')](),controller['create']);router['put'](_0x1021('0x10'),auth[_0x1021('0xd')](),controller[_0x1021('0x11')]);router[_0x1021('0x12')](_0x1021('0x10'),auth[_0x1021('0xd')](),controller[_0x1021('0x13')]);module[_0x1021('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 75c4eff..8b58f09 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 _0x53ec=['STRING','TEXT','sequelize','exports'];(function(_0x258ff0,_0x3efa61){var _0x3ccb77=function(_0x3e850f){while(--_0x3e850f){_0x258ff0['push'](_0x258ff0['shift']());}};_0x3ccb77(++_0x3efa61);}(_0x53ec,0x192));var _0xc53e=function(_0x117b82,_0x13554b){_0x117b82=_0x117b82-0x0;var _0x3a8975=_0x53ec[_0x117b82];return _0x3a8975;};'use strict';var Sequelize=require(_0xc53e('0x0'));module[_0xc53e('0x1')]={'name':{'type':Sequelize[_0xc53e('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xc53e('0x2')]},'parent':{'type':Sequelize[_0xc53e('0x2')]},'table':{'type':Sequelize[_0xc53e('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xc53e('0x3')]}}; \ No newline at end of file +var _0xb4c7=['STRING','TEXT','sequelize','exports'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x339301,_0x4d9089){_0x339301=_0x339301-0x0;var _0x25a96f=_0xb4c7[_0x339301];return _0x25a96f;};'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/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 6655b21..e841ae7 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 _0x31f0=['fullPath','%s-%s.%s','randomstring','generate','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','../../components/export/','../../files/reports','countTable','COUNT(*)','run','runReport','DATE(%s)','keyBy','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','get','DefaultReports','destroy','error','name','send','index','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','include','findAll','rows','catch','params','length','find','create','user','role','Reports','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','preview','join','left_join','right_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','from','table','function','replace','format','orderBy','DESC','field','alias','parse','joins','parentKey','foreignKey','%s.%s\x20=\x20%s.%s','foreignTable','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','cross_join','COUNT(DISTINCT\x20%s)','AVG(%s)','HOUR(%s)','ROUND(%s)','IS\x20NOT\x20NULL','getFields','MetricId','metric','groupBy','output','web'];(function(_0x371367,_0x1eec1a){var _0x57c4f1=function(_0x369840){while(--_0x369840){_0x371367['push'](_0x371367['shift']());}};_0x57c4f1(++_0x1eec1a);}(_0x31f0,0xb7));var _0x031f=function(_0x25c294,_0x43c6d7){_0x25c294=_0x25c294-0x0;var _0x3724f5=_0x31f0[_0x25c294];return _0x3724f5;};'use strict';var emlformat=require(_0x031f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x031f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x031f('0x2'));var moment=require(_0x031f('0x3'));var BPromise=require(_0x031f('0x4'));var Mustache=require(_0x031f('0x5'));var util=require('util');var path=require(_0x031f('0x6'));var sox=require(_0x031f('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x031f('0x8'));var squel=require('squel');var crypto=require(_0x031f('0x9'));var jsforce=require(_0x031f('0xa'));var deskjs=require(_0x031f('0xb'));var toCsv=require(_0x031f('0xc'));var querystring=require('querystring');var Papa=require(_0x031f('0xd'));var Redis=require(_0x031f('0xe'));var authService=require(_0x031f('0xf'));var qs=require(_0x031f('0x10'));var as=require(_0x031f('0x11'));var hardwareService=require(_0x031f('0x12'));var logger=require(_0x031f('0x13'))(_0x031f('0x14'));var utils=require('../../config/utils');var config=require(_0x031f('0x15'));var licenseUtil=require(_0x031f('0x16'));var db=require(_0x031f('0x17'))['db'];var dbH=require(_0x031f('0x17'))[_0x031f('0x18')];function respondWithStatusCode(_0x405896,_0x1c230d){_0x1c230d=_0x1c230d||0xcc;return function(_0x5d0457){if(_0x5d0457){return _0x405896[_0x031f('0x19')](_0x1c230d);}return _0x405896[_0x031f('0x1a')](_0x1c230d)[_0x031f('0x1b')]();};}function respondWithResult(_0x2e3dfe,_0x2ea549){_0x2ea549=_0x2ea549||0xc8;return function(_0x57f9c0){if(_0x57f9c0){return _0x2e3dfe['status'](_0x2ea549)[_0x031f('0x1c')](_0x57f9c0);}};}function respondWithFilteredResult(_0x3a10aa,_0xe4fc1d){return function(_0x286177){if(_0x286177){var _0x5196b1=typeof _0xe4fc1d[_0x031f('0x1d')]===_0x031f('0x1e')&&typeof _0xe4fc1d['limit']===_0x031f('0x1e');var _0x535e70=_0x286177[_0x031f('0x1f')];var _0x5f2199=_0x5196b1?0x0:_0xe4fc1d[_0x031f('0x1d')];var _0xaa155=_0x5196b1?_0x286177[_0x031f('0x1f')]:_0xe4fc1d[_0x031f('0x1d')]+_0xe4fc1d[_0x031f('0x20')];var _0x2825ef;if(_0xaa155>=_0x535e70){_0xaa155=_0x535e70;_0x2825ef=0xc8;}else{_0x2825ef=0xce;}_0x3a10aa[_0x031f('0x1a')](_0x2825ef);return _0x3a10aa[_0x031f('0x21')](_0x031f('0x22'),_0x5f2199+'-'+_0xaa155+'/'+_0x535e70)['json'](_0x286177);}return null;};}function patchUpdates(_0xf72793){return function(_0x33926c){try{jsonpatch[_0x031f('0x23')](_0x33926c,_0xf72793,!![]);}catch(_0x4d6706){return BPromise['reject'](_0x4d6706);}return _0x33926c[_0x031f('0x24')]();};}function saveUpdates(_0x4d0f92,_0x3472a2){return function(_0x57f6c4){if(_0x57f6c4){return _0x57f6c4['update'](_0x4d0f92)['then'](function(_0x971691){return _0x971691;});}return null;};}function removeEntity(_0x12c406,_0x2920cd){return function(_0x4c8126){if(_0x4c8126){return _0x4c8126['destroy']()[_0x031f('0x25')](function(){var _0x5a64c0=_0x4c8126[_0x031f('0x26')]({'plain':!![]});var _0x1f5a14=_0x031f('0x27');return db['UserProfileResource'][_0x031f('0x28')]({'where':{'type':_0x1f5a14,'resourceId':_0x5a64c0['id']}})[_0x031f('0x25')](function(){return _0x4c8126;});})['then'](function(){_0x12c406[_0x031f('0x1a')](0xcc)[_0x031f('0x1b')]();});}};}function handleEntityNotFound(_0x2403e9,_0x5395ea){return function(_0xa308b){if(!_0xa308b){_0x2403e9[_0x031f('0x19')](0x194);}return _0xa308b;};}function handleError(_0xb6ed6c,_0xaf5bea){_0xaf5bea=_0xaf5bea||0x1f4;return function(_0xfaa36){logger[_0x031f('0x29')](_0xfaa36['stack']);if(_0xfaa36[_0x031f('0x2a')]){delete _0xfaa36[_0x031f('0x2a')];}_0xb6ed6c[_0x031f('0x1a')](_0xaf5bea)[_0x031f('0x2b')](_0xfaa36);};}exports[_0x031f('0x2c')]=function(_0x2d24f0,_0x378692){var _0x87dc07={},_0x2034ac={},_0xfc4a89={'count':0x0,'rows':[]};var _0x2cf3a8=_['map'](db[_0x031f('0x2d')][_0x031f('0x2e')],function(_0xb3a6bd){return{'name':_0xb3a6bd[_0x031f('0x2f')],'type':_0xb3a6bd[_0x031f('0x30')][_0x031f('0x31')]};});_0x2034ac[_0x031f('0x32')]=_[_0x031f('0x33')](_0x2cf3a8,_0x031f('0x2a'));_0x2034ac[_0x031f('0x34')]=_[_0x031f('0x35')](_0x2d24f0[_0x031f('0x34')]);_0x2034ac[_0x031f('0x36')]=_['intersection'](_0x2034ac[_0x031f('0x32')],_0x2034ac[_0x031f('0x34')]);_0x87dc07['attributes']=_[_0x031f('0x37')](_0x2034ac[_0x031f('0x32')],qs['fields'](_0x2d24f0[_0x031f('0x34')][_0x031f('0x38')]));_0x87dc07[_0x031f('0x39')]=_0x87dc07[_0x031f('0x39')]['length']?_0x87dc07['attributes']:_0x2034ac[_0x031f('0x32')];if(!_0x2d24f0['query'][_0x031f('0x3a')](_0x031f('0x3b'))){_0x87dc07[_0x031f('0x20')]=qs['limit'](_0x2d24f0['query'][_0x031f('0x20')]);_0x87dc07['offset']=qs['offset'](_0x2d24f0[_0x031f('0x34')][_0x031f('0x1d')]);}_0x87dc07[_0x031f('0x3c')]=qs[_0x031f('0x3d')](_0x2d24f0[_0x031f('0x34')][_0x031f('0x3d')]);_0x87dc07[_0x031f('0x3e')]=qs['filters'](_[_0x031f('0x3f')](_0x2d24f0[_0x031f('0x34')],_0x2034ac[_0x031f('0x36')]),_0x2cf3a8);if(_0x2d24f0[_0x031f('0x34')]['filter']){_0x87dc07[_0x031f('0x3e')]=_[_0x031f('0x40')](_0x87dc07[_0x031f('0x3e')],{'$or':_['map'](_0x2cf3a8,function(_0x24ec95){if(_0x24ec95[_0x031f('0x30')]!=='VIRTUAL'){var _0x36bafa={};_0x36bafa[_0x24ec95[_0x031f('0x2a')]]={'$like':'%'+_0x2d24f0['query']['filter']+'%'};return _0x36bafa;}})});}_0x87dc07=_[_0x031f('0x40')]({},_0x87dc07,_0x2d24f0[_0x031f('0x41')]);var _0x9efbc4={'where':_0x87dc07[_0x031f('0x3e')]};return db[_0x031f('0x2d')][_0x031f('0x1f')](_0x9efbc4)[_0x031f('0x25')](function(_0x5a212c){_0xfc4a89[_0x031f('0x1f')]=_0x5a212c;if(_0x2d24f0[_0x031f('0x34')]['includeAll']){_0x87dc07[_0x031f('0x42')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x031f('0x43')](_0x87dc07);})[_0x031f('0x25')](function(_0x56dd24){_0xfc4a89[_0x031f('0x44')]=_0x56dd24;return _0xfc4a89;})[_0x031f('0x25')](respondWithFilteredResult(_0x378692,_0x87dc07))[_0x031f('0x45')](handleError(_0x378692,null));};exports['show']=function(_0x98747f,_0x213e1c){var _0x1d3324={'raw':!![],'where':{'id':_0x98747f[_0x031f('0x46')]['id']}},_0x2a6cba={};_0x2a6cba[_0x031f('0x32')]=_[_0x031f('0x35')](db[_0x031f('0x2d')][_0x031f('0x2e')]);_0x2a6cba['query']=_[_0x031f('0x35')](_0x98747f[_0x031f('0x34')]);_0x2a6cba[_0x031f('0x36')]=_[_0x031f('0x37')](_0x2a6cba[_0x031f('0x32')],_0x2a6cba[_0x031f('0x34')]);_0x1d3324[_0x031f('0x39')]=_[_0x031f('0x37')](_0x2a6cba[_0x031f('0x32')],qs['fields'](_0x98747f[_0x031f('0x34')]['fields']));_0x1d3324['attributes']=_0x1d3324[_0x031f('0x39')][_0x031f('0x47')]?_0x1d3324[_0x031f('0x39')]:_0x2a6cba[_0x031f('0x32')];if(_0x98747f[_0x031f('0x34')]['includeAll']){_0x1d3324[_0x031f('0x42')]=[{'all':!![]}];}_0x1d3324=_[_0x031f('0x40')]({},_0x1d3324,_0x98747f[_0x031f('0x41')]);return db['AnalyticDefaultReport'][_0x031f('0x48')](_0x1d3324)[_0x031f('0x25')](handleEntityNotFound(_0x213e1c,null))[_0x031f('0x25')](respondWithResult(_0x213e1c,null))[_0x031f('0x45')](handleError(_0x213e1c,null));};exports[_0x031f('0x49')]=function(_0x12d28e,_0x5caeb5){return db['AnalyticDefaultReport'][_0x031f('0x49')](_0x12d28e['body'],{})[_0x031f('0x25')](function(_0x3bba44){var _0x5a29e0=_0x12d28e[_0x031f('0x4a')]['get']({'plain':!![]});if(!_0x5a29e0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a29e0[_0x031f('0x4b')]==='user'){var _0x16bade=_0x3bba44['get']({'plain':!![]});var _0x11bf43=_0x031f('0x4c');return db['UserProfileSection'][_0x031f('0x48')]({'where':{'name':_0x11bf43,'userProfileId':_0x5a29e0[_0x031f('0x4d')]},'raw':!![]})['then'](function(_0x46471a){if(_0x46471a&&_0x46471a['autoAssociation']===0x0){return db[_0x031f('0x4e')]['create']({'name':_0x16bade[_0x031f('0x2a')],'resourceId':_0x16bade['id'],'type':_0x031f('0x27'),'sectionId':_0x46471a['id']},{})[_0x031f('0x25')](function(){return _0x3bba44;});}else{return _0x3bba44;}})[_0x031f('0x45')](function(_0x691a68){logger['error'](_0x031f('0x4f'),_0x691a68);throw _0x691a68;});}return _0x3bba44;})['then'](respondWithResult(_0x5caeb5,0xc9))[_0x031f('0x45')](handleError(_0x5caeb5,null));};exports[_0x031f('0x50')]=function(_0x4d49f8,_0x1f9c55){if(_0x4d49f8[_0x031f('0x51')]['id']){delete _0x4d49f8['body']['id'];}return db[_0x031f('0x2d')][_0x031f('0x48')]({'where':{'id':_0x4d49f8[_0x031f('0x46')]['id']}})['then'](handleEntityNotFound(_0x1f9c55,null))[_0x031f('0x25')](saveUpdates(_0x4d49f8['body'],null))[_0x031f('0x25')](respondWithResult(_0x1f9c55,null))['catch'](handleError(_0x1f9c55,null));};exports[_0x031f('0x28')]=function(_0x561a2b,_0xa52a54){return db[_0x031f('0x2d')]['find']({'where':{'id':_0x561a2b['params']['id']}})[_0x031f('0x25')](handleEntityNotFound(_0xa52a54,null))[_0x031f('0x25')](removeEntity(_0xa52a54,null))['catch'](handleError(_0xa52a54,null));};exports[_0x031f('0x52')]=function(_0xb44c73,_0x255003){var _0x286d4e=0xa;var _0x21a89d=[_0x031f('0x53'),_0x031f('0x54'),_0x031f('0x55'),'cross_join'];var _0xe452c2={'SUM':_0x031f('0x56'),'COUNT':_0x031f('0x57'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x031f('0x58'),'MIN':_0x031f('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x031f('0x5a'),'GROUP_CONCAT ASC':_0x031f('0x5b'),'GROUP_CONCAT DESC':_0x031f('0x5c')};var _0x198e2e={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x031f('0x5d')};var _0xcf8b7=function(_0x4a7fbb){return!_[_0x031f('0x5e')]([_0x031f('0x5f'),'IS\x20NOT\x20NULL',_0x031f('0x60'),_0x031f('0x61')],_0x4a7fbb);};var _0x451c71=function(_0x22d211){if(!_0x22d211||!_0x22d211[_0x031f('0x62')][_0x031f('0x47')]){return'';}for(var _0x2ddf15='(',_0x4527e5=0x0;_0x4527e5<_0x22d211[_0x031f('0x62')]['length'];_0x4527e5+=0x1){_0x4527e5>0x0&&(_0x2ddf15+='\x20'+_0x22d211[_0x031f('0x63')]+'\x20');_0x2ddf15+=_0x22d211['rules'][_0x4527e5][_0x031f('0x64')]?_0x451c71(_0x22d211[_0x031f('0x62')][_0x4527e5][_0x031f('0x64')]):_0x22d211['rules'][_0x4527e5]['field']+'\x20'+_0x22d211[_0x031f('0x62')][_0x4527e5][_0x031f('0x65')]+(_0xcf8b7(_0x22d211[_0x031f('0x62')][_0x4527e5][_0x031f('0x65')])?'\x20'+_0x22d211['rules'][_0x4527e5][_0x031f('0x66')]:'');}return _0x2ddf15+')';};var _0x5a181c={'where':{'id':_0xb44c73[_0x031f('0x46')]['id']}},_0x478982,_0x2179ee,_0x534bae,_0x50d618,_0x71e67;_0x5a181c=_[_0x031f('0x40')]({},_0x5a181c,_0xb44c73[_0x031f('0x41')]);return db[_0x031f('0x2d')]['find'](_0x5a181c)['then'](function(_0x214eec){if(_0x214eec){_0x478982=_0x214eec;return _0x214eec['getFields']();}return null;})[_0x031f('0x25')](function(_0xa921b2){if(_0xa921b2){if(!_0xa921b2['length']){throw new db[(_0x031f('0x67'))][(_0x031f('0x68'))](_0x031f('0x69'),0x193);}_0x2179ee=_0xa921b2;return db[_0x031f('0x6a')][_0x031f('0x43')]({'raw':!![]});}return null;})[_0x031f('0x25')](function(_0x5bea08){if(_0x5bea08){_0x534bae=_['keyBy'](_0x5bea08,'id');var _0x3bcc7e;var _0x232b62=squel[_0x031f('0x6b')]();_0x232b62[_0x031f('0x6c')](_0x478982[_0x031f('0x6d')]);for(var _0x26fa57=0x0;_0x26fa57<_0x2179ee[_0x031f('0x47')];_0x26fa57+=0x1){_0x3bcc7e=_0x2179ee[_0x26fa57]['MetricId']?_0x534bae[_0x2179ee[_0x26fa57]['MetricId']]['metric']:_0x2179ee[_0x26fa57]['field'];_0x3bcc7e=_0x2179ee[_0x26fa57][_0x031f('0x6e')]?_[_0x031f('0x6f')](_0xe452c2[_0x2179ee[_0x26fa57][_0x031f('0x6e')]],'%s',_0x3bcc7e):_0x3bcc7e;_0x3bcc7e=_0x2179ee[_0x26fa57]['format']?_[_0x031f('0x6f')](_0x198e2e[_0x2179ee[_0x26fa57][_0x031f('0x70')]],'%s',_0x3bcc7e):_0x3bcc7e;if(_0x2179ee[_0x26fa57]['groupBy']){_0x232b62[_0x031f('0x64')](_0x3bcc7e);}_0x2179ee[_0x26fa57][_0x031f('0x71')]&&_0x232b62[_0x031f('0x3c')](_0x3bcc7e,_0x2179ee[_0x26fa57][_0x031f('0x71')]===_0x031f('0x72')?![]:!![]);_0x232b62[_0x031f('0x73')](_0x3bcc7e,_0x2179ee[_0x26fa57][_0x031f('0x74')]||_0x3bcc7e);}if(_0x478982['joins']){_0x478982['joins']=JSON[_0x031f('0x75')](_0x478982['joins']);for(var _0x2ed9c1=0x0;_0x2ed9c1<_0x478982['joins'][_0x031f('0x47')];_0x2ed9c1+=0x1){if(_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x30')]&&_['includes'](_0x21a89d,_0x478982[_0x031f('0x76')][_0x2ed9c1]['type'])&&_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x77')]&&_0x478982[_0x031f('0x76')][_0x2ed9c1]['foreignTable']&&_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x78')]){_0x232b62[_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x30')]](_0x478982[_0x031f('0x76')][_0x2ed9c1]['foreignTable'],null,util['format'](_0x031f('0x79'),_0x478982[_0x031f('0x6d')],_0x478982['joins'][_0x2ed9c1][_0x031f('0x77')],_0x478982['joins'][_0x2ed9c1][_0x031f('0x7a')],_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x78')]));}}}if(_0x478982[_0x031f('0x7b')]){_0x478982['conditions']=JSON[_0x031f('0x75')](_0x478982[_0x031f('0x7b')]);_0x232b62[_0x031f('0x3e')](_0x451c71(_0x478982['conditions'][_0x031f('0x64')]));}_0x71e67=_0x232b62[_0x031f('0x7c')]();_0x232b62['limit'](_0x286d4e);_0x232b62[_0x031f('0x1d')](0x0);logger[_0x031f('0x7d')](_0x031f('0x7e'),_0x232b62[_0x031f('0x7f')]());return dbH[_0x031f('0x80')][_0x031f('0x34')](_0x232b62[_0x031f('0x7f')](),{'type':dbH['sequelize'][_0x031f('0x81')][_0x031f('0x82')]});}})[_0x031f('0x25')](respondWithResult(_0x255003,null))['catch'](handleError(_0x255003,null));};function runReport(_0x4f4aff,_0x26de7c,_0x5bd344){var _0x54f02d=_0x26de7c[_0x031f('0x2a')];var _0x184bbd=0xa;var _0x1c8055=[_0x031f('0x53'),_0x031f('0x54'),_0x031f('0x55'),_0x031f('0x83')];var _0x32c626={'SUM':_0x031f('0x56'),'COUNT':_0x031f('0x57'),'COUNT DISTINCT':_0x031f('0x84'),'MAX':'MAX(%s)','MIN':_0x031f('0x59'),'AVG':_0x031f('0x85'),'GROUP_CONCAT':_0x031f('0x5a'),'GROUP_CONCAT ASC':_0x031f('0x5b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x6970f5={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x031f('0x86'),'ROUND':_0x031f('0x87'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x510bb6=function(_0x3cfaa4){return!_[_0x031f('0x5e')]([_0x031f('0x5f'),_0x031f('0x88'),_0x031f('0x60'),_0x031f('0x61')],_0x3cfaa4);};var _0x5e0853=function(_0x263658){if(!_0x263658||!_0x263658[_0x031f('0x62')]['length']){return'';}for(var _0x25ea89='(',_0x2f2e96=0x0;_0x2f2e96<_0x263658[_0x031f('0x62')][_0x031f('0x47')];_0x2f2e96+=0x1){_0x2f2e96>0x0&&(_0x25ea89+='\x20'+_0x263658[_0x031f('0x63')]+'\x20');_0x25ea89+=_0x263658[_0x031f('0x62')][_0x2f2e96][_0x031f('0x64')]?_0x5e0853(_0x263658['rules'][_0x2f2e96][_0x031f('0x64')]):_0x263658['rules'][_0x2f2e96][_0x031f('0x73')]+'\x20'+_0x263658[_0x031f('0x62')][_0x2f2e96][_0x031f('0x65')]+(_0x510bb6(_0x263658['rules'][_0x2f2e96]['condition'])?'\x20'+_0x263658['rules'][_0x2f2e96][_0x031f('0x66')]:'');}return _0x25ea89+')';};var _0xee744={'where':{'id':_0x4f4aff['id']}},_0x8f0afd,_0x2985fe,_0x290f82,_0x307246,_0x232aa0;_0xee744=_['merge']({},_0xee744,_0x5bd344);return db['AnalyticDefaultReport'][_0x031f('0x48')](_0xee744)[_0x031f('0x25')](function(_0x54d86e){if(_0x54d86e){_0x8f0afd=_0x54d86e;return _0x54d86e[_0x031f('0x89')]();}return null;})['then'](function(_0x1c31d5){if(_0x1c31d5){if(!_0x1c31d5[_0x031f('0x47')]){throw new db['Sequelize'][(_0x031f('0x68'))](_0x031f('0x69'),0x193);}_0x2985fe=_0x1c31d5;return db['AnalyticMetric'][_0x031f('0x43')]({'raw':!![]});}return null;})[_0x031f('0x25')](function(_0x1b588e){if(_0x1b588e){_0x290f82=_['keyBy'](_0x1b588e,'id');var _0xa9b5e2;var _0x31504b=squel[_0x031f('0x6b')]();_0x31504b[_0x031f('0x6c')](_0x8f0afd[_0x031f('0x6d')]);for(var _0x2b3326=0x0;_0x2b3326<_0x2985fe['length'];_0x2b3326+=0x1){_0xa9b5e2=_0x2985fe[_0x2b3326][_0x031f('0x8a')]?_0x290f82[_0x2985fe[_0x2b3326][_0x031f('0x8a')]][_0x031f('0x8b')]:_0x2985fe[_0x2b3326][_0x031f('0x73')];_0xa9b5e2=_0x2985fe[_0x2b3326]['function']?_[_0x031f('0x6f')](_0x32c626[_0x2985fe[_0x2b3326][_0x031f('0x6e')]],'%s',_0xa9b5e2):_0xa9b5e2;_0xa9b5e2=_0x2985fe[_0x2b3326]['format']?_[_0x031f('0x6f')](_0x6970f5[_0x2985fe[_0x2b3326][_0x031f('0x70')]],'%s',_0xa9b5e2):_0xa9b5e2;if(_0x2985fe[_0x2b3326][_0x031f('0x8c')]){_0x31504b[_0x031f('0x64')](_0xa9b5e2);}_0x2985fe[_0x2b3326][_0x031f('0x71')]&&_0x31504b[_0x031f('0x3c')](_0xa9b5e2,_0x2985fe[_0x2b3326][_0x031f('0x71')]===_0x031f('0x72')?![]:!![]);_0x31504b[_0x031f('0x73')](_0xa9b5e2,_0x2985fe[_0x2b3326][_0x031f('0x74')]||_0xa9b5e2);}if(_0x8f0afd[_0x031f('0x76')]){_0x8f0afd[_0x031f('0x76')]=JSON[_0x031f('0x75')](_0x8f0afd[_0x031f('0x76')]);for(var _0x2433ce=0x0;_0x2433ce<_0x8f0afd['joins'][_0x031f('0x47')];_0x2433ce+=0x1){if(_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x30')]&&_[_0x031f('0x5e')](_0x1c8055,_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x30')])&&_0x8f0afd['joins'][_0x2433ce]['parentKey']&&_0x8f0afd['joins'][_0x2433ce][_0x031f('0x7a')]&&_0x8f0afd[_0x031f('0x76')][_0x2433ce]['foreignKey']){_0x31504b[_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x30')]](_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x7a')],null,util['format'](_0x031f('0x79'),_0x8f0afd[_0x031f('0x6d')],_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x77')],_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x7a')],_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x78')]));}}}if(_0x8f0afd[_0x031f('0x7b')]){_0x8f0afd[_0x031f('0x7b')]=JSON[_0x031f('0x75')](_0x8f0afd[_0x031f('0x7b')]);_0x31504b['where'](_0x5e0853(_0x8f0afd[_0x031f('0x7b')][_0x031f('0x64')]));}_0x232aa0=_0x31504b['clone']();_0x31504b[_0x031f('0x20')](_0x184bbd);_0x31504b[_0x031f('0x1d')](0x0);return;}})['then'](function(){if(_0x26de7c[_0x031f('0x8d')]===_0x031f('0x8e')){return null;}var _0x1ade73=_[_0x031f('0x40')](_0x26de7c,{'name':_0x26de7c[_0x031f('0x8f')]||_0x26de7c[_0x031f('0x2a')]||_0x8f0afd[_0x031f('0x2a')],'basename':_0x54f02d,'savename':util[_0x031f('0x70')](_0x031f('0x90'),_0x26de7c['name']||_0x8f0afd[_0x031f('0x2a')],require(_0x031f('0x91'))[_0x031f('0x92')](0x4),_0x26de7c['output']||'csv'),'reportId':_0x8f0afd['id'],'reportType':_0x031f('0x93')});return db['AnalyticExtractedReport'][_0x031f('0x49')](_0x1ade73,{'raw':!![]});})[_0x031f('0x25')](function(_0x4a96f2){if(_0x8f0afd[_0x031f('0x6d')]===_0x031f('0x94')){_0x232aa0[_0x031f('0x3e')](_0x8f0afd[_0x031f('0x6d')]+_0x031f('0x95'),_0x26de7c[_0x031f('0x96')],_0x26de7c[_0x031f('0x97')]);}else{_0x232aa0[_0x031f('0x3e')](_0x8f0afd[_0x031f('0x6d')]+_0x031f('0x98'),_0x26de7c[_0x031f('0x96')],_0x26de7c[_0x031f('0x97')]);}if(_0x4a96f2){logger[_0x031f('0x99')]('Run\x20Query:',_0x232aa0['toString']());require(_0x031f('0x9a'))['fork'](path[_0x031f('0x53')](__dirname,_0x031f('0x9b'),_0x4a96f2[_0x031f('0x8d')]),[_0x4a96f2['id'],_0x232aa0['toString'](),path[_0x031f('0x53')](__dirname,_0x031f('0x9c'),_0x4a96f2['savename']),_0x54f02d]);return _0x4a96f2;}else{var _0x185085=squel[_0x031f('0x6b')]();_0x185085[_0x031f('0x6c')]('('+_0x232aa0[_0x031f('0x7f')]()+')',_0x031f('0x9d'));_0x185085[_0x031f('0x73')](_0x031f('0x9e'),'count');_0x232aa0[_0x031f('0x20')](_0x26de7c[_0x031f('0x20')]||_0x184bbd);_0x232aa0[_0x031f('0x1d')](_0x26de7c[_0x031f('0x1d')]||0x0);return dbH['sequelize']['query'](_0x185085[_0x031f('0x7f')](),{'type':dbH['sequelize']['QueryTypes'][_0x031f('0x82')]})['then'](function(_0x579ade){if(!_0x579ade[_0x031f('0x47')]){_0x307246=0x0;}else{_0x307246=_0x579ade[0x0][_0x031f('0x1f')]||0x0;}return dbH[_0x031f('0x80')][_0x031f('0x34')](_0x232aa0[_0x031f('0x7f')](),{'type':dbH[_0x031f('0x80')]['QueryTypes'][_0x031f('0x82')]});})[_0x031f('0x25')](function(_0x52a3f0){return{'rows':_0x52a3f0||[],'count':_0x307246};});}});}exports[_0x031f('0x9f')]=function(_0x355e1a,_0x30c32f){return runReport(_0x355e1a[_0x031f('0x46')],_0x355e1a['query'],_0x355e1a['options'])['then'](respondWithResult(_0x30c32f,null))[_0x031f('0x45')](handleError(_0x30c32f,null));};exports[_0x031f('0xa0')]=runReport;exports[_0x031f('0x34')]=function(_0x3ec98a,_0x3ed663){var _0xac324f=0xa;var _0xcf0af9=[_0x031f('0x53'),_0x031f('0x54'),'right_join',_0x031f('0x83')];var _0xde544e={'SUM':_0x031f('0x56'),'COUNT':_0x031f('0x57'),'COUNT DISTINCT':_0x031f('0x84'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x031f('0x5a'),'GROUP_CONCAT ASC':_0x031f('0x5b'),'GROUP_CONCAT DESC':_0x031f('0x5c')};var _0x84cd0c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x031f('0xa1'),'HOUR':'HOUR(%s)','ROUND':_0x031f('0x87'),'UNIX_TIMESTAMP':_0x031f('0x5d')};var _0x24aff3=function(_0x35a1f1){return!_[_0x031f('0x5e')](['IS\x20NULL',_0x031f('0x88'),_0x031f('0x60'),_0x031f('0x61')],_0x35a1f1);};var _0x3cb099=function(_0x4a4d8f){if(!_0x4a4d8f||!_0x4a4d8f[_0x031f('0x62')][_0x031f('0x47')]){return'';}for(var _0x578201='(',_0xdbf09f=0x0;_0xdbf09f<_0x4a4d8f['rules'][_0x031f('0x47')];_0xdbf09f+=0x1){_0xdbf09f>0x0&&(_0x578201+='\x20'+_0x4a4d8f[_0x031f('0x63')]+'\x20');_0x578201+=_0x4a4d8f[_0x031f('0x62')][_0xdbf09f][_0x031f('0x64')]?_0x3cb099(_0x4a4d8f[_0x031f('0x62')][_0xdbf09f]['group']):_0x4a4d8f[_0x031f('0x62')][_0xdbf09f]['field']+'\x20'+_0x4a4d8f[_0x031f('0x62')][_0xdbf09f][_0x031f('0x65')]+(_0x24aff3(_0x4a4d8f['rules'][_0xdbf09f][_0x031f('0x65')])?'\x20'+_0x4a4d8f[_0x031f('0x62')][_0xdbf09f][_0x031f('0x66')]:'');}return _0x578201+')';};var _0x123b4d={'where':{'id':_0x3ec98a['params']['id']}},_0x3f80b5,_0x53cd67,_0x516f11,_0x50cdb2,_0x2e9a3b;_0x123b4d=_[_0x031f('0x40')]({},_0x123b4d,_0x3ec98a[_0x031f('0x41')]);return db[_0x031f('0x2d')][_0x031f('0x48')](_0x123b4d)[_0x031f('0x25')](function(_0x53911d){if(_0x53911d){_0x3f80b5=_0x53911d;return _0x53911d[_0x031f('0x89')]();}return null;})['then'](function(_0x30fa18){if(_0x30fa18){if(!_0x30fa18[_0x031f('0x47')]){throw new db[(_0x031f('0x67'))]['ValidationErrorItem'](_0x031f('0x69'),0x193);}_0x53cd67=_0x30fa18;return db[_0x031f('0x6a')][_0x031f('0x43')]({'raw':!![]});}return null;})[_0x031f('0x25')](function(_0x5b092c){if(_0x5b092c){_0x516f11=_[_0x031f('0xa2')](_0x5b092c,'id');var _0x7b8699;var _0x14a497=squel[_0x031f('0x6b')]();_0x14a497[_0x031f('0x6c')](_0x3f80b5[_0x031f('0x6d')]);for(var _0x59fd9a=0x0;_0x59fd9a<_0x53cd67[_0x031f('0x47')];_0x59fd9a+=0x1){_0x7b8699=_0x53cd67[_0x59fd9a][_0x031f('0x8a')]?_0x516f11[_0x53cd67[_0x59fd9a][_0x031f('0x8a')]][_0x031f('0x8b')]:_0x53cd67[_0x59fd9a][_0x031f('0x73')];_0x7b8699=_0x53cd67[_0x59fd9a][_0x031f('0x6e')]?_[_0x031f('0x6f')](_0xde544e[_0x53cd67[_0x59fd9a]['function']],'%s',_0x7b8699):_0x7b8699;_0x7b8699=_0x53cd67[_0x59fd9a][_0x031f('0x70')]?_[_0x031f('0x6f')](_0x84cd0c[_0x53cd67[_0x59fd9a][_0x031f('0x70')]],'%s',_0x7b8699):_0x7b8699;if(_0x53cd67[_0x59fd9a][_0x031f('0x8c')]){_0x14a497[_0x031f('0x64')](_0x7b8699);}_0x53cd67[_0x59fd9a]['orderBy']&&_0x14a497[_0x031f('0x3c')](_0x7b8699,_0x53cd67[_0x59fd9a][_0x031f('0x71')]===_0x031f('0x72')?![]:!![]);_0x14a497[_0x031f('0x73')](_0x7b8699,_0x53cd67[_0x59fd9a][_0x031f('0x74')]||_0x7b8699);}if(_0x3f80b5['joins']){_0x3f80b5[_0x031f('0x76')]=JSON[_0x031f('0x75')](_0x3f80b5[_0x031f('0x76')]);for(var _0x110747=0x0;_0x110747<_0x3f80b5[_0x031f('0x76')]['length'];_0x110747+=0x1){if(_0x3f80b5['joins'][_0x110747][_0x031f('0x30')]&&_[_0x031f('0x5e')](_0xcf0af9,_0x3f80b5['joins'][_0x110747][_0x031f('0x30')])&&_0x3f80b5['joins'][_0x110747][_0x031f('0x77')]&&_0x3f80b5[_0x031f('0x76')][_0x110747][_0x031f('0x7a')]&&_0x3f80b5[_0x031f('0x76')][_0x110747]['foreignKey']){_0x14a497[_0x3f80b5['joins'][_0x110747][_0x031f('0x30')]](_0x3f80b5[_0x031f('0x76')][_0x110747][_0x031f('0x7a')],null,util[_0x031f('0x70')]('%s.%s\x20=\x20%s.%s',_0x3f80b5[_0x031f('0x6d')],_0x3f80b5[_0x031f('0x76')][_0x110747][_0x031f('0x77')],_0x3f80b5['joins'][_0x110747][_0x031f('0x7a')],_0x3f80b5[_0x031f('0x76')][_0x110747][_0x031f('0x78')]));}}}if(_0x3f80b5['conditions']){_0x3f80b5[_0x031f('0x7b')]=JSON[_0x031f('0x75')](_0x3f80b5[_0x031f('0x7b')]);_0x14a497[_0x031f('0x3e')](_0x3cb099(_0x3f80b5[_0x031f('0x7b')]['group']));}_0x2e9a3b=_0x14a497[_0x031f('0x7c')]();_0x14a497[_0x031f('0x20')](_0xac324f);_0x14a497[_0x031f('0x1d')](0x0);logger[_0x031f('0x7d')](_0x031f('0x7e'),_0x14a497[_0x031f('0x7f')]());return dbH['sequelize']['query'](_0x14a497[_0x031f('0x7f')](),{'type':dbH[_0x031f('0x80')][_0x031f('0x81')][_0x031f('0x82')]});}})[_0x031f('0x25')](function(){return{'sql':_0x2e9a3b[_0x031f('0x7f')]()};})[_0x031f('0x25')](respondWithResult(_0x3ed663,null))['catch'](handleError(_0x3ed663,null));}; \ No newline at end of file +var _0x687b=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','get','DefaultReports','UserProfileResource','destroy','sendStatus','error','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','options','findAll','catch','params','intersection','includeAll','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','right_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','merge','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','alias','joins','parse','foreignTable','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SUM(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ValidationErrorItem','DESC','parentKey','web','fullPath','%s-%s.%s','output','csv','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','SELECT','run','runReport','cross_join','%s.%s\x20=\x20%s.%s','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x687b,0x14a));var _0xb687=function(_0x2efe4f,_0x35b3d9){_0x2efe4f=_0x2efe4f-0x0;var _0x251e7e=_0x687b[_0x2efe4f];return _0x251e7e;};'use strict';var emlformat=require(_0xb687('0x0'));var rimraf=require(_0xb687('0x1'));var zipdir=require(_0xb687('0x2'));var jsonpatch=require(_0xb687('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb687('0x4'));var Mustache=require(_0xb687('0x5'));var util=require(_0xb687('0x6'));var path=require(_0xb687('0x7'));var sox=require(_0xb687('0x8'));var csv=require(_0xb687('0x9'));var ejs=require(_0xb687('0xa'));var fs=require('fs');var fs_extra=require(_0xb687('0xb'));var _=require(_0xb687('0xc'));var squel=require(_0xb687('0xd'));var crypto=require('crypto');var jsforce=require(_0xb687('0xe'));var deskjs=require(_0xb687('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb687('0x10'));var Papa=require(_0xb687('0x11'));var Redis=require(_0xb687('0x12'));var authService=require(_0xb687('0x13'));var qs=require(_0xb687('0x14'));var as=require(_0xb687('0x15'));var hardwareService=require(_0xb687('0x16'));var logger=require(_0xb687('0x17'))(_0xb687('0x18'));var utils=require('../../config/utils');var config=require(_0xb687('0x19'));var licenseUtil=require(_0xb687('0x1a'));var db=require(_0xb687('0x1b'))['db'];var dbH=require(_0xb687('0x1b'))['dbH'];function respondWithStatusCode(_0x4c97ed,_0x3e85b3){_0x3e85b3=_0x3e85b3||0xcc;return function(_0x155ebe){if(_0x155ebe){return _0x4c97ed['sendStatus'](_0x3e85b3);}return _0x4c97ed[_0xb687('0x1c')](_0x3e85b3)[_0xb687('0x1d')]();};}function respondWithResult(_0x1f1f35,_0x30d502){_0x30d502=_0x30d502||0xc8;return function(_0x838dd4){if(_0x838dd4){return _0x1f1f35[_0xb687('0x1c')](_0x30d502)[_0xb687('0x1e')](_0x838dd4);}};}function respondWithFilteredResult(_0x141375,_0x263085){return function(_0x2c7a18){if(_0x2c7a18){var _0x25124a=typeof _0x263085[_0xb687('0x1f')]==='undefined'&&typeof _0x263085[_0xb687('0x20')]===_0xb687('0x21');var _0x30d370=_0x2c7a18['count'];var _0x48958d=_0x25124a?0x0:_0x263085[_0xb687('0x1f')];var _0x3a10ef=_0x25124a?_0x2c7a18[_0xb687('0x22')]:_0x263085['offset']+_0x263085[_0xb687('0x20')];var _0x481f1d;if(_0x3a10ef>=_0x30d370){_0x3a10ef=_0x30d370;_0x481f1d=0xc8;}else{_0x481f1d=0xce;}_0x141375[_0xb687('0x1c')](_0x481f1d);return _0x141375[_0xb687('0x23')](_0xb687('0x24'),_0x48958d+'-'+_0x3a10ef+'/'+_0x30d370)[_0xb687('0x1e')](_0x2c7a18);}return null;};}function patchUpdates(_0x49d5a1){return function(_0x3a73d5){try{jsonpatch['apply'](_0x3a73d5,_0x49d5a1,!![]);}catch(_0x335541){return BPromise[_0xb687('0x25')](_0x335541);}return _0x3a73d5[_0xb687('0x26')]();};}function saveUpdates(_0x546fde,_0x1dc06b){return function(_0x491623){if(_0x491623){return _0x491623[_0xb687('0x27')](_0x546fde)[_0xb687('0x28')](function(_0xbf6c58){return _0xbf6c58;});}return null;};}function removeEntity(_0x38866c,_0xf48ba4){return function(_0x2f0a0a){if(_0x2f0a0a){return _0x2f0a0a['destroy']()[_0xb687('0x28')](function(){var _0x129347=_0x2f0a0a[_0xb687('0x29')]({'plain':!![]});var _0x1a0261=_0xb687('0x2a');return db[_0xb687('0x2b')][_0xb687('0x2c')]({'where':{'type':_0x1a0261,'resourceId':_0x129347['id']}})[_0xb687('0x28')](function(){return _0x2f0a0a;});})[_0xb687('0x28')](function(){_0x38866c[_0xb687('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3712cf,_0x192966){return function(_0x392721){if(!_0x392721){_0x3712cf[_0xb687('0x2d')](0x194);}return _0x392721;};}function handleError(_0x2e5c8d,_0x173c58){_0x173c58=_0x173c58||0x1f4;return function(_0x4e9a06){logger[_0xb687('0x2e')](_0x4e9a06['stack']);if(_0x4e9a06[_0xb687('0x2f')]){delete _0x4e9a06[_0xb687('0x2f')];}_0x2e5c8d[_0xb687('0x1c')](_0x173c58)[_0xb687('0x30')](_0x4e9a06);};}exports[_0xb687('0x31')]=function(_0x43d20d,_0xf1f0dd){var _0x556815={},_0x3da2be={},_0xe3428f={'count':0x0,'rows':[]};var _0x3c08ab=_[_0xb687('0x32')](db[_0xb687('0x33')][_0xb687('0x34')],function(_0x44be88){return{'name':_0x44be88[_0xb687('0x35')],'type':_0x44be88[_0xb687('0x36')][_0xb687('0x37')]};});_0x3da2be[_0xb687('0x38')]=_['map'](_0x3c08ab,'name');_0x3da2be[_0xb687('0x39')]=_[_0xb687('0x3a')](_0x43d20d[_0xb687('0x39')]);_0x3da2be[_0xb687('0x3b')]=_['intersection'](_0x3da2be['model'],_0x3da2be[_0xb687('0x39')]);_0x556815[_0xb687('0x3c')]=_['intersection'](_0x3da2be[_0xb687('0x38')],qs[_0xb687('0x3d')](_0x43d20d['query'][_0xb687('0x3d')]));_0x556815['attributes']=_0x556815[_0xb687('0x3c')][_0xb687('0x3e')]?_0x556815[_0xb687('0x3c')]:_0x3da2be[_0xb687('0x38')];if(!_0x43d20d[_0xb687('0x39')][_0xb687('0x3f')]('nolimit')){_0x556815[_0xb687('0x20')]=qs[_0xb687('0x20')](_0x43d20d[_0xb687('0x39')][_0xb687('0x20')]);_0x556815['offset']=qs[_0xb687('0x1f')](_0x43d20d[_0xb687('0x39')][_0xb687('0x1f')]);}_0x556815[_0xb687('0x40')]=qs[_0xb687('0x41')](_0x43d20d['query'][_0xb687('0x41')]);_0x556815[_0xb687('0x42')]=qs[_0xb687('0x3b')](_[_0xb687('0x43')](_0x43d20d[_0xb687('0x39')],_0x3da2be[_0xb687('0x3b')]),_0x3c08ab);if(_0x43d20d['query']['filter']){_0x556815[_0xb687('0x42')]=_['merge'](_0x556815[_0xb687('0x42')],{'$or':_[_0xb687('0x32')](_0x3c08ab,function(_0x48d3b1){if(_0x48d3b1[_0xb687('0x36')]!==_0xb687('0x44')){var _0x57776b={};_0x57776b[_0x48d3b1[_0xb687('0x2f')]]={'$like':'%'+_0x43d20d[_0xb687('0x39')][_0xb687('0x45')]+'%'};return _0x57776b;}})});}_0x556815=_['merge']({},_0x556815,_0x43d20d[_0xb687('0x46')]);var _0x9cffb2={'where':_0x556815[_0xb687('0x42')]};return db[_0xb687('0x33')][_0xb687('0x22')](_0x9cffb2)[_0xb687('0x28')](function(_0x21b9ef){_0xe3428f['count']=_0x21b9ef;if(_0x43d20d[_0xb687('0x39')]['includeAll']){_0x556815['include']=[{'all':!![]}];}return db[_0xb687('0x33')][_0xb687('0x47')](_0x556815);})['then'](function(_0x19a21c){_0xe3428f['rows']=_0x19a21c;return _0xe3428f;})[_0xb687('0x28')](respondWithFilteredResult(_0xf1f0dd,_0x556815))[_0xb687('0x48')](handleError(_0xf1f0dd,null));};exports['show']=function(_0x4cb7a0,_0x3a8509){var _0x5d9cb0={'raw':!![],'where':{'id':_0x4cb7a0[_0xb687('0x49')]['id']}},_0x247c67={};_0x247c67[_0xb687('0x38')]=_[_0xb687('0x3a')](db[_0xb687('0x33')][_0xb687('0x34')]);_0x247c67[_0xb687('0x39')]=_[_0xb687('0x3a')](_0x4cb7a0[_0xb687('0x39')]);_0x247c67[_0xb687('0x3b')]=_[_0xb687('0x4a')](_0x247c67[_0xb687('0x38')],_0x247c67['query']);_0x5d9cb0[_0xb687('0x3c')]=_['intersection'](_0x247c67[_0xb687('0x38')],qs[_0xb687('0x3d')](_0x4cb7a0[_0xb687('0x39')][_0xb687('0x3d')]));_0x5d9cb0[_0xb687('0x3c')]=_0x5d9cb0[_0xb687('0x3c')]['length']?_0x5d9cb0['attributes']:_0x247c67[_0xb687('0x38')];if(_0x4cb7a0[_0xb687('0x39')][_0xb687('0x4b')]){_0x5d9cb0[_0xb687('0x4c')]=[{'all':!![]}];}_0x5d9cb0=_['merge']({},_0x5d9cb0,_0x4cb7a0[_0xb687('0x46')]);return db[_0xb687('0x33')][_0xb687('0x4d')](_0x5d9cb0)[_0xb687('0x28')](handleEntityNotFound(_0x3a8509,null))['then'](respondWithResult(_0x3a8509,null))[_0xb687('0x48')](handleError(_0x3a8509,null));};exports[_0xb687('0x4e')]=function(_0x162b19,_0x401b99){return db['AnalyticDefaultReport']['create'](_0x162b19[_0xb687('0x4f')],{})[_0xb687('0x28')](function(_0x42b61a){var _0x508862=_0x162b19['user'][_0xb687('0x29')]({'plain':!![]});if(!_0x508862)throw new Error(_0xb687('0x50'));if(_0x508862[_0xb687('0x51')]===_0xb687('0x52')){var _0x34205d=_0x42b61a[_0xb687('0x29')]({'plain':!![]});var _0x602864=_0xb687('0x53');return db['UserProfileSection'][_0xb687('0x4d')]({'where':{'name':_0x602864,'userProfileId':_0x508862[_0xb687('0x54')]},'raw':!![]})[_0xb687('0x28')](function(_0x4f5784){if(_0x4f5784&&_0x4f5784['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x34205d[_0xb687('0x2f')],'resourceId':_0x34205d['id'],'type':_0xb687('0x2a'),'sectionId':_0x4f5784['id']},{})[_0xb687('0x28')](function(){return _0x42b61a;});}else{return _0x42b61a;}})[_0xb687('0x48')](function(_0x1ddfd4){logger[_0xb687('0x2e')](_0xb687('0x55'),_0x1ddfd4);throw _0x1ddfd4;});}return _0x42b61a;})[_0xb687('0x28')](respondWithResult(_0x401b99,0xc9))[_0xb687('0x48')](handleError(_0x401b99,null));};exports[_0xb687('0x27')]=function(_0x128264,_0x166900){if(_0x128264[_0xb687('0x4f')]['id']){delete _0x128264[_0xb687('0x4f')]['id'];}return db[_0xb687('0x33')][_0xb687('0x4d')]({'where':{'id':_0x128264[_0xb687('0x49')]['id']}})['then'](handleEntityNotFound(_0x166900,null))['then'](saveUpdates(_0x128264[_0xb687('0x4f')],null))[_0xb687('0x28')](respondWithResult(_0x166900,null))[_0xb687('0x48')](handleError(_0x166900,null));};exports[_0xb687('0x2c')]=function(_0x4e5642,_0xfa8790){return db[_0xb687('0x33')]['find']({'where':{'id':_0x4e5642[_0xb687('0x49')]['id']}})['then'](handleEntityNotFound(_0xfa8790,null))[_0xb687('0x28')](removeEntity(_0xfa8790,null))[_0xb687('0x48')](handleError(_0xfa8790,null));};exports['preview']=function(_0x4fb188,_0x13ad6a){var _0x4ab9c5=0xa;var _0x5ea8fd=[_0xb687('0x56'),_0xb687('0x57'),_0xb687('0x58'),'cross_join'];var _0x25e140={'SUM':'SUM(%s)','COUNT':_0xb687('0x59'),'COUNT DISTINCT':_0xb687('0x5a'),'MAX':_0xb687('0x5b'),'MIN':_0xb687('0x5c'),'AVG':_0xb687('0x5d'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xb687('0x5e')};var _0x58ec8b={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xb687('0x5f'),'UNIX_TIMESTAMP':_0xb687('0x60')};var _0xbc3a94=function(_0x4bc18f){return!_[_0xb687('0x61')]([_0xb687('0x62'),_0xb687('0x63'),_0xb687('0x64'),_0xb687('0x65')],_0x4bc18f);};var _0x17505c=function(_0x132e3a){if(!_0x132e3a||!_0x132e3a['rules']['length']){return'';}for(var _0x2714c6='(',_0x4906df=0x0;_0x4906df<_0x132e3a[_0xb687('0x66')][_0xb687('0x3e')];_0x4906df+=0x1){_0x4906df>0x0&&(_0x2714c6+='\x20'+_0x132e3a[_0xb687('0x67')]+'\x20');_0x2714c6+=_0x132e3a[_0xb687('0x66')][_0x4906df][_0xb687('0x68')]?_0x17505c(_0x132e3a['rules'][_0x4906df][_0xb687('0x68')]):_0x132e3a['rules'][_0x4906df][_0xb687('0x69')]+'\x20'+_0x132e3a[_0xb687('0x66')][_0x4906df][_0xb687('0x6a')]+(_0xbc3a94(_0x132e3a[_0xb687('0x66')][_0x4906df][_0xb687('0x6a')])?'\x20'+_0x132e3a[_0xb687('0x66')][_0x4906df][_0xb687('0x6b')]:'');}return _0x2714c6+')';};var _0x5deb7a={'where':{'id':_0x4fb188['params']['id']}},_0x28a6aa,_0x31ed20,_0x8942b7,_0x36bb4b,_0x258caf;_0x5deb7a=_[_0xb687('0x6c')]({},_0x5deb7a,_0x4fb188[_0xb687('0x46')]);return db[_0xb687('0x33')][_0xb687('0x4d')](_0x5deb7a)[_0xb687('0x28')](function(_0x15ef44){if(_0x15ef44){_0x28a6aa=_0x15ef44;return _0x15ef44[_0xb687('0x6d')]();}return null;})[_0xb687('0x28')](function(_0x177ea4){if(_0x177ea4){if(!_0x177ea4[_0xb687('0x3e')]){throw new db[(_0xb687('0x6e'))]['ValidationErrorItem'](_0xb687('0x6f'),0x193);}_0x31ed20=_0x177ea4;return db[_0xb687('0x70')][_0xb687('0x47')]({'raw':!![]});}return null;})[_0xb687('0x28')](function(_0x505f7a){if(_0x505f7a){_0x8942b7=_[_0xb687('0x71')](_0x505f7a,'id');var _0x1a6075;var _0x53b00a=squel[_0xb687('0x72')]();_0x53b00a[_0xb687('0x73')](_0x28a6aa[_0xb687('0x74')]);for(var _0x5eeb75=0x0;_0x5eeb75<_0x31ed20[_0xb687('0x3e')];_0x5eeb75+=0x1){_0x1a6075=_0x31ed20[_0x5eeb75][_0xb687('0x75')]?_0x8942b7[_0x31ed20[_0x5eeb75]['MetricId']][_0xb687('0x76')]:_0x31ed20[_0x5eeb75][_0xb687('0x69')];_0x1a6075=_0x31ed20[_0x5eeb75][_0xb687('0x77')]?_[_0xb687('0x78')](_0x25e140[_0x31ed20[_0x5eeb75]['function']],'%s',_0x1a6075):_0x1a6075;_0x1a6075=_0x31ed20[_0x5eeb75][_0xb687('0x79')]?_[_0xb687('0x78')](_0x58ec8b[_0x31ed20[_0x5eeb75]['format']],'%s',_0x1a6075):_0x1a6075;if(_0x31ed20[_0x5eeb75][_0xb687('0x7a')]){_0x53b00a[_0xb687('0x68')](_0x1a6075);}_0x31ed20[_0x5eeb75]['orderBy']&&_0x53b00a['order'](_0x1a6075,_0x31ed20[_0x5eeb75][_0xb687('0x7b')]==='DESC'?![]:!![]);_0x53b00a[_0xb687('0x69')](_0x1a6075,_0x31ed20[_0x5eeb75][_0xb687('0x7c')]||_0x1a6075);}if(_0x28a6aa[_0xb687('0x7d')]){_0x28a6aa[_0xb687('0x7d')]=JSON[_0xb687('0x7e')](_0x28a6aa[_0xb687('0x7d')]);for(var _0x229bc4=0x0;_0x229bc4<_0x28a6aa[_0xb687('0x7d')]['length'];_0x229bc4+=0x1){if(_0x28a6aa[_0xb687('0x7d')][_0x229bc4][_0xb687('0x36')]&&_[_0xb687('0x61')](_0x5ea8fd,_0x28a6aa[_0xb687('0x7d')][_0x229bc4][_0xb687('0x36')])&&_0x28a6aa[_0xb687('0x7d')][_0x229bc4]['parentKey']&&_0x28a6aa[_0xb687('0x7d')][_0x229bc4][_0xb687('0x7f')]&&_0x28a6aa['joins'][_0x229bc4][_0xb687('0x80')]){_0x53b00a[_0x28a6aa[_0xb687('0x7d')][_0x229bc4][_0xb687('0x36')]](_0x28a6aa[_0xb687('0x7d')][_0x229bc4]['foreignTable'],null,util[_0xb687('0x79')]('%s.%s\x20=\x20%s.%s',_0x28a6aa['table'],_0x28a6aa[_0xb687('0x7d')][_0x229bc4]['parentKey'],_0x28a6aa['joins'][_0x229bc4][_0xb687('0x7f')],_0x28a6aa['joins'][_0x229bc4][_0xb687('0x80')]));}}}if(_0x28a6aa[_0xb687('0x81')]){_0x28a6aa['conditions']=JSON[_0xb687('0x7e')](_0x28a6aa[_0xb687('0x81')]);_0x53b00a['where'](_0x17505c(_0x28a6aa[_0xb687('0x81')][_0xb687('0x68')]));}_0x258caf=_0x53b00a[_0xb687('0x82')]();_0x53b00a[_0xb687('0x20')](_0x4ab9c5);_0x53b00a[_0xb687('0x1f')](0x0);logger[_0xb687('0x83')](_0xb687('0x84'),_0x53b00a[_0xb687('0x85')]());return dbH[_0xb687('0x86')][_0xb687('0x39')](_0x53b00a[_0xb687('0x85')](),{'type':dbH['sequelize'][_0xb687('0x87')]['SELECT']});}})['then'](respondWithResult(_0x13ad6a,null))[_0xb687('0x48')](handleError(_0x13ad6a,null));};function runReport(_0x29e830,_0x22ebca,_0xfecb8d){var _0x3a7339=_0x22ebca['name'];var _0x59c94b=0xa;var _0x29e27e=[_0xb687('0x56'),_0xb687('0x57'),_0xb687('0x58'),'cross_join'];var _0x448d59={'SUM':_0xb687('0x88'),'COUNT':_0xb687('0x59'),'COUNT DISTINCT':_0xb687('0x5a'),'MAX':_0xb687('0x5b'),'MIN':_0xb687('0x5c'),'AVG':_0xb687('0x5d'),'GROUP_CONCAT':_0xb687('0x89'),'GROUP_CONCAT ASC':_0xb687('0x8a'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x25f5c3={'SEC_TO_TIME':_0xb687('0x8b'),'DATE':_0xb687('0x8c'),'HOUR':_0xb687('0x8d'),'ROUND':_0xb687('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1037b1=function(_0x3bf480){return!_['includes']([_0xb687('0x62'),'IS\x20NOT\x20NULL',_0xb687('0x64'),_0xb687('0x65')],_0x3bf480);};var _0x5ec5f6=function(_0x1c683e){if(!_0x1c683e||!_0x1c683e[_0xb687('0x66')]['length']){return'';}for(var _0x231caa='(',_0x3479c5=0x0;_0x3479c5<_0x1c683e[_0xb687('0x66')][_0xb687('0x3e')];_0x3479c5+=0x1){_0x3479c5>0x0&&(_0x231caa+='\x20'+_0x1c683e[_0xb687('0x67')]+'\x20');_0x231caa+=_0x1c683e[_0xb687('0x66')][_0x3479c5]['group']?_0x5ec5f6(_0x1c683e[_0xb687('0x66')][_0x3479c5][_0xb687('0x68')]):_0x1c683e[_0xb687('0x66')][_0x3479c5][_0xb687('0x69')]+'\x20'+_0x1c683e[_0xb687('0x66')][_0x3479c5][_0xb687('0x6a')]+(_0x1037b1(_0x1c683e[_0xb687('0x66')][_0x3479c5][_0xb687('0x6a')])?'\x20'+_0x1c683e[_0xb687('0x66')][_0x3479c5][_0xb687('0x6b')]:'');}return _0x231caa+')';};var _0x290ddf={'where':{'id':_0x29e830['id']}},_0x5ee585,_0x10fb0,_0x5be566,_0x3d98e2,_0x3aa1c8;_0x290ddf=_['merge']({},_0x290ddf,_0xfecb8d);return db['AnalyticDefaultReport'][_0xb687('0x4d')](_0x290ddf)[_0xb687('0x28')](function(_0x3b4acf){if(_0x3b4acf){_0x5ee585=_0x3b4acf;return _0x3b4acf[_0xb687('0x6d')]();}return null;})[_0xb687('0x28')](function(_0x1c3de0){if(_0x1c3de0){if(!_0x1c3de0[_0xb687('0x3e')]){throw new db[(_0xb687('0x6e'))][(_0xb687('0x8e'))](_0xb687('0x6f'),0x193);}_0x10fb0=_0x1c3de0;return db[_0xb687('0x70')][_0xb687('0x47')]({'raw':!![]});}return null;})[_0xb687('0x28')](function(_0x1ea6fd){if(_0x1ea6fd){_0x5be566=_[_0xb687('0x71')](_0x1ea6fd,'id');var _0x3f45b7;var _0x508550=squel['select']();_0x508550[_0xb687('0x73')](_0x5ee585['table']);for(var _0x5f2557=0x0;_0x5f2557<_0x10fb0[_0xb687('0x3e')];_0x5f2557+=0x1){_0x3f45b7=_0x10fb0[_0x5f2557][_0xb687('0x75')]?_0x5be566[_0x10fb0[_0x5f2557]['MetricId']][_0xb687('0x76')]:_0x10fb0[_0x5f2557][_0xb687('0x69')];_0x3f45b7=_0x10fb0[_0x5f2557]['function']?_[_0xb687('0x78')](_0x448d59[_0x10fb0[_0x5f2557][_0xb687('0x77')]],'%s',_0x3f45b7):_0x3f45b7;_0x3f45b7=_0x10fb0[_0x5f2557][_0xb687('0x79')]?_[_0xb687('0x78')](_0x25f5c3[_0x10fb0[_0x5f2557][_0xb687('0x79')]],'%s',_0x3f45b7):_0x3f45b7;if(_0x10fb0[_0x5f2557][_0xb687('0x7a')]){_0x508550[_0xb687('0x68')](_0x3f45b7);}_0x10fb0[_0x5f2557][_0xb687('0x7b')]&&_0x508550[_0xb687('0x40')](_0x3f45b7,_0x10fb0[_0x5f2557]['orderBy']===_0xb687('0x8f')?![]:!![]);_0x508550[_0xb687('0x69')](_0x3f45b7,_0x10fb0[_0x5f2557]['alias']||_0x3f45b7);}if(_0x5ee585[_0xb687('0x7d')]){_0x5ee585['joins']=JSON[_0xb687('0x7e')](_0x5ee585[_0xb687('0x7d')]);for(var _0x59166c=0x0;_0x59166c<_0x5ee585[_0xb687('0x7d')][_0xb687('0x3e')];_0x59166c+=0x1){if(_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x36')]&&_[_0xb687('0x61')](_0x29e27e,_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x36')])&&_0x5ee585['joins'][_0x59166c]['parentKey']&&_0x5ee585[_0xb687('0x7d')][_0x59166c]['foreignTable']&&_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x80')]){_0x508550[_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x36')]](_0x5ee585['joins'][_0x59166c][_0xb687('0x7f')],null,util[_0xb687('0x79')]('%s.%s\x20=\x20%s.%s',_0x5ee585[_0xb687('0x74')],_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x90')],_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x7f')],_0x5ee585[_0xb687('0x7d')][_0x59166c]['foreignKey']));}}}if(_0x5ee585[_0xb687('0x81')]){_0x5ee585[_0xb687('0x81')]=JSON[_0xb687('0x7e')](_0x5ee585[_0xb687('0x81')]);_0x508550[_0xb687('0x42')](_0x5ec5f6(_0x5ee585[_0xb687('0x81')][_0xb687('0x68')]));}_0x3aa1c8=_0x508550[_0xb687('0x82')]();_0x508550[_0xb687('0x20')](_0x59c94b);_0x508550[_0xb687('0x1f')](0x0);return;}})['then'](function(){if(_0x22ebca['output']===_0xb687('0x91')){return null;}var _0x1a7cd8=_[_0xb687('0x6c')](_0x22ebca,{'name':_0x22ebca[_0xb687('0x92')]||_0x22ebca[_0xb687('0x2f')]||_0x5ee585[_0xb687('0x2f')],'basename':_0x3a7339,'savename':util[_0xb687('0x79')](_0xb687('0x93'),_0x22ebca[_0xb687('0x2f')]||_0x5ee585['name'],require('randomstring')['generate'](0x4),_0x22ebca[_0xb687('0x94')]||_0xb687('0x95')),'reportId':_0x5ee585['id'],'reportType':_0xb687('0x96')});return db[_0xb687('0x97')][_0xb687('0x4e')](_0x1a7cd8,{'raw':!![]});})[_0xb687('0x28')](function(_0x473130){if(_0x5ee585[_0xb687('0x74')]==='cdr'){_0x3aa1c8[_0xb687('0x42')](_0x5ee585[_0xb687('0x74')]+_0xb687('0x98'),_0x22ebca[_0xb687('0x99')],_0x22ebca[_0xb687('0x9a')]);}else{_0x3aa1c8[_0xb687('0x42')](_0x5ee585[_0xb687('0x74')]+_0xb687('0x9b'),_0x22ebca['startDate'],_0x22ebca[_0xb687('0x9a')]);}if(_0x473130){logger['info'](_0xb687('0x9c'),_0x3aa1c8[_0xb687('0x85')]());require('child_process')[_0xb687('0x9d')](path[_0xb687('0x56')](__dirname,_0xb687('0x9e'),_0x473130['output']),[_0x473130['id'],_0x3aa1c8[_0xb687('0x85')](),path[_0xb687('0x56')](__dirname,_0xb687('0x9f'),_0x473130[_0xb687('0xa0')]),_0x3a7339]);return _0x473130;}else{var _0x3d4596=squel[_0xb687('0x72')]();_0x3d4596[_0xb687('0x73')]('('+_0x3aa1c8['toString']()+')',_0xb687('0xa1'));_0x3d4596[_0xb687('0x69')](_0xb687('0xa2'),_0xb687('0x22'));_0x3aa1c8[_0xb687('0x20')](_0x22ebca['limit']||_0x59c94b);_0x3aa1c8[_0xb687('0x1f')](_0x22ebca[_0xb687('0x1f')]||0x0);return dbH[_0xb687('0x86')]['query'](_0x3d4596[_0xb687('0x85')](),{'type':dbH['sequelize'][_0xb687('0x87')][_0xb687('0xa3')]})['then'](function(_0x3dbbd6){if(!_0x3dbbd6[_0xb687('0x3e')]){_0x3d98e2=0x0;}else{_0x3d98e2=_0x3dbbd6[0x0][_0xb687('0x22')]||0x0;}return dbH['sequelize'][_0xb687('0x39')](_0x3aa1c8[_0xb687('0x85')](),{'type':dbH[_0xb687('0x86')][_0xb687('0x87')][_0xb687('0xa3')]});})[_0xb687('0x28')](function(_0x15e599){return{'rows':_0x15e599||[],'count':_0x3d98e2};});}});}exports[_0xb687('0xa4')]=function(_0x8f6ba0,_0x568aca){return runReport(_0x8f6ba0[_0xb687('0x49')],_0x8f6ba0[_0xb687('0x39')],_0x8f6ba0[_0xb687('0x46')])['then'](respondWithResult(_0x568aca,null))['catch'](handleError(_0x568aca,null));};exports[_0xb687('0xa5')]=runReport;exports['query']=function(_0x187810,_0x1d21ef){var _0x386d12=0xa;var _0x4dd8f4=['join',_0xb687('0x57'),_0xb687('0x58'),_0xb687('0xa6')];var _0x295795={'SUM':_0xb687('0x88'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xb687('0x5a'),'MAX':_0xb687('0x5b'),'MIN':'MIN(%s)','AVG':_0xb687('0x5d'),'GROUP_CONCAT':_0xb687('0x89'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xb687('0x5e')};var _0xe7056c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xb687('0x8c'),'HOUR':_0xb687('0x8d'),'ROUND':_0xb687('0x5f'),'UNIX_TIMESTAMP':_0xb687('0x60')};var _0x1b1cf5=function(_0x46283c){return!_[_0xb687('0x61')](['IS\x20NULL',_0xb687('0x63'),'IS\x20EMPTY',_0xb687('0x65')],_0x46283c);};var _0x394ed6=function(_0x875169){if(!_0x875169||!_0x875169[_0xb687('0x66')]['length']){return'';}for(var _0x1ec485='(',_0x55a919=0x0;_0x55a919<_0x875169['rules'][_0xb687('0x3e')];_0x55a919+=0x1){_0x55a919>0x0&&(_0x1ec485+='\x20'+_0x875169[_0xb687('0x67')]+'\x20');_0x1ec485+=_0x875169[_0xb687('0x66')][_0x55a919]['group']?_0x394ed6(_0x875169[_0xb687('0x66')][_0x55a919][_0xb687('0x68')]):_0x875169['rules'][_0x55a919][_0xb687('0x69')]+'\x20'+_0x875169['rules'][_0x55a919][_0xb687('0x6a')]+(_0x1b1cf5(_0x875169[_0xb687('0x66')][_0x55a919]['condition'])?'\x20'+_0x875169[_0xb687('0x66')][_0x55a919]['value']:'');}return _0x1ec485+')';};var _0x2aecd5={'where':{'id':_0x187810[_0xb687('0x49')]['id']}},_0x58955e,_0x488a2a,_0x303738,_0x3904a3,_0x581338;_0x2aecd5=_['merge']({},_0x2aecd5,_0x187810[_0xb687('0x46')]);return db[_0xb687('0x33')][_0xb687('0x4d')](_0x2aecd5)['then'](function(_0xc29834){if(_0xc29834){_0x58955e=_0xc29834;return _0xc29834[_0xb687('0x6d')]();}return null;})[_0xb687('0x28')](function(_0x1f2f2b){if(_0x1f2f2b){if(!_0x1f2f2b[_0xb687('0x3e')]){throw new db[(_0xb687('0x6e'))]['ValidationErrorItem'](_0xb687('0x6f'),0x193);}_0x488a2a=_0x1f2f2b;return db[_0xb687('0x70')][_0xb687('0x47')]({'raw':!![]});}return null;})[_0xb687('0x28')](function(_0x3591e2){if(_0x3591e2){_0x303738=_['keyBy'](_0x3591e2,'id');var _0x4d0c14;var _0x200b55=squel[_0xb687('0x72')]();_0x200b55[_0xb687('0x73')](_0x58955e[_0xb687('0x74')]);for(var _0x33f4de=0x0;_0x33f4de<_0x488a2a[_0xb687('0x3e')];_0x33f4de+=0x1){_0x4d0c14=_0x488a2a[_0x33f4de][_0xb687('0x75')]?_0x303738[_0x488a2a[_0x33f4de]['MetricId']][_0xb687('0x76')]:_0x488a2a[_0x33f4de][_0xb687('0x69')];_0x4d0c14=_0x488a2a[_0x33f4de][_0xb687('0x77')]?_['replace'](_0x295795[_0x488a2a[_0x33f4de][_0xb687('0x77')]],'%s',_0x4d0c14):_0x4d0c14;_0x4d0c14=_0x488a2a[_0x33f4de][_0xb687('0x79')]?_[_0xb687('0x78')](_0xe7056c[_0x488a2a[_0x33f4de]['format']],'%s',_0x4d0c14):_0x4d0c14;if(_0x488a2a[_0x33f4de][_0xb687('0x7a')]){_0x200b55[_0xb687('0x68')](_0x4d0c14);}_0x488a2a[_0x33f4de]['orderBy']&&_0x200b55[_0xb687('0x40')](_0x4d0c14,_0x488a2a[_0x33f4de][_0xb687('0x7b')]===_0xb687('0x8f')?![]:!![]);_0x200b55[_0xb687('0x69')](_0x4d0c14,_0x488a2a[_0x33f4de]['alias']||_0x4d0c14);}if(_0x58955e[_0xb687('0x7d')]){_0x58955e[_0xb687('0x7d')]=JSON[_0xb687('0x7e')](_0x58955e[_0xb687('0x7d')]);for(var _0xcff220=0x0;_0xcff220<_0x58955e['joins'][_0xb687('0x3e')];_0xcff220+=0x1){if(_0x58955e[_0xb687('0x7d')][_0xcff220]['type']&&_[_0xb687('0x61')](_0x4dd8f4,_0x58955e[_0xb687('0x7d')][_0xcff220]['type'])&&_0x58955e[_0xb687('0x7d')][_0xcff220][_0xb687('0x90')]&&_0x58955e[_0xb687('0x7d')][_0xcff220]['foreignTable']&&_0x58955e[_0xb687('0x7d')][_0xcff220][_0xb687('0x80')]){_0x200b55[_0x58955e['joins'][_0xcff220]['type']](_0x58955e['joins'][_0xcff220][_0xb687('0x7f')],null,util['format'](_0xb687('0xa7'),_0x58955e[_0xb687('0x74')],_0x58955e[_0xb687('0x7d')][_0xcff220][_0xb687('0x90')],_0x58955e[_0xb687('0x7d')][_0xcff220]['foreignTable'],_0x58955e['joins'][_0xcff220][_0xb687('0x80')]));}}}if(_0x58955e[_0xb687('0x81')]){_0x58955e[_0xb687('0x81')]=JSON[_0xb687('0x7e')](_0x58955e[_0xb687('0x81')]);_0x200b55[_0xb687('0x42')](_0x394ed6(_0x58955e[_0xb687('0x81')]['group']));}_0x581338=_0x200b55['clone']();_0x200b55['limit'](_0x386d12);_0x200b55[_0xb687('0x1f')](0x0);logger[_0xb687('0x83')](_0xb687('0x84'),_0x200b55['toString']());return dbH['sequelize']['query'](_0x200b55[_0xb687('0x85')](),{'type':dbH['sequelize'][_0xb687('0x87')][_0xb687('0xa3')]});}})[_0xb687('0x28')](function(){return{'sql':_0x581338[_0xb687('0x85')]()};})[_0xb687('0x28')](respondWithResult(_0x1d21ef,null))[_0xb687('0x48')](handleError(_0x1d21ef,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index f8dc8cf..a7d7566 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 _0x7ed3=['exports','AnalyticDefaultReport','analytics_default_reports','lodash','path','rimraf','../../config/environment'];(function(_0x276bb7,_0x55b660){var _0x334da4=function(_0x15084d){while(--_0x15084d){_0x276bb7['push'](_0x276bb7['shift']());}};_0x334da4(++_0x55b660);}(_0x7ed3,0x137));var _0x37ed=function(_0x2773b3,_0x302cd8){_0x2773b3=_0x2773b3-0x0;var _0xa113ea=_0x7ed3[_0x2773b3];return _0xa113ea;};'use strict';var _=require(_0x37ed('0x0'));var util=require('util');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(_0x37ed('0x1'));var rimraf=require(_0x37ed('0x2'));var config=require(_0x37ed('0x3'));var attributes=require('./analyticDefaultReport.attributes');module[_0x37ed('0x4')]=function(_0x9e86ee,_0x5ecd6e){return _0x9e86ee['define'](_0x37ed('0x5'),attributes,{'tableName':_0x37ed('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc6f5=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','lodash'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xc6f5,0x197));var _0x5c6f=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xc6f5[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x5c6f('0x0'));var util=require(_0x5c6f('0x1'));var logger=require(_0x5c6f('0x2'))('api');var moment=require(_0x5c6f('0x3'));var BPromise=require(_0x5c6f('0x4'));var rp=require(_0x5c6f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5c6f('0x6'));var config=require(_0x5c6f('0x7'));var attributes=require(_0x5c6f('0x8'));module[_0x5c6f('0x9')]=function(_0xb1212c,_0x20564b){return _0xb1212c[_0x5c6f('0xa')](_0x5c6f('0xb'),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 70e25bf..2183b2c 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 _0x2a6c=['error','code','message','request\x20sent','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticDefaultReport,\x20%s,\x20%s','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1709e7,_0x2ced21){var _0x402819=function(_0x3637a0){while(--_0x3637a0){_0x1709e7['push'](_0x1709e7['shift']());}};_0x402819(++_0x2ced21);}(_0x2a6c,0x102));var _0xc2a6=function(_0x2ceee7,_0x3c937f){_0x2ceee7=_0x2ceee7-0x0;var _0x4392f9=_0x2a6c[_0x2ceee7];return _0x4392f9;};'use strict';var _=require('lodash');var util=require(_0xc2a6('0x0'));var moment=require(_0xc2a6('0x1'));var BPromise=require(_0xc2a6('0x2'));var rs=require(_0xc2a6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc2a6('0x4'))['db'];var utils=require(_0xc2a6('0x5'));var logger=require(_0xc2a6('0x6'))(_0xc2a6('0x7'));var config=require(_0xc2a6('0x8'));var jayson=require(_0xc2a6('0x9'));var client=jayson[_0xc2a6('0xa')][_0xc2a6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1829c2,_0x189a87,_0x5aabc5){return new BPromise(function(_0x5d02fe,_0x278e3c){return client[_0xc2a6('0xc')](_0x1829c2,_0x5aabc5)[_0xc2a6('0xd')](function(_0x3739cc){logger['info'](_0xc2a6('0xe'),_0x189a87,'request\x20sent');logger[_0xc2a6('0xf')](_0xc2a6('0x10'),_0x189a87,'request\x20sent',JSON[_0xc2a6('0x11')](_0x3739cc));if(_0x3739cc[_0xc2a6('0x12')]){if(_0x3739cc[_0xc2a6('0x12')][_0xc2a6('0x13')]===0x1f4){logger[_0xc2a6('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x189a87,_0x3739cc[_0xc2a6('0x12')]['message']);return _0x278e3c(_0x3739cc[_0xc2a6('0x12')]['message']);}logger[_0xc2a6('0x12')](_0xc2a6('0xe'),_0x189a87,_0x3739cc[_0xc2a6('0x12')][_0xc2a6('0x14')]);return _0x5d02fe(_0x3739cc[_0xc2a6('0x12')][_0xc2a6('0x14')]);}else{logger['info'](_0xc2a6('0xe'),_0x189a87,_0xc2a6('0x15'));_0x5d02fe(_0x3739cc['result'][_0xc2a6('0x14')]);}})[_0xc2a6('0x16')](function(_0x5caea5){logger[_0xc2a6('0x12')](_0xc2a6('0xe'),_0x189a87,_0x5caea5);_0x278e3c(_0x5caea5);});});} \ No newline at end of file +var _0x942a=['debug','request\x20sent','stringify','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info'];(function(_0x445a84,_0x311a44){var _0x5e3a6e=function(_0x326ca3){while(--_0x326ca3){_0x445a84['push'](_0x445a84['shift']());}};_0x5e3a6e(++_0x311a44);}(_0x942a,0x171));var _0xa942=function(_0x151381,_0x97b314){_0x151381=_0x151381-0x0;var _0x2afab6=_0x942a[_0x151381];return _0x2afab6;};'use strict';var _=require('lodash');var util=require(_0xa942('0x0'));var moment=require('moment');var BPromise=require(_0xa942('0x1'));var rs=require(_0xa942('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa942('0x3'));var logger=require(_0xa942('0x4'))('rpc');var config=require(_0xa942('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xa942('0x6')][_0xa942('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4dd053,_0x3af71a,_0x99a6df){return new BPromise(function(_0x490d8d,_0x2a367a){return client[_0xa942('0x8')](_0x4dd053,_0x99a6df)[_0xa942('0x9')](function(_0x435806){logger[_0xa942('0xa')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3af71a,'request\x20sent');logger[_0xa942('0xb')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x3af71a,_0xa942('0xc'),JSON[_0xa942('0xd')](_0x435806));if(_0x435806[_0xa942('0xe')]){if(_0x435806[_0xa942('0xe')][_0xa942('0xf')]===0x1f4){logger[_0xa942('0xe')](_0xa942('0x10'),_0x3af71a,_0x435806[_0xa942('0xe')][_0xa942('0x11')]);return _0x2a367a(_0x435806[_0xa942('0xe')][_0xa942('0x11')]);}logger[_0xa942('0xe')](_0xa942('0x10'),_0x3af71a,_0x435806[_0xa942('0xe')][_0xa942('0x11')]);return _0x490d8d(_0x435806['error'][_0xa942('0x11')]);}else{logger[_0xa942('0xa')](_0xa942('0x10'),_0x3af71a,_0xa942('0xc'));_0x490d8d(_0x435806[_0xa942('0x12')][_0xa942('0x11')]);}})[_0xa942('0x13')](function(_0x30771a){logger['error'](_0xa942('0x10'),_0x3af71a,_0x30771a);_0x2a367a(_0x30771a);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index daffcaf..2eb3f04 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 _0x3c54=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','isAuthenticated','/:id/preview','preview','/:id/run','/:id/query','post','create','delete','/:id','destroy','multer','util','path'];(function(_0x513455,_0x9ea0c1){var _0x378728=function(_0x19a2d1){while(--_0x19a2d1){_0x513455['push'](_0x513455['shift']());}};_0x378728(++_0x9ea0c1);}(_0x3c54,0x14d));var _0x43c5=function(_0x56b4bd,_0x53a74c){_0x56b4bd=_0x56b4bd-0x0;var _0x3e614d=_0x3c54[_0x56b4bd];return _0x3e614d;};'use strict';var multer=require(_0x43c5('0x0'));var util=require(_0x43c5('0x1'));var path=require(_0x43c5('0x2'));var timeout=require(_0x43c5('0x3'));var express=require(_0x43c5('0x4'));var router=express[_0x43c5('0x5')]();var fs_extra=require(_0x43c5('0x6'));var auth=require(_0x43c5('0x7'));var interaction=require(_0x43c5('0x8'));var config=require('../../config/environment');var controller=require('./analyticDefaultReport.controller');router[_0x43c5('0x9')]('/',auth['isAuthenticated'](),controller[_0x43c5('0xa')]);router['get']('/:id',auth[_0x43c5('0xb')](),controller['show']);router['get'](_0x43c5('0xc'),auth[_0x43c5('0xb')](),controller[_0x43c5('0xd')]);router[_0x43c5('0x9')](_0x43c5('0xe'),auth[_0x43c5('0xb')](),controller['run']);router[_0x43c5('0x9')](_0x43c5('0xf'),auth[_0x43c5('0xb')](),controller['query']);router[_0x43c5('0x10')]('/',auth[_0x43c5('0xb')](),controller[_0x43c5('0x11')]);router['put']('/:id',auth[_0x43c5('0xb')](),controller['update']);router[_0x43c5('0x12')](_0x43c5('0x13'),auth['isAuthenticated'](),controller[_0x43c5('0x14')]);module['exports']=router; \ No newline at end of file +var _0x8ffd=['multer','path','express','Router','fs-extra','../../config/environment','get','isAuthenticated','/:id','show','/:id/preview','/:id/run','run','/:id/query','query','post','create','put','update','delete','destroy','exports'];(function(_0x6d205c,_0x305498){var _0x3b5e06=function(_0x112835){while(--_0x112835){_0x6d205c['push'](_0x6d205c['shift']());}};_0x3b5e06(++_0x305498);}(_0x8ffd,0x18c));var _0xd8ff=function(_0x34d275,_0x5d84ee){_0x34d275=_0x34d275-0x0;var _0x1379cc=_0x8ffd[_0x34d275];return _0x1379cc;};'use strict';var multer=require(_0xd8ff('0x0'));var util=require('util');var path=require(_0xd8ff('0x1'));var timeout=require('connect-timeout');var express=require(_0xd8ff('0x2'));var router=express[_0xd8ff('0x3')]();var fs_extra=require(_0xd8ff('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd8ff('0x5'));var controller=require('./analyticDefaultReport.controller');router[_0xd8ff('0x6')]('/',auth[_0xd8ff('0x7')](),controller['index']);router[_0xd8ff('0x6')](_0xd8ff('0x8'),auth[_0xd8ff('0x7')](),controller[_0xd8ff('0x9')]);router[_0xd8ff('0x6')](_0xd8ff('0xa'),auth[_0xd8ff('0x7')](),controller['preview']);router[_0xd8ff('0x6')](_0xd8ff('0xb'),auth[_0xd8ff('0x7')](),controller[_0xd8ff('0xc')]);router[_0xd8ff('0x6')](_0xd8ff('0xd'),auth['isAuthenticated'](),controller[_0xd8ff('0xe')]);router[_0xd8ff('0xf')]('/',auth[_0xd8ff('0x7')](),controller[_0xd8ff('0x10')]);router[_0xd8ff('0x11')](_0xd8ff('0x8'),auth[_0xd8ff('0x7')](),controller[_0xd8ff('0x12')]);router[_0xd8ff('0x13')](_0xd8ff('0x8'),auth['isAuthenticated'](),controller[_0xd8ff('0x14')]);module[_0xd8ff('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 2021919..c6e3b42 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 _0xf914=['Loading','manual','scheduled','INTEGER','sequelize','moment','exports','STRING','csv','pdf','xlsx','DATE'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xf914,0x1c0));var _0x4f91=function(_0x1c34e7,_0x33f9a8){_0x1c34e7=_0x1c34e7-0x0;var _0x378cb1=_0xf914[_0x1c34e7];return _0x378cb1;};'use strict';var Sequelize=require(_0x4f91('0x0'));var moment=require(_0x4f91('0x1'));module[_0x4f91('0x2')]={'name':{'type':Sequelize[_0x4f91('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x4f91('0x3')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x4f91('0x4'),_0x4f91('0x5'),_0x4f91('0x6')),'allowNull':![],'defaultValue':_0x4f91('0x4')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x4f91('0x7')]},'endDate':{'type':Sequelize[_0x4f91('0x7')]},'status':{'type':Sequelize[_0x4f91('0x3')],'defaultValue':_0x4f91('0x8')},'type':{'type':Sequelize['ENUM'](_0x4f91('0x9'),_0x4f91('0xa')),'allowNull':![],'defaultValue':_0x4f91('0x9')},'reportId':{'type':Sequelize[_0x4f91('0xb')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x4f91('0x3')]}}; \ No newline at end of file +var _0xecd9=['csv','pdf','DATE','Loading','scheduled','manual','UNSIGNED','sequelize','moment','STRING','ENUM'];(function(_0x2d4c1b,_0x1e282c){var _0x2039c5=function(_0x3c40db){while(--_0x3c40db){_0x2d4c1b['push'](_0x2d4c1b['shift']());}};_0x2039c5(++_0x1e282c);}(_0xecd9,0x19e));var _0x9ecd=function(_0x42d560,_0x195f36){_0x42d560=_0x42d560-0x0;var _0x3d236e=_0xecd9[_0x42d560];return _0x3d236e;};'use strict';var Sequelize=require(_0x9ecd('0x0'));var moment=require(_0x9ecd('0x1'));module['exports']={'name':{'type':Sequelize[_0x9ecd('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x9ecd('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x9ecd('0x3')](_0x9ecd('0x4'),_0x9ecd('0x5'),'xlsx'),'allowNull':![],'defaultValue':_0x9ecd('0x4')},'savename':{'type':Sequelize[_0x9ecd('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x9ecd('0x6')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x9ecd('0x2')],'defaultValue':_0x9ecd('0x7')},'type':{'type':Sequelize['ENUM']('manual',_0x9ecd('0x8')),'allowNull':![],'defaultValue':_0x9ecd('0x9')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x9ecd('0xa')]},'reportType':{'type':Sequelize[_0x9ecd('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index b2548aa..58c800b 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 _0x0eef=['catch','show','params','includeAll','options','find','body','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','basename','output','existsSync','join','root','server/files/reports','savename','Sequelize','format','%s.%s','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','save','then','destroy','get','ExtractedReports','UserProfileResource','stack','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','include','rows'];(function(_0x3f126f,_0x38384b){var _0x15bee1=function(_0x2a31ad){while(--_0x2a31ad){_0x3f126f['push'](_0x3f126f['shift']());}};_0x15bee1(++_0x38384b);}(_0x0eef,0x128));var _0xf0ee=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x0eef[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0xf0ee('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf0ee('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf0ee('0x2'));var moment=require(_0xf0ee('0x3'));var BPromise=require(_0xf0ee('0x4'));var Mustache=require(_0xf0ee('0x5'));var util=require(_0xf0ee('0x6'));var path=require(_0xf0ee('0x7'));var sox=require('sox');var csv=require(_0xf0ee('0x8'));var ejs=require(_0xf0ee('0x9'));var fs=require('fs');var fs_extra=require(_0xf0ee('0xa'));var _=require(_0xf0ee('0xb'));var squel=require(_0xf0ee('0xc'));var crypto=require(_0xf0ee('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf0ee('0xe'));var toCsv=require(_0xf0ee('0x8'));var querystring=require(_0xf0ee('0xf'));var Papa=require(_0xf0ee('0x10'));var Redis=require(_0xf0ee('0x11'));var authService=require(_0xf0ee('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf0ee('0x13'));var hardwareService=require(_0xf0ee('0x14'));var logger=require(_0xf0ee('0x15'))(_0xf0ee('0x16'));var utils=require('../../config/utils');var config=require(_0xf0ee('0x17'));var licenseUtil=require(_0xf0ee('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54af77,_0xa7bc8e){_0xa7bc8e=_0xa7bc8e||0xcc;return function(_0x3105ab){if(_0x3105ab){return _0x54af77[_0xf0ee('0x19')](_0xa7bc8e);}return _0x54af77[_0xf0ee('0x1a')](_0xa7bc8e)[_0xf0ee('0x1b')]();};}function respondWithResult(_0x52dee8,_0xf0fdde){_0xf0fdde=_0xf0fdde||0xc8;return function(_0x24bee2){if(_0x24bee2){return _0x52dee8[_0xf0ee('0x1a')](_0xf0fdde)[_0xf0ee('0x1c')](_0x24bee2);}};}function respondWithFilteredResult(_0x39a094,_0x6e698c){return function(_0x51cdd1){if(_0x51cdd1){var _0x2243ed=typeof _0x6e698c['offset']===_0xf0ee('0x1d')&&typeof _0x6e698c['limit']===_0xf0ee('0x1d');var _0x51497c=_0x51cdd1[_0xf0ee('0x1e')];var _0x205998=_0x2243ed?0x0:_0x6e698c['offset'];var _0x188f96=_0x2243ed?_0x51cdd1[_0xf0ee('0x1e')]:_0x6e698c[_0xf0ee('0x1f')]+_0x6e698c['limit'];var _0x4c1d6d;if(_0x188f96>=_0x51497c){_0x188f96=_0x51497c;_0x4c1d6d=0xc8;}else{_0x4c1d6d=0xce;}_0x39a094[_0xf0ee('0x1a')](_0x4c1d6d);return _0x39a094[_0xf0ee('0x20')](_0xf0ee('0x21'),_0x205998+'-'+_0x188f96+'/'+_0x51497c)[_0xf0ee('0x1c')](_0x51cdd1);}return null;};}function patchUpdates(_0x37262d){return function(_0x599c83){try{jsonpatch['apply'](_0x599c83,_0x37262d,!![]);}catch(_0x40836f){return BPromise['reject'](_0x40836f);}return _0x599c83[_0xf0ee('0x22')]();};}function saveUpdates(_0x54310b,_0x4dbdf8){return function(_0x3cf3bb){if(_0x3cf3bb){return _0x3cf3bb['update'](_0x54310b)[_0xf0ee('0x23')](function(_0x5d3a60){return _0x5d3a60;});}return null;};}function removeEntity(_0x1a3896,_0x43b874){return function(_0x596afc){if(_0x596afc){return _0x596afc[_0xf0ee('0x24')]()['then'](function(){var _0x5edc62=_0x596afc[_0xf0ee('0x25')]({'plain':!![]});var _0x1d5e92=_0xf0ee('0x26');return db[_0xf0ee('0x27')][_0xf0ee('0x24')]({'where':{'type':_0x1d5e92,'resourceId':_0x5edc62['id']}})[_0xf0ee('0x23')](function(){return _0x596afc;});})[_0xf0ee('0x23')](function(){_0x1a3896[_0xf0ee('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18c60a,_0x198bf7){return function(_0x46291b){if(!_0x46291b){_0x18c60a['sendStatus'](0x194);}return _0x46291b;};}function handleError(_0x400d21,_0x2d02db){_0x2d02db=_0x2d02db||0x1f4;return function(_0x16721f){logger['error'](_0x16721f[_0xf0ee('0x28')]);if(_0x16721f['name']){delete _0x16721f['name'];}_0x400d21[_0xf0ee('0x1a')](_0x2d02db)[_0xf0ee('0x29')](_0x16721f);};}exports[_0xf0ee('0x2a')]=function(_0x58712c,_0x90f4b1){var _0x11ef08={},_0x3b1be8={},_0x31427b={'count':0x0,'rows':[]};var _0x26bc6d=_[_0xf0ee('0x2b')](db[_0xf0ee('0x2c')][_0xf0ee('0x2d')],function(_0x19286f){return{'name':_0x19286f[_0xf0ee('0x2e')],'type':_0x19286f[_0xf0ee('0x2f')][_0xf0ee('0x30')]};});_0x3b1be8[_0xf0ee('0x31')]=_[_0xf0ee('0x2b')](_0x26bc6d,_0xf0ee('0x32'));_0x3b1be8[_0xf0ee('0x33')]=_[_0xf0ee('0x34')](_0x58712c[_0xf0ee('0x33')]);_0x3b1be8[_0xf0ee('0x35')]=_[_0xf0ee('0x36')](_0x3b1be8['model'],_0x3b1be8[_0xf0ee('0x33')]);_0x11ef08['attributes']=_[_0xf0ee('0x36')](_0x3b1be8[_0xf0ee('0x31')],qs[_0xf0ee('0x37')](_0x58712c[_0xf0ee('0x33')]['fields']));_0x11ef08[_0xf0ee('0x38')]=_0x11ef08['attributes'][_0xf0ee('0x39')]?_0x11ef08['attributes']:_0x3b1be8['model'];if(!_0x58712c[_0xf0ee('0x33')][_0xf0ee('0x3a')]('nolimit')){_0x11ef08[_0xf0ee('0x3b')]=qs[_0xf0ee('0x3b')](_0x58712c[_0xf0ee('0x33')][_0xf0ee('0x3b')]);_0x11ef08['offset']=qs['offset'](_0x58712c['query']['offset']);}_0x11ef08[_0xf0ee('0x3c')]=qs[_0xf0ee('0x3d')](_0x58712c['query'][_0xf0ee('0x3d')]);_0x11ef08[_0xf0ee('0x3e')]=qs[_0xf0ee('0x35')](_[_0xf0ee('0x3f')](_0x58712c[_0xf0ee('0x33')],_0x3b1be8[_0xf0ee('0x35')]),_0x26bc6d);if(_0x58712c[_0xf0ee('0x33')][_0xf0ee('0x40')]){_0x11ef08[_0xf0ee('0x3e')]=_['merge'](_0x11ef08[_0xf0ee('0x3e')],{'$or':_[_0xf0ee('0x2b')](_0x26bc6d,function(_0x3e5824){if(_0x3e5824[_0xf0ee('0x2f')]!=='VIRTUAL'){var _0x1260a1={};_0x1260a1[_0x3e5824[_0xf0ee('0x32')]]={'$like':'%'+_0x58712c[_0xf0ee('0x33')][_0xf0ee('0x40')]+'%'};return _0x1260a1;}})});}_0x11ef08=_[_0xf0ee('0x41')]({},_0x11ef08,_0x58712c['options']);var _0x1fecbe={'where':_0x11ef08[_0xf0ee('0x3e')]};return db[_0xf0ee('0x2c')][_0xf0ee('0x1e')](_0x1fecbe)[_0xf0ee('0x23')](function(_0x5c5bab){_0x31427b[_0xf0ee('0x1e')]=_0x5c5bab;if(_0x58712c[_0xf0ee('0x33')]['includeAll']){_0x11ef08[_0xf0ee('0x42')]=[{'all':!![]}];}return db[_0xf0ee('0x2c')]['findAll'](_0x11ef08);})[_0xf0ee('0x23')](function(_0x1b6b78){_0x31427b[_0xf0ee('0x43')]=_0x1b6b78;return _0x31427b;})[_0xf0ee('0x23')](respondWithFilteredResult(_0x90f4b1,_0x11ef08))[_0xf0ee('0x44')](handleError(_0x90f4b1,null));};exports[_0xf0ee('0x45')]=function(_0x3e802f,_0x4bbedb){var _0x16cc6d={'raw':!![],'where':{'id':_0x3e802f[_0xf0ee('0x46')]['id']}},_0x4be7c3={};_0x4be7c3[_0xf0ee('0x31')]=_[_0xf0ee('0x34')](db[_0xf0ee('0x2c')][_0xf0ee('0x2d')]);_0x4be7c3[_0xf0ee('0x33')]=_['keys'](_0x3e802f[_0xf0ee('0x33')]);_0x4be7c3['filters']=_[_0xf0ee('0x36')](_0x4be7c3['model'],_0x4be7c3['query']);_0x16cc6d[_0xf0ee('0x38')]=_['intersection'](_0x4be7c3[_0xf0ee('0x31')],qs[_0xf0ee('0x37')](_0x3e802f[_0xf0ee('0x33')][_0xf0ee('0x37')]));_0x16cc6d['attributes']=_0x16cc6d['attributes']['length']?_0x16cc6d[_0xf0ee('0x38')]:_0x4be7c3[_0xf0ee('0x31')];if(_0x3e802f[_0xf0ee('0x33')][_0xf0ee('0x47')]){_0x16cc6d[_0xf0ee('0x42')]=[{'all':!![]}];}_0x16cc6d=_['merge']({},_0x16cc6d,_0x3e802f[_0xf0ee('0x48')]);return db['AnalyticExtractedReport'][_0xf0ee('0x49')](_0x16cc6d)['then'](handleEntityNotFound(_0x4bbedb,null))[_0xf0ee('0x23')](respondWithResult(_0x4bbedb,null))[_0xf0ee('0x44')](handleError(_0x4bbedb,null));};exports['create']=function(_0x7087ef,_0x38b8d4){return db[_0xf0ee('0x2c')]['create'](_0x7087ef[_0xf0ee('0x4a')],{})[_0xf0ee('0x23')](function(_0x440141){var _0x183914=_0x7087ef[_0xf0ee('0x4b')]['get']({'plain':!![]});if(!_0x183914)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x183914[_0xf0ee('0x4c')]===_0xf0ee('0x4b')){var _0x306e5e=_0x440141[_0xf0ee('0x25')]({'plain':!![]});var _0x51dbd6='ExtractedReports';return db[_0xf0ee('0x4d')][_0xf0ee('0x49')]({'where':{'name':_0x51dbd6,'userProfileId':_0x183914[_0xf0ee('0x4e')]},'raw':!![]})[_0xf0ee('0x23')](function(_0x1432bc){if(_0x1432bc&&_0x1432bc['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x306e5e['name'],'resourceId':_0x306e5e['id'],'type':_0x1432bc['name'],'sectionId':_0x1432bc['id']},{})['then'](function(){return _0x440141;});}else{return _0x440141;}})[_0xf0ee('0x44')](function(_0x4815e3){logger['error'](_0xf0ee('0x4f'),_0x4815e3);throw _0x4815e3;});}return _0x440141;})[_0xf0ee('0x23')](respondWithResult(_0x38b8d4,0xc9))['catch'](handleError(_0x38b8d4,null));};exports[_0xf0ee('0x50')]=function(_0x67e0cb,_0x2e0c33){if(_0x67e0cb[_0xf0ee('0x4a')]['id']){delete _0x67e0cb[_0xf0ee('0x4a')]['id'];}return db['AnalyticExtractedReport'][_0xf0ee('0x49')]({'where':{'id':_0x67e0cb[_0xf0ee('0x46')]['id']}})[_0xf0ee('0x23')](handleEntityNotFound(_0x2e0c33,null))[_0xf0ee('0x23')](saveUpdates(_0x67e0cb['body'],null))[_0xf0ee('0x23')](respondWithResult(_0x2e0c33,null))[_0xf0ee('0x44')](handleError(_0x2e0c33,null));};exports['destroy']=function(_0x4d6acb,_0x1a4c10){return db['AnalyticExtractedReport'][_0xf0ee('0x49')]({'where':{'id':_0x4d6acb[_0xf0ee('0x46')]['id']}})['then'](handleEntityNotFound(_0x1a4c10,null))[_0xf0ee('0x23')](removeEntity(_0x1a4c10,null))[_0xf0ee('0x44')](handleError(_0x1a4c10,null));};exports['download']=function(_0x546f50,_0x506235,_0x46f47d){return db['AnalyticExtractedReport'][_0xf0ee('0x49')]({'where':{'id':_0x546f50[_0xf0ee('0x46')]['id']},'attributes':[_0xf0ee('0x32'),_0xf0ee('0x51'),'savename',_0xf0ee('0x52')],'raw':!![]})['then'](handleEntityNotFound(_0x506235,null))[_0xf0ee('0x23')](function(_0x4ef5ce){if(_0x4ef5ce){if(!fs[_0xf0ee('0x53')](path[_0xf0ee('0x54')](config[_0xf0ee('0x55')],_0xf0ee('0x56'),_0x4ef5ce[_0xf0ee('0x57')]))){throw new db[(_0xf0ee('0x58'))]['ValidationError']('Report\x20not\x20found\x20or\x20empty');}if(_0x546f50[_0xf0ee('0x33')]['exists']){return _0x506235['sendStatus'](0xc8);}return _0x506235['download'](path[_0xf0ee('0x54')](config['root'],_0xf0ee('0x56'),_0x4ef5ce[_0xf0ee('0x57')]),util[_0xf0ee('0x59')](_0xf0ee('0x5a'),_0x4ef5ce[_0xf0ee('0x51')]||_0x4ef5ce['name'],_0x4ef5ce['output']['toLowerCase']()));}})[_0xf0ee('0x44')](handleError(_0x506235,null));}; \ No newline at end of file +var _0x84a4=['request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','name','send','map','type','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','VIRTUAL','filter','merge','AnalyticExtractedReport','rows','catch','show','rawAttributes','includeAll','include','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ExtractedReports','UserProfileSection','body','params','basename','savename','output','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','sendStatus','server/files/reports','%s.%s','toLowerCase','eml-format','rimraf','fast-json-patch'];(function(_0x43a954,_0x1d73d7){var _0x1973f6=function(_0x3de96c){while(--_0x3de96c){_0x43a954['push'](_0x43a954['shift']());}};_0x1973f6(++_0x1d73d7);}(_0x84a4,0xab));var _0x484a=function(_0x3411a4,_0x60d585){_0x3411a4=_0x3411a4-0x0;var _0x4eb325=_0x84a4[_0x3411a4];return _0x4eb325;};'use strict';var emlformat=require(_0x484a('0x0'));var rimraf=require(_0x484a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x484a('0x2'));var rp=require(_0x484a('0x3'));var moment=require(_0x484a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x484a('0x5'));var util=require(_0x484a('0x6'));var path=require(_0x484a('0x7'));var sox=require('sox');var csv=require(_0x484a('0x8'));var ejs=require(_0x484a('0x9'));var fs=require('fs');var fs_extra=require(_0x484a('0xa'));var _=require(_0x484a('0xb'));var squel=require(_0x484a('0xc'));var crypto=require(_0x484a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x484a('0xe'));var Papa=require(_0x484a('0xf'));var Redis=require('ioredis');var authService=require(_0x484a('0x10'));var qs=require(_0x484a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x484a('0x12'))('api');var utils=require(_0x484a('0x13'));var config=require(_0x484a('0x14'));var licenseUtil=require(_0x484a('0x15'));var db=require(_0x484a('0x16'))['db'];function respondWithStatusCode(_0x45adb7,_0x108f33){_0x108f33=_0x108f33||0xcc;return function(_0x162e93){if(_0x162e93){return _0x45adb7['sendStatus'](_0x108f33);}return _0x45adb7[_0x484a('0x17')](_0x108f33)['end']();};}function respondWithResult(_0x412718,_0x4ce308){_0x4ce308=_0x4ce308||0xc8;return function(_0x1bee5e){if(_0x1bee5e){return _0x412718[_0x484a('0x17')](_0x4ce308)['json'](_0x1bee5e);}};}function respondWithFilteredResult(_0xb40d8c,_0x298c16){return function(_0x41dbf9){if(_0x41dbf9){var _0x2fc281=typeof _0x298c16[_0x484a('0x18')]===_0x484a('0x19')&&typeof _0x298c16['limit']===_0x484a('0x19');var _0x361783=_0x41dbf9['count'];var _0x1e07a5=_0x2fc281?0x0:_0x298c16['offset'];var _0x3886da=_0x2fc281?_0x41dbf9[_0x484a('0x1a')]:_0x298c16[_0x484a('0x18')]+_0x298c16['limit'];var _0x4fbc5f;if(_0x3886da>=_0x361783){_0x3886da=_0x361783;_0x4fbc5f=0xc8;}else{_0x4fbc5f=0xce;}_0xb40d8c[_0x484a('0x17')](_0x4fbc5f);return _0xb40d8c[_0x484a('0x1b')](_0x484a('0x1c'),_0x1e07a5+'-'+_0x3886da+'/'+_0x361783)[_0x484a('0x1d')](_0x41dbf9);}return null;};}function patchUpdates(_0x675651){return function(_0x54c4f2){try{jsonpatch[_0x484a('0x1e')](_0x54c4f2,_0x675651,!![]);}catch(_0x438268){return BPromise[_0x484a('0x1f')](_0x438268);}return _0x54c4f2[_0x484a('0x20')]();};}function saveUpdates(_0x71fd0e,_0x249187){return function(_0x116fe5){if(_0x116fe5){return _0x116fe5[_0x484a('0x21')](_0x71fd0e)[_0x484a('0x22')](function(_0x4beede){return _0x4beede;});}return null;};}function removeEntity(_0x25fbfc,_0x11a042){return function(_0x22237f){if(_0x22237f){return _0x22237f[_0x484a('0x23')]()[_0x484a('0x22')](function(){var _0x2e65cf=_0x22237f[_0x484a('0x24')]({'plain':!![]});var _0x2a0809='ExtractedReports';return db[_0x484a('0x25')]['destroy']({'where':{'type':_0x2a0809,'resourceId':_0x2e65cf['id']}})['then'](function(){return _0x22237f;});})[_0x484a('0x22')](function(){_0x25fbfc[_0x484a('0x17')](0xcc)[_0x484a('0x26')]();});}};}function handleEntityNotFound(_0x9d67ec,_0x2751c1){return function(_0x397830){if(!_0x397830){_0x9d67ec['sendStatus'](0x194);}return _0x397830;};}function handleError(_0x129bdc,_0x2aa596){_0x2aa596=_0x2aa596||0x1f4;return function(_0x1f86cc){logger[_0x484a('0x27')](_0x1f86cc['stack']);if(_0x1f86cc['name']){delete _0x1f86cc[_0x484a('0x28')];}_0x129bdc[_0x484a('0x17')](_0x2aa596)[_0x484a('0x29')](_0x1f86cc);};}exports['index']=function(_0x186264,_0x694567){var _0x3e3350={},_0x288093={},_0x136560={'count':0x0,'rows':[]};var _0xaebc60=_[_0x484a('0x2a')](db['AnalyticExtractedReport']['rawAttributes'],function(_0x8f3c4d){return{'name':_0x8f3c4d['fieldName'],'type':_0x8f3c4d[_0x484a('0x2b')]['key']};});_0x288093['model']=_[_0x484a('0x2a')](_0xaebc60,_0x484a('0x28'));_0x288093['query']=_[_0x484a('0x2c')](_0x186264[_0x484a('0x2d')]);_0x288093[_0x484a('0x2e')]=_[_0x484a('0x2f')](_0x288093[_0x484a('0x30')],_0x288093[_0x484a('0x2d')]);_0x3e3350['attributes']=_[_0x484a('0x2f')](_0x288093[_0x484a('0x30')],qs['fields'](_0x186264['query'][_0x484a('0x31')]));_0x3e3350[_0x484a('0x32')]=_0x3e3350[_0x484a('0x32')][_0x484a('0x33')]?_0x3e3350[_0x484a('0x32')]:_0x288093['model'];if(!_0x186264[_0x484a('0x2d')][_0x484a('0x34')](_0x484a('0x35'))){_0x3e3350[_0x484a('0x36')]=qs['limit'](_0x186264[_0x484a('0x2d')]['limit']);_0x3e3350[_0x484a('0x18')]=qs[_0x484a('0x18')](_0x186264[_0x484a('0x2d')][_0x484a('0x18')]);}_0x3e3350['order']=qs[_0x484a('0x37')](_0x186264[_0x484a('0x2d')]['sort']);_0x3e3350[_0x484a('0x38')]=qs['filters'](_['pick'](_0x186264[_0x484a('0x2d')],_0x288093[_0x484a('0x2e')]),_0xaebc60);if(_0x186264[_0x484a('0x2d')]['filter']){_0x3e3350[_0x484a('0x38')]=_['merge'](_0x3e3350[_0x484a('0x38')],{'$or':_[_0x484a('0x2a')](_0xaebc60,function(_0x3ff0c0){if(_0x3ff0c0[_0x484a('0x2b')]!==_0x484a('0x39')){var _0x5e6b4f={};_0x5e6b4f[_0x3ff0c0[_0x484a('0x28')]]={'$like':'%'+_0x186264[_0x484a('0x2d')][_0x484a('0x3a')]+'%'};return _0x5e6b4f;}})});}_0x3e3350=_[_0x484a('0x3b')]({},_0x3e3350,_0x186264['options']);var _0x2a8c68={'where':_0x3e3350['where']};return db[_0x484a('0x3c')][_0x484a('0x1a')](_0x2a8c68)['then'](function(_0x3a05f1){_0x136560[_0x484a('0x1a')]=_0x3a05f1;if(_0x186264[_0x484a('0x2d')]['includeAll']){_0x3e3350['include']=[{'all':!![]}];}return db[_0x484a('0x3c')]['findAll'](_0x3e3350);})[_0x484a('0x22')](function(_0x219bff){_0x136560[_0x484a('0x3d')]=_0x219bff;return _0x136560;})[_0x484a('0x22')](respondWithFilteredResult(_0x694567,_0x3e3350))[_0x484a('0x3e')](handleError(_0x694567,null));};exports[_0x484a('0x3f')]=function(_0x6fe4a,_0x5c1ffa){var _0x526400={'raw':!![],'where':{'id':_0x6fe4a['params']['id']}},_0x660453={};_0x660453[_0x484a('0x30')]=_[_0x484a('0x2c')](db[_0x484a('0x3c')][_0x484a('0x40')]);_0x660453['query']=_[_0x484a('0x2c')](_0x6fe4a[_0x484a('0x2d')]);_0x660453[_0x484a('0x2e')]=_[_0x484a('0x2f')](_0x660453[_0x484a('0x30')],_0x660453[_0x484a('0x2d')]);_0x526400['attributes']=_[_0x484a('0x2f')](_0x660453[_0x484a('0x30')],qs[_0x484a('0x31')](_0x6fe4a[_0x484a('0x2d')]['fields']));_0x526400[_0x484a('0x32')]=_0x526400[_0x484a('0x32')]['length']?_0x526400[_0x484a('0x32')]:_0x660453[_0x484a('0x30')];if(_0x6fe4a[_0x484a('0x2d')][_0x484a('0x41')]){_0x526400[_0x484a('0x42')]=[{'all':!![]}];}_0x526400=_[_0x484a('0x3b')]({},_0x526400,_0x6fe4a[_0x484a('0x43')]);return db[_0x484a('0x3c')][_0x484a('0x44')](_0x526400)[_0x484a('0x22')](handleEntityNotFound(_0x5c1ffa,null))['then'](respondWithResult(_0x5c1ffa,null))[_0x484a('0x3e')](handleError(_0x5c1ffa,null));};exports[_0x484a('0x45')]=function(_0x5b4f2c,_0xe03d74){return db[_0x484a('0x3c')]['create'](_0x5b4f2c['body'],{})[_0x484a('0x22')](function(_0x28d0b0){var _0x363d3d=_0x5b4f2c['user']['get']({'plain':!![]});if(!_0x363d3d)throw new Error(_0x484a('0x46'));if(_0x363d3d[_0x484a('0x47')]===_0x484a('0x48')){var _0x2ad4a5=_0x28d0b0[_0x484a('0x24')]({'plain':!![]});var _0x149c73=_0x484a('0x49');return db[_0x484a('0x4a')][_0x484a('0x44')]({'where':{'name':_0x149c73,'userProfileId':_0x363d3d['userProfileId']},'raw':!![]})[_0x484a('0x22')](function(_0x4b5603){if(_0x4b5603&&_0x4b5603['autoAssociation']===0x0){return db['UserProfileResource'][_0x484a('0x45')]({'name':_0x2ad4a5['name'],'resourceId':_0x2ad4a5['id'],'type':_0x4b5603[_0x484a('0x28')],'sectionId':_0x4b5603['id']},{})[_0x484a('0x22')](function(){return _0x28d0b0;});}else{return _0x28d0b0;}})['catch'](function(_0x22239b){logger[_0x484a('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x22239b);throw _0x22239b;});}return _0x28d0b0;})[_0x484a('0x22')](respondWithResult(_0xe03d74,0xc9))[_0x484a('0x3e')](handleError(_0xe03d74,null));};exports[_0x484a('0x21')]=function(_0x4f8f8d,_0x36203c){if(_0x4f8f8d[_0x484a('0x4b')]['id']){delete _0x4f8f8d[_0x484a('0x4b')]['id'];}return db[_0x484a('0x3c')][_0x484a('0x44')]({'where':{'id':_0x4f8f8d[_0x484a('0x4c')]['id']}})['then'](handleEntityNotFound(_0x36203c,null))['then'](saveUpdates(_0x4f8f8d[_0x484a('0x4b')],null))[_0x484a('0x22')](respondWithResult(_0x36203c,null))[_0x484a('0x3e')](handleError(_0x36203c,null));};exports[_0x484a('0x23')]=function(_0x106aae,_0x386e67){return db[_0x484a('0x3c')][_0x484a('0x44')]({'where':{'id':_0x106aae[_0x484a('0x4c')]['id']}})[_0x484a('0x22')](handleEntityNotFound(_0x386e67,null))[_0x484a('0x22')](removeEntity(_0x386e67,null))[_0x484a('0x3e')](handleError(_0x386e67,null));};exports['download']=function(_0x52058e,_0x3a997a,_0x280433){return db['AnalyticExtractedReport'][_0x484a('0x44')]({'where':{'id':_0x52058e['params']['id']},'attributes':[_0x484a('0x28'),_0x484a('0x4d'),_0x484a('0x4e'),_0x484a('0x4f')],'raw':!![]})[_0x484a('0x22')](handleEntityNotFound(_0x3a997a,null))['then'](function(_0x32be83){if(_0x32be83){if(!fs['existsSync'](path['join'](config['root'],'server/files/reports',_0x32be83['savename']))){throw new db[(_0x484a('0x50'))]['ValidationError'](_0x484a('0x51'));}if(_0x52058e['query'][_0x484a('0x52')]){return _0x3a997a[_0x484a('0x53')](0xc8);}return _0x3a997a['download'](path['join'](config['root'],_0x484a('0x54'),_0x32be83[_0x484a('0x4e')]),util['format'](_0x484a('0x55'),_0x32be83[_0x484a('0x4d')]||_0x32be83[_0x484a('0x28')],_0x32be83[_0x484a('0x4f')][_0x484a('0x56')]()));}})[_0x484a('0x3e')](handleError(_0x3a997a,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 533cd1e..e403640 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 _0xf625=['path','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api'];(function(_0x23ec06,_0x561142){var _0x2831d4=function(_0x3802bc){while(--_0x3802bc){_0x23ec06['push'](_0x23ec06['shift']());}};_0x2831d4(++_0x561142);}(_0xf625,0x11a));var _0x5f62=function(_0x3909ae,_0x3183c7){_0x3909ae=_0x3909ae-0x0;var _0x15000b=_0xf625[_0x3909ae];return _0x15000b;};'use strict';var _=require(_0x5f62('0x0'));var util=require(_0x5f62('0x1'));var logger=require(_0x5f62('0x2'))(_0x5f62('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5f62('0x4'));var rimraf=require('rimraf');var config=require(_0x5f62('0x5'));var attributes=require(_0x5f62('0x6'));module[_0x5f62('0x7')]=function(_0x34c76e,_0x37a511){return _0x34c76e[_0x5f62('0x8')](_0x5f62('0x9'),attributes,{'tableName':_0x5f62('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa97c=['./analyticExtractedReport.attributes','exports','define','analytics_extracted_reports','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xba9946,_0x3e270b){var _0x55b343=function(_0x3309da){while(--_0x3309da){_0xba9946['push'](_0xba9946['shift']());}};_0x55b343(++_0x3e270b);}(_0xa97c,0x1d8));var _0xca97=function(_0x27eff2,_0x1fbaf0){_0x27eff2=_0x27eff2-0x0;var _0x352a1f=_0xa97c[_0x27eff2];return _0x352a1f;};'use strict';var _=require(_0xca97('0x0'));var util=require('util');var logger=require(_0xca97('0x1'))(_0xca97('0x2'));var moment=require('moment');var BPromise=require(_0xca97('0x3'));var rp=require(_0xca97('0x4'));var fs=require('fs');var path=require(_0xca97('0x5'));var rimraf=require(_0xca97('0x6'));var config=require(_0xca97('0x7'));var attributes=require(_0xca97('0x8'));module[_0xca97('0x9')]=function(_0x37e7d2,_0xa41039){return _0x37e7d2[_0xca97('0xa')]('AnalyticExtractedReport',attributes,{'tableName':_0xca97('0xb'),'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 359726b..2c974dd 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 _0xa039=['request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','client','http'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xa039,0x1c4));var _0x9a03=function(_0x2c22cf,_0x2d7c62){_0x2c22cf=_0x2c22cf-0x0;var _0x1561e8=_0xa039[_0x2c22cf];return _0x1561e8;};'use strict';var _=require('lodash');var util=require(_0x9a03('0x0'));var moment=require('moment');var BPromise=require(_0x9a03('0x1'));var rs=require(_0x9a03('0x2'));var fs=require('fs');var Redis=require(_0x9a03('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9a03('0x4'));var logger=require(_0x9a03('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9a03('0x6')][_0x9a03('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x569fd4,_0x7da9b3,_0x12e010){return new BPromise(function(_0x3f9aff,_0x471791){return client[_0x9a03('0x8')](_0x569fd4,_0x12e010)[_0x9a03('0x9')](function(_0x2de3ba){logger[_0x9a03('0xa')](_0x9a03('0xb'),_0x7da9b3,'request\x20sent');logger['debug'](_0x9a03('0xc'),_0x7da9b3,_0x9a03('0xd'),JSON[_0x9a03('0xe')](_0x2de3ba));if(_0x2de3ba[_0x9a03('0xf')]){if(_0x2de3ba['error'][_0x9a03('0x10')]===0x1f4){logger['error'](_0x9a03('0xb'),_0x7da9b3,_0x2de3ba[_0x9a03('0xf')][_0x9a03('0x11')]);return _0x471791(_0x2de3ba[_0x9a03('0xf')][_0x9a03('0x11')]);}logger[_0x9a03('0xf')](_0x9a03('0xb'),_0x7da9b3,_0x2de3ba[_0x9a03('0xf')][_0x9a03('0x11')]);return _0x3f9aff(_0x2de3ba['error'][_0x9a03('0x11')]);}else{logger[_0x9a03('0xa')](_0x9a03('0xb'),_0x7da9b3,'request\x20sent');_0x3f9aff(_0x2de3ba[_0x9a03('0x12')][_0x9a03('0x11')]);}})[_0x9a03('0x13')](function(_0x3f42f7){logger['error'](_0x9a03('0xb'),_0x7da9b3,_0x3f42f7);_0x471791(_0x3f42f7);});});} \ No newline at end of file +var _0x6d40=['rpc','../../config/environment','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x375362,_0x21b72a){var _0x14ceac=function(_0x31bc4d){while(--_0x31bc4d){_0x375362['push'](_0x375362['shift']());}};_0x14ceac(++_0x21b72a);}(_0x6d40,0x1ec));var _0x06d4=function(_0x177600,_0x307b54){_0x177600=_0x177600-0x0;var _0xb6282f=_0x6d40[_0x177600];return _0xb6282f;};'use strict';var _=require(_0x06d4('0x0'));var util=require(_0x06d4('0x1'));var moment=require('moment');var BPromise=require(_0x06d4('0x2'));var rs=require(_0x06d4('0x3'));var fs=require('fs');var Redis=require(_0x06d4('0x4'));var db=require(_0x06d4('0x5'))['db'];var utils=require(_0x06d4('0x6'));var logger=require(_0x06d4('0x7'))(_0x06d4('0x8'));var config=require(_0x06d4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x06d4('0xa')][_0x06d4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36f174,_0x208e2d,_0x35275f){return new BPromise(function(_0x4b5868,_0x1d6f8e){return client[_0x06d4('0xc')](_0x36f174,_0x35275f)[_0x06d4('0xd')](function(_0x3ca834){logger[_0x06d4('0xe')](_0x06d4('0xf'),_0x208e2d,_0x06d4('0x10'));logger[_0x06d4('0x11')](_0x06d4('0x12'),_0x208e2d,_0x06d4('0x10'),JSON[_0x06d4('0x13')](_0x3ca834));if(_0x3ca834[_0x06d4('0x14')]){if(_0x3ca834[_0x06d4('0x14')][_0x06d4('0x15')]===0x1f4){logger[_0x06d4('0x14')](_0x06d4('0xf'),_0x208e2d,_0x3ca834[_0x06d4('0x14')][_0x06d4('0x16')]);return _0x1d6f8e(_0x3ca834[_0x06d4('0x14')]['message']);}logger['error'](_0x06d4('0xf'),_0x208e2d,_0x3ca834['error'][_0x06d4('0x16')]);return _0x4b5868(_0x3ca834[_0x06d4('0x14')][_0x06d4('0x16')]);}else{logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x208e2d,_0x06d4('0x10'));_0x4b5868(_0x3ca834[_0x06d4('0x17')][_0x06d4('0x16')]);}})[_0x06d4('0x18')](function(_0x1be3c2){logger[_0x06d4('0x14')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x208e2d,_0x1be3c2);_0x1d6f8e(_0x1be3c2);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index c8b6f0c..ea85374 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 _0xb8a6=['/:id','show','/:id/download','download','create','update','delete','destroy','exports','util','path','express','fs-extra','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x51cce6,_0x16a2fb){var _0x4b53c3=function(_0xefdc56){while(--_0xefdc56){_0x51cce6['push'](_0x51cce6['shift']());}};_0x4b53c3(++_0x16a2fb);}(_0xb8a6,0x13b));var _0x6b8a=function(_0xe578a8,_0x3e927e){_0xe578a8=_0xe578a8-0x0;var _0x584925=_0xb8a6[_0xe578a8];return _0x584925;};'use strict';var multer=require('multer');var util=require(_0x6b8a('0x0'));var path=require(_0x6b8a('0x1'));var timeout=require('connect-timeout');var express=require(_0x6b8a('0x2'));var router=express['Router']();var fs_extra=require(_0x6b8a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x6b8a('0x4'));var config=require('../../config/environment');var controller=require('./analyticExtractedReport.controller');router[_0x6b8a('0x5')]('/',auth[_0x6b8a('0x6')](),controller[_0x6b8a('0x7')]);router[_0x6b8a('0x5')](_0x6b8a('0x8'),auth['isAuthenticated'](),controller[_0x6b8a('0x9')]);router[_0x6b8a('0x5')](_0x6b8a('0xa'),auth['isAuthenticated'](),controller[_0x6b8a('0xb')]);router['post']('/',auth[_0x6b8a('0x6')](),controller[_0x6b8a('0xc')]);router['put'](_0x6b8a('0x8'),auth['isAuthenticated'](),controller[_0x6b8a('0xd')]);router[_0x6b8a('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x6b8a('0xf')]);module[_0x6b8a('0x10')]=router; \ No newline at end of file +var _0x0477=['../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','/:id','show','/:id/download','download','post','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x8e0cd6,_0x364ace){var _0x162215=function(_0xea40c5){while(--_0xea40c5){_0x8e0cd6['push'](_0x8e0cd6['shift']());}};_0x162215(++_0x364ace);}(_0x0477,0x188));var _0x7047=function(_0x555b2f,_0x43b622){_0x555b2f=_0x555b2f-0x0;var _0x81c0a6=_0x0477[_0x555b2f];return _0x81c0a6;};'use strict';var multer=require(_0x7047('0x0'));var util=require(_0x7047('0x1'));var path=require('path');var timeout=require(_0x7047('0x2'));var express=require(_0x7047('0x3'));var router=express[_0x7047('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7047('0x5'));var interaction=require(_0x7047('0x6'));var config=require(_0x7047('0x7'));var controller=require(_0x7047('0x8'));router[_0x7047('0x9')]('/',auth[_0x7047('0xa')](),controller['index']);router[_0x7047('0x9')](_0x7047('0xb'),auth[_0x7047('0xa')](),controller[_0x7047('0xc')]);router[_0x7047('0x9')](_0x7047('0xd'),auth['isAuthenticated'](),controller[_0x7047('0xe')]);router[_0x7047('0xf')]('/',auth[_0x7047('0xa')](),controller['create']);router['put'](_0x7047('0xb'),auth[_0x7047('0xa')](),controller[_0x7047('0x10')]);router[_0x7047('0x11')]('/:id',auth[_0x7047('0xa')](),controller[_0x7047('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 482e0f4..d7d62ec 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 _0x6dbc=['STRING'];(function(_0xd1c6d8,_0x3eb001){var _0x27ab29=function(_0x31de34){while(--_0x31de34){_0xd1c6d8['push'](_0xd1c6d8['shift']());}};_0x27ab29(++_0x3eb001);}(_0x6dbc,0x15d));var _0xc6db=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x6dbc[_0x2d7f0e];return _0x110b07;};'use strict';var Sequelize=require('sequelize');module['exports']={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0xc6db('0x0')]},'function':{'type':Sequelize[_0xc6db('0x0')]},'format':{'type':Sequelize[_0xc6db('0x0')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xc6db('0x0')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xe02f=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x3ba1ca,_0x225761){var _0x51d416=function(_0x407c4f){while(--_0x407c4f){_0x3ba1ca['push'](_0x3ba1ca['shift']());}};_0x51d416(++_0x225761);}(_0xe02f,0x1b9));var _0xfe02=function(_0x10f7f7,_0x457207){_0x10f7f7=_0x10f7f7-0x0;var _0x4ca615=_0xe02f[_0x10f7f7];return _0x4ca615;};'use strict';var Sequelize=require(_0xfe02('0x0'));module[_0xfe02('0x1')]={'field':{'type':Sequelize[_0xfe02('0x2')]},'alias':{'type':Sequelize[_0xfe02('0x3')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xfe02('0x3')]},'groupBy':{'type':Sequelize[_0xfe02('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0xfe02('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 1f95ee1..7b32f93 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 _0xb411=['fields','attributes','length','order','sort','filter','where','merge','options','includeAll','include','findAll','rows','params','find','catch','create','body','bulkCreate','bulkDestroy','ids','AnalyticCustomReport','sequelize','transaction','CustomReportId','eml-format','rimraf','request-promise','bluebird','util','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','update','then','destroy','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','query','keys','filters','intersection','model'];(function(_0x15876a,_0x15383d){var _0xbd900f=function(_0x103e59){while(--_0x103e59){_0x15876a['push'](_0x15876a['shift']());}};_0xbd900f(++_0x15383d);}(_0xb411,0xf7));var _0x1b41=function(_0x56be8b,_0x3433ce){_0x56be8b=_0x56be8b-0x0;var _0x127933=_0xb411[_0x56be8b];return _0x127933;};'use strict';var emlformat=require(_0x1b41('0x0'));var rimraf=require(_0x1b41('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1b41('0x2'));var moment=require('moment');var BPromise=require(_0x1b41('0x3'));var Mustache=require('mustache');var util=require(_0x1b41('0x4'));var path=require('path');var sox=require(_0x1b41('0x5'));var csv=require(_0x1b41('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1b41('0x7'));var squel=require(_0x1b41('0x8'));var crypto=require('crypto');var jsforce=require(_0x1b41('0x9'));var deskjs=require(_0x1b41('0xa'));var toCsv=require(_0x1b41('0x6'));var querystring=require(_0x1b41('0xb'));var Papa=require(_0x1b41('0xc'));var Redis=require(_0x1b41('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1b41('0xe'));var hardwareService=require(_0x1b41('0xf'));var logger=require(_0x1b41('0x10'))(_0x1b41('0x11'));var utils=require(_0x1b41('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x1b41('0x13'));var db=require(_0x1b41('0x14'))['db'];function respondWithStatusCode(_0x560663,_0x2cfc2c){_0x2cfc2c=_0x2cfc2c||0xcc;return function(_0x3d0499){if(_0x3d0499){return _0x560663[_0x1b41('0x15')](_0x2cfc2c);}return _0x560663[_0x1b41('0x16')](_0x2cfc2c)[_0x1b41('0x17')]();};}function respondWithResult(_0x5414c0,_0xa2186a){_0xa2186a=_0xa2186a||0xc8;return function(_0x549aa8){if(_0x549aa8){return _0x5414c0[_0x1b41('0x16')](_0xa2186a)['json'](_0x549aa8);}};}function respondWithFilteredResult(_0x4df41,_0x2e4685){return function(_0x2cc9b8){if(_0x2cc9b8){var _0x34e56d=typeof _0x2e4685[_0x1b41('0x18')]===_0x1b41('0x19')&&typeof _0x2e4685[_0x1b41('0x1a')]===_0x1b41('0x19');var _0x4281a0=_0x2cc9b8[_0x1b41('0x1b')];var _0x5b580a=_0x34e56d?0x0:_0x2e4685['offset'];var _0x5827c7=_0x34e56d?_0x2cc9b8[_0x1b41('0x1b')]:_0x2e4685[_0x1b41('0x18')]+_0x2e4685[_0x1b41('0x1a')];var _0x27a160;if(_0x5827c7>=_0x4281a0){_0x5827c7=_0x4281a0;_0x27a160=0xc8;}else{_0x27a160=0xce;}_0x4df41['status'](_0x27a160);return _0x4df41['set'](_0x1b41('0x1c'),_0x5b580a+'-'+_0x5827c7+'/'+_0x4281a0)[_0x1b41('0x1d')](_0x2cc9b8);}return null;};}function patchUpdates(_0x3b5441){return function(_0x48f51d){try{jsonpatch[_0x1b41('0x1e')](_0x48f51d,_0x3b5441,!![]);}catch(_0x3c4f2f){return BPromise['reject'](_0x3c4f2f);}return _0x48f51d['save']();};}function saveUpdates(_0x563d19,_0x40e837){return function(_0x4b8028){if(_0x4b8028){return _0x4b8028[_0x1b41('0x1f')](_0x563d19)[_0x1b41('0x20')](function(_0x3cb235){return _0x3cb235;});}return null;};}function removeEntity(_0x5afec0,_0x1d70f1){return function(_0x2da07a){if(_0x2da07a){return _0x2da07a[_0x1b41('0x21')]()[_0x1b41('0x20')](function(){_0x5afec0['status'](0xcc)[_0x1b41('0x17')]();});}};}function handleEntityNotFound(_0x3de17c,_0xb32d70){return function(_0x36b391){if(!_0x36b391){_0x3de17c[_0x1b41('0x15')](0x194);}return _0x36b391;};}function handleError(_0x4ee816,_0x4c2f0b){_0x4c2f0b=_0x4c2f0b||0x1f4;return function(_0x56bae9){logger[_0x1b41('0x22')](_0x56bae9[_0x1b41('0x23')]);if(_0x56bae9[_0x1b41('0x24')]){delete _0x56bae9[_0x1b41('0x24')];}_0x4ee816[_0x1b41('0x16')](_0x4c2f0b)[_0x1b41('0x25')](_0x56bae9);};}exports[_0x1b41('0x26')]=function(_0x27bb60,_0x112b4d){var _0x19f91e={},_0x38a5a0={},_0x5679f0={'count':0x0,'rows':[]};var _0x246b37=_[_0x1b41('0x27')](db[_0x1b41('0x28')][_0x1b41('0x29')],function(_0x1efc13){return{'name':_0x1efc13[_0x1b41('0x2a')],'type':_0x1efc13[_0x1b41('0x2b')]['key']};});_0x38a5a0['model']=_['map'](_0x246b37,_0x1b41('0x24'));_0x38a5a0[_0x1b41('0x2c')]=_[_0x1b41('0x2d')](_0x27bb60[_0x1b41('0x2c')]);_0x38a5a0[_0x1b41('0x2e')]=_[_0x1b41('0x2f')](_0x38a5a0[_0x1b41('0x30')],_0x38a5a0['query']);_0x19f91e['attributes']=_[_0x1b41('0x2f')](_0x38a5a0[_0x1b41('0x30')],qs[_0x1b41('0x31')](_0x27bb60[_0x1b41('0x2c')][_0x1b41('0x31')]));_0x19f91e['attributes']=_0x19f91e[_0x1b41('0x32')][_0x1b41('0x33')]?_0x19f91e[_0x1b41('0x32')]:_0x38a5a0[_0x1b41('0x30')];if(!_0x27bb60[_0x1b41('0x2c')]['hasOwnProperty']('nolimit')){_0x19f91e[_0x1b41('0x1a')]=qs[_0x1b41('0x1a')](_0x27bb60[_0x1b41('0x2c')]['limit']);_0x19f91e[_0x1b41('0x18')]=qs[_0x1b41('0x18')](_0x27bb60[_0x1b41('0x2c')][_0x1b41('0x18')]);}_0x19f91e[_0x1b41('0x34')]=qs[_0x1b41('0x35')](_0x27bb60[_0x1b41('0x2c')][_0x1b41('0x35')]);_0x19f91e['where']=qs[_0x1b41('0x2e')](_['pick'](_0x27bb60[_0x1b41('0x2c')],_0x38a5a0[_0x1b41('0x2e')]),_0x246b37);if(_0x27bb60['query'][_0x1b41('0x36')]){_0x19f91e[_0x1b41('0x37')]=_[_0x1b41('0x38')](_0x19f91e[_0x1b41('0x37')],{'$or':_[_0x1b41('0x27')](_0x246b37,function(_0x3562ac){if(_0x3562ac['type']!=='VIRTUAL'){var _0x14000e={};_0x14000e[_0x3562ac['name']]={'$like':'%'+_0x27bb60[_0x1b41('0x2c')][_0x1b41('0x36')]+'%'};return _0x14000e;}})});}_0x19f91e=_[_0x1b41('0x38')]({},_0x19f91e,_0x27bb60[_0x1b41('0x39')]);var _0x5d36cc={'where':_0x19f91e[_0x1b41('0x37')]};return db[_0x1b41('0x28')][_0x1b41('0x1b')](_0x5d36cc)[_0x1b41('0x20')](function(_0xc2f847){_0x5679f0[_0x1b41('0x1b')]=_0xc2f847;if(_0x27bb60['query'][_0x1b41('0x3a')]){_0x19f91e[_0x1b41('0x3b')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x1b41('0x3c')](_0x19f91e);})[_0x1b41('0x20')](function(_0x562194){_0x5679f0[_0x1b41('0x3d')]=_0x562194;return _0x5679f0;})[_0x1b41('0x20')](respondWithFilteredResult(_0x112b4d,_0x19f91e))['catch'](handleError(_0x112b4d,null));};exports['show']=function(_0x230e8d,_0x1a6e50){var _0x3da44e={'raw':![],'where':{'id':_0x230e8d[_0x1b41('0x3e')]['id']}},_0x2d4669={};_0x2d4669[_0x1b41('0x30')]=_[_0x1b41('0x2d')](db[_0x1b41('0x28')][_0x1b41('0x29')]);_0x2d4669[_0x1b41('0x2c')]=_[_0x1b41('0x2d')](_0x230e8d[_0x1b41('0x2c')]);_0x2d4669[_0x1b41('0x2e')]=_[_0x1b41('0x2f')](_0x2d4669[_0x1b41('0x30')],_0x2d4669['query']);_0x3da44e[_0x1b41('0x32')]=_[_0x1b41('0x2f')](_0x2d4669[_0x1b41('0x30')],qs[_0x1b41('0x31')](_0x230e8d[_0x1b41('0x2c')][_0x1b41('0x31')]));_0x3da44e[_0x1b41('0x32')]=_0x3da44e[_0x1b41('0x32')][_0x1b41('0x33')]?_0x3da44e['attributes']:_0x2d4669[_0x1b41('0x30')];if(_0x230e8d['query']['includeAll']){_0x3da44e[_0x1b41('0x3b')]=[{'all':!![]}];}_0x3da44e=_['merge']({},_0x3da44e,_0x230e8d[_0x1b41('0x39')]);return db[_0x1b41('0x28')][_0x1b41('0x3f')](_0x3da44e)[_0x1b41('0x20')](handleEntityNotFound(_0x1a6e50,null))[_0x1b41('0x20')](respondWithResult(_0x1a6e50,null))[_0x1b41('0x40')](handleError(_0x1a6e50,null));};exports[_0x1b41('0x41')]=function(_0x42fe62,_0x430414){return db['AnalyticFieldReport'][_0x1b41('0x41')](_0x42fe62[_0x1b41('0x42')],{})[_0x1b41('0x20')](respondWithResult(_0x430414,0xc9))[_0x1b41('0x40')](handleError(_0x430414,null));};exports[_0x1b41('0x43')]=function(_0x109827,_0x29d725){return db[_0x1b41('0x28')][_0x1b41('0x43')](_0x109827[_0x1b41('0x42')],{'raw':![],'individualHooks':!![]})[_0x1b41('0x20')](respondWithResult(_0x29d725,0xc9))['catch'](handleError(_0x29d725,null));};exports[_0x1b41('0x1f')]=function(_0x3b053b,_0x3778d6){if(_0x3b053b[_0x1b41('0x42')]['id']){delete _0x3b053b[_0x1b41('0x42')]['id'];}return db[_0x1b41('0x28')][_0x1b41('0x3f')]({'where':{'id':_0x3b053b[_0x1b41('0x3e')]['id']}})[_0x1b41('0x20')](handleEntityNotFound(_0x3778d6,null))['then'](saveUpdates(_0x3b053b[_0x1b41('0x42')],null))[_0x1b41('0x20')](respondWithResult(_0x3778d6,null))['catch'](handleError(_0x3778d6,null));};exports['destroy']=function(_0x29939e,_0x1cee98){return db['AnalyticFieldReport'][_0x1b41('0x3f')]({'where':{'id':_0x29939e['params']['id']}})[_0x1b41('0x20')](handleEntityNotFound(_0x1cee98,null))[_0x1b41('0x20')](removeEntity(_0x1cee98,null))[_0x1b41('0x40')](handleError(_0x1cee98,null));};exports[_0x1b41('0x44')]=function(_0x7cb64,_0x350244){return db[_0x1b41('0x28')][_0x1b41('0x21')]({'where':{'id':_0x7cb64[_0x1b41('0x2c')][_0x1b41('0x45')]||[]},'raw':![],'individualHooks':!![]})[_0x1b41('0x20')](respondWithResult(_0x350244,0xcc))[_0x1b41('0x40')](handleError(_0x350244,null));};exports['addFields']=function(_0x2c51aa,_0x3e0f3e,_0x2d6705){return db[_0x1b41('0x46')]['findOne']({'where':{'id':_0x2c51aa[_0x1b41('0x3e')]['id']}})[_0x1b41('0x20')](handleEntityNotFound(_0x3e0f3e,null))[_0x1b41('0x20')](function(_0xbdf3eb){if(_0xbdf3eb){return db[_0x1b41('0x47')][_0x1b41('0x48')](function(_0x216dd){return db['AnalyticFieldReport'][_0x1b41('0x21')]({'where':{'CustomReportId':_0x2c51aa[_0x1b41('0x3e')]['id']},'transaction':_0x216dd})[_0x1b41('0x20')](function(_0x4ab287){var _0x25fb26=_[_0x1b41('0x27')](_0x2c51aa[_0x1b41('0x42')],function(_0x38412c){delete _0x38412c['id'];_0x38412c[_0x1b41('0x49')]=_0x2c51aa['params']['id'];return _0x38412c;});return db[_0x1b41('0x28')][_0x1b41('0x43')](_0x25fb26,{'transaction':_0x216dd});});})[_0x1b41('0x20')](function(){return db['AnalyticFieldReport'][_0x1b41('0x3c')]({'where':{'CustomReportId':_0x2c51aa[_0x1b41('0x3e')]['id']}});});}})['then'](respondWithResult(_0x3e0f3e,null))[_0x1b41('0x40')](handleError(_0x3e0f3e,null));}; \ No newline at end of file +var _0xd6a7=['undefined','limit','count','set','apply','reject','save','update','destroy','error','name','send','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','options','then','include','show','params','keys','merge','find','catch','create','bulkCreate','body','bulkDestroy','ids','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x4583d0,_0x24551f){var _0x7b3c5a=function(_0x14946a){while(--_0x14946a){_0x4583d0['push'](_0x4583d0['shift']());}};_0x7b3c5a(++_0x24551f);}(_0xd6a7,0x11f));var _0x7d6a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd6a7[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x7d6a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7d6a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7d6a('0x2'));var moment=require('moment');var BPromise=require(_0x7d6a('0x3'));var Mustache=require(_0x7d6a('0x4'));var util=require(_0x7d6a('0x5'));var path=require(_0x7d6a('0x6'));var sox=require(_0x7d6a('0x7'));var csv=require(_0x7d6a('0x8'));var ejs=require(_0x7d6a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7d6a('0xa'));var squel=require(_0x7d6a('0xb'));var crypto=require('crypto');var jsforce=require(_0x7d6a('0xc'));var deskjs=require(_0x7d6a('0xd'));var toCsv=require(_0x7d6a('0x8'));var querystring=require('querystring');var Papa=require(_0x7d6a('0xe'));var Redis=require('ioredis');var authService=require(_0x7d6a('0xf'));var qs=require(_0x7d6a('0x10'));var as=require(_0x7d6a('0x11'));var hardwareService=require(_0x7d6a('0x12'));var logger=require(_0x7d6a('0x13'))(_0x7d6a('0x14'));var utils=require(_0x7d6a('0x15'));var config=require(_0x7d6a('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7d6a('0x17'))['db'];function respondWithStatusCode(_0x58ab9e,_0x135cf7){_0x135cf7=_0x135cf7||0xcc;return function(_0x2bae7b){if(_0x2bae7b){return _0x58ab9e[_0x7d6a('0x18')](_0x135cf7);}return _0x58ab9e[_0x7d6a('0x19')](_0x135cf7)[_0x7d6a('0x1a')]();};}function respondWithResult(_0x442e20,_0x882d0d){_0x882d0d=_0x882d0d||0xc8;return function(_0x5a73dd){if(_0x5a73dd){return _0x442e20[_0x7d6a('0x19')](_0x882d0d)[_0x7d6a('0x1b')](_0x5a73dd);}};}function respondWithFilteredResult(_0x4db851,_0x59d158){return function(_0xc9fa53){if(_0xc9fa53){var _0x281e90=typeof _0x59d158[_0x7d6a('0x1c')]===_0x7d6a('0x1d')&&typeof _0x59d158[_0x7d6a('0x1e')]===_0x7d6a('0x1d');var _0x1f591e=_0xc9fa53[_0x7d6a('0x1f')];var _0x135a0c=_0x281e90?0x0:_0x59d158[_0x7d6a('0x1c')];var _0x28455f=_0x281e90?_0xc9fa53[_0x7d6a('0x1f')]:_0x59d158[_0x7d6a('0x1c')]+_0x59d158[_0x7d6a('0x1e')];var _0x1e3b12;if(_0x28455f>=_0x1f591e){_0x28455f=_0x1f591e;_0x1e3b12=0xc8;}else{_0x1e3b12=0xce;}_0x4db851[_0x7d6a('0x19')](_0x1e3b12);return _0x4db851[_0x7d6a('0x20')]('Content-Range',_0x135a0c+'-'+_0x28455f+'/'+_0x1f591e)[_0x7d6a('0x1b')](_0xc9fa53);}return null;};}function patchUpdates(_0xbbe6ce){return function(_0x34b523){try{jsonpatch[_0x7d6a('0x21')](_0x34b523,_0xbbe6ce,!![]);}catch(_0xa0753b){return BPromise[_0x7d6a('0x22')](_0xa0753b);}return _0x34b523[_0x7d6a('0x23')]();};}function saveUpdates(_0x54f126,_0x4bfd79){return function(_0x3e35ee){if(_0x3e35ee){return _0x3e35ee[_0x7d6a('0x24')](_0x54f126)['then'](function(_0x4c6db3){return _0x4c6db3;});}return null;};}function removeEntity(_0x53f946,_0x376281){return function(_0x3af0e0){if(_0x3af0e0){return _0x3af0e0[_0x7d6a('0x25')]()['then'](function(){_0x53f946[_0x7d6a('0x19')](0xcc)[_0x7d6a('0x1a')]();});}};}function handleEntityNotFound(_0x50f626,_0x51bddd){return function(_0x40425a){if(!_0x40425a){_0x50f626[_0x7d6a('0x18')](0x194);}return _0x40425a;};}function handleError(_0x1e1fa3,_0xe8dd2e){_0xe8dd2e=_0xe8dd2e||0x1f4;return function(_0x58f9a2){logger[_0x7d6a('0x26')](_0x58f9a2['stack']);if(_0x58f9a2[_0x7d6a('0x27')]){delete _0x58f9a2[_0x7d6a('0x27')];}_0x1e1fa3[_0x7d6a('0x19')](_0xe8dd2e)[_0x7d6a('0x28')](_0x58f9a2);};}exports['index']=function(_0x4d55ec,_0x6b4a9f){var _0x3b3963={},_0x4352e4={},_0x37997a={'count':0x0,'rows':[]};var _0x10a147=_['map'](db[_0x7d6a('0x29')][_0x7d6a('0x2a')],function(_0xf94ad){return{'name':_0xf94ad[_0x7d6a('0x2b')],'type':_0xf94ad[_0x7d6a('0x2c')][_0x7d6a('0x2d')]};});_0x4352e4[_0x7d6a('0x2e')]=_[_0x7d6a('0x2f')](_0x10a147,_0x7d6a('0x27'));_0x4352e4[_0x7d6a('0x30')]=_['keys'](_0x4d55ec['query']);_0x4352e4['filters']=_[_0x7d6a('0x31')](_0x4352e4[_0x7d6a('0x2e')],_0x4352e4[_0x7d6a('0x30')]);_0x3b3963[_0x7d6a('0x32')]=_[_0x7d6a('0x31')](_0x4352e4[_0x7d6a('0x2e')],qs[_0x7d6a('0x33')](_0x4d55ec[_0x7d6a('0x30')][_0x7d6a('0x33')]));_0x3b3963['attributes']=_0x3b3963[_0x7d6a('0x32')][_0x7d6a('0x34')]?_0x3b3963[_0x7d6a('0x32')]:_0x4352e4[_0x7d6a('0x2e')];if(!_0x4d55ec[_0x7d6a('0x30')][_0x7d6a('0x35')](_0x7d6a('0x36'))){_0x3b3963[_0x7d6a('0x1e')]=qs[_0x7d6a('0x1e')](_0x4d55ec[_0x7d6a('0x30')][_0x7d6a('0x1e')]);_0x3b3963[_0x7d6a('0x1c')]=qs[_0x7d6a('0x1c')](_0x4d55ec['query'][_0x7d6a('0x1c')]);}_0x3b3963[_0x7d6a('0x37')]=qs[_0x7d6a('0x38')](_0x4d55ec[_0x7d6a('0x30')][_0x7d6a('0x38')]);_0x3b3963[_0x7d6a('0x39')]=qs[_0x7d6a('0x3a')](_['pick'](_0x4d55ec[_0x7d6a('0x30')],_0x4352e4[_0x7d6a('0x3a')]),_0x10a147);if(_0x4d55ec[_0x7d6a('0x30')][_0x7d6a('0x3b')]){_0x3b3963[_0x7d6a('0x39')]=_['merge'](_0x3b3963[_0x7d6a('0x39')],{'$or':_[_0x7d6a('0x2f')](_0x10a147,function(_0x44e23a){if(_0x44e23a[_0x7d6a('0x2c')]!=='VIRTUAL'){var _0x1044da={};_0x1044da[_0x44e23a['name']]={'$like':'%'+_0x4d55ec[_0x7d6a('0x30')][_0x7d6a('0x3b')]+'%'};return _0x1044da;}})});}_0x3b3963=_['merge']({},_0x3b3963,_0x4d55ec[_0x7d6a('0x3c')]);var _0x564e30={'where':_0x3b3963[_0x7d6a('0x39')]};return db[_0x7d6a('0x29')]['count'](_0x564e30)[_0x7d6a('0x3d')](function(_0x20e368){_0x37997a[_0x7d6a('0x1f')]=_0x20e368;if(_0x4d55ec['query']['includeAll']){_0x3b3963[_0x7d6a('0x3e')]=[{'all':!![]}];}return db[_0x7d6a('0x29')]['findAll'](_0x3b3963);})[_0x7d6a('0x3d')](function(_0x4feaed){_0x37997a['rows']=_0x4feaed;return _0x37997a;})[_0x7d6a('0x3d')](respondWithFilteredResult(_0x6b4a9f,_0x3b3963))['catch'](handleError(_0x6b4a9f,null));};exports[_0x7d6a('0x3f')]=function(_0x541a38,_0x37ee38){var _0x38febc={'raw':![],'where':{'id':_0x541a38[_0x7d6a('0x40')]['id']}},_0x5d21a8={};_0x5d21a8['model']=_[_0x7d6a('0x41')](db[_0x7d6a('0x29')][_0x7d6a('0x2a')]);_0x5d21a8[_0x7d6a('0x30')]=_[_0x7d6a('0x41')](_0x541a38['query']);_0x5d21a8[_0x7d6a('0x3a')]=_[_0x7d6a('0x31')](_0x5d21a8[_0x7d6a('0x2e')],_0x5d21a8[_0x7d6a('0x30')]);_0x38febc['attributes']=_[_0x7d6a('0x31')](_0x5d21a8['model'],qs[_0x7d6a('0x33')](_0x541a38[_0x7d6a('0x30')][_0x7d6a('0x33')]));_0x38febc[_0x7d6a('0x32')]=_0x38febc[_0x7d6a('0x32')][_0x7d6a('0x34')]?_0x38febc[_0x7d6a('0x32')]:_0x5d21a8[_0x7d6a('0x2e')];if(_0x541a38[_0x7d6a('0x30')]['includeAll']){_0x38febc[_0x7d6a('0x3e')]=[{'all':!![]}];}_0x38febc=_[_0x7d6a('0x42')]({},_0x38febc,_0x541a38[_0x7d6a('0x3c')]);return db[_0x7d6a('0x29')][_0x7d6a('0x43')](_0x38febc)[_0x7d6a('0x3d')](handleEntityNotFound(_0x37ee38,null))[_0x7d6a('0x3d')](respondWithResult(_0x37ee38,null))[_0x7d6a('0x44')](handleError(_0x37ee38,null));};exports[_0x7d6a('0x45')]=function(_0x5d3fd1,_0x40a482){return db[_0x7d6a('0x29')][_0x7d6a('0x45')](_0x5d3fd1['body'],{})[_0x7d6a('0x3d')](respondWithResult(_0x40a482,0xc9))['catch'](handleError(_0x40a482,null));};exports[_0x7d6a('0x46')]=function(_0x484e64,_0x1fd0d0){return db['AnalyticFieldReport']['bulkCreate'](_0x484e64[_0x7d6a('0x47')],{'raw':![],'individualHooks':!![]})[_0x7d6a('0x3d')](respondWithResult(_0x1fd0d0,0xc9))[_0x7d6a('0x44')](handleError(_0x1fd0d0,null));};exports[_0x7d6a('0x24')]=function(_0x111c46,_0x1cf51f){if(_0x111c46[_0x7d6a('0x47')]['id']){delete _0x111c46[_0x7d6a('0x47')]['id'];}return db['AnalyticFieldReport'][_0x7d6a('0x43')]({'where':{'id':_0x111c46[_0x7d6a('0x40')]['id']}})[_0x7d6a('0x3d')](handleEntityNotFound(_0x1cf51f,null))[_0x7d6a('0x3d')](saveUpdates(_0x111c46[_0x7d6a('0x47')],null))['then'](respondWithResult(_0x1cf51f,null))[_0x7d6a('0x44')](handleError(_0x1cf51f,null));};exports[_0x7d6a('0x25')]=function(_0x535947,_0x4aecaf){return db[_0x7d6a('0x29')][_0x7d6a('0x43')]({'where':{'id':_0x535947['params']['id']}})[_0x7d6a('0x3d')](handleEntityNotFound(_0x4aecaf,null))['then'](removeEntity(_0x4aecaf,null))['catch'](handleError(_0x4aecaf,null));};exports[_0x7d6a('0x48')]=function(_0x1fad46,_0x1c82d9){return db[_0x7d6a('0x29')][_0x7d6a('0x25')]({'where':{'id':_0x1fad46['query'][_0x7d6a('0x49')]||[]},'raw':![],'individualHooks':!![]})[_0x7d6a('0x3d')](respondWithResult(_0x1c82d9,0xcc))[_0x7d6a('0x44')](handleError(_0x1c82d9,null));};exports['addFields']=function(_0x2e822d,_0x95e732,_0x223cea){return db[_0x7d6a('0x4a')][_0x7d6a('0x4b')]({'where':{'id':_0x2e822d[_0x7d6a('0x40')]['id']}})[_0x7d6a('0x3d')](handleEntityNotFound(_0x95e732,null))['then'](function(_0x3c0425){if(_0x3c0425){return db[_0x7d6a('0x4c')][_0x7d6a('0x4d')](function(_0x184244){return db[_0x7d6a('0x29')][_0x7d6a('0x25')]({'where':{'CustomReportId':_0x2e822d[_0x7d6a('0x40')]['id']},'transaction':_0x184244})[_0x7d6a('0x3d')](function(_0x511135){var _0x45aee5=_[_0x7d6a('0x2f')](_0x2e822d[_0x7d6a('0x47')],function(_0x52ef2e){delete _0x52ef2e['id'];_0x52ef2e[_0x7d6a('0x4e')]=_0x2e822d[_0x7d6a('0x40')]['id'];return _0x52ef2e;});return db[_0x7d6a('0x29')][_0x7d6a('0x46')](_0x45aee5,{'transaction':_0x184244});});})['then'](function(){return db[_0x7d6a('0x29')]['findAll']({'where':{'CustomReportId':_0x2e822d['params']['id']}});});}})[_0x7d6a('0x3d')](respondWithResult(_0x95e732,null))['catch'](handleError(_0x95e732,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index d2f5dc6..2066901 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 _0x5a61=['moment','request-promise','../../config/environment','./analyticFieldReport.attributes','exports','AnalyticFieldReport','analytics_report_fields','lodash','../../config/logger','api'];(function(_0x6bc1b,_0x4ec014){var _0x18d074=function(_0x427299){while(--_0x427299){_0x6bc1b['push'](_0x6bc1b['shift']());}};_0x18d074(++_0x4ec014);}(_0x5a61,0xd9));var _0x15a6=function(_0x55018a,_0x4b5296){_0x55018a=_0x55018a-0x0;var _0x2d1dea=_0x5a61[_0x55018a];return _0x2d1dea;};'use strict';var _=require(_0x15a6('0x0'));var util=require('util');var logger=require(_0x15a6('0x1'))(_0x15a6('0x2'));var moment=require(_0x15a6('0x3'));var BPromise=require('bluebird');var rp=require(_0x15a6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x15a6('0x5'));var attributes=require(_0x15a6('0x6'));module[_0x15a6('0x7')]=function(_0x23b689,_0x20bf55){return _0x23b689['define'](_0x15a6('0x8'),attributes,{'tableName':_0x15a6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x4e5552,_0x19ec4e){var _0x60a338=function(_0x40c70e){while(--_0x40c70e){_0x4e5552['push'](_0x4e5552['shift']());}};_0x60a338(++_0x19ec4e);}(_0xe706,0x1c6));var _0x6e70=function(_0xef66ed,_0x1a5239){_0xef66ed=_0xef66ed-0x0;var _0xa14f66=_0xe706[_0xef66ed];return _0xa14f66;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x462287,_0x393afd){return _0x462287[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('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 535919a..3b15179 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 _0xa879=['AnalyticFieldReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xa65bc3,_0x2bd50c){var _0x1ab82c=function(_0x4dc6a4){while(--_0x4dc6a4){_0xa65bc3['push'](_0xa65bc3['shift']());}};_0x1ab82c(++_0x2bd50c);}(_0xa879,0xea));var _0x9a87=function(_0x183060,_0x319d29){_0x183060=_0x183060-0x0;var _0x552b8b=_0xa879[_0x183060];return _0x552b8b;};'use strict';var _=require(_0x9a87('0x0'));var util=require('util');var moment=require(_0x9a87('0x1'));var BPromise=require(_0x9a87('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9a87('0x3'));var db=require(_0x9a87('0x4'))['db'];var utils=require(_0x9a87('0x5'));var logger=require(_0x9a87('0x6'))(_0x9a87('0x7'));var config=require(_0x9a87('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9a87('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf6e779,_0xb44406,_0x207f6d){return new BPromise(function(_0x572a53,_0x846304){return client[_0x9a87('0xa')](_0xf6e779,_0x207f6d)[_0x9a87('0xb')](function(_0x2f2550){logger[_0x9a87('0xc')]('AnalyticFieldReport,\x20%s,\x20%s',_0xb44406,_0x9a87('0xd'));logger[_0x9a87('0xe')](_0x9a87('0xf'),_0xb44406,'request\x20sent',JSON[_0x9a87('0x10')](_0x2f2550));if(_0x2f2550[_0x9a87('0x11')]){if(_0x2f2550['error'][_0x9a87('0x12')]===0x1f4){logger[_0x9a87('0x11')](_0x9a87('0x13'),_0xb44406,_0x2f2550['error'][_0x9a87('0x14')]);return _0x846304(_0x2f2550[_0x9a87('0x11')][_0x9a87('0x14')]);}logger[_0x9a87('0x11')](_0x9a87('0x13'),_0xb44406,_0x2f2550[_0x9a87('0x11')]['message']);return _0x572a53(_0x2f2550[_0x9a87('0x11')]['message']);}else{logger[_0x9a87('0xc')]('AnalyticFieldReport,\x20%s,\x20%s',_0xb44406,'request\x20sent');_0x572a53(_0x2f2550[_0x9a87('0x15')][_0x9a87('0x14')]);}})[_0x9a87('0x16')](function(_0x53e9bf){logger['error'](_0x9a87('0x13'),_0xb44406,_0x53e9bf);_0x846304(_0x53e9bf);});});} \ No newline at end of file +var _0x07e2=['request','info','AnalyticFieldReport,\x20%s,\x20%s','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x187d1f,_0x2c09c2){var _0x3556e5=function(_0x5d9095){while(--_0x5d9095){_0x187d1f['push'](_0x187d1f['shift']());}};_0x3556e5(++_0x2c09c2);}(_0x07e2,0x131));var _0x207e=function(_0x381781,_0x35257f){_0x381781=_0x381781-0x0;var _0x540ba0=_0x07e2[_0x381781];return _0x540ba0;};'use strict';var _=require('lodash');var util=require(_0x207e('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x207e('0x1'));var fs=require('fs');var Redis=require(_0x207e('0x2'));var db=require(_0x207e('0x3'))['db'];var utils=require(_0x207e('0x4'));var logger=require(_0x207e('0x5'))(_0x207e('0x6'));var config=require(_0x207e('0x7'));var jayson=require(_0x207e('0x8'));var client=jayson[_0x207e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ab7ee,_0x5b1b58,_0x3305fa){return new BPromise(function(_0x4e20ac,_0x196a6b){return client[_0x207e('0xa')](_0x2ab7ee,_0x3305fa)['then'](function(_0x5e9eae){logger[_0x207e('0xb')](_0x207e('0xc'),_0x5b1b58,'request\x20sent');logger['debug'](_0x207e('0xd'),_0x5b1b58,'request\x20sent',JSON[_0x207e('0xe')](_0x5e9eae));if(_0x5e9eae[_0x207e('0xf')]){if(_0x5e9eae['error'][_0x207e('0x10')]===0x1f4){logger[_0x207e('0xf')](_0x207e('0xc'),_0x5b1b58,_0x5e9eae[_0x207e('0xf')][_0x207e('0x11')]);return _0x196a6b(_0x5e9eae[_0x207e('0xf')][_0x207e('0x11')]);}logger[_0x207e('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x5b1b58,_0x5e9eae['error'][_0x207e('0x11')]);return _0x4e20ac(_0x5e9eae[_0x207e('0xf')][_0x207e('0x11')]);}else{logger['info'](_0x207e('0xc'),_0x5b1b58,_0x207e('0x12'));_0x4e20ac(_0x5e9eae[_0x207e('0x13')]['message']);}})[_0x207e('0x14')](function(_0x108281){logger[_0x207e('0xf')](_0x207e('0xc'),_0x5b1b58,_0x108281);_0x196a6b(_0x108281);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 36307cf..3e4322f 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(_0xac15c3,_0x2451ea){var _0x3ef3db=function(_0x361906){while(--_0x361906){_0xac15c3['push'](_0xac15c3['shift']());}};_0x3ef3db(++_0x2451ea);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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(_0x2c10d1,_0x9a1e2b){var _0x119b4a=function(_0xcee1a5){while(--_0xcee1a5){_0x2c10d1['push'](_0x2c10d1['shift']());}};_0x119b4a(++_0x9a1e2b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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 29798ce..2b827da 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 _0x84a0=['name','TEXT','sequelize','exports','STRING'];(function(_0x25e293,_0x329321){var _0x294981=function(_0x1320e7){while(--_0x1320e7){_0x25e293['push'](_0x25e293['shift']());}};_0x294981(++_0x329321);}(_0x84a0,0x66));var _0x084a=function(_0x543a43,_0x27240f){_0x543a43=_0x543a43-0x0;var _0x40fbb4=_0x84a0[_0x543a43];return _0x40fbb4;};'use strict';var Sequelize=require(_0x084a('0x0'));module[_0x084a('0x1')]={'name':{'type':Sequelize[_0x084a('0x2')],'allowNull':![],'unique':_0x084a('0x3')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x084a('0x4')]},'description':{'type':Sequelize[_0x084a('0x2')]}}; \ No newline at end of file +var _0xb98f=['STRING','name','sequelize','exports'];(function(_0x330db1,_0x35fc39){var _0xe113f4=function(_0x422608){while(--_0x422608){_0x330db1['push'](_0x330db1['shift']());}};_0xe113f4(++_0x35fc39);}(_0xb98f,0xce));var _0xfb98=function(_0x2790cf,_0x3f8b07){_0x2790cf=_0x2790cf-0x0;var _0xc19833=_0xb98f[_0x2790cf];return _0xc19833;};'use strict';var Sequelize=require(_0xfb98('0x0'));module[_0xfb98('0x1')]={'name':{'type':Sequelize[_0xfb98('0x2')],'allowNull':![],'unique':_0xfb98('0x3')},'table':{'type':Sequelize[_0xfb98('0x2')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index bec88c0..787601f 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 _0xdc97=['mustache','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','update','then','get','destroy','sendStatus','error','stack','name','send','AnalyticMetric','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','length','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','findAll','rows','catch','params','keys','fields','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Metrics','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','zip-dir','request-promise','bluebird'];(function(_0x4d6d91,_0x427352){var _0x3bf046=function(_0x5b9812){while(--_0x5b9812){_0x4d6d91['push'](_0x4d6d91['shift']());}};_0x3bf046(++_0x427352);}(_0xdc97,0x13b));var _0x7dc9=function(_0x5cddc4,_0x394b2f){_0x5cddc4=_0x5cddc4-0x0;var _0x22e2bb=_0xdc97[_0x5cddc4];return _0x22e2bb;};'use strict';var emlformat=require(_0x7dc9('0x0'));var rimraf=require(_0x7dc9('0x1'));var zipdir=require(_0x7dc9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7dc9('0x3'));var moment=require('moment');var BPromise=require(_0x7dc9('0x4'));var Mustache=require(_0x7dc9('0x5'));var util=require('util');var path=require(_0x7dc9('0x6'));var sox=require(_0x7dc9('0x7'));var csv=require(_0x7dc9('0x8'));var ejs=require(_0x7dc9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7dc9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7dc9('0xb'));var deskjs=require(_0x7dc9('0xc'));var toCsv=require(_0x7dc9('0x8'));var querystring=require(_0x7dc9('0xd'));var Papa=require(_0x7dc9('0xe'));var Redis=require('ioredis');var authService=require(_0x7dc9('0xf'));var qs=require(_0x7dc9('0x10'));var as=require(_0x7dc9('0x11'));var hardwareService=require(_0x7dc9('0x12'));var logger=require(_0x7dc9('0x13'))(_0x7dc9('0x14'));var utils=require(_0x7dc9('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x599ef1,_0x94c75a){_0x94c75a=_0x94c75a||0xcc;return function(_0x14e5db){if(_0x14e5db){return _0x599ef1['sendStatus'](_0x94c75a);}return _0x599ef1[_0x7dc9('0x16')](_0x94c75a)[_0x7dc9('0x17')]();};}function respondWithResult(_0xaadf2,_0xf37bc7){_0xf37bc7=_0xf37bc7||0xc8;return function(_0x31d43d){if(_0x31d43d){return _0xaadf2[_0x7dc9('0x16')](_0xf37bc7)['json'](_0x31d43d);}};}function respondWithFilteredResult(_0x3a54f2,_0x278191){return function(_0x1b0aa1){if(_0x1b0aa1){var _0x442819=typeof _0x278191[_0x7dc9('0x18')]===_0x7dc9('0x19')&&typeof _0x278191[_0x7dc9('0x1a')]===_0x7dc9('0x19');var _0x4778d5=_0x1b0aa1['count'];var _0x22577e=_0x442819?0x0:_0x278191['offset'];var _0x1f5906=_0x442819?_0x1b0aa1[_0x7dc9('0x1b')]:_0x278191['offset']+_0x278191[_0x7dc9('0x1a')];var _0x3b738a;if(_0x1f5906>=_0x4778d5){_0x1f5906=_0x4778d5;_0x3b738a=0xc8;}else{_0x3b738a=0xce;}_0x3a54f2[_0x7dc9('0x16')](_0x3b738a);return _0x3a54f2[_0x7dc9('0x1c')](_0x7dc9('0x1d'),_0x22577e+'-'+_0x1f5906+'/'+_0x4778d5)[_0x7dc9('0x1e')](_0x1b0aa1);}return null;};}function patchUpdates(_0x2dad65){return function(_0x2895f5){try{jsonpatch[_0x7dc9('0x1f')](_0x2895f5,_0x2dad65,!![]);}catch(_0x2b38d6){return BPromise['reject'](_0x2b38d6);}return _0x2895f5['save']();};}function saveUpdates(_0x12954f,_0x5981e2){return function(_0x596e0f){if(_0x596e0f){return _0x596e0f[_0x7dc9('0x20')](_0x12954f)[_0x7dc9('0x21')](function(_0x5e9525){return _0x5e9525;});}return null;};}function removeEntity(_0xffc080,_0x43d31f){return function(_0x41110a){if(_0x41110a){return _0x41110a['destroy']()[_0x7dc9('0x21')](function(){var _0x1e3a8d=_0x41110a[_0x7dc9('0x22')]({'plain':!![]});var _0x55a482='Metrics';return db['UserProfileResource'][_0x7dc9('0x23')]({'where':{'type':_0x55a482,'resourceId':_0x1e3a8d['id']}})[_0x7dc9('0x21')](function(){return _0x41110a;});})['then'](function(){_0xffc080['status'](0xcc)[_0x7dc9('0x17')]();});}};}function handleEntityNotFound(_0x5afb7d,_0x2d22eb){return function(_0x1c690b){if(!_0x1c690b){_0x5afb7d[_0x7dc9('0x24')](0x194);}return _0x1c690b;};}function handleError(_0x3e4102,_0xa2aaa9){_0xa2aaa9=_0xa2aaa9||0x1f4;return function(_0x450124){logger[_0x7dc9('0x25')](_0x450124[_0x7dc9('0x26')]);if(_0x450124[_0x7dc9('0x27')]){delete _0x450124[_0x7dc9('0x27')];}_0x3e4102[_0x7dc9('0x16')](_0xa2aaa9)[_0x7dc9('0x28')](_0x450124);};}exports['index']=function(_0x4e929c,_0x513dd6){var _0x49a4a5={},_0x4a68f0={},_0x553a03={'count':0x0,'rows':[]};var _0x58c4e8=_['map'](db[_0x7dc9('0x29')][_0x7dc9('0x2a')],function(_0x29dcef){return{'name':_0x29dcef[_0x7dc9('0x2b')],'type':_0x29dcef[_0x7dc9('0x2c')][_0x7dc9('0x2d')]};});_0x4a68f0['model']=_['map'](_0x58c4e8,'name');_0x4a68f0[_0x7dc9('0x2e')]=_['keys'](_0x4e929c[_0x7dc9('0x2e')]);_0x4a68f0[_0x7dc9('0x2f')]=_[_0x7dc9('0x30')](_0x4a68f0[_0x7dc9('0x31')],_0x4a68f0[_0x7dc9('0x2e')]);_0x49a4a5[_0x7dc9('0x32')]=_[_0x7dc9('0x30')](_0x4a68f0[_0x7dc9('0x31')],qs['fields'](_0x4e929c[_0x7dc9('0x2e')]['fields']));_0x49a4a5[_0x7dc9('0x32')]=_0x49a4a5[_0x7dc9('0x32')][_0x7dc9('0x33')]?_0x49a4a5[_0x7dc9('0x32')]:_0x4a68f0['model'];if(!_0x4e929c[_0x7dc9('0x2e')]['hasOwnProperty'](_0x7dc9('0x34'))){_0x49a4a5['limit']=qs['limit'](_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x1a')]);_0x49a4a5[_0x7dc9('0x18')]=qs[_0x7dc9('0x18')](_0x4e929c['query'][_0x7dc9('0x18')]);}_0x49a4a5[_0x7dc9('0x35')]=qs[_0x7dc9('0x36')](_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x36')]);_0x49a4a5[_0x7dc9('0x37')]=qs[_0x7dc9('0x2f')](_[_0x7dc9('0x38')](_0x4e929c[_0x7dc9('0x2e')],_0x4a68f0[_0x7dc9('0x2f')]),_0x58c4e8);if(_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x39')]){_0x49a4a5['where']=_[_0x7dc9('0x3a')](_0x49a4a5[_0x7dc9('0x37')],{'$or':_[_0x7dc9('0x3b')](_0x58c4e8,function(_0xfd2612){if(_0xfd2612['type']!==_0x7dc9('0x3c')){var _0x89db0e={};_0x89db0e[_0xfd2612[_0x7dc9('0x27')]]={'$like':'%'+_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x39')]+'%'};return _0x89db0e;}})});}_0x49a4a5=_[_0x7dc9('0x3a')]({},_0x49a4a5,_0x4e929c['options']);var _0x553230={'where':_0x49a4a5[_0x7dc9('0x37')]};return db[_0x7dc9('0x29')]['count'](_0x553230)[_0x7dc9('0x21')](function(_0x4a37ec){_0x553a03[_0x7dc9('0x1b')]=_0x4a37ec;if(_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x3d')]){_0x49a4a5['include']=[{'all':!![]}];}return db[_0x7dc9('0x29')][_0x7dc9('0x3e')](_0x49a4a5);})[_0x7dc9('0x21')](function(_0x95513c){_0x553a03[_0x7dc9('0x3f')]=_0x95513c;return _0x553a03;})[_0x7dc9('0x21')](respondWithFilteredResult(_0x513dd6,_0x49a4a5))[_0x7dc9('0x40')](handleError(_0x513dd6,null));};exports['show']=function(_0x187aa6,_0x4f29b2){var _0x52d883={'raw':!![],'where':{'id':_0x187aa6[_0x7dc9('0x41')]['id']}},_0xcced6c={};_0xcced6c[_0x7dc9('0x31')]=_[_0x7dc9('0x42')](db[_0x7dc9('0x29')][_0x7dc9('0x2a')]);_0xcced6c[_0x7dc9('0x2e')]=_[_0x7dc9('0x42')](_0x187aa6[_0x7dc9('0x2e')]);_0xcced6c['filters']=_[_0x7dc9('0x30')](_0xcced6c[_0x7dc9('0x31')],_0xcced6c[_0x7dc9('0x2e')]);_0x52d883[_0x7dc9('0x32')]=_[_0x7dc9('0x30')](_0xcced6c[_0x7dc9('0x31')],qs['fields'](_0x187aa6[_0x7dc9('0x2e')][_0x7dc9('0x43')]));_0x52d883['attributes']=_0x52d883[_0x7dc9('0x32')][_0x7dc9('0x33')]?_0x52d883[_0x7dc9('0x32')]:_0xcced6c['model'];if(_0x187aa6[_0x7dc9('0x2e')]['includeAll']){_0x52d883['include']=[{'all':!![]}];}_0x52d883=_[_0x7dc9('0x3a')]({},_0x52d883,_0x187aa6[_0x7dc9('0x44')]);return db[_0x7dc9('0x29')]['find'](_0x52d883)['then'](handleEntityNotFound(_0x4f29b2,null))[_0x7dc9('0x21')](respondWithResult(_0x4f29b2,null))['catch'](handleError(_0x4f29b2,null));};exports[_0x7dc9('0x45')]=function(_0x4ab558,_0x5e2d59){return db[_0x7dc9('0x29')][_0x7dc9('0x45')](_0x4ab558[_0x7dc9('0x46')],{})[_0x7dc9('0x21')](function(_0x414bf4){var _0x113087=_0x4ab558[_0x7dc9('0x47')][_0x7dc9('0x22')]({'plain':!![]});if(!_0x113087)throw new Error(_0x7dc9('0x48'));if(_0x113087[_0x7dc9('0x49')]===_0x7dc9('0x47')){var _0x13580b=_0x414bf4[_0x7dc9('0x22')]({'plain':!![]});var _0x59be9b=_0x7dc9('0x4a');return db['UserProfileSection']['find']({'where':{'name':_0x59be9b,'userProfileId':_0x113087[_0x7dc9('0x4b')]},'raw':!![]})[_0x7dc9('0x21')](function(_0x40e382){if(_0x40e382&&_0x40e382[_0x7dc9('0x4c')]===0x0){return db[_0x7dc9('0x4d')]['create']({'name':_0x13580b[_0x7dc9('0x27')],'resourceId':_0x13580b['id'],'type':_0x40e382[_0x7dc9('0x27')],'sectionId':_0x40e382['id']},{})[_0x7dc9('0x21')](function(){return _0x414bf4;});}else{return _0x414bf4;}})['catch'](function(_0x341909){logger[_0x7dc9('0x25')](_0x7dc9('0x4e'),_0x341909);throw _0x341909;});}return _0x414bf4;})[_0x7dc9('0x21')](respondWithResult(_0x5e2d59,0xc9))[_0x7dc9('0x40')](handleError(_0x5e2d59,null));};exports[_0x7dc9('0x20')]=function(_0x593132,_0x366b8b){if(_0x593132[_0x7dc9('0x46')]['id']){delete _0x593132[_0x7dc9('0x46')]['id'];}return db[_0x7dc9('0x29')][_0x7dc9('0x4f')]({'where':{'id':_0x593132[_0x7dc9('0x41')]['id']}})[_0x7dc9('0x21')](handleEntityNotFound(_0x366b8b,null))[_0x7dc9('0x21')](saveUpdates(_0x593132[_0x7dc9('0x46')],null))[_0x7dc9('0x21')](respondWithResult(_0x366b8b,null))[_0x7dc9('0x40')](handleError(_0x366b8b,null));};exports[_0x7dc9('0x23')]=function(_0x4fec6e,_0x1767b6){return db[_0x7dc9('0x29')][_0x7dc9('0x4f')]({'where':{'id':_0x4fec6e[_0x7dc9('0x41')]['id']}})[_0x7dc9('0x21')](handleEntityNotFound(_0x1767b6,null))['then'](removeEntity(_0x1767b6,null))[_0x7dc9('0x40')](handleError(_0x1767b6,null));}; \ No newline at end of file +var _0xe5b3=['undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','Metrics','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','type','keys','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','params','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','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'];(function(_0x3a2bb7,_0x4ebdce){var _0x4f5f21=function(_0x455d71){while(--_0x455d71){_0x3a2bb7['push'](_0x3a2bb7['shift']());}};_0x4f5f21(++_0x4ebdce);}(_0xe5b3,0x133));var _0x3e5b=function(_0x31b7d7,_0x3de9ed){_0x31b7d7=_0x31b7d7-0x0;var _0x3a376e=_0xe5b3[_0x31b7d7];return _0x3a376e;};'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(){var _0x36d960=_0x1eb80f['get']({'plain':!![]});var _0x41b684=_0x3e5b('0x28');return db[_0x3e5b('0x29')][_0x3e5b('0x2a')]({'where':{'type':_0x41b684,'resourceId':_0x36d960['id']}})[_0x3e5b('0x27')](function(){return _0x1eb80f;});})[_0x3e5b('0x27')](function(){_0x150674[_0x3e5b('0x1b')](0xcc)[_0x3e5b('0x1a')]();});}};}function handleEntityNotFound(_0x4c4b89,_0x1c7278){return function(_0x505f40){if(!_0x505f40){_0x4c4b89[_0x3e5b('0x19')](0x194);}return _0x505f40;};}function handleError(_0x4fd64b,_0x101653){_0x101653=_0x101653||0x1f4;return function(_0x1f6473){logger[_0x3e5b('0x2b')](_0x1f6473[_0x3e5b('0x2c')]);if(_0x1f6473[_0x3e5b('0x2d')]){delete _0x1f6473[_0x3e5b('0x2d')];}_0x4fd64b[_0x3e5b('0x1b')](_0x101653)[_0x3e5b('0x2e')](_0x1f6473);};}exports[_0x3e5b('0x2f')]=function(_0x112dc0,_0x1e1565){var _0x489221={},_0x21bc10={},_0x1882aa={'count':0x0,'rows':[]};var _0xa8760b=_[_0x3e5b('0x30')](db[_0x3e5b('0x31')][_0x3e5b('0x32')],function(_0x345927){return{'name':_0x345927['fieldName'],'type':_0x345927[_0x3e5b('0x33')]['key']};});_0x21bc10['model']=_[_0x3e5b('0x30')](_0xa8760b,_0x3e5b('0x2d'));_0x21bc10['query']=_[_0x3e5b('0x34')](_0x112dc0[_0x3e5b('0x35')]);_0x21bc10[_0x3e5b('0x36')]=_[_0x3e5b('0x37')](_0x21bc10[_0x3e5b('0x38')],_0x21bc10[_0x3e5b('0x35')]);_0x489221[_0x3e5b('0x39')]=_[_0x3e5b('0x37')](_0x21bc10[_0x3e5b('0x38')],qs[_0x3e5b('0x3a')](_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x3a')]));_0x489221['attributes']=_0x489221[_0x3e5b('0x39')][_0x3e5b('0x3b')]?_0x489221['attributes']:_0x21bc10['model'];if(!_0x112dc0[_0x3e5b('0x35')]['hasOwnProperty'](_0x3e5b('0x3c'))){_0x489221[_0x3e5b('0x1e')]=qs[_0x3e5b('0x1e')](_0x112dc0[_0x3e5b('0x35')]['limit']);_0x489221[_0x3e5b('0x20')]=qs['offset'](_0x112dc0[_0x3e5b('0x35')]['offset']);}_0x489221['order']=qs['sort'](_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x3d')]);_0x489221[_0x3e5b('0x3e')]=qs[_0x3e5b('0x36')](_[_0x3e5b('0x3f')](_0x112dc0[_0x3e5b('0x35')],_0x21bc10['filters']),_0xa8760b);if(_0x112dc0['query']['filter']){_0x489221['where']=_['merge'](_0x489221['where'],{'$or':_['map'](_0xa8760b,function(_0x182bc4){if(_0x182bc4[_0x3e5b('0x33')]!==_0x3e5b('0x40')){var _0x1aafd5={};_0x1aafd5[_0x182bc4[_0x3e5b('0x2d')]]={'$like':'%'+_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x41')]+'%'};return _0x1aafd5;}})});}_0x489221=_[_0x3e5b('0x42')]({},_0x489221,_0x112dc0[_0x3e5b('0x43')]);var _0xbbc6b={'where':_0x489221[_0x3e5b('0x3e')]};return db['AnalyticMetric'][_0x3e5b('0x1f')](_0xbbc6b)[_0x3e5b('0x27')](function(_0x1e8075){_0x1882aa[_0x3e5b('0x1f')]=_0x1e8075;if(_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x44')]){_0x489221[_0x3e5b('0x45')]=[{'all':!![]}];}return db[_0x3e5b('0x31')][_0x3e5b('0x46')](_0x489221);})[_0x3e5b('0x27')](function(_0x13c8d5){_0x1882aa['rows']=_0x13c8d5;return _0x1882aa;})['then'](respondWithFilteredResult(_0x1e1565,_0x489221))['catch'](handleError(_0x1e1565,null));};exports['show']=function(_0xa99d75,_0x21ee8a){var _0x9fc025={'raw':!![],'where':{'id':_0xa99d75[_0x3e5b('0x47')]['id']}},_0x24c416={};_0x24c416[_0x3e5b('0x38')]=_[_0x3e5b('0x34')](db[_0x3e5b('0x31')][_0x3e5b('0x32')]);_0x24c416[_0x3e5b('0x35')]=_['keys'](_0xa99d75[_0x3e5b('0x35')]);_0x24c416[_0x3e5b('0x36')]=_[_0x3e5b('0x37')](_0x24c416[_0x3e5b('0x38')],_0x24c416[_0x3e5b('0x35')]);_0x9fc025['attributes']=_['intersection'](_0x24c416['model'],qs[_0x3e5b('0x3a')](_0xa99d75[_0x3e5b('0x35')][_0x3e5b('0x3a')]));_0x9fc025['attributes']=_0x9fc025['attributes'][_0x3e5b('0x3b')]?_0x9fc025[_0x3e5b('0x39')]:_0x24c416[_0x3e5b('0x38')];if(_0xa99d75['query']['includeAll']){_0x9fc025[_0x3e5b('0x45')]=[{'all':!![]}];}_0x9fc025=_['merge']({},_0x9fc025,_0xa99d75[_0x3e5b('0x43')]);return db[_0x3e5b('0x31')][_0x3e5b('0x48')](_0x9fc025)[_0x3e5b('0x27')](handleEntityNotFound(_0x21ee8a,null))[_0x3e5b('0x27')](respondWithResult(_0x21ee8a,null))[_0x3e5b('0x49')](handleError(_0x21ee8a,null));};exports[_0x3e5b('0x4a')]=function(_0x3ea5aa,_0x339852){return db['AnalyticMetric'][_0x3e5b('0x4a')](_0x3ea5aa['body'],{})[_0x3e5b('0x27')](function(_0x2e7047){var _0x26e11e=_0x3ea5aa[_0x3e5b('0x4b')][_0x3e5b('0x4c')]({'plain':!![]});if(!_0x26e11e)throw new Error(_0x3e5b('0x4d'));if(_0x26e11e[_0x3e5b('0x4e')]===_0x3e5b('0x4b')){var _0x2b5d3d=_0x2e7047[_0x3e5b('0x4c')]({'plain':!![]});var _0xf6ca5b=_0x3e5b('0x28');return db[_0x3e5b('0x4f')]['find']({'where':{'name':_0xf6ca5b,'userProfileId':_0x26e11e[_0x3e5b('0x50')]},'raw':!![]})[_0x3e5b('0x27')](function(_0x2ca33b){if(_0x2ca33b&&_0x2ca33b[_0x3e5b('0x51')]===0x0){return db[_0x3e5b('0x29')][_0x3e5b('0x4a')]({'name':_0x2b5d3d['name'],'resourceId':_0x2b5d3d['id'],'type':_0x2ca33b[_0x3e5b('0x2d')],'sectionId':_0x2ca33b['id']},{})[_0x3e5b('0x27')](function(){return _0x2e7047;});}else{return _0x2e7047;}})[_0x3e5b('0x49')](function(_0x314d42){logger[_0x3e5b('0x2b')](_0x3e5b('0x52'),_0x314d42);throw _0x314d42;});}return _0x2e7047;})[_0x3e5b('0x27')](respondWithResult(_0x339852,0xc9))[_0x3e5b('0x49')](handleError(_0x339852,null));};exports['update']=function(_0x1e6403,_0x5e702f){if(_0x1e6403['body']['id']){delete _0x1e6403[_0x3e5b('0x53')]['id'];}return db['AnalyticMetric'][_0x3e5b('0x48')]({'where':{'id':_0x1e6403[_0x3e5b('0x47')]['id']}})[_0x3e5b('0x27')](handleEntityNotFound(_0x5e702f,null))[_0x3e5b('0x27')](saveUpdates(_0x1e6403['body'],null))['then'](respondWithResult(_0x5e702f,null))['catch'](handleError(_0x5e702f,null));};exports['destroy']=function(_0x2ab5f3,_0x999518){return db[_0x3e5b('0x31')][_0x3e5b('0x48')]({'where':{'id':_0x2ab5f3[_0x3e5b('0x47')]['id']}})['then'](handleEntityNotFound(_0x999518,null))['then'](removeEntity(_0x999518,null))[_0x3e5b('0x49')](handleError(_0x999518,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index dde8712..47c6e2a 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 _0x770d=['moment','bluebird','request-promise','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api'];(function(_0x3836ec,_0x4bc915){var _0x4aa699=function(_0x510d08){while(--_0x510d08){_0x3836ec['push'](_0x3836ec['shift']());}};_0x4aa699(++_0x4bc915);}(_0x770d,0x122));var _0xd770=function(_0x37cde3,_0x20109a){_0x37cde3=_0x37cde3-0x0;var _0x2d6530=_0x770d[_0x37cde3];return _0x2d6530;};'use strict';var _=require(_0xd770('0x0'));var util=require(_0xd770('0x1'));var logger=require(_0xd770('0x2'))(_0xd770('0x3'));var moment=require(_0xd770('0x4'));var BPromise=require(_0xd770('0x5'));var rp=require(_0xd770('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd770('0x7'));var config=require(_0xd770('0x8'));var attributes=require(_0xd770('0x9'));module[_0xd770('0xa')]=function(_0x5d3b18,_0x554c5e){return _0x5d3b18[_0xd770('0xb')](_0xd770('0xc'),attributes,{'tableName':_0xd770('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8838=['./analyticMetric.attributes','exports','define','analytics_metrics','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x148e7c,_0x433004){var _0x59da04=function(_0x20d6a6){while(--_0x20d6a6){_0x148e7c['push'](_0x148e7c['shift']());}};_0x59da04(++_0x433004);}(_0x8838,0x90));var _0x8883=function(_0x3f246b,_0x1c8b9a){_0x3f246b=_0x3f246b-0x0;var _0x1a7b27=_0x8838[_0x3f246b];return _0x1a7b27;};'use strict';var _=require(_0x8883('0x0'));var util=require(_0x8883('0x1'));var logger=require(_0x8883('0x2'))(_0x8883('0x3'));var moment=require(_0x8883('0x4'));var BPromise=require(_0x8883('0x5'));var rp=require(_0x8883('0x6'));var fs=require('fs');var path=require(_0x8883('0x7'));var rimraf=require(_0x8883('0x8'));var config=require(_0x8883('0x9'));var attributes=require(_0x8883('0xa'));module[_0x8883('0xb')]=function(_0x5c894f,_0x5061d6){return _0x5c894f[_0x8883('0xc')]('AnalyticMetric',attributes,{'tableName':_0x8883('0xd'),'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 0d50c32..e36926c 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 _0x8d47=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','AnalyticMetric,\x20%s,\x20%s','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash'];(function(_0x4e019c,_0x55ff32){var _0x37dedf=function(_0xfac621){while(--_0xfac621){_0x4e019c['push'](_0x4e019c['shift']());}};_0x37dedf(++_0x55ff32);}(_0x8d47,0x1df));var _0x78d4=function(_0x2eddce,_0x2930d8){_0x2eddce=_0x2eddce-0x0;var _0x5c6cca=_0x8d47[_0x2eddce];return _0x5c6cca;};'use strict';var _=require(_0x78d4('0x0'));var util=require('util');var moment=require(_0x78d4('0x1'));var BPromise=require(_0x78d4('0x2'));var rs=require(_0x78d4('0x3'));var fs=require('fs');var Redis=require(_0x78d4('0x4'));var db=require(_0x78d4('0x5'))['db'];var utils=require(_0x78d4('0x6'));var logger=require(_0x78d4('0x7'))(_0x78d4('0x8'));var config=require(_0x78d4('0x9'));var jayson=require(_0x78d4('0xa'));var client=jayson['client'][_0x78d4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21aa99,_0xa168c5,_0x2a4d2c){return new BPromise(function(_0x52d165,_0x19beb9){return client[_0x78d4('0xc')](_0x21aa99,_0x2a4d2c)[_0x78d4('0xd')](function(_0x474d36){logger['info'](_0x78d4('0xe'),_0xa168c5,'request\x20sent');logger[_0x78d4('0xf')](_0x78d4('0x10'),_0xa168c5,_0x78d4('0x11'),JSON[_0x78d4('0x12')](_0x474d36));if(_0x474d36[_0x78d4('0x13')]){if(_0x474d36[_0x78d4('0x13')]['code']===0x1f4){logger[_0x78d4('0x13')](_0x78d4('0xe'),_0xa168c5,_0x474d36[_0x78d4('0x13')][_0x78d4('0x14')]);return _0x19beb9(_0x474d36[_0x78d4('0x13')][_0x78d4('0x14')]);}logger[_0x78d4('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0xa168c5,_0x474d36[_0x78d4('0x13')]['message']);return _0x52d165(_0x474d36[_0x78d4('0x13')][_0x78d4('0x14')]);}else{logger[_0x78d4('0x15')](_0x78d4('0xe'),_0xa168c5,'request\x20sent');_0x52d165(_0x474d36[_0x78d4('0x16')][_0x78d4('0x14')]);}})[_0x78d4('0x17')](function(_0x3044f2){logger[_0x78d4('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0xa168c5,_0x3044f2);_0x19beb9(_0x3044f2);});});} \ No newline at end of file +var _0x7da8=['then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2b4f44,_0x7cc184){var _0xaaebe3=function(_0x11f155){while(--_0x11f155){_0x2b4f44['push'](_0x2b4f44['shift']());}};_0xaaebe3(++_0x7cc184);}(_0x7da8,0x164));var _0x87da=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x7da8[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x87da('0x0'));var util=require(_0x87da('0x1'));var moment=require(_0x87da('0x2'));var BPromise=require('bluebird');var rs=require(_0x87da('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x87da('0x4'))['db'];var utils=require(_0x87da('0x5'));var logger=require(_0x87da('0x6'))(_0x87da('0x7'));var config=require(_0x87da('0x8'));var jayson=require(_0x87da('0x9'));var client=jayson[_0x87da('0xa')][_0x87da('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36856c,_0x20e780,_0x2fd416){return new BPromise(function(_0x3096bb,_0x31b7f2){return client['request'](_0x36856c,_0x2fd416)[_0x87da('0xc')](function(_0x5290ea){logger[_0x87da('0xd')](_0x87da('0xe'),_0x20e780,_0x87da('0xf'));logger[_0x87da('0x10')](_0x87da('0x11'),_0x20e780,_0x87da('0xf'),JSON[_0x87da('0x12')](_0x5290ea));if(_0x5290ea[_0x87da('0x13')]){if(_0x5290ea[_0x87da('0x13')][_0x87da('0x14')]===0x1f4){logger[_0x87da('0x13')](_0x87da('0xe'),_0x20e780,_0x5290ea['error'][_0x87da('0x15')]);return _0x31b7f2(_0x5290ea[_0x87da('0x13')][_0x87da('0x15')]);}logger[_0x87da('0x13')](_0x87da('0xe'),_0x20e780,_0x5290ea['error'][_0x87da('0x15')]);return _0x3096bb(_0x5290ea[_0x87da('0x13')][_0x87da('0x15')]);}else{logger[_0x87da('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x20e780,_0x87da('0xf'));_0x3096bb(_0x5290ea['result']['message']);}})[_0x87da('0x16')](function(_0x233834){logger[_0x87da('0x13')](_0x87da('0xe'),_0x20e780,_0x233834);_0x31b7f2(_0x233834);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index dc05120..f5b1bf6 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 _0x4ce6=['../../components/auth/service','../../config/environment','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x4551fd,_0x18ff84){var _0x2adb36=function(_0x30ff46){while(--_0x30ff46){_0x4551fd['push'](_0x4551fd['shift']());}};_0x2adb36(++_0x18ff84);}(_0x4ce6,0x108));var _0x64ce=function(_0x5f3905,_0x43a651){_0x5f3905=_0x5f3905-0x0;var _0x2923b1=_0x4ce6[_0x5f3905];return _0x2923b1;};'use strict';var multer=require(_0x64ce('0x0'));var util=require('util');var path=require(_0x64ce('0x1'));var timeout=require(_0x64ce('0x2'));var express=require(_0x64ce('0x3'));var router=express[_0x64ce('0x4')]();var fs_extra=require(_0x64ce('0x5'));var auth=require(_0x64ce('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x64ce('0x7'));var controller=require('./analyticMetric.controller');router['get']('/',auth[_0x64ce('0x8')](),controller[_0x64ce('0x9')]);router['get'](_0x64ce('0xa'),auth[_0x64ce('0x8')](),controller[_0x64ce('0xb')]);router[_0x64ce('0xc')]('/',auth[_0x64ce('0x8')](),controller[_0x64ce('0xd')]);router[_0x64ce('0xe')](_0x64ce('0xa'),auth[_0x64ce('0x8')](),controller[_0x64ce('0xf')]);router['delete'](_0x64ce('0xa'),auth[_0x64ce('0x8')](),controller[_0x64ce('0x10')]);module[_0x64ce('0x11')]=router; \ No newline at end of file +var _0xdf98=['isAuthenticated','index','/:id','show','create','update','delete','destroy','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdf98,0xcf));var _0x8df9=function(_0x1cc060,_0x1afbdc){_0x1cc060=_0x1cc060-0x0;var _0x5c7e10=_0xdf98[_0x1cc060];return _0x5c7e10;};'use strict';var multer=require(_0x8df9('0x0'));var util=require('util');var path=require(_0x8df9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8df9('0x2')]();var fs_extra=require(_0x8df9('0x3'));var auth=require(_0x8df9('0x4'));var interaction=require(_0x8df9('0x5'));var config=require(_0x8df9('0x6'));var controller=require(_0x8df9('0x7'));router[_0x8df9('0x8')]('/',auth[_0x8df9('0x9')](),controller[_0x8df9('0xa')]);router['get'](_0x8df9('0xb'),auth[_0x8df9('0x9')](),controller[_0x8df9('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8df9('0xd')]);router['put'](_0x8df9('0xb'),auth[_0x8df9('0x9')](),controller[_0x8df9('0xe')]);router[_0x8df9('0xf')](_0x8df9('0xb'),auth[_0x8df9('0x9')](),controller[_0x8df9('0x10')]);module[_0x8df9('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 7a761ec..161ef42 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 _0x7d53=['exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7d53,0x11d));var _0x37d5=function(_0x23d727,_0x472346){_0x23d727=_0x23d727-0x0;var _0x456ef2=_0x7d53[_0x23d727];return _0x456ef2;};'use strict';var Sequelize=require('sequelize');module[_0x37d5('0x0')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0xb778=['sequelize','exports','TEXT'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xb778,0x1c5));var _0x8b77=function(_0x143a91,_0x235332){_0x143a91=_0x143a91-0x0;var _0x1906f5=_0xb778[_0x143a91];return _0x1906f5;};'use strict';var Sequelize=require(_0x8b77('0x0'));module[_0x8b77('0x1')]={'tree':{'type':Sequelize[_0x8b77('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 6d5a2d8..99d4b29 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 _0x5f7b=['apply','reject','save','destroy','then','error','stack','name','send','index','map','AnalyticTreeReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','include','rows','catch','show','params','includeAll','options','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','ejs','fs-extra','squel','crypto','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','sendStatus','status','json','offset','undefined','limit','count'];(function(_0x4eaa4c,_0x2f7422){var _0x15aec6=function(_0x23efc9){while(--_0x23efc9){_0x4eaa4c['push'](_0x4eaa4c['shift']());}};_0x15aec6(++_0x2f7422);}(_0x5f7b,0xc3));var _0xb5f7=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x5f7b[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require(_0xb5f7('0x0'));var rimraf=require(_0xb5f7('0x1'));var zipdir=require(_0xb5f7('0x2'));var jsonpatch=require(_0xb5f7('0x3'));var rp=require(_0xb5f7('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb5f7('0x5'));var util=require('util');var path=require(_0xb5f7('0x6'));var sox=require(_0xb5f7('0x7'));var csv=require('to-csv');var ejs=require(_0xb5f7('0x8'));var fs=require('fs');var fs_extra=require(_0xb5f7('0x9'));var _=require('lodash');var squel=require(_0xb5f7('0xa'));var crypto=require(_0xb5f7('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb5f7('0xc'));var toCsv=require(_0xb5f7('0xd'));var querystring=require(_0xb5f7('0xe'));var Papa=require(_0xb5f7('0xf'));var Redis=require(_0xb5f7('0x10'));var authService=require(_0xb5f7('0x11'));var qs=require(_0xb5f7('0x12'));var as=require(_0xb5f7('0x13'));var hardwareService=require(_0xb5f7('0x14'));var logger=require(_0xb5f7('0x15'))(_0xb5f7('0x16'));var utils=require(_0xb5f7('0x17'));var config=require(_0xb5f7('0x18'));var licenseUtil=require(_0xb5f7('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33d67e,_0x11a98f){_0x11a98f=_0x11a98f||0xcc;return function(_0x3a0402){if(_0x3a0402){return _0x33d67e[_0xb5f7('0x1a')](_0x11a98f);}return _0x33d67e[_0xb5f7('0x1b')](_0x11a98f)['end']();};}function respondWithResult(_0x17dcb4,_0x304a25){_0x304a25=_0x304a25||0xc8;return function(_0x2172f4){if(_0x2172f4){return _0x17dcb4[_0xb5f7('0x1b')](_0x304a25)[_0xb5f7('0x1c')](_0x2172f4);}};}function respondWithFilteredResult(_0x251b81,_0x349e2b){return function(_0x3f1d34){if(_0x3f1d34){var _0x2475d8=typeof _0x349e2b[_0xb5f7('0x1d')]===_0xb5f7('0x1e')&&typeof _0x349e2b[_0xb5f7('0x1f')]===_0xb5f7('0x1e');var _0x35bcbb=_0x3f1d34['count'];var _0x3d6329=_0x2475d8?0x0:_0x349e2b[_0xb5f7('0x1d')];var _0x511873=_0x2475d8?_0x3f1d34[_0xb5f7('0x20')]:_0x349e2b['offset']+_0x349e2b[_0xb5f7('0x1f')];var _0x5d7b40;if(_0x511873>=_0x35bcbb){_0x511873=_0x35bcbb;_0x5d7b40=0xc8;}else{_0x5d7b40=0xce;}_0x251b81[_0xb5f7('0x1b')](_0x5d7b40);return _0x251b81['set']('Content-Range',_0x3d6329+'-'+_0x511873+'/'+_0x35bcbb)[_0xb5f7('0x1c')](_0x3f1d34);}return null;};}function patchUpdates(_0x30bc20){return function(_0x207f5f){try{jsonpatch[_0xb5f7('0x21')](_0x207f5f,_0x30bc20,!![]);}catch(_0x21a9f6){return BPromise[_0xb5f7('0x22')](_0x21a9f6);}return _0x207f5f[_0xb5f7('0x23')]();};}function saveUpdates(_0x4aff0b,_0x383faa){return function(_0x51a1f1){if(_0x51a1f1){return _0x51a1f1['update'](_0x4aff0b)['then'](function(_0x43def5){return _0x43def5;});}return null;};}function removeEntity(_0x258ebd,_0x45a626){return function(_0xd65f7e){if(_0xd65f7e){return _0xd65f7e[_0xb5f7('0x24')]()[_0xb5f7('0x25')](function(){_0x258ebd[_0xb5f7('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45c884,_0x1d448b){return function(_0x5e1b23){if(!_0x5e1b23){_0x45c884[_0xb5f7('0x1a')](0x194);}return _0x5e1b23;};}function handleError(_0x316d7d,_0x44e9b3){_0x44e9b3=_0x44e9b3||0x1f4;return function(_0x6fc367){logger[_0xb5f7('0x26')](_0x6fc367[_0xb5f7('0x27')]);if(_0x6fc367[_0xb5f7('0x28')]){delete _0x6fc367[_0xb5f7('0x28')];}_0x316d7d['status'](_0x44e9b3)[_0xb5f7('0x29')](_0x6fc367);};}exports[_0xb5f7('0x2a')]=function(_0x13b8ea,_0x586a6d){var _0x2752b8={},_0x388a3f={},_0x73e3f={'count':0x0,'rows':[]};var _0x5caf69=_[_0xb5f7('0x2b')](db[_0xb5f7('0x2c')]['rawAttributes'],function(_0x34eefa){return{'name':_0x34eefa[_0xb5f7('0x2d')],'type':_0x34eefa[_0xb5f7('0x2e')][_0xb5f7('0x2f')]};});_0x388a3f[_0xb5f7('0x30')]=_[_0xb5f7('0x2b')](_0x5caf69,_0xb5f7('0x28'));_0x388a3f[_0xb5f7('0x31')]=_[_0xb5f7('0x32')](_0x13b8ea[_0xb5f7('0x31')]);_0x388a3f[_0xb5f7('0x33')]=_[_0xb5f7('0x34')](_0x388a3f['model'],_0x388a3f[_0xb5f7('0x31')]);_0x2752b8[_0xb5f7('0x35')]=_[_0xb5f7('0x34')](_0x388a3f[_0xb5f7('0x30')],qs['fields'](_0x13b8ea[_0xb5f7('0x31')][_0xb5f7('0x36')]));_0x2752b8[_0xb5f7('0x35')]=_0x2752b8[_0xb5f7('0x35')][_0xb5f7('0x37')]?_0x2752b8[_0xb5f7('0x35')]:_0x388a3f[_0xb5f7('0x30')];if(!_0x13b8ea['query'][_0xb5f7('0x38')](_0xb5f7('0x39'))){_0x2752b8[_0xb5f7('0x1f')]=qs['limit'](_0x13b8ea['query'][_0xb5f7('0x1f')]);_0x2752b8[_0xb5f7('0x1d')]=qs[_0xb5f7('0x1d')](_0x13b8ea[_0xb5f7('0x31')]['offset']);}_0x2752b8[_0xb5f7('0x3a')]=qs[_0xb5f7('0x3b')](_0x13b8ea[_0xb5f7('0x31')][_0xb5f7('0x3b')]);_0x2752b8[_0xb5f7('0x3c')]=qs[_0xb5f7('0x33')](_[_0xb5f7('0x3d')](_0x13b8ea[_0xb5f7('0x31')],_0x388a3f[_0xb5f7('0x33')]),_0x5caf69);if(_0x13b8ea[_0xb5f7('0x31')]['filter']){_0x2752b8[_0xb5f7('0x3c')]=_[_0xb5f7('0x3e')](_0x2752b8['where'],{'$or':_[_0xb5f7('0x2b')](_0x5caf69,function(_0x30ef6d){if(_0x30ef6d[_0xb5f7('0x2e')]!==_0xb5f7('0x3f')){var _0x326314={};_0x326314[_0x30ef6d[_0xb5f7('0x28')]]={'$like':'%'+_0x13b8ea[_0xb5f7('0x31')][_0xb5f7('0x40')]+'%'};return _0x326314;}})});}_0x2752b8=_[_0xb5f7('0x3e')]({},_0x2752b8,_0x13b8ea['options']);var _0x41a083={'where':_0x2752b8[_0xb5f7('0x3c')]};return db[_0xb5f7('0x2c')][_0xb5f7('0x20')](_0x41a083)['then'](function(_0x39dc05){_0x73e3f['count']=_0x39dc05;if(_0x13b8ea[_0xb5f7('0x31')]['includeAll']){_0x2752b8[_0xb5f7('0x41')]=[{'all':!![]}];}return db[_0xb5f7('0x2c')]['findAll'](_0x2752b8);})['then'](function(_0x5c3553){_0x73e3f[_0xb5f7('0x42')]=_0x5c3553;return _0x73e3f;})[_0xb5f7('0x25')](respondWithFilteredResult(_0x586a6d,_0x2752b8))[_0xb5f7('0x43')](handleError(_0x586a6d,null));};exports[_0xb5f7('0x44')]=function(_0x5b3dfd,_0x236e47){var _0x5370d3={'raw':!![],'where':{'id':_0x5b3dfd[_0xb5f7('0x45')]['id']}},_0x39856a={};_0x39856a[_0xb5f7('0x30')]=_['keys'](db[_0xb5f7('0x2c')]['rawAttributes']);_0x39856a['query']=_['keys'](_0x5b3dfd[_0xb5f7('0x31')]);_0x39856a[_0xb5f7('0x33')]=_['intersection'](_0x39856a[_0xb5f7('0x30')],_0x39856a[_0xb5f7('0x31')]);_0x5370d3[_0xb5f7('0x35')]=_[_0xb5f7('0x34')](_0x39856a['model'],qs[_0xb5f7('0x36')](_0x5b3dfd[_0xb5f7('0x31')][_0xb5f7('0x36')]));_0x5370d3[_0xb5f7('0x35')]=_0x5370d3[_0xb5f7('0x35')]['length']?_0x5370d3['attributes']:_0x39856a[_0xb5f7('0x30')];if(_0x5b3dfd[_0xb5f7('0x31')][_0xb5f7('0x46')]){_0x5370d3[_0xb5f7('0x41')]=[{'all':!![]}];}_0x5370d3=_[_0xb5f7('0x3e')]({},_0x5370d3,_0x5b3dfd[_0xb5f7('0x47')]);return db[_0xb5f7('0x2c')]['find'](_0x5370d3)[_0xb5f7('0x25')](handleEntityNotFound(_0x236e47,null))[_0xb5f7('0x25')](respondWithResult(_0x236e47,null))[_0xb5f7('0x43')](handleError(_0x236e47,null));};exports[_0xb5f7('0x48')]=function(_0x19a72d,_0x2d4c21){return db[_0xb5f7('0x2c')]['create'](_0x19a72d[_0xb5f7('0x49')],{})[_0xb5f7('0x25')](respondWithResult(_0x2d4c21,0xc9))['catch'](handleError(_0x2d4c21,null));};exports[_0xb5f7('0x4a')]=function(_0x47ff41,_0x5f500b){if(_0x47ff41['body']['id']){delete _0x47ff41[_0xb5f7('0x49')]['id'];}return db['AnalyticTreeReport']['find']({'where':{'id':_0x47ff41[_0xb5f7('0x45')]['id']}})[_0xb5f7('0x25')](handleEntityNotFound(_0x5f500b,null))[_0xb5f7('0x25')](saveUpdates(_0x47ff41[_0xb5f7('0x49')],null))[_0xb5f7('0x25')](respondWithResult(_0x5f500b,null))[_0xb5f7('0x43')](handleError(_0x5f500b,null));};exports['destroy']=function(_0x29025e,_0x45dc23){return db[_0xb5f7('0x2c')][_0xb5f7('0x4b')]({'where':{'id':_0x29025e[_0xb5f7('0x45')]['id']}})[_0xb5f7('0x25')](handleEntityNotFound(_0x45dc23,null))[_0xb5f7('0x25')](removeEntity(_0x45dc23,null))[_0xb5f7('0x43')](handleError(_0x45dc23,null));}; \ No newline at end of file +var _0x21ec=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes'];(function(_0x41c4c5,_0x46953c){var _0x3bd4ef=function(_0x2fd690){while(--_0x2fd690){_0x41c4c5['push'](_0x41c4c5['shift']());}};_0x3bd4ef(++_0x46953c);}(_0x21ec,0xb2));var _0xc21e=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x21ec[_0x4b2863];return _0x567d67;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc21e('0x0'));var zipdir=require(_0xc21e('0x1'));var jsonpatch=require(_0xc21e('0x2'));var rp=require('request-promise');var moment=require(_0xc21e('0x3'));var BPromise=require(_0xc21e('0x4'));var Mustache=require(_0xc21e('0x5'));var util=require(_0xc21e('0x6'));var path=require(_0xc21e('0x7'));var sox=require(_0xc21e('0x8'));var csv=require(_0xc21e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc21e('0xa'));var _=require(_0xc21e('0xb'));var squel=require(_0xc21e('0xc'));var crypto=require(_0xc21e('0xd'));var jsforce=require(_0xc21e('0xe'));var deskjs=require(_0xc21e('0xf'));var toCsv=require(_0xc21e('0x9'));var querystring=require(_0xc21e('0x10'));var Papa=require('papaparse');var Redis=require(_0xc21e('0x11'));var authService=require(_0xc21e('0x12'));var qs=require(_0xc21e('0x13'));var as=require(_0xc21e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc21e('0x15'))(_0xc21e('0x16'));var utils=require(_0xc21e('0x17'));var config=require(_0xc21e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc21e('0x19'))['db'];function respondWithStatusCode(_0x33eb3f,_0x6af8c9){_0x6af8c9=_0x6af8c9||0xcc;return function(_0x16401c){if(_0x16401c){return _0x33eb3f[_0xc21e('0x1a')](_0x6af8c9);}return _0x33eb3f['status'](_0x6af8c9)[_0xc21e('0x1b')]();};}function respondWithResult(_0xc3f443,_0x18213b){_0x18213b=_0x18213b||0xc8;return function(_0x3f234a){if(_0x3f234a){return _0xc3f443[_0xc21e('0x1c')](_0x18213b)['json'](_0x3f234a);}};}function respondWithFilteredResult(_0xfaddb2,_0x4fbed5){return function(_0xefd430){if(_0xefd430){var _0x4da0eb=typeof _0x4fbed5[_0xc21e('0x1d')]===_0xc21e('0x1e')&&typeof _0x4fbed5[_0xc21e('0x1f')]===_0xc21e('0x1e');var _0x59d5c7=_0xefd430['count'];var _0xd092df=_0x4da0eb?0x0:_0x4fbed5[_0xc21e('0x1d')];var _0x3a51aa=_0x4da0eb?_0xefd430[_0xc21e('0x20')]:_0x4fbed5['offset']+_0x4fbed5[_0xc21e('0x1f')];var _0x39249b;if(_0x3a51aa>=_0x59d5c7){_0x3a51aa=_0x59d5c7;_0x39249b=0xc8;}else{_0x39249b=0xce;}_0xfaddb2['status'](_0x39249b);return _0xfaddb2[_0xc21e('0x21')](_0xc21e('0x22'),_0xd092df+'-'+_0x3a51aa+'/'+_0x59d5c7)['json'](_0xefd430);}return null;};}function patchUpdates(_0x229102){return function(_0x14cd3f){try{jsonpatch[_0xc21e('0x23')](_0x14cd3f,_0x229102,!![]);}catch(_0x554534){return BPromise[_0xc21e('0x24')](_0x554534);}return _0x14cd3f[_0xc21e('0x25')]();};}function saveUpdates(_0xe0c810,_0x3c44bc){return function(_0x4af573){if(_0x4af573){return _0x4af573['update'](_0xe0c810)[_0xc21e('0x26')](function(_0x108f40){return _0x108f40;});}return null;};}function removeEntity(_0x1d675d,_0x4dec2d){return function(_0x828324){if(_0x828324){return _0x828324[_0xc21e('0x27')]()['then'](function(){_0x1d675d[_0xc21e('0x1c')](0xcc)[_0xc21e('0x1b')]();});}};}function handleEntityNotFound(_0x12cddf,_0x385ce3){return function(_0x178400){if(!_0x178400){_0x12cddf[_0xc21e('0x1a')](0x194);}return _0x178400;};}function handleError(_0x273bfe,_0x4416e4){_0x4416e4=_0x4416e4||0x1f4;return function(_0x2ff2c8){logger[_0xc21e('0x28')](_0x2ff2c8[_0xc21e('0x29')]);if(_0x2ff2c8[_0xc21e('0x2a')]){delete _0x2ff2c8[_0xc21e('0x2a')];}_0x273bfe[_0xc21e('0x1c')](_0x4416e4)[_0xc21e('0x2b')](_0x2ff2c8);};}exports[_0xc21e('0x2c')]=function(_0x97f908,_0x123752){var _0x500443={},_0x30ec49={},_0x19efe3={'count':0x0,'rows':[]};var _0x48a812=_[_0xc21e('0x2d')](db[_0xc21e('0x2e')][_0xc21e('0x2f')],function(_0x81650b){return{'name':_0x81650b[_0xc21e('0x30')],'type':_0x81650b['type'][_0xc21e('0x31')]};});_0x30ec49['model']=_[_0xc21e('0x2d')](_0x48a812,_0xc21e('0x2a'));_0x30ec49[_0xc21e('0x32')]=_[_0xc21e('0x33')](_0x97f908[_0xc21e('0x32')]);_0x30ec49[_0xc21e('0x34')]=_[_0xc21e('0x35')](_0x30ec49[_0xc21e('0x36')],_0x30ec49[_0xc21e('0x32')]);_0x500443[_0xc21e('0x37')]=_[_0xc21e('0x35')](_0x30ec49[_0xc21e('0x36')],qs['fields'](_0x97f908[_0xc21e('0x32')][_0xc21e('0x38')]));_0x500443[_0xc21e('0x37')]=_0x500443[_0xc21e('0x37')][_0xc21e('0x39')]?_0x500443[_0xc21e('0x37')]:_0x30ec49['model'];if(!_0x97f908[_0xc21e('0x32')][_0xc21e('0x3a')](_0xc21e('0x3b'))){_0x500443[_0xc21e('0x1f')]=qs[_0xc21e('0x1f')](_0x97f908[_0xc21e('0x32')][_0xc21e('0x1f')]);_0x500443[_0xc21e('0x1d')]=qs[_0xc21e('0x1d')](_0x97f908[_0xc21e('0x32')]['offset']);}_0x500443[_0xc21e('0x3c')]=qs['sort'](_0x97f908[_0xc21e('0x32')][_0xc21e('0x3d')]);_0x500443[_0xc21e('0x3e')]=qs['filters'](_[_0xc21e('0x3f')](_0x97f908[_0xc21e('0x32')],_0x30ec49[_0xc21e('0x34')]),_0x48a812);if(_0x97f908[_0xc21e('0x32')][_0xc21e('0x40')]){_0x500443[_0xc21e('0x3e')]=_[_0xc21e('0x41')](_0x500443[_0xc21e('0x3e')],{'$or':_[_0xc21e('0x2d')](_0x48a812,function(_0x9f6baf){if(_0x9f6baf[_0xc21e('0x42')]!==_0xc21e('0x43')){var _0x4cecfe={};_0x4cecfe[_0x9f6baf[_0xc21e('0x2a')]]={'$like':'%'+_0x97f908['query'][_0xc21e('0x40')]+'%'};return _0x4cecfe;}})});}_0x500443=_[_0xc21e('0x41')]({},_0x500443,_0x97f908[_0xc21e('0x44')]);var _0x57a598={'where':_0x500443[_0xc21e('0x3e')]};return db[_0xc21e('0x2e')]['count'](_0x57a598)['then'](function(_0x51c204){_0x19efe3[_0xc21e('0x20')]=_0x51c204;if(_0x97f908[_0xc21e('0x32')][_0xc21e('0x45')]){_0x500443[_0xc21e('0x46')]=[{'all':!![]}];}return db[_0xc21e('0x2e')]['findAll'](_0x500443);})[_0xc21e('0x26')](function(_0x3f07af){_0x19efe3[_0xc21e('0x47')]=_0x3f07af;return _0x19efe3;})['then'](respondWithFilteredResult(_0x123752,_0x500443))[_0xc21e('0x48')](handleError(_0x123752,null));};exports[_0xc21e('0x49')]=function(_0x52f509,_0x3f8daa){var _0x2a5581={'raw':!![],'where':{'id':_0x52f509[_0xc21e('0x4a')]['id']}},_0x275500={};_0x275500['model']=_['keys'](db['AnalyticTreeReport'][_0xc21e('0x2f')]);_0x275500[_0xc21e('0x32')]=_[_0xc21e('0x33')](_0x52f509[_0xc21e('0x32')]);_0x275500[_0xc21e('0x34')]=_[_0xc21e('0x35')](_0x275500[_0xc21e('0x36')],_0x275500[_0xc21e('0x32')]);_0x2a5581['attributes']=_[_0xc21e('0x35')](_0x275500['model'],qs[_0xc21e('0x38')](_0x52f509['query'][_0xc21e('0x38')]));_0x2a5581['attributes']=_0x2a5581[_0xc21e('0x37')][_0xc21e('0x39')]?_0x2a5581[_0xc21e('0x37')]:_0x275500[_0xc21e('0x36')];if(_0x52f509[_0xc21e('0x32')][_0xc21e('0x45')]){_0x2a5581[_0xc21e('0x46')]=[{'all':!![]}];}_0x2a5581=_[_0xc21e('0x41')]({},_0x2a5581,_0x52f509['options']);return db[_0xc21e('0x2e')][_0xc21e('0x4b')](_0x2a5581)[_0xc21e('0x26')](handleEntityNotFound(_0x3f8daa,null))[_0xc21e('0x26')](respondWithResult(_0x3f8daa,null))['catch'](handleError(_0x3f8daa,null));};exports[_0xc21e('0x4c')]=function(_0x507ee9,_0x3a59ad){return db['AnalyticTreeReport'][_0xc21e('0x4c')](_0x507ee9['body'],{})[_0xc21e('0x26')](respondWithResult(_0x3a59ad,0xc9))[_0xc21e('0x48')](handleError(_0x3a59ad,null));};exports['update']=function(_0x1c4707,_0x29fac4){if(_0x1c4707['body']['id']){delete _0x1c4707[_0xc21e('0x4d')]['id'];}return db[_0xc21e('0x2e')]['find']({'where':{'id':_0x1c4707[_0xc21e('0x4a')]['id']}})[_0xc21e('0x26')](handleEntityNotFound(_0x29fac4,null))['then'](saveUpdates(_0x1c4707['body'],null))[_0xc21e('0x26')](respondWithResult(_0x29fac4,null))[_0xc21e('0x48')](handleError(_0x29fac4,null));};exports['destroy']=function(_0x5dafce,_0x32a6c8){return db['AnalyticTreeReport'][_0xc21e('0x4b')]({'where':{'id':_0x5dafce['params']['id']}})[_0xc21e('0x26')](handleEntityNotFound(_0x32a6c8,null))[_0xc21e('0x26')](removeEntity(_0x32a6c8,null))[_0xc21e('0x48')](handleError(_0x32a6c8,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 8cc0846..a9f9b12 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 _0x64ee=['../../config/environment','exports','define','AnalyticTreeReport','analytics_report_trees','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x1488cd,_0x25a893){var _0x63fa13=function(_0x57dd1c){while(--_0x57dd1c){_0x1488cd['push'](_0x1488cd['shift']());}};_0x63fa13(++_0x25a893);}(_0x64ee,0x1f4));var _0xe64e=function(_0x578120,_0x595de5){_0x578120=_0x578120-0x0;var _0xf1fd0c=_0x64ee[_0x578120];return _0xf1fd0c;};'use strict';var _=require('lodash');var util=require(_0xe64e('0x0'));var logger=require(_0xe64e('0x1'))(_0xe64e('0x2'));var moment=require('moment');var BPromise=require(_0xe64e('0x3'));var rp=require(_0xe64e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe64e('0x5'));var config=require(_0xe64e('0x6'));var attributes=require('./analyticTreeReport.attributes');module[_0xe64e('0x7')]=function(_0x761852,_0x425f09){return _0x761852[_0xe64e('0x8')](_0xe64e('0x9'),attributes,{'tableName':_0xe64e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe2e2=['request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','analytics_report_trees','lodash','util','../../config/logger','api','bluebird'];(function(_0x62ee48,_0x383ffc){var _0x39df44=function(_0x337e10){while(--_0x337e10){_0x62ee48['push'](_0x62ee48['shift']());}};_0x39df44(++_0x383ffc);}(_0xe2e2,0x17b));var _0x2e2e=function(_0x199c55,_0x167d19){_0x199c55=_0x199c55-0x0;var _0x592b02=_0xe2e2[_0x199c55];return _0x592b02;};'use strict';var _=require(_0x2e2e('0x0'));var util=require(_0x2e2e('0x1'));var logger=require(_0x2e2e('0x2'))(_0x2e2e('0x3'));var moment=require('moment');var BPromise=require(_0x2e2e('0x4'));var rp=require(_0x2e2e('0x5'));var fs=require('fs');var path=require(_0x2e2e('0x6'));var rimraf=require(_0x2e2e('0x7'));var config=require(_0x2e2e('0x8'));var attributes=require(_0x2e2e('0x9'));module[_0x2e2e('0xa')]=function(_0x2b76ad,_0x43d5f4){return _0x2b76ad['define']('AnalyticTreeReport',attributes,{'tableName':_0x2e2e('0xb'),'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 5118afd..47942dc 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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x387b9d,_0x3c769c){var _0x23a678=function(_0x1e324a){while(--_0x1e324a){_0x387b9d['push'](_0x387b9d['shift']());}};_0x23a678(++_0x3c769c);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xc4aa[_0x50a0c2];return _0x5ebadd;};'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')]('AnalyticTreeReport,\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 _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x590a38,_0x2bc65c){var _0xf36626=function(_0x551cd1){while(--_0x551cd1){_0x590a38['push'](_0x590a38['shift']());}};_0xf36626(++_0x2bc65c);}(_0xadb5,0xad));var _0x5adb=function(_0x39f212,_0x26826d){_0x39f212=_0x39f212-0x0;var _0x57fd33=_0xadb5[_0x39f212];return _0x57fd33;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 4ea1d14..e5163c4 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 _0xe171=['update','delete','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','/:id','isAuthenticated','show','post','create','put'];(function(_0x4d341f,_0x744847){var _0x53a0b4=function(_0x4b9108){while(--_0x4b9108){_0x4d341f['push'](_0x4d341f['shift']());}};_0x53a0b4(++_0x744847);}(_0xe171,0x1f3));var _0x1e17=function(_0x73034e,_0x17389c){_0x73034e=_0x73034e-0x0;var _0x2bbbae=_0xe171[_0x73034e];return _0x2bbbae;};'use strict';var multer=require('multer');var util=require(_0x1e17('0x0'));var path=require(_0x1e17('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1e17('0x2')]();var fs_extra=require(_0x1e17('0x3'));var auth=require(_0x1e17('0x4'));var interaction=require(_0x1e17('0x5'));var config=require('../../config/environment');var controller=require('./analyticTreeReport.controller');router[_0x1e17('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1e17('0x6')](_0x1e17('0x7'),auth[_0x1e17('0x8')](),controller[_0x1e17('0x9')]);router[_0x1e17('0xa')]('/',auth[_0x1e17('0x8')](),controller[_0x1e17('0xb')]);router[_0x1e17('0xc')](_0x1e17('0x7'),auth[_0x1e17('0x8')](),controller[_0x1e17('0xd')]);router[_0x1e17('0xe')](_0x1e17('0x7'),auth['isAuthenticated'](),controller['destroy']);module[_0x1e17('0xf')]=router; \ No newline at end of file +var _0x1d6d=['/:id','show','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index'];(function(_0x290f7a,_0x45e5a6){var _0x8292c4=function(_0xb7d9f4){while(--_0xb7d9f4){_0x290f7a['push'](_0x290f7a['shift']());}};_0x8292c4(++_0x45e5a6);}(_0x1d6d,0xf8));var _0xd1d6=function(_0x7910d0,_0x171616){_0x7910d0=_0x7910d0-0x0;var _0x50c58b=_0x1d6d[_0x7910d0];return _0x50c58b;};'use strict';var multer=require(_0xd1d6('0x0'));var util=require(_0xd1d6('0x1'));var path=require('path');var timeout=require(_0xd1d6('0x2'));var express=require(_0xd1d6('0x3'));var router=express['Router']();var fs_extra=require(_0xd1d6('0x4'));var auth=require(_0xd1d6('0x5'));var interaction=require(_0xd1d6('0x6'));var config=require(_0xd1d6('0x7'));var controller=require(_0xd1d6('0x8'));router[_0xd1d6('0x9')]('/',auth[_0xd1d6('0xa')](),controller[_0xd1d6('0xb')]);router[_0xd1d6('0x9')](_0xd1d6('0xc'),auth['isAuthenticated'](),controller[_0xd1d6('0xd')]);router[_0xd1d6('0xe')]('/',auth['isAuthenticated'](),controller[_0xd1d6('0xf')]);router['put'](_0xd1d6('0xc'),auth[_0xd1d6('0xa')](),controller[_0xd1d6('0x10')]);router[_0xd1d6('0x11')](_0xd1d6('0xc'),auth[_0xd1d6('0xa')](),controller[_0xd1d6('0x12')]);module[_0xd1d6('0x13')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 4d94c51..22acda8 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 _0x0851=['sequelize','exports','STRING'];(function(_0x1e4f2d,_0x22e2bb){var _0xd05ce5=function(_0x4c7b43){while(--_0x4c7b43){_0x1e4f2d['push'](_0x1e4f2d['shift']());}};_0xd05ce5(++_0x22e2bb);}(_0x0851,0x8a));var _0x1085=function(_0x3f140c,_0x1e74ea){_0x3f140c=_0x3f140c-0x0;var _0xa7d076=_0x0851[_0x3f140c];return _0xa7d076;};'use strict';var Sequelize=require(_0x1085('0x0'));module[_0x1085('0x1')]={'name':{'type':Sequelize[_0x1085('0x2')]},'basename':{'type':Sequelize[_0x1085('0x2')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8743=['exports','STRING','sequelize'];(function(_0x4ba3c4,_0x24842d){var _0x2b6605=function(_0xc2698f){while(--_0xc2698f){_0x4ba3c4['push'](_0x4ba3c4['shift']());}};_0x2b6605(++_0x24842d);}(_0x8743,0x7a));var _0x3874=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x8743[_0x56482c];return _0x5aae7a;};'use strict';var Sequelize=require(_0x3874('0x0'));module[_0x3874('0x1')]={'name':{'type':Sequelize[_0x3874('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x3874('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index a147f2c..a092102 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 _0xa0d3=['createdAt','updatedAt','body','create','file','mimetype','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','Attachment','findAll','rows','catch','show','params','options','find','clone','get','omit'];(function(_0x5a7f52,_0x2e604d){var _0x188f90=function(_0x4882fe){while(--_0x4882fe){_0x5a7f52['push'](_0x5a7f52['shift']());}};_0x188f90(++_0x2e604d);}(_0xa0d3,0xb8));var _0x3a0d=function(_0x2726ad,_0x5073b1){_0x2726ad=_0x2726ad-0x0;var _0xd87993=_0xa0d3[_0x2726ad];return _0xd87993;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3a0d('0x0'));var zipdir=require(_0x3a0d('0x1'));var jsonpatch=require(_0x3a0d('0x2'));var rp=require(_0x3a0d('0x3'));var moment=require('moment');var BPromise=require(_0x3a0d('0x4'));var Mustache=require(_0x3a0d('0x5'));var util=require(_0x3a0d('0x6'));var path=require('path');var sox=require(_0x3a0d('0x7'));var csv=require(_0x3a0d('0x8'));var ejs=require(_0x3a0d('0x9'));var fs=require('fs');var fs_extra=require(_0x3a0d('0xa'));var _=require(_0x3a0d('0xb'));var squel=require('squel');var crypto=require(_0x3a0d('0xc'));var jsforce=require(_0x3a0d('0xd'));var deskjs=require(_0x3a0d('0xe'));var toCsv=require(_0x3a0d('0x8'));var querystring=require(_0x3a0d('0xf'));var Papa=require(_0x3a0d('0x10'));var Redis=require(_0x3a0d('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3a0d('0x12'));var hardwareService=require(_0x3a0d('0x13'));var logger=require(_0x3a0d('0x14'))(_0x3a0d('0x15'));var utils=require(_0x3a0d('0x16'));var config=require(_0x3a0d('0x17'));var licenseUtil=require(_0x3a0d('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4171a0,_0x17a7f6){_0x17a7f6=_0x17a7f6||0xcc;return function(_0x4c5b3f){if(_0x4c5b3f){return _0x4171a0['sendStatus'](_0x17a7f6);}return _0x4171a0[_0x3a0d('0x19')](_0x17a7f6)[_0x3a0d('0x1a')]();};}function respondWithResult(_0x145431,_0x527d49){_0x527d49=_0x527d49||0xc8;return function(_0x190208){if(_0x190208){return _0x145431['status'](_0x527d49)[_0x3a0d('0x1b')](_0x190208);}};}function respondWithFilteredResult(_0x326fe2,_0x30111c){return function(_0x27c327){if(_0x27c327){var _0x14c9a=typeof _0x30111c['offset']===_0x3a0d('0x1c')&&typeof _0x30111c['limit']==='undefined';var _0x3fb59d=_0x27c327[_0x3a0d('0x1d')];var _0x50a10c=_0x14c9a?0x0:_0x30111c[_0x3a0d('0x1e')];var _0xffab65=_0x14c9a?_0x27c327[_0x3a0d('0x1d')]:_0x30111c[_0x3a0d('0x1e')]+_0x30111c[_0x3a0d('0x1f')];var _0x25f8ee;if(_0xffab65>=_0x3fb59d){_0xffab65=_0x3fb59d;_0x25f8ee=0xc8;}else{_0x25f8ee=0xce;}_0x326fe2[_0x3a0d('0x19')](_0x25f8ee);return _0x326fe2['set'](_0x3a0d('0x20'),_0x50a10c+'-'+_0xffab65+'/'+_0x3fb59d)[_0x3a0d('0x1b')](_0x27c327);}return null;};}function patchUpdates(_0x4b5a99){return function(_0x2195ee){try{jsonpatch[_0x3a0d('0x21')](_0x2195ee,_0x4b5a99,!![]);}catch(_0x371def){return BPromise[_0x3a0d('0x22')](_0x371def);}return _0x2195ee['save']();};}function saveUpdates(_0x2029c1,_0x4a79d5){return function(_0x44cbe2){if(_0x44cbe2){return _0x44cbe2[_0x3a0d('0x23')](_0x2029c1)[_0x3a0d('0x24')](function(_0x584b37){return _0x584b37;});}return null;};}function removeEntity(_0x3577be,_0x49bcca){return function(_0x24d5c5){if(_0x24d5c5){return _0x24d5c5[_0x3a0d('0x25')]()['then'](function(){_0x3577be['status'](0xcc)[_0x3a0d('0x1a')]();});}};}function handleEntityNotFound(_0x45fb90,_0x38aafb){return function(_0x1f2c2d){if(!_0x1f2c2d){_0x45fb90[_0x3a0d('0x26')](0x194);}return _0x1f2c2d;};}function handleError(_0x17dc45,_0x5c5f95){_0x5c5f95=_0x5c5f95||0x1f4;return function(_0x55d5c1){logger[_0x3a0d('0x27')](_0x55d5c1[_0x3a0d('0x28')]);if(_0x55d5c1[_0x3a0d('0x29')]){delete _0x55d5c1['name'];}_0x17dc45[_0x3a0d('0x19')](_0x5c5f95)[_0x3a0d('0x2a')](_0x55d5c1);};}exports[_0x3a0d('0x2b')]=function(_0x355708,_0x997adb){var _0x286b38={},_0xb72a19={},_0x5b272d={'count':0x0,'rows':[]};var _0x4e8358=_[_0x3a0d('0x2c')](db['Attachment'][_0x3a0d('0x2d')],function(_0x2d27d1){return{'name':_0x2d27d1[_0x3a0d('0x2e')],'type':_0x2d27d1[_0x3a0d('0x2f')][_0x3a0d('0x30')]};});_0xb72a19[_0x3a0d('0x31')]=_[_0x3a0d('0x2c')](_0x4e8358,_0x3a0d('0x29'));_0xb72a19['query']=_[_0x3a0d('0x32')](_0x355708['query']);_0xb72a19[_0x3a0d('0x33')]=_[_0x3a0d('0x34')](_0xb72a19[_0x3a0d('0x31')],_0xb72a19[_0x3a0d('0x35')]);_0x286b38[_0x3a0d('0x36')]=_[_0x3a0d('0x34')](_0xb72a19[_0x3a0d('0x31')],qs['fields'](_0x355708[_0x3a0d('0x35')][_0x3a0d('0x37')]));_0x286b38[_0x3a0d('0x36')]=_0x286b38[_0x3a0d('0x36')][_0x3a0d('0x38')]?_0x286b38[_0x3a0d('0x36')]:_0xb72a19['model'];if(!_0x355708['query'][_0x3a0d('0x39')]('nolimit')){_0x286b38[_0x3a0d('0x1f')]=qs[_0x3a0d('0x1f')](_0x355708[_0x3a0d('0x35')][_0x3a0d('0x1f')]);_0x286b38[_0x3a0d('0x1e')]=qs[_0x3a0d('0x1e')](_0x355708[_0x3a0d('0x35')][_0x3a0d('0x1e')]);}_0x286b38['order']=qs['sort'](_0x355708[_0x3a0d('0x35')][_0x3a0d('0x3a')]);_0x286b38[_0x3a0d('0x3b')]=qs[_0x3a0d('0x33')](_[_0x3a0d('0x3c')](_0x355708[_0x3a0d('0x35')],_0xb72a19[_0x3a0d('0x33')]),_0x4e8358);if(_0x355708[_0x3a0d('0x35')][_0x3a0d('0x3d')]){_0x286b38['where']=_['merge'](_0x286b38[_0x3a0d('0x3b')],{'$or':_[_0x3a0d('0x2c')](_0x4e8358,function(_0x1c3061){if(_0x1c3061[_0x3a0d('0x2f')]!==_0x3a0d('0x3e')){var _0x131d1d={};_0x131d1d[_0x1c3061[_0x3a0d('0x29')]]={'$like':'%'+_0x355708[_0x3a0d('0x35')]['filter']+'%'};return _0x131d1d;}})});}_0x286b38=_[_0x3a0d('0x3f')]({},_0x286b38,_0x355708['options']);var _0x25bb6b={'where':_0x286b38[_0x3a0d('0x3b')]};return db['Attachment']['count'](_0x25bb6b)[_0x3a0d('0x24')](function(_0x24caec){_0x5b272d['count']=_0x24caec;if(_0x355708[_0x3a0d('0x35')][_0x3a0d('0x40')]){_0x286b38[_0x3a0d('0x41')]=[{'all':!![]}];}return db[_0x3a0d('0x42')][_0x3a0d('0x43')](_0x286b38);})[_0x3a0d('0x24')](function(_0x4b9577){_0x5b272d[_0x3a0d('0x44')]=_0x4b9577;return _0x5b272d;})[_0x3a0d('0x24')](respondWithFilteredResult(_0x997adb,_0x286b38))[_0x3a0d('0x45')](handleError(_0x997adb,null));};exports[_0x3a0d('0x46')]=function(_0x4490c0,_0x1b0026){var _0x2a8857={'raw':!![],'where':{'id':_0x4490c0[_0x3a0d('0x47')]['id']}},_0x48893b={};_0x48893b[_0x3a0d('0x31')]=_['keys'](db[_0x3a0d('0x42')][_0x3a0d('0x2d')]);_0x48893b[_0x3a0d('0x35')]=_[_0x3a0d('0x32')](_0x4490c0[_0x3a0d('0x35')]);_0x48893b[_0x3a0d('0x33')]=_['intersection'](_0x48893b[_0x3a0d('0x31')],_0x48893b[_0x3a0d('0x35')]);_0x2a8857[_0x3a0d('0x36')]=_[_0x3a0d('0x34')](_0x48893b[_0x3a0d('0x31')],qs[_0x3a0d('0x37')](_0x4490c0[_0x3a0d('0x35')][_0x3a0d('0x37')]));_0x2a8857['attributes']=_0x2a8857[_0x3a0d('0x36')][_0x3a0d('0x38')]?_0x2a8857['attributes']:_0x48893b['model'];if(_0x4490c0[_0x3a0d('0x35')][_0x3a0d('0x40')]){_0x2a8857['include']=[{'all':!![]}];}_0x2a8857=_[_0x3a0d('0x3f')]({},_0x2a8857,_0x4490c0[_0x3a0d('0x48')]);return db[_0x3a0d('0x42')][_0x3a0d('0x49')](_0x2a8857)['then'](handleEntityNotFound(_0x1b0026,null))['then'](respondWithResult(_0x1b0026,null))[_0x3a0d('0x45')](handleError(_0x1b0026,null));};exports[_0x3a0d('0x4a')]=function(_0x502bba,_0x56893d){var _0x130742={'where':{'id':_0x502bba[_0x3a0d('0x47')]['id']}},_0xa5cbf4={};_0xa5cbf4[_0x3a0d('0x31')]=_['keys'](db[_0x3a0d('0x42')][_0x3a0d('0x2d')]);_0x130742[_0x3a0d('0x36')]=_[_0x3a0d('0x34')](_0xa5cbf4[_0x3a0d('0x31')],qs[_0x3a0d('0x37')](_0x502bba[_0x3a0d('0x35')][_0x3a0d('0x37')]));_0x130742[_0x3a0d('0x36')]=_0x130742[_0x3a0d('0x36')][_0x3a0d('0x38')]?_0x130742['attributes']:_0xa5cbf4['model'];if(_0x502bba[_0x3a0d('0x35')][_0x3a0d('0x40')]){_0x130742[_0x3a0d('0x41')]=[{'all':!![]}];}_0x130742=_[_0x3a0d('0x3f')]({},_0x130742,_0x502bba[_0x3a0d('0x48')]);return db[_0x3a0d('0x42')][_0x3a0d('0x49')](_0x130742)[_0x3a0d('0x24')](handleEntityNotFound(_0x56893d,null))[_0x3a0d('0x24')](function(_0x1eb919){if(_0x1eb919){var _0x51c566=_0x1eb919[_0x3a0d('0x4b')]({'plain':!![]});_0x51c566=qs[_0x3a0d('0x4c')](_0x51c566,['id',_0x3a0d('0x4d'),_0x3a0d('0x4e')]);_0x502bba[_0x3a0d('0x4f')]=_[_0x3a0d('0x4c')](_0x502bba[_0x3a0d('0x4f')],['id','createdAt',_0x3a0d('0x4e')]);return db['Attachment']['create'](_[_0x3a0d('0x3f')](_0x51c566,_0x502bba[_0x3a0d('0x4f')]),{'include':_0x502bba[_0x3a0d('0x35')]['includeAll']?[{'all':!![]}]:undefined});}})[_0x3a0d('0x24')](respondWithResult(_0x56893d,0xc9))['catch'](handleError(_0x56893d,null));};exports['update']=function(_0x24a76a,_0x5dfcf3){if(_0x24a76a[_0x3a0d('0x4f')]['id']){delete _0x24a76a[_0x3a0d('0x4f')]['id'];}return db['Attachment'][_0x3a0d('0x49')]({'where':{'id':_0x24a76a[_0x3a0d('0x47')]['id']}})[_0x3a0d('0x24')](handleEntityNotFound(_0x5dfcf3,null))[_0x3a0d('0x24')](saveUpdates(_0x24a76a[_0x3a0d('0x4f')],null))[_0x3a0d('0x24')](respondWithResult(_0x5dfcf3,null))[_0x3a0d('0x45')](handleError(_0x5dfcf3,null));};exports[_0x3a0d('0x25')]=function(_0x32bb39,_0x3f30c2){return db[_0x3a0d('0x42')][_0x3a0d('0x49')]({'where':{'id':_0x32bb39[_0x3a0d('0x47')]['id']}})[_0x3a0d('0x24')](handleEntityNotFound(_0x3f30c2,null))[_0x3a0d('0x24')](removeEntity(_0x3f30c2,null))['catch'](handleError(_0x3f30c2,null));};exports[_0x3a0d('0x50')]=function(_0x38f628,_0x302838,_0x19f59b){_0x38f628[_0x3a0d('0x4f')][_0x3a0d('0x29')]=_0x38f628[_0x3a0d('0x51')]['originalname'];_0x38f628['body']['basename']=_0x38f628[_0x3a0d('0x51')]['filename'];_0x38f628[_0x3a0d('0x4f')][_0x3a0d('0x2f')]=_0x38f628[_0x3a0d('0x51')][_0x3a0d('0x52')];return db[_0x3a0d('0x42')][_0x3a0d('0x50')](_0x38f628['body'])[_0x3a0d('0x24')](respondWithResult(_0x302838,0xc9))[_0x3a0d('0x45')](handleError(_0x302838,null));};exports['download']=function(_0x5b50e6,_0x2b97f6,_0x301a4e){return db[_0x3a0d('0x42')]['findOne']({'where':{'id':_0x5b50e6[_0x3a0d('0x47')]['id']},'raw':!![]})[_0x3a0d('0x24')](handleEntityNotFound(_0x2b97f6,null))[_0x3a0d('0x24')](function(_0x445659){if(_0x445659){var _0x1d2e77=_0x445659[_0x3a0d('0x53')]!==null;var _0x379132=path[_0x3a0d('0x54')](config['root'],_0x3a0d('0x55'));if(_0x1d2e77){_0x379132=path[_0x3a0d('0x54')](_0x379132,_0x3a0d('0x56'));}var _0xdad1f8=path[_0x3a0d('0x54')](_0x379132,_0x445659['basename']);return _0x2b97f6['download'](_0xdad1f8);}})[_0x3a0d('0x45')](handleError(_0x2b97f6,null));}; \ No newline at end of file +var _0x9512=['where','merge','filter','includeAll','include','findAll','rows','catch','length','options','find','clone','params','get','omit','updatedAt','body','createdAt','update','file','originalname','basename','create','download','findOne','ChatOfflineMessageId','server/files/attachments/','join','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','end','error','name','index','Attachment','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','sort'];(function(_0x52740f,_0x343961){var _0x1cbe11=function(_0x376976){while(--_0x376976){_0x52740f['push'](_0x52740f['shift']());}};_0x1cbe11(++_0x343961);}(_0x9512,0x10c));var _0x2951=function(_0x36f2b2,_0x4dea08){_0x36f2b2=_0x36f2b2-0x0;var _0x4a0f99=_0x9512[_0x36f2b2];return _0x4a0f99;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2951('0x0'));var zipdir=require(_0x2951('0x1'));var jsonpatch=require(_0x2951('0x2'));var rp=require(_0x2951('0x3'));var moment=require(_0x2951('0x4'));var BPromise=require(_0x2951('0x5'));var Mustache=require('mustache');var util=require(_0x2951('0x6'));var path=require(_0x2951('0x7'));var sox=require('sox');var csv=require(_0x2951('0x8'));var ejs=require(_0x2951('0x9'));var fs=require('fs');var fs_extra=require(_0x2951('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2951('0xb'));var deskjs=require(_0x2951('0xc'));var toCsv=require(_0x2951('0x8'));var querystring=require(_0x2951('0xd'));var Papa=require(_0x2951('0xe'));var Redis=require('ioredis');var authService=require(_0x2951('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x2951('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2951('0x11'));var utils=require(_0x2951('0x12'));var config=require(_0x2951('0x13'));var licenseUtil=require(_0x2951('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5817fc,_0x49789f){_0x49789f=_0x49789f||0xcc;return function(_0x5b6ad4){if(_0x5b6ad4){return _0x5817fc[_0x2951('0x15')](_0x49789f);}return _0x5817fc[_0x2951('0x16')](_0x49789f)['end']();};}function respondWithResult(_0x4dd42b,_0x223a4d){_0x223a4d=_0x223a4d||0xc8;return function(_0x5b8789){if(_0x5b8789){return _0x4dd42b[_0x2951('0x16')](_0x223a4d)['json'](_0x5b8789);}};}function respondWithFilteredResult(_0x4c25cf,_0x2afc1e){return function(_0xae8f20){if(_0xae8f20){var _0x19d85f=typeof _0x2afc1e[_0x2951('0x17')]===_0x2951('0x18')&&typeof _0x2afc1e['limit']===_0x2951('0x18');var _0x9f560d=_0xae8f20[_0x2951('0x19')];var _0x13141a=_0x19d85f?0x0:_0x2afc1e[_0x2951('0x17')];var _0x575da8=_0x19d85f?_0xae8f20[_0x2951('0x19')]:_0x2afc1e[_0x2951('0x17')]+_0x2afc1e[_0x2951('0x1a')];var _0x152ade;if(_0x575da8>=_0x9f560d){_0x575da8=_0x9f560d;_0x152ade=0xc8;}else{_0x152ade=0xce;}_0x4c25cf[_0x2951('0x16')](_0x152ade);return _0x4c25cf[_0x2951('0x1b')](_0x2951('0x1c'),_0x13141a+'-'+_0x575da8+'/'+_0x9f560d)['json'](_0xae8f20);}return null;};}function patchUpdates(_0x4efadd){return function(_0x21f03c){try{jsonpatch[_0x2951('0x1d')](_0x21f03c,_0x4efadd,!![]);}catch(_0xafa8b9){return BPromise['reject'](_0xafa8b9);}return _0x21f03c[_0x2951('0x1e')]();};}function saveUpdates(_0x215e15,_0x2973e8){return function(_0x1e7234){if(_0x1e7234){return _0x1e7234['update'](_0x215e15)[_0x2951('0x1f')](function(_0x3e5e3d){return _0x3e5e3d;});}return null;};}function removeEntity(_0x491411,_0x4e4936){return function(_0x794f5){if(_0x794f5){return _0x794f5[_0x2951('0x20')]()[_0x2951('0x1f')](function(){_0x491411[_0x2951('0x16')](0xcc)[_0x2951('0x21')]();});}};}function handleEntityNotFound(_0x2acf63,_0x3af701){return function(_0x5c4987){if(!_0x5c4987){_0x2acf63[_0x2951('0x15')](0x194);}return _0x5c4987;};}function handleError(_0x10fefd,_0x5204f3){_0x5204f3=_0x5204f3||0x1f4;return function(_0x55e129){logger[_0x2951('0x22')](_0x55e129['stack']);if(_0x55e129[_0x2951('0x23')]){delete _0x55e129[_0x2951('0x23')];}_0x10fefd['status'](_0x5204f3)['send'](_0x55e129);};}exports[_0x2951('0x24')]=function(_0x3f2e74,_0x124c8b){var _0x3f936e={},_0x258be7={},_0x30fd2a={'count':0x0,'rows':[]};var _0x12c2f9=_['map'](db[_0x2951('0x25')][_0x2951('0x26')],function(_0x469270){return{'name':_0x469270[_0x2951('0x27')],'type':_0x469270[_0x2951('0x28')][_0x2951('0x29')]};});_0x258be7[_0x2951('0x2a')]=_[_0x2951('0x2b')](_0x12c2f9,'name');_0x258be7['query']=_[_0x2951('0x2c')](_0x3f2e74[_0x2951('0x2d')]);_0x258be7[_0x2951('0x2e')]=_[_0x2951('0x2f')](_0x258be7[_0x2951('0x2a')],_0x258be7[_0x2951('0x2d')]);_0x3f936e[_0x2951('0x30')]=_[_0x2951('0x2f')](_0x258be7['model'],qs[_0x2951('0x31')](_0x3f2e74[_0x2951('0x2d')][_0x2951('0x31')]));_0x3f936e[_0x2951('0x30')]=_0x3f936e[_0x2951('0x30')]['length']?_0x3f936e[_0x2951('0x30')]:_0x258be7['model'];if(!_0x3f2e74['query'][_0x2951('0x32')]('nolimit')){_0x3f936e[_0x2951('0x1a')]=qs[_0x2951('0x1a')](_0x3f2e74[_0x2951('0x2d')]['limit']);_0x3f936e[_0x2951('0x17')]=qs['offset'](_0x3f2e74[_0x2951('0x2d')]['offset']);}_0x3f936e['order']=qs[_0x2951('0x33')](_0x3f2e74[_0x2951('0x2d')][_0x2951('0x33')]);_0x3f936e[_0x2951('0x34')]=qs[_0x2951('0x2e')](_['pick'](_0x3f2e74[_0x2951('0x2d')],_0x258be7['filters']),_0x12c2f9);if(_0x3f2e74['query']['filter']){_0x3f936e[_0x2951('0x34')]=_[_0x2951('0x35')](_0x3f936e['where'],{'$or':_[_0x2951('0x2b')](_0x12c2f9,function(_0x5f2dd3){if(_0x5f2dd3[_0x2951('0x28')]!=='VIRTUAL'){var _0x565832={};_0x565832[_0x5f2dd3[_0x2951('0x23')]]={'$like':'%'+_0x3f2e74[_0x2951('0x2d')][_0x2951('0x36')]+'%'};return _0x565832;}})});}_0x3f936e=_['merge']({},_0x3f936e,_0x3f2e74['options']);var _0x19b3f9={'where':_0x3f936e['where']};return db[_0x2951('0x25')][_0x2951('0x19')](_0x19b3f9)[_0x2951('0x1f')](function(_0xfb67dc){_0x30fd2a[_0x2951('0x19')]=_0xfb67dc;if(_0x3f2e74[_0x2951('0x2d')][_0x2951('0x37')]){_0x3f936e[_0x2951('0x38')]=[{'all':!![]}];}return db[_0x2951('0x25')][_0x2951('0x39')](_0x3f936e);})[_0x2951('0x1f')](function(_0x55ccab){_0x30fd2a[_0x2951('0x3a')]=_0x55ccab;return _0x30fd2a;})[_0x2951('0x1f')](respondWithFilteredResult(_0x124c8b,_0x3f936e))[_0x2951('0x3b')](handleError(_0x124c8b,null));};exports['show']=function(_0x24fc13,_0x30b045){var _0x2fb0a4={'raw':!![],'where':{'id':_0x24fc13['params']['id']}},_0x569772={};_0x569772[_0x2951('0x2a')]=_['keys'](db[_0x2951('0x25')][_0x2951('0x26')]);_0x569772[_0x2951('0x2d')]=_['keys'](_0x24fc13[_0x2951('0x2d')]);_0x569772[_0x2951('0x2e')]=_[_0x2951('0x2f')](_0x569772['model'],_0x569772['query']);_0x2fb0a4[_0x2951('0x30')]=_[_0x2951('0x2f')](_0x569772['model'],qs[_0x2951('0x31')](_0x24fc13[_0x2951('0x2d')][_0x2951('0x31')]));_0x2fb0a4[_0x2951('0x30')]=_0x2fb0a4[_0x2951('0x30')][_0x2951('0x3c')]?_0x2fb0a4[_0x2951('0x30')]:_0x569772[_0x2951('0x2a')];if(_0x24fc13[_0x2951('0x2d')][_0x2951('0x37')]){_0x2fb0a4[_0x2951('0x38')]=[{'all':!![]}];}_0x2fb0a4=_[_0x2951('0x35')]({},_0x2fb0a4,_0x24fc13[_0x2951('0x3d')]);return db[_0x2951('0x25')][_0x2951('0x3e')](_0x2fb0a4)[_0x2951('0x1f')](handleEntityNotFound(_0x30b045,null))[_0x2951('0x1f')](respondWithResult(_0x30b045,null))['catch'](handleError(_0x30b045,null));};exports[_0x2951('0x3f')]=function(_0x2917c1,_0x504aa6){var _0x4af606={'where':{'id':_0x2917c1[_0x2951('0x40')]['id']}},_0x54972a={};_0x54972a[_0x2951('0x2a')]=_[_0x2951('0x2c')](db[_0x2951('0x25')][_0x2951('0x26')]);_0x4af606['attributes']=_[_0x2951('0x2f')](_0x54972a[_0x2951('0x2a')],qs['fields'](_0x2917c1['query'][_0x2951('0x31')]));_0x4af606[_0x2951('0x30')]=_0x4af606['attributes']['length']?_0x4af606['attributes']:_0x54972a['model'];if(_0x2917c1[_0x2951('0x2d')][_0x2951('0x37')]){_0x4af606['include']=[{'all':!![]}];}_0x4af606=_['merge']({},_0x4af606,_0x2917c1['options']);return db[_0x2951('0x25')][_0x2951('0x3e')](_0x4af606)[_0x2951('0x1f')](handleEntityNotFound(_0x504aa6,null))[_0x2951('0x1f')](function(_0x3a0d3e){if(_0x3a0d3e){var _0x420b6=_0x3a0d3e[_0x2951('0x41')]({'plain':!![]});_0x420b6=qs[_0x2951('0x42')](_0x420b6,['id','createdAt',_0x2951('0x43')]);_0x2917c1[_0x2951('0x44')]=_[_0x2951('0x42')](_0x2917c1[_0x2951('0x44')],['id',_0x2951('0x45'),_0x2951('0x43')]);return db[_0x2951('0x25')]['create'](_[_0x2951('0x35')](_0x420b6,_0x2917c1[_0x2951('0x44')]),{'include':_0x2917c1[_0x2951('0x2d')][_0x2951('0x37')]?[{'all':!![]}]:undefined});}})[_0x2951('0x1f')](respondWithResult(_0x504aa6,0xc9))['catch'](handleError(_0x504aa6,null));};exports[_0x2951('0x46')]=function(_0x1657fb,_0x3a86ff){if(_0x1657fb[_0x2951('0x44')]['id']){delete _0x1657fb[_0x2951('0x44')]['id'];}return db[_0x2951('0x25')]['find']({'where':{'id':_0x1657fb[_0x2951('0x40')]['id']}})[_0x2951('0x1f')](handleEntityNotFound(_0x3a86ff,null))[_0x2951('0x1f')](saveUpdates(_0x1657fb[_0x2951('0x44')],null))['then'](respondWithResult(_0x3a86ff,null))[_0x2951('0x3b')](handleError(_0x3a86ff,null));};exports[_0x2951('0x20')]=function(_0x3c675,_0x49a66e){return db[_0x2951('0x25')][_0x2951('0x3e')]({'where':{'id':_0x3c675['params']['id']}})['then'](handleEntityNotFound(_0x49a66e,null))['then'](removeEntity(_0x49a66e,null))[_0x2951('0x3b')](handleError(_0x49a66e,null));};exports['create']=function(_0x399132,_0x2e563c,_0x326b43){_0x399132[_0x2951('0x44')][_0x2951('0x23')]=_0x399132[_0x2951('0x47')][_0x2951('0x48')];_0x399132['body'][_0x2951('0x49')]=_0x399132[_0x2951('0x47')]['filename'];_0x399132[_0x2951('0x44')]['type']=_0x399132[_0x2951('0x47')]['mimetype'];return db[_0x2951('0x25')][_0x2951('0x4a')](_0x399132['body'])[_0x2951('0x1f')](respondWithResult(_0x2e563c,0xc9))[_0x2951('0x3b')](handleError(_0x2e563c,null));};exports[_0x2951('0x4b')]=function(_0x4745bf,_0x1937ca,_0xd070ce){return db[_0x2951('0x25')][_0x2951('0x4c')]({'where':{'id':_0x4745bf['params']['id']},'raw':!![]})[_0x2951('0x1f')](handleEntityNotFound(_0x1937ca,null))[_0x2951('0x1f')](function(_0x520998){if(_0x520998){var _0x37d85f=_0x520998[_0x2951('0x4d')]!==null;var _0x3e778e=path['join'](config['root'],_0x2951('0x4e'));if(_0x37d85f){_0x3e778e=path[_0x2951('0x4f')](_0x3e778e,'offline-chat/');}var _0x49ceb4=path[_0x2951('0x4f')](_0x3e778e,_0x520998[_0x2951('0x49')]);return _0x1937ca['download'](_0x49ceb4);}})[_0x2951('0x3b')](handleError(_0x1937ca,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 552af8d..8e5eb5a 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 _0x53d6=['path','rimraf','./attachment.attributes','exports','define','Attachment','attachments','lodash','util','../../config/logger','api'];(function(_0x4c5f3e,_0x3c6f97){var _0x31ca51=function(_0x110c29){while(--_0x110c29){_0x4c5f3e['push'](_0x4c5f3e['shift']());}};_0x31ca51(++_0x3c6f97);}(_0x53d6,0xee));var _0x653d=function(_0x37222f,_0x25a5ab){_0x37222f=_0x37222f-0x0;var _0x5c5a6d=_0x53d6[_0x37222f];return _0x5c5a6d;};'use strict';var _=require(_0x653d('0x0'));var util=require(_0x653d('0x1'));var logger=require(_0x653d('0x2'))(_0x653d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x653d('0x4'));var rimraf=require(_0x653d('0x5'));var config=require('../../config/environment');var attributes=require(_0x653d('0x6'));module[_0x653d('0x7')]=function(_0x164de5,_0x52d5af){return _0x164de5[_0x653d('0x8')](_0x653d('0x9'),attributes,{'tableName':_0x653d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4db4=['../../config/logger','bluebird','request-promise','path','../../config/environment','./attachment.attributes','exports','attachments','lodash','util'];(function(_0x11973d,_0x68c443){var _0x2875e3=function(_0x597cda){while(--_0x597cda){_0x11973d['push'](_0x11973d['shift']());}};_0x2875e3(++_0x68c443);}(_0x4db4,0x120));var _0x44db=function(_0x290cd2,_0x3c81cc){_0x290cd2=_0x290cd2-0x0;var _0x572a5d=_0x4db4[_0x290cd2];return _0x572a5d;};'use strict';var _=require(_0x44db('0x0'));var util=require(_0x44db('0x1'));var logger=require(_0x44db('0x2'))('api');var moment=require('moment');var BPromise=require(_0x44db('0x3'));var rp=require(_0x44db('0x4'));var fs=require('fs');var path=require(_0x44db('0x5'));var rimraf=require('rimraf');var config=require(_0x44db('0x6'));var attributes=require(_0x44db('0x7'));module[_0x44db('0x8')]=function(_0x5cebe8,_0x1892ce){return _0x5cebe8['define']('Attachment',attributes,{'tableName':_0x44db('0x9'),'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 24059ef..0d01780 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 _0xfc1e=['message','result','CreateAttachment','create','body','options','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','Attachment,\x20%s,\x20%s','debug','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x33f5d3,_0x4a6141){var _0x9d677e=function(_0x1ee4a4){while(--_0x1ee4a4){_0x33f5d3['push'](_0x33f5d3['shift']());}};_0x9d677e(++_0x4a6141);}(_0xfc1e,0x1c9));var _0xefc1=function(_0xab9f3d,_0xb336fa){_0xab9f3d=_0xab9f3d-0x0;var _0x5283bf=_0xfc1e[_0xab9f3d];return _0x5283bf;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xefc1('0x0'));var rs=require(_0xefc1('0x1'));var fs=require('fs');var Redis=require(_0xefc1('0x2'));var db=require(_0xefc1('0x3'))['db'];var utils=require(_0xefc1('0x4'));var logger=require('../../config/logger')(_0xefc1('0x5'));var config=require(_0xefc1('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xefc1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x38927c,_0x44d15b,_0x3ff4a7){return new BPromise(function(_0x45bec4,_0x77f637){return client[_0xefc1('0x8')](_0x38927c,_0x3ff4a7)[_0xefc1('0x9')](function(_0x244927){logger[_0xefc1('0xa')](_0xefc1('0xb'),_0x44d15b,'request\x20sent');logger[_0xefc1('0xc')](_0xefc1('0xd'),_0x44d15b,_0xefc1('0xe'),JSON[_0xefc1('0xf')](_0x244927));if(_0x244927[_0xefc1('0x10')]){if(_0x244927[_0xefc1('0x10')][_0xefc1('0x11')]===0x1f4){logger[_0xefc1('0x10')](_0xefc1('0xb'),_0x44d15b,_0x244927[_0xefc1('0x10')][_0xefc1('0x12')]);return _0x77f637(_0x244927['error'][_0xefc1('0x12')]);}logger[_0xefc1('0x10')](_0xefc1('0xb'),_0x44d15b,_0x244927[_0xefc1('0x10')][_0xefc1('0x12')]);return _0x45bec4(_0x244927[_0xefc1('0x10')][_0xefc1('0x12')]);}else{logger[_0xefc1('0xa')]('Attachment,\x20%s,\x20%s',_0x44d15b,_0xefc1('0xe'));_0x45bec4(_0x244927[_0xefc1('0x13')][_0xefc1('0x12')]);}})['catch'](function(_0x159adb){logger[_0xefc1('0x10')](_0xefc1('0xb'),_0x44d15b,_0x159adb);_0x77f637(_0x159adb);});});}exports[_0xefc1('0x14')]=function(_0x257914){var _0x38923c=this;return new Promise(function(_0x3b5a6e,_0x126052){return db['Attachment'][_0xefc1('0x15')](_0x257914[_0xefc1('0x16')],{'raw':_0x257914[_0xefc1('0x17')]?_0x257914['options']['raw']===undefined?!![]:![]:!![]})[_0xefc1('0x9')](function(_0x492d7d){logger[_0xefc1('0xa')]('CreateAttachment',_0x257914);logger[_0xefc1('0xc')](_0xefc1('0x14'),_0x257914,JSON['stringify'](_0x492d7d));_0x3b5a6e(_0x492d7d);})[_0xefc1('0x18')](function(_0x2ea108){logger[_0xefc1('0x10')](_0xefc1('0x14'),_0x2ea108[_0xefc1('0x12')],_0x257914);_0x126052(_0x38923c[_0xefc1('0x10')](0x1f4,_0x2ea108['message']));});});}; \ No newline at end of file +var _0x9567=['../../config/utils','../../config/logger','../../config/environment','client','request','then','info','Attachment,\x20%s,\x20%s','debug','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateAttachment','create','options','stringify','lodash','util','moment','bluebird','randomstring'];(function(_0x16f143,_0x813860){var _0x1fff62=function(_0x39edce){while(--_0x39edce){_0x16f143['push'](_0x16f143['shift']());}};_0x1fff62(++_0x813860);}(_0x9567,0xdc));var _0x7956=function(_0x227c3a,_0x44efb){_0x227c3a=_0x227c3a-0x0;var _0x1535e8=_0x9567[_0x227c3a];return _0x1535e8;};'use strict';var _=require(_0x7956('0x0'));var util=require(_0x7956('0x1'));var moment=require(_0x7956('0x2'));var BPromise=require(_0x7956('0x3'));var rs=require(_0x7956('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7956('0x5'));var logger=require(_0x7956('0x6'))('rpc');var config=require(_0x7956('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7956('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1819b6,_0x31b50d,_0x48b2b3){return new BPromise(function(_0x3c213a,_0x50038a){return client[_0x7956('0x9')](_0x1819b6,_0x48b2b3)[_0x7956('0xa')](function(_0x53310c){logger[_0x7956('0xb')](_0x7956('0xc'),_0x31b50d,'request\x20sent');logger[_0x7956('0xd')](_0x7956('0xe'),_0x31b50d,_0x7956('0xf'),JSON['stringify'](_0x53310c));if(_0x53310c[_0x7956('0x10')]){if(_0x53310c[_0x7956('0x10')][_0x7956('0x11')]===0x1f4){logger[_0x7956('0x10')]('Attachment,\x20%s,\x20%s',_0x31b50d,_0x53310c[_0x7956('0x10')][_0x7956('0x12')]);return _0x50038a(_0x53310c[_0x7956('0x10')]['message']);}logger[_0x7956('0x10')](_0x7956('0xc'),_0x31b50d,_0x53310c[_0x7956('0x10')][_0x7956('0x12')]);return _0x3c213a(_0x53310c[_0x7956('0x10')][_0x7956('0x12')]);}else{logger[_0x7956('0xb')](_0x7956('0xc'),_0x31b50d,_0x7956('0xf'));_0x3c213a(_0x53310c[_0x7956('0x13')][_0x7956('0x12')]);}})[_0x7956('0x14')](function(_0x18ae51){logger[_0x7956('0x10')](_0x7956('0xc'),_0x31b50d,_0x18ae51);_0x50038a(_0x18ae51);});});}exports[_0x7956('0x15')]=function(_0x5e6b90){var _0x5c3afb=this;return new Promise(function(_0x10b29c,_0x811122){return db['Attachment'][_0x7956('0x16')](_0x5e6b90['body'],{'raw':_0x5e6b90[_0x7956('0x17')]?_0x5e6b90[_0x7956('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x7956('0xa')](function(_0x2e31cd){logger[_0x7956('0xb')]('CreateAttachment',_0x5e6b90);logger[_0x7956('0xd')]('CreateAttachment',_0x5e6b90,JSON[_0x7956('0x18')](_0x2e31cd));_0x10b29c(_0x2e31cd);})['catch'](function(_0x427500){logger[_0x7956('0x10')](_0x7956('0x15'),_0x427500[_0x7956('0x12')],_0x5e6b90);_0x811122(_0x5c3afb['error'](0x1f4,_0x427500[_0x7956('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index f2ffc2c..6badcea 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 _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(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x5f66,0x1a0));var _0x65f6=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x5f66[_0x122096];return _0x3d1966;};'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 +var _0xadb5=['root','format','%s-%s','originalname','replace','file','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','/:id/clone'];(function(_0x5dcca0,_0x2e3385){var _0x522285=function(_0x1f36e0){while(--_0x1f36e0){_0x5dcca0['push'](_0x5dcca0['shift']());}};_0x522285(++_0x2e3385);}(_0xadb5,0xad));var _0x5adb=function(_0x5b45d9,_0x5cd565){_0x5b45d9=_0x5b45d9-0x0;var _0x13f65f=_0xadb5[_0x5b45d9];return _0x13f65f;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./attachment.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller['clone']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a8f66,_0x1ea238,_0x82e67e){_0x82e67e(null,path['join'](config[_0x5adb('0x10')],'server/files/attachments/'));},'filename':function(_0x2a0b70,_0x5433bf,_0x8cfcc6){_0x8cfcc6(null,util[_0x5adb('0x11')](_0x5adb('0x12'),Date['now'](),_0x5433bf[_0x5adb('0x13')][_0x5adb('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5adb('0xe')]('/',upload['single'](_0x5adb('0x15')),controller['create']);router[_0x5adb('0x16')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x18')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);module[_0x5adb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 8f096df..39d5733 100644 --- a/server/api/authActiveDirectory/authActiveDirectory.controller.js +++ b/server/api/authActiveDirectory/authActiveDirectory.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5358=['clearBlockUser','getLicense','catch','status','send','message','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','passport','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','api','undefined','activedirectory','baseDN','authenticate','error','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','blockDuration','adSsoEnabled','name','password','salt','role','disabled','blocked','blockedAt','online','user','agent','then','add'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x5358,0x67));var _0x8535=function(_0x58729e,_0x3b83cd){_0x58729e=_0x58729e-0x0;var _0x1431ae=_0x5358[_0x58729e];return _0x1431ae;};'use strict';var passport=require(_0x8535('0x0'));var LocalStrategy=require(_0x8535('0x1'))[_0x8535('0x2')];var moment=require(_0x8535('0x3'));var ActiveDirectory=require(_0x8535('0x4'));var BPromise=require(_0x8535('0x5'));var util=require(_0x8535('0x6'));var db=require(_0x8535('0x7'))['db'];var authService=require(_0x8535('0x8'));var utils=require(_0x8535('0x9'));var config=require(_0x8535('0xa'));var logger=require('../../config/logger')(_0x8535('0xb'));function isActiveDirectoryConfigured(_0x146446){var _0x522b1e=![];if(typeof _0x146446['activedirectory']!==_0x8535('0xc')){_0x522b1e=_0x146446[_0x8535('0xd')][_0x8535('0xe')]&&_0x146446[_0x8535('0xd')]['url']&&_0x146446['activedirectory']['domain'];}return _0x522b1e;}function adAuthenticate(_0x53a2d0,_0x3ca508,_0x29456e){return new BPromise(function(_0x1a570d,_0x5a21a7){try{var _0x36bfdf=new ActiveDirectory(_0x53a2d0);_0x36bfdf[_0x8535('0xf')](_0x3ca508,_0x29456e,function(_0x11980e,_0x2797aa){if(_0x11980e){logger[_0x8535('0x10')]('Error\x20authenticate\x20%s:\x20%s',_0x3ca508,util['inspect'](_0x11980e,{'showHidden':![],'depth':null}));_0x5a21a7(_0x8535('0x11'));}else if(!_0x2797aa){logger[_0x8535('0x10')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x3ca508);_0x5a21a7('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x1a570d(_0x2797aa);}});}catch(_0x459c1d){_0x5a21a7(_0x459c1d);}});}function ActiveDirectoryAuthenticate(_0x29bbd3,_0x3665b2,_0x10638a,_0x7bd8e1){var _0xd6b46d,_0x41593f;if(!isActiveDirectoryConfigured(config)){logger[_0x8535('0x10')](_0x8535('0x12'),_0x3665b2);return _0x7bd8e1(null,![],{'message':_0x8535('0x11')});}return db[_0x8535('0x13')][_0x8535('0x14')]({'where':{'id':0x1},'attributes':['adSsoEnabled',_0x8535('0x15')],'raw':!![]})['then'](function(_0x360a7a){_0xd6b46d=_0x360a7a;if(!_0xd6b46d[_0x8535('0x16')]){logger[_0x8535('0x10')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x3665b2);throw new Error(_0x8535('0x11'));}return _0x29bbd3['findOne']({'attributes':['id',_0x8535('0x17'),_0x8535('0x18'),_0x8535('0x19'),_0x8535('0x1a'),_0x8535('0x1b'),_0x8535('0x1c'),_0x8535('0x1d'),_0x8535('0x1e')],'where':{'name':_0x3665b2,'role':{'$or':['admin',_0x8535('0x1f'),_0x8535('0x20')]},'adSsoEnabled':!![]}});})['then'](function(_0x2ed4f7){if(!_0x2ed4f7||_0x2ed4f7&&_0x2ed4f7[_0x8535('0x17')]!==_0x3665b2){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x41593f=_0x2ed4f7;var _0x492618=_0x41593f[_0x8535('0x17')]+'@'+config[_0x8535('0xd')]['domain'];return adAuthenticate(config[_0x8535('0xd')],_0x492618,_0x10638a);})[_0x8535('0x21')](function(_0x43b586){if(_0x41593f['disabled']){throw new Error(_0x8535('0x11'));}if(_0xd6b46d['blockDuration']>0x0){if(_0x41593f[_0x8535('0x1c')]){if(moment(_0x41593f[_0x8535('0x1d')])[_0x8535('0x22')](_0xd6b46d[_0x8535('0x15')],'minutes')>moment()){throw new Error(_0x8535('0x11'));}return utils[_0x8535('0x23')](_0x41593f,0x0,![],null)[_0x8535('0x21')](function(){return utils[_0x8535('0x24')](_0x41593f);})[_0x8535('0x21')](function(){return _0x7bd8e1(null,_0x41593f);});}else{return utils[_0x8535('0x24')](_0x41593f)[_0x8535('0x21')](function(){return _0x7bd8e1(null,_0x41593f);});}}else{return utils[_0x8535('0x24')](_0x41593f)['then'](function(){return _0x7bd8e1(null,_0x41593f);});}})[_0x8535('0x25')](function(_0x4f40d3){return _0x7bd8e1(null,![],_0x4f40d3);});}function handleError(_0x15ef0b,_0x40f2c2,_0x8ede65){return _0x15ef0b[_0x8535('0x26')](_0x40f2c2||0x1f4)[_0x8535('0x27')]({'message':_0x8ede65?_0x8ede65[_0x8535('0x28')]||_0x8ede65:''});}exports['login']=function(_0x41ce3a,_0x57f047,_0x3d68b5){passport[_0x8535('0xf')](_0x8535('0x29'),function(_0x59cf09,_0x3f86bc,_0x273c68){var _0x1a961e=_0x59cf09||_0x273c68;if(_0x1a961e){return handleError(_0x57f047,0x191,_0x1a961e);}if(!_0x3f86bc){return handleError(_0x57f047,0x194,{'message':_0x8535('0x2a')});}else{var _0x24ffa7={'payload':{'id':_0x3f86bc['id'],'role':_0x3f86bc['role']},'options':{'expiresIn':0x15180}};return authService[_0x8535('0x2b')](_0x24ffa7)[_0x8535('0x21')](function(_0x47b9dc){_0x57f047[_0x8535('0x2c')]({'id':_0x3f86bc['id'],'token':_0x47b9dc,'statusCall':'','isAlreadyLogged':_0x3f86bc[_0x8535('0x1e')]});});}})(_0x41ce3a,_0x57f047,_0x3d68b5);};passport[_0x8535('0x2d')](_0x8535('0x29'),new LocalStrategy({'usernameField':_0x8535('0x17'),'passwordField':'password'},function(_0x27a449,_0x3256bc,_0x593e35){return ActiveDirectoryAuthenticate(db['User'],_0x27a449,_0x3256bc,_0x593e35);})); \ No newline at end of file +var _0xa894=['disabled','online','admin','user','agent','then','blockDuration','blockedAt','add','getLicense','catch','status','send','message','login','authenticate','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','passport','passport-local','activedirectory2','bluebird','util','../../components/auth/service','../../config/utils','../../config/environment','api','activedirectory','undefined','baseDN','domain','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','findOne','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xa894,0x1d6));var _0x4a89=function(_0x5d8987,_0x14d054){_0x5d8987=_0x5d8987-0x0;var _0x2997eb=_0xa894[_0x5d8987];return _0x2997eb;};'use strict';var passport=require(_0x4a89('0x0'));var LocalStrategy=require(_0x4a89('0x1'))['Strategy'];var moment=require('moment');var ActiveDirectory=require(_0x4a89('0x2'));var BPromise=require(_0x4a89('0x3'));var util=require(_0x4a89('0x4'));var db=require('../../mysqldb')['db'];var authService=require(_0x4a89('0x5'));var utils=require(_0x4a89('0x6'));var config=require(_0x4a89('0x7'));var logger=require('../../config/logger')(_0x4a89('0x8'));function isActiveDirectoryConfigured(_0xe7bb63){var _0x7ddb6c=![];if(typeof _0xe7bb63[_0x4a89('0x9')]!==_0x4a89('0xa')){_0x7ddb6c=_0xe7bb63[_0x4a89('0x9')][_0x4a89('0xb')]&&_0xe7bb63[_0x4a89('0x9')]['url']&&_0xe7bb63['activedirectory'][_0x4a89('0xc')];}return _0x7ddb6c;}function adAuthenticate(_0x72d745,_0x1d21eb,_0xe47002){return new BPromise(function(_0x562940,_0x3b429f){try{var _0x109180=new ActiveDirectory(_0x72d745);_0x109180['authenticate'](_0x1d21eb,_0xe47002,function(_0x26cc65,_0x5530d3){if(_0x26cc65){logger[_0x4a89('0xd')](_0x4a89('0xe'),_0x1d21eb,util[_0x4a89('0xf')](_0x26cc65,{'showHidden':![],'depth':null}));_0x3b429f(_0x4a89('0x10'));}else if(!_0x5530d3){logger[_0x4a89('0xd')](_0x4a89('0x11'),_0x1d21eb);_0x3b429f(_0x4a89('0x10'));}else{_0x562940(_0x5530d3);}});}catch(_0x4b1c63){_0x3b429f(_0x4b1c63);}});}function ActiveDirectoryAuthenticate(_0x4a147a,_0x1daf5e,_0x3c48d7,_0x34858c){var _0x1a2b83,_0x1f2762;if(!isActiveDirectoryConfigured(config)){logger['error'](_0x4a89('0x12'),_0x1daf5e);return _0x34858c(null,![],{'message':_0x4a89('0x10')});}return db['Setting'][_0x4a89('0x13')]({'where':{'id':0x1},'attributes':[_0x4a89('0x14'),'blockDuration'],'raw':!![]})['then'](function(_0x1c6e23){_0x1a2b83=_0x1c6e23;if(!_0x1a2b83[_0x4a89('0x14')]){logger[_0x4a89('0xd')](_0x4a89('0x15'),_0x1daf5e);throw new Error(_0x4a89('0x10'));}return _0x4a147a[_0x4a89('0x13')]({'attributes':['id',_0x4a89('0x16'),_0x4a89('0x17'),_0x4a89('0x18'),'role',_0x4a89('0x19'),'blocked','blockedAt',_0x4a89('0x1a')],'where':{'name':_0x1daf5e,'role':{'$or':[_0x4a89('0x1b'),_0x4a89('0x1c'),_0x4a89('0x1d')]},'adSsoEnabled':!![]}});})['then'](function(_0x1c1261){if(!_0x1c1261||_0x1c1261&&_0x1c1261[_0x4a89('0x16')]!==_0x1daf5e){throw new Error(_0x4a89('0x10'));}_0x1f2762=_0x1c1261;var _0x561185=_0x1f2762['name']+'@'+config['activedirectory']['domain'];return adAuthenticate(config[_0x4a89('0x9')],_0x561185,_0x3c48d7);})[_0x4a89('0x1e')](function(_0x53eb09){if(_0x1f2762[_0x4a89('0x19')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x1a2b83[_0x4a89('0x1f')]>0x0){if(_0x1f2762['blocked']){if(moment(_0x1f2762[_0x4a89('0x20')])[_0x4a89('0x21')](_0x1a2b83[_0x4a89('0x1f')],'minutes')>moment()){throw new Error(_0x4a89('0x10'));}return utils['clearBlockUser'](_0x1f2762,0x0,![],null)[_0x4a89('0x1e')](function(){return utils[_0x4a89('0x22')](_0x1f2762);})[_0x4a89('0x1e')](function(){return _0x34858c(null,_0x1f2762);});}else{return utils[_0x4a89('0x22')](_0x1f2762)[_0x4a89('0x1e')](function(){return _0x34858c(null,_0x1f2762);});}}else{return utils[_0x4a89('0x22')](_0x1f2762)[_0x4a89('0x1e')](function(){return _0x34858c(null,_0x1f2762);});}})[_0x4a89('0x23')](function(_0x3c8089){return _0x34858c(null,![],_0x3c8089);});}function handleError(_0x42c465,_0x36e2d8,_0x17c0aa){return _0x42c465[_0x4a89('0x24')](_0x36e2d8||0x1f4)[_0x4a89('0x25')]({'message':_0x17c0aa?_0x17c0aa[_0x4a89('0x26')]||_0x17c0aa:''});}exports[_0x4a89('0x27')]=function(_0x59f5ea,_0x4118aa,_0x554e12){passport[_0x4a89('0x28')](_0x4a89('0x29'),function(_0x47045c,_0x23b700,_0x3a40db){var _0x3b5efd=_0x47045c||_0x3a40db;if(_0x3b5efd){return handleError(_0x4118aa,0x191,_0x3b5efd);}if(!_0x23b700){return handleError(_0x4118aa,0x194,{'message':_0x4a89('0x2a')});}else{var _0x55c65a={'payload':{'id':_0x23b700['id'],'role':_0x23b700[_0x4a89('0x2b')]},'options':{'expiresIn':0x15180}};return authService[_0x4a89('0x2c')](_0x55c65a)[_0x4a89('0x1e')](function(_0x5ae2ac){_0x4118aa['json']({'id':_0x23b700['id'],'token':_0x5ae2ac,'statusCall':'','isAlreadyLogged':_0x23b700[_0x4a89('0x1a')]});});}})(_0x59f5ea,_0x4118aa,_0x554e12);};passport['use'](_0x4a89('0x29'),new LocalStrategy({'usernameField':_0x4a89('0x16'),'passwordField':_0x4a89('0x17')},function(_0xfd9a69,_0x4a8881,_0xd3885d){return ActiveDirectoryAuthenticate(db['User'],_0xfd9a69,_0x4a8881,_0xd3885d);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 0c02559..55b722b 100644 --- a/server/api/authActiveDirectory/index.js +++ b/server/api/authActiveDirectory/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdc6c=['Router','./authActiveDirectory.controller','exports','express'];(function(_0x38c083,_0x34663e){var _0x32a398=function(_0x3d88cb){while(--_0x3d88cb){_0x38c083['push'](_0x38c083['shift']());}};_0x32a398(++_0x34663e);}(_0xdc6c,0x1b3));var _0xcdc6=function(_0x391c55,_0x168617){_0x391c55=_0x391c55-0x0;var _0xa434e0=_0xdc6c[_0x391c55];return _0xa434e0;};'use strict';var express=require(_0xcdc6('0x0'));var router=express[_0xcdc6('0x1')]();var controller=require(_0xcdc6('0x2'));router['post']('/',controller['login']);module[_0xcdc6('0x3')]=router; \ No newline at end of file +var _0x3d29=['login','exports','express'];(function(_0x472208,_0x142120){var _0x26926d=function(_0x17d12e){while(--_0x17d12e){_0x472208['push'](_0x472208['shift']());}};_0x26926d(++_0x142120);}(_0x3d29,0x68));var _0x93d2=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x3d29[_0x4d8ed9];return _0x1e2140;};'use strict';var express=require(_0x93d2('0x0'));var router=express['Router']();var controller=require('./authActiveDirectory.controller');router['post']('/',controller[_0x93d2('0x1')]);module[_0x93d2('0x2')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 9f35013..5405914 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 _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x323fa2,_0x4ba631){var _0x277baa=function(_0x4351a6){while(--_0x4351a6){_0x323fa2['push'](_0x323fa2['shift']());}};_0x277baa(++_0x4ba631);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x7a54,0x106));var _0x47a5=function(_0x52f901,_0x53f194){_0x52f901=_0x52f901-0x0;var _0x4da813=_0x7a54[_0x52f901];return _0x4da813;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index d40a97f..0cc4903 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 _0xab6f=['../../components/auth/service','get','/callback','callback','setTokenCookie','express','passport','Router','./authGoogle.controller','../user/user.controller.js'];(function(_0x3f1d8a,_0x373118){var _0x2f139a=function(_0x5a1457){while(--_0x5a1457){_0x3f1d8a['push'](_0x3f1d8a['shift']());}};_0x2f139a(++_0x373118);}(_0xab6f,0x177));var _0xfab6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xab6f[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0xfab6('0x0'));var passport=require(_0xfab6('0x1'));var router=express[_0xfab6('0x2')]();var controller=require(_0xfab6('0x3'));var userController=require(_0xfab6('0x4'));var authService=require(_0xfab6('0x5'));router['get']('/',controller['login']);router[_0xfab6('0x6')](_0xfab6('0x7'),controller[_0xfab6('0x8')],authService['isMiddleware'],userController['login'],authService[_0xfab6('0x9')]);module['exports']=router; \ No newline at end of file +var _0x843f=['exports','passport','Router','../user/user.controller.js','../../components/auth/service','get','isMiddleware','login'];(function(_0x325c4f,_0x5800b4){var _0x431098=function(_0x5be070){while(--_0x5be070){_0x325c4f['push'](_0x325c4f['shift']());}};_0x431098(++_0x5800b4);}(_0x843f,0xd1));var _0xf843=function(_0x14b37c,_0x27d104){_0x14b37c=_0x14b37c-0x0;var _0xc0bc8f=_0x843f[_0x14b37c];return _0xc0bc8f;};'use strict';var express=require('express');var passport=require(_0xf843('0x0'));var router=express[_0xf843('0x1')]();var controller=require('./authGoogle.controller');var userController=require(_0xf843('0x2'));var authService=require(_0xf843('0x3'));router['get']('/',controller['login']);router[_0xf843('0x4')]('/callback',controller['callback'],authService[_0xf843('0x5')],userController[_0xf843('0x6')],authService['setTokenCookie']);module[_0xf843('0x7')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 4fc3b54..be842cd 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 _0x4332=['admin','user','agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockedAt','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','message','status','login','authenticate','local-login','signToken','json','online','Email\x20parameter\x20is\x20missing','generate','body','trim','toLowerCase','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','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','https://','host','send','reset','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','password','previousPasswords','validatePasswordHistory','resetPasswordToken','use','passport','passport-local','jayson/promise','lodash','moment','../../components/auth/service','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','name','salt','role','disabled','blocked','loginAttempts'];(function(_0x356b80,_0x308410){var _0x29309c=function(_0x15628b){while(--_0x15628b){_0x356b80['push'](_0x356b80['shift']());}};_0x29309c(++_0x308410);}(_0x4332,0x1c8));var _0x2433=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4332[_0xa464c9];return _0x3d73c4;};'use strict';var util=require('util');var passport=require(_0x2433('0x0'));var LocalStrategy=require(_0x2433('0x1'))['Strategy'];var jayson=require(_0x2433('0x2'));var _=require(_0x2433('0x3'));var rs=require('randomstring');var moment=require(_0x2433('0x4'));var db=require('../../mysqldb')['db'];var authService=require(_0x2433('0x5'));var utils=require('../../config/utils');var client=jayson[_0x2433('0x6')][_0x2433('0x7')]({'port':0x232b});function localAuthenticate(_0x418e6e,_0x581b21,_0x4fd84a,_0x55dacc){var _0x185644,_0x3c1a29;return db[_0x2433('0x8')][_0x2433('0x9')]({'where':{'id':0x1},'attributes':[_0x2433('0xa'),_0x2433('0xb')],'raw':!![]})['then'](function(_0x59928c){_0x185644=_0x59928c;return _0x418e6e['findOne']({'attributes':['id',_0x2433('0xc'),'password',_0x2433('0xd'),_0x2433('0xe'),_0x2433('0xf'),_0x2433('0x10'),'blockedAt',_0x2433('0x11')],'where':{'name':_0x581b21,'role':{'$or':[_0x2433('0x12'),_0x2433('0x13'),_0x2433('0x14')]}}});})[_0x2433('0x15')](function(_0x37a979){if(!_0x37a979||_0x37a979&&_0x37a979[_0x2433('0xc')]!==_0x581b21){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x3c1a29=_0x37a979;return _0x3c1a29;}})[_0x2433('0x15')](function(){_0x3c1a29['authenticate'](_0x4fd84a,function(_0x53caf1,_0x283737){var _0x376c7e=_0x3c1a29[_0x2433('0x11')]+0x1;if(_0x53caf1){return _0x55dacc(_0x53caf1);}else if(!_0x283737){if(_0x3c1a29[_0x2433('0xf')]){return _0x55dacc(null,![],{'message':_0x2433('0x16')});}else if(_0x185644['allowedLoginAttempts']>0x0){if(_0x3c1a29['blocked']){if(_0x185644[_0x2433('0xb')]>0x0){if(moment(_0x3c1a29[_0x2433('0x17')])[_0x2433('0x18')](_0x185644[_0x2433('0xb')],_0x2433('0x19'))>moment()){return _0x55dacc(null,![],{'message':_0x2433('0x16')});}else{return utils[_0x2433('0x1a')](_0x3c1a29,_0x376c7e,![],null)[_0x2433('0x15')](function(){return _0x55dacc(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x55dacc(null,![],{'message':_0x2433('0x16')});}}else{if(_0x376c7e>=_0x185644[_0x2433('0xa')]){return utils['clearBlockUser'](_0x3c1a29,0x0,!![],moment())[_0x2433('0x15')](function(){return _0x55dacc(null,![],{'message':_0x2433('0x16')});});}else{return utils[_0x2433('0x1a')](_0x3c1a29,_0x376c7e,![],null)[_0x2433('0x15')](function(){return _0x55dacc(null,![],{'message':_0x2433('0x16')});});}}}else{return _0x55dacc(null,![],{'message':_0x2433('0x16')});}}else{if(_0x3c1a29[_0x2433('0xf')]){return _0x55dacc(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x185644[_0x2433('0xa')]>0x0){if(_0x3c1a29[_0x2433('0x10')]){if(_0x185644[_0x2433('0xb')]>0x0){if(moment(_0x3c1a29[_0x2433('0x17')])[_0x2433('0x18')](_0x185644[_0x2433('0xb')],_0x2433('0x19'))>moment()){return _0x55dacc(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0x3c1a29,0x0,![],null)['then'](function(){return utils[_0x2433('0x1b')](_0x3c1a29);})[_0x2433('0x15')](function(){return _0x55dacc(null,_0x3c1a29);});}}else{return _0x55dacc(null,![],{'message':_0x2433('0x16')});}}else{return utils[_0x2433('0x1a')](_0x3c1a29,0x0,![],null)[_0x2433('0x15')](function(){return utils[_0x2433('0x1b')](_0x3c1a29);})['then'](function(){return _0x55dacc(null,_0x3c1a29);})[_0x2433('0x1c')](function(_0x12f5e1){return _0x55dacc(null,![],_0x12f5e1);});}}else{if(_0x3c1a29[_0x2433('0x10')]){return _0x55dacc(null,![],{'message':_0x2433('0x16')});}else{return utils[_0x2433('0x1b')](_0x3c1a29)['then'](function(){return _0x55dacc(null,_0x3c1a29);});}}}});})[_0x2433('0x1c')](function(_0x496482){return _0x55dacc(null,![],_0x496482);});}function sendServiceMail(_0x269300){return db[_0x2433('0x1d')][_0x2433('0x1e')]({'where':{'service':!![]},'attributes':['id',_0x2433('0xc'),_0x2433('0x1f')],'include':[{'model':db[_0x2433('0x20')],'as':_0x2433('0x21'),'include':[{'model':db[_0x2433('0x22')],'as':_0x2433('0x22')}]}]})[_0x2433('0x15')](function(_0x38e7f9){if(!_0x38e7f9){throw new Error(_0x2433('0x23'));}var _0x3e0271=_0x38e7f9['getSmtpOptions']();var _0x5833de={'account':_0x3e0271,'message':_[_0x2433('0x24')]({'from':util[_0x2433('0x25')](_0x2433('0x26'),_0x38e7f9[_0x2433('0xc')],_0x38e7f9[_0x2433('0x1f')]||_0x38e7f9[_0x2433('0x21')][_0x2433('0x13')])},_0x269300)};return client[_0x2433('0x27')](_0x2433('0x28'),_0x5833de);})[_0x2433('0x15')](function(_0x1469f2){if(_0x1469f2[_0x2433('0x29')]){throw new Error(util[_0x2433('0x25')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x1469f2[_0x2433('0x29')][_0x2433('0x2a')]||JSON['stringify'](_0x1469f2['error'])));}return!![];});}function handleError(_0x2fb72f,_0x483a4b,_0x3e4fae){return _0x2fb72f[_0x2433('0x2b')](_0x483a4b||0x1f4)['send']({'message':_0x3e4fae?_0x3e4fae[_0x2433('0x2a')]||_0x3e4fae:''});}exports[_0x2433('0x2c')]=function(_0xc49cf7,_0x5e318d,_0x38e116){passport[_0x2433('0x2d')](_0x2433('0x2e'),function(_0x2ed1ff,_0xf522db,_0x334df8){var _0xf2cbd8=_0x2ed1ff||_0x334df8;if(_0xf2cbd8){return handleError(_0x5e318d,0x191,_0xf2cbd8);}if(!_0xf522db){return handleError(_0x5e318d,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x24fd3b={'payload':{'id':_0xf522db['id'],'role':_0xf522db[_0x2433('0xe')]},'options':{'expiresIn':0x15180}};return authService[_0x2433('0x2f')](_0x24fd3b)[_0x2433('0x15')](function(_0x5f2838){_0x5e318d[_0x2433('0x30')]({'id':_0xf522db['id'],'token':_0x5f2838,'statusCall':'','isAlreadyLogged':_0xf522db[_0x2433('0x31')]});});}})(_0xc49cf7,_0x5e318d,_0x38e116);};exports['forgot']=function(_0x2bc8a7,_0x3926d6){if(!_0x2bc8a7['body']['email']){return handleError(_0x3926d6,0x1f4,{'message':_0x2433('0x32')});}var _0x1c7bc3=rs[_0x2433('0x33')]();_0x2bc8a7[_0x2433('0x34')][_0x2433('0x1f')]=_0x2bc8a7[_0x2433('0x34')][_0x2433('0x1f')][_0x2433('0x35')]()[_0x2433('0x36')]();var _0x346768;return db['Setting'][_0x2433('0x9')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x2433('0xb')],'raw':!![]})['then'](function(_0x42293e){_0x346768=_0x42293e;return db[_0x2433('0x37')][_0x2433('0x1e')]({'where':{'email':_0x2bc8a7['body'][_0x2433('0x1f')]}});})[_0x2433('0x15')](function(_0x315956){if(!_0x315956){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x315956[_0x2433('0xf')]){throw new Error(_0x2433('0x38'));}if(_0x315956[_0x2433('0x10')]){if(moment(_0x315956[_0x2433('0x17')])[_0x2433('0x18')](_0x346768[_0x2433('0xb')],_0x2433('0x19'))>moment()){throw new Error(_0x2433('0x39'));}else{_0x315956[_0x2433('0x10')]=![];_0x315956['blockedAt']=null;}}_0x315956['resetPasswordToken']=_0x1c7bc3;_0x315956[_0x2433('0x3a')]=Date[_0x2433('0x3b')]()+0x36ee80;return _0x315956[_0x2433('0x3c')]();})[_0x2433('0x15')](function(){return sendServiceMail({'to':_0x2bc8a7[_0x2433('0x34')][_0x2433('0x1f')],'subject':_0x2433('0x3d'),'text':_0x2433('0x3e')+_0x2433('0x3f')+_0x2433('0x40')+_0x2bc8a7['headers'][_0x2433('0x41')]+'/reset/'+_0x1c7bc3+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})['then'](function(){_0x3926d6[_0x2433('0x2b')](0xc8)[_0x2433('0x42')]({'message':'Reset\x20Email\x20sent!'});})[_0x2433('0x1c')](function(_0x58fddf){return handleError(_0x3926d6,0x1f4,_0x58fddf);});};exports[_0x2433('0x43')]=function(_0x236706,_0x2641a0){return db[_0x2433('0x37')][_0x2433('0x1e')]({'where':{'resetPasswordToken':_0x236706[_0x2433('0x44')]['token'],'resetPasswordExpires':{'$gt':Date[_0x2433('0x3b')]()}}})['then'](function(_0x19fa95){if(!_0x19fa95){throw new Error(_0x2433('0x45'));}return db[_0x2433('0x8')][_0x2433('0x9')]({'attributes':['id',_0x2433('0x46'),_0x2433('0x47'),_0x2433('0x48')]})[_0x2433('0x15')](function(_0xceb19f){if(_0xceb19f['securePassword'])authService[_0x2433('0x49')](_0x236706['body'][_0x2433('0x4a')]);if(!_0xceb19f[_0x2433('0x47')]||!_0x19fa95[_0x2433('0x4b')])return _0x19fa95;authService[_0x2433('0x4c')](_0x236706[_0x2433('0x34')][_0x2433('0x4a')],_0x19fa95[_0x2433('0x4b')],_0xceb19f[_0x2433('0x48')]);return _0x19fa95;})[_0x2433('0x15')](function(){_0x19fa95[_0x2433('0x4a')]=_0x236706[_0x2433('0x34')][_0x2433('0x4a')];_0x19fa95[_0x2433('0x4d')]=null;_0x19fa95[_0x2433('0x3a')]=null;return _0x19fa95['save']();});})[_0x2433('0x15')](function(){_0x2641a0[_0x2433('0x2b')](0xc8)[_0x2433('0x42')]({'message':'Password\x20reset!'});})['catch'](function(_0x468437){return handleError(_0x2641a0,0x1f4,_0x468437);});};passport[_0x2433('0x4e')](_0x2433('0x2e'),new LocalStrategy({'usernameField':_0x2433('0xc'),'passwordField':_0x2433('0x4a')},function(_0x57a125,_0x34761d,_0x189dcd){return localAuthenticate(db['User'],_0x57a125,_0x34761d,_0x189dcd);})); \ No newline at end of file +var _0x98fa=['status','send','login','authenticate','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','body','Email\x20parameter\x20is\x20missing','trim','toLowerCase','Setting','User','find','This\x20email\x20is\x20not\x20registered.','disabled','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','host','/reset/','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','validatePasswordPattern','enforcePasswordHistory','validatePasswordHistory','previousPasswords','passwordHistoryLimit','Password\x20reset!','use','util','passport-local','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','http','findOne','blockDuration','password','salt','role','blocked','loginAttempts','admin','user','agent','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','allowedLoginAttempts','add','clearBlockUser','then','blockedAt','minutes','getLicense','catch','MailAccount','email','MailServerOut','Smtp','CloudProvider','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify'];(function(_0x57f3bf,_0x1ec33e){var _0x45176f=function(_0x144ee6){while(--_0x144ee6){_0x57f3bf['push'](_0x57f3bf['shift']());}};_0x45176f(++_0x1ec33e);}(_0x98fa,0xd1));var _0xa98f=function(_0x496377,_0x3a68a4){_0x496377=_0x496377-0x0;var _0x151575=_0x98fa[_0x496377];return _0x151575;};'use strict';var util=require(_0xa98f('0x0'));var passport=require('passport');var LocalStrategy=require(_0xa98f('0x1'))['Strategy'];var jayson=require(_0xa98f('0x2'));var _=require(_0xa98f('0x3'));var rs=require(_0xa98f('0x4'));var moment=require(_0xa98f('0x5'));var db=require(_0xa98f('0x6'))['db'];var authService=require(_0xa98f('0x7'));var utils=require(_0xa98f('0x8'));var client=jayson['client'][_0xa98f('0x9')]({'port':0x232b});function localAuthenticate(_0x693c05,_0x3d90ac,_0x3ba300,_0x1d74e4){var _0x563fcb,_0x2e5fd5;return db['Setting'][_0xa98f('0xa')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xa98f('0xb')],'raw':!![]})['then'](function(_0x561ad1){_0x563fcb=_0x561ad1;return _0x693c05[_0xa98f('0xa')]({'attributes':['id','name',_0xa98f('0xc'),_0xa98f('0xd'),_0xa98f('0xe'),'disabled',_0xa98f('0xf'),'blockedAt',_0xa98f('0x10')],'where':{'name':_0x3d90ac,'role':{'$or':[_0xa98f('0x11'),_0xa98f('0x12'),_0xa98f('0x13')]}}});})['then'](function(_0x32cf46){if(!_0x32cf46||_0x32cf46&&_0x32cf46[_0xa98f('0x14')]!==_0x3d90ac){throw new Error(_0xa98f('0x15'));}else{_0x2e5fd5=_0x32cf46;return _0x2e5fd5;}})['then'](function(){_0x2e5fd5['authenticate'](_0x3ba300,function(_0x2253af,_0x1e4a65){var _0x2c988a=_0x2e5fd5[_0xa98f('0x10')]+0x1;if(_0x2253af){return _0x1d74e4(_0x2253af);}else if(!_0x1e4a65){if(_0x2e5fd5['disabled']){return _0x1d74e4(null,![],{'message':_0xa98f('0x15')});}else if(_0x563fcb[_0xa98f('0x16')]>0x0){if(_0x2e5fd5[_0xa98f('0xf')]){if(_0x563fcb[_0xa98f('0xb')]>0x0){if(moment(_0x2e5fd5['blockedAt'])[_0xa98f('0x17')](_0x563fcb['blockDuration'],'minutes')>moment()){return _0x1d74e4(null,![],{'message':_0xa98f('0x15')});}else{return utils[_0xa98f('0x18')](_0x2e5fd5,_0x2c988a,![],null)[_0xa98f('0x19')](function(){return _0x1d74e4(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x1d74e4(null,![],{'message':_0xa98f('0x15')});}}else{if(_0x2c988a>=_0x563fcb[_0xa98f('0x16')]){return utils['clearBlockUser'](_0x2e5fd5,0x0,!![],moment())[_0xa98f('0x19')](function(){return _0x1d74e4(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0xa98f('0x18')](_0x2e5fd5,_0x2c988a,![],null)[_0xa98f('0x19')](function(){return _0x1d74e4(null,![],{'message':_0xa98f('0x15')});});}}}else{return _0x1d74e4(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x2e5fd5['disabled']){return _0x1d74e4(null,![],{'message':_0xa98f('0x15')});}else if(_0x563fcb[_0xa98f('0x16')]>0x0){if(_0x2e5fd5['blocked']){if(_0x563fcb[_0xa98f('0xb')]>0x0){if(moment(_0x2e5fd5[_0xa98f('0x1a')])[_0xa98f('0x17')](_0x563fcb[_0xa98f('0xb')],_0xa98f('0x1b'))>moment()){return _0x1d74e4(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xa98f('0x18')](_0x2e5fd5,0x0,![],null)[_0xa98f('0x19')](function(){return utils['getLicense'](_0x2e5fd5);})['then'](function(){return _0x1d74e4(null,_0x2e5fd5);});}}else{return _0x1d74e4(null,![],{'message':_0xa98f('0x15')});}}else{return utils[_0xa98f('0x18')](_0x2e5fd5,0x0,![],null)[_0xa98f('0x19')](function(){return utils[_0xa98f('0x1c')](_0x2e5fd5);})[_0xa98f('0x19')](function(){return _0x1d74e4(null,_0x2e5fd5);})[_0xa98f('0x1d')](function(_0xa819f1){return _0x1d74e4(null,![],_0xa819f1);});}}else{if(_0x2e5fd5[_0xa98f('0xf')]){return _0x1d74e4(null,![],{'message':_0xa98f('0x15')});}else{return utils[_0xa98f('0x1c')](_0x2e5fd5)['then'](function(){return _0x1d74e4(null,_0x2e5fd5);});}}}});})['catch'](function(_0x3343d3){return _0x1d74e4(null,![],_0x3343d3);});}function sendServiceMail(_0xd77ee9){return db[_0xa98f('0x1e')]['find']({'where':{'service':!![]},'attributes':['id','name',_0xa98f('0x1f')],'include':[{'model':db[_0xa98f('0x20')],'as':_0xa98f('0x21'),'include':[{'model':db['CloudProvider'],'as':_0xa98f('0x22')}]}]})['then'](function(_0x111d87){if(!_0x111d87){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x10ef82=_0x111d87['getSmtpOptions']();var _0x2b552b={'account':_0x10ef82,'message':_['merge']({'from':util[_0xa98f('0x23')](_0xa98f('0x24'),_0x111d87[_0xa98f('0x14')],_0x111d87[_0xa98f('0x1f')]||_0x111d87[_0xa98f('0x21')][_0xa98f('0x12')])},_0xd77ee9)};return client[_0xa98f('0x25')](_0xa98f('0x26'),_0x2b552b);})[_0xa98f('0x19')](function(_0x3326a9){if(_0x3326a9[_0xa98f('0x27')]){throw new Error(util[_0xa98f('0x23')](_0xa98f('0x28'),_0x3326a9[_0xa98f('0x27')][_0xa98f('0x29')]||JSON[_0xa98f('0x2a')](_0x3326a9['error'])));}return!![];});}function handleError(_0x29edb6,_0x38f091,_0x4399d4){return _0x29edb6[_0xa98f('0x2b')](_0x38f091||0x1f4)[_0xa98f('0x2c')]({'message':_0x4399d4?_0x4399d4[_0xa98f('0x29')]||_0x4399d4:''});}exports[_0xa98f('0x2d')]=function(_0x2589fc,_0x46e317,_0x2b186d){passport[_0xa98f('0x2e')](_0xa98f('0x2f'),function(_0x5c8298,_0x10e057,_0x39a838){var _0x9571ae=_0x5c8298||_0x39a838;if(_0x9571ae){return handleError(_0x46e317,0x191,_0x9571ae);}if(!_0x10e057){return handleError(_0x46e317,0x194,{'message':_0xa98f('0x30')});}else{var _0x59d3f1={'payload':{'id':_0x10e057['id'],'role':_0x10e057[_0xa98f('0xe')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x59d3f1)[_0xa98f('0x19')](function(_0x48eed1){_0x46e317[_0xa98f('0x31')]({'id':_0x10e057['id'],'token':_0x48eed1,'statusCall':'','isAlreadyLogged':_0x10e057[_0xa98f('0x32')]});});}})(_0x2589fc,_0x46e317,_0x2b186d);};exports['forgot']=function(_0x3ef97c,_0x4511a7){if(!_0x3ef97c[_0xa98f('0x33')][_0xa98f('0x1f')]){return handleError(_0x4511a7,0x1f4,{'message':_0xa98f('0x34')});}var _0x36988c=rs['generate']();_0x3ef97c[_0xa98f('0x33')]['email']=_0x3ef97c[_0xa98f('0x33')][_0xa98f('0x1f')][_0xa98f('0x35')]()[_0xa98f('0x36')]();var _0x3a6871;return db[_0xa98f('0x37')][_0xa98f('0xa')]({'where':{'id':0x1},'attributes':[_0xa98f('0x16'),_0xa98f('0xb')],'raw':!![]})[_0xa98f('0x19')](function(_0xa32c63){_0x3a6871=_0xa32c63;return db[_0xa98f('0x38')][_0xa98f('0x39')]({'where':{'email':_0x3ef97c[_0xa98f('0x33')][_0xa98f('0x1f')]}});})[_0xa98f('0x19')](function(_0x3dc207){if(!_0x3dc207){throw new Error(_0xa98f('0x3a'));}if(_0x3dc207[_0xa98f('0x3b')]){throw new Error(_0xa98f('0x3c'));}if(_0x3dc207[_0xa98f('0xf')]){if(moment(_0x3dc207['blockedAt'])[_0xa98f('0x17')](_0x3a6871[_0xa98f('0xb')],'minutes')>moment()){throw new Error(_0xa98f('0x3d'));}else{_0x3dc207[_0xa98f('0xf')]=![];_0x3dc207['blockedAt']=null;}}_0x3dc207[_0xa98f('0x3e')]=_0x36988c;_0x3dc207[_0xa98f('0x3f')]=Date[_0xa98f('0x40')]()+0x36ee80;return _0x3dc207[_0xa98f('0x41')]();})['then'](function(){return sendServiceMail({'to':_0x3ef97c[_0xa98f('0x33')][_0xa98f('0x1f')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0xa98f('0x42')+_0xa98f('0x43')+'https://'+_0x3ef97c[_0xa98f('0x44')][_0xa98f('0x45')]+_0xa98f('0x46')+_0x36988c+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0xa98f('0x19')](function(){_0x4511a7[_0xa98f('0x2b')](0xc8)[_0xa98f('0x2c')]({'message':_0xa98f('0x47')});})[_0xa98f('0x1d')](function(_0x5e017d){return handleError(_0x4511a7,0x1f4,_0x5e017d);});};exports[_0xa98f('0x48')]=function(_0x384c53,_0x111559){return db[_0xa98f('0x38')][_0xa98f('0x39')]({'where':{'resetPasswordToken':_0x384c53[_0xa98f('0x49')][_0xa98f('0x4a')],'resetPasswordExpires':{'$gt':Date[_0xa98f('0x40')]()}}})[_0xa98f('0x19')](function(_0x3aab11){if(!_0x3aab11){throw new Error(_0xa98f('0x4b'));}return db[_0xa98f('0x37')]['findOne']({'attributes':['id',_0xa98f('0x4c'),'enforcePasswordHistory','passwordHistoryLimit']})[_0xa98f('0x19')](function(_0x1cd747){if(_0x1cd747[_0xa98f('0x4c')])authService[_0xa98f('0x4d')](_0x384c53[_0xa98f('0x33')][_0xa98f('0xc')]);if(!_0x1cd747[_0xa98f('0x4e')]||!_0x3aab11['previousPasswords'])return _0x3aab11;authService[_0xa98f('0x4f')](_0x384c53[_0xa98f('0x33')][_0xa98f('0xc')],_0x3aab11[_0xa98f('0x50')],_0x1cd747[_0xa98f('0x51')]);return _0x3aab11;})[_0xa98f('0x19')](function(){_0x3aab11[_0xa98f('0xc')]=_0x384c53[_0xa98f('0x33')][_0xa98f('0xc')];_0x3aab11[_0xa98f('0x3e')]=null;_0x3aab11[_0xa98f('0x3f')]=null;return _0x3aab11[_0xa98f('0x41')]();});})[_0xa98f('0x19')](function(){_0x111559['status'](0xc8)['send']({'message':_0xa98f('0x52')});})[_0xa98f('0x1d')](function(_0x2e4f4a){return handleError(_0x111559,0x1f4,_0x2e4f4a);});};passport[_0xa98f('0x53')](_0xa98f('0x2f'),new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0x16c9b2,_0x560ab5,_0x5030f5){return localAuthenticate(db['User'],_0x16c9b2,_0x560ab5,_0x5030f5);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 8673da7..7b58a62 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 _0x46a1=['/reset/:token','exports','express','post','/forgot','forgot'];(function(_0x945db7,_0x292423){var _0x27b299=function(_0x1b3fdf){while(--_0x1b3fdf){_0x945db7['push'](_0x945db7['shift']());}};_0x27b299(++_0x292423);}(_0x46a1,0x8c));var _0x146a=function(_0x372880,_0x4196d8){_0x372880=_0x372880-0x0;var _0x36dfe8=_0x46a1[_0x372880];return _0x36dfe8;};'use strict';var express=require(_0x146a('0x0'));var router=express['Router']();var controller=require('./authLocal.controller');router[_0x146a('0x1')]('/',controller['login']);router['post'](_0x146a('0x2'),controller[_0x146a('0x3')]);router['post'](_0x146a('0x4'),controller['reset']);module[_0x146a('0x5')]=router; \ No newline at end of file +var _0xc977=['exports','Router','/forgot','forgot','/reset/:token','reset'];(function(_0x2ecb67,_0x8ec62d){var _0x168079=function(_0x56c365){while(--_0x56c365){_0x2ecb67['push'](_0x2ecb67['shift']());}};_0x168079(++_0x8ec62d);}(_0xc977,0xc7));var _0x7c97=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xc977[_0x5ddb1c];return _0x354adc;};'use strict';var express=require('express');var router=express[_0x7c97('0x0')]();var controller=require('./authLocal.controller');router['post']('/',controller['login']);router['post'](_0x7c97('0x1'),controller[_0x7c97('0x2')]);router['post'](_0x7c97('0x3'),controller[_0x7c97('0x4')]);module[_0x7c97('0x5')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 9d49a58..3fc6dcd 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 _0xe335=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xe335,0x113));var _0x5e33=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xe335[_0x46698a];return _0x356db0;};'use strict';var Sequelize=require(_0x5e33('0x0'));module[_0x5e33('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x5e33('0x2')]},'description':{'type':Sequelize[_0x5e33('0x2')]},'status':{'type':Sequelize[_0x5e33('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x5e33('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0xdd26=['BOOLEAN','STRING'];(function(_0x311909,_0x414bf7){var _0x8d3163=function(_0x226f55){while(--_0x226f55){_0x311909['push'](_0x311909['shift']());}};_0x8d3163(++_0x414bf7);}(_0xdd26,0xe9));var _0x6dd2=function(_0x58ef84,_0x3ecc29){_0x58ef84=_0x58ef84-0x0;var _0x17c84a=_0xdd26[_0x58ef84];return _0x17c84a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6dd2('0x0')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x6dd2('0x1')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'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 dd0995b..fcbfad9 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 _0x7a5f=['name','send','index','map','Automation','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','catch','create','body','params','addConditions','Condition','find','ids','findOne','getConditions','addActions','Action','omit','getActions','eml-format','fast-json-patch','bluebird','mustache','util','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','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','then','stack'];(function(_0x3480e9,_0x491e26){var _0x229a4b=function(_0x576e08){while(--_0x576e08){_0x3480e9['push'](_0x3480e9['shift']());}};_0x229a4b(++_0x491e26);}(_0x7a5f,0x12a));var _0xf7a5=function(_0x412c8f,_0x11ec94){_0x412c8f=_0x412c8f-0x0;var _0x27c005=_0x7a5f[_0x412c8f];return _0x27c005;};'use strict';var emlformat=require(_0xf7a5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf7a5('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf7a5('0x2'));var Mustache=require(_0xf7a5('0x3'));var util=require(_0xf7a5('0x4'));var path=require(_0xf7a5('0x5'));var sox=require(_0xf7a5('0x6'));var csv=require(_0xf7a5('0x7'));var ejs=require(_0xf7a5('0x8'));var fs=require('fs');var fs_extra=require(_0xf7a5('0x9'));var _=require('lodash');var squel=require(_0xf7a5('0xa'));var crypto=require(_0xf7a5('0xb'));var jsforce=require(_0xf7a5('0xc'));var deskjs=require(_0xf7a5('0xd'));var toCsv=require(_0xf7a5('0x7'));var querystring=require(_0xf7a5('0xe'));var Papa=require(_0xf7a5('0xf'));var Redis=require(_0xf7a5('0x10'));var authService=require(_0xf7a5('0x11'));var qs=require(_0xf7a5('0x12'));var as=require(_0xf7a5('0x13'));var hardwareService=require(_0xf7a5('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xf7a5('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf7a5('0x16'))['db'];function respondWithStatusCode(_0x492be4,_0x3f87d2){_0x3f87d2=_0x3f87d2||0xcc;return function(_0x4c1a33){if(_0x4c1a33){return _0x492be4[_0xf7a5('0x17')](_0x3f87d2);}return _0x492be4[_0xf7a5('0x18')](_0x3f87d2)[_0xf7a5('0x19')]();};}function respondWithResult(_0x2aabbc,_0x5b173e){_0x5b173e=_0x5b173e||0xc8;return function(_0x687a76){if(_0x687a76){return _0x2aabbc[_0xf7a5('0x18')](_0x5b173e)['json'](_0x687a76);}};}function respondWithFilteredResult(_0x470946,_0x1ca73c){return function(_0x308375){if(_0x308375){var _0x5495b9=typeof _0x1ca73c[_0xf7a5('0x1a')]==='undefined'&&typeof _0x1ca73c[_0xf7a5('0x1b')]===_0xf7a5('0x1c');var _0x452a8d=_0x308375[_0xf7a5('0x1d')];var _0x4ac815=_0x5495b9?0x0:_0x1ca73c['offset'];var _0x251359=_0x5495b9?_0x308375[_0xf7a5('0x1d')]:_0x1ca73c[_0xf7a5('0x1a')]+_0x1ca73c[_0xf7a5('0x1b')];var _0x50de2d;if(_0x251359>=_0x452a8d){_0x251359=_0x452a8d;_0x50de2d=0xc8;}else{_0x50de2d=0xce;}_0x470946[_0xf7a5('0x18')](_0x50de2d);return _0x470946[_0xf7a5('0x1e')](_0xf7a5('0x1f'),_0x4ac815+'-'+_0x251359+'/'+_0x452a8d)[_0xf7a5('0x20')](_0x308375);}return null;};}function patchUpdates(_0x10babe){return function(_0x9af0bc){try{jsonpatch[_0xf7a5('0x21')](_0x9af0bc,_0x10babe,!![]);}catch(_0x486f67){return BPromise[_0xf7a5('0x22')](_0x486f67);}return _0x9af0bc['save']();};}function saveUpdates(_0x2b6821,_0x85c960){return function(_0x2ce023){if(_0x2ce023){return _0x2ce023[_0xf7a5('0x23')](_0x2b6821)['then'](function(_0x171634){return _0x171634;});}return null;};}function removeEntity(_0x438f8f,_0x193066){return function(_0x1d4cd1){if(_0x1d4cd1){return _0x1d4cd1['destroy']()[_0xf7a5('0x24')](function(){_0x438f8f[_0xf7a5('0x18')](0xcc)[_0xf7a5('0x19')]();});}};}function handleEntityNotFound(_0x24ab0e,_0xe3684){return function(_0x290fd9){if(!_0x290fd9){_0x24ab0e[_0xf7a5('0x17')](0x194);}return _0x290fd9;};}function handleError(_0x3b03c9,_0x6d9b95){_0x6d9b95=_0x6d9b95||0x1f4;return function(_0x59e30a){logger['error'](_0x59e30a[_0xf7a5('0x25')]);if(_0x59e30a['name']){delete _0x59e30a[_0xf7a5('0x26')];}_0x3b03c9[_0xf7a5('0x18')](_0x6d9b95)[_0xf7a5('0x27')](_0x59e30a);};}exports[_0xf7a5('0x28')]=function(_0x399ab0,_0x4e3d9d){var _0x452d6b={},_0x32555b={},_0x465a69={'count':0x0,'rows':[]};var _0x7e46be=_[_0xf7a5('0x29')](db[_0xf7a5('0x2a')][_0xf7a5('0x2b')],function(_0x32b0c3){return{'name':_0x32b0c3[_0xf7a5('0x2c')],'type':_0x32b0c3[_0xf7a5('0x2d')][_0xf7a5('0x2e')]};});_0x32555b[_0xf7a5('0x2f')]=_[_0xf7a5('0x29')](_0x7e46be,_0xf7a5('0x26'));_0x32555b['query']=_[_0xf7a5('0x30')](_0x399ab0[_0xf7a5('0x31')]);_0x32555b[_0xf7a5('0x32')]=_[_0xf7a5('0x33')](_0x32555b[_0xf7a5('0x2f')],_0x32555b['query']);_0x452d6b[_0xf7a5('0x34')]=_[_0xf7a5('0x33')](_0x32555b[_0xf7a5('0x2f')],qs['fields'](_0x399ab0['query'][_0xf7a5('0x35')]));_0x452d6b[_0xf7a5('0x34')]=_0x452d6b[_0xf7a5('0x34')][_0xf7a5('0x36')]?_0x452d6b[_0xf7a5('0x34')]:_0x32555b[_0xf7a5('0x2f')];if(!_0x399ab0[_0xf7a5('0x31')][_0xf7a5('0x37')](_0xf7a5('0x38'))){_0x452d6b[_0xf7a5('0x1b')]=qs[_0xf7a5('0x1b')](_0x399ab0[_0xf7a5('0x31')]['limit']);_0x452d6b['offset']=qs[_0xf7a5('0x1a')](_0x399ab0[_0xf7a5('0x31')]['offset']);}_0x452d6b[_0xf7a5('0x39')]=qs[_0xf7a5('0x3a')](_0x399ab0['query'][_0xf7a5('0x3a')]);_0x452d6b[_0xf7a5('0x3b')]=qs['filters'](_[_0xf7a5('0x3c')](_0x399ab0[_0xf7a5('0x31')],_0x32555b[_0xf7a5('0x32')]),_0x7e46be);if(_0x399ab0['query'][_0xf7a5('0x3d')]){_0x452d6b[_0xf7a5('0x3b')]=_['merge'](_0x452d6b[_0xf7a5('0x3b')],{'$or':_[_0xf7a5('0x29')](_0x7e46be,function(_0x35f9c8){if(_0x35f9c8[_0xf7a5('0x2d')]!==_0xf7a5('0x3e')){var _0x40fff6={};_0x40fff6[_0x35f9c8[_0xf7a5('0x26')]]={'$like':'%'+_0x399ab0[_0xf7a5('0x31')][_0xf7a5('0x3d')]+'%'};return _0x40fff6;}})});}_0x452d6b=_[_0xf7a5('0x3f')]({},_0x452d6b,_0x399ab0[_0xf7a5('0x40')]);var _0x2f6f6f={'where':_0x452d6b['where']};return db[_0xf7a5('0x2a')][_0xf7a5('0x1d')](_0x2f6f6f)[_0xf7a5('0x24')](function(_0x491a52){_0x465a69[_0xf7a5('0x1d')]=_0x491a52;if(_0x399ab0[_0xf7a5('0x31')][_0xf7a5('0x41')]){_0x452d6b[_0xf7a5('0x42')]=[{'all':!![]}];}return db[_0xf7a5('0x2a')][_0xf7a5('0x43')](_0x452d6b);})[_0xf7a5('0x24')](function(_0x4aec5d){_0x465a69[_0xf7a5('0x44')]=_0x4aec5d;return _0x465a69;})[_0xf7a5('0x24')](respondWithFilteredResult(_0x4e3d9d,_0x452d6b))['catch'](handleError(_0x4e3d9d,null));};exports[_0xf7a5('0x45')]=function(_0x5bddb2,_0x14b1f4){var _0x3bdc10={'raw':![],'where':{'id':_0x5bddb2['params']['id']}},_0x2972ea={};_0x2972ea[_0xf7a5('0x2f')]=_[_0xf7a5('0x30')](db['Automation']['rawAttributes']);_0x2972ea[_0xf7a5('0x31')]=_['keys'](_0x5bddb2['query']);_0x2972ea[_0xf7a5('0x32')]=_[_0xf7a5('0x33')](_0x2972ea[_0xf7a5('0x2f')],_0x2972ea[_0xf7a5('0x31')]);_0x3bdc10['attributes']=_[_0xf7a5('0x33')](_0x2972ea[_0xf7a5('0x2f')],qs[_0xf7a5('0x35')](_0x5bddb2[_0xf7a5('0x31')][_0xf7a5('0x35')]));_0x3bdc10[_0xf7a5('0x34')]=_0x3bdc10[_0xf7a5('0x34')][_0xf7a5('0x36')]?_0x3bdc10['attributes']:_0x2972ea[_0xf7a5('0x2f')];if(_0x5bddb2[_0xf7a5('0x31')][_0xf7a5('0x41')]){_0x3bdc10[_0xf7a5('0x42')]=[{'all':!![]}];}_0x3bdc10=_[_0xf7a5('0x3f')]({},_0x3bdc10,_0x5bddb2['options']);return db[_0xf7a5('0x2a')]['find'](_0x3bdc10)[_0xf7a5('0x24')](handleEntityNotFound(_0x14b1f4,null))[_0xf7a5('0x24')](respondWithResult(_0x14b1f4,null))[_0xf7a5('0x46')](handleError(_0x14b1f4,null));};exports[_0xf7a5('0x47')]=function(_0x402566,_0x112a30){return db[_0xf7a5('0x2a')][_0xf7a5('0x47')](_0x402566[_0xf7a5('0x48')],{})[_0xf7a5('0x24')](respondWithResult(_0x112a30,0xc9))[_0xf7a5('0x46')](handleError(_0x112a30,null));};exports[_0xf7a5('0x23')]=function(_0x5d0e16,_0xeb0dab){if(_0x5d0e16[_0xf7a5('0x48')]['id']){delete _0x5d0e16[_0xf7a5('0x48')]['id'];}return db[_0xf7a5('0x2a')]['find']({'where':{'id':_0x5d0e16[_0xf7a5('0x49')]['id']}})[_0xf7a5('0x24')](handleEntityNotFound(_0xeb0dab,null))[_0xf7a5('0x24')](saveUpdates(_0x5d0e16[_0xf7a5('0x48')],null))[_0xf7a5('0x24')](respondWithResult(_0xeb0dab,null))['catch'](handleError(_0xeb0dab,null));};exports['destroy']=function(_0x5e5bf7,_0x27dde6){return db[_0xf7a5('0x2a')]['find']({'where':{'id':_0x5e5bf7[_0xf7a5('0x49')]['id']}})[_0xf7a5('0x24')](handleEntityNotFound(_0x27dde6,null))[_0xf7a5('0x24')](removeEntity(_0x27dde6,null))[_0xf7a5('0x46')](handleError(_0x27dde6,null));};exports[_0xf7a5('0x4a')]=function(_0x1e0d09,_0x837368,_0x4f8a2a){return db[_0xf7a5('0x4b')][_0xf7a5('0x4c')]({'where':{'id':_0x1e0d09[_0xf7a5('0x49')]['id']}})[_0xf7a5('0x24')](handleEntityNotFound(_0x837368,null))['then'](function(_0xe17f0b){if(_0xe17f0b){return _0xe17f0b[_0xf7a5('0x4a')](_0x1e0d09[_0xf7a5('0x48')]['ids'],_['omit'](_0x1e0d09[_0xf7a5('0x48')],[_0xf7a5('0x4d'),'id'])||{});}})['then'](respondWithResult(_0x837368,null))['catch'](handleError(_0x837368,null));};exports['getConditions']=function(_0xc2329a,_0x471312,_0x2f7ba7){var _0x812a16={};var _0x13f613={};var _0x596589;var _0x55cff2;return db[_0xf7a5('0x2a')][_0xf7a5('0x4e')]({'where':{'id':_0xc2329a['params']['id']}})[_0xf7a5('0x24')](handleEntityNotFound(_0x471312,null))[_0xf7a5('0x24')](function(_0x4ed291){if(_0x4ed291){_0x596589=_0x4ed291;_0x13f613[_0xf7a5('0x2f')]=_[_0xf7a5('0x30')](db['Condition'][_0xf7a5('0x2b')]);_0x13f613[_0xf7a5('0x31')]=_[_0xf7a5('0x30')](_0xc2329a[_0xf7a5('0x31')]);_0x13f613[_0xf7a5('0x32')]=_[_0xf7a5('0x33')](_0x13f613[_0xf7a5('0x2f')],_0x13f613['query']);_0x812a16[_0xf7a5('0x34')]=_[_0xf7a5('0x33')](_0x13f613['model'],qs['fields'](_0xc2329a[_0xf7a5('0x31')][_0xf7a5('0x35')]));_0x812a16['attributes']=_0x812a16['attributes'][_0xf7a5('0x36')]?_0x812a16['attributes']:_0x13f613[_0xf7a5('0x2f')];_0x812a16[_0xf7a5('0x39')]=qs[_0xf7a5('0x3a')](_0xc2329a[_0xf7a5('0x31')][_0xf7a5('0x3a')]);_0x812a16['where']=qs[_0xf7a5('0x32')](_[_0xf7a5('0x3c')](_0xc2329a[_0xf7a5('0x31')],_0x13f613['filters']));if(_0xc2329a['query'][_0xf7a5('0x3d')]){_0x812a16[_0xf7a5('0x3b')]=_[_0xf7a5('0x3f')](_0x812a16[_0xf7a5('0x3b')],{'$or':_[_0xf7a5('0x29')](_0x812a16[_0xf7a5('0x34')],function(_0x5459cd){var _0x2a9cab={};_0x2a9cab[_0x5459cd]={'$like':'%'+_0xc2329a[_0xf7a5('0x31')][_0xf7a5('0x3d')]+'%'};return _0x2a9cab;})});}_0x812a16=_[_0xf7a5('0x3f')]({},_0x812a16,_0xc2329a[_0xf7a5('0x40')]);return _0x596589[_0xf7a5('0x4f')](_0x812a16);}})['then'](function(_0x37f059){if(_0x37f059){_0x55cff2=_0x37f059[_0xf7a5('0x36')];if(!_0xc2329a[_0xf7a5('0x31')][_0xf7a5('0x37')](_0xf7a5('0x38'))){_0x812a16[_0xf7a5('0x1b')]=qs[_0xf7a5('0x1b')](_0xc2329a[_0xf7a5('0x31')][_0xf7a5('0x1b')]);_0x812a16[_0xf7a5('0x1a')]=qs[_0xf7a5('0x1a')](_0xc2329a[_0xf7a5('0x31')][_0xf7a5('0x1a')]);}return _0x596589[_0xf7a5('0x4f')](_0x812a16);}})[_0xf7a5('0x24')](function(_0x2940e7){if(_0x2940e7){return _0x2940e7?{'count':_0x55cff2,'rows':_0x2940e7}:null;}})[_0xf7a5('0x24')](respondWithResult(_0x471312,null))['catch'](handleError(_0x471312,null));};exports[_0xf7a5('0x50')]=function(_0x2455e7,_0x4ec00d,_0x349e7d){return db[_0xf7a5('0x51')]['find']({'where':{'id':_0x2455e7[_0xf7a5('0x49')]['id']}})['then'](handleEntityNotFound(_0x4ec00d,null))[_0xf7a5('0x24')](function(_0x36b2d7){if(_0x36b2d7){return _0x36b2d7['addActions'](_0x2455e7[_0xf7a5('0x48')][_0xf7a5('0x4d')],_[_0xf7a5('0x52')](_0x2455e7['body'],[_0xf7a5('0x4d'),'id'])||{});}})[_0xf7a5('0x24')](respondWithResult(_0x4ec00d,null))['catch'](handleError(_0x4ec00d,null));};exports['getActions']=function(_0x5a5afc,_0x54b412,_0x464bf2){var _0x31be36={};var _0x35d419={};var _0x3e6899;var _0x10558a;return db['Automation'][_0xf7a5('0x4e')]({'where':{'id':_0x5a5afc[_0xf7a5('0x49')]['id']}})[_0xf7a5('0x24')](handleEntityNotFound(_0x54b412,null))[_0xf7a5('0x24')](function(_0x1baa1b){if(_0x1baa1b){_0x3e6899=_0x1baa1b;_0x35d419[_0xf7a5('0x2f')]=_[_0xf7a5('0x30')](db[_0xf7a5('0x51')][_0xf7a5('0x2b')]);_0x35d419[_0xf7a5('0x31')]=_['keys'](_0x5a5afc[_0xf7a5('0x31')]);_0x35d419[_0xf7a5('0x32')]=_[_0xf7a5('0x33')](_0x35d419[_0xf7a5('0x2f')],_0x35d419[_0xf7a5('0x31')]);_0x31be36[_0xf7a5('0x34')]=_[_0xf7a5('0x33')](_0x35d419['model'],qs[_0xf7a5('0x35')](_0x5a5afc[_0xf7a5('0x31')][_0xf7a5('0x35')]));_0x31be36['attributes']=_0x31be36[_0xf7a5('0x34')][_0xf7a5('0x36')]?_0x31be36[_0xf7a5('0x34')]:_0x35d419['model'];_0x31be36['order']=qs[_0xf7a5('0x3a')](_0x5a5afc[_0xf7a5('0x31')][_0xf7a5('0x3a')]);_0x31be36[_0xf7a5('0x3b')]=qs[_0xf7a5('0x32')](_[_0xf7a5('0x3c')](_0x5a5afc[_0xf7a5('0x31')],_0x35d419[_0xf7a5('0x32')]));if(_0x5a5afc[_0xf7a5('0x31')][_0xf7a5('0x3d')]){_0x31be36[_0xf7a5('0x3b')]=_[_0xf7a5('0x3f')](_0x31be36[_0xf7a5('0x3b')],{'$or':_[_0xf7a5('0x29')](_0x31be36['attributes'],function(_0x28baa1){var _0x2ef03e={};_0x2ef03e[_0x28baa1]={'$like':'%'+_0x5a5afc['query'][_0xf7a5('0x3d')]+'%'};return _0x2ef03e;})});}_0x31be36=_[_0xf7a5('0x3f')]({},_0x31be36,_0x5a5afc[_0xf7a5('0x40')]);return _0x3e6899[_0xf7a5('0x53')](_0x31be36);}})[_0xf7a5('0x24')](function(_0x225470){if(_0x225470){_0x10558a=_0x225470[_0xf7a5('0x36')];if(!_0x5a5afc['query'][_0xf7a5('0x37')](_0xf7a5('0x38'))){_0x31be36[_0xf7a5('0x1b')]=qs[_0xf7a5('0x1b')](_0x5a5afc['query'][_0xf7a5('0x1b')]);_0x31be36[_0xf7a5('0x1a')]=qs[_0xf7a5('0x1a')](_0x5a5afc[_0xf7a5('0x31')][_0xf7a5('0x1a')]);}return _0x3e6899[_0xf7a5('0x53')](_0x31be36);}})[_0xf7a5('0x24')](function(_0x425b5f){if(_0x425b5f){return _0x425b5f?{'count':_0x10558a,'rows':_0x425b5f}:null;}})['then'](respondWithResult(_0x54b412,null))[_0xf7a5('0x46')](handleError(_0x54b412,null));}; \ No newline at end of file +var _0x2a29=['to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','name','send','map','Automation','fieldName','type','key','model','query','filters','attributes','intersection','fields','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','keys','length','find','catch','create','body','update','destroy','addConditions','Condition','ids','getConditions','findOne','rawAttributes','order','nolimit','addActions','Action','omit','getActions','pick','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x1c0870,_0xb3e682){var _0x454576=function(_0x545ab5){while(--_0x545ab5){_0x1c0870['push'](_0x1c0870['shift']());}};_0x454576(++_0xb3e682);}(_0x2a29,0x186));var _0x92a2=function(_0x48448d,_0x8acc8c){_0x48448d=_0x48448d-0x0;var _0x2c704e=_0x2a29[_0x48448d];return _0x2c704e;};'use strict';var emlformat=require(_0x92a2('0x0'));var rimraf=require(_0x92a2('0x1'));var zipdir=require(_0x92a2('0x2'));var jsonpatch=require(_0x92a2('0x3'));var rp=require('request-promise');var moment=require(_0x92a2('0x4'));var BPromise=require(_0x92a2('0x5'));var Mustache=require('mustache');var util=require(_0x92a2('0x6'));var path=require(_0x92a2('0x7'));var sox=require(_0x92a2('0x8'));var csv=require('to-csv');var ejs=require(_0x92a2('0x9'));var fs=require('fs');var fs_extra=require(_0x92a2('0xa'));var _=require(_0x92a2('0xb'));var squel=require(_0x92a2('0xc'));var crypto=require(_0x92a2('0xd'));var jsforce=require(_0x92a2('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x92a2('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x92a2('0x10'));var authService=require(_0x92a2('0x11'));var qs=require(_0x92a2('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x92a2('0x13'))(_0x92a2('0x14'));var utils=require('../../config/utils');var config=require(_0x92a2('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x92a2('0x16'))['db'];function respondWithStatusCode(_0x2548cf,_0x16237d){_0x16237d=_0x16237d||0xcc;return function(_0x341966){if(_0x341966){return _0x2548cf[_0x92a2('0x17')](_0x16237d);}return _0x2548cf[_0x92a2('0x18')](_0x16237d)[_0x92a2('0x19')]();};}function respondWithResult(_0x17a794,_0x129d48){_0x129d48=_0x129d48||0xc8;return function(_0x170fa9){if(_0x170fa9){return _0x17a794['status'](_0x129d48)[_0x92a2('0x1a')](_0x170fa9);}};}function respondWithFilteredResult(_0x12ebfe,_0x531a2e){return function(_0x1a9874){if(_0x1a9874){var _0x17dcd9=typeof _0x531a2e[_0x92a2('0x1b')]===_0x92a2('0x1c')&&typeof _0x531a2e[_0x92a2('0x1d')]==='undefined';var _0x42cd6f=_0x1a9874[_0x92a2('0x1e')];var _0x5bb1f6=_0x17dcd9?0x0:_0x531a2e['offset'];var _0x4dfbe7=_0x17dcd9?_0x1a9874[_0x92a2('0x1e')]:_0x531a2e['offset']+_0x531a2e[_0x92a2('0x1d')];var _0x16dd0b;if(_0x4dfbe7>=_0x42cd6f){_0x4dfbe7=_0x42cd6f;_0x16dd0b=0xc8;}else{_0x16dd0b=0xce;}_0x12ebfe[_0x92a2('0x18')](_0x16dd0b);return _0x12ebfe[_0x92a2('0x1f')]('Content-Range',_0x5bb1f6+'-'+_0x4dfbe7+'/'+_0x42cd6f)[_0x92a2('0x1a')](_0x1a9874);}return null;};}function patchUpdates(_0x5da773){return function(_0x22e518){try{jsonpatch[_0x92a2('0x20')](_0x22e518,_0x5da773,!![]);}catch(_0x453d19){return BPromise[_0x92a2('0x21')](_0x453d19);}return _0x22e518[_0x92a2('0x22')]();};}function saveUpdates(_0x36eadc,_0x4f67e4){return function(_0x1a7d71){if(_0x1a7d71){return _0x1a7d71['update'](_0x36eadc)['then'](function(_0x481aa4){return _0x481aa4;});}return null;};}function removeEntity(_0x733a1a,_0x50b608){return function(_0x4bed8a){if(_0x4bed8a){return _0x4bed8a['destroy']()[_0x92a2('0x23')](function(){_0x733a1a[_0x92a2('0x18')](0xcc)[_0x92a2('0x19')]();});}};}function handleEntityNotFound(_0x67dac0,_0x3b97eb){return function(_0x4b0da8){if(!_0x4b0da8){_0x67dac0[_0x92a2('0x17')](0x194);}return _0x4b0da8;};}function handleError(_0x17ae42,_0x5e7029){_0x5e7029=_0x5e7029||0x1f4;return function(_0x11a2e5){logger['error'](_0x11a2e5['stack']);if(_0x11a2e5[_0x92a2('0x24')]){delete _0x11a2e5['name'];}_0x17ae42[_0x92a2('0x18')](_0x5e7029)[_0x92a2('0x25')](_0x11a2e5);};}exports['index']=function(_0x2fb042,_0xf93242){var _0xdcbcfa={},_0x31e9d8={},_0x35a559={'count':0x0,'rows':[]};var _0x2dcae6=_[_0x92a2('0x26')](db[_0x92a2('0x27')]['rawAttributes'],function(_0x475da0){return{'name':_0x475da0[_0x92a2('0x28')],'type':_0x475da0[_0x92a2('0x29')][_0x92a2('0x2a')]};});_0x31e9d8[_0x92a2('0x2b')]=_[_0x92a2('0x26')](_0x2dcae6,_0x92a2('0x24'));_0x31e9d8[_0x92a2('0x2c')]=_['keys'](_0x2fb042[_0x92a2('0x2c')]);_0x31e9d8[_0x92a2('0x2d')]=_['intersection'](_0x31e9d8['model'],_0x31e9d8[_0x92a2('0x2c')]);_0xdcbcfa[_0x92a2('0x2e')]=_[_0x92a2('0x2f')](_0x31e9d8[_0x92a2('0x2b')],qs[_0x92a2('0x30')](_0x2fb042['query'][_0x92a2('0x30')]));_0xdcbcfa[_0x92a2('0x2e')]=_0xdcbcfa[_0x92a2('0x2e')]['length']?_0xdcbcfa['attributes']:_0x31e9d8[_0x92a2('0x2b')];if(!_0x2fb042[_0x92a2('0x2c')]['hasOwnProperty']('nolimit')){_0xdcbcfa[_0x92a2('0x1d')]=qs[_0x92a2('0x1d')](_0x2fb042[_0x92a2('0x2c')][_0x92a2('0x1d')]);_0xdcbcfa['offset']=qs[_0x92a2('0x1b')](_0x2fb042['query'][_0x92a2('0x1b')]);}_0xdcbcfa['order']=qs['sort'](_0x2fb042[_0x92a2('0x2c')][_0x92a2('0x31')]);_0xdcbcfa[_0x92a2('0x32')]=qs['filters'](_['pick'](_0x2fb042[_0x92a2('0x2c')],_0x31e9d8[_0x92a2('0x2d')]),_0x2dcae6);if(_0x2fb042['query'][_0x92a2('0x33')]){_0xdcbcfa[_0x92a2('0x32')]=_[_0x92a2('0x34')](_0xdcbcfa[_0x92a2('0x32')],{'$or':_[_0x92a2('0x26')](_0x2dcae6,function(_0x5e3c31){if(_0x5e3c31[_0x92a2('0x29')]!==_0x92a2('0x35')){var _0x53f6b6={};_0x53f6b6[_0x5e3c31['name']]={'$like':'%'+_0x2fb042['query']['filter']+'%'};return _0x53f6b6;}})});}_0xdcbcfa=_[_0x92a2('0x34')]({},_0xdcbcfa,_0x2fb042[_0x92a2('0x36')]);var _0x4b1667={'where':_0xdcbcfa['where']};return db[_0x92a2('0x27')]['count'](_0x4b1667)[_0x92a2('0x23')](function(_0x1dd14f){_0x35a559[_0x92a2('0x1e')]=_0x1dd14f;if(_0x2fb042[_0x92a2('0x2c')]['includeAll']){_0xdcbcfa[_0x92a2('0x37')]=[{'all':!![]}];}return db['Automation'][_0x92a2('0x38')](_0xdcbcfa);})[_0x92a2('0x23')](function(_0x281598){_0x35a559[_0x92a2('0x39')]=_0x281598;return _0x35a559;})[_0x92a2('0x23')](respondWithFilteredResult(_0xf93242,_0xdcbcfa))['catch'](handleError(_0xf93242,null));};exports[_0x92a2('0x3a')]=function(_0x473da5,_0x322ef1){var _0x43629b={'raw':![],'where':{'id':_0x473da5[_0x92a2('0x3b')]['id']}},_0x3822ee={};_0x3822ee[_0x92a2('0x2b')]=_[_0x92a2('0x3c')](db[_0x92a2('0x27')]['rawAttributes']);_0x3822ee[_0x92a2('0x2c')]=_[_0x92a2('0x3c')](_0x473da5[_0x92a2('0x2c')]);_0x3822ee[_0x92a2('0x2d')]=_[_0x92a2('0x2f')](_0x3822ee['model'],_0x3822ee[_0x92a2('0x2c')]);_0x43629b['attributes']=_['intersection'](_0x3822ee['model'],qs[_0x92a2('0x30')](_0x473da5[_0x92a2('0x2c')]['fields']));_0x43629b[_0x92a2('0x2e')]=_0x43629b[_0x92a2('0x2e')][_0x92a2('0x3d')]?_0x43629b[_0x92a2('0x2e')]:_0x3822ee['model'];if(_0x473da5[_0x92a2('0x2c')]['includeAll']){_0x43629b['include']=[{'all':!![]}];}_0x43629b=_[_0x92a2('0x34')]({},_0x43629b,_0x473da5[_0x92a2('0x36')]);return db[_0x92a2('0x27')][_0x92a2('0x3e')](_0x43629b)[_0x92a2('0x23')](handleEntityNotFound(_0x322ef1,null))['then'](respondWithResult(_0x322ef1,null))[_0x92a2('0x3f')](handleError(_0x322ef1,null));};exports[_0x92a2('0x40')]=function(_0x2a3311,_0x524ba1){return db[_0x92a2('0x27')][_0x92a2('0x40')](_0x2a3311[_0x92a2('0x41')],{})['then'](respondWithResult(_0x524ba1,0xc9))['catch'](handleError(_0x524ba1,null));};exports[_0x92a2('0x42')]=function(_0x2264b8,_0x2346ab){if(_0x2264b8[_0x92a2('0x41')]['id']){delete _0x2264b8['body']['id'];}return db[_0x92a2('0x27')]['find']({'where':{'id':_0x2264b8[_0x92a2('0x3b')]['id']}})[_0x92a2('0x23')](handleEntityNotFound(_0x2346ab,null))[_0x92a2('0x23')](saveUpdates(_0x2264b8['body'],null))[_0x92a2('0x23')](respondWithResult(_0x2346ab,null))['catch'](handleError(_0x2346ab,null));};exports[_0x92a2('0x43')]=function(_0x3b6dc4,_0x218b13){return db[_0x92a2('0x27')][_0x92a2('0x3e')]({'where':{'id':_0x3b6dc4['params']['id']}})[_0x92a2('0x23')](handleEntityNotFound(_0x218b13,null))[_0x92a2('0x23')](removeEntity(_0x218b13,null))['catch'](handleError(_0x218b13,null));};exports[_0x92a2('0x44')]=function(_0x1f53f3,_0x3f8d2e,_0x3b0546){return db[_0x92a2('0x45')][_0x92a2('0x3e')]({'where':{'id':_0x1f53f3['params']['id']}})['then'](handleEntityNotFound(_0x3f8d2e,null))['then'](function(_0x46bb80){if(_0x46bb80){return _0x46bb80[_0x92a2('0x44')](_0x1f53f3[_0x92a2('0x41')][_0x92a2('0x46')],_['omit'](_0x1f53f3[_0x92a2('0x41')],[_0x92a2('0x46'),'id'])||{});}})[_0x92a2('0x23')](respondWithResult(_0x3f8d2e,null))['catch'](handleError(_0x3f8d2e,null));};exports[_0x92a2('0x47')]=function(_0x190051,_0x29ef67,_0x1c2e39){var _0x5083ab={};var _0xc492ba={};var _0x6f0f23;var _0x5ecf79;return db['Automation'][_0x92a2('0x48')]({'where':{'id':_0x190051['params']['id']}})[_0x92a2('0x23')](handleEntityNotFound(_0x29ef67,null))[_0x92a2('0x23')](function(_0x2bf2a4){if(_0x2bf2a4){_0x6f0f23=_0x2bf2a4;_0xc492ba[_0x92a2('0x2b')]=_['keys'](db[_0x92a2('0x45')][_0x92a2('0x49')]);_0xc492ba[_0x92a2('0x2c')]=_[_0x92a2('0x3c')](_0x190051[_0x92a2('0x2c')]);_0xc492ba[_0x92a2('0x2d')]=_[_0x92a2('0x2f')](_0xc492ba[_0x92a2('0x2b')],_0xc492ba[_0x92a2('0x2c')]);_0x5083ab[_0x92a2('0x2e')]=_[_0x92a2('0x2f')](_0xc492ba[_0x92a2('0x2b')],qs[_0x92a2('0x30')](_0x190051[_0x92a2('0x2c')][_0x92a2('0x30')]));_0x5083ab['attributes']=_0x5083ab[_0x92a2('0x2e')][_0x92a2('0x3d')]?_0x5083ab[_0x92a2('0x2e')]:_0xc492ba[_0x92a2('0x2b')];_0x5083ab[_0x92a2('0x4a')]=qs[_0x92a2('0x31')](_0x190051[_0x92a2('0x2c')][_0x92a2('0x31')]);_0x5083ab[_0x92a2('0x32')]=qs[_0x92a2('0x2d')](_['pick'](_0x190051[_0x92a2('0x2c')],_0xc492ba[_0x92a2('0x2d')]));if(_0x190051[_0x92a2('0x2c')]['filter']){_0x5083ab[_0x92a2('0x32')]=_[_0x92a2('0x34')](_0x5083ab[_0x92a2('0x32')],{'$or':_[_0x92a2('0x26')](_0x5083ab['attributes'],function(_0x402944){var _0x28a61e={};_0x28a61e[_0x402944]={'$like':'%'+_0x190051[_0x92a2('0x2c')][_0x92a2('0x33')]+'%'};return _0x28a61e;})});}_0x5083ab=_[_0x92a2('0x34')]({},_0x5083ab,_0x190051[_0x92a2('0x36')]);return _0x6f0f23[_0x92a2('0x47')](_0x5083ab);}})['then'](function(_0x14ef81){if(_0x14ef81){_0x5ecf79=_0x14ef81['length'];if(!_0x190051['query']['hasOwnProperty'](_0x92a2('0x4b'))){_0x5083ab[_0x92a2('0x1d')]=qs['limit'](_0x190051['query']['limit']);_0x5083ab[_0x92a2('0x1b')]=qs[_0x92a2('0x1b')](_0x190051['query'][_0x92a2('0x1b')]);}return _0x6f0f23[_0x92a2('0x47')](_0x5083ab);}})[_0x92a2('0x23')](function(_0xd969d8){if(_0xd969d8){return _0xd969d8?{'count':_0x5ecf79,'rows':_0xd969d8}:null;}})['then'](respondWithResult(_0x29ef67,null))[_0x92a2('0x3f')](handleError(_0x29ef67,null));};exports[_0x92a2('0x4c')]=function(_0xd48d79,_0x1a4d64,_0x47eca0){return db[_0x92a2('0x4d')][_0x92a2('0x3e')]({'where':{'id':_0xd48d79[_0x92a2('0x3b')]['id']}})['then'](handleEntityNotFound(_0x1a4d64,null))[_0x92a2('0x23')](function(_0x3ab2bf){if(_0x3ab2bf){return _0x3ab2bf[_0x92a2('0x4c')](_0xd48d79[_0x92a2('0x41')][_0x92a2('0x46')],_[_0x92a2('0x4e')](_0xd48d79[_0x92a2('0x41')],[_0x92a2('0x46'),'id'])||{});}})[_0x92a2('0x23')](respondWithResult(_0x1a4d64,null))[_0x92a2('0x3f')](handleError(_0x1a4d64,null));};exports[_0x92a2('0x4f')]=function(_0xbbd858,_0x50f3f0,_0x193e98){var _0x28f631={};var _0x418693={};var _0x30c6de;var _0x3a4d2d;return db[_0x92a2('0x27')][_0x92a2('0x48')]({'where':{'id':_0xbbd858[_0x92a2('0x3b')]['id']}})[_0x92a2('0x23')](handleEntityNotFound(_0x50f3f0,null))[_0x92a2('0x23')](function(_0x49c049){if(_0x49c049){_0x30c6de=_0x49c049;_0x418693[_0x92a2('0x2b')]=_[_0x92a2('0x3c')](db[_0x92a2('0x4d')][_0x92a2('0x49')]);_0x418693[_0x92a2('0x2c')]=_['keys'](_0xbbd858[_0x92a2('0x2c')]);_0x418693[_0x92a2('0x2d')]=_['intersection'](_0x418693[_0x92a2('0x2b')],_0x418693[_0x92a2('0x2c')]);_0x28f631['attributes']=_[_0x92a2('0x2f')](_0x418693[_0x92a2('0x2b')],qs['fields'](_0xbbd858[_0x92a2('0x2c')][_0x92a2('0x30')]));_0x28f631[_0x92a2('0x2e')]=_0x28f631[_0x92a2('0x2e')][_0x92a2('0x3d')]?_0x28f631['attributes']:_0x418693[_0x92a2('0x2b')];_0x28f631[_0x92a2('0x4a')]=qs['sort'](_0xbbd858[_0x92a2('0x2c')][_0x92a2('0x31')]);_0x28f631['where']=qs[_0x92a2('0x2d')](_[_0x92a2('0x50')](_0xbbd858['query'],_0x418693[_0x92a2('0x2d')]));if(_0xbbd858[_0x92a2('0x2c')]['filter']){_0x28f631['where']=_[_0x92a2('0x34')](_0x28f631[_0x92a2('0x32')],{'$or':_[_0x92a2('0x26')](_0x28f631['attributes'],function(_0x2ff43c){var _0x27ed01={};_0x27ed01[_0x2ff43c]={'$like':'%'+_0xbbd858[_0x92a2('0x2c')][_0x92a2('0x33')]+'%'};return _0x27ed01;})});}_0x28f631=_['merge']({},_0x28f631,_0xbbd858['options']);return _0x30c6de['getActions'](_0x28f631);}})[_0x92a2('0x23')](function(_0x25a4cb){if(_0x25a4cb){_0x3a4d2d=_0x25a4cb['length'];if(!_0xbbd858['query']['hasOwnProperty'](_0x92a2('0x4b'))){_0x28f631[_0x92a2('0x1d')]=qs[_0x92a2('0x1d')](_0xbbd858[_0x92a2('0x2c')][_0x92a2('0x1d')]);_0x28f631[_0x92a2('0x1b')]=qs[_0x92a2('0x1b')](_0xbbd858[_0x92a2('0x2c')]['offset']);}return _0x30c6de[_0x92a2('0x4f')](_0x28f631);}})[_0x92a2('0x23')](function(_0x1793e3){if(_0x1793e3){return _0x1793e3?{'count':_0x3a4d2d,'rows':_0x1793e3}:null;}})['then'](respondWithResult(_0x50f3f0,null))[_0x92a2('0x3f')](handleError(_0x50f3f0,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 572b007..de4162f 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 _0xc831=['util','api','moment','bluebird','request-promise','../../config/environment','exports','define','Automation'];(function(_0x169c92,_0x215c01){var _0x5f2f5b=function(_0x16928b){while(--_0x16928b){_0x169c92['push'](_0x169c92['shift']());}};_0x5f2f5b(++_0x215c01);}(_0xc831,0x17a));var _0x1c83=function(_0x5a8a7c,_0xe4ed6f){_0x5a8a7c=_0x5a8a7c-0x0;var _0x3d131f=_0xc831[_0x5a8a7c];return _0x3d131f;};'use strict';var _=require('lodash');var util=require(_0x1c83('0x0'));var logger=require('../../config/logger')(_0x1c83('0x1'));var moment=require(_0x1c83('0x2'));var BPromise=require(_0x1c83('0x3'));var rp=require(_0x1c83('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1c83('0x5'));var attributes=require('./automation.attributes');module[_0x1c83('0x6')]=function(_0x3661d7,_0xb77749){return _0x3661d7[_0x1c83('0x7')](_0x1c83('0x8'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f24=['rimraf','../../config/environment','exports','define','lodash','util','../../config/logger','moment','request-promise'];(function(_0x537662,_0x3f1da7){var _0x3bbccf=function(_0x523247){while(--_0x523247){_0x537662['push'](_0x537662['shift']());}};_0x3bbccf(++_0x3f1da7);}(_0x3f24,0x1a2));var _0x43f2=function(_0x5ed0a7,_0x2dc03a){_0x5ed0a7=_0x5ed0a7-0x0;var _0x8378c5=_0x3f24[_0x5ed0a7];return _0x8378c5;};'use strict';var _=require(_0x43f2('0x0'));var util=require(_0x43f2('0x1'));var logger=require(_0x43f2('0x2'))('api');var moment=require(_0x43f2('0x3'));var BPromise=require('bluebird');var rp=require(_0x43f2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x43f2('0x5'));var config=require(_0x43f2('0x6'));var attributes=require('./automation.attributes');module[_0x43f2('0x7')]=function(_0x2d9e02,_0xbaf19e){return _0x2d9e02[_0x43f2('0x8')]('Automation',attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 5f0863d..43be275 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 _0xbf13=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','../../mysqldb'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xbf13,0xe2));var _0x3bf1=function(_0x16314a,_0x398aa2){_0x16314a=_0x16314a-0x0;var _0x51657e=_0xbf13[_0x16314a];return _0x51657e;};'use strict';var _=require(_0x3bf1('0x0'));var util=require(_0x3bf1('0x1'));var moment=require(_0x3bf1('0x2'));var BPromise=require(_0x3bf1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3bf1('0x4'))['db'];var utils=require(_0x3bf1('0x5'));var logger=require('../../config/logger')(_0x3bf1('0x6'));var config=require(_0x3bf1('0x7'));var jayson=require(_0x3bf1('0x8'));var client=jayson[_0x3bf1('0x9')][_0x3bf1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54eada,_0x4d9fa2,_0x4502c5){return new BPromise(function(_0x30bda1,_0x56eb60){return client[_0x3bf1('0xb')](_0x54eada,_0x4502c5)[_0x3bf1('0xc')](function(_0x28906a){logger[_0x3bf1('0xd')](_0x3bf1('0xe'),_0x4d9fa2,_0x3bf1('0xf'));logger['debug']('Automation,\x20%s,\x20%s,\x20%s',_0x4d9fa2,_0x3bf1('0xf'),JSON[_0x3bf1('0x10')](_0x28906a));if(_0x28906a['error']){if(_0x28906a[_0x3bf1('0x11')]['code']===0x1f4){logger[_0x3bf1('0x11')](_0x3bf1('0xe'),_0x4d9fa2,_0x28906a[_0x3bf1('0x11')][_0x3bf1('0x12')]);return _0x56eb60(_0x28906a[_0x3bf1('0x11')][_0x3bf1('0x12')]);}logger['error']('Automation,\x20%s,\x20%s',_0x4d9fa2,_0x28906a[_0x3bf1('0x11')][_0x3bf1('0x12')]);return _0x30bda1(_0x28906a[_0x3bf1('0x11')][_0x3bf1('0x12')]);}else{logger[_0x3bf1('0xd')](_0x3bf1('0xe'),_0x4d9fa2,_0x3bf1('0xf'));_0x30bda1(_0x28906a[_0x3bf1('0x13')][_0x3bf1('0x12')]);}})[_0x3bf1('0x14')](function(_0x260440){logger[_0x3bf1('0x11')](_0x3bf1('0xe'),_0x4d9fa2,_0x260440);_0x56eb60(_0x260440);});});} \ No newline at end of file +var _0x117c=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','Automation,\x20%s,\x20%s','message','catch','bluebird'];(function(_0x445101,_0x2414bf){var _0x3c3d04=function(_0x249067){while(--_0x249067){_0x445101['push'](_0x445101['shift']());}};_0x3c3d04(++_0x2414bf);}(_0x117c,0x71));var _0xc117=function(_0x41b29e,_0x34b288){_0x41b29e=_0x41b29e-0x0;var _0xacd517=_0x117c[_0x41b29e];return _0xacd517;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xc117('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc117('0x1'))['db'];var utils=require(_0xc117('0x2'));var logger=require(_0xc117('0x3'))(_0xc117('0x4'));var config=require(_0xc117('0x5'));var jayson=require(_0xc117('0x6'));var client=jayson['client'][_0xc117('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x389734,_0x48efbb,_0x181a70){return new BPromise(function(_0x56c9bd,_0x451447){return client[_0xc117('0x8')](_0x389734,_0x181a70)[_0xc117('0x9')](function(_0x39e33f){logger[_0xc117('0xa')]('Automation,\x20%s,\x20%s',_0x48efbb,_0xc117('0xb'));logger['debug'](_0xc117('0xc'),_0x48efbb,'request\x20sent',JSON[_0xc117('0xd')](_0x39e33f));if(_0x39e33f[_0xc117('0xe')]){if(_0x39e33f['error'][_0xc117('0xf')]===0x1f4){logger['error'](_0xc117('0x10'),_0x48efbb,_0x39e33f[_0xc117('0xe')][_0xc117('0x11')]);return _0x451447(_0x39e33f[_0xc117('0xe')]['message']);}logger[_0xc117('0xe')](_0xc117('0x10'),_0x48efbb,_0x39e33f[_0xc117('0xe')][_0xc117('0x11')]);return _0x56c9bd(_0x39e33f[_0xc117('0xe')][_0xc117('0x11')]);}else{logger[_0xc117('0xa')](_0xc117('0x10'),_0x48efbb,_0xc117('0xb'));_0x56c9bd(_0x39e33f['result']['message']);}})[_0xc117('0x12')](function(_0x241ee7){logger[_0xc117('0xe')](_0xc117('0x10'),_0x48efbb,_0x241ee7);_0x451447(_0x241ee7);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 429fae1..0d6aa4f 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 _0x9275=['addActions','put','update','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','/:id/conditions','getConditions','/:id/actions','getActions','create','post'];(function(_0x19f720,_0x21a60b){var _0xa461b4=function(_0x146cc){while(--_0x146cc){_0x19f720['push'](_0x19f720['shift']());}};_0xa461b4(++_0x21a60b);}(_0x9275,0x130));var _0x5927=function(_0x16dbfd,_0x2f9431){_0x16dbfd=_0x16dbfd-0x0;var _0x382254=_0x9275[_0x16dbfd];return _0x382254;};'use strict';var multer=require('multer');var util=require(_0x5927('0x0'));var path=require(_0x5927('0x1'));var timeout=require(_0x5927('0x2'));var express=require('express');var router=express[_0x5927('0x3')]();var fs_extra=require(_0x5927('0x4'));var auth=require(_0x5927('0x5'));var interaction=require(_0x5927('0x6'));var config=require(_0x5927('0x7'));var controller=require('./automation.controller');router[_0x5927('0x8')]('/',auth['isAuthenticated'](),controller[_0x5927('0x9')]);router[_0x5927('0x8')](_0x5927('0xa'),auth[_0x5927('0xb')](),controller['show']);router[_0x5927('0x8')](_0x5927('0xc'),auth[_0x5927('0xb')](),controller[_0x5927('0xd')]);router[_0x5927('0x8')](_0x5927('0xe'),auth[_0x5927('0xb')](),controller[_0x5927('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5927('0x10')]);router[_0x5927('0x11')](_0x5927('0xc'),auth[_0x5927('0xb')](),controller['addConditions']);router[_0x5927('0x11')]('/:id/actions',auth[_0x5927('0xb')](),controller[_0x5927('0x12')]);router[_0x5927('0x13')](_0x5927('0xa'),auth[_0x5927('0xb')](),controller[_0x5927('0x14')]);router['delete']('/:id',auth[_0x5927('0xb')](),controller[_0x5927('0x15')]);module[_0x5927('0x16')]=router; \ No newline at end of file +var _0xef1c=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./automation.controller','get','isAuthenticated','show','/:id/conditions','getConditions','getActions','post','create','/:id/actions','put','/:id','exports','multer','util','connect-timeout','express'];(function(_0x18bebd,_0x32f07a){var _0x42524b=function(_0x2db8d2){while(--_0x2db8d2){_0x18bebd['push'](_0x18bebd['shift']());}};_0x42524b(++_0x32f07a);}(_0xef1c,0x176));var _0xcef1=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xef1c[_0x2d7f0e];return _0x110b07;};'use strict';var multer=require(_0xcef1('0x0'));var util=require(_0xcef1('0x1'));var path=require('path');var timeout=require(_0xcef1('0x2'));var express=require(_0xcef1('0x3'));var router=express[_0xcef1('0x4')]();var fs_extra=require(_0xcef1('0x5'));var auth=require(_0xcef1('0x6'));var interaction=require(_0xcef1('0x7'));var config=require('../../config/environment');var controller=require(_0xcef1('0x8'));router[_0xcef1('0x9')]('/',auth[_0xcef1('0xa')](),controller['index']);router[_0xcef1('0x9')]('/:id',auth[_0xcef1('0xa')](),controller[_0xcef1('0xb')]);router[_0xcef1('0x9')](_0xcef1('0xc'),auth['isAuthenticated'](),controller[_0xcef1('0xd')]);router[_0xcef1('0x9')]('/:id/actions',auth[_0xcef1('0xa')](),controller[_0xcef1('0xe')]);router[_0xcef1('0xf')]('/',auth['isAuthenticated'](),controller[_0xcef1('0x10')]);router['post']('/:id/conditions',auth[_0xcef1('0xa')](),controller['addConditions']);router[_0xcef1('0xf')](_0xcef1('0x11'),auth[_0xcef1('0xa')](),controller['addActions']);router[_0xcef1('0x12')](_0xcef1('0x13'),auth[_0xcef1('0xa')](),controller['update']);router['delete'](_0xcef1('0x13'),auth['isAuthenticated'](),controller['destroy']);module[_0xcef1('0x14')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 4a33a88..eca8936 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 _0x4377=['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)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\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)','07:00-22:00,*,*,*','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)'];(function(_0x1fe40b,_0xdf9bda){var _0x585a4d=function(_0x40f941){while(--_0x40f941){_0x1fe40b['push'](_0x1fe40b['shift']());}};_0x585a4d(++_0xdf9bda);}(_0x4377,0xcb));var _0x7437=function(_0x13b028,_0x54dc4b){_0x13b028=_0x13b028-0x0;var _0x7ead62=_0x4377[_0x13b028];return _0x7ead62;};'use strict';var Sequelize=require(_0x7437('0x0'));module[_0x7437('0x1')]={'name':{'type':Sequelize[_0x7437('0x2')],'unique':_0x7437('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x7437('0x4')]('ivr'),'allowNull':![],'defaultValue':_0x7437('0x5')},'description':{'type':Sequelize[_0x7437('0x2')]},'active':{'type':Sequelize[_0x7437('0x6')],'defaultValue':0x0,'comment':_0x7437('0x7')},'limitCalls':{'type':Sequelize[_0x7437('0x8')](0x4)[_0x7437('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x7437('0xa')},'dialOriginateCallerIdName':{'type':Sequelize[_0x7437('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x7437('0x8')](0x3)[_0x7437('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7437('0xb')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7437('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7437('0xc')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7437('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7437('0xd')},'dialBusyMaxRetry':{'type':Sequelize[_0x7437('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7437('0xe')},'dialBusyRetryFrequency':{'type':Sequelize[_0x7437('0x8')](0x5)[_0x7437('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x7437('0x8')](0x3)[_0x7437('0x9')],'defaultValue':0x3,'comment':_0x7437('0xf')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x7437('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7437('0x10')},'dialGlobalMaxRetry':{'type':Sequelize[_0x7437('0x8')](0x3)[_0x7437('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x7437('0x11')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x7437('0x2')],'defaultValue':_0x7437('0x12')},'dialCheckDuplicateType':{'type':Sequelize[_0x7437('0x4')](_0x7437('0x13'),'never',_0x7437('0x14')),'defaultValue':_0x7437('0x13')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x7437('0x15')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x7437('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x7437('0x16')},'dialAMDGreeting':{'type':Sequelize[_0x7437('0x8')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x7437('0x17')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x7437('0x8')](0x9)[_0x7437('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x7437('0x18')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x7437('0x8')](0x9)[_0x7437('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7437('0x19')},'dialAMDMinWordLength':{'type':Sequelize[_0x7437('0x8')](0x9)[_0x7437('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x7437('0x1a')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x7437('0x8')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x7437('0x1b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x7437('0x8')](0x9)[_0x7437('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x7437('0x1c')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x7437('0x8')](0x5)[_0x7437('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x7437('0x4')]('DESC','ASC'),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x7437('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x7437('0x8')](0x3)[_0x7437('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7437('0x1d')},'dialCutDigit':{'type':Sequelize[_0x7437('0x8')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x7437('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7437('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x7437('0x8')](0x5)[_0x7437('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7437('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0x7437('0x8')](0x3)[_0x7437('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7437('0x20')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7437('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7437('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x7437('0x8')](0x3)[_0x7437('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7437('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x7437('0x8')](0x5)[_0x7437('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7437('0x23')},'dialMachineMaxRetry':{'type':Sequelize[_0x7437('0x8')](0x3)[_0x7437('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7437('0x24')},'dialMachineRetryFrequency':{'type':Sequelize[_0x7437('0x8')](0x5)[_0x7437('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7437('0x25')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x7437('0x8')](0x3)[_0x7437('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7437('0x26')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x7437('0x8')](0x5)[_0x7437('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7437('0x27')}}; \ No newline at end of file +var _0xc06d=['#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','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)','sequelize','exports','STRING','name','ivr','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','INTEGER','#Congestion\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)','07:00-22:00,*,*,*','ENUM','always','onlyIfOpen','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc06d,0x15a));var _0xdc06=function(_0x5bc37f,_0x50debd){_0x5bc37f=_0x5bc37f-0x0;var _0x583e6d=_0xc06d[_0x5bc37f];return _0x583e6d;};'use strict';var Sequelize=require(_0xdc06('0x0'));module[_0xdc06('0x1')]={'name':{'type':Sequelize[_0xdc06('0x2')],'unique':_0xdc06('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xdc06('0x4')),'allowNull':![],'defaultValue':_0xdc06('0x4')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xdc06('0x5')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0xdc06('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xdc06('0x7')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xdc06('0x8')](0x3)[_0xdc06('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xdc06('0x8')](0x3)[_0xdc06('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdc06('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xdc06('0x8')](0x5)[_0xdc06('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xdc06('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xdc06('0x8')](0x5)[_0xdc06('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdc06('0xa')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xdc06('0x8')](0x3)[_0xdc06('0x6')],'defaultValue':0x3,'comment':_0xdc06('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdc06('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0xdc06('0x8')](0x3)[_0xdc06('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xdc06('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xdc06('0x2')],'defaultValue':_0xdc06('0xd')},'dialCheckDuplicateType':{'type':Sequelize[_0xdc06('0xe')](_0xdc06('0xf'),'never',_0xdc06('0x10')),'defaultValue':_0xdc06('0xf')},'dialAMDActive':{'type':Sequelize[_0xdc06('0x11')],'defaultValue':0x0,'comment':_0xdc06('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0xdc06('0x8')](0x9)[_0xdc06('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xdc06('0x13')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xdc06('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xdc06('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xdc06('0x8')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xdc06('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xdc06('0x8')](0x9)[_0xdc06('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xdc06('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0xdc06('0x8')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xdc06('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xdc06('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xdc06('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xdc06('0x8')](0x9)[_0xdc06('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xdc06('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xdc06('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xdc06('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xdc06('0x8')](0x9)[_0xdc06('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xdc06('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize[_0xdc06('0xe')](_0xdc06('0x1c'),'ASC'),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xdc06('0x8')](0x3)[_0xdc06('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xdc06('0x1d')},'dialCutDigit':{'type':Sequelize[_0xdc06('0x8')](0x3)[_0xdc06('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xdc06('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xdc06('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdc06('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xdc06('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdc06('0x20')},'dialDropMaxRetry':{'type':Sequelize[_0xdc06('0x8')](0x3)[_0xdc06('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdc06('0x21')},'dialDropRetryFrequency':{'type':Sequelize[_0xdc06('0x8')](0x5)[_0xdc06('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdc06('0x22')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xdc06('0x8')](0x3)[_0xdc06('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdc06('0x23')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xdc06('0x8')](0x5)[_0xdc06('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdc06('0x24')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xdc06('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdc06('0x25')},'dialMachineRetryFrequency':{'type':Sequelize[_0xdc06('0x8')](0x5)[_0xdc06('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdc06('0x26')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xdc06('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdc06('0x27')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xdc06('0x8')](0x5)[_0xdc06('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdc06('0x28')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 5abc4eb..df456d7 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 _0xe1fe=['removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','then','destroy','IvrCampaigns','UserProfileResource','error','name','send','index','Campaign','rawAttributes','fieldName','map','query','model','intersection','fields','attributes','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','clone','find','omit','createdAt','updatedAt','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getHoppers','CmHopper','keys','hasOwnProperty','order','CampaignId','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','cm_contacts','cm_hopper_additional_phones','cmHopperId','OrderBy','ci.item','ci.OrderBY','cm_contact_has_items','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','sequelize','push','all','removeLists','getBlackLists','addBlackLists','spread'];(function(_0x26ade8,_0x387df1){var _0x1e8070=function(_0x2d5cc7){while(--_0x2d5cc7){_0x26ade8['push'](_0x26ade8['shift']());}};_0x1e8070(++_0x387df1);}(_0xe1fe,0x1c3));var _0xee1f=function(_0x387b58,_0x333ba3){_0x387b58=_0x387b58-0x0;var _0x20e209=_0xe1fe[_0x387b58];return _0x20e209;};'use strict';var emlformat=require(_0xee1f('0x0'));var rimraf=require(_0xee1f('0x1'));var zipdir=require(_0xee1f('0x2'));var jsonpatch=require(_0xee1f('0x3'));var rp=require(_0xee1f('0x4'));var moment=require(_0xee1f('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xee1f('0x6'));var path=require(_0xee1f('0x7'));var sox=require(_0xee1f('0x8'));var csv=require(_0xee1f('0x9'));var ejs=require(_0xee1f('0xa'));var fs=require('fs');var fs_extra=require(_0xee1f('0xb'));var _=require(_0xee1f('0xc'));var squel=require(_0xee1f('0xd'));var crypto=require(_0xee1f('0xe'));var jsforce=require(_0xee1f('0xf'));var deskjs=require(_0xee1f('0x10'));var toCsv=require(_0xee1f('0x9'));var querystring=require(_0xee1f('0x11'));var Papa=require(_0xee1f('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xee1f('0x13'));var logger=require(_0xee1f('0x14'))(_0xee1f('0x15'));var utils=require(_0xee1f('0x16'));var config=require(_0xee1f('0x17'));var licenseUtil=require(_0xee1f('0x18'));var db=require(_0xee1f('0x19'))['db'];function respondWithStatusCode(_0xd8408d,_0x31512b){_0x31512b=_0x31512b||0xcc;return function(_0x260d50){if(_0x260d50){return _0xd8408d[_0xee1f('0x1a')](_0x31512b);}return _0xd8408d[_0xee1f('0x1b')](_0x31512b)[_0xee1f('0x1c')]();};}function respondWithResult(_0x39ac58,_0x3302c3){_0x3302c3=_0x3302c3||0xc8;return function(_0x4e1073){if(_0x4e1073){return _0x39ac58['status'](_0x3302c3)[_0xee1f('0x1d')](_0x4e1073);}};}function respondWithFilteredResult(_0x12900a,_0x15d69f){return function(_0x15ebbc){if(_0x15ebbc){var _0x158a8e=typeof _0x15d69f[_0xee1f('0x1e')]===_0xee1f('0x1f')&&typeof _0x15d69f[_0xee1f('0x20')]===_0xee1f('0x1f');var _0x23f77a=_0x15ebbc['count'];var _0x10cbe3=_0x158a8e?0x0:_0x15d69f['offset'];var _0x4fe1b5=_0x158a8e?_0x15ebbc[_0xee1f('0x21')]:_0x15d69f[_0xee1f('0x1e')]+_0x15d69f[_0xee1f('0x20')];var _0x471b57;if(_0x4fe1b5>=_0x23f77a){_0x4fe1b5=_0x23f77a;_0x471b57=0xc8;}else{_0x471b57=0xce;}_0x12900a[_0xee1f('0x1b')](_0x471b57);return _0x12900a[_0xee1f('0x22')]('Content-Range',_0x10cbe3+'-'+_0x4fe1b5+'/'+_0x23f77a)[_0xee1f('0x1d')](_0x15ebbc);}return null;};}function patchUpdates(_0x3ebe79){return function(_0x29dad7){try{jsonpatch[_0xee1f('0x23')](_0x29dad7,_0x3ebe79,!![]);}catch(_0x5c0c43){return BPromise['reject'](_0x5c0c43);}return _0x29dad7[_0xee1f('0x24')]();};}function saveUpdates(_0x2eefbc,_0x361953){return function(_0x4c1fb6){if(_0x4c1fb6){return _0x4c1fb6['update'](_0x2eefbc)[_0xee1f('0x25')](function(_0x1740d8){return _0x1740d8;});}return null;};}function removeEntity(_0x395044,_0x2103ec){return function(_0x44acef){if(_0x44acef){return _0x44acef[_0xee1f('0x26')]()['then'](function(){var _0x408fa5=_0x44acef['get']({'plain':!![]});var _0x510e22=_0xee1f('0x27');return db[_0xee1f('0x28')]['destroy']({'where':{'type':_0x510e22,'resourceId':_0x408fa5['id']}})[_0xee1f('0x25')](function(){return _0x44acef;});})[_0xee1f('0x25')](function(){_0x395044[_0xee1f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b370c,_0x140816){return function(_0x52d835){if(!_0x52d835){_0x1b370c[_0xee1f('0x1a')](0x194);}return _0x52d835;};}function handleError(_0xc5dd52,_0xe62b18){_0xe62b18=_0xe62b18||0x1f4;return function(_0x5be320){logger[_0xee1f('0x29')](_0x5be320['stack']);if(_0x5be320[_0xee1f('0x2a')]){delete _0x5be320['name'];}_0xc5dd52[_0xee1f('0x1b')](_0xe62b18)[_0xee1f('0x2b')](_0x5be320);};}exports[_0xee1f('0x2c')]=function(_0x2fcc3a,_0x3d0a52){var _0x19344b={},_0xdec86f={},_0x4f8c8e={'count':0x0,'rows':[]};var _0x69c6e0=_['map'](db[_0xee1f('0x2d')][_0xee1f('0x2e')],function(_0x1c595a){return{'name':_0x1c595a[_0xee1f('0x2f')],'type':_0x1c595a['type']['key']};});_0xdec86f['model']=_[_0xee1f('0x30')](_0x69c6e0,_0xee1f('0x2a'));_0xdec86f[_0xee1f('0x31')]=_['keys'](_0x2fcc3a[_0xee1f('0x31')]);_0xdec86f['filters']=_['intersection'](_0xdec86f[_0xee1f('0x32')],_0xdec86f[_0xee1f('0x31')]);_0x19344b['attributes']=_[_0xee1f('0x33')](_0xdec86f[_0xee1f('0x32')],qs[_0xee1f('0x34')](_0x2fcc3a[_0xee1f('0x31')][_0xee1f('0x34')]));_0x19344b['attributes']=_0x19344b[_0xee1f('0x35')][_0xee1f('0x36')]?_0x19344b[_0xee1f('0x35')]:_0xdec86f[_0xee1f('0x32')];if(!_0x2fcc3a[_0xee1f('0x31')]['hasOwnProperty'](_0xee1f('0x37'))){_0x19344b[_0xee1f('0x20')]=qs['limit'](_0x2fcc3a['query'][_0xee1f('0x20')]);_0x19344b[_0xee1f('0x1e')]=qs[_0xee1f('0x1e')](_0x2fcc3a[_0xee1f('0x31')][_0xee1f('0x1e')]);}_0x19344b['order']=qs[_0xee1f('0x38')](_0x2fcc3a[_0xee1f('0x31')]['sort']);_0x19344b[_0xee1f('0x39')]=qs[_0xee1f('0x3a')](_[_0xee1f('0x3b')](_0x2fcc3a[_0xee1f('0x31')],_0xdec86f[_0xee1f('0x3a')]),_0x69c6e0);if(_0x2fcc3a[_0xee1f('0x31')][_0xee1f('0x3c')]){_0x19344b[_0xee1f('0x39')]=_[_0xee1f('0x3d')](_0x19344b['where'],{'$or':_['map'](_0x69c6e0,function(_0x2bb920){if(_0x2bb920['type']!==_0xee1f('0x3e')){var _0x505b02={};_0x505b02[_0x2bb920[_0xee1f('0x2a')]]={'$like':'%'+_0x2fcc3a[_0xee1f('0x31')][_0xee1f('0x3c')]+'%'};return _0x505b02;}})});}_0x19344b=_[_0xee1f('0x3d')]({},_0x19344b,_0x2fcc3a[_0xee1f('0x3f')]);var _0x53a52b={'where':_0x19344b[_0xee1f('0x39')]};return db['Campaign']['count'](_0x53a52b)[_0xee1f('0x25')](function(_0x44ec9e){_0x4f8c8e[_0xee1f('0x21')]=_0x44ec9e;if(_0x2fcc3a[_0xee1f('0x31')][_0xee1f('0x40')]){_0x19344b[_0xee1f('0x41')]=[{'all':!![]}];}return db[_0xee1f('0x2d')][_0xee1f('0x42')](_0x19344b);})[_0xee1f('0x25')](function(_0x8a3c3c){_0x4f8c8e[_0xee1f('0x43')]=_0x8a3c3c;return _0x4f8c8e;})[_0xee1f('0x25')](respondWithFilteredResult(_0x3d0a52,_0x19344b))[_0xee1f('0x44')](handleError(_0x3d0a52,null));};exports[_0xee1f('0x45')]=function(_0x144f16,_0xf2fdf3){var _0x2468cb={'raw':![],'where':{'id':_0x144f16[_0xee1f('0x46')]['id']}},_0x29dc1b={};_0x29dc1b[_0xee1f('0x32')]=_['keys'](db[_0xee1f('0x2d')][_0xee1f('0x2e')]);_0x29dc1b['query']=_['keys'](_0x144f16[_0xee1f('0x31')]);_0x29dc1b[_0xee1f('0x3a')]=_[_0xee1f('0x33')](_0x29dc1b[_0xee1f('0x32')],_0x29dc1b['query']);_0x2468cb[_0xee1f('0x35')]=_[_0xee1f('0x33')](_0x29dc1b[_0xee1f('0x32')],qs['fields'](_0x144f16[_0xee1f('0x31')]['fields']));_0x2468cb['attributes']=_0x2468cb[_0xee1f('0x35')][_0xee1f('0x36')]?_0x2468cb[_0xee1f('0x35')]:_0x29dc1b['model'];if(_0x144f16[_0xee1f('0x31')][_0xee1f('0x40')]){_0x2468cb[_0xee1f('0x41')]=[{'all':!![]}];}_0x2468cb=_['merge']({},_0x2468cb,_0x144f16[_0xee1f('0x3f')]);return db[_0xee1f('0x2d')]['find'](_0x2468cb)[_0xee1f('0x25')](handleEntityNotFound(_0xf2fdf3,null))[_0xee1f('0x25')](respondWithResult(_0xf2fdf3,null))['catch'](handleError(_0xf2fdf3,null));};exports['create']=function(_0x55dfb6,_0x5b93d6){return db['Campaign'][_0xee1f('0x47')](_0x55dfb6[_0xee1f('0x48')],{})['then'](function(_0x174a40){var _0x6848b9=_0x55dfb6[_0xee1f('0x49')][_0xee1f('0x4a')]({'plain':!![]});if(!_0x6848b9)throw new Error(_0xee1f('0x4b'));if(_0x6848b9[_0xee1f('0x4c')]===_0xee1f('0x49')){var _0x4ed908=_0x174a40[_0xee1f('0x4a')]({'plain':!![]});var _0x32d7fd=_0xee1f('0x27');return db[_0xee1f('0x4d')]['find']({'where':{'name':_0x32d7fd,'userProfileId':_0x6848b9['userProfileId']},'raw':!![]})['then'](function(_0x57b9af){if(_0x57b9af&&_0x57b9af['autoAssociation']===0x0){return db[_0xee1f('0x28')][_0xee1f('0x47')]({'name':_0x4ed908['name'],'resourceId':_0x4ed908['id'],'type':_0x57b9af[_0xee1f('0x2a')],'sectionId':_0x57b9af['id']},{})[_0xee1f('0x25')](function(){return _0x174a40;});}else{return _0x174a40;}})[_0xee1f('0x44')](function(_0x206371){logger[_0xee1f('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x206371);throw _0x206371;});}return _0x174a40;})[_0xee1f('0x25')](respondWithResult(_0x5b93d6,0xc9))[_0xee1f('0x44')](handleError(_0x5b93d6,null));};exports[_0xee1f('0x4e')]=function(_0x4414d8,_0x1dc5f4){var _0x5cff21={'where':{'id':_0x4414d8[_0xee1f('0x46')]['id']}},_0x2de796={};_0x2de796[_0xee1f('0x32')]=_['keys'](db['Campaign'][_0xee1f('0x2e')]);_0x5cff21[_0xee1f('0x35')]=_[_0xee1f('0x33')](_0x2de796[_0xee1f('0x32')],qs[_0xee1f('0x34')](_0x4414d8[_0xee1f('0x31')][_0xee1f('0x34')]));_0x5cff21[_0xee1f('0x35')]=_0x5cff21['attributes'][_0xee1f('0x36')]?_0x5cff21[_0xee1f('0x35')]:_0x2de796[_0xee1f('0x32')];if(_0x4414d8[_0xee1f('0x31')][_0xee1f('0x40')]){_0x5cff21[_0xee1f('0x41')]=[{'all':!![]}];}_0x5cff21=_[_0xee1f('0x3d')]({},_0x5cff21,_0x4414d8[_0xee1f('0x3f')]);return db[_0xee1f('0x2d')][_0xee1f('0x4f')](_0x5cff21)['then'](handleEntityNotFound(_0x1dc5f4,null))[_0xee1f('0x25')](function(_0x1485b4){if(_0x1485b4){var _0x25b380=_0x1485b4[_0xee1f('0x4a')]({'plain':!![]});_0x25b380=qs[_0xee1f('0x50')](_0x25b380,['id',_0xee1f('0x51'),_0xee1f('0x52')]);_0x4414d8[_0xee1f('0x48')]=_[_0xee1f('0x50')](_0x4414d8[_0xee1f('0x48')],['id',_0xee1f('0x51'),_0xee1f('0x52')]);return db[_0xee1f('0x2d')][_0xee1f('0x47')](_['merge'](_0x25b380,_0x4414d8[_0xee1f('0x48')]),{'include':_0x4414d8[_0xee1f('0x31')][_0xee1f('0x40')]?[{'all':!![]}]:undefined})[_0xee1f('0x25')](function(_0x2ce827){var _0x2de2af=_0x4414d8[_0xee1f('0x49')]['get']({'plain':!![]});if(!_0x2de2af)throw new Error(_0xee1f('0x4b'));if(_0x2de2af['role']===_0xee1f('0x49')){var _0x434b7a=_0x2ce827[_0xee1f('0x4a')]({'plain':!![]});var _0xd8812=_0xee1f('0x27');return db[_0xee1f('0x4d')]['find']({'where':{'name':_0xd8812,'userProfileId':_0x2de2af[_0xee1f('0x53')]},'raw':!![]})[_0xee1f('0x25')](function(_0x1809b6){if(_0x1809b6&&_0x1809b6[_0xee1f('0x54')]===0x0){return db['UserProfileResource'][_0xee1f('0x47')]({'name':_0x434b7a[_0xee1f('0x2a')],'resourceId':_0x434b7a['id'],'type':_0x1809b6[_0xee1f('0x2a')],'sectionId':_0x1809b6['id']},{})[_0xee1f('0x25')](function(){return _0x2ce827;});}else{return _0x2ce827;}})['catch'](function(_0x2752cf){logger['error'](_0xee1f('0x55'),_0x2752cf);throw _0x2752cf;});}return _0x2ce827;});}})[_0xee1f('0x25')](respondWithResult(_0x1dc5f4,0xc9))[_0xee1f('0x44')](handleError(_0x1dc5f4,null));};exports[_0xee1f('0x56')]=function(_0x257c80,_0x2ef896){if(_0x257c80[_0xee1f('0x48')]['id']){delete _0x257c80[_0xee1f('0x48')]['id'];}return db[_0xee1f('0x2d')][_0xee1f('0x4f')]({'where':{'id':_0x257c80[_0xee1f('0x46')]['id']}})[_0xee1f('0x25')](handleEntityNotFound(_0x2ef896,null))[_0xee1f('0x25')](saveUpdates(_0x257c80['body'],null))[_0xee1f('0x25')](respondWithResult(_0x2ef896,null))['catch'](handleError(_0x2ef896,null));};exports['destroy']=function(_0x215d72,_0x53a407){return db[_0xee1f('0x2d')]['find']({'where':{'id':_0x215d72[_0xee1f('0x46')]['id']}})[_0xee1f('0x25')](handleEntityNotFound(_0x53a407,null))[_0xee1f('0x25')](removeEntity(_0x53a407,null))['catch'](handleError(_0x53a407,null));};exports[_0xee1f('0x57')]=function(_0x1fafcc,_0xfab3f8,_0x6e34a8){var _0x467477={'raw':!![],'where':{}};var _0x479d83={};var _0x4d028d={'count':0x0,'rows':[]};return db[_0xee1f('0x2d')]['findOne']({'where':{'id':_0x1fafcc[_0xee1f('0x46')]['id']}})['then'](handleEntityNotFound(_0xfab3f8,null))[_0xee1f('0x25')](function(_0x3ab991){if(_0x3ab991){_0x479d83['model']=_['keys'](db[_0xee1f('0x58')][_0xee1f('0x2e')]);_0x479d83[_0xee1f('0x31')]=_[_0xee1f('0x59')](_0x1fafcc['query']);_0x479d83[_0xee1f('0x3a')]=_[_0xee1f('0x33')](_0x479d83[_0xee1f('0x32')],_0x479d83[_0xee1f('0x31')]);_0x467477[_0xee1f('0x35')]=_[_0xee1f('0x33')](_0x479d83[_0xee1f('0x32')],qs[_0xee1f('0x34')](_0x1fafcc[_0xee1f('0x31')][_0xee1f('0x34')]));_0x467477[_0xee1f('0x35')]=_0x467477['attributes'][_0xee1f('0x36')]?_0x467477[_0xee1f('0x35')]:_0x479d83['model'];if(!_0x1fafcc['query'][_0xee1f('0x5a')]('nolimit')){_0x467477[_0xee1f('0x20')]=qs[_0xee1f('0x20')](_0x1fafcc['query'][_0xee1f('0x20')]);_0x467477['offset']=qs[_0xee1f('0x1e')](_0x1fafcc['query'][_0xee1f('0x1e')]);}_0x467477[_0xee1f('0x5b')]=qs[_0xee1f('0x38')](_0x1fafcc[_0xee1f('0x31')]['sort']);_0x467477[_0xee1f('0x39')]=qs['filters'](_['pick'](_0x1fafcc[_0xee1f('0x31')],_0x479d83['filters']));_0x467477[_0xee1f('0x39')][_0xee1f('0x5c')]=_0x3ab991['id'];if(_0x1fafcc[_0xee1f('0x31')][_0xee1f('0x3c')]){_0x467477[_0xee1f('0x39')]=_['merge'](_0x467477[_0xee1f('0x39')],{'$or':_[_0xee1f('0x30')](_0x467477[_0xee1f('0x35')],function(_0x3db12d){var _0x49a7a={};_0x49a7a[_0x3db12d]={'$like':'%'+_0x1fafcc['query'][_0xee1f('0x3c')]+'%'};return _0x49a7a;})});}_0x467477=_[_0xee1f('0x3d')]({},_0x467477,_0x1fafcc[_0xee1f('0x3f')]);return db[_0xee1f('0x58')][_0xee1f('0x21')]({'where':_0x467477[_0xee1f('0x39')]})[_0xee1f('0x25')](function(_0x5ece5b){_0x4d028d[_0xee1f('0x21')]=_0x5ece5b;if(_0x1fafcc['query']['includeAll']){_0x467477[_0xee1f('0x41')]=[{'all':!![]}];}return db[_0xee1f('0x58')]['findAll'](_0x467477);})[_0xee1f('0x25')](function(_0x55ad8c){_0x4d028d[_0xee1f('0x43')]=_0x55ad8c;return _0x4d028d;});}})[_0xee1f('0x25')](respondWithFilteredResult(_0xfab3f8,_0x467477))[_0xee1f('0x44')](handleError(_0xfab3f8,null));};exports[_0xee1f('0x5d')]=function(_0x1a02fd,_0x1423d9,_0x556da1){var _0x30f46a={'raw':!![],'where':{}};var _0x20641d={};var _0x2c7403={'count':0x0,'rows':[]};return db[_0xee1f('0x2d')][_0xee1f('0x5e')]({'where':{'id':_0x1a02fd[_0xee1f('0x46')]['id']}})[_0xee1f('0x25')](handleEntityNotFound(_0x1423d9,null))['then'](function(_0x58bd03){if(_0x58bd03){_0x20641d['model']=_[_0xee1f('0x59')](db['CmHopperHistory'][_0xee1f('0x2e')]);_0x20641d['query']=_[_0xee1f('0x59')](_0x1a02fd[_0xee1f('0x31')]);_0x20641d[_0xee1f('0x3a')]=_[_0xee1f('0x33')](_0x20641d[_0xee1f('0x32')],_0x20641d[_0xee1f('0x31')]);_0x30f46a['attributes']=_['intersection'](_0x20641d['model'],qs[_0xee1f('0x34')](_0x1a02fd[_0xee1f('0x31')][_0xee1f('0x34')]));_0x30f46a[_0xee1f('0x35')]=_0x30f46a['attributes']['length']?_0x30f46a[_0xee1f('0x35')]:_0x20641d[_0xee1f('0x32')];if(!_0x1a02fd[_0xee1f('0x31')][_0xee1f('0x5a')](_0xee1f('0x37'))){_0x30f46a[_0xee1f('0x20')]=qs[_0xee1f('0x20')](_0x1a02fd['query'][_0xee1f('0x20')]);_0x30f46a[_0xee1f('0x1e')]=qs[_0xee1f('0x1e')](_0x1a02fd[_0xee1f('0x31')]['offset']);}_0x30f46a[_0xee1f('0x5b')]=qs[_0xee1f('0x38')](_0x1a02fd[_0xee1f('0x31')]['sort']);_0x30f46a[_0xee1f('0x39')]=qs[_0xee1f('0x3a')](_[_0xee1f('0x3b')](_0x1a02fd[_0xee1f('0x31')],_0x20641d[_0xee1f('0x3a')]));_0x30f46a[_0xee1f('0x39')][_0xee1f('0x5c')]=_0x58bd03['id'];if(_0x1a02fd[_0xee1f('0x31')][_0xee1f('0x3c')]){_0x30f46a[_0xee1f('0x39')]=_['merge'](_0x30f46a[_0xee1f('0x39')],{'$or':_['map'](_0x30f46a[_0xee1f('0x35')],function(_0x19186a){var _0x2575c0={};_0x2575c0[_0x19186a]={'$like':'%'+_0x1a02fd[_0xee1f('0x31')][_0xee1f('0x3c')]+'%'};return _0x2575c0;})});}_0x30f46a=_[_0xee1f('0x3d')]({},_0x30f46a,_0x1a02fd[_0xee1f('0x3f')]);return db['CmHopperHistory']['count']({'where':_0x30f46a[_0xee1f('0x39')]})[_0xee1f('0x25')](function(_0x37430d){_0x2c7403[_0xee1f('0x21')]=_0x37430d;if(_0x1a02fd[_0xee1f('0x31')]['includeAll']){_0x30f46a[_0xee1f('0x41')]=[{'all':!![]}];}return db[_0xee1f('0x5f')][_0xee1f('0x42')](_0x30f46a);})[_0xee1f('0x25')](function(_0x4d3639){_0x2c7403[_0xee1f('0x43')]=_0x4d3639;return _0x2c7403;});}})[_0xee1f('0x25')](respondWithFilteredResult(_0x1423d9,_0x30f46a))[_0xee1f('0x44')](handleError(_0x1423d9,null));};exports[_0xee1f('0x60')]=function(_0x33e4a0,_0x3aaef4,_0x430628){var _0x4bc7f6={'raw':!![],'where':{}};var _0x3d9587={};var _0x127aec={'count':0x0,'rows':[]};return db[_0xee1f('0x2d')][_0xee1f('0x5e')]({'where':{'id':_0x33e4a0[_0xee1f('0x46')]['id']}})[_0xee1f('0x25')](handleEntityNotFound(_0x3aaef4,null))[_0xee1f('0x25')](function(_0x1c556a){if(_0x1c556a){_0x3d9587[_0xee1f('0x32')]=_[_0xee1f('0x59')](db[_0xee1f('0x61')]['rawAttributes']);_0x3d9587[_0xee1f('0x31')]=_[_0xee1f('0x59')](_0x33e4a0[_0xee1f('0x31')]);_0x3d9587[_0xee1f('0x3a')]=_[_0xee1f('0x33')](_0x3d9587['model'],_0x3d9587['query']);_0x4bc7f6[_0xee1f('0x35')]=_[_0xee1f('0x33')](_0x3d9587['model'],qs['fields'](_0x33e4a0[_0xee1f('0x31')][_0xee1f('0x34')]));_0x4bc7f6[_0xee1f('0x35')]=_0x4bc7f6['attributes'][_0xee1f('0x36')]?_0x4bc7f6[_0xee1f('0x35')]:_0x3d9587[_0xee1f('0x32')];if(!_0x33e4a0[_0xee1f('0x31')][_0xee1f('0x5a')](_0xee1f('0x37'))){_0x4bc7f6[_0xee1f('0x20')]=qs[_0xee1f('0x20')](_0x33e4a0[_0xee1f('0x31')][_0xee1f('0x20')]);_0x4bc7f6['offset']=qs[_0xee1f('0x1e')](_0x33e4a0[_0xee1f('0x31')][_0xee1f('0x1e')]);}_0x4bc7f6['order']=qs['sort'](_0x33e4a0[_0xee1f('0x31')][_0xee1f('0x38')]);_0x4bc7f6[_0xee1f('0x39')]=qs['filters'](_[_0xee1f('0x3b')](_0x33e4a0[_0xee1f('0x31')],_0x3d9587[_0xee1f('0x3a')]));_0x4bc7f6[_0xee1f('0x39')][_0xee1f('0x5c')]=_0x1c556a['id'];if(_0x33e4a0[_0xee1f('0x31')]['filter']){_0x4bc7f6[_0xee1f('0x39')]=_['merge'](_0x4bc7f6['where'],{'$or':_[_0xee1f('0x30')](_0x4bc7f6['attributes'],function(_0x221ff9){var _0xf35cf6={};_0xf35cf6[_0x221ff9]={'$like':'%'+_0x33e4a0[_0xee1f('0x31')][_0xee1f('0x3c')]+'%'};return _0xf35cf6;})});}_0x4bc7f6=_[_0xee1f('0x3d')]({},_0x4bc7f6,_0x33e4a0['options']);return db[_0xee1f('0x61')][_0xee1f('0x21')]({'where':_0x4bc7f6[_0xee1f('0x39')]})[_0xee1f('0x25')](function(_0x1d8aa3){_0x127aec['count']=_0x1d8aa3;if(_0x33e4a0[_0xee1f('0x31')][_0xee1f('0x40')]){_0x4bc7f6[_0xee1f('0x41')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xee1f('0x42')](_0x4bc7f6);})[_0xee1f('0x25')](function(_0x1e6866){_0x127aec[_0xee1f('0x43')]=_0x1e6866;return _0x127aec;});}})['then'](respondWithFilteredResult(_0x3aaef4,_0x4bc7f6))['catch'](handleError(_0x3aaef4,null));};exports[_0xee1f('0x62')]=function(_0x3b4c6e,_0x231141,_0x4ddd44){var _0x39656c={'raw':!![],'where':{}};var _0x367ce4={};var _0x25dbb5={'count':0x0,'rows':[]};return db[_0xee1f('0x2d')]['findOne']({'where':{'id':_0x3b4c6e[_0xee1f('0x46')]['id']}})[_0xee1f('0x25')](handleEntityNotFound(_0x231141,null))[_0xee1f('0x25')](function(_0x11aef6){if(_0x11aef6){_0x367ce4['model']=_[_0xee1f('0x59')](db['CmHopperBlack'][_0xee1f('0x2e')]);_0x367ce4['query']=_[_0xee1f('0x59')](_0x3b4c6e[_0xee1f('0x31')]);_0x367ce4[_0xee1f('0x3a')]=_['intersection'](_0x367ce4[_0xee1f('0x32')],_0x367ce4[_0xee1f('0x31')]);_0x39656c[_0xee1f('0x35')]=_[_0xee1f('0x33')](_0x367ce4[_0xee1f('0x32')],qs['fields'](_0x3b4c6e['query'][_0xee1f('0x34')]));_0x39656c[_0xee1f('0x35')]=_0x39656c['attributes'][_0xee1f('0x36')]?_0x39656c[_0xee1f('0x35')]:_0x367ce4['model'];if(!_0x3b4c6e[_0xee1f('0x31')]['hasOwnProperty'](_0xee1f('0x37'))){_0x39656c[_0xee1f('0x20')]=qs[_0xee1f('0x20')](_0x3b4c6e[_0xee1f('0x31')][_0xee1f('0x20')]);_0x39656c['offset']=qs[_0xee1f('0x1e')](_0x3b4c6e[_0xee1f('0x31')][_0xee1f('0x1e')]);}_0x39656c[_0xee1f('0x5b')]=qs['sort'](_0x3b4c6e[_0xee1f('0x31')][_0xee1f('0x38')]);_0x39656c['where']=qs[_0xee1f('0x3a')](_[_0xee1f('0x3b')](_0x3b4c6e[_0xee1f('0x31')],_0x367ce4[_0xee1f('0x3a')]));_0x39656c[_0xee1f('0x39')]['CampaignId']=_0x11aef6['id'];if(_0x3b4c6e[_0xee1f('0x31')][_0xee1f('0x3c')]){_0x39656c['where']=_[_0xee1f('0x3d')](_0x39656c['where'],{'$or':_[_0xee1f('0x30')](_0x39656c[_0xee1f('0x35')],function(_0x3ed177){var _0x433cfa={};_0x433cfa[_0x3ed177]={'$like':'%'+_0x3b4c6e[_0xee1f('0x31')][_0xee1f('0x3c')]+'%'};return _0x433cfa;})});}_0x39656c=_['merge']({},_0x39656c,_0x3b4c6e[_0xee1f('0x3f')]);return db[_0xee1f('0x63')][_0xee1f('0x21')]({'where':_0x39656c[_0xee1f('0x39')]})[_0xee1f('0x25')](function(_0x538792){_0x25dbb5['count']=_0x538792;if(_0x3b4c6e[_0xee1f('0x31')][_0xee1f('0x40')]){_0x39656c['include']=[{'all':!![]}];}return db[_0xee1f('0x63')]['findAll'](_0x39656c);})[_0xee1f('0x25')](function(_0x468fcc){_0x25dbb5[_0xee1f('0x43')]=_0x468fcc;return _0x25dbb5;});}})[_0xee1f('0x25')](respondWithFilteredResult(_0x231141,_0x39656c))[_0xee1f('0x44')](handleError(_0x231141,null));};exports[_0xee1f('0x64')]=function(_0x109bb0,_0x48113a,_0x4e5c25){var _0x5bc568={};var _0x429110={};var _0x2c3a3a;var _0x3f5878;return db['Campaign'][_0xee1f('0x5e')]({'where':{'id':_0x109bb0['params']['id']}})[_0xee1f('0x25')](handleEntityNotFound(_0x48113a,null))[_0xee1f('0x25')](function(_0x1bcbb3){if(_0x1bcbb3){_0x2c3a3a=_0x1bcbb3;_0x429110[_0xee1f('0x32')]=_['keys'](db[_0xee1f('0x65')][_0xee1f('0x2e')]);_0x429110[_0xee1f('0x31')]=_[_0xee1f('0x59')](_0x109bb0[_0xee1f('0x31')]);_0x429110[_0xee1f('0x3a')]=_['intersection'](_0x429110['model'],_0x429110['query']);_0x5bc568[_0xee1f('0x35')]=_[_0xee1f('0x33')](_0x429110[_0xee1f('0x32')],qs['fields'](_0x109bb0[_0xee1f('0x31')][_0xee1f('0x34')]));_0x5bc568[_0xee1f('0x35')]=_0x5bc568['attributes']['length']?_0x5bc568[_0xee1f('0x35')]:_0x429110[_0xee1f('0x32')];_0x5bc568['order']=qs[_0xee1f('0x38')](_0x109bb0[_0xee1f('0x31')][_0xee1f('0x38')]);_0x5bc568['where']=qs['filters'](_[_0xee1f('0x3b')](_0x109bb0[_0xee1f('0x31')],_0x429110[_0xee1f('0x3a')]));if(_0x109bb0[_0xee1f('0x31')][_0xee1f('0x3c')]){_0x5bc568[_0xee1f('0x39')]=_[_0xee1f('0x3d')](_0x5bc568[_0xee1f('0x39')],{'$or':_['map'](_0x5bc568[_0xee1f('0x35')],function(_0x484db4){var _0x2a0e2d={};_0x2a0e2d[_0x484db4]={'$like':'%'+_0x109bb0[_0xee1f('0x31')][_0xee1f('0x3c')]+'%'};return _0x2a0e2d;})});}_0x5bc568=_[_0xee1f('0x3d')]({},_0x5bc568,_0x109bb0[_0xee1f('0x3f')]);return _0x2c3a3a[_0xee1f('0x64')](_0x5bc568);}})['then'](function(_0x5069e6){if(_0x5069e6){_0x3f5878=_0x5069e6[_0xee1f('0x36')];if(!_0x109bb0[_0xee1f('0x31')]['hasOwnProperty'](_0xee1f('0x37'))){_0x5bc568[_0xee1f('0x20')]=qs[_0xee1f('0x20')](_0x109bb0[_0xee1f('0x31')][_0xee1f('0x20')]);_0x5bc568[_0xee1f('0x1e')]=qs[_0xee1f('0x1e')](_0x109bb0[_0xee1f('0x31')][_0xee1f('0x1e')]);}return _0x2c3a3a[_0xee1f('0x64')](_0x5bc568);}})[_0xee1f('0x25')](function(_0x17cf9b){if(_0x17cf9b){return _0x17cf9b?{'count':_0x3f5878,'rows':_0x17cf9b}:null;}})[_0xee1f('0x25')](respondWithResult(_0x48113a,null))[_0xee1f('0x44')](handleError(_0x48113a,null));};exports[_0xee1f('0x66')]=function(_0x1fcfa9,_0xf54268,_0x53652f){var _0x349b0a,_0x247751;var _0x21764b=[];var _0xff01e0=moment()[_0xee1f('0x67')](_0xee1f('0x68'));return db[_0xee1f('0x2d')]['find']({'where':{'id':_0x1fcfa9[_0xee1f('0x46')]['id']}})[_0xee1f('0x25')](handleEntityNotFound(_0xf54268,null))[_0xee1f('0x25')](function(_0x1f37d2){if(_0x1f37d2){_0x247751=_0x1f37d2;return _0x1f37d2[_0xee1f('0x66')](_0x1fcfa9[_0xee1f('0x48')]['ids'],_[_0xee1f('0x50')](_0x1fcfa9[_0xee1f('0x48')],[_0xee1f('0x69'),'id'])||{});}return null;})['spread'](function(_0x5bf163){var _0x5b0c28;var _0xa7ad3e;_0x349b0a=_0x5bf163||[];var _0x49e1f0=[];if(_0x5bf163){for(var _0x252fbd=0x0;_0x252fbd<_0x5bf163['length'];_0x252fbd+=0x1){var _0x22a477=_0x5bf163[_0x252fbd][_0xee1f('0x4a')]({'plain':!![]});_0x247751[_0xee1f('0x6a')]=_0x1fcfa9['body']['dialCheckDuplicateType']?_0x1fcfa9[_0xee1f('0x48')][_0xee1f('0x6a')]:_0x247751[_0xee1f('0x6a')];switch(_0x247751['dialCheckDuplicateType']){case _0xee1f('0x6b'):_0x5b0c28=squel[_0xee1f('0x6c')]()[_0xee1f('0x6d')](_0xee1f('0x6e'))[_0xee1f('0x6f')]([_0xee1f('0x70'),_0xee1f('0x71'),_0xee1f('0x72'),_0xee1f('0x73'),_0xee1f('0x5c'),_0xee1f('0x51'),_0xee1f('0x52')],squel[_0xee1f('0x74')]()[_0xee1f('0x75')](_0xee1f('0x70'),'phone')[_0xee1f('0x75')](_0xee1f('0x76'),_0xee1f('0x71'))[_0xee1f('0x75')]('id',_0xee1f('0x72'))['field'](_0x22a477[_0xee1f('0x77')][_0xee1f('0x78')](),_0xee1f('0x73'))[_0xee1f('0x75')](_0x1fcfa9[_0xee1f('0x46')]['id']['toString'](),_0xee1f('0x5c'))[_0xee1f('0x75')]('\x27'+_0xff01e0+'\x27',_0xee1f('0x51'))['field']('\x27'+_0xff01e0+'\x27',_0xee1f('0x52'))['from']('cm_contacts')[_0xee1f('0x39')](_0xee1f('0x79'))['where'](_0xee1f('0x7a'),_0x22a477[_0xee1f('0x77')][_0xee1f('0x78')]())[_0xee1f('0x39')](_0xee1f('0x7b'))[_0xee1f('0x39')]('phone\x20NOT\x20IN\x20(?)',squel[_0xee1f('0x74')]()[_0xee1f('0x75')](_0xee1f('0x7c'))[_0xee1f('0x7d')](_0xee1f('0x7e'))[_0xee1f('0x39')]('CampaignId\x20=\x20?',_0x1fcfa9[_0xee1f('0x46')]['id'][_0xee1f('0x78')]()))[_0xee1f('0x39')](_0xee1f('0x7f'),squel[_0xee1f('0x74')]()[_0xee1f('0x75')](_0xee1f('0x80'))['from'](_0xee1f('0x6e'))[_0xee1f('0x39')](_0xee1f('0x81'),_0x1fcfa9[_0xee1f('0x46')]['id'][_0xee1f('0x78')]())))[_0xee1f('0x78')]();break;case _0xee1f('0x82'):_0x5b0c28=squel[_0xee1f('0x6c')]()[_0xee1f('0x6d')](_0xee1f('0x6e'))[_0xee1f('0x6f')](['phone','scheduledAt',_0xee1f('0x72'),_0xee1f('0x73'),'CampaignId',_0xee1f('0x51'),'updatedAt'],squel[_0xee1f('0x74')]()[_0xee1f('0x75')]('phone',_0xee1f('0x70'))[_0xee1f('0x75')](_0xee1f('0x76'),_0xee1f('0x71'))[_0xee1f('0x75')]('id',_0xee1f('0x72'))[_0xee1f('0x75')](_0x22a477['CmListId'][_0xee1f('0x78')](),_0xee1f('0x73'))[_0xee1f('0x75')](_0x1fcfa9[_0xee1f('0x46')]['id']['toString'](),_0xee1f('0x5c'))['field']('\x27'+_0xff01e0+'\x27',_0xee1f('0x51'))['field']('\x27'+_0xff01e0+'\x27',_0xee1f('0x52'))[_0xee1f('0x7d')](_0xee1f('0x83'))[_0xee1f('0x39')](_0xee1f('0x79'))[_0xee1f('0x39')]('ListId\x20=\x20?',_0x22a477[_0xee1f('0x77')][_0xee1f('0x78')]())[_0xee1f('0x39')]('phone\x20IS\x20NOT\x20NULL')[_0xee1f('0x39')](_0xee1f('0x7f'),squel[_0xee1f('0x74')]()[_0xee1f('0x75')](_0xee1f('0x80'))[_0xee1f('0x7d')](_0xee1f('0x6e'))['where'](_0xee1f('0x81'),_0x1fcfa9['params']['id'][_0xee1f('0x78')]())))[_0xee1f('0x78')]();break;default:_0x5b0c28=squel[_0xee1f('0x6c')]()['into'](_0xee1f('0x6e'))['fromQuery'](['phone','scheduledAt',_0xee1f('0x72'),_0xee1f('0x73'),_0xee1f('0x5c'),_0xee1f('0x51'),'updatedAt'],squel[_0xee1f('0x74')]()['field'](_0xee1f('0x70'),_0xee1f('0x70'))[_0xee1f('0x75')]('NOW()',_0xee1f('0x71'))['field']('id',_0xee1f('0x72'))[_0xee1f('0x75')](_0x22a477[_0xee1f('0x77')][_0xee1f('0x78')](),'ListId')[_0xee1f('0x75')](_0x1fcfa9[_0xee1f('0x46')]['id'][_0xee1f('0x78')](),'CampaignId')[_0xee1f('0x75')]('\x27'+_0xff01e0+'\x27',_0xee1f('0x51'))['field']('\x27'+_0xff01e0+'\x27',_0xee1f('0x52'))[_0xee1f('0x7d')](_0xee1f('0x83'))[_0xee1f('0x39')](_0xee1f('0x79'))[_0xee1f('0x39')](_0xee1f('0x7a'),_0x22a477[_0xee1f('0x77')]['toString']())[_0xee1f('0x39')](_0xee1f('0x7b')))[_0xee1f('0x78')]();}_0xa7ad3e=squel[_0xee1f('0x6c')]()['into'](_0xee1f('0x84'))['fromQuery']([_0xee1f('0x85'),_0xee1f('0x71'),_0xee1f('0x70'),_0xee1f('0x86'),'createdAt',_0xee1f('0x52')],squel['select']()['field']('h.id','id')[_0xee1f('0x75')](_0xee1f('0x76'),_0xee1f('0x71'))[_0xee1f('0x75')](_0xee1f('0x87'),'phone')[_0xee1f('0x75')](_0xee1f('0x88'),_0xee1f('0x86'))['field']('\x27'+_0xff01e0+'\x27',_0xee1f('0x51'))['field']('\x27'+_0xff01e0+'\x27','updatedAt')[_0xee1f('0x7d')](_0xee1f('0x89'),'ci')['join'](_0xee1f('0x6e'),'h',_0xee1f('0x8a'))[_0xee1f('0x39')](_0xee1f('0x8b'),_0x22a477['CmListId'][_0xee1f('0x78')]())[_0xee1f('0x39')](_0xee1f('0x8c'),_0x1fcfa9[_0xee1f('0x46')]['id'][_0xee1f('0x78')]())[_0xee1f('0x39')](_0xee1f('0x8d'),_0xff01e0))[_0xee1f('0x78')]();_0x49e1f0['push'](db[_0xee1f('0x8e')]['query'](_0x5b0c28));_0x21764b[_0xee1f('0x8f')](db[_0xee1f('0x8e')]['query'](_0xa7ad3e));}return BPromise[_0xee1f('0x90')](_0x49e1f0);}})[_0xee1f('0x25')](function(){return BPromise[_0xee1f('0x90')](_0x21764b);})[_0xee1f('0x25')](function(){return _0x349b0a;})['then'](respondWithResult(_0xf54268,null))['catch'](handleError(_0xf54268,null));};exports[_0xee1f('0x91')]=function(_0x211cc3,_0x2c9249,_0xa9daf1){return db[_0xee1f('0x2d')][_0xee1f('0x4f')]({'where':{'id':_0x211cc3[_0xee1f('0x46')]['id']}})[_0xee1f('0x25')](handleEntityNotFound(_0x2c9249,null))[_0xee1f('0x25')](function(_0x1b56cb){if(_0x1b56cb){return _0x1b56cb[_0xee1f('0x91')](_0x211cc3[_0xee1f('0x31')][_0xee1f('0x69')]);}})[_0xee1f('0x25')](function(_0x5f5cf8){if(_0x5f5cf8){return db[_0xee1f('0x58')][_0xee1f('0x26')]({'where':{'ListId':_0x211cc3[_0xee1f('0x31')]['ids'],'CampaignId':_0x211cc3[_0xee1f('0x46')]['id']}})[_0xee1f('0x25')](function(){return _0x5f5cf8;});}})['then'](respondWithStatusCode(_0x2c9249,null))['catch'](handleError(_0x2c9249,null));};exports[_0xee1f('0x92')]=function(_0x3d633a,_0x36829e,_0x4530ee){var _0x5c7b59={};var _0x48b10b={};var _0x4f3d14;var _0x5a512d;return db[_0xee1f('0x2d')][_0xee1f('0x5e')]({'where':{'id':_0x3d633a[_0xee1f('0x46')]['id']}})[_0xee1f('0x25')](handleEntityNotFound(_0x36829e,null))[_0xee1f('0x25')](function(_0x30cfa6){if(_0x30cfa6){_0x4f3d14=_0x30cfa6;_0x48b10b[_0xee1f('0x32')]=_[_0xee1f('0x59')](db['CmList']['rawAttributes']);_0x48b10b[_0xee1f('0x31')]=_[_0xee1f('0x59')](_0x3d633a[_0xee1f('0x31')]);_0x48b10b['filters']=_[_0xee1f('0x33')](_0x48b10b['model'],_0x48b10b[_0xee1f('0x31')]);_0x5c7b59[_0xee1f('0x35')]=_[_0xee1f('0x33')](_0x48b10b[_0xee1f('0x32')],qs['fields'](_0x3d633a[_0xee1f('0x31')][_0xee1f('0x34')]));_0x5c7b59[_0xee1f('0x35')]=_0x5c7b59[_0xee1f('0x35')]['length']?_0x5c7b59[_0xee1f('0x35')]:_0x48b10b['model'];_0x5c7b59['order']=qs[_0xee1f('0x38')](_0x3d633a['query'][_0xee1f('0x38')]);_0x5c7b59[_0xee1f('0x39')]=qs[_0xee1f('0x3a')](_[_0xee1f('0x3b')](_0x3d633a[_0xee1f('0x31')],_0x48b10b[_0xee1f('0x3a')]));if(_0x3d633a[_0xee1f('0x31')]['filter']){_0x5c7b59[_0xee1f('0x39')]=_['merge'](_0x5c7b59['where'],{'$or':_['map'](_0x5c7b59[_0xee1f('0x35')],function(_0x233fc6){var _0x36927c={};_0x36927c[_0x233fc6]={'$like':'%'+_0x3d633a[_0xee1f('0x31')]['filter']+'%'};return _0x36927c;})});}_0x5c7b59=_[_0xee1f('0x3d')]({},_0x5c7b59,_0x3d633a[_0xee1f('0x3f')]);return _0x4f3d14[_0xee1f('0x92')](_0x5c7b59);}})[_0xee1f('0x25')](function(_0x46dec7){if(_0x46dec7){_0x5a512d=_0x46dec7[_0xee1f('0x36')];if(!_0x3d633a[_0xee1f('0x31')]['hasOwnProperty'](_0xee1f('0x37'))){_0x5c7b59[_0xee1f('0x20')]=qs[_0xee1f('0x20')](_0x3d633a[_0xee1f('0x31')]['limit']);_0x5c7b59[_0xee1f('0x1e')]=qs[_0xee1f('0x1e')](_0x3d633a[_0xee1f('0x31')][_0xee1f('0x1e')]);}return _0x4f3d14[_0xee1f('0x92')](_0x5c7b59);}})[_0xee1f('0x25')](function(_0x4aabb1){if(_0x4aabb1){return _0x4aabb1?{'count':_0x5a512d,'rows':_0x4aabb1}:null;}})['then'](respondWithResult(_0x36829e,null))['catch'](handleError(_0x36829e,null));};exports[_0xee1f('0x93')]=function(_0x4a948a,_0x21453a,_0x11fddc){var _0x3fbc27,_0x550c87;var _0x4e5f5b=[];var _0x282c1b=moment()['format'](_0xee1f('0x68'));return db['Campaign']['find']({'where':{'id':_0x4a948a[_0xee1f('0x46')]['id']}})[_0xee1f('0x25')](handleEntityNotFound(_0x21453a,null))[_0xee1f('0x25')](function(_0x5c84c3){if(_0x5c84c3){_0x550c87=_0x5c84c3;return _0x5c84c3[_0xee1f('0x93')](_0x4a948a['body']['ids'],_[_0xee1f('0x50')](_0x4a948a[_0xee1f('0x48')],['ids','id'])||{});}return null;})[_0xee1f('0x94')](function(_0x2227aa){var _0x2e61a4;var _0x446295;_0x3fbc27=_0x2227aa||[];var _0x5cfbca=[];if(_0x2227aa){for(var _0x372a41=0x0;_0x372a41<_0x2227aa[_0xee1f('0x36')];_0x372a41+=0x1){var _0x2ef353=_0x2227aa[_0x372a41][_0xee1f('0x4a')]({'plain':!![]});_0x2e61a4=squel[_0xee1f('0x6c')]()['into']('cm_hopper_black')[_0xee1f('0x6f')]([_0xee1f('0x70'),_0xee1f('0x72'),_0xee1f('0x73'),_0xee1f('0x5c'),_0xee1f('0x51'),_0xee1f('0x52')],squel[_0xee1f('0x74')]()[_0xee1f('0x75')]('phone',_0xee1f('0x70'))[_0xee1f('0x75')]('id','ContactId')[_0xee1f('0x75')](_0x2ef353[_0xee1f('0x77')][_0xee1f('0x78')](),_0xee1f('0x73'))['field'](_0x4a948a[_0xee1f('0x46')]['id'][_0xee1f('0x78')](),_0xee1f('0x5c'))[_0xee1f('0x75')](_0xee1f('0x76'),_0xee1f('0x51'))['field']('NOW()','updatedAt')['from'](_0xee1f('0x83'))[_0xee1f('0x39')]('deletedAt\x20IS\x20NULL')[_0xee1f('0x39')](_0xee1f('0x7a'),_0x2ef353[_0xee1f('0x77')][_0xee1f('0x78')]())[_0xee1f('0x39')](_0xee1f('0x7b')))[_0xee1f('0x78')]();_0x5cfbca['push'](db[_0xee1f('0x8e')][_0xee1f('0x31')](_0x2e61a4));}return BPromise[_0xee1f('0x90')](_0x5cfbca);}})[_0xee1f('0x25')](function(){return _0x3fbc27;})['then'](respondWithResult(_0x21453a,null))[_0xee1f('0x44')](handleError(_0x21453a,null));};exports[_0xee1f('0x95')]=function(_0x29bc2c,_0x5559bd,_0x3a81cd){return db[_0xee1f('0x2d')][_0xee1f('0x4f')]({'where':{'id':_0x29bc2c[_0xee1f('0x46')]['id']}})[_0xee1f('0x25')](handleEntityNotFound(_0x5559bd,null))['then'](function(_0x6ed336){if(_0x6ed336){return _0x6ed336['removeBlackLists'](_0x29bc2c[_0xee1f('0x31')][_0xee1f('0x69')]);}})[_0xee1f('0x25')](function(_0x5e8c64){if(_0x5e8c64){return db[_0xee1f('0x63')]['destroy']({'where':{'ListId':_0x29bc2c[_0xee1f('0x31')][_0xee1f('0x69')],'CampaignId':_0x29bc2c[_0xee1f('0x46')]['id']}})[_0xee1f('0x25')](function(){return _0x5e8c64;});}})['then'](respondWithStatusCode(_0x5559bd,null))[_0xee1f('0x44')](handleError(_0x5559bd,null));}; \ No newline at end of file +var _0xf485=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','get','then','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','order','sort','where','filter','merge','VIRTUAL','options','Campaign','includeAll','findAll','rows','show','params','fields','include','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','IvrCampaigns','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','user','userProfileId','findOne','CmHopper','hasOwnProperty','nolimit','pick','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','format','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','select','field','phone','NOW()','CmListId','toString','from','cm_contacts','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','cmHopperId','OrderBy','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.CampaignId=?','h.createdAt\x20=\x20?','sequelize','push','all','removeLists','getBlackLists','addBlackLists','YYYY-MM-DD\x20HH:mm:ss','ListId\x20=\x20?','eml-format','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse'];(function(_0x1722ea,_0x4244ec){var _0x267aa0=function(_0x22cbe3){while(--_0x22cbe3){_0x1722ea['push'](_0x1722ea['shift']());}};_0x267aa0(++_0x4244ec);}(_0xf485,0x1af));var _0x5f48=function(_0x1a4b58,_0x3c8c4a){_0x1a4b58=_0x1a4b58-0x0;var _0x16e54a=_0xf485[_0x1a4b58];return _0x16e54a;};'use strict';var emlformat=require(_0x5f48('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5f48('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5f48('0x2'));var moment=require(_0x5f48('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5f48('0x4'));var util=require(_0x5f48('0x5'));var path=require(_0x5f48('0x6'));var sox=require('sox');var csv=require(_0x5f48('0x7'));var ejs=require(_0x5f48('0x8'));var fs=require('fs');var fs_extra=require(_0x5f48('0x9'));var _=require(_0x5f48('0xa'));var squel=require(_0x5f48('0xb'));var crypto=require(_0x5f48('0xc'));var jsforce=require(_0x5f48('0xd'));var deskjs=require(_0x5f48('0xe'));var toCsv=require(_0x5f48('0x7'));var querystring=require('querystring');var Papa=require(_0x5f48('0xf'));var Redis=require(_0x5f48('0x10'));var authService=require(_0x5f48('0x11'));var qs=require(_0x5f48('0x12'));var as=require(_0x5f48('0x13'));var hardwareService=require(_0x5f48('0x14'));var logger=require(_0x5f48('0x15'))('api');var utils=require(_0x5f48('0x16'));var config=require(_0x5f48('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5f48('0x18'))['db'];function respondWithStatusCode(_0x3464d3,_0x1f491d){_0x1f491d=_0x1f491d||0xcc;return function(_0x3e634f){if(_0x3e634f){return _0x3464d3[_0x5f48('0x19')](_0x1f491d);}return _0x3464d3['status'](_0x1f491d)['end']();};}function respondWithResult(_0x36a908,_0x16baa0){_0x16baa0=_0x16baa0||0xc8;return function(_0x1a1183){if(_0x1a1183){return _0x36a908[_0x5f48('0x1a')](_0x16baa0)[_0x5f48('0x1b')](_0x1a1183);}};}function respondWithFilteredResult(_0x470562,_0x474620){return function(_0x26ff72){if(_0x26ff72){var _0x49127f=typeof _0x474620[_0x5f48('0x1c')]===_0x5f48('0x1d')&&typeof _0x474620[_0x5f48('0x1e')]===_0x5f48('0x1d');var _0x324f0e=_0x26ff72['count'];var _0x1d6054=_0x49127f?0x0:_0x474620[_0x5f48('0x1c')];var _0x36896c=_0x49127f?_0x26ff72[_0x5f48('0x1f')]:_0x474620[_0x5f48('0x1c')]+_0x474620['limit'];var _0x636218;if(_0x36896c>=_0x324f0e){_0x36896c=_0x324f0e;_0x636218=0xc8;}else{_0x636218=0xce;}_0x470562[_0x5f48('0x1a')](_0x636218);return _0x470562[_0x5f48('0x20')](_0x5f48('0x21'),_0x1d6054+'-'+_0x36896c+'/'+_0x324f0e)[_0x5f48('0x1b')](_0x26ff72);}return null;};}function patchUpdates(_0x1c0e83){return function(_0x13545d){try{jsonpatch[_0x5f48('0x22')](_0x13545d,_0x1c0e83,!![]);}catch(_0x495e94){return BPromise['reject'](_0x495e94);}return _0x13545d[_0x5f48('0x23')]();};}function saveUpdates(_0x30b10b,_0x535830){return function(_0x40ab87){if(_0x40ab87){return _0x40ab87[_0x5f48('0x24')](_0x30b10b)['then'](function(_0x33dec5){return _0x33dec5;});}return null;};}function removeEntity(_0x58487b,_0x205ad3){return function(_0x315b72){if(_0x315b72){return _0x315b72[_0x5f48('0x25')]()['then'](function(){var _0x48520f=_0x315b72[_0x5f48('0x26')]({'plain':!![]});var _0x22c0a9='IvrCampaigns';return db['UserProfileResource'][_0x5f48('0x25')]({'where':{'type':_0x22c0a9,'resourceId':_0x48520f['id']}})['then'](function(){return _0x315b72;});})[_0x5f48('0x27')](function(){_0x58487b[_0x5f48('0x1a')](0xcc)[_0x5f48('0x28')]();});}};}function handleEntityNotFound(_0xe03d5,_0x12d509){return function(_0x12009d){if(!_0x12009d){_0xe03d5[_0x5f48('0x19')](0x194);}return _0x12009d;};}function handleError(_0x2831c8,_0x16a0cd){_0x16a0cd=_0x16a0cd||0x1f4;return function(_0x4731ab){logger[_0x5f48('0x29')](_0x4731ab[_0x5f48('0x2a')]);if(_0x4731ab[_0x5f48('0x2b')]){delete _0x4731ab[_0x5f48('0x2b')];}_0x2831c8['status'](_0x16a0cd)[_0x5f48('0x2c')](_0x4731ab);};}exports[_0x5f48('0x2d')]=function(_0x30e440,_0x4c10fb){var _0x46b41f={},_0x444e9c={},_0x1a244a={'count':0x0,'rows':[]};var _0x467696=_[_0x5f48('0x2e')](db['Campaign'][_0x5f48('0x2f')],function(_0x49816f){return{'name':_0x49816f[_0x5f48('0x30')],'type':_0x49816f[_0x5f48('0x31')][_0x5f48('0x32')]};});_0x444e9c[_0x5f48('0x33')]=_[_0x5f48('0x2e')](_0x467696,_0x5f48('0x2b'));_0x444e9c[_0x5f48('0x34')]=_[_0x5f48('0x35')](_0x30e440[_0x5f48('0x34')]);_0x444e9c[_0x5f48('0x36')]=_[_0x5f48('0x37')](_0x444e9c[_0x5f48('0x33')],_0x444e9c['query']);_0x46b41f[_0x5f48('0x38')]=_[_0x5f48('0x37')](_0x444e9c[_0x5f48('0x33')],qs['fields'](_0x30e440[_0x5f48('0x34')]['fields']));_0x46b41f[_0x5f48('0x38')]=_0x46b41f[_0x5f48('0x38')][_0x5f48('0x39')]?_0x46b41f[_0x5f48('0x38')]:_0x444e9c[_0x5f48('0x33')];if(!_0x30e440[_0x5f48('0x34')]['hasOwnProperty']('nolimit')){_0x46b41f['limit']=qs[_0x5f48('0x1e')](_0x30e440[_0x5f48('0x34')]['limit']);_0x46b41f[_0x5f48('0x1c')]=qs[_0x5f48('0x1c')](_0x30e440[_0x5f48('0x34')][_0x5f48('0x1c')]);}_0x46b41f[_0x5f48('0x3a')]=qs[_0x5f48('0x3b')](_0x30e440[_0x5f48('0x34')][_0x5f48('0x3b')]);_0x46b41f[_0x5f48('0x3c')]=qs['filters'](_['pick'](_0x30e440['query'],_0x444e9c[_0x5f48('0x36')]),_0x467696);if(_0x30e440[_0x5f48('0x34')][_0x5f48('0x3d')]){_0x46b41f[_0x5f48('0x3c')]=_[_0x5f48('0x3e')](_0x46b41f['where'],{'$or':_[_0x5f48('0x2e')](_0x467696,function(_0x153267){if(_0x153267[_0x5f48('0x31')]!==_0x5f48('0x3f')){var _0x310af6={};_0x310af6[_0x153267[_0x5f48('0x2b')]]={'$like':'%'+_0x30e440[_0x5f48('0x34')]['filter']+'%'};return _0x310af6;}})});}_0x46b41f=_[_0x5f48('0x3e')]({},_0x46b41f,_0x30e440[_0x5f48('0x40')]);var _0x6c84e1={'where':_0x46b41f[_0x5f48('0x3c')]};return db[_0x5f48('0x41')]['count'](_0x6c84e1)['then'](function(_0x437f44){_0x1a244a[_0x5f48('0x1f')]=_0x437f44;if(_0x30e440['query'][_0x5f48('0x42')]){_0x46b41f['include']=[{'all':!![]}];}return db[_0x5f48('0x41')][_0x5f48('0x43')](_0x46b41f);})['then'](function(_0x1baa73){_0x1a244a[_0x5f48('0x44')]=_0x1baa73;return _0x1a244a;})['then'](respondWithFilteredResult(_0x4c10fb,_0x46b41f))['catch'](handleError(_0x4c10fb,null));};exports[_0x5f48('0x45')]=function(_0x3e955c,_0x244d96){var _0x403a24={'raw':![],'where':{'id':_0x3e955c[_0x5f48('0x46')]['id']}},_0x260fb8={};_0x260fb8[_0x5f48('0x33')]=_[_0x5f48('0x35')](db[_0x5f48('0x41')][_0x5f48('0x2f')]);_0x260fb8[_0x5f48('0x34')]=_['keys'](_0x3e955c[_0x5f48('0x34')]);_0x260fb8[_0x5f48('0x36')]=_[_0x5f48('0x37')](_0x260fb8[_0x5f48('0x33')],_0x260fb8['query']);_0x403a24[_0x5f48('0x38')]=_['intersection'](_0x260fb8[_0x5f48('0x33')],qs[_0x5f48('0x47')](_0x3e955c['query'][_0x5f48('0x47')]));_0x403a24[_0x5f48('0x38')]=_0x403a24[_0x5f48('0x38')][_0x5f48('0x39')]?_0x403a24['attributes']:_0x260fb8[_0x5f48('0x33')];if(_0x3e955c[_0x5f48('0x34')][_0x5f48('0x42')]){_0x403a24[_0x5f48('0x48')]=[{'all':!![]}];}_0x403a24=_[_0x5f48('0x3e')]({},_0x403a24,_0x3e955c[_0x5f48('0x40')]);return db[_0x5f48('0x41')][_0x5f48('0x49')](_0x403a24)[_0x5f48('0x27')](handleEntityNotFound(_0x244d96,null))['then'](respondWithResult(_0x244d96,null))[_0x5f48('0x4a')](handleError(_0x244d96,null));};exports[_0x5f48('0x4b')]=function(_0x34132d,_0x2f813a){return db['Campaign'][_0x5f48('0x4b')](_0x34132d[_0x5f48('0x4c')],{})['then'](function(_0xc23d59){var _0x101015=_0x34132d['user'][_0x5f48('0x26')]({'plain':!![]});if(!_0x101015)throw new Error(_0x5f48('0x4d'));if(_0x101015[_0x5f48('0x4e')]==='user'){var _0x5f3b1f=_0xc23d59['get']({'plain':!![]});var _0x55afb4=_0x5f48('0x4f');return db[_0x5f48('0x50')][_0x5f48('0x49')]({'where':{'name':_0x55afb4,'userProfileId':_0x101015['userProfileId']},'raw':!![]})[_0x5f48('0x27')](function(_0x50fae9){if(_0x50fae9&&_0x50fae9[_0x5f48('0x51')]===0x0){return db[_0x5f48('0x52')][_0x5f48('0x4b')]({'name':_0x5f3b1f['name'],'resourceId':_0x5f3b1f['id'],'type':_0x50fae9[_0x5f48('0x2b')],'sectionId':_0x50fae9['id']},{})[_0x5f48('0x27')](function(){return _0xc23d59;});}else{return _0xc23d59;}})[_0x5f48('0x4a')](function(_0x22302c){logger[_0x5f48('0x29')](_0x5f48('0x53'),_0x22302c);throw _0x22302c;});}return _0xc23d59;})[_0x5f48('0x27')](respondWithResult(_0x2f813a,0xc9))[_0x5f48('0x4a')](handleError(_0x2f813a,null));};exports[_0x5f48('0x54')]=function(_0x1a9ebf,_0x2015cb){var _0x45c74a={'where':{'id':_0x1a9ebf['params']['id']}},_0x4ff63e={};_0x4ff63e[_0x5f48('0x33')]=_[_0x5f48('0x35')](db[_0x5f48('0x41')][_0x5f48('0x2f')]);_0x45c74a[_0x5f48('0x38')]=_[_0x5f48('0x37')](_0x4ff63e['model'],qs[_0x5f48('0x47')](_0x1a9ebf[_0x5f48('0x34')]['fields']));_0x45c74a['attributes']=_0x45c74a['attributes'][_0x5f48('0x39')]?_0x45c74a[_0x5f48('0x38')]:_0x4ff63e[_0x5f48('0x33')];if(_0x1a9ebf['query'][_0x5f48('0x42')]){_0x45c74a[_0x5f48('0x48')]=[{'all':!![]}];}_0x45c74a=_[_0x5f48('0x3e')]({},_0x45c74a,_0x1a9ebf[_0x5f48('0x40')]);return db[_0x5f48('0x41')][_0x5f48('0x49')](_0x45c74a)[_0x5f48('0x27')](handleEntityNotFound(_0x2015cb,null))[_0x5f48('0x27')](function(_0x4276b8){if(_0x4276b8){var _0x39f162=_0x4276b8[_0x5f48('0x26')]({'plain':!![]});_0x39f162=qs[_0x5f48('0x55')](_0x39f162,['id','createdAt',_0x5f48('0x56')]);_0x1a9ebf[_0x5f48('0x4c')]=_[_0x5f48('0x55')](_0x1a9ebf[_0x5f48('0x4c')],['id',_0x5f48('0x57'),'updatedAt']);return db[_0x5f48('0x41')]['create'](_[_0x5f48('0x3e')](_0x39f162,_0x1a9ebf['body']),{'include':_0x1a9ebf['query'][_0x5f48('0x42')]?[{'all':!![]}]:undefined})['then'](function(_0x284bf8){var _0x17e5ee=_0x1a9ebf[_0x5f48('0x58')]['get']({'plain':!![]});if(!_0x17e5ee)throw new Error(_0x5f48('0x4d'));if(_0x17e5ee[_0x5f48('0x4e')]===_0x5f48('0x58')){var _0x21c051=_0x284bf8[_0x5f48('0x26')]({'plain':!![]});var _0x51365b=_0x5f48('0x4f');return db[_0x5f48('0x50')]['find']({'where':{'name':_0x51365b,'userProfileId':_0x17e5ee[_0x5f48('0x59')]},'raw':!![]})[_0x5f48('0x27')](function(_0x340b7e){if(_0x340b7e&&_0x340b7e[_0x5f48('0x51')]===0x0){return db[_0x5f48('0x52')][_0x5f48('0x4b')]({'name':_0x21c051[_0x5f48('0x2b')],'resourceId':_0x21c051['id'],'type':_0x340b7e[_0x5f48('0x2b')],'sectionId':_0x340b7e['id']},{})[_0x5f48('0x27')](function(){return _0x284bf8;});}else{return _0x284bf8;}})[_0x5f48('0x4a')](function(_0x57a38c){logger[_0x5f48('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x57a38c);throw _0x57a38c;});}return _0x284bf8;});}})[_0x5f48('0x27')](respondWithResult(_0x2015cb,0xc9))[_0x5f48('0x4a')](handleError(_0x2015cb,null));};exports[_0x5f48('0x24')]=function(_0x4713b1,_0x340988){if(_0x4713b1['body']['id']){delete _0x4713b1[_0x5f48('0x4c')]['id'];}return db[_0x5f48('0x41')]['find']({'where':{'id':_0x4713b1[_0x5f48('0x46')]['id']}})['then'](handleEntityNotFound(_0x340988,null))[_0x5f48('0x27')](saveUpdates(_0x4713b1[_0x5f48('0x4c')],null))[_0x5f48('0x27')](respondWithResult(_0x340988,null))['catch'](handleError(_0x340988,null));};exports[_0x5f48('0x25')]=function(_0x16828b,_0x4775da){return db['Campaign'][_0x5f48('0x49')]({'where':{'id':_0x16828b[_0x5f48('0x46')]['id']}})[_0x5f48('0x27')](handleEntityNotFound(_0x4775da,null))[_0x5f48('0x27')](removeEntity(_0x4775da,null))[_0x5f48('0x4a')](handleError(_0x4775da,null));};exports['getHoppers']=function(_0x317077,_0x887605,_0x651cfc){var _0xd7d61c={'raw':!![],'where':{}};var _0x450b3b={};var _0x4a264f={'count':0x0,'rows':[]};return db[_0x5f48('0x41')][_0x5f48('0x5a')]({'where':{'id':_0x317077[_0x5f48('0x46')]['id']}})[_0x5f48('0x27')](handleEntityNotFound(_0x887605,null))['then'](function(_0x5c78bb){if(_0x5c78bb){_0x450b3b[_0x5f48('0x33')]=_[_0x5f48('0x35')](db[_0x5f48('0x5b')]['rawAttributes']);_0x450b3b[_0x5f48('0x34')]=_[_0x5f48('0x35')](_0x317077[_0x5f48('0x34')]);_0x450b3b[_0x5f48('0x36')]=_[_0x5f48('0x37')](_0x450b3b[_0x5f48('0x33')],_0x450b3b[_0x5f48('0x34')]);_0xd7d61c[_0x5f48('0x38')]=_['intersection'](_0x450b3b[_0x5f48('0x33')],qs[_0x5f48('0x47')](_0x317077[_0x5f48('0x34')]['fields']));_0xd7d61c[_0x5f48('0x38')]=_0xd7d61c[_0x5f48('0x38')][_0x5f48('0x39')]?_0xd7d61c[_0x5f48('0x38')]:_0x450b3b['model'];if(!_0x317077[_0x5f48('0x34')][_0x5f48('0x5c')](_0x5f48('0x5d'))){_0xd7d61c[_0x5f48('0x1e')]=qs['limit'](_0x317077[_0x5f48('0x34')][_0x5f48('0x1e')]);_0xd7d61c[_0x5f48('0x1c')]=qs[_0x5f48('0x1c')](_0x317077[_0x5f48('0x34')][_0x5f48('0x1c')]);}_0xd7d61c[_0x5f48('0x3a')]=qs['sort'](_0x317077[_0x5f48('0x34')][_0x5f48('0x3b')]);_0xd7d61c[_0x5f48('0x3c')]=qs['filters'](_[_0x5f48('0x5e')](_0x317077[_0x5f48('0x34')],_0x450b3b[_0x5f48('0x36')]));_0xd7d61c[_0x5f48('0x3c')][_0x5f48('0x5f')]=_0x5c78bb['id'];if(_0x317077[_0x5f48('0x34')][_0x5f48('0x3d')]){_0xd7d61c['where']=_[_0x5f48('0x3e')](_0xd7d61c[_0x5f48('0x3c')],{'$or':_[_0x5f48('0x2e')](_0xd7d61c[_0x5f48('0x38')],function(_0x4b9deb){var _0x2d9b23={};_0x2d9b23[_0x4b9deb]={'$like':'%'+_0x317077[_0x5f48('0x34')][_0x5f48('0x3d')]+'%'};return _0x2d9b23;})});}_0xd7d61c=_[_0x5f48('0x3e')]({},_0xd7d61c,_0x317077[_0x5f48('0x40')]);return db[_0x5f48('0x5b')][_0x5f48('0x1f')]({'where':_0xd7d61c[_0x5f48('0x3c')]})[_0x5f48('0x27')](function(_0x4a5295){_0x4a264f[_0x5f48('0x1f')]=_0x4a5295;if(_0x317077[_0x5f48('0x34')][_0x5f48('0x42')]){_0xd7d61c[_0x5f48('0x48')]=[{'all':!![]}];}return db[_0x5f48('0x5b')][_0x5f48('0x43')](_0xd7d61c);})[_0x5f48('0x27')](function(_0x3f2a3e){_0x4a264f[_0x5f48('0x44')]=_0x3f2a3e;return _0x4a264f;});}})[_0x5f48('0x27')](respondWithFilteredResult(_0x887605,_0xd7d61c))['catch'](handleError(_0x887605,null));};exports[_0x5f48('0x60')]=function(_0x9aeb44,_0x2a7222,_0x29632b){var _0x3a601f={'raw':!![],'where':{}};var _0x2d6705={};var _0x2c39ea={'count':0x0,'rows':[]};return db[_0x5f48('0x41')][_0x5f48('0x5a')]({'where':{'id':_0x9aeb44[_0x5f48('0x46')]['id']}})['then'](handleEntityNotFound(_0x2a7222,null))['then'](function(_0x183e70){if(_0x183e70){_0x2d6705[_0x5f48('0x33')]=_[_0x5f48('0x35')](db['CmHopperHistory'][_0x5f48('0x2f')]);_0x2d6705[_0x5f48('0x34')]=_[_0x5f48('0x35')](_0x9aeb44['query']);_0x2d6705[_0x5f48('0x36')]=_['intersection'](_0x2d6705[_0x5f48('0x33')],_0x2d6705['query']);_0x3a601f[_0x5f48('0x38')]=_[_0x5f48('0x37')](_0x2d6705[_0x5f48('0x33')],qs[_0x5f48('0x47')](_0x9aeb44[_0x5f48('0x34')][_0x5f48('0x47')]));_0x3a601f['attributes']=_0x3a601f['attributes'][_0x5f48('0x39')]?_0x3a601f['attributes']:_0x2d6705['model'];if(!_0x9aeb44[_0x5f48('0x34')]['hasOwnProperty'](_0x5f48('0x5d'))){_0x3a601f[_0x5f48('0x1e')]=qs[_0x5f48('0x1e')](_0x9aeb44[_0x5f48('0x34')][_0x5f48('0x1e')]);_0x3a601f[_0x5f48('0x1c')]=qs[_0x5f48('0x1c')](_0x9aeb44['query']['offset']);}_0x3a601f[_0x5f48('0x3a')]=qs[_0x5f48('0x3b')](_0x9aeb44['query'][_0x5f48('0x3b')]);_0x3a601f[_0x5f48('0x3c')]=qs[_0x5f48('0x36')](_[_0x5f48('0x5e')](_0x9aeb44['query'],_0x2d6705[_0x5f48('0x36')]));_0x3a601f[_0x5f48('0x3c')][_0x5f48('0x5f')]=_0x183e70['id'];if(_0x9aeb44['query']['filter']){_0x3a601f[_0x5f48('0x3c')]=_[_0x5f48('0x3e')](_0x3a601f[_0x5f48('0x3c')],{'$or':_[_0x5f48('0x2e')](_0x3a601f[_0x5f48('0x38')],function(_0x254d4b){var _0xce22a7={};_0xce22a7[_0x254d4b]={'$like':'%'+_0x9aeb44[_0x5f48('0x34')][_0x5f48('0x3d')]+'%'};return _0xce22a7;})});}_0x3a601f=_[_0x5f48('0x3e')]({},_0x3a601f,_0x9aeb44[_0x5f48('0x40')]);return db[_0x5f48('0x61')][_0x5f48('0x1f')]({'where':_0x3a601f['where']})['then'](function(_0x243918){_0x2c39ea[_0x5f48('0x1f')]=_0x243918;if(_0x9aeb44[_0x5f48('0x34')][_0x5f48('0x42')]){_0x3a601f['include']=[{'all':!![]}];}return db[_0x5f48('0x61')][_0x5f48('0x43')](_0x3a601f);})[_0x5f48('0x27')](function(_0x43b1db){_0x2c39ea['rows']=_0x43b1db;return _0x2c39ea;});}})[_0x5f48('0x27')](respondWithFilteredResult(_0x2a7222,_0x3a601f))[_0x5f48('0x4a')](handleError(_0x2a7222,null));};exports[_0x5f48('0x62')]=function(_0x269fa0,_0x6416b7,_0x1e2e81){var _0x316215={'raw':!![],'where':{}};var _0x358764={};var _0x3bf41d={'count':0x0,'rows':[]};return db[_0x5f48('0x41')][_0x5f48('0x5a')]({'where':{'id':_0x269fa0[_0x5f48('0x46')]['id']}})[_0x5f48('0x27')](handleEntityNotFound(_0x6416b7,null))['then'](function(_0x2baf1d){if(_0x2baf1d){_0x358764[_0x5f48('0x33')]=_[_0x5f48('0x35')](db[_0x5f48('0x63')][_0x5f48('0x2f')]);_0x358764[_0x5f48('0x34')]=_[_0x5f48('0x35')](_0x269fa0[_0x5f48('0x34')]);_0x358764['filters']=_['intersection'](_0x358764[_0x5f48('0x33')],_0x358764[_0x5f48('0x34')]);_0x316215[_0x5f48('0x38')]=_[_0x5f48('0x37')](_0x358764['model'],qs[_0x5f48('0x47')](_0x269fa0[_0x5f48('0x34')][_0x5f48('0x47')]));_0x316215[_0x5f48('0x38')]=_0x316215[_0x5f48('0x38')][_0x5f48('0x39')]?_0x316215[_0x5f48('0x38')]:_0x358764['model'];if(!_0x269fa0[_0x5f48('0x34')][_0x5f48('0x5c')]('nolimit')){_0x316215['limit']=qs[_0x5f48('0x1e')](_0x269fa0[_0x5f48('0x34')][_0x5f48('0x1e')]);_0x316215[_0x5f48('0x1c')]=qs[_0x5f48('0x1c')](_0x269fa0[_0x5f48('0x34')][_0x5f48('0x1c')]);}_0x316215['order']=qs[_0x5f48('0x3b')](_0x269fa0['query'][_0x5f48('0x3b')]);_0x316215[_0x5f48('0x3c')]=qs[_0x5f48('0x36')](_['pick'](_0x269fa0[_0x5f48('0x34')],_0x358764[_0x5f48('0x36')]));_0x316215[_0x5f48('0x3c')][_0x5f48('0x5f')]=_0x2baf1d['id'];if(_0x269fa0[_0x5f48('0x34')]['filter']){_0x316215[_0x5f48('0x3c')]=_[_0x5f48('0x3e')](_0x316215[_0x5f48('0x3c')],{'$or':_[_0x5f48('0x2e')](_0x316215[_0x5f48('0x38')],function(_0x5ad8de){var _0x59b219={};_0x59b219[_0x5ad8de]={'$like':'%'+_0x269fa0[_0x5f48('0x34')]['filter']+'%'};return _0x59b219;})});}_0x316215=_[_0x5f48('0x3e')]({},_0x316215,_0x269fa0[_0x5f48('0x40')]);return db[_0x5f48('0x63')][_0x5f48('0x1f')]({'where':_0x316215[_0x5f48('0x3c')]})[_0x5f48('0x27')](function(_0x2c892d){_0x3bf41d[_0x5f48('0x1f')]=_0x2c892d;if(_0x269fa0[_0x5f48('0x34')][_0x5f48('0x42')]){_0x316215[_0x5f48('0x48')]=[{'all':!![]}];}return db[_0x5f48('0x63')]['findAll'](_0x316215);})[_0x5f48('0x27')](function(_0x5cfc8a){_0x3bf41d[_0x5f48('0x44')]=_0x5cfc8a;return _0x3bf41d;});}})[_0x5f48('0x27')](respondWithFilteredResult(_0x6416b7,_0x316215))[_0x5f48('0x4a')](handleError(_0x6416b7,null));};exports[_0x5f48('0x64')]=function(_0x23f027,_0x29f7f7,_0x56ac1e){var _0x924551={'raw':!![],'where':{}};var _0x2223c1={};var _0x24913b={'count':0x0,'rows':[]};return db[_0x5f48('0x41')][_0x5f48('0x5a')]({'where':{'id':_0x23f027['params']['id']}})[_0x5f48('0x27')](handleEntityNotFound(_0x29f7f7,null))[_0x5f48('0x27')](function(_0xe21563){if(_0xe21563){_0x2223c1[_0x5f48('0x33')]=_['keys'](db[_0x5f48('0x65')][_0x5f48('0x2f')]);_0x2223c1[_0x5f48('0x34')]=_['keys'](_0x23f027['query']);_0x2223c1[_0x5f48('0x36')]=_[_0x5f48('0x37')](_0x2223c1[_0x5f48('0x33')],_0x2223c1[_0x5f48('0x34')]);_0x924551[_0x5f48('0x38')]=_[_0x5f48('0x37')](_0x2223c1['model'],qs[_0x5f48('0x47')](_0x23f027[_0x5f48('0x34')][_0x5f48('0x47')]));_0x924551[_0x5f48('0x38')]=_0x924551['attributes']['length']?_0x924551[_0x5f48('0x38')]:_0x2223c1['model'];if(!_0x23f027[_0x5f48('0x34')]['hasOwnProperty'](_0x5f48('0x5d'))){_0x924551['limit']=qs[_0x5f48('0x1e')](_0x23f027['query']['limit']);_0x924551[_0x5f48('0x1c')]=qs[_0x5f48('0x1c')](_0x23f027[_0x5f48('0x34')][_0x5f48('0x1c')]);}_0x924551[_0x5f48('0x3a')]=qs[_0x5f48('0x3b')](_0x23f027[_0x5f48('0x34')][_0x5f48('0x3b')]);_0x924551[_0x5f48('0x3c')]=qs[_0x5f48('0x36')](_[_0x5f48('0x5e')](_0x23f027[_0x5f48('0x34')],_0x2223c1['filters']));_0x924551['where'][_0x5f48('0x5f')]=_0xe21563['id'];if(_0x23f027[_0x5f48('0x34')][_0x5f48('0x3d')]){_0x924551[_0x5f48('0x3c')]=_[_0x5f48('0x3e')](_0x924551[_0x5f48('0x3c')],{'$or':_[_0x5f48('0x2e')](_0x924551[_0x5f48('0x38')],function(_0x4fb9da){var _0x374e28={};_0x374e28[_0x4fb9da]={'$like':'%'+_0x23f027['query'][_0x5f48('0x3d')]+'%'};return _0x374e28;})});}_0x924551=_[_0x5f48('0x3e')]({},_0x924551,_0x23f027[_0x5f48('0x40')]);return db[_0x5f48('0x65')][_0x5f48('0x1f')]({'where':_0x924551[_0x5f48('0x3c')]})[_0x5f48('0x27')](function(_0x12e9ce){_0x24913b[_0x5f48('0x1f')]=_0x12e9ce;if(_0x23f027[_0x5f48('0x34')][_0x5f48('0x42')]){_0x924551['include']=[{'all':!![]}];}return db[_0x5f48('0x65')][_0x5f48('0x43')](_0x924551);})[_0x5f48('0x27')](function(_0x30966a){_0x24913b[_0x5f48('0x44')]=_0x30966a;return _0x24913b;});}})[_0x5f48('0x27')](respondWithFilteredResult(_0x29f7f7,_0x924551))[_0x5f48('0x4a')](handleError(_0x29f7f7,null));};exports[_0x5f48('0x66')]=function(_0x54aa13,_0x3e67e4,_0x325ee8){var _0x4d4d44={};var _0x1c0bc5={};var _0x169d7e;var _0x40d1af;return db[_0x5f48('0x41')]['findOne']({'where':{'id':_0x54aa13[_0x5f48('0x46')]['id']}})[_0x5f48('0x27')](handleEntityNotFound(_0x3e67e4,null))[_0x5f48('0x27')](function(_0x1d3323){if(_0x1d3323){_0x169d7e=_0x1d3323;_0x1c0bc5[_0x5f48('0x33')]=_[_0x5f48('0x35')](db[_0x5f48('0x67')][_0x5f48('0x2f')]);_0x1c0bc5['query']=_[_0x5f48('0x35')](_0x54aa13[_0x5f48('0x34')]);_0x1c0bc5[_0x5f48('0x36')]=_['intersection'](_0x1c0bc5[_0x5f48('0x33')],_0x1c0bc5[_0x5f48('0x34')]);_0x4d4d44[_0x5f48('0x38')]=_[_0x5f48('0x37')](_0x1c0bc5[_0x5f48('0x33')],qs['fields'](_0x54aa13[_0x5f48('0x34')][_0x5f48('0x47')]));_0x4d4d44[_0x5f48('0x38')]=_0x4d4d44[_0x5f48('0x38')][_0x5f48('0x39')]?_0x4d4d44[_0x5f48('0x38')]:_0x1c0bc5[_0x5f48('0x33')];_0x4d4d44['order']=qs[_0x5f48('0x3b')](_0x54aa13[_0x5f48('0x34')][_0x5f48('0x3b')]);_0x4d4d44[_0x5f48('0x3c')]=qs[_0x5f48('0x36')](_[_0x5f48('0x5e')](_0x54aa13['query'],_0x1c0bc5[_0x5f48('0x36')]));if(_0x54aa13[_0x5f48('0x34')][_0x5f48('0x3d')]){_0x4d4d44['where']=_[_0x5f48('0x3e')](_0x4d4d44[_0x5f48('0x3c')],{'$or':_['map'](_0x4d4d44[_0x5f48('0x38')],function(_0x480b31){var _0x38d8a4={};_0x38d8a4[_0x480b31]={'$like':'%'+_0x54aa13[_0x5f48('0x34')][_0x5f48('0x3d')]+'%'};return _0x38d8a4;})});}_0x4d4d44=_[_0x5f48('0x3e')]({},_0x4d4d44,_0x54aa13[_0x5f48('0x40')]);return _0x169d7e[_0x5f48('0x66')](_0x4d4d44);}})['then'](function(_0x1f9cfb){if(_0x1f9cfb){_0x40d1af=_0x1f9cfb[_0x5f48('0x39')];if(!_0x54aa13[_0x5f48('0x34')][_0x5f48('0x5c')](_0x5f48('0x5d'))){_0x4d4d44[_0x5f48('0x1e')]=qs[_0x5f48('0x1e')](_0x54aa13[_0x5f48('0x34')][_0x5f48('0x1e')]);_0x4d4d44['offset']=qs[_0x5f48('0x1c')](_0x54aa13['query'][_0x5f48('0x1c')]);}return _0x169d7e[_0x5f48('0x66')](_0x4d4d44);}})[_0x5f48('0x27')](function(_0x49665b){if(_0x49665b){return _0x49665b?{'count':_0x40d1af,'rows':_0x49665b}:null;}})[_0x5f48('0x27')](respondWithResult(_0x3e67e4,null))[_0x5f48('0x4a')](handleError(_0x3e67e4,null));};exports['addLists']=function(_0x55b681,_0x485357,_0xd6e51c){var _0x1a8a8d,_0x4b7bd2;var _0x4f0e39=[];var _0x25ddc7=moment()[_0x5f48('0x68')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x5f48('0x41')]['find']({'where':{'id':_0x55b681[_0x5f48('0x46')]['id']}})['then'](handleEntityNotFound(_0x485357,null))[_0x5f48('0x27')](function(_0x1f7ad3){if(_0x1f7ad3){_0x4b7bd2=_0x1f7ad3;return _0x1f7ad3[_0x5f48('0x69')](_0x55b681[_0x5f48('0x4c')]['ids'],_[_0x5f48('0x55')](_0x55b681[_0x5f48('0x4c')],[_0x5f48('0x6a'),'id'])||{});}return null;})[_0x5f48('0x6b')](function(_0x21ed50){var _0xb53a6d;var _0xa9518d;_0x1a8a8d=_0x21ed50||[];var _0x56c9e7=[];if(_0x21ed50){for(var _0x5d25e2=0x0;_0x5d25e2<_0x21ed50[_0x5f48('0x39')];_0x5d25e2+=0x1){var _0xf32f12=_0x21ed50[_0x5d25e2][_0x5f48('0x26')]({'plain':!![]});_0x4b7bd2['dialCheckDuplicateType']=_0x55b681[_0x5f48('0x4c')]['dialCheckDuplicateType']?_0x55b681['body']['dialCheckDuplicateType']:_0x4b7bd2['dialCheckDuplicateType'];switch(_0x4b7bd2[_0x5f48('0x6c')]){case _0x5f48('0x6d'):_0xb53a6d=squel[_0x5f48('0x6e')]()[_0x5f48('0x6f')](_0x5f48('0x70'))[_0x5f48('0x71')](['phone',_0x5f48('0x72'),_0x5f48('0x73'),_0x5f48('0x74'),'CampaignId',_0x5f48('0x57'),_0x5f48('0x56')],squel[_0x5f48('0x75')]()[_0x5f48('0x76')](_0x5f48('0x77'),_0x5f48('0x77'))[_0x5f48('0x76')](_0x5f48('0x78'),_0x5f48('0x72'))['field']('id',_0x5f48('0x73'))[_0x5f48('0x76')](_0xf32f12[_0x5f48('0x79')][_0x5f48('0x7a')](),_0x5f48('0x74'))[_0x5f48('0x76')](_0x55b681[_0x5f48('0x46')]['id']['toString'](),_0x5f48('0x5f'))[_0x5f48('0x76')]('\x27'+_0x25ddc7+'\x27','createdAt')['field']('\x27'+_0x25ddc7+'\x27',_0x5f48('0x56'))[_0x5f48('0x7b')](_0x5f48('0x7c'))['where']('deletedAt\x20IS\x20NULL')[_0x5f48('0x3c')]('ListId\x20=\x20?',_0xf32f12['CmListId'][_0x5f48('0x7a')]())[_0x5f48('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0x5f48('0x3c')](_0x5f48('0x7d'),squel[_0x5f48('0x75')]()[_0x5f48('0x76')](_0x5f48('0x7e'))[_0x5f48('0x7b')](_0x5f48('0x7f'))[_0x5f48('0x3c')]('CampaignId\x20=\x20?',_0x55b681[_0x5f48('0x46')]['id']['toString']()))[_0x5f48('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x5f48('0x76')](_0x5f48('0x80'))[_0x5f48('0x7b')](_0x5f48('0x70'))['where'](_0x5f48('0x81'),_0x55b681[_0x5f48('0x46')]['id']['toString']())))[_0x5f48('0x7a')]();break;case'onlyIfOpen':_0xb53a6d=squel[_0x5f48('0x6e')]()[_0x5f48('0x6f')]('cm_hopper')[_0x5f48('0x71')]([_0x5f48('0x77'),'scheduledAt',_0x5f48('0x73'),_0x5f48('0x74'),'CampaignId',_0x5f48('0x57'),_0x5f48('0x56')],squel[_0x5f48('0x75')]()[_0x5f48('0x76')](_0x5f48('0x77'),'phone')[_0x5f48('0x76')](_0x5f48('0x78'),_0x5f48('0x72'))['field']('id',_0x5f48('0x73'))['field'](_0xf32f12[_0x5f48('0x79')]['toString'](),_0x5f48('0x74'))[_0x5f48('0x76')](_0x55b681[_0x5f48('0x46')]['id']['toString'](),_0x5f48('0x5f'))[_0x5f48('0x76')]('\x27'+_0x25ddc7+'\x27',_0x5f48('0x57'))[_0x5f48('0x76')]('\x27'+_0x25ddc7+'\x27',_0x5f48('0x56'))[_0x5f48('0x7b')](_0x5f48('0x7c'))[_0x5f48('0x3c')](_0x5f48('0x82'))[_0x5f48('0x3c')]('ListId\x20=\x20?',_0xf32f12['CmListId']['toString']())['where'](_0x5f48('0x83'))[_0x5f48('0x3c')](_0x5f48('0x7d'),squel[_0x5f48('0x75')]()[_0x5f48('0x76')]('COALESCE(phone,\x27\x27)')[_0x5f48('0x7b')](_0x5f48('0x70'))['where'](_0x5f48('0x81'),_0x55b681[_0x5f48('0x46')]['id'][_0x5f48('0x7a')]())))['toString']();break;default:_0xb53a6d=squel['insert']()['into'](_0x5f48('0x70'))[_0x5f48('0x71')]([_0x5f48('0x77'),_0x5f48('0x72'),_0x5f48('0x73'),'ListId',_0x5f48('0x5f'),'createdAt',_0x5f48('0x56')],squel[_0x5f48('0x75')]()['field']('phone',_0x5f48('0x77'))[_0x5f48('0x76')]('NOW()',_0x5f48('0x72'))[_0x5f48('0x76')]('id','ContactId')[_0x5f48('0x76')](_0xf32f12[_0x5f48('0x79')][_0x5f48('0x7a')](),_0x5f48('0x74'))['field'](_0x55b681[_0x5f48('0x46')]['id'][_0x5f48('0x7a')](),_0x5f48('0x5f'))['field']('\x27'+_0x25ddc7+'\x27',_0x5f48('0x57'))['field']('\x27'+_0x25ddc7+'\x27',_0x5f48('0x56'))[_0x5f48('0x7b')]('cm_contacts')[_0x5f48('0x3c')](_0x5f48('0x82'))['where']('ListId\x20=\x20?',_0xf32f12[_0x5f48('0x79')][_0x5f48('0x7a')]())[_0x5f48('0x3c')](_0x5f48('0x83')))[_0x5f48('0x7a')]();}_0xa9518d=squel['insert']()[_0x5f48('0x6f')]('cm_hopper_additional_phones')[_0x5f48('0x71')]([_0x5f48('0x84'),_0x5f48('0x72'),_0x5f48('0x77'),_0x5f48('0x85'),_0x5f48('0x57'),_0x5f48('0x56')],squel['select']()['field']('h.id','id')[_0x5f48('0x76')](_0x5f48('0x78'),_0x5f48('0x72'))[_0x5f48('0x76')](_0x5f48('0x86'),_0x5f48('0x77'))[_0x5f48('0x76')](_0x5f48('0x87'),'OrderBy')['field']('\x27'+_0x25ddc7+'\x27',_0x5f48('0x57'))[_0x5f48('0x76')]('\x27'+_0x25ddc7+'\x27','updatedAt')[_0x5f48('0x7b')](_0x5f48('0x88'),'ci')[_0x5f48('0x89')](_0x5f48('0x70'),'h',_0x5f48('0x8a'))[_0x5f48('0x3c')]('h.ListId\x20=\x20?',_0xf32f12[_0x5f48('0x79')][_0x5f48('0x7a')]())[_0x5f48('0x3c')](_0x5f48('0x8b'),_0x55b681[_0x5f48('0x46')]['id'][_0x5f48('0x7a')]())['where'](_0x5f48('0x8c'),_0x25ddc7))[_0x5f48('0x7a')]();_0x56c9e7['push'](db[_0x5f48('0x8d')][_0x5f48('0x34')](_0xb53a6d));_0x4f0e39[_0x5f48('0x8e')](db[_0x5f48('0x8d')][_0x5f48('0x34')](_0xa9518d));}return BPromise['all'](_0x56c9e7);}})[_0x5f48('0x27')](function(){return BPromise[_0x5f48('0x8f')](_0x4f0e39);})['then'](function(){return _0x1a8a8d;})[_0x5f48('0x27')](respondWithResult(_0x485357,null))[_0x5f48('0x4a')](handleError(_0x485357,null));};exports['removeLists']=function(_0x1794a1,_0x111563,_0x8ca4d8){return db[_0x5f48('0x41')][_0x5f48('0x49')]({'where':{'id':_0x1794a1[_0x5f48('0x46')]['id']}})[_0x5f48('0x27')](handleEntityNotFound(_0x111563,null))[_0x5f48('0x27')](function(_0x4b4ae3){if(_0x4b4ae3){return _0x4b4ae3[_0x5f48('0x90')](_0x1794a1[_0x5f48('0x34')][_0x5f48('0x6a')]);}})['then'](function(_0xf9286d){if(_0xf9286d){return db[_0x5f48('0x5b')]['destroy']({'where':{'ListId':_0x1794a1['query'][_0x5f48('0x6a')],'CampaignId':_0x1794a1[_0x5f48('0x46')]['id']}})[_0x5f48('0x27')](function(){return _0xf9286d;});}})[_0x5f48('0x27')](respondWithStatusCode(_0x111563,null))['catch'](handleError(_0x111563,null));};exports[_0x5f48('0x91')]=function(_0x397336,_0x143415,_0x5831ad){var _0x230f56={};var _0x124c74={};var _0x39e373;var _0xbb6661;return db['Campaign'][_0x5f48('0x5a')]({'where':{'id':_0x397336['params']['id']}})[_0x5f48('0x27')](handleEntityNotFound(_0x143415,null))['then'](function(_0x2ce105){if(_0x2ce105){_0x39e373=_0x2ce105;_0x124c74[_0x5f48('0x33')]=_[_0x5f48('0x35')](db['CmList'][_0x5f48('0x2f')]);_0x124c74[_0x5f48('0x34')]=_[_0x5f48('0x35')](_0x397336[_0x5f48('0x34')]);_0x124c74[_0x5f48('0x36')]=_[_0x5f48('0x37')](_0x124c74['model'],_0x124c74['query']);_0x230f56[_0x5f48('0x38')]=_['intersection'](_0x124c74[_0x5f48('0x33')],qs[_0x5f48('0x47')](_0x397336[_0x5f48('0x34')][_0x5f48('0x47')]));_0x230f56[_0x5f48('0x38')]=_0x230f56[_0x5f48('0x38')][_0x5f48('0x39')]?_0x230f56['attributes']:_0x124c74[_0x5f48('0x33')];_0x230f56[_0x5f48('0x3a')]=qs['sort'](_0x397336['query'][_0x5f48('0x3b')]);_0x230f56[_0x5f48('0x3c')]=qs['filters'](_[_0x5f48('0x5e')](_0x397336[_0x5f48('0x34')],_0x124c74[_0x5f48('0x36')]));if(_0x397336['query']['filter']){_0x230f56['where']=_[_0x5f48('0x3e')](_0x230f56[_0x5f48('0x3c')],{'$or':_[_0x5f48('0x2e')](_0x230f56[_0x5f48('0x38')],function(_0x453a76){var _0x3952e8={};_0x3952e8[_0x453a76]={'$like':'%'+_0x397336[_0x5f48('0x34')][_0x5f48('0x3d')]+'%'};return _0x3952e8;})});}_0x230f56=_[_0x5f48('0x3e')]({},_0x230f56,_0x397336['options']);return _0x39e373['getBlackLists'](_0x230f56);}})[_0x5f48('0x27')](function(_0x187957){if(_0x187957){_0xbb6661=_0x187957[_0x5f48('0x39')];if(!_0x397336[_0x5f48('0x34')][_0x5f48('0x5c')](_0x5f48('0x5d'))){_0x230f56[_0x5f48('0x1e')]=qs[_0x5f48('0x1e')](_0x397336[_0x5f48('0x34')]['limit']);_0x230f56[_0x5f48('0x1c')]=qs['offset'](_0x397336[_0x5f48('0x34')][_0x5f48('0x1c')]);}return _0x39e373[_0x5f48('0x91')](_0x230f56);}})['then'](function(_0x3387de){if(_0x3387de){return _0x3387de?{'count':_0xbb6661,'rows':_0x3387de}:null;}})[_0x5f48('0x27')](respondWithResult(_0x143415,null))[_0x5f48('0x4a')](handleError(_0x143415,null));};exports[_0x5f48('0x92')]=function(_0x5a727c,_0x50b2d3,_0x42d932){var _0x5e2def,_0x47d9a6;var _0x3e62e0=[];var _0x519a86=moment()[_0x5f48('0x68')](_0x5f48('0x93'));return db[_0x5f48('0x41')][_0x5f48('0x49')]({'where':{'id':_0x5a727c[_0x5f48('0x46')]['id']}})[_0x5f48('0x27')](handleEntityNotFound(_0x50b2d3,null))[_0x5f48('0x27')](function(_0x31f1a3){if(_0x31f1a3){_0x47d9a6=_0x31f1a3;return _0x31f1a3[_0x5f48('0x92')](_0x5a727c[_0x5f48('0x4c')][_0x5f48('0x6a')],_[_0x5f48('0x55')](_0x5a727c[_0x5f48('0x4c')],[_0x5f48('0x6a'),'id'])||{});}return null;})[_0x5f48('0x6b')](function(_0x24cea8){var _0x4e6102;var _0x1bec6e;_0x5e2def=_0x24cea8||[];var _0x539668=[];if(_0x24cea8){for(var _0x2addc5=0x0;_0x2addc5<_0x24cea8['length'];_0x2addc5+=0x1){var _0x51d212=_0x24cea8[_0x2addc5][_0x5f48('0x26')]({'plain':!![]});_0x4e6102=squel[_0x5f48('0x6e')]()[_0x5f48('0x6f')]('cm_hopper_black')[_0x5f48('0x71')]([_0x5f48('0x77'),_0x5f48('0x73'),'ListId',_0x5f48('0x5f'),_0x5f48('0x57'),_0x5f48('0x56')],squel[_0x5f48('0x75')]()[_0x5f48('0x76')](_0x5f48('0x77'),_0x5f48('0x77'))[_0x5f48('0x76')]('id',_0x5f48('0x73'))['field'](_0x51d212[_0x5f48('0x79')][_0x5f48('0x7a')](),'ListId')[_0x5f48('0x76')](_0x5a727c[_0x5f48('0x46')]['id'][_0x5f48('0x7a')](),_0x5f48('0x5f'))[_0x5f48('0x76')](_0x5f48('0x78'),_0x5f48('0x57'))[_0x5f48('0x76')]('NOW()',_0x5f48('0x56'))[_0x5f48('0x7b')](_0x5f48('0x7c'))[_0x5f48('0x3c')]('deletedAt\x20IS\x20NULL')[_0x5f48('0x3c')](_0x5f48('0x94'),_0x51d212['CmListId'][_0x5f48('0x7a')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x5f48('0x7a')]();_0x539668[_0x5f48('0x8e')](db[_0x5f48('0x8d')][_0x5f48('0x34')](_0x4e6102));}return BPromise['all'](_0x539668);}})[_0x5f48('0x27')](function(){return _0x5e2def;})[_0x5f48('0x27')](respondWithResult(_0x50b2d3,null))[_0x5f48('0x4a')](handleError(_0x50b2d3,null));};exports['removeBlackLists']=function(_0x47abc4,_0x2945da,_0x37f4fb){return db[_0x5f48('0x41')][_0x5f48('0x49')]({'where':{'id':_0x47abc4[_0x5f48('0x46')]['id']}})[_0x5f48('0x27')](handleEntityNotFound(_0x2945da,null))[_0x5f48('0x27')](function(_0x1f3535){if(_0x1f3535){return _0x1f3535['removeBlackLists'](_0x47abc4[_0x5f48('0x34')][_0x5f48('0x6a')]);}})[_0x5f48('0x27')](function(_0x37522e){if(_0x37522e){return db['CmHopperBlack'][_0x5f48('0x25')]({'where':{'ListId':_0x47abc4['query'][_0x5f48('0x6a')],'CampaignId':_0x47abc4[_0x5f48('0x46')]['id']}})[_0x5f48('0x27')](function(){return _0x37522e;});}})[_0x5f48('0x27')](respondWithStatusCode(_0x2945da,null))[_0x5f48('0x4a')](handleError(_0x2945da,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index f7c763b..9b86841 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x4b2a90,_0x27f5ea){var _0x30bee3=function(_0x30fd3e){while(--_0x30fd3e){_0x4b2a90['push'](_0x4b2a90['shift']());}};_0x30bee3(++_0x27f5ea);}(_0x7a54,0x106));var _0x47a5=function(_0x52996c,_0x28d50d){_0x52996c=_0x52996c-0x0;var _0x2e0201=_0x7a54[_0x52996c];return _0x2e0201;};'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 3a2e514..8b04a52 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 _0xa8a8=['Campaign,\x20%s,\x20%s','message','catch','Campaign','findAll','where','options','attributes','limit','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xa8a8,0xec));var _0x8a8a=function(_0x3ffd91,_0x432390){_0x3ffd91=_0x3ffd91-0x0;var _0x4dae07=_0xa8a8[_0x3ffd91];return _0x4dae07;};'use strict';var _=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var moment=require(_0x8a8a('0x2'));var BPromise=require(_0x8a8a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a8a('0x4'));var db=require(_0x8a8a('0x5'))['db'];var utils=require(_0x8a8a('0x6'));var logger=require(_0x8a8a('0x7'))(_0x8a8a('0x8'));var config=require(_0x8a8a('0x9'));var jayson=require(_0x8a8a('0xa'));var client=jayson[_0x8a8a('0xb')][_0x8a8a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x315fe9,_0x1d7121,_0x8e7aa0){return new BPromise(function(_0x4225b9,_0xecaa6f){return client[_0x8a8a('0xd')](_0x315fe9,_0x8e7aa0)['then'](function(_0x576ef9){logger[_0x8a8a('0xe')]('Campaign,\x20%s,\x20%s',_0x1d7121,_0x8a8a('0xf'));logger[_0x8a8a('0x10')]('Campaign,\x20%s,\x20%s,\x20%s',_0x1d7121,_0x8a8a('0xf'),JSON[_0x8a8a('0x11')](_0x576ef9));if(_0x576ef9[_0x8a8a('0x12')]){if(_0x576ef9['error'][_0x8a8a('0x13')]===0x1f4){logger[_0x8a8a('0x12')](_0x8a8a('0x14'),_0x1d7121,_0x576ef9[_0x8a8a('0x12')]['message']);return _0xecaa6f(_0x576ef9[_0x8a8a('0x12')]['message']);}logger[_0x8a8a('0x12')](_0x8a8a('0x14'),_0x1d7121,_0x576ef9[_0x8a8a('0x12')][_0x8a8a('0x15')]);return _0x4225b9(_0x576ef9[_0x8a8a('0x12')][_0x8a8a('0x15')]);}else{logger[_0x8a8a('0xe')]('Campaign,\x20%s,\x20%s',_0x1d7121,_0x8a8a('0xf'));_0x4225b9(_0x576ef9['result'][_0x8a8a('0x15')]);}})[_0x8a8a('0x16')](function(_0x46a4f4){logger[_0x8a8a('0x12')](_0x8a8a('0x14'),_0x1d7121,_0x46a4f4);_0xecaa6f(_0x46a4f4);});});}exports['GetCampaign']=function(_0x9d55f9){var _0x3d165c=this;return new Promise(function(_0x262ca9,_0x2bce13){return db[_0x8a8a('0x17')][_0x8a8a('0x18')]({'raw':_0x9d55f9['options']?_0x9d55f9['options']['raw']===undefined?!![]:![]:!![],'where':_0x9d55f9['options']?_0x9d55f9['options'][_0x8a8a('0x19')]||null:null,'attributes':_0x9d55f9[_0x8a8a('0x1a')]?_0x9d55f9[_0x8a8a('0x1a')][_0x8a8a('0x1b')]||null:null,'limit':_0x9d55f9[_0x8a8a('0x1a')]?_0x9d55f9[_0x8a8a('0x1a')][_0x8a8a('0x1c')]||null:null,'include':_0x9d55f9[_0x8a8a('0x1a')]?_0x9d55f9[_0x8a8a('0x1a')][_0x8a8a('0x1d')]?_[_0x8a8a('0x1e')](_0x9d55f9[_0x8a8a('0x1a')][_0x8a8a('0x1d')],function(_0x625c1b){return{'model':db[_0x625c1b[_0x8a8a('0x1f')]],'as':_0x625c1b['as'],'attributes':_0x625c1b['attributes'],'include':_0x625c1b[_0x8a8a('0x1d')]?_[_0x8a8a('0x1e')](_0x625c1b[_0x8a8a('0x1d')],function(_0x7662e){return{'model':db[_0x7662e[_0x8a8a('0x1f')]],'as':_0x7662e['as'],'attributes':_0x7662e[_0x8a8a('0x1b')],'include':_0x7662e[_0x8a8a('0x1d')]?_['map'](_0x7662e[_0x8a8a('0x1d')],function(_0x38c1e0){return{'model':db[_0x38c1e0[_0x8a8a('0x1f')]],'as':_0x38c1e0['as'],'attributes':_0x38c1e0['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2dafcd){logger[_0x8a8a('0xe')]('GetCampaign',_0x9d55f9);logger['debug']('GetCampaign',_0x9d55f9,JSON[_0x8a8a('0x11')](_0x2dafcd));_0x262ca9(_0x2dafcd);})['catch'](function(_0x10b916){logger[_0x8a8a('0x12')]('GetCampaign',_0x10b916[_0x8a8a('0x15')],_0x9d55f9);_0x2bce13(_0x3d165c[_0x8a8a('0x12')](0x1f4,_0x10b916[_0x8a8a('0x15')]));});});}; \ No newline at end of file +var _0x44f8=['raw','where','attributes','limit','include','map','model','then','GetCampaign','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','client','http','request\x20sent','error','Campaign,\x20%s,\x20%s','message','result','catch','options'];(function(_0x1e5246,_0x376043){var _0xf4d359=function(_0x5f4eb9){while(--_0x5f4eb9){_0x1e5246['push'](_0x1e5246['shift']());}};_0xf4d359(++_0x376043);}(_0x44f8,0x1de));var _0x844f=function(_0x500a6f,_0xa7042e){_0x500a6f=_0x500a6f-0x0;var _0x1093cc=_0x44f8[_0x500a6f];return _0x1093cc;};'use strict';var _=require(_0x844f('0x0'));var util=require(_0x844f('0x1'));var moment=require(_0x844f('0x2'));var BPromise=require(_0x844f('0x3'));var rs=require(_0x844f('0x4'));var fs=require('fs');var Redis=require(_0x844f('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x844f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x844f('0x7')][_0x844f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x46eb2c,_0x38a334,_0x37b697){return new BPromise(function(_0x1987a9,_0x188f88){return client['request'](_0x46eb2c,_0x37b697)['then'](function(_0x39416d){logger['info']('Campaign,\x20%s,\x20%s',_0x38a334,_0x844f('0x9'));logger['debug']('Campaign,\x20%s,\x20%s,\x20%s',_0x38a334,'request\x20sent',JSON['stringify'](_0x39416d));if(_0x39416d[_0x844f('0xa')]){if(_0x39416d[_0x844f('0xa')]['code']===0x1f4){logger[_0x844f('0xa')](_0x844f('0xb'),_0x38a334,_0x39416d[_0x844f('0xa')]['message']);return _0x188f88(_0x39416d['error'][_0x844f('0xc')]);}logger['error'](_0x844f('0xb'),_0x38a334,_0x39416d[_0x844f('0xa')][_0x844f('0xc')]);return _0x1987a9(_0x39416d[_0x844f('0xa')][_0x844f('0xc')]);}else{logger['info']('Campaign,\x20%s,\x20%s',_0x38a334,_0x844f('0x9'));_0x1987a9(_0x39416d[_0x844f('0xd')][_0x844f('0xc')]);}})[_0x844f('0xe')](function(_0x4f7ce4){logger[_0x844f('0xa')]('Campaign,\x20%s,\x20%s',_0x38a334,_0x4f7ce4);_0x188f88(_0x4f7ce4);});});}exports['GetCampaign']=function(_0x1f96d0){var _0x2cca8e=this;return new Promise(function(_0x5cc55c,_0x24e386){return db['Campaign']['findAll']({'raw':_0x1f96d0[_0x844f('0xf')]?_0x1f96d0['options'][_0x844f('0x10')]===undefined?!![]:![]:!![],'where':_0x1f96d0[_0x844f('0xf')]?_0x1f96d0[_0x844f('0xf')][_0x844f('0x11')]||null:null,'attributes':_0x1f96d0[_0x844f('0xf')]?_0x1f96d0['options'][_0x844f('0x12')]||null:null,'limit':_0x1f96d0['options']?_0x1f96d0['options'][_0x844f('0x13')]||null:null,'include':_0x1f96d0[_0x844f('0xf')]?_0x1f96d0[_0x844f('0xf')][_0x844f('0x14')]?_[_0x844f('0x15')](_0x1f96d0['options'][_0x844f('0x14')],function(_0x4bd66d){return{'model':db[_0x4bd66d[_0x844f('0x16')]],'as':_0x4bd66d['as'],'attributes':_0x4bd66d['attributes'],'include':_0x4bd66d[_0x844f('0x14')]?_[_0x844f('0x15')](_0x4bd66d[_0x844f('0x14')],function(_0x7dc0c9){return{'model':db[_0x7dc0c9[_0x844f('0x16')]],'as':_0x7dc0c9['as'],'attributes':_0x7dc0c9[_0x844f('0x12')],'include':_0x7dc0c9[_0x844f('0x14')]?_['map'](_0x7dc0c9[_0x844f('0x14')],function(_0x16d7ad){return{'model':db[_0x16d7ad[_0x844f('0x16')]],'as':_0x16d7ad['as'],'attributes':_0x16d7ad[_0x844f('0x12')]};}):[]};}):[]};}):[]:[]})[_0x844f('0x17')](function(_0x29d224){logger['info'](_0x844f('0x18'),_0x1f96d0);logger[_0x844f('0x19')](_0x844f('0x18'),_0x1f96d0,JSON['stringify'](_0x29d224));_0x5cc55c(_0x29d224);})['catch'](function(_0x1e243c){logger[_0x844f('0xa')](_0x844f('0x18'),_0x1e243c['message'],_0x1f96d0);_0x24e386(_0x2cca8e[_0x844f('0xa')](0x1f4,_0x1e243c['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 9226b1f..a9414be 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 _0x2ed4=['getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','clone','addLists','destroy','delete','removeLists','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','getHoppers','getHopperHistories'];(function(_0xd7b41,_0x17b6ed){var _0x4a74c7=function(_0x273c10){while(--_0x273c10){_0xd7b41['push'](_0xd7b41['shift']());}};_0x4a74c7(++_0x17b6ed);}(_0x2ed4,0x1b3));var _0x42ed=function(_0x1602ef,_0x447aba){_0x1602ef=_0x1602ef-0x0;var _0x5870ee=_0x2ed4[_0x1602ef];return _0x5870ee;};'use strict';var multer=require(_0x42ed('0x0'));var util=require('util');var path=require(_0x42ed('0x1'));var timeout=require(_0x42ed('0x2'));var express=require(_0x42ed('0x3'));var router=express[_0x42ed('0x4')]();var fs_extra=require(_0x42ed('0x5'));var auth=require(_0x42ed('0x6'));var interaction=require(_0x42ed('0x7'));var config=require(_0x42ed('0x8'));var controller=require('./campaign.controller');router['get']('/',auth[_0x42ed('0x9')](),controller[_0x42ed('0xa')]);router[_0x42ed('0xb')](_0x42ed('0xc'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/hoppers',auth[_0x42ed('0x9')](),controller[_0x42ed('0xd')]);router['get']('/:id/hopper_histories',auth[_0x42ed('0x9')](),controller[_0x42ed('0xe')]);router['get']('/:id/hopper_finals',auth[_0x42ed('0x9')](),controller[_0x42ed('0xf')]);router['get'](_0x42ed('0x10'),auth[_0x42ed('0x9')](),controller[_0x42ed('0x11')]);router[_0x42ed('0xb')](_0x42ed('0x12'),auth['isAuthenticated'](),controller[_0x42ed('0x13')]);router[_0x42ed('0xb')](_0x42ed('0x14'),auth[_0x42ed('0x9')](),controller[_0x42ed('0x15')]);router[_0x42ed('0x16')]('/',auth[_0x42ed('0x9')](),controller[_0x42ed('0x17')]);router['post']('/:id/clone',auth['isAuthenticated'](),controller[_0x42ed('0x18')]);router[_0x42ed('0x16')]('/:id/lists',auth[_0x42ed('0x9')](),controller[_0x42ed('0x19')]);router[_0x42ed('0x16')](_0x42ed('0x14'),auth[_0x42ed('0x9')](),controller['addBlackLists']);router['put'](_0x42ed('0xc'),auth[_0x42ed('0x9')](),controller['update']);router['delete']('/:id',auth[_0x42ed('0x9')](),controller[_0x42ed('0x1a')]);router[_0x42ed('0x1b')](_0x42ed('0x12'),auth[_0x42ed('0x9')](),controller[_0x42ed('0x1c')]);router[_0x42ed('0x1b')](_0x42ed('0x14'),auth['isAuthenticated'](),controller['removeBlackLists']);module[_0x42ed('0x1d')]=router; \ No newline at end of file +var _0xdeaf=['/:id/lists','addLists','/:id/blacklists','addBlackLists','put','update','delete','removeLists','multer','util','path','Router','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','getLists','getBlackLists','post','create','/:id/clone','clone'];(function(_0x316a66,_0x445ebc){var _0x100b8e=function(_0x25e5b8){while(--_0x25e5b8){_0x316a66['push'](_0x316a66['shift']());}};_0x100b8e(++_0x445ebc);}(_0xdeaf,0x19e));var _0xfdea=function(_0x24de71,_0x3af991){_0x24de71=_0x24de71-0x0;var _0x4d0303=_0xdeaf[_0x24de71];return _0x4d0303;};'use strict';var multer=require(_0xfdea('0x0'));var util=require(_0xfdea('0x1'));var path=require(_0xfdea('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfdea('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(_0xfdea('0x4'));router[_0xfdea('0x5')]('/',auth[_0xfdea('0x6')](),controller[_0xfdea('0x7')]);router['get'](_0xfdea('0x8'),auth[_0xfdea('0x6')](),controller[_0xfdea('0x9')]);router[_0xfdea('0x5')]('/:id/hoppers',auth[_0xfdea('0x6')](),controller['getHoppers']);router[_0xfdea('0x5')](_0xfdea('0xa'),auth[_0xfdea('0x6')](),controller[_0xfdea('0xb')]);router[_0xfdea('0x5')](_0xfdea('0xc'),auth['isAuthenticated'](),controller['getHopperFinals']);router[_0xfdea('0x5')](_0xfdea('0xd'),auth[_0xfdea('0x6')](),controller[_0xfdea('0xe')]);router['get']('/:id/lists',auth['isAuthenticated'](),controller[_0xfdea('0xf')]);router['get']('/:id/blacklists',auth[_0xfdea('0x6')](),controller[_0xfdea('0x10')]);router[_0xfdea('0x11')]('/',auth[_0xfdea('0x6')](),controller[_0xfdea('0x12')]);router[_0xfdea('0x11')](_0xfdea('0x13'),auth[_0xfdea('0x6')](),controller[_0xfdea('0x14')]);router[_0xfdea('0x11')](_0xfdea('0x15'),auth['isAuthenticated'](),controller[_0xfdea('0x16')]);router[_0xfdea('0x11')](_0xfdea('0x17'),auth[_0xfdea('0x6')](),controller[_0xfdea('0x18')]);router[_0xfdea('0x19')]('/:id',auth['isAuthenticated'](),controller[_0xfdea('0x1a')]);router[_0xfdea('0x1b')](_0xfdea('0x8'),auth[_0xfdea('0x6')](),controller['destroy']);router[_0xfdea('0x1b')](_0xfdea('0x15'),auth['isAuthenticated'](),controller[_0xfdea('0x1c')]);router[_0xfdea('0x1b')](_0xfdea('0x17'),auth['isAuthenticated'](),controller['removeBlackLists']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 0cb0807..1c4d89f 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 _0x0078=['getDataValue','key','sequelize','exports','STRING','VIRTUAL'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0078,0x152));var _0x8007=function(_0x2393e9,_0x1101ac){_0x2393e9=_0x2393e9-0x0;var _0x227f67=_0x0078[_0x2393e9];return _0x227f67;};'use strict';var Sequelize=require(_0x8007('0x0'));module[_0x8007('0x1')]={'key':{'type':Sequelize[_0x8007('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x8007('0x2')]},'name':{'type':Sequelize[_0x8007('0x3')],'get':function(){return this[_0x8007('0x4')](_0x8007('0x5'));}}}; \ No newline at end of file +var _0xbaa1=['sequelize','exports','STRING','TEXT','VIRTUAL','getDataValue'];(function(_0x1e3116,_0x3b2e5c){var _0x3a5501=function(_0x51b726){while(--_0x51b726){_0x1e3116['push'](_0x1e3116['shift']());}};_0x3a5501(++_0x3b2e5c);}(_0xbaa1,0x168));var _0x1baa=function(_0x5d9447,_0x642173){_0x5d9447=_0x5d9447-0x0;var _0x11bae2=_0xbaa1[_0x5d9447];return _0x11bae2;};'use strict';var Sequelize=require(_0x1baa('0x0'));module[_0x1baa('0x1')]={'key':{'type':Sequelize[_0x1baa('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x1baa('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x1baa('0x2')]},'name':{'type':Sequelize[_0x1baa('0x4')],'get':function(){return this[_0x1baa('0x5')]('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index cd8d4e8..1eba068 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 _0x20eb=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','CannedAnswers','UserProfileResource','error','stack','send','index','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','include','find','catch','body','params','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','create','user','UserProfileSection','userProfileId','autoAssociation','name','eml-format','zip-dir','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x2e195d,_0x229650){var _0x15cf2a=function(_0x1603eb){while(--_0x1603eb){_0x2e195d['push'](_0x2e195d['shift']());}};_0x15cf2a(++_0x229650);}(_0x20eb,0xa0));var _0xb20e=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x20eb[_0x24061a];return _0x82054e;};'use strict';var emlformat=require(_0xb20e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb20e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb20e('0x2'));var moment=require(_0xb20e('0x3'));var BPromise=require(_0xb20e('0x4'));var Mustache=require(_0xb20e('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xb20e('0x6'));var ejs=require(_0xb20e('0x7'));var fs=require('fs');var fs_extra=require(_0xb20e('0x8'));var _=require(_0xb20e('0x9'));var squel=require(_0xb20e('0xa'));var crypto=require('crypto');var jsforce=require(_0xb20e('0xb'));var deskjs=require(_0xb20e('0xc'));var toCsv=require(_0xb20e('0x6'));var querystring=require(_0xb20e('0xd'));var Papa=require(_0xb20e('0xe'));var Redis=require(_0xb20e('0xf'));var authService=require(_0xb20e('0x10'));var qs=require(_0xb20e('0x11'));var as=require(_0xb20e('0x12'));var hardwareService=require(_0xb20e('0x13'));var logger=require('../../config/logger')(_0xb20e('0x14'));var utils=require('../../config/utils');var config=require(_0xb20e('0x15'));var licenseUtil=require(_0xb20e('0x16'));var db=require(_0xb20e('0x17'))['db'];function respondWithStatusCode(_0x1620e7,_0x3b9151){_0x3b9151=_0x3b9151||0xcc;return function(_0x56f0af){if(_0x56f0af){return _0x1620e7[_0xb20e('0x18')](_0x3b9151);}return _0x1620e7[_0xb20e('0x19')](_0x3b9151)['end']();};}function respondWithResult(_0x461ed4,_0x4030cc){_0x4030cc=_0x4030cc||0xc8;return function(_0x57449b){if(_0x57449b){return _0x461ed4[_0xb20e('0x19')](_0x4030cc)[_0xb20e('0x1a')](_0x57449b);}};}function respondWithFilteredResult(_0x4a74df,_0x281839){return function(_0x2ebbf4){if(_0x2ebbf4){var _0x59a950=typeof _0x281839[_0xb20e('0x1b')]===_0xb20e('0x1c')&&typeof _0x281839[_0xb20e('0x1d')]===_0xb20e('0x1c');var _0xc494e=_0x2ebbf4[_0xb20e('0x1e')];var _0x20e7c7=_0x59a950?0x0:_0x281839[_0xb20e('0x1b')];var _0x2b7606=_0x59a950?_0x2ebbf4[_0xb20e('0x1e')]:_0x281839['offset']+_0x281839['limit'];var _0x325bf3;if(_0x2b7606>=_0xc494e){_0x2b7606=_0xc494e;_0x325bf3=0xc8;}else{_0x325bf3=0xce;}_0x4a74df[_0xb20e('0x19')](_0x325bf3);return _0x4a74df[_0xb20e('0x1f')](_0xb20e('0x20'),_0x20e7c7+'-'+_0x2b7606+'/'+_0xc494e)[_0xb20e('0x1a')](_0x2ebbf4);}return null;};}function patchUpdates(_0x47b962){return function(_0x2a9e04){try{jsonpatch[_0xb20e('0x21')](_0x2a9e04,_0x47b962,!![]);}catch(_0x2a9c95){return BPromise['reject'](_0x2a9c95);}return _0x2a9e04[_0xb20e('0x22')]();};}function saveUpdates(_0xb4e923,_0x3859da){return function(_0x274e1c){if(_0x274e1c){return _0x274e1c[_0xb20e('0x23')](_0xb4e923)[_0xb20e('0x24')](function(_0x48c4f8){return _0x48c4f8;});}return null;};}function removeEntity(_0x96ef01,_0x31517b){return function(_0x38132f){if(_0x38132f){return _0x38132f[_0xb20e('0x25')]()['then'](function(){var _0x366a2e=_0x38132f[_0xb20e('0x26')]({'plain':!![]});var _0x2a047d=_0xb20e('0x27');return db[_0xb20e('0x28')][_0xb20e('0x25')]({'where':{'type':_0x2a047d,'resourceId':_0x366a2e['id']}})[_0xb20e('0x24')](function(){return _0x38132f;});})[_0xb20e('0x24')](function(){_0x96ef01[_0xb20e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x148edb,_0x4926cd){return function(_0x534f60){if(!_0x534f60){_0x148edb[_0xb20e('0x18')](0x194);}return _0x534f60;};}function handleError(_0xefcc5d,_0x46fa3b){_0x46fa3b=_0x46fa3b||0x1f4;return function(_0x374dc5){logger[_0xb20e('0x29')](_0x374dc5[_0xb20e('0x2a')]);if(_0x374dc5['name']){delete _0x374dc5['name'];}_0xefcc5d[_0xb20e('0x19')](_0x46fa3b)[_0xb20e('0x2b')](_0x374dc5);};}exports[_0xb20e('0x2c')]=function(_0x2da454,_0x29e434){var _0x30db90={},_0x500acc={},_0x57081a={'count':0x0,'rows':[]};var _0x40b7d8=_[_0xb20e('0x2d')](db[_0xb20e('0x2e')][_0xb20e('0x2f')],function(_0x3fe16a){return{'name':_0x3fe16a[_0xb20e('0x30')],'type':_0x3fe16a[_0xb20e('0x31')][_0xb20e('0x32')]};});_0x500acc[_0xb20e('0x33')]=_[_0xb20e('0x2d')](_0x40b7d8,'name');_0x500acc[_0xb20e('0x34')]=_[_0xb20e('0x35')](_0x2da454[_0xb20e('0x34')]);_0x500acc[_0xb20e('0x36')]=_['intersection'](_0x500acc['model'],_0x500acc['query']);_0x30db90[_0xb20e('0x37')]=_[_0xb20e('0x38')](_0x500acc[_0xb20e('0x33')],qs[_0xb20e('0x39')](_0x2da454[_0xb20e('0x34')][_0xb20e('0x39')]));_0x30db90[_0xb20e('0x37')]=_0x30db90[_0xb20e('0x37')][_0xb20e('0x3a')]?_0x30db90[_0xb20e('0x37')]:_0x500acc[_0xb20e('0x33')];if(!_0x2da454[_0xb20e('0x34')][_0xb20e('0x3b')](_0xb20e('0x3c'))){_0x30db90[_0xb20e('0x1d')]=qs['limit'](_0x2da454[_0xb20e('0x34')]['limit']);_0x30db90[_0xb20e('0x1b')]=qs['offset'](_0x2da454[_0xb20e('0x34')][_0xb20e('0x1b')]);}_0x30db90[_0xb20e('0x3d')]=qs[_0xb20e('0x3e')](_0x2da454[_0xb20e('0x34')]['sort']);_0x30db90[_0xb20e('0x3f')]=qs[_0xb20e('0x36')](_[_0xb20e('0x40')](_0x2da454[_0xb20e('0x34')],_0x500acc[_0xb20e('0x36')]),_0x40b7d8);if(_0x2da454[_0xb20e('0x34')][_0xb20e('0x41')]){_0x30db90['where']=_[_0xb20e('0x42')](_0x30db90[_0xb20e('0x3f')],{'$or':[{'key':{'$like':'%'+_0x2da454[_0xb20e('0x34')][_0xb20e('0x41')]+'%'}},{'value':{'$like':'%'+_0x2da454[_0xb20e('0x34')]['filter']+'%'}}]});}_0x30db90=_[_0xb20e('0x42')]({},_0x30db90,_0x2da454[_0xb20e('0x43')]);var _0x2eb6d1={'where':_0x30db90[_0xb20e('0x3f')]};return db[_0xb20e('0x2e')]['count'](_0x2eb6d1)[_0xb20e('0x24')](function(_0x5915ea){_0x57081a[_0xb20e('0x1e')]=_0x5915ea;if(_0x2da454[_0xb20e('0x34')][_0xb20e('0x44')]){_0x30db90['include']=[{'all':!![]}];}return db[_0xb20e('0x2e')][_0xb20e('0x45')](_0x30db90);})['then'](function(_0x32f9cb){_0x57081a[_0xb20e('0x46')]=_0x32f9cb;return _0x57081a;})[_0xb20e('0x24')](respondWithFilteredResult(_0x29e434,_0x30db90))['catch'](handleError(_0x29e434,null));};exports['show']=function(_0x168096,_0x5df258){var _0x42868f={'raw':!![],'where':{'id':_0x168096['params']['id']}},_0x5b0325={};_0x5b0325[_0xb20e('0x33')]=_[_0xb20e('0x35')](db[_0xb20e('0x2e')][_0xb20e('0x2f')]);_0x5b0325['query']=_[_0xb20e('0x35')](_0x168096[_0xb20e('0x34')]);_0x5b0325[_0xb20e('0x36')]=_['intersection'](_0x5b0325[_0xb20e('0x33')],_0x5b0325[_0xb20e('0x34')]);_0x42868f['attributes']=_[_0xb20e('0x38')](_0x5b0325[_0xb20e('0x33')],qs[_0xb20e('0x39')](_0x168096[_0xb20e('0x34')][_0xb20e('0x39')]));_0x42868f[_0xb20e('0x37')]=_0x42868f['attributes'][_0xb20e('0x3a')]?_0x42868f[_0xb20e('0x37')]:_0x5b0325[_0xb20e('0x33')];if(_0x168096[_0xb20e('0x34')][_0xb20e('0x44')]){_0x42868f[_0xb20e('0x47')]=[{'all':!![]}];}_0x42868f=_[_0xb20e('0x42')]({},_0x42868f,_0x168096['options']);return db[_0xb20e('0x2e')][_0xb20e('0x48')](_0x42868f)[_0xb20e('0x24')](handleEntityNotFound(_0x5df258,null))[_0xb20e('0x24')](respondWithResult(_0x5df258,null))[_0xb20e('0x49')](handleError(_0x5df258,null));};exports[_0xb20e('0x23')]=function(_0x3d36f2,_0x416782){if(_0x3d36f2['body']['id']){delete _0x3d36f2[_0xb20e('0x4a')]['id'];}return db['CannedAnswer'][_0xb20e('0x48')]({'where':{'id':_0x3d36f2[_0xb20e('0x4b')]['id']}})[_0xb20e('0x24')](handleEntityNotFound(_0x416782,null))[_0xb20e('0x24')](saveUpdates(_0x3d36f2['body'],null))['then'](respondWithResult(_0x416782,null))[_0xb20e('0x49')](handleError(_0x416782,null));};exports[_0xb20e('0x25')]=function(_0x441520,_0xe91ea3){return db[_0xb20e('0x2e')][_0xb20e('0x48')]({'where':{'id':_0x441520[_0xb20e('0x4b')]['id']}})[_0xb20e('0x24')](handleEntityNotFound(_0xe91ea3,null))[_0xb20e('0x24')](removeEntity(_0xe91ea3,null))['catch'](handleError(_0xe91ea3,null));};exports['create']=function(_0x4385ac,_0x11b6ed){var _0x1c6634={'key':_0x4385ac[_0xb20e('0x4a')][_0xb20e('0x32')]};if(_0x4385ac[_0xb20e('0x4a')][_0xb20e('0x4c')]){_0x1c6634['MailAccountId']=_0x4385ac[_0xb20e('0x4a')][_0xb20e('0x4c')];}else if(_0x4385ac['body'][_0xb20e('0x4d')]){_0x1c6634[_0xb20e('0x4d')]=_0x4385ac['body'][_0xb20e('0x4d')];}else if(_0x4385ac['body']['OpenchannelAccountId']){_0x1c6634[_0xb20e('0x4e')]=_0x4385ac[_0xb20e('0x4a')][_0xb20e('0x4e')];}else if(_0x4385ac['body'][_0xb20e('0x4f')]){_0x1c6634['ChatWebsiteId']=_0x4385ac[_0xb20e('0x4a')][_0xb20e('0x4f')];}return db[_0xb20e('0x2e')][_0xb20e('0x48')]({'where':_0x1c6634})[_0xb20e('0x24')](function(_0x6c057d){if(_0x6c057d){throw new db[(_0xb20e('0x50'))][(_0xb20e('0x51'))](_0xb20e('0x52'));}return db[_0xb20e('0x2e')][_0xb20e('0x53')](_0x4385ac[_0xb20e('0x4a')]);})[_0xb20e('0x24')](function(_0x731906){var _0x28e8fa=_0x4385ac[_0xb20e('0x54')]['get']({'plain':!![]});if(!_0x28e8fa)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x28e8fa['role']===_0xb20e('0x54')){var _0x5d7bc0=_0x731906[_0xb20e('0x26')]({'plain':!![]});return db[_0xb20e('0x55')][_0xb20e('0x48')]({'where':{'name':_0xb20e('0x27'),'userProfileId':_0x28e8fa[_0xb20e('0x56')]},'raw':!![]})[_0xb20e('0x24')](function(_0x878b2){if(_0x878b2&&_0x878b2[_0xb20e('0x57')]===0x0){return db['UserProfileResource'][_0xb20e('0x53')]({'name':_0x5d7bc0['name'],'resourceId':_0x5d7bc0['id'],'type':_0x878b2[_0xb20e('0x58')],'sectionId':_0x878b2['id']},{})[_0xb20e('0x24')](function(){return _0x731906;});}else{return _0x731906;}})[_0xb20e('0x49')](function(_0xb9d46c){logger[_0xb20e('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb9d46c);throw _0xb9d46c;});}return _0x731906;})[_0xb20e('0x24')](respondWithResult(_0x11b6ed,0xc9))[_0xb20e('0x49')](handleError(_0x11b6ed,null));}; \ No newline at end of file +var _0x4fe9=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','filter','merge','options','include','CannedAnswer','rows','params','find','body','catch','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','CannedAnswers','autoAssociation','UserProfileResource','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x486512,_0x1c4f06){var _0x48e24a=function(_0x18570c){while(--_0x18570c){_0x486512['push'](_0x486512['shift']());}};_0x48e24a(++_0x1c4f06);}(_0x4fe9,0x132));var _0x94fe=function(_0x4dde9f,_0x2de95f){_0x4dde9f=_0x4dde9f-0x0;var _0x429e11=_0x4fe9[_0x4dde9f];return _0x429e11;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x94fe('0x0'));var zipdir=require(_0x94fe('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x94fe('0x2'));var moment=require(_0x94fe('0x3'));var BPromise=require(_0x94fe('0x4'));var Mustache=require(_0x94fe('0x5'));var util=require(_0x94fe('0x6'));var path=require('path');var sox=require(_0x94fe('0x7'));var csv=require(_0x94fe('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x94fe('0x9'));var squel=require('squel');var crypto=require(_0x94fe('0xa'));var jsforce=require(_0x94fe('0xb'));var deskjs=require(_0x94fe('0xc'));var toCsv=require(_0x94fe('0x8'));var querystring=require(_0x94fe('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x94fe('0xe'));var as=require(_0x94fe('0xf'));var hardwareService=require(_0x94fe('0x10'));var logger=require('../../config/logger')(_0x94fe('0x11'));var utils=require(_0x94fe('0x12'));var config=require(_0x94fe('0x13'));var licenseUtil=require(_0x94fe('0x14'));var db=require(_0x94fe('0x15'))['db'];function respondWithStatusCode(_0x1fcf80,_0x5a57c1){_0x5a57c1=_0x5a57c1||0xcc;return function(_0x43507d){if(_0x43507d){return _0x1fcf80[_0x94fe('0x16')](_0x5a57c1);}return _0x1fcf80[_0x94fe('0x17')](_0x5a57c1)['end']();};}function respondWithResult(_0x379a8a,_0x86a93e){_0x86a93e=_0x86a93e||0xc8;return function(_0x15c5fd){if(_0x15c5fd){return _0x379a8a[_0x94fe('0x17')](_0x86a93e)[_0x94fe('0x18')](_0x15c5fd);}};}function respondWithFilteredResult(_0x74906b,_0x46c917){return function(_0x45f4ef){if(_0x45f4ef){var _0x32aafa=typeof _0x46c917['offset']==='undefined'&&typeof _0x46c917[_0x94fe('0x19')]===_0x94fe('0x1a');var _0x18f2cc=_0x45f4ef[_0x94fe('0x1b')];var _0x3a6c90=_0x32aafa?0x0:_0x46c917[_0x94fe('0x1c')];var _0x47014c=_0x32aafa?_0x45f4ef[_0x94fe('0x1b')]:_0x46c917[_0x94fe('0x1c')]+_0x46c917[_0x94fe('0x19')];var _0x74352b;if(_0x47014c>=_0x18f2cc){_0x47014c=_0x18f2cc;_0x74352b=0xc8;}else{_0x74352b=0xce;}_0x74906b[_0x94fe('0x17')](_0x74352b);return _0x74906b['set']('Content-Range',_0x3a6c90+'-'+_0x47014c+'/'+_0x18f2cc)[_0x94fe('0x18')](_0x45f4ef);}return null;};}function patchUpdates(_0x4ceedd){return function(_0x51248f){try{jsonpatch[_0x94fe('0x1d')](_0x51248f,_0x4ceedd,!![]);}catch(_0x44a9a3){return BPromise[_0x94fe('0x1e')](_0x44a9a3);}return _0x51248f[_0x94fe('0x1f')]();};}function saveUpdates(_0x4e2047,_0x3df344){return function(_0x297a22){if(_0x297a22){return _0x297a22[_0x94fe('0x20')](_0x4e2047)['then'](function(_0x2374b5){return _0x2374b5;});}return null;};}function removeEntity(_0x251418,_0x1e86bc){return function(_0x4238a0){if(_0x4238a0){return _0x4238a0['destroy']()[_0x94fe('0x21')](function(){var _0x12d173=_0x4238a0['get']({'plain':!![]});var _0x99bc5b='CannedAnswers';return db['UserProfileResource'][_0x94fe('0x22')]({'where':{'type':_0x99bc5b,'resourceId':_0x12d173['id']}})[_0x94fe('0x21')](function(){return _0x4238a0;});})[_0x94fe('0x21')](function(){_0x251418[_0x94fe('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x135d15,_0x15dcfe){return function(_0x501aec){if(!_0x501aec){_0x135d15[_0x94fe('0x16')](0x194);}return _0x501aec;};}function handleError(_0x238e49,_0x4864ab){_0x4864ab=_0x4864ab||0x1f4;return function(_0x298435){logger[_0x94fe('0x23')](_0x298435[_0x94fe('0x24')]);if(_0x298435['name']){delete _0x298435[_0x94fe('0x25')];}_0x238e49[_0x94fe('0x17')](_0x4864ab)[_0x94fe('0x26')](_0x298435);};}exports[_0x94fe('0x27')]=function(_0x55ad86,_0x197f3a){var _0x7df08b={},_0x577011={},_0x10640d={'count':0x0,'rows':[]};var _0x18b783=_[_0x94fe('0x28')](db['CannedAnswer'][_0x94fe('0x29')],function(_0xbb7b08){return{'name':_0xbb7b08[_0x94fe('0x2a')],'type':_0xbb7b08[_0x94fe('0x2b')][_0x94fe('0x2c')]};});_0x577011[_0x94fe('0x2d')]=_['map'](_0x18b783,'name');_0x577011['query']=_[_0x94fe('0x2e')](_0x55ad86[_0x94fe('0x2f')]);_0x577011[_0x94fe('0x30')]=_[_0x94fe('0x31')](_0x577011[_0x94fe('0x2d')],_0x577011['query']);_0x7df08b[_0x94fe('0x32')]=_[_0x94fe('0x31')](_0x577011[_0x94fe('0x2d')],qs[_0x94fe('0x33')](_0x55ad86['query'][_0x94fe('0x33')]));_0x7df08b[_0x94fe('0x32')]=_0x7df08b['attributes'][_0x94fe('0x34')]?_0x7df08b[_0x94fe('0x32')]:_0x577011['model'];if(!_0x55ad86[_0x94fe('0x2f')]['hasOwnProperty']('nolimit')){_0x7df08b[_0x94fe('0x19')]=qs[_0x94fe('0x19')](_0x55ad86[_0x94fe('0x2f')][_0x94fe('0x19')]);_0x7df08b[_0x94fe('0x1c')]=qs[_0x94fe('0x1c')](_0x55ad86[_0x94fe('0x2f')][_0x94fe('0x1c')]);}_0x7df08b[_0x94fe('0x35')]=qs[_0x94fe('0x36')](_0x55ad86[_0x94fe('0x2f')][_0x94fe('0x36')]);_0x7df08b[_0x94fe('0x37')]=qs[_0x94fe('0x30')](_['pick'](_0x55ad86[_0x94fe('0x2f')],_0x577011[_0x94fe('0x30')]),_0x18b783);if(_0x55ad86[_0x94fe('0x2f')][_0x94fe('0x38')]){_0x7df08b['where']=_[_0x94fe('0x39')](_0x7df08b['where'],{'$or':[{'key':{'$like':'%'+_0x55ad86['query'][_0x94fe('0x38')]+'%'}},{'value':{'$like':'%'+_0x55ad86[_0x94fe('0x2f')][_0x94fe('0x38')]+'%'}}]});}_0x7df08b=_[_0x94fe('0x39')]({},_0x7df08b,_0x55ad86[_0x94fe('0x3a')]);var _0x1ed0ce={'where':_0x7df08b[_0x94fe('0x37')]};return db['CannedAnswer']['count'](_0x1ed0ce)[_0x94fe('0x21')](function(_0x5c84db){_0x10640d[_0x94fe('0x1b')]=_0x5c84db;if(_0x55ad86[_0x94fe('0x2f')]['includeAll']){_0x7df08b[_0x94fe('0x3b')]=[{'all':!![]}];}return db[_0x94fe('0x3c')]['findAll'](_0x7df08b);})[_0x94fe('0x21')](function(_0x152b07){_0x10640d[_0x94fe('0x3d')]=_0x152b07;return _0x10640d;})[_0x94fe('0x21')](respondWithFilteredResult(_0x197f3a,_0x7df08b))['catch'](handleError(_0x197f3a,null));};exports['show']=function(_0x188e21,_0xfce685){var _0x1b42e3={'raw':!![],'where':{'id':_0x188e21[_0x94fe('0x3e')]['id']}},_0x483fb9={};_0x483fb9[_0x94fe('0x2d')]=_[_0x94fe('0x2e')](db[_0x94fe('0x3c')][_0x94fe('0x29')]);_0x483fb9[_0x94fe('0x2f')]=_[_0x94fe('0x2e')](_0x188e21['query']);_0x483fb9['filters']=_[_0x94fe('0x31')](_0x483fb9['model'],_0x483fb9[_0x94fe('0x2f')]);_0x1b42e3['attributes']=_['intersection'](_0x483fb9['model'],qs[_0x94fe('0x33')](_0x188e21[_0x94fe('0x2f')][_0x94fe('0x33')]));_0x1b42e3[_0x94fe('0x32')]=_0x1b42e3[_0x94fe('0x32')]['length']?_0x1b42e3[_0x94fe('0x32')]:_0x483fb9[_0x94fe('0x2d')];if(_0x188e21[_0x94fe('0x2f')]['includeAll']){_0x1b42e3[_0x94fe('0x3b')]=[{'all':!![]}];}_0x1b42e3=_[_0x94fe('0x39')]({},_0x1b42e3,_0x188e21[_0x94fe('0x3a')]);return db['CannedAnswer'][_0x94fe('0x3f')](_0x1b42e3)[_0x94fe('0x21')](handleEntityNotFound(_0xfce685,null))[_0x94fe('0x21')](respondWithResult(_0xfce685,null))['catch'](handleError(_0xfce685,null));};exports[_0x94fe('0x20')]=function(_0x571be7,_0x486eac){if(_0x571be7[_0x94fe('0x40')]['id']){delete _0x571be7[_0x94fe('0x40')]['id'];}return db['CannedAnswer'][_0x94fe('0x3f')]({'where':{'id':_0x571be7[_0x94fe('0x3e')]['id']}})[_0x94fe('0x21')](handleEntityNotFound(_0x486eac,null))[_0x94fe('0x21')](saveUpdates(_0x571be7[_0x94fe('0x40')],null))[_0x94fe('0x21')](respondWithResult(_0x486eac,null))[_0x94fe('0x41')](handleError(_0x486eac,null));};exports[_0x94fe('0x22')]=function(_0x2fd648,_0x2f1c6b){return db[_0x94fe('0x3c')]['find']({'where':{'id':_0x2fd648['params']['id']}})[_0x94fe('0x21')](handleEntityNotFound(_0x2f1c6b,null))[_0x94fe('0x21')](removeEntity(_0x2f1c6b,null))[_0x94fe('0x41')](handleError(_0x2f1c6b,null));};exports[_0x94fe('0x42')]=function(_0xcd7d4,_0x476e59){var _0x4b74fe={'key':_0xcd7d4[_0x94fe('0x40')][_0x94fe('0x2c')]};if(_0xcd7d4['body'][_0x94fe('0x43')]){_0x4b74fe['MailAccountId']=_0xcd7d4[_0x94fe('0x40')][_0x94fe('0x43')];}else if(_0xcd7d4[_0x94fe('0x40')][_0x94fe('0x44')]){_0x4b74fe[_0x94fe('0x44')]=_0xcd7d4[_0x94fe('0x40')][_0x94fe('0x44')];}else if(_0xcd7d4[_0x94fe('0x40')]['OpenchannelAccountId']){_0x4b74fe['OpenchannelAccountId']=_0xcd7d4[_0x94fe('0x40')][_0x94fe('0x45')];}else if(_0xcd7d4[_0x94fe('0x40')][_0x94fe('0x46')]){_0x4b74fe[_0x94fe('0x46')]=_0xcd7d4[_0x94fe('0x40')]['ChatWebsiteId'];}return db['CannedAnswer']['find']({'where':_0x4b74fe})[_0x94fe('0x21')](function(_0x10d72a){if(_0x10d72a){throw new db[(_0x94fe('0x47'))]['ValidationError'](_0x94fe('0x48'));}return db[_0x94fe('0x3c')][_0x94fe('0x42')](_0xcd7d4[_0x94fe('0x40')]);})['then'](function(_0x473ac9){var _0x35f7e4=_0xcd7d4[_0x94fe('0x49')][_0x94fe('0x4a')]({'plain':!![]});if(!_0x35f7e4)throw new Error(_0x94fe('0x4b'));if(_0x35f7e4[_0x94fe('0x4c')]===_0x94fe('0x49')){var _0x17fe6a=_0x473ac9[_0x94fe('0x4a')]({'plain':!![]});return db[_0x94fe('0x4d')][_0x94fe('0x3f')]({'where':{'name':_0x94fe('0x4e'),'userProfileId':_0x35f7e4['userProfileId']},'raw':!![]})['then'](function(_0x5626e5){if(_0x5626e5&&_0x5626e5[_0x94fe('0x4f')]===0x0){return db[_0x94fe('0x50')][_0x94fe('0x42')]({'name':_0x17fe6a[_0x94fe('0x25')],'resourceId':_0x17fe6a['id'],'type':_0x5626e5['name'],'sectionId':_0x5626e5['id']},{})[_0x94fe('0x21')](function(){return _0x473ac9;});}else{return _0x473ac9;}})[_0x94fe('0x41')](function(_0x1b2bdb){logger[_0x94fe('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1b2bdb);throw _0x1b2bdb;});}return _0x473ac9;})[_0x94fe('0x21')](respondWithResult(_0x476e59,0xc9))[_0x94fe('0x41')](handleError(_0x476e59,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 019904e..f3841af 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 _0x43e5=['define','CannedAnswer','tools_canned_answers','utf8mb4','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x114ae4,_0x14bdc9){var _0x32f566=function(_0x4f3fd1){while(--_0x4f3fd1){_0x114ae4['push'](_0x114ae4['shift']());}};_0x32f566(++_0x14bdc9);}(_0x43e5,0x160));var _0x543e=function(_0x3ee091,_0x259393){_0x3ee091=_0x3ee091-0x0;var _0x31d6f=_0x43e5[_0x3ee091];return _0x31d6f;};'use strict';var _=require(_0x543e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x543e('0x1'));var BPromise=require(_0x543e('0x2'));var rp=require(_0x543e('0x3'));var fs=require('fs');var path=require(_0x543e('0x4'));var rimraf=require(_0x543e('0x5'));var config=require(_0x543e('0x6'));var attributes=require('./cannedAnswer.attributes');module[_0x543e('0x7')]=function(_0x5ad163,_0x2c564a){return _0x5ad163[_0x543e('0x8')](_0x543e('0x9'),attributes,{'tableName':_0x543e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x543e('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x7061=['bluebird','request-promise','path','tools_canned_answers','lodash','util','api'];(function(_0x50cb00,_0x1499ef){var _0xd62f39=function(_0x1669fc){while(--_0x1669fc){_0x50cb00['push'](_0x50cb00['shift']());}};_0xd62f39(++_0x1499ef);}(_0x7061,0xac));var _0x1706=function(_0x4f6f04,_0x461ec4){_0x4f6f04=_0x4f6f04-0x0;var _0x311a20=_0x7061[_0x4f6f04];return _0x311a20;};'use strict';var _=require(_0x1706('0x0'));var util=require(_0x1706('0x1'));var logger=require('../../config/logger')(_0x1706('0x2'));var moment=require('moment');var BPromise=require(_0x1706('0x3'));var rp=require(_0x1706('0x4'));var fs=require('fs');var path=require(_0x1706('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cannedAnswer.attributes');module['exports']=function(_0x5afb73,_0x5740a6){return _0x5afb73['define']('CannedAnswer',attributes,{'tableName':_0x1706('0x6'),'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 2463dfd..426645a 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(_0x14ca7a,_0x129814){var _0x48a3e0=function(_0x5904ee){while(--_0x5904ee){_0x14ca7a['push'](_0x14ca7a['shift']());}};_0x48a3e0(++_0x129814);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'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(_0x5e729d,_0x254376){var _0x4efc38=function(_0x3a5a49){while(--_0x3a5a49){_0x5e729d['push'](_0x5e729d['shift']());}};_0x4efc38(++_0x254376);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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 2f49d42..f7cc97b 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 _0x4b29=['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'];(function(_0x4001ad,_0x1e22dd){var _0x4c7ec2=function(_0x24cb8a){while(--_0x24cb8a){_0x4001ad['push'](_0x4001ad['shift']());}};_0x4c7ec2(++_0x1e22dd);}(_0x4b29,0x14a));var _0x94b2=function(_0x418a6c,_0x2f04d2){_0x418a6c=_0x418a6c-0x0;var _0x47b44e=_0x4b29[_0x418a6c];return _0x47b44e;};'use strict';var multer=require(_0x94b2('0x0'));var util=require(_0x94b2('0x1'));var path=require(_0x94b2('0x2'));var timeout=require(_0x94b2('0x3'));var express=require(_0x94b2('0x4'));var router=express[_0x94b2('0x5')]();var fs_extra=require(_0x94b2('0x6'));var auth=require(_0x94b2('0x7'));var interaction=require(_0x94b2('0x8'));var config=require(_0x94b2('0x9'));var controller=require('./cannedAnswer.controller');router['get']('/',auth[_0x94b2('0xa')](),controller[_0x94b2('0xb')]);router[_0x94b2('0xc')](_0x94b2('0xd'),auth['isAuthenticated'](),controller[_0x94b2('0xe')]);router[_0x94b2('0xf')]('/',auth[_0x94b2('0xa')](),controller['create']);router['put'](_0x94b2('0xd'),auth[_0x94b2('0xa')](),controller[_0x94b2('0x10')]);router[_0x94b2('0x11')](_0x94b2('0xd'),auth['isAuthenticated'](),controller[_0x94b2('0x12')]);module[_0x94b2('0x13')]=router; \ No newline at end of file +var _0xd286=['../../components/interaction/service','./cannedAnswer.controller','isAuthenticated','/:id','post','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xd286,0x181));var _0x6d28=function(_0x5ea3f6,_0x595373){_0x5ea3f6=_0x5ea3f6-0x0;var _0x3fc5a2=_0xd286[_0x5ea3f6];return _0x3fc5a2;};'use strict';var multer=require(_0x6d28('0x0'));var util=require(_0x6d28('0x1'));var path=require(_0x6d28('0x2'));var timeout=require(_0x6d28('0x3'));var express=require(_0x6d28('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6d28('0x5'));var config=require('../../config/environment');var controller=require(_0x6d28('0x6'));router['get']('/',auth[_0x6d28('0x7')](),controller['index']);router['get'](_0x6d28('0x8'),auth[_0x6d28('0x7')](),controller['show']);router[_0x6d28('0x9')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x6d28('0x7')](),controller['update']);router[_0x6d28('0xa')](_0x6d28('0x8'),auth[_0x6d28('0x7')](),controller[_0x6d28('0xb')]);module[_0x6d28('0xc')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 5c417ca..3b72dd6 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 _0xc68d=['STRING','INTEGER','exports','DATE'];(function(_0x1989e2,_0x5a3b47){var _0x218d38=function(_0x572af8){while(--_0x572af8){_0x1989e2['push'](_0x1989e2['shift']());}};_0x218d38(++_0x5a3b47);}(_0xc68d,0x17a));var _0xdc68=function(_0x314737,_0xc0002d){_0x314737=_0x314737-0x0;var _0x19cd9c=_0xc68d[_0x314737];return _0x19cd9c;};'use strict';var Sequelize=require('sequelize');module[_0xdc68('0x0')]={'calldate':{'type':Sequelize[_0xdc68('0x1')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0xdc68('0x2')]},'dst':{'type':Sequelize[_0xdc68('0x2')]},'dcontext':{'type':Sequelize[_0xdc68('0x2')]},'channel':{'type':Sequelize[_0xdc68('0x2')]},'dstchannel':{'type':Sequelize[_0xdc68('0x2')]},'lastapp':{'type':Sequelize[_0xdc68('0x2')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0xdc68('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xdc68('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xdc68('0x2')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xdc68('0x2')]},'userfield':{'type':Sequelize[_0xdc68('0x2')]},'uniqueid':{'type':Sequelize[_0xdc68('0x2')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0xdc68('0x2')]},'type':{'type':Sequelize[_0xdc68('0x2')]},'tag':{'type':Sequelize[_0xdc68('0x2')]}}; \ No newline at end of file +var _0xf296=['1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports'];(function(_0x4cbfbc,_0x3165d4){var _0x11b285=function(_0x4c5948){while(--_0x4c5948){_0x4cbfbc['push'](_0x4cbfbc['shift']());}};_0x11b285(++_0x3165d4);}(_0xf296,0x94));var _0x6f29=function(_0x614dc5,_0x3dd98e){_0x614dc5=_0x614dc5-0x0;var _0x571e07=_0xf296[_0x614dc5];return _0x571e07;};'use strict';var Sequelize=require(_0x6f29('0x0'));module[_0x6f29('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x6f29('0x2')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x6f29('0x3')]},'dcontext':{'type':Sequelize[_0x6f29('0x3')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x6f29('0x3')]},'lastapp':{'type':Sequelize[_0x6f29('0x3')]},'lastdata':{'type':Sequelize[_0x6f29('0x3')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x6f29('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x6f29('0x3')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x6f29('0x3')]},'userfield':{'type':Sequelize[_0x6f29('0x3')]},'uniqueid':{'type':Sequelize[_0x6f29('0x3')]},'linkedid':{'type':Sequelize[_0x6f29('0x3')]},'sequence':{'type':Sequelize[_0x6f29('0x3')]},'peeraccount':{'type':Sequelize[_0x6f29('0x3')]},'type':{'type':Sequelize[_0x6f29('0x3')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 2abba2d..3823693 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 _0x5162=['undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','Cdr','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','catch','show','params','intersection','find','create','body','eml-format','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5162,0x103));var _0x2516=function(_0x33b9ac,_0x1cd671){_0x33b9ac=_0x33b9ac-0x0;var _0x4da2a0=_0x5162[_0x33b9ac];return _0x4da2a0;};'use strict';var emlformat=require(_0x2516('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2516('0x1'));var BPromise=require(_0x2516('0x2'));var Mustache=require(_0x2516('0x3'));var util=require(_0x2516('0x4'));var path=require(_0x2516('0x5'));var sox=require(_0x2516('0x6'));var csv=require(_0x2516('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2516('0x8'));var crypto=require(_0x2516('0x9'));var jsforce=require(_0x2516('0xa'));var deskjs=require(_0x2516('0xb'));var toCsv=require(_0x2516('0x7'));var querystring=require(_0x2516('0xc'));var Papa=require(_0x2516('0xd'));var Redis=require('ioredis');var authService=require(_0x2516('0xe'));var qs=require(_0x2516('0xf'));var as=require(_0x2516('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x2516('0x11'));var licenseUtil=require(_0x2516('0x12'));var db=require(_0x2516('0x13'))['db'];function respondWithStatusCode(_0x3ef6ff,_0x56c69c){_0x56c69c=_0x56c69c||0xcc;return function(_0x33496b){if(_0x33496b){return _0x3ef6ff[_0x2516('0x14')](_0x56c69c);}return _0x3ef6ff[_0x2516('0x15')](_0x56c69c)[_0x2516('0x16')]();};}function respondWithResult(_0x42c771,_0x558d20){_0x558d20=_0x558d20||0xc8;return function(_0x3e5e0f){if(_0x3e5e0f){return _0x42c771[_0x2516('0x15')](_0x558d20)[_0x2516('0x17')](_0x3e5e0f);}};}function respondWithFilteredResult(_0x181a28,_0x2637e8){return function(_0x2ec31f){if(_0x2ec31f){var _0x19aacb=typeof _0x2637e8[_0x2516('0x18')]===_0x2516('0x19')&&typeof _0x2637e8['limit']===_0x2516('0x19');var _0x1ced29=_0x2ec31f[_0x2516('0x1a')];var _0x564d05=_0x19aacb?0x0:_0x2637e8[_0x2516('0x18')];var _0x5e96c7=_0x19aacb?_0x2ec31f['count']:_0x2637e8[_0x2516('0x18')]+_0x2637e8[_0x2516('0x1b')];var _0x151168;if(_0x5e96c7>=_0x1ced29){_0x5e96c7=_0x1ced29;_0x151168=0xc8;}else{_0x151168=0xce;}_0x181a28[_0x2516('0x15')](_0x151168);return _0x181a28[_0x2516('0x1c')](_0x2516('0x1d'),_0x564d05+'-'+_0x5e96c7+'/'+_0x1ced29)[_0x2516('0x17')](_0x2ec31f);}return null;};}function patchUpdates(_0x113616){return function(_0x248c5a){try{jsonpatch[_0x2516('0x1e')](_0x248c5a,_0x113616,!![]);}catch(_0x39ba5b){return BPromise[_0x2516('0x1f')](_0x39ba5b);}return _0x248c5a[_0x2516('0x20')]();};}function saveUpdates(_0x4fb7d9,_0x559a3e){return function(_0x12db4d){if(_0x12db4d){return _0x12db4d[_0x2516('0x21')](_0x4fb7d9)[_0x2516('0x22')](function(_0x2d5b1b){return _0x2d5b1b;});}return null;};}function removeEntity(_0x3ffb6d,_0x32de7a){return function(_0x3d906d){if(_0x3d906d){return _0x3d906d[_0x2516('0x23')]()['then'](function(){_0x3ffb6d[_0x2516('0x15')](0xcc)[_0x2516('0x16')]();});}};}function handleEntityNotFound(_0x774b60,_0x434d54){return function(_0x47f4fb){if(!_0x47f4fb){_0x774b60[_0x2516('0x14')](0x194);}return _0x47f4fb;};}function handleError(_0x30eeb9,_0x1f722c){_0x1f722c=_0x1f722c||0x1f4;return function(_0x3d728a){logger[_0x2516('0x24')](_0x3d728a['stack']);if(_0x3d728a[_0x2516('0x25')]){delete _0x3d728a[_0x2516('0x25')];}_0x30eeb9[_0x2516('0x15')](_0x1f722c)[_0x2516('0x26')](_0x3d728a);};}exports[_0x2516('0x27')]=function(_0x285e67,_0x556f01){var _0x136893={},_0x20dc9f={},_0x493a3e={'count':0x0,'rows':[]};var _0x19d90d=_[_0x2516('0x28')](db[_0x2516('0x29')][_0x2516('0x2a')],function(_0x539704){return{'name':_0x539704[_0x2516('0x2b')],'type':_0x539704[_0x2516('0x2c')][_0x2516('0x2d')]};});_0x20dc9f[_0x2516('0x2e')]=_[_0x2516('0x28')](_0x19d90d,_0x2516('0x25'));_0x20dc9f[_0x2516('0x2f')]=_[_0x2516('0x30')](_0x285e67[_0x2516('0x2f')]);_0x20dc9f[_0x2516('0x31')]=_['intersection'](_0x20dc9f[_0x2516('0x2e')],_0x20dc9f['query']);_0x136893[_0x2516('0x32')]=_['intersection'](_0x20dc9f[_0x2516('0x2e')],qs['fields'](_0x285e67[_0x2516('0x2f')][_0x2516('0x33')]));_0x136893[_0x2516('0x32')]=_0x136893[_0x2516('0x32')][_0x2516('0x34')]?_0x136893[_0x2516('0x32')]:_0x20dc9f[_0x2516('0x2e')];if(!_0x285e67[_0x2516('0x2f')][_0x2516('0x35')]('nolimit')){_0x136893[_0x2516('0x1b')]=qs[_0x2516('0x1b')](_0x285e67[_0x2516('0x2f')][_0x2516('0x1b')]);_0x136893['offset']=qs['offset'](_0x285e67[_0x2516('0x2f')][_0x2516('0x18')]);}_0x136893[_0x2516('0x36')]=qs[_0x2516('0x37')](_0x285e67[_0x2516('0x2f')][_0x2516('0x37')]);_0x136893[_0x2516('0x38')]=qs[_0x2516('0x31')](_[_0x2516('0x39')](_0x285e67[_0x2516('0x2f')],_0x20dc9f['filters']),_0x19d90d);if(_0x285e67['query'][_0x2516('0x3a')]){_0x136893[_0x2516('0x38')]=_['merge'](_0x136893['where'],{'$or':_[_0x2516('0x28')](_0x19d90d,function(_0x3b310f){if(_0x3b310f['type']!==_0x2516('0x3b')){var _0x52ef6b={};_0x52ef6b[_0x3b310f[_0x2516('0x25')]]={'$like':'%'+_0x285e67[_0x2516('0x2f')]['filter']+'%'};return _0x52ef6b;}})});}_0x136893=_[_0x2516('0x3c')]({},_0x136893,_0x285e67[_0x2516('0x3d')]);var _0x155cf7={'where':_0x136893[_0x2516('0x38')]};return db[_0x2516('0x29')][_0x2516('0x1a')](_0x155cf7)[_0x2516('0x22')](function(_0x2371a8){_0x493a3e[_0x2516('0x1a')]=_0x2371a8;if(_0x285e67[_0x2516('0x2f')][_0x2516('0x3e')]){_0x136893[_0x2516('0x3f')]=[{'all':!![]}];}return db[_0x2516('0x29')]['findAll'](_0x136893);})[_0x2516('0x22')](function(_0x1bc0e){_0x493a3e['rows']=_0x1bc0e;return _0x493a3e;})[_0x2516('0x22')](respondWithFilteredResult(_0x556f01,_0x136893))[_0x2516('0x40')](handleError(_0x556f01,null));};exports[_0x2516('0x41')]=function(_0x1afefb,_0x421c58){var _0x582cb6={'raw':!![],'where':{'id':_0x1afefb[_0x2516('0x42')]['id']}},_0x1a8d2d={};_0x1a8d2d[_0x2516('0x2e')]=_[_0x2516('0x30')](db[_0x2516('0x29')][_0x2516('0x2a')]);_0x1a8d2d['query']=_[_0x2516('0x30')](_0x1afefb[_0x2516('0x2f')]);_0x1a8d2d[_0x2516('0x31')]=_[_0x2516('0x43')](_0x1a8d2d[_0x2516('0x2e')],_0x1a8d2d[_0x2516('0x2f')]);_0x582cb6[_0x2516('0x32')]=_['intersection'](_0x1a8d2d[_0x2516('0x2e')],qs['fields'](_0x1afefb[_0x2516('0x2f')]['fields']));_0x582cb6[_0x2516('0x32')]=_0x582cb6[_0x2516('0x32')][_0x2516('0x34')]?_0x582cb6['attributes']:_0x1a8d2d['model'];if(_0x1afefb[_0x2516('0x2f')][_0x2516('0x3e')]){_0x582cb6['include']=[{'all':!![]}];}_0x582cb6=_['merge']({},_0x582cb6,_0x1afefb[_0x2516('0x3d')]);return db[_0x2516('0x29')][_0x2516('0x44')](_0x582cb6)['then'](handleEntityNotFound(_0x421c58,null))[_0x2516('0x22')](respondWithResult(_0x421c58,null))['catch'](handleError(_0x421c58,null));};exports[_0x2516('0x45')]=function(_0x39fd32,_0x318128){return db[_0x2516('0x29')]['create'](_0x39fd32[_0x2516('0x46')],{})[_0x2516('0x22')](respondWithResult(_0x318128,0xc9))[_0x2516('0x40')](handleError(_0x318128,null));};exports[_0x2516('0x21')]=function(_0x43874c,_0x482883){if(_0x43874c[_0x2516('0x46')]['id']){delete _0x43874c[_0x2516('0x46')]['id'];}return db[_0x2516('0x29')][_0x2516('0x44')]({'where':{'id':_0x43874c['params']['id']}})[_0x2516('0x22')](handleEntityNotFound(_0x482883,null))[_0x2516('0x22')](saveUpdates(_0x43874c[_0x2516('0x46')],null))[_0x2516('0x22')](respondWithResult(_0x482883,null))[_0x2516('0x40')](handleError(_0x482883,null));};exports['destroy']=function(_0x1c4be3,_0x1aa854){return db[_0x2516('0x29')][_0x2516('0x44')]({'where':{'id':_0x1c4be3[_0x2516('0x42')]['id']}})[_0x2516('0x22')](handleEntityNotFound(_0x1aa854,null))['then'](removeEntity(_0x1aa854,null))['catch'](handleError(_0x1aa854,null));};exports['describe']=function(_0x323590,_0x4f7eb4){return db['Cdr']['describe']()[_0x2516('0x22')](respondWithResult(_0x4f7eb4,null))[_0x2516('0x40')](handleError(_0x4f7eb4,null));}; \ No newline at end of file +var _0xa751=['path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','status','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','Cdr','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','rows','catch','show','params','keys','includeAll','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util'];(function(_0x62c646,_0xa08641){var _0x2385f3=function(_0x45b92b){while(--_0x45b92b){_0x62c646['push'](_0x62c646['shift']());}};_0x2385f3(++_0xa08641);}(_0xa751,0x175));var _0x1a75=function(_0x5b10f5,_0x47493e){_0x5b10f5=_0x5b10f5-0x0;var _0x1b5d6a=_0xa751[_0x5b10f5];return _0x1b5d6a;};'use strict';var emlformat=require(_0x1a75('0x0'));var rimraf=require(_0x1a75('0x1'));var zipdir=require(_0x1a75('0x2'));var jsonpatch=require(_0x1a75('0x3'));var rp=require('request-promise');var moment=require(_0x1a75('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1a75('0x5'));var util=require(_0x1a75('0x6'));var path=require(_0x1a75('0x7'));var sox=require('sox');var csv=require(_0x1a75('0x8'));var ejs=require(_0x1a75('0x9'));var fs=require('fs');var fs_extra=require(_0x1a75('0xa'));var _=require(_0x1a75('0xb'));var squel=require(_0x1a75('0xc'));var crypto=require(_0x1a75('0xd'));var jsforce=require(_0x1a75('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1a75('0xf'));var Redis=require(_0x1a75('0x10'));var authService=require(_0x1a75('0x11'));var qs=require(_0x1a75('0x12'));var as=require(_0x1a75('0x13'));var hardwareService=require(_0x1a75('0x14'));var logger=require(_0x1a75('0x15'))(_0x1a75('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1a75('0x17'))['db'];function respondWithStatusCode(_0x24e8dc,_0xae1af0){_0xae1af0=_0xae1af0||0xcc;return function(_0x1220e4){if(_0x1220e4){return _0x24e8dc['sendStatus'](_0xae1af0);}return _0x24e8dc['status'](_0xae1af0)[_0x1a75('0x18')]();};}function respondWithResult(_0xf4a616,_0x48577b){_0x48577b=_0x48577b||0xc8;return function(_0x1c84d3){if(_0x1c84d3){return _0xf4a616[_0x1a75('0x19')](_0x48577b)['json'](_0x1c84d3);}};}function respondWithFilteredResult(_0x1f3c38,_0xb4a245){return function(_0x15a1ec){if(_0x15a1ec){var _0x5883df=typeof _0xb4a245['offset']==='undefined'&&typeof _0xb4a245[_0x1a75('0x1a')]===_0x1a75('0x1b');var _0x2b6f3d=_0x15a1ec[_0x1a75('0x1c')];var _0x1b1af2=_0x5883df?0x0:_0xb4a245[_0x1a75('0x1d')];var _0x47f384=_0x5883df?_0x15a1ec[_0x1a75('0x1c')]:_0xb4a245['offset']+_0xb4a245['limit'];var _0x42df2c;if(_0x47f384>=_0x2b6f3d){_0x47f384=_0x2b6f3d;_0x42df2c=0xc8;}else{_0x42df2c=0xce;}_0x1f3c38[_0x1a75('0x19')](_0x42df2c);return _0x1f3c38['set'](_0x1a75('0x1e'),_0x1b1af2+'-'+_0x47f384+'/'+_0x2b6f3d)['json'](_0x15a1ec);}return null;};}function patchUpdates(_0x4699c9){return function(_0x3e3549){try{jsonpatch[_0x1a75('0x1f')](_0x3e3549,_0x4699c9,!![]);}catch(_0x340750){return BPromise[_0x1a75('0x20')](_0x340750);}return _0x3e3549[_0x1a75('0x21')]();};}function saveUpdates(_0x5a0ad7,_0x3ed5e9){return function(_0x4dc595){if(_0x4dc595){return _0x4dc595[_0x1a75('0x22')](_0x5a0ad7)[_0x1a75('0x23')](function(_0x320413){return _0x320413;});}return null;};}function removeEntity(_0x59e3da,_0x443ff8){return function(_0x5e6617){if(_0x5e6617){return _0x5e6617[_0x1a75('0x24')]()[_0x1a75('0x23')](function(){_0x59e3da[_0x1a75('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9fe9fe,_0x126f40){return function(_0x4dec82){if(!_0x4dec82){_0x9fe9fe[_0x1a75('0x25')](0x194);}return _0x4dec82;};}function handleError(_0x399dae,_0x5a6acc){_0x5a6acc=_0x5a6acc||0x1f4;return function(_0x168e06){logger[_0x1a75('0x26')](_0x168e06[_0x1a75('0x27')]);if(_0x168e06[_0x1a75('0x28')]){delete _0x168e06['name'];}_0x399dae[_0x1a75('0x19')](_0x5a6acc)[_0x1a75('0x29')](_0x168e06);};}exports[_0x1a75('0x2a')]=function(_0x2f5ac9,_0xf33870){var _0x9e66b9={},_0x3b6e1d={},_0x38e885={'count':0x0,'rows':[]};var _0x5518ed=_['map'](db[_0x1a75('0x2b')][_0x1a75('0x2c')],function(_0x1a0359){return{'name':_0x1a0359[_0x1a75('0x2d')],'type':_0x1a0359[_0x1a75('0x2e')][_0x1a75('0x2f')]};});_0x3b6e1d[_0x1a75('0x30')]=_[_0x1a75('0x31')](_0x5518ed,'name');_0x3b6e1d['query']=_['keys'](_0x2f5ac9[_0x1a75('0x32')]);_0x3b6e1d[_0x1a75('0x33')]=_[_0x1a75('0x34')](_0x3b6e1d[_0x1a75('0x30')],_0x3b6e1d['query']);_0x9e66b9['attributes']=_['intersection'](_0x3b6e1d[_0x1a75('0x30')],qs[_0x1a75('0x35')](_0x2f5ac9['query']['fields']));_0x9e66b9[_0x1a75('0x36')]=_0x9e66b9['attributes'][_0x1a75('0x37')]?_0x9e66b9[_0x1a75('0x36')]:_0x3b6e1d[_0x1a75('0x30')];if(!_0x2f5ac9['query']['hasOwnProperty'](_0x1a75('0x38'))){_0x9e66b9[_0x1a75('0x1a')]=qs[_0x1a75('0x1a')](_0x2f5ac9[_0x1a75('0x32')][_0x1a75('0x1a')]);_0x9e66b9[_0x1a75('0x1d')]=qs[_0x1a75('0x1d')](_0x2f5ac9[_0x1a75('0x32')][_0x1a75('0x1d')]);}_0x9e66b9[_0x1a75('0x39')]=qs[_0x1a75('0x3a')](_0x2f5ac9[_0x1a75('0x32')][_0x1a75('0x3a')]);_0x9e66b9[_0x1a75('0x3b')]=qs[_0x1a75('0x33')](_[_0x1a75('0x3c')](_0x2f5ac9['query'],_0x3b6e1d[_0x1a75('0x33')]),_0x5518ed);if(_0x2f5ac9['query']['filter']){_0x9e66b9[_0x1a75('0x3b')]=_[_0x1a75('0x3d')](_0x9e66b9[_0x1a75('0x3b')],{'$or':_[_0x1a75('0x31')](_0x5518ed,function(_0x2842d4){if(_0x2842d4['type']!==_0x1a75('0x3e')){var _0xc88c40={};_0xc88c40[_0x2842d4[_0x1a75('0x28')]]={'$like':'%'+_0x2f5ac9[_0x1a75('0x32')][_0x1a75('0x3f')]+'%'};return _0xc88c40;}})});}_0x9e66b9=_['merge']({},_0x9e66b9,_0x2f5ac9[_0x1a75('0x40')]);var _0x481bfe={'where':_0x9e66b9[_0x1a75('0x3b')]};return db[_0x1a75('0x2b')][_0x1a75('0x1c')](_0x481bfe)[_0x1a75('0x23')](function(_0x269ed6){_0x38e885[_0x1a75('0x1c')]=_0x269ed6;if(_0x2f5ac9[_0x1a75('0x32')]['includeAll']){_0x9e66b9['include']=[{'all':!![]}];}return db[_0x1a75('0x2b')]['findAll'](_0x9e66b9);})[_0x1a75('0x23')](function(_0x14abcf){_0x38e885[_0x1a75('0x41')]=_0x14abcf;return _0x38e885;})['then'](respondWithFilteredResult(_0xf33870,_0x9e66b9))[_0x1a75('0x42')](handleError(_0xf33870,null));};exports[_0x1a75('0x43')]=function(_0x21bfae,_0x5a2c51){var _0x292cbc={'raw':!![],'where':{'id':_0x21bfae[_0x1a75('0x44')]['id']}},_0x15fe49={};_0x15fe49[_0x1a75('0x30')]=_[_0x1a75('0x45')](db[_0x1a75('0x2b')][_0x1a75('0x2c')]);_0x15fe49['query']=_[_0x1a75('0x45')](_0x21bfae[_0x1a75('0x32')]);_0x15fe49[_0x1a75('0x33')]=_[_0x1a75('0x34')](_0x15fe49[_0x1a75('0x30')],_0x15fe49['query']);_0x292cbc[_0x1a75('0x36')]=_[_0x1a75('0x34')](_0x15fe49['model'],qs[_0x1a75('0x35')](_0x21bfae['query'][_0x1a75('0x35')]));_0x292cbc['attributes']=_0x292cbc[_0x1a75('0x36')][_0x1a75('0x37')]?_0x292cbc[_0x1a75('0x36')]:_0x15fe49[_0x1a75('0x30')];if(_0x21bfae[_0x1a75('0x32')][_0x1a75('0x46')]){_0x292cbc[_0x1a75('0x47')]=[{'all':!![]}];}_0x292cbc=_['merge']({},_0x292cbc,_0x21bfae[_0x1a75('0x40')]);return db['Cdr'][_0x1a75('0x48')](_0x292cbc)[_0x1a75('0x23')](handleEntityNotFound(_0x5a2c51,null))[_0x1a75('0x23')](respondWithResult(_0x5a2c51,null))[_0x1a75('0x42')](handleError(_0x5a2c51,null));};exports[_0x1a75('0x49')]=function(_0x1bf8a0,_0x2cfacf){return db[_0x1a75('0x2b')]['create'](_0x1bf8a0[_0x1a75('0x4a')],{})[_0x1a75('0x23')](respondWithResult(_0x2cfacf,0xc9))[_0x1a75('0x42')](handleError(_0x2cfacf,null));};exports[_0x1a75('0x22')]=function(_0x385382,_0x1b76d){if(_0x385382[_0x1a75('0x4a')]['id']){delete _0x385382[_0x1a75('0x4a')]['id'];}return db[_0x1a75('0x2b')][_0x1a75('0x48')]({'where':{'id':_0x385382[_0x1a75('0x44')]['id']}})[_0x1a75('0x23')](handleEntityNotFound(_0x1b76d,null))[_0x1a75('0x23')](saveUpdates(_0x385382[_0x1a75('0x4a')],null))[_0x1a75('0x23')](respondWithResult(_0x1b76d,null))['catch'](handleError(_0x1b76d,null));};exports[_0x1a75('0x24')]=function(_0xa20c25,_0x1ae0cb){return db[_0x1a75('0x2b')][_0x1a75('0x48')]({'where':{'id':_0xa20c25[_0x1a75('0x44')]['id']}})[_0x1a75('0x23')](handleEntityNotFound(_0x1ae0cb,null))[_0x1a75('0x23')](removeEntity(_0x1ae0cb,null))['catch'](handleError(_0x1ae0cb,null));};exports[_0x1a75('0x4b')]=function(_0x5f44e3,_0x40e643){return db[_0x1a75('0x2b')][_0x1a75('0x4b')]()['then'](respondWithResult(_0x40e643,null))['catch'](handleError(_0x40e643,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 2461eee..bca49f9 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 _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x222d6f,_0x116849){var _0x1e08bb=function(_0x43943b){while(--_0x43943b){_0x222d6f['push'](_0x222d6f['shift']());}};_0x1e08bb(++_0x116849);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'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(_0x3d2532,_0x2936dc){var _0x1405ce=function(_0x3201d9){while(--_0x3201d9){_0x3d2532['push'](_0x3d2532['shift']());}};_0x1405ce(++_0x2936dc);}(_0x7a54,0x106));var _0x47a5=function(_0xa99e80,_0x1aea8f){_0xa99e80=_0xa99e80-0x0;var _0x5225d6=_0x7a54[_0xa99e80];return _0x5225d6;};'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 aabb283..29fa434 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 _0x6766=['client','http','request','then','info','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','Cdr,\x20%s,\x20%s','message','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x18c9ab,_0x6ba7e7){var _0x17fc37=function(_0x57783c){while(--_0x57783c){_0x18c9ab['push'](_0x18c9ab['shift']());}};_0x17fc37(++_0x6ba7e7);}(_0x6766,0xf5));var _0x6676=function(_0xb1cf84,_0x813740){_0xb1cf84=_0xb1cf84-0x0;var _0x4bad2e=_0x6766[_0xb1cf84];return _0x4bad2e;};'use strict';var _=require('lodash');var util=require(_0x6676('0x0'));var moment=require(_0x6676('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6676('0x2'))['db'];var utils=require(_0x6676('0x3'));var logger=require(_0x6676('0x4'))('rpc');var config=require(_0x6676('0x5'));var jayson=require(_0x6676('0x6'));var client=jayson[_0x6676('0x7')][_0x6676('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x368418,_0x231998,_0x11e2bd){return new BPromise(function(_0x527775,_0x3b9851){return client[_0x6676('0x9')](_0x368418,_0x11e2bd)[_0x6676('0xa')](function(_0xc67135){logger[_0x6676('0xb')]('Cdr,\x20%s,\x20%s',_0x231998,_0x6676('0xc'));logger[_0x6676('0xd')](_0x6676('0xe'),_0x231998,_0x6676('0xc'),JSON[_0x6676('0xf')](_0xc67135));if(_0xc67135[_0x6676('0x10')]){if(_0xc67135[_0x6676('0x10')][_0x6676('0x11')]===0x1f4){logger[_0x6676('0x10')](_0x6676('0x12'),_0x231998,_0xc67135['error'][_0x6676('0x13')]);return _0x3b9851(_0xc67135['error'][_0x6676('0x13')]);}logger[_0x6676('0x10')](_0x6676('0x12'),_0x231998,_0xc67135['error'][_0x6676('0x13')]);return _0x527775(_0xc67135['error']['message']);}else{logger[_0x6676('0xb')](_0x6676('0x12'),_0x231998,_0x6676('0xc'));_0x527775(_0xc67135['result'][_0x6676('0x13')]);}})[_0x6676('0x14')](function(_0x3bdad8){logger[_0x6676('0x10')](_0x6676('0x12'),_0x231998,_0x3bdad8);_0x3b9851(_0x3bdad8);});});} \ No newline at end of file +var _0x2d9c=['http','request','then','info','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message','Cdr,\x20%s,\x20%s','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','client'];(function(_0x46ae81,_0x16cd38){var _0x5013ca=function(_0x2ad2d2){while(--_0x2ad2d2){_0x46ae81['push'](_0x46ae81['shift']());}};_0x5013ca(++_0x16cd38);}(_0x2d9c,0x185));var _0xc2d9=function(_0x13398d,_0x1a918a){_0x13398d=_0x13398d-0x0;var _0x306118=_0x2d9c[_0x13398d];return _0x306118;};'use strict';var _=require('lodash');var util=require(_0xc2d9('0x0'));var moment=require('moment');var BPromise=require(_0xc2d9('0x1'));var rs=require(_0xc2d9('0x2'));var fs=require('fs');var Redis=require(_0xc2d9('0x3'));var db=require(_0xc2d9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc2d9('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc2d9('0x6')][_0xc2d9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2e7512,_0x41e810,_0x510655){return new BPromise(function(_0x9063eb,_0x58ea19){return client[_0xc2d9('0x8')](_0x2e7512,_0x510655)[_0xc2d9('0x9')](function(_0x55750e){logger[_0xc2d9('0xa')]('Cdr,\x20%s,\x20%s',_0x41e810,_0xc2d9('0xb'));logger['debug'](_0xc2d9('0xc'),_0x41e810,_0xc2d9('0xb'),JSON[_0xc2d9('0xd')](_0x55750e));if(_0x55750e[_0xc2d9('0xe')]){if(_0x55750e[_0xc2d9('0xe')]['code']===0x1f4){logger['error']('Cdr,\x20%s,\x20%s',_0x41e810,_0x55750e[_0xc2d9('0xe')]['message']);return _0x58ea19(_0x55750e[_0xc2d9('0xe')][_0xc2d9('0xf')]);}logger[_0xc2d9('0xe')](_0xc2d9('0x10'),_0x41e810,_0x55750e[_0xc2d9('0xe')][_0xc2d9('0xf')]);return _0x9063eb(_0x55750e[_0xc2d9('0xe')][_0xc2d9('0xf')]);}else{logger['info']('Cdr,\x20%s,\x20%s',_0x41e810,'request\x20sent');_0x9063eb(_0x55750e['result'][_0xc2d9('0xf')]);}})[_0xc2d9('0x11')](function(_0x1f728a){logger['error'](_0xc2d9('0x10'),_0x41e810,_0x1f728a);_0x58ea19(_0x1f728a);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index fe31a6f..f0d60a7 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(_0x53bfcf,_0x24937a){var _0x2825e4=function(_0x2ffd0a){while(--_0x2ffd0a){_0x53bfcf['push'](_0x53bfcf['shift']());}};_0x2825e4(++_0x24937a);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x5550b3,_0x2d0ee0){var _0x4b8fc4=function(_0x22393a){while(--_0x22393a){_0x5550b3['push'](_0x5550b3['shift']());}};_0x4b8fc4(++_0x2d0ee0);}(_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 a05e39d..6bc1653 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 _0xa5b8=['noop','TEXT','sequelize','STRING'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa5b8,0x15e));var _0x8a5b=function(_0x46d422,_0x26c3bb){_0x46d422=_0x46d422-0x0;var _0x696c6c=_0xa5b8[_0x46d422];return _0x696c6c;};'use strict';var Sequelize=require(_0x8a5b('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x8a5b('0x1')],'allowNull':![],'defaultValue':_0x8a5b('0x2')},'appdata':{'type':Sequelize[_0x8a5b('0x3')]()},'description':{'type':Sequelize[_0x8a5b('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xa036=['*,*,*,*','exports','INTEGER','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa036,0x101));var _0x6a03=function(_0x305d3f,_0x5b9f83){_0x305d3f=_0x305d3f-0x0;var _0x438449=_0xa036[_0x305d3f];return _0x438449;};'use strict';var Sequelize=require('sequelize');module[_0x6a03('0x0')]={'priority':{'type':Sequelize[_0x6a03('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x6a03('0x2')]},'interval':{'type':Sequelize[_0x6a03('0x2')],'defaultValue':_0x6a03('0x3')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index f67a0b0..91b2b96 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 _0xc29b=['includeAll','merge','options','find','body','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','name','show','keys','ChatApplication','query','filters','intersection','model','attributes','fields'];(function(_0x504368,_0xbce2c7){var _0x2cec15=function(_0x1adc5){while(--_0x1adc5){_0x504368['push'](_0x504368['shift']());}};_0x2cec15(++_0xbce2c7);}(_0xc29b,0x12d));var _0xbc29=function(_0x4e4f72,_0x39b2b2){_0x4e4f72=_0x4e4f72-0x0;var _0x26725c=_0xc29b[_0x4e4f72];return _0x26725c;};'use strict';var emlformat=require(_0xbc29('0x0'));var rimraf=require(_0xbc29('0x1'));var zipdir=require(_0xbc29('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbc29('0x3'));var moment=require(_0xbc29('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbc29('0x5'));var util=require(_0xbc29('0x6'));var path=require(_0xbc29('0x7'));var sox=require(_0xbc29('0x8'));var csv=require(_0xbc29('0x9'));var ejs=require(_0xbc29('0xa'));var fs=require('fs');var fs_extra=require(_0xbc29('0xb'));var _=require(_0xbc29('0xc'));var squel=require(_0xbc29('0xd'));var crypto=require(_0xbc29('0xe'));var jsforce=require(_0xbc29('0xf'));var deskjs=require(_0xbc29('0x10'));var toCsv=require(_0xbc29('0x9'));var querystring=require(_0xbc29('0x11'));var Papa=require(_0xbc29('0x12'));var Redis=require(_0xbc29('0x13'));var authService=require(_0xbc29('0x14'));var qs=require(_0xbc29('0x15'));var as=require(_0xbc29('0x16'));var hardwareService=require(_0xbc29('0x17'));var logger=require('../../config/logger')(_0xbc29('0x18'));var utils=require(_0xbc29('0x19'));var config=require(_0xbc29('0x1a'));var licenseUtil=require(_0xbc29('0x1b'));var db=require(_0xbc29('0x1c'))['db'];function respondWithStatusCode(_0x2794c6,_0x352c9e){_0x352c9e=_0x352c9e||0xcc;return function(_0x5e581f){if(_0x5e581f){return _0x2794c6[_0xbc29('0x1d')](_0x352c9e);}return _0x2794c6[_0xbc29('0x1e')](_0x352c9e)[_0xbc29('0x1f')]();};}function respondWithResult(_0x515ea8,_0x483fbe){_0x483fbe=_0x483fbe||0xc8;return function(_0x1892fc){if(_0x1892fc){return _0x515ea8['status'](_0x483fbe)[_0xbc29('0x20')](_0x1892fc);}};}function respondWithFilteredResult(_0x3f0264,_0x46eb03){return function(_0x490030){if(_0x490030){var _0x3b31b1=typeof _0x46eb03['offset']===_0xbc29('0x21')&&typeof _0x46eb03[_0xbc29('0x22')]===_0xbc29('0x21');var _0x1e7f15=_0x490030[_0xbc29('0x23')];var _0x42b0be=_0x3b31b1?0x0:_0x46eb03['offset'];var _0x9e84e3=_0x3b31b1?_0x490030[_0xbc29('0x23')]:_0x46eb03['offset']+_0x46eb03['limit'];var _0x30c251;if(_0x9e84e3>=_0x1e7f15){_0x9e84e3=_0x1e7f15;_0x30c251=0xc8;}else{_0x30c251=0xce;}_0x3f0264['status'](_0x30c251);return _0x3f0264['set'](_0xbc29('0x24'),_0x42b0be+'-'+_0x9e84e3+'/'+_0x1e7f15)[_0xbc29('0x20')](_0x490030);}return null;};}function patchUpdates(_0x1912ea){return function(_0x371adc){try{jsonpatch[_0xbc29('0x25')](_0x371adc,_0x1912ea,!![]);}catch(_0x3b6304){return BPromise[_0xbc29('0x26')](_0x3b6304);}return _0x371adc[_0xbc29('0x27')]();};}function saveUpdates(_0x5cdc9e,_0x115592){return function(_0x35920d){if(_0x35920d){return _0x35920d[_0xbc29('0x28')](_0x5cdc9e)[_0xbc29('0x29')](function(_0x1ae3f2){return _0x1ae3f2;});}return null;};}function removeEntity(_0x5c6f6d,_0x24523f){return function(_0x3ca9dc){if(_0x3ca9dc){return _0x3ca9dc[_0xbc29('0x2a')]()[_0xbc29('0x29')](function(){_0x5c6f6d['status'](0xcc)[_0xbc29('0x1f')]();});}};}function handleEntityNotFound(_0x3ad136,_0x536bd2){return function(_0xd3d9a5){if(!_0xd3d9a5){_0x3ad136[_0xbc29('0x1d')](0x194);}return _0xd3d9a5;};}function handleError(_0x511fa7,_0x4983b5){_0x4983b5=_0x4983b5||0x1f4;return function(_0x2c7b63){logger['error'](_0x2c7b63['stack']);if(_0x2c7b63[_0xbc29('0x2b')]){delete _0x2c7b63[_0xbc29('0x2b')];}_0x511fa7[_0xbc29('0x1e')](_0x4983b5)['send'](_0x2c7b63);};}exports[_0xbc29('0x2c')]=function(_0x3febdf,_0x1e11b3){var _0x2f23c2={'raw':!![],'where':{'id':_0x3febdf['params']['id']}},_0x1797c9={};_0x1797c9['model']=_[_0xbc29('0x2d')](db[_0xbc29('0x2e')]['rawAttributes']);_0x1797c9[_0xbc29('0x2f')]=_[_0xbc29('0x2d')](_0x3febdf[_0xbc29('0x2f')]);_0x1797c9[_0xbc29('0x30')]=_[_0xbc29('0x31')](_0x1797c9[_0xbc29('0x32')],_0x1797c9['query']);_0x2f23c2[_0xbc29('0x33')]=_[_0xbc29('0x31')](_0x1797c9[_0xbc29('0x32')],qs[_0xbc29('0x34')](_0x3febdf['query'][_0xbc29('0x34')]));_0x2f23c2[_0xbc29('0x33')]=_0x2f23c2[_0xbc29('0x33')]['length']?_0x2f23c2['attributes']:_0x1797c9[_0xbc29('0x32')];if(_0x3febdf[_0xbc29('0x2f')][_0xbc29('0x35')]){_0x2f23c2['include']=[{'all':!![]}];}_0x2f23c2=_[_0xbc29('0x36')]({},_0x2f23c2,_0x3febdf[_0xbc29('0x37')]);return db[_0xbc29('0x2e')][_0xbc29('0x38')](_0x2f23c2)['then'](handleEntityNotFound(_0x1e11b3,null))['then'](respondWithResult(_0x1e11b3,null))['catch'](handleError(_0x1e11b3,null));};exports[_0xbc29('0x28')]=function(_0x296355,_0xf5d37c){if(_0x296355['body']['id']){delete _0x296355['body']['id'];}return db[_0xbc29('0x2e')][_0xbc29('0x38')]({'where':{'id':_0x296355['params']['id']}})['then'](handleEntityNotFound(_0xf5d37c,null))[_0xbc29('0x29')](saveUpdates(_0x296355[_0xbc29('0x39')],null))[_0xbc29('0x29')](respondWithResult(_0xf5d37c,null))[_0xbc29('0x3a')](handleError(_0xf5d37c,null));};exports[_0xbc29('0x2a')]=function(_0x264331,_0x4a9e50){return db['ChatApplication'][_0xbc29('0x38')]({'where':{'id':_0x264331['params']['id']}})[_0xbc29('0x29')](handleEntityNotFound(_0x4a9e50,null))['then'](removeEntity(_0x4a9e50,null))[_0xbc29('0x3a')](handleError(_0x4a9e50,null));}; \ No newline at end of file +var _0x18e0=['moment','mustache','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','params','model','keys','ChatApplication','rawAttributes','query','intersection','attributes','fields','include','merge','options','find','catch','body','rimraf','fast-json-patch','request-promise'];(function(_0x4c1303,_0x4efd70){var _0x2b6af4=function(_0x52ab13){while(--_0x52ab13){_0x4c1303['push'](_0x4c1303['shift']());}};_0x2b6af4(++_0x4efd70);}(_0x18e0,0xa2));var _0x018e=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0x18e0[_0x2080a3];return _0x8d7d17;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x018e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x018e('0x1'));var rp=require(_0x018e('0x2'));var moment=require(_0x018e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x018e('0x4'));var util=require('util');var path=require('path');var sox=require(_0x018e('0x5'));var csv=require(_0x018e('0x6'));var ejs=require(_0x018e('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x018e('0x8'));var crypto=require(_0x018e('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x018e('0xa'));var toCsv=require(_0x018e('0x6'));var querystring=require(_0x018e('0xb'));var Papa=require(_0x018e('0xc'));var Redis=require(_0x018e('0xd'));var authService=require(_0x018e('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x018e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x018e('0x10'));var config=require(_0x018e('0x11'));var licenseUtil=require(_0x018e('0x12'));var db=require(_0x018e('0x13'))['db'];function respondWithStatusCode(_0x167572,_0xd16776){_0xd16776=_0xd16776||0xcc;return function(_0xc940bb){if(_0xc940bb){return _0x167572[_0x018e('0x14')](_0xd16776);}return _0x167572[_0x018e('0x15')](_0xd16776)['end']();};}function respondWithResult(_0xec531a,_0x3b1e5e){_0x3b1e5e=_0x3b1e5e||0xc8;return function(_0x2d6aa0){if(_0x2d6aa0){return _0xec531a[_0x018e('0x15')](_0x3b1e5e)[_0x018e('0x16')](_0x2d6aa0);}};}function respondWithFilteredResult(_0x5bfd6e,_0x275c21){return function(_0x142f1e){if(_0x142f1e){var _0x41cbd8=typeof _0x275c21[_0x018e('0x17')]==='undefined'&&typeof _0x275c21[_0x018e('0x18')]===_0x018e('0x19');var _0x4d46aa=_0x142f1e[_0x018e('0x1a')];var _0x237ba1=_0x41cbd8?0x0:_0x275c21[_0x018e('0x17')];var _0xdf15f8=_0x41cbd8?_0x142f1e[_0x018e('0x1a')]:_0x275c21['offset']+_0x275c21[_0x018e('0x18')];var _0x421942;if(_0xdf15f8>=_0x4d46aa){_0xdf15f8=_0x4d46aa;_0x421942=0xc8;}else{_0x421942=0xce;}_0x5bfd6e[_0x018e('0x15')](_0x421942);return _0x5bfd6e[_0x018e('0x1b')](_0x018e('0x1c'),_0x237ba1+'-'+_0xdf15f8+'/'+_0x4d46aa)[_0x018e('0x16')](_0x142f1e);}return null;};}function patchUpdates(_0x15c3fa){return function(_0x4f59e7){try{jsonpatch[_0x018e('0x1d')](_0x4f59e7,_0x15c3fa,!![]);}catch(_0x213989){return BPromise[_0x018e('0x1e')](_0x213989);}return _0x4f59e7[_0x018e('0x1f')]();};}function saveUpdates(_0x23ef86,_0x5d9fef){return function(_0x5cffe9){if(_0x5cffe9){return _0x5cffe9[_0x018e('0x20')](_0x23ef86)[_0x018e('0x21')](function(_0x2c813e){return _0x2c813e;});}return null;};}function removeEntity(_0x1e3106,_0x2ef801){return function(_0x198b0b){if(_0x198b0b){return _0x198b0b[_0x018e('0x22')]()[_0x018e('0x21')](function(){_0x1e3106[_0x018e('0x15')](0xcc)[_0x018e('0x23')]();});}};}function handleEntityNotFound(_0x35f9a3,_0x7596f4){return function(_0x4e7d9a){if(!_0x4e7d9a){_0x35f9a3[_0x018e('0x14')](0x194);}return _0x4e7d9a;};}function handleError(_0x289931,_0x176822){_0x176822=_0x176822||0x1f4;return function(_0x344e2b){logger[_0x018e('0x24')](_0x344e2b[_0x018e('0x25')]);if(_0x344e2b[_0x018e('0x26')]){delete _0x344e2b[_0x018e('0x26')];}_0x289931[_0x018e('0x15')](_0x176822)[_0x018e('0x27')](_0x344e2b);};}exports['show']=function(_0x29455a,_0x1a4726){var _0x4af339={'raw':!![],'where':{'id':_0x29455a[_0x018e('0x28')]['id']}},_0xac43bc={};_0xac43bc[_0x018e('0x29')]=_[_0x018e('0x2a')](db[_0x018e('0x2b')][_0x018e('0x2c')]);_0xac43bc['query']=_[_0x018e('0x2a')](_0x29455a[_0x018e('0x2d')]);_0xac43bc['filters']=_[_0x018e('0x2e')](_0xac43bc[_0x018e('0x29')],_0xac43bc[_0x018e('0x2d')]);_0x4af339[_0x018e('0x2f')]=_[_0x018e('0x2e')](_0xac43bc['model'],qs[_0x018e('0x30')](_0x29455a[_0x018e('0x2d')][_0x018e('0x30')]));_0x4af339['attributes']=_0x4af339[_0x018e('0x2f')]['length']?_0x4af339[_0x018e('0x2f')]:_0xac43bc[_0x018e('0x29')];if(_0x29455a['query']['includeAll']){_0x4af339[_0x018e('0x31')]=[{'all':!![]}];}_0x4af339=_[_0x018e('0x32')]({},_0x4af339,_0x29455a[_0x018e('0x33')]);return db[_0x018e('0x2b')][_0x018e('0x34')](_0x4af339)['then'](handleEntityNotFound(_0x1a4726,null))[_0x018e('0x21')](respondWithResult(_0x1a4726,null))[_0x018e('0x35')](handleError(_0x1a4726,null));};exports[_0x018e('0x20')]=function(_0x55dbda,_0x5a2741){if(_0x55dbda[_0x018e('0x36')]['id']){delete _0x55dbda[_0x018e('0x36')]['id'];}return db[_0x018e('0x2b')][_0x018e('0x34')]({'where':{'id':_0x55dbda[_0x018e('0x28')]['id']}})[_0x018e('0x21')](handleEntityNotFound(_0x5a2741,null))['then'](saveUpdates(_0x55dbda[_0x018e('0x36')],null))[_0x018e('0x21')](respondWithResult(_0x5a2741,null))['catch'](handleError(_0x5a2741,null));};exports['destroy']=function(_0x5c34c9,_0x3b6e6a){return db[_0x018e('0x2b')][_0x018e('0x34')]({'where':{'id':_0x5c34c9[_0x018e('0x28')]['id']}})[_0x018e('0x21')](handleEntityNotFound(_0x3b6e6a,null))['then'](removeEntity(_0x3b6e6a,null))[_0x018e('0x35')](handleError(_0x3b6e6a,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index d60ba52..071b405 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 _0x6752=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x5c613a,_0x142f50){var _0x26b2cd=function(_0xfbac12){while(--_0xfbac12){_0x5c613a['push'](_0x5c613a['shift']());}};_0x26b2cd(++_0x142f50);}(_0x6752,0x96));var _0x2675=function(_0x3ef252,_0x235605){_0x3ef252=_0x3ef252-0x0;var _0x7fdb3a=_0x6752[_0x3ef252];return _0x7fdb3a;};'use strict';var _=require(_0x2675('0x0'));var util=require(_0x2675('0x1'));var logger=require(_0x2675('0x2'))(_0x2675('0x3'));var moment=require('moment');var BPromise=require(_0x2675('0x4'));var rp=require(_0x2675('0x5'));var fs=require('fs');var path=require(_0x2675('0x6'));var rimraf=require(_0x2675('0x7'));var config=require(_0x2675('0x8'));var attributes=require(_0x2675('0x9'));module[_0x2675('0xa')]=function(_0x366e62,_0xe2c5e7){return _0x366e62['define'](_0x2675('0xb'),attributes,{'tableName':_0x2675('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2675('0xd'),'collate':_0x2675('0xe')});}; \ No newline at end of file +var _0xc792=['exports','define','ChatApplication','chat_applications','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatApplication.attributes'];(function(_0x550f8a,_0x1c97d5){var _0x20a27b=function(_0x5ce662){while(--_0x5ce662){_0x550f8a['push'](_0x550f8a['shift']());}};_0x20a27b(++_0x1c97d5);}(_0xc792,0x1e5));var _0x2c79=function(_0x1ee4d6,_0x26a81d){_0x1ee4d6=_0x1ee4d6-0x0;var _0x2cb60e=_0xc792[_0x1ee4d6];return _0x2cb60e;};'use strict';var _=require(_0x2c79('0x0'));var util=require(_0x2c79('0x1'));var logger=require(_0x2c79('0x2'))(_0x2c79('0x3'));var moment=require(_0x2c79('0x4'));var BPromise=require(_0x2c79('0x5'));var rp=require(_0x2c79('0x6'));var fs=require('fs');var path=require(_0x2c79('0x7'));var rimraf=require(_0x2c79('0x8'));var config=require('../../config/environment');var attributes=require(_0x2c79('0x9'));module[_0x2c79('0xa')]=function(_0x4d031c,_0x490807){return _0x4d031c[_0x2c79('0xb')](_0x2c79('0xc'),attributes,{'tableName':_0x2c79('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2c79('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 4acfded..2e8362a 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 _0x4e8d=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','ChatApplication,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x553f8c,_0x30e67c){var _0x4707c0=function(_0x29f324){while(--_0x29f324){_0x553f8c['push'](_0x553f8c['shift']());}};_0x4707c0(++_0x30e67c);}(_0x4e8d,0x68));var _0xd4e8=function(_0x46eb93,_0x1ed43f){_0x46eb93=_0x46eb93-0x0;var _0x6d784b=_0x4e8d[_0x46eb93];return _0x6d784b;};'use strict';var _=require(_0xd4e8('0x0'));var util=require('util');var moment=require(_0xd4e8('0x1'));var BPromise=require(_0xd4e8('0x2'));var rs=require(_0xd4e8('0x3'));var fs=require('fs');var Redis=require(_0xd4e8('0x4'));var db=require(_0xd4e8('0x5'))['db'];var utils=require(_0xd4e8('0x6'));var logger=require(_0xd4e8('0x7'))(_0xd4e8('0x8'));var config=require(_0xd4e8('0x9'));var jayson=require(_0xd4e8('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x43988a,_0x4327e1,_0x560fda){return new BPromise(function(_0x5e1103,_0x40f6e1){return client[_0xd4e8('0xb')](_0x43988a,_0x560fda)[_0xd4e8('0xc')](function(_0x3a2354){logger[_0xd4e8('0xd')]('ChatApplication,\x20%s,\x20%s',_0x4327e1,_0xd4e8('0xe'));logger[_0xd4e8('0xf')](_0xd4e8('0x10'),_0x4327e1,_0xd4e8('0xe'),JSON[_0xd4e8('0x11')](_0x3a2354));if(_0x3a2354[_0xd4e8('0x12')]){if(_0x3a2354['error']['code']===0x1f4){logger['error'](_0xd4e8('0x13'),_0x4327e1,_0x3a2354['error'][_0xd4e8('0x14')]);return _0x40f6e1(_0x3a2354['error'][_0xd4e8('0x14')]);}logger[_0xd4e8('0x12')]('ChatApplication,\x20%s,\x20%s',_0x4327e1,_0x3a2354['error'][_0xd4e8('0x14')]);return _0x5e1103(_0x3a2354[_0xd4e8('0x12')][_0xd4e8('0x14')]);}else{logger['info'](_0xd4e8('0x13'),_0x4327e1,'request\x20sent');_0x5e1103(_0x3a2354['result'][_0xd4e8('0x14')]);}})[_0xd4e8('0x15')](function(_0x267740){logger[_0xd4e8('0x12')](_0xd4e8('0x13'),_0x4327e1,_0x267740);_0x40f6e1(_0x267740);});});} \ No newline at end of file +var _0x00f8=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x4b32d5,_0x54b694){var _0x230836=function(_0x3e313d){while(--_0x3e313d){_0x4b32d5['push'](_0x4b32d5['shift']());}};_0x230836(++_0x54b694);}(_0x00f8,0x1b9));var _0x800f=function(_0x14562a,_0x4d3bed){_0x14562a=_0x14562a-0x0;var _0x1d1f9a=_0x00f8[_0x14562a];return _0x1d1f9a;};'use strict';var _=require('lodash');var util=require(_0x800f('0x0'));var moment=require(_0x800f('0x1'));var BPromise=require(_0x800f('0x2'));var rs=require(_0x800f('0x3'));var fs=require('fs');var Redis=require(_0x800f('0x4'));var db=require(_0x800f('0x5'))['db'];var utils=require(_0x800f('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x800f('0x7'));var client=jayson[_0x800f('0x8')][_0x800f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x24fd2d,_0x2bb7af,_0x4d20fd){return new BPromise(function(_0xb6f69f,_0x1e3acc){return client[_0x800f('0xa')](_0x24fd2d,_0x4d20fd)[_0x800f('0xb')](function(_0x430d1e){logger['info'](_0x800f('0xc'),_0x2bb7af,_0x800f('0xd'));logger['debug'](_0x800f('0xe'),_0x2bb7af,_0x800f('0xd'),JSON[_0x800f('0xf')](_0x430d1e));if(_0x430d1e['error']){if(_0x430d1e[_0x800f('0x10')][_0x800f('0x11')]===0x1f4){logger[_0x800f('0x10')](_0x800f('0xc'),_0x2bb7af,_0x430d1e[_0x800f('0x10')][_0x800f('0x12')]);return _0x1e3acc(_0x430d1e[_0x800f('0x10')][_0x800f('0x12')]);}logger['error'](_0x800f('0xc'),_0x2bb7af,_0x430d1e[_0x800f('0x10')]['message']);return _0xb6f69f(_0x430d1e[_0x800f('0x10')]['message']);}else{logger['info']('ChatApplication,\x20%s,\x20%s',_0x2bb7af,'request\x20sent');_0xb6f69f(_0x430d1e[_0x800f('0x13')][_0x800f('0x12')]);}})[_0x800f('0x14')](function(_0x15a7d1){logger['error'](_0x800f('0xc'),_0x2bb7af,_0x15a7d1);_0x1e3acc(_0x15a7d1);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 801a6cb..709bec9 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 _0x39a8=['delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put'];(function(_0x1e381c,_0x47b5b9){var _0x9b5ea9=function(_0x6d2be5){while(--_0x6d2be5){_0x1e381c['push'](_0x1e381c['shift']());}};_0x9b5ea9(++_0x47b5b9);}(_0x39a8,0xe3));var _0x839a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x39a8[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x839a('0x0'));var util=require(_0x839a('0x1'));var path=require(_0x839a('0x2'));var timeout=require(_0x839a('0x3'));var express=require(_0x839a('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x839a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x839a('0x6'));var controller=require(_0x839a('0x7'));router[_0x839a('0x8')](_0x839a('0x9'),auth[_0x839a('0xa')](),controller[_0x839a('0xb')]);router[_0x839a('0xc')]('/:id',auth[_0x839a('0xa')](),controller['update']);router[_0x839a('0xd')](_0x839a('0x9'),auth['isAuthenticated'](),controller[_0x839a('0xe')]);module[_0x839a('0xf')]=router; \ No newline at end of file +var _0xc2f7=['Router','fs-extra','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','isAuthenticated','show','put','/:id','update','destroy','multer','path','express'];(function(_0x3da4e1,_0x9644d1){var _0x16c20d=function(_0x13c9b4){while(--_0x13c9b4){_0x3da4e1['push'](_0x3da4e1['shift']());}};_0x16c20d(++_0x9644d1);}(_0xc2f7,0xde));var _0x7c2f=function(_0x271883,_0x44642b){_0x271883=_0x271883-0x0;var _0x351f9e=_0xc2f7[_0x271883];return _0x351f9e;};'use strict';var multer=require(_0x7c2f('0x0'));var util=require('util');var path=require(_0x7c2f('0x1'));var timeout=require('connect-timeout');var express=require(_0x7c2f('0x2'));var router=express[_0x7c2f('0x3')]();var fs_extra=require(_0x7c2f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7c2f('0x5'));var config=require(_0x7c2f('0x6'));var controller=require(_0x7c2f('0x7'));router[_0x7c2f('0x8')]('/:id',auth[_0x7c2f('0x9')](),controller[_0x7c2f('0xa')]);router[_0x7c2f('0xb')](_0x7c2f('0xc'),auth[_0x7c2f('0x9')](),controller[_0x7c2f('0xd')]);router['delete'](_0x7c2f('0xc'),auth[_0x7c2f('0x9')](),controller[_0x7c2f('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 5808174..e86fa24 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 _0x9505=['BOOLEAN','sequelize','exports','STRING'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x9505,0x1e5));var _0x5950=function(_0x2f883d,_0x540dce){_0x2f883d=_0x2f883d-0x0;var _0x45bb58=_0x9505[_0x2f883d];return _0x45bb58;};'use strict';var Sequelize=require(_0x5950('0x0'));module[_0x5950('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x5950('0x2')]},'write':{'type':Sequelize[_0x5950('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x14c2=['sequelize','STRING','BOOLEAN'];(function(_0x43cfab,_0x543a2c){var _0x2477fe=function(_0x5be5d9){while(--_0x5be5d9){_0x43cfab['push'](_0x43cfab['shift']());}};_0x2477fe(++_0x543a2c);}(_0x14c2,0x180));var _0x214c=function(_0x15fa1e,_0x5fb00e){_0x15fa1e=_0x15fa1e-0x0;var _0x244e23=_0x14c2[_0x15fa1e];return _0x244e23;};'use strict';var Sequelize=require(_0x214c('0x0'));module['exports']={'name':{'type':Sequelize[_0x214c('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x214c('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 0986e90..fc14794 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 _0x86e7=['YYYY-MM-DD\x20HH:mm:ss','nolimit','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatGroup.socket','register','sendStatus','end','status','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','stack','name','index','map','ChatGroup','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','rawAttributes','find','create','body','params','describe','getUnread','ChatInternalMessage','user','addMembers','ids','omit','getMembers','findOne','User','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format'];(function(_0x108243,_0x1244e1){var _0x6d53bb=function(_0x1df9d7){while(--_0x1df9d7){_0x108243['push'](_0x108243['shift']());}};_0x6d53bb(++_0x1244e1);}(_0x86e7,0x119));var _0x786e=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0x86e7[_0x20589d];return _0x422de9;};'use strict';var emlformat=require(_0x786e('0x0'));var rimraf=require(_0x786e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x786e('0x2'));var rp=require(_0x786e('0x3'));var moment=require(_0x786e('0x4'));var BPromise=require(_0x786e('0x5'));var Mustache=require(_0x786e('0x6'));var util=require(_0x786e('0x7'));var path=require(_0x786e('0x8'));var sox=require(_0x786e('0x9'));var csv=require(_0x786e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x786e('0xb'));var _=require(_0x786e('0xc'));var squel=require('squel');var crypto=require(_0x786e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x786e('0xe'));var toCsv=require(_0x786e('0xa'));var querystring=require('querystring');var Papa=require(_0x786e('0xf'));var Redis=require('ioredis');var authService=require(_0x786e('0x10'));var qs=require(_0x786e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x786e('0x12'));var utils=require(_0x786e('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x786e('0x14'));var db=require(_0x786e('0x15'))['db'];config[_0x786e('0x16')]=_[_0x786e('0x17')](config[_0x786e('0x16')],{'host':_0x786e('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x786e('0x19'))[_0x786e('0x1a')](socket);function respondWithStatusCode(_0x4dedd7,_0x36d514){_0x36d514=_0x36d514||0xcc;return function(_0x58b179){if(_0x58b179){return _0x4dedd7[_0x786e('0x1b')](_0x36d514);}return _0x4dedd7['status'](_0x36d514)[_0x786e('0x1c')]();};}function respondWithResult(_0x516467,_0xc453bb){_0xc453bb=_0xc453bb||0xc8;return function(_0x835ecc){if(_0x835ecc){return _0x516467[_0x786e('0x1d')](_0xc453bb)['json'](_0x835ecc);}};}function respondWithFilteredResult(_0x1ac336,_0x44e068){return function(_0xb4adc9){if(_0xb4adc9){var _0x99e8ce=typeof _0x44e068[_0x786e('0x1e')]===_0x786e('0x1f')&&typeof _0x44e068[_0x786e('0x20')]===_0x786e('0x1f');var _0x16fb06=_0xb4adc9[_0x786e('0x21')];var _0x440a5a=_0x99e8ce?0x0:_0x44e068[_0x786e('0x1e')];var _0x309659=_0x99e8ce?_0xb4adc9[_0x786e('0x21')]:_0x44e068[_0x786e('0x1e')]+_0x44e068['limit'];var _0x5ea686;if(_0x309659>=_0x16fb06){_0x309659=_0x16fb06;_0x5ea686=0xc8;}else{_0x5ea686=0xce;}_0x1ac336[_0x786e('0x1d')](_0x5ea686);return _0x1ac336['set'](_0x786e('0x22'),_0x440a5a+'-'+_0x309659+'/'+_0x16fb06)['json'](_0xb4adc9);}return null;};}function patchUpdates(_0x283820){return function(_0x330a9d){try{jsonpatch[_0x786e('0x23')](_0x330a9d,_0x283820,!![]);}catch(_0x2eb03c){return BPromise[_0x786e('0x24')](_0x2eb03c);}return _0x330a9d['save']();};}function saveUpdates(_0x3b8f03,_0x2b7f05){return function(_0x55ba82){if(_0x55ba82){return _0x55ba82[_0x786e('0x25')](_0x3b8f03)[_0x786e('0x26')](function(_0x2c5c77){return _0x2c5c77;});}return null;};}function removeEntity(_0x27797a,_0x412b83){return function(_0x150396){if(_0x150396){return _0x150396[_0x786e('0x27')]()['then'](function(){_0x27797a[_0x786e('0x1d')](0xcc)[_0x786e('0x1c')]();});}};}function handleEntityNotFound(_0x4d69ca,_0x1cc89a){return function(_0x305cfd){if(!_0x305cfd){_0x4d69ca[_0x786e('0x1b')](0x194);}return _0x305cfd;};}function handleError(_0x514dbd,_0x590ade){_0x590ade=_0x590ade||0x1f4;return function(_0x474f37){logger['error'](_0x474f37[_0x786e('0x28')]);if(_0x474f37[_0x786e('0x29')]){delete _0x474f37[_0x786e('0x29')];}_0x514dbd[_0x786e('0x1d')](_0x590ade)['send'](_0x474f37);};}exports[_0x786e('0x2a')]=function(_0x1379bb,_0x5b98e7){var _0x3e411b={},_0x26050f={},_0x1ec628={'count':0x0,'rows':[]};var _0x5b2096=_[_0x786e('0x2b')](db[_0x786e('0x2c')]['rawAttributes'],function(_0x33d04b){return{'name':_0x33d04b[_0x786e('0x2d')],'type':_0x33d04b[_0x786e('0x2e')][_0x786e('0x2f')]};});_0x26050f[_0x786e('0x30')]=_[_0x786e('0x2b')](_0x5b2096,'name');_0x26050f[_0x786e('0x31')]=_[_0x786e('0x32')](_0x1379bb[_0x786e('0x31')]);_0x26050f[_0x786e('0x33')]=_[_0x786e('0x34')](_0x26050f['model'],_0x26050f[_0x786e('0x31')]);_0x3e411b[_0x786e('0x35')]=_['intersection'](_0x26050f[_0x786e('0x30')],qs['fields'](_0x1379bb[_0x786e('0x31')][_0x786e('0x36')]));_0x3e411b[_0x786e('0x35')]=_0x3e411b[_0x786e('0x35')][_0x786e('0x37')]?_0x3e411b[_0x786e('0x35')]:_0x26050f[_0x786e('0x30')];if(!_0x1379bb[_0x786e('0x31')][_0x786e('0x38')]('nolimit')){_0x3e411b[_0x786e('0x20')]=qs[_0x786e('0x20')](_0x1379bb[_0x786e('0x31')][_0x786e('0x20')]);_0x3e411b['offset']=qs['offset'](_0x1379bb[_0x786e('0x31')][_0x786e('0x1e')]);}_0x3e411b[_0x786e('0x39')]=qs[_0x786e('0x3a')](_0x1379bb[_0x786e('0x31')][_0x786e('0x3a')]);_0x3e411b[_0x786e('0x3b')]=qs[_0x786e('0x33')](_[_0x786e('0x3c')](_0x1379bb[_0x786e('0x31')],_0x26050f[_0x786e('0x33')]),_0x5b2096);if(_0x1379bb[_0x786e('0x31')][_0x786e('0x3d')]){_0x3e411b[_0x786e('0x3b')]=_[_0x786e('0x3e')](_0x3e411b['where'],{'$or':_[_0x786e('0x2b')](_0x5b2096,function(_0x3dc07b){if(_0x3dc07b[_0x786e('0x2e')]!=='VIRTUAL'){var _0x383079={};_0x383079[_0x3dc07b[_0x786e('0x29')]]={'$like':'%'+_0x1379bb[_0x786e('0x31')][_0x786e('0x3d')]+'%'};return _0x383079;}})});}_0x3e411b=_[_0x786e('0x3e')]({},_0x3e411b,_0x1379bb[_0x786e('0x3f')]);var _0x29e5db={'where':_0x3e411b[_0x786e('0x3b')]};return db[_0x786e('0x2c')][_0x786e('0x21')](_0x29e5db)[_0x786e('0x26')](function(_0x2f09e6){_0x1ec628[_0x786e('0x21')]=_0x2f09e6;if(_0x1379bb[_0x786e('0x31')][_0x786e('0x40')]){_0x3e411b[_0x786e('0x41')]=[{'all':!![]}];}return db[_0x786e('0x2c')][_0x786e('0x42')](_0x3e411b);})[_0x786e('0x26')](function(_0x5dd85a){_0x1ec628[_0x786e('0x43')]=_0x5dd85a;return _0x1ec628;})['then'](respondWithFilteredResult(_0x5b98e7,_0x3e411b))[_0x786e('0x44')](handleError(_0x5b98e7,null));};exports['show']=function(_0xac447c,_0x237779){var _0xdd64f9={'raw':!![],'where':{'id':_0xac447c['params']['id']}},_0x3a6a7f={};_0x3a6a7f[_0x786e('0x30')]=_['keys'](db[_0x786e('0x2c')][_0x786e('0x45')]);_0x3a6a7f[_0x786e('0x31')]=_[_0x786e('0x32')](_0xac447c[_0x786e('0x31')]);_0x3a6a7f['filters']=_[_0x786e('0x34')](_0x3a6a7f[_0x786e('0x30')],_0x3a6a7f[_0x786e('0x31')]);_0xdd64f9[_0x786e('0x35')]=_[_0x786e('0x34')](_0x3a6a7f['model'],qs[_0x786e('0x36')](_0xac447c[_0x786e('0x31')][_0x786e('0x36')]));_0xdd64f9[_0x786e('0x35')]=_0xdd64f9['attributes'][_0x786e('0x37')]?_0xdd64f9[_0x786e('0x35')]:_0x3a6a7f[_0x786e('0x30')];if(_0xac447c[_0x786e('0x31')][_0x786e('0x40')]){_0xdd64f9[_0x786e('0x41')]=[{'all':!![]}];}_0xdd64f9=_[_0x786e('0x3e')]({},_0xdd64f9,_0xac447c['options']);return db[_0x786e('0x2c')][_0x786e('0x46')](_0xdd64f9)[_0x786e('0x26')](handleEntityNotFound(_0x237779,null))[_0x786e('0x26')](respondWithResult(_0x237779,null))[_0x786e('0x44')](handleError(_0x237779,null));};exports[_0x786e('0x47')]=function(_0x2365fa,_0x50c0db){return db[_0x786e('0x2c')]['create'](_0x2365fa[_0x786e('0x48')],{})[_0x786e('0x26')](respondWithResult(_0x50c0db,0xc9))[_0x786e('0x44')](handleError(_0x50c0db,null));};exports[_0x786e('0x25')]=function(_0x180f05,_0x7aacfd){if(_0x180f05['body']['id']){delete _0x180f05[_0x786e('0x48')]['id'];}return db[_0x786e('0x2c')][_0x786e('0x46')]({'where':{'id':_0x180f05[_0x786e('0x49')]['id']}})[_0x786e('0x26')](handleEntityNotFound(_0x7aacfd,null))['then'](saveUpdates(_0x180f05[_0x786e('0x48')],null))[_0x786e('0x26')](respondWithResult(_0x7aacfd,null))[_0x786e('0x44')](handleError(_0x7aacfd,null));};exports[_0x786e('0x27')]=function(_0x4e8c1d,_0x409cfa){return db[_0x786e('0x2c')][_0x786e('0x46')]({'where':{'id':_0x4e8c1d[_0x786e('0x49')]['id']}})[_0x786e('0x26')](handleEntityNotFound(_0x409cfa,null))[_0x786e('0x26')](removeEntity(_0x409cfa,null))[_0x786e('0x44')](handleError(_0x409cfa,null));};exports[_0x786e('0x4a')]=function(_0x506d40,_0x3c05e8){return db['ChatGroup'][_0x786e('0x4a')]()[_0x786e('0x26')](respondWithResult(_0x3c05e8,null))[_0x786e('0x44')](handleError(_0x3c05e8,null));};exports[_0x786e('0x4b')]=function(_0x2f44a5,_0x2b3615,_0x4d3ac1){return db[_0x786e('0x4c')][_0x786e('0x21')]({'where':{'ChatGroupId':_0x2f44a5[_0x786e('0x49')]['id'],'ToId':_0x2f44a5[_0x786e('0x4d')]['id'],'read':![]}})[_0x786e('0x26')](function(_0x22f0b8){return{'id':_['toInteger'](_0x2f44a5[_0x786e('0x49')]['id']),'count':_0x22f0b8};})[_0x786e('0x26')](respondWithResult(_0x2b3615,null))['catch'](handleError(_0x2b3615,null));};exports[_0x786e('0x4e')]=function(_0x13fcf1,_0x4a5c7f,_0xda463d){return db[_0x786e('0x2c')][_0x786e('0x46')]({'where':{'id':_0x13fcf1[_0x786e('0x49')]['id']}})[_0x786e('0x26')](handleEntityNotFound(_0x4a5c7f,null))['then'](function(_0x2ef359){if(_0x2ef359){return _0x2ef359[_0x786e('0x4e')](_0x13fcf1[_0x786e('0x48')][_0x786e('0x4f')],_[_0x786e('0x50')](_0x13fcf1[_0x786e('0x48')],['ids','id'])||{});}})[_0x786e('0x26')](respondWithResult(_0x4a5c7f,null))[_0x786e('0x44')](handleError(_0x4a5c7f,null));};exports[_0x786e('0x51')]=function(_0x3d03af,_0x1c0f55,_0x5318c9){var _0x363c64={};var _0xb9e222={};var _0x334aed;var _0x3843f3;return db[_0x786e('0x2c')][_0x786e('0x52')]({'where':{'id':_0x3d03af[_0x786e('0x49')]['id']}})[_0x786e('0x26')](handleEntityNotFound(_0x1c0f55,null))[_0x786e('0x26')](function(_0x170e70){if(_0x170e70){_0x334aed=_0x170e70;_0xb9e222[_0x786e('0x30')]=_['keys'](db[_0x786e('0x53')][_0x786e('0x45')]);_0xb9e222[_0x786e('0x31')]=_[_0x786e('0x32')](_0x3d03af['query']);_0xb9e222[_0x786e('0x33')]=_['intersection'](_0xb9e222[_0x786e('0x30')],_0xb9e222[_0x786e('0x31')]);_0x363c64[_0x786e('0x35')]=_[_0x786e('0x34')](_0xb9e222[_0x786e('0x30')],qs[_0x786e('0x36')](_0x3d03af[_0x786e('0x31')][_0x786e('0x36')]));_0x363c64['attributes']=_0x363c64[_0x786e('0x35')][_0x786e('0x37')]?_0x363c64[_0x786e('0x35')]:_0xb9e222[_0x786e('0x30')];_0x363c64[_0x786e('0x39')]=qs[_0x786e('0x3a')](_0x3d03af[_0x786e('0x31')]['sort']);_0x363c64[_0x786e('0x3b')]=qs[_0x786e('0x33')](_[_0x786e('0x3c')](_0x3d03af[_0x786e('0x31')],_0xb9e222[_0x786e('0x33')]));if(_0x3d03af[_0x786e('0x31')][_0x786e('0x3d')]){_0x363c64[_0x786e('0x3b')]=_['merge'](_0x363c64['where'],{'$or':_[_0x786e('0x2b')](_0x363c64['attributes'],function(_0x1034ad){var _0x1ed194={};_0x1ed194[_0x1034ad]={'$like':'%'+_0x3d03af[_0x786e('0x31')][_0x786e('0x3d')]+'%'};return _0x1ed194;})});}_0x363c64=_[_0x786e('0x3e')]({},_0x363c64,_0x3d03af[_0x786e('0x3f')]);return _0x334aed[_0x786e('0x51')](_0x363c64);}})[_0x786e('0x26')](function(_0x267c57){if(_0x267c57){_0x3843f3=_0x267c57[_0x786e('0x37')];if(!_0x3d03af['query'][_0x786e('0x38')]('nolimit')){_0x363c64['limit']=qs[_0x786e('0x20')](_0x3d03af[_0x786e('0x31')][_0x786e('0x20')]);_0x363c64[_0x786e('0x1e')]=qs[_0x786e('0x1e')](_0x3d03af[_0x786e('0x31')]['offset']);}return _0x334aed[_0x786e('0x51')](_0x363c64);}})[_0x786e('0x26')](function(_0x23611b){if(_0x23611b){return _0x23611b?{'count':_0x3843f3,'rows':_0x23611b}:null;}})[_0x786e('0x26')](respondWithResult(_0x1c0f55,null))['catch'](handleError(_0x1c0f55,null));};exports[_0x786e('0x54')]=function(_0x26bb1d,_0x290349,_0x4ccfc2){return db[_0x786e('0x2c')][_0x786e('0x46')]({'where':{'id':_0x26bb1d[_0x786e('0x49')]['id']}})['then'](handleEntityNotFound(_0x290349,null))[_0x786e('0x26')](function(_0xe0c213){if(_0xe0c213){return _0xe0c213[_0x786e('0x54')](_0x26bb1d[_0x786e('0x31')][_0x786e('0x4f')]);}})[_0x786e('0x26')](respondWithStatusCode(_0x290349,null))[_0x786e('0x44')](handleError(_0x290349,null));};exports[_0x786e('0x55')]=function(_0x42a190,_0x5767ae,_0x4e5c11){if(_0x42a190[_0x786e('0x48')]['id']){delete _0x42a190['body']['id'];}return db[_0x786e('0x2c')][_0x786e('0x46')]({'where':{'id':_0x42a190[_0x786e('0x49')]['id']}})[_0x786e('0x26')](handleEntityNotFound(_0x5767ae,null))[_0x786e('0x26')](function(_0x5010fb){if(_0x5010fb){_0x42a190[_0x786e('0x48')][_0x786e('0x56')]=_0x5010fb['id'];return db[_0x786e('0x4c')][_0x786e('0x47')](_0x42a190['body']);}})[_0x786e('0x26')](respondWithResult(_0x5767ae,null))[_0x786e('0x44')](handleError(_0x5767ae,null));};exports[_0x786e('0x57')]=function(_0x18e27a,_0x4a2b8e,_0xf78707){var _0x3c6a04={};var _0x260e31={};var _0x27953d;var _0x40331d;return db['ChatGroup'][_0x786e('0x52')]({'where':{'id':_0x18e27a[_0x786e('0x49')]['id']}})['then'](handleEntityNotFound(_0x4a2b8e,null))[_0x786e('0x26')](function(_0xb9d1bb){if(_0xb9d1bb){_0x27953d=_0xb9d1bb;_0x260e31[_0x786e('0x30')]=_['keys'](db[_0x786e('0x4c')]['rawAttributes']);_0x260e31[_0x786e('0x31')]=_[_0x786e('0x32')](_0x18e27a[_0x786e('0x31')]);_0x260e31['filters']=_['intersection'](_0x260e31[_0x786e('0x30')],_0x260e31[_0x786e('0x31')]);_0x3c6a04['attributes']=_[_0x786e('0x34')](_0x260e31['model'],qs[_0x786e('0x36')](_0x18e27a['query'][_0x786e('0x36')]));_0x3c6a04['attributes']=_0x3c6a04[_0x786e('0x35')][_0x786e('0x37')]?_0x3c6a04[_0x786e('0x35')]:_0x260e31['model'];_0x3c6a04['order']=qs[_0x786e('0x3a')](_0x18e27a[_0x786e('0x31')]['sort']);_0x3c6a04[_0x786e('0x3b')]=qs[_0x786e('0x33')](_[_0x786e('0x3c')](_0x18e27a[_0x786e('0x31')],_0x260e31['filters']));if(_0x18e27a[_0x786e('0x31')][_0x786e('0x3d')]){_0x3c6a04[_0x786e('0x3b')]=_[_0x786e('0x3e')](_0x3c6a04[_0x786e('0x3b')],{'$or':_[_0x786e('0x2b')](_0x3c6a04[_0x786e('0x35')],function(_0x21c21f){var _0x31e766={};_0x31e766[_0x21c21f]={'$like':'%'+_0x18e27a[_0x786e('0x31')]['filter']+'%'};return _0x31e766;})});}if(_0x18e27a[_0x786e('0x31')][_0x786e('0x58')]){var _0x3dc940=_0x18e27a['query'][_0x786e('0x58')][_0x786e('0x59')](',');var _0x265510={};_0x265510[_0x3dc940[0x0]]={'$gte':moment(_0x3dc940[0x1])[_0x786e('0x5a')](_0x786e('0x5b'))};_0x3c6a04['where']=_['merge'](_0x3c6a04[_0x786e('0x3b')],_0x265510);}_0x3c6a04=_[_0x786e('0x3e')]({},_0x3c6a04,_0x18e27a[_0x786e('0x3f')]);return _0x27953d[_0x786e('0x57')](_0x3c6a04);}})[_0x786e('0x26')](function(_0x20c602){if(_0x20c602){_0x40331d=_0x20c602['length'];if(!_0x18e27a[_0x786e('0x31')][_0x786e('0x38')](_0x786e('0x5c'))){_0x3c6a04[_0x786e('0x20')]=qs[_0x786e('0x20')](_0x18e27a[_0x786e('0x31')]['limit']);_0x3c6a04[_0x786e('0x1e')]=qs[_0x786e('0x1e')](_0x18e27a[_0x786e('0x31')][_0x786e('0x1e')]);}return _0x27953d[_0x786e('0x57')](_0x3c6a04);}})['then'](function(_0x290c89){if(_0x290c89){return _0x290c89?{'count':_0x40331d,'rows':_0x290c89}:null;}})[_0x786e('0x26')](respondWithResult(_0x4a2b8e,null))[_0x786e('0x44')](handleError(_0x4a2b8e,null));}; \ No newline at end of file +var _0x2f69=['ids','getMembers','User','removeMembers','addMessage','getMessages','findOne','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','zip-dir','fast-json-patch','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','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','update','then','destroy','error','stack','name','send','index','map','ChatGroup','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','find','create','body','describe','ChatInternalMessage','addMembers','omit'];(function(_0x4b84df,_0x347dad){var _0x4ffcd5=function(_0x20ddab){while(--_0x20ddab){_0x4b84df['push'](_0x4b84df['shift']());}};_0x4ffcd5(++_0x347dad);}(_0x2f69,0x12e));var _0x92f6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2f69[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x92f6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x92f6('0x1'));var jsonpatch=require(_0x92f6('0x2'));var rp=require('request-promise');var moment=require(_0x92f6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x92f6('0x4'));var util=require(_0x92f6('0x5'));var path=require(_0x92f6('0x6'));var sox=require(_0x92f6('0x7'));var csv=require(_0x92f6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x92f6('0x9'));var _=require(_0x92f6('0xa'));var squel=require(_0x92f6('0xb'));var crypto=require(_0x92f6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x92f6('0xd'));var toCsv=require(_0x92f6('0x8'));var querystring=require(_0x92f6('0xe'));var Papa=require(_0x92f6('0xf'));var Redis=require(_0x92f6('0x10'));var authService=require(_0x92f6('0x11'));var qs=require(_0x92f6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x92f6('0x13'));var logger=require(_0x92f6('0x14'))(_0x92f6('0x15'));var utils=require(_0x92f6('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x92f6('0x17'));var db=require(_0x92f6('0x18'))['db'];config[_0x92f6('0x19')]=_['defaults'](config[_0x92f6('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x92f6('0x1a'))(new Redis(config[_0x92f6('0x19')]));require(_0x92f6('0x1b'))[_0x92f6('0x1c')](socket);function respondWithStatusCode(_0x29225a,_0x1ddee1){_0x1ddee1=_0x1ddee1||0xcc;return function(_0x1c05ca){if(_0x1c05ca){return _0x29225a[_0x92f6('0x1d')](_0x1ddee1);}return _0x29225a[_0x92f6('0x1e')](_0x1ddee1)[_0x92f6('0x1f')]();};}function respondWithResult(_0x41ae14,_0x3aebf2){_0x3aebf2=_0x3aebf2||0xc8;return function(_0x502051){if(_0x502051){return _0x41ae14['status'](_0x3aebf2)['json'](_0x502051);}};}function respondWithFilteredResult(_0x328b43,_0x3d207a){return function(_0x3e4029){if(_0x3e4029){var _0x14d287=typeof _0x3d207a[_0x92f6('0x20')]===_0x92f6('0x21')&&typeof _0x3d207a[_0x92f6('0x22')]===_0x92f6('0x21');var _0x1d5993=_0x3e4029[_0x92f6('0x23')];var _0x1ab723=_0x14d287?0x0:_0x3d207a['offset'];var _0x4718fa=_0x14d287?_0x3e4029[_0x92f6('0x23')]:_0x3d207a[_0x92f6('0x20')]+_0x3d207a[_0x92f6('0x22')];var _0xac1ed1;if(_0x4718fa>=_0x1d5993){_0x4718fa=_0x1d5993;_0xac1ed1=0xc8;}else{_0xac1ed1=0xce;}_0x328b43[_0x92f6('0x1e')](_0xac1ed1);return _0x328b43[_0x92f6('0x24')](_0x92f6('0x25'),_0x1ab723+'-'+_0x4718fa+'/'+_0x1d5993)[_0x92f6('0x26')](_0x3e4029);}return null;};}function patchUpdates(_0xe7fbbc){return function(_0x8f8d8b){try{jsonpatch[_0x92f6('0x27')](_0x8f8d8b,_0xe7fbbc,!![]);}catch(_0x37dd44){return BPromise['reject'](_0x37dd44);}return _0x8f8d8b['save']();};}function saveUpdates(_0x131489,_0x58f514){return function(_0x336c22){if(_0x336c22){return _0x336c22[_0x92f6('0x28')](_0x131489)[_0x92f6('0x29')](function(_0x29b117){return _0x29b117;});}return null;};}function removeEntity(_0x1a3130,_0x547f7f){return function(_0x2047a6){if(_0x2047a6){return _0x2047a6[_0x92f6('0x2a')]()[_0x92f6('0x29')](function(){_0x1a3130[_0x92f6('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42fdd1,_0x583a71){return function(_0x2f63aa){if(!_0x2f63aa){_0x42fdd1['sendStatus'](0x194);}return _0x2f63aa;};}function handleError(_0x4e8fa2,_0x2008db){_0x2008db=_0x2008db||0x1f4;return function(_0x4f174e){logger[_0x92f6('0x2b')](_0x4f174e[_0x92f6('0x2c')]);if(_0x4f174e[_0x92f6('0x2d')]){delete _0x4f174e['name'];}_0x4e8fa2[_0x92f6('0x1e')](_0x2008db)[_0x92f6('0x2e')](_0x4f174e);};}exports[_0x92f6('0x2f')]=function(_0x1e953b,_0x228ef7){var _0x2652d5={},_0x1fdf80={},_0x5f30e8={'count':0x0,'rows':[]};var _0x18c1ff=_[_0x92f6('0x30')](db[_0x92f6('0x31')]['rawAttributes'],function(_0x39c054){return{'name':_0x39c054[_0x92f6('0x32')],'type':_0x39c054[_0x92f6('0x33')][_0x92f6('0x34')]};});_0x1fdf80[_0x92f6('0x35')]=_['map'](_0x18c1ff,_0x92f6('0x2d'));_0x1fdf80[_0x92f6('0x36')]=_[_0x92f6('0x37')](_0x1e953b[_0x92f6('0x36')]);_0x1fdf80[_0x92f6('0x38')]=_[_0x92f6('0x39')](_0x1fdf80[_0x92f6('0x35')],_0x1fdf80['query']);_0x2652d5['attributes']=_[_0x92f6('0x39')](_0x1fdf80[_0x92f6('0x35')],qs['fields'](_0x1e953b['query']['fields']));_0x2652d5[_0x92f6('0x3a')]=_0x2652d5[_0x92f6('0x3a')][_0x92f6('0x3b')]?_0x2652d5[_0x92f6('0x3a')]:_0x1fdf80['model'];if(!_0x1e953b[_0x92f6('0x36')][_0x92f6('0x3c')](_0x92f6('0x3d'))){_0x2652d5[_0x92f6('0x22')]=qs['limit'](_0x1e953b[_0x92f6('0x36')][_0x92f6('0x22')]);_0x2652d5[_0x92f6('0x20')]=qs['offset'](_0x1e953b['query']['offset']);}_0x2652d5[_0x92f6('0x3e')]=qs[_0x92f6('0x3f')](_0x1e953b[_0x92f6('0x36')]['sort']);_0x2652d5[_0x92f6('0x40')]=qs['filters'](_[_0x92f6('0x41')](_0x1e953b[_0x92f6('0x36')],_0x1fdf80['filters']),_0x18c1ff);if(_0x1e953b[_0x92f6('0x36')][_0x92f6('0x42')]){_0x2652d5[_0x92f6('0x40')]=_[_0x92f6('0x43')](_0x2652d5[_0x92f6('0x40')],{'$or':_[_0x92f6('0x30')](_0x18c1ff,function(_0xe417f3){if(_0xe417f3['type']!==_0x92f6('0x44')){var _0x59d319={};_0x59d319[_0xe417f3[_0x92f6('0x2d')]]={'$like':'%'+_0x1e953b[_0x92f6('0x36')]['filter']+'%'};return _0x59d319;}})});}_0x2652d5=_['merge']({},_0x2652d5,_0x1e953b[_0x92f6('0x45')]);var _0x2325fc={'where':_0x2652d5[_0x92f6('0x40')]};return db[_0x92f6('0x31')]['count'](_0x2325fc)[_0x92f6('0x29')](function(_0xa11f60){_0x5f30e8[_0x92f6('0x23')]=_0xa11f60;if(_0x1e953b[_0x92f6('0x36')][_0x92f6('0x46')]){_0x2652d5[_0x92f6('0x47')]=[{'all':!![]}];}return db[_0x92f6('0x31')][_0x92f6('0x48')](_0x2652d5);})['then'](function(_0x3d99c5){_0x5f30e8[_0x92f6('0x49')]=_0x3d99c5;return _0x5f30e8;})[_0x92f6('0x29')](respondWithFilteredResult(_0x228ef7,_0x2652d5))[_0x92f6('0x4a')](handleError(_0x228ef7,null));};exports[_0x92f6('0x4b')]=function(_0x405df9,_0x5f5334){var _0x48aee0={'raw':!![],'where':{'id':_0x405df9[_0x92f6('0x4c')]['id']}},_0x345e27={};_0x345e27['model']=_[_0x92f6('0x37')](db['ChatGroup'][_0x92f6('0x4d')]);_0x345e27[_0x92f6('0x36')]=_['keys'](_0x405df9[_0x92f6('0x36')]);_0x345e27['filters']=_[_0x92f6('0x39')](_0x345e27['model'],_0x345e27[_0x92f6('0x36')]);_0x48aee0[_0x92f6('0x3a')]=_['intersection'](_0x345e27['model'],qs[_0x92f6('0x4e')](_0x405df9['query'][_0x92f6('0x4e')]));_0x48aee0[_0x92f6('0x3a')]=_0x48aee0[_0x92f6('0x3a')][_0x92f6('0x3b')]?_0x48aee0[_0x92f6('0x3a')]:_0x345e27[_0x92f6('0x35')];if(_0x405df9[_0x92f6('0x36')][_0x92f6('0x46')]){_0x48aee0[_0x92f6('0x47')]=[{'all':!![]}];}_0x48aee0=_[_0x92f6('0x43')]({},_0x48aee0,_0x405df9['options']);return db[_0x92f6('0x31')][_0x92f6('0x4f')](_0x48aee0)['then'](handleEntityNotFound(_0x5f5334,null))[_0x92f6('0x29')](respondWithResult(_0x5f5334,null))[_0x92f6('0x4a')](handleError(_0x5f5334,null));};exports[_0x92f6('0x50')]=function(_0x3056fa,_0x5dc85c){return db['ChatGroup']['create'](_0x3056fa[_0x92f6('0x51')],{})[_0x92f6('0x29')](respondWithResult(_0x5dc85c,0xc9))[_0x92f6('0x4a')](handleError(_0x5dc85c,null));};exports[_0x92f6('0x28')]=function(_0x15706b,_0x1fca15){if(_0x15706b[_0x92f6('0x51')]['id']){delete _0x15706b['body']['id'];}return db[_0x92f6('0x31')][_0x92f6('0x4f')]({'where':{'id':_0x15706b[_0x92f6('0x4c')]['id']}})[_0x92f6('0x29')](handleEntityNotFound(_0x1fca15,null))[_0x92f6('0x29')](saveUpdates(_0x15706b['body'],null))[_0x92f6('0x29')](respondWithResult(_0x1fca15,null))[_0x92f6('0x4a')](handleError(_0x1fca15,null));};exports[_0x92f6('0x2a')]=function(_0x179d2e,_0x3d50d7){return db[_0x92f6('0x31')][_0x92f6('0x4f')]({'where':{'id':_0x179d2e['params']['id']}})[_0x92f6('0x29')](handleEntityNotFound(_0x3d50d7,null))[_0x92f6('0x29')](removeEntity(_0x3d50d7,null))['catch'](handleError(_0x3d50d7,null));};exports[_0x92f6('0x52')]=function(_0x330964,_0x42ca91){return db[_0x92f6('0x31')][_0x92f6('0x52')]()[_0x92f6('0x29')](respondWithResult(_0x42ca91,null))[_0x92f6('0x4a')](handleError(_0x42ca91,null));};exports['getUnread']=function(_0x12d33d,_0x220c19,_0xbb0267){return db[_0x92f6('0x53')][_0x92f6('0x23')]({'where':{'ChatGroupId':_0x12d33d[_0x92f6('0x4c')]['id'],'ToId':_0x12d33d['user']['id'],'read':![]}})[_0x92f6('0x29')](function(_0x43e1a0){return{'id':_['toInteger'](_0x12d33d[_0x92f6('0x4c')]['id']),'count':_0x43e1a0};})[_0x92f6('0x29')](respondWithResult(_0x220c19,null))[_0x92f6('0x4a')](handleError(_0x220c19,null));};exports[_0x92f6('0x54')]=function(_0x2dedb5,_0x3a9492,_0x460650){return db[_0x92f6('0x31')][_0x92f6('0x4f')]({'where':{'id':_0x2dedb5[_0x92f6('0x4c')]['id']}})[_0x92f6('0x29')](handleEntityNotFound(_0x3a9492,null))['then'](function(_0x53b46f){if(_0x53b46f){return _0x53b46f[_0x92f6('0x54')](_0x2dedb5[_0x92f6('0x51')]['ids'],_[_0x92f6('0x55')](_0x2dedb5[_0x92f6('0x51')],[_0x92f6('0x56'),'id'])||{});}})[_0x92f6('0x29')](respondWithResult(_0x3a9492,null))[_0x92f6('0x4a')](handleError(_0x3a9492,null));};exports[_0x92f6('0x57')]=function(_0x2be1d4,_0x5880cc,_0x4fc6b3){var _0x5b03d3={};var _0x2d7168={};var _0x5ecbd0;var _0x12ffb3;return db['ChatGroup']['findOne']({'where':{'id':_0x2be1d4['params']['id']}})['then'](handleEntityNotFound(_0x5880cc,null))[_0x92f6('0x29')](function(_0x213701){if(_0x213701){_0x5ecbd0=_0x213701;_0x2d7168[_0x92f6('0x35')]=_['keys'](db[_0x92f6('0x58')]['rawAttributes']);_0x2d7168['query']=_[_0x92f6('0x37')](_0x2be1d4[_0x92f6('0x36')]);_0x2d7168['filters']=_['intersection'](_0x2d7168[_0x92f6('0x35')],_0x2d7168['query']);_0x5b03d3[_0x92f6('0x3a')]=_['intersection'](_0x2d7168[_0x92f6('0x35')],qs[_0x92f6('0x4e')](_0x2be1d4['query'][_0x92f6('0x4e')]));_0x5b03d3[_0x92f6('0x3a')]=_0x5b03d3[_0x92f6('0x3a')][_0x92f6('0x3b')]?_0x5b03d3['attributes']:_0x2d7168[_0x92f6('0x35')];_0x5b03d3[_0x92f6('0x3e')]=qs[_0x92f6('0x3f')](_0x2be1d4[_0x92f6('0x36')][_0x92f6('0x3f')]);_0x5b03d3[_0x92f6('0x40')]=qs[_0x92f6('0x38')](_[_0x92f6('0x41')](_0x2be1d4[_0x92f6('0x36')],_0x2d7168[_0x92f6('0x38')]));if(_0x2be1d4[_0x92f6('0x36')]['filter']){_0x5b03d3[_0x92f6('0x40')]=_[_0x92f6('0x43')](_0x5b03d3['where'],{'$or':_[_0x92f6('0x30')](_0x5b03d3[_0x92f6('0x3a')],function(_0xdb8030){var _0x5e8e90={};_0x5e8e90[_0xdb8030]={'$like':'%'+_0x2be1d4['query']['filter']+'%'};return _0x5e8e90;})});}_0x5b03d3=_[_0x92f6('0x43')]({},_0x5b03d3,_0x2be1d4[_0x92f6('0x45')]);return _0x5ecbd0[_0x92f6('0x57')](_0x5b03d3);}})['then'](function(_0x51ad99){if(_0x51ad99){_0x12ffb3=_0x51ad99[_0x92f6('0x3b')];if(!_0x2be1d4['query'][_0x92f6('0x3c')](_0x92f6('0x3d'))){_0x5b03d3['limit']=qs[_0x92f6('0x22')](_0x2be1d4[_0x92f6('0x36')]['limit']);_0x5b03d3[_0x92f6('0x20')]=qs[_0x92f6('0x20')](_0x2be1d4[_0x92f6('0x36')][_0x92f6('0x20')]);}return _0x5ecbd0[_0x92f6('0x57')](_0x5b03d3);}})['then'](function(_0x5ee27c){if(_0x5ee27c){return _0x5ee27c?{'count':_0x12ffb3,'rows':_0x5ee27c}:null;}})[_0x92f6('0x29')](respondWithResult(_0x5880cc,null))[_0x92f6('0x4a')](handleError(_0x5880cc,null));};exports[_0x92f6('0x59')]=function(_0x1a5232,_0x974605,_0x584e36){return db[_0x92f6('0x31')][_0x92f6('0x4f')]({'where':{'id':_0x1a5232[_0x92f6('0x4c')]['id']}})[_0x92f6('0x29')](handleEntityNotFound(_0x974605,null))[_0x92f6('0x29')](function(_0x3b1119){if(_0x3b1119){return _0x3b1119[_0x92f6('0x59')](_0x1a5232[_0x92f6('0x36')][_0x92f6('0x56')]);}})['then'](respondWithStatusCode(_0x974605,null))[_0x92f6('0x4a')](handleError(_0x974605,null));};exports[_0x92f6('0x5a')]=function(_0x480b8b,_0xa611b0,_0x59d581){if(_0x480b8b['body']['id']){delete _0x480b8b[_0x92f6('0x51')]['id'];}return db[_0x92f6('0x31')][_0x92f6('0x4f')]({'where':{'id':_0x480b8b['params']['id']}})[_0x92f6('0x29')](handleEntityNotFound(_0xa611b0,null))[_0x92f6('0x29')](function(_0x5b5f53){if(_0x5b5f53){_0x480b8b[_0x92f6('0x51')]['ChatGroupId']=_0x5b5f53['id'];return db[_0x92f6('0x53')][_0x92f6('0x50')](_0x480b8b[_0x92f6('0x51')]);}})[_0x92f6('0x29')](respondWithResult(_0xa611b0,null))[_0x92f6('0x4a')](handleError(_0xa611b0,null));};exports[_0x92f6('0x5b')]=function(_0xd43cfa,_0x3782ed,_0x29605f){var _0xb7ec90={};var _0x37eca3={};var _0x42d19c;var _0x604835;return db[_0x92f6('0x31')][_0x92f6('0x5c')]({'where':{'id':_0xd43cfa[_0x92f6('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3782ed,null))['then'](function(_0x510bc0){if(_0x510bc0){_0x42d19c=_0x510bc0;_0x37eca3[_0x92f6('0x35')]=_[_0x92f6('0x37')](db[_0x92f6('0x53')][_0x92f6('0x4d')]);_0x37eca3[_0x92f6('0x36')]=_['keys'](_0xd43cfa[_0x92f6('0x36')]);_0x37eca3[_0x92f6('0x38')]=_['intersection'](_0x37eca3['model'],_0x37eca3['query']);_0xb7ec90[_0x92f6('0x3a')]=_[_0x92f6('0x39')](_0x37eca3[_0x92f6('0x35')],qs['fields'](_0xd43cfa[_0x92f6('0x36')][_0x92f6('0x4e')]));_0xb7ec90[_0x92f6('0x3a')]=_0xb7ec90[_0x92f6('0x3a')][_0x92f6('0x3b')]?_0xb7ec90[_0x92f6('0x3a')]:_0x37eca3[_0x92f6('0x35')];_0xb7ec90[_0x92f6('0x3e')]=qs[_0x92f6('0x3f')](_0xd43cfa[_0x92f6('0x36')]['sort']);_0xb7ec90[_0x92f6('0x40')]=qs[_0x92f6('0x38')](_[_0x92f6('0x41')](_0xd43cfa[_0x92f6('0x36')],_0x37eca3[_0x92f6('0x38')]));if(_0xd43cfa['query'][_0x92f6('0x42')]){_0xb7ec90[_0x92f6('0x40')]=_['merge'](_0xb7ec90[_0x92f6('0x40')],{'$or':_[_0x92f6('0x30')](_0xb7ec90[_0x92f6('0x3a')],function(_0x51e91d){var _0x26629b={};_0x26629b[_0x51e91d]={'$like':'%'+_0xd43cfa[_0x92f6('0x36')][_0x92f6('0x42')]+'%'};return _0x26629b;})});}if(_0xd43cfa[_0x92f6('0x36')][_0x92f6('0x5d')]){var _0x1b22ac=_0xd43cfa['query'][_0x92f6('0x5d')][_0x92f6('0x5e')](',');var _0x57f0b9={};_0x57f0b9[_0x1b22ac[0x0]]={'$gte':moment(_0x1b22ac[0x1])[_0x92f6('0x5f')](_0x92f6('0x60'))};_0xb7ec90[_0x92f6('0x40')]=_['merge'](_0xb7ec90['where'],_0x57f0b9);}_0xb7ec90=_['merge']({},_0xb7ec90,_0xd43cfa[_0x92f6('0x45')]);return _0x42d19c[_0x92f6('0x5b')](_0xb7ec90);}})[_0x92f6('0x29')](function(_0x48f867){if(_0x48f867){_0x604835=_0x48f867[_0x92f6('0x3b')];if(!_0xd43cfa['query'][_0x92f6('0x3c')](_0x92f6('0x3d'))){_0xb7ec90[_0x92f6('0x22')]=qs[_0x92f6('0x22')](_0xd43cfa[_0x92f6('0x36')]['limit']);_0xb7ec90[_0x92f6('0x20')]=qs[_0x92f6('0x20')](_0xd43cfa[_0x92f6('0x36')][_0x92f6('0x20')]);}return _0x42d19c[_0x92f6('0x5b')](_0xb7ec90);}})[_0x92f6('0x29')](function(_0x3e89c4){if(_0x3e89c4){return _0x3e89c4?{'count':_0x604835,'rows':_0x3e89c4}:null;}})[_0x92f6('0x29')](respondWithResult(_0x3782ed,null))[_0x92f6('0x4a')](handleError(_0x3782ed,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index a2d174f..c2c7488 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 _0x0137=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','ChatGroup','setMaxListeners','save'];(function(_0x3b7b8a,_0x52c3b0){var _0x441206=function(_0x5d34d3){while(--_0x5d34d3){_0x3b7b8a['push'](_0x3b7b8a['shift']());}};_0x441206(++_0x52c3b0);}(_0x0137,0x1d8));var _0x7013=function(_0x438e07,_0x590a1b){_0x438e07=_0x438e07-0x0;var _0x28f1a4=_0x0137[_0x438e07];return _0x28f1a4;};'use strict';var EventEmitter=require(_0x7013('0x0'));var ChatGroup=require(_0x7013('0x1'))['db'][_0x7013('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x7013('0x3')](0x0);var events={'afterCreate':_0x7013('0x4'),'afterUpdate':'update','afterDestroy':_0x7013('0x5')};function emitEvent(_0x23a553){return function(_0x1d35c3,_0x72e6a9,_0x17462b){ChatGroupEvents[_0x7013('0x6')](_0x23a553+':'+_0x1d35c3['id'],_0x1d35c3);ChatGroupEvents['emit'](_0x23a553,_0x1d35c3);_0x17462b(null);};}for(var e in events){if(events[_0x7013('0x7')](e)){var event=events[e];ChatGroup[_0x7013('0x8')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x649e=['exports','events','../../mysqldb','ChatGroup','setMaxListeners','save','update','remove','emit','hook'];(function(_0xbc902c,_0x1af01b){var _0x5e71e8=function(_0xfdf65b){while(--_0xfdf65b){_0xbc902c['push'](_0xbc902c['shift']());}};_0x5e71e8(++_0x1af01b);}(_0x649e,0xdd));var _0xe649=function(_0x7dec21,_0x84f83c){_0x7dec21=_0x7dec21-0x0;var _0x1b4761=_0x649e[_0x7dec21];return _0x1b4761;};'use strict';var EventEmitter=require(_0xe649('0x0'));var ChatGroup=require(_0xe649('0x1'))['db'][_0xe649('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xe649('0x3')](0x0);var events={'afterCreate':_0xe649('0x4'),'afterUpdate':_0xe649('0x5'),'afterDestroy':_0xe649('0x6')};function emitEvent(_0x1b7d70){return function(_0x173b41,_0x4e9760,_0x371318){ChatGroupEvents[_0xe649('0x7')](_0x1b7d70+':'+_0x173b41['id'],_0x173b41);ChatGroupEvents[_0xe649('0x7')](_0x1b7d70,_0x173b41);_0x371318(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0xe649('0x8')](e,emitEvent(event));}}module[_0xe649('0x9')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 4b0472e..71d507a 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 _0xe99e=['util','../../config/logger','bluebird','request-promise','path','../../config/environment','exports','define','chat_groups','lodash'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xe99e,0xd1));var _0xee99=function(_0x8a6255,_0x4f2b24){_0x8a6255=_0x8a6255-0x0;var _0x370434=_0xe99e[_0x8a6255];return _0x370434;};'use strict';var _=require(_0xee99('0x0'));var util=require(_0xee99('0x1'));var logger=require(_0xee99('0x2'))('api');var moment=require('moment');var BPromise=require(_0xee99('0x3'));var rp=require(_0xee99('0x4'));var fs=require('fs');var path=require(_0xee99('0x5'));var rimraf=require('rimraf');var config=require(_0xee99('0x6'));var attributes=require('./chatGroup.attributes');module[_0xee99('0x7')]=function(_0x16a51,_0x23f155){return _0x16a51[_0xee99('0x8')]('ChatGroup',attributes,{'tableName':_0xee99('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f20=['define','ChatGroup','chat_groups','util','moment','bluebird','rimraf','./chatGroup.attributes'];(function(_0x49136d,_0x3f6127){var _0x40d292=function(_0x3e299c){while(--_0x3e299c){_0x49136d['push'](_0x49136d['shift']());}};_0x40d292(++_0x3f6127);}(_0x2f20,0x6b));var _0x02f2=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0x2f20[_0x40a825];return _0x273a54;};'use strict';var _=require('lodash');var util=require(_0x02f2('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x02f2('0x1'));var BPromise=require(_0x02f2('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x02f2('0x3'));var config=require('../../config/environment');var attributes=require(_0x02f2('0x4'));module['exports']=function(_0x15707d,_0xd4325){return _0x15707d[_0x02f2('0x5')](_0x02f2('0x6'),attributes,{'tableName':_0x02f2('0x7'),'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 adbd617..d5b80bb 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 _0x938a=['jayson/promise','http','redis','socket.io-emitter','./chatGroup.socket','then','info','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','request\x20sent','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x3acd23,_0x3d0861){var _0x54e7a9=function(_0xf601e5){while(--_0xf601e5){_0x3acd23['push'](_0x3acd23['shift']());}};_0x54e7a9(++_0x3d0861);}(_0x938a,0x1f2));var _0xa938=function(_0x2265ba,_0x3521bb){_0x2265ba=_0x2265ba-0x0;var _0x51e025=_0x938a[_0x2265ba];return _0x51e025;};'use strict';var _=require(_0xa938('0x0'));var util=require(_0xa938('0x1'));var moment=require(_0xa938('0x2'));var BPromise=require(_0xa938('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa938('0x4'))['db'];var utils=require(_0xa938('0x5'));var logger=require(_0xa938('0x6'))('rpc');var config=require(_0xa938('0x7'));var jayson=require(_0xa938('0x8'));var client=jayson['client'][_0xa938('0x9')]({'port':0x232a});config[_0xa938('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa938('0xb'))(new Redis(config[_0xa938('0xa')]));require(_0xa938('0xc'))['register'](socket);function respondWithRpcPromise(_0x4577fb,_0x24ac33,_0x15cef1){return new BPromise(function(_0x18ba2f,_0x110401){return client['request'](_0x4577fb,_0x15cef1)[_0xa938('0xd')](function(_0x29a19d){logger[_0xa938('0xe')]('ChatGroup,\x20%s,\x20%s',_0x24ac33,'request\x20sent');logger['debug']('ChatGroup,\x20%s,\x20%s,\x20%s',_0x24ac33,'request\x20sent',JSON[_0xa938('0xf')](_0x29a19d));if(_0x29a19d[_0xa938('0x10')]){if(_0x29a19d['error'][_0xa938('0x11')]===0x1f4){logger[_0xa938('0x10')](_0xa938('0x12'),_0x24ac33,_0x29a19d['error'][_0xa938('0x13')]);return _0x110401(_0x29a19d[_0xa938('0x10')][_0xa938('0x13')]);}logger[_0xa938('0x10')](_0xa938('0x12'),_0x24ac33,_0x29a19d['error'][_0xa938('0x13')]);return _0x18ba2f(_0x29a19d[_0xa938('0x10')][_0xa938('0x13')]);}else{logger[_0xa938('0xe')]('ChatGroup,\x20%s,\x20%s',_0x24ac33,_0xa938('0x14'));_0x18ba2f(_0x29a19d['result'][_0xa938('0x13')]);}})[_0xa938('0x15')](function(_0x2972ac){logger[_0xa938('0x10')](_0xa938('0x12'),_0x24ac33,_0x2972ac);_0x110401(_0x2972ac);});});} \ No newline at end of file +var _0xf0db=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x5db99b,_0xdee23a){var _0x4b2d0e=function(_0x4deee1){while(--_0x4deee1){_0x5db99b['push'](_0x5db99b['shift']());}};_0x4b2d0e(++_0xdee23a);}(_0xf0db,0x12b));var _0xbf0d=function(_0xcba257,_0x510ba6){_0xcba257=_0xcba257-0x0;var _0x437e65=_0xf0db[_0xcba257];return _0x437e65;};'use strict';var _=require(_0xbf0d('0x0'));var util=require(_0xbf0d('0x1'));var moment=require('moment');var BPromise=require(_0xbf0d('0x2'));var rs=require(_0xbf0d('0x3'));var fs=require('fs');var Redis=require(_0xbf0d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbf0d('0x5'));var logger=require(_0xbf0d('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbf0d('0x7'));var client=jayson[_0xbf0d('0x8')][_0xbf0d('0x9')]({'port':0x232a});config[_0xbf0d('0xa')]=_['defaults'](config[_0xbf0d('0xa')],{'host':_0xbf0d('0xb'),'port':0x18eb});var socket=require(_0xbf0d('0xc'))(new Redis(config[_0xbf0d('0xa')]));require(_0xbf0d('0xd'))[_0xbf0d('0xe')](socket);function respondWithRpcPromise(_0x154401,_0xb7715f,_0x55cb8f){return new BPromise(function(_0x5a28a3,_0x170113){return client[_0xbf0d('0xf')](_0x154401,_0x55cb8f)[_0xbf0d('0x10')](function(_0x290a56){logger[_0xbf0d('0x11')](_0xbf0d('0x12'),_0xb7715f,_0xbf0d('0x13'));logger[_0xbf0d('0x14')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0xb7715f,_0xbf0d('0x13'),JSON[_0xbf0d('0x15')](_0x290a56));if(_0x290a56['error']){if(_0x290a56[_0xbf0d('0x16')][_0xbf0d('0x17')]===0x1f4){logger[_0xbf0d('0x16')](_0xbf0d('0x12'),_0xb7715f,_0x290a56[_0xbf0d('0x16')][_0xbf0d('0x18')]);return _0x170113(_0x290a56[_0xbf0d('0x16')][_0xbf0d('0x18')]);}logger[_0xbf0d('0x16')](_0xbf0d('0x12'),_0xb7715f,_0x290a56[_0xbf0d('0x16')][_0xbf0d('0x18')]);return _0x5a28a3(_0x290a56[_0xbf0d('0x16')][_0xbf0d('0x18')]);}else{logger['info'](_0xbf0d('0x12'),_0xb7715f,_0xbf0d('0x13'));_0x5a28a3(_0x290a56[_0xbf0d('0x19')][_0xbf0d('0x18')]);}})[_0xbf0d('0x1a')](function(_0x35166e){logger[_0xbf0d('0x16')]('ChatGroup,\x20%s,\x20%s',_0xb7715f,_0x35166e);_0x170113(_0x35166e);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index dacdb25..8187890 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 _0xd137=['register','length','./chatGroup.events','save','remove','update','emit','removeListener'];(function(_0x459cfb,_0x26b8f8){var _0x182972=function(_0x31fae5){while(--_0x31fae5){_0x459cfb['push'](_0x459cfb['shift']());}};_0x182972(++_0x26b8f8);}(_0xd137,0xa2));var _0x7d13=function(_0x1ac29c,_0xc36b3f){_0x1ac29c=_0x1ac29c-0x0;var _0x3a9101=_0xd137[_0x1ac29c];return _0x3a9101;};'use strict';var ChatGroupEvents=require(_0x7d13('0x0'));var events=[_0x7d13('0x1'),_0x7d13('0x2'),_0x7d13('0x3')];function createListener(_0x3c2c48,_0x54753a){return function(_0x5a67c6){_0x54753a[_0x7d13('0x4')](_0x3c2c48,_0x5a67c6);};}function removeListener(_0x4b665e,_0xb24c77){return function(){ChatGroupEvents[_0x7d13('0x5')](_0x4b665e,_0xb24c77);};}exports[_0x7d13('0x6')]=function(_0x42c06a){for(var _0x5b0c57=0x0,_0xf5a5fd=events[_0x7d13('0x7')];_0x5b0c57<_0xf5a5fd;_0x5b0c57++){var _0x527116=events[_0x5b0c57];var _0x2ca0a5=createListener('chatGroup:'+_0x527116,_0x42c06a);ChatGroupEvents['on'](_0x527116,_0x2ca0a5);}}; \ No newline at end of file +var _0x88c6=['chatGroup:','./chatGroup.events','save','update','emit','length'];(function(_0x23dbc3,_0x22d7ae){var _0x5cb9db=function(_0x2cddf7){while(--_0x2cddf7){_0x23dbc3['push'](_0x23dbc3['shift']());}};_0x5cb9db(++_0x22d7ae);}(_0x88c6,0x121));var _0x688c=function(_0x5d67be,_0x73cb7){_0x5d67be=_0x5d67be-0x0;var _0x4ce27a=_0x88c6[_0x5d67be];return _0x4ce27a;};'use strict';var ChatGroupEvents=require(_0x688c('0x0'));var events=[_0x688c('0x1'),'remove',_0x688c('0x2')];function createListener(_0x28e51d,_0x49dfed){return function(_0x1a0d63){_0x49dfed[_0x688c('0x3')](_0x28e51d,_0x1a0d63);};}function removeListener(_0x5b0225,_0x6b40af){return function(){ChatGroupEvents['removeListener'](_0x5b0225,_0x6b40af);};}exports['register']=function(_0x21f689){for(var _0xbb7e41=0x0,_0x3b6140=events[_0x688c('0x4')];_0xbb7e41<_0x3b6140;_0xbb7e41++){var _0x9c2932=events[_0xbb7e41];var _0x426bb8=createListener(_0x688c('0x5')+_0x9c2932,_0x21f689);ChatGroupEvents['on'](_0x9c2932,_0x426bb8);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 877cdcd..e9199ce 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 _0xc3b9=['removeMembers','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','get','index','/describe','describe','/:id','isAuthenticated','getUnread','/:id/members','/:id/messages','post','create','addMembers','addMessage','put','update','delete','destroy'];(function(_0x254b22,_0x27159f){var _0x1279db=function(_0x3ca06f){while(--_0x3ca06f){_0x254b22['push'](_0x254b22['shift']());}};_0x1279db(++_0x27159f);}(_0xc3b9,0x196));var _0x9c3b=function(_0x5bbae4,_0x2a4a4e){_0x5bbae4=_0x5bbae4-0x0;var _0x338a50=_0xc3b9[_0x5bbae4];return _0x338a50;};'use strict';var multer=require(_0x9c3b('0x0'));var util=require(_0x9c3b('0x1'));var path=require(_0x9c3b('0x2'));var timeout=require(_0x9c3b('0x3'));var express=require(_0x9c3b('0x4'));var router=express['Router']();var fs_extra=require(_0x9c3b('0x5'));var auth=require(_0x9c3b('0x6'));var interaction=require(_0x9c3b('0x7'));var config=require('../../config/environment');var controller=require(_0x9c3b('0x8'));router[_0x9c3b('0x9')]('/',auth['isAuthenticated'](),controller[_0x9c3b('0xa')]);router[_0x9c3b('0x9')](_0x9c3b('0xb'),auth['isAuthenticated'](),controller[_0x9c3b('0xc')]);router['get'](_0x9c3b('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x9c3b('0x9')]('/:id/unread',auth[_0x9c3b('0xe')](),controller[_0x9c3b('0xf')]);router[_0x9c3b('0x9')](_0x9c3b('0x10'),auth[_0x9c3b('0xe')](),controller['getMembers']);router[_0x9c3b('0x9')](_0x9c3b('0x11'),auth[_0x9c3b('0xe')](),controller['getMessages']);router[_0x9c3b('0x12')]('/',auth['isAuthenticated'](),controller[_0x9c3b('0x13')]);router[_0x9c3b('0x12')](_0x9c3b('0x10'),auth[_0x9c3b('0xe')](),controller[_0x9c3b('0x14')]);router['post']('/:id/messages',auth[_0x9c3b('0xe')](),controller[_0x9c3b('0x15')]);router[_0x9c3b('0x16')]('/:id',auth[_0x9c3b('0xe')](),controller[_0x9c3b('0x17')]);router[_0x9c3b('0x18')](_0x9c3b('0xd'),auth['isAuthenticated'](),controller[_0x9c3b('0x19')]);router[_0x9c3b('0x18')](_0x9c3b('0x10'),auth[_0x9c3b('0xe')](),controller[_0x9c3b('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xfc14=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','post','create','addMembers','addMessage','update','delete','removeMembers','multer'];(function(_0x1e2aae,_0x2349e3){var _0x4d8a43=function(_0x305d4c){while(--_0x305d4c){_0x1e2aae['push'](_0x1e2aae['shift']());}};_0x4d8a43(++_0x2349e3);}(_0xfc14,0x8b));var _0x4fc1=function(_0x1a59ba,_0x2b4ec3){_0x1a59ba=_0x1a59ba-0x0;var _0x3b11bb=_0xfc14[_0x1a59ba];return _0x3b11bb;};'use strict';var multer=require(_0x4fc1('0x0'));var util=require('util');var path=require(_0x4fc1('0x1'));var timeout=require(_0x4fc1('0x2'));var express=require(_0x4fc1('0x3'));var router=express[_0x4fc1('0x4')]();var fs_extra=require(_0x4fc1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4fc1('0x6'));var config=require(_0x4fc1('0x7'));var controller=require(_0x4fc1('0x8'));router[_0x4fc1('0x9')]('/',auth['isAuthenticated'](),controller[_0x4fc1('0xa')]);router[_0x4fc1('0x9')](_0x4fc1('0xb'),auth[_0x4fc1('0xc')](),controller[_0x4fc1('0xd')]);router['get'](_0x4fc1('0xe'),auth[_0x4fc1('0xc')](),controller[_0x4fc1('0xf')]);router[_0x4fc1('0x9')](_0x4fc1('0x10'),auth[_0x4fc1('0xc')](),controller[_0x4fc1('0x11')]);router[_0x4fc1('0x9')](_0x4fc1('0x12'),auth[_0x4fc1('0xc')](),controller[_0x4fc1('0x13')]);router[_0x4fc1('0x9')](_0x4fc1('0x14'),auth['isAuthenticated'](),controller['getMessages']);router[_0x4fc1('0x15')]('/',auth[_0x4fc1('0xc')](),controller[_0x4fc1('0x16')]);router[_0x4fc1('0x15')](_0x4fc1('0x12'),auth['isAuthenticated'](),controller[_0x4fc1('0x17')]);router['post']('/:id/messages',auth['isAuthenticated'](),controller[_0x4fc1('0x18')]);router['put'](_0x4fc1('0xe'),auth[_0x4fc1('0xc')](),controller[_0x4fc1('0x19')]);router[_0x4fc1('0x1a')](_0x4fc1('0xe'),auth[_0x4fc1('0xc')](),controller['destroy']);router['delete']('/:id/members',auth[_0x4fc1('0xc')](),controller[_0x4fc1('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 5821bff..f3e3c40 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 _0xd2bf=['sequelize','ENUM','star','TEXT','STRING','DATE','long','out','BOOLEAN'];(function(_0x9f7d7a,_0x49c32c){var _0x10a5a8=function(_0x2c33e2){while(--_0x2c33e2){_0x9f7d7a['push'](_0x9f7d7a['shift']());}};_0x10a5a8(++_0x49c32c);}(_0xd2bf,0x1dd));var _0xfd2b=function(_0x176d14,_0x3984ea){_0x176d14=_0x176d14-0x0;var _0x89522c=_0xd2bf[_0x176d14];return _0x89522c;};'use strict';var Sequelize=require(_0xfd2b('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0xfd2b('0x1')](_0xfd2b('0x2'),'thumb'),'defaultValue':_0xfd2b('0x2')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0xfd2b('0x3')]},'mailTranscript':{'type':Sequelize[_0xfd2b('0x4')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xfd2b('0x5')]},'disposition':{'type':Sequelize[_0xfd2b('0x4')]},'secondDisposition':{'type':Sequelize[_0xfd2b('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xfd2b('0x4')]},'browserName':{'type':Sequelize[_0xfd2b('0x4')]},'browserVersion':{'type':Sequelize[_0xfd2b('0x4')]},'osName':{'type':Sequelize[_0xfd2b('0x4')]},'osVersion':{'type':Sequelize[_0xfd2b('0x4')]},'deviceModel':{'type':Sequelize[_0xfd2b('0x4')]},'deviceVendor':{'type':Sequelize[_0xfd2b('0x4')]},'deviceType':{'type':Sequelize[_0xfd2b('0x4')]},'referer':{'type':Sequelize[_0xfd2b('0x3')]},'customerIp':{'type':Sequelize[_0xfd2b('0x4')]},'formData':{'type':Sequelize[_0xfd2b('0x3')](_0xfd2b('0x6'))},'read1stAt':{'type':Sequelize[_0xfd2b('0x5')]},'lastMsgAt':{'type':Sequelize[_0xfd2b('0x5')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xfd2b('0x7')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xfd2b('0x4')]},'customerPort':{'type':Sequelize[_0xfd2b('0x4')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0xfd2b('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x05b6=['thumb','TEXT','STRING','DATE','long','out','sequelize','BOOLEAN','INTEGER','ENUM','star'];(function(_0x4bb12b,_0x5697df){var _0x2baa7c=function(_0x2e7f4e){while(--_0x2e7f4e){_0x4bb12b['push'](_0x4bb12b['shift']());}};_0x2baa7c(++_0x5697df);}(_0x05b6,0x74));var _0x605b=function(_0x2eac4f,_0x5173f9){_0x2eac4f=_0x2eac4f-0x0;var _0x58f73b=_0x05b6[_0x2eac4f];return _0x58f73b;};'use strict';var Sequelize=require(_0x605b('0x0'));module['exports']={'closed':{'type':Sequelize[_0x605b('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x605b('0x2')]},'ratingType':{'type':Sequelize[_0x605b('0x3')](_0x605b('0x4'),_0x605b('0x5')),'defaultValue':_0x605b('0x4')},'ratingMessage':{'type':Sequelize[_0x605b('0x6')]},'pathTranscript':{'type':Sequelize[_0x605b('0x6')]},'mailTranscript':{'type':Sequelize[_0x605b('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x605b('0x8')]},'disposition':{'type':Sequelize[_0x605b('0x7')]},'secondDisposition':{'type':Sequelize[_0x605b('0x7')]},'thirdDisposition':{'type':Sequelize[_0x605b('0x7')]},'note':{'type':Sequelize[_0x605b('0x7')]},'browserName':{'type':Sequelize[_0x605b('0x7')]},'browserVersion':{'type':Sequelize[_0x605b('0x7')]},'osName':{'type':Sequelize[_0x605b('0x7')]},'osVersion':{'type':Sequelize[_0x605b('0x7')]},'deviceModel':{'type':Sequelize[_0x605b('0x7')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x605b('0x7')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0x605b('0x9'))},'read1stAt':{'type':Sequelize[_0x605b('0x8')]},'lastMsgAt':{'type':Sequelize[_0x605b('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x605b('0x3')]('in',_0x605b('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x605b('0x7')]},'customerPort':{'type':Sequelize[_0x605b('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x605b('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x605b('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 911b78e..79a3618 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 _0x9e8f=['YYYY-MM-DD\x20HH:mm:ss','options','includeAll','include','rows','secret','includeAgent','setTags','spread','Tag','color','chatInteractionTags:save','removeTags','server','files','tmp','attachments','transcript-%d-%s.zip','push','firstName','lastName','read','Account','Owner','get','mkdirSync','Chat','N.A.','toString','closedAt','browserName','osName','referer','customerPort','tail','existsSync','createReadStream','pipe','value','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','err','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','ejs','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','destroy','stack','name','send','merge','body','contact','agent','interaction','index','map','ChatInteraction','rawAttributes','fieldName','key','findAll','chat','query','show','keys','intersection','model','attributes','fields','length','create','find','params','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooNote','vidaooMetadata','user','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooTopic','isNull','follow','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','type','Attachment','Unauthorized','attachId','ChatOfflineMessageId','join','root','offline-chat/','download','close','format','transcript-%s.txt','now','pathTranscript','Messages','User','ContactId','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','direction','appendFileSync','MailAccount','CloudProvider','Smtp','SendMail','sendMail','Mail\x20Transcript','mailTranscript','ids','omit','getMessages','filters','hasOwnProperty','nolimit','order','sort','where','pick','ChatInteractionId','filter','$gte','split'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x9e8f,0x103));var _0xf9e8=function(_0x46bf15,_0x4813b8){_0x46bf15=_0x46bf15-0x0;var _0x367349=_0x9e8f[_0x46bf15];return _0x367349;};'use strict';var rimraf=require(_0xf9e8('0x0'));var zipdir=require(_0xf9e8('0x1'));var rp=require(_0xf9e8('0x2'));var moment=require(_0xf9e8('0x3'));var BPromise=require(_0xf9e8('0x4'));var Mustache=require(_0xf9e8('0x5'));var util=require(_0xf9e8('0x6'));var path=require('path');var ejs=require(_0xf9e8('0x7'));var fs=require('fs');var _=require(_0xf9e8('0x8'));var Redis=require(_0xf9e8('0x9'));var interaction=require(_0xf9e8('0xa'));var qs=require('../../components/parsers/qs');var pdf=require(_0xf9e8('0xb'));var logger=require(_0xf9e8('0xc'))(_0xf9e8('0xd'));var config=require(_0xf9e8('0xe'));var db=require(_0xf9e8('0xf'))['db'];config[_0xf9e8('0x10')]=_[_0xf9e8('0x11')](config[_0xf9e8('0x10')],{'host':_0xf9e8('0x12'),'port':0x18eb});var socket=require(_0xf9e8('0x13'))(new Redis(config[_0xf9e8('0x10')]));require(_0xf9e8('0x14'))[_0xf9e8('0x15')](socket);var jayson=require(_0xf9e8('0x16'));var client=jayson[_0xf9e8('0x17')][_0xf9e8('0x18')]({'port':0x232b});var client9004=jayson[_0xf9e8('0x17')][_0xf9e8('0x18')]({'port':0x232c});function respondWithRpcPromise(_0xa318cb,_0x3a1adf,_0x526775,_0x5be6d7){return new BPromise(function(_0x5137fa,_0xd522be){var _0x162f2d=_0x5be6d7||client;return _0x162f2d[_0xf9e8('0x19')](_0xa318cb,_0x526775)[_0xf9e8('0x1a')](function(_0x495740){logger[_0xf9e8('0x1b')]('ChatInteraction,\x20%s,\x20%s',_0x3a1adf,_0xf9e8('0x1c'));logger[_0xf9e8('0x1d')](_0xf9e8('0x1e'),_0x3a1adf,_0xf9e8('0x1c'),JSON[_0xf9e8('0x1f')](_0x495740));if(_0x495740[_0xf9e8('0x20')]){if(_0x495740[_0xf9e8('0x20')][_0xf9e8('0x21')]===0x1f4){logger[_0xf9e8('0x20')](_0xf9e8('0x22'),_0x3a1adf,_0x495740[_0xf9e8('0x20')]['message']);return _0xd522be(_0x495740[_0xf9e8('0x20')]['message']);}logger[_0xf9e8('0x20')](_0xf9e8('0x22'),_0x3a1adf,_0x495740['error'][_0xf9e8('0x23')]);return _0x5137fa(_0x495740['error'][_0xf9e8('0x23')]);}else{logger[_0xf9e8('0x1b')]('ChatInteraction,\x20%s,\x20%s',_0x3a1adf,_0xf9e8('0x1c'));_0x5137fa(_0x495740[_0xf9e8('0x24')][_0xf9e8('0x23')]);}})[_0xf9e8('0x25')](function(_0x3aba17){logger[_0xf9e8('0x20')](_0xf9e8('0x22'),_0x3a1adf,_0x3aba17);_0xd522be(_0x3aba17);});});}function respondWithStatusCode(_0x3700ca,_0x183cc5){_0x183cc5=_0x183cc5||0xcc;return function(_0x8c6e1){if(_0x8c6e1){return _0x3700ca[_0xf9e8('0x26')](_0x183cc5);}return _0x3700ca[_0xf9e8('0x27')](_0x183cc5)[_0xf9e8('0x28')]();};}function respondWithResult(_0x509fea,_0x51d111){_0x51d111=_0x51d111||0xc8;return function(_0xf75e94){if(_0xf75e94){return _0x509fea[_0xf9e8('0x27')](_0x51d111)[_0xf9e8('0x29')](_0xf75e94);}};}function respondWithFilteredResult(_0x5b117e,_0x390800){return function(_0x4cb2fc){if(_0x4cb2fc){var _0x47d36f=typeof _0x390800[_0xf9e8('0x2a')]===_0xf9e8('0x2b')&&typeof _0x390800[_0xf9e8('0x2c')]===_0xf9e8('0x2b');var _0x391d49=_0x4cb2fc[_0xf9e8('0x2d')];var _0x4c2026=_0x47d36f?0x0:_0x390800[_0xf9e8('0x2a')];var _0x46e3a1=_0x47d36f?_0x4cb2fc[_0xf9e8('0x2d')]:_0x390800[_0xf9e8('0x2a')]+_0x390800[_0xf9e8('0x2c')];var _0x24ccbb;if(_0x46e3a1>=_0x391d49){_0x46e3a1=_0x391d49;_0x24ccbb=0xc8;}else{_0x24ccbb=0xce;}_0x5b117e[_0xf9e8('0x27')](_0x24ccbb);return _0x5b117e['set'](_0xf9e8('0x2e'),_0x4c2026+'-'+_0x46e3a1+'/'+_0x391d49)[_0xf9e8('0x29')](_0x4cb2fc);}return null;};}function saveUpdates(_0x250bc3){return function(_0x605a37){if(_0x605a37){return _0x605a37[_0xf9e8('0x2f')](_0x250bc3)[_0xf9e8('0x1a')](function(_0x4fa590){return _0x4fa590;});}return null;};}function removeEntity(_0x362ed2){return function(_0x384697){if(_0x384697){return _0x384697[_0xf9e8('0x30')]()[_0xf9e8('0x1a')](function(){_0x362ed2[_0xf9e8('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23fa6d){return function(_0x2e6140){if(!_0x2e6140){_0x23fa6d[_0xf9e8('0x26')](0x194);}return _0x2e6140;};}function handleError(_0x158059,_0x4f2a1d){_0x4f2a1d=_0x4f2a1d||0x1f4;return function(_0x655206){logger[_0xf9e8('0x20')](_0x655206[_0xf9e8('0x31')]);if(_0x655206[_0xf9e8('0x32')]){delete _0x655206[_0xf9e8('0x32')];}_0x158059[_0xf9e8('0x27')](_0x4f2a1d)[_0xf9e8('0x33')](_0x655206);};}function getMustacheRender(_0x421bea,_0x20cb30){return Mustache['render'](_0x421bea,_[_0xf9e8('0x34')](_0x20cb30[_0xf9e8('0x35')],{'contact':_0x20cb30[_0xf9e8('0x36')],'message':_0x20cb30[_0xf9e8('0x23')],'agent':_0x20cb30[_0xf9e8('0x37')],'interaction':_0x20cb30[_0xf9e8('0x38')],'account':_0x20cb30['account']}))||'';}exports[_0xf9e8('0x39')]=function(_0x22c70a,_0x42a740){var _0x22fc7c={};var _0x457e87=_[_0xf9e8('0x3a')](db[_0xf9e8('0x3b')][_0xf9e8('0x3c')],function(_0x2c8504){return{'name':_0x2c8504[_0xf9e8('0x3d')],'type':_0x2c8504['type'][_0xf9e8('0x3e')]};});_0x22fc7c=qs['getOptions'](_0x457e87,_0x22c70a);return interaction[_0xf9e8('0x3f')](_0xf9e8('0x40'),_0x22c70a[_0xf9e8('0x41')],_0x22c70a['user'],_0x22fc7c,_0x457e87)['then'](respondWithFilteredResult(_0x42a740,_0x22fc7c))[_0xf9e8('0x25')](handleError(_0x42a740,null));};exports[_0xf9e8('0x42')]=function(_0x3e8641,_0x4130ba){var _0xfba891={'raw':![],'where':{'id':_0x3e8641['params']['id']}},_0xd996cf={};_0xd996cf['model']=_['keys'](db[_0xf9e8('0x3b')][_0xf9e8('0x3c')]);_0xd996cf[_0xf9e8('0x41')]=_[_0xf9e8('0x43')](_0x3e8641[_0xf9e8('0x41')]);_0xd996cf['filters']=_[_0xf9e8('0x44')](_0xd996cf[_0xf9e8('0x45')],_0xd996cf[_0xf9e8('0x41')]);_0xfba891[_0xf9e8('0x46')]=_[_0xf9e8('0x44')](_0xd996cf['model'],qs[_0xf9e8('0x47')](_0x3e8641[_0xf9e8('0x41')]['fields']));_0xfba891[_0xf9e8('0x46')]=_0xfba891[_0xf9e8('0x46')][_0xf9e8('0x48')]?_0xfba891[_0xf9e8('0x46')]:_0xd996cf[_0xf9e8('0x45')];if(_0x3e8641[_0xf9e8('0x41')]['includeAll']){_0xfba891['include']=[{'all':!![]}];}_0xfba891=_[_0xf9e8('0x34')]({},_0xfba891,_0x3e8641['options']);return db[_0xf9e8('0x3b')]['find'](_0xfba891)[_0xf9e8('0x1a')](handleEntityNotFound(_0x4130ba,null))['then'](respondWithResult(_0x4130ba,null))[_0xf9e8('0x25')](handleError(_0x4130ba,null));};exports['create']=function(_0x5e2551,_0x2947a5){return db[_0xf9e8('0x3b')][_0xf9e8('0x49')](_0x5e2551[_0xf9e8('0x35')],{})[_0xf9e8('0x1a')](respondWithResult(_0x2947a5,0xc9))[_0xf9e8('0x25')](handleError(_0x2947a5,null));};exports[_0xf9e8('0x2f')]=function(_0x58ae1a,_0x30f3a8){if(_0x58ae1a[_0xf9e8('0x35')]['id']){delete _0x58ae1a['body']['id'];}return db[_0xf9e8('0x3b')][_0xf9e8('0x4a')]({'where':{'id':_0x58ae1a[_0xf9e8('0x4b')]['id']}})[_0xf9e8('0x1a')](handleEntityNotFound(_0x30f3a8,null))[_0xf9e8('0x1a')](saveUpdates(_0x58ae1a[_0xf9e8('0x35')],null))['then'](respondWithResult(_0x30f3a8,null))['catch'](handleError(_0x30f3a8,null));};exports[_0xf9e8('0x30')]=function(_0x2f3891,_0x3c8c16){return db[_0xf9e8('0x3b')][_0xf9e8('0x4a')]({'where':{'id':_0x2f3891['params']['id']}})[_0xf9e8('0x1a')](handleEntityNotFound(_0x3c8c16,null))[_0xf9e8('0x1a')](removeEntity(_0x3c8c16,null))[_0xf9e8('0x25')](handleError(_0x3c8c16,null));};exports[_0xf9e8('0x4c')]=function(_0x2193fd,_0x435eb4){return db[_0xf9e8('0x3b')][_0xf9e8('0x4c')]()[_0xf9e8('0x1a')](respondWithResult(_0x435eb4,null))['catch'](handleError(_0x435eb4,null));};exports[_0xf9e8('0x4d')]=function(_0x220829,_0x438540){var _0x46c08b=_0x220829[_0xf9e8('0x4b')]['id'];var _0x254759;var _0xa35565;var _0x59b552;return db[_0xf9e8('0x3b')][_0xf9e8('0x4e')]({'where':{'id':_0x46c08b}})['then'](function(_0x502ef5){_0x254759=_0x502ef5;return db[_0xf9e8('0x4f')][_0xf9e8('0x4e')]({'where':{'id':_0x502ef5[_0xf9e8('0x50')]},'attributes':['id',_0xf9e8('0x51'),_0xf9e8('0x52'),'vidaooTopic',_0xf9e8('0x53'),_0xf9e8('0x54')],'raw':!![]});})[_0xf9e8('0x1a')](function(_0x4ba96c){if(_0x4ba96c&&_0x4ba96c[_0xf9e8('0x51')]&&_0x4ba96c[_0xf9e8('0x52')]){_0xa35565=_0x4ba96c;var _0x365e47={'interaction':{'id':_0x46c08b},'agent':{'id':_0x220829['user']['id'],'name':_0x220829[_0xf9e8('0x55')]['name'],'fullname':_0x220829[_0xf9e8('0x55')][_0xf9e8('0x56')],'email':_0x220829[_0xf9e8('0x55')][_0xf9e8('0x57')]},'contact':_0x220829['body'][_0xf9e8('0x36')],'account':_0x220829[_0xf9e8('0x35')]['account']};var _0x1fc2ce={'rejectUnauthorized':![],'method':_0xf9e8('0x58'),'url':_0xf9e8('0x59'),'headers':{'X-APIKEY':_0x4ba96c[_0xf9e8('0x51')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x220829[_0xf9e8('0x55')][_0xf9e8('0x57')]],'buttons':null,'topic':_0xa35565[_0xf9e8('0x5a')],'note':_[_0xf9e8('0x5b')](_0xa35565[_0xf9e8('0x53')])?null:getMustacheRender(_0xa35565[_0xf9e8('0x53')],_0x365e47),'metadata':null},'redirect':_0xf9e8('0x5c'),'json':!![]};try{if(!_[_0xf9e8('0x5b')](_0xa35565['vidaooMetadata'])){var _0xe7d082=getMustacheRender(_0xa35565[_0xf9e8('0x54')],_0x365e47);var _0x4c31b7=JSON[_0xf9e8('0x5d')](_0xe7d082);_0x1fc2ce[_0xf9e8('0x35')][_0xf9e8('0x5e')]=_0x4c31b7;}}catch(_0x2a21b8){throw new db[(_0xf9e8('0x5f'))][(_0xf9e8('0x60'))](_0xf9e8('0x61'));}return rp(_0x1fc2ce);}else{throw new db['Sequelize'][(_0xf9e8('0x60'))](_0xf9e8('0x62'));}})[_0xf9e8('0x1a')](function(_0x48b8f4){_0x59b552=_0x48b8f4;if(_0x59b552['id']){var _0x4d186f={'body':_0x59b552['join_url'],'ChatWebsiteId':_0xa35565['id'],'ChatInteractionId':_0x254759['id'],'direction':_0xf9e8('0x63'),'UserId':_0x220829[_0xf9e8('0x55')]['id']};return db[_0xf9e8('0x64')]['create'](_0x4d186f,{});}else{throw new db[(_0xf9e8('0x5f'))][(_0xf9e8('0x60'))](_0xf9e8('0x65'));}})[_0xf9e8('0x1a')](function(){return _0x254759['updateAttributes']({'vidaooSessionId':_0x59b552['id']});})[_0xf9e8('0x1a')](respondWithResult(_0x438540,null))[_0xf9e8('0x25')](handleError(_0x438540,null));};exports[_0xf9e8('0x66')]=function(_0x3fed70,_0x296b54){if(_0x3fed70['body']['id']){delete _0x3fed70['body']['id'];}return db[_0xf9e8('0x3b')]['find']({'where':{'id':_0x3fed70[_0xf9e8('0x4b')]['id']},'include':[{'model':db[_0xf9e8('0x67')],'as':_0xf9e8('0x68')}]})[_0xf9e8('0x1a')](handleEntityNotFound(_0x296b54,null))['then'](saveUpdates(_0x3fed70[_0xf9e8('0x35')],null))[_0xf9e8('0x1a')](respondWithResult(_0x296b54,null))[_0xf9e8('0x25')](handleError(_0x296b54,null));};exports[_0xf9e8('0x69')]=function(_0x39ab94,_0x1cc99d){if(_0x39ab94[_0xf9e8('0x35')]['id']){delete _0x39ab94['body']['id'];}return db['ChatInteraction'][_0xf9e8('0x4a')]({'where':{'id':_0x39ab94[_0xf9e8('0x4b')]['id']}})[_0xf9e8('0x1a')](function(_0x3aa2f6){if(!_0x3aa2f6){logger[_0xf9e8('0x20')](_0xf9e8('0x6a'),_0xf9e8('0x69'),0x194,_0xf9e8('0x6b'));_0x1cc99d[_0xf9e8('0x26')](0x194);}else{if(_0x3aa2f6[_0xf9e8('0x6c')]){throw new db[(_0xf9e8('0x5f'))][(_0xf9e8('0x60'))](_0xf9e8('0x6d'));}}return _0x3aa2f6;})['then'](function(_0x4dba95){if(_0x4dba95){return _0x4dba95['update']({'closed':_0x39ab94[_0xf9e8('0x35')][_0xf9e8('0x6e')],'disposition':_0x39ab94[_0xf9e8('0x35')]['disposition']})[_0xf9e8('0x1a')](function(_0x46d979){return _0x46d979;});}})['then'](function(){return respondWithRpcPromise(_0xf9e8('0x6f'),_0xf9e8('0x69'),_0x39ab94[_0xf9e8('0x35')],client9004);})[_0xf9e8('0x1a')](respondWithResult(_0x1cc99d,null))[_0xf9e8('0x25')](handleError(_0x1cc99d,null));};exports[_0xf9e8('0x70')]=function(_0x3e6cb7,_0xe0e324){_0x3e6cb7[_0xf9e8('0x35')]['name']=_0x3e6cb7[_0xf9e8('0x71')][_0xf9e8('0x72')];_0x3e6cb7[_0xf9e8('0x35')][_0xf9e8('0x73')]=_0x3e6cb7[_0xf9e8('0x71')][_0xf9e8('0x74')];_0x3e6cb7['body'][_0xf9e8('0x75')]=_0x3e6cb7['file']['mimetype'];return db[_0xf9e8('0x76')]['create'](_0x3e6cb7[_0xf9e8('0x35')])[_0xf9e8('0x1a')](respondWithResult(_0xe0e324,0xc9))[_0xf9e8('0x25')](handleError(_0xe0e324,null));};exports['attachmentDownload']=function(_0x4f8072,_0x3844fb){return db[_0xf9e8('0x3b')]['findOne']({'where':{'id':_0x4f8072['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x3844fb,null))[_0xf9e8('0x1a')](function(_0x397959){if(_0x397959){if(_0x397959[_0xf9e8('0x6e')]){return _0x3844fb[_0xf9e8('0x27')](0x193)['json']({'status':0x193,'message':_0xf9e8('0x77')});}return db[_0xf9e8('0x76')][_0xf9e8('0x4e')]({'where':{'id':_0x4f8072['query'][_0xf9e8('0x78')]},'raw':!![]})['then'](handleEntityNotFound(_0x3844fb,null));}})[_0xf9e8('0x1a')](function(_0x2a4ab5){if(_0x2a4ab5){var _0x41b74a=_0x2a4ab5[_0xf9e8('0x79')]!==null;var _0x51e067=path[_0xf9e8('0x7a')](config[_0xf9e8('0x7b')],'server/files/attachments/');if(_0x41b74a){_0x51e067=path['join'](_0x51e067,_0xf9e8('0x7c'));}var _0x299a63=path['join'](_0x51e067,_0x2a4ab5['basename']);return _0x3844fb[_0xf9e8('0x7d')](_0x299a63);}})[_0xf9e8('0x25')](handleError(_0x3844fb,null));};exports[_0xf9e8('0x7e')]=function(_0x4ebb67,_0x2a25ff){var _0x8d736a=null;var _0x5d27be=null;var _0x2308bc=null;if(_0x4ebb67[_0xf9e8('0x35')]['id']){delete _0x4ebb67[_0xf9e8('0x35')]['id'];}if(_0x4ebb67[_0xf9e8('0x35')]['mailTranscript']){_0x2308bc=path['join'](config[_0xf9e8('0x7b')],'server/files/chat/upload/',util[_0xf9e8('0x7f')](_0xf9e8('0x80'),Date[_0xf9e8('0x81')]()));_0x4ebb67['body'][_0xf9e8('0x82')]=_0x2308bc;}return db[_0xf9e8('0x3b')][_0xf9e8('0x4a')]({'where':{'id':_0x4ebb67['params']['id']},'include':[{'model':db[_0xf9e8('0x64')],'as':_0xf9e8('0x83'),'include':[{'model':db['User'],'as':_0xf9e8('0x84')}]}]})[_0xf9e8('0x1a')](handleEntityNotFound(_0x2a25ff,null))['then'](saveUpdates(_0x4ebb67[_0xf9e8('0x35')],null))[_0xf9e8('0x1a')](function(_0x497608){if(_0x497608){_0x8d736a=_0x497608;return db['ChatWebsite'][_0xf9e8('0x4a')]({'where':{'id':_0x8d736a[_0xf9e8('0x50')]}});}})['then'](function(_0x160a67){if(_0x160a67){_0x5d27be=_0x160a67;return db['CmContact']['find']({'where':{'id':_0x8d736a[_0xf9e8('0x85')]}});}})[_0xf9e8('0x1a')](function(_0xb8450d){if(_0xb8450d){if(_0x2308bc){var _0x485be8=null;for(var _0x1c7315=0x1;_0x1c7315<_0x8d736a[_0xf9e8('0x83')][_0xf9e8('0x48')];++_0x1c7315){_0x485be8=_0x8d736a[_0xf9e8('0x83')][_0x1c7315];var _0x2364d4=_0x485be8[_0xf9e8('0x6c')]?util[_0xf9e8('0x7f')](_0xf9e8('0x86'),_0x5d27be[_0xf9e8('0x87')],_0x485be8[_0xf9e8('0x6c')]):_0xf9e8('0x88');var _0x52c929=_0x4ebb67[_0xf9e8('0x35')][_0xf9e8('0x89')]||util['format'](_0xf9e8('0x86'),_0xf9e8('0x8a'),_0x485be8[_0xf9e8('0x85')]);switch(_0x5d27be[_0xf9e8('0x8b')]){case _0xf9e8('0x8c'):_0x2364d4=_0x485be8['UserId']?util[_0xf9e8('0x7f')](_0xf9e8('0x86'),_0x5d27be[_0xf9e8('0x87')],_0x485be8[_0xf9e8('0x6c')]):_0xf9e8('0x88');break;case _0xf9e8('0x8d'):_0x2364d4=_0x485be8[_0xf9e8('0x6c')]?_0x485be8[_0xf9e8('0x84')][_0xf9e8('0x8e')]||_0x485be8[_0xf9e8('0x84')][_0xf9e8('0x56')]:_0xf9e8('0x88');break;case _0xf9e8('0x8f'):_0x2364d4=_0x485be8[_0xf9e8('0x6c')]?_0x485be8[_0xf9e8('0x84')]['fullname']:_0xf9e8('0x88');break;default:_0x2364d4=_0x485be8[_0xf9e8('0x6c')]?util[_0xf9e8('0x7f')](_0xf9e8('0x86'),_0x5d27be[_0xf9e8('0x87')],_0x485be8[_0xf9e8('0x6c')]):'System';}var _0x79be27=util['format'](_0xf9e8('0x90'),moment(_0x485be8[_0xf9e8('0x91')])[_0xf9e8('0x7f')]('MM/DD/YYYY\x20HH:mm:ss'),_0x485be8[_0xf9e8('0x92')]==='in'?_0x52c929:_0x2364d4,_0x485be8['body']);if(!_0x485be8['secret']){fs[_0xf9e8('0x93')](_0x2308bc,_0x79be27);}}return db[_0xf9e8('0x94')]['findOne']({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0xf9e8('0x95')],'as':'CloudProvider','raw':!![]}]}]});}}})['then'](function(_0x1a01b2){if(!_0x1a01b2||!_0x1a01b2[_0xf9e8('0x96')]||!_0x4ebb67[_0xf9e8('0x35')])return _0x8d736a;var _0x589770=_0x1a01b2['getSmtpOptions']();return respondWithRpcPromise(_0xf9e8('0x97'),_0xf9e8('0x98'),{'account':_0x589770,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x1a01b2[_0xf9e8('0x32')],_0x1a01b2['email']||_0x1a01b2['Smtp'][_0xf9e8('0x55')]),'to':_0x4ebb67[_0xf9e8('0x35')]['mailTranscript'],'subject':_0xf9e8('0x99'),'text':util[_0xf9e8('0x7f')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x4ebb67[_0xf9e8('0x35')][_0xf9e8('0x9a')]),'attachments':[{'path':_0x2308bc}]}})[_0xf9e8('0x1a')](function(){return _0x8d736a;})[_0xf9e8('0x25')](function(_0x296839){logger['error'](_0x296839);});})[_0xf9e8('0x1a')](respondWithStatusCode(_0x2a25ff,0xc8))['catch'](handleError(_0x2a25ff,null));};exports['addMessage']=function(_0x3c44c1,_0x2ecbda){return db[_0xf9e8('0x64')][_0xf9e8('0x4a')]({'where':{'id':_0x3c44c1[_0xf9e8('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2ecbda,null))['then'](function(_0x48cdea){if(_0x48cdea){return _0x48cdea['addMessage'](_0x3c44c1[_0xf9e8('0x35')][_0xf9e8('0x9b')],_[_0xf9e8('0x9c')](_0x3c44c1[_0xf9e8('0x35')],[_0xf9e8('0x9b'),'id'])||{});}})[_0xf9e8('0x1a')](respondWithResult(_0x2ecbda,null))['catch'](handleError(_0x2ecbda,null));};exports[_0xf9e8('0x9d')]=function(_0x20b2f1,_0x5dbcfa){var _0x15cabf={'raw':![],'where':{}};var _0x36f9c1={};var _0x1d76ca={'count':0x0,'rows':[]};return db[_0xf9e8('0x3b')][_0xf9e8('0x4e')]({'where':{'id':_0x20b2f1[_0xf9e8('0x4b')]['id']}})[_0xf9e8('0x1a')](handleEntityNotFound(_0x5dbcfa,null))[_0xf9e8('0x1a')](function(_0x85bbe8){if(_0x85bbe8){_0x36f9c1[_0xf9e8('0x45')]=_[_0xf9e8('0x43')](db[_0xf9e8('0x64')][_0xf9e8('0x3c')]);_0x36f9c1[_0xf9e8('0x41')]=_['keys'](_0x20b2f1[_0xf9e8('0x41')]);_0x36f9c1[_0xf9e8('0x9e')]=_[_0xf9e8('0x44')](_0x36f9c1['model'],_0x36f9c1[_0xf9e8('0x41')]);_0x15cabf[_0xf9e8('0x46')]=_['intersection'](_0x36f9c1[_0xf9e8('0x45')],qs[_0xf9e8('0x47')](_0x20b2f1[_0xf9e8('0x41')][_0xf9e8('0x47')]));_0x15cabf[_0xf9e8('0x46')]=_0x15cabf[_0xf9e8('0x46')][_0xf9e8('0x48')]?_0x15cabf['attributes']:_0x36f9c1[_0xf9e8('0x45')];if(!_0x20b2f1[_0xf9e8('0x41')][_0xf9e8('0x9f')](_0xf9e8('0xa0'))){_0x15cabf['limit']=qs[_0xf9e8('0x2c')](_0x20b2f1[_0xf9e8('0x41')][_0xf9e8('0x2c')]);_0x15cabf[_0xf9e8('0x2a')]=qs[_0xf9e8('0x2a')](_0x20b2f1[_0xf9e8('0x41')][_0xf9e8('0x2a')]);}_0x15cabf[_0xf9e8('0xa1')]=qs['sort'](_0x20b2f1[_0xf9e8('0x41')][_0xf9e8('0xa2')]);_0x15cabf[_0xf9e8('0xa3')]=qs[_0xf9e8('0x9e')](_[_0xf9e8('0xa4')](_0x20b2f1[_0xf9e8('0x41')],_0x36f9c1[_0xf9e8('0x9e')]));_0x15cabf[_0xf9e8('0xa3')][_0xf9e8('0xa5')]=_0x85bbe8['id'];if(_0x20b2f1[_0xf9e8('0x41')][_0xf9e8('0xa6')]){_0x15cabf['where']=_[_0xf9e8('0x34')](_0x15cabf[_0xf9e8('0xa3')],{'$or':_[_0xf9e8('0x3a')](_0x15cabf[_0xf9e8('0x46')],function(_0x433385){var _0x5cc7de={};_0x5cc7de[_0x433385]={'$like':'%'+_0x20b2f1[_0xf9e8('0x41')]['filter']+'%'};return _0x5cc7de;})});}if(_0x20b2f1[_0xf9e8('0x41')][_0xf9e8('0xa7')]){var _0x127568=_0x20b2f1[_0xf9e8('0x41')][_0xf9e8('0xa7')][_0xf9e8('0xa8')](',');var _0x3375fd={};_0x3375fd[_0x127568[0x0]]={'$gte':moment(_0x127568[0x1])[_0xf9e8('0x7f')](_0xf9e8('0xa9'))};_0x15cabf[_0xf9e8('0xa3')]=_[_0xf9e8('0x34')](_0x15cabf['where'],_0x3375fd);}_0x15cabf=_[_0xf9e8('0x34')]({},_0x15cabf,_0x20b2f1[_0xf9e8('0xaa')]);return db['ChatMessage'][_0xf9e8('0x2d')]({'where':_0x15cabf['where']})['then'](function(_0x31516f){_0x1d76ca[_0xf9e8('0x2d')]=_0x31516f;if(_0x20b2f1[_0xf9e8('0x41')][_0xf9e8('0xab')]){_0x15cabf[_0xf9e8('0xac')]=[{'all':!![]}];}return db[_0xf9e8('0x64')][_0xf9e8('0x3f')](_0x15cabf);})[_0xf9e8('0x1a')](function(_0x20c4c0){_0x1d76ca[_0xf9e8('0xad')]=_0x20c4c0;return _0x1d76ca;});}})[_0xf9e8('0x1a')](respondWithFilteredResult(_0x5dbcfa,_0x15cabf))['catch'](handleError(_0x5dbcfa,null));};exports['getMyMessages']=function(_0x51eb95,_0x42ceb8){var _0x26e8e0={'where':{}},_0x195a5e={},_0x911c7e={'count':0x0,'rows':[]};return db[_0xf9e8('0x3b')][_0xf9e8('0x4e')]({'where':{'id':_0x51eb95['params']['id']}})['then'](handleEntityNotFound(_0x42ceb8,null))[_0xf9e8('0x1a')](function(_0x3febac){if(_0x3febac){_0x195a5e['model']=_[_0xf9e8('0x43')](db['ChatMessage'][_0xf9e8('0x3c')]);_0x195a5e[_0xf9e8('0x41')]=_[_0xf9e8('0x43')](_0x51eb95['query']);_0x195a5e[_0xf9e8('0x9e')]=_[_0xf9e8('0x44')](_0x195a5e[_0xf9e8('0x45')],_0x195a5e[_0xf9e8('0x41')]);_0x26e8e0[_0xf9e8('0x46')]=_[_0xf9e8('0x44')](_0x195a5e[_0xf9e8('0x45')],qs[_0xf9e8('0x47')](_0x51eb95[_0xf9e8('0x41')][_0xf9e8('0x47')]));_0x26e8e0[_0xf9e8('0x46')]=_0x26e8e0[_0xf9e8('0x46')]['length']?_0x26e8e0[_0xf9e8('0x46')]:_0x195a5e[_0xf9e8('0x45')];if(!_0x51eb95[_0xf9e8('0x41')][_0xf9e8('0x9f')](_0xf9e8('0xa0'))){_0x26e8e0[_0xf9e8('0x2c')]=qs[_0xf9e8('0x2c')](_0x51eb95[_0xf9e8('0x41')][_0xf9e8('0x2c')]);_0x26e8e0[_0xf9e8('0x2a')]=qs[_0xf9e8('0x2a')](_0x51eb95['query'][_0xf9e8('0x2a')]);}_0x26e8e0[_0xf9e8('0xa1')]=qs[_0xf9e8('0xa2')](_0x51eb95[_0xf9e8('0x41')][_0xf9e8('0xa2')]);_0x26e8e0['where']=qs[_0xf9e8('0x9e')](_[_0xf9e8('0xa4')](_0x51eb95[_0xf9e8('0x41')],_0x195a5e[_0xf9e8('0x9e')]));_0x26e8e0['where'][_0xf9e8('0xa5')]=_0x3febac['id'];if(_0x51eb95[_0xf9e8('0x41')][_0xf9e8('0xa6')]){_0x26e8e0[_0xf9e8('0xa3')]=_[_0xf9e8('0x34')](_0x26e8e0[_0xf9e8('0xa3')],{'$or':_[_0xf9e8('0x3a')](_0x26e8e0[_0xf9e8('0x46')],function(_0x213c4){var _0x15196e={};_0x15196e[_0x213c4]={'$like':'%'+_0x51eb95[_0xf9e8('0x41')][_0xf9e8('0xa6')]+'%'};return _0x15196e;})});}_0x26e8e0['where'][_0xf9e8('0xae')]=![];if(_0x51eb95[_0xf9e8('0x41')]['id']){_0x26e8e0[_0xf9e8('0xa3')]['id']={'$gt':_0x51eb95['query']['id']};}_0x26e8e0=_[_0xf9e8('0x34')]({},_0x26e8e0,_0x51eb95[_0xf9e8('0xaa')]);return db['ChatMessage'][_0xf9e8('0x2d')]({'where':_0x26e8e0[_0xf9e8('0xa3')]})['then'](function(_0x2e4235){_0x911c7e[_0xf9e8('0x2d')]=_0x2e4235;_0x26e8e0['include']=[];if(_0x51eb95[_0xf9e8('0x41')][_0xf9e8('0xaf')]){_0x26e8e0[_0xf9e8('0xac')]['push']({'model':db['User'],'as':_0xf9e8('0x84'),'attributes':['id',_0xf9e8('0x56'),'alias']});}if(_0x51eb95['query'][_0xf9e8('0xab')]){_0x26e8e0[_0xf9e8('0xac')]=[{'all':!![]}];}return db[_0xf9e8('0x64')][_0xf9e8('0x3f')](_0x26e8e0);})[_0xf9e8('0x1a')](function(_0x15e2df){_0x911c7e['rows']=_0x15e2df;return _0x911c7e;});}})['then'](respondWithFilteredResult(_0x42ceb8,_0x26e8e0))[_0xf9e8('0x25')](handleError(_0x42ceb8,null));};exports['addTags']=function(_0x544b24,_0xdfdfe5){return db[_0xf9e8('0x3b')]['find']({'where':{'id':_0x544b24['params']['id']}})['then'](handleEntityNotFound(_0xdfdfe5,null))[_0xf9e8('0x1a')](function(_0x1ddede){if(_0x1ddede){return _0x1ddede[_0xf9e8('0xb0')](_0x544b24[_0xf9e8('0x35')]['ids'],_['omit'](_0x544b24[_0xf9e8('0x35')],[_0xf9e8('0x9b'),'id'])||{})[_0xf9e8('0xb1')](function(){return db[_0xf9e8('0xb2')][_0xf9e8('0x3f')]({'attributes':['id','name',_0xf9e8('0xb3')],'where':{'id':_0x544b24[_0xf9e8('0x35')][_0xf9e8('0x9b')]}});})[_0xf9e8('0x1a')](function(_0x2450fb){socket['emit'](_0xf9e8('0xb4'),{'id':Number(_0x544b24[_0xf9e8('0x4b')]['id']),'tags':_0x2450fb||[]});return{'id':Number(_0x544b24[_0xf9e8('0x4b')]['id']),'tags':_0x2450fb||[]};});}})[_0xf9e8('0x1a')](respondWithResult(_0xdfdfe5,null))[_0xf9e8('0x25')](handleError(_0xdfdfe5,null));};exports[_0xf9e8('0xb5')]=function(_0x55f798,_0x4a626b){return db[_0xf9e8('0x3b')][_0xf9e8('0x4a')]({'where':{'id':_0x55f798[_0xf9e8('0x4b')]['id']}})[_0xf9e8('0x1a')](handleEntityNotFound(_0x4a626b,null))[_0xf9e8('0x1a')](function(_0xa9915a){if(_0xa9915a){return _0xa9915a['removeTags'](_0x55f798[_0xf9e8('0x41')][_0xf9e8('0x9b')]);}})[_0xf9e8('0x1a')](respondWithStatusCode(_0x4a626b,null))[_0xf9e8('0x25')](handleError(_0x4a626b,null));};exports['download']=function(_0x1f9fe5,_0x1d98ac){var _0x360d80=moment()['unix']()['toString']();var _0x71b4ac=path[_0xf9e8('0x7a')](config['root'],_0xf9e8('0xb6'),_0xf9e8('0xb7'),_0xf9e8('0xb8'));var _0x5a3449=path[_0xf9e8('0x7a')](config[_0xf9e8('0x7b')],_0xf9e8('0xb6'),_0xf9e8('0xb7'),_0xf9e8('0xb9'));var _0x2da2b8=path[_0xf9e8('0x7a')](_0x71b4ac,_0x360d80);var _0x157bd6=util['format'](_0xf9e8('0xba'),_0x1f9fe5[_0xf9e8('0x4b')]['id'],_0x360d80);var _0x1b7542=path[_0xf9e8('0x7a')](_0x71b4ac,_0x157bd6);var _0x142d84=[];_0x142d84[_0xf9e8('0xbb')]({'model':db[_0xf9e8('0x84')],'as':_0xf9e8('0x84'),'attributes':['id','fullname'],'raw':!![]});_0x142d84[_0xf9e8('0xbb')]({'model':db[_0xf9e8('0x67')],'as':_0xf9e8('0x68'),'attributes':['id',_0xf9e8('0xbc'),_0xf9e8('0xbd')],'raw':!![]});if(_0x1f9fe5[_0xf9e8('0x41')][_0xf9e8('0xb9')]){_0x142d84[_0xf9e8('0xbb')]({'model':db['Attachment'],'as':_0xf9e8('0x76'),'raw':!![]});}var _0x3178f5=[{'model':db[_0xf9e8('0x64')],'as':_0xf9e8('0x83'),'attributes':['id','body',_0xf9e8('0x91'),'direction',_0xf9e8('0xae'),_0xf9e8('0xbe')],'include':_0x142d84}];_0x3178f5[_0xf9e8('0xbb')]({'model':db[_0xf9e8('0x4f')],'as':_0xf9e8('0xbf'),'attributes':['id',_0xf9e8('0x32')]});_0x3178f5[_0xf9e8('0xbb')]({'model':db[_0xf9e8('0x84')],'as':_0xf9e8('0xc0'),'attributes':['id','fullname']});return db['ChatInteraction'][_0xf9e8('0x4a')]({'where':{'id':_0x1f9fe5[_0xf9e8('0x4b')]['id']},'include':_0x3178f5})['then'](handleEntityNotFound(_0x1d98ac,null))[_0xf9e8('0x1a')](function(_0x3a8eb2){if(_0x3a8eb2){var _0x503f18=_0x3a8eb2[_0xf9e8('0xc1')]({'plain':!![]});fs[_0xf9e8('0xc2')](_0x2da2b8);var _0x4739e6={'channel':_0xf9e8('0xc3'),'account':_0x503f18[_0xf9e8('0xbf')][_0xf9e8('0x32')],'agent':_0x503f18[_0xf9e8('0xc0')]?_0x503f18[_0xf9e8('0xc0')][_0xf9e8('0x56')]:_0xf9e8('0xc4'),'createdAt':moment(_0x503f18[_0xf9e8('0x91')])[_0xf9e8('0x7f')](_0xf9e8('0xa9'))[_0xf9e8('0xc5')](),'closedAt':_0x503f18[_0xf9e8('0x6e')]?moment(_0x503f18[_0xf9e8('0xc6')])[_0xf9e8('0x7f')]('YYYY-MM-DD\x20HH:mm:ss')[_0xf9e8('0xc5')]():'','disposition':_0x503f18['disposition'],'chatInfo':{'browser':_0x503f18[_0xf9e8('0xc7')],'os':_0x503f18[_0xf9e8('0xc8')],'referer':_0x503f18[_0xf9e8('0xc9')],'customerIp':_0x503f18['customerIp'],'customerPort':_0x503f18[_0xf9e8('0xca')]?_0x503f18[_0xf9e8('0xca')]:_0xf9e8('0xc4')},'messages':_(_0x503f18['Messages'])[_0xf9e8('0xcb')]()['filter']({'secret':![]})[_0xf9e8('0x3a')](function(_0x15f8a9){if(_0x15f8a9['Attachment']){var _0x3b8c5d=path['join'](_0x5a3449,_0x15f8a9[_0xf9e8('0x76')][_0xf9e8('0x73')]);if(fs[_0xf9e8('0xcc')](_0x3b8c5d)){fs[_0xf9e8('0xcd')](_0x3b8c5d)[_0xf9e8('0xce')](fs['createWriteStream'](path[_0xf9e8('0x7a')](_0x2da2b8,_0x15f8a9[_0xf9e8('0x76')]['basename'])));}}return{'date':moment(_0x15f8a9[_0xf9e8('0x91')])[_0xf9e8('0x7f')](_0xf9e8('0xa9'))[_0xf9e8('0xc5')](),'sender':_0x15f8a9[_0xf9e8('0x92')]===_0xf9e8('0x63')?_0x15f8a9['User']?_0x15f8a9[_0xf9e8('0x84')][_0xf9e8('0x56')]:_0xf9e8('0x88'):_0x15f8a9[_0xf9e8('0x68')][_0xf9e8('0xbc')]+(_0x15f8a9[_0xf9e8('0x68')][_0xf9e8('0xbd')]?'\x20'+_0x15f8a9[_0xf9e8('0x68')][_0xf9e8('0xbd')]:''),'body':_0x15f8a9['Attachment']?_0x15f8a9[_0xf9e8('0x76')][_0xf9e8('0x73')]:_0x15f8a9[_0xf9e8('0x35')],'direction':_0x15f8a9[_0xf9e8('0x92')]==='out'?'A':'C','secret':_0x15f8a9['secret'],'read':_0x15f8a9[_0xf9e8('0xbe')],'attachment':_0x15f8a9[_0xf9e8('0x76')]};})[_0xf9e8('0xcf')]()};return ejs[_0xf9e8('0xd0')](path['join'](config['root'],'server',_0xf9e8('0xd1'),_0xf9e8('0xd2')),{'interaction':_0x4739e6})['then'](function(_0x5ef895){var _0x5dead2=path[_0xf9e8('0x7a')](_0x2da2b8,_0xf9e8('0xd3')+_0x503f18['id']+'-'+_0x360d80+'.pdf');var _0x4e4893={'path':_0x5dead2,'channel':_0xf9e8('0xc3'),'interactionId':_0x503f18['id']};return pdf[_0xf9e8('0xd4')](_0x5ef895,_0x4e4893);})[_0xf9e8('0x1a')](function(){return new Promise(function(_0x52d786,_0x208bc3){zipdir(_0x2da2b8,{'saveTo':_0x1b7542},function(_0x33f21d,_0x3e8288){if(_0x33f21d)return _0x208bc3(_0x33f21d);return _0x52d786(_0x3e8288);});})[_0xf9e8('0x1a')](function(){return new BPromise(function(_0x2fb561,_0x5b8dbd){rimraf(_0x2da2b8,function(_0x396318){if(_0x396318)_0x5b8dbd(_0x396318);return _0x2fb561();});});})[_0xf9e8('0x1a')](function(){return _0x1d98ac[_0xf9e8('0x7d')](_0x1b7542,_0x157bd6,function(_0x64a449){if(_0x64a449){logger[_0xf9e8('0x20')](_0xf9e8('0xd5'),_0x64a449);}else{fs['unlinkSync'](_0x1b7542);}});});});}else{return _0x1d98ac['sendStatus'](0xc8);}})[_0xf9e8('0x25')](handleError(_0x1d98ac,null));}; \ No newline at end of file +var _0x67be=['localhost','socket.io-emitter','register','jayson/promise','http','client','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','name','render','body','contact','agent','interaction','account','index','map','ChatInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','chat','query','user','show','params','model','keys','filters','intersection','fields','attributes','includeAll','include','merge','options','create','find','destroy','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','fullname','email','follow','isNull','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','out','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','CmContact','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','disposition','AbandonInteraction','abandon','attachmentUpload','file','originalname','basename','attachmentDownload','closed','Attachment','ChatOfflineMessageId','join','offline-chat/','download','close','mailTranscript','root','transcript-%s.txt','now','pathTranscript','ChatMessage','Messages','User','ContactId','length','format','%s%d','agentAlias','System','agentIdentifier','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','CloudProvider','Smtp','getSmtpOptions','SendMail','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','omit','ids','getMessages','hasOwnProperty','sort','where','pick','ChatInteractionId','filter','$gte','rows','getMyMessages','order','includeAgent','push','addTags','setTags','spread','color','emit','chatInteractionTags:save','removeTags','toString','server','tmp','transcript-%d-%s.zip','firstName','read','Account','Owner','get','mkdirSync','Chat','N.A.','YYYY-MM-DD\x20HH:mm:ss','browserName','osName','referer','customerPort','tail','existsSync','createWriteStream','lastName','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','defaults','redis'];(function(_0x597fc3,_0x39517c){var _0x2235f4=function(_0x2596f2){while(--_0x2596f2){_0x597fc3['push'](_0x597fc3['shift']());}};_0x2235f4(++_0x39517c);}(_0x67be,0x18a));var _0xe67b=function(_0x40ceb1,_0x970175){_0x40ceb1=_0x40ceb1-0x0;var _0x264e28=_0x67be[_0x40ceb1];return _0x264e28;};'use strict';var rimraf=require(_0xe67b('0x0'));var zipdir=require(_0xe67b('0x1'));var rp=require(_0xe67b('0x2'));var moment=require(_0xe67b('0x3'));var BPromise=require(_0xe67b('0x4'));var Mustache=require(_0xe67b('0x5'));var util=require('util');var path=require(_0xe67b('0x6'));var ejs=require(_0xe67b('0x7'));var fs=require('fs');var _=require(_0xe67b('0x8'));var Redis=require(_0xe67b('0x9'));var interaction=require(_0xe67b('0xa'));var qs=require(_0xe67b('0xb'));var pdf=require(_0xe67b('0xc'));var logger=require('../../config/logger')(_0xe67b('0xd'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0xe67b('0xe')](config[_0xe67b('0xf')],{'host':_0xe67b('0x10'),'port':0x18eb});var socket=require(_0xe67b('0x11'))(new Redis(config['redis']));require('./chatInteraction.socket')[_0xe67b('0x12')](socket);var jayson=require(_0xe67b('0x13'));var client=jayson['client'][_0xe67b('0x14')]({'port':0x232b});var client9004=jayson[_0xe67b('0x15')][_0xe67b('0x14')]({'port':0x232c});function respondWithRpcPromise(_0x4f9b01,_0x23764d,_0x31b5d2,_0x21eea5){return new BPromise(function(_0x474714,_0x205609){var _0x3da1fd=_0x21eea5||client;return _0x3da1fd[_0xe67b('0x16')](_0x4f9b01,_0x31b5d2)[_0xe67b('0x17')](function(_0x23a583){logger[_0xe67b('0x18')](_0xe67b('0x19'),_0x23764d,_0xe67b('0x1a'));logger[_0xe67b('0x1b')](_0xe67b('0x1c'),_0x23764d,_0xe67b('0x1a'),JSON[_0xe67b('0x1d')](_0x23a583));if(_0x23a583[_0xe67b('0x1e')]){if(_0x23a583[_0xe67b('0x1e')][_0xe67b('0x1f')]===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x23764d,_0x23a583['error'][_0xe67b('0x20')]);return _0x205609(_0x23a583[_0xe67b('0x1e')][_0xe67b('0x20')]);}logger[_0xe67b('0x1e')](_0xe67b('0x19'),_0x23764d,_0x23a583[_0xe67b('0x1e')][_0xe67b('0x20')]);return _0x474714(_0x23a583[_0xe67b('0x1e')][_0xe67b('0x20')]);}else{logger[_0xe67b('0x18')](_0xe67b('0x19'),_0x23764d,_0xe67b('0x1a'));_0x474714(_0x23a583[_0xe67b('0x21')]['message']);}})[_0xe67b('0x22')](function(_0x124e97){logger[_0xe67b('0x1e')](_0xe67b('0x19'),_0x23764d,_0x124e97);_0x205609(_0x124e97);});});}function respondWithStatusCode(_0x4f0f4b,_0x307518){_0x307518=_0x307518||0xcc;return function(_0x5dca44){if(_0x5dca44){return _0x4f0f4b[_0xe67b('0x23')](_0x307518);}return _0x4f0f4b[_0xe67b('0x24')](_0x307518)[_0xe67b('0x25')]();};}function respondWithResult(_0x5d787b,_0x41e571){_0x41e571=_0x41e571||0xc8;return function(_0x4474e7){if(_0x4474e7){return _0x5d787b['status'](_0x41e571)[_0xe67b('0x26')](_0x4474e7);}};}function respondWithFilteredResult(_0x324cad,_0x1c161f){return function(_0x1ce67f){if(_0x1ce67f){var _0x3ca2a0=typeof _0x1c161f[_0xe67b('0x27')]===_0xe67b('0x28')&&typeof _0x1c161f[_0xe67b('0x29')]===_0xe67b('0x28');var _0x2e6b28=_0x1ce67f[_0xe67b('0x2a')];var _0x241ac4=_0x3ca2a0?0x0:_0x1c161f[_0xe67b('0x27')];var _0x4886cf=_0x3ca2a0?_0x1ce67f[_0xe67b('0x2a')]:_0x1c161f[_0xe67b('0x27')]+_0x1c161f[_0xe67b('0x29')];var _0x856f25;if(_0x4886cf>=_0x2e6b28){_0x4886cf=_0x2e6b28;_0x856f25=0xc8;}else{_0x856f25=0xce;}_0x324cad['status'](_0x856f25);return _0x324cad[_0xe67b('0x2b')](_0xe67b('0x2c'),_0x241ac4+'-'+_0x4886cf+'/'+_0x2e6b28)[_0xe67b('0x26')](_0x1ce67f);}return null;};}function saveUpdates(_0x56b088){return function(_0x1f56fa){if(_0x1f56fa){return _0x1f56fa[_0xe67b('0x2d')](_0x56b088)['then'](function(_0x36d272){return _0x36d272;});}return null;};}function removeEntity(_0x106019){return function(_0x65a1aa){if(_0x65a1aa){return _0x65a1aa['destroy']()[_0xe67b('0x17')](function(){_0x106019[_0xe67b('0x24')](0xcc)[_0xe67b('0x25')]();});}};}function handleEntityNotFound(_0x3125f4){return function(_0x140633){if(!_0x140633){_0x3125f4[_0xe67b('0x23')](0x194);}return _0x140633;};}function handleError(_0x2bf3a7,_0x437b52){_0x437b52=_0x437b52||0x1f4;return function(_0x5dce04){logger[_0xe67b('0x1e')](_0x5dce04['stack']);if(_0x5dce04[_0xe67b('0x2e')]){delete _0x5dce04[_0xe67b('0x2e')];}_0x2bf3a7[_0xe67b('0x24')](_0x437b52)['send'](_0x5dce04);};}function getMustacheRender(_0x4994de,_0x165ce7){return Mustache[_0xe67b('0x2f')](_0x4994de,_['merge'](_0x165ce7[_0xe67b('0x30')],{'contact':_0x165ce7[_0xe67b('0x31')],'message':_0x165ce7[_0xe67b('0x20')],'agent':_0x165ce7[_0xe67b('0x32')],'interaction':_0x165ce7[_0xe67b('0x33')],'account':_0x165ce7[_0xe67b('0x34')]}))||'';}exports[_0xe67b('0x35')]=function(_0x30d40e,_0x2f406d){var _0x99a097={};var _0x9bd45a=_[_0xe67b('0x36')](db[_0xe67b('0x37')][_0xe67b('0x38')],function(_0x56bdcc){return{'name':_0x56bdcc[_0xe67b('0x39')],'type':_0x56bdcc[_0xe67b('0x3a')][_0xe67b('0x3b')]};});_0x99a097=qs[_0xe67b('0x3c')](_0x9bd45a,_0x30d40e);return interaction[_0xe67b('0x3d')](_0xe67b('0x3e'),_0x30d40e[_0xe67b('0x3f')],_0x30d40e[_0xe67b('0x40')],_0x99a097,_0x9bd45a)[_0xe67b('0x17')](respondWithFilteredResult(_0x2f406d,_0x99a097))[_0xe67b('0x22')](handleError(_0x2f406d,null));};exports[_0xe67b('0x41')]=function(_0x3f8447,_0x458bd1){var _0x531932={'raw':![],'where':{'id':_0x3f8447[_0xe67b('0x42')]['id']}},_0x5a2018={};_0x5a2018[_0xe67b('0x43')]=_[_0xe67b('0x44')](db[_0xe67b('0x37')]['rawAttributes']);_0x5a2018['query']=_[_0xe67b('0x44')](_0x3f8447[_0xe67b('0x3f')]);_0x5a2018[_0xe67b('0x45')]=_[_0xe67b('0x46')](_0x5a2018['model'],_0x5a2018[_0xe67b('0x3f')]);_0x531932['attributes']=_['intersection'](_0x5a2018[_0xe67b('0x43')],qs[_0xe67b('0x47')](_0x3f8447[_0xe67b('0x3f')]['fields']));_0x531932[_0xe67b('0x48')]=_0x531932[_0xe67b('0x48')]['length']?_0x531932['attributes']:_0x5a2018[_0xe67b('0x43')];if(_0x3f8447[_0xe67b('0x3f')][_0xe67b('0x49')]){_0x531932[_0xe67b('0x4a')]=[{'all':!![]}];}_0x531932=_[_0xe67b('0x4b')]({},_0x531932,_0x3f8447[_0xe67b('0x4c')]);return db['ChatInteraction']['find'](_0x531932)[_0xe67b('0x17')](handleEntityNotFound(_0x458bd1,null))[_0xe67b('0x17')](respondWithResult(_0x458bd1,null))[_0xe67b('0x22')](handleError(_0x458bd1,null));};exports[_0xe67b('0x4d')]=function(_0x38a67d,_0x29c6f8){return db['ChatInteraction'][_0xe67b('0x4d')](_0x38a67d[_0xe67b('0x30')],{})['then'](respondWithResult(_0x29c6f8,0xc9))['catch'](handleError(_0x29c6f8,null));};exports[_0xe67b('0x2d')]=function(_0x2b1dcb,_0x480197){if(_0x2b1dcb['body']['id']){delete _0x2b1dcb['body']['id'];}return db[_0xe67b('0x37')][_0xe67b('0x4e')]({'where':{'id':_0x2b1dcb['params']['id']}})[_0xe67b('0x17')](handleEntityNotFound(_0x480197,null))[_0xe67b('0x17')](saveUpdates(_0x2b1dcb[_0xe67b('0x30')],null))['then'](respondWithResult(_0x480197,null))[_0xe67b('0x22')](handleError(_0x480197,null));};exports[_0xe67b('0x4f')]=function(_0x1a6f03,_0x434e03){return db[_0xe67b('0x37')]['find']({'where':{'id':_0x1a6f03[_0xe67b('0x42')]['id']}})[_0xe67b('0x17')](handleEntityNotFound(_0x434e03,null))[_0xe67b('0x17')](removeEntity(_0x434e03,null))[_0xe67b('0x22')](handleError(_0x434e03,null));};exports[_0xe67b('0x50')]=function(_0x2e6c0b,_0x27c729){return db[_0xe67b('0x37')][_0xe67b('0x50')]()[_0xe67b('0x17')](respondWithResult(_0x27c729,null))[_0xe67b('0x22')](handleError(_0x27c729,null));};exports[_0xe67b('0x51')]=function(_0x4c5255,_0x1672f7){var _0x22f0c8=_0x4c5255[_0xe67b('0x42')]['id'];var _0x2630f4;var _0x56e46c;var _0x770eed;return db['ChatInteraction'][_0xe67b('0x52')]({'where':{'id':_0x22f0c8}})[_0xe67b('0x17')](function(_0x57529f){_0x2630f4=_0x57529f;return db[_0xe67b('0x53')][_0xe67b('0x52')]({'where':{'id':_0x57529f[_0xe67b('0x54')]},'attributes':['id',_0xe67b('0x55'),_0xe67b('0x56'),_0xe67b('0x57'),_0xe67b('0x58'),_0xe67b('0x59')],'raw':!![]});})[_0xe67b('0x17')](function(_0x2657dc){if(_0x2657dc&&_0x2657dc[_0xe67b('0x55')]&&_0x2657dc[_0xe67b('0x56')]){_0x56e46c=_0x2657dc;var _0x3301a1={'interaction':{'id':_0x22f0c8},'agent':{'id':_0x4c5255[_0xe67b('0x40')]['id'],'name':_0x4c5255[_0xe67b('0x40')][_0xe67b('0x2e')],'fullname':_0x4c5255[_0xe67b('0x40')][_0xe67b('0x5a')],'email':_0x4c5255[_0xe67b('0x40')]['email']},'contact':_0x4c5255['body'][_0xe67b('0x31')],'account':_0x4c5255['body'][_0xe67b('0x34')]};var _0x14f37a={'rejectUnauthorized':![],'method':'POST','url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x2657dc[_0xe67b('0x55')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x4c5255[_0xe67b('0x40')][_0xe67b('0x5b')]],'buttons':null,'topic':_0x56e46c[_0xe67b('0x57')],'note':_['isNull'](_0x56e46c[_0xe67b('0x58')])?null:getMustacheRender(_0x56e46c['vidaooNote'],_0x3301a1),'metadata':null},'redirect':_0xe67b('0x5c'),'json':!![]};try{if(!_[_0xe67b('0x5d')](_0x56e46c[_0xe67b('0x59')])){var _0x4491b8=getMustacheRender(_0x56e46c[_0xe67b('0x59')],_0x3301a1);var _0x443709=JSON[_0xe67b('0x5e')](_0x4491b8);_0x14f37a['body'][_0xe67b('0x5f')]=_0x443709;}}catch(_0x372eaf){throw new db[(_0xe67b('0x60'))][(_0xe67b('0x61'))](_0xe67b('0x62'));}return rp(_0x14f37a);}else{throw new db[(_0xe67b('0x60'))]['ValidationError']('Error\x20in\x20Vidaoo\x20configuration');}})[_0xe67b('0x17')](function(_0xf21b79){_0x770eed=_0xf21b79;if(_0x770eed['id']){var _0x2c3a01={'body':_0x770eed[_0xe67b('0x63')],'ChatWebsiteId':_0x56e46c['id'],'ChatInteractionId':_0x2630f4['id'],'direction':_0xe67b('0x64'),'UserId':_0x4c5255[_0xe67b('0x40')]['id']};return db['ChatMessage'][_0xe67b('0x4d')](_0x2c3a01,{});}else{throw new db[(_0xe67b('0x60'))][(_0xe67b('0x61'))](_0xe67b('0x65'));}})[_0xe67b('0x17')](function(){return _0x2630f4[_0xe67b('0x66')]({'vidaooSessionId':_0x770eed['id']});})[_0xe67b('0x17')](respondWithResult(_0x1672f7,null))[_0xe67b('0x22')](handleError(_0x1672f7,null));};exports['customUpdate']=function(_0x227d1f,_0x4fbfef){if(_0x227d1f[_0xe67b('0x30')]['id']){delete _0x227d1f[_0xe67b('0x30')]['id'];}return db[_0xe67b('0x37')][_0xe67b('0x4e')]({'where':{'id':_0x227d1f['params']['id']},'include':[{'model':db[_0xe67b('0x67')],'as':_0xe67b('0x68')}]})[_0xe67b('0x17')](handleEntityNotFound(_0x4fbfef,null))[_0xe67b('0x17')](saveUpdates(_0x227d1f['body'],null))['then'](respondWithResult(_0x4fbfef,null))[_0xe67b('0x22')](handleError(_0x4fbfef,null));};exports['abandon']=function(_0x590270,_0x1267c3){if(_0x590270[_0xe67b('0x30')]['id']){delete _0x590270[_0xe67b('0x30')]['id'];}return db[_0xe67b('0x37')][_0xe67b('0x4e')]({'where':{'id':_0x590270[_0xe67b('0x42')]['id']}})[_0xe67b('0x17')](function(_0x40af89){if(!_0x40af89){logger[_0xe67b('0x1e')](_0xe67b('0x69'),'abandon',0x194,_0xe67b('0x6a'));_0x1267c3[_0xe67b('0x23')](0x194);}else{if(_0x40af89[_0xe67b('0x6b')]){throw new db['Sequelize'][(_0xe67b('0x61'))](_0xe67b('0x6c'));}}return _0x40af89;})[_0xe67b('0x17')](function(_0x2a71aa){if(_0x2a71aa){return _0x2a71aa[_0xe67b('0x2d')]({'closed':_0x590270[_0xe67b('0x30')]['closed'],'disposition':_0x590270[_0xe67b('0x30')][_0xe67b('0x6d')]})[_0xe67b('0x17')](function(_0xe2534c){return _0xe2534c;});}})[_0xe67b('0x17')](function(){return respondWithRpcPromise(_0xe67b('0x6e'),_0xe67b('0x6f'),_0x590270[_0xe67b('0x30')],client9004);})['then'](respondWithResult(_0x1267c3,null))['catch'](handleError(_0x1267c3,null));};exports[_0xe67b('0x70')]=function(_0x45a10f,_0x312377){_0x45a10f[_0xe67b('0x30')][_0xe67b('0x2e')]=_0x45a10f[_0xe67b('0x71')][_0xe67b('0x72')];_0x45a10f[_0xe67b('0x30')][_0xe67b('0x73')]=_0x45a10f['file']['filename'];_0x45a10f[_0xe67b('0x30')]['type']=_0x45a10f[_0xe67b('0x71')]['mimetype'];return db['Attachment']['create'](_0x45a10f[_0xe67b('0x30')])[_0xe67b('0x17')](respondWithResult(_0x312377,0xc9))['catch'](handleError(_0x312377,null));};exports[_0xe67b('0x74')]=function(_0x23723d,_0x3c8eaa){return db[_0xe67b('0x37')][_0xe67b('0x52')]({'where':{'id':_0x23723d[_0xe67b('0x42')]['id']},'raw':!![]})[_0xe67b('0x17')](handleEntityNotFound(_0x3c8eaa,null))['then'](function(_0x19dafc){if(_0x19dafc){if(_0x19dafc[_0xe67b('0x75')]){return _0x3c8eaa[_0xe67b('0x24')](0x193)['json']({'status':0x193,'message':'Unauthorized'});}return db[_0xe67b('0x76')][_0xe67b('0x52')]({'where':{'id':_0x23723d[_0xe67b('0x3f')]['attachId']},'raw':!![]})['then'](handleEntityNotFound(_0x3c8eaa,null));}})[_0xe67b('0x17')](function(_0x45d39f){if(_0x45d39f){var _0x5f4f56=_0x45d39f[_0xe67b('0x77')]!==null;var _0x50c8cb=path[_0xe67b('0x78')](config['root'],'server/files/attachments/');if(_0x5f4f56){_0x50c8cb=path[_0xe67b('0x78')](_0x50c8cb,_0xe67b('0x79'));}var _0xab5acd=path[_0xe67b('0x78')](_0x50c8cb,_0x45d39f[_0xe67b('0x73')]);return _0x3c8eaa[_0xe67b('0x7a')](_0xab5acd);}})[_0xe67b('0x22')](handleError(_0x3c8eaa,null));};exports[_0xe67b('0x7b')]=function(_0x16d8b7,_0x87bc10){var _0x516450=null;var _0x72bba3=null;var _0x43d47c=null;if(_0x16d8b7['body']['id']){delete _0x16d8b7[_0xe67b('0x30')]['id'];}if(_0x16d8b7[_0xe67b('0x30')][_0xe67b('0x7c')]){_0x43d47c=path[_0xe67b('0x78')](config[_0xe67b('0x7d')],'server/files/chat/upload/',util['format'](_0xe67b('0x7e'),Date[_0xe67b('0x7f')]()));_0x16d8b7['body'][_0xe67b('0x80')]=_0x43d47c;}return db[_0xe67b('0x37')][_0xe67b('0x4e')]({'where':{'id':_0x16d8b7[_0xe67b('0x42')]['id']},'include':[{'model':db[_0xe67b('0x81')],'as':_0xe67b('0x82'),'include':[{'model':db['User'],'as':_0xe67b('0x83')}]}]})[_0xe67b('0x17')](handleEntityNotFound(_0x87bc10,null))[_0xe67b('0x17')](saveUpdates(_0x16d8b7[_0xe67b('0x30')],null))[_0xe67b('0x17')](function(_0x1a348c){if(_0x1a348c){_0x516450=_0x1a348c;return db['ChatWebsite'][_0xe67b('0x4e')]({'where':{'id':_0x516450[_0xe67b('0x54')]}});}})[_0xe67b('0x17')](function(_0x482fd4){if(_0x482fd4){_0x72bba3=_0x482fd4;return db['CmContact'][_0xe67b('0x4e')]({'where':{'id':_0x516450[_0xe67b('0x84')]}});}})[_0xe67b('0x17')](function(_0x4106c7){if(_0x4106c7){if(_0x43d47c){var _0x373f13=null;for(var _0x11a004=0x1;_0x11a004<_0x516450['Messages'][_0xe67b('0x85')];++_0x11a004){_0x373f13=_0x516450[_0xe67b('0x82')][_0x11a004];var _0x5a15f2=_0x373f13['UserId']?util[_0xe67b('0x86')](_0xe67b('0x87'),_0x72bba3[_0xe67b('0x88')],_0x373f13[_0xe67b('0x6b')]):_0xe67b('0x89');var _0x5becfb=_0x16d8b7[_0xe67b('0x30')]['customer']||util[_0xe67b('0x86')](_0xe67b('0x87'),'Visitor',_0x373f13[_0xe67b('0x84')]);switch(_0x72bba3[_0xe67b('0x8a')]){case'website_alias':_0x5a15f2=_0x373f13[_0xe67b('0x6b')]?util[_0xe67b('0x86')]('%s%d',_0x72bba3['agentAlias'],_0x373f13[_0xe67b('0x6b')]):_0xe67b('0x89');break;case _0xe67b('0x8b'):_0x5a15f2=_0x373f13[_0xe67b('0x6b')]?_0x373f13[_0xe67b('0x83')][_0xe67b('0x8c')]||_0x373f13['User'][_0xe67b('0x5a')]:_0xe67b('0x89');break;case'agent_fullname':_0x5a15f2=_0x373f13['UserId']?_0x373f13[_0xe67b('0x83')][_0xe67b('0x5a')]:'System';break;default:_0x5a15f2=_0x373f13[_0xe67b('0x6b')]?util[_0xe67b('0x86')]('%s%d',_0x72bba3[_0xe67b('0x88')],_0x373f13['UserId']):'System';}var _0x1d06c6=util['format'](_0xe67b('0x8d'),moment(_0x373f13[_0xe67b('0x8e')])[_0xe67b('0x86')](_0xe67b('0x8f')),_0x373f13[_0xe67b('0x90')]==='in'?_0x5becfb:_0x5a15f2,_0x373f13[_0xe67b('0x30')]);if(!_0x373f13[_0xe67b('0x91')]){fs[_0xe67b('0x92')](_0x43d47c,_0x1d06c6);}}return db[_0xe67b('0x93')][_0xe67b('0x52')]({'where':{'service':!![]},'include':[{'model':db[_0xe67b('0x94')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xe67b('0x95')],'as':'CloudProvider','raw':!![]}]}]});}}})['then'](function(_0x3b8902){if(!_0x3b8902||!_0x3b8902[_0xe67b('0x96')]||!_0x16d8b7[_0xe67b('0x30')])return _0x516450;var _0x42ef75=_0x3b8902[_0xe67b('0x97')]();return respondWithRpcPromise(_0xe67b('0x98'),'sendMail',{'account':_0x42ef75,'message':{'from':util[_0xe67b('0x86')]('\x22%s\x22\x20<%s>',_0x3b8902[_0xe67b('0x2e')],_0x3b8902[_0xe67b('0x5b')]||_0x3b8902['Smtp'][_0xe67b('0x40')]),'to':_0x16d8b7[_0xe67b('0x30')]['mailTranscript'],'subject':_0xe67b('0x99'),'text':util[_0xe67b('0x86')](_0xe67b('0x9a'),_0x16d8b7['body'][_0xe67b('0x7c')]),'attachments':[{'path':_0x43d47c}]}})[_0xe67b('0x17')](function(){return _0x516450;})[_0xe67b('0x22')](function(_0x25c78b){logger[_0xe67b('0x1e')](_0x25c78b);});})[_0xe67b('0x17')](respondWithStatusCode(_0x87bc10,0xc8))[_0xe67b('0x22')](handleError(_0x87bc10,null));};exports[_0xe67b('0x9b')]=function(_0x55ec55,_0x48a002){return db[_0xe67b('0x81')][_0xe67b('0x4e')]({'where':{'id':_0x55ec55[_0xe67b('0x42')]['id']}})[_0xe67b('0x17')](handleEntityNotFound(_0x48a002,null))[_0xe67b('0x17')](function(_0x59b165){if(_0x59b165){return _0x59b165[_0xe67b('0x9b')](_0x55ec55[_0xe67b('0x30')]['ids'],_[_0xe67b('0x9c')](_0x55ec55['body'],[_0xe67b('0x9d'),'id'])||{});}})[_0xe67b('0x17')](respondWithResult(_0x48a002,null))['catch'](handleError(_0x48a002,null));};exports[_0xe67b('0x9e')]=function(_0x1be6ed,_0x44f236){var _0x4a304e={'raw':![],'where':{}};var _0x5c959f={};var _0x32fb0b={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xe67b('0x52')]({'where':{'id':_0x1be6ed['params']['id']}})['then'](handleEntityNotFound(_0x44f236,null))['then'](function(_0x41a12e){if(_0x41a12e){_0x5c959f[_0xe67b('0x43')]=_[_0xe67b('0x44')](db[_0xe67b('0x81')][_0xe67b('0x38')]);_0x5c959f[_0xe67b('0x3f')]=_[_0xe67b('0x44')](_0x1be6ed[_0xe67b('0x3f')]);_0x5c959f['filters']=_[_0xe67b('0x46')](_0x5c959f[_0xe67b('0x43')],_0x5c959f['query']);_0x4a304e[_0xe67b('0x48')]=_['intersection'](_0x5c959f['model'],qs['fields'](_0x1be6ed[_0xe67b('0x3f')][_0xe67b('0x47')]));_0x4a304e[_0xe67b('0x48')]=_0x4a304e[_0xe67b('0x48')][_0xe67b('0x85')]?_0x4a304e[_0xe67b('0x48')]:_0x5c959f[_0xe67b('0x43')];if(!_0x1be6ed[_0xe67b('0x3f')][_0xe67b('0x9f')]('nolimit')){_0x4a304e[_0xe67b('0x29')]=qs['limit'](_0x1be6ed[_0xe67b('0x3f')][_0xe67b('0x29')]);_0x4a304e[_0xe67b('0x27')]=qs['offset'](_0x1be6ed[_0xe67b('0x3f')][_0xe67b('0x27')]);}_0x4a304e['order']=qs[_0xe67b('0xa0')](_0x1be6ed[_0xe67b('0x3f')][_0xe67b('0xa0')]);_0x4a304e[_0xe67b('0xa1')]=qs[_0xe67b('0x45')](_[_0xe67b('0xa2')](_0x1be6ed[_0xe67b('0x3f')],_0x5c959f[_0xe67b('0x45')]));_0x4a304e[_0xe67b('0xa1')][_0xe67b('0xa3')]=_0x41a12e['id'];if(_0x1be6ed[_0xe67b('0x3f')][_0xe67b('0xa4')]){_0x4a304e[_0xe67b('0xa1')]=_[_0xe67b('0x4b')](_0x4a304e[_0xe67b('0xa1')],{'$or':_[_0xe67b('0x36')](_0x4a304e[_0xe67b('0x48')],function(_0x595ffd){var _0x351d7f={};_0x351d7f[_0x595ffd]={'$like':'%'+_0x1be6ed[_0xe67b('0x3f')][_0xe67b('0xa4')]+'%'};return _0x351d7f;})});}if(_0x1be6ed[_0xe67b('0x3f')]['$gte']){var _0x3f5218=_0x1be6ed['query'][_0xe67b('0xa5')]['split'](',');var _0x5d1164={};_0x5d1164[_0x3f5218[0x0]]={'$gte':moment(_0x3f5218[0x1])[_0xe67b('0x86')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4a304e[_0xe67b('0xa1')]=_['merge'](_0x4a304e['where'],_0x5d1164);}_0x4a304e=_[_0xe67b('0x4b')]({},_0x4a304e,_0x1be6ed[_0xe67b('0x4c')]);return db[_0xe67b('0x81')][_0xe67b('0x2a')]({'where':_0x4a304e[_0xe67b('0xa1')]})[_0xe67b('0x17')](function(_0x41d5ec){_0x32fb0b[_0xe67b('0x2a')]=_0x41d5ec;if(_0x1be6ed[_0xe67b('0x3f')][_0xe67b('0x49')]){_0x4a304e[_0xe67b('0x4a')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x4a304e);})['then'](function(_0x5a092b){_0x32fb0b[_0xe67b('0xa6')]=_0x5a092b;return _0x32fb0b;});}})[_0xe67b('0x17')](respondWithFilteredResult(_0x44f236,_0x4a304e))[_0xe67b('0x22')](handleError(_0x44f236,null));};exports[_0xe67b('0xa7')]=function(_0x1f823d,_0x134851){var _0x3cbb89={'where':{}},_0x26d1ab={},_0x7b3cbd={'count':0x0,'rows':[]};return db[_0xe67b('0x37')]['findOne']({'where':{'id':_0x1f823d[_0xe67b('0x42')]['id']}})[_0xe67b('0x17')](handleEntityNotFound(_0x134851,null))[_0xe67b('0x17')](function(_0x266450){if(_0x266450){_0x26d1ab[_0xe67b('0x43')]=_[_0xe67b('0x44')](db[_0xe67b('0x81')][_0xe67b('0x38')]);_0x26d1ab[_0xe67b('0x3f')]=_[_0xe67b('0x44')](_0x1f823d['query']);_0x26d1ab['filters']=_[_0xe67b('0x46')](_0x26d1ab[_0xe67b('0x43')],_0x26d1ab[_0xe67b('0x3f')]);_0x3cbb89[_0xe67b('0x48')]=_['intersection'](_0x26d1ab[_0xe67b('0x43')],qs[_0xe67b('0x47')](_0x1f823d[_0xe67b('0x3f')]['fields']));_0x3cbb89['attributes']=_0x3cbb89['attributes'][_0xe67b('0x85')]?_0x3cbb89['attributes']:_0x26d1ab['model'];if(!_0x1f823d[_0xe67b('0x3f')][_0xe67b('0x9f')]('nolimit')){_0x3cbb89[_0xe67b('0x29')]=qs[_0xe67b('0x29')](_0x1f823d[_0xe67b('0x3f')]['limit']);_0x3cbb89[_0xe67b('0x27')]=qs[_0xe67b('0x27')](_0x1f823d[_0xe67b('0x3f')][_0xe67b('0x27')]);}_0x3cbb89[_0xe67b('0xa8')]=qs[_0xe67b('0xa0')](_0x1f823d[_0xe67b('0x3f')][_0xe67b('0xa0')]);_0x3cbb89[_0xe67b('0xa1')]=qs[_0xe67b('0x45')](_[_0xe67b('0xa2')](_0x1f823d['query'],_0x26d1ab[_0xe67b('0x45')]));_0x3cbb89[_0xe67b('0xa1')][_0xe67b('0xa3')]=_0x266450['id'];if(_0x1f823d[_0xe67b('0x3f')][_0xe67b('0xa4')]){_0x3cbb89[_0xe67b('0xa1')]=_[_0xe67b('0x4b')](_0x3cbb89[_0xe67b('0xa1')],{'$or':_[_0xe67b('0x36')](_0x3cbb89[_0xe67b('0x48')],function(_0x5b7119){var _0x1eb116={};_0x1eb116[_0x5b7119]={'$like':'%'+_0x1f823d['query'][_0xe67b('0xa4')]+'%'};return _0x1eb116;})});}_0x3cbb89['where']['secret']=![];if(_0x1f823d[_0xe67b('0x3f')]['id']){_0x3cbb89[_0xe67b('0xa1')]['id']={'$gt':_0x1f823d[_0xe67b('0x3f')]['id']};}_0x3cbb89=_[_0xe67b('0x4b')]({},_0x3cbb89,_0x1f823d[_0xe67b('0x4c')]);return db[_0xe67b('0x81')][_0xe67b('0x2a')]({'where':_0x3cbb89[_0xe67b('0xa1')]})[_0xe67b('0x17')](function(_0x398d14){_0x7b3cbd['count']=_0x398d14;_0x3cbb89[_0xe67b('0x4a')]=[];if(_0x1f823d['query'][_0xe67b('0xa9')]){_0x3cbb89[_0xe67b('0x4a')][_0xe67b('0xaa')]({'model':db['User'],'as':_0xe67b('0x83'),'attributes':['id','fullname',_0xe67b('0x8c')]});}if(_0x1f823d[_0xe67b('0x3f')][_0xe67b('0x49')]){_0x3cbb89[_0xe67b('0x4a')]=[{'all':!![]}];}return db[_0xe67b('0x81')][_0xe67b('0x3d')](_0x3cbb89);})['then'](function(_0xf1502e){_0x7b3cbd[_0xe67b('0xa6')]=_0xf1502e;return _0x7b3cbd;});}})['then'](respondWithFilteredResult(_0x134851,_0x3cbb89))[_0xe67b('0x22')](handleError(_0x134851,null));};exports[_0xe67b('0xab')]=function(_0x158724,_0x5ef299){return db[_0xe67b('0x37')][_0xe67b('0x4e')]({'where':{'id':_0x158724[_0xe67b('0x42')]['id']}})[_0xe67b('0x17')](handleEntityNotFound(_0x5ef299,null))[_0xe67b('0x17')](function(_0x5d25df){if(_0x5d25df){return _0x5d25df[_0xe67b('0xac')](_0x158724[_0xe67b('0x30')][_0xe67b('0x9d')],_[_0xe67b('0x9c')](_0x158724[_0xe67b('0x30')],[_0xe67b('0x9d'),'id'])||{})[_0xe67b('0xad')](function(){return db['Tag']['findAll']({'attributes':['id',_0xe67b('0x2e'),_0xe67b('0xae')],'where':{'id':_0x158724[_0xe67b('0x30')]['ids']}});})[_0xe67b('0x17')](function(_0x385e6a){socket[_0xe67b('0xaf')](_0xe67b('0xb0'),{'id':Number(_0x158724[_0xe67b('0x42')]['id']),'tags':_0x385e6a||[]});return{'id':Number(_0x158724['params']['id']),'tags':_0x385e6a||[]};});}})['then'](respondWithResult(_0x5ef299,null))[_0xe67b('0x22')](handleError(_0x5ef299,null));};exports[_0xe67b('0xb1')]=function(_0x4ef5dd,_0x2f0e4b){return db['ChatInteraction'][_0xe67b('0x4e')]({'where':{'id':_0x4ef5dd[_0xe67b('0x42')]['id']}})['then'](handleEntityNotFound(_0x2f0e4b,null))[_0xe67b('0x17')](function(_0x51423c){if(_0x51423c){return _0x51423c[_0xe67b('0xb1')](_0x4ef5dd['query'][_0xe67b('0x9d')]);}})[_0xe67b('0x17')](respondWithStatusCode(_0x2f0e4b,null))[_0xe67b('0x22')](handleError(_0x2f0e4b,null));};exports[_0xe67b('0x7a')]=function(_0x3ecc1c,_0x1dcdee){var _0x465ee9=moment()['unix']()[_0xe67b('0xb2')]();var _0x50f55e=path[_0xe67b('0x78')](config[_0xe67b('0x7d')],_0xe67b('0xb3'),'files',_0xe67b('0xb4'));var _0x1deb01=path[_0xe67b('0x78')](config[_0xe67b('0x7d')],_0xe67b('0xb3'),'files','attachments');var _0x136dc8=path[_0xe67b('0x78')](_0x50f55e,_0x465ee9);var _0x3802d7=util['format'](_0xe67b('0xb5'),_0x3ecc1c[_0xe67b('0x42')]['id'],_0x465ee9);var _0x5d3803=path[_0xe67b('0x78')](_0x50f55e,_0x3802d7);var _0x42a771=[];_0x42a771['push']({'model':db[_0xe67b('0x83')],'as':_0xe67b('0x83'),'attributes':['id',_0xe67b('0x5a')],'raw':!![]});_0x42a771[_0xe67b('0xaa')]({'model':db[_0xe67b('0x67')],'as':_0xe67b('0x68'),'attributes':['id',_0xe67b('0xb6'),'lastName'],'raw':!![]});if(_0x3ecc1c[_0xe67b('0x3f')]['attachments']){_0x42a771[_0xe67b('0xaa')]({'model':db[_0xe67b('0x76')],'as':'Attachment','raw':!![]});}var _0x4cb3e1=[{'model':db[_0xe67b('0x81')],'as':_0xe67b('0x82'),'attributes':['id',_0xe67b('0x30'),_0xe67b('0x8e'),_0xe67b('0x90'),_0xe67b('0x91'),_0xe67b('0xb7')],'include':_0x42a771}];_0x4cb3e1[_0xe67b('0xaa')]({'model':db['ChatWebsite'],'as':_0xe67b('0xb8'),'attributes':['id','name']});_0x4cb3e1[_0xe67b('0xaa')]({'model':db[_0xe67b('0x83')],'as':_0xe67b('0xb9'),'attributes':['id',_0xe67b('0x5a')]});return db[_0xe67b('0x37')][_0xe67b('0x4e')]({'where':{'id':_0x3ecc1c[_0xe67b('0x42')]['id']},'include':_0x4cb3e1})[_0xe67b('0x17')](handleEntityNotFound(_0x1dcdee,null))[_0xe67b('0x17')](function(_0x4cc105){if(_0x4cc105){var _0x2d89f1=_0x4cc105[_0xe67b('0xba')]({'plain':!![]});fs[_0xe67b('0xbb')](_0x136dc8);var _0x11f602={'channel':_0xe67b('0xbc'),'account':_0x2d89f1[_0xe67b('0xb8')][_0xe67b('0x2e')],'agent':_0x2d89f1[_0xe67b('0xb9')]?_0x2d89f1[_0xe67b('0xb9')][_0xe67b('0x5a')]:_0xe67b('0xbd'),'createdAt':moment(_0x2d89f1[_0xe67b('0x8e')])[_0xe67b('0x86')](_0xe67b('0xbe'))[_0xe67b('0xb2')](),'closedAt':_0x2d89f1[_0xe67b('0x75')]?moment(_0x2d89f1['closedAt'])[_0xe67b('0x86')](_0xe67b('0xbe'))['toString']():'','disposition':_0x2d89f1[_0xe67b('0x6d')],'chatInfo':{'browser':_0x2d89f1[_0xe67b('0xbf')],'os':_0x2d89f1[_0xe67b('0xc0')],'referer':_0x2d89f1[_0xe67b('0xc1')],'customerIp':_0x2d89f1['customerIp'],'customerPort':_0x2d89f1['customerPort']?_0x2d89f1[_0xe67b('0xc2')]:_0xe67b('0xbd')},'messages':_(_0x2d89f1[_0xe67b('0x82')])[_0xe67b('0xc3')]()[_0xe67b('0xa4')]({'secret':![]})['map'](function(_0x35daac){if(_0x35daac[_0xe67b('0x76')]){var _0x37fceb=path['join'](_0x1deb01,_0x35daac['Attachment'][_0xe67b('0x73')]);if(fs[_0xe67b('0xc4')](_0x37fceb)){fs['createReadStream'](_0x37fceb)['pipe'](fs[_0xe67b('0xc5')](path[_0xe67b('0x78')](_0x136dc8,_0x35daac['Attachment'][_0xe67b('0x73')])));}}return{'date':moment(_0x35daac['createdAt'])[_0xe67b('0x86')](_0xe67b('0xbe'))[_0xe67b('0xb2')](),'sender':_0x35daac['direction']===_0xe67b('0x64')?_0x35daac[_0xe67b('0x83')]?_0x35daac['User'][_0xe67b('0x5a')]:_0xe67b('0x89'):_0x35daac[_0xe67b('0x68')][_0xe67b('0xb6')]+(_0x35daac[_0xe67b('0x68')][_0xe67b('0xc6')]?'\x20'+_0x35daac[_0xe67b('0x68')][_0xe67b('0xc6')]:''),'body':_0x35daac[_0xe67b('0x76')]?_0x35daac['Attachment'][_0xe67b('0x73')]:_0x35daac['body'],'direction':_0x35daac[_0xe67b('0x90')]===_0xe67b('0x64')?'A':'C','secret':_0x35daac[_0xe67b('0x91')],'read':_0x35daac[_0xe67b('0xb7')],'attachment':_0x35daac[_0xe67b('0x76')]};})[_0xe67b('0xc7')]()};return ejs[_0xe67b('0xc8')](path[_0xe67b('0x78')](config[_0xe67b('0x7d')],_0xe67b('0xb3'),_0xe67b('0xc9'),_0xe67b('0xca')),{'interaction':_0x11f602})['then'](function(_0x4a2296){var _0xa60784=path[_0xe67b('0x78')](_0x136dc8,_0xe67b('0xcb')+_0x2d89f1['id']+'-'+_0x465ee9+_0xe67b('0xcc'));var _0x4dfcfe={'path':_0xa60784,'channel':'Chat','interactionId':_0x2d89f1['id']};return pdf['createPdfFromHTML'](_0x4a2296,_0x4dfcfe);})[_0xe67b('0x17')](function(){return new Promise(function(_0x4aac29,_0x51044f){zipdir(_0x136dc8,{'saveTo':_0x5d3803},function(_0x355e54,_0x26dafc){if(_0x355e54)return _0x51044f(_0x355e54);return _0x4aac29(_0x26dafc);});})[_0xe67b('0x17')](function(){return new BPromise(function(_0x5607ed,_0x17da85){rimraf(_0x136dc8,function(_0x2506a8){if(_0x2506a8)_0x17da85(_0x2506a8);return _0x5607ed();});});})[_0xe67b('0x17')](function(){return _0x1dcdee[_0xe67b('0x7a')](_0x5d3803,_0x3802d7,function(_0xa0cc4a){if(_0xa0cc4a){logger[_0xe67b('0x1e')]('err',_0xa0cc4a);}else{fs['unlinkSync'](_0x5d3803);}});});});}else{return _0x1dcdee[_0xe67b('0x23')](0xc8);}})[_0xe67b('0x22')](handleError(_0x1dcdee,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index d567b66..42191ca 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 _0xb237=['update','remove','getUsers','then','setDataValue','findAll','emit','catch','hasOwnProperty','hook','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save'];(function(_0x4c5f2c,_0x5a480c){var _0x1cebc3=function(_0x19877e){while(--_0x19877e){_0x4c5f2c['push'](_0x4c5f2c['shift']());}};_0x1cebc3(++_0x5a480c);}(_0xb237,0x10a));var _0x7b23=function(_0x3baa95,_0x3ae66a){_0x3baa95=_0x3baa95-0x0;var _0x1d447b=_0xb237[_0x3baa95];return _0x1d447b;};'use strict';var EventEmitter=require(_0x7b23('0x0'));var ChatInteraction=require(_0x7b23('0x1'))['db'][_0x7b23('0x2')];var ChatMessage=require(_0x7b23('0x1'))['db'][_0x7b23('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x7b23('0x4')](0x0);var events={'afterCreate':_0x7b23('0x5'),'afterUpdate':_0x7b23('0x6'),'afterDestroy':_0x7b23('0x7')};function emitEvent(_0x395b75){return function(_0x2e993f,_0x144133,_0x1947f7){_0x2e993f[_0x7b23('0x8')]({'attributes':['id'],'raw':!![]})[_0x7b23('0x9')](function(_0x16951a){_0x2e993f[_0x7b23('0xa')]('Users',_0x16951a['map'](function(_0x4f379c){return{'id':_0x4f379c['id']};}));return ChatMessage[_0x7b23('0xb')]({'where':{'ChatInteractionId':_0x2e993f['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4f2636){_0x2e993f[_0x7b23('0xa')]('unreadMessages',_0x4f2636['length']);ChatInteractionEvents[_0x7b23('0xc')](_0x395b75+':'+_0x2e993f['id'],_0x2e993f);ChatInteractionEvents['emit'](_0x395b75,_0x2e993f);_0x1947f7(null);})[_0x7b23('0xd')](_0x1947f7(null));};}for(var e in events){if(events[_0x7b23('0xe')](e)){var event=events[e];ChatInteraction[_0x7b23('0xf')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0x7d05=['hook','events','../../mysqldb','ChatMessage','setMaxListeners','update','remove','then','setDataValue','Users','map','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x1ac393,_0x52793d){var _0x2b54b2=function(_0x3e4bf0){while(--_0x3e4bf0){_0x1ac393['push'](_0x1ac393['shift']());}};_0x2b54b2(++_0x52793d);}(_0x7d05,0x1d1));var _0x57d0=function(_0x4d75a1,_0x45002a){_0x4d75a1=_0x4d75a1-0x0;var _0x18f98b=_0x7d05[_0x4d75a1];return _0x18f98b;};'use strict';var EventEmitter=require(_0x57d0('0x0'));var ChatInteraction=require(_0x57d0('0x1'))['db']['ChatInteraction'];var ChatMessage=require('../../mysqldb')['db'][_0x57d0('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x57d0('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x57d0('0x4'),'afterDestroy':_0x57d0('0x5')};function emitEvent(_0x30f090){return function(_0xf12a98,_0x4abb2a,_0x57b082){_0xf12a98['getUsers']({'attributes':['id'],'raw':!![]})[_0x57d0('0x6')](function(_0x3e8c72){_0xf12a98[_0x57d0('0x7')](_0x57d0('0x8'),_0x3e8c72[_0x57d0('0x9')](function(_0x569f46){return{'id':_0x569f46['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0xf12a98['id'],'direction':'in','read':![]},'raw':!![]});})[_0x57d0('0x6')](function(_0x49cbca){_0xf12a98[_0x57d0('0x7')](_0x57d0('0xa'),_0x49cbca[_0x57d0('0xb')]);ChatInteractionEvents[_0x57d0('0xc')](_0x30f090+':'+_0xf12a98['id'],_0xf12a98);ChatInteractionEvents['emit'](_0x30f090,_0xf12a98);_0x57b082(null);})[_0x57d0('0xd')](_0x57b082(null));};}for(var e in events){if(events[_0x57d0('0xe')](e)){var event=events[e];ChatInteraction[_0x57d0('0xf')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 3c87ca8..03cdcf6 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 _0xf4ad=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','define','chat_interactions','changed','closed','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x33f7ed,_0x35167e){var _0x50ed01=function(_0x2e58cc){while(--_0x2e58cc){_0x33f7ed['push'](_0x33f7ed['shift']());}};_0x50ed01(++_0x35167e);}(_0xf4ad,0xd1));var _0xdf4a=function(_0x22e9a1,_0x1d3a53){_0x22e9a1=_0x22e9a1-0x0;var _0x5bff12=_0xf4ad[_0x22e9a1];return _0x5bff12;};'use strict';var _=require(_0xdf4a('0x0'));var util=require(_0xdf4a('0x1'));var logger=require(_0xdf4a('0x2'))('api');var moment=require(_0xdf4a('0x3'));var BPromise=require(_0xdf4a('0x4'));var rp=require(_0xdf4a('0x5'));var fs=require('fs');var path=require(_0xdf4a('0x6'));var rimraf=require(_0xdf4a('0x7'));var config=require('../../config/environment');var attributes=require('./chatInteraction.attributes');module['exports']=function(_0x56abb5,_0x263fa0){return _0x56abb5[_0xdf4a('0x8')]('ChatInteraction',attributes,{'tableName':_0xdf4a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5e4e17,_0xc43f0e,_0x4f450d){if(_0x5e4e17[_0xdf4a('0xa')](_0xdf4a('0xb'))){_0x5e4e17['closedAt']=moment()['format'](_0xdf4a('0xc'));}_0x4f450d(null,_0x5e4e17);}},'charset':_0xdf4a('0xd'),'collate':_0xdf4a('0xe')});}; \ No newline at end of file +var _0x3fa1=['YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','changed','format'];(function(_0x44f12f,_0x3f3957){var _0x34d474=function(_0x368f02){while(--_0x368f02){_0x44f12f['push'](_0x44f12f['shift']());}};_0x34d474(++_0x3f3957);}(_0x3fa1,0x157));var _0x13fa=function(_0x12cb90,_0xdab1f9){_0x12cb90=_0x12cb90-0x0;var _0x952309=_0x3fa1[_0x12cb90];return _0x952309;};'use strict';var _=require(_0x13fa('0x0'));var util=require(_0x13fa('0x1'));var logger=require(_0x13fa('0x2'))(_0x13fa('0x3'));var moment=require(_0x13fa('0x4'));var BPromise=require('bluebird');var rp=require(_0x13fa('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x13fa('0x6'));var config=require(_0x13fa('0x7'));var attributes=require(_0x13fa('0x8'));module[_0x13fa('0x9')]=function(_0x3fb8e7,_0x53ba1b){return _0x3fb8e7[_0x13fa('0xa')](_0x13fa('0xb'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x56d61e,_0x388311,_0x1d1fa4){if(_0x56d61e[_0x13fa('0xc')]('closed')){_0x56d61e['closedAt']=moment()[_0x13fa('0xd')](_0x13fa('0xe'));}_0x1d1fa4(null,_0x56d61e);}},'charset':_0x13fa('0xf'),'collate':_0x13fa('0x10')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 4653779..476915d 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 _0x1142=['request','info','request\x20sent','debug','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','ChatInteraction','body','options','raw','where','attributes','limit','then','UpdateChatInteraction','AddTagsToChatInteraction','find','addTags','ids','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','register'];(function(_0x2d8403,_0x1dd8f7){var _0x425012=function(_0x1e0b2a){while(--_0x1e0b2a){_0x2d8403['push'](_0x2d8403['shift']());}};_0x425012(++_0x1dd8f7);}(_0x1142,0x70));var _0x2114=function(_0x307327,_0x1f169f){_0x307327=_0x307327-0x0;var _0x38ec83=_0x1142[_0x307327];return _0x38ec83;};'use strict';var _=require(_0x2114('0x0'));var util=require('util');var moment=require(_0x2114('0x1'));var BPromise=require(_0x2114('0x2'));var rs=require(_0x2114('0x3'));var fs=require('fs');var Redis=require(_0x2114('0x4'));var db=require(_0x2114('0x5'))['db'];var utils=require(_0x2114('0x6'));var logger=require(_0x2114('0x7'))(_0x2114('0x8'));var config=require(_0x2114('0x9'));var jayson=require(_0x2114('0xa'));var client=jayson['client'][_0x2114('0xb')]({'port':0x232a});config['redis']=_[_0x2114('0xc')](config[_0x2114('0xd')],{'host':_0x2114('0xe'),'port':0x18eb});var socket=require(_0x2114('0xf'))(new Redis(config['redis']));require('./chatInteraction.socket')[_0x2114('0x10')](socket);function respondWithRpcPromise(_0x5289c5,_0x391a13,_0x9d8796){return new BPromise(function(_0xbf65e0,_0x7a4c18){return client[_0x2114('0x11')](_0x5289c5,_0x9d8796)['then'](function(_0x776ba2){logger[_0x2114('0x12')]('ChatInteraction,\x20%s,\x20%s',_0x391a13,_0x2114('0x13'));logger[_0x2114('0x14')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x391a13,'request\x20sent',JSON[_0x2114('0x15')](_0x776ba2));if(_0x776ba2[_0x2114('0x16')]){if(_0x776ba2[_0x2114('0x16')][_0x2114('0x17')]===0x1f4){logger[_0x2114('0x16')](_0x2114('0x18'),_0x391a13,_0x776ba2[_0x2114('0x16')]['message']);return _0x7a4c18(_0x776ba2['error'][_0x2114('0x19')]);}logger[_0x2114('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x391a13,_0x776ba2['error']['message']);return _0xbf65e0(_0x776ba2[_0x2114('0x16')][_0x2114('0x19')]);}else{logger[_0x2114('0x12')](_0x2114('0x18'),_0x391a13,_0x2114('0x13'));_0xbf65e0(_0x776ba2[_0x2114('0x1a')]['message']);}})[_0x2114('0x1b')](function(_0x5b478e){logger[_0x2114('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x391a13,_0x5b478e);_0x7a4c18(_0x5b478e);});});}exports['UpdateChatInteraction']=function(_0x23f48b){var _0xf31a5b=this;return new Promise(function(_0x497cdd,_0x4a5df2){return db[_0x2114('0x1c')]['update'](_0x23f48b[_0x2114('0x1d')],{'raw':_0x23f48b[_0x2114('0x1e')]?_0x23f48b['options'][_0x2114('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23f48b['options']?_0x23f48b[_0x2114('0x1e')][_0x2114('0x20')]||null:null,'attributes':_0x23f48b[_0x2114('0x1e')]?_0x23f48b[_0x2114('0x1e')][_0x2114('0x21')]||null:null,'limit':_0x23f48b[_0x2114('0x1e')]?_0x23f48b[_0x2114('0x1e')][_0x2114('0x22')]||null:null})[_0x2114('0x23')](function(_0x2290eb){logger['info'](_0x2114('0x24'),_0x23f48b);logger[_0x2114('0x14')](_0x2114('0x24'),_0x23f48b,JSON[_0x2114('0x15')](_0x2290eb));_0x497cdd(_0x2290eb);})['catch'](function(_0x2f0978){logger[_0x2114('0x16')](_0x2114('0x24'),_0x2f0978['message'],_0x23f48b);_0x4a5df2(_0xf31a5b[_0x2114('0x16')](0x1f4,_0x2f0978[_0x2114('0x19')]));});});};exports[_0x2114('0x25')]=function(_0x105365){return new Promise(function(_0x1d4997,_0x99ec3){return db['ChatInteraction'][_0x2114('0x26')]({'where':_0x105365[_0x2114('0x1e')]?_0x105365[_0x2114('0x1e')][_0x2114('0x20')]||null:null})[_0x2114('0x23')](function(_0x2308ea){if(_0x2308ea){return _0x2308ea[_0x2114('0x27')](_0x105365[_0x2114('0x1d')][_0x2114('0x28')],_['omit'](_0x105365[_0x2114('0x1d')],['ids','id'])||{});}})[_0x2114('0x29')](function(_0x19ae58){logger[_0x2114('0x12')](_0x2114('0x2a'),_0x105365);logger[_0x2114('0x14')]('AddTags',_0x105365,JSON['stringify'](_0x19ae58));_0x1d4997(_0x19ae58);})[_0x2114('0x1b')](function(_0x556728){logger[_0x2114('0x16')](_0x2114('0x2a'),_0x556728['message'],_0x105365);_0x99ec3(_this['error'](0x1f4,_0x556728[_0x2114('0x19')]));});});}; \ No newline at end of file +var _0xfba1=['info','catch','UpdateChatInteraction','update','options','raw','where','attributes','limit','then','stringify','ChatInteraction','find','addTags','ids','omit','spread','AddTags','lodash','moment','randomstring','../../mysqldb','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','register','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfba1,0xa2));var _0x1fba=function(_0x2063de,_0x286428){_0x2063de=_0x2063de-0x0;var _0x43343c=_0xfba1[_0x2063de];return _0x43343c;};'use strict';var _=require(_0x1fba('0x0'));var util=require('util');var moment=require(_0x1fba('0x1'));var BPromise=require('bluebird');var rs=require(_0x1fba('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1fba('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1fba('0x4'));var config=require(_0x1fba('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x1fba('0x6')]['http']({'port':0x232a});config[_0x1fba('0x7')]=_[_0x1fba('0x8')](config[_0x1fba('0x7')],{'host':_0x1fba('0x9'),'port':0x18eb});var socket=require(_0x1fba('0xa'))(new Redis(config[_0x1fba('0x7')]));require('./chatInteraction.socket')[_0x1fba('0xb')](socket);function respondWithRpcPromise(_0x8e64ef,_0x3a3a63,_0xd6987b){return new BPromise(function(_0xabba60,_0x4f36bc){return client['request'](_0x8e64ef,_0xd6987b)['then'](function(_0x1e9b5b){logger['info'](_0x1fba('0xc'),_0x3a3a63,_0x1fba('0xd'));logger[_0x1fba('0xe')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x3a3a63,_0x1fba('0xd'),JSON['stringify'](_0x1e9b5b));if(_0x1e9b5b[_0x1fba('0xf')]){if(_0x1e9b5b['error'][_0x1fba('0x10')]===0x1f4){logger['error'](_0x1fba('0xc'),_0x3a3a63,_0x1e9b5b[_0x1fba('0xf')]['message']);return _0x4f36bc(_0x1e9b5b['error']['message']);}logger[_0x1fba('0xf')](_0x1fba('0xc'),_0x3a3a63,_0x1e9b5b[_0x1fba('0xf')][_0x1fba('0x11')]);return _0xabba60(_0x1e9b5b[_0x1fba('0xf')][_0x1fba('0x11')]);}else{logger[_0x1fba('0x12')](_0x1fba('0xc'),_0x3a3a63,_0x1fba('0xd'));_0xabba60(_0x1e9b5b['result'][_0x1fba('0x11')]);}})[_0x1fba('0x13')](function(_0x31b2fb){logger[_0x1fba('0xf')](_0x1fba('0xc'),_0x3a3a63,_0x31b2fb);_0x4f36bc(_0x31b2fb);});});}exports[_0x1fba('0x14')]=function(_0x30aaa8){var _0x366159=this;return new Promise(function(_0x43fa42,_0x19a412){return db['ChatInteraction'][_0x1fba('0x15')](_0x30aaa8['body'],{'raw':_0x30aaa8[_0x1fba('0x16')]?_0x30aaa8['options'][_0x1fba('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30aaa8[_0x1fba('0x16')]?_0x30aaa8['options'][_0x1fba('0x18')]||null:null,'attributes':_0x30aaa8[_0x1fba('0x16')]?_0x30aaa8['options'][_0x1fba('0x19')]||null:null,'limit':_0x30aaa8[_0x1fba('0x16')]?_0x30aaa8[_0x1fba('0x16')][_0x1fba('0x1a')]||null:null})[_0x1fba('0x1b')](function(_0x6bad22){logger[_0x1fba('0x12')]('UpdateChatInteraction',_0x30aaa8);logger['debug'](_0x1fba('0x14'),_0x30aaa8,JSON[_0x1fba('0x1c')](_0x6bad22));_0x43fa42(_0x6bad22);})[_0x1fba('0x13')](function(_0x47ab48){logger[_0x1fba('0xf')](_0x1fba('0x14'),_0x47ab48[_0x1fba('0x11')],_0x30aaa8);_0x19a412(_0x366159[_0x1fba('0xf')](0x1f4,_0x47ab48[_0x1fba('0x11')]));});});};exports['AddTagsToChatInteraction']=function(_0x392460){return new Promise(function(_0x16f9ec,_0x5008de){return db[_0x1fba('0x1d')][_0x1fba('0x1e')]({'where':_0x392460[_0x1fba('0x16')]?_0x392460[_0x1fba('0x16')][_0x1fba('0x18')]||null:null})[_0x1fba('0x1b')](function(_0x3db7a9){if(_0x3db7a9){return _0x3db7a9[_0x1fba('0x1f')](_0x392460['body'][_0x1fba('0x20')],_[_0x1fba('0x21')](_0x392460['body'],[_0x1fba('0x20'),'id'])||{});}})[_0x1fba('0x22')](function(_0x3ddc72){logger[_0x1fba('0x12')]('AddTags',_0x392460);logger[_0x1fba('0xe')]('AddTags',_0x392460,JSON['stringify'](_0x3ddc72));_0x16f9ec(_0x3ddc72);})[_0x1fba('0x13')](function(_0x2211dd){logger[_0x1fba('0xf')](_0x1fba('0x23'),_0x2211dd['message'],_0x392460);_0x5008de(_this[_0x1fba('0xf')](0x1f4,_0x2211dd[_0x1fba('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index af2dc74..51acad3 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 _0x5f58=['register','chatInteraction:','./chatInteraction.events','remove','update','emit','removeListener'];(function(_0x442db4,_0x4c17f9){var _0x1c8607=function(_0x21e85d){while(--_0x21e85d){_0x442db4['push'](_0x442db4['shift']());}};_0x1c8607(++_0x4c17f9);}(_0x5f58,0x1a6));var _0x85f5=function(_0x374c4a,_0x5afa32){_0x374c4a=_0x374c4a-0x0;var _0x103f4a=_0x5f58[_0x374c4a];return _0x103f4a;};'use strict';var ChatInteractionEvents=require(_0x85f5('0x0'));var events=['save',_0x85f5('0x1'),_0x85f5('0x2')];function createListener(_0x95673e,_0x27416e){return function(_0x174e14){_0x27416e[_0x85f5('0x3')](_0x95673e,_0x174e14);};}function removeListener(_0x5d6912,_0xb62caa){return function(){ChatInteractionEvents[_0x85f5('0x4')](_0x5d6912,_0xb62caa);};}exports[_0x85f5('0x5')]=function(_0x43bb52){for(var _0x225ac2=0x0,_0x4cd133=events['length'];_0x225ac2<_0x4cd133;_0x225ac2++){var _0x3d1d20=events[_0x225ac2];var _0x2f3dcc=createListener(_0x85f5('0x6')+_0x3d1d20,_0x43bb52);ChatInteractionEvents['on'](_0x3d1d20,_0x2f3dcc);}}; \ No newline at end of file +var _0x3094=['chatInteraction:','save','remove','update','emit','register','length'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3094,0x86));var _0x4309=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3094[_0x3dd15e];return _0x231fd0;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x4309('0x0'),_0x4309('0x1'),_0x4309('0x2')];function createListener(_0x56a160,_0x1e0048){return function(_0x50d54a){_0x1e0048[_0x4309('0x3')](_0x56a160,_0x50d54a);};}function removeListener(_0x101588,_0x297793){return function(){ChatInteractionEvents['removeListener'](_0x101588,_0x297793);};}exports[_0x4309('0x4')]=function(_0x43c338){for(var _0x5da01b=0x0,_0x3567d1=events[_0x4309('0x5')];_0x5da01b<_0x3567d1;_0x5da01b++){var _0x3b143f=events[_0x5da01b];var _0x5a19f6=createListener(_0x4309('0x6')+_0x3b143f,_0x43c338);ChatInteractionEvents['on'](_0x3b143f,_0x5a19f6);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index b8ca822..0963a31 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 _0x966c=['getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','join','root','%s-%s','now','originalname','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','chatinteraction:destroy','destroy','delete','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages'];(function(_0xb8cfbe,_0x2e81b6){var _0x227d51=function(_0x5cb1ff){while(--_0x5cb1ff){_0xb8cfbe['push'](_0xb8cfbe['shift']());}};_0x227d51(++_0x2e81b6);}(_0x966c,0x1ad));var _0xc966=function(_0x248c3d,_0x5438dc){_0x248c3d=_0x248c3d-0x0;var _0x12c2e2=_0x966c[_0x248c3d];return _0x12c2e2;};'use strict';var multer=require(_0xc966('0x0'));var util=require(_0xc966('0x1'));var path=require('path');var timeout=require(_0xc966('0x2'));var express=require(_0xc966('0x3'));var router=express[_0xc966('0x4')]();var fs_extra=require(_0xc966('0x5'));var auth=require(_0xc966('0x6'));var interaction=require(_0xc966('0x7'));var config=require(_0xc966('0x8'));var controller=require('./chatInteraction.controller');router[_0xc966('0x9')]('/',auth[_0xc966('0xa')](),controller[_0xc966('0xb')]);router['get']('/describe',auth[_0xc966('0xa')](),controller[_0xc966('0xc')]);router[_0xc966('0x9')](_0xc966('0xd'),auth[_0xc966('0xe')](),controller[_0xc966('0xf')]);router[_0xc966('0x9')](_0xc966('0x10'),auth[_0xc966('0xe')](),controller[_0xc966('0x11')]);router[_0xc966('0x9')](_0xc966('0x12'),auth[_0xc966('0xa')](),controller[_0xc966('0x13')]);router[_0xc966('0x9')](_0xc966('0x14'),auth[_0xc966('0xe')](),controller[_0xc966('0x15')]);router[_0xc966('0x9')](_0xc966('0x16'),auth[_0xc966('0xa')](),controller[_0xc966('0x17')]);router[_0xc966('0x18')]('/',auth[_0xc966('0xa')](),controller[_0xc966('0x19')]);router['post'](_0xc966('0x1a'),auth[_0xc966('0xa')](),controller[_0xc966('0x1b')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1b3638,_0x5aa2fc,_0x594f7a){_0x594f7a(null,path[_0xc966('0x1c')](config[_0xc966('0x1d')],'server/files/attachments/'));},'filename':function(_0x215920,_0x125cc6,_0x313c68){_0x313c68(null,util['format'](_0xc966('0x1e'),Date[_0xc966('0x1f')](),_0x125cc6[_0xc966('0x20')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xc966('0x18')](_0xc966('0x21'),upload[_0xc966('0x22')](_0xc966('0x23')),controller[_0xc966('0x24')]);router[_0xc966('0x18')](_0xc966('0x12'),auth[_0xc966('0xe')](),controller[_0xc966('0x25')]);router[_0xc966('0x18')](_0xc966('0x26'),auth[_0xc966('0xa')](),interaction[_0xc966('0x27')](_0xc966('0x28'),_0xc966('0x29')),controller['addTags']);router[_0xc966('0x2a')](_0xc966('0xd'),auth[_0xc966('0xa')](),interaction['tracked'](_0xc966('0x28'),_0xc966('0x2b')),controller[_0xc966('0x2c')]);router['put'](_0xc966('0x2d'),controller[_0xc966('0x2e')]);router['put'](_0xc966('0x2f'),auth['isChatInteractionAuthorized'](),controller[_0xc966('0x30')]);router[_0xc966('0x2a')](_0xc966('0x31'),controller[_0xc966('0x32')]);router['delete'](_0xc966('0xd'),auth[_0xc966('0xa')](),interaction[_0xc966('0x27')](_0xc966('0x28'),_0xc966('0x33')),controller[_0xc966('0x34')]);router[_0xc966('0x35')]('/:id/tags',auth['isAuthenticated'](),controller[_0xc966('0x36')]);module[_0xc966('0x37')]=router; \ No newline at end of file +var _0xf43a=['/:id/download','download','post','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','file','isChatInteractionAuthorized','addMessage','/:id/tags','chat','addTags','put','chatinteraction:update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','delete','/:id','tracked','destroy','removeTags','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','describe','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages'];(function(_0x44f16a,_0x43f134){var _0x2cc20f=function(_0x1e851c){while(--_0x1e851c){_0x44f16a['push'](_0x44f16a['shift']());}};_0x2cc20f(++_0x43f134);}(_0xf43a,0xc1));var _0xaf43=function(_0x4fab70,_0x520a86){_0x4fab70=_0x4fab70-0x0;var _0x322528=_0xf43a[_0x4fab70];return _0x322528;};'use strict';var multer=require('multer');var util=require(_0xaf43('0x0'));var path=require(_0xaf43('0x1'));var timeout=require(_0xaf43('0x2'));var express=require(_0xaf43('0x3'));var router=express[_0xaf43('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xaf43('0x5'));var interaction=require(_0xaf43('0x6'));var config=require(_0xaf43('0x7'));var controller=require('./chatInteraction.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xaf43('0x8')]);router[_0xaf43('0x9')](_0xaf43('0xa'),auth[_0xaf43('0xb')](),controller[_0xaf43('0xc')]);router['get']('/:id',auth['isChatInteractionAuthorized'](),controller[_0xaf43('0xd')]);router[_0xaf43('0x9')](_0xaf43('0xe'),auth['isChatInteractionAuthorized'](),controller[_0xaf43('0xf')]);router[_0xaf43('0x9')](_0xaf43('0x10'),auth[_0xaf43('0xb')](),controller[_0xaf43('0x11')]);router[_0xaf43('0x9')](_0xaf43('0x12'),auth['isChatInteractionAuthorized'](),controller['getMyMessages']);router['get'](_0xaf43('0x13'),auth[_0xaf43('0xb')](),controller[_0xaf43('0x14')]);router['post']('/',auth[_0xaf43('0xb')](),controller['create']);router[_0xaf43('0x15')](_0xaf43('0x16'),auth[_0xaf43('0xb')](),controller[_0xaf43('0x17')]);var upload=multer({'storage':multer[_0xaf43('0x18')]({'destination':function(_0x49e88b,_0x36a117,_0x5d686e){_0x5d686e(null,path[_0xaf43('0x19')](config[_0xaf43('0x1a')],_0xaf43('0x1b')));},'filename':function(_0x24091b,_0x550a38,_0x1cdd9d){_0x1cdd9d(null,util[_0xaf43('0x1c')](_0xaf43('0x1d'),Date[_0xaf43('0x1e')](),_0x550a38[_0xaf43('0x1f')][_0xaf43('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xaf43('0x15')](_0xaf43('0x21'),upload['single'](_0xaf43('0x22')),controller['attachmentUpload']);router[_0xaf43('0x15')](_0xaf43('0x10'),auth[_0xaf43('0x23')](),controller[_0xaf43('0x24')]);router[_0xaf43('0x15')](_0xaf43('0x25'),auth[_0xaf43('0xb')](),interaction['tracked'](_0xaf43('0x26'),'chatinteraction:addtags'),controller[_0xaf43('0x27')]);router[_0xaf43('0x28')]('/:id',auth[_0xaf43('0xb')](),interaction['tracked'](_0xaf43('0x26'),_0xaf43('0x29')),controller['update']);router['put'](_0xaf43('0x2a'),controller[_0xaf43('0x2b')]);router['put'](_0xaf43('0x2c'),auth[_0xaf43('0x23')](),controller[_0xaf43('0x2d')]);router[_0xaf43('0x28')](_0xaf43('0x2e'),controller['close']);router[_0xaf43('0x2f')](_0xaf43('0x30'),auth[_0xaf43('0xb')](),interaction[_0xaf43('0x31')](_0xaf43('0x26'),'chatinteraction:destroy'),controller[_0xaf43('0x32')]);router[_0xaf43('0x2f')](_0xaf43('0x25'),auth[_0xaf43('0xb')](),controller[_0xaf43('0x33')]);module[_0xaf43('0x34')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 38139b2..ff727dc 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 _0xf8bc=['exports','TEXT','medium','INTEGER','sequelize'];(function(_0x25d408,_0x2b1491){var _0x5d3043=function(_0x508031){while(--_0x508031){_0x25d408['push'](_0x25d408['shift']());}};_0x5d3043(++_0x2b1491);}(_0xf8bc,0xb8));var _0xcf8b=function(_0x4169d8,_0x3d7cd4){_0x4169d8=_0x4169d8-0x0;var _0x32084a=_0xf8bc[_0x4169d8];return _0x32084a;};'use strict';var Sequelize=require(_0xcf8b('0x0'));module[_0xcf8b('0x1')]={'body':{'type':Sequelize[_0xcf8b('0x2')](_0xcf8b('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xcf8b('0x4')]}}; \ No newline at end of file +var _0x20c3=['sequelize','exports','INTEGER'];(function(_0x41aa24,_0xe3bb56){var _0x3a758a=function(_0x2d00e2){while(--_0x2d00e2){_0x41aa24['push'](_0x41aa24['shift']());}};_0x3a758a(++_0xe3bb56);}(_0x20c3,0x189));var _0x320c=function(_0x5d51d2,_0x286a78){_0x5d51d2=_0x5d51d2-0x0;var _0x2c63f1=_0x20c3[_0x5d51d2];return _0x2c63f1;};'use strict';var Sequelize=require(_0x320c('0x0'));module[_0x320c('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x320c('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 8440d3f..98ceffb 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 _0x6027=['include','findAll','rows','catch','show','params','includeAll','find','create','body','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','User','admin','user','role','online','allowmessenger','showWebBar','-online','VoiceQueue','type','get','Agents','userProfileId','UserProfileResource','isEmpty','agent','push','FromId','ToId','read','-createdAt','eml-format','rimraf','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','error','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','sort','pick','filter','merge','where','options'];(function(_0x1e8366,_0x201c9f){var _0x44e61d=function(_0x34e516){while(--_0x34e516){_0x1e8366['push'](_0x1e8366['shift']());}};_0x44e61d(++_0x201c9f);}(_0x6027,0x14e));var _0x7602=function(_0xe2ebaa,_0x138483){_0xe2ebaa=_0xe2ebaa-0x0;var _0x563838=_0x6027[_0xe2ebaa];return _0x563838;};'use strict';var emlformat=require(_0x7602('0x0'));var rimraf=require(_0x7602('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7602('0x2'));var moment=require('moment');var BPromise=require(_0x7602('0x3'));var Mustache=require(_0x7602('0x4'));var util=require(_0x7602('0x5'));var path=require('path');var sox=require(_0x7602('0x6'));var csv=require(_0x7602('0x7'));var ejs=require(_0x7602('0x8'));var fs=require('fs');var fs_extra=require(_0x7602('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7602('0xa'));var jsforce=require(_0x7602('0xb'));var deskjs=require(_0x7602('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7602('0xd'));var Papa=require(_0x7602('0xe'));var Redis=require('ioredis');var authService=require(_0x7602('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x7602('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7602('0x11'))(_0x7602('0x12'));var utils=require(_0x7602('0x13'));var config=require(_0x7602('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x7602('0x15')]=_[_0x7602('0x16')](config['redis'],{'host':_0x7602('0x17'),'port':0x18eb});var socket=require(_0x7602('0x18'))(new Redis(config['redis']));require('./chatInternalMessage.socket')['register'](socket);function respondWithStatusCode(_0x2d7d41,_0x26e76a){_0x26e76a=_0x26e76a||0xcc;return function(_0x1b2d89){if(_0x1b2d89){return _0x2d7d41[_0x7602('0x19')](_0x26e76a);}return _0x2d7d41[_0x7602('0x1a')](_0x26e76a)[_0x7602('0x1b')]();};}function respondWithResult(_0x389bcd,_0x5daf72){_0x5daf72=_0x5daf72||0xc8;return function(_0x496136){if(_0x496136){return _0x389bcd[_0x7602('0x1a')](_0x5daf72)[_0x7602('0x1c')](_0x496136);}};}function respondWithFilteredResult(_0x4c40f4,_0x3a4a4f){return function(_0x37a998){if(_0x37a998){var _0x145b0f=typeof _0x3a4a4f[_0x7602('0x1d')]===_0x7602('0x1e')&&typeof _0x3a4a4f['limit']===_0x7602('0x1e');var _0x574f7e=_0x37a998['count'];var _0x161378=_0x145b0f?0x0:_0x3a4a4f[_0x7602('0x1d')];var _0x3d3651=_0x145b0f?_0x37a998[_0x7602('0x1f')]:_0x3a4a4f[_0x7602('0x1d')]+_0x3a4a4f[_0x7602('0x20')];var _0x5ca90d;if(_0x3d3651>=_0x574f7e){_0x3d3651=_0x574f7e;_0x5ca90d=0xc8;}else{_0x5ca90d=0xce;}_0x4c40f4[_0x7602('0x1a')](_0x5ca90d);return _0x4c40f4[_0x7602('0x21')]('Content-Range',_0x161378+'-'+_0x3d3651+'/'+_0x574f7e)[_0x7602('0x1c')](_0x37a998);}return null;};}function patchUpdates(_0x5dc4e9){return function(_0x2eee9d){try{jsonpatch[_0x7602('0x22')](_0x2eee9d,_0x5dc4e9,!![]);}catch(_0xdbb6b3){return BPromise[_0x7602('0x23')](_0xdbb6b3);}return _0x2eee9d['save']();};}function saveUpdates(_0x59500a,_0x268644){return function(_0x249dfb){if(_0x249dfb){return _0x249dfb[_0x7602('0x24')](_0x59500a)[_0x7602('0x25')](function(_0x7c0021){return _0x7c0021;});}return null;};}function removeEntity(_0x553a11,_0x25fbeb){return function(_0x180f17){if(_0x180f17){return _0x180f17[_0x7602('0x26')]()['then'](function(){_0x553a11[_0x7602('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19d057,_0x318df2){return function(_0x2158e7){if(!_0x2158e7){_0x19d057[_0x7602('0x19')](0x194);}return _0x2158e7;};}function handleError(_0xc236d6,_0x594c0e){_0x594c0e=_0x594c0e||0x1f4;return function(_0xa5d0b4){logger[_0x7602('0x27')](_0xa5d0b4['stack']);if(_0xa5d0b4[_0x7602('0x28')]){delete _0xa5d0b4[_0x7602('0x28')];}_0xc236d6[_0x7602('0x1a')](_0x594c0e)[_0x7602('0x29')](_0xa5d0b4);};}exports[_0x7602('0x2a')]=function(_0x4f115b,_0xefe1cd){var _0x2402e0={},_0x32e62d={},_0x53d30c={'count':0x0,'rows':[]};var _0x4e3c10=_[_0x7602('0x2b')](db[_0x7602('0x2c')][_0x7602('0x2d')],function(_0xa8eff){return{'name':_0xa8eff[_0x7602('0x2e')],'type':_0xa8eff['type'][_0x7602('0x2f')]};});_0x32e62d[_0x7602('0x30')]=_[_0x7602('0x2b')](_0x4e3c10,_0x7602('0x28'));_0x32e62d[_0x7602('0x31')]=_[_0x7602('0x32')](_0x4f115b['query']);_0x32e62d[_0x7602('0x33')]=_[_0x7602('0x34')](_0x32e62d[_0x7602('0x30')],_0x32e62d['query']);_0x2402e0[_0x7602('0x35')]=_[_0x7602('0x34')](_0x32e62d[_0x7602('0x30')],qs[_0x7602('0x36')](_0x4f115b[_0x7602('0x31')][_0x7602('0x36')]));_0x2402e0[_0x7602('0x35')]=_0x2402e0[_0x7602('0x35')][_0x7602('0x37')]?_0x2402e0['attributes']:_0x32e62d['model'];if(!_0x4f115b[_0x7602('0x31')]['hasOwnProperty']('nolimit')){_0x2402e0[_0x7602('0x20')]=qs['limit'](_0x4f115b['query'][_0x7602('0x20')]);_0x2402e0[_0x7602('0x1d')]=qs['offset'](_0x4f115b[_0x7602('0x31')][_0x7602('0x1d')]);}_0x2402e0['order']=qs['sort'](_0x4f115b[_0x7602('0x31')][_0x7602('0x38')]);_0x2402e0['where']=qs[_0x7602('0x33')](_[_0x7602('0x39')](_0x4f115b['query'],_0x32e62d[_0x7602('0x33')]),_0x4e3c10);if(_0x4f115b[_0x7602('0x31')][_0x7602('0x3a')]){_0x2402e0['where']=_[_0x7602('0x3b')](_0x2402e0[_0x7602('0x3c')],{'$or':_[_0x7602('0x2b')](_0x4e3c10,function(_0x2678da){if(_0x2678da['type']!=='VIRTUAL'){var _0x103c90={};_0x103c90[_0x2678da[_0x7602('0x28')]]={'$like':'%'+_0x4f115b[_0x7602('0x31')][_0x7602('0x3a')]+'%'};return _0x103c90;}})});}_0x2402e0=_[_0x7602('0x3b')]({},_0x2402e0,_0x4f115b[_0x7602('0x3d')]);var _0x1ecf9f={'where':_0x2402e0[_0x7602('0x3c')]};return db[_0x7602('0x2c')][_0x7602('0x1f')](_0x1ecf9f)['then'](function(_0x5278bf){_0x53d30c[_0x7602('0x1f')]=_0x5278bf;if(_0x4f115b[_0x7602('0x31')]['includeAll']){_0x2402e0[_0x7602('0x3e')]=[{'all':!![]}];}return db[_0x7602('0x2c')][_0x7602('0x3f')](_0x2402e0);})[_0x7602('0x25')](function(_0x2f479f){_0x53d30c[_0x7602('0x40')]=_0x2f479f;return _0x53d30c;})[_0x7602('0x25')](respondWithFilteredResult(_0xefe1cd,_0x2402e0))[_0x7602('0x41')](handleError(_0xefe1cd,null));};exports[_0x7602('0x42')]=function(_0xdc888b,_0xdd8d0e){var _0x1d6039={'raw':!![],'where':{'id':_0xdc888b[_0x7602('0x43')]['id']}},_0x3c392b={};_0x3c392b[_0x7602('0x30')]=_['keys'](db[_0x7602('0x2c')][_0x7602('0x2d')]);_0x3c392b[_0x7602('0x31')]=_[_0x7602('0x32')](_0xdc888b['query']);_0x3c392b['filters']=_['intersection'](_0x3c392b[_0x7602('0x30')],_0x3c392b[_0x7602('0x31')]);_0x1d6039[_0x7602('0x35')]=_[_0x7602('0x34')](_0x3c392b[_0x7602('0x30')],qs[_0x7602('0x36')](_0xdc888b[_0x7602('0x31')]['fields']));_0x1d6039[_0x7602('0x35')]=_0x1d6039[_0x7602('0x35')]['length']?_0x1d6039[_0x7602('0x35')]:_0x3c392b[_0x7602('0x30')];if(_0xdc888b['query'][_0x7602('0x44')]){_0x1d6039[_0x7602('0x3e')]=[{'all':!![]}];}_0x1d6039=_[_0x7602('0x3b')]({},_0x1d6039,_0xdc888b[_0x7602('0x3d')]);return db[_0x7602('0x2c')][_0x7602('0x45')](_0x1d6039)[_0x7602('0x25')](handleEntityNotFound(_0xdd8d0e,null))[_0x7602('0x25')](respondWithResult(_0xdd8d0e,null))[_0x7602('0x41')](handleError(_0xdd8d0e,null));};exports[_0x7602('0x46')]=function(_0x186125,_0x1dd924){return db[_0x7602('0x2c')][_0x7602('0x46')](_0x186125[_0x7602('0x47')],{})[_0x7602('0x25')](respondWithResult(_0x1dd924,0xc9))[_0x7602('0x41')](handleError(_0x1dd924,null));};exports[_0x7602('0x24')]=function(_0x437d20,_0x41794e){if(_0x437d20['body']['id']){delete _0x437d20[_0x7602('0x47')]['id'];}return db[_0x7602('0x2c')][_0x7602('0x45')]({'where':{'id':_0x437d20[_0x7602('0x43')]['id']}})[_0x7602('0x25')](handleEntityNotFound(_0x41794e,null))[_0x7602('0x25')](saveUpdates(_0x437d20['body'],null))['then'](respondWithResult(_0x41794e,null))[_0x7602('0x41')](handleError(_0x41794e,null));};exports[_0x7602('0x26')]=function(_0x4d315e,_0x100853){return db[_0x7602('0x2c')]['find']({'where':{'id':_0x4d315e[_0x7602('0x43')]['id']}})['then'](handleEntityNotFound(_0x100853,null))['then'](removeEntity(_0x100853,null))['catch'](handleError(_0x100853,null));};exports['describe']=function(_0x1240e4,_0x5cae10){return db[_0x7602('0x2c')]['describe']()[_0x7602('0x25')](respondWithResult(_0x5cae10,null))[_0x7602('0x41')](handleError(_0x5cae10,null));};function wrapUser(_0x1aa46f){return function(_0x53e480){var _0x339f0f=_0x1aa46f['get']({'plain':!![]});_0x339f0f[_0x7602('0x48')]=[];if(_0x53e480){_0x339f0f[_0x7602('0x49')]=_0x53e480[_0x7602('0x4a')];_0x339f0f[_0x7602('0x4b')]=_0x53e480;}else{_0x339f0f[_0x7602('0x49')]=moment(0x0)[_0x7602('0x4c')](_0x7602('0x4d'));_0x339f0f[_0x7602('0x4b')]={};}return _0x339f0f;};}exports['getUsers']=function(_0x2c9936,_0x1be4e0,_0x390c64){var _0x51249d=[];return db[_0x7602('0x4e')]['findAll']({'where':{'role':['agent',_0x7602('0x4f'),_0x7602('0x50')]},'attributes':['id','fullname',_0x7602('0x28'),_0x7602('0x51'),'userpic','internal',_0x7602('0x52'),'lastLoginAt',_0x7602('0x53'),_0x7602('0x54')],'order':qs[_0x7602('0x38')](_0x7602('0x55')),'include':[{'model':db[_0x7602('0x56')],'as':'VoiceQueues','attributes':['id',_0x7602('0x28'),_0x7602('0x57')],'through':{'attributes':[]}}]})['then'](function(_0x4d3935){if(_0x4d3935){var _0x29441d=_0x2c9936[_0x7602('0x50')][_0x7602('0x58')]({'plain':!![]});if(!_0x29441d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29441d['role']===_0x7602('0x50')){return db['UserProfileSection'][_0x7602('0x45')]({'where':{'name':_0x7602('0x59'),'userProfileId':_0x29441d[_0x7602('0x5a')]},'raw':!![]})[_0x7602('0x25')](function(_0x52b4cb){if(_0x52b4cb){if(_0x52b4cb['autoAssociation']===0x0){return db[_0x7602('0x5b')][_0x7602('0x3f')]({'where':{'sectionId':_0x52b4cb['id']},'raw':!![]})[_0x7602('0x25')](function(_0x149f12){var _0xd5480c=[];if(_[_0x7602('0x5c')](_0x149f12)){_0xd5480c=_['filter'](_0x4d3935,function(_0x29fdad){if(_0x29fdad[_0x7602('0x51')]!==_0x7602('0x5d')){return _0x29fdad;}});return _0xd5480c;}else{for(var _0x265e84=0x0;_0x265e84<_0x4d3935[_0x7602('0x37')];_0x265e84++){var _0x50b731=_0x4d3935[_0x265e84];if(_0x50b731['role']===_0x7602('0x5d')){var _0x9f386=_[_0x7602('0x45')](_0x149f12,function(_0x1ba181){return _0x1ba181['resourceId']===_0x50b731['id'];});if(_0x9f386)_0xd5480c[_0x7602('0x5e')](_0x50b731);}else{_0xd5480c['push'](_0x50b731);}}return _0xd5480c;}});}else{return _0x4d3935;}}else{var _0x447440=_[_0x7602('0x3a')](_0x4d3935,function(_0x5e8b35){if(_0x5e8b35['role']!==_0x7602('0x5d')){return _0x5e8b35;}});return _0x447440;}});}else{return _0x4d3935;}}})[_0x7602('0x25')](function(_0x42e7e4){var _0x1de55a=[];if(_0x42e7e4){_0x51249d=_0x42e7e4;for(var _0x48f755=0x0;_0x48f755<_0x42e7e4['length'];_0x48f755+=0x1){_0x51249d[_0x48f755][_0x7602('0x48')]=[];_0x1de55a[_0x7602('0x5e')](db[_0x7602('0x2c')][_0x7602('0x45')]({'where':{'FromId':[_0x2c9936['user']['id'],_0x42e7e4[_0x48f755]['id']],'ToId':[_0x2c9936[_0x7602('0x50')]['id'],_0x42e7e4[_0x48f755]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x7602('0x5f'),_0x7602('0x60'),_0x7602('0x61'),_0x7602('0x47')],'order':qs[_0x7602('0x38')](_0x7602('0x62')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x7602('0x25')](wrapUser(_0x42e7e4[_0x48f755])));}return BPromise['all'](_0x1de55a);}return[];})['then'](function(_0x3bba19){return{'rows':_0x3bba19,'count':_0x3bba19[_0x7602('0x37')]};})[_0x7602('0x25')](respondWithResult(_0x1be4e0,null))['catch'](handleError(_0x1be4e0,null));}; \ No newline at end of file +var _0x9f12=['error','stack','name','send','ChatInternalMessage','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','where','pick','map','filter','merge','options','count','includeAll','include','catch','show','params','intersection','find','create','body','get','createdAt','lastMessage','lastMessageAt','format','getUsers','findAll','agent','admin','user','fullname','userpic','internal','online','showWebBar','-online','VoiceQueue','VoiceQueues','role','Agents','autoAssociation','UserProfileResource','isEmpty','resourceId','push','messages','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','set','Content-Range','update','destroy','then','sendStatus'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9f12,0x17a));var _0x29f1=function(_0x27671f,_0x449b6a){_0x27671f=_0x27671f-0x0;var _0x523bbf=_0x9f12[_0x27671f];return _0x523bbf;};'use strict';var emlformat=require(_0x29f1('0x0'));var rimraf=require(_0x29f1('0x1'));var zipdir=require(_0x29f1('0x2'));var jsonpatch=require(_0x29f1('0x3'));var rp=require(_0x29f1('0x4'));var moment=require(_0x29f1('0x5'));var BPromise=require(_0x29f1('0x6'));var Mustache=require(_0x29f1('0x7'));var util=require(_0x29f1('0x8'));var path=require(_0x29f1('0x9'));var sox=require(_0x29f1('0xa'));var csv=require(_0x29f1('0xb'));var ejs=require(_0x29f1('0xc'));var fs=require('fs');var fs_extra=require(_0x29f1('0xd'));var _=require(_0x29f1('0xe'));var squel=require('squel');var crypto=require(_0x29f1('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x29f1('0x10'));var toCsv=require('to-csv');var querystring=require(_0x29f1('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x29f1('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x29f1('0x13'));var logger=require('../../config/logger')(_0x29f1('0x14'));var utils=require(_0x29f1('0x15'));var config=require(_0x29f1('0x16'));var licenseUtil=require(_0x29f1('0x17'));var db=require(_0x29f1('0x18'))['db'];config[_0x29f1('0x19')]=_[_0x29f1('0x1a')](config[_0x29f1('0x19')],{'host':_0x29f1('0x1b'),'port':0x18eb});var socket=require(_0x29f1('0x1c'))(new Redis(config[_0x29f1('0x19')]));require('./chatInternalMessage.socket')[_0x29f1('0x1d')](socket);function respondWithStatusCode(_0x7c5689,_0x15da5e){_0x15da5e=_0x15da5e||0xcc;return function(_0x443a7a){if(_0x443a7a){return _0x7c5689['sendStatus'](_0x15da5e);}return _0x7c5689[_0x29f1('0x1e')](_0x15da5e)[_0x29f1('0x1f')]();};}function respondWithResult(_0x343a37,_0x245ee0){_0x245ee0=_0x245ee0||0xc8;return function(_0x4baa6a){if(_0x4baa6a){return _0x343a37['status'](_0x245ee0)[_0x29f1('0x20')](_0x4baa6a);}};}function respondWithFilteredResult(_0x4d105d,_0x372150){return function(_0x3254bc){if(_0x3254bc){var _0xaa4e4a=typeof _0x372150[_0x29f1('0x21')]===_0x29f1('0x22')&&typeof _0x372150[_0x29f1('0x23')]===_0x29f1('0x22');var _0x35aeec=_0x3254bc['count'];var _0x4cf485=_0xaa4e4a?0x0:_0x372150['offset'];var _0x1145de=_0xaa4e4a?_0x3254bc['count']:_0x372150[_0x29f1('0x21')]+_0x372150['limit'];var _0x27f285;if(_0x1145de>=_0x35aeec){_0x1145de=_0x35aeec;_0x27f285=0xc8;}else{_0x27f285=0xce;}_0x4d105d[_0x29f1('0x1e')](_0x27f285);return _0x4d105d[_0x29f1('0x24')](_0x29f1('0x25'),_0x4cf485+'-'+_0x1145de+'/'+_0x35aeec)['json'](_0x3254bc);}return null;};}function patchUpdates(_0x2cf7bc){return function(_0x49c954){try{jsonpatch['apply'](_0x49c954,_0x2cf7bc,!![]);}catch(_0x525281){return BPromise['reject'](_0x525281);}return _0x49c954['save']();};}function saveUpdates(_0xc98c27,_0x14f171){return function(_0xe75ebc){if(_0xe75ebc){return _0xe75ebc[_0x29f1('0x26')](_0xc98c27)['then'](function(_0x30f253){return _0x30f253;});}return null;};}function removeEntity(_0x314994,_0x377f71){return function(_0xadc58c){if(_0xadc58c){return _0xadc58c[_0x29f1('0x27')]()[_0x29f1('0x28')](function(){_0x314994[_0x29f1('0x1e')](0xcc)[_0x29f1('0x1f')]();});}};}function handleEntityNotFound(_0x15a4ba,_0x9c97c3){return function(_0x5b3bf4){if(!_0x5b3bf4){_0x15a4ba[_0x29f1('0x29')](0x194);}return _0x5b3bf4;};}function handleError(_0x36f687,_0x2808fc){_0x2808fc=_0x2808fc||0x1f4;return function(_0x3dd314){logger[_0x29f1('0x2a')](_0x3dd314[_0x29f1('0x2b')]);if(_0x3dd314[_0x29f1('0x2c')]){delete _0x3dd314[_0x29f1('0x2c')];}_0x36f687[_0x29f1('0x1e')](_0x2808fc)[_0x29f1('0x2d')](_0x3dd314);};}exports['index']=function(_0x5bab33,_0x26825e){var _0xdc1ebf={},_0x3afed4={},_0x93d8bb={'count':0x0,'rows':[]};var _0x46fcf9=_['map'](db[_0x29f1('0x2e')][_0x29f1('0x2f')],function(_0x457e4e){return{'name':_0x457e4e[_0x29f1('0x30')],'type':_0x457e4e[_0x29f1('0x31')]['key']};});_0x3afed4[_0x29f1('0x32')]=_['map'](_0x46fcf9,_0x29f1('0x2c'));_0x3afed4[_0x29f1('0x33')]=_[_0x29f1('0x34')](_0x5bab33[_0x29f1('0x33')]);_0x3afed4[_0x29f1('0x35')]=_['intersection'](_0x3afed4[_0x29f1('0x32')],_0x3afed4[_0x29f1('0x33')]);_0xdc1ebf[_0x29f1('0x36')]=_['intersection'](_0x3afed4[_0x29f1('0x32')],qs[_0x29f1('0x37')](_0x5bab33[_0x29f1('0x33')][_0x29f1('0x37')]));_0xdc1ebf[_0x29f1('0x36')]=_0xdc1ebf[_0x29f1('0x36')][_0x29f1('0x38')]?_0xdc1ebf[_0x29f1('0x36')]:_0x3afed4[_0x29f1('0x32')];if(!_0x5bab33[_0x29f1('0x33')][_0x29f1('0x39')]('nolimit')){_0xdc1ebf['limit']=qs[_0x29f1('0x23')](_0x5bab33['query'][_0x29f1('0x23')]);_0xdc1ebf[_0x29f1('0x21')]=qs[_0x29f1('0x21')](_0x5bab33[_0x29f1('0x33')][_0x29f1('0x21')]);}_0xdc1ebf[_0x29f1('0x3a')]=qs['sort'](_0x5bab33['query']['sort']);_0xdc1ebf[_0x29f1('0x3b')]=qs[_0x29f1('0x35')](_[_0x29f1('0x3c')](_0x5bab33[_0x29f1('0x33')],_0x3afed4[_0x29f1('0x35')]),_0x46fcf9);if(_0x5bab33['query']['filter']){_0xdc1ebf[_0x29f1('0x3b')]=_['merge'](_0xdc1ebf[_0x29f1('0x3b')],{'$or':_[_0x29f1('0x3d')](_0x46fcf9,function(_0x4304e9){if(_0x4304e9[_0x29f1('0x31')]!=='VIRTUAL'){var _0x8f4057={};_0x8f4057[_0x4304e9['name']]={'$like':'%'+_0x5bab33[_0x29f1('0x33')][_0x29f1('0x3e')]+'%'};return _0x8f4057;}})});}_0xdc1ebf=_[_0x29f1('0x3f')]({},_0xdc1ebf,_0x5bab33[_0x29f1('0x40')]);var _0x15a4a2={'where':_0xdc1ebf[_0x29f1('0x3b')]};return db[_0x29f1('0x2e')][_0x29f1('0x41')](_0x15a4a2)['then'](function(_0x45f571){_0x93d8bb['count']=_0x45f571;if(_0x5bab33[_0x29f1('0x33')][_0x29f1('0x42')]){_0xdc1ebf[_0x29f1('0x43')]=[{'all':!![]}];}return db[_0x29f1('0x2e')]['findAll'](_0xdc1ebf);})[_0x29f1('0x28')](function(_0x536ebd){_0x93d8bb['rows']=_0x536ebd;return _0x93d8bb;})[_0x29f1('0x28')](respondWithFilteredResult(_0x26825e,_0xdc1ebf))[_0x29f1('0x44')](handleError(_0x26825e,null));};exports[_0x29f1('0x45')]=function(_0x38f7d8,_0xc4f756){var _0x51dcc1={'raw':!![],'where':{'id':_0x38f7d8[_0x29f1('0x46')]['id']}},_0x428111={};_0x428111[_0x29f1('0x32')]=_[_0x29f1('0x34')](db[_0x29f1('0x2e')][_0x29f1('0x2f')]);_0x428111[_0x29f1('0x33')]=_[_0x29f1('0x34')](_0x38f7d8[_0x29f1('0x33')]);_0x428111['filters']=_[_0x29f1('0x47')](_0x428111[_0x29f1('0x32')],_0x428111[_0x29f1('0x33')]);_0x51dcc1[_0x29f1('0x36')]=_[_0x29f1('0x47')](_0x428111[_0x29f1('0x32')],qs[_0x29f1('0x37')](_0x38f7d8['query'][_0x29f1('0x37')]));_0x51dcc1[_0x29f1('0x36')]=_0x51dcc1[_0x29f1('0x36')][_0x29f1('0x38')]?_0x51dcc1['attributes']:_0x428111[_0x29f1('0x32')];if(_0x38f7d8[_0x29f1('0x33')][_0x29f1('0x42')]){_0x51dcc1['include']=[{'all':!![]}];}_0x51dcc1=_['merge']({},_0x51dcc1,_0x38f7d8[_0x29f1('0x40')]);return db[_0x29f1('0x2e')][_0x29f1('0x48')](_0x51dcc1)[_0x29f1('0x28')](handleEntityNotFound(_0xc4f756,null))[_0x29f1('0x28')](respondWithResult(_0xc4f756,null))[_0x29f1('0x44')](handleError(_0xc4f756,null));};exports[_0x29f1('0x49')]=function(_0xd49b63,_0x180c13){return db['ChatInternalMessage'][_0x29f1('0x49')](_0xd49b63[_0x29f1('0x4a')],{})[_0x29f1('0x28')](respondWithResult(_0x180c13,0xc9))['catch'](handleError(_0x180c13,null));};exports[_0x29f1('0x26')]=function(_0x305cee,_0x1c102b){if(_0x305cee['body']['id']){delete _0x305cee['body']['id'];}return db[_0x29f1('0x2e')]['find']({'where':{'id':_0x305cee[_0x29f1('0x46')]['id']}})['then'](handleEntityNotFound(_0x1c102b,null))['then'](saveUpdates(_0x305cee[_0x29f1('0x4a')],null))[_0x29f1('0x28')](respondWithResult(_0x1c102b,null))[_0x29f1('0x44')](handleError(_0x1c102b,null));};exports[_0x29f1('0x27')]=function(_0x18dc55,_0x4fdfcf){return db[_0x29f1('0x2e')]['find']({'where':{'id':_0x18dc55[_0x29f1('0x46')]['id']}})[_0x29f1('0x28')](handleEntityNotFound(_0x4fdfcf,null))[_0x29f1('0x28')](removeEntity(_0x4fdfcf,null))[_0x29f1('0x44')](handleError(_0x4fdfcf,null));};exports['describe']=function(_0x49e4c1,_0xbb8349){return db[_0x29f1('0x2e')]['describe']()[_0x29f1('0x28')](respondWithResult(_0xbb8349,null))['catch'](handleError(_0xbb8349,null));};function wrapUser(_0x1f1209){return function(_0x52650f){var _0x107c90=_0x1f1209[_0x29f1('0x4b')]({'plain':!![]});_0x107c90['messages']=[];if(_0x52650f){_0x107c90['lastMessageAt']=_0x52650f[_0x29f1('0x4c')];_0x107c90[_0x29f1('0x4d')]=_0x52650f;}else{_0x107c90[_0x29f1('0x4e')]=moment(0x0)[_0x29f1('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x107c90[_0x29f1('0x4d')]={};}return _0x107c90;};}exports[_0x29f1('0x50')]=function(_0x9aba43,_0x61e3bd,_0x48f020){var _0x55dee4=[];return db['User'][_0x29f1('0x51')]({'where':{'role':[_0x29f1('0x52'),_0x29f1('0x53'),_0x29f1('0x54')]},'attributes':['id',_0x29f1('0x55'),_0x29f1('0x2c'),'role',_0x29f1('0x56'),_0x29f1('0x57'),_0x29f1('0x58'),'lastLoginAt','allowmessenger',_0x29f1('0x59')],'order':qs['sort'](_0x29f1('0x5a')),'include':[{'model':db[_0x29f1('0x5b')],'as':_0x29f1('0x5c'),'attributes':['id',_0x29f1('0x2c'),_0x29f1('0x31')],'through':{'attributes':[]}}]})['then'](function(_0x52b81e){if(_0x52b81e){var _0x29a663=_0x9aba43['user'][_0x29f1('0x4b')]({'plain':!![]});if(!_0x29a663)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29a663[_0x29f1('0x5d')]===_0x29f1('0x54')){return db['UserProfileSection'][_0x29f1('0x48')]({'where':{'name':_0x29f1('0x5e'),'userProfileId':_0x29a663['userProfileId']},'raw':!![]})[_0x29f1('0x28')](function(_0x5296cb){if(_0x5296cb){if(_0x5296cb[_0x29f1('0x5f')]===0x0){return db[_0x29f1('0x60')]['findAll']({'where':{'sectionId':_0x5296cb['id']},'raw':!![]})[_0x29f1('0x28')](function(_0x36542f){var _0x14b3a4=[];if(_[_0x29f1('0x61')](_0x36542f)){_0x14b3a4=_[_0x29f1('0x3e')](_0x52b81e,function(_0x2a0fa2){if(_0x2a0fa2[_0x29f1('0x5d')]!=='agent'){return _0x2a0fa2;}});return _0x14b3a4;}else{for(var _0x1946f3=0x0;_0x1946f3<_0x52b81e[_0x29f1('0x38')];_0x1946f3++){var _0x41b4f3=_0x52b81e[_0x1946f3];if(_0x41b4f3[_0x29f1('0x5d')]===_0x29f1('0x52')){var _0x52f4b2=_['find'](_0x36542f,function(_0x1a6124){return _0x1a6124[_0x29f1('0x62')]===_0x41b4f3['id'];});if(_0x52f4b2)_0x14b3a4[_0x29f1('0x63')](_0x41b4f3);}else{_0x14b3a4[_0x29f1('0x63')](_0x41b4f3);}}return _0x14b3a4;}});}else{return _0x52b81e;}}else{var _0xe11e19=_['filter'](_0x52b81e,function(_0x2f2b46){if(_0x2f2b46[_0x29f1('0x5d')]!==_0x29f1('0x52')){return _0x2f2b46;}});return _0xe11e19;}});}else{return _0x52b81e;}}})['then'](function(_0x507c4e){var _0x156041=[];if(_0x507c4e){_0x55dee4=_0x507c4e;for(var _0x27b647=0x0;_0x27b647<_0x507c4e[_0x29f1('0x38')];_0x27b647+=0x1){_0x55dee4[_0x27b647][_0x29f1('0x64')]=[];_0x156041[_0x29f1('0x63')](db[_0x29f1('0x2e')][_0x29f1('0x48')]({'where':{'FromId':[_0x9aba43[_0x29f1('0x54')]['id'],_0x507c4e[_0x27b647]['id']],'ToId':[_0x9aba43[_0x29f1('0x54')]['id'],_0x507c4e[_0x27b647]['id']],'ChatGroupId':null},'attributes':['id',_0x29f1('0x4c'),'FromId',_0x29f1('0x65'),_0x29f1('0x66'),_0x29f1('0x4a')],'order':qs['sort'](_0x29f1('0x67')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x29f1('0x28')](wrapUser(_0x507c4e[_0x27b647])));}return BPromise[_0x29f1('0x68')](_0x156041);}return[];})[_0x29f1('0x28')](function(_0x20037d){return{'rows':_0x20037d,'count':_0x20037d['length']};})['then'](respondWithResult(_0x61e3bd,null))[_0x29f1('0x44')](handleError(_0x61e3bd,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 0bef637..3aacfc2 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 _0xd2d5=['emit','hook','exports','events','../../mysqldb','save','update','remove'];(function(_0x4ac6b5,_0xad35d1){var _0x2ff93e=function(_0x23be00){while(--_0x23be00){_0x4ac6b5['push'](_0x4ac6b5['shift']());}};_0x2ff93e(++_0xad35d1);}(_0xd2d5,0xab));var _0x5d2d=function(_0x5da27f,_0x504b76){_0x5da27f=_0x5da27f-0x0;var _0x54a3fb=_0xd2d5[_0x5da27f];return _0x54a3fb;};'use strict';var EventEmitter=require(_0x5d2d('0x0'));var ChatInternalMessage=require(_0x5d2d('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5d2d('0x2'),'afterUpdate':_0x5d2d('0x3'),'afterDestroy':_0x5d2d('0x4')};function emitEvent(_0x4b7c64){return function(_0x13438d,_0x30d8cd,_0x525807){ChatInternalMessageEvents[_0x5d2d('0x5')](_0x4b7c64+':'+_0x13438d['id'],_0x13438d);ChatInternalMessageEvents[_0x5d2d('0x5')](_0x4b7c64,_0x13438d);_0x525807(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x5d2d('0x6')](e,emitEvent(event));}}module[_0x5d2d('0x7')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x083f=['events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x4e6cfc,_0x524247){var _0x2806bb=function(_0x23c863){while(--_0x23c863){_0x4e6cfc['push'](_0x4e6cfc['shift']());}};_0x2806bb(++_0x524247);}(_0x083f,0xd1));var _0xf083=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x083f[_0x40a045];return _0x1a687c;};'use strict';var EventEmitter=require(_0xf083('0x0'));var ChatInternalMessage=require(_0xf083('0x1'))['db'][_0xf083('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xf083('0x3')](0x0);var events={'afterCreate':_0xf083('0x4'),'afterUpdate':_0xf083('0x5'),'afterDestroy':_0xf083('0x6')};function emitEvent(_0x38f7e6){return function(_0x374f86,_0x1e47dd,_0x338bb0){ChatInternalMessageEvents[_0xf083('0x7')](_0x38f7e6+':'+_0x374f86['id'],_0x374f86);ChatInternalMessageEvents[_0xf083('0x7')](_0x38f7e6,_0x374f86);_0x338bb0(null);};}for(var e in events){if(events[_0xf083('0x8')](e)){var event=events[e];ChatInternalMessage[_0xf083('0x9')](e,emitEvent(event));}}module[_0xf083('0xa')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index a33e753..94b8ebd 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 _0x9181=['lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9181,0x196));var _0x1918=function(_0x18b94d,_0x128692){_0x18b94d=_0x18b94d-0x0;var _0x1939d3=_0x9181[_0x18b94d];return _0x1939d3;};'use strict';var _=require(_0x1918('0x0'));var util=require(_0x1918('0x1'));var logger=require('../../config/logger')(_0x1918('0x2'));var moment=require(_0x1918('0x3'));var BPromise=require('bluebird');var rp=require(_0x1918('0x4'));var fs=require('fs');var path=require(_0x1918('0x5'));var rimraf=require(_0x1918('0x6'));var config=require(_0x1918('0x7'));var attributes=require(_0x1918('0x8'));module['exports']=function(_0x1de7b7,_0x24cfa2){return _0x1de7b7[_0x1918('0x9')](_0x1918('0xa'),attributes,{'tableName':_0x1918('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1918('0xc'),'collate':_0x1918('0xd')});}; \ No newline at end of file +var _0x4ef5=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','exports','define','chat_internal_messages'];(function(_0x1dc029,_0x40ea99){var _0x1fdaa3=function(_0x37de31){while(--_0x37de31){_0x1dc029['push'](_0x1dc029['shift']());}};_0x1fdaa3(++_0x40ea99);}(_0x4ef5,0x109));var _0x54ef=function(_0x1ec7b3,_0x14211c){_0x1ec7b3=_0x1ec7b3-0x0;var _0x315f31=_0x4ef5[_0x1ec7b3];return _0x315f31;};'use strict';var _=require(_0x54ef('0x0'));var util=require(_0x54ef('0x1'));var logger=require(_0x54ef('0x2'))(_0x54ef('0x3'));var moment=require('moment');var BPromise=require(_0x54ef('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x54ef('0x5'));var config=require(_0x54ef('0x6'));var attributes=require('./chatInternalMessage.attributes');module[_0x54ef('0x7')]=function(_0x39002b,_0x48e90e){return _0x39002b[_0x54ef('0x8')]('ChatInternalMessage',attributes,{'tableName':_0x54ef('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x54ef('0xa')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 4a7691e..9aa93dc 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 _0xc459=['message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x5b7b0b,_0x54e67e){var _0x5b5db0=function(_0xe280b3){while(--_0xe280b3){_0x5b7b0b['push'](_0x5b7b0b['shift']());}};_0x5b5db0(++_0x54e67e);}(_0xc459,0xfc));var _0x9c45=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc459[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9c45('0x0'));var util=require(_0x9c45('0x1'));var moment=require(_0x9c45('0x2'));var BPromise=require(_0x9c45('0x3'));var rs=require(_0x9c45('0x4'));var fs=require('fs');var Redis=require(_0x9c45('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9c45('0x6'));var logger=require(_0x9c45('0x7'))(_0x9c45('0x8'));var config=require(_0x9c45('0x9'));var jayson=require(_0x9c45('0xa'));var client=jayson[_0x9c45('0xb')]['http']({'port':0x232a});config[_0x9c45('0xc')]=_[_0x9c45('0xd')](config[_0x9c45('0xc')],{'host':_0x9c45('0xe'),'port':0x18eb});var socket=require(_0x9c45('0xf'))(new Redis(config['redis']));require(_0x9c45('0x10'))[_0x9c45('0x11')](socket);function respondWithRpcPromise(_0x356357,_0x517710,_0x1b770c){return new BPromise(function(_0x438c7e,_0x9d2006){return client[_0x9c45('0x12')](_0x356357,_0x1b770c)[_0x9c45('0x13')](function(_0x53cae0){logger['info'](_0x9c45('0x14'),_0x517710,'request\x20sent');logger[_0x9c45('0x15')](_0x9c45('0x16'),_0x517710,_0x9c45('0x17'),JSON[_0x9c45('0x18')](_0x53cae0));if(_0x53cae0[_0x9c45('0x19')]){if(_0x53cae0['error'][_0x9c45('0x1a')]===0x1f4){logger[_0x9c45('0x19')](_0x9c45('0x14'),_0x517710,_0x53cae0['error'][_0x9c45('0x1b')]);return _0x9d2006(_0x53cae0[_0x9c45('0x19')][_0x9c45('0x1b')]);}logger[_0x9c45('0x19')]('ChatInternalMessage,\x20%s,\x20%s',_0x517710,_0x53cae0[_0x9c45('0x19')][_0x9c45('0x1b')]);return _0x438c7e(_0x53cae0['error'][_0x9c45('0x1b')]);}else{logger[_0x9c45('0x1c')](_0x9c45('0x14'),_0x517710,_0x9c45('0x17'));_0x438c7e(_0x53cae0[_0x9c45('0x1d')][_0x9c45('0x1b')]);}})[_0x9c45('0x1e')](function(_0x488f44){logger[_0x9c45('0x19')](_0x9c45('0x14'),_0x517710,_0x488f44);_0x9d2006(_0x488f44);});});} \ No newline at end of file +var _0xfafd=['then','info','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request'];(function(_0x1ff17d,_0x375a19){var _0xf4280f=function(_0x5b0e52){while(--_0x5b0e52){_0x1ff17d['push'](_0x1ff17d['shift']());}};_0xf4280f(++_0x375a19);}(_0xfafd,0xcc));var _0xdfaf=function(_0x10a841,_0x587cf2){_0x10a841=_0x10a841-0x0;var _0xbbfbb0=_0xfafd[_0x10a841];return _0xbbfbb0;};'use strict';var _=require('lodash');var util=require(_0xdfaf('0x0'));var moment=require(_0xdfaf('0x1'));var BPromise=require(_0xdfaf('0x2'));var rs=require(_0xdfaf('0x3'));var fs=require('fs');var Redis=require(_0xdfaf('0x4'));var db=require(_0xdfaf('0x5'))['db'];var utils=require(_0xdfaf('0x6'));var logger=require(_0xdfaf('0x7'))(_0xdfaf('0x8'));var config=require(_0xdfaf('0x9'));var jayson=require(_0xdfaf('0xa'));var client=jayson[_0xdfaf('0xb')][_0xdfaf('0xc')]({'port':0x232a});config[_0xdfaf('0xd')]=_[_0xdfaf('0xe')](config['redis'],{'host':_0xdfaf('0xf'),'port':0x18eb});var socket=require(_0xdfaf('0x10'))(new Redis(config[_0xdfaf('0xd')]));require(_0xdfaf('0x11'))[_0xdfaf('0x12')](socket);function respondWithRpcPromise(_0x23712a,_0x466923,_0x26fd47){return new BPromise(function(_0x5092d6,_0x3747ce){return client[_0xdfaf('0x13')](_0x23712a,_0x26fd47)[_0xdfaf('0x14')](function(_0x42ea9f){logger[_0xdfaf('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x466923,_0xdfaf('0x16'));logger[_0xdfaf('0x17')](_0xdfaf('0x18'),_0x466923,_0xdfaf('0x16'),JSON[_0xdfaf('0x19')](_0x42ea9f));if(_0x42ea9f[_0xdfaf('0x1a')]){if(_0x42ea9f[_0xdfaf('0x1a')][_0xdfaf('0x1b')]===0x1f4){logger[_0xdfaf('0x1a')](_0xdfaf('0x1c'),_0x466923,_0x42ea9f['error'][_0xdfaf('0x1d')]);return _0x3747ce(_0x42ea9f[_0xdfaf('0x1a')][_0xdfaf('0x1d')]);}logger['error'](_0xdfaf('0x1c'),_0x466923,_0x42ea9f[_0xdfaf('0x1a')][_0xdfaf('0x1d')]);return _0x5092d6(_0x42ea9f['error']['message']);}else{logger[_0xdfaf('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x466923,'request\x20sent');_0x5092d6(_0x42ea9f[_0xdfaf('0x1e')][_0xdfaf('0x1d')]);}})[_0xdfaf('0x1f')](function(_0x120e5d){logger[_0xdfaf('0x1a')](_0xdfaf('0x1c'),_0x466923,_0x120e5d);_0x3747ce(_0x120e5d);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 8947b50..7e95ad5 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 _0x33ec=['emit','removeListener','length','chatInternalMessage:','./chatInternalMessage.events','save','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x33ec,0x1d2));var _0xc33e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x33ec[_0x3dd15e];return _0x231fd0;};'use strict';var ChatInternalMessageEvents=require(_0xc33e('0x0'));var events=[_0xc33e('0x1'),'remove',_0xc33e('0x2')];function createListener(_0x2dd651,_0x58377e){return function(_0x1fcaad){_0x58377e[_0xc33e('0x3')](_0x2dd651,_0x1fcaad);};}function removeListener(_0x5b8023,_0x6ddf1d){return function(){ChatInternalMessageEvents[_0xc33e('0x4')](_0x5b8023,_0x6ddf1d);};}exports['register']=function(_0x237510){for(var _0xcbc8ec=0x0,_0x1c88ec=events[_0xc33e('0x5')];_0xcbc8ec<_0x1c88ec;_0xcbc8ec++){var _0x21ee2d=events[_0xcbc8ec];var _0x3d7b78=createListener(_0xc33e('0x6')+_0x21ee2d,_0x237510);ChatInternalMessageEvents['on'](_0x21ee2d,_0x3d7b78);}}; \ No newline at end of file +var _0xbf03=['emit','removeListener','length','chatInternalMessage:','./chatInternalMessage.events','save','remove'];(function(_0x293274,_0x1f9041){var _0x21730e=function(_0x56fc27){while(--_0x56fc27){_0x293274['push'](_0x293274['shift']());}};_0x21730e(++_0x1f9041);}(_0xbf03,0x66));var _0x3bf0=function(_0x196822,_0x3658d1){_0x196822=_0x196822-0x0;var _0x14338a=_0xbf03[_0x196822];return _0x14338a;};'use strict';var ChatInternalMessageEvents=require(_0x3bf0('0x0'));var events=[_0x3bf0('0x1'),_0x3bf0('0x2'),'update'];function createListener(_0x3b9e90,_0x3a7d5b){return function(_0x4b47f6){_0x3a7d5b[_0x3bf0('0x3')](_0x3b9e90,_0x4b47f6);};}function removeListener(_0x43da41,_0x95db4){return function(){ChatInternalMessageEvents[_0x3bf0('0x4')](_0x43da41,_0x95db4);};}exports['register']=function(_0x5e1e24){for(var _0x23329e=0x0,_0x3fbd24=events[_0x3bf0('0x5')];_0x23329e<_0x3fbd24;_0x23329e++){var _0x1cd001=events[_0x23329e];var _0x4457b2=createListener(_0x3bf0('0x6')+_0x1cd001,_0x5e1e24);ChatInternalMessageEvents['on'](_0x1cd001,_0x4457b2);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 8c9522c..1a31e5d 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 _0x3fcd=['../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','/describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service'];(function(_0x3f8a3f,_0x37a68b){var _0x2cf290=function(_0x1fddc1){while(--_0x1fddc1){_0x3f8a3f['push'](_0x3f8a3f['shift']());}};_0x2cf290(++_0x37a68b);}(_0x3fcd,0x1c7));var _0xd3fc=function(_0x4bf3fb,_0x4bb220){_0x4bf3fb=_0x4bf3fb-0x0;var _0x37f0d6=_0x3fcd[_0x4bf3fb];return _0x37f0d6;};'use strict';var multer=require(_0xd3fc('0x0'));var util=require(_0xd3fc('0x1'));var path=require('path');var timeout=require(_0xd3fc('0x2'));var express=require('express');var router=express[_0xd3fc('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd3fc('0x4'));var interaction=require(_0xd3fc('0x5'));var config=require(_0xd3fc('0x6'));var controller=require(_0xd3fc('0x7'));router[_0xd3fc('0x8')]('/',auth[_0xd3fc('0x9')](),controller['index']);router[_0xd3fc('0x8')](_0xd3fc('0xa'),auth[_0xd3fc('0x9')](),controller['describe']);router['get']('/users',auth['isAuthenticated'](),controller['getUsers']);router[_0xd3fc('0x8')](_0xd3fc('0xb'),auth['isAuthenticated'](),controller[_0xd3fc('0xc')]);router[_0xd3fc('0xd')]('/',auth[_0xd3fc('0x9')](),controller[_0xd3fc('0xe')]);router[_0xd3fc('0xf')](_0xd3fc('0xb'),controller[_0xd3fc('0x10')]);router[_0xd3fc('0x11')](_0xd3fc('0xb'),auth['isAuthenticated'](),controller[_0xd3fc('0x12')]);module[_0xd3fc('0x13')]=router; \ No newline at end of file +var _0xf061=['get','isAuthenticated','index','/describe','describe','/:id','post','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xf061,0x1a7));var _0x1f06=function(_0x1949eb,_0x4a899d){_0x1949eb=_0x1949eb-0x0;var _0x496bdd=_0xf061[_0x1949eb];return _0x496bdd;};'use strict';var multer=require(_0x1f06('0x0'));var util=require(_0x1f06('0x1'));var path=require(_0x1f06('0x2'));var timeout=require('connect-timeout');var express=require(_0x1f06('0x3'));var router=express[_0x1f06('0x4')]();var fs_extra=require(_0x1f06('0x5'));var auth=require(_0x1f06('0x6'));var interaction=require(_0x1f06('0x7'));var config=require(_0x1f06('0x8'));var controller=require('./chatInternalMessage.controller');router[_0x1f06('0x9')]('/',auth[_0x1f06('0xa')](),controller[_0x1f06('0xb')]);router[_0x1f06('0x9')](_0x1f06('0xc'),auth['isAuthenticated'](),controller[_0x1f06('0xd')]);router[_0x1f06('0x9')]('/users',auth[_0x1f06('0xa')](),controller['getUsers']);router[_0x1f06('0x9')](_0x1f06('0xe'),auth[_0x1f06('0xa')](),controller['show']);router[_0x1f06('0xf')]('/',auth[_0x1f06('0xa')](),controller['create']);router['put']('/:id',controller['update']);router[_0x1f06('0x10')](_0x1f06('0xe'),auth[_0x1f06('0xa')](),controller[_0x1f06('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 6ae239f..09e4e54 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 _0xb7e2=['sequelize','TEXT','BOOLEAN','ENUM','out','DATE','STRING'];(function(_0xcdd3dd,_0x39f009){var _0x5d9394=function(_0x1fea22){while(--_0x1fea22){_0xcdd3dd['push'](_0xcdd3dd['shift']());}};_0x5d9394(++_0x39f009);}(_0xb7e2,0x103));var _0x2b7e=function(_0x1a2f16,_0x1dd3a4){_0x1a2f16=_0x1a2f16-0x0;var _0x23b0e7=_0xb7e2[_0x1a2f16];return _0x23b0e7;};'use strict';var Sequelize=require(_0x2b7e('0x0'));module['exports']={'body':{'type':Sequelize[_0x2b7e('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x2b7e('0x2')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x2b7e('0x3')]('in','out'),'defaultValue':_0x2b7e('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x2b7e('0x5')]},'providerName':{'type':Sequelize[_0x2b7e('0x6')]},'providerResponse':{'type':Sequelize[_0x2b7e('0x1')]}}; \ No newline at end of file +var _0x73a1=['medium','BOOLEAN','ENUM','out','DATE','TEXT'];(function(_0x261522,_0x1adc1f){var _0x98a25a=function(_0x1b0f9c){while(--_0x1b0f9c){_0x261522['push'](_0x261522['shift']());}};_0x98a25a(++_0x1adc1f);}(_0x73a1,0x161));var _0x173a=function(_0x40dd56,_0x726ca5){_0x40dd56=_0x40dd56-0x0;var _0x4f850f=_0x73a1[_0x40dd56];return _0x4f850f;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x173a('0x0')](_0x173a('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x173a('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x173a('0x3')]('in',_0x173a('0x4')),'defaultValue':_0x173a('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x173a('0x5')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x173a('0x0')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 8fb78af..fd88129 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 _0x9ead=['redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','client','http','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','save','update','destroy','stack','name','send','index','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','filter','where','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','ChatMessage','rawAttributes','fields','find','body','params','describe','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','../../config/logger','chat-interactions','reject','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','motionChannel','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x40d9c8,_0x42ddab){var _0x4b11fe=function(_0xc279ad){while(--_0xc279ad){_0x40d9c8['push'](_0x40d9c8['shift']());}};_0x4b11fe(++_0x42ddab);}(_0x9ead,0x70));var _0xd9ea=function(_0x4f6259,_0x35094b){_0x4f6259=_0x4f6259-0x0;var _0x35f1bb=_0x9ead[_0x4f6259];return _0x35f1bb;};'use strict';var emlformat=require(_0xd9ea('0x0'));var rimraf=require(_0xd9ea('0x1'));var zipdir=require(_0xd9ea('0x2'));var jsonpatch=require(_0xd9ea('0x3'));var rp=require('request-promise');var moment=require(_0xd9ea('0x4'));var BPromise=require(_0xd9ea('0x5'));var Mustache=require(_0xd9ea('0x6'));var util=require('util');var path=require(_0xd9ea('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd9ea('0x8'));var fs=require('fs');var fs_extra=require(_0xd9ea('0x9'));var _=require(_0xd9ea('0xa'));var squel=require(_0xd9ea('0xb'));var crypto=require('crypto');var jsforce=require(_0xd9ea('0xc'));var deskjs=require(_0xd9ea('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd9ea('0xe'));var qs=require(_0xd9ea('0xf'));var as=require(_0xd9ea('0x10'));var hardwareService=require(_0xd9ea('0x11'));var logger=require('../../config/logger')(_0xd9ea('0x12'));var utils=require(_0xd9ea('0x13'));var config=require(_0xd9ea('0x14'));var licenseUtil=require(_0xd9ea('0x15'));var db=require('../../mysqldb')['db'];config[_0xd9ea('0x16')]=_[_0xd9ea('0x17')](config['redis'],{'host':_0xd9ea('0x18'),'port':0x18eb});var socket=require(_0xd9ea('0x19'))(new Redis(config[_0xd9ea('0x16')]));require(_0xd9ea('0x1a'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xd9ea('0x1b')][_0xd9ea('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0xd9ea('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x46c906,_0x57b79b,_0x1c4c70,_0x53e5ab){return new BPromise(function(_0x1d417b,_0x556f6a){var _0x4ded73=_0x53e5ab||client;return _0x4ded73['request'](_0x46c906,_0x1c4c70)[_0xd9ea('0x1d')](function(_0x3daa5a){logger['info'](_0xd9ea('0x1e'),_0x57b79b,_0xd9ea('0x1f'));logger[_0xd9ea('0x20')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x57b79b,'request\x20sent',JSON['stringify'](_0x3daa5a));if(_0x3daa5a[_0xd9ea('0x21')]){if(_0x3daa5a['error'][_0xd9ea('0x22')]===0x1f4){logger['error'](_0xd9ea('0x1e'),_0x57b79b,_0x3daa5a[_0xd9ea('0x21')][_0xd9ea('0x23')]);return _0x556f6a(_0x3daa5a['error'][_0xd9ea('0x23')]);}logger['error'](_0xd9ea('0x1e'),_0x57b79b,_0x3daa5a[_0xd9ea('0x21')][_0xd9ea('0x23')]);return _0x1d417b(_0x3daa5a[_0xd9ea('0x21')][_0xd9ea('0x23')]);}else{logger[_0xd9ea('0x24')]('ChatMessage,\x20%s,\x20%s',_0x57b79b,_0xd9ea('0x1f'));_0x1d417b(_0x3daa5a[_0xd9ea('0x25')][_0xd9ea('0x23')]);}})[_0xd9ea('0x26')](function(_0x4a1e56){logger[_0xd9ea('0x21')](_0xd9ea('0x1e'),_0x57b79b,_0x4a1e56);_0x556f6a(_0x4a1e56);});});}function respondWithStatusCode(_0x5c9ab5,_0x2f6de0){_0x2f6de0=_0x2f6de0||0xcc;return function(_0x54ff36){if(_0x54ff36){return _0x5c9ab5[_0xd9ea('0x27')](_0x2f6de0);}return _0x5c9ab5['status'](_0x2f6de0)[_0xd9ea('0x28')]();};}function respondWithResult(_0x4d286f,_0x32c167){_0x32c167=_0x32c167||0xc8;return function(_0x2f43c2){if(_0x2f43c2){return _0x4d286f['status'](_0x32c167)['json'](_0x2f43c2);}};}function respondWithFilteredResult(_0x353103,_0x2e389f){return function(_0x54b2ec){if(_0x54b2ec){var _0x59659b=typeof _0x2e389f[_0xd9ea('0x29')]===_0xd9ea('0x2a')&&typeof _0x2e389f[_0xd9ea('0x2b')]===_0xd9ea('0x2a');var _0x2d8709=_0x54b2ec[_0xd9ea('0x2c')];var _0x1871e0=_0x59659b?0x0:_0x2e389f[_0xd9ea('0x29')];var _0x183df1=_0x59659b?_0x54b2ec['count']:_0x2e389f[_0xd9ea('0x29')]+_0x2e389f[_0xd9ea('0x2b')];var _0x517105;if(_0x183df1>=_0x2d8709){_0x183df1=_0x2d8709;_0x517105=0xc8;}else{_0x517105=0xce;}_0x353103[_0xd9ea('0x2d')](_0x517105);return _0x353103[_0xd9ea('0x2e')](_0xd9ea('0x2f'),_0x1871e0+'-'+_0x183df1+'/'+_0x2d8709)[_0xd9ea('0x30')](_0x54b2ec);}return null;};}function patchUpdates(_0x4ccb81){return function(_0x26bb7a){try{jsonpatch[_0xd9ea('0x31')](_0x26bb7a,_0x4ccb81,!![]);}catch(_0x2ddc8d){return BPromise['reject'](_0x2ddc8d);}return _0x26bb7a[_0xd9ea('0x32')]();};}function saveUpdates(_0x4a2a56,_0x7575ae){return function(_0x70075e){if(_0x70075e){return _0x70075e[_0xd9ea('0x33')](_0x4a2a56)['then'](function(_0x36b53a){return _0x36b53a;});}return null;};}function removeEntity(_0x229167,_0x2afa12){return function(_0x35299a){if(_0x35299a){return _0x35299a[_0xd9ea('0x34')]()[_0xd9ea('0x1d')](function(){_0x229167[_0xd9ea('0x2d')](0xcc)[_0xd9ea('0x28')]();});}};}function handleEntityNotFound(_0x4f4f68,_0x483423){return function(_0x167928){if(!_0x167928){_0x4f4f68[_0xd9ea('0x27')](0x194);}return _0x167928;};}function handleError(_0x17f508,_0x551caa){_0x551caa=_0x551caa||0x1f4;return function(_0x341783){logger['error'](_0x341783[_0xd9ea('0x35')]);if(_0x341783[_0xd9ea('0x36')]){delete _0x341783[_0xd9ea('0x36')];}_0x17f508[_0xd9ea('0x2d')](_0x551caa)[_0xd9ea('0x37')](_0x341783);};}exports[_0xd9ea('0x38')]=function(_0x54b7ab,_0x2e33e4){var _0x506169={},_0x396e79={},_0x441be1={'count':0x0,'rows':[]};var _0x4bfe0a=_['map'](db['ChatMessage']['rawAttributes'],function(_0x5eda0e){return{'name':_0x5eda0e[_0xd9ea('0x39')],'type':_0x5eda0e[_0xd9ea('0x3a')][_0xd9ea('0x3b')]};});_0x396e79[_0xd9ea('0x3c')]=_['map'](_0x4bfe0a,_0xd9ea('0x36'));_0x396e79[_0xd9ea('0x3d')]=_[_0xd9ea('0x3e')](_0x54b7ab[_0xd9ea('0x3d')]);_0x396e79[_0xd9ea('0x3f')]=_[_0xd9ea('0x40')](_0x396e79[_0xd9ea('0x3c')],_0x396e79[_0xd9ea('0x3d')]);_0x506169[_0xd9ea('0x41')]=_['intersection'](_0x396e79[_0xd9ea('0x3c')],qs['fields'](_0x54b7ab[_0xd9ea('0x3d')]['fields']));_0x506169[_0xd9ea('0x41')]=_0x506169[_0xd9ea('0x41')]['length']?_0x506169['attributes']:_0x396e79['model'];if(!_0x54b7ab[_0xd9ea('0x3d')][_0xd9ea('0x42')](_0xd9ea('0x43'))){_0x506169[_0xd9ea('0x2b')]=qs[_0xd9ea('0x2b')](_0x54b7ab['query'][_0xd9ea('0x2b')]);_0x506169[_0xd9ea('0x29')]=qs['offset'](_0x54b7ab['query'][_0xd9ea('0x29')]);}_0x506169[_0xd9ea('0x44')]=qs[_0xd9ea('0x45')](_0x54b7ab[_0xd9ea('0x3d')][_0xd9ea('0x45')]);_0x506169['where']=qs[_0xd9ea('0x3f')](_['pick'](_0x54b7ab[_0xd9ea('0x3d')],_0x396e79[_0xd9ea('0x3f')]),_0x4bfe0a);if(_0x54b7ab[_0xd9ea('0x3d')][_0xd9ea('0x46')]){_0x506169[_0xd9ea('0x47')]=_[_0xd9ea('0x48')](_0x506169[_0xd9ea('0x47')],{'$or':_[_0xd9ea('0x49')](_0x4bfe0a,function(_0x5c4a33){if(_0x5c4a33['type']!==_0xd9ea('0x4a')){var _0x11cb7a={};_0x11cb7a[_0x5c4a33['name']]={'$like':'%'+_0x54b7ab['query'][_0xd9ea('0x46')]+'%'};return _0x11cb7a;}})});}_0x506169=_[_0xd9ea('0x48')]({},_0x506169,_0x54b7ab[_0xd9ea('0x4b')]);var _0x3ea891={'where':_0x506169[_0xd9ea('0x47')]};return db['ChatMessage'][_0xd9ea('0x2c')](_0x3ea891)[_0xd9ea('0x1d')](function(_0x3e022e){_0x441be1[_0xd9ea('0x2c')]=_0x3e022e;if(_0x54b7ab[_0xd9ea('0x3d')][_0xd9ea('0x4c')]){_0x506169[_0xd9ea('0x4d')]=[{'all':!![]}];}return db['ChatMessage'][_0xd9ea('0x4e')](_0x506169);})['then'](function(_0x2faf85){_0x441be1[_0xd9ea('0x4f')]=_0x2faf85;return _0x441be1;})[_0xd9ea('0x1d')](respondWithFilteredResult(_0x2e33e4,_0x506169))['catch'](handleError(_0x2e33e4,null));};exports[_0xd9ea('0x50')]=function(_0x2eb3b7,_0x5dd1ff){var _0x2178cc={'raw':!![],'where':{'id':_0x2eb3b7['params']['id']}},_0x36a974={};_0x36a974[_0xd9ea('0x3c')]=_[_0xd9ea('0x3e')](db[_0xd9ea('0x51')][_0xd9ea('0x52')]);_0x36a974[_0xd9ea('0x3d')]=_['keys'](_0x2eb3b7[_0xd9ea('0x3d')]);_0x36a974[_0xd9ea('0x3f')]=_[_0xd9ea('0x40')](_0x36a974[_0xd9ea('0x3c')],_0x36a974[_0xd9ea('0x3d')]);_0x2178cc['attributes']=_[_0xd9ea('0x40')](_0x36a974['model'],qs[_0xd9ea('0x53')](_0x2eb3b7[_0xd9ea('0x3d')][_0xd9ea('0x53')]));_0x2178cc[_0xd9ea('0x41')]=_0x2178cc[_0xd9ea('0x41')]['length']?_0x2178cc[_0xd9ea('0x41')]:_0x36a974['model'];if(_0x2eb3b7['query'][_0xd9ea('0x4c')]){_0x2178cc[_0xd9ea('0x4d')]=[{'all':!![]}];}_0x2178cc=_[_0xd9ea('0x48')]({},_0x2178cc,_0x2eb3b7[_0xd9ea('0x4b')]);return db['ChatMessage'][_0xd9ea('0x54')](_0x2178cc)['then'](handleEntityNotFound(_0x5dd1ff,null))[_0xd9ea('0x1d')](respondWithResult(_0x5dd1ff,null))[_0xd9ea('0x26')](handleError(_0x5dd1ff,null));};exports['create']=function(_0x2aa502,_0x10117e){return db['ChatMessage']['create'](_0x2aa502['body'],{})['then'](respondWithResult(_0x10117e,0xc9))['catch'](handleError(_0x10117e,null));};exports[_0xd9ea('0x33')]=function(_0x4e0576,_0x9dbb16){if(_0x4e0576[_0xd9ea('0x55')]['id']){delete _0x4e0576[_0xd9ea('0x55')]['id'];}return db[_0xd9ea('0x51')]['find']({'where':{'id':_0x4e0576['params']['id']}})[_0xd9ea('0x1d')](handleEntityNotFound(_0x9dbb16,null))[_0xd9ea('0x1d')](saveUpdates(_0x4e0576[_0xd9ea('0x55')],null))[_0xd9ea('0x1d')](respondWithResult(_0x9dbb16,null))[_0xd9ea('0x26')](handleError(_0x9dbb16,null));};exports['destroy']=function(_0x722575,_0x175330){return db[_0xd9ea('0x51')][_0xd9ea('0x54')]({'where':{'id':_0x722575[_0xd9ea('0x56')]['id']}})['then'](handleEntityNotFound(_0x175330,null))[_0xd9ea('0x1d')](removeEntity(_0x175330,null))[_0xd9ea('0x26')](handleError(_0x175330,null));};exports[_0xd9ea('0x57')]=function(_0x38f5b7,_0x340daf){return db[_0xd9ea('0x51')][_0xd9ea('0x57')]()[_0xd9ea('0x1d')](respondWithResult(_0x340daf,null))['catch'](handleError(_0x340daf,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports[_0xd9ea('0x58')]=function(_0x2ff213,_0x4c8677,_0x5d0c07){var _0x3be13={'agent':{},'channel':_0xd9ea('0x59')};if(_0x2ff213[_0xd9ea('0x55')]['id']){delete _0x2ff213[_0xd9ea('0x55')]['id'];}_0x2ff213[_0xd9ea('0x55')][_0xd9ea('0x5a')]=!![];_0x2ff213[_0xd9ea('0x55')][_0xd9ea('0x5b')]=moment()[_0xd9ea('0x5c')](_0xd9ea('0x5d'));_0x2ff213['body'][_0xd9ea('0x5e')]=_0x2ff213['body'][_0xd9ea('0x5e')]||_0x2ff213[_0xd9ea('0x5f')]['id'];_0x3be13[_0xd9ea('0x60')]['id']=_0x2ff213[_0xd9ea('0x55')][_0xd9ea('0x5e')];return db[_0xd9ea('0x51')][_0xd9ea('0x54')]({'where':{'id':_0x2ff213['params']['id'],'UserId':null}})[_0xd9ea('0x1d')](handleEntityNotFound(_0x4c8677,null))['then'](saveUpdates(_0x2ff213['body'],null))[_0xd9ea('0x1d')](function(_0x4c65e9){if(_0x4c65e9){_0x3be13[_0xd9ea('0x23')]=_0x4c65e9[_0xd9ea('0x61')]({'plain':!![]});return db[_0xd9ea('0x62')][_0xd9ea('0x54')]({'where':{'id':_0x4c65e9[_0xd9ea('0x63')]}});}return null;})[_0xd9ea('0x1d')](handleEntityNotFound(_0x4c8677,null))[_0xd9ea('0x1d')](function(_0x6833ec){if(_0x6833ec){return _0x6833ec['update']({'UserId':_0x2ff213['body'][_0xd9ea('0x5e')],'read1stAt':_['isNil'](_0x6833ec[_0xd9ea('0x64')])?moment()[_0xd9ea('0x5c')](_0xd9ea('0x5d')):undefined});}return null;})[_0xd9ea('0x1d')](function(_0x1b7c34){if(_0x1b7c34){_0x3be13[_0xd9ea('0x65')]=_0x1b7c34[_0xd9ea('0x61')]({'plain':!![]});interaction_log[_0xd9ea('0x24')](_0xd9ea('0x66'),_0x2ff213[_0xd9ea('0x5f')]['id'],_0x2ff213['user']['name'],_0x2ff213['user'][_0xd9ea('0x67')],_0x3be13[_0xd9ea('0x65')]['id'],_0x2ff213[_0xd9ea('0x55')]?JSON[_0xd9ea('0x68')](_0x2ff213['body']):_0xd9ea('0x69'));return respondWithRpcPromise(_0xd9ea('0x6a'),_0xd9ea('0x6b'),_0x3be13);}return null;})[_0xd9ea('0x1d')](function(_0xae6049){var _0x156af5=_0xd9ea('0x6c')+_0xae6049[_0xd9ea('0x23')][_0xd9ea('0x6d')];return db[_0xd9ea('0x6e')][_0xd9ea('0x3d')](_0x156af5,{'type':db[_0xd9ea('0x6f')][_0xd9ea('0x70')][_0xd9ea('0x71')],'raw':!![]})[_0xd9ea('0x1d')](function(_0xbf9f28){return _0xbf9f28;});})['then'](function(_0x2afc74){if(_0x2afc74){_0x3be13[_0xd9ea('0x23')]['contact']=_0x2afc74[0x0];if(!_0x2ff213['body'][_0xd9ea('0x5e')])return;return db[_0xd9ea('0x72')][_0xd9ea('0x54')]({'where':{'id':_0x2ff213[_0xd9ea('0x55')][_0xd9ea('0x5e')],'role':_0xd9ea('0x60')},'attributes':['id',_0xd9ea('0x36'),_0xd9ea('0x73'),_0xd9ea('0x74'),_0xd9ea('0x75')],'raw':!![]});}return null;})[_0xd9ea('0x1d')](function(_0x316ff){if(!_0x316ff)return null;_0x3be13[_0xd9ea('0x23')][_0xd9ea('0x60')]=_0x316ff;return _0x3be13;})[_0xd9ea('0x1d')](function(_0x2f51f5){if(_0x2f51f5){if(_0x2ff213[_0xd9ea('0x55')][_0xd9ea('0x76')]){_0x3be13[_0xd9ea('0x23')][_0xd9ea('0x77')]=util[_0xd9ea('0x5c')](_0xd9ea('0x78'),_0x2ff213[_0xd9ea('0x5f')][_0xd9ea('0x36')]);_0x3be13['message'][_0xd9ea('0x79')]=_0x3be13[_0xd9ea('0x79')];_0x3be13['message']['motionChannel']=_0x3be13['channel'];_0x3be13['message'][_0xd9ea('0x7a')]='accept';return respondWithRpcPromise(_0xd9ea('0x7b'),'EventManager',{'event':_0xd9ea('0x7c'),'message':_[_0xd9ea('0x48')](_0x3be13['message'],JSON[_0xd9ea('0x7d')](_0x3be13[_0xd9ea('0x65')][_0xd9ea('0x7e')]))},client9002)[_0xd9ea('0x1d')](function(){return _0x3be13;});}return _0x3be13;}return null;})[_0xd9ea('0x1d')](respondWithResult(_0x4c8677,null))[_0xd9ea('0x26')](handleError(_0x4c8677,null));};var interaction_log=require(_0xd9ea('0x7f'))(_0xd9ea('0x80'));exports[_0xd9ea('0x81')]=function(_0x191545,_0x49b8dd,_0x4cae52){var _0x1c70fc={'agent':{},'channel':_0xd9ea('0x59')};if(_0x191545[_0xd9ea('0x55')]['id']){delete _0x191545[_0xd9ea('0x55')]['id'];}_0x191545[_0xd9ea('0x55')][_0xd9ea('0x5e')]=_0x191545['body']['UserId']||_0x191545[_0xd9ea('0x5f')]['id'];_0x1c70fc[_0xd9ea('0x60')]['id']=_0x191545['body'][_0xd9ea('0x5e')];return db['ChatMessage'][_0xd9ea('0x54')]({'where':{'id':_0x191545[_0xd9ea('0x56')]['id'],'UserId':null}})[_0xd9ea('0x1d')](handleEntityNotFound(_0x49b8dd,null))[_0xd9ea('0x1d')](function(_0x17971e){if(_0x17971e){_0x1c70fc[_0xd9ea('0x23')]=_0x17971e[_0xd9ea('0x61')]({'plain':!![]});return db['ChatInteraction'][_0xd9ea('0x54')]({'where':{'id':_0x17971e['ChatInteractionId']}});}return null;})[_0xd9ea('0x1d')](handleEntityNotFound(_0x49b8dd,null))[_0xd9ea('0x1d')](function(_0x4c4ccf){if(_0x4c4ccf){_0x1c70fc['interaction']=_0x4c4ccf['get']({'plain':!![]});interaction_log[_0xd9ea('0x24')](_0xd9ea('0x82'),_0x191545[_0xd9ea('0x5f')]['id'],_0x191545[_0xd9ea('0x5f')][_0xd9ea('0x36')],_0x191545['user'][_0xd9ea('0x67')],_0x1c70fc[_0xd9ea('0x65')]['id'],_0x191545[_0xd9ea('0x55')]?JSON[_0xd9ea('0x68')](_0x191545[_0xd9ea('0x55')]):_0xd9ea('0x69'));return respondWithRpcPromise(_0xd9ea('0x83'),'rejectMessage',_0x1c70fc);}return null;})[_0xd9ea('0x1d')](function(_0x535d7a){var _0x4208fb=_0xd9ea('0x6c')+_0x535d7a[_0xd9ea('0x23')][_0xd9ea('0x6d')];return db[_0xd9ea('0x6e')][_0xd9ea('0x3d')](_0x4208fb,{'type':db[_0xd9ea('0x6f')][_0xd9ea('0x70')][_0xd9ea('0x71')],'raw':!![]})[_0xd9ea('0x1d')](function(_0x2e28c8){return _0x2e28c8;});})[_0xd9ea('0x1d')](function(_0x53362c){if(_0x53362c){_0x1c70fc[_0xd9ea('0x23')]['contact']=_0x53362c[0x0];if(!_0x191545[_0xd9ea('0x55')]['UserId'])return;return db[_0xd9ea('0x72')][_0xd9ea('0x54')]({'where':{'id':_0x191545[_0xd9ea('0x55')]['UserId'],'role':_0xd9ea('0x60')},'attributes':['id',_0xd9ea('0x36'),_0xd9ea('0x73'),_0xd9ea('0x74'),_0xd9ea('0x75')],'raw':!![]});}return null;})[_0xd9ea('0x1d')](function(_0x4dd4f6){if(!_0x4dd4f6)return null;_0x1c70fc['message'][_0xd9ea('0x60')]=_0x4dd4f6;return _0x1c70fc;})[_0xd9ea('0x1d')](function(_0xa9fdbf){if(_0xa9fdbf){_0xa9fdbf[_0xd9ea('0x23')][_0xd9ea('0x77')]=util[_0xd9ea('0x5c')](_0xd9ea('0x78'),_0x191545['user'][_0xd9ea('0x36')]);_0xa9fdbf['message'][_0xd9ea('0x79')]=_0x1c70fc[_0xd9ea('0x79')];_0xa9fdbf[_0xd9ea('0x23')][_0xd9ea('0x84')]=_0x1c70fc['channel'];_0xa9fdbf[_0xd9ea('0x23')][_0xd9ea('0x7a')]=_0xd9ea('0x81');respondWithRpcPromise('EventManager',_0xd9ea('0x7b'),{'event':_0xd9ea('0x85'),'message':_['merge'](_0x1c70fc[_0xd9ea('0x23')],JSON[_0xd9ea('0x7d')](_0x1c70fc['interaction'][_0xd9ea('0x7e')]))},client9002);return _0x1c70fc;}return null;})[_0xd9ea('0x1d')](respondWithResult(_0x49b8dd,null))[_0xd9ea('0x26')](handleError(_0x49b8dd,null));}; \ No newline at end of file +var _0x8972=['reject','then','destroy','end','sendStatus','stack','name','index','map','ChatMessage','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','length','options','find','create','update','body','describe','chat-interactions','accept','chat','read','format','user','agent','UserId','get','ChatInteraction','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','User','internal','channel','motionChannel','event','EventManager','parse','formData','ChatInteractionId','RejectMessage','rejectMessage','Sequelize','contact','fullname','email','interface','SIP/%s','rejectmessage','eml-format','rimraf','zip-dir','request-promise','moment','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/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','http','client','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x52a80a,_0x1442d1){var _0x500083=function(_0xf0454a){while(--_0xf0454a){_0x52a80a['push'](_0x52a80a['shift']());}};_0x500083(++_0x1442d1);}(_0x8972,0xd8));var _0x2897=function(_0x2039ef,_0x51e049){_0x2039ef=_0x2039ef-0x0;var _0x1012c7=_0x8972[_0x2039ef];return _0x1012c7;};'use strict';var emlformat=require(_0x2897('0x0'));var rimraf=require(_0x2897('0x1'));var zipdir=require(_0x2897('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2897('0x3'));var moment=require(_0x2897('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2897('0x5'));var util=require(_0x2897('0x6'));var path=require(_0x2897('0x7'));var sox=require(_0x2897('0x8'));var csv=require(_0x2897('0x9'));var ejs=require(_0x2897('0xa'));var fs=require('fs');var fs_extra=require(_0x2897('0xb'));var _=require(_0x2897('0xc'));var squel=require(_0x2897('0xd'));var crypto=require(_0x2897('0xe'));var jsforce=require(_0x2897('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2897('0x10'));var Papa=require('papaparse');var Redis=require(_0x2897('0x11'));var authService=require(_0x2897('0x12'));var qs=require(_0x2897('0x13'));var as=require(_0x2897('0x14'));var hardwareService=require(_0x2897('0x15'));var logger=require(_0x2897('0x16'))(_0x2897('0x17'));var utils=require('../../config/utils');var config=require(_0x2897('0x18'));var licenseUtil=require(_0x2897('0x19'));var db=require(_0x2897('0x1a'))['db'];config[_0x2897('0x1b')]=_[_0x2897('0x1c')](config['redis'],{'host':_0x2897('0x1d'),'port':0x18eb});var socket=require(_0x2897('0x1e'))(new Redis(config[_0x2897('0x1b')]));require(_0x2897('0x1f'))[_0x2897('0x20')](socket);var jayson=require(_0x2897('0x21'));var client=jayson['client'][_0x2897('0x22')]({'port':0x232c});var client9002=jayson[_0x2897('0x23')][_0x2897('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x22e07c,_0x3eedaf,_0x3cb4e9,_0x48aeed){return new BPromise(function(_0x33d48d,_0x1437cf){var _0x30215c=_0x48aeed||client;return _0x30215c['request'](_0x22e07c,_0x3cb4e9)['then'](function(_0x1c93a8){logger[_0x2897('0x24')](_0x2897('0x25'),_0x3eedaf,_0x2897('0x26'));logger[_0x2897('0x27')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x3eedaf,'request\x20sent',JSON[_0x2897('0x28')](_0x1c93a8));if(_0x1c93a8[_0x2897('0x29')]){if(_0x1c93a8['error'][_0x2897('0x2a')]===0x1f4){logger[_0x2897('0x29')]('ChatMessage,\x20%s,\x20%s',_0x3eedaf,_0x1c93a8[_0x2897('0x29')]['message']);return _0x1437cf(_0x1c93a8[_0x2897('0x29')][_0x2897('0x2b')]);}logger[_0x2897('0x29')](_0x2897('0x25'),_0x3eedaf,_0x1c93a8['error'][_0x2897('0x2b')]);return _0x33d48d(_0x1c93a8['error'][_0x2897('0x2b')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x3eedaf,_0x2897('0x26'));_0x33d48d(_0x1c93a8[_0x2897('0x2c')][_0x2897('0x2b')]);}})[_0x2897('0x2d')](function(_0x4857ff){logger[_0x2897('0x29')]('ChatMessage,\x20%s,\x20%s',_0x3eedaf,_0x4857ff);_0x1437cf(_0x4857ff);});});}function respondWithStatusCode(_0x5e25e9,_0x4e62ac){_0x4e62ac=_0x4e62ac||0xcc;return function(_0x37a20e){if(_0x37a20e){return _0x5e25e9['sendStatus'](_0x4e62ac);}return _0x5e25e9[_0x2897('0x2e')](_0x4e62ac)['end']();};}function respondWithResult(_0x5ed7b5,_0x50d045){_0x50d045=_0x50d045||0xc8;return function(_0x4f8c12){if(_0x4f8c12){return _0x5ed7b5[_0x2897('0x2e')](_0x50d045)[_0x2897('0x2f')](_0x4f8c12);}};}function respondWithFilteredResult(_0x942599,_0x84bc74){return function(_0x3bb17d){if(_0x3bb17d){var _0x8c4c32=typeof _0x84bc74[_0x2897('0x30')]===_0x2897('0x31')&&typeof _0x84bc74[_0x2897('0x32')]===_0x2897('0x31');var _0x1680be=_0x3bb17d[_0x2897('0x33')];var _0x41c6b9=_0x8c4c32?0x0:_0x84bc74[_0x2897('0x30')];var _0x4b9e54=_0x8c4c32?_0x3bb17d['count']:_0x84bc74[_0x2897('0x30')]+_0x84bc74[_0x2897('0x32')];var _0x13d7ec;if(_0x4b9e54>=_0x1680be){_0x4b9e54=_0x1680be;_0x13d7ec=0xc8;}else{_0x13d7ec=0xce;}_0x942599[_0x2897('0x2e')](_0x13d7ec);return _0x942599[_0x2897('0x34')](_0x2897('0x35'),_0x41c6b9+'-'+_0x4b9e54+'/'+_0x1680be)[_0x2897('0x2f')](_0x3bb17d);}return null;};}function patchUpdates(_0x5d1623){return function(_0x3a0049){try{jsonpatch['apply'](_0x3a0049,_0x5d1623,!![]);}catch(_0x27f033){return BPromise[_0x2897('0x36')](_0x27f033);}return _0x3a0049['save']();};}function saveUpdates(_0x4aba66,_0x134177){return function(_0x329dd2){if(_0x329dd2){return _0x329dd2['update'](_0x4aba66)[_0x2897('0x37')](function(_0x12f023){return _0x12f023;});}return null;};}function removeEntity(_0x407523,_0x4ec2a6){return function(_0x4a7a4e){if(_0x4a7a4e){return _0x4a7a4e[_0x2897('0x38')]()[_0x2897('0x37')](function(){_0x407523['status'](0xcc)[_0x2897('0x39')]();});}};}function handleEntityNotFound(_0x42f789,_0x4408d6){return function(_0x26bff9){if(!_0x26bff9){_0x42f789[_0x2897('0x3a')](0x194);}return _0x26bff9;};}function handleError(_0x1eb0e6,_0x3d8632){_0x3d8632=_0x3d8632||0x1f4;return function(_0x13ec7c){logger[_0x2897('0x29')](_0x13ec7c[_0x2897('0x3b')]);if(_0x13ec7c[_0x2897('0x3c')]){delete _0x13ec7c[_0x2897('0x3c')];}_0x1eb0e6['status'](_0x3d8632)['send'](_0x13ec7c);};}exports[_0x2897('0x3d')]=function(_0x1957e3,_0x457009){var _0x3d1ecb={},_0x30b6ec={},_0x3eea82={'count':0x0,'rows':[]};var _0x11c9a7=_[_0x2897('0x3e')](db[_0x2897('0x3f')]['rawAttributes'],function(_0x5ded23){return{'name':_0x5ded23['fieldName'],'type':_0x5ded23[_0x2897('0x40')][_0x2897('0x41')]};});_0x30b6ec[_0x2897('0x42')]=_[_0x2897('0x3e')](_0x11c9a7,_0x2897('0x3c'));_0x30b6ec['query']=_[_0x2897('0x43')](_0x1957e3[_0x2897('0x44')]);_0x30b6ec[_0x2897('0x45')]=_[_0x2897('0x46')](_0x30b6ec[_0x2897('0x42')],_0x30b6ec[_0x2897('0x44')]);_0x3d1ecb[_0x2897('0x47')]=_['intersection'](_0x30b6ec[_0x2897('0x42')],qs[_0x2897('0x48')](_0x1957e3[_0x2897('0x44')]['fields']));_0x3d1ecb[_0x2897('0x47')]=_0x3d1ecb['attributes']['length']?_0x3d1ecb[_0x2897('0x47')]:_0x30b6ec['model'];if(!_0x1957e3[_0x2897('0x44')][_0x2897('0x49')](_0x2897('0x4a'))){_0x3d1ecb[_0x2897('0x32')]=qs['limit'](_0x1957e3[_0x2897('0x44')][_0x2897('0x32')]);_0x3d1ecb[_0x2897('0x30')]=qs[_0x2897('0x30')](_0x1957e3['query'][_0x2897('0x30')]);}_0x3d1ecb[_0x2897('0x4b')]=qs[_0x2897('0x4c')](_0x1957e3[_0x2897('0x44')][_0x2897('0x4c')]);_0x3d1ecb[_0x2897('0x4d')]=qs[_0x2897('0x45')](_[_0x2897('0x4e')](_0x1957e3[_0x2897('0x44')],_0x30b6ec[_0x2897('0x45')]),_0x11c9a7);if(_0x1957e3[_0x2897('0x44')][_0x2897('0x4f')]){_0x3d1ecb['where']=_[_0x2897('0x50')](_0x3d1ecb[_0x2897('0x4d')],{'$or':_['map'](_0x11c9a7,function(_0x241830){if(_0x241830[_0x2897('0x40')]!==_0x2897('0x51')){var _0x1d4e4f={};_0x1d4e4f[_0x241830['name']]={'$like':'%'+_0x1957e3['query'][_0x2897('0x4f')]+'%'};return _0x1d4e4f;}})});}_0x3d1ecb=_[_0x2897('0x50')]({},_0x3d1ecb,_0x1957e3['options']);var _0x51e972={'where':_0x3d1ecb[_0x2897('0x4d')]};return db[_0x2897('0x3f')]['count'](_0x51e972)[_0x2897('0x37')](function(_0x18397a){_0x3eea82['count']=_0x18397a;if(_0x1957e3[_0x2897('0x44')][_0x2897('0x52')]){_0x3d1ecb[_0x2897('0x53')]=[{'all':!![]}];}return db['ChatMessage'][_0x2897('0x54')](_0x3d1ecb);})[_0x2897('0x37')](function(_0x4ae4aa){_0x3eea82[_0x2897('0x55')]=_0x4ae4aa;return _0x3eea82;})['then'](respondWithFilteredResult(_0x457009,_0x3d1ecb))[_0x2897('0x2d')](handleError(_0x457009,null));};exports[_0x2897('0x56')]=function(_0x4dc412,_0x1820ed){var _0x4582e3={'raw':!![],'where':{'id':_0x4dc412[_0x2897('0x57')]['id']}},_0x1d6610={};_0x1d6610[_0x2897('0x42')]=_['keys'](db['ChatMessage']['rawAttributes']);_0x1d6610[_0x2897('0x44')]=_[_0x2897('0x43')](_0x4dc412['query']);_0x1d6610[_0x2897('0x45')]=_[_0x2897('0x46')](_0x1d6610['model'],_0x1d6610[_0x2897('0x44')]);_0x4582e3[_0x2897('0x47')]=_[_0x2897('0x46')](_0x1d6610['model'],qs[_0x2897('0x48')](_0x4dc412['query'][_0x2897('0x48')]));_0x4582e3[_0x2897('0x47')]=_0x4582e3['attributes'][_0x2897('0x58')]?_0x4582e3[_0x2897('0x47')]:_0x1d6610[_0x2897('0x42')];if(_0x4dc412[_0x2897('0x44')][_0x2897('0x52')]){_0x4582e3[_0x2897('0x53')]=[{'all':!![]}];}_0x4582e3=_[_0x2897('0x50')]({},_0x4582e3,_0x4dc412[_0x2897('0x59')]);return db['ChatMessage'][_0x2897('0x5a')](_0x4582e3)[_0x2897('0x37')](handleEntityNotFound(_0x1820ed,null))[_0x2897('0x37')](respondWithResult(_0x1820ed,null))[_0x2897('0x2d')](handleError(_0x1820ed,null));};exports[_0x2897('0x5b')]=function(_0x48b038,_0x24dc97){return db[_0x2897('0x3f')]['create'](_0x48b038['body'],{})[_0x2897('0x37')](respondWithResult(_0x24dc97,0xc9))['catch'](handleError(_0x24dc97,null));};exports[_0x2897('0x5c')]=function(_0x4d8af6,_0xc43214){if(_0x4d8af6[_0x2897('0x5d')]['id']){delete _0x4d8af6['body']['id'];}return db['ChatMessage'][_0x2897('0x5a')]({'where':{'id':_0x4d8af6[_0x2897('0x57')]['id']}})[_0x2897('0x37')](handleEntityNotFound(_0xc43214,null))['then'](saveUpdates(_0x4d8af6[_0x2897('0x5d')],null))['then'](respondWithResult(_0xc43214,null))[_0x2897('0x2d')](handleError(_0xc43214,null));};exports[_0x2897('0x38')]=function(_0x3eb982,_0x1ef863){return db['ChatMessage'][_0x2897('0x5a')]({'where':{'id':_0x3eb982['params']['id']}})[_0x2897('0x37')](handleEntityNotFound(_0x1ef863,null))[_0x2897('0x37')](removeEntity(_0x1ef863,null))[_0x2897('0x2d')](handleError(_0x1ef863,null));};exports[_0x2897('0x5e')]=function(_0x5cf38d,_0x32b310){return db[_0x2897('0x3f')][_0x2897('0x5e')]()[_0x2897('0x37')](respondWithResult(_0x32b310,null))[_0x2897('0x2d')](handleError(_0x32b310,null));};var interaction_log=require('../../config/logger')(_0x2897('0x5f'));exports[_0x2897('0x60')]=function(_0x310468,_0x557062,_0x323c91){var _0x2bbd48={'agent':{},'channel':_0x2897('0x61')};if(_0x310468[_0x2897('0x5d')]['id']){delete _0x310468['body']['id'];}_0x310468['body'][_0x2897('0x62')]=!![];_0x310468[_0x2897('0x5d')]['readAt']=moment()[_0x2897('0x63')]('YYYY-MM-DD\x20HH:mm:ss');_0x310468['body']['UserId']=_0x310468['body']['UserId']||_0x310468[_0x2897('0x64')]['id'];_0x2bbd48[_0x2897('0x65')]['id']=_0x310468[_0x2897('0x5d')][_0x2897('0x66')];return db[_0x2897('0x3f')][_0x2897('0x5a')]({'where':{'id':_0x310468[_0x2897('0x57')]['id'],'UserId':null}})[_0x2897('0x37')](handleEntityNotFound(_0x557062,null))['then'](saveUpdates(_0x310468['body'],null))['then'](function(_0xe4545e){if(_0xe4545e){_0x2bbd48[_0x2897('0x2b')]=_0xe4545e[_0x2897('0x67')]({'plain':!![]});return db[_0x2897('0x68')][_0x2897('0x5a')]({'where':{'id':_0xe4545e['ChatInteractionId']}});}return null;})[_0x2897('0x37')](handleEntityNotFound(_0x557062,null))[_0x2897('0x37')](function(_0x35611c){if(_0x35611c){return _0x35611c[_0x2897('0x5c')]({'UserId':_0x310468[_0x2897('0x5d')][_0x2897('0x66')],'read1stAt':_['isNil'](_0x35611c[_0x2897('0x69')])?moment()[_0x2897('0x63')](_0x2897('0x6a')):undefined});}return null;})[_0x2897('0x37')](function(_0xd3c701){if(_0xd3c701){_0x2bbd48[_0x2897('0x6b')]=_0xd3c701[_0x2897('0x67')]({'plain':!![]});interaction_log['info'](_0x2897('0x6c'),_0x310468[_0x2897('0x64')]['id'],_0x310468[_0x2897('0x64')][_0x2897('0x3c')],_0x310468['user'][_0x2897('0x6d')],_0x2bbd48[_0x2897('0x6b')]['id'],_0x310468[_0x2897('0x5d')]?JSON[_0x2897('0x28')](_0x310468[_0x2897('0x5d')]):_0x2897('0x6e'));return respondWithRpcPromise(_0x2897('0x6f'),'acceptMessage',_0x2bbd48);}return null;})[_0x2897('0x37')](function(_0x576e13){var _0x448277=_0x2897('0x70')+_0x576e13['message'][_0x2897('0x71')];return db[_0x2897('0x72')][_0x2897('0x44')](_0x448277,{'type':db['Sequelize'][_0x2897('0x73')][_0x2897('0x74')],'raw':!![]})['then'](function(_0x9ab4c6){return _0x9ab4c6;});})[_0x2897('0x37')](function(_0x31323b){if(_0x31323b){_0x2bbd48[_0x2897('0x2b')]['contact']=_0x31323b[0x0];if(!_0x310468['body'][_0x2897('0x66')])return;return db[_0x2897('0x75')]['find']({'where':{'id':_0x310468[_0x2897('0x5d')][_0x2897('0x66')],'role':_0x2897('0x65')},'attributes':['id',_0x2897('0x3c'),'fullname','email',_0x2897('0x76')],'raw':!![]});}return null;})['then'](function(_0xc8d8b8){if(!_0xc8d8b8)return null;_0x2bbd48[_0x2897('0x2b')][_0x2897('0x65')]=_0xc8d8b8;return _0x2bbd48;})['then'](function(_0x74a973){if(_0x74a973){if(_0x310468['body']['manual']){_0x2bbd48[_0x2897('0x2b')]['interface']=util['format']('SIP/%s',_0x310468[_0x2897('0x64')][_0x2897('0x3c')]);_0x2bbd48[_0x2897('0x2b')][_0x2897('0x77')]=_0x2bbd48[_0x2897('0x77')];_0x2bbd48['message'][_0x2897('0x78')]=_0x2bbd48[_0x2897('0x77')];_0x2bbd48[_0x2897('0x2b')][_0x2897('0x79')]=_0x2897('0x60');return respondWithRpcPromise(_0x2897('0x7a'),_0x2897('0x7a'),{'event':'acceptmessage','message':_[_0x2897('0x50')](_0x2bbd48['message'],JSON[_0x2897('0x7b')](_0x2bbd48[_0x2897('0x6b')][_0x2897('0x7c')]))},client9002)[_0x2897('0x37')](function(){return _0x2bbd48;});}return _0x2bbd48;}return null;})[_0x2897('0x37')](respondWithResult(_0x557062,null))[_0x2897('0x2d')](handleError(_0x557062,null));};var interaction_log=require('../../config/logger')(_0x2897('0x5f'));exports['reject']=function(_0x3c2746,_0x8e76a1,_0x192faa){var _0x4d8670={'agent':{},'channel':_0x2897('0x61')};if(_0x3c2746[_0x2897('0x5d')]['id']){delete _0x3c2746[_0x2897('0x5d')]['id'];}_0x3c2746[_0x2897('0x5d')][_0x2897('0x66')]=_0x3c2746[_0x2897('0x5d')]['UserId']||_0x3c2746['user']['id'];_0x4d8670[_0x2897('0x65')]['id']=_0x3c2746[_0x2897('0x5d')][_0x2897('0x66')];return db['ChatMessage'][_0x2897('0x5a')]({'where':{'id':_0x3c2746[_0x2897('0x57')]['id'],'UserId':null}})[_0x2897('0x37')](handleEntityNotFound(_0x8e76a1,null))[_0x2897('0x37')](function(_0x2dc7d5){if(_0x2dc7d5){_0x4d8670[_0x2897('0x2b')]=_0x2dc7d5[_0x2897('0x67')]({'plain':!![]});return db[_0x2897('0x68')][_0x2897('0x5a')]({'where':{'id':_0x2dc7d5[_0x2897('0x7d')]}});}return null;})[_0x2897('0x37')](handleEntityNotFound(_0x8e76a1,null))['then'](function(_0x5bdb7c){if(_0x5bdb7c){_0x4d8670[_0x2897('0x6b')]=_0x5bdb7c[_0x2897('0x67')]({'plain':!![]});interaction_log[_0x2897('0x24')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3c2746[_0x2897('0x64')]['id'],_0x3c2746[_0x2897('0x64')][_0x2897('0x3c')],_0x3c2746[_0x2897('0x64')]['role'],_0x4d8670[_0x2897('0x6b')]['id'],_0x3c2746[_0x2897('0x5d')]?JSON[_0x2897('0x28')](_0x3c2746['body']):_0x2897('0x6e'));return respondWithRpcPromise(_0x2897('0x7e'),_0x2897('0x7f'),_0x4d8670);}return null;})['then'](function(_0x2fdcc6){var _0x343092=_0x2897('0x70')+_0x2fdcc6[_0x2897('0x2b')]['ContactId'];return db[_0x2897('0x72')]['query'](_0x343092,{'type':db[_0x2897('0x80')]['QueryTypes']['SELECT'],'raw':!![]})[_0x2897('0x37')](function(_0x3dde02){return _0x3dde02;});})[_0x2897('0x37')](function(_0x39a2dd){if(_0x39a2dd){_0x4d8670[_0x2897('0x2b')][_0x2897('0x81')]=_0x39a2dd[0x0];if(!_0x3c2746['body']['UserId'])return;return db[_0x2897('0x75')][_0x2897('0x5a')]({'where':{'id':_0x3c2746['body']['UserId'],'role':_0x2897('0x65')},'attributes':['id',_0x2897('0x3c'),_0x2897('0x82'),_0x2897('0x83'),_0x2897('0x76')],'raw':!![]});}return null;})[_0x2897('0x37')](function(_0x2eb32b){if(!_0x2eb32b)return null;_0x4d8670[_0x2897('0x2b')]['agent']=_0x2eb32b;return _0x4d8670;})['then'](function(_0x325356){if(_0x325356){_0x325356['message'][_0x2897('0x84')]=util[_0x2897('0x63')](_0x2897('0x85'),_0x3c2746[_0x2897('0x64')][_0x2897('0x3c')]);_0x325356[_0x2897('0x2b')][_0x2897('0x77')]=_0x4d8670[_0x2897('0x77')];_0x325356[_0x2897('0x2b')]['motionChannel']=_0x4d8670[_0x2897('0x77')];_0x325356[_0x2897('0x2b')]['event']=_0x2897('0x36');respondWithRpcPromise(_0x2897('0x7a'),_0x2897('0x7a'),{'event':_0x2897('0x86'),'message':_[_0x2897('0x50')](_0x4d8670[_0x2897('0x2b')],JSON[_0x2897('0x7b')](_0x4d8670[_0x2897('0x6b')][_0x2897('0x7c')]))},client9002);return _0x4d8670;}return null;})['then'](respondWithResult(_0x8e76a1,null))[_0x2897('0x2d')](handleError(_0x8e76a1,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 6b1a099..82fc616 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 _0x322d=['setMaxListeners','remove','hasOwnProperty','hook','exports','events','ChatMessage'];(function(_0x537d13,_0x423bc0){var _0x4e6e66=function(_0xac0734){while(--_0xac0734){_0x537d13['push'](_0x537d13['shift']());}};_0x4e6e66(++_0x423bc0);}(_0x322d,0x15c));var _0xd322=function(_0xe31502,_0x24688d){_0xe31502=_0xe31502-0x0;var _0x171c63=_0x322d[_0xe31502];return _0x171c63;};'use strict';var EventEmitter=require(_0xd322('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0xd322('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xd322('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xd322('0x3')};function emitEvent(_0x1e11c3){return function(_0x1ba876,_0x29c1f0,_0x4a7eb5){ChatMessageEvents['emit'](_0x1e11c3+':'+_0x1ba876['id'],_0x1ba876);ChatMessageEvents['emit'](_0x1e11c3,_0x1ba876);_0x4a7eb5(null);};}for(var e in events){if(events[_0xd322('0x4')](e)){var event=events[e];ChatMessage[_0xd322('0x5')](e,emitEvent(event));}}module[_0xd322('0x6')]=ChatMessageEvents; \ No newline at end of file +var _0xbf87=['save','update','emit','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0xa71904,_0x21363f){var _0x507060=function(_0x4ac794){while(--_0x4ac794){_0xa71904['push'](_0xa71904['shift']());}};_0x507060(++_0x21363f);}(_0xbf87,0x11d));var _0x7bf8=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xbf87[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x7bf8('0x0'));var ChatMessage=require(_0x7bf8('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x7bf8('0x2')](0x0);var events={'afterCreate':_0x7bf8('0x3'),'afterUpdate':_0x7bf8('0x4'),'afterDestroy':'remove'};function emitEvent(_0x52b631){return function(_0x534fe5,_0x4ce692,_0x54ce0f){ChatMessageEvents['emit'](_0x52b631+':'+_0x534fe5['id'],_0x534fe5);ChatMessageEvents[_0x7bf8('0x5')](_0x52b631,_0x534fe5);_0x54ce0f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x7bf8('0x6')](e,emitEvent(event));}}module[_0x7bf8('0x7')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index d48563c..9dcb873 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 _0x92e1=['isNil','UserId','ChatInteraction','findOne','createdAt','catch','error','utf8mb4','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','toLowerCase','direction'];(function(_0x2ab365,_0xa3812e){var _0x49fef3=function(_0x29b883){while(--_0x29b883){_0x2ab365['push'](_0x2ab365['shift']());}};_0x49fef3(++_0xa3812e);}(_0x92e1,0x10d));var _0x192e=function(_0x45f111,_0x3a1a4a){_0x45f111=_0x45f111-0x0;var _0x483508=_0x92e1[_0x45f111];return _0x483508;};'use strict';var _=require(_0x192e('0x0'));var util=require(_0x192e('0x1'));var logger=require(_0x192e('0x2'))(_0x192e('0x3'));var moment=require('moment');var BPromise=require(_0x192e('0x4'));var rp=require(_0x192e('0x5'));var fs=require('fs');var path=require(_0x192e('0x6'));var rimraf=require(_0x192e('0x7'));var config=require(_0x192e('0x8'));var attributes=require(_0x192e('0x9'));module[_0x192e('0xa')]=function(_0x3bb4e7,_0x1cdd3e){return _0x3bb4e7[_0x192e('0xb')](_0x192e('0xc'),attributes,{'tableName':_0x192e('0xd'),'paranoid':![],'indexes':[{'name':_0x192e('0xe'),'fields':[_0x192e('0xf')],'type':_0x192e('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x142d4f,_0x38f469,_0x4f216f){var _0x4b01c9=_0x3bb4e7[_0x192e('0x11')];var _0x736f15=_0x142d4f[_0x192e('0x12')]({'plain':!![]});if(_0x736f15['direction'][_0x192e('0x13')]()==='in'||_0x736f15[_0x192e('0x14')][_0x192e('0x13')]()==='out'&&!_0x736f15['secret']&&!_[_0x192e('0x15')](_0x736f15[_0x192e('0x16')])){_0x4b01c9[_0x192e('0x17')][_0x192e('0x18')]({'where':{'id':_0x736f15['ChatInteractionId']}})['then'](function(_0x34a606){if(_0x34a606){_0x34a606['update']({'lastMsgAt':_0x736f15[_0x192e('0x19')],'lastMsgDirection':_0x736f15[_0x192e('0x14')]['toLowerCase']()});}})[_0x192e('0x1a')](function(_0x448aa7){console[_0x192e('0x1b')](_0x448aa7);});}_0x4f216f();}},'charset':_0x192e('0x1c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xef45=['catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','path','rimraf','../../config/environment','exports','define','chat_messages','fti_chat_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update'];(function(_0x4c9e04,_0x1f12e1){var _0x391e86=function(_0x57f7ae){while(--_0x57f7ae){_0x4c9e04['push'](_0x4c9e04['shift']());}};_0x391e86(++_0x1f12e1);}(_0xef45,0xe3));var _0x5ef4=function(_0x3ee0e1,_0x3193b1){_0x3ee0e1=_0x3ee0e1-0x0;var _0x42be7b=_0xef45[_0x3ee0e1];return _0x42be7b;};'use strict';var _=require(_0x5ef4('0x0'));var util=require(_0x5ef4('0x1'));var logger=require(_0x5ef4('0x2'))(_0x5ef4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5ef4('0x4'));var rimraf=require(_0x5ef4('0x5'));var config=require(_0x5ef4('0x6'));var attributes=require('./chatMessage.attributes');module[_0x5ef4('0x7')]=function(_0x3bd46c,_0x95d6d9){return _0x3bd46c[_0x5ef4('0x8')]('ChatMessage',attributes,{'tableName':_0x5ef4('0x9'),'paranoid':![],'indexes':[{'name':_0x5ef4('0xa'),'fields':[_0x5ef4('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x14ee1f,_0x45ada7,_0x3142d1){var _0x407eff=_0x3bd46c[_0x5ef4('0xc')];var _0x4b17f1=_0x14ee1f[_0x5ef4('0xd')]({'plain':!![]});if(_0x4b17f1[_0x5ef4('0xe')][_0x5ef4('0xf')]()==='in'||_0x4b17f1[_0x5ef4('0xe')]['toLowerCase']()===_0x5ef4('0x10')&&!_0x4b17f1[_0x5ef4('0x11')]&&!_[_0x5ef4('0x12')](_0x4b17f1[_0x5ef4('0x13')])){_0x407eff[_0x5ef4('0x14')][_0x5ef4('0x15')]({'where':{'id':_0x4b17f1[_0x5ef4('0x16')]}})[_0x5ef4('0x17')](function(_0x107dd6){if(_0x107dd6){_0x107dd6[_0x5ef4('0x18')]({'lastMsgAt':_0x4b17f1['createdAt'],'lastMsgDirection':_0x4b17f1[_0x5ef4('0xe')]['toLowerCase']()});}})[_0x5ef4('0x19')](function(_0x4b87f7){console[_0x5ef4('0x1a')](_0x4b87f7);});}_0x3142d1();}},'charset':'utf8mb4','collate':_0x5ef4('0x1b')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 9dc3256..bc3c617 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 _0xa135=['stringify','error','code','ChatMessage,\x20%s,\x20%s','message','request\x20sent','result','catch','ChatMessage','create','body','options','then','CreateChatMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','./chatMessage.socket','register','info','debug','ChatMessage,\x20%s,\x20%s,\x20%s'];(function(_0x562cc9,_0x1cb01e){var _0x5ddbf8=function(_0x48cb40){while(--_0x48cb40){_0x562cc9['push'](_0x562cc9['shift']());}};_0x5ddbf8(++_0x1cb01e);}(_0xa135,0x12e));var _0x5a13=function(_0x196752,_0x4f1429){_0x196752=_0x196752-0x0;var _0x77fda3=_0xa135[_0x196752];return _0x77fda3;};'use strict';var _=require('lodash');var util=require(_0x5a13('0x0'));var moment=require(_0x5a13('0x1'));var BPromise=require(_0x5a13('0x2'));var rs=require(_0x5a13('0x3'));var fs=require('fs');var Redis=require(_0x5a13('0x4'));var db=require(_0x5a13('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5a13('0x6'));var config=require(_0x5a13('0x7'));var jayson=require(_0x5a13('0x8'));var client=jayson[_0x5a13('0x9')]['http']({'port':0x232a});config['redis']=_[_0x5a13('0xa')](config[_0x5a13('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x5a13('0xc'))(new Redis(config[_0x5a13('0xb')]));require(_0x5a13('0xd'))[_0x5a13('0xe')](socket);function respondWithRpcPromise(_0x1cc3f9,_0x50189c,_0x596e07){return new BPromise(function(_0x2add0c,_0x378c56){return client['request'](_0x1cc3f9,_0x596e07)['then'](function(_0x37d09b){logger[_0x5a13('0xf')]('ChatMessage,\x20%s,\x20%s',_0x50189c,'request\x20sent');logger[_0x5a13('0x10')](_0x5a13('0x11'),_0x50189c,'request\x20sent',JSON[_0x5a13('0x12')](_0x37d09b));if(_0x37d09b[_0x5a13('0x13')]){if(_0x37d09b[_0x5a13('0x13')][_0x5a13('0x14')]===0x1f4){logger[_0x5a13('0x13')](_0x5a13('0x15'),_0x50189c,_0x37d09b[_0x5a13('0x13')][_0x5a13('0x16')]);return _0x378c56(_0x37d09b[_0x5a13('0x13')][_0x5a13('0x16')]);}logger[_0x5a13('0x13')](_0x5a13('0x15'),_0x50189c,_0x37d09b[_0x5a13('0x13')]['message']);return _0x2add0c(_0x37d09b[_0x5a13('0x13')][_0x5a13('0x16')]);}else{logger[_0x5a13('0xf')]('ChatMessage,\x20%s,\x20%s',_0x50189c,_0x5a13('0x17'));_0x2add0c(_0x37d09b[_0x5a13('0x18')][_0x5a13('0x16')]);}})[_0x5a13('0x19')](function(_0x598303){logger[_0x5a13('0x13')](_0x5a13('0x15'),_0x50189c,_0x598303);_0x378c56(_0x598303);});});}exports['CreateChatMessage']=function(_0x27667e){var _0x975b08=this;return new Promise(function(_0x1cc4ab,_0x7dc6b6){return db[_0x5a13('0x1a')][_0x5a13('0x1b')](_0x27667e[_0x5a13('0x1c')],{'raw':_0x27667e[_0x5a13('0x1d')]?_0x27667e['options']['raw']===undefined?!![]:![]:!![]})[_0x5a13('0x1e')](function(_0x4da9b3){logger[_0x5a13('0xf')](_0x5a13('0x1f'),_0x27667e);logger[_0x5a13('0x10')]('CreateChatMessage',_0x27667e,JSON['stringify'](_0x4da9b3));_0x1cc4ab(_0x4da9b3);})[_0x5a13('0x19')](function(_0x127d32){logger[_0x5a13('0x13')]('CreateChatMessage',_0x127d32[_0x5a13('0x16')],_0x27667e);_0x7dc6b6(_0x975b08[_0x5a13('0x13')](0x1f4,_0x127d32[_0x5a13('0x16')]));});});}; \ No newline at end of file +var _0x69d1=['request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','CreateChatMessage','ChatMessage','create','options','raw','stringify','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','register'];(function(_0x2649aa,_0x34c0c3){var _0x3cde1c=function(_0x5059d3){while(--_0x5059d3){_0x2649aa['push'](_0x2649aa['shift']());}};_0x3cde1c(++_0x34c0c3);}(_0x69d1,0xdd));var _0x169d=function(_0x13485b,_0x29fb3e){_0x13485b=_0x13485b-0x0;var _0x4ae5e8=_0x69d1[_0x13485b];return _0x4ae5e8;};'use strict';var _=require('lodash');var util=require(_0x169d('0x0'));var moment=require(_0x169d('0x1'));var BPromise=require(_0x169d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x169d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x169d('0x4'));var logger=require(_0x169d('0x5'))(_0x169d('0x6'));var config=require(_0x169d('0x7'));var jayson=require(_0x169d('0x8'));var client=jayson[_0x169d('0x9')][_0x169d('0xa')]({'port':0x232a});config['redis']=_[_0x169d('0xb')](config[_0x169d('0xc')],{'host':_0x169d('0xd'),'port':0x18eb});var socket=require(_0x169d('0xe'))(new Redis(config[_0x169d('0xc')]));require(_0x169d('0xf'))[_0x169d('0x10')](socket);function respondWithRpcPromise(_0x617d66,_0x2dc570,_0x247e69){return new BPromise(function(_0x38010a,_0x41f85d){return client[_0x169d('0x11')](_0x617d66,_0x247e69)[_0x169d('0x12')](function(_0x13676d){logger[_0x169d('0x13')](_0x169d('0x14'),_0x2dc570,_0x169d('0x15'));logger[_0x169d('0x16')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x2dc570,'request\x20sent',JSON['stringify'](_0x13676d));if(_0x13676d[_0x169d('0x17')]){if(_0x13676d[_0x169d('0x17')][_0x169d('0x18')]===0x1f4){logger[_0x169d('0x17')](_0x169d('0x14'),_0x2dc570,_0x13676d[_0x169d('0x17')][_0x169d('0x19')]);return _0x41f85d(_0x13676d[_0x169d('0x17')][_0x169d('0x19')]);}logger[_0x169d('0x17')](_0x169d('0x14'),_0x2dc570,_0x13676d[_0x169d('0x17')][_0x169d('0x19')]);return _0x38010a(_0x13676d[_0x169d('0x17')][_0x169d('0x19')]);}else{logger['info'](_0x169d('0x14'),_0x2dc570,'request\x20sent');_0x38010a(_0x13676d[_0x169d('0x1a')][_0x169d('0x19')]);}})[_0x169d('0x1b')](function(_0x957cfc){logger[_0x169d('0x17')](_0x169d('0x14'),_0x2dc570,_0x957cfc);_0x41f85d(_0x957cfc);});});}exports[_0x169d('0x1c')]=function(_0x47bf84){var _0x5626fe=this;return new Promise(function(_0x43f537,_0x484889){return db[_0x169d('0x1d')][_0x169d('0x1e')](_0x47bf84['body'],{'raw':_0x47bf84['options']?_0x47bf84[_0x169d('0x1f')][_0x169d('0x20')]===undefined?!![]:![]:!![]})[_0x169d('0x12')](function(_0x118d17){logger[_0x169d('0x13')](_0x169d('0x1c'),_0x47bf84);logger[_0x169d('0x16')](_0x169d('0x1c'),_0x47bf84,JSON[_0x169d('0x21')](_0x118d17));_0x43f537(_0x118d17);})[_0x169d('0x1b')](function(_0x491565){logger[_0x169d('0x17')](_0x169d('0x1c'),_0x491565[_0x169d('0x19')],_0x47bf84);_0x484889(_0x5626fe[_0x169d('0x17')](0x1f4,_0x491565[_0x169d('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 745f56d..fc1562e 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 _0x3248=['remove','update','removeListener','length','chatMessage:','./chatMessage.events','save'];(function(_0x2338ae,_0x1896f8){var _0x4adad9=function(_0x1f6ed1){while(--_0x1f6ed1){_0x2338ae['push'](_0x2338ae['shift']());}};_0x4adad9(++_0x1896f8);}(_0x3248,0x1b0));var _0x8324=function(_0x3ec65,_0x396ba5){_0x3ec65=_0x3ec65-0x0;var _0x4bf59e=_0x3248[_0x3ec65];return _0x4bf59e;};'use strict';var ChatMessageEvents=require(_0x8324('0x0'));var events=[_0x8324('0x1'),_0x8324('0x2'),_0x8324('0x3')];function createListener(_0x9b580,_0x23b671){return function(_0x3ab598){_0x23b671['emit'](_0x9b580,_0x3ab598);};}function removeListener(_0x4c565b,_0x2e46f3){return function(){ChatMessageEvents[_0x8324('0x4')](_0x4c565b,_0x2e46f3);};}exports['register']=function(_0x18edd2){for(var _0x283f5f=0x0,_0x446423=events[_0x8324('0x5')];_0x283f5f<_0x446423;_0x283f5f++){var _0x215c15=events[_0x283f5f];var _0x5d5f01=createListener(_0x8324('0x6')+_0x215c15,_0x18edd2);ChatMessageEvents['on'](_0x215c15,_0x5d5f01);}}; \ No newline at end of file +var _0x56e7=['emit','removeListener','length','save','remove'];(function(_0x35d4e4,_0x19ea70){var _0x520d8a=function(_0x5455ed){while(--_0x5455ed){_0x35d4e4['push'](_0x35d4e4['shift']());}};_0x520d8a(++_0x19ea70);}(_0x56e7,0x7b));var _0x756e=function(_0x28efa0,_0x481587){_0x28efa0=_0x28efa0-0x0;var _0x110f72=_0x56e7[_0x28efa0];return _0x110f72;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x756e('0x0'),_0x756e('0x1'),'update'];function createListener(_0x2eadee,_0x3efe5c){return function(_0x46a672){_0x3efe5c[_0x756e('0x2')](_0x2eadee,_0x46a672);};}function removeListener(_0x11ce5f,_0x38546a){return function(){ChatMessageEvents[_0x756e('0x3')](_0x11ce5f,_0x38546a);};}exports['register']=function(_0x3b3b8f){for(var _0x404189=0x0,_0x26519d=events[_0x756e('0x4')];_0x404189<_0x26519d;_0x404189++){var _0x5c8589=events[_0x404189];var _0x1c6a22=createListener('chatMessage:'+_0x5c8589,_0x3b3b8f);ChatMessageEvents['on'](_0x5c8589,_0x1c6a22);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index fc7b69f..4537fb9 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 _0x54fe=['/:id','show','tracked','chat','chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','index','/describe','isAuthenticated','get'];(function(_0x532112,_0x37d94b){var _0x23e5fb=function(_0x690ac8){while(--_0x690ac8){_0x532112['push'](_0x532112['shift']());}};_0x23e5fb(++_0x37d94b);}(_0x54fe,0x1d8));var _0xe54f=function(_0x5b43af,_0x24a223){_0x5b43af=_0x5b43af-0x0;var _0x23f724=_0x54fe[_0x5b43af];return _0x23f724;};'use strict';var multer=require(_0xe54f('0x0'));var util=require(_0xe54f('0x1'));var path=require('path');var timeout=require(_0xe54f('0x2'));var express=require(_0xe54f('0x3'));var router=express[_0xe54f('0x4')]();var fs_extra=require(_0xe54f('0x5'));var auth=require(_0xe54f('0x6'));var interaction=require(_0xe54f('0x7'));var config=require(_0xe54f('0x8'));var controller=require(_0xe54f('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xe54f('0xa')]);router['get'](_0xe54f('0xb'),auth[_0xe54f('0xc')](),controller['describe']);router[_0xe54f('0xd')](_0xe54f('0xe'),auth[_0xe54f('0xc')](),controller[_0xe54f('0xf')]);router['post']('/',auth[_0xe54f('0xc')](),interaction[_0xe54f('0x10')](_0xe54f('0x11'),_0xe54f('0x12')),controller[_0xe54f('0x13')]);router[_0xe54f('0x14')]('/:id',controller[_0xe54f('0x15')]);router[_0xe54f('0x14')](_0xe54f('0x16'),auth['isAuthenticated'](),controller[_0xe54f('0x17')]);router[_0xe54f('0x14')](_0xe54f('0x18'),auth['isAuthenticated'](),controller[_0xe54f('0x19')]);router[_0xe54f('0x1a')](_0xe54f('0xe'),auth[_0xe54f('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x74e7=['post','create','put','update','/:id/accept','accept','/:id/reject','reject','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x5b5868,_0x5215e2){var _0x2decaa=function(_0x1ffbcc){while(--_0x1ffbcc){_0x5b5868['push'](_0x5b5868['shift']());}};_0x2decaa(++_0x5215e2);}(_0x74e7,0x1d6));var _0x774e=function(_0x54bb8c,_0x1b3e97){_0x54bb8c=_0x54bb8c-0x0;var _0x18ccc0=_0x74e7[_0x54bb8c];return _0x18ccc0;};'use strict';var multer=require(_0x774e('0x0'));var util=require(_0x774e('0x1'));var path=require(_0x774e('0x2'));var timeout=require('connect-timeout');var express=require(_0x774e('0x3'));var router=express['Router']();var fs_extra=require(_0x774e('0x4'));var auth=require(_0x774e('0x5'));var interaction=require(_0x774e('0x6'));var config=require('../../config/environment');var controller=require(_0x774e('0x7'));router[_0x774e('0x8')]('/',auth[_0x774e('0x9')](),controller[_0x774e('0xa')]);router[_0x774e('0x8')](_0x774e('0xb'),auth[_0x774e('0x9')](),controller['describe']);router[_0x774e('0x8')](_0x774e('0xc'),auth[_0x774e('0x9')](),controller[_0x774e('0xd')]);router[_0x774e('0xe')]('/',auth['isAuthenticated'](),interaction['tracked']('chat','chatmessage:create'),controller[_0x774e('0xf')]);router[_0x774e('0x10')]('/:id',controller[_0x774e('0x11')]);router[_0x774e('0x10')](_0x774e('0x12'),auth[_0x774e('0x9')](),controller[_0x774e('0x13')]);router[_0x774e('0x10')](_0x774e('0x14'),auth[_0x774e('0x9')](),controller[_0x774e('0x15')]);router['delete'](_0x774e('0xc'),auth[_0x774e('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index ca0eca4..351f5a5 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 _0xb10b=['medium','sequelize','TEXT'];(function(_0xb0cc8c,_0x13dabd){var _0x29204c=function(_0x57b531){while(--_0x57b531){_0xb0cc8c['push'](_0xb0cc8c['shift']());}};_0x29204c(++_0x13dabd);}(_0xb10b,0x12a));var _0xbb10=function(_0x511a19,_0x417e36){_0x511a19=_0x511a19-0x0;var _0x499aa6=_0xb10b[_0x511a19];return _0x499aa6;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'body':{'type':Sequelize[_0xbb10('0x1')](_0xbb10('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xbb10('0x1')]('medium'),'allowNull':![]}}; \ No newline at end of file +var _0x5f2f=['exports','TEXT','medium','sequelize'];(function(_0x28b29a,_0x2db6d4){var _0x306ac1=function(_0x4e005d){while(--_0x4e005d){_0x28b29a['push'](_0x28b29a['shift']());}};_0x306ac1(++_0x2db6d4);}(_0x5f2f,0x73));var _0xf5f2=function(_0x21a2e1,_0x548682){_0x21a2e1=_0x21a2e1-0x0;var _0x4f15e1=_0x5f2f[_0x21a2e1];return _0x4f15e1;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'body':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index e178b12..15c380c 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(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0x7a54,0x106));var _0x47a5=function(_0x213598,_0x17a114){_0x213598=_0x213598-0x0;var _0x554ac7=_0x7a54[_0x213598];return _0x554ac7;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x3a4de8,_0x823276){var _0x4ca5a8=function(_0x883b7e){while(--_0x883b7e){_0x3a4de8['push'](_0x3a4de8['shift']());}};_0x4ca5a8(++_0x823276);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 62f9798..16da497 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.events.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe899=['hasOwnProperty','events','../../mysqldb','ChatOfflineMessage','setMaxListeners','save','update','remove','emit'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xe899,0x1cc));var _0x9e89=function(_0x296754,_0x5befe9){_0x296754=_0x296754-0x0;var _0x1d9f1d=_0xe899[_0x296754];return _0x1d9f1d;};'use strict';var EventEmitter=require(_0x9e89('0x0'));var ChatOfflineMessage=require(_0x9e89('0x1'))['db'][_0x9e89('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x9e89('0x3')](0x0);var events={'afterCreate':_0x9e89('0x4'),'afterUpdate':_0x9e89('0x5'),'afterDestroy':_0x9e89('0x6')};function emitEvent(_0xc2aa22){return function(_0x5d129f,_0x277f6a,_0x1815f3){ChatOfflineMessageEvents['emit'](_0xc2aa22+':'+_0x5d129f['id'],_0x5d129f);ChatOfflineMessageEvents[_0x9e89('0x7')](_0xc2aa22,_0x5d129f);_0x1815f3(null);};}for(var e in events){if(events[_0x9e89('0x8')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file +var _0x00f0=['hook','exports','events','../../mysqldb','ChatOfflineMessage','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x48e49c,_0x18f577){var _0x4e0448=function(_0x5661e4){while(--_0x5661e4){_0x48e49c['push'](_0x48e49c['shift']());}};_0x4e0448(++_0x18f577);}(_0x00f0,0xec));var _0x000f=function(_0x4ae70d,_0x2f2082){_0x4ae70d=_0x4ae70d-0x0;var _0x446f8b=_0x00f0[_0x4ae70d];return _0x446f8b;};'use strict';var EventEmitter=require(_0x000f('0x0'));var ChatOfflineMessage=require(_0x000f('0x1'))['db'][_0x000f('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x000f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x000f('0x4')};function emitEvent(_0x4c8ce1){return function(_0x3cd8ed,_0x53989d,_0x3a0613){ChatOfflineMessageEvents[_0x000f('0x5')](_0x4c8ce1+':'+_0x3cd8ed['id'],_0x3cd8ed);ChatOfflineMessageEvents['emit'](_0x4c8ce1,_0x3cd8ed);_0x3a0613(null);};}for(var e in events){if(events[_0x000f('0x6')](e)){var event=events[e];ChatOfflineMessage[_0x000f('0x7')](e,emitEvent(event));}}module[_0x000f('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 374c76a..6905caa 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 _0x0c6e=['chat_offline_messages','./chatOfflineMessage.attributes','exports','define'];(function(_0x4f962,_0x455cef){var _0x185244=function(_0x209950){while(--_0x209950){_0x4f962['push'](_0x4f962['shift']());}};_0x185244(++_0x455cef);}(_0x0c6e,0xb9));var _0xe0c6=function(_0x149ab0,_0x220d22){_0x149ab0=_0x149ab0-0x0;var _0xea2a6c=_0x0c6e[_0x149ab0];return _0xea2a6c;};'use strict';var attributes=require(_0xe0c6('0x0'));module[_0xe0c6('0x1')]=function(_0x3c3ef9){return _0x3c3ef9[_0xe0c6('0x2')]('ChatOfflineMessage',attributes,{'tableName':_0xe0c6('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xda44=['chat_offline_messages','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage'];(function(_0x2e9f28,_0x18a89e){var _0x248a5d=function(_0x188ba1){while(--_0x188ba1){_0x2e9f28['push'](_0x2e9f28['shift']());}};_0x248a5d(++_0x18a89e);}(_0xda44,0x13c));var _0x4da4=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xda44[_0x2ec461];return _0x28603d;};'use strict';var attributes=require(_0x4da4('0x0'));module[_0x4da4('0x1')]=function(_0x2e07ba){return _0x2e07ba[_0x4da4('0x2')](_0x4da4('0x3'),attributes,{'tableName':_0x4da4('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 0585cb1..472974e 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 _0xc80f=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x47b7a0,_0x304798){var _0x32f37d=function(_0x16ad8f){while(--_0x16ad8f){_0x47b7a0['push'](_0x47b7a0['shift']());}};_0x32f37d(++_0x304798);}(_0xc80f,0x7e));var _0xfc80=function(_0x2d47b5,_0x1cedfa){_0x2d47b5=_0x2d47b5-0x0;var _0x45f873=_0xc80f[_0x2d47b5];return _0x45f873;};'use strict';var _=require(_0xfc80('0x0'));var util=require(_0xfc80('0x1'));var moment=require(_0xfc80('0x2'));var BPromise=require(_0xfc80('0x3'));var rs=require(_0xfc80('0x4'));var fs=require('fs');var Redis=require(_0xfc80('0x5'));var db=require(_0xfc80('0x6'))['db'];var utils=require(_0xfc80('0x7'));var logger=require(_0xfc80('0x8'))(_0xfc80('0x9'));var config=require(_0xfc80('0xa'));var jayson=require(_0xfc80('0xb'));var client=jayson['client'][_0xfc80('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x58022e,_0x385ebb,_0x394e73){return new BPromise(function(_0x78a674,_0x1e1197){return client[_0xfc80('0xd')](_0x58022e,_0x394e73)['then'](function(_0x598584){logger[_0xfc80('0xe')](_0xfc80('0xf'),_0x385ebb,'request\x20sent');logger[_0xfc80('0x10')](_0xfc80('0x11'),_0x385ebb,_0xfc80('0x12'),JSON[_0xfc80('0x13')](_0x598584));if(_0x598584[_0xfc80('0x14')]){if(_0x598584[_0xfc80('0x14')][_0xfc80('0x15')]===0x1f4){logger[_0xfc80('0x14')](_0xfc80('0xf'),_0x385ebb,_0x598584[_0xfc80('0x14')][_0xfc80('0x16')]);return _0x1e1197(_0x598584[_0xfc80('0x14')][_0xfc80('0x16')]);}logger[_0xfc80('0x14')](_0xfc80('0xf'),_0x385ebb,_0x598584[_0xfc80('0x14')][_0xfc80('0x16')]);return _0x78a674(_0x598584[_0xfc80('0x14')][_0xfc80('0x16')]);}else{logger[_0xfc80('0xe')](_0xfc80('0xf'),_0x385ebb,_0xfc80('0x12'));_0x78a674(_0x598584[_0xfc80('0x17')][_0xfc80('0x16')]);}})[_0xfc80('0x18')](function(_0x2d84a6){logger[_0xfc80('0x14')](_0xfc80('0xf'),_0x385ebb,_0x2d84a6);_0x1e1197(_0x2d84a6);});});} \ No newline at end of file +var _0xb9d5=['../../config/environment','client','http','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x51fb2f,_0x37f004){var _0x40be65=function(_0x296aaa){while(--_0x296aaa){_0x51fb2f['push'](_0x51fb2f['shift']());}};_0x40be65(++_0x37f004);}(_0xb9d5,0xb6));var _0x5b9d=function(_0x4fd3d3,_0x3f34ff){_0x4fd3d3=_0x4fd3d3-0x0;var _0x36e697=_0xb9d5[_0x4fd3d3];return _0x36e697;};'use strict';var _=require('lodash');var util=require(_0x5b9d('0x0'));var moment=require(_0x5b9d('0x1'));var BPromise=require(_0x5b9d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5b9d('0x3'))['db'];var utils=require(_0x5b9d('0x4'));var logger=require(_0x5b9d('0x5'))(_0x5b9d('0x6'));var config=require(_0x5b9d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5b9d('0x8')][_0x5b9d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x9c89ce,_0x35bde3,_0x300797){return new BPromise(function(_0x546207,_0x2fb79c){return client['request'](_0x9c89ce,_0x300797)[_0x5b9d('0xa')](function(_0x35c60b){logger[_0x5b9d('0xb')](_0x5b9d('0xc'),_0x35bde3,_0x5b9d('0xd'));logger['debug'](_0x5b9d('0xe'),_0x35bde3,_0x5b9d('0xd'),JSON[_0x5b9d('0xf')](_0x35c60b));if(_0x35c60b['error']){if(_0x35c60b['error'][_0x5b9d('0x10')]===0x1f4){logger[_0x5b9d('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x35bde3,_0x35c60b[_0x5b9d('0x11')][_0x5b9d('0x12')]);return _0x2fb79c(_0x35c60b[_0x5b9d('0x11')][_0x5b9d('0x12')]);}logger[_0x5b9d('0x11')](_0x5b9d('0xc'),_0x35bde3,_0x35c60b[_0x5b9d('0x11')]['message']);return _0x546207(_0x35c60b[_0x5b9d('0x11')][_0x5b9d('0x12')]);}else{logger[_0x5b9d('0xb')](_0x5b9d('0xc'),_0x35bde3,_0x5b9d('0xd'));_0x546207(_0x35c60b[_0x5b9d('0x13')][_0x5b9d('0x12')]);}})[_0x5b9d('0x14')](function(_0xea2730){logger['error'](_0x5b9d('0xc'),_0x35bde3,_0xea2730);_0x2fb79c(_0xea2730);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 43653d5..99c2f4a 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 _0xb2e3=['./chatOfflineMessage.controller','get','isAuthenticated','/describe','describe','show','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x9ff5a,_0x5f4f61){var _0x205979=function(_0x650a85){while(--_0x650a85){_0x9ff5a['push'](_0x9ff5a['shift']());}};_0x205979(++_0x5f4f61);}(_0xb2e3,0x157));var _0x3b2e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb2e3[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3b2e('0x0'));var util=require(_0x3b2e('0x1'));var path=require(_0x3b2e('0x2'));var timeout=require(_0x3b2e('0x3'));var express=require(_0x3b2e('0x4'));var router=express[_0x3b2e('0x5')]();var fs_extra=require(_0x3b2e('0x6'));var auth=require(_0x3b2e('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x3b2e('0x8'));var controller=require(_0x3b2e('0x9'));router[_0x3b2e('0xa')]('/',auth[_0x3b2e('0xb')](),controller['index']);router[_0x3b2e('0xa')](_0x3b2e('0xc'),auth[_0x3b2e('0xb')](),controller[_0x3b2e('0xd')]);router[_0x3b2e('0xa')]('/:id',auth[_0x3b2e('0xb')](),controller[_0x3b2e('0xe')]);router['post']('/',auth[_0x3b2e('0xb')](),controller[_0x3b2e('0xf')]);router[_0x3b2e('0x10')]('/:id',auth[_0x3b2e('0xb')](),controller[_0x3b2e('0x11')]);router[_0x3b2e('0x12')](_0x3b2e('0x13'),auth[_0x3b2e('0xb')](),controller[_0x3b2e('0x14')]);module[_0x3b2e('0x15')]=router; \ No newline at end of file +var _0xd5a4=['../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','describe','/:id','show','post','put','update','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x10e8ed,_0x384a0d){var _0x4aea4a=function(_0x486ad1){while(--_0x486ad1){_0x10e8ed['push'](_0x10e8ed['shift']());}};_0x4aea4a(++_0x384a0d);}(_0xd5a4,0xb8));var _0x4d5a=function(_0x468c2a,_0x4a1ca7){_0x468c2a=_0x468c2a-0x0;var _0x2c7fee=_0xd5a4[_0x468c2a];return _0x2c7fee;};'use strict';var multer=require(_0x4d5a('0x0'));var util=require(_0x4d5a('0x1'));var path=require('path');var timeout=require(_0x4d5a('0x2'));var express=require(_0x4d5a('0x3'));var router=express[_0x4d5a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4d5a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4d5a('0x6'));var controller=require(_0x4d5a('0x7'));router[_0x4d5a('0x8')]('/',auth[_0x4d5a('0x9')](),controller[_0x4d5a('0xa')]);router['get']('/describe',auth[_0x4d5a('0x9')](),controller[_0x4d5a('0xb')]);router[_0x4d5a('0x8')](_0x4d5a('0xc'),auth['isAuthenticated'](),controller[_0x4d5a('0xd')]);router[_0x4d5a('0xe')]('/',auth[_0x4d5a('0x9')](),controller['create']);router[_0x4d5a('0xf')](_0x4d5a('0xc'),auth[_0x4d5a('0x9')](),controller[_0x4d5a('0x10')]);router['delete'](_0x4d5a('0xc'),auth[_0x4d5a('0x9')](),controller[_0x4d5a('0x11')]);module[_0x4d5a('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 8e245cf..ceec771 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 _0x7941=['sequelize','exports','STRING','ENUM','timeout','mouseOver','INTEGER'];(function(_0x10826e,_0x228c11){var _0x2d534e=function(_0xff3ebd){while(--_0xff3ebd){_0x10826e['push'](_0x10826e['shift']());}};_0x2d534e(++_0x228c11);}(_0x7941,0xcb));var _0x1794=function(_0x4ab815,_0x434bdc){_0x4ab815=_0x4ab815-0x0;var _0x50f01c=_0x7941[_0x4ab815];return _0x50f01c;};'use strict';var Sequelize=require(_0x1794('0x0'));module[_0x1794('0x1')]={'name':{'type':Sequelize[_0x1794('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x1794('0x3')]('mouseOver',_0x1794('0x4')),'defaultValue':_0x1794('0x5')},'selector':{'type':Sequelize[_0x1794('0x2')]},'timeout':{'type':Sequelize[_0x1794('0x6')]}}; \ No newline at end of file +var _0xe0ed=['sequelize','exports','STRING','ENUM','mouseOver','timeout','INTEGER'];(function(_0x49d30a,_0xa737c2){var _0x6a6025=function(_0x38ee16){while(--_0x38ee16){_0x49d30a['push'](_0x49d30a['shift']());}};_0x6a6025(++_0xa737c2);}(_0xe0ed,0x1ab));var _0xde0e=function(_0x1258f9,_0x5dc8f3){_0x1258f9=_0x1258f9-0x0;var _0x1f8a78=_0xe0ed[_0x1258f9];return _0x1f8a78;};'use strict';var Sequelize=require(_0xde0e('0x0'));module[_0xde0e('0x1')]={'name':{'type':Sequelize[_0xde0e('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xde0e('0x3')](_0xde0e('0x4'),_0xde0e('0x5')),'defaultValue':_0xde0e('0x4')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xde0e('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 1abeef1..fcd9b0a 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 _0x8098=['end','error','stack','name','send','params','keys','rawAttributes','query','intersection','model','attributes','fields','length','merge','ChatProactiveAction','catch','create','body','update','find','destroy','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','then'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x8098,0x1ba));var _0x8809=function(_0x288528,_0x3e9b45){_0x288528=_0x288528-0x0;var _0x5cdb7d=_0x8098[_0x288528];return _0x5cdb7d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8809('0x0'));var jsonpatch=require(_0x8809('0x1'));var rp=require(_0x8809('0x2'));var moment=require(_0x8809('0x3'));var BPromise=require(_0x8809('0x4'));var Mustache=require('mustache');var util=require(_0x8809('0x5'));var path=require(_0x8809('0x6'));var sox=require(_0x8809('0x7'));var csv=require(_0x8809('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8809('0x9'));var _=require(_0x8809('0xa'));var squel=require('squel');var crypto=require(_0x8809('0xb'));var jsforce=require(_0x8809('0xc'));var deskjs=require(_0x8809('0xd'));var toCsv=require(_0x8809('0x8'));var querystring=require(_0x8809('0xe'));var Papa=require(_0x8809('0xf'));var Redis=require(_0x8809('0x10'));var authService=require(_0x8809('0x11'));var qs=require(_0x8809('0x12'));var as=require(_0x8809('0x13'));var hardwareService=require(_0x8809('0x14'));var logger=require(_0x8809('0x15'))(_0x8809('0x16'));var utils=require(_0x8809('0x17'));var config=require(_0x8809('0x18'));var licenseUtil=require(_0x8809('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x388b99,_0x455989){_0x455989=_0x455989||0xcc;return function(_0x4d3b4c){if(_0x4d3b4c){return _0x388b99[_0x8809('0x1a')](_0x455989);}return _0x388b99[_0x8809('0x1b')](_0x455989)['end']();};}function respondWithResult(_0x5d87df,_0x316f2c){_0x316f2c=_0x316f2c||0xc8;return function(_0x2e4279){if(_0x2e4279){return _0x5d87df[_0x8809('0x1b')](_0x316f2c)[_0x8809('0x1c')](_0x2e4279);}};}function respondWithFilteredResult(_0x131716,_0x3d4d7e){return function(_0x105bec){if(_0x105bec){var _0x5624b5=typeof _0x3d4d7e[_0x8809('0x1d')]===_0x8809('0x1e')&&typeof _0x3d4d7e['limit']===_0x8809('0x1e');var _0x369d58=_0x105bec['count'];var _0x3b0562=_0x5624b5?0x0:_0x3d4d7e[_0x8809('0x1d')];var _0x7ec1a6=_0x5624b5?_0x105bec[_0x8809('0x1f')]:_0x3d4d7e[_0x8809('0x1d')]+_0x3d4d7e['limit'];var _0x4826e2;if(_0x7ec1a6>=_0x369d58){_0x7ec1a6=_0x369d58;_0x4826e2=0xc8;}else{_0x4826e2=0xce;}_0x131716[_0x8809('0x1b')](_0x4826e2);return _0x131716[_0x8809('0x20')](_0x8809('0x21'),_0x3b0562+'-'+_0x7ec1a6+'/'+_0x369d58)[_0x8809('0x1c')](_0x105bec);}return null;};}function patchUpdates(_0x2ff4a1){return function(_0x91de1e){try{jsonpatch[_0x8809('0x22')](_0x91de1e,_0x2ff4a1,!![]);}catch(_0x404be9){return BPromise[_0x8809('0x23')](_0x404be9);}return _0x91de1e[_0x8809('0x24')]();};}function saveUpdates(_0x16893a,_0x1440aa){return function(_0x26b43e){if(_0x26b43e){return _0x26b43e['update'](_0x16893a)['then'](function(_0x34d2df){return _0x34d2df;});}return null;};}function removeEntity(_0x5984c6,_0x521840){return function(_0x54ddd8){if(_0x54ddd8){return _0x54ddd8['destroy']()[_0x8809('0x25')](function(){_0x5984c6[_0x8809('0x1b')](0xcc)[_0x8809('0x26')]();});}};}function handleEntityNotFound(_0x2bbf26,_0x2947f7){return function(_0x3d21fd){if(!_0x3d21fd){_0x2bbf26[_0x8809('0x1a')](0x194);}return _0x3d21fd;};}function handleError(_0x14f545,_0x125776){_0x125776=_0x125776||0x1f4;return function(_0x6e5dc8){logger[_0x8809('0x27')](_0x6e5dc8[_0x8809('0x28')]);if(_0x6e5dc8['name']){delete _0x6e5dc8[_0x8809('0x29')];}_0x14f545[_0x8809('0x1b')](_0x125776)[_0x8809('0x2a')](_0x6e5dc8);};}exports['show']=function(_0x13d74b,_0x443741){var _0xbba52b={'raw':!![],'where':{'id':_0x13d74b[_0x8809('0x2b')]['id']}},_0x296187={};_0x296187['model']=_[_0x8809('0x2c')](db['ChatProactiveAction'][_0x8809('0x2d')]);_0x296187[_0x8809('0x2e')]=_['keys'](_0x13d74b[_0x8809('0x2e')]);_0x296187['filters']=_[_0x8809('0x2f')](_0x296187[_0x8809('0x30')],_0x296187[_0x8809('0x2e')]);_0xbba52b[_0x8809('0x31')]=_[_0x8809('0x2f')](_0x296187[_0x8809('0x30')],qs['fields'](_0x13d74b['query'][_0x8809('0x32')]));_0xbba52b[_0x8809('0x31')]=_0xbba52b[_0x8809('0x31')][_0x8809('0x33')]?_0xbba52b[_0x8809('0x31')]:_0x296187['model'];if(_0x13d74b[_0x8809('0x2e')]['includeAll']){_0xbba52b['include']=[{'all':!![]}];}_0xbba52b=_[_0x8809('0x34')]({},_0xbba52b,_0x13d74b['options']);return db[_0x8809('0x35')]['find'](_0xbba52b)[_0x8809('0x25')](handleEntityNotFound(_0x443741,null))[_0x8809('0x25')](respondWithResult(_0x443741,null))[_0x8809('0x36')](handleError(_0x443741,null));};exports[_0x8809('0x37')]=function(_0x27565c,_0x29c522){return db['ChatProactiveAction'][_0x8809('0x37')](_0x27565c[_0x8809('0x38')],{})['then'](respondWithResult(_0x29c522,0xc9))[_0x8809('0x36')](handleError(_0x29c522,null));};exports[_0x8809('0x39')]=function(_0x4a09a,_0x2f584f){if(_0x4a09a[_0x8809('0x38')]['id']){delete _0x4a09a[_0x8809('0x38')]['id'];}return db['ChatProactiveAction'][_0x8809('0x3a')]({'where':{'id':_0x4a09a[_0x8809('0x2b')]['id']}})[_0x8809('0x25')](handleEntityNotFound(_0x2f584f,null))[_0x8809('0x25')](saveUpdates(_0x4a09a[_0x8809('0x38')],null))[_0x8809('0x25')](respondWithResult(_0x2f584f,null))[_0x8809('0x36')](handleError(_0x2f584f,null));};exports[_0x8809('0x3b')]=function(_0x4e73ff,_0x13b530){return db[_0x8809('0x35')][_0x8809('0x3a')]({'where':{'id':_0x4e73ff[_0x8809('0x2b')]['id']}})['then'](handleEntityNotFound(_0x13b530,null))[_0x8809('0x25')](removeEntity(_0x13b530,null))[_0x8809('0x36')](handleError(_0x13b530,null));}; \ No newline at end of file +var _0x777f=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','show','model','ChatProactiveAction','query','keys','filters','intersection','attributes','fields','length','includeAll','include','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x1aa66f,_0x275c62){var _0xda3e71=function(_0x2b09d3){while(--_0x2b09d3){_0x1aa66f['push'](_0x1aa66f['shift']());}};_0xda3e71(++_0x275c62);}(_0x777f,0x9f));var _0xf777=function(_0x326e79,_0x33dc91){_0x326e79=_0x326e79-0x0;var _0x37eb89=_0x777f[_0x326e79];return _0x37eb89;};'use strict';var emlformat=require(_0xf777('0x0'));var rimraf=require(_0xf777('0x1'));var zipdir=require(_0xf777('0x2'));var jsonpatch=require(_0xf777('0x3'));var rp=require(_0xf777('0x4'));var moment=require(_0xf777('0x5'));var BPromise=require(_0xf777('0x6'));var Mustache=require(_0xf777('0x7'));var util=require('util');var path=require(_0xf777('0x8'));var sox=require(_0xf777('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf777('0xa'));var squel=require(_0xf777('0xb'));var crypto=require(_0xf777('0xc'));var jsforce=require(_0xf777('0xd'));var deskjs=require(_0xf777('0xe'));var toCsv=require(_0xf777('0xf'));var querystring=require(_0xf777('0x10'));var Papa=require(_0xf777('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf777('0x12'));var hardwareService=require(_0xf777('0x13'));var logger=require('../../config/logger')(_0xf777('0x14'));var utils=require(_0xf777('0x15'));var config=require(_0xf777('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xf777('0x17'))['db'];function respondWithStatusCode(_0x43c032,_0x5d7c2b){_0x5d7c2b=_0x5d7c2b||0xcc;return function(_0x1c8c65){if(_0x1c8c65){return _0x43c032[_0xf777('0x18')](_0x5d7c2b);}return _0x43c032[_0xf777('0x19')](_0x5d7c2b)[_0xf777('0x1a')]();};}function respondWithResult(_0x4d2173,_0x52e5a1){_0x52e5a1=_0x52e5a1||0xc8;return function(_0x8a1436){if(_0x8a1436){return _0x4d2173['status'](_0x52e5a1)[_0xf777('0x1b')](_0x8a1436);}};}function respondWithFilteredResult(_0x18aa74,_0x182c00){return function(_0x5780f5){if(_0x5780f5){var _0x3ecaa5=typeof _0x182c00[_0xf777('0x1c')]===_0xf777('0x1d')&&typeof _0x182c00[_0xf777('0x1e')]===_0xf777('0x1d');var _0xb3908a=_0x5780f5[_0xf777('0x1f')];var _0x3e0ba3=_0x3ecaa5?0x0:_0x182c00[_0xf777('0x1c')];var _0x126f72=_0x3ecaa5?_0x5780f5[_0xf777('0x1f')]:_0x182c00['offset']+_0x182c00[_0xf777('0x1e')];var _0x4e0edb;if(_0x126f72>=_0xb3908a){_0x126f72=_0xb3908a;_0x4e0edb=0xc8;}else{_0x4e0edb=0xce;}_0x18aa74[_0xf777('0x19')](_0x4e0edb);return _0x18aa74['set'](_0xf777('0x20'),_0x3e0ba3+'-'+_0x126f72+'/'+_0xb3908a)['json'](_0x5780f5);}return null;};}function patchUpdates(_0x4c6d39){return function(_0x3b4b0e){try{jsonpatch[_0xf777('0x21')](_0x3b4b0e,_0x4c6d39,!![]);}catch(_0x4e370b){return BPromise[_0xf777('0x22')](_0x4e370b);}return _0x3b4b0e[_0xf777('0x23')]();};}function saveUpdates(_0x50bddb,_0x55c56a){return function(_0x54bdf8){if(_0x54bdf8){return _0x54bdf8[_0xf777('0x24')](_0x50bddb)[_0xf777('0x25')](function(_0x527305){return _0x527305;});}return null;};}function removeEntity(_0x57d2b4,_0x43384d){return function(_0x5a0a3f){if(_0x5a0a3f){return _0x5a0a3f[_0xf777('0x26')]()['then'](function(){_0x57d2b4[_0xf777('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fd176,_0x2a1c7f){return function(_0x4d4296){if(!_0x4d4296){_0x4fd176[_0xf777('0x18')](0x194);}return _0x4d4296;};}function handleError(_0x48a961,_0x130461){_0x130461=_0x130461||0x1f4;return function(_0x1a1d74){logger[_0xf777('0x27')](_0x1a1d74[_0xf777('0x28')]);if(_0x1a1d74[_0xf777('0x29')]){delete _0x1a1d74[_0xf777('0x29')];}_0x48a961['status'](_0x130461)[_0xf777('0x2a')](_0x1a1d74);};}exports[_0xf777('0x2b')]=function(_0x13b2a8,_0x4f38f2){var _0x4f6933={'raw':!![],'where':{'id':_0x13b2a8['params']['id']}},_0x451e21={};_0x451e21[_0xf777('0x2c')]=_['keys'](db[_0xf777('0x2d')]['rawAttributes']);_0x451e21[_0xf777('0x2e')]=_[_0xf777('0x2f')](_0x13b2a8[_0xf777('0x2e')]);_0x451e21[_0xf777('0x30')]=_[_0xf777('0x31')](_0x451e21[_0xf777('0x2c')],_0x451e21['query']);_0x4f6933[_0xf777('0x32')]=_[_0xf777('0x31')](_0x451e21[_0xf777('0x2c')],qs[_0xf777('0x33')](_0x13b2a8[_0xf777('0x2e')][_0xf777('0x33')]));_0x4f6933[_0xf777('0x32')]=_0x4f6933['attributes'][_0xf777('0x34')]?_0x4f6933[_0xf777('0x32')]:_0x451e21[_0xf777('0x2c')];if(_0x13b2a8[_0xf777('0x2e')][_0xf777('0x35')]){_0x4f6933[_0xf777('0x36')]=[{'all':!![]}];}_0x4f6933=_['merge']({},_0x4f6933,_0x13b2a8[_0xf777('0x37')]);return db[_0xf777('0x2d')][_0xf777('0x38')](_0x4f6933)[_0xf777('0x25')](handleEntityNotFound(_0x4f38f2,null))[_0xf777('0x25')](respondWithResult(_0x4f38f2,null))[_0xf777('0x39')](handleError(_0x4f38f2,null));};exports[_0xf777('0x3a')]=function(_0x88cbc8,_0x49c864){return db[_0xf777('0x2d')][_0xf777('0x3a')](_0x88cbc8[_0xf777('0x3b')],{})[_0xf777('0x25')](respondWithResult(_0x49c864,0xc9))['catch'](handleError(_0x49c864,null));};exports[_0xf777('0x24')]=function(_0x5c5a43,_0x377c85){if(_0x5c5a43[_0xf777('0x3b')]['id']){delete _0x5c5a43[_0xf777('0x3b')]['id'];}return db[_0xf777('0x2d')]['find']({'where':{'id':_0x5c5a43['params']['id']}})[_0xf777('0x25')](handleEntityNotFound(_0x377c85,null))[_0xf777('0x25')](saveUpdates(_0x5c5a43[_0xf777('0x3b')],null))[_0xf777('0x25')](respondWithResult(_0x377c85,null))['catch'](handleError(_0x377c85,null));};exports[_0xf777('0x26')]=function(_0x47e847,_0x5f4757){return db[_0xf777('0x2d')][_0xf777('0x38')]({'where':{'id':_0x47e847['params']['id']}})[_0xf777('0x25')](handleEntityNotFound(_0x5f4757,null))[_0xf777('0x25')](removeEntity(_0x5f4757,null))['catch'](handleError(_0x5f4757,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 0784310..16f788b 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 _0xaf64=['util','request-promise','path','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0xaf64,0x178));var _0x4af6=function(_0x49c653,_0x390195){_0x49c653=_0x49c653-0x0;var _0x31e169=_0xaf64[_0x49c653];return _0x31e169;};'use strict';var _=require('lodash');var util=require(_0x4af6('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4af6('0x1'));var fs=require('fs');var path=require(_0x4af6('0x2'));var rimraf=require('rimraf');var config=require(_0x4af6('0x3'));var attributes=require(_0x4af6('0x4'));module[_0x4af6('0x5')]=function(_0x5b5d34,_0x4b1f90){return _0x5b5d34[_0x4af6('0x6')](_0x4af6('0x7'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd6ac=['moment','bluebird','request-promise','rimraf','define','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger'];(function(_0x4a0801,_0x55b298){var _0x47306d=function(_0x415a91){while(--_0x415a91){_0x4a0801['push'](_0x4a0801['shift']());}};_0x47306d(++_0x55b298);}(_0xd6ac,0x16f));var _0xcd6a=function(_0x555d51,_0x534544){_0x555d51=_0x555d51-0x0;var _0x2552f8=_0xd6ac[_0x555d51];return _0x2552f8;};'use strict';var _=require(_0xcd6a('0x0'));var util=require(_0xcd6a('0x1'));var logger=require(_0xcd6a('0x2'))('api');var moment=require(_0xcd6a('0x3'));var BPromise=require(_0xcd6a('0x4'));var rp=require(_0xcd6a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcd6a('0x6'));var config=require('../../config/environment');var attributes=require('./chatProactiveAction.attributes');module['exports']=function(_0x55f2db,_0x294007){return _0x55f2db[_0xcd6a('0x7')](_0xcd6a('0x8'),attributes,{'tableName':_0xcd6a('0x9'),'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 df1ae6c..45f0a7f 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 _0x2a59=['stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s'];(function(_0x3bd52b,_0xbbc735){var _0x1e5b89=function(_0x29ccc3){while(--_0x29ccc3){_0x3bd52b['push'](_0x3bd52b['shift']());}};_0x1e5b89(++_0xbbc735);}(_0x2a59,0x13a));var _0x92a5=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x2a59[_0xc4001c];return _0x49f7bc;};'use strict';var _=require(_0x92a5('0x0'));var util=require(_0x92a5('0x1'));var moment=require(_0x92a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x92a5('0x3'));var fs=require('fs');var Redis=require(_0x92a5('0x4'));var db=require(_0x92a5('0x5'))['db'];var utils=require(_0x92a5('0x6'));var logger=require(_0x92a5('0x7'))('rpc');var config=require(_0x92a5('0x8'));var jayson=require(_0x92a5('0x9'));var client=jayson['client'][_0x92a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5bc5e5,_0x12bdb5,_0x4da633){return new BPromise(function(_0x268b88,_0x34667e){return client['request'](_0x5bc5e5,_0x4da633)['then'](function(_0x3d0b30){logger[_0x92a5('0xb')](_0x92a5('0xc'),_0x12bdb5,_0x92a5('0xd'));logger[_0x92a5('0xe')](_0x92a5('0xf'),_0x12bdb5,'request\x20sent',JSON[_0x92a5('0x10')](_0x3d0b30));if(_0x3d0b30[_0x92a5('0x11')]){if(_0x3d0b30[_0x92a5('0x11')][_0x92a5('0x12')]===0x1f4){logger['error'](_0x92a5('0xc'),_0x12bdb5,_0x3d0b30['error'][_0x92a5('0x13')]);return _0x34667e(_0x3d0b30[_0x92a5('0x11')][_0x92a5('0x13')]);}logger[_0x92a5('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0x12bdb5,_0x3d0b30[_0x92a5('0x11')][_0x92a5('0x13')]);return _0x268b88(_0x3d0b30[_0x92a5('0x11')][_0x92a5('0x13')]);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x12bdb5,_0x92a5('0xd'));_0x268b88(_0x3d0b30[_0x92a5('0x14')][_0x92a5('0x13')]);}})[_0x92a5('0x15')](function(_0x36c8a5){logger[_0x92a5('0x11')](_0x92a5('0xc'),_0x12bdb5,_0x36c8a5);_0x34667e(_0x36c8a5);});});} \ No newline at end of file +var _0xf05e=['rpc','../../config/environment','jayson/promise','http','request','then','info','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatProactiveAction,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x1da6a8,_0x2d5fcf){var _0x388f23=function(_0x1eca61){while(--_0x1eca61){_0x1da6a8['push'](_0x1da6a8['shift']());}};_0x388f23(++_0x2d5fcf);}(_0xf05e,0x179));var _0xef05=function(_0x59bd3b,_0x53eff9){_0x59bd3b=_0x59bd3b-0x0;var _0x586c53=_0xf05e[_0x59bd3b];return _0x586c53;};'use strict';var _=require(_0xef05('0x0'));var util=require(_0xef05('0x1'));var moment=require(_0xef05('0x2'));var BPromise=require(_0xef05('0x3'));var rs=require(_0xef05('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xef05('0x5'))['db'];var utils=require(_0xef05('0x6'));var logger=require('../../config/logger')(_0xef05('0x7'));var config=require(_0xef05('0x8'));var jayson=require(_0xef05('0x9'));var client=jayson['client'][_0xef05('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x530739,_0x48420f,_0x2a4c96){return new BPromise(function(_0x10a0c9,_0x275493){return client[_0xef05('0xb')](_0x530739,_0x2a4c96)[_0xef05('0xc')](function(_0x62743a){logger[_0xef05('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x48420f,'request\x20sent');logger[_0xef05('0xe')](_0xef05('0xf'),_0x48420f,'request\x20sent',JSON[_0xef05('0x10')](_0x62743a));if(_0x62743a[_0xef05('0x11')]){if(_0x62743a[_0xef05('0x11')][_0xef05('0x12')]===0x1f4){logger[_0xef05('0x11')](_0xef05('0x13'),_0x48420f,_0x62743a[_0xef05('0x11')][_0xef05('0x14')]);return _0x275493(_0x62743a[_0xef05('0x11')][_0xef05('0x14')]);}logger[_0xef05('0x11')](_0xef05('0x13'),_0x48420f,_0x62743a[_0xef05('0x11')]['message']);return _0x10a0c9(_0x62743a[_0xef05('0x11')][_0xef05('0x14')]);}else{logger[_0xef05('0xd')](_0xef05('0x13'),_0x48420f,_0xef05('0x15'));_0x10a0c9(_0x62743a[_0xef05('0x16')][_0xef05('0x14')]);}})[_0xef05('0x17')](function(_0x44e9b6){logger[_0xef05('0x11')](_0xef05('0x13'),_0x48420f,_0x44e9b6);_0x275493(_0x44e9b6);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 858acee..17e15fd 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 _0x7da7=['util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/:id','show','isAuthenticated','create','put','delete','exports','multer'];(function(_0x2c32fb,_0x45b9a8){var _0x1f2836=function(_0x277504){while(--_0x277504){_0x2c32fb['push'](_0x2c32fb['shift']());}};_0x1f2836(++_0x45b9a8);}(_0x7da7,0x10d));var _0x77da=function(_0x3cd91d,_0x163516){_0x3cd91d=_0x3cd91d-0x0;var _0x3b4fab=_0x7da7[_0x3cd91d];return _0x3b4fab;};'use strict';var multer=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var path=require(_0x77da('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x77da('0x3')]();var fs_extra=require(_0x77da('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x77da('0x5'));var config=require(_0x77da('0x6'));var controller=require('./chatProactiveAction.controller');router[_0x77da('0x7')](_0x77da('0x8'),auth['isAuthenticated'](),controller[_0x77da('0x9')]);router['post']('/',auth[_0x77da('0xa')](),controller[_0x77da('0xb')]);router[_0x77da('0xc')](_0x77da('0x8'),auth[_0x77da('0xa')](),controller['update']);router[_0x77da('0xd')](_0x77da('0x8'),auth[_0x77da('0xa')](),controller['destroy']);module[_0x77da('0xe')]=router; \ No newline at end of file +var _0x326f=['../../config/environment','./chatProactiveAction.controller','get','/:id','show','post','isAuthenticated','create','update','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x18a085,_0x2b4a77){var _0x59b09e=function(_0x4dda9d){while(--_0x4dda9d){_0x18a085['push'](_0x18a085['shift']());}};_0x59b09e(++_0x2b4a77);}(_0x326f,0xd1));var _0xf326=function(_0x198171,_0x56c7ce){_0x198171=_0x198171-0x0;var _0x5c8c45=_0x326f[_0x198171];return _0x5c8c45;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')](_0xf326('0xa'),auth['isAuthenticated'](),controller[_0xf326('0xb')]);router[_0xf326('0xc')]('/',auth[_0xf326('0xd')](),controller[_0xf326('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xf326('0xf')]);router[_0xf326('0x10')](_0xf326('0xa'),auth[_0xf326('0xd')](),controller[_0xf326('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 6fa998d..f7b80e6 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 _0x3642=['ENUM','roundrobin','exports','name','STRING','INTEGER'];(function(_0x459847,_0x3d79f4){var _0x3720fe=function(_0x213c83){while(--_0x213c83){_0x459847['push'](_0x459847['shift']());}};_0x3720fe(++_0x3d79f4);}(_0x3642,0x8c));var _0x2364=function(_0x3cb6dc,_0x120dd3){_0x3cb6dc=_0x3cb6dc-0x0;var _0x47ec89=_0x3642[_0x3cb6dc];return _0x47ec89;};'use strict';var Sequelize=require('sequelize');module[_0x2364('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x2364('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2364('0x2')]},'timeout':{'type':Sequelize[_0x2364('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2364('0x4')]('rrmemory','beepall',_0x2364('0x5'))}}; \ No newline at end of file +var _0x59b5=['rrmemory','beepall','roundrobin','exports','name','STRING','INTEGER','ENUM'];(function(_0x2f0a2c,_0x56b573){var _0x146f78=function(_0x10fcc4){while(--_0x10fcc4){_0x2f0a2c['push'](_0x2f0a2c['shift']());}};_0x146f78(++_0x56b573);}(_0x59b5,0xd3));var _0x559b=function(_0x33d93d,_0xe170b3){_0x33d93d=_0x33d93d-0x0;var _0x2e4150=_0x59b5[_0x33d93d];return _0x2e4150;};'use strict';var Sequelize=require('sequelize');module[_0x559b('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x559b('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x559b('0x2')]},'timeout':{'type':Sequelize[_0x559b('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x559b('0x4')](_0x559b('0x5'),_0x559b('0x6'),_0x559b('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index db70847..3e716ae 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 _0x2651=['../../mysqldb','redis','socket.io-emitter','./chatQueue.socket','register','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','update','destroy','get','ChatQueues','UserProfileResource','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','ChatQueue','rows','show','length','include','create','body','user','role','UserProfileSection','find','userProfileId','params','describe','getMembers','findOne','UserChatQueue','ChatQueueId','findAll','User','findAndCountAll','UserId','chatPause','updatedAt','format','createdAt','getTeams','Team','hasOwnProperty','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','forEach','userChatQueue:save','removeTeams','ids','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','SELECT','every','TeamId','includes','union','compact','isEmpty','removeAgents','userChatQueue:remove','addAgents','spread','isArray','emit','getAgents','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0xbb6fd8,_0x271a1a){var _0x2f22d3=function(_0x3dba77){while(--_0x3dba77){_0xbb6fd8['push'](_0xbb6fd8['shift']());}};_0x2f22d3(++_0x271a1a);}(_0x2651,0x7e));var _0x1265=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0x2651[_0x3fba9f];return _0x192cf1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1265('0x0'));var zipdir=require(_0x1265('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1265('0x2'));var moment=require(_0x1265('0x3'));var BPromise=require(_0x1265('0x4'));var Mustache=require(_0x1265('0x5'));var util=require(_0x1265('0x6'));var path=require(_0x1265('0x7'));var sox=require(_0x1265('0x8'));var csv=require('to-csv');var ejs=require(_0x1265('0x9'));var fs=require('fs');var fs_extra=require(_0x1265('0xa'));var _=require('lodash');var squel=require(_0x1265('0xb'));var crypto=require('crypto');var jsforce=require(_0x1265('0xc'));var deskjs=require(_0x1265('0xd'));var toCsv=require(_0x1265('0xe'));var querystring=require('querystring');var Papa=require(_0x1265('0xf'));var Redis=require(_0x1265('0x10'));var authService=require(_0x1265('0x11'));var qs=require(_0x1265('0x12'));var as=require(_0x1265('0x13'));var hardwareService=require(_0x1265('0x14'));var logger=require(_0x1265('0x15'))(_0x1265('0x16'));var utils=require(_0x1265('0x17'));var config=require(_0x1265('0x18'));var licenseUtil=require(_0x1265('0x19'));var db=require(_0x1265('0x1a'))['db'];config[_0x1265('0x1b')]=_['defaults'](config[_0x1265('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x1265('0x1c'))(new Redis(config[_0x1265('0x1b')]));require(_0x1265('0x1d'))[_0x1265('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x1265('0x1f')][_0x1265('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x41dad5,_0x1b7e85,_0x3f11cb,_0x336f10){return new BPromise(function(_0x5267ca,_0x21484d){var _0x250616=_0x336f10||client;return _0x250616[_0x1265('0x21')](_0x41dad5,_0x3f11cb)[_0x1265('0x22')](function(_0xcb8aa7){logger[_0x1265('0x23')](_0x1265('0x24'),_0x1b7e85,'request\x20sent');logger[_0x1265('0x25')](_0x1265('0x26'),_0x1b7e85,_0x1265('0x27'),JSON['stringify'](_0xcb8aa7));if(_0xcb8aa7[_0x1265('0x28')]){if(_0xcb8aa7[_0x1265('0x28')][_0x1265('0x29')]===0x1f4){logger[_0x1265('0x28')]('ChatQueue,\x20%s,\x20%s',_0x1b7e85,_0xcb8aa7['error']['message']);return _0x21484d(_0xcb8aa7[_0x1265('0x28')]['message']);}logger[_0x1265('0x28')](_0x1265('0x24'),_0x1b7e85,_0xcb8aa7['error'][_0x1265('0x2a')]);return _0x5267ca(_0xcb8aa7['error'][_0x1265('0x2a')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x1b7e85,_0x1265('0x27'));_0x5267ca(_0xcb8aa7[_0x1265('0x2b')][_0x1265('0x2a')]);}})[_0x1265('0x2c')](function(_0x2293ee){logger[_0x1265('0x28')](_0x1265('0x24'),_0x1b7e85,_0x2293ee);_0x21484d(_0x2293ee);});});}function respondWithStatusCode(_0x156775,_0xd8c638){_0xd8c638=_0xd8c638||0xcc;return function(_0x48af72){if(_0x48af72){return _0x156775[_0x1265('0x2d')](_0xd8c638);}return _0x156775[_0x1265('0x2e')](_0xd8c638)['end']();};}function respondWithResult(_0x236abf,_0x126ad5){_0x126ad5=_0x126ad5||0xc8;return function(_0x3dc6e5){if(_0x3dc6e5){return _0x236abf['status'](_0x126ad5)[_0x1265('0x2f')](_0x3dc6e5);}};}function respondWithFilteredResult(_0x1e7cd4,_0x580f45){return function(_0x59c230){if(_0x59c230){var _0x4e2359=typeof _0x580f45[_0x1265('0x30')]==='undefined'&&typeof _0x580f45[_0x1265('0x31')]===_0x1265('0x32');var _0x448f60=_0x59c230[_0x1265('0x33')];var _0x1b9a79=_0x4e2359?0x0:_0x580f45[_0x1265('0x30')];var _0x299fcd=_0x4e2359?_0x59c230[_0x1265('0x33')]:_0x580f45[_0x1265('0x30')]+_0x580f45[_0x1265('0x31')];var _0xe13bc1;if(_0x299fcd>=_0x448f60){_0x299fcd=_0x448f60;_0xe13bc1=0xc8;}else{_0xe13bc1=0xce;}_0x1e7cd4[_0x1265('0x2e')](_0xe13bc1);return _0x1e7cd4['set'](_0x1265('0x34'),_0x1b9a79+'-'+_0x299fcd+'/'+_0x448f60)['json'](_0x59c230);}return null;};}function patchUpdates(_0x2a7b2a){return function(_0xddb167){try{jsonpatch[_0x1265('0x35')](_0xddb167,_0x2a7b2a,!![]);}catch(_0x4b1c33){return BPromise[_0x1265('0x36')](_0x4b1c33);}return _0xddb167['save']();};}function saveUpdates(_0x4bb5e1,_0x492b12){return function(_0x13eb99){if(_0x13eb99){return _0x13eb99[_0x1265('0x37')](_0x4bb5e1)[_0x1265('0x22')](function(_0x15ad9f){return _0x15ad9f;});}return null;};}function removeEntity(_0x487d69,_0x1abd6d){return function(_0x7c89be){if(_0x7c89be){return _0x7c89be[_0x1265('0x38')]()[_0x1265('0x22')](function(){var _0x1c27fd=_0x7c89be[_0x1265('0x39')]({'plain':!![]});var _0x2b52e4=_0x1265('0x3a');return db[_0x1265('0x3b')][_0x1265('0x38')]({'where':{'type':_0x2b52e4,'resourceId':_0x1c27fd['id']}})[_0x1265('0x22')](function(){return _0x7c89be;});})[_0x1265('0x22')](function(){_0x487d69[_0x1265('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf63498,_0x4b220b){return function(_0x59ba70){if(!_0x59ba70){_0xf63498[_0x1265('0x2d')](0x194);}return _0x59ba70;};}function handleError(_0x4d9b49,_0x1f1c9b){_0x1f1c9b=_0x1f1c9b||0x1f4;return function(_0x4d4df0){logger[_0x1265('0x28')](_0x4d4df0[_0x1265('0x3c')]);if(_0x4d4df0[_0x1265('0x3d')]){delete _0x4d4df0['name'];}_0x4d9b49[_0x1265('0x2e')](_0x1f1c9b)[_0x1265('0x3e')](_0x4d4df0);};}exports[_0x1265('0x3f')]=function(_0x1a87ce,_0x3272c0){var _0x55167d={},_0x39ddcc={},_0x316c07={'count':0x0,'rows':[]};var _0x433604=_[_0x1265('0x40')](db['ChatQueue'][_0x1265('0x41')],function(_0x18f6ff){return{'name':_0x18f6ff['fieldName'],'type':_0x18f6ff[_0x1265('0x42')][_0x1265('0x43')]};});_0x39ddcc[_0x1265('0x44')]=_[_0x1265('0x40')](_0x433604,_0x1265('0x3d'));_0x39ddcc[_0x1265('0x45')]=_[_0x1265('0x46')](_0x1a87ce['query']);_0x39ddcc[_0x1265('0x47')]=_[_0x1265('0x48')](_0x39ddcc['model'],_0x39ddcc[_0x1265('0x45')]);_0x55167d[_0x1265('0x49')]=_[_0x1265('0x48')](_0x39ddcc[_0x1265('0x44')],qs['fields'](_0x1a87ce[_0x1265('0x45')][_0x1265('0x4a')]));_0x55167d[_0x1265('0x49')]=_0x55167d[_0x1265('0x49')]['length']?_0x55167d['attributes']:_0x39ddcc[_0x1265('0x44')];if(!_0x1a87ce['query']['hasOwnProperty'](_0x1265('0x4b'))){_0x55167d[_0x1265('0x31')]=qs[_0x1265('0x31')](_0x1a87ce[_0x1265('0x45')]['limit']);_0x55167d[_0x1265('0x30')]=qs[_0x1265('0x30')](_0x1a87ce[_0x1265('0x45')]['offset']);}_0x55167d[_0x1265('0x4c')]=qs[_0x1265('0x4d')](_0x1a87ce[_0x1265('0x45')][_0x1265('0x4d')]);_0x55167d[_0x1265('0x4e')]=qs[_0x1265('0x47')](_[_0x1265('0x4f')](_0x1a87ce[_0x1265('0x45')],_0x39ddcc[_0x1265('0x47')]),_0x433604);if(_0x1a87ce[_0x1265('0x45')][_0x1265('0x50')]){_0x55167d[_0x1265('0x4e')]=_[_0x1265('0x51')](_0x55167d[_0x1265('0x4e')],{'$or':_['map'](_0x433604,function(_0x12aec0){if(_0x12aec0[_0x1265('0x42')]!==_0x1265('0x52')){var _0x204074={};_0x204074[_0x12aec0['name']]={'$like':'%'+_0x1a87ce[_0x1265('0x45')][_0x1265('0x50')]+'%'};return _0x204074;}})});}_0x55167d=_['merge']({},_0x55167d,_0x1a87ce[_0x1265('0x53')]);var _0x534f47={'where':_0x55167d[_0x1265('0x4e')]};return db['ChatQueue'][_0x1265('0x33')](_0x534f47)['then'](function(_0x11dbc7){_0x316c07['count']=_0x11dbc7;if(_0x1a87ce['query'][_0x1265('0x54')]){_0x55167d['include']=[{'all':!![]}];}return db[_0x1265('0x55')]['findAll'](_0x55167d);})[_0x1265('0x22')](function(_0x41f13b){_0x316c07[_0x1265('0x56')]=_0x41f13b;return _0x316c07;})[_0x1265('0x22')](respondWithFilteredResult(_0x3272c0,_0x55167d))[_0x1265('0x2c')](handleError(_0x3272c0,null));};exports[_0x1265('0x57')]=function(_0x492510,_0x159ef7){var _0x218840={'raw':!![],'where':{'id':_0x492510['params']['id']}},_0x1c65f6={};_0x1c65f6[_0x1265('0x44')]=_['keys'](db[_0x1265('0x55')]['rawAttributes']);_0x1c65f6['query']=_['keys'](_0x492510[_0x1265('0x45')]);_0x1c65f6['filters']=_[_0x1265('0x48')](_0x1c65f6[_0x1265('0x44')],_0x1c65f6[_0x1265('0x45')]);_0x218840['attributes']=_[_0x1265('0x48')](_0x1c65f6[_0x1265('0x44')],qs[_0x1265('0x4a')](_0x492510['query']['fields']));_0x218840['attributes']=_0x218840[_0x1265('0x49')][_0x1265('0x58')]?_0x218840[_0x1265('0x49')]:_0x1c65f6[_0x1265('0x44')];if(_0x492510['query'][_0x1265('0x54')]){_0x218840[_0x1265('0x59')]=[{'all':!![]}];}_0x218840=_[_0x1265('0x51')]({},_0x218840,_0x492510['options']);return db[_0x1265('0x55')]['find'](_0x218840)[_0x1265('0x22')](handleEntityNotFound(_0x159ef7,null))['then'](respondWithResult(_0x159ef7,null))[_0x1265('0x2c')](handleError(_0x159ef7,null));};exports[_0x1265('0x5a')]=function(_0x167f70,_0x4607b1){return db[_0x1265('0x55')][_0x1265('0x5a')](_0x167f70[_0x1265('0x5b')],{})[_0x1265('0x22')](function(_0x526b3b){var _0x61bb10=_0x167f70[_0x1265('0x5c')]['get']({'plain':!![]});if(!_0x61bb10)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x61bb10[_0x1265('0x5d')]===_0x1265('0x5c')){var _0x40b8e8=_0x526b3b[_0x1265('0x39')]({'plain':!![]});var _0x12522d=_0x1265('0x3a');return db[_0x1265('0x5e')][_0x1265('0x5f')]({'where':{'name':_0x12522d,'userProfileId':_0x61bb10[_0x1265('0x60')]},'raw':!![]})[_0x1265('0x22')](function(_0x5aff17){if(_0x5aff17&&_0x5aff17['autoAssociation']===0x0){return db[_0x1265('0x3b')][_0x1265('0x5a')]({'name':_0x40b8e8['name'],'resourceId':_0x40b8e8['id'],'type':_0x5aff17[_0x1265('0x3d')],'sectionId':_0x5aff17['id']},{})[_0x1265('0x22')](function(){return _0x526b3b;});}else{return _0x526b3b;}})[_0x1265('0x2c')](function(_0x23d518){logger[_0x1265('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x23d518);throw _0x23d518;});}return _0x526b3b;})[_0x1265('0x22')](respondWithResult(_0x4607b1,0xc9))['catch'](handleError(_0x4607b1,null));};exports[_0x1265('0x37')]=function(_0x15ee54,_0x9bfdb0){if(_0x15ee54[_0x1265('0x5b')]['id']){delete _0x15ee54[_0x1265('0x5b')]['id'];}return db[_0x1265('0x55')]['find']({'where':{'id':_0x15ee54[_0x1265('0x61')]['id']}})['then'](handleEntityNotFound(_0x9bfdb0,null))[_0x1265('0x22')](saveUpdates(_0x15ee54[_0x1265('0x5b')],null))[_0x1265('0x22')](respondWithResult(_0x9bfdb0,null))[_0x1265('0x2c')](handleError(_0x9bfdb0,null));};exports[_0x1265('0x38')]=function(_0x203388,_0x1016f2){return db[_0x1265('0x55')][_0x1265('0x5f')]({'where':{'id':_0x203388[_0x1265('0x61')]['id']}})['then'](handleEntityNotFound(_0x1016f2,null))[_0x1265('0x22')](removeEntity(_0x1016f2,null))[_0x1265('0x2c')](handleError(_0x1016f2,null));};exports[_0x1265('0x62')]=function(_0x4a6ea6,_0x526b97){return db[_0x1265('0x55')]['describe']()['then'](respondWithResult(_0x526b97,null))[_0x1265('0x2c')](handleError(_0x526b97,null));};exports[_0x1265('0x63')]=function(_0x1c4325,_0x44c3ea,_0x560e1c){var _0x16752f={'raw':!![],'where':{}},_0x1504f1={},_0x1e6e89;return db[_0x1265('0x55')][_0x1265('0x64')]({'where':{'id':_0x1c4325[_0x1265('0x61')]['id']}})['then'](handleEntityNotFound(_0x44c3ea,null))[_0x1265('0x22')](function(_0x16c9e3){if(_0x16c9e3){_0x1e6e89=_0x16c9e3[_0x1265('0x39')]({'plain':!![]});_0x1504f1[_0x1265('0x44')]=_[_0x1265('0x46')](db[_0x1265('0x65')]['rawAttributes']);_0x1504f1[_0x1265('0x45')]=_['keys'](_0x1c4325[_0x1265('0x45')]);_0x1504f1[_0x1265('0x47')]=_['intersection'](_0x1504f1[_0x1265('0x44')],_0x1504f1['query']);_0x16752f['attributes']=_[_0x1265('0x48')](_0x1504f1['model'],qs[_0x1265('0x4a')](_0x1c4325['query'][_0x1265('0x4a')]));_0x16752f[_0x1265('0x49')]=_0x16752f[_0x1265('0x49')][_0x1265('0x58')]?_0x16752f[_0x1265('0x49')]:_0x1504f1[_0x1265('0x44')];if(!_0x1c4325[_0x1265('0x45')]['hasOwnProperty'](_0x1265('0x4b'))){_0x16752f[_0x1265('0x31')]=qs[_0x1265('0x31')](_0x1c4325['query'][_0x1265('0x31')]);_0x16752f[_0x1265('0x30')]=qs['offset'](_0x1c4325[_0x1265('0x45')]['offset']);}_0x16752f[_0x1265('0x4c')]=qs['sort'](_0x1c4325[_0x1265('0x45')][_0x1265('0x4d')]);_0x16752f[_0x1265('0x4e')]=qs['filters'](_['pick'](_0x1c4325[_0x1265('0x45')],_0x1504f1[_0x1265('0x47')]));_0x16752f[_0x1265('0x4e')][_0x1265('0x66')]=_0x16c9e3['id'];if(_0x1c4325['query'][_0x1265('0x50')]){_0x16752f[_0x1265('0x4e')]=_[_0x1265('0x51')](_0x16752f[_0x1265('0x4e')],{'$or':_['map'](_0x16752f['attributes'],function(_0x3b85d9){var _0x25bf6c={};_0x25bf6c[_0x3b85d9]={'$like':'%'+_0x1c4325[_0x1265('0x45')][_0x1265('0x50')]+'%'};return _0x25bf6c;})});}_0x16752f=_[_0x1265('0x51')]({},_0x16752f,_0x1c4325[_0x1265('0x53')]);return db[_0x1265('0x65')][_0x1265('0x67')](_0x16752f);}})['then'](function(_0x32a1ee){if(_0x32a1ee){return db[_0x1265('0x68')][_0x1265('0x69')]({'where':{'id':_['map'](_0x32a1ee,_0x1265('0x6a')),'role':'agent'},'attributes':['id',_0x1265('0x3d'),_0x1265('0x6b'),_0x1265('0x6c'),'createdAt']});}})[_0x1265('0x22')](function(_0x2ac6fe){if(_0x2ac6fe){return{'count':_0x2ac6fe[_0x1265('0x33')],'rows':_[_0x1265('0x40')](_0x2ac6fe['rows'],function(_0x477a96){return{'membername':_0x477a96[_0x1265('0x3d')],'UserId':_0x477a96['id'],'queue_name':_0x1e6e89['name'],'ChatQueueId':_0x1e6e89['id'],'interface':util[_0x1265('0x6d')]('%s/%s','SIP',_0x477a96[_0x1265('0x3d')]),'penalty':0x0,'paused':_0x477a96['chatPause'],'createdAt':_0x477a96[_0x1265('0x6e')],'updatedAt':_0x477a96[_0x1265('0x6c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1265('0x22')](respondWithFilteredResult(_0x44c3ea,_0x16752f))[_0x1265('0x2c')](handleError(_0x44c3ea,null));};exports[_0x1265('0x6f')]=function(_0xe643b4,_0x4e29b5,_0x329186){var _0x1a7885={};var _0x20e3bd={};var _0x259b6b;var _0x2984a8;return db[_0x1265('0x55')][_0x1265('0x64')]({'where':{'id':_0xe643b4[_0x1265('0x61')]['id']}})[_0x1265('0x22')](handleEntityNotFound(_0x4e29b5,null))[_0x1265('0x22')](function(_0x131851){if(_0x131851){_0x259b6b=_0x131851;_0x20e3bd[_0x1265('0x44')]=_[_0x1265('0x46')](db[_0x1265('0x70')][_0x1265('0x41')]);_0x20e3bd[_0x1265('0x45')]=_[_0x1265('0x46')](_0xe643b4['query']);_0x20e3bd[_0x1265('0x47')]=_[_0x1265('0x48')](_0x20e3bd[_0x1265('0x44')],_0x20e3bd['query']);_0x1a7885['attributes']=_[_0x1265('0x48')](_0x20e3bd[_0x1265('0x44')],qs['fields'](_0xe643b4[_0x1265('0x45')][_0x1265('0x4a')]));_0x1a7885[_0x1265('0x49')]=_0x1a7885['attributes'][_0x1265('0x58')]?_0x1a7885[_0x1265('0x49')]:_0x20e3bd[_0x1265('0x44')];_0x1a7885[_0x1265('0x4c')]=qs[_0x1265('0x4d')](_0xe643b4[_0x1265('0x45')][_0x1265('0x4d')]);_0x1a7885[_0x1265('0x4e')]=qs[_0x1265('0x47')](_[_0x1265('0x4f')](_0xe643b4[_0x1265('0x45')],_0x20e3bd[_0x1265('0x47')]));if(_0xe643b4[_0x1265('0x45')][_0x1265('0x50')]){_0x1a7885['where']=_[_0x1265('0x51')](_0x1a7885[_0x1265('0x4e')],{'$or':_['map'](_0x1a7885[_0x1265('0x49')],function(_0x5e3683){var _0x17e882={};_0x17e882[_0x5e3683]={'$like':'%'+_0xe643b4['query'][_0x1265('0x50')]+'%'};return _0x17e882;})});}_0x1a7885=_[_0x1265('0x51')]({},_0x1a7885,_0xe643b4['options']);return _0x259b6b[_0x1265('0x6f')](_0x1a7885);}})[_0x1265('0x22')](function(_0x22a38f){if(_0x22a38f){_0x2984a8=_0x22a38f['length'];if(!_0xe643b4[_0x1265('0x45')][_0x1265('0x71')](_0x1265('0x4b'))){_0x1a7885[_0x1265('0x31')]=qs['limit'](_0xe643b4['query']['limit']);_0x1a7885[_0x1265('0x30')]=qs[_0x1265('0x30')](_0xe643b4[_0x1265('0x45')][_0x1265('0x30')]);}return _0x259b6b[_0x1265('0x6f')](_0x1a7885);}})[_0x1265('0x22')](function(_0x3677b1){if(_0x3677b1){return _0x3677b1?{'count':_0x2984a8,'rows':_0x3677b1}:null;}})[_0x1265('0x22')](respondWithResult(_0x4e29b5,null))[_0x1265('0x2c')](handleError(_0x4e29b5,null));};exports['addTeams']=function(_0xfb4391,_0x273b9d,_0x3acc18){var _0xc1b60d=_0xfb4391[_0x1265('0x5b')]['ids'];return db[_0x1265('0x70')][_0x1265('0x67')]({'where':{'id':_0xc1b60d},'attributes':['id'],'include':[{'model':db[_0x1265('0x68')],'as':_0x1265('0x72'),'attributes':['id',_0x1265('0x3d'),_0x1265('0x73'),_0x1265('0x74'),_0x1265('0x75')],'raw':!![]}]})[_0x1265('0x22')](function(_0x424ace){if(_0x424ace){var _0x10e5c1=_[_0x1265('0x76')](_0x424ace,function(_0x36e145){var _0x24c857=_0x36e145[_0x1265('0x39')]({'plain':!![]});return _0x24c857[_0x1265('0x72')];});return db[_0x1265('0x55')][_0x1265('0x5f')]({'where':{'id':_0xfb4391[_0x1265('0x61')]['id']}})[_0x1265('0x22')](function(_0x26a9d7){return db[_0x1265('0x77')][_0x1265('0x78')](function(_0x35c49e){return _0x26a9d7[_0x1265('0x79')](_0xc1b60d,{'transaction':_0x35c49e})[_0x1265('0x22')](function(){return BPromise[_0x1265('0x7a')](_0x10e5c1,function(_0xe993a2){return db[_0x1265('0x65')]['findOrCreate']({'where':{'UserId':_0xe993a2['id'],'ChatQueueId':_0xfb4391['params']['id']},'transaction':_0x35c49e});});})[_0x1265('0x22')](function(){_0x10e5c1[_0x1265('0x7b')](function(_0x100b74){socket['emit'](_0x1265('0x7c'),{'UserId':_0x100b74['id'],'ChatQueueId':_0x26a9d7['id']});});});});});}})[_0x1265('0x22')](respondWithStatusCode(_0x273b9d,null))['catch'](handleError(_0x273b9d,null));};exports[_0x1265('0x7d')]=function(_0x4c9ca6,_0x31af64,_0x54fd72){return db[_0x1265('0x70')]['findAll']({'where':{'id':_0x4c9ca6['query'][_0x1265('0x7e')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1265('0x72'),'attributes':['id'],'raw':!![]}]})[_0x1265('0x22')](handleEntityNotFound(_0x31af64,null))[_0x1265('0x22')](function(_0x5c833d){var _0x4bd123=_['map'](_0x5c833d,'id');var _0xed7150=[];var _0x6b2c8=[];var _0x3206c0=squel[_0x1265('0x7f')]();_0x3206c0[_0x1265('0x80')](_0x1265('0x81'))[_0x1265('0x82')]('team_has_chat_queues','tq')[_0x1265('0x83')](_0x1265('0x84'),'ut',_0x1265('0x85'))[_0x1265('0x4e')](_0x1265('0x86'),_0x4c9ca6[_0x1265('0x61')]['id']);for(var _0x197f72=0x0;_0x197f72<_0x5c833d[_0x1265('0x58')];_0x197f72+=0x1){let _0x2b494c=_0x5c833d[_0x197f72];for(var _0x3e75bf=0x0;_0x3e75bf<_0x2b494c[_0x1265('0x72')][_0x1265('0x58')];_0x3e75bf+=0x1){let _0x4f18f0=_0x2b494c['Agents'][_0x3e75bf];var _0x4c699f=_0x3206c0[_0x1265('0x87')]();_0x4c699f[_0x1265('0x4e')](_0x1265('0x88'),_0x4f18f0['id']);_0x6b2c8[_0x1265('0x89')](db[_0x1265('0x77')][_0x1265('0x45')](_0x4c699f['toString'](),{'type':db[_0x1265('0x77')]['QueryTypes'][_0x1265('0x8a')]})[_0x1265('0x22')](function(_0x48a36a){if(_0x48a36a[_0x1265('0x58')]===0x1){return _0x4f18f0['id'];}else{var _0x78e01a=_[_0x1265('0x8b')](_[_0x1265('0x40')](_0x48a36a,_0x1265('0x8c')),function(_0x3f3c7f){return _[_0x1265('0x8d')](_0x4bd123,_0x3f3c7f);});if(_0x78e01a){return _0x4f18f0['id'];}}}));}}return BPromise['all'](_0x6b2c8)[_0x1265('0x22')](function(_0x163c00){_0xed7150=_(_0xed7150)[_0x1265('0x8e')](_0x163c00)[_0x1265('0x8f')]()['value']();return db[_0x1265('0x55')][_0x1265('0x5f')]({'where':{'id':_0x4c9ca6['params']['id']}})[_0x1265('0x22')](function(_0xc985e1){return db['sequelize'][_0x1265('0x78')](function(_0x56a7a3){return _0xc985e1['removeTeams'](_0x4c9ca6[_0x1265('0x45')][_0x1265('0x7e')],{'transaction':_0x56a7a3})['then'](function(){if(!_[_0x1265('0x90')](_0xed7150)){return _0xc985e1[_0x1265('0x91')](_0xed7150,{'transaction':_0x56a7a3});}})[_0x1265('0x22')](function(){_0xed7150[_0x1265('0x7b')](function(_0x16879b){socket['emit'](_0x1265('0x92'),{'UserId':_0x16879b,'ChatQueueId':_0xc985e1['id']});});});});});});})[_0x1265('0x22')](respondWithStatusCode(_0x31af64,null))[_0x1265('0x2c')](handleError(_0x31af64,null));};exports[_0x1265('0x93')]=function(_0x5d695c,_0x9a3bce,_0x36d91a){return db[_0x1265('0x55')][_0x1265('0x5f')]({'where':{'id':_0x5d695c[_0x1265('0x61')]['id']}})[_0x1265('0x22')](handleEntityNotFound(_0x9a3bce,null))['then'](function(_0x3da090){if(_0x3da090){return _0x3da090[_0x1265('0x93')](_0x5d695c[_0x1265('0x5b')][_0x1265('0x7e')],_['omit'](_0x5d695c[_0x1265('0x5b')],[_0x1265('0x7e'),'id'])||{})[_0x1265('0x94')](function(_0x309e7f){for(var _0x4823eb=0x0;_0x4823eb<_0x5d695c['body'][_0x1265('0x7e')][_0x1265('0x58')];_0x4823eb+=0x1){socket['emit'](_0x1265('0x7c'),{'UserId':Number(_0x5d695c[_0x1265('0x5b')][_0x1265('0x7e')][_0x4823eb]),'ChatQueueId':Number(_0x5d695c[_0x1265('0x61')]['id'])});}return _0x309e7f;});}})[_0x1265('0x22')](respondWithResult(_0x9a3bce,null))[_0x1265('0x2c')](handleError(_0x9a3bce,null));};exports['removeAgents']=function(_0x2cb1ad,_0x323a13,_0x26f5f5){return db[_0x1265('0x55')][_0x1265('0x5f')]({'where':{'id':_0x2cb1ad['params']['id']}})[_0x1265('0x22')](handleEntityNotFound(_0x323a13,null))['then'](function(_0x1ee133){if(_0x1ee133){return _0x1ee133[_0x1265('0x91')](_0x2cb1ad[_0x1265('0x45')][_0x1265('0x7e')])[_0x1265('0x22')](function(){if(_[_0x1265('0x95')](_0x2cb1ad['query'][_0x1265('0x7e')])){for(var _0x53417c=0x0;_0x53417c<_0x2cb1ad['query'][_0x1265('0x7e')][_0x1265('0x58')];_0x53417c+=0x1){socket[_0x1265('0x96')]('userChatQueue:remove',{'UserId':Number(_0x2cb1ad[_0x1265('0x45')][_0x1265('0x7e')][_0x53417c]),'ChatQueueId':Number(_0x2cb1ad[_0x1265('0x61')]['id'])});}}else{socket[_0x1265('0x96')](_0x1265('0x92'),{'UserId':Number(_0x2cb1ad['query'][_0x1265('0x7e')]),'ChatQueueId':Number(_0x2cb1ad[_0x1265('0x61')]['id'])});}});}})[_0x1265('0x22')](respondWithStatusCode(_0x323a13,null))[_0x1265('0x2c')](handleError(_0x323a13,null));};exports[_0x1265('0x97')]=function(_0x27d336,_0x2aa44e,_0x136c5f){var _0x2c14e6={};var _0x5c9b91={};var _0x5e46a0;var _0x582a3a;return db[_0x1265('0x55')][_0x1265('0x64')]({'where':{'id':_0x27d336[_0x1265('0x61')]['id']}})[_0x1265('0x22')](handleEntityNotFound(_0x2aa44e,null))[_0x1265('0x22')](function(_0x5eefdc){if(_0x5eefdc){_0x5e46a0=_0x5eefdc;_0x5c9b91['model']=_[_0x1265('0x46')](db[_0x1265('0x68')][_0x1265('0x41')]);_0x5c9b91[_0x1265('0x45')]=_['keys'](_0x27d336[_0x1265('0x45')]);_0x5c9b91[_0x1265('0x47')]=_[_0x1265('0x48')](_0x5c9b91['model'],_0x5c9b91[_0x1265('0x45')]);_0x2c14e6[_0x1265('0x49')]=_[_0x1265('0x48')](_0x5c9b91[_0x1265('0x44')],qs[_0x1265('0x4a')](_0x27d336[_0x1265('0x45')][_0x1265('0x4a')]));_0x2c14e6['attributes']=_0x2c14e6[_0x1265('0x49')][_0x1265('0x58')]?_0x2c14e6[_0x1265('0x49')]:_0x5c9b91[_0x1265('0x44')];_0x2c14e6[_0x1265('0x4c')]=qs[_0x1265('0x4d')](_0x27d336['query'][_0x1265('0x4d')]);_0x2c14e6[_0x1265('0x4e')]=qs[_0x1265('0x47')](_[_0x1265('0x4f')](_0x27d336[_0x1265('0x45')],_0x5c9b91[_0x1265('0x47')]));if(_0x27d336['query'][_0x1265('0x50')]){_0x2c14e6['where']=_[_0x1265('0x51')](_0x2c14e6[_0x1265('0x4e')],{'$or':_[_0x1265('0x40')](_0x2c14e6[_0x1265('0x49')],function(_0x4eda48){var _0x4dce6e={};_0x4dce6e[_0x4eda48]={'$like':'%'+_0x27d336[_0x1265('0x45')][_0x1265('0x50')]+'%'};return _0x4dce6e;})});}_0x2c14e6=_['merge']({},_0x2c14e6,_0x27d336[_0x1265('0x53')]);return _0x5e46a0[_0x1265('0x97')](_0x2c14e6);}})[_0x1265('0x22')](function(_0x1141d2){if(_0x1141d2){_0x582a3a=_0x1141d2[_0x1265('0x58')];if(!_0x27d336[_0x1265('0x45')]['hasOwnProperty'](_0x1265('0x4b'))){_0x2c14e6[_0x1265('0x31')]=qs[_0x1265('0x31')](_0x27d336[_0x1265('0x45')][_0x1265('0x31')]);_0x2c14e6['offset']=qs[_0x1265('0x30')](_0x27d336[_0x1265('0x45')]['offset']);}return _0x5e46a0['getAgents'](_0x2c14e6);}})[_0x1265('0x22')](function(_0x453477){if(_0x453477){return _0x453477?{'count':_0x582a3a,'rows':_0x453477}:null;}})[_0x1265('0x22')](respondWithResult(_0x2aa44e,null))[_0x1265('0x2c')](handleError(_0x2aa44e,null));}; \ No newline at end of file +var _0x33f8=['mustache','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','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','./chatQueue.socket','register','jayson/promise','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','get','ChatQueues','UserProfileResource','stack','name','send','index','map','ChatQueue','type','key','model','keys','filters','intersection','query','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','rows','show','params','rawAttributes','fields','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserChatQueue','nolimit','options','findAll','User','findAndCountAll','UserId','agent','chatPause','createdAt','%s/%s','SIP','updatedAt','getTeams','addTeams','ids','Team','Agents','flatMap','sequelize','transaction','each','forEach','userChatQueue:save','removeTeams','select','from','join','user_has_teams','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','all','compact','value','isEmpty','removeAgents','emit','userChatQueue:remove','omit','spread','isArray','getAgents','findOne','rimraf','zip-dir','request-promise','bluebird'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x33f8,0x128));var _0x833f=function(_0x3895ac,_0x4c29ed){_0x3895ac=_0x3895ac-0x0;var _0x45d22b=_0x33f8[_0x3895ac];return _0x45d22b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x833f('0x0'));var zipdir=require(_0x833f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x833f('0x2'));var moment=require('moment');var BPromise=require(_0x833f('0x3'));var Mustache=require(_0x833f('0x4'));var util=require(_0x833f('0x5'));var path=require(_0x833f('0x6'));var sox=require(_0x833f('0x7'));var csv=require(_0x833f('0x8'));var ejs=require(_0x833f('0x9'));var fs=require('fs');var fs_extra=require(_0x833f('0xa'));var _=require(_0x833f('0xb'));var squel=require('squel');var crypto=require(_0x833f('0xc'));var jsforce=require(_0x833f('0xd'));var deskjs=require(_0x833f('0xe'));var toCsv=require(_0x833f('0x8'));var querystring=require(_0x833f('0xf'));var Papa=require(_0x833f('0x10'));var Redis=require(_0x833f('0x11'));var authService=require(_0x833f('0x12'));var qs=require(_0x833f('0x13'));var as=require(_0x833f('0x14'));var hardwareService=require(_0x833f('0x15'));var logger=require(_0x833f('0x16'))(_0x833f('0x17'));var utils=require('../../config/utils');var config=require(_0x833f('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x833f('0x19'))['db'];config['redis']=_[_0x833f('0x1a')](config[_0x833f('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x833f('0x1c'))[_0x833f('0x1d')](socket);var jayson=require(_0x833f('0x1e'));var client=jayson[_0x833f('0x1f')][_0x833f('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x369e30,_0x378873,_0x4cdb51,_0x29c337){return new BPromise(function(_0x42656b,_0x160427){var _0x11ae67=_0x29c337||client;return _0x11ae67[_0x833f('0x21')](_0x369e30,_0x4cdb51)[_0x833f('0x22')](function(_0xdded16){logger[_0x833f('0x23')](_0x833f('0x24'),_0x378873,_0x833f('0x25'));logger[_0x833f('0x26')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x378873,'request\x20sent',JSON['stringify'](_0xdded16));if(_0xdded16[_0x833f('0x27')]){if(_0xdded16[_0x833f('0x27')][_0x833f('0x28')]===0x1f4){logger[_0x833f('0x27')](_0x833f('0x24'),_0x378873,_0xdded16[_0x833f('0x27')]['message']);return _0x160427(_0xdded16[_0x833f('0x27')][_0x833f('0x29')]);}logger['error'](_0x833f('0x24'),_0x378873,_0xdded16['error']['message']);return _0x42656b(_0xdded16[_0x833f('0x27')][_0x833f('0x29')]);}else{logger[_0x833f('0x23')](_0x833f('0x24'),_0x378873,'request\x20sent');_0x42656b(_0xdded16[_0x833f('0x2a')][_0x833f('0x29')]);}})[_0x833f('0x2b')](function(_0x358fc5){logger[_0x833f('0x27')]('ChatQueue,\x20%s,\x20%s',_0x378873,_0x358fc5);_0x160427(_0x358fc5);});});}function respondWithStatusCode(_0x1ee33e,_0xb2de93){_0xb2de93=_0xb2de93||0xcc;return function(_0x5c3d3f){if(_0x5c3d3f){return _0x1ee33e[_0x833f('0x2c')](_0xb2de93);}return _0x1ee33e[_0x833f('0x2d')](_0xb2de93)[_0x833f('0x2e')]();};}function respondWithResult(_0x929af3,_0x457f4a){_0x457f4a=_0x457f4a||0xc8;return function(_0x3e784f){if(_0x3e784f){return _0x929af3[_0x833f('0x2d')](_0x457f4a)[_0x833f('0x2f')](_0x3e784f);}};}function respondWithFilteredResult(_0x46dec0,_0x371bc9){return function(_0x3ca96e){if(_0x3ca96e){var _0x16e017=typeof _0x371bc9[_0x833f('0x30')]==='undefined'&&typeof _0x371bc9[_0x833f('0x31')]===_0x833f('0x32');var _0x4eeef1=_0x3ca96e[_0x833f('0x33')];var _0x4fcb30=_0x16e017?0x0:_0x371bc9[_0x833f('0x30')];var _0x1a5d54=_0x16e017?_0x3ca96e['count']:_0x371bc9[_0x833f('0x30')]+_0x371bc9['limit'];var _0x496f96;if(_0x1a5d54>=_0x4eeef1){_0x1a5d54=_0x4eeef1;_0x496f96=0xc8;}else{_0x496f96=0xce;}_0x46dec0[_0x833f('0x2d')](_0x496f96);return _0x46dec0[_0x833f('0x34')](_0x833f('0x35'),_0x4fcb30+'-'+_0x1a5d54+'/'+_0x4eeef1)[_0x833f('0x2f')](_0x3ca96e);}return null;};}function patchUpdates(_0x4b1edd){return function(_0x14a080){try{jsonpatch['apply'](_0x14a080,_0x4b1edd,!![]);}catch(_0x5a60bc){return BPromise[_0x833f('0x36')](_0x5a60bc);}return _0x14a080[_0x833f('0x37')]();};}function saveUpdates(_0x328e8,_0x141afd){return function(_0x743331){if(_0x743331){return _0x743331[_0x833f('0x38')](_0x328e8)['then'](function(_0x2bf7e5){return _0x2bf7e5;});}return null;};}function removeEntity(_0x4f9613,_0xde4caf){return function(_0x3fe938){if(_0x3fe938){return _0x3fe938[_0x833f('0x39')]()['then'](function(){var _0x173147=_0x3fe938[_0x833f('0x3a')]({'plain':!![]});var _0x48b8d3=_0x833f('0x3b');return db[_0x833f('0x3c')]['destroy']({'where':{'type':_0x48b8d3,'resourceId':_0x173147['id']}})[_0x833f('0x22')](function(){return _0x3fe938;});})[_0x833f('0x22')](function(){_0x4f9613[_0x833f('0x2d')](0xcc)[_0x833f('0x2e')]();});}};}function handleEntityNotFound(_0x55d407,_0x2466e2){return function(_0xe72fed){if(!_0xe72fed){_0x55d407[_0x833f('0x2c')](0x194);}return _0xe72fed;};}function handleError(_0x163113,_0x3eca5a){_0x3eca5a=_0x3eca5a||0x1f4;return function(_0xa86577){logger[_0x833f('0x27')](_0xa86577[_0x833f('0x3d')]);if(_0xa86577[_0x833f('0x3e')]){delete _0xa86577['name'];}_0x163113[_0x833f('0x2d')](_0x3eca5a)[_0x833f('0x3f')](_0xa86577);};}exports[_0x833f('0x40')]=function(_0x1999b7,_0x1ab48){var _0x3ff367={},_0x5d720f={},_0x35c78d={'count':0x0,'rows':[]};var _0x21e10b=_[_0x833f('0x41')](db[_0x833f('0x42')]['rawAttributes'],function(_0x6c9b2){return{'name':_0x6c9b2['fieldName'],'type':_0x6c9b2[_0x833f('0x43')][_0x833f('0x44')]};});_0x5d720f[_0x833f('0x45')]=_['map'](_0x21e10b,_0x833f('0x3e'));_0x5d720f['query']=_[_0x833f('0x46')](_0x1999b7['query']);_0x5d720f[_0x833f('0x47')]=_[_0x833f('0x48')](_0x5d720f[_0x833f('0x45')],_0x5d720f[_0x833f('0x49')]);_0x3ff367['attributes']=_[_0x833f('0x48')](_0x5d720f[_0x833f('0x45')],qs['fields'](_0x1999b7[_0x833f('0x49')]['fields']));_0x3ff367[_0x833f('0x4a')]=_0x3ff367[_0x833f('0x4a')][_0x833f('0x4b')]?_0x3ff367[_0x833f('0x4a')]:_0x5d720f[_0x833f('0x45')];if(!_0x1999b7[_0x833f('0x49')][_0x833f('0x4c')]('nolimit')){_0x3ff367[_0x833f('0x31')]=qs[_0x833f('0x31')](_0x1999b7[_0x833f('0x49')][_0x833f('0x31')]);_0x3ff367[_0x833f('0x30')]=qs['offset'](_0x1999b7[_0x833f('0x49')][_0x833f('0x30')]);}_0x3ff367[_0x833f('0x4d')]=qs[_0x833f('0x4e')](_0x1999b7[_0x833f('0x49')][_0x833f('0x4e')]);_0x3ff367['where']=qs[_0x833f('0x47')](_[_0x833f('0x4f')](_0x1999b7['query'],_0x5d720f['filters']),_0x21e10b);if(_0x1999b7[_0x833f('0x49')][_0x833f('0x50')]){_0x3ff367[_0x833f('0x51')]=_[_0x833f('0x52')](_0x3ff367[_0x833f('0x51')],{'$or':_[_0x833f('0x41')](_0x21e10b,function(_0x302a9f){if(_0x302a9f[_0x833f('0x43')]!==_0x833f('0x53')){var _0x5a5fb1={};_0x5a5fb1[_0x302a9f[_0x833f('0x3e')]]={'$like':'%'+_0x1999b7[_0x833f('0x49')][_0x833f('0x50')]+'%'};return _0x5a5fb1;}})});}_0x3ff367=_['merge']({},_0x3ff367,_0x1999b7['options']);var _0x36c2e3={'where':_0x3ff367[_0x833f('0x51')]};return db['ChatQueue'][_0x833f('0x33')](_0x36c2e3)['then'](function(_0xa2e161){_0x35c78d[_0x833f('0x33')]=_0xa2e161;if(_0x1999b7[_0x833f('0x49')][_0x833f('0x54')]){_0x3ff367[_0x833f('0x55')]=[{'all':!![]}];}return db['ChatQueue']['findAll'](_0x3ff367);})['then'](function(_0x4a1a90){_0x35c78d[_0x833f('0x56')]=_0x4a1a90;return _0x35c78d;})['then'](respondWithFilteredResult(_0x1ab48,_0x3ff367))[_0x833f('0x2b')](handleError(_0x1ab48,null));};exports[_0x833f('0x57')]=function(_0x1332eb,_0x2962a7){var _0x479a31={'raw':!![],'where':{'id':_0x1332eb[_0x833f('0x58')]['id']}},_0x2830fc={};_0x2830fc[_0x833f('0x45')]=_[_0x833f('0x46')](db['ChatQueue'][_0x833f('0x59')]);_0x2830fc[_0x833f('0x49')]=_[_0x833f('0x46')](_0x1332eb[_0x833f('0x49')]);_0x2830fc['filters']=_[_0x833f('0x48')](_0x2830fc['model'],_0x2830fc['query']);_0x479a31[_0x833f('0x4a')]=_['intersection'](_0x2830fc[_0x833f('0x45')],qs[_0x833f('0x5a')](_0x1332eb[_0x833f('0x49')][_0x833f('0x5a')]));_0x479a31[_0x833f('0x4a')]=_0x479a31[_0x833f('0x4a')][_0x833f('0x4b')]?_0x479a31[_0x833f('0x4a')]:_0x2830fc['model'];if(_0x1332eb[_0x833f('0x49')][_0x833f('0x54')]){_0x479a31['include']=[{'all':!![]}];}_0x479a31=_[_0x833f('0x52')]({},_0x479a31,_0x1332eb['options']);return db[_0x833f('0x42')][_0x833f('0x5b')](_0x479a31)[_0x833f('0x22')](handleEntityNotFound(_0x2962a7,null))['then'](respondWithResult(_0x2962a7,null))['catch'](handleError(_0x2962a7,null));};exports[_0x833f('0x5c')]=function(_0xc7245f,_0x2d425f){return db['ChatQueue']['create'](_0xc7245f[_0x833f('0x5d')],{})[_0x833f('0x22')](function(_0x31a713){var _0x60fc28=_0xc7245f['user'][_0x833f('0x3a')]({'plain':!![]});if(!_0x60fc28)throw new Error(_0x833f('0x5e'));if(_0x60fc28[_0x833f('0x5f')]===_0x833f('0x60')){var _0x4afaf2=_0x31a713[_0x833f('0x3a')]({'plain':!![]});var _0x27ef77=_0x833f('0x3b');return db['UserProfileSection'][_0x833f('0x5b')]({'where':{'name':_0x27ef77,'userProfileId':_0x60fc28['userProfileId']},'raw':!![]})[_0x833f('0x22')](function(_0x2d57b1){if(_0x2d57b1&&_0x2d57b1[_0x833f('0x61')]===0x0){return db[_0x833f('0x3c')][_0x833f('0x5c')]({'name':_0x4afaf2[_0x833f('0x3e')],'resourceId':_0x4afaf2['id'],'type':_0x2d57b1['name'],'sectionId':_0x2d57b1['id']},{})['then'](function(){return _0x31a713;});}else{return _0x31a713;}})['catch'](function(_0x1ca025){logger[_0x833f('0x27')](_0x833f('0x62'),_0x1ca025);throw _0x1ca025;});}return _0x31a713;})[_0x833f('0x22')](respondWithResult(_0x2d425f,0xc9))[_0x833f('0x2b')](handleError(_0x2d425f,null));};exports['update']=function(_0x3fad18,_0x3e6b6f){if(_0x3fad18[_0x833f('0x5d')]['id']){delete _0x3fad18[_0x833f('0x5d')]['id'];}return db[_0x833f('0x42')]['find']({'where':{'id':_0x3fad18['params']['id']}})[_0x833f('0x22')](handleEntityNotFound(_0x3e6b6f,null))[_0x833f('0x22')](saveUpdates(_0x3fad18['body'],null))[_0x833f('0x22')](respondWithResult(_0x3e6b6f,null))[_0x833f('0x2b')](handleError(_0x3e6b6f,null));};exports[_0x833f('0x39')]=function(_0x4cea1e,_0x5301b8){return db[_0x833f('0x42')][_0x833f('0x5b')]({'where':{'id':_0x4cea1e[_0x833f('0x58')]['id']}})[_0x833f('0x22')](handleEntityNotFound(_0x5301b8,null))[_0x833f('0x22')](removeEntity(_0x5301b8,null))['catch'](handleError(_0x5301b8,null));};exports[_0x833f('0x63')]=function(_0x56e9b9,_0xfe8750){return db['ChatQueue'][_0x833f('0x63')]()[_0x833f('0x22')](respondWithResult(_0xfe8750,null))[_0x833f('0x2b')](handleError(_0xfe8750,null));};exports[_0x833f('0x64')]=function(_0x5b9df8,_0x575177,_0x1e45b7){var _0x1a3482={'raw':!![],'where':{}},_0xa513b9={},_0x2da040;return db[_0x833f('0x42')]['findOne']({'where':{'id':_0x5b9df8['params']['id']}})[_0x833f('0x22')](handleEntityNotFound(_0x575177,null))['then'](function(_0x30f939){if(_0x30f939){_0x2da040=_0x30f939['get']({'plain':!![]});_0xa513b9[_0x833f('0x45')]=_[_0x833f('0x46')](db[_0x833f('0x65')]['rawAttributes']);_0xa513b9[_0x833f('0x49')]=_['keys'](_0x5b9df8[_0x833f('0x49')]);_0xa513b9[_0x833f('0x47')]=_[_0x833f('0x48')](_0xa513b9[_0x833f('0x45')],_0xa513b9[_0x833f('0x49')]);_0x1a3482[_0x833f('0x4a')]=_[_0x833f('0x48')](_0xa513b9['model'],qs['fields'](_0x5b9df8[_0x833f('0x49')][_0x833f('0x5a')]));_0x1a3482[_0x833f('0x4a')]=_0x1a3482[_0x833f('0x4a')]['length']?_0x1a3482['attributes']:_0xa513b9['model'];if(!_0x5b9df8[_0x833f('0x49')]['hasOwnProperty'](_0x833f('0x66'))){_0x1a3482[_0x833f('0x31')]=qs[_0x833f('0x31')](_0x5b9df8[_0x833f('0x49')][_0x833f('0x31')]);_0x1a3482[_0x833f('0x30')]=qs['offset'](_0x5b9df8[_0x833f('0x49')][_0x833f('0x30')]);}_0x1a3482[_0x833f('0x4d')]=qs['sort'](_0x5b9df8[_0x833f('0x49')]['sort']);_0x1a3482[_0x833f('0x51')]=qs[_0x833f('0x47')](_[_0x833f('0x4f')](_0x5b9df8['query'],_0xa513b9[_0x833f('0x47')]));_0x1a3482[_0x833f('0x51')]['ChatQueueId']=_0x30f939['id'];if(_0x5b9df8['query']['filter']){_0x1a3482[_0x833f('0x51')]=_[_0x833f('0x52')](_0x1a3482[_0x833f('0x51')],{'$or':_[_0x833f('0x41')](_0x1a3482[_0x833f('0x4a')],function(_0x7e1551){var _0x3f9e9e={};_0x3f9e9e[_0x7e1551]={'$like':'%'+_0x5b9df8[_0x833f('0x49')][_0x833f('0x50')]+'%'};return _0x3f9e9e;})});}_0x1a3482=_[_0x833f('0x52')]({},_0x1a3482,_0x5b9df8[_0x833f('0x67')]);return db[_0x833f('0x65')][_0x833f('0x68')](_0x1a3482);}})['then'](function(_0x9df97a){if(_0x9df97a){return db[_0x833f('0x69')][_0x833f('0x6a')]({'where':{'id':_[_0x833f('0x41')](_0x9df97a,_0x833f('0x6b')),'role':_0x833f('0x6c')},'attributes':['id',_0x833f('0x3e'),_0x833f('0x6d'),'updatedAt',_0x833f('0x6e')]});}})[_0x833f('0x22')](function(_0x5b55b0){if(_0x5b55b0){return{'count':_0x5b55b0['count'],'rows':_[_0x833f('0x41')](_0x5b55b0[_0x833f('0x56')],function(_0x312294){return{'membername':_0x312294[_0x833f('0x3e')],'UserId':_0x312294['id'],'queue_name':_0x2da040[_0x833f('0x3e')],'ChatQueueId':_0x2da040['id'],'interface':util['format'](_0x833f('0x6f'),_0x833f('0x70'),_0x312294[_0x833f('0x3e')]),'penalty':0x0,'paused':_0x312294[_0x833f('0x6d')],'createdAt':_0x312294[_0x833f('0x6e')],'updatedAt':_0x312294[_0x833f('0x71')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x833f('0x22')](respondWithFilteredResult(_0x575177,_0x1a3482))[_0x833f('0x2b')](handleError(_0x575177,null));};exports['getTeams']=function(_0x2ba614,_0x3b915b,_0x4fa39f){var _0x55facb={};var _0x39a375={};var _0x2f3f9b;var _0xdc9983;return db['ChatQueue']['findOne']({'where':{'id':_0x2ba614[_0x833f('0x58')]['id']}})['then'](handleEntityNotFound(_0x3b915b,null))[_0x833f('0x22')](function(_0x4c3931){if(_0x4c3931){_0x2f3f9b=_0x4c3931;_0x39a375['model']=_[_0x833f('0x46')](db['Team'][_0x833f('0x59')]);_0x39a375[_0x833f('0x49')]=_[_0x833f('0x46')](_0x2ba614[_0x833f('0x49')]);_0x39a375['filters']=_[_0x833f('0x48')](_0x39a375[_0x833f('0x45')],_0x39a375['query']);_0x55facb[_0x833f('0x4a')]=_[_0x833f('0x48')](_0x39a375['model'],qs[_0x833f('0x5a')](_0x2ba614['query'][_0x833f('0x5a')]));_0x55facb[_0x833f('0x4a')]=_0x55facb[_0x833f('0x4a')][_0x833f('0x4b')]?_0x55facb[_0x833f('0x4a')]:_0x39a375[_0x833f('0x45')];_0x55facb[_0x833f('0x4d')]=qs[_0x833f('0x4e')](_0x2ba614[_0x833f('0x49')]['sort']);_0x55facb[_0x833f('0x51')]=qs[_0x833f('0x47')](_['pick'](_0x2ba614[_0x833f('0x49')],_0x39a375[_0x833f('0x47')]));if(_0x2ba614[_0x833f('0x49')][_0x833f('0x50')]){_0x55facb['where']=_['merge'](_0x55facb[_0x833f('0x51')],{'$or':_[_0x833f('0x41')](_0x55facb[_0x833f('0x4a')],function(_0x417d6c){var _0x2670d4={};_0x2670d4[_0x417d6c]={'$like':'%'+_0x2ba614['query'][_0x833f('0x50')]+'%'};return _0x2670d4;})});}_0x55facb=_[_0x833f('0x52')]({},_0x55facb,_0x2ba614[_0x833f('0x67')]);return _0x2f3f9b[_0x833f('0x72')](_0x55facb);}})[_0x833f('0x22')](function(_0x2730e1){if(_0x2730e1){_0xdc9983=_0x2730e1[_0x833f('0x4b')];if(!_0x2ba614['query']['hasOwnProperty'](_0x833f('0x66'))){_0x55facb[_0x833f('0x31')]=qs[_0x833f('0x31')](_0x2ba614['query'][_0x833f('0x31')]);_0x55facb[_0x833f('0x30')]=qs[_0x833f('0x30')](_0x2ba614['query'][_0x833f('0x30')]);}return _0x2f3f9b['getTeams'](_0x55facb);}})[_0x833f('0x22')](function(_0x1f1ba4){if(_0x1f1ba4){return _0x1f1ba4?{'count':_0xdc9983,'rows':_0x1f1ba4}:null;}})[_0x833f('0x22')](respondWithResult(_0x3b915b,null))['catch'](handleError(_0x3b915b,null));};exports[_0x833f('0x73')]=function(_0x38fb8d,_0x18cafc,_0x16b3b6){var _0x32fa2a=_0x38fb8d[_0x833f('0x5d')][_0x833f('0x74')];return db[_0x833f('0x75')][_0x833f('0x68')]({'where':{'id':_0x32fa2a},'attributes':['id'],'include':[{'model':db[_0x833f('0x69')],'as':_0x833f('0x76'),'attributes':['id',_0x833f('0x3e'),'online','voicePause','interface'],'raw':!![]}]})[_0x833f('0x22')](function(_0x3bb754){if(_0x3bb754){var _0x4fb225=_[_0x833f('0x77')](_0x3bb754,function(_0x3701a0){var _0x36b025=_0x3701a0[_0x833f('0x3a')]({'plain':!![]});return _0x36b025[_0x833f('0x76')];});return db['ChatQueue'][_0x833f('0x5b')]({'where':{'id':_0x38fb8d[_0x833f('0x58')]['id']}})[_0x833f('0x22')](function(_0x3ce590){return db[_0x833f('0x78')][_0x833f('0x79')](function(_0x4820ec){return _0x3ce590[_0x833f('0x73')](_0x32fa2a,{'transaction':_0x4820ec})['then'](function(){return BPromise[_0x833f('0x7a')](_0x4fb225,function(_0x12a21d){return db[_0x833f('0x65')]['findOrCreate']({'where':{'UserId':_0x12a21d['id'],'ChatQueueId':_0x38fb8d[_0x833f('0x58')]['id']},'transaction':_0x4820ec});});})['then'](function(){_0x4fb225[_0x833f('0x7b')](function(_0x2684bc){socket['emit'](_0x833f('0x7c'),{'UserId':_0x2684bc['id'],'ChatQueueId':_0x3ce590['id']});});});});});}})[_0x833f('0x22')](respondWithStatusCode(_0x18cafc,null))[_0x833f('0x2b')](handleError(_0x18cafc,null));};exports[_0x833f('0x7d')]=function(_0x516804,_0x35baf4,_0x5ee896){return db[_0x833f('0x75')][_0x833f('0x68')]({'where':{'id':_0x516804[_0x833f('0x49')]['ids']},'attributes':['id'],'include':[{'model':db[_0x833f('0x69')],'as':_0x833f('0x76'),'attributes':['id'],'raw':!![]}]})[_0x833f('0x22')](handleEntityNotFound(_0x35baf4,null))[_0x833f('0x22')](function(_0x73a1ef){var _0x1c9019=_[_0x833f('0x41')](_0x73a1ef,'id');var _0xaf45ae=[];var _0x860f8a=[];var _0x5d9124=squel[_0x833f('0x7e')]();_0x5d9124['field']('tq.TeamId')[_0x833f('0x7f')]('team_has_chat_queues','tq')[_0x833f('0x80')](_0x833f('0x81'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x833f('0x82'),_0x516804['params']['id']);for(var _0x27bc3e=0x0;_0x27bc3e<_0x73a1ef[_0x833f('0x4b')];_0x27bc3e+=0x1){let _0x271b07=_0x73a1ef[_0x27bc3e];for(var _0x33240d=0x0;_0x33240d<_0x271b07[_0x833f('0x76')]['length'];_0x33240d+=0x1){let _0x6c4f16=_0x271b07[_0x833f('0x76')][_0x33240d];var _0x39051a=_0x5d9124[_0x833f('0x83')]();_0x39051a['where'](_0x833f('0x84'),_0x6c4f16['id']);_0x860f8a['push'](db[_0x833f('0x78')][_0x833f('0x49')](_0x39051a[_0x833f('0x85')](),{'type':db[_0x833f('0x78')][_0x833f('0x86')][_0x833f('0x87')]})[_0x833f('0x22')](function(_0x776e80){if(_0x776e80['length']===0x1){return _0x6c4f16['id'];}else{var _0x1a7358=_[_0x833f('0x88')](_['map'](_0x776e80,'TeamId'),function(_0x568308){return _[_0x833f('0x89')](_0x1c9019,_0x568308);});if(_0x1a7358){return _0x6c4f16['id'];}}}));}}return BPromise[_0x833f('0x8a')](_0x860f8a)['then'](function(_0x69fff9){_0xaf45ae=_(_0xaf45ae)['union'](_0x69fff9)[_0x833f('0x8b')]()[_0x833f('0x8c')]();return db[_0x833f('0x42')][_0x833f('0x5b')]({'where':{'id':_0x516804['params']['id']}})['then'](function(_0x289d97){return db['sequelize'][_0x833f('0x79')](function(_0x5636c9){return _0x289d97[_0x833f('0x7d')](_0x516804['query'][_0x833f('0x74')],{'transaction':_0x5636c9})[_0x833f('0x22')](function(){if(!_[_0x833f('0x8d')](_0xaf45ae)){return _0x289d97[_0x833f('0x8e')](_0xaf45ae,{'transaction':_0x5636c9});}})[_0x833f('0x22')](function(){_0xaf45ae[_0x833f('0x7b')](function(_0x412836){socket[_0x833f('0x8f')](_0x833f('0x90'),{'UserId':_0x412836,'ChatQueueId':_0x289d97['id']});});});});});});})['then'](respondWithStatusCode(_0x35baf4,null))[_0x833f('0x2b')](handleError(_0x35baf4,null));};exports['addAgents']=function(_0x213226,_0x4ae801,_0x24d02f){return db['ChatQueue'][_0x833f('0x5b')]({'where':{'id':_0x213226[_0x833f('0x58')]['id']}})['then'](handleEntityNotFound(_0x4ae801,null))[_0x833f('0x22')](function(_0x27a069){if(_0x27a069){return _0x27a069['addAgents'](_0x213226['body'][_0x833f('0x74')],_[_0x833f('0x91')](_0x213226[_0x833f('0x5d')],[_0x833f('0x74'),'id'])||{})[_0x833f('0x92')](function(_0x586292){for(var _0x4f863c=0x0;_0x4f863c<_0x213226[_0x833f('0x5d')][_0x833f('0x74')][_0x833f('0x4b')];_0x4f863c+=0x1){socket[_0x833f('0x8f')](_0x833f('0x7c'),{'UserId':Number(_0x213226[_0x833f('0x5d')][_0x833f('0x74')][_0x4f863c]),'ChatQueueId':Number(_0x213226[_0x833f('0x58')]['id'])});}return _0x586292;});}})[_0x833f('0x22')](respondWithResult(_0x4ae801,null))[_0x833f('0x2b')](handleError(_0x4ae801,null));};exports[_0x833f('0x8e')]=function(_0x63d2ef,_0x1e5d35,_0x1aab87){return db['ChatQueue']['find']({'where':{'id':_0x63d2ef[_0x833f('0x58')]['id']}})[_0x833f('0x22')](handleEntityNotFound(_0x1e5d35,null))[_0x833f('0x22')](function(_0x5548ad){if(_0x5548ad){return _0x5548ad[_0x833f('0x8e')](_0x63d2ef[_0x833f('0x49')][_0x833f('0x74')])[_0x833f('0x22')](function(){if(_[_0x833f('0x93')](_0x63d2ef[_0x833f('0x49')][_0x833f('0x74')])){for(var _0x59f60b=0x0;_0x59f60b<_0x63d2ef[_0x833f('0x49')][_0x833f('0x74')]['length'];_0x59f60b+=0x1){socket[_0x833f('0x8f')](_0x833f('0x90'),{'UserId':Number(_0x63d2ef['query']['ids'][_0x59f60b]),'ChatQueueId':Number(_0x63d2ef['params']['id'])});}}else{socket[_0x833f('0x8f')](_0x833f('0x90'),{'UserId':Number(_0x63d2ef[_0x833f('0x49')]['ids']),'ChatQueueId':Number(_0x63d2ef[_0x833f('0x58')]['id'])});}});}})[_0x833f('0x22')](respondWithStatusCode(_0x1e5d35,null))[_0x833f('0x2b')](handleError(_0x1e5d35,null));};exports[_0x833f('0x94')]=function(_0x39573a,_0x1ec9a0,_0x196608){var _0x527fe1={};var _0x32dd4f={};var _0x2906a4;var _0x4358fa;return db[_0x833f('0x42')][_0x833f('0x95')]({'where':{'id':_0x39573a[_0x833f('0x58')]['id']}})['then'](handleEntityNotFound(_0x1ec9a0,null))[_0x833f('0x22')](function(_0x55f696){if(_0x55f696){_0x2906a4=_0x55f696;_0x32dd4f[_0x833f('0x45')]=_['keys'](db['User'][_0x833f('0x59')]);_0x32dd4f[_0x833f('0x49')]=_[_0x833f('0x46')](_0x39573a[_0x833f('0x49')]);_0x32dd4f[_0x833f('0x47')]=_[_0x833f('0x48')](_0x32dd4f[_0x833f('0x45')],_0x32dd4f[_0x833f('0x49')]);_0x527fe1[_0x833f('0x4a')]=_[_0x833f('0x48')](_0x32dd4f[_0x833f('0x45')],qs[_0x833f('0x5a')](_0x39573a[_0x833f('0x49')][_0x833f('0x5a')]));_0x527fe1[_0x833f('0x4a')]=_0x527fe1[_0x833f('0x4a')][_0x833f('0x4b')]?_0x527fe1[_0x833f('0x4a')]:_0x32dd4f['model'];_0x527fe1[_0x833f('0x4d')]=qs[_0x833f('0x4e')](_0x39573a[_0x833f('0x49')][_0x833f('0x4e')]);_0x527fe1[_0x833f('0x51')]=qs[_0x833f('0x47')](_['pick'](_0x39573a['query'],_0x32dd4f[_0x833f('0x47')]));if(_0x39573a[_0x833f('0x49')][_0x833f('0x50')]){_0x527fe1[_0x833f('0x51')]=_['merge'](_0x527fe1[_0x833f('0x51')],{'$or':_[_0x833f('0x41')](_0x527fe1[_0x833f('0x4a')],function(_0x5d1860){var _0x2285e5={};_0x2285e5[_0x5d1860]={'$like':'%'+_0x39573a['query'][_0x833f('0x50')]+'%'};return _0x2285e5;})});}_0x527fe1=_[_0x833f('0x52')]({},_0x527fe1,_0x39573a['options']);return _0x2906a4[_0x833f('0x94')](_0x527fe1);}})[_0x833f('0x22')](function(_0x3a56ff){if(_0x3a56ff){_0x4358fa=_0x3a56ff[_0x833f('0x4b')];if(!_0x39573a['query'][_0x833f('0x4c')](_0x833f('0x66'))){_0x527fe1[_0x833f('0x31')]=qs[_0x833f('0x31')](_0x39573a[_0x833f('0x49')]['limit']);_0x527fe1[_0x833f('0x30')]=qs[_0x833f('0x30')](_0x39573a[_0x833f('0x49')][_0x833f('0x30')]);}return _0x2906a4['getAgents'](_0x527fe1);}})[_0x833f('0x22')](function(_0x616653){if(_0x616653){return _0x616653?{'count':_0x4358fa,'rows':_0x616653}:null;}})[_0x833f('0x22')](respondWithResult(_0x1ec9a0,null))['catch'](handleError(_0x1ec9a0,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index ece6cbe..8033992 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 _0x8fe0=['emit','hasOwnProperty','hook','exports','ChatQueue','update','remove'];(function(_0x442469,_0x5d2194){var _0x2109b4=function(_0x3fdf86){while(--_0x3fdf86){_0x442469['push'](_0x442469['shift']());}};_0x2109b4(++_0x5d2194);}(_0x8fe0,0xdd));var _0x08fe=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x8fe0[_0x19e35c];return _0x3e1fe8;};'use strict';var EventEmitter=require('events');var ChatQueue=require('../../mysqldb')['db'][_0x08fe('0x0')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x08fe('0x1'),'afterDestroy':_0x08fe('0x2')};function emitEvent(_0x46aa95){return function(_0x5cd8ec,_0x2fb7ea,_0x1f04bc){ChatQueueEvents[_0x08fe('0x3')](_0x46aa95+':'+_0x5cd8ec['id'],_0x5cd8ec);ChatQueueEvents[_0x08fe('0x3')](_0x46aa95,_0x5cd8ec);_0x1f04bc(null);};}for(var e in events){if(events[_0x08fe('0x4')](e)){var event=events[e];ChatQueue[_0x08fe('0x5')](e,emitEvent(event));}}module[_0x08fe('0x6')]=ChatQueueEvents; \ No newline at end of file +var _0x74a3=['hasOwnProperty','exports','events','../../mysqldb','ChatQueue','save','update','remove','emit'];(function(_0x2ce44f,_0x446221){var _0x1c1495=function(_0x53857b){while(--_0x53857b){_0x2ce44f['push'](_0x2ce44f['shift']());}};_0x1c1495(++_0x446221);}(_0x74a3,0x1b2));var _0x374a=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x74a3[_0x6c993a];return _0x27f547;};'use strict';var EventEmitter=require(_0x374a('0x0'));var ChatQueue=require(_0x374a('0x1'))['db'][_0x374a('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x374a('0x3'),'afterUpdate':_0x374a('0x4'),'afterDestroy':_0x374a('0x5')};function emitEvent(_0x33a53f){return function(_0x48d0c6,_0x5138f7,_0x1fd0c5){ChatQueueEvents[_0x374a('0x6')](_0x33a53f+':'+_0x48d0c6['id'],_0x48d0c6);ChatQueueEvents[_0x374a('0x6')](_0x33a53f,_0x48d0c6);_0x1fd0c5(null);};}for(var e in events){if(events[_0x374a('0x7')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0x374a('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 922db01..f2e083d 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 _0x9202=['request-promise','path','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','../../config/logger','api','moment'];(function(_0x4fd0b2,_0x1cb32e){var _0x1a1fd2=function(_0x3cb3ee){while(--_0x3cb3ee){_0x4fd0b2['push'](_0x4fd0b2['shift']());}};_0x1a1fd2(++_0x1cb32e);}(_0x9202,0x1f1));var _0x2920=function(_0x4d9943,_0x34d95e){_0x4d9943=_0x4d9943-0x0;var _0x484515=_0x9202[_0x4d9943];return _0x484515;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2920('0x0'))(_0x2920('0x1'));var moment=require(_0x2920('0x2'));var BPromise=require('bluebird');var rp=require(_0x2920('0x3'));var fs=require('fs');var path=require(_0x2920('0x4'));var rimraf=require('rimraf');var config=require(_0x2920('0x5'));var attributes=require(_0x2920('0x6'));module[_0x2920('0x7')]=function(_0x24c23c,_0x37e1b1){return _0x24c23c[_0x2920('0x8')](_0x2920('0x9'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb801=['request-promise','path','exports','chat_queues','lodash','../../config/logger','api','moment'];(function(_0x49f79b,_0x17fdcb){var _0x2d7f34=function(_0x5062d8){while(--_0x5062d8){_0x49f79b['push'](_0x49f79b['shift']());}};_0x2d7f34(++_0x17fdcb);}(_0xb801,0x11c));var _0x1b80=function(_0x1f28a6,_0x11d1a4){_0x1f28a6=_0x1f28a6-0x0;var _0x444b21=_0xb801[_0x1f28a6];return _0x444b21;};'use strict';var _=require(_0x1b80('0x0'));var util=require('util');var logger=require(_0x1b80('0x1'))(_0x1b80('0x2'));var moment=require(_0x1b80('0x3'));var BPromise=require('bluebird');var rp=require(_0x1b80('0x4'));var fs=require('fs');var path=require(_0x1b80('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatQueue.attributes');module[_0x1b80('0x6')]=function(_0x47e1be,_0x270505){return _0x47e1be['define']('ChatQueue',attributes,{'tableName':_0x1b80('0x7'),'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 bcfa1d9..6234d43 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 _0x53aa=['where','attributes','limit','include','map','model','ShowChatQueue','find','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetChatQueue','ChatQueue','findAll','options'];(function(_0x17ff84,_0x513e44){var _0x4d6138=function(_0x291862){while(--_0x291862){_0x17ff84['push'](_0x17ff84['shift']());}};_0x4d6138(++_0x513e44);}(_0x53aa,0x167));var _0xa53a=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x53aa[_0x2e4e19];return _0x9ba20b;};'use strict';var _=require(_0xa53a('0x0'));var util=require(_0xa53a('0x1'));var moment=require(_0xa53a('0x2'));var BPromise=require(_0xa53a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa53a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa53a('0x5'))(_0xa53a('0x6'));var config=require(_0xa53a('0x7'));var jayson=require(_0xa53a('0x8'));var client=jayson[_0xa53a('0x9')]['http']({'port':0x232a});config[_0xa53a('0xa')]=_[_0xa53a('0xb')](config['redis'],{'host':_0xa53a('0xc'),'port':0x18eb});var socket=require(_0xa53a('0xd'))(new Redis(config[_0xa53a('0xa')]));require('./chatQueue.socket')[_0xa53a('0xe')](socket);function respondWithRpcPromise(_0x5785a9,_0x422fb3,_0x1a79a1){return new BPromise(function(_0x40bd10,_0x5d1e46){return client[_0xa53a('0xf')](_0x5785a9,_0x1a79a1)[_0xa53a('0x10')](function(_0x18eba9){logger[_0xa53a('0x11')](_0xa53a('0x12'),_0x422fb3,'request\x20sent');logger[_0xa53a('0x13')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x422fb3,_0xa53a('0x14'),JSON[_0xa53a('0x15')](_0x18eba9));if(_0x18eba9[_0xa53a('0x16')]){if(_0x18eba9[_0xa53a('0x16')][_0xa53a('0x17')]===0x1f4){logger[_0xa53a('0x16')](_0xa53a('0x12'),_0x422fb3,_0x18eba9[_0xa53a('0x16')][_0xa53a('0x18')]);return _0x5d1e46(_0x18eba9[_0xa53a('0x16')][_0xa53a('0x18')]);}logger[_0xa53a('0x16')]('ChatQueue,\x20%s,\x20%s',_0x422fb3,_0x18eba9[_0xa53a('0x16')][_0xa53a('0x18')]);return _0x40bd10(_0x18eba9['error'][_0xa53a('0x18')]);}else{logger[_0xa53a('0x11')](_0xa53a('0x12'),_0x422fb3,_0xa53a('0x14'));_0x40bd10(_0x18eba9[_0xa53a('0x19')][_0xa53a('0x18')]);}})[_0xa53a('0x1a')](function(_0x344350){logger[_0xa53a('0x16')](_0xa53a('0x12'),_0x422fb3,_0x344350);_0x5d1e46(_0x344350);});});}exports[_0xa53a('0x1b')]=function(_0x1a50bd){var _0x2311ba=this;return new Promise(function(_0xaecd04,_0x584c4e){return db[_0xa53a('0x1c')][_0xa53a('0x1d')]({'raw':_0x1a50bd['options']?_0x1a50bd[_0xa53a('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x1a50bd[_0xa53a('0x1e')]?_0x1a50bd[_0xa53a('0x1e')][_0xa53a('0x1f')]||null:null,'attributes':_0x1a50bd[_0xa53a('0x1e')]?_0x1a50bd[_0xa53a('0x1e')][_0xa53a('0x20')]||null:null,'limit':_0x1a50bd['options']?_0x1a50bd[_0xa53a('0x1e')][_0xa53a('0x21')]||null:null,'include':_0x1a50bd['options']?_0x1a50bd[_0xa53a('0x1e')][_0xa53a('0x22')]?_[_0xa53a('0x23')](_0x1a50bd[_0xa53a('0x1e')][_0xa53a('0x22')],function(_0x401aae){return{'model':db[_0x401aae[_0xa53a('0x24')]],'as':_0x401aae['as'],'attributes':_0x401aae['attributes'],'include':_0x401aae['include']?_[_0xa53a('0x23')](_0x401aae[_0xa53a('0x22')],function(_0x512d96){return{'model':db[_0x512d96[_0xa53a('0x24')]],'as':_0x512d96['as'],'attributes':_0x512d96[_0xa53a('0x20')],'include':_0x512d96[_0xa53a('0x22')]?_[_0xa53a('0x23')](_0x512d96[_0xa53a('0x22')],function(_0x1e796b){return{'model':db[_0x1e796b['model']],'as':_0x1e796b['as'],'attributes':_0x1e796b[_0xa53a('0x20')]};}):[]};}):[]};}):[]:[]})[_0xa53a('0x10')](function(_0xde3502){logger['info']('GetChatQueue',_0x1a50bd);logger[_0xa53a('0x13')](_0xa53a('0x1b'),_0x1a50bd,JSON[_0xa53a('0x15')](_0xde3502));_0xaecd04(_0xde3502);})['catch'](function(_0x2d78eb){logger[_0xa53a('0x16')](_0xa53a('0x1b'),_0x2d78eb[_0xa53a('0x18')],_0x1a50bd);_0x584c4e(_0x2311ba['error'](0x1f4,_0x2d78eb['message']));});});};exports[_0xa53a('0x25')]=function(_0x25d4f3){var _0x22d998=this;return new Promise(function(_0x315dc6,_0x3461ae){return db[_0xa53a('0x1c')][_0xa53a('0x26')]({'raw':_0x25d4f3[_0xa53a('0x1e')]?_0x25d4f3[_0xa53a('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x25d4f3[_0xa53a('0x1e')]?_0x25d4f3['options'][_0xa53a('0x1f')]||null:null,'attributes':_0x25d4f3[_0xa53a('0x1e')]?_0x25d4f3[_0xa53a('0x1e')][_0xa53a('0x20')]||null:null,'include':_0x25d4f3[_0xa53a('0x1e')]?_0x25d4f3[_0xa53a('0x1e')][_0xa53a('0x22')]?_[_0xa53a('0x23')](_0x25d4f3[_0xa53a('0x1e')]['include'],function(_0x351860){return{'model':db[_0x351860['model']],'as':_0x351860['as'],'attributes':_0x351860['attributes'],'include':_0x351860[_0xa53a('0x22')]?_[_0xa53a('0x23')](_0x351860[_0xa53a('0x22')],function(_0x4993df){return{'model':db[_0x4993df[_0xa53a('0x24')]],'as':_0x4993df['as'],'attributes':_0x4993df['attributes'],'include':_0x4993df[_0xa53a('0x22')]?_[_0xa53a('0x23')](_0x4993df['include'],function(_0x295898){return{'model':db[_0x295898[_0xa53a('0x24')]],'as':_0x295898['as'],'attributes':_0x295898[_0xa53a('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x109276){logger[_0xa53a('0x11')]('ShowChatQueue',_0x25d4f3);logger[_0xa53a('0x13')](_0xa53a('0x25'),_0x25d4f3,JSON[_0xa53a('0x15')](_0x109276));_0x315dc6(_0x109276);})[_0xa53a('0x1a')](function(_0x13dc01){logger['error'](_0xa53a('0x25'),_0x13dc01[_0xa53a('0x18')],_0x25d4f3);_0x3461ae(_0x22d998['error'](0x1f4,_0x13dc01[_0xa53a('0x18')]));});});}; \ No newline at end of file +var _0x6f2f=['model','attributes','then','ShowChatQueue','find','lodash','util','ioredis','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetChatQueue','ChatQueue','options','raw','where','include','map'];(function(_0x1fe978,_0x5e1d74){var _0x13b233=function(_0x2dc5d8){while(--_0x2dc5d8){_0x1fe978['push'](_0x1fe978['shift']());}};_0x13b233(++_0x5e1d74);}(_0x6f2f,0xbe));var _0xf6f2=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x6f2f[_0x403c20];return _0x2b271a;};'use strict';var _=require(_0xf6f2('0x0'));var util=require(_0xf6f2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf6f2('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf6f2('0x3'))(_0xf6f2('0x4'));var config=require(_0xf6f2('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf6f2('0x6')]({'port':0x232a});config[_0xf6f2('0x7')]=_[_0xf6f2('0x8')](config[_0xf6f2('0x7')],{'host':_0xf6f2('0x9'),'port':0x18eb});var socket=require(_0xf6f2('0xa'))(new Redis(config[_0xf6f2('0x7')]));require(_0xf6f2('0xb'))[_0xf6f2('0xc')](socket);function respondWithRpcPromise(_0x17ffd2,_0x55a260,_0x109271){return new BPromise(function(_0x266c6e,_0x2a4325){return client[_0xf6f2('0xd')](_0x17ffd2,_0x109271)['then'](function(_0x4ca76a){logger['info'](_0xf6f2('0xe'),_0x55a260,_0xf6f2('0xf'));logger[_0xf6f2('0x10')](_0xf6f2('0x11'),_0x55a260,_0xf6f2('0xf'),JSON[_0xf6f2('0x12')](_0x4ca76a));if(_0x4ca76a['error']){if(_0x4ca76a[_0xf6f2('0x13')][_0xf6f2('0x14')]===0x1f4){logger[_0xf6f2('0x13')](_0xf6f2('0xe'),_0x55a260,_0x4ca76a[_0xf6f2('0x13')]['message']);return _0x2a4325(_0x4ca76a[_0xf6f2('0x13')][_0xf6f2('0x15')]);}logger[_0xf6f2('0x13')](_0xf6f2('0xe'),_0x55a260,_0x4ca76a[_0xf6f2('0x13')][_0xf6f2('0x15')]);return _0x266c6e(_0x4ca76a[_0xf6f2('0x13')][_0xf6f2('0x15')]);}else{logger[_0xf6f2('0x16')](_0xf6f2('0xe'),_0x55a260,_0xf6f2('0xf'));_0x266c6e(_0x4ca76a[_0xf6f2('0x17')][_0xf6f2('0x15')]);}})[_0xf6f2('0x18')](function(_0xb05611){logger['error']('ChatQueue,\x20%s,\x20%s',_0x55a260,_0xb05611);_0x2a4325(_0xb05611);});});}exports[_0xf6f2('0x19')]=function(_0x544f71){var _0x145a7e=this;return new Promise(function(_0xe01b4d,_0x312429){return db[_0xf6f2('0x1a')]['findAll']({'raw':_0x544f71[_0xf6f2('0x1b')]?_0x544f71[_0xf6f2('0x1b')][_0xf6f2('0x1c')]===undefined?!![]:![]:!![],'where':_0x544f71[_0xf6f2('0x1b')]?_0x544f71['options'][_0xf6f2('0x1d')]||null:null,'attributes':_0x544f71['options']?_0x544f71[_0xf6f2('0x1b')]['attributes']||null:null,'limit':_0x544f71[_0xf6f2('0x1b')]?_0x544f71[_0xf6f2('0x1b')]['limit']||null:null,'include':_0x544f71[_0xf6f2('0x1b')]?_0x544f71[_0xf6f2('0x1b')][_0xf6f2('0x1e')]?_[_0xf6f2('0x1f')](_0x544f71[_0xf6f2('0x1b')][_0xf6f2('0x1e')],function(_0x3304ec){return{'model':db[_0x3304ec[_0xf6f2('0x20')]],'as':_0x3304ec['as'],'attributes':_0x3304ec['attributes'],'include':_0x3304ec[_0xf6f2('0x1e')]?_[_0xf6f2('0x1f')](_0x3304ec[_0xf6f2('0x1e')],function(_0xf0f188){return{'model':db[_0xf0f188[_0xf6f2('0x20')]],'as':_0xf0f188['as'],'attributes':_0xf0f188[_0xf6f2('0x21')],'include':_0xf0f188[_0xf6f2('0x1e')]?_[_0xf6f2('0x1f')](_0xf0f188[_0xf6f2('0x1e')],function(_0x40243e){return{'model':db[_0x40243e[_0xf6f2('0x20')]],'as':_0x40243e['as'],'attributes':_0x40243e['attributes']};}):[]};}):[]};}):[]:[]})[_0xf6f2('0x22')](function(_0x26c4dc){logger[_0xf6f2('0x16')](_0xf6f2('0x19'),_0x544f71);logger[_0xf6f2('0x10')](_0xf6f2('0x19'),_0x544f71,JSON[_0xf6f2('0x12')](_0x26c4dc));_0xe01b4d(_0x26c4dc);})[_0xf6f2('0x18')](function(_0x6a077c){logger[_0xf6f2('0x13')](_0xf6f2('0x19'),_0x6a077c[_0xf6f2('0x15')],_0x544f71);_0x312429(_0x145a7e['error'](0x1f4,_0x6a077c[_0xf6f2('0x15')]));});});};exports[_0xf6f2('0x23')]=function(_0x2fc531){var _0x1863d9=this;return new Promise(function(_0x3aec2c,_0x3a421f){return db[_0xf6f2('0x1a')][_0xf6f2('0x24')]({'raw':_0x2fc531[_0xf6f2('0x1b')]?_0x2fc531[_0xf6f2('0x1b')][_0xf6f2('0x1c')]===undefined?!![]:![]:!![],'where':_0x2fc531[_0xf6f2('0x1b')]?_0x2fc531[_0xf6f2('0x1b')]['where']||null:null,'attributes':_0x2fc531['options']?_0x2fc531['options'][_0xf6f2('0x21')]||null:null,'include':_0x2fc531[_0xf6f2('0x1b')]?_0x2fc531['options']['include']?_[_0xf6f2('0x1f')](_0x2fc531[_0xf6f2('0x1b')][_0xf6f2('0x1e')],function(_0x9bf3e0){return{'model':db[_0x9bf3e0[_0xf6f2('0x20')]],'as':_0x9bf3e0['as'],'attributes':_0x9bf3e0[_0xf6f2('0x21')],'include':_0x9bf3e0['include']?_[_0xf6f2('0x1f')](_0x9bf3e0['include'],function(_0x33139f){return{'model':db[_0x33139f[_0xf6f2('0x20')]],'as':_0x33139f['as'],'attributes':_0x33139f[_0xf6f2('0x21')],'include':_0x33139f[_0xf6f2('0x1e')]?_['map'](_0x33139f[_0xf6f2('0x1e')],function(_0x311a37){return{'model':db[_0x311a37[_0xf6f2('0x20')]],'as':_0x311a37['as'],'attributes':_0x311a37['attributes']};}):[]};}):[]};}):[]:[]})[_0xf6f2('0x22')](function(_0x213923){logger[_0xf6f2('0x16')]('ShowChatQueue',_0x2fc531);logger[_0xf6f2('0x10')]('ShowChatQueue',_0x2fc531,JSON[_0xf6f2('0x12')](_0x213923));_0x3aec2c(_0x213923);})[_0xf6f2('0x18')](function(_0x2ed69c){logger['error'](_0xf6f2('0x23'),_0x2ed69c[_0xf6f2('0x15')],_0x2fc531);_0x3a421f(_0x1863d9[_0xf6f2('0x13')](0x1f4,_0x2ed69c[_0xf6f2('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 7bc0e92..8046db2 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 _0x826a=['update','emit','removeListener','register','length','chatQueue:','save'];(function(_0xb951b2,_0x242620){var _0x5102f0=function(_0x44504f){while(--_0x44504f){_0xb951b2['push'](_0xb951b2['shift']());}};_0x5102f0(++_0x242620);}(_0x826a,0x1aa));var _0xa826=function(_0x1b0888,_0x20ba39){_0x1b0888=_0x1b0888-0x0;var _0x24c3e2=_0x826a[_0x1b0888];return _0x24c3e2;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0xa826('0x0'),'remove',_0xa826('0x1')];function createListener(_0x50c70e,_0x376d53){return function(_0x19ba11){_0x376d53[_0xa826('0x2')](_0x50c70e,_0x19ba11);};}function removeListener(_0x34e1ad,_0x5372ab){return function(){ChatQueueEvents[_0xa826('0x3')](_0x34e1ad,_0x5372ab);};}exports[_0xa826('0x4')]=function(_0x3929d4){for(var _0x34327b=0x0,_0x45154f=events[_0xa826('0x5')];_0x34327b<_0x45154f;_0x34327b++){var _0x4339f9=events[_0x34327b];var _0x14c2ba=createListener(_0xa826('0x6')+_0x4339f9,_0x3929d4);ChatQueueEvents['on'](_0x4339f9,_0x14c2ba);}}; \ No newline at end of file +var _0x5178=['remove','update','register','length','save'];(function(_0x542549,_0x466258){var _0x39693b=function(_0x430e25){while(--_0x430e25){_0x542549['push'](_0x542549['shift']());}};_0x39693b(++_0x466258);}(_0x5178,0x171));var _0x8517=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x5178[_0x6131cd];return _0x47e916;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x8517('0x0'),_0x8517('0x1'),_0x8517('0x2')];function createListener(_0x2dc28f,_0x38d5b3){return function(_0x5e0a44){_0x38d5b3['emit'](_0x2dc28f,_0x5e0a44);};}function removeListener(_0x3ed6a5,_0x221184){return function(){ChatQueueEvents['removeListener'](_0x3ed6a5,_0x221184);};}exports[_0x8517('0x3')]=function(_0x58ed7e){for(var _0x13ba05=0x0,_0x45498e=events[_0x8517('0x4')];_0x13ba05<_0x45498e;_0x13ba05++){var _0x10f918=events[_0x13ba05];var _0x25146d=createListener('chatQueue:'+_0x10f918,_0x58ed7e);ChatQueueEvents['on'](_0x10f918,_0x25146d);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index c756a69..7719bbb 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 _0x814b=['/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x4f8893,_0x20800b){var _0xa460e0=function(_0x4b7a18){while(--_0x4b7a18){_0x4f8893['push'](_0x4f8893['shift']());}};_0xa460e0(++_0x20800b);}(_0x814b,0x1a2));var _0xb814=function(_0x300b26,_0x3a9b67){_0x300b26=_0x300b26-0x0;var _0x5cb1ae=_0x814b[_0x300b26];return _0x5cb1ae;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0xa')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0xa')](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router['get'](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x15')]);router[_0xb814('0x16')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x17')]);router[_0xb814('0x16')](_0xb814('0x12'),auth[_0xb814('0xb')](),controller[_0xb814('0x18')]);router[_0xb814('0x16')](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x19')]);router[_0xb814('0x1a')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x1b')]);router[_0xb814('0x1c')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller['destroy']);router[_0xb814('0x1c')]('/:id/teams',auth[_0xb814('0xb')](),controller[_0xb814('0x1d')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xb814('0x1e')]);module['exports']=router; \ No newline at end of file +var _0xe14b=['/describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','express','Router','../../components/auth/service','./chatQueue.controller','get','isAuthenticated','index'];(function(_0x37d00f,_0x554792){var _0xfece47=function(_0x231088){while(--_0x231088){_0x37d00f['push'](_0x37d00f['shift']());}};_0xfece47(++_0x554792);}(_0xe14b,0x93));var _0xbe14=function(_0x142ed6,_0x3f2137){_0x142ed6=_0x142ed6-0x0;var _0x38f5f6=_0xe14b[_0x142ed6];return _0x38f5f6;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x10')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x10')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x12')]);router[_0xbe14('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x13')]);router[_0xbe14('0x14')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0x16')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x16')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeTeams']);router[_0xbe14('0x16')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);module[_0xbe14('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 360694c..47617ef 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 _0x219a=['exports','STRING','DATE','sequelize'];(function(_0x4079fd,_0x1598a3){var _0x872e1b=function(_0x1b6343){while(--_0x1b6343){_0x4079fd['push'](_0x4079fd['shift']());}};_0x872e1b(++_0x1598a3);}(_0x219a,0x1c7));var _0xa219=function(_0x32a028,_0x16c217){_0x32a028=_0x32a028-0x0;var _0x529aca=_0x219a[_0x32a028];return _0x529aca;};'use strict';var moment=require('moment');var Sequelize=require(_0xa219('0x0'));module[_0xa219('0x1')]={'uniqueid':{'type':Sequelize[_0xa219('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xa219('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xa219('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x50a9=['moment','sequelize','exports','STRING','DATE'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0x50a9,0x11d));var _0x950a=function(_0x411f8f,_0x11a2a2){_0x411f8f=_0x411f8f-0x0;var _0x5954f8=_0x50a9[_0x411f8f];return _0x5954f8;};'use strict';var moment=require(_0x950a('0x0'));var Sequelize=require(_0x950a('0x1'));module[_0x950a('0x2')]={'uniqueid':{'type':Sequelize[_0x950a('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x950a('0x3')]},'joinAt':{'type':Sequelize[_0x950a('0x4')]},'leaveAt':{'type':Sequelize[_0x950a('0x4')]},'acceptAt':{'type':Sequelize[_0x950a('0x4')]},'exitAt':{'type':Sequelize[_0x950a('0x4')]},'reason':{'type':Sequelize[_0x950a('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 43fef0f..6c7ae46 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 _0x326f=['bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','merge','VIRTUAL','options','ChatQueueReport','includeAll','include','rows','catch','show','params','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment'];(function(_0x90be5,_0x5a9d98){var _0x377d8b=function(_0x5d6352){while(--_0x5d6352){_0x90be5['push'](_0x90be5['shift']());}};_0x377d8b(++_0x5a9d98);}(_0x326f,0xd1));var _0xf326=function(_0x3361cb,_0x44fbdd){_0x3361cb=_0x3361cb-0x0;var _0x1c121b=_0x326f[_0x3361cb];return _0x1c121b;};'use strict';var emlformat=require(_0xf326('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf326('0x1'));var rp=require(_0xf326('0x2'));var moment=require(_0xf326('0x3'));var BPromise=require(_0xf326('0x4'));var Mustache=require(_0xf326('0x5'));var util=require(_0xf326('0x6'));var path=require(_0xf326('0x7'));var sox=require(_0xf326('0x8'));var csv=require(_0xf326('0x9'));var ejs=require(_0xf326('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf326('0xb'));var squel=require(_0xf326('0xc'));var crypto=require(_0xf326('0xd'));var jsforce=require(_0xf326('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf326('0xf'));var Redis=require(_0xf326('0x10'));var authService=require(_0xf326('0x11'));var qs=require(_0xf326('0x12'));var as=require(_0xf326('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf326('0x14'))('api');var utils=require(_0xf326('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf326('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3162f9,_0x9ed463){_0x9ed463=_0x9ed463||0xcc;return function(_0x4b3966){if(_0x4b3966){return _0x3162f9[_0xf326('0x17')](_0x9ed463);}return _0x3162f9[_0xf326('0x18')](_0x9ed463)[_0xf326('0x19')]();};}function respondWithResult(_0x17a098,_0x5c8483){_0x5c8483=_0x5c8483||0xc8;return function(_0x45c1b6){if(_0x45c1b6){return _0x17a098['status'](_0x5c8483)['json'](_0x45c1b6);}};}function respondWithFilteredResult(_0xdf21d9,_0x11f6d2){return function(_0x1f2e5a){if(_0x1f2e5a){var _0xa63d1a=typeof _0x11f6d2[_0xf326('0x1a')]===_0xf326('0x1b')&&typeof _0x11f6d2[_0xf326('0x1c')]===_0xf326('0x1b');var _0x5a682a=_0x1f2e5a[_0xf326('0x1d')];var _0x453100=_0xa63d1a?0x0:_0x11f6d2[_0xf326('0x1a')];var _0x31ffb9=_0xa63d1a?_0x1f2e5a[_0xf326('0x1d')]:_0x11f6d2[_0xf326('0x1a')]+_0x11f6d2['limit'];var _0x4a5b6c;if(_0x31ffb9>=_0x5a682a){_0x31ffb9=_0x5a682a;_0x4a5b6c=0xc8;}else{_0x4a5b6c=0xce;}_0xdf21d9['status'](_0x4a5b6c);return _0xdf21d9[_0xf326('0x1e')](_0xf326('0x1f'),_0x453100+'-'+_0x31ffb9+'/'+_0x5a682a)['json'](_0x1f2e5a);}return null;};}function patchUpdates(_0x4cabce){return function(_0x128c68){try{jsonpatch['apply'](_0x128c68,_0x4cabce,!![]);}catch(_0x5b6d3c){return BPromise[_0xf326('0x20')](_0x5b6d3c);}return _0x128c68[_0xf326('0x21')]();};}function saveUpdates(_0x549b46,_0x5aa184){return function(_0x19b8ba){if(_0x19b8ba){return _0x19b8ba[_0xf326('0x22')](_0x549b46)['then'](function(_0x337ed5){return _0x337ed5;});}return null;};}function removeEntity(_0x1b9039,_0x43c53e){return function(_0x295752){if(_0x295752){return _0x295752[_0xf326('0x23')]()[_0xf326('0x24')](function(){_0x1b9039['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f31f6,_0x520d85){return function(_0x1a2c4e){if(!_0x1a2c4e){_0x4f31f6[_0xf326('0x17')](0x194);}return _0x1a2c4e;};}function handleError(_0x1ff2b5,_0x148953){_0x148953=_0x148953||0x1f4;return function(_0x410237){logger['error'](_0x410237[_0xf326('0x25')]);if(_0x410237[_0xf326('0x26')]){delete _0x410237[_0xf326('0x26')];}_0x1ff2b5['status'](_0x148953)[_0xf326('0x27')](_0x410237);};}exports['index']=function(_0x4a9abf,_0x6a8e89){var _0x1ae23a={},_0x2fa28e={},_0x5dbe63={'count':0x0,'rows':[]};var _0xc115d9=_[_0xf326('0x28')](db['ChatQueueReport'][_0xf326('0x29')],function(_0x119ab8){return{'name':_0x119ab8[_0xf326('0x2a')],'type':_0x119ab8[_0xf326('0x2b')][_0xf326('0x2c')]};});_0x2fa28e[_0xf326('0x2d')]=_[_0xf326('0x28')](_0xc115d9,_0xf326('0x26'));_0x2fa28e[_0xf326('0x2e')]=_[_0xf326('0x2f')](_0x4a9abf['query']);_0x2fa28e[_0xf326('0x30')]=_[_0xf326('0x31')](_0x2fa28e[_0xf326('0x2d')],_0x2fa28e['query']);_0x1ae23a[_0xf326('0x32')]=_[_0xf326('0x31')](_0x2fa28e[_0xf326('0x2d')],qs['fields'](_0x4a9abf['query'][_0xf326('0x33')]));_0x1ae23a[_0xf326('0x32')]=_0x1ae23a[_0xf326('0x32')][_0xf326('0x34')]?_0x1ae23a[_0xf326('0x32')]:_0x2fa28e[_0xf326('0x2d')];if(!_0x4a9abf[_0xf326('0x2e')][_0xf326('0x35')]('nolimit')){_0x1ae23a[_0xf326('0x1c')]=qs[_0xf326('0x1c')](_0x4a9abf['query'][_0xf326('0x1c')]);_0x1ae23a['offset']=qs[_0xf326('0x1a')](_0x4a9abf['query']['offset']);}_0x1ae23a[_0xf326('0x36')]=qs['sort'](_0x4a9abf[_0xf326('0x2e')]['sort']);_0x1ae23a[_0xf326('0x37')]=qs[_0xf326('0x30')](_[_0xf326('0x38')](_0x4a9abf['query'],_0x2fa28e[_0xf326('0x30')]),_0xc115d9);if(_0x4a9abf[_0xf326('0x2e')]['filter']){_0x1ae23a[_0xf326('0x37')]=_[_0xf326('0x39')](_0x1ae23a[_0xf326('0x37')],{'$or':_[_0xf326('0x28')](_0xc115d9,function(_0x51076c){if(_0x51076c[_0xf326('0x2b')]!==_0xf326('0x3a')){var _0x1e69b1={};_0x1e69b1[_0x51076c[_0xf326('0x26')]]={'$like':'%'+_0x4a9abf[_0xf326('0x2e')]['filter']+'%'};return _0x1e69b1;}})});}_0x1ae23a=_[_0xf326('0x39')]({},_0x1ae23a,_0x4a9abf[_0xf326('0x3b')]);var _0x5cfb97={'where':_0x1ae23a['where']};return db[_0xf326('0x3c')]['count'](_0x5cfb97)['then'](function(_0x22d462){_0x5dbe63['count']=_0x22d462;if(_0x4a9abf[_0xf326('0x2e')][_0xf326('0x3d')]){_0x1ae23a[_0xf326('0x3e')]=[{'all':!![]}];}return db[_0xf326('0x3c')]['findAll'](_0x1ae23a);})[_0xf326('0x24')](function(_0x45d344){_0x5dbe63[_0xf326('0x3f')]=_0x45d344;return _0x5dbe63;})[_0xf326('0x24')](respondWithFilteredResult(_0x6a8e89,_0x1ae23a))[_0xf326('0x40')](handleError(_0x6a8e89,null));};exports[_0xf326('0x41')]=function(_0x2ad841,_0x224a32){var _0x31283b={'raw':!![],'where':{'id':_0x2ad841[_0xf326('0x42')]['id']}},_0x1227d3={};_0x1227d3[_0xf326('0x2d')]=_['keys'](db[_0xf326('0x3c')][_0xf326('0x29')]);_0x1227d3[_0xf326('0x2e')]=_[_0xf326('0x2f')](_0x2ad841[_0xf326('0x2e')]);_0x1227d3[_0xf326('0x30')]=_['intersection'](_0x1227d3[_0xf326('0x2d')],_0x1227d3[_0xf326('0x2e')]);_0x31283b['attributes']=_[_0xf326('0x31')](_0x1227d3[_0xf326('0x2d')],qs[_0xf326('0x33')](_0x2ad841[_0xf326('0x2e')][_0xf326('0x33')]));_0x31283b['attributes']=_0x31283b['attributes'][_0xf326('0x34')]?_0x31283b[_0xf326('0x32')]:_0x1227d3['model'];if(_0x2ad841['query'][_0xf326('0x3d')]){_0x31283b[_0xf326('0x3e')]=[{'all':!![]}];}_0x31283b=_[_0xf326('0x39')]({},_0x31283b,_0x2ad841['options']);return db[_0xf326('0x3c')][_0xf326('0x43')](_0x31283b)[_0xf326('0x24')](handleEntityNotFound(_0x224a32,null))[_0xf326('0x24')](respondWithResult(_0x224a32,null))[_0xf326('0x40')](handleError(_0x224a32,null));};exports[_0xf326('0x44')]=function(_0x12792c,_0x3b90dc){return db[_0xf326('0x3c')][_0xf326('0x44')](_0x12792c[_0xf326('0x45')],{})[_0xf326('0x24')](respondWithResult(_0x3b90dc,0xc9))[_0xf326('0x40')](handleError(_0x3b90dc,null));};exports[_0xf326('0x22')]=function(_0xeac1a1,_0x59f9a7){if(_0xeac1a1[_0xf326('0x45')]['id']){delete _0xeac1a1[_0xf326('0x45')]['id'];}return db[_0xf326('0x3c')][_0xf326('0x43')]({'where':{'id':_0xeac1a1['params']['id']}})[_0xf326('0x24')](handleEntityNotFound(_0x59f9a7,null))[_0xf326('0x24')](saveUpdates(_0xeac1a1[_0xf326('0x45')],null))[_0xf326('0x24')](respondWithResult(_0x59f9a7,null))['catch'](handleError(_0x59f9a7,null));};exports[_0xf326('0x23')]=function(_0x1967ab,_0x145a77){return db[_0xf326('0x3c')][_0xf326('0x43')]({'where':{'id':_0x1967ab['params']['id']}})['then'](handleEntityNotFound(_0x145a77,null))[_0xf326('0x24')](removeEntity(_0x145a77,null))[_0xf326('0x40')](handleError(_0x145a77,null));};exports[_0xf326('0x46')]=function(_0x4cb25b,_0x102fba){return db[_0xf326('0x3c')][_0xf326('0x46')]()['then'](respondWithResult(_0x102fba,null))['catch'](handleError(_0x102fba,null));}; \ No newline at end of file +var _0x4351=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','status','end','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','params','fields','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis'];(function(_0x190f52,_0x2927eb){var _0x4dc4c7=function(_0xaa6bf){while(--_0xaa6bf){_0x190f52['push'](_0x190f52['shift']());}};_0x4dc4c7(++_0x2927eb);}(_0x4351,0x1b5));var _0x1435=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x4351[_0x4fc9e6];return _0x551d28;};'use strict';var emlformat=require(_0x1435('0x0'));var rimraf=require(_0x1435('0x1'));var zipdir=require(_0x1435('0x2'));var jsonpatch=require(_0x1435('0x3'));var rp=require(_0x1435('0x4'));var moment=require(_0x1435('0x5'));var BPromise=require(_0x1435('0x6'));var Mustache=require(_0x1435('0x7'));var util=require(_0x1435('0x8'));var path=require(_0x1435('0x9'));var sox=require(_0x1435('0xa'));var csv=require(_0x1435('0xb'));var ejs=require(_0x1435('0xc'));var fs=require('fs');var fs_extra=require(_0x1435('0xd'));var _=require(_0x1435('0xe'));var squel=require('squel');var crypto=require(_0x1435('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1435('0xb'));var querystring=require(_0x1435('0x10'));var Papa=require(_0x1435('0x11'));var Redis=require(_0x1435('0x12'));var authService=require(_0x1435('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1435('0x14'));var hardwareService=require(_0x1435('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x1435('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x1435('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1632ac,_0x5137c0){_0x5137c0=_0x5137c0||0xcc;return function(_0x47daf0){if(_0x47daf0){return _0x1632ac['sendStatus'](_0x5137c0);}return _0x1632ac[_0x1435('0x18')](_0x5137c0)[_0x1435('0x19')]();};}function respondWithResult(_0x243669,_0x4a80bc){_0x4a80bc=_0x4a80bc||0xc8;return function(_0x4a52ba){if(_0x4a52ba){return _0x243669[_0x1435('0x18')](_0x4a80bc)['json'](_0x4a52ba);}};}function respondWithFilteredResult(_0x39405c,_0x3f0b08){return function(_0x1f5fc3){if(_0x1f5fc3){var _0x202744=typeof _0x3f0b08[_0x1435('0x1a')]===_0x1435('0x1b')&&typeof _0x3f0b08[_0x1435('0x1c')]===_0x1435('0x1b');var _0x2c1a6b=_0x1f5fc3[_0x1435('0x1d')];var _0x430367=_0x202744?0x0:_0x3f0b08[_0x1435('0x1a')];var _0x68f503=_0x202744?_0x1f5fc3[_0x1435('0x1d')]:_0x3f0b08[_0x1435('0x1a')]+_0x3f0b08['limit'];var _0x26da28;if(_0x68f503>=_0x2c1a6b){_0x68f503=_0x2c1a6b;_0x26da28=0xc8;}else{_0x26da28=0xce;}_0x39405c[_0x1435('0x18')](_0x26da28);return _0x39405c['set'](_0x1435('0x1e'),_0x430367+'-'+_0x68f503+'/'+_0x2c1a6b)['json'](_0x1f5fc3);}return null;};}function patchUpdates(_0x15d7c0){return function(_0x2a72aa){try{jsonpatch[_0x1435('0x1f')](_0x2a72aa,_0x15d7c0,!![]);}catch(_0x28bc0a){return BPromise[_0x1435('0x20')](_0x28bc0a);}return _0x2a72aa[_0x1435('0x21')]();};}function saveUpdates(_0x543209,_0x17ed76){return function(_0x437f61){if(_0x437f61){return _0x437f61[_0x1435('0x22')](_0x543209)[_0x1435('0x23')](function(_0x57a94f){return _0x57a94f;});}return null;};}function removeEntity(_0x1b6259,_0x302831){return function(_0xab77fa){if(_0xab77fa){return _0xab77fa[_0x1435('0x24')]()[_0x1435('0x23')](function(){_0x1b6259[_0x1435('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x523792,_0x22241f){return function(_0x2b4828){if(!_0x2b4828){_0x523792[_0x1435('0x25')](0x194);}return _0x2b4828;};}function handleError(_0x4f86f0,_0x42599d){_0x42599d=_0x42599d||0x1f4;return function(_0x25cf29){logger[_0x1435('0x26')](_0x25cf29[_0x1435('0x27')]);if(_0x25cf29[_0x1435('0x28')]){delete _0x25cf29['name'];}_0x4f86f0[_0x1435('0x18')](_0x42599d)[_0x1435('0x29')](_0x25cf29);};}exports[_0x1435('0x2a')]=function(_0x453d68,_0x1c3b7e){var _0x108c25={},_0x2e0e72={},_0x57a02f={'count':0x0,'rows':[]};var _0x31ab10=_[_0x1435('0x2b')](db[_0x1435('0x2c')][_0x1435('0x2d')],function(_0x297edf){return{'name':_0x297edf['fieldName'],'type':_0x297edf[_0x1435('0x2e')][_0x1435('0x2f')]};});_0x2e0e72[_0x1435('0x30')]=_[_0x1435('0x2b')](_0x31ab10,'name');_0x2e0e72[_0x1435('0x31')]=_[_0x1435('0x32')](_0x453d68['query']);_0x2e0e72[_0x1435('0x33')]=_['intersection'](_0x2e0e72[_0x1435('0x30')],_0x2e0e72[_0x1435('0x31')]);_0x108c25['attributes']=_[_0x1435('0x34')](_0x2e0e72[_0x1435('0x30')],qs['fields'](_0x453d68['query']['fields']));_0x108c25[_0x1435('0x35')]=_0x108c25['attributes'][_0x1435('0x36')]?_0x108c25['attributes']:_0x2e0e72[_0x1435('0x30')];if(!_0x453d68['query'][_0x1435('0x37')](_0x1435('0x38'))){_0x108c25[_0x1435('0x1c')]=qs[_0x1435('0x1c')](_0x453d68[_0x1435('0x31')][_0x1435('0x1c')]);_0x108c25['offset']=qs[_0x1435('0x1a')](_0x453d68[_0x1435('0x31')][_0x1435('0x1a')]);}_0x108c25[_0x1435('0x39')]=qs[_0x1435('0x3a')](_0x453d68['query'][_0x1435('0x3a')]);_0x108c25['where']=qs[_0x1435('0x33')](_[_0x1435('0x3b')](_0x453d68['query'],_0x2e0e72[_0x1435('0x33')]),_0x31ab10);if(_0x453d68[_0x1435('0x31')][_0x1435('0x3c')]){_0x108c25[_0x1435('0x3d')]=_[_0x1435('0x3e')](_0x108c25[_0x1435('0x3d')],{'$or':_[_0x1435('0x2b')](_0x31ab10,function(_0x176dbd){if(_0x176dbd[_0x1435('0x2e')]!==_0x1435('0x3f')){var _0x3ecac4={};_0x3ecac4[_0x176dbd[_0x1435('0x28')]]={'$like':'%'+_0x453d68['query'][_0x1435('0x3c')]+'%'};return _0x3ecac4;}})});}_0x108c25=_['merge']({},_0x108c25,_0x453d68[_0x1435('0x40')]);var _0x5b24ab={'where':_0x108c25[_0x1435('0x3d')]};return db['ChatQueueReport'][_0x1435('0x1d')](_0x5b24ab)['then'](function(_0x36bc74){_0x57a02f[_0x1435('0x1d')]=_0x36bc74;if(_0x453d68[_0x1435('0x31')]['includeAll']){_0x108c25[_0x1435('0x41')]=[{'all':!![]}];}return db[_0x1435('0x2c')][_0x1435('0x42')](_0x108c25);})['then'](function(_0x1d6417){_0x57a02f[_0x1435('0x43')]=_0x1d6417;return _0x57a02f;})['then'](respondWithFilteredResult(_0x1c3b7e,_0x108c25))['catch'](handleError(_0x1c3b7e,null));};exports[_0x1435('0x44')]=function(_0x40e9eb,_0x2dd1f5){var _0x5986f8={'raw':!![],'where':{'id':_0x40e9eb[_0x1435('0x45')]['id']}},_0x4e5d0a={};_0x4e5d0a['model']=_[_0x1435('0x32')](db['ChatQueueReport'][_0x1435('0x2d')]);_0x4e5d0a['query']=_[_0x1435('0x32')](_0x40e9eb['query']);_0x4e5d0a[_0x1435('0x33')]=_['intersection'](_0x4e5d0a[_0x1435('0x30')],_0x4e5d0a[_0x1435('0x31')]);_0x5986f8['attributes']=_[_0x1435('0x34')](_0x4e5d0a['model'],qs[_0x1435('0x46')](_0x40e9eb[_0x1435('0x31')][_0x1435('0x46')]));_0x5986f8['attributes']=_0x5986f8[_0x1435('0x35')][_0x1435('0x36')]?_0x5986f8['attributes']:_0x4e5d0a[_0x1435('0x30')];if(_0x40e9eb[_0x1435('0x31')]['includeAll']){_0x5986f8[_0x1435('0x41')]=[{'all':!![]}];}_0x5986f8=_[_0x1435('0x3e')]({},_0x5986f8,_0x40e9eb['options']);return db[_0x1435('0x2c')][_0x1435('0x47')](_0x5986f8)['then'](handleEntityNotFound(_0x2dd1f5,null))[_0x1435('0x23')](respondWithResult(_0x2dd1f5,null))[_0x1435('0x48')](handleError(_0x2dd1f5,null));};exports[_0x1435('0x49')]=function(_0x4b254e,_0x57b5d4){return db[_0x1435('0x2c')]['create'](_0x4b254e[_0x1435('0x4a')],{})['then'](respondWithResult(_0x57b5d4,0xc9))[_0x1435('0x48')](handleError(_0x57b5d4,null));};exports[_0x1435('0x22')]=function(_0x1f8899,_0x148862){if(_0x1f8899[_0x1435('0x4a')]['id']){delete _0x1f8899[_0x1435('0x4a')]['id'];}return db[_0x1435('0x2c')]['find']({'where':{'id':_0x1f8899[_0x1435('0x45')]['id']}})[_0x1435('0x23')](handleEntityNotFound(_0x148862,null))[_0x1435('0x23')](saveUpdates(_0x1f8899['body'],null))[_0x1435('0x23')](respondWithResult(_0x148862,null))[_0x1435('0x48')](handleError(_0x148862,null));};exports[_0x1435('0x24')]=function(_0x24c5d0,_0x118c06){return db[_0x1435('0x2c')][_0x1435('0x47')]({'where':{'id':_0x24c5d0[_0x1435('0x45')]['id']}})['then'](handleEntityNotFound(_0x118c06,null))[_0x1435('0x23')](removeEntity(_0x118c06,null))[_0x1435('0x48')](handleError(_0x118c06,null));};exports[_0x1435('0x4b')]=function(_0x4244e1,_0x5953ce){return db['ChatQueueReport'][_0x1435('0x4b')]()[_0x1435('0x23')](respondWithResult(_0x5953ce,null))[_0x1435('0x48')](handleError(_0x5953ce,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index a95536f..efea479 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 _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util'];(function(_0x3a7e42,_0x58e47d){var _0x7122b7=function(_0x42acab){while(--_0x42acab){_0x3a7e42['push'](_0x3a7e42['shift']());}};_0x7122b7(++_0x58e47d);}(_0xe706,0xa3));var _0x6e70=function(_0x28ee74,_0x289441){_0x28ee74=_0x28ee74-0x0;var _0x6cc80c=_0xe706[_0x28ee74];return _0x6cc80c;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util'];(function(_0x5dc123,_0x1a7217){var _0xd98e38=function(_0x1332aa){while(--_0x1332aa){_0x5dc123['push'](_0x5dc123['shift']());}};_0xd98e38(++_0x1a7217);}(_0xe706,0xa3));var _0x6e70=function(_0x6d394d,_0x185b80){_0x6d394d=_0x6d394d-0x0;var _0x1f0621=_0xe706[_0x6d394d];return _0x1f0621;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 3bf76f3..23f4b5d 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 _0xa5db=['http','request','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateChatQueueReport','create','options','raw','then','UpdateChatQueueReport','ChatQueueReport','update','body','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x34b821,_0x504e55){var _0x5e00a0=function(_0x242892){while(--_0x242892){_0x34b821['push'](_0x34b821['shift']());}};_0x5e00a0(++_0x504e55);}(_0xa5db,0x7e));var _0xba5d=function(_0x2a51c9,_0x407762){_0x2a51c9=_0x2a51c9-0x0;var _0x569011=_0xa5db[_0x2a51c9];return _0x569011;};'use strict';var _=require(_0xba5d('0x0'));var util=require(_0xba5d('0x1'));var moment=require(_0xba5d('0x2'));var BPromise=require('bluebird');var rs=require(_0xba5d('0x3'));var fs=require('fs');var Redis=require(_0xba5d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xba5d('0x5'))(_0xba5d('0x6'));var config=require(_0xba5d('0x7'));var jayson=require(_0xba5d('0x8'));var client=jayson[_0xba5d('0x9')][_0xba5d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1046df,_0x5b650c,_0x4a7d12){return new BPromise(function(_0x19bca3,_0x1d27bc){return client[_0xba5d('0xb')](_0x1046df,_0x4a7d12)['then'](function(_0x4a8036){logger[_0xba5d('0xc')](_0xba5d('0xd'),_0x5b650c,_0xba5d('0xe'));logger[_0xba5d('0xf')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x5b650c,_0xba5d('0xe'),JSON[_0xba5d('0x10')](_0x4a8036));if(_0x4a8036[_0xba5d('0x11')]){if(_0x4a8036[_0xba5d('0x11')][_0xba5d('0x12')]===0x1f4){logger[_0xba5d('0x11')](_0xba5d('0xd'),_0x5b650c,_0x4a8036[_0xba5d('0x11')][_0xba5d('0x13')]);return _0x1d27bc(_0x4a8036[_0xba5d('0x11')][_0xba5d('0x13')]);}logger[_0xba5d('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x5b650c,_0x4a8036[_0xba5d('0x11')]['message']);return _0x19bca3(_0x4a8036[_0xba5d('0x11')][_0xba5d('0x13')]);}else{logger[_0xba5d('0xc')](_0xba5d('0xd'),_0x5b650c,_0xba5d('0xe'));_0x19bca3(_0x4a8036[_0xba5d('0x14')][_0xba5d('0x13')]);}})[_0xba5d('0x15')](function(_0x265934){logger[_0xba5d('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x5b650c,_0x265934);_0x1d27bc(_0x265934);});});}exports[_0xba5d('0x16')]=function(_0xe3cff2){var _0x1ebcc6=this;return new Promise(function(_0x5b62f2,_0xdda906){return db['ChatQueueReport'][_0xba5d('0x17')](_0xe3cff2['body'],{'raw':_0xe3cff2[_0xba5d('0x18')]?_0xe3cff2[_0xba5d('0x18')][_0xba5d('0x19')]===undefined?!![]:![]:!![]})[_0xba5d('0x1a')](function(_0x13fc98){logger['info'](_0xba5d('0x16'),_0xe3cff2);logger['debug'](_0xba5d('0x16'),_0xe3cff2,JSON[_0xba5d('0x10')](_0x13fc98));_0x5b62f2(_0x13fc98);})['catch'](function(_0x5a879c){logger[_0xba5d('0x11')]('CreateChatQueueReport',_0x5a879c[_0xba5d('0x13')],_0xe3cff2);_0xdda906(_0x1ebcc6['error'](0x1f4,_0x5a879c[_0xba5d('0x13')]));});});};exports[_0xba5d('0x1b')]=function(_0x416aee){var _0x550dea=this;return new Promise(function(_0x8f06f1,_0x2ed45f){return db[_0xba5d('0x1c')][_0xba5d('0x1d')](_0x416aee[_0xba5d('0x1e')],{'raw':_0x416aee[_0xba5d('0x18')]?_0x416aee['options'][_0xba5d('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x416aee[_0xba5d('0x18')]?_0x416aee[_0xba5d('0x18')][_0xba5d('0x1f')]||null:null,'attributes':_0x416aee[_0xba5d('0x18')]?_0x416aee[_0xba5d('0x18')][_0xba5d('0x20')]||null:null,'limit':_0x416aee[_0xba5d('0x18')]?_0x416aee[_0xba5d('0x18')][_0xba5d('0x21')]||null:null})[_0xba5d('0x1a')](function(_0x43e203){logger[_0xba5d('0xc')](_0xba5d('0x1b'),_0x416aee);logger['debug']('UpdateChatQueueReport',_0x416aee,JSON[_0xba5d('0x10')](_0x43e203));_0x8f06f1(_0x43e203);})['catch'](function(_0x4b682f){logger[_0xba5d('0x11')](_0xba5d('0x1b'),_0x4b682f[_0xba5d('0x13')],_0x416aee);_0x2ed45f(_0x550dea[_0xba5d('0x11')](0x1f4,_0x4b682f['message']));});});}; \ No newline at end of file +var _0xf097=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','options','raw','then','UpdateChatQueueReport','update','body','where','attributes','limit','lodash','util','moment'];(function(_0x54c10d,_0x2f2251){var _0x1fa703=function(_0x508eb4){while(--_0x508eb4){_0x54c10d['push'](_0x54c10d['shift']());}};_0x1fa703(++_0x2f2251);}(_0xf097,0x66));var _0x7f09=function(_0x541e51,_0x3b4a2c){_0x541e51=_0x541e51-0x0;var _0x4cc19e=_0xf097[_0x541e51];return _0x4cc19e;};'use strict';var _=require(_0x7f09('0x0'));var util=require(_0x7f09('0x1'));var moment=require(_0x7f09('0x2'));var BPromise=require(_0x7f09('0x3'));var rs=require(_0x7f09('0x4'));var fs=require('fs');var Redis=require(_0x7f09('0x5'));var db=require(_0x7f09('0x6'))['db'];var utils=require(_0x7f09('0x7'));var logger=require(_0x7f09('0x8'))(_0x7f09('0x9'));var config=require('../../config/environment');var jayson=require(_0x7f09('0xa'));var client=jayson[_0x7f09('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x364e42,_0x6d7627,_0x1a60cf){return new BPromise(function(_0xebfeae,_0x3336ba){return client[_0x7f09('0xc')](_0x364e42,_0x1a60cf)['then'](function(_0x4f845f){logger[_0x7f09('0xd')](_0x7f09('0xe'),_0x6d7627,'request\x20sent');logger[_0x7f09('0xf')](_0x7f09('0x10'),_0x6d7627,_0x7f09('0x11'),JSON[_0x7f09('0x12')](_0x4f845f));if(_0x4f845f[_0x7f09('0x13')]){if(_0x4f845f[_0x7f09('0x13')]['code']===0x1f4){logger[_0x7f09('0x13')](_0x7f09('0xe'),_0x6d7627,_0x4f845f[_0x7f09('0x13')][_0x7f09('0x14')]);return _0x3336ba(_0x4f845f['error']['message']);}logger[_0x7f09('0x13')](_0x7f09('0xe'),_0x6d7627,_0x4f845f['error']['message']);return _0xebfeae(_0x4f845f[_0x7f09('0x13')][_0x7f09('0x14')]);}else{logger[_0x7f09('0xd')]('ChatQueueReport,\x20%s,\x20%s',_0x6d7627,_0x7f09('0x11'));_0xebfeae(_0x4f845f[_0x7f09('0x15')][_0x7f09('0x14')]);}})[_0x7f09('0x16')](function(_0x32b561){logger[_0x7f09('0x13')](_0x7f09('0xe'),_0x6d7627,_0x32b561);_0x3336ba(_0x32b561);});});}exports[_0x7f09('0x17')]=function(_0x25ba41){var _0x420401=this;return new Promise(function(_0x4a4bcb,_0x1b5427){return db[_0x7f09('0x18')][_0x7f09('0x19')](_0x25ba41['body'],{'raw':_0x25ba41[_0x7f09('0x1a')]?_0x25ba41[_0x7f09('0x1a')][_0x7f09('0x1b')]===undefined?!![]:![]:!![]})[_0x7f09('0x1c')](function(_0x5e59e5){logger[_0x7f09('0xd')]('CreateChatQueueReport',_0x25ba41);logger['debug'](_0x7f09('0x17'),_0x25ba41,JSON[_0x7f09('0x12')](_0x5e59e5));_0x4a4bcb(_0x5e59e5);})[_0x7f09('0x16')](function(_0x916963){logger[_0x7f09('0x13')](_0x7f09('0x17'),_0x916963[_0x7f09('0x14')],_0x25ba41);_0x1b5427(_0x420401[_0x7f09('0x13')](0x1f4,_0x916963[_0x7f09('0x14')]));});});};exports[_0x7f09('0x1d')]=function(_0x225299){var _0x101640=this;return new Promise(function(_0x5bfd73,_0x2c40cf){return db[_0x7f09('0x18')][_0x7f09('0x1e')](_0x225299[_0x7f09('0x1f')],{'raw':_0x225299[_0x7f09('0x1a')]?_0x225299['options'][_0x7f09('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225299[_0x7f09('0x1a')]?_0x225299[_0x7f09('0x1a')][_0x7f09('0x20')]||null:null,'attributes':_0x225299['options']?_0x225299[_0x7f09('0x1a')][_0x7f09('0x21')]||null:null,'limit':_0x225299[_0x7f09('0x1a')]?_0x225299['options'][_0x7f09('0x22')]||null:null})[_0x7f09('0x1c')](function(_0x4d2d93){logger[_0x7f09('0xd')](_0x7f09('0x1d'),_0x225299);logger[_0x7f09('0xf')](_0x7f09('0x1d'),_0x225299,JSON[_0x7f09('0x12')](_0x4d2d93));_0x5bfd73(_0x4d2d93);})[_0x7f09('0x16')](function(_0x2af662){logger[_0x7f09('0x13')](_0x7f09('0x1d'),_0x2af662[_0x7f09('0x14')],_0x225299);_0x2c40cf(_0x101640['error'](0x1f4,_0x2af662[_0x7f09('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index a823cfb..7d19663 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 _0x1499=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','connect-timeout','Router'];(function(_0x5d5a51,_0x54d479){var _0x1deb2b=function(_0x1276da){while(--_0x1276da){_0x5d5a51['push'](_0x5d5a51['shift']());}};_0x1deb2b(++_0x54d479);}(_0x1499,0x8f));var _0x9149=function(_0x1d5252,_0x4d485b){_0x1d5252=_0x1d5252-0x0;var _0xf3a49e=_0x1499[_0x1d5252];return _0xf3a49e;};'use strict';var multer=require(_0x9149('0x0'));var util=require(_0x9149('0x1'));var path=require('path');var timeout=require(_0x9149('0x2'));var express=require('express');var router=express[_0x9149('0x3')]();var fs_extra=require(_0x9149('0x4'));var auth=require(_0x9149('0x5'));var interaction=require(_0x9149('0x6'));var config=require(_0x9149('0x7'));var controller=require('./chatQueueReport.controller');router[_0x9149('0x8')]('/',auth[_0x9149('0x9')](),controller[_0x9149('0xa')]);router[_0x9149('0x8')](_0x9149('0xb'),auth['isAuthenticated'](),controller[_0x9149('0xc')]);router[_0x9149('0x8')](_0x9149('0xd'),auth[_0x9149('0x9')](),controller[_0x9149('0xe')]);router[_0x9149('0xf')]('/',auth[_0x9149('0x9')](),controller['create']);router[_0x9149('0x10')]('/:id',auth[_0x9149('0x9')](),controller[_0x9149('0x11')]);router[_0x9149('0x12')](_0x9149('0xd'),auth[_0x9149('0x9')](),controller[_0x9149('0x13')]);module[_0x9149('0x14')]=router; \ No newline at end of file +var _0x7571=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./chatQueueReport.controller','isAuthenticated','get','/describe','show','post'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x7571,0x1a8));var _0x1757=function(_0x267c41,_0x244bd2){_0x267c41=_0x267c41-0x0;var _0x160aaf=_0x7571[_0x267c41];return _0x160aaf;};'use strict';var multer=require(_0x1757('0x0'));var util=require(_0x1757('0x1'));var path=require(_0x1757('0x2'));var timeout=require(_0x1757('0x3'));var express=require(_0x1757('0x4'));var router=express['Router']();var fs_extra=require(_0x1757('0x5'));var auth=require(_0x1757('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1757('0x7'));router['get']('/',auth[_0x1757('0x8')](),controller['index']);router[_0x1757('0x9')](_0x1757('0xa'),auth[_0x1757('0x8')](),controller['describe']);router[_0x1757('0x9')]('/:id',auth[_0x1757('0x8')](),controller[_0x1757('0xb')]);router[_0x1757('0xc')]('/',auth['isAuthenticated'](),controller[_0x1757('0xd')]);router[_0x1757('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x1757('0xf')]);router[_0x1757('0x10')]('/:id',auth[_0x1757('0x8')](),controller[_0x1757('0x11')]);module[_0x1757('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 c0e9a28..0356e48 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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x31a415,_0x342648){var _0x159ccb=function(_0x2fb50b){while(--_0x2fb50b){_0x31a415['push'](_0x31a415['shift']());}};_0x159ccb(++_0x342648);}(_0x008c,0x188));var _0xc008=function(_0x5005ba,_0x423ed1){_0x5005ba=_0x5005ba-0x0;var _0x21278c=_0x008c[_0x5005ba];return _0x21278c;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file +var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x1004fa,_0x21747f){var _0x4b53f2=function(_0x5120cb){while(--_0x5120cb){_0x1004fa['push'](_0x1004fa['shift']());}};_0x4b53f2(++_0x21747f);}(_0x70e0,0x17b));var _0x070e=function(_0x309995,_0xa5e701){_0x309995=_0x309995-0x0;var _0x1453f7=_0x70e0[_0x309995];return _0x1453f7;};'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/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 526d1fa..b207343 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 _0xc5c9=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','end','status','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','map','ChatTransferReport','rawAttributes','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','body','find','describe','eml-format','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x4b19a5,_0x1d6119){var _0x2e663d=function(_0x5e665d){while(--_0x5e665d){_0x4b19a5['push'](_0x4b19a5['shift']());}};_0x2e663d(++_0x1d6119);}(_0xc5c9,0x11d));var _0x9c5c=function(_0x38e570,_0xf78d4f){_0x38e570=_0x38e570-0x0;var _0x58e83f=_0xc5c9[_0x38e570];return _0x58e83f;};'use strict';var emlformat=require(_0x9c5c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9c5c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9c5c('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x9c5c('0x3'));var util=require(_0x9c5c('0x4'));var path=require(_0x9c5c('0x5'));var sox=require(_0x9c5c('0x6'));var csv=require(_0x9c5c('0x7'));var ejs=require(_0x9c5c('0x8'));var fs=require('fs');var fs_extra=require(_0x9c5c('0x9'));var _=require(_0x9c5c('0xa'));var squel=require(_0x9c5c('0xb'));var crypto=require(_0x9c5c('0xc'));var jsforce=require(_0x9c5c('0xd'));var deskjs=require(_0x9c5c('0xe'));var toCsv=require(_0x9c5c('0x7'));var querystring=require(_0x9c5c('0xf'));var Papa=require('papaparse');var Redis=require(_0x9c5c('0x10'));var authService=require(_0x9c5c('0x11'));var qs=require(_0x9c5c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9c5c('0x13'));var logger=require(_0x9c5c('0x14'))('api');var utils=require(_0x9c5c('0x15'));var config=require(_0x9c5c('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28c860,_0x169806){_0x169806=_0x169806||0xcc;return function(_0xcfbd7d){if(_0xcfbd7d){return _0x28c860[_0x9c5c('0x17')](_0x169806);}return _0x28c860['status'](_0x169806)[_0x9c5c('0x18')]();};}function respondWithResult(_0x3537a5,_0x511f86){_0x511f86=_0x511f86||0xc8;return function(_0x157d2d){if(_0x157d2d){return _0x3537a5[_0x9c5c('0x19')](_0x511f86)[_0x9c5c('0x1a')](_0x157d2d);}};}function respondWithFilteredResult(_0x1f917d,_0x5590e0){return function(_0x2887bf){if(_0x2887bf){var _0x5aefe8=typeof _0x5590e0['offset']===_0x9c5c('0x1b')&&typeof _0x5590e0['limit']===_0x9c5c('0x1b');var _0x28abd6=_0x2887bf[_0x9c5c('0x1c')];var _0x13e021=_0x5aefe8?0x0:_0x5590e0[_0x9c5c('0x1d')];var _0x4b600c=_0x5aefe8?_0x2887bf[_0x9c5c('0x1c')]:_0x5590e0['offset']+_0x5590e0['limit'];var _0x5c4140;if(_0x4b600c>=_0x28abd6){_0x4b600c=_0x28abd6;_0x5c4140=0xc8;}else{_0x5c4140=0xce;}_0x1f917d['status'](_0x5c4140);return _0x1f917d[_0x9c5c('0x1e')](_0x9c5c('0x1f'),_0x13e021+'-'+_0x4b600c+'/'+_0x28abd6)[_0x9c5c('0x1a')](_0x2887bf);}return null;};}function patchUpdates(_0x4704bf){return function(_0x5f3bce){try{jsonpatch[_0x9c5c('0x20')](_0x5f3bce,_0x4704bf,!![]);}catch(_0x2e94eb){return BPromise[_0x9c5c('0x21')](_0x2e94eb);}return _0x5f3bce[_0x9c5c('0x22')]();};}function saveUpdates(_0xca2059,_0x4b0b68){return function(_0x5690d5){if(_0x5690d5){return _0x5690d5[_0x9c5c('0x23')](_0xca2059)[_0x9c5c('0x24')](function(_0x2fca61){return _0x2fca61;});}return null;};}function removeEntity(_0x134e65,_0x143020){return function(_0x26c76e){if(_0x26c76e){return _0x26c76e[_0x9c5c('0x25')]()['then'](function(){_0x134e65[_0x9c5c('0x19')](0xcc)[_0x9c5c('0x18')]();});}};}function handleEntityNotFound(_0x5922d6,_0x5768e9){return function(_0x1eca95){if(!_0x1eca95){_0x5922d6[_0x9c5c('0x17')](0x194);}return _0x1eca95;};}function handleError(_0x5439c1,_0x2417ae){_0x2417ae=_0x2417ae||0x1f4;return function(_0x34352c){logger[_0x9c5c('0x26')](_0x34352c[_0x9c5c('0x27')]);if(_0x34352c['name']){delete _0x34352c['name'];}_0x5439c1[_0x9c5c('0x19')](_0x2417ae)[_0x9c5c('0x28')](_0x34352c);};}exports['index']=function(_0x30c360,_0x17d44f){var _0x2cae75={},_0x12dfb1={},_0x1e7e25={'count':0x0,'rows':[]};var _0x4cd6c1=_[_0x9c5c('0x29')](db[_0x9c5c('0x2a')][_0x9c5c('0x2b')],function(_0x39f8ef){return{'name':_0x39f8ef['fieldName'],'type':_0x39f8ef['type'][_0x9c5c('0x2c')]};});_0x12dfb1[_0x9c5c('0x2d')]=_[_0x9c5c('0x29')](_0x4cd6c1,_0x9c5c('0x2e'));_0x12dfb1[_0x9c5c('0x2f')]=_[_0x9c5c('0x30')](_0x30c360['query']);_0x12dfb1[_0x9c5c('0x31')]=_[_0x9c5c('0x32')](_0x12dfb1[_0x9c5c('0x2d')],_0x12dfb1['query']);_0x2cae75[_0x9c5c('0x33')]=_[_0x9c5c('0x32')](_0x12dfb1[_0x9c5c('0x2d')],qs['fields'](_0x30c360['query'][_0x9c5c('0x34')]));_0x2cae75[_0x9c5c('0x33')]=_0x2cae75[_0x9c5c('0x33')][_0x9c5c('0x35')]?_0x2cae75[_0x9c5c('0x33')]:_0x12dfb1[_0x9c5c('0x2d')];if(!_0x30c360[_0x9c5c('0x2f')][_0x9c5c('0x36')](_0x9c5c('0x37'))){_0x2cae75[_0x9c5c('0x38')]=qs['limit'](_0x30c360[_0x9c5c('0x2f')][_0x9c5c('0x38')]);_0x2cae75[_0x9c5c('0x1d')]=qs[_0x9c5c('0x1d')](_0x30c360['query'][_0x9c5c('0x1d')]);}_0x2cae75[_0x9c5c('0x39')]=qs['sort'](_0x30c360[_0x9c5c('0x2f')][_0x9c5c('0x3a')]);_0x2cae75[_0x9c5c('0x3b')]=qs[_0x9c5c('0x31')](_[_0x9c5c('0x3c')](_0x30c360[_0x9c5c('0x2f')],_0x12dfb1[_0x9c5c('0x31')]),_0x4cd6c1);if(_0x30c360[_0x9c5c('0x2f')][_0x9c5c('0x3d')]){_0x2cae75[_0x9c5c('0x3b')]=_[_0x9c5c('0x3e')](_0x2cae75[_0x9c5c('0x3b')],{'$or':_[_0x9c5c('0x29')](_0x4cd6c1,function(_0x4d2aee){if(_0x4d2aee['type']!==_0x9c5c('0x3f')){var _0x40b833={};_0x40b833[_0x4d2aee['name']]={'$like':'%'+_0x30c360['query'][_0x9c5c('0x3d')]+'%'};return _0x40b833;}})});}_0x2cae75=_[_0x9c5c('0x3e')]({},_0x2cae75,_0x30c360[_0x9c5c('0x40')]);var _0x384cb0={'where':_0x2cae75[_0x9c5c('0x3b')]};return db[_0x9c5c('0x2a')][_0x9c5c('0x1c')](_0x384cb0)['then'](function(_0x5d781c){_0x1e7e25['count']=_0x5d781c;if(_0x30c360[_0x9c5c('0x2f')][_0x9c5c('0x41')]){_0x2cae75[_0x9c5c('0x42')]=[{'all':!![]}];}return db[_0x9c5c('0x2a')][_0x9c5c('0x43')](_0x2cae75);})[_0x9c5c('0x24')](function(_0x264300){_0x1e7e25['rows']=_0x264300;return _0x1e7e25;})[_0x9c5c('0x24')](respondWithFilteredResult(_0x17d44f,_0x2cae75))[_0x9c5c('0x44')](handleError(_0x17d44f,null));};exports[_0x9c5c('0x45')]=function(_0x1283b5,_0x187504){var _0xe90970={'raw':!![],'where':{'id':_0x1283b5[_0x9c5c('0x46')]['id']}},_0xfd5ffc={};_0xfd5ffc[_0x9c5c('0x2d')]=_[_0x9c5c('0x30')](db[_0x9c5c('0x2a')][_0x9c5c('0x2b')]);_0xfd5ffc['query']=_[_0x9c5c('0x30')](_0x1283b5['query']);_0xfd5ffc[_0x9c5c('0x31')]=_[_0x9c5c('0x32')](_0xfd5ffc[_0x9c5c('0x2d')],_0xfd5ffc[_0x9c5c('0x2f')]);_0xe90970['attributes']=_[_0x9c5c('0x32')](_0xfd5ffc[_0x9c5c('0x2d')],qs[_0x9c5c('0x34')](_0x1283b5['query'][_0x9c5c('0x34')]));_0xe90970[_0x9c5c('0x33')]=_0xe90970[_0x9c5c('0x33')][_0x9c5c('0x35')]?_0xe90970['attributes']:_0xfd5ffc[_0x9c5c('0x2d')];if(_0x1283b5[_0x9c5c('0x2f')]['includeAll']){_0xe90970[_0x9c5c('0x42')]=[{'all':!![]}];}_0xe90970=_[_0x9c5c('0x3e')]({},_0xe90970,_0x1283b5['options']);return db[_0x9c5c('0x2a')]['find'](_0xe90970)[_0x9c5c('0x24')](handleEntityNotFound(_0x187504,null))['then'](respondWithResult(_0x187504,null))['catch'](handleError(_0x187504,null));};exports[_0x9c5c('0x47')]=function(_0x2ddd51,_0x113e59){return db[_0x9c5c('0x2a')]['create'](_0x2ddd51['body'],{})[_0x9c5c('0x24')](respondWithResult(_0x113e59,0xc9))[_0x9c5c('0x44')](handleError(_0x113e59,null));};exports[_0x9c5c('0x23')]=function(_0x5805a2,_0x2fd35f){if(_0x5805a2[_0x9c5c('0x48')]['id']){delete _0x5805a2[_0x9c5c('0x48')]['id'];}return db[_0x9c5c('0x2a')][_0x9c5c('0x49')]({'where':{'id':_0x5805a2[_0x9c5c('0x46')]['id']}})[_0x9c5c('0x24')](handleEntityNotFound(_0x2fd35f,null))[_0x9c5c('0x24')](saveUpdates(_0x5805a2[_0x9c5c('0x48')],null))[_0x9c5c('0x24')](respondWithResult(_0x2fd35f,null))[_0x9c5c('0x44')](handleError(_0x2fd35f,null));};exports['destroy']=function(_0x4c12ea,_0x3a0b18){return db[_0x9c5c('0x2a')][_0x9c5c('0x49')]({'where':{'id':_0x4c12ea[_0x9c5c('0x46')]['id']}})['then'](handleEntityNotFound(_0x3a0b18,null))[_0x9c5c('0x24')](removeEntity(_0x3a0b18,null))[_0x9c5c('0x44')](handleError(_0x3a0b18,null));};exports[_0x9c5c('0x4a')]=function(_0x522fdc,_0x22c25a){return db[_0x9c5c('0x2a')][_0x9c5c('0x4a')]()[_0x9c5c('0x24')](respondWithResult(_0x22c25a,null))[_0x9c5c('0x44')](handleError(_0x22c25a,null));}; \ No newline at end of file +var _0x4ea8=['count','offset','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','send','index','map','rawAttributes','fieldName','key','model','name','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','ChatTransferReport','includeAll','include','findAll','rows','catch','show','keys','merge','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','limit'];(function(_0x2648d5,_0x59d362){var _0x47abda=function(_0x4ed58a){while(--_0x4ed58a){_0x2648d5['push'](_0x2648d5['shift']());}};_0x47abda(++_0x59d362);}(_0x4ea8,0xc0));var _0x84ea=function(_0x536442,_0x18e920){_0x536442=_0x536442-0x0;var _0x82516e=_0x4ea8[_0x536442];return _0x82516e;};'use strict';var emlformat=require(_0x84ea('0x0'));var rimraf=require(_0x84ea('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x84ea('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x84ea('0x3'));var util=require(_0x84ea('0x4'));var path=require('path');var sox=require(_0x84ea('0x5'));var csv=require(_0x84ea('0x6'));var ejs=require(_0x84ea('0x7'));var fs=require('fs');var fs_extra=require(_0x84ea('0x8'));var _=require('lodash');var squel=require(_0x84ea('0x9'));var crypto=require(_0x84ea('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x84ea('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x84ea('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x84ea('0xd'));var logger=require(_0x84ea('0xe'))(_0x84ea('0xf'));var utils=require(_0x84ea('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x84ea('0x11'));var db=require(_0x84ea('0x12'))['db'];function respondWithStatusCode(_0x2fdf8b,_0x3b0887){_0x3b0887=_0x3b0887||0xcc;return function(_0x5b6140){if(_0x5b6140){return _0x2fdf8b['sendStatus'](_0x3b0887);}return _0x2fdf8b[_0x84ea('0x13')](_0x3b0887)[_0x84ea('0x14')]();};}function respondWithResult(_0x2950a8,_0x81ff83){_0x81ff83=_0x81ff83||0xc8;return function(_0x25d628){if(_0x25d628){return _0x2950a8[_0x84ea('0x13')](_0x81ff83)[_0x84ea('0x15')](_0x25d628);}};}function respondWithFilteredResult(_0x5b957e,_0x429762){return function(_0xcfc6e9){if(_0xcfc6e9){var _0x16bef9=typeof _0x429762['offset']===_0x84ea('0x16')&&typeof _0x429762[_0x84ea('0x17')]===_0x84ea('0x16');var _0x21fe37=_0xcfc6e9['count'];var _0x57ec5b=_0x16bef9?0x0:_0x429762['offset'];var _0x2cbef5=_0x16bef9?_0xcfc6e9[_0x84ea('0x18')]:_0x429762[_0x84ea('0x19')]+_0x429762[_0x84ea('0x17')];var _0x133d78;if(_0x2cbef5>=_0x21fe37){_0x2cbef5=_0x21fe37;_0x133d78=0xc8;}else{_0x133d78=0xce;}_0x5b957e['status'](_0x133d78);return _0x5b957e['set'](_0x84ea('0x1a'),_0x57ec5b+'-'+_0x2cbef5+'/'+_0x21fe37)[_0x84ea('0x15')](_0xcfc6e9);}return null;};}function patchUpdates(_0x5824d7){return function(_0x25794f){try{jsonpatch[_0x84ea('0x1b')](_0x25794f,_0x5824d7,!![]);}catch(_0x1fc551){return BPromise[_0x84ea('0x1c')](_0x1fc551);}return _0x25794f['save']();};}function saveUpdates(_0x2d9a40,_0x5466e7){return function(_0x5b0a99){if(_0x5b0a99){return _0x5b0a99[_0x84ea('0x1d')](_0x2d9a40)[_0x84ea('0x1e')](function(_0x52f558){return _0x52f558;});}return null;};}function removeEntity(_0x18d567,_0x8adc39){return function(_0x456f0f){if(_0x456f0f){return _0x456f0f[_0x84ea('0x1f')]()[_0x84ea('0x1e')](function(){_0x18d567[_0x84ea('0x13')](0xcc)[_0x84ea('0x14')]();});}};}function handleEntityNotFound(_0x22dd92,_0x14a25c){return function(_0x1c3064){if(!_0x1c3064){_0x22dd92[_0x84ea('0x20')](0x194);}return _0x1c3064;};}function handleError(_0x222f0c,_0x1cb911){_0x1cb911=_0x1cb911||0x1f4;return function(_0x253c51){logger[_0x84ea('0x21')](_0x253c51[_0x84ea('0x22')]);if(_0x253c51['name']){delete _0x253c51['name'];}_0x222f0c[_0x84ea('0x13')](_0x1cb911)[_0x84ea('0x23')](_0x253c51);};}exports[_0x84ea('0x24')]=function(_0x26ed33,_0x173fd9){var _0x342fed={},_0x5aba3f={},_0x30e78c={'count':0x0,'rows':[]};var _0x28774d=_[_0x84ea('0x25')](db['ChatTransferReport'][_0x84ea('0x26')],function(_0x11ebd0){return{'name':_0x11ebd0[_0x84ea('0x27')],'type':_0x11ebd0['type'][_0x84ea('0x28')]};});_0x5aba3f[_0x84ea('0x29')]=_[_0x84ea('0x25')](_0x28774d,_0x84ea('0x2a'));_0x5aba3f[_0x84ea('0x2b')]=_['keys'](_0x26ed33[_0x84ea('0x2b')]);_0x5aba3f[_0x84ea('0x2c')]=_[_0x84ea('0x2d')](_0x5aba3f[_0x84ea('0x29')],_0x5aba3f['query']);_0x342fed[_0x84ea('0x2e')]=_[_0x84ea('0x2d')](_0x5aba3f[_0x84ea('0x29')],qs[_0x84ea('0x2f')](_0x26ed33[_0x84ea('0x2b')][_0x84ea('0x2f')]));_0x342fed[_0x84ea('0x2e')]=_0x342fed[_0x84ea('0x2e')]['length']?_0x342fed['attributes']:_0x5aba3f[_0x84ea('0x29')];if(!_0x26ed33[_0x84ea('0x2b')][_0x84ea('0x30')](_0x84ea('0x31'))){_0x342fed[_0x84ea('0x17')]=qs[_0x84ea('0x17')](_0x26ed33[_0x84ea('0x2b')]['limit']);_0x342fed[_0x84ea('0x19')]=qs[_0x84ea('0x19')](_0x26ed33['query'][_0x84ea('0x19')]);}_0x342fed[_0x84ea('0x32')]=qs[_0x84ea('0x33')](_0x26ed33[_0x84ea('0x2b')][_0x84ea('0x33')]);_0x342fed[_0x84ea('0x34')]=qs['filters'](_[_0x84ea('0x35')](_0x26ed33['query'],_0x5aba3f['filters']),_0x28774d);if(_0x26ed33['query'][_0x84ea('0x36')]){_0x342fed['where']=_['merge'](_0x342fed[_0x84ea('0x34')],{'$or':_[_0x84ea('0x25')](_0x28774d,function(_0xd1fdd7){if(_0xd1fdd7[_0x84ea('0x37')]!==_0x84ea('0x38')){var _0x5cbebc={};_0x5cbebc[_0xd1fdd7[_0x84ea('0x2a')]]={'$like':'%'+_0x26ed33[_0x84ea('0x2b')][_0x84ea('0x36')]+'%'};return _0x5cbebc;}})});}_0x342fed=_['merge']({},_0x342fed,_0x26ed33[_0x84ea('0x39')]);var _0x5c3f07={'where':_0x342fed['where']};return db[_0x84ea('0x3a')][_0x84ea('0x18')](_0x5c3f07)['then'](function(_0x56f213){_0x30e78c[_0x84ea('0x18')]=_0x56f213;if(_0x26ed33[_0x84ea('0x2b')][_0x84ea('0x3b')]){_0x342fed[_0x84ea('0x3c')]=[{'all':!![]}];}return db[_0x84ea('0x3a')][_0x84ea('0x3d')](_0x342fed);})[_0x84ea('0x1e')](function(_0x49a19c){_0x30e78c[_0x84ea('0x3e')]=_0x49a19c;return _0x30e78c;})[_0x84ea('0x1e')](respondWithFilteredResult(_0x173fd9,_0x342fed))[_0x84ea('0x3f')](handleError(_0x173fd9,null));};exports[_0x84ea('0x40')]=function(_0x5c9ff9,_0x1b5e4e){var _0x4f5542={'raw':!![],'where':{'id':_0x5c9ff9['params']['id']}},_0x4863a3={};_0x4863a3[_0x84ea('0x29')]=_['keys'](db[_0x84ea('0x3a')][_0x84ea('0x26')]);_0x4863a3[_0x84ea('0x2b')]=_[_0x84ea('0x41')](_0x5c9ff9[_0x84ea('0x2b')]);_0x4863a3[_0x84ea('0x2c')]=_[_0x84ea('0x2d')](_0x4863a3['model'],_0x4863a3['query']);_0x4f5542[_0x84ea('0x2e')]=_[_0x84ea('0x2d')](_0x4863a3[_0x84ea('0x29')],qs['fields'](_0x5c9ff9['query']['fields']));_0x4f5542['attributes']=_0x4f5542[_0x84ea('0x2e')]['length']?_0x4f5542[_0x84ea('0x2e')]:_0x4863a3[_0x84ea('0x29')];if(_0x5c9ff9['query'][_0x84ea('0x3b')]){_0x4f5542[_0x84ea('0x3c')]=[{'all':!![]}];}_0x4f5542=_[_0x84ea('0x42')]({},_0x4f5542,_0x5c9ff9[_0x84ea('0x39')]);return db[_0x84ea('0x3a')][_0x84ea('0x43')](_0x4f5542)[_0x84ea('0x1e')](handleEntityNotFound(_0x1b5e4e,null))['then'](respondWithResult(_0x1b5e4e,null))[_0x84ea('0x3f')](handleError(_0x1b5e4e,null));};exports[_0x84ea('0x44')]=function(_0x455a97,_0x291320){return db[_0x84ea('0x3a')][_0x84ea('0x44')](_0x455a97[_0x84ea('0x45')],{})[_0x84ea('0x1e')](respondWithResult(_0x291320,0xc9))[_0x84ea('0x3f')](handleError(_0x291320,null));};exports[_0x84ea('0x1d')]=function(_0x49df49,_0xe237c7){if(_0x49df49['body']['id']){delete _0x49df49[_0x84ea('0x45')]['id'];}return db[_0x84ea('0x3a')][_0x84ea('0x43')]({'where':{'id':_0x49df49['params']['id']}})[_0x84ea('0x1e')](handleEntityNotFound(_0xe237c7,null))[_0x84ea('0x1e')](saveUpdates(_0x49df49[_0x84ea('0x45')],null))[_0x84ea('0x1e')](respondWithResult(_0xe237c7,null))[_0x84ea('0x3f')](handleError(_0xe237c7,null));};exports[_0x84ea('0x1f')]=function(_0x272d84,_0x2f1ac4){return db[_0x84ea('0x3a')]['find']({'where':{'id':_0x272d84[_0x84ea('0x46')]['id']}})[_0x84ea('0x1e')](handleEntityNotFound(_0x2f1ac4,null))[_0x84ea('0x1e')](removeEntity(_0x2f1ac4,null))['catch'](handleError(_0x2f1ac4,null));};exports[_0x84ea('0x47')]=function(_0x3e25ed,_0x1a68b0){return db['ChatTransferReport']['describe']()['then'](respondWithResult(_0x1a68b0,null))[_0x84ea('0x3f')](handleError(_0x1a68b0,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 3e09f38..f86abab 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 _0x3083=['report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','exports','define'];(function(_0x5419da,_0x429446){var _0x3a4c50=function(_0x274f75){while(--_0x274f75){_0x5419da['push'](_0x5419da['shift']());}};_0x3a4c50(++_0x429446);}(_0x3083,0xff));var _0x3308=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0x3083[_0x2080a3];return _0x8d7d17;};'use strict';var _=require(_0x3308('0x0'));var util=require(_0x3308('0x1'));var logger=require(_0x3308('0x2'))(_0x3308('0x3'));var moment=require(_0x3308('0x4'));var BPromise=require(_0x3308('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3308('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatTransferReport.attributes');module[_0x3308('0x7')]=function(_0x5b6d2b,_0x183214){return _0x5b6d2b[_0x3308('0x8')]('ChatTransferReport',attributes,{'tableName':_0x3308('0x9'),'paranoid':![],'indexes':[{'name':_0x3308('0xa'),'fields':[_0x3308('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa1be=['../../config/logger','moment','bluebird','request-promise','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','uniqueid','lodash'];(function(_0x3a16d4,_0x23ecda){var _0x31ea9c=function(_0x35fea8){while(--_0x35fea8){_0x3a16d4['push'](_0x3a16d4['shift']());}};_0x31ea9c(++_0x23ecda);}(_0xa1be,0x128));var _0xea1b=function(_0x3c6aa0,_0x280f28){_0x3c6aa0=_0x3c6aa0-0x0;var _0x4b58c6=_0xa1be[_0x3c6aa0];return _0x4b58c6;};'use strict';var _=require(_0xea1b('0x0'));var util=require('util');var logger=require(_0xea1b('0x1'))('api');var moment=require(_0xea1b('0x2'));var BPromise=require(_0xea1b('0x3'));var rp=require(_0xea1b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xea1b('0x5'));var attributes=require(_0xea1b('0x6'));module[_0xea1b('0x7')]=function(_0x5f0423,_0x364c82){return _0x5f0423[_0xea1b('0x8')](_0xea1b('0x9'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xea1b('0xa'),'fields':[_0xea1b('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 268d744..2dc1624 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 _0x1498=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatTransferReport,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird'];(function(_0x284ba4,_0x5f5db1){var _0x1ba706=function(_0x514d03){while(--_0x514d03){_0x284ba4['push'](_0x284ba4['shift']());}};_0x1ba706(++_0x5f5db1);}(_0x1498,0xa5));var _0x8149=function(_0x12ef51,_0x2d5ea7){_0x12ef51=_0x12ef51-0x0;var _0x39af05=_0x1498[_0x12ef51];return _0x39af05;};'use strict';var _=require(_0x8149('0x0'));var util=require(_0x8149('0x1'));var moment=require('moment');var BPromise=require(_0x8149('0x2'));var rs=require(_0x8149('0x3'));var fs=require('fs');var Redis=require(_0x8149('0x4'));var db=require(_0x8149('0x5'))['db'];var utils=require(_0x8149('0x6'));var logger=require(_0x8149('0x7'))('rpc');var config=require(_0x8149('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8149('0x9')][_0x8149('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x468d19,_0x153b97,_0x325c6a){return new BPromise(function(_0x45df89,_0x3f3392){return client[_0x8149('0xb')](_0x468d19,_0x325c6a)[_0x8149('0xc')](function(_0x39414f){logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x153b97,_0x8149('0xd'));logger[_0x8149('0xe')](_0x8149('0xf'),_0x153b97,'request\x20sent',JSON[_0x8149('0x10')](_0x39414f));if(_0x39414f[_0x8149('0x11')]){if(_0x39414f[_0x8149('0x11')][_0x8149('0x12')]===0x1f4){logger[_0x8149('0x11')](_0x8149('0x13'),_0x153b97,_0x39414f[_0x8149('0x11')]['message']);return _0x3f3392(_0x39414f[_0x8149('0x11')][_0x8149('0x14')]);}logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x153b97,_0x39414f[_0x8149('0x11')][_0x8149('0x14')]);return _0x45df89(_0x39414f['error'][_0x8149('0x14')]);}else{logger[_0x8149('0x15')](_0x8149('0x13'),_0x153b97,'request\x20sent');_0x45df89(_0x39414f[_0x8149('0x16')]['message']);}})[_0x8149('0x17')](function(_0x5f56f8){logger[_0x8149('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x153b97,_0x5f56f8);_0x3f3392(_0x5f56f8);});});} \ No newline at end of file +var _0xa4e3=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa4e3,0x103));var _0x3a4e=function(_0x2ea92f,_0x1b4f22){_0x2ea92f=_0x2ea92f-0x0;var _0x5529ee=_0xa4e3[_0x2ea92f];return _0x5529ee;};'use strict';var _=require(_0x3a4e('0x0'));var util=require(_0x3a4e('0x1'));var moment=require('moment');var BPromise=require(_0x3a4e('0x2'));var rs=require(_0x3a4e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3a4e('0x4'))['db'];var utils=require(_0x3a4e('0x5'));var logger=require(_0x3a4e('0x6'))('rpc');var config=require(_0x3a4e('0x7'));var jayson=require(_0x3a4e('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4ea0e0,_0x39af53,_0x27e9e5){return new BPromise(function(_0x127cf0,_0x194d21){return client[_0x3a4e('0x9')](_0x4ea0e0,_0x27e9e5)[_0x3a4e('0xa')](function(_0x32200c){logger[_0x3a4e('0xb')]('ChatTransferReport,\x20%s,\x20%s',_0x39af53,_0x3a4e('0xc'));logger[_0x3a4e('0xd')](_0x3a4e('0xe'),_0x39af53,_0x3a4e('0xc'),JSON[_0x3a4e('0xf')](_0x32200c));if(_0x32200c[_0x3a4e('0x10')]){if(_0x32200c['error'][_0x3a4e('0x11')]===0x1f4){logger[_0x3a4e('0x10')](_0x3a4e('0x12'),_0x39af53,_0x32200c[_0x3a4e('0x10')][_0x3a4e('0x13')]);return _0x194d21(_0x32200c['error']['message']);}logger[_0x3a4e('0x10')](_0x3a4e('0x12'),_0x39af53,_0x32200c[_0x3a4e('0x10')][_0x3a4e('0x13')]);return _0x127cf0(_0x32200c[_0x3a4e('0x10')][_0x3a4e('0x13')]);}else{logger['info'](_0x3a4e('0x12'),_0x39af53,'request\x20sent');_0x127cf0(_0x32200c[_0x3a4e('0x14')][_0x3a4e('0x13')]);}})[_0x3a4e('0x15')](function(_0x5c8ceb){logger[_0x3a4e('0x10')](_0x3a4e('0x12'),_0x39af53,_0x5c8ceb);_0x194d21(_0x5c8ceb);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 24486da..be68b54 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 _0x6174=['Router','fs-extra','isAuthenticated','index','get','show','create','put','/:id','update','delete','util','path','express'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x6174,0x1af));var _0x4617=function(_0x877dbb,_0x4d00d5){_0x877dbb=_0x877dbb-0x0;var _0xc224a9=_0x6174[_0x877dbb];return _0xc224a9;};'use strict';var multer=require('multer');var util=require(_0x4617('0x0'));var path=require(_0x4617('0x1'));var timeout=require('connect-timeout');var express=require(_0x4617('0x2'));var router=express[_0x4617('0x3')]();var fs_extra=require(_0x4617('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatTransferReport.controller');router['get']('/',auth[_0x4617('0x5')](),controller[_0x4617('0x6')]);router['get']('/describe',auth[_0x4617('0x5')](),controller['describe']);router[_0x4617('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x4617('0x8')]);router['post']('/',auth[_0x4617('0x5')](),controller[_0x4617('0x9')]);router[_0x4617('0xa')](_0x4617('0xb'),auth[_0x4617('0x5')](),controller[_0x4617('0xc')]);router[_0x4617('0xd')]('/:id',auth[_0x4617('0x5')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7bc8=['destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','put','update','delete'];(function(_0x1dce89,_0x5cae59){var _0x5415b4=function(_0x3441b1){while(--_0x3441b1){_0x1dce89['push'](_0x1dce89['shift']());}};_0x5415b4(++_0x5cae59);}(_0x7bc8,0x92));var _0x87bc=function(_0x3bc0da,_0x81d03d){_0x3bc0da=_0x3bc0da-0x0;var _0x5a2547=_0x7bc8[_0x3bc0da];return _0x5a2547;};'use strict';var multer=require(_0x87bc('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x87bc('0x1'));var express=require('express');var router=express[_0x87bc('0x2')]();var fs_extra=require(_0x87bc('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x87bc('0x4'));var config=require(_0x87bc('0x5'));var controller=require(_0x87bc('0x6'));router[_0x87bc('0x7')]('/',auth[_0x87bc('0x8')](),controller[_0x87bc('0x9')]);router[_0x87bc('0x7')](_0x87bc('0xa'),auth[_0x87bc('0x8')](),controller[_0x87bc('0xb')]);router[_0x87bc('0x7')](_0x87bc('0xc'),auth[_0x87bc('0x8')](),controller['show']);router['post']('/',auth[_0x87bc('0x8')](),controller['create']);router[_0x87bc('0xd')](_0x87bc('0xc'),auth[_0x87bc('0x8')](),controller[_0x87bc('0xe')]);router[_0x87bc('0xf')](_0x87bc('0xc'),auth['isAuthenticated'](),controller[_0x87bc('0x10')]);module[_0x87bc('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 5cb19ed..8a7e7e4 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 _0xa74f=['Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','exports','address','STRING','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','squared','rounded','We\x20are\x20here!','Chat','Send','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Feedback','star','TEXT','stringify','input','name','getDataValue','onlineForm','textarea','Comments','Leave\x20your\x20comments','offlineForm','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion'];(function(_0x190ff6,_0x515cfd){var _0x5356d2=function(_0x2cf77c){while(--_0x2cf77c){_0x190ff6['push'](_0x190ff6['shift']());}};_0x5356d2(++_0x515cfd);}(_0xa74f,0x9a));var _0xfa74=function(_0x4d7116,_0xdb8175){_0x4d7116=_0x4d7116-0x0;var _0x4593dc=_0xa74f[_0x4d7116];return _0x4593dc;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0xfa74('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xfa74('0x1')},'description':{'type':Sequelize[_0xfa74('0x2')]},'mapKey':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0x3')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xfa74('0x3')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xfa74('0x4')},'customerAlias':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xfa74('0x2')],'allowNull':![],'defaultValue':_0xfa74('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xfa74('0x2')],'allowNull':![],'defaultValue':_0xfa74('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xfa74('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xfa74('0x2')],'allowNull':![],'defaultValue':_0xfa74('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xfa74('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0xfa74('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xfa74('0x9')]('rounded',_0xfa74('0xa')),'defaultValue':_0xfa74('0xb')},'header_online':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0xc')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xfa74('0xd')},'offline_chat_button':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0xe')},'header_offline':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0xfa74('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xfa74('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0xfa74('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0x12')},'noteTitle':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0x13')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0xe')},'skipMessageButton':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0xfa74('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xfa74('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xfa74('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0x14')},'ratingType':{'type':Sequelize[_0xfa74('0x9')]('star','thumb'),'defaultValue':_0xfa74('0x15')},'ratingStarsNumber':{'type':Sequelize[_0xfa74('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xfa74('0x16')],'defaultValue':function(){return JSON[_0xfa74('0x17')]({'items':[{'type':_0xfa74('0x18'),'variable':null,'config':{'placeholder':'name','type':'text','required':!![]},'props':{'title':_0xfa74('0x19'),'helpText':''}},{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xfa74('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xfa74('0x1a')](_0xfa74('0x1b'))?JSON['parse'](this['getDataValue'](_0xfa74('0x1b'))):{};},'set':function(_0xeb6c11){return this['setDataValue'](_0xfa74('0x1b'),JSON['stringify'](_0xeb6c11));}},'offlineForm':{'type':Sequelize[_0xfa74('0x16')],'defaultValue':function(){return JSON[_0xfa74('0x17')]({'items':[{'type':'input','props':{'title':_0xfa74('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xfa74('0x3'),'type':_0xfa74('0x3')},'variable':null},{'type':_0xfa74('0x1c'),'config':{'placeholder':'Comments'},'props':{'title':_0xfa74('0x1d'),'helpText':_0xfa74('0x1e')}}],'fromKey':0x0});},'get':function(){return this[_0xfa74('0x1a')]('offlineForm')?JSON['parse'](this[_0xfa74('0x1a')](_0xfa74('0x1f'))):{};},'set':function(_0x5df5cd){return this['setDataValue'](_0xfa74('0x1f'),JSON['stringify'](_0x5df5cd));}},'token':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0xfa74('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xfa74('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xfa74('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xfa74('0x2')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xfa74('0x2')]},'waitingTitle':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0x20')},'waitingMessage':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0x21')},'offlineMessageSubject':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0x22')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0xfa74('0x23')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0x24')},'skipUnmanaged':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0x25')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0xfa74('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xfa74('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xfa74('0x16')]},'showAgentAvatar':{'type':Sequelize[_0xfa74('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xfa74('0x16')],'defaultValue':function(){return _0xfa74('0x26');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0xfa74('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0x27')},'verticalAlignment':{'type':Sequelize[_0xfa74('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0x28')},'messagesAlignment':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0x29')},'defaultTitle':{'type':Sequelize[_0xfa74('0x2')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0xfa74('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xfa74('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xfa74('0x2')],'allowNull':![],'defaultValue':_0xfa74('0x2a'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xfa74('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xfa74('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xfa74('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0x2b')},'systemAvatar':{'type':Sequelize[_0xfa74('0x16')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xfa74('0x2c')},'mandatoryDisposition':{'type':Sequelize[_0xfa74('0x8')],'defaultValue':![],'comment':_0xfa74('0x2d'),'set':function(_0x35f252){if(!_0x35f252)this['setDataValue'](_0xfa74('0x2e'),null);this[_0xfa74('0x2f')](_0xfa74('0x30'),_0x35f252);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0xfa74('0x2')],'allowNull':![],'defaultValue':_0xfa74('0x31')},'vidaooNote':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':function(){return _0xfa74('0x32');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xfa74('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xfa74('0x16')]}}; \ No newline at end of file +var _0x702d=['ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Note','Thanks\x20you\x20for\x20your\x20time!','Skip','star','thumb','stringify','name','input','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','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}}','sequelize','randomstring','exports','STRING','email','Agent','#ffffff','INTEGER','BOOLEAN'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x702d,0x147));var _0xd702=function(_0x4be77c,_0x465d29){_0x4be77c=_0x4be77c-0x0;var _0x1ddbe0=_0x702d[_0x4be77c];return _0x1ddbe0;};'use strict';var Sequelize=require(_0xd702('0x0'));var rs=require(_0xd702('0x1'));module[_0xd702('0x2')]={'name':{'type':Sequelize[_0xd702('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0xd702('0x3')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0xd702('0x3')]},'mapKey':{'type':Sequelize[_0xd702('0x3')],'defaultValue':_0xd702('0x4')},'mapKeyOffline':{'type':Sequelize[_0xd702('0x3')],'defaultValue':'email'},'key':{'type':Sequelize[_0xd702('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xd702('0x5')},'customerAlias':{'type':Sequelize[_0xd702('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xd702('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xd702('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xd702('0x3')],'allowNull':![],'defaultValue':_0xd702('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xd702('0x3')],'allowNull':![],'defaultValue':_0xd702('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xd702('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xd702('0x3')]},'animation':{'type':Sequelize[_0xd702('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xd702('0x9')](_0xd702('0xa'),_0xd702('0xb')),'defaultValue':'rounded'},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0xd702('0xc')},'start_chat_button':{'type':Sequelize[_0xd702('0x3')],'defaultValue':_0xd702('0xd')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xd702('0xe')},'header_offline':{'type':Sequelize[_0xd702('0x3')],'defaultValue':_0xd702('0xf')},'download_transcript':{'type':Sequelize[_0xd702('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xd702('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xd702('0x3')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xd702('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xd702('0x10')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0xd702('0x11')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0xd702('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0xd702('0x3')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0xd702('0x3')],'defaultValue':_0xd702('0x13')},'placeholderMessage':{'type':Sequelize[_0xd702('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xd702('0x14')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xd702('0xe')},'skipMessageButton':{'type':Sequelize[_0xd702('0x3')],'defaultValue':_0xd702('0x15')},'conditionAgreement':{'type':Sequelize[_0xd702('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xd702('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xd702('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xd702('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize['ENUM'](_0xd702('0x16'),_0xd702('0x17')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0xd702('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xd702('0x18')]({'items':[{'type':'input','variable':null,'config':{'placeholder':'name','type':'text','required':!![]},'props':{'title':_0xd702('0x19'),'helpText':''}},{'type':_0xd702('0x1a'),'props':{'title':_0xd702('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xd702('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xd702('0x1b')](_0xd702('0x1c'))?JSON[_0xd702('0x1d')](this[_0xd702('0x1b')](_0xd702('0x1c'))):{};},'set':function(_0x94c58d){return this[_0xd702('0x1e')](_0xd702('0x1c'),JSON['stringify'](_0x94c58d));}},'offlineForm':{'type':Sequelize[_0xd702('0x10')],'defaultValue':function(){return JSON[_0xd702('0x18')]({'items':[{'type':_0xd702('0x1a'),'props':{'title':_0xd702('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xd702('0x4'),'type':_0xd702('0x4')},'variable':null},{'type':_0xd702('0x1f'),'config':{'placeholder':_0xd702('0x20')},'props':{'title':'Comments','helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0xd702('0x1b')](_0xd702('0x21'))?JSON['parse'](this[_0xd702('0x1b')](_0xd702('0x21'))):{};},'set':function(_0xffdb54){return this[_0xd702('0x1e')]('offlineForm',JSON[_0xd702('0x18')](_0xffdb54));}},'token':{'type':Sequelize[_0xd702('0x3')],'defaultValue':function(){return rs[_0xd702('0x22')]();}},'autoclose':{'type':Sequelize[_0xd702('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xd702('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xd702('0x3')]},'forwardOffline':{'type':Sequelize[_0xd702('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xd702('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0xd702('0x23')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0xd702('0x3')],'defaultValue':_0xd702('0x24')},'offlineMessageBody':{'type':Sequelize[_0xd702('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0xd702('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xd702('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0xd702('0x3')],'defaultValue':_0xd702('0x15')},'sendUnmanaged':{'type':Sequelize[_0xd702('0x3')],'defaultValue':_0xd702('0xe')},'enableCustomerAttachment':{'type':Sequelize[_0xd702('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xd702('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xd702('0x10')]},'showAgentAvatar':{'type':Sequelize[_0xd702('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xd702('0x3')]},'notificationTemplate':{'type':Sequelize[_0xd702('0x10')],'defaultValue':function(){return _0xd702('0x25');}},'notificationSound':{'type':Sequelize[_0xd702('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd702('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xd702('0x3')],'defaultValue':_0xd702('0x26')},'waitForTheAssignedAgent':{'type':Sequelize[_0xd702('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xd702('0x3')],'defaultValue':_0xd702('0x27')},'verticalAlignment':{'type':Sequelize[_0xd702('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xd702('0x3')],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0xd702('0x28')},'defaultTitle':{'type':Sequelize[_0xd702('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xd702('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xd702('0x3')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xd702('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd702('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd702('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xd702('0x3')],'defaultValue':_0xd702('0x29')},'systemAvatar':{'type':Sequelize[_0xd702('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xd702('0x2a')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xd702('0x2b'),'set':function(_0x239bec){if(!_0x239bec)this[_0xd702('0x1e')](_0xd702('0x2c'),null);this[_0xd702('0x1e')](_0xd702('0x2d'),_0x239bec);}},'vidaooEscalation':{'type':Sequelize[_0xd702('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xd702('0x3')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd702('0x2e')},'vidaooNote':{'type':Sequelize[_0xd702('0x3')],'defaultValue':function(){return _0xd702('0x2f');}},'vidaooMetadata':{'type':Sequelize[_0xd702('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xd702('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 89efa47..e0c0224 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 _0x8b0a=['remote','x-real-ip','connection','remoteAddress','referer','replace','alignment','verticalAlignment','textColor','textButtonColor','color_button','backgroundColor','IntervalId','Transaction','READ_COMMITTED','finally','getApplications','chatProactiveAction','addProactiveActions','omit','ChatProactiveAction','getFields','online','false','offlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','util','ejs','lodash','querystring','../../components/parsers/qs','../../config/logger','api','../../config/environment','url','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','sendStatus','status','end','json','offset','undefined','count','update','then','destroy','get','ChatWebsites','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','limit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','Pause','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','ChatWebsiteId','Disposition','findOne','hasOwnProperty','order','removeDispositions','addAnswer','CannedAnswer','removeAnswers','ids','addLogo','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','sitepic','../../config/license/util','custom','existsSync','server/files/images/logos/','getAvatar','server/files/images/avatars/default_avatar.png','isNil','server/files/images/avatars/','showCustomerAvatar','download','getSystemAvatar','server/files/images/avatars/system_avatar.png','user-agent-parser','headers','user-agent','getResult','chat','difference','createdAt','updatedAt','CompanyId','ListId','from','Sequelize','ValidationError','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','ChatApplication','Applications','account','applications','list','orderBy','priority','Contacts','defaults','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','firstName','x-real-port','browser','%s\x20%s','version','format','device','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','lastName','messageId','created','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','notify','offline','no\x20available\x20attributes','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','ChatOfflineMessage','fromString','mimetype','server','files','attachments','offline-chat','basename','openNewInteraction','sequelize','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','originalname','toPairsIn','mapValues','subjectOffline','Chat','NotifyMailAccount','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','Contact','Owner','fullname','color','tag','Command','interval','timezone','iftime\x20%s','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','getSnippet','Interval','Intervals','getProactiveActions','getLicense','virtual','License','increment','all','some','readFileSync','server/files/chat/iframe.ejs','origin'];(function(_0x5d11ca,_0x4dbe9e){var _0x347e91=function(_0x12ae92){while(--_0x12ae92){_0x5d11ca['push'](_0x5d11ca['shift']());}};_0x347e91(++_0x4dbe9e);}(_0x8b0a,0x14b));var _0xa8b0=function(_0x3311ae,_0x362cee){_0x3311ae=_0x3311ae-0x0;var _0x107949=_0x8b0a[_0x3311ae];return _0x107949;};'use strict';var BPromise=require('bluebird');var Mustache=require(_0xa8b0('0x0'));var util=require(_0xa8b0('0x1'));var path=require('path');var ejs=require(_0xa8b0('0x2'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa8b0('0x3'));var querystring=require(_0xa8b0('0x4'));var Redis=require('ioredis');var qs=require(_0xa8b0('0x5'));var logger=require(_0xa8b0('0x6'))(_0xa8b0('0x7'));var config=require(_0xa8b0('0x8'));var url=require(_0xa8b0('0x9'));var db=require(_0xa8b0('0xa'))['db'];config['redis']=_['defaults'](config[_0xa8b0('0xb')],{'host':_0xa8b0('0xc'),'port':0x18eb});var socket=require(_0xa8b0('0xd'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0xa8b0('0xe')](socket);var htmlToText=require('html-to-text');var jayson=require(_0xa8b0('0xf'));var client=jayson[_0xa8b0('0x10')][_0xa8b0('0x11')]({'port':0x232c});var client9002=jayson[_0xa8b0('0x10')][_0xa8b0('0x11')]({'port':0x232a});var client9003=jayson[_0xa8b0('0x10')][_0xa8b0('0x11')]({'port':0x232b});var client9001=jayson['client'][_0xa8b0('0x11')]({'port':0x2329});function respondWithRpcPromise(_0xe137a3,_0x51ca45,_0x49c230,_0x1123b3){return new BPromise(function(_0x196e64,_0x10ad2b){var _0x1c157e=_0x1123b3||client;return _0x1c157e[_0xa8b0('0x12')](_0xe137a3,_0x49c230)['then'](function(_0x1ebb9d){logger[_0xa8b0('0x13')](_0xa8b0('0x14'),_0x51ca45,_0xa8b0('0x15'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x51ca45,_0xa8b0('0x15'),JSON[_0xa8b0('0x16')](_0x1ebb9d));if(_0x1ebb9d[_0xa8b0('0x17')]){if(_0x1ebb9d[_0xa8b0('0x17')]['code']===0x1f4){logger[_0xa8b0('0x17')](_0xa8b0('0x14'),_0x51ca45,_0x1ebb9d[_0xa8b0('0x17')][_0xa8b0('0x18')]);return _0x10ad2b(_0x1ebb9d['error']['message']);}logger[_0xa8b0('0x17')](_0xa8b0('0x14'),_0x51ca45,_0x1ebb9d[_0xa8b0('0x17')][_0xa8b0('0x18')]);return _0x196e64(_0x1ebb9d[_0xa8b0('0x17')][_0xa8b0('0x18')]);}else{logger[_0xa8b0('0x13')](_0xa8b0('0x14'),_0x51ca45,_0xa8b0('0x15'));_0x196e64(_0x1ebb9d[_0xa8b0('0x19')][_0xa8b0('0x18')]);}})['catch'](function(_0x4f5882){logger[_0xa8b0('0x17')](_0xa8b0('0x14'),_0x51ca45,_0x4f5882);_0x10ad2b(_0x4f5882);});});}function respondWithStatusCode(_0x3cd207,_0x174ff3){_0x174ff3=_0x174ff3||0xcc;return function(_0x417e32){if(_0x417e32){return _0x3cd207[_0xa8b0('0x1a')](_0x174ff3);}return _0x3cd207[_0xa8b0('0x1b')](_0x174ff3)[_0xa8b0('0x1c')]();};}function respondWithResult(_0x19cf8d,_0x2f3e66){_0x2f3e66=_0x2f3e66||0xc8;return function(_0x50234e){if(_0x50234e){return _0x19cf8d[_0xa8b0('0x1b')](_0x2f3e66)[_0xa8b0('0x1d')](_0x50234e);}};}function respondWithFilteredResult(_0x162065,_0x3e7508){return function(_0x72c8b7){if(_0x72c8b7){var _0x5b8659=typeof _0x3e7508[_0xa8b0('0x1e')]===_0xa8b0('0x1f')&&typeof _0x3e7508['limit']==='undefined';var _0xa82156=_0x72c8b7[_0xa8b0('0x20')];var _0x67a2c1=_0x5b8659?0x0:_0x3e7508[_0xa8b0('0x1e')];var _0x202b7f=_0x5b8659?_0x72c8b7[_0xa8b0('0x20')]:_0x3e7508['offset']+_0x3e7508['limit'];var _0x4d9baf;if(_0x202b7f>=_0xa82156){_0x202b7f=_0xa82156;_0x4d9baf=0xc8;}else{_0x4d9baf=0xce;}_0x162065[_0xa8b0('0x1b')](_0x4d9baf);return _0x162065['set']('Content-Range',_0x67a2c1+'-'+_0x202b7f+'/'+_0xa82156)[_0xa8b0('0x1d')](_0x72c8b7);}return null;};}function saveUpdates(_0x322c49){return function(_0x579d13){if(_0x579d13){return _0x579d13[_0xa8b0('0x21')](_0x322c49)[_0xa8b0('0x22')](function(_0x1d5580){return _0x1d5580;});}return null;};}function removeEntity(_0x534792){return function(_0x582697){if(_0x582697){return _0x582697[_0xa8b0('0x23')]()[_0xa8b0('0x22')](function(){var _0x271bab=_0x582697[_0xa8b0('0x24')]({'plain':!![]});var _0x3a856c=_0xa8b0('0x25');return db[_0xa8b0('0x26')][_0xa8b0('0x23')]({'where':{'type':_0x3a856c,'resourceId':_0x271bab['id']}})['then'](function(){return _0x582697;});})['then'](function(){_0x534792[_0xa8b0('0x1b')](0xcc)[_0xa8b0('0x1c')]();});}};}function handleEntityNotFound(_0x5697cc){return function(_0x387893){if(!_0x387893){_0x5697cc['sendStatus'](0x194);}return _0x387893;};}function handleError(_0x235f29,_0x134641){_0x134641=_0x134641||0x1f4;return function(_0x379529){logger[_0xa8b0('0x17')](_0x379529[_0xa8b0('0x27')]);if(_0x379529['name']){delete _0x379529[_0xa8b0('0x28')];}_0x235f29[_0xa8b0('0x1b')](_0x134641)[_0xa8b0('0x29')](_0x379529);};}exports[_0xa8b0('0x2a')]=function(_0x48410e,_0x472fa6){var _0xae1ce0={'include':[{'model':db['Pause'],'as':_0xa8b0('0x2b')}]},_0x4f17b8={},_0x5b61c2={'count':0x0,'rows':[]};var _0x2dd750=_['map'](db[_0xa8b0('0x2c')][_0xa8b0('0x2d')],function(_0x5bf373){return{'name':_0x5bf373[_0xa8b0('0x2e')],'type':_0x5bf373[_0xa8b0('0x2f')][_0xa8b0('0x30')]};});_0x4f17b8['model']=_[_0xa8b0('0x31')](_0x2dd750,_0xa8b0('0x28'));_0x4f17b8[_0xa8b0('0x32')]=_[_0xa8b0('0x33')](_0x48410e[_0xa8b0('0x32')]);_0x4f17b8[_0xa8b0('0x34')]=_[_0xa8b0('0x35')](_0x4f17b8[_0xa8b0('0x36')],_0x4f17b8[_0xa8b0('0x32')]);_0xae1ce0[_0xa8b0('0x37')]=_[_0xa8b0('0x35')](_0x4f17b8['model'],qs[_0xa8b0('0x38')](_0x48410e[_0xa8b0('0x32')][_0xa8b0('0x38')]));_0xae1ce0[_0xa8b0('0x37')]=_0xae1ce0[_0xa8b0('0x37')][_0xa8b0('0x39')]?_0xae1ce0[_0xa8b0('0x37')]:_0x4f17b8['model'];if(!_0x48410e[_0xa8b0('0x32')]['hasOwnProperty'](_0xa8b0('0x3a'))){_0xae1ce0[_0xa8b0('0x3b')]=qs[_0xa8b0('0x3b')](_0x48410e[_0xa8b0('0x32')]['limit']);_0xae1ce0[_0xa8b0('0x1e')]=qs[_0xa8b0('0x1e')](_0x48410e['query'][_0xa8b0('0x1e')]);}_0xae1ce0['order']=qs[_0xa8b0('0x3c')](_0x48410e[_0xa8b0('0x32')]['sort']);_0xae1ce0['where']=qs[_0xa8b0('0x34')](_[_0xa8b0('0x3d')](_0x48410e[_0xa8b0('0x32')],_0x4f17b8[_0xa8b0('0x34')]),_0x2dd750);if(_0x48410e[_0xa8b0('0x32')][_0xa8b0('0x3e')]){_0xae1ce0['where']=_['merge'](_0xae1ce0[_0xa8b0('0x3f')],{'$or':_[_0xa8b0('0x31')](_0x2dd750,function(_0x212f6b){if(_0x212f6b['type']!==_0xa8b0('0x40')){var _0x7e34dd={};_0x7e34dd[_0x212f6b[_0xa8b0('0x28')]]={'$like':'%'+_0x48410e[_0xa8b0('0x32')][_0xa8b0('0x3e')]+'%'};return _0x7e34dd;}})});}_0xae1ce0=_[_0xa8b0('0x41')]({},_0xae1ce0,_0x48410e[_0xa8b0('0x42')]);var _0x38dde2={'where':_0xae1ce0[_0xa8b0('0x3f')]};return db[_0xa8b0('0x2c')][_0xa8b0('0x20')](_0x38dde2)[_0xa8b0('0x22')](function(_0x38c44d){_0x5b61c2[_0xa8b0('0x20')]=_0x38c44d;if(_0x48410e[_0xa8b0('0x32')][_0xa8b0('0x43')]){_0xae1ce0[_0xa8b0('0x44')]=[{'all':!![]}];}return db[_0xa8b0('0x2c')][_0xa8b0('0x45')](_0xae1ce0);})['then'](function(_0x5eb34d){_0x5b61c2[_0xa8b0('0x46')]=_0x5eb34d;return _0x5b61c2;})['then'](respondWithFilteredResult(_0x472fa6,_0xae1ce0))['catch'](handleError(_0x472fa6,null));};exports['show']=function(_0xd9225c,_0x148891){var _0x39a427={'raw':![],'where':{'id':_0xd9225c['params']['id']},'include':[{'model':db[_0xa8b0('0x47')],'as':_0xa8b0('0x2b')}]},_0x197be7={};_0x197be7[_0xa8b0('0x36')]=_[_0xa8b0('0x33')](db['ChatWebsite'][_0xa8b0('0x2d')]);_0x197be7[_0xa8b0('0x32')]=_[_0xa8b0('0x33')](_0xd9225c['query']);_0x197be7[_0xa8b0('0x34')]=_[_0xa8b0('0x35')](_0x197be7['model'],_0x197be7[_0xa8b0('0x32')]);_0x39a427[_0xa8b0('0x37')]=_[_0xa8b0('0x35')](_0x197be7[_0xa8b0('0x36')],qs[_0xa8b0('0x38')](_0xd9225c[_0xa8b0('0x32')][_0xa8b0('0x38')]));_0x39a427[_0xa8b0('0x37')]=_0x39a427[_0xa8b0('0x37')][_0xa8b0('0x39')]?_0x39a427[_0xa8b0('0x37')]:_0x197be7[_0xa8b0('0x36')];if(_0xd9225c[_0xa8b0('0x32')][_0xa8b0('0x43')]){_0x39a427['include']=[{'all':!![]}];}_0x39a427=_[_0xa8b0('0x41')]({},_0x39a427,_0xd9225c[_0xa8b0('0x42')]);return db[_0xa8b0('0x2c')]['find'](_0x39a427)[_0xa8b0('0x22')](handleEntityNotFound(_0x148891,null))['then'](respondWithResult(_0x148891,null))['catch'](handleError(_0x148891,null));};exports[_0xa8b0('0x48')]=function(_0x5e2517,_0x46728a){return db[_0xa8b0('0x2c')]['create'](_0x5e2517[_0xa8b0('0x49')],{})[_0xa8b0('0x22')](function(_0x1cc99f){var _0x276162=_0x5e2517[_0xa8b0('0x4a')][_0xa8b0('0x24')]({'plain':!![]});if(!_0x276162)throw new Error(_0xa8b0('0x4b'));if(_0x276162[_0xa8b0('0x4c')]===_0xa8b0('0x4a')){var _0x2a6d26=_0x1cc99f['get']({'plain':!![]});var _0x1be10a=_0xa8b0('0x25');return db[_0xa8b0('0x4d')][_0xa8b0('0x4e')]({'where':{'name':_0x1be10a,'userProfileId':_0x276162[_0xa8b0('0x4f')]},'raw':!![]})[_0xa8b0('0x22')](function(_0x2c8c46){if(_0x2c8c46&&_0x2c8c46['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x2a6d26[_0xa8b0('0x28')],'resourceId':_0x2a6d26['id'],'type':_0x2c8c46[_0xa8b0('0x28')],'sectionId':_0x2c8c46['id']},{})[_0xa8b0('0x22')](function(){return _0x1cc99f;});}else{return _0x1cc99f;}})[_0xa8b0('0x50')](function(_0x219a39){logger['error'](_0xa8b0('0x51'),_0x219a39);throw _0x219a39;});}return _0x1cc99f;})[_0xa8b0('0x22')](respondWithResult(_0x46728a,0xc9))['catch'](handleError(_0x46728a,null));};exports[_0xa8b0('0x21')]=function(_0x3291e1,_0x5642f7){if(_0x3291e1[_0xa8b0('0x49')]['id']){delete _0x3291e1[_0xa8b0('0x49')]['id'];}return db[_0xa8b0('0x2c')][_0xa8b0('0x4e')]({'where':{'id':_0x3291e1['params']['id']},'include':[{'model':db[_0xa8b0('0x47')],'as':_0xa8b0('0x2b')}]})[_0xa8b0('0x22')](handleEntityNotFound(_0x5642f7,null))[_0xa8b0('0x22')](saveUpdates(_0x3291e1[_0xa8b0('0x49')],null))['then'](respondWithResult(_0x5642f7,null))[_0xa8b0('0x50')](handleError(_0x5642f7,null));};exports[_0xa8b0('0x23')]=function(_0x35455a,_0x354b7d){return db[_0xa8b0('0x2c')][_0xa8b0('0x4e')]({'where':{'id':_0x35455a[_0xa8b0('0x52')]['id']}})[_0xa8b0('0x22')](handleEntityNotFound(_0x354b7d,null))[_0xa8b0('0x22')](removeEntity(_0x354b7d,null))[_0xa8b0('0x50')](handleError(_0x354b7d,null));};exports['describe']=function(_0x3f2e2f,_0x130b64){return db['ChatWebsite'][_0xa8b0('0x53')]()['then'](respondWithResult(_0x130b64,null))[_0xa8b0('0x50')](handleError(_0x130b64,null));};exports[_0xa8b0('0x54')]=function(_0x5e9be9,_0x3ebb41){if(_0x5e9be9[_0xa8b0('0x49')]['id']){delete _0x5e9be9[_0xa8b0('0x49')]['id'];}return db[_0xa8b0('0x2c')][_0xa8b0('0x4e')]({'where':{'id':_0x5e9be9[_0xa8b0('0x52')]['id']}})[_0xa8b0('0x22')](handleEntityNotFound(_0x3ebb41,null))['then'](function(_0x45c22a){if(_0x45c22a){_0x5e9be9[_0xa8b0('0x49')][_0xa8b0('0x55')]=_0x45c22a['id'];return db[_0xa8b0('0x56')][_0xa8b0('0x48')](_0x5e9be9[_0xa8b0('0x49')]);}})['then'](respondWithResult(_0x3ebb41,null))[_0xa8b0('0x50')](handleError(_0x3ebb41,null));};exports['getDispositions']=function(_0x53a5de,_0x9ecdbe){var _0x19dba7={'raw':![],'where':{}};var _0xa466d3={};var _0x5e697c={'count':0x0,'rows':[]};return db[_0xa8b0('0x2c')][_0xa8b0('0x57')]({'where':{'id':_0x53a5de[_0xa8b0('0x52')]['id']}})['then'](handleEntityNotFound(_0x9ecdbe,null))[_0xa8b0('0x22')](function(_0x108a63){if(_0x108a63){_0xa466d3['model']=_[_0xa8b0('0x33')](db[_0xa8b0('0x56')][_0xa8b0('0x2d')]);_0xa466d3[_0xa8b0('0x32')]=_[_0xa8b0('0x33')](_0x53a5de[_0xa8b0('0x32')]);_0xa466d3[_0xa8b0('0x34')]=_[_0xa8b0('0x35')](_0xa466d3[_0xa8b0('0x36')],_0xa466d3['query']);_0x19dba7[_0xa8b0('0x37')]=_['intersection'](_0xa466d3[_0xa8b0('0x36')],qs[_0xa8b0('0x38')](_0x53a5de[_0xa8b0('0x32')][_0xa8b0('0x38')]));_0x19dba7[_0xa8b0('0x37')]=_0x19dba7[_0xa8b0('0x37')][_0xa8b0('0x39')]?_0x19dba7[_0xa8b0('0x37')]:_0xa466d3['model'];if(!_0x53a5de['query'][_0xa8b0('0x58')](_0xa8b0('0x3a'))){_0x19dba7['limit']=qs[_0xa8b0('0x3b')](_0x53a5de[_0xa8b0('0x32')][_0xa8b0('0x3b')]);_0x19dba7['offset']=qs[_0xa8b0('0x1e')](_0x53a5de[_0xa8b0('0x32')]['offset']);}_0x19dba7[_0xa8b0('0x59')]=qs[_0xa8b0('0x3c')](_0x53a5de['query'][_0xa8b0('0x3c')]);_0x19dba7['where']=qs[_0xa8b0('0x34')](_[_0xa8b0('0x3d')](_0x53a5de[_0xa8b0('0x32')],_0xa466d3[_0xa8b0('0x34')]));_0x19dba7[_0xa8b0('0x3f')][_0xa8b0('0x55')]=_0x108a63['id'];if(_0x53a5de['query'][_0xa8b0('0x3e')]){_0x19dba7[_0xa8b0('0x3f')]=_[_0xa8b0('0x41')](_0x19dba7[_0xa8b0('0x3f')],{'$or':_[_0xa8b0('0x31')](_0x19dba7[_0xa8b0('0x37')],function(_0x1b4ba0){var _0x599fb4={};_0x599fb4[_0x1b4ba0]={'$like':'%'+_0x53a5de[_0xa8b0('0x32')]['filter']+'%'};return _0x599fb4;})});}_0x19dba7=_['merge']({},_0x19dba7,_0x53a5de[_0xa8b0('0x42')]);return db['Disposition'][_0xa8b0('0x20')]({'where':_0x19dba7[_0xa8b0('0x3f')]})[_0xa8b0('0x22')](function(_0x30da27){_0x5e697c[_0xa8b0('0x20')]=_0x30da27;if(_0x53a5de[_0xa8b0('0x32')][_0xa8b0('0x43')]){_0x19dba7[_0xa8b0('0x44')]=[{'all':!![]}];}return db[_0xa8b0('0x56')][_0xa8b0('0x45')](_0x19dba7);})[_0xa8b0('0x22')](function(_0x640ef6){_0x5e697c['rows']=_0x640ef6;return _0x5e697c;});}})[_0xa8b0('0x22')](respondWithFilteredResult(_0x9ecdbe,_0x19dba7))[_0xa8b0('0x50')](handleError(_0x9ecdbe,null));};exports[_0xa8b0('0x5a')]=function(_0x4c2f40,_0x3b9f0d){return db[_0xa8b0('0x2c')][_0xa8b0('0x4e')]({'where':{'id':_0x4c2f40[_0xa8b0('0x52')]['id']}})['then'](handleEntityNotFound(_0x3b9f0d,null))[_0xa8b0('0x22')](function(_0x289d52){if(_0x289d52){return _0x289d52[_0xa8b0('0x5a')](_0x4c2f40[_0xa8b0('0x32')]['ids']);}})[_0xa8b0('0x22')](respondWithStatusCode(_0x3b9f0d,null))[_0xa8b0('0x50')](handleError(_0x3b9f0d,null));};exports[_0xa8b0('0x5b')]=function(_0x137377,_0x3dee5f){if(_0x137377[_0xa8b0('0x49')]['id']){delete _0x137377['body']['id'];}return db[_0xa8b0('0x2c')][_0xa8b0('0x4e')]({'where':{'id':_0x137377[_0xa8b0('0x52')]['id']}})[_0xa8b0('0x22')](handleEntityNotFound(_0x3dee5f,null))[_0xa8b0('0x22')](function(_0x4a3737){if(_0x4a3737){_0x137377[_0xa8b0('0x49')][_0xa8b0('0x55')]=_0x4a3737['id'];return db[_0xa8b0('0x5c')][_0xa8b0('0x48')](_0x137377[_0xa8b0('0x49')]);}})[_0xa8b0('0x22')](respondWithResult(_0x3dee5f,null))['catch'](handleError(_0x3dee5f,null));};exports['getAnswers']=function(_0x2ede8f,_0x403491){var _0x43e68e={'raw':![],'where':{}};var _0x1bcac2={};var _0x457619={'count':0x0,'rows':[]};return db[_0xa8b0('0x2c')][_0xa8b0('0x57')]({'where':{'id':_0x2ede8f['params']['id']}})['then'](handleEntityNotFound(_0x403491,null))['then'](function(_0x1ce373){if(_0x1ce373){_0x1bcac2[_0xa8b0('0x36')]=_['keys'](db[_0xa8b0('0x5c')][_0xa8b0('0x2d')]);_0x1bcac2[_0xa8b0('0x32')]=_[_0xa8b0('0x33')](_0x2ede8f[_0xa8b0('0x32')]);_0x1bcac2['filters']=_[_0xa8b0('0x35')](_0x1bcac2[_0xa8b0('0x36')],_0x1bcac2[_0xa8b0('0x32')]);_0x43e68e[_0xa8b0('0x37')]=_[_0xa8b0('0x35')](_0x1bcac2[_0xa8b0('0x36')],qs['fields'](_0x2ede8f[_0xa8b0('0x32')][_0xa8b0('0x38')]));_0x43e68e[_0xa8b0('0x37')]=_0x43e68e['attributes'][_0xa8b0('0x39')]?_0x43e68e[_0xa8b0('0x37')]:_0x1bcac2[_0xa8b0('0x36')];if(!_0x2ede8f[_0xa8b0('0x32')][_0xa8b0('0x58')](_0xa8b0('0x3a'))){_0x43e68e[_0xa8b0('0x3b')]=qs[_0xa8b0('0x3b')](_0x2ede8f[_0xa8b0('0x32')]['limit']);_0x43e68e[_0xa8b0('0x1e')]=qs['offset'](_0x2ede8f[_0xa8b0('0x32')][_0xa8b0('0x1e')]);}_0x43e68e[_0xa8b0('0x59')]=qs[_0xa8b0('0x3c')](_0x2ede8f[_0xa8b0('0x32')][_0xa8b0('0x3c')]);_0x43e68e['where']=qs[_0xa8b0('0x34')](_['pick'](_0x2ede8f[_0xa8b0('0x32')],_0x1bcac2[_0xa8b0('0x34')]));_0x43e68e['where'][_0xa8b0('0x55')]=_0x1ce373['id'];if(_0x2ede8f[_0xa8b0('0x32')][_0xa8b0('0x3e')]){_0x43e68e[_0xa8b0('0x3f')]=_[_0xa8b0('0x41')](_0x43e68e[_0xa8b0('0x3f')],{'$or':_[_0xa8b0('0x31')](_0x43e68e[_0xa8b0('0x37')],function(_0xcaf1e7){var _0xe3dcb2={};_0xe3dcb2[_0xcaf1e7]={'$like':'%'+_0x2ede8f['query']['filter']+'%'};return _0xe3dcb2;})});}_0x43e68e=_[_0xa8b0('0x41')]({},_0x43e68e,_0x2ede8f[_0xa8b0('0x42')]);return db['CannedAnswer'][_0xa8b0('0x20')]({'where':_0x43e68e[_0xa8b0('0x3f')]})[_0xa8b0('0x22')](function(_0x4c34f4){_0x457619[_0xa8b0('0x20')]=_0x4c34f4;if(_0x2ede8f[_0xa8b0('0x32')]['includeAll']){_0x43e68e[_0xa8b0('0x44')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x43e68e);})[_0xa8b0('0x22')](function(_0x413668){_0x457619[_0xa8b0('0x46')]=_0x413668;return _0x457619;});}})['then'](respondWithFilteredResult(_0x403491,_0x43e68e))[_0xa8b0('0x50')](handleError(_0x403491,null));};exports[_0xa8b0('0x5d')]=function(_0xd01ce4,_0x15de89){return db['ChatWebsite'][_0xa8b0('0x4e')]({'where':{'id':_0xd01ce4[_0xa8b0('0x52')]['id']}})[_0xa8b0('0x22')](handleEntityNotFound(_0x15de89,null))[_0xa8b0('0x22')](function(_0x179a41){if(_0x179a41){return _0x179a41[_0xa8b0('0x5d')](_0xd01ce4[_0xa8b0('0x32')][_0xa8b0('0x5e')]);}})[_0xa8b0('0x22')](respondWithStatusCode(_0x15de89,null))[_0xa8b0('0x50')](handleError(_0x15de89,null));};exports[_0xa8b0('0x5f')]=function(_0x174857,_0x3eb3c6){_0x174857[_0xa8b0('0x49')]['sitepic']=_0x174857[_0xa8b0('0x60')][_0xa8b0('0x61')];return db[_0xa8b0('0x2c')][_0xa8b0('0x4e')]({'where':{'id':_0x174857[_0xa8b0('0x52')]['id']}})[_0xa8b0('0x22')](handleEntityNotFound(_0x3eb3c6,null))[_0xa8b0('0x22')](saveUpdates(_0x174857['body'],null))[_0xa8b0('0x22')](respondWithResult(_0x3eb3c6,null))['catch'](handleError(_0x3eb3c6,null));};exports[_0xa8b0('0x62')]=function(_0x115646,_0x176ced){_0x115646['body'][_0xa8b0('0x63')]=_0x115646[_0xa8b0('0x60')]['filename'];return db[_0xa8b0('0x2c')][_0xa8b0('0x4e')]({'where':{'id':_0x115646[_0xa8b0('0x52')]['id']}})[_0xa8b0('0x22')](handleEntityNotFound(_0x176ced,null))[_0xa8b0('0x22')](saveUpdates(_0x115646[_0xa8b0('0x49')],null))[_0xa8b0('0x22')](respondWithResult(_0x176ced,null))['catch'](handleError(_0x176ced,null));};exports[_0xa8b0('0x64')]=function(_0x32238a,_0x2e588c){_0x32238a[_0xa8b0('0x49')][_0xa8b0('0x65')]=_0x32238a[_0xa8b0('0x60')]['filename'];return db[_0xa8b0('0x2c')][_0xa8b0('0x4e')]({'where':{'id':_0x32238a[_0xa8b0('0x52')]['id']}})[_0xa8b0('0x22')](handleEntityNotFound(_0x2e588c,null))[_0xa8b0('0x22')](saveUpdates(_0x32238a[_0xa8b0('0x49')],null))[_0xa8b0('0x22')](respondWithResult(_0x2e588c,null))[_0xa8b0('0x50')](handleError(_0x2e588c,null));};exports['addSystemAvatar']=function(_0x3a505e,_0x36a7dc){_0x3a505e[_0xa8b0('0x49')][_0xa8b0('0x66')]=_0x3a505e[_0xa8b0('0x60')][_0xa8b0('0x61')];return db[_0xa8b0('0x2c')][_0xa8b0('0x4e')]({'where':{'id':_0x3a505e[_0xa8b0('0x52')]['id']}})[_0xa8b0('0x22')](handleEntityNotFound(_0x36a7dc,null))[_0xa8b0('0x22')](saveUpdates(_0x3a505e['body'],null))['then'](respondWithResult(_0x36a7dc,null))[_0xa8b0('0x50')](handleError(_0x36a7dc,null));};exports[_0xa8b0('0x67')]=function(_0x221e32,_0x46c6da){var _0x538a02=path[_0xa8b0('0x68')](config[_0xa8b0('0x69')],_0xa8b0('0x6a'));var _0x41ccd6={'where':{'id':_0x221e32['params']['id']},'attributes':['id',_0xa8b0('0x6b')],'raw':!![]};var _0x44b475=![];return require(_0xa8b0('0x6c'))['getLicense']()[_0xa8b0('0x22')](function(_0xa309d){if(_0xa309d){_0x44b475=_0xa309d[_0xa8b0('0x6d')];}})[_0xa8b0('0x22')](function(){return db['ChatWebsite'][_0xa8b0('0x4e')](_0x41ccd6);})[_0xa8b0('0x22')](handleEntityNotFound(_0x46c6da,null))[_0xa8b0('0x22')](function(_0x20128e){if(_0x20128e){if(!_['isNil'](_0x20128e[_0xa8b0('0x6b')])){if(fs[_0xa8b0('0x6e')](path[_0xa8b0('0x68')](config[_0xa8b0('0x69')],_0xa8b0('0x6f'),_0x20128e['sitepic']))&&_0x44b475){_0x538a02=path[_0xa8b0('0x68')](config[_0xa8b0('0x69')],'server/files/images/logos/',_0x20128e[_0xa8b0('0x6b')]);}}return _0x46c6da['download'](_0x538a02);}})[_0xa8b0('0x50')](handleError(_0x46c6da,null));};exports[_0xa8b0('0x70')]=function(_0x405c96,_0x457a97){var _0x505c4d=path[_0xa8b0('0x68')](config[_0xa8b0('0x69')],_0xa8b0('0x71'));var _0x332531={'where':{'id':_0x405c96[_0xa8b0('0x52')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0xa8b0('0x2c')][_0xa8b0('0x4e')](_0x332531)[_0xa8b0('0x22')](handleEntityNotFound(_0x457a97,null))['then'](function(_0x3a7760){if(_0x3a7760){if(!_[_0xa8b0('0x72')](_0x3a7760[_0xa8b0('0x63')])){if(fs[_0xa8b0('0x6e')](path[_0xa8b0('0x68')](config[_0xa8b0('0x69')],_0xa8b0('0x73'),_0x3a7760[_0xa8b0('0x63')]))){_0x505c4d=path[_0xa8b0('0x68')](config[_0xa8b0('0x69')],_0xa8b0('0x73'),_0x3a7760[_0xa8b0('0x63')]);}}return _0x457a97['download'](_0x505c4d);}})[_0xa8b0('0x50')](handleError(_0x457a97,null));};exports['getCustomerAvatar']=function(_0x30950c,_0xbbeaae){var _0x237a67=path['join'](config[_0xa8b0('0x69')],'server/files/images/avatars/customer_avatar.png');var _0x48aa5b={'where':{'id':_0x30950c[_0xa8b0('0x52')]['id']},'attributes':['id',_0xa8b0('0x65'),_0xa8b0('0x74')],'raw':!![]};return db[_0xa8b0('0x2c')][_0xa8b0('0x4e')](_0x48aa5b)['then'](handleEntityNotFound(_0xbbeaae,null))[_0xa8b0('0x22')](function(_0x8aa43a){if(_0x8aa43a){if(!_[_0xa8b0('0x72')](_0x8aa43a['customerAvatar'])){if(fs[_0xa8b0('0x6e')](path[_0xa8b0('0x68')](config[_0xa8b0('0x69')],_0xa8b0('0x73'),_0x8aa43a[_0xa8b0('0x65')]))&&_0x8aa43a[_0xa8b0('0x74')]){_0x237a67=path['join'](config[_0xa8b0('0x69')],_0xa8b0('0x73'),_0x8aa43a[_0xa8b0('0x65')]);}}return _0xbbeaae[_0xa8b0('0x75')](_0x237a67);}})['catch'](handleError(_0xbbeaae,null));};exports[_0xa8b0('0x76')]=function(_0x2c574c,_0x4fb081){var _0x47051d=path[_0xa8b0('0x68')](config[_0xa8b0('0x69')],_0xa8b0('0x77'));var _0x34c8fe={'where':{'id':_0x2c574c['params']['id']},'attributes':['id',_0xa8b0('0x66')],'raw':!![]};return db['ChatWebsite'][_0xa8b0('0x4e')](_0x34c8fe)['then'](handleEntityNotFound(_0x4fb081,null))[_0xa8b0('0x22')](function(_0x28ffa8){if(_0x28ffa8){if(!_[_0xa8b0('0x72')](_0x28ffa8[_0xa8b0('0x66')])){if(fs['existsSync'](path[_0xa8b0('0x68')](config['root'],_0xa8b0('0x73'),_0x28ffa8['systemAvatar']))){_0x47051d=path[_0xa8b0('0x68')](config[_0xa8b0('0x69')],_0xa8b0('0x73'),_0x28ffa8[_0xa8b0('0x66')]);}}return _0x4fb081[_0xa8b0('0x75')](_0x47051d);}})[_0xa8b0('0x50')](handleError(_0x4fb081,null));};exports['notify']=function(_0x3f9edf,_0x33d92f){var _0x290a6a=require(_0xa8b0('0x78'));var _0x24244e=new _0x290a6a();var _0x4be2d0=_0x24244e['setUA'](_0x3f9edf[_0xa8b0('0x79')][_0xa8b0('0x7a')])[_0xa8b0('0x7b')]();var _0x3ace2d={'body':_0x3f9edf[_0xa8b0('0x49')],'channel':_0xa8b0('0x7c')};var _0x5aa8c7=[];var _0x5d3ae4=[];var _0x48d36d={};var _0xc4926d=![];return db['CmContact'][_0xa8b0('0x53')]()[_0xa8b0('0x22')](function(_0x5c655a){if(!_0x5c655a){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x5aa8c7=_[_0xa8b0('0x7d')](_[_0xa8b0('0x33')](_0x5c655a),[_0xa8b0('0x7e'),_0xa8b0('0x7f')]);_0x5d3ae4=_[_0xa8b0('0x7d')](_['keys'](_0x5c655a),[_0xa8b0('0x7e'),'updatedAt',_0xa8b0('0x80'),_0xa8b0('0x81')]);if(_0x3f9edf[_0xa8b0('0x49')]['id']){delete _0x3f9edf[_0xa8b0('0x49')]['id'];}if(_['isNil'](_0x3f9edf[_0xa8b0('0x49')][_0xa8b0('0x82')])){throw new db[(_0xa8b0('0x83'))][(_0xa8b0('0x84'))](_0xa8b0('0x85'));}if(_[_0xa8b0('0x72')](_0x3f9edf['body'][_0xa8b0('0x49')])||_0x3f9edf[_0xa8b0('0x49')][_0xa8b0('0x49')]===''){throw new db[(_0xa8b0('0x83'))][(_0xa8b0('0x84'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x3f9edf[_0xa8b0('0x49')][_0xa8b0('0x86')])){throw new db[(_0xa8b0('0x83'))]['ValidationError'](_0xa8b0('0x87')+_0x5d3ae4);}if(!_[_0xa8b0('0x88')](_0x5d3ae4,_0x3f9edf[_0xa8b0('0x49')][_0xa8b0('0x86')])){throw new db[(_0xa8b0('0x83'))][(_0xa8b0('0x84'))](_0xa8b0('0x89')+_0x5d3ae4);}_0x48d36d[_0x3f9edf[_0xa8b0('0x49')][_0xa8b0('0x86')]]=_0x3f9edf[_0xa8b0('0x49')][_0xa8b0('0x82')];})[_0xa8b0('0x22')](function(){return db[_0xa8b0('0x2c')][_0xa8b0('0x4e')]({'where':{'id':_0x3f9edf['params']['id']},'include':[{'model':db[_0xa8b0('0x8a')],'as':_0xa8b0('0x8b'),'include':[{'model':db[_0xa8b0('0x8c')],'as':'Contacts','where':_0x48d36d,'limit':0x1,'order':[[_0xa8b0('0x7f'),'DESC']]}]},{'model':db[_0xa8b0('0x8d')],'as':_0xa8b0('0x8e')}]});})[_0xa8b0('0x22')](handleEntityNotFound(_0x33d92f,null))[_0xa8b0('0x22')](function(_0xb87e6c){if(_0xb87e6c&&_0xb87e6c[_0xa8b0('0x8b')]){_0x3ace2d[_0xa8b0('0x8f')]=_0xb87e6c;_0x3ace2d[_0xa8b0('0x90')]=_0xb87e6c['Applications'];_0x3ace2d[_0xa8b0('0x91')]=_0xb87e6c['List'];_0x3ace2d[_0xa8b0('0x90')]=_[_0xa8b0('0x92')](_0x3ace2d[_0xa8b0('0x90')],[_0xa8b0('0x93')],['asc']);if(_0x3ace2d[_0xa8b0('0x8f')]['Applications']){delete _0x3ace2d['account'][_0xa8b0('0x8e')];}if(_0x3ace2d[_0xa8b0('0x8f')][_0xa8b0('0x8b')]&&_0x3ace2d['account'][_0xa8b0('0x8b')][_0xa8b0('0x94')][_0xa8b0('0x39')]){return _0x3ace2d[_0xa8b0('0x8f')][_0xa8b0('0x8b')][_0xa8b0('0x94')][0x0];}var _0x2ba24e=_[_0xa8b0('0x95')](_0x3f9edf[_0xa8b0('0x49')],{'firstName':_0x3f9edf[_0xa8b0('0x49')][_0xa8b0('0x82')],'ListId':_0xb87e6c[_0xa8b0('0x81')]});_0x2ba24e[_0x3f9edf['body'][_0xa8b0('0x86')]]=_0x3f9edf['body'][_0xa8b0('0x82')];return db[_0xa8b0('0x8c')][_0xa8b0('0x48')](_0x2ba24e,{'fields':_0x5aa8c7,'raw':!![]});}})[_0xa8b0('0x22')](handleEntityNotFound(_0x33d92f,null))['then'](function(_0x40444a){_0x3ace2d[_0xa8b0('0x96')]=_0x40444a;var _0x59fe47=_0x3f9edf[_0xa8b0('0x49')][_0xa8b0('0x97')];if(_0x3f9edf['headers'][_0xa8b0('0x98')]){_0x59fe47=_0x3f9edf[_0xa8b0('0x79')][_0xa8b0('0x98')];}else if(_0x3f9edf[_0xa8b0('0x79')][_0xa8b0('0x99')]){_0x59fe47=_[_0xa8b0('0x9a')](_0x3f9edf[_0xa8b0('0x79')]['x-forwarded-for']['split'](','));}if(_0x40444a){var _0x524c0b={'ContactId':_0x40444a['id'],'ChatWebsiteId':_0x3f9edf[_0xa8b0('0x52')]['id'],'from':(_0x40444a[_0xa8b0('0x9b')]||'')+'\x20'+(_0x40444a['lastName']||''),'customerIp':_0x59fe47,'customerPort':_0x3f9edf[_0xa8b0('0x79')][_0xa8b0('0x9c')]?_0x3f9edf[_0xa8b0('0x79')][_0xa8b0('0x9c')]:null,'referer':_0x3f9edf[_0xa8b0('0x49')]['referer'],'browserName':_0x4be2d0['browser'][_0xa8b0('0x28')]&&_0x4be2d0[_0xa8b0('0x9d')]['version']?util['format'](_0xa8b0('0x9e'),_0x4be2d0[_0xa8b0('0x9d')][_0xa8b0('0x28')],_0x4be2d0[_0xa8b0('0x9d')][_0xa8b0('0x9f')]):'unknown','browserVersion':_0x4be2d0[_0xa8b0('0x9d')][_0xa8b0('0x9f')]||'unknown','osName':util[_0xa8b0('0xa0')](_0xa8b0('0x9e'),_0x4be2d0['os'][_0xa8b0('0x28')],_0x4be2d0['os'][_0xa8b0('0x9f')]),'osVersion':_0x4be2d0['os'][_0xa8b0('0x9f')],'deviceModel':_0x4be2d0[_0xa8b0('0xa1')]['model']&&_0x4be2d0[_0xa8b0('0xa1')][_0xa8b0('0xa2')]?util['format']('%s\x20%s\x20%s',_0x4be2d0[_0xa8b0('0xa1')][_0xa8b0('0x36')],_0x4be2d0[_0xa8b0('0xa1')][_0xa8b0('0xa2')],_0x4be2d0['device']['type']):null,'deviceVendor':_0x4be2d0[_0xa8b0('0xa1')][_0xa8b0('0xa2')],'deviceType':_0x4be2d0[_0xa8b0('0xa1')]['type'],'formData':JSON[_0xa8b0('0x16')](_0x3f9edf[_0xa8b0('0x49')])};var _0x449a05={'ChatWebsiteId':_0x3f9edf[_0xa8b0('0x52')]['id'],'closed':![]};if(_0x3f9edf[_0xa8b0('0x49')]['threadId']){_0x449a05['threadId']=_0x3f9edf[_0xa8b0('0x49')][_0xa8b0('0xa3')];return db[_0xa8b0('0xa4')][_0xa8b0('0x4e')]({'where':_0x449a05})[_0xa8b0('0x22')](function(_0x257c4a){if(_0x257c4a){return[_0x257c4a,![]];}_0x524c0b[_0xa8b0('0xa3')]=_0x3f9edf[_0xa8b0('0x49')][_0xa8b0('0xa3')];_0x524c0b[_0xa8b0('0xa5')]=_0x3f9edf['body'][_0xa8b0('0xa5')];return db[_0xa8b0('0xa4')][_0xa8b0('0x48')](_0x524c0b)[_0xa8b0('0x22')](function(_0xcc76b1){return[_0xcc76b1,!![]];});});}_0x449a05[_0xa8b0('0xa6')]=_0x40444a['id'];if(_0x3f9edf[_0xa8b0('0x49')][_0xa8b0('0xa7')]&&_0x3f9edf[_0xa8b0('0x49')][_0xa8b0('0xa7')]['id']){_0x449a05['id']=_0x3f9edf['body'][_0xa8b0('0xa7')]['id'];return db[_0xa8b0('0xa4')]['find']({'where':_0x449a05})[_0xa8b0('0x22')](function(_0x329f43){if(_0x329f43){return[_0x329f43,![]];}return db['ChatInteraction']['create'](_0x524c0b)[_0xa8b0('0x22')](function(_0x5de305){return[_0x5de305,!![]];});});}return db[_0xa8b0('0xa4')][_0xa8b0('0x48')](_0x524c0b)[_0xa8b0('0x22')](function(_0x44a123){return[_0x44a123,!![]];});}})[_0xa8b0('0xa8')](function(_0x434732,_0x3e9cd6){if(_0x434732){_0xc4926d=_0x3e9cd6;if(!_0x3e9cd6){var _0x47d3da={'from':(_0x3ace2d['contact']['firstName']||'')+'\x20'+(_0x3ace2d['contact'][_0xa8b0('0xa9')]||'')};if(_0x3f9edf[_0xa8b0('0x49')][_0xa8b0('0xa3')]&&_0x3f9edf[_0xa8b0('0x49')][_0xa8b0('0xaa')]&&_0x3f9edf[_0xa8b0('0x49')][_0xa8b0('0xa3')]!=_0x3f9edf[_0xa8b0('0x49')][_0xa8b0('0xaa')]){_0x47d3da[_0xa8b0('0xa3')]=_0x3f9edf[_0xa8b0('0x49')][_0xa8b0('0xaa')];}return _0x434732[_0xa8b0('0x21')](_0x47d3da);}else{return _0x434732;}}})[_0xa8b0('0x22')](function(_0x23f2b2){_0x3ace2d[_0xa8b0('0xa7')]=_0x23f2b2[_0xa8b0('0x24')]({'plain':!![]});_0x3ace2d[_0xa8b0('0xa7')][_0xa8b0('0xab')]=_0xc4926d;if(_0x3ace2d['interaction'][_0xa8b0('0xab')]){if(_0x3ace2d[_0xa8b0('0x8f')]['autoclose']){_0x3ace2d['applications'][_0xa8b0('0xac')]({'id':0x0,'priority':_0x3ace2d[_0xa8b0('0x90')]['length']+0x1,'app':_0xa8b0('0xad'),'appdata':_0xa8b0('0xae'),'interval':_0xa8b0('0xaf')});}}return db[_0xa8b0('0xb0')]['create']({'body':_0x3f9edf[_0xa8b0('0x49')][_0xa8b0('0x49')],'ChatWebsiteId':_0x3f9edf[_0xa8b0('0x52')]['id'],'ChatInteractionId':_0x23f2b2['id'],'direction':'in','ContactId':_0x3ace2d[_0xa8b0('0x96')]['id'],'AttachmentId':_0x3f9edf[_0xa8b0('0x49')][_0xa8b0('0xb1')]});})[_0xa8b0('0x22')](function(_0x1a6804){_0x3ace2d[_0xa8b0('0x18')]=_0x1a6804;if(_0x3ace2d[_0xa8b0('0xa7')][_0xa8b0('0xb2')]){return db[_0xa8b0('0xb3')][_0xa8b0('0x4e')]({'attributes':['id','name'],'where':{'id':_0x3ace2d[_0xa8b0('0xa7')][_0xa8b0('0xb2')]}})['then'](function(_0x310da3){if(_0x310da3){_0x3ace2d[_0xa8b0('0x90')][_0xa8b0('0xb4')]({'id':0x0,'priority':0x0,'app':_0xa8b0('0xb5'),'appdata':_0x310da3[_0xa8b0('0x28')]+','+(_0x3ace2d['account'][_0xa8b0('0xb6')]||0xa),'interval':_0xa8b0('0xaf')});_0x3ace2d[_0xa8b0('0xb7')]=!![];}return respondWithRpcPromise(_0xa8b0('0xb8'),_0xa8b0('0xb9'),_0x3ace2d);});}return respondWithRpcPromise(_0xa8b0('0xb8'),_0xa8b0('0xb9'),_0x3ace2d);})[_0xa8b0('0x22')](function(_0x37a253){respondWithRpcPromise(_0xa8b0('0xba'),_0xa8b0('0xba'),{'event':_0xa8b0('0xbb'),'message':_0x37a253},client9002);return _0x37a253;})[_0xa8b0('0x22')](respondWithResult(_0x33d92f,null))[_0xa8b0('0x50')](handleError(_0x33d92f,null));};exports[_0xa8b0('0xbc')]=function(_0x2bb615,_0x2cebe2){var _0x1a1e75,_0x127831,_0x58d13d;var _0x4cfc78=[];var _0x4c0cec={};var _0x54e882=_0x2bb615['files']||[];var _0x443550=[];var _0x3bd722;return db['CmContact'][_0xa8b0('0x53')]()['then'](function(_0x2374b9){if(!_0x2374b9){throw new db['Sequelize'][(_0xa8b0('0x84'))](_0xa8b0('0xbd'));}_0x4cfc78=_[_0xa8b0('0x7d')](_['keys'](_0x2374b9),[_0xa8b0('0x7e'),_0xa8b0('0x7f'),'CompanyId','ListId']);if(_0x2bb615[_0xa8b0('0x49')]['id']){delete _0x2bb615[_0xa8b0('0x49')]['id'];}if(_[_0xa8b0('0x72')](_0x2bb615['body']['from'])){throw _0x2cebe2[_0xa8b0('0x1b')](0x1f4)[_0xa8b0('0x29')](new db[(_0xa8b0('0x83'))][(_0xa8b0('0x84'))]('from\x20is\x20mandatory'));}if(_[_0xa8b0('0x72')](_0x2bb615[_0xa8b0('0x49')]['body'])||_0x2bb615['body'][_0xa8b0('0x49')]===''){throw _0x2cebe2['status'](0x1f4)[_0xa8b0('0x29')](new db['Sequelize'][(_0xa8b0('0x84'))](_0xa8b0('0xbe')));}if(_[_0xa8b0('0x72')](_0x2bb615['body'][_0xa8b0('0xbf')])){throw _0x2cebe2['status'](0x1f4)[_0xa8b0('0x29')](new db[(_0xa8b0('0x83'))][(_0xa8b0('0x84'))](_0xa8b0('0xc0')+_0x4cfc78));}if(!_[_0xa8b0('0x88')](_0x4cfc78,_0x2bb615[_0xa8b0('0x49')][_0xa8b0('0xbf')])){throw _0x2cebe2[_0xa8b0('0x1b')](0x1f4)['send'](new db[(_0xa8b0('0x83'))][(_0xa8b0('0x84'))](_0xa8b0('0xc1')+_0x4cfc78));}_0x4c0cec[_0x2bb615[_0xa8b0('0x49')][_0xa8b0('0xbf')]]=_0x2bb615[_0xa8b0('0x49')]['from'];})[_0xa8b0('0x22')](function(){return db[_0xa8b0('0x2c')][_0xa8b0('0x4e')]({'where':{'id':_0x2bb615[_0xa8b0('0x52')]['id']},'include':[{'model':db['CmList'],'as':'List'},{'model':db[_0xa8b0('0xc2')],'as':_0xa8b0('0xc2')}]});})[_0xa8b0('0x22')](handleEntityNotFound(_0x2cebe2,null))[_0xa8b0('0x22')](function(_0xd717ef){if(_0xd717ef&&_0xd717ef['List']){_0x127831=_0xd717ef;var _0xdb94df=_[_0xa8b0('0x95')](_0x2bb615[_0xa8b0('0x49')],{'firstName':_0x2bb615[_0xa8b0('0x49')][_0xa8b0('0x82')],'phone':_0x2bb615[_0xa8b0('0x49')][_0xa8b0('0x82')],'ListId':_0xd717ef[_0xa8b0('0x81')]});_0xdb94df[_0x2bb615[_0xa8b0('0x49')][_0xa8b0('0xbf')]]=_0x2bb615[_0xa8b0('0x49')][_0xa8b0('0x82')];return db[_0xa8b0('0x8c')][_0xa8b0('0xc3')]({'where':_0x4c0cec,'defaults':_0xdb94df});}})[_0xa8b0('0xa8')](function(_0x205d68){if(_0x205d68){_0x58d13d=_0x205d68;var _0xb23dbe=fs['readFileSync'](path[_0xa8b0('0x68')](config['root'],_0xa8b0('0xc4')),_0xa8b0('0xc5'));var _0x2888fe=ejs[_0xa8b0('0xc6')](_0xb23dbe,{'body':_[_0xa8b0('0xc7')](_0x2bb615[_0xa8b0('0x49')]['body']),'bodyTitle':_0x127831['offlineMessageBody']});return db[_0xa8b0('0xc8')][_0xa8b0('0x48')]({'body':_0x2888fe,'plainBody':htmlToText[_0xa8b0('0xc9')](_0x2888fe),'ContactId':_0x205d68['id'],'ChatWebsiteId':_0x127831['id']});}})[_0xa8b0('0x22')](function(_0x4f1c5d){_0x3bd722=_0x4f1c5d;if(_0x54e882[_0xa8b0('0x39')]){var _0x202e08=_0x54e882[_0xa8b0('0x31')](function(_0x30315c){return{'name':_0x30315c['originalname'],'basename':_0x30315c['filename'],'type':_0x30315c[_0xa8b0('0xca')],'ChatOfflineMessageId':_0x4f1c5d['id']};});_0x443550=_0x202e08['map'](_0x50f01d=>{var _0x2d5e91={'filename':_0x50f01d[_0xa8b0('0x28')],'path':path['join'](config[_0xa8b0('0x69')],_0xa8b0('0xcb'),_0xa8b0('0xcc'),_0xa8b0('0xcd'),_0xa8b0('0xce'),_0x50f01d[_0xa8b0('0xcf')])};return _0x2d5e91;});if(!_0x127831[_0xa8b0('0xd0')]){return db[_0xa8b0('0xd1')]['transaction'](function(_0x5d2ff9){return db[_0xa8b0('0xd2')][_0xa8b0('0xd3')](_0x202e08,{'transaction':_0x5d2ff9});});}}})['then'](function(){if(_0x3bd722){_0x1a1e75=_0x3bd722;return db['MailAccount'][_0xa8b0('0x57')]({'where':{'service':!![]},'include':[{'model':db[_0xa8b0('0xd4')],'as':_0xa8b0('0xd5'),'raw':!![],'include':[{'model':db[_0xa8b0('0xd6')],'as':_0xa8b0('0xd6'),'raw':!![]}]}]});}})[_0xa8b0('0x22')](function(_0x127e72){if(_0x127e72&&_0x127e72[_0xa8b0('0xd5')]&&_0x127831[_0xa8b0('0xd7')]&&_0x127831[_0xa8b0('0xd8')]){var _0x521502=_0x127e72['getSmtpOptions']();return respondWithRpcPromise(_0xa8b0('0xd9'),_0xa8b0('0xda'),{'account':_0x521502,'message':{'from':util[_0xa8b0('0xa0')](_0xa8b0('0xdb'),_0x127e72[_0xa8b0('0x28')],_0x127e72[_0xa8b0('0xdc')]||_0x127e72[_0xa8b0('0xd5')][_0xa8b0('0x4a')]),'to':_0x127831[_0xa8b0('0xd8')],'subject':_0x127831[_0xa8b0('0xdd')],'html':_0x1a1e75[_0xa8b0('0x49')],'attachments':_0x443550}},client9003)['then'](function(){return _0x1a1e75;})['catch'](function(_0x223a38){logger[_0xa8b0('0x17')](_0x223a38);});}})[_0xa8b0('0x22')](function(){if(_0x127831&&_0x127831[_0xa8b0('0xd0')]&&_0x127831[_0xa8b0('0xde')]){var _0x4eed3b=[];if(_0x54e882[_0xa8b0('0x39')]){_0x4eed3b=_0x54e882[_0xa8b0('0x31')](function(_0x4c6f05){return{'name':_0x4c6f05[_0xa8b0('0xdf')],'basename':_0x4c6f05[_0xa8b0('0x61')],'type':_0x4c6f05[_0xa8b0('0xca')],'ChatOfflineMessageId':_0x3bd722['id']};});}var _0x2723cb;if(!_[_0xa8b0('0x72')](_0x127831['subjectOffline'])){var _0x5a48bd=_[_0xa8b0('0x31')](_0x2bb615['body'],function(_0x14dd18){return _0x14dd18;});var _0x502305=_[_0xa8b0('0xe0')](_0x5a48bd)[0x0];var _0x54ccdf=_[_0xa8b0('0xe1')](_0x502305,function(_0x5e97a8){return _0x5e97a8;});_0x2723cb=_0x54ccdf[0x1][_0x127831[_0xa8b0('0xe2')]];}var _0x2b8a66={'from':_0x58d13d[_0xa8b0('0xdc')],'firstName':_0x58d13d['firstName'],'lastName':_0x58d13d['lastName'],'mapKey':_0xa8b0('0xdc'),'message':{'from':_0x58d13d[_0xa8b0('0xdc')],'to':_0x127831[_0xa8b0('0xc2')][_0xa8b0('0xdc')],'cc':'','subject':_[_0xa8b0('0x72')](_0x2723cb)?_0x127831[_0xa8b0('0xdd')]:_0x2723cb,'messageId':'','sentAt':new Date(),'attach':_0x4eed3b[_0xa8b0('0x39')],'attachments':_0x4eed3b,'originChannel':_0xa8b0('0xe3'),'ChatWebsiteId':_0x127831['id'],'ChatOfflineMessageId':_0x1a1e75['id'],'originTo':_0x127831[_0xa8b0('0xc2')][_0xa8b0('0xdc')]},'body':_0x1a1e75[_0xa8b0('0x49')]};var _0x39ff88={'account':{'id':_0x127831['MailAccountId']},'body':_0x2b8a66,'log':_0xa8b0('0xe4')};return respondWithRpcPromise(_0xa8b0('0xe4'),'notifyMail',_0x39ff88,client9001)[_0xa8b0('0x22')](function(){return _0x1a1e75;})[_0xa8b0('0x50')](function(_0x2abc28){logger[_0xa8b0('0x17')](_0x2abc28);});}return;})[_0xa8b0('0x22')](function(){if(_0x1a1e75){return _0x1a1e75;}})['then'](respondWithResult(_0x2cebe2,null))[_0xa8b0('0x50')](function(_0x5922ba){logger[_0xa8b0('0x17')](_0xa8b0('0x50'),_0x5922ba);for(var _0x5ad0ce of _0x54e882){var _0x56f00c=path[_0xa8b0('0x68')](config[_0xa8b0('0x69')],_0xa8b0('0xcb'),_0xa8b0('0xcc'),'attachments','offline-chat',_0x5ad0ce['filename']);fs_extra[_0xa8b0('0xe5')](_0x56f00c)['catch'](function(_0x19c94c){logger['error'](_0xa8b0('0xe6'),_0x56f00c,_0x19c94c);});}});};exports['addInteraction']=function(_0x4d9a18,_0x41d749){return db['ChatInteraction']['find']({'where':{'id':_0x4d9a18[_0xa8b0('0x52')]['id']}})[_0xa8b0('0x22')](handleEntityNotFound(_0x41d749,null))[_0xa8b0('0x22')](function(_0x59fa41){if(_0x59fa41){return _0x59fa41[_0xa8b0('0xe7')](_0x4d9a18[_0xa8b0('0x49')]['ids'],_['omit'](_0x4d9a18['body'],[_0xa8b0('0x5e'),'id'])||{});}})['then'](respondWithResult(_0x41d749,null))[_0xa8b0('0x50')](handleError(_0x41d749,null));};exports['getInteractions']=function(_0xbcb126,_0x48a465){var _0x335af4={'raw':![],'where':{}};var _0x519b8e={};var _0x1d7e4f={'count':0x0,'rows':[]};return db[_0xa8b0('0x2c')][_0xa8b0('0x57')]({'where':{'id':_0xbcb126[_0xa8b0('0x52')]['id']}})[_0xa8b0('0x22')](handleEntityNotFound(_0x48a465,null))['then'](function(_0x78956e){if(_0x78956e){_0x519b8e[_0xa8b0('0x36')]=_[_0xa8b0('0x33')](db[_0xa8b0('0xa4')][_0xa8b0('0x2d')]);_0x519b8e['query']=_[_0xa8b0('0x33')](_0xbcb126[_0xa8b0('0x32')]);_0x519b8e[_0xa8b0('0x34')]=_['intersection'](_0x519b8e[_0xa8b0('0x36')],_0x519b8e[_0xa8b0('0x32')]);_0x335af4[_0xa8b0('0x37')]=_['intersection'](_0x519b8e[_0xa8b0('0x36')],qs[_0xa8b0('0x38')](_0xbcb126[_0xa8b0('0x32')]['fields']));_0x335af4[_0xa8b0('0x37')]=_0x335af4[_0xa8b0('0x37')]['length']?_0x335af4[_0xa8b0('0x37')]:_0x519b8e['model'];if(!_0xbcb126[_0xa8b0('0x32')][_0xa8b0('0x58')](_0xa8b0('0x3a'))){_0x335af4[_0xa8b0('0x3b')]=qs[_0xa8b0('0x3b')](_0xbcb126[_0xa8b0('0x32')][_0xa8b0('0x3b')]);_0x335af4[_0xa8b0('0x1e')]=qs[_0xa8b0('0x1e')](_0xbcb126[_0xa8b0('0x32')][_0xa8b0('0x1e')]);}_0x335af4[_0xa8b0('0x59')]=qs[_0xa8b0('0x3c')](_0xbcb126[_0xa8b0('0x32')]['sort']);_0x335af4['where']=qs[_0xa8b0('0x34')](_[_0xa8b0('0x3d')](_0xbcb126[_0xa8b0('0x32')],_0x519b8e[_0xa8b0('0x34')]));_0x335af4[_0xa8b0('0x3f')][_0xa8b0('0x55')]=_0x78956e['id'];if(_0xbcb126[_0xa8b0('0x32')][_0xa8b0('0x3e')]){_0x335af4[_0xa8b0('0x3f')]=_[_0xa8b0('0x41')](_0x335af4['where'],{'$or':_[_0xa8b0('0x31')](_0x335af4[_0xa8b0('0x37')],function(_0x2d3173){var _0x1bd2dd={};_0x1bd2dd[_0x2d3173]={'$like':'%'+_0xbcb126['query'][_0xa8b0('0x3e')]+'%'};return _0x1bd2dd;})});}_0x335af4=_[_0xa8b0('0x41')]({},_0x335af4,_0xbcb126['options']);return db[_0xa8b0('0xa4')][_0xa8b0('0x20')]({'where':_0x335af4[_0xa8b0('0x3f')]})[_0xa8b0('0x22')](function(_0x2b3b02){_0x1d7e4f[_0xa8b0('0x20')]=_0x2b3b02;if(_0xbcb126[_0xa8b0('0x32')][_0xa8b0('0x43')]){_0x335af4[_0xa8b0('0x44')]=[{'model':db[_0xa8b0('0x8c')],'as':_0xa8b0('0xe8'),'required':![]},{'model':db[_0xa8b0('0xb3')],'as':_0xa8b0('0xe9'),'attributes':['name',_0xa8b0('0xea'),'internal'],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xa8b0('0x28'),_0xa8b0('0xeb')],'where':_0xbcb126[_0xa8b0('0x32')]['tag']?{'id':_0xbcb126['query'][_0xa8b0('0xec')]}:undefined,'required':_0xbcb126[_0xa8b0('0x32')][_0xa8b0('0xec')]?!![]:![]}];}return db['ChatInteraction'][_0xa8b0('0x45')](_0x335af4);})['then'](function(_0x57a49f){_0x1d7e4f[_0xa8b0('0x46')]=_0x57a49f;return _0x1d7e4f;});}})[_0xa8b0('0x22')](respondWithFilteredResult(_0x48a465,_0x335af4))[_0xa8b0('0x50')](handleError(_0x48a465,null));};function iftimePromise(_0x402b58,_0x4f3de7){return respondWithRpcPromise(_0xa8b0('0xed'),'getSnippet',{'command':_0x4f3de7['timezone']?util[_0xa8b0('0xa0')]('iftime\x20%s,%s',_0x402b58[_0xa8b0('0xee')],_0x4f3de7[_0xa8b0('0xef')]):util[_0xa8b0('0xa0')](_0xa8b0('0xf0'),_0x402b58[_0xa8b0('0xee')])},client9002)['then'](function(_0x2b0018){var _0x3a4c3c=_0x2b0018&&_0x2b0018['indexOf']('true')>=0x0?!![]:![];logger[_0xa8b0('0x13')](_0xa8b0('0xf1'),_0x4f3de7['id'],_0x402b58['id'],_0x402b58[_0xa8b0('0xee')],_0x3a4c3c?_0xa8b0('0xf2'):_0xa8b0('0xf3'),_0x4f3de7['timezone']?_0x4f3de7[_0xa8b0('0xef')]:_0xa8b0('0xf4'));return _0x3a4c3c;})[_0xa8b0('0x50')](function(_0x52d601){logger[_0xa8b0('0x17')](_0xa8b0('0xf1'),_0x4f3de7['id'],_0x402b58['id'],_0x402b58['interval'],util[_0xa8b0('0xf5')](_0x52d601,{'showHidden':![],'depth':null}),_0x4f3de7[_0xa8b0('0xef')]?_0x4f3de7['timezone']:'No\x20timezone');return![];});}exports[_0xa8b0('0xf6')]=function(_0x574671,_0x499a2c){var _0x1d2af0=0x0;var _0xf95c65=0x0;var _0x8e9cdf=![];var _0xd4a62c;var _0x11fe97;return db[_0xa8b0('0x2c')][_0xa8b0('0x4e')]({'where':{'id':_0x574671['params']['id']},'include':[{'model':db[_0xa8b0('0xf7')],'as':'Interval','include':[{'model':db[_0xa8b0('0xf7')],'as':_0xa8b0('0xf8'),'attributes':['id',_0xa8b0('0xee')],'raw':!![]}]}]})[_0xa8b0('0x22')](handleEntityNotFound(_0x499a2c,null))['then'](function(_0x243efb){if(_0x243efb){_0xd4a62c=_0x243efb;return _0x243efb[_0xa8b0('0xf9')]({'raw':!![]});}})[_0xa8b0('0x22')](function(_0x1b1e57){if(_0xd4a62c){if(_0x1b1e57){_0x11fe97=_0x1b1e57;}}return require(_0xa8b0('0x6c'))[_0xa8b0('0xfa')]();})['then'](function(_0x5106fb){if(_0x5106fb){_0xf95c65=_0x5106fb[_0xa8b0('0xfb')];_0x8e9cdf=_0x5106fb['custom'];}})[_0xa8b0('0x22')](function(){return db[_0xa8b0('0xa4')][_0xa8b0('0x20')]({'where':{'closed':![]}});})[_0xa8b0('0x22')](function(_0x21b33e){_0x1d2af0=_0x21b33e;if(_0xf95c65&&_0x21b33e>_0xf95c65){return db[_0xa8b0('0xfc')][_0xa8b0('0x57')]({'where':{'id':0x1}})[_0xa8b0('0x22')](function(_0x32a4e0){if(_0x32a4e0){_0x32a4e0[_0xa8b0('0xfd')]('chatLicenseExceeded');}});}})[_0xa8b0('0x22')](function(){if(_0xd4a62c[_0xa8b0('0xf7')]&&_0xd4a62c[_0xa8b0('0xf7')][_0xa8b0('0xf8')]){var _0x278acc=[];for(var _0x5e301d=0x0;_0x5e301d<_0xd4a62c['Interval'][_0xa8b0('0xf8')][_0xa8b0('0x39')];_0x5e301d++){var _0x40d5f8=_0xd4a62c['Interval']['Intervals'][_0x5e301d][_0xa8b0('0x24')]({'plain':!![]});_0x278acc[_0xa8b0('0xac')](iftimePromise(_0x40d5f8,_0xd4a62c));}return BPromise[_0xa8b0('0xfe')](_0x278acc)[_0xa8b0('0x22')](function(_0x278483){return _[_0xa8b0('0xff')](_0x278483);});}else{return!![];}})[_0xa8b0('0x22')](function(_0x5303e2){var _0x3e91fd=fs[_0xa8b0('0x100')](path['join'](config[_0xa8b0('0x69')],_0xa8b0('0x101')),'utf8');var _0x300319=new url['URL'](_0xd4a62c['address'])[_0xa8b0('0x102')];var _0x5874be='3.1.0';var _0x104c9f=![];var _0x3a84a0={'chatVersion':_0x5874be,'chatWebsiteAddressOrigin':_0x300319,'remote':_0xd4a62c[_0xa8b0('0x103')],'query':querystring['stringify'](_['merge'](_0xd4a62c[_0xa8b0('0x24')]({'plain':!![]}),{'customerIp':_0x574671[_0xa8b0('0x79')][_0xa8b0('0x99')]||_0x574671[_0xa8b0('0x79')][_0xa8b0('0x104')]||_0x574671[_0xa8b0('0x105')][_0xa8b0('0x106')]||_0x574671['ip'],'referer':_0x574671[_0xa8b0('0x79')][_0xa8b0('0x107')],'openedInteractions':_0x1d2af0,'maxInteractions':_0xf95c65,'virtual':_0x8e9cdf['virtual'],'online':_0x5303e2,'custom':_0x8e9cdf}))[_0xa8b0('0x108')](/'/g,'\x5c\x27')};_0x499a2c[_0xa8b0('0x29')](ejs[_0xa8b0('0xc6')](Mustache[_0xa8b0('0xc6')](_0x3e91fd,_0x3a84a0),{'proactiveActions':_0x11fe97,'alignment':_0xd4a62c[_0xa8b0('0x109')],'verticalAlignment':_0xd4a62c[_0xa8b0('0x10a')],'div_color':_0xd4a62c[_0xa8b0('0xeb')],'labelText':_0xd4a62c['labelText'],'text_color':_0xd4a62c[_0xa8b0('0x10b')],'text_button_color':_0xd4a62c[_0xa8b0('0x10c')],'button_color':_0xd4a62c[_0xa8b0('0x10d')],'background_color':_0xd4a62c[_0xa8b0('0x10e')],'hideWhenOffline':_0xd4a62c['hideWhenOffline'],'intervalId':_0xd4a62c[_0xa8b0('0x10f')],'isDevelopment':_0x104c9f,'chatVersion':_0x5874be}));})[_0xa8b0('0x50')](handleError(_0x499a2c,null));};exports['addApplications']=function(_0xfea279,_0x2c8aa2){var _0x408e3e=_0xfea279['params']['id'];var _0x192e8d=_0xfea279[_0xa8b0('0x49')];var _0x3c9122=0xc8;var _0x3c5540=null;return db['sequelize']['transaction']({'isolationLevel':db[_0xa8b0('0xd1')][_0xa8b0('0x110')]['ISOLATION_LEVELS'][_0xa8b0('0x111')]},function(_0xe7fbd8){return db['ChatWebsite']['findOne']({'where':{'id':_0x408e3e},'transaction':_0xe7fbd8})[_0xa8b0('0x22')](function(_0x548a31){if(_0x548a31){return db[_0xa8b0('0x8d')][_0xa8b0('0x23')]({'where':{'ChatWebsiteId':_0x408e3e},'transaction':_0xe7fbd8})['then'](function(){var _0x149af2=_[_0xa8b0('0x31')](_0x192e8d,function(_0x537013){_0x537013[_0xa8b0('0x55')]=_0x408e3e;return _0x537013;});return db[_0xa8b0('0x8d')][_0xa8b0('0xd3')](_0x149af2,{'transaction':_0xe7fbd8});});}else{_0x3c9122=0x194;_0x3c5540=[];}});})[_0xa8b0('0x22')](function(){if(_0x3c9122!==0x194){return db[_0xa8b0('0x8d')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x408e3e},'order':_0xa8b0('0x93')})['then'](function(_0x5d0875){_0x3c5540=_0x5d0875;});}})[_0xa8b0('0x50')](function(_0x5b4739){_0x3c9122=0x1f4;logger['error'](_0x5b4739[_0xa8b0('0x27')]);if(_0x5b4739[_0xa8b0('0x28')]){delete _0x5b4739[_0xa8b0('0x28')];}_0x3c5540=_0x5b4739;})[_0xa8b0('0x112')](function(){if(_0x3c5540===null){_0x2c8aa2[_0xa8b0('0x1a')](_0x3c9122);}else{if(_0x3c9122===0x1f4){_0x2c8aa2[_0xa8b0('0x1b')](_0x3c9122)[_0xa8b0('0x29')](_0x3c5540);}else{_0x2c8aa2[_0xa8b0('0x1b')](_0x3c9122)['json'](_0x3c5540);}}});};exports[_0xa8b0('0x113')]=function(_0x34bd37,_0x20b74c){var _0x1596c5={};var _0x37cd05={};var _0x3e8b2f;var _0x592dd7;return db[_0xa8b0('0x2c')][_0xa8b0('0x57')]({'where':{'id':_0x34bd37['params']['id']}})['then'](handleEntityNotFound(_0x20b74c,null))[_0xa8b0('0x22')](function(_0x536e8f){if(_0x536e8f){_0x3e8b2f=_0x536e8f;_0x37cd05[_0xa8b0('0x36')]=_[_0xa8b0('0x33')](db[_0xa8b0('0x8d')][_0xa8b0('0x2d')]);_0x37cd05[_0xa8b0('0x32')]=_['keys'](_0x34bd37[_0xa8b0('0x32')]);_0x37cd05[_0xa8b0('0x34')]=_['intersection'](_0x37cd05[_0xa8b0('0x36')],_0x37cd05[_0xa8b0('0x32')]);_0x1596c5[_0xa8b0('0x37')]=_[_0xa8b0('0x35')](_0x37cd05['model'],qs[_0xa8b0('0x38')](_0x34bd37[_0xa8b0('0x32')]['fields']));_0x1596c5['attributes']=_0x1596c5[_0xa8b0('0x37')][_0xa8b0('0x39')]?_0x1596c5['attributes']:_0x37cd05['model'];_0x1596c5[_0xa8b0('0x59')]=qs[_0xa8b0('0x3c')](_0x34bd37['query'][_0xa8b0('0x3c')]);_0x1596c5[_0xa8b0('0x3f')]=qs[_0xa8b0('0x34')](_[_0xa8b0('0x3d')](_0x34bd37['query'],_0x37cd05[_0xa8b0('0x34')]));if(_0x34bd37[_0xa8b0('0x32')][_0xa8b0('0x3e')]){_0x1596c5[_0xa8b0('0x3f')]=_[_0xa8b0('0x41')](_0x1596c5[_0xa8b0('0x3f')],{'$or':_[_0xa8b0('0x31')](_0x1596c5[_0xa8b0('0x37')],function(_0xe82eca){var _0x4f80ba={};_0x4f80ba[_0xe82eca]={'$like':'%'+_0x34bd37[_0xa8b0('0x32')]['filter']+'%'};return _0x4f80ba;})});}_0x1596c5=_[_0xa8b0('0x41')]({},_0x1596c5,_0x34bd37[_0xa8b0('0x42')]);return _0x3e8b2f[_0xa8b0('0x113')](_0x1596c5);}})['then'](function(_0x3cdf44){if(_0x3cdf44){_0x592dd7=_0x3cdf44[_0xa8b0('0x39')];if(!_0x34bd37[_0xa8b0('0x32')]['hasOwnProperty'](_0xa8b0('0x3a'))){_0x1596c5[_0xa8b0('0x3b')]=qs[_0xa8b0('0x3b')](_0x34bd37[_0xa8b0('0x32')]['limit']);_0x1596c5[_0xa8b0('0x1e')]=qs[_0xa8b0('0x1e')](_0x34bd37[_0xa8b0('0x32')]['offset']);}return _0x3e8b2f[_0xa8b0('0x113')](_0x1596c5);}})[_0xa8b0('0x22')](function(_0x3c3da5){if(_0x3c3da5){return _0x3c3da5?{'count':_0x592dd7,'rows':_0x3c3da5}:null;}})[_0xa8b0('0x22')](respondWithResult(_0x20b74c,null))[_0xa8b0('0x50')](handleError(_0x20b74c,null));};exports['addProactiveActions']=function(_0xf1f412,_0x8dcccf){return db[_0xa8b0('0x114')]['find']({'where':{'id':_0xf1f412[_0xa8b0('0x52')]['id']}})[_0xa8b0('0x22')](handleEntityNotFound(_0x8dcccf,null))[_0xa8b0('0x22')](function(_0x2163fd){if(_0x2163fd){return _0x2163fd[_0xa8b0('0x115')](_0xf1f412[_0xa8b0('0x49')][_0xa8b0('0x5e')],_[_0xa8b0('0x116')](_0xf1f412[_0xa8b0('0x49')],[_0xa8b0('0x5e'),'id'])||{});}})[_0xa8b0('0x22')](respondWithResult(_0x8dcccf,null))[_0xa8b0('0x50')](handleError(_0x8dcccf,null));};exports['getProactiveActions']=function(_0x51cd6c,_0x3bc9c2){var _0x3f4865={};var _0x3a610e={};var _0x10d654;var _0x3a9167;return db[_0xa8b0('0x2c')][_0xa8b0('0x57')]({'where':{'id':_0x51cd6c['params']['id']}})['then'](handleEntityNotFound(_0x3bc9c2,null))['then'](function(_0xb0a477){if(_0xb0a477){_0x10d654=_0xb0a477;_0x3a610e[_0xa8b0('0x36')]=_[_0xa8b0('0x33')](db[_0xa8b0('0x117')][_0xa8b0('0x2d')]);_0x3a610e[_0xa8b0('0x32')]=_['keys'](_0x51cd6c[_0xa8b0('0x32')]);_0x3a610e[_0xa8b0('0x34')]=_[_0xa8b0('0x35')](_0x3a610e[_0xa8b0('0x36')],_0x3a610e[_0xa8b0('0x32')]);_0x3f4865['attributes']=_[_0xa8b0('0x35')](_0x3a610e[_0xa8b0('0x36')],qs[_0xa8b0('0x38')](_0x51cd6c[_0xa8b0('0x32')]['fields']));_0x3f4865[_0xa8b0('0x37')]=_0x3f4865[_0xa8b0('0x37')]['length']?_0x3f4865[_0xa8b0('0x37')]:_0x3a610e[_0xa8b0('0x36')];_0x3f4865[_0xa8b0('0x59')]=qs[_0xa8b0('0x3c')](_0x51cd6c[_0xa8b0('0x32')]['sort']);_0x3f4865[_0xa8b0('0x3f')]=qs['filters'](_[_0xa8b0('0x3d')](_0x51cd6c['query'],_0x3a610e[_0xa8b0('0x34')]));if(_0x51cd6c['query'][_0xa8b0('0x3e')]){_0x3f4865['where']=_[_0xa8b0('0x41')](_0x3f4865[_0xa8b0('0x3f')],{'$or':_[_0xa8b0('0x31')](_0x3f4865[_0xa8b0('0x37')],function(_0x58adfb){var _0x2abd0a={};_0x2abd0a[_0x58adfb]={'$like':'%'+_0x51cd6c[_0xa8b0('0x32')][_0xa8b0('0x3e')]+'%'};return _0x2abd0a;})});}_0x3f4865=_[_0xa8b0('0x41')]({},_0x3f4865,_0x51cd6c[_0xa8b0('0x42')]);return _0x10d654[_0xa8b0('0xf9')](_0x3f4865);}})[_0xa8b0('0x22')](function(_0x470d82){if(_0x470d82){_0x3a9167=_0x470d82[_0xa8b0('0x39')];if(!_0x51cd6c[_0xa8b0('0x32')]['hasOwnProperty'](_0xa8b0('0x3a'))){_0x3f4865[_0xa8b0('0x3b')]=qs[_0xa8b0('0x3b')](_0x51cd6c['query']['limit']);_0x3f4865[_0xa8b0('0x1e')]=qs[_0xa8b0('0x1e')](_0x51cd6c[_0xa8b0('0x32')][_0xa8b0('0x1e')]);}return _0x10d654[_0xa8b0('0xf9')](_0x3f4865);}})[_0xa8b0('0x22')](function(_0x31d332){if(_0x31d332){return _0x31d332?{'count':_0x3a9167,'rows':_0x31d332}:null;}})[_0xa8b0('0x22')](respondWithResult(_0x3bc9c2,null))[_0xa8b0('0x50')](handleError(_0x3bc9c2,null));};exports[_0xa8b0('0x118')]=function(_0x481bd1,_0x57edee){var _0x25cca5=_0x481bd1[_0xa8b0('0x32')][_0xa8b0('0x119')]===_0xa8b0('0x11a')?_0xa8b0('0x11b'):'onlineForm';return db[_0xa8b0('0x2c')][_0xa8b0('0x4e')]({'attributes':['id',_0x25cca5],'where':{'id':_0x481bd1[_0xa8b0('0x52')]['id']}})[_0xa8b0('0x22')](handleEntityNotFound(_0x57edee,null))['then'](function(_0x6af93c){if(_0x6af93c){var _0x169cfb=_0x6af93c[_0x25cca5];var _0x2b2ddb=_0x169cfb&&_0x169cfb[_0xa8b0('0x11c')]?_0x169cfb[_0xa8b0('0x11c')]:[];_0x57edee[_0xa8b0('0x29')]({'fromKey':_[_0xa8b0('0x72')](_0x169cfb[_0xa8b0('0x11d')])?undefined:_0x169cfb[_0xa8b0('0x11d')],'count':_0x2b2ddb[_0xa8b0('0x39')],'rows':_0x2b2ddb});}})[_0xa8b0('0x50')](handleError(_0x57edee,null));};exports[_0xa8b0('0x11e')]=function(_0x6306a6,_0x2b3096){var _0x4d9228={'raw':![],'where':{}};var _0x599f8d={};var _0x5335bb={'count':0x0,'rows':[]};return db[_0xa8b0('0x2c')]['findOne']({'where':{'id':_0x6306a6['params']['id']}})[_0xa8b0('0x22')](handleEntityNotFound(_0x2b3096,null))['then'](function(_0x12a159){if(_0x12a159){_0x599f8d[_0xa8b0('0x36')]=_[_0xa8b0('0x33')](db[_0xa8b0('0xc8')]['rawAttributes']);_0x599f8d[_0xa8b0('0x32')]=_[_0xa8b0('0x33')](_0x6306a6[_0xa8b0('0x32')]);_0x599f8d['filters']=_['intersection'](_0x599f8d[_0xa8b0('0x36')],_0x599f8d['query']);_0x4d9228['attributes']=_['intersection'](_0x599f8d['model'],qs[_0xa8b0('0x38')](_0x6306a6[_0xa8b0('0x32')][_0xa8b0('0x38')]));_0x4d9228[_0xa8b0('0x37')]=_0x4d9228[_0xa8b0('0x37')][_0xa8b0('0x39')]?_0x4d9228['attributes']:_0x599f8d[_0xa8b0('0x36')];if(!_0x6306a6['query']['hasOwnProperty'](_0xa8b0('0x3a'))){_0x4d9228['limit']=qs['limit'](_0x6306a6[_0xa8b0('0x32')][_0xa8b0('0x3b')]);_0x4d9228['offset']=qs[_0xa8b0('0x1e')](_0x6306a6[_0xa8b0('0x32')][_0xa8b0('0x1e')]);}_0x4d9228[_0xa8b0('0x59')]=qs[_0xa8b0('0x3c')](_0x6306a6[_0xa8b0('0x32')][_0xa8b0('0x3c')]);_0x4d9228[_0xa8b0('0x3f')]=qs['filters'](_[_0xa8b0('0x3d')](_0x6306a6[_0xa8b0('0x32')],_0x599f8d[_0xa8b0('0x34')]));_0x4d9228['where'][_0xa8b0('0x55')]=_0x12a159['id'];if(_0x6306a6[_0xa8b0('0x32')][_0xa8b0('0x3e')]){_0x4d9228[_0xa8b0('0x3f')]=_[_0xa8b0('0x41')](_0x4d9228[_0xa8b0('0x3f')],{'$or':_[_0xa8b0('0x31')](_0x4d9228[_0xa8b0('0x37')],function(_0x17a587){var _0x59a09c={};_0x59a09c[_0x17a587]={'$like':'%'+_0x6306a6[_0xa8b0('0x32')][_0xa8b0('0x3e')]+'%'};return _0x59a09c;})});}_0x4d9228=_[_0xa8b0('0x41')]({},_0x4d9228,_0x6306a6[_0xa8b0('0x42')]);return db[_0xa8b0('0xc8')][_0xa8b0('0x20')]({'where':_0x4d9228[_0xa8b0('0x3f')]})[_0xa8b0('0x22')](function(_0x29a9f7){_0x5335bb[_0xa8b0('0x20')]=_0x29a9f7;if(_0x6306a6['query'][_0xa8b0('0x43')]){_0x4d9228[_0xa8b0('0x44')]=[{'all':!![]}];}else{_0x4d9228['include']=[{'model':db['CmContact'],'as':_0xa8b0('0xe8'),'required':![]},{'model':db[_0xa8b0('0xd2')],'as':_0xa8b0('0x11f'),'required':![]}];}return db['ChatOfflineMessage']['findAll'](_0x4d9228);})['then'](function(_0x1df89d){_0x5335bb['rows']=_0x1df89d;return _0x5335bb;});}})[_0xa8b0('0x22')](respondWithFilteredResult(_0x2b3096,_0x4d9228))[_0xa8b0('0x50')](handleError(_0x2b3096,null));};exports[_0xa8b0('0x120')]=function(_0x131379,_0x9e5c8f){return db[_0xa8b0('0x2c')]['find']({'where':{'id':_0x131379[_0xa8b0('0x52')]['id']}})['then'](handleEntityNotFound(_0x9e5c8f,null))['then'](function(_0x3b43fc){if(_0x3b43fc){return _0x3b43fc['addAgents'](_0x131379['body']['ids'],_[_0xa8b0('0x116')](_0x131379[_0xa8b0('0x49')],['ids','id'])||{})[_0xa8b0('0xa8')](function(_0x498fa1){for(var _0x727ee7=0x0;_0x727ee7<_0x131379['body'][_0xa8b0('0x5e')]['length'];_0x727ee7+=0x1){socket[_0xa8b0('0x121')](_0xa8b0('0x122'),{'UserId':Number(_0x131379[_0xa8b0('0x49')][_0xa8b0('0x5e')][_0x727ee7]),'ChatWebsiteId':Number(_0x131379[_0xa8b0('0x52')]['id'])});}return _0x498fa1;});}})[_0xa8b0('0x22')](respondWithResult(_0x9e5c8f,null))[_0xa8b0('0x50')](handleError(_0x9e5c8f,null));};exports[_0xa8b0('0x123')]=function(_0x190ca6,_0x5da136){return db[_0xa8b0('0x2c')]['find']({'where':{'id':_0x190ca6['params']['id']}})[_0xa8b0('0x22')](handleEntityNotFound(_0x5da136,null))[_0xa8b0('0x22')](function(_0x1b4f7a){if(_0x1b4f7a){return _0x1b4f7a[_0xa8b0('0x123')](_0x190ca6[_0xa8b0('0x32')][_0xa8b0('0x5e')])['then'](function(){if(_[_0xa8b0('0x124')](_0x190ca6['query'][_0xa8b0('0x5e')])){for(var _0x446183=0x0;_0x446183<_0x190ca6[_0xa8b0('0x32')]['ids'][_0xa8b0('0x39')];_0x446183+=0x1){socket[_0xa8b0('0x121')](_0xa8b0('0x125'),{'UserId':Number(_0x190ca6[_0xa8b0('0x32')][_0xa8b0('0x5e')][_0x446183]),'ChatWebsiteId':Number(_0x190ca6[_0xa8b0('0x52')]['id'])});}}else{socket[_0xa8b0('0x121')]('userChatWebsite:remove',{'UserId':Number(_0x190ca6['query'][_0xa8b0('0x5e')]),'ChatWebsiteId':Number(_0x190ca6[_0xa8b0('0x52')]['id'])});}});}})['then'](respondWithStatusCode(_0x5da136,null))[_0xa8b0('0x50')](handleError(_0x5da136,null));};exports[_0xa8b0('0x126')]=function(_0x5e76b5,_0x549d97){var _0x541c7f={};var _0x718332={};var _0x64e82b;var _0x7f5526;return db[_0xa8b0('0x2c')][_0xa8b0('0x57')]({'where':{'id':_0x5e76b5[_0xa8b0('0x52')]['id']}})['then'](handleEntityNotFound(_0x549d97,null))[_0xa8b0('0x22')](function(_0x4d5d18){if(_0x4d5d18){_0x64e82b=_0x4d5d18;_0x718332[_0xa8b0('0x36')]=_[_0xa8b0('0x33')](db['User'][_0xa8b0('0x2d')]);_0x718332[_0xa8b0('0x32')]=_['keys'](_0x5e76b5[_0xa8b0('0x32')]);_0x718332['filters']=_['intersection'](_0x718332[_0xa8b0('0x36')],_0x718332[_0xa8b0('0x32')]);_0x541c7f[_0xa8b0('0x37')]=_['intersection'](_0x718332[_0xa8b0('0x36')],qs[_0xa8b0('0x38')](_0x5e76b5[_0xa8b0('0x32')][_0xa8b0('0x38')]));_0x541c7f[_0xa8b0('0x37')]=_0x541c7f[_0xa8b0('0x37')][_0xa8b0('0x39')]?_0x541c7f[_0xa8b0('0x37')]:_0x718332[_0xa8b0('0x36')];_0x541c7f[_0xa8b0('0x59')]=qs[_0xa8b0('0x3c')](_0x5e76b5[_0xa8b0('0x32')][_0xa8b0('0x3c')]);_0x541c7f[_0xa8b0('0x3f')]=qs[_0xa8b0('0x34')](_['pick'](_0x5e76b5['query'],_0x718332[_0xa8b0('0x34')]));if(_0x5e76b5[_0xa8b0('0x32')]['filter']){_0x541c7f[_0xa8b0('0x3f')]=_[_0xa8b0('0x41')](_0x541c7f[_0xa8b0('0x3f')],{'$or':_['map'](_0x541c7f[_0xa8b0('0x37')],function(_0x1e2f69){var _0x544848={};_0x544848[_0x1e2f69]={'$like':'%'+_0x5e76b5['query'][_0xa8b0('0x3e')]+'%'};return _0x544848;})});}_0x541c7f=_[_0xa8b0('0x41')]({},_0x541c7f,_0x5e76b5[_0xa8b0('0x42')]);return _0x64e82b[_0xa8b0('0x126')](_0x541c7f);}})[_0xa8b0('0x22')](function(_0x221c1f){if(_0x221c1f){_0x7f5526=_0x221c1f[_0xa8b0('0x39')];if(!_0x5e76b5[_0xa8b0('0x32')]['hasOwnProperty'](_0xa8b0('0x3a'))){_0x541c7f['limit']=qs[_0xa8b0('0x3b')](_0x5e76b5[_0xa8b0('0x32')][_0xa8b0('0x3b')]);_0x541c7f[_0xa8b0('0x1e')]=qs[_0xa8b0('0x1e')](_0x5e76b5['query']['offset']);}return _0x64e82b[_0xa8b0('0x126')](_0x541c7f);}})['then'](function(_0x5c26a7){if(_0x5c26a7){return _0x5c26a7?{'count':_0x7f5526,'rows':_0x5c26a7}:null;}})['then'](respondWithResult(_0x549d97,null))[_0xa8b0('0x50')](handleError(_0x549d97,null));}; \ No newline at end of file +var _0xa70f=['body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Applications','account','applications','list','orderBy','asc','Contacts','contact','customerIp','cf-connecting-ip','first','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','type','threadId','externalUrl','interaction','ChatInteraction','spread','messageId','created','push','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','waitForTheAssignedAgent','Start','startRouting','EventManager','notify','offline','from\x20is\x20mandatory','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','fromString','originalname','mimetype','server','files','basename','openNewInteraction','sequelize','transaction','bulkCreate','MailServerOut','Smtp','CloudProvider','sendMail','\x22%s\x22\x20<%s>','forwardOfflineAddress','offlineMessageSubject','toPairsIn','mapValues','subjectOffline','email','Chat','MailAccountId','NotifyMailAccount','notifyMail','offline-chat','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','Interval','Intervals','getProactiveActions','getLicense','virtual','increment','chatLicenseExceeded','all','some','server/files/chat/iframe.ejs','URL','address','origin','3.1.0','remote','stringify','x-real-ip','connection','remoteAddress','alignment','verticalAlignment','labelText','textColor','color_button','IntervalId','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','ChatApplication','findAndCountAll','priority','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachment','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','mustache','path','fs-extra','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','url','../../mysqldb','defaults','redis','./chatWebsite.socket','register','html-to-text','jayson/promise','client','http','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','status','end','json','offset','undefined','limit','count','set','update','then','destroy','get','sendStatus','name','send','index','map','ChatWebsite','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','include','rows','show','Pause','mandatoryDispositionPause','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatWebsites','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','ChatWebsiteId','getDispositions','Disposition','findAll','removeDispositions','ids','getAnswers','findOne','CannedAnswer','nolimit','removeAnswers','addLogo','sitepic','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','file','addSystemAvatar','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','custom','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','isNil','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','user-agent-parser','setUA','headers','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','from'];(function(_0x4b2d64,_0x202ded){var _0x16b037=function(_0x111fa2){while(--_0x111fa2){_0x4b2d64['push'](_0x4b2d64['shift']());}};_0x16b037(++_0x202ded);}(_0xa70f,0xa6));var _0xfa70=function(_0x1cddf6,_0x27b840){_0x1cddf6=_0x1cddf6-0x0;var _0x54ee23=_0xa70f[_0x1cddf6];return _0x54ee23;};'use strict';var BPromise=require(_0xfa70('0x0'));var Mustache=require(_0xfa70('0x1'));var util=require('util');var path=require(_0xfa70('0x2'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfa70('0x3'));var _=require(_0xfa70('0x4'));var querystring=require('querystring');var Redis=require(_0xfa70('0x5'));var qs=require(_0xfa70('0x6'));var logger=require(_0xfa70('0x7'))('api');var config=require(_0xfa70('0x8'));var url=require(_0xfa70('0x9'));var db=require(_0xfa70('0xa'))['db'];config['redis']=_[_0xfa70('0xb')](config[_0xfa70('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfa70('0xc')]));require(_0xfa70('0xd'))[_0xfa70('0xe')](socket);var htmlToText=require(_0xfa70('0xf'));var jayson=require(_0xfa70('0x10'));var client=jayson[_0xfa70('0x11')][_0xfa70('0x12')]({'port':0x232c});var client9002=jayson[_0xfa70('0x11')][_0xfa70('0x12')]({'port':0x232a});var client9003=jayson['client'][_0xfa70('0x12')]({'port':0x232b});var client9001=jayson[_0xfa70('0x11')][_0xfa70('0x12')]({'port':0x2329});function respondWithRpcPromise(_0x4bf1c8,_0x929163,_0x3f8f61,_0x430401){return new BPromise(function(_0x185029,_0x50bcb2){var _0x57a8dc=_0x430401||client;return _0x57a8dc['request'](_0x4bf1c8,_0x3f8f61)['then'](function(_0x58da67){logger[_0xfa70('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x929163,_0xfa70('0x14'));logger[_0xfa70('0x15')](_0xfa70('0x16'),_0x929163,_0xfa70('0x14'),JSON['stringify'](_0x58da67));if(_0x58da67[_0xfa70('0x17')]){if(_0x58da67['error'][_0xfa70('0x18')]===0x1f4){logger[_0xfa70('0x17')](_0xfa70('0x19'),_0x929163,_0x58da67['error'][_0xfa70('0x1a')]);return _0x50bcb2(_0x58da67[_0xfa70('0x17')]['message']);}logger[_0xfa70('0x17')](_0xfa70('0x19'),_0x929163,_0x58da67[_0xfa70('0x17')][_0xfa70('0x1a')]);return _0x185029(_0x58da67[_0xfa70('0x17')][_0xfa70('0x1a')]);}else{logger['info'](_0xfa70('0x19'),_0x929163,_0xfa70('0x14'));_0x185029(_0x58da67[_0xfa70('0x1b')][_0xfa70('0x1a')]);}})[_0xfa70('0x1c')](function(_0x3544ac){logger[_0xfa70('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x929163,_0x3544ac);_0x50bcb2(_0x3544ac);});});}function respondWithStatusCode(_0x2998ed,_0x3b4196){_0x3b4196=_0x3b4196||0xcc;return function(_0x58d56d){if(_0x58d56d){return _0x2998ed['sendStatus'](_0x3b4196);}return _0x2998ed[_0xfa70('0x1d')](_0x3b4196)[_0xfa70('0x1e')]();};}function respondWithResult(_0x2b56bc,_0x78c835){_0x78c835=_0x78c835||0xc8;return function(_0x46f8c1){if(_0x46f8c1){return _0x2b56bc[_0xfa70('0x1d')](_0x78c835)[_0xfa70('0x1f')](_0x46f8c1);}};}function respondWithFilteredResult(_0x19d1f5,_0x25307f){return function(_0x11ccac){if(_0x11ccac){var _0x46a54b=typeof _0x25307f[_0xfa70('0x20')]===_0xfa70('0x21')&&typeof _0x25307f[_0xfa70('0x22')]===_0xfa70('0x21');var _0x113ece=_0x11ccac[_0xfa70('0x23')];var _0x414f9a=_0x46a54b?0x0:_0x25307f[_0xfa70('0x20')];var _0x48b443=_0x46a54b?_0x11ccac[_0xfa70('0x23')]:_0x25307f[_0xfa70('0x20')]+_0x25307f[_0xfa70('0x22')];var _0x103fd2;if(_0x48b443>=_0x113ece){_0x48b443=_0x113ece;_0x103fd2=0xc8;}else{_0x103fd2=0xce;}_0x19d1f5['status'](_0x103fd2);return _0x19d1f5[_0xfa70('0x24')]('Content-Range',_0x414f9a+'-'+_0x48b443+'/'+_0x113ece)[_0xfa70('0x1f')](_0x11ccac);}return null;};}function saveUpdates(_0x13f95c){return function(_0x3c7eef){if(_0x3c7eef){return _0x3c7eef[_0xfa70('0x25')](_0x13f95c)[_0xfa70('0x26')](function(_0x37550e){return _0x37550e;});}return null;};}function removeEntity(_0x48cc89){return function(_0x59eeb6){if(_0x59eeb6){return _0x59eeb6[_0xfa70('0x27')]()[_0xfa70('0x26')](function(){var _0x202443=_0x59eeb6[_0xfa70('0x28')]({'plain':!![]});var _0x5beb2b='ChatWebsites';return db['UserProfileResource']['destroy']({'where':{'type':_0x5beb2b,'resourceId':_0x202443['id']}})[_0xfa70('0x26')](function(){return _0x59eeb6;});})[_0xfa70('0x26')](function(){_0x48cc89[_0xfa70('0x1d')](0xcc)[_0xfa70('0x1e')]();});}};}function handleEntityNotFound(_0x5d9a72){return function(_0x3286d3){if(!_0x3286d3){_0x5d9a72[_0xfa70('0x29')](0x194);}return _0x3286d3;};}function handleError(_0x288ebc,_0x4b03f3){_0x4b03f3=_0x4b03f3||0x1f4;return function(_0x950669){logger[_0xfa70('0x17')](_0x950669['stack']);if(_0x950669[_0xfa70('0x2a')]){delete _0x950669[_0xfa70('0x2a')];}_0x288ebc[_0xfa70('0x1d')](_0x4b03f3)[_0xfa70('0x2b')](_0x950669);};}exports[_0xfa70('0x2c')]=function(_0x2fb66f,_0x536d5f){var _0x50d89e={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x5387f3={},_0x112306={'count':0x0,'rows':[]};var _0x19d3d7=_[_0xfa70('0x2d')](db[_0xfa70('0x2e')][_0xfa70('0x2f')],function(_0x964668){return{'name':_0x964668[_0xfa70('0x30')],'type':_0x964668['type'][_0xfa70('0x31')]};});_0x5387f3[_0xfa70('0x32')]=_[_0xfa70('0x2d')](_0x19d3d7,_0xfa70('0x2a'));_0x5387f3[_0xfa70('0x33')]=_[_0xfa70('0x34')](_0x2fb66f[_0xfa70('0x33')]);_0x5387f3['filters']=_[_0xfa70('0x35')](_0x5387f3[_0xfa70('0x32')],_0x5387f3[_0xfa70('0x33')]);_0x50d89e['attributes']=_[_0xfa70('0x35')](_0x5387f3[_0xfa70('0x32')],qs[_0xfa70('0x36')](_0x2fb66f[_0xfa70('0x33')][_0xfa70('0x36')]));_0x50d89e[_0xfa70('0x37')]=_0x50d89e[_0xfa70('0x37')][_0xfa70('0x38')]?_0x50d89e[_0xfa70('0x37')]:_0x5387f3[_0xfa70('0x32')];if(!_0x2fb66f[_0xfa70('0x33')][_0xfa70('0x39')]('nolimit')){_0x50d89e[_0xfa70('0x22')]=qs['limit'](_0x2fb66f[_0xfa70('0x33')][_0xfa70('0x22')]);_0x50d89e[_0xfa70('0x20')]=qs['offset'](_0x2fb66f[_0xfa70('0x33')][_0xfa70('0x20')]);}_0x50d89e[_0xfa70('0x3a')]=qs[_0xfa70('0x3b')](_0x2fb66f[_0xfa70('0x33')]['sort']);_0x50d89e[_0xfa70('0x3c')]=qs['filters'](_[_0xfa70('0x3d')](_0x2fb66f[_0xfa70('0x33')],_0x5387f3[_0xfa70('0x3e')]),_0x19d3d7);if(_0x2fb66f[_0xfa70('0x33')][_0xfa70('0x3f')]){_0x50d89e[_0xfa70('0x3c')]=_[_0xfa70('0x40')](_0x50d89e[_0xfa70('0x3c')],{'$or':_[_0xfa70('0x2d')](_0x19d3d7,function(_0x481293){if(_0x481293['type']!==_0xfa70('0x41')){var _0x5dea56={};_0x5dea56[_0x481293['name']]={'$like':'%'+_0x2fb66f['query'][_0xfa70('0x3f')]+'%'};return _0x5dea56;}})});}_0x50d89e=_['merge']({},_0x50d89e,_0x2fb66f[_0xfa70('0x42')]);var _0x88ae20={'where':_0x50d89e[_0xfa70('0x3c')]};return db[_0xfa70('0x2e')][_0xfa70('0x23')](_0x88ae20)[_0xfa70('0x26')](function(_0x4de4fa){_0x112306[_0xfa70('0x23')]=_0x4de4fa;if(_0x2fb66f[_0xfa70('0x33')]['includeAll']){_0x50d89e[_0xfa70('0x43')]=[{'all':!![]}];}return db['ChatWebsite']['findAll'](_0x50d89e);})[_0xfa70('0x26')](function(_0x14392a){_0x112306[_0xfa70('0x44')]=_0x14392a;return _0x112306;})[_0xfa70('0x26')](respondWithFilteredResult(_0x536d5f,_0x50d89e))[_0xfa70('0x1c')](handleError(_0x536d5f,null));};exports[_0xfa70('0x45')]=function(_0xd533a9,_0x27ff75){var _0x2a88d0={'raw':![],'where':{'id':_0xd533a9['params']['id']},'include':[{'model':db[_0xfa70('0x46')],'as':_0xfa70('0x47')}]},_0x325e1b={};_0x325e1b[_0xfa70('0x32')]=_[_0xfa70('0x34')](db['ChatWebsite'][_0xfa70('0x2f')]);_0x325e1b['query']=_[_0xfa70('0x34')](_0xd533a9['query']);_0x325e1b[_0xfa70('0x3e')]=_[_0xfa70('0x35')](_0x325e1b[_0xfa70('0x32')],_0x325e1b[_0xfa70('0x33')]);_0x2a88d0[_0xfa70('0x37')]=_['intersection'](_0x325e1b['model'],qs[_0xfa70('0x36')](_0xd533a9['query'][_0xfa70('0x36')]));_0x2a88d0[_0xfa70('0x37')]=_0x2a88d0['attributes'][_0xfa70('0x38')]?_0x2a88d0[_0xfa70('0x37')]:_0x325e1b[_0xfa70('0x32')];if(_0xd533a9[_0xfa70('0x33')][_0xfa70('0x48')]){_0x2a88d0[_0xfa70('0x43')]=[{'all':!![]}];}_0x2a88d0=_[_0xfa70('0x40')]({},_0x2a88d0,_0xd533a9[_0xfa70('0x42')]);return db[_0xfa70('0x2e')][_0xfa70('0x49')](_0x2a88d0)[_0xfa70('0x26')](handleEntityNotFound(_0x27ff75,null))[_0xfa70('0x26')](respondWithResult(_0x27ff75,null))[_0xfa70('0x1c')](handleError(_0x27ff75,null));};exports['create']=function(_0x3ec32b,_0x58ca02){return db[_0xfa70('0x2e')][_0xfa70('0x4a')](_0x3ec32b[_0xfa70('0x4b')],{})['then'](function(_0x215627){var _0x1ce21e=_0x3ec32b[_0xfa70('0x4c')]['get']({'plain':!![]});if(!_0x1ce21e)throw new Error(_0xfa70('0x4d'));if(_0x1ce21e[_0xfa70('0x4e')]===_0xfa70('0x4c')){var _0x15765f=_0x215627[_0xfa70('0x28')]({'plain':!![]});var _0x18a8e1=_0xfa70('0x4f');return db[_0xfa70('0x50')][_0xfa70('0x49')]({'where':{'name':_0x18a8e1,'userProfileId':_0x1ce21e[_0xfa70('0x51')]},'raw':!![]})[_0xfa70('0x26')](function(_0x4b9a84){if(_0x4b9a84&&_0x4b9a84['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x15765f[_0xfa70('0x2a')],'resourceId':_0x15765f['id'],'type':_0x4b9a84['name'],'sectionId':_0x4b9a84['id']},{})['then'](function(){return _0x215627;});}else{return _0x215627;}})[_0xfa70('0x1c')](function(_0x117e19){logger[_0xfa70('0x17')](_0xfa70('0x52'),_0x117e19);throw _0x117e19;});}return _0x215627;})[_0xfa70('0x26')](respondWithResult(_0x58ca02,0xc9))[_0xfa70('0x1c')](handleError(_0x58ca02,null));};exports[_0xfa70('0x25')]=function(_0xc0ccee,_0x969ed1){if(_0xc0ccee['body']['id']){delete _0xc0ccee[_0xfa70('0x4b')]['id'];}return db[_0xfa70('0x2e')][_0xfa70('0x49')]({'where':{'id':_0xc0ccee['params']['id']},'include':[{'model':db[_0xfa70('0x46')],'as':'mandatoryDispositionPause'}]})[_0xfa70('0x26')](handleEntityNotFound(_0x969ed1,null))['then'](saveUpdates(_0xc0ccee[_0xfa70('0x4b')],null))['then'](respondWithResult(_0x969ed1,null))['catch'](handleError(_0x969ed1,null));};exports[_0xfa70('0x27')]=function(_0x3dfc85,_0x1848d8){return db[_0xfa70('0x2e')][_0xfa70('0x49')]({'where':{'id':_0x3dfc85[_0xfa70('0x53')]['id']}})[_0xfa70('0x26')](handleEntityNotFound(_0x1848d8,null))[_0xfa70('0x26')](removeEntity(_0x1848d8,null))[_0xfa70('0x1c')](handleError(_0x1848d8,null));};exports[_0xfa70('0x54')]=function(_0x182f58,_0x796bf9){return db[_0xfa70('0x2e')]['describe']()[_0xfa70('0x26')](respondWithResult(_0x796bf9,null))[_0xfa70('0x1c')](handleError(_0x796bf9,null));};exports[_0xfa70('0x55')]=function(_0x44308e,_0xa8a502){if(_0x44308e[_0xfa70('0x4b')]['id']){delete _0x44308e['body']['id'];}return db[_0xfa70('0x2e')][_0xfa70('0x49')]({'where':{'id':_0x44308e['params']['id']}})['then'](handleEntityNotFound(_0xa8a502,null))[_0xfa70('0x26')](function(_0x5f35e7){if(_0x5f35e7){_0x44308e['body'][_0xfa70('0x56')]=_0x5f35e7['id'];return db['Disposition'][_0xfa70('0x4a')](_0x44308e[_0xfa70('0x4b')]);}})[_0xfa70('0x26')](respondWithResult(_0xa8a502,null))['catch'](handleError(_0xa8a502,null));};exports[_0xfa70('0x57')]=function(_0x2854c0,_0x5ba27e){var _0x315713={'raw':![],'where':{}};var _0x256f1d={};var _0x51dc0e={'count':0x0,'rows':[]};return db[_0xfa70('0x2e')]['findOne']({'where':{'id':_0x2854c0[_0xfa70('0x53')]['id']}})[_0xfa70('0x26')](handleEntityNotFound(_0x5ba27e,null))[_0xfa70('0x26')](function(_0x2c9a66){if(_0x2c9a66){_0x256f1d[_0xfa70('0x32')]=_[_0xfa70('0x34')](db[_0xfa70('0x58')][_0xfa70('0x2f')]);_0x256f1d[_0xfa70('0x33')]=_[_0xfa70('0x34')](_0x2854c0['query']);_0x256f1d[_0xfa70('0x3e')]=_[_0xfa70('0x35')](_0x256f1d[_0xfa70('0x32')],_0x256f1d[_0xfa70('0x33')]);_0x315713[_0xfa70('0x37')]=_['intersection'](_0x256f1d[_0xfa70('0x32')],qs[_0xfa70('0x36')](_0x2854c0[_0xfa70('0x33')][_0xfa70('0x36')]));_0x315713[_0xfa70('0x37')]=_0x315713['attributes'][_0xfa70('0x38')]?_0x315713[_0xfa70('0x37')]:_0x256f1d[_0xfa70('0x32')];if(!_0x2854c0['query'][_0xfa70('0x39')]('nolimit')){_0x315713['limit']=qs[_0xfa70('0x22')](_0x2854c0[_0xfa70('0x33')][_0xfa70('0x22')]);_0x315713['offset']=qs[_0xfa70('0x20')](_0x2854c0[_0xfa70('0x33')]['offset']);}_0x315713[_0xfa70('0x3a')]=qs[_0xfa70('0x3b')](_0x2854c0[_0xfa70('0x33')]['sort']);_0x315713[_0xfa70('0x3c')]=qs[_0xfa70('0x3e')](_['pick'](_0x2854c0['query'],_0x256f1d['filters']));_0x315713['where']['ChatWebsiteId']=_0x2c9a66['id'];if(_0x2854c0[_0xfa70('0x33')]['filter']){_0x315713[_0xfa70('0x3c')]=_['merge'](_0x315713[_0xfa70('0x3c')],{'$or':_[_0xfa70('0x2d')](_0x315713[_0xfa70('0x37')],function(_0x51711e){var _0x1e2164={};_0x1e2164[_0x51711e]={'$like':'%'+_0x2854c0[_0xfa70('0x33')]['filter']+'%'};return _0x1e2164;})});}_0x315713=_[_0xfa70('0x40')]({},_0x315713,_0x2854c0[_0xfa70('0x42')]);return db['Disposition'][_0xfa70('0x23')]({'where':_0x315713['where']})[_0xfa70('0x26')](function(_0x2042e4){_0x51dc0e[_0xfa70('0x23')]=_0x2042e4;if(_0x2854c0[_0xfa70('0x33')][_0xfa70('0x48')]){_0x315713['include']=[{'all':!![]}];}return db[_0xfa70('0x58')][_0xfa70('0x59')](_0x315713);})[_0xfa70('0x26')](function(_0x2cdfb5){_0x51dc0e[_0xfa70('0x44')]=_0x2cdfb5;return _0x51dc0e;});}})[_0xfa70('0x26')](respondWithFilteredResult(_0x5ba27e,_0x315713))['catch'](handleError(_0x5ba27e,null));};exports['removeDispositions']=function(_0x5d7620,_0x4f78b6){return db[_0xfa70('0x2e')][_0xfa70('0x49')]({'where':{'id':_0x5d7620[_0xfa70('0x53')]['id']}})['then'](handleEntityNotFound(_0x4f78b6,null))[_0xfa70('0x26')](function(_0x125082){if(_0x125082){return _0x125082[_0xfa70('0x5a')](_0x5d7620[_0xfa70('0x33')][_0xfa70('0x5b')]);}})[_0xfa70('0x26')](respondWithStatusCode(_0x4f78b6,null))[_0xfa70('0x1c')](handleError(_0x4f78b6,null));};exports['addAnswer']=function(_0x4f98b7,_0x40b4b6){if(_0x4f98b7['body']['id']){delete _0x4f98b7[_0xfa70('0x4b')]['id'];}return db[_0xfa70('0x2e')][_0xfa70('0x49')]({'where':{'id':_0x4f98b7[_0xfa70('0x53')]['id']}})[_0xfa70('0x26')](handleEntityNotFound(_0x40b4b6,null))[_0xfa70('0x26')](function(_0x596d1b){if(_0x596d1b){_0x4f98b7[_0xfa70('0x4b')][_0xfa70('0x56')]=_0x596d1b['id'];return db['CannedAnswer'][_0xfa70('0x4a')](_0x4f98b7['body']);}})[_0xfa70('0x26')](respondWithResult(_0x40b4b6,null))[_0xfa70('0x1c')](handleError(_0x40b4b6,null));};exports[_0xfa70('0x5c')]=function(_0x49dca1,_0x3619c5){var _0x483e67={'raw':![],'where':{}};var _0x4bb3f1={};var _0x3732d5={'count':0x0,'rows':[]};return db[_0xfa70('0x2e')][_0xfa70('0x5d')]({'where':{'id':_0x49dca1[_0xfa70('0x53')]['id']}})['then'](handleEntityNotFound(_0x3619c5,null))[_0xfa70('0x26')](function(_0x45bd75){if(_0x45bd75){_0x4bb3f1[_0xfa70('0x32')]=_[_0xfa70('0x34')](db[_0xfa70('0x5e')]['rawAttributes']);_0x4bb3f1[_0xfa70('0x33')]=_['keys'](_0x49dca1[_0xfa70('0x33')]);_0x4bb3f1[_0xfa70('0x3e')]=_[_0xfa70('0x35')](_0x4bb3f1[_0xfa70('0x32')],_0x4bb3f1[_0xfa70('0x33')]);_0x483e67['attributes']=_[_0xfa70('0x35')](_0x4bb3f1['model'],qs[_0xfa70('0x36')](_0x49dca1[_0xfa70('0x33')][_0xfa70('0x36')]));_0x483e67[_0xfa70('0x37')]=_0x483e67[_0xfa70('0x37')][_0xfa70('0x38')]?_0x483e67[_0xfa70('0x37')]:_0x4bb3f1[_0xfa70('0x32')];if(!_0x49dca1['query']['hasOwnProperty'](_0xfa70('0x5f'))){_0x483e67[_0xfa70('0x22')]=qs[_0xfa70('0x22')](_0x49dca1[_0xfa70('0x33')][_0xfa70('0x22')]);_0x483e67['offset']=qs[_0xfa70('0x20')](_0x49dca1['query'][_0xfa70('0x20')]);}_0x483e67[_0xfa70('0x3a')]=qs[_0xfa70('0x3b')](_0x49dca1[_0xfa70('0x33')]['sort']);_0x483e67['where']=qs[_0xfa70('0x3e')](_[_0xfa70('0x3d')](_0x49dca1[_0xfa70('0x33')],_0x4bb3f1['filters']));_0x483e67[_0xfa70('0x3c')][_0xfa70('0x56')]=_0x45bd75['id'];if(_0x49dca1[_0xfa70('0x33')][_0xfa70('0x3f')]){_0x483e67[_0xfa70('0x3c')]=_[_0xfa70('0x40')](_0x483e67[_0xfa70('0x3c')],{'$or':_[_0xfa70('0x2d')](_0x483e67[_0xfa70('0x37')],function(_0x47f56d){var _0x5d3361={};_0x5d3361[_0x47f56d]={'$like':'%'+_0x49dca1[_0xfa70('0x33')]['filter']+'%'};return _0x5d3361;})});}_0x483e67=_[_0xfa70('0x40')]({},_0x483e67,_0x49dca1[_0xfa70('0x42')]);return db['CannedAnswer']['count']({'where':_0x483e67['where']})[_0xfa70('0x26')](function(_0x2e9e47){_0x3732d5[_0xfa70('0x23')]=_0x2e9e47;if(_0x49dca1[_0xfa70('0x33')][_0xfa70('0x48')]){_0x483e67[_0xfa70('0x43')]=[{'all':!![]}];}return db[_0xfa70('0x5e')][_0xfa70('0x59')](_0x483e67);})[_0xfa70('0x26')](function(_0x207b27){_0x3732d5[_0xfa70('0x44')]=_0x207b27;return _0x3732d5;});}})[_0xfa70('0x26')](respondWithFilteredResult(_0x3619c5,_0x483e67))[_0xfa70('0x1c')](handleError(_0x3619c5,null));};exports[_0xfa70('0x60')]=function(_0x5524e2,_0x46a48c){return db[_0xfa70('0x2e')]['find']({'where':{'id':_0x5524e2['params']['id']}})[_0xfa70('0x26')](handleEntityNotFound(_0x46a48c,null))[_0xfa70('0x26')](function(_0x3b6b9a){if(_0x3b6b9a){return _0x3b6b9a[_0xfa70('0x60')](_0x5524e2[_0xfa70('0x33')][_0xfa70('0x5b')]);}})[_0xfa70('0x26')](respondWithStatusCode(_0x46a48c,null))[_0xfa70('0x1c')](handleError(_0x46a48c,null));};exports[_0xfa70('0x61')]=function(_0x4aa72b,_0x37b35f){_0x4aa72b[_0xfa70('0x4b')][_0xfa70('0x62')]=_0x4aa72b['file'][_0xfa70('0x63')];return db[_0xfa70('0x2e')][_0xfa70('0x49')]({'where':{'id':_0x4aa72b['params']['id']}})[_0xfa70('0x26')](handleEntityNotFound(_0x37b35f,null))['then'](saveUpdates(_0x4aa72b[_0xfa70('0x4b')],null))[_0xfa70('0x26')](respondWithResult(_0x37b35f,null))[_0xfa70('0x1c')](handleError(_0x37b35f,null));};exports[_0xfa70('0x64')]=function(_0x16136d,_0x3625b9){_0x16136d[_0xfa70('0x4b')][_0xfa70('0x65')]=_0x16136d['file'][_0xfa70('0x63')];return db[_0xfa70('0x2e')][_0xfa70('0x49')]({'where':{'id':_0x16136d[_0xfa70('0x53')]['id']}})['then'](handleEntityNotFound(_0x3625b9,null))['then'](saveUpdates(_0x16136d['body'],null))[_0xfa70('0x26')](respondWithResult(_0x3625b9,null))[_0xfa70('0x1c')](handleError(_0x3625b9,null));};exports[_0xfa70('0x66')]=function(_0x4cadf0,_0x93a349){_0x4cadf0[_0xfa70('0x4b')][_0xfa70('0x67')]=_0x4cadf0[_0xfa70('0x68')][_0xfa70('0x63')];return db[_0xfa70('0x2e')][_0xfa70('0x49')]({'where':{'id':_0x4cadf0[_0xfa70('0x53')]['id']}})['then'](handleEntityNotFound(_0x93a349,null))['then'](saveUpdates(_0x4cadf0[_0xfa70('0x4b')],null))[_0xfa70('0x26')](respondWithResult(_0x93a349,null))['catch'](handleError(_0x93a349,null));};exports[_0xfa70('0x69')]=function(_0x2ff938,_0x2d3ef3){_0x2ff938['body']['systemAvatar']=_0x2ff938[_0xfa70('0x68')][_0xfa70('0x63')];return db[_0xfa70('0x2e')][_0xfa70('0x49')]({'where':{'id':_0x2ff938[_0xfa70('0x53')]['id']}})[_0xfa70('0x26')](handleEntityNotFound(_0x2d3ef3,null))[_0xfa70('0x26')](saveUpdates(_0x2ff938[_0xfa70('0x4b')],null))[_0xfa70('0x26')](respondWithResult(_0x2d3ef3,null))['catch'](handleError(_0x2d3ef3,null));};exports['getLogo']=function(_0x237ce4,_0x497945){var _0x178143=path[_0xfa70('0x6a')](config[_0xfa70('0x6b')],_0xfa70('0x6c'));var _0xdc557f={'where':{'id':_0x237ce4['params']['id']},'attributes':['id',_0xfa70('0x62')],'raw':!![]};var _0x468041=![];return require(_0xfa70('0x6d'))['getLicense']()[_0xfa70('0x26')](function(_0xb3567d){if(_0xb3567d){_0x468041=_0xb3567d[_0xfa70('0x6e')];}})[_0xfa70('0x26')](function(){return db[_0xfa70('0x2e')]['find'](_0xdc557f);})['then'](handleEntityNotFound(_0x497945,null))[_0xfa70('0x26')](function(_0x101d61){if(_0x101d61){if(!_['isNil'](_0x101d61['sitepic'])){if(fs[_0xfa70('0x6f')](path[_0xfa70('0x6a')](config['root'],_0xfa70('0x70'),_0x101d61[_0xfa70('0x62')]))&&_0x468041){_0x178143=path[_0xfa70('0x6a')](config[_0xfa70('0x6b')],_0xfa70('0x70'),_0x101d61[_0xfa70('0x62')]);}}return _0x497945[_0xfa70('0x71')](_0x178143);}})[_0xfa70('0x1c')](handleError(_0x497945,null));};exports[_0xfa70('0x72')]=function(_0x394f15,_0x2c0c7c){var _0x2da734=path[_0xfa70('0x6a')](config['root'],_0xfa70('0x73'));var _0x4e146b={'where':{'id':_0x394f15[_0xfa70('0x53')]['id']},'attributes':['id',_0xfa70('0x65')],'raw':!![]};return db[_0xfa70('0x2e')][_0xfa70('0x49')](_0x4e146b)[_0xfa70('0x26')](handleEntityNotFound(_0x2c0c7c,null))[_0xfa70('0x26')](function(_0x701ef9){if(_0x701ef9){if(!_[_0xfa70('0x74')](_0x701ef9[_0xfa70('0x65')])){if(fs[_0xfa70('0x6f')](path[_0xfa70('0x6a')](config[_0xfa70('0x6b')],_0xfa70('0x75'),_0x701ef9['agentAvatar']))){_0x2da734=path[_0xfa70('0x6a')](config['root'],'server/files/images/avatars/',_0x701ef9[_0xfa70('0x65')]);}}return _0x2c0c7c['download'](_0x2da734);}})[_0xfa70('0x1c')](handleError(_0x2c0c7c,null));};exports[_0xfa70('0x76')]=function(_0x356342,_0x5ea107){var _0x59fcc4=path[_0xfa70('0x6a')](config[_0xfa70('0x6b')],_0xfa70('0x77'));var _0x3123d7={'where':{'id':_0x356342[_0xfa70('0x53')]['id']},'attributes':['id',_0xfa70('0x67'),_0xfa70('0x78')],'raw':!![]};return db[_0xfa70('0x2e')][_0xfa70('0x49')](_0x3123d7)[_0xfa70('0x26')](handleEntityNotFound(_0x5ea107,null))[_0xfa70('0x26')](function(_0x3fc015){if(_0x3fc015){if(!_[_0xfa70('0x74')](_0x3fc015[_0xfa70('0x67')])){if(fs[_0xfa70('0x6f')](path['join'](config[_0xfa70('0x6b')],_0xfa70('0x75'),_0x3fc015[_0xfa70('0x67')]))&&_0x3fc015[_0xfa70('0x78')]){_0x59fcc4=path[_0xfa70('0x6a')](config[_0xfa70('0x6b')],'server/files/images/avatars/',_0x3fc015[_0xfa70('0x67')]);}}return _0x5ea107['download'](_0x59fcc4);}})['catch'](handleError(_0x5ea107,null));};exports[_0xfa70('0x79')]=function(_0x3a8477,_0x5f4f89){var _0x568a4b=path[_0xfa70('0x6a')](config[_0xfa70('0x6b')],_0xfa70('0x7a'));var _0x580d3b={'where':{'id':_0x3a8477[_0xfa70('0x53')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xfa70('0x2e')][_0xfa70('0x49')](_0x580d3b)[_0xfa70('0x26')](handleEntityNotFound(_0x5f4f89,null))[_0xfa70('0x26')](function(_0x5403cd){if(_0x5403cd){if(!_[_0xfa70('0x74')](_0x5403cd[_0xfa70('0x7b')])){if(fs['existsSync'](path[_0xfa70('0x6a')](config[_0xfa70('0x6b')],_0xfa70('0x75'),_0x5403cd[_0xfa70('0x7b')]))){_0x568a4b=path[_0xfa70('0x6a')](config[_0xfa70('0x6b')],'server/files/images/avatars/',_0x5403cd[_0xfa70('0x7b')]);}}return _0x5f4f89[_0xfa70('0x71')](_0x568a4b);}})[_0xfa70('0x1c')](handleError(_0x5f4f89,null));};exports['notify']=function(_0x4d1789,_0x475e49){var _0xb589=require(_0xfa70('0x7c'));var _0x58bd7b=new _0xb589();var _0x2faa7d=_0x58bd7b[_0xfa70('0x7d')](_0x4d1789[_0xfa70('0x7e')][_0xfa70('0x7f')])[_0xfa70('0x80')]();var _0x3f6c27={'body':_0x4d1789[_0xfa70('0x4b')],'channel':_0xfa70('0x81')};var _0x2872a4=[];var _0x75b8db=[];var _0x28c0fb={};var _0x510350=![];return db[_0xfa70('0x82')][_0xfa70('0x54')]()[_0xfa70('0x26')](function(_0x421a7a){if(!_0x421a7a){throw new db[(_0xfa70('0x83'))][(_0xfa70('0x84'))](_0xfa70('0x85'));}_0x2872a4=_['difference'](_[_0xfa70('0x34')](_0x421a7a),[_0xfa70('0x86'),_0xfa70('0x87')]);_0x75b8db=_[_0xfa70('0x88')](_[_0xfa70('0x34')](_0x421a7a),[_0xfa70('0x86'),'updatedAt',_0xfa70('0x89'),_0xfa70('0x8a')]);if(_0x4d1789[_0xfa70('0x4b')]['id']){delete _0x4d1789['body']['id'];}if(_['isNil'](_0x4d1789[_0xfa70('0x4b')][_0xfa70('0x8b')])){throw new db[(_0xfa70('0x83'))][(_0xfa70('0x84'))]('from\x20is\x20mandatory');}if(_[_0xfa70('0x74')](_0x4d1789[_0xfa70('0x4b')][_0xfa70('0x4b')])||_0x4d1789['body'][_0xfa70('0x4b')]===''){throw new db[(_0xfa70('0x83'))][(_0xfa70('0x84'))](_0xfa70('0x8c'));}if(_[_0xfa70('0x74')](_0x4d1789['body'][_0xfa70('0x8d')])){throw new db[(_0xfa70('0x83'))][(_0xfa70('0x84'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x75b8db);}if(!_[_0xfa70('0x8e')](_0x75b8db,_0x4d1789[_0xfa70('0x4b')][_0xfa70('0x8d')])){throw new db[(_0xfa70('0x83'))][(_0xfa70('0x84'))](_0xfa70('0x8f')+_0x75b8db);}_0x28c0fb[_0x4d1789[_0xfa70('0x4b')]['mapKey']]=_0x4d1789[_0xfa70('0x4b')]['from'];})[_0xfa70('0x26')](function(){return db[_0xfa70('0x2e')][_0xfa70('0x49')]({'where':{'id':_0x4d1789['params']['id']},'include':[{'model':db[_0xfa70('0x90')],'as':_0xfa70('0x91'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x28c0fb,'limit':0x1,'order':[[_0xfa70('0x87'),'DESC']]}]},{'model':db['ChatApplication'],'as':_0xfa70('0x92')}]});})['then'](handleEntityNotFound(_0x475e49,null))[_0xfa70('0x26')](function(_0x326883){if(_0x326883&&_0x326883[_0xfa70('0x91')]){_0x3f6c27[_0xfa70('0x93')]=_0x326883;_0x3f6c27[_0xfa70('0x94')]=_0x326883['Applications'];_0x3f6c27[_0xfa70('0x95')]=_0x326883[_0xfa70('0x91')];_0x3f6c27[_0xfa70('0x94')]=_[_0xfa70('0x96')](_0x3f6c27[_0xfa70('0x94')],['priority'],[_0xfa70('0x97')]);if(_0x3f6c27['account'][_0xfa70('0x92')]){delete _0x3f6c27['account'][_0xfa70('0x92')];}if(_0x3f6c27[_0xfa70('0x93')]['List']&&_0x3f6c27[_0xfa70('0x93')][_0xfa70('0x91')][_0xfa70('0x98')][_0xfa70('0x38')]){return _0x3f6c27[_0xfa70('0x93')]['List'][_0xfa70('0x98')][0x0];}var _0x29e438=_[_0xfa70('0xb')](_0x4d1789[_0xfa70('0x4b')],{'firstName':_0x4d1789[_0xfa70('0x4b')][_0xfa70('0x8b')],'ListId':_0x326883['ListId']});_0x29e438[_0x4d1789[_0xfa70('0x4b')][_0xfa70('0x8d')]]=_0x4d1789[_0xfa70('0x4b')][_0xfa70('0x8b')];return db[_0xfa70('0x82')][_0xfa70('0x4a')](_0x29e438,{'fields':_0x2872a4,'raw':!![]});}})[_0xfa70('0x26')](handleEntityNotFound(_0x475e49,null))[_0xfa70('0x26')](function(_0x590cd0){_0x3f6c27[_0xfa70('0x99')]=_0x590cd0;var _0x43c826=_0x4d1789[_0xfa70('0x4b')][_0xfa70('0x9a')];if(_0x4d1789[_0xfa70('0x7e')][_0xfa70('0x9b')]){_0x43c826=_0x4d1789[_0xfa70('0x7e')][_0xfa70('0x9b')];}else if(_0x4d1789['headers']['x-forwarded-for']){_0x43c826=_[_0xfa70('0x9c')](_0x4d1789[_0xfa70('0x7e')][_0xfa70('0x9d')][_0xfa70('0x9e')](','));}if(_0x590cd0){var _0x27fcc6={'ContactId':_0x590cd0['id'],'ChatWebsiteId':_0x4d1789['params']['id'],'from':(_0x590cd0[_0xfa70('0x9f')]||'')+'\x20'+(_0x590cd0[_0xfa70('0xa0')]||''),'customerIp':_0x43c826,'customerPort':_0x4d1789[_0xfa70('0x7e')][_0xfa70('0xa1')]?_0x4d1789['headers'][_0xfa70('0xa1')]:null,'referer':_0x4d1789['body'][_0xfa70('0xa2')],'browserName':_0x2faa7d['browser']['name']&&_0x2faa7d[_0xfa70('0xa3')][_0xfa70('0xa4')]?util[_0xfa70('0xa5')](_0xfa70('0xa6'),_0x2faa7d[_0xfa70('0xa3')][_0xfa70('0x2a')],_0x2faa7d[_0xfa70('0xa3')][_0xfa70('0xa4')]):_0xfa70('0xa7'),'browserVersion':_0x2faa7d[_0xfa70('0xa3')][_0xfa70('0xa4')]||_0xfa70('0xa7'),'osName':util['format'](_0xfa70('0xa6'),_0x2faa7d['os'][_0xfa70('0x2a')],_0x2faa7d['os'][_0xfa70('0xa4')]),'osVersion':_0x2faa7d['os'][_0xfa70('0xa4')],'deviceModel':_0x2faa7d[_0xfa70('0xa8')]['model']&&_0x2faa7d[_0xfa70('0xa8')][_0xfa70('0xa9')]?util[_0xfa70('0xa5')](_0xfa70('0xaa'),_0x2faa7d['device']['model'],_0x2faa7d[_0xfa70('0xa8')][_0xfa70('0xa9')],_0x2faa7d[_0xfa70('0xa8')][_0xfa70('0xab')]):null,'deviceVendor':_0x2faa7d[_0xfa70('0xa8')][_0xfa70('0xa9')],'deviceType':_0x2faa7d[_0xfa70('0xa8')][_0xfa70('0xab')],'formData':JSON['stringify'](_0x4d1789[_0xfa70('0x4b')])};var _0x2ef4b1={'ChatWebsiteId':_0x4d1789[_0xfa70('0x53')]['id'],'closed':![]};if(_0x4d1789[_0xfa70('0x4b')][_0xfa70('0xac')]){_0x2ef4b1[_0xfa70('0xac')]=_0x4d1789['body']['threadId'];return db['ChatInteraction'][_0xfa70('0x49')]({'where':_0x2ef4b1})[_0xfa70('0x26')](function(_0x5e33f2){if(_0x5e33f2){return[_0x5e33f2,![]];}_0x27fcc6[_0xfa70('0xac')]=_0x4d1789['body']['threadId'];_0x27fcc6[_0xfa70('0xad')]=_0x4d1789[_0xfa70('0x4b')][_0xfa70('0xad')];return db['ChatInteraction'][_0xfa70('0x4a')](_0x27fcc6)[_0xfa70('0x26')](function(_0xc3c3b8){return[_0xc3c3b8,!![]];});});}_0x2ef4b1['ContactId']=_0x590cd0['id'];if(_0x4d1789['body'][_0xfa70('0xae')]&&_0x4d1789['body']['interaction']['id']){_0x2ef4b1['id']=_0x4d1789[_0xfa70('0x4b')][_0xfa70('0xae')]['id'];return db[_0xfa70('0xaf')][_0xfa70('0x49')]({'where':_0x2ef4b1})[_0xfa70('0x26')](function(_0x9373f2){if(_0x9373f2){return[_0x9373f2,![]];}return db['ChatInteraction']['create'](_0x27fcc6)['then'](function(_0x2ad53a){return[_0x2ad53a,!![]];});});}return db[_0xfa70('0xaf')]['create'](_0x27fcc6)[_0xfa70('0x26')](function(_0xa94a88){return[_0xa94a88,!![]];});}})[_0xfa70('0xb0')](function(_0x4d15a0,_0x56c9cc){if(_0x4d15a0){_0x510350=_0x56c9cc;if(!_0x56c9cc){var _0x5bf7fd={'from':(_0x3f6c27[_0xfa70('0x99')]['firstName']||'')+'\x20'+(_0x3f6c27[_0xfa70('0x99')][_0xfa70('0xa0')]||'')};if(_0x4d1789[_0xfa70('0x4b')][_0xfa70('0xac')]&&_0x4d1789[_0xfa70('0x4b')][_0xfa70('0xb1')]&&_0x4d1789[_0xfa70('0x4b')][_0xfa70('0xac')]!=_0x4d1789['body'][_0xfa70('0xb1')]){_0x5bf7fd[_0xfa70('0xac')]=_0x4d1789[_0xfa70('0x4b')]['messageId'];}return _0x4d15a0[_0xfa70('0x25')](_0x5bf7fd);}else{return _0x4d15a0;}}})[_0xfa70('0x26')](function(_0x3b80d6){_0x3f6c27[_0xfa70('0xae')]=_0x3b80d6[_0xfa70('0x28')]({'plain':!![]});_0x3f6c27[_0xfa70('0xae')][_0xfa70('0xb2')]=_0x510350;if(_0x3f6c27[_0xfa70('0xae')][_0xfa70('0xb2')]){if(_0x3f6c27[_0xfa70('0x93')]['autoclose']){_0x3f6c27[_0xfa70('0x94')][_0xfa70('0xb3')]({'id':0x0,'priority':_0x3f6c27['applications']['length']+0x1,'app':'close','appdata':_0xfa70('0xb4'),'interval':_0xfa70('0xb5')});}}return db[_0xfa70('0xb6')]['create']({'body':_0x4d1789[_0xfa70('0x4b')][_0xfa70('0x4b')],'ChatWebsiteId':_0x4d1789['params']['id'],'ChatInteractionId':_0x3b80d6['id'],'direction':'in','ContactId':_0x3f6c27['contact']['id'],'AttachmentId':_0x4d1789[_0xfa70('0x4b')][_0xfa70('0xb7')]});})[_0xfa70('0x26')](function(_0x470608){_0x3f6c27[_0xfa70('0x1a')]=_0x470608;if(_0x3f6c27[_0xfa70('0xae')][_0xfa70('0xb8')]){return db[_0xfa70('0xb9')][_0xfa70('0x49')]({'attributes':['id',_0xfa70('0x2a')],'where':{'id':_0x3f6c27[_0xfa70('0xae')]['UserId']}})[_0xfa70('0x26')](function(_0x455f7f){if(_0x455f7f){_0x3f6c27['applications']['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x455f7f[_0xfa70('0x2a')]+','+(_0x3f6c27[_0xfa70('0x93')][_0xfa70('0xba')]||0xa),'interval':_0xfa70('0xb5')});_0x3f6c27['forcedOwnership']=!![];}return respondWithRpcPromise(_0xfa70('0xbb'),_0xfa70('0xbc'),_0x3f6c27);});}return respondWithRpcPromise('Start',_0xfa70('0xbc'),_0x3f6c27);})['then'](function(_0x517a2a){respondWithRpcPromise(_0xfa70('0xbd'),_0xfa70('0xbd'),{'event':_0xfa70('0xbe'),'message':_0x517a2a},client9002);return _0x517a2a;})[_0xfa70('0x26')](respondWithResult(_0x475e49,null))[_0xfa70('0x1c')](handleError(_0x475e49,null));};exports[_0xfa70('0xbf')]=function(_0x3cb410,_0x4d85ae){var _0x1efda4,_0x124083,_0x1bf8f6;var _0x3333b2=[];var _0x1bef11={};var _0x3cfc60=_0x3cb410['files']||[];var _0x1e49d5=[];var _0x4bd01f;return db[_0xfa70('0x82')][_0xfa70('0x54')]()['then'](function(_0x267248){if(!_0x267248){throw new db['Sequelize'][(_0xfa70('0x84'))](_0xfa70('0x85'));}_0x3333b2=_[_0xfa70('0x88')](_[_0xfa70('0x34')](_0x267248),[_0xfa70('0x86'),_0xfa70('0x87'),'CompanyId','ListId']);if(_0x3cb410[_0xfa70('0x4b')]['id']){delete _0x3cb410['body']['id'];}if(_[_0xfa70('0x74')](_0x3cb410[_0xfa70('0x4b')]['from'])){throw _0x4d85ae[_0xfa70('0x1d')](0x1f4)[_0xfa70('0x2b')](new db[(_0xfa70('0x83'))][(_0xfa70('0x84'))](_0xfa70('0xc0')));}if(_[_0xfa70('0x74')](_0x3cb410[_0xfa70('0x4b')][_0xfa70('0x4b')])||_0x3cb410['body'][_0xfa70('0x4b')]===''){throw _0x4d85ae[_0xfa70('0x1d')](0x1f4)[_0xfa70('0x2b')](new db[(_0xfa70('0x83'))][(_0xfa70('0x84'))](_0xfa70('0x8c')));}if(_['isNil'](_0x3cb410[_0xfa70('0x4b')][_0xfa70('0xc1')])){throw _0x4d85ae[_0xfa70('0x1d')](0x1f4)['send'](new db['Sequelize'][(_0xfa70('0x84'))](_0xfa70('0xc2')+_0x3333b2));}if(!_[_0xfa70('0x8e')](_0x3333b2,_0x3cb410[_0xfa70('0x4b')][_0xfa70('0xc1')])){throw _0x4d85ae['status'](0x1f4)[_0xfa70('0x2b')](new db[(_0xfa70('0x83'))][(_0xfa70('0x84'))](_0xfa70('0xc3')+_0x3333b2));}_0x1bef11[_0x3cb410[_0xfa70('0x4b')][_0xfa70('0xc1')]]=_0x3cb410[_0xfa70('0x4b')][_0xfa70('0x8b')];})[_0xfa70('0x26')](function(){return db[_0xfa70('0x2e')][_0xfa70('0x49')]({'where':{'id':_0x3cb410[_0xfa70('0x53')]['id']},'include':[{'model':db[_0xfa70('0x90')],'as':_0xfa70('0x91')},{'model':db[_0xfa70('0xc4')],'as':_0xfa70('0xc4')}]});})['then'](handleEntityNotFound(_0x4d85ae,null))[_0xfa70('0x26')](function(_0x1def23){if(_0x1def23&&_0x1def23['List']){_0x124083=_0x1def23;var _0x3bb6c8=_[_0xfa70('0xb')](_0x3cb410[_0xfa70('0x4b')],{'firstName':_0x3cb410[_0xfa70('0x4b')][_0xfa70('0x8b')],'phone':_0x3cb410[_0xfa70('0x4b')]['from'],'ListId':_0x1def23[_0xfa70('0x8a')]});_0x3bb6c8[_0x3cb410[_0xfa70('0x4b')][_0xfa70('0xc1')]]=_0x3cb410[_0xfa70('0x4b')][_0xfa70('0x8b')];return db['CmContact'][_0xfa70('0xc5')]({'where':_0x1bef11,'defaults':_0x3bb6c8});}})[_0xfa70('0xb0')](function(_0x571e68){if(_0x571e68){_0x1bf8f6=_0x571e68;var _0x1d044c=fs[_0xfa70('0xc6')](path[_0xfa70('0x6a')](config[_0xfa70('0x6b')],_0xfa70('0xc7')),_0xfa70('0xc8'));var _0x3028e8=ejs[_0xfa70('0xc9')](_0x1d044c,{'body':_[_0xfa70('0xca')](_0x3cb410['body']['body']),'bodyTitle':_0x124083[_0xfa70('0xcb')]});return db[_0xfa70('0xcc')][_0xfa70('0x4a')]({'body':_0x3028e8,'plainBody':htmlToText[_0xfa70('0xcd')](_0x3028e8),'ContactId':_0x571e68['id'],'ChatWebsiteId':_0x124083['id']});}})[_0xfa70('0x26')](function(_0x4dc5a5){_0x4bd01f=_0x4dc5a5;if(_0x3cfc60['length']){var _0x32bc77=_0x3cfc60['map'](function(_0x35354c){return{'name':_0x35354c[_0xfa70('0xce')],'basename':_0x35354c[_0xfa70('0x63')],'type':_0x35354c[_0xfa70('0xcf')],'ChatOfflineMessageId':_0x4dc5a5['id']};});_0x1e49d5=_0x32bc77[_0xfa70('0x2d')](_0x1703bc=>{var _0x2bc913={'filename':_0x1703bc[_0xfa70('0x2a')],'path':path[_0xfa70('0x6a')](config['root'],_0xfa70('0xd0'),_0xfa70('0xd1'),'attachments','offline-chat',_0x1703bc[_0xfa70('0xd2')])};return _0x2bc913;});if(!_0x124083[_0xfa70('0xd3')]){return db[_0xfa70('0xd4')][_0xfa70('0xd5')](function(_0x17aedd){return db['Attachment'][_0xfa70('0xd6')](_0x32bc77,{'transaction':_0x17aedd});});}}})[_0xfa70('0x26')](function(){if(_0x4bd01f){_0x1efda4=_0x4bd01f;return db[_0xfa70('0xc4')][_0xfa70('0x5d')]({'where':{'service':!![]},'include':[{'model':db[_0xfa70('0xd7')],'as':_0xfa70('0xd8'),'raw':!![],'include':[{'model':db[_0xfa70('0xd9')],'as':_0xfa70('0xd9'),'raw':!![]}]}]});}})[_0xfa70('0x26')](function(_0x165db6){if(_0x165db6&&_0x165db6[_0xfa70('0xd8')]&&_0x124083['forwardOffline']&&_0x124083['forwardOfflineAddress']){var _0x4bb0df=_0x165db6['getSmtpOptions']();return respondWithRpcPromise('SendMail',_0xfa70('0xda'),{'account':_0x4bb0df,'message':{'from':util[_0xfa70('0xa5')](_0xfa70('0xdb'),_0x165db6[_0xfa70('0x2a')],_0x165db6['email']||_0x165db6[_0xfa70('0xd8')][_0xfa70('0x4c')]),'to':_0x124083[_0xfa70('0xdc')],'subject':_0x124083[_0xfa70('0xdd')],'html':_0x1efda4[_0xfa70('0x4b')],'attachments':_0x1e49d5}},client9003)[_0xfa70('0x26')](function(){return _0x1efda4;})[_0xfa70('0x1c')](function(_0x1a62e6){logger['error'](_0x1a62e6);});}})[_0xfa70('0x26')](function(){if(_0x124083&&_0x124083['openNewInteraction']&&_0x124083['MailAccountId']){var _0x13cbdb=[];if(_0x3cfc60[_0xfa70('0x38')]){_0x13cbdb=_0x3cfc60['map'](function(_0x286ccf){return{'name':_0x286ccf[_0xfa70('0xce')],'basename':_0x286ccf[_0xfa70('0x63')],'type':_0x286ccf[_0xfa70('0xcf')],'ChatOfflineMessageId':_0x4bd01f['id']};});}var _0x290641;if(!_['isNil'](_0x124083['subjectOffline'])){var _0x36a04=_[_0xfa70('0x2d')](_0x3cb410['body'],function(_0x3fa3c1){return _0x3fa3c1;});var _0x24cad0=_[_0xfa70('0xde')](_0x36a04)[0x0];var _0x2f7306=_[_0xfa70('0xdf')](_0x24cad0,function(_0x26ff6f){return _0x26ff6f;});_0x290641=_0x2f7306[0x1][_0x124083[_0xfa70('0xe0')]];}var _0x11a8e9={'from':_0x1bf8f6[_0xfa70('0xe1')],'firstName':_0x1bf8f6[_0xfa70('0x9f')],'lastName':_0x1bf8f6[_0xfa70('0xa0')],'mapKey':_0xfa70('0xe1'),'message':{'from':_0x1bf8f6[_0xfa70('0xe1')],'to':_0x124083['MailAccount'][_0xfa70('0xe1')],'cc':'','subject':_[_0xfa70('0x74')](_0x290641)?_0x124083[_0xfa70('0xdd')]:_0x290641,'messageId':'','sentAt':new Date(),'attach':_0x13cbdb[_0xfa70('0x38')],'attachments':_0x13cbdb,'originChannel':_0xfa70('0xe2'),'ChatWebsiteId':_0x124083['id'],'ChatOfflineMessageId':_0x1efda4['id'],'originTo':_0x124083['MailAccount'][_0xfa70('0xe1')]},'body':_0x1efda4['body']};var _0x53e87d={'account':{'id':_0x124083[_0xfa70('0xe3')]},'body':_0x11a8e9,'log':_0xfa70('0xe4')};return respondWithRpcPromise(_0xfa70('0xe4'),_0xfa70('0xe5'),_0x53e87d,client9001)['then'](function(){return _0x1efda4;})[_0xfa70('0x1c')](function(_0x47078b){logger[_0xfa70('0x17')](_0x47078b);});}return;})[_0xfa70('0x26')](function(){if(_0x1efda4){return _0x1efda4;}})['then'](respondWithResult(_0x4d85ae,null))[_0xfa70('0x1c')](function(_0x314826){logger[_0xfa70('0x17')](_0xfa70('0x1c'),_0x314826);for(var _0x3558b1 of _0x3cfc60){var _0x3fd132=path[_0xfa70('0x6a')](config[_0xfa70('0x6b')],_0xfa70('0xd0'),_0xfa70('0xd1'),'attachments',_0xfa70('0xe6'),_0x3558b1[_0xfa70('0x63')]);fs_extra[_0xfa70('0xe7')](_0x3fd132)[_0xfa70('0x1c')](function(_0x19f0a5){logger[_0xfa70('0x17')](_0xfa70('0xe8'),_0x3fd132,_0x19f0a5);});}});};exports[_0xfa70('0xe9')]=function(_0x3ad0c5,_0x5a32f8){return db[_0xfa70('0xaf')]['find']({'where':{'id':_0x3ad0c5[_0xfa70('0x53')]['id']}})[_0xfa70('0x26')](handleEntityNotFound(_0x5a32f8,null))['then'](function(_0x479453){if(_0x479453){return _0x479453['addInteraction'](_0x3ad0c5[_0xfa70('0x4b')][_0xfa70('0x5b')],_[_0xfa70('0xea')](_0x3ad0c5[_0xfa70('0x4b')],[_0xfa70('0x5b'),'id'])||{});}})[_0xfa70('0x26')](respondWithResult(_0x5a32f8,null))[_0xfa70('0x1c')](handleError(_0x5a32f8,null));};exports[_0xfa70('0xeb')]=function(_0x507bc1,_0x5479a4){var _0x17b586={'raw':![],'where':{}};var _0x2f697c={};var _0x559225={'count':0x0,'rows':[]};return db[_0xfa70('0x2e')][_0xfa70('0x5d')]({'where':{'id':_0x507bc1[_0xfa70('0x53')]['id']}})[_0xfa70('0x26')](handleEntityNotFound(_0x5479a4,null))['then'](function(_0x1354a1){if(_0x1354a1){_0x2f697c[_0xfa70('0x32')]=_[_0xfa70('0x34')](db[_0xfa70('0xaf')][_0xfa70('0x2f')]);_0x2f697c['query']=_[_0xfa70('0x34')](_0x507bc1[_0xfa70('0x33')]);_0x2f697c[_0xfa70('0x3e')]=_[_0xfa70('0x35')](_0x2f697c[_0xfa70('0x32')],_0x2f697c[_0xfa70('0x33')]);_0x17b586[_0xfa70('0x37')]=_[_0xfa70('0x35')](_0x2f697c[_0xfa70('0x32')],qs[_0xfa70('0x36')](_0x507bc1[_0xfa70('0x33')]['fields']));_0x17b586[_0xfa70('0x37')]=_0x17b586[_0xfa70('0x37')][_0xfa70('0x38')]?_0x17b586['attributes']:_0x2f697c[_0xfa70('0x32')];if(!_0x507bc1[_0xfa70('0x33')][_0xfa70('0x39')](_0xfa70('0x5f'))){_0x17b586['limit']=qs[_0xfa70('0x22')](_0x507bc1[_0xfa70('0x33')]['limit']);_0x17b586['offset']=qs['offset'](_0x507bc1['query'][_0xfa70('0x20')]);}_0x17b586[_0xfa70('0x3a')]=qs[_0xfa70('0x3b')](_0x507bc1[_0xfa70('0x33')][_0xfa70('0x3b')]);_0x17b586[_0xfa70('0x3c')]=qs[_0xfa70('0x3e')](_[_0xfa70('0x3d')](_0x507bc1[_0xfa70('0x33')],_0x2f697c[_0xfa70('0x3e')]));_0x17b586['where'][_0xfa70('0x56')]=_0x1354a1['id'];if(_0x507bc1[_0xfa70('0x33')][_0xfa70('0x3f')]){_0x17b586['where']=_['merge'](_0x17b586[_0xfa70('0x3c')],{'$or':_[_0xfa70('0x2d')](_0x17b586['attributes'],function(_0x594226){var _0x398cee={};_0x398cee[_0x594226]={'$like':'%'+_0x507bc1[_0xfa70('0x33')][_0xfa70('0x3f')]+'%'};return _0x398cee;})});}_0x17b586=_[_0xfa70('0x40')]({},_0x17b586,_0x507bc1[_0xfa70('0x42')]);return db[_0xfa70('0xaf')][_0xfa70('0x23')]({'where':_0x17b586[_0xfa70('0x3c')]})[_0xfa70('0x26')](function(_0x3ef1f1){_0x559225[_0xfa70('0x23')]=_0x3ef1f1;if(_0x507bc1['query'][_0xfa70('0x48')]){_0x17b586['include']=[{'model':db[_0xfa70('0x82')],'as':_0xfa70('0xec'),'required':![]},{'model':db[_0xfa70('0xb9')],'as':_0xfa70('0xed'),'attributes':['name',_0xfa70('0xee'),'internal'],'required':![]},{'model':db[_0xfa70('0xef')],'as':_0xfa70('0xf0'),'attributes':['id',_0xfa70('0x2a'),_0xfa70('0xf1')],'where':_0x507bc1[_0xfa70('0x33')][_0xfa70('0xf2')]?{'id':_0x507bc1['query'][_0xfa70('0xf2')]}:undefined,'required':_0x507bc1['query']['tag']?!![]:![]}];}return db[_0xfa70('0xaf')][_0xfa70('0x59')](_0x17b586);})[_0xfa70('0x26')](function(_0x303beb){_0x559225['rows']=_0x303beb;return _0x559225;});}})[_0xfa70('0x26')](respondWithFilteredResult(_0x5479a4,_0x17b586))[_0xfa70('0x1c')](handleError(_0x5479a4,null));};function iftimePromise(_0x9e9f99,_0x1d0e9d){return respondWithRpcPromise(_0xfa70('0xf3'),_0xfa70('0xf4'),{'command':_0x1d0e9d[_0xfa70('0xf5')]?util[_0xfa70('0xa5')](_0xfa70('0xf6'),_0x9e9f99[_0xfa70('0xf7')],_0x1d0e9d[_0xfa70('0xf5')]):util[_0xfa70('0xa5')]('iftime\x20%s',_0x9e9f99[_0xfa70('0xf7')])},client9002)[_0xfa70('0x26')](function(_0x2be633){var _0x4fbad2=_0x2be633&&_0x2be633[_0xfa70('0xf8')](_0xfa70('0xf9'))>=0x0?!![]:![];logger[_0xfa70('0x13')](_0xfa70('0xfa'),_0x1d0e9d['id'],_0x9e9f99['id'],_0x9e9f99[_0xfa70('0xf7')],_0x4fbad2?_0xfa70('0xfb'):_0xfa70('0xfc'),_0x1d0e9d[_0xfa70('0xf5')]?_0x1d0e9d[_0xfa70('0xf5')]:_0xfa70('0xfd'));return _0x4fbad2;})[_0xfa70('0x1c')](function(_0x546bc9){logger[_0xfa70('0x17')](_0xfa70('0xfa'),_0x1d0e9d['id'],_0x9e9f99['id'],_0x9e9f99['interval'],util['inspect'](_0x546bc9,{'showHidden':![],'depth':null}),_0x1d0e9d[_0xfa70('0xf5')]?_0x1d0e9d[_0xfa70('0xf5')]:_0xfa70('0xfd'));return![];});}exports[_0xfa70('0xf4')]=function(_0x5d040a,_0x8a6a34){var _0x527efc=0x0;var _0x358579=0x0;var _0xd1827f=![];var _0x15f198;var _0x368ba8;return db['ChatWebsite'][_0xfa70('0x49')]({'where':{'id':_0x5d040a['params']['id']},'include':[{'model':db[_0xfa70('0xfe')],'as':_0xfa70('0xfe'),'include':[{'model':db[_0xfa70('0xfe')],'as':_0xfa70('0xff'),'attributes':['id','interval'],'raw':!![]}]}]})[_0xfa70('0x26')](handleEntityNotFound(_0x8a6a34,null))[_0xfa70('0x26')](function(_0x2ff5ba){if(_0x2ff5ba){_0x15f198=_0x2ff5ba;return _0x2ff5ba[_0xfa70('0x100')]({'raw':!![]});}})['then'](function(_0x47d246){if(_0x15f198){if(_0x47d246){_0x368ba8=_0x47d246;}}return require(_0xfa70('0x6d'))[_0xfa70('0x101')]();})[_0xfa70('0x26')](function(_0x317dca){if(_0x317dca){_0x358579=_0x317dca[_0xfa70('0x102')];_0xd1827f=_0x317dca[_0xfa70('0x6e')];}})[_0xfa70('0x26')](function(){return db[_0xfa70('0xaf')]['count']({'where':{'closed':![]}});})['then'](function(_0x23cae4){_0x527efc=_0x23cae4;if(_0x358579&&_0x23cae4>_0x358579){return db['License'][_0xfa70('0x5d')]({'where':{'id':0x1}})[_0xfa70('0x26')](function(_0x5afae7){if(_0x5afae7){_0x5afae7[_0xfa70('0x103')](_0xfa70('0x104'));}});}})['then'](function(){if(_0x15f198[_0xfa70('0xfe')]&&_0x15f198[_0xfa70('0xfe')]['Intervals']){var _0x31ff0f=[];for(var _0x37d4d2=0x0;_0x37d4d2<_0x15f198[_0xfa70('0xfe')]['Intervals'][_0xfa70('0x38')];_0x37d4d2++){var _0x1531f4=_0x15f198[_0xfa70('0xfe')][_0xfa70('0xff')][_0x37d4d2][_0xfa70('0x28')]({'plain':!![]});_0x31ff0f[_0xfa70('0xb3')](iftimePromise(_0x1531f4,_0x15f198));}return BPromise[_0xfa70('0x105')](_0x31ff0f)['then'](function(_0x2d97d9){return _[_0xfa70('0x106')](_0x2d97d9);});}else{return!![];}})['then'](function(_0x41cd40){var _0x2e436b=fs['readFileSync'](path[_0xfa70('0x6a')](config['root'],_0xfa70('0x107')),_0xfa70('0xc8'));var _0x92670e=new url[(_0xfa70('0x108'))](_0x15f198[_0xfa70('0x109')])[_0xfa70('0x10a')];var _0x16743c=_0xfa70('0x10b');var _0x6c439e=![];var _0x45cfc3={'chatVersion':_0x16743c,'chatWebsiteAddressOrigin':_0x92670e,'remote':_0x15f198[_0xfa70('0x10c')],'query':querystring[_0xfa70('0x10d')](_[_0xfa70('0x40')](_0x15f198[_0xfa70('0x28')]({'plain':!![]}),{'customerIp':_0x5d040a['headers'][_0xfa70('0x9d')]||_0x5d040a[_0xfa70('0x7e')][_0xfa70('0x10e')]||_0x5d040a[_0xfa70('0x10f')][_0xfa70('0x110')]||_0x5d040a['ip'],'referer':_0x5d040a[_0xfa70('0x7e')][_0xfa70('0xa2')],'openedInteractions':_0x527efc,'maxInteractions':_0x358579,'virtual':_0xd1827f[_0xfa70('0x102')],'online':_0x41cd40,'custom':_0xd1827f}))['replace'](/'/g,'\x5c\x27')};_0x8a6a34[_0xfa70('0x2b')](ejs[_0xfa70('0xc9')](Mustache[_0xfa70('0xc9')](_0x2e436b,_0x45cfc3),{'proactiveActions':_0x368ba8,'alignment':_0x15f198[_0xfa70('0x111')],'verticalAlignment':_0x15f198[_0xfa70('0x112')],'div_color':_0x15f198[_0xfa70('0xf1')],'labelText':_0x15f198[_0xfa70('0x113')],'text_color':_0x15f198[_0xfa70('0x114')],'text_button_color':_0x15f198['textButtonColor'],'button_color':_0x15f198[_0xfa70('0x115')],'background_color':_0x15f198['backgroundColor'],'hideWhenOffline':_0x15f198['hideWhenOffline'],'intervalId':_0x15f198[_0xfa70('0x116')],'isDevelopment':_0x6c439e,'chatVersion':_0x16743c}));})['catch'](handleError(_0x8a6a34,null));};exports[_0xfa70('0x117')]=function(_0x10b327,_0xf03ac0){var _0x1e64cd=_0x10b327[_0xfa70('0x53')]['id'];var _0x13abfb=_0x10b327[_0xfa70('0x4b')];var _0x44bf2e=0xc8;var _0x1a599d=null;return db[_0xfa70('0xd4')][_0xfa70('0xd5')]({'isolationLevel':db[_0xfa70('0xd4')][_0xfa70('0x118')][_0xfa70('0x119')][_0xfa70('0x11a')]},function(_0x1097cc){return db[_0xfa70('0x2e')]['findOne']({'where':{'id':_0x1e64cd},'transaction':_0x1097cc})[_0xfa70('0x26')](function(_0x33f475){if(_0x33f475){return db['ChatApplication'][_0xfa70('0x27')]({'where':{'ChatWebsiteId':_0x1e64cd},'transaction':_0x1097cc})[_0xfa70('0x26')](function(){var _0x3164d2=_[_0xfa70('0x2d')](_0x13abfb,function(_0x40a8b6){_0x40a8b6[_0xfa70('0x56')]=_0x1e64cd;return _0x40a8b6;});return db[_0xfa70('0x11b')][_0xfa70('0xd6')](_0x3164d2,{'transaction':_0x1097cc});});}else{_0x44bf2e=0x194;_0x1a599d=[];}});})[_0xfa70('0x26')](function(){if(_0x44bf2e!==0x194){return db[_0xfa70('0x11b')][_0xfa70('0x11c')]({'where':{'ChatWebsiteId':_0x1e64cd},'order':_0xfa70('0x11d')})[_0xfa70('0x26')](function(_0x1d5405){_0x1a599d=_0x1d5405;});}})[_0xfa70('0x1c')](function(_0x4f48c5){_0x44bf2e=0x1f4;logger[_0xfa70('0x17')](_0x4f48c5['stack']);if(_0x4f48c5[_0xfa70('0x2a')]){delete _0x4f48c5[_0xfa70('0x2a')];}_0x1a599d=_0x4f48c5;})[_0xfa70('0x11e')](function(){if(_0x1a599d===null){_0xf03ac0[_0xfa70('0x29')](_0x44bf2e);}else{if(_0x44bf2e===0x1f4){_0xf03ac0[_0xfa70('0x1d')](_0x44bf2e)[_0xfa70('0x2b')](_0x1a599d);}else{_0xf03ac0['status'](_0x44bf2e)[_0xfa70('0x1f')](_0x1a599d);}}});};exports[_0xfa70('0x11f')]=function(_0x3516ca,_0x2be032){var _0x374801={};var _0x5a39c9={};var _0x24b58c;var _0x23dce1;return db[_0xfa70('0x2e')]['findOne']({'where':{'id':_0x3516ca[_0xfa70('0x53')]['id']}})[_0xfa70('0x26')](handleEntityNotFound(_0x2be032,null))[_0xfa70('0x26')](function(_0x266c0b){if(_0x266c0b){_0x24b58c=_0x266c0b;_0x5a39c9[_0xfa70('0x32')]=_[_0xfa70('0x34')](db[_0xfa70('0x11b')][_0xfa70('0x2f')]);_0x5a39c9[_0xfa70('0x33')]=_['keys'](_0x3516ca['query']);_0x5a39c9[_0xfa70('0x3e')]=_[_0xfa70('0x35')](_0x5a39c9['model'],_0x5a39c9[_0xfa70('0x33')]);_0x374801[_0xfa70('0x37')]=_[_0xfa70('0x35')](_0x5a39c9[_0xfa70('0x32')],qs[_0xfa70('0x36')](_0x3516ca['query'][_0xfa70('0x36')]));_0x374801[_0xfa70('0x37')]=_0x374801[_0xfa70('0x37')]['length']?_0x374801['attributes']:_0x5a39c9['model'];_0x374801[_0xfa70('0x3a')]=qs[_0xfa70('0x3b')](_0x3516ca[_0xfa70('0x33')]['sort']);_0x374801[_0xfa70('0x3c')]=qs[_0xfa70('0x3e')](_[_0xfa70('0x3d')](_0x3516ca[_0xfa70('0x33')],_0x5a39c9[_0xfa70('0x3e')]));if(_0x3516ca[_0xfa70('0x33')][_0xfa70('0x3f')]){_0x374801[_0xfa70('0x3c')]=_[_0xfa70('0x40')](_0x374801[_0xfa70('0x3c')],{'$or':_[_0xfa70('0x2d')](_0x374801[_0xfa70('0x37')],function(_0x37a8ee){var _0x231dd4={};_0x231dd4[_0x37a8ee]={'$like':'%'+_0x3516ca['query'][_0xfa70('0x3f')]+'%'};return _0x231dd4;})});}_0x374801=_[_0xfa70('0x40')]({},_0x374801,_0x3516ca['options']);return _0x24b58c[_0xfa70('0x11f')](_0x374801);}})[_0xfa70('0x26')](function(_0x4b651c){if(_0x4b651c){_0x23dce1=_0x4b651c[_0xfa70('0x38')];if(!_0x3516ca[_0xfa70('0x33')][_0xfa70('0x39')](_0xfa70('0x5f'))){_0x374801[_0xfa70('0x22')]=qs['limit'](_0x3516ca[_0xfa70('0x33')][_0xfa70('0x22')]);_0x374801[_0xfa70('0x20')]=qs['offset'](_0x3516ca[_0xfa70('0x33')]['offset']);}return _0x24b58c['getApplications'](_0x374801);}})[_0xfa70('0x26')](function(_0x246d20){if(_0x246d20){return _0x246d20?{'count':_0x23dce1,'rows':_0x246d20}:null;}})['then'](respondWithResult(_0x2be032,null))[_0xfa70('0x1c')](handleError(_0x2be032,null));};exports[_0xfa70('0x120')]=function(_0x444e2a,_0x5ec26b){return db[_0xfa70('0x121')][_0xfa70('0x49')]({'where':{'id':_0x444e2a['params']['id']}})[_0xfa70('0x26')](handleEntityNotFound(_0x5ec26b,null))[_0xfa70('0x26')](function(_0x10d4d7){if(_0x10d4d7){return _0x10d4d7[_0xfa70('0x120')](_0x444e2a['body']['ids'],_['omit'](_0x444e2a[_0xfa70('0x4b')],['ids','id'])||{});}})[_0xfa70('0x26')](respondWithResult(_0x5ec26b,null))[_0xfa70('0x1c')](handleError(_0x5ec26b,null));};exports[_0xfa70('0x100')]=function(_0x1cf8d2,_0x38378b){var _0x2f1159={};var _0x12f808={};var _0x483a4d;var _0x1851c4;return db['ChatWebsite'][_0xfa70('0x5d')]({'where':{'id':_0x1cf8d2['params']['id']}})[_0xfa70('0x26')](handleEntityNotFound(_0x38378b,null))['then'](function(_0x70f27a){if(_0x70f27a){_0x483a4d=_0x70f27a;_0x12f808[_0xfa70('0x32')]=_[_0xfa70('0x34')](db[_0xfa70('0x122')][_0xfa70('0x2f')]);_0x12f808[_0xfa70('0x33')]=_[_0xfa70('0x34')](_0x1cf8d2[_0xfa70('0x33')]);_0x12f808[_0xfa70('0x3e')]=_[_0xfa70('0x35')](_0x12f808[_0xfa70('0x32')],_0x12f808['query']);_0x2f1159['attributes']=_[_0xfa70('0x35')](_0x12f808[_0xfa70('0x32')],qs[_0xfa70('0x36')](_0x1cf8d2[_0xfa70('0x33')][_0xfa70('0x36')]));_0x2f1159['attributes']=_0x2f1159[_0xfa70('0x37')][_0xfa70('0x38')]?_0x2f1159['attributes']:_0x12f808[_0xfa70('0x32')];_0x2f1159[_0xfa70('0x3a')]=qs[_0xfa70('0x3b')](_0x1cf8d2[_0xfa70('0x33')][_0xfa70('0x3b')]);_0x2f1159[_0xfa70('0x3c')]=qs[_0xfa70('0x3e')](_['pick'](_0x1cf8d2[_0xfa70('0x33')],_0x12f808[_0xfa70('0x3e')]));if(_0x1cf8d2[_0xfa70('0x33')]['filter']){_0x2f1159['where']=_['merge'](_0x2f1159[_0xfa70('0x3c')],{'$or':_['map'](_0x2f1159['attributes'],function(_0x39c25f){var _0x414e08={};_0x414e08[_0x39c25f]={'$like':'%'+_0x1cf8d2[_0xfa70('0x33')]['filter']+'%'};return _0x414e08;})});}_0x2f1159=_[_0xfa70('0x40')]({},_0x2f1159,_0x1cf8d2[_0xfa70('0x42')]);return _0x483a4d['getProactiveActions'](_0x2f1159);}})[_0xfa70('0x26')](function(_0x257978){if(_0x257978){_0x1851c4=_0x257978['length'];if(!_0x1cf8d2['query'][_0xfa70('0x39')](_0xfa70('0x5f'))){_0x2f1159[_0xfa70('0x22')]=qs[_0xfa70('0x22')](_0x1cf8d2['query'][_0xfa70('0x22')]);_0x2f1159[_0xfa70('0x20')]=qs[_0xfa70('0x20')](_0x1cf8d2[_0xfa70('0x33')][_0xfa70('0x20')]);}return _0x483a4d[_0xfa70('0x100')](_0x2f1159);}})[_0xfa70('0x26')](function(_0x33c404){if(_0x33c404){return _0x33c404?{'count':_0x1851c4,'rows':_0x33c404}:null;}})[_0xfa70('0x26')](respondWithResult(_0x38378b,null))['catch'](handleError(_0x38378b,null));};exports[_0xfa70('0x123')]=function(_0x427ef8,_0x4c0a75){var _0x25bae3=_0x427ef8['query'][_0xfa70('0x124')]==='false'?_0xfa70('0x125'):_0xfa70('0x126');return db[_0xfa70('0x2e')][_0xfa70('0x49')]({'attributes':['id',_0x25bae3],'where':{'id':_0x427ef8[_0xfa70('0x53')]['id']}})[_0xfa70('0x26')](handleEntityNotFound(_0x4c0a75,null))[_0xfa70('0x26')](function(_0x59c5b8){if(_0x59c5b8){var _0x18985b=_0x59c5b8[_0x25bae3];var _0x1c184a=_0x18985b&&_0x18985b[_0xfa70('0x127')]?_0x18985b[_0xfa70('0x127')]:[];_0x4c0a75[_0xfa70('0x2b')]({'fromKey':_[_0xfa70('0x74')](_0x18985b[_0xfa70('0x128')])?undefined:_0x18985b[_0xfa70('0x128')],'count':_0x1c184a[_0xfa70('0x38')],'rows':_0x1c184a});}})['catch'](handleError(_0x4c0a75,null));};exports[_0xfa70('0x129')]=function(_0x1a90d1,_0x214792){var _0x529929={'raw':![],'where':{}};var _0x607581={};var _0x5f3d69={'count':0x0,'rows':[]};return db[_0xfa70('0x2e')][_0xfa70('0x5d')]({'where':{'id':_0x1a90d1['params']['id']}})[_0xfa70('0x26')](handleEntityNotFound(_0x214792,null))['then'](function(_0x223185){if(_0x223185){_0x607581['model']=_[_0xfa70('0x34')](db[_0xfa70('0xcc')][_0xfa70('0x2f')]);_0x607581[_0xfa70('0x33')]=_['keys'](_0x1a90d1[_0xfa70('0x33')]);_0x607581['filters']=_['intersection'](_0x607581[_0xfa70('0x32')],_0x607581[_0xfa70('0x33')]);_0x529929[_0xfa70('0x37')]=_['intersection'](_0x607581['model'],qs[_0xfa70('0x36')](_0x1a90d1['query'][_0xfa70('0x36')]));_0x529929[_0xfa70('0x37')]=_0x529929[_0xfa70('0x37')][_0xfa70('0x38')]?_0x529929[_0xfa70('0x37')]:_0x607581[_0xfa70('0x32')];if(!_0x1a90d1[_0xfa70('0x33')][_0xfa70('0x39')](_0xfa70('0x5f'))){_0x529929[_0xfa70('0x22')]=qs[_0xfa70('0x22')](_0x1a90d1['query'][_0xfa70('0x22')]);_0x529929[_0xfa70('0x20')]=qs[_0xfa70('0x20')](_0x1a90d1['query'][_0xfa70('0x20')]);}_0x529929[_0xfa70('0x3a')]=qs[_0xfa70('0x3b')](_0x1a90d1['query'][_0xfa70('0x3b')]);_0x529929[_0xfa70('0x3c')]=qs[_0xfa70('0x3e')](_['pick'](_0x1a90d1[_0xfa70('0x33')],_0x607581[_0xfa70('0x3e')]));_0x529929[_0xfa70('0x3c')][_0xfa70('0x56')]=_0x223185['id'];if(_0x1a90d1['query'][_0xfa70('0x3f')]){_0x529929[_0xfa70('0x3c')]=_[_0xfa70('0x40')](_0x529929[_0xfa70('0x3c')],{'$or':_[_0xfa70('0x2d')](_0x529929['attributes'],function(_0x55b6ab){var _0x5e4e2b={};_0x5e4e2b[_0x55b6ab]={'$like':'%'+_0x1a90d1[_0xfa70('0x33')]['filter']+'%'};return _0x5e4e2b;})});}_0x529929=_[_0xfa70('0x40')]({},_0x529929,_0x1a90d1[_0xfa70('0x42')]);return db[_0xfa70('0xcc')][_0xfa70('0x23')]({'where':_0x529929[_0xfa70('0x3c')]})['then'](function(_0x5d455d){_0x5f3d69[_0xfa70('0x23')]=_0x5d455d;if(_0x1a90d1[_0xfa70('0x33')]['includeAll']){_0x529929[_0xfa70('0x43')]=[{'all':!![]}];}else{_0x529929[_0xfa70('0x43')]=[{'model':db[_0xfa70('0x82')],'as':'Contact','required':![]},{'model':db[_0xfa70('0x12a')],'as':'Attachments','required':![]}];}return db[_0xfa70('0xcc')]['findAll'](_0x529929);})[_0xfa70('0x26')](function(_0x36c336){_0x5f3d69[_0xfa70('0x44')]=_0x36c336;return _0x5f3d69;});}})[_0xfa70('0x26')](respondWithFilteredResult(_0x214792,_0x529929))['catch'](handleError(_0x214792,null));};exports[_0xfa70('0x12b')]=function(_0xcce62c,_0x42e3ad){return db[_0xfa70('0x2e')][_0xfa70('0x49')]({'where':{'id':_0xcce62c[_0xfa70('0x53')]['id']}})[_0xfa70('0x26')](handleEntityNotFound(_0x42e3ad,null))[_0xfa70('0x26')](function(_0x126c06){if(_0x126c06){return _0x126c06[_0xfa70('0x12b')](_0xcce62c['body'][_0xfa70('0x5b')],_[_0xfa70('0xea')](_0xcce62c[_0xfa70('0x4b')],['ids','id'])||{})[_0xfa70('0xb0')](function(_0x365984){for(var _0x35ee1c=0x0;_0x35ee1c<_0xcce62c['body'][_0xfa70('0x5b')][_0xfa70('0x38')];_0x35ee1c+=0x1){socket[_0xfa70('0x12c')](_0xfa70('0x12d'),{'UserId':Number(_0xcce62c['body'][_0xfa70('0x5b')][_0x35ee1c]),'ChatWebsiteId':Number(_0xcce62c[_0xfa70('0x53')]['id'])});}return _0x365984;});}})['then'](respondWithResult(_0x42e3ad,null))[_0xfa70('0x1c')](handleError(_0x42e3ad,null));};exports[_0xfa70('0x12e')]=function(_0x640da1,_0x5defd9){return db[_0xfa70('0x2e')]['find']({'where':{'id':_0x640da1[_0xfa70('0x53')]['id']}})[_0xfa70('0x26')](handleEntityNotFound(_0x5defd9,null))[_0xfa70('0x26')](function(_0x3b4663){if(_0x3b4663){return _0x3b4663['removeAgents'](_0x640da1[_0xfa70('0x33')][_0xfa70('0x5b')])[_0xfa70('0x26')](function(){if(_[_0xfa70('0x12f')](_0x640da1['query'][_0xfa70('0x5b')])){for(var _0x14be27=0x0;_0x14be27<_0x640da1[_0xfa70('0x33')][_0xfa70('0x5b')][_0xfa70('0x38')];_0x14be27+=0x1){socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x640da1['query']['ids'][_0x14be27]),'ChatWebsiteId':Number(_0x640da1[_0xfa70('0x53')]['id'])});}}else{socket[_0xfa70('0x12c')](_0xfa70('0x130'),{'UserId':Number(_0x640da1[_0xfa70('0x33')][_0xfa70('0x5b')]),'ChatWebsiteId':Number(_0x640da1[_0xfa70('0x53')]['id'])});}});}})[_0xfa70('0x26')](respondWithStatusCode(_0x5defd9,null))['catch'](handleError(_0x5defd9,null));};exports[_0xfa70('0x131')]=function(_0x44975d,_0x20c7aa){var _0x1d23bd={};var _0x467df8={};var _0x3869b3;var _0x3107a4;return db[_0xfa70('0x2e')][_0xfa70('0x5d')]({'where':{'id':_0x44975d[_0xfa70('0x53')]['id']}})[_0xfa70('0x26')](handleEntityNotFound(_0x20c7aa,null))[_0xfa70('0x26')](function(_0x38c149){if(_0x38c149){_0x3869b3=_0x38c149;_0x467df8[_0xfa70('0x32')]=_[_0xfa70('0x34')](db[_0xfa70('0xb9')]['rawAttributes']);_0x467df8[_0xfa70('0x33')]=_[_0xfa70('0x34')](_0x44975d['query']);_0x467df8[_0xfa70('0x3e')]=_[_0xfa70('0x35')](_0x467df8[_0xfa70('0x32')],_0x467df8[_0xfa70('0x33')]);_0x1d23bd['attributes']=_['intersection'](_0x467df8[_0xfa70('0x32')],qs[_0xfa70('0x36')](_0x44975d[_0xfa70('0x33')][_0xfa70('0x36')]));_0x1d23bd[_0xfa70('0x37')]=_0x1d23bd[_0xfa70('0x37')][_0xfa70('0x38')]?_0x1d23bd[_0xfa70('0x37')]:_0x467df8[_0xfa70('0x32')];_0x1d23bd['order']=qs[_0xfa70('0x3b')](_0x44975d[_0xfa70('0x33')][_0xfa70('0x3b')]);_0x1d23bd[_0xfa70('0x3c')]=qs[_0xfa70('0x3e')](_[_0xfa70('0x3d')](_0x44975d[_0xfa70('0x33')],_0x467df8[_0xfa70('0x3e')]));if(_0x44975d['query'][_0xfa70('0x3f')]){_0x1d23bd[_0xfa70('0x3c')]=_['merge'](_0x1d23bd[_0xfa70('0x3c')],{'$or':_[_0xfa70('0x2d')](_0x1d23bd['attributes'],function(_0x105cf8){var _0x27469c={};_0x27469c[_0x105cf8]={'$like':'%'+_0x44975d[_0xfa70('0x33')]['filter']+'%'};return _0x27469c;})});}_0x1d23bd=_[_0xfa70('0x40')]({},_0x1d23bd,_0x44975d[_0xfa70('0x42')]);return _0x3869b3['getAgents'](_0x1d23bd);}})['then'](function(_0x38973c){if(_0x38973c){_0x3107a4=_0x38973c[_0xfa70('0x38')];if(!_0x44975d['query'][_0xfa70('0x39')](_0xfa70('0x5f'))){_0x1d23bd['limit']=qs[_0xfa70('0x22')](_0x44975d[_0xfa70('0x33')][_0xfa70('0x22')]);_0x1d23bd[_0xfa70('0x20')]=qs['offset'](_0x44975d[_0xfa70('0x33')][_0xfa70('0x20')]);}return _0x3869b3[_0xfa70('0x131')](_0x1d23bd);}})[_0xfa70('0x26')](function(_0xc2610e){if(_0xc2610e){return _0xc2610e?{'count':_0x3107a4,'rows':_0xc2610e}:null;}})['then'](respondWithResult(_0x20c7aa,null))[_0xfa70('0x1c')](handleError(_0x20c7aa,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 07847de..d7d42c5 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 _0xbe48=['exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save','emit','hasOwnProperty','hook'];(function(_0x2b8907,_0x2e15a4){var _0x1a4f5a=function(_0x4ab1e2){while(--_0x4ab1e2){_0x2b8907['push'](_0x2b8907['shift']());}};_0x1a4f5a(++_0x2e15a4);}(_0xbe48,0x121));var _0x8be4=function(_0x1d591d,_0x3b0814){_0x1d591d=_0x1d591d-0x0;var _0x147f9f=_0xbe48[_0x1d591d];return _0x147f9f;};'use strict';var EventEmitter=require(_0x8be4('0x0'));var ChatWebsite=require(_0x8be4('0x1'))['db'][_0x8be4('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x8be4('0x3')](0x0);var events={'afterCreate':_0x8be4('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3404c7){return function(_0x95e50e,_0x53fdb0,_0x191a88){ChatWebsiteEvents[_0x8be4('0x5')](_0x3404c7+':'+_0x95e50e['id'],_0x95e50e);ChatWebsiteEvents[_0x8be4('0x5')](_0x3404c7,_0x95e50e);_0x191a88(null);};}for(var e in events){if(events[_0x8be4('0x6')](e)){var event=events[e];ChatWebsite[_0x8be4('0x7')](e,emitEvent(event));}}module[_0x8be4('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0xcf1c=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x1f993a,_0x2391e8){var _0x49d756=function(_0xf15d56){while(--_0xf15d56){_0x1f993a['push'](_0x1f993a['shift']());}};_0x49d756(++_0x2391e8);}(_0xcf1c,0x18d));var _0xccf1=function(_0x458f09,_0xf2ee90){_0x458f09=_0x458f09-0x0;var _0x1ca565=_0xcf1c[_0x458f09];return _0x1ca565;};'use strict';var EventEmitter=require(_0xccf1('0x0'));var ChatWebsite=require(_0xccf1('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xccf1('0x2')](0x0);var events={'afterCreate':_0xccf1('0x3'),'afterUpdate':_0xccf1('0x4'),'afterDestroy':_0xccf1('0x5')};function emitEvent(_0x5670d0){return function(_0x5d3e85,_0x509c8d,_0x301b38){ChatWebsiteEvents['emit'](_0x5670d0+':'+_0x5d3e85['id'],_0x5d3e85);ChatWebsiteEvents[_0xccf1('0x6')](_0x5670d0,_0x5d3e85);_0x301b38(null);};}for(var e in events){if(events[_0xccf1('0x7')](e)){var event=events[e];ChatWebsite[_0xccf1('0x8')](e,emitEvent(event));}}module[_0xccf1('0x9')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 6eb2284..c4e018d 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 _0x9701=['moment','bluebird','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','util','api'];(function(_0x2cb7a1,_0x49f4ee){var _0x3ff7ff=function(_0x3b6ed9){while(--_0x3b6ed9){_0x2cb7a1['push'](_0x2cb7a1['shift']());}};_0x3ff7ff(++_0x49f4ee);}(_0x9701,0x198));var _0x1970=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9701[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var util=require(_0x1970('0x0'));var logger=require('../../config/logger')(_0x1970('0x1'));var moment=require(_0x1970('0x2'));var BPromise=require(_0x1970('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1970('0x4'));var rimraf=require(_0x1970('0x5'));var config=require(_0x1970('0x6'));var attributes=require(_0x1970('0x7'));module[_0x1970('0x8')]=function(_0x5bc374,_0x80d2d2){return _0x5bc374[_0x1970('0x9')]('ChatWebsite',attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5061=['lodash','util','../../config/logger','api','moment','path','rimraf','./chatWebsite.attributes','define','ChatWebsite','chat_websites'];(function(_0x1b4a2c,_0x3fc60b){var _0x40a60e=function(_0xf9feb){while(--_0xf9feb){_0x1b4a2c['push'](_0x1b4a2c['shift']());}};_0x40a60e(++_0x3fc60b);}(_0x5061,0x176));var _0x1506=function(_0x4d9bb2,_0x3db50d){_0x4d9bb2=_0x4d9bb2-0x0;var _0x3179fe=_0x5061[_0x4d9bb2];return _0x3179fe;};'use strict';var _=require(_0x1506('0x0'));var util=require(_0x1506('0x1'));var logger=require(_0x1506('0x2'))(_0x1506('0x3'));var moment=require(_0x1506('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1506('0x5'));var rimraf=require(_0x1506('0x6'));var config=require('../../config/environment');var attributes=require(_0x1506('0x7'));module['exports']=function(_0x371fb7,_0x6836cd){return _0x371fb7[_0x1506('0x8')](_0x1506('0x9'),attributes,{'tableName':_0x1506('0xa'),'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 896acc7..77d4696 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 _0xcc56=['./chatWebsite.socket','request','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','code','error','ChatWebsite,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x2f9ecc,_0x417125){var _0x121b0a=function(_0xaf4c53){while(--_0xaf4c53){_0x2f9ecc['push'](_0x2f9ecc['shift']());}};_0x121b0a(++_0x417125);}(_0xcc56,0x14d));var _0x6cc5=function(_0x58fa29,_0x1135f2){_0x58fa29=_0x58fa29-0x0;var _0x59044e=_0xcc56[_0x58fa29];return _0x59044e;};'use strict';var _=require(_0x6cc5('0x0'));var util=require(_0x6cc5('0x1'));var moment=require(_0x6cc5('0x2'));var BPromise=require(_0x6cc5('0x3'));var rs=require(_0x6cc5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6cc5('0x5'))['db'];var utils=require(_0x6cc5('0x6'));var logger=require(_0x6cc5('0x7'))(_0x6cc5('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6cc5('0x9')][_0x6cc5('0xa')]({'port':0x232a});config[_0x6cc5('0xb')]=_[_0x6cc5('0xc')](config[_0x6cc5('0xb')],{'host':_0x6cc5('0xd'),'port':0x18eb});var socket=require(_0x6cc5('0xe'))(new Redis(config[_0x6cc5('0xb')]));require(_0x6cc5('0xf'))['register'](socket);function respondWithRpcPromise(_0x206311,_0x4563ab,_0x58e582){return new BPromise(function(_0x4f0be3,_0x5e630f){return client[_0x6cc5('0x10')](_0x206311,_0x58e582)[_0x6cc5('0x11')](function(_0x39af30){logger[_0x6cc5('0x12')]('ChatWebsite,\x20%s,\x20%s',_0x4563ab,_0x6cc5('0x13'));logger[_0x6cc5('0x14')](_0x6cc5('0x15'),_0x4563ab,'request\x20sent',JSON[_0x6cc5('0x16')](_0x39af30));if(_0x39af30['error']){if(_0x39af30['error'][_0x6cc5('0x17')]===0x1f4){logger[_0x6cc5('0x18')](_0x6cc5('0x19'),_0x4563ab,_0x39af30[_0x6cc5('0x18')]['message']);return _0x5e630f(_0x39af30['error']['message']);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x4563ab,_0x39af30['error']['message']);return _0x4f0be3(_0x39af30[_0x6cc5('0x18')][_0x6cc5('0x1a')]);}else{logger[_0x6cc5('0x12')](_0x6cc5('0x19'),_0x4563ab,_0x6cc5('0x13'));_0x4f0be3(_0x39af30[_0x6cc5('0x1b')][_0x6cc5('0x1a')]);}})[_0x6cc5('0x1c')](function(_0x53170a){logger[_0x6cc5('0x18')](_0x6cc5('0x19'),_0x4563ab,_0x53170a);_0x5e630f(_0x53170a);});});} \ No newline at end of file +var _0xe168=['code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2387c5,_0xfcc74c){var _0x2c414c=function(_0x3d1881){while(--_0x3d1881){_0x2387c5['push'](_0x2387c5['shift']());}};_0x2c414c(++_0xfcc74c);}(_0xe168,0xce));var _0x8e16=function(_0x35f511,_0x4b60ff){_0x35f511=_0x35f511-0x0;var _0x33d91b=_0xe168[_0x35f511];return _0x33d91b;};'use strict';var _=require(_0x8e16('0x0'));var util=require(_0x8e16('0x1'));var moment=require(_0x8e16('0x2'));var BPromise=require(_0x8e16('0x3'));var rs=require(_0x8e16('0x4'));var fs=require('fs');var Redis=require(_0x8e16('0x5'));var db=require(_0x8e16('0x6'))['db'];var utils=require(_0x8e16('0x7'));var logger=require(_0x8e16('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8e16('0x9'));var client=jayson[_0x8e16('0xa')][_0x8e16('0xb')]({'port':0x232a});config[_0x8e16('0xc')]=_[_0x8e16('0xd')](config[_0x8e16('0xc')],{'host':_0x8e16('0xe'),'port':0x18eb});var socket=require(_0x8e16('0xf'))(new Redis(config[_0x8e16('0xc')]));require(_0x8e16('0x10'))[_0x8e16('0x11')](socket);function respondWithRpcPromise(_0x339bc2,_0x5b1e8e,_0x2c5a1e){return new BPromise(function(_0x7ede4b,_0x20d19b){return client[_0x8e16('0x12')](_0x339bc2,_0x2c5a1e)[_0x8e16('0x13')](function(_0x122024){logger[_0x8e16('0x14')](_0x8e16('0x15'),_0x5b1e8e,_0x8e16('0x16'));logger['debug'](_0x8e16('0x17'),_0x5b1e8e,_0x8e16('0x16'),JSON[_0x8e16('0x18')](_0x122024));if(_0x122024[_0x8e16('0x19')]){if(_0x122024['error'][_0x8e16('0x1a')]===0x1f4){logger[_0x8e16('0x19')](_0x8e16('0x15'),_0x5b1e8e,_0x122024['error'][_0x8e16('0x1b')]);return _0x20d19b(_0x122024[_0x8e16('0x19')][_0x8e16('0x1b')]);}logger[_0x8e16('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x5b1e8e,_0x122024[_0x8e16('0x19')][_0x8e16('0x1b')]);return _0x7ede4b(_0x122024[_0x8e16('0x19')]['message']);}else{logger[_0x8e16('0x14')](_0x8e16('0x15'),_0x5b1e8e,'request\x20sent');_0x7ede4b(_0x122024['result']['message']);}})[_0x8e16('0x1c')](function(_0x4a02f5){logger[_0x8e16('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x5b1e8e,_0x4a02f5);_0x20d19b(_0x4a02f5);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 5d7d3b3..4211eaa 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 _0x78c6=['emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save','remove','update'];(function(_0x1f2e95,_0x5aafca){var _0x3a9a07=function(_0x1e83b8){while(--_0x1e83b8){_0x1f2e95['push'](_0x1f2e95['shift']());}};_0x3a9a07(++_0x5aafca);}(_0x78c6,0x17f));var _0x678c=function(_0x249db0,_0x45947d){_0x249db0=_0x249db0-0x0;var _0xda8563=_0x78c6[_0x249db0];return _0xda8563;};'use strict';var ChatWebsiteEvents=require(_0x678c('0x0'));var events=[_0x678c('0x1'),_0x678c('0x2'),_0x678c('0x3')];function createListener(_0x2202b6,_0x21c60b){return function(_0x3beec1){_0x21c60b[_0x678c('0x4')](_0x2202b6,_0x3beec1);};}function removeListener(_0x2d2de0,_0x262ee7){return function(){ChatWebsiteEvents[_0x678c('0x5')](_0x2d2de0,_0x262ee7);};}exports[_0x678c('0x6')]=function(_0x5fe6d5){for(var _0x8b5d27=0x0,_0x2ad240=events[_0x678c('0x7')];_0x8b5d27<_0x2ad240;_0x8b5d27++){var _0x7a70d1=events[_0x8b5d27];var _0x295434=createListener(_0x678c('0x8')+_0x7a70d1,_0x5fe6d5);ChatWebsiteEvents['on'](_0x7a70d1,_0x295434);}}; \ No newline at end of file +var _0xf698=['length','chatWebsite:','./chatWebsite.events','update','removeListener','register'];(function(_0x3c3eb7,_0x55343d){var _0x108733=function(_0x5bd6f6){while(--_0x5bd6f6){_0x3c3eb7['push'](_0x3c3eb7['shift']());}};_0x108733(++_0x55343d);}(_0xf698,0x14c));var _0x8f69=function(_0x296897,_0x4d23ea){_0x296897=_0x296897-0x0;var _0x2b44ab=_0xf698[_0x296897];return _0x2b44ab;};'use strict';var ChatWebsiteEvents=require(_0x8f69('0x0'));var events=['save','remove',_0x8f69('0x1')];function createListener(_0x354452,_0x12fc41){return function(_0x21c3c7){_0x12fc41['emit'](_0x354452,_0x21c3c7);};}function removeListener(_0x305bf1,_0x53824c){return function(){ChatWebsiteEvents[_0x8f69('0x2')](_0x305bf1,_0x53824c);};}exports[_0x8f69('0x3')]=function(_0x3f3f2b){for(var _0x86e8bf=0x0,_0x3f2c1e=events[_0x8f69('0x4')];_0x86e8bf<_0x3f2c1e;_0x86e8bf++){var _0x99e4c4=events[_0x86e8bf];var _0x93054e=createListener(_0x8f69('0x5')+_0x99e4c4,_0x3f3f2b);ChatWebsiteEvents['on'](_0x99e4c4,_0x93054e);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 58b23ab..38b1dad 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 _0xd37b=['getSnippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getOfflineMessages','/:id/users','getAgents','post','/:id/dispositions','join','root','server/files/images/logos/','now','single','file','addLogo','diskStorage','server/files/images/avatars/','format','addAvatar','%s-%s','originalname','/:id/customer_avatar','addCustomerAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','/:id/offline','offline','addInteraction','/:id/applications','addApplications','addProactiveActions','addAgents','put','delete','destroy','removeAnswers','removeAgents','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd37b,0x1dd));var _0xbd37=function(_0x59f454,_0x1f688c){_0x59f454=_0x59f454-0x0;var _0x273b91=_0xd37b[_0x59f454];return _0x273b91;};'use strict';var multer=require(_0xbd37('0x0'));var util=require(_0xbd37('0x1'));var path=require(_0xbd37('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbd37('0x3')]();var fs_extra=require(_0xbd37('0x4'));var auth=require(_0xbd37('0x5'));var interaction=require(_0xbd37('0x6'));var config=require(_0xbd37('0x7'));var controller=require(_0xbd37('0x8'));router[_0xbd37('0x9')]('/',auth[_0xbd37('0xa')](),controller[_0xbd37('0xb')]);router[_0xbd37('0x9')](_0xbd37('0xc'),auth['isAuthenticated'](),controller[_0xbd37('0xd')]);router['get'](_0xbd37('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xbd37('0x9')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xbd37('0xf')]);router[_0xbd37('0x9')](_0xbd37('0x10'),auth[_0xbd37('0xa')](),controller[_0xbd37('0x11')]);router[_0xbd37('0x9')](_0xbd37('0x12'),controller[_0xbd37('0x13')]);router['get'](_0xbd37('0x14'),controller[_0xbd37('0x15')]);router['get']('/:id/customer_avatar',controller['getCustomerAvatar']);router[_0xbd37('0x9')](_0xbd37('0x16'),controller[_0xbd37('0x17')]);router[_0xbd37('0x9')](_0xbd37('0x18'),auth[_0xbd37('0xa')](),controller[_0xbd37('0x19')]);router['get'](_0xbd37('0x1a'),controller[_0xbd37('0x1b')]);router[_0xbd37('0x9')]('/:id/applications',auth['isAuthenticated'](),controller[_0xbd37('0x1c')]);router[_0xbd37('0x9')](_0xbd37('0x1d'),auth[_0xbd37('0xa')](),controller[_0xbd37('0x1e')]);router[_0xbd37('0x9')](_0xbd37('0x1f'),controller['getFields']);router['get']('/:id/offline_messages',auth[_0xbd37('0xa')](),controller[_0xbd37('0x20')]);router[_0xbd37('0x9')](_0xbd37('0x21'),auth[_0xbd37('0xa')](),controller[_0xbd37('0x22')]);router[_0xbd37('0x23')]('/',auth[_0xbd37('0xa')](),controller['create']);router['post'](_0xbd37('0x24'),auth[_0xbd37('0xa')](),controller['addDisposition']);router[_0xbd37('0x23')](_0xbd37('0x10'),auth[_0xbd37('0xa')](),controller['addAnswer']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3ad983,_0x3d9082,_0x14e1e5){_0x14e1e5(null,path[_0xbd37('0x25')](config[_0xbd37('0x26')],_0xbd37('0x27')));},'filename':function(_0x1f1b3e,_0xac6241,_0x42dd9e){_0x42dd9e(null,util['format']('%s-%s',Date[_0xbd37('0x28')](),_0xac6241['originalname']));}})});router['post'](_0xbd37('0x12'),upload[_0xbd37('0x29')](_0xbd37('0x2a')),controller[_0xbd37('0x2b')]);var upload=multer({'storage':multer[_0xbd37('0x2c')]({'destination':function(_0x5ed083,_0x514bba,_0xb53213){_0xb53213(null,path[_0xbd37('0x25')](config['root'],_0xbd37('0x2d')));},'filename':function(_0x1c2304,_0x3470c6,_0x2fb98b){_0x2fb98b(null,util[_0xbd37('0x2e')]('%s-%s',Date[_0xbd37('0x28')](),_0x3470c6['originalname']));}})});router[_0xbd37('0x23')](_0xbd37('0x14'),upload[_0xbd37('0x29')](_0xbd37('0x2a')),controller[_0xbd37('0x2f')]);var upload=multer({'storage':multer[_0xbd37('0x2c')]({'destination':function(_0x1667ea,_0x55a97c,_0x59af57){_0x59af57(null,path[_0xbd37('0x25')](config[_0xbd37('0x26')],_0xbd37('0x2d')));},'filename':function(_0x13ee31,_0x2d9a4e,_0xce6a7c){_0xce6a7c(null,util[_0xbd37('0x2e')](_0xbd37('0x30'),Date['now'](),_0x2d9a4e[_0xbd37('0x31')]));}})});router[_0xbd37('0x23')](_0xbd37('0x32'),upload[_0xbd37('0x29')](_0xbd37('0x2a')),controller[_0xbd37('0x33')]);var upload=multer({'storage':multer[_0xbd37('0x2c')]({'destination':function(_0x9820fa,_0x5631e5,_0x3a0c94){_0x3a0c94(null,path[_0xbd37('0x25')](config[_0xbd37('0x26')],_0xbd37('0x2d')));},'filename':function(_0x43daac,_0x5e4215,_0x2bd87b){_0x2bd87b(null,util['format']('%s-%s',Date[_0xbd37('0x28')](),_0x5e4215[_0xbd37('0x31')]));}})});router[_0xbd37('0x23')](_0xbd37('0x16'),upload[_0xbd37('0x29')]('file'),controller['addSystemAvatar']);router['post'](_0xbd37('0x34'),controller[_0xbd37('0x35')]);const offlineUploadMulter=multer({'storage':multer[_0xbd37('0x2c')]({'destination':function(_0x5cba08,_0x56b16c,_0x2d6227){const _0x4037e1=path[_0xbd37('0x25')](config[_0xbd37('0x26')],_0xbd37('0x36'),_0xbd37('0x37'),_0xbd37('0x38'));fs_extra[_0xbd37('0x39')](_0x4037e1,function(){_0x2d6227(null,_0x4037e1);});},'filename':function(_0x2d3e0f,_0x36cf0b,_0x550ab9){const _0x248cf9=_0x36cf0b[_0xbd37('0x31')][_0xbd37('0x3a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x5a6d30=path['extname'](_0x248cf9);const _0x52352d=Date[_0xbd37('0x28')]()+'-'+_0x248cf9['replace'](_0x5a6d30,'')+_0x5a6d30;_0x550ab9(null,_0x52352d);}})});router[_0xbd37('0x23')](_0xbd37('0x3b'),offlineUploadMulter['any'](),controller[_0xbd37('0x3c')]);router[_0xbd37('0x23')](_0xbd37('0x18'),auth[_0xbd37('0xa')](),controller[_0xbd37('0x3d')]);router[_0xbd37('0x23')](_0xbd37('0x3e'),auth[_0xbd37('0xa')](),controller[_0xbd37('0x3f')]);router[_0xbd37('0x23')](_0xbd37('0x1d'),auth['isAuthenticated'](),controller[_0xbd37('0x40')]);router[_0xbd37('0x23')]('/:id/users',auth[_0xbd37('0xa')](),controller[_0xbd37('0x41')]);router[_0xbd37('0x42')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xbd37('0x43')](_0xbd37('0xe'),auth[_0xbd37('0xa')](),controller[_0xbd37('0x44')]);router['delete'](_0xbd37('0x24'),auth[_0xbd37('0xa')](),controller['removeDispositions']);router[_0xbd37('0x43')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xbd37('0x45')]);router[_0xbd37('0x43')](_0xbd37('0x21'),auth['isAuthenticated'](),controller[_0xbd37('0x46')]);module[_0xbd37('0x47')]=router; \ No newline at end of file +var _0xbc45=['removeAnswers','removeAgents','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getLogo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','getSystemAvatar','/:id/interactions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','/:id/offline_messages','getOfflineMessages','post','create','addAnswer','diskStorage','root','format','%s-%s','now','/:id/logo','single','addLogo','join','server/files/images/avatars/','originalname','file','addAvatar','addCustomerAvatar','/:id/system_avatar','addSystemAvatar','/:id/notify','notify','server/files','offline-chat','extname','/:id/offline','any','offline','addInteraction','addProactiveActions','/:id/users','addAgents','put','update','destroy','removeDispositions','delete'];(function(_0x2e8f90,_0x830dd9){var _0x584090=function(_0x53bd1c){while(--_0x53bd1c){_0x2e8f90['push'](_0x2e8f90['shift']());}};_0x584090(++_0x830dd9);}(_0xbc45,0x160));var _0x5bc4=function(_0x45bd77,_0x594e75){_0x45bd77=_0x45bd77-0x0;var _0x5c26ed=_0xbc45[_0x45bd77];return _0x5c26ed;};'use strict';var multer=require(_0x5bc4('0x0'));var util=require(_0x5bc4('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5bc4('0x2'));var router=express['Router']();var fs_extra=require(_0x5bc4('0x3'));var auth=require(_0x5bc4('0x4'));var interaction=require(_0x5bc4('0x5'));var config=require(_0x5bc4('0x6'));var controller=require(_0x5bc4('0x7'));router[_0x5bc4('0x8')]('/',auth[_0x5bc4('0x9')](),controller['index']);router[_0x5bc4('0x8')](_0x5bc4('0xa'),auth[_0x5bc4('0x9')](),controller[_0x5bc4('0xb')]);router['get'](_0x5bc4('0xc'),auth[_0x5bc4('0x9')](),controller[_0x5bc4('0xd')]);router['get'](_0x5bc4('0xe'),auth[_0x5bc4('0x9')](),controller[_0x5bc4('0xf')]);router[_0x5bc4('0x8')](_0x5bc4('0x10'),auth[_0x5bc4('0x9')](),controller['getAnswers']);router[_0x5bc4('0x8')]('/:id/logo',controller[_0x5bc4('0x11')]);router[_0x5bc4('0x8')](_0x5bc4('0x12'),controller['getAvatar']);router['get'](_0x5bc4('0x13'),controller[_0x5bc4('0x14')]);router[_0x5bc4('0x8')]('/:id/system_avatar',controller[_0x5bc4('0x15')]);router[_0x5bc4('0x8')](_0x5bc4('0x16'),auth[_0x5bc4('0x9')](),controller['getInteractions']);router[_0x5bc4('0x8')](_0x5bc4('0x17'),controller[_0x5bc4('0x18')]);router['get'](_0x5bc4('0x19'),auth[_0x5bc4('0x9')](),controller[_0x5bc4('0x1a')]);router[_0x5bc4('0x8')](_0x5bc4('0x1b'),auth[_0x5bc4('0x9')](),controller[_0x5bc4('0x1c')]);router[_0x5bc4('0x8')](_0x5bc4('0x1d'),controller['getFields']);router[_0x5bc4('0x8')](_0x5bc4('0x1e'),auth[_0x5bc4('0x9')](),controller[_0x5bc4('0x1f')]);router['get']('/:id/users',auth[_0x5bc4('0x9')](),controller['getAgents']);router[_0x5bc4('0x20')]('/',auth['isAuthenticated'](),controller[_0x5bc4('0x21')]);router['post'](_0x5bc4('0xe'),auth[_0x5bc4('0x9')](),controller['addDisposition']);router[_0x5bc4('0x20')]('/:id/canned_answers',auth[_0x5bc4('0x9')](),controller[_0x5bc4('0x22')]);var upload=multer({'storage':multer[_0x5bc4('0x23')]({'destination':function(_0xc11f64,_0x351926,_0x1d54fe){_0x1d54fe(null,path['join'](config[_0x5bc4('0x24')],'server/files/images/logos/'));},'filename':function(_0x4834b3,_0x58e61b,_0x4ac44f){_0x4ac44f(null,util[_0x5bc4('0x25')](_0x5bc4('0x26'),Date[_0x5bc4('0x27')](),_0x58e61b['originalname']));}})});router[_0x5bc4('0x20')](_0x5bc4('0x28'),upload[_0x5bc4('0x29')]('file'),controller[_0x5bc4('0x2a')]);var upload=multer({'storage':multer[_0x5bc4('0x23')]({'destination':function(_0x19ef05,_0x5674dd,_0x4b7c72){_0x4b7c72(null,path[_0x5bc4('0x2b')](config['root'],_0x5bc4('0x2c')));},'filename':function(_0x1f47e4,_0x406aa2,_0xe0d6c2){_0xe0d6c2(null,util['format'](_0x5bc4('0x26'),Date[_0x5bc4('0x27')](),_0x406aa2[_0x5bc4('0x2d')]));}})});router[_0x5bc4('0x20')](_0x5bc4('0x12'),upload[_0x5bc4('0x29')](_0x5bc4('0x2e')),controller[_0x5bc4('0x2f')]);var upload=multer({'storage':multer[_0x5bc4('0x23')]({'destination':function(_0x294823,_0x391eba,_0x36b5f9){_0x36b5f9(null,path['join'](config[_0x5bc4('0x24')],_0x5bc4('0x2c')));},'filename':function(_0x22b021,_0x4290db,_0xaaf582){_0xaaf582(null,util['format'](_0x5bc4('0x26'),Date[_0x5bc4('0x27')](),_0x4290db['originalname']));}})});router['post'](_0x5bc4('0x13'),upload[_0x5bc4('0x29')](_0x5bc4('0x2e')),controller[_0x5bc4('0x30')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2e3d96,_0x23ee16,_0x27d8bb){_0x27d8bb(null,path[_0x5bc4('0x2b')](config[_0x5bc4('0x24')],_0x5bc4('0x2c')));},'filename':function(_0x3126df,_0x30e5c7,_0x13c02f){_0x13c02f(null,util[_0x5bc4('0x25')](_0x5bc4('0x26'),Date[_0x5bc4('0x27')](),_0x30e5c7[_0x5bc4('0x2d')]));}})});router[_0x5bc4('0x20')](_0x5bc4('0x31'),upload[_0x5bc4('0x29')](_0x5bc4('0x2e')),controller[_0x5bc4('0x32')]);router['post'](_0x5bc4('0x33'),controller[_0x5bc4('0x34')]);const offlineUploadMulter=multer({'storage':multer[_0x5bc4('0x23')]({'destination':function(_0x7e9fe5,_0x384541,_0x31d1a0){const _0x2b0118=path['join'](config[_0x5bc4('0x24')],_0x5bc4('0x35'),'attachments',_0x5bc4('0x36'));fs_extra['ensureDir'](_0x2b0118,function(){_0x31d1a0(null,_0x2b0118);});},'filename':function(_0x4e0ce4,_0xa95f03,_0x5c5e55){const _0x14fe0c=_0xa95f03[_0x5bc4('0x2d')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x34d871=path[_0x5bc4('0x37')](_0x14fe0c);const _0x1a0a2f=Date[_0x5bc4('0x27')]()+'-'+_0x14fe0c['replace'](_0x34d871,'')+_0x34d871;_0x5c5e55(null,_0x1a0a2f);}})});router['post'](_0x5bc4('0x38'),offlineUploadMulter[_0x5bc4('0x39')](),controller[_0x5bc4('0x3a')]);router[_0x5bc4('0x20')](_0x5bc4('0x16'),auth[_0x5bc4('0x9')](),controller[_0x5bc4('0x3b')]);router[_0x5bc4('0x20')](_0x5bc4('0x19'),auth[_0x5bc4('0x9')](),controller['addApplications']);router['post'](_0x5bc4('0x1b'),auth['isAuthenticated'](),controller[_0x5bc4('0x3c')]);router[_0x5bc4('0x20')](_0x5bc4('0x3d'),auth[_0x5bc4('0x9')](),controller[_0x5bc4('0x3e')]);router[_0x5bc4('0x3f')]('/:id',auth[_0x5bc4('0x9')](),controller[_0x5bc4('0x40')]);router['delete'](_0x5bc4('0xc'),auth[_0x5bc4('0x9')](),controller[_0x5bc4('0x41')]);router['delete'](_0x5bc4('0xe'),auth[_0x5bc4('0x9')](),controller[_0x5bc4('0x42')]);router[_0x5bc4('0x43')](_0x5bc4('0x10'),auth[_0x5bc4('0x9')](),controller[_0x5bc4('0x44')]);router[_0x5bc4('0x43')](_0x5bc4('0x3d'),auth[_0x5bc4('0x9')](),controller[_0x5bc4('0x45')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index d252546..d91ac46 100644 --- a/server/api/client-side-logs.js +++ b/server/api/client-side-logs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe5a5=['Client-Side\x20logger\x20not\x20found!','expressEndpoint','use','isAuthenticated','exports','Router','production','get','client-side-logger'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe5a5,0xcb));var _0x5e5a=function(_0x583c72,_0x3aac93){_0x583c72=_0x583c72-0x0;var _0x1fdd0f=_0xe5a5[_0x583c72];return _0x1fdd0f;};var beaverLogger=require('beaver-logger/server');var express=require('express');var auth=require('../components/auth/service');var config=require('../config/environment');var router=express[_0x5e5a('0x0')]();var isProduction=config['env']===_0x5e5a('0x1')||![];function clientSideLogs(_0x350ea4,_0x29f7e7,_0x168e29){var _0x5b0b9c=_0x350ea4['app'][_0x5e5a('0x2')](_0x5e5a('0x3'));if(!_0x5b0b9c){throw new Error(_0x5e5a('0x4'));}return beaverLogger[_0x5e5a('0x5')]({'uri':'/client-logs','logger':_0x5b0b9c,'enableCors':!isProduction})(_0x350ea4,_0x29f7e7,_0x168e29);}router[_0x5e5a('0x6')](auth[_0x5e5a('0x7')](),clientSideLogs);module[_0x5e5a('0x8')]=router; \ No newline at end of file +var _0xab90=['Client-Side\x20logger\x20not\x20found!','expressEndpoint','isAuthenticated','exports','express','../components/auth/service','env','production','app'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xab90,0x175));var _0x0ab9=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xab90[_0x8c43de];return _0xa6591b;};var beaverLogger=require('beaver-logger/server');var express=require(_0x0ab9('0x0'));var auth=require(_0x0ab9('0x1'));var config=require('../config/environment');var router=express['Router']();var isProduction=config[_0x0ab9('0x2')]===_0x0ab9('0x3')||![];function clientSideLogs(_0x1593ed,_0x4f5c57,_0x3adf12){var _0x36b1aa=_0x1593ed[_0x0ab9('0x4')]['get']('client-side-logger');if(!_0x36b1aa){throw new Error(_0x0ab9('0x5'));}return beaverLogger[_0x0ab9('0x6')]({'uri':'/client-logs','logger':_0x36b1aa,'enableCors':!isProduction})(_0x1593ed,_0x4f5c57,_0x3adf12);}router['use'](auth[_0x0ab9('0x7')](),clientSideLogs);module[_0x0ab9('0x8')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 26f904d..09a4ccb 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 _0x58ff=['MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','ENUM','AmazonAWS','MicrosoftAzure','Outlook365','Dynamics365','STRING','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant'];(function(_0x5cf713,_0x364aa9){var _0x4630dd=function(_0x59a253){while(--_0x59a253){_0x5cf713['push'](_0x5cf713['shift']());}};_0x4630dd(++_0x364aa9);}(_0x58ff,0xd7));var _0xf58f=function(_0x54bc01,_0x3c2d5a){_0x54bc01=_0x54bc01-0x0;var _0x14a34f=_0x58ff[_0x54bc01];return _0x14a34f;};'use strict';var Sequelize=require(_0xf58f('0x0'));module[_0xf58f('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xf58f('0x2')](_0xf58f('0x3'),'Google',_0xf58f('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xf58f('0x5'),_0xf58f('0x6'))},'data1':{'type':Sequelize[_0xf58f('0x7')],'comment':_0xf58f('0x8')},'data2':{'type':Sequelize[_0xf58f('0x7')],'comment':_0xf58f('0x9')},'data3':{'type':Sequelize[_0xf58f('0x7')],'comment':_0xf58f('0xa')},'data4':{'type':Sequelize[_0xf58f('0x7')],'comment':_0xf58f('0xb')},'data5':{'type':Sequelize[_0xf58f('0xc')],'comment':_0xf58f('0xd')},'data6':{'type':Sequelize[_0xf58f('0xc')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0xf58f('0xc')],'comment':_0xf58f('0xe')}}; \ No newline at end of file +var _0x062b=['MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','STRING','ENUM','Google','MicrosoftAzure'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x062b,0xe2));var _0xb062=function(_0x51713e,_0x1343f3){_0x51713e=_0x51713e-0x0;var _0x3e3743=_0x062b[_0x51713e];return _0x3e3743;};'use strict';var Sequelize=require(_0xb062('0x0'));module['exports']={'name':{'type':Sequelize[_0xb062('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xb062('0x2')]('AmazonAWS',_0xb062('0x3'),_0xb062('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xb062('0x2')]('Outlook365','Dynamics365')},'data1':{'type':Sequelize[_0xb062('0x1')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0xb062('0x1')],'comment':_0xb062('0x5')},'data3':{'type':Sequelize[_0xb062('0x1')],'comment':_0xb062('0x6')},'data4':{'type':Sequelize[_0xb062('0x1')],'comment':_0xb062('0x7')},'data5':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0xb062('0x8')],'comment':_0xb062('0x9')},'data7':{'type':Sequelize['TEXT'],'comment':_0xb062('0xa')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index e70adba..1eaad2e 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 _0x55fa=['encryptString','oauth2MicrosoftAuthorize','findOne','user','get','state','Invalid\x20state\x20parameter','parse','base64','toString','ascii','isValidIdToken','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','refresh_token','data6','startRefreshInterval','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../mysqldb','redis','defaults','localhost','sendStatus','status','json','offset','undefined','count','limit','set','destroy','then','end','error','name','send','padEnd','CloudProvider','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','map','options','includeAll','include','findAll','rows','MicrosoftAzure','data3','catch','show','params','length','find','service','decryptString','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','update'];(function(_0x55d8c5,_0x10287a){var _0x225ae5=function(_0x2ba03a){while(--_0x2ba03a){_0x55d8c5['push'](_0x55d8c5['shift']());}};_0x225ae5(++_0x10287a);}(_0x55fa,0x12e));var _0xa55f=function(_0x332282,_0x3514e1){_0x332282=_0x332282-0x0;var _0x30600b=_0x55fa[_0x332282];return _0x30600b;};'use strict';var _=require('lodash');var Redis=require(_0xa55f('0x0'));var qs=require(_0xa55f('0x1'));var encryptor=require(_0xa55f('0x2'));var config=require(_0xa55f('0x3'));var logger=require('../../config/logger')('api');var db=require(_0xa55f('0x4'))['db'];var oauth=require('./cloudProvider.oauth');config[_0xa55f('0x5')]=_[_0xa55f('0x6')](config[_0xa55f('0x5')],{'host':_0xa55f('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa55f('0x5')]));var redis=new Redis(config[_0xa55f('0x5')]);function respondWithStatusCode(_0x53f0d6,_0x249a1b){_0x249a1b=_0x249a1b||0xcc;return function(_0x4cd03e){if(_0x4cd03e){return _0x53f0d6[_0xa55f('0x8')](_0x249a1b);}return _0x53f0d6[_0xa55f('0x9')](_0x249a1b)['end']();};}function respondWithResult(_0x31f9bb,_0x2a716a){_0x2a716a=_0x2a716a||0xc8;return function(_0xce9fbc){if(_0xce9fbc){return _0x31f9bb[_0xa55f('0x9')](_0x2a716a)[_0xa55f('0xa')](_0xce9fbc);}};}function respondWithFilteredResult(_0x283d6a,_0x21f84c){return function(_0x17e71a){if(_0x17e71a){var _0x4dc9fc=typeof _0x21f84c[_0xa55f('0xb')]===_0xa55f('0xc')&&typeof _0x21f84c['limit']===_0xa55f('0xc');var _0x236f6e=_0x17e71a[_0xa55f('0xd')];var _0x2ef55a=_0x4dc9fc?0x0:_0x21f84c[_0xa55f('0xb')];var _0x314594=_0x4dc9fc?_0x17e71a[_0xa55f('0xd')]:_0x21f84c['offset']+_0x21f84c[_0xa55f('0xe')];var _0x2e2d4a;if(_0x314594>=_0x236f6e){_0x314594=_0x236f6e;_0x2e2d4a=0xc8;}else{_0x2e2d4a=0xce;}_0x283d6a[_0xa55f('0x9')](_0x2e2d4a);return _0x283d6a[_0xa55f('0xf')]('Content-Range',_0x2ef55a+'-'+_0x314594+'/'+_0x236f6e)[_0xa55f('0xa')](_0x17e71a);}return null;};}function saveUpdates(_0x1b2ec4){return function(_0x57f11b){if(_0x57f11b){return _0x57f11b['update'](_0x1b2ec4)['then'](function(_0x3b227c){return _0x3b227c;});}return null;};}function removeEntity(_0xd5257c){return function(_0x333612){if(_0x333612){return _0x333612[_0xa55f('0x10')]()[_0xa55f('0x11')](function(){_0xd5257c[_0xa55f('0x9')](0xcc)[_0xa55f('0x12')]();});}};}function handleEntityNotFound(_0x247d7f){return function(_0x285be0){if(!_0x285be0){_0x247d7f['sendStatus'](0x194);}return _0x285be0;};}function handleError(_0x4b3286,_0x414dc5){_0x414dc5=_0x414dc5||0x1f4;return function(_0x529d21){logger[_0xa55f('0x13')](_0x529d21['stack']);if(_0x529d21[_0xa55f('0x14')]){delete _0x529d21[_0xa55f('0x14')];}_0x4b3286[_0xa55f('0x9')](_0x414dc5)[_0xa55f('0x15')](_0x529d21);};}function maskClientSecret(_0xc571a8){return _[_0xa55f('0x16')](_0xc571a8['slice'](0x0,0x3),0x14,'*');}exports['index']=function(_0x25197c,_0x5dc2a2){var _0x2ae783={},_0x276814={},_0x70b1c7={'count':0x0,'rows':[]};var _0x29ddc8=_['map'](db[_0xa55f('0x17')][_0xa55f('0x18')],function(_0x4e3ad3){return{'name':_0x4e3ad3[_0xa55f('0x19')],'type':_0x4e3ad3[_0xa55f('0x1a')][_0xa55f('0x1b')]};});_0x276814[_0xa55f('0x1c')]=_['map'](_0x29ddc8,'name');_0x276814[_0xa55f('0x1d')]=_[_0xa55f('0x1e')](_0x25197c['query']);_0x276814['filters']=_[_0xa55f('0x1f')](_0x276814['model'],_0x276814[_0xa55f('0x1d')]);_0x2ae783[_0xa55f('0x20')]=_[_0xa55f('0x1f')](_0x276814['model'],qs[_0xa55f('0x21')](_0x25197c[_0xa55f('0x1d')]['fields']));_0x2ae783[_0xa55f('0x20')]=_0x2ae783[_0xa55f('0x20')]['length']?_0x2ae783[_0xa55f('0x20')]:_0x276814[_0xa55f('0x1c')];if(!_0x25197c[_0xa55f('0x1d')][_0xa55f('0x22')](_0xa55f('0x23'))){_0x2ae783[_0xa55f('0xe')]=qs[_0xa55f('0xe')](_0x25197c[_0xa55f('0x1d')][_0xa55f('0xe')]);_0x2ae783['offset']=qs[_0xa55f('0xb')](_0x25197c[_0xa55f('0x1d')][_0xa55f('0xb')]);}_0x2ae783['order']=qs[_0xa55f('0x24')](_0x25197c[_0xa55f('0x1d')][_0xa55f('0x24')]);_0x2ae783[_0xa55f('0x25')]=qs[_0xa55f('0x26')](_[_0xa55f('0x27')](_0x25197c[_0xa55f('0x1d')],_0x276814['filters']),_0x29ddc8);if(_0x25197c[_0xa55f('0x1d')][_0xa55f('0x28')]){_0x2ae783[_0xa55f('0x25')]=_[_0xa55f('0x29')](_0x2ae783[_0xa55f('0x25')],{'$or':_[_0xa55f('0x2a')](_0x29ddc8,function(_0x590b3b){if(_0x590b3b[_0xa55f('0x1a')]!=='VIRTUAL'){var _0x51c8d5={};_0x51c8d5[_0x590b3b[_0xa55f('0x14')]]={'$like':'%'+_0x25197c[_0xa55f('0x1d')][_0xa55f('0x28')]+'%'};return _0x51c8d5;}})});}_0x2ae783=_[_0xa55f('0x29')]({},_0x2ae783,_0x25197c[_0xa55f('0x2b')]);var _0x41c8d1={'where':_0x2ae783[_0xa55f('0x25')]};return db[_0xa55f('0x17')][_0xa55f('0xd')](_0x41c8d1)[_0xa55f('0x11')](function(_0x5ea543){_0x70b1c7[_0xa55f('0xd')]=_0x5ea543;if(_0x25197c[_0xa55f('0x1d')][_0xa55f('0x2c')]){_0x2ae783[_0xa55f('0x2d')]=[{'all':!![]}];}return db[_0xa55f('0x17')][_0xa55f('0x2e')](_0x2ae783);})['then'](function(_0x1b4fc9){_0x70b1c7[_0xa55f('0x2f')]=_[_0xa55f('0x2a')](_0x1b4fc9,function(_0x2d4c91){if(_0x2d4c91['service']===_0xa55f('0x30')){var _0x3fbbb3=encryptor['decryptString'](_0x2d4c91[_0xa55f('0x31')]);_0x2d4c91['data3']=maskClientSecret(_0x3fbbb3);}return _0x2d4c91;});return _0x70b1c7;})[_0xa55f('0x11')](respondWithFilteredResult(_0x5dc2a2,_0x2ae783))[_0xa55f('0x32')](handleError(_0x5dc2a2,null));};exports[_0xa55f('0x33')]=function(_0x85eb7b,_0x3f9649){var _0x142e09={'raw':!![],'where':{'id':_0x85eb7b[_0xa55f('0x34')]['id']}},_0x3a26f6={};_0x3a26f6['model']=_[_0xa55f('0x1e')](db[_0xa55f('0x17')][_0xa55f('0x18')]);_0x3a26f6[_0xa55f('0x1d')]=_[_0xa55f('0x1e')](_0x85eb7b[_0xa55f('0x1d')]);_0x3a26f6[_0xa55f('0x26')]=_[_0xa55f('0x1f')](_0x3a26f6['model'],_0x3a26f6[_0xa55f('0x1d')]);_0x142e09[_0xa55f('0x20')]=_[_0xa55f('0x1f')](_0x3a26f6[_0xa55f('0x1c')],qs[_0xa55f('0x21')](_0x85eb7b[_0xa55f('0x1d')][_0xa55f('0x21')]));_0x142e09['attributes']=_0x142e09[_0xa55f('0x20')][_0xa55f('0x35')]?_0x142e09[_0xa55f('0x20')]:_0x3a26f6['model'];if(_0x85eb7b[_0xa55f('0x1d')][_0xa55f('0x2c')]){_0x142e09[_0xa55f('0x2d')]=[{'all':!![]}];}_0x142e09=_['merge']({},_0x142e09,_0x85eb7b[_0xa55f('0x2b')]);return db[_0xa55f('0x17')][_0xa55f('0x36')](_0x142e09)[_0xa55f('0x11')](handleEntityNotFound(_0x3f9649,null))[_0xa55f('0x11')](function(_0x5e2eba){if(_0x5e2eba[_0xa55f('0x37')]===_0xa55f('0x30')){var _0x5e1b4b=encryptor[_0xa55f('0x38')](_0x5e2eba[_0xa55f('0x31')]);_0x5e2eba['data3']=maskClientSecret(_0x5e1b4b);}return _0x5e2eba;})[_0xa55f('0x11')](respondWithResult(_0x3f9649,null))[_0xa55f('0x32')](handleError(_0x3f9649,null));};exports[_0xa55f('0x39')]=function(_0x13ed0f,_0xe0a73f){if(!_0x13ed0f[_0xa55f('0x3a')]['name'])throw new Error(_0xa55f('0x3b'));if(!_0x13ed0f[_0xa55f('0x3a')][_0xa55f('0x37')])throw new Error(_0xa55f('0x3c'));var _0x959a7b=db[_0xa55f('0x17')]['rawAttributes'][_0xa55f('0x37')][_0xa55f('0x3d')];if(!_0x959a7b[_0xa55f('0x3e')](_0x13ed0f[_0xa55f('0x3a')][_0xa55f('0x37')]))throw new Error(_0xa55f('0x3f')+_0x959a7b[_0xa55f('0x40')](',\x20'));if(_0x13ed0f[_0xa55f('0x3a')][_0xa55f('0x37')]===_0xa55f('0x30')&&_0x13ed0f['body']['data3']){_0x13ed0f[_0xa55f('0x3a')][_0xa55f('0x31')]=encryptor['encryptString'](_0x13ed0f[_0xa55f('0x3a')]['data3']);}return db[_0xa55f('0x17')][_0xa55f('0x39')](_0x13ed0f[_0xa55f('0x3a')],{})[_0xa55f('0x11')](respondWithResult(_0xe0a73f,0xc9))[_0xa55f('0x32')](handleError(_0xe0a73f,null));};exports[_0xa55f('0x41')]=function(_0x474e00,_0x37dd9c){if(_0x474e00[_0xa55f('0x3a')]['id']){delete _0x474e00[_0xa55f('0x3a')]['id'];}return db[_0xa55f('0x17')][_0xa55f('0x36')]({'where':{'id':_0x474e00['params']['id']}})[_0xa55f('0x11')](handleEntityNotFound(_0x37dd9c,null))[_0xa55f('0x11')](function(_0x1d9421){if(_0x1d9421[_0xa55f('0x37')]==='MicrosoftAzure'&&_0x474e00[_0xa55f('0x3a')][_0xa55f('0x31')]){_0x474e00['body'][_0xa55f('0x31')]=encryptor[_0xa55f('0x42')](_0x474e00['body'][_0xa55f('0x31')]);}return _0x1d9421;})[_0xa55f('0x11')](saveUpdates(_0x474e00['body'],null))[_0xa55f('0x11')](respondWithResult(_0x37dd9c,null))[_0xa55f('0x32')](handleError(_0x37dd9c,null));};exports[_0xa55f('0x10')]=function(_0x4096ee,_0x26ec87){return db[_0xa55f('0x17')][_0xa55f('0x36')]({'where':{'id':_0x4096ee['params']['id']}})['then'](handleEntityNotFound(_0x26ec87,null))[_0xa55f('0x11')](removeEntity(_0x26ec87,null))[_0xa55f('0x32')](handleError(_0x26ec87,null));};exports[_0xa55f('0x43')]=function(_0x460b82,_0x219276){return db[_0xa55f('0x17')][_0xa55f('0x44')]({'where':{'id':_0x460b82[_0xa55f('0x34')]['id']},'raw':!![]})[_0xa55f('0x11')](function(_0x31fa0a){if(!_0x31fa0a)return _0x219276[_0xa55f('0x8')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x31fa0a,_0x460b82[_0xa55f('0x45')]['id'])};})['then'](respondWithResult(_0x219276,null))[_0xa55f('0x32')](handleError(_0x219276,null));};exports['oauth2MicrosoftCallback']=function(_0x2370e3,_0x510e1e){var _0x1a7d12=_0x2370e3[_0xa55f('0x3a')];var _0x4f23ff;var _0x18c4a2;if(_0x1a7d12[_0xa55f('0x13')])throw _0x1a7d12;redis[_0xa55f('0x46')](_0x1a7d12[_0xa55f('0x47')])[_0xa55f('0x11')](function(_0x2e5003){if(!_0x2e5003)throw new Error(_0xa55f('0x48'));_0x4f23ff=JSON[_0xa55f('0x49')](_0x2e5003);var _0x113f66=Buffer['from'](_0x1a7d12[_0xa55f('0x47')],_0xa55f('0x4a'))[_0xa55f('0x4b')](_0xa55f('0x4c'));_0x18c4a2=JSON[_0xa55f('0x49')](_0x113f66);if(!oauth[_0xa55f('0x4d')](_0x1a7d12['id_token'],_0x4f23ff[_0xa55f('0x4e')]))throw new Error(_0xa55f('0x4f'));redis[_0xa55f('0x50')](_0x1a7d12[_0xa55f('0x47')]);return oauth[_0xa55f('0x51')](_0x1a7d12[_0xa55f('0x52')],_0x4f23ff);})[_0xa55f('0x11')](function(_0x16dc4c){_0x4f23ff[_0xa55f('0x53')]=_0x16dc4c['access_token'];_0x4f23ff['data6']=_0x16dc4c[_0xa55f('0x54')];return db['CloudProvider'][_0xa55f('0x41')]({'data5':_0x4f23ff[_0xa55f('0x53')],'data6':_0x4f23ff[_0xa55f('0x55')]},{'where':{'id':_0x4f23ff['id']}});})[_0xa55f('0x11')](function(){oauth[_0xa55f('0x56')](_0x4f23ff);socket['emit']('microsoftAuthorization:success',{'id':_0x18c4a2['id']});return;})[_0xa55f('0x11')](respondWithStatusCode(_0x510e1e,null))['catch'](function(_0x597d58){if(_0x18c4a2){socket['emit'](_0xa55f('0x57'),{'id':_0x18c4a2['id']});}if(!_0x4f23ff){logger[_0xa55f('0x13')](_0xa55f('0x58'),_0x597d58);return _0x510e1e[_0xa55f('0x9')](0x1f4)[_0xa55f('0x15')](_0x597d58[_0xa55f('0x59')]);}logger[_0xa55f('0x13')](_0xa55f('0x5a'),_0x4f23ff['id'],JSON[_0xa55f('0x5b')](_0x597d58));});}; \ No newline at end of file +var _0xaa51=['findAll','rows','service','MicrosoftAzure','data3','catch','show','params','rawAttributes','merge','find','decryptString','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','update','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','from','base64','toString','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','access_token','data6','refresh_token','emit','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','send','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','then','destroy','error','stack','name','padEnd','index','map','CloudProvider','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','type','VIRTUAL','filter','options','includeAll','include'];(function(_0x892f29,_0x3d4087){var _0x233136=function(_0x4f9e85){while(--_0x4f9e85){_0x892f29['push'](_0x892f29['shift']());}};_0x233136(++_0x3d4087);}(_0xaa51,0x92));var _0x1aa5=function(_0x56798d,_0x4b5937){_0x56798d=_0x56798d-0x0;var _0x2667f7=_0xaa51[_0x56798d];return _0x2667f7;};'use strict';var _=require(_0x1aa5('0x0'));var Redis=require(_0x1aa5('0x1'));var qs=require('../../components/parsers/qs');var encryptor=require(_0x1aa5('0x2'));var config=require(_0x1aa5('0x3'));var logger=require(_0x1aa5('0x4'))(_0x1aa5('0x5'));var db=require(_0x1aa5('0x6'))['db'];var oauth=require('./cloudProvider.oauth');config[_0x1aa5('0x7')]=_[_0x1aa5('0x8')](config[_0x1aa5('0x7')],{'host':_0x1aa5('0x9'),'port':0x18eb});var socket=require(_0x1aa5('0xa'))(new Redis(config[_0x1aa5('0x7')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x13eeb1,_0x2680b4){_0x2680b4=_0x2680b4||0xcc;return function(_0x3f849b){if(_0x3f849b){return _0x13eeb1[_0x1aa5('0xb')](_0x2680b4);}return _0x13eeb1[_0x1aa5('0xc')](_0x2680b4)[_0x1aa5('0xd')]();};}function respondWithResult(_0x49692e,_0xdb91e5){_0xdb91e5=_0xdb91e5||0xc8;return function(_0x3096aa){if(_0x3096aa){return _0x49692e[_0x1aa5('0xc')](_0xdb91e5)[_0x1aa5('0xe')](_0x3096aa);}};}function respondWithFilteredResult(_0x2bd5df,_0x1b3c99){return function(_0x4e97b){if(_0x4e97b){var _0x5a822b=typeof _0x1b3c99[_0x1aa5('0xf')]==='undefined'&&typeof _0x1b3c99['limit']===_0x1aa5('0x10');var _0x261b12=_0x4e97b[_0x1aa5('0x11')];var _0x472995=_0x5a822b?0x0:_0x1b3c99[_0x1aa5('0xf')];var _0x51f77c=_0x5a822b?_0x4e97b[_0x1aa5('0x11')]:_0x1b3c99[_0x1aa5('0xf')]+_0x1b3c99[_0x1aa5('0x12')];var _0x83833a;if(_0x51f77c>=_0x261b12){_0x51f77c=_0x261b12;_0x83833a=0xc8;}else{_0x83833a=0xce;}_0x2bd5df[_0x1aa5('0xc')](_0x83833a);return _0x2bd5df[_0x1aa5('0x13')](_0x1aa5('0x14'),_0x472995+'-'+_0x51f77c+'/'+_0x261b12)[_0x1aa5('0xe')](_0x4e97b);}return null;};}function saveUpdates(_0x5a9e26){return function(_0x232ef4){if(_0x232ef4){return _0x232ef4['update'](_0x5a9e26)[_0x1aa5('0x15')](function(_0x2530fd){return _0x2530fd;});}return null;};}function removeEntity(_0x5bdd48){return function(_0xb7757){if(_0xb7757){return _0xb7757[_0x1aa5('0x16')]()['then'](function(){_0x5bdd48['status'](0xcc)[_0x1aa5('0xd')]();});}};}function handleEntityNotFound(_0x309e5a){return function(_0x3b4177){if(!_0x3b4177){_0x309e5a['sendStatus'](0x194);}return _0x3b4177;};}function handleError(_0x478e4d,_0x1b8149){_0x1b8149=_0x1b8149||0x1f4;return function(_0x332066){logger[_0x1aa5('0x17')](_0x332066[_0x1aa5('0x18')]);if(_0x332066[_0x1aa5('0x19')]){delete _0x332066[_0x1aa5('0x19')];}_0x478e4d['status'](_0x1b8149)['send'](_0x332066);};}function maskClientSecret(_0x4b5e6d){return _[_0x1aa5('0x1a')](_0x4b5e6d['slice'](0x0,0x3),0x14,'*');}exports[_0x1aa5('0x1b')]=function(_0x47f587,_0x27672b){var _0x38f618={},_0x229123={},_0x6df553={'count':0x0,'rows':[]};var _0x1292d2=_[_0x1aa5('0x1c')](db[_0x1aa5('0x1d')]['rawAttributes'],function(_0x4f0635){return{'name':_0x4f0635['fieldName'],'type':_0x4f0635['type'][_0x1aa5('0x1e')]};});_0x229123[_0x1aa5('0x1f')]=_[_0x1aa5('0x1c')](_0x1292d2,'name');_0x229123[_0x1aa5('0x20')]=_[_0x1aa5('0x21')](_0x47f587[_0x1aa5('0x20')]);_0x229123['filters']=_[_0x1aa5('0x22')](_0x229123[_0x1aa5('0x1f')],_0x229123['query']);_0x38f618[_0x1aa5('0x23')]=_[_0x1aa5('0x22')](_0x229123[_0x1aa5('0x1f')],qs['fields'](_0x47f587[_0x1aa5('0x20')][_0x1aa5('0x24')]));_0x38f618[_0x1aa5('0x23')]=_0x38f618[_0x1aa5('0x23')][_0x1aa5('0x25')]?_0x38f618[_0x1aa5('0x23')]:_0x229123[_0x1aa5('0x1f')];if(!_0x47f587[_0x1aa5('0x20')][_0x1aa5('0x26')]('nolimit')){_0x38f618[_0x1aa5('0x12')]=qs[_0x1aa5('0x12')](_0x47f587[_0x1aa5('0x20')][_0x1aa5('0x12')]);_0x38f618[_0x1aa5('0xf')]=qs[_0x1aa5('0xf')](_0x47f587[_0x1aa5('0x20')][_0x1aa5('0xf')]);}_0x38f618['order']=qs[_0x1aa5('0x27')](_0x47f587[_0x1aa5('0x20')][_0x1aa5('0x27')]);_0x38f618[_0x1aa5('0x28')]=qs[_0x1aa5('0x29')](_['pick'](_0x47f587[_0x1aa5('0x20')],_0x229123[_0x1aa5('0x29')]),_0x1292d2);if(_0x47f587[_0x1aa5('0x20')]['filter']){_0x38f618[_0x1aa5('0x28')]=_['merge'](_0x38f618[_0x1aa5('0x28')],{'$or':_['map'](_0x1292d2,function(_0x53fc6b){if(_0x53fc6b[_0x1aa5('0x2a')]!==_0x1aa5('0x2b')){var _0x54e884={};_0x54e884[_0x53fc6b[_0x1aa5('0x19')]]={'$like':'%'+_0x47f587[_0x1aa5('0x20')][_0x1aa5('0x2c')]+'%'};return _0x54e884;}})});}_0x38f618=_['merge']({},_0x38f618,_0x47f587[_0x1aa5('0x2d')]);var _0x4c12b2={'where':_0x38f618[_0x1aa5('0x28')]};return db[_0x1aa5('0x1d')]['count'](_0x4c12b2)['then'](function(_0x12aafa){_0x6df553[_0x1aa5('0x11')]=_0x12aafa;if(_0x47f587[_0x1aa5('0x20')][_0x1aa5('0x2e')]){_0x38f618[_0x1aa5('0x2f')]=[{'all':!![]}];}return db['CloudProvider'][_0x1aa5('0x30')](_0x38f618);})[_0x1aa5('0x15')](function(_0x3339e1){_0x6df553[_0x1aa5('0x31')]=_[_0x1aa5('0x1c')](_0x3339e1,function(_0x2db581){if(_0x2db581[_0x1aa5('0x32')]===_0x1aa5('0x33')){var _0x2e543b=encryptor['decryptString'](_0x2db581['data3']);_0x2db581[_0x1aa5('0x34')]=maskClientSecret(_0x2e543b);}return _0x2db581;});return _0x6df553;})[_0x1aa5('0x15')](respondWithFilteredResult(_0x27672b,_0x38f618))[_0x1aa5('0x35')](handleError(_0x27672b,null));};exports[_0x1aa5('0x36')]=function(_0x50f4b2,_0x58cb0f){var _0x15f487={'raw':!![],'where':{'id':_0x50f4b2[_0x1aa5('0x37')]['id']}},_0x552389={};_0x552389[_0x1aa5('0x1f')]=_[_0x1aa5('0x21')](db['CloudProvider'][_0x1aa5('0x38')]);_0x552389[_0x1aa5('0x20')]=_['keys'](_0x50f4b2[_0x1aa5('0x20')]);_0x552389[_0x1aa5('0x29')]=_[_0x1aa5('0x22')](_0x552389['model'],_0x552389[_0x1aa5('0x20')]);_0x15f487['attributes']=_[_0x1aa5('0x22')](_0x552389[_0x1aa5('0x1f')],qs['fields'](_0x50f4b2[_0x1aa5('0x20')]['fields']));_0x15f487['attributes']=_0x15f487[_0x1aa5('0x23')]['length']?_0x15f487['attributes']:_0x552389['model'];if(_0x50f4b2['query']['includeAll']){_0x15f487['include']=[{'all':!![]}];}_0x15f487=_[_0x1aa5('0x39')]({},_0x15f487,_0x50f4b2['options']);return db[_0x1aa5('0x1d')][_0x1aa5('0x3a')](_0x15f487)[_0x1aa5('0x15')](handleEntityNotFound(_0x58cb0f,null))[_0x1aa5('0x15')](function(_0x35af36){if(_0x35af36[_0x1aa5('0x32')]===_0x1aa5('0x33')){var _0x7af12c=encryptor[_0x1aa5('0x3b')](_0x35af36[_0x1aa5('0x34')]);_0x35af36[_0x1aa5('0x34')]=maskClientSecret(_0x7af12c);}return _0x35af36;})[_0x1aa5('0x15')](respondWithResult(_0x58cb0f,null))[_0x1aa5('0x35')](handleError(_0x58cb0f,null));};exports[_0x1aa5('0x3c')]=function(_0xe18710,_0xa0176c){if(!_0xe18710[_0x1aa5('0x3d')][_0x1aa5('0x19')])throw new Error(_0x1aa5('0x3e'));if(!_0xe18710[_0x1aa5('0x3d')][_0x1aa5('0x32')])throw new Error(_0x1aa5('0x3f'));var _0x3877a7=db['CloudProvider'][_0x1aa5('0x38')][_0x1aa5('0x32')][_0x1aa5('0x40')];if(!_0x3877a7[_0x1aa5('0x41')](_0xe18710[_0x1aa5('0x3d')][_0x1aa5('0x32')]))throw new Error(_0x1aa5('0x42')+_0x3877a7['join'](',\x20'));if(_0xe18710[_0x1aa5('0x3d')]['service']===_0x1aa5('0x33')&&_0xe18710['body'][_0x1aa5('0x34')]){_0xe18710[_0x1aa5('0x3d')][_0x1aa5('0x34')]=encryptor[_0x1aa5('0x43')](_0xe18710['body'][_0x1aa5('0x34')]);}return db[_0x1aa5('0x1d')][_0x1aa5('0x3c')](_0xe18710[_0x1aa5('0x3d')],{})[_0x1aa5('0x15')](respondWithResult(_0xa0176c,0xc9))[_0x1aa5('0x35')](handleError(_0xa0176c,null));};exports[_0x1aa5('0x44')]=function(_0x3fc218,_0x33fada){if(_0x3fc218[_0x1aa5('0x3d')]['id']){delete _0x3fc218[_0x1aa5('0x3d')]['id'];}return db[_0x1aa5('0x1d')][_0x1aa5('0x3a')]({'where':{'id':_0x3fc218[_0x1aa5('0x37')]['id']}})[_0x1aa5('0x15')](handleEntityNotFound(_0x33fada,null))[_0x1aa5('0x15')](function(_0xb8caa9){if(_0xb8caa9[_0x1aa5('0x32')]===_0x1aa5('0x33')&&_0x3fc218[_0x1aa5('0x3d')][_0x1aa5('0x34')]){_0x3fc218['body']['data3']=encryptor['encryptString'](_0x3fc218[_0x1aa5('0x3d')][_0x1aa5('0x34')]);}return _0xb8caa9;})['then'](saveUpdates(_0x3fc218[_0x1aa5('0x3d')],null))[_0x1aa5('0x15')](respondWithResult(_0x33fada,null))[_0x1aa5('0x35')](handleError(_0x33fada,null));};exports['destroy']=function(_0x3cf84b,_0x2d0cce){return db[_0x1aa5('0x1d')][_0x1aa5('0x3a')]({'where':{'id':_0x3cf84b[_0x1aa5('0x37')]['id']}})[_0x1aa5('0x15')](handleEntityNotFound(_0x2d0cce,null))[_0x1aa5('0x15')](removeEntity(_0x2d0cce,null))[_0x1aa5('0x35')](handleError(_0x2d0cce,null));};exports[_0x1aa5('0x45')]=function(_0x274ed0,_0x3baf54){return db['CloudProvider'][_0x1aa5('0x46')]({'where':{'id':_0x274ed0['params']['id']},'raw':!![]})['then'](function(_0xec58e7){if(!_0xec58e7)return _0x3baf54[_0x1aa5('0xb')](0x194);return{'url':oauth[_0x1aa5('0x47')](_0xec58e7,_0x274ed0[_0x1aa5('0x48')]['id'])};})[_0x1aa5('0x15')](respondWithResult(_0x3baf54,null))['catch'](handleError(_0x3baf54,null));};exports[_0x1aa5('0x49')]=function(_0x35649a,_0x201ec9){var _0x44088d=_0x35649a['body'];var _0x2ad6a5;var _0x46497e;if(_0x44088d[_0x1aa5('0x17')])throw _0x44088d;redis[_0x1aa5('0x4a')](_0x44088d[_0x1aa5('0x4b')])[_0x1aa5('0x15')](function(_0x1b2a38){if(!_0x1b2a38)throw new Error(_0x1aa5('0x4c'));_0x2ad6a5=JSON[_0x1aa5('0x4d')](_0x1b2a38);var _0x3999d9=Buffer[_0x1aa5('0x4e')](_0x44088d[_0x1aa5('0x4b')],_0x1aa5('0x4f'))[_0x1aa5('0x50')]('ascii');_0x46497e=JSON[_0x1aa5('0x4d')](_0x3999d9);if(!oauth[_0x1aa5('0x51')](_0x44088d[_0x1aa5('0x52')],_0x2ad6a5[_0x1aa5('0x53')]))throw new Error(_0x1aa5('0x54'));redis[_0x1aa5('0x55')](_0x44088d[_0x1aa5('0x4b')]);return oauth[_0x1aa5('0x56')](_0x44088d[_0x1aa5('0x57')],_0x2ad6a5);})[_0x1aa5('0x15')](function(_0x409801){_0x2ad6a5['data5']=_0x409801[_0x1aa5('0x58')];_0x2ad6a5[_0x1aa5('0x59')]=_0x409801[_0x1aa5('0x5a')];return db['CloudProvider'][_0x1aa5('0x44')]({'data5':_0x2ad6a5['data5'],'data6':_0x2ad6a5['data6']},{'where':{'id':_0x2ad6a5['id']}});})['then'](function(){oauth['startRefreshInterval'](_0x2ad6a5);socket['emit']('microsoftAuthorization:success',{'id':_0x46497e['id']});return;})[_0x1aa5('0x15')](respondWithStatusCode(_0x201ec9,null))[_0x1aa5('0x35')](function(_0x1deb53){if(_0x46497e){socket[_0x1aa5('0x5b')](_0x1aa5('0x5c'),{'id':_0x46497e['id']});}if(!_0x2ad6a5){logger[_0x1aa5('0x17')](_0x1aa5('0x5d'),_0x1deb53);return _0x201ec9[_0x1aa5('0xc')](0x1f4)[_0x1aa5('0x5e')](_0x1deb53['message']);}logger[_0x1aa5('0x17')](_0x1aa5('0x5f'),_0x2ad6a5['id'],JSON[_0x1aa5('0x60')](_0x1deb53));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index fce2e7b..5e06edb 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 _0xbc2f=['rimraf','./cloudProvider.attributes','exports','define','CloudProvider','../../config/logger','api','moment','request-promise'];(function(_0x32b0fc,_0x482f22){var _0x2274e1=function(_0x2a4599){while(--_0x2a4599){_0x32b0fc['push'](_0x32b0fc['shift']());}};_0x2274e1(++_0x482f22);}(_0xbc2f,0x16d));var _0xfbc2=function(_0x2af219,_0x280514){_0x2af219=_0x2af219-0x0;var _0xad6991=_0xbc2f[_0x2af219];return _0xad6991;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfbc2('0x0'))(_0xfbc2('0x1'));var moment=require(_0xfbc2('0x2'));var BPromise=require('bluebird');var rp=require(_0xfbc2('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfbc2('0x4'));var config=require('../../config/environment');var attributes=require(_0xfbc2('0x5'));module[_0xfbc2('0x6')]=function(_0x5e24fb,_0x7a4203){return _0x5e24fb[_0xfbc2('0x7')](_0xfbc2('0x8'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f53=['bluebird','path','rimraf','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash','util','../../config/logger'];(function(_0x53cd94,_0xdb71b0){var _0x1d3b02=function(_0x789d69){while(--_0x789d69){_0x53cd94['push'](_0x53cd94['shift']());}};_0x1d3b02(++_0xdb71b0);}(_0x6f53,0x19f));var _0x36f5=function(_0x31c81b,_0x20f535){_0x31c81b=_0x31c81b-0x0;var _0x371034=_0x6f53[_0x31c81b];return _0x371034;};'use strict';var _=require(_0x36f5('0x0'));var util=require(_0x36f5('0x1'));var logger=require(_0x36f5('0x2'))('api');var moment=require('moment');var BPromise=require(_0x36f5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x36f5('0x4'));var rimraf=require(_0x36f5('0x5'));var config=require('../../config/environment');var attributes=require(_0x36f5('0x6'));module[_0x36f5('0x7')]=function(_0x536c03,_0x3d9bf3){return _0x536c03[_0x36f5('0x8')](_0x36f5('0x9'),attributes,{'tableName':_0x36f5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 5e0aae7..5741dae 100644 --- a/server/api/cloudProvider/cloudProvider.oauth.js +++ b/server/api/cloudProvider/cloudProvider.oauth.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4e56=['https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','type','Dynamics365','push','data7','/.default','join','Outlook365','replace','{TENANT_ID}','data2','code','id_token','from','base64','toString','hex','client_id','data1','response_type','redirect_uri','data4','form_post','scope','prompt','value','oauth2Claims','oauth2/','set','stringify','payload','iss','issuer','aud','nonce','unix','exp','resolve','data3','findOne','refresh_token','data6','decryptString','POST','data5','access_token','CloudProvider','update','then','error','authorization_code','intervals','bind','findAll','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','ioredis','request-promise','util','../../components/encryptor','../../config/environment','api','../../config/schedule/cloud-provider','../../mysqldb','redis','localhost','openid','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All'];(function(_0x15cd00,_0x2565de){var _0x67350f=function(_0x6829be){while(--_0x6829be){_0x15cd00['push'](_0x15cd00['shift']());}};_0x67350f(++_0x2565de);}(_0x4e56,0x89));var _0x64e5=function(_0x3f2546,_0x2ff601){_0x3f2546=_0x3f2546-0x0;var _0x47dc25=_0x4e56[_0x3f2546];return _0x47dc25;};'use strict';var _=require(_0x64e5('0x0'));var crypto=require(_0x64e5('0x1'));var jwt=require(_0x64e5('0x2'));var moment=require('moment');var Redis=require(_0x64e5('0x3'));var rp=require(_0x64e5('0x4'));var util=require(_0x64e5('0x5'));var encryptor=require(_0x64e5('0x6'));var config=require(_0x64e5('0x7'));var logger=require('../../config/logger')(_0x64e5('0x8'));var schedule=require(_0x64e5('0x9'));var db=require(_0x64e5('0xa'))['db'];config[_0x64e5('0xb')]=_['defaults'](config[_0x64e5('0xb')],{'host':_0x64e5('0xc'),'port':0x18eb});var redis=new Redis(config[_0x64e5('0xb')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0x64e5('0xd'),'profile',_0x64e5('0xe'),_0x64e5('0xf'),_0x64e5('0x10'),_0x64e5('0x11'),_0x64e5('0x12')],'Dynamics365':[_0x64e5('0xd'),_0x64e5('0xf')]};var MICROSOFT_AUTH_ENDPOINT=_0x64e5('0x13');var MICROSOFT_TOKEN_ENDPOINT=_0x64e5('0x14');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x247bc0){var _0x442c4b=_['map'](AZURE_AUTH_SCOPES[_0x247bc0[_0x64e5('0x15')]]);if(_0x247bc0[_0x64e5('0x15')]===_0x64e5('0x16'))_0x442c4b[_0x64e5('0x17')](_0x247bc0[_0x64e5('0x18')]+_0x64e5('0x19'));return _0x442c4b[_0x64e5('0x1a')]('\x20');}function getAccessTokenScope(_0x10c75b){if(_0x10c75b[_0x64e5('0x15')]===_0x64e5('0x1b'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x10c75b[_0x64e5('0x15')]===_0x64e5('0x16'))return _0x10c75b[_0x64e5('0x18')]+_0x64e5('0x19');}function generateMicrosoftAuthorizationUrl(_0x353e4b,_0x1eb0b6){var _0x4efda3=MICROSOFT_AUTH_URL[_0x64e5('0x1c')](_0x64e5('0x1d'),_0x353e4b[_0x64e5('0x1e')]);var _0xe750dc=[_0x64e5('0x1f'),_0x64e5('0x20')];var _0x2f9e2f=Buffer[_0x64e5('0x21')](JSON['stringify']({'id':_0x1eb0b6}))['toString'](_0x64e5('0x22'));var _0x53099f=crypto['randomBytes'](0x10)[_0x64e5('0x23')](_0x64e5('0x24'));var _0x39ebd8=getAuthorizationScopes(_0x353e4b);var _0x58c973=[{'key':_0x64e5('0x25'),'value':_0x353e4b[_0x64e5('0x26')]},{'key':_0x64e5('0x27'),'value':encodeURIComponent(_0xe750dc[_0x64e5('0x1a')]('\x20'))},{'key':_0x64e5('0x28'),'value':_0x353e4b[_0x64e5('0x29')]},{'key':'response_mode','value':_0x64e5('0x2a')},{'key':_0x64e5('0x2b'),'value':encodeURIComponent(_0x39ebd8)},{'key':'state','value':_0x2f9e2f},{'key':'nonce','value':_0x53099f},{'key':_0x64e5('0x2c'),'value':'login'}];var _0xee9a9e=_0x4efda3+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x58c973,function(_0x195dd1){return _0x195dd1['key']+'='+_0x195dd1[_0x64e5('0x2d')];})['join']('&');_0x353e4b[_0x64e5('0x2e')]={'issuer':_0x4efda3[_0x64e5('0x1c')](_0x64e5('0x2f'),''),'audience':_0x353e4b[_0x64e5('0x26')],'state':_0x2f9e2f,'nonce':_0x53099f};redis[_0x64e5('0x30')](_0x2f9e2f,JSON[_0x64e5('0x31')](_0x353e4b));return _0xee9a9e;}function isValidIdToken(_0x3548b1,_0x31e9dd){try{var _0x3b7008=jwt['decode'](_0x3548b1,{'complete':!![]});var _0x3b62af=_0x3b7008[_0x64e5('0x32')];if(_0x3b62af[_0x64e5('0x33')]!==_0x31e9dd[_0x64e5('0x34')])return![];if(_0x3b62af[_0x64e5('0x35')]!==_0x31e9dd['audience'])return![];if(_0x3b62af[_0x64e5('0x36')]!==_0x31e9dd[_0x64e5('0x36')])return![];if(moment()['isAfter'](moment[_0x64e5('0x37')](_0x3b62af[_0x64e5('0x38')])))return![];return!![];}catch(_0x311dd8){throw _0x311dd8;}}function refreshOauth2MicrosoftAccessToken(_0x131b67){return Promise[_0x64e5('0x39')]()['then'](function(){if(_0x131b67[_0x64e5('0x3a')])return _0x131b67;return db['CloudProvider'][_0x64e5('0x3b')]({'where':{'id':_0x131b67['id']},'raw':!![]});})['then'](function(_0x49e612){var _0x5b95a2={'grant_type':_0x64e5('0x3c'),'refresh_token':_0x49e612[_0x64e5('0x3d')],'scope':getAccessTokenScope(_0x49e612),'redirect_uri':_0x49e612['data4'],'client_id':_0x49e612[_0x64e5('0x26')],'client_secret':encryptor[_0x64e5('0x3e')](_0x49e612['data3'])};var _0x58a708={'method':_0x64e5('0x3f'),'uri':MICROSOFT_AUTH_URL['replace'](_0x64e5('0x1d'),_0x49e612['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x5b95a2,'json':!![]};return rp(_0x58a708);})['then'](function(_0x92ef9a){_0x131b67[_0x64e5('0x40')]=_0x92ef9a[_0x64e5('0x41')];_0x131b67['data6']=_0x92ef9a[_0x64e5('0x3c')];return db[_0x64e5('0x42')][_0x64e5('0x43')]({'data5':_0x131b67[_0x64e5('0x40')],'data6':_0x131b67[_0x64e5('0x3d')]},{'where':{'id':_0x131b67['id']}});})[_0x64e5('0x44')](function(){return _0x131b67;})['catch'](function(_0x54602a){logger[_0x64e5('0x45')]('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x131b67['id'],_0x54602a);});}function getOauth2MicrosoftAccessToken(_0x3d390e,_0x3b1b90){var _0x4bf945={'grant_type':_0x64e5('0x46'),'code':_0x3d390e,'scope':getAccessTokenScope(_0x3b1b90),'redirect_uri':_0x3b1b90[_0x64e5('0x29')],'client_id':_0x3b1b90[_0x64e5('0x26')],'client_secret':encryptor['decryptString'](_0x3b1b90[_0x64e5('0x3a')])};var _0x4ce37a={'method':_0x64e5('0x3f'),'uri':MICROSOFT_AUTH_URL[_0x64e5('0x1c')](_0x64e5('0x1d'),_0x3b1b90[_0x64e5('0x1e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x4bf945,'json':!![]};return rp(_0x4ce37a);}function startRefreshInterval(_0x3183b4){var _0xf92f16=schedule[_0x64e5('0x47')];if(_0xf92f16[_0x3183b4['id']])clearInterval(_0xf92f16[_0x3183b4['id']]);_0xf92f16[_0x3183b4['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x64e5('0x48')](this,{'id':_0x3183b4['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0xf92f16;}function startAllRefreshIntervals(){return db[_0x64e5('0x42')][_0x64e5('0x49')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x49acf4){var _0x588e76=_0x49acf4['map'](function(_0x3fae41){return refreshOauth2MicrosoftAccessToken(_0x3fae41)['then'](function(_0x3374aa){startRefreshInterval(_0x3374aa);});});return Promise['all'](_0x588e76);})['catch'](function(_0x57cc30){var _0x4ebc34=_0x57cc30?util[_0x64e5('0x4a')](_0x57cc30,{'showHidden':![],'depth':null}):'';logger['error'](_0x64e5('0x4b'),_0x4ebc34);});}module[_0x64e5('0x4c')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x8559=['../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','profile','email','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','openid','/token','map','type','Dynamics365','/.default','{TENANT_ID}','data2','code','id_token','from','stringify','toString','base64','randomBytes','data1','response_type','join','redirect_uri','data4','form_post','scope','state','nonce','login','key','value','oauth2Claims','replace','oauth2/','decode','payload','iss','issuer','aud','unix','exp','resolve','then','data3','CloudProvider','findOne','refresh_token','data6','decryptString','POST','data5','access_token','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','intervals','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor'];(function(_0x218554,_0x2896f4){var _0x3a2bbf=function(_0x106868){while(--_0x106868){_0x218554['push'](_0x218554['shift']());}};_0x3a2bbf(++_0x2896f4);}(_0x8559,0x175));var _0x9855=function(_0xcd47a,_0x100962){_0xcd47a=_0xcd47a-0x0;var _0x4b58dd=_0x8559[_0xcd47a];return _0x4b58dd;};'use strict';var _=require('lodash');var crypto=require(_0x9855('0x0'));var jwt=require(_0x9855('0x1'));var moment=require(_0x9855('0x2'));var Redis=require(_0x9855('0x3'));var rp=require(_0x9855('0x4'));var util=require(_0x9855('0x5'));var encryptor=require(_0x9855('0x6'));var config=require(_0x9855('0x7'));var logger=require(_0x9855('0x8'))(_0x9855('0x9'));var schedule=require(_0x9855('0xa'));var db=require(_0x9855('0xb'))['db'];config[_0x9855('0xc')]=_[_0x9855('0xd')](config[_0x9855('0xc')],{'host':_0x9855('0xe'),'port':0x18eb});var redis=new Redis(config[_0x9855('0xc')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0x9855('0xf'),_0x9855('0x10'),'offline_access',_0x9855('0x11'),_0x9855('0x12'),_0x9855('0x13')],'Dynamics365':[_0x9855('0x14'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0x9855('0x15');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x4727da){var _0x2d6e66=_[_0x9855('0x16')](AZURE_AUTH_SCOPES[_0x4727da[_0x9855('0x17')]]);if(_0x4727da[_0x9855('0x17')]===_0x9855('0x18'))_0x2d6e66['push'](_0x4727da['data7']+_0x9855('0x19'));return _0x2d6e66['join']('\x20');}function getAccessTokenScope(_0x718a08){if(_0x718a08[_0x9855('0x17')]==='Outlook365')return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x718a08[_0x9855('0x17')]===_0x9855('0x18'))return _0x718a08['data7']+_0x9855('0x19');}function generateMicrosoftAuthorizationUrl(_0x28cd68,_0x27afd4){var _0x5b1953=MICROSOFT_AUTH_URL['replace'](_0x9855('0x1a'),_0x28cd68[_0x9855('0x1b')]);var _0xaec9f2=[_0x9855('0x1c'),_0x9855('0x1d')];var _0x17bcfe=Buffer[_0x9855('0x1e')](JSON[_0x9855('0x1f')]({'id':_0x27afd4}))[_0x9855('0x20')](_0x9855('0x21'));var _0x72bc7a=crypto[_0x9855('0x22')](0x10)[_0x9855('0x20')]('hex');var _0x126b20=getAuthorizationScopes(_0x28cd68);var _0x562828=[{'key':'client_id','value':_0x28cd68[_0x9855('0x23')]},{'key':_0x9855('0x24'),'value':encodeURIComponent(_0xaec9f2[_0x9855('0x25')]('\x20'))},{'key':_0x9855('0x26'),'value':_0x28cd68[_0x9855('0x27')]},{'key':'response_mode','value':_0x9855('0x28')},{'key':_0x9855('0x29'),'value':encodeURIComponent(_0x126b20)},{'key':_0x9855('0x2a'),'value':_0x17bcfe},{'key':_0x9855('0x2b'),'value':_0x72bc7a},{'key':'prompt','value':_0x9855('0x2c')}];var _0x577d6a=_0x5b1953+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x9855('0x16')](_0x562828,function(_0x1db66c){return _0x1db66c[_0x9855('0x2d')]+'='+_0x1db66c[_0x9855('0x2e')];})[_0x9855('0x25')]('&');_0x28cd68[_0x9855('0x2f')]={'issuer':_0x5b1953[_0x9855('0x30')](_0x9855('0x31'),''),'audience':_0x28cd68[_0x9855('0x23')],'state':_0x17bcfe,'nonce':_0x72bc7a};redis['set'](_0x17bcfe,JSON[_0x9855('0x1f')](_0x28cd68));return _0x577d6a;}function isValidIdToken(_0x805928,_0x310a39){try{var _0x1705e1=jwt[_0x9855('0x32')](_0x805928,{'complete':!![]});var _0x41e902=_0x1705e1[_0x9855('0x33')];if(_0x41e902[_0x9855('0x34')]!==_0x310a39[_0x9855('0x35')])return![];if(_0x41e902[_0x9855('0x36')]!==_0x310a39['audience'])return![];if(_0x41e902[_0x9855('0x2b')]!==_0x310a39[_0x9855('0x2b')])return![];if(moment()['isAfter'](moment[_0x9855('0x37')](_0x41e902[_0x9855('0x38')])))return![];return!![];}catch(_0x40bdd8){throw _0x40bdd8;}}function refreshOauth2MicrosoftAccessToken(_0x3b9936){return Promise[_0x9855('0x39')]()[_0x9855('0x3a')](function(){if(_0x3b9936[_0x9855('0x3b')])return _0x3b9936;return db[_0x9855('0x3c')][_0x9855('0x3d')]({'where':{'id':_0x3b9936['id']},'raw':!![]});})[_0x9855('0x3a')](function(_0x5ef6d3){var _0x11714a={'grant_type':_0x9855('0x3e'),'refresh_token':_0x5ef6d3[_0x9855('0x3f')],'scope':getAccessTokenScope(_0x5ef6d3),'redirect_uri':_0x5ef6d3[_0x9855('0x27')],'client_id':_0x5ef6d3['data1'],'client_secret':encryptor[_0x9855('0x40')](_0x5ef6d3[_0x9855('0x3b')])};var _0xc37255={'method':_0x9855('0x41'),'uri':MICROSOFT_AUTH_URL[_0x9855('0x30')](_0x9855('0x1a'),_0x5ef6d3[_0x9855('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x11714a,'json':!![]};return rp(_0xc37255);})[_0x9855('0x3a')](function(_0x526b5e){_0x3b9936[_0x9855('0x42')]=_0x526b5e[_0x9855('0x43')];_0x3b9936[_0x9855('0x3f')]=_0x526b5e[_0x9855('0x3e')];return db[_0x9855('0x3c')]['update']({'data5':_0x3b9936[_0x9855('0x42')],'data6':_0x3b9936[_0x9855('0x3f')]},{'where':{'id':_0x3b9936['id']}});})[_0x9855('0x3a')](function(){return _0x3b9936;})[_0x9855('0x44')](function(_0x3d871e){logger[_0x9855('0x45')](_0x9855('0x46'),_0x3b9936['id'],_0x3d871e);});}function getOauth2MicrosoftAccessToken(_0x15d482,_0x4f5132){var _0x1e4add={'grant_type':'authorization_code','code':_0x15d482,'scope':getAccessTokenScope(_0x4f5132),'redirect_uri':_0x4f5132['data4'],'client_id':_0x4f5132[_0x9855('0x23')],'client_secret':encryptor[_0x9855('0x40')](_0x4f5132[_0x9855('0x3b')])};var _0x284dd2={'method':_0x9855('0x41'),'uri':MICROSOFT_AUTH_URL[_0x9855('0x30')](_0x9855('0x1a'),_0x4f5132[_0x9855('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1e4add,'json':!![]};return rp(_0x284dd2);}function startRefreshInterval(_0x1d2187){var _0x3cae93=schedule[_0x9855('0x47')];if(_0x3cae93[_0x1d2187['id']])clearInterval(_0x3cae93[_0x1d2187['id']]);_0x3cae93[_0x1d2187['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x1d2187['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x9855('0x47')]=_0x3cae93;}function startAllRefreshIntervals(){return db['CloudProvider'][_0x9855('0x48')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x9855('0x3a')](function(_0x4cb1c4){var _0x30a2f1=_0x4cb1c4[_0x9855('0x16')](function(_0x496b56){return refreshOauth2MicrosoftAccessToken(_0x496b56)[_0x9855('0x3a')](function(_0x4f1ec9){startRefreshInterval(_0x4f1ec9);});});return Promise[_0x9855('0x49')](_0x30a2f1);})[_0x9855('0x44')](function(_0x3f6f80){var _0x53316f=_0x3f6f80?util[_0x9855('0x4a')](_0x3f6f80,{'showHidden':![],'depth':null}):'';logger[_0x9855('0x45')](_0x9855('0x4b'),_0x53316f);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 17bcb2f..7ec8c3e 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 _0xbbbc=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','request\x20sent','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x6da129,_0x40948d){var _0x1349d6=function(_0x3b1bc){while(--_0x3b1bc){_0x6da129['push'](_0x6da129['shift']());}};_0x1349d6(++_0x40948d);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x4c27c2,_0x3572f4){_0x4c27c2=_0x4c27c2-0x0;var _0x5e2605=_0xbbbc[_0x4c27c2];return _0x5e2605;};'use strict';var _=require(_0xcbbb('0x0'));var util=require(_0xcbbb('0x1'));var moment=require(_0xcbbb('0x2'));var BPromise=require(_0xcbbb('0x3'));var rs=require(_0xcbbb('0x4'));var fs=require('fs');var Redis=require(_0xcbbb('0x5'));var db=require(_0xcbbb('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xcbbb('0x7'))(_0xcbbb('0x8'));var config=require(_0xcbbb('0x9'));var jayson=require(_0xcbbb('0xa'));var client=jayson[_0xcbbb('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x388197,_0x1796b4,_0x32ec9c){return new BPromise(function(_0x6f4fd8,_0x356249){return client[_0xcbbb('0xc')](_0x388197,_0x32ec9c)[_0xcbbb('0xd')](function(_0x4ec90a){logger[_0xcbbb('0xe')]('CloudProvider,\x20%s,\x20%s',_0x1796b4,'request\x20sent');logger[_0xcbbb('0xf')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x1796b4,_0xcbbb('0x10'),JSON['stringify'](_0x4ec90a));if(_0x4ec90a[_0xcbbb('0x11')]){if(_0x4ec90a[_0xcbbb('0x11')]['code']===0x1f4){logger[_0xcbbb('0x11')]('CloudProvider,\x20%s,\x20%s',_0x1796b4,_0x4ec90a[_0xcbbb('0x11')]['message']);return _0x356249(_0x4ec90a[_0xcbbb('0x11')][_0xcbbb('0x12')]);}logger[_0xcbbb('0x11')]('CloudProvider,\x20%s,\x20%s',_0x1796b4,_0x4ec90a[_0xcbbb('0x11')][_0xcbbb('0x12')]);return _0x6f4fd8(_0x4ec90a[_0xcbbb('0x11')][_0xcbbb('0x12')]);}else{logger['info']('CloudProvider,\x20%s,\x20%s',_0x1796b4,_0xcbbb('0x10'));_0x6f4fd8(_0x4ec90a[_0xcbbb('0x13')][_0xcbbb('0x12')]);}})[_0xcbbb('0x14')](function(_0x5e25ca){logger[_0xcbbb('0x11')]('CloudProvider,\x20%s,\x20%s',_0x1796b4,_0x5e25ca);_0x356249(_0x5e25ca);});});} \ No newline at end of file +var _0xccde=['stringify','error','code','CloudProvider,\x20%s,\x20%s','message','result','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent'];(function(_0x36147b,_0x57f40b){var _0x141351=function(_0x219aa1){while(--_0x219aa1){_0x36147b['push'](_0x36147b['shift']());}};_0x141351(++_0x57f40b);}(_0xccde,0x1e1));var _0xeccd=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xccde[_0x28947d];return _0x12d2ee;};'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')]('CloudProvider,\x20%s,\x20%s',_0x130f1c,'request\x20sent');logger['debug']('CloudProvider,\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')]('CloudProvider,\x20%s,\x20%s',_0x130f1c,_0x9dccd['error'][_0xeccd('0x11')]);return _0x1eebfb(_0x9dccd[_0xeccd('0xe')][_0xeccd('0x11')]);}else{logger[_0xeccd('0xb')]('CloudProvider,\x20%s,\x20%s',_0x130f1c,_0xeccd('0xc'));_0x1eebfb(_0x9dccd[_0xeccd('0x12')]['message']);}})['catch'](function(_0x42e47e){logger[_0xeccd('0xe')](_0xeccd('0x10'),_0x130f1c,_0x42e47e);_0x4b068e(_0x42e47e);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 6b3c4f3..6d23763 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 _0xdb28=['delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','oauth2MicrosoftCallback','express','Router','../../components/auth/service','./cloudProvider.controller','isAuthenticated','index','get','/:id','post','update'];(function(_0x3c139e,_0x177cfa){var _0x378be6=function(_0x45bdc3){while(--_0x45bdc3){_0x3c139e['push'](_0x3c139e['shift']());}};_0x378be6(++_0x177cfa);}(_0xdb28,0x106));var _0x8db2=function(_0x2d203b,_0x21eece){_0x2d203b=_0x2d203b-0x0;var _0x56e30e=_0xdb28[_0x2d203b];return _0x56e30e;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['get']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);router[_0x8db2('0x6')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller['show']);router[_0x8db2('0x8')]('/',auth[_0x8db2('0x4')](),controller['create']);router['put'](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0x9')]);router[_0x8db2('0xa')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xb')]);router['get'](_0x8db2('0xc'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xd')]);router['post'](_0x8db2('0xe'),controller[_0x8db2('0xf')]);module['exports']=router; \ No newline at end of file +var _0x7a54=['isAuthenticated','/:id','show','post','create','delete','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback','exports','express','Router','../../components/auth/service','get'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x7a54,0x106));var _0x47a5=function(_0x2f09a3,_0x3d2777){_0x2f09a3=_0x2f09a3-0x0;var _0xa63c1c=_0x7a54[_0x2f09a3];return _0xa63c1c;};'use strict';var express=require(_0x47a5('0x0'));var router=express[_0x47a5('0x1')]();var auth=require(_0x47a5('0x2'));var controller=require('./cloudProvider.controller');router[_0x47a5('0x3')]('/',auth[_0x47a5('0x4')](),controller['index']);router[_0x47a5('0x3')](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller[_0x47a5('0x6')]);router[_0x47a5('0x7')]('/',auth['isAuthenticated'](),controller[_0x47a5('0x8')]);router['put'](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller['update']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x47a5('0x3')](_0x47a5('0xa'),auth['isAuthenticated'](),controller[_0x47a5('0xb')]);router['post']('/oauth2/microsoft/callback',controller[_0x47a5('0xc')]);module[_0x47a5('0xd')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index a2df17b..bcea597 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 _0x2094=['STRING','name','sequelize'];(function(_0x4b23bc,_0x3bf394){var _0xb63d3=function(_0x1b73cb){while(--_0x1b73cb){_0x4b23bc['push'](_0x4b23bc['shift']());}};_0xb63d3(++_0x3bf394);}(_0x2094,0x10d));var _0x4209=function(_0x510ef9,_0x230714){_0x510ef9=_0x510ef9-0x0;var _0x50efd3=_0x2094[_0x510ef9];return _0x50efd3;};'use strict';var Sequelize=require(_0x4209('0x0'));module['exports']={'name':{'type':Sequelize[_0x4209('0x1')],'unique':_0x4209('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x4209('0x1')]},'companyId':{'type':Sequelize[_0x4209('0x1')]},'website':{'type':Sequelize[_0x4209('0x1')]},'phone':{'type':Sequelize[_0x4209('0x1')]},'fax':{'type':Sequelize[_0x4209('0x1')]},'type':{'type':Sequelize[_0x4209('0x1')]},'street':{'type':Sequelize[_0x4209('0x1')]},'postalCode':{'type':Sequelize[_0x4209('0x1')]},'city':{'type':Sequelize[_0x4209('0x1')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x4209('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x4209('0x1')]},'sStreet':{'type':Sequelize[_0x4209('0x1')]},'sPostalCode':{'type':Sequelize[_0x4209('0x1')]},'sCity':{'type':Sequelize[_0x4209('0x1')]},'sCountry':{'type':Sequelize[_0x4209('0x1')]},'description':{'type':Sequelize[_0x4209('0x1')]}}; \ No newline at end of file +var _0xfca5=['exports','STRING','name','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfca5,0x1cf));var _0x5fca=function(_0x576266,_0x4002b0){_0x576266=_0x576266-0x0;var _0x18234f=_0xfca5[_0x576266];return _0x18234f;};'use strict';var Sequelize=require(_0x5fca('0x0'));module[_0x5fca('0x1')]={'name':{'type':Sequelize[_0x5fca('0x2')],'unique':_0x5fca('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x5fca('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x5fca('0x2')]},'phone':{'type':Sequelize[_0x5fca('0x2')]},'fax':{'type':Sequelize[_0x5fca('0x2')]},'type':{'type':Sequelize[_0x5fca('0x2')]},'street':{'type':Sequelize[_0x5fca('0x2')]},'postalCode':{'type':Sequelize[_0x5fca('0x2')]},'city':{'type':Sequelize[_0x5fca('0x2')]},'country':{'type':Sequelize[_0x5fca('0x2')]},'email':{'type':Sequelize[_0x5fca('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x5fca('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x5fca('0x2')]},'sCity':{'type':Sequelize[_0x5fca('0x2')]},'sCountry':{'type':Sequelize[_0x5fca('0x2')]},'description':{'type':Sequelize[_0x5fca('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 3d5cab8..5a81938 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 _0xeaa2=['merge','map','options','where','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addContacts','omit','getContacts','findOne','CmContact','order','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','then','destroy','get','Companies','UserProfileResource','sendStatus','error','name','send','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter'];(function(_0x22e050,_0x1bedbc){var _0x5743f6=function(_0x5cdbd7){while(--_0x5cdbd7){_0x22e050['push'](_0x22e050['shift']());}};_0x5743f6(++_0x1bedbc);}(_0xeaa2,0x18c));var _0x2eaa=function(_0x174202,_0x5c5292){_0x174202=_0x174202-0x0;var _0x4daa4a=_0xeaa2[_0x174202];return _0x4daa4a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2eaa('0x0'));var zipdir=require(_0x2eaa('0x1'));var jsonpatch=require(_0x2eaa('0x2'));var rp=require(_0x2eaa('0x3'));var moment=require(_0x2eaa('0x4'));var BPromise=require(_0x2eaa('0x5'));var Mustache=require(_0x2eaa('0x6'));var util=require(_0x2eaa('0x7'));var path=require(_0x2eaa('0x8'));var sox=require(_0x2eaa('0x9'));var csv=require(_0x2eaa('0xa'));var ejs=require(_0x2eaa('0xb'));var fs=require('fs');var fs_extra=require(_0x2eaa('0xc'));var _=require(_0x2eaa('0xd'));var squel=require('squel');var crypto=require(_0x2eaa('0xe'));var jsforce=require(_0x2eaa('0xf'));var deskjs=require(_0x2eaa('0x10'));var toCsv=require('to-csv');var querystring=require(_0x2eaa('0x11'));var Papa=require(_0x2eaa('0x12'));var Redis=require(_0x2eaa('0x13'));var authService=require(_0x2eaa('0x14'));var qs=require(_0x2eaa('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2eaa('0x16'));var logger=require(_0x2eaa('0x17'))(_0x2eaa('0x18'));var utils=require(_0x2eaa('0x19'));var config=require(_0x2eaa('0x1a'));var licenseUtil=require(_0x2eaa('0x1b'));var db=require(_0x2eaa('0x1c'))['db'];function respondWithStatusCode(_0x29a8da,_0x33693){_0x33693=_0x33693||0xcc;return function(_0x41d8e2){if(_0x41d8e2){return _0x29a8da['sendStatus'](_0x33693);}return _0x29a8da[_0x2eaa('0x1d')](_0x33693)[_0x2eaa('0x1e')]();};}function respondWithResult(_0x5e3ca0,_0xdcbcfb){_0xdcbcfb=_0xdcbcfb||0xc8;return function(_0xebd1b){if(_0xebd1b){return _0x5e3ca0[_0x2eaa('0x1d')](_0xdcbcfb)[_0x2eaa('0x1f')](_0xebd1b);}};}function respondWithFilteredResult(_0x3b8337,_0x36d25c){return function(_0x3d1605){if(_0x3d1605){var _0x4d1e89=typeof _0x36d25c[_0x2eaa('0x20')]==='undefined'&&typeof _0x36d25c[_0x2eaa('0x21')]===_0x2eaa('0x22');var _0x4e685a=_0x3d1605[_0x2eaa('0x23')];var _0x523303=_0x4d1e89?0x0:_0x36d25c['offset'];var _0x47dac4=_0x4d1e89?_0x3d1605[_0x2eaa('0x23')]:_0x36d25c[_0x2eaa('0x20')]+_0x36d25c[_0x2eaa('0x21')];var _0x461906;if(_0x47dac4>=_0x4e685a){_0x47dac4=_0x4e685a;_0x461906=0xc8;}else{_0x461906=0xce;}_0x3b8337[_0x2eaa('0x1d')](_0x461906);return _0x3b8337[_0x2eaa('0x24')](_0x2eaa('0x25'),_0x523303+'-'+_0x47dac4+'/'+_0x4e685a)['json'](_0x3d1605);}return null;};}function patchUpdates(_0x42590f){return function(_0xb5db73){try{jsonpatch['apply'](_0xb5db73,_0x42590f,!![]);}catch(_0x39f4d8){return BPromise[_0x2eaa('0x26')](_0x39f4d8);}return _0xb5db73[_0x2eaa('0x27')]();};}function saveUpdates(_0x3bc0a5,_0x236493){return function(_0x47b081){if(_0x47b081){return _0x47b081['update'](_0x3bc0a5)[_0x2eaa('0x28')](function(_0x293e27){return _0x293e27;});}return null;};}function removeEntity(_0x6ac0c7,_0x1bf3d4){return function(_0xb3c1aa){if(_0xb3c1aa){return _0xb3c1aa[_0x2eaa('0x29')]()['then'](function(){var _0x5953dc=_0xb3c1aa[_0x2eaa('0x2a')]({'plain':!![]});var _0x5cc0ab=_0x2eaa('0x2b');return db[_0x2eaa('0x2c')][_0x2eaa('0x29')]({'where':{'type':_0x5cc0ab,'resourceId':_0x5953dc['id']}})[_0x2eaa('0x28')](function(){return _0xb3c1aa;});})[_0x2eaa('0x28')](function(){_0x6ac0c7[_0x2eaa('0x1d')](0xcc)[_0x2eaa('0x1e')]();});}};}function handleEntityNotFound(_0x221b6b,_0x3b9833){return function(_0x522465){if(!_0x522465){_0x221b6b[_0x2eaa('0x2d')](0x194);}return _0x522465;};}function handleError(_0x4a644a,_0x112c4a){_0x112c4a=_0x112c4a||0x1f4;return function(_0x30157a){logger[_0x2eaa('0x2e')](_0x30157a['stack']);if(_0x30157a[_0x2eaa('0x2f')]){delete _0x30157a['name'];}_0x4a644a['status'](_0x112c4a)[_0x2eaa('0x30')](_0x30157a);};}exports[_0x2eaa('0x31')]=function(_0x5cadd9,_0x30b03f){var _0x5c75d7={},_0x2b135b={},_0x10216d={'count':0x0,'rows':[]};return db[_0x2eaa('0x32')][_0x2eaa('0x33')]()[_0x2eaa('0x28')](function(_0x688ff6){_0x2b135b[_0x2eaa('0x34')]=_[_0x2eaa('0x35')](_0x688ff6);_0x2b135b[_0x2eaa('0x36')]=_[_0x2eaa('0x35')](_0x5cadd9[_0x2eaa('0x36')]);_0x2b135b[_0x2eaa('0x37')]=_[_0x2eaa('0x38')](_0x2b135b[_0x2eaa('0x34')],_0x2b135b[_0x2eaa('0x36')]);_0x5c75d7[_0x2eaa('0x39')]=_['intersection'](_0x2b135b[_0x2eaa('0x34')],qs[_0x2eaa('0x3a')](_0x5cadd9[_0x2eaa('0x36')]['fields']));_0x5c75d7[_0x2eaa('0x39')]=_0x5c75d7[_0x2eaa('0x39')][_0x2eaa('0x3b')]?_0x5c75d7[_0x2eaa('0x39')]:_0x2b135b[_0x2eaa('0x34')];if(!_0x5cadd9[_0x2eaa('0x36')][_0x2eaa('0x3c')](_0x2eaa('0x3d'))){_0x5c75d7[_0x2eaa('0x21')]=qs['limit'](_0x5cadd9[_0x2eaa('0x36')][_0x2eaa('0x21')]);_0x5c75d7[_0x2eaa('0x20')]=qs[_0x2eaa('0x20')](_0x5cadd9['query']['offset']);}_0x5c75d7['order']=qs[_0x2eaa('0x3e')](_0x5cadd9[_0x2eaa('0x36')][_0x2eaa('0x3e')]);_0x5c75d7['where']=qs['filters'](_['pick'](_0x5cadd9['query'],_0x2b135b[_0x2eaa('0x37')]),_0x688ff6);if(_0x5cadd9[_0x2eaa('0x36')][_0x2eaa('0x3f')]){_0x5c75d7['where']=_[_0x2eaa('0x40')](_0x5c75d7['where'],{'$or':_[_0x2eaa('0x41')](_0x5c75d7['attributes'],function(_0x2648d2){var _0x5a91ed={};_0x5a91ed[_0x2648d2]={'$like':'%'+_0x5cadd9[_0x2eaa('0x36')][_0x2eaa('0x3f')]+'%'};return _0x5a91ed;})});}_0x5c75d7=_[_0x2eaa('0x40')]({},_0x5c75d7,_0x5cadd9[_0x2eaa('0x42')]);var _0x552dcc={'where':_0x5c75d7[_0x2eaa('0x43')]};return db['CmCompany'][_0x2eaa('0x23')](_0x552dcc)[_0x2eaa('0x28')](function(_0x10b274){_0x10216d[_0x2eaa('0x23')]=_0x10b274;if(_0x5cadd9[_0x2eaa('0x36')][_0x2eaa('0x44')]){_0x5c75d7[_0x2eaa('0x45')]=[{'all':!![]}];}return db[_0x2eaa('0x32')][_0x2eaa('0x46')](_0x5c75d7);})[_0x2eaa('0x28')](function(_0x3f2831){_0x10216d[_0x2eaa('0x47')]=_0x3f2831;return _0x10216d;})['then'](respondWithFilteredResult(_0x30b03f,_0x5c75d7))['catch'](handleError(_0x30b03f,null));})[_0x2eaa('0x48')](handleError(_0x30b03f,null));};exports[_0x2eaa('0x49')]=function(_0x11dff3,_0x133fbc){var _0x2fd3d7={'raw':![],'where':{'id':_0x11dff3[_0x2eaa('0x4a')]['id']}},_0x3413ef={};_0x3413ef[_0x2eaa('0x34')]=_[_0x2eaa('0x35')](db['CmCompany'][_0x2eaa('0x4b')]);_0x3413ef[_0x2eaa('0x36')]=_['keys'](_0x11dff3[_0x2eaa('0x36')]);_0x3413ef[_0x2eaa('0x37')]=_[_0x2eaa('0x38')](_0x3413ef[_0x2eaa('0x34')],_0x3413ef[_0x2eaa('0x36')]);_0x2fd3d7[_0x2eaa('0x39')]=_[_0x2eaa('0x38')](_0x3413ef[_0x2eaa('0x34')],qs['fields'](_0x11dff3[_0x2eaa('0x36')][_0x2eaa('0x3a')]));_0x2fd3d7[_0x2eaa('0x39')]=_0x2fd3d7[_0x2eaa('0x39')][_0x2eaa('0x3b')]?_0x2fd3d7['attributes']:_0x3413ef[_0x2eaa('0x34')];if(_0x11dff3['query'][_0x2eaa('0x44')]){_0x2fd3d7['include']=[{'all':!![]}];}_0x2fd3d7=_[_0x2eaa('0x40')]({},_0x2fd3d7,_0x11dff3['options']);return db[_0x2eaa('0x32')][_0x2eaa('0x4c')](_0x2fd3d7)[_0x2eaa('0x28')](handleEntityNotFound(_0x133fbc,null))[_0x2eaa('0x28')](respondWithResult(_0x133fbc,null))[_0x2eaa('0x48')](handleError(_0x133fbc,null));};exports[_0x2eaa('0x4d')]=function(_0x267658,_0x66447){return db['CmCompany']['create'](_0x267658[_0x2eaa('0x4e')],{})[_0x2eaa('0x28')](function(_0x4ee771){var _0x5ba4aa=_0x267658[_0x2eaa('0x4f')][_0x2eaa('0x2a')]({'plain':!![]});if(!_0x5ba4aa)throw new Error(_0x2eaa('0x50'));if(_0x5ba4aa[_0x2eaa('0x51')]===_0x2eaa('0x4f')){var _0x32f82b=_0x4ee771[_0x2eaa('0x2a')]({'plain':!![]});var _0x2e1a53=_0x2eaa('0x2b');return db[_0x2eaa('0x52')][_0x2eaa('0x4c')]({'where':{'name':_0x2e1a53,'userProfileId':_0x5ba4aa['userProfileId']},'raw':!![]})[_0x2eaa('0x28')](function(_0x102a26){if(_0x102a26&&_0x102a26[_0x2eaa('0x53')]===0x0){return db[_0x2eaa('0x2c')][_0x2eaa('0x4d')]({'name':_0x32f82b[_0x2eaa('0x2f')],'resourceId':_0x32f82b['id'],'type':_0x102a26[_0x2eaa('0x2f')],'sectionId':_0x102a26['id']},{})[_0x2eaa('0x28')](function(){return _0x4ee771;});}else{return _0x4ee771;}})[_0x2eaa('0x48')](function(_0x4564f8){logger['error'](_0x2eaa('0x54'),_0x4564f8);throw _0x4564f8;});}return _0x4ee771;})[_0x2eaa('0x28')](respondWithResult(_0x66447,0xc9))[_0x2eaa('0x48')](handleError(_0x66447,null));};exports[_0x2eaa('0x55')]=function(_0x2a1769,_0x44bd71){if(_0x2a1769[_0x2eaa('0x4e')]['id']){delete _0x2a1769[_0x2eaa('0x4e')]['id'];}return db[_0x2eaa('0x32')][_0x2eaa('0x4c')]({'where':{'id':_0x2a1769[_0x2eaa('0x4a')]['id']}})[_0x2eaa('0x28')](handleEntityNotFound(_0x44bd71,null))[_0x2eaa('0x28')](saveUpdates(_0x2a1769[_0x2eaa('0x4e')],null))[_0x2eaa('0x28')](respondWithResult(_0x44bd71,null))[_0x2eaa('0x48')](handleError(_0x44bd71,null));};exports['destroy']=function(_0x21b2c5,_0x657ed1){return db[_0x2eaa('0x32')][_0x2eaa('0x4c')]({'where':{'id':_0x21b2c5[_0x2eaa('0x4a')]['id']}})[_0x2eaa('0x28')](handleEntityNotFound(_0x657ed1,null))[_0x2eaa('0x28')](removeEntity(_0x657ed1,null))[_0x2eaa('0x48')](handleError(_0x657ed1,null));};exports['describe']=function(_0x2766fd,_0x56aa2f){return db[_0x2eaa('0x32')][_0x2eaa('0x33')]()['then'](respondWithResult(_0x56aa2f,null))[_0x2eaa('0x48')](handleError(_0x56aa2f,null));};exports[_0x2eaa('0x56')]=function(_0xb45b8a,_0x3755fd,_0x24f93b){return db['CmContact']['find']({'where':{'id':_0xb45b8a['params']['id']}})[_0x2eaa('0x28')](handleEntityNotFound(_0x3755fd,null))[_0x2eaa('0x28')](function(_0x10a861){if(_0x10a861){return _0x10a861[_0x2eaa('0x56')](_0xb45b8a['body']['ids'],_[_0x2eaa('0x57')](_0xb45b8a[_0x2eaa('0x4e')],['ids','id'])||{});}})[_0x2eaa('0x28')](respondWithResult(_0x3755fd,null))[_0x2eaa('0x48')](handleError(_0x3755fd,null));};exports[_0x2eaa('0x58')]=function(_0x1e5126,_0x3bd7ed,_0x1fb62d){var _0x466125={};var _0xefddfc={};var _0xd34d35;var _0x430bea;return db[_0x2eaa('0x32')][_0x2eaa('0x59')]({'where':{'id':_0x1e5126[_0x2eaa('0x4a')]['id']}})[_0x2eaa('0x28')](handleEntityNotFound(_0x3bd7ed,null))[_0x2eaa('0x28')](function(_0x2380e8){if(_0x2380e8){_0xd34d35=_0x2380e8;_0xefddfc[_0x2eaa('0x34')]=_[_0x2eaa('0x35')](db[_0x2eaa('0x5a')][_0x2eaa('0x4b')]);_0xefddfc[_0x2eaa('0x36')]=_[_0x2eaa('0x35')](_0x1e5126['query']);_0xefddfc[_0x2eaa('0x37')]=_['intersection'](_0xefddfc[_0x2eaa('0x34')],_0xefddfc[_0x2eaa('0x36')]);_0x466125[_0x2eaa('0x39')]=_['intersection'](_0xefddfc[_0x2eaa('0x34')],qs[_0x2eaa('0x3a')](_0x1e5126[_0x2eaa('0x36')][_0x2eaa('0x3a')]));_0x466125[_0x2eaa('0x39')]=_0x466125['attributes'][_0x2eaa('0x3b')]?_0x466125[_0x2eaa('0x39')]:_0xefddfc[_0x2eaa('0x34')];_0x466125[_0x2eaa('0x5b')]=qs[_0x2eaa('0x3e')](_0x1e5126[_0x2eaa('0x36')]['sort']);_0x466125[_0x2eaa('0x43')]=qs[_0x2eaa('0x37')](_['pick'](_0x1e5126['query'],_0xefddfc['filters']));if(_0x1e5126[_0x2eaa('0x36')]['filter']){_0x466125[_0x2eaa('0x43')]=_['merge'](_0x466125[_0x2eaa('0x43')],{'$or':_[_0x2eaa('0x41')](_0x466125[_0x2eaa('0x39')],function(_0x348540){var _0x48c0d4={};_0x48c0d4[_0x348540]={'$like':'%'+_0x1e5126[_0x2eaa('0x36')][_0x2eaa('0x3f')]+'%'};return _0x48c0d4;})});}_0x466125=_[_0x2eaa('0x40')]({},_0x466125,_0x1e5126['options']);return _0xd34d35[_0x2eaa('0x58')](_0x466125);}})[_0x2eaa('0x28')](function(_0x4ddf14){if(_0x4ddf14){_0x430bea=_0x4ddf14[_0x2eaa('0x3b')];if(!_0x1e5126[_0x2eaa('0x36')][_0x2eaa('0x3c')](_0x2eaa('0x3d'))){_0x466125[_0x2eaa('0x21')]=qs[_0x2eaa('0x21')](_0x1e5126[_0x2eaa('0x36')][_0x2eaa('0x21')]);_0x466125[_0x2eaa('0x20')]=qs['offset'](_0x1e5126[_0x2eaa('0x36')][_0x2eaa('0x20')]);}return _0xd34d35[_0x2eaa('0x58')](_0x466125);}})[_0x2eaa('0x28')](function(_0x6190f9){if(_0x6190f9){return _0x6190f9?{'count':_0x430bea,'rows':_0x6190f9}:null;}})[_0x2eaa('0x28')](respondWithResult(_0x3bd7ed,null))[_0x2eaa('0x48')](handleError(_0x3bd7ed,null));}; \ No newline at end of file +var _0x150c=['status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','CmCompany','describe','keys','filters','intersection','model','query','fields','attributes','length','limit','order','sort','where','pick','merge','filter','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','omit','ids','getContacts','findOne','rawAttributes','map','hasOwnProperty','nolimit','eml-format','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x150c,0x9a));var _0xc150=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0x150c[_0x342700];return _0x53406f;};'use strict';var emlformat=require(_0xc150('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc150('0x1'));var rp=require(_0xc150('0x2'));var moment=require(_0xc150('0x3'));var BPromise=require(_0xc150('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc150('0x5'));var sox=require(_0xc150('0x6'));var csv=require(_0xc150('0x7'));var ejs=require(_0xc150('0x8'));var fs=require('fs');var fs_extra=require(_0xc150('0x9'));var _=require(_0xc150('0xa'));var squel=require(_0xc150('0xb'));var crypto=require(_0xc150('0xc'));var jsforce=require(_0xc150('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc150('0x7'));var querystring=require(_0xc150('0xe'));var Papa=require(_0xc150('0xf'));var Redis=require('ioredis');var authService=require(_0xc150('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xc150('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc150('0x12'))(_0xc150('0x13'));var utils=require(_0xc150('0x14'));var config=require(_0xc150('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc150('0x16'))['db'];function respondWithStatusCode(_0x4268f3,_0x3b91a4){_0x3b91a4=_0x3b91a4||0xcc;return function(_0x2bcda4){if(_0x2bcda4){return _0x4268f3[_0xc150('0x17')](_0x3b91a4);}return _0x4268f3[_0xc150('0x18')](_0x3b91a4)[_0xc150('0x19')]();};}function respondWithResult(_0x19e986,_0x4a32d4){_0x4a32d4=_0x4a32d4||0xc8;return function(_0x4a120a){if(_0x4a120a){return _0x19e986[_0xc150('0x18')](_0x4a32d4)[_0xc150('0x1a')](_0x4a120a);}};}function respondWithFilteredResult(_0x440422,_0x5a094a){return function(_0x3d730b){if(_0x3d730b){var _0x3ccefc=typeof _0x5a094a[_0xc150('0x1b')]==='undefined'&&typeof _0x5a094a['limit']===_0xc150('0x1c');var _0x364e0a=_0x3d730b[_0xc150('0x1d')];var _0x1120c9=_0x3ccefc?0x0:_0x5a094a[_0xc150('0x1b')];var _0x302a01=_0x3ccefc?_0x3d730b[_0xc150('0x1d')]:_0x5a094a['offset']+_0x5a094a['limit'];var _0x2f89b2;if(_0x302a01>=_0x364e0a){_0x302a01=_0x364e0a;_0x2f89b2=0xc8;}else{_0x2f89b2=0xce;}_0x440422[_0xc150('0x18')](_0x2f89b2);return _0x440422[_0xc150('0x1e')](_0xc150('0x1f'),_0x1120c9+'-'+_0x302a01+'/'+_0x364e0a)[_0xc150('0x1a')](_0x3d730b);}return null;};}function patchUpdates(_0x2ba0ab){return function(_0xb70a76){try{jsonpatch[_0xc150('0x20')](_0xb70a76,_0x2ba0ab,!![]);}catch(_0x2c43f2){return BPromise[_0xc150('0x21')](_0x2c43f2);}return _0xb70a76['save']();};}function saveUpdates(_0x58162d,_0xeee1d4){return function(_0x55d1e3){if(_0x55d1e3){return _0x55d1e3[_0xc150('0x22')](_0x58162d)[_0xc150('0x23')](function(_0x527b8a){return _0x527b8a;});}return null;};}function removeEntity(_0x210fd5,_0x59059d){return function(_0x289090){if(_0x289090){return _0x289090[_0xc150('0x24')]()[_0xc150('0x23')](function(){var _0x5f4992=_0x289090[_0xc150('0x25')]({'plain':!![]});var _0x453f41='Companies';return db[_0xc150('0x26')][_0xc150('0x24')]({'where':{'type':_0x453f41,'resourceId':_0x5f4992['id']}})[_0xc150('0x23')](function(){return _0x289090;});})[_0xc150('0x23')](function(){_0x210fd5[_0xc150('0x18')](0xcc)[_0xc150('0x19')]();});}};}function handleEntityNotFound(_0x33cd44,_0x5a5a31){return function(_0x489294){if(!_0x489294){_0x33cd44['sendStatus'](0x194);}return _0x489294;};}function handleError(_0x129941,_0x79a54e){_0x79a54e=_0x79a54e||0x1f4;return function(_0x2c198f){logger[_0xc150('0x27')](_0x2c198f[_0xc150('0x28')]);if(_0x2c198f['name']){delete _0x2c198f[_0xc150('0x29')];}_0x129941[_0xc150('0x18')](_0x79a54e)[_0xc150('0x2a')](_0x2c198f);};}exports[_0xc150('0x2b')]=function(_0x1d145b,_0x49fb47){var _0x174ec7={},_0x24760c={},_0x41347a={'count':0x0,'rows':[]};return db[_0xc150('0x2c')][_0xc150('0x2d')]()['then'](function(_0x3efd2c){_0x24760c['model']=_['keys'](_0x3efd2c);_0x24760c['query']=_[_0xc150('0x2e')](_0x1d145b['query']);_0x24760c[_0xc150('0x2f')]=_[_0xc150('0x30')](_0x24760c[_0xc150('0x31')],_0x24760c[_0xc150('0x32')]);_0x174ec7['attributes']=_[_0xc150('0x30')](_0x24760c[_0xc150('0x31')],qs[_0xc150('0x33')](_0x1d145b[_0xc150('0x32')][_0xc150('0x33')]));_0x174ec7[_0xc150('0x34')]=_0x174ec7[_0xc150('0x34')][_0xc150('0x35')]?_0x174ec7[_0xc150('0x34')]:_0x24760c[_0xc150('0x31')];if(!_0x1d145b[_0xc150('0x32')]['hasOwnProperty']('nolimit')){_0x174ec7[_0xc150('0x36')]=qs[_0xc150('0x36')](_0x1d145b[_0xc150('0x32')]['limit']);_0x174ec7[_0xc150('0x1b')]=qs[_0xc150('0x1b')](_0x1d145b[_0xc150('0x32')][_0xc150('0x1b')]);}_0x174ec7[_0xc150('0x37')]=qs[_0xc150('0x38')](_0x1d145b[_0xc150('0x32')][_0xc150('0x38')]);_0x174ec7[_0xc150('0x39')]=qs[_0xc150('0x2f')](_[_0xc150('0x3a')](_0x1d145b['query'],_0x24760c['filters']),_0x3efd2c);if(_0x1d145b[_0xc150('0x32')]['filter']){_0x174ec7[_0xc150('0x39')]=_[_0xc150('0x3b')](_0x174ec7['where'],{'$or':_['map'](_0x174ec7[_0xc150('0x34')],function(_0x514c25){var _0x4c5797={};_0x4c5797[_0x514c25]={'$like':'%'+_0x1d145b[_0xc150('0x32')][_0xc150('0x3c')]+'%'};return _0x4c5797;})});}_0x174ec7=_['merge']({},_0x174ec7,_0x1d145b['options']);var _0xaa3a77={'where':_0x174ec7[_0xc150('0x39')]};return db[_0xc150('0x2c')][_0xc150('0x1d')](_0xaa3a77)[_0xc150('0x23')](function(_0x3ae607){_0x41347a[_0xc150('0x1d')]=_0x3ae607;if(_0x1d145b[_0xc150('0x32')][_0xc150('0x3d')]){_0x174ec7['include']=[{'all':!![]}];}return db[_0xc150('0x2c')][_0xc150('0x3e')](_0x174ec7);})[_0xc150('0x23')](function(_0x4b55fa){_0x41347a[_0xc150('0x3f')]=_0x4b55fa;return _0x41347a;})[_0xc150('0x23')](respondWithFilteredResult(_0x49fb47,_0x174ec7))['catch'](handleError(_0x49fb47,null));})[_0xc150('0x40')](handleError(_0x49fb47,null));};exports[_0xc150('0x41')]=function(_0xfc9d19,_0x4de175){var _0x89406f={'raw':![],'where':{'id':_0xfc9d19[_0xc150('0x42')]['id']}},_0x5c999d={};_0x5c999d[_0xc150('0x31')]=_[_0xc150('0x2e')](db['CmCompany']['rawAttributes']);_0x5c999d['query']=_[_0xc150('0x2e')](_0xfc9d19[_0xc150('0x32')]);_0x5c999d[_0xc150('0x2f')]=_[_0xc150('0x30')](_0x5c999d[_0xc150('0x31')],_0x5c999d[_0xc150('0x32')]);_0x89406f['attributes']=_[_0xc150('0x30')](_0x5c999d[_0xc150('0x31')],qs[_0xc150('0x33')](_0xfc9d19['query'][_0xc150('0x33')]));_0x89406f[_0xc150('0x34')]=_0x89406f[_0xc150('0x34')][_0xc150('0x35')]?_0x89406f[_0xc150('0x34')]:_0x5c999d[_0xc150('0x31')];if(_0xfc9d19['query'][_0xc150('0x3d')]){_0x89406f[_0xc150('0x43')]=[{'all':!![]}];}_0x89406f=_['merge']({},_0x89406f,_0xfc9d19[_0xc150('0x44')]);return db[_0xc150('0x2c')][_0xc150('0x45')](_0x89406f)[_0xc150('0x23')](handleEntityNotFound(_0x4de175,null))[_0xc150('0x23')](respondWithResult(_0x4de175,null))['catch'](handleError(_0x4de175,null));};exports['create']=function(_0x6aa338,_0x2cc21f){return db[_0xc150('0x2c')][_0xc150('0x46')](_0x6aa338[_0xc150('0x47')],{})[_0xc150('0x23')](function(_0x158e9a){var _0x237481=_0x6aa338[_0xc150('0x48')]['get']({'plain':!![]});if(!_0x237481)throw new Error(_0xc150('0x49'));if(_0x237481[_0xc150('0x4a')]===_0xc150('0x48')){var _0x1c94c8=_0x158e9a[_0xc150('0x25')]({'plain':!![]});var _0x570914='Companies';return db[_0xc150('0x4b')][_0xc150('0x45')]({'where':{'name':_0x570914,'userProfileId':_0x237481[_0xc150('0x4c')]},'raw':!![]})[_0xc150('0x23')](function(_0x31aab6){if(_0x31aab6&&_0x31aab6[_0xc150('0x4d')]===0x0){return db[_0xc150('0x26')][_0xc150('0x46')]({'name':_0x1c94c8['name'],'resourceId':_0x1c94c8['id'],'type':_0x31aab6['name'],'sectionId':_0x31aab6['id']},{})[_0xc150('0x23')](function(){return _0x158e9a;});}else{return _0x158e9a;}})[_0xc150('0x40')](function(_0x5d0fc6){logger[_0xc150('0x27')](_0xc150('0x4e'),_0x5d0fc6);throw _0x5d0fc6;});}return _0x158e9a;})[_0xc150('0x23')](respondWithResult(_0x2cc21f,0xc9))['catch'](handleError(_0x2cc21f,null));};exports[_0xc150('0x22')]=function(_0x438bc2,_0x8d33c7){if(_0x438bc2[_0xc150('0x47')]['id']){delete _0x438bc2[_0xc150('0x47')]['id'];}return db['CmCompany'][_0xc150('0x45')]({'where':{'id':_0x438bc2[_0xc150('0x42')]['id']}})[_0xc150('0x23')](handleEntityNotFound(_0x8d33c7,null))[_0xc150('0x23')](saveUpdates(_0x438bc2[_0xc150('0x47')],null))['then'](respondWithResult(_0x8d33c7,null))[_0xc150('0x40')](handleError(_0x8d33c7,null));};exports[_0xc150('0x24')]=function(_0x4c3a0a,_0xfae184){return db[_0xc150('0x2c')][_0xc150('0x45')]({'where':{'id':_0x4c3a0a['params']['id']}})[_0xc150('0x23')](handleEntityNotFound(_0xfae184,null))[_0xc150('0x23')](removeEntity(_0xfae184,null))[_0xc150('0x40')](handleError(_0xfae184,null));};exports[_0xc150('0x2d')]=function(_0x384cb2,_0xc4989e){return db[_0xc150('0x2c')][_0xc150('0x2d')]()[_0xc150('0x23')](respondWithResult(_0xc4989e,null))[_0xc150('0x40')](handleError(_0xc4989e,null));};exports[_0xc150('0x4f')]=function(_0x386a7b,_0x289df6,_0x1e2800){return db[_0xc150('0x50')][_0xc150('0x45')]({'where':{'id':_0x386a7b[_0xc150('0x42')]['id']}})[_0xc150('0x23')](handleEntityNotFound(_0x289df6,null))['then'](function(_0x131839){if(_0x131839){return _0x131839[_0xc150('0x4f')](_0x386a7b[_0xc150('0x47')]['ids'],_[_0xc150('0x51')](_0x386a7b[_0xc150('0x47')],[_0xc150('0x52'),'id'])||{});}})[_0xc150('0x23')](respondWithResult(_0x289df6,null))[_0xc150('0x40')](handleError(_0x289df6,null));};exports[_0xc150('0x53')]=function(_0x26ea57,_0x24cc8d,_0x1a584a){var _0x3a9d41={};var _0x2c8c81={};var _0x503d87;var _0x32bc0b;return db[_0xc150('0x2c')][_0xc150('0x54')]({'where':{'id':_0x26ea57[_0xc150('0x42')]['id']}})[_0xc150('0x23')](handleEntityNotFound(_0x24cc8d,null))[_0xc150('0x23')](function(_0x34cb41){if(_0x34cb41){_0x503d87=_0x34cb41;_0x2c8c81[_0xc150('0x31')]=_[_0xc150('0x2e')](db[_0xc150('0x50')][_0xc150('0x55')]);_0x2c8c81[_0xc150('0x32')]=_[_0xc150('0x2e')](_0x26ea57[_0xc150('0x32')]);_0x2c8c81[_0xc150('0x2f')]=_[_0xc150('0x30')](_0x2c8c81[_0xc150('0x31')],_0x2c8c81['query']);_0x3a9d41[_0xc150('0x34')]=_[_0xc150('0x30')](_0x2c8c81['model'],qs[_0xc150('0x33')](_0x26ea57[_0xc150('0x32')][_0xc150('0x33')]));_0x3a9d41[_0xc150('0x34')]=_0x3a9d41[_0xc150('0x34')][_0xc150('0x35')]?_0x3a9d41[_0xc150('0x34')]:_0x2c8c81[_0xc150('0x31')];_0x3a9d41['order']=qs[_0xc150('0x38')](_0x26ea57['query'][_0xc150('0x38')]);_0x3a9d41[_0xc150('0x39')]=qs[_0xc150('0x2f')](_[_0xc150('0x3a')](_0x26ea57[_0xc150('0x32')],_0x2c8c81['filters']));if(_0x26ea57[_0xc150('0x32')][_0xc150('0x3c')]){_0x3a9d41[_0xc150('0x39')]=_[_0xc150('0x3b')](_0x3a9d41[_0xc150('0x39')],{'$or':_[_0xc150('0x56')](_0x3a9d41[_0xc150('0x34')],function(_0x389b61){var _0x588269={};_0x588269[_0x389b61]={'$like':'%'+_0x26ea57[_0xc150('0x32')][_0xc150('0x3c')]+'%'};return _0x588269;})});}_0x3a9d41=_[_0xc150('0x3b')]({},_0x3a9d41,_0x26ea57[_0xc150('0x44')]);return _0x503d87[_0xc150('0x53')](_0x3a9d41);}})['then'](function(_0x274c22){if(_0x274c22){_0x32bc0b=_0x274c22[_0xc150('0x35')];if(!_0x26ea57['query'][_0xc150('0x57')](_0xc150('0x58'))){_0x3a9d41['limit']=qs[_0xc150('0x36')](_0x26ea57['query'][_0xc150('0x36')]);_0x3a9d41[_0xc150('0x1b')]=qs[_0xc150('0x1b')](_0x26ea57[_0xc150('0x32')][_0xc150('0x1b')]);}return _0x503d87['getContacts'](_0x3a9d41);}})[_0xc150('0x23')](function(_0x5c756a){if(_0x5c756a){return _0x5c756a?{'count':_0x32bc0b,'rows':_0x5c756a}:null;}})[_0xc150('0x23')](respondWithResult(_0x24cc8d,null))[_0xc150('0x40')](handleError(_0x24cc8d,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index da79641..4172182 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 _0x54a4=['api','moment','bluebird','path','rimraf','../../config/environment','define','CmCompany','lodash','util','../../config/logger'];(function(_0x41f56a,_0x49a25b){var _0x25d410=function(_0x2aae95){while(--_0x2aae95){_0x41f56a['push'](_0x41f56a['shift']());}};_0x25d410(++_0x49a25b);}(_0x54a4,0x17e));var _0x454a=function(_0x2bc288,_0x2d7f08){_0x2bc288=_0x2bc288-0x0;var _0x38d080=_0x54a4[_0x2bc288];return _0x38d080;};'use strict';var _=require(_0x454a('0x0'));var util=require(_0x454a('0x1'));var logger=require(_0x454a('0x2'))(_0x454a('0x3'));var moment=require(_0x454a('0x4'));var BPromise=require(_0x454a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x454a('0x6'));var rimraf=require(_0x454a('0x7'));var config=require(_0x454a('0x8'));var attributes=require('./cmCompany.attributes');module['exports']=function(_0x5b1a55,_0x36e093){return _0x5b1a55[_0x454a('0x9')](_0x454a('0xa'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x257d=['exports','define','cm_companies','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./cmCompany.attributes'];(function(_0x47878f,_0x48d3bf){var _0x4b05b8=function(_0x3d6597){while(--_0x3d6597){_0x47878f['push'](_0x47878f['shift']());}};_0x4b05b8(++_0x48d3bf);}(_0x257d,0x1b3));var _0xd257=function(_0x498e3f,_0x15bb7d){_0x498e3f=_0x498e3f-0x0;var _0x537c0f=_0x257d[_0x498e3f];return _0x537c0f;};'use strict';var _=require(_0xd257('0x0'));var util=require(_0xd257('0x1'));var logger=require(_0xd257('0x2'))(_0xd257('0x3'));var moment=require(_0xd257('0x4'));var BPromise=require('bluebird');var rp=require(_0xd257('0x5'));var fs=require('fs');var path=require(_0xd257('0x6'));var rimraf=require(_0xd257('0x7'));var config=require('../../config/environment');var attributes=require(_0xd257('0x8'));module[_0xd257('0x9')]=function(_0x420e20,_0x4711fc){return _0x420e20[_0xd257('0xa')]('CmCompany',attributes,{'tableName':_0xd257('0xb'),'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 90e3090..6a86591 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 _0x9ccc=['result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','CmCompany,\x20%s,\x20%s','debug','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x9c964b,_0x5a2929){var _0x5f3df7=function(_0x1f7a7e){while(--_0x1f7a7e){_0x9c964b['push'](_0x9c964b['shift']());}};_0x5f3df7(++_0x5a2929);}(_0x9ccc,0x161));var _0xc9cc=function(_0x21cf56,_0x25733c){_0x21cf56=_0x21cf56-0x0;var _0x31f4e0=_0x9ccc[_0x21cf56];return _0x31f4e0;};'use strict';var _=require(_0xc9cc('0x0'));var util=require(_0xc9cc('0x1'));var moment=require(_0xc9cc('0x2'));var BPromise=require('bluebird');var rs=require(_0xc9cc('0x3'));var fs=require('fs');var Redis=require(_0xc9cc('0x4'));var db=require(_0xc9cc('0x5'))['db'];var utils=require(_0xc9cc('0x6'));var logger=require(_0xc9cc('0x7'))('rpc');var config=require(_0xc9cc('0x8'));var jayson=require(_0xc9cc('0x9'));var client=jayson['client'][_0xc9cc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f6b87,_0x41fad2,_0x4b806e){return new BPromise(function(_0x4117fc,_0x26d398){return client[_0xc9cc('0xb')](_0x3f6b87,_0x4b806e)[_0xc9cc('0xc')](function(_0x307cbe){logger[_0xc9cc('0xd')](_0xc9cc('0xe'),_0x41fad2,'request\x20sent');logger[_0xc9cc('0xf')](_0xc9cc('0x10'),_0x41fad2,_0xc9cc('0x11'),JSON['stringify'](_0x307cbe));if(_0x307cbe[_0xc9cc('0x12')]){if(_0x307cbe[_0xc9cc('0x12')][_0xc9cc('0x13')]===0x1f4){logger['error'](_0xc9cc('0xe'),_0x41fad2,_0x307cbe[_0xc9cc('0x12')][_0xc9cc('0x14')]);return _0x26d398(_0x307cbe['error'][_0xc9cc('0x14')]);}logger[_0xc9cc('0x12')](_0xc9cc('0xe'),_0x41fad2,_0x307cbe[_0xc9cc('0x12')][_0xc9cc('0x14')]);return _0x4117fc(_0x307cbe['error'][_0xc9cc('0x14')]);}else{logger[_0xc9cc('0xd')](_0xc9cc('0xe'),_0x41fad2,_0xc9cc('0x11'));_0x4117fc(_0x307cbe[_0xc9cc('0x15')][_0xc9cc('0x14')]);}})['catch'](function(_0x30ea0e){logger['error'](_0xc9cc('0xe'),_0x41fad2,_0x30ea0e);_0x26d398(_0x30ea0e);});});} \ No newline at end of file +var _0x21c7=['../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCompany,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x2d0472,_0x2b3088){var _0x46a846=function(_0x209b5b){while(--_0x209b5b){_0x2d0472['push'](_0x2d0472['shift']());}};_0x46a846(++_0x2b3088);}(_0x21c7,0x1a8));var _0x721c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x21c7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x721c('0x0'));var util=require(_0x721c('0x1'));var moment=require(_0x721c('0x2'));var BPromise=require(_0x721c('0x3'));var rs=require(_0x721c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x721c('0x5'));var logger=require(_0x721c('0x6'))(_0x721c('0x7'));var config=require(_0x721c('0x8'));var jayson=require(_0x721c('0x9'));var client=jayson[_0x721c('0xa')][_0x721c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x53a7a6,_0x169b50,_0x33f7a2){return new BPromise(function(_0x5df156,_0x4996bd){return client[_0x721c('0xc')](_0x53a7a6,_0x33f7a2)[_0x721c('0xd')](function(_0x275b0e){logger['info']('CmCompany,\x20%s,\x20%s',_0x169b50,_0x721c('0xe'));logger[_0x721c('0xf')](_0x721c('0x10'),_0x169b50,_0x721c('0xe'),JSON[_0x721c('0x11')](_0x275b0e));if(_0x275b0e[_0x721c('0x12')]){if(_0x275b0e[_0x721c('0x12')][_0x721c('0x13')]===0x1f4){logger[_0x721c('0x12')](_0x721c('0x14'),_0x169b50,_0x275b0e[_0x721c('0x12')][_0x721c('0x15')]);return _0x4996bd(_0x275b0e['error'][_0x721c('0x15')]);}logger[_0x721c('0x12')](_0x721c('0x14'),_0x169b50,_0x275b0e[_0x721c('0x12')][_0x721c('0x15')]);return _0x5df156(_0x275b0e[_0x721c('0x12')]['message']);}else{logger[_0x721c('0x16')]('CmCompany,\x20%s,\x20%s',_0x169b50,_0x721c('0xe'));_0x5df156(_0x275b0e[_0x721c('0x17')][_0x721c('0x15')]);}})['catch'](function(_0x2f6c42){logger[_0x721c('0x12')](_0x721c('0x14'),_0x169b50,_0x2f6c42);_0x4996bd(_0x2f6c42);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 287cc6f..ff0bdb2 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 _0xd578=['index','get','isAuthenticated','describe','show','/:id/contacts','getContacts','create','post','addContacts','put','/:id','update','delete','destroy','multer','util','path','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xd578,0x1dd));var _0x8d57=function(_0x205570,_0x42fc4e){_0x205570=_0x205570-0x0;var _0x3f1c80=_0xd578[_0x205570];return _0x3f1c80;};'use strict';var multer=require(_0x8d57('0x0'));var util=require(_0x8d57('0x1'));var path=require(_0x8d57('0x2'));var timeout=require('connect-timeout');var express=require(_0x8d57('0x3'));var router=express[_0x8d57('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8d57('0x5'));var config=require(_0x8d57('0x6'));var controller=require('./cmCompany.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x8d57('0x7')]);router[_0x8d57('0x8')]('/describe',auth[_0x8d57('0x9')](),controller[_0x8d57('0xa')]);router[_0x8d57('0x8')]('/:id',auth[_0x8d57('0x9')](),controller[_0x8d57('0xb')]);router[_0x8d57('0x8')](_0x8d57('0xc'),auth[_0x8d57('0x9')](),controller[_0x8d57('0xd')]);router['post']('/',auth[_0x8d57('0x9')](),controller[_0x8d57('0xe')]);router[_0x8d57('0xf')](_0x8d57('0xc'),auth['isAuthenticated'](),controller[_0x8d57('0x10')]);router[_0x8d57('0x11')](_0x8d57('0x12'),auth[_0x8d57('0x9')](),controller[_0x8d57('0x13')]);router[_0x8d57('0x14')](_0x8d57('0x12'),auth[_0x8d57('0x9')](),controller[_0x8d57('0x15')]);module['exports']=router; \ No newline at end of file +var _0x26a2=['../../config/environment','./cmCompany.controller','isAuthenticated','/describe','describe','get','/:id','/:id/contacts','getContacts','post','create','addContacts','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x26a2,0x125));var _0x226a=function(_0x3b004f,_0x16392b){_0x3b004f=_0x3b004f-0x0;var _0x167b2f=_0x26a2[_0x3b004f];return _0x167b2f;};'use strict';var multer=require(_0x226a('0x0'));var util=require('util');var path=require(_0x226a('0x1'));var timeout=require(_0x226a('0x2'));var express=require('express');var router=express[_0x226a('0x3')]();var fs_extra=require(_0x226a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x226a('0x5'));var config=require(_0x226a('0x6'));var controller=require(_0x226a('0x7'));router['get']('/',auth[_0x226a('0x8')](),controller['index']);router['get'](_0x226a('0x9'),auth[_0x226a('0x8')](),controller[_0x226a('0xa')]);router[_0x226a('0xb')](_0x226a('0xc'),auth[_0x226a('0x8')](),controller['show']);router[_0x226a('0xb')](_0x226a('0xd'),auth[_0x226a('0x8')](),controller[_0x226a('0xe')]);router[_0x226a('0xf')]('/',auth[_0x226a('0x8')](),controller[_0x226a('0x10')]);router[_0x226a('0xf')](_0x226a('0xd'),auth[_0x226a('0x8')](),controller[_0x226a('0x11')]);router[_0x226a('0x12')](_0x226a('0xc'),auth['isAuthenticated'](),controller[_0x226a('0x13')]);router[_0x226a('0x14')](_0x226a('0xc'),auth['isAuthenticated'](),controller[_0x226a('0x15')]);module[_0x226a('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 3434f5f..0c4b2e0 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 _0xda2e=['NOW','lodash','sequelize','exports','STRING','INTEGER','UNSIGNED','DATE'];(function(_0x32d09e,_0x5e05bf){var _0x4c6451=function(_0x36fc57){while(--_0x36fc57){_0x32d09e['push'](_0x32d09e['shift']());}};_0x4c6451(++_0x5e05bf);}(_0xda2e,0xd9));var _0xeda2=function(_0x19fb2b,_0x212bd8){_0x19fb2b=_0x19fb2b-0x0;var _0x3be612=_0xda2e[_0x19fb2b];return _0x3be612;};'use strict';var _=require(_0xeda2('0x0'));var Sequelize=require(_0xeda2('0x1'));module[_0xeda2('0x2')]={'firstName':{'type':Sequelize[_0xeda2('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0xeda2('0x3')]},'street':{'type':Sequelize[_0xeda2('0x3')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xeda2('0x3')]},'country':{'type':Sequelize[_0xeda2('0x3')]},'dateOfBirth':{'type':Sequelize[_0xeda2('0x3')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0xeda2('0x3')]},'mobile':{'type':Sequelize[_0xeda2('0x3')]},'fax':{'type':Sequelize[_0xeda2('0x3')]},'email':{'type':Sequelize[_0xeda2('0x3')]},'url':{'type':Sequelize[_0xeda2('0x3')]},'facebook':{'type':Sequelize[_0xeda2('0x3')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0xeda2('0x3')]},'skype':{'type':Sequelize[_0xeda2('0x3')]},'teams':{'type':Sequelize[_0xeda2('0x3')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0xeda2('0x3')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xeda2('0x4')]},'AdditionalPhones':{'type':Sequelize[_0xeda2('0x3')]},'priority':{'type':Sequelize[_0xeda2('0x4')](0x2)[_0xeda2('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xeda2('0x6')],'defaultValue':Sequelize[_0xeda2('0x7')]},'dialTimezone':{'type':Sequelize[_0xeda2('0x3')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x49c8=['NOW','lodash','sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x49c8,0x7f));var _0x849c=function(_0x1f7fd5,_0x16dbb3){_0x1f7fd5=_0x1f7fd5-0x0;var _0x429402=_0x49c8[_0x1f7fd5];return _0x429402;};'use strict';var _=require(_0x849c('0x0'));var Sequelize=require(_0x849c('0x1'));module[_0x849c('0x2')]={'firstName':{'type':Sequelize[_0x849c('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x849c('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x849c('0x3')]},'city':{'type':Sequelize[_0x849c('0x3')]},'country':{'type':Sequelize[_0x849c('0x3')]},'dateOfBirth':{'type':Sequelize[_0x849c('0x3')]},'description':{'type':Sequelize[_0x849c('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x849c('0x3')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x849c('0x3')]},'url':{'type':Sequelize[_0x849c('0x3')]},'facebook':{'type':Sequelize[_0x849c('0x3')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x849c('0x3')]},'skype':{'type':Sequelize[_0x849c('0x3')]},'teams':{'type':Sequelize[_0x849c('0x3')]},'viber':{'type':Sequelize[_0x849c('0x3')]},'line':{'type':Sequelize[_0x849c('0x3')]},'wechat':{'type':Sequelize[_0x849c('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x849c('0x5')]},'AdditionalPhones':{'type':Sequelize[_0x849c('0x3')]},'priority':{'type':Sequelize[_0x849c('0x5')](0x2)[_0x849c('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x849c('0x7')],'defaultValue':Sequelize[_0x849c('0x8')]},'dialTimezone':{'type':Sequelize[_0x849c('0x3')]},'utcOffset':{'type':Sequelize[_0x849c('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 5b8c15f..887f4cb 100644 --- a/server/api/cmContact/cmContact.controller.js +++ b/server/api/cmContact/cmContact.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0x1780f8,_0x11ba93){var _0x33a410=function(_0x2a015f){while(--_0x2a015f){_0x1780f8['push'](_0x1780f8['shift']());}};_0x33a410(++_0x11ba93);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file +var _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 83fb13f..65cfe22 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 _0xc508=['emit','hook','exports','events','CmContact','setMaxListeners','save'];(function(_0x3bd0a1,_0x55c7c4){var _0x389e9d=function(_0x3d89ed){while(--_0x3d89ed){_0x3bd0a1['push'](_0x3bd0a1['shift']());}};_0x389e9d(++_0x55c7c4);}(_0xc508,0x130));var _0x8c50=function(_0x57ca85,_0x5c0271){_0x57ca85=_0x57ca85-0x0;var _0xa261b6=_0xc508[_0x57ca85];return _0xa261b6;};'use strict';var EventEmitter=require(_0x8c50('0x0'));var CmContact=require('../../mysqldb')['db'][_0x8c50('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x8c50('0x2')](0x0);var events={'afterCreate':_0x8c50('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x7dc896){return function(_0x49af68,_0x3e74c1,_0x404113){CmContactEvents[_0x8c50('0x4')](_0x7dc896+':'+_0x49af68['id'],_0x49af68);CmContactEvents[_0x8c50('0x4')](_0x7dc896,_0x49af68);_0x404113(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0x8c50('0x5')](e,emitEvent(event));}}module[_0x8c50('0x6')]=CmContactEvents; \ No newline at end of file +var _0x67cf=['save','update','exports','events','../../mysqldb','CmContact','setMaxListeners'];(function(_0x387843,_0x4fd57c){var _0x345fd1=function(_0x47bbbc){while(--_0x47bbbc){_0x387843['push'](_0x387843['shift']());}};_0x345fd1(++_0x4fd57c);}(_0x67cf,0x1ed));var _0xf67c=function(_0xac56ce,_0xb73e4){_0xac56ce=_0xac56ce-0x0;var _0x5105e1=_0x67cf[_0xac56ce];return _0x5105e1;};'use strict';var EventEmitter=require(_0xf67c('0x0'));var CmContact=require(_0xf67c('0x1'))['db'][_0xf67c('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xf67c('0x3')](0x0);var events={'afterCreate':_0xf67c('0x4'),'afterUpdate':_0xf67c('0x5'),'afterDestroy':'remove'};function emitEvent(_0x364bb3){return function(_0x2a485b,_0x1a97a7,_0x14a95a){CmContactEvents['emit'](_0x364bb3+':'+_0x2a485b['id'],_0x2a485b);CmContactEvents['emit'](_0x364bb3,_0x2a485b);_0x14a95a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0xf67c('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 691cb9a..f924ac8 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 _0x9d49=['length','onlyIfOpen','BlackLists','CmHopperBlack','error','cmContact,\x20%s,\x20%s','message','always','models','ContactId','CampaignId','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','lastName','fax','email','FULLTEXT','utf8mb4_unicode_ci','get','cmContact','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','findOne','then','timezones','utcOffset','add','ret','CmHopper','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','callbackUniqueid','catch','cmContact,\x20afterCreate\x20','\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','Campaign','minutes','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','cmContact,\x20afterCreate,\x20','findAll','outbound','dialCheckDuplicateType','CmList','Lists'];(function(_0x4ebc8c,_0x565017){var _0x49eb72=function(_0x402f0b){while(--_0x402f0b){_0x4ebc8c['push'](_0x4ebc8c['shift']());}};_0x49eb72(++_0x565017);}(_0x9d49,0x12d));var _0x99d4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9d49[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x99d4('0x0'));var util=require(_0x99d4('0x1'));var logger=require(_0x99d4('0x2'))(_0x99d4('0x3'));var moment=require(_0x99d4('0x4'));var BPromise=require(_0x99d4('0x5'));var rp=require(_0x99d4('0x6'));var fs=require('fs');var path=require(_0x99d4('0x7'));var rimraf=require(_0x99d4('0x8'));var config=require(_0x99d4('0x9'));var shared=require('../../config/environment/shared');var attributes=require(_0x99d4('0xa'));module[_0x99d4('0xb')]=function(_0x51534,_0x5332cc){return _0x51534[_0x99d4('0xc')](_0x99d4('0xd'),attributes,{'tableName':_0x99d4('0xe'),'paranoid':!![],'indexes':[{'name':_0x99d4('0xf'),'fields':[_0x99d4('0xf')]},{'name':_0x99d4('0x10'),'fields':[_0x99d4('0x11'),_0x99d4('0x12'),_0x99d4('0xf'),'mobile',_0x99d4('0x13'),_0x99d4('0x14')],'type':_0x99d4('0x15')}],'timestamps':!![],'charset':'utf8mb4','collate':_0x99d4('0x16'),'hooks':{'afterCreate':function(_0x349a04,_0x3082d1,_0x252bb0){var _0x4c77b5=_0x51534['models'];var _0x4c0462=_0x349a04[_0x99d4('0x17')]({'plain':!![]});function _0x30f4d2(){return function(_0x3a3427){logger['error'](_0x99d4('0x18'),_0x99d4('0x19'),util[_0x99d4('0x1a')](_0x3a3427,{'showHidden':![],'depth':null}));};}function _0x1c885f(_0x2d26c9,_0x3001a4){var _0x582a34=_0x3001a4[_0x99d4('0x1b')]?_0x3001a4['scheduledat']:moment()[_0x99d4('0x1c')](_0x99d4('0x1d'));return new BPromise(function(_0x2e3042,_0x493eb2){if(_[_0x99d4('0x1e')](_0x3001a4[_0x99d4('0x1f')])){_0x2e3042({'ret':_0x582a34});}else{_0x4c77b5[_0x99d4('0x20')][_0x99d4('0x21')]({'where':{'id':_0x2d26c9['id']}})[_0x99d4('0x22')](function(_0x2ad997){if(!_['isNil'](_0x2ad997)){var _0x1af7bc=_0x2ad997['dialTimezone'];if(!_[_0x99d4('0x1e')](_0x1af7bc)){var _0x4515c4=shared[_0x99d4('0x23')];var _0x17f375=_0x4515c4[_0x1af7bc];var _0x3b8467=_0x4515c4[_0x3001a4[_0x99d4('0x1f')]];if(!_[_0x99d4('0x1e')](_0x17f375)&&!_['isNil'](_0x3b8467)){var _0x4aa0a7=_0x17f375[_0x99d4('0x24')]-_0x3b8467['utcOffset'];_0x582a34=_0x3001a4[_0x99d4('0x1b')]?_0x3001a4[_0x99d4('0x1b')]:moment();var _0x2500d9=moment(_0x582a34)[_0x99d4('0x25')](_0x4aa0a7,'minutes');_0x2e3042({'ret':_0x2500d9[_0x99d4('0x1c')](_0x99d4('0x1d'))});}else _0x2e3042({'ret':_0x582a34});}else _0x2e3042({'ret':_0x582a34});}else{_0x2e3042({'ret':_0x582a34});}});}});return 0xa;}var _0x142ccf=function(_0x398578){return new BPromise(function(_0x292954,_0x4e1d5c){_0x1c885f(_0x398578,_0x4c0462)[_0x99d4('0x22')](function(_0x2c0a83){_0x4c0462[_0x99d4('0x1b')]=_0x2c0a83[_0x99d4('0x26')];_0x4c77b5[_0x99d4('0x27')]['findOne']({'where':{'phone':_0x4c0462[_0x99d4('0xf')],'VoiceQueueId':_0x398578['id']}})[_0x99d4('0x22')](function(_0x2fcf46){if(!_[_0x99d4('0x1e')](_0x2fcf46)){throw new Error('cmContact,\x20afterCreate\x20'+_0x4c0462['phone']+_0x99d4('0x28')+_0x398578['id']);}return _0x4c77b5['CmHopper'][_0x99d4('0x29')]({'phone':_0x4c0462[_0x99d4('0xf')],'ContactId':_0x4c0462['id'],'ListId':_0x4c0462[_0x99d4('0x2a')],'priority':_0x4c0462[_0x99d4('0x2b')]?_0x4c0462[_0x99d4('0x2b')]:0x2,'scheduledat':_0x4c0462['scheduledat']?_0x4c0462[_0x99d4('0x1b')]:moment()[_0x99d4('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x4c0462[_0x99d4('0x2c')]?!![]:![],'callbackuniqueid':_0x4c0462[_0x99d4('0x2c')]?_0x4c0462[_0x99d4('0x2c')]:undefined,'callbackat':_0x4c0462['callbackUniqueid']?moment()[_0x99d4('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x398578['id']});})[_0x99d4('0x2d')](function(_0x348860){_0x4e1d5c(_0x348860);});});});};var _0x5cc63a=function(_0x3726ed){return new BPromise(function(_0x9ea852,_0x4c9bf1){_0x1c885f(_0x3726ed,_0x4c0462)[_0x99d4('0x22')](function(_0x3c5d2d){_0x4c0462[_0x99d4('0x1b')]=_0x3c5d2d[_0x99d4('0x26')];_0x4c77b5[_0x99d4('0x27')][_0x99d4('0x21')]({'where':{'phone':_0x4c0462[_0x99d4('0xf')],'VoiceQueueId':_0x3726ed['id']}})['then'](function(_0x45490a){if(!_[_0x99d4('0x1e')](_0x45490a)){throw new Error(_0x99d4('0x2e')+_0x4c0462['phone']+_0x99d4('0x2f')+_0x3726ed['id']);}return _0x4c77b5[_0x99d4('0x30')][_0x99d4('0x21')]({'where':{'calleridnum':_0x4c0462['phone'],'VoiceQueueId':_0x3726ed['id']}});})['then'](function(_0x509984){if(!_['isNil'](_0x509984)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x4c0462['phone']+_0x99d4('0x31')+_0x3726ed['id']);}return _0x4c77b5[_0x99d4('0x27')]['create']({'phone':_0x4c0462['phone'],'ContactId':_0x4c0462['id'],'ListId':_0x4c0462[_0x99d4('0x2a')],'priority':_0x4c0462[_0x99d4('0x2b')]?_0x4c0462[_0x99d4('0x2b')]:0x2,'scheduledat':_0x4c0462[_0x99d4('0x1b')]?_0x4c0462[_0x99d4('0x1b')]:moment()[_0x99d4('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x4c0462[_0x99d4('0x2c')]?!![]:![],'callbackuniqueid':_0x4c0462[_0x99d4('0x2c')]?_0x4c0462[_0x99d4('0x2c')]:undefined,'callbackat':_0x4c0462[_0x99d4('0x2c')]?moment()[_0x99d4('0x1c')](_0x99d4('0x1d')):undefined,'VoiceQueueId':_0x3726ed['id']});})['catch'](function(_0x51b0e9){_0x4c9bf1(_0x51b0e9);});});});};function _0x5672b7(){return function(_0x5950f3){logger['error'](_0x99d4('0x18'),_0x99d4('0x19'),util[_0x99d4('0x1a')](_0x5950f3,{'showHidden':![],'depth':null}));};}function _0x33b561(_0x333557,_0x3eb566){var _0x5ed031=_0x3eb566[_0x99d4('0x1b')]?_0x3eb566[_0x99d4('0x1b')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x4ca4d2,_0x7dfaeb){if(_[_0x99d4('0x1e')](_0x3eb566[_0x99d4('0x1f')])){_0x4ca4d2({'ret':_0x5ed031});}else{_0x4c77b5[_0x99d4('0x32')][_0x99d4('0x21')]({'where':{'id':_0x333557['id']}})[_0x99d4('0x22')](function(_0x196e1f){if(!_[_0x99d4('0x1e')](_0x196e1f)){var _0x534435=_0x196e1f['dialTimezone'];if(!_[_0x99d4('0x1e')](_0x534435)){var _0x5b26b0=shared[_0x99d4('0x23')];var _0x38a29e=_0x5b26b0[_0x534435];var _0x391876=_0x5b26b0[_0x3eb566[_0x99d4('0x1f')]];if(!_[_0x99d4('0x1e')](_0x38a29e)&&!_[_0x99d4('0x1e')](_0x391876)){var _0xeea9ee=_0x38a29e[_0x99d4('0x24')]-_0x391876['utcOffset'];_0x5ed031=_0x3eb566[_0x99d4('0x1b')]?_0x3eb566[_0x99d4('0x1b')]:moment();var _0x5d88c1=moment(_0x5ed031)[_0x99d4('0x25')](_0xeea9ee,_0x99d4('0x33'));_0x4ca4d2({'ret':_0x5d88c1[_0x99d4('0x1c')](_0x99d4('0x1d'))});}else _0x4ca4d2({'ret':_0x5ed031});}else _0x4ca4d2({'ret':_0x5ed031});}else{_0x4ca4d2({'ret':_0x5ed031});}});}});return 0xa;}var _0x378582=function(_0x281067){return new BPromise(function(_0x25944f,_0x238e9d){_0x33b561(_0x281067,_0x4c0462)[_0x99d4('0x22')](function(_0x2940c1){_0x4c0462[_0x99d4('0x1b')]=_0x2940c1[_0x99d4('0x26')];_0x4c77b5['CmHopper']['findOne']({'where':{'phone':_0x4c0462[_0x99d4('0xf')],'CampaignId':_0x281067['id']}})[_0x99d4('0x22')](function(_0x2430a8){if(!_['isNil'](_0x2430a8)){throw new Error(_0x99d4('0x2e')+_0x4c0462[_0x99d4('0xf')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x281067['id']);}return _0x4c77b5[_0x99d4('0x27')][_0x99d4('0x29')]({'phone':_0x4c0462[_0x99d4('0xf')],'ContactId':_0x4c0462['id'],'ListId':_0x4c0462[_0x99d4('0x2a')],'priority':_0x4c0462[_0x99d4('0x2b')]?_0x4c0462[_0x99d4('0x2b')]:0x2,'scheduledat':_0x4c0462['scheduledat']?_0x4c0462[_0x99d4('0x1b')]:moment()[_0x99d4('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x4c0462[_0x99d4('0x2c')]?!![]:![],'callbackuniqueid':_0x4c0462[_0x99d4('0x2c')]?_0x4c0462['callbackUniqueid']:undefined,'callbackat':_0x4c0462[_0x99d4('0x2c')]?moment()[_0x99d4('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x281067['id']});})[_0x99d4('0x2d')](function(_0x3c852b){_0x238e9d(_0x3c852b);});});});};var _0x65f3da=function(_0x3c9970){return new BPromise(function(_0x2f40dd,_0x101368){_0x33b561(_0x3c9970,_0x4c0462)[_0x99d4('0x22')](function(_0x43d0ca){_0x4c0462[_0x99d4('0x1b')]=_0x43d0ca['ret'];_0x4c77b5[_0x99d4('0x27')]['findOne']({'where':{'phone':_0x4c0462[_0x99d4('0xf')],'CampaignId':_0x3c9970['id']}})[_0x99d4('0x22')](function(_0x58d7b9){if(!_[_0x99d4('0x1e')](_0x58d7b9)){throw new Error('cmContact,\x20afterCreate\x20'+_0x4c0462['phone']+_0x99d4('0x34')+_0x3c9970['id']);}return _0x4c77b5['CmHopperFinal'][_0x99d4('0x21')]({'where':{'calleridnum':_0x4c0462[_0x99d4('0xf')],'CampaignId':_0x3c9970['id']}});})[_0x99d4('0x22')](function(_0x181aa3){if(!_[_0x99d4('0x1e')](_0x181aa3)){throw new Error(_0x99d4('0x35')+_0x4c0462['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20'+_0x3c9970['id']);}return _0x4c77b5[_0x99d4('0x27')][_0x99d4('0x29')]({'phone':_0x4c0462[_0x99d4('0xf')],'ContactId':_0x4c0462['id'],'ListId':_0x4c0462[_0x99d4('0x2a')],'priority':_0x4c0462[_0x99d4('0x2b')]?_0x4c0462['priority']:0x2,'scheduledat':_0x4c0462[_0x99d4('0x1b')]?_0x4c0462[_0x99d4('0x1b')]:moment()[_0x99d4('0x1c')](_0x99d4('0x1d')),'callback':_0x4c0462[_0x99d4('0x2c')]?!![]:![],'callbackuniqueid':_0x4c0462[_0x99d4('0x2c')]?_0x4c0462[_0x99d4('0x2c')]:undefined,'callbackat':_0x4c0462[_0x99d4('0x2c')]?moment()[_0x99d4('0x1c')](_0x99d4('0x1d')):undefined,'CampaignId':_0x3c9970['id']});})[_0x99d4('0x2d')](function(_0x48f5cd){_0x101368(_0x48f5cd);});});});};if(_0x4c0462[_0x99d4('0x2a')]){_0x4c77b5[_0x99d4('0x20')][_0x99d4('0x36')]({'where':{'type':_0x99d4('0x37')},'attributes':['id',_0x99d4('0x38'),_0x99d4('0x1f')],'include':[{'model':_0x4c77b5[_0x99d4('0x39')],'as':_0x99d4('0x3a'),'where':{'id':_0x4c0462['ListId']}}]})[_0x99d4('0x22')](function(_0x4cfb0e){if(_0x4cfb0e){var _0x4a546a=[];for(var _0xbf8583=0x0,_0x1da201;_0xbf8583<_0x4cfb0e[_0x99d4('0x3b')];_0xbf8583+=0x1){_0x1da201=_0x4cfb0e[_0xbf8583]['get']({'plain':!![]});switch(_0x1da201['dialCheckDuplicateType']){case'always':_0x5cc63a(_0x1da201)[_0x99d4('0x2d')](_0x30f4d2());break;case _0x99d4('0x3c'):_0x142ccf(_0x1da201)[_0x99d4('0x2d')](_0x30f4d2());break;default:_0x33b561(_0x1da201,_0x4c0462)[_0x99d4('0x22')](function(_0x190c84){_0x4c0462[_0x99d4('0x1b')]=_0x190c84[_0x99d4('0x26')];_0x4c77b5[_0x99d4('0x27')][_0x99d4('0x29')]({'phone':_0x4c0462[_0x99d4('0xf')],'ContactId':_0x4c0462['id'],'ListId':_0x4c0462[_0x99d4('0x2a')],'scheduledat':_0x4c0462['scheduledat']?_0x4c0462[_0x99d4('0x1b')]:moment()[_0x99d4('0x1c')](_0x99d4('0x1d')),'priority':_0x4c0462[_0x99d4('0x2b')]?_0x4c0462[_0x99d4('0x2b')]:0x2,'callback':_0x4c0462[_0x99d4('0x2c')]?!![]:![],'callbackuniqueid':_0x4c0462[_0x99d4('0x2c')]?_0x4c0462[_0x99d4('0x2c')]:undefined,'callbackat':_0x4c0462[_0x99d4('0x2c')]?moment()[_0x99d4('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x1da201['id']})['catch'](_0x30f4d2());});}}}})[_0x99d4('0x22')](function(){return _0x4c77b5[_0x99d4('0x20')][_0x99d4('0x36')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0x4c77b5[_0x99d4('0x39')],'as':_0x99d4('0x3d'),'where':{'id':_0x4c0462[_0x99d4('0x2a')]}}]})[_0x99d4('0x22')](function(_0x282157){if(_0x282157){var _0x316aad=[];for(var _0x30efbb=0x0,_0x3f5bea;_0x30efbb<_0x282157['length'];_0x30efbb+=0x1){_0x3f5bea=_0x282157[_0x30efbb][_0x99d4('0x17')]({'plain':!![]});_0x4c77b5[_0x99d4('0x3e')]['create']({'phone':_0x4c0462[_0x99d4('0xf')],'ContactId':_0x4c0462['id'],'ListId':_0x4c0462[_0x99d4('0x2a')],'VoiceQueueId':_0x3f5bea['id']})['catch'](function(_0xf22818){logger[_0x99d4('0x3f')](_0x99d4('0x40'),'afterCreate',_0xf22818[_0x99d4('0x41')]);});}}});})[_0x99d4('0x22')](function(){return _0x4c77b5[_0x99d4('0x32')][_0x99d4('0x36')]({'attributes':['id',_0x99d4('0x38'),_0x99d4('0x1f')],'include':[{'model':_0x4c77b5[_0x99d4('0x39')],'as':'Lists','where':{'id':_0x4c0462['ListId']}}]})[_0x99d4('0x22')](function(_0x5dc54c){if(_0x5dc54c){var _0x33548d=[];for(var _0x3c3743=0x0,_0x1790b6;_0x3c3743<_0x5dc54c[_0x99d4('0x3b')];_0x3c3743+=0x1){_0x1790b6=_0x5dc54c[_0x3c3743][_0x99d4('0x17')]({'plain':!![]});switch(_0x1790b6[_0x99d4('0x38')]){case _0x99d4('0x42'):_0x65f3da(_0x1790b6)[_0x99d4('0x2d')](_0x5672b7());break;case _0x99d4('0x3c'):_0x378582(_0x1790b6)[_0x99d4('0x2d')](_0x5672b7());break;default:_0x4c77b5[_0x99d4('0x27')][_0x99d4('0x29')]({'phone':_0x4c0462['phone'],'ContactId':_0x4c0462['id'],'ListId':_0x4c0462[_0x99d4('0x2a')],'scheduledat':_0x4c0462[_0x99d4('0x1b')]?_0x4c0462['scheduledat']:moment()['format'](_0x99d4('0x1d')),'priority':_0x4c0462['priority']?_0x4c0462[_0x99d4('0x2b')]:0x2,'callback':_0x4c0462[_0x99d4('0x2c')]?!![]:![],'callbackuniqueid':_0x4c0462['callbackUniqueid']?_0x4c0462[_0x99d4('0x2c')]:undefined,'callbackat':_0x4c0462[_0x99d4('0x2c')]?moment()[_0x99d4('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x1790b6['id']})[_0x99d4('0x2d')](_0x5672b7());}}}});})[_0x99d4('0x22')](function(){return _0x4c77b5[_0x99d4('0x32')][_0x99d4('0x36')]({'attributes':['id'],'include':[{'model':_0x4c77b5[_0x99d4('0x39')],'as':_0x99d4('0x3d'),'where':{'id':_0x4c0462[_0x99d4('0x2a')]}}]})[_0x99d4('0x22')](function(_0x271cbf){if(_0x271cbf){var _0x7a31b3=[];for(var _0x18b571=0x0,_0x3a9b90;_0x18b571<_0x271cbf['length'];_0x18b571+=0x1){_0x3a9b90=_0x271cbf[_0x18b571][_0x99d4('0x17')]({'plain':!![]});_0x4c77b5[_0x99d4('0x3e')][_0x99d4('0x29')]({'phone':_0x4c0462['phone'],'ContactId':_0x4c0462['id'],'ListId':_0x4c0462[_0x99d4('0x2a')],'CampaignId':_0x3a9b90['id']})[_0x99d4('0x2d')](function(_0x5136a7){logger[_0x99d4('0x3f')](_0x99d4('0x40'),'afterCreate',_0x5136a7[_0x99d4('0x41')]);});}}});})['then'](function(){_0x252bb0();})['catch'](function(_0x1fb962){logger[_0x99d4('0x3f')]('cmContact,\x20%s,\x20%s',_0x99d4('0x19'),_0x1fb962[_0x99d4('0x41')]);_0x252bb0(_0x1fb962);});}else{_0x252bb0(new Error('List\x20not\x20found'));}},'afterDestroy':function(_0x303d64,_0x47c706,_0x5af8f8){var _0x567272=_0x51534[_0x99d4('0x43')];var _0x2bf7b3=_0x303d64[_0x99d4('0x17')]({'plain':!![]});return _0x567272[_0x99d4('0x27')][_0x99d4('0x36')]({'raw':!![],'where':{'ListId':_0x2bf7b3['ListId'],'ContactId':_0x2bf7b3['id']}})[_0x99d4('0x22')](function(_0x1750d2){if(!_['isEmpty'](_0x1750d2)){var _0x35afdf=[];for(var _0xba3052=0x0;_0xba3052<_0x1750d2['length'];_0xba3052+=0x1){var _0x115197=_0x567272[_0x99d4('0x27')]['destroy']({'where':{'ListId':_0x1750d2[_0xba3052]['ListId'],'ContactId':_0x1750d2[_0xba3052][_0x99d4('0x44')],'VoiceQueueId':_0x1750d2[_0xba3052]['VoiceQueueId'],'CampaignId':_0x1750d2[_0xba3052][_0x99d4('0x45')]}});_0x35afdf['push'](_0x115197);}return BPromise['all'](_0x35afdf);}})[_0x99d4('0x22')](function(_0x2b1241){logger['info'](_0x99d4('0x46'),util[_0x99d4('0x1a')](_0x2b1241,{'showHidden':![],'depth':null}));_0x5af8f8();})[_0x99d4('0x2d')](function(_0x1fe31c){logger['error'](_0x99d4('0x47'),util[_0x99d4('0x1a')](_0x1fe31c,{'showHidden':![],'depth':null}));_0x5af8f8(_0x1fe31c);});}}});}; \ No newline at end of file +var _0x0d9c=['FULLTEXT','utf8mb4_unicode_ci','error','cmContact','afterCreate','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','VoiceQueue','findOne','isNil','dialTimezone','timezones','utcOffset','add','minutes','ret','then','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','ListId','priority','callbackUniqueid','catch','cmContact,\x20afterCreate\x20','\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','CmHopper','create','inspect','Campaign','\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','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','outbound','dialCheckDuplicateType','CmList','Lists','length','always','BlackLists','get','CmHopperBlack','cmContact,\x20%s,\x20%s','message','findAll','models','isEmpty','destroy','ContactId','VoiceQueueId','CampaignId','all','info','[CmContact][afterDestroy][Succesfull]','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','lastName','fax','email'];(function(_0x239055,_0xb8da40){var _0x432cc2=function(_0x4cddf1){while(--_0x4cddf1){_0x239055['push'](_0x239055['shift']());}};_0x432cc2(++_0xb8da40);}(_0x0d9c,0x81));var _0xc0d9=function(_0x1d997f,_0x259b5a){_0x1d997f=_0x1d997f-0x0;var _0x307704=_0x0d9c[_0x1d997f];return _0x307704;};'use strict';var _=require(_0xc0d9('0x0'));var util=require(_0xc0d9('0x1'));var logger=require(_0xc0d9('0x2'))('api');var moment=require(_0xc0d9('0x3'));var BPromise=require(_0xc0d9('0x4'));var rp=require(_0xc0d9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc0d9('0x6'));var config=require(_0xc0d9('0x7'));var shared=require('../../config/environment/shared');var attributes=require(_0xc0d9('0x8'));module[_0xc0d9('0x9')]=function(_0x3f0cc0,_0x2a792b){return _0x3f0cc0[_0xc0d9('0xa')](_0xc0d9('0xb'),attributes,{'tableName':_0xc0d9('0xc'),'paranoid':!![],'indexes':[{'name':_0xc0d9('0xd'),'fields':[_0xc0d9('0xd')]},{'name':_0xc0d9('0xe'),'fields':[_0xc0d9('0xf'),_0xc0d9('0x10'),'phone','mobile',_0xc0d9('0x11'),_0xc0d9('0x12')],'type':_0xc0d9('0x13')}],'timestamps':!![],'charset':'utf8mb4','collate':_0xc0d9('0x14'),'hooks':{'afterCreate':function(_0x335128,_0x37d5f6,_0x1c3ef6){var _0x20ba51=_0x3f0cc0['models'];var _0x2a9f36=_0x335128['get']({'plain':!![]});function _0x4c7ee0(){return function(_0x719e7){logger[_0xc0d9('0x15')](_0xc0d9('0x16'),_0xc0d9('0x17'),util['inspect'](_0x719e7,{'showHidden':![],'depth':null}));};}function _0x3820fa(_0x31f851,_0x567081){var _0x42137a=_0x567081[_0xc0d9('0x18')]?_0x567081['scheduledat']:moment()[_0xc0d9('0x19')](_0xc0d9('0x1a'));return new BPromise(function(_0x1af6fa,_0x3a8c1e){if(_['isNil'](_0x567081['dialTimezone'])){_0x1af6fa({'ret':_0x42137a});}else{_0x20ba51[_0xc0d9('0x1b')][_0xc0d9('0x1c')]({'where':{'id':_0x31f851['id']}})['then'](function(_0x258126){if(!_[_0xc0d9('0x1d')](_0x258126)){var _0x17828a=_0x258126[_0xc0d9('0x1e')];if(!_['isNil'](_0x17828a)){var _0x590033=shared[_0xc0d9('0x1f')];var _0x19a9b6=_0x590033[_0x17828a];var _0x3509e7=_0x590033[_0x567081[_0xc0d9('0x1e')]];if(!_[_0xc0d9('0x1d')](_0x19a9b6)&&!_['isNil'](_0x3509e7)){var _0x135b8d=_0x19a9b6[_0xc0d9('0x20')]-_0x3509e7[_0xc0d9('0x20')];_0x42137a=_0x567081['scheduledat']?_0x567081[_0xc0d9('0x18')]:moment();var _0xe2ef5c=moment(_0x42137a)[_0xc0d9('0x21')](_0x135b8d,_0xc0d9('0x22'));_0x1af6fa({'ret':_0xe2ef5c[_0xc0d9('0x19')](_0xc0d9('0x1a'))});}else _0x1af6fa({'ret':_0x42137a});}else _0x1af6fa({'ret':_0x42137a});}else{_0x1af6fa({'ret':_0x42137a});}});}});return 0xa;}var _0x1b40e2=function(_0x28b2ad){return new BPromise(function(_0xc60604,_0x5267e2){_0x3820fa(_0x28b2ad,_0x2a9f36)['then'](function(_0x3b47b9){_0x2a9f36[_0xc0d9('0x18')]=_0x3b47b9[_0xc0d9('0x23')];_0x20ba51['CmHopper'][_0xc0d9('0x1c')]({'where':{'phone':_0x2a9f36[_0xc0d9('0xd')],'VoiceQueueId':_0x28b2ad['id']}})[_0xc0d9('0x24')](function(_0x49b068){if(!_[_0xc0d9('0x1d')](_0x49b068)){throw new Error('cmContact,\x20afterCreate\x20'+_0x2a9f36['phone']+_0xc0d9('0x25')+_0x28b2ad['id']);}return _0x20ba51['CmHopper']['create']({'phone':_0x2a9f36[_0xc0d9('0xd')],'ContactId':_0x2a9f36['id'],'ListId':_0x2a9f36[_0xc0d9('0x26')],'priority':_0x2a9f36[_0xc0d9('0x27')]?_0x2a9f36[_0xc0d9('0x27')]:0x2,'scheduledat':_0x2a9f36[_0xc0d9('0x18')]?_0x2a9f36[_0xc0d9('0x18')]:moment()[_0xc0d9('0x19')](_0xc0d9('0x1a')),'callback':_0x2a9f36[_0xc0d9('0x28')]?!![]:![],'callbackuniqueid':_0x2a9f36['callbackUniqueid']?_0x2a9f36[_0xc0d9('0x28')]:undefined,'callbackat':_0x2a9f36[_0xc0d9('0x28')]?moment()['format'](_0xc0d9('0x1a')):undefined,'VoiceQueueId':_0x28b2ad['id']});})[_0xc0d9('0x29')](function(_0x1a99d5){_0x5267e2(_0x1a99d5);});});});};var _0x291f7=function(_0x496db9){return new BPromise(function(_0x55aa21,_0x15ca45){_0x3820fa(_0x496db9,_0x2a9f36)[_0xc0d9('0x24')](function(_0x5b4857){_0x2a9f36[_0xc0d9('0x18')]=_0x5b4857[_0xc0d9('0x23')];_0x20ba51['CmHopper'][_0xc0d9('0x1c')]({'where':{'phone':_0x2a9f36[_0xc0d9('0xd')],'VoiceQueueId':_0x496db9['id']}})[_0xc0d9('0x24')](function(_0x422404){if(!_['isNil'](_0x422404)){throw new Error(_0xc0d9('0x2a')+_0x2a9f36[_0xc0d9('0xd')]+_0xc0d9('0x2b')+_0x496db9['id']);}return _0x20ba51[_0xc0d9('0x2c')][_0xc0d9('0x1c')]({'where':{'calleridnum':_0x2a9f36[_0xc0d9('0xd')],'VoiceQueueId':_0x496db9['id']}});})['then'](function(_0x4ed4b5){if(!_['isNil'](_0x4ed4b5)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x2a9f36['phone']+_0xc0d9('0x2d')+_0x496db9['id']);}return _0x20ba51[_0xc0d9('0x2e')][_0xc0d9('0x2f')]({'phone':_0x2a9f36[_0xc0d9('0xd')],'ContactId':_0x2a9f36['id'],'ListId':_0x2a9f36[_0xc0d9('0x26')],'priority':_0x2a9f36[_0xc0d9('0x27')]?_0x2a9f36[_0xc0d9('0x27')]:0x2,'scheduledat':_0x2a9f36[_0xc0d9('0x18')]?_0x2a9f36[_0xc0d9('0x18')]:moment()[_0xc0d9('0x19')](_0xc0d9('0x1a')),'callback':_0x2a9f36[_0xc0d9('0x28')]?!![]:![],'callbackuniqueid':_0x2a9f36[_0xc0d9('0x28')]?_0x2a9f36['callbackUniqueid']:undefined,'callbackat':_0x2a9f36[_0xc0d9('0x28')]?moment()[_0xc0d9('0x19')](_0xc0d9('0x1a')):undefined,'VoiceQueueId':_0x496db9['id']});})[_0xc0d9('0x29')](function(_0x27b20c){_0x15ca45(_0x27b20c);});});});};function _0x5f4fce(){return function(_0x46fc5e){logger[_0xc0d9('0x15')](_0xc0d9('0x16'),'afterCreate',util[_0xc0d9('0x30')](_0x46fc5e,{'showHidden':![],'depth':null}));};}function _0x2c9518(_0x536b27,_0x33a591){var _0x4c226c=_0x33a591[_0xc0d9('0x18')]?_0x33a591[_0xc0d9('0x18')]:moment()[_0xc0d9('0x19')](_0xc0d9('0x1a'));return new BPromise(function(_0x3207ad,_0x404a7a){if(_[_0xc0d9('0x1d')](_0x33a591[_0xc0d9('0x1e')])){_0x3207ad({'ret':_0x4c226c});}else{_0x20ba51[_0xc0d9('0x31')][_0xc0d9('0x1c')]({'where':{'id':_0x536b27['id']}})['then'](function(_0x1a545b){if(!_[_0xc0d9('0x1d')](_0x1a545b)){var _0x17749d=_0x1a545b[_0xc0d9('0x1e')];if(!_['isNil'](_0x17749d)){var _0x478e97=shared[_0xc0d9('0x1f')];var _0x2ede0f=_0x478e97[_0x17749d];var _0x2b3886=_0x478e97[_0x33a591[_0xc0d9('0x1e')]];if(!_['isNil'](_0x2ede0f)&&!_[_0xc0d9('0x1d')](_0x2b3886)){var _0x2c93b7=_0x2ede0f[_0xc0d9('0x20')]-_0x2b3886[_0xc0d9('0x20')];_0x4c226c=_0x33a591[_0xc0d9('0x18')]?_0x33a591[_0xc0d9('0x18')]:moment();var _0x327692=moment(_0x4c226c)[_0xc0d9('0x21')](_0x2c93b7,'minutes');_0x3207ad({'ret':_0x327692['format']('YYYY-MM-DD\x20HH:mm:ss')});}else _0x3207ad({'ret':_0x4c226c});}else _0x3207ad({'ret':_0x4c226c});}else{_0x3207ad({'ret':_0x4c226c});}});}});return 0xa;}var _0xbaf511=function(_0x16751d){return new BPromise(function(_0x336d89,_0x4a0a6e){_0x2c9518(_0x16751d,_0x2a9f36)['then'](function(_0x2389de){_0x2a9f36[_0xc0d9('0x18')]=_0x2389de[_0xc0d9('0x23')];_0x20ba51[_0xc0d9('0x2e')]['findOne']({'where':{'phone':_0x2a9f36[_0xc0d9('0xd')],'CampaignId':_0x16751d['id']}})[_0xc0d9('0x24')](function(_0x593c65){if(!_['isNil'](_0x593c65)){throw new Error(_0xc0d9('0x2a')+_0x2a9f36[_0xc0d9('0xd')]+_0xc0d9('0x32')+_0x16751d['id']);}return _0x20ba51[_0xc0d9('0x2e')]['create']({'phone':_0x2a9f36[_0xc0d9('0xd')],'ContactId':_0x2a9f36['id'],'ListId':_0x2a9f36['ListId'],'priority':_0x2a9f36[_0xc0d9('0x27')]?_0x2a9f36[_0xc0d9('0x27')]:0x2,'scheduledat':_0x2a9f36[_0xc0d9('0x18')]?_0x2a9f36[_0xc0d9('0x18')]:moment()[_0xc0d9('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x2a9f36[_0xc0d9('0x28')]?!![]:![],'callbackuniqueid':_0x2a9f36[_0xc0d9('0x28')]?_0x2a9f36[_0xc0d9('0x28')]:undefined,'callbackat':_0x2a9f36[_0xc0d9('0x28')]?moment()[_0xc0d9('0x19')](_0xc0d9('0x1a')):undefined,'CampaignId':_0x16751d['id']});})['catch'](function(_0x2c03dd){_0x4a0a6e(_0x2c03dd);});});});};var _0x2a149a=function(_0x40834a){return new BPromise(function(_0x37557f,_0x48b914){_0x2c9518(_0x40834a,_0x2a9f36)[_0xc0d9('0x24')](function(_0x7b217c){_0x2a9f36[_0xc0d9('0x18')]=_0x7b217c[_0xc0d9('0x23')];_0x20ba51['CmHopper'][_0xc0d9('0x1c')]({'where':{'phone':_0x2a9f36[_0xc0d9('0xd')],'CampaignId':_0x40834a['id']}})[_0xc0d9('0x24')](function(_0x23249){if(!_['isNil'](_0x23249)){throw new Error(_0xc0d9('0x2a')+_0x2a9f36[_0xc0d9('0xd')]+_0xc0d9('0x33')+_0x40834a['id']);}return _0x20ba51['CmHopperFinal'][_0xc0d9('0x1c')]({'where':{'calleridnum':_0x2a9f36[_0xc0d9('0xd')],'CampaignId':_0x40834a['id']}});})[_0xc0d9('0x24')](function(_0x5b1207){if(!_[_0xc0d9('0x1d')](_0x5b1207)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x2a9f36[_0xc0d9('0xd')]+_0xc0d9('0x34')+_0x40834a['id']);}return _0x20ba51[_0xc0d9('0x2e')]['create']({'phone':_0x2a9f36['phone'],'ContactId':_0x2a9f36['id'],'ListId':_0x2a9f36[_0xc0d9('0x26')],'priority':_0x2a9f36[_0xc0d9('0x27')]?_0x2a9f36[_0xc0d9('0x27')]:0x2,'scheduledat':_0x2a9f36[_0xc0d9('0x18')]?_0x2a9f36[_0xc0d9('0x18')]:moment()['format'](_0xc0d9('0x1a')),'callback':_0x2a9f36[_0xc0d9('0x28')]?!![]:![],'callbackuniqueid':_0x2a9f36[_0xc0d9('0x28')]?_0x2a9f36[_0xc0d9('0x28')]:undefined,'callbackat':_0x2a9f36['callbackUniqueid']?moment()[_0xc0d9('0x19')](_0xc0d9('0x1a')):undefined,'CampaignId':_0x40834a['id']});})[_0xc0d9('0x29')](function(_0x1d4aa9){_0x48b914(_0x1d4aa9);});});});};if(_0x2a9f36['ListId']){_0x20ba51[_0xc0d9('0x1b')]['findAll']({'where':{'type':_0xc0d9('0x35')},'attributes':['id',_0xc0d9('0x36'),_0xc0d9('0x1e')],'include':[{'model':_0x20ba51[_0xc0d9('0x37')],'as':_0xc0d9('0x38'),'where':{'id':_0x2a9f36[_0xc0d9('0x26')]}}]})['then'](function(_0x40d321){if(_0x40d321){var _0x4922f6=[];for(var _0x4a2ca9=0x0,_0x1093d0;_0x4a2ca9<_0x40d321[_0xc0d9('0x39')];_0x4a2ca9+=0x1){_0x1093d0=_0x40d321[_0x4a2ca9]['get']({'plain':!![]});switch(_0x1093d0[_0xc0d9('0x36')]){case _0xc0d9('0x3a'):_0x291f7(_0x1093d0)[_0xc0d9('0x29')](_0x4c7ee0());break;case'onlyIfOpen':_0x1b40e2(_0x1093d0)[_0xc0d9('0x29')](_0x4c7ee0());break;default:_0x2c9518(_0x1093d0,_0x2a9f36)[_0xc0d9('0x24')](function(_0x24da6b){_0x2a9f36[_0xc0d9('0x18')]=_0x24da6b['ret'];_0x20ba51[_0xc0d9('0x2e')][_0xc0d9('0x2f')]({'phone':_0x2a9f36[_0xc0d9('0xd')],'ContactId':_0x2a9f36['id'],'ListId':_0x2a9f36[_0xc0d9('0x26')],'scheduledat':_0x2a9f36[_0xc0d9('0x18')]?_0x2a9f36[_0xc0d9('0x18')]:moment()['format'](_0xc0d9('0x1a')),'priority':_0x2a9f36['priority']?_0x2a9f36[_0xc0d9('0x27')]:0x2,'callback':_0x2a9f36[_0xc0d9('0x28')]?!![]:![],'callbackuniqueid':_0x2a9f36[_0xc0d9('0x28')]?_0x2a9f36[_0xc0d9('0x28')]:undefined,'callbackat':_0x2a9f36['callbackUniqueid']?moment()[_0xc0d9('0x19')](_0xc0d9('0x1a')):undefined,'VoiceQueueId':_0x1093d0['id']})[_0xc0d9('0x29')](_0x4c7ee0());});}}}})[_0xc0d9('0x24')](function(){return _0x20ba51[_0xc0d9('0x1b')]['findAll']({'where':{'type':_0xc0d9('0x35')},'attributes':['id'],'include':[{'model':_0x20ba51[_0xc0d9('0x37')],'as':_0xc0d9('0x3b'),'where':{'id':_0x2a9f36[_0xc0d9('0x26')]}}]})[_0xc0d9('0x24')](function(_0x3ba58e){if(_0x3ba58e){var _0x47c784=[];for(var _0x2d195f=0x0,_0x322a67;_0x2d195f<_0x3ba58e[_0xc0d9('0x39')];_0x2d195f+=0x1){_0x322a67=_0x3ba58e[_0x2d195f][_0xc0d9('0x3c')]({'plain':!![]});_0x20ba51[_0xc0d9('0x3d')][_0xc0d9('0x2f')]({'phone':_0x2a9f36[_0xc0d9('0xd')],'ContactId':_0x2a9f36['id'],'ListId':_0x2a9f36[_0xc0d9('0x26')],'VoiceQueueId':_0x322a67['id']})[_0xc0d9('0x29')](function(_0x1fca56){logger[_0xc0d9('0x15')](_0xc0d9('0x3e'),_0xc0d9('0x17'),_0x1fca56[_0xc0d9('0x3f')]);});}}});})[_0xc0d9('0x24')](function(){return _0x20ba51[_0xc0d9('0x31')][_0xc0d9('0x40')]({'attributes':['id',_0xc0d9('0x36'),'dialTimezone'],'include':[{'model':_0x20ba51['CmList'],'as':_0xc0d9('0x38'),'where':{'id':_0x2a9f36[_0xc0d9('0x26')]}}]})[_0xc0d9('0x24')](function(_0x34ae11){if(_0x34ae11){var _0x269212=[];for(var _0x46085b=0x0,_0x4563b9;_0x46085b<_0x34ae11['length'];_0x46085b+=0x1){_0x4563b9=_0x34ae11[_0x46085b][_0xc0d9('0x3c')]({'plain':!![]});switch(_0x4563b9['dialCheckDuplicateType']){case _0xc0d9('0x3a'):_0x2a149a(_0x4563b9)[_0xc0d9('0x29')](_0x5f4fce());break;case'onlyIfOpen':_0xbaf511(_0x4563b9)[_0xc0d9('0x29')](_0x5f4fce());break;default:_0x20ba51[_0xc0d9('0x2e')]['create']({'phone':_0x2a9f36[_0xc0d9('0xd')],'ContactId':_0x2a9f36['id'],'ListId':_0x2a9f36['ListId'],'scheduledat':_0x2a9f36[_0xc0d9('0x18')]?_0x2a9f36[_0xc0d9('0x18')]:moment()[_0xc0d9('0x19')](_0xc0d9('0x1a')),'priority':_0x2a9f36[_0xc0d9('0x27')]?_0x2a9f36[_0xc0d9('0x27')]:0x2,'callback':_0x2a9f36[_0xc0d9('0x28')]?!![]:![],'callbackuniqueid':_0x2a9f36['callbackUniqueid']?_0x2a9f36[_0xc0d9('0x28')]:undefined,'callbackat':_0x2a9f36[_0xc0d9('0x28')]?moment()[_0xc0d9('0x19')](_0xc0d9('0x1a')):undefined,'CampaignId':_0x4563b9['id']})[_0xc0d9('0x29')](_0x5f4fce());}}}});})['then'](function(){return _0x20ba51[_0xc0d9('0x31')][_0xc0d9('0x40')]({'attributes':['id'],'include':[{'model':_0x20ba51[_0xc0d9('0x37')],'as':_0xc0d9('0x3b'),'where':{'id':_0x2a9f36['ListId']}}]})[_0xc0d9('0x24')](function(_0x331b6f){if(_0x331b6f){var _0x265b92=[];for(var _0x2d6239=0x0,_0xf2054;_0x2d6239<_0x331b6f[_0xc0d9('0x39')];_0x2d6239+=0x1){_0xf2054=_0x331b6f[_0x2d6239][_0xc0d9('0x3c')]({'plain':!![]});_0x20ba51[_0xc0d9('0x3d')][_0xc0d9('0x2f')]({'phone':_0x2a9f36[_0xc0d9('0xd')],'ContactId':_0x2a9f36['id'],'ListId':_0x2a9f36[_0xc0d9('0x26')],'CampaignId':_0xf2054['id']})['catch'](function(_0x91ed3d){logger[_0xc0d9('0x15')](_0xc0d9('0x3e'),_0xc0d9('0x17'),_0x91ed3d[_0xc0d9('0x3f')]);});}}});})[_0xc0d9('0x24')](function(){_0x1c3ef6();})[_0xc0d9('0x29')](function(_0x27f0ba){logger[_0xc0d9('0x15')](_0xc0d9('0x3e'),_0xc0d9('0x17'),_0x27f0ba['message']);_0x1c3ef6(_0x27f0ba);});}else{_0x1c3ef6(new Error('List\x20not\x20found'));}},'afterDestroy':function(_0x55227e,_0x108a1a,_0x31cd0e){var _0x2a36d3=_0x3f0cc0[_0xc0d9('0x41')];var _0x202598=_0x55227e[_0xc0d9('0x3c')]({'plain':!![]});return _0x2a36d3['CmHopper'][_0xc0d9('0x40')]({'raw':!![],'where':{'ListId':_0x202598[_0xc0d9('0x26')],'ContactId':_0x202598['id']}})[_0xc0d9('0x24')](function(_0x5663d6){if(!_[_0xc0d9('0x42')](_0x5663d6)){var _0xe9b978=[];for(var _0x2462ca=0x0;_0x2462ca<_0x5663d6[_0xc0d9('0x39')];_0x2462ca+=0x1){var _0x18bb42=_0x2a36d3['CmHopper'][_0xc0d9('0x43')]({'where':{'ListId':_0x5663d6[_0x2462ca]['ListId'],'ContactId':_0x5663d6[_0x2462ca][_0xc0d9('0x44')],'VoiceQueueId':_0x5663d6[_0x2462ca][_0xc0d9('0x45')],'CampaignId':_0x5663d6[_0x2462ca][_0xc0d9('0x46')]}});_0xe9b978['push'](_0x18bb42);}return BPromise[_0xc0d9('0x47')](_0xe9b978);}})['then'](function(_0x4c8062){logger[_0xc0d9('0x48')](_0xc0d9('0x49'),util[_0xc0d9('0x30')](_0x4c8062,{'showHidden':![],'depth':null}));_0x31cd0e();})[_0xc0d9('0x29')](function(_0x3a4cbd){logger[_0xc0d9('0x15')]('[CmContact][afterDestroy][Error]',util[_0xc0d9('0x30')](_0x3a4cbd,{'showHidden':![],'depth':null}));_0x31cd0e(_0x3a4cbd);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 92db7a1..8234d20 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x3ebcc0,_0xd1b020){var _0x2275e2=function(_0x5526aa){while(--_0x5526aa){_0x3ebcc0['push'](_0x3ebcc0['shift']());}};_0x2275e2(++_0xd1b020);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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 bbfef5d..8517455 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 _0x2333=['INTEGER','STRING','sequelize','exports'];(function(_0x176a21,_0x499cb7){var _0x13c783=function(_0x509193){while(--_0x509193){_0x176a21['push'](_0x176a21['shift']());}};_0x13c783(++_0x499cb7);}(_0x2333,0x11a));var _0x3233=function(_0x246079,_0x10d6c4){_0x246079=_0x246079-0x0;var _0x3e19af=_0x2333[_0x246079];return _0x3e19af;};'use strict';var Sequelize=require(_0x3233('0x0'));module[_0x3233('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x3233('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x3233('0x3')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x3233('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0x3233('0x3')],'defaultValue':null}}; \ No newline at end of file +var _0x851e=['INTEGER','STRING','PHONE','sequelize','exports'];(function(_0xbd3669,_0x329b70){var _0x34f750=function(_0x2a3eb5){while(--_0x2a3eb5){_0xbd3669['push'](_0xbd3669['shift']());}};_0x34f750(++_0x329b70);}(_0x851e,0x1e8));var _0xe851=function(_0x2fe959,_0x351d77){_0x2fe959=_0x2fe959-0x0;var _0x2f6ace=_0x851e[_0x2fe959];return _0x2f6ace;};'use strict';var Sequelize=require(_0xe851('0x0'));module[_0xe851('0x1')]={'CmContactId':{'type':Sequelize[_0xe851('0x2')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xe851('0x3')],'defaultValue':_0xe851('0x4')},'OrderBy':{'type':Sequelize[_0xe851('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0xe851('0x3')],'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 1ec68a4..4b18d73 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 _0xd79f=['params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','get','CmContactHasItems','error','stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','keys','includeAll','find','create','body','user','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x13ca07,_0x561229){var _0x55da62=function(_0x17cd46){while(--_0x17cd46){_0x13ca07['push'](_0x13ca07['shift']());}};_0x55da62(++_0x561229);}(_0xd79f,0x1be));var _0xfd79=function(_0x9aad99,_0x185e28){_0x9aad99=_0x9aad99-0x0;var _0x17a982=_0xd79f[_0x9aad99];return _0x17a982;};'use strict';var emlformat=require(_0xfd79('0x0'));var rimraf=require(_0xfd79('0x1'));var zipdir=require(_0xfd79('0x2'));var jsonpatch=require(_0xfd79('0x3'));var rp=require(_0xfd79('0x4'));var moment=require(_0xfd79('0x5'));var BPromise=require(_0xfd79('0x6'));var Mustache=require(_0xfd79('0x7'));var util=require('util');var path=require(_0xfd79('0x8'));var sox=require(_0xfd79('0x9'));var csv=require(_0xfd79('0xa'));var ejs=require(_0xfd79('0xb'));var fs=require('fs');var fs_extra=require(_0xfd79('0xc'));var _=require(_0xfd79('0xd'));var squel=require(_0xfd79('0xe'));var crypto=require(_0xfd79('0xf'));var jsforce=require(_0xfd79('0x10'));var deskjs=require(_0xfd79('0x11'));var toCsv=require(_0xfd79('0xa'));var querystring=require(_0xfd79('0x12'));var Papa=require(_0xfd79('0x13'));var Redis=require(_0xfd79('0x14'));var authService=require(_0xfd79('0x15'));var qs=require(_0xfd79('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfd79('0x17'));var logger=require(_0xfd79('0x18'))(_0xfd79('0x19'));var utils=require(_0xfd79('0x1a'));var config=require(_0xfd79('0x1b'));var licenseUtil=require(_0xfd79('0x1c'));var db=require(_0xfd79('0x1d'))['db'];function respondWithStatusCode(_0x5ba35c,_0x57fe9b){_0x57fe9b=_0x57fe9b||0xcc;return function(_0x28f821){if(_0x28f821){return _0x5ba35c[_0xfd79('0x1e')](_0x57fe9b);}return _0x5ba35c['status'](_0x57fe9b)[_0xfd79('0x1f')]();};}function respondWithResult(_0x51d9c2,_0x165214){_0x165214=_0x165214||0xc8;return function(_0x385c29){if(_0x385c29){return _0x51d9c2[_0xfd79('0x20')](_0x165214)[_0xfd79('0x21')](_0x385c29);}};}function respondWithFilteredResult(_0x3b4875,_0x410d2a){return function(_0x4a6b83){if(_0x4a6b83){var _0x510af6=typeof _0x410d2a[_0xfd79('0x22')]===_0xfd79('0x23')&&typeof _0x410d2a['limit']==='undefined';var _0x1af47f=_0x4a6b83['count'];var _0x202143=_0x510af6?0x0:_0x410d2a['offset'];var _0x4ca75a=_0x510af6?_0x4a6b83[_0xfd79('0x24')]:_0x410d2a[_0xfd79('0x22')]+_0x410d2a['limit'];var _0x3cc3ad;if(_0x4ca75a>=_0x1af47f){_0x4ca75a=_0x1af47f;_0x3cc3ad=0xc8;}else{_0x3cc3ad=0xce;}_0x3b4875['status'](_0x3cc3ad);return _0x3b4875[_0xfd79('0x25')](_0xfd79('0x26'),_0x202143+'-'+_0x4ca75a+'/'+_0x1af47f)[_0xfd79('0x21')](_0x4a6b83);}return null;};}function patchUpdates(_0x5efc84){return function(_0x306a8d){try{jsonpatch[_0xfd79('0x27')](_0x306a8d,_0x5efc84,!![]);}catch(_0x47a6a6){return BPromise[_0xfd79('0x28')](_0x47a6a6);}return _0x306a8d[_0xfd79('0x29')]();};}function saveUpdates(_0x42c999,_0x3782f1){return function(_0x387cbb){if(_0x387cbb){return _0x387cbb['update'](_0x42c999)[_0xfd79('0x2a')](function(_0x5b3be4){return _0x5b3be4;});}return null;};}function removeEntity(_0x1b42a9,_0x3d59a0){return function(_0x5984a5){if(_0x5984a5){return _0x5984a5[_0xfd79('0x2b')]()['then'](function(){var _0x39a788=_0x5984a5[_0xfd79('0x2c')]({'plain':!![]});var _0x181e62=_0xfd79('0x2d');return db['UserProfileResource']['destroy']({'where':{'type':_0x181e62,'resourceId':_0x39a788['id']}})[_0xfd79('0x2a')](function(){return _0x5984a5;});})['then'](function(){_0x1b42a9[_0xfd79('0x20')](0xcc)[_0xfd79('0x1f')]();});}};}function handleEntityNotFound(_0x3cc6d8,_0x303675){return function(_0x31c528){if(!_0x31c528){_0x3cc6d8['sendStatus'](0x194);}return _0x31c528;};}function handleError(_0x3629a9,_0x55efcd){_0x55efcd=_0x55efcd||0x1f4;return function(_0x22e721){logger[_0xfd79('0x2e')](_0x22e721[_0xfd79('0x2f')]);if(_0x22e721[_0xfd79('0x30')]){delete _0x22e721[_0xfd79('0x30')];}_0x3629a9['status'](_0x55efcd)[_0xfd79('0x31')](_0x22e721);};}exports[_0xfd79('0x32')]=function(_0x1b91d5,_0x38bdcc){var _0x3f56f3={},_0x197b21={},_0x35b8c3={'count':0x0,'rows':[]};var _0x2cea70=_[_0xfd79('0x33')](db[_0xfd79('0x34')][_0xfd79('0x35')],function(_0x11f833){return{'name':_0x11f833[_0xfd79('0x36')],'type':_0x11f833[_0xfd79('0x37')][_0xfd79('0x38')]};});_0x197b21[_0xfd79('0x39')]=_[_0xfd79('0x33')](_0x2cea70,_0xfd79('0x30'));_0x197b21[_0xfd79('0x3a')]=_['keys'](_0x1b91d5[_0xfd79('0x3a')]);_0x197b21['filters']=_[_0xfd79('0x3b')](_0x197b21[_0xfd79('0x39')],_0x197b21[_0xfd79('0x3a')]);_0x3f56f3['attributes']=_[_0xfd79('0x3b')](_0x197b21[_0xfd79('0x39')],qs[_0xfd79('0x3c')](_0x1b91d5[_0xfd79('0x3a')][_0xfd79('0x3c')]));_0x3f56f3[_0xfd79('0x3d')]=_0x3f56f3['attributes']['length']?_0x3f56f3['attributes']:_0x197b21[_0xfd79('0x39')];if(!_0x1b91d5['query'][_0xfd79('0x3e')](_0xfd79('0x3f'))){_0x3f56f3[_0xfd79('0x40')]=qs[_0xfd79('0x40')](_0x1b91d5[_0xfd79('0x3a')][_0xfd79('0x40')]);_0x3f56f3[_0xfd79('0x22')]=qs['offset'](_0x1b91d5[_0xfd79('0x3a')][_0xfd79('0x22')]);}_0x3f56f3[_0xfd79('0x41')]=qs[_0xfd79('0x42')](_0x1b91d5[_0xfd79('0x3a')]['sort']);_0x3f56f3['where']=qs[_0xfd79('0x43')](_[_0xfd79('0x44')](_0x1b91d5[_0xfd79('0x3a')],_0x197b21[_0xfd79('0x43')]),_0x2cea70);if(_0x1b91d5['query'][_0xfd79('0x45')]){_0x3f56f3[_0xfd79('0x46')]=_[_0xfd79('0x47')](_0x3f56f3['where'],{'$or':_['map'](_0x2cea70,function(_0x281bf3){if(_0x281bf3['type']!==_0xfd79('0x48')){var _0x2bf1b6={};_0x2bf1b6[_0x281bf3[_0xfd79('0x30')]]={'$like':'%'+_0x1b91d5[_0xfd79('0x3a')][_0xfd79('0x45')]+'%'};return _0x2bf1b6;}})});}_0x3f56f3=_[_0xfd79('0x47')]({},_0x3f56f3,_0x1b91d5[_0xfd79('0x49')]);var _0x2733e9={'where':_0x3f56f3[_0xfd79('0x46')]};return db['CmContactHasItem'][_0xfd79('0x24')](_0x2733e9)['then'](function(_0x3e0ac5){_0x35b8c3[_0xfd79('0x24')]=_0x3e0ac5;if(_0x1b91d5[_0xfd79('0x3a')]['includeAll']){_0x3f56f3[_0xfd79('0x4a')]=[{'all':!![]}];}return db[_0xfd79('0x34')][_0xfd79('0x4b')](_0x3f56f3);})[_0xfd79('0x2a')](function(_0x4f89ac){_0x35b8c3[_0xfd79('0x4c')]=_0x4f89ac;return _0x35b8c3;})[_0xfd79('0x2a')](respondWithFilteredResult(_0x38bdcc,_0x3f56f3))[_0xfd79('0x4d')](handleError(_0x38bdcc,null));};exports[_0xfd79('0x4e')]=function(_0x3f4e02,_0xea3a61){var _0x2dabc8={'raw':!![],'where':{'id':_0x3f4e02['params']['id']}},_0x2847f3={};_0x2847f3[_0xfd79('0x39')]=_[_0xfd79('0x4f')](db[_0xfd79('0x34')][_0xfd79('0x35')]);_0x2847f3['query']=_[_0xfd79('0x4f')](_0x3f4e02[_0xfd79('0x3a')]);_0x2847f3[_0xfd79('0x43')]=_[_0xfd79('0x3b')](_0x2847f3[_0xfd79('0x39')],_0x2847f3[_0xfd79('0x3a')]);_0x2dabc8[_0xfd79('0x3d')]=_[_0xfd79('0x3b')](_0x2847f3[_0xfd79('0x39')],qs[_0xfd79('0x3c')](_0x3f4e02[_0xfd79('0x3a')][_0xfd79('0x3c')]));_0x2dabc8['attributes']=_0x2dabc8[_0xfd79('0x3d')]['length']?_0x2dabc8['attributes']:_0x2847f3['model'];if(_0x3f4e02['query'][_0xfd79('0x50')]){_0x2dabc8[_0xfd79('0x4a')]=[{'all':!![]}];}_0x2dabc8=_[_0xfd79('0x47')]({},_0x2dabc8,_0x3f4e02[_0xfd79('0x49')]);return db[_0xfd79('0x34')][_0xfd79('0x51')](_0x2dabc8)['then'](handleEntityNotFound(_0xea3a61,null))['then'](respondWithResult(_0xea3a61,null))[_0xfd79('0x4d')](handleError(_0xea3a61,null));};exports[_0xfd79('0x52')]=function(_0x4dbc6c,_0x229c3c){return db[_0xfd79('0x34')]['create'](_0x4dbc6c[_0xfd79('0x53')],{})['then'](function(_0x1610d6){var _0x1d85e4=_0x4dbc6c[_0xfd79('0x54')][_0xfd79('0x2c')]({'plain':!![]});if(!_0x1d85e4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1d85e4['role']===_0xfd79('0x54')){var _0x34ff35=_0x1610d6[_0xfd79('0x2c')]({'plain':!![]});var _0x118f4e=_0xfd79('0x2d');return db[_0xfd79('0x55')][_0xfd79('0x51')]({'where':{'name':_0x118f4e,'userProfileId':_0x1d85e4['userProfileId']},'raw':!![]})[_0xfd79('0x2a')](function(_0x3a0bbe){if(_0x3a0bbe&&_0x3a0bbe['autoAssociation']===0x0){return db[_0xfd79('0x56')][_0xfd79('0x52')]({'name':_0x34ff35[_0xfd79('0x30')],'resourceId':_0x34ff35['id'],'type':_0x3a0bbe['name'],'sectionId':_0x3a0bbe['id']},{})[_0xfd79('0x2a')](function(){return _0x1610d6;});}else{return _0x1610d6;}})['catch'](function(_0x20140f){logger['error'](_0xfd79('0x57'),_0x20140f);throw _0x20140f;});}return _0x1610d6;})[_0xfd79('0x2a')](respondWithResult(_0x229c3c,0xc9))[_0xfd79('0x4d')](handleError(_0x229c3c,null));};exports['update']=function(_0x2ed482,_0x513e62){if(_0x2ed482[_0xfd79('0x53')]['id']){delete _0x2ed482['body']['id'];}return db['CmContactHasItem'][_0xfd79('0x51')]({'where':{'id':_0x2ed482[_0xfd79('0x58')]['id']}})[_0xfd79('0x2a')](handleEntityNotFound(_0x513e62,null))['then'](saveUpdates(_0x2ed482[_0xfd79('0x53')],null))[_0xfd79('0x2a')](respondWithResult(_0x513e62,null))[_0xfd79('0x4d')](handleError(_0x513e62,null));};exports[_0xfd79('0x2b')]=function(_0x45da09,_0x5da5a0){return db[_0xfd79('0x34')][_0xfd79('0x51')]({'where':{'id':_0x45da09['params']['id']}})[_0xfd79('0x2a')](handleEntityNotFound(_0x5da5a0,null))[_0xfd79('0x2a')](removeEntity(_0x5da5a0,null))[_0xfd79('0x4d')](handleError(_0x5da5a0,null));}; \ No newline at end of file +var _0x9e81=['includeAll','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','CmContactHasItems','sendStatus','error','stack','name','send','map','CmContactHasItem','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','findAll','rows','catch','show'];(function(_0x1128cd,_0x3391de){var _0x3b46d8=function(_0x378fd5){while(--_0x378fd5){_0x1128cd['push'](_0x1128cd['shift']());}};_0x3b46d8(++_0x3391de);}(_0x9e81,0x10d));var _0x19e8=function(_0x202438,_0x21f696){_0x202438=_0x202438-0x0;var _0x43a7f1=_0x9e81[_0x202438];return _0x43a7f1;};'use strict';var emlformat=require(_0x19e8('0x0'));var rimraf=require(_0x19e8('0x1'));var zipdir=require(_0x19e8('0x2'));var jsonpatch=require(_0x19e8('0x3'));var rp=require(_0x19e8('0x4'));var moment=require(_0x19e8('0x5'));var BPromise=require(_0x19e8('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x19e8('0x7'));var sox=require(_0x19e8('0x8'));var csv=require(_0x19e8('0x9'));var ejs=require(_0x19e8('0xa'));var fs=require('fs');var fs_extra=require(_0x19e8('0xb'));var _=require(_0x19e8('0xc'));var squel=require(_0x19e8('0xd'));var crypto=require('crypto');var jsforce=require(_0x19e8('0xe'));var deskjs=require(_0x19e8('0xf'));var toCsv=require(_0x19e8('0x9'));var querystring=require('querystring');var Papa=require(_0x19e8('0x10'));var Redis=require(_0x19e8('0x11'));var authService=require(_0x19e8('0x12'));var qs=require(_0x19e8('0x13'));var as=require(_0x19e8('0x14'));var hardwareService=require(_0x19e8('0x15'));var logger=require('../../config/logger')(_0x19e8('0x16'));var utils=require(_0x19e8('0x17'));var config=require(_0x19e8('0x18'));var licenseUtil=require(_0x19e8('0x19'));var db=require(_0x19e8('0x1a'))['db'];function respondWithStatusCode(_0x4b0c9d,_0x4c84f5){_0x4c84f5=_0x4c84f5||0xcc;return function(_0x473fe9){if(_0x473fe9){return _0x4b0c9d['sendStatus'](_0x4c84f5);}return _0x4b0c9d['status'](_0x4c84f5)[_0x19e8('0x1b')]();};}function respondWithResult(_0x3e53ee,_0x282a36){_0x282a36=_0x282a36||0xc8;return function(_0x3b4af1){if(_0x3b4af1){return _0x3e53ee[_0x19e8('0x1c')](_0x282a36)[_0x19e8('0x1d')](_0x3b4af1);}};}function respondWithFilteredResult(_0x3787d7,_0x453d8f){return function(_0x4c2074){if(_0x4c2074){var _0x537098=typeof _0x453d8f[_0x19e8('0x1e')]==='undefined'&&typeof _0x453d8f['limit']===_0x19e8('0x1f');var _0x51638b=_0x4c2074[_0x19e8('0x20')];var _0x515128=_0x537098?0x0:_0x453d8f[_0x19e8('0x1e')];var _0x1620ba=_0x537098?_0x4c2074[_0x19e8('0x20')]:_0x453d8f[_0x19e8('0x1e')]+_0x453d8f[_0x19e8('0x21')];var _0x2456db;if(_0x1620ba>=_0x51638b){_0x1620ba=_0x51638b;_0x2456db=0xc8;}else{_0x2456db=0xce;}_0x3787d7[_0x19e8('0x1c')](_0x2456db);return _0x3787d7[_0x19e8('0x22')](_0x19e8('0x23'),_0x515128+'-'+_0x1620ba+'/'+_0x51638b)[_0x19e8('0x1d')](_0x4c2074);}return null;};}function patchUpdates(_0x31564f){return function(_0xc03156){try{jsonpatch[_0x19e8('0x24')](_0xc03156,_0x31564f,!![]);}catch(_0x274e4c){return BPromise[_0x19e8('0x25')](_0x274e4c);}return _0xc03156[_0x19e8('0x26')]();};}function saveUpdates(_0x3f37c7,_0xd5e181){return function(_0x3b1ede){if(_0x3b1ede){return _0x3b1ede[_0x19e8('0x27')](_0x3f37c7)[_0x19e8('0x28')](function(_0x153bfd){return _0x153bfd;});}return null;};}function removeEntity(_0x2a33d0,_0x5f185b){return function(_0x423938){if(_0x423938){return _0x423938[_0x19e8('0x29')]()['then'](function(){var _0x220632=_0x423938[_0x19e8('0x2a')]({'plain':!![]});var _0x234de3=_0x19e8('0x2b');return db['UserProfileResource'][_0x19e8('0x29')]({'where':{'type':_0x234de3,'resourceId':_0x220632['id']}})['then'](function(){return _0x423938;});})[_0x19e8('0x28')](function(){_0x2a33d0[_0x19e8('0x1c')](0xcc)[_0x19e8('0x1b')]();});}};}function handleEntityNotFound(_0x535b1a,_0xef2b04){return function(_0x5c40de){if(!_0x5c40de){_0x535b1a[_0x19e8('0x2c')](0x194);}return _0x5c40de;};}function handleError(_0x345d14,_0x4c67e2){_0x4c67e2=_0x4c67e2||0x1f4;return function(_0x1a9ab7){logger[_0x19e8('0x2d')](_0x1a9ab7[_0x19e8('0x2e')]);if(_0x1a9ab7[_0x19e8('0x2f')]){delete _0x1a9ab7[_0x19e8('0x2f')];}_0x345d14[_0x19e8('0x1c')](_0x4c67e2)[_0x19e8('0x30')](_0x1a9ab7);};}exports['index']=function(_0x3ec2ff,_0x2614dd){var _0x2a70fe={},_0x369ed6={},_0x2ea0ff={'count':0x0,'rows':[]};var _0x5a9756=_[_0x19e8('0x31')](db[_0x19e8('0x32')][_0x19e8('0x33')],function(_0x53f738){return{'name':_0x53f738[_0x19e8('0x34')],'type':_0x53f738[_0x19e8('0x35')]['key']};});_0x369ed6[_0x19e8('0x36')]=_[_0x19e8('0x31')](_0x5a9756,_0x19e8('0x2f'));_0x369ed6[_0x19e8('0x37')]=_[_0x19e8('0x38')](_0x3ec2ff[_0x19e8('0x37')]);_0x369ed6['filters']=_[_0x19e8('0x39')](_0x369ed6[_0x19e8('0x36')],_0x369ed6[_0x19e8('0x37')]);_0x2a70fe[_0x19e8('0x3a')]=_[_0x19e8('0x39')](_0x369ed6['model'],qs[_0x19e8('0x3b')](_0x3ec2ff[_0x19e8('0x37')][_0x19e8('0x3b')]));_0x2a70fe[_0x19e8('0x3a')]=_0x2a70fe[_0x19e8('0x3a')][_0x19e8('0x3c')]?_0x2a70fe[_0x19e8('0x3a')]:_0x369ed6[_0x19e8('0x36')];if(!_0x3ec2ff[_0x19e8('0x37')][_0x19e8('0x3d')](_0x19e8('0x3e'))){_0x2a70fe['limit']=qs[_0x19e8('0x21')](_0x3ec2ff[_0x19e8('0x37')]['limit']);_0x2a70fe[_0x19e8('0x1e')]=qs[_0x19e8('0x1e')](_0x3ec2ff[_0x19e8('0x37')][_0x19e8('0x1e')]);}_0x2a70fe[_0x19e8('0x3f')]=qs[_0x19e8('0x40')](_0x3ec2ff[_0x19e8('0x37')][_0x19e8('0x40')]);_0x2a70fe[_0x19e8('0x41')]=qs[_0x19e8('0x42')](_[_0x19e8('0x43')](_0x3ec2ff[_0x19e8('0x37')],_0x369ed6[_0x19e8('0x42')]),_0x5a9756);if(_0x3ec2ff[_0x19e8('0x37')][_0x19e8('0x44')]){_0x2a70fe[_0x19e8('0x41')]=_['merge'](_0x2a70fe['where'],{'$or':_[_0x19e8('0x31')](_0x5a9756,function(_0x1b8501){if(_0x1b8501[_0x19e8('0x35')]!==_0x19e8('0x45')){var _0x394e08={};_0x394e08[_0x1b8501['name']]={'$like':'%'+_0x3ec2ff[_0x19e8('0x37')][_0x19e8('0x44')]+'%'};return _0x394e08;}})});}_0x2a70fe=_['merge']({},_0x2a70fe,_0x3ec2ff[_0x19e8('0x46')]);var _0x3dd7c1={'where':_0x2a70fe[_0x19e8('0x41')]};return db['CmContactHasItem']['count'](_0x3dd7c1)[_0x19e8('0x28')](function(_0x103302){_0x2ea0ff[_0x19e8('0x20')]=_0x103302;if(_0x3ec2ff[_0x19e8('0x37')]['includeAll']){_0x2a70fe['include']=[{'all':!![]}];}return db[_0x19e8('0x32')][_0x19e8('0x47')](_0x2a70fe);})[_0x19e8('0x28')](function(_0x2136b3){_0x2ea0ff[_0x19e8('0x48')]=_0x2136b3;return _0x2ea0ff;})['then'](respondWithFilteredResult(_0x2614dd,_0x2a70fe))[_0x19e8('0x49')](handleError(_0x2614dd,null));};exports[_0x19e8('0x4a')]=function(_0x5ec1ca,_0x8d34aa){var _0x5aff19={'raw':!![],'where':{'id':_0x5ec1ca['params']['id']}},_0x4173f0={};_0x4173f0[_0x19e8('0x36')]=_[_0x19e8('0x38')](db['CmContactHasItem'][_0x19e8('0x33')]);_0x4173f0[_0x19e8('0x37')]=_[_0x19e8('0x38')](_0x5ec1ca[_0x19e8('0x37')]);_0x4173f0[_0x19e8('0x42')]=_['intersection'](_0x4173f0[_0x19e8('0x36')],_0x4173f0['query']);_0x5aff19[_0x19e8('0x3a')]=_[_0x19e8('0x39')](_0x4173f0['model'],qs['fields'](_0x5ec1ca[_0x19e8('0x37')][_0x19e8('0x3b')]));_0x5aff19[_0x19e8('0x3a')]=_0x5aff19['attributes']['length']?_0x5aff19[_0x19e8('0x3a')]:_0x4173f0[_0x19e8('0x36')];if(_0x5ec1ca[_0x19e8('0x37')][_0x19e8('0x4b')]){_0x5aff19['include']=[{'all':!![]}];}_0x5aff19=_[_0x19e8('0x4c')]({},_0x5aff19,_0x5ec1ca['options']);return db[_0x19e8('0x32')]['find'](_0x5aff19)[_0x19e8('0x28')](handleEntityNotFound(_0x8d34aa,null))[_0x19e8('0x28')](respondWithResult(_0x8d34aa,null))['catch'](handleError(_0x8d34aa,null));};exports[_0x19e8('0x4d')]=function(_0x23a7e2,_0x591217){return db['CmContactHasItem']['create'](_0x23a7e2[_0x19e8('0x4e')],{})[_0x19e8('0x28')](function(_0x5d229d){var _0x1869ff=_0x23a7e2[_0x19e8('0x4f')][_0x19e8('0x2a')]({'plain':!![]});if(!_0x1869ff)throw new Error(_0x19e8('0x50'));if(_0x1869ff['role']===_0x19e8('0x4f')){var _0x52e568=_0x5d229d[_0x19e8('0x2a')]({'plain':!![]});var _0x256da4=_0x19e8('0x2b');return db[_0x19e8('0x51')]['find']({'where':{'name':_0x256da4,'userProfileId':_0x1869ff['userProfileId']},'raw':!![]})[_0x19e8('0x28')](function(_0x842d08){if(_0x842d08&&_0x842d08[_0x19e8('0x52')]===0x0){return db[_0x19e8('0x53')][_0x19e8('0x4d')]({'name':_0x52e568[_0x19e8('0x2f')],'resourceId':_0x52e568['id'],'type':_0x842d08[_0x19e8('0x2f')],'sectionId':_0x842d08['id']},{})[_0x19e8('0x28')](function(){return _0x5d229d;});}else{return _0x5d229d;}})['catch'](function(_0x2491bb){logger[_0x19e8('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2491bb);throw _0x2491bb;});}return _0x5d229d;})[_0x19e8('0x28')](respondWithResult(_0x591217,0xc9))[_0x19e8('0x49')](handleError(_0x591217,null));};exports[_0x19e8('0x27')]=function(_0x4094b6,_0x5f122d){if(_0x4094b6[_0x19e8('0x4e')]['id']){delete _0x4094b6[_0x19e8('0x4e')]['id'];}return db['CmContactHasItem'][_0x19e8('0x54')]({'where':{'id':_0x4094b6[_0x19e8('0x55')]['id']}})[_0x19e8('0x28')](handleEntityNotFound(_0x5f122d,null))[_0x19e8('0x28')](saveUpdates(_0x4094b6[_0x19e8('0x4e')],null))[_0x19e8('0x28')](respondWithResult(_0x5f122d,null))[_0x19e8('0x49')](handleError(_0x5f122d,null));};exports[_0x19e8('0x29')]=function(_0x59891d,_0x169f3d){return db[_0x19e8('0x32')]['find']({'where':{'id':_0x59891d['params']['id']}})[_0x19e8('0x28')](handleEntityNotFound(_0x169f3d,null))[_0x19e8('0x28')](removeEntity(_0x169f3d,null))['catch'](handleError(_0x169f3d,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index b7eb768..644bd7a 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 _0x33dd=['rimraf','./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items','lodash','util','api','bluebird','request-promise','path'];(function(_0x46c8ec,_0x246ea4){var _0x47e1cf=function(_0x4d7827){while(--_0x4d7827){_0x46c8ec['push'](_0x46c8ec['shift']());}};_0x47e1cf(++_0x246ea4);}(_0x33dd,0xc6));var _0xd33d=function(_0x2c4003,_0x4c6491){_0x2c4003=_0x2c4003-0x0;var _0x4ffbbc=_0x33dd[_0x2c4003];return _0x4ffbbc;};'use strict';var _=require(_0xd33d('0x0'));var util=require(_0xd33d('0x1'));var logger=require('../../config/logger')(_0xd33d('0x2'));var moment=require('moment');var BPromise=require(_0xd33d('0x3'));var rp=require(_0xd33d('0x4'));var fs=require('fs');var path=require(_0xd33d('0x5'));var rimraf=require(_0xd33d('0x6'));var config=require('../../config/environment');var attributes=require(_0xd33d('0x7'));module[_0xd33d('0x8')]=function(_0xea8798,_0x3a6fe1){return _0xea8798[_0xd33d('0x9')](_0xd33d('0xa'),attributes,{'tableName':_0xd33d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbcd6=['define','cm_contact_has_items','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./cmContactHasItem.attributes','exports'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xbcd6,0x70));var _0x6bcd=function(_0xeebc72,_0x38d608){_0xeebc72=_0xeebc72-0x0;var _0x4d6857=_0xbcd6[_0xeebc72];return _0x4d6857;};'use strict';var _=require('lodash');var util=require(_0x6bcd('0x0'));var logger=require(_0x6bcd('0x1'))('api');var moment=require('moment');var BPromise=require(_0x6bcd('0x2'));var rp=require(_0x6bcd('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6bcd('0x4'));var config=require(_0x6bcd('0x5'));var attributes=require(_0x6bcd('0x6'));module[_0x6bcd('0x7')]=function(_0x37a995,_0x181d82){return _0x37a995[_0x6bcd('0x8')]('CmContactHasItem',attributes,{'tableName':_0x6bcd('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 e0a62cb..c068736 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 _0x6a3f=['message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','error'];(function(_0x49df11,_0x1e03c2){var _0x118e85=function(_0x4c3bce){while(--_0x4c3bce){_0x49df11['push'](_0x49df11['shift']());}};_0x118e85(++_0x1e03c2);}(_0x6a3f,0x136));var _0xf6a3=function(_0x269ef0,_0x2c1b3f){_0x269ef0=_0x269ef0-0x0;var _0xf4a624=_0x6a3f[_0x269ef0];return _0xf4a624;};'use strict';var _=require(_0xf6a3('0x0'));var util=require('util');var moment=require(_0xf6a3('0x1'));var BPromise=require(_0xf6a3('0x2'));var rs=require(_0xf6a3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf6a3('0x4'))['db'];var utils=require(_0xf6a3('0x5'));var logger=require(_0xf6a3('0x6'))(_0xf6a3('0x7'));var config=require(_0xf6a3('0x8'));var jayson=require(_0xf6a3('0x9'));var client=jayson[_0xf6a3('0xa')][_0xf6a3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33ac91,_0x3c0e78,_0x261ea6){return new BPromise(function(_0x2544db,_0x230381){return client[_0xf6a3('0xc')](_0x33ac91,_0x261ea6)[_0xf6a3('0xd')](function(_0x1e58c0){logger[_0xf6a3('0xe')](_0xf6a3('0xf'),_0x3c0e78,_0xf6a3('0x10'));logger[_0xf6a3('0x11')](_0xf6a3('0x12'),_0x3c0e78,_0xf6a3('0x10'),JSON['stringify'](_0x1e58c0));if(_0x1e58c0[_0xf6a3('0x13')]){if(_0x1e58c0[_0xf6a3('0x13')]['code']===0x1f4){logger[_0xf6a3('0x13')]('CmContactHasItem,\x20%s,\x20%s',_0x3c0e78,_0x1e58c0[_0xf6a3('0x13')]['message']);return _0x230381(_0x1e58c0['error'][_0xf6a3('0x14')]);}logger['error'](_0xf6a3('0xf'),_0x3c0e78,_0x1e58c0[_0xf6a3('0x13')][_0xf6a3('0x14')]);return _0x2544db(_0x1e58c0[_0xf6a3('0x13')][_0xf6a3('0x14')]);}else{logger[_0xf6a3('0xe')](_0xf6a3('0xf'),_0x3c0e78,_0xf6a3('0x10'));_0x2544db(_0x1e58c0[_0xf6a3('0x15')][_0xf6a3('0x14')]);}})['catch'](function(_0x21bcad){logger[_0xf6a3('0x13')](_0xf6a3('0xf'),_0x3c0e78,_0x21bcad);_0x230381(_0x21bcad);});});} \ No newline at end of file +var _0x850b=['debug','request\x20sent','stringify','error','message','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmContactHasItem,\x20%s,\x20%s'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x850b,0x84));var _0xb850=function(_0x19c64d,_0x5882d8){_0x19c64d=_0x19c64d-0x0;var _0x38430d=_0x850b[_0x19c64d];return _0x38430d;};'use strict';var _=require(_0xb850('0x0'));var util=require(_0xb850('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb850('0x2'));var fs=require('fs');var Redis=require(_0xb850('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb850('0x4'));var logger=require(_0xb850('0x5'))(_0xb850('0x6'));var config=require(_0xb850('0x7'));var jayson=require(_0xb850('0x8'));var client=jayson[_0xb850('0x9')][_0xb850('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ce374,_0x5dca0d,_0x427be1){return new BPromise(function(_0x171d76,_0xffa52){return client[_0xb850('0xb')](_0x1ce374,_0x427be1)[_0xb850('0xc')](function(_0x4d588f){logger[_0xb850('0xd')](_0xb850('0xe'),_0x5dca0d,'request\x20sent');logger[_0xb850('0xf')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x5dca0d,_0xb850('0x10'),JSON[_0xb850('0x11')](_0x4d588f));if(_0x4d588f[_0xb850('0x12')]){if(_0x4d588f[_0xb850('0x12')]['code']===0x1f4){logger[_0xb850('0x12')](_0xb850('0xe'),_0x5dca0d,_0x4d588f[_0xb850('0x12')][_0xb850('0x13')]);return _0xffa52(_0x4d588f[_0xb850('0x12')][_0xb850('0x13')]);}logger[_0xb850('0x12')](_0xb850('0xe'),_0x5dca0d,_0x4d588f[_0xb850('0x12')][_0xb850('0x13')]);return _0x171d76(_0x4d588f['error'][_0xb850('0x13')]);}else{logger['info'](_0xb850('0xe'),_0x5dca0d,_0xb850('0x10'));_0x171d76(_0x4d588f['result'][_0xb850('0x13')]);}})[_0xb850('0x14')](function(_0xe339b4){logger[_0xb850('0x12')](_0xb850('0xe'),_0x5dca0d,_0xe339b4);_0xffa52(_0xe339b4);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index ab3afa2..5f4638d 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 _0xb67b=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','create','put','update','delete','destroy','multer','path','connect-timeout','express','Router'];(function(_0x48d6d9,_0x442b28){var _0x582073=function(_0x1fdf57){while(--_0x1fdf57){_0x48d6d9['push'](_0x48d6d9['shift']());}};_0x582073(++_0x442b28);}(_0xb67b,0x1f3));var _0xbb67=function(_0x38c652,_0x1ea1b7){_0x38c652=_0x38c652-0x0;var _0x218a37=_0xb67b[_0x38c652];return _0x218a37;};'use strict';var multer=require(_0xbb67('0x0'));var util=require('util');var path=require(_0xbb67('0x1'));var timeout=require(_0xbb67('0x2'));var express=require(_0xbb67('0x3'));var router=express[_0xbb67('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbb67('0x5'));var interaction=require(_0xbb67('0x6'));var config=require(_0xbb67('0x7'));var controller=require(_0xbb67('0x8'));router[_0xbb67('0x9')]('/',auth[_0xbb67('0xa')](),controller[_0xbb67('0xb')]);router['get'](_0xbb67('0xc'),auth[_0xbb67('0xa')](),controller['show']);router['post']('/',auth[_0xbb67('0xa')](),controller[_0xbb67('0xd')]);router[_0xbb67('0xe')](_0xbb67('0xc'),auth[_0xbb67('0xa')](),controller[_0xbb67('0xf')]);router[_0xbb67('0x10')](_0xbb67('0xc'),auth[_0xbb67('0xa')](),controller[_0xbb67('0x11')]);module['exports']=router; \ No newline at end of file +var _0xd4ca=['update','delete','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','create','put','/:id'];(function(_0x33d73d,_0x33a4ab){var _0x1d8fd0=function(_0xec3916){while(--_0xec3916){_0x33d73d['push'](_0x33d73d['shift']());}};_0x1d8fd0(++_0x33a4ab);}(_0xd4ca,0x19b));var _0xad4c=function(_0x3dd1f7,_0x141a06){_0x3dd1f7=_0x3dd1f7-0x0;var _0x2c8493=_0xd4ca[_0x3dd1f7];return _0x2c8493;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xad4c('0x0'));var express=require(_0xad4c('0x1'));var router=express[_0xad4c('0x2')]();var fs_extra=require(_0xad4c('0x3'));var auth=require(_0xad4c('0x4'));var interaction=require(_0xad4c('0x5'));var config=require(_0xad4c('0x6'));var controller=require('./cmContactHasItem.controller');router['get']('/',auth[_0xad4c('0x7')](),controller[_0xad4c('0x8')]);router[_0xad4c('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xad4c('0xa')]);router['post']('/',auth[_0xad4c('0x7')](),controller[_0xad4c('0xb')]);router[_0xad4c('0xc')](_0xad4c('0xd'),auth[_0xad4c('0x7')](),controller[_0xad4c('0xe')]);router[_0xad4c('0xf')](_0xad4c('0xd'),auth[_0xad4c('0x7')](),controller['destroy']);module[_0xad4c('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index c697f0e..6695eaf 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 _0xe6cb=['getDataValue','alias','STRING','setDataValue','name','TEXT','long','values','isArray','stringify','BOOLEAN','ENUM','lodash','VIRTUAL'];(function(_0x5d2b42,_0x55e868){var _0x35bd4d=function(_0x2bc808){while(--_0x2bc808){_0x5d2b42['push'](_0x5d2b42['shift']());}};_0x35bd4d(++_0x55e868);}(_0xe6cb,0x7c));var _0xbe6c=function(_0x8da039,_0x208539){_0x8da039=_0x8da039-0x0;var _0x4831ae=_0xe6cb[_0x8da039];return _0x4831ae;};'use strict';var Sequelize=require('sequelize');var _=require(_0xbe6c('0x0'));module['exports']={'name':{'type':Sequelize[_0xbe6c('0x1')],'get':function(_0x3fb22e){return this[_0xbe6c('0x2')](_0xbe6c('0x3'));}},'alias':{'type':Sequelize[_0xbe6c('0x4')],'allowNull':![],'set':function(_0x474b6c){this[_0xbe6c('0x5')](_0xbe6c('0x3'),_0x474b6c?_0x474b6c:this['getDataValue'](_0xbe6c('0x6')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0xbe6c('0x7')](_0xbe6c('0x8')),'get':function(){if(this[_0xbe6c('0x2')]('type')==='select'){return JSON['parse'](this[_0xbe6c('0x2')](_0xbe6c('0x9')));}else{return this['getDataValue']('values');}},'set':function(_0x5d9f25){if(Array[_0xbe6c('0xa')](_0x5d9f25)){this[_0xbe6c('0x5')](_0xbe6c('0x9'),JSON[_0xbe6c('0xb')](_0x5d9f25));}else{this[_0xbe6c('0x5')](_0xbe6c('0x9'),_0x5d9f25);}}},'required':{'type':Sequelize[_0xbe6c('0xc')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0xbe6c('0xd')]('voice')}}; \ No newline at end of file +var _0x4c79=['values','isArray','BOOLEAN','ENUM','sequelize','lodash','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','TEXT','long','select','parse'];(function(_0x12a758,_0x471242){var _0x2b709a=function(_0x5eb311){while(--_0x5eb311){_0x12a758['push'](_0x12a758['shift']());}};_0x2b709a(++_0x471242);}(_0x4c79,0x174));var _0x94c7=function(_0x494e72,_0x5f1178){_0x494e72=_0x494e72-0x0;var _0x2d3947=_0x4c79[_0x494e72];return _0x2d3947;};'use strict';var Sequelize=require(_0x94c7('0x0'));var _=require(_0x94c7('0x1'));module['exports']={'name':{'type':Sequelize[_0x94c7('0x2')],'get':function(_0x5997a0){return this[_0x94c7('0x3')](_0x94c7('0x4'));}},'alias':{'type':Sequelize[_0x94c7('0x5')],'allowNull':![],'set':function(_0x414606){this[_0x94c7('0x6')](_0x94c7('0x4'),_0x414606?_0x414606:this['getDataValue'](_0x94c7('0x7')));}},'type':{'type':Sequelize[_0x94c7('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0x94c7('0x8')](_0x94c7('0x9')),'get':function(){if(this[_0x94c7('0x3')]('type')===_0x94c7('0xa')){return JSON[_0x94c7('0xb')](this[_0x94c7('0x3')](_0x94c7('0xc')));}else{return this[_0x94c7('0x3')]('values');}},'set':function(_0x164df6){if(Array[_0x94c7('0xd')](_0x164df6)){this[_0x94c7('0x6')](_0x94c7('0xc'),JSON['stringify'](_0x164df6));}else{this[_0x94c7('0x6')](_0x94c7('0xc'),_0x164df6);}}},'required':{'type':Sequelize[_0x94c7('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x94c7('0xf')]('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index c5475e9..6cd2a58 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 _0x821e=['cm_contacts','cf_%d','rimraf','zip-dir','fast-json-patch','request-promise','moment','to-csv','ejs','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','stack','send','index','rawAttributes','fieldName','type','model','differenceBy','map','name','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','options','CmCustomField','include','rows','show','keys','includeAll','find','catch','update','body','params','create','sequelize','transaction','Sequelize','TEXT','switch','BOOLEAN','addColumn'];(function(_0x399dda,_0x49aaea){var _0x5b93cc=function(_0x2156e0){while(--_0x2156e0){_0x399dda['push'](_0x399dda['shift']());}};_0x5b93cc(++_0x49aaea);}(_0x821e,0xa0));var _0xe821=function(_0x211bc3,_0x5860c8){_0x211bc3=_0x211bc3-0x0;var _0x34c9a2=_0x821e[_0x211bc3];return _0x34c9a2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe821('0x0'));var zipdir=require(_0xe821('0x1'));var jsonpatch=require(_0xe821('0x2'));var rp=require(_0xe821('0x3'));var moment=require(_0xe821('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xe821('0x5'));var ejs=require(_0xe821('0x6'));var fs=require('fs');var fs_extra=require(_0xe821('0x7'));var _=require('lodash');var squel=require(_0xe821('0x8'));var crypto=require(_0xe821('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xe821('0xa'));var toCsv=require(_0xe821('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe821('0xb'));var authService=require(_0xe821('0xc'));var qs=require(_0xe821('0xd'));var as=require(_0xe821('0xe'));var hardwareService=require(_0xe821('0xf'));var logger=require(_0xe821('0x10'))(_0xe821('0x11'));var utils=require(_0xe821('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xe821('0x13'));var db=require(_0xe821('0x14'))['db'];function respondWithStatusCode(_0x2d8c8e,_0x1aac8d){_0x1aac8d=_0x1aac8d||0xcc;return function(_0x59f1cd){if(_0x59f1cd){return _0x2d8c8e['sendStatus'](_0x1aac8d);}return _0x2d8c8e[_0xe821('0x15')](_0x1aac8d)[_0xe821('0x16')]();};}function respondWithResult(_0x35078c,_0x5b9e2d){_0x5b9e2d=_0x5b9e2d||0xc8;return function(_0x585e5b){if(_0x585e5b){return _0x35078c['status'](_0x5b9e2d)[_0xe821('0x17')](_0x585e5b);}};}function respondWithFilteredResult(_0x50b9ac,_0x193b10){return function(_0x565964){if(_0x565964){var _0x2b5162=typeof _0x193b10[_0xe821('0x18')]===_0xe821('0x19')&&typeof _0x193b10[_0xe821('0x1a')]===_0xe821('0x19');var _0x34c084=_0x565964[_0xe821('0x1b')];var _0x3e8f3c=_0x2b5162?0x0:_0x193b10['offset'];var _0x1f688b=_0x2b5162?_0x565964[_0xe821('0x1b')]:_0x193b10[_0xe821('0x18')]+_0x193b10['limit'];var _0x43d29b;if(_0x1f688b>=_0x34c084){_0x1f688b=_0x34c084;_0x43d29b=0xc8;}else{_0x43d29b=0xce;}_0x50b9ac['status'](_0x43d29b);return _0x50b9ac[_0xe821('0x1c')](_0xe821('0x1d'),_0x3e8f3c+'-'+_0x1f688b+'/'+_0x34c084)['json'](_0x565964);}return null;};}function patchUpdates(_0x5dec8e){return function(_0x826de4){try{jsonpatch[_0xe821('0x1e')](_0x826de4,_0x5dec8e,!![]);}catch(_0x3088b3){return BPromise['reject'](_0x3088b3);}return _0x826de4[_0xe821('0x1f')]();};}function saveUpdates(_0x39847f,_0x53d00b){return function(_0x1e0120){if(_0x1e0120){return _0x1e0120['update'](_0x39847f)[_0xe821('0x20')](function(_0x51d311){return _0x51d311;});}return null;};}function removeEntity(_0x308ddb,_0x16f491){return function(_0x5a0bcd){if(_0x5a0bcd){return _0x5a0bcd[_0xe821('0x21')]()['then'](function(){_0x308ddb[_0xe821('0x15')](0xcc)[_0xe821('0x16')]();});}};}function handleEntityNotFound(_0x161ec2,_0x20a071){return function(_0x28f13d){if(!_0x28f13d){_0x161ec2[_0xe821('0x22')](0x194);}return _0x28f13d;};}function handleError(_0x50384a,_0x34f820){_0x34f820=_0x34f820||0x1f4;return function(_0x5b6977){logger['error'](_0x5b6977[_0xe821('0x23')]);if(_0x5b6977['name']){delete _0x5b6977['name'];}_0x50384a[_0xe821('0x15')](_0x34f820)[_0xe821('0x24')](_0x5b6977);};}exports[_0xe821('0x25')]=function(_0x3decb4,_0x50da6e){var _0x2d9198={},_0x330f46={},_0x4a3d09={'count':0x0,'rows':[]};var _0x485305=_['map'](db['CmCustomField'][_0xe821('0x26')],function(_0x6829ef){return{'name':_0x6829ef[_0xe821('0x27')],'type':_0x6829ef[_0xe821('0x28')]['key']};});_0x330f46[_0xe821('0x29')]=_[_0xe821('0x2a')](_[_0xe821('0x2b')](_0x485305,_0xe821('0x2c')),[_0xe821('0x2c')]);_0x330f46['query']=_['keys'](_0x3decb4[_0xe821('0x2d')]);_0x330f46['filters']=_[_0xe821('0x2e')](_0x330f46['model'],_0x330f46[_0xe821('0x2d')]);_0x2d9198[_0xe821('0x2f')]=_[_0xe821('0x2e')](_0x330f46[_0xe821('0x29')],qs[_0xe821('0x30')](_0x3decb4[_0xe821('0x2d')][_0xe821('0x30')]));_0x2d9198[_0xe821('0x2f')]=_0x2d9198['attributes'][_0xe821('0x31')]?_0x2d9198[_0xe821('0x2f')]:_0x330f46[_0xe821('0x29')];if(!_0x3decb4[_0xe821('0x2d')][_0xe821('0x32')]('nolimit')){_0x2d9198[_0xe821('0x1a')]=qs[_0xe821('0x1a')](_0x3decb4[_0xe821('0x2d')][_0xe821('0x1a')]);_0x2d9198[_0xe821('0x18')]=qs['offset'](_0x3decb4[_0xe821('0x2d')][_0xe821('0x18')]);}_0x2d9198[_0xe821('0x33')]=qs['sort'](_0x3decb4['query'][_0xe821('0x34')]);_0x2d9198[_0xe821('0x35')]=qs[_0xe821('0x36')](_['pick'](_0x3decb4[_0xe821('0x2d')],_0x330f46[_0xe821('0x36')]),_0x485305);if(_0x3decb4['query'][_0xe821('0x37')]){_0x2d9198['where']=_[_0xe821('0x38')](_0x2d9198[_0xe821('0x35')],{'$or':_[_0xe821('0x2b')](_0x485305,function(_0x23acb4){if(_0x23acb4[_0xe821('0x28')]!=='VIRTUAL'){var _0x40c60e={};_0x40c60e[_0x23acb4[_0xe821('0x2c')]]={'$like':'%'+_0x3decb4[_0xe821('0x2d')][_0xe821('0x37')]+'%'};return _0x40c60e;}})});}_0x2d9198=_[_0xe821('0x38')]({},_0x2d9198,_0x3decb4[_0xe821('0x39')]);var _0x4eb5b5={'where':_0x2d9198['where']};return db[_0xe821('0x3a')][_0xe821('0x1b')](_0x4eb5b5)['then'](function(_0x38eb4b){_0x4a3d09[_0xe821('0x1b')]=_0x38eb4b;if(_0x3decb4[_0xe821('0x2d')]['includeAll']){_0x2d9198[_0xe821('0x3b')]=[{'all':!![]}];}return db[_0xe821('0x3a')]['findAll'](_0x2d9198);})[_0xe821('0x20')](function(_0x2ecccc){_0x4a3d09[_0xe821('0x3c')]=_0x2ecccc;return _0x4a3d09;})[_0xe821('0x20')](respondWithFilteredResult(_0x50da6e,_0x2d9198))['catch'](handleError(_0x50da6e,null));};exports[_0xe821('0x3d')]=function(_0x5e26e6,_0xc145ee){var _0x26a9e0={'raw':!![],'where':{'id':_0x5e26e6['params']['id']}},_0x21d888={};_0x21d888[_0xe821('0x29')]=_[_0xe821('0x3e')](db[_0xe821('0x3a')][_0xe821('0x26')]);_0x21d888[_0xe821('0x2d')]=_[_0xe821('0x3e')](_0x5e26e6['query']);_0x21d888['filters']=_[_0xe821('0x2e')](_0x21d888[_0xe821('0x29')],_0x21d888[_0xe821('0x2d')]);_0x26a9e0[_0xe821('0x2f')]=_[_0xe821('0x2e')](_0x21d888[_0xe821('0x29')],qs[_0xe821('0x30')](_0x5e26e6[_0xe821('0x2d')][_0xe821('0x30')]));_0x26a9e0['attributes']=_0x26a9e0[_0xe821('0x2f')]['length']?_0x26a9e0[_0xe821('0x2f')]:_0x21d888[_0xe821('0x29')];if(_0x5e26e6['query'][_0xe821('0x3f')]){_0x26a9e0[_0xe821('0x3b')]=[{'all':!![]}];}_0x26a9e0=_[_0xe821('0x38')]({},_0x26a9e0,_0x5e26e6[_0xe821('0x39')]);return db['CmCustomField'][_0xe821('0x40')](_0x26a9e0)[_0xe821('0x20')](handleEntityNotFound(_0xc145ee,null))[_0xe821('0x20')](respondWithResult(_0xc145ee,null))[_0xe821('0x41')](handleError(_0xc145ee,null));};exports[_0xe821('0x42')]=function(_0x4c17be,_0x3384dd){if(_0x4c17be[_0xe821('0x43')]['id']){delete _0x4c17be[_0xe821('0x43')]['id'];}return db[_0xe821('0x3a')][_0xe821('0x40')]({'where':{'id':_0x4c17be['params']['id']}})['then'](handleEntityNotFound(_0x3384dd,null))[_0xe821('0x20')](saveUpdates(_0x4c17be['body'],null))[_0xe821('0x20')](respondWithResult(_0x3384dd,null))['catch'](handleError(_0x3384dd,null));};exports[_0xe821('0x21')]=function(_0x3de712,_0x2eead2){return db[_0xe821('0x3a')]['find']({'where':{'id':_0x3de712[_0xe821('0x44')]['id']}})[_0xe821('0x20')](handleEntityNotFound(_0x2eead2,null))['then'](removeEntity(_0x2eead2,null))[_0xe821('0x41')](handleError(_0x2eead2,null));};exports[_0xe821('0x45')]=function(_0x4dfa3c,_0x10b70f){var _0x42d55a;return db[_0xe821('0x46')][_0xe821('0x47')](function(_0x5e4777){return db[_0xe821('0x3a')][_0xe821('0x45')](_0x4dfa3c['body'],{'transaction':_0x5e4777})['then'](function(_0x39d9de){_0x42d55a=_0x39d9de;var _0x2b3730={'type':db[_0xe821('0x48')]['TEXT'],'transaction':_0x5e4777};switch(_0x4dfa3c['body'][_0xe821('0x28')]){case'text':_0x2b3730[_0xe821('0x28')]=db[_0xe821('0x48')][_0xe821('0x49')];break;case'number':_0x2b3730[_0xe821('0x28')]=db['Sequelize']['INTEGER'];break;case _0xe821('0x4a'):_0x2b3730[_0xe821('0x28')]=db[_0xe821('0x48')][_0xe821('0x4b')];_0x2b3730['defaultValue']=![];break;default:}return db[_0xe821('0x46')]['queryInterface'][_0xe821('0x4c')](_0xe821('0x4d'),util['format'](_0xe821('0x4e'),_0x42d55a['id']),_0x2b3730);})[_0xe821('0x20')](function(){return _0x42d55a;});})[_0xe821('0x20')](respondWithResult(_0x10b70f,0xc9))[_0xe821('0x41')](handleError(_0x10b70f,null));}; \ No newline at end of file +var _0x86a1=['ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','CmCustomField','fieldName','type','key','differenceBy','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','findAll','rows','catch','show','params','keys','rawAttributes','length','includeAll','find','body','sequelize','transaction','TEXT','number','Sequelize','switch','BOOLEAN','queryInterface','addColumn','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv'];(function(_0x2ac1de,_0x5c3667){var _0x2e7b43=function(_0x3afbc5){while(--_0x3afbc5){_0x2ac1de['push'](_0x2ac1de['shift']());}};_0x2e7b43(++_0x5c3667);}(_0x86a1,0x15e));var _0x186a=function(_0x587ba2,_0x42eb40){_0x587ba2=_0x587ba2-0x0;var _0x50ec73=_0x86a1[_0x587ba2];return _0x50ec73;};'use strict';var emlformat=require(_0x186a('0x0'));var rimraf=require(_0x186a('0x1'));var zipdir=require(_0x186a('0x2'));var jsonpatch=require(_0x186a('0x3'));var rp=require(_0x186a('0x4'));var moment=require(_0x186a('0x5'));var BPromise=require(_0x186a('0x6'));var Mustache=require(_0x186a('0x7'));var util=require('util');var path=require('path');var sox=require(_0x186a('0x8'));var csv=require(_0x186a('0x9'));var ejs=require(_0x186a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x186a('0xb'));var squel=require(_0x186a('0xc'));var crypto=require('crypto');var jsforce=require(_0x186a('0xd'));var deskjs=require(_0x186a('0xe'));var toCsv=require(_0x186a('0x9'));var querystring=require('querystring');var Papa=require(_0x186a('0xf'));var Redis=require(_0x186a('0x10'));var authService=require(_0x186a('0x11'));var qs=require(_0x186a('0x12'));var as=require(_0x186a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x186a('0x14'))(_0x186a('0x15'));var utils=require(_0x186a('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x186a('0x17'));var db=require(_0x186a('0x18'))['db'];function respondWithStatusCode(_0x259827,_0x22afce){_0x22afce=_0x22afce||0xcc;return function(_0x535858){if(_0x535858){return _0x259827['sendStatus'](_0x22afce);}return _0x259827['status'](_0x22afce)[_0x186a('0x19')]();};}function respondWithResult(_0x62be28,_0x74cfd4){_0x74cfd4=_0x74cfd4||0xc8;return function(_0x579c2e){if(_0x579c2e){return _0x62be28[_0x186a('0x1a')](_0x74cfd4)[_0x186a('0x1b')](_0x579c2e);}};}function respondWithFilteredResult(_0x253e56,_0x429779){return function(_0x8dfcb3){if(_0x8dfcb3){var _0xf26a47=typeof _0x429779[_0x186a('0x1c')]===_0x186a('0x1d')&&typeof _0x429779[_0x186a('0x1e')]==='undefined';var _0x20d960=_0x8dfcb3['count'];var _0x31bce8=_0xf26a47?0x0:_0x429779['offset'];var _0x49f598=_0xf26a47?_0x8dfcb3['count']:_0x429779['offset']+_0x429779['limit'];var _0x520794;if(_0x49f598>=_0x20d960){_0x49f598=_0x20d960;_0x520794=0xc8;}else{_0x520794=0xce;}_0x253e56['status'](_0x520794);return _0x253e56[_0x186a('0x1f')](_0x186a('0x20'),_0x31bce8+'-'+_0x49f598+'/'+_0x20d960)[_0x186a('0x1b')](_0x8dfcb3);}return null;};}function patchUpdates(_0x49871f){return function(_0x258d15){try{jsonpatch[_0x186a('0x21')](_0x258d15,_0x49871f,!![]);}catch(_0xd58868){return BPromise[_0x186a('0x22')](_0xd58868);}return _0x258d15[_0x186a('0x23')]();};}function saveUpdates(_0x12d80d,_0x5c660d){return function(_0x26ce57){if(_0x26ce57){return _0x26ce57[_0x186a('0x24')](_0x12d80d)['then'](function(_0xc07068){return _0xc07068;});}return null;};}function removeEntity(_0x11e1e1,_0x4c06c8){return function(_0x57a57f){if(_0x57a57f){return _0x57a57f[_0x186a('0x25')]()[_0x186a('0x26')](function(){_0x11e1e1[_0x186a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11d6c8,_0x41113d){return function(_0x135fab){if(!_0x135fab){_0x11d6c8[_0x186a('0x27')](0x194);}return _0x135fab;};}function handleError(_0x7bcc26,_0x259d08){_0x259d08=_0x259d08||0x1f4;return function(_0x20e729){logger[_0x186a('0x28')](_0x20e729[_0x186a('0x29')]);if(_0x20e729['name']){delete _0x20e729[_0x186a('0x2a')];}_0x7bcc26[_0x186a('0x1a')](_0x259d08)[_0x186a('0x2b')](_0x20e729);};}exports[_0x186a('0x2c')]=function(_0x146b4a,_0x267206){var _0x79835b={},_0x10ef69={},_0x550396={'count':0x0,'rows':[]};var _0x1053bb=_[_0x186a('0x2d')](db[_0x186a('0x2e')]['rawAttributes'],function(_0x2056c4){return{'name':_0x2056c4[_0x186a('0x2f')],'type':_0x2056c4[_0x186a('0x30')][_0x186a('0x31')]};});_0x10ef69['model']=_[_0x186a('0x32')](_[_0x186a('0x2d')](_0x1053bb,_0x186a('0x2a')),['name']);_0x10ef69[_0x186a('0x33')]=_['keys'](_0x146b4a[_0x186a('0x33')]);_0x10ef69['filters']=_[_0x186a('0x34')](_0x10ef69[_0x186a('0x35')],_0x10ef69[_0x186a('0x33')]);_0x79835b[_0x186a('0x36')]=_[_0x186a('0x34')](_0x10ef69[_0x186a('0x35')],qs[_0x186a('0x37')](_0x146b4a[_0x186a('0x33')]['fields']));_0x79835b[_0x186a('0x36')]=_0x79835b[_0x186a('0x36')]['length']?_0x79835b['attributes']:_0x10ef69[_0x186a('0x35')];if(!_0x146b4a[_0x186a('0x33')][_0x186a('0x38')](_0x186a('0x39'))){_0x79835b[_0x186a('0x1e')]=qs[_0x186a('0x1e')](_0x146b4a[_0x186a('0x33')][_0x186a('0x1e')]);_0x79835b[_0x186a('0x1c')]=qs[_0x186a('0x1c')](_0x146b4a[_0x186a('0x33')][_0x186a('0x1c')]);}_0x79835b[_0x186a('0x3a')]=qs[_0x186a('0x3b')](_0x146b4a[_0x186a('0x33')][_0x186a('0x3b')]);_0x79835b[_0x186a('0x3c')]=qs[_0x186a('0x3d')](_[_0x186a('0x3e')](_0x146b4a[_0x186a('0x33')],_0x10ef69[_0x186a('0x3d')]),_0x1053bb);if(_0x146b4a[_0x186a('0x33')][_0x186a('0x3f')]){_0x79835b[_0x186a('0x3c')]=_[_0x186a('0x40')](_0x79835b[_0x186a('0x3c')],{'$or':_[_0x186a('0x2d')](_0x1053bb,function(_0x2210e6){if(_0x2210e6[_0x186a('0x30')]!==_0x186a('0x41')){var _0x2c0e9c={};_0x2c0e9c[_0x2210e6[_0x186a('0x2a')]]={'$like':'%'+_0x146b4a[_0x186a('0x33')][_0x186a('0x3f')]+'%'};return _0x2c0e9c;}})});}_0x79835b=_[_0x186a('0x40')]({},_0x79835b,_0x146b4a[_0x186a('0x42')]);var _0xdaf15c={'where':_0x79835b['where']};return db[_0x186a('0x2e')]['count'](_0xdaf15c)[_0x186a('0x26')](function(_0x3a0f43){_0x550396[_0x186a('0x43')]=_0x3a0f43;if(_0x146b4a[_0x186a('0x33')]['includeAll']){_0x79835b['include']=[{'all':!![]}];}return db[_0x186a('0x2e')][_0x186a('0x44')](_0x79835b);})[_0x186a('0x26')](function(_0x47eca0){_0x550396[_0x186a('0x45')]=_0x47eca0;return _0x550396;})['then'](respondWithFilteredResult(_0x267206,_0x79835b))[_0x186a('0x46')](handleError(_0x267206,null));};exports[_0x186a('0x47')]=function(_0x158dc6,_0x5de12d){var _0x171f46={'raw':!![],'where':{'id':_0x158dc6[_0x186a('0x48')]['id']}},_0x513543={};_0x513543[_0x186a('0x35')]=_[_0x186a('0x49')](db[_0x186a('0x2e')][_0x186a('0x4a')]);_0x513543[_0x186a('0x33')]=_[_0x186a('0x49')](_0x158dc6['query']);_0x513543[_0x186a('0x3d')]=_[_0x186a('0x34')](_0x513543[_0x186a('0x35')],_0x513543['query']);_0x171f46[_0x186a('0x36')]=_[_0x186a('0x34')](_0x513543[_0x186a('0x35')],qs['fields'](_0x158dc6[_0x186a('0x33')][_0x186a('0x37')]));_0x171f46[_0x186a('0x36')]=_0x171f46[_0x186a('0x36')][_0x186a('0x4b')]?_0x171f46[_0x186a('0x36')]:_0x513543[_0x186a('0x35')];if(_0x158dc6[_0x186a('0x33')][_0x186a('0x4c')]){_0x171f46['include']=[{'all':!![]}];}_0x171f46=_[_0x186a('0x40')]({},_0x171f46,_0x158dc6[_0x186a('0x42')]);return db[_0x186a('0x2e')][_0x186a('0x4d')](_0x171f46)[_0x186a('0x26')](handleEntityNotFound(_0x5de12d,null))['then'](respondWithResult(_0x5de12d,null))['catch'](handleError(_0x5de12d,null));};exports[_0x186a('0x24')]=function(_0x1f37a2,_0x5d8319){if(_0x1f37a2['body']['id']){delete _0x1f37a2[_0x186a('0x4e')]['id'];}return db['CmCustomField'][_0x186a('0x4d')]({'where':{'id':_0x1f37a2[_0x186a('0x48')]['id']}})['then'](handleEntityNotFound(_0x5d8319,null))[_0x186a('0x26')](saveUpdates(_0x1f37a2['body'],null))[_0x186a('0x26')](respondWithResult(_0x5d8319,null))['catch'](handleError(_0x5d8319,null));};exports[_0x186a('0x25')]=function(_0x202ceb,_0x49232f){return db[_0x186a('0x2e')][_0x186a('0x4d')]({'where':{'id':_0x202ceb[_0x186a('0x48')]['id']}})[_0x186a('0x26')](handleEntityNotFound(_0x49232f,null))[_0x186a('0x26')](removeEntity(_0x49232f,null))[_0x186a('0x46')](handleError(_0x49232f,null));};exports['create']=function(_0x4a8ed0,_0x27311a){var _0x75f20a;return db[_0x186a('0x4f')][_0x186a('0x50')](function(_0x4895a3){return db['CmCustomField']['create'](_0x4a8ed0[_0x186a('0x4e')],{'transaction':_0x4895a3})[_0x186a('0x26')](function(_0x25c0fa){_0x75f20a=_0x25c0fa;var _0xcbd95b={'type':db['Sequelize'][_0x186a('0x51')],'transaction':_0x4895a3};switch(_0x4a8ed0[_0x186a('0x4e')][_0x186a('0x30')]){case'text':_0xcbd95b[_0x186a('0x30')]=db['Sequelize']['TEXT'];break;case _0x186a('0x52'):_0xcbd95b[_0x186a('0x30')]=db[_0x186a('0x53')]['INTEGER'];break;case _0x186a('0x54'):_0xcbd95b[_0x186a('0x30')]=db[_0x186a('0x53')][_0x186a('0x55')];_0xcbd95b['defaultValue']=![];break;default:}return db[_0x186a('0x4f')][_0x186a('0x56')][_0x186a('0x57')]('cm_contacts',util[_0x186a('0x58')](_0x186a('0x59'),_0x75f20a['id']),_0xcbd95b);})[_0x186a('0x26')](function(){return _0x75f20a;});})['then'](respondWithResult(_0x27311a,0xc9))[_0x186a('0x46')](handleError(_0x27311a,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 6d9ee98..7a67225 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 _0xa94f=['bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','define','cm_custom_fields','lodash','util','../../config/logger','moment'];(function(_0x948c82,_0x1a2ea0){var _0x380ec8=function(_0xcdb872){while(--_0xcdb872){_0x948c82['push'](_0x948c82['shift']());}};_0x380ec8(++_0x1a2ea0);}(_0xa94f,0x1ac));var _0xfa94=function(_0x407df1,_0x5ee3bf){_0x407df1=_0x407df1-0x0;var _0x578906=_0xa94f[_0x407df1];return _0x578906;};'use strict';var _=require(_0xfa94('0x0'));var util=require(_0xfa94('0x1'));var logger=require(_0xfa94('0x2'))('api');var moment=require(_0xfa94('0x3'));var BPromise=require(_0xfa94('0x4'));var rp=require(_0xfa94('0x5'));var fs=require('fs');var path=require(_0xfa94('0x6'));var rimraf=require(_0xfa94('0x7'));var config=require(_0xfa94('0x8'));var attributes=require(_0xfa94('0x9'));module['exports']=function(_0x5068cb,_0x36e23f){return _0x5068cb[_0xfa94('0xa')]('CmCustomField',attributes,{'tableName':_0xfa94('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6400=['path','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x6400,0x118));var _0x0640=function(_0xe7a99e,_0x4902a1){_0xe7a99e=_0xe7a99e-0x0;var _0x3bef5c=_0x6400[_0xe7a99e];return _0x3bef5c;};'use strict';var _=require(_0x0640('0x0'));var util=require(_0x0640('0x1'));var logger=require(_0x0640('0x2'))(_0x0640('0x3'));var moment=require('moment');var BPromise=require(_0x0640('0x4'));var rp=require(_0x0640('0x5'));var fs=require('fs');var path=require(_0x0640('0x6'));var rimraf=require('rimraf');var config=require(_0x0640('0x7'));var attributes=require(_0x0640('0x8'));module[_0x0640('0x9')]=function(_0x568f7d,_0x725017){return _0x568f7d[_0x0640('0xa')](_0x0640('0xb'),attributes,{'tableName':_0x0640('0xc'),'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 d6359bf..f6806b0 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 _0x5140=['moment','bluebird','randomstring','../../mysqldb','../../config/logger','client','http','request','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','code','error','message','result','lodash'];(function(_0x2f0b75,_0x27513a){var _0x266f30=function(_0x57e23f){while(--_0x57e23f){_0x2f0b75['push'](_0x2f0b75['shift']());}};_0x266f30(++_0x27513a);}(_0x5140,0xa1));var _0x0514=function(_0xdb0360,_0x1799eb){_0xdb0360=_0xdb0360-0x0;var _0x1306f9=_0x5140[_0xdb0360];return _0x1306f9;};'use strict';var _=require(_0x0514('0x0'));var util=require('util');var moment=require(_0x0514('0x1'));var BPromise=require(_0x0514('0x2'));var rs=require(_0x0514('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0514('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0514('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0514('0x6')][_0x0514('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x26eac4,_0x37dc93,_0x20d750){return new BPromise(function(_0x5d3c87,_0x426651){return client[_0x0514('0x8')](_0x26eac4,_0x20d750)['then'](function(_0x593f84){logger[_0x0514('0x9')](_0x0514('0xa'),_0x37dc93,_0x0514('0xb'));logger[_0x0514('0xc')](_0x0514('0xd'),_0x37dc93,_0x0514('0xb'),JSON['stringify'](_0x593f84));if(_0x593f84['error']){if(_0x593f84['error'][_0x0514('0xe')]===0x1f4){logger[_0x0514('0xf')]('CmCustomField,\x20%s,\x20%s',_0x37dc93,_0x593f84[_0x0514('0xf')][_0x0514('0x10')]);return _0x426651(_0x593f84['error'][_0x0514('0x10')]);}logger['error']('CmCustomField,\x20%s,\x20%s',_0x37dc93,_0x593f84[_0x0514('0xf')][_0x0514('0x10')]);return _0x5d3c87(_0x593f84[_0x0514('0xf')][_0x0514('0x10')]);}else{logger['info']('CmCustomField,\x20%s,\x20%s',_0x37dc93,_0x0514('0xb'));_0x5d3c87(_0x593f84[_0x0514('0x11')]['message']);}})['catch'](function(_0x5b3fba){logger[_0x0514('0xf')](_0x0514('0xa'),_0x37dc93,_0x5b3fba);_0x426651(_0x5b3fba);});});} \ No newline at end of file +var _0xea95=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','debug','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0xea95,0x1c4));var _0x5ea9=function(_0x412033,_0xf06537){_0x412033=_0x412033-0x0;var _0x45f313=_0xea95[_0x412033];return _0x45f313;};'use strict';var _=require(_0x5ea9('0x0'));var util=require('util');var moment=require(_0x5ea9('0x1'));var BPromise=require(_0x5ea9('0x2'));var rs=require(_0x5ea9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5ea9('0x4'))['db'];var utils=require(_0x5ea9('0x5'));var logger=require(_0x5ea9('0x6'))(_0x5ea9('0x7'));var config=require(_0x5ea9('0x8'));var jayson=require(_0x5ea9('0x9'));var client=jayson[_0x5ea9('0xa')][_0x5ea9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f11c5,_0x56c782,_0x167d66){return new BPromise(function(_0x21e3a4,_0x3ef146){return client[_0x5ea9('0xc')](_0x4f11c5,_0x167d66)['then'](function(_0x28185e){logger['info']('CmCustomField,\x20%s,\x20%s',_0x56c782,'request\x20sent');logger[_0x5ea9('0xd')](_0x5ea9('0xe'),_0x56c782,_0x5ea9('0xf'),JSON[_0x5ea9('0x10')](_0x28185e));if(_0x28185e[_0x5ea9('0x11')]){if(_0x28185e[_0x5ea9('0x11')][_0x5ea9('0x12')]===0x1f4){logger[_0x5ea9('0x11')](_0x5ea9('0x13'),_0x56c782,_0x28185e['error'][_0x5ea9('0x14')]);return _0x3ef146(_0x28185e[_0x5ea9('0x11')][_0x5ea9('0x14')]);}logger[_0x5ea9('0x11')]('CmCustomField,\x20%s,\x20%s',_0x56c782,_0x28185e[_0x5ea9('0x11')][_0x5ea9('0x14')]);return _0x21e3a4(_0x28185e[_0x5ea9('0x11')]['message']);}else{logger[_0x5ea9('0x15')](_0x5ea9('0x13'),_0x56c782,_0x5ea9('0xf'));_0x21e3a4(_0x28185e[_0x5ea9('0x16')][_0x5ea9('0x14')]);}})[_0x5ea9('0x17')](function(_0x41d259){logger[_0x5ea9('0x11')]('CmCustomField,\x20%s,\x20%s',_0x56c782,_0x41d259);_0x3ef146(_0x41d259);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 738e788..bffe4b9 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 _0xc57c=['express','../../components/auth/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','create','put','destroy','exports','multer'];(function(_0x29df67,_0x723968){var _0x3d18da=function(_0x384382){while(--_0x384382){_0x29df67['push'](_0x29df67['shift']());}};_0x3d18da(++_0x723968);}(_0xc57c,0x149));var _0xcc57=function(_0x2da525,_0x315a01){_0x2da525=_0x2da525-0x0;var _0xf0a632=_0xc57c[_0x2da525];return _0xf0a632;};'use strict';var multer=require(_0xcc57('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcc57('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xcc57('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xcc57('0x3'));var controller=require(_0xcc57('0x4'));router[_0xcc57('0x5')]('/',auth[_0xcc57('0x6')](),controller[_0xcc57('0x7')]);router[_0xcc57('0x5')](_0xcc57('0x8'),auth['isAuthenticated'](),controller[_0xcc57('0x9')]);router[_0xcc57('0xa')]('/',auth[_0xcc57('0x6')](),controller[_0xcc57('0xb')]);router[_0xcc57('0xc')](_0xcc57('0x8'),auth[_0xcc57('0x6')](),controller['update']);router['delete']('/:id',auth[_0xcc57('0x6')](),controller[_0xcc57('0xd')]);module[_0xcc57('0xe')]=router; \ No newline at end of file +var _0x061c=['../../components/interaction/service','./cmCustomField.controller','isAuthenticated','index','get','/:id','show','post','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0x061c,0xc0));var _0xc061=function(_0x1abeaf,_0x30f90f){_0x1abeaf=_0x1abeaf-0x0;var _0x247849=_0x061c[_0x1abeaf];return _0x247849;};'use strict';var multer=require(_0xc061('0x0'));var util=require(_0xc061('0x1'));var path=require(_0xc061('0x2'));var timeout=require(_0xc061('0x3'));var express=require(_0xc061('0x4'));var router=express[_0xc061('0x5')]();var fs_extra=require(_0xc061('0x6'));var auth=require(_0xc061('0x7'));var interaction=require(_0xc061('0x8'));var config=require('../../config/environment');var controller=require(_0xc061('0x9'));router['get']('/',auth[_0xc061('0xa')](),controller[_0xc061('0xb')]);router[_0xc061('0xc')](_0xc061('0xd'),auth[_0xc061('0xa')](),controller[_0xc061('0xe')]);router[_0xc061('0xf')]('/',auth[_0xc061('0xa')](),controller[_0xc061('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc061('0x11')]);router[_0xc061('0x12')](_0xc061('0xd'),auth[_0xc061('0xa')](),controller['destroy']);module[_0xc061('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 65d9e4d..09f6975 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 _0xa13c=['format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','BOOLEAN','contactListQueue','moment','STRING','DATE'];(function(_0x5461f1,_0x177426){var _0x38c261=function(_0x21c531){while(--_0x21c531){_0x5461f1['push'](_0x5461f1['shift']());}};_0x38c261(++_0x177426);}(_0xa13c,0x11d));var _0xca13=function(_0x4e18bf,_0x37cab2){_0x4e18bf=_0x4e18bf-0x0;var _0x5d6896=_0xa13c[_0x4e18bf];return _0x5d6896;};'use strict';var moment=require(_0xca13('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0xca13('0x1')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xca13('0x2')],'defaultValue':moment()[_0xca13('0x3')](_0xca13('0x4'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xca13('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xca13('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xca13('0x2')]},'priority':{'type':Sequelize[_0xca13('0x5')](0x2)[_0xca13('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xca13('0x7')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xca13('0x5')],'unique':_0xca13('0x8')},'ListId':{'type':Sequelize[_0xca13('0x5')],'unique':_0xca13('0x8')},'UserId':{'type':Sequelize[_0xca13('0x5')]},'VoiceQueueId':{'type':Sequelize[_0xca13('0x5')],'unique':_0xca13('0x8')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0xca13('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xca13('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xca13('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xca13('0x5')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0xca13('0x2')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x9b55=['exports','STRING','BOOLEAN','INTEGER','DATE','UNSIGNED','contactListQueue','moment'];(function(_0x390335,_0x36d2e3){var _0x913dec=function(_0x226cdd){while(--_0x226cdd){_0x390335['push'](_0x390335['shift']());}};_0x913dec(++_0x36d2e3);}(_0x9b55,0x14f));var _0x59b5=function(_0x2307d,_0x4e8a40){_0x2307d=_0x2307d-0x0;var _0x3a4cfd=_0x9b55[_0x2307d];return _0x3a4cfd;};'use strict';var moment=require(_0x59b5('0x0'));var Sequelize=require('sequelize');module[_0x59b5('0x1')]={'phone':{'type':Sequelize[_0x59b5('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x59b5('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x59b5('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x59b5('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x59b5('0x4')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x59b5('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x59b5('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x59b5('0x5')]},'priority':{'type':Sequelize[_0x59b5('0x4')](0x2)[_0x59b5('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x59b5('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x59b5('0x4')],'unique':_0x59b5('0x7')},'ListId':{'type':Sequelize[_0x59b5('0x4')],'unique':_0x59b5('0x7')},'UserId':{'type':Sequelize[_0x59b5('0x4')]},'VoiceQueueId':{'type':Sequelize[_0x59b5('0x4')],'unique':_0x59b5('0x7')},'CampaignId':{'type':Sequelize[_0x59b5('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x59b5('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x59b5('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x59b5('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x59b5('0x4')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x59b5('0x4')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x59b5('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0x59b5('0x5')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 348c785..ce597a8 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 _0xde64=['where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch','show','includeAll','find','create','body','params','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','state','statedesc','deleted','campaign','membername','user','deletedat','format','calleridnum','phone','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','outbound','dialOrderByScheduledAt','dialPreviewAutoRecallMe','length','YYYY-MM-DD\x20HH:mm:ss','value','direction','prev','isEmpty','hopperIds','ASC','scheduledAt','DESC','sequelize','literal','priority','findOne','scheduledat','recallme','LOCK','UPDATE','Contact','CmCompany','CmList','List','Queue','dialActive','getPreviewRecall','transaction','Company','preview','isNumber','error','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','getTimezones','push','utcOffset','getTimezone','timezones','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','json','offset','undefined','limit','status','set','update','then','sendStatus','name','send','index','map','CmHopper','rawAttributes','fieldName','type','key','query','keys','intersection','filters','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','model','fields','nolimit','order','sort'];(function(_0x217ff6,_0x36f75d){var _0x417c93=function(_0x4787d2){while(--_0x4787d2){_0x217ff6['push'](_0x217ff6['shift']());}};_0x417c93(++_0x36f75d);}(_0xde64,0x17c));var _0x4de6=function(_0x46d4de,_0x232ad1){_0x46d4de=_0x46d4de-0x0;var _0x2da682=_0xde64[_0x46d4de];return _0x2da682;};'use strict';var moment=require(_0x4de6('0x0'));var _=require(_0x4de6('0x1'));var qs=require(_0x4de6('0x2'));var logger=require(_0x4de6('0x3'))(_0x4de6('0x4'));var shared=require(_0x4de6('0x5'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x3c4b91,_0x3bd290){_0x3bd290=_0x3bd290||0xc8;return function(_0x5a5c5a){if(_0x5a5c5a){return _0x3c4b91['status'](_0x3bd290)[_0x4de6('0x6')](_0x5a5c5a);}};}function respondWithFilteredResult(_0x45867b,_0x4da17f){return function(_0x568496){if(_0x568496){var _0x24edef=typeof _0x4da17f[_0x4de6('0x7')]===_0x4de6('0x8')&&typeof _0x4da17f[_0x4de6('0x9')]===_0x4de6('0x8');var _0x202cdc=_0x568496['count'];var _0x267c1a=_0x24edef?0x0:_0x4da17f[_0x4de6('0x7')];var _0x1dbeed=_0x24edef?_0x568496['count']:_0x4da17f[_0x4de6('0x7')]+_0x4da17f[_0x4de6('0x9')];var _0x2e205b;if(_0x1dbeed>=_0x202cdc){_0x1dbeed=_0x202cdc;_0x2e205b=0xc8;}else{_0x2e205b=0xce;}_0x45867b[_0x4de6('0xa')](_0x2e205b);return _0x45867b[_0x4de6('0xb')]('Content-Range',_0x267c1a+'-'+_0x1dbeed+'/'+_0x202cdc)[_0x4de6('0x6')](_0x568496);}return null;};}function saveUpdates(_0x3baa31,_0xb8e256){return function(_0x509002){if(_0x509002){return _0x509002[_0x4de6('0xc')](_0x3baa31)[_0x4de6('0xd')](function(_0x27c108){return _0x27c108;});}return null;};}function handleEntityNotFound(_0x2bd121,_0x58b0c1){return function(_0x1ccfee){if(!_0x1ccfee){_0x2bd121[_0x4de6('0xe')](0x194);}return _0x1ccfee;};}function handleError(_0x43d59b,_0x4dd3b5){_0x4dd3b5=_0x4dd3b5||0x1f4;return function(_0x33fd67){logger['error'](_0x33fd67['stack']);if(_0x33fd67[_0x4de6('0xf')]){delete _0x33fd67[_0x4de6('0xf')];}_0x43d59b[_0x4de6('0xa')](_0x4dd3b5)[_0x4de6('0x10')](_0x33fd67);};}exports[_0x4de6('0x11')]=function(_0x279278,_0x324202){var _0x5aacb4={},_0x420f7c={},_0xea1610={'count':0x0,'rows':[]};var _0x2c7e57=_[_0x4de6('0x12')](db[_0x4de6('0x13')][_0x4de6('0x14')],function(_0x20855f){return{'name':_0x20855f[_0x4de6('0x15')],'type':_0x20855f[_0x4de6('0x16')][_0x4de6('0x17')]};});_0x420f7c['model']=_[_0x4de6('0x12')](_0x2c7e57,'name');_0x420f7c[_0x4de6('0x18')]=_[_0x4de6('0x19')](_0x279278[_0x4de6('0x18')]);_0x420f7c['filters']=_[_0x4de6('0x1a')](_0x420f7c['model'],_0x420f7c[_0x4de6('0x18')]);_0x420f7c[_0x4de6('0x1b')]=_[_0x4de6('0x1c')](_0x420f7c['filters'],[_0x4de6('0x1d'),_0x4de6('0x1e'),_0x4de6('0x1f'),_0x4de6('0x20'),_0x4de6('0x21'),_0x4de6('0x22'),_0x4de6('0x23'),'$eq',_0x4de6('0x24'),_0x4de6('0x25'),_0x4de6('0x26'),_0x4de6('0x27'),_0x4de6('0x28'),_0x4de6('0x29'),_0x4de6('0x2a'),_0x4de6('0x2b'),_0x4de6('0x2c'),'$like',_0x4de6('0x2d'),_0x4de6('0x2e'),_0x4de6('0x2f'),_0x4de6('0x30')]);_0x5aacb4[_0x4de6('0x31')]=_['intersection'](_0x420f7c[_0x4de6('0x32')],qs['fields'](_0x279278[_0x4de6('0x18')][_0x4de6('0x33')]));_0x5aacb4[_0x4de6('0x31')]=_0x5aacb4[_0x4de6('0x31')]['length']?_0x5aacb4['attributes']:_0x420f7c['model'];if(!_0x279278['query']['hasOwnProperty'](_0x4de6('0x34'))){_0x5aacb4[_0x4de6('0x9')]=qs[_0x4de6('0x9')](_0x279278[_0x4de6('0x18')][_0x4de6('0x9')]);_0x5aacb4[_0x4de6('0x7')]=qs[_0x4de6('0x7')](_0x279278[_0x4de6('0x18')][_0x4de6('0x7')]);}_0x5aacb4[_0x4de6('0x35')]=qs[_0x4de6('0x36')](_0x279278[_0x4de6('0x18')][_0x4de6('0x36')]);_0x5aacb4[_0x4de6('0x37')]=qs[_0x4de6('0x1b')](_[_0x4de6('0x38')](_0x279278[_0x4de6('0x18')],_0x420f7c[_0x4de6('0x1b')]),_0x2c7e57);if(_0x279278[_0x4de6('0x18')][_0x4de6('0x39')]){_0x5aacb4[_0x4de6('0x37')]=_[_0x4de6('0x3a')](_0x5aacb4[_0x4de6('0x37')],{'$or':_[_0x4de6('0x12')](_0x2c7e57,function(_0x1aab6e){if(_0x1aab6e[_0x4de6('0x16')]!==_0x4de6('0x3b')){var _0x12d20e={};_0x12d20e[_0x1aab6e[_0x4de6('0xf')]]={'$like':'%'+_0x279278['query'][_0x4de6('0x39')]+'%'};return _0x12d20e;}})});}_0x5aacb4=_[_0x4de6('0x3a')]({},_0x5aacb4,_0x279278[_0x4de6('0x3c')]);var _0x3bf31f={'where':_0x5aacb4['where']};return db[_0x4de6('0x13')][_0x4de6('0x3d')](_0x3bf31f)[_0x4de6('0xd')](function(_0x122493){_0xea1610['count']=_0x122493;if(_0x279278[_0x4de6('0x18')]['includeAll']){_0x5aacb4[_0x4de6('0x3e')]=[{'all':!![]}];}return db[_0x4de6('0x13')][_0x4de6('0x3f')](_0x5aacb4);})[_0x4de6('0xd')](function(_0x37feb0){_0xea1610[_0x4de6('0x40')]=_0x37feb0;return _0xea1610;})[_0x4de6('0xd')](respondWithFilteredResult(_0x324202,_0x5aacb4))[_0x4de6('0x41')](handleError(_0x324202,null));};exports[_0x4de6('0x42')]=function(_0xdfa5ed,_0x85581b){var _0x1f0262={'raw':!![],'where':{'id':_0xdfa5ed['params']['id']}},_0x551440={};_0x551440[_0x4de6('0x32')]=_[_0x4de6('0x19')](db[_0x4de6('0x13')][_0x4de6('0x14')]);_0x551440['query']=_['keys'](_0xdfa5ed[_0x4de6('0x18')]);_0x551440['filters']=_[_0x4de6('0x1a')](_0x551440['model'],_0x551440[_0x4de6('0x18')]);_0x1f0262['attributes']=_[_0x4de6('0x1a')](_0x551440[_0x4de6('0x32')],qs[_0x4de6('0x33')](_0xdfa5ed[_0x4de6('0x18')]['fields']));_0x1f0262[_0x4de6('0x31')]=_0x1f0262[_0x4de6('0x31')]['length']?_0x1f0262['attributes']:_0x551440[_0x4de6('0x32')];if(_0xdfa5ed['query'][_0x4de6('0x43')]){_0x1f0262[_0x4de6('0x3e')]=[{'all':!![]}];}_0x1f0262=_[_0x4de6('0x3a')]({},_0x1f0262,_0xdfa5ed[_0x4de6('0x3c')]);return db[_0x4de6('0x13')][_0x4de6('0x44')](_0x1f0262)[_0x4de6('0xd')](handleEntityNotFound(_0x85581b,null))[_0x4de6('0xd')](respondWithResult(_0x85581b,null))[_0x4de6('0x41')](handleError(_0x85581b,null));};exports[_0x4de6('0x45')]=function(_0x2cb079,_0x90ad4f){return db['CmHopper']['create'](_0x2cb079['body'],{})[_0x4de6('0xd')](respondWithResult(_0x90ad4f,0xc9))[_0x4de6('0x41')](handleError(_0x90ad4f,null));};exports['update']=function(_0x57fb2f,_0x16a12d){if(_0x57fb2f['body']['id']){delete _0x57fb2f[_0x4de6('0x46')]['id'];}return db[_0x4de6('0x13')]['find']({'where':{'id':_0x57fb2f[_0x4de6('0x47')]['id']}})[_0x4de6('0xd')](handleEntityNotFound(_0x16a12d,null))[_0x4de6('0xd')](saveUpdates(_0x57fb2f[_0x4de6('0x46')],null))[_0x4de6('0xd')](respondWithResult(_0x16a12d,null))['catch'](handleError(_0x16a12d,null));};exports[_0x4de6('0x48')]=function(_0x388b78,_0x2e23ad){return db[_0x4de6('0x13')][_0x4de6('0x48')]()[_0x4de6('0xd')](respondWithResult(_0x2e23ad,null))[_0x4de6('0x41')](handleError(_0x2e23ad,null));};exports[_0x4de6('0x49')]=function(_0x698dcb,_0x3126f1){var _0x367c8f;var _0x35df53=_0x698dcb[_0x4de6('0x47')]['id'];return db[_0x4de6('0x13')][_0x4de6('0x44')]({'where':{'id':_0x698dcb[_0x4de6('0x47')]['id']}})[_0x4de6('0xd')](handleEntityNotFound(_0x3126f1,null))['then'](function(_0x5eab19){if(_0x5eab19){return _0x5eab19[_0x4de6('0x49')]()[_0x4de6('0xd')](function(_0x524807){return _0x524807;});}})[_0x4de6('0xd')](function(_0x191f93){_0x367c8f=_0x191f93;if(_0x191f93){if(_0x191f93[_0x4de6('0x4a')]||_0x191f93[_0x4de6('0x4b')]){return db[_0x191f93[_0x4de6('0x4a')]?_0x4de6('0x4c'):_0x4de6('0x4d')]['find']({'where':{'id':_0x191f93[_0x4de6('0x4a')]?_0x191f93['VoiceQueueId']:_0x191f93[_0x4de6('0x4b')]},'attributes':['id',_0x4de6('0xf')],'raw':!![]});}}})[_0x4de6('0xd')](function(_0xb8b798){var _0x3326ad={};if(_0xb8b798){_[_0x4de6('0x3a')](_0x3326ad,_[_0x4de6('0x4e')](_0x367c8f[_0x4de6('0x4f')],['createdAt','updatedAt','id']));_0x3326ad[_0x4de6('0x50')]=0x15;_0x3326ad[_0x4de6('0x51')]=_0x4de6('0x52');_0x3326ad[_0x4de6('0x53')]=_0xb8b798['name'];_0x3326ad[_0x4de6('0x54')]=_0x698dcb[_0x4de6('0x55')][_0x4de6('0xf')];_0x3326ad['UserId']=_0x698dcb[_0x4de6('0x55')]['id'];_0x3326ad['deleted']=!![];_0x3326ad[_0x4de6('0x56')]=moment()[_0x4de6('0x57')]('YYYY-MM-DD\x20HH:mm:ss');_0x3326ad[_0x4de6('0x58')]=_0x367c8f[_0x4de6('0x59')];_0x3326ad['campaigntype']=_0x367c8f[_0x4de6('0x4a')]?_0x4de6('0x5a'):_0x4de6('0x5b');return db[_0x4de6('0x5c')][_0x4de6('0x44')]({'where':{'id':_0x3326ad[_0x4de6('0x5d')]},'attributes':[_0x4de6('0x5e'),_0x4de6('0x5f')]})[_0x4de6('0xd')](function(_0x46b82f){if(!_[_0x4de6('0x60')](_0x3126f1)&&!_['isNil'](_0x46b82f[_0x4de6('0x5e')])){_0x3326ad[_0x4de6('0x61')]=_0x46b82f[_0x4de6('0x5e')];if(!_['isNil'](_0x46b82f[_0x4de6('0x5f')])){_0x3326ad[_0x4de6('0x61')]+='\x20'+_0x46b82f['lastName'];}}})[_0x4de6('0x62')](function(){return db[_0x4de6('0x63')][_0x4de6('0x45')](_0x3326ad);});}})[_0x4de6('0xd')](function(_0x49b8c2){return db[_0x4de6('0x64')][_0x4de6('0x49')]({'where':{'CmHopperId':_0x35df53}});})[_0x4de6('0xd')](function(){return _0x3126f1['status'](0xcc)[_0x4de6('0x65')]();})[_0x4de6('0x41')](handleError(_0x3126f1,null));};exports[_0x4de6('0x66')]=function(_0x34065e,_0x1e4dc2){var _0x358faa=[];return db[_0x4de6('0x5c')][_0x4de6('0x48')]()[_0x4de6('0xd')](function(_0x2e748a){_0x358faa=_[_0x4de6('0x19')](_0x2e748a);return _0x34065e[_0x4de6('0x55')][_0x4de6('0x67')]({'where':{'type':_0x4de6('0x68'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x4de6('0x69'),_0x4de6('0x6a')],'raw':!![]});})['then'](function(_0x2f68e2){if(_0x2f68e2&&_0x2f68e2[_0x4de6('0x6b')]){return db['sequelize']['transaction'](function(_0x5b4fe9){var _0x4ebcd3={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x4de6('0x57')](_0x4de6('0x6c'))},'VoiceQueueId':{'$in':_[_0x4de6('0x12')](_0x2f68e2,'id')},'$or':[{'UserId':null},{'UserId':_0x34065e[_0x4de6('0x55')]['id']}]};var _0x3b3a3c={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x2f68e2)[_0x4de6('0x39')]([_0x4de6('0x6a'),0x0])[_0x4de6('0x12')]('id')[_0x4de6('0x6d')]()},'$or':[{'UserId':null},{'UserId':_0x34065e['user']['id']}]};var _0x5e400b={'$or':[_0x4ebcd3,_0x3b3a3c]};var _0x1dae3a=[];if(_0x34065e[_0x4de6('0x46')]['direction']&&_0x34065e[_0x4de6('0x46')][_0x4de6('0x6e')]===_0x4de6('0x6f')){if(!_[_0x4de6('0x70')](_0x34065e[_0x4de6('0x46')][_0x4de6('0x71')])){_0x5e400b['id']={'$in':_0x34065e[_0x4de6('0x46')][_0x4de6('0x71')]};}_0x1dae3a=[['priority',_0x4de6('0x72')],[_0x4de6('0x73'),_0x2f68e2[0x0]['dialOrderByScheduledAt']==='ASC'?_0x4de6('0x74'):_0x4de6('0x72')],db[_0x4de6('0x75')][_0x4de6('0x76')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x4de6('0x74')]];}else{if(!_['isEmpty'](_0x34065e['body'][_0x4de6('0x71')])){_0x5e400b['id']={'$notIn':_0x34065e['body']['hopperIds']};}_0x1dae3a=[[_0x4de6('0x77'),_0x4de6('0x74')],['scheduledAt',_0x2f68e2[0x0][_0x4de6('0x69')]],db[_0x4de6('0x75')][_0x4de6('0x76')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id','ASC']];}return db['CmHopper'][_0x4de6('0x78')]({'attributes':['id',_0x4de6('0x79'),_0x4de6('0x59'),_0x4de6('0x7a')],'where':_0x5e400b,'order':_0x1dae3a,'transaction':_0x5b4fe9,'lock':_0x5b4fe9[_0x4de6('0x7b')][_0x4de6('0x7c')],'include':[{'model':db['CmContact'],'as':_0x4de6('0x7d'),'attributes':_0x358faa,'include':[{'model':db[_0x4de6('0x7e')],'as':'Company','attributes':['id','name']}]},{'model':db[_0x4de6('0x7f')],'as':_0x4de6('0x80'),'attributes':['id','name']},{'model':db[_0x4de6('0x4c')],'as':_0x4de6('0x81'),'attributes':['id',_0x4de6('0xf'),_0x4de6('0x82')]}]})['then'](function(_0x1b5b36){if(_0x1b5b36){return _0x1b5b36[_0x4de6('0xc')]({'UserId':_0x34065e['user']['id']},{'transaction':_0x5b4fe9});}});});}})[_0x4de6('0xd')](handleEntityNotFound(_0x1e4dc2,null))[_0x4de6('0xd')](respondWithResult(_0x1e4dc2,null))[_0x4de6('0x41')](handleError(_0x1e4dc2,null));};exports[_0x4de6('0x83')]=function(_0x7efb2,_0x3129cb,_0xeaf72e){var _0x5f3afe=[];var _0x318caa=_0x7efb2[_0x4de6('0x47')]['id'];var _0x43380a=_0x7efb2[_0x4de6('0x55')]['id'];return db[_0x4de6('0x5c')][_0x4de6('0x48')]()['then'](function(_0x1eca16){_0x5f3afe=_[_0x4de6('0x19')](_0x1eca16);return db[_0x4de6('0x75')][_0x4de6('0x84')](function(_0x17519a){const _0x1d504f={'id':_0x318caa};return db[_0x4de6('0x13')][_0x4de6('0x78')]({'attributes':['id',_0x4de6('0x79'),_0x4de6('0x7a')],'where':_0x1d504f,'transaction':_0x17519a,'lock':_0x17519a[_0x4de6('0x7b')][_0x4de6('0x7c')],'include':[{'model':db[_0x4de6('0x5c')],'as':_0x4de6('0x7d'),'attributes':_0x5f3afe,'include':[{'model':db[_0x4de6('0x7e')],'as':_0x4de6('0x85'),'attributes':['id',_0x4de6('0xf')]}]},{'model':db['CmList'],'as':_0x4de6('0x80'),'attributes':['id',_0x4de6('0xf')]},{'model':db[_0x4de6('0x4c')],'as':_0x4de6('0x81'),'attributes':['id','name',_0x4de6('0x82')]}]})['then'](function(_0x3d6e0d){if(_0x3d6e0d){return _0x3d6e0d[_0x4de6('0xc')]({'UserId':_0x43380a},{'transaction':_0x17519a});}});});})[_0x4de6('0xd')](handleEntityNotFound(_0x3129cb,null))[_0x4de6('0xd')](respondWithResult(_0x3129cb,null))[_0x4de6('0x41')](handleError(_0x3129cb,null));};exports['getOpenContacts']=function(_0x104b48,_0x58e78c){return _0x104b48[_0x4de6('0x55')][_0x4de6('0x67')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x4de6('0x86')},'attributes':['id'],'raw':!![]})['then'](function(_0x4d0cde){if(_0x4d0cde&&_0x4d0cde['length']){return db[_0x4de6('0x13')][_0x4de6('0x3d')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x4de6('0x57')](_0x4de6('0x6c'))},'VoiceQueueId':{'$in':_[_0x4de6('0x12')](_0x4d0cde,'id')},'$or':[{'UserId':null},{'UserId':_0x104b48[_0x4de6('0x55')]['id']}]}});}return 0x0;})[_0x4de6('0xd')](function(_0x43bd4b){if(!_['isNil'](_0x43bd4b)&&_[_0x4de6('0x87')](_0x43bd4b)){return _0x58e78c[_0x4de6('0xa')](0xc8)[_0x4de6('0x6')]({'contacts':_0x43bd4b});}else{logger[_0x4de6('0x88')](_0x4de6('0x89'),_0x4de6('0x8a'),0x194,_0x4de6('0x8b'));_0x58e78c[_0x4de6('0xe')](0x194);}})[_0x4de6('0x41')](handleError(_0x58e78c,null));};exports[_0x4de6('0x8c')]=function(_0x261539,_0x1582be){var _0x4cfe36=shared['timezones'];var _0x2060da=[];_[_0x4de6('0x12')](_0x4cfe36,function(_0x117272){_0x2060da[_0x4de6('0x8d')]({'id':_0x117272[_0x4de6('0xf')],'name':_0x117272[_0x4de6('0xf')],'utcOffset':_0x117272[_0x4de6('0x8e')]});});return _0x1582be['status'](0xc8)['json']({'tz':_0x2060da});};exports[_0x4de6('0x8f')]=function(_0xd3fe83,_0x427a2b){var _0x556bd4=shared[_0x4de6('0x90')];var _0x874c1f={};if(!_[_0x4de6('0x60')](_0x556bd4[_0xd3fe83[_0x4de6('0x46')]['id']]))_0x874c1f=_0x556bd4[_0xd3fe83[_0x4de6('0x46')]['id']];return _0x427a2b[_0x4de6('0xa')](0xc8)[_0x4de6('0x6')](_0x874c1f);}; \ No newline at end of file +var _0x207c=['show','includeAll','create','body','find','params','describe','destroy','CampaignId','VoiceQueueId','VoiceQueue','Campaign','omit','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','end','getPreview','getVoiceQueues','preview','dialPreviewAutoRecallMe','transaction','value','direction','isEmpty','hopperIds','priority','ASC','scheduledAt','dialOrderByScheduledAt','DESC','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','recallme','UPDATE','CmCompany','CmList','List','dialActive','findOne','LOCK','Contact','Company','Queue','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getTimezones','timezones','utcOffset','getTimezone','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','undefined','limit','count','offset','set','json','update','then','sendStatus','name','status','send','map','CmHopper','rawAttributes','fieldName','type','key','model','query','keys','intersection','filters','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$notIn','$iLike','$notILike','$like','$overlap','$contains','$any','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch'];(function(_0x23bb20,_0x3ee15d){var _0x1283af=function(_0x35c344){while(--_0x35c344){_0x23bb20['push'](_0x23bb20['shift']());}};_0x1283af(++_0x3ee15d);}(_0x207c,0x1e8));var _0xc207=function(_0x54cef6,_0x146b0e){_0x54cef6=_0x54cef6-0x0;var _0x39aacf=_0x207c[_0x54cef6];return _0x39aacf;};'use strict';var moment=require('moment');var _=require(_0xc207('0x0'));var qs=require(_0xc207('0x1'));var logger=require(_0xc207('0x2'))(_0xc207('0x3'));var shared=require(_0xc207('0x4'));var db=require(_0xc207('0x5'))['db'];function respondWithResult(_0x1dd107,_0x4b9daa){_0x4b9daa=_0x4b9daa||0xc8;return function(_0x38ff02){if(_0x38ff02){return _0x1dd107['status'](_0x4b9daa)['json'](_0x38ff02);}};}function respondWithFilteredResult(_0x55023e,_0xc88789){return function(_0x314561){if(_0x314561){var _0x3395e4=typeof _0xc88789['offset']===_0xc207('0x6')&&typeof _0xc88789[_0xc207('0x7')]===_0xc207('0x6');var _0x4e10e8=_0x314561[_0xc207('0x8')];var _0x817576=_0x3395e4?0x0:_0xc88789[_0xc207('0x9')];var _0x13ec41=_0x3395e4?_0x314561[_0xc207('0x8')]:_0xc88789[_0xc207('0x9')]+_0xc88789['limit'];var _0x574425;if(_0x13ec41>=_0x4e10e8){_0x13ec41=_0x4e10e8;_0x574425=0xc8;}else{_0x574425=0xce;}_0x55023e['status'](_0x574425);return _0x55023e[_0xc207('0xa')]('Content-Range',_0x817576+'-'+_0x13ec41+'/'+_0x4e10e8)[_0xc207('0xb')](_0x314561);}return null;};}function saveUpdates(_0x2782ce,_0x59d401){return function(_0x3e1108){if(_0x3e1108){return _0x3e1108[_0xc207('0xc')](_0x2782ce)[_0xc207('0xd')](function(_0x32acbf){return _0x32acbf;});}return null;};}function handleEntityNotFound(_0xe993a0,_0x51e967){return function(_0xc62672){if(!_0xc62672){_0xe993a0[_0xc207('0xe')](0x194);}return _0xc62672;};}function handleError(_0x274bbd,_0x4031ad){_0x4031ad=_0x4031ad||0x1f4;return function(_0x4ef6c4){logger['error'](_0x4ef6c4['stack']);if(_0x4ef6c4[_0xc207('0xf')]){delete _0x4ef6c4[_0xc207('0xf')];}_0x274bbd[_0xc207('0x10')](_0x4031ad)[_0xc207('0x11')](_0x4ef6c4);};}exports['index']=function(_0x1bc70c,_0x282595){var _0x217d5e={},_0x5f288e={},_0x4129b8={'count':0x0,'rows':[]};var _0x488cc0=_[_0xc207('0x12')](db[_0xc207('0x13')][_0xc207('0x14')],function(_0x461f6a){return{'name':_0x461f6a[_0xc207('0x15')],'type':_0x461f6a[_0xc207('0x16')][_0xc207('0x17')]};});_0x5f288e[_0xc207('0x18')]=_[_0xc207('0x12')](_0x488cc0,_0xc207('0xf'));_0x5f288e[_0xc207('0x19')]=_[_0xc207('0x1a')](_0x1bc70c[_0xc207('0x19')]);_0x5f288e['filters']=_[_0xc207('0x1b')](_0x5f288e['model'],_0x5f288e[_0xc207('0x19')]);_0x5f288e[_0xc207('0x1c')]=_[_0xc207('0x1d')](_0x5f288e[_0xc207('0x1c')],[_0xc207('0x1e'),_0xc207('0x1f'),_0xc207('0x20'),_0xc207('0x21'),_0xc207('0x22'),_0xc207('0x23'),_0xc207('0x24'),_0xc207('0x25'),_0xc207('0x26'),_0xc207('0x27'),_0xc207('0x28'),'$in',_0xc207('0x29'),'$like','$notLike',_0xc207('0x2a'),_0xc207('0x2b'),_0xc207('0x2c'),_0xc207('0x2d'),_0xc207('0x2e'),'$contained',_0xc207('0x2f')]);_0x217d5e[_0xc207('0x30')]=_[_0xc207('0x1b')](_0x5f288e[_0xc207('0x18')],qs[_0xc207('0x31')](_0x1bc70c[_0xc207('0x19')][_0xc207('0x31')]));_0x217d5e[_0xc207('0x30')]=_0x217d5e[_0xc207('0x30')][_0xc207('0x32')]?_0x217d5e[_0xc207('0x30')]:_0x5f288e[_0xc207('0x18')];if(!_0x1bc70c[_0xc207('0x19')]['hasOwnProperty'](_0xc207('0x33'))){_0x217d5e[_0xc207('0x7')]=qs[_0xc207('0x7')](_0x1bc70c[_0xc207('0x19')][_0xc207('0x7')]);_0x217d5e[_0xc207('0x9')]=qs['offset'](_0x1bc70c[_0xc207('0x19')][_0xc207('0x9')]);}_0x217d5e[_0xc207('0x34')]=qs[_0xc207('0x35')](_0x1bc70c['query'][_0xc207('0x35')]);_0x217d5e[_0xc207('0x36')]=qs[_0xc207('0x1c')](_[_0xc207('0x37')](_0x1bc70c[_0xc207('0x19')],_0x5f288e[_0xc207('0x1c')]),_0x488cc0);if(_0x1bc70c[_0xc207('0x19')][_0xc207('0x38')]){_0x217d5e[_0xc207('0x36')]=_['merge'](_0x217d5e['where'],{'$or':_[_0xc207('0x12')](_0x488cc0,function(_0x2a9701){if(_0x2a9701[_0xc207('0x16')]!==_0xc207('0x39')){var _0x591a7f={};_0x591a7f[_0x2a9701[_0xc207('0xf')]]={'$like':'%'+_0x1bc70c[_0xc207('0x19')][_0xc207('0x38')]+'%'};return _0x591a7f;}})});}_0x217d5e=_[_0xc207('0x3a')]({},_0x217d5e,_0x1bc70c[_0xc207('0x3b')]);var _0x5e3177={'where':_0x217d5e[_0xc207('0x36')]};return db[_0xc207('0x13')]['count'](_0x5e3177)[_0xc207('0xd')](function(_0x49bada){_0x4129b8[_0xc207('0x8')]=_0x49bada;if(_0x1bc70c[_0xc207('0x19')]['includeAll']){_0x217d5e[_0xc207('0x3c')]=[{'all':!![]}];}return db[_0xc207('0x13')][_0xc207('0x3d')](_0x217d5e);})['then'](function(_0x5b3041){_0x4129b8[_0xc207('0x3e')]=_0x5b3041;return _0x4129b8;})[_0xc207('0xd')](respondWithFilteredResult(_0x282595,_0x217d5e))[_0xc207('0x3f')](handleError(_0x282595,null));};exports[_0xc207('0x40')]=function(_0x4c3e29,_0x3a6f45){var _0x47cdc4={'raw':!![],'where':{'id':_0x4c3e29['params']['id']}},_0x4cce4f={};_0x4cce4f['model']=_[_0xc207('0x1a')](db[_0xc207('0x13')][_0xc207('0x14')]);_0x4cce4f['query']=_[_0xc207('0x1a')](_0x4c3e29[_0xc207('0x19')]);_0x4cce4f[_0xc207('0x1c')]=_[_0xc207('0x1b')](_0x4cce4f['model'],_0x4cce4f[_0xc207('0x19')]);_0x47cdc4[_0xc207('0x30')]=_[_0xc207('0x1b')](_0x4cce4f[_0xc207('0x18')],qs[_0xc207('0x31')](_0x4c3e29['query'][_0xc207('0x31')]));_0x47cdc4[_0xc207('0x30')]=_0x47cdc4[_0xc207('0x30')][_0xc207('0x32')]?_0x47cdc4[_0xc207('0x30')]:_0x4cce4f[_0xc207('0x18')];if(_0x4c3e29[_0xc207('0x19')][_0xc207('0x41')]){_0x47cdc4[_0xc207('0x3c')]=[{'all':!![]}];}_0x47cdc4=_['merge']({},_0x47cdc4,_0x4c3e29[_0xc207('0x3b')]);return db[_0xc207('0x13')]['find'](_0x47cdc4)[_0xc207('0xd')](handleEntityNotFound(_0x3a6f45,null))[_0xc207('0xd')](respondWithResult(_0x3a6f45,null))[_0xc207('0x3f')](handleError(_0x3a6f45,null));};exports[_0xc207('0x42')]=function(_0x3ce5a3,_0x5b663f){return db[_0xc207('0x13')][_0xc207('0x42')](_0x3ce5a3[_0xc207('0x43')],{})['then'](respondWithResult(_0x5b663f,0xc9))[_0xc207('0x3f')](handleError(_0x5b663f,null));};exports[_0xc207('0xc')]=function(_0x2967ad,_0x45536e){if(_0x2967ad['body']['id']){delete _0x2967ad['body']['id'];}return db[_0xc207('0x13')][_0xc207('0x44')]({'where':{'id':_0x2967ad[_0xc207('0x45')]['id']}})[_0xc207('0xd')](handleEntityNotFound(_0x45536e,null))[_0xc207('0xd')](saveUpdates(_0x2967ad[_0xc207('0x43')],null))[_0xc207('0xd')](respondWithResult(_0x45536e,null))[_0xc207('0x3f')](handleError(_0x45536e,null));};exports[_0xc207('0x46')]=function(_0x212552,_0x2afcd1){return db[_0xc207('0x13')]['describe']()['then'](respondWithResult(_0x2afcd1,null))[_0xc207('0x3f')](handleError(_0x2afcd1,null));};exports[_0xc207('0x47')]=function(_0x2468d0,_0x480f12){var _0x2b89e0;var _0x3f712d=_0x2468d0[_0xc207('0x45')]['id'];return db[_0xc207('0x13')]['find']({'where':{'id':_0x2468d0[_0xc207('0x45')]['id']}})['then'](handleEntityNotFound(_0x480f12,null))[_0xc207('0xd')](function(_0x50a504){if(_0x50a504){return _0x50a504['destroy']()[_0xc207('0xd')](function(_0x30f02e){return _0x30f02e;});}})['then'](function(_0x552edd){_0x2b89e0=_0x552edd;if(_0x552edd){if(_0x552edd['VoiceQueueId']||_0x552edd[_0xc207('0x48')]){return db[_0x552edd[_0xc207('0x49')]?_0xc207('0x4a'):_0xc207('0x4b')][_0xc207('0x44')]({'where':{'id':_0x552edd[_0xc207('0x49')]?_0x552edd[_0xc207('0x49')]:_0x552edd[_0xc207('0x48')]},'attributes':['id','name'],'raw':!![]});}}})[_0xc207('0xd')](function(_0x1435a9){var _0x5aedd3={};if(_0x1435a9){_['merge'](_0x5aedd3,_[_0xc207('0x4c')](_0x2b89e0['dataValues'],['createdAt',_0xc207('0x4d'),'id']));_0x5aedd3[_0xc207('0x4e')]=0x15;_0x5aedd3[_0xc207('0x4f')]=_0xc207('0x50');_0x5aedd3[_0xc207('0x51')]=_0x1435a9[_0xc207('0xf')];_0x5aedd3[_0xc207('0x52')]=_0x2468d0[_0xc207('0x53')][_0xc207('0xf')];_0x5aedd3[_0xc207('0x54')]=_0x2468d0[_0xc207('0x53')]['id'];_0x5aedd3['deleted']=!![];_0x5aedd3['deletedat']=moment()[_0xc207('0x55')](_0xc207('0x56'));_0x5aedd3[_0xc207('0x57')]=_0x2b89e0[_0xc207('0x58')];_0x5aedd3[_0xc207('0x59')]=_0x2b89e0[_0xc207('0x49')]?_0xc207('0x5a'):_0xc207('0x5b');return db[_0xc207('0x5c')]['find']({'where':{'id':_0x5aedd3[_0xc207('0x5d')]},'attributes':[_0xc207('0x5e'),_0xc207('0x5f')]})[_0xc207('0xd')](function(_0x569c85){if(!_[_0xc207('0x60')](_0x480f12)&&!_[_0xc207('0x60')](_0x569c85[_0xc207('0x5e')])){_0x5aedd3[_0xc207('0x61')]=_0x569c85[_0xc207('0x5e')];if(!_[_0xc207('0x60')](_0x569c85[_0xc207('0x5f')])){_0x5aedd3['calleridname']+='\x20'+_0x569c85[_0xc207('0x5f')];}}})[_0xc207('0x62')](function(){return db[_0xc207('0x63')][_0xc207('0x42')](_0x5aedd3);});}})['then'](function(_0xc7812){return db['CmHopperAdditionalPhone']['destroy']({'where':{'CmHopperId':_0x3f712d}});})[_0xc207('0xd')](function(){return _0x480f12[_0xc207('0x10')](0xcc)[_0xc207('0x64')]();})[_0xc207('0x3f')](handleError(_0x480f12,null));};exports[_0xc207('0x65')]=function(_0x3b1b4c,_0x35a0d8){var _0x33c372=[];return db[_0xc207('0x5c')][_0xc207('0x46')]()[_0xc207('0xd')](function(_0x2f97bf){_0x33c372=_[_0xc207('0x1a')](_0x2f97bf);return _0x3b1b4c[_0xc207('0x53')][_0xc207('0x66')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xc207('0x67')},'attributes':['id','dialOrderByScheduledAt',_0xc207('0x68')],'raw':!![]});})[_0xc207('0xd')](function(_0x2ade23){if(_0x2ade23&&_0x2ade23['length']){return db['sequelize'][_0xc207('0x69')](function(_0x3ac0dd){var _0x2f18a2={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xc207('0x56'))},'VoiceQueueId':{'$in':_[_0xc207('0x12')](_0x2ade23,'id')},'$or':[{'UserId':null},{'UserId':_0x3b1b4c[_0xc207('0x53')]['id']}]};var _0x4967b4={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x2ade23)['filter']([_0xc207('0x68'),0x0])['map']('id')[_0xc207('0x6a')]()},'$or':[{'UserId':null},{'UserId':_0x3b1b4c[_0xc207('0x53')]['id']}]};var _0x3cca53={'$or':[_0x2f18a2,_0x4967b4]};var _0x4b197=[];if(_0x3b1b4c[_0xc207('0x43')][_0xc207('0x6b')]&&_0x3b1b4c[_0xc207('0x43')][_0xc207('0x6b')]==='prev'){if(!_[_0xc207('0x6c')](_0x3b1b4c[_0xc207('0x43')][_0xc207('0x6d')])){_0x3cca53['id']={'$in':_0x3b1b4c[_0xc207('0x43')][_0xc207('0x6d')]};}_0x4b197=[[_0xc207('0x6e'),_0xc207('0x6f')],[_0xc207('0x70'),_0x2ade23[0x0][_0xc207('0x71')]===_0xc207('0x6f')?_0xc207('0x72'):'ASC'],db[_0xc207('0x73')][_0xc207('0x74')](_0xc207('0x75')),['id',_0xc207('0x72')]];}else{if(!_['isEmpty'](_0x3b1b4c['body'][_0xc207('0x6d')])){_0x3cca53['id']={'$notIn':_0x3b1b4c[_0xc207('0x43')][_0xc207('0x6d')]};}_0x4b197=[[_0xc207('0x6e'),'DESC'],[_0xc207('0x70'),_0x2ade23[0x0][_0xc207('0x71')]],db[_0xc207('0x73')]['literal'](_0xc207('0x76')),['id',_0xc207('0x6f')]];}return db[_0xc207('0x13')]['findOne']({'attributes':['id',_0xc207('0x77'),'phone',_0xc207('0x78')],'where':_0x3cca53,'order':_0x4b197,'transaction':_0x3ac0dd,'lock':_0x3ac0dd['LOCK'][_0xc207('0x79')],'include':[{'model':db[_0xc207('0x5c')],'as':'Contact','attributes':_0x33c372,'include':[{'model':db[_0xc207('0x7a')],'as':'Company','attributes':['id',_0xc207('0xf')]}]},{'model':db[_0xc207('0x7b')],'as':_0xc207('0x7c'),'attributes':['id',_0xc207('0xf')]},{'model':db[_0xc207('0x4a')],'as':'Queue','attributes':['id','name',_0xc207('0x7d')]}]})[_0xc207('0xd')](function(_0x5320a9){if(_0x5320a9){return _0x5320a9[_0xc207('0xc')]({'UserId':_0x3b1b4c[_0xc207('0x53')]['id']},{'transaction':_0x3ac0dd});}});});}})['then'](handleEntityNotFound(_0x35a0d8,null))[_0xc207('0xd')](respondWithResult(_0x35a0d8,null))[_0xc207('0x3f')](handleError(_0x35a0d8,null));};exports['getPreviewRecall']=function(_0x2f5938,_0x2548bd,_0x3748de){var _0x1d550d=[];var _0x13c415=_0x2f5938[_0xc207('0x45')]['id'];var _0x5be1e7=_0x2f5938['user']['id'];return db[_0xc207('0x5c')][_0xc207('0x46')]()[_0xc207('0xd')](function(_0x15b13d){_0x1d550d=_[_0xc207('0x1a')](_0x15b13d);return db['sequelize'][_0xc207('0x69')](function(_0x4f79b3){const _0x6b1089={'id':_0x13c415};return db[_0xc207('0x13')][_0xc207('0x7e')]({'attributes':['id',_0xc207('0x77'),_0xc207('0x78')],'where':_0x6b1089,'transaction':_0x4f79b3,'lock':_0x4f79b3[_0xc207('0x7f')]['UPDATE'],'include':[{'model':db[_0xc207('0x5c')],'as':_0xc207('0x80'),'attributes':_0x1d550d,'include':[{'model':db['CmCompany'],'as':_0xc207('0x81'),'attributes':['id',_0xc207('0xf')]}]},{'model':db[_0xc207('0x7b')],'as':_0xc207('0x7c'),'attributes':['id',_0xc207('0xf')]},{'model':db[_0xc207('0x4a')],'as':_0xc207('0x82'),'attributes':['id',_0xc207('0xf'),_0xc207('0x7d')]}]})[_0xc207('0xd')](function(_0x473560){if(_0x473560){return _0x473560[_0xc207('0xc')]({'UserId':_0x5be1e7},{'transaction':_0x4f79b3});}});});})[_0xc207('0xd')](handleEntityNotFound(_0x2548bd,null))['then'](respondWithResult(_0x2548bd,null))[_0xc207('0x3f')](handleError(_0x2548bd,null));};exports[_0xc207('0x83')]=function(_0x2f4efd,_0x266e65){return _0x2f4efd['user'][_0xc207('0x66')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xc207('0x67')},'attributes':['id'],'raw':!![]})['then'](function(_0x53cb21){if(_0x53cb21&&_0x53cb21[_0xc207('0x32')]){return db[_0xc207('0x13')][_0xc207('0x8')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xc207('0x55')](_0xc207('0x56'))},'VoiceQueueId':{'$in':_[_0xc207('0x12')](_0x53cb21,'id')},'$or':[{'UserId':null},{'UserId':_0x2f4efd['user']['id']}]}});}return 0x0;})[_0xc207('0xd')](function(_0x503f62){if(!_[_0xc207('0x60')](_0x503f62)&&_[_0xc207('0x84')](_0x503f62)){return _0x266e65[_0xc207('0x10')](0xc8)[_0xc207('0xb')]({'contacts':_0x503f62});}else{logger['error'](_0xc207('0x85'),_0xc207('0x83'),0x194,'entity\x20not\x20found');_0x266e65[_0xc207('0xe')](0x194);}})[_0xc207('0x3f')](handleError(_0x266e65,null));};exports[_0xc207('0x86')]=function(_0x1365f4,_0x5af9f6){var _0xc814f3=shared[_0xc207('0x87')];var _0x2c00fb=[];_[_0xc207('0x12')](_0xc814f3,function(_0x511bd9){_0x2c00fb['push']({'id':_0x511bd9['name'],'name':_0x511bd9['name'],'utcOffset':_0x511bd9[_0xc207('0x88')]});});return _0x5af9f6[_0xc207('0x10')](0xc8)[_0xc207('0xb')]({'tz':_0x2c00fb});};exports[_0xc207('0x89')]=function(_0x504c6b,_0x4f928b){var _0x341c95=shared['timezones'];var _0x50f110={};if(!_[_0xc207('0x60')](_0x341c95[_0x504c6b[_0xc207('0x43')]['id']]))_0x50f110=_0x341c95[_0x504c6b[_0xc207('0x43')]['id']];return _0x4f928b[_0xc207('0x10')](0xc8)[_0xc207('0xb')](_0x50f110);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 0357b57..110c505 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 _0xda19=['define','CmHopper','cm_hopper','scheduledat','priority','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./cmHopper.attributes','exports'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xda19,0xd5));var _0x9da1=function(_0x3f2a23,_0x4d98e7){_0x3f2a23=_0x3f2a23-0x0;var _0x55bcd0=_0xda19[_0x3f2a23];return _0x55bcd0;};'use strict';var _=require('lodash');var util=require(_0x9da1('0x0'));var logger=require(_0x9da1('0x1'))('api');var moment=require(_0x9da1('0x2'));var BPromise=require('bluebird');var rp=require(_0x9da1('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9da1('0x4'));var config=require(_0x9da1('0x5'));var attributes=require(_0x9da1('0x6'));module[_0x9da1('0x7')]=function(_0x156faf,_0x2dcbc6){return _0x156faf[_0x9da1('0x8')](_0x9da1('0x9'),attributes,{'tableName':_0x9da1('0xa'),'paranoid':![],'indexes':[{'name':_0x9da1('0xb'),'fields':['scheduledat']},{'name':'phone','fields':['phone']},{'name':_0x9da1('0xc'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0x687b=['lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','scheduledat','phone','priority'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x687b,0x14a));var _0xb687=function(_0x26d678,_0x273258){_0x26d678=_0x26d678-0x0;var _0x4ad538=_0x687b[_0x26d678];return _0x4ad538;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var logger=require(_0xb687('0x2'))(_0xb687('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb687('0x4'));var fs=require('fs');var path=require(_0xb687('0x5'));var rimraf=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var attributes=require(_0xb687('0x8'));module[_0xb687('0x9')]=function(_0x16ccf3,_0xf43a1f){return _0x16ccf3[_0xb687('0xa')](_0xb687('0xb'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xb687('0xc'),'fields':[_0xb687('0xc')]},{'name':'phone','fields':[_0xb687('0xd')]},{'name':_0xb687('0xe'),'fields':[_0xb687('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 4441686..4d9cca5 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 _0x84bb=['\x22%s\x22','\x20,\x201,\x20null','GetContactRecallMe','UserId','GetCmHopperPreview','phone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','List','NOW()','lodash','util','moment','bluebird','rpc','GetCmHopper','CmHopper','options','raw','where','attributes','limit','include','map','model','then','debug','stringify','error','message','ShowCmHopper','find','catch','CreateCmHopper','create','body','update','info','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','UpdateCmHopper','destroy','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause','length','push','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','active','MoveContactManagedDialer','CountReScheduled','findAll','COUNT','literal','`scheduledat`\x20>=\x20','format'];(function(_0xe6ff6e,_0x1c341e){var _0x3d98db=function(_0x31fd42){while(--_0x31fd42){_0xe6ff6e['push'](_0xe6ff6e['shift']());}};_0x3d98db(++_0x1c341e);}(_0x84bb,0x1d7));var _0xb84b=function(_0x2a2b9d,_0x29ad81){_0x2a2b9d=_0x2a2b9d-0x0;var _0x314b2d=_0x84bb[_0x2a2b9d];return _0x314b2d;};'use strict';var _=require(_0xb84b('0x0'));var util=require(_0xb84b('0x1'));var moment=require(_0xb84b('0x2'));var BPromise=require(_0xb84b('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0xb84b('0x4'));exports[_0xb84b('0x5')]=function(_0x257657){var _0x112af5=this;return new Promise(function(_0x2136e3,_0x22e3c9){return db[_0xb84b('0x6')]['findAll']({'raw':_0x257657[_0xb84b('0x7')]?_0x257657[_0xb84b('0x7')][_0xb84b('0x8')]===undefined?!![]:![]:!![],'where':_0x257657[_0xb84b('0x7')]?_0x257657['options'][_0xb84b('0x9')]||null:null,'attributes':_0x257657[_0xb84b('0x7')]?_0x257657[_0xb84b('0x7')][_0xb84b('0xa')]||null:null,'limit':_0x257657['options']?_0x257657['options'][_0xb84b('0xb')]||null:null,'include':_0x257657[_0xb84b('0x7')]?_0x257657[_0xb84b('0x7')][_0xb84b('0xc')]?_['map'](_0x257657[_0xb84b('0x7')][_0xb84b('0xc')],function(_0x33867a){return{'model':db[_0x33867a['model']],'as':_0x33867a['as'],'attributes':_0x33867a['attributes'],'include':_0x33867a[_0xb84b('0xc')]?_[_0xb84b('0xd')](_0x33867a[_0xb84b('0xc')],function(_0x28ce10){return{'model':db[_0x28ce10[_0xb84b('0xe')]],'as':_0x28ce10['as'],'attributes':_0x28ce10['attributes'],'include':_0x28ce10[_0xb84b('0xc')]?_[_0xb84b('0xd')](_0x28ce10['include'],function(_0x1baf8d){return{'model':db[_0x1baf8d[_0xb84b('0xe')]],'as':_0x1baf8d['as'],'attributes':_0x1baf8d[_0xb84b('0xa')]};}):[]};}):[]};}):[]:[]})[_0xb84b('0xf')](function(_0x219e4c){logger['info'](_0xb84b('0x5'),_0x257657);logger[_0xb84b('0x10')](_0xb84b('0x5'),_0x257657,JSON[_0xb84b('0x11')](_0x219e4c));_0x2136e3(_0x219e4c);})['catch'](function(_0x35b413){logger[_0xb84b('0x12')]('GetCmHopper',_0x35b413[_0xb84b('0x13')],_0x257657);_0x22e3c9(_0x112af5[_0xb84b('0x12')](0x1f4,_0x35b413[_0xb84b('0x13')]));});});};exports[_0xb84b('0x14')]=function(_0x5baf97){var _0xecc36d=this;return new Promise(function(_0x43785d,_0x220a3f){return db[_0xb84b('0x6')][_0xb84b('0x15')]({'raw':_0x5baf97[_0xb84b('0x7')]?_0x5baf97[_0xb84b('0x7')][_0xb84b('0x8')]===undefined?!![]:![]:!![],'where':_0x5baf97[_0xb84b('0x7')]?_0x5baf97[_0xb84b('0x7')][_0xb84b('0x9')]||null:null,'attributes':_0x5baf97['options']?_0x5baf97[_0xb84b('0x7')][_0xb84b('0xa')]||null:null,'include':_0x5baf97[_0xb84b('0x7')]?_0x5baf97['options'][_0xb84b('0xc')]?_['map'](_0x5baf97[_0xb84b('0x7')][_0xb84b('0xc')],function(_0x577176){return{'model':db[_0x577176[_0xb84b('0xe')]],'as':_0x577176['as'],'attributes':_0x577176[_0xb84b('0xa')],'include':_0x577176[_0xb84b('0xc')]?_['map'](_0x577176[_0xb84b('0xc')],function(_0x3674dc){return{'model':db[_0x3674dc[_0xb84b('0xe')]],'as':_0x3674dc['as'],'attributes':_0x3674dc[_0xb84b('0xa')],'include':_0x3674dc[_0xb84b('0xc')]?_['map'](_0x3674dc[_0xb84b('0xc')],function(_0x3a146a){return{'model':db[_0x3a146a[_0xb84b('0xe')]],'as':_0x3a146a['as'],'attributes':_0x3a146a[_0xb84b('0xa')]};}):[]};}):[]};}):[]:[]})[_0xb84b('0xf')](function(_0x211248){logger['info']('ShowCmHopper',_0x5baf97);logger[_0xb84b('0x10')](_0xb84b('0x14'),_0x5baf97,JSON['stringify'](_0x211248));_0x43785d(_0x211248);})[_0xb84b('0x16')](function(_0x4f794b){logger[_0xb84b('0x12')]('ShowCmHopper',_0x4f794b['message'],_0x5baf97);_0x220a3f(_0xecc36d[_0xb84b('0x12')](0x1f4,_0x4f794b[_0xb84b('0x13')]));});});};exports[_0xb84b('0x17')]=function(_0x5aa66f){var _0x25602d=this;return new Promise(function(_0x24c8ee,_0xabe437){return db[_0xb84b('0x6')][_0xb84b('0x18')](_0x5aa66f[_0xb84b('0x19')],{'raw':_0x5aa66f[_0xb84b('0x7')]?_0x5aa66f[_0xb84b('0x7')][_0xb84b('0x8')]===undefined?!![]:![]:!![]})['then'](function(_0x2aa147){logger['info'](_0xb84b('0x17'),_0x5aa66f);logger[_0xb84b('0x10')]('CreateCmHopper',_0x5aa66f,JSON[_0xb84b('0x11')](_0x2aa147));_0x24c8ee(_0x2aa147);})[_0xb84b('0x16')](function(_0x4043b1){logger[_0xb84b('0x12')]('CreateCmHopper',_0x4043b1[_0xb84b('0x13')],_0x5aa66f);_0xabe437(_0x25602d['error'](0x1f4,_0x4043b1[_0xb84b('0x13')]));});});};exports['UpdateCmHopper']=function(_0x399a68){var _0x2ec942=this;return new Promise(function(_0x1bc9ed,_0x761df1){return db[_0xb84b('0x6')][_0xb84b('0x1a')](_0x399a68[_0xb84b('0x19')],{'raw':_0x399a68[_0xb84b('0x7')]?_0x399a68[_0xb84b('0x7')][_0xb84b('0x8')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x399a68['options']?_0x399a68[_0xb84b('0x7')][_0xb84b('0x9')]||null:null,'attributes':_0x399a68[_0xb84b('0x7')]?_0x399a68['options'][_0xb84b('0xa')]||null:null,'limit':_0x399a68[_0xb84b('0x7')]?_0x399a68[_0xb84b('0x7')][_0xb84b('0xb')]||null:null})[_0xb84b('0xf')](function(_0x163dd0){logger[_0xb84b('0x1b')]('UpdateCmHopper',_0x399a68);logger[_0xb84b('0x1b')](_0xb84b('0x1c'),JSON[_0xb84b('0x11')](_0x399a68['options']['where']),_0x399a68[_0xb84b('0x19')]['active']);logger[_0xb84b('0x10')](_0xb84b('0x1d'),_0x399a68,JSON[_0xb84b('0x11')](_0x163dd0));_0x1bc9ed(_0x163dd0);})['catch'](function(_0x45e6e6){logger[_0xb84b('0x12')](_0xb84b('0x1d'),_0x45e6e6[_0xb84b('0x13')],_0x399a68);_0x761df1(_0x2ec942[_0xb84b('0x12')](0x1f4,_0x45e6e6[_0xb84b('0x13')]));});});};exports['DestroyCmHopper']=function(_0x16eda4){var _0x24d3da=this;return new Promise(function(_0x38e285,_0x12935c){return db[_0xb84b('0x6')][_0xb84b('0x1e')]({'where':_0x16eda4[_0xb84b('0x7')]?_0x16eda4[_0xb84b('0x7')][_0xb84b('0x9')]||null:null})[_0xb84b('0xf')](function(_0x21aaa3){logger['info']('DestroyCmHopper',_0x16eda4);logger[_0xb84b('0x10')]('DestroyCmHopper',_0x16eda4,JSON['stringify'](_0x21aaa3));_0x38e285(_0x21aaa3);})[_0xb84b('0x16')](function(_0x52c248){logger['error'](_0xb84b('0x1f'),_0x52c248[_0xb84b('0x13')],_0x16eda4);_0x12935c(_0x24d3da[_0xb84b('0x12')](0x1f4,_0x52c248[_0xb84b('0x13')]));});});};exports[_0xb84b('0x20')]=function(_0x490121){var _0x4c8692=this;return new Promise(function(_0x58e9b5,_0x98596a){return db[_0xb84b('0x21')][_0xb84b('0x22')]()[_0xb84b('0xf')](function(_0xb545a7){return db[_0xb84b('0x23')][_0xb84b('0x24')](function(_0x16e540){return db[_0xb84b('0x6')]['findAll']({'where':_0x490121[_0xb84b('0x7')]?_0x490121[_0xb84b('0x7')][_0xb84b('0x9')]||null:null,'attributes':_0x490121[_0xb84b('0x7')]?_0x490121[_0xb84b('0x7')]['attributes']||null:null,'limit':_0x490121['options']?_0x490121[_0xb84b('0x7')][_0xb84b('0xb')]||null:null,'order':_0x490121[_0xb84b('0x7')]?_0x490121[_0xb84b('0x7')][_0xb84b('0x25')]||null:null,'transaction':_0x16e540,'lock':_0x16e540[_0xb84b('0x26')][_0xb84b('0x27')],'include':[{'model':db[_0xb84b('0x21')],'as':_0xb84b('0x28'),'attributes':_[_0xb84b('0x29')](_0xb545a7)},{'model':db[_0xb84b('0x2a')],'as':_0xb84b('0x2b'),'attributes':['id',_0xb84b('0x2c'),_0xb84b('0x2d')]}]})[_0xb84b('0xf')](function(_0xd9e8e1){var _0x232447=[];var _0x7a698c=[];for(var _0x406fcd=0x0;_0x406fcd<_0xd9e8e1[_0xb84b('0x2e')];_0x406fcd+=0x1){var _0x595108=_0xd9e8e1[_0x406fcd]['UserId'];if(_0x595108===null){_0x232447[_0xb84b('0x2f')](_0xd9e8e1[_0x406fcd][_0xb84b('0x1a')](_0x490121['body'],{'transaction':_0x16e540}));}else if(!_0x7a698c[_0xb84b('0x30')](_0x595108)){_0x7a698c[_0xb84b('0x2f')](_0x595108);_0x232447[_0xb84b('0x2f')](_0xd9e8e1[_0x406fcd]['update'](_0x490121[_0xb84b('0x19')],{'transaction':_0x16e540}));}}return BPromise[_0xb84b('0x31')](_0x232447);});})[_0xb84b('0xf')](function(_0x157d5b){logger['info'](_0xb84b('0x20'),_0x490121);if(_0x157d5b[_0xb84b('0x2e')]>0x0){logger[_0xb84b('0x1b')](_0xb84b('0x32'),_0x157d5b[0x0][_0xb84b('0x33')]['id'],_0x157d5b[0x0][_0xb84b('0x33')][_0xb84b('0x34')],_0x157d5b[0x0][_0xb84b('0x33')][_0xb84b('0x35')]);}logger[_0xb84b('0x10')](_0xb84b('0x20'),_0x490121,JSON[_0xb84b('0x11')](_0x157d5b));_0x58e9b5(_0x157d5b);})[_0xb84b('0x16')](function(_0x193c56){logger[_0xb84b('0x12')]('GetContactDialer',_0x193c56[_0xb84b('0x13')],_0x490121);_0x98596a(_0x4c8692['error'](0x1f4,_0x193c56['message']));});});});};exports[_0xb84b('0x36')]=function(_0x5b16ce){var _0x40163b=this;return new Promise(function(_0x48b620,_0x2ffd4e){return db[_0xb84b('0x23')][_0xb84b('0x24')](function(_0xe30d39){return db['CmHopperFinal'][_0xb84b('0x18')](_0x5b16ce[_0xb84b('0x19')],{'raw':_0x5b16ce[_0xb84b('0x7')]?_0x5b16ce[_0xb84b('0x7')][_0xb84b('0x8')]===undefined?!![]:![]:!![],'transaction':_0xe30d39})[_0xb84b('0xf')](function(){logger[_0xb84b('0x1b')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xb84b('0x11')](_0x5b16ce['options'][_0xb84b('0x9')]),_0x5b16ce[_0xb84b('0x7')][_0xb84b('0x9')][_0xb84b('0x35')]);return db[_0xb84b('0x6')][_0xb84b('0x1e')]({'where':_0x5b16ce['options']?_0x5b16ce[_0xb84b('0x7')]['where']||null:null,'transaction':_0xe30d39});});})[_0xb84b('0xf')](function(_0x3c6fd5){logger[_0xb84b('0x1b')](_0xb84b('0x36'),_0x5b16ce);logger[_0xb84b('0x10')]('MoveContactManagedDialer',_0x5b16ce,JSON[_0xb84b('0x11')](_0x3c6fd5));_0x48b620(_0x3c6fd5);})['catch'](function(_0x3146da){logger[_0xb84b('0x12')]('MoveContactManagedDialer',_0x3146da['message'],_0x5b16ce);_0x2ffd4e(_0x40163b['error'](0x1f4,_0x3146da[_0xb84b('0x13')]));});});};exports[_0xb84b('0x37')]=function(_0x240002){var _0x5ec5ad=this;return new Promise(function(_0x5b09e3,_0x237884){return db[_0xb84b('0x6')][_0xb84b('0x38')]({'raw':_0x240002[_0xb84b('0x7')]?_0x240002[_0xb84b('0x7')][_0xb84b('0x8')]===undefined?!![]:![]:!![],'where':_0x240002['options']?_0x240002['options'][_0xb84b('0x9')]||null:null,'attributes':[[db[_0xb84b('0x23')]['fn'](_0xb84b('0x39'),db['sequelize']['fn']('IF',db[_0xb84b('0x23')][_0xb84b('0x3a')](_0xb84b('0x3b')+util[_0xb84b('0x3c')](_0xb84b('0x3d'),moment()[_0xb84b('0x3c')]('YYYY-MM-DD\x20HH:mm:ss'))+_0xb84b('0x3e')))),'contactsRescheduled']]})[_0xb84b('0xf')](function(_0x27d67d){logger['info']('CountReScheduled',_0x240002);logger[_0xb84b('0x10')](_0xb84b('0x37'),_0x240002,JSON[_0xb84b('0x11')](_0x27d67d));_0x5b09e3(_0x27d67d);})[_0xb84b('0x16')](function(_0x48e020){logger[_0xb84b('0x12')](_0xb84b('0x37'),_0x48e020[_0xb84b('0x13')],_0x240002);_0x237884(_0x5ec5ad[_0xb84b('0x12')](0x1f4,_0x48e020['message']));});});};exports[_0xb84b('0x3f')]=function(_0x440c21){var _0xbe1b84=this;return new Promise(function(_0xc82da5,_0xb7eb93){return db[_0xb84b('0x21')]['describe']()[_0xb84b('0xf')](function(){return db[_0xb84b('0x23')][_0xb84b('0x24')](function(_0x1b0427){return db[_0xb84b('0x6')]['findAll']({'where':_0x440c21['options']?_0x440c21[_0xb84b('0x7')][_0xb84b('0x9')]||null:null,'attributes':_0x440c21[_0xb84b('0x7')]?_0x440c21[_0xb84b('0x7')]['attributes']||null:null,'limit':0x1,'order':_0x440c21[_0xb84b('0x7')]?_0x440c21[_0xb84b('0x7')][_0xb84b('0x25')]||null:null,'group':db[_0xb84b('0x6')][_0xb84b('0x40')],'transaction':_0x1b0427,'lock':_0x1b0427['LOCK'][_0xb84b('0x27')],'include':_0x440c21['options']?_0x440c21['options'][_0xb84b('0xc')]?_[_0xb84b('0xd')](_0x440c21['options'][_0xb84b('0xc')],function(_0x164a0d){return{'model':db[_0x164a0d['model']],'as':_0x164a0d['as'],'attributes':_0x164a0d[_0xb84b('0xa')],'include':_0x164a0d['include']?_[_0xb84b('0xd')](_0x164a0d[_0xb84b('0xc')],function(_0x270666){return{'model':db[_0x270666[_0xb84b('0xe')]],'as':_0x270666['as'],'attributes':_0x270666[_0xb84b('0xa')],'include':_0x270666['include']?_[_0xb84b('0xd')](_0x270666[_0xb84b('0xc')],function(_0x4475dc){return{'model':db[_0x4475dc[_0xb84b('0xe')]],'as':_0x4475dc['as'],'attributes':_0x4475dc[_0xb84b('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xb302b4){var _0x44d802=[];for(var _0x34373a=0x0;_0x34373a<_0xb302b4[_0xb84b('0x2e')];_0x34373a+=0x1){_0x44d802[_0xb84b('0x2f')](_0xb302b4[_0x34373a][_0xb84b('0x1a')](_0x440c21['body'],{'transaction':_0x1b0427}));}return BPromise[_0xb84b('0x31')](_0x44d802);});})[_0xb84b('0xf')](function(_0x44e6c3){logger[_0xb84b('0x1b')](_0xb84b('0x3f'),_0x440c21);logger[_0xb84b('0x10')]('GetContactRecallMe',_0x440c21,JSON['stringify'](_0x44e6c3));_0xc82da5(_0x44e6c3);})[_0xb84b('0x16')](function(_0x2477bb){logger[_0xb84b('0x12')](_0xb84b('0x3f'),_0x2477bb[_0xb84b('0x13')],_0x440c21);_0xb7eb93(_0xbe1b84[_0xb84b('0x12')](0x1f4,_0x2477bb[_0xb84b('0x13')]));});});});};exports[_0xb84b('0x41')]=function(_0x2055ce){var _0xa62ba5=this;return new Promise(function(_0xef5ee1,_0x146591){db[_0xb84b('0x21')][_0xb84b('0x22')]()['then'](function(_0x4a809e){return db[_0xb84b('0x6')][_0xb84b('0x38')]({'raw':_0x2055ce[_0xb84b('0x7')]?_0x2055ce[_0xb84b('0x7')][_0xb84b('0x8')]===undefined?!![]:![]:!![],'where':_0x2055ce[_0xb84b('0x7')]?_0x2055ce['options'][_0xb84b('0x9')]||null:null,'attributes':_0x2055ce['options']?_0x2055ce[_0xb84b('0x7')][_0xb84b('0xa')]||null:null,'limit':_0x2055ce['options']?_0x2055ce[_0xb84b('0x7')][_0xb84b('0xb')]||null:null,'include':_0x2055ce[_0xb84b('0x7')]?_0x2055ce[_0xb84b('0x7')]['include']?_[_0xb84b('0xd')](_0x2055ce[_0xb84b('0x7')][_0xb84b('0xc')],function(_0xde6f66){return{'model':db[_0xde6f66[_0xb84b('0xe')]],'as':_0xde6f66['as'],'attributes':_0xde6f66['as']===_0xb84b('0x28')?_[_0xb84b('0x29')](_0x4a809e):_0xde6f66[_0xb84b('0xa')],'include':_0xde6f66[_0xb84b('0xc')]?_[_0xb84b('0xd')](_0xde6f66['include'],function(_0x58b75a){return{'model':db[_0x58b75a[_0xb84b('0xe')]],'as':_0x58b75a['as'],'attributes':_0x58b75a[_0xb84b('0xa')],'include':_0x58b75a['include']?_[_0xb84b('0xd')](_0x58b75a['include'],function(_0x561c13){return{'model':db[_0x561c13['model']],'as':_0x561c13['as'],'attributes':_0x561c13['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ac015){logger[_0xb84b('0x1b')](_0xb84b('0x5'),_0x2055ce);logger[_0xb84b('0x10')]('GetCmHopper',_0x2055ce,JSON[_0xb84b('0x11')](_0x5ac015));_0xef5ee1(_0x5ac015);})['catch'](function(_0x58098f){logger[_0xb84b('0x12')](_0xb84b('0x5'),_0x58098f[_0xb84b('0x13')],_0x2055ce);_0x146591(_0xa62ba5['error'](0x1f4,_0x58098f[_0xb84b('0x13')]));});});});};exports['GetContactByPhone']=function(_0x53ba91){var _0x5f50fa=this;return new Promise(function(_0x493b22,_0x1b9e26){return db['CmContact']['findOne']({'raw':!![],'where':{'phone':_0x53ba91[_0xb84b('0x7')][_0xb84b('0x9')][_0xb84b('0x42')]},'attributes':['id','dialTimezone'],'order':[['id',_0xb84b('0x43')]]})[_0xb84b('0xf')](function(_0x295d9f){logger[_0xb84b('0x1b')](_0xb84b('0x44'),_0x53ba91);logger[_0xb84b('0x10')]('getContactByPhone',_0x53ba91,JSON[_0xb84b('0x11')](_0x295d9f));_0x493b22(_0x295d9f);})[_0xb84b('0x16')](function(_0x2c25f0){logger['error'](_0xb84b('0x44'),_0x2c25f0[_0xb84b('0x13')],_0x53ba91);_0x1b9e26(_0x5f50fa['error'](0x1f4,_0x2c25f0['message']));});});};exports[_0xb84b('0x45')]=function(_0x4e3322){var _0x760dc7=this;return new Promise(function(_0x1d12f6,_0x351b01){return db[_0xb84b('0x23')]['transaction'](function(_0x538bf0){var _0x510b0a=_0x4e3322[_0xb84b('0x7')]&&_0x4e3322[_0xb84b('0x7')][_0xb84b('0x9')]?_0x4e3322[_0xb84b('0x7')][_0xb84b('0x9')]:{};return db[_0xb84b('0x6')][_0xb84b('0x1a')](_0x4e3322[_0xb84b('0x19')],{'where':_0x510b0a,'transaction':_0x538bf0})['then'](function(_0x411d21){logger[_0xb84b('0x1b')](_0xb84b('0x45'),_0x4e3322);logger[_0xb84b('0x10')](_0xb84b('0x45'),_0x4e3322,JSON[_0xb84b('0x11')](_0x411d21));_0x1d12f6(_0x411d21);})['catch'](function(_0xe1c960){logger[_0xb84b('0x12')](_0xb84b('0x45'),_0xe1c960[_0xb84b('0x13')],_0x4e3322);_0x351b01(_0x760dc7[_0xb84b('0x12')](0x1f4,_0xe1c960[_0xb84b('0x13')]));});});});};exports[_0xb84b('0x46')]=function(_0x3c55cb){var _0x59c45b=this;var _0x431fdf=_0x3c55cb[_0xb84b('0x19')][_0xb84b('0x9')]['voiceQueueIds'];var _0x4ab2b3=_0x3c55cb[_0xb84b('0x19')][_0xb84b('0x9')]['interval'];var _0x4aca3e=_0x3c55cb[_0xb84b('0x19')][_0xb84b('0x9')][_0xb84b('0x47')];return new Promise(function(_0x43c33c,_0x541626){return db[_0xb84b('0x6')]['findAll']({'where':{'voiceQueueId':{'$in':_0x431fdf},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xb84b('0x23')]['literal'](_0xb84b('0x48')+_0x4ab2b3+_0xb84b('0x49')),'$gt':db['sequelize'][_0xb84b('0x3a')]('NOW()')}},'UserId':{'$in':_0x4aca3e}},'include':[{'model':db[_0xb84b('0x21')],'as':_0xb84b('0x28')},{'model':db[_0xb84b('0x2a')],'as':_0xb84b('0x2b'),'attributes':['id','name',_0xb84b('0x2d')]},{'model':db['CmList'],'as':_0xb84b('0x4a')}]})['then'](function(_0x144afc){if(_0x144afc['length']>0x0){return db[_0xb84b('0x23')]['transaction'](function(_0x157067){return db[_0xb84b('0x6')][_0xb84b('0x1a')]({'recallmeNotifiedDate':db[_0xb84b('0x23')][_0xb84b('0x3a')](_0xb84b('0x4b'))},{'where':{'id':{'$in':_[_0xb84b('0xd')](_0x144afc,'id')}},'transaction':_0x157067})[_0xb84b('0xf')](function(){_0x43c33c(_0x144afc);})['catch'](function(_0x161ab2){logger[_0xb84b('0x12')]('CmHopperHandlePreviewRecallNotifications',_0x161ab2[_0xb84b('0x13')],_0x3c55cb);_0x541626(_0x59c45b[_0xb84b('0x12')](0x1f4,_0x161ab2[_0xb84b('0x13')]));});})[_0xb84b('0x16')](function(_0x581694){logger[_0xb84b('0x12')]('CmHopperHandlePreviewRecallNotifications',_0x581694[_0xb84b('0x13')],_0x3c55cb);_0x541626(_0x59c45b['error'](0x1f4,_0x581694[_0xb84b('0x13')]));});}else{_0x43c33c(_0x144afc);}});});}; \ No newline at end of file +var _0x87cc=['bluebird','rpc','GetCmHopper','CmHopper','options','where','attributes','limit','include','map','model','info','debug','stringify','error','message','ShowCmHopper','find','raw','then','catch','CreateCmHopper','create','body','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','findAll','order','LOCK','UPDATE','Contact','Agent','name','voicePause','length','UserId','push','includes','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','MoveContactManagedDialer','CmHopperFinal','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','all','GetContactRecallMe','GetContactByPhone','findOne','phone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','User','CmList','List','NOW()','util'];(function(_0x36e3ba,_0x1912e8){var _0x7972c7=function(_0x52e712){while(--_0x52e712){_0x36e3ba['push'](_0x36e3ba['shift']());}};_0x7972c7(++_0x1912e8);}(_0x87cc,0xda));var _0xc87c=function(_0x1d6e09,_0x8be519){_0x1d6e09=_0x1d6e09-0x0;var _0x4c6b0e=_0x87cc[_0x1d6e09];return _0x4c6b0e;};'use strict';var _=require('lodash');var util=require(_0xc87c('0x0'));var moment=require('moment');var BPromise=require(_0xc87c('0x1'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0xc87c('0x2'));exports[_0xc87c('0x3')]=function(_0x3b8c9a){var _0x3a461e=this;return new Promise(function(_0x5a022d,_0x51adfb){return db[_0xc87c('0x4')]['findAll']({'raw':_0x3b8c9a[_0xc87c('0x5')]?_0x3b8c9a['options']['raw']===undefined?!![]:![]:!![],'where':_0x3b8c9a[_0xc87c('0x5')]?_0x3b8c9a[_0xc87c('0x5')][_0xc87c('0x6')]||null:null,'attributes':_0x3b8c9a[_0xc87c('0x5')]?_0x3b8c9a[_0xc87c('0x5')][_0xc87c('0x7')]||null:null,'limit':_0x3b8c9a[_0xc87c('0x5')]?_0x3b8c9a['options'][_0xc87c('0x8')]||null:null,'include':_0x3b8c9a[_0xc87c('0x5')]?_0x3b8c9a['options'][_0xc87c('0x9')]?_[_0xc87c('0xa')](_0x3b8c9a[_0xc87c('0x5')][_0xc87c('0x9')],function(_0x162449){return{'model':db[_0x162449[_0xc87c('0xb')]],'as':_0x162449['as'],'attributes':_0x162449[_0xc87c('0x7')],'include':_0x162449[_0xc87c('0x9')]?_['map'](_0x162449[_0xc87c('0x9')],function(_0x2fad20){return{'model':db[_0x2fad20[_0xc87c('0xb')]],'as':_0x2fad20['as'],'attributes':_0x2fad20['attributes'],'include':_0x2fad20[_0xc87c('0x9')]?_['map'](_0x2fad20[_0xc87c('0x9')],function(_0x33a4f5){return{'model':db[_0x33a4f5['model']],'as':_0x33a4f5['as'],'attributes':_0x33a4f5[_0xc87c('0x7')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x24c6ac){logger[_0xc87c('0xc')](_0xc87c('0x3'),_0x3b8c9a);logger[_0xc87c('0xd')]('GetCmHopper',_0x3b8c9a,JSON[_0xc87c('0xe')](_0x24c6ac));_0x5a022d(_0x24c6ac);})['catch'](function(_0x1a8331){logger[_0xc87c('0xf')](_0xc87c('0x3'),_0x1a8331[_0xc87c('0x10')],_0x3b8c9a);_0x51adfb(_0x3a461e['error'](0x1f4,_0x1a8331[_0xc87c('0x10')]));});});};exports[_0xc87c('0x11')]=function(_0x572d37){var _0xe36b81=this;return new Promise(function(_0x2895c9,_0x4636c2){return db['CmHopper'][_0xc87c('0x12')]({'raw':_0x572d37[_0xc87c('0x5')]?_0x572d37[_0xc87c('0x5')][_0xc87c('0x13')]===undefined?!![]:![]:!![],'where':_0x572d37[_0xc87c('0x5')]?_0x572d37[_0xc87c('0x5')][_0xc87c('0x6')]||null:null,'attributes':_0x572d37[_0xc87c('0x5')]?_0x572d37[_0xc87c('0x5')][_0xc87c('0x7')]||null:null,'include':_0x572d37['options']?_0x572d37[_0xc87c('0x5')][_0xc87c('0x9')]?_[_0xc87c('0xa')](_0x572d37[_0xc87c('0x5')][_0xc87c('0x9')],function(_0x4af469){return{'model':db[_0x4af469['model']],'as':_0x4af469['as'],'attributes':_0x4af469[_0xc87c('0x7')],'include':_0x4af469[_0xc87c('0x9')]?_[_0xc87c('0xa')](_0x4af469[_0xc87c('0x9')],function(_0x59b0b5){return{'model':db[_0x59b0b5[_0xc87c('0xb')]],'as':_0x59b0b5['as'],'attributes':_0x59b0b5['attributes'],'include':_0x59b0b5['include']?_['map'](_0x59b0b5[_0xc87c('0x9')],function(_0x33c943){return{'model':db[_0x33c943[_0xc87c('0xb')]],'as':_0x33c943['as'],'attributes':_0x33c943['attributes']};}):[]};}):[]};}):[]:[]})[_0xc87c('0x14')](function(_0x51100c){logger[_0xc87c('0xc')]('ShowCmHopper',_0x572d37);logger[_0xc87c('0xd')](_0xc87c('0x11'),_0x572d37,JSON['stringify'](_0x51100c));_0x2895c9(_0x51100c);})[_0xc87c('0x15')](function(_0x39b1d3){logger[_0xc87c('0xf')](_0xc87c('0x11'),_0x39b1d3[_0xc87c('0x10')],_0x572d37);_0x4636c2(_0xe36b81[_0xc87c('0xf')](0x1f4,_0x39b1d3[_0xc87c('0x10')]));});});};exports[_0xc87c('0x16')]=function(_0x3ef87b){var _0x20f9c8=this;return new Promise(function(_0x163dc0,_0x310327){return db[_0xc87c('0x4')][_0xc87c('0x17')](_0x3ef87b[_0xc87c('0x18')],{'raw':_0x3ef87b['options']?_0x3ef87b[_0xc87c('0x5')][_0xc87c('0x13')]===undefined?!![]:![]:!![]})[_0xc87c('0x14')](function(_0x10fb22){logger[_0xc87c('0xc')](_0xc87c('0x16'),_0x3ef87b);logger[_0xc87c('0xd')](_0xc87c('0x16'),_0x3ef87b,JSON['stringify'](_0x10fb22));_0x163dc0(_0x10fb22);})[_0xc87c('0x15')](function(_0x2868db){logger['error'](_0xc87c('0x16'),_0x2868db[_0xc87c('0x10')],_0x3ef87b);_0x310327(_0x20f9c8['error'](0x1f4,_0x2868db[_0xc87c('0x10')]));});});};exports[_0xc87c('0x19')]=function(_0x4cd105){var _0x40055f=this;return new Promise(function(_0x42f8af,_0x2dbfc7){return db[_0xc87c('0x4')][_0xc87c('0x1a')](_0x4cd105[_0xc87c('0x18')],{'raw':_0x4cd105[_0xc87c('0x5')]?_0x4cd105['options'][_0xc87c('0x13')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4cd105[_0xc87c('0x5')]?_0x4cd105[_0xc87c('0x5')][_0xc87c('0x6')]||null:null,'attributes':_0x4cd105['options']?_0x4cd105[_0xc87c('0x5')][_0xc87c('0x7')]||null:null,'limit':_0x4cd105[_0xc87c('0x5')]?_0x4cd105['options']['limit']||null:null})['then'](function(_0x9278d7){logger[_0xc87c('0xc')](_0xc87c('0x19'),_0x4cd105);logger[_0xc87c('0xc')](_0xc87c('0x1b'),JSON['stringify'](_0x4cd105[_0xc87c('0x5')][_0xc87c('0x6')]),_0x4cd105[_0xc87c('0x18')][_0xc87c('0x1c')]);logger['debug'](_0xc87c('0x19'),_0x4cd105,JSON[_0xc87c('0xe')](_0x9278d7));_0x42f8af(_0x9278d7);})['catch'](function(_0xb0086d){logger[_0xc87c('0xf')](_0xc87c('0x19'),_0xb0086d['message'],_0x4cd105);_0x2dbfc7(_0x40055f[_0xc87c('0xf')](0x1f4,_0xb0086d[_0xc87c('0x10')]));});});};exports[_0xc87c('0x1d')]=function(_0xa0f17d){var _0x793531=this;return new Promise(function(_0x48e31f,_0x3ec907){return db['CmHopper'][_0xc87c('0x1e')]({'where':_0xa0f17d[_0xc87c('0x5')]?_0xa0f17d[_0xc87c('0x5')][_0xc87c('0x6')]||null:null})[_0xc87c('0x14')](function(_0x560e56){logger[_0xc87c('0xc')](_0xc87c('0x1d'),_0xa0f17d);logger[_0xc87c('0xd')](_0xc87c('0x1d'),_0xa0f17d,JSON[_0xc87c('0xe')](_0x560e56));_0x48e31f(_0x560e56);})[_0xc87c('0x15')](function(_0x18e8a9){logger[_0xc87c('0xf')](_0xc87c('0x1d'),_0x18e8a9[_0xc87c('0x10')],_0xa0f17d);_0x3ec907(_0x793531[_0xc87c('0xf')](0x1f4,_0x18e8a9[_0xc87c('0x10')]));});});};exports[_0xc87c('0x1f')]=function(_0xd36aee){var _0x209868=this;return new Promise(function(_0x306ac7,_0x5769ec){return db[_0xc87c('0x20')][_0xc87c('0x21')]()[_0xc87c('0x14')](function(_0x5041fa){return db[_0xc87c('0x22')][_0xc87c('0x23')](function(_0xe6e241){return db[_0xc87c('0x4')][_0xc87c('0x24')]({'where':_0xd36aee['options']?_0xd36aee[_0xc87c('0x5')][_0xc87c('0x6')]||null:null,'attributes':_0xd36aee[_0xc87c('0x5')]?_0xd36aee[_0xc87c('0x5')][_0xc87c('0x7')]||null:null,'limit':_0xd36aee['options']?_0xd36aee['options'][_0xc87c('0x8')]||null:null,'order':_0xd36aee[_0xc87c('0x5')]?_0xd36aee[_0xc87c('0x5')][_0xc87c('0x25')]||null:null,'transaction':_0xe6e241,'lock':_0xe6e241[_0xc87c('0x26')][_0xc87c('0x27')],'include':[{'model':db['CmContact'],'as':_0xc87c('0x28'),'attributes':_['keys'](_0x5041fa)},{'model':db['User'],'as':_0xc87c('0x29'),'attributes':['id',_0xc87c('0x2a'),_0xc87c('0x2b')]}]})[_0xc87c('0x14')](function(_0x1b0894){var _0x2da000=[];var _0x493acd=[];for(var _0x52a7c0=0x0;_0x52a7c0<_0x1b0894[_0xc87c('0x2c')];_0x52a7c0+=0x1){var _0x26d7d5=_0x1b0894[_0x52a7c0][_0xc87c('0x2d')];if(_0x26d7d5===null){_0x2da000[_0xc87c('0x2e')](_0x1b0894[_0x52a7c0][_0xc87c('0x1a')](_0xd36aee['body'],{'transaction':_0xe6e241}));}else if(!_0x493acd[_0xc87c('0x2f')](_0x26d7d5)){_0x493acd[_0xc87c('0x2e')](_0x26d7d5);_0x2da000[_0xc87c('0x2e')](_0x1b0894[_0x52a7c0][_0xc87c('0x1a')](_0xd36aee[_0xc87c('0x18')],{'transaction':_0xe6e241}));}}return BPromise['all'](_0x2da000);});})[_0xc87c('0x14')](function(_0x5495f3){logger[_0xc87c('0xc')](_0xc87c('0x1f'),_0xd36aee);if(_0x5495f3[_0xc87c('0x2c')]>0x0){logger[_0xc87c('0xc')](_0xc87c('0x30'),_0x5495f3[0x0][_0xc87c('0x31')]['id'],_0x5495f3[0x0][_0xc87c('0x31')]['ContactId'],_0x5495f3[0x0][_0xc87c('0x31')][_0xc87c('0x1c')]);}logger['debug'](_0xc87c('0x1f'),_0xd36aee,JSON['stringify'](_0x5495f3));_0x306ac7(_0x5495f3);})[_0xc87c('0x15')](function(_0x249b81){logger[_0xc87c('0xf')](_0xc87c('0x1f'),_0x249b81['message'],_0xd36aee);_0x5769ec(_0x209868[_0xc87c('0xf')](0x1f4,_0x249b81[_0xc87c('0x10')]));});});});};exports[_0xc87c('0x32')]=function(_0x483b42){var _0x28fc71=this;return new Promise(function(_0x760fae,_0xb4bf8f){return db[_0xc87c('0x22')][_0xc87c('0x23')](function(_0x52faf5){return db[_0xc87c('0x33')][_0xc87c('0x17')](_0x483b42['body'],{'raw':_0x483b42['options']?_0x483b42[_0xc87c('0x5')][_0xc87c('0x13')]===undefined?!![]:![]:!![],'transaction':_0x52faf5})[_0xc87c('0x14')](function(){logger[_0xc87c('0xc')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xc87c('0xe')](_0x483b42['options'][_0xc87c('0x6')]),_0x483b42[_0xc87c('0x5')][_0xc87c('0x6')][_0xc87c('0x1c')]);return db['CmHopper'][_0xc87c('0x1e')]({'where':_0x483b42[_0xc87c('0x5')]?_0x483b42[_0xc87c('0x5')]['where']||null:null,'transaction':_0x52faf5});});})[_0xc87c('0x14')](function(_0x377c14){logger['info'](_0xc87c('0x32'),_0x483b42);logger['debug'](_0xc87c('0x32'),_0x483b42,JSON['stringify'](_0x377c14));_0x760fae(_0x377c14);})[_0xc87c('0x15')](function(_0x153047){logger[_0xc87c('0xf')](_0xc87c('0x32'),_0x153047[_0xc87c('0x10')],_0x483b42);_0xb4bf8f(_0x28fc71[_0xc87c('0xf')](0x1f4,_0x153047['message']));});});};exports[_0xc87c('0x34')]=function(_0x1dba06){var _0x13dcaa=this;return new Promise(function(_0x1147af,_0x2d4d68){return db[_0xc87c('0x4')][_0xc87c('0x24')]({'raw':_0x1dba06[_0xc87c('0x5')]?_0x1dba06[_0xc87c('0x5')][_0xc87c('0x13')]===undefined?!![]:![]:!![],'where':_0x1dba06['options']?_0x1dba06[_0xc87c('0x5')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0xc87c('0x35'),db[_0xc87c('0x22')]['fn']('IF',db['sequelize'][_0xc87c('0x36')](_0xc87c('0x37')+util['format'](_0xc87c('0x38'),moment()['format'](_0xc87c('0x39')))+'\x20,\x201,\x20null'))),'contactsRescheduled']]})[_0xc87c('0x14')](function(_0x40a52f){logger[_0xc87c('0xc')]('CountReScheduled',_0x1dba06);logger[_0xc87c('0xd')](_0xc87c('0x34'),_0x1dba06,JSON[_0xc87c('0xe')](_0x40a52f));_0x1147af(_0x40a52f);})[_0xc87c('0x15')](function(_0x91b977){logger['error'](_0xc87c('0x34'),_0x91b977[_0xc87c('0x10')],_0x1dba06);_0x2d4d68(_0x13dcaa[_0xc87c('0xf')](0x1f4,_0x91b977[_0xc87c('0x10')]));});});};exports['GetContactRecallMe']=function(_0x105438){var _0x189c1d=this;return new Promise(function(_0x23b205,_0x163e89){return db['CmContact'][_0xc87c('0x21')]()[_0xc87c('0x14')](function(){return db[_0xc87c('0x22')][_0xc87c('0x23')](function(_0x30d376){return db['CmHopper']['findAll']({'where':_0x105438['options']?_0x105438[_0xc87c('0x5')][_0xc87c('0x6')]||null:null,'attributes':_0x105438[_0xc87c('0x5')]?_0x105438[_0xc87c('0x5')][_0xc87c('0x7')]||null:null,'limit':0x1,'order':_0x105438['options']?_0x105438[_0xc87c('0x5')][_0xc87c('0x25')]||null:null,'group':db[_0xc87c('0x4')][_0xc87c('0x2d')],'transaction':_0x30d376,'lock':_0x30d376[_0xc87c('0x26')][_0xc87c('0x27')],'include':_0x105438[_0xc87c('0x5')]?_0x105438[_0xc87c('0x5')][_0xc87c('0x9')]?_[_0xc87c('0xa')](_0x105438['options'][_0xc87c('0x9')],function(_0x1aaf73){return{'model':db[_0x1aaf73[_0xc87c('0xb')]],'as':_0x1aaf73['as'],'attributes':_0x1aaf73[_0xc87c('0x7')],'include':_0x1aaf73['include']?_[_0xc87c('0xa')](_0x1aaf73[_0xc87c('0x9')],function(_0x5dba8c){return{'model':db[_0x5dba8c[_0xc87c('0xb')]],'as':_0x5dba8c['as'],'attributes':_0x5dba8c[_0xc87c('0x7')],'include':_0x5dba8c[_0xc87c('0x9')]?_[_0xc87c('0xa')](_0x5dba8c[_0xc87c('0x9')],function(_0x17ef1b){return{'model':db[_0x17ef1b[_0xc87c('0xb')]],'as':_0x17ef1b['as'],'attributes':_0x17ef1b[_0xc87c('0x7')]};}):[]};}):[]};}):[]:[]})[_0xc87c('0x14')](function(_0x4e9904){var _0x2f2794=[];for(var _0x5c0e69=0x0;_0x5c0e69<_0x4e9904[_0xc87c('0x2c')];_0x5c0e69+=0x1){_0x2f2794[_0xc87c('0x2e')](_0x4e9904[_0x5c0e69][_0xc87c('0x1a')](_0x105438[_0xc87c('0x18')],{'transaction':_0x30d376}));}return BPromise[_0xc87c('0x3a')](_0x2f2794);});})[_0xc87c('0x14')](function(_0x3ef46f){logger[_0xc87c('0xc')](_0xc87c('0x3b'),_0x105438);logger[_0xc87c('0xd')]('GetContactRecallMe',_0x105438,JSON[_0xc87c('0xe')](_0x3ef46f));_0x23b205(_0x3ef46f);})[_0xc87c('0x15')](function(_0x3f6b7d){logger['error'](_0xc87c('0x3b'),_0x3f6b7d[_0xc87c('0x10')],_0x105438);_0x163e89(_0x189c1d['error'](0x1f4,_0x3f6b7d['message']));});});});};exports['GetCmHopperPreview']=function(_0x212c51){var _0x557e90=this;return new Promise(function(_0x43f182,_0x740e72){db[_0xc87c('0x20')][_0xc87c('0x21')]()[_0xc87c('0x14')](function(_0x14a8d1){return db[_0xc87c('0x4')][_0xc87c('0x24')]({'raw':_0x212c51['options']?_0x212c51[_0xc87c('0x5')][_0xc87c('0x13')]===undefined?!![]:![]:!![],'where':_0x212c51[_0xc87c('0x5')]?_0x212c51[_0xc87c('0x5')]['where']||null:null,'attributes':_0x212c51[_0xc87c('0x5')]?_0x212c51[_0xc87c('0x5')][_0xc87c('0x7')]||null:null,'limit':_0x212c51[_0xc87c('0x5')]?_0x212c51['options']['limit']||null:null,'include':_0x212c51[_0xc87c('0x5')]?_0x212c51[_0xc87c('0x5')][_0xc87c('0x9')]?_['map'](_0x212c51[_0xc87c('0x5')]['include'],function(_0x2b88e6){return{'model':db[_0x2b88e6[_0xc87c('0xb')]],'as':_0x2b88e6['as'],'attributes':_0x2b88e6['as']===_0xc87c('0x28')?_['keys'](_0x14a8d1):_0x2b88e6[_0xc87c('0x7')],'include':_0x2b88e6[_0xc87c('0x9')]?_[_0xc87c('0xa')](_0x2b88e6[_0xc87c('0x9')],function(_0x1f4639){return{'model':db[_0x1f4639[_0xc87c('0xb')]],'as':_0x1f4639['as'],'attributes':_0x1f4639['attributes'],'include':_0x1f4639['include']?_[_0xc87c('0xa')](_0x1f4639[_0xc87c('0x9')],function(_0x3ee4cc){return{'model':db[_0x3ee4cc[_0xc87c('0xb')]],'as':_0x3ee4cc['as'],'attributes':_0x3ee4cc[_0xc87c('0x7')]};}):[]};}):[]};}):[]:[]})[_0xc87c('0x14')](function(_0x214d8c){logger['info'](_0xc87c('0x3'),_0x212c51);logger[_0xc87c('0xd')](_0xc87c('0x3'),_0x212c51,JSON['stringify'](_0x214d8c));_0x43f182(_0x214d8c);})[_0xc87c('0x15')](function(_0x4faa7d){logger['error'](_0xc87c('0x3'),_0x4faa7d[_0xc87c('0x10')],_0x212c51);_0x740e72(_0x557e90['error'](0x1f4,_0x4faa7d[_0xc87c('0x10')]));});});});};exports[_0xc87c('0x3c')]=function(_0x457ab1){var _0x49b91e=this;return new Promise(function(_0x56c940,_0x564d32){return db[_0xc87c('0x20')][_0xc87c('0x3d')]({'raw':!![],'where':{'phone':_0x457ab1[_0xc87c('0x5')][_0xc87c('0x6')][_0xc87c('0x3e')]},'attributes':['id','dialTimezone'],'order':[['id',_0xc87c('0x3f')]]})[_0xc87c('0x14')](function(_0x259009){logger[_0xc87c('0xc')](_0xc87c('0x40'),_0x457ab1);logger[_0xc87c('0xd')](_0xc87c('0x40'),_0x457ab1,JSON[_0xc87c('0xe')](_0x259009));_0x56c940(_0x259009);})[_0xc87c('0x15')](function(_0xfe70a9){logger[_0xc87c('0xf')](_0xc87c('0x40'),_0xfe70a9[_0xc87c('0x10')],_0x457ab1);_0x564d32(_0x49b91e[_0xc87c('0xf')](0x1f4,_0xfe70a9[_0xc87c('0x10')]));});});};exports['ResetActiveCalls']=function(_0x264462){var _0x123431=this;return new Promise(function(_0x235886,_0x3b75d7){return db['sequelize']['transaction'](function(_0x1c4a51){var _0x354423=_0x264462[_0xc87c('0x5')]&&_0x264462[_0xc87c('0x5')][_0xc87c('0x6')]?_0x264462['options'][_0xc87c('0x6')]:{};return db['CmHopper'][_0xc87c('0x1a')](_0x264462['body'],{'where':_0x354423,'transaction':_0x1c4a51})[_0xc87c('0x14')](function(_0x1b9d33){logger[_0xc87c('0xc')]('ResetActiveCalls',_0x264462);logger['debug'](_0xc87c('0x41'),_0x264462,JSON[_0xc87c('0xe')](_0x1b9d33));_0x235886(_0x1b9d33);})[_0xc87c('0x15')](function(_0x5ca052){logger[_0xc87c('0xf')](_0xc87c('0x41'),_0x5ca052[_0xc87c('0x10')],_0x264462);_0x3b75d7(_0x123431[_0xc87c('0xf')](0x1f4,_0x5ca052[_0xc87c('0x10')]));});});});};exports[_0xc87c('0x42')]=function(_0x4a0c29){var _0x252f13=this;var _0xc1093b=_0x4a0c29[_0xc87c('0x18')][_0xc87c('0x6')]['voiceQueueIds'];var _0x535f3a=_0x4a0c29[_0xc87c('0x18')]['where']['interval'];var _0x27cc34=_0x4a0c29['body'][_0xc87c('0x6')][_0xc87c('0x43')];return new Promise(function(_0x18756c,_0x1b01e6){return db['CmHopper'][_0xc87c('0x24')]({'where':{'voiceQueueId':{'$in':_0xc1093b},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xc87c('0x22')][_0xc87c('0x36')](_0xc87c('0x44')+_0x535f3a+'\x20MINUTE'),'$gt':db[_0xc87c('0x22')][_0xc87c('0x36')]('NOW()')}},'UserId':{'$in':_0x27cc34}},'include':[{'model':db[_0xc87c('0x20')],'as':_0xc87c('0x28')},{'model':db[_0xc87c('0x45')],'as':_0xc87c('0x29'),'attributes':['id','name',_0xc87c('0x2b')]},{'model':db[_0xc87c('0x46')],'as':_0xc87c('0x47')}]})['then'](function(_0x54ac9a){if(_0x54ac9a['length']>0x0){return db[_0xc87c('0x22')][_0xc87c('0x23')](function(_0x1d0181){return db[_0xc87c('0x4')][_0xc87c('0x1a')]({'recallmeNotifiedDate':db[_0xc87c('0x22')]['literal'](_0xc87c('0x48'))},{'where':{'id':{'$in':_[_0xc87c('0xa')](_0x54ac9a,'id')}},'transaction':_0x1d0181})[_0xc87c('0x14')](function(){_0x18756c(_0x54ac9a);})[_0xc87c('0x15')](function(_0x16df33){logger[_0xc87c('0xf')]('CmHopperHandlePreviewRecallNotifications',_0x16df33[_0xc87c('0x10')],_0x4a0c29);_0x1b01e6(_0x252f13[_0xc87c('0xf')](0x1f4,_0x16df33[_0xc87c('0x10')]));});})[_0xc87c('0x15')](function(_0x2c6fec){logger[_0xc87c('0xf')](_0xc87c('0x42'),_0x2c6fec[_0xc87c('0x10')],_0x4a0c29);_0x1b01e6(_0x252f13[_0xc87c('0xf')](0x1f4,_0x2c6fec['message']));});}else{_0x18756c(_0x54ac9a);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 68f3886..c04d872 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 _0x7aef=['/:id','show','/:id/previewrecall','getPreviewRecall','post','create','getPreview','getTimezone','update','destroy','exports','express','Router','./cmHopper.controller','isAuthenticated','get','describe','/opencontacts','getTimezones'];(function(_0x8ba19a,_0x1d2b2b){var _0x2bd8b4=function(_0xee823f){while(--_0xee823f){_0x8ba19a['push'](_0x8ba19a['shift']());}};_0x2bd8b4(++_0x1d2b2b);}(_0x7aef,0x128));var _0xf7ae=function(_0x179e34,_0x3dc914){_0x179e34=_0x179e34-0x0;var _0x378a8c=_0x7aef[_0x179e34];return _0x378a8c;};'use strict';var express=require(_0xf7ae('0x0'));var router=express[_0xf7ae('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xf7ae('0x2'));router['get']('/',auth[_0xf7ae('0x3')](),controller['index']);router[_0xf7ae('0x4')]('/describe',auth['isAuthenticated'](),controller[_0xf7ae('0x5')]);router[_0xf7ae('0x4')](_0xf7ae('0x6'),auth['isAuthenticated'](),controller['getOpenContacts']);router[_0xf7ae('0x4')]('/timezones',auth[_0xf7ae('0x3')](),controller[_0xf7ae('0x7')]);router[_0xf7ae('0x4')](_0xf7ae('0x8'),auth[_0xf7ae('0x3')](),controller[_0xf7ae('0x9')]);router[_0xf7ae('0x4')](_0xf7ae('0xa'),auth[_0xf7ae('0x3')](),controller[_0xf7ae('0xb')]);router[_0xf7ae('0xc')]('/',auth['isAuthenticated'](),controller[_0xf7ae('0xd')]);router[_0xf7ae('0xc')]('/preview',auth[_0xf7ae('0x3')](),controller[_0xf7ae('0xe')]);router['post']('/timezone',auth[_0xf7ae('0x3')](),controller[_0xf7ae('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xf7ae('0x10')]);router['delete']('/:id',auth[_0xf7ae('0x3')](),controller[_0xf7ae('0x11')]);module[_0xf7ae('0x12')]=router; \ No newline at end of file +var _0xe496=['/describe','describe','/timezones','getTimezones','/:id','/:id/previewrecall','getPreviewRecall','post','create','/preview','getPreview','getTimezone','put','update','destroy','exports','../../components/auth/service','./cmHopper.controller','get','isAuthenticated'];(function(_0x5587ff,_0x29a96e){var _0x1d5d4f=function(_0x13d1ab){while(--_0x13d1ab){_0x5587ff['push'](_0x5587ff['shift']());}};_0x1d5d4f(++_0x29a96e);}(_0xe496,0x1dc));var _0x6e49=function(_0x4aa125,_0x26a805){_0x4aa125=_0x4aa125-0x0;var _0x59f95a=_0xe496[_0x4aa125];return _0x59f95a;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x6e49('0x0'));var controller=require(_0x6e49('0x1'));router[_0x6e49('0x2')]('/',auth[_0x6e49('0x3')](),controller['index']);router['get'](_0x6e49('0x4'),auth[_0x6e49('0x3')](),controller[_0x6e49('0x5')]);router['get']('/opencontacts',auth['isAuthenticated'](),controller['getOpenContacts']);router[_0x6e49('0x2')](_0x6e49('0x6'),auth['isAuthenticated'](),controller[_0x6e49('0x7')]);router[_0x6e49('0x2')](_0x6e49('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x6e49('0x2')](_0x6e49('0x9'),auth[_0x6e49('0x3')](),controller[_0x6e49('0xa')]);router[_0x6e49('0xb')]('/',auth[_0x6e49('0x3')](),controller[_0x6e49('0xc')]);router['post'](_0x6e49('0xd'),auth['isAuthenticated'](),controller[_0x6e49('0xe')]);router[_0x6e49('0xb')]('/timezone',auth[_0x6e49('0x3')](),controller[_0x6e49('0xf')]);router[_0x6e49('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x6e49('0x11')]);router['delete'](_0x6e49('0x8'),auth[_0x6e49('0x3')](),controller[_0x6e49('0x12')]);module[_0x6e49('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 65275d4..d34bab9 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 _0xaa9b=['format','YYYY-MM-DD\x20HH:mm:ss','sequelize','STRING','INTEGER'];(function(_0x27843c,_0x39a824){var _0x253f27=function(_0x3648a8){while(--_0x3648a8){_0x27843c['push'](_0x27843c['shift']());}};_0x253f27(++_0x39a824);}(_0xaa9b,0xe8));var _0xbaa9=function(_0x367f69,_0x97258a){_0x367f69=_0x367f69-0x0;var _0x223209=_0xaa9b[_0x367f69];return _0x223209;};'use strict';var moment=require('moment');var Sequelize=require(_0xbaa9('0x0'));module['exports']={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0xbaa9('0x1')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xbaa9('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xbaa9('0x3')](_0xbaa9('0x4'))},'countbusyretry':{'type':Sequelize[_0xbaa9('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xbaa9('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xbaa9('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xbaa9('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xbaa9('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xbaa9('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xbaa9('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xbaa9('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4334=['sequelize','STRING','INTEGER','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment'];(function(_0xea6018,_0x4cf082){var _0x57b54d=function(_0x49099a){while(--_0x49099a){_0xea6018['push'](_0xea6018['shift']());}};_0x57b54d(++_0x4cf082);}(_0x4334,0xd1));var _0x4433=function(_0x172d0d,_0x35b35a){_0x172d0d=_0x172d0d-0x0;var _0x5963f2=_0x4334[_0x172d0d];return _0x5963f2;};'use strict';var moment=require(_0x4433('0x0'));var Sequelize=require(_0x4433('0x1'));module['exports']={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0x4433('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x4433('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x4433('0x4')],'defaultValue':moment()[_0x4433('0x5')](_0x4433('0x6'))},'countbusyretry':{'type':Sequelize[_0x4433('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4433('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4433('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x4433('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4433('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4433('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4433('0x3')],'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 5767532..bb34595 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 _0x281f=['CmHopperAdditionalPhone','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','includeAll','create','body','user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','error','stack','name','send','map'];(function(_0x15e56a,_0x5483d9){var _0x472c0d=function(_0x3bfbc9){while(--_0x3bfbc9){_0x15e56a['push'](_0x15e56a['shift']());}};_0x472c0d(++_0x5483d9);}(_0x281f,0x16f));var _0xf281=function(_0x25248b,_0x3c8491){_0x25248b=_0x25248b-0x0;var _0x509939=_0x281f[_0x25248b];return _0x509939;};'use strict';var emlformat=require(_0xf281('0x0'));var rimraf=require(_0xf281('0x1'));var zipdir=require(_0xf281('0x2'));var jsonpatch=require(_0xf281('0x3'));var rp=require(_0xf281('0x4'));var moment=require(_0xf281('0x5'));var BPromise=require(_0xf281('0x6'));var Mustache=require(_0xf281('0x7'));var util=require(_0xf281('0x8'));var path=require(_0xf281('0x9'));var sox=require(_0xf281('0xa'));var csv=require(_0xf281('0xb'));var ejs=require(_0xf281('0xc'));var fs=require('fs');var fs_extra=require(_0xf281('0xd'));var _=require(_0xf281('0xe'));var squel=require(_0xf281('0xf'));var crypto=require(_0xf281('0x10'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf281('0x11'));var Papa=require(_0xf281('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf281('0x13'));var as=require(_0xf281('0x14'));var hardwareService=require(_0xf281('0x15'));var logger=require('../../config/logger')(_0xf281('0x16'));var utils=require(_0xf281('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xf281('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20a578,_0x241e48){_0x241e48=_0x241e48||0xcc;return function(_0x75f22){if(_0x75f22){return _0x20a578[_0xf281('0x19')](_0x241e48);}return _0x20a578[_0xf281('0x1a')](_0x241e48)[_0xf281('0x1b')]();};}function respondWithResult(_0x1ca1d6,_0x556509){_0x556509=_0x556509||0xc8;return function(_0x1acb7f){if(_0x1acb7f){return _0x1ca1d6[_0xf281('0x1a')](_0x556509)[_0xf281('0x1c')](_0x1acb7f);}};}function respondWithFilteredResult(_0x19e46c,_0x32b46c){return function(_0x21ddb0){if(_0x21ddb0){var _0x3c77a7=typeof _0x32b46c[_0xf281('0x1d')]==='undefined'&&typeof _0x32b46c[_0xf281('0x1e')]===_0xf281('0x1f');var _0x12b4a4=_0x21ddb0[_0xf281('0x20')];var _0x5a30cb=_0x3c77a7?0x0:_0x32b46c[_0xf281('0x1d')];var _0x1ff00a=_0x3c77a7?_0x21ddb0[_0xf281('0x20')]:_0x32b46c[_0xf281('0x1d')]+_0x32b46c[_0xf281('0x1e')];var _0x55f600;if(_0x1ff00a>=_0x12b4a4){_0x1ff00a=_0x12b4a4;_0x55f600=0xc8;}else{_0x55f600=0xce;}_0x19e46c['status'](_0x55f600);return _0x19e46c['set'](_0xf281('0x21'),_0x5a30cb+'-'+_0x1ff00a+'/'+_0x12b4a4)['json'](_0x21ddb0);}return null;};}function patchUpdates(_0x44af31){return function(_0x2168b7){try{jsonpatch[_0xf281('0x22')](_0x2168b7,_0x44af31,!![]);}catch(_0x4219cf){return BPromise[_0xf281('0x23')](_0x4219cf);}return _0x2168b7[_0xf281('0x24')]();};}function saveUpdates(_0x52b670,_0x49478e){return function(_0x24176d){if(_0x24176d){return _0x24176d[_0xf281('0x25')](_0x52b670)[_0xf281('0x26')](function(_0x39a900){return _0x39a900;});}return null;};}function removeEntity(_0x6213f6,_0x5aac0d){return function(_0x2e9867){if(_0x2e9867){return _0x2e9867[_0xf281('0x27')]()[_0xf281('0x26')](function(){var _0x3bc73e=_0x2e9867[_0xf281('0x28')]({'plain':!![]});var _0x5ce821=_0xf281('0x29');return db[_0xf281('0x2a')][_0xf281('0x27')]({'where':{'type':_0x5ce821,'resourceId':_0x3bc73e['id']}})[_0xf281('0x26')](function(){return _0x2e9867;});})[_0xf281('0x26')](function(){_0x6213f6[_0xf281('0x1a')](0xcc)[_0xf281('0x1b')]();});}};}function handleEntityNotFound(_0x5ad7d6,_0x206a9f){return function(_0x4cd29d){if(!_0x4cd29d){_0x5ad7d6[_0xf281('0x19')](0x194);}return _0x4cd29d;};}function handleError(_0x9f2698,_0x489c7e){_0x489c7e=_0x489c7e||0x1f4;return function(_0x138882){logger[_0xf281('0x2b')](_0x138882[_0xf281('0x2c')]);if(_0x138882[_0xf281('0x2d')]){delete _0x138882[_0xf281('0x2d')];}_0x9f2698[_0xf281('0x1a')](_0x489c7e)[_0xf281('0x2e')](_0x138882);};}exports['index']=function(_0x5a43b8,_0x4787e2){var _0x4c74d7={},_0x3502bc={},_0x4fc7ff={'count':0x0,'rows':[]};var _0x7344af=_[_0xf281('0x2f')](db[_0xf281('0x30')][_0xf281('0x31')],function(_0x50aee1){return{'name':_0x50aee1['fieldName'],'type':_0x50aee1[_0xf281('0x32')][_0xf281('0x33')]};});_0x3502bc['model']=_[_0xf281('0x2f')](_0x7344af,_0xf281('0x2d'));_0x3502bc[_0xf281('0x34')]=_[_0xf281('0x35')](_0x5a43b8['query']);_0x3502bc[_0xf281('0x36')]=_[_0xf281('0x37')](_0x3502bc[_0xf281('0x38')],_0x3502bc[_0xf281('0x34')]);_0x4c74d7['attributes']=_[_0xf281('0x37')](_0x3502bc[_0xf281('0x38')],qs[_0xf281('0x39')](_0x5a43b8[_0xf281('0x34')][_0xf281('0x39')]));_0x4c74d7[_0xf281('0x3a')]=_0x4c74d7[_0xf281('0x3a')][_0xf281('0x3b')]?_0x4c74d7[_0xf281('0x3a')]:_0x3502bc[_0xf281('0x38')];if(!_0x5a43b8[_0xf281('0x34')][_0xf281('0x3c')]('nolimit')){_0x4c74d7[_0xf281('0x1e')]=qs[_0xf281('0x1e')](_0x5a43b8[_0xf281('0x34')][_0xf281('0x1e')]);_0x4c74d7['offset']=qs[_0xf281('0x1d')](_0x5a43b8[_0xf281('0x34')][_0xf281('0x1d')]);}_0x4c74d7['order']=qs[_0xf281('0x3d')](_0x5a43b8[_0xf281('0x34')]['sort']);_0x4c74d7[_0xf281('0x3e')]=qs[_0xf281('0x36')](_[_0xf281('0x3f')](_0x5a43b8[_0xf281('0x34')],_0x3502bc['filters']),_0x7344af);if(_0x5a43b8['query']['filter']){_0x4c74d7[_0xf281('0x3e')]=_[_0xf281('0x40')](_0x4c74d7['where'],{'$or':_[_0xf281('0x2f')](_0x7344af,function(_0x234fa5){if(_0x234fa5[_0xf281('0x32')]!==_0xf281('0x41')){var _0x4c7ad6={};_0x4c7ad6[_0x234fa5[_0xf281('0x2d')]]={'$like':'%'+_0x5a43b8[_0xf281('0x34')][_0xf281('0x42')]+'%'};return _0x4c7ad6;}})});}_0x4c74d7=_[_0xf281('0x40')]({},_0x4c74d7,_0x5a43b8[_0xf281('0x43')]);var _0x25811f={'where':_0x4c74d7[_0xf281('0x3e')]};return db[_0xf281('0x30')][_0xf281('0x20')](_0x25811f)['then'](function(_0x3c76ea){_0x4fc7ff[_0xf281('0x20')]=_0x3c76ea;if(_0x5a43b8['query']['includeAll']){_0x4c74d7[_0xf281('0x44')]=[{'all':!![]}];}return db[_0xf281('0x30')][_0xf281('0x45')](_0x4c74d7);})['then'](function(_0x3cda4e){_0x4fc7ff[_0xf281('0x46')]=_0x3cda4e;return _0x4fc7ff;})[_0xf281('0x26')](respondWithFilteredResult(_0x4787e2,_0x4c74d7))[_0xf281('0x47')](handleError(_0x4787e2,null));};exports[_0xf281('0x48')]=function(_0x5ba5c9,_0x21cd41){var _0x16ffaa={'raw':!![],'where':{'id':_0x5ba5c9['params']['id']}},_0x26f77e={};_0x26f77e['model']=_[_0xf281('0x35')](db[_0xf281('0x30')][_0xf281('0x31')]);_0x26f77e[_0xf281('0x34')]=_[_0xf281('0x35')](_0x5ba5c9[_0xf281('0x34')]);_0x26f77e[_0xf281('0x36')]=_[_0xf281('0x37')](_0x26f77e[_0xf281('0x38')],_0x26f77e[_0xf281('0x34')]);_0x16ffaa[_0xf281('0x3a')]=_['intersection'](_0x26f77e[_0xf281('0x38')],qs[_0xf281('0x39')](_0x5ba5c9[_0xf281('0x34')][_0xf281('0x39')]));_0x16ffaa[_0xf281('0x3a')]=_0x16ffaa[_0xf281('0x3a')][_0xf281('0x3b')]?_0x16ffaa[_0xf281('0x3a')]:_0x26f77e[_0xf281('0x38')];if(_0x5ba5c9[_0xf281('0x34')][_0xf281('0x49')]){_0x16ffaa['include']=[{'all':!![]}];}_0x16ffaa=_[_0xf281('0x40')]({},_0x16ffaa,_0x5ba5c9[_0xf281('0x43')]);return db[_0xf281('0x30')]['find'](_0x16ffaa)[_0xf281('0x26')](handleEntityNotFound(_0x21cd41,null))[_0xf281('0x26')](respondWithResult(_0x21cd41,null))['catch'](handleError(_0x21cd41,null));};exports[_0xf281('0x4a')]=function(_0x4f972b,_0x3966be){return db[_0xf281('0x30')][_0xf281('0x4a')](_0x4f972b[_0xf281('0x4b')],{})[_0xf281('0x26')](function(_0xa6b31f){var _0x21b060=_0x4f972b[_0xf281('0x4c')][_0xf281('0x28')]({'plain':!![]});if(!_0x21b060)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x21b060[_0xf281('0x4d')]===_0xf281('0x4c')){var _0x5e4314=_0xa6b31f['get']({'plain':!![]});var _0x31739a=_0xf281('0x29');return db[_0xf281('0x4e')][_0xf281('0x4f')]({'where':{'name':_0x31739a,'userProfileId':_0x21b060[_0xf281('0x50')]},'raw':!![]})[_0xf281('0x26')](function(_0x28085f){if(_0x28085f&&_0x28085f['autoAssociation']===0x0){return db[_0xf281('0x2a')]['create']({'name':_0x5e4314[_0xf281('0x2d')],'resourceId':_0x5e4314['id'],'type':_0x28085f['name'],'sectionId':_0x28085f['id']},{})[_0xf281('0x26')](function(){return _0xa6b31f;});}else{return _0xa6b31f;}})[_0xf281('0x47')](function(_0x164474){logger[_0xf281('0x2b')](_0xf281('0x51'),_0x164474);throw _0x164474;});}return _0xa6b31f;})[_0xf281('0x26')](respondWithResult(_0x3966be,0xc9))[_0xf281('0x47')](handleError(_0x3966be,null));};exports[_0xf281('0x25')]=function(_0x123845,_0xa26382){if(_0x123845[_0xf281('0x4b')]['id']){delete _0x123845[_0xf281('0x4b')]['id'];}return db[_0xf281('0x30')]['find']({'where':{'id':_0x123845[_0xf281('0x52')]['id']}})[_0xf281('0x26')](handleEntityNotFound(_0xa26382,null))[_0xf281('0x26')](saveUpdates(_0x123845[_0xf281('0x4b')],null))[_0xf281('0x26')](respondWithResult(_0xa26382,null))[_0xf281('0x47')](handleError(_0xa26382,null));};exports[_0xf281('0x27')]=function(_0x595231,_0x2ea95d){return db[_0xf281('0x30')][_0xf281('0x4f')]({'where':{'id':_0x595231[_0xf281('0x52')]['id']}})[_0xf281('0x26')](handleEntityNotFound(_0x2ea95d,null))[_0xf281('0x26')](removeEntity(_0x2ea95d,null))[_0xf281('0x47')](handleError(_0x2ea95d,null));}; \ No newline at end of file +var _0xd844=['status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','CmHopperAdditionalPhones','UserProfileResource','then','error','stack','name','send','index','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','destroy','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus'];(function(_0x33080e,_0x1c600a){var _0x407395=function(_0x5b62fd){while(--_0x5b62fd){_0x33080e['push'](_0x33080e['shift']());}};_0x407395(++_0x1c600a);}(_0xd844,0x1f1));var _0x4d84=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd844[_0x122ef9];return _0x42fba0;};'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('request-promise');var moment=require('moment');var BPromise=require(_0x4d84('0x3'));var Mustache=require(_0x4d84('0x4'));var util=require(_0x4d84('0x5'));var path=require(_0x4d84('0x6'));var sox=require(_0x4d84('0x7'));var csv=require(_0x4d84('0x8'));var ejs=require(_0x4d84('0x9'));var fs=require('fs');var fs_extra=require(_0x4d84('0xa'));var _=require(_0x4d84('0xb'));var squel=require(_0x4d84('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4d84('0xd'));var toCsv=require(_0x4d84('0x8'));var querystring=require(_0x4d84('0xe'));var Papa=require(_0x4d84('0xf'));var Redis=require(_0x4d84('0x10'));var authService=require(_0x4d84('0x11'));var qs=require(_0x4d84('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4d84('0x13'));var logger=require(_0x4d84('0x14'))(_0x4d84('0x15'));var utils=require(_0x4d84('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4d84('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33ad8e,_0x5c9bec){_0x5c9bec=_0x5c9bec||0xcc;return function(_0x1b3b4c){if(_0x1b3b4c){return _0x33ad8e[_0x4d84('0x18')](_0x5c9bec);}return _0x33ad8e[_0x4d84('0x19')](_0x5c9bec)[_0x4d84('0x1a')]();};}function respondWithResult(_0xe57fe1,_0x484f8a){_0x484f8a=_0x484f8a||0xc8;return function(_0x10ef9a){if(_0x10ef9a){return _0xe57fe1['status'](_0x484f8a)[_0x4d84('0x1b')](_0x10ef9a);}};}function respondWithFilteredResult(_0x32df4c,_0x4dd119){return function(_0x3ad26e){if(_0x3ad26e){var _0x22aefa=typeof _0x4dd119[_0x4d84('0x1c')]===_0x4d84('0x1d')&&typeof _0x4dd119[_0x4d84('0x1e')]===_0x4d84('0x1d');var _0x57be8b=_0x3ad26e['count'];var _0x40fa39=_0x22aefa?0x0:_0x4dd119[_0x4d84('0x1c')];var _0x374ae3=_0x22aefa?_0x3ad26e['count']:_0x4dd119[_0x4d84('0x1c')]+_0x4dd119[_0x4d84('0x1e')];var _0x4e50ba;if(_0x374ae3>=_0x57be8b){_0x374ae3=_0x57be8b;_0x4e50ba=0xc8;}else{_0x4e50ba=0xce;}_0x32df4c[_0x4d84('0x19')](_0x4e50ba);return _0x32df4c[_0x4d84('0x1f')](_0x4d84('0x20'),_0x40fa39+'-'+_0x374ae3+'/'+_0x57be8b)['json'](_0x3ad26e);}return null;};}function patchUpdates(_0x4a21b4){return function(_0x3c569e){try{jsonpatch[_0x4d84('0x21')](_0x3c569e,_0x4a21b4,!![]);}catch(_0x2e5226){return BPromise[_0x4d84('0x22')](_0x2e5226);}return _0x3c569e[_0x4d84('0x23')]();};}function saveUpdates(_0x273ab2,_0x341fd0){return function(_0x2c5872){if(_0x2c5872){return _0x2c5872['update'](_0x273ab2)['then'](function(_0x558516){return _0x558516;});}return null;};}function removeEntity(_0xae5f11,_0x5de66c){return function(_0x2c86d0){if(_0x2c86d0){return _0x2c86d0['destroy']()['then'](function(){var _0x1abe9b=_0x2c86d0['get']({'plain':!![]});var _0x3bc0eb=_0x4d84('0x24');return db[_0x4d84('0x25')]['destroy']({'where':{'type':_0x3bc0eb,'resourceId':_0x1abe9b['id']}})[_0x4d84('0x26')](function(){return _0x2c86d0;});})[_0x4d84('0x26')](function(){_0xae5f11[_0x4d84('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x338d27,_0x2caccf){return function(_0x522298){if(!_0x522298){_0x338d27[_0x4d84('0x18')](0x194);}return _0x522298;};}function handleError(_0x26840f,_0x303e41){_0x303e41=_0x303e41||0x1f4;return function(_0x372243){logger[_0x4d84('0x27')](_0x372243[_0x4d84('0x28')]);if(_0x372243[_0x4d84('0x29')]){delete _0x372243[_0x4d84('0x29')];}_0x26840f[_0x4d84('0x19')](_0x303e41)[_0x4d84('0x2a')](_0x372243);};}exports[_0x4d84('0x2b')]=function(_0x9cd797,_0x509698){var _0x2ec32b={},_0x555bcd={},_0x592795={'count':0x0,'rows':[]};var _0x4b6357=_['map'](db[_0x4d84('0x2c')][_0x4d84('0x2d')],function(_0x3a049b){return{'name':_0x3a049b[_0x4d84('0x2e')],'type':_0x3a049b[_0x4d84('0x2f')][_0x4d84('0x30')]};});_0x555bcd[_0x4d84('0x31')]=_[_0x4d84('0x32')](_0x4b6357,'name');_0x555bcd[_0x4d84('0x33')]=_[_0x4d84('0x34')](_0x9cd797[_0x4d84('0x33')]);_0x555bcd[_0x4d84('0x35')]=_[_0x4d84('0x36')](_0x555bcd[_0x4d84('0x31')],_0x555bcd[_0x4d84('0x33')]);_0x2ec32b[_0x4d84('0x37')]=_[_0x4d84('0x36')](_0x555bcd[_0x4d84('0x31')],qs[_0x4d84('0x38')](_0x9cd797[_0x4d84('0x33')][_0x4d84('0x38')]));_0x2ec32b[_0x4d84('0x37')]=_0x2ec32b['attributes']['length']?_0x2ec32b['attributes']:_0x555bcd[_0x4d84('0x31')];if(!_0x9cd797[_0x4d84('0x33')]['hasOwnProperty'](_0x4d84('0x39'))){_0x2ec32b['limit']=qs[_0x4d84('0x1e')](_0x9cd797[_0x4d84('0x33')]['limit']);_0x2ec32b['offset']=qs['offset'](_0x9cd797[_0x4d84('0x33')][_0x4d84('0x1c')]);}_0x2ec32b[_0x4d84('0x3a')]=qs[_0x4d84('0x3b')](_0x9cd797[_0x4d84('0x33')][_0x4d84('0x3b')]);_0x2ec32b['where']=qs['filters'](_[_0x4d84('0x3c')](_0x9cd797['query'],_0x555bcd[_0x4d84('0x35')]),_0x4b6357);if(_0x9cd797[_0x4d84('0x33')][_0x4d84('0x3d')]){_0x2ec32b[_0x4d84('0x3e')]=_[_0x4d84('0x3f')](_0x2ec32b[_0x4d84('0x3e')],{'$or':_['map'](_0x4b6357,function(_0x381feb){if(_0x381feb[_0x4d84('0x2f')]!==_0x4d84('0x40')){var _0x1d496a={};_0x1d496a[_0x381feb[_0x4d84('0x29')]]={'$like':'%'+_0x9cd797[_0x4d84('0x33')][_0x4d84('0x3d')]+'%'};return _0x1d496a;}})});}_0x2ec32b=_[_0x4d84('0x3f')]({},_0x2ec32b,_0x9cd797[_0x4d84('0x41')]);var _0xdfba4a={'where':_0x2ec32b['where']};return db[_0x4d84('0x2c')][_0x4d84('0x42')](_0xdfba4a)[_0x4d84('0x26')](function(_0x1ad45a){_0x592795[_0x4d84('0x42')]=_0x1ad45a;if(_0x9cd797['query'][_0x4d84('0x43')]){_0x2ec32b[_0x4d84('0x44')]=[{'all':!![]}];}return db[_0x4d84('0x2c')][_0x4d84('0x45')](_0x2ec32b);})[_0x4d84('0x26')](function(_0x301b88){_0x592795[_0x4d84('0x46')]=_0x301b88;return _0x592795;})['then'](respondWithFilteredResult(_0x509698,_0x2ec32b))[_0x4d84('0x47')](handleError(_0x509698,null));};exports['show']=function(_0x5d5613,_0x44ff14){var _0x15e0e9={'raw':!![],'where':{'id':_0x5d5613['params']['id']}},_0x433536={};_0x433536[_0x4d84('0x31')]=_[_0x4d84('0x34')](db['CmHopperAdditionalPhone'][_0x4d84('0x2d')]);_0x433536[_0x4d84('0x33')]=_[_0x4d84('0x34')](_0x5d5613[_0x4d84('0x33')]);_0x433536[_0x4d84('0x35')]=_['intersection'](_0x433536['model'],_0x433536[_0x4d84('0x33')]);_0x15e0e9['attributes']=_['intersection'](_0x433536[_0x4d84('0x31')],qs[_0x4d84('0x38')](_0x5d5613[_0x4d84('0x33')][_0x4d84('0x38')]));_0x15e0e9['attributes']=_0x15e0e9[_0x4d84('0x37')][_0x4d84('0x48')]?_0x15e0e9[_0x4d84('0x37')]:_0x433536[_0x4d84('0x31')];if(_0x5d5613[_0x4d84('0x33')][_0x4d84('0x43')]){_0x15e0e9['include']=[{'all':!![]}];}_0x15e0e9=_['merge']({},_0x15e0e9,_0x5d5613[_0x4d84('0x41')]);return db[_0x4d84('0x2c')][_0x4d84('0x49')](_0x15e0e9)['then'](handleEntityNotFound(_0x44ff14,null))['then'](respondWithResult(_0x44ff14,null))[_0x4d84('0x47')](handleError(_0x44ff14,null));};exports[_0x4d84('0x4a')]=function(_0x6f6801,_0x2f5537){return db[_0x4d84('0x2c')]['create'](_0x6f6801[_0x4d84('0x4b')],{})[_0x4d84('0x26')](function(_0x55cd56){var _0x4f6eb4=_0x6f6801[_0x4d84('0x4c')]['get']({'plain':!![]});if(!_0x4f6eb4)throw new Error(_0x4d84('0x4d'));if(_0x4f6eb4[_0x4d84('0x4e')]===_0x4d84('0x4c')){var _0x4e40a2=_0x55cd56[_0x4d84('0x4f')]({'plain':!![]});var _0x1ebebf='CmHopperAdditionalPhones';return db[_0x4d84('0x50')][_0x4d84('0x49')]({'where':{'name':_0x1ebebf,'userProfileId':_0x4f6eb4[_0x4d84('0x51')]},'raw':!![]})['then'](function(_0x4ab6fa){if(_0x4ab6fa&&_0x4ab6fa[_0x4d84('0x52')]===0x0){return db[_0x4d84('0x25')][_0x4d84('0x4a')]({'name':_0x4e40a2[_0x4d84('0x29')],'resourceId':_0x4e40a2['id'],'type':_0x4ab6fa[_0x4d84('0x29')],'sectionId':_0x4ab6fa['id']},{})[_0x4d84('0x26')](function(){return _0x55cd56;});}else{return _0x55cd56;}})[_0x4d84('0x47')](function(_0x48fa66){logger[_0x4d84('0x27')](_0x4d84('0x53'),_0x48fa66);throw _0x48fa66;});}return _0x55cd56;})[_0x4d84('0x26')](respondWithResult(_0x2f5537,0xc9))['catch'](handleError(_0x2f5537,null));};exports[_0x4d84('0x54')]=function(_0x4d2835,_0x2f539e){if(_0x4d2835[_0x4d84('0x4b')]['id']){delete _0x4d2835[_0x4d84('0x4b')]['id'];}return db[_0x4d84('0x2c')][_0x4d84('0x49')]({'where':{'id':_0x4d2835[_0x4d84('0x55')]['id']}})[_0x4d84('0x26')](handleEntityNotFound(_0x2f539e,null))[_0x4d84('0x26')](saveUpdates(_0x4d2835[_0x4d84('0x4b')],null))[_0x4d84('0x26')](respondWithResult(_0x2f539e,null))[_0x4d84('0x47')](handleError(_0x2f539e,null));};exports[_0x4d84('0x56')]=function(_0x2ddaec,_0x42010a){return db[_0x4d84('0x2c')]['find']({'where':{'id':_0x2ddaec['params']['id']}})['then'](handleEntityNotFound(_0x42010a,null))[_0x4d84('0x26')](removeEntity(_0x42010a,null))[_0x4d84('0x47')](handleError(_0x42010a,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 8b22dd9..68f4ae9 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 _0xbbfa=['cm_hopper_additional_phones','lodash','util','../../config/logger','moment','bluebird','request-promise','path','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone'];(function(_0xa0476f,_0x1a2267){var _0x5e95a9=function(_0x5ec450){while(--_0x5ec450){_0xa0476f['push'](_0xa0476f['shift']());}};_0x5e95a9(++_0x1a2267);}(_0xbbfa,0x175));var _0xabbf=function(_0x14c8ee,_0x34d4fb){_0x14c8ee=_0x14c8ee-0x0;var _0x51acc2=_0xbbfa[_0x14c8ee];return _0x51acc2;};'use strict';var _=require(_0xabbf('0x0'));var util=require(_0xabbf('0x1'));var logger=require(_0xabbf('0x2'))('api');var moment=require(_0xabbf('0x3'));var BPromise=require(_0xabbf('0x4'));var rp=require(_0xabbf('0x5'));var fs=require('fs');var path=require(_0xabbf('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xabbf('0x7'));module[_0xabbf('0x8')]=function(_0x15a3b6,_0x1c59e5){return _0x15a3b6[_0xabbf('0x9')](_0xabbf('0xa'),attributes,{'tableName':_0xabbf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee73=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','cm_hopper_additional_phones','lodash'];(function(_0x334f3b,_0x41b8ee){var _0x5b792e=function(_0x3d850d){while(--_0x3d850d){_0x334f3b['push'](_0x334f3b['shift']());}};_0x5b792e(++_0x41b8ee);}(_0xee73,0x196));var _0x3ee7=function(_0x32659d,_0x58ece9){_0x32659d=_0x32659d-0x0;var _0x10d610=_0xee73[_0x32659d];return _0x10d610;};'use strict';var _=require(_0x3ee7('0x0'));var util=require(_0x3ee7('0x1'));var logger=require(_0x3ee7('0x2'))(_0x3ee7('0x3'));var moment=require(_0x3ee7('0x4'));var BPromise=require(_0x3ee7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3ee7('0x6'));var rimraf=require(_0x3ee7('0x7'));var config=require(_0x3ee7('0x8'));var attributes=require(_0x3ee7('0x9'));module['exports']=function(_0x526d2c,_0x226045){return _0x526d2c['define']('CmHopperAdditionalPhone',attributes,{'tableName':_0x3ee7('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 9919b59..d8b7ea7 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 _0x9e1e=['update','activateAdditionalPhone','field','IncrementPreviewCounters','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','client','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CmHopper','body','ContactId','ListId','CampaignId','OrderBy','ASC','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','CmHopperAdditionalPhone','countcongestionretry','catch','VerifyAdditionalPhones','SwapAdditionalPhones','findOne','VoiceQueueId','duration','waitTime','isNil','scheduledat','add','minutes','createdAt','updatedAt','phone','sequelize','transaction'];(function(_0x1a3bf7,_0x43471a){var _0x1ced35=function(_0x51e4ac){while(--_0x51e4ac){_0x1a3bf7['push'](_0x1a3bf7['shift']());}};_0x1ced35(++_0x43471a);}(_0x9e1e,0x126));var _0xe9e1=function(_0x2cfa08,_0x23a555){_0x2cfa08=_0x2cfa08-0x0;var _0x528029=_0x9e1e[_0x2cfa08];return _0x528029;};'use strict';var _=require(_0xe9e1('0x0'));var util=require(_0xe9e1('0x1'));var moment=require(_0xe9e1('0x2'));var BPromise=require(_0xe9e1('0x3'));var rs=require(_0xe9e1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe9e1('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe9e1('0x6'));var config=require('../../config/environment');var jayson=require(_0xe9e1('0x7'));var client=jayson[_0xe9e1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf81966,_0x15b61c,_0x3c232e){return new BPromise(function(_0x4bf31a,_0x56eb64){return client[_0xe9e1('0x9')](_0xf81966,_0x3c232e)[_0xe9e1('0xa')](function(_0x1def18){logger[_0xe9e1('0xb')](_0xe9e1('0xc'),_0x15b61c,_0xe9e1('0xd'));logger[_0xe9e1('0xe')](_0xe9e1('0xf'),_0x15b61c,_0xe9e1('0xd'),JSON[_0xe9e1('0x10')](_0x1def18));if(_0x1def18['error']){if(_0x1def18[_0xe9e1('0x11')]['code']===0x1f4){logger[_0xe9e1('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x15b61c,_0x1def18['error'][_0xe9e1('0x12')]);return _0x56eb64(_0x1def18[_0xe9e1('0x11')][_0xe9e1('0x12')]);}logger[_0xe9e1('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x15b61c,_0x1def18['error']['message']);return _0x4bf31a(_0x1def18[_0xe9e1('0x11')][_0xe9e1('0x12')]);}else{logger[_0xe9e1('0xb')](_0xe9e1('0xc'),_0x15b61c,'request\x20sent');_0x4bf31a(_0x1def18[_0xe9e1('0x13')][_0xe9e1('0x12')]);}})['catch'](function(_0x313ad5){logger['error'](_0xe9e1('0xc'),_0x15b61c,_0x313ad5);_0x56eb64(_0x313ad5);});});}exports['VerifyAdditionalPhones']=function(_0x3d3151){var _0x3fcefe=this;return new Promise(function(_0x366dc0,_0x694ef7){return db[_0xe9e1('0x14')]['findOne']({'raw':!![],'where':{'ContactId':_0x3d3151[_0xe9e1('0x15')][_0xe9e1('0x16')],'ListId':_0x3d3151[_0xe9e1('0x15')][_0xe9e1('0x17')],'VoiceQueueId':_0x3d3151[_0xe9e1('0x15')]['VoiceQueueId']===undefined?null:_0x3d3151['body']['VoiceQueueId'],'CampaignId':_0x3d3151['body'][_0xe9e1('0x18')]===undefined?null:_0x3d3151[_0xe9e1('0x15')]['CampaignId']}})['then'](function(_0x4cc07d){if(_0x4cc07d!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x4cc07d['id'],'OrderBy':{'$gt':_0x4cc07d[_0xe9e1('0x19')]}},'order':[[_0xe9e1('0x19'),_0xe9e1('0x1a')]]})[_0xe9e1('0xa')](function(_0x4be4e4){var _0x3f2142=0x0;if(_0x4be4e4){if(_0x4be4e4[_0xe9e1('0x1b')]+_0x4be4e4['countcongestionretry']+_0x4be4e4[_0xe9e1('0x1c')]+_0x4be4e4[_0xe9e1('0x1d')]+_0x4be4e4[_0xe9e1('0x1e')]+_0x4be4e4[_0xe9e1('0x1f')]+_0x4be4e4[_0xe9e1('0x20')]+_0x4be4e4[_0xe9e1('0x21')]<_0x3d3151[_0xe9e1('0x22')][_0xe9e1('0x23')])_0x3f2142=0x1;_0x366dc0({'additional':_0x3f2142});}else{return db[_0xe9e1('0x24')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x4cc07d['id']},'order':[[_0xe9e1('0x19'),_0xe9e1('0x1a')]]})[_0xe9e1('0xa')](function(_0x8a6d4b){var _0x27b9b5=0x0;if(_0x8a6d4b){if(_0x8a6d4b['countbusyretry']+_0x8a6d4b[_0xe9e1('0x25')]+_0x8a6d4b[_0xe9e1('0x1c')]+_0x8a6d4b[_0xe9e1('0x1d')]+_0x8a6d4b['countdropretry']+_0x8a6d4b[_0xe9e1('0x1f')]+_0x8a6d4b[_0xe9e1('0x20')]+_0x8a6d4b[_0xe9e1('0x21')]<_0x3d3151['entity'][_0xe9e1('0x23')])_0x27b9b5=0x1;_0x366dc0({'additional':_0x27b9b5});}else{_0x366dc0({'additional':0x0});}})[_0xe9e1('0x26')](function(_0x5462dc){logger[_0xe9e1('0x11')](_0xe9e1('0x27'),_0x5462dc['message']);_0x694ef7(_0x3fcefe[_0xe9e1('0x11')](0x1f4,_0x5462dc[_0xe9e1('0x12')]));});}})[_0xe9e1('0x26')](function(_0x471cb3){logger[_0xe9e1('0x11')](_0xe9e1('0x27'),_0x471cb3[_0xe9e1('0x12')]);_0x694ef7(_0x3fcefe[_0xe9e1('0x11')](0x1f4,_0x471cb3[_0xe9e1('0x12')]));});}else _0x366dc0({'additional':0x0});});});};exports[_0xe9e1('0x28')]=function(_0x578096){var _0x53b09d=this;return new Promise(function(_0x3e05ee,_0x16fa85){return db['CmHopper'][_0xe9e1('0x29')]({'raw':!![],'where':{'ContactId':_0x578096['body']['ContactId'],'ListId':_0x578096[_0xe9e1('0x15')][_0xe9e1('0x17')],'VoiceQueueId':_0x578096[_0xe9e1('0x15')][_0xe9e1('0x2a')]===undefined?null:_0x578096['body'][_0xe9e1('0x2a')],'CampaignId':_0x578096[_0xe9e1('0x15')][_0xe9e1('0x18')]===undefined?null:_0x578096[_0xe9e1('0x15')][_0xe9e1('0x18')]}})[_0xe9e1('0xa')](function(_0x546563){if(_0x546563!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x546563['id'],'OrderBy':{'$gte':_0x546563[_0xe9e1('0x19')]}},'order':[[_0xe9e1('0x19'),_0xe9e1('0x1a')]]})[_0xe9e1('0xa')](function(_0x3484ac){if(_0x3484ac)return activateAdditionalPhone(_0x546563,_0x578096[_0xe9e1('0x15')],_0x3484ac,_0x578096[_0xe9e1('0x2b')],_0x578096[_0xe9e1('0x2c')])[_0xe9e1('0xa')](function(_0x49782c){_0x3e05ee(_0x49782c);});else{return db[_0xe9e1('0x24')][_0xe9e1('0x29')]({'raw':!![],'where':{'CmHopperId':_0x546563['id']},'order':[[_0xe9e1('0x19'),_0xe9e1('0x1a')]]})[_0xe9e1('0xa')](function(_0x1f3835){if(_0x1f3835)return activateAdditionalPhone(_0x546563,_0x578096[_0xe9e1('0x15')],_0x1f3835,_0x578096[_0xe9e1('0x2b')],_0x578096[_0xe9e1('0x2c')])[_0xe9e1('0xa')](function(_0x3ed9fc){_0x3e05ee(_0x3ed9fc);});else{_0x3e05ee({'id':_0x546563['id'],'phone':''});}})[_0xe9e1('0x26')](function(_0x60cbb5){logger[_0xe9e1('0x11')](_0xe9e1('0x27'),_0x60cbb5[_0xe9e1('0x12')]);_0x16fa85(_0x53b09d[_0xe9e1('0x11')](0x1f4,_0x60cbb5['message']));});}})[_0xe9e1('0x26')](function(_0x30af48){logger[_0xe9e1('0x11')](_0xe9e1('0x27'),_0x30af48['message']);_0x16fa85(_0x53b09d['error'](0x1f4,_0x30af48[_0xe9e1('0x12')]));});}else _0x3e05ee(0x1);});});};function activateAdditionalPhone(_0x40e8bd,_0x12dcd8,_0x22c831,_0xbcc4d5,_0x139e10){return new Promise(function(_0x23e40c,_0x39d914){var _0x5d0ba5;if(_[_0xe9e1('0x2d')](_0x22c831[_0xe9e1('0x2e')])){_0x22c831[_0xe9e1('0x2e')]=moment();}if(moment()>moment(_0x22c831[_0xe9e1('0x2e')])){_0x5d0ba5=moment()[_0xe9e1('0x2f')](_0x139e10||0x3,_0xe9e1('0x30'));}else{if(_0x22c831[_0xe9e1('0x19')]==0x0){_0x5d0ba5=moment(_0x22c831[_0xe9e1('0x2e')]);}else{_0x5d0ba5=moment()[_0xe9e1('0x2f')](_0x139e10||0x3,_0xe9e1('0x30'));}}if(_['isNil'](_0x5d0ba5)){_0x5d0ba5=moment()['add'](_0x139e10||0x3,_0xe9e1('0x30'));}var _0x5b2e84={'phone':_0x40e8bd['phone'],'active':0x0,'OrderBy':_[_0xe9e1('0x2d')](_0x40e8bd[_0xe9e1('0x19')])?0x0:_0x40e8bd[_0xe9e1('0x19')],'scheduledat':moment()[_0xe9e1('0x2f')](_0xbcc4d5||0x1,_0xe9e1('0x30')),'countbusyretry':_0x12dcd8['countbusyretry'],'countcongestionretry':_0x12dcd8[_0xe9e1('0x25')],'countnoanswerretry':_0x12dcd8[_0xe9e1('0x1c')],'countnosuchnumberretry':_0x12dcd8[_0xe9e1('0x1d')],'countdropretry':_0x12dcd8['countdropretry'],'countabandonedretry':_0x12dcd8[_0xe9e1('0x1f')],'countmachineretry':_0x12dcd8['countmachineretry'],'countagentrejectretry':_0x12dcd8['countagentrejectretry'],'createdAt':_0x12dcd8[_0xe9e1('0x31')],'updatedAt':_0x12dcd8[_0xe9e1('0x32')]};var _0x1672e2={'CmHopperId':_0x40e8bd['id'],'phone':_0x22c831[_0xe9e1('0x33')],'active':0x0,'OrderBy':_[_0xe9e1('0x2d')](_0x22c831[_0xe9e1('0x19')])?0x0:_0x22c831[_0xe9e1('0x19')],'scheduledat':_0x5d0ba5,'countbusyretry':_0x22c831[_0xe9e1('0x1b')],'countcongestionretry':_0x22c831['countcongestionretry'],'countnoanswerretry':_0x22c831[_0xe9e1('0x1c')],'countnosuchnumberretry':_0x22c831[_0xe9e1('0x1d')],'countdropretry':_0x22c831['countdropretry'],'countabandonedretry':_0x22c831['countabandonedretry'],'countmachineretry':_0x22c831[_0xe9e1('0x20')],'countagentrejectretry':_0x22c831['countagentrejectretry'],'createdAt':_0x22c831[_0xe9e1('0x31')],'updatedAt':_0x22c831[_0xe9e1('0x32')]};return db[_0xe9e1('0x34')][_0xe9e1('0x35')](function(_0x4271b3){return db[_0xe9e1('0x24')]['update'](_0x5b2e84,{'where':{'id':_0x22c831['id']}},{'transaction':_0x4271b3})[_0xe9e1('0xa')](function(){return db['CmHopper'][_0xe9e1('0x36')](_0x1672e2,{'where':{'id':_0x40e8bd['id']}},{'transaction':_0x4271b3});});})[_0xe9e1('0xa')](function(_0x59686e){_0x23e40c({'id':_0x40e8bd['id'],'phone':_0x22c831['phone']});})[_0xe9e1('0x26')](function(_0x155049){logger[_0xe9e1('0x11')](_0xe9e1('0x37'),_0x155049['message']);_0x39d914({'error':_0x155049['message']});});});}exports['IncrementPreviewCounters']=function(_0x49c512){var _0x6484e6=this;return new Promise(function(_0x127b4c,_0x63ba34){return db[_0xe9e1('0x14')][_0xe9e1('0x36')](_0x49c512[_0xe9e1('0x15')][_0xe9e1('0x38')],{'where':{'id':_0x49c512['body']['id']}})[_0xe9e1('0xa')](function(_0x3ed9fe){_0x127b4c(_0x3ed9fe);})[_0xe9e1('0x26')](function(_0x2fb857){logger['error'](_0xe9e1('0x39'),_0x2fb857[_0xe9e1('0x12')]);_0x63ba34(_0x6484e6['error'](0x1f4,_0x2fb857[_0xe9e1('0x12')]));});});}; \ No newline at end of file +var _0x8107=['info','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperAdditionalPhone,\x20%s,\x20%s','message','result','catch','CmHopper','body','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','findOne','OrderBy','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','entity','ASC','countmachineretry','dialGlobalMaxRetry','VerifyAdditionalPhones','SwapAdditionalPhones','ContactId','duration','waitTime','isNil','add','minutes','phone','createdAt','updatedAt','update','activateAdditionalPhone','field','IncrementPreviewCounters','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','then'];(function(_0x1af0e5,_0x152990){var _0x3c444a=function(_0x3b3d13){while(--_0x3b3d13){_0x1af0e5['push'](_0x1af0e5['shift']());}};_0x3c444a(++_0x152990);}(_0x8107,0x109));var _0x7810=function(_0x1c443f,_0x51319d){_0x1c443f=_0x1c443f-0x0;var _0x4a4a71=_0x8107[_0x1c443f];return _0x4a4a71;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7810('0x0'));var BPromise=require(_0x7810('0x1'));var rs=require(_0x7810('0x2'));var fs=require('fs');var Redis=require(_0x7810('0x3'));var db=require(_0x7810('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7810('0x5'))(_0x7810('0x6'));var config=require(_0x7810('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7810('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5e25f2,_0x5b22da,_0x19f6dd){return new BPromise(function(_0x3ee53f,_0x21024f){return client['request'](_0x5e25f2,_0x19f6dd)[_0x7810('0x9')](function(_0x3d0e26){logger[_0x7810('0xa')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x5b22da,_0x7810('0xb'));logger[_0x7810('0xc')](_0x7810('0xd'),_0x5b22da,_0x7810('0xb'),JSON[_0x7810('0xe')](_0x3d0e26));if(_0x3d0e26[_0x7810('0xf')]){if(_0x3d0e26['error'][_0x7810('0x10')]===0x1f4){logger[_0x7810('0xf')](_0x7810('0x11'),_0x5b22da,_0x3d0e26[_0x7810('0xf')][_0x7810('0x12')]);return _0x21024f(_0x3d0e26[_0x7810('0xf')][_0x7810('0x12')]);}logger['error'](_0x7810('0x11'),_0x5b22da,_0x3d0e26['error'][_0x7810('0x12')]);return _0x3ee53f(_0x3d0e26['error'][_0x7810('0x12')]);}else{logger[_0x7810('0xa')](_0x7810('0x11'),_0x5b22da,_0x7810('0xb'));_0x3ee53f(_0x3d0e26[_0x7810('0x13')][_0x7810('0x12')]);}})[_0x7810('0x14')](function(_0xa1c10e){logger['error'](_0x7810('0x11'),_0x5b22da,_0xa1c10e);_0x21024f(_0xa1c10e);});});}exports['VerifyAdditionalPhones']=function(_0xd55eed){var _0x1607b9=this;return new Promise(function(_0x1fbeed,_0x9d8b85){return db[_0x7810('0x15')]['findOne']({'raw':!![],'where':{'ContactId':_0xd55eed[_0x7810('0x16')]['ContactId'],'ListId':_0xd55eed[_0x7810('0x16')][_0x7810('0x17')],'VoiceQueueId':_0xd55eed[_0x7810('0x16')][_0x7810('0x18')]===undefined?null:_0xd55eed[_0x7810('0x16')][_0x7810('0x18')],'CampaignId':_0xd55eed[_0x7810('0x16')]['CampaignId']===undefined?null:_0xd55eed[_0x7810('0x16')][_0x7810('0x19')]}})[_0x7810('0x9')](function(_0x3233db){if(_0x3233db!=null){return db[_0x7810('0x1a')][_0x7810('0x1b')]({'raw':!![],'where':{'CmHopperId':_0x3233db['id'],'OrderBy':{'$gt':_0x3233db['OrderBy']}},'order':[[_0x7810('0x1c'),'ASC']]})[_0x7810('0x9')](function(_0x56cce4){var _0x3a29b7=0x0;if(_0x56cce4){if(_0x56cce4[_0x7810('0x1d')]+_0x56cce4[_0x7810('0x1e')]+_0x56cce4[_0x7810('0x1f')]+_0x56cce4[_0x7810('0x20')]+_0x56cce4[_0x7810('0x21')]+_0x56cce4[_0x7810('0x22')]+_0x56cce4['countmachineretry']+_0x56cce4[_0x7810('0x23')]<_0xd55eed[_0x7810('0x24')]['dialGlobalMaxRetry'])_0x3a29b7=0x1;_0x1fbeed({'additional':_0x3a29b7});}else{return db[_0x7810('0x1a')][_0x7810('0x1b')]({'raw':!![],'where':{'CmHopperId':_0x3233db['id']},'order':[[_0x7810('0x1c'),_0x7810('0x25')]]})[_0x7810('0x9')](function(_0x26425a){var _0x35edd5=0x0;if(_0x26425a){if(_0x26425a['countbusyretry']+_0x26425a['countcongestionretry']+_0x26425a[_0x7810('0x1f')]+_0x26425a[_0x7810('0x20')]+_0x26425a[_0x7810('0x21')]+_0x26425a[_0x7810('0x22')]+_0x26425a[_0x7810('0x26')]+_0x26425a[_0x7810('0x23')]<_0xd55eed[_0x7810('0x24')][_0x7810('0x27')])_0x35edd5=0x1;_0x1fbeed({'additional':_0x35edd5});}else{_0x1fbeed({'additional':0x0});}})[_0x7810('0x14')](function(_0xabf51d){logger[_0x7810('0xf')]('VerifyAdditionalPhones',_0xabf51d[_0x7810('0x12')]);_0x9d8b85(_0x1607b9[_0x7810('0xf')](0x1f4,_0xabf51d['message']));});}})[_0x7810('0x14')](function(_0x164075){logger['error'](_0x7810('0x28'),_0x164075[_0x7810('0x12')]);_0x9d8b85(_0x1607b9[_0x7810('0xf')](0x1f4,_0x164075['message']));});}else _0x1fbeed({'additional':0x0});});});};exports[_0x7810('0x29')]=function(_0x16d04c){var _0x13cf01=this;return new Promise(function(_0x475a74,_0x287e61){return db[_0x7810('0x15')]['findOne']({'raw':!![],'where':{'ContactId':_0x16d04c[_0x7810('0x16')][_0x7810('0x2a')],'ListId':_0x16d04c['body'][_0x7810('0x17')],'VoiceQueueId':_0x16d04c[_0x7810('0x16')][_0x7810('0x18')]===undefined?null:_0x16d04c['body'][_0x7810('0x18')],'CampaignId':_0x16d04c[_0x7810('0x16')][_0x7810('0x19')]===undefined?null:_0x16d04c[_0x7810('0x16')][_0x7810('0x19')]}})[_0x7810('0x9')](function(_0x256298){if(_0x256298!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x256298['id'],'OrderBy':{'$gte':_0x256298[_0x7810('0x1c')]}},'order':[[_0x7810('0x1c'),_0x7810('0x25')]]})[_0x7810('0x9')](function(_0x251881){if(_0x251881)return activateAdditionalPhone(_0x256298,_0x16d04c[_0x7810('0x16')],_0x251881,_0x16d04c[_0x7810('0x2b')],_0x16d04c['waitTime'])[_0x7810('0x9')](function(_0x501144){_0x475a74(_0x501144);});else{return db[_0x7810('0x1a')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x256298['id']},'order':[[_0x7810('0x1c'),'ASC']]})[_0x7810('0x9')](function(_0x37c172){if(_0x37c172)return activateAdditionalPhone(_0x256298,_0x16d04c[_0x7810('0x16')],_0x37c172,_0x16d04c[_0x7810('0x2b')],_0x16d04c[_0x7810('0x2c')])[_0x7810('0x9')](function(_0x151231){_0x475a74(_0x151231);});else{_0x475a74({'id':_0x256298['id'],'phone':''});}})[_0x7810('0x14')](function(_0x3facf6){logger['error'](_0x7810('0x28'),_0x3facf6[_0x7810('0x12')]);_0x287e61(_0x13cf01['error'](0x1f4,_0x3facf6[_0x7810('0x12')]));});}})['catch'](function(_0x5bc8fd){logger[_0x7810('0xf')]('VerifyAdditionalPhones',_0x5bc8fd[_0x7810('0x12')]);_0x287e61(_0x13cf01[_0x7810('0xf')](0x1f4,_0x5bc8fd[_0x7810('0x12')]));});}else _0x475a74(0x1);});});};function activateAdditionalPhone(_0x269fef,_0x6ffa20,_0xfcdd01,_0x58671d,_0x59898f){return new Promise(function(_0x3f15a8,_0x29d56b){var _0x1c9649;if(_[_0x7810('0x2d')](_0xfcdd01['scheduledat'])){_0xfcdd01['scheduledat']=moment();}if(moment()>moment(_0xfcdd01['scheduledat'])){_0x1c9649=moment()[_0x7810('0x2e')](_0x59898f||0x3,_0x7810('0x2f'));}else{if(_0xfcdd01['OrderBy']==0x0){_0x1c9649=moment(_0xfcdd01['scheduledat']);}else{_0x1c9649=moment()['add'](_0x59898f||0x3,_0x7810('0x2f'));}}if(_[_0x7810('0x2d')](_0x1c9649)){_0x1c9649=moment()['add'](_0x59898f||0x3,_0x7810('0x2f'));}var _0x42a0a3={'phone':_0x269fef[_0x7810('0x30')],'active':0x0,'OrderBy':_[_0x7810('0x2d')](_0x269fef[_0x7810('0x1c')])?0x0:_0x269fef['OrderBy'],'scheduledat':moment()[_0x7810('0x2e')](_0x58671d||0x1,_0x7810('0x2f')),'countbusyretry':_0x6ffa20[_0x7810('0x1d')],'countcongestionretry':_0x6ffa20[_0x7810('0x1e')],'countnoanswerretry':_0x6ffa20[_0x7810('0x1f')],'countnosuchnumberretry':_0x6ffa20[_0x7810('0x20')],'countdropretry':_0x6ffa20[_0x7810('0x21')],'countabandonedretry':_0x6ffa20['countabandonedretry'],'countmachineretry':_0x6ffa20[_0x7810('0x26')],'countagentrejectretry':_0x6ffa20[_0x7810('0x23')],'createdAt':_0x6ffa20[_0x7810('0x31')],'updatedAt':_0x6ffa20[_0x7810('0x32')]};var _0x4cc9bb={'CmHopperId':_0x269fef['id'],'phone':_0xfcdd01[_0x7810('0x30')],'active':0x0,'OrderBy':_[_0x7810('0x2d')](_0xfcdd01[_0x7810('0x1c')])?0x0:_0xfcdd01[_0x7810('0x1c')],'scheduledat':_0x1c9649,'countbusyretry':_0xfcdd01[_0x7810('0x1d')],'countcongestionretry':_0xfcdd01[_0x7810('0x1e')],'countnoanswerretry':_0xfcdd01[_0x7810('0x1f')],'countnosuchnumberretry':_0xfcdd01[_0x7810('0x20')],'countdropretry':_0xfcdd01['countdropretry'],'countabandonedretry':_0xfcdd01[_0x7810('0x22')],'countmachineretry':_0xfcdd01[_0x7810('0x26')],'countagentrejectretry':_0xfcdd01['countagentrejectretry'],'createdAt':_0xfcdd01[_0x7810('0x31')],'updatedAt':_0xfcdd01[_0x7810('0x32')]};return db['sequelize']['transaction'](function(_0x5cc4ac){return db[_0x7810('0x1a')]['update'](_0x42a0a3,{'where':{'id':_0xfcdd01['id']}},{'transaction':_0x5cc4ac})['then'](function(){return db[_0x7810('0x15')][_0x7810('0x33')](_0x4cc9bb,{'where':{'id':_0x269fef['id']}},{'transaction':_0x5cc4ac});});})[_0x7810('0x9')](function(_0x342702){_0x3f15a8({'id':_0x269fef['id'],'phone':_0xfcdd01['phone']});})['catch'](function(_0x1ea605){logger[_0x7810('0xf')](_0x7810('0x34'),_0x1ea605['message']);_0x29d56b({'error':_0x1ea605[_0x7810('0x12')]});});});}exports['IncrementPreviewCounters']=function(_0x44acec){var _0x405f33=this;return new Promise(function(_0x23d962,_0x149c57){return db[_0x7810('0x15')][_0x7810('0x33')](_0x44acec[_0x7810('0x16')][_0x7810('0x35')],{'where':{'id':_0x44acec[_0x7810('0x16')]['id']}})[_0x7810('0x9')](function(_0x5f556f){_0x23d962(_0x5f556f);})[_0x7810('0x14')](function(_0x407e9e){logger['error'](_0x7810('0x36'),_0x407e9e[_0x7810('0x12')]);_0x149c57(_0x405f33['error'](0x1f4,_0x407e9e[_0x7810('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index b4fdfb8..74e56d8 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 _0x68b7=['fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','multer','path','connect-timeout','express'];(function(_0x15c41a,_0x310951){var _0x20fa0a=function(_0x174bfe){while(--_0x174bfe){_0x15c41a['push'](_0x15c41a['shift']());}};_0x20fa0a(++_0x310951);}(_0x68b7,0x8c));var _0x768b=function(_0x1c571e,_0x548a78){_0x1c571e=_0x1c571e-0x0;var _0x4c546e=_0x68b7[_0x1c571e];return _0x4c546e;};'use strict';var multer=require(_0x768b('0x0'));var util=require('util');var path=require(_0x768b('0x1'));var timeout=require(_0x768b('0x2'));var express=require(_0x768b('0x3'));var router=express['Router']();var fs_extra=require(_0x768b('0x4'));var auth=require(_0x768b('0x5'));var interaction=require(_0x768b('0x6'));var config=require('../../config/environment');var controller=require(_0x768b('0x7'));router[_0x768b('0x8')]('/',auth[_0x768b('0x9')](),controller[_0x768b('0xa')]);router[_0x768b('0x8')](_0x768b('0xb'),auth[_0x768b('0x9')](),controller['show']);router[_0x768b('0xc')]('/',auth['isAuthenticated'](),controller[_0x768b('0xd')]);router[_0x768b('0xe')](_0x768b('0xb'),auth[_0x768b('0x9')](),controller[_0x768b('0xf')]);router[_0x768b('0x10')]('/:id',auth[_0x768b('0x9')](),controller[_0x768b('0x11')]);module['exports']=router; \ No newline at end of file +var _0xe9db=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','multer'];(function(_0x45096e,_0x17e82d){var _0xba1fa3=function(_0x29f43c){while(--_0x29f43c){_0x45096e['push'](_0x45096e['shift']());}};_0xba1fa3(++_0x17e82d);}(_0xe9db,0xbc));var _0xbe9d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe9db[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xbe9d('0x0'));var util=require(_0xbe9d('0x1'));var path=require(_0xbe9d('0x2'));var timeout=require(_0xbe9d('0x3'));var express=require(_0xbe9d('0x4'));var router=express[_0xbe9d('0x5')]();var fs_extra=require(_0xbe9d('0x6'));var auth=require(_0xbe9d('0x7'));var interaction=require(_0xbe9d('0x8'));var config=require(_0xbe9d('0x9'));var controller=require(_0xbe9d('0xa'));router[_0xbe9d('0xb')]('/',auth[_0xbe9d('0xc')](),controller[_0xbe9d('0xd')]);router['get'](_0xbe9d('0xe'),auth[_0xbe9d('0xc')](),controller[_0xbe9d('0xf')]);router[_0xbe9d('0x10')]('/',auth[_0xbe9d('0xc')](),controller[_0xbe9d('0x11')]);router[_0xbe9d('0x12')](_0xbe9d('0xe'),auth[_0xbe9d('0xc')](),controller[_0xbe9d('0x13')]);router[_0xbe9d('0x14')](_0xbe9d('0xe'),auth[_0xbe9d('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 2cdee16..4fe5217 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 _0x3d30=['contactListQueue','exports','INTEGER'];(function(_0x358ab6,_0x2899d8){var _0x155484=function(_0x1b5e17){while(--_0x1b5e17){_0x358ab6['push'](_0x358ab6['shift']());}};_0x155484(++_0x2899d8);}(_0x3d30,0x6a));var _0x03d3=function(_0x20f2b9,_0x58a1f8){_0x20f2b9=_0x20f2b9-0x0;var _0x576dc9=_0x3d30[_0x20f2b9];return _0x576dc9;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x03d3('0x0')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x03d3('0x1')],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x03d3('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x03d3('0x2')}}; \ No newline at end of file +var _0xc55e=['INTEGER','contactListQueue','moment','sequelize','exports','STRING'];(function(_0xa28b1a,_0x384f4b){var _0x4c9b78=function(_0x3cf640){while(--_0x3cf640){_0xa28b1a['push'](_0xa28b1a['shift']());}};_0x4c9b78(++_0x384f4b);}(_0xc55e,0x146));var _0xec55=function(_0x4d6e5f,_0x20bbb1){_0x4d6e5f=_0x4d6e5f-0x0;var _0x5b059c=_0xc55e[_0x4d6e5f];return _0x5b059c;};'use strict';var moment=require(_0xec55('0x0'));var Sequelize=require(_0xec55('0x1'));module[_0xec55('0x2')]={'phone':{'type':Sequelize[_0xec55('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xec55('0x4')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xec55('0x4')],'unique':_0xec55('0x5')},'VoiceQueueId':{'type':Sequelize[_0xec55('0x4')],'unique':_0xec55('0x5')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 9c18877..c3137da 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 _0xd37d=['intersection','fields','length','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','body','destroy','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','then','sendStatus','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','model','keys','query','attributes'];(function(_0x2c7162,_0xeea532){var _0x41e618=function(_0x30b0e4){while(--_0x30b0e4){_0x2c7162['push'](_0x2c7162['shift']());}};_0x41e618(++_0xeea532);}(_0xd37d,0xad));var _0xdd37=function(_0x1186ba,_0x421a86){_0x1186ba=_0x1186ba-0x0;var _0x13a347=_0xd37d[_0x1186ba];return _0x13a347;};'use strict';var emlformat=require(_0xdd37('0x0'));var rimraf=require(_0xdd37('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xdd37('0x2'));var moment=require(_0xdd37('0x3'));var BPromise=require(_0xdd37('0x4'));var Mustache=require(_0xdd37('0x5'));var util=require('util');var path=require('path');var sox=require(_0xdd37('0x6'));var csv=require(_0xdd37('0x7'));var ejs=require(_0xdd37('0x8'));var fs=require('fs');var fs_extra=require(_0xdd37('0x9'));var _=require(_0xdd37('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdd37('0xb'));var deskjs=require(_0xdd37('0xc'));var toCsv=require(_0xdd37('0x7'));var querystring=require(_0xdd37('0xd'));var Papa=require(_0xdd37('0xe'));var Redis=require(_0xdd37('0xf'));var authService=require(_0xdd37('0x10'));var qs=require(_0xdd37('0x11'));var as=require(_0xdd37('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdd37('0x13'))(_0xdd37('0x14'));var utils=require('../../config/utils');var config=require(_0xdd37('0x15'));var licenseUtil=require(_0xdd37('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x339329,_0x354849){_0x354849=_0x354849||0xcc;return function(_0x51a6f4){if(_0x51a6f4){return _0x339329['sendStatus'](_0x354849);}return _0x339329[_0xdd37('0x17')](_0x354849)[_0xdd37('0x18')]();};}function respondWithResult(_0x3c6fb5,_0x385278){_0x385278=_0x385278||0xc8;return function(_0x1144de){if(_0x1144de){return _0x3c6fb5[_0xdd37('0x17')](_0x385278)[_0xdd37('0x19')](_0x1144de);}};}function respondWithFilteredResult(_0x4b317b,_0x166266){return function(_0x1f998f){if(_0x1f998f){var _0x5e28f9=typeof _0x166266['offset']==='undefined'&&typeof _0x166266['limit']===_0xdd37('0x1a');var _0x4cfca7=_0x1f998f[_0xdd37('0x1b')];var _0x1794a0=_0x5e28f9?0x0:_0x166266[_0xdd37('0x1c')];var _0x465c80=_0x5e28f9?_0x1f998f[_0xdd37('0x1b')]:_0x166266[_0xdd37('0x1c')]+_0x166266[_0xdd37('0x1d')];var _0x5d3894;if(_0x465c80>=_0x4cfca7){_0x465c80=_0x4cfca7;_0x5d3894=0xc8;}else{_0x5d3894=0xce;}_0x4b317b['status'](_0x5d3894);return _0x4b317b[_0xdd37('0x1e')](_0xdd37('0x1f'),_0x1794a0+'-'+_0x465c80+'/'+_0x4cfca7)[_0xdd37('0x19')](_0x1f998f);}return null;};}function patchUpdates(_0x238f27){return function(_0x2d515a){try{jsonpatch['apply'](_0x2d515a,_0x238f27,!![]);}catch(_0x19220c){return BPromise[_0xdd37('0x20')](_0x19220c);}return _0x2d515a[_0xdd37('0x21')]();};}function saveUpdates(_0x20d6a7,_0xdcab24){return function(_0x42c3c6){if(_0x42c3c6){return _0x42c3c6[_0xdd37('0x22')](_0x20d6a7)[_0xdd37('0x23')](function(_0x2203c8){return _0x2203c8;});}return null;};}function removeEntity(_0x2e1bc2,_0x277fc8){return function(_0x3e02df){if(_0x3e02df){return _0x3e02df['destroy']()[_0xdd37('0x23')](function(){_0x2e1bc2[_0xdd37('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x68afc8,_0x2d2cd6){return function(_0x4d68ee){if(!_0x4d68ee){_0x68afc8[_0xdd37('0x24')](0x194);}return _0x4d68ee;};}function handleError(_0x2e2892,_0x40a6b5){_0x40a6b5=_0x40a6b5||0x1f4;return function(_0xdd36aa){logger[_0xdd37('0x25')](_0xdd36aa[_0xdd37('0x26')]);if(_0xdd36aa[_0xdd37('0x27')]){delete _0xdd36aa[_0xdd37('0x27')];}_0x2e2892[_0xdd37('0x17')](_0x40a6b5)[_0xdd37('0x28')](_0xdd36aa);};}exports[_0xdd37('0x29')]=function(_0x5d00ad,_0x1d48fe){var _0x1f67b7={},_0x31c2cc={},_0x4a74cc={'count':0x0,'rows':[]};var _0x266652=_[_0xdd37('0x2a')](db[_0xdd37('0x2b')][_0xdd37('0x2c')],function(_0x8cc6d4){return{'name':_0x8cc6d4[_0xdd37('0x2d')],'type':_0x8cc6d4[_0xdd37('0x2e')][_0xdd37('0x2f')]};});_0x31c2cc[_0xdd37('0x30')]=_['map'](_0x266652,_0xdd37('0x27'));_0x31c2cc['query']=_[_0xdd37('0x31')](_0x5d00ad[_0xdd37('0x32')]);_0x31c2cc['filters']=_['intersection'](_0x31c2cc[_0xdd37('0x30')],_0x31c2cc['query']);_0x1f67b7[_0xdd37('0x33')]=_[_0xdd37('0x34')](_0x31c2cc[_0xdd37('0x30')],qs[_0xdd37('0x35')](_0x5d00ad[_0xdd37('0x32')]['fields']));_0x1f67b7[_0xdd37('0x33')]=_0x1f67b7[_0xdd37('0x33')][_0xdd37('0x36')]?_0x1f67b7[_0xdd37('0x33')]:_0x31c2cc['model'];if(!_0x5d00ad['query']['hasOwnProperty'](_0xdd37('0x37'))){_0x1f67b7['limit']=qs[_0xdd37('0x1d')](_0x5d00ad[_0xdd37('0x32')][_0xdd37('0x1d')]);_0x1f67b7['offset']=qs['offset'](_0x5d00ad['query']['offset']);}_0x1f67b7[_0xdd37('0x38')]=qs[_0xdd37('0x39')](_0x5d00ad[_0xdd37('0x32')][_0xdd37('0x39')]);_0x1f67b7[_0xdd37('0x3a')]=qs['filters'](_[_0xdd37('0x3b')](_0x5d00ad[_0xdd37('0x32')],_0x31c2cc[_0xdd37('0x3c')]),_0x266652);if(_0x5d00ad[_0xdd37('0x32')][_0xdd37('0x3d')]){_0x1f67b7[_0xdd37('0x3a')]=_[_0xdd37('0x3e')](_0x1f67b7['where'],{'$or':_['map'](_0x266652,function(_0x4313e4){if(_0x4313e4[_0xdd37('0x2e')]!==_0xdd37('0x3f')){var _0x30b925={};_0x30b925[_0x4313e4[_0xdd37('0x27')]]={'$like':'%'+_0x5d00ad[_0xdd37('0x32')][_0xdd37('0x3d')]+'%'};return _0x30b925;}})});}_0x1f67b7=_[_0xdd37('0x3e')]({},_0x1f67b7,_0x5d00ad[_0xdd37('0x40')]);var _0x378874={'where':_0x1f67b7[_0xdd37('0x3a')]};return db[_0xdd37('0x2b')][_0xdd37('0x1b')](_0x378874)[_0xdd37('0x23')](function(_0x5e695b){_0x4a74cc[_0xdd37('0x1b')]=_0x5e695b;if(_0x5d00ad[_0xdd37('0x32')][_0xdd37('0x41')]){_0x1f67b7[_0xdd37('0x42')]=[{'all':!![]}];}return db[_0xdd37('0x2b')][_0xdd37('0x43')](_0x1f67b7);})[_0xdd37('0x23')](function(_0x1a09fe){_0x4a74cc[_0xdd37('0x44')]=_0x1a09fe;return _0x4a74cc;})[_0xdd37('0x23')](respondWithFilteredResult(_0x1d48fe,_0x1f67b7))['catch'](handleError(_0x1d48fe,null));};exports['show']=function(_0xae2833,_0x4048d3){var _0xf00279={'raw':!![],'where':{'id':_0xae2833[_0xdd37('0x45')]['id']}},_0x4c9442={};_0x4c9442[_0xdd37('0x30')]=_[_0xdd37('0x31')](db['CmHopperBlack']['rawAttributes']);_0x4c9442[_0xdd37('0x32')]=_['keys'](_0xae2833[_0xdd37('0x32')]);_0x4c9442[_0xdd37('0x3c')]=_['intersection'](_0x4c9442['model'],_0x4c9442[_0xdd37('0x32')]);_0xf00279[_0xdd37('0x33')]=_[_0xdd37('0x34')](_0x4c9442[_0xdd37('0x30')],qs['fields'](_0xae2833[_0xdd37('0x32')][_0xdd37('0x35')]));_0xf00279['attributes']=_0xf00279['attributes'][_0xdd37('0x36')]?_0xf00279[_0xdd37('0x33')]:_0x4c9442['model'];if(_0xae2833[_0xdd37('0x32')]['includeAll']){_0xf00279[_0xdd37('0x42')]=[{'all':!![]}];}_0xf00279=_[_0xdd37('0x3e')]({},_0xf00279,_0xae2833[_0xdd37('0x40')]);return db['CmHopperBlack'][_0xdd37('0x46')](_0xf00279)['then'](handleEntityNotFound(_0x4048d3,null))[_0xdd37('0x23')](respondWithResult(_0x4048d3,null))[_0xdd37('0x47')](handleError(_0x4048d3,null));};exports[_0xdd37('0x22')]=function(_0x1d45b0,_0x1e355a){if(_0x1d45b0[_0xdd37('0x48')]['id']){delete _0x1d45b0[_0xdd37('0x48')]['id'];}return db[_0xdd37('0x2b')]['find']({'where':{'id':_0x1d45b0[_0xdd37('0x45')]['id']}})[_0xdd37('0x23')](handleEntityNotFound(_0x1e355a,null))['then'](saveUpdates(_0x1d45b0[_0xdd37('0x48')],null))[_0xdd37('0x23')](respondWithResult(_0x1e355a,null))['catch'](handleError(_0x1e355a,null));};exports[_0xdd37('0x49')]=function(_0x2fea8a,_0x21477d){return db[_0xdd37('0x2b')][_0xdd37('0x46')]({'where':{'id':_0x2fea8a[_0xdd37('0x45')]['id']}})['then'](handleEntityNotFound(_0x21477d,null))['then'](removeEntity(_0x21477d,null))[_0xdd37('0x47')](handleError(_0x21477d,null));};exports[_0xdd37('0x4a')]=function(_0x360fc3,_0x36d618){return db[_0xdd37('0x2b')][_0xdd37('0x4a')]()['then'](respondWithResult(_0x36d618,null))[_0xdd37('0x47')](handleError(_0x36d618,null));}; \ No newline at end of file +var _0x1a62=['filters','where','VIRTUAL','options','count','includeAll','include','findAll','show','params','find','catch','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','set','apply','reject','save','update','then','destroy','end','error','name','send','index','CmHopperBlack','rawAttributes','fieldName','type','key','map','keys','intersection','model','query','attributes','fields','length','nolimit','order','sort','pick'];(function(_0x235340,_0x2a7e4b){var _0x163e1c=function(_0x10c8af){while(--_0x10c8af){_0x235340['push'](_0x235340['shift']());}};_0x163e1c(++_0x2a7e4b);}(_0x1a62,0x176));var _0x21a6=function(_0x193098,_0x53605a){_0x193098=_0x193098-0x0;var _0x396924=_0x1a62[_0x193098];return _0x396924;};'use strict';var emlformat=require(_0x21a6('0x0'));var rimraf=require(_0x21a6('0x1'));var zipdir=require(_0x21a6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x21a6('0x3'));var moment=require(_0x21a6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x21a6('0x5'));var path=require('path');var sox=require(_0x21a6('0x6'));var csv=require(_0x21a6('0x7'));var ejs=require(_0x21a6('0x8'));var fs=require('fs');var fs_extra=require(_0x21a6('0x9'));var _=require(_0x21a6('0xa'));var squel=require('squel');var crypto=require(_0x21a6('0xb'));var jsforce=require(_0x21a6('0xc'));var deskjs=require(_0x21a6('0xd'));var toCsv=require(_0x21a6('0x7'));var querystring=require(_0x21a6('0xe'));var Papa=require(_0x21a6('0xf'));var Redis=require('ioredis');var authService=require(_0x21a6('0x10'));var qs=require(_0x21a6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x21a6('0x12'));var logger=require(_0x21a6('0x13'))('api');var utils=require(_0x21a6('0x14'));var config=require(_0x21a6('0x15'));var licenseUtil=require(_0x21a6('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b8200,_0x3eec3f){_0x3eec3f=_0x3eec3f||0xcc;return function(_0x56f64f){if(_0x56f64f){return _0x3b8200[_0x21a6('0x17')](_0x3eec3f);}return _0x3b8200['status'](_0x3eec3f)['end']();};}function respondWithResult(_0x48f3ec,_0x3c57aa){_0x3c57aa=_0x3c57aa||0xc8;return function(_0xc90d31){if(_0xc90d31){return _0x48f3ec[_0x21a6('0x18')](_0x3c57aa)[_0x21a6('0x19')](_0xc90d31);}};}function respondWithFilteredResult(_0xc1c94f,_0x38223f){return function(_0x25d121){if(_0x25d121){var _0x5a43e7=typeof _0x38223f[_0x21a6('0x1a')]===_0x21a6('0x1b')&&typeof _0x38223f[_0x21a6('0x1c')]===_0x21a6('0x1b');var _0x3dca6f=_0x25d121['count'];var _0x256dea=_0x5a43e7?0x0:_0x38223f[_0x21a6('0x1a')];var _0x4814bf=_0x5a43e7?_0x25d121['count']:_0x38223f[_0x21a6('0x1a')]+_0x38223f[_0x21a6('0x1c')];var _0x5e9616;if(_0x4814bf>=_0x3dca6f){_0x4814bf=_0x3dca6f;_0x5e9616=0xc8;}else{_0x5e9616=0xce;}_0xc1c94f[_0x21a6('0x18')](_0x5e9616);return _0xc1c94f[_0x21a6('0x1d')]('Content-Range',_0x256dea+'-'+_0x4814bf+'/'+_0x3dca6f)['json'](_0x25d121);}return null;};}function patchUpdates(_0xf215){return function(_0x1fc028){try{jsonpatch[_0x21a6('0x1e')](_0x1fc028,_0xf215,!![]);}catch(_0x16a9c1){return BPromise[_0x21a6('0x1f')](_0x16a9c1);}return _0x1fc028[_0x21a6('0x20')]();};}function saveUpdates(_0x1ee13,_0x5ac597){return function(_0x225eeb){if(_0x225eeb){return _0x225eeb[_0x21a6('0x21')](_0x1ee13)[_0x21a6('0x22')](function(_0x361527){return _0x361527;});}return null;};}function removeEntity(_0x11b256,_0x5ee275){return function(_0x525ab3){if(_0x525ab3){return _0x525ab3[_0x21a6('0x23')]()[_0x21a6('0x22')](function(){_0x11b256[_0x21a6('0x18')](0xcc)[_0x21a6('0x24')]();});}};}function handleEntityNotFound(_0x357dd4,_0x249e52){return function(_0x9e5776){if(!_0x9e5776){_0x357dd4[_0x21a6('0x17')](0x194);}return _0x9e5776;};}function handleError(_0x3e0337,_0x54ea40){_0x54ea40=_0x54ea40||0x1f4;return function(_0x13a8fa){logger[_0x21a6('0x25')](_0x13a8fa['stack']);if(_0x13a8fa[_0x21a6('0x26')]){delete _0x13a8fa['name'];}_0x3e0337[_0x21a6('0x18')](_0x54ea40)[_0x21a6('0x27')](_0x13a8fa);};}exports[_0x21a6('0x28')]=function(_0x1ab21f,_0x161fe5){var _0x2d9603={},_0x25886c={},_0x10c784={'count':0x0,'rows':[]};var _0x1b00ad=_['map'](db[_0x21a6('0x29')][_0x21a6('0x2a')],function(_0xb0653){return{'name':_0xb0653[_0x21a6('0x2b')],'type':_0xb0653[_0x21a6('0x2c')][_0x21a6('0x2d')]};});_0x25886c['model']=_[_0x21a6('0x2e')](_0x1b00ad,_0x21a6('0x26'));_0x25886c['query']=_[_0x21a6('0x2f')](_0x1ab21f['query']);_0x25886c['filters']=_[_0x21a6('0x30')](_0x25886c[_0x21a6('0x31')],_0x25886c[_0x21a6('0x32')]);_0x2d9603[_0x21a6('0x33')]=_[_0x21a6('0x30')](_0x25886c[_0x21a6('0x31')],qs[_0x21a6('0x34')](_0x1ab21f[_0x21a6('0x32')][_0x21a6('0x34')]));_0x2d9603[_0x21a6('0x33')]=_0x2d9603[_0x21a6('0x33')][_0x21a6('0x35')]?_0x2d9603[_0x21a6('0x33')]:_0x25886c[_0x21a6('0x31')];if(!_0x1ab21f[_0x21a6('0x32')]['hasOwnProperty'](_0x21a6('0x36'))){_0x2d9603[_0x21a6('0x1c')]=qs[_0x21a6('0x1c')](_0x1ab21f[_0x21a6('0x32')]['limit']);_0x2d9603[_0x21a6('0x1a')]=qs[_0x21a6('0x1a')](_0x1ab21f[_0x21a6('0x32')]['offset']);}_0x2d9603[_0x21a6('0x37')]=qs[_0x21a6('0x38')](_0x1ab21f[_0x21a6('0x32')]['sort']);_0x2d9603['where']=qs['filters'](_[_0x21a6('0x39')](_0x1ab21f[_0x21a6('0x32')],_0x25886c[_0x21a6('0x3a')]),_0x1b00ad);if(_0x1ab21f['query']['filter']){_0x2d9603[_0x21a6('0x3b')]=_['merge'](_0x2d9603[_0x21a6('0x3b')],{'$or':_[_0x21a6('0x2e')](_0x1b00ad,function(_0x473f1f){if(_0x473f1f[_0x21a6('0x2c')]!==_0x21a6('0x3c')){var _0x50a022={};_0x50a022[_0x473f1f['name']]={'$like':'%'+_0x1ab21f[_0x21a6('0x32')]['filter']+'%'};return _0x50a022;}})});}_0x2d9603=_['merge']({},_0x2d9603,_0x1ab21f[_0x21a6('0x3d')]);var _0x8bf9c6={'where':_0x2d9603[_0x21a6('0x3b')]};return db[_0x21a6('0x29')]['count'](_0x8bf9c6)[_0x21a6('0x22')](function(_0x13ee44){_0x10c784[_0x21a6('0x3e')]=_0x13ee44;if(_0x1ab21f[_0x21a6('0x32')][_0x21a6('0x3f')]){_0x2d9603[_0x21a6('0x40')]=[{'all':!![]}];}return db[_0x21a6('0x29')][_0x21a6('0x41')](_0x2d9603);})[_0x21a6('0x22')](function(_0xf1325a){_0x10c784['rows']=_0xf1325a;return _0x10c784;})[_0x21a6('0x22')](respondWithFilteredResult(_0x161fe5,_0x2d9603))['catch'](handleError(_0x161fe5,null));};exports[_0x21a6('0x42')]=function(_0x53465c,_0x389421){var _0x2c797f={'raw':!![],'where':{'id':_0x53465c[_0x21a6('0x43')]['id']}},_0x405869={};_0x405869['model']=_[_0x21a6('0x2f')](db[_0x21a6('0x29')][_0x21a6('0x2a')]);_0x405869[_0x21a6('0x32')]=_[_0x21a6('0x2f')](_0x53465c[_0x21a6('0x32')]);_0x405869['filters']=_[_0x21a6('0x30')](_0x405869[_0x21a6('0x31')],_0x405869[_0x21a6('0x32')]);_0x2c797f[_0x21a6('0x33')]=_[_0x21a6('0x30')](_0x405869[_0x21a6('0x31')],qs[_0x21a6('0x34')](_0x53465c[_0x21a6('0x32')][_0x21a6('0x34')]));_0x2c797f[_0x21a6('0x33')]=_0x2c797f[_0x21a6('0x33')][_0x21a6('0x35')]?_0x2c797f[_0x21a6('0x33')]:_0x405869['model'];if(_0x53465c[_0x21a6('0x32')][_0x21a6('0x3f')]){_0x2c797f[_0x21a6('0x40')]=[{'all':!![]}];}_0x2c797f=_['merge']({},_0x2c797f,_0x53465c['options']);return db['CmHopperBlack'][_0x21a6('0x44')](_0x2c797f)[_0x21a6('0x22')](handleEntityNotFound(_0x389421,null))[_0x21a6('0x22')](respondWithResult(_0x389421,null))[_0x21a6('0x45')](handleError(_0x389421,null));};exports[_0x21a6('0x21')]=function(_0x540139,_0x515a32){if(_0x540139['body']['id']){delete _0x540139[_0x21a6('0x46')]['id'];}return db['CmHopperBlack'][_0x21a6('0x44')]({'where':{'id':_0x540139[_0x21a6('0x43')]['id']}})[_0x21a6('0x22')](handleEntityNotFound(_0x515a32,null))[_0x21a6('0x22')](saveUpdates(_0x540139[_0x21a6('0x46')],null))[_0x21a6('0x22')](respondWithResult(_0x515a32,null))[_0x21a6('0x45')](handleError(_0x515a32,null));};exports['destroy']=function(_0x60cd7a,_0x192393){return db['CmHopperBlack'][_0x21a6('0x44')]({'where':{'id':_0x60cd7a[_0x21a6('0x43')]['id']}})[_0x21a6('0x22')](handleEntityNotFound(_0x192393,null))[_0x21a6('0x22')](removeEntity(_0x192393,null))[_0x21a6('0x45')](handleError(_0x192393,null));};exports[_0x21a6('0x47')]=function(_0x278199,_0x4100c3){return db[_0x21a6('0x29')][_0x21a6('0x47')]()['then'](respondWithResult(_0x4100c3,null))[_0x21a6('0x45')](handleError(_0x4100c3,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index b3136d1..35ab812 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 _0x5f11=['cm_hopper_black','../../config/logger','api','bluebird','request-promise','rimraf','define','CmHopperBlack'];(function(_0xd6d6b,_0x478cdc){var _0x5a293b=function(_0x22f82f){while(--_0x22f82f){_0xd6d6b['push'](_0xd6d6b['shift']());}};_0x5a293b(++_0x478cdc);}(_0x5f11,0x149));var _0x15f1=function(_0xc7c59d,_0x57c4c5){_0xc7c59d=_0xc7c59d-0x0;var _0x48a06e=_0x5f11[_0xc7c59d];return _0x48a06e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x15f1('0x0'))(_0x15f1('0x1'));var moment=require('moment');var BPromise=require(_0x15f1('0x2'));var rp=require(_0x15f1('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x15f1('0x4'));var config=require('../../config/environment');var attributes=require('./cmHopperBlack.attributes');module['exports']=function(_0x3f8650,_0x15caa9){return _0x3f8650[_0x15f1('0x5')](_0x15f1('0x6'),attributes,{'tableName':_0x15f1('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe3f=['exports','CmHopperBlack','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x324a41,_0x109a91){var _0x10ad60=function(_0x506e9c){while(--_0x506e9c){_0x324a41['push'](_0x324a41['shift']());}};_0x10ad60(++_0x109a91);}(_0xfe3f,0x9c));var _0xffe3=function(_0x15f51c,_0x32bd75){_0x15f51c=_0x15f51c-0x0;var _0x34149e=_0xfe3f[_0x15f51c];return _0x34149e;};'use strict';var _=require(_0xffe3('0x0'));var util=require(_0xffe3('0x1'));var logger=require(_0xffe3('0x2'))(_0xffe3('0x3'));var moment=require('moment');var BPromise=require(_0xffe3('0x4'));var rp=require(_0xffe3('0x5'));var fs=require('fs');var path=require(_0xffe3('0x6'));var rimraf=require(_0xffe3('0x7'));var config=require(_0xffe3('0x8'));var attributes=require('./cmHopperBlack.attributes');module[_0xffe3('0x9')]=function(_0x4519c0,_0x59596e){return _0x4519c0['define'](_0xffe3('0xa'),attributes,{'tableName':'cm_hopper_black','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 ebb8b37..ff5b821 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 _0xfa5e=['where','DestroyCmHopperBlack','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','message','CmHopperBlack,\x20%s,\x20%s','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','map','include','model','attributes','debug','update','limit','UpdateCmHopperBlack','destroy'];(function(_0x123733,_0x564c9f){var _0x467e8b=function(_0x1ea04c){while(--_0x1ea04c){_0x123733['push'](_0x123733['shift']());}};_0x467e8b(++_0x564c9f);}(_0xfa5e,0x9a));var _0xefa5=function(_0x441ce7,_0x2ca1cd){_0x441ce7=_0x441ce7-0x0;var _0x158fd8=_0xfa5e[_0x441ce7];return _0x158fd8;};'use strict';var _=require(_0xefa5('0x0'));var util=require(_0xefa5('0x1'));var moment=require('moment');var BPromise=require(_0xefa5('0x2'));var rs=require(_0xefa5('0x3'));var fs=require('fs');var Redis=require(_0xefa5('0x4'));var db=require(_0xefa5('0x5'))['db'];var utils=require(_0xefa5('0x6'));var logger=require(_0xefa5('0x7'))(_0xefa5('0x8'));var config=require(_0xefa5('0x9'));var jayson=require(_0xefa5('0xa'));var client=jayson[_0xefa5('0xb')][_0xefa5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1e22f9,_0x58fdcb,_0x14050a){return new BPromise(function(_0x4b5ee0,_0x5e397d){return client[_0xefa5('0xd')](_0x1e22f9,_0x14050a)[_0xefa5('0xe')](function(_0x5a01f3){logger[_0xefa5('0xf')]('CmHopperBlack,\x20%s,\x20%s',_0x58fdcb,_0xefa5('0x10'));logger['debug']('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x58fdcb,_0xefa5('0x10'),JSON[_0xefa5('0x11')](_0x5a01f3));if(_0x5a01f3[_0xefa5('0x12')]){if(_0x5a01f3[_0xefa5('0x12')]['code']===0x1f4){logger[_0xefa5('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x58fdcb,_0x5a01f3[_0xefa5('0x12')][_0xefa5('0x13')]);return _0x5e397d(_0x5a01f3[_0xefa5('0x12')][_0xefa5('0x13')]);}logger['error'](_0xefa5('0x14'),_0x58fdcb,_0x5a01f3[_0xefa5('0x12')][_0xefa5('0x13')]);return _0x4b5ee0(_0x5a01f3[_0xefa5('0x12')][_0xefa5('0x13')]);}else{logger[_0xefa5('0xf')](_0xefa5('0x14'),_0x58fdcb,_0xefa5('0x10'));_0x4b5ee0(_0x5a01f3['result'][_0xefa5('0x13')]);}})[_0xefa5('0x15')](function(_0x150536){logger['error'](_0xefa5('0x14'),_0x58fdcb,_0x150536);_0x5e397d(_0x150536);});});}exports[_0xefa5('0x16')]=function(_0x17c37a){var _0x112146=this;return new Promise(function(_0x37146f,_0x4c93e4){return db[_0xefa5('0x17')][_0xefa5('0x18')]({'raw':_0x17c37a[_0xefa5('0x19')]?_0x17c37a[_0xefa5('0x19')][_0xefa5('0x1a')]===undefined?!![]:![]:!![],'where':_0x17c37a['options']?_0x17c37a[_0xefa5('0x19')]['where']||null:null,'attributes':_0x17c37a['options']?_0x17c37a[_0xefa5('0x19')]['attributes']||null:null,'limit':_0x17c37a[_0xefa5('0x19')]?_0x17c37a[_0xefa5('0x19')]['limit']||null:null,'include':_0x17c37a[_0xefa5('0x19')]?_0x17c37a[_0xefa5('0x19')]['include']?_[_0xefa5('0x1b')](_0x17c37a[_0xefa5('0x19')][_0xefa5('0x1c')],function(_0x260013){return{'model':db[_0x260013[_0xefa5('0x1d')]],'as':_0x260013['as'],'attributes':_0x260013['attributes'],'include':_0x260013['include']?_['map'](_0x260013['include'],function(_0x26fdbd){return{'model':db[_0x26fdbd['model']],'as':_0x26fdbd['as'],'attributes':_0x26fdbd['attributes'],'include':_0x26fdbd[_0xefa5('0x1c')]?_[_0xefa5('0x1b')](_0x26fdbd[_0xefa5('0x1c')],function(_0x3fcaf4){return{'model':db[_0x3fcaf4[_0xefa5('0x1d')]],'as':_0x3fcaf4['as'],'attributes':_0x3fcaf4[_0xefa5('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xefa5('0xe')](function(_0x5d2c81){logger[_0xefa5('0xf')](_0xefa5('0x16'),_0x17c37a);logger[_0xefa5('0x1f')](_0xefa5('0x16'),_0x17c37a,JSON['stringify'](_0x5d2c81));_0x37146f(_0x5d2c81);})[_0xefa5('0x15')](function(_0x136b2a){logger['error'](_0xefa5('0x16'),_0x136b2a[_0xefa5('0x13')],_0x17c37a);_0x4c93e4(_0x112146[_0xefa5('0x12')](0x1f4,_0x136b2a[_0xefa5('0x13')]));});});};exports['UpdateCmHopperBlack']=function(_0x181c44){var _0x59c6e3=this;return new Promise(function(_0xe58e7d,_0x283923){return db[_0xefa5('0x17')][_0xefa5('0x20')](_0x181c44['body'],{'raw':_0x181c44['options']?_0x181c44[_0xefa5('0x19')][_0xefa5('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x181c44[_0xefa5('0x19')]?_0x181c44[_0xefa5('0x19')]['where']||null:null,'attributes':_0x181c44[_0xefa5('0x19')]?_0x181c44[_0xefa5('0x19')][_0xefa5('0x1e')]||null:null,'limit':_0x181c44[_0xefa5('0x19')]?_0x181c44[_0xefa5('0x19')][_0xefa5('0x21')]||null:null})[_0xefa5('0xe')](function(_0x111ced){logger[_0xefa5('0xf')]('UpdateCmHopperBlack',_0x181c44);logger['debug']('UpdateCmHopperBlack',_0x181c44,JSON[_0xefa5('0x11')](_0x111ced));_0xe58e7d(_0x111ced);})['catch'](function(_0x47a443){logger[_0xefa5('0x12')](_0xefa5('0x22'),_0x47a443[_0xefa5('0x13')],_0x181c44);_0x283923(_0x59c6e3[_0xefa5('0x12')](0x1f4,_0x47a443[_0xefa5('0x13')]));});});};exports['DestroyCmHopperBlack']=function(_0x5c1755){var _0x4764ea=this;return new Promise(function(_0x3e2a5b,_0x8259fd){return db['CmHopperBlack'][_0xefa5('0x23')]({'where':_0x5c1755[_0xefa5('0x19')]?_0x5c1755[_0xefa5('0x19')][_0xefa5('0x24')]||null:null})[_0xefa5('0xe')](function(_0x26f79a){logger[_0xefa5('0xf')](_0xefa5('0x25'),_0x5c1755);logger[_0xefa5('0x1f')](_0xefa5('0x25'),_0x5c1755,JSON[_0xefa5('0x11')](_0x26f79a));_0x3e2a5b(_0x26f79a);})[_0xefa5('0x15')](function(_0x4c9181){logger['error'](_0xefa5('0x25'),_0x4c9181[_0xefa5('0x13')],_0x5c1755);_0x8259fd(_0x4764ea[_0xefa5('0x12')](0x1f4,_0x4c9181[_0xefa5('0x13')]));});});}; \ No newline at end of file +var _0x56f6=['body','limit','info','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','CmHopperBlack,\x20%s,\x20%s','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CmHopperBlack','findAll','options','raw','where','include','map','model','attributes','GetCmHopperBlack','debug','UpdateCmHopperBlack','update'];(function(_0x247ada,_0x1e4bef){var _0x4c15fa=function(_0x16150e){while(--_0x16150e){_0x247ada['push'](_0x247ada['shift']());}};_0x4c15fa(++_0x1e4bef);}(_0x56f6,0x18b));var _0x656f=function(_0x51630e,_0x58b570){_0x51630e=_0x51630e-0x0;var _0x15c758=_0x56f6[_0x51630e];return _0x15c758;};'use strict';var _=require(_0x656f('0x0'));var util=require(_0x656f('0x1'));var moment=require(_0x656f('0x2'));var BPromise=require(_0x656f('0x3'));var rs=require(_0x656f('0x4'));var fs=require('fs');var Redis=require(_0x656f('0x5'));var db=require(_0x656f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x656f('0x7'))('rpc');var config=require(_0x656f('0x8'));var jayson=require(_0x656f('0x9'));var client=jayson['client'][_0x656f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x40153e,_0x429150,_0x2070c8){return new BPromise(function(_0x5eae80,_0x5e1967){return client[_0x656f('0xb')](_0x40153e,_0x2070c8)[_0x656f('0xc')](function(_0x47674b){logger['info'](_0x656f('0xd'),_0x429150,'request\x20sent');logger['debug'](_0x656f('0xe'),_0x429150,_0x656f('0xf'),JSON[_0x656f('0x10')](_0x47674b));if(_0x47674b[_0x656f('0x11')]){if(_0x47674b[_0x656f('0x11')][_0x656f('0x12')]===0x1f4){logger[_0x656f('0x11')](_0x656f('0xd'),_0x429150,_0x47674b[_0x656f('0x11')][_0x656f('0x13')]);return _0x5e1967(_0x47674b['error'][_0x656f('0x13')]);}logger[_0x656f('0x11')](_0x656f('0xd'),_0x429150,_0x47674b[_0x656f('0x11')][_0x656f('0x13')]);return _0x5eae80(_0x47674b['error'][_0x656f('0x13')]);}else{logger['info'](_0x656f('0xd'),_0x429150,_0x656f('0xf'));_0x5eae80(_0x47674b['result']['message']);}})[_0x656f('0x14')](function(_0x487b6b){logger[_0x656f('0x11')](_0x656f('0xd'),_0x429150,_0x487b6b);_0x5e1967(_0x487b6b);});});}exports['GetCmHopperBlack']=function(_0x3f393d){var _0xb72133=this;return new Promise(function(_0x4f5e70,_0x246a9e){return db[_0x656f('0x15')][_0x656f('0x16')]({'raw':_0x3f393d[_0x656f('0x17')]?_0x3f393d[_0x656f('0x17')][_0x656f('0x18')]===undefined?!![]:![]:!![],'where':_0x3f393d[_0x656f('0x17')]?_0x3f393d['options'][_0x656f('0x19')]||null:null,'attributes':_0x3f393d['options']?_0x3f393d[_0x656f('0x17')]['attributes']||null:null,'limit':_0x3f393d['options']?_0x3f393d[_0x656f('0x17')]['limit']||null:null,'include':_0x3f393d[_0x656f('0x17')]?_0x3f393d['options'][_0x656f('0x1a')]?_[_0x656f('0x1b')](_0x3f393d['options'][_0x656f('0x1a')],function(_0x4eda57){return{'model':db[_0x4eda57[_0x656f('0x1c')]],'as':_0x4eda57['as'],'attributes':_0x4eda57[_0x656f('0x1d')],'include':_0x4eda57[_0x656f('0x1a')]?_[_0x656f('0x1b')](_0x4eda57[_0x656f('0x1a')],function(_0x11e623){return{'model':db[_0x11e623[_0x656f('0x1c')]],'as':_0x11e623['as'],'attributes':_0x11e623['attributes'],'include':_0x11e623[_0x656f('0x1a')]?_[_0x656f('0x1b')](_0x11e623['include'],function(_0x3f69be){return{'model':db[_0x3f69be[_0x656f('0x1c')]],'as':_0x3f69be['as'],'attributes':_0x3f69be['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x25bb54){logger['info'](_0x656f('0x1e'),_0x3f393d);logger[_0x656f('0x1f')]('GetCmHopperBlack',_0x3f393d,JSON['stringify'](_0x25bb54));_0x4f5e70(_0x25bb54);})['catch'](function(_0x49a3fb){logger['error'](_0x656f('0x1e'),_0x49a3fb['message'],_0x3f393d);_0x246a9e(_0xb72133['error'](0x1f4,_0x49a3fb['message']));});});};exports[_0x656f('0x20')]=function(_0x46b589){var _0x3043e0=this;return new Promise(function(_0x26aa77,_0x3d69da){return db[_0x656f('0x15')][_0x656f('0x21')](_0x46b589[_0x656f('0x22')],{'raw':_0x46b589[_0x656f('0x17')]?_0x46b589[_0x656f('0x17')][_0x656f('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46b589[_0x656f('0x17')]?_0x46b589[_0x656f('0x17')][_0x656f('0x19')]||null:null,'attributes':_0x46b589['options']?_0x46b589['options']['attributes']||null:null,'limit':_0x46b589['options']?_0x46b589[_0x656f('0x17')][_0x656f('0x23')]||null:null})[_0x656f('0xc')](function(_0x33d556){logger[_0x656f('0x24')](_0x656f('0x20'),_0x46b589);logger['debug'](_0x656f('0x20'),_0x46b589,JSON[_0x656f('0x10')](_0x33d556));_0x26aa77(_0x33d556);})[_0x656f('0x14')](function(_0x43ba00){logger[_0x656f('0x11')](_0x656f('0x20'),_0x43ba00[_0x656f('0x13')],_0x46b589);_0x3d69da(_0x3043e0[_0x656f('0x11')](0x1f4,_0x43ba00[_0x656f('0x13')]));});});};exports[_0x656f('0x25')]=function(_0x578b2a){var _0x24edf0=this;return new Promise(function(_0x14aa07,_0x46e4a7){return db['CmHopperBlack'][_0x656f('0x26')]({'where':_0x578b2a[_0x656f('0x17')]?_0x578b2a[_0x656f('0x17')][_0x656f('0x19')]||null:null})['then'](function(_0x31bdb0){logger['info'](_0x656f('0x25'),_0x578b2a);logger[_0x656f('0x1f')]('DestroyCmHopperBlack',_0x578b2a,JSON[_0x656f('0x10')](_0x31bdb0));_0x14aa07(_0x31bdb0);})['catch'](function(_0x58bad7){logger[_0x656f('0x11')](_0x656f('0x25'),_0x58bad7[_0x656f('0x13')],_0x578b2a);_0x46e4a7(_0x24edf0[_0x656f('0x11')](0x1f4,_0x58bad7[_0x656f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index de447ec..eecbb84 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 _0xeda8=['get','isAuthenticated','index','describe','/:id','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller'];(function(_0x3f3d0e,_0x8a0892){var _0x3b84ad=function(_0x3fae1c){while(--_0x3fae1c){_0x3f3d0e['push'](_0x3f3d0e['shift']());}};_0x3b84ad(++_0x8a0892);}(_0xeda8,0x104));var _0x8eda=function(_0x337664,_0x93f68d){_0x337664=_0x337664-0x0;var _0x7f5c70=_0xeda8[_0x337664];return _0x7f5c70;};'use strict';var multer=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var path=require('path');var timeout=require(_0x8eda('0x2'));var express=require(_0x8eda('0x3'));var router=express[_0x8eda('0x4')]();var fs_extra=require(_0x8eda('0x5'));var auth=require(_0x8eda('0x6'));var interaction=require(_0x8eda('0x7'));var config=require(_0x8eda('0x8'));var controller=require(_0x8eda('0x9'));router[_0x8eda('0xa')]('/',auth[_0x8eda('0xb')](),controller[_0x8eda('0xc')]);router[_0x8eda('0xa')]('/describe',auth[_0x8eda('0xb')](),controller[_0x8eda('0xd')]);router[_0x8eda('0xa')](_0x8eda('0xe'),auth['isAuthenticated'](),controller['show']);router['put']('/:id',auth[_0x8eda('0xb')](),controller[_0x8eda('0xf')]);router[_0x8eda('0x10')]('/:id',auth[_0x8eda('0xb')](),controller['destroy']);module[_0x8eda('0x11')]=router; \ No newline at end of file +var _0xabce=['show','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe'];(function(_0x17dfe4,_0x45d2ba){var _0x4d2059=function(_0x5e6d12){while(--_0x5e6d12){_0x17dfe4['push'](_0x17dfe4['shift']());}};_0x4d2059(++_0x45d2ba);}(_0xabce,0x103));var _0xeabc=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0xabce[_0x18cd5b];return _0x5eaa52;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./cmHopperBlack.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/describe',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xb')]);router[_0xeabc('0xc')](_0xeabc('0xd'),auth[_0xeabc('0x8')](),controller[_0xeabc('0xe')]);router[_0xeabc('0xf')](_0xeabc('0xd'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x10')]);module[_0xeabc('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 a18e603..ba1e74d 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 _0x90fe=['exports','INTEGER','STRING','DATE','endtime','setDataValue','followuptime','diff','seconds','BOOLEAN','sequelize','moment'];(function(_0x2405bc,_0x2f28a1){var _0x5272d4=function(_0x225294){while(--_0x225294){_0x2405bc['push'](_0x2405bc['shift']());}};_0x5272d4(++_0x2f28a1);}(_0x90fe,0xa6));var _0xe90f=function(_0xc6a1a4,_0x43eeda){_0xc6a1a4=_0xc6a1a4-0x0;var _0x292d14=_0x90fe[_0xc6a1a4];return _0x292d14;};'use strict';var Sequelize=require(_0xe90f('0x0'));var moment=require(_0xe90f('0x1'));module[_0xe90f('0x2')]={'state':{'type':Sequelize[_0xe90f('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xe90f('0x4')]},'scheduledat':{'type':Sequelize[_0xe90f('0x5')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe90f('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xe90f('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xe90f('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xe90f('0x4')]},'starttime':{'type':Sequelize[_0xe90f('0x5')]},'responsetime':{'type':Sequelize[_0xe90f('0x5')]},'answertime':{'type':Sequelize[_0xe90f('0x5')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xe90f('0x5')]},'ringtime':{'type':Sequelize[_0xe90f('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xe90f('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xe90f('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xe90f('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xe90f('0x4')]},'campaign':{'type':Sequelize[_0xe90f('0x4')]},'campaigntype':{'type':Sequelize[_0xe90f('0x4')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xe90f('0x4')]},'secondDisposition':{'type':Sequelize[_0xe90f('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0xe90f('0x5')],'set':function(_0x1ad6d8){var _0x2b0e49=this['getDataValue'](_0xe90f('0x6'));if(_0x2b0e49&&_0x1ad6d8){this[_0xe90f('0x7')](_0xe90f('0x8'),moment(_0x1ad6d8)[_0xe90f('0x9')](moment(_0x2b0e49),_0xe90f('0xa')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xe90f('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xe90f('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xe90f('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xe90f('0x5')]},'callback':{'type':Sequelize[_0xe90f('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xe90f('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xe90f('0x5')]},'deleted':{'type':Sequelize[_0xe90f('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xe90f('0x5')]},'recallme':{'type':Sequelize[_0xe90f('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0xe90f('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xe90f('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe90f('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe90f('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8fc2=['STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','seconds','BOOLEAN','sequelize','moment','exports','INTEGER'];(function(_0x3eee78,_0x5acc63){var _0x53a5e5=function(_0x472fb6){while(--_0x472fb6){_0x3eee78['push'](_0x3eee78['shift']());}};_0x53a5e5(++_0x5acc63);}(_0x8fc2,0x14e));var _0x28fc=function(_0x27cf39,_0x8c23da){_0x27cf39=_0x27cf39-0x0;var _0x1e0b21=_0x8fc2[_0x27cf39];return _0x1e0b21;};'use strict';var Sequelize=require(_0x28fc('0x0'));var moment=require(_0x28fc('0x1'));module[_0x28fc('0x2')]={'state':{'type':Sequelize[_0x28fc('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x28fc('0x4')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x28fc('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x28fc('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x28fc('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x28fc('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x28fc('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x28fc('0x4')]},'calleridnum':{'type':Sequelize[_0x28fc('0x4')]},'calleridname':{'type':Sequelize[_0x28fc('0x4')]},'starttime':{'type':Sequelize[_0x28fc('0x5')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x28fc('0x5')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x28fc('0x5')]},'ringtime':{'type':Sequelize[_0x28fc('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x28fc('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x28fc('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x28fc('0x4')]},'campaign':{'type':Sequelize[_0x28fc('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x28fc('0x4')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x28fc('0x4')]},'dispositionat':{'type':Sequelize[_0x28fc('0x5')],'set':function(_0x33911b){var _0x3af48c=this[_0x28fc('0x6')](_0x28fc('0x7'));if(_0x3af48c&&_0x33911b){this[_0x28fc('0x8')](_0x28fc('0x9'),moment(_0x33911b)[_0x28fc('0xa')](moment(_0x3af48c),_0x28fc('0xb')));}}},'amd':{'type':Sequelize[_0x28fc('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0x28fc('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x28fc('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x28fc('0x5')]},'callback':{'type':Sequelize[_0x28fc('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x28fc('0x5')]},'deleted':{'type':Sequelize[_0x28fc('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x28fc('0x5')]},'recallme':{'type':Sequelize[_0x28fc('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x28fc('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x28fc('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x28fc('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x28fc('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 2964b52..7c402a2 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 _0x9536=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','error','stack','name','index','map','CmHopperFinal','fieldName','model','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','then','includeAll','include','findAll','rows','catch','params','rawAttributes','intersection','length','options','find','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','fromQuery','phone','scheduledAt','ContactId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','ANY_VALUE(ContactId)','ListId','NOW()','from','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper','calleridnum','state\x20=\x204','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','select','ANY_VALUE(ListId)','CampaignId\x20=\x20?','cm_hopper_final','group','checkContactHopper','CmHopper','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring'];(function(_0x141d0c,_0x3910ce){var _0x178a04=function(_0x4565a0){while(--_0x4565a0){_0x141d0c['push'](_0x141d0c['shift']());}};_0x178a04(++_0x3910ce);}(_0x9536,0x179));var _0x6953=function(_0x46b22a,_0x5bf83a){_0x46b22a=_0x46b22a-0x0;var _0x44c2e8=_0x9536[_0x46b22a];return _0x44c2e8;};'use strict';var emlformat=require(_0x6953('0x0'));var rimraf=require(_0x6953('0x1'));var zipdir=require(_0x6953('0x2'));var jsonpatch=require(_0x6953('0x3'));var rp=require('request-promise');var moment=require(_0x6953('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6953('0x5'));var util=require(_0x6953('0x6'));var path=require(_0x6953('0x7'));var sox=require(_0x6953('0x8'));var csv=require(_0x6953('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6953('0xa'));var _=require(_0x6953('0xb'));var squel=require(_0x6953('0xc'));var crypto=require(_0x6953('0xd'));var jsforce=require(_0x6953('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6953('0x9'));var querystring=require(_0x6953('0xf'));var Papa=require(_0x6953('0x10'));var Redis=require('ioredis');var authService=require(_0x6953('0x11'));var qs=require(_0x6953('0x12'));var as=require(_0x6953('0x13'));var hardwareService=require(_0x6953('0x14'));var logger=require(_0x6953('0x15'))(_0x6953('0x16'));var utils=require(_0x6953('0x17'));var config=require(_0x6953('0x18'));var licenseUtil=require(_0x6953('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x358388,_0x513dd0){_0x513dd0=_0x513dd0||0xcc;return function(_0x8de91e){if(_0x8de91e){return _0x358388[_0x6953('0x1a')](_0x513dd0);}return _0x358388[_0x6953('0x1b')](_0x513dd0)[_0x6953('0x1c')]();};}function respondWithResult(_0x1b5221,_0x244713){_0x244713=_0x244713||0xc8;return function(_0x175fa9){if(_0x175fa9){return _0x1b5221[_0x6953('0x1b')](_0x244713)[_0x6953('0x1d')](_0x175fa9);}};}function respondWithFilteredResult(_0x31d182,_0xae5515){return function(_0x548473){if(_0x548473){var _0x5f49db=typeof _0xae5515[_0x6953('0x1e')]===_0x6953('0x1f')&&typeof _0xae5515[_0x6953('0x20')]===_0x6953('0x1f');var _0x510d46=_0x548473[_0x6953('0x21')];var _0x2da771=_0x5f49db?0x0:_0xae5515['offset'];var _0x10858a=_0x5f49db?_0x548473[_0x6953('0x21')]:_0xae5515[_0x6953('0x1e')]+_0xae5515[_0x6953('0x20')];var _0xc714d3;if(_0x10858a>=_0x510d46){_0x10858a=_0x510d46;_0xc714d3=0xc8;}else{_0xc714d3=0xce;}_0x31d182['status'](_0xc714d3);return _0x31d182[_0x6953('0x22')](_0x6953('0x23'),_0x2da771+'-'+_0x10858a+'/'+_0x510d46)[_0x6953('0x1d')](_0x548473);}return null;};}function patchUpdates(_0x2ba433){return function(_0x41f021){try{jsonpatch['apply'](_0x41f021,_0x2ba433,!![]);}catch(_0xf96d07){return BPromise[_0x6953('0x24')](_0xf96d07);}return _0x41f021['save']();};}function saveUpdates(_0x317979,_0x40c9d1){return function(_0xb92529){if(_0xb92529){return _0xb92529[_0x6953('0x25')](_0x317979)['then'](function(_0x37f339){return _0x37f339;});}return null;};}function removeEntity(_0x231cb2,_0x2a7f6a){return function(_0x508ea7){if(_0x508ea7){return _0x508ea7['destroy']()['then'](function(){_0x231cb2[_0x6953('0x1b')](0xcc)[_0x6953('0x1c')]();});}};}function handleEntityNotFound(_0x550be4,_0x1a32f4){return function(_0x587df0){if(!_0x587df0){_0x550be4[_0x6953('0x1a')](0x194);}return _0x587df0;};}function handleError(_0x2bf39b,_0xcdbce8){_0xcdbce8=_0xcdbce8||0x1f4;return function(_0x2cc01e){logger[_0x6953('0x26')](_0x2cc01e[_0x6953('0x27')]);if(_0x2cc01e['name']){delete _0x2cc01e[_0x6953('0x28')];}_0x2bf39b[_0x6953('0x1b')](_0xcdbce8)['send'](_0x2cc01e);};}exports[_0x6953('0x29')]=function(_0x4af39d,_0x173b3c){var _0x3b1175={},_0x426c7c={},_0x4b0325={'count':0x0,'rows':[]};var _0x131992=_[_0x6953('0x2a')](db[_0x6953('0x2b')]['rawAttributes'],function(_0x4c49fc){return{'name':_0x4c49fc[_0x6953('0x2c')],'type':_0x4c49fc['type']['key']};});_0x426c7c[_0x6953('0x2d')]=_[_0x6953('0x2a')](_0x131992,_0x6953('0x28'));_0x426c7c[_0x6953('0x2e')]=_[_0x6953('0x2f')](_0x4af39d['query']);_0x426c7c[_0x6953('0x30')]=_['intersection'](_0x426c7c[_0x6953('0x2d')],_0x426c7c[_0x6953('0x2e')]);_0x3b1175['attributes']=_['intersection'](_0x426c7c[_0x6953('0x2d')],qs[_0x6953('0x31')](_0x4af39d[_0x6953('0x2e')]['fields']));_0x3b1175[_0x6953('0x32')]=_0x3b1175['attributes']['length']?_0x3b1175['attributes']:_0x426c7c['model'];if(!_0x4af39d[_0x6953('0x2e')][_0x6953('0x33')](_0x6953('0x34'))){_0x3b1175[_0x6953('0x20')]=qs[_0x6953('0x20')](_0x4af39d[_0x6953('0x2e')]['limit']);_0x3b1175[_0x6953('0x1e')]=qs['offset'](_0x4af39d[_0x6953('0x2e')]['offset']);}_0x3b1175[_0x6953('0x35')]=qs[_0x6953('0x36')](_0x4af39d[_0x6953('0x2e')][_0x6953('0x36')]);_0x3b1175['where']=qs[_0x6953('0x30')](_[_0x6953('0x37')](_0x4af39d[_0x6953('0x2e')],_0x426c7c[_0x6953('0x30')]),_0x131992);if(_0x4af39d[_0x6953('0x2e')][_0x6953('0x38')]){_0x3b1175[_0x6953('0x39')]=_[_0x6953('0x3a')](_0x3b1175[_0x6953('0x39')],{'$or':_[_0x6953('0x2a')](_0x131992,function(_0x2d9d81){if(_0x2d9d81['type']!==_0x6953('0x3b')){var _0x3c03ab={};_0x3c03ab[_0x2d9d81[_0x6953('0x28')]]={'$like':'%'+_0x4af39d['query']['filter']+'%'};return _0x3c03ab;}})});}_0x3b1175=_[_0x6953('0x3a')]({},_0x3b1175,_0x4af39d['options']);var _0x5abaf2={'where':_0x3b1175[_0x6953('0x39')]};return db[_0x6953('0x2b')]['count'](_0x5abaf2)[_0x6953('0x3c')](function(_0x263728){_0x4b0325[_0x6953('0x21')]=_0x263728;if(_0x4af39d[_0x6953('0x2e')][_0x6953('0x3d')]){_0x3b1175[_0x6953('0x3e')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x6953('0x3f')](_0x3b1175);})[_0x6953('0x3c')](function(_0x30a27a){_0x4b0325[_0x6953('0x40')]=_0x30a27a;return _0x4b0325;})[_0x6953('0x3c')](respondWithFilteredResult(_0x173b3c,_0x3b1175))[_0x6953('0x41')](handleError(_0x173b3c,null));};exports['show']=function(_0x5a40de,_0xeef91a){var _0x54d7c2={'raw':!![],'where':{'id':_0x5a40de[_0x6953('0x42')]['id']}},_0x588ff8={};_0x588ff8[_0x6953('0x2d')]=_[_0x6953('0x2f')](db[_0x6953('0x2b')][_0x6953('0x43')]);_0x588ff8['query']=_['keys'](_0x5a40de[_0x6953('0x2e')]);_0x588ff8[_0x6953('0x30')]=_['intersection'](_0x588ff8[_0x6953('0x2d')],_0x588ff8['query']);_0x54d7c2[_0x6953('0x32')]=_[_0x6953('0x44')](_0x588ff8[_0x6953('0x2d')],qs[_0x6953('0x31')](_0x5a40de['query'][_0x6953('0x31')]));_0x54d7c2[_0x6953('0x32')]=_0x54d7c2['attributes'][_0x6953('0x45')]?_0x54d7c2[_0x6953('0x32')]:_0x588ff8[_0x6953('0x2d')];if(_0x5a40de[_0x6953('0x2e')][_0x6953('0x3d')]){_0x54d7c2[_0x6953('0x3e')]=[{'all':!![]}];}_0x54d7c2=_[_0x6953('0x3a')]({},_0x54d7c2,_0x5a40de[_0x6953('0x46')]);return db[_0x6953('0x2b')][_0x6953('0x47')](_0x54d7c2)[_0x6953('0x3c')](handleEntityNotFound(_0xeef91a,null))['then'](respondWithResult(_0xeef91a,null))[_0x6953('0x41')](handleError(_0xeef91a,null));};exports['describe']=function(_0x15c142,_0x1d5979){return db[_0x6953('0x2b')]['describe']()[_0x6953('0x3c')](respondWithResult(_0x1d5979,null))[_0x6953('0x41')](handleError(_0x1d5979,null));};exports['update']=function(_0x525145,_0xbf5b61){if(_0x525145[_0x6953('0x48')][_0x6953('0x49')]){delete _0x525145[_0x6953('0x48')][_0x6953('0x49')];}return db[_0x6953('0x2b')][_0x6953('0x47')]({'where':{'uniqueid':_0x525145[_0x6953('0x42')]['id']}})[_0x6953('0x3c')](handleEntityNotFound(_0xbf5b61,null))[_0x6953('0x3c')](saveUpdates(_0x525145[_0x6953('0x48')],null))['then'](respondWithResult(_0xbf5b61,null))['catch'](handleError(_0xbf5b61,null));};exports[_0x6953('0x4a')]=function(_0x38e3e8,_0x68ab5d,_0x7bcd92){return db[_0x6953('0x2b')][_0x6953('0x3f')]({'raw':![],'where':{'VoiceQueueId':_0x38e3e8[_0x6953('0x42')]['id']},'attributes':[[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x200,\x201,\x20null'))),_0x6953('0x4d')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db['sequelize'][_0x6953('0x4e')](_0x6953('0x4f')))),_0x6953('0x50')],[db['sequelize']['fn']('COUNT',db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x6953('0x51')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')]['literal'](_0x6953('0x52')))),_0x6953('0x53')],[db['sequelize']['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x54')))),_0x6953('0x55')],[db['sequelize']['fn'](_0x6953('0x4c'),db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x6953('0x56')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db['sequelize'][_0x6953('0x4e')](_0x6953('0x57')))),'reCallContacts'],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x58')))),_0x6953('0x59')]]})[_0x6953('0x3c')](handleEntityNotFound(_0x68ab5d,null))['then'](respondWithResult(_0x68ab5d,null))[_0x6953('0x41')](handleError(_0x68ab5d,null));};exports[_0x6953('0x5a')]=function(_0x35ac0e,_0x57ffab,_0x479ab4){return db[_0x6953('0x2b')][_0x6953('0x3f')]({'raw':![],'where':{'CampaignId':_0x35ac0e[_0x6953('0x42')]['id']},'attributes':[[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x5b')))),_0x6953('0x4d')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x4f')))),_0x6953('0x50')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x5c')))),_0x6953('0x51')],[db[_0x6953('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6953('0x4b')]['literal'](_0x6953('0x52')))),_0x6953('0x53')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x54')))),_0x6953('0x55')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x5d')))),_0x6953('0x56')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')]['literal'](_0x6953('0x57')))),_0x6953('0x5e')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),_0x6953('0x59')]]})[_0x6953('0x3c')](handleEntityNotFound(_0x57ffab,null))['then'](respondWithResult(_0x57ffab,null))[_0x6953('0x41')](handleError(_0x57ffab,null));};exports[_0x6953('0x5f')]=function(_0x41d74d,_0x5063ac,_0x4cb8a4){return db[_0x6953('0x60')][_0x6953('0x47')]({'where':{'id':_0x41d74d[_0x6953('0x42')]['id']}})[_0x6953('0x3c')](handleEntityNotFound(_0x5063ac,null))[_0x6953('0x3c')](function(_0x43a39f){var _0x3cf1c0;if(_0x43a39f){_0x3cf1c0=squel[_0x6953('0x61')]()[_0x6953('0x62')]('cm_hopper')[_0x6953('0x63')]([_0x6953('0x64'),_0x6953('0x65'),_0x6953('0x66'),'ListId',_0x6953('0x67'),_0x6953('0x68'),_0x6953('0x69')],squel['select']()[_0x6953('0x6a')](_0x6953('0x6b'),_0x6953('0x64'))[_0x6953('0x6a')]('NOW()',_0x6953('0x65'))[_0x6953('0x6a')](_0x6953('0x6c'),_0x6953('0x66'))['field']('ANY_VALUE(ListId)',_0x6953('0x6d'))[_0x6953('0x6a')]('ANY_VALUE(VoiceQueueId)','VoiceQueueId')[_0x6953('0x6a')](_0x6953('0x6e'),_0x6953('0x68'))[_0x6953('0x6a')]('NOW()',_0x6953('0x69'))[_0x6953('0x6f')]('cm_hopper_final')[_0x6953('0x39')](_0x6953('0x70'),_0x41d74d['params']['id']['toString']())['where'](_0x6953('0x71'),_0x41d74d[_0x6953('0x48')][_0x6953('0x72')][_0x6953('0x73')]())[_0x6953('0x39')](_0x6953('0x74'))[_0x6953('0x39')](_0x6953('0x75'),squel['select']()[_0x6953('0x6a')](_0x6953('0x64'))[_0x6953('0x6f')](_0x6953('0x76'))[_0x6953('0x39')](_0x6953('0x70'),_0x41d74d['params']['id'][_0x6953('0x73')]()))['where'](_0x6953('0x75'),squel['select']()[_0x6953('0x6a')](_0x6953('0x77'))[_0x6953('0x6f')]('cm_hopper_final')[_0x6953('0x39')](_0x6953('0x70'),_0x41d74d[_0x6953('0x42')]['id'][_0x6953('0x73')]())[_0x6953('0x39')](_0x6953('0x78')))['group'](_0x6953('0x66')))[_0x6953('0x73')]();return db[_0x6953('0x4b')][_0x6953('0x2e')](_0x3cf1c0);}return[];})[_0x6953('0x3c')](respondWithResult(_0x5063ac,null))[_0x6953('0x41')](handleError(_0x5063ac,null));};exports[_0x6953('0x79')]=function(_0xa26241,_0xefb593,_0x216b92){return db[_0x6953('0x7a')]['find']({'where':{'id':_0xa26241[_0x6953('0x42')]['id']}})[_0x6953('0x3c')](handleEntityNotFound(_0xefb593,null))[_0x6953('0x3c')](function(_0x396a9f){var _0x92c0bc;if(_0x396a9f){_0x92c0bc=squel[_0x6953('0x61')]()[_0x6953('0x62')](_0x6953('0x76'))[_0x6953('0x63')]([_0x6953('0x64'),_0x6953('0x65'),'ContactId',_0x6953('0x6d'),_0x6953('0x7b'),_0x6953('0x68'),'updatedAt'],squel[_0x6953('0x7c')]()['field']('ANY_VALUE(calleridnum)',_0x6953('0x64'))[_0x6953('0x6a')](_0x6953('0x6e'),_0x6953('0x65'))[_0x6953('0x6a')](_0x6953('0x6c'),_0x6953('0x66'))['field'](_0x6953('0x7d'),_0x6953('0x6d'))[_0x6953('0x6a')]('ANY_VALUE(CampaignId)',_0x6953('0x7b'))[_0x6953('0x6a')]('NOW()',_0x6953('0x68'))['field']('NOW()',_0x6953('0x69'))['from']('cm_hopper_final')[_0x6953('0x39')](_0x6953('0x7e'),_0xa26241[_0x6953('0x42')]['id']['toString']())[_0x6953('0x39')](_0x6953('0x71'),_0xa26241['body'][_0x6953('0x72')][_0x6953('0x73')]())[_0x6953('0x39')](_0x6953('0x74'))[_0x6953('0x39')](_0x6953('0x75'),squel[_0x6953('0x7c')]()[_0x6953('0x6a')](_0x6953('0x64'))['from'](_0x6953('0x76'))[_0x6953('0x39')]('CampaignId\x20=\x20?',_0xa26241[_0x6953('0x42')]['id'][_0x6953('0x73')]()))[_0x6953('0x39')](_0x6953('0x75'),squel[_0x6953('0x7c')]()[_0x6953('0x6a')](_0x6953('0x77'))['from'](_0x6953('0x7f'))[_0x6953('0x39')](_0x6953('0x7e'),_0xa26241[_0x6953('0x42')]['id'][_0x6953('0x73')]())[_0x6953('0x39')](_0x6953('0x78')))[_0x6953('0x80')](_0x6953('0x66')))['toString']();return db[_0x6953('0x4b')]['query'](_0x92c0bc);}return[];})[_0x6953('0x3c')](respondWithResult(_0xefb593,null))['catch'](handleError(_0xefb593,null));};exports[_0x6953('0x81')]=function(_0x7215ed,_0x3cb96a,_0x46bcec){return db[_0x6953('0x82')]['findOne']({'where':{'VoiceQueueId':_0x7215ed[_0x6953('0x48')]['VoiceQueueId'],'CampaignId':_0x7215ed[_0x6953('0x48')][_0x6953('0x7b')],'ContactId':_0x7215ed[_0x6953('0x48')][_0x6953('0x66')]}})['then'](handleEntityNotFound(_0x3cb96a,null))[_0x6953('0x3c')](function(_0x50f019){if(_0x50f019){return _0x50f019;}return null;})[_0x6953('0x3c')](respondWithResult(_0x3cb96a,null))[_0x6953('0x41')](handleError(_0x3cb96a,null));}; \ No newline at end of file +var _0x2ef3=['params','keys','describe','uniqueid','body','find','countContactsQueueCampaignHopperFinal','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','countContactsIvrCampaignHopperFinal','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','answeringMachine','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','createdAt','updatedAt','field','NOW()','VoiceQueueId','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','select','from','calleridnum','state\x20=\x204','group','Campaign','ListId','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','CampaignId\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','CmHopper','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','CmHopperFinal','then','includeAll','include','findAll','catch','show'];(function(_0x16fba4,_0x5a908e){var _0x21bfe8=function(_0x510dc4){while(--_0x510dc4){_0x16fba4['push'](_0x16fba4['shift']());}};_0x21bfe8(++_0x5a908e);}(_0x2ef3,0xba));var _0x32ef=function(_0x3ca40d,_0x377fec){_0x3ca40d=_0x3ca40d-0x0;var _0x2370ec=_0x2ef3[_0x3ca40d];return _0x2370ec;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['CmHopperFinal'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'all':!![]}];}return db[_0x32ef('0x3d')][_0x32ef('0x41')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x3c0e44){_0x3c569d['rows']=_0x3c0e44;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x42')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x43')]=function(_0x2a33dd,_0x765c63){var _0x5dca14={'raw':!![],'where':{'id':_0x2a33dd[_0x32ef('0x44')]['id']}},_0x2901a1={};_0x2901a1['model']=_[_0x32ef('0x45')](db['CmHopperFinal'][_0x32ef('0x2a')]);_0x2901a1[_0x32ef('0x2f')]=_[_0x32ef('0x45')](_0x2a33dd[_0x32ef('0x2f')]);_0x2901a1[_0x32ef('0x30')]=_[_0x32ef('0x32')](_0x2901a1[_0x32ef('0x2e')],_0x2901a1[_0x32ef('0x2f')]);_0x5dca14[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x2901a1['model'],qs[_0x32ef('0x33')](_0x2a33dd['query'][_0x32ef('0x33')]));_0x5dca14[_0x32ef('0x31')]=_0x5dca14[_0x32ef('0x31')]['length']?_0x5dca14[_0x32ef('0x31')]:_0x2901a1[_0x32ef('0x2e')];if(_0x2a33dd[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5dca14[_0x32ef('0x40')]=[{'all':!![]}];}_0x5dca14=_[_0x32ef('0x3b')]({},_0x5dca14,_0x2a33dd[_0x32ef('0x3c')]);return db['CmHopperFinal']['find'](_0x5dca14)[_0x32ef('0x3e')](handleEntityNotFound(_0x765c63,null))[_0x32ef('0x3e')](respondWithResult(_0x765c63,null))[_0x32ef('0x42')](handleError(_0x765c63,null));};exports[_0x32ef('0x46')]=function(_0x209361,_0xd67dc9){return db[_0x32ef('0x3d')][_0x32ef('0x46')]()[_0x32ef('0x3e')](respondWithResult(_0xd67dc9,null))[_0x32ef('0x42')](handleError(_0xd67dc9,null));};exports[_0x32ef('0x24')]=function(_0x30ad49,_0x36a65c){if(_0x30ad49['body'][_0x32ef('0x47')]){delete _0x30ad49[_0x32ef('0x48')][_0x32ef('0x47')];}return db[_0x32ef('0x3d')][_0x32ef('0x49')]({'where':{'uniqueid':_0x30ad49[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x36a65c,null))[_0x32ef('0x3e')](saveUpdates(_0x30ad49[_0x32ef('0x48')],null))[_0x32ef('0x3e')](respondWithResult(_0x36a65c,null))[_0x32ef('0x42')](handleError(_0x36a65c,null));};exports[_0x32ef('0x4a')]=function(_0x272377,_0x326445,_0x307ac8){return db[_0x32ef('0x3d')][_0x32ef('0x41')]({'raw':![],'where':{'VoiceQueueId':_0x272377[_0x32ef('0x44')]['id']},'attributes':[[db['sequelize']['fn']('COUNT',db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x4d')))),_0x32ef('0x4e')],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x50')))),'noAnswerContacts'],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x51')))),'busyContacts'],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db['sequelize'][_0x32ef('0x4c')]('`state`\x20=\x208,\x201,\x20null'))),_0x32ef('0x52')],[db[_0x32ef('0x4b')]['fn']('COUNT',db[_0x32ef('0x4b')]['fn']('IF',db['sequelize'][_0x32ef('0x4c')](_0x32ef('0x53')))),_0x32ef('0x54')],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x32ef('0x55')],[db['sequelize']['fn']('COUNT',db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x56')))),_0x32ef('0x57')],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')]('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0x32ef('0x3e')](handleEntityNotFound(_0x326445,null))[_0x32ef('0x3e')](respondWithResult(_0x326445,null))['catch'](handleError(_0x326445,null));};exports[_0x32ef('0x58')]=function(_0x12e1ef,_0x2b5703,_0x49c245){return db[_0x32ef('0x3d')][_0x32ef('0x41')]({'raw':![],'where':{'CampaignId':_0x12e1ef[_0x32ef('0x44')]['id']},'attributes':[[db['sequelize']['fn']('COUNT',db[_0x32ef('0x4b')]['fn']('IF',db['sequelize'][_0x32ef('0x4c')]('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db['sequelize'][_0x32ef('0x4c')](_0x32ef('0x50')))),_0x32ef('0x59')],[db['sequelize']['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db['sequelize']['literal'](_0x32ef('0x51')))),_0x32ef('0x5a')],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')]['literal'](_0x32ef('0x5b')))),_0x32ef('0x52')],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x53')))),_0x32ef('0x54')],[db['sequelize']['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x5c')))),'abandonedContacts'],[db['sequelize']['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x56')))),'reCallContacts'],[db[_0x32ef('0x4b')]['fn']('COUNT',db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),_0x32ef('0x5d')]]})[_0x32ef('0x3e')](handleEntityNotFound(_0x2b5703,null))[_0x32ef('0x3e')](respondWithResult(_0x2b5703,null))['catch'](handleError(_0x2b5703,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x3b4a8e,_0x5edd29,_0x7d2c3a){return db[_0x32ef('0x5e')]['find']({'where':{'id':_0x3b4a8e[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x5edd29,null))[_0x32ef('0x3e')](function(_0xd7a78){var _0x9df27c;if(_0xd7a78){_0x9df27c=squel[_0x32ef('0x5f')]()[_0x32ef('0x60')](_0x32ef('0x61'))[_0x32ef('0x62')]([_0x32ef('0x63'),_0x32ef('0x64'),_0x32ef('0x65'),'ListId','VoiceQueueId',_0x32ef('0x66'),_0x32ef('0x67')],squel['select']()[_0x32ef('0x68')]('ANY_VALUE(calleridnum)',_0x32ef('0x63'))[_0x32ef('0x68')](_0x32ef('0x69'),'scheduledAt')[_0x32ef('0x68')]('ANY_VALUE(ContactId)',_0x32ef('0x65'))[_0x32ef('0x68')]('ANY_VALUE(ListId)','ListId')[_0x32ef('0x68')]('ANY_VALUE(VoiceQueueId)',_0x32ef('0x6a'))['field'](_0x32ef('0x69'),_0x32ef('0x66'))[_0x32ef('0x68')]('NOW()','updatedAt')['from'](_0x32ef('0x6b'))['where'](_0x32ef('0x6c'),_0x3b4a8e[_0x32ef('0x44')]['id'][_0x32ef('0x6d')]())[_0x32ef('0x38')](_0x32ef('0x6e'),_0x3b4a8e[_0x32ef('0x48')]['state'][_0x32ef('0x6d')]())['where']('calleridnum\x20IS\x20NOT\x20NULL')[_0x32ef('0x38')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x32ef('0x6f')]()[_0x32ef('0x68')]('phone')[_0x32ef('0x70')](_0x32ef('0x61'))[_0x32ef('0x38')](_0x32ef('0x6c'),_0x3b4a8e[_0x32ef('0x44')]['id'][_0x32ef('0x6d')]()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x32ef('0x6f')]()['field'](_0x32ef('0x71'))[_0x32ef('0x70')](_0x32ef('0x6b'))[_0x32ef('0x38')](_0x32ef('0x6c'),_0x3b4a8e[_0x32ef('0x44')]['id']['toString']())[_0x32ef('0x38')](_0x32ef('0x72')))[_0x32ef('0x73')](_0x32ef('0x65')))[_0x32ef('0x6d')]();return db['sequelize']['query'](_0x9df27c);}return[];})[_0x32ef('0x3e')](respondWithResult(_0x5edd29,null))[_0x32ef('0x42')](handleError(_0x5edd29,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x211fb1,_0x2e333d,_0x338578){return db[_0x32ef('0x74')][_0x32ef('0x49')]({'where':{'id':_0x211fb1[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x2e333d,null))[_0x32ef('0x3e')](function(_0x353641){var _0x54e65d;if(_0x353641){_0x54e65d=squel[_0x32ef('0x5f')]()[_0x32ef('0x60')]('cm_hopper')[_0x32ef('0x62')](['phone',_0x32ef('0x64'),'ContactId',_0x32ef('0x75'),_0x32ef('0x76'),_0x32ef('0x66'),_0x32ef('0x67')],squel['select']()[_0x32ef('0x68')](_0x32ef('0x77'),_0x32ef('0x63'))['field']('NOW()','scheduledAt')[_0x32ef('0x68')](_0x32ef('0x78'),_0x32ef('0x65'))[_0x32ef('0x68')](_0x32ef('0x79'),'ListId')[_0x32ef('0x68')]('ANY_VALUE(CampaignId)',_0x32ef('0x76'))[_0x32ef('0x68')](_0x32ef('0x69'),'createdAt')[_0x32ef('0x68')](_0x32ef('0x69'),_0x32ef('0x67'))[_0x32ef('0x70')](_0x32ef('0x6b'))['where'](_0x32ef('0x7a'),_0x211fb1['params']['id'][_0x32ef('0x6d')]())[_0x32ef('0x38')]('state\x20=\x20?',_0x211fb1['body'][_0x32ef('0x7b')][_0x32ef('0x6d')]())[_0x32ef('0x38')](_0x32ef('0x7c'))['where'](_0x32ef('0x7d'),squel['select']()['field'](_0x32ef('0x63'))['from'](_0x32ef('0x61'))[_0x32ef('0x38')](_0x32ef('0x7a'),_0x211fb1['params']['id']['toString']()))[_0x32ef('0x38')](_0x32ef('0x7d'),squel[_0x32ef('0x6f')]()[_0x32ef('0x68')](_0x32ef('0x71'))[_0x32ef('0x70')](_0x32ef('0x6b'))['where'](_0x32ef('0x7a'),_0x211fb1[_0x32ef('0x44')]['id'][_0x32ef('0x6d')]())[_0x32ef('0x38')]('state\x20=\x204'))['group'](_0x32ef('0x65')))['toString']();return db[_0x32ef('0x4b')][_0x32ef('0x2f')](_0x54e65d);}return[];})['then'](respondWithResult(_0x2e333d,null))['catch'](handleError(_0x2e333d,null));};exports['checkContactHopper']=function(_0x201675,_0x33f6c3,_0xa53375){return db[_0x32ef('0x7e')]['findOne']({'where':{'VoiceQueueId':_0x201675[_0x32ef('0x48')][_0x32ef('0x6a')],'CampaignId':_0x201675[_0x32ef('0x48')]['CampaignId'],'ContactId':_0x201675[_0x32ef('0x48')]['ContactId']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x33f6c3,null))[_0x32ef('0x3e')](function(_0x5f4890){if(_0x5f4890){return _0x5f4890;}return null;})['then'](respondWithResult(_0x33f6c3,null))[_0x32ef('0x42')](handleError(_0x33f6c3,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 3c4dc82..2a91363 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 _0x0816=['uniqueid','util','../../config/logger','api','moment','request-promise','path','../../config/environment','define','CmHopperFinal','calleridnum'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0x0816,0x16c));var _0x6081=function(_0xed4881,_0x45771c){_0xed4881=_0xed4881-0x0;var _0x7fcbd5=_0x0816[_0xed4881];return _0x7fcbd5;};'use strict';var _=require('lodash');var util=require(_0x6081('0x0'));var logger=require(_0x6081('0x1'))(_0x6081('0x2'));var moment=require(_0x6081('0x3'));var BPromise=require('bluebird');var rp=require(_0x6081('0x4'));var fs=require('fs');var path=require(_0x6081('0x5'));var rimraf=require('rimraf');var config=require(_0x6081('0x6'));var attributes=require('./cmHopperFinal.attributes');module['exports']=function(_0x394a81,_0xf0542e){return _0x394a81[_0x6081('0x7')](_0x6081('0x8'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x6081('0x9'),'fields':['calleridnum']},{'name':_0x6081('0xa'),'fields':[_0x6081('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x86fb=['rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','calleridnum','uniqueid','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x4e9274,_0x49576e){var _0x8b474c=function(_0x204cca){while(--_0x204cca){_0x4e9274['push'](_0x4e9274['shift']());}};_0x8b474c(++_0x49576e);}(_0x86fb,0x116));var _0xb86f=function(_0x358d34,_0x510caa){_0x358d34=_0x358d34-0x0;var _0x35fe18=_0x86fb[_0x358d34];return _0x35fe18;};'use strict';var _=require(_0xb86f('0x0'));var util=require(_0xb86f('0x1'));var logger=require('../../config/logger')(_0xb86f('0x2'));var moment=require(_0xb86f('0x3'));var BPromise=require(_0xb86f('0x4'));var rp=require(_0xb86f('0x5'));var fs=require('fs');var path=require(_0xb86f('0x6'));var rimraf=require(_0xb86f('0x7'));var config=require(_0xb86f('0x8'));var attributes=require(_0xb86f('0x9'));module[_0xb86f('0xa')]=function(_0x3fc90a,_0x4f5a4e){return _0x3fc90a[_0xb86f('0xb')](_0xb86f('0xc'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0xb86f('0xd'),'fields':[_0xb86f('0xd')]},{'name':_0xb86f('0xe'),'fields':[_0xb86f('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 7ea3138..6bdf45c 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(_0x2af5a2,_0x43dcaa){var _0x501390=function(_0x56e917){while(--_0x56e917){_0x2af5a2['push'](_0x2af5a2['shift']());}};_0x501390(++_0x43dcaa);}(_0x7a54,0x106));var _0x47a5=function(_0x55309e,_0x173e6a){_0x55309e=_0x55309e-0x0;var _0x3e58bb=_0x7a54[_0x55309e];return _0x3e58bb;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x55cf07,_0x56773a){var _0x50c224=function(_0x17ffca){while(--_0x17ffca){_0x55cf07['push'](_0x55cf07['shift']());}};_0x50c224(++_0x56773a);}(_0x7a54,0x106));var _0x47a5=function(_0x5529be,_0x446926){_0x5529be=_0x5529be-0x0;var _0x408068=_0x7a54[_0x5529be];return _0x408068;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 327dbbf..7022a2e 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 _0x3acb=['../../components/auth/service','../../components/interaction/service','./cmHopperFinal.controller','get','isAuthenticated','/describe','show','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','update','exports','path','express','Router','fs-extra'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3acb,0x114));var _0xb3ac=function(_0x33ef40,_0x35f9ad){_0x33ef40=_0x33ef40-0x0;var _0x5298f7=_0x3acb[_0x33ef40];return _0x5298f7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb3ac('0x0'));var timeout=require('connect-timeout');var express=require(_0xb3ac('0x1'));var router=express[_0xb3ac('0x2')]();var fs_extra=require(_0xb3ac('0x3'));var auth=require(_0xb3ac('0x4'));var interaction=require(_0xb3ac('0x5'));var config=require('../../config/environment');var controller=require(_0xb3ac('0x6'));router[_0xb3ac('0x7')]('/',auth[_0xb3ac('0x8')](),controller['index']);router[_0xb3ac('0x7')](_0xb3ac('0x9'),auth[_0xb3ac('0x8')](),controller['describe']);router[_0xb3ac('0x7')]('/:id',auth[_0xb3ac('0x8')](),controller[_0xb3ac('0xa')]);router['get']('/voice/queue/countAttributes/:id',auth[_0xb3ac('0x8')](),controller[_0xb3ac('0xb')]);router['get'](_0xb3ac('0xc'),auth[_0xb3ac('0x8')](),controller[_0xb3ac('0xd')]);router[_0xb3ac('0xe')](_0xb3ac('0xf'),auth[_0xb3ac('0x8')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0xb3ac('0xe')]('/voice/campaign/moveContacts/:id',auth[_0xb3ac('0x8')](),controller[_0xb3ac('0x10')]);router[_0xb3ac('0xe')](_0xb3ac('0x11'),auth[_0xb3ac('0x8')](),controller['checkContactHopper']);router['put']('/:id',auth[_0xb3ac('0x8')](),controller[_0xb3ac('0x12')]);module[_0xb3ac('0x13')]=router; \ No newline at end of file +var _0x874d=['/checkContactHopper','put','/:id','update','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperFinal.controller','get','isAuthenticated','index','describe','show','countContactsQueueCampaignHopperFinal','/voice/queue/moveContacts/:id','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal'];(function(_0x5e1aa5,_0x35d6e9){var _0x2c4704=function(_0x57ae32){while(--_0x57ae32){_0x5e1aa5['push'](_0x5e1aa5['shift']());}};_0x2c4704(++_0x35d6e9);}(_0x874d,0x1e8));var _0xd874=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x874d[_0x42245d];return _0x4b211a;};'use strict';var multer=require('multer');var util=require(_0xd874('0x0'));var path=require(_0xd874('0x1'));var timeout=require(_0xd874('0x2'));var express=require('express');var router=express[_0xd874('0x3')]();var fs_extra=require(_0xd874('0x4'));var auth=require(_0xd874('0x5'));var interaction=require(_0xd874('0x6'));var config=require('../../config/environment');var controller=require(_0xd874('0x7'));router[_0xd874('0x8')]('/',auth[_0xd874('0x9')](),controller[_0xd874('0xa')]);router[_0xd874('0x8')]('/describe',auth[_0xd874('0x9')](),controller[_0xd874('0xb')]);router[_0xd874('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xd874('0xc')]);router[_0xd874('0x8')]('/voice/queue/countAttributes/:id',auth[_0xd874('0x9')](),controller[_0xd874('0xd')]);router[_0xd874('0x8')]('/campaign/countAttributes/:id',auth[_0xd874('0x9')](),controller['countContactsIvrCampaignHopperFinal']);router['post'](_0xd874('0xe'),auth['isAuthenticated'](),controller['moveContactsQueueCampaignHopperFinal']);router[_0xd874('0xf')](_0xd874('0x10'),auth[_0xd874('0x9')](),controller[_0xd874('0x11')]);router[_0xd874('0xf')](_0xd874('0x12'),auth['isAuthenticated'](),controller['checkContactHopper']);router[_0xd874('0x13')](_0xd874('0x14'),auth['isAuthenticated'](),controller[_0xd874('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 92ef833..6f48c69 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 _0xab9f=['sequelize','INTEGER','STRING','DATE','BOOLEAN'];(function(_0x1401e1,_0xabb499){var _0x1aab56=function(_0x1071fd){while(--_0x1071fd){_0x1401e1['push'](_0x1401e1['shift']());}};_0x1aab56(++_0xabb499);}(_0xab9f,0x1bd));var _0xfab9=function(_0x5dde91,_0x3bb66e){_0x5dde91=_0x5dde91-0x0;var _0x402888=_0xab9f[_0x5dde91];return _0x402888;};'use strict';var Sequelize=require(_0xfab9('0x0'));module['exports']={'state':{'type':Sequelize[_0xfab9('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xfab9('0x2')]},'scheduledat':{'type':Sequelize[_0xfab9('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xfab9('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xfab9('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xfab9('0x2')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xfab9('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xfab9('0x2')]},'starttime':{'type':Sequelize[_0xfab9('0x3')]},'responsetime':{'type':Sequelize[_0xfab9('0x3')]},'answertime':{'type':Sequelize[_0xfab9('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xfab9('0x3')]},'ringtime':{'type':Sequelize[_0xfab9('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xfab9('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xfab9('0x2')]},'campaign':{'type':Sequelize[_0xfab9('0x2')]},'campaigntype':{'type':Sequelize[_0xfab9('0x2')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0xfab9('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0xfab9('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0xfab9('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xfab9('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xfab9('0x3')]},'recallme':{'type':Sequelize[_0xfab9('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xfab9('0x3')]},'edited':{'type':Sequelize[_0xfab9('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xfab9('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xfab9('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xfab9('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xfab9('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xfab9('0x2')]}}; \ No newline at end of file +var _0x7880=['BOOLEAN','sequelize','INTEGER','STRING','DATE'];(function(_0x102dda,_0x538136){var _0x33e87c=function(_0x3e74fd){while(--_0x3e74fd){_0x102dda['push'](_0x102dda['shift']());}};_0x33e87c(++_0x538136);}(_0x7880,0x10f));var _0x0788=function(_0x4d9a48,_0x20bc50){_0x4d9a48=_0x4d9a48-0x0;var _0xef464d=_0x7880[_0x4d9a48];return _0xef464d;};'use strict';var Sequelize=require(_0x0788('0x0'));module['exports']={'state':{'type':Sequelize[_0x0788('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x0788('0x2')]},'scheduledat':{'type':Sequelize[_0x0788('0x3')]},'countbusyretry':{'type':Sequelize[_0x0788('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0788('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x0788('0x2')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x0788('0x2')]},'calleridnum':{'type':Sequelize[_0x0788('0x2')]},'calleridname':{'type':Sequelize[_0x0788('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x0788('0x3')]},'answertime':{'type':Sequelize[_0x0788('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x0788('0x3')]},'ringtime':{'type':Sequelize[_0x0788('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x0788('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x0788('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x0788('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x0788('0x2')]},'campaign':{'type':Sequelize[_0x0788('0x2')]},'campaigntype':{'type':Sequelize[_0x0788('0x2')]},'membername':{'type':Sequelize[_0x0788('0x2')]},'reason':{'type':Sequelize[_0x0788('0x2')]},'amd':{'type':Sequelize[_0x0788('0x4')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x0788('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x0788('0x3')]},'recallme':{'type':Sequelize[_0x0788('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x0788('0x3')]},'edited':{'type':Sequelize[_0x0788('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x0788('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0788('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0788('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 912c408..76d01fe 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 _0x0670=['fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','catch','show','params','find','create','describe','body','uniqueid','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','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','undefined','count','Content-Range','reject','save','update','then','destroy','error','stack','name','CmHopperHistory','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','attributes'];(function(_0x27c652,_0xf1f9fe){var _0x36b637=function(_0x35feac){while(--_0x35feac){_0x27c652['push'](_0x27c652['shift']());}};_0x36b637(++_0xf1f9fe);}(_0x0670,0xaa));var _0x0067=function(_0x3ecf95,_0x559a2c){_0x3ecf95=_0x3ecf95-0x0;var _0x3f1e72=_0x0670[_0x3ecf95];return _0x3f1e72;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0067('0x0'));var zipdir=require(_0x0067('0x1'));var jsonpatch=require(_0x0067('0x2'));var rp=require(_0x0067('0x3'));var moment=require(_0x0067('0x4'));var BPromise=require(_0x0067('0x5'));var Mustache=require(_0x0067('0x6'));var util=require(_0x0067('0x7'));var path=require(_0x0067('0x8'));var sox=require(_0x0067('0x9'));var csv=require(_0x0067('0xa'));var ejs=require(_0x0067('0xb'));var fs=require('fs');var fs_extra=require(_0x0067('0xc'));var _=require(_0x0067('0xd'));var squel=require(_0x0067('0xe'));var crypto=require(_0x0067('0xf'));var jsforce=require(_0x0067('0x10'));var deskjs=require(_0x0067('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0067('0x12'));var Redis=require(_0x0067('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0067('0x14'));var hardwareService=require(_0x0067('0x15'));var logger=require(_0x0067('0x16'))(_0x0067('0x17'));var utils=require(_0x0067('0x18'));var config=require(_0x0067('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x0067('0x1a'))['db'];function respondWithStatusCode(_0x5dac91,_0x1ee144){_0x1ee144=_0x1ee144||0xcc;return function(_0x56cf3b){if(_0x56cf3b){return _0x5dac91['sendStatus'](_0x1ee144);}return _0x5dac91[_0x0067('0x1b')](_0x1ee144)[_0x0067('0x1c')]();};}function respondWithResult(_0x53616a,_0x2627f2){_0x2627f2=_0x2627f2||0xc8;return function(_0x1fa965){if(_0x1fa965){return _0x53616a[_0x0067('0x1b')](_0x2627f2)[_0x0067('0x1d')](_0x1fa965);}};}function respondWithFilteredResult(_0x4289e2,_0x556079){return function(_0x1aff7f){if(_0x1aff7f){var _0x1c1ec4=typeof _0x556079[_0x0067('0x1e')]==='undefined'&&typeof _0x556079[_0x0067('0x1f')]===_0x0067('0x20');var _0x58a3b0=_0x1aff7f[_0x0067('0x21')];var _0x137382=_0x1c1ec4?0x0:_0x556079[_0x0067('0x1e')];var _0x25b7b4=_0x1c1ec4?_0x1aff7f['count']:_0x556079[_0x0067('0x1e')]+_0x556079[_0x0067('0x1f')];var _0x29aff1;if(_0x25b7b4>=_0x58a3b0){_0x25b7b4=_0x58a3b0;_0x29aff1=0xc8;}else{_0x29aff1=0xce;}_0x4289e2[_0x0067('0x1b')](_0x29aff1);return _0x4289e2['set'](_0x0067('0x22'),_0x137382+'-'+_0x25b7b4+'/'+_0x58a3b0)[_0x0067('0x1d')](_0x1aff7f);}return null;};}function patchUpdates(_0x4dff65){return function(_0x2709c8){try{jsonpatch['apply'](_0x2709c8,_0x4dff65,!![]);}catch(_0x1779d2){return BPromise[_0x0067('0x23')](_0x1779d2);}return _0x2709c8[_0x0067('0x24')]();};}function saveUpdates(_0x258301,_0x59de84){return function(_0x1ff021){if(_0x1ff021){return _0x1ff021[_0x0067('0x25')](_0x258301)[_0x0067('0x26')](function(_0x2d9071){return _0x2d9071;});}return null;};}function removeEntity(_0x45239d,_0x381056){return function(_0x30b472){if(_0x30b472){return _0x30b472[_0x0067('0x27')]()['then'](function(){_0x45239d[_0x0067('0x1b')](0xcc)[_0x0067('0x1c')]();});}};}function handleEntityNotFound(_0x2ffa6a,_0x5222f2){return function(_0x5bebe0){if(!_0x5bebe0){_0x2ffa6a['sendStatus'](0x194);}return _0x5bebe0;};}function handleError(_0x223e5f,_0x43f79c){_0x43f79c=_0x43f79c||0x1f4;return function(_0x5477b4){logger[_0x0067('0x28')](_0x5477b4[_0x0067('0x29')]);if(_0x5477b4[_0x0067('0x2a')]){delete _0x5477b4[_0x0067('0x2a')];}_0x223e5f[_0x0067('0x1b')](_0x43f79c)['send'](_0x5477b4);};}exports['index']=function(_0xfa44e9,_0x1e6342){var _0x317c14={},_0x44bd01={},_0xa4e24e={'count':0x0,'rows':[]};var _0x249aa7=_['map'](db[_0x0067('0x2b')][_0x0067('0x2c')],function(_0x3f6f44){return{'name':_0x3f6f44[_0x0067('0x2d')],'type':_0x3f6f44[_0x0067('0x2e')][_0x0067('0x2f')]};});_0x44bd01[_0x0067('0x30')]=_[_0x0067('0x31')](_0x249aa7,'name');_0x44bd01['query']=_[_0x0067('0x32')](_0xfa44e9['query']);_0x44bd01[_0x0067('0x33')]=_[_0x0067('0x34')](_0x44bd01[_0x0067('0x30')],_0x44bd01[_0x0067('0x35')]);_0x317c14[_0x0067('0x36')]=_[_0x0067('0x34')](_0x44bd01['model'],qs[_0x0067('0x37')](_0xfa44e9['query'][_0x0067('0x37')]));_0x317c14[_0x0067('0x36')]=_0x317c14[_0x0067('0x36')][_0x0067('0x38')]?_0x317c14[_0x0067('0x36')]:_0x44bd01[_0x0067('0x30')];if(!_0xfa44e9[_0x0067('0x35')][_0x0067('0x39')](_0x0067('0x3a'))){_0x317c14[_0x0067('0x1f')]=qs['limit'](_0xfa44e9[_0x0067('0x35')]['limit']);_0x317c14[_0x0067('0x1e')]=qs[_0x0067('0x1e')](_0xfa44e9['query'][_0x0067('0x1e')]);}_0x317c14[_0x0067('0x3b')]=qs[_0x0067('0x3c')](_0xfa44e9[_0x0067('0x35')][_0x0067('0x3c')]);_0x317c14[_0x0067('0x3d')]=qs[_0x0067('0x33')](_['pick'](_0xfa44e9[_0x0067('0x35')],_0x44bd01[_0x0067('0x33')]),_0x249aa7);if(_0xfa44e9[_0x0067('0x35')][_0x0067('0x3e')]){_0x317c14['where']=_[_0x0067('0x3f')](_0x317c14[_0x0067('0x3d')],{'$or':_['map'](_0x249aa7,function(_0x78a584){if(_0x78a584[_0x0067('0x2e')]!==_0x0067('0x40')){var _0x65a0b6={};_0x65a0b6[_0x78a584['name']]={'$like':'%'+_0xfa44e9[_0x0067('0x35')][_0x0067('0x3e')]+'%'};return _0x65a0b6;}})});}_0x317c14=_[_0x0067('0x3f')]({},_0x317c14,_0xfa44e9['options']);var _0x82be00={'where':_0x317c14[_0x0067('0x3d')]};return db[_0x0067('0x2b')]['count'](_0x82be00)['then'](function(_0x32323f){_0xa4e24e['count']=_0x32323f;if(_0xfa44e9[_0x0067('0x35')][_0x0067('0x41')]){_0x317c14[_0x0067('0x42')]=[{'all':!![]}];}return db[_0x0067('0x2b')]['findAll'](_0x317c14);})['then'](function(_0x24500a){_0xa4e24e['rows']=_0x24500a;return _0xa4e24e;})[_0x0067('0x26')](respondWithFilteredResult(_0x1e6342,_0x317c14))[_0x0067('0x43')](handleError(_0x1e6342,null));};exports[_0x0067('0x44')]=function(_0x207593,_0x53cdfc){var _0x5a8a74={'raw':!![],'where':{'id':_0x207593[_0x0067('0x45')]['id']}},_0x336778={};_0x336778[_0x0067('0x30')]=_[_0x0067('0x32')](db[_0x0067('0x2b')][_0x0067('0x2c')]);_0x336778['query']=_['keys'](_0x207593[_0x0067('0x35')]);_0x336778['filters']=_[_0x0067('0x34')](_0x336778[_0x0067('0x30')],_0x336778[_0x0067('0x35')]);_0x5a8a74[_0x0067('0x36')]=_[_0x0067('0x34')](_0x336778['model'],qs[_0x0067('0x37')](_0x207593[_0x0067('0x35')][_0x0067('0x37')]));_0x5a8a74[_0x0067('0x36')]=_0x5a8a74[_0x0067('0x36')][_0x0067('0x38')]?_0x5a8a74[_0x0067('0x36')]:_0x336778[_0x0067('0x30')];if(_0x207593[_0x0067('0x35')]['includeAll']){_0x5a8a74[_0x0067('0x42')]=[{'all':!![]}];}_0x5a8a74=_[_0x0067('0x3f')]({},_0x5a8a74,_0x207593['options']);return db[_0x0067('0x2b')][_0x0067('0x46')](_0x5a8a74)[_0x0067('0x26')](handleEntityNotFound(_0x53cdfc,null))[_0x0067('0x26')](respondWithResult(_0x53cdfc,null))['catch'](handleError(_0x53cdfc,null));};exports[_0x0067('0x47')]=function(_0x1b68b2,_0x13cc8b){return db[_0x0067('0x2b')]['create'](_0x1b68b2['body'],{})[_0x0067('0x26')](respondWithResult(_0x13cc8b,0xc9))[_0x0067('0x43')](handleError(_0x13cc8b,null));};exports[_0x0067('0x48')]=function(_0x1bb022,_0x2d2145){return db[_0x0067('0x2b')][_0x0067('0x48')]()[_0x0067('0x26')](respondWithResult(_0x2d2145,null))['catch'](handleError(_0x2d2145,null));};exports['update']=function(_0x5945ce,_0x5d4d6f){if(_0x5945ce[_0x0067('0x49')][_0x0067('0x4a')]){delete _0x5945ce['body'][_0x0067('0x4a')];}return db[_0x0067('0x2b')]['find']({'where':{'uniqueid':_0x5945ce[_0x0067('0x45')]['id']}})['then'](handleEntityNotFound(_0x5d4d6f,null))[_0x0067('0x26')](saveUpdates(_0x5945ce[_0x0067('0x49')],null))[_0x0067('0x26')](respondWithResult(_0x5d4d6f,null))['catch'](handleError(_0x5d4d6f,null));}; \ No newline at end of file +var _0xbf0a=['keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','CmHopperHistory','show','params','include','find','body','catch','describe','uniqueid','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','ejs','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','query'];(function(_0x229101,_0x31339d){var _0xc93cb=function(_0x461394){while(--_0x461394){_0x229101['push'](_0x229101['shift']());}};_0xc93cb(++_0x31339d);}(_0xbf0a,0xed));var _0xabf0=function(_0x152b71,_0x525e00){_0x152b71=_0x152b71-0x0;var _0x3d99e7=_0xbf0a[_0x152b71];return _0x3d99e7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xabf0('0x0'));var zipdir=require(_0xabf0('0x1'));var jsonpatch=require(_0xabf0('0x2'));var rp=require('request-promise');var moment=require(_0xabf0('0x3'));var BPromise=require(_0xabf0('0x4'));var Mustache=require('mustache');var util=require(_0xabf0('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xabf0('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xabf0('0x7'));var squel=require('squel');var crypto=require(_0xabf0('0x8'));var jsforce=require(_0xabf0('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xabf0('0xa'));var Redis=require('ioredis');var authService=require(_0xabf0('0xb'));var qs=require('../../components/parsers/qs');var as=require(_0xabf0('0xc'));var hardwareService=require(_0xabf0('0xd'));var logger=require(_0xabf0('0xe'))('api');var utils=require(_0xabf0('0xf'));var config=require(_0xabf0('0x10'));var licenseUtil=require(_0xabf0('0x11'));var db=require(_0xabf0('0x12'))['db'];function respondWithStatusCode(_0x151d07,_0x40ad6d){_0x40ad6d=_0x40ad6d||0xcc;return function(_0x4fa30e){if(_0x4fa30e){return _0x151d07[_0xabf0('0x13')](_0x40ad6d);}return _0x151d07[_0xabf0('0x14')](_0x40ad6d)[_0xabf0('0x15')]();};}function respondWithResult(_0x2421e1,_0x2fa983){_0x2fa983=_0x2fa983||0xc8;return function(_0x23827b){if(_0x23827b){return _0x2421e1[_0xabf0('0x14')](_0x2fa983)[_0xabf0('0x16')](_0x23827b);}};}function respondWithFilteredResult(_0x40d7eb,_0x57cbcc){return function(_0x42ee8a){if(_0x42ee8a){var _0x5d2e71=typeof _0x57cbcc[_0xabf0('0x17')]===_0xabf0('0x18')&&typeof _0x57cbcc[_0xabf0('0x19')]===_0xabf0('0x18');var _0x423152=_0x42ee8a[_0xabf0('0x1a')];var _0x25128e=_0x5d2e71?0x0:_0x57cbcc[_0xabf0('0x17')];var _0x4f3173=_0x5d2e71?_0x42ee8a['count']:_0x57cbcc['offset']+_0x57cbcc['limit'];var _0x361671;if(_0x4f3173>=_0x423152){_0x4f3173=_0x423152;_0x361671=0xc8;}else{_0x361671=0xce;}_0x40d7eb[_0xabf0('0x14')](_0x361671);return _0x40d7eb[_0xabf0('0x1b')](_0xabf0('0x1c'),_0x25128e+'-'+_0x4f3173+'/'+_0x423152)[_0xabf0('0x16')](_0x42ee8a);}return null;};}function patchUpdates(_0x375fdf){return function(_0x3d0e4d){try{jsonpatch[_0xabf0('0x1d')](_0x3d0e4d,_0x375fdf,!![]);}catch(_0x21a2ff){return BPromise[_0xabf0('0x1e')](_0x21a2ff);}return _0x3d0e4d[_0xabf0('0x1f')]();};}function saveUpdates(_0x52816e,_0x436222){return function(_0x5ef116){if(_0x5ef116){return _0x5ef116[_0xabf0('0x20')](_0x52816e)[_0xabf0('0x21')](function(_0x30ea26){return _0x30ea26;});}return null;};}function removeEntity(_0x2721b9,_0x299725){return function(_0x3298b2){if(_0x3298b2){return _0x3298b2[_0xabf0('0x22')]()['then'](function(){_0x2721b9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xd980cb,_0x1c3c3b){return function(_0x5889b8){if(!_0x5889b8){_0xd980cb['sendStatus'](0x194);}return _0x5889b8;};}function handleError(_0x53e609,_0x1a5c9c){_0x1a5c9c=_0x1a5c9c||0x1f4;return function(_0x1662a4){logger[_0xabf0('0x23')](_0x1662a4[_0xabf0('0x24')]);if(_0x1662a4[_0xabf0('0x25')]){delete _0x1662a4['name'];}_0x53e609[_0xabf0('0x14')](_0x1a5c9c)[_0xabf0('0x26')](_0x1662a4);};}exports['index']=function(_0x320280,_0x4c5faf){var _0x499269={},_0x4192a6={},_0x4d4f23={'count':0x0,'rows':[]};var _0x5b84d4=_[_0xabf0('0x27')](db['CmHopperHistory'][_0xabf0('0x28')],function(_0x40340c){return{'name':_0x40340c[_0xabf0('0x29')],'type':_0x40340c['type']['key']};});_0x4192a6['model']=_[_0xabf0('0x27')](_0x5b84d4,_0xabf0('0x25'));_0x4192a6[_0xabf0('0x2a')]=_[_0xabf0('0x2b')](_0x320280['query']);_0x4192a6[_0xabf0('0x2c')]=_[_0xabf0('0x2d')](_0x4192a6['model'],_0x4192a6[_0xabf0('0x2a')]);_0x499269[_0xabf0('0x2e')]=_[_0xabf0('0x2d')](_0x4192a6[_0xabf0('0x2f')],qs[_0xabf0('0x30')](_0x320280[_0xabf0('0x2a')][_0xabf0('0x30')]));_0x499269['attributes']=_0x499269[_0xabf0('0x2e')][_0xabf0('0x31')]?_0x499269['attributes']:_0x4192a6[_0xabf0('0x2f')];if(!_0x320280[_0xabf0('0x2a')][_0xabf0('0x32')](_0xabf0('0x33'))){_0x499269[_0xabf0('0x19')]=qs['limit'](_0x320280[_0xabf0('0x2a')][_0xabf0('0x19')]);_0x499269[_0xabf0('0x17')]=qs[_0xabf0('0x17')](_0x320280[_0xabf0('0x2a')][_0xabf0('0x17')]);}_0x499269[_0xabf0('0x34')]=qs['sort'](_0x320280['query'][_0xabf0('0x35')]);_0x499269['where']=qs[_0xabf0('0x2c')](_[_0xabf0('0x36')](_0x320280['query'],_0x4192a6[_0xabf0('0x2c')]),_0x5b84d4);if(_0x320280[_0xabf0('0x2a')][_0xabf0('0x37')]){_0x499269['where']=_[_0xabf0('0x38')](_0x499269[_0xabf0('0x39')],{'$or':_[_0xabf0('0x27')](_0x5b84d4,function(_0x3884a4){if(_0x3884a4['type']!==_0xabf0('0x3a')){var _0x28c743={};_0x28c743[_0x3884a4['name']]={'$like':'%'+_0x320280[_0xabf0('0x2a')][_0xabf0('0x37')]+'%'};return _0x28c743;}})});}_0x499269=_[_0xabf0('0x38')]({},_0x499269,_0x320280[_0xabf0('0x3b')]);var _0x3b970d={'where':_0x499269['where']};return db['CmHopperHistory'][_0xabf0('0x1a')](_0x3b970d)[_0xabf0('0x21')](function(_0x527274){_0x4d4f23[_0xabf0('0x1a')]=_0x527274;if(_0x320280[_0xabf0('0x2a')][_0xabf0('0x3c')]){_0x499269['include']=[{'all':!![]}];}return db[_0xabf0('0x3d')]['findAll'](_0x499269);})[_0xabf0('0x21')](function(_0x1d52b7){_0x4d4f23['rows']=_0x1d52b7;return _0x4d4f23;})['then'](respondWithFilteredResult(_0x4c5faf,_0x499269))['catch'](handleError(_0x4c5faf,null));};exports[_0xabf0('0x3e')]=function(_0x32888f,_0x25352d){var _0x20d0bc={'raw':!![],'where':{'id':_0x32888f[_0xabf0('0x3f')]['id']}},_0x43093d={};_0x43093d[_0xabf0('0x2f')]=_[_0xabf0('0x2b')](db['CmHopperHistory'][_0xabf0('0x28')]);_0x43093d[_0xabf0('0x2a')]=_[_0xabf0('0x2b')](_0x32888f[_0xabf0('0x2a')]);_0x43093d[_0xabf0('0x2c')]=_[_0xabf0('0x2d')](_0x43093d['model'],_0x43093d[_0xabf0('0x2a')]);_0x20d0bc['attributes']=_[_0xabf0('0x2d')](_0x43093d[_0xabf0('0x2f')],qs[_0xabf0('0x30')](_0x32888f[_0xabf0('0x2a')][_0xabf0('0x30')]));_0x20d0bc[_0xabf0('0x2e')]=_0x20d0bc[_0xabf0('0x2e')]['length']?_0x20d0bc['attributes']:_0x43093d[_0xabf0('0x2f')];if(_0x32888f[_0xabf0('0x2a')]['includeAll']){_0x20d0bc[_0xabf0('0x40')]=[{'all':!![]}];}_0x20d0bc=_['merge']({},_0x20d0bc,_0x32888f[_0xabf0('0x3b')]);return db[_0xabf0('0x3d')][_0xabf0('0x41')](_0x20d0bc)['then'](handleEntityNotFound(_0x25352d,null))[_0xabf0('0x21')](respondWithResult(_0x25352d,null))['catch'](handleError(_0x25352d,null));};exports['create']=function(_0x3bd22e,_0x5bf486){return db[_0xabf0('0x3d')]['create'](_0x3bd22e[_0xabf0('0x42')],{})['then'](respondWithResult(_0x5bf486,0xc9))[_0xabf0('0x43')](handleError(_0x5bf486,null));};exports[_0xabf0('0x44')]=function(_0x3f8226,_0x2ca16c){return db[_0xabf0('0x3d')][_0xabf0('0x44')]()[_0xabf0('0x21')](respondWithResult(_0x2ca16c,null))[_0xabf0('0x43')](handleError(_0x2ca16c,null));};exports[_0xabf0('0x20')]=function(_0x39b111,_0x3a94dc){if(_0x39b111[_0xabf0('0x42')][_0xabf0('0x45')]){delete _0x39b111[_0xabf0('0x42')][_0xabf0('0x45')];}return db['CmHopperHistory']['find']({'where':{'uniqueid':_0x39b111[_0xabf0('0x3f')]['id']}})[_0xabf0('0x21')](handleEntityNotFound(_0x3a94dc,null))[_0xabf0('0x21')](saveUpdates(_0x39b111[_0xabf0('0x42')],null))[_0xabf0('0x21')](respondWithResult(_0x3a94dc,null))[_0xabf0('0x43')](handleError(_0x3a94dc,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 2692ab7..e8dfd73 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 _0x7b77=['util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./cmHopperHistory.attributes','exports','define','cm_hopper_history','endtime','uniqueid','lodash'];(function(_0x48bb8c,_0x34d195){var _0x5a129c=function(_0x220a1f){while(--_0x220a1f){_0x48bb8c['push'](_0x48bb8c['shift']());}};_0x5a129c(++_0x34d195);}(_0x7b77,0x179));var _0x77b7=function(_0x310504,_0x26ad95){_0x310504=_0x310504-0x0;var _0x5b36d0=_0x7b77[_0x310504];return _0x5b36d0;};'use strict';var _=require(_0x77b7('0x0'));var util=require(_0x77b7('0x1'));var logger=require(_0x77b7('0x2'))(_0x77b7('0x3'));var moment=require('moment');var BPromise=require(_0x77b7('0x4'));var rp=require(_0x77b7('0x5'));var fs=require('fs');var path=require(_0x77b7('0x6'));var rimraf=require('rimraf');var config=require(_0x77b7('0x7'));var attributes=require(_0x77b7('0x8'));module[_0x77b7('0x9')]=function(_0x3d97f0,_0x4556c1){return _0x3d97f0[_0x77b7('0xa')]('CmHopperHistory',attributes,{'tableName':_0x77b7('0xb'),'paranoid':![],'indexes':[{'name':_0x77b7('0xc'),'fields':[_0x77b7('0xc')]},{'name':'uniqueid','fields':[_0x77b7('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x964b=['api','moment','bluebird','rimraf','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','uniqueid','lodash','util'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x964b,0x112));var _0xb964=function(_0x2e7b5a,_0xbfed56){_0x2e7b5a=_0x2e7b5a-0x0;var _0x27100d=_0x964b[_0x2e7b5a];return _0x27100d;};'use strict';var _=require(_0xb964('0x0'));var util=require(_0xb964('0x1'));var logger=require('../../config/logger')(_0xb964('0x2'));var moment=require(_0xb964('0x3'));var BPromise=require(_0xb964('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb964('0x5'));var config=require('../../config/environment');var attributes=require(_0xb964('0x6'));module[_0xb964('0x7')]=function(_0xba9f19,_0x11a0c1){return _0xba9f19[_0xb964('0x8')](_0xb964('0x9'),attributes,{'tableName':_0xb964('0xa'),'paranoid':![],'indexes':[{'name':'endtime','fields':['endtime']},{'name':_0xb964('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 330d896..0e61fd4 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 _0x3451=['`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`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','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundAnswerAgiCallsDay','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','`state`\x20=\x204,\x201,\x20null','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','then','AvgHandleTime','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','literal','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name'];(function(_0x210fbd,_0x51ae26){var _0x58c44e=function(_0x38dfac){while(--_0x38dfac){_0x210fbd['push'](_0x210fbd['shift']());}};_0x58c44e(++_0x51ae26);}(_0x3451,0x19a));var _0x1345=function(_0x1c189b,_0x587e1b){_0x1c189b=_0x1c189b-0x0;var _0x3771dc=_0x3451[_0x1c189b];return _0x3771dc;};'use strict';var _=require(_0x1345('0x0'));var util=require(_0x1345('0x1'));var moment=require('moment');var BPromise=require(_0x1345('0x2'));var rs=require(_0x1345('0x3'));var fs=require('fs');var Redis=require(_0x1345('0x4'));var db=require(_0x1345('0x5'))['db'];var utils=require(_0x1345('0x6'));var logger=require(_0x1345('0x7'))(_0x1345('0x8'));var config=require(_0x1345('0x9'));var jayson=require(_0x1345('0xa'));var client=jayson[_0x1345('0xb')][_0x1345('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x34c716,_0x4b90dd,_0x3e236d){return new BPromise(function(_0x40689f,_0x516d55){return client[_0x1345('0xd')](_0x34c716,_0x3e236d)['then'](function(_0x4b9de8){logger[_0x1345('0xe')]('CmHopperHistory,\x20%s,\x20%s',_0x4b90dd,_0x1345('0xf'));logger[_0x1345('0x10')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x4b90dd,'request\x20sent',JSON[_0x1345('0x11')](_0x4b9de8));if(_0x4b9de8['error']){if(_0x4b9de8[_0x1345('0x12')][_0x1345('0x13')]===0x1f4){logger[_0x1345('0x12')](_0x1345('0x14'),_0x4b90dd,_0x4b9de8['error'][_0x1345('0x15')]);return _0x516d55(_0x4b9de8[_0x1345('0x12')][_0x1345('0x15')]);}logger[_0x1345('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x4b90dd,_0x4b9de8[_0x1345('0x12')][_0x1345('0x15')]);return _0x40689f(_0x4b9de8[_0x1345('0x12')][_0x1345('0x15')]);}else{logger[_0x1345('0xe')](_0x1345('0x14'),_0x4b90dd,_0x1345('0xf'));_0x40689f(_0x4b9de8[_0x1345('0x16')][_0x1345('0x15')]);}})[_0x1345('0x17')](function(_0x318a0d){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x4b90dd,_0x318a0d);_0x516d55(_0x318a0d);});});}exports[_0x1345('0x18')]=function(_0x1afc89){var _0x1862eb=this;return new Promise(function(_0x1db636,_0x55b95c){return db[_0x1345('0x19')][_0x1345('0x1a')](_0x1afc89[_0x1345('0x1b')],{'raw':_0x1afc89[_0x1345('0x1c')]?_0x1afc89[_0x1345('0x1c')][_0x1345('0x1d')]===undefined?!![]:![]:!![]})[_0x1345('0x1e')](function(_0x43d209){logger[_0x1345('0xe')](_0x1345('0x18'),_0x1afc89);logger[_0x1345('0x10')]('CreateCmHopperHistory',_0x1afc89,JSON[_0x1345('0x11')](_0x43d209));_0x1db636(_0x43d209);})[_0x1345('0x17')](function(_0xaf6ecc){logger[_0x1345('0x12')](_0x1345('0x18'),_0xaf6ecc[_0x1345('0x15')],_0x1afc89);_0x55b95c(_0x1862eb[_0x1345('0x12')](0x1f4,_0xaf6ecc[_0x1345('0x15')]));});});};exports[_0x1345('0x1f')]=function(_0x339ea9){var _0x2e7206=this;return new Promise(function(_0x26358e,_0x39a950){return db['CmHopperHistory'][_0x1345('0x20')]({'raw':_0x339ea9['options']?_0x339ea9[_0x1345('0x1c')][_0x1345('0x1d')]===undefined?!![]:![]:!![],'where':_0x339ea9[_0x1345('0x1c')]?_0x339ea9[_0x1345('0x1c')][_0x1345('0x21')]||null:null,'attributes':[[db[_0x1345('0x22')]['fn'](_0x1345('0x23'),db[_0x1345('0x22')][_0x1345('0x24')]('id')),_0x1345('0x25')],[db[_0x1345('0x22')]['fn'](_0x1345('0x23'),db['sequelize']['fn']('IF',db[_0x1345('0x22')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x1345('0x26')],[db[_0x1345('0x22')]['fn'](_0x1345('0x23'),db[_0x1345('0x22')]['fn']('IF',db[_0x1345('0x22')]['literal'](_0x1345('0x27')))),_0x1345('0x28')],[db[_0x1345('0x22')]['fn']('COUNT',db[_0x1345('0x22')]['fn']('IF',db['sequelize']['literal'](_0x1345('0x29')))),_0x1345('0x2a')],[db[_0x1345('0x22')]['fn'](_0x1345('0x2b'),db['sequelize']['fn']('IF',db[_0x1345('0x22')][_0x1345('0x2c')](_0x1345('0x2d')))),_0x1345('0x2e')],[db[_0x1345('0x22')]['fn'](_0x1345('0x2b'),db[_0x1345('0x22')]['fn']('IF',db[_0x1345('0x22')][_0x1345('0x2c')](_0x1345('0x2f')))),_0x1345('0x30')]]})['then'](function(_0x422ac9){logger[_0x1345('0xe')](_0x1345('0x1f'),_0x339ea9);logger[_0x1345('0x10')](_0x1345('0x1f'),_0x339ea9,JSON['stringify'](_0x422ac9));_0x26358e(_0x422ac9);})[_0x1345('0x17')](function(_0x5da4c8){logger['error'](_0x1345('0x1f'),_0x5da4c8[_0x1345('0x15')],_0x339ea9);_0x39a950(_0x2e7206[_0x1345('0x12')](0x1f4,_0x5da4c8['message']));});});};exports[_0x1345('0x31')]=function(_0x33ee2d){var _0x46a62c=this;return new Promise(function(_0x2c49b9,_0x3cf188){return db[_0x1345('0x19')][_0x1345('0x20')]({'raw':_0x33ee2d['options']?_0x33ee2d['options']['raw']===undefined?!![]:![]:!![],'where':_0x33ee2d['options']?_0x33ee2d['options'][_0x1345('0x21')]||null:null,'attributes':[[_0x1345('0x32'),_0x1345('0x33')],[db[_0x1345('0x22')]['fn'](_0x1345('0x23'),db['sequelize']['fn']('IF',db['sequelize'][_0x1345('0x2c')](_0x1345('0x34')))),_0x1345('0x35')],[db[_0x1345('0x22')]['fn'](_0x1345('0x23'),db[_0x1345('0x22')]['fn']('IF',db['sequelize'][_0x1345('0x2c')](_0x1345('0x36')))),_0x1345('0x37')],[db[_0x1345('0x22')]['fn']('COUNT',db[_0x1345('0x22')]['fn']('IF',db[_0x1345('0x22')][_0x1345('0x2c')]('`state`\x20=\x204,\x201,\x20null'))),_0x1345('0x38')],[db[_0x1345('0x22')]['fn'](_0x1345('0x23'),db['sequelize']['fn']('IF',db[_0x1345('0x22')][_0x1345('0x2c')](_0x1345('0x39')))),_0x1345('0x3a')],[db[_0x1345('0x22')]['fn']('COUNT',db[_0x1345('0x22')]['fn']('IF',db[_0x1345('0x22')][_0x1345('0x2c')](_0x1345('0x3b')))),'outboundCongestionCallsDay'],[db[_0x1345('0x22')]['fn'](_0x1345('0x23'),db[_0x1345('0x22')]['fn']('IF',db[_0x1345('0x22')][_0x1345('0x2c')](_0x1345('0x3c')))),_0x1345('0x3d')],[db[_0x1345('0x22')]['fn'](_0x1345('0x23'),db[_0x1345('0x22')]['fn']('IF',db[_0x1345('0x22')][_0x1345('0x2c')](_0x1345('0x3e')))),_0x1345('0x3f')],[db[_0x1345('0x22')]['fn'](_0x1345('0x23'),db['sequelize']['fn']('IF',db[_0x1345('0x22')][_0x1345('0x2c')](_0x1345('0x40')))),_0x1345('0x41')],[db[_0x1345('0x22')]['fn'](_0x1345('0x23'),db[_0x1345('0x22')]['fn']('IF',db[_0x1345('0x22')][_0x1345('0x2c')](_0x1345('0x42')))),_0x1345('0x43')],[db[_0x1345('0x22')]['fn'](_0x1345('0x23'),db['sequelize']['fn']('IF',db[_0x1345('0x22')]['literal'](_0x1345('0x44')))),_0x1345('0x45')],[db['sequelize']['fn'](_0x1345('0x23'),db[_0x1345('0x22')]['fn']('IF',db[_0x1345('0x22')]['literal']('`state`\x20=\x2018,\x201,\x20null'))),'outboundRejectCallsDay'],[db[_0x1345('0x22')]['fn'](_0x1345('0x23'),db['sequelize']['fn']('IF',db[_0x1345('0x22')][_0x1345('0x2c')]('`state`\x20=\x2016,\x201,\x20null'))),_0x1345('0x46')],[db['sequelize']['fn'](_0x1345('0x23'),db['sequelize']['fn']('IF',db[_0x1345('0x22')][_0x1345('0x2c')]('`state`\x20=\x2020,\x201,\x20null'))),_0x1345('0x47')],[db[_0x1345('0x22')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x1345('0x22')]['literal'](_0x1345('0x48')))),_0x1345('0x49')]],'group':[_0x1345('0x32')]})['then'](function(_0x5d6526){logger['info'](_0x1345('0x31'),_0x33ee2d);logger[_0x1345('0x10')](_0x1345('0x31'),_0x33ee2d,JSON[_0x1345('0x11')](_0x5d6526));_0x2c49b9(_0x5d6526);})['catch'](function(_0x257009){logger['error'](_0x1345('0x31'),_0x257009[_0x1345('0x15')],_0x33ee2d);_0x3cf188(_0x46a62c[_0x1345('0x12')](0x1f4,_0x257009[_0x1345('0x15')]));});});};exports[_0x1345('0x4a')]=function(_0x17857f){var _0xbd274=this;return new Promise(function(_0x409976,_0x439682){return db[_0x1345('0x19')]['findAll']({'raw':_0x17857f[_0x1345('0x1c')]?_0x17857f[_0x1345('0x1c')][_0x1345('0x1d')]===undefined?!![]:![]:!![],'where':_0x17857f[_0x1345('0x1c')]?_0x17857f[_0x1345('0x1c')][_0x1345('0x21')]||null:null,'attributes':[[_0x1345('0x32'),_0x1345('0x33')],[db[_0x1345('0x22')]['fn'](_0x1345('0x23'),db[_0x1345('0x22')][_0x1345('0x24')]('id')),_0x1345('0x4b')],[db[_0x1345('0x22')]['fn'](_0x1345('0x23'),db[_0x1345('0x22')]['fn']('IF',db['sequelize'][_0x1345('0x2c')](_0x1345('0x4c')))),'ivrAnswerCallsDay']],'group':[_0x1345('0x32')]})[_0x1345('0x1e')](function(_0x162b19){logger['info'](_0x1345('0x4a'),_0x17857f);logger[_0x1345('0x10')](_0x1345('0x4a'),_0x17857f,JSON[_0x1345('0x11')](_0x162b19));_0x409976(_0x162b19);})[_0x1345('0x17')](function(_0x102ba0){logger[_0x1345('0x12')](_0x1345('0x4a'),_0x102ba0[_0x1345('0x15')],_0x17857f);_0x439682(_0xbd274[_0x1345('0x12')](0x1f4,_0x102ba0[_0x1345('0x15')]));});});}; \ No newline at end of file +var _0x4d41=['request','then','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','CmHopperHistory,\x20%s,\x20%s','info','catch','CreateCmHopperHistory','CmHopperHistory','create','options','raw','stringify','AvgHandleTime','where','sequelize','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','COUNT','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x208,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetCampaignHopperHistory','findAll','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http'];(function(_0x43b50c,_0x22c826){var _0x480158=function(_0x1bcb35){while(--_0x1bcb35){_0x43b50c['push'](_0x43b50c['shift']());}};_0x480158(++_0x22c826);}(_0x4d41,0x153));var _0x14d4=function(_0xf30651,_0x964c8){_0xf30651=_0xf30651-0x0;var _0x5382a0=_0x4d41[_0xf30651];return _0x5382a0;};'use strict';var _=require(_0x14d4('0x0'));var util=require(_0x14d4('0x1'));var moment=require(_0x14d4('0x2'));var BPromise=require('bluebird');var rs=require(_0x14d4('0x3'));var fs=require('fs');var Redis=require(_0x14d4('0x4'));var db=require(_0x14d4('0x5'))['db'];var utils=require(_0x14d4('0x6'));var logger=require(_0x14d4('0x7'))(_0x14d4('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x14d4('0x9')][_0x14d4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f7d30,_0x586569,_0x5a6cc0){return new BPromise(function(_0x5af0d5,_0x38ad4e){return client[_0x14d4('0xb')](_0x2f7d30,_0x5a6cc0)[_0x14d4('0xc')](function(_0x466286){logger['info']('CmHopperHistory,\x20%s,\x20%s',_0x586569,_0x14d4('0xd'));logger[_0x14d4('0xe')](_0x14d4('0xf'),_0x586569,'request\x20sent',JSON['stringify'](_0x466286));if(_0x466286[_0x14d4('0x10')]){if(_0x466286['error'][_0x14d4('0x11')]===0x1f4){logger[_0x14d4('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x586569,_0x466286[_0x14d4('0x10')][_0x14d4('0x12')]);return _0x38ad4e(_0x466286[_0x14d4('0x10')][_0x14d4('0x12')]);}logger[_0x14d4('0x10')](_0x14d4('0x13'),_0x586569,_0x466286[_0x14d4('0x10')][_0x14d4('0x12')]);return _0x5af0d5(_0x466286[_0x14d4('0x10')]['message']);}else{logger[_0x14d4('0x14')](_0x14d4('0x13'),_0x586569,_0x14d4('0xd'));_0x5af0d5(_0x466286['result'][_0x14d4('0x12')]);}})[_0x14d4('0x15')](function(_0x2eafb9){logger[_0x14d4('0x10')](_0x14d4('0x13'),_0x586569,_0x2eafb9);_0x38ad4e(_0x2eafb9);});});}exports[_0x14d4('0x16')]=function(_0x41901f){var _0xdc4f60=this;return new Promise(function(_0xca0cad,_0xaba73a){return db[_0x14d4('0x17')][_0x14d4('0x18')](_0x41901f['body'],{'raw':_0x41901f[_0x14d4('0x19')]?_0x41901f[_0x14d4('0x19')][_0x14d4('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x321f4a){logger['info'](_0x14d4('0x16'),_0x41901f);logger[_0x14d4('0xe')](_0x14d4('0x16'),_0x41901f,JSON[_0x14d4('0x1b')](_0x321f4a));_0xca0cad(_0x321f4a);})[_0x14d4('0x15')](function(_0x51fea0){logger[_0x14d4('0x10')](_0x14d4('0x16'),_0x51fea0[_0x14d4('0x12')],_0x41901f);_0xaba73a(_0xdc4f60['error'](0x1f4,_0x51fea0['message']));});});};exports[_0x14d4('0x1c')]=function(_0x1974cf){var _0x176bdf=this;return new Promise(function(_0x578776,_0x2ffca8){return db[_0x14d4('0x17')]['findAll']({'raw':_0x1974cf[_0x14d4('0x19')]?_0x1974cf[_0x14d4('0x19')][_0x14d4('0x1a')]===undefined?!![]:![]:!![],'where':_0x1974cf[_0x14d4('0x19')]?_0x1974cf['options'][_0x14d4('0x1d')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0x14d4('0x1e')][_0x14d4('0x1f')]('id')),_0x14d4('0x20')],[db[_0x14d4('0x1e')]['fn']('COUNT',db[_0x14d4('0x1e')]['fn']('IF',db['sequelize'][_0x14d4('0x21')](_0x14d4('0x22')))),'predictiveIntervalAnsweredCalls'],[db[_0x14d4('0x1e')]['fn'](_0x14d4('0x23'),db['sequelize']['fn']('IF',db[_0x14d4('0x1e')][_0x14d4('0x21')](_0x14d4('0x24')))),'predictiveIntervalDroppedCallsTimeout'],[db['sequelize']['fn'](_0x14d4('0x23'),db[_0x14d4('0x1e')]['fn']('IF',db['sequelize'][_0x14d4('0x21')]('`state`\x20=\x2011,\x201,\x20null'))),_0x14d4('0x25')],[db['sequelize']['fn'](_0x14d4('0x26'),db[_0x14d4('0x1e')]['fn']('IF',db[_0x14d4('0x1e')][_0x14d4('0x21')](_0x14d4('0x27')))),_0x14d4('0x28')],[db[_0x14d4('0x1e')]['fn'](_0x14d4('0x26'),db['sequelize']['fn']('IF',db[_0x14d4('0x1e')][_0x14d4('0x21')](_0x14d4('0x29')))),_0x14d4('0x2a')]]})[_0x14d4('0xc')](function(_0x3a47bd){logger['info'](_0x14d4('0x1c'),_0x1974cf);logger[_0x14d4('0xe')](_0x14d4('0x1c'),_0x1974cf,JSON[_0x14d4('0x1b')](_0x3a47bd));_0x578776(_0x3a47bd);})[_0x14d4('0x15')](function(_0x3c68dc){logger[_0x14d4('0x10')]('AvgHandleTime',_0x3c68dc[_0x14d4('0x12')],_0x1974cf);_0x2ffca8(_0x176bdf[_0x14d4('0x10')](0x1f4,_0x3c68dc[_0x14d4('0x12')]));});});};exports[_0x14d4('0x2b')]=function(_0x3a3578){var _0x10af33=this;return new Promise(function(_0x4fa991,_0x105ba6){return db[_0x14d4('0x17')]['findAll']({'raw':_0x3a3578[_0x14d4('0x19')]?_0x3a3578[_0x14d4('0x19')][_0x14d4('0x1a')]===undefined?!![]:![]:!![],'where':_0x3a3578['options']?_0x3a3578[_0x14d4('0x19')]['where']||null:null,'attributes':[[_0x14d4('0x2c'),_0x14d4('0x2d')],[db[_0x14d4('0x1e')]['fn']('COUNT',db[_0x14d4('0x1e')]['fn']('IF',db[_0x14d4('0x1e')][_0x14d4('0x21')](_0x14d4('0x2e')))),_0x14d4('0x2f')],[db['sequelize']['fn'](_0x14d4('0x23'),db[_0x14d4('0x1e')]['fn']('IF',db[_0x14d4('0x1e')][_0x14d4('0x21')](_0x14d4('0x30')))),_0x14d4('0x31')],[db[_0x14d4('0x1e')]['fn'](_0x14d4('0x23'),db[_0x14d4('0x1e')]['fn']('IF',db[_0x14d4('0x1e')][_0x14d4('0x21')](_0x14d4('0x22')))),_0x14d4('0x32')],[db['sequelize']['fn'](_0x14d4('0x23'),db[_0x14d4('0x1e')]['fn']('IF',db['sequelize'][_0x14d4('0x21')]('`state`\x20=\x205,\x201,\x20null'))),'outboundBusyCallsDay'],[db[_0x14d4('0x1e')]['fn'](_0x14d4('0x23'),db[_0x14d4('0x1e')]['fn']('IF',db['sequelize'][_0x14d4('0x21')](_0x14d4('0x33')))),'outboundCongestionCallsDay'],[db[_0x14d4('0x1e')]['fn'](_0x14d4('0x23'),db[_0x14d4('0x1e')]['fn']('IF',db[_0x14d4('0x1e')][_0x14d4('0x21')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x14d4('0x34')],[db['sequelize']['fn'](_0x14d4('0x23'),db['sequelize']['fn']('IF',db['sequelize'][_0x14d4('0x21')](_0x14d4('0x35')))),_0x14d4('0x36')],[db[_0x14d4('0x1e')]['fn'](_0x14d4('0x23'),db['sequelize']['fn']('IF',db[_0x14d4('0x1e')][_0x14d4('0x21')](_0x14d4('0x37')))),_0x14d4('0x38')],[db[_0x14d4('0x1e')]['fn'](_0x14d4('0x23'),db[_0x14d4('0x1e')]['fn']('IF',db['sequelize'][_0x14d4('0x21')]('`state`\x20=\x2013,\x201,\x20null'))),_0x14d4('0x39')],[db[_0x14d4('0x1e')]['fn'](_0x14d4('0x23'),db[_0x14d4('0x1e')]['fn']('IF',db['sequelize'][_0x14d4('0x21')](_0x14d4('0x3a')))),_0x14d4('0x3b')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x14d4('0x21')](_0x14d4('0x3c')))),_0x14d4('0x3d')],[db['sequelize']['fn']('COUNT',db[_0x14d4('0x1e')]['fn']('IF',db[_0x14d4('0x1e')][_0x14d4('0x21')](_0x14d4('0x3e')))),_0x14d4('0x3f')],[db[_0x14d4('0x1e')]['fn']('COUNT',db[_0x14d4('0x1e')]['fn']('IF',db['sequelize'][_0x14d4('0x21')](_0x14d4('0x40')))),_0x14d4('0x3d')],[db[_0x14d4('0x1e')]['fn'](_0x14d4('0x23'),db['sequelize']['fn']('IF',db[_0x14d4('0x1e')]['literal'](_0x14d4('0x41')))),'outboundReCallsDay']],'group':[_0x14d4('0x2c')]})[_0x14d4('0xc')](function(_0x5b2c71){logger['info'](_0x14d4('0x2b'),_0x3a3578);logger[_0x14d4('0xe')]('GetVoiceQueueHopperHistory',_0x3a3578,JSON[_0x14d4('0x1b')](_0x5b2c71));_0x4fa991(_0x5b2c71);})['catch'](function(_0x1e1812){logger[_0x14d4('0x10')](_0x14d4('0x2b'),_0x1e1812['message'],_0x3a3578);_0x105ba6(_0x10af33[_0x14d4('0x10')](0x1f4,_0x1e1812[_0x14d4('0x12')]));});});};exports[_0x14d4('0x42')]=function(_0x154a21){var _0x128c2d=this;return new Promise(function(_0x246abc,_0x422090){return db[_0x14d4('0x17')][_0x14d4('0x43')]({'raw':_0x154a21['options']?_0x154a21[_0x14d4('0x19')][_0x14d4('0x1a')]===undefined?!![]:![]:!![],'where':_0x154a21['options']?_0x154a21['options'][_0x14d4('0x1d')]||null:null,'attributes':[[_0x14d4('0x2c'),_0x14d4('0x2d')],[db[_0x14d4('0x1e')]['fn'](_0x14d4('0x23'),db['sequelize'][_0x14d4('0x1f')]('id')),_0x14d4('0x44')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x14d4('0x1e')][_0x14d4('0x21')]('`state`\x20=\x204,\x201,\x20null'))),_0x14d4('0x45')]],'group':[_0x14d4('0x2c')]})[_0x14d4('0xc')](function(_0x1abebf){logger[_0x14d4('0x14')](_0x14d4('0x42'),_0x154a21);logger[_0x14d4('0xe')](_0x14d4('0x42'),_0x154a21,JSON[_0x14d4('0x1b')](_0x1abebf));_0x246abc(_0x1abebf);})[_0x14d4('0x15')](function(_0x42e113){logger[_0x14d4('0x10')](_0x14d4('0x42'),_0x42e113[_0x14d4('0x12')],_0x154a21);_0x422090(_0x128c2d[_0x14d4('0x10')](0x1f4,_0x42e113[_0x14d4('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index ba9002e..c214176 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 _0xd94a=['fs-extra','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','update','exports','multer','util','connect-timeout','Router'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xd94a,0x1cc));var _0xad94=function(_0x3d800a,_0x5d29d9){_0x3d800a=_0x3d800a-0x0;var _0x2c3bd6=_0xd94a[_0x3d800a];return _0x2c3bd6;};'use strict';var multer=require(_0xad94('0x0'));var util=require(_0xad94('0x1'));var path=require('path');var timeout=require(_0xad94('0x2'));var express=require('express');var router=express[_0xad94('0x3')]();var fs_extra=require(_0xad94('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xad94('0x5'));router[_0xad94('0x6')]('/',auth[_0xad94('0x7')](),controller[_0xad94('0x8')]);router[_0xad94('0x6')](_0xad94('0x9'),auth[_0xad94('0x7')](),controller['describe']);router[_0xad94('0x6')](_0xad94('0xa'),auth[_0xad94('0x7')](),controller[_0xad94('0xb')]);router[_0xad94('0xc')]('/',auth[_0xad94('0x7')](),controller[_0xad94('0xd')]);router['put'](_0xad94('0xa'),auth[_0xad94('0x7')](),controller[_0xad94('0xe')]);module[_0xad94('0xf')]=router; \ No newline at end of file +var _0xc98a=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./cmHopperHistory.controller','isAuthenticated','index','get','/:id','post','create','update'];(function(_0xb9b594,_0x30617b){var _0x3609ba=function(_0x289b4a){while(--_0x289b4a){_0xb9b594['push'](_0xb9b594['shift']());}};_0x3609ba(++_0x30617b);}(_0xc98a,0x71));var _0xac98=function(_0x3e4b98,_0x2ec6b4){_0x3e4b98=_0x3e4b98-0x0;var _0xf2b74b=_0xc98a[_0x3e4b98];return _0xf2b74b;};'use strict';var multer=require(_0xac98('0x0'));var util=require(_0xac98('0x1'));var path=require(_0xac98('0x2'));var timeout=require(_0xac98('0x3'));var express=require('express');var router=express[_0xac98('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xac98('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xac98('0x6'));var controller=require(_0xac98('0x7'));router['get']('/',auth[_0xac98('0x8')](),controller[_0xac98('0x9')]);router[_0xac98('0xa')]('/describe',auth[_0xac98('0x8')](),controller['describe']);router[_0xac98('0xa')](_0xac98('0xb'),auth[_0xac98('0x8')](),controller['show']);router[_0xac98('0xc')]('/',auth[_0xac98('0x8')](),controller[_0xac98('0xd')]);router['put'](_0xac98('0xb'),auth[_0xac98('0x8')](),controller[_0xac98('0xe')]);module[_0xac98('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 1a423ea..08a896b 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 _0x2d17=['name','STRING','sequelize','exports'];(function(_0x23a673,_0x31e4bc){var _0x2213b7=function(_0x3c5dcc){while(--_0x3c5dcc){_0x23a673['push'](_0x23a673['shift']());}};_0x2213b7(++_0x31e4bc);}(_0x2d17,0x17e));var _0x72d1=function(_0x201a64,_0x416023){_0x201a64=_0x201a64-0x0;var _0x2f4806=_0x2d17[_0x201a64];return _0x2f4806;};'use strict';var Sequelize=require(_0x72d1('0x0'));module[_0x72d1('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x72d1('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x72d1('0x3')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xde6c=['STRING','sequelize','exports','name'];(function(_0x32413a,_0x2fbe54){var _0x1439e0=function(_0x108320){while(--_0x108320){_0x32413a['push'](_0x32413a['shift']());}};_0x1439e0(++_0x2fbe54);}(_0xde6c,0x119));var _0xcde6=function(_0x21dd50,_0x921f70){_0x21dd50=_0x21dd50-0x0;var _0x1b7d5e=_0xde6c[_0x21dd50];return _0x1b7d5e;};'use strict';var Sequelize=require(_0xcde6('0x0'));module[_0xcde6('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xcde6('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xcde6('0x3')]},'dialPrefix':{'type':Sequelize[_0xcde6('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 56f9e80..c582b92 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 _0xe83f=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','status','end','json','offset','undefined','limit','count','apply','reject','save','then','destroy','get','Lists','UserProfileResource','sendStatus','error','stack','name','send','index','map','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','CmList','rawAttributes','include','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','find','describe','Disposition','getDispositions','findOne','nolimit','removeDispositions','addContacts','CmContact','tags','join','isArray','ListId','push','omit','ids','success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','concat','CustomFields','format','cf_%d','raw','getContactsCsv','ContactItemType','OrderBy','alias','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','c.cf_','customField_','field','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','description','description_additionalPhone_','each','toString','isEmpty','now','writeFileSync','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','setHeader','Content-type','text/csv','/tmp/list_%d_%s.csv','sequelize','transaction','Sequelize','TEXT','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','findAndCountAll','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x51ec61,_0xf9d1e3){var _0x223200=function(_0x3bd510){while(--_0x3bd510){_0x51ec61['push'](_0x51ec61['shift']());}};_0x223200(++_0xf9d1e3);}(_0xe83f,0x139));var _0xfe83=function(_0x3c28a3,_0x1f82a5){_0x3c28a3=_0x3c28a3-0x0;var _0x264cc1=_0xe83f[_0x3c28a3];return _0x264cc1;};'use strict';var emlformat=require(_0xfe83('0x0'));var rimraf=require(_0xfe83('0x1'));var zipdir=require(_0xfe83('0x2'));var jsonpatch=require(_0xfe83('0x3'));var rp=require(_0xfe83('0x4'));var moment=require(_0xfe83('0x5'));var BPromise=require(_0xfe83('0x6'));var Mustache=require(_0xfe83('0x7'));var util=require('util');var path=require('path');var sox=require(_0xfe83('0x8'));var csv=require(_0xfe83('0x9'));var ejs=require(_0xfe83('0xa'));var fs=require('fs');var fs_extra=require(_0xfe83('0xb'));var _=require(_0xfe83('0xc'));var squel=require(_0xfe83('0xd'));var crypto=require('crypto');var jsforce=require(_0xfe83('0xe'));var deskjs=require(_0xfe83('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfe83('0x10'));var authService=require(_0xfe83('0x11'));var qs=require(_0xfe83('0x12'));var as=require(_0xfe83('0x13'));var hardwareService=require(_0xfe83('0x14'));var logger=require('../../config/logger')(_0xfe83('0x15'));var utils=require(_0xfe83('0x16'));var config=require(_0xfe83('0x17'));var licenseUtil=require(_0xfe83('0x18'));var db=require(_0xfe83('0x19'))['db'];var csv_results;config[_0xfe83('0x1a')]=_[_0xfe83('0x1b')](config[_0xfe83('0x1a')],{'host':_0xfe83('0x1c'),'port':0x18eb});var socket=require(_0xfe83('0x1d'))(new Redis(config['redis']));require(_0xfe83('0x1e'))[_0xfe83('0x1f')](socket);function respondWithStatusCode(_0x55b402,_0x37b862){_0x37b862=_0x37b862||0xcc;return function(_0x16e045){if(_0x16e045){return _0x55b402['sendStatus'](_0x37b862);}return _0x55b402[_0xfe83('0x20')](_0x37b862)[_0xfe83('0x21')]();};}function respondWithResult(_0x245593,_0x59af13){_0x59af13=_0x59af13||0xc8;return function(_0x5a995f){if(_0x5a995f){return _0x245593['status'](_0x59af13)[_0xfe83('0x22')](_0x5a995f);}};}function respondWithFilteredResult(_0x1e9a49,_0x23ad5c){return function(_0x42f867){if(_0x42f867){var _0x3c0d3a=typeof _0x23ad5c[_0xfe83('0x23')]===_0xfe83('0x24')&&typeof _0x23ad5c[_0xfe83('0x25')]===_0xfe83('0x24');var _0x53bdb3=_0x42f867['count'];var _0x1ed1cc=_0x3c0d3a?0x0:_0x23ad5c[_0xfe83('0x23')];var _0x138f93=_0x3c0d3a?_0x42f867[_0xfe83('0x26')]:_0x23ad5c['offset']+_0x23ad5c[_0xfe83('0x25')];var _0x46c540;if(_0x138f93>=_0x53bdb3){_0x138f93=_0x53bdb3;_0x46c540=0xc8;}else{_0x46c540=0xce;}_0x1e9a49[_0xfe83('0x20')](_0x46c540);return _0x1e9a49['set']('Content-Range',_0x1ed1cc+'-'+_0x138f93+'/'+_0x53bdb3)[_0xfe83('0x22')](_0x42f867);}return null;};}function patchUpdates(_0x5374ee){return function(_0x59e457){try{jsonpatch[_0xfe83('0x27')](_0x59e457,_0x5374ee,!![]);}catch(_0xb5ab42){return BPromise[_0xfe83('0x28')](_0xb5ab42);}return _0x59e457[_0xfe83('0x29')]();};}function saveUpdates(_0x432979,_0x451de1){return function(_0x5cc046){if(_0x5cc046){return _0x5cc046['update'](_0x432979)[_0xfe83('0x2a')](function(_0x405b32){return _0x405b32;});}return null;};}function removeEntity(_0x54f8cf,_0x1f57b5){return function(_0x29d0d4){if(_0x29d0d4){return _0x29d0d4[_0xfe83('0x2b')]()['then'](function(){var _0x205de9=_0x29d0d4[_0xfe83('0x2c')]({'plain':!![]});var _0x16084f=_0xfe83('0x2d');return db[_0xfe83('0x2e')][_0xfe83('0x2b')]({'where':{'type':_0x16084f,'resourceId':_0x205de9['id']}})['then'](function(){return _0x29d0d4;});})[_0xfe83('0x2a')](function(){_0x54f8cf['status'](0xcc)[_0xfe83('0x21')]();});}};}function handleEntityNotFound(_0x22c763,_0xc67023){return function(_0x15d8c5){if(!_0x15d8c5){_0x22c763[_0xfe83('0x2f')](0x194);}return _0x15d8c5;};}function handleError(_0x3d4e48,_0x526961){_0x526961=_0x526961||0x1f4;return function(_0x48ed58){logger[_0xfe83('0x30')](_0x48ed58[_0xfe83('0x31')]);if(_0x48ed58[_0xfe83('0x32')]){delete _0x48ed58[_0xfe83('0x32')];}_0x3d4e48[_0xfe83('0x20')](_0x526961)[_0xfe83('0x33')](_0x48ed58);};}exports[_0xfe83('0x34')]=function(_0x22f486,_0x3769db){var _0x210f81={},_0x1a428b={},_0x2bec17={'count':0x0,'rows':[]};var _0x5e59af=_[_0xfe83('0x35')](db['CmList']['rawAttributes'],function(_0x20b7c7){return{'name':_0x20b7c7[_0xfe83('0x36')],'type':_0x20b7c7[_0xfe83('0x37')]['key']};});_0x1a428b['model']=_['map'](_0x5e59af,_0xfe83('0x32'));_0x1a428b['query']=_[_0xfe83('0x38')](_0x22f486[_0xfe83('0x39')]);_0x1a428b[_0xfe83('0x3a')]=_[_0xfe83('0x3b')](_0x1a428b[_0xfe83('0x3c')],_0x1a428b['query']);_0x210f81[_0xfe83('0x3d')]=_['intersection'](_0x1a428b[_0xfe83('0x3c')],qs[_0xfe83('0x3e')](_0x22f486['query'][_0xfe83('0x3e')]));_0x210f81[_0xfe83('0x3d')]=_0x210f81[_0xfe83('0x3d')][_0xfe83('0x3f')]?_0x210f81['attributes']:_0x1a428b[_0xfe83('0x3c')];if(!_0x22f486[_0xfe83('0x39')][_0xfe83('0x40')]('nolimit')){_0x210f81['limit']=qs[_0xfe83('0x25')](_0x22f486[_0xfe83('0x39')][_0xfe83('0x25')]);_0x210f81[_0xfe83('0x23')]=qs[_0xfe83('0x23')](_0x22f486['query'][_0xfe83('0x23')]);}_0x210f81[_0xfe83('0x41')]=qs['sort'](_0x22f486[_0xfe83('0x39')][_0xfe83('0x42')]);_0x210f81['where']=qs[_0xfe83('0x3a')](_[_0xfe83('0x43')](_0x22f486[_0xfe83('0x39')],_0x1a428b[_0xfe83('0x3a')]),_0x5e59af);if(_0x22f486['query'][_0xfe83('0x44')]){_0x210f81[_0xfe83('0x45')]=_['merge'](_0x210f81[_0xfe83('0x45')],{'$or':_[_0xfe83('0x35')](_0x5e59af,function(_0x353870){if(_0x353870[_0xfe83('0x37')]!==_0xfe83('0x46')){var _0x2ca1cf={};_0x2ca1cf[_0x353870['name']]={'$like':'%'+_0x22f486[_0xfe83('0x39')][_0xfe83('0x44')]+'%'};return _0x2ca1cf;}})});}_0x210f81=_[_0xfe83('0x47')]({},_0x210f81,_0x22f486[_0xfe83('0x48')]);var _0x109691={'where':_0x210f81['where']};return db['CmList'][_0xfe83('0x26')](_0x109691)[_0xfe83('0x2a')](function(_0x1d7f90){_0x2bec17[_0xfe83('0x26')]=_0x1d7f90;if(_0x22f486[_0xfe83('0x39')][_0xfe83('0x49')]){_0x210f81['include']=[{'all':!![]}];}return db['CmList'][_0xfe83('0x4a')](_0x210f81);})['then'](function(_0x529fe4){_0x2bec17[_0xfe83('0x4b')]=_0x529fe4;return _0x2bec17;})[_0xfe83('0x2a')](respondWithFilteredResult(_0x3769db,_0x210f81))[_0xfe83('0x4c')](handleError(_0x3769db,null));};exports[_0xfe83('0x4d')]=function(_0x41870e,_0x2cfc14){var _0x4278d8={'raw':![],'where':{'id':_0x41870e[_0xfe83('0x4e')]['id']}},_0x5965ae={};_0x5965ae[_0xfe83('0x3c')]=_['keys'](db[_0xfe83('0x4f')][_0xfe83('0x50')]);_0x5965ae[_0xfe83('0x39')]=_[_0xfe83('0x38')](_0x41870e[_0xfe83('0x39')]);_0x5965ae[_0xfe83('0x3a')]=_[_0xfe83('0x3b')](_0x5965ae[_0xfe83('0x3c')],_0x5965ae[_0xfe83('0x39')]);_0x4278d8[_0xfe83('0x3d')]=_[_0xfe83('0x3b')](_0x5965ae[_0xfe83('0x3c')],qs[_0xfe83('0x3e')](_0x41870e[_0xfe83('0x39')][_0xfe83('0x3e')]));_0x4278d8['attributes']=_0x4278d8['attributes']['length']?_0x4278d8[_0xfe83('0x3d')]:_0x5965ae['model'];if(_0x41870e[_0xfe83('0x39')][_0xfe83('0x49')]){_0x4278d8[_0xfe83('0x51')]=[{'all':!![]}];}_0x4278d8=_['merge']({},_0x4278d8,_0x41870e[_0xfe83('0x48')]);return db[_0xfe83('0x4f')]['find'](_0x4278d8)['then'](handleEntityNotFound(_0x2cfc14,null))[_0xfe83('0x2a')](respondWithResult(_0x2cfc14,null))[_0xfe83('0x4c')](handleError(_0x2cfc14,null));};exports[_0xfe83('0x52')]=function(_0x1b5c7d,_0x51eeae){return db[_0xfe83('0x4f')]['create'](_0x1b5c7d['body'],{})['then'](function(_0x3bf6d0){var _0x36fa69=_0x1b5c7d['user']['get']({'plain':!![]});if(!_0x36fa69)throw new Error(_0xfe83('0x53'));if(_0x36fa69[_0xfe83('0x54')]===_0xfe83('0x55')){var _0xd81455=_0x3bf6d0[_0xfe83('0x2c')]({'plain':!![]});var _0x13a224=_0xfe83('0x2d');return db['UserProfileSection']['find']({'where':{'name':_0x13a224,'userProfileId':_0x36fa69[_0xfe83('0x56')]},'raw':!![]})[_0xfe83('0x2a')](function(_0x755bdc){if(_0x755bdc&&_0x755bdc[_0xfe83('0x57')]===0x0){return db[_0xfe83('0x2e')][_0xfe83('0x52')]({'name':_0xd81455[_0xfe83('0x32')],'resourceId':_0xd81455['id'],'type':_0x755bdc[_0xfe83('0x32')],'sectionId':_0x755bdc['id']},{})[_0xfe83('0x2a')](function(){return _0x3bf6d0;});}else{return _0x3bf6d0;}})[_0xfe83('0x4c')](function(_0x2ba6a8){logger[_0xfe83('0x30')](_0xfe83('0x58'),_0x2ba6a8);throw _0x2ba6a8;});}return _0x3bf6d0;})[_0xfe83('0x2a')](respondWithResult(_0x51eeae,0xc9))[_0xfe83('0x4c')](handleError(_0x51eeae,null));};exports[_0xfe83('0x59')]=function(_0xe6ece3,_0x3322d4){if(_0xe6ece3[_0xfe83('0x5a')]['id']){delete _0xe6ece3[_0xfe83('0x5a')]['id'];}return db[_0xfe83('0x4f')][_0xfe83('0x5b')]({'where':{'id':_0xe6ece3[_0xfe83('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3322d4,null))[_0xfe83('0x2a')](saveUpdates(_0xe6ece3[_0xfe83('0x5a')],null))[_0xfe83('0x2a')](respondWithResult(_0x3322d4,null))[_0xfe83('0x4c')](handleError(_0x3322d4,null));};exports['destroy']=function(_0x284a9e,_0x111050){return db[_0xfe83('0x4f')][_0xfe83('0x5b')]({'where':{'id':_0x284a9e[_0xfe83('0x4e')]['id']}})[_0xfe83('0x2a')](handleEntityNotFound(_0x111050,null))['then'](removeEntity(_0x111050,null))[_0xfe83('0x4c')](handleError(_0x111050,null));};exports['describe']=function(_0x19153c,_0xad3f68){return db['CmList'][_0xfe83('0x5c')]()[_0xfe83('0x2a')](respondWithResult(_0xad3f68,null))['catch'](handleError(_0xad3f68,null));};exports['addDisposition']=function(_0x134dcd,_0x1c6a6a,_0x2f651e){if(_0x134dcd['body']['id']){delete _0x134dcd[_0xfe83('0x5a')]['id'];}return db[_0xfe83('0x4f')][_0xfe83('0x5b')]({'where':{'id':_0x134dcd[_0xfe83('0x4e')]['id']}})[_0xfe83('0x2a')](handleEntityNotFound(_0x1c6a6a,null))['then'](function(_0x30732e){if(_0x30732e){_0x134dcd[_0xfe83('0x5a')]['ListId']=_0x30732e['id'];return db[_0xfe83('0x5d')][_0xfe83('0x52')](_0x134dcd[_0xfe83('0x5a')]);}})[_0xfe83('0x2a')](respondWithResult(_0x1c6a6a,null))['catch'](handleError(_0x1c6a6a,null));};exports[_0xfe83('0x5e')]=function(_0x542f09,_0x4ba7e4,_0x3ebc75){var _0x339b25={'raw':![],'where':{}};var _0x3b999e={};var _0x54a393={'count':0x0,'rows':[]};return db['CmList'][_0xfe83('0x5f')]({'where':{'id':_0x542f09[_0xfe83('0x4e')]['id']}})[_0xfe83('0x2a')](handleEntityNotFound(_0x4ba7e4,null))['then'](function(_0x52ecde){if(_0x52ecde){_0x3b999e[_0xfe83('0x3c')]=_['keys'](db[_0xfe83('0x5d')][_0xfe83('0x50')]);_0x3b999e[_0xfe83('0x39')]=_[_0xfe83('0x38')](_0x542f09[_0xfe83('0x39')]);_0x3b999e[_0xfe83('0x3a')]=_[_0xfe83('0x3b')](_0x3b999e['model'],_0x3b999e[_0xfe83('0x39')]);_0x339b25['attributes']=_[_0xfe83('0x3b')](_0x3b999e[_0xfe83('0x3c')],qs['fields'](_0x542f09[_0xfe83('0x39')][_0xfe83('0x3e')]));_0x339b25[_0xfe83('0x3d')]=_0x339b25[_0xfe83('0x3d')][_0xfe83('0x3f')]?_0x339b25[_0xfe83('0x3d')]:_0x3b999e[_0xfe83('0x3c')];if(!_0x542f09['query'][_0xfe83('0x40')](_0xfe83('0x60'))){_0x339b25['limit']=qs[_0xfe83('0x25')](_0x542f09[_0xfe83('0x39')]['limit']);_0x339b25['offset']=qs[_0xfe83('0x23')](_0x542f09['query'][_0xfe83('0x23')]);}_0x339b25[_0xfe83('0x41')]=qs[_0xfe83('0x42')](_0x542f09[_0xfe83('0x39')]['sort']);_0x339b25['where']=qs[_0xfe83('0x3a')](_[_0xfe83('0x43')](_0x542f09[_0xfe83('0x39')],_0x3b999e[_0xfe83('0x3a')]));_0x339b25[_0xfe83('0x45')]['ListId']=_0x52ecde['id'];if(_0x542f09[_0xfe83('0x39')][_0xfe83('0x44')]){_0x339b25[_0xfe83('0x45')]=_[_0xfe83('0x47')](_0x339b25['where'],{'$or':_[_0xfe83('0x35')](_0x339b25['attributes'],function(_0x2b88e9){var _0x410400={};_0x410400[_0x2b88e9]={'$like':'%'+_0x542f09[_0xfe83('0x39')][_0xfe83('0x44')]+'%'};return _0x410400;})});}_0x339b25=_[_0xfe83('0x47')]({},_0x339b25,_0x542f09['options']);return db['Disposition'][_0xfe83('0x26')]({'where':_0x339b25[_0xfe83('0x45')]})[_0xfe83('0x2a')](function(_0x16f08a){_0x54a393['count']=_0x16f08a;if(_0x542f09[_0xfe83('0x39')][_0xfe83('0x49')]){_0x339b25[_0xfe83('0x51')]=[{'all':!![]}];}return db[_0xfe83('0x5d')][_0xfe83('0x4a')](_0x339b25);})['then'](function(_0x2e94c3){_0x54a393['rows']=_0x2e94c3;return _0x54a393;});}})[_0xfe83('0x2a')](respondWithFilteredResult(_0x4ba7e4,_0x339b25))[_0xfe83('0x4c')](handleError(_0x4ba7e4,null));};exports[_0xfe83('0x61')]=function(_0x2976b4,_0x3ecaae,_0x3af28b){return db[_0xfe83('0x4f')][_0xfe83('0x5b')]({'where':{'id':_0x2976b4[_0xfe83('0x4e')]['id']}})[_0xfe83('0x2a')](handleEntityNotFound(_0x3ecaae,null))[_0xfe83('0x2a')](function(_0x5b9ca3){if(_0x5b9ca3){return _0x5b9ca3[_0xfe83('0x61')](_0x2976b4['query']['ids']);}})[_0xfe83('0x2a')](respondWithStatusCode(_0x3ecaae,null))[_0xfe83('0x4c')](handleError(_0x3ecaae,null));};exports[_0xfe83('0x62')]=function(_0x1a82c9,_0x496bfa,_0x3cf480){return db['CmList'][_0xfe83('0x5b')]({'where':{'id':_0x1a82c9['params']['id']}})['then'](handleEntityNotFound(_0x496bfa,null))[_0xfe83('0x2a')](function(_0x35a1ba){if(_0x35a1ba){var _0xd44a53=[];var _0xa33fac={'success':[],'errors':[]};return db[_0xfe83('0x63')][_0xfe83('0x5c')]()['then'](function(_0x4199b8){if(_0x1a82c9[_0xfe83('0x5a')][_0xfe83('0x64')]&&_['isArray'](_0x1a82c9['body'][_0xfe83('0x64')])){if(_0x1a82c9[_0xfe83('0x5a')][_0xfe83('0x64')][_0xfe83('0x3f')]){_0x1a82c9[_0xfe83('0x5a')][_0xfe83('0x64')]=_0x1a82c9['body'][_0xfe83('0x64')][_0xfe83('0x65')](';')+';';}else{_0x1a82c9[_0xfe83('0x5a')]['tags']=null;}}else{_0x1a82c9[_0xfe83('0x5a')][_0xfe83('0x64')]=null;}if(_0x1a82c9[_0xfe83('0x5a')]&&_[_0xfe83('0x66')](_0x1a82c9[_0xfe83('0x5a')])){for(var _0x2dd82c=0x0;_0x2dd82c<_0x1a82c9[_0xfe83('0x5a')][_0xfe83('0x3f')];_0x2dd82c+=0x1){_0x1a82c9[_0xfe83('0x5a')][_0x2dd82c][_0xfe83('0x67')]=_0x1a82c9[_0xfe83('0x4e')]['id'];_0xd44a53[_0xfe83('0x68')](_0x1a82c9[_0xfe83('0x5a')][_0x2dd82c]);}return BPromise['each'](_0xd44a53,function(_0x16ac80){return db[_0xfe83('0x63')]['create'](_[_0xfe83('0x69')](_0x16ac80,[_0xfe83('0x6a'),'id'])||{},{'fields':_['keys'](_0x4199b8),'raw':!![]})[_0xfe83('0x2a')](function(_0x2e6354){_0xa33fac[_0xfe83('0x6b')][_0xfe83('0x68')](_0x2e6354[_0xfe83('0x6c')]);})['catch'](function(_0x399fd5){_0xa33fac[_0xfe83('0x6d')][_0xfe83('0x68')]({'data':_0x16ac80,'error':_0x399fd5[_0xfe83('0x6e')]});});})[_0xfe83('0x2a')](function(_0x2f488b){return _0xa33fac;})[_0xfe83('0x4c')](function(_0x594e3e){return _0x594e3e;});}else{_0x496bfa['status'](0x190)[_0xfe83('0x22')]({'message':_0xfe83('0x6f')});}});}})[_0xfe83('0x2a')](respondWithResult(_0x496bfa,null))[_0xfe83('0x4c')](handleError(_0x496bfa,null));};exports[_0xfe83('0x70')]=function(_0x1e5977,_0x58efc6,_0x4111d5){var _0x28b949;return db[_0xfe83('0x4f')][_0xfe83('0x5b')]({'where':{'id':_0x1e5977[_0xfe83('0x4e')]['id']},'include':[{'model':db[_0xfe83('0x71')],'as':'CustomFields'}]})[_0xfe83('0x2a')](handleEntityNotFound(_0x58efc6,null))[_0xfe83('0x2a')](function(_0x501908){if(_0x501908){_0x28b949=_0x501908;return db[_0xfe83('0x63')][_0xfe83('0x50')];}})['then'](function(_0x482e6){if(_0x482e6){var _0x3f0492={};var _0xed5a75={};_0xed5a75['model']=_[_0xfe83('0x72')](_['keys'](_0x482e6),_['map'](_0x28b949[_0xfe83('0x73')],function(_0x226bfd){return util[_0xfe83('0x74')](_0xfe83('0x75'),_0x226bfd['id']);}));_0xed5a75[_0xfe83('0x39')]=_['keys'](_0x1e5977[_0xfe83('0x39')]);_0xed5a75[_0xfe83('0x3a')]=_[_0xfe83('0x3b')](_0xed5a75[_0xfe83('0x3c')],_0xed5a75[_0xfe83('0x39')]);_0x3f0492['attributes']=_[_0xfe83('0x3b')](_0xed5a75[_0xfe83('0x3c')],qs['fields'](_0x1e5977[_0xfe83('0x39')][_0xfe83('0x3e')]));_0x3f0492[_0xfe83('0x3d')]=_0x3f0492[_0xfe83('0x3d')][_0xfe83('0x3f')]?_0x3f0492[_0xfe83('0x3d')]:_0xed5a75[_0xfe83('0x3c')];if(!_0x1e5977[_0xfe83('0x39')]['hasOwnProperty']('nolimit')){_0x3f0492[_0xfe83('0x25')]=qs[_0xfe83('0x25')](_0x1e5977['query']['limit']);_0x3f0492[_0xfe83('0x23')]=qs[_0xfe83('0x23')](_0x1e5977['query'][_0xfe83('0x23')]);}_0x3f0492[_0xfe83('0x41')]=qs[_0xfe83('0x42')](_0x1e5977[_0xfe83('0x39')][_0xfe83('0x42')]);_0x3f0492['where']=qs[_0xfe83('0x3a')](_[_0xfe83('0x43')](_0x1e5977['query'],_0xed5a75[_0xfe83('0x3a')]));_0x3f0492[_0xfe83('0x76')]=!![];if(_0x1e5977['query'][_0xfe83('0x44')]){_0x3f0492[_0xfe83('0x45')]=_[_0xfe83('0x47')](_0x3f0492[_0xfe83('0x45')],{'$or':_[_0xfe83('0x35')](_0x3f0492['attributes'],function(_0x9d1b72){var _0x17538f={};_0x17538f[_0x9d1b72]={'$like':'%'+_0x1e5977[_0xfe83('0x39')]['filter']+'%'};return _0x17538f;})});}_0x3f0492=_[_0xfe83('0x47')]({},_0x3f0492,_0x1e5977[_0xfe83('0x48')]);return _0x28b949[_0xfe83('0x70')](_0x3f0492);}})[_0xfe83('0x2a')](respondWithResult(_0x58efc6,null))['catch'](handleError(_0x58efc6,null));};exports[_0xfe83('0x77')]=function(_0x3dfeb3,_0x5f4540,_0x47f688){var _0x290a04;var _0xd966a5;var _0x224307;var _0x43f089=_0x3dfeb3[_0xfe83('0x4e')]['id'];csv_results=[];return db[_0xfe83('0x78')][_0xfe83('0x4a')]({'attributes':['id',_0xfe83('0x32')],'raw':!![],'order':[_0xfe83('0x79')]})[_0xfe83('0x2a')](function(_0xa1b775){_0x290a04=_0xa1b775;var _0x1c400b=_[_0xfe83('0x38')](db['CmContact'][_0xfe83('0x50')]);return db[_0xfe83('0x71')]['findAll']({'raw':!![],'attributes':['id',_0xfe83('0x7a')]})[_0xfe83('0x2a')](function(_0x2b568f){_0xd966a5=_0x2b568f;var _0xf5fc39=squel[_0xfe83('0x7b')]()['fields'](_0x1c400b)[_0xfe83('0x7c')](_0xfe83('0x7d'),'c')[_0xfe83('0x45')](_0xfe83('0x7e'),_0x43f089)[_0xfe83('0x45')](_0xfe83('0x7f'))[_0xfe83('0x80')]();for(var _0x308917=0x0;_0x308917<_0xd966a5[_0xfe83('0x3f')];_0x308917++){_0xf5fc39['field'](_0xfe83('0x81')+_0xd966a5[_0x308917]['id'],_0xfe83('0x82')+_0xd966a5[_0x308917]['alias']);}for(var _0x308917=0x0;_0x308917<_0x290a04[_0xfe83('0x3f')];_0x308917++){_0xf5fc39[_0xfe83('0x83')](squel[_0xfe83('0x7b')]()[_0xfe83('0x83')]('item')['from']('cm_contact_has_items')[_0xfe83('0x45')](_0xfe83('0x84'),_0x290a04[_0x308917]['id'])[_0xfe83('0x45')](_0xfe83('0x85')),'additionalPhone_'+_0x290a04[_0x308917][_0xfe83('0x32')]);_0xf5fc39[_0xfe83('0x83')](squel[_0xfe83('0x7b')]()[_0xfe83('0x83')](_0xfe83('0x86'))[_0xfe83('0x7c')]('cm_contact_has_items')[_0xfe83('0x45')](_0xfe83('0x84'),_0x290a04[_0x308917]['id'])[_0xfe83('0x45')](_0xfe83('0x85')),_0xfe83('0x87')+_0x290a04[_0x308917][_0xfe83('0x32')]);}var _0x4bc9ea=[];_0x4bc9ea[_0xfe83('0x68')](_0xf5fc39['toString']());BPromise[_0xfe83('0x88')](_0x4bc9ea,handleQuery)[_0xfe83('0x2a')](function(_0x4e3c9d){handleQuery(_0xf5fc39[_0xfe83('0x89')]());var _0x34fa86=csv_results[0x0];if(!_[_0xfe83('0x8a')](_0x34fa86)){var _0x2d1b62=toCsv(_0x34fa86);var _0x2ea773=Date[_0xfe83('0x8b')]();fs[_0xfe83('0x8c')](util[_0xfe83('0x74')]('/tmp/list_%d_%s.csv',_0x43f089,_0x2ea773),_0x2d1b62);_0x5f4540['setHeader'](_0xfe83('0x8d'),_0xfe83('0x8e')+util[_0xfe83('0x74')](_0xfe83('0x8f'),_0x43f089,_0x2ea773));_0x5f4540[_0xfe83('0x90')](_0xfe83('0x91'),_0xfe83('0x92'));return _0x5f4540['download'](util['format'](_0xfe83('0x93'),_0x43f089,_0x2ea773));}else{return _0x5f4540[_0xfe83('0x2f')](0xcc);}});});});};exports['addCustomField']=function(_0x12c3c5,_0x5babe7,_0x144444){var _0x2c0662;delete _0x12c3c5[_0xfe83('0x5a')]['id'];return db['CmList'][_0xfe83('0x5f')]({'where':{'id':_0x12c3c5[_0xfe83('0x4e')]['id']}})[_0xfe83('0x2a')](handleEntityNotFound(_0x5babe7,null))['then'](function(_0x48f3f2){if(_0x48f3f2){return db[_0xfe83('0x94')][_0xfe83('0x95')](function(_0x3b0563){return db[_0xfe83('0x71')][_0xfe83('0x52')](_0x12c3c5['body'],{'transaction':_0x3b0563})[_0xfe83('0x2a')](function(_0x11728e){_0x2c0662=_0x11728e;return _0x48f3f2['addCustomFields'](_0x11728e,{'transaction':_0x3b0563});})['then'](function(){var _0x23c131={'type':db[_0xfe83('0x96')][_0xfe83('0x97')],'transaction':_0x3b0563};switch(_0x12c3c5[_0xfe83('0x5a')]['type']){case'text':_0x23c131['type']=db[_0xfe83('0x96')][_0xfe83('0x97')];break;case'number':_0x23c131[_0xfe83('0x37')]=db[_0xfe83('0x96')][_0xfe83('0x98')];break;case _0xfe83('0x99'):_0x23c131[_0xfe83('0x37')]=db[_0xfe83('0x96')][_0xfe83('0x9a')];_0x23c131[_0xfe83('0x9b')]=![];break;default:}return db[_0xfe83('0x94')][_0xfe83('0x9c')][_0xfe83('0x9d')](_0xfe83('0x7d'),util[_0xfe83('0x74')](_0xfe83('0x9e'),_0x2c0662['id']),_0x23c131);})[_0xfe83('0x2a')](function(){return _0x2c0662;});});}})['then'](respondWithResult(_0x5babe7,null))[_0xfe83('0x4c')](handleError(_0x5babe7,null));};exports['getCustomFields']=function(_0x28cb76,_0x548525,_0x385cfc){var _0x11e397={};var _0xf28a39={};var _0x4a347e;var _0x179bcb;return db['CmList'][_0xfe83('0x5f')]({'where':{'id':_0x28cb76[_0xfe83('0x4e')]['id']}})[_0xfe83('0x2a')](handleEntityNotFound(_0x548525,null))[_0xfe83('0x2a')](function(_0x4823b7){if(_0x4823b7){_0x4a347e=_0x4823b7;_0xf28a39[_0xfe83('0x3c')]=_['keys'](db['CmCustomField']['rawAttributes']);_0xf28a39[_0xfe83('0x39')]=_[_0xfe83('0x38')](_0x28cb76[_0xfe83('0x39')]);_0xf28a39['filters']=_[_0xfe83('0x3b')](_0xf28a39[_0xfe83('0x3c')],_0xf28a39[_0xfe83('0x39')]);_0x11e397[_0xfe83('0x3d')]=_[_0xfe83('0x3b')](_0xf28a39[_0xfe83('0x3c')],qs[_0xfe83('0x3e')](_0x28cb76[_0xfe83('0x39')]['fields']));_0x11e397[_0xfe83('0x3d')]=_0x11e397[_0xfe83('0x3d')]['length']?_0x11e397[_0xfe83('0x3d')]:_0xf28a39[_0xfe83('0x3c')];_0x11e397['order']=qs['sort'](_0x28cb76['query'][_0xfe83('0x42')]);_0x11e397['where']=qs['filters'](_['pick'](_0x28cb76[_0xfe83('0x39')],_0xf28a39[_0xfe83('0x3a')]));_0x11e397['where']=_[_0xfe83('0x47')](_0x11e397[_0xfe83('0x45')],{'$or':[{'ListId':_0x4823b7['id']},{'ListId':null}]});if(_0x28cb76[_0xfe83('0x39')][_0xfe83('0x44')]){_0x11e397[_0xfe83('0x45')]=_[_0xfe83('0x47')](_0x11e397[_0xfe83('0x45')],{'$or':_[_0xfe83('0x35')](_0x11e397['attributes'],function(_0x203f37){var _0x506254={};_0x506254[_0x203f37]={'$like':'%'+_0x28cb76[_0xfe83('0x39')]['filter']+'%'};return _0x506254;})});}_0x11e397=_['merge']({},_0x11e397,_0x28cb76[_0xfe83('0x48')]);return db[_0xfe83('0x71')][_0xfe83('0x9f')](_0x11e397);}})[_0xfe83('0x2a')](respondWithResult(_0x548525,null))[_0xfe83('0x4c')](handleError(_0x548525,null));};exports['getGlobalCustomFields']=function(_0x1d1b7f,_0x591c86){return db[_0xfe83('0x71')][_0xfe83('0x9f')]({'where':{'ListId':null}})[_0xfe83('0x2a')](handleEntityNotFound(_0x591c86,null))['then'](function(_0x2c16d8){return _0x2c16d8;})['then'](respondWithResult(_0x591c86,null))['catch'](handleError(_0x591c86,null));};exports['addAgents']=function(_0x153fc8,_0x40f114,_0x515c49){return db[_0xfe83('0x4f')][_0xfe83('0x5b')]({'where':{'id':_0x153fc8[_0xfe83('0x4e')]['id']}})['then'](handleEntityNotFound(_0x40f114,null))['then'](function(_0x2cb06e){if(_0x2cb06e){return _0x2cb06e['addAgents'](_0x153fc8[_0xfe83('0x5a')][_0xfe83('0x6a')],_[_0xfe83('0x69')](_0x153fc8[_0xfe83('0x5a')],[_0xfe83('0x6a'),'id'])||{})[_0xfe83('0xa0')](function(_0x7ba4f4){for(var _0x4f10d4=0x0;_0x4f10d4<_0x153fc8[_0xfe83('0x5a')][_0xfe83('0x6a')][_0xfe83('0x3f')];_0x4f10d4+=0x1){socket[_0xfe83('0xa1')](_0xfe83('0xa2'),{'UserId':Number(_0x153fc8[_0xfe83('0x5a')][_0xfe83('0x6a')][_0x4f10d4]),'CmListId':Number(_0x153fc8[_0xfe83('0x4e')]['id'])});}return _0x7ba4f4;});}})[_0xfe83('0x2a')](respondWithResult(_0x40f114,null))['catch'](handleError(_0x40f114,null));};exports['removeAgents']=function(_0x3e41c1,_0x1a21d3,_0x2c1962){return db[_0xfe83('0x4f')][_0xfe83('0x5b')]({'where':{'id':_0x3e41c1[_0xfe83('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1a21d3,null))[_0xfe83('0x2a')](function(_0x4c88f8){if(_0x4c88f8){return _0x4c88f8[_0xfe83('0xa3')](_0x3e41c1[_0xfe83('0x39')][_0xfe83('0x6a')])[_0xfe83('0x2a')](function(){if(_[_0xfe83('0x66')](_0x3e41c1[_0xfe83('0x39')][_0xfe83('0x6a')])){for(var _0x5c5971=0x0;_0x5c5971<_0x3e41c1[_0xfe83('0x39')][_0xfe83('0x6a')][_0xfe83('0x3f')];_0x5c5971+=0x1){socket['emit'](_0xfe83('0xa4'),{'UserId':Number(_0x3e41c1['query']['ids'][_0x5c5971]),'CmListId':Number(_0x3e41c1['params']['id'])});}}else{socket['emit']('userCmList:remove',{'UserId':Number(_0x3e41c1[_0xfe83('0x39')][_0xfe83('0x6a')]),'CmListId':Number(_0x3e41c1[_0xfe83('0x4e')]['id'])});}});}})['then'](respondWithStatusCode(_0x1a21d3,null))[_0xfe83('0x4c')](handleError(_0x1a21d3,null));};exports[_0xfe83('0xa5')]=function(_0x13076d,_0x35df94,_0x314244){var _0x1cbb8f={};var _0x2d198d={};var _0x56b813;var _0x41ba5c;return db[_0xfe83('0x4f')][_0xfe83('0x5f')]({'where':{'id':_0x13076d[_0xfe83('0x4e')]['id']}})[_0xfe83('0x2a')](handleEntityNotFound(_0x35df94,null))['then'](function(_0x3a53c1){if(_0x3a53c1){_0x56b813=_0x3a53c1;_0x2d198d[_0xfe83('0x3c')]=_[_0xfe83('0x38')](db[_0xfe83('0xa6')]['rawAttributes']);_0x2d198d[_0xfe83('0x39')]=_[_0xfe83('0x38')](_0x13076d['query']);_0x2d198d['filters']=_['intersection'](_0x2d198d[_0xfe83('0x3c')],_0x2d198d[_0xfe83('0x39')]);_0x1cbb8f[_0xfe83('0x3d')]=_['intersection'](_0x2d198d[_0xfe83('0x3c')],qs[_0xfe83('0x3e')](_0x13076d[_0xfe83('0x39')][_0xfe83('0x3e')]));_0x1cbb8f[_0xfe83('0x3d')]=_0x1cbb8f[_0xfe83('0x3d')][_0xfe83('0x3f')]?_0x1cbb8f[_0xfe83('0x3d')]:_0x2d198d['model'];_0x1cbb8f[_0xfe83('0x41')]=qs[_0xfe83('0x42')](_0x13076d[_0xfe83('0x39')][_0xfe83('0x42')]);_0x1cbb8f[_0xfe83('0x45')]=qs[_0xfe83('0x3a')](_[_0xfe83('0x43')](_0x13076d[_0xfe83('0x39')],_0x2d198d[_0xfe83('0x3a')]));if(_0x13076d[_0xfe83('0x39')]['filter']){_0x1cbb8f[_0xfe83('0x45')]=_['merge'](_0x1cbb8f[_0xfe83('0x45')],{'$or':_[_0xfe83('0x35')](_0x1cbb8f[_0xfe83('0x3d')],function(_0x39e414){var _0x571251={};_0x571251[_0x39e414]={'$like':'%'+_0x13076d[_0xfe83('0x39')][_0xfe83('0x44')]+'%'};return _0x571251;})});}_0x1cbb8f=_[_0xfe83('0x47')]({},_0x1cbb8f,_0x13076d[_0xfe83('0x48')]);return _0x56b813[_0xfe83('0xa5')](_0x1cbb8f);}})['then'](function(_0x27fc32){if(_0x27fc32){_0x41ba5c=_0x27fc32[_0xfe83('0x3f')];if(!_0x13076d[_0xfe83('0x39')][_0xfe83('0x40')](_0xfe83('0x60'))){_0x1cbb8f[_0xfe83('0x25')]=qs[_0xfe83('0x25')](_0x13076d[_0xfe83('0x39')][_0xfe83('0x25')]);_0x1cbb8f['offset']=qs[_0xfe83('0x23')](_0x13076d[_0xfe83('0x39')][_0xfe83('0x23')]);}return _0x56b813[_0xfe83('0xa5')](_0x1cbb8f);}})[_0xfe83('0x2a')](function(_0x23ceca){if(_0x23ceca){return _0x23ceca?{'count':_0x41ba5c,'rows':_0x23ceca}:null;}})['then'](respondWithResult(_0x35df94,null))[_0xfe83('0x4c')](handleError(_0x35df94,null));};function handleQuery(_0x3aa42f){logger['info'](_0x3aa42f);return db['sequelize'][_0xfe83('0x39')](_0x3aa42f)[_0xfe83('0xa0')](function(_0x3c8ad9){csv_results[_0xfe83('0x68')](_0x3c8ad9);})[_0xfe83('0x4c')](function(_0xa01131){logger[_0xfe83('0x30')](_0xa01131[_0xfe83('0x6e')]);});} \ No newline at end of file +var _0x7a05=['each','omit','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','format','cf_%d','raw','getContactsCsv','ContactItemType','findAll','alias','select','from','cm_contacts','c.ListId\x20=\x20?','distinct','field','item','cm_contact_has_items','additionalPhone_','description','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','description_additionalPhone_','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','text','TEXT','INTEGER','switch','queryInterface','cf_%s','findOne','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','info','error','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','then','get','UserProfileResource','end','stack','name','send','index','map','CmList','fieldName','type','key','filters','intersection','model','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','rows','params','keys','include','find','catch','create','body','user','role','Lists','UserProfileSection','userProfileId','autoAssociation','addDisposition','ListId','Disposition','getDispositions','rawAttributes','removeDispositions','ids','CmContact','describe','tags','isArray','join','push'];(function(_0x2ffbcc,_0x65959){var _0x32be9e=function(_0x226b78){while(--_0x226b78){_0x2ffbcc['push'](_0x2ffbcc['shift']());}};_0x32be9e(++_0x65959);}(_0x7a05,0xdc));var _0x57a0=function(_0x45fa35,_0x315a10){_0x45fa35=_0x45fa35-0x0;var _0x4f6dad=_0x7a05[_0x45fa35];return _0x4f6dad;};'use strict';var emlformat=require(_0x57a0('0x0'));var rimraf=require(_0x57a0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x57a0('0x2'));var rp=require(_0x57a0('0x3'));var moment=require(_0x57a0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x57a0('0x5'));var util=require(_0x57a0('0x6'));var path=require(_0x57a0('0x7'));var sox=require(_0x57a0('0x8'));var csv=require(_0x57a0('0x9'));var ejs=require(_0x57a0('0xa'));var fs=require('fs');var fs_extra=require(_0x57a0('0xb'));var _=require(_0x57a0('0xc'));var squel=require(_0x57a0('0xd'));var crypto=require(_0x57a0('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x57a0('0xf'));var toCsv=require(_0x57a0('0x9'));var querystring=require(_0x57a0('0x10'));var Papa=require(_0x57a0('0x11'));var Redis=require(_0x57a0('0x12'));var authService=require(_0x57a0('0x13'));var qs=require(_0x57a0('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x57a0('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x57a0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x57a0('0x17'));var db=require(_0x57a0('0x18'))['db'];var csv_results;config[_0x57a0('0x19')]=_[_0x57a0('0x1a')](config['redis'],{'host':_0x57a0('0x1b'),'port':0x18eb});var socket=require(_0x57a0('0x1c'))(new Redis(config[_0x57a0('0x19')]));require('./cmList.socket')[_0x57a0('0x1d')](socket);function respondWithStatusCode(_0x3bd03b,_0x7d39ce){_0x7d39ce=_0x7d39ce||0xcc;return function(_0x62a088){if(_0x62a088){return _0x3bd03b[_0x57a0('0x1e')](_0x7d39ce);}return _0x3bd03b[_0x57a0('0x1f')](_0x7d39ce)['end']();};}function respondWithResult(_0x5d8329,_0xdf0827){_0xdf0827=_0xdf0827||0xc8;return function(_0x15473a){if(_0x15473a){return _0x5d8329['status'](_0xdf0827)[_0x57a0('0x20')](_0x15473a);}};}function respondWithFilteredResult(_0x4fba3d,_0x32814c){return function(_0x5bda2e){if(_0x5bda2e){var _0x38f49b=typeof _0x32814c[_0x57a0('0x21')]===_0x57a0('0x22')&&typeof _0x32814c[_0x57a0('0x23')]===_0x57a0('0x22');var _0x449f4a=_0x5bda2e[_0x57a0('0x24')];var _0x3f58cd=_0x38f49b?0x0:_0x32814c[_0x57a0('0x21')];var _0x2e9247=_0x38f49b?_0x5bda2e['count']:_0x32814c['offset']+_0x32814c[_0x57a0('0x23')];var _0x5ca2b0;if(_0x2e9247>=_0x449f4a){_0x2e9247=_0x449f4a;_0x5ca2b0=0xc8;}else{_0x5ca2b0=0xce;}_0x4fba3d[_0x57a0('0x1f')](_0x5ca2b0);return _0x4fba3d[_0x57a0('0x25')](_0x57a0('0x26'),_0x3f58cd+'-'+_0x2e9247+'/'+_0x449f4a)[_0x57a0('0x20')](_0x5bda2e);}return null;};}function patchUpdates(_0x143025){return function(_0x2c4598){try{jsonpatch[_0x57a0('0x27')](_0x2c4598,_0x143025,!![]);}catch(_0x5a82d9){return BPromise[_0x57a0('0x28')](_0x5a82d9);}return _0x2c4598['save']();};}function saveUpdates(_0x294128,_0x3fb172){return function(_0x9c99bf){if(_0x9c99bf){return _0x9c99bf['update'](_0x294128)['then'](function(_0x4bd865){return _0x4bd865;});}return null;};}function removeEntity(_0x4ed9db,_0x232501){return function(_0x50d312){if(_0x50d312){return _0x50d312[_0x57a0('0x29')]()[_0x57a0('0x2a')](function(){var _0x3fd2b5=_0x50d312[_0x57a0('0x2b')]({'plain':!![]});var _0xf716f='Lists';return db[_0x57a0('0x2c')][_0x57a0('0x29')]({'where':{'type':_0xf716f,'resourceId':_0x3fd2b5['id']}})['then'](function(){return _0x50d312;});})[_0x57a0('0x2a')](function(){_0x4ed9db[_0x57a0('0x1f')](0xcc)[_0x57a0('0x2d')]();});}};}function handleEntityNotFound(_0x4a0676,_0x5e6228){return function(_0x3fb567){if(!_0x3fb567){_0x4a0676['sendStatus'](0x194);}return _0x3fb567;};}function handleError(_0xf438e8,_0x1e23ad){_0x1e23ad=_0x1e23ad||0x1f4;return function(_0x4cfbf4){logger['error'](_0x4cfbf4[_0x57a0('0x2e')]);if(_0x4cfbf4[_0x57a0('0x2f')]){delete _0x4cfbf4[_0x57a0('0x2f')];}_0xf438e8[_0x57a0('0x1f')](_0x1e23ad)[_0x57a0('0x30')](_0x4cfbf4);};}exports[_0x57a0('0x31')]=function(_0x57aab2,_0x3a789f){var _0x1fea9c={},_0xed9923={},_0x56148c={'count':0x0,'rows':[]};var _0x1476f3=_[_0x57a0('0x32')](db[_0x57a0('0x33')]['rawAttributes'],function(_0x2ef1b9){return{'name':_0x2ef1b9[_0x57a0('0x34')],'type':_0x2ef1b9[_0x57a0('0x35')][_0x57a0('0x36')]};});_0xed9923['model']=_[_0x57a0('0x32')](_0x1476f3,_0x57a0('0x2f'));_0xed9923['query']=_['keys'](_0x57aab2['query']);_0xed9923[_0x57a0('0x37')]=_[_0x57a0('0x38')](_0xed9923[_0x57a0('0x39')],_0xed9923[_0x57a0('0x3a')]);_0x1fea9c['attributes']=_[_0x57a0('0x38')](_0xed9923[_0x57a0('0x39')],qs[_0x57a0('0x3b')](_0x57aab2['query'][_0x57a0('0x3b')]));_0x1fea9c['attributes']=_0x1fea9c[_0x57a0('0x3c')][_0x57a0('0x3d')]?_0x1fea9c['attributes']:_0xed9923['model'];if(!_0x57aab2[_0x57a0('0x3a')][_0x57a0('0x3e')](_0x57a0('0x3f'))){_0x1fea9c['limit']=qs['limit'](_0x57aab2['query'][_0x57a0('0x23')]);_0x1fea9c['offset']=qs[_0x57a0('0x21')](_0x57aab2[_0x57a0('0x3a')]['offset']);}_0x1fea9c[_0x57a0('0x40')]=qs[_0x57a0('0x41')](_0x57aab2[_0x57a0('0x3a')]['sort']);_0x1fea9c[_0x57a0('0x42')]=qs[_0x57a0('0x37')](_[_0x57a0('0x43')](_0x57aab2['query'],_0xed9923[_0x57a0('0x37')]),_0x1476f3);if(_0x57aab2[_0x57a0('0x3a')][_0x57a0('0x44')]){_0x1fea9c[_0x57a0('0x42')]=_['merge'](_0x1fea9c[_0x57a0('0x42')],{'$or':_[_0x57a0('0x32')](_0x1476f3,function(_0x417a5e){if(_0x417a5e[_0x57a0('0x35')]!==_0x57a0('0x45')){var _0x63f2a1={};_0x63f2a1[_0x417a5e[_0x57a0('0x2f')]]={'$like':'%'+_0x57aab2[_0x57a0('0x3a')][_0x57a0('0x44')]+'%'};return _0x63f2a1;}})});}_0x1fea9c=_[_0x57a0('0x46')]({},_0x1fea9c,_0x57aab2[_0x57a0('0x47')]);var _0x156f2d={'where':_0x1fea9c[_0x57a0('0x42')]};return db[_0x57a0('0x33')]['count'](_0x156f2d)['then'](function(_0x32eaa4){_0x56148c[_0x57a0('0x24')]=_0x32eaa4;if(_0x57aab2['query'][_0x57a0('0x48')]){_0x1fea9c['include']=[{'all':!![]}];}return db['CmList']['findAll'](_0x1fea9c);})['then'](function(_0xa90c){_0x56148c[_0x57a0('0x49')]=_0xa90c;return _0x56148c;})[_0x57a0('0x2a')](respondWithFilteredResult(_0x3a789f,_0x1fea9c))['catch'](handleError(_0x3a789f,null));};exports['show']=function(_0x52a332,_0x2385bd){var _0x34be71={'raw':![],'where':{'id':_0x52a332[_0x57a0('0x4a')]['id']}},_0xde01e7={};_0xde01e7['model']=_[_0x57a0('0x4b')](db['CmList']['rawAttributes']);_0xde01e7[_0x57a0('0x3a')]=_[_0x57a0('0x4b')](_0x52a332[_0x57a0('0x3a')]);_0xde01e7[_0x57a0('0x37')]=_[_0x57a0('0x38')](_0xde01e7['model'],_0xde01e7['query']);_0x34be71[_0x57a0('0x3c')]=_['intersection'](_0xde01e7[_0x57a0('0x39')],qs[_0x57a0('0x3b')](_0x52a332[_0x57a0('0x3a')]['fields']));_0x34be71[_0x57a0('0x3c')]=_0x34be71[_0x57a0('0x3c')][_0x57a0('0x3d')]?_0x34be71[_0x57a0('0x3c')]:_0xde01e7[_0x57a0('0x39')];if(_0x52a332[_0x57a0('0x3a')][_0x57a0('0x48')]){_0x34be71[_0x57a0('0x4c')]=[{'all':!![]}];}_0x34be71=_['merge']({},_0x34be71,_0x52a332[_0x57a0('0x47')]);return db['CmList'][_0x57a0('0x4d')](_0x34be71)[_0x57a0('0x2a')](handleEntityNotFound(_0x2385bd,null))['then'](respondWithResult(_0x2385bd,null))[_0x57a0('0x4e')](handleError(_0x2385bd,null));};exports[_0x57a0('0x4f')]=function(_0x50d17f,_0x4bd6ad){return db[_0x57a0('0x33')][_0x57a0('0x4f')](_0x50d17f[_0x57a0('0x50')],{})[_0x57a0('0x2a')](function(_0x54fdaa){var _0x59b234=_0x50d17f[_0x57a0('0x51')]['get']({'plain':!![]});if(!_0x59b234)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x59b234[_0x57a0('0x52')]===_0x57a0('0x51')){var _0x2efb5b=_0x54fdaa[_0x57a0('0x2b')]({'plain':!![]});var _0x3515f7=_0x57a0('0x53');return db[_0x57a0('0x54')][_0x57a0('0x4d')]({'where':{'name':_0x3515f7,'userProfileId':_0x59b234[_0x57a0('0x55')]},'raw':!![]})[_0x57a0('0x2a')](function(_0x353d48){if(_0x353d48&&_0x353d48[_0x57a0('0x56')]===0x0){return db[_0x57a0('0x2c')]['create']({'name':_0x2efb5b['name'],'resourceId':_0x2efb5b['id'],'type':_0x353d48[_0x57a0('0x2f')],'sectionId':_0x353d48['id']},{})[_0x57a0('0x2a')](function(){return _0x54fdaa;});}else{return _0x54fdaa;}})[_0x57a0('0x4e')](function(_0x178225){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x178225);throw _0x178225;});}return _0x54fdaa;})[_0x57a0('0x2a')](respondWithResult(_0x4bd6ad,0xc9))[_0x57a0('0x4e')](handleError(_0x4bd6ad,null));};exports['update']=function(_0x2c809e,_0x3d0f6d){if(_0x2c809e['body']['id']){delete _0x2c809e['body']['id'];}return db[_0x57a0('0x33')]['find']({'where':{'id':_0x2c809e['params']['id']}})[_0x57a0('0x2a')](handleEntityNotFound(_0x3d0f6d,null))[_0x57a0('0x2a')](saveUpdates(_0x2c809e[_0x57a0('0x50')],null))[_0x57a0('0x2a')](respondWithResult(_0x3d0f6d,null))['catch'](handleError(_0x3d0f6d,null));};exports[_0x57a0('0x29')]=function(_0xdbcfa8,_0x22ab88){return db['CmList'][_0x57a0('0x4d')]({'where':{'id':_0xdbcfa8['params']['id']}})[_0x57a0('0x2a')](handleEntityNotFound(_0x22ab88,null))[_0x57a0('0x2a')](removeEntity(_0x22ab88,null))[_0x57a0('0x4e')](handleError(_0x22ab88,null));};exports['describe']=function(_0xb8c592,_0xf5fe35){return db[_0x57a0('0x33')]['describe']()['then'](respondWithResult(_0xf5fe35,null))[_0x57a0('0x4e')](handleError(_0xf5fe35,null));};exports[_0x57a0('0x57')]=function(_0x2017fc,_0x2296f9,_0x1e838c){if(_0x2017fc[_0x57a0('0x50')]['id']){delete _0x2017fc[_0x57a0('0x50')]['id'];}return db[_0x57a0('0x33')][_0x57a0('0x4d')]({'where':{'id':_0x2017fc[_0x57a0('0x4a')]['id']}})[_0x57a0('0x2a')](handleEntityNotFound(_0x2296f9,null))[_0x57a0('0x2a')](function(_0x844489){if(_0x844489){_0x2017fc['body'][_0x57a0('0x58')]=_0x844489['id'];return db[_0x57a0('0x59')]['create'](_0x2017fc[_0x57a0('0x50')]);}})[_0x57a0('0x2a')](respondWithResult(_0x2296f9,null))[_0x57a0('0x4e')](handleError(_0x2296f9,null));};exports[_0x57a0('0x5a')]=function(_0x5cb88f,_0x3da552,_0x5cd8b6){var _0x5ba08f={'raw':![],'where':{}};var _0xa0614={};var _0x2429e5={'count':0x0,'rows':[]};return db['CmList']['findOne']({'where':{'id':_0x5cb88f[_0x57a0('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3da552,null))[_0x57a0('0x2a')](function(_0x5259da){if(_0x5259da){_0xa0614['model']=_[_0x57a0('0x4b')](db['Disposition'][_0x57a0('0x5b')]);_0xa0614[_0x57a0('0x3a')]=_[_0x57a0('0x4b')](_0x5cb88f[_0x57a0('0x3a')]);_0xa0614[_0x57a0('0x37')]=_[_0x57a0('0x38')](_0xa0614[_0x57a0('0x39')],_0xa0614['query']);_0x5ba08f[_0x57a0('0x3c')]=_['intersection'](_0xa0614[_0x57a0('0x39')],qs[_0x57a0('0x3b')](_0x5cb88f['query']['fields']));_0x5ba08f[_0x57a0('0x3c')]=_0x5ba08f[_0x57a0('0x3c')][_0x57a0('0x3d')]?_0x5ba08f[_0x57a0('0x3c')]:_0xa0614['model'];if(!_0x5cb88f['query']['hasOwnProperty'](_0x57a0('0x3f'))){_0x5ba08f[_0x57a0('0x23')]=qs[_0x57a0('0x23')](_0x5cb88f[_0x57a0('0x3a')][_0x57a0('0x23')]);_0x5ba08f['offset']=qs[_0x57a0('0x21')](_0x5cb88f[_0x57a0('0x3a')][_0x57a0('0x21')]);}_0x5ba08f[_0x57a0('0x40')]=qs['sort'](_0x5cb88f['query']['sort']);_0x5ba08f[_0x57a0('0x42')]=qs[_0x57a0('0x37')](_['pick'](_0x5cb88f[_0x57a0('0x3a')],_0xa0614['filters']));_0x5ba08f[_0x57a0('0x42')]['ListId']=_0x5259da['id'];if(_0x5cb88f[_0x57a0('0x3a')][_0x57a0('0x44')]){_0x5ba08f[_0x57a0('0x42')]=_[_0x57a0('0x46')](_0x5ba08f[_0x57a0('0x42')],{'$or':_['map'](_0x5ba08f[_0x57a0('0x3c')],function(_0x5018d6){var _0x1ace25={};_0x1ace25[_0x5018d6]={'$like':'%'+_0x5cb88f[_0x57a0('0x3a')][_0x57a0('0x44')]+'%'};return _0x1ace25;})});}_0x5ba08f=_[_0x57a0('0x46')]({},_0x5ba08f,_0x5cb88f[_0x57a0('0x47')]);return db[_0x57a0('0x59')][_0x57a0('0x24')]({'where':_0x5ba08f['where']})[_0x57a0('0x2a')](function(_0x5740ef){_0x2429e5[_0x57a0('0x24')]=_0x5740ef;if(_0x5cb88f[_0x57a0('0x3a')][_0x57a0('0x48')]){_0x5ba08f[_0x57a0('0x4c')]=[{'all':!![]}];}return db[_0x57a0('0x59')]['findAll'](_0x5ba08f);})['then'](function(_0xb94d02){_0x2429e5[_0x57a0('0x49')]=_0xb94d02;return _0x2429e5;});}})[_0x57a0('0x2a')](respondWithFilteredResult(_0x3da552,_0x5ba08f))[_0x57a0('0x4e')](handleError(_0x3da552,null));};exports['removeDispositions']=function(_0x49b9a9,_0x407187,_0x4c4975){return db['CmList'][_0x57a0('0x4d')]({'where':{'id':_0x49b9a9[_0x57a0('0x4a')]['id']}})[_0x57a0('0x2a')](handleEntityNotFound(_0x407187,null))[_0x57a0('0x2a')](function(_0x5bf138){if(_0x5bf138){return _0x5bf138[_0x57a0('0x5c')](_0x49b9a9['query'][_0x57a0('0x5d')]);}})[_0x57a0('0x2a')](respondWithStatusCode(_0x407187,null))['catch'](handleError(_0x407187,null));};exports['addContacts']=function(_0x38276b,_0x1e4aa3,_0x5b3f5f){return db[_0x57a0('0x33')]['find']({'where':{'id':_0x38276b['params']['id']}})[_0x57a0('0x2a')](handleEntityNotFound(_0x1e4aa3,null))[_0x57a0('0x2a')](function(_0x3b53a2){if(_0x3b53a2){var _0x1c7a02=[];var _0x49f3d3={'success':[],'errors':[]};return db[_0x57a0('0x5e')][_0x57a0('0x5f')]()[_0x57a0('0x2a')](function(_0x3ae198){if(_0x38276b[_0x57a0('0x50')][_0x57a0('0x60')]&&_[_0x57a0('0x61')](_0x38276b['body'][_0x57a0('0x60')])){if(_0x38276b[_0x57a0('0x50')][_0x57a0('0x60')][_0x57a0('0x3d')]){_0x38276b[_0x57a0('0x50')][_0x57a0('0x60')]=_0x38276b[_0x57a0('0x50')][_0x57a0('0x60')][_0x57a0('0x62')](';')+';';}else{_0x38276b[_0x57a0('0x50')][_0x57a0('0x60')]=null;}}else{_0x38276b[_0x57a0('0x50')][_0x57a0('0x60')]=null;}if(_0x38276b[_0x57a0('0x50')]&&_[_0x57a0('0x61')](_0x38276b['body'])){for(var _0x565133=0x0;_0x565133<_0x38276b[_0x57a0('0x50')][_0x57a0('0x3d')];_0x565133+=0x1){_0x38276b['body'][_0x565133]['ListId']=_0x38276b[_0x57a0('0x4a')]['id'];_0x1c7a02[_0x57a0('0x63')](_0x38276b[_0x57a0('0x50')][_0x565133]);}return BPromise[_0x57a0('0x64')](_0x1c7a02,function(_0x1f0c48){return db['CmContact'][_0x57a0('0x4f')](_[_0x57a0('0x65')](_0x1f0c48,[_0x57a0('0x5d'),'id'])||{},{'fields':_[_0x57a0('0x4b')](_0x3ae198),'raw':!![]})[_0x57a0('0x2a')](function(_0x5755e){_0x49f3d3['success'][_0x57a0('0x63')](_0x5755e[_0x57a0('0x66')]);})[_0x57a0('0x4e')](function(_0x23d66e){_0x49f3d3[_0x57a0('0x67')][_0x57a0('0x63')]({'data':_0x1f0c48,'error':_0x23d66e[_0x57a0('0x68')]});});})['then'](function(_0x439645){return _0x49f3d3;})[_0x57a0('0x4e')](function(_0x3f0cd0){return _0x3f0cd0;});}else{_0x1e4aa3[_0x57a0('0x1f')](0x190)[_0x57a0('0x20')]({'message':_0x57a0('0x69')});}});}})[_0x57a0('0x2a')](respondWithResult(_0x1e4aa3,null))[_0x57a0('0x4e')](handleError(_0x1e4aa3,null));};exports[_0x57a0('0x6a')]=function(_0x2e9576,_0x2786b5,_0x3e3aad){var _0xda2e76;return db[_0x57a0('0x33')][_0x57a0('0x4d')]({'where':{'id':_0x2e9576['params']['id']},'include':[{'model':db[_0x57a0('0x6b')],'as':_0x57a0('0x6c')}]})['then'](handleEntityNotFound(_0x2786b5,null))[_0x57a0('0x2a')](function(_0x3520c3){if(_0x3520c3){_0xda2e76=_0x3520c3;return db[_0x57a0('0x5e')][_0x57a0('0x5b')];}})['then'](function(_0x486db0){if(_0x486db0){var _0x490c1e={};var _0x323b47={};_0x323b47[_0x57a0('0x39')]=_['concat'](_[_0x57a0('0x4b')](_0x486db0),_[_0x57a0('0x32')](_0xda2e76['CustomFields'],function(_0x48fb40){return util[_0x57a0('0x6d')](_0x57a0('0x6e'),_0x48fb40['id']);}));_0x323b47[_0x57a0('0x3a')]=_[_0x57a0('0x4b')](_0x2e9576[_0x57a0('0x3a')]);_0x323b47[_0x57a0('0x37')]=_[_0x57a0('0x38')](_0x323b47[_0x57a0('0x39')],_0x323b47[_0x57a0('0x3a')]);_0x490c1e[_0x57a0('0x3c')]=_[_0x57a0('0x38')](_0x323b47[_0x57a0('0x39')],qs[_0x57a0('0x3b')](_0x2e9576[_0x57a0('0x3a')][_0x57a0('0x3b')]));_0x490c1e[_0x57a0('0x3c')]=_0x490c1e[_0x57a0('0x3c')][_0x57a0('0x3d')]?_0x490c1e[_0x57a0('0x3c')]:_0x323b47[_0x57a0('0x39')];if(!_0x2e9576[_0x57a0('0x3a')][_0x57a0('0x3e')](_0x57a0('0x3f'))){_0x490c1e[_0x57a0('0x23')]=qs['limit'](_0x2e9576[_0x57a0('0x3a')]['limit']);_0x490c1e[_0x57a0('0x21')]=qs['offset'](_0x2e9576['query'][_0x57a0('0x21')]);}_0x490c1e['order']=qs[_0x57a0('0x41')](_0x2e9576[_0x57a0('0x3a')][_0x57a0('0x41')]);_0x490c1e[_0x57a0('0x42')]=qs[_0x57a0('0x37')](_[_0x57a0('0x43')](_0x2e9576[_0x57a0('0x3a')],_0x323b47[_0x57a0('0x37')]));_0x490c1e[_0x57a0('0x6f')]=!![];if(_0x2e9576['query'][_0x57a0('0x44')]){_0x490c1e[_0x57a0('0x42')]=_[_0x57a0('0x46')](_0x490c1e['where'],{'$or':_[_0x57a0('0x32')](_0x490c1e[_0x57a0('0x3c')],function(_0x3aca1d){var _0xe6858a={};_0xe6858a[_0x3aca1d]={'$like':'%'+_0x2e9576[_0x57a0('0x3a')][_0x57a0('0x44')]+'%'};return _0xe6858a;})});}_0x490c1e=_[_0x57a0('0x46')]({},_0x490c1e,_0x2e9576[_0x57a0('0x47')]);return _0xda2e76[_0x57a0('0x6a')](_0x490c1e);}})[_0x57a0('0x2a')](respondWithResult(_0x2786b5,null))['catch'](handleError(_0x2786b5,null));};exports[_0x57a0('0x70')]=function(_0x1d2dc5,_0x28e65a,_0xf9612a){var _0x5b2155;var _0x315887;var _0x2dc807;var _0x29166b=_0x1d2dc5[_0x57a0('0x4a')]['id'];csv_results=[];return db[_0x57a0('0x71')][_0x57a0('0x72')]({'attributes':['id',_0x57a0('0x2f')],'raw':!![],'order':['OrderBy']})[_0x57a0('0x2a')](function(_0x23a792){_0x5b2155=_0x23a792;var _0x12fdf1=_['keys'](db[_0x57a0('0x5e')]['rawAttributes']);return db[_0x57a0('0x6b')]['findAll']({'raw':!![],'attributes':['id',_0x57a0('0x73')]})['then'](function(_0x167f1c){_0x315887=_0x167f1c;var _0x48866a=squel[_0x57a0('0x74')]()['fields'](_0x12fdf1)[_0x57a0('0x75')](_0x57a0('0x76'),'c')[_0x57a0('0x42')](_0x57a0('0x77'),_0x29166b)[_0x57a0('0x42')]('c.deletedAt\x20is\x20null')[_0x57a0('0x78')]();for(var _0xc418f1=0x0;_0xc418f1<_0x315887[_0x57a0('0x3d')];_0xc418f1++){_0x48866a['field']('c.cf_'+_0x315887[_0xc418f1]['id'],'customField_'+_0x315887[_0xc418f1][_0x57a0('0x73')]);}for(var _0xc418f1=0x0;_0xc418f1<_0x5b2155[_0x57a0('0x3d')];_0xc418f1++){_0x48866a[_0x57a0('0x79')](squel[_0x57a0('0x74')]()[_0x57a0('0x79')](_0x57a0('0x7a'))[_0x57a0('0x75')](_0x57a0('0x7b'))[_0x57a0('0x42')]('ItemTypeId\x20=\x20?',_0x5b2155[_0xc418f1]['id'])['where']('CmContactId\x20=\x20c.id'),_0x57a0('0x7c')+_0x5b2155[_0xc418f1][_0x57a0('0x2f')]);_0x48866a['field'](squel[_0x57a0('0x74')]()[_0x57a0('0x79')](_0x57a0('0x7d'))[_0x57a0('0x75')](_0x57a0('0x7b'))[_0x57a0('0x42')](_0x57a0('0x7e'),_0x5b2155[_0xc418f1]['id'])[_0x57a0('0x42')](_0x57a0('0x7f')),_0x57a0('0x80')+_0x5b2155[_0xc418f1][_0x57a0('0x2f')]);}var _0x4a2949=[];_0x4a2949[_0x57a0('0x63')](_0x48866a[_0x57a0('0x81')]());BPromise['each'](_0x4a2949,handleQuery)['then'](function(_0x4ddb98){handleQuery(_0x48866a[_0x57a0('0x81')]());var _0x1e9513=csv_results[0x0];if(!_[_0x57a0('0x82')](_0x1e9513)){var _0x30760d=toCsv(_0x1e9513);var _0x40bd74=Date[_0x57a0('0x83')]();fs[_0x57a0('0x84')](util['format'](_0x57a0('0x85'),_0x29166b,_0x40bd74),_0x30760d);_0x28e65a[_0x57a0('0x86')](_0x57a0('0x87'),'attachment;\x20filename='+util[_0x57a0('0x6d')]('list_%d_%s.csv',_0x29166b,_0x40bd74));_0x28e65a[_0x57a0('0x86')]('Content-type','text/csv');return _0x28e65a[_0x57a0('0x88')](util[_0x57a0('0x6d')]('/tmp/list_%d_%s.csv',_0x29166b,_0x40bd74));}else{return _0x28e65a[_0x57a0('0x1e')](0xcc);}});});});};exports[_0x57a0('0x89')]=function(_0x4bb321,_0x37356f,_0x19a691){var _0x4931db;delete _0x4bb321[_0x57a0('0x50')]['id'];return db['CmList']['findOne']({'where':{'id':_0x4bb321[_0x57a0('0x4a')]['id']}})[_0x57a0('0x2a')](handleEntityNotFound(_0x37356f,null))[_0x57a0('0x2a')](function(_0x71f78){if(_0x71f78){return db[_0x57a0('0x8a')][_0x57a0('0x8b')](function(_0x46817b){return db[_0x57a0('0x6b')]['create'](_0x4bb321[_0x57a0('0x50')],{'transaction':_0x46817b})['then'](function(_0x5c6ba4){_0x4931db=_0x5c6ba4;return _0x71f78[_0x57a0('0x8c')](_0x5c6ba4,{'transaction':_0x46817b});})[_0x57a0('0x2a')](function(){var _0x379255={'type':db[_0x57a0('0x8d')]['TEXT'],'transaction':_0x46817b};switch(_0x4bb321[_0x57a0('0x50')][_0x57a0('0x35')]){case _0x57a0('0x8e'):_0x379255[_0x57a0('0x35')]=db[_0x57a0('0x8d')][_0x57a0('0x8f')];break;case'number':_0x379255[_0x57a0('0x35')]=db[_0x57a0('0x8d')][_0x57a0('0x90')];break;case _0x57a0('0x91'):_0x379255[_0x57a0('0x35')]=db[_0x57a0('0x8d')]['BOOLEAN'];_0x379255['defaultValue']=![];break;default:}return db['sequelize'][_0x57a0('0x92')]['addColumn'](_0x57a0('0x76'),util[_0x57a0('0x6d')](_0x57a0('0x93'),_0x4931db['id']),_0x379255);})[_0x57a0('0x2a')](function(){return _0x4931db;});});}})[_0x57a0('0x2a')](respondWithResult(_0x37356f,null))['catch'](handleError(_0x37356f,null));};exports['getCustomFields']=function(_0x21d655,_0x1d1e86,_0x4625cc){var _0x4344c3={};var _0x3e3e8a={};var _0x2353fa;var _0x4fe11e;return db['CmList'][_0x57a0('0x94')]({'where':{'id':_0x21d655['params']['id']}})[_0x57a0('0x2a')](handleEntityNotFound(_0x1d1e86,null))[_0x57a0('0x2a')](function(_0x241a6b){if(_0x241a6b){_0x2353fa=_0x241a6b;_0x3e3e8a[_0x57a0('0x39')]=_[_0x57a0('0x4b')](db[_0x57a0('0x6b')][_0x57a0('0x5b')]);_0x3e3e8a[_0x57a0('0x3a')]=_[_0x57a0('0x4b')](_0x21d655[_0x57a0('0x3a')]);_0x3e3e8a[_0x57a0('0x37')]=_[_0x57a0('0x38')](_0x3e3e8a['model'],_0x3e3e8a['query']);_0x4344c3[_0x57a0('0x3c')]=_[_0x57a0('0x38')](_0x3e3e8a[_0x57a0('0x39')],qs[_0x57a0('0x3b')](_0x21d655['query'][_0x57a0('0x3b')]));_0x4344c3[_0x57a0('0x3c')]=_0x4344c3[_0x57a0('0x3c')][_0x57a0('0x3d')]?_0x4344c3[_0x57a0('0x3c')]:_0x3e3e8a[_0x57a0('0x39')];_0x4344c3[_0x57a0('0x40')]=qs[_0x57a0('0x41')](_0x21d655[_0x57a0('0x3a')][_0x57a0('0x41')]);_0x4344c3[_0x57a0('0x42')]=qs[_0x57a0('0x37')](_['pick'](_0x21d655[_0x57a0('0x3a')],_0x3e3e8a[_0x57a0('0x37')]));_0x4344c3['where']=_[_0x57a0('0x46')](_0x4344c3[_0x57a0('0x42')],{'$or':[{'ListId':_0x241a6b['id']},{'ListId':null}]});if(_0x21d655[_0x57a0('0x3a')][_0x57a0('0x44')]){_0x4344c3[_0x57a0('0x42')]=_['merge'](_0x4344c3[_0x57a0('0x42')],{'$or':_[_0x57a0('0x32')](_0x4344c3[_0x57a0('0x3c')],function(_0xe59cc1){var _0xf61e79={};_0xf61e79[_0xe59cc1]={'$like':'%'+_0x21d655[_0x57a0('0x3a')][_0x57a0('0x44')]+'%'};return _0xf61e79;})});}_0x4344c3=_['merge']({},_0x4344c3,_0x21d655[_0x57a0('0x47')]);return db[_0x57a0('0x6b')][_0x57a0('0x95')](_0x4344c3);}})[_0x57a0('0x2a')](respondWithResult(_0x1d1e86,null))[_0x57a0('0x4e')](handleError(_0x1d1e86,null));};exports[_0x57a0('0x96')]=function(_0x5a6937,_0x2c73eb){return db[_0x57a0('0x6b')]['findAndCountAll']({'where':{'ListId':null}})[_0x57a0('0x2a')](handleEntityNotFound(_0x2c73eb,null))['then'](function(_0xaed72b){return _0xaed72b;})[_0x57a0('0x2a')](respondWithResult(_0x2c73eb,null))['catch'](handleError(_0x2c73eb,null));};exports[_0x57a0('0x97')]=function(_0x6266f5,_0x4af89d,_0x3de896){return db[_0x57a0('0x33')][_0x57a0('0x4d')]({'where':{'id':_0x6266f5['params']['id']}})[_0x57a0('0x2a')](handleEntityNotFound(_0x4af89d,null))[_0x57a0('0x2a')](function(_0xcedd29){if(_0xcedd29){return _0xcedd29[_0x57a0('0x97')](_0x6266f5[_0x57a0('0x50')][_0x57a0('0x5d')],_[_0x57a0('0x65')](_0x6266f5['body'],[_0x57a0('0x5d'),'id'])||{})[_0x57a0('0x98')](function(_0x299085){for(var _0x82ec48=0x0;_0x82ec48<_0x6266f5[_0x57a0('0x50')][_0x57a0('0x5d')][_0x57a0('0x3d')];_0x82ec48+=0x1){socket[_0x57a0('0x99')](_0x57a0('0x9a'),{'UserId':Number(_0x6266f5[_0x57a0('0x50')][_0x57a0('0x5d')][_0x82ec48]),'CmListId':Number(_0x6266f5[_0x57a0('0x4a')]['id'])});}return _0x299085;});}})['then'](respondWithResult(_0x4af89d,null))[_0x57a0('0x4e')](handleError(_0x4af89d,null));};exports[_0x57a0('0x9b')]=function(_0x3416d4,_0x47e929,_0x4a8149){return db[_0x57a0('0x33')][_0x57a0('0x4d')]({'where':{'id':_0x3416d4[_0x57a0('0x4a')]['id']}})['then'](handleEntityNotFound(_0x47e929,null))['then'](function(_0x4d0413){if(_0x4d0413){return _0x4d0413['removeAgents'](_0x3416d4[_0x57a0('0x3a')][_0x57a0('0x5d')])[_0x57a0('0x2a')](function(){if(_[_0x57a0('0x61')](_0x3416d4[_0x57a0('0x3a')][_0x57a0('0x5d')])){for(var _0x13f7cc=0x0;_0x13f7cc<_0x3416d4[_0x57a0('0x3a')]['ids'][_0x57a0('0x3d')];_0x13f7cc+=0x1){socket['emit'](_0x57a0('0x9c'),{'UserId':Number(_0x3416d4[_0x57a0('0x3a')]['ids'][_0x13f7cc]),'CmListId':Number(_0x3416d4[_0x57a0('0x4a')]['id'])});}}else{socket[_0x57a0('0x99')](_0x57a0('0x9c'),{'UserId':Number(_0x3416d4[_0x57a0('0x3a')][_0x57a0('0x5d')]),'CmListId':Number(_0x3416d4[_0x57a0('0x4a')]['id'])});}});}})['then'](respondWithStatusCode(_0x47e929,null))[_0x57a0('0x4e')](handleError(_0x47e929,null));};exports[_0x57a0('0x9d')]=function(_0x133491,_0x18a6e4,_0x29fc5c){var _0x26901d={};var _0x10e333={};var _0xae1e6b;var _0x55b286;return db[_0x57a0('0x33')][_0x57a0('0x94')]({'where':{'id':_0x133491['params']['id']}})[_0x57a0('0x2a')](handleEntityNotFound(_0x18a6e4,null))[_0x57a0('0x2a')](function(_0x3c1b8d){if(_0x3c1b8d){_0xae1e6b=_0x3c1b8d;_0x10e333['model']=_[_0x57a0('0x4b')](db['User'][_0x57a0('0x5b')]);_0x10e333[_0x57a0('0x3a')]=_[_0x57a0('0x4b')](_0x133491[_0x57a0('0x3a')]);_0x10e333[_0x57a0('0x37')]=_[_0x57a0('0x38')](_0x10e333[_0x57a0('0x39')],_0x10e333[_0x57a0('0x3a')]);_0x26901d['attributes']=_[_0x57a0('0x38')](_0x10e333[_0x57a0('0x39')],qs[_0x57a0('0x3b')](_0x133491['query'][_0x57a0('0x3b')]));_0x26901d[_0x57a0('0x3c')]=_0x26901d['attributes'][_0x57a0('0x3d')]?_0x26901d[_0x57a0('0x3c')]:_0x10e333[_0x57a0('0x39')];_0x26901d[_0x57a0('0x40')]=qs[_0x57a0('0x41')](_0x133491[_0x57a0('0x3a')][_0x57a0('0x41')]);_0x26901d[_0x57a0('0x42')]=qs[_0x57a0('0x37')](_[_0x57a0('0x43')](_0x133491[_0x57a0('0x3a')],_0x10e333[_0x57a0('0x37')]));if(_0x133491[_0x57a0('0x3a')][_0x57a0('0x44')]){_0x26901d['where']=_['merge'](_0x26901d[_0x57a0('0x42')],{'$or':_[_0x57a0('0x32')](_0x26901d[_0x57a0('0x3c')],function(_0x245567){var _0x4134d1={};_0x4134d1[_0x245567]={'$like':'%'+_0x133491[_0x57a0('0x3a')][_0x57a0('0x44')]+'%'};return _0x4134d1;})});}_0x26901d=_[_0x57a0('0x46')]({},_0x26901d,_0x133491[_0x57a0('0x47')]);return _0xae1e6b[_0x57a0('0x9d')](_0x26901d);}})[_0x57a0('0x2a')](function(_0x26ff24){if(_0x26ff24){_0x55b286=_0x26ff24[_0x57a0('0x3d')];if(!_0x133491['query'][_0x57a0('0x3e')](_0x57a0('0x3f'))){_0x26901d['limit']=qs[_0x57a0('0x23')](_0x133491[_0x57a0('0x3a')][_0x57a0('0x23')]);_0x26901d[_0x57a0('0x21')]=qs[_0x57a0('0x21')](_0x133491[_0x57a0('0x3a')][_0x57a0('0x21')]);}return _0xae1e6b[_0x57a0('0x9d')](_0x26901d);}})[_0x57a0('0x2a')](function(_0x1ccd5c){if(_0x1ccd5c){return _0x1ccd5c?{'count':_0x55b286,'rows':_0x1ccd5c}:null;}})[_0x57a0('0x2a')](respondWithResult(_0x18a6e4,null))[_0x57a0('0x4e')](handleError(_0x18a6e4,null));};function handleQuery(_0x532ea3){logger[_0x57a0('0x9e')](_0x532ea3);return db[_0x57a0('0x8a')][_0x57a0('0x3a')](_0x532ea3)[_0x57a0('0x98')](function(_0x4c90eb){csv_results[_0x57a0('0x63')](_0x4c90eb);})['catch'](function(_0x2a9bc9){logger[_0x57a0('0x9f')](_0x2a9bc9['message']);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index df99706..a954383 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x5f457d,_0x56888b){var _0x168de1=function(_0x3a3509){while(--_0x3a3509){_0x5f457d['push'](_0x5f457d['shift']());}};_0x168de1(++_0x56888b);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=CmListEvents; \ No newline at end of file +var _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe14b,0x93));var _0xbe14=function(_0x57d2c7,_0x5de40f){_0x57d2c7=_0x57d2c7-0x0;var _0x21dc54=_0xe14b[_0x57d2c7];return _0x21dc54;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index de8237c..6b7b0fb 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 _0xb903=['rimraf','../../config/environment','./cmList.attributes','exports','cm_lists','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x8f8dcd,_0x249623){var _0x4041bd=function(_0x874abc){while(--_0x874abc){_0x8f8dcd['push'](_0x8f8dcd['shift']());}};_0x4041bd(++_0x249623);}(_0xb903,0x185));var _0x3b90=function(_0x378c7c,_0x1e0020){_0x378c7c=_0x378c7c-0x0;var _0x364377=_0xb903[_0x378c7c];return _0x364377;};'use strict';var _=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var logger=require(_0x3b90('0x2'))(_0x3b90('0x3'));var moment=require('moment');var BPromise=require(_0x3b90('0x4'));var rp=require(_0x3b90('0x5'));var fs=require('fs');var path=require(_0x3b90('0x6'));var rimraf=require(_0x3b90('0x7'));var config=require(_0x3b90('0x8'));var attributes=require(_0x3b90('0x9'));module[_0x3b90('0xa')]=function(_0x5acd76,_0x15b68f){return _0x5acd76['define']('CmList',attributes,{'tableName':_0x3b90('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6324=['define','cm_lists','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','exports'];(function(_0xf2097,_0x156190){var _0x2670a7=function(_0x136937){while(--_0x136937){_0xf2097['push'](_0xf2097['shift']());}};_0x2670a7(++_0x156190);}(_0x6324,0x142));var _0x4632=function(_0x5341d2,_0x2da6d6){_0x5341d2=_0x5341d2-0x0;var _0x3a4d6a=_0x6324[_0x5341d2];return _0x3a4d6a;};'use strict';var _=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var logger=require(_0x4632('0x2'))(_0x4632('0x3'));var moment=require('moment');var BPromise=require(_0x4632('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4632('0x5'));var rimraf=require('rimraf');var config=require(_0x4632('0x6'));var attributes=require('./cmList.attributes');module[_0x4632('0x7')]=function(_0x24aba6,_0x1f3077){return _0x24aba6[_0x4632('0x8')]('CmList',attributes,{'tableName':_0x4632('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 2e995e5..50dcdf8 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 _0x53c6=['request','CmList,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','register'];(function(_0x2c8de9,_0x491a15){var _0xca3fe=function(_0x3e79b2){while(--_0x3e79b2){_0x2c8de9['push'](_0x2c8de9['shift']());}};_0xca3fe(++_0x491a15);}(_0x53c6,0x106));var _0x653c=function(_0x2426d7,_0x515f06){_0x2426d7=_0x2426d7-0x0;var _0x236709=_0x53c6[_0x2426d7];return _0x236709;};'use strict';var _=require(_0x653c('0x0'));var util=require(_0x653c('0x1'));var moment=require(_0x653c('0x2'));var BPromise=require('bluebird');var rs=require(_0x653c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x653c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x653c('0x5'))(_0x653c('0x6'));var config=require(_0x653c('0x7'));var jayson=require(_0x653c('0x8'));var client=jayson[_0x653c('0x9')]['http']({'port':0x232a});config['redis']=_[_0x653c('0xa')](config[_0x653c('0xb')],{'host':_0x653c('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./cmList.socket')[_0x653c('0xd')](socket);function respondWithRpcPromise(_0x4606d1,_0x221ee8,_0x102d01){return new BPromise(function(_0x591915,_0x2ad28f){return client[_0x653c('0xe')](_0x4606d1,_0x102d01)['then'](function(_0x3a6a15){logger['info'](_0x653c('0xf'),_0x221ee8,_0x653c('0x10'));logger[_0x653c('0x11')]('CmList,\x20%s,\x20%s,\x20%s',_0x221ee8,_0x653c('0x10'),JSON[_0x653c('0x12')](_0x3a6a15));if(_0x3a6a15[_0x653c('0x13')]){if(_0x3a6a15[_0x653c('0x13')]['code']===0x1f4){logger[_0x653c('0x13')]('CmList,\x20%s,\x20%s',_0x221ee8,_0x3a6a15[_0x653c('0x13')][_0x653c('0x14')]);return _0x2ad28f(_0x3a6a15['error'][_0x653c('0x14')]);}logger[_0x653c('0x13')](_0x653c('0xf'),_0x221ee8,_0x3a6a15[_0x653c('0x13')][_0x653c('0x14')]);return _0x591915(_0x3a6a15[_0x653c('0x13')][_0x653c('0x14')]);}else{logger[_0x653c('0x15')](_0x653c('0xf'),_0x221ee8,_0x653c('0x10'));_0x591915(_0x3a6a15[_0x653c('0x16')][_0x653c('0x14')]);}})['catch'](function(_0x19b1ee){logger['error'](_0x653c('0xf'),_0x221ee8,_0x19b1ee);_0x2ad28f(_0x19b1ee);});});} \ No newline at end of file +var _0x02cc=['client','http','redis','localhost','./cmList.socket','register','then','info','CmList,\x20%s,\x20%s','debug','error','code','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise'];(function(_0x265647,_0x4d3f21){var _0x3a9c63=function(_0x53049e){while(--_0x53049e){_0x265647['push'](_0x265647['shift']());}};_0x3a9c63(++_0x4d3f21);}(_0x02cc,0x1b2));var _0xc02c=function(_0x1c6ccb,_0x192033){_0x1c6ccb=_0x1c6ccb-0x0;var _0x27800d=_0x02cc[_0x1c6ccb];return _0x27800d;};'use strict';var _=require(_0xc02c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc02c('0x1'));var rs=require(_0xc02c('0x2'));var fs=require('fs');var Redis=require(_0xc02c('0x3'));var db=require(_0xc02c('0x4'))['db'];var utils=require(_0xc02c('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xc02c('0x6'));var client=jayson[_0xc02c('0x7')][_0xc02c('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0xc02c('0x9')],{'host':_0xc02c('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc02c('0x9')]));require(_0xc02c('0xb'))[_0xc02c('0xc')](socket);function respondWithRpcPromise(_0xb2bae,_0x235453,_0x40f9c3){return new BPromise(function(_0x5532ba,_0x6eece8){return client['request'](_0xb2bae,_0x40f9c3)[_0xc02c('0xd')](function(_0x37659e){logger[_0xc02c('0xe')](_0xc02c('0xf'),_0x235453,'request\x20sent');logger[_0xc02c('0x10')]('CmList,\x20%s,\x20%s,\x20%s',_0x235453,'request\x20sent',JSON['stringify'](_0x37659e));if(_0x37659e['error']){if(_0x37659e[_0xc02c('0x11')][_0xc02c('0x12')]===0x1f4){logger[_0xc02c('0x11')]('CmList,\x20%s,\x20%s',_0x235453,_0x37659e[_0xc02c('0x11')][_0xc02c('0x13')]);return _0x6eece8(_0x37659e[_0xc02c('0x11')][_0xc02c('0x13')]);}logger[_0xc02c('0x11')](_0xc02c('0xf'),_0x235453,_0x37659e[_0xc02c('0x11')][_0xc02c('0x13')]);return _0x5532ba(_0x37659e[_0xc02c('0x11')][_0xc02c('0x13')]);}else{logger[_0xc02c('0xe')](_0xc02c('0xf'),_0x235453,'request\x20sent');_0x5532ba(_0x37659e['result'][_0xc02c('0x13')]);}})[_0xc02c('0x14')](function(_0x1957fc){logger[_0xc02c('0x11')](_0xc02c('0xf'),_0x235453,_0x1957fc);_0x6eece8(_0x1957fc);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index aa61fbc..4b37e01 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 _0x36cd=['emit','removeListener','length','./cmList.events','save','remove','update'];(function(_0x245d65,_0xe6ae06){var _0xd651af=function(_0xc48dfc){while(--_0xc48dfc){_0x245d65['push'](_0x245d65['shift']());}};_0xd651af(++_0xe6ae06);}(_0x36cd,0x1e6));var _0xd36c=function(_0x9fdca,_0x364493){_0x9fdca=_0x9fdca-0x0;var _0x4037a3=_0x36cd[_0x9fdca];return _0x4037a3;};'use strict';var CmListEvents=require(_0xd36c('0x0'));var events=[_0xd36c('0x1'),_0xd36c('0x2'),_0xd36c('0x3')];function createListener(_0x418e7b,_0x184913){return function(_0x1edb36){_0x184913[_0xd36c('0x4')](_0x418e7b,_0x1edb36);};}function removeListener(_0x5a1718,_0x44961d){return function(){CmListEvents[_0xd36c('0x5')](_0x5a1718,_0x44961d);};}exports['register']=function(_0xd0dd74){for(var _0x413d9f=0x0,_0x4ca504=events[_0xd36c('0x6')];_0x413d9f<_0x4ca504;_0x413d9f++){var _0x2d36bd=events[_0x413d9f];var _0xb4728f=createListener('cmList:'+_0x2d36bd,_0xd0dd74);CmListEvents['on'](_0x2d36bd,_0xb4728f);}}; \ No newline at end of file +var _0xea67=['cmList:','./cmList.events','save','remove','update','emit','removeListener','length'];(function(_0x3fa9d0,_0x31e4ac){var _0x5eae8f=function(_0x589abf){while(--_0x589abf){_0x3fa9d0['push'](_0x3fa9d0['shift']());}};_0x5eae8f(++_0x31e4ac);}(_0xea67,0x121));var _0x7ea6=function(_0x24243b,_0x55c567){_0x24243b=_0x24243b-0x0;var _0x1a85ce=_0xea67[_0x24243b];return _0x1a85ce;};'use strict';var CmListEvents=require(_0x7ea6('0x0'));var events=[_0x7ea6('0x1'),_0x7ea6('0x2'),_0x7ea6('0x3')];function createListener(_0x48ecdc,_0x11727f){return function(_0x2445bd){_0x11727f[_0x7ea6('0x4')](_0x48ecdc,_0x2445bd);};}function removeListener(_0x13b1d3,_0x5b9b05){return function(){CmListEvents[_0x7ea6('0x5')](_0x13b1d3,_0x5b9b05);};}exports['register']=function(_0x339fa7){for(var _0x40402a=0x0,_0x3cc277=events[_0x7ea6('0x6')];_0x40402a<_0x3cc277;_0x40402a++){var _0xdf5bac=events[_0x40402a];var _0x2a4e43=createListener(_0x7ea6('0x7')+_0xdf5bac,_0x339fa7);CmListEvents['on'](_0xdf5bac,_0x2a4e43);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index f1c4eeb..6fc9c6e 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 _0x0fd1=['addDisposition','/:id/contacts','/:id/users','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','index','/describe','isAuthenticated','describe','getGlobalCustomFields','/:id','/:id/dispositions','getDispositions','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','post','create'];(function(_0x3f3481,_0x19687f){var _0x324bc9=function(_0x41bdc8){while(--_0x41bdc8){_0x3f3481['push'](_0x3f3481['shift']());}};_0x324bc9(++_0x19687f);}(_0x0fd1,0x12b));var _0x10fd=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x0fd1[_0x243b2f];return _0xcb3c2d;};'use strict';var multer=require(_0x10fd('0x0'));var util=require(_0x10fd('0x1'));var path=require(_0x10fd('0x2'));var timeout=require('connect-timeout');var express=require(_0x10fd('0x3'));var router=express[_0x10fd('0x4')]();var fs_extra=require(_0x10fd('0x5'));var auth=require(_0x10fd('0x6'));var interaction=require(_0x10fd('0x7'));var config=require(_0x10fd('0x8'));var controller=require(_0x10fd('0x9'));router[_0x10fd('0xa')]('/',auth['isAuthenticated'](),controller[_0x10fd('0xb')]);router[_0x10fd('0xa')](_0x10fd('0xc'),auth[_0x10fd('0xd')](),controller[_0x10fd('0xe')]);router['get']('/global_fields',auth[_0x10fd('0xd')](),controller[_0x10fd('0xf')]);router[_0x10fd('0xa')](_0x10fd('0x10'),auth[_0x10fd('0xd')](),controller['show']);router[_0x10fd('0xa')](_0x10fd('0x11'),auth[_0x10fd('0xd')](),controller[_0x10fd('0x12')]);router['get']('/:id/contacts',auth['isAuthenticated'](),controller['getContacts']);router[_0x10fd('0xa')](_0x10fd('0x13'),auth[_0x10fd('0xd')](),controller[_0x10fd('0x14')]);router[_0x10fd('0xa')](_0x10fd('0x15'),auth[_0x10fd('0xd')](),controller[_0x10fd('0x16')]);router[_0x10fd('0xa')]('/:id/users',auth[_0x10fd('0xd')](),controller['getAgents']);router[_0x10fd('0x17')]('/',auth[_0x10fd('0xd')](),controller[_0x10fd('0x18')]);router[_0x10fd('0x17')](_0x10fd('0x11'),auth['isAuthenticated'](),controller[_0x10fd('0x19')]);router[_0x10fd('0x17')](_0x10fd('0x1a'),auth[_0x10fd('0xd')](),controller['addContacts']);router[_0x10fd('0x17')](_0x10fd('0x15'),auth[_0x10fd('0xd')](),controller['addCustomField']);router[_0x10fd('0x17')](_0x10fd('0x1b'),auth[_0x10fd('0xd')](),controller[_0x10fd('0x1c')]);router[_0x10fd('0x1d')](_0x10fd('0x10'),auth[_0x10fd('0xd')](),controller[_0x10fd('0x1e')]);router[_0x10fd('0x1f')]('/:id',auth[_0x10fd('0xd')](),controller[_0x10fd('0x20')]);router['delete'](_0x10fd('0x11'),auth[_0x10fd('0xd')](),controller[_0x10fd('0x21')]);router[_0x10fd('0x1f')]('/:id/users',auth[_0x10fd('0xd')](),controller[_0x10fd('0x22')]);module[_0x10fd('0x23')]=router; \ No newline at end of file +var _0x6e86=['get','isAuthenticated','index','/describe','describe','/global_fields','getGlobalCustomFields','/:id','show','/:id/dispositions','/:id/contacts','getContacts','/:id/contacts/csv','/:id/fields','getCustomFields','/:id/users','getAgents','create','post','addDisposition','addContacts','addCustomField','addAgents','put','delete','removeDispositions','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./cmList.controller'];(function(_0x9fb704,_0x301996){var _0x1d1790=function(_0x504dbd){while(--_0x504dbd){_0x9fb704['push'](_0x9fb704['shift']());}};_0x1d1790(++_0x301996);}(_0x6e86,0xed));var _0x66e8=function(_0x49cb71,_0x2f0149){_0x49cb71=_0x49cb71-0x0;var _0x3a50fd=_0x6e86[_0x49cb71];return _0x3a50fd;};'use strict';var multer=require(_0x66e8('0x0'));var util=require('util');var path=require(_0x66e8('0x1'));var timeout=require(_0x66e8('0x2'));var express=require(_0x66e8('0x3'));var router=express['Router']();var fs_extra=require(_0x66e8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x66e8('0x5'));var config=require(_0x66e8('0x6'));var controller=require(_0x66e8('0x7'));router[_0x66e8('0x8')]('/',auth[_0x66e8('0x9')](),controller[_0x66e8('0xa')]);router[_0x66e8('0x8')](_0x66e8('0xb'),auth[_0x66e8('0x9')](),controller[_0x66e8('0xc')]);router[_0x66e8('0x8')](_0x66e8('0xd'),auth[_0x66e8('0x9')](),controller[_0x66e8('0xe')]);router[_0x66e8('0x8')](_0x66e8('0xf'),auth['isAuthenticated'](),controller[_0x66e8('0x10')]);router[_0x66e8('0x8')](_0x66e8('0x11'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x66e8('0x8')](_0x66e8('0x12'),auth[_0x66e8('0x9')](),controller[_0x66e8('0x13')]);router[_0x66e8('0x8')](_0x66e8('0x14'),auth[_0x66e8('0x9')](),controller['getContactsCsv']);router[_0x66e8('0x8')](_0x66e8('0x15'),auth[_0x66e8('0x9')](),controller[_0x66e8('0x16')]);router[_0x66e8('0x8')](_0x66e8('0x17'),auth[_0x66e8('0x9')](),controller[_0x66e8('0x18')]);router['post']('/',auth[_0x66e8('0x9')](),controller[_0x66e8('0x19')]);router[_0x66e8('0x1a')](_0x66e8('0x11'),auth[_0x66e8('0x9')](),controller[_0x66e8('0x1b')]);router[_0x66e8('0x1a')](_0x66e8('0x12'),auth[_0x66e8('0x9')](),controller[_0x66e8('0x1c')]);router[_0x66e8('0x1a')]('/:id/fields',auth['isAuthenticated'](),controller[_0x66e8('0x1d')]);router['post'](_0x66e8('0x17'),auth[_0x66e8('0x9')](),controller[_0x66e8('0x1e')]);router[_0x66e8('0x1f')](_0x66e8('0xf'),auth[_0x66e8('0x9')](),controller['update']);router[_0x66e8('0x20')]('/:id',auth[_0x66e8('0x9')](),controller['destroy']);router['delete'](_0x66e8('0x11'),auth['isAuthenticated'](),controller[_0x66e8('0x21')]);router[_0x66e8('0x20')](_0x66e8('0x17'),auth[_0x66e8('0x9')](),controller['removeAgents']);module[_0x66e8('0x22')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 6917afb..364f71e 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 _0x74d4=['getDataValue','field','STRING','VIRTUAL'];(function(_0x1f73c3,_0xa8af11){var _0x20450e=function(_0x2f30fb){while(--_0x2f30fb){_0x1f73c3['push'](_0x1f73c3['shift']());}};_0x20450e(++_0xa8af11);}(_0x74d4,0x163));var _0x474d=function(_0x3fc6a2,_0x16d351){_0x3fc6a2=_0x3fc6a2-0x0;var _0x231657=_0x74d4[_0x3fc6a2];return _0x231657;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x474d('0x0')],'get':function(_0x2d3e56){return this[_0x474d('0x1')](_0x474d('0x2'));}},'field':{'type':Sequelize[_0x474d('0x3')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x6650=['STRING','exports','VIRTUAL'];(function(_0x457b3d,_0x1d5709){var _0xf55f65=function(_0x33cb05){while(--_0x33cb05){_0x457b3d['push'](_0x457b3d['shift']());}};_0xf55f65(++_0x1d5709);}(_0x6650,0xf4));var _0x0665=function(_0x3007b4,_0x4a2d76){_0x3007b4=_0x3007b4-0x0;var _0x2a976e=_0x6650[_0x3007b4];return _0x2a976e;};'use strict';var Sequelize=require('sequelize');module[_0x0665('0x0')]={'name':{'type':Sequelize[_0x0665('0x1')],'get':function(_0x286784){return this['getDataValue']('field');}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0665('0x2')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 8409448..62a1d29 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(_0x488fbd,_0x2359d4){var _0x325f99=function(_0x572181){while(--_0x572181){_0x488fbd['push'](_0x488fbd['shift']());}};_0x325f99(++_0x2359d4);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'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 _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(_0x2ff6fc,_0x5e6a2d){var _0xad0dea=function(_0x419b7e){while(--_0x419b7e){_0x2ff6fc['push'](_0x2ff6fc['shift']());}};_0xad0dea(++_0x5e6a2d);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index f484ff4..6e59587 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 _0x36a6=['lodash','util','api','moment','bluebird','path','../../config/environment','define','Condition','tools_conditions'];(function(_0x45ce17,_0x5e328c){var _0x464b7e=function(_0x11e860){while(--_0x11e860){_0x45ce17['push'](_0x45ce17['shift']());}};_0x464b7e(++_0x5e328c);}(_0x36a6,0xa0));var _0x636a=function(_0x234eef,_0x111efb){_0x234eef=_0x234eef-0x0;var _0x43c5e8=_0x36a6[_0x234eef];return _0x43c5e8;};'use strict';var _=require(_0x636a('0x0'));var util=require(_0x636a('0x1'));var logger=require('../../config/logger')(_0x636a('0x2'));var moment=require(_0x636a('0x3'));var BPromise=require(_0x636a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x636a('0x5'));var rimraf=require('rimraf');var config=require(_0x636a('0x6'));var attributes=require('./condition.attributes');module['exports']=function(_0x4796ca,_0x53188f){return _0x4796ca[_0x636a('0x7')](_0x636a('0x8'),attributes,{'tableName':_0x636a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4871=['api','request-promise','path','rimraf','../../config/environment','./condition.attributes','exports','define','Condition','lodash','util','../../config/logger'];(function(_0x312a89,_0x24f89b){var _0x4f0338=function(_0x218fa2){while(--_0x218fa2){_0x312a89['push'](_0x312a89['shift']());}};_0x4f0338(++_0x24f89b);}(_0x4871,0x1d1));var _0x1487=function(_0x5c9a5a,_0x1cff8c){_0x5c9a5a=_0x5c9a5a-0x0;var _0x5bab92=_0x4871[_0x5c9a5a];return _0x5bab92;};'use strict';var _=require(_0x1487('0x0'));var util=require(_0x1487('0x1'));var logger=require(_0x1487('0x2'))(_0x1487('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1487('0x4'));var fs=require('fs');var path=require(_0x1487('0x5'));var rimraf=require(_0x1487('0x6'));var config=require(_0x1487('0x7'));var attributes=require(_0x1487('0x8'));module[_0x1487('0x9')]=function(_0x513d5c,_0x5704d9){return _0x513d5c[_0x1487('0xa')](_0x1487('0xb'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 16b23e5..959a2d9 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 _0x8b5d=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Condition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x48b819,_0x5159df){var _0x16b470=function(_0x46083e){while(--_0x46083e){_0x48b819['push'](_0x48b819['shift']());}};_0x16b470(++_0x5159df);}(_0x8b5d,0xff));var _0xd8b5=function(_0x1283d4,_0x36b6f1){_0x1283d4=_0x1283d4-0x0;var _0x433643=_0x8b5d[_0x1283d4];return _0x433643;};'use strict';var _=require(_0xd8b5('0x0'));var util=require(_0xd8b5('0x1'));var moment=require('moment');var BPromise=require(_0xd8b5('0x2'));var rs=require(_0xd8b5('0x3'));var fs=require('fs');var Redis=require(_0xd8b5('0x4'));var db=require(_0xd8b5('0x5'))['db'];var utils=require(_0xd8b5('0x6'));var logger=require(_0xd8b5('0x7'))('rpc');var config=require(_0xd8b5('0x8'));var jayson=require(_0xd8b5('0x9'));var client=jayson[_0xd8b5('0xa')][_0xd8b5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ae923,_0x141800,_0x3e548b){return new BPromise(function(_0x18ea4b,_0x5d0a4c){return client[_0xd8b5('0xc')](_0x5ae923,_0x3e548b)['then'](function(_0x54c090){logger[_0xd8b5('0xd')](_0xd8b5('0xe'),_0x141800,_0xd8b5('0xf'));logger[_0xd8b5('0x10')]('Condition,\x20%s,\x20%s,\x20%s',_0x141800,_0xd8b5('0xf'),JSON[_0xd8b5('0x11')](_0x54c090));if(_0x54c090[_0xd8b5('0x12')]){if(_0x54c090[_0xd8b5('0x12')][_0xd8b5('0x13')]===0x1f4){logger[_0xd8b5('0x12')](_0xd8b5('0xe'),_0x141800,_0x54c090[_0xd8b5('0x12')][_0xd8b5('0x14')]);return _0x5d0a4c(_0x54c090['error'][_0xd8b5('0x14')]);}logger[_0xd8b5('0x12')](_0xd8b5('0xe'),_0x141800,_0x54c090[_0xd8b5('0x12')][_0xd8b5('0x14')]);return _0x18ea4b(_0x54c090[_0xd8b5('0x12')][_0xd8b5('0x14')]);}else{logger[_0xd8b5('0xd')](_0xd8b5('0xe'),_0x141800,_0xd8b5('0xf'));_0x18ea4b(_0x54c090[_0xd8b5('0x15')][_0xd8b5('0x14')]);}})[_0xd8b5('0x16')](function(_0x5934f8){logger[_0xd8b5('0x12')]('Condition,\x20%s,\x20%s',_0x141800,_0x5934f8);_0x5d0a4c(_0x5934f8);});});} \ No newline at end of file +var _0x1e8d=['lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','request','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x291843,_0x4d7fac){var _0x3a03fd=function(_0x61268d){while(--_0x61268d){_0x291843['push'](_0x291843['shift']());}};_0x3a03fd(++_0x4d7fac);}(_0x1e8d,0x190));var _0xd1e8=function(_0x1e6b41,_0x33ce88){_0x1e6b41=_0x1e6b41-0x0;var _0x4159f1=_0x1e8d[_0x1e6b41];return _0x4159f1;};'use strict';var _=require(_0xd1e8('0x0'));var util=require(_0xd1e8('0x1'));var moment=require(_0xd1e8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd1e8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd1e8('0x4'));var logger=require(_0xd1e8('0x5'))(_0xd1e8('0x6'));var config=require('../../config/environment');var jayson=require(_0xd1e8('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2696b2,_0x6d6555,_0x34de51){return new BPromise(function(_0x13d2fa,_0x3d9ba5){return client[_0xd1e8('0x8')](_0x2696b2,_0x34de51)['then'](function(_0x5a08a2){logger[_0xd1e8('0x9')](_0xd1e8('0xa'),_0x6d6555,_0xd1e8('0xb'));logger[_0xd1e8('0xc')](_0xd1e8('0xd'),_0x6d6555,'request\x20sent',JSON[_0xd1e8('0xe')](_0x5a08a2));if(_0x5a08a2[_0xd1e8('0xf')]){if(_0x5a08a2[_0xd1e8('0xf')][_0xd1e8('0x10')]===0x1f4){logger[_0xd1e8('0xf')](_0xd1e8('0xa'),_0x6d6555,_0x5a08a2[_0xd1e8('0xf')][_0xd1e8('0x11')]);return _0x3d9ba5(_0x5a08a2['error']['message']);}logger['error']('Condition,\x20%s,\x20%s',_0x6d6555,_0x5a08a2[_0xd1e8('0xf')][_0xd1e8('0x11')]);return _0x13d2fa(_0x5a08a2[_0xd1e8('0xf')][_0xd1e8('0x11')]);}else{logger['info']('Condition,\x20%s,\x20%s',_0x6d6555,'request\x20sent');_0x13d2fa(_0x5a08a2[_0xd1e8('0x12')][_0xd1e8('0x11')]);}})[_0xd1e8('0x13')](function(_0x29242e){logger[_0xd1e8('0xf')](_0xd1e8('0xa'),_0x6d6555,_0x29242e);_0x3d9ba5(_0x29242e);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 9dd1ae3..aae9436 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 _0xea4a=['put','/:id','update','delete','isAuthenticated','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller'];(function(_0x217c27,_0x4325db){var _0xb7b87=function(_0x2c0b41){while(--_0x2c0b41){_0x217c27['push'](_0x217c27['shift']());}};_0xb7b87(++_0x4325db);}(_0xea4a,0xa7));var _0xaea4=function(_0x2f1aaf,_0x3934c1){_0x2f1aaf=_0x2f1aaf-0x0;var _0x2ba82d=_0xea4a[_0x2f1aaf];return _0x2ba82d;};'use strict';var multer=require(_0xaea4('0x0'));var util=require(_0xaea4('0x1'));var path=require(_0xaea4('0x2'));var timeout=require(_0xaea4('0x3'));var express=require(_0xaea4('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xaea4('0x5'));var interaction=require(_0xaea4('0x6'));var config=require(_0xaea4('0x7'));var controller=require(_0xaea4('0x8'));router[_0xaea4('0x9')](_0xaea4('0xa'),auth['isAuthenticated'](),controller[_0xaea4('0xb')]);router[_0xaea4('0xc')]('/:id',auth[_0xaea4('0xd')](),controller[_0xaea4('0xe')]);module[_0xaea4('0xf')]=router; \ No newline at end of file +var _0x092f=['express','Router','../../components/interaction/service','./condition.controller','put','/:id','isAuthenticated','update','delete','multer','util','path','connect-timeout'];(function(_0x17fea7,_0x102927){var _0x3150c3=function(_0x1d6bd0){while(--_0x1d6bd0){_0x17fea7['push'](_0x17fea7['shift']());}};_0x3150c3(++_0x102927);}(_0x092f,0x15b));var _0xf092=function(_0x492535,_0x46524a){_0x492535=_0x492535-0x0;var _0x256620=_0x092f[_0x492535];return _0x256620;};'use strict';var multer=require(_0xf092('0x0'));var util=require(_0xf092('0x1'));var path=require(_0xf092('0x2'));var timeout=require(_0xf092('0x3'));var express=require(_0xf092('0x4'));var router=express[_0xf092('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf092('0x6'));var config=require('../../config/environment');var controller=require(_0xf092('0x7'));router[_0xf092('0x8')](_0xf092('0x9'),auth[_0xf092('0xa')](),controller[_0xf092('0xb')]);router[_0xf092('0xc')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 0c98d48..2ba7d58 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 _0x6184=['STRING','name','sequelize','exports'];(function(_0x294201,_0x248d09){var _0x108987=function(_0x368020){while(--_0x368020){_0x294201['push'](_0x294201['shift']());}};_0x108987(++_0x248d09);}(_0x6184,0x1d6));var _0x4618=function(_0x14476b,_0xd1a7a4){_0x14476b=_0x14476b-0x0;var _0x24e2e8=_0x6184[_0x14476b];return _0x24e2e8;};'use strict';var Sequelize=require(_0x4618('0x0'));module[_0x4618('0x1')]={'name':{'type':Sequelize[_0x4618('0x2')],'allowNull':![],'unique':_0x4618('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x4618('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xee6c=['STRING','sequelize','name','INTEGER'];(function(_0x224347,_0x4e0d3c){var _0x518666=function(_0x31be64){while(--_0x31be64){_0x224347['push'](_0x224347['shift']());}};_0x518666(++_0x4e0d3c);}(_0xee6c,0x139));var _0xcee6=function(_0x33554,_0x271ce4){_0x33554=_0x33554-0x0;var _0x245a00=_0xee6c[_0x33554];return _0x245a00;};'use strict';var Sequelize=require(_0xcee6('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xcee6('0x1')},'OrderBy':{'type':Sequelize[_0xcee6('0x2')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xcee6('0x3')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 7b1b0b0..a0a04d7 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 _0x14a0=['undefined','limit','count','offset','set','apply','reject','save','update','destroy','then','get','UserProfileResource','error','stack','send','index','map','ContactItemType','rawAttributes','fieldName','type','key','name','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ContactItemTypes','userProfileId','autoAssociation','params','CmContactHasItem','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','jsforce','querystring','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x249d99,_0x16b584){var _0x5bfb05=function(_0x4f4d67){while(--_0x4f4d67){_0x249d99['push'](_0x249d99['shift']());}};_0x5bfb05(++_0x16b584);}(_0x14a0,0x8e));var _0x014a=function(_0x580647,_0x43d2c3){_0x580647=_0x580647-0x0;var _0x5f0792=_0x14a0[_0x580647];return _0x5f0792;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x014a('0x0'));var zipdir=require(_0x014a('0x1'));var jsonpatch=require(_0x014a('0x2'));var rp=require(_0x014a('0x3'));var moment=require(_0x014a('0x4'));var BPromise=require(_0x014a('0x5'));var Mustache=require(_0x014a('0x6'));var util=require('util');var path=require('path');var sox=require(_0x014a('0x7'));var csv=require(_0x014a('0x8'));var ejs=require(_0x014a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x014a('0xa'));var crypto=require(_0x014a('0xb'));var jsforce=require(_0x014a('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x014a('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x014a('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x014a('0xf'))(_0x014a('0x10'));var utils=require('../../config/utils');var config=require(_0x014a('0x11'));var licenseUtil=require(_0x014a('0x12'));var db=require(_0x014a('0x13'))['db'];function respondWithStatusCode(_0x43bfeb,_0x1bcd1){_0x1bcd1=_0x1bcd1||0xcc;return function(_0x20cb56){if(_0x20cb56){return _0x43bfeb[_0x014a('0x14')](_0x1bcd1);}return _0x43bfeb[_0x014a('0x15')](_0x1bcd1)[_0x014a('0x16')]();};}function respondWithResult(_0x71535d,_0x45cd80){_0x45cd80=_0x45cd80||0xc8;return function(_0x3c54c8){if(_0x3c54c8){return _0x71535d['status'](_0x45cd80)[_0x014a('0x17')](_0x3c54c8);}};}function respondWithFilteredResult(_0x3cf92f,_0x59f207){return function(_0x3a836f){if(_0x3a836f){var _0x128c46=typeof _0x59f207['offset']===_0x014a('0x18')&&typeof _0x59f207[_0x014a('0x19')]===_0x014a('0x18');var _0x12da95=_0x3a836f[_0x014a('0x1a')];var _0x12d339=_0x128c46?0x0:_0x59f207[_0x014a('0x1b')];var _0x263b07=_0x128c46?_0x3a836f[_0x014a('0x1a')]:_0x59f207[_0x014a('0x1b')]+_0x59f207[_0x014a('0x19')];var _0x89e132;if(_0x263b07>=_0x12da95){_0x263b07=_0x12da95;_0x89e132=0xc8;}else{_0x89e132=0xce;}_0x3cf92f[_0x014a('0x15')](_0x89e132);return _0x3cf92f[_0x014a('0x1c')]('Content-Range',_0x12d339+'-'+_0x263b07+'/'+_0x12da95)[_0x014a('0x17')](_0x3a836f);}return null;};}function patchUpdates(_0x109a9c){return function(_0x11065f){try{jsonpatch[_0x014a('0x1d')](_0x11065f,_0x109a9c,!![]);}catch(_0xc9a563){return BPromise[_0x014a('0x1e')](_0xc9a563);}return _0x11065f[_0x014a('0x1f')]();};}function saveUpdates(_0x3dd2d0,_0x290b86){return function(_0x486e66){if(_0x486e66){return _0x486e66[_0x014a('0x20')](_0x3dd2d0)['then'](function(_0x1a1318){return _0x1a1318;});}return null;};}function removeEntity(_0x26718b,_0x44d921){return function(_0x36d52b){if(_0x36d52b){return _0x36d52b[_0x014a('0x21')]()[_0x014a('0x22')](function(){var _0x3fec9f=_0x36d52b[_0x014a('0x23')]({'plain':!![]});var _0x165a42='ContactItemTypes';return db[_0x014a('0x24')]['destroy']({'where':{'type':_0x165a42,'resourceId':_0x3fec9f['id']}})[_0x014a('0x22')](function(){return _0x36d52b;});})[_0x014a('0x22')](function(){_0x26718b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x9a901f,_0x3f9719){return function(_0x143346){if(!_0x143346){_0x9a901f['sendStatus'](0x194);}return _0x143346;};}function handleError(_0x183f19,_0x3c1fa4){_0x3c1fa4=_0x3c1fa4||0x1f4;return function(_0x598179){logger[_0x014a('0x25')](_0x598179[_0x014a('0x26')]);if(_0x598179['name']){delete _0x598179['name'];}_0x183f19[_0x014a('0x15')](_0x3c1fa4)[_0x014a('0x27')](_0x598179);};}exports[_0x014a('0x28')]=function(_0x29fce5,_0x4ea00c){var _0x434038={},_0x147e7e={},_0x15af07={'count':0x0,'rows':[]};var _0x402d3b=_[_0x014a('0x29')](db[_0x014a('0x2a')][_0x014a('0x2b')],function(_0x1dae8e){return{'name':_0x1dae8e[_0x014a('0x2c')],'type':_0x1dae8e[_0x014a('0x2d')][_0x014a('0x2e')]};});_0x147e7e['model']=_[_0x014a('0x29')](_0x402d3b,_0x014a('0x2f'));_0x147e7e[_0x014a('0x30')]=_[_0x014a('0x31')](_0x29fce5[_0x014a('0x30')]);_0x147e7e[_0x014a('0x32')]=_[_0x014a('0x33')](_0x147e7e['model'],_0x147e7e[_0x014a('0x30')]);_0x434038[_0x014a('0x34')]=_['intersection'](_0x147e7e[_0x014a('0x35')],qs[_0x014a('0x36')](_0x29fce5[_0x014a('0x30')][_0x014a('0x36')]));_0x434038[_0x014a('0x34')]=_0x434038[_0x014a('0x34')][_0x014a('0x37')]?_0x434038[_0x014a('0x34')]:_0x147e7e['model'];if(!_0x29fce5[_0x014a('0x30')][_0x014a('0x38')](_0x014a('0x39'))){_0x434038[_0x014a('0x19')]=qs['limit'](_0x29fce5[_0x014a('0x30')][_0x014a('0x19')]);_0x434038[_0x014a('0x1b')]=qs[_0x014a('0x1b')](_0x29fce5[_0x014a('0x30')][_0x014a('0x1b')]);}_0x434038[_0x014a('0x3a')]=qs[_0x014a('0x3b')](_0x29fce5[_0x014a('0x30')]['sort']);_0x434038[_0x014a('0x3c')]=qs['filters'](_[_0x014a('0x3d')](_0x29fce5[_0x014a('0x30')],_0x147e7e[_0x014a('0x32')]),_0x402d3b);if(_0x29fce5[_0x014a('0x30')][_0x014a('0x3e')]){_0x434038['where']=_[_0x014a('0x3f')](_0x434038[_0x014a('0x3c')],{'$or':_['map'](_0x402d3b,function(_0x9227b8){if(_0x9227b8[_0x014a('0x2d')]!==_0x014a('0x40')){var _0x2e7a14={};_0x2e7a14[_0x9227b8[_0x014a('0x2f')]]={'$like':'%'+_0x29fce5[_0x014a('0x30')][_0x014a('0x3e')]+'%'};return _0x2e7a14;}})});}_0x434038=_[_0x014a('0x3f')]({},_0x434038,_0x29fce5[_0x014a('0x41')]);var _0x537bde={'where':_0x434038[_0x014a('0x3c')]};return db[_0x014a('0x2a')][_0x014a('0x1a')](_0x537bde)[_0x014a('0x22')](function(_0x5f1a91){_0x15af07[_0x014a('0x1a')]=_0x5f1a91;if(_0x29fce5[_0x014a('0x30')][_0x014a('0x42')]){_0x434038[_0x014a('0x43')]=[{'all':!![]}];}return db[_0x014a('0x2a')][_0x014a('0x44')](_0x434038);})['then'](function(_0x361866){_0x15af07[_0x014a('0x45')]=_0x361866;return _0x15af07;})['then'](respondWithFilteredResult(_0x4ea00c,_0x434038))[_0x014a('0x46')](handleError(_0x4ea00c,null));};exports[_0x014a('0x47')]=function(_0x2c45f1,_0x5dc092){var _0x5bcf8={'raw':!![],'where':{'id':_0x2c45f1['params']['id']}},_0x50a8f0={};_0x50a8f0[_0x014a('0x35')]=_[_0x014a('0x31')](db['ContactItemType'][_0x014a('0x2b')]);_0x50a8f0[_0x014a('0x30')]=_[_0x014a('0x31')](_0x2c45f1[_0x014a('0x30')]);_0x50a8f0[_0x014a('0x32')]=_[_0x014a('0x33')](_0x50a8f0['model'],_0x50a8f0[_0x014a('0x30')]);_0x5bcf8[_0x014a('0x34')]=_[_0x014a('0x33')](_0x50a8f0['model'],qs['fields'](_0x2c45f1[_0x014a('0x30')]['fields']));_0x5bcf8['attributes']=_0x5bcf8[_0x014a('0x34')]['length']?_0x5bcf8[_0x014a('0x34')]:_0x50a8f0[_0x014a('0x35')];if(_0x2c45f1[_0x014a('0x30')]['includeAll']){_0x5bcf8[_0x014a('0x43')]=[{'all':!![]}];}_0x5bcf8=_[_0x014a('0x3f')]({},_0x5bcf8,_0x2c45f1[_0x014a('0x41')]);return db[_0x014a('0x2a')][_0x014a('0x48')](_0x5bcf8)[_0x014a('0x22')](handleEntityNotFound(_0x5dc092,null))['then'](respondWithResult(_0x5dc092,null))[_0x014a('0x46')](handleError(_0x5dc092,null));};exports[_0x014a('0x49')]=function(_0x5a861c,_0x1a4df9){return db[_0x014a('0x2a')][_0x014a('0x49')](_0x5a861c[_0x014a('0x4a')],{})[_0x014a('0x22')](function(_0x357ca1){var _0x437f23=_0x5a861c[_0x014a('0x4b')]['get']({'plain':!![]});if(!_0x437f23)throw new Error(_0x014a('0x4c'));if(_0x437f23[_0x014a('0x4d')]===_0x014a('0x4b')){var _0x135e7e=_0x357ca1[_0x014a('0x23')]({'plain':!![]});var _0x4b2fdb=_0x014a('0x4e');return db['UserProfileSection'][_0x014a('0x48')]({'where':{'name':_0x4b2fdb,'userProfileId':_0x437f23[_0x014a('0x4f')]},'raw':!![]})[_0x014a('0x22')](function(_0x479dc0){if(_0x479dc0&&_0x479dc0[_0x014a('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x135e7e['name'],'resourceId':_0x135e7e['id'],'type':_0x479dc0['name'],'sectionId':_0x479dc0['id']},{})[_0x014a('0x22')](function(){return _0x357ca1;});}else{return _0x357ca1;}})['catch'](function(_0x1fe253){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1fe253);throw _0x1fe253;});}return _0x357ca1;})[_0x014a('0x22')](respondWithResult(_0x1a4df9,0xc9))['catch'](handleError(_0x1a4df9,null));};exports[_0x014a('0x20')]=function(_0x1e778d,_0x400633){if(_0x1e778d[_0x014a('0x4a')]['id']){delete _0x1e778d[_0x014a('0x4a')]['id'];}return db[_0x014a('0x2a')][_0x014a('0x48')]({'where':{'id':_0x1e778d[_0x014a('0x51')]['id']}})[_0x014a('0x22')](handleEntityNotFound(_0x400633,null))[_0x014a('0x22')](saveUpdates(_0x1e778d['body'],null))['then'](respondWithResult(_0x400633,null))[_0x014a('0x46')](handleError(_0x400633,null));};exports[_0x014a('0x21')]=function(_0x237345,_0x4cc246){return db['ContactItemType'][_0x014a('0x48')]({'where':{'id':_0x237345['params']['id']}})[_0x014a('0x22')](handleEntityNotFound(_0x4cc246,null))[_0x014a('0x22')](db[_0x014a('0x52')][_0x014a('0x20')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x237345['params']['id']}}))[_0x014a('0x22')](removeEntity(_0x4cc246,null))[_0x014a('0x46')](handleError(_0x4cc246,null));}; \ No newline at end of file +var _0x6a95=['get','ContactItemTypes','error','name','send','map','ContactItemType','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','show','keys','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy'];(function(_0x2eb042,_0x145afa){var _0x53636a=function(_0x16057c){while(--_0x16057c){_0x2eb042['push'](_0x2eb042['shift']());}};_0x53636a(++_0x145afa);}(_0x6a95,0x1db));var _0x56a9=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0x6a95[_0x2160a9];return _0xa88cf7;};'use strict';var emlformat=require(_0x56a9('0x0'));var rimraf=require(_0x56a9('0x1'));var zipdir=require(_0x56a9('0x2'));var jsonpatch=require(_0x56a9('0x3'));var rp=require(_0x56a9('0x4'));var moment=require(_0x56a9('0x5'));var BPromise=require(_0x56a9('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x56a9('0x7'));var sox=require(_0x56a9('0x8'));var csv=require(_0x56a9('0x9'));var ejs=require(_0x56a9('0xa'));var fs=require('fs');var fs_extra=require(_0x56a9('0xb'));var _=require(_0x56a9('0xc'));var squel=require(_0x56a9('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x56a9('0xe'));var toCsv=require(_0x56a9('0x9'));var querystring=require('querystring');var Papa=require(_0x56a9('0xf'));var Redis=require(_0x56a9('0x10'));var authService=require(_0x56a9('0x11'));var qs=require(_0x56a9('0x12'));var as=require(_0x56a9('0x13'));var hardwareService=require(_0x56a9('0x14'));var logger=require(_0x56a9('0x15'))(_0x56a9('0x16'));var utils=require(_0x56a9('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x56a9('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b2c7f,_0x4552ce){_0x4552ce=_0x4552ce||0xcc;return function(_0x420667){if(_0x420667){return _0x2b2c7f[_0x56a9('0x19')](_0x4552ce);}return _0x2b2c7f[_0x56a9('0x1a')](_0x4552ce)[_0x56a9('0x1b')]();};}function respondWithResult(_0x124ab8,_0x1a2eb4){_0x1a2eb4=_0x1a2eb4||0xc8;return function(_0x40b2cb){if(_0x40b2cb){return _0x124ab8['status'](_0x1a2eb4)['json'](_0x40b2cb);}};}function respondWithFilteredResult(_0x2e0dfd,_0x2a0714){return function(_0x42007b){if(_0x42007b){var _0x46f854=typeof _0x2a0714['offset']===_0x56a9('0x1c')&&typeof _0x2a0714['limit']==='undefined';var _0x4e292f=_0x42007b[_0x56a9('0x1d')];var _0x576bdf=_0x46f854?0x0:_0x2a0714[_0x56a9('0x1e')];var _0x105fe5=_0x46f854?_0x42007b[_0x56a9('0x1d')]:_0x2a0714[_0x56a9('0x1e')]+_0x2a0714[_0x56a9('0x1f')];var _0xbfeb1a;if(_0x105fe5>=_0x4e292f){_0x105fe5=_0x4e292f;_0xbfeb1a=0xc8;}else{_0xbfeb1a=0xce;}_0x2e0dfd[_0x56a9('0x1a')](_0xbfeb1a);return _0x2e0dfd[_0x56a9('0x20')](_0x56a9('0x21'),_0x576bdf+'-'+_0x105fe5+'/'+_0x4e292f)[_0x56a9('0x22')](_0x42007b);}return null;};}function patchUpdates(_0x5f145f){return function(_0x5bc03a){try{jsonpatch[_0x56a9('0x23')](_0x5bc03a,_0x5f145f,!![]);}catch(_0x16f9de){return BPromise[_0x56a9('0x24')](_0x16f9de);}return _0x5bc03a[_0x56a9('0x25')]();};}function saveUpdates(_0x4a09e5,_0x6100fe){return function(_0x3355c4){if(_0x3355c4){return _0x3355c4[_0x56a9('0x26')](_0x4a09e5)[_0x56a9('0x27')](function(_0x5a82e0){return _0x5a82e0;});}return null;};}function removeEntity(_0x44762e,_0x32839b){return function(_0x21ab38){if(_0x21ab38){return _0x21ab38[_0x56a9('0x28')]()[_0x56a9('0x27')](function(){var _0x52016c=_0x21ab38[_0x56a9('0x29')]({'plain':!![]});var _0x217bda=_0x56a9('0x2a');return db['UserProfileResource'][_0x56a9('0x28')]({'where':{'type':_0x217bda,'resourceId':_0x52016c['id']}})['then'](function(){return _0x21ab38;});})[_0x56a9('0x27')](function(){_0x44762e[_0x56a9('0x1a')](0xcc)[_0x56a9('0x1b')]();});}};}function handleEntityNotFound(_0x20432a,_0x45f38c){return function(_0x1afe8a){if(!_0x1afe8a){_0x20432a[_0x56a9('0x19')](0x194);}return _0x1afe8a;};}function handleError(_0xff5f55,_0x51fd64){_0x51fd64=_0x51fd64||0x1f4;return function(_0x437ccf){logger[_0x56a9('0x2b')](_0x437ccf['stack']);if(_0x437ccf[_0x56a9('0x2c')]){delete _0x437ccf['name'];}_0xff5f55['status'](_0x51fd64)[_0x56a9('0x2d')](_0x437ccf);};}exports['index']=function(_0x2f933a,_0x11002a){var _0x2fbd5d={},_0x2c1c3d={},_0x5879db={'count':0x0,'rows':[]};var _0x332707=_[_0x56a9('0x2e')](db[_0x56a9('0x2f')][_0x56a9('0x30')],function(_0xbbb47d){return{'name':_0xbbb47d[_0x56a9('0x31')],'type':_0xbbb47d[_0x56a9('0x32')][_0x56a9('0x33')]};});_0x2c1c3d[_0x56a9('0x34')]=_[_0x56a9('0x2e')](_0x332707,_0x56a9('0x2c'));_0x2c1c3d[_0x56a9('0x35')]=_['keys'](_0x2f933a[_0x56a9('0x35')]);_0x2c1c3d[_0x56a9('0x36')]=_[_0x56a9('0x37')](_0x2c1c3d['model'],_0x2c1c3d[_0x56a9('0x35')]);_0x2fbd5d['attributes']=_['intersection'](_0x2c1c3d['model'],qs[_0x56a9('0x38')](_0x2f933a[_0x56a9('0x35')]['fields']));_0x2fbd5d['attributes']=_0x2fbd5d[_0x56a9('0x39')][_0x56a9('0x3a')]?_0x2fbd5d[_0x56a9('0x39')]:_0x2c1c3d[_0x56a9('0x34')];if(!_0x2f933a[_0x56a9('0x35')][_0x56a9('0x3b')](_0x56a9('0x3c'))){_0x2fbd5d[_0x56a9('0x1f')]=qs[_0x56a9('0x1f')](_0x2f933a[_0x56a9('0x35')]['limit']);_0x2fbd5d['offset']=qs['offset'](_0x2f933a['query'][_0x56a9('0x1e')]);}_0x2fbd5d[_0x56a9('0x3d')]=qs['sort'](_0x2f933a[_0x56a9('0x35')][_0x56a9('0x3e')]);_0x2fbd5d[_0x56a9('0x3f')]=qs[_0x56a9('0x36')](_[_0x56a9('0x40')](_0x2f933a[_0x56a9('0x35')],_0x2c1c3d[_0x56a9('0x36')]),_0x332707);if(_0x2f933a['query'][_0x56a9('0x41')]){_0x2fbd5d[_0x56a9('0x3f')]=_['merge'](_0x2fbd5d['where'],{'$or':_[_0x56a9('0x2e')](_0x332707,function(_0x1180c6){if(_0x1180c6[_0x56a9('0x32')]!==_0x56a9('0x42')){var _0x158504={};_0x158504[_0x1180c6[_0x56a9('0x2c')]]={'$like':'%'+_0x2f933a[_0x56a9('0x35')][_0x56a9('0x41')]+'%'};return _0x158504;}})});}_0x2fbd5d=_[_0x56a9('0x43')]({},_0x2fbd5d,_0x2f933a[_0x56a9('0x44')]);var _0x9f24ea={'where':_0x2fbd5d[_0x56a9('0x3f')]};return db[_0x56a9('0x2f')][_0x56a9('0x1d')](_0x9f24ea)[_0x56a9('0x27')](function(_0xe57cfb){_0x5879db[_0x56a9('0x1d')]=_0xe57cfb;if(_0x2f933a[_0x56a9('0x35')]['includeAll']){_0x2fbd5d[_0x56a9('0x45')]=[{'all':!![]}];}return db[_0x56a9('0x2f')][_0x56a9('0x46')](_0x2fbd5d);})['then'](function(_0x1f8b30){_0x5879db['rows']=_0x1f8b30;return _0x5879db;})[_0x56a9('0x27')](respondWithFilteredResult(_0x11002a,_0x2fbd5d))['catch'](handleError(_0x11002a,null));};exports[_0x56a9('0x47')]=function(_0x39c445,_0x3998f1){var _0x49286b={'raw':!![],'where':{'id':_0x39c445['params']['id']}},_0x5192d8={};_0x5192d8['model']=_[_0x56a9('0x48')](db[_0x56a9('0x2f')][_0x56a9('0x30')]);_0x5192d8[_0x56a9('0x35')]=_[_0x56a9('0x48')](_0x39c445[_0x56a9('0x35')]);_0x5192d8[_0x56a9('0x36')]=_[_0x56a9('0x37')](_0x5192d8[_0x56a9('0x34')],_0x5192d8[_0x56a9('0x35')]);_0x49286b[_0x56a9('0x39')]=_[_0x56a9('0x37')](_0x5192d8[_0x56a9('0x34')],qs[_0x56a9('0x38')](_0x39c445['query'][_0x56a9('0x38')]));_0x49286b[_0x56a9('0x39')]=_0x49286b[_0x56a9('0x39')]['length']?_0x49286b[_0x56a9('0x39')]:_0x5192d8[_0x56a9('0x34')];if(_0x39c445['query'][_0x56a9('0x49')]){_0x49286b[_0x56a9('0x45')]=[{'all':!![]}];}_0x49286b=_[_0x56a9('0x43')]({},_0x49286b,_0x39c445[_0x56a9('0x44')]);return db['ContactItemType'][_0x56a9('0x4a')](_0x49286b)[_0x56a9('0x27')](handleEntityNotFound(_0x3998f1,null))[_0x56a9('0x27')](respondWithResult(_0x3998f1,null))[_0x56a9('0x4b')](handleError(_0x3998f1,null));};exports[_0x56a9('0x4c')]=function(_0x3942d8,_0x31aaf5){return db[_0x56a9('0x2f')][_0x56a9('0x4c')](_0x3942d8[_0x56a9('0x4d')],{})[_0x56a9('0x27')](function(_0x500656){var _0x58d370=_0x3942d8[_0x56a9('0x4e')][_0x56a9('0x29')]({'plain':!![]});if(!_0x58d370)throw new Error(_0x56a9('0x4f'));if(_0x58d370[_0x56a9('0x50')]==='user'){var _0x1986f2=_0x500656[_0x56a9('0x29')]({'plain':!![]});var _0x26ad3e=_0x56a9('0x2a');return db['UserProfileSection'][_0x56a9('0x4a')]({'where':{'name':_0x26ad3e,'userProfileId':_0x58d370[_0x56a9('0x51')]},'raw':!![]})['then'](function(_0x1ff42f){if(_0x1ff42f&&_0x1ff42f[_0x56a9('0x52')]===0x0){return db['UserProfileResource'][_0x56a9('0x4c')]({'name':_0x1986f2[_0x56a9('0x2c')],'resourceId':_0x1986f2['id'],'type':_0x1ff42f[_0x56a9('0x2c')],'sectionId':_0x1ff42f['id']},{})[_0x56a9('0x27')](function(){return _0x500656;});}else{return _0x500656;}})['catch'](function(_0x4938d6){logger[_0x56a9('0x2b')](_0x56a9('0x53'),_0x4938d6);throw _0x4938d6;});}return _0x500656;})[_0x56a9('0x27')](respondWithResult(_0x31aaf5,0xc9))[_0x56a9('0x4b')](handleError(_0x31aaf5,null));};exports[_0x56a9('0x26')]=function(_0xce9dc0,_0x798b4e){if(_0xce9dc0[_0x56a9('0x4d')]['id']){delete _0xce9dc0[_0x56a9('0x4d')]['id'];}return db[_0x56a9('0x2f')]['find']({'where':{'id':_0xce9dc0[_0x56a9('0x54')]['id']}})[_0x56a9('0x27')](handleEntityNotFound(_0x798b4e,null))[_0x56a9('0x27')](saveUpdates(_0xce9dc0[_0x56a9('0x4d')],null))[_0x56a9('0x27')](respondWithResult(_0x798b4e,null))[_0x56a9('0x4b')](handleError(_0x798b4e,null));};exports[_0x56a9('0x28')]=function(_0x488577,_0x870aa5){return db[_0x56a9('0x2f')][_0x56a9('0x4a')]({'where':{'id':_0x488577[_0x56a9('0x54')]['id']}})[_0x56a9('0x27')](handleEntityNotFound(_0x870aa5,null))[_0x56a9('0x27')](db[_0x56a9('0x55')]['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x488577[_0x56a9('0x54')]['id']}}))['then'](removeEntity(_0x870aa5,null))['catch'](handleError(_0x870aa5,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 51d49d5..9444348 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 _0x45cf=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','util'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x45cf,0x8f));var _0xf45c=function(_0x4343b6,_0x3bd4d4){_0x4343b6=_0x4343b6-0x0;var _0x5be505=_0x45cf[_0x4343b6];return _0x5be505;};'use strict';var _=require('lodash');var util=require(_0xf45c('0x0'));var logger=require(_0xf45c('0x1'))('api');var moment=require(_0xf45c('0x2'));var BPromise=require(_0xf45c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf45c('0x4'));var rimraf=require(_0xf45c('0x5'));var config=require(_0xf45c('0x6'));var attributes=require(_0xf45c('0x7'));module[_0xf45c('0x8')]=function(_0x540d30,_0x57c69d){return _0x540d30[_0xf45c('0x9')](_0xf45c('0xa'),attributes,{'tableName':_0xf45c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fbc=['exports','ContactItemType','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes'];(function(_0x47ce41,_0x1a5136){var _0x342ee1=function(_0x4ddc75){while(--_0x4ddc75){_0x47ce41['push'](_0x47ce41['shift']());}};_0x342ee1(++_0x1a5136);}(_0x7fbc,0xde));var _0xc7fb=function(_0xc67fe1,_0x56c68b){_0xc67fe1=_0xc67fe1-0x0;var _0x215008=_0x7fbc[_0xc67fe1];return _0x215008;};'use strict';var _=require(_0xc7fb('0x0'));var util=require('util');var logger=require(_0xc7fb('0x1'))('api');var moment=require('moment');var BPromise=require(_0xc7fb('0x2'));var rp=require(_0xc7fb('0x3'));var fs=require('fs');var path=require(_0xc7fb('0x4'));var rimraf=require(_0xc7fb('0x5'));var config=require(_0xc7fb('0x6'));var attributes=require(_0xc7fb('0x7'));module[_0xc7fb('0x8')]=function(_0x4261c8,_0x126392){return _0x4261c8['define'](_0xc7fb('0x9'),attributes,{'tableName':'tools_contact_item_types','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 36ff306..5bb231d 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 _0x7cd8=['randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird'];(function(_0x3d9312,_0x3363fc){var _0x3a0a42=function(_0x58cad2){while(--_0x58cad2){_0x3d9312['push'](_0x3d9312['shift']());}};_0x3a0a42(++_0x3363fc);}(_0x7cd8,0x1f4));var _0x87cd=function(_0x3bcc31,_0x331645){_0x3bcc31=_0x3bcc31-0x0;var _0x59f119=_0x7cd8[_0x3bcc31];return _0x59f119;};'use strict';var _=require(_0x87cd('0x0'));var util=require(_0x87cd('0x1'));var moment=require(_0x87cd('0x2'));var BPromise=require(_0x87cd('0x3'));var rs=require(_0x87cd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x87cd('0x5'))['db'];var utils=require(_0x87cd('0x6'));var logger=require('../../config/logger')(_0x87cd('0x7'));var config=require(_0x87cd('0x8'));var jayson=require(_0x87cd('0x9'));var client=jayson[_0x87cd('0xa')][_0x87cd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10df3,_0x435a09,_0xb04e29){return new BPromise(function(_0x1a9864,_0x38c38e){return client['request'](_0x10df3,_0xb04e29)[_0x87cd('0xc')](function(_0x95fd7e){logger[_0x87cd('0xd')](_0x87cd('0xe'),_0x435a09,_0x87cd('0xf'));logger['debug'](_0x87cd('0x10'),_0x435a09,_0x87cd('0xf'),JSON[_0x87cd('0x11')](_0x95fd7e));if(_0x95fd7e['error']){if(_0x95fd7e[_0x87cd('0x12')]['code']===0x1f4){logger[_0x87cd('0x12')](_0x87cd('0xe'),_0x435a09,_0x95fd7e[_0x87cd('0x12')][_0x87cd('0x13')]);return _0x38c38e(_0x95fd7e[_0x87cd('0x12')][_0x87cd('0x13')]);}logger['error'](_0x87cd('0xe'),_0x435a09,_0x95fd7e[_0x87cd('0x12')]['message']);return _0x1a9864(_0x95fd7e[_0x87cd('0x12')][_0x87cd('0x13')]);}else{logger[_0x87cd('0xd')](_0x87cd('0xe'),_0x435a09,_0x87cd('0xf'));_0x1a9864(_0x95fd7e[_0x87cd('0x14')][_0x87cd('0x13')]);}})['catch'](function(_0x2fe65c){logger[_0x87cd('0x12')]('ContactItemType,\x20%s,\x20%s',_0x435a09,_0x2fe65c);_0x38c38e(_0x2fe65c);});});} \ No newline at end of file +var _0x6a7a=['then','info','debug','ContactItemType,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ContactItemType,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request'];(function(_0x224fb5,_0x13f5c2){var _0xf5f4b8=function(_0x3b5eb3){while(--_0x3b5eb3){_0x224fb5['push'](_0x224fb5['shift']());}};_0xf5f4b8(++_0x13f5c2);}(_0x6a7a,0x1ad));var _0xa6a7=function(_0x5d1e3c,_0x369af4){_0x5d1e3c=_0x5d1e3c-0x0;var _0x37495f=_0x6a7a[_0x5d1e3c];return _0x37495f;};'use strict';var _=require(_0xa6a7('0x0'));var util=require(_0xa6a7('0x1'));var moment=require(_0xa6a7('0x2'));var BPromise=require(_0xa6a7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa6a7('0x4'));var db=require(_0xa6a7('0x5'))['db'];var utils=require(_0xa6a7('0x6'));var logger=require('../../config/logger')(_0xa6a7('0x7'));var config=require(_0xa6a7('0x8'));var jayson=require(_0xa6a7('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x262ea0,_0x4e1991,_0x5b83e7){return new BPromise(function(_0x2ff096,_0xb1109d){return client[_0xa6a7('0xa')](_0x262ea0,_0x5b83e7)[_0xa6a7('0xb')](function(_0x1f2bae){logger[_0xa6a7('0xc')]('ContactItemType,\x20%s,\x20%s',_0x4e1991,'request\x20sent');logger[_0xa6a7('0xd')](_0xa6a7('0xe'),_0x4e1991,_0xa6a7('0xf'),JSON['stringify'](_0x1f2bae));if(_0x1f2bae[_0xa6a7('0x10')]){if(_0x1f2bae[_0xa6a7('0x10')][_0xa6a7('0x11')]===0x1f4){logger[_0xa6a7('0x10')](_0xa6a7('0x12'),_0x4e1991,_0x1f2bae[_0xa6a7('0x10')][_0xa6a7('0x13')]);return _0xb1109d(_0x1f2bae['error'][_0xa6a7('0x13')]);}logger[_0xa6a7('0x10')](_0xa6a7('0x12'),_0x4e1991,_0x1f2bae[_0xa6a7('0x10')][_0xa6a7('0x13')]);return _0x2ff096(_0x1f2bae[_0xa6a7('0x10')][_0xa6a7('0x13')]);}else{logger[_0xa6a7('0xc')](_0xa6a7('0x12'),_0x4e1991,_0xa6a7('0xf'));_0x2ff096(_0x1f2bae[_0xa6a7('0x14')][_0xa6a7('0x13')]);}})[_0xa6a7('0x15')](function(_0x505b71){logger[_0xa6a7('0x10')](_0xa6a7('0x12'),_0x4e1991,_0x505b71);_0xb1109d(_0x505b71);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index ef3a7c0..d8524e5 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 _0xefd3=['post','create','put','update','delete','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','/:id','show'];(function(_0x538574,_0x4cd6df){var _0x116565=function(_0x1961bd){while(--_0x1961bd){_0x538574['push'](_0x538574['shift']());}};_0x116565(++_0x4cd6df);}(_0xefd3,0x1e5));var _0x3efd=function(_0x1a215d,_0x5d580b){_0x1a215d=_0x1a215d-0x0;var _0x5c5b3d=_0xefd3[_0x1a215d];return _0x5c5b3d;};'use strict';var multer=require('multer');var util=require(_0x3efd('0x0'));var path=require(_0x3efd('0x1'));var timeout=require(_0x3efd('0x2'));var express=require(_0x3efd('0x3'));var router=express[_0x3efd('0x4')]();var fs_extra=require(_0x3efd('0x5'));var auth=require(_0x3efd('0x6'));var interaction=require(_0x3efd('0x7'));var config=require(_0x3efd('0x8'));var controller=require(_0x3efd('0x9'));router[_0x3efd('0xa')]('/',auth[_0x3efd('0xb')](),controller[_0x3efd('0xc')]);router[_0x3efd('0xa')](_0x3efd('0xd'),auth['isAuthenticated'](),controller[_0x3efd('0xe')]);router[_0x3efd('0xf')]('/',auth['isAuthenticated'](),controller[_0x3efd('0x10')]);router[_0x3efd('0x11')](_0x3efd('0xd'),auth[_0x3efd('0xb')](),controller[_0x3efd('0x12')]);router[_0x3efd('0x13')](_0x3efd('0xd'),auth[_0x3efd('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb74d=['index','get','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./contactItemType.controller','isAuthenticated'];(function(_0x1c8a17,_0x266d09){var _0x1a2129=function(_0x5e727e){while(--_0x5e727e){_0x1c8a17['push'](_0x1c8a17['shift']());}};_0x1a2129(++_0x266d09);}(_0xb74d,0x69));var _0xdb74=function(_0x547e20,_0x284545){_0x547e20=_0x547e20-0x0;var _0x359171=_0xb74d[_0x547e20];return _0x359171;};'use strict';var multer=require(_0xdb74('0x0'));var util=require(_0xdb74('0x1'));var path=require(_0xdb74('0x2'));var timeout=require(_0xdb74('0x3'));var express=require(_0xdb74('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdb74('0x5'));var interaction=require(_0xdb74('0x6'));var config=require('../../config/environment');var controller=require(_0xdb74('0x7'));router['get']('/',auth[_0xdb74('0x8')](),controller[_0xdb74('0x9')]);router[_0xdb74('0xa')](_0xdb74('0xb'),auth['isAuthenticated'](),controller[_0xdb74('0xc')]);router[_0xdb74('0xd')]('/',auth[_0xdb74('0x8')](),controller['create']);router[_0xdb74('0xe')](_0xdb74('0xb'),auth[_0xdb74('0x8')](),controller[_0xdb74('0xf')]);router[_0xdb74('0x10')]('/:id',auth[_0xdb74('0x8')](),controller[_0xdb74('0x11')]);module[_0xdb74('0x12')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index cb99fc5..78ec39c 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 _0xb7e7=['STRING','sequelize'];(function(_0x59d0cc,_0xa7c52b){var _0x2ae79f=function(_0x33042e){while(--_0x33042e){_0x59d0cc['push'](_0x59d0cc['shift']());}};_0x2ae79f(++_0xa7c52b);}(_0xb7e7,0x121));var _0x7b7e=function(_0x75f869,_0x3690d6){_0x75f869=_0x75f869-0x0;var _0x10af8b=_0xb7e7[_0x75f869];return _0x10af8b;};'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 +var _0xbaf0=['name','exports','STRING'];(function(_0x187279,_0x26d152){var _0x3da59d=function(_0x41c808){while(--_0x41c808){_0x187279['push'](_0x187279['shift']());}};_0x3da59d(++_0x26d152);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 3ac6e7e..b1b9a92 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 _0xaac8=['filter','options','includeAll','include','findAll','catch','params','keys','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','updatedAt','omit','Unable\x20to\x20retrieve\x20the\x20current\x20user','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrFaxAccounts','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','addItem','findOne','DashboardItem','getItems','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','redis','defaults','./dashboard.socket','register','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','destroy','get','CustomDashboards','UserProfileResource','then','end','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL'];(function(_0xc31a27,_0x54f1bc){var _0x25e7d1=function(_0x2a5fc2){while(--_0x2a5fc2){_0xc31a27['push'](_0xc31a27['shift']());}};_0x25e7d1(++_0x54f1bc);}(_0xaac8,0xb9));var _0x8aac=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xaac8[_0x4a53d];return _0x27410e;};'use strict';var emlformat=require(_0x8aac('0x0'));var rimraf=require(_0x8aac('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8aac('0x2'));var rp=require(_0x8aac('0x3'));var moment=require('moment');var BPromise=require(_0x8aac('0x4'));var Mustache=require(_0x8aac('0x5'));var util=require('util');var path=require(_0x8aac('0x6'));var sox=require(_0x8aac('0x7'));var csv=require(_0x8aac('0x8'));var ejs=require(_0x8aac('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8aac('0xa'));var squel=require(_0x8aac('0xb'));var crypto=require('crypto');var jsforce=require(_0x8aac('0xc'));var deskjs=require(_0x8aac('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8aac('0xe'));var Papa=require(_0x8aac('0xf'));var Redis=require('ioredis');var authService=require(_0x8aac('0x10'));var qs=require(_0x8aac('0x11'));var as=require(_0x8aac('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8aac('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8aac('0x14'));var db=require('../../mysqldb')['db'];config[_0x8aac('0x15')]=_[_0x8aac('0x16')](config[_0x8aac('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8aac('0x15')]));require(_0x8aac('0x17'))[_0x8aac('0x18')](socket);function respondWithStatusCode(_0x20f9b3,_0x47733d){_0x47733d=_0x47733d||0xcc;return function(_0x1dccdb){if(_0x1dccdb){return _0x20f9b3[_0x8aac('0x19')](_0x47733d);}return _0x20f9b3['status'](_0x47733d)['end']();};}function respondWithResult(_0x2049de,_0x2bce28){_0x2bce28=_0x2bce28||0xc8;return function(_0x47e350){if(_0x47e350){return _0x2049de[_0x8aac('0x1a')](_0x2bce28)[_0x8aac('0x1b')](_0x47e350);}};}function respondWithFilteredResult(_0x47b334,_0x54fd7d){return function(_0x40631e){if(_0x40631e){var _0x2f077b=typeof _0x54fd7d['offset']===_0x8aac('0x1c')&&typeof _0x54fd7d['limit']===_0x8aac('0x1c');var _0x37fdd5=_0x40631e[_0x8aac('0x1d')];var _0x5ceb9c=_0x2f077b?0x0:_0x54fd7d[_0x8aac('0x1e')];var _0x367443=_0x2f077b?_0x40631e[_0x8aac('0x1d')]:_0x54fd7d[_0x8aac('0x1e')]+_0x54fd7d[_0x8aac('0x1f')];var _0x378184;if(_0x367443>=_0x37fdd5){_0x367443=_0x37fdd5;_0x378184=0xc8;}else{_0x378184=0xce;}_0x47b334[_0x8aac('0x1a')](_0x378184);return _0x47b334[_0x8aac('0x20')](_0x8aac('0x21'),_0x5ceb9c+'-'+_0x367443+'/'+_0x37fdd5)[_0x8aac('0x1b')](_0x40631e);}return null;};}function patchUpdates(_0x41dc54){return function(_0x1dee3e){try{jsonpatch[_0x8aac('0x22')](_0x1dee3e,_0x41dc54,!![]);}catch(_0x313734){return BPromise['reject'](_0x313734);}return _0x1dee3e[_0x8aac('0x23')]();};}function saveUpdates(_0x294d2d,_0xe9dcd3){return function(_0x2d0d8b){if(_0x2d0d8b){return _0x2d0d8b[_0x8aac('0x24')](_0x294d2d)['then'](function(_0x2158eb){return _0x2158eb;});}return null;};}function removeEntity(_0x1e6b49,_0x2fd3ba){return function(_0x1ceae9){if(_0x1ceae9){return _0x1ceae9[_0x8aac('0x25')]()['then'](function(){var _0x5981c9=_0x1ceae9[_0x8aac('0x26')]({'plain':!![]});var _0x30b505=_0x8aac('0x27');return db[_0x8aac('0x28')][_0x8aac('0x25')]({'where':{'type':_0x30b505,'resourceId':_0x5981c9['id']}})[_0x8aac('0x29')](function(){return _0x1ceae9;});})[_0x8aac('0x29')](function(){_0x1e6b49[_0x8aac('0x1a')](0xcc)[_0x8aac('0x2a')]();});}};}function handleEntityNotFound(_0x23f02a,_0x20f473){return function(_0x599332){if(!_0x599332){_0x23f02a[_0x8aac('0x19')](0x194);}return _0x599332;};}function handleError(_0x1c91fe,_0x534d4d){_0x534d4d=_0x534d4d||0x1f4;return function(_0x9f05fd){logger[_0x8aac('0x2b')](_0x9f05fd[_0x8aac('0x2c')]);if(_0x9f05fd[_0x8aac('0x2d')]){delete _0x9f05fd[_0x8aac('0x2d')];}_0x1c91fe[_0x8aac('0x1a')](_0x534d4d)[_0x8aac('0x2e')](_0x9f05fd);};}exports[_0x8aac('0x2f')]=function(_0x364978,_0x28d11f){var _0x3f6160={},_0x508272={},_0x9e35f6={'count':0x0,'rows':[]};var _0x2521e1=_[_0x8aac('0x30')](db[_0x8aac('0x31')][_0x8aac('0x32')],function(_0x2ecccc){return{'name':_0x2ecccc[_0x8aac('0x33')],'type':_0x2ecccc[_0x8aac('0x34')][_0x8aac('0x35')]};});_0x508272[_0x8aac('0x36')]=_[_0x8aac('0x30')](_0x2521e1,_0x8aac('0x2d'));_0x508272['query']=_['keys'](_0x364978[_0x8aac('0x37')]);_0x508272[_0x8aac('0x38')]=_[_0x8aac('0x39')](_0x508272[_0x8aac('0x36')],_0x508272['query']);_0x3f6160[_0x8aac('0x3a')]=_['intersection'](_0x508272[_0x8aac('0x36')],qs[_0x8aac('0x3b')](_0x364978[_0x8aac('0x37')]['fields']));_0x3f6160[_0x8aac('0x3a')]=_0x3f6160[_0x8aac('0x3a')][_0x8aac('0x3c')]?_0x3f6160[_0x8aac('0x3a')]:_0x508272[_0x8aac('0x36')];if(!_0x364978['query'][_0x8aac('0x3d')](_0x8aac('0x3e'))){_0x3f6160[_0x8aac('0x1f')]=qs[_0x8aac('0x1f')](_0x364978[_0x8aac('0x37')][_0x8aac('0x1f')]);_0x3f6160[_0x8aac('0x1e')]=qs[_0x8aac('0x1e')](_0x364978[_0x8aac('0x37')][_0x8aac('0x1e')]);}_0x3f6160[_0x8aac('0x3f')]=qs[_0x8aac('0x40')](_0x364978['query'][_0x8aac('0x40')]);_0x3f6160[_0x8aac('0x41')]=qs['filters'](_[_0x8aac('0x42')](_0x364978[_0x8aac('0x37')],_0x508272[_0x8aac('0x38')]),_0x2521e1);if(_0x364978[_0x8aac('0x37')]['filter']){_0x3f6160[_0x8aac('0x41')]=_[_0x8aac('0x43')](_0x3f6160[_0x8aac('0x41')],{'$or':_[_0x8aac('0x30')](_0x2521e1,function(_0xd1a1db){if(_0xd1a1db[_0x8aac('0x34')]!==_0x8aac('0x44')){var _0x3a4c17={};_0x3a4c17[_0xd1a1db[_0x8aac('0x2d')]]={'$like':'%'+_0x364978[_0x8aac('0x37')][_0x8aac('0x45')]+'%'};return _0x3a4c17;}})});}_0x3f6160=_[_0x8aac('0x43')]({},_0x3f6160,_0x364978[_0x8aac('0x46')]);var _0x158518={'where':_0x3f6160['where']};return db[_0x8aac('0x31')][_0x8aac('0x1d')](_0x158518)['then'](function(_0x9f1a6d){_0x9e35f6[_0x8aac('0x1d')]=_0x9f1a6d;if(_0x364978[_0x8aac('0x37')][_0x8aac('0x47')]){_0x3f6160[_0x8aac('0x48')]=[{'all':!![]}];}return db[_0x8aac('0x31')][_0x8aac('0x49')](_0x3f6160);})[_0x8aac('0x29')](function(_0x2f5a42){_0x9e35f6['rows']=_0x2f5a42;return _0x9e35f6;})[_0x8aac('0x29')](respondWithFilteredResult(_0x28d11f,_0x3f6160))[_0x8aac('0x4a')](handleError(_0x28d11f,null));};exports['show']=function(_0x389915,_0x1c7bd5){var _0x823ccc={'raw':![],'where':{'id':_0x389915[_0x8aac('0x4b')]['id']}},_0x314083={};_0x314083[_0x8aac('0x36')]=_[_0x8aac('0x4c')](db[_0x8aac('0x31')][_0x8aac('0x32')]);_0x314083[_0x8aac('0x37')]=_[_0x8aac('0x4c')](_0x389915[_0x8aac('0x37')]);_0x314083[_0x8aac('0x38')]=_[_0x8aac('0x39')](_0x314083[_0x8aac('0x36')],_0x314083[_0x8aac('0x37')]);_0x823ccc[_0x8aac('0x3a')]=_['intersection'](_0x314083[_0x8aac('0x36')],qs[_0x8aac('0x3b')](_0x389915[_0x8aac('0x37')][_0x8aac('0x3b')]));_0x823ccc[_0x8aac('0x3a')]=_0x823ccc[_0x8aac('0x3a')]['length']?_0x823ccc[_0x8aac('0x3a')]:_0x314083['model'];if(_0x389915[_0x8aac('0x37')][_0x8aac('0x47')]){_0x823ccc[_0x8aac('0x48')]=[{'all':!![]}];}_0x823ccc=_[_0x8aac('0x43')]({},_0x823ccc,_0x389915['options']);return db[_0x8aac('0x31')][_0x8aac('0x4d')](_0x823ccc)[_0x8aac('0x29')](handleEntityNotFound(_0x1c7bd5,null))[_0x8aac('0x29')](respondWithResult(_0x1c7bd5,null))[_0x8aac('0x4a')](handleError(_0x1c7bd5,null));};exports['create']=function(_0x1e1da5,_0xd71c7d){return db[_0x8aac('0x31')][_0x8aac('0x4e')](_0x1e1da5[_0x8aac('0x4f')],{})['then'](function(_0x375317){var _0x5c5989=_0x1e1da5[_0x8aac('0x50')][_0x8aac('0x26')]({'plain':!![]});if(!_0x5c5989)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5c5989[_0x8aac('0x51')]===_0x8aac('0x50')){var _0x5f0869=_0x375317[_0x8aac('0x26')]({'plain':!![]});var _0x599007=_0x8aac('0x27');return db[_0x8aac('0x52')][_0x8aac('0x4d')]({'where':{'name':_0x599007,'userProfileId':_0x5c5989[_0x8aac('0x53')]},'raw':!![]})[_0x8aac('0x29')](function(_0x37e279){if(_0x37e279&&_0x37e279[_0x8aac('0x54')]===0x0){return db['UserProfileResource'][_0x8aac('0x4e')]({'name':_0x5f0869[_0x8aac('0x2d')],'resourceId':_0x5f0869['id'],'type':_0x37e279[_0x8aac('0x2d')],'sectionId':_0x37e279['id']},{})['then'](function(){return _0x375317;});}else{return _0x375317;}})[_0x8aac('0x4a')](function(_0x324d2c){logger[_0x8aac('0x2b')](_0x8aac('0x55'),_0x324d2c);throw _0x324d2c;});}return _0x375317;})[_0x8aac('0x29')](respondWithResult(_0xd71c7d,0xc9))[_0x8aac('0x4a')](handleError(_0xd71c7d,null));};exports['clone']=function(_0x25781d,_0x2fc884){var _0x7ddecc={'where':{'id':_0x25781d[_0x8aac('0x4b')]['id']}},_0x3ae429={};_0x3ae429['model']=_[_0x8aac('0x4c')](db[_0x8aac('0x31')][_0x8aac('0x32')]);_0x7ddecc[_0x8aac('0x3a')]=_[_0x8aac('0x39')](_0x3ae429[_0x8aac('0x36')],qs[_0x8aac('0x3b')](_0x25781d[_0x8aac('0x37')]['fields']));_0x7ddecc[_0x8aac('0x3a')]=_0x7ddecc[_0x8aac('0x3a')][_0x8aac('0x3c')]?_0x7ddecc[_0x8aac('0x3a')]:_0x3ae429[_0x8aac('0x36')];if(_0x25781d[_0x8aac('0x37')][_0x8aac('0x47')]){_0x7ddecc[_0x8aac('0x48')]=[{'all':!![]}];}_0x7ddecc=_[_0x8aac('0x43')]({},_0x7ddecc,_0x25781d[_0x8aac('0x46')]);return db[_0x8aac('0x31')][_0x8aac('0x4d')](_0x7ddecc)[_0x8aac('0x29')](handleEntityNotFound(_0x2fc884,null))[_0x8aac('0x29')](function(_0x3454d1){if(_0x3454d1){var _0x26dece=_0x3454d1[_0x8aac('0x26')]({'plain':!![]});_0x26dece=qs['omit'](_0x26dece,['id',_0x8aac('0x56'),_0x8aac('0x57')]);_0x25781d[_0x8aac('0x4f')]=_[_0x8aac('0x58')](_0x25781d['body'],['id',_0x8aac('0x56'),_0x8aac('0x57')]);return db[_0x8aac('0x31')][_0x8aac('0x4e')](_[_0x8aac('0x43')](_0x26dece,_0x25781d[_0x8aac('0x4f')]),{'include':_0x25781d[_0x8aac('0x37')][_0x8aac('0x47')]?[{'all':!![]}]:undefined})['then'](function(_0x5779c7){var _0x2c1b24=_0x25781d['user']['get']({'plain':!![]});if(!_0x2c1b24)throw new Error(_0x8aac('0x59'));if(_0x2c1b24[_0x8aac('0x51')]===_0x8aac('0x50')){var _0x43a3c9=_0x5779c7[_0x8aac('0x26')]({'plain':!![]});var _0x1030e7=_0x8aac('0x27');return db[_0x8aac('0x52')][_0x8aac('0x4d')]({'where':{'name':_0x1030e7,'userProfileId':_0x2c1b24[_0x8aac('0x53')]},'raw':!![]})[_0x8aac('0x29')](function(_0xf06e44){if(_0xf06e44&&_0xf06e44[_0x8aac('0x54')]===0x0){return db[_0x8aac('0x28')]['create']({'name':_0x43a3c9['name'],'resourceId':_0x43a3c9['id'],'type':_0xf06e44[_0x8aac('0x2d')],'sectionId':_0xf06e44['id']},{})['then'](function(){return _0x5779c7;});}else{return _0x5779c7;}})['catch'](function(_0x4180de){logger[_0x8aac('0x2b')](_0x8aac('0x55'),_0x4180de);throw _0x4180de;});}return _0x5779c7;});}})['then'](respondWithResult(_0x2fc884,0xc9))[_0x8aac('0x4a')](handleError(_0x2fc884,null));};exports[_0x8aac('0x24')]=function(_0x3bc8df,_0x56f0e4){if(_0x3bc8df[_0x8aac('0x4f')]['id']){delete _0x3bc8df[_0x8aac('0x4f')]['id'];}return db[_0x8aac('0x31')][_0x8aac('0x4d')]({'where':{'id':_0x3bc8df[_0x8aac('0x4b')]['id']}})[_0x8aac('0x29')](handleEntityNotFound(_0x56f0e4,null))[_0x8aac('0x29')](saveUpdates(_0x3bc8df[_0x8aac('0x4f')],null))[_0x8aac('0x29')](respondWithResult(_0x56f0e4,null))[_0x8aac('0x4a')](handleError(_0x56f0e4,null));};exports[_0x8aac('0x25')]=function(_0x5d4879,_0x2131df){return db[_0x8aac('0x31')][_0x8aac('0x4d')]({'where':{'id':_0x5d4879[_0x8aac('0x4b')]['id']}})[_0x8aac('0x29')](handleEntityNotFound(_0x2131df,null))['then'](removeEntity(_0x2131df,null))[_0x8aac('0x4a')](handleError(_0x2131df,null));};function widgetAttributes(_0x25a0ab){try{switch(_0x25a0ab[_0x8aac('0x34')]){case _0x8aac('0x5a'):return[{'name':'attrUrl','value':_0x25a0ab[_0x8aac('0x5b')]||(_0x25a0ab['attrs']&&_0x25a0ab[_0x8aac('0x5c')][0x0]?_0x25a0ab['attrs'][0x0][_0x8aac('0x5d')]:undefined)||_0x8aac('0x5e')}];case'custom':return[{'name':_0x8aac('0x5f'),'value':_0x25a0ab[_0x8aac('0x5f')]||(_0x25a0ab[_0x8aac('0x5c')]&&_0x25a0ab[_0x8aac('0x5c')][0x0]?_0x25a0ab['attrs'][0x0]['value']:undefined)||''}];case _0x8aac('0x60'):return[{'name':_0x8aac('0x61'),'value':_0x25a0ab['attrHourFormat']||(_0x25a0ab['attrs']&&_0x25a0ab['attrs'][0x0]?_0x25a0ab[_0x8aac('0x5c')][0x0][_0x8aac('0x5d')]:undefined)||'HH:mm:ss'},{'name':_0x8aac('0x62'),'value':_0x25a0ab[_0x8aac('0x62')]||(_0x25a0ab[_0x8aac('0x5c')]&&_0x25a0ab[_0x8aac('0x5c')][0x1]?_0x25a0ab[_0x8aac('0x5c')][0x1]['value']:undefined)||_0x8aac('0x63')},{'name':_0x8aac('0x64'),'value':_0x25a0ab['attrFontSize']||(_0x25a0ab[_0x8aac('0x5c')]&&_0x25a0ab[_0x8aac('0x5c')][0x2]?_0x25a0ab['attrs'][0x2][_0x8aac('0x5d')]:undefined)||0xc}];case _0x8aac('0x65'):return[{'name':_0x8aac('0x66'),'value':_0x25a0ab[_0x8aac('0x66')]||(_0x25a0ab[_0x8aac('0x5c')]&&_0x25a0ab[_0x8aac('0x5c')][0x0]?_0x25a0ab[_0x8aac('0x5c')][0x0][_0x8aac('0x5d')]:undefined)||_0x8aac('0x67')},{'name':_0x8aac('0x68'),'value':_0x25a0ab[_0x8aac('0x68')]||(_0x25a0ab['attrs']&&_0x25a0ab[_0x8aac('0x5c')][0x1]?_0x25a0ab[_0x8aac('0x5c')][0x1][_0x8aac('0x5d')]:undefined)||[]},{'name':_0x8aac('0x64'),'value':_0x25a0ab[_0x8aac('0x64')]||(_0x25a0ab['attrs']&&_0x25a0ab[_0x8aac('0x5c')][0x2]?_0x25a0ab['attrs'][0x2][_0x8aac('0x5d')]:undefined)||0x14},{'name':'attrChannel','value':_0x25a0ab[_0x8aac('0x69')]||(_0x25a0ab[_0x8aac('0x5c')]&&_0x25a0ab[_0x8aac('0x5c')][0x3]?_0x25a0ab[_0x8aac('0x5c')][0x3]['value']:undefined)||_0x8aac('0x6a')},{'name':_0x8aac('0x6b'),'value':_0x25a0ab[_0x8aac('0x6b')]||(_0x25a0ab[_0x8aac('0x5c')]&&_0x25a0ab[_0x8aac('0x5c')][0x4]?_0x25a0ab['attrs'][0x4][_0x8aac('0x5d')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x25a0ab['attrFaxAccounts']||(_0x25a0ab[_0x8aac('0x5c')]&&_0x25a0ab[_0x8aac('0x5c')][0x5]?_0x25a0ab[_0x8aac('0x5c')][0x5][_0x8aac('0x5d')]:undefined)||''},{'name':_0x8aac('0x6c'),'value':_0x25a0ab[_0x8aac('0x6c')]||(_0x25a0ab[_0x8aac('0x5c')]&&_0x25a0ab[_0x8aac('0x5c')][0x6]?_0x25a0ab['attrs'][0x6]['value']:undefined)||''},{'name':_0x8aac('0x6d'),'value':_0x25a0ab[_0x8aac('0x6d')]||(_0x25a0ab[_0x8aac('0x5c')]&&_0x25a0ab[_0x8aac('0x5c')][0x7]?_0x25a0ab[_0x8aac('0x5c')][0x7][_0x8aac('0x5d')]:undefined)||''},{'name':_0x8aac('0x6e'),'value':_0x25a0ab[_0x8aac('0x6e')]||(_0x25a0ab['attrs']&&_0x25a0ab[_0x8aac('0x5c')][0x8]?_0x25a0ab[_0x8aac('0x5c')][0x8][_0x8aac('0x5d')]:undefined)||''},{'name':_0x8aac('0x6f'),'value':_0x25a0ab['attrChatWebsites']||(_0x25a0ab[_0x8aac('0x5c')]&&_0x25a0ab['attrs'][0x9]?_0x25a0ab[_0x8aac('0x5c')][0x9]['value']:undefined)||''}];case _0x8aac('0x70'):case _0x8aac('0x71'):return[{'name':_0x8aac('0x72'),'value':_0x25a0ab[_0x8aac('0x72')]||(_0x25a0ab[_0x8aac('0x5c')]&&_0x25a0ab[_0x8aac('0x5c')][0x0]?_0x25a0ab['attrs'][0x0][_0x8aac('0x5d')]:undefined)||_0x8aac('0x67')},{'name':_0x8aac('0x73'),'value':_0x25a0ab[_0x8aac('0x73')]||(_0x25a0ab[_0x8aac('0x5c')]&&_0x25a0ab[_0x8aac('0x5c')][0x1]?_0x25a0ab['attrs'][0x1][_0x8aac('0x5d')]:undefined)||null},{'name':'attrSerie3','value':_0x25a0ab[_0x8aac('0x74')]||(_0x25a0ab[_0x8aac('0x5c')]&&_0x25a0ab['attrs'][0x2]?_0x25a0ab['attrs'][0x2][_0x8aac('0x5d')]:undefined)||null},{'name':_0x8aac('0x68'),'value':_0x25a0ab['attrVoiceQueues']||(_0x25a0ab[_0x8aac('0x5c')]&&_0x25a0ab['attrs'][0x3]?_0x25a0ab[_0x8aac('0x5c')][0x3][_0x8aac('0x5d')]:undefined)||[]},{'name':_0x8aac('0x69'),'value':_0x25a0ab[_0x8aac('0x69')]||(_0x25a0ab[_0x8aac('0x5c')]&&_0x25a0ab[_0x8aac('0x5c')][0x4]?_0x25a0ab['attrs'][0x4]['value']:undefined)||_0x8aac('0x6a')},{'name':_0x8aac('0x6b'),'value':_0x25a0ab[_0x8aac('0x6b')]||(_0x25a0ab[_0x8aac('0x5c')]&&_0x25a0ab[_0x8aac('0x5c')][0x5]?_0x25a0ab['attrs'][0x5][_0x8aac('0x5d')]:undefined)||''},{'name':_0x8aac('0x75'),'value':_0x25a0ab['attrFaxAccounts']||(_0x25a0ab[_0x8aac('0x5c')]&&_0x25a0ab[_0x8aac('0x5c')][0x6]?_0x25a0ab[_0x8aac('0x5c')][0x6][_0x8aac('0x5d')]:undefined)||''},{'name':_0x8aac('0x6c'),'value':_0x25a0ab[_0x8aac('0x6c')]||(_0x25a0ab[_0x8aac('0x5c')]&&_0x25a0ab['attrs'][0x7]?_0x25a0ab[_0x8aac('0x5c')][0x7][_0x8aac('0x5d')]:undefined)||''},{'name':_0x8aac('0x6d'),'value':_0x25a0ab[_0x8aac('0x6d')]||(_0x25a0ab[_0x8aac('0x5c')]&&_0x25a0ab[_0x8aac('0x5c')][0x8]?_0x25a0ab['attrs'][0x8][_0x8aac('0x5d')]:undefined)||''},{'name':_0x8aac('0x6e'),'value':_0x25a0ab[_0x8aac('0x6e')]||(_0x25a0ab[_0x8aac('0x5c')]&&_0x25a0ab[_0x8aac('0x5c')][0x9]?_0x25a0ab[_0x8aac('0x5c')][0x9][_0x8aac('0x5d')]:undefined)||''},{'name':'attrChatWebsites','value':_0x25a0ab['attrChatWebsites']||(_0x25a0ab[_0x8aac('0x5c')]&&_0x25a0ab[_0x8aac('0x5c')][0xa]?_0x25a0ab[_0x8aac('0x5c')][0xa][_0x8aac('0x5d')]:undefined)||''}];case _0x8aac('0x76'):return[{'name':_0x8aac('0x77'),'type':_0x25a0ab[_0x8aac('0x78')]||(_0x25a0ab[_0x8aac('0x5c')]&&_0x25a0ab['attrs'][0x0]?_0x25a0ab[_0x8aac('0x5c')][0x0][_0x8aac('0x34')]:undefined)||null,'value':_0x25a0ab[_0x8aac('0x77')]||(_0x25a0ab[_0x8aac('0x5c')]&&_0x25a0ab['attrs'][0x0]?_0x25a0ab[_0x8aac('0x5c')][0x0]['value']:undefined)||null},{'name':_0x8aac('0x79'),'value':_0x25a0ab[_0x8aac('0x79')]||(_0x25a0ab['attrs']&&_0x25a0ab[_0x8aac('0x5c')][0x1]?_0x25a0ab[_0x8aac('0x5c')][0x1][_0x8aac('0x5d')]:undefined)||0x0}];default:return[];}}catch(_0x17ab05){logger[_0x8aac('0x2b')](_0x8aac('0x7a'),JSON['stringify'](_0x17ab05));return[];}}exports[_0x8aac('0x7b')]=function(_0xabd81b,_0x18009a,_0x37a57a){if(_0xabd81b['body']['id']){delete _0xabd81b[_0x8aac('0x4f')]['id'];}return db[_0x8aac('0x31')][_0x8aac('0x4d')]({'where':{'id':_0xabd81b[_0x8aac('0x4b')]['id']}})[_0x8aac('0x29')](handleEntityNotFound(_0x18009a,null))[_0x8aac('0x29')](function(_0xea1951){if(_0xea1951){_0xabd81b[_0x8aac('0x4f')]['DashboardId']=_0xea1951['id'];_0xabd81b[_0x8aac('0x4f')]['attrs']=widgetAttributes(_0xabd81b['body']);return db['DashboardItem'][_0x8aac('0x4e')](_0xabd81b['body']);}})[_0x8aac('0x29')](respondWithResult(_0x18009a,null))[_0x8aac('0x4a')](handleError(_0x18009a,null));};exports['getItems']=function(_0x4d3418,_0x11ad7e,_0x1b4f7d){var _0x444f95={};var _0x96cb42={};var _0x52f9fd;var _0x39f100;return db[_0x8aac('0x31')][_0x8aac('0x7c')]({'where':{'id':_0x4d3418[_0x8aac('0x4b')]['id']}})[_0x8aac('0x29')](handleEntityNotFound(_0x11ad7e,null))[_0x8aac('0x29')](function(_0x24039c){if(_0x24039c){_0x52f9fd=_0x24039c;_0x96cb42[_0x8aac('0x36')]=_[_0x8aac('0x4c')](db[_0x8aac('0x7d')][_0x8aac('0x32')]);_0x96cb42[_0x8aac('0x37')]=_['keys'](_0x4d3418[_0x8aac('0x37')]);_0x96cb42[_0x8aac('0x38')]=_['intersection'](_0x96cb42['model'],_0x96cb42['query']);_0x444f95[_0x8aac('0x3a')]=_['intersection'](_0x96cb42[_0x8aac('0x36')],qs[_0x8aac('0x3b')](_0x4d3418[_0x8aac('0x37')][_0x8aac('0x3b')]));_0x444f95[_0x8aac('0x3a')]=_0x444f95[_0x8aac('0x3a')]['length']?_0x444f95[_0x8aac('0x3a')]:_0x96cb42[_0x8aac('0x36')];_0x444f95[_0x8aac('0x3f')]=qs['sort'](_0x4d3418[_0x8aac('0x37')][_0x8aac('0x40')]);_0x444f95[_0x8aac('0x41')]=qs['filters'](_[_0x8aac('0x42')](_0x4d3418['query'],_0x96cb42['filters']));if(_0x4d3418[_0x8aac('0x37')]['filter']){_0x444f95[_0x8aac('0x41')]=_[_0x8aac('0x43')](_0x444f95[_0x8aac('0x41')],{'$or':_[_0x8aac('0x30')](_0x444f95[_0x8aac('0x3a')],function(_0x2de5c4){var _0x55aa71={};_0x55aa71[_0x2de5c4]={'$like':'%'+_0x4d3418[_0x8aac('0x37')][_0x8aac('0x45')]+'%'};return _0x55aa71;})});}_0x444f95=_[_0x8aac('0x43')]({},_0x444f95,_0x4d3418[_0x8aac('0x46')]);return _0x52f9fd['getItems'](_0x444f95);}})[_0x8aac('0x29')](function(_0x44eed3){if(_0x44eed3){_0x39f100=_0x44eed3[_0x8aac('0x3c')];if(!_0x4d3418[_0x8aac('0x37')]['hasOwnProperty'](_0x8aac('0x3e'))){_0x444f95[_0x8aac('0x1f')]=qs['limit'](_0x4d3418[_0x8aac('0x37')]['limit']);_0x444f95['offset']=qs[_0x8aac('0x1e')](_0x4d3418[_0x8aac('0x37')][_0x8aac('0x1e')]);}return _0x52f9fd[_0x8aac('0x7e')](_0x444f95);}})[_0x8aac('0x29')](function(_0x5ec68f){if(_0x5ec68f){return _0x5ec68f?{'count':_0x39f100,'rows':_0x5ec68f}:null;}})['then'](respondWithResult(_0x11ad7e,null))[_0x8aac('0x4a')](handleError(_0x11ad7e,null));}; \ No newline at end of file +var _0x0449=['apply','reject','save','update','then','get','CustomDashboards','UserProfileResource','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','Dashboard','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','userProfileId','iframe','attrUrl','attrs','https://','custom','attrPath','clock','attrHourFormat','value','attrTimezone','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrOpenchannelAccounts','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','getItems','DashboardItem','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x0449,0xdf));var _0x9044=function(_0x5dbdb9,_0x2e4412){_0x5dbdb9=_0x5dbdb9-0x0;var _0x44359e=_0x0449[_0x5dbdb9];return _0x44359e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9044('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9044('0x1'));var moment=require(_0x9044('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x9044('0x3'));var util=require(_0x9044('0x4'));var path=require(_0x9044('0x5'));var sox=require(_0x9044('0x6'));var csv=require(_0x9044('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9044('0x8'));var squel=require(_0x9044('0x9'));var crypto=require(_0x9044('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9044('0x7'));var querystring=require('querystring');var Papa=require(_0x9044('0xb'));var Redis=require(_0x9044('0xc'));var authService=require(_0x9044('0xd'));var qs=require(_0x9044('0xe'));var as=require(_0x9044('0xf'));var hardwareService=require(_0x9044('0x10'));var logger=require(_0x9044('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9044('0x12'))['db'];config[_0x9044('0x13')]=_[_0x9044('0x14')](config[_0x9044('0x13')],{'host':_0x9044('0x15'),'port':0x18eb});var socket=require(_0x9044('0x16'))(new Redis(config['redis']));require(_0x9044('0x17'))[_0x9044('0x18')](socket);function respondWithStatusCode(_0x38483c,_0x2dab80){_0x2dab80=_0x2dab80||0xcc;return function(_0x1d7433){if(_0x1d7433){return _0x38483c[_0x9044('0x19')](_0x2dab80);}return _0x38483c[_0x9044('0x1a')](_0x2dab80)[_0x9044('0x1b')]();};}function respondWithResult(_0x2f4200,_0x3df5d1){_0x3df5d1=_0x3df5d1||0xc8;return function(_0x53f7b7){if(_0x53f7b7){return _0x2f4200[_0x9044('0x1a')](_0x3df5d1)[_0x9044('0x1c')](_0x53f7b7);}};}function respondWithFilteredResult(_0x14d9be,_0x2214bb){return function(_0x7d711d){if(_0x7d711d){var _0x457d91=typeof _0x2214bb[_0x9044('0x1d')]==='undefined'&&typeof _0x2214bb[_0x9044('0x1e')]===_0x9044('0x1f');var _0x319593=_0x7d711d[_0x9044('0x20')];var _0x2c40e2=_0x457d91?0x0:_0x2214bb[_0x9044('0x1d')];var _0x4b63c1=_0x457d91?_0x7d711d[_0x9044('0x20')]:_0x2214bb[_0x9044('0x1d')]+_0x2214bb[_0x9044('0x1e')];var _0x56b906;if(_0x4b63c1>=_0x319593){_0x4b63c1=_0x319593;_0x56b906=0xc8;}else{_0x56b906=0xce;}_0x14d9be[_0x9044('0x1a')](_0x56b906);return _0x14d9be[_0x9044('0x21')](_0x9044('0x22'),_0x2c40e2+'-'+_0x4b63c1+'/'+_0x319593)[_0x9044('0x1c')](_0x7d711d);}return null;};}function patchUpdates(_0x17b82c){return function(_0x568e16){try{jsonpatch[_0x9044('0x23')](_0x568e16,_0x17b82c,!![]);}catch(_0x5c4aa4){return BPromise[_0x9044('0x24')](_0x5c4aa4);}return _0x568e16[_0x9044('0x25')]();};}function saveUpdates(_0x1c84cb,_0x962f65){return function(_0x59f196){if(_0x59f196){return _0x59f196[_0x9044('0x26')](_0x1c84cb)[_0x9044('0x27')](function(_0x3fbcc5){return _0x3fbcc5;});}return null;};}function removeEntity(_0x36a1b9,_0x50f8b0){return function(_0x4cb5cc){if(_0x4cb5cc){return _0x4cb5cc['destroy']()[_0x9044('0x27')](function(){var _0x77d480=_0x4cb5cc[_0x9044('0x28')]({'plain':!![]});var _0x3e8b30=_0x9044('0x29');return db[_0x9044('0x2a')][_0x9044('0x2b')]({'where':{'type':_0x3e8b30,'resourceId':_0x77d480['id']}})['then'](function(){return _0x4cb5cc;});})[_0x9044('0x27')](function(){_0x36a1b9[_0x9044('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4bcd70,_0x102275){return function(_0x117abc){if(!_0x117abc){_0x4bcd70['sendStatus'](0x194);}return _0x117abc;};}function handleError(_0x282e79,_0x18141a){_0x18141a=_0x18141a||0x1f4;return function(_0x5d5f1c){logger[_0x9044('0x2c')](_0x5d5f1c[_0x9044('0x2d')]);if(_0x5d5f1c[_0x9044('0x2e')]){delete _0x5d5f1c[_0x9044('0x2e')];}_0x282e79[_0x9044('0x1a')](_0x18141a)[_0x9044('0x2f')](_0x5d5f1c);};}exports[_0x9044('0x30')]=function(_0x3579e3,_0x193a29){var _0x19b616={},_0x2cc5ee={},_0x573073={'count':0x0,'rows':[]};var _0x54487d=_['map'](db['Dashboard'][_0x9044('0x31')],function(_0x25494f){return{'name':_0x25494f[_0x9044('0x32')],'type':_0x25494f[_0x9044('0x33')]['key']};});_0x2cc5ee[_0x9044('0x34')]=_[_0x9044('0x35')](_0x54487d,_0x9044('0x2e'));_0x2cc5ee[_0x9044('0x36')]=_['keys'](_0x3579e3[_0x9044('0x36')]);_0x2cc5ee[_0x9044('0x37')]=_[_0x9044('0x38')](_0x2cc5ee[_0x9044('0x34')],_0x2cc5ee[_0x9044('0x36')]);_0x19b616['attributes']=_['intersection'](_0x2cc5ee[_0x9044('0x34')],qs['fields'](_0x3579e3['query'][_0x9044('0x39')]));_0x19b616[_0x9044('0x3a')]=_0x19b616[_0x9044('0x3a')][_0x9044('0x3b')]?_0x19b616['attributes']:_0x2cc5ee['model'];if(!_0x3579e3[_0x9044('0x36')][_0x9044('0x3c')](_0x9044('0x3d'))){_0x19b616[_0x9044('0x1e')]=qs[_0x9044('0x1e')](_0x3579e3['query'][_0x9044('0x1e')]);_0x19b616['offset']=qs[_0x9044('0x1d')](_0x3579e3['query'][_0x9044('0x1d')]);}_0x19b616[_0x9044('0x3e')]=qs[_0x9044('0x3f')](_0x3579e3[_0x9044('0x36')][_0x9044('0x3f')]);_0x19b616[_0x9044('0x40')]=qs[_0x9044('0x37')](_[_0x9044('0x41')](_0x3579e3[_0x9044('0x36')],_0x2cc5ee['filters']),_0x54487d);if(_0x3579e3[_0x9044('0x36')]['filter']){_0x19b616[_0x9044('0x40')]=_[_0x9044('0x42')](_0x19b616[_0x9044('0x40')],{'$or':_[_0x9044('0x35')](_0x54487d,function(_0x2425ca){if(_0x2425ca[_0x9044('0x33')]!==_0x9044('0x43')){var _0x5c6ce4={};_0x5c6ce4[_0x2425ca['name']]={'$like':'%'+_0x3579e3[_0x9044('0x36')][_0x9044('0x44')]+'%'};return _0x5c6ce4;}})});}_0x19b616=_[_0x9044('0x42')]({},_0x19b616,_0x3579e3[_0x9044('0x45')]);var _0x37cede={'where':_0x19b616[_0x9044('0x40')]};return db[_0x9044('0x46')][_0x9044('0x20')](_0x37cede)[_0x9044('0x27')](function(_0x1b64ea){_0x573073[_0x9044('0x20')]=_0x1b64ea;if(_0x3579e3[_0x9044('0x36')][_0x9044('0x47')]){_0x19b616[_0x9044('0x48')]=[{'all':!![]}];}return db[_0x9044('0x46')][_0x9044('0x49')](_0x19b616);})[_0x9044('0x27')](function(_0x1c3bb9){_0x573073[_0x9044('0x4a')]=_0x1c3bb9;return _0x573073;})[_0x9044('0x27')](respondWithFilteredResult(_0x193a29,_0x19b616))['catch'](handleError(_0x193a29,null));};exports[_0x9044('0x4b')]=function(_0x138af6,_0x40b524){var _0x62bbbf={'raw':![],'where':{'id':_0x138af6[_0x9044('0x4c')]['id']}},_0x2c5390={};_0x2c5390[_0x9044('0x34')]=_[_0x9044('0x4d')](db[_0x9044('0x46')][_0x9044('0x31')]);_0x2c5390[_0x9044('0x36')]=_[_0x9044('0x4d')](_0x138af6[_0x9044('0x36')]);_0x2c5390['filters']=_['intersection'](_0x2c5390[_0x9044('0x34')],_0x2c5390['query']);_0x62bbbf[_0x9044('0x3a')]=_[_0x9044('0x38')](_0x2c5390[_0x9044('0x34')],qs[_0x9044('0x39')](_0x138af6['query'][_0x9044('0x39')]));_0x62bbbf[_0x9044('0x3a')]=_0x62bbbf[_0x9044('0x3a')][_0x9044('0x3b')]?_0x62bbbf[_0x9044('0x3a')]:_0x2c5390['model'];if(_0x138af6['query'][_0x9044('0x47')]){_0x62bbbf['include']=[{'all':!![]}];}_0x62bbbf=_[_0x9044('0x42')]({},_0x62bbbf,_0x138af6[_0x9044('0x45')]);return db[_0x9044('0x46')][_0x9044('0x4e')](_0x62bbbf)[_0x9044('0x27')](handleEntityNotFound(_0x40b524,null))['then'](respondWithResult(_0x40b524,null))[_0x9044('0x4f')](handleError(_0x40b524,null));};exports[_0x9044('0x50')]=function(_0x420557,_0x3d30dd){return db['Dashboard'][_0x9044('0x50')](_0x420557[_0x9044('0x51')],{})['then'](function(_0x2e1e55){var _0x5c083b=_0x420557[_0x9044('0x52')][_0x9044('0x28')]({'plain':!![]});if(!_0x5c083b)throw new Error(_0x9044('0x53'));if(_0x5c083b[_0x9044('0x54')]===_0x9044('0x52')){var _0x3e8d66=_0x2e1e55[_0x9044('0x28')]({'plain':!![]});var _0x1de9f8=_0x9044('0x29');return db[_0x9044('0x55')][_0x9044('0x4e')]({'where':{'name':_0x1de9f8,'userProfileId':_0x5c083b['userProfileId']},'raw':!![]})[_0x9044('0x27')](function(_0x136479){if(_0x136479&&_0x136479[_0x9044('0x56')]===0x0){return db[_0x9044('0x2a')][_0x9044('0x50')]({'name':_0x3e8d66[_0x9044('0x2e')],'resourceId':_0x3e8d66['id'],'type':_0x136479[_0x9044('0x2e')],'sectionId':_0x136479['id']},{})[_0x9044('0x27')](function(){return _0x2e1e55;});}else{return _0x2e1e55;}})[_0x9044('0x4f')](function(_0x209bd7){logger[_0x9044('0x2c')](_0x9044('0x57'),_0x209bd7);throw _0x209bd7;});}return _0x2e1e55;})[_0x9044('0x27')](respondWithResult(_0x3d30dd,0xc9))['catch'](handleError(_0x3d30dd,null));};exports[_0x9044('0x58')]=function(_0x290cc5,_0x442f46){var _0x384ca8={'where':{'id':_0x290cc5[_0x9044('0x4c')]['id']}},_0x32e5c1={};_0x32e5c1[_0x9044('0x34')]=_[_0x9044('0x4d')](db['Dashboard']['rawAttributes']);_0x384ca8[_0x9044('0x3a')]=_['intersection'](_0x32e5c1[_0x9044('0x34')],qs['fields'](_0x290cc5[_0x9044('0x36')][_0x9044('0x39')]));_0x384ca8[_0x9044('0x3a')]=_0x384ca8[_0x9044('0x3a')][_0x9044('0x3b')]?_0x384ca8[_0x9044('0x3a')]:_0x32e5c1['model'];if(_0x290cc5[_0x9044('0x36')]['includeAll']){_0x384ca8[_0x9044('0x48')]=[{'all':!![]}];}_0x384ca8=_[_0x9044('0x42')]({},_0x384ca8,_0x290cc5['options']);return db[_0x9044('0x46')][_0x9044('0x4e')](_0x384ca8)['then'](handleEntityNotFound(_0x442f46,null))[_0x9044('0x27')](function(_0xf4447d){if(_0xf4447d){var _0x5be2ed=_0xf4447d['get']({'plain':!![]});_0x5be2ed=qs[_0x9044('0x59')](_0x5be2ed,['id','createdAt','updatedAt']);_0x290cc5['body']=_[_0x9044('0x59')](_0x290cc5[_0x9044('0x51')],['id',_0x9044('0x5a'),_0x9044('0x5b')]);return db[_0x9044('0x46')]['create'](_[_0x9044('0x42')](_0x5be2ed,_0x290cc5[_0x9044('0x51')]),{'include':_0x290cc5[_0x9044('0x36')]['includeAll']?[{'all':!![]}]:undefined})[_0x9044('0x27')](function(_0x4331b3){var _0x5a70f9=_0x290cc5['user'][_0x9044('0x28')]({'plain':!![]});if(!_0x5a70f9)throw new Error(_0x9044('0x53'));if(_0x5a70f9[_0x9044('0x54')]===_0x9044('0x52')){var _0x1d8b42=_0x4331b3['get']({'plain':!![]});var _0x51d2a4='CustomDashboards';return db[_0x9044('0x55')][_0x9044('0x4e')]({'where':{'name':_0x51d2a4,'userProfileId':_0x5a70f9[_0x9044('0x5c')]},'raw':!![]})[_0x9044('0x27')](function(_0x2e98fb){if(_0x2e98fb&&_0x2e98fb['autoAssociation']===0x0){return db[_0x9044('0x2a')][_0x9044('0x50')]({'name':_0x1d8b42[_0x9044('0x2e')],'resourceId':_0x1d8b42['id'],'type':_0x2e98fb['name'],'sectionId':_0x2e98fb['id']},{})[_0x9044('0x27')](function(){return _0x4331b3;});}else{return _0x4331b3;}})[_0x9044('0x4f')](function(_0x51c76c){logger[_0x9044('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x51c76c);throw _0x51c76c;});}return _0x4331b3;});}})['then'](respondWithResult(_0x442f46,0xc9))[_0x9044('0x4f')](handleError(_0x442f46,null));};exports[_0x9044('0x26')]=function(_0xe32c80,_0x5833be){if(_0xe32c80[_0x9044('0x51')]['id']){delete _0xe32c80[_0x9044('0x51')]['id'];}return db[_0x9044('0x46')]['find']({'where':{'id':_0xe32c80[_0x9044('0x4c')]['id']}})[_0x9044('0x27')](handleEntityNotFound(_0x5833be,null))[_0x9044('0x27')](saveUpdates(_0xe32c80[_0x9044('0x51')],null))['then'](respondWithResult(_0x5833be,null))[_0x9044('0x4f')](handleError(_0x5833be,null));};exports[_0x9044('0x2b')]=function(_0x42dfde,_0x312160){return db[_0x9044('0x46')][_0x9044('0x4e')]({'where':{'id':_0x42dfde[_0x9044('0x4c')]['id']}})[_0x9044('0x27')](handleEntityNotFound(_0x312160,null))[_0x9044('0x27')](removeEntity(_0x312160,null))[_0x9044('0x4f')](handleError(_0x312160,null));};function widgetAttributes(_0x3f1ade){try{switch(_0x3f1ade['type']){case _0x9044('0x5d'):return[{'name':'attrUrl','value':_0x3f1ade[_0x9044('0x5e')]||(_0x3f1ade[_0x9044('0x5f')]&&_0x3f1ade[_0x9044('0x5f')][0x0]?_0x3f1ade[_0x9044('0x5f')][0x0]['value']:undefined)||_0x9044('0x60')}];case _0x9044('0x61'):return[{'name':_0x9044('0x62'),'value':_0x3f1ade['attrPath']||(_0x3f1ade[_0x9044('0x5f')]&&_0x3f1ade[_0x9044('0x5f')][0x0]?_0x3f1ade[_0x9044('0x5f')][0x0]['value']:undefined)||''}];case _0x9044('0x63'):return[{'name':'attrHourFormat','value':_0x3f1ade[_0x9044('0x64')]||(_0x3f1ade['attrs']&&_0x3f1ade[_0x9044('0x5f')][0x0]?_0x3f1ade[_0x9044('0x5f')][0x0][_0x9044('0x65')]:undefined)||'HH:mm:ss'},{'name':_0x9044('0x66'),'value':_0x3f1ade[_0x9044('0x66')]||(_0x3f1ade[_0x9044('0x5f')]&&_0x3f1ade[_0x9044('0x5f')][0x1]?_0x3f1ade[_0x9044('0x5f')][0x1][_0x9044('0x65')]:undefined)||'0.00'},{'name':_0x9044('0x67'),'value':_0x3f1ade[_0x9044('0x67')]||(_0x3f1ade[_0x9044('0x5f')]&&_0x3f1ade[_0x9044('0x5f')][0x2]?_0x3f1ade['attrs'][0x2][_0x9044('0x65')]:undefined)||0xc}];case'counter':return[{'name':_0x9044('0x68'),'value':_0x3f1ade['attrMetric']||(_0x3f1ade[_0x9044('0x5f')]&&_0x3f1ade[_0x9044('0x5f')][0x0]?_0x3f1ade['attrs'][0x0][_0x9044('0x65')]:undefined)||_0x9044('0x69')},{'name':_0x9044('0x6a'),'value':_0x3f1ade[_0x9044('0x6a')]||(_0x3f1ade[_0x9044('0x5f')]&&_0x3f1ade[_0x9044('0x5f')][0x1]?_0x3f1ade['attrs'][0x1][_0x9044('0x65')]:undefined)||[]},{'name':_0x9044('0x67'),'value':_0x3f1ade[_0x9044('0x67')]||(_0x3f1ade[_0x9044('0x5f')]&&_0x3f1ade['attrs'][0x2]?_0x3f1ade[_0x9044('0x5f')][0x2][_0x9044('0x65')]:undefined)||0x14},{'name':_0x9044('0x6b'),'value':_0x3f1ade[_0x9044('0x6b')]||(_0x3f1ade[_0x9044('0x5f')]&&_0x3f1ade[_0x9044('0x5f')][0x3]?_0x3f1ade[_0x9044('0x5f')][0x3][_0x9044('0x65')]:undefined)||_0x9044('0x6c')},{'name':_0x9044('0x6d'),'value':_0x3f1ade[_0x9044('0x6d')]||(_0x3f1ade[_0x9044('0x5f')]&&_0x3f1ade[_0x9044('0x5f')][0x4]?_0x3f1ade[_0x9044('0x5f')][0x4][_0x9044('0x65')]:undefined)||''},{'name':_0x9044('0x6e'),'value':_0x3f1ade['attrFaxAccounts']||(_0x3f1ade['attrs']&&_0x3f1ade['attrs'][0x5]?_0x3f1ade[_0x9044('0x5f')][0x5][_0x9044('0x65')]:undefined)||''},{'name':_0x9044('0x6f'),'value':_0x3f1ade[_0x9044('0x6f')]||(_0x3f1ade[_0x9044('0x5f')]&&_0x3f1ade[_0x9044('0x5f')][0x6]?_0x3f1ade[_0x9044('0x5f')][0x6]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x3f1ade['attrOpenchannelAccounts']||(_0x3f1ade['attrs']&&_0x3f1ade[_0x9044('0x5f')][0x7]?_0x3f1ade[_0x9044('0x5f')][0x7][_0x9044('0x65')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x3f1ade[_0x9044('0x70')]||(_0x3f1ade['attrs']&&_0x3f1ade[_0x9044('0x5f')][0x8]?_0x3f1ade[_0x9044('0x5f')][0x8][_0x9044('0x65')]:undefined)||''},{'name':_0x9044('0x71'),'value':_0x3f1ade[_0x9044('0x71')]||(_0x3f1ade['attrs']&&_0x3f1ade[_0x9044('0x5f')][0x9]?_0x3f1ade[_0x9044('0x5f')][0x9]['value']:undefined)||''}];case _0x9044('0x72'):case _0x9044('0x73'):return[{'name':_0x9044('0x74'),'value':_0x3f1ade[_0x9044('0x74')]||(_0x3f1ade[_0x9044('0x5f')]&&_0x3f1ade['attrs'][0x0]?_0x3f1ade[_0x9044('0x5f')][0x0]['value']:undefined)||_0x9044('0x69')},{'name':_0x9044('0x75'),'value':_0x3f1ade[_0x9044('0x75')]||(_0x3f1ade[_0x9044('0x5f')]&&_0x3f1ade[_0x9044('0x5f')][0x1]?_0x3f1ade['attrs'][0x1][_0x9044('0x65')]:undefined)||null},{'name':_0x9044('0x76'),'value':_0x3f1ade[_0x9044('0x76')]||(_0x3f1ade[_0x9044('0x5f')]&&_0x3f1ade['attrs'][0x2]?_0x3f1ade[_0x9044('0x5f')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x3f1ade[_0x9044('0x6a')]||(_0x3f1ade[_0x9044('0x5f')]&&_0x3f1ade['attrs'][0x3]?_0x3f1ade[_0x9044('0x5f')][0x3][_0x9044('0x65')]:undefined)||[]},{'name':_0x9044('0x6b'),'value':_0x3f1ade[_0x9044('0x6b')]||(_0x3f1ade['attrs']&&_0x3f1ade['attrs'][0x4]?_0x3f1ade[_0x9044('0x5f')][0x4]['value']:undefined)||_0x9044('0x6c')},{'name':'attrEmailAccounts','value':_0x3f1ade[_0x9044('0x6d')]||(_0x3f1ade[_0x9044('0x5f')]&&_0x3f1ade['attrs'][0x5]?_0x3f1ade[_0x9044('0x5f')][0x5][_0x9044('0x65')]:undefined)||''},{'name':_0x9044('0x6e'),'value':_0x3f1ade[_0x9044('0x6e')]||(_0x3f1ade[_0x9044('0x5f')]&&_0x3f1ade[_0x9044('0x5f')][0x6]?_0x3f1ade[_0x9044('0x5f')][0x6][_0x9044('0x65')]:undefined)||''},{'name':_0x9044('0x6f'),'value':_0x3f1ade[_0x9044('0x6f')]||(_0x3f1ade[_0x9044('0x5f')]&&_0x3f1ade[_0x9044('0x5f')][0x7]?_0x3f1ade[_0x9044('0x5f')][0x7][_0x9044('0x65')]:undefined)||''},{'name':_0x9044('0x77'),'value':_0x3f1ade[_0x9044('0x77')]||(_0x3f1ade['attrs']&&_0x3f1ade[_0x9044('0x5f')][0x8]?_0x3f1ade[_0x9044('0x5f')][0x8][_0x9044('0x65')]:undefined)||''},{'name':_0x9044('0x70'),'value':_0x3f1ade['attrWhatsappAccounts']||(_0x3f1ade[_0x9044('0x5f')]&&_0x3f1ade[_0x9044('0x5f')][0x9]?_0x3f1ade[_0x9044('0x5f')][0x9][_0x9044('0x65')]:undefined)||''},{'name':_0x9044('0x71'),'value':_0x3f1ade[_0x9044('0x71')]||(_0x3f1ade['attrs']&&_0x3f1ade[_0x9044('0x5f')][0xa]?_0x3f1ade[_0x9044('0x5f')][0xa][_0x9044('0x65')]:undefined)||''}];case _0x9044('0x78'):return[{'name':'attrReport','type':_0x3f1ade[_0x9044('0x79')]||(_0x3f1ade['attrs']&&_0x3f1ade['attrs'][0x0]?_0x3f1ade[_0x9044('0x5f')][0x0][_0x9044('0x33')]:undefined)||null,'value':_0x3f1ade[_0x9044('0x7a')]||(_0x3f1ade['attrs']&&_0x3f1ade[_0x9044('0x5f')][0x0]?_0x3f1ade['attrs'][0x0][_0x9044('0x65')]:undefined)||null},{'name':_0x9044('0x7b'),'value':_0x3f1ade[_0x9044('0x7b')]||(_0x3f1ade[_0x9044('0x5f')]&&_0x3f1ade['attrs'][0x1]?_0x3f1ade[_0x9044('0x5f')][0x1][_0x9044('0x65')]:undefined)||0x0}];default:return[];}}catch(_0x52c1fc){logger['error'](_0x9044('0x7c'),JSON[_0x9044('0x7d')](_0x52c1fc));return[];}}exports[_0x9044('0x7e')]=function(_0x243b6c,_0x4750d4,_0x46b5c6){if(_0x243b6c['body']['id']){delete _0x243b6c[_0x9044('0x51')]['id'];}return db[_0x9044('0x46')]['find']({'where':{'id':_0x243b6c['params']['id']}})['then'](handleEntityNotFound(_0x4750d4,null))[_0x9044('0x27')](function(_0x44a62a){if(_0x44a62a){_0x243b6c[_0x9044('0x51')]['DashboardId']=_0x44a62a['id'];_0x243b6c[_0x9044('0x51')][_0x9044('0x5f')]=widgetAttributes(_0x243b6c[_0x9044('0x51')]);return db['DashboardItem'][_0x9044('0x50')](_0x243b6c['body']);}})[_0x9044('0x27')](respondWithResult(_0x4750d4,null))[_0x9044('0x4f')](handleError(_0x4750d4,null));};exports[_0x9044('0x7f')]=function(_0x23559b,_0x1b61b1,_0x530809){var _0xf61c0e={};var _0x5617d2={};var _0x38f35d;var _0x2c5b8a;return db[_0x9044('0x46')]['findOne']({'where':{'id':_0x23559b[_0x9044('0x4c')]['id']}})[_0x9044('0x27')](handleEntityNotFound(_0x1b61b1,null))['then'](function(_0xe96e5d){if(_0xe96e5d){_0x38f35d=_0xe96e5d;_0x5617d2[_0x9044('0x34')]=_[_0x9044('0x4d')](db[_0x9044('0x80')][_0x9044('0x31')]);_0x5617d2[_0x9044('0x36')]=_['keys'](_0x23559b[_0x9044('0x36')]);_0x5617d2[_0x9044('0x37')]=_[_0x9044('0x38')](_0x5617d2[_0x9044('0x34')],_0x5617d2[_0x9044('0x36')]);_0xf61c0e['attributes']=_['intersection'](_0x5617d2[_0x9044('0x34')],qs['fields'](_0x23559b[_0x9044('0x36')][_0x9044('0x39')]));_0xf61c0e[_0x9044('0x3a')]=_0xf61c0e[_0x9044('0x3a')][_0x9044('0x3b')]?_0xf61c0e['attributes']:_0x5617d2[_0x9044('0x34')];_0xf61c0e[_0x9044('0x3e')]=qs[_0x9044('0x3f')](_0x23559b[_0x9044('0x36')][_0x9044('0x3f')]);_0xf61c0e[_0x9044('0x40')]=qs[_0x9044('0x37')](_[_0x9044('0x41')](_0x23559b['query'],_0x5617d2[_0x9044('0x37')]));if(_0x23559b['query'][_0x9044('0x44')]){_0xf61c0e[_0x9044('0x40')]=_[_0x9044('0x42')](_0xf61c0e[_0x9044('0x40')],{'$or':_['map'](_0xf61c0e[_0x9044('0x3a')],function(_0x2957f3){var _0x334375={};_0x334375[_0x2957f3]={'$like':'%'+_0x23559b[_0x9044('0x36')]['filter']+'%'};return _0x334375;})});}_0xf61c0e=_[_0x9044('0x42')]({},_0xf61c0e,_0x23559b[_0x9044('0x45')]);return _0x38f35d[_0x9044('0x7f')](_0xf61c0e);}})[_0x9044('0x27')](function(_0xfc6b57){if(_0xfc6b57){_0x2c5b8a=_0xfc6b57[_0x9044('0x3b')];if(!_0x23559b[_0x9044('0x36')][_0x9044('0x3c')]('nolimit')){_0xf61c0e[_0x9044('0x1e')]=qs[_0x9044('0x1e')](_0x23559b['query'][_0x9044('0x1e')]);_0xf61c0e[_0x9044('0x1d')]=qs[_0x9044('0x1d')](_0x23559b[_0x9044('0x36')]['offset']);}return _0x38f35d[_0x9044('0x7f')](_0xf61c0e);}})['then'](function(_0x2afe10){if(_0x2afe10){return _0x2afe10?{'count':_0x2c5b8a,'rows':_0x2afe10}:null;}})[_0x9044('0x27')](respondWithResult(_0x1b61b1,null))[_0x9044('0x4f')](handleError(_0x1b61b1,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 790c11c..85e8a94 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 _0xe6c5=['emit','hasOwnProperty','hook','exports','events','setMaxListeners','save','update','remove'];(function(_0x4e3fcd,_0x105a73){var _0x1322d7=function(_0x9bca61){while(--_0x9bca61){_0x4e3fcd['push'](_0x4e3fcd['shift']());}};_0x1322d7(++_0x105a73);}(_0xe6c5,0x67));var _0x5e6c=function(_0x15cc6a,_0x464e58){_0x15cc6a=_0x15cc6a-0x0;var _0x53000d=_0xe6c5[_0x15cc6a];return _0x53000d;};'use strict';var EventEmitter=require(_0x5e6c('0x0'));var Dashboard=require('../../mysqldb')['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x5e6c('0x1')](0x0);var events={'afterCreate':_0x5e6c('0x2'),'afterUpdate':_0x5e6c('0x3'),'afterDestroy':_0x5e6c('0x4')};function emitEvent(_0x56e3e3){return function(_0x29480c,_0x243866,_0x2e4a67){DashboardEvents[_0x5e6c('0x5')](_0x56e3e3+':'+_0x29480c['id'],_0x29480c);DashboardEvents['emit'](_0x56e3e3,_0x29480c);_0x2e4a67(null);};}for(var e in events){if(events[_0x5e6c('0x6')](e)){var event=events[e];Dashboard[_0x5e6c('0x7')](e,emitEvent(event));}}module[_0x5e6c('0x8')]=DashboardEvents; \ No newline at end of file +var _0xda28=['exports','events','../../mysqldb','Dashboard','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x2906c4,_0x388039){var _0x96c290=function(_0x40ead1){while(--_0x40ead1){_0x2906c4['push'](_0x2906c4['shift']());}};_0x96c290(++_0x388039);}(_0xda28,0xfd));var _0x8da2=function(_0x47f058,_0xfb559a){_0x47f058=_0x47f058-0x0;var _0x4f20f6=_0xda28[_0x47f058];return _0x4f20f6;};'use strict';var EventEmitter=require(_0x8da2('0x0'));var Dashboard=require(_0x8da2('0x1'))['db'][_0x8da2('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x8da2('0x3')](0x0);var events={'afterCreate':_0x8da2('0x4'),'afterUpdate':'update','afterDestroy':_0x8da2('0x5')};function emitEvent(_0x2b62d4){return function(_0x42eb1a,_0x142292,_0x20008f){DashboardEvents[_0x8da2('0x6')](_0x2b62d4+':'+_0x42eb1a['id'],_0x42eb1a);DashboardEvents['emit'](_0x2b62d4,_0x42eb1a);_0x20008f(null);};}for(var e in events){if(events[_0x8da2('0x7')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0x8da2('0x8')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 377eb76..1b9b705 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 _0x2171=['lodash','util','../../config/logger','moment','rimraf','../../config/environment','dashboards'];(function(_0x3a0a7c,_0x295a41){var _0x2b5a40=function(_0x5ed49f){while(--_0x5ed49f){_0x3a0a7c['push'](_0x3a0a7c['shift']());}};_0x2b5a40(++_0x295a41);}(_0x2171,0x1b9));var _0x1217=function(_0x4b84ab,_0x3611a1){_0x4b84ab=_0x4b84ab-0x0;var _0x387324=_0x2171[_0x4b84ab];return _0x387324;};'use strict';var _=require(_0x1217('0x0'));var util=require(_0x1217('0x1'));var logger=require(_0x1217('0x2'))('api');var moment=require(_0x1217('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1217('0x4'));var config=require(_0x1217('0x5'));var attributes=require('./dashboard.attributes');module['exports']=function(_0x4af2c6,_0xb98a59){return _0x4af2c6['define']('Dashboard',attributes,{'tableName':_0x1217('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0762=['rimraf','../../config/environment','exports','define','Dashboard','lodash','api','moment','bluebird','request-promise'];(function(_0x202610,_0x4981fe){var _0x5899ea=function(_0x192e0d){while(--_0x192e0d){_0x202610['push'](_0x202610['shift']());}};_0x5899ea(++_0x4981fe);}(_0x0762,0x1d1));var _0x2076=function(_0x4201de,_0x43ac07){_0x4201de=_0x4201de-0x0;var _0x3fef97=_0x0762[_0x4201de];return _0x3fef97;};'use strict';var _=require(_0x2076('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2076('0x1'));var moment=require(_0x2076('0x2'));var BPromise=require(_0x2076('0x3'));var rp=require(_0x2076('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2076('0x5'));var config=require(_0x2076('0x6'));var attributes=require('./dashboard.attributes');module[_0x2076('0x7')]=function(_0x1b0826,_0x23e7f4){return _0x1b0826[_0x2076('0x8')](_0x2076('0x9'),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 1f8d742..675d62b 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 _0x24ce=['message','result','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./dashboard.socket','register','request','then','info','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','code','Dashboard,\x20%s,\x20%s','error'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x24ce,0x1de));var _0xe24c=function(_0x402137,_0x5c2f95){_0x402137=_0x402137-0x0;var _0x3994cf=_0x24ce[_0x402137];return _0x3994cf;};'use strict';var _=require('lodash');var util=require(_0xe24c('0x0'));var moment=require(_0xe24c('0x1'));var BPromise=require(_0xe24c('0x2'));var rs=require(_0xe24c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe24c('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xe24c('0x5'));var jayson=require(_0xe24c('0x6'));var client=jayson[_0xe24c('0x7')][_0xe24c('0x8')]({'port':0x232a});config[_0xe24c('0x9')]=_['defaults'](config[_0xe24c('0x9')],{'host':_0xe24c('0xa'),'port':0x18eb});var socket=require(_0xe24c('0xb'))(new Redis(config[_0xe24c('0x9')]));require(_0xe24c('0xc'))[_0xe24c('0xd')](socket);function respondWithRpcPromise(_0x3b72f5,_0x3eed6b,_0x4384e7){return new BPromise(function(_0x7b13c,_0x66c829){return client[_0xe24c('0xe')](_0x3b72f5,_0x4384e7)[_0xe24c('0xf')](function(_0x49fc72){logger[_0xe24c('0x10')]('Dashboard,\x20%s,\x20%s',_0x3eed6b,_0xe24c('0x11'));logger['debug'](_0xe24c('0x12'),_0x3eed6b,_0xe24c('0x11'),JSON['stringify'](_0x49fc72));if(_0x49fc72['error']){if(_0x49fc72['error'][_0xe24c('0x13')]===0x1f4){logger['error'](_0xe24c('0x14'),_0x3eed6b,_0x49fc72[_0xe24c('0x15')][_0xe24c('0x16')]);return _0x66c829(_0x49fc72[_0xe24c('0x15')]['message']);}logger[_0xe24c('0x15')](_0xe24c('0x14'),_0x3eed6b,_0x49fc72[_0xe24c('0x15')][_0xe24c('0x16')]);return _0x7b13c(_0x49fc72[_0xe24c('0x15')][_0xe24c('0x16')]);}else{logger[_0xe24c('0x10')](_0xe24c('0x14'),_0x3eed6b,_0xe24c('0x11'));_0x7b13c(_0x49fc72[_0xe24c('0x17')][_0xe24c('0x16')]);}})[_0xe24c('0x18')](function(_0x14810d){logger['error'](_0xe24c('0x14'),_0x3eed6b,_0x14810d);_0x66c829(_0x14810d);});});} \ No newline at end of file +var _0x4cce=['jayson/promise','http','redis','localhost','socket.io-emitter','./dashboard.socket','register','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x55e2f2,_0x4cf5fe){var _0x2dd912=function(_0x2d10f8){while(--_0x2d10f8){_0x55e2f2['push'](_0x55e2f2['shift']());}};_0x2dd912(++_0x4cf5fe);}(_0x4cce,0xc2));var _0xe4cc=function(_0x24cd4a,_0x4c0661){_0x24cd4a=_0x24cd4a-0x0;var _0x3101d5=_0x4cce[_0x24cd4a];return _0x3101d5;};'use strict';var _=require('lodash');var util=require(_0xe4cc('0x0'));var moment=require(_0xe4cc('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe4cc('0x2'))['db'];var utils=require(_0xe4cc('0x3'));var logger=require('../../config/logger')(_0xe4cc('0x4'));var config=require(_0xe4cc('0x5'));var jayson=require(_0xe4cc('0x6'));var client=jayson['client'][_0xe4cc('0x7')]({'port':0x232a});config[_0xe4cc('0x8')]=_['defaults'](config[_0xe4cc('0x8')],{'host':_0xe4cc('0x9'),'port':0x18eb});var socket=require(_0xe4cc('0xa'))(new Redis(config[_0xe4cc('0x8')]));require(_0xe4cc('0xb'))[_0xe4cc('0xc')](socket);function respondWithRpcPromise(_0x1f9353,_0x558dda,_0x4ee83e){return new BPromise(function(_0x24941b,_0x757cc1){return client['request'](_0x1f9353,_0x4ee83e)[_0xe4cc('0xd')](function(_0x383879){logger[_0xe4cc('0xe')](_0xe4cc('0xf'),_0x558dda,_0xe4cc('0x10'));logger[_0xe4cc('0x11')](_0xe4cc('0x12'),_0x558dda,_0xe4cc('0x10'),JSON[_0xe4cc('0x13')](_0x383879));if(_0x383879[_0xe4cc('0x14')]){if(_0x383879[_0xe4cc('0x14')][_0xe4cc('0x15')]===0x1f4){logger[_0xe4cc('0x14')](_0xe4cc('0xf'),_0x558dda,_0x383879[_0xe4cc('0x14')][_0xe4cc('0x16')]);return _0x757cc1(_0x383879[_0xe4cc('0x14')][_0xe4cc('0x16')]);}logger[_0xe4cc('0x14')](_0xe4cc('0xf'),_0x558dda,_0x383879[_0xe4cc('0x14')][_0xe4cc('0x16')]);return _0x24941b(_0x383879[_0xe4cc('0x14')][_0xe4cc('0x16')]);}else{logger['info']('Dashboard,\x20%s,\x20%s',_0x558dda,_0xe4cc('0x10'));_0x24941b(_0x383879[_0xe4cc('0x17')]['message']);}})[_0xe4cc('0x18')](function(_0x54727b){logger['error'](_0xe4cc('0xf'),_0x558dda,_0x54727b);_0x757cc1(_0x54727b);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 04f3405..74a1731 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 _0x26cb=['dashboard:','save','update','emit','removeListener','register'];(function(_0x538b6a,_0x505970){var _0x4cbe93=function(_0x2cbcbd){while(--_0x2cbcbd){_0x538b6a['push'](_0x538b6a['shift']());}};_0x4cbe93(++_0x505970);}(_0x26cb,0x1c3));var _0xb26c=function(_0x43b2d4,_0x55b7a0){_0x43b2d4=_0x43b2d4-0x0;var _0x36d662=_0x26cb[_0x43b2d4];return _0x36d662;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0xb26c('0x0'),'remove',_0xb26c('0x1')];function createListener(_0x4a67d,_0x5abf96){return function(_0x3141b6){_0x5abf96[_0xb26c('0x2')](_0x4a67d,_0x3141b6);};}function removeListener(_0x23298e,_0x1c3177){return function(){DashboardEvents[_0xb26c('0x3')](_0x23298e,_0x1c3177);};}exports[_0xb26c('0x4')]=function(_0x56fcb0){for(var _0x7b5c3=0x0,_0x162098=events['length'];_0x7b5c3<_0x162098;_0x7b5c3++){var _0x4c41fc=events[_0x7b5c3];var _0x12eb39=createListener(_0xb26c('0x5')+_0x4c41fc,_0x56fcb0);DashboardEvents['on'](_0x4c41fc,_0x12eb39);}}; \ No newline at end of file +var _0xf940=['dashboard:','./dashboard.events','save','remove','removeListener','register','length'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf940,0xda));var _0x0f94=function(_0x59e174,_0x43a286){_0x59e174=_0x59e174-0x0;var _0x2d581f=_0xf940[_0x59e174];return _0x2d581f;};'use strict';var DashboardEvents=require(_0x0f94('0x0'));var events=[_0x0f94('0x1'),_0x0f94('0x2'),'update'];function createListener(_0x14bf7e,_0x21cad9){return function(_0x36f4f4){_0x21cad9['emit'](_0x14bf7e,_0x36f4f4);};}function removeListener(_0xdee1cb,_0x2fa412){return function(){DashboardEvents[_0x0f94('0x3')](_0xdee1cb,_0x2fa412);};}exports[_0x0f94('0x4')]=function(_0x57e3d9){for(var _0x699d44=0x0,_0x46d75f=events[_0x0f94('0x5')];_0x699d44<_0x46d75f;_0x699d44++){var _0x286915=events[_0x699d44];var _0x5427bf=createListener(_0x0f94('0x6')+_0x286915,_0x57e3d9);DashboardEvents['on'](_0x286915,_0x5427bf);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index d4b1b33..effdb75 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 _0xfe95=['addItem','put','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','/:id','show','/:id/items','isAuthenticated','getItems','create','post','clone'];(function(_0x4f22a4,_0x476b9e){var _0x17132d=function(_0x37d244){while(--_0x37d244){_0x4f22a4['push'](_0x4f22a4['shift']());}};_0x17132d(++_0x476b9e);}(_0xfe95,0xea));var _0x5fe9=function(_0x4b095c,_0x266c55){_0x4b095c=_0x4b095c-0x0;var _0x4495e2=_0xfe95[_0x4b095c];return _0x4495e2;};'use strict';var multer=require(_0x5fe9('0x0'));var util=require(_0x5fe9('0x1'));var path=require(_0x5fe9('0x2'));var timeout=require(_0x5fe9('0x3'));var express=require(_0x5fe9('0x4'));var router=express['Router']();var fs_extra=require(_0x5fe9('0x5'));var auth=require(_0x5fe9('0x6'));var interaction=require(_0x5fe9('0x7'));var config=require(_0x5fe9('0x8'));var controller=require(_0x5fe9('0x9'));router[_0x5fe9('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5fe9('0xa')](_0x5fe9('0xb'),auth['isAuthenticated'](),controller[_0x5fe9('0xc')]);router[_0x5fe9('0xa')](_0x5fe9('0xd'),auth[_0x5fe9('0xe')](),controller[_0x5fe9('0xf')]);router['post']('/',auth[_0x5fe9('0xe')](),controller[_0x5fe9('0x10')]);router[_0x5fe9('0x11')]('/:id/clone',auth[_0x5fe9('0xe')](),controller[_0x5fe9('0x12')]);router[_0x5fe9('0x11')]('/:id/items',auth[_0x5fe9('0xe')](),controller[_0x5fe9('0x13')]);router[_0x5fe9('0x14')](_0x5fe9('0xb'),auth[_0x5fe9('0xe')](),controller['update']);router[_0x5fe9('0x15')](_0x5fe9('0xb'),auth[_0x5fe9('0xe')](),controller[_0x5fe9('0x16')]);module['exports']=router; \ No newline at end of file +var _0x3424=['index','isAuthenticated','post','clone','/:id/items','addItem','put','/:id','update','delete','destroy','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./dashboard.controller','get'];(function(_0x15b6b7,_0x288130){var _0x475b67=function(_0x5973c1){while(--_0x5973c1){_0x15b6b7['push'](_0x15b6b7['shift']());}};_0x475b67(++_0x288130);}(_0x3424,0x1a9));var _0x4342=function(_0x119125,_0x527dd7){_0x119125=_0x119125-0x0;var _0x5e1955=_0x3424[_0x119125];return _0x5e1955;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4342('0x0'));var timeout=require(_0x4342('0x1'));var express=require(_0x4342('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4342('0x3'));var config=require(_0x4342('0x4'));var controller=require(_0x4342('0x5'));router[_0x4342('0x6')]('/',auth['isAuthenticated'](),controller[_0x4342('0x7')]);router[_0x4342('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x4342('0x6')]('/:id/items',auth[_0x4342('0x8')](),controller['getItems']);router[_0x4342('0x9')]('/',auth[_0x4342('0x8')](),controller['create']);router['post']('/:id/clone',auth['isAuthenticated'](),controller[_0x4342('0xa')]);router['post'](_0x4342('0xb'),auth[_0x4342('0x8')](),controller[_0x4342('0xc')]);router[_0x4342('0xd')](_0x4342('0xe'),auth['isAuthenticated'](),controller[_0x4342('0xf')]);router[_0x4342('0x10')](_0x4342('0xe'),auth[_0x4342('0x8')](),controller[_0x4342('0x11')]);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 54b0c4d..9852396 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 _0x4c60=['attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING'];(function(_0x197109,_0x3fb695){var _0x2e8057=function(_0x3cf9d5){while(--_0x3cf9d5){_0x197109['push'](_0x197109['shift']());}};_0x2e8057(++_0x3fb695);}(_0x4c60,0xc1));var _0x04c6=function(_0x5f3202,_0x15d3f9){_0x5f3202=_0x5f3202-0x0;var _0x392fd1=_0x4c60[_0x5f3202];return _0x392fd1;};'use strict';var Sequelize=require(_0x04c6('0x0'));var squel=require(_0x04c6('0x1'));var _=require(_0x04c6('0x2'));module[_0x04c6('0x3')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x04c6('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT']('long'),'get':function(){try{return JSON['parse'](this['getDataValue'](_0x04c6('0x5')));}catch(_0xc6e772){return[];}},'set':function(_0x2054da){try{this[_0x04c6('0x6')](_0x04c6('0x5'),JSON[_0x04c6('0x7')](_0x2054da));}catch(_0x8f9b13){this['setDataValue'](_0x04c6('0x5'),JSON[_0x04c6('0x7')]([]));}}},'sizeX':{'type':Sequelize[_0x04c6('0x8')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x04c6('0x8')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x04c6('0x9'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x04c6('0xa'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x04c6('0x4')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0x687b=['sequelize','squel','lodash','exports','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','STRING','#ffffff','#2196f3'];(function(_0x4e469e,_0x2e2a71){var _0x1eba64=function(_0x2d5f38){while(--_0x2d5f38){_0x4e469e['push'](_0x4e469e['shift']());}};_0x1eba64(++_0x2e2a71);}(_0x687b,0x14a));var _0xb687=function(_0x5a4a1e,_0x5f014c){_0x5a4a1e=_0x5a4a1e-0x0;var _0x13b91d=_0x687b[_0x5a4a1e];return _0x13b91d;};'use strict';var Sequelize=require(_0xb687('0x0'));var squel=require(_0xb687('0x1'));var _=require(_0xb687('0x2'));module[_0xb687('0x3')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xb687('0x4')](_0xb687('0x5')),'get':function(){try{return JSON[_0xb687('0x6')](this[_0xb687('0x7')](_0xb687('0x8')));}catch(_0x194c55){return[];}},'set':function(_0x16ccf3){try{this[_0xb687('0x9')](_0xb687('0x8'),JSON[_0xb687('0xa')](_0x16ccf3));}catch(_0x48942b){this[_0xb687('0x9')](_0xb687('0x8'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0xb687('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xb687('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xb687('0xb')]},'col':{'type':Sequelize[_0xb687('0xb')]},'background':{'type':Sequelize[_0xb687('0xc')],'allowNull':![],'defaultValue':_0xb687('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xb687('0xc')],'allowNull':![],'defaultValue':_0xb687('0xe'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xb687('0xc')]},'titleFontSize':{'type':Sequelize['INTEGER'],'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 799302e..0d51d7c 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 _0x9303=['attrPath','value','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','attrReport','attrRefresh','create','body','update','eml-format','fast-json-patch','moment','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','then','end','error','stack','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','destroy','type','attrUrl','attrs','custom'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x9303,0xd7));var _0x3930=function(_0x515f78,_0x3b69be){_0x515f78=_0x515f78-0x0;var _0x506f6c=_0x9303[_0x515f78];return _0x506f6c;};'use strict';var emlformat=require(_0x3930('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3930('0x1'));var rp=require('request-promise');var moment=require(_0x3930('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3930('0x3'));var path=require(_0x3930('0x4'));var sox=require(_0x3930('0x5'));var csv=require(_0x3930('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3930('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3930('0x8'));var jsforce=require(_0x3930('0x9'));var deskjs=require(_0x3930('0xa'));var toCsv=require(_0x3930('0x6'));var querystring=require(_0x3930('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3930('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3930('0xd'))(_0x3930('0xe'));var utils=require(_0x3930('0xf'));var config=require(_0x3930('0x10'));var licenseUtil=require(_0x3930('0x11'));var db=require('../../mysqldb')['db'];config[_0x3930('0x12')]=_['defaults'](config[_0x3930('0x12')],{'host':_0x3930('0x13'),'port':0x18eb});var socket=require(_0x3930('0x14'))(new Redis(config['redis']));require(_0x3930('0x15'))[_0x3930('0x16')](socket);function respondWithStatusCode(_0x4ef6c4,_0x457912){_0x457912=_0x457912||0xcc;return function(_0x44603d){if(_0x44603d){return _0x4ef6c4[_0x3930('0x17')](_0x457912);}return _0x4ef6c4[_0x3930('0x18')](_0x457912)['end']();};}function respondWithResult(_0x55ec9b,_0x3a2ac0){_0x3a2ac0=_0x3a2ac0||0xc8;return function(_0x49468d){if(_0x49468d){return _0x55ec9b[_0x3930('0x18')](_0x3a2ac0)['json'](_0x49468d);}};}function respondWithFilteredResult(_0x4113c4,_0x5bf6f4){return function(_0x5a1c39){if(_0x5a1c39){var _0x4a1405=typeof _0x5bf6f4['offset']===_0x3930('0x19')&&typeof _0x5bf6f4[_0x3930('0x1a')]===_0x3930('0x19');var _0x5b5f55=_0x5a1c39['count'];var _0x4f4e2e=_0x4a1405?0x0:_0x5bf6f4['offset'];var _0x3400f5=_0x4a1405?_0x5a1c39[_0x3930('0x1b')]:_0x5bf6f4[_0x3930('0x1c')]+_0x5bf6f4[_0x3930('0x1a')];var _0x3d2a2f;if(_0x3400f5>=_0x5b5f55){_0x3400f5=_0x5b5f55;_0x3d2a2f=0xc8;}else{_0x3d2a2f=0xce;}_0x4113c4['status'](_0x3d2a2f);return _0x4113c4[_0x3930('0x1d')](_0x3930('0x1e'),_0x4f4e2e+'-'+_0x3400f5+'/'+_0x5b5f55)[_0x3930('0x1f')](_0x5a1c39);}return null;};}function patchUpdates(_0x4a4307){return function(_0x30ccf0){try{jsonpatch[_0x3930('0x20')](_0x30ccf0,_0x4a4307,!![]);}catch(_0x12eeb7){return BPromise[_0x3930('0x21')](_0x12eeb7);}return _0x30ccf0[_0x3930('0x22')]();};}function saveUpdates(_0x186e2e,_0x347d7d){return function(_0x14acf5){if(_0x14acf5){return _0x14acf5['update'](_0x186e2e)[_0x3930('0x23')](function(_0x1dcdcd){return _0x1dcdcd;});}return null;};}function removeEntity(_0x187453,_0x11358e){return function(_0x454138){if(_0x454138){return _0x454138['destroy']()[_0x3930('0x23')](function(){_0x187453[_0x3930('0x18')](0xcc)[_0x3930('0x24')]();});}};}function handleEntityNotFound(_0x5b20a7,_0x2ec9b1){return function(_0x306d5b){if(!_0x306d5b){_0x5b20a7[_0x3930('0x17')](0x194);}return _0x306d5b;};}function handleError(_0x423fe6,_0x582b18){_0x582b18=_0x582b18||0x1f4;return function(_0x575e76){logger[_0x3930('0x25')](_0x575e76[_0x3930('0x26')]);if(_0x575e76[_0x3930('0x27')]){delete _0x575e76['name'];}_0x423fe6[_0x3930('0x18')](_0x582b18)[_0x3930('0x28')](_0x575e76);};}exports[_0x3930('0x29')]=function(_0x3e41de,_0x11290d){var _0x8fdd26={'raw':![],'where':{'id':_0x3e41de[_0x3930('0x2a')]['id']}},_0xcd21b7={};_0xcd21b7[_0x3930('0x2b')]=_[_0x3930('0x2c')](db[_0x3930('0x2d')][_0x3930('0x2e')]);_0xcd21b7[_0x3930('0x2f')]=_[_0x3930('0x2c')](_0x3e41de[_0x3930('0x2f')]);_0xcd21b7[_0x3930('0x30')]=_[_0x3930('0x31')](_0xcd21b7[_0x3930('0x2b')],_0xcd21b7[_0x3930('0x2f')]);_0x8fdd26[_0x3930('0x32')]=_['intersection'](_0xcd21b7['model'],qs['fields'](_0x3e41de[_0x3930('0x2f')][_0x3930('0x33')]));_0x8fdd26['attributes']=_0x8fdd26[_0x3930('0x32')][_0x3930('0x34')]?_0x8fdd26['attributes']:_0xcd21b7[_0x3930('0x2b')];if(_0x3e41de['query'][_0x3930('0x35')]){_0x8fdd26[_0x3930('0x36')]=[{'all':!![]}];}_0x8fdd26=_[_0x3930('0x37')]({},_0x8fdd26,_0x3e41de[_0x3930('0x38')]);return db[_0x3930('0x2d')][_0x3930('0x39')](_0x8fdd26)[_0x3930('0x23')](handleEntityNotFound(_0x11290d,null))[_0x3930('0x23')](respondWithResult(_0x11290d,null))[_0x3930('0x3a')](handleError(_0x11290d,null));};exports[_0x3930('0x3b')]=function(_0x315091,_0x2e9694){return db[_0x3930('0x2d')][_0x3930('0x39')]({'where':{'id':_0x315091[_0x3930('0x2a')]['id']}})[_0x3930('0x23')](handleEntityNotFound(_0x2e9694,null))['then'](removeEntity(_0x2e9694,null))[_0x3930('0x3a')](handleError(_0x2e9694,null));};function widgetAttributes(_0x533d69){try{switch(_0x533d69[_0x3930('0x3c')]){case'iframe':return[{'name':_0x3930('0x3d'),'value':_0x533d69['attrUrl']||(_0x533d69['attrs']&&_0x533d69[_0x3930('0x3e')][0x0]?_0x533d69[_0x3930('0x3e')][0x0]['value']:undefined)||'https://'}];case _0x3930('0x3f'):return[{'name':'attrPath','value':_0x533d69[_0x3930('0x40')]||(_0x533d69[_0x3930('0x3e')]&&_0x533d69[_0x3930('0x3e')][0x0]?_0x533d69[_0x3930('0x3e')][0x0][_0x3930('0x41')]:undefined)||''}];case _0x3930('0x42'):return[{'name':_0x3930('0x43'),'value':_0x533d69[_0x3930('0x43')]||(_0x533d69['attrs']&&_0x533d69['attrs'][0x0]?_0x533d69[_0x3930('0x3e')][0x0][_0x3930('0x41')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x533d69[_0x3930('0x44')]||(_0x533d69[_0x3930('0x3e')]&&_0x533d69[_0x3930('0x3e')][0x1]?_0x533d69['attrs'][0x1]['value']:undefined)||_0x3930('0x45')},{'name':_0x3930('0x46'),'value':_0x533d69[_0x3930('0x46')]||(_0x533d69[_0x3930('0x3e')]&&_0x533d69['attrs'][0x2]?_0x533d69['attrs'][0x2][_0x3930('0x41')]:undefined)||0xc}];case'counter':return[{'name':_0x3930('0x47'),'value':_0x533d69[_0x3930('0x47')]||(_0x533d69['attrs']&&_0x533d69[_0x3930('0x3e')][0x0]?_0x533d69['attrs'][0x0][_0x3930('0x41')]:undefined)||_0x3930('0x48')},{'name':_0x3930('0x49'),'value':_0x533d69[_0x3930('0x49')]||(_0x533d69[_0x3930('0x3e')]&&_0x533d69[_0x3930('0x3e')][0x1]?_0x533d69[_0x3930('0x3e')][0x1][_0x3930('0x41')]:undefined)||[]},{'name':_0x3930('0x46'),'value':_0x533d69[_0x3930('0x46')]||(_0x533d69[_0x3930('0x3e')]&&_0x533d69[_0x3930('0x3e')][0x2]?_0x533d69[_0x3930('0x3e')][0x2][_0x3930('0x41')]:undefined)||0x14},{'name':_0x3930('0x4a'),'value':_0x533d69['attrChannel']||(_0x533d69[_0x3930('0x3e')]&&_0x533d69[_0x3930('0x3e')][0x3]?_0x533d69[_0x3930('0x3e')][0x3][_0x3930('0x41')]:undefined)||_0x3930('0x4b')},{'name':_0x3930('0x4c'),'value':_0x533d69['attrEmailAccounts']||(_0x533d69[_0x3930('0x3e')]&&_0x533d69[_0x3930('0x3e')][0x4]?_0x533d69[_0x3930('0x3e')][0x4][_0x3930('0x41')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x533d69[_0x3930('0x4d')]||(_0x533d69['attrs']&&_0x533d69[_0x3930('0x3e')][0x5]?_0x533d69['attrs'][0x5]['value']:undefined)||''},{'name':_0x3930('0x4e'),'value':_0x533d69[_0x3930('0x4e')]||(_0x533d69['attrs']&&_0x533d69[_0x3930('0x3e')][0x6]?_0x533d69[_0x3930('0x3e')][0x6][_0x3930('0x41')]:undefined)||''},{'name':_0x3930('0x4f'),'value':_0x533d69['attrOpenchannelAccounts']||(_0x533d69[_0x3930('0x3e')]&&_0x533d69[_0x3930('0x3e')][0x7]?_0x533d69[_0x3930('0x3e')][0x7][_0x3930('0x41')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x533d69[_0x3930('0x50')]||(_0x533d69[_0x3930('0x3e')]&&_0x533d69[_0x3930('0x3e')][0x8]?_0x533d69[_0x3930('0x3e')][0x8][_0x3930('0x41')]:undefined)||''},{'name':_0x3930('0x51'),'value':_0x533d69['attrChatWebsites']||(_0x533d69[_0x3930('0x3e')]&&_0x533d69[_0x3930('0x3e')][0x9]?_0x533d69['attrs'][0x9][_0x3930('0x41')]:undefined)||''}];case'multibar-chart':case _0x3930('0x52'):return[{'name':_0x3930('0x53'),'value':_0x533d69[_0x3930('0x53')]||(_0x533d69[_0x3930('0x3e')]&&_0x533d69['attrs'][0x0]?_0x533d69[_0x3930('0x3e')][0x0][_0x3930('0x41')]:undefined)||_0x3930('0x48')},{'name':_0x3930('0x54'),'value':_0x533d69[_0x3930('0x54')]||(_0x533d69[_0x3930('0x3e')]&&_0x533d69[_0x3930('0x3e')][0x1]?_0x533d69[_0x3930('0x3e')][0x1][_0x3930('0x41')]:undefined)||null},{'name':_0x3930('0x55'),'value':_0x533d69['attrSerie3']||(_0x533d69[_0x3930('0x3e')]&&_0x533d69[_0x3930('0x3e')][0x2]?_0x533d69[_0x3930('0x3e')][0x2]['value']:undefined)||null},{'name':_0x3930('0x49'),'value':_0x533d69['attrVoiceQueues']||(_0x533d69[_0x3930('0x3e')]&&_0x533d69['attrs'][0x3]?_0x533d69[_0x3930('0x3e')][0x3][_0x3930('0x41')]:undefined)||[]},{'name':_0x3930('0x4a'),'value':_0x533d69[_0x3930('0x4a')]||(_0x533d69[_0x3930('0x3e')]&&_0x533d69[_0x3930('0x3e')][0x4]?_0x533d69[_0x3930('0x3e')][0x4][_0x3930('0x41')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x533d69[_0x3930('0x4c')]||(_0x533d69[_0x3930('0x3e')]&&_0x533d69['attrs'][0x5]?_0x533d69['attrs'][0x5][_0x3930('0x41')]:undefined)||''},{'name':_0x3930('0x4d'),'value':_0x533d69[_0x3930('0x4d')]||(_0x533d69['attrs']&&_0x533d69[_0x3930('0x3e')][0x6]?_0x533d69[_0x3930('0x3e')][0x6][_0x3930('0x41')]:undefined)||''},{'name':_0x3930('0x4e'),'value':_0x533d69[_0x3930('0x4e')]||(_0x533d69['attrs']&&_0x533d69['attrs'][0x7]?_0x533d69[_0x3930('0x3e')][0x7][_0x3930('0x41')]:undefined)||''},{'name':_0x3930('0x4f'),'value':_0x533d69['attrOpenchannelAccounts']||(_0x533d69['attrs']&&_0x533d69['attrs'][0x8]?_0x533d69['attrs'][0x8][_0x3930('0x41')]:undefined)||''},{'name':_0x3930('0x50'),'value':_0x533d69[_0x3930('0x50')]||(_0x533d69[_0x3930('0x3e')]&&_0x533d69['attrs'][0x9]?_0x533d69[_0x3930('0x3e')][0x9][_0x3930('0x41')]:undefined)||''},{'name':'attrChatWebsites','value':_0x533d69[_0x3930('0x51')]||(_0x533d69[_0x3930('0x3e')]&&_0x533d69[_0x3930('0x3e')][0xa]?_0x533d69[_0x3930('0x3e')][0xa][_0x3930('0x41')]:undefined)||''}];case _0x3930('0x56'):return[{'name':'attrReport','type':_0x533d69[_0x3930('0x57')]||(_0x533d69[_0x3930('0x3e')]&&_0x533d69[_0x3930('0x3e')][0x0]?_0x533d69['attrs'][0x0][_0x3930('0x3c')]:undefined)||null,'value':_0x533d69[_0x3930('0x58')]||(_0x533d69[_0x3930('0x3e')]&&_0x533d69[_0x3930('0x3e')][0x0]?_0x533d69[_0x3930('0x3e')][0x0][_0x3930('0x41')]:undefined)||null},{'name':'attrRefresh','value':_0x533d69[_0x3930('0x59')]||(_0x533d69['attrs']&&_0x533d69[_0x3930('0x3e')][0x1]?_0x533d69['attrs'][0x1][_0x3930('0x41')]:undefined)||0x0}];default:return[];}}catch(_0x51637e){logger[_0x3930('0x25')]('widgetAttributes:\x20%s',JSON['stringify'](_0x51637e));return[];}}exports[_0x3930('0x5a')]=function(_0x2b29d3,_0x4159f6){if(_0x2b29d3[_0x3930('0x5b')]){_0x2b29d3[_0x3930('0x5b')][_0x3930('0x3e')]=widgetAttributes(_0x2b29d3[_0x3930('0x5b')]);}return db[_0x3930('0x2d')]['create'](_0x2b29d3[_0x3930('0x5b')],{})['then'](respondWithResult(_0x4159f6,0xc9))[_0x3930('0x3a')](handleError(_0x4159f6,null));};exports[_0x3930('0x5c')]=function(_0x1f5cd9,_0x406b34){if(_0x1f5cd9[_0x3930('0x5b')]['id']){delete _0x1f5cd9[_0x3930('0x5b')]['id'];}_0x1f5cd9['body'][_0x3930('0x3e')]=widgetAttributes(_0x1f5cd9[_0x3930('0x5b')]);return db['DashboardItem'][_0x3930('0x39')]({'where':{'id':_0x1f5cd9[_0x3930('0x2a')]['id']}})[_0x3930('0x23')](handleEntityNotFound(_0x406b34,null))['then'](saveUpdates(_0x1f5cd9['body'],null))[_0x3930('0x23')](respondWithResult(_0x406b34,null))['catch'](handleError(_0x406b34,null));}; \ No newline at end of file +var _0xcddb=['save','update','then','destroy','status','error','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','attributes','length','includeAll','include','merge','options','find','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','voice','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','create','body','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject'];(function(_0x341c58,_0x5b80f7){var _0x524f0e=function(_0x3a7c21){while(--_0x3a7c21){_0x341c58['push'](_0x341c58['shift']());}};_0x524f0e(++_0x5b80f7);}(_0xcddb,0x1c4));var _0xbcdd=function(_0x6ef878,_0x601b3c){_0x6ef878=_0x6ef878-0x0;var _0x3b6dc6=_0xcddb[_0x6ef878];return _0x3b6dc6;};'use strict';var emlformat=require(_0xbcdd('0x0'));var rimraf=require(_0xbcdd('0x1'));var zipdir=require(_0xbcdd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbcdd('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbcdd('0x4'));var util=require(_0xbcdd('0x5'));var path=require(_0xbcdd('0x6'));var sox=require(_0xbcdd('0x7'));var csv=require('to-csv');var ejs=require(_0xbcdd('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbcdd('0x9'));var squel=require(_0xbcdd('0xa'));var crypto=require('crypto');var jsforce=require(_0xbcdd('0xb'));var deskjs=require(_0xbcdd('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbcdd('0xd'));var Redis=require(_0xbcdd('0xe'));var authService=require(_0xbcdd('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xbcdd('0x10'));var hardwareService=require(_0xbcdd('0x11'));var logger=require(_0xbcdd('0x12'))(_0xbcdd('0x13'));var utils=require('../../config/utils');var config=require(_0xbcdd('0x14'));var licenseUtil=require(_0xbcdd('0x15'));var db=require('../../mysqldb')['db'];config[_0xbcdd('0x16')]=_[_0xbcdd('0x17')](config['redis'],{'host':_0xbcdd('0x18'),'port':0x18eb});var socket=require(_0xbcdd('0x19'))(new Redis(config['redis']));require('./dashboardItem.socket')[_0xbcdd('0x1a')](socket);function respondWithStatusCode(_0x34e4cb,_0x22b66c){_0x22b66c=_0x22b66c||0xcc;return function(_0x12f57c){if(_0x12f57c){return _0x34e4cb[_0xbcdd('0x1b')](_0x22b66c);}return _0x34e4cb['status'](_0x22b66c)[_0xbcdd('0x1c')]();};}function respondWithResult(_0x408055,_0x4e2342){_0x4e2342=_0x4e2342||0xc8;return function(_0x1f077e){if(_0x1f077e){return _0x408055['status'](_0x4e2342)[_0xbcdd('0x1d')](_0x1f077e);}};}function respondWithFilteredResult(_0x2e7eeb,_0x177cc5){return function(_0x47ae02){if(_0x47ae02){var _0x1b27cb=typeof _0x177cc5[_0xbcdd('0x1e')]===_0xbcdd('0x1f')&&typeof _0x177cc5[_0xbcdd('0x20')]===_0xbcdd('0x1f');var _0x5ad171=_0x47ae02[_0xbcdd('0x21')];var _0x3396bb=_0x1b27cb?0x0:_0x177cc5[_0xbcdd('0x1e')];var _0x1477f1=_0x1b27cb?_0x47ae02[_0xbcdd('0x21')]:_0x177cc5[_0xbcdd('0x1e')]+_0x177cc5['limit'];var _0x224a84;if(_0x1477f1>=_0x5ad171){_0x1477f1=_0x5ad171;_0x224a84=0xc8;}else{_0x224a84=0xce;}_0x2e7eeb['status'](_0x224a84);return _0x2e7eeb[_0xbcdd('0x22')](_0xbcdd('0x23'),_0x3396bb+'-'+_0x1477f1+'/'+_0x5ad171)[_0xbcdd('0x1d')](_0x47ae02);}return null;};}function patchUpdates(_0x23bbd5){return function(_0x5a891b){try{jsonpatch[_0xbcdd('0x24')](_0x5a891b,_0x23bbd5,!![]);}catch(_0x2cd0dd){return BPromise[_0xbcdd('0x25')](_0x2cd0dd);}return _0x5a891b[_0xbcdd('0x26')]();};}function saveUpdates(_0x527e71,_0x155e28){return function(_0x2f85af){if(_0x2f85af){return _0x2f85af[_0xbcdd('0x27')](_0x527e71)[_0xbcdd('0x28')](function(_0x3cfd0f){return _0x3cfd0f;});}return null;};}function removeEntity(_0x5441a9,_0x1f334d){return function(_0x15671c){if(_0x15671c){return _0x15671c[_0xbcdd('0x29')]()[_0xbcdd('0x28')](function(){_0x5441a9[_0xbcdd('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x340fc0,_0x5f2c82){return function(_0x58cc33){if(!_0x58cc33){_0x340fc0[_0xbcdd('0x1b')](0x194);}return _0x58cc33;};}function handleError(_0x179db9,_0x3a804c){_0x3a804c=_0x3a804c||0x1f4;return function(_0x18b13b){logger[_0xbcdd('0x2b')](_0x18b13b['stack']);if(_0x18b13b[_0xbcdd('0x2c')]){delete _0x18b13b['name'];}_0x179db9['status'](_0x3a804c)[_0xbcdd('0x2d')](_0x18b13b);};}exports[_0xbcdd('0x2e')]=function(_0x5bdb8a,_0x2dc944){var _0x561fb4={'raw':![],'where':{'id':_0x5bdb8a[_0xbcdd('0x2f')]['id']}},_0x3cdcb3={};_0x3cdcb3[_0xbcdd('0x30')]=_[_0xbcdd('0x31')](db[_0xbcdd('0x32')][_0xbcdd('0x33')]);_0x3cdcb3[_0xbcdd('0x34')]=_['keys'](_0x5bdb8a[_0xbcdd('0x34')]);_0x3cdcb3[_0xbcdd('0x35')]=_['intersection'](_0x3cdcb3['model'],_0x3cdcb3[_0xbcdd('0x34')]);_0x561fb4[_0xbcdd('0x36')]=_['intersection'](_0x3cdcb3[_0xbcdd('0x30')],qs['fields'](_0x5bdb8a[_0xbcdd('0x34')]['fields']));_0x561fb4[_0xbcdd('0x36')]=_0x561fb4['attributes'][_0xbcdd('0x37')]?_0x561fb4[_0xbcdd('0x36')]:_0x3cdcb3['model'];if(_0x5bdb8a[_0xbcdd('0x34')][_0xbcdd('0x38')]){_0x561fb4[_0xbcdd('0x39')]=[{'all':!![]}];}_0x561fb4=_[_0xbcdd('0x3a')]({},_0x561fb4,_0x5bdb8a[_0xbcdd('0x3b')]);return db['DashboardItem'][_0xbcdd('0x3c')](_0x561fb4)['then'](handleEntityNotFound(_0x2dc944,null))[_0xbcdd('0x28')](respondWithResult(_0x2dc944,null))[_0xbcdd('0x3d')](handleError(_0x2dc944,null));};exports['destroy']=function(_0x5e136d,_0x9e45b4){return db['DashboardItem'][_0xbcdd('0x3c')]({'where':{'id':_0x5e136d[_0xbcdd('0x2f')]['id']}})[_0xbcdd('0x28')](handleEntityNotFound(_0x9e45b4,null))['then'](removeEntity(_0x9e45b4,null))[_0xbcdd('0x3d')](handleError(_0x9e45b4,null));};function widgetAttributes(_0x1ae6c7){try{switch(_0x1ae6c7[_0xbcdd('0x3e')]){case _0xbcdd('0x3f'):return[{'name':_0xbcdd('0x40'),'value':_0x1ae6c7[_0xbcdd('0x40')]||(_0x1ae6c7[_0xbcdd('0x41')]&&_0x1ae6c7[_0xbcdd('0x41')][0x0]?_0x1ae6c7[_0xbcdd('0x41')][0x0][_0xbcdd('0x42')]:undefined)||_0xbcdd('0x43')}];case _0xbcdd('0x44'):return[{'name':'attrPath','value':_0x1ae6c7[_0xbcdd('0x45')]||(_0x1ae6c7[_0xbcdd('0x41')]&&_0x1ae6c7[_0xbcdd('0x41')][0x0]?_0x1ae6c7[_0xbcdd('0x41')][0x0][_0xbcdd('0x42')]:undefined)||''}];case _0xbcdd('0x46'):return[{'name':'attrHourFormat','value':_0x1ae6c7[_0xbcdd('0x47')]||(_0x1ae6c7['attrs']&&_0x1ae6c7[_0xbcdd('0x41')][0x0]?_0x1ae6c7['attrs'][0x0][_0xbcdd('0x42')]:undefined)||_0xbcdd('0x48')},{'name':'attrTimezone','value':_0x1ae6c7[_0xbcdd('0x49')]||(_0x1ae6c7[_0xbcdd('0x41')]&&_0x1ae6c7[_0xbcdd('0x41')][0x1]?_0x1ae6c7[_0xbcdd('0x41')][0x1]['value']:undefined)||'0.00'},{'name':_0xbcdd('0x4a'),'value':_0x1ae6c7[_0xbcdd('0x4a')]||(_0x1ae6c7[_0xbcdd('0x41')]&&_0x1ae6c7['attrs'][0x2]?_0x1ae6c7[_0xbcdd('0x41')][0x2][_0xbcdd('0x42')]:undefined)||0xc}];case'counter':return[{'name':_0xbcdd('0x4b'),'value':_0x1ae6c7[_0xbcdd('0x4b')]||(_0x1ae6c7[_0xbcdd('0x41')]&&_0x1ae6c7['attrs'][0x0]?_0x1ae6c7[_0xbcdd('0x41')][0x0][_0xbcdd('0x42')]:undefined)||_0xbcdd('0x4c')},{'name':'attrVoiceQueues','value':_0x1ae6c7[_0xbcdd('0x4d')]||(_0x1ae6c7[_0xbcdd('0x41')]&&_0x1ae6c7[_0xbcdd('0x41')][0x1]?_0x1ae6c7[_0xbcdd('0x41')][0x1][_0xbcdd('0x42')]:undefined)||[]},{'name':_0xbcdd('0x4a'),'value':_0x1ae6c7[_0xbcdd('0x4a')]||(_0x1ae6c7[_0xbcdd('0x41')]&&_0x1ae6c7[_0xbcdd('0x41')][0x2]?_0x1ae6c7[_0xbcdd('0x41')][0x2][_0xbcdd('0x42')]:undefined)||0x14},{'name':_0xbcdd('0x4e'),'value':_0x1ae6c7['attrChannel']||(_0x1ae6c7[_0xbcdd('0x41')]&&_0x1ae6c7['attrs'][0x3]?_0x1ae6c7[_0xbcdd('0x41')][0x3][_0xbcdd('0x42')]:undefined)||'voice'},{'name':_0xbcdd('0x4f'),'value':_0x1ae6c7[_0xbcdd('0x4f')]||(_0x1ae6c7[_0xbcdd('0x41')]&&_0x1ae6c7[_0xbcdd('0x41')][0x4]?_0x1ae6c7[_0xbcdd('0x41')][0x4]['value']:undefined)||''},{'name':_0xbcdd('0x50'),'value':_0x1ae6c7[_0xbcdd('0x50')]||(_0x1ae6c7['attrs']&&_0x1ae6c7['attrs'][0x5]?_0x1ae6c7[_0xbcdd('0x41')][0x5][_0xbcdd('0x42')]:undefined)||''},{'name':_0xbcdd('0x51'),'value':_0x1ae6c7[_0xbcdd('0x51')]||(_0x1ae6c7[_0xbcdd('0x41')]&&_0x1ae6c7[_0xbcdd('0x41')][0x6]?_0x1ae6c7[_0xbcdd('0x41')][0x6]['value']:undefined)||''},{'name':_0xbcdd('0x52'),'value':_0x1ae6c7[_0xbcdd('0x52')]||(_0x1ae6c7['attrs']&&_0x1ae6c7[_0xbcdd('0x41')][0x7]?_0x1ae6c7['attrs'][0x7][_0xbcdd('0x42')]:undefined)||''},{'name':_0xbcdd('0x53'),'value':_0x1ae6c7[_0xbcdd('0x53')]||(_0x1ae6c7[_0xbcdd('0x41')]&&_0x1ae6c7[_0xbcdd('0x41')][0x8]?_0x1ae6c7[_0xbcdd('0x41')][0x8][_0xbcdd('0x42')]:undefined)||''},{'name':_0xbcdd('0x54'),'value':_0x1ae6c7['attrChatWebsites']||(_0x1ae6c7['attrs']&&_0x1ae6c7[_0xbcdd('0x41')][0x9]?_0x1ae6c7[_0xbcdd('0x41')][0x9]['value']:undefined)||''}];case _0xbcdd('0x55'):case _0xbcdd('0x56'):return[{'name':_0xbcdd('0x57'),'value':_0x1ae6c7[_0xbcdd('0x57')]||(_0x1ae6c7[_0xbcdd('0x41')]&&_0x1ae6c7['attrs'][0x0]?_0x1ae6c7[_0xbcdd('0x41')][0x0][_0xbcdd('0x42')]:undefined)||_0xbcdd('0x4c')},{'name':_0xbcdd('0x58'),'value':_0x1ae6c7['attrSerie2']||(_0x1ae6c7['attrs']&&_0x1ae6c7['attrs'][0x1]?_0x1ae6c7[_0xbcdd('0x41')][0x1][_0xbcdd('0x42')]:undefined)||null},{'name':_0xbcdd('0x59'),'value':_0x1ae6c7['attrSerie3']||(_0x1ae6c7[_0xbcdd('0x41')]&&_0x1ae6c7[_0xbcdd('0x41')][0x2]?_0x1ae6c7[_0xbcdd('0x41')][0x2][_0xbcdd('0x42')]:undefined)||null},{'name':_0xbcdd('0x4d'),'value':_0x1ae6c7[_0xbcdd('0x4d')]||(_0x1ae6c7[_0xbcdd('0x41')]&&_0x1ae6c7[_0xbcdd('0x41')][0x3]?_0x1ae6c7[_0xbcdd('0x41')][0x3]['value']:undefined)||[]},{'name':_0xbcdd('0x4e'),'value':_0x1ae6c7[_0xbcdd('0x4e')]||(_0x1ae6c7[_0xbcdd('0x41')]&&_0x1ae6c7[_0xbcdd('0x41')][0x4]?_0x1ae6c7[_0xbcdd('0x41')][0x4][_0xbcdd('0x42')]:undefined)||_0xbcdd('0x5a')},{'name':_0xbcdd('0x4f'),'value':_0x1ae6c7['attrEmailAccounts']||(_0x1ae6c7['attrs']&&_0x1ae6c7[_0xbcdd('0x41')][0x5]?_0x1ae6c7[_0xbcdd('0x41')][0x5][_0xbcdd('0x42')]:undefined)||''},{'name':_0xbcdd('0x50'),'value':_0x1ae6c7['attrFaxAccounts']||(_0x1ae6c7[_0xbcdd('0x41')]&&_0x1ae6c7['attrs'][0x6]?_0x1ae6c7['attrs'][0x6][_0xbcdd('0x42')]:undefined)||''},{'name':_0xbcdd('0x51'),'value':_0x1ae6c7[_0xbcdd('0x51')]||(_0x1ae6c7[_0xbcdd('0x41')]&&_0x1ae6c7[_0xbcdd('0x41')][0x7]?_0x1ae6c7[_0xbcdd('0x41')][0x7]['value']:undefined)||''},{'name':_0xbcdd('0x52'),'value':_0x1ae6c7[_0xbcdd('0x52')]||(_0x1ae6c7['attrs']&&_0x1ae6c7[_0xbcdd('0x41')][0x8]?_0x1ae6c7['attrs'][0x8][_0xbcdd('0x42')]:undefined)||''},{'name':_0xbcdd('0x53'),'value':_0x1ae6c7[_0xbcdd('0x53')]||(_0x1ae6c7[_0xbcdd('0x41')]&&_0x1ae6c7[_0xbcdd('0x41')][0x9]?_0x1ae6c7['attrs'][0x9][_0xbcdd('0x42')]:undefined)||''},{'name':_0xbcdd('0x54'),'value':_0x1ae6c7[_0xbcdd('0x54')]||(_0x1ae6c7[_0xbcdd('0x41')]&&_0x1ae6c7['attrs'][0xa]?_0x1ae6c7[_0xbcdd('0x41')][0xa][_0xbcdd('0x42')]:undefined)||''}];case _0xbcdd('0x5b'):return[{'name':_0xbcdd('0x5c'),'type':_0x1ae6c7[_0xbcdd('0x5d')]||(_0x1ae6c7[_0xbcdd('0x41')]&&_0x1ae6c7['attrs'][0x0]?_0x1ae6c7[_0xbcdd('0x41')][0x0][_0xbcdd('0x3e')]:undefined)||null,'value':_0x1ae6c7[_0xbcdd('0x5c')]||(_0x1ae6c7[_0xbcdd('0x41')]&&_0x1ae6c7[_0xbcdd('0x41')][0x0]?_0x1ae6c7[_0xbcdd('0x41')][0x0][_0xbcdd('0x42')]:undefined)||null},{'name':_0xbcdd('0x5e'),'value':_0x1ae6c7[_0xbcdd('0x5e')]||(_0x1ae6c7['attrs']&&_0x1ae6c7['attrs'][0x1]?_0x1ae6c7[_0xbcdd('0x41')][0x1][_0xbcdd('0x42')]:undefined)||0x0}];default:return[];}}catch(_0x492bae){logger['error'](_0xbcdd('0x5f'),JSON['stringify'](_0x492bae));return[];}}exports[_0xbcdd('0x60')]=function(_0x30137d,_0x4baa60){if(_0x30137d[_0xbcdd('0x61')]){_0x30137d['body'][_0xbcdd('0x41')]=widgetAttributes(_0x30137d[_0xbcdd('0x61')]);}return db[_0xbcdd('0x32')][_0xbcdd('0x60')](_0x30137d[_0xbcdd('0x61')],{})['then'](respondWithResult(_0x4baa60,0xc9))[_0xbcdd('0x3d')](handleError(_0x4baa60,null));};exports[_0xbcdd('0x27')]=function(_0x58b279,_0x58db35){if(_0x58b279[_0xbcdd('0x61')]['id']){delete _0x58b279['body']['id'];}_0x58b279[_0xbcdd('0x61')][_0xbcdd('0x41')]=widgetAttributes(_0x58b279[_0xbcdd('0x61')]);return db[_0xbcdd('0x32')][_0xbcdd('0x3c')]({'where':{'id':_0x58b279[_0xbcdd('0x2f')]['id']}})[_0xbcdd('0x28')](handleEntityNotFound(_0x58db35,null))[_0xbcdd('0x28')](saveUpdates(_0x58b279[_0xbcdd('0x61')],null))[_0xbcdd('0x28')](respondWithResult(_0x58db35,null))[_0xbcdd('0x3d')](handleError(_0x58db35,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 38f8b6d..5246692 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 _0x9641=['hook','events','../../mysqldb','DashboardItem','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x1d56a5,_0x31fbd9){var _0x53c0a0=function(_0x34183f){while(--_0x34183f){_0x1d56a5['push'](_0x1d56a5['shift']());}};_0x53c0a0(++_0x31fbd9);}(_0x9641,0x79));var _0x1964=function(_0xb4e052,_0x1d3cb6){_0xb4e052=_0xb4e052-0x0;var _0x5197e7=_0x9641[_0xb4e052];return _0x5197e7;};'use strict';var EventEmitter=require(_0x1964('0x0'));var DashboardItem=require(_0x1964('0x1'))['db'][_0x1964('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x1964('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x1964('0x4')};function emitEvent(_0x44cb57){return function(_0x4f7621,_0x3fbf9e,_0xcfce88){DashboardItemEvents['emit'](_0x44cb57+':'+_0x4f7621['id'],_0x4f7621);DashboardItemEvents[_0x1964('0x5')](_0x44cb57,_0x4f7621);_0xcfce88(null);};}for(var e in events){if(events[_0x1964('0x6')](e)){var event=events[e];DashboardItem[_0x1964('0x7')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0x2ccd=['DashboardItem','setMaxListeners','save','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x13cdfd,_0x2e2521){var _0x50eee0=function(_0xc8dbe7){while(--_0xc8dbe7){_0x13cdfd['push'](_0x13cdfd['shift']());}};_0x50eee0(++_0x2e2521);}(_0x2ccd,0x142));var _0xd2cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2ccd[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xd2cc('0x0'));var DashboardItem=require(_0xd2cc('0x1'))['db'][_0xd2cc('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xd2cc('0x3')](0x0);var events={'afterCreate':_0xd2cc('0x4'),'afterUpdate':_0xd2cc('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4effa4){return function(_0x3eb22c,_0x68552a,_0x2aa6f9){DashboardItemEvents[_0xd2cc('0x6')](_0x4effa4+':'+_0x3eb22c['id'],_0x3eb22c);DashboardItemEvents[_0xd2cc('0x6')](_0x4effa4,_0x3eb22c);_0x2aa6f9(null);};}for(var e in events){if(events[_0xd2cc('0x7')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0xd2cc('0x8')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index a041d21..69f230c 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 _0xd78b=['dashboard_items','util','../../config/logger','api','bluebird','request-promise','./dashboardItem.attributes','exports','define','DashboardItem'];(function(_0x306646,_0xdc2e1b){var _0x40bd8d=function(_0x397d05){while(--_0x397d05){_0x306646['push'](_0x306646['shift']());}};_0x40bd8d(++_0xdc2e1b);}(_0xd78b,0x155));var _0xbd78=function(_0x5db81b,_0x55a0a2){_0x5db81b=_0x5db81b-0x0;var _0x37e027=_0xd78b[_0x5db81b];return _0x37e027;};'use strict';var _=require('lodash');var util=require(_0xbd78('0x0'));var logger=require(_0xbd78('0x1'))(_0xbd78('0x2'));var moment=require('moment');var BPromise=require(_0xbd78('0x3'));var rp=require(_0xbd78('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbd78('0x5'));module[_0xbd78('0x6')]=function(_0x4d8ef1,_0x404d1c){return _0x4d8ef1[_0xbd78('0x7')](_0xbd78('0x8'),attributes,{'tableName':_0xbd78('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4a25=['path','../../config/environment','./dashboardItem.attributes','exports','DashboardItem','dashboard_items','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x19d24c,_0x62bc50){var _0x2fae8d=function(_0x419856){while(--_0x419856){_0x19d24c['push'](_0x19d24c['shift']());}};_0x2fae8d(++_0x62bc50);}(_0x4a25,0x1d4));var _0x54a2=function(_0x574ce3,_0x59eef4){_0x574ce3=_0x574ce3-0x0;var _0x3447a0=_0x4a25[_0x574ce3];return _0x3447a0;};'use strict';var _=require(_0x54a2('0x0'));var util=require('util');var logger=require(_0x54a2('0x1'))('api');var moment=require(_0x54a2('0x2'));var BPromise=require(_0x54a2('0x3'));var rp=require(_0x54a2('0x4'));var fs=require('fs');var path=require(_0x54a2('0x5'));var rimraf=require('rimraf');var config=require(_0x54a2('0x6'));var attributes=require(_0x54a2('0x7'));module[_0x54a2('0x8')]=function(_0x3ecde5,_0x472eed){return _0x3ecde5['define'](_0x54a2('0x9'),attributes,{'tableName':_0x54a2('0xa'),'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 f36d496..098cee8 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 _0x7ed9=['stringify','error','code','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','redis','localhost','socket.io-emitter','./dashboardItem.socket','request','then','DashboardItem,\x20%s,\x20%s','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s'];(function(_0x56fe98,_0x43dc16){var _0x212f4f=function(_0xc3427d){while(--_0xc3427d){_0x56fe98['push'](_0x56fe98['shift']());}};_0x212f4f(++_0x43dc16);}(_0x7ed9,0xde));var _0x97ed=function(_0x53ee8f,_0x41b139){_0x53ee8f=_0x53ee8f-0x0;var _0x147617=_0x7ed9[_0x53ee8f];return _0x147617;};'use strict';var _=require(_0x97ed('0x0'));var util=require(_0x97ed('0x1'));var moment=require(_0x97ed('0x2'));var BPromise=require(_0x97ed('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x97ed('0x4'));var db=require(_0x97ed('0x5'))['db'];var utils=require(_0x97ed('0x6'));var logger=require('../../config/logger')(_0x97ed('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x97ed('0x8')]['http']({'port':0x232a});config[_0x97ed('0x9')]=_['defaults'](config[_0x97ed('0x9')],{'host':_0x97ed('0xa'),'port':0x18eb});var socket=require(_0x97ed('0xb'))(new Redis(config[_0x97ed('0x9')]));require(_0x97ed('0xc'))['register'](socket);function respondWithRpcPromise(_0x3bb541,_0x10d4dd,_0x181195){return new BPromise(function(_0x2406a0,_0x22eacd){return client[_0x97ed('0xd')](_0x3bb541,_0x181195)[_0x97ed('0xe')](function(_0x347b42){logger['info'](_0x97ed('0xf'),_0x10d4dd,_0x97ed('0x10'));logger['debug'](_0x97ed('0x11'),_0x10d4dd,_0x97ed('0x10'),JSON[_0x97ed('0x12')](_0x347b42));if(_0x347b42[_0x97ed('0x13')]){if(_0x347b42[_0x97ed('0x13')][_0x97ed('0x14')]===0x1f4){logger[_0x97ed('0x13')]('DashboardItem,\x20%s,\x20%s',_0x10d4dd,_0x347b42['error'][_0x97ed('0x15')]);return _0x22eacd(_0x347b42[_0x97ed('0x13')][_0x97ed('0x15')]);}logger['error']('DashboardItem,\x20%s,\x20%s',_0x10d4dd,_0x347b42[_0x97ed('0x13')][_0x97ed('0x15')]);return _0x2406a0(_0x347b42[_0x97ed('0x13')]['message']);}else{logger[_0x97ed('0x16')](_0x97ed('0xf'),_0x10d4dd,_0x97ed('0x10'));_0x2406a0(_0x347b42[_0x97ed('0x17')][_0x97ed('0x15')]);}})['catch'](function(_0x11649f){logger['error'](_0x97ed('0xf'),_0x10d4dd,_0x11649f);_0x22eacd(_0x11649f);});});} \ No newline at end of file +var _0x754e=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./dashboardItem.socket','request','then','info','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','code','error','DashboardItem,\x20%s,\x20%s','message'];(function(_0x425c4c,_0x29ae48){var _0x2b4c08=function(_0x1c0887){while(--_0x1c0887){_0x425c4c['push'](_0x425c4c['shift']());}};_0x2b4c08(++_0x29ae48);}(_0x754e,0x1ef));var _0xe754=function(_0x201951,_0x9e1407){_0x201951=_0x201951-0x0;var _0x5c69c1=_0x754e[_0x201951];return _0x5c69c1;};'use strict';var _=require(_0xe754('0x0'));var util=require(_0xe754('0x1'));var moment=require(_0xe754('0x2'));var BPromise=require(_0xe754('0x3'));var rs=require(_0xe754('0x4'));var fs=require('fs');var Redis=require(_0xe754('0x5'));var db=require(_0xe754('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe754('0x7'))(_0xe754('0x8'));var config=require(_0xe754('0x9'));var jayson=require(_0xe754('0xa'));var client=jayson[_0xe754('0xb')][_0xe754('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0xe754('0xd')],{'host':_0xe754('0xe'),'port':0x18eb});var socket=require(_0xe754('0xf'))(new Redis(config[_0xe754('0xd')]));require(_0xe754('0x10'))['register'](socket);function respondWithRpcPromise(_0xd8f7b9,_0xd850d,_0x42a092){return new BPromise(function(_0x199bdc,_0x268d49){return client[_0xe754('0x11')](_0xd8f7b9,_0x42a092)[_0xe754('0x12')](function(_0x4d05ea){logger[_0xe754('0x13')]('DashboardItem,\x20%s,\x20%s',_0xd850d,_0xe754('0x14'));logger['debug'](_0xe754('0x15'),_0xd850d,_0xe754('0x14'),JSON[_0xe754('0x16')](_0x4d05ea));if(_0x4d05ea['error']){if(_0x4d05ea['error'][_0xe754('0x17')]===0x1f4){logger[_0xe754('0x18')](_0xe754('0x19'),_0xd850d,_0x4d05ea[_0xe754('0x18')][_0xe754('0x1a')]);return _0x268d49(_0x4d05ea[_0xe754('0x18')]['message']);}logger['error'](_0xe754('0x19'),_0xd850d,_0x4d05ea[_0xe754('0x18')]['message']);return _0x199bdc(_0x4d05ea['error'][_0xe754('0x1a')]);}else{logger['info'](_0xe754('0x19'),_0xd850d,_0xe754('0x14'));_0x199bdc(_0x4d05ea[_0xe754('0x1b')][_0xe754('0x1a')]);}})[_0xe754('0x1c')](function(_0x5d2712){logger[_0xe754('0x18')](_0xe754('0x19'),_0xd850d,_0x5d2712);_0x268d49(_0x5d2712);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 2af80f8..22d62f3 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 _0xd203=['removeListener','length','dashboardItem:','./dashboardItem.events','save','remove','update','emit'];(function(_0x4dc069,_0x209c03){var _0x6a2f56=function(_0x3ba5a1){while(--_0x3ba5a1){_0x4dc069['push'](_0x4dc069['shift']());}};_0x6a2f56(++_0x209c03);}(_0xd203,0x16b));var _0x3d20=function(_0xc68a84,_0x2488ce){_0xc68a84=_0xc68a84-0x0;var _0x4aca47=_0xd203[_0xc68a84];return _0x4aca47;};'use strict';var DashboardItemEvents=require(_0x3d20('0x0'));var events=[_0x3d20('0x1'),_0x3d20('0x2'),_0x3d20('0x3')];function createListener(_0x4215f3,_0x80d9de){return function(_0x58360f){_0x80d9de[_0x3d20('0x4')](_0x4215f3,_0x58360f);};}function removeListener(_0x2bd5c8,_0x4dec3a){return function(){DashboardItemEvents[_0x3d20('0x5')](_0x2bd5c8,_0x4dec3a);};}exports['register']=function(_0x16d103){for(var _0x3821b1=0x0,_0x11c382=events[_0x3d20('0x6')];_0x3821b1<_0x11c382;_0x3821b1++){var _0x4bbdf2=events[_0x3821b1];var _0xb664ea=createListener(_0x3d20('0x7')+_0x4bbdf2,_0x16d103);DashboardItemEvents['on'](_0x4bbdf2,_0xb664ea);}}; \ No newline at end of file +var _0xb2af=['length','./dashboardItem.events','save','remove','update','emit','register'];(function(_0x32bfac,_0x450905){var _0x587d6a=function(_0x3a02d8){while(--_0x3a02d8){_0x32bfac['push'](_0x32bfac['shift']());}};_0x587d6a(++_0x450905);}(_0xb2af,0x1a5));var _0xfb2a=function(_0x2a8ce9,_0x1d2c89){_0x2a8ce9=_0x2a8ce9-0x0;var _0x541e4c=_0xb2af[_0x2a8ce9];return _0x541e4c;};'use strict';var DashboardItemEvents=require(_0xfb2a('0x0'));var events=[_0xfb2a('0x1'),_0xfb2a('0x2'),_0xfb2a('0x3')];function createListener(_0x5ae0b0,_0x41be41){return function(_0x29bf00){_0x41be41[_0xfb2a('0x4')](_0x5ae0b0,_0x29bf00);};}function removeListener(_0x4f4bf3,_0x686463){return function(){DashboardItemEvents['removeListener'](_0x4f4bf3,_0x686463);};}exports[_0xfb2a('0x5')]=function(_0x3b1607){for(var _0x9566a2=0x0,_0x4a635d=events[_0xfb2a('0x6')];_0x9566a2<_0x4a635d;_0x9566a2++){var _0x5b4146=events[_0x9566a2];var _0x2ad158=createListener('dashboardItem:'+_0x5b4146,_0x3b1607);DashboardItemEvents['on'](_0x5b4146,_0x2ad158);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 1052358..69bb26c 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 _0x3f0d=['path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','show','post','isAuthenticated','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0xc251d1,_0x567608){var _0x15212b=function(_0x3e3eb0){while(--_0x3e3eb0){_0xc251d1['push'](_0xc251d1['shift']());}};_0x15212b(++_0x567608);}(_0x3f0d,0x11c));var _0xd3f0=function(_0x18894f,_0x539bed){_0x18894f=_0x18894f-0x0;var _0x1dccb4=_0x3f0d[_0x18894f];return _0x1dccb4;};'use strict';var multer=require(_0xd3f0('0x0'));var util=require('util');var path=require(_0xd3f0('0x1'));var timeout=require(_0xd3f0('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd3f0('0x3'));var auth=require(_0xd3f0('0x4'));var interaction=require(_0xd3f0('0x5'));var config=require(_0xd3f0('0x6'));var controller=require(_0xd3f0('0x7'));router[_0xd3f0('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xd3f0('0x9')]);router[_0xd3f0('0xa')]('/',auth[_0xd3f0('0xb')](),controller[_0xd3f0('0xc')]);router[_0xd3f0('0xd')](_0xd3f0('0xe'),auth[_0xd3f0('0xb')](),controller[_0xd3f0('0xf')]);router[_0xd3f0('0x10')](_0xd3f0('0xe'),auth['isAuthenticated'](),controller[_0xd3f0('0x11')]);module[_0xd3f0('0x12')]=router; \ No newline at end of file +var _0x9239=['multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','show','post','isAuthenticated','create','put','update','destroy','exports'];(function(_0x2738a9,_0x101cca){var _0x43b533=function(_0x250e77){while(--_0x250e77){_0x2738a9['push'](_0x2738a9['shift']());}};_0x43b533(++_0x101cca);}(_0x9239,0x156));var _0x9923=function(_0x48e087,_0x287f83){_0x48e087=_0x48e087-0x0;var _0x23257f=_0x9239[_0x48e087];return _0x23257f;};'use strict';var multer=require(_0x9923('0x0'));var util=require(_0x9923('0x1'));var path=require('path');var timeout=require(_0x9923('0x2'));var express=require(_0x9923('0x3'));var router=express[_0x9923('0x4')]();var fs_extra=require(_0x9923('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9923('0x6'));var config=require(_0x9923('0x7'));var controller=require(_0x9923('0x8'));router[_0x9923('0x9')](_0x9923('0xa'),auth['isAuthenticated'](),controller[_0x9923('0xb')]);router[_0x9923('0xc')]('/',auth[_0x9923('0xd')](),controller[_0x9923('0xe')]);router[_0x9923('0xf')](_0x9923('0xa'),auth[_0x9923('0xd')](),controller[_0x9923('0x10')]);router['delete'](_0x9923('0xa'),auth[_0x9923('0xd')](),controller[_0x9923('0x11')]);module[_0x9923('0x12')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index ee89e07..e390c00 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 _0xb26a=['third','STRING','sequelize','exports','first','second'];(function(_0xfe1f5b,_0x1611eb){var _0x2bf96d=function(_0x38c623){while(--_0x38c623){_0xfe1f5b['push'](_0xfe1f5b['shift']());}};_0x2bf96d(++_0x1611eb);}(_0xb26a,0x188));var _0xab26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb26a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xab26('0x0'));module[_0xab26('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0xab26('0x2'),_0xab26('0x3'),_0xab26('0x4')),'allowNull':![],'defaultValue':_0xab26('0x2')},'description':{'type':Sequelize[_0xab26('0x5')]}}; \ No newline at end of file +var _0x7458=['ENUM','first','second','third','sequelize','exports','STRING'];(function(_0x2c068a,_0x300872){var _0x22e3de=function(_0x244bbc){while(--_0x244bbc){_0x2c068a['push'](_0x2c068a['shift']());}};_0x22e3de(++_0x300872);}(_0x7458,0xc8));var _0x8745=function(_0x1e3924,_0x143bc3){_0x1e3924=_0x1e3924-0x0;var _0x38e3e0=_0x7458[_0x1e3924];return _0x38e3e0;};'use strict';var Sequelize=require(_0x8745('0x0'));module[_0x8745('0x1')]={'name':{'type':Sequelize[_0x8745('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x8745('0x3')](_0x8745('0x4'),_0x8745('0x5'),_0x8745('0x6')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x8745('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 86061a2..9f1bad0 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 _0xf767=['fields','attributes','length','nolimit','offset','order','sort','pick','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','undefined','count','limit','status','set','json','apply','save','then','Dispositions','UserProfileResource','stack','name','send','index','map','Disposition','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x383158,_0x415e43){var _0x507985=function(_0x1e498e){while(--_0x1e498e){_0x383158['push'](_0x383158['shift']());}};_0x507985(++_0x415e43);}(_0xf767,0x76));var _0x7f76=function(_0x7275e9,_0x321fa5){_0x7275e9=_0x7275e9-0x0;var _0x17b99d=_0xf767[_0x7275e9];return _0x17b99d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7f76('0x0'));var zipdir=require(_0x7f76('0x1'));var jsonpatch=require(_0x7f76('0x2'));var rp=require(_0x7f76('0x3'));var moment=require(_0x7f76('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7f76('0x5'));var util=require(_0x7f76('0x6'));var path=require(_0x7f76('0x7'));var sox=require(_0x7f76('0x8'));var csv=require('to-csv');var ejs=require(_0x7f76('0x9'));var fs=require('fs');var fs_extra=require(_0x7f76('0xa'));var _=require(_0x7f76('0xb'));var squel=require(_0x7f76('0xc'));var crypto=require(_0x7f76('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7f76('0xe'));var toCsv=require(_0x7f76('0xf'));var querystring=require(_0x7f76('0x10'));var Papa=require(_0x7f76('0x11'));var Redis=require('ioredis');var authService=require(_0x7f76('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7f76('0x13'));var hardwareService=require(_0x7f76('0x14'));var logger=require(_0x7f76('0x15'))(_0x7f76('0x16'));var utils=require(_0x7f76('0x17'));var config=require(_0x7f76('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x7f76('0x19'))['db'];function respondWithStatusCode(_0x2cd1b3,_0x47403b){_0x47403b=_0x47403b||0xcc;return function(_0x32392b){if(_0x32392b){return _0x2cd1b3[_0x7f76('0x1a')](_0x47403b);}return _0x2cd1b3['status'](_0x47403b)[_0x7f76('0x1b')]();};}function respondWithResult(_0x4d8de0,_0x42a9d3){_0x42a9d3=_0x42a9d3||0xc8;return function(_0x256f79){if(_0x256f79){return _0x4d8de0['status'](_0x42a9d3)['json'](_0x256f79);}};}function respondWithFilteredResult(_0x58d2f3,_0xe81aa9){return function(_0x2df2db){if(_0x2df2db){var _0x286e96=typeof _0xe81aa9['offset']===_0x7f76('0x1c')&&typeof _0xe81aa9['limit']===_0x7f76('0x1c');var _0x3ceb6a=_0x2df2db[_0x7f76('0x1d')];var _0x4802ff=_0x286e96?0x0:_0xe81aa9['offset'];var _0x494537=_0x286e96?_0x2df2db['count']:_0xe81aa9['offset']+_0xe81aa9[_0x7f76('0x1e')];var _0xdb1407;if(_0x494537>=_0x3ceb6a){_0x494537=_0x3ceb6a;_0xdb1407=0xc8;}else{_0xdb1407=0xce;}_0x58d2f3[_0x7f76('0x1f')](_0xdb1407);return _0x58d2f3[_0x7f76('0x20')]('Content-Range',_0x4802ff+'-'+_0x494537+'/'+_0x3ceb6a)[_0x7f76('0x21')](_0x2df2db);}return null;};}function patchUpdates(_0x557c0f){return function(_0x38c4d6){try{jsonpatch[_0x7f76('0x22')](_0x38c4d6,_0x557c0f,!![]);}catch(_0x5a28b0){return BPromise['reject'](_0x5a28b0);}return _0x38c4d6[_0x7f76('0x23')]();};}function saveUpdates(_0xb647d8,_0x5efed5){return function(_0x3f2536){if(_0x3f2536){return _0x3f2536['update'](_0xb647d8)[_0x7f76('0x24')](function(_0x333056){return _0x333056;});}return null;};}function removeEntity(_0x31993d,_0x3deb00){return function(_0x3eea75){if(_0x3eea75){return _0x3eea75['destroy']()[_0x7f76('0x24')](function(){var _0x584a11=_0x3eea75['get']({'plain':!![]});var _0x197519=_0x7f76('0x25');return db[_0x7f76('0x26')]['destroy']({'where':{'type':_0x197519,'resourceId':_0x584a11['id']}})[_0x7f76('0x24')](function(){return _0x3eea75;});})[_0x7f76('0x24')](function(){_0x31993d[_0x7f76('0x1f')](0xcc)[_0x7f76('0x1b')]();});}};}function handleEntityNotFound(_0x27a030,_0x5811eb){return function(_0x13f3c9){if(!_0x13f3c9){_0x27a030[_0x7f76('0x1a')](0x194);}return _0x13f3c9;};}function handleError(_0x523d7a,_0x4ee0b0){_0x4ee0b0=_0x4ee0b0||0x1f4;return function(_0xe459de){logger['error'](_0xe459de[_0x7f76('0x27')]);if(_0xe459de[_0x7f76('0x28')]){delete _0xe459de[_0x7f76('0x28')];}_0x523d7a[_0x7f76('0x1f')](_0x4ee0b0)[_0x7f76('0x29')](_0xe459de);};}exports[_0x7f76('0x2a')]=function(_0x503223,_0x3570ec){var _0x218aee={},_0x109589={},_0x38f31e={'count':0x0,'rows':[]};var _0x5eb5cf=_[_0x7f76('0x2b')](db[_0x7f76('0x2c')][_0x7f76('0x2d')],function(_0x4d7a2f){return{'name':_0x4d7a2f[_0x7f76('0x2e')],'type':_0x4d7a2f[_0x7f76('0x2f')][_0x7f76('0x30')]};});_0x109589[_0x7f76('0x31')]=_[_0x7f76('0x2b')](_0x5eb5cf,_0x7f76('0x28'));_0x109589[_0x7f76('0x32')]=_[_0x7f76('0x33')](_0x503223[_0x7f76('0x32')]);_0x109589[_0x7f76('0x34')]=_[_0x7f76('0x35')](_0x109589[_0x7f76('0x31')],_0x109589[_0x7f76('0x32')]);_0x218aee['attributes']=_[_0x7f76('0x35')](_0x109589[_0x7f76('0x31')],qs[_0x7f76('0x36')](_0x503223[_0x7f76('0x32')][_0x7f76('0x36')]));_0x218aee[_0x7f76('0x37')]=_0x218aee[_0x7f76('0x37')][_0x7f76('0x38')]?_0x218aee['attributes']:_0x109589[_0x7f76('0x31')];if(!_0x503223['query']['hasOwnProperty'](_0x7f76('0x39'))){_0x218aee['limit']=qs[_0x7f76('0x1e')](_0x503223[_0x7f76('0x32')]['limit']);_0x218aee[_0x7f76('0x3a')]=qs['offset'](_0x503223['query'][_0x7f76('0x3a')]);}_0x218aee[_0x7f76('0x3b')]=qs[_0x7f76('0x3c')](_0x503223[_0x7f76('0x32')][_0x7f76('0x3c')]);_0x218aee['where']=qs[_0x7f76('0x34')](_[_0x7f76('0x3d')](_0x503223['query'],_0x109589['filters']),_0x5eb5cf);if(_0x503223[_0x7f76('0x32')]['filter']){_0x218aee[_0x7f76('0x3e')]=_[_0x7f76('0x3f')](_0x218aee[_0x7f76('0x3e')],{'$or':_['map'](_0x5eb5cf,function(_0x2e1b96){if(_0x2e1b96[_0x7f76('0x2f')]!==_0x7f76('0x40')){var _0x3d9bbe={};_0x3d9bbe[_0x2e1b96[_0x7f76('0x28')]]={'$like':'%'+_0x503223[_0x7f76('0x32')]['filter']+'%'};return _0x3d9bbe;}})});}_0x218aee=_['merge']({},_0x218aee,_0x503223[_0x7f76('0x41')]);var _0x669d8b={'where':_0x218aee[_0x7f76('0x3e')]};return db[_0x7f76('0x2c')][_0x7f76('0x1d')](_0x669d8b)[_0x7f76('0x24')](function(_0x401284){_0x38f31e[_0x7f76('0x1d')]=_0x401284;if(_0x503223[_0x7f76('0x32')][_0x7f76('0x42')]){_0x218aee[_0x7f76('0x43')]=[{'all':!![]}];}return db[_0x7f76('0x2c')][_0x7f76('0x44')](_0x218aee);})[_0x7f76('0x24')](function(_0x2a43f1){_0x38f31e[_0x7f76('0x45')]=_0x2a43f1;return _0x38f31e;})[_0x7f76('0x24')](respondWithFilteredResult(_0x3570ec,_0x218aee))[_0x7f76('0x46')](handleError(_0x3570ec,null));};exports['show']=function(_0x50f136,_0x278069){var _0xc1bd2={'raw':!![],'where':{'id':_0x50f136['params']['id']}},_0x4fa218={};_0x4fa218[_0x7f76('0x31')]=_['keys'](db[_0x7f76('0x2c')]['rawAttributes']);_0x4fa218['query']=_[_0x7f76('0x33')](_0x50f136[_0x7f76('0x32')]);_0x4fa218[_0x7f76('0x34')]=_[_0x7f76('0x35')](_0x4fa218[_0x7f76('0x31')],_0x4fa218[_0x7f76('0x32')]);_0xc1bd2[_0x7f76('0x37')]=_[_0x7f76('0x35')](_0x4fa218[_0x7f76('0x31')],qs[_0x7f76('0x36')](_0x50f136[_0x7f76('0x32')][_0x7f76('0x36')]));_0xc1bd2[_0x7f76('0x37')]=_0xc1bd2[_0x7f76('0x37')]['length']?_0xc1bd2[_0x7f76('0x37')]:_0x4fa218['model'];if(_0x50f136[_0x7f76('0x32')][_0x7f76('0x42')]){_0xc1bd2[_0x7f76('0x43')]=[{'all':!![]}];}_0xc1bd2=_[_0x7f76('0x3f')]({},_0xc1bd2,_0x50f136['options']);return db[_0x7f76('0x2c')][_0x7f76('0x47')](_0xc1bd2)[_0x7f76('0x24')](handleEntityNotFound(_0x278069,null))[_0x7f76('0x24')](respondWithResult(_0x278069,null))['catch'](handleError(_0x278069,null));};exports[_0x7f76('0x48')]=function(_0xd87fe7,_0x53f77a){return db[_0x7f76('0x2c')][_0x7f76('0x48')](_0xd87fe7[_0x7f76('0x49')],{})['then'](function(_0x14d76a){var _0x44c8f5=_0xd87fe7[_0x7f76('0x4a')][_0x7f76('0x4b')]({'plain':!![]});if(!_0x44c8f5)throw new Error(_0x7f76('0x4c'));if(_0x44c8f5[_0x7f76('0x4d')]===_0x7f76('0x4a')){var _0x42abd9=_0x14d76a[_0x7f76('0x4b')]({'plain':!![]});var _0xa97329=_0x7f76('0x25');return db[_0x7f76('0x4e')]['find']({'where':{'name':_0xa97329,'userProfileId':_0x44c8f5[_0x7f76('0x4f')]},'raw':!![]})['then'](function(_0x3d23b4){if(_0x3d23b4&&_0x3d23b4[_0x7f76('0x50')]===0x0){return db[_0x7f76('0x26')]['create']({'name':_0x42abd9[_0x7f76('0x28')],'resourceId':_0x42abd9['id'],'type':_0x3d23b4[_0x7f76('0x28')],'sectionId':_0x3d23b4['id']},{})['then'](function(){return _0x14d76a;});}else{return _0x14d76a;}})[_0x7f76('0x46')](function(_0x370c7b){logger[_0x7f76('0x51')](_0x7f76('0x52'),_0x370c7b);throw _0x370c7b;});}return _0x14d76a;})[_0x7f76('0x24')](respondWithResult(_0x53f77a,0xc9))[_0x7f76('0x46')](handleError(_0x53f77a,null));};exports[_0x7f76('0x53')]=function(_0x1f5a28,_0x30d331){if(_0x1f5a28['body']['id']){delete _0x1f5a28['body']['id'];}return db[_0x7f76('0x2c')][_0x7f76('0x47')]({'where':{'id':_0x1f5a28[_0x7f76('0x54')]['id']}})[_0x7f76('0x24')](handleEntityNotFound(_0x30d331,null))[_0x7f76('0x24')](saveUpdates(_0x1f5a28[_0x7f76('0x49')],null))[_0x7f76('0x24')](respondWithResult(_0x30d331,null))[_0x7f76('0x46')](handleError(_0x30d331,null));};exports[_0x7f76('0x55')]=function(_0x47c5ec,_0x2448c4){return db[_0x7f76('0x2c')][_0x7f76('0x47')]({'where':{'id':_0x47c5ec[_0x7f76('0x54')]['id']}})[_0x7f76('0x24')](handleEntityNotFound(_0x2448c4,null))[_0x7f76('0x24')](removeEntity(_0x2448c4,null))[_0x7f76('0x46')](handleError(_0x2448c4,null));}; \ No newline at end of file +var _0xe978=['keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','get','Dispositions','UserProfileResource','destroy','error','stack','name','map','Disposition','rawAttributes','type','key','model'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xe978,0x70));var _0x8e97=function(_0x32acb8,_0xc93a4){_0x32acb8=_0x32acb8-0x0;var _0x1fa292=_0xe978[_0x32acb8];return _0x1fa292;};'use strict';var emlformat=require(_0x8e97('0x0'));var rimraf=require(_0x8e97('0x1'));var zipdir=require(_0x8e97('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8e97('0x3'));var BPromise=require(_0x8e97('0x4'));var Mustache=require(_0x8e97('0x5'));var util=require(_0x8e97('0x6'));var path=require(_0x8e97('0x7'));var sox=require('sox');var csv=require(_0x8e97('0x8'));var ejs=require(_0x8e97('0x9'));var fs=require('fs');var fs_extra=require(_0x8e97('0xa'));var _=require(_0x8e97('0xb'));var squel=require(_0x8e97('0xc'));var crypto=require('crypto');var jsforce=require(_0x8e97('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8e97('0x8'));var querystring=require(_0x8e97('0xe'));var Papa=require(_0x8e97('0xf'));var Redis=require('ioredis');var authService=require(_0x8e97('0x10'));var qs=require(_0x8e97('0x11'));var as=require(_0x8e97('0x12'));var hardwareService=require(_0x8e97('0x13'));var logger=require(_0x8e97('0x14'))(_0x8e97('0x15'));var utils=require(_0x8e97('0x16'));var config=require(_0x8e97('0x17'));var licenseUtil=require(_0x8e97('0x18'));var db=require(_0x8e97('0x19'))['db'];function respondWithStatusCode(_0x23215e,_0x4f45ee){_0x4f45ee=_0x4f45ee||0xcc;return function(_0x3d2c93){if(_0x3d2c93){return _0x23215e[_0x8e97('0x1a')](_0x4f45ee);}return _0x23215e[_0x8e97('0x1b')](_0x4f45ee)[_0x8e97('0x1c')]();};}function respondWithResult(_0x4df8d3,_0x5051e8){_0x5051e8=_0x5051e8||0xc8;return function(_0x583c0a){if(_0x583c0a){return _0x4df8d3['status'](_0x5051e8)['json'](_0x583c0a);}};}function respondWithFilteredResult(_0x5e2725,_0x17bc97){return function(_0x4fc685){if(_0x4fc685){var _0x33b6b3=typeof _0x17bc97[_0x8e97('0x1d')]==='undefined'&&typeof _0x17bc97['limit']===_0x8e97('0x1e');var _0x3f3738=_0x4fc685[_0x8e97('0x1f')];var _0x2f475c=_0x33b6b3?0x0:_0x17bc97[_0x8e97('0x1d')];var _0x2b823e=_0x33b6b3?_0x4fc685[_0x8e97('0x1f')]:_0x17bc97[_0x8e97('0x1d')]+_0x17bc97[_0x8e97('0x20')];var _0x596d71;if(_0x2b823e>=_0x3f3738){_0x2b823e=_0x3f3738;_0x596d71=0xc8;}else{_0x596d71=0xce;}_0x5e2725[_0x8e97('0x1b')](_0x596d71);return _0x5e2725[_0x8e97('0x21')](_0x8e97('0x22'),_0x2f475c+'-'+_0x2b823e+'/'+_0x3f3738)[_0x8e97('0x23')](_0x4fc685);}return null;};}function patchUpdates(_0x9bb69f){return function(_0xa2968a){try{jsonpatch[_0x8e97('0x24')](_0xa2968a,_0x9bb69f,!![]);}catch(_0x5a5c99){return BPromise[_0x8e97('0x25')](_0x5a5c99);}return _0xa2968a[_0x8e97('0x26')]();};}function saveUpdates(_0x2b1b01,_0x305686){return function(_0x387748){if(_0x387748){return _0x387748[_0x8e97('0x27')](_0x2b1b01)[_0x8e97('0x28')](function(_0x18fcdb){return _0x18fcdb;});}return null;};}function removeEntity(_0x3c13de,_0x5dde33){return function(_0x517c1e){if(_0x517c1e){return _0x517c1e['destroy']()['then'](function(){var _0x3d8440=_0x517c1e[_0x8e97('0x29')]({'plain':!![]});var _0x2be986=_0x8e97('0x2a');return db[_0x8e97('0x2b')][_0x8e97('0x2c')]({'where':{'type':_0x2be986,'resourceId':_0x3d8440['id']}})[_0x8e97('0x28')](function(){return _0x517c1e;});})[_0x8e97('0x28')](function(){_0x3c13de['status'](0xcc)[_0x8e97('0x1c')]();});}};}function handleEntityNotFound(_0x2a5f18,_0x33e801){return function(_0x5bb338){if(!_0x5bb338){_0x2a5f18[_0x8e97('0x1a')](0x194);}return _0x5bb338;};}function handleError(_0x4ef232,_0x7f0baf){_0x7f0baf=_0x7f0baf||0x1f4;return function(_0x7f3ea1){logger[_0x8e97('0x2d')](_0x7f3ea1[_0x8e97('0x2e')]);if(_0x7f3ea1[_0x8e97('0x2f')]){delete _0x7f3ea1[_0x8e97('0x2f')];}_0x4ef232[_0x8e97('0x1b')](_0x7f0baf)['send'](_0x7f3ea1);};}exports['index']=function(_0x1271c1,_0x364296){var _0x19d800={},_0x3f24d0={},_0x5818b0={'count':0x0,'rows':[]};var _0x5a63ce=_[_0x8e97('0x30')](db[_0x8e97('0x31')][_0x8e97('0x32')],function(_0x46ddaa){return{'name':_0x46ddaa['fieldName'],'type':_0x46ddaa[_0x8e97('0x33')][_0x8e97('0x34')]};});_0x3f24d0[_0x8e97('0x35')]=_[_0x8e97('0x30')](_0x5a63ce,_0x8e97('0x2f'));_0x3f24d0['query']=_[_0x8e97('0x36')](_0x1271c1['query']);_0x3f24d0[_0x8e97('0x37')]=_[_0x8e97('0x38')](_0x3f24d0[_0x8e97('0x35')],_0x3f24d0[_0x8e97('0x39')]);_0x19d800[_0x8e97('0x3a')]=_['intersection'](_0x3f24d0[_0x8e97('0x35')],qs[_0x8e97('0x3b')](_0x1271c1['query']['fields']));_0x19d800[_0x8e97('0x3a')]=_0x19d800[_0x8e97('0x3a')][_0x8e97('0x3c')]?_0x19d800['attributes']:_0x3f24d0[_0x8e97('0x35')];if(!_0x1271c1[_0x8e97('0x39')][_0x8e97('0x3d')](_0x8e97('0x3e'))){_0x19d800[_0x8e97('0x20')]=qs['limit'](_0x1271c1[_0x8e97('0x39')]['limit']);_0x19d800[_0x8e97('0x1d')]=qs[_0x8e97('0x1d')](_0x1271c1[_0x8e97('0x39')]['offset']);}_0x19d800['order']=qs[_0x8e97('0x3f')](_0x1271c1[_0x8e97('0x39')][_0x8e97('0x3f')]);_0x19d800['where']=qs['filters'](_[_0x8e97('0x40')](_0x1271c1[_0x8e97('0x39')],_0x3f24d0[_0x8e97('0x37')]),_0x5a63ce);if(_0x1271c1['query']['filter']){_0x19d800[_0x8e97('0x41')]=_['merge'](_0x19d800[_0x8e97('0x41')],{'$or':_[_0x8e97('0x30')](_0x5a63ce,function(_0x6a1e57){if(_0x6a1e57[_0x8e97('0x33')]!==_0x8e97('0x42')){var _0x13d73b={};_0x13d73b[_0x6a1e57[_0x8e97('0x2f')]]={'$like':'%'+_0x1271c1['query'][_0x8e97('0x43')]+'%'};return _0x13d73b;}})});}_0x19d800=_[_0x8e97('0x44')]({},_0x19d800,_0x1271c1[_0x8e97('0x45')]);var _0x27185b={'where':_0x19d800[_0x8e97('0x41')]};return db[_0x8e97('0x31')][_0x8e97('0x1f')](_0x27185b)[_0x8e97('0x28')](function(_0x4c1180){_0x5818b0[_0x8e97('0x1f')]=_0x4c1180;if(_0x1271c1[_0x8e97('0x39')][_0x8e97('0x46')]){_0x19d800['include']=[{'all':!![]}];}return db[_0x8e97('0x31')]['findAll'](_0x19d800);})[_0x8e97('0x28')](function(_0x60a881){_0x5818b0['rows']=_0x60a881;return _0x5818b0;})['then'](respondWithFilteredResult(_0x364296,_0x19d800))[_0x8e97('0x47')](handleError(_0x364296,null));};exports[_0x8e97('0x48')]=function(_0xfe53be,_0x3ce21d){var _0x183f92={'raw':!![],'where':{'id':_0xfe53be[_0x8e97('0x49')]['id']}},_0x1568ef={};_0x1568ef['model']=_[_0x8e97('0x36')](db[_0x8e97('0x31')][_0x8e97('0x32')]);_0x1568ef[_0x8e97('0x39')]=_[_0x8e97('0x36')](_0xfe53be[_0x8e97('0x39')]);_0x1568ef['filters']=_[_0x8e97('0x38')](_0x1568ef[_0x8e97('0x35')],_0x1568ef[_0x8e97('0x39')]);_0x183f92['attributes']=_['intersection'](_0x1568ef[_0x8e97('0x35')],qs[_0x8e97('0x3b')](_0xfe53be[_0x8e97('0x39')][_0x8e97('0x3b')]));_0x183f92[_0x8e97('0x3a')]=_0x183f92[_0x8e97('0x3a')]['length']?_0x183f92[_0x8e97('0x3a')]:_0x1568ef[_0x8e97('0x35')];if(_0xfe53be[_0x8e97('0x39')][_0x8e97('0x46')]){_0x183f92['include']=[{'all':!![]}];}_0x183f92=_[_0x8e97('0x44')]({},_0x183f92,_0xfe53be['options']);return db['Disposition'][_0x8e97('0x4a')](_0x183f92)[_0x8e97('0x28')](handleEntityNotFound(_0x3ce21d,null))[_0x8e97('0x28')](respondWithResult(_0x3ce21d,null))[_0x8e97('0x47')](handleError(_0x3ce21d,null));};exports[_0x8e97('0x4b')]=function(_0x48cc94,_0x2d4243){return db[_0x8e97('0x31')][_0x8e97('0x4b')](_0x48cc94[_0x8e97('0x4c')],{})[_0x8e97('0x28')](function(_0x630cca){var _0x541d8e=_0x48cc94['user'][_0x8e97('0x29')]({'plain':!![]});if(!_0x541d8e)throw new Error(_0x8e97('0x4d'));if(_0x541d8e['role']===_0x8e97('0x4e')){var _0x48752d=_0x630cca[_0x8e97('0x29')]({'plain':!![]});var _0x519760='Dispositions';return db[_0x8e97('0x4f')][_0x8e97('0x4a')]({'where':{'name':_0x519760,'userProfileId':_0x541d8e[_0x8e97('0x50')]},'raw':!![]})[_0x8e97('0x28')](function(_0x1570cd){if(_0x1570cd&&_0x1570cd[_0x8e97('0x51')]===0x0){return db[_0x8e97('0x2b')][_0x8e97('0x4b')]({'name':_0x48752d[_0x8e97('0x2f')],'resourceId':_0x48752d['id'],'type':_0x1570cd['name'],'sectionId':_0x1570cd['id']},{})['then'](function(){return _0x630cca;});}else{return _0x630cca;}})[_0x8e97('0x47')](function(_0x38fbf3){logger[_0x8e97('0x2d')](_0x8e97('0x52'),_0x38fbf3);throw _0x38fbf3;});}return _0x630cca;})['then'](respondWithResult(_0x2d4243,0xc9))[_0x8e97('0x47')](handleError(_0x2d4243,null));};exports['update']=function(_0x4e9aba,_0x7bc01d){if(_0x4e9aba[_0x8e97('0x4c')]['id']){delete _0x4e9aba[_0x8e97('0x4c')]['id'];}return db[_0x8e97('0x31')]['find']({'where':{'id':_0x4e9aba[_0x8e97('0x49')]['id']}})['then'](handleEntityNotFound(_0x7bc01d,null))[_0x8e97('0x28')](saveUpdates(_0x4e9aba[_0x8e97('0x4c')],null))[_0x8e97('0x28')](respondWithResult(_0x7bc01d,null))[_0x8e97('0x47')](handleError(_0x7bc01d,null));};exports[_0x8e97('0x2c')]=function(_0x4b82dd,_0x21c076){return db['Disposition'][_0x8e97('0x4a')]({'where':{'id':_0x4b82dd[_0x8e97('0x49')]['id']}})['then'](handleEntityNotFound(_0x21c076,null))[_0x8e97('0x28')](removeEntity(_0x21c076,null))[_0x8e97('0x47')](handleError(_0x21c076,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index b098875..99f6154 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 _0xcb37=['exports','Disposition','tools_dispositions','name_voice','ListId','name_chat','name','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes'];(function(_0x3b58c3,_0x3c2858){var _0x16d90f=function(_0x4ed4b3){while(--_0x4ed4b3){_0x3b58c3['push'](_0x3b58c3['shift']());}};_0x16d90f(++_0x3c2858);}(_0xcb37,0xa8));var _0x7cb3=function(_0x57e3df,_0x5028e5){_0x57e3df=_0x57e3df-0x0;var _0xcd5998=_0xcb37[_0x57e3df];return _0xcd5998;};'use strict';var _=require(_0x7cb3('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x7cb3('0x1'));var rp=require(_0x7cb3('0x2'));var fs=require('fs');var path=require(_0x7cb3('0x3'));var rimraf=require(_0x7cb3('0x4'));var config=require(_0x7cb3('0x5'));var attributes=require(_0x7cb3('0x6'));module[_0x7cb3('0x7')]=function(_0x823004,_0x3e8ca3){return _0x823004['define'](_0x7cb3('0x8'),attributes,{'tableName':_0x7cb3('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x7cb3('0xa'),'fields':['name',_0x7cb3('0xb')]},{'unique':!![],'name':_0x7cb3('0xc'),'fields':[_0x7cb3('0xd'),_0x7cb3('0xe')]},{'unique':!![],'name':_0x7cb3('0xf'),'fields':[_0x7cb3('0xd'),_0x7cb3('0x10')]},{'unique':!![],'name':_0x7cb3('0x11'),'fields':['name',_0x7cb3('0x12')]},{'unique':!![],'name':_0x7cb3('0x13'),'fields':[_0x7cb3('0xd'),_0x7cb3('0x14')]},{'unique':!![],'name':_0x7cb3('0x15'),'fields':[_0x7cb3('0xd'),_0x7cb3('0x16')]},{'unique':!![],'name':_0x7cb3('0x17'),'fields':[_0x7cb3('0xd'),_0x7cb3('0x18')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x00cc=['ListId','name_chat','ChatWebsiteId','MailAccountId','name_sms','SmsAccountId','name_openchannel','WhatsappAccountId','lodash','api','moment','bluebird','path','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name'];(function(_0xc5ad2b,_0x5d7243){var _0x3587f4=function(_0x1293c4){while(--_0x1293c4){_0xc5ad2b['push'](_0xc5ad2b['shift']());}};_0x3587f4(++_0x5d7243);}(_0x00cc,0xa2));var _0xc00c=function(_0x448810,_0x258677){_0x448810=_0x448810-0x0;var _0x39a55c=_0x00cc[_0x448810];return _0x39a55c;};'use strict';var _=require(_0xc00c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc00c('0x1'));var moment=require(_0xc00c('0x2'));var BPromise=require(_0xc00c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc00c('0x4'));var rimraf=require(_0xc00c('0x5'));var config=require(_0xc00c('0x6'));var attributes=require(_0xc00c('0x7'));module[_0xc00c('0x8')]=function(_0x967ab2,_0xc2c2eb){return _0x967ab2[_0xc00c('0x9')](_0xc00c('0xa'),attributes,{'tableName':_0xc00c('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xc00c('0xc'),'fields':[_0xc00c('0xd'),_0xc00c('0xe')]},{'unique':!![],'name':_0xc00c('0xf'),'fields':['name',_0xc00c('0x10')]},{'unique':!![],'name':'name_mail','fields':[_0xc00c('0xd'),_0xc00c('0x11')]},{'unique':!![],'name':_0xc00c('0x12'),'fields':['name',_0xc00c('0x13')]},{'unique':!![],'name':'name_fax','fields':[_0xc00c('0xd'),'FaxAccountId']},{'unique':!![],'name':_0xc00c('0x14'),'fields':[_0xc00c('0xd'),'OpenchannelAccountId']},{'unique':!![],'name':'name_whatsapp','fields':[_0xc00c('0xd'),_0xc00c('0x15')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 29dec3c..21284bc 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(_0x31fa94,_0x5a4927){var _0x14f6e5=function(_0x5cf835){while(--_0x5cf835){_0x31fa94['push'](_0x31fa94['shift']());}};_0x14f6e5(++_0x5a4927);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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(_0x3469b5,_0x292f51){var _0x1ee7c1=function(_0x2c3327){while(--_0x2c3327){_0x3469b5['push'](_0x3469b5['shift']());}};_0x1ee7c1(++_0x292f51);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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 67607d9..e7bc1cb 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 _0x9e3d=['delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./disposition.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9e3d,0x1de));var _0xd9e3=function(_0xe27d4a,_0x1c537d){_0xe27d4a=_0xe27d4a-0x0;var _0x4d541b=_0x9e3d[_0xe27d4a];return _0x4d541b;};'use strict';var multer=require(_0xd9e3('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd9e3('0x1'));var express=require(_0xd9e3('0x2'));var router=express[_0xd9e3('0x3')]();var fs_extra=require(_0xd9e3('0x4'));var auth=require(_0xd9e3('0x5'));var interaction=require(_0xd9e3('0x6'));var config=require('../../config/environment');var controller=require(_0xd9e3('0x7'));router[_0xd9e3('0x8')]('/',auth[_0xd9e3('0x9')](),controller[_0xd9e3('0xa')]);router[_0xd9e3('0x8')](_0xd9e3('0xb'),auth['isAuthenticated'](),controller[_0xd9e3('0xc')]);router[_0xd9e3('0xd')]('/',auth['isAuthenticated'](),controller[_0xd9e3('0xe')]);router[_0xd9e3('0xf')](_0xd9e3('0xb'),auth[_0xd9e3('0x9')](),controller['update']);router[_0xd9e3('0x10')](_0xd9e3('0xb'),auth[_0xd9e3('0x9')](),controller[_0xd9e3('0x11')]);module[_0xd9e3('0x12')]=router; \ No newline at end of file +var _0xbcec=['isAuthenticated','index','/:id','show','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x305c31,_0x466b17){var _0x17f39f=function(_0x53ae03){while(--_0x53ae03){_0x305c31['push'](_0x305c31['shift']());}};_0x17f39f(++_0x466b17);}(_0xbcec,0xe6));var _0xcbce=function(_0x5db570,_0x4116d3){_0x5db570=_0x5db570-0x0;var _0x4ee280=_0xbcec[_0x5db570];return _0x4ee280;};'use strict';var multer=require(_0xcbce('0x0'));var util=require(_0xcbce('0x1'));var path=require(_0xcbce('0x2'));var timeout=require(_0xcbce('0x3'));var express=require(_0xcbce('0x4'));var router=express['Router']();var fs_extra=require(_0xcbce('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xcbce('0x6'));var config=require(_0xcbce('0x7'));var controller=require('./disposition.controller');router['get']('/',auth[_0xcbce('0x8')](),controller[_0xcbce('0x9')]);router['get'](_0xcbce('0xa'),auth[_0xcbce('0x8')](),controller[_0xcbce('0xb')]);router[_0xcbce('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xcbce('0xa'),auth[_0xcbce('0x8')](),controller[_0xcbce('0xd')]);router[_0xcbce('0xe')](_0xcbce('0xa'),auth[_0xcbce('0x8')](),controller[_0xcbce('0xf')]);module[_0xcbce('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 57c561c..5cba472 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 _0x398f=['mandatoryDisposition','sequelize','STRING','ENUM','yes','2400','7200','12000','14400','4800','9600','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','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'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x398f,0xfe));var _0xf398=function(_0x5abf9d,_0x5d7c93){_0x5abf9d=_0x5abf9d-0x0;var _0x19a40c=_0x398f[_0x5abf9d];return _0x19a40c;};'use strict';var Sequelize=require(_0xf398('0x0'));module['exports']={'name':{'type':Sequelize[_0xf398('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf398('0x1')]},'ecm':{'type':Sequelize[_0xf398('0x2')](_0xf398('0x3'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0xf398('0x1')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0xf398('0x1')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0xf398('0x2')](_0xf398('0x4'),'4800',_0xf398('0x5'),'9600',_0xf398('0x6'),_0xf398('0x7')),'defaultValue':_0xf398('0x8')},'maxrate':{'type':Sequelize[_0xf398('0x2')](_0xf398('0x4'),_0xf398('0x8'),_0xf398('0x5'),_0xf398('0x9'),_0xf398('0x6'),'14400'),'defaultValue':_0xf398('0x7')},'modem':{'type':Sequelize[_0xf398('0x1')],'defaultValue':_0xf398('0xa')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xf398('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xf398('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xf398('0x2')](_0xf398('0xc'),_0xf398('0xd'),_0xf398('0xe'),_0xf398('0xf')),'defaultValue':_0xf398('0xc')},'key':{'type':Sequelize[_0xf398('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xf398('0x10')],'defaultValue':function(){return _0xf398('0x11');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf398('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf398('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf398('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf398('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf398('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xf398('0x13')},'mandatoryDisposition':{'type':Sequelize[_0xf398('0x12')],'defaultValue':![],'comment':_0xf398('0x14'),'set':function(_0x30f0c1){if(!_0x30f0c1)this[_0xf398('0x15')]('mandatoryDispositionPauseId',null);this[_0xf398('0x15')](_0xf398('0x16'),_0x30f0c1);}}}; \ No newline at end of file +var _0x7b6f=['7200','12000','9600','INTEGER','SIP','DADHI','KHOMP','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','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800'];(function(_0xb6dab,_0x5bff55){var _0x1ec72d=function(_0x208140){while(--_0x208140){_0xb6dab['push'](_0xb6dab['shift']());}};_0x1ec72d(++_0x5bff55);}(_0x7b6f,0x1c3));var _0xf7b6=function(_0x2cfb2b,_0x30c0f1){_0x2cfb2b=_0x2cfb2b-0x0;var _0x403a5c=_0x7b6f[_0x2cfb2b];return _0x403a5c;};'use strict';var Sequelize=require(_0xf7b6('0x0'));module[_0xf7b6('0x1')]={'name':{'type':Sequelize[_0xf7b6('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0xf7b6('0x3')](_0xf7b6('0x4'),'no'),'defaultValue':_0xf7b6('0x4')},'headerinfo':{'type':Sequelize[_0xf7b6('0x2')],'defaultValue':_0xf7b6('0x5')},'localstationid':{'type':Sequelize['STRING'],'unique':_0xf7b6('0x6')},'minrate':{'type':Sequelize[_0xf7b6('0x3')](_0xf7b6('0x7'),_0xf7b6('0x8'),_0xf7b6('0x9'),'9600',_0xf7b6('0xa'),'14400'),'defaultValue':_0xf7b6('0x8')},'maxrate':{'type':Sequelize[_0xf7b6('0x3')](_0xf7b6('0x7'),_0xf7b6('0x8'),_0xf7b6('0x9'),_0xf7b6('0xb'),'12000','14400'),'defaultValue':'14400'},'modem':{'type':Sequelize[_0xf7b6('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0xf7b6('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xf7b6('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xf7b6('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xf7b6('0x3')](_0xf7b6('0xd'),'IAX',_0xf7b6('0xe'),_0xf7b6('0xf')),'defaultValue':_0xf7b6('0xd')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xf7b6('0x10')],'defaultValue':function(){return _0xf7b6('0x11');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf7b6('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf7b6('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf7b6('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf7b6('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf7b6('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf7b6('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0xf7b6('0x13')},'mandatoryDisposition':{'type':Sequelize[_0xf7b6('0x12')],'defaultValue':![],'comment':_0xf7b6('0x14'),'set':function(_0x3be316){if(!_0x3be316)this[_0xf7b6('0x15')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0xf7b6('0x16'),_0x3be316);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 77a3a18..deb6203 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 _0x0ed0=['options','FaxAccount','includeAll','include','findAll','rows','catch','show','params','intersection','create','body','user','role','get','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','hasOwnProperty','removeAnswers','addInteraction','getInteractions','FaxInteraction','CmContact','Contact','Owner','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','FaxApplication','bulkCreate','findAndCountAll','finally','getApplications','context','from-voip-provider','exten','localstationid','app','system','Fax\x20Extension','priority','appdata','push','Answer','Set','ecm','gateway','faxdetect','maxrate','minrate','modem','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','omit','tech','key','createdAt','TrunkId','ListId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','updatedAt','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','Contacts','List\x20not\x20found','Send\x20Fax\x20failed','filename','Contact\x20not\x20found','spread','out','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','isArray','emit','getAgents','User','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxAccount.socket','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','destroy','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','map','rawAttributes','type','model','query','keys','attributes','fields','length','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL'];(function(_0x1eefab,_0x28991b){var _0xbb5253=function(_0x39a0d1){while(--_0x39a0d1){_0x1eefab['push'](_0x1eefab['shift']());}};_0xbb5253(++_0x28991b);}(_0x0ed0,0x144));var _0x00ed=function(_0x5ec55d,_0x380177){_0x5ec55d=_0x5ec55d-0x0;var _0x248ca5=_0x0ed0[_0x5ec55d];return _0x248ca5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x00ed('0x0'));var zipdir=require(_0x00ed('0x1'));var jsonpatch=require(_0x00ed('0x2'));var rp=require(_0x00ed('0x3'));var moment=require(_0x00ed('0x4'));var BPromise=require(_0x00ed('0x5'));var Mustache=require(_0x00ed('0x6'));var util=require('util');var path=require('path');var sox=require(_0x00ed('0x7'));var csv=require(_0x00ed('0x8'));var ejs=require(_0x00ed('0x9'));var fs=require('fs');var fs_extra=require(_0x00ed('0xa'));var _=require(_0x00ed('0xb'));var squel=require(_0x00ed('0xc'));var crypto=require(_0x00ed('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x00ed('0xe'));var toCsv=require(_0x00ed('0x8'));var querystring=require(_0x00ed('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x00ed('0x10'));var as=require(_0x00ed('0x11'));var hardwareService=require(_0x00ed('0x12'));var logger=require(_0x00ed('0x13'))(_0x00ed('0x14'));var utils=require(_0x00ed('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x00ed('0x16'));var db=require(_0x00ed('0x17'))['db'];config[_0x00ed('0x18')]=_[_0x00ed('0x19')](config[_0x00ed('0x18')],{'host':_0x00ed('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x00ed('0x18')]));require(_0x00ed('0x1b'))[_0x00ed('0x1c')](socket);var jayson=require(_0x00ed('0x1d'));var client=jayson[_0x00ed('0x1e')][_0x00ed('0x1f')]({'port':0x232c});var client9002=jayson[_0x00ed('0x1e')][_0x00ed('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0xc2340,_0x40634f,_0x3a121f,_0x540ce0){return new BPromise(function(_0x49589c,_0x3d2eef){var _0x457604=_0x540ce0||client;return _0x457604[_0x00ed('0x20')](_0xc2340,_0x3a121f)[_0x00ed('0x21')](function(_0x18bb29){logger[_0x00ed('0x22')](_0x00ed('0x23'),_0x40634f,_0x00ed('0x24'));logger['debug'](_0x00ed('0x25'),_0x40634f,_0x00ed('0x24'),JSON['stringify'](_0x18bb29));if(_0x18bb29['error']){if(_0x18bb29[_0x00ed('0x26')][_0x00ed('0x27')]===0x1f4){logger['error'](_0x00ed('0x23'),_0x40634f,_0x18bb29[_0x00ed('0x26')][_0x00ed('0x28')]);return _0x3d2eef(_0x18bb29[_0x00ed('0x26')][_0x00ed('0x28')]);}logger[_0x00ed('0x26')]('FaxAccount,\x20%s,\x20%s',_0x40634f,_0x18bb29['error']['message']);return _0x49589c(_0x18bb29[_0x00ed('0x26')]['message']);}else{logger[_0x00ed('0x22')](_0x00ed('0x23'),_0x40634f,'request\x20sent');_0x49589c(_0x18bb29[_0x00ed('0x29')][_0x00ed('0x28')]);}})['catch'](function(_0x304bd1){logger[_0x00ed('0x26')](_0x00ed('0x23'),_0x40634f,_0x304bd1);_0x3d2eef(_0x304bd1);});});}function respondWithStatusCode(_0x4f9385,_0x4cef46){_0x4cef46=_0x4cef46||0xcc;return function(_0x320124){if(_0x320124){return _0x4f9385[_0x00ed('0x2a')](_0x4cef46);}return _0x4f9385[_0x00ed('0x2b')](_0x4cef46)[_0x00ed('0x2c')]();};}function respondWithResult(_0x2e76a4,_0x3b1037){_0x3b1037=_0x3b1037||0xc8;return function(_0x57d8f7){if(_0x57d8f7){return _0x2e76a4[_0x00ed('0x2b')](_0x3b1037)[_0x00ed('0x2d')](_0x57d8f7);}};}function respondWithFilteredResult(_0x16fd83,_0xa67300){return function(_0x3eabf2){if(_0x3eabf2){var _0x32642f=typeof _0xa67300[_0x00ed('0x2e')]===_0x00ed('0x2f')&&typeof _0xa67300['limit']===_0x00ed('0x2f');var _0x5447c2=_0x3eabf2[_0x00ed('0x30')];var _0x2dad4f=_0x32642f?0x0:_0xa67300[_0x00ed('0x2e')];var _0x323af2=_0x32642f?_0x3eabf2[_0x00ed('0x30')]:_0xa67300[_0x00ed('0x2e')]+_0xa67300['limit'];var _0x450d7f;if(_0x323af2>=_0x5447c2){_0x323af2=_0x5447c2;_0x450d7f=0xc8;}else{_0x450d7f=0xce;}_0x16fd83['status'](_0x450d7f);return _0x16fd83[_0x00ed('0x31')](_0x00ed('0x32'),_0x2dad4f+'-'+_0x323af2+'/'+_0x5447c2)[_0x00ed('0x2d')](_0x3eabf2);}return null;};}function patchUpdates(_0x4e81df){return function(_0x1aaff4){try{jsonpatch[_0x00ed('0x33')](_0x1aaff4,_0x4e81df,!![]);}catch(_0x5cff61){return BPromise[_0x00ed('0x34')](_0x5cff61);}return _0x1aaff4['save']();};}function saveUpdates(_0x5c7a81,_0xedec0){return function(_0x56df84){if(_0x56df84){return _0x56df84[_0x00ed('0x35')](_0x5c7a81)[_0x00ed('0x21')](function(_0x294263){return _0x294263;});}return null;};}function removeEntity(_0xdce89b,_0x4fe378){return function(_0x2e7ec1){if(_0x2e7ec1){return _0x2e7ec1[_0x00ed('0x36')]()[_0x00ed('0x21')](function(){var _0x4a8a96=_0x2e7ec1['get']({'plain':!![]});var _0x419db5='FaxAccounts';return db[_0x00ed('0x37')][_0x00ed('0x36')]({'where':{'type':_0x419db5,'resourceId':_0x4a8a96['id']}})[_0x00ed('0x21')](function(){return _0x2e7ec1;});})[_0x00ed('0x21')](function(){_0xdce89b['status'](0xcc)[_0x00ed('0x2c')]();});}};}function handleEntityNotFound(_0x411467,_0x25a5a2){return function(_0x96ccca){if(!_0x96ccca){_0x411467[_0x00ed('0x2a')](0x194);}return _0x96ccca;};}function handleError(_0x111f39,_0x16418b){_0x16418b=_0x16418b||0x1f4;return function(_0x375687){logger[_0x00ed('0x26')](_0x375687[_0x00ed('0x38')]);if(_0x375687[_0x00ed('0x39')]){delete _0x375687[_0x00ed('0x39')];}_0x111f39[_0x00ed('0x2b')](_0x16418b)[_0x00ed('0x3a')](_0x375687);};}exports['index']=function(_0x17210f,_0x1600c4){var _0x232655={'include':[{'model':db[_0x00ed('0x3b')],'as':_0x00ed('0x3c')}]},_0x4b4d70={},_0x1f6834={'count':0x0,'rows':[]};var _0x4bdfe1=_[_0x00ed('0x3d')](db['FaxAccount'][_0x00ed('0x3e')],function(_0x3d399b){return{'name':_0x3d399b['fieldName'],'type':_0x3d399b[_0x00ed('0x3f')]['key']};});_0x4b4d70[_0x00ed('0x40')]=_[_0x00ed('0x3d')](_0x4bdfe1,'name');_0x4b4d70[_0x00ed('0x41')]=_[_0x00ed('0x42')](_0x17210f['query']);_0x4b4d70['filters']=_['intersection'](_0x4b4d70[_0x00ed('0x40')],_0x4b4d70[_0x00ed('0x41')]);_0x232655[_0x00ed('0x43')]=_['intersection'](_0x4b4d70['model'],qs[_0x00ed('0x44')](_0x17210f[_0x00ed('0x41')][_0x00ed('0x44')]));_0x232655[_0x00ed('0x43')]=_0x232655[_0x00ed('0x43')][_0x00ed('0x45')]?_0x232655[_0x00ed('0x43')]:_0x4b4d70[_0x00ed('0x40')];if(!_0x17210f[_0x00ed('0x41')]['hasOwnProperty'](_0x00ed('0x46'))){_0x232655[_0x00ed('0x47')]=qs[_0x00ed('0x47')](_0x17210f[_0x00ed('0x41')][_0x00ed('0x47')]);_0x232655['offset']=qs[_0x00ed('0x2e')](_0x17210f[_0x00ed('0x41')][_0x00ed('0x2e')]);}_0x232655[_0x00ed('0x48')]=qs['sort'](_0x17210f[_0x00ed('0x41')][_0x00ed('0x49')]);_0x232655[_0x00ed('0x4a')]=qs[_0x00ed('0x4b')](_[_0x00ed('0x4c')](_0x17210f[_0x00ed('0x41')],_0x4b4d70[_0x00ed('0x4b')]),_0x4bdfe1);if(_0x17210f[_0x00ed('0x41')][_0x00ed('0x4d')]){_0x232655[_0x00ed('0x4a')]=_[_0x00ed('0x4e')](_0x232655[_0x00ed('0x4a')],{'$or':_[_0x00ed('0x3d')](_0x4bdfe1,function(_0x4c02e2){if(_0x4c02e2[_0x00ed('0x3f')]!==_0x00ed('0x4f')){var _0x31ef5a={};_0x31ef5a[_0x4c02e2['name']]={'$like':'%'+_0x17210f[_0x00ed('0x41')][_0x00ed('0x4d')]+'%'};return _0x31ef5a;}})});}_0x232655=_[_0x00ed('0x4e')]({},_0x232655,_0x17210f[_0x00ed('0x50')]);var _0x58f99e={'where':_0x232655[_0x00ed('0x4a')]};return db[_0x00ed('0x51')][_0x00ed('0x30')](_0x58f99e)[_0x00ed('0x21')](function(_0x1c9c14){_0x1f6834[_0x00ed('0x30')]=_0x1c9c14;if(_0x17210f[_0x00ed('0x41')][_0x00ed('0x52')]){_0x232655[_0x00ed('0x53')]=[{'all':!![]}];}return db[_0x00ed('0x51')][_0x00ed('0x54')](_0x232655);})[_0x00ed('0x21')](function(_0x5ffcb5){_0x1f6834[_0x00ed('0x55')]=_0x5ffcb5;return _0x1f6834;})[_0x00ed('0x21')](respondWithFilteredResult(_0x1600c4,_0x232655))[_0x00ed('0x56')](handleError(_0x1600c4,null));};exports[_0x00ed('0x57')]=function(_0x1612a1,_0x172d35){var _0x3325a4={'raw':![],'where':{'id':_0x1612a1[_0x00ed('0x58')]['id']},'include':[{'model':db[_0x00ed('0x3b')],'as':'mandatoryDispositionPause'}]},_0x26592e={};_0x26592e[_0x00ed('0x40')]=_[_0x00ed('0x42')](db[_0x00ed('0x51')][_0x00ed('0x3e')]);_0x26592e['query']=_[_0x00ed('0x42')](_0x1612a1[_0x00ed('0x41')]);_0x26592e['filters']=_[_0x00ed('0x59')](_0x26592e['model'],_0x26592e[_0x00ed('0x41')]);_0x3325a4['attributes']=_[_0x00ed('0x59')](_0x26592e[_0x00ed('0x40')],qs[_0x00ed('0x44')](_0x1612a1[_0x00ed('0x41')][_0x00ed('0x44')]));_0x3325a4['attributes']=_0x3325a4['attributes'][_0x00ed('0x45')]?_0x3325a4[_0x00ed('0x43')]:_0x26592e[_0x00ed('0x40')];if(_0x1612a1[_0x00ed('0x41')][_0x00ed('0x52')]){_0x3325a4[_0x00ed('0x53')]=[{'all':!![]}];}_0x3325a4=_[_0x00ed('0x4e')]({},_0x3325a4,_0x1612a1[_0x00ed('0x50')]);return db[_0x00ed('0x51')]['find'](_0x3325a4)[_0x00ed('0x21')](handleEntityNotFound(_0x172d35,null))[_0x00ed('0x21')](respondWithResult(_0x172d35,null))['catch'](handleError(_0x172d35,null));};exports[_0x00ed('0x5a')]=function(_0x2ccea1,_0x263b54){return db[_0x00ed('0x51')][_0x00ed('0x5a')](_0x2ccea1[_0x00ed('0x5b')],{})[_0x00ed('0x21')](function(_0x2e94d9){var _0x2914c6=_0x2ccea1[_0x00ed('0x5c')]['get']({'plain':!![]});if(!_0x2914c6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2914c6[_0x00ed('0x5d')]===_0x00ed('0x5c')){var _0x25d27d=_0x2e94d9[_0x00ed('0x5e')]({'plain':!![]});var _0x102a20='FaxAccounts';return db[_0x00ed('0x5f')][_0x00ed('0x60')]({'where':{'name':_0x102a20,'userProfileId':_0x2914c6[_0x00ed('0x61')]},'raw':!![]})[_0x00ed('0x21')](function(_0x541dcb){if(_0x541dcb&&_0x541dcb[_0x00ed('0x62')]===0x0){return db['UserProfileResource']['create']({'name':_0x25d27d[_0x00ed('0x39')],'resourceId':_0x25d27d['id'],'type':_0x541dcb['name'],'sectionId':_0x541dcb['id']},{})[_0x00ed('0x21')](function(){return _0x2e94d9;});}else{return _0x2e94d9;}})[_0x00ed('0x56')](function(_0x56bb7c){logger[_0x00ed('0x26')](_0x00ed('0x63'),_0x56bb7c);throw _0x56bb7c;});}return _0x2e94d9;})[_0x00ed('0x21')](respondWithResult(_0x263b54,0xc9))[_0x00ed('0x56')](handleError(_0x263b54,null));};exports[_0x00ed('0x35')]=function(_0x39c53c,_0x214afc){if(_0x39c53c[_0x00ed('0x5b')]['id']){delete _0x39c53c[_0x00ed('0x5b')]['id'];}return db[_0x00ed('0x51')]['find']({'where':{'id':_0x39c53c[_0x00ed('0x58')]['id']},'include':[{'model':db[_0x00ed('0x3b')],'as':_0x00ed('0x3c')}]})['then'](handleEntityNotFound(_0x214afc,null))[_0x00ed('0x21')](saveUpdates(_0x39c53c[_0x00ed('0x5b')],null))[_0x00ed('0x21')](respondWithResult(_0x214afc,null))[_0x00ed('0x56')](handleError(_0x214afc,null));};exports[_0x00ed('0x36')]=function(_0x1d6d2b,_0x48e19c){return db['FaxAccount'][_0x00ed('0x60')]({'where':{'id':_0x1d6d2b[_0x00ed('0x58')]['id']}})[_0x00ed('0x21')](handleEntityNotFound(_0x48e19c,null))[_0x00ed('0x21')](removeEntity(_0x48e19c,null))[_0x00ed('0x56')](handleError(_0x48e19c,null));};exports[_0x00ed('0x64')]=function(_0x102f29,_0x3bb385){return db[_0x00ed('0x51')]['describe']()[_0x00ed('0x21')](respondWithResult(_0x3bb385,null))[_0x00ed('0x56')](handleError(_0x3bb385,null));};exports[_0x00ed('0x65')]=function(_0x256825,_0xe79358,_0x34f393){if(_0x256825['body']['id']){delete _0x256825[_0x00ed('0x5b')]['id'];}return db['FaxAccount'][_0x00ed('0x60')]({'where':{'id':_0x256825[_0x00ed('0x58')]['id']}})[_0x00ed('0x21')](handleEntityNotFound(_0xe79358,null))['then'](function(_0x10d9eb){if(_0x10d9eb){_0x256825[_0x00ed('0x5b')][_0x00ed('0x66')]=_0x10d9eb['id'];return db[_0x00ed('0x67')][_0x00ed('0x5a')](_0x256825[_0x00ed('0x5b')]);}})['then'](respondWithResult(_0xe79358,null))[_0x00ed('0x56')](handleError(_0xe79358,null));};exports[_0x00ed('0x68')]=function(_0x63f754,_0x2af79c,_0x433047){var _0x59bc74={'raw':![],'where':{}};var _0x4d1a08={};var _0x120dd6={'count':0x0,'rows':[]};return db[_0x00ed('0x51')][_0x00ed('0x69')]({'where':{'id':_0x63f754[_0x00ed('0x58')]['id']}})[_0x00ed('0x21')](handleEntityNotFound(_0x2af79c,null))[_0x00ed('0x21')](function(_0x4af202){if(_0x4af202){_0x4d1a08[_0x00ed('0x40')]=_[_0x00ed('0x42')](db[_0x00ed('0x67')][_0x00ed('0x3e')]);_0x4d1a08['query']=_['keys'](_0x63f754[_0x00ed('0x41')]);_0x4d1a08[_0x00ed('0x4b')]=_['intersection'](_0x4d1a08[_0x00ed('0x40')],_0x4d1a08[_0x00ed('0x41')]);_0x59bc74[_0x00ed('0x43')]=_['intersection'](_0x4d1a08['model'],qs['fields'](_0x63f754[_0x00ed('0x41')][_0x00ed('0x44')]));_0x59bc74['attributes']=_0x59bc74['attributes'][_0x00ed('0x45')]?_0x59bc74['attributes']:_0x4d1a08['model'];if(!_0x63f754[_0x00ed('0x41')]['hasOwnProperty'](_0x00ed('0x46'))){_0x59bc74[_0x00ed('0x47')]=qs['limit'](_0x63f754[_0x00ed('0x41')][_0x00ed('0x47')]);_0x59bc74[_0x00ed('0x2e')]=qs['offset'](_0x63f754['query'][_0x00ed('0x2e')]);}_0x59bc74['order']=qs[_0x00ed('0x49')](_0x63f754[_0x00ed('0x41')][_0x00ed('0x49')]);_0x59bc74[_0x00ed('0x4a')]=qs[_0x00ed('0x4b')](_['pick'](_0x63f754['query'],_0x4d1a08[_0x00ed('0x4b')]));_0x59bc74[_0x00ed('0x4a')][_0x00ed('0x66')]=_0x4af202['id'];if(_0x63f754[_0x00ed('0x41')]['filter']){_0x59bc74[_0x00ed('0x4a')]=_['merge'](_0x59bc74['where'],{'$or':_[_0x00ed('0x3d')](_0x59bc74[_0x00ed('0x43')],function(_0x46f2ac){var _0x472648={};_0x472648[_0x46f2ac]={'$like':'%'+_0x63f754[_0x00ed('0x41')]['filter']+'%'};return _0x472648;})});}_0x59bc74=_[_0x00ed('0x4e')]({},_0x59bc74,_0x63f754[_0x00ed('0x50')]);return db[_0x00ed('0x67')][_0x00ed('0x30')]({'where':_0x59bc74[_0x00ed('0x4a')]})['then'](function(_0x44a8e6){_0x120dd6[_0x00ed('0x30')]=_0x44a8e6;if(_0x63f754['query'][_0x00ed('0x52')]){_0x59bc74['include']=[{'all':!![]}];}return db['Disposition'][_0x00ed('0x54')](_0x59bc74);})['then'](function(_0x32c6bb){_0x120dd6[_0x00ed('0x55')]=_0x32c6bb;return _0x120dd6;});}})[_0x00ed('0x21')](respondWithFilteredResult(_0x2af79c,_0x59bc74))[_0x00ed('0x56')](handleError(_0x2af79c,null));};exports[_0x00ed('0x6a')]=function(_0x5659cf,_0x4f3978,_0x442fca){return db[_0x00ed('0x51')][_0x00ed('0x60')]({'where':{'id':_0x5659cf['params']['id']}})[_0x00ed('0x21')](handleEntityNotFound(_0x4f3978,null))['then'](function(_0x3369d8){if(_0x3369d8){return _0x3369d8['removeDispositions'](_0x5659cf[_0x00ed('0x41')][_0x00ed('0x6b')]);}})[_0x00ed('0x21')](respondWithStatusCode(_0x4f3978,null))[_0x00ed('0x56')](handleError(_0x4f3978,null));};exports[_0x00ed('0x6c')]=function(_0x17c323,_0x40b4cb,_0x5cd4e9){if(_0x17c323['body']['id']){delete _0x17c323[_0x00ed('0x5b')]['id'];}return db[_0x00ed('0x51')][_0x00ed('0x60')]({'where':{'id':_0x17c323[_0x00ed('0x58')]['id']}})[_0x00ed('0x21')](handleEntityNotFound(_0x40b4cb,null))['then'](function(_0x4abf5f){if(_0x4abf5f){_0x17c323[_0x00ed('0x5b')][_0x00ed('0x66')]=_0x4abf5f['id'];return db[_0x00ed('0x6d')][_0x00ed('0x5a')](_0x17c323[_0x00ed('0x5b')]);}})[_0x00ed('0x21')](respondWithResult(_0x40b4cb,null))[_0x00ed('0x56')](handleError(_0x40b4cb,null));};exports[_0x00ed('0x6e')]=function(_0x340799,_0x9da88e,_0x488b3f){var _0x56d2d4={'raw':![],'where':{}};var _0x189521={};var _0x1ab5bc={'count':0x0,'rows':[]};return db[_0x00ed('0x51')][_0x00ed('0x69')]({'where':{'id':_0x340799[_0x00ed('0x58')]['id']}})[_0x00ed('0x21')](handleEntityNotFound(_0x9da88e,null))['then'](function(_0x40f305){if(_0x40f305){_0x189521[_0x00ed('0x40')]=_[_0x00ed('0x42')](db[_0x00ed('0x6d')]['rawAttributes']);_0x189521['query']=_[_0x00ed('0x42')](_0x340799[_0x00ed('0x41')]);_0x189521[_0x00ed('0x4b')]=_['intersection'](_0x189521[_0x00ed('0x40')],_0x189521[_0x00ed('0x41')]);_0x56d2d4[_0x00ed('0x43')]=_[_0x00ed('0x59')](_0x189521[_0x00ed('0x40')],qs[_0x00ed('0x44')](_0x340799[_0x00ed('0x41')][_0x00ed('0x44')]));_0x56d2d4[_0x00ed('0x43')]=_0x56d2d4[_0x00ed('0x43')][_0x00ed('0x45')]?_0x56d2d4[_0x00ed('0x43')]:_0x189521[_0x00ed('0x40')];if(!_0x340799[_0x00ed('0x41')][_0x00ed('0x6f')](_0x00ed('0x46'))){_0x56d2d4['limit']=qs[_0x00ed('0x47')](_0x340799[_0x00ed('0x41')][_0x00ed('0x47')]);_0x56d2d4[_0x00ed('0x2e')]=qs['offset'](_0x340799['query']['offset']);}_0x56d2d4[_0x00ed('0x48')]=qs[_0x00ed('0x49')](_0x340799[_0x00ed('0x41')][_0x00ed('0x49')]);_0x56d2d4[_0x00ed('0x4a')]=qs[_0x00ed('0x4b')](_['pick'](_0x340799[_0x00ed('0x41')],_0x189521[_0x00ed('0x4b')]));_0x56d2d4[_0x00ed('0x4a')]['FaxAccountId']=_0x40f305['id'];if(_0x340799[_0x00ed('0x41')][_0x00ed('0x4d')]){_0x56d2d4[_0x00ed('0x4a')]=_[_0x00ed('0x4e')](_0x56d2d4[_0x00ed('0x4a')],{'$or':_[_0x00ed('0x3d')](_0x56d2d4[_0x00ed('0x43')],function(_0x232fc9){var _0x3684a6={};_0x3684a6[_0x232fc9]={'$like':'%'+_0x340799[_0x00ed('0x41')][_0x00ed('0x4d')]+'%'};return _0x3684a6;})});}_0x56d2d4=_['merge']({},_0x56d2d4,_0x340799['options']);return db[_0x00ed('0x6d')]['count']({'where':_0x56d2d4['where']})[_0x00ed('0x21')](function(_0x28f94f){_0x1ab5bc[_0x00ed('0x30')]=_0x28f94f;if(_0x340799[_0x00ed('0x41')][_0x00ed('0x52')]){_0x56d2d4['include']=[{'all':!![]}];}return db[_0x00ed('0x6d')]['findAll'](_0x56d2d4);})[_0x00ed('0x21')](function(_0x172314){_0x1ab5bc[_0x00ed('0x55')]=_0x172314;return _0x1ab5bc;});}})['then'](respondWithFilteredResult(_0x9da88e,_0x56d2d4))[_0x00ed('0x56')](handleError(_0x9da88e,null));};exports[_0x00ed('0x70')]=function(_0x479fe9,_0x4eb4e6,_0x1dffeb){return db[_0x00ed('0x51')][_0x00ed('0x60')]({'where':{'id':_0x479fe9[_0x00ed('0x58')]['id']}})['then'](handleEntityNotFound(_0x4eb4e6,null))[_0x00ed('0x21')](function(_0x55026f){if(_0x55026f){return _0x55026f[_0x00ed('0x70')](_0x479fe9[_0x00ed('0x41')][_0x00ed('0x6b')]);}})[_0x00ed('0x21')](respondWithStatusCode(_0x4eb4e6,null))[_0x00ed('0x56')](handleError(_0x4eb4e6,null));};exports[_0x00ed('0x71')]=function(_0x358791,_0x34ee88,_0x585c3b){return db['FaxInteraction'][_0x00ed('0x60')]({'where':{'id':_0x358791[_0x00ed('0x58')]['id']}})[_0x00ed('0x21')](handleEntityNotFound(_0x34ee88,null))[_0x00ed('0x21')](function(_0x47fdf0){if(_0x47fdf0){return _0x47fdf0['addInteraction'](_0x358791[_0x00ed('0x5b')][_0x00ed('0x6b')],_['omit'](_0x358791[_0x00ed('0x5b')],[_0x00ed('0x6b'),'id'])||{});}})[_0x00ed('0x21')](respondWithResult(_0x34ee88,null))[_0x00ed('0x56')](handleError(_0x34ee88,null));};exports[_0x00ed('0x72')]=function(_0x4cab59,_0x25482d,_0x47d8ab){var _0x334cb9={'raw':![],'where':{}};var _0x357a6a={};var _0x2a0967={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x4cab59[_0x00ed('0x58')]['id']}})['then'](handleEntityNotFound(_0x25482d,null))[_0x00ed('0x21')](function(_0x5c8d96){if(_0x5c8d96){_0x357a6a[_0x00ed('0x40')]=_[_0x00ed('0x42')](db[_0x00ed('0x73')][_0x00ed('0x3e')]);_0x357a6a[_0x00ed('0x41')]=_['keys'](_0x4cab59[_0x00ed('0x41')]);_0x357a6a[_0x00ed('0x4b')]=_[_0x00ed('0x59')](_0x357a6a[_0x00ed('0x40')],_0x357a6a[_0x00ed('0x41')]);_0x334cb9[_0x00ed('0x43')]=_[_0x00ed('0x59')](_0x357a6a[_0x00ed('0x40')],qs[_0x00ed('0x44')](_0x4cab59[_0x00ed('0x41')][_0x00ed('0x44')]));_0x334cb9[_0x00ed('0x43')]=_0x334cb9[_0x00ed('0x43')][_0x00ed('0x45')]?_0x334cb9['attributes']:_0x357a6a[_0x00ed('0x40')];if(!_0x4cab59[_0x00ed('0x41')][_0x00ed('0x6f')]('nolimit')){_0x334cb9[_0x00ed('0x47')]=qs['limit'](_0x4cab59[_0x00ed('0x41')][_0x00ed('0x47')]);_0x334cb9['offset']=qs[_0x00ed('0x2e')](_0x4cab59[_0x00ed('0x41')]['offset']);}_0x334cb9[_0x00ed('0x48')]=qs['sort'](_0x4cab59[_0x00ed('0x41')][_0x00ed('0x49')]);_0x334cb9[_0x00ed('0x4a')]=qs[_0x00ed('0x4b')](_[_0x00ed('0x4c')](_0x4cab59[_0x00ed('0x41')],_0x357a6a[_0x00ed('0x4b')]));_0x334cb9[_0x00ed('0x4a')][_0x00ed('0x66')]=_0x5c8d96['id'];if(_0x4cab59['query'][_0x00ed('0x4d')]){_0x334cb9[_0x00ed('0x4a')]=_[_0x00ed('0x4e')](_0x334cb9['where'],{'$or':_[_0x00ed('0x3d')](_0x334cb9[_0x00ed('0x43')],function(_0x33febc){var _0x57651f={};_0x57651f[_0x33febc]={'$like':'%'+_0x4cab59['query'][_0x00ed('0x4d')]+'%'};return _0x57651f;})});}_0x334cb9=_[_0x00ed('0x4e')]({},_0x334cb9,_0x4cab59[_0x00ed('0x50')]);return db[_0x00ed('0x73')][_0x00ed('0x30')]({'where':_0x334cb9[_0x00ed('0x4a')]})[_0x00ed('0x21')](function(_0x267262){_0x2a0967[_0x00ed('0x30')]=_0x267262;if(_0x4cab59[_0x00ed('0x41')][_0x00ed('0x52')]){_0x334cb9['include']=[{'model':db[_0x00ed('0x74')],'as':_0x00ed('0x75'),'required':![]},{'model':db['User'],'as':_0x00ed('0x76'),'attributes':[_0x00ed('0x39'),'fullname',_0x00ed('0x77')],'required':![]},{'model':db[_0x00ed('0x78')],'as':_0x00ed('0x79'),'attributes':['id',_0x00ed('0x39'),_0x00ed('0x7a')],'where':_0x4cab59[_0x00ed('0x41')][_0x00ed('0x7b')]?{'id':_0x4cab59[_0x00ed('0x41')]['tag']}:undefined,'required':_0x4cab59[_0x00ed('0x41')][_0x00ed('0x7b')]?!![]:![]}];}return db[_0x00ed('0x73')]['findAll'](_0x334cb9);})[_0x00ed('0x21')](function(_0x22a36e){_0x2a0967[_0x00ed('0x55')]=_0x22a36e;return _0x2a0967;});}})[_0x00ed('0x21')](respondWithFilteredResult(_0x25482d,_0x334cb9))['catch'](handleError(_0x25482d,null));};exports[_0x00ed('0x7c')]=function(_0x292b85,_0x248885){var _0x58ea6a=_0x292b85['params']['id'];var _0x23246a=_0x292b85['body'];var _0xbe1de5=0xc8;var _0x5af2ef=null;return db[_0x00ed('0x7d')][_0x00ed('0x7e')]({'isolationLevel':db['sequelize'][_0x00ed('0x7f')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x22730c){return db[_0x00ed('0x51')][_0x00ed('0x69')]({'where':{'id':_0x58ea6a},'transaction':_0x22730c})[_0x00ed('0x21')](function(_0x53a08f){if(_0x53a08f){return db['FaxApplication'][_0x00ed('0x36')]({'where':{'FaxAccountId':_0x58ea6a},'transaction':_0x22730c})[_0x00ed('0x21')](function(){var _0x1dd751=_[_0x00ed('0x3d')](_0x23246a,function(_0x37405d){_0x37405d[_0x00ed('0x66')]=_0x58ea6a;return _0x37405d;});return db[_0x00ed('0x80')][_0x00ed('0x81')](_0x1dd751,{'transaction':_0x22730c});});}else{_0xbe1de5=0x194;_0x5af2ef=[];}});})[_0x00ed('0x21')](function(){if(_0xbe1de5!==0x194){return db[_0x00ed('0x80')][_0x00ed('0x82')]({'where':{'FaxAccountId':_0x58ea6a},'order':'priority'})['then'](function(_0x538d1f){_0x5af2ef=_0x538d1f;});}})[_0x00ed('0x56')](function(_0x13a3a6){_0xbe1de5=0x1f4;logger[_0x00ed('0x26')](_0x13a3a6[_0x00ed('0x38')]);if(_0x13a3a6[_0x00ed('0x39')]){delete _0x13a3a6[_0x00ed('0x39')];}_0x5af2ef=_0x13a3a6;})[_0x00ed('0x83')](function(){if(_0x5af2ef===null){_0x248885['sendStatus'](_0xbe1de5);}else{if(_0xbe1de5===0x1f4){_0x248885[_0x00ed('0x2b')](_0xbe1de5)[_0x00ed('0x3a')](_0x5af2ef);}else{_0x248885[_0x00ed('0x2b')](_0xbe1de5)['json'](_0x5af2ef);}}});};exports['getApplications']=function(_0x5ec4b6,_0x1d510d,_0x202df0){var _0xc63842={};var _0x3df67a={};var _0x35f179;var _0x43cf1a;return db[_0x00ed('0x51')]['findOne']({'where':{'id':_0x5ec4b6[_0x00ed('0x58')]['id']}})['then'](handleEntityNotFound(_0x1d510d,null))['then'](function(_0x4acd29){if(_0x4acd29){_0x35f179=_0x4acd29;_0x3df67a['model']=_[_0x00ed('0x42')](db[_0x00ed('0x80')]['rawAttributes']);_0x3df67a[_0x00ed('0x41')]=_[_0x00ed('0x42')](_0x5ec4b6[_0x00ed('0x41')]);_0x3df67a['filters']=_['intersection'](_0x3df67a[_0x00ed('0x40')],_0x3df67a[_0x00ed('0x41')]);_0xc63842[_0x00ed('0x43')]=_['intersection'](_0x3df67a[_0x00ed('0x40')],qs[_0x00ed('0x44')](_0x5ec4b6[_0x00ed('0x41')]['fields']));_0xc63842['attributes']=_0xc63842[_0x00ed('0x43')][_0x00ed('0x45')]?_0xc63842[_0x00ed('0x43')]:_0x3df67a[_0x00ed('0x40')];_0xc63842['order']=qs[_0x00ed('0x49')](_0x5ec4b6['query'][_0x00ed('0x49')]);_0xc63842[_0x00ed('0x4a')]=qs[_0x00ed('0x4b')](_['pick'](_0x5ec4b6[_0x00ed('0x41')],_0x3df67a[_0x00ed('0x4b')]));if(_0x5ec4b6['query'][_0x00ed('0x4d')]){_0xc63842['where']=_['merge'](_0xc63842[_0x00ed('0x4a')],{'$or':_[_0x00ed('0x3d')](_0xc63842[_0x00ed('0x43')],function(_0x33cb16){var _0x55e13d={};_0x55e13d[_0x33cb16]={'$like':'%'+_0x5ec4b6[_0x00ed('0x41')]['filter']+'%'};return _0x55e13d;})});}_0xc63842=_[_0x00ed('0x4e')]({},_0xc63842,_0x5ec4b6[_0x00ed('0x50')]);return _0x35f179['getApplications'](_0xc63842);}})[_0x00ed('0x21')](function(_0x59a82e){if(_0x59a82e){_0x43cf1a=_0x59a82e[_0x00ed('0x45')];if(!_0x5ec4b6['query'][_0x00ed('0x6f')](_0x00ed('0x46'))){_0xc63842[_0x00ed('0x47')]=qs[_0x00ed('0x47')](_0x5ec4b6['query']['limit']);_0xc63842[_0x00ed('0x2e')]=qs[_0x00ed('0x2e')](_0x5ec4b6['query']['offset']);}return _0x35f179[_0x00ed('0x84')](_0xc63842);}})[_0x00ed('0x21')](function(_0x2db059){if(_0x2db059){return _0x2db059?{'count':_0x43cf1a,'rows':_0x2db059}:null;}})[_0x00ed('0x21')](respondWithResult(_0x1d510d,null))[_0x00ed('0x56')](handleError(_0x1d510d,null));};function Extension(_0x24bbe1,_0x37bf7a,_0x309697,_0x10b454){this[_0x00ed('0x85')]=_0x00ed('0x86');this[_0x00ed('0x87')]=_0x24bbe1[_0x00ed('0x88')];this[_0x00ed('0x89')]=_0x10b454;this['type']=_0x00ed('0x8a');this['description']=_0x00ed('0x8b');this[_0x00ed('0x66')]=_0x24bbe1['id'];this[_0x00ed('0x8c')]=_0x37bf7a;this[_0x00ed('0x8d')]=_0x309697;}function createExtensionsReciveFax(_0x197ae2){var _0x47ada5=0x1;var _0x3a0cd0=[];_0x3a0cd0[_0x00ed('0x8e')](new Extension(_0x197ae2,_0x47ada5,'',_0x00ed('0x8f')));_0x47ada5+=0x1;_0x3a0cd0[_0x00ed('0x8e')](new Extension(_0x197ae2,_0x47ada5,'CDR(type)=inbound-fax',_0x00ed('0x90')));_0x47ada5+=0x1;for(var _0x314601 in _0x197ae2){if(_0x197ae2[_0x00ed('0x6f')](_0x314601)&&(_0x314601===_0x00ed('0x91')||_0x314601==='localstationid'||_0x314601===_0x00ed('0x92')||_0x314601===_0x00ed('0x93')||_0x314601==='headerinfo'||_0x314601===_0x00ed('0x94')||_0x314601===_0x00ed('0x95')||_0x314601===_0x00ed('0x96')||_0x314601==='t38timeout')){_0x3a0cd0['push'](new Extension(_0x197ae2,_0x47ada5,_0x00ed('0x97')+_0x314601+')='+_0x197ae2[_0x314601],_0x00ed('0x90')));_0x47ada5+=0x1;}}_0x3a0cd0[_0x00ed('0x8e')](new Extension(_0x197ae2,_0x47ada5,'6',_0x00ed('0x98')));_0x47ada5+=0x1;_0x3a0cd0[_0x00ed('0x8e')](new Extension(_0x197ae2,_0x47ada5,_0x00ed('0x99'),_0x00ed('0x9a')));_0x47ada5=0x0;return _0x3a0cd0;}exports[_0x00ed('0x9b')]=function(_0x3a1951,_0x519130,_0x7a20f7){var _0x1f315a;return db[_0x00ed('0x7d')][_0x00ed('0x7e')](function(_0xc5459d){return db[_0x00ed('0x51')]['create'](_0x3a1951[_0x00ed('0x5b')],{'transaction':_0xc5459d})[_0x00ed('0x21')](function(_0xe5f051){_0x1f315a=_0xe5f051[_0x00ed('0x5e')]({'plain':!![]});return db[_0x00ed('0x9c')][_0x00ed('0x81')](createExtensionsReciveFax(_0x1f315a),{'transaction':_0xc5459d});});})[_0x00ed('0x21')](function(){return _0x1f315a;})[_0x00ed('0x21')](respondWithResult(_0x519130,null))['catch'](handleError(_0x519130,null));};exports[_0x00ed('0x9d')]=function(_0x40ca5a,_0x2a58fd,_0x16c9f5){var _0x154577;return db[_0x00ed('0x7d')][_0x00ed('0x7e')](function(_0x415fc4){return db[_0x00ed('0x51')][_0x00ed('0x35')](_0x40ca5a[_0x00ed('0x5b')],{'where':{'id':_0x40ca5a['body']['id']},'transaction':_0x415fc4})[_0x00ed('0x21')](function(_0x24727e){return db['VoiceExtension'][_0x00ed('0x36')]({'where':{'FaxAccountId':_0x40ca5a[_0x00ed('0x5b')]['id']},'transaction':_0x415fc4})[_0x00ed('0x21')](function(_0x52bb74){return db['VoiceExtension'][_0x00ed('0x81')](createExtensionsReciveFax(_[_0x00ed('0x9e')](_0x40ca5a[_0x00ed('0x5b')],[_0x00ed('0x9f'),_0x00ed('0xa0'),_0x00ed('0xa1'),'updatedAt',_0x00ed('0xa2'),_0x00ed('0xa3')])),{'transaction':_0x415fc4});});});})['then'](function(){return db[_0x00ed('0x51')]['findById'](_0x40ca5a[_0x00ed('0x5b')]['id']);})[_0x00ed('0x21')](respondWithResult(_0x2a58fd,null))[_0x00ed('0x56')](handleError(_0x2a58fd,null));};exports['getMessages']=function(_0x201c94,_0x59a02b,_0x53b6f0){var _0x163407={'raw':!![],'where':{}};var _0x144ab7={};var _0x2adfb1={'count':0x0,'rows':[]};return db['FaxAccount'][_0x00ed('0x69')]({'where':{'id':_0x201c94[_0x00ed('0x58')]['id']}})[_0x00ed('0x21')](handleEntityNotFound(_0x59a02b,null))['then'](function(_0x18e647){if(_0x18e647){_0x144ab7[_0x00ed('0x40')]=_['keys'](db['FaxMessage'][_0x00ed('0x3e')]);_0x144ab7[_0x00ed('0x41')]=_[_0x00ed('0x42')](_0x201c94[_0x00ed('0x41')]);_0x144ab7[_0x00ed('0x4b')]=_[_0x00ed('0x59')](_0x144ab7[_0x00ed('0x40')],_0x144ab7['query']);_0x163407['attributes']=_[_0x00ed('0x59')](_0x144ab7['model'],qs[_0x00ed('0x44')](_0x201c94[_0x00ed('0x41')]['fields']));_0x163407[_0x00ed('0x43')]=_0x163407[_0x00ed('0x43')][_0x00ed('0x45')]?_0x163407[_0x00ed('0x43')]:_0x144ab7[_0x00ed('0x40')];if(!_0x201c94[_0x00ed('0x41')][_0x00ed('0x6f')](_0x00ed('0x46'))){_0x163407[_0x00ed('0x47')]=qs[_0x00ed('0x47')](_0x201c94[_0x00ed('0x41')]['limit']);_0x163407[_0x00ed('0x2e')]=qs['offset'](_0x201c94['query']['offset']);}_0x163407['order']=qs['sort'](_0x201c94[_0x00ed('0x41')][_0x00ed('0x49')]);_0x163407[_0x00ed('0x4a')]=qs[_0x00ed('0x4b')](_[_0x00ed('0x4c')](_0x201c94[_0x00ed('0x41')],_0x144ab7[_0x00ed('0x4b')]));_0x163407[_0x00ed('0x4a')][_0x00ed('0x66')]=_0x18e647['id'];if(_0x201c94[_0x00ed('0x41')][_0x00ed('0x4d')]){_0x163407[_0x00ed('0x4a')]=_[_0x00ed('0x4e')](_0x163407['where'],{'$or':_[_0x00ed('0x3d')](_0x163407[_0x00ed('0x43')],function(_0x3ff976){var _0x413ebb={};_0x413ebb[_0x3ff976]={'$like':'%'+_0x201c94[_0x00ed('0x41')][_0x00ed('0x4d')]+'%'};return _0x413ebb;})});}if(_0x201c94[_0x00ed('0x41')]['$gte']){var _0x5cec27=_0x201c94[_0x00ed('0x41')][_0x00ed('0xa4')][_0x00ed('0xa5')](',');var _0x3d6f6d={};_0x3d6f6d[_0x5cec27[0x0]]={'$gte':moment(_0x5cec27[0x1])[_0x00ed('0xa6')](_0x00ed('0xa7'))};_0x163407['where']=_[_0x00ed('0x4e')](_0x163407[_0x00ed('0x4a')],_0x3d6f6d);}_0x163407=_[_0x00ed('0x4e')]({},_0x163407,_0x201c94['options']);return db[_0x00ed('0xa8')][_0x00ed('0x30')]({'where':_0x163407[_0x00ed('0x4a')]})['then'](function(_0x3629cb){_0x2adfb1[_0x00ed('0x30')]=_0x3629cb;if(_0x201c94[_0x00ed('0x41')][_0x00ed('0x52')]){_0x163407[_0x00ed('0x53')]=[{'all':!![]}];}return db[_0x00ed('0xa8')]['findAll'](_0x163407);})[_0x00ed('0x21')](function(_0xe11e05){_0x2adfb1[_0x00ed('0x55')]=_0xe11e05;return _0x2adfb1;});}})[_0x00ed('0x21')](respondWithFilteredResult(_0x59a02b,_0x163407))['catch'](handleError(_0x59a02b,null));};exports['send']=function(_0x36e0ea,_0x121e32,_0x17d169){var _0x3567e8,_0x12ddfd={},_0x233e78;if(_0x36e0ea[_0x00ed('0x5b')]['to']){_0x233e78=_0x36e0ea['body']['to'][0x0];}return db[_0x00ed('0x51')][_0x00ed('0x60')]({'where':{'id':_0x36e0ea[_0x00ed('0x58')]['id']},'include':[{'model':db[_0x00ed('0xa9')],'as':_0x00ed('0xaa'),'include':[{'model':db[_0x00ed('0x74')],'as':'Contacts','where':{'fax':_0x233e78},'limit':0x1,'order':[[_0x00ed('0xab'),'DESC']]}]}]})[_0x00ed('0x21')](handleEntityNotFound(_0x121e32,null))[_0x00ed('0x21')](function(_0x3711d2){_0x3567e8=_0x3711d2;if(_0x36e0ea[_0x00ed('0x5b')][_0x00ed('0xac')]&&_0x36e0ea[_0x00ed('0x5b')]['attachments'][_0x00ed('0x45')]){for(var _0x7a173f=0x0;_0x7a173f<_0x36e0ea[_0x00ed('0x5b')][_0x00ed('0xac')][_0x00ed('0x45')];_0x7a173f+=0x1){_0x36e0ea[_0x00ed('0x5b')][_0x00ed('0xac')][_0x7a173f]={'filename':_0x36e0ea[_0x00ed('0x5b')][_0x00ed('0xac')][_0x7a173f][_0x00ed('0x39')],'id':_0x36e0ea[_0x00ed('0x5b')][_0x00ed('0xac')][_0x7a173f]['id'],'path':path[_0x00ed('0xad')](config[_0x00ed('0xae')],_0x00ed('0xaf'),_0x36e0ea[_0x00ed('0x5b')][_0x00ed('0xac')][_0x7a173f][_0x00ed('0xb0')])};}}return respondWithRpcPromise('CheckAfterSend',_0x00ed('0xb1'),{'FaxAccountId':_['isNil'](_0x36e0ea['params']['id'])?undefined:_0x36e0ea['params']['id'],'path':_[_0x00ed('0xb2')](_0x36e0ea[_0x00ed('0x5b')][_0x00ed('0xac')][0x0][_0x00ed('0xb3')])?undefined:_0x36e0ea[_0x00ed('0x5b')]['attachments'][0x0]['path'],'fax':_['isNil'](_0x36e0ea[_0x00ed('0x5b')]['to'][0x0])?undefined:_0x36e0ea[_0x00ed('0x5b')]['to'][0x0]},client9002);})[_0x00ed('0x21')](function(){if(_0x3567e8){if(_[_0x00ed('0xb2')](_0x36e0ea['body'][_0x00ed('0xb4')])){_0x36e0ea[_0x00ed('0x5b')][_0x00ed('0xb4')]=util[_0x00ed('0xa6')](_0x00ed('0xb5'),_0x3567e8['name'],_0x3567e8[_0x00ed('0xb6')]);}if(_0x3567e8[_0x00ed('0xaa')]){if(_0x3567e8[_0x00ed('0xaa')][_0x00ed('0xb7')][_0x00ed('0x45')]){return _0x3567e8[_0x00ed('0xaa')]['Contacts'][0x0];}else{return db[_0x00ed('0x74')][_0x00ed('0x5a')](_['defaults'](_0x36e0ea[_0x00ed('0x5b')],{'firstName':_0x36e0ea[_0x00ed('0x5b')]['to'][0x0],'phone':_0x36e0ea[_0x00ed('0x5b')]['to'][0x0],'fax':_0x36e0ea[_0x00ed('0x5b')]['to'][0x0],'ListId':_0x3567e8['ListId']}));}}else{throw new Error(_0x00ed('0xb8'));}}else{throw new Error(_0x00ed('0xb9'));}})[_0x00ed('0x21')](function(_0x343228){if(_0x343228){return db[_0x00ed('0x73')][_0x00ed('0x60')]({'where':{'ContactId':_0x343228['id'],'closed':![],'FaxAccountId':_0x3567e8['id']}})['then'](function(_0x2babb4){if(_0x2babb4){return[_0x2babb4,![]];}return db['FaxInteraction'][_0x00ed('0x5a')]({'UserId':_0x36e0ea[_0x00ed('0x5c')]['id'],'ContactId':_0x343228['id'],'FaxAccountId':_0x3567e8['id'],'fax':_0x36e0ea['body']['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x00ed('0x4e')](_0x36e0ea[_0x00ed('0x5b')],{'read':![],'body':_0x36e0ea[_0x00ed('0x5b')]['attachments'][0x0][_0x00ed('0xba')],'FaxAccountId':_0x3567e8['id'],'UserId':_0x36e0ea[_0x00ed('0x5c')]['id'],'ContactId':_0x343228['id'],'AttachmentId':_0x36e0ea[_0x00ed('0x5b')][_0x00ed('0xac')][0x0]['id']})]},{'include':[{'model':db[_0x00ed('0xa8')],'as':'Messages'}]})['then'](function(_0x5968e2){return[_0x5968e2,!![]];});});}else{throw new Error(_0x00ed('0xbb'));}})[_0x00ed('0xbc')](function(_0x55b560,_0xbca35a){if(_0xbca35a){return _0x55b560;}return db[_0x00ed('0xa8')][_0x00ed('0x5a')]({'direction':_0x00ed('0xbd'),'read':![],'body':_0x36e0ea['body']['attachments'][0x0][_0x00ed('0xba')],'FaxAccountId':_0x3567e8['id'],'FaxInteractionId':_0x55b560['id'],'UserId':_0x36e0ea[_0x00ed('0x5c')]['id'],'ContactId':_0x55b560[_0x00ed('0xbe')],'AttachmentId':_0x36e0ea['body']['attachments'][0x0]['id']})[_0x00ed('0x21')](function(_0x1545d6){_0x55b560[_0x00ed('0xbf')][_0x00ed('0xc0')]=[];_0x55b560[_0x00ed('0xbf')][_0x00ed('0xc0')]['push'](_0x1545d6[_0x00ed('0xbf')]);return _0x55b560;});})[_0x00ed('0x21')](function(_0x567d61){respondWithRpcPromise(_0x00ed('0xc1'),_0x00ed('0xc1'),{'FaxAccountId':_['isNil'](_0x36e0ea[_0x00ed('0x58')]['id'])?undefined:_0x36e0ea[_0x00ed('0x58')]['id'],'path':_['isNil'](_0x36e0ea[_0x00ed('0x5b')][_0x00ed('0xac')][0x0]['path'])?undefined:_0x36e0ea['body'][_0x00ed('0xac')][0x0][_0x00ed('0xb3')],'fax':_[_0x00ed('0xb2')](_0x36e0ea[_0x00ed('0x5b')]['to'][0x0])?undefined:_0x36e0ea[_0x00ed('0x5b')]['to'][0x0],'AttachmentId':_0x36e0ea[_0x00ed('0x5b')][_0x00ed('0xac')][0x0]['id']},client9002)[_0x00ed('0x21')](function(_0x3beeaf){logger['info'](_0x00ed('0xc2'),_0x3beeaf);})[_0x00ed('0x56')](function(_0x5f4c68){logger[_0x00ed('0x22')](_0x00ed('0xc2'),_0x5f4c68);});return _0x567d61;})['then'](respondWithResult(_0x121e32,null))[_0x00ed('0x56')](handleError(_0x121e32,null));};exports[_0x00ed('0xc3')]=function(_0x3b2105,_0x3a2351,_0x2b12ec){return db[_0x00ed('0x51')][_0x00ed('0x60')]({'where':{'id':_0x3b2105[_0x00ed('0x58')]['id']}})[_0x00ed('0x21')](handleEntityNotFound(_0x3a2351,null))['then'](function(_0x251f68){if(_0x251f68){return _0x251f68[_0x00ed('0xc3')](_0x3b2105[_0x00ed('0x5b')][_0x00ed('0x6b')],_['omit'](_0x3b2105[_0x00ed('0x5b')],[_0x00ed('0x6b'),'id'])||{})[_0x00ed('0xbc')](function(_0x38803f){for(var _0x34ef61=0x0;_0x34ef61<_0x3b2105[_0x00ed('0x5b')][_0x00ed('0x6b')][_0x00ed('0x45')];_0x34ef61+=0x1){socket['emit'](_0x00ed('0xc4'),{'UserId':Number(_0x3b2105[_0x00ed('0x5b')][_0x00ed('0x6b')][_0x34ef61]),'FaxAccountId':Number(_0x3b2105[_0x00ed('0x58')]['id'])});}return _0x38803f;});}})[_0x00ed('0x21')](respondWithResult(_0x3a2351,null))['catch'](handleError(_0x3a2351,null));};exports[_0x00ed('0xc5')]=function(_0xef36f6,_0x5ddd2b,_0x20954e){return db['FaxAccount']['find']({'where':{'id':_0xef36f6[_0x00ed('0x58')]['id']}})['then'](handleEntityNotFound(_0x5ddd2b,null))[_0x00ed('0x21')](function(_0x1060b6){if(_0x1060b6){return _0x1060b6['removeAgents'](_0xef36f6[_0x00ed('0x41')][_0x00ed('0x6b')])[_0x00ed('0x21')](function(){if(_[_0x00ed('0xc6')](_0xef36f6[_0x00ed('0x41')][_0x00ed('0x6b')])){for(var _0x335a1d=0x0;_0x335a1d<_0xef36f6['query'][_0x00ed('0x6b')][_0x00ed('0x45')];_0x335a1d+=0x1){socket[_0x00ed('0xc7')]('userFaxAccount:remove',{'UserId':Number(_0xef36f6[_0x00ed('0x41')][_0x00ed('0x6b')][_0x335a1d]),'FaxAccountId':Number(_0xef36f6[_0x00ed('0x58')]['id'])});}}else{socket[_0x00ed('0xc7')]('userFaxAccount:remove',{'UserId':Number(_0xef36f6[_0x00ed('0x41')]['ids']),'FaxAccountId':Number(_0xef36f6[_0x00ed('0x58')]['id'])});}});}})[_0x00ed('0x21')](respondWithStatusCode(_0x5ddd2b,null))[_0x00ed('0x56')](handleError(_0x5ddd2b,null));};exports[_0x00ed('0xc8')]=function(_0x32e050,_0x5c09b8,_0x1add8a){var _0x33446f={};var _0x3154fe={};var _0x207860;var _0x261de6;return db[_0x00ed('0x51')]['findOne']({'where':{'id':_0x32e050['params']['id']}})[_0x00ed('0x21')](handleEntityNotFound(_0x5c09b8,null))[_0x00ed('0x21')](function(_0x522e99){if(_0x522e99){_0x207860=_0x522e99;_0x3154fe[_0x00ed('0x40')]=_[_0x00ed('0x42')](db[_0x00ed('0xc9')]['rawAttributes']);_0x3154fe['query']=_[_0x00ed('0x42')](_0x32e050[_0x00ed('0x41')]);_0x3154fe[_0x00ed('0x4b')]=_[_0x00ed('0x59')](_0x3154fe[_0x00ed('0x40')],_0x3154fe[_0x00ed('0x41')]);_0x33446f['attributes']=_[_0x00ed('0x59')](_0x3154fe[_0x00ed('0x40')],qs[_0x00ed('0x44')](_0x32e050['query']['fields']));_0x33446f['attributes']=_0x33446f[_0x00ed('0x43')]['length']?_0x33446f[_0x00ed('0x43')]:_0x3154fe[_0x00ed('0x40')];_0x33446f[_0x00ed('0x48')]=qs[_0x00ed('0x49')](_0x32e050[_0x00ed('0x41')][_0x00ed('0x49')]);_0x33446f['where']=qs[_0x00ed('0x4b')](_['pick'](_0x32e050[_0x00ed('0x41')],_0x3154fe['filters']));if(_0x32e050[_0x00ed('0x41')]['filter']){_0x33446f['where']=_[_0x00ed('0x4e')](_0x33446f[_0x00ed('0x4a')],{'$or':_[_0x00ed('0x3d')](_0x33446f['attributes'],function(_0x56ca18){var _0x586145={};_0x586145[_0x56ca18]={'$like':'%'+_0x32e050['query'][_0x00ed('0x4d')]+'%'};return _0x586145;})});}_0x33446f=_[_0x00ed('0x4e')]({},_0x33446f,_0x32e050[_0x00ed('0x50')]);return _0x207860[_0x00ed('0xc8')](_0x33446f);}})['then'](function(_0x41cfe7){if(_0x41cfe7){_0x261de6=_0x41cfe7['length'];if(!_0x32e050[_0x00ed('0x41')][_0x00ed('0x6f')]('nolimit')){_0x33446f[_0x00ed('0x47')]=qs[_0x00ed('0x47')](_0x32e050[_0x00ed('0x41')][_0x00ed('0x47')]);_0x33446f[_0x00ed('0x2e')]=qs['offset'](_0x32e050[_0x00ed('0x41')]['offset']);}return _0x207860[_0x00ed('0xc8')](_0x33446f);}})['then'](function(_0x5ae315){if(_0x5ae315){return _0x5ae315?{'count':_0x261de6,'rows':_0x5ae315}:null;}})['then'](respondWithResult(_0x5c09b8,null))[_0x00ed('0x56')](handleError(_0x5c09b8,null));}; \ No newline at end of file +var _0x24d3=['userFaxAccount:save','removeAgents','userFaxAccount:remove','getAgents','rimraf','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','./faxAccount.socket','register','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','undefined','limit','offset','set','Content-Range','json','apply','reject','update','then','destroy','get','FaxAccounts','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','findOne','hasOwnProperty','filter','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','getInteractions','Contact','User','Owner','fullname','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','send','getApplications','context','exten','app','system','description','Fax\x20Extension','priority','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','localstationid','gateway','faxdetect','headerinfo','maxrate','minrate','t38timeout','FAXOPT(','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','TrunkId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','CmContact','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','List','Contacts','defaults','ListId','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','omit','spread','emit'];(function(_0x54b09e,_0x2355ad){var _0x3b757a=function(_0x17e173){while(--_0x17e173){_0x54b09e['push'](_0x54b09e['shift']());}};_0x3b757a(++_0x2355ad);}(_0x24d3,0x19a));var _0x324d=function(_0x2a4577,_0x499a65){_0x2a4577=_0x2a4577-0x0;var _0x43e520=_0x24d3[_0x2a4577];return _0x43e520;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x324d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x324d('0x1'));var moment=require(_0x324d('0x2'));var BPromise=require(_0x324d('0x3'));var Mustache=require(_0x324d('0x4'));var util=require('util');var path=require('path');var sox=require(_0x324d('0x5'));var csv=require(_0x324d('0x6'));var ejs=require(_0x324d('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x324d('0x8'));var squel=require('squel');var crypto=require(_0x324d('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x324d('0xa'));var toCsv=require(_0x324d('0x6'));var querystring=require('querystring');var Papa=require(_0x324d('0xb'));var Redis=require(_0x324d('0xc'));var authService=require(_0x324d('0xd'));var qs=require(_0x324d('0xe'));var as=require(_0x324d('0xf'));var hardwareService=require(_0x324d('0x10'));var logger=require(_0x324d('0x11'))(_0x324d('0x12'));var utils=require('../../config/utils');var config=require(_0x324d('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x324d('0x14'))['db'];config[_0x324d('0x15')]=_['defaults'](config[_0x324d('0x15')],{'host':_0x324d('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x324d('0x15')]));require(_0x324d('0x17'))[_0x324d('0x18')](socket);var jayson=require(_0x324d('0x19'));var client=jayson[_0x324d('0x1a')][_0x324d('0x1b')]({'port':0x232c});var client9002=jayson[_0x324d('0x1a')][_0x324d('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x588d0a,_0x53d1e5,_0x255d2c,_0x47e799){return new BPromise(function(_0x4115d9,_0x29f1fb){var _0x3e0769=_0x47e799||client;return _0x3e0769[_0x324d('0x1c')](_0x588d0a,_0x255d2c)['then'](function(_0x138801){logger[_0x324d('0x1d')]('FaxAccount,\x20%s,\x20%s',_0x53d1e5,_0x324d('0x1e'));logger[_0x324d('0x1f')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x53d1e5,'request\x20sent',JSON[_0x324d('0x20')](_0x138801));if(_0x138801[_0x324d('0x21')]){if(_0x138801[_0x324d('0x21')][_0x324d('0x22')]===0x1f4){logger[_0x324d('0x21')](_0x324d('0x23'),_0x53d1e5,_0x138801['error'][_0x324d('0x24')]);return _0x29f1fb(_0x138801['error'][_0x324d('0x24')]);}logger[_0x324d('0x21')](_0x324d('0x23'),_0x53d1e5,_0x138801[_0x324d('0x21')]['message']);return _0x4115d9(_0x138801[_0x324d('0x21')][_0x324d('0x24')]);}else{logger[_0x324d('0x1d')](_0x324d('0x23'),_0x53d1e5,_0x324d('0x1e'));_0x4115d9(_0x138801[_0x324d('0x25')][_0x324d('0x24')]);}})[_0x324d('0x26')](function(_0x64fc6f){logger[_0x324d('0x21')]('FaxAccount,\x20%s,\x20%s',_0x53d1e5,_0x64fc6f);_0x29f1fb(_0x64fc6f);});});}function respondWithStatusCode(_0x1826f1,_0x406b12){_0x406b12=_0x406b12||0xcc;return function(_0x286a2a){if(_0x286a2a){return _0x1826f1[_0x324d('0x27')](_0x406b12);}return _0x1826f1[_0x324d('0x28')](_0x406b12)[_0x324d('0x29')]();};}function respondWithResult(_0x30ed1f,_0x10ac3b){_0x10ac3b=_0x10ac3b||0xc8;return function(_0x5e440d){if(_0x5e440d){return _0x30ed1f[_0x324d('0x28')](_0x10ac3b)['json'](_0x5e440d);}};}function respondWithFilteredResult(_0xe774b,_0x4fc2aa){return function(_0x3b8d39){if(_0x3b8d39){var _0x2858bb=typeof _0x4fc2aa['offset']===_0x324d('0x2a')&&typeof _0x4fc2aa[_0x324d('0x2b')]===_0x324d('0x2a');var _0x578913=_0x3b8d39['count'];var _0x407134=_0x2858bb?0x0:_0x4fc2aa['offset'];var _0x3b1978=_0x2858bb?_0x3b8d39['count']:_0x4fc2aa[_0x324d('0x2c')]+_0x4fc2aa[_0x324d('0x2b')];var _0x4d35c5;if(_0x3b1978>=_0x578913){_0x3b1978=_0x578913;_0x4d35c5=0xc8;}else{_0x4d35c5=0xce;}_0xe774b[_0x324d('0x28')](_0x4d35c5);return _0xe774b[_0x324d('0x2d')](_0x324d('0x2e'),_0x407134+'-'+_0x3b1978+'/'+_0x578913)[_0x324d('0x2f')](_0x3b8d39);}return null;};}function patchUpdates(_0x28dc22){return function(_0x122663){try{jsonpatch[_0x324d('0x30')](_0x122663,_0x28dc22,!![]);}catch(_0x462216){return BPromise[_0x324d('0x31')](_0x462216);}return _0x122663['save']();};}function saveUpdates(_0x3d0793,_0x4f9de0){return function(_0x5ae313){if(_0x5ae313){return _0x5ae313[_0x324d('0x32')](_0x3d0793)[_0x324d('0x33')](function(_0xf3d141){return _0xf3d141;});}return null;};}function removeEntity(_0x5ec48a,_0x2b50b3){return function(_0x22ec90){if(_0x22ec90){return _0x22ec90[_0x324d('0x34')]()['then'](function(){var _0xffadd1=_0x22ec90[_0x324d('0x35')]({'plain':!![]});var _0x26a1fe=_0x324d('0x36');return db[_0x324d('0x37')][_0x324d('0x34')]({'where':{'type':_0x26a1fe,'resourceId':_0xffadd1['id']}})['then'](function(){return _0x22ec90;});})[_0x324d('0x33')](function(){_0x5ec48a[_0x324d('0x28')](0xcc)[_0x324d('0x29')]();});}};}function handleEntityNotFound(_0x50a84a,_0x4146f2){return function(_0x4667fb){if(!_0x4667fb){_0x50a84a[_0x324d('0x27')](0x194);}return _0x4667fb;};}function handleError(_0x489201,_0x3ee61e){_0x3ee61e=_0x3ee61e||0x1f4;return function(_0x34f9a8){logger[_0x324d('0x21')](_0x34f9a8[_0x324d('0x38')]);if(_0x34f9a8[_0x324d('0x39')]){delete _0x34f9a8[_0x324d('0x39')];}_0x489201['status'](_0x3ee61e)['send'](_0x34f9a8);};}exports[_0x324d('0x3a')]=function(_0x153f46,_0x5373ad){var _0x3c5645={'include':[{'model':db[_0x324d('0x3b')],'as':_0x324d('0x3c')}]},_0x4023f3={},_0x18820f={'count':0x0,'rows':[]};var _0x33621c=_[_0x324d('0x3d')](db[_0x324d('0x3e')][_0x324d('0x3f')],function(_0x5bded2){return{'name':_0x5bded2[_0x324d('0x40')],'type':_0x5bded2[_0x324d('0x41')][_0x324d('0x42')]};});_0x4023f3[_0x324d('0x43')]=_[_0x324d('0x3d')](_0x33621c,_0x324d('0x39'));_0x4023f3[_0x324d('0x44')]=_['keys'](_0x153f46[_0x324d('0x44')]);_0x4023f3['filters']=_[_0x324d('0x45')](_0x4023f3[_0x324d('0x43')],_0x4023f3[_0x324d('0x44')]);_0x3c5645['attributes']=_[_0x324d('0x45')](_0x4023f3[_0x324d('0x43')],qs[_0x324d('0x46')](_0x153f46[_0x324d('0x44')]['fields']));_0x3c5645['attributes']=_0x3c5645[_0x324d('0x47')][_0x324d('0x48')]?_0x3c5645['attributes']:_0x4023f3[_0x324d('0x43')];if(!_0x153f46[_0x324d('0x44')]['hasOwnProperty'](_0x324d('0x49'))){_0x3c5645[_0x324d('0x2b')]=qs[_0x324d('0x2b')](_0x153f46[_0x324d('0x44')]['limit']);_0x3c5645['offset']=qs[_0x324d('0x2c')](_0x153f46[_0x324d('0x44')][_0x324d('0x2c')]);}_0x3c5645[_0x324d('0x4a')]=qs[_0x324d('0x4b')](_0x153f46[_0x324d('0x44')][_0x324d('0x4b')]);_0x3c5645[_0x324d('0x4c')]=qs[_0x324d('0x4d')](_[_0x324d('0x4e')](_0x153f46[_0x324d('0x44')],_0x4023f3['filters']),_0x33621c);if(_0x153f46[_0x324d('0x44')]['filter']){_0x3c5645[_0x324d('0x4c')]=_[_0x324d('0x4f')](_0x3c5645[_0x324d('0x4c')],{'$or':_[_0x324d('0x3d')](_0x33621c,function(_0x10018f){if(_0x10018f[_0x324d('0x41')]!==_0x324d('0x50')){var _0x21b087={};_0x21b087[_0x10018f['name']]={'$like':'%'+_0x153f46[_0x324d('0x44')]['filter']+'%'};return _0x21b087;}})});}_0x3c5645=_[_0x324d('0x4f')]({},_0x3c5645,_0x153f46[_0x324d('0x51')]);var _0x4f8d80={'where':_0x3c5645[_0x324d('0x4c')]};return db[_0x324d('0x3e')][_0x324d('0x52')](_0x4f8d80)[_0x324d('0x33')](function(_0x51ae7a){_0x18820f['count']=_0x51ae7a;if(_0x153f46['query'][_0x324d('0x53')]){_0x3c5645[_0x324d('0x54')]=[{'all':!![]}];}return db['FaxAccount'][_0x324d('0x55')](_0x3c5645);})[_0x324d('0x33')](function(_0x145dec){_0x18820f[_0x324d('0x56')]=_0x145dec;return _0x18820f;})[_0x324d('0x33')](respondWithFilteredResult(_0x5373ad,_0x3c5645))[_0x324d('0x26')](handleError(_0x5373ad,null));};exports[_0x324d('0x57')]=function(_0x1b40a2,_0x1dda00){var _0x5e0105={'raw':![],'where':{'id':_0x1b40a2[_0x324d('0x58')]['id']},'include':[{'model':db[_0x324d('0x3b')],'as':'mandatoryDispositionPause'}]},_0x15cb6c={};_0x15cb6c[_0x324d('0x43')]=_['keys'](db[_0x324d('0x3e')][_0x324d('0x3f')]);_0x15cb6c[_0x324d('0x44')]=_[_0x324d('0x59')](_0x1b40a2[_0x324d('0x44')]);_0x15cb6c[_0x324d('0x4d')]=_['intersection'](_0x15cb6c[_0x324d('0x43')],_0x15cb6c[_0x324d('0x44')]);_0x5e0105[_0x324d('0x47')]=_[_0x324d('0x45')](_0x15cb6c[_0x324d('0x43')],qs[_0x324d('0x46')](_0x1b40a2[_0x324d('0x44')][_0x324d('0x46')]));_0x5e0105[_0x324d('0x47')]=_0x5e0105['attributes'][_0x324d('0x48')]?_0x5e0105[_0x324d('0x47')]:_0x15cb6c['model'];if(_0x1b40a2[_0x324d('0x44')][_0x324d('0x53')]){_0x5e0105[_0x324d('0x54')]=[{'all':!![]}];}_0x5e0105=_[_0x324d('0x4f')]({},_0x5e0105,_0x1b40a2[_0x324d('0x51')]);return db[_0x324d('0x3e')]['find'](_0x5e0105)[_0x324d('0x33')](handleEntityNotFound(_0x1dda00,null))[_0x324d('0x33')](respondWithResult(_0x1dda00,null))[_0x324d('0x26')](handleError(_0x1dda00,null));};exports[_0x324d('0x5a')]=function(_0x57d45a,_0x427ec3){return db[_0x324d('0x3e')][_0x324d('0x5a')](_0x57d45a[_0x324d('0x5b')],{})[_0x324d('0x33')](function(_0x2350d7){var _0x3e46f0=_0x57d45a[_0x324d('0x5c')][_0x324d('0x35')]({'plain':!![]});if(!_0x3e46f0)throw new Error(_0x324d('0x5d'));if(_0x3e46f0[_0x324d('0x5e')]===_0x324d('0x5c')){var _0x302cac=_0x2350d7[_0x324d('0x35')]({'plain':!![]});var _0x28e62c=_0x324d('0x36');return db[_0x324d('0x5f')][_0x324d('0x60')]({'where':{'name':_0x28e62c,'userProfileId':_0x3e46f0['userProfileId']},'raw':!![]})[_0x324d('0x33')](function(_0x5ea493){if(_0x5ea493&&_0x5ea493[_0x324d('0x61')]===0x0){return db[_0x324d('0x37')][_0x324d('0x5a')]({'name':_0x302cac['name'],'resourceId':_0x302cac['id'],'type':_0x5ea493[_0x324d('0x39')],'sectionId':_0x5ea493['id']},{})['then'](function(){return _0x2350d7;});}else{return _0x2350d7;}})[_0x324d('0x26')](function(_0x542385){logger[_0x324d('0x21')](_0x324d('0x62'),_0x542385);throw _0x542385;});}return _0x2350d7;})[_0x324d('0x33')](respondWithResult(_0x427ec3,0xc9))[_0x324d('0x26')](handleError(_0x427ec3,null));};exports[_0x324d('0x32')]=function(_0x30c7c4,_0x56f9b4){if(_0x30c7c4[_0x324d('0x5b')]['id']){delete _0x30c7c4[_0x324d('0x5b')]['id'];}return db[_0x324d('0x3e')][_0x324d('0x60')]({'where':{'id':_0x30c7c4['params']['id']},'include':[{'model':db['Pause'],'as':_0x324d('0x3c')}]})['then'](handleEntityNotFound(_0x56f9b4,null))[_0x324d('0x33')](saveUpdates(_0x30c7c4[_0x324d('0x5b')],null))[_0x324d('0x33')](respondWithResult(_0x56f9b4,null))[_0x324d('0x26')](handleError(_0x56f9b4,null));};exports[_0x324d('0x34')]=function(_0x3b2eea,_0x2b3121){return db[_0x324d('0x3e')][_0x324d('0x60')]({'where':{'id':_0x3b2eea['params']['id']}})[_0x324d('0x33')](handleEntityNotFound(_0x2b3121,null))['then'](removeEntity(_0x2b3121,null))[_0x324d('0x26')](handleError(_0x2b3121,null));};exports[_0x324d('0x63')]=function(_0x252154,_0xba319e){return db['FaxAccount']['describe']()[_0x324d('0x33')](respondWithResult(_0xba319e,null))[_0x324d('0x26')](handleError(_0xba319e,null));};exports[_0x324d('0x64')]=function(_0x41c7d6,_0xfe6dfc,_0x2cf07d){if(_0x41c7d6[_0x324d('0x5b')]['id']){delete _0x41c7d6[_0x324d('0x5b')]['id'];}return db[_0x324d('0x3e')]['find']({'where':{'id':_0x41c7d6[_0x324d('0x58')]['id']}})['then'](handleEntityNotFound(_0xfe6dfc,null))[_0x324d('0x33')](function(_0x427ebc){if(_0x427ebc){_0x41c7d6['body'][_0x324d('0x65')]=_0x427ebc['id'];return db[_0x324d('0x66')][_0x324d('0x5a')](_0x41c7d6[_0x324d('0x5b')]);}})[_0x324d('0x33')](respondWithResult(_0xfe6dfc,null))[_0x324d('0x26')](handleError(_0xfe6dfc,null));};exports['getDispositions']=function(_0xcd8a92,_0x33a4dc,_0x3518ab){var _0x948e76={'raw':![],'where':{}};var _0x33906d={};var _0x40e118={'count':0x0,'rows':[]};return db[_0x324d('0x3e')][_0x324d('0x67')]({'where':{'id':_0xcd8a92[_0x324d('0x58')]['id']}})[_0x324d('0x33')](handleEntityNotFound(_0x33a4dc,null))[_0x324d('0x33')](function(_0x57ec15){if(_0x57ec15){_0x33906d[_0x324d('0x43')]=_[_0x324d('0x59')](db[_0x324d('0x66')][_0x324d('0x3f')]);_0x33906d[_0x324d('0x44')]=_[_0x324d('0x59')](_0xcd8a92['query']);_0x33906d[_0x324d('0x4d')]=_[_0x324d('0x45')](_0x33906d[_0x324d('0x43')],_0x33906d['query']);_0x948e76[_0x324d('0x47')]=_[_0x324d('0x45')](_0x33906d[_0x324d('0x43')],qs[_0x324d('0x46')](_0xcd8a92[_0x324d('0x44')][_0x324d('0x46')]));_0x948e76['attributes']=_0x948e76['attributes'][_0x324d('0x48')]?_0x948e76[_0x324d('0x47')]:_0x33906d[_0x324d('0x43')];if(!_0xcd8a92[_0x324d('0x44')][_0x324d('0x68')](_0x324d('0x49'))){_0x948e76[_0x324d('0x2b')]=qs[_0x324d('0x2b')](_0xcd8a92[_0x324d('0x44')][_0x324d('0x2b')]);_0x948e76[_0x324d('0x2c')]=qs[_0x324d('0x2c')](_0xcd8a92[_0x324d('0x44')][_0x324d('0x2c')]);}_0x948e76['order']=qs['sort'](_0xcd8a92[_0x324d('0x44')][_0x324d('0x4b')]);_0x948e76['where']=qs[_0x324d('0x4d')](_['pick'](_0xcd8a92['query'],_0x33906d[_0x324d('0x4d')]));_0x948e76['where'][_0x324d('0x65')]=_0x57ec15['id'];if(_0xcd8a92[_0x324d('0x44')][_0x324d('0x69')]){_0x948e76[_0x324d('0x4c')]=_[_0x324d('0x4f')](_0x948e76[_0x324d('0x4c')],{'$or':_[_0x324d('0x3d')](_0x948e76[_0x324d('0x47')],function(_0x866e57){var _0x3ccbc8={};_0x3ccbc8[_0x866e57]={'$like':'%'+_0xcd8a92[_0x324d('0x44')][_0x324d('0x69')]+'%'};return _0x3ccbc8;})});}_0x948e76=_['merge']({},_0x948e76,_0xcd8a92[_0x324d('0x51')]);return db[_0x324d('0x66')][_0x324d('0x52')]({'where':_0x948e76['where']})[_0x324d('0x33')](function(_0x294b97){_0x40e118['count']=_0x294b97;if(_0xcd8a92[_0x324d('0x44')][_0x324d('0x53')]){_0x948e76[_0x324d('0x54')]=[{'all':!![]}];}return db[_0x324d('0x66')]['findAll'](_0x948e76);})[_0x324d('0x33')](function(_0xf1acaa){_0x40e118[_0x324d('0x56')]=_0xf1acaa;return _0x40e118;});}})[_0x324d('0x33')](respondWithFilteredResult(_0x33a4dc,_0x948e76))['catch'](handleError(_0x33a4dc,null));};exports[_0x324d('0x6a')]=function(_0x31e9d1,_0x10ab38,_0x15b5f6){return db[_0x324d('0x3e')][_0x324d('0x60')]({'where':{'id':_0x31e9d1[_0x324d('0x58')]['id']}})[_0x324d('0x33')](handleEntityNotFound(_0x10ab38,null))[_0x324d('0x33')](function(_0x4dbcd0){if(_0x4dbcd0){return _0x4dbcd0[_0x324d('0x6a')](_0x31e9d1[_0x324d('0x44')][_0x324d('0x6b')]);}})[_0x324d('0x33')](respondWithStatusCode(_0x10ab38,null))[_0x324d('0x26')](handleError(_0x10ab38,null));};exports[_0x324d('0x6c')]=function(_0x2b3fa6,_0x17438f,_0x37d4c){if(_0x2b3fa6[_0x324d('0x5b')]['id']){delete _0x2b3fa6[_0x324d('0x5b')]['id'];}return db[_0x324d('0x3e')]['find']({'where':{'id':_0x2b3fa6[_0x324d('0x58')]['id']}})[_0x324d('0x33')](handleEntityNotFound(_0x17438f,null))[_0x324d('0x33')](function(_0x2cf359){if(_0x2cf359){_0x2b3fa6[_0x324d('0x5b')]['FaxAccountId']=_0x2cf359['id'];return db[_0x324d('0x6d')][_0x324d('0x5a')](_0x2b3fa6[_0x324d('0x5b')]);}})[_0x324d('0x33')](respondWithResult(_0x17438f,null))['catch'](handleError(_0x17438f,null));};exports[_0x324d('0x6e')]=function(_0x1cf620,_0x2fdfef,_0x53b199){var _0x3341f0={'raw':![],'where':{}};var _0x51f813={};var _0x2d2189={'count':0x0,'rows':[]};return db[_0x324d('0x3e')][_0x324d('0x67')]({'where':{'id':_0x1cf620['params']['id']}})['then'](handleEntityNotFound(_0x2fdfef,null))[_0x324d('0x33')](function(_0x4fb82e){if(_0x4fb82e){_0x51f813[_0x324d('0x43')]=_[_0x324d('0x59')](db[_0x324d('0x6d')]['rawAttributes']);_0x51f813[_0x324d('0x44')]=_[_0x324d('0x59')](_0x1cf620['query']);_0x51f813[_0x324d('0x4d')]=_['intersection'](_0x51f813[_0x324d('0x43')],_0x51f813[_0x324d('0x44')]);_0x3341f0[_0x324d('0x47')]=_[_0x324d('0x45')](_0x51f813[_0x324d('0x43')],qs['fields'](_0x1cf620[_0x324d('0x44')][_0x324d('0x46')]));_0x3341f0[_0x324d('0x47')]=_0x3341f0[_0x324d('0x47')][_0x324d('0x48')]?_0x3341f0[_0x324d('0x47')]:_0x51f813[_0x324d('0x43')];if(!_0x1cf620[_0x324d('0x44')][_0x324d('0x68')](_0x324d('0x49'))){_0x3341f0[_0x324d('0x2b')]=qs[_0x324d('0x2b')](_0x1cf620[_0x324d('0x44')]['limit']);_0x3341f0[_0x324d('0x2c')]=qs[_0x324d('0x2c')](_0x1cf620[_0x324d('0x44')][_0x324d('0x2c')]);}_0x3341f0['order']=qs[_0x324d('0x4b')](_0x1cf620[_0x324d('0x44')][_0x324d('0x4b')]);_0x3341f0[_0x324d('0x4c')]=qs[_0x324d('0x4d')](_['pick'](_0x1cf620['query'],_0x51f813[_0x324d('0x4d')]));_0x3341f0[_0x324d('0x4c')]['FaxAccountId']=_0x4fb82e['id'];if(_0x1cf620[_0x324d('0x44')][_0x324d('0x69')]){_0x3341f0['where']=_[_0x324d('0x4f')](_0x3341f0[_0x324d('0x4c')],{'$or':_[_0x324d('0x3d')](_0x3341f0['attributes'],function(_0x40fba0){var _0x57881a={};_0x57881a[_0x40fba0]={'$like':'%'+_0x1cf620[_0x324d('0x44')][_0x324d('0x69')]+'%'};return _0x57881a;})});}_0x3341f0=_[_0x324d('0x4f')]({},_0x3341f0,_0x1cf620[_0x324d('0x51')]);return db[_0x324d('0x6d')][_0x324d('0x52')]({'where':_0x3341f0[_0x324d('0x4c')]})[_0x324d('0x33')](function(_0x46218e){_0x2d2189[_0x324d('0x52')]=_0x46218e;if(_0x1cf620['query'][_0x324d('0x53')]){_0x3341f0[_0x324d('0x54')]=[{'all':!![]}];}return db[_0x324d('0x6d')][_0x324d('0x55')](_0x3341f0);})[_0x324d('0x33')](function(_0x433e95){_0x2d2189[_0x324d('0x56')]=_0x433e95;return _0x2d2189;});}})[_0x324d('0x33')](respondWithFilteredResult(_0x2fdfef,_0x3341f0))[_0x324d('0x26')](handleError(_0x2fdfef,null));};exports['removeAnswers']=function(_0x508cd2,_0x203cdc,_0x45ce08){return db['FaxAccount']['find']({'where':{'id':_0x508cd2[_0x324d('0x58')]['id']}})[_0x324d('0x33')](handleEntityNotFound(_0x203cdc,null))[_0x324d('0x33')](function(_0x2c2c86){if(_0x2c2c86){return _0x2c2c86[_0x324d('0x6f')](_0x508cd2[_0x324d('0x44')][_0x324d('0x6b')]);}})['then'](respondWithStatusCode(_0x203cdc,null))[_0x324d('0x26')](handleError(_0x203cdc,null));};exports[_0x324d('0x70')]=function(_0xb04174,_0x4924cd,_0x49cc1f){return db[_0x324d('0x71')][_0x324d('0x60')]({'where':{'id':_0xb04174[_0x324d('0x58')]['id']}})[_0x324d('0x33')](handleEntityNotFound(_0x4924cd,null))[_0x324d('0x33')](function(_0xa5d619){if(_0xa5d619){return _0xa5d619['addInteraction'](_0xb04174['body'][_0x324d('0x6b')],_['omit'](_0xb04174['body'],[_0x324d('0x6b'),'id'])||{});}})[_0x324d('0x33')](respondWithResult(_0x4924cd,null))[_0x324d('0x26')](handleError(_0x4924cd,null));};exports[_0x324d('0x72')]=function(_0x2979de,_0x59c209,_0x4a62eb){var _0x214b1f={'raw':![],'where':{}};var _0x32efd7={};var _0x5dc79e={'count':0x0,'rows':[]};return db[_0x324d('0x3e')][_0x324d('0x67')]({'where':{'id':_0x2979de[_0x324d('0x58')]['id']}})['then'](handleEntityNotFound(_0x59c209,null))[_0x324d('0x33')](function(_0x4214ec){if(_0x4214ec){_0x32efd7[_0x324d('0x43')]=_[_0x324d('0x59')](db[_0x324d('0x71')][_0x324d('0x3f')]);_0x32efd7[_0x324d('0x44')]=_[_0x324d('0x59')](_0x2979de[_0x324d('0x44')]);_0x32efd7['filters']=_[_0x324d('0x45')](_0x32efd7[_0x324d('0x43')],_0x32efd7[_0x324d('0x44')]);_0x214b1f[_0x324d('0x47')]=_[_0x324d('0x45')](_0x32efd7[_0x324d('0x43')],qs['fields'](_0x2979de['query'][_0x324d('0x46')]));_0x214b1f[_0x324d('0x47')]=_0x214b1f[_0x324d('0x47')][_0x324d('0x48')]?_0x214b1f['attributes']:_0x32efd7[_0x324d('0x43')];if(!_0x2979de[_0x324d('0x44')][_0x324d('0x68')](_0x324d('0x49'))){_0x214b1f['limit']=qs[_0x324d('0x2b')](_0x2979de['query']['limit']);_0x214b1f[_0x324d('0x2c')]=qs[_0x324d('0x2c')](_0x2979de[_0x324d('0x44')][_0x324d('0x2c')]);}_0x214b1f['order']=qs[_0x324d('0x4b')](_0x2979de[_0x324d('0x44')]['sort']);_0x214b1f[_0x324d('0x4c')]=qs[_0x324d('0x4d')](_['pick'](_0x2979de[_0x324d('0x44')],_0x32efd7[_0x324d('0x4d')]));_0x214b1f[_0x324d('0x4c')][_0x324d('0x65')]=_0x4214ec['id'];if(_0x2979de['query'][_0x324d('0x69')]){_0x214b1f[_0x324d('0x4c')]=_[_0x324d('0x4f')](_0x214b1f[_0x324d('0x4c')],{'$or':_[_0x324d('0x3d')](_0x214b1f[_0x324d('0x47')],function(_0x419cfc){var _0xab0d32={};_0xab0d32[_0x419cfc]={'$like':'%'+_0x2979de[_0x324d('0x44')][_0x324d('0x69')]+'%'};return _0xab0d32;})});}_0x214b1f=_[_0x324d('0x4f')]({},_0x214b1f,_0x2979de[_0x324d('0x51')]);return db['FaxInteraction'][_0x324d('0x52')]({'where':_0x214b1f[_0x324d('0x4c')]})[_0x324d('0x33')](function(_0x15f61d){_0x5dc79e['count']=_0x15f61d;if(_0x2979de[_0x324d('0x44')][_0x324d('0x53')]){_0x214b1f[_0x324d('0x54')]=[{'model':db['CmContact'],'as':_0x324d('0x73'),'required':![]},{'model':db[_0x324d('0x74')],'as':_0x324d('0x75'),'attributes':[_0x324d('0x39'),_0x324d('0x76'),'internal'],'required':![]},{'model':db[_0x324d('0x77')],'as':_0x324d('0x78'),'attributes':['id',_0x324d('0x39'),_0x324d('0x79')],'where':_0x2979de[_0x324d('0x44')][_0x324d('0x7a')]?{'id':_0x2979de[_0x324d('0x44')][_0x324d('0x7a')]}:undefined,'required':_0x2979de['query'][_0x324d('0x7a')]?!![]:![]}];}return db[_0x324d('0x71')][_0x324d('0x55')](_0x214b1f);})['then'](function(_0x3d8c76){_0x5dc79e[_0x324d('0x56')]=_0x3d8c76;return _0x5dc79e;});}})[_0x324d('0x33')](respondWithFilteredResult(_0x59c209,_0x214b1f))[_0x324d('0x26')](handleError(_0x59c209,null));};exports[_0x324d('0x7b')]=function(_0x285fac,_0x2bbf5d){var _0x79bff=_0x285fac[_0x324d('0x58')]['id'];var _0x18da96=_0x285fac[_0x324d('0x5b')];var _0x3d6214=0xc8;var _0x393ef0=null;return db[_0x324d('0x7c')][_0x324d('0x7d')]({'isolationLevel':db[_0x324d('0x7c')][_0x324d('0x7e')][_0x324d('0x7f')][_0x324d('0x80')]},function(_0x24fa05){return db['FaxAccount']['findOne']({'where':{'id':_0x79bff},'transaction':_0x24fa05})[_0x324d('0x33')](function(_0x5b7d1c){if(_0x5b7d1c){return db[_0x324d('0x81')][_0x324d('0x34')]({'where':{'FaxAccountId':_0x79bff},'transaction':_0x24fa05})[_0x324d('0x33')](function(){var _0x280ef6=_['map'](_0x18da96,function(_0x3519c9){_0x3519c9['FaxAccountId']=_0x79bff;return _0x3519c9;});return db[_0x324d('0x81')][_0x324d('0x82')](_0x280ef6,{'transaction':_0x24fa05});});}else{_0x3d6214=0x194;_0x393ef0=[];}});})['then'](function(){if(_0x3d6214!==0x194){return db[_0x324d('0x81')][_0x324d('0x83')]({'where':{'FaxAccountId':_0x79bff},'order':'priority'})[_0x324d('0x33')](function(_0x326320){_0x393ef0=_0x326320;});}})[_0x324d('0x26')](function(_0x45f854){_0x3d6214=0x1f4;logger['error'](_0x45f854[_0x324d('0x38')]);if(_0x45f854[_0x324d('0x39')]){delete _0x45f854['name'];}_0x393ef0=_0x45f854;})['finally'](function(){if(_0x393ef0===null){_0x2bbf5d['sendStatus'](_0x3d6214);}else{if(_0x3d6214===0x1f4){_0x2bbf5d[_0x324d('0x28')](_0x3d6214)[_0x324d('0x84')](_0x393ef0);}else{_0x2bbf5d['status'](_0x3d6214)[_0x324d('0x2f')](_0x393ef0);}}});};exports[_0x324d('0x85')]=function(_0x2c2593,_0x52f2d4,_0x4f53ff){var _0x54fce1={};var _0x5b7d18={};var _0x2a2791;var _0x4a71d6;return db['FaxAccount']['findOne']({'where':{'id':_0x2c2593[_0x324d('0x58')]['id']}})['then'](handleEntityNotFound(_0x52f2d4,null))[_0x324d('0x33')](function(_0x5e6575){if(_0x5e6575){_0x2a2791=_0x5e6575;_0x5b7d18[_0x324d('0x43')]=_[_0x324d('0x59')](db[_0x324d('0x81')][_0x324d('0x3f')]);_0x5b7d18['query']=_['keys'](_0x2c2593['query']);_0x5b7d18['filters']=_[_0x324d('0x45')](_0x5b7d18['model'],_0x5b7d18['query']);_0x54fce1[_0x324d('0x47')]=_['intersection'](_0x5b7d18[_0x324d('0x43')],qs[_0x324d('0x46')](_0x2c2593['query'][_0x324d('0x46')]));_0x54fce1[_0x324d('0x47')]=_0x54fce1['attributes'][_0x324d('0x48')]?_0x54fce1[_0x324d('0x47')]:_0x5b7d18[_0x324d('0x43')];_0x54fce1['order']=qs['sort'](_0x2c2593[_0x324d('0x44')][_0x324d('0x4b')]);_0x54fce1['where']=qs[_0x324d('0x4d')](_[_0x324d('0x4e')](_0x2c2593[_0x324d('0x44')],_0x5b7d18[_0x324d('0x4d')]));if(_0x2c2593[_0x324d('0x44')][_0x324d('0x69')]){_0x54fce1['where']=_[_0x324d('0x4f')](_0x54fce1[_0x324d('0x4c')],{'$or':_[_0x324d('0x3d')](_0x54fce1[_0x324d('0x47')],function(_0x1642ca){var _0x5d6543={};_0x5d6543[_0x1642ca]={'$like':'%'+_0x2c2593[_0x324d('0x44')][_0x324d('0x69')]+'%'};return _0x5d6543;})});}_0x54fce1=_[_0x324d('0x4f')]({},_0x54fce1,_0x2c2593[_0x324d('0x51')]);return _0x2a2791[_0x324d('0x85')](_0x54fce1);}})[_0x324d('0x33')](function(_0x2842af){if(_0x2842af){_0x4a71d6=_0x2842af[_0x324d('0x48')];if(!_0x2c2593['query']['hasOwnProperty'](_0x324d('0x49'))){_0x54fce1[_0x324d('0x2b')]=qs['limit'](_0x2c2593[_0x324d('0x44')][_0x324d('0x2b')]);_0x54fce1[_0x324d('0x2c')]=qs[_0x324d('0x2c')](_0x2c2593[_0x324d('0x44')][_0x324d('0x2c')]);}return _0x2a2791[_0x324d('0x85')](_0x54fce1);}})[_0x324d('0x33')](function(_0x34b99e){if(_0x34b99e){return _0x34b99e?{'count':_0x4a71d6,'rows':_0x34b99e}:null;}})[_0x324d('0x33')](respondWithResult(_0x52f2d4,null))[_0x324d('0x26')](handleError(_0x52f2d4,null));};function Extension(_0x59dd0f,_0x15af6e,_0x14140b,_0xfdc29b){this[_0x324d('0x86')]='from-voip-provider';this[_0x324d('0x87')]=_0x59dd0f['localstationid'];this[_0x324d('0x88')]=_0xfdc29b;this[_0x324d('0x41')]=_0x324d('0x89');this[_0x324d('0x8a')]=_0x324d('0x8b');this[_0x324d('0x65')]=_0x59dd0f['id'];this[_0x324d('0x8c')]=_0x15af6e;this[_0x324d('0x8d')]=_0x14140b;}function createExtensionsReciveFax(_0x29b56c){var _0x33013e=0x1;var _0x1404fb=[];_0x1404fb[_0x324d('0x8e')](new Extension(_0x29b56c,_0x33013e,'',_0x324d('0x8f')));_0x33013e+=0x1;_0x1404fb[_0x324d('0x8e')](new Extension(_0x29b56c,_0x33013e,_0x324d('0x90'),_0x324d('0x91')));_0x33013e+=0x1;for(var _0x571bf1 in _0x29b56c){if(_0x29b56c[_0x324d('0x68')](_0x571bf1)&&(_0x571bf1===_0x324d('0x92')||_0x571bf1===_0x324d('0x93')||_0x571bf1===_0x324d('0x94')||_0x571bf1===_0x324d('0x95')||_0x571bf1===_0x324d('0x96')||_0x571bf1===_0x324d('0x97')||_0x571bf1===_0x324d('0x98')||_0x571bf1==='modem'||_0x571bf1===_0x324d('0x99'))){_0x1404fb[_0x324d('0x8e')](new Extension(_0x29b56c,_0x33013e,_0x324d('0x9a')+_0x571bf1+')='+_0x29b56c[_0x571bf1],_0x324d('0x91')));_0x33013e+=0x1;}}_0x1404fb['push'](new Extension(_0x29b56c,_0x33013e,'6','Wait'));_0x33013e+=0x1;_0x1404fb[_0x324d('0x8e')](new Extension(_0x29b56c,_0x33013e,'/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',_0x324d('0x9b')));_0x33013e=0x0;return _0x1404fb;}exports[_0x324d('0x9c')]=function(_0x1f6887,_0x44ebf6,_0x4863d1){var _0x2b1ed7;return db[_0x324d('0x7c')][_0x324d('0x7d')](function(_0x2fee39){return db[_0x324d('0x3e')][_0x324d('0x5a')](_0x1f6887['body'],{'transaction':_0x2fee39})['then'](function(_0x566309){_0x2b1ed7=_0x566309[_0x324d('0x35')]({'plain':!![]});return db[_0x324d('0x9d')][_0x324d('0x82')](createExtensionsReciveFax(_0x2b1ed7),{'transaction':_0x2fee39});});})[_0x324d('0x33')](function(){return _0x2b1ed7;})[_0x324d('0x33')](respondWithResult(_0x44ebf6,null))[_0x324d('0x26')](handleError(_0x44ebf6,null));};exports[_0x324d('0x9e')]=function(_0x30b980,_0x244a9b,_0x1e71d8){var _0x12e52c;return db['sequelize']['transaction'](function(_0x289093){return db[_0x324d('0x3e')][_0x324d('0x32')](_0x30b980[_0x324d('0x5b')],{'where':{'id':_0x30b980[_0x324d('0x5b')]['id']},'transaction':_0x289093})['then'](function(_0xfa11fa){return db[_0x324d('0x9d')][_0x324d('0x34')]({'where':{'FaxAccountId':_0x30b980[_0x324d('0x5b')]['id']},'transaction':_0x289093})['then'](function(_0x266e9b){return db['VoiceExtension'][_0x324d('0x82')](createExtensionsReciveFax(_['omit'](_0x30b980[_0x324d('0x5b')],[_0x324d('0x9f'),'key',_0x324d('0xa0'),_0x324d('0xa1'),_0x324d('0xa2'),'ListId'])),{'transaction':_0x289093});});});})[_0x324d('0x33')](function(){return db[_0x324d('0x3e')][_0x324d('0xa3')](_0x30b980['body']['id']);})[_0x324d('0x33')](respondWithResult(_0x244a9b,null))[_0x324d('0x26')](handleError(_0x244a9b,null));};exports[_0x324d('0xa4')]=function(_0x5f53cb,_0x1233eb,_0x3de4f1){var _0x4b2f8b={'raw':!![],'where':{}};var _0x1431ed={};var _0x4fca70={'count':0x0,'rows':[]};return db[_0x324d('0x3e')][_0x324d('0x67')]({'where':{'id':_0x5f53cb[_0x324d('0x58')]['id']}})['then'](handleEntityNotFound(_0x1233eb,null))[_0x324d('0x33')](function(_0x222a0f){if(_0x222a0f){_0x1431ed['model']=_[_0x324d('0x59')](db[_0x324d('0xa5')][_0x324d('0x3f')]);_0x1431ed[_0x324d('0x44')]=_[_0x324d('0x59')](_0x5f53cb['query']);_0x1431ed[_0x324d('0x4d')]=_[_0x324d('0x45')](_0x1431ed[_0x324d('0x43')],_0x1431ed[_0x324d('0x44')]);_0x4b2f8b[_0x324d('0x47')]=_[_0x324d('0x45')](_0x1431ed[_0x324d('0x43')],qs['fields'](_0x5f53cb[_0x324d('0x44')][_0x324d('0x46')]));_0x4b2f8b[_0x324d('0x47')]=_0x4b2f8b[_0x324d('0x47')]['length']?_0x4b2f8b[_0x324d('0x47')]:_0x1431ed[_0x324d('0x43')];if(!_0x5f53cb[_0x324d('0x44')][_0x324d('0x68')](_0x324d('0x49'))){_0x4b2f8b[_0x324d('0x2b')]=qs[_0x324d('0x2b')](_0x5f53cb[_0x324d('0x44')][_0x324d('0x2b')]);_0x4b2f8b[_0x324d('0x2c')]=qs[_0x324d('0x2c')](_0x5f53cb[_0x324d('0x44')][_0x324d('0x2c')]);}_0x4b2f8b[_0x324d('0x4a')]=qs[_0x324d('0x4b')](_0x5f53cb[_0x324d('0x44')][_0x324d('0x4b')]);_0x4b2f8b['where']=qs[_0x324d('0x4d')](_[_0x324d('0x4e')](_0x5f53cb[_0x324d('0x44')],_0x1431ed['filters']));_0x4b2f8b['where'][_0x324d('0x65')]=_0x222a0f['id'];if(_0x5f53cb['query'][_0x324d('0x69')]){_0x4b2f8b['where']=_[_0x324d('0x4f')](_0x4b2f8b[_0x324d('0x4c')],{'$or':_['map'](_0x4b2f8b[_0x324d('0x47')],function(_0x5801d4){var _0x4145f5={};_0x4145f5[_0x5801d4]={'$like':'%'+_0x5f53cb[_0x324d('0x44')][_0x324d('0x69')]+'%'};return _0x4145f5;})});}if(_0x5f53cb[_0x324d('0x44')][_0x324d('0xa6')]){var _0x3e4adf=_0x5f53cb[_0x324d('0x44')][_0x324d('0xa6')][_0x324d('0xa7')](',');var _0x36b0b3={};_0x36b0b3[_0x3e4adf[0x0]]={'$gte':moment(_0x3e4adf[0x1])[_0x324d('0xa8')](_0x324d('0xa9'))};_0x4b2f8b['where']=_[_0x324d('0x4f')](_0x4b2f8b[_0x324d('0x4c')],_0x36b0b3);}_0x4b2f8b=_[_0x324d('0x4f')]({},_0x4b2f8b,_0x5f53cb[_0x324d('0x51')]);return db[_0x324d('0xa5')][_0x324d('0x52')]({'where':_0x4b2f8b['where']})['then'](function(_0x513261){_0x4fca70[_0x324d('0x52')]=_0x513261;if(_0x5f53cb[_0x324d('0x44')][_0x324d('0x53')]){_0x4b2f8b[_0x324d('0x54')]=[{'all':!![]}];}return db['FaxMessage'][_0x324d('0x55')](_0x4b2f8b);})[_0x324d('0x33')](function(_0x4d9ac4){_0x4fca70['rows']=_0x4d9ac4;return _0x4fca70;});}})[_0x324d('0x33')](respondWithFilteredResult(_0x1233eb,_0x4b2f8b))[_0x324d('0x26')](handleError(_0x1233eb,null));};exports['send']=function(_0x2bde86,_0x3831e8,_0x5a089a){var _0xb8cd1f,_0x1b8a05={},_0x1819aa;if(_0x2bde86[_0x324d('0x5b')]['to']){_0x1819aa=_0x2bde86['body']['to'][0x0];}return db[_0x324d('0x3e')][_0x324d('0x60')]({'where':{'id':_0x2bde86[_0x324d('0x58')]['id']},'include':[{'model':db[_0x324d('0xaa')],'as':'List','include':[{'model':db[_0x324d('0xab')],'as':'Contacts','where':{'fax':_0x1819aa},'limit':0x1,'order':[[_0x324d('0xa1'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x3831e8,null))[_0x324d('0x33')](function(_0x22c32b){_0xb8cd1f=_0x22c32b;if(_0x2bde86[_0x324d('0x5b')][_0x324d('0xac')]&&_0x2bde86['body'][_0x324d('0xac')][_0x324d('0x48')]){for(var _0x429609=0x0;_0x429609<_0x2bde86[_0x324d('0x5b')][_0x324d('0xac')][_0x324d('0x48')];_0x429609+=0x1){_0x2bde86[_0x324d('0x5b')][_0x324d('0xac')][_0x429609]={'filename':_0x2bde86[_0x324d('0x5b')][_0x324d('0xac')][_0x429609][_0x324d('0x39')],'id':_0x2bde86[_0x324d('0x5b')][_0x324d('0xac')][_0x429609]['id'],'path':path[_0x324d('0xad')](config[_0x324d('0xae')],_0x324d('0xaf'),_0x2bde86[_0x324d('0x5b')][_0x324d('0xac')][_0x429609][_0x324d('0xb0')])};}}return respondWithRpcPromise(_0x324d('0xb1'),_0x324d('0xb1'),{'FaxAccountId':_['isNil'](_0x2bde86[_0x324d('0x58')]['id'])?undefined:_0x2bde86[_0x324d('0x58')]['id'],'path':_[_0x324d('0xb2')](_0x2bde86[_0x324d('0x5b')][_0x324d('0xac')][0x0][_0x324d('0xb3')])?undefined:_0x2bde86[_0x324d('0x5b')][_0x324d('0xac')][0x0]['path'],'fax':_['isNil'](_0x2bde86[_0x324d('0x5b')]['to'][0x0])?undefined:_0x2bde86[_0x324d('0x5b')]['to'][0x0]},client9002);})[_0x324d('0x33')](function(){if(_0xb8cd1f){if(_[_0x324d('0xb2')](_0x2bde86['body'][_0x324d('0xb4')])){_0x2bde86[_0x324d('0x5b')][_0x324d('0xb4')]=util[_0x324d('0xa8')](_0x324d('0xb5'),_0xb8cd1f[_0x324d('0x39')],_0xb8cd1f[_0x324d('0xb6')]);}if(_0xb8cd1f[_0x324d('0xb7')]){if(_0xb8cd1f[_0x324d('0xb7')][_0x324d('0xb8')]['length']){return _0xb8cd1f['List'][_0x324d('0xb8')][0x0];}else{return db[_0x324d('0xab')][_0x324d('0x5a')](_[_0x324d('0xb9')](_0x2bde86['body'],{'firstName':_0x2bde86[_0x324d('0x5b')]['to'][0x0],'phone':_0x2bde86[_0x324d('0x5b')]['to'][0x0],'fax':_0x2bde86[_0x324d('0x5b')]['to'][0x0],'ListId':_0xb8cd1f[_0x324d('0xba')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x324d('0xbb'));}})['then'](function(_0x49a0dd){if(_0x49a0dd){return db[_0x324d('0x71')][_0x324d('0x60')]({'where':{'ContactId':_0x49a0dd['id'],'closed':![],'FaxAccountId':_0xb8cd1f['id']}})[_0x324d('0x33')](function(_0x50e73b){if(_0x50e73b){return[_0x50e73b,![]];}return db[_0x324d('0x71')][_0x324d('0x5a')]({'UserId':_0x2bde86[_0x324d('0x5c')]['id'],'ContactId':_0x49a0dd['id'],'FaxAccountId':_0xb8cd1f['id'],'fax':_0x2bde86[_0x324d('0x5b')]['to'][0x0],'firstMsgDirection':_0x324d('0xbc'),'Messages':[_[_0x324d('0x4f')](_0x2bde86[_0x324d('0x5b')],{'read':![],'body':_0x2bde86['body'][_0x324d('0xac')][0x0][_0x324d('0xbd')],'FaxAccountId':_0xb8cd1f['id'],'UserId':_0x2bde86['user']['id'],'ContactId':_0x49a0dd['id'],'AttachmentId':_0x2bde86['body'][_0x324d('0xac')][0x0]['id']})]},{'include':[{'model':db[_0x324d('0xa5')],'as':_0x324d('0xbe')}]})[_0x324d('0x33')](function(_0x51b81e){return[_0x51b81e,!![]];});});}else{throw new Error(_0x324d('0xbf'));}})['spread'](function(_0x5baa3a,_0x5ee6d7){if(_0x5ee6d7){return _0x5baa3a;}return db['FaxMessage'][_0x324d('0x5a')]({'direction':_0x324d('0xbc'),'read':![],'body':_0x2bde86['body'][_0x324d('0xac')][0x0][_0x324d('0xbd')],'FaxAccountId':_0xb8cd1f['id'],'FaxInteractionId':_0x5baa3a['id'],'UserId':_0x2bde86[_0x324d('0x5c')]['id'],'ContactId':_0x5baa3a['ContactId'],'AttachmentId':_0x2bde86[_0x324d('0x5b')][_0x324d('0xac')][0x0]['id']})[_0x324d('0x33')](function(_0x1ac658){_0x5baa3a[_0x324d('0xc0')][_0x324d('0xbe')]=[];_0x5baa3a['dataValues']['Messages']['push'](_0x1ac658[_0x324d('0xc0')]);return _0x5baa3a;});})[_0x324d('0x33')](function(_0x26a5f5){respondWithRpcPromise('SendFax',_0x324d('0xc1'),{'FaxAccountId':_['isNil'](_0x2bde86[_0x324d('0x58')]['id'])?undefined:_0x2bde86[_0x324d('0x58')]['id'],'path':_['isNil'](_0x2bde86['body']['attachments'][0x0][_0x324d('0xb3')])?undefined:_0x2bde86[_0x324d('0x5b')][_0x324d('0xac')][0x0][_0x324d('0xb3')],'fax':_[_0x324d('0xb2')](_0x2bde86[_0x324d('0x5b')]['to'][0x0])?undefined:_0x2bde86[_0x324d('0x5b')]['to'][0x0],'AttachmentId':_0x2bde86[_0x324d('0x5b')][_0x324d('0xac')][0x0]['id']},client9002)[_0x324d('0x33')](function(_0x21b7ce){logger['info'](_0x324d('0xc2'),_0x21b7ce);})[_0x324d('0x26')](function(_0x4c5319){logger['info']('SendFaxRpc,\x20%s',_0x4c5319);});return _0x26a5f5;})[_0x324d('0x33')](respondWithResult(_0x3831e8,null))['catch'](handleError(_0x3831e8,null));};exports[_0x324d('0xc3')]=function(_0x1a3495,_0x4e66c2,_0xe44828){return db[_0x324d('0x3e')][_0x324d('0x60')]({'where':{'id':_0x1a3495[_0x324d('0x58')]['id']}})[_0x324d('0x33')](handleEntityNotFound(_0x4e66c2,null))[_0x324d('0x33')](function(_0x55be3e){if(_0x55be3e){return _0x55be3e[_0x324d('0xc3')](_0x1a3495[_0x324d('0x5b')][_0x324d('0x6b')],_[_0x324d('0xc4')](_0x1a3495[_0x324d('0x5b')],[_0x324d('0x6b'),'id'])||{})[_0x324d('0xc5')](function(_0xb07db){for(var _0x2f655a=0x0;_0x2f655a<_0x1a3495['body'][_0x324d('0x6b')]['length'];_0x2f655a+=0x1){socket[_0x324d('0xc6')](_0x324d('0xc7'),{'UserId':Number(_0x1a3495[_0x324d('0x5b')][_0x324d('0x6b')][_0x2f655a]),'FaxAccountId':Number(_0x1a3495[_0x324d('0x58')]['id'])});}return _0xb07db;});}})[_0x324d('0x33')](respondWithResult(_0x4e66c2,null))['catch'](handleError(_0x4e66c2,null));};exports[_0x324d('0xc8')]=function(_0x45ca3c,_0x33c207,_0x2ee60f){return db['FaxAccount'][_0x324d('0x60')]({'where':{'id':_0x45ca3c[_0x324d('0x58')]['id']}})[_0x324d('0x33')](handleEntityNotFound(_0x33c207,null))[_0x324d('0x33')](function(_0x4b1e6e){if(_0x4b1e6e){return _0x4b1e6e['removeAgents'](_0x45ca3c[_0x324d('0x44')]['ids'])['then'](function(){if(_['isArray'](_0x45ca3c['query'][_0x324d('0x6b')])){for(var _0x53ab53=0x0;_0x53ab53<_0x45ca3c[_0x324d('0x44')][_0x324d('0x6b')][_0x324d('0x48')];_0x53ab53+=0x1){socket[_0x324d('0xc6')]('userFaxAccount:remove',{'UserId':Number(_0x45ca3c['query'][_0x324d('0x6b')][_0x53ab53]),'FaxAccountId':Number(_0x45ca3c['params']['id'])});}}else{socket[_0x324d('0xc6')](_0x324d('0xc9'),{'UserId':Number(_0x45ca3c[_0x324d('0x44')][_0x324d('0x6b')]),'FaxAccountId':Number(_0x45ca3c[_0x324d('0x58')]['id'])});}});}})['then'](respondWithStatusCode(_0x33c207,null))['catch'](handleError(_0x33c207,null));};exports[_0x324d('0xca')]=function(_0xc04d66,_0x51d873,_0x1660d2){var _0x262fd5={};var _0x597698={};var _0x17ba6c;var _0x697e27;return db[_0x324d('0x3e')][_0x324d('0x67')]({'where':{'id':_0xc04d66['params']['id']}})[_0x324d('0x33')](handleEntityNotFound(_0x51d873,null))[_0x324d('0x33')](function(_0x423165){if(_0x423165){_0x17ba6c=_0x423165;_0x597698[_0x324d('0x43')]=_[_0x324d('0x59')](db[_0x324d('0x74')]['rawAttributes']);_0x597698[_0x324d('0x44')]=_['keys'](_0xc04d66[_0x324d('0x44')]);_0x597698[_0x324d('0x4d')]=_[_0x324d('0x45')](_0x597698['model'],_0x597698[_0x324d('0x44')]);_0x262fd5[_0x324d('0x47')]=_[_0x324d('0x45')](_0x597698[_0x324d('0x43')],qs['fields'](_0xc04d66['query'][_0x324d('0x46')]));_0x262fd5['attributes']=_0x262fd5[_0x324d('0x47')]['length']?_0x262fd5[_0x324d('0x47')]:_0x597698[_0x324d('0x43')];_0x262fd5[_0x324d('0x4a')]=qs[_0x324d('0x4b')](_0xc04d66['query'][_0x324d('0x4b')]);_0x262fd5[_0x324d('0x4c')]=qs[_0x324d('0x4d')](_['pick'](_0xc04d66[_0x324d('0x44')],_0x597698[_0x324d('0x4d')]));if(_0xc04d66['query']['filter']){_0x262fd5[_0x324d('0x4c')]=_[_0x324d('0x4f')](_0x262fd5[_0x324d('0x4c')],{'$or':_[_0x324d('0x3d')](_0x262fd5[_0x324d('0x47')],function(_0x21c5c6){var _0xce681d={};_0xce681d[_0x21c5c6]={'$like':'%'+_0xc04d66[_0x324d('0x44')]['filter']+'%'};return _0xce681d;})});}_0x262fd5=_[_0x324d('0x4f')]({},_0x262fd5,_0xc04d66[_0x324d('0x51')]);return _0x17ba6c['getAgents'](_0x262fd5);}})[_0x324d('0x33')](function(_0x1cfbee){if(_0x1cfbee){_0x697e27=_0x1cfbee['length'];if(!_0xc04d66[_0x324d('0x44')][_0x324d('0x68')](_0x324d('0x49'))){_0x262fd5[_0x324d('0x2b')]=qs['limit'](_0xc04d66[_0x324d('0x44')][_0x324d('0x2b')]);_0x262fd5[_0x324d('0x2c')]=qs[_0x324d('0x2c')](_0xc04d66[_0x324d('0x44')][_0x324d('0x2c')]);}return _0x17ba6c[_0x324d('0xca')](_0x262fd5);}})[_0x324d('0x33')](function(_0x5c5536){if(_0x5c5536){return _0x5c5536?{'count':_0x697e27,'rows':_0x5c5536}:null;}})[_0x324d('0x33')](respondWithResult(_0x51d873,null))[_0x324d('0x26')](handleError(_0x51d873,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 793734e..9ee7bf2 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 _0x68c7=['hasOwnProperty','exports','events','../../mysqldb','emit'];(function(_0x194a62,_0x2353a4){var _0x2d9c00=function(_0x1e46f0){while(--_0x1e46f0){_0x194a62['push'](_0x194a62['shift']());}};_0x2d9c00(++_0x2353a4);}(_0x68c7,0x192));var _0x768c=function(_0x4edbfc,_0x31dc32){_0x4edbfc=_0x4edbfc-0x0;var _0x245061=_0x68c7[_0x4edbfc];return _0x245061;};'use strict';var EventEmitter=require(_0x768c('0x0'));var FaxAccount=require(_0x768c('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xe1e7ae){return function(_0x3a9458,_0x47b092,_0x216873){FaxAccountEvents[_0x768c('0x2')](_0xe1e7ae+':'+_0x3a9458['id'],_0x3a9458);FaxAccountEvents[_0x768c('0x2')](_0xe1e7ae,_0x3a9458);_0x216873(null);};}for(var e in events){if(events[_0x768c('0x3')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x768c('0x4')]=FaxAccountEvents; \ No newline at end of file +var _0x8797=['../../mysqldb','FaxAccount','remove','emit','hasOwnProperty','hook','events'];(function(_0x1284fd,_0x302999){var _0x12bfb7=function(_0x44fb38){while(--_0x44fb38){_0x1284fd['push'](_0x1284fd['shift']());}};_0x12bfb7(++_0x302999);}(_0x8797,0x133));var _0x7879=function(_0x472063,_0x11a264){_0x472063=_0x472063-0x0;var _0x17a1bf=_0x8797[_0x472063];return _0x17a1bf;};'use strict';var EventEmitter=require(_0x7879('0x0'));var FaxAccount=require(_0x7879('0x1'))['db'][_0x7879('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x7879('0x3')};function emitEvent(_0x382526){return function(_0x5288e1,_0x3d733c,_0x280a3c){FaxAccountEvents['emit'](_0x382526+':'+_0x5288e1['id'],_0x5288e1);FaxAccountEvents[_0x7879('0x4')](_0x382526,_0x5288e1);_0x280a3c(null);};}for(var e in events){if(events[_0x7879('0x5')](e)){var event=events[e];FaxAccount[_0x7879('0x6')](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 c2b32e0..8dda163 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 _0x0be1=['lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports','FaxAccount','fax_accounts'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x0be1,0x150));var _0x10be=function(_0x2525f1,_0x47034f){_0x2525f1=_0x2525f1-0x0;var _0x13c1b5=_0x0be1[_0x2525f1];return _0x13c1b5;};'use strict';var _=require(_0x10be('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x10be('0x1'));var moment=require(_0x10be('0x2'));var BPromise=require(_0x10be('0x3'));var rp=require(_0x10be('0x4'));var fs=require('fs');var path=require(_0x10be('0x5'));var rimraf=require(_0x10be('0x6'));var config=require(_0x10be('0x7'));var attributes=require(_0x10be('0x8'));module[_0x10be('0x9')]=function(_0x267846,_0x203ba9){return _0x267846['define'](_0x10be('0xa'),attributes,{'tableName':_0x10be('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7781=['rimraf','./faxAccount.attributes','define','FaxAccount','fax_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5c13f7,_0x4a43b3){var _0x4f8df6=function(_0x26271f){while(--_0x26271f){_0x5c13f7['push'](_0x5c13f7['shift']());}};_0x4f8df6(++_0x4a43b3);}(_0x7781,0x1a9));var _0x1778=function(_0x2e882f,_0x47e09e){_0x2e882f=_0x2e882f-0x0;var _0x3c773e=_0x7781[_0x2e882f];return _0x3c773e;};'use strict';var _=require(_0x1778('0x0'));var util=require(_0x1778('0x1'));var logger=require(_0x1778('0x2'))(_0x1778('0x3'));var moment=require(_0x1778('0x4'));var BPromise=require(_0x1778('0x5'));var rp=require(_0x1778('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1778('0x7'));var config=require('../../config/environment');var attributes=require(_0x1778('0x8'));module['exports']=function(_0x5344f8,_0x51862e){return _0x5344f8[_0x1778('0x9')](_0x1778('0xa'),attributes,{'tableName':_0x1778('0xb'),'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 c299291..fb75f75 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 _0x73a8=['ListId','from','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','find','account','Contacts','FaxApplication','List','applications','Applications','list','priority','defaults','create','contact','fax','FaxInteraction','spread','get','autoclose','length','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','unshift','name','waitForTheAssignedAgent','Start','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','./faxAccount.socket','register','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','findAll','options','raw','attributes','limit','include','map','model','then','GetFaxAccount','catch','body','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId'];(function(_0x2421a1,_0x35e3e9){var _0x354a13=function(_0x53f693){while(--_0x53f693){_0x2421a1['push'](_0x2421a1['shift']());}};_0x354a13(++_0x35e3e9);}(_0x73a8,0x7f));var _0x873a=function(_0x1371a7,_0x159269){_0x1371a7=_0x1371a7-0x0;var _0x344d39=_0x73a8[_0x1371a7];return _0x344d39;};'use strict';var _=require(_0x873a('0x0'));var util=require(_0x873a('0x1'));var moment=require(_0x873a('0x2'));var BPromise=require(_0x873a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x873a('0x4'));var db=require(_0x873a('0x5'))['db'];var utils=require(_0x873a('0x6'));var logger=require(_0x873a('0x7'))(_0x873a('0x8'));var config=require(_0x873a('0x9'));var jayson=require(_0x873a('0xa'));var client=jayson[_0x873a('0xb')][_0x873a('0xc')]({'port':0x232c});config[_0x873a('0xd')]=_['defaults'](config[_0x873a('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x873a('0xd')]));require(_0x873a('0xe'))[_0x873a('0xf')](socket);function respondWithRpcPromise(_0x5f3d75,_0x4fc9ee,_0x3b81b4){return new BPromise(function(_0x193ab2,_0x4fc2db){return client[_0x873a('0x10')](_0x5f3d75,_0x3b81b4)['then'](function(_0x2ed356){logger[_0x873a('0x11')](_0x873a('0x12'),_0x4fc9ee,_0x873a('0x13'));logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x4fc9ee,_0x873a('0x13'),JSON[_0x873a('0x14')](_0x2ed356));if(_0x2ed356['error']){if(_0x2ed356[_0x873a('0x15')][_0x873a('0x16')]===0x1f4){logger[_0x873a('0x15')](_0x873a('0x12'),_0x4fc9ee,_0x2ed356[_0x873a('0x15')][_0x873a('0x17')]);return _0x4fc2db(_0x2ed356['error'][_0x873a('0x17')]);}logger[_0x873a('0x15')](_0x873a('0x12'),_0x4fc9ee,_0x2ed356['error']['message']);return _0x193ab2(_0x2ed356['error'][_0x873a('0x17')]);}else{logger['info'](_0x873a('0x12'),_0x4fc9ee,_0x873a('0x13'));_0x193ab2(_0x2ed356[_0x873a('0x18')][_0x873a('0x17')]);}})['catch'](function(_0x57f2cd){logger[_0x873a('0x15')](_0x873a('0x12'),_0x4fc9ee,_0x57f2cd);_0x4fc2db(_0x57f2cd);});});}exports['GetFaxAccount']=function(_0x219ea1){var _0x18abe7=this;return new Promise(function(_0x292b27,_0x43f79){return db['FaxAccount'][_0x873a('0x19')]({'raw':_0x219ea1[_0x873a('0x1a')]?_0x219ea1['options'][_0x873a('0x1b')]===undefined?!![]:![]:!![],'where':_0x219ea1['options']?_0x219ea1[_0x873a('0x1a')]['where']||null:null,'attributes':_0x219ea1['options']?_0x219ea1[_0x873a('0x1a')][_0x873a('0x1c')]||null:null,'limit':_0x219ea1[_0x873a('0x1a')]?_0x219ea1[_0x873a('0x1a')][_0x873a('0x1d')]||null:null,'include':_0x219ea1[_0x873a('0x1a')]?_0x219ea1[_0x873a('0x1a')][_0x873a('0x1e')]?_[_0x873a('0x1f')](_0x219ea1[_0x873a('0x1a')][_0x873a('0x1e')],function(_0x1dbf8b){return{'model':db[_0x1dbf8b[_0x873a('0x20')]],'as':_0x1dbf8b['as'],'attributes':_0x1dbf8b[_0x873a('0x1c')],'include':_0x1dbf8b[_0x873a('0x1e')]?_['map'](_0x1dbf8b['include'],function(_0x41f905){return{'model':db[_0x41f905['model']],'as':_0x41f905['as'],'attributes':_0x41f905[_0x873a('0x1c')],'include':_0x41f905[_0x873a('0x1e')]?_[_0x873a('0x1f')](_0x41f905[_0x873a('0x1e')],function(_0x563bac){return{'model':db[_0x563bac[_0x873a('0x20')]],'as':_0x563bac['as'],'attributes':_0x563bac['attributes']};}):[]};}):[]};}):[]:[]})[_0x873a('0x21')](function(_0xd07a70){logger['info'](_0x873a('0x22'),_0x219ea1);logger['debug'](_0x873a('0x22'),_0x219ea1,JSON[_0x873a('0x14')](_0xd07a70));_0x292b27(_0xd07a70);})[_0x873a('0x23')](function(_0x30286a){logger['error'](_0x873a('0x22'),_0x30286a[_0x873a('0x17')],_0x219ea1);_0x43f79(_0x18abe7[_0x873a('0x15')](0x1f4,_0x30286a[_0x873a('0x17')]));});});};exports['NotifyFaxAccount']=function(_0xa9f62a,_0x2e3f61,_0x393423){var _0x4815d6=this;return new Promise(function(_0x2718fe,_0x5ac8ad){var _0x40af57={'body':_0xa9f62a[_0x873a('0x24')],'channel':'fax'};var _0x150bdf=[];var _0x487969=[];var _0x359ef2={};return db[_0x873a('0x25')][_0x873a('0x26')]()['then'](function(_0xd34235){if(!_0xd34235){throw new db[(_0x873a('0x27'))][(_0x873a('0x28'))](_0x873a('0x29'));}_0x150bdf=_[_0x873a('0x2a')](_[_0x873a('0x2b')](_0xd34235),[_0x873a('0x2c'),_0x873a('0x2d')]);_0x487969=_['difference'](_[_0x873a('0x2b')](_0xd34235),[_0x873a('0x2c'),'updatedAt',_0x873a('0x2e'),_0x873a('0x2f')]);if(_0xa9f62a[_0x873a('0x24')]['id']){delete _0xa9f62a[_0x873a('0x24')]['id'];}if(_['isNil'](_0xa9f62a['body'][_0x873a('0x30')])){throw new db[(_0x873a('0x27'))][(_0x873a('0x28'))]('from\x20is\x20mandatory');}if(_['isNil'](_0xa9f62a[_0x873a('0x24')][_0x873a('0x24')])||_0xa9f62a['body'][_0x873a('0x24')]===''){throw new db[(_0x873a('0x27'))][(_0x873a('0x28'))](_0x873a('0x31'));}if(_[_0x873a('0x32')](_0xa9f62a[_0x873a('0x24')][_0x873a('0x33')])){throw new db['Sequelize'][(_0x873a('0x28'))](_0x873a('0x34')+_0x487969);}if(!_['includes'](_0x487969,_0xa9f62a[_0x873a('0x24')][_0x873a('0x33')])){throw new db['Sequelize']['ValidationError'](_0x873a('0x35')+_0x487969);}_0x359ef2[_0xa9f62a[_0x873a('0x24')]['mapKey']]=_0xa9f62a[_0x873a('0x24')][_0x873a('0x30')];})[_0x873a('0x21')](function(){return db[_0x873a('0x36')][_0x873a('0x37')]({'where':{'id':_0xa9f62a[_0x873a('0x38')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x873a('0x25')],'as':_0x873a('0x39'),'where':_0x359ef2,'limit':0x1,'order':[[_0x873a('0x2d'),'DESC']]}]},{'model':db[_0x873a('0x3a')],'as':'Applications'}]});})[_0x873a('0x21')](function(_0x272f03){if(_0x272f03&&_0x272f03[_0x873a('0x3b')]){var _0x401ebb=_0x272f03['get']({'plain':!![]});_0x40af57[_0x873a('0x38')]=_0x401ebb;_0x40af57[_0x873a('0x3c')]=_0x401ebb[_0x873a('0x3d')];_0x40af57[_0x873a('0x3e')]=_0x401ebb[_0x873a('0x3b')];_0x40af57['applications']=_['orderBy'](_0x40af57[_0x873a('0x3c')],[_0x873a('0x3f')],['asc']);if(_0x40af57[_0x873a('0x38')]['Applications']){delete _0x40af57[_0x873a('0x38')]['Applications'];}if(_0x40af57['account'][_0x873a('0x3b')]&&_0x40af57[_0x873a('0x38')][_0x873a('0x3b')]['Contacts']['length']){return _0x40af57['account']['List'][_0x873a('0x39')][0x0];}var _0x360ae4=_[_0x873a('0x40')](_0xa9f62a[_0x873a('0x24')],{'firstName':_0xa9f62a[_0x873a('0x24')][_0x873a('0x30')],'ListId':_0x401ebb['ListId']});_0x360ae4[_0xa9f62a[_0x873a('0x24')][_0x873a('0x33')]]=_0xa9f62a[_0x873a('0x24')][_0x873a('0x30')];return db[_0x873a('0x25')][_0x873a('0x41')](_0x360ae4,{'fields':_0x150bdf,'raw':!![]});}})[_0x873a('0x21')](function(_0x3694b0){_0x40af57[_0x873a('0x42')]=_0x3694b0;if(_0x3694b0){var _0x4f2df9={'ContactId':_0x3694b0['id'],'FaxAccountId':_0xa9f62a[_0x873a('0x38')]['id'],'fax':_0x3694b0[_0x873a('0x43')]};return db[_0x873a('0x44')]['find']({'where':{'ContactId':_0x3694b0['id'],'closed':![],'FaxAccountId':_0xa9f62a[_0x873a('0x38')]['id']}})[_0x873a('0x21')](function(_0x326e12){if(_0x326e12){return[_0x326e12,![]];}return db[_0x873a('0x44')][_0x873a('0x41')](_0x4f2df9)[_0x873a('0x21')](function(_0x4cab3a){return[_0x4cab3a,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x873a('0x45')](function(_0x5ea53b,_0x532d8c){var _0x34efc0=_0x5ea53b[_0x873a('0x46')]({'plain':!![]});if(_0x532d8c){if(_0x40af57[_0x873a('0x38')][_0x873a('0x47')]){_0x40af57[_0x873a('0x3c')]['push']({'id':0x0,'priority':_0x40af57[_0x873a('0x3c')][_0x873a('0x48')]+0x1,'app':_0x873a('0x49'),'appdata':_0x873a('0x4a'),'interval':_0x873a('0x4b')});}_0x34efc0['created']=!![];}else{_0x34efc0[_0x873a('0x4c')]=![];}_0x40af57[_0x873a('0x4d')]=_0x34efc0;return db[_0x873a('0x4e')][_0x873a('0x41')]({'body':_0xa9f62a[_0x873a('0x24')][_0x873a('0x24')],'FaxAccountId':_0xa9f62a[_0x873a('0x38')]['id'],'FaxInteractionId':_0x5ea53b['id'],'direction':'in','ContactId':_0x5ea53b[_0x873a('0x4f')],'AttachmentId':_0xa9f62a['body'][_0x873a('0x50')]});})['then'](function(_0x2809c2){_0x40af57[_0x873a('0x17')]=_0x2809c2;if(_0x40af57[_0x873a('0x4d')][_0x873a('0x51')]){return db[_0x873a('0x52')][_0x873a('0x37')]({'attributes':['id','name'],'where':{'id':_0x40af57[_0x873a('0x4d')][_0x873a('0x51')]}})[_0x873a('0x21')](function(_0xf1f454){if(_0xf1f454){_0x40af57['applications'][_0x873a('0x53')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xf1f454[_0x873a('0x54')]+','+(_0x40af57[_0x873a('0x38')][_0x873a('0x55')]||0xa),'interval':_0x873a('0x4b')});}return respondWithRpcPromise(_0x873a('0x56'),'startRouting',_0x40af57);});}return respondWithRpcPromise(_0x873a('0x56'),'startRouting',_0x40af57);})[_0x873a('0x21')](function(_0x4b8a1c){_0x2718fe(_0x4b8a1c);})[_0x873a('0x23')](function(_0x3abf13){_0x5ac8ad(_0x4815d6[_0x873a('0x15')](0x1f4,_0x3abf13[_0x873a('0x17')]));});});}; \ No newline at end of file +var _0x0e52=['where','attributes','limit','include','map','then','catch','NotifyFaxAccount','body','fax','CmContact','ValidationError','no\x20available\x20attributes','keys','updatedAt','createdAt','CompanyId','ListId','isNil','from','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','account','CmList','List','Contacts','DESC','Applications','get','applications','orderBy','priority','asc','length','create','contact','FaxInteraction','Contact\x20not\x20found','spread','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','UserId','User','name','unshift','Start','startRouting','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','./faxAccount.socket','register','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','message','GetFaxAccount','findAll','options','raw'];(function(_0x8819a1,_0x436876){var _0x2691c3=function(_0x3ae1dd){while(--_0x3ae1dd){_0x8819a1['push'](_0x8819a1['shift']());}};_0x2691c3(++_0x436876);}(_0x0e52,0x1d2));var _0x20e5=function(_0x9d8ad1,_0x3e3c74){_0x9d8ad1=_0x9d8ad1-0x0;var _0x4f37ad=_0x0e52[_0x9d8ad1];return _0x4f37ad;};'use strict';var _=require(_0x20e5('0x0'));var util=require(_0x20e5('0x1'));var moment=require('moment');var BPromise=require(_0x20e5('0x2'));var rs=require(_0x20e5('0x3'));var fs=require('fs');var Redis=require(_0x20e5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x20e5('0x5'));var logger=require(_0x20e5('0x6'))('rpc');var config=require(_0x20e5('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x20e5('0x8')]({'port':0x232c});config[_0x20e5('0x9')]=_[_0x20e5('0xa')](config[_0x20e5('0x9')],{'host':_0x20e5('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x20e5('0x9')]));require(_0x20e5('0xc'))[_0x20e5('0xd')](socket);function respondWithRpcPromise(_0xf73af9,_0x5454e9,_0x420cc6){return new BPromise(function(_0x571629,_0xa1fcd1){return client[_0x20e5('0xe')](_0xf73af9,_0x420cc6)['then'](function(_0x570a51){logger[_0x20e5('0xf')](_0x20e5('0x10'),_0x5454e9,_0x20e5('0x11'));logger[_0x20e5('0x12')](_0x20e5('0x13'),_0x5454e9,'request\x20sent',JSON['stringify'](_0x570a51));if(_0x570a51[_0x20e5('0x14')]){if(_0x570a51[_0x20e5('0x14')]['code']===0x1f4){logger[_0x20e5('0x14')](_0x20e5('0x10'),_0x5454e9,_0x570a51['error']['message']);return _0xa1fcd1(_0x570a51[_0x20e5('0x14')][_0x20e5('0x15')]);}logger[_0x20e5('0x14')]('FaxAccount,\x20%s,\x20%s',_0x5454e9,_0x570a51[_0x20e5('0x14')][_0x20e5('0x15')]);return _0x571629(_0x570a51[_0x20e5('0x14')]['message']);}else{logger[_0x20e5('0xf')]('FaxAccount,\x20%s,\x20%s',_0x5454e9,_0x20e5('0x11'));_0x571629(_0x570a51['result'][_0x20e5('0x15')]);}})['catch'](function(_0x58a521){logger['error'](_0x20e5('0x10'),_0x5454e9,_0x58a521);_0xa1fcd1(_0x58a521);});});}exports[_0x20e5('0x16')]=function(_0x2b19ca){var _0x4fdb81=this;return new Promise(function(_0x483c7c,_0x45ae4a){return db['FaxAccount'][_0x20e5('0x17')]({'raw':_0x2b19ca[_0x20e5('0x18')]?_0x2b19ca[_0x20e5('0x18')][_0x20e5('0x19')]===undefined?!![]:![]:!![],'where':_0x2b19ca['options']?_0x2b19ca[_0x20e5('0x18')][_0x20e5('0x1a')]||null:null,'attributes':_0x2b19ca[_0x20e5('0x18')]?_0x2b19ca[_0x20e5('0x18')][_0x20e5('0x1b')]||null:null,'limit':_0x2b19ca[_0x20e5('0x18')]?_0x2b19ca[_0x20e5('0x18')][_0x20e5('0x1c')]||null:null,'include':_0x2b19ca[_0x20e5('0x18')]?_0x2b19ca[_0x20e5('0x18')][_0x20e5('0x1d')]?_['map'](_0x2b19ca[_0x20e5('0x18')][_0x20e5('0x1d')],function(_0x128f41){return{'model':db[_0x128f41['model']],'as':_0x128f41['as'],'attributes':_0x128f41[_0x20e5('0x1b')],'include':_0x128f41['include']?_[_0x20e5('0x1e')](_0x128f41[_0x20e5('0x1d')],function(_0x4c9e5d){return{'model':db[_0x4c9e5d['model']],'as':_0x4c9e5d['as'],'attributes':_0x4c9e5d[_0x20e5('0x1b')],'include':_0x4c9e5d[_0x20e5('0x1d')]?_[_0x20e5('0x1e')](_0x4c9e5d[_0x20e5('0x1d')],function(_0x47284d){return{'model':db[_0x47284d['model']],'as':_0x47284d['as'],'attributes':_0x47284d[_0x20e5('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x20e5('0x1f')](function(_0x1b3952){logger['info']('GetFaxAccount',_0x2b19ca);logger[_0x20e5('0x12')](_0x20e5('0x16'),_0x2b19ca,JSON['stringify'](_0x1b3952));_0x483c7c(_0x1b3952);})[_0x20e5('0x20')](function(_0x97b890){logger[_0x20e5('0x14')](_0x20e5('0x16'),_0x97b890[_0x20e5('0x15')],_0x2b19ca);_0x45ae4a(_0x4fdb81['error'](0x1f4,_0x97b890['message']));});});};exports[_0x20e5('0x21')]=function(_0x2f0557,_0x1f7cf6,_0xd55efe){var _0x56246c=this;return new Promise(function(_0x3ea913,_0xaa1de0){var _0x5d735b={'body':_0x2f0557[_0x20e5('0x22')],'channel':_0x20e5('0x23')};var _0x347364=[];var _0x3af360=[];var _0x400d53={};return db[_0x20e5('0x24')]['describe']()[_0x20e5('0x1f')](function(_0x2cf6d2){if(!_0x2cf6d2){throw new db['Sequelize'][(_0x20e5('0x25'))](_0x20e5('0x26'));}_0x347364=_['difference'](_[_0x20e5('0x27')](_0x2cf6d2),['createdAt',_0x20e5('0x28')]);_0x3af360=_['difference'](_['keys'](_0x2cf6d2),[_0x20e5('0x29'),_0x20e5('0x28'),_0x20e5('0x2a'),_0x20e5('0x2b')]);if(_0x2f0557['body']['id']){delete _0x2f0557['body']['id'];}if(_[_0x20e5('0x2c')](_0x2f0557[_0x20e5('0x22')][_0x20e5('0x2d')])){throw new db[(_0x20e5('0x2e'))][(_0x20e5('0x25'))]('from\x20is\x20mandatory');}if(_[_0x20e5('0x2c')](_0x2f0557[_0x20e5('0x22')][_0x20e5('0x22')])||_0x2f0557['body']['body']===''){throw new db['Sequelize']['ValidationError'](_0x20e5('0x2f'));}if(_['isNil'](_0x2f0557[_0x20e5('0x22')][_0x20e5('0x30')])){throw new db[(_0x20e5('0x2e'))][(_0x20e5('0x25'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3af360);}if(!_[_0x20e5('0x31')](_0x3af360,_0x2f0557['body'][_0x20e5('0x30')])){throw new db['Sequelize'][(_0x20e5('0x25'))](_0x20e5('0x32')+_0x3af360);}_0x400d53[_0x2f0557[_0x20e5('0x22')][_0x20e5('0x30')]]=_0x2f0557[_0x20e5('0x22')][_0x20e5('0x2d')];})[_0x20e5('0x1f')](function(){return db[_0x20e5('0x33')]['find']({'where':{'id':_0x2f0557[_0x20e5('0x34')]['id']},'include':[{'model':db[_0x20e5('0x35')],'as':_0x20e5('0x36'),'include':[{'model':db[_0x20e5('0x24')],'as':_0x20e5('0x37'),'where':_0x400d53,'limit':0x1,'order':[[_0x20e5('0x28'),_0x20e5('0x38')]]}]},{'model':db['FaxApplication'],'as':_0x20e5('0x39')}]});})[_0x20e5('0x1f')](function(_0x563bbb){if(_0x563bbb&&_0x563bbb['List']){var _0x497059=_0x563bbb[_0x20e5('0x3a')]({'plain':!![]});_0x5d735b[_0x20e5('0x34')]=_0x497059;_0x5d735b['applications']=_0x497059[_0x20e5('0x39')];_0x5d735b['list']=_0x497059['List'];_0x5d735b[_0x20e5('0x3b')]=_[_0x20e5('0x3c')](_0x5d735b[_0x20e5('0x3b')],[_0x20e5('0x3d')],[_0x20e5('0x3e')]);if(_0x5d735b[_0x20e5('0x34')]['Applications']){delete _0x5d735b[_0x20e5('0x34')][_0x20e5('0x39')];}if(_0x5d735b[_0x20e5('0x34')]['List']&&_0x5d735b['account'][_0x20e5('0x36')][_0x20e5('0x37')][_0x20e5('0x3f')]){return _0x5d735b['account'][_0x20e5('0x36')]['Contacts'][0x0];}var _0x213204=_[_0x20e5('0xa')](_0x2f0557[_0x20e5('0x22')],{'firstName':_0x2f0557['body']['from'],'ListId':_0x497059['ListId']});_0x213204[_0x2f0557['body'][_0x20e5('0x30')]]=_0x2f0557[_0x20e5('0x22')]['from'];return db['CmContact'][_0x20e5('0x40')](_0x213204,{'fields':_0x347364,'raw':!![]});}})[_0x20e5('0x1f')](function(_0x334dd2){_0x5d735b[_0x20e5('0x41')]=_0x334dd2;if(_0x334dd2){var _0x27431f={'ContactId':_0x334dd2['id'],'FaxAccountId':_0x2f0557[_0x20e5('0x34')]['id'],'fax':_0x334dd2['fax']};return db[_0x20e5('0x42')]['find']({'where':{'ContactId':_0x334dd2['id'],'closed':![],'FaxAccountId':_0x2f0557[_0x20e5('0x34')]['id']}})[_0x20e5('0x1f')](function(_0x1004a9){if(_0x1004a9){return[_0x1004a9,![]];}return db[_0x20e5('0x42')][_0x20e5('0x40')](_0x27431f)[_0x20e5('0x1f')](function(_0x149cba){return[_0x149cba,!![]];});});}else{throw new Error(_0x20e5('0x43'));}})[_0x20e5('0x44')](function(_0xd0f237,_0x5a6cf9){var _0xc98b01=_0xd0f237[_0x20e5('0x3a')]({'plain':!![]});if(_0x5a6cf9){if(_0x5d735b[_0x20e5('0x34')]['autoclose']){_0x5d735b[_0x20e5('0x3b')]['push']({'id':0x0,'priority':_0x5d735b[_0x20e5('0x3b')][_0x20e5('0x3f')]+0x1,'app':_0x20e5('0x45'),'appdata':_0x20e5('0x46'),'interval':_0x20e5('0x47')});}_0xc98b01['created']=!![];}else{_0xc98b01[_0x20e5('0x48')]=![];}_0x5d735b[_0x20e5('0x49')]=_0xc98b01;return db[_0x20e5('0x4a')][_0x20e5('0x40')]({'body':_0x2f0557[_0x20e5('0x22')][_0x20e5('0x22')],'FaxAccountId':_0x2f0557[_0x20e5('0x34')]['id'],'FaxInteractionId':_0xd0f237['id'],'direction':'in','ContactId':_0xd0f237[_0x20e5('0x4b')],'AttachmentId':_0x2f0557[_0x20e5('0x22')]['AttachmentId']});})['then'](function(_0x487287){_0x5d735b[_0x20e5('0x15')]=_0x487287;if(_0x5d735b[_0x20e5('0x49')][_0x20e5('0x4c')]){return db[_0x20e5('0x4d')]['find']({'attributes':['id',_0x20e5('0x4e')],'where':{'id':_0x5d735b['interaction']['UserId']}})[_0x20e5('0x1f')](function(_0x2535ae){if(_0x2535ae){_0x5d735b[_0x20e5('0x3b')][_0x20e5('0x4f')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2535ae[_0x20e5('0x4e')]+','+(_0x5d735b['account']['waitForTheAssignedAgent']||0xa),'interval':_0x20e5('0x47')});}return respondWithRpcPromise(_0x20e5('0x50'),_0x20e5('0x51'),_0x5d735b);});}return respondWithRpcPromise(_0x20e5('0x50'),_0x20e5('0x51'),_0x5d735b);})[_0x20e5('0x1f')](function(_0x3d6a7c){_0x3ea913(_0x3d6a7c);})[_0x20e5('0x20')](function(_0x5646a7){_0xaa1de0(_0x56246c[_0x20e5('0x14')](0x1f4,_0x5646a7[_0x20e5('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index b9017a1..0bb9f7d 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 _0x00fc=['register','length','faxAccount:','./faxAccount.events','save','remove','emit','removeListener'];(function(_0x59627b,_0x396645){var _0x3a4e1b=function(_0x3fc4bc){while(--_0x3fc4bc){_0x59627b['push'](_0x59627b['shift']());}};_0x3a4e1b(++_0x396645);}(_0x00fc,0xa3));var _0xc00f=function(_0x2e04ef,_0x31a596){_0x2e04ef=_0x2e04ef-0x0;var _0x5722b0=_0x00fc[_0x2e04ef];return _0x5722b0;};'use strict';var FaxAccountEvents=require(_0xc00f('0x0'));var events=[_0xc00f('0x1'),_0xc00f('0x2'),'update'];function createListener(_0x292290,_0x2e7227){return function(_0x1f7082){_0x2e7227[_0xc00f('0x3')](_0x292290,_0x1f7082);};}function removeListener(_0x1ed69d,_0x413890){return function(){FaxAccountEvents[_0xc00f('0x4')](_0x1ed69d,_0x413890);};}exports[_0xc00f('0x5')]=function(_0x57b6f3){for(var _0x77a33=0x0,_0x85ea4d=events[_0xc00f('0x6')];_0x77a33<_0x85ea4d;_0x77a33++){var _0xc90c90=events[_0x77a33];var _0x3406f9=createListener(_0xc00f('0x7')+_0xc90c90,_0x57b6f3);FaxAccountEvents['on'](_0xc90c90,_0x3406f9);}}; \ No newline at end of file +var _0xa8fd=['./faxAccount.events','save','remove','update','emit','removeListener','register','length','faxAccount:'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xa8fd,0x1c2));var _0xda8f=function(_0x2d2282,_0x1b736d){_0x2d2282=_0x2d2282-0x0;var _0x2eafea=_0xa8fd[_0x2d2282];return _0x2eafea;};'use strict';var FaxAccountEvents=require(_0xda8f('0x0'));var events=[_0xda8f('0x1'),_0xda8f('0x2'),_0xda8f('0x3')];function createListener(_0x160479,_0x7d8e5f){return function(_0x237e38){_0x7d8e5f[_0xda8f('0x4')](_0x160479,_0x237e38);};}function removeListener(_0x229cc7,_0x4b1e77){return function(){FaxAccountEvents[_0xda8f('0x5')](_0x229cc7,_0x4b1e77);};}exports[_0xda8f('0x6')]=function(_0x33b32f){for(var _0x454fd9=0x0,_0x5730f2=events[_0xda8f('0x7')];_0x454fd9<_0x5730f2;_0x454fd9++){var _0x21c2f6=events[_0x454fd9];var _0x403e23=createListener(_0xda8f('0x8')+_0x21c2f6,_0x33b32f);FaxAccountEvents['on'](_0x21c2f6,_0x403e23);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 54a184c..34fc415 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(_0x347204,_0x3fc917){var _0x364401=function(_0x3e8440){while(--_0x3e8440){_0x347204['push'](_0x347204['shift']());}};_0x364401(++_0x3fc917);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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(_0x16d004,_0x4d0ce7){var _0x28aa7a=function(_0x4882e8){while(--_0x4882e8){_0x16d004['push'](_0x16d004['shift']());}};_0x28aa7a(++_0x4d0ce7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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 4cdd780..c77a376 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 _0xc35e=['noop','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x4dbf49,_0x1813ae){var _0x24f8f0=function(_0xe72afc){while(--_0xe72afc){_0x4dbf49['push'](_0x4dbf49['shift']());}};_0x24f8f0(++_0x1813ae);}(_0xc35e,0x158));var _0xec35=function(_0x1c6a76,_0x5087e2){_0x1c6a76=_0x1c6a76-0x0;var _0x44933c=_0xc35e[_0x1c6a76];return _0x44933c;};'use strict';var Sequelize=require(_0xec35('0x0'));module[_0xec35('0x1')]={'priority':{'type':Sequelize[_0xec35('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xec35('0x3')],'allowNull':![],'defaultValue':_0xec35('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xec35('0x3')],'defaultValue':_0xec35('0x5')}}; \ No newline at end of file +var _0xe5aa=['TEXT','sequelize','exports','INTEGER','STRING'];(function(_0x1b3232,_0x2515e8){var _0x5e5f9d=function(_0x24f2f2){while(--_0x24f2f2){_0x1b3232['push'](_0x1b3232['shift']());}};_0x5e5f9d(++_0x2515e8);}(_0xe5aa,0x1d2));var _0xae5a=function(_0x34e570,_0xd6eda8){_0x34e570=_0x34e570-0x0;var _0x563eef=_0xe5aa[_0x34e570];return _0x563eef;};'use strict';var Sequelize=require(_0xae5a('0x0'));module[_0xae5a('0x1')]={'priority':{'type':Sequelize[_0xae5a('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xae5a('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xae5a('0x4')]()},'description':{'type':Sequelize[_0xae5a('0x3')]},'interval':{'type':Sequelize[_0xae5a('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 83ab44c..98d6c0a 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 _0x4f98=['../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','model','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','includeAll','include','catch','show','params','keys','length','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x31adee,_0x1ad0c2){var _0xbf3886=function(_0x3b432f){while(--_0x3b432f){_0x31adee['push'](_0x31adee['shift']());}};_0xbf3886(++_0x1ad0c2);}(_0x4f98,0x112));var _0x84f9=function(_0x374ccf,_0xa945c4){_0x374ccf=_0x374ccf-0x0;var _0x443cde=_0x4f98[_0x374ccf];return _0x443cde;};'use strict';var emlformat=require(_0x84f9('0x0'));var rimraf=require(_0x84f9('0x1'));var zipdir=require(_0x84f9('0x2'));var jsonpatch=require(_0x84f9('0x3'));var rp=require(_0x84f9('0x4'));var moment=require(_0x84f9('0x5'));var BPromise=require(_0x84f9('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x84f9('0x7'));var sox=require(_0x84f9('0x8'));var csv=require(_0x84f9('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x84f9('0xa'));var squel=require(_0x84f9('0xb'));var crypto=require(_0x84f9('0xc'));var jsforce=require(_0x84f9('0xd'));var deskjs=require(_0x84f9('0xe'));var toCsv=require('to-csv');var querystring=require(_0x84f9('0xf'));var Papa=require(_0x84f9('0x10'));var Redis=require(_0x84f9('0x11'));var authService=require(_0x84f9('0x12'));var qs=require(_0x84f9('0x13'));var as=require(_0x84f9('0x14'));var hardwareService=require(_0x84f9('0x15'));var logger=require(_0x84f9('0x16'))('api');var utils=require(_0x84f9('0x17'));var config=require(_0x84f9('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x84f9('0x19'))['db'];function respondWithStatusCode(_0x456f39,_0x4b91bb){_0x4b91bb=_0x4b91bb||0xcc;return function(_0x4b54e0){if(_0x4b54e0){return _0x456f39[_0x84f9('0x1a')](_0x4b91bb);}return _0x456f39[_0x84f9('0x1b')](_0x4b91bb)[_0x84f9('0x1c')]();};}function respondWithResult(_0x47b609,_0x33270e){_0x33270e=_0x33270e||0xc8;return function(_0x51adac){if(_0x51adac){return _0x47b609[_0x84f9('0x1b')](_0x33270e)[_0x84f9('0x1d')](_0x51adac);}};}function respondWithFilteredResult(_0x117c26,_0x5673b9){return function(_0xaa4b82){if(_0xaa4b82){var _0xea71b9=typeof _0x5673b9[_0x84f9('0x1e')]===_0x84f9('0x1f')&&typeof _0x5673b9[_0x84f9('0x20')]===_0x84f9('0x1f');var _0x288a21=_0xaa4b82[_0x84f9('0x21')];var _0x23be74=_0xea71b9?0x0:_0x5673b9[_0x84f9('0x1e')];var _0x2b0895=_0xea71b9?_0xaa4b82[_0x84f9('0x21')]:_0x5673b9[_0x84f9('0x1e')]+_0x5673b9[_0x84f9('0x20')];var _0x56df9f;if(_0x2b0895>=_0x288a21){_0x2b0895=_0x288a21;_0x56df9f=0xc8;}else{_0x56df9f=0xce;}_0x117c26[_0x84f9('0x1b')](_0x56df9f);return _0x117c26[_0x84f9('0x22')](_0x84f9('0x23'),_0x23be74+'-'+_0x2b0895+'/'+_0x288a21)[_0x84f9('0x1d')](_0xaa4b82);}return null;};}function patchUpdates(_0x4a6f47){return function(_0x25ead1){try{jsonpatch['apply'](_0x25ead1,_0x4a6f47,!![]);}catch(_0xa6a5cb){return BPromise[_0x84f9('0x24')](_0xa6a5cb);}return _0x25ead1[_0x84f9('0x25')]();};}function saveUpdates(_0x6fbe85,_0x187f9d){return function(_0x568778){if(_0x568778){return _0x568778['update'](_0x6fbe85)[_0x84f9('0x26')](function(_0x3ccb78){return _0x3ccb78;});}return null;};}function removeEntity(_0x3d99e5,_0x28bb5d){return function(_0x24f498){if(_0x24f498){return _0x24f498[_0x84f9('0x27')]()[_0x84f9('0x26')](function(){_0x3d99e5[_0x84f9('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4bfc60,_0x546a9d){return function(_0x11b56a){if(!_0x11b56a){_0x4bfc60['sendStatus'](0x194);}return _0x11b56a;};}function handleError(_0x5e2588,_0x2a73a2){_0x2a73a2=_0x2a73a2||0x1f4;return function(_0x58bbc8){logger['error'](_0x58bbc8[_0x84f9('0x28')]);if(_0x58bbc8['name']){delete _0x58bbc8[_0x84f9('0x29')];}_0x5e2588['status'](_0x2a73a2)[_0x84f9('0x2a')](_0x58bbc8);};}exports[_0x84f9('0x2b')]=function(_0x4b4b60,_0x16894a){var _0x216b69={},_0x56ae99={},_0x29bec3={'count':0x0,'rows':[]};var _0x304e1e=_[_0x84f9('0x2c')](db[_0x84f9('0x2d')][_0x84f9('0x2e')],function(_0xad110c){return{'name':_0xad110c[_0x84f9('0x2f')],'type':_0xad110c['type']['key']};});_0x56ae99[_0x84f9('0x30')]=_[_0x84f9('0x2c')](_0x304e1e,_0x84f9('0x29'));_0x56ae99[_0x84f9('0x31')]=_['keys'](_0x4b4b60['query']);_0x56ae99[_0x84f9('0x32')]=_['intersection'](_0x56ae99['model'],_0x56ae99[_0x84f9('0x31')]);_0x216b69[_0x84f9('0x33')]=_[_0x84f9('0x34')](_0x56ae99[_0x84f9('0x30')],qs[_0x84f9('0x35')](_0x4b4b60['query'][_0x84f9('0x35')]));_0x216b69[_0x84f9('0x33')]=_0x216b69[_0x84f9('0x33')]['length']?_0x216b69[_0x84f9('0x33')]:_0x56ae99[_0x84f9('0x30')];if(!_0x4b4b60['query'][_0x84f9('0x36')]('nolimit')){_0x216b69[_0x84f9('0x20')]=qs['limit'](_0x4b4b60[_0x84f9('0x31')]['limit']);_0x216b69[_0x84f9('0x1e')]=qs[_0x84f9('0x1e')](_0x4b4b60[_0x84f9('0x31')]['offset']);}_0x216b69[_0x84f9('0x37')]=qs['sort'](_0x4b4b60[_0x84f9('0x31')][_0x84f9('0x38')]);_0x216b69[_0x84f9('0x39')]=qs[_0x84f9('0x32')](_[_0x84f9('0x3a')](_0x4b4b60[_0x84f9('0x31')],_0x56ae99[_0x84f9('0x32')]),_0x304e1e);if(_0x4b4b60[_0x84f9('0x31')][_0x84f9('0x3b')]){_0x216b69['where']=_[_0x84f9('0x3c')](_0x216b69[_0x84f9('0x39')],{'$or':_['map'](_0x304e1e,function(_0x5d79e1){if(_0x5d79e1[_0x84f9('0x3d')]!=='VIRTUAL'){var _0x488f6d={};_0x488f6d[_0x5d79e1[_0x84f9('0x29')]]={'$like':'%'+_0x4b4b60['query']['filter']+'%'};return _0x488f6d;}})});}_0x216b69=_[_0x84f9('0x3c')]({},_0x216b69,_0x4b4b60[_0x84f9('0x3e')]);var _0x25e51c={'where':_0x216b69[_0x84f9('0x39')]};return db[_0x84f9('0x2d')]['count'](_0x25e51c)[_0x84f9('0x26')](function(_0x40633a){_0x29bec3[_0x84f9('0x21')]=_0x40633a;if(_0x4b4b60[_0x84f9('0x31')][_0x84f9('0x3f')]){_0x216b69[_0x84f9('0x40')]=[{'all':!![]}];}return db['FaxApplication']['findAll'](_0x216b69);})[_0x84f9('0x26')](function(_0x57a9b3){_0x29bec3['rows']=_0x57a9b3;return _0x29bec3;})[_0x84f9('0x26')](respondWithFilteredResult(_0x16894a,_0x216b69))[_0x84f9('0x41')](handleError(_0x16894a,null));};exports[_0x84f9('0x42')]=function(_0x409c7c,_0xf14a78){var _0xa2daf3={'raw':!![],'where':{'id':_0x409c7c[_0x84f9('0x43')]['id']}},_0x368a12={};_0x368a12[_0x84f9('0x30')]=_[_0x84f9('0x44')](db[_0x84f9('0x2d')][_0x84f9('0x2e')]);_0x368a12['query']=_[_0x84f9('0x44')](_0x409c7c[_0x84f9('0x31')]);_0x368a12[_0x84f9('0x32')]=_[_0x84f9('0x34')](_0x368a12[_0x84f9('0x30')],_0x368a12[_0x84f9('0x31')]);_0xa2daf3[_0x84f9('0x33')]=_[_0x84f9('0x34')](_0x368a12[_0x84f9('0x30')],qs['fields'](_0x409c7c[_0x84f9('0x31')][_0x84f9('0x35')]));_0xa2daf3[_0x84f9('0x33')]=_0xa2daf3[_0x84f9('0x33')][_0x84f9('0x45')]?_0xa2daf3[_0x84f9('0x33')]:_0x368a12[_0x84f9('0x30')];if(_0x409c7c[_0x84f9('0x31')][_0x84f9('0x3f')]){_0xa2daf3[_0x84f9('0x40')]=[{'all':!![]}];}_0xa2daf3=_[_0x84f9('0x3c')]({},_0xa2daf3,_0x409c7c[_0x84f9('0x3e')]);return db[_0x84f9('0x2d')][_0x84f9('0x46')](_0xa2daf3)[_0x84f9('0x26')](handleEntityNotFound(_0xf14a78,null))[_0x84f9('0x26')](respondWithResult(_0xf14a78,null))[_0x84f9('0x41')](handleError(_0xf14a78,null));};exports[_0x84f9('0x47')]=function(_0x531ae6,_0x10bef7){return db[_0x84f9('0x2d')]['create'](_0x531ae6[_0x84f9('0x48')],{})[_0x84f9('0x26')](respondWithResult(_0x10bef7,0xc9))[_0x84f9('0x41')](handleError(_0x10bef7,null));};exports[_0x84f9('0x49')]=function(_0x4033fa,_0x4f6b39){if(_0x4033fa['body']['id']){delete _0x4033fa['body']['id'];}return db[_0x84f9('0x2d')][_0x84f9('0x46')]({'where':{'id':_0x4033fa[_0x84f9('0x43')]['id']}})['then'](handleEntityNotFound(_0x4f6b39,null))[_0x84f9('0x26')](saveUpdates(_0x4033fa[_0x84f9('0x48')],null))['then'](respondWithResult(_0x4f6b39,null))['catch'](handleError(_0x4f6b39,null));};exports[_0x84f9('0x27')]=function(_0x34ef26,_0x2e345a){return db['FaxApplication'][_0x84f9('0x46')]({'where':{'id':_0x34ef26[_0x84f9('0x43')]['id']}})['then'](handleEntityNotFound(_0x2e345a,null))[_0x84f9('0x26')](removeEntity(_0x2e345a,null))[_0x84f9('0x41')](handleError(_0x2e345a,null));}; \ No newline at end of file +var _0xaf83=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','options','includeAll','findAll','catch','show','params','find','create','body','update','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware'];(function(_0x312120,_0x3a1815){var _0x59997d=function(_0x36ae94){while(--_0x36ae94){_0x312120['push'](_0x312120['shift']());}};_0x59997d(++_0x3a1815);}(_0xaf83,0x1e6));var _0x3af8=function(_0x1deba9,_0x42ec49){_0x1deba9=_0x1deba9-0x0;var _0xda60c2=_0xaf83[_0x1deba9];return _0xda60c2;};'use strict';var emlformat=require(_0x3af8('0x0'));var rimraf=require(_0x3af8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3af8('0x2'));var rp=require(_0x3af8('0x3'));var moment=require('moment');var BPromise=require(_0x3af8('0x4'));var Mustache=require(_0x3af8('0x5'));var util=require('util');var path=require(_0x3af8('0x6'));var sox=require(_0x3af8('0x7'));var csv=require(_0x3af8('0x8'));var ejs=require(_0x3af8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3af8('0xa'));var squel=require('squel');var crypto=require(_0x3af8('0xb'));var jsforce=require(_0x3af8('0xc'));var deskjs=require(_0x3af8('0xd'));var toCsv=require(_0x3af8('0x8'));var querystring=require('querystring');var Papa=require(_0x3af8('0xe'));var Redis=require(_0x3af8('0xf'));var authService=require(_0x3af8('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3af8('0x11'));var logger=require(_0x3af8('0x12'))(_0x3af8('0x13'));var utils=require(_0x3af8('0x14'));var config=require(_0x3af8('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x3af8('0x16'))['db'];function respondWithStatusCode(_0x485b57,_0x481da8){_0x481da8=_0x481da8||0xcc;return function(_0x135d7e){if(_0x135d7e){return _0x485b57['sendStatus'](_0x481da8);}return _0x485b57['status'](_0x481da8)[_0x3af8('0x17')]();};}function respondWithResult(_0x19f6d8,_0x282515){_0x282515=_0x282515||0xc8;return function(_0x80a73a){if(_0x80a73a){return _0x19f6d8['status'](_0x282515)[_0x3af8('0x18')](_0x80a73a);}};}function respondWithFilteredResult(_0x4a536f,_0x1d5162){return function(_0x1f98cf){if(_0x1f98cf){var _0x224390=typeof _0x1d5162[_0x3af8('0x19')]===_0x3af8('0x1a')&&typeof _0x1d5162[_0x3af8('0x1b')]===_0x3af8('0x1a');var _0x4b1f46=_0x1f98cf[_0x3af8('0x1c')];var _0x2715df=_0x224390?0x0:_0x1d5162[_0x3af8('0x19')];var _0x18a611=_0x224390?_0x1f98cf['count']:_0x1d5162[_0x3af8('0x19')]+_0x1d5162[_0x3af8('0x1b')];var _0x4a7409;if(_0x18a611>=_0x4b1f46){_0x18a611=_0x4b1f46;_0x4a7409=0xc8;}else{_0x4a7409=0xce;}_0x4a536f[_0x3af8('0x1d')](_0x4a7409);return _0x4a536f['set'](_0x3af8('0x1e'),_0x2715df+'-'+_0x18a611+'/'+_0x4b1f46)[_0x3af8('0x18')](_0x1f98cf);}return null;};}function patchUpdates(_0x5c8824){return function(_0x341cd8){try{jsonpatch[_0x3af8('0x1f')](_0x341cd8,_0x5c8824,!![]);}catch(_0x4679c1){return BPromise[_0x3af8('0x20')](_0x4679c1);}return _0x341cd8[_0x3af8('0x21')]();};}function saveUpdates(_0x11cc3a,_0x583c9b){return function(_0x4c75cb){if(_0x4c75cb){return _0x4c75cb['update'](_0x11cc3a)[_0x3af8('0x22')](function(_0x17b814){return _0x17b814;});}return null;};}function removeEntity(_0x36e541,_0x5858da){return function(_0x2c0197){if(_0x2c0197){return _0x2c0197[_0x3af8('0x23')]()[_0x3af8('0x22')](function(){_0x36e541[_0x3af8('0x1d')](0xcc)[_0x3af8('0x17')]();});}};}function handleEntityNotFound(_0x25f7f3,_0x217619){return function(_0x21a80b){if(!_0x21a80b){_0x25f7f3['sendStatus'](0x194);}return _0x21a80b;};}function handleError(_0x1bf593,_0xb48f4a){_0xb48f4a=_0xb48f4a||0x1f4;return function(_0x329eb4){logger[_0x3af8('0x24')](_0x329eb4[_0x3af8('0x25')]);if(_0x329eb4[_0x3af8('0x26')]){delete _0x329eb4[_0x3af8('0x26')];}_0x1bf593[_0x3af8('0x1d')](_0xb48f4a)[_0x3af8('0x27')](_0x329eb4);};}exports[_0x3af8('0x28')]=function(_0x5bf32e,_0x3be522){var _0x24e2e6={},_0x1f6658={},_0x50336c={'count':0x0,'rows':[]};var _0x4ffcfb=_[_0x3af8('0x29')](db[_0x3af8('0x2a')][_0x3af8('0x2b')],function(_0x4d59f3){return{'name':_0x4d59f3[_0x3af8('0x2c')],'type':_0x4d59f3[_0x3af8('0x2d')][_0x3af8('0x2e')]};});_0x1f6658[_0x3af8('0x2f')]=_['map'](_0x4ffcfb,_0x3af8('0x26'));_0x1f6658[_0x3af8('0x30')]=_[_0x3af8('0x31')](_0x5bf32e['query']);_0x1f6658['filters']=_['intersection'](_0x1f6658[_0x3af8('0x2f')],_0x1f6658[_0x3af8('0x30')]);_0x24e2e6[_0x3af8('0x32')]=_[_0x3af8('0x33')](_0x1f6658['model'],qs[_0x3af8('0x34')](_0x5bf32e[_0x3af8('0x30')][_0x3af8('0x34')]));_0x24e2e6[_0x3af8('0x32')]=_0x24e2e6[_0x3af8('0x32')][_0x3af8('0x35')]?_0x24e2e6[_0x3af8('0x32')]:_0x1f6658['model'];if(!_0x5bf32e['query'][_0x3af8('0x36')]('nolimit')){_0x24e2e6[_0x3af8('0x1b')]=qs[_0x3af8('0x1b')](_0x5bf32e['query'][_0x3af8('0x1b')]);_0x24e2e6[_0x3af8('0x19')]=qs['offset'](_0x5bf32e[_0x3af8('0x30')]['offset']);}_0x24e2e6[_0x3af8('0x37')]=qs[_0x3af8('0x38')](_0x5bf32e[_0x3af8('0x30')][_0x3af8('0x38')]);_0x24e2e6[_0x3af8('0x39')]=qs['filters'](_[_0x3af8('0x3a')](_0x5bf32e[_0x3af8('0x30')],_0x1f6658[_0x3af8('0x3b')]),_0x4ffcfb);if(_0x5bf32e[_0x3af8('0x30')][_0x3af8('0x3c')]){_0x24e2e6[_0x3af8('0x39')]=_[_0x3af8('0x3d')](_0x24e2e6[_0x3af8('0x39')],{'$or':_[_0x3af8('0x29')](_0x4ffcfb,function(_0x589998){if(_0x589998[_0x3af8('0x2d')]!=='VIRTUAL'){var _0x49f0f9={};_0x49f0f9[_0x589998['name']]={'$like':'%'+_0x5bf32e[_0x3af8('0x30')]['filter']+'%'};return _0x49f0f9;}})});}_0x24e2e6=_[_0x3af8('0x3d')]({},_0x24e2e6,_0x5bf32e[_0x3af8('0x3e')]);var _0x14b694={'where':_0x24e2e6[_0x3af8('0x39')]};return db[_0x3af8('0x2a')]['count'](_0x14b694)[_0x3af8('0x22')](function(_0x47c83b){_0x50336c[_0x3af8('0x1c')]=_0x47c83b;if(_0x5bf32e[_0x3af8('0x30')][_0x3af8('0x3f')]){_0x24e2e6['include']=[{'all':!![]}];}return db[_0x3af8('0x2a')][_0x3af8('0x40')](_0x24e2e6);})[_0x3af8('0x22')](function(_0x2177a8){_0x50336c['rows']=_0x2177a8;return _0x50336c;})[_0x3af8('0x22')](respondWithFilteredResult(_0x3be522,_0x24e2e6))[_0x3af8('0x41')](handleError(_0x3be522,null));};exports[_0x3af8('0x42')]=function(_0x5e0a7b,_0x5df46a){var _0x2fdf4d={'raw':!![],'where':{'id':_0x5e0a7b[_0x3af8('0x43')]['id']}},_0xe4fc82={};_0xe4fc82[_0x3af8('0x2f')]=_[_0x3af8('0x31')](db['FaxApplication'][_0x3af8('0x2b')]);_0xe4fc82[_0x3af8('0x30')]=_['keys'](_0x5e0a7b[_0x3af8('0x30')]);_0xe4fc82[_0x3af8('0x3b')]=_['intersection'](_0xe4fc82[_0x3af8('0x2f')],_0xe4fc82[_0x3af8('0x30')]);_0x2fdf4d['attributes']=_['intersection'](_0xe4fc82['model'],qs['fields'](_0x5e0a7b[_0x3af8('0x30')]['fields']));_0x2fdf4d[_0x3af8('0x32')]=_0x2fdf4d['attributes'][_0x3af8('0x35')]?_0x2fdf4d[_0x3af8('0x32')]:_0xe4fc82[_0x3af8('0x2f')];if(_0x5e0a7b[_0x3af8('0x30')][_0x3af8('0x3f')]){_0x2fdf4d['include']=[{'all':!![]}];}_0x2fdf4d=_[_0x3af8('0x3d')]({},_0x2fdf4d,_0x5e0a7b[_0x3af8('0x3e')]);return db[_0x3af8('0x2a')][_0x3af8('0x44')](_0x2fdf4d)[_0x3af8('0x22')](handleEntityNotFound(_0x5df46a,null))[_0x3af8('0x22')](respondWithResult(_0x5df46a,null))[_0x3af8('0x41')](handleError(_0x5df46a,null));};exports[_0x3af8('0x45')]=function(_0x342160,_0x43e054){return db['FaxApplication'][_0x3af8('0x45')](_0x342160[_0x3af8('0x46')],{})[_0x3af8('0x22')](respondWithResult(_0x43e054,0xc9))[_0x3af8('0x41')](handleError(_0x43e054,null));};exports[_0x3af8('0x47')]=function(_0x2e37f5,_0x331e55){if(_0x2e37f5[_0x3af8('0x46')]['id']){delete _0x2e37f5[_0x3af8('0x46')]['id'];}return db[_0x3af8('0x2a')][_0x3af8('0x44')]({'where':{'id':_0x2e37f5[_0x3af8('0x43')]['id']}})['then'](handleEntityNotFound(_0x331e55,null))['then'](saveUpdates(_0x2e37f5[_0x3af8('0x46')],null))[_0x3af8('0x22')](respondWithResult(_0x331e55,null))[_0x3af8('0x41')](handleError(_0x331e55,null));};exports[_0x3af8('0x23')]=function(_0x13a061,_0x5947c2){return db[_0x3af8('0x2a')]['find']({'where':{'id':_0x13a061['params']['id']}})[_0x3af8('0x22')](handleEntityNotFound(_0x5947c2,null))[_0x3af8('0x22')](removeEntity(_0x5947c2,null))['catch'](handleError(_0x5947c2,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 1badffe..16be9b3 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 _0x5534=['request-promise','../../config/environment','./faxApplication.attributes','exports','fax_applications','utf8mb4','lodash','../../config/logger'];(function(_0x10e40a,_0x2d49a1){var _0x29bde8=function(_0x187542){while(--_0x187542){_0x10e40a['push'](_0x10e40a['shift']());}};_0x29bde8(++_0x2d49a1);}(_0x5534,0x17e));var _0x4553=function(_0x3c3862,_0x2954f6){_0x3c3862=_0x3c3862-0x0;var _0x47aeb0=_0x5534[_0x3c3862];return _0x47aeb0;};'use strict';var _=require(_0x4553('0x0'));var util=require('util');var logger=require(_0x4553('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4553('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4553('0x3'));var attributes=require(_0x4553('0x4'));module[_0x4553('0x5')]=function(_0x143bc3,_0x3fb4f4){return _0x143bc3['define']('FaxApplication',attributes,{'tableName':_0x4553('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4553('0x7'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xdca0=['define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./faxApplication.attributes','exports'];(function(_0x4a4922,_0x82cb8f){var _0x55a8c6=function(_0x59712e){while(--_0x59712e){_0x4a4922['push'](_0x4a4922['shift']());}};_0x55a8c6(++_0x82cb8f);}(_0xdca0,0x139));var _0x0dca=function(_0x5b8f6d,_0x15ecd0){_0x5b8f6d=_0x5b8f6d-0x0;var _0x729fba=_0xdca0[_0x5b8f6d];return _0x729fba;};'use strict';var _=require(_0x0dca('0x0'));var util=require('util');var logger=require(_0x0dca('0x1'))(_0x0dca('0x2'));var moment=require(_0x0dca('0x3'));var BPromise=require(_0x0dca('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0dca('0x5'));var config=require(_0x0dca('0x6'));var attributes=require(_0x0dca('0x7'));module[_0x0dca('0x8')]=function(_0x53b1d8,_0x2f1830){return _0x53b1d8[_0x0dca('0x9')](_0x0dca('0xa'),attributes,{'tableName':_0x0dca('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0dca('0xc'),'collate':_0x0dca('0xd')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index b4aa63b..e32becd 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 _0x0bb2=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxApplication','body','options','raw','where','attributes','then','debug'];(function(_0x1b7548,_0x42a578){var _0x4b0742=function(_0x42b909){while(--_0x42b909){_0x1b7548['push'](_0x1b7548['shift']());}};_0x4b0742(++_0x42a578);}(_0x0bb2,0x179));var _0x20bb=function(_0x2c1796,_0x2d915f){_0x2c1796=_0x2c1796-0x0;var _0x5097eb=_0x0bb2[_0x2c1796];return _0x5097eb;};'use strict';var _=require('lodash');var util=require(_0x20bb('0x0'));var moment=require(_0x20bb('0x1'));var BPromise=require(_0x20bb('0x2'));var rs=require(_0x20bb('0x3'));var fs=require('fs');var Redis=require(_0x20bb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x20bb('0x5'));var logger=require(_0x20bb('0x6'))(_0x20bb('0x7'));var config=require(_0x20bb('0x8'));var jayson=require(_0x20bb('0x9'));var client=jayson['client'][_0x20bb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe0fe31,_0x3a8f70,_0x3af192){return new BPromise(function(_0x1079f4,_0x50cefb){return client['request'](_0xe0fe31,_0x3af192)['then'](function(_0x2dc6f2){logger[_0x20bb('0xb')](_0x20bb('0xc'),_0x3a8f70,_0x20bb('0xd'));logger['debug'](_0x20bb('0xe'),_0x3a8f70,_0x20bb('0xd'),JSON[_0x20bb('0xf')](_0x2dc6f2));if(_0x2dc6f2[_0x20bb('0x10')]){if(_0x2dc6f2[_0x20bb('0x10')][_0x20bb('0x11')]===0x1f4){logger[_0x20bb('0x10')](_0x20bb('0xc'),_0x3a8f70,_0x2dc6f2[_0x20bb('0x10')]['message']);return _0x50cefb(_0x2dc6f2[_0x20bb('0x10')][_0x20bb('0x12')]);}logger[_0x20bb('0x10')](_0x20bb('0xc'),_0x3a8f70,_0x2dc6f2[_0x20bb('0x10')][_0x20bb('0x12')]);return _0x1079f4(_0x2dc6f2[_0x20bb('0x10')][_0x20bb('0x12')]);}else{logger['info']('FaxApplication,\x20%s,\x20%s',_0x3a8f70,_0x20bb('0xd'));_0x1079f4(_0x2dc6f2[_0x20bb('0x13')][_0x20bb('0x12')]);}})[_0x20bb('0x14')](function(_0x3f5a17){logger[_0x20bb('0x10')](_0x20bb('0xc'),_0x3a8f70,_0x3f5a17);_0x50cefb(_0x3f5a17);});});}exports[_0x20bb('0x15')]=function(_0xc96d8d){var _0x2da82e=this;return new Promise(function(_0x1bd1f0,_0x38ed98){return db['FaxApplication']['update'](_0xc96d8d[_0x20bb('0x16')],{'raw':_0xc96d8d[_0x20bb('0x17')]?_0xc96d8d['options'][_0x20bb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc96d8d[_0x20bb('0x17')]?_0xc96d8d[_0x20bb('0x17')][_0x20bb('0x19')]||null:null,'attributes':_0xc96d8d[_0x20bb('0x17')]?_0xc96d8d['options'][_0x20bb('0x1a')]||null:null,'limit':_0xc96d8d[_0x20bb('0x17')]?_0xc96d8d['options']['limit']||null:null})[_0x20bb('0x1b')](function(_0x24c481){logger[_0x20bb('0xb')]('UpdateFaxApplication',_0xc96d8d);logger[_0x20bb('0x1c')](_0x20bb('0x15'),_0xc96d8d,JSON[_0x20bb('0xf')](_0x24c481));_0x1bd1f0(_0x24c481);})['catch'](function(_0x3f36a8){logger[_0x20bb('0x10')]('UpdateFaxApplication',_0x3f36a8[_0x20bb('0x12')],_0xc96d8d);_0x38ed98(_0x2da82e[_0x20bb('0x10')](0x1f4,_0x3f36a8[_0x20bb('0x12')]));});});}; \ No newline at end of file +var _0x5c6e=['options','raw','where','attributes','lodash','util','moment','bluebird','randomstring','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','FaxApplication,\x20%s,\x20%s','message','result','catch','UpdateFaxApplication','body'];(function(_0x38dcde,_0x321efd){var _0x20bc51=function(_0x174ae2){while(--_0x174ae2){_0x38dcde['push'](_0x38dcde['shift']());}};_0x20bc51(++_0x321efd);}(_0x5c6e,0x11c));var _0xe5c6=function(_0xb301d4,_0x27ed18){_0xb301d4=_0xb301d4-0x0;var _0x3b5bde=_0x5c6e[_0xb301d4];return _0x3b5bde;};'use strict';var _=require(_0xe5c6('0x0'));var util=require(_0xe5c6('0x1'));var moment=require(_0xe5c6('0x2'));var BPromise=require(_0xe5c6('0x3'));var rs=require(_0xe5c6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe5c6('0x5'));var config=require(_0xe5c6('0x6'));var jayson=require(_0xe5c6('0x7'));var client=jayson[_0xe5c6('0x8')][_0xe5c6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3bcdbe,_0x4f38d4,_0x1c036d){return new BPromise(function(_0x5a5901,_0x1c161d){return client[_0xe5c6('0xa')](_0x3bcdbe,_0x1c036d)[_0xe5c6('0xb')](function(_0x33b447){logger[_0xe5c6('0xc')]('FaxApplication,\x20%s,\x20%s',_0x4f38d4,_0xe5c6('0xd'));logger[_0xe5c6('0xe')](_0xe5c6('0xf'),_0x4f38d4,_0xe5c6('0xd'),JSON[_0xe5c6('0x10')](_0x33b447));if(_0x33b447[_0xe5c6('0x11')]){if(_0x33b447[_0xe5c6('0x11')]['code']===0x1f4){logger[_0xe5c6('0x11')](_0xe5c6('0x12'),_0x4f38d4,_0x33b447[_0xe5c6('0x11')]['message']);return _0x1c161d(_0x33b447[_0xe5c6('0x11')][_0xe5c6('0x13')]);}logger[_0xe5c6('0x11')](_0xe5c6('0x12'),_0x4f38d4,_0x33b447['error'][_0xe5c6('0x13')]);return _0x5a5901(_0x33b447[_0xe5c6('0x11')][_0xe5c6('0x13')]);}else{logger[_0xe5c6('0xc')]('FaxApplication,\x20%s,\x20%s',_0x4f38d4,'request\x20sent');_0x5a5901(_0x33b447[_0xe5c6('0x14')][_0xe5c6('0x13')]);}})[_0xe5c6('0x15')](function(_0x31ecd4){logger[_0xe5c6('0x11')](_0xe5c6('0x12'),_0x4f38d4,_0x31ecd4);_0x1c161d(_0x31ecd4);});});}exports[_0xe5c6('0x16')]=function(_0xf1ec98){var _0x509aee=this;return new Promise(function(_0x3811fb,_0xccd52a){return db['FaxApplication']['update'](_0xf1ec98[_0xe5c6('0x17')],{'raw':_0xf1ec98['options']?_0xf1ec98[_0xe5c6('0x18')][_0xe5c6('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf1ec98[_0xe5c6('0x18')]?_0xf1ec98[_0xe5c6('0x18')][_0xe5c6('0x1a')]||null:null,'attributes':_0xf1ec98[_0xe5c6('0x18')]?_0xf1ec98[_0xe5c6('0x18')][_0xe5c6('0x1b')]||null:null,'limit':_0xf1ec98[_0xe5c6('0x18')]?_0xf1ec98[_0xe5c6('0x18')]['limit']||null:null})[_0xe5c6('0xb')](function(_0x4c61af){logger[_0xe5c6('0xc')](_0xe5c6('0x16'),_0xf1ec98);logger[_0xe5c6('0xe')](_0xe5c6('0x16'),_0xf1ec98,JSON[_0xe5c6('0x10')](_0x4c61af));_0x3811fb(_0x4c61af);})[_0xe5c6('0x15')](function(_0x52df61){logger['error']('UpdateFaxApplication',_0x52df61[_0xe5c6('0x13')],_0xf1ec98);_0xccd52a(_0x509aee[_0xe5c6('0x11')](0x1f4,_0x52df61[_0xe5c6('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index e597af8..3dd4406 100644 --- a/server/api/faxApplication/index.js +++ b/server/api/faxApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4024=['express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','update','destroy','exports','multer','util','connect-timeout'];(function(_0x4830b7,_0x1a2ecc){var _0x5828a2=function(_0x16304e){while(--_0x16304e){_0x4830b7['push'](_0x4830b7['shift']());}};_0x5828a2(++_0x1a2ecc);}(_0x4024,0x89));var _0x4402=function(_0x112462,_0xe2ede){_0x112462=_0x112462-0x0;var _0x27bedc=_0x4024[_0x112462];return _0x27bedc;};'use strict';var multer=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var path=require('path');var timeout=require(_0x4402('0x2'));var express=require(_0x4402('0x3'));var router=express['Router']();var fs_extra=require(_0x4402('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4402('0x5'));var config=require(_0x4402('0x6'));var controller=require('./faxApplication.controller');router['get']('/',auth[_0x4402('0x7')](),controller[_0x4402('0x8')]);router[_0x4402('0x9')]('/:id',auth[_0x4402('0x7')](),controller['show']);router['post']('/',auth[_0x4402('0x7')](),controller['create']);router['put'](_0x4402('0xa'),auth['isAuthenticated'](),controller[_0x4402('0xb')]);router['delete'](_0x4402('0xa'),auth['isAuthenticated'](),controller[_0x4402('0xc')]);module[_0x4402('0xd')]=router; \ No newline at end of file +var _0x4024=['express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','update','destroy','exports','multer','util','connect-timeout'];(function(_0xb09560,_0x4ab514){var _0x5bed15=function(_0x34363f){while(--_0x34363f){_0xb09560['push'](_0xb09560['shift']());}};_0x5bed15(++_0x4ab514);}(_0x4024,0x89));var _0x4402=function(_0x2252a1,_0x42aa3c){_0x2252a1=_0x2252a1-0x0;var _0x468d05=_0x4024[_0x2252a1];return _0x468d05;};'use strict';var multer=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var path=require('path');var timeout=require(_0x4402('0x2'));var express=require(_0x4402('0x3'));var router=express['Router']();var fs_extra=require(_0x4402('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4402('0x5'));var config=require(_0x4402('0x6'));var controller=require('./faxApplication.controller');router['get']('/',auth[_0x4402('0x7')](),controller[_0x4402('0x8')]);router[_0x4402('0x9')]('/:id',auth[_0x4402('0x7')](),controller['show']);router['post']('/',auth[_0x4402('0x7')](),controller['create']);router['put'](_0x4402('0xa'),auth['isAuthenticated'](),controller[_0x4402('0xb')]);router['delete'](_0x4402('0xa'),auth['isAuthenticated'](),controller[_0x4402('0xc')]);module[_0x4402('0xd')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 1dffd03..130e5a3 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 _0xb889=['ENUM','out','sequelize','exports','DATE','STRING'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0xb889,0x10a));var _0x9b88=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xb889[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require(_0x9b88('0x0'));module[_0x9b88('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9b88('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x9b88('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x9b88('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x9b88('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x9b88('0x4')]('in',_0x9b88('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xddf1=['sequelize','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x2722c3,_0x1a1b6a){var _0x590fc7=function(_0x33b0d6){while(--_0x33b0d6){_0x2722c3['push'](_0x2722c3['shift']());}};_0x590fc7(++_0x1a1b6a);}(_0xddf1,0x1b2));var _0x1ddf=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xddf1[_0x3d42d8];return _0x27fc41;};'use strict';var Sequelize=require(_0x1ddf('0x0'));module[_0x1ddf('0x1')]={'closed':{'type':Sequelize[_0x1ddf('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1ddf('0x3')]},'disposition':{'type':Sequelize[_0x1ddf('0x4')]},'secondDisposition':{'type':Sequelize[_0x1ddf('0x4')]},'thirdDisposition':{'type':Sequelize[_0x1ddf('0x4')]},'note':{'type':Sequelize[_0x1ddf('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x1ddf('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x1ddf('0x5')]('in',_0x1ddf('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1ddf('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x1ddf('0x5')]('in','out'),'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 bcb6606..d8adac5 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 _0x8eed=['set','json','update','then','destroy','stack','name','send','index','map','FaxInteraction','rawAttributes','type','key','getOptions','findAll','fax','catch','show','keys','query','filters','intersection','model','attributes','fields','length','includeAll','include','merge','options','find','create','body','params','describe','FaxMessage','addMessage','ids','omit','getMessages','findOne','hasOwnProperty','order','pick','where','FaxInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','spread','color','emit','faxInteractionTags:save','removeTags','unix','join','root','server','files','attachments','transcript-%d-%s.zip','push','Attachment','Messages','mkdirSync','createReadStream','pipe','createWriteStream','basename','resolve','download','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','ioredis','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count'];(function(_0x59bb3c,_0x370e3e){var _0x2192de=function(_0x2426d2){while(--_0x2426d2){_0x59bb3c['push'](_0x59bb3c['shift']());}};_0x2192de(++_0x370e3e);}(_0x8eed,0xb2));var _0xd8ee=function(_0x58d70a,_0x4a111e){_0x58d70a=_0x58d70a-0x0;var _0x1a4cc7=_0x8eed[_0x58d70a];return _0x1a4cc7;};'use strict';var rimraf=require(_0xd8ee('0x0'));var zipdir=require(_0xd8ee('0x1'));var moment=require(_0xd8ee('0x2'));var BPromise=require(_0xd8ee('0x3'));var util=require(_0xd8ee('0x4'));var path=require(_0xd8ee('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xd8ee('0x6'));var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var logger=require(_0xd8ee('0x7'))(_0xd8ee('0x8'));var config=require('../../config/environment');var db=require(_0xd8ee('0x9'))['db'];config[_0xd8ee('0xa')]=_['defaults'](config['redis'],{'host':_0xd8ee('0xb'),'port':0x18eb});var socket=require(_0xd8ee('0xc'))(new Redis(config[_0xd8ee('0xa')]));require(_0xd8ee('0xd'))[_0xd8ee('0xe')](socket);function respondWithStatusCode(_0x224844,_0x4a7cea){_0x4a7cea=_0x4a7cea||0xcc;return function(_0x3a8c27){if(_0x3a8c27){return _0x224844[_0xd8ee('0xf')](_0x4a7cea);}return _0x224844[_0xd8ee('0x10')](_0x4a7cea)[_0xd8ee('0x11')]();};}function respondWithResult(_0x23534f,_0x14e6a3){_0x14e6a3=_0x14e6a3||0xc8;return function(_0x21c996){if(_0x21c996){return _0x23534f[_0xd8ee('0x10')](_0x14e6a3)['json'](_0x21c996);}};}function respondWithFilteredResult(_0x563cd2,_0x2abe49){return function(_0x85203e){if(_0x85203e){var _0x1d16c6=typeof _0x2abe49[_0xd8ee('0x12')]===_0xd8ee('0x13')&&typeof _0x2abe49[_0xd8ee('0x14')]===_0xd8ee('0x13');var _0x28ac1b=_0x85203e[_0xd8ee('0x15')];var _0xac8948=_0x1d16c6?0x0:_0x2abe49['offset'];var _0x32269c=_0x1d16c6?_0x85203e['count']:_0x2abe49[_0xd8ee('0x12')]+_0x2abe49['limit'];var _0x4f9960;if(_0x32269c>=_0x28ac1b){_0x32269c=_0x28ac1b;_0x4f9960=0xc8;}else{_0x4f9960=0xce;}_0x563cd2['status'](_0x4f9960);return _0x563cd2[_0xd8ee('0x16')]('Content-Range',_0xac8948+'-'+_0x32269c+'/'+_0x28ac1b)[_0xd8ee('0x17')](_0x85203e);}return null;};}function saveUpdates(_0x2c2d64){return function(_0x567853){if(_0x567853){return _0x567853[_0xd8ee('0x18')](_0x2c2d64)[_0xd8ee('0x19')](function(_0x3201c2){return _0x3201c2;});}return null;};}function removeEntity(_0x357f79){return function(_0x34ef5a){if(_0x34ef5a){return _0x34ef5a[_0xd8ee('0x1a')]()[_0xd8ee('0x19')](function(){_0x357f79[_0xd8ee('0x10')](0xcc)[_0xd8ee('0x11')]();});}};}function handleEntityNotFound(_0x5a2f85){return function(_0x201a5c){if(!_0x201a5c){_0x5a2f85['sendStatus'](0x194);}return _0x201a5c;};}function handleError(_0x23ab37,_0x1e5c19){_0x1e5c19=_0x1e5c19||0x1f4;return function(_0x152a40){logger['error'](_0x152a40[_0xd8ee('0x1b')]);if(_0x152a40[_0xd8ee('0x1c')]){delete _0x152a40[_0xd8ee('0x1c')];}_0x23ab37['status'](_0x1e5c19)[_0xd8ee('0x1d')](_0x152a40);};}exports[_0xd8ee('0x1e')]=function(_0x169fe7,_0x1a01c4){var _0x9d2155={};var _0x58eb41=_[_0xd8ee('0x1f')](db[_0xd8ee('0x20')][_0xd8ee('0x21')],function(_0x364eb9){return{'name':_0x364eb9['fieldName'],'type':_0x364eb9[_0xd8ee('0x22')][_0xd8ee('0x23')]};});_0x9d2155=qs[_0xd8ee('0x24')](_0x58eb41,_0x169fe7);return interaction[_0xd8ee('0x25')](_0xd8ee('0x26'),_0x169fe7['query'],_0x169fe7['user'],_0x9d2155,_0x58eb41)['then'](respondWithFilteredResult(_0x1a01c4,_0x9d2155))[_0xd8ee('0x27')](handleError(_0x1a01c4,null));};exports[_0xd8ee('0x28')]=function(_0x32737b,_0x2b8fa8){var _0x25d581={'raw':![],'where':{'id':_0x32737b['params']['id']}},_0x460061={};_0x460061['model']=_[_0xd8ee('0x29')](db[_0xd8ee('0x20')]['rawAttributes']);_0x460061[_0xd8ee('0x2a')]=_[_0xd8ee('0x29')](_0x32737b[_0xd8ee('0x2a')]);_0x460061[_0xd8ee('0x2b')]=_[_0xd8ee('0x2c')](_0x460061[_0xd8ee('0x2d')],_0x460061[_0xd8ee('0x2a')]);_0x25d581[_0xd8ee('0x2e')]=_[_0xd8ee('0x2c')](_0x460061[_0xd8ee('0x2d')],qs[_0xd8ee('0x2f')](_0x32737b[_0xd8ee('0x2a')][_0xd8ee('0x2f')]));_0x25d581[_0xd8ee('0x2e')]=_0x25d581['attributes'][_0xd8ee('0x30')]?_0x25d581[_0xd8ee('0x2e')]:_0x460061[_0xd8ee('0x2d')];if(_0x32737b[_0xd8ee('0x2a')][_0xd8ee('0x31')]){_0x25d581[_0xd8ee('0x32')]=[{'all':!![]}];}_0x25d581=_[_0xd8ee('0x33')]({},_0x25d581,_0x32737b[_0xd8ee('0x34')]);return db[_0xd8ee('0x20')][_0xd8ee('0x35')](_0x25d581)['then'](handleEntityNotFound(_0x2b8fa8,null))['then'](respondWithResult(_0x2b8fa8,null))['catch'](handleError(_0x2b8fa8,null));};exports['create']=function(_0x67e8ad,_0x3da37d){return db[_0xd8ee('0x20')][_0xd8ee('0x36')](_0x67e8ad['body'],{})[_0xd8ee('0x19')](respondWithResult(_0x3da37d,0xc9))[_0xd8ee('0x27')](handleError(_0x3da37d,null));};exports[_0xd8ee('0x18')]=function(_0x3fdac9,_0x52321b){if(_0x3fdac9[_0xd8ee('0x37')]['id']){delete _0x3fdac9['body']['id'];}return db['FaxInteraction']['find']({'where':{'id':_0x3fdac9[_0xd8ee('0x38')]['id']}})['then'](handleEntityNotFound(_0x52321b,null))[_0xd8ee('0x19')](saveUpdates(_0x3fdac9['body'],null))['then'](respondWithResult(_0x52321b,null))[_0xd8ee('0x27')](handleError(_0x52321b,null));};exports[_0xd8ee('0x1a')]=function(_0x2fcc17,_0x306f77){return db[_0xd8ee('0x20')]['find']({'where':{'id':_0x2fcc17[_0xd8ee('0x38')]['id']}})['then'](handleEntityNotFound(_0x306f77,null))['then'](removeEntity(_0x306f77,null))[_0xd8ee('0x27')](handleError(_0x306f77,null));};exports['describe']=function(_0x4fd4dc,_0x5ec9f6){return db[_0xd8ee('0x20')][_0xd8ee('0x39')]()[_0xd8ee('0x19')](respondWithResult(_0x5ec9f6,null))[_0xd8ee('0x27')](handleError(_0x5ec9f6,null));};exports['addMessage']=function(_0x5c00aa,_0x316012){return db[_0xd8ee('0x3a')][_0xd8ee('0x35')]({'where':{'id':_0x5c00aa['params']['id']}})['then'](handleEntityNotFound(_0x316012,null))[_0xd8ee('0x19')](function(_0x24ed37){if(_0x24ed37){return _0x24ed37[_0xd8ee('0x3b')](_0x5c00aa['body'][_0xd8ee('0x3c')],_[_0xd8ee('0x3d')](_0x5c00aa[_0xd8ee('0x37')],[_0xd8ee('0x3c'),'id'])||{});}})['then'](respondWithResult(_0x316012,null))[_0xd8ee('0x27')](handleError(_0x316012,null));};exports[_0xd8ee('0x3e')]=function(_0x1acfa3,_0x487d7a){var _0x39074b={'raw':![],'where':{}};var _0x23921e={};var _0xd51b53={'count':0x0,'rows':[]};return db['FaxInteraction'][_0xd8ee('0x3f')]({'where':{'id':_0x1acfa3['params']['id']}})[_0xd8ee('0x19')](handleEntityNotFound(_0x487d7a,null))[_0xd8ee('0x19')](function(_0x47c859){if(_0x47c859){_0x23921e[_0xd8ee('0x2d')]=_[_0xd8ee('0x29')](db[_0xd8ee('0x3a')][_0xd8ee('0x21')]);_0x23921e[_0xd8ee('0x2a')]=_[_0xd8ee('0x29')](_0x1acfa3[_0xd8ee('0x2a')]);_0x23921e[_0xd8ee('0x2b')]=_[_0xd8ee('0x2c')](_0x23921e[_0xd8ee('0x2d')],_0x23921e['query']);_0x39074b[_0xd8ee('0x2e')]=_[_0xd8ee('0x2c')](_0x23921e['model'],qs[_0xd8ee('0x2f')](_0x1acfa3['query'][_0xd8ee('0x2f')]));_0x39074b[_0xd8ee('0x2e')]=_0x39074b[_0xd8ee('0x2e')][_0xd8ee('0x30')]?_0x39074b['attributes']:_0x23921e[_0xd8ee('0x2d')];if(!_0x1acfa3[_0xd8ee('0x2a')][_0xd8ee('0x40')]('nolimit')){_0x39074b[_0xd8ee('0x14')]=qs[_0xd8ee('0x14')](_0x1acfa3[_0xd8ee('0x2a')][_0xd8ee('0x14')]);_0x39074b[_0xd8ee('0x12')]=qs[_0xd8ee('0x12')](_0x1acfa3[_0xd8ee('0x2a')][_0xd8ee('0x12')]);}_0x39074b[_0xd8ee('0x41')]=qs['sort'](_0x1acfa3[_0xd8ee('0x2a')]['sort']);_0x39074b['where']=qs[_0xd8ee('0x2b')](_[_0xd8ee('0x42')](_0x1acfa3['query'],_0x23921e[_0xd8ee('0x2b')]));_0x39074b[_0xd8ee('0x43')][_0xd8ee('0x44')]=_0x47c859['id'];if(_0x1acfa3[_0xd8ee('0x2a')]['filter']){_0x39074b[_0xd8ee('0x43')]=_[_0xd8ee('0x33')](_0x39074b[_0xd8ee('0x43')],{'$or':_[_0xd8ee('0x1f')](_0x39074b['attributes'],function(_0xc451fa){var _0x546f3a={};_0x546f3a[_0xc451fa]={'$like':'%'+_0x1acfa3[_0xd8ee('0x2a')][_0xd8ee('0x45')]+'%'};return _0x546f3a;})});}if(_0x1acfa3[_0xd8ee('0x2a')]['$gte']){var _0x120aa6=_0x1acfa3[_0xd8ee('0x2a')][_0xd8ee('0x46')][_0xd8ee('0x47')](',');var _0x499cb3={};_0x499cb3[_0x120aa6[0x0]]={'$gte':moment(_0x120aa6[0x1])[_0xd8ee('0x48')](_0xd8ee('0x49'))};_0x39074b[_0xd8ee('0x43')]=_[_0xd8ee('0x33')](_0x39074b[_0xd8ee('0x43')],_0x499cb3);}_0x39074b=_[_0xd8ee('0x33')]({},_0x39074b,_0x1acfa3[_0xd8ee('0x34')]);return db[_0xd8ee('0x3a')][_0xd8ee('0x15')]({'where':_0x39074b[_0xd8ee('0x43')]})[_0xd8ee('0x19')](function(_0x2ddf77){_0xd51b53['count']=_0x2ddf77;if(_0x1acfa3['query'][_0xd8ee('0x31')]){_0x39074b[_0xd8ee('0x32')]=[{'all':!![]}];}return db[_0xd8ee('0x3a')][_0xd8ee('0x25')](_0x39074b);})[_0xd8ee('0x19')](function(_0x50a15f){_0xd51b53[_0xd8ee('0x4a')]=_0x50a15f;return _0xd51b53;});}})[_0xd8ee('0x19')](respondWithFilteredResult(_0x487d7a,_0x39074b))[_0xd8ee('0x27')](handleError(_0x487d7a,null));};exports['addTags']=function(_0x362769,_0x2eaa5f){return db[_0xd8ee('0x20')][_0xd8ee('0x35')]({'where':{'id':_0x362769[_0xd8ee('0x38')]['id']}})[_0xd8ee('0x19')](handleEntityNotFound(_0x2eaa5f,null))['then'](function(_0x5f0e06){if(_0x5f0e06){return _0x5f0e06[_0xd8ee('0x4b')](_0x362769[_0xd8ee('0x37')][_0xd8ee('0x3c')],_[_0xd8ee('0x3d')](_0x362769[_0xd8ee('0x37')],[_0xd8ee('0x3c'),'id'])||{})[_0xd8ee('0x4c')](function(){return db['Tag'][_0xd8ee('0x25')]({'attributes':['id','name',_0xd8ee('0x4d')],'where':{'id':_0x362769[_0xd8ee('0x37')][_0xd8ee('0x3c')]}});})[_0xd8ee('0x19')](function(_0x230751){socket[_0xd8ee('0x4e')](_0xd8ee('0x4f'),{'id':Number(_0x362769[_0xd8ee('0x38')]['id']),'tags':_0x230751||[]});return{'id':Number(_0x362769[_0xd8ee('0x38')]['id']),'tags':_0x230751||[]};});}})[_0xd8ee('0x19')](respondWithResult(_0x2eaa5f,null))[_0xd8ee('0x27')](handleError(_0x2eaa5f,null));};exports[_0xd8ee('0x50')]=function(_0x34df21,_0x313310){return db[_0xd8ee('0x20')]['find']({'where':{'id':_0x34df21[_0xd8ee('0x38')]['id']}})[_0xd8ee('0x19')](handleEntityNotFound(_0x313310,null))[_0xd8ee('0x19')](function(_0x604bff){if(_0x604bff){return _0x604bff[_0xd8ee('0x50')](_0x34df21[_0xd8ee('0x2a')][_0xd8ee('0x3c')]);}})[_0xd8ee('0x19')](respondWithStatusCode(_0x313310,null))[_0xd8ee('0x27')](handleError(_0x313310,null));};exports['download']=function(_0x1b53a3,_0x209ce2){var _0xd5436f=moment()[_0xd8ee('0x51')]()['toString']();var _0x2b5c34=path[_0xd8ee('0x52')](config[_0xd8ee('0x53')],_0xd8ee('0x54'),_0xd8ee('0x55'),'tmp');var _0x48f25b=path[_0xd8ee('0x52')](config[_0xd8ee('0x53')],_0xd8ee('0x54'),_0xd8ee('0x55'),_0xd8ee('0x56'));var _0x9ed142=path[_0xd8ee('0x52')](_0x2b5c34,_0xd5436f);var _0x1dcda7=util[_0xd8ee('0x48')](_0xd8ee('0x57'),_0x1b53a3[_0xd8ee('0x38')]['id'],_0xd5436f);var _0x4e1638=path[_0xd8ee('0x52')](_0x2b5c34,_0x1dcda7);var _0x2c2dbc=[];_0x2c2dbc[_0xd8ee('0x58')]({'model':db[_0xd8ee('0x59')],'as':_0xd8ee('0x59'),'raw':!![]});var _0x5d6671=[{'model':db[_0xd8ee('0x3a')],'as':_0xd8ee('0x5a'),'attributes':['id',_0xd8ee('0x37'),'createdAt'],'include':_0x2c2dbc}];return db[_0xd8ee('0x20')][_0xd8ee('0x35')]({'where':{'id':_0x1b53a3['params']['id']},'include':_0x5d6671})[_0xd8ee('0x19')](handleEntityNotFound(_0x209ce2,null))[_0xd8ee('0x19')](function(_0x2cbce7){if(_0x2cbce7&&_0x2cbce7[_0xd8ee('0x5a')]){var _0x58c4c6=_0x2cbce7['get']({'plain':!![]});fs[_0xd8ee('0x5b')](_0x9ed142);for(var _0x19fcd4=0x0;_0x19fcd4<_0x58c4c6[_0xd8ee('0x5a')][_0xd8ee('0x30')];_0x19fcd4++){var _0x17430c=_0x58c4c6[_0xd8ee('0x5a')][_0x19fcd4][_0xd8ee('0x59')];if(_0x17430c){var _0xbc950b=path[_0xd8ee('0x52')](_0x48f25b,_0x17430c['basename']);if(fs['existsSync'](_0xbc950b)){fs[_0xd8ee('0x5c')](_0xbc950b)[_0xd8ee('0x5d')](fs[_0xd8ee('0x5e')](path[_0xd8ee('0x52')](_0x9ed142,_0x17430c[_0xd8ee('0x5f')])));}}}return BPromise[_0xd8ee('0x60')]()[_0xd8ee('0x19')](function(){return new BPromise(function(_0x3c4859,_0x2ac14a){zipdir(_0x9ed142,{'saveTo':_0x4e1638},function(_0xd4c630,_0x13d2d6){if(_0xd4c630)return _0x2ac14a(_0xd4c630);return _0x3c4859(_0x13d2d6);});})[_0xd8ee('0x19')](function(){return new BPromise(function(_0x2f2472,_0x5cc638){rimraf(_0x9ed142,function(_0x9aca94){if(_0x9aca94)_0x5cc638(_0x9aca94);return _0x2f2472();});});})[_0xd8ee('0x19')](function(){return _0x209ce2[_0xd8ee('0x61')](_0x4e1638,_0x1dcda7,function(_0x4a7231){if(_0x4a7231){console['log'](_0xd8ee('0x62'),_0x4a7231);}else{fs[_0xd8ee('0x63')](_0x4e1638);}});});});}else{return _0x209ce2['sendStatus'](0xc8);}})[_0xd8ee('0x27')](handleError(_0x209ce2,null));}; \ No newline at end of file +var _0x45ce=['color','emit','faxInteractionTags:save','removeTags','download','unix','files','join','root','server','attachments','push','Attachment','Messages','mkdirSync','basename','existsSync','createWriteStream','resolve','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','path','lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','name','send','index','FaxInteraction','fieldName','type','key','findAll','fax','user','catch','show','params','keys','rawAttributes','query','filters','intersection','model','attributes','fields','length','includeAll','include','merge','options','find','create','body','describe','addMessage','FaxMessage','ids','findOne','hasOwnProperty','nolimit','order','sort','where','pick','FaxInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','omit','spread','Tag'];(function(_0x33ae4e,_0x296713){var _0x49d4be=function(_0x113d53){while(--_0x113d53){_0x33ae4e['push'](_0x33ae4e['shift']());}};_0x49d4be(++_0x296713);}(_0x45ce,0x7e));var _0xe45c=function(_0x26a5c9,_0x4b19d0){_0x26a5c9=_0x26a5c9-0x0;var _0x374c47=_0x45ce[_0x26a5c9];return _0x374c47;};'use strict';var rimraf=require(_0xe45c('0x0'));var zipdir=require(_0xe45c('0x1'));var moment=require(_0xe45c('0x2'));var BPromise=require(_0xe45c('0x3'));var util=require('util');var path=require(_0xe45c('0x4'));var fs=require('fs');var _=require(_0xe45c('0x5'));var Redis=require(_0xe45c('0x6'));var interaction=require(_0xe45c('0x7'));var qs=require('../../components/parsers/qs');var logger=require(_0xe45c('0x8'))(_0xe45c('0x9'));var config=require(_0xe45c('0xa'));var db=require('../../mysqldb')['db'];config[_0xe45c('0xb')]=_[_0xe45c('0xc')](config[_0xe45c('0xb')],{'host':_0xe45c('0xd'),'port':0x18eb});var socket=require(_0xe45c('0xe'))(new Redis(config[_0xe45c('0xb')]));require(_0xe45c('0xf'))[_0xe45c('0x10')](socket);function respondWithStatusCode(_0x12dabf,_0x225e25){_0x225e25=_0x225e25||0xcc;return function(_0xb1bd13){if(_0xb1bd13){return _0x12dabf[_0xe45c('0x11')](_0x225e25);}return _0x12dabf[_0xe45c('0x12')](_0x225e25)[_0xe45c('0x13')]();};}function respondWithResult(_0x5dfd04,_0x246943){_0x246943=_0x246943||0xc8;return function(_0x11ecdd){if(_0x11ecdd){return _0x5dfd04[_0xe45c('0x12')](_0x246943)['json'](_0x11ecdd);}};}function respondWithFilteredResult(_0x5406af,_0x10bf9a){return function(_0x502c81){if(_0x502c81){var _0x294cf5=typeof _0x10bf9a[_0xe45c('0x14')]===_0xe45c('0x15')&&typeof _0x10bf9a[_0xe45c('0x16')]===_0xe45c('0x15');var _0x12d018=_0x502c81[_0xe45c('0x17')];var _0x284761=_0x294cf5?0x0:_0x10bf9a[_0xe45c('0x14')];var _0x250146=_0x294cf5?_0x502c81[_0xe45c('0x17')]:_0x10bf9a['offset']+_0x10bf9a['limit'];var _0x6dfb22;if(_0x250146>=_0x12d018){_0x250146=_0x12d018;_0x6dfb22=0xc8;}else{_0x6dfb22=0xce;}_0x5406af[_0xe45c('0x12')](_0x6dfb22);return _0x5406af[_0xe45c('0x18')](_0xe45c('0x19'),_0x284761+'-'+_0x250146+'/'+_0x12d018)['json'](_0x502c81);}return null;};}function saveUpdates(_0x18eb4d){return function(_0x4cd63d){if(_0x4cd63d){return _0x4cd63d[_0xe45c('0x1a')](_0x18eb4d)[_0xe45c('0x1b')](function(_0x2ed0ab){return _0x2ed0ab;});}return null;};}function removeEntity(_0x18893e){return function(_0x4cd7e1){if(_0x4cd7e1){return _0x4cd7e1[_0xe45c('0x1c')]()[_0xe45c('0x1b')](function(){_0x18893e[_0xe45c('0x12')](0xcc)[_0xe45c('0x13')]();});}};}function handleEntityNotFound(_0x33020d){return function(_0xbb98d2){if(!_0xbb98d2){_0x33020d['sendStatus'](0x194);}return _0xbb98d2;};}function handleError(_0x127978,_0x39e087){_0x39e087=_0x39e087||0x1f4;return function(_0xdac6f7){logger[_0xe45c('0x1d')](_0xdac6f7['stack']);if(_0xdac6f7[_0xe45c('0x1e')]){delete _0xdac6f7[_0xe45c('0x1e')];}_0x127978[_0xe45c('0x12')](_0x39e087)[_0xe45c('0x1f')](_0xdac6f7);};}exports[_0xe45c('0x20')]=function(_0xad8fc5,_0x10daa6){var _0x503fc7={};var _0x12bae6=_['map'](db[_0xe45c('0x21')]['rawAttributes'],function(_0x5ca2d9){return{'name':_0x5ca2d9[_0xe45c('0x22')],'type':_0x5ca2d9[_0xe45c('0x23')][_0xe45c('0x24')]};});_0x503fc7=qs['getOptions'](_0x12bae6,_0xad8fc5);return interaction[_0xe45c('0x25')](_0xe45c('0x26'),_0xad8fc5['query'],_0xad8fc5[_0xe45c('0x27')],_0x503fc7,_0x12bae6)['then'](respondWithFilteredResult(_0x10daa6,_0x503fc7))[_0xe45c('0x28')](handleError(_0x10daa6,null));};exports[_0xe45c('0x29')]=function(_0x5f15b3,_0x46d891){var _0x1339c9={'raw':![],'where':{'id':_0x5f15b3[_0xe45c('0x2a')]['id']}},_0x5a7271={};_0x5a7271['model']=_[_0xe45c('0x2b')](db['FaxInteraction'][_0xe45c('0x2c')]);_0x5a7271[_0xe45c('0x2d')]=_['keys'](_0x5f15b3[_0xe45c('0x2d')]);_0x5a7271[_0xe45c('0x2e')]=_[_0xe45c('0x2f')](_0x5a7271[_0xe45c('0x30')],_0x5a7271[_0xe45c('0x2d')]);_0x1339c9[_0xe45c('0x31')]=_['intersection'](_0x5a7271[_0xe45c('0x30')],qs[_0xe45c('0x32')](_0x5f15b3[_0xe45c('0x2d')][_0xe45c('0x32')]));_0x1339c9['attributes']=_0x1339c9[_0xe45c('0x31')][_0xe45c('0x33')]?_0x1339c9[_0xe45c('0x31')]:_0x5a7271[_0xe45c('0x30')];if(_0x5f15b3[_0xe45c('0x2d')][_0xe45c('0x34')]){_0x1339c9[_0xe45c('0x35')]=[{'all':!![]}];}_0x1339c9=_[_0xe45c('0x36')]({},_0x1339c9,_0x5f15b3[_0xe45c('0x37')]);return db['FaxInteraction'][_0xe45c('0x38')](_0x1339c9)['then'](handleEntityNotFound(_0x46d891,null))[_0xe45c('0x1b')](respondWithResult(_0x46d891,null))[_0xe45c('0x28')](handleError(_0x46d891,null));};exports[_0xe45c('0x39')]=function(_0x56750e,_0x47362b){return db['FaxInteraction'][_0xe45c('0x39')](_0x56750e[_0xe45c('0x3a')],{})['then'](respondWithResult(_0x47362b,0xc9))[_0xe45c('0x28')](handleError(_0x47362b,null));};exports[_0xe45c('0x1a')]=function(_0x118a47,_0x332a03){if(_0x118a47['body']['id']){delete _0x118a47[_0xe45c('0x3a')]['id'];}return db['FaxInteraction']['find']({'where':{'id':_0x118a47[_0xe45c('0x2a')]['id']}})[_0xe45c('0x1b')](handleEntityNotFound(_0x332a03,null))[_0xe45c('0x1b')](saveUpdates(_0x118a47['body'],null))[_0xe45c('0x1b')](respondWithResult(_0x332a03,null))[_0xe45c('0x28')](handleError(_0x332a03,null));};exports[_0xe45c('0x1c')]=function(_0x4a7ae7,_0xd4693a){return db[_0xe45c('0x21')][_0xe45c('0x38')]({'where':{'id':_0x4a7ae7['params']['id']}})['then'](handleEntityNotFound(_0xd4693a,null))['then'](removeEntity(_0xd4693a,null))['catch'](handleError(_0xd4693a,null));};exports['describe']=function(_0x107d2e,_0x26c145){return db[_0xe45c('0x21')][_0xe45c('0x3b')]()[_0xe45c('0x1b')](respondWithResult(_0x26c145,null))[_0xe45c('0x28')](handleError(_0x26c145,null));};exports[_0xe45c('0x3c')]=function(_0x1b54b4,_0x53d8e7){return db[_0xe45c('0x3d')][_0xe45c('0x38')]({'where':{'id':_0x1b54b4[_0xe45c('0x2a')]['id']}})[_0xe45c('0x1b')](handleEntityNotFound(_0x53d8e7,null))[_0xe45c('0x1b')](function(_0x409a27){if(_0x409a27){return _0x409a27[_0xe45c('0x3c')](_0x1b54b4[_0xe45c('0x3a')][_0xe45c('0x3e')],_['omit'](_0x1b54b4[_0xe45c('0x3a')],['ids','id'])||{});}})[_0xe45c('0x1b')](respondWithResult(_0x53d8e7,null))[_0xe45c('0x28')](handleError(_0x53d8e7,null));};exports['getMessages']=function(_0x1328cb,_0x487e53){var _0x380001={'raw':![],'where':{}};var _0x561f69={};var _0x1121ca={'count':0x0,'rows':[]};return db[_0xe45c('0x21')][_0xe45c('0x3f')]({'where':{'id':_0x1328cb[_0xe45c('0x2a')]['id']}})['then'](handleEntityNotFound(_0x487e53,null))[_0xe45c('0x1b')](function(_0x4eb3c0){if(_0x4eb3c0){_0x561f69[_0xe45c('0x30')]=_[_0xe45c('0x2b')](db[_0xe45c('0x3d')][_0xe45c('0x2c')]);_0x561f69[_0xe45c('0x2d')]=_[_0xe45c('0x2b')](_0x1328cb['query']);_0x561f69[_0xe45c('0x2e')]=_['intersection'](_0x561f69[_0xe45c('0x30')],_0x561f69['query']);_0x380001[_0xe45c('0x31')]=_[_0xe45c('0x2f')](_0x561f69['model'],qs[_0xe45c('0x32')](_0x1328cb[_0xe45c('0x2d')][_0xe45c('0x32')]));_0x380001[_0xe45c('0x31')]=_0x380001[_0xe45c('0x31')][_0xe45c('0x33')]?_0x380001[_0xe45c('0x31')]:_0x561f69[_0xe45c('0x30')];if(!_0x1328cb['query'][_0xe45c('0x40')](_0xe45c('0x41'))){_0x380001['limit']=qs[_0xe45c('0x16')](_0x1328cb[_0xe45c('0x2d')][_0xe45c('0x16')]);_0x380001['offset']=qs[_0xe45c('0x14')](_0x1328cb[_0xe45c('0x2d')]['offset']);}_0x380001[_0xe45c('0x42')]=qs[_0xe45c('0x43')](_0x1328cb[_0xe45c('0x2d')]['sort']);_0x380001[_0xe45c('0x44')]=qs[_0xe45c('0x2e')](_[_0xe45c('0x45')](_0x1328cb[_0xe45c('0x2d')],_0x561f69['filters']));_0x380001[_0xe45c('0x44')][_0xe45c('0x46')]=_0x4eb3c0['id'];if(_0x1328cb[_0xe45c('0x2d')][_0xe45c('0x47')]){_0x380001[_0xe45c('0x44')]=_['merge'](_0x380001[_0xe45c('0x44')],{'$or':_['map'](_0x380001[_0xe45c('0x31')],function(_0x296b6f){var _0x43d100={};_0x43d100[_0x296b6f]={'$like':'%'+_0x1328cb['query'][_0xe45c('0x47')]+'%'};return _0x43d100;})});}if(_0x1328cb['query'][_0xe45c('0x48')]){var _0x557013=_0x1328cb[_0xe45c('0x2d')][_0xe45c('0x48')][_0xe45c('0x49')](',');var _0x171de={};_0x171de[_0x557013[0x0]]={'$gte':moment(_0x557013[0x1])[_0xe45c('0x4a')](_0xe45c('0x4b'))};_0x380001[_0xe45c('0x44')]=_[_0xe45c('0x36')](_0x380001[_0xe45c('0x44')],_0x171de);}_0x380001=_[_0xe45c('0x36')]({},_0x380001,_0x1328cb['options']);return db[_0xe45c('0x3d')][_0xe45c('0x17')]({'where':_0x380001['where']})['then'](function(_0x2a2dad){_0x1121ca[_0xe45c('0x17')]=_0x2a2dad;if(_0x1328cb[_0xe45c('0x2d')]['includeAll']){_0x380001[_0xe45c('0x35')]=[{'all':!![]}];}return db['FaxMessage'][_0xe45c('0x25')](_0x380001);})[_0xe45c('0x1b')](function(_0x38e758){_0x1121ca[_0xe45c('0x4c')]=_0x38e758;return _0x1121ca;});}})[_0xe45c('0x1b')](respondWithFilteredResult(_0x487e53,_0x380001))[_0xe45c('0x28')](handleError(_0x487e53,null));};exports[_0xe45c('0x4d')]=function(_0x464627,_0x1ee281){return db[_0xe45c('0x21')]['find']({'where':{'id':_0x464627[_0xe45c('0x2a')]['id']}})[_0xe45c('0x1b')](handleEntityNotFound(_0x1ee281,null))[_0xe45c('0x1b')](function(_0x1d8a8d){if(_0x1d8a8d){return _0x1d8a8d[_0xe45c('0x4e')](_0x464627[_0xe45c('0x3a')][_0xe45c('0x3e')],_[_0xe45c('0x4f')](_0x464627[_0xe45c('0x3a')],[_0xe45c('0x3e'),'id'])||{})[_0xe45c('0x50')](function(){return db[_0xe45c('0x51')][_0xe45c('0x25')]({'attributes':['id',_0xe45c('0x1e'),_0xe45c('0x52')],'where':{'id':_0x464627[_0xe45c('0x3a')][_0xe45c('0x3e')]}});})[_0xe45c('0x1b')](function(_0x14e191){socket[_0xe45c('0x53')](_0xe45c('0x54'),{'id':Number(_0x464627[_0xe45c('0x2a')]['id']),'tags':_0x14e191||[]});return{'id':Number(_0x464627[_0xe45c('0x2a')]['id']),'tags':_0x14e191||[]};});}})[_0xe45c('0x1b')](respondWithResult(_0x1ee281,null))[_0xe45c('0x28')](handleError(_0x1ee281,null));};exports[_0xe45c('0x55')]=function(_0x4782e8,_0x76feed){return db[_0xe45c('0x21')]['find']({'where':{'id':_0x4782e8[_0xe45c('0x2a')]['id']}})[_0xe45c('0x1b')](handleEntityNotFound(_0x76feed,null))['then'](function(_0x137e2d){if(_0x137e2d){return _0x137e2d[_0xe45c('0x55')](_0x4782e8[_0xe45c('0x2d')][_0xe45c('0x3e')]);}})[_0xe45c('0x1b')](respondWithStatusCode(_0x76feed,null))[_0xe45c('0x28')](handleError(_0x76feed,null));};exports[_0xe45c('0x56')]=function(_0xbbe349,_0x3668c5){var _0xf71a1f=moment()[_0xe45c('0x57')]()['toString']();var _0x3c3c59=path['join'](config['root'],'server',_0xe45c('0x58'),'tmp');var _0x43429a=path[_0xe45c('0x59')](config[_0xe45c('0x5a')],_0xe45c('0x5b'),_0xe45c('0x58'),_0xe45c('0x5c'));var _0x54d9c3=path[_0xe45c('0x59')](_0x3c3c59,_0xf71a1f);var _0x231498=util['format']('transcript-%d-%s.zip',_0xbbe349[_0xe45c('0x2a')]['id'],_0xf71a1f);var _0x1358ae=path[_0xe45c('0x59')](_0x3c3c59,_0x231498);var _0x1a89a9=[];_0x1a89a9[_0xe45c('0x5d')]({'model':db['Attachment'],'as':_0xe45c('0x5e'),'raw':!![]});var _0x272260=[{'model':db['FaxMessage'],'as':_0xe45c('0x5f'),'attributes':['id',_0xe45c('0x3a'),'createdAt'],'include':_0x1a89a9}];return db[_0xe45c('0x21')]['find']({'where':{'id':_0xbbe349[_0xe45c('0x2a')]['id']},'include':_0x272260})[_0xe45c('0x1b')](handleEntityNotFound(_0x3668c5,null))[_0xe45c('0x1b')](function(_0x5aff92){if(_0x5aff92&&_0x5aff92[_0xe45c('0x5f')]){var _0x1e04e8=_0x5aff92['get']({'plain':!![]});fs[_0xe45c('0x60')](_0x54d9c3);for(var _0x4f42a1=0x0;_0x4f42a1<_0x1e04e8[_0xe45c('0x5f')][_0xe45c('0x33')];_0x4f42a1++){var _0x27ed5a=_0x1e04e8['Messages'][_0x4f42a1][_0xe45c('0x5e')];if(_0x27ed5a){var _0x135b0b=path[_0xe45c('0x59')](_0x43429a,_0x27ed5a[_0xe45c('0x61')]);if(fs[_0xe45c('0x62')](_0x135b0b)){fs['createReadStream'](_0x135b0b)['pipe'](fs[_0xe45c('0x63')](path['join'](_0x54d9c3,_0x27ed5a[_0xe45c('0x61')])));}}}return BPromise[_0xe45c('0x64')]()[_0xe45c('0x1b')](function(){return new BPromise(function(_0x34fc6d,_0x58c12e){zipdir(_0x54d9c3,{'saveTo':_0x1358ae},function(_0x5006dc,_0x29e10c){if(_0x5006dc)return _0x58c12e(_0x5006dc);return _0x34fc6d(_0x29e10c);});})[_0xe45c('0x1b')](function(){return new BPromise(function(_0x389d3b,_0x197744){rimraf(_0x54d9c3,function(_0xdef4e){if(_0xdef4e)_0x197744(_0xdef4e);return _0x389d3b();});});})['then'](function(){return _0x3668c5[_0xe45c('0x56')](_0x1358ae,_0x231498,function(_0x98c6c5){if(_0x98c6c5){console[_0xe45c('0x65')](_0xe45c('0x66'),_0x98c6c5);}else{fs[_0xe45c('0x67')](_0x1358ae);}});});});}else{return _0x3668c5['sendStatus'](0xc8);}})[_0xe45c('0x28')](handleError(_0x3668c5,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 172bcd5..bb158aa 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 _0xe126=['update','remove','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','events','../../mysqldb','FaxMessage','setMaxListeners','save'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0xe126,0x1bb));var _0x6e12=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xe126[_0x4e676e];return _0x336a3c;};'use strict';var EventEmitter=require(_0x6e12('0x0'));var FaxInteraction=require('../../mysqldb')['db']['FaxInteraction'];var FaxMessage=require(_0x6e12('0x1'))['db'][_0x6e12('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x6e12('0x3')](0x0);var events={'afterCreate':_0x6e12('0x4'),'afterUpdate':_0x6e12('0x5'),'afterDestroy':_0x6e12('0x6')};function emitEvent(_0x4bb2b2){return function(_0x5cb9f4,_0x54d706,_0x10388c){_0x5cb9f4['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x783e9e){_0x5cb9f4[_0x6e12('0x7')](_0x6e12('0x8'),_0x783e9e[_0x6e12('0x9')](function(_0x2857f0){return{'id':_0x2857f0['id']};}));return FaxMessage[_0x6e12('0xa')]({'where':{'FaxInteractionId':_0x5cb9f4['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xa85e3){_0x5cb9f4[_0x6e12('0x7')](_0x6e12('0xb'),_0xa85e3['length']);FaxInteractionEvents[_0x6e12('0xc')](_0x4bb2b2+':'+_0x5cb9f4['id'],_0x5cb9f4);FaxInteractionEvents[_0x6e12('0xc')](_0x4bb2b2,_0x5cb9f4);_0x10388c(null);})[_0x6e12('0xd')](_0x10388c(null));};}for(var e in events){if(events[_0x6e12('0xe')](e)){var event=events[e];FaxInteraction[_0x6e12('0xf')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0x7a66=['../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','map','findAll','setDataValue','unreadMessages','emit','catch','hasOwnProperty','hook','exports'];(function(_0x5864ef,_0x496812){var _0x21c244=function(_0x433f8a){while(--_0x433f8a){_0x5864ef['push'](_0x5864ef['shift']());}};_0x21c244(++_0x496812);}(_0x7a66,0x6c));var _0x67a6=function(_0x401d81,_0x4fc6f0){_0x401d81=_0x401d81-0x0;var _0x17ac0b=_0x7a66[_0x401d81];return _0x17ac0b;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x67a6('0x0'))['db'][_0x67a6('0x1')];var FaxMessage=require(_0x67a6('0x0'))['db'][_0x67a6('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x67a6('0x3')](0x0);var events={'afterCreate':_0x67a6('0x4'),'afterUpdate':_0x67a6('0x5'),'afterDestroy':_0x67a6('0x6')};function emitEvent(_0x128e20){return function(_0x2b35d4,_0x451e20,_0x113dbc){_0x2b35d4[_0x67a6('0x7')]({'attributes':['id'],'raw':!![]})[_0x67a6('0x8')](function(_0x2adf2e){_0x2b35d4['setDataValue']('Users',_0x2adf2e[_0x67a6('0x9')](function(_0x293eec){return{'id':_0x293eec['id']};}));return FaxMessage[_0x67a6('0xa')]({'where':{'FaxInteractionId':_0x2b35d4['id'],'direction':'in','read':![]},'raw':!![]});})[_0x67a6('0x8')](function(_0x559c78){_0x2b35d4[_0x67a6('0xb')](_0x67a6('0xc'),_0x559c78['length']);FaxInteractionEvents[_0x67a6('0xd')](_0x128e20+':'+_0x2b35d4['id'],_0x2b35d4);FaxInteractionEvents[_0x67a6('0xd')](_0x128e20,_0x2b35d4);_0x113dbc(null);})[_0x67a6('0xe')](_0x113dbc(null));};}for(var e in events){if(events[_0x67a6('0xf')](e)){var event=events[e];FaxInteraction[_0x67a6('0x10')](e,emitEvent(event));}}module[_0x67a6('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 39060bf..ec798a5 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 _0xb0e5=['path','../../config/environment','exports','FaxInteraction','fax_interactions','changed','closed','closedAt','format','lodash','util','../../config/logger','api','moment'];(function(_0x4979d4,_0x3de9dc){var _0x518028=function(_0x344971){while(--_0x344971){_0x4979d4['push'](_0x4979d4['shift']());}};_0x518028(++_0x3de9dc);}(_0xb0e5,0x1ad));var _0x5b0e=function(_0xb819a5,_0x40af38){_0xb819a5=_0xb819a5-0x0;var _0x27a3a0=_0xb0e5[_0xb819a5];return _0x27a3a0;};'use strict';var _=require(_0x5b0e('0x0'));var util=require(_0x5b0e('0x1'));var logger=require(_0x5b0e('0x2'))(_0x5b0e('0x3'));var moment=require(_0x5b0e('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5b0e('0x5'));var rimraf=require('rimraf');var config=require(_0x5b0e('0x6'));var attributes=require('./faxInteraction.attributes');module[_0x5b0e('0x7')]=function(_0x3f9d1b,_0x5222fe){return _0x3f9d1b['define'](_0x5b0e('0x8'),attributes,{'tableName':_0x5b0e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2e7503,_0xb3ec8d,_0x7a7cfe){if(_0x2e7503[_0x5b0e('0xa')](_0x5b0e('0xb'))){_0x2e7503[_0x5b0e('0xc')]=moment()[_0x5b0e('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x7a7cfe(null,_0x2e7503);}}});}; \ No newline at end of file +var _0xc035=['rimraf','exports','define','FaxInteraction','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc035,0xf6));var _0x5c03=function(_0xb90119,_0xfa02ab){_0xb90119=_0xb90119-0x0;var _0xf2a023=_0xc035[_0xb90119];return _0xf2a023;};'use strict';var _=require(_0x5c03('0x0'));var util=require('util');var logger=require(_0x5c03('0x1'))(_0x5c03('0x2'));var moment=require(_0x5c03('0x3'));var BPromise=require('bluebird');var rp=require(_0x5c03('0x4'));var fs=require('fs');var path=require(_0x5c03('0x5'));var rimraf=require(_0x5c03('0x6'));var config=require('../../config/environment');var attributes=require('./faxInteraction.attributes');module[_0x5c03('0x7')]=function(_0x50c273,_0x518514){return _0x50c273[_0x5c03('0x8')](_0x5c03('0x9'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x412c2f,_0x7469ff,_0x4243f8){if(_0x412c2f['changed']('closed')){_0x412c2f['closedAt']=moment()[_0x5c03('0xa')](_0x5c03('0xb'));}_0x4243f8(null,_0x412c2f);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index a067d45..5784eea 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 _0x4940=['result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','limit','AddTagsToFaxInteraction','find','addTags','ids','omit','AddTags','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','defaults','./faxInteraction.socket','request','then','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxInteraction,\x20%s,\x20%s','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4940,0x89));var _0x0494=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x4940[_0x3d42d8];return _0x27fc41;};'use strict';var _=require(_0x0494('0x0'));var util=require('util');var moment=require(_0x0494('0x1'));var BPromise=require(_0x0494('0x2'));var rs=require(_0x0494('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0494('0x4'))['db'];var utils=require(_0x0494('0x5'));var logger=require(_0x0494('0x6'))(_0x0494('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0494('0x8')]['http']({'port':0x232a});config[_0x0494('0x9')]=_[_0x0494('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0494('0x9')]));require(_0x0494('0xb'))['register'](socket);function respondWithRpcPromise(_0x2d28cd,_0x4d7da1,_0x657ed4){return new BPromise(function(_0x39a80b,_0x368140){return client[_0x0494('0xc')](_0x2d28cd,_0x657ed4)[_0x0494('0xd')](function(_0x52febc){logger['info']('FaxInteraction,\x20%s,\x20%s',_0x4d7da1,_0x0494('0xe'));logger[_0x0494('0xf')](_0x0494('0x10'),_0x4d7da1,'request\x20sent',JSON[_0x0494('0x11')](_0x52febc));if(_0x52febc[_0x0494('0x12')]){if(_0x52febc['error'][_0x0494('0x13')]===0x1f4){logger[_0x0494('0x12')]('FaxInteraction,\x20%s,\x20%s',_0x4d7da1,_0x52febc[_0x0494('0x12')][_0x0494('0x14')]);return _0x368140(_0x52febc[_0x0494('0x12')][_0x0494('0x14')]);}logger[_0x0494('0x12')](_0x0494('0x15'),_0x4d7da1,_0x52febc[_0x0494('0x12')][_0x0494('0x14')]);return _0x39a80b(_0x52febc[_0x0494('0x12')][_0x0494('0x14')]);}else{logger[_0x0494('0x16')](_0x0494('0x15'),_0x4d7da1,'request\x20sent');_0x39a80b(_0x52febc[_0x0494('0x17')][_0x0494('0x14')]);}})[_0x0494('0x18')](function(_0x28312d){logger[_0x0494('0x12')]('FaxInteraction,\x20%s,\x20%s',_0x4d7da1,_0x28312d);_0x368140(_0x28312d);});});}exports[_0x0494('0x19')]=function(_0x10e977){var _0x35f2fa=this;return new Promise(function(_0x457f04,_0x2d003b){return db[_0x0494('0x1a')][_0x0494('0x1b')](_0x10e977[_0x0494('0x1c')],{'raw':_0x10e977[_0x0494('0x1d')]?_0x10e977[_0x0494('0x1d')][_0x0494('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10e977[_0x0494('0x1d')]?_0x10e977[_0x0494('0x1d')][_0x0494('0x1f')]||null:null,'attributes':_0x10e977['options']?_0x10e977[_0x0494('0x1d')][_0x0494('0x20')]||null:null,'limit':_0x10e977[_0x0494('0x1d')]?_0x10e977[_0x0494('0x1d')][_0x0494('0x21')]||null:null})[_0x0494('0xd')](function(_0xa9caf1){logger[_0x0494('0x16')](_0x0494('0x19'),_0x10e977);logger[_0x0494('0xf')]('UpdateFaxInteraction',_0x10e977,JSON[_0x0494('0x11')](_0xa9caf1));_0x457f04(_0xa9caf1);})[_0x0494('0x18')](function(_0x3c3d04){logger[_0x0494('0x12')]('UpdateFaxInteraction',_0x3c3d04[_0x0494('0x14')],_0x10e977);_0x2d003b(_0x35f2fa['error'](0x1f4,_0x3c3d04[_0x0494('0x14')]));});});};exports[_0x0494('0x22')]=function(_0x2fa1ba){return new Promise(function(_0x57eff2,_0x3f972f){return db['FaxInteraction'][_0x0494('0x23')]({'where':_0x2fa1ba[_0x0494('0x1d')]?_0x2fa1ba[_0x0494('0x1d')][_0x0494('0x1f')]||null:null})[_0x0494('0xd')](function(_0x35e166){if(_0x35e166){return _0x35e166[_0x0494('0x24')](_0x2fa1ba[_0x0494('0x1c')][_0x0494('0x25')],_[_0x0494('0x26')](_0x2fa1ba[_0x0494('0x1c')],[_0x0494('0x25'),'id'])||{});}})['spread'](function(_0x35dc4b){logger['info'](_0x0494('0x27'),_0x2fa1ba);logger[_0x0494('0xf')]('AddTags',_0x2fa1ba,JSON[_0x0494('0x11')](_0x35dc4b));_0x57eff2(_0x35dc4b);})[_0x0494('0x18')](function(_0x414b2f){logger[_0x0494('0x12')]('AddTags',_0x414b2f['message'],_0x2fa1ba);_0x3f972f(_this[_0x0494('0x12')](0x1f4,_0x414b2f[_0x0494('0x14')]));});});}; \ No newline at end of file +var _0x01a2=['error','code','FaxInteraction,\x20%s,\x20%s','message','result','catch','UpdateFaxInteraction','update','body','options','where','attributes','limit','debug','FaxInteraction','find','addTags','ids','spread','stringify','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','register','request','then','info','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x652c98,_0x5d5e1e){var _0x3a2753=function(_0x29c01f){while(--_0x29c01f){_0x652c98['push'](_0x652c98['shift']());}};_0x3a2753(++_0x5d5e1e);}(_0x01a2,0x10b));var _0x201a=function(_0x2c4300,_0x74fadb){_0x2c4300=_0x2c4300-0x0;var _0x115ccb=_0x01a2[_0x2c4300];return _0x115ccb;};'use strict';var _=require(_0x201a('0x0'));var util=require(_0x201a('0x1'));var moment=require(_0x201a('0x2'));var BPromise=require('bluebird');var rs=require(_0x201a('0x3'));var fs=require('fs');var Redis=require(_0x201a('0x4'));var db=require(_0x201a('0x5'))['db'];var utils=require(_0x201a('0x6'));var logger=require(_0x201a('0x7'))('rpc');var config=require(_0x201a('0x8'));var jayson=require(_0x201a('0x9'));var client=jayson[_0x201a('0xa')][_0x201a('0xb')]({'port':0x232a});config[_0x201a('0xc')]=_[_0x201a('0xd')](config[_0x201a('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x201a('0xc')]));require('./faxInteraction.socket')[_0x201a('0xe')](socket);function respondWithRpcPromise(_0x56b2c9,_0x38ff0d,_0xe44a5f){return new BPromise(function(_0x167a9a,_0x3050c0){return client[_0x201a('0xf')](_0x56b2c9,_0xe44a5f)[_0x201a('0x10')](function(_0x3bbecf){logger[_0x201a('0x11')]('FaxInteraction,\x20%s,\x20%s',_0x38ff0d,_0x201a('0x12'));logger['debug'](_0x201a('0x13'),_0x38ff0d,_0x201a('0x12'),JSON['stringify'](_0x3bbecf));if(_0x3bbecf[_0x201a('0x14')]){if(_0x3bbecf[_0x201a('0x14')][_0x201a('0x15')]===0x1f4){logger['error'](_0x201a('0x16'),_0x38ff0d,_0x3bbecf[_0x201a('0x14')][_0x201a('0x17')]);return _0x3050c0(_0x3bbecf[_0x201a('0x14')][_0x201a('0x17')]);}logger[_0x201a('0x14')]('FaxInteraction,\x20%s,\x20%s',_0x38ff0d,_0x3bbecf[_0x201a('0x14')]['message']);return _0x167a9a(_0x3bbecf[_0x201a('0x14')][_0x201a('0x17')]);}else{logger[_0x201a('0x11')](_0x201a('0x16'),_0x38ff0d,_0x201a('0x12'));_0x167a9a(_0x3bbecf[_0x201a('0x18')][_0x201a('0x17')]);}})[_0x201a('0x19')](function(_0x3fd287){logger[_0x201a('0x14')](_0x201a('0x16'),_0x38ff0d,_0x3fd287);_0x3050c0(_0x3fd287);});});}exports[_0x201a('0x1a')]=function(_0x247129){var _0x2476bd=this;return new Promise(function(_0x133c18,_0x12f2a2){return db['FaxInteraction'][_0x201a('0x1b')](_0x247129[_0x201a('0x1c')],{'raw':_0x247129['options']?_0x247129[_0x201a('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x247129[_0x201a('0x1d')]?_0x247129[_0x201a('0x1d')][_0x201a('0x1e')]||null:null,'attributes':_0x247129[_0x201a('0x1d')]?_0x247129[_0x201a('0x1d')][_0x201a('0x1f')]||null:null,'limit':_0x247129[_0x201a('0x1d')]?_0x247129['options'][_0x201a('0x20')]||null:null})[_0x201a('0x10')](function(_0x3aec2b){logger[_0x201a('0x11')](_0x201a('0x1a'),_0x247129);logger[_0x201a('0x21')](_0x201a('0x1a'),_0x247129,JSON['stringify'](_0x3aec2b));_0x133c18(_0x3aec2b);})[_0x201a('0x19')](function(_0x187609){logger[_0x201a('0x14')](_0x201a('0x1a'),_0x187609['message'],_0x247129);_0x12f2a2(_0x2476bd[_0x201a('0x14')](0x1f4,_0x187609[_0x201a('0x17')]));});});};exports['AddTagsToFaxInteraction']=function(_0x21e468){return new Promise(function(_0x441722,_0x5ed2f0){return db[_0x201a('0x22')][_0x201a('0x23')]({'where':_0x21e468[_0x201a('0x1d')]?_0x21e468['options'][_0x201a('0x1e')]||null:null})['then'](function(_0x5ec03e){if(_0x5ec03e){return _0x5ec03e[_0x201a('0x24')](_0x21e468[_0x201a('0x1c')][_0x201a('0x25')],_['omit'](_0x21e468[_0x201a('0x1c')],[_0x201a('0x25'),'id'])||{});}})[_0x201a('0x26')](function(_0x3b69a0){logger['info']('AddTags',_0x21e468);logger[_0x201a('0x21')]('AddTags',_0x21e468,JSON[_0x201a('0x27')](_0x3b69a0));_0x441722(_0x3b69a0);})[_0x201a('0x19')](function(_0x4a52f9){logger[_0x201a('0x14')](_0x201a('0x28'),_0x4a52f9[_0x201a('0x17')],_0x21e468);_0x5ed2f0(_this[_0x201a('0x14')](0x1f4,_0x4a52f9['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index ce8067e..dd9c269 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 _0x7f7a=['./faxInteraction.events','remove','update','emit','register','length','faxInteraction:'];(function(_0x234004,_0x37264c){var _0x3bc020=function(_0x25c0b1){while(--_0x25c0b1){_0x234004['push'](_0x234004['shift']());}};_0x3bc020(++_0x37264c);}(_0x7f7a,0x103));var _0xa7f7=function(_0xfdf7b3,_0x5307ef){_0xfdf7b3=_0xfdf7b3-0x0;var _0x30fe6d=_0x7f7a[_0xfdf7b3];return _0x30fe6d;};'use strict';var FaxInteractionEvents=require(_0xa7f7('0x0'));var events=['save',_0xa7f7('0x1'),_0xa7f7('0x2')];function createListener(_0x574284,_0x46ee90){return function(_0x69f3b){_0x46ee90[_0xa7f7('0x3')](_0x574284,_0x69f3b);};}function removeListener(_0x23dc2f,_0x2ce2f9){return function(){FaxInteractionEvents['removeListener'](_0x23dc2f,_0x2ce2f9);};}exports[_0xa7f7('0x4')]=function(_0x6c51d8){for(var _0x3989f4=0x0,_0x50bd0c=events[_0xa7f7('0x5')];_0x3989f4<_0x50bd0c;_0x3989f4++){var _0x39eb28=events[_0x3989f4];var _0x109639=createListener(_0xa7f7('0x6')+_0x39eb28,_0x6c51d8);FaxInteractionEvents['on'](_0x39eb28,_0x109639);}}; \ No newline at end of file +var _0xed3a=['register','faxInteraction:','./faxInteraction.events','save','remove','update'];(function(_0x20f902,_0x17e9af){var _0x42fd50=function(_0x5d478a){while(--_0x5d478a){_0x20f902['push'](_0x20f902['shift']());}};_0x42fd50(++_0x17e9af);}(_0xed3a,0x128));var _0xaed3=function(_0x59f846,_0x20d7cf){_0x59f846=_0x59f846-0x0;var _0x50c64a=_0xed3a[_0x59f846];return _0x50c64a;};'use strict';var FaxInteractionEvents=require(_0xaed3('0x0'));var events=[_0xaed3('0x1'),_0xaed3('0x2'),_0xaed3('0x3')];function createListener(_0x1626aa,_0xe1e47f){return function(_0x592c9c){_0xe1e47f['emit'](_0x1626aa,_0x592c9c);};}function removeListener(_0x43a8e5,_0x11ef1d){return function(){FaxInteractionEvents['removeListener'](_0x43a8e5,_0x11ef1d);};}exports[_0xaed3('0x4')]=function(_0x222ba0){for(var _0xfd50c3=0x0,_0x40631a=events['length'];_0xfd50c3<_0x40631a;_0xfd50c3++){var _0x3a94a6=events[_0xfd50c3];var _0x145f5f=createListener(_0xaed3('0x5')+_0x3a94a6,_0x222ba0);FaxInteractionEvents['on'](_0x3a94a6,_0x145f5f);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 0b52a9f..adefec7 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 _0xb492=['multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./faxInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','post','create','/:id/messages','addMessage','tracked','fax','faxinteraction:addtags','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','/:id/tags','removeTags'];(function(_0x356ae9,_0x3d6de1){var _0xe16621=function(_0x4a3c90){while(--_0x4a3c90){_0x356ae9['push'](_0x356ae9['shift']());}};_0xe16621(++_0x3d6de1);}(_0xb492,0x105));var _0x2b49=function(_0x9afbee,_0x354ace){_0x9afbee=_0x9afbee-0x0;var _0x580a72=_0xb492[_0x9afbee];return _0x580a72;};'use strict';var multer=require(_0x2b49('0x0'));var util=require(_0x2b49('0x1'));var path=require(_0x2b49('0x2'));var timeout=require(_0x2b49('0x3'));var express=require(_0x2b49('0x4'));var router=express['Router']();var fs_extra=require(_0x2b49('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2b49('0x6'));var config=require('../../config/environment');var controller=require(_0x2b49('0x7'));router[_0x2b49('0x8')]('/',auth[_0x2b49('0x9')](),controller['index']);router[_0x2b49('0x8')](_0x2b49('0xa'),auth[_0x2b49('0x9')](),controller[_0x2b49('0xb')]);router[_0x2b49('0x8')](_0x2b49('0xc'),auth[_0x2b49('0x9')](),controller[_0x2b49('0xd')]);router[_0x2b49('0x8')]('/:id/messages',auth[_0x2b49('0x9')](),controller['getMessages']);router[_0x2b49('0x8')](_0x2b49('0xe'),auth[_0x2b49('0x9')](),controller['download']);router[_0x2b49('0xf')]('/',auth['isAuthenticated'](),controller[_0x2b49('0x10')]);router[_0x2b49('0xf')](_0x2b49('0x11'),auth[_0x2b49('0x9')](),controller[_0x2b49('0x12')]);router[_0x2b49('0xf')]('/:id/tags',auth[_0x2b49('0x9')](),interaction[_0x2b49('0x13')](_0x2b49('0x14'),_0x2b49('0x15')),controller['addTags']);router['put'](_0x2b49('0xc'),auth[_0x2b49('0x9')](),interaction[_0x2b49('0x13')]('fax',_0x2b49('0x16')),controller[_0x2b49('0x17')]);router[_0x2b49('0x18')](_0x2b49('0xc'),auth[_0x2b49('0x9')](),interaction['tracked'](_0x2b49('0x14'),_0x2b49('0x19')),controller[_0x2b49('0x1a')]);router['delete'](_0x2b49('0x1b'),auth[_0x2b49('0x9')](),controller[_0x2b49('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x9362=['../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','isAuthenticated','index','/describe','describe','get','/:id/download','download','create','post','/:id/tags','fax','faxinteraction:addtags','addTags','put','/:id','tracked','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags','multer','util','path','express','Router','fs-extra'];(function(_0xbbfad4,_0x4e81a3){var _0x2bf8e8=function(_0x5326ae){while(--_0x5326ae){_0xbbfad4['push'](_0xbbfad4['shift']());}};_0x2bf8e8(++_0x4e81a3);}(_0x9362,0x111));var _0x2936=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9362[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x2936('0x0'));var util=require(_0x2936('0x1'));var path=require(_0x2936('0x2'));var timeout=require('connect-timeout');var express=require(_0x2936('0x3'));var router=express[_0x2936('0x4')]();var fs_extra=require(_0x2936('0x5'));var auth=require(_0x2936('0x6'));var interaction=require(_0x2936('0x7'));var config=require('../../config/environment');var controller=require(_0x2936('0x8'));router['get']('/',auth[_0x2936('0x9')](),controller[_0x2936('0xa')]);router['get'](_0x2936('0xb'),auth[_0x2936('0x9')](),controller[_0x2936('0xc')]);router[_0x2936('0xd')]('/:id',auth[_0x2936('0x9')](),controller['show']);router['get']('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router['get'](_0x2936('0xe'),auth[_0x2936('0x9')](),controller[_0x2936('0xf')]);router['post']('/',auth[_0x2936('0x9')](),controller[_0x2936('0x10')]);router['post']('/:id/messages',auth[_0x2936('0x9')](),controller['addMessage']);router[_0x2936('0x11')](_0x2936('0x12'),auth[_0x2936('0x9')](),interaction['tracked'](_0x2936('0x13'),_0x2936('0x14')),controller[_0x2936('0x15')]);router[_0x2936('0x16')](_0x2936('0x17'),auth[_0x2936('0x9')](),interaction[_0x2936('0x18')](_0x2936('0x13'),_0x2936('0x19')),controller[_0x2936('0x1a')]);router[_0x2936('0x1b')](_0x2936('0x17'),auth[_0x2936('0x9')](),interaction[_0x2936('0x18')](_0x2936('0x13'),_0x2936('0x1c')),controller[_0x2936('0x1d')]);router[_0x2936('0x1b')](_0x2936('0x12'),auth['isAuthenticated'](),controller[_0x2936('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 9a377e6..15ca623 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 _0xad8a=['BOOLEAN','out','sequelize','exports','TEXT','medium'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0xad8a,0xb0));var _0xaad8=function(_0xcad0b5,_0x57255c){_0xcad0b5=_0xcad0b5-0x0;var _0x90199a=_0xad8a[_0xcad0b5];return _0x90199a;};'use strict';var Sequelize=require(_0xaad8('0x0'));module[_0xaad8('0x1')]={'body':{'type':Sequelize[_0xaad8('0x2')](_0xaad8('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xaad8('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xaad8('0x5')),'defaultValue':_0xaad8('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xaad8('0x2')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x26bc=['sequelize','exports','TEXT','medium','BOOLEAN','out'];(function(_0x1fd1b1,_0x3ccae9){var _0x78d7c4=function(_0x4005f9){while(--_0x4005f9){_0x1fd1b1['push'](_0x1fd1b1['shift']());}};_0x78d7c4(++_0x3ccae9);}(_0x26bc,0x162));var _0xc26b=function(_0x2d0e9d,_0x2fe853){_0x2d0e9d=_0x2d0e9d-0x0;var _0x785cbf=_0x26bc[_0x2d0e9d];return _0x785cbf;};'use strict';var Sequelize=require(_0xc26b('0x0'));module[_0xc26b('0x1')]={'body':{'type':Sequelize[_0xc26b('0x2')](_0xc26b('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xc26b('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xc26b('0x5')),'defaultValue':_0xc26b('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xc26b('0x2')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 6885222..36899be 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 _0x4618=['end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','name','send','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','merge','options','FaxMessage','includeAll','include','rows','catch','show','params','keys','rawAttributes','find','body','destroy','describe','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','fax-interactions','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT','create','CmContact','findOne','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','join','root','server','attachments','Attachment','download','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','info','FaxMessage,\x20%s,\x20%s','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','sendStatus','status'];(function(_0x129f74,_0x3d64d8){var _0x1cf683=function(_0x232179){while(--_0x232179){_0x129f74['push'](_0x129f74['shift']());}};_0x1cf683(++_0x3d64d8);}(_0x4618,0x68));var _0x8461=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0x4618[_0x1f36bb];return _0xaf97fa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8461('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8461('0x1'));var rp=require(_0x8461('0x2'));var moment=require(_0x8461('0x3'));var BPromise=require(_0x8461('0x4'));var Mustache=require(_0x8461('0x5'));var util=require('util');var path=require(_0x8461('0x6'));var sox=require(_0x8461('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8461('0x8'));var _=require('lodash');var squel=require(_0x8461('0x9'));var crypto=require(_0x8461('0xa'));var jsforce=require(_0x8461('0xb'));var deskjs=require(_0x8461('0xc'));var toCsv=require(_0x8461('0xd'));var querystring=require(_0x8461('0xe'));var Papa=require(_0x8461('0xf'));var Redis=require(_0x8461('0x10'));var authService=require(_0x8461('0x11'));var qs=require(_0x8461('0x12'));var as=require(_0x8461('0x13'));var hardwareService=require(_0x8461('0x14'));var logger=require(_0x8461('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x8461('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8461('0x17'))['db'];config['redis']=_[_0x8461('0x18')](config[_0x8461('0x19')],{'host':_0x8461('0x1a'),'port':0x18eb});var socket=require(_0x8461('0x1b'))(new Redis(config[_0x8461('0x19')]));require(_0x8461('0x1c'))[_0x8461('0x1d')](socket);var jayson=require(_0x8461('0x1e'));var client=jayson[_0x8461('0x1f')][_0x8461('0x20')]({'port':0x232c});var client9002=jayson[_0x8461('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33f391,_0x52a3a0,_0x5c7776,_0x47114b){return new BPromise(function(_0x46ce67,_0x1b8690){var _0x8645fd=_0x47114b||client;return _0x8645fd[_0x8461('0x21')](_0x33f391,_0x5c7776)['then'](function(_0x385de2){logger[_0x8461('0x22')](_0x8461('0x23'),_0x52a3a0,'request\x20sent');logger['debug'](_0x8461('0x24'),_0x52a3a0,'request\x20sent',JSON[_0x8461('0x25')](_0x385de2));if(_0x385de2['error']){if(_0x385de2[_0x8461('0x26')][_0x8461('0x27')]===0x1f4){logger[_0x8461('0x26')]('FaxMessage,\x20%s,\x20%s',_0x52a3a0,_0x385de2[_0x8461('0x26')][_0x8461('0x28')]);return _0x1b8690(_0x385de2[_0x8461('0x26')]['message']);}logger['error'](_0x8461('0x23'),_0x52a3a0,_0x385de2[_0x8461('0x26')][_0x8461('0x28')]);return _0x46ce67(_0x385de2[_0x8461('0x26')][_0x8461('0x28')]);}else{logger[_0x8461('0x22')](_0x8461('0x23'),_0x52a3a0,_0x8461('0x29'));_0x46ce67(_0x385de2[_0x8461('0x2a')][_0x8461('0x28')]);}})['catch'](function(_0x48d59c){logger[_0x8461('0x26')](_0x8461('0x23'),_0x52a3a0,_0x48d59c);_0x1b8690(_0x48d59c);});});}function respondWithStatusCode(_0x246fcc,_0x24ca07){_0x24ca07=_0x24ca07||0xcc;return function(_0x171904){if(_0x171904){return _0x246fcc[_0x8461('0x2b')](_0x24ca07);}return _0x246fcc[_0x8461('0x2c')](_0x24ca07)[_0x8461('0x2d')]();};}function respondWithResult(_0x18f5bc,_0x2f0289){_0x2f0289=_0x2f0289||0xc8;return function(_0x4b7f16){if(_0x4b7f16){return _0x18f5bc[_0x8461('0x2c')](_0x2f0289)[_0x8461('0x2e')](_0x4b7f16);}};}function respondWithFilteredResult(_0xac5e13,_0x31a9de){return function(_0x5b0c72){if(_0x5b0c72){var _0xebe45c=typeof _0x31a9de[_0x8461('0x2f')]===_0x8461('0x30')&&typeof _0x31a9de['limit']===_0x8461('0x30');var _0x5dc6b4=_0x5b0c72[_0x8461('0x31')];var _0x2d27a3=_0xebe45c?0x0:_0x31a9de[_0x8461('0x2f')];var _0x3b76fa=_0xebe45c?_0x5b0c72[_0x8461('0x31')]:_0x31a9de[_0x8461('0x2f')]+_0x31a9de['limit'];var _0xf5c15c;if(_0x3b76fa>=_0x5dc6b4){_0x3b76fa=_0x5dc6b4;_0xf5c15c=0xc8;}else{_0xf5c15c=0xce;}_0xac5e13[_0x8461('0x2c')](_0xf5c15c);return _0xac5e13[_0x8461('0x32')](_0x8461('0x33'),_0x2d27a3+'-'+_0x3b76fa+'/'+_0x5dc6b4)[_0x8461('0x2e')](_0x5b0c72);}return null;};}function patchUpdates(_0x5c6728){return function(_0x462041){try{jsonpatch[_0x8461('0x34')](_0x462041,_0x5c6728,!![]);}catch(_0x56d251){return BPromise[_0x8461('0x35')](_0x56d251);}return _0x462041[_0x8461('0x36')]();};}function saveUpdates(_0x2d08f9,_0x3329e7){return function(_0x3ca13f){if(_0x3ca13f){return _0x3ca13f[_0x8461('0x37')](_0x2d08f9)[_0x8461('0x38')](function(_0xfd4de7){return _0xfd4de7;});}return null;};}function removeEntity(_0x2c9d37,_0x4c7a07){return function(_0x41be9){if(_0x41be9){return _0x41be9['destroy']()[_0x8461('0x38')](function(){_0x2c9d37[_0x8461('0x2c')](0xcc)[_0x8461('0x2d')]();});}};}function handleEntityNotFound(_0x568e8e,_0x5e7825){return function(_0x57bc16){if(!_0x57bc16){_0x568e8e['sendStatus'](0x194);}return _0x57bc16;};}function handleError(_0x152970,_0x133e18){_0x133e18=_0x133e18||0x1f4;return function(_0x4e67d1){logger[_0x8461('0x26')](_0x4e67d1['stack']);if(_0x4e67d1[_0x8461('0x39')]){delete _0x4e67d1[_0x8461('0x39')];}_0x152970[_0x8461('0x2c')](_0x133e18)[_0x8461('0x3a')](_0x4e67d1);};}exports[_0x8461('0x3b')]=function(_0x1f3a37,_0x946a54){var _0x26a234={},_0x29e1c4={},_0x1ee2f1={'count':0x0,'rows':[]};var _0x396d66=_[_0x8461('0x3c')](db['FaxMessage']['rawAttributes'],function(_0x3af8b4){return{'name':_0x3af8b4[_0x8461('0x3d')],'type':_0x3af8b4[_0x8461('0x3e')][_0x8461('0x3f')]};});_0x29e1c4[_0x8461('0x40')]=_[_0x8461('0x3c')](_0x396d66,_0x8461('0x39'));_0x29e1c4['query']=_['keys'](_0x1f3a37[_0x8461('0x41')]);_0x29e1c4[_0x8461('0x42')]=_[_0x8461('0x43')](_0x29e1c4['model'],_0x29e1c4[_0x8461('0x41')]);_0x26a234[_0x8461('0x44')]=_[_0x8461('0x43')](_0x29e1c4['model'],qs[_0x8461('0x45')](_0x1f3a37[_0x8461('0x41')]['fields']));_0x26a234[_0x8461('0x44')]=_0x26a234['attributes'][_0x8461('0x46')]?_0x26a234[_0x8461('0x44')]:_0x29e1c4[_0x8461('0x40')];if(!_0x1f3a37[_0x8461('0x41')][_0x8461('0x47')](_0x8461('0x48'))){_0x26a234[_0x8461('0x49')]=qs[_0x8461('0x49')](_0x1f3a37[_0x8461('0x41')][_0x8461('0x49')]);_0x26a234[_0x8461('0x2f')]=qs[_0x8461('0x2f')](_0x1f3a37[_0x8461('0x41')][_0x8461('0x2f')]);}_0x26a234[_0x8461('0x4a')]=qs['sort'](_0x1f3a37['query'][_0x8461('0x4b')]);_0x26a234['where']=qs[_0x8461('0x42')](_[_0x8461('0x4c')](_0x1f3a37['query'],_0x29e1c4[_0x8461('0x42')]),_0x396d66);if(_0x1f3a37[_0x8461('0x41')][_0x8461('0x4d')]){_0x26a234[_0x8461('0x4e')]=_['merge'](_0x26a234[_0x8461('0x4e')],{'$or':_[_0x8461('0x3c')](_0x396d66,function(_0xe04c25){if(_0xe04c25[_0x8461('0x3e')]!==_0x8461('0x4f')){var _0x221b75={};_0x221b75[_0xe04c25[_0x8461('0x39')]]={'$like':'%'+_0x1f3a37['query'][_0x8461('0x4d')]+'%'};return _0x221b75;}})});}_0x26a234=_[_0x8461('0x50')]({},_0x26a234,_0x1f3a37[_0x8461('0x51')]);var _0x356bce={'where':_0x26a234['where']};return db[_0x8461('0x52')]['count'](_0x356bce)[_0x8461('0x38')](function(_0x1dec7b){_0x1ee2f1['count']=_0x1dec7b;if(_0x1f3a37[_0x8461('0x41')][_0x8461('0x53')]){_0x26a234[_0x8461('0x54')]=[{'all':!![]}];}return db[_0x8461('0x52')]['findAll'](_0x26a234);})[_0x8461('0x38')](function(_0x52e04d){_0x1ee2f1[_0x8461('0x55')]=_0x52e04d;return _0x1ee2f1;})[_0x8461('0x38')](respondWithFilteredResult(_0x946a54,_0x26a234))[_0x8461('0x56')](handleError(_0x946a54,null));};exports[_0x8461('0x57')]=function(_0x72339c,_0xc95b6e){var _0x7b0a28={'raw':!![],'where':{'id':_0x72339c[_0x8461('0x58')]['id']}},_0x126644={};_0x126644['model']=_[_0x8461('0x59')](db[_0x8461('0x52')][_0x8461('0x5a')]);_0x126644[_0x8461('0x41')]=_[_0x8461('0x59')](_0x72339c[_0x8461('0x41')]);_0x126644['filters']=_[_0x8461('0x43')](_0x126644[_0x8461('0x40')],_0x126644['query']);_0x7b0a28[_0x8461('0x44')]=_['intersection'](_0x126644[_0x8461('0x40')],qs[_0x8461('0x45')](_0x72339c[_0x8461('0x41')][_0x8461('0x45')]));_0x7b0a28[_0x8461('0x44')]=_0x7b0a28[_0x8461('0x44')][_0x8461('0x46')]?_0x7b0a28[_0x8461('0x44')]:_0x126644[_0x8461('0x40')];if(_0x72339c[_0x8461('0x41')]['includeAll']){_0x7b0a28['include']=[{'all':!![]}];}_0x7b0a28=_[_0x8461('0x50')]({},_0x7b0a28,_0x72339c[_0x8461('0x51')]);return db[_0x8461('0x52')][_0x8461('0x5b')](_0x7b0a28)[_0x8461('0x38')](handleEntityNotFound(_0xc95b6e,null))['then'](respondWithResult(_0xc95b6e,null))[_0x8461('0x56')](handleError(_0xc95b6e,null));};exports[_0x8461('0x37')]=function(_0x17428f,_0x527d0a){if(_0x17428f[_0x8461('0x5c')]['id']){delete _0x17428f[_0x8461('0x5c')]['id'];}return db[_0x8461('0x52')]['find']({'where':{'id':_0x17428f[_0x8461('0x58')]['id']}})[_0x8461('0x38')](handleEntityNotFound(_0x527d0a,null))['then'](saveUpdates(_0x17428f['body'],null))[_0x8461('0x38')](respondWithResult(_0x527d0a,null))['catch'](handleError(_0x527d0a,null));};exports[_0x8461('0x5d')]=function(_0x120c9a,_0x9b7997){return db['FaxMessage']['find']({'where':{'id':_0x120c9a[_0x8461('0x58')]['id']}})[_0x8461('0x38')](handleEntityNotFound(_0x9b7997,null))[_0x8461('0x38')](removeEntity(_0x9b7997,null))[_0x8461('0x56')](handleError(_0x9b7997,null));};exports['describe']=function(_0xc6875,_0x362b46){return db[_0x8461('0x52')][_0x8461('0x5e')]()['then'](respondWithResult(_0x362b46,null))['catch'](handleError(_0x362b46,null));};var interaction_log=require(_0x8461('0x15'))('fax-interactions');exports[_0x8461('0x5f')]=function(_0x2976cc,_0x428fe3,_0x3b064c){var _0x102537={'agent':{},'channel':_0x8461('0x60')};if(_0x2976cc[_0x8461('0x5c')]['id']){delete _0x2976cc[_0x8461('0x5c')]['id'];}_0x2976cc[_0x8461('0x5c')][_0x8461('0x61')]=!![];_0x2976cc['body'][_0x8461('0x62')]=moment()[_0x8461('0x63')](_0x8461('0x64'));_0x2976cc[_0x8461('0x5c')][_0x8461('0x65')]=_0x2976cc[_0x8461('0x5c')]['UserId']||_0x2976cc[_0x8461('0x66')]['id'];_0x102537[_0x8461('0x67')]['id']=_0x2976cc[_0x8461('0x5c')][_0x8461('0x65')];return db[_0x8461('0x52')][_0x8461('0x5b')]({'where':{'id':_0x2976cc[_0x8461('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x428fe3,null))[_0x8461('0x38')](saveUpdates(_0x2976cc[_0x8461('0x5c')],null))['then'](function(_0x2de651){if(_0x2de651){_0x102537[_0x8461('0x28')]=_0x2de651[_0x8461('0x68')]({'plain':!![]});return db[_0x8461('0x69')][_0x8461('0x5b')]({'where':{'id':_0x2de651[_0x8461('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0x428fe3,null))[_0x8461('0x38')](function(_0x2938bf){if(_0x2938bf){return _0x2938bf[_0x8461('0x37')]({'UserId':_0x2976cc['body'][_0x8461('0x65')],'read1stAt':_[_0x8461('0x6b')](_0x2938bf[_0x8461('0x6c')])?moment()['format'](_0x8461('0x64')):undefined});}return null;})['then'](function(_0x4f410e){if(_0x4f410e){_0x102537['interaction']=_0x4f410e[_0x8461('0x68')]({'plain':!![]});interaction_log['info'](_0x8461('0x6d'),_0x2976cc[_0x8461('0x66')]['id'],_0x2976cc[_0x8461('0x66')][_0x8461('0x39')],_0x2976cc[_0x8461('0x66')][_0x8461('0x6e')],_0x102537[_0x8461('0x6f')]['id'],_0x2976cc['body']?JSON[_0x8461('0x25')](_0x2976cc[_0x8461('0x5c')]):_0x8461('0x70'));return respondWithRpcPromise('AcceptMessage',_0x8461('0x71'),_0x102537);}return null;})[_0x8461('0x38')](function(_0x408f74){var _0x300378=_0x8461('0x72')+_0x408f74[_0x8461('0x28')][_0x8461('0x73')];return db[_0x8461('0x74')][_0x8461('0x41')](_0x300378,{'type':db[_0x8461('0x75')]['QueryTypes']['SELECT'],'raw':!![]})[_0x8461('0x38')](function(_0xcfe69a){return _0xcfe69a;});})[_0x8461('0x38')](function(_0x307ebf){if(_0x307ebf){_0x102537[_0x8461('0x28')][_0x8461('0x76')]=_0x307ebf[0x0];if(!_0x2976cc[_0x8461('0x5c')][_0x8461('0x65')])return;return db[_0x8461('0x77')][_0x8461('0x5b')]({'where':{'id':_0x2976cc[_0x8461('0x5c')][_0x8461('0x65')],'role':_0x8461('0x67')},'attributes':['id','name',_0x8461('0x78'),_0x8461('0x79'),_0x8461('0x7a')],'raw':!![]});}return null;})[_0x8461('0x38')](function(_0x3f84da){if(!_0x3f84da)return null;_0x102537['message']['agent']=_0x3f84da;return _0x102537;})[_0x8461('0x38')](function(_0x55f707){if(_0x55f707){if(_0x2976cc[_0x8461('0x5c')][_0x8461('0x7b')]){_0x102537[_0x8461('0x28')][_0x8461('0x7c')]=util[_0x8461('0x63')](_0x8461('0x7d'),_0x2976cc[_0x8461('0x66')][_0x8461('0x39')]);_0x102537[_0x8461('0x28')][_0x8461('0x7e')]=_0x102537[_0x8461('0x7e')];_0x102537[_0x8461('0x28')][_0x8461('0x7f')]=_0x102537[_0x8461('0x7e')];_0x102537[_0x8461('0x28')][_0x8461('0x80')]=_0x8461('0x5f');return respondWithRpcPromise(_0x8461('0x81'),_0x8461('0x81'),{'event':_0x8461('0x82'),'message':_0x102537['message']},client9002)['then'](function(){return _0x102537;});}return _0x102537;}return null;})[_0x8461('0x38')](respondWithResult(_0x428fe3,null))[_0x8461('0x56')](handleError(_0x428fe3,null));};var interaction_log=require(_0x8461('0x15'))(_0x8461('0x83'));exports[_0x8461('0x35')]=function(_0x22527c,_0x156fff,_0x3a0df6){var _0x54a8f0={'agent':{},'channel':_0x8461('0x60')};if(_0x22527c[_0x8461('0x5c')]['id']){delete _0x22527c[_0x8461('0x5c')]['id'];}_0x22527c[_0x8461('0x5c')][_0x8461('0x65')]=_0x22527c[_0x8461('0x5c')][_0x8461('0x65')]||_0x22527c[_0x8461('0x66')]['id'];_0x54a8f0[_0x8461('0x67')]['id']=_0x22527c[_0x8461('0x5c')][_0x8461('0x65')];return db[_0x8461('0x52')][_0x8461('0x5b')]({'where':{'id':_0x22527c[_0x8461('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x156fff,null))[_0x8461('0x38')](function(_0x5e6440){if(_0x5e6440){_0x54a8f0['message']=_0x5e6440[_0x8461('0x68')]({'plain':!![]});return db[_0x8461('0x69')]['find']({'where':{'id':_0x5e6440[_0x8461('0x6a')]}});}return null;})[_0x8461('0x38')](handleEntityNotFound(_0x156fff,null))[_0x8461('0x38')](function(_0x444813){if(_0x444813){_0x54a8f0['interaction']=_0x444813['get']({'plain':!![]});interaction_log['info'](_0x8461('0x84'),_0x22527c[_0x8461('0x66')]['id'],_0x22527c['user']['name'],_0x22527c[_0x8461('0x66')]['role'],_0x54a8f0[_0x8461('0x6f')]['id'],_0x22527c[_0x8461('0x5c')]?JSON[_0x8461('0x25')](_0x22527c[_0x8461('0x5c')]):_0x8461('0x70'));return respondWithRpcPromise(_0x8461('0x85'),_0x8461('0x86'),_0x54a8f0);}return null;})['then'](function(_0x117e1a){var _0x56310e=_0x8461('0x72')+_0x117e1a[_0x8461('0x28')][_0x8461('0x73')];return db['sequelize'][_0x8461('0x41')](_0x56310e,{'type':db[_0x8461('0x75')]['QueryTypes'][_0x8461('0x87')],'raw':!![]})[_0x8461('0x38')](function(_0x412552){return _0x412552;});})['then'](function(_0x10ccf8){if(_0x10ccf8){_0x54a8f0[_0x8461('0x28')][_0x8461('0x76')]=_0x10ccf8[0x0];if(!_0x22527c[_0x8461('0x5c')][_0x8461('0x65')])return;return db[_0x8461('0x77')][_0x8461('0x5b')]({'where':{'id':_0x22527c[_0x8461('0x5c')][_0x8461('0x65')],'role':_0x8461('0x67')},'attributes':['id','name',_0x8461('0x78'),_0x8461('0x79'),_0x8461('0x7a')],'raw':!![]});}return null;})[_0x8461('0x38')](function(_0x37b5e4){if(!_0x37b5e4)return null;_0x54a8f0['message'][_0x8461('0x67')]=_0x37b5e4;return _0x54a8f0;})[_0x8461('0x38')](function(_0xd25e20){if(_0xd25e20){_0xd25e20['message']['interface']=util[_0x8461('0x63')]('SIP/%s',_0x22527c[_0x8461('0x66')][_0x8461('0x39')]);_0xd25e20['message'][_0x8461('0x7e')]=_0x54a8f0[_0x8461('0x7e')];_0xd25e20[_0x8461('0x28')][_0x8461('0x7f')]=_0x54a8f0[_0x8461('0x7e')];_0xd25e20[_0x8461('0x28')][_0x8461('0x80')]=_0x8461('0x35');respondWithRpcPromise(_0x8461('0x81'),_0x8461('0x81'),{'event':'rejectmessage','message':_0xd25e20[_0x8461('0x28')]},client9002);return _0x54a8f0;}return null;})[_0x8461('0x38')](respondWithResult(_0x156fff,null))['catch'](handleError(_0x156fff,null));};exports['create']=function(_0x4c84bd,_0x19b493){var _0x58e6b7;return db[_0x8461('0x52')][_0x8461('0x88')](_0x4c84bd['body'],{})[_0x8461('0x38')](function(_0x3de389){_0x58e6b7=_0x3de389;return db[_0x8461('0x89')][_0x8461('0x8a')]({'where':{'id':_0x58e6b7[_0x8461('0x73')]}});})[_0x8461('0x38')](function(_0xb27de1){if(_[_0x8461('0x6b')](_0xb27de1)){return;}else{_0x58e6b7['fax']=_0xb27de1[_0x8461('0x60')];return db['Attachment'][_0x8461('0x8a')]({'where':{'id':_0x58e6b7[_0x8461('0x8b')]}});}})[_0x8461('0x38')](function(_0xd3de20){return respondWithRpcPromise('SendFax',_0x8461('0x8c'),{'FaxAccountId':_['isNil'](_0x4c84bd[_0x8461('0x5c')])?undefined:_0x4c84bd['body']['FaxAccountId'],'path':_[_0x8461('0x6b')](_0xd3de20)?undefined:util[_0x8461('0x63')](_0x8461('0x8d'),_0xd3de20[_0x8461('0x8e')]),'fax':_[_0x8461('0x6b')](_0x58e6b7[_0x8461('0x60')])?undefined:_0x58e6b7['fax'],'AttachmentId':_0x58e6b7[_0x8461('0x8b')]},client9002);})[_0x8461('0x38')](respondWithResult(_0x19b493,0xc9))[_0x8461('0x56')](handleError(_0x19b493,null));};exports['download']=function(_0x3f2a0f,_0x45ce5f){var _0x398d55=path[_0x8461('0x8f')](config[_0x8461('0x90')],_0x8461('0x91'),'files',_0x8461('0x92'));return db[_0x8461('0x52')]['find']({'where':{'id':_0x3f2a0f[_0x8461('0x58')]['id']},'include':[{'model':db[_0x8461('0x93')],'as':_0x8461('0x93')}]})[_0x8461('0x38')](handleEntityNotFound(_0x45ce5f,null))[_0x8461('0x38')](function(_0x5a15e6){if(_0x5a15e6){return _0x45ce5f[_0x8461('0x94')](path[_0x8461('0x8f')](_0x398d55,_0x5a15e6[_0x8461('0x93')]['basename']));}})['catch'](handleError(_0x45ce5f,null));}; \ No newline at end of file +var _0xfbd2=['merge','type','options','count','includeAll','findAll','rows','show','params','FaxMessage','include','catch','body','find','describe','fax-interactions','accept','fax','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','format','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','role','rejectMessage','QueryTypes','rejectmessage','create','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','download','join','root','server','files','attachments','basename','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','register','client','http','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','sendStatus','status','json','undefined','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','offset','sort','where','pick','filter'];(function(_0x4e88a1,_0x4ea61d){var _0x4bb106=function(_0x144e8c){while(--_0x144e8c){_0x4e88a1['push'](_0x4e88a1['shift']());}};_0x4bb106(++_0x4ea61d);}(_0xfbd2,0x164));var _0x2fbd=function(_0x2099f6,_0x32b4ad){_0x2099f6=_0x2099f6-0x0;var _0x13a947=_0xfbd2[_0x2099f6];return _0x13a947;};'use strict';var emlformat=require(_0x2fbd('0x0'));var rimraf=require(_0x2fbd('0x1'));var zipdir=require(_0x2fbd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2fbd('0x3'));var moment=require('moment');var BPromise=require(_0x2fbd('0x4'));var Mustache=require(_0x2fbd('0x5'));var util=require('util');var path=require(_0x2fbd('0x6'));var sox=require('sox');var csv=require(_0x2fbd('0x7'));var ejs=require(_0x2fbd('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2fbd('0x9'));var squel=require(_0x2fbd('0xa'));var crypto=require(_0x2fbd('0xb'));var jsforce=require(_0x2fbd('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2fbd('0xd'));var Papa=require(_0x2fbd('0xe'));var Redis=require(_0x2fbd('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2fbd('0x10'));var as=require(_0x2fbd('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2fbd('0x12'))('api');var utils=require(_0x2fbd('0x13'));var config=require(_0x2fbd('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x2fbd('0x15'))['db'];config[_0x2fbd('0x16')]=_[_0x2fbd('0x17')](config[_0x2fbd('0x16')],{'host':_0x2fbd('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2fbd('0x16')]));require('./faxMessage.socket')[_0x2fbd('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0x2fbd('0x1a')][_0x2fbd('0x1b')]({'port':0x232c});var client9002=jayson['client'][_0x2fbd('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0xbbcf60,_0x2b55ac,_0x1fe2bf,_0x10c073){return new BPromise(function(_0x373522,_0x375f58){var _0x80bbdf=_0x10c073||client;return _0x80bbdf[_0x2fbd('0x1c')](_0xbbcf60,_0x1fe2bf)['then'](function(_0x3f5b0a){logger[_0x2fbd('0x1d')](_0x2fbd('0x1e'),_0x2b55ac,_0x2fbd('0x1f'));logger[_0x2fbd('0x20')](_0x2fbd('0x21'),_0x2b55ac,'request\x20sent',JSON[_0x2fbd('0x22')](_0x3f5b0a));if(_0x3f5b0a['error']){if(_0x3f5b0a['error'][_0x2fbd('0x23')]===0x1f4){logger[_0x2fbd('0x24')](_0x2fbd('0x1e'),_0x2b55ac,_0x3f5b0a[_0x2fbd('0x24')]['message']);return _0x375f58(_0x3f5b0a[_0x2fbd('0x24')][_0x2fbd('0x25')]);}logger['error'](_0x2fbd('0x1e'),_0x2b55ac,_0x3f5b0a[_0x2fbd('0x24')][_0x2fbd('0x25')]);return _0x373522(_0x3f5b0a[_0x2fbd('0x24')][_0x2fbd('0x25')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x2b55ac,'request\x20sent');_0x373522(_0x3f5b0a[_0x2fbd('0x26')][_0x2fbd('0x25')]);}})['catch'](function(_0x1328d3){logger[_0x2fbd('0x24')](_0x2fbd('0x1e'),_0x2b55ac,_0x1328d3);_0x375f58(_0x1328d3);});});}function respondWithStatusCode(_0x53c2bf,_0x3d7eb5){_0x3d7eb5=_0x3d7eb5||0xcc;return function(_0x3ab95e){if(_0x3ab95e){return _0x53c2bf[_0x2fbd('0x27')](_0x3d7eb5);}return _0x53c2bf[_0x2fbd('0x28')](_0x3d7eb5)['end']();};}function respondWithResult(_0x158c4e,_0x397239){_0x397239=_0x397239||0xc8;return function(_0x5598af){if(_0x5598af){return _0x158c4e['status'](_0x397239)[_0x2fbd('0x29')](_0x5598af);}};}function respondWithFilteredResult(_0xa83e63,_0x1efdcb){return function(_0x52b46a){if(_0x52b46a){var _0x2803e6=typeof _0x1efdcb['offset']===_0x2fbd('0x2a')&&typeof _0x1efdcb['limit']===_0x2fbd('0x2a');var _0x2a48ec=_0x52b46a['count'];var _0x388500=_0x2803e6?0x0:_0x1efdcb['offset'];var _0x4b6f8a=_0x2803e6?_0x52b46a['count']:_0x1efdcb['offset']+_0x1efdcb['limit'];var _0x139716;if(_0x4b6f8a>=_0x2a48ec){_0x4b6f8a=_0x2a48ec;_0x139716=0xc8;}else{_0x139716=0xce;}_0xa83e63[_0x2fbd('0x28')](_0x139716);return _0xa83e63[_0x2fbd('0x2b')](_0x2fbd('0x2c'),_0x388500+'-'+_0x4b6f8a+'/'+_0x2a48ec)[_0x2fbd('0x29')](_0x52b46a);}return null;};}function patchUpdates(_0x370141){return function(_0xf0b4f4){try{jsonpatch[_0x2fbd('0x2d')](_0xf0b4f4,_0x370141,!![]);}catch(_0x339d23){return BPromise[_0x2fbd('0x2e')](_0x339d23);}return _0xf0b4f4[_0x2fbd('0x2f')]();};}function saveUpdates(_0x21bb1c,_0xb105ac){return function(_0x3de05e){if(_0x3de05e){return _0x3de05e[_0x2fbd('0x30')](_0x21bb1c)[_0x2fbd('0x31')](function(_0x5f13f4){return _0x5f13f4;});}return null;};}function removeEntity(_0x1f2c06,_0x17d56f){return function(_0x28ae38){if(_0x28ae38){return _0x28ae38[_0x2fbd('0x32')]()[_0x2fbd('0x31')](function(){_0x1f2c06[_0x2fbd('0x28')](0xcc)[_0x2fbd('0x33')]();});}};}function handleEntityNotFound(_0x43dfaa,_0x34100d){return function(_0x2d450a){if(!_0x2d450a){_0x43dfaa['sendStatus'](0x194);}return _0x2d450a;};}function handleError(_0x4f8add,_0x6d35af){_0x6d35af=_0x6d35af||0x1f4;return function(_0x290f7b){logger[_0x2fbd('0x24')](_0x290f7b[_0x2fbd('0x34')]);if(_0x290f7b[_0x2fbd('0x35')]){delete _0x290f7b[_0x2fbd('0x35')];}_0x4f8add[_0x2fbd('0x28')](_0x6d35af)[_0x2fbd('0x36')](_0x290f7b);};}exports[_0x2fbd('0x37')]=function(_0x24f9fe,_0x21eac8){var _0x535adf={},_0x81bb2b={},_0x9fd5bc={'count':0x0,'rows':[]};var _0x6037e9=_[_0x2fbd('0x38')](db['FaxMessage'][_0x2fbd('0x39')],function(_0x155e43){return{'name':_0x155e43[_0x2fbd('0x3a')],'type':_0x155e43['type'][_0x2fbd('0x3b')]};});_0x81bb2b[_0x2fbd('0x3c')]=_['map'](_0x6037e9,_0x2fbd('0x35'));_0x81bb2b[_0x2fbd('0x3d')]=_[_0x2fbd('0x3e')](_0x24f9fe['query']);_0x81bb2b[_0x2fbd('0x3f')]=_[_0x2fbd('0x40')](_0x81bb2b[_0x2fbd('0x3c')],_0x81bb2b[_0x2fbd('0x3d')]);_0x535adf['attributes']=_[_0x2fbd('0x40')](_0x81bb2b[_0x2fbd('0x3c')],qs[_0x2fbd('0x41')](_0x24f9fe['query'][_0x2fbd('0x41')]));_0x535adf[_0x2fbd('0x42')]=_0x535adf['attributes'][_0x2fbd('0x43')]?_0x535adf[_0x2fbd('0x42')]:_0x81bb2b[_0x2fbd('0x3c')];if(!_0x24f9fe[_0x2fbd('0x3d')][_0x2fbd('0x44')](_0x2fbd('0x45'))){_0x535adf['limit']=qs[_0x2fbd('0x46')](_0x24f9fe[_0x2fbd('0x3d')]['limit']);_0x535adf[_0x2fbd('0x47')]=qs['offset'](_0x24f9fe[_0x2fbd('0x3d')][_0x2fbd('0x47')]);}_0x535adf['order']=qs['sort'](_0x24f9fe[_0x2fbd('0x3d')][_0x2fbd('0x48')]);_0x535adf[_0x2fbd('0x49')]=qs[_0x2fbd('0x3f')](_[_0x2fbd('0x4a')](_0x24f9fe[_0x2fbd('0x3d')],_0x81bb2b[_0x2fbd('0x3f')]),_0x6037e9);if(_0x24f9fe[_0x2fbd('0x3d')][_0x2fbd('0x4b')]){_0x535adf[_0x2fbd('0x49')]=_[_0x2fbd('0x4c')](_0x535adf[_0x2fbd('0x49')],{'$or':_[_0x2fbd('0x38')](_0x6037e9,function(_0x2003bc){if(_0x2003bc[_0x2fbd('0x4d')]!=='VIRTUAL'){var _0x1c5a85={};_0x1c5a85[_0x2003bc[_0x2fbd('0x35')]]={'$like':'%'+_0x24f9fe[_0x2fbd('0x3d')][_0x2fbd('0x4b')]+'%'};return _0x1c5a85;}})});}_0x535adf=_[_0x2fbd('0x4c')]({},_0x535adf,_0x24f9fe[_0x2fbd('0x4e')]);var _0x11c229={'where':_0x535adf[_0x2fbd('0x49')]};return db['FaxMessage']['count'](_0x11c229)[_0x2fbd('0x31')](function(_0x51e9cd){_0x9fd5bc[_0x2fbd('0x4f')]=_0x51e9cd;if(_0x24f9fe[_0x2fbd('0x3d')][_0x2fbd('0x50')]){_0x535adf['include']=[{'all':!![]}];}return db['FaxMessage'][_0x2fbd('0x51')](_0x535adf);})[_0x2fbd('0x31')](function(_0x183e21){_0x9fd5bc[_0x2fbd('0x52')]=_0x183e21;return _0x9fd5bc;})[_0x2fbd('0x31')](respondWithFilteredResult(_0x21eac8,_0x535adf))['catch'](handleError(_0x21eac8,null));};exports[_0x2fbd('0x53')]=function(_0x1aa591,_0x127538){var _0x1ea648={'raw':!![],'where':{'id':_0x1aa591[_0x2fbd('0x54')]['id']}},_0x36ef54={};_0x36ef54[_0x2fbd('0x3c')]=_['keys'](db[_0x2fbd('0x55')][_0x2fbd('0x39')]);_0x36ef54[_0x2fbd('0x3d')]=_[_0x2fbd('0x3e')](_0x1aa591[_0x2fbd('0x3d')]);_0x36ef54[_0x2fbd('0x3f')]=_['intersection'](_0x36ef54[_0x2fbd('0x3c')],_0x36ef54['query']);_0x1ea648[_0x2fbd('0x42')]=_[_0x2fbd('0x40')](_0x36ef54[_0x2fbd('0x3c')],qs[_0x2fbd('0x41')](_0x1aa591[_0x2fbd('0x3d')][_0x2fbd('0x41')]));_0x1ea648[_0x2fbd('0x42')]=_0x1ea648[_0x2fbd('0x42')][_0x2fbd('0x43')]?_0x1ea648[_0x2fbd('0x42')]:_0x36ef54[_0x2fbd('0x3c')];if(_0x1aa591['query'][_0x2fbd('0x50')]){_0x1ea648[_0x2fbd('0x56')]=[{'all':!![]}];}_0x1ea648=_[_0x2fbd('0x4c')]({},_0x1ea648,_0x1aa591[_0x2fbd('0x4e')]);return db['FaxMessage']['find'](_0x1ea648)[_0x2fbd('0x31')](handleEntityNotFound(_0x127538,null))[_0x2fbd('0x31')](respondWithResult(_0x127538,null))[_0x2fbd('0x57')](handleError(_0x127538,null));};exports['update']=function(_0x5bfdfa,_0x1ead84){if(_0x5bfdfa[_0x2fbd('0x58')]['id']){delete _0x5bfdfa[_0x2fbd('0x58')]['id'];}return db[_0x2fbd('0x55')][_0x2fbd('0x59')]({'where':{'id':_0x5bfdfa['params']['id']}})[_0x2fbd('0x31')](handleEntityNotFound(_0x1ead84,null))['then'](saveUpdates(_0x5bfdfa[_0x2fbd('0x58')],null))['then'](respondWithResult(_0x1ead84,null))[_0x2fbd('0x57')](handleError(_0x1ead84,null));};exports[_0x2fbd('0x32')]=function(_0x19af7e,_0x2dadf1){return db[_0x2fbd('0x55')][_0x2fbd('0x59')]({'where':{'id':_0x19af7e[_0x2fbd('0x54')]['id']}})[_0x2fbd('0x31')](handleEntityNotFound(_0x2dadf1,null))[_0x2fbd('0x31')](removeEntity(_0x2dadf1,null))[_0x2fbd('0x57')](handleError(_0x2dadf1,null));};exports[_0x2fbd('0x5a')]=function(_0x44dd1e,_0x4dfb40){return db['FaxMessage'][_0x2fbd('0x5a')]()[_0x2fbd('0x31')](respondWithResult(_0x4dfb40,null))['catch'](handleError(_0x4dfb40,null));};var interaction_log=require(_0x2fbd('0x12'))(_0x2fbd('0x5b'));exports[_0x2fbd('0x5c')]=function(_0x447973,_0x24d9de,_0x334054){var _0x51b5da={'agent':{},'channel':_0x2fbd('0x5d')};if(_0x447973[_0x2fbd('0x58')]['id']){delete _0x447973[_0x2fbd('0x58')]['id'];}_0x447973[_0x2fbd('0x58')]['read']=!![];_0x447973['body'][_0x2fbd('0x5e')]=moment()['format'](_0x2fbd('0x5f'));_0x447973[_0x2fbd('0x58')][_0x2fbd('0x60')]=_0x447973['body'][_0x2fbd('0x60')]||_0x447973[_0x2fbd('0x61')]['id'];_0x51b5da['agent']['id']=_0x447973['body'][_0x2fbd('0x60')];return db[_0x2fbd('0x55')][_0x2fbd('0x59')]({'where':{'id':_0x447973[_0x2fbd('0x54')]['id'],'UserId':null}})[_0x2fbd('0x31')](handleEntityNotFound(_0x24d9de,null))[_0x2fbd('0x31')](saveUpdates(_0x447973[_0x2fbd('0x58')],null))[_0x2fbd('0x31')](function(_0x3e19fa){if(_0x3e19fa){_0x51b5da[_0x2fbd('0x25')]=_0x3e19fa[_0x2fbd('0x62')]({'plain':!![]});return db[_0x2fbd('0x63')][_0x2fbd('0x59')]({'where':{'id':_0x3e19fa[_0x2fbd('0x64')]}});}return null;})[_0x2fbd('0x31')](handleEntityNotFound(_0x24d9de,null))[_0x2fbd('0x31')](function(_0x5e14b8){if(_0x5e14b8){return _0x5e14b8[_0x2fbd('0x30')]({'UserId':_0x447973[_0x2fbd('0x58')][_0x2fbd('0x60')],'read1stAt':_[_0x2fbd('0x65')](_0x5e14b8[_0x2fbd('0x66')])?moment()[_0x2fbd('0x67')](_0x2fbd('0x5f')):undefined});}return null;})[_0x2fbd('0x31')](function(_0x38b680){if(_0x38b680){_0x51b5da[_0x2fbd('0x68')]=_0x38b680['get']({'plain':!![]});interaction_log[_0x2fbd('0x1d')](_0x2fbd('0x69'),_0x447973[_0x2fbd('0x61')]['id'],_0x447973[_0x2fbd('0x61')][_0x2fbd('0x35')],_0x447973[_0x2fbd('0x61')]['role'],_0x51b5da['interaction']['id'],_0x447973[_0x2fbd('0x58')]?JSON['stringify'](_0x447973[_0x2fbd('0x58')]):_0x2fbd('0x6a'));return respondWithRpcPromise(_0x2fbd('0x6b'),'acceptMessage',_0x51b5da);}return null;})[_0x2fbd('0x31')](function(_0x430f5a){var _0x42801b=_0x2fbd('0x6c')+_0x430f5a[_0x2fbd('0x25')][_0x2fbd('0x6d')];return db[_0x2fbd('0x6e')]['query'](_0x42801b,{'type':db[_0x2fbd('0x6f')]['QueryTypes'][_0x2fbd('0x70')],'raw':!![]})['then'](function(_0x258321){return _0x258321;});})[_0x2fbd('0x31')](function(_0x3f93b2){if(_0x3f93b2){_0x51b5da[_0x2fbd('0x25')][_0x2fbd('0x71')]=_0x3f93b2[0x0];if(!_0x447973[_0x2fbd('0x58')]['UserId'])return;return db[_0x2fbd('0x72')][_0x2fbd('0x59')]({'where':{'id':_0x447973[_0x2fbd('0x58')][_0x2fbd('0x60')],'role':_0x2fbd('0x73')},'attributes':['id',_0x2fbd('0x35'),_0x2fbd('0x74'),_0x2fbd('0x75'),_0x2fbd('0x76')],'raw':!![]});}return null;})['then'](function(_0x60dd85){if(!_0x60dd85)return null;_0x51b5da[_0x2fbd('0x25')]['agent']=_0x60dd85;return _0x51b5da;})[_0x2fbd('0x31')](function(_0x4b7e66){if(_0x4b7e66){if(_0x447973['body'][_0x2fbd('0x77')]){_0x51b5da[_0x2fbd('0x25')][_0x2fbd('0x78')]=util[_0x2fbd('0x67')](_0x2fbd('0x79'),_0x447973[_0x2fbd('0x61')][_0x2fbd('0x35')]);_0x51b5da[_0x2fbd('0x25')][_0x2fbd('0x7a')]=_0x51b5da[_0x2fbd('0x7a')];_0x51b5da[_0x2fbd('0x25')][_0x2fbd('0x7b')]=_0x51b5da[_0x2fbd('0x7a')];_0x51b5da[_0x2fbd('0x25')][_0x2fbd('0x7c')]=_0x2fbd('0x5c');return respondWithRpcPromise(_0x2fbd('0x7d'),_0x2fbd('0x7d'),{'event':'acceptmessage','message':_0x51b5da[_0x2fbd('0x25')]},client9002)[_0x2fbd('0x31')](function(){return _0x51b5da;});}return _0x51b5da;}return null;})[_0x2fbd('0x31')](respondWithResult(_0x24d9de,null))[_0x2fbd('0x57')](handleError(_0x24d9de,null));};var interaction_log=require(_0x2fbd('0x12'))(_0x2fbd('0x5b'));exports[_0x2fbd('0x2e')]=function(_0x5b4b78,_0x53ceed,_0x2bd00b){var _0x52bef9={'agent':{},'channel':_0x2fbd('0x5d')};if(_0x5b4b78['body']['id']){delete _0x5b4b78[_0x2fbd('0x58')]['id'];}_0x5b4b78[_0x2fbd('0x58')][_0x2fbd('0x60')]=_0x5b4b78[_0x2fbd('0x58')][_0x2fbd('0x60')]||_0x5b4b78[_0x2fbd('0x61')]['id'];_0x52bef9[_0x2fbd('0x73')]['id']=_0x5b4b78[_0x2fbd('0x58')][_0x2fbd('0x60')];return db[_0x2fbd('0x55')][_0x2fbd('0x59')]({'where':{'id':_0x5b4b78[_0x2fbd('0x54')]['id'],'UserId':null}})[_0x2fbd('0x31')](handleEntityNotFound(_0x53ceed,null))[_0x2fbd('0x31')](function(_0x8d4ba3){if(_0x8d4ba3){_0x52bef9[_0x2fbd('0x25')]=_0x8d4ba3[_0x2fbd('0x62')]({'plain':!![]});return db[_0x2fbd('0x63')][_0x2fbd('0x59')]({'where':{'id':_0x8d4ba3[_0x2fbd('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x53ceed,null))['then'](function(_0xa2fd52){if(_0xa2fd52){_0x52bef9[_0x2fbd('0x68')]=_0xa2fd52[_0x2fbd('0x62')]({'plain':!![]});interaction_log[_0x2fbd('0x1d')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5b4b78['user']['id'],_0x5b4b78['user'][_0x2fbd('0x35')],_0x5b4b78[_0x2fbd('0x61')][_0x2fbd('0x7e')],_0x52bef9[_0x2fbd('0x68')]['id'],_0x5b4b78[_0x2fbd('0x58')]?JSON['stringify'](_0x5b4b78[_0x2fbd('0x58')]):_0x2fbd('0x6a'));return respondWithRpcPromise('RejectMessage',_0x2fbd('0x7f'),_0x52bef9);}return null;})[_0x2fbd('0x31')](function(_0x32b179){var _0x2ec1cb=_0x2fbd('0x6c')+_0x32b179[_0x2fbd('0x25')]['ContactId'];return db[_0x2fbd('0x6e')][_0x2fbd('0x3d')](_0x2ec1cb,{'type':db['Sequelize'][_0x2fbd('0x80')][_0x2fbd('0x70')],'raw':!![]})[_0x2fbd('0x31')](function(_0xfb50c){return _0xfb50c;});})[_0x2fbd('0x31')](function(_0x1f9514){if(_0x1f9514){_0x52bef9[_0x2fbd('0x25')]['contact']=_0x1f9514[0x0];if(!_0x5b4b78[_0x2fbd('0x58')][_0x2fbd('0x60')])return;return db[_0x2fbd('0x72')][_0x2fbd('0x59')]({'where':{'id':_0x5b4b78[_0x2fbd('0x58')]['UserId'],'role':_0x2fbd('0x73')},'attributes':['id',_0x2fbd('0x35'),'fullname',_0x2fbd('0x75'),_0x2fbd('0x76')],'raw':!![]});}return null;})[_0x2fbd('0x31')](function(_0x1f0843){if(!_0x1f0843)return null;_0x52bef9['message']['agent']=_0x1f0843;return _0x52bef9;})[_0x2fbd('0x31')](function(_0x15b93e){if(_0x15b93e){_0x15b93e[_0x2fbd('0x25')][_0x2fbd('0x78')]=util[_0x2fbd('0x67')](_0x2fbd('0x79'),_0x5b4b78[_0x2fbd('0x61')]['name']);_0x15b93e['message'][_0x2fbd('0x7a')]=_0x52bef9['channel'];_0x15b93e[_0x2fbd('0x25')][_0x2fbd('0x7b')]=_0x52bef9[_0x2fbd('0x7a')];_0x15b93e[_0x2fbd('0x25')][_0x2fbd('0x7c')]=_0x2fbd('0x2e');respondWithRpcPromise(_0x2fbd('0x7d'),_0x2fbd('0x7d'),{'event':_0x2fbd('0x81'),'message':_0x15b93e[_0x2fbd('0x25')]},client9002);return _0x52bef9;}return null;})['then'](respondWithResult(_0x53ceed,null))[_0x2fbd('0x57')](handleError(_0x53ceed,null));};exports[_0x2fbd('0x82')]=function(_0x3f6bcc,_0x17a35c){var _0x1e66ff;return db[_0x2fbd('0x55')]['create'](_0x3f6bcc['body'],{})[_0x2fbd('0x31')](function(_0x368d61){_0x1e66ff=_0x368d61;return db[_0x2fbd('0x83')][_0x2fbd('0x84')]({'where':{'id':_0x1e66ff[_0x2fbd('0x6d')]}});})[_0x2fbd('0x31')](function(_0x32756f){if(_[_0x2fbd('0x65')](_0x32756f)){return;}else{_0x1e66ff[_0x2fbd('0x5d')]=_0x32756f[_0x2fbd('0x5d')];return db[_0x2fbd('0x85')][_0x2fbd('0x84')]({'where':{'id':_0x1e66ff[_0x2fbd('0x86')]}});}})[_0x2fbd('0x31')](function(_0x4b919e){return respondWithRpcPromise(_0x2fbd('0x87'),_0x2fbd('0x87'),{'FaxAccountId':_['isNil'](_0x3f6bcc[_0x2fbd('0x58')])?undefined:_0x3f6bcc[_0x2fbd('0x58')][_0x2fbd('0x88')],'path':_['isNil'](_0x4b919e)?undefined:util[_0x2fbd('0x67')]('/var/opt/motion2/server/files/attachments/%s',_0x4b919e['basename']),'fax':_[_0x2fbd('0x65')](_0x1e66ff[_0x2fbd('0x5d')])?undefined:_0x1e66ff['fax'],'AttachmentId':_0x1e66ff[_0x2fbd('0x86')]},client9002);})['then'](respondWithResult(_0x17a35c,0xc9))['catch'](handleError(_0x17a35c,null));};exports[_0x2fbd('0x89')]=function(_0x4a20d4,_0x31c2a0){var _0x4a8919=path[_0x2fbd('0x8a')](config[_0x2fbd('0x8b')],_0x2fbd('0x8c'),_0x2fbd('0x8d'),_0x2fbd('0x8e'));return db[_0x2fbd('0x55')]['find']({'where':{'id':_0x4a20d4[_0x2fbd('0x54')]['id']},'include':[{'model':db[_0x2fbd('0x85')],'as':'Attachment'}]})[_0x2fbd('0x31')](handleEntityNotFound(_0x31c2a0,null))['then'](function(_0x35a761){if(_0x35a761){return _0x31c2a0[_0x2fbd('0x89')](path[_0x2fbd('0x8a')](_0x4a8919,_0x35a761[_0x2fbd('0x85')][_0x2fbd('0x8f')]));}})['catch'](handleError(_0x31c2a0,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 129adb3..9f83e7b 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 _0xd906=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','FaxMessage'];(function(_0x4087e3,_0x2d931d){var _0x345d87=function(_0x1ab0c1){while(--_0x1ab0c1){_0x4087e3['push'](_0x4087e3['shift']());}};_0x345d87(++_0x2d931d);}(_0xd906,0x6b));var _0x6d90=function(_0x4b5a7d,_0x1a4bad){_0x4b5a7d=_0x4b5a7d-0x0;var _0x4c8c23=_0xd906[_0x4b5a7d];return _0x4c8c23;};'use strict';var EventEmitter=require('events');var FaxMessage=require('../../mysqldb')['db'][_0x6d90('0x0')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x6d90('0x1')](0x0);var events={'afterCreate':_0x6d90('0x2'),'afterUpdate':_0x6d90('0x3'),'afterDestroy':_0x6d90('0x4')};function emitEvent(_0x4d5bbd){return function(_0x2ae140,_0x431c1e,_0x132c67){FaxMessageEvents[_0x6d90('0x5')](_0x4d5bbd+':'+_0x2ae140['id'],_0x2ae140);FaxMessageEvents['emit'](_0x4d5bbd,_0x2ae140);_0x132c67(null);};}for(var e in events){if(events[_0x6d90('0x6')](e)){var event=events[e];FaxMessage[_0x6d90('0x7')](e,emitEvent(event));}}module[_0x6d90('0x8')]=FaxMessageEvents; \ No newline at end of file +var _0xecb2=['exports','events','setMaxListeners','remove','emit'];(function(_0x2de9d4,_0x1ec48f){var _0x419580=function(_0x29864b){while(--_0x29864b){_0x2de9d4['push'](_0x2de9d4['shift']());}};_0x419580(++_0x1ec48f);}(_0xecb2,0xf6));var _0x2ecb=function(_0x1bca5a,_0xff1e4c){_0x1bca5a=_0x1bca5a-0x0;var _0x4b3e80=_0xecb2[_0x1bca5a];return _0x4b3e80;};'use strict';var EventEmitter=require(_0x2ecb('0x0'));var FaxMessage=require('../../mysqldb')['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x2ecb('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x2ecb('0x2')};function emitEvent(_0x2f3639){return function(_0x393e7c,_0x2a4fe5,_0x1d007c){FaxMessageEvents[_0x2ecb('0x3')](_0x2f3639+':'+_0x393e7c['id'],_0x393e7c);FaxMessageEvents['emit'](_0x2f3639,_0x393e7c);_0x1d007c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x2ecb('0x4')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index d0196db..4e4c12d 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 _0x80c1=['FULLTEXT','models','get','toLowerCase','out','secret','UserId','FaxInteraction','FaxInteractionId','then','createdAt','direction','catch','error','utf8mb4','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./faxMessage.attributes','define','FaxMessage','fax_messages','fti_fax_messages','body'];(function(_0xd9432e,_0xe60d66){var _0x48711b=function(_0x2bbe6f){while(--_0x2bbe6f){_0xd9432e['push'](_0xd9432e['shift']());}};_0x48711b(++_0xe60d66);}(_0x80c1,0xa0));var _0x180c=function(_0xb3174d,_0x3726e3){_0xb3174d=_0xb3174d-0x0;var _0x5ddf1c=_0x80c1[_0xb3174d];return _0x5ddf1c;};'use strict';var _=require(_0x180c('0x0'));var util=require(_0x180c('0x1'));var logger=require('../../config/logger')(_0x180c('0x2'));var moment=require(_0x180c('0x3'));var BPromise=require(_0x180c('0x4'));var rp=require(_0x180c('0x5'));var fs=require('fs');var path=require(_0x180c('0x6'));var rimraf=require('rimraf');var config=require(_0x180c('0x7'));var attributes=require(_0x180c('0x8'));module['exports']=function(_0x40ab8c,_0x4e8b42){return _0x40ab8c[_0x180c('0x9')](_0x180c('0xa'),attributes,{'tableName':_0x180c('0xb'),'paranoid':![],'indexes':[{'name':_0x180c('0xc'),'fields':[_0x180c('0xd')],'type':_0x180c('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x38d096,_0x38f4fd,_0x439b6a){var _0xacadeb=_0x40ab8c[_0x180c('0xf')];var _0x30dc13=_0x38d096[_0x180c('0x10')]({'plain':!![]});if(_0x30dc13['direction'][_0x180c('0x11')]()==='in'||_0x30dc13['direction'][_0x180c('0x11')]()===_0x180c('0x12')&&!_0x30dc13[_0x180c('0x13')]&&!_['isNil'](_0x30dc13[_0x180c('0x14')])){_0xacadeb[_0x180c('0x15')]['findOne']({'where':{'id':_0x30dc13[_0x180c('0x16')]}})[_0x180c('0x17')](function(_0xb3da1b){if(_0xb3da1b){_0xb3da1b['update']({'lastMsgAt':_0x30dc13[_0x180c('0x18')],'lastMsgDirection':_0x30dc13[_0x180c('0x19')][_0x180c('0x11')]()});}})[_0x180c('0x1a')](function(_0x1a77e3){console[_0x180c('0x1b')](_0x1a77e3);});}_0x439b6a();}},'charset':_0x180c('0x1c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xecca=['FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','path','./faxMessage.attributes','define','FaxMessage','fax_messages','fti_fax_messages','body'];(function(_0x22bdd3,_0x552e50){var _0x44d9d9=function(_0x2b4ab9){while(--_0x2b4ab9){_0x22bdd3['push'](_0x22bdd3['shift']());}};_0x44d9d9(++_0x552e50);}(_0xecca,0x1d4));var _0xaecc=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xecca[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0xaecc('0x0'));var logger=require(_0xaecc('0x1'))(_0xaecc('0x2'));var moment=require('moment');var BPromise=require(_0xaecc('0x3'));var rp=require(_0xaecc('0x4'));var fs=require('fs');var path=require(_0xaecc('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xaecc('0x6'));module['exports']=function(_0x379c20,_0x390858){return _0x379c20[_0xaecc('0x7')](_0xaecc('0x8'),attributes,{'tableName':_0xaecc('0x9'),'paranoid':![],'indexes':[{'name':_0xaecc('0xa'),'fields':[_0xaecc('0xb')],'type':_0xaecc('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x40ec02,_0x252748,_0x4d2557){var _0x3aeb7a=_0x379c20[_0xaecc('0xd')];var _0x41f700=_0x40ec02['get']({'plain':!![]});if(_0x41f700[_0xaecc('0xe')][_0xaecc('0xf')]()==='in'||_0x41f700[_0xaecc('0xe')][_0xaecc('0xf')]()===_0xaecc('0x10')&&!_0x41f700[_0xaecc('0x11')]&&!_[_0xaecc('0x12')](_0x41f700[_0xaecc('0x13')])){_0x3aeb7a[_0xaecc('0x14')][_0xaecc('0x15')]({'where':{'id':_0x41f700[_0xaecc('0x16')]}})[_0xaecc('0x17')](function(_0x4dc5df){if(_0x4dc5df){_0x4dc5df[_0xaecc('0x18')]({'lastMsgAt':_0x41f700[_0xaecc('0x19')],'lastMsgDirection':_0x41f700[_0xaecc('0xe')]['toLowerCase']()});}})[_0xaecc('0x1a')](function(_0x1fb66e){console[_0xaecc('0x1b')](_0x1fb66e);});}_0x4d2557();}},'charset':_0xaecc('0x1c'),'collate':_0xaecc('0x1d')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 5a5613a..e87cd1c 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 _0x5c12=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','FaxMessage,\x20%s,\x20%s','message','catch','CreateFaxMessage','FaxMessage','create','body','options','then','stringify','UpdateFaxMessage','raw','attributes','limit','util','moment','randomstring','ioredis'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x5c12,0x188));var _0x25c1=function(_0xf04c6d,_0xe98786){_0xf04c6d=_0xf04c6d-0x0;var _0x4a804e=_0x5c12[_0xf04c6d];return _0x4a804e;};'use strict';var _=require('lodash');var util=require(_0x25c1('0x0'));var moment=require(_0x25c1('0x1'));var BPromise=require('bluebird');var rs=require(_0x25c1('0x2'));var fs=require('fs');var Redis=require(_0x25c1('0x3'));var db=require(_0x25c1('0x4'))['db'];var utils=require(_0x25c1('0x5'));var logger=require(_0x25c1('0x6'))(_0x25c1('0x7'));var config=require(_0x25c1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x25c1('0x9')][_0x25c1('0xa')]({'port':0x232a});config[_0x25c1('0xb')]=_['defaults'](config['redis'],{'host':_0x25c1('0xc'),'port':0x18eb});var socket=require(_0x25c1('0xd'))(new Redis(config[_0x25c1('0xb')]));require(_0x25c1('0xe'))[_0x25c1('0xf')](socket);function respondWithRpcPromise(_0x588f30,_0x3e062e,_0x41c89d){return new BPromise(function(_0x11a223,_0x81f0f4){return client[_0x25c1('0x10')](_0x588f30,_0x41c89d)['then'](function(_0x196e2f){logger[_0x25c1('0x11')]('FaxMessage,\x20%s,\x20%s',_0x3e062e,_0x25c1('0x12'));logger[_0x25c1('0x13')](_0x25c1('0x14'),_0x3e062e,_0x25c1('0x12'),JSON['stringify'](_0x196e2f));if(_0x196e2f['error']){if(_0x196e2f['error']['code']===0x1f4){logger[_0x25c1('0x15')](_0x25c1('0x16'),_0x3e062e,_0x196e2f[_0x25c1('0x15')][_0x25c1('0x17')]);return _0x81f0f4(_0x196e2f[_0x25c1('0x15')]['message']);}logger[_0x25c1('0x15')]('FaxMessage,\x20%s,\x20%s',_0x3e062e,_0x196e2f['error']['message']);return _0x11a223(_0x196e2f[_0x25c1('0x15')][_0x25c1('0x17')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x3e062e,_0x25c1('0x12'));_0x11a223(_0x196e2f['result'][_0x25c1('0x17')]);}})[_0x25c1('0x18')](function(_0x5c3c5d){logger['error']('FaxMessage,\x20%s,\x20%s',_0x3e062e,_0x5c3c5d);_0x81f0f4(_0x5c3c5d);});});}exports[_0x25c1('0x19')]=function(_0x3d3149){var _0x22a36e=this;return new Promise(function(_0x1bf95d,_0x481c12){return db[_0x25c1('0x1a')][_0x25c1('0x1b')](_0x3d3149[_0x25c1('0x1c')],{'raw':_0x3d3149[_0x25c1('0x1d')]?_0x3d3149['options']['raw']===undefined?!![]:![]:!![]})[_0x25c1('0x1e')](function(_0xac3335){logger[_0x25c1('0x11')](_0x25c1('0x19'),_0x3d3149);logger[_0x25c1('0x13')](_0x25c1('0x19'),_0x3d3149,JSON[_0x25c1('0x1f')](_0xac3335));_0x1bf95d(_0xac3335);})[_0x25c1('0x18')](function(_0x14ffd9){logger[_0x25c1('0x15')](_0x25c1('0x19'),_0x14ffd9[_0x25c1('0x17')],_0x3d3149);_0x481c12(_0x22a36e[_0x25c1('0x15')](0x1f4,_0x14ffd9['message']));});});};exports[_0x25c1('0x20')]=function(_0x20dbb9){var _0x1b1c96=this;return new Promise(function(_0x1fb59f,_0x21fdb8){return db[_0x25c1('0x1a')]['update'](_0x20dbb9[_0x25c1('0x1c')],{'raw':_0x20dbb9[_0x25c1('0x1d')]?_0x20dbb9[_0x25c1('0x1d')][_0x25c1('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20dbb9[_0x25c1('0x1d')]?_0x20dbb9[_0x25c1('0x1d')]['where']||null:null,'attributes':_0x20dbb9[_0x25c1('0x1d')]?_0x20dbb9['options'][_0x25c1('0x22')]||null:null,'limit':_0x20dbb9[_0x25c1('0x1d')]?_0x20dbb9[_0x25c1('0x1d')][_0x25c1('0x23')]||null:null})[_0x25c1('0x1e')](function(_0x21069c){logger[_0x25c1('0x11')](_0x25c1('0x20'),_0x20dbb9);logger[_0x25c1('0x13')]('UpdateFaxMessage',_0x20dbb9,JSON[_0x25c1('0x1f')](_0x21069c));_0x1fb59f(_0x21069c);})['catch'](function(_0x492715){logger[_0x25c1('0x15')](_0x25c1('0x20'),_0x492715['message'],_0x20dbb9);_0x21fdb8(_0x1b1c96[_0x25c1('0x15')](0x1f4,_0x492715['message']));});});}; \ No newline at end of file +var _0x54ef=['../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','./faxMessage.socket','request','then','info','request\x20sent','stringify','error','FaxMessage,\x20%s,\x20%s','message','result','catch','FaxMessage','create','body','options','raw','CreateFaxMessage','UpdateFaxMessage','where','attributes','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x1cabf4,_0x521317){var _0x713508=function(_0x5a284f){while(--_0x5a284f){_0x1cabf4['push'](_0x1cabf4['shift']());}};_0x713508(++_0x521317);}(_0x54ef,0x112));var _0xf54e=function(_0x51dba4,_0x5e1d14){_0x51dba4=_0x51dba4-0x0;var _0x419e10=_0x54ef[_0x51dba4];return _0x419e10;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var moment=require(_0xf54e('0x2'));var BPromise=require('bluebird');var rs=require(_0xf54e('0x3'));var fs=require('fs');var Redis=require(_0xf54e('0x4'));var db=require(_0xf54e('0x5'))['db'];var utils=require(_0xf54e('0x6'));var logger=require(_0xf54e('0x7'))(_0xf54e('0x8'));var config=require(_0xf54e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0xa')]({'port':0x232a});config[_0xf54e('0xb')]=_[_0xf54e('0xc')](config['redis'],{'host':_0xf54e('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf54e('0xb')]));require(_0xf54e('0xe'))['register'](socket);function respondWithRpcPromise(_0x26fc3e,_0xefa1c0,_0x6b9e61){return new BPromise(function(_0x3ecfb3,_0x5f232a){return client[_0xf54e('0xf')](_0x26fc3e,_0x6b9e61)[_0xf54e('0x10')](function(_0x143d66){logger[_0xf54e('0x11')]('FaxMessage,\x20%s,\x20%s',_0xefa1c0,_0xf54e('0x12'));logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0xefa1c0,_0xf54e('0x12'),JSON[_0xf54e('0x13')](_0x143d66));if(_0x143d66[_0xf54e('0x14')]){if(_0x143d66[_0xf54e('0x14')]['code']===0x1f4){logger[_0xf54e('0x14')](_0xf54e('0x15'),_0xefa1c0,_0x143d66[_0xf54e('0x14')][_0xf54e('0x16')]);return _0x5f232a(_0x143d66['error'][_0xf54e('0x16')]);}logger[_0xf54e('0x14')](_0xf54e('0x15'),_0xefa1c0,_0x143d66['error']['message']);return _0x3ecfb3(_0x143d66[_0xf54e('0x14')][_0xf54e('0x16')]);}else{logger[_0xf54e('0x11')](_0xf54e('0x15'),_0xefa1c0,_0xf54e('0x12'));_0x3ecfb3(_0x143d66[_0xf54e('0x17')][_0xf54e('0x16')]);}})[_0xf54e('0x18')](function(_0x1dcc04){logger[_0xf54e('0x14')](_0xf54e('0x15'),_0xefa1c0,_0x1dcc04);_0x5f232a(_0x1dcc04);});});}exports['CreateFaxMessage']=function(_0x48a7e1){var _0x23e14=this;return new Promise(function(_0x59f338,_0x3e1556){return db[_0xf54e('0x19')][_0xf54e('0x1a')](_0x48a7e1[_0xf54e('0x1b')],{'raw':_0x48a7e1[_0xf54e('0x1c')]?_0x48a7e1[_0xf54e('0x1c')][_0xf54e('0x1d')]===undefined?!![]:![]:!![]})[_0xf54e('0x10')](function(_0x3c0169){logger[_0xf54e('0x11')](_0xf54e('0x1e'),_0x48a7e1);logger['debug'](_0xf54e('0x1e'),_0x48a7e1,JSON['stringify'](_0x3c0169));_0x59f338(_0x3c0169);})[_0xf54e('0x18')](function(_0x272df6){logger[_0xf54e('0x14')](_0xf54e('0x1e'),_0x272df6[_0xf54e('0x16')],_0x48a7e1);_0x3e1556(_0x23e14[_0xf54e('0x14')](0x1f4,_0x272df6[_0xf54e('0x16')]));});});};exports[_0xf54e('0x1f')]=function(_0x2342a9){var _0x33457f=this;return new Promise(function(_0xf6cdd7,_0x39c0ae){return db[_0xf54e('0x19')]['update'](_0x2342a9[_0xf54e('0x1b')],{'raw':_0x2342a9['options']?_0x2342a9[_0xf54e('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2342a9[_0xf54e('0x1c')]?_0x2342a9[_0xf54e('0x1c')][_0xf54e('0x20')]||null:null,'attributes':_0x2342a9[_0xf54e('0x1c')]?_0x2342a9[_0xf54e('0x1c')][_0xf54e('0x21')]||null:null,'limit':_0x2342a9[_0xf54e('0x1c')]?_0x2342a9['options']['limit']||null:null})[_0xf54e('0x10')](function(_0x258d29){logger[_0xf54e('0x11')](_0xf54e('0x1f'),_0x2342a9);logger[_0xf54e('0x22')](_0xf54e('0x1f'),_0x2342a9,JSON[_0xf54e('0x13')](_0x258d29));_0xf6cdd7(_0x258d29);})[_0xf54e('0x18')](function(_0x3ae704){logger[_0xf54e('0x14')]('UpdateFaxMessage',_0x3ae704['message'],_0x2342a9);_0x39c0ae(_0x33457f[_0xf54e('0x14')](0x1f4,_0x3ae704[_0xf54e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 78d15db..7313183 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 _0x4412=['remove','update','emit','removeListener','register','length','faxMessage:','save'];(function(_0x1aea5e,_0x1bd960){var _0x1e4545=function(_0x577f64){while(--_0x577f64){_0x1aea5e['push'](_0x1aea5e['shift']());}};_0x1e4545(++_0x1bd960);}(_0x4412,0xa7));var _0x2441=function(_0xd5f137,_0x4c77ff){_0xd5f137=_0xd5f137-0x0;var _0xbb3f7f=_0x4412[_0xd5f137];return _0xbb3f7f;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x2441('0x0'),_0x2441('0x1'),_0x2441('0x2')];function createListener(_0x1a365e,_0x18507b){return function(_0x5cdb82){_0x18507b[_0x2441('0x3')](_0x1a365e,_0x5cdb82);};}function removeListener(_0x3662d4,_0xbd5462){return function(){FaxMessageEvents[_0x2441('0x4')](_0x3662d4,_0xbd5462);};}exports[_0x2441('0x5')]=function(_0x37cfb8){for(var _0x383685=0x0,_0x22b266=events[_0x2441('0x6')];_0x383685<_0x22b266;_0x383685++){var _0x168519=events[_0x383685];var _0x44e6c4=createListener(_0x2441('0x7')+_0x168519,_0x37cfb8);FaxMessageEvents['on'](_0x168519,_0x44e6c4);}}; \ No newline at end of file +var _0xa25e=['update','emit','removeListener','register','length','./faxMessage.events','save','remove'];(function(_0x4c2769,_0x42aadd){var _0x27bdf9=function(_0x4136a5){while(--_0x4136a5){_0x4c2769['push'](_0x4c2769['shift']());}};_0x27bdf9(++_0x42aadd);}(_0xa25e,0xd5));var _0xea25=function(_0x5b955c,_0x1b03c0){_0x5b955c=_0x5b955c-0x0;var _0x28028a=_0xa25e[_0x5b955c];return _0x28028a;};'use strict';var FaxMessageEvents=require(_0xea25('0x0'));var events=[_0xea25('0x1'),_0xea25('0x2'),_0xea25('0x3')];function createListener(_0x2da056,_0x153996){return function(_0x56a92c){_0x153996[_0xea25('0x4')](_0x2da056,_0x56a92c);};}function removeListener(_0x8d9e22,_0x4232f5){return function(){FaxMessageEvents[_0xea25('0x5')](_0x8d9e22,_0x4232f5);};}exports[_0xea25('0x6')]=function(_0x6d2818){for(var _0x70e0f6=0x0,_0x461eb8=events[_0xea25('0x7')];_0x70e0f6<_0x461eb8;_0x70e0f6++){var _0x5a232e=events[_0x70e0f6];var _0xba3284=createListener('faxMessage:'+_0x5a232e,_0x6d2818);FaxMessageEvents['on'](_0x5a232e,_0xba3284);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index e4ecfbc..edb39ac 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 _0x91a7=['isAuthenticated','/:id','show','download','tracked','fax','faxmessage:create','create','put','update','accept','/:id/reject','reject','delete','exports','util','path','connect-timeout','Router','../../components/auth/service','./faxMessage.controller','get','index','/describe'];(function(_0x2f48cd,_0x46a75a){var _0x193ae2=function(_0x253c01){while(--_0x253c01){_0x2f48cd['push'](_0x2f48cd['shift']());}};_0x193ae2(++_0x46a75a);}(_0x91a7,0xe7));var _0x791a=function(_0xffab0,_0x5f1f3d){_0xffab0=_0xffab0-0x0;var _0x1e07db=_0x91a7[_0xffab0];return _0x1e07db;};'use strict';var multer=require('multer');var util=require(_0x791a('0x0'));var path=require(_0x791a('0x1'));var timeout=require(_0x791a('0x2'));var express=require('express');var router=express[_0x791a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x791a('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x791a('0x5'));router[_0x791a('0x6')]('/',auth['isAuthenticated'](),controller[_0x791a('0x7')]);router['get'](_0x791a('0x8'),auth[_0x791a('0x9')](),controller['describe']);router[_0x791a('0x6')](_0x791a('0xa'),auth[_0x791a('0x9')](),controller[_0x791a('0xb')]);router[_0x791a('0x6')]('/:id/download',auth[_0x791a('0x9')](),controller[_0x791a('0xc')]);router['post']('/',auth[_0x791a('0x9')](),interaction[_0x791a('0xd')](_0x791a('0xe'),_0x791a('0xf')),controller[_0x791a('0x10')]);router[_0x791a('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x791a('0x12')]);router[_0x791a('0x11')]('/:id/accept',auth[_0x791a('0x9')](),controller[_0x791a('0x13')]);router['put'](_0x791a('0x14'),auth[_0x791a('0x9')](),controller[_0x791a('0x15')]);router[_0x791a('0x16')]('/:id',auth[_0x791a('0x9')](),controller['destroy']);module[_0x791a('0x17')]=router; \ No newline at end of file +var _0x39cb=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','index','/describe','isAuthenticated','/:id','show','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','path','express'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x39cb,0x1bd));var _0xb39c=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x39cb[_0x4b369d];return _0x571a98;};'use strict';var multer=require('multer');var util=require(_0xb39c('0x0'));var path=require(_0xb39c('0x1'));var timeout=require('connect-timeout');var express=require(_0xb39c('0x2'));var router=express[_0xb39c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb39c('0x4'));var interaction=require(_0xb39c('0x5'));var config=require(_0xb39c('0x6'));var controller=require(_0xb39c('0x7'));router[_0xb39c('0x8')]('/',auth['isAuthenticated'](),controller[_0xb39c('0x9')]);router[_0xb39c('0x8')](_0xb39c('0xa'),auth[_0xb39c('0xb')](),controller['describe']);router['get'](_0xb39c('0xc'),auth[_0xb39c('0xb')](),controller[_0xb39c('0xd')]);router[_0xb39c('0x8')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0xb39c('0xe')]('/',auth[_0xb39c('0xb')](),interaction[_0xb39c('0xf')](_0xb39c('0x10'),_0xb39c('0x11')),controller[_0xb39c('0x12')]);router[_0xb39c('0x13')](_0xb39c('0xc'),auth['isAuthenticated'](),controller[_0xb39c('0x14')]);router[_0xb39c('0x13')](_0xb39c('0x15'),auth['isAuthenticated'](),controller[_0xb39c('0x16')]);router[_0xb39c('0x13')](_0xb39c('0x17'),auth[_0xb39c('0xb')](),controller[_0xb39c('0x18')]);router[_0xb39c('0x19')](_0xb39c('0xc'),auth['isAuthenticated'](),controller[_0xb39c('0x1a')]);module[_0xb39c('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 5186f8f..81ce3df 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 _0x5edd=['INTEGER','rrmemory','beepall','exports','STRING'];(function(_0x199eea,_0xf78479){var _0x31c95f=function(_0xd93b0d){while(--_0xd93b0d){_0x199eea['push'](_0x199eea['shift']());}};_0x31c95f(++_0xf78479);}(_0x5edd,0xf3));var _0xd5ed=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x5edd[_0x53ccf2];return _0x5a2964;};'use strict';var Sequelize=require('sequelize');module[_0xd5ed('0x0')]={'name':{'type':Sequelize[_0xd5ed('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd5ed('0x1')]},'timeout':{'type':Sequelize[_0xd5ed('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xd5ed('0x3'),_0xd5ed('0x4'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xd5ed('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xff4f=['exports','STRING','INTEGER','ENUM','rrmemory','roundrobin','sequelize'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xff4f,0x156));var _0xfff4=function(_0x243ff4,_0x44a1b5){_0x243ff4=_0x243ff4-0x0;var _0x2ed845=_0xff4f[_0x243ff4];return _0x2ed845;};'use strict';var Sequelize=require(_0xfff4('0x0'));module[_0xfff4('0x1')]={'name':{'type':Sequelize[_0xfff4('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xfff4('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xfff4('0x4')](_0xfff4('0x5'),'beepall',_0xfff4('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xfff4('0x3')],'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 7b9de4d..f796c86 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 _0x9a77=['select','field','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','SELECT','TeamId','includes','all','union','compact','isEmpty','removeAgents','forEach','emit','addAgents','omit','userFaxQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxQueue.socket','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','get','stack','name','send','map','FaxQueue','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserFaxQueue','FaxQueueId','User','UserId','faxPause','updatedAt','createdAt','format','%s/%s','getTeams','findOne','Team','options','addTeams','ids','Agents','interface','flatMap','sequelize','transaction','each','findOrCreate','userFaxQueue:save','removeTeams'];(function(_0x5eed0f,_0x3fa328){var _0x3f0e75=function(_0x34ddbc){while(--_0x34ddbc){_0x5eed0f['push'](_0x5eed0f['shift']());}};_0x3f0e75(++_0x3fa328);}(_0x9a77,0x12f));var _0x79a7=function(_0x9eab05,_0x513c03){_0x9eab05=_0x9eab05-0x0;var _0x846b0f=_0x9a77[_0x9eab05];return _0x846b0f;};'use strict';var emlformat=require(_0x79a7('0x0'));var rimraf=require(_0x79a7('0x1'));var zipdir=require(_0x79a7('0x2'));var jsonpatch=require(_0x79a7('0x3'));var rp=require(_0x79a7('0x4'));var moment=require('moment');var BPromise=require(_0x79a7('0x5'));var Mustache=require('mustache');var util=require(_0x79a7('0x6'));var path=require(_0x79a7('0x7'));var sox=require(_0x79a7('0x8'));var csv=require(_0x79a7('0x9'));var ejs=require(_0x79a7('0xa'));var fs=require('fs');var fs_extra=require(_0x79a7('0xb'));var _=require(_0x79a7('0xc'));var squel=require(_0x79a7('0xd'));var crypto=require(_0x79a7('0xe'));var jsforce=require(_0x79a7('0xf'));var deskjs=require(_0x79a7('0x10'));var toCsv=require(_0x79a7('0x9'));var querystring=require(_0x79a7('0x11'));var Papa=require('papaparse');var Redis=require(_0x79a7('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x79a7('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x79a7('0x14'));var logger=require('../../config/logger')(_0x79a7('0x15'));var utils=require(_0x79a7('0x16'));var config=require(_0x79a7('0x17'));var licenseUtil=require(_0x79a7('0x18'));var db=require(_0x79a7('0x19'))['db'];config[_0x79a7('0x1a')]=_['defaults'](config[_0x79a7('0x1a')],{'host':_0x79a7('0x1b'),'port':0x18eb});var socket=require(_0x79a7('0x1c'))(new Redis(config[_0x79a7('0x1a')]));require(_0x79a7('0x1d'))['register'](socket);function respondWithStatusCode(_0x44ca4d,_0x55ccab){_0x55ccab=_0x55ccab||0xcc;return function(_0x14ff16){if(_0x14ff16){return _0x44ca4d[_0x79a7('0x1e')](_0x55ccab);}return _0x44ca4d['status'](_0x55ccab)[_0x79a7('0x1f')]();};}function respondWithResult(_0x1005c1,_0x5f31a9){_0x5f31a9=_0x5f31a9||0xc8;return function(_0xc71eb9){if(_0xc71eb9){return _0x1005c1[_0x79a7('0x20')](_0x5f31a9)['json'](_0xc71eb9);}};}function respondWithFilteredResult(_0x4539dd,_0xe2bfa3){return function(_0x206fae){if(_0x206fae){var _0x9e06d6=typeof _0xe2bfa3[_0x79a7('0x21')]===_0x79a7('0x22')&&typeof _0xe2bfa3[_0x79a7('0x23')]===_0x79a7('0x22');var _0x523100=_0x206fae[_0x79a7('0x24')];var _0x1ef0bb=_0x9e06d6?0x0:_0xe2bfa3['offset'];var _0x3ffe13=_0x9e06d6?_0x206fae[_0x79a7('0x24')]:_0xe2bfa3[_0x79a7('0x21')]+_0xe2bfa3[_0x79a7('0x23')];var _0x1a9650;if(_0x3ffe13>=_0x523100){_0x3ffe13=_0x523100;_0x1a9650=0xc8;}else{_0x1a9650=0xce;}_0x4539dd[_0x79a7('0x20')](_0x1a9650);return _0x4539dd[_0x79a7('0x25')](_0x79a7('0x26'),_0x1ef0bb+'-'+_0x3ffe13+'/'+_0x523100)[_0x79a7('0x27')](_0x206fae);}return null;};}function patchUpdates(_0x57f200){return function(_0x574e3d){try{jsonpatch[_0x79a7('0x28')](_0x574e3d,_0x57f200,!![]);}catch(_0x5f48cb){return BPromise['reject'](_0x5f48cb);}return _0x574e3d[_0x79a7('0x29')]();};}function saveUpdates(_0x1f53c4,_0x51fe4c){return function(_0x4e360b){if(_0x4e360b){return _0x4e360b[_0x79a7('0x2a')](_0x1f53c4)[_0x79a7('0x2b')](function(_0x392264){return _0x392264;});}return null;};}function removeEntity(_0x3ccaf4,_0x3bb40b){return function(_0x25308f){if(_0x25308f){return _0x25308f[_0x79a7('0x2c')]()[_0x79a7('0x2b')](function(){var _0x527396=_0x25308f[_0x79a7('0x2d')]({'plain':!![]});var _0x5a06b8='FaxQueues';return db['UserProfileResource'][_0x79a7('0x2c')]({'where':{'type':_0x5a06b8,'resourceId':_0x527396['id']}})[_0x79a7('0x2b')](function(){return _0x25308f;});})[_0x79a7('0x2b')](function(){_0x3ccaf4['status'](0xcc)[_0x79a7('0x1f')]();});}};}function handleEntityNotFound(_0x2ead0a,_0x40bc3b){return function(_0x5a4583){if(!_0x5a4583){_0x2ead0a[_0x79a7('0x1e')](0x194);}return _0x5a4583;};}function handleError(_0x275528,_0xa7c7ac){_0xa7c7ac=_0xa7c7ac||0x1f4;return function(_0x306812){logger['error'](_0x306812[_0x79a7('0x2e')]);if(_0x306812[_0x79a7('0x2f')]){delete _0x306812[_0x79a7('0x2f')];}_0x275528['status'](_0xa7c7ac)[_0x79a7('0x30')](_0x306812);};}exports['index']=function(_0x4ca6e0,_0x79253){var _0x4cb212={},_0x4398b3={},_0x5f3c5d={'count':0x0,'rows':[]};var _0x5ca39a=_[_0x79a7('0x31')](db[_0x79a7('0x32')][_0x79a7('0x33')],function(_0x1c531f){return{'name':_0x1c531f[_0x79a7('0x34')],'type':_0x1c531f[_0x79a7('0x35')][_0x79a7('0x36')]};});_0x4398b3[_0x79a7('0x37')]=_['map'](_0x5ca39a,_0x79a7('0x2f'));_0x4398b3['query']=_[_0x79a7('0x38')](_0x4ca6e0[_0x79a7('0x39')]);_0x4398b3[_0x79a7('0x3a')]=_['intersection'](_0x4398b3[_0x79a7('0x37')],_0x4398b3[_0x79a7('0x39')]);_0x4cb212[_0x79a7('0x3b')]=_[_0x79a7('0x3c')](_0x4398b3[_0x79a7('0x37')],qs[_0x79a7('0x3d')](_0x4ca6e0[_0x79a7('0x39')]['fields']));_0x4cb212[_0x79a7('0x3b')]=_0x4cb212[_0x79a7('0x3b')][_0x79a7('0x3e')]?_0x4cb212[_0x79a7('0x3b')]:_0x4398b3[_0x79a7('0x37')];if(!_0x4ca6e0[_0x79a7('0x39')][_0x79a7('0x3f')](_0x79a7('0x40'))){_0x4cb212[_0x79a7('0x23')]=qs[_0x79a7('0x23')](_0x4ca6e0[_0x79a7('0x39')][_0x79a7('0x23')]);_0x4cb212[_0x79a7('0x21')]=qs[_0x79a7('0x21')](_0x4ca6e0['query'][_0x79a7('0x21')]);}_0x4cb212[_0x79a7('0x41')]=qs['sort'](_0x4ca6e0['query'][_0x79a7('0x42')]);_0x4cb212[_0x79a7('0x43')]=qs[_0x79a7('0x3a')](_[_0x79a7('0x44')](_0x4ca6e0[_0x79a7('0x39')],_0x4398b3[_0x79a7('0x3a')]),_0x5ca39a);if(_0x4ca6e0[_0x79a7('0x39')][_0x79a7('0x45')]){_0x4cb212['where']=_[_0x79a7('0x46')](_0x4cb212['where'],{'$or':_[_0x79a7('0x31')](_0x5ca39a,function(_0x383716){if(_0x383716['type']!==_0x79a7('0x47')){var _0x479c8e={};_0x479c8e[_0x383716[_0x79a7('0x2f')]]={'$like':'%'+_0x4ca6e0[_0x79a7('0x39')][_0x79a7('0x45')]+'%'};return _0x479c8e;}})});}_0x4cb212=_[_0x79a7('0x46')]({},_0x4cb212,_0x4ca6e0['options']);var _0x36f45e={'where':_0x4cb212[_0x79a7('0x43')]};return db[_0x79a7('0x32')]['count'](_0x36f45e)[_0x79a7('0x2b')](function(_0x4c643d){_0x5f3c5d[_0x79a7('0x24')]=_0x4c643d;if(_0x4ca6e0['query'][_0x79a7('0x48')]){_0x4cb212[_0x79a7('0x49')]=[{'all':!![]}];}return db[_0x79a7('0x32')][_0x79a7('0x4a')](_0x4cb212);})[_0x79a7('0x2b')](function(_0x51a726){_0x5f3c5d[_0x79a7('0x4b')]=_0x51a726;return _0x5f3c5d;})[_0x79a7('0x2b')](respondWithFilteredResult(_0x79253,_0x4cb212))[_0x79a7('0x4c')](handleError(_0x79253,null));};exports[_0x79a7('0x4d')]=function(_0x95c32c,_0x28766f){var _0x391f06={'raw':!![],'where':{'id':_0x95c32c[_0x79a7('0x4e')]['id']}},_0x76b25={};_0x76b25['model']=_[_0x79a7('0x38')](db['FaxQueue'][_0x79a7('0x33')]);_0x76b25[_0x79a7('0x39')]=_['keys'](_0x95c32c[_0x79a7('0x39')]);_0x76b25['filters']=_[_0x79a7('0x3c')](_0x76b25['model'],_0x76b25['query']);_0x391f06[_0x79a7('0x3b')]=_[_0x79a7('0x3c')](_0x76b25[_0x79a7('0x37')],qs[_0x79a7('0x3d')](_0x95c32c[_0x79a7('0x39')][_0x79a7('0x3d')]));_0x391f06[_0x79a7('0x3b')]=_0x391f06[_0x79a7('0x3b')][_0x79a7('0x3e')]?_0x391f06['attributes']:_0x76b25['model'];if(_0x95c32c['query'][_0x79a7('0x48')]){_0x391f06['include']=[{'all':!![]}];}_0x391f06=_['merge']({},_0x391f06,_0x95c32c['options']);return db[_0x79a7('0x32')][_0x79a7('0x4f')](_0x391f06)[_0x79a7('0x2b')](handleEntityNotFound(_0x28766f,null))['then'](respondWithResult(_0x28766f,null))[_0x79a7('0x4c')](handleError(_0x28766f,null));};exports[_0x79a7('0x50')]=function(_0x2270a0,_0x399f00){return db[_0x79a7('0x32')]['create'](_0x2270a0[_0x79a7('0x51')],{})['then'](function(_0x277938){var _0x896261=_0x2270a0[_0x79a7('0x52')][_0x79a7('0x2d')]({'plain':!![]});if(!_0x896261)throw new Error(_0x79a7('0x53'));if(_0x896261[_0x79a7('0x54')]===_0x79a7('0x52')){var _0x1c9908=_0x277938[_0x79a7('0x2d')]({'plain':!![]});var _0x5036b3=_0x79a7('0x55');return db['UserProfileSection'][_0x79a7('0x4f')]({'where':{'name':_0x5036b3,'userProfileId':_0x896261[_0x79a7('0x56')]},'raw':!![]})[_0x79a7('0x2b')](function(_0xc98e85){if(_0xc98e85&&_0xc98e85[_0x79a7('0x57')]===0x0){return db[_0x79a7('0x58')][_0x79a7('0x50')]({'name':_0x1c9908[_0x79a7('0x2f')],'resourceId':_0x1c9908['id'],'type':_0xc98e85[_0x79a7('0x2f')],'sectionId':_0xc98e85['id']},{})['then'](function(){return _0x277938;});}else{return _0x277938;}})['catch'](function(_0x387905){logger[_0x79a7('0x59')](_0x79a7('0x5a'),_0x387905);throw _0x387905;});}return _0x277938;})[_0x79a7('0x2b')](respondWithResult(_0x399f00,0xc9))[_0x79a7('0x4c')](handleError(_0x399f00,null));};exports[_0x79a7('0x2a')]=function(_0x19b342,_0xd8216b){if(_0x19b342[_0x79a7('0x51')]['id']){delete _0x19b342[_0x79a7('0x51')]['id'];}return db[_0x79a7('0x32')]['find']({'where':{'id':_0x19b342[_0x79a7('0x4e')]['id']}})[_0x79a7('0x2b')](handleEntityNotFound(_0xd8216b,null))[_0x79a7('0x2b')](saveUpdates(_0x19b342[_0x79a7('0x51')],null))[_0x79a7('0x2b')](respondWithResult(_0xd8216b,null))[_0x79a7('0x4c')](handleError(_0xd8216b,null));};exports[_0x79a7('0x2c')]=function(_0x433976,_0x1d6574){return db['FaxQueue'][_0x79a7('0x4f')]({'where':{'id':_0x433976['params']['id']}})[_0x79a7('0x2b')](handleEntityNotFound(_0x1d6574,null))[_0x79a7('0x2b')](removeEntity(_0x1d6574,null))[_0x79a7('0x4c')](handleError(_0x1d6574,null));};exports[_0x79a7('0x5b')]=function(_0x2f5003,_0x215a5b){return db['FaxQueue']['describe']()[_0x79a7('0x2b')](respondWithResult(_0x215a5b,null))[_0x79a7('0x4c')](handleError(_0x215a5b,null));};exports[_0x79a7('0x5c')]=function(_0x23d28a,_0x255ebe,_0x50cfec){var _0x253eb4={'raw':!![],'where':{}},_0x143132={},_0xc9f407;return db['FaxQueue']['findOne']({'where':{'id':_0x23d28a[_0x79a7('0x4e')]['id']}})['then'](handleEntityNotFound(_0x255ebe,null))[_0x79a7('0x2b')](function(_0x4b22b3){if(_0x4b22b3){_0xc9f407=_0x4b22b3[_0x79a7('0x2d')]({'plain':!![]});_0x143132['model']=_['keys'](db[_0x79a7('0x5d')][_0x79a7('0x33')]);_0x143132[_0x79a7('0x39')]=_[_0x79a7('0x38')](_0x23d28a[_0x79a7('0x39')]);_0x143132['filters']=_[_0x79a7('0x3c')](_0x143132['model'],_0x143132[_0x79a7('0x39')]);_0x253eb4[_0x79a7('0x3b')]=_[_0x79a7('0x3c')](_0x143132[_0x79a7('0x37')],qs[_0x79a7('0x3d')](_0x23d28a['query'][_0x79a7('0x3d')]));_0x253eb4[_0x79a7('0x3b')]=_0x253eb4[_0x79a7('0x3b')][_0x79a7('0x3e')]?_0x253eb4['attributes']:_0x143132[_0x79a7('0x37')];if(!_0x23d28a[_0x79a7('0x39')][_0x79a7('0x3f')](_0x79a7('0x40'))){_0x253eb4[_0x79a7('0x23')]=qs[_0x79a7('0x23')](_0x23d28a[_0x79a7('0x39')][_0x79a7('0x23')]);_0x253eb4[_0x79a7('0x21')]=qs[_0x79a7('0x21')](_0x23d28a['query'][_0x79a7('0x21')]);}_0x253eb4['order']=qs['sort'](_0x23d28a[_0x79a7('0x39')]['sort']);_0x253eb4['where']=qs[_0x79a7('0x3a')](_[_0x79a7('0x44')](_0x23d28a[_0x79a7('0x39')],_0x143132['filters']));_0x253eb4[_0x79a7('0x43')][_0x79a7('0x5e')]=_0x4b22b3['id'];if(_0x23d28a[_0x79a7('0x39')][_0x79a7('0x45')]){_0x253eb4[_0x79a7('0x43')]=_[_0x79a7('0x46')](_0x253eb4[_0x79a7('0x43')],{'$or':_[_0x79a7('0x31')](_0x253eb4[_0x79a7('0x3b')],function(_0x41934f){var _0x215be6={};_0x215be6[_0x41934f]={'$like':'%'+_0x23d28a['query'][_0x79a7('0x45')]+'%'};return _0x215be6;})});}_0x253eb4=_['merge']({},_0x253eb4,_0x23d28a['options']);return db[_0x79a7('0x5d')][_0x79a7('0x4a')](_0x253eb4);}})['then'](function(_0x13948d){if(_0x13948d){return db[_0x79a7('0x5f')]['findAndCountAll']({'where':{'id':_[_0x79a7('0x31')](_0x13948d,_0x79a7('0x60')),'role':'agent'},'attributes':['id',_0x79a7('0x2f'),_0x79a7('0x61'),_0x79a7('0x62'),_0x79a7('0x63')]});}})[_0x79a7('0x2b')](function(_0x49844b){if(_0x49844b){return{'count':_0x49844b[_0x79a7('0x24')],'rows':_['map'](_0x49844b[_0x79a7('0x4b')],function(_0x3f888e){return{'membername':_0x3f888e['name'],'UserId':_0x3f888e['id'],'queue_name':_0xc9f407['name'],'FaxQueueId':_0xc9f407['id'],'interface':util[_0x79a7('0x64')](_0x79a7('0x65'),'SIP',_0x3f888e[_0x79a7('0x2f')]),'penalty':0x0,'paused':_0x3f888e['faxPause'],'createdAt':_0x3f888e[_0x79a7('0x63')],'updatedAt':_0x3f888e['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x79a7('0x2b')](respondWithFilteredResult(_0x255ebe,_0x253eb4))[_0x79a7('0x4c')](handleError(_0x255ebe,null));};exports[_0x79a7('0x66')]=function(_0xb978a7,_0x3ae2cb,_0x53be2d){var _0x1e3d16={};var _0x41fa79={};var _0x22cf76;var _0x189f72;return db[_0x79a7('0x32')][_0x79a7('0x67')]({'where':{'id':_0xb978a7[_0x79a7('0x4e')]['id']}})[_0x79a7('0x2b')](handleEntityNotFound(_0x3ae2cb,null))[_0x79a7('0x2b')](function(_0x53692b){if(_0x53692b){_0x22cf76=_0x53692b;_0x41fa79[_0x79a7('0x37')]=_['keys'](db[_0x79a7('0x68')][_0x79a7('0x33')]);_0x41fa79['query']=_[_0x79a7('0x38')](_0xb978a7[_0x79a7('0x39')]);_0x41fa79[_0x79a7('0x3a')]=_[_0x79a7('0x3c')](_0x41fa79[_0x79a7('0x37')],_0x41fa79[_0x79a7('0x39')]);_0x1e3d16[_0x79a7('0x3b')]=_[_0x79a7('0x3c')](_0x41fa79[_0x79a7('0x37')],qs[_0x79a7('0x3d')](_0xb978a7['query'][_0x79a7('0x3d')]));_0x1e3d16[_0x79a7('0x3b')]=_0x1e3d16[_0x79a7('0x3b')][_0x79a7('0x3e')]?_0x1e3d16['attributes']:_0x41fa79[_0x79a7('0x37')];_0x1e3d16['order']=qs[_0x79a7('0x42')](_0xb978a7[_0x79a7('0x39')][_0x79a7('0x42')]);_0x1e3d16[_0x79a7('0x43')]=qs[_0x79a7('0x3a')](_[_0x79a7('0x44')](_0xb978a7[_0x79a7('0x39')],_0x41fa79[_0x79a7('0x3a')]));if(_0xb978a7[_0x79a7('0x39')]['filter']){_0x1e3d16[_0x79a7('0x43')]=_[_0x79a7('0x46')](_0x1e3d16[_0x79a7('0x43')],{'$or':_[_0x79a7('0x31')](_0x1e3d16['attributes'],function(_0x1956f3){var _0x389b68={};_0x389b68[_0x1956f3]={'$like':'%'+_0xb978a7['query'][_0x79a7('0x45')]+'%'};return _0x389b68;})});}_0x1e3d16=_[_0x79a7('0x46')]({},_0x1e3d16,_0xb978a7[_0x79a7('0x69')]);return _0x22cf76['getTeams'](_0x1e3d16);}})[_0x79a7('0x2b')](function(_0x216c0e){if(_0x216c0e){_0x189f72=_0x216c0e[_0x79a7('0x3e')];if(!_0xb978a7[_0x79a7('0x39')][_0x79a7('0x3f')](_0x79a7('0x40'))){_0x1e3d16[_0x79a7('0x23')]=qs['limit'](_0xb978a7[_0x79a7('0x39')][_0x79a7('0x23')]);_0x1e3d16['offset']=qs['offset'](_0xb978a7[_0x79a7('0x39')][_0x79a7('0x21')]);}return _0x22cf76[_0x79a7('0x66')](_0x1e3d16);}})[_0x79a7('0x2b')](function(_0x381fa0){if(_0x381fa0){return _0x381fa0?{'count':_0x189f72,'rows':_0x381fa0}:null;}})['then'](respondWithResult(_0x3ae2cb,null))[_0x79a7('0x4c')](handleError(_0x3ae2cb,null));};exports[_0x79a7('0x6a')]=function(_0x1aeace,_0x3dfc9f,_0x4b2f7f){var _0x575a18=_0x1aeace['body'][_0x79a7('0x6b')];return db[_0x79a7('0x68')]['findAll']({'where':{'id':_0x575a18},'attributes':['id'],'include':[{'model':db[_0x79a7('0x5f')],'as':_0x79a7('0x6c'),'attributes':['id',_0x79a7('0x2f'),'online','voicePause',_0x79a7('0x6d')],'raw':!![]}]})[_0x79a7('0x2b')](function(_0x44b342){if(_0x44b342){var _0x1e82e4=_[_0x79a7('0x6e')](_0x44b342,function(_0x51b271){var _0x16d1d8=_0x51b271[_0x79a7('0x2d')]({'plain':!![]});return _0x16d1d8[_0x79a7('0x6c')];});return db[_0x79a7('0x32')][_0x79a7('0x4f')]({'where':{'id':_0x1aeace[_0x79a7('0x4e')]['id']}})[_0x79a7('0x2b')](function(_0x30dc9a){return db[_0x79a7('0x6f')][_0x79a7('0x70')](function(_0x5cc71c){return _0x30dc9a[_0x79a7('0x6a')](_0x575a18,{'transaction':_0x5cc71c})['then'](function(){return BPromise[_0x79a7('0x71')](_0x1e82e4,function(_0x56c72a){return db[_0x79a7('0x5d')][_0x79a7('0x72')]({'where':{'UserId':_0x56c72a['id'],'FaxQueueId':_0x1aeace[_0x79a7('0x4e')]['id']},'transaction':_0x5cc71c});});})[_0x79a7('0x2b')](function(){_0x1e82e4['forEach'](function(_0x3e902a){socket['emit'](_0x79a7('0x73'),{'UserId':_0x3e902a['id'],'FaxQueueId':_0x30dc9a['id']});});});});});}})[_0x79a7('0x2b')](respondWithStatusCode(_0x3dfc9f,null))[_0x79a7('0x4c')](handleError(_0x3dfc9f,null));};exports[_0x79a7('0x74')]=function(_0x5b7e3b,_0x4c9ae7,_0x4858e1){return db['Team'][_0x79a7('0x4a')]({'where':{'id':_0x5b7e3b['query'][_0x79a7('0x6b')]},'attributes':['id'],'include':[{'model':db[_0x79a7('0x5f')],'as':_0x79a7('0x6c'),'attributes':['id'],'raw':!![]}]})[_0x79a7('0x2b')](handleEntityNotFound(_0x4c9ae7,null))[_0x79a7('0x2b')](function(_0xe438e1){var _0x1a5d22=_['map'](_0xe438e1,'id');var _0x2c0f67=[];var _0x535e46=[];var _0x2f6f12=squel[_0x79a7('0x75')]();_0x2f6f12[_0x79a7('0x76')](_0x79a7('0x77'))['from']('team_has_fax_queues','tq')[_0x79a7('0x78')](_0x79a7('0x79'),'ut',_0x79a7('0x7a'))[_0x79a7('0x43')]('FaxQueueId\x20=\x20?',_0x5b7e3b[_0x79a7('0x4e')]['id']);for(var _0x4fded2=0x0;_0x4fded2<_0xe438e1[_0x79a7('0x3e')];_0x4fded2+=0x1){let _0x3b31de=_0xe438e1[_0x4fded2];for(var _0xde420=0x0;_0xde420<_0x3b31de[_0x79a7('0x6c')]['length'];_0xde420+=0x1){let _0x102085=_0x3b31de[_0x79a7('0x6c')][_0xde420];var _0x2a0732=_0x2f6f12['clone']();_0x2a0732[_0x79a7('0x43')](_0x79a7('0x7b'),_0x102085['id']);_0x535e46[_0x79a7('0x7c')](db[_0x79a7('0x6f')][_0x79a7('0x39')](_0x2a0732[_0x79a7('0x7d')](),{'type':db[_0x79a7('0x6f')]['QueryTypes'][_0x79a7('0x7e')]})[_0x79a7('0x2b')](function(_0x39646e){if(_0x39646e[_0x79a7('0x3e')]===0x1){return _0x102085['id'];}else{var _0x3b81bd=_['every'](_['map'](_0x39646e,_0x79a7('0x7f')),function(_0x952092){return _[_0x79a7('0x80')](_0x1a5d22,_0x952092);});if(_0x3b81bd){return _0x102085['id'];}}}));}}return BPromise[_0x79a7('0x81')](_0x535e46)['then'](function(_0x361cd9){_0x2c0f67=_(_0x2c0f67)[_0x79a7('0x82')](_0x361cd9)[_0x79a7('0x83')]()['value']();return db[_0x79a7('0x32')][_0x79a7('0x4f')]({'where':{'id':_0x5b7e3b[_0x79a7('0x4e')]['id']}})['then'](function(_0x47414c){return db[_0x79a7('0x6f')][_0x79a7('0x70')](function(_0x91ed81){return _0x47414c[_0x79a7('0x74')](_0x5b7e3b[_0x79a7('0x39')]['ids'],{'transaction':_0x91ed81})[_0x79a7('0x2b')](function(){if(!_[_0x79a7('0x84')](_0x2c0f67)){return _0x47414c[_0x79a7('0x85')](_0x2c0f67,{'transaction':_0x91ed81});}})[_0x79a7('0x2b')](function(){_0x2c0f67[_0x79a7('0x86')](function(_0x58d2d0){socket[_0x79a7('0x87')]('userFaxQueue:remove',{'UserId':_0x58d2d0,'FaxQueueId':_0x47414c['id']});});});});});});})[_0x79a7('0x2b')](respondWithStatusCode(_0x4c9ae7,null))[_0x79a7('0x4c')](handleError(_0x4c9ae7,null));};exports[_0x79a7('0x88')]=function(_0x911870,_0xc79fe5,_0xe02edb){return db[_0x79a7('0x32')][_0x79a7('0x4f')]({'where':{'id':_0x911870[_0x79a7('0x4e')]['id']}})[_0x79a7('0x2b')](handleEntityNotFound(_0xc79fe5,null))[_0x79a7('0x2b')](function(_0x31a752){if(_0x31a752){return _0x31a752[_0x79a7('0x88')](_0x911870[_0x79a7('0x51')][_0x79a7('0x6b')],_[_0x79a7('0x89')](_0x911870['body'],['ids','id'])||{})['spread'](function(_0x38f36f){for(var _0x4f9027=0x0;_0x4f9027<_0x911870['body'][_0x79a7('0x6b')][_0x79a7('0x3e')];_0x4f9027+=0x1){socket['emit'](_0x79a7('0x73'),{'UserId':Number(_0x911870[_0x79a7('0x51')]['ids'][_0x4f9027]),'FaxQueueId':Number(_0x911870[_0x79a7('0x4e')]['id'])});}return _0x38f36f;});}})[_0x79a7('0x2b')](respondWithResult(_0xc79fe5,null))['catch'](handleError(_0xc79fe5,null));};exports[_0x79a7('0x85')]=function(_0x2713e6,_0x88c795,_0x4e784c){return db[_0x79a7('0x32')][_0x79a7('0x4f')]({'where':{'id':_0x2713e6[_0x79a7('0x4e')]['id']}})['then'](handleEntityNotFound(_0x88c795,null))[_0x79a7('0x2b')](function(_0x2edbcd){if(_0x2edbcd){return _0x2edbcd[_0x79a7('0x85')](_0x2713e6[_0x79a7('0x39')][_0x79a7('0x6b')])[_0x79a7('0x2b')](function(){if(_['isArray'](_0x2713e6['query'][_0x79a7('0x6b')])){for(var _0x73e950=0x0;_0x73e950<_0x2713e6['query'][_0x79a7('0x6b')][_0x79a7('0x3e')];_0x73e950+=0x1){socket[_0x79a7('0x87')](_0x79a7('0x8a'),{'UserId':Number(_0x2713e6[_0x79a7('0x39')]['ids'][_0x73e950]),'FaxQueueId':Number(_0x2713e6['params']['id'])});}}else{socket[_0x79a7('0x87')](_0x79a7('0x8a'),{'UserId':Number(_0x2713e6['query'][_0x79a7('0x6b')]),'FaxQueueId':Number(_0x2713e6['params']['id'])});}});}})['then'](respondWithStatusCode(_0x88c795,null))['catch'](handleError(_0x88c795,null));};exports[_0x79a7('0x8b')]=function(_0x56404b,_0x595115,_0x3cc17f){var _0x2afc18={};var _0x1c0f33={};var _0x4078bf;var _0xc41c5a;return db[_0x79a7('0x32')][_0x79a7('0x67')]({'where':{'id':_0x56404b[_0x79a7('0x4e')]['id']}})[_0x79a7('0x2b')](handleEntityNotFound(_0x595115,null))['then'](function(_0x4133c3){if(_0x4133c3){_0x4078bf=_0x4133c3;_0x1c0f33[_0x79a7('0x37')]=_['keys'](db['User'][_0x79a7('0x33')]);_0x1c0f33[_0x79a7('0x39')]=_[_0x79a7('0x38')](_0x56404b[_0x79a7('0x39')]);_0x1c0f33[_0x79a7('0x3a')]=_[_0x79a7('0x3c')](_0x1c0f33['model'],_0x1c0f33['query']);_0x2afc18[_0x79a7('0x3b')]=_[_0x79a7('0x3c')](_0x1c0f33[_0x79a7('0x37')],qs[_0x79a7('0x3d')](_0x56404b[_0x79a7('0x39')]['fields']));_0x2afc18['attributes']=_0x2afc18[_0x79a7('0x3b')][_0x79a7('0x3e')]?_0x2afc18['attributes']:_0x1c0f33[_0x79a7('0x37')];_0x2afc18[_0x79a7('0x41')]=qs[_0x79a7('0x42')](_0x56404b['query']['sort']);_0x2afc18['where']=qs[_0x79a7('0x3a')](_[_0x79a7('0x44')](_0x56404b[_0x79a7('0x39')],_0x1c0f33[_0x79a7('0x3a')]));if(_0x56404b['query'][_0x79a7('0x45')]){_0x2afc18[_0x79a7('0x43')]=_[_0x79a7('0x46')](_0x2afc18[_0x79a7('0x43')],{'$or':_[_0x79a7('0x31')](_0x2afc18[_0x79a7('0x3b')],function(_0x5d2395){var _0xdd371f={};_0xdd371f[_0x5d2395]={'$like':'%'+_0x56404b[_0x79a7('0x39')][_0x79a7('0x45')]+'%'};return _0xdd371f;})});}_0x2afc18=_[_0x79a7('0x46')]({},_0x2afc18,_0x56404b[_0x79a7('0x69')]);return _0x4078bf[_0x79a7('0x8b')](_0x2afc18);}})[_0x79a7('0x2b')](function(_0x3a2416){if(_0x3a2416){_0xc41c5a=_0x3a2416[_0x79a7('0x3e')];if(!_0x56404b[_0x79a7('0x39')][_0x79a7('0x3f')]('nolimit')){_0x2afc18['limit']=qs['limit'](_0x56404b[_0x79a7('0x39')][_0x79a7('0x23')]);_0x2afc18[_0x79a7('0x21')]=qs[_0x79a7('0x21')](_0x56404b[_0x79a7('0x39')]['offset']);}return _0x4078bf[_0x79a7('0x8b')](_0x2afc18);}})[_0x79a7('0x2b')](function(_0x1ea7d0){if(_0x1ea7d0){return _0x1ea7d0?{'count':_0xc41c5a,'rows':_0x1ea7d0}:null;}})[_0x79a7('0x2b')](respondWithResult(_0x595115,null))[_0x79a7('0x4c')](handleError(_0x595115,null));}; \ No newline at end of file +var _0xe127=['save','then','UserProfileResource','stack','name','index','map','FaxQueue','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','options','findAll','rows','catch','params','includeAll','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','nolimit','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','merge','addTeams','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','ids','select','field','tq.TeamId','from','user_has_teams','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','union','compact','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','userFaxQueue:save','isArray','getAgents','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','reject'];(function(_0x1a8746,_0x3fc447){var _0x33bdae=function(_0x90a160){while(--_0x90a160){_0x1a8746['push'](_0x1a8746['shift']());}};_0x33bdae(++_0x3fc447);}(_0xe127,0xe9));var _0x7e12=function(_0x50a3f4,_0x50347a){_0x50a3f4=_0x50a3f4-0x0;var _0x3df624=_0xe127[_0x50a3f4];return _0x3df624;};'use strict';var emlformat=require(_0x7e12('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7e12('0x1'));var jsonpatch=require(_0x7e12('0x2'));var rp=require('request-promise');var moment=require(_0x7e12('0x3'));var BPromise=require(_0x7e12('0x4'));var Mustache=require(_0x7e12('0x5'));var util=require('util');var path=require(_0x7e12('0x6'));var sox=require(_0x7e12('0x7'));var csv=require(_0x7e12('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7e12('0x9'));var _=require(_0x7e12('0xa'));var squel=require('squel');var crypto=require(_0x7e12('0xb'));var jsforce=require(_0x7e12('0xc'));var deskjs=require(_0x7e12('0xd'));var toCsv=require(_0x7e12('0x8'));var querystring=require(_0x7e12('0xe'));var Papa=require(_0x7e12('0xf'));var Redis=require(_0x7e12('0x10'));var authService=require(_0x7e12('0x11'));var qs=require(_0x7e12('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7e12('0x13'));var logger=require('../../config/logger')(_0x7e12('0x14'));var utils=require(_0x7e12('0x15'));var config=require(_0x7e12('0x16'));var licenseUtil=require(_0x7e12('0x17'));var db=require(_0x7e12('0x18'))['db'];config['redis']=_[_0x7e12('0x19')](config[_0x7e12('0x1a')],{'host':_0x7e12('0x1b'),'port':0x18eb});var socket=require(_0x7e12('0x1c'))(new Redis(config[_0x7e12('0x1a')]));require(_0x7e12('0x1d'))[_0x7e12('0x1e')](socket);function respondWithStatusCode(_0x470cb4,_0x17d266){_0x17d266=_0x17d266||0xcc;return function(_0x3fc17f){if(_0x3fc17f){return _0x470cb4[_0x7e12('0x1f')](_0x17d266);}return _0x470cb4[_0x7e12('0x20')](_0x17d266)[_0x7e12('0x21')]();};}function respondWithResult(_0x26f11f,_0x31596f){_0x31596f=_0x31596f||0xc8;return function(_0x567943){if(_0x567943){return _0x26f11f['status'](_0x31596f)[_0x7e12('0x22')](_0x567943);}};}function respondWithFilteredResult(_0x4f4140,_0x19adb1){return function(_0x48bf3a){if(_0x48bf3a){var _0x3af795=typeof _0x19adb1[_0x7e12('0x23')]===_0x7e12('0x24')&&typeof _0x19adb1[_0x7e12('0x25')]===_0x7e12('0x24');var _0x3c9a49=_0x48bf3a[_0x7e12('0x26')];var _0x202340=_0x3af795?0x0:_0x19adb1['offset'];var _0x3475b=_0x3af795?_0x48bf3a[_0x7e12('0x26')]:_0x19adb1['offset']+_0x19adb1[_0x7e12('0x25')];var _0x10bc01;if(_0x3475b>=_0x3c9a49){_0x3475b=_0x3c9a49;_0x10bc01=0xc8;}else{_0x10bc01=0xce;}_0x4f4140['status'](_0x10bc01);return _0x4f4140[_0x7e12('0x27')]('Content-Range',_0x202340+'-'+_0x3475b+'/'+_0x3c9a49)[_0x7e12('0x22')](_0x48bf3a);}return null;};}function patchUpdates(_0x1fa33b){return function(_0x1b2e29){try{jsonpatch['apply'](_0x1b2e29,_0x1fa33b,!![]);}catch(_0x464041){return BPromise[_0x7e12('0x28')](_0x464041);}return _0x1b2e29[_0x7e12('0x29')]();};}function saveUpdates(_0x3b3013,_0x164846){return function(_0xb8386f){if(_0xb8386f){return _0xb8386f['update'](_0x3b3013)[_0x7e12('0x2a')](function(_0x429766){return _0x429766;});}return null;};}function removeEntity(_0x56ad74,_0x5b8542){return function(_0x1b5346){if(_0x1b5346){return _0x1b5346['destroy']()[_0x7e12('0x2a')](function(){var _0x8e0f56=_0x1b5346['get']({'plain':!![]});var _0x4cea99='FaxQueues';return db[_0x7e12('0x2b')]['destroy']({'where':{'type':_0x4cea99,'resourceId':_0x8e0f56['id']}})[_0x7e12('0x2a')](function(){return _0x1b5346;});})[_0x7e12('0x2a')](function(){_0x56ad74[_0x7e12('0x20')](0xcc)[_0x7e12('0x21')]();});}};}function handleEntityNotFound(_0x3a1f01,_0x481fc8){return function(_0x5dac5f){if(!_0x5dac5f){_0x3a1f01[_0x7e12('0x1f')](0x194);}return _0x5dac5f;};}function handleError(_0x263c49,_0x49c53a){_0x49c53a=_0x49c53a||0x1f4;return function(_0x1010ca){logger['error'](_0x1010ca[_0x7e12('0x2c')]);if(_0x1010ca[_0x7e12('0x2d')]){delete _0x1010ca[_0x7e12('0x2d')];}_0x263c49[_0x7e12('0x20')](_0x49c53a)['send'](_0x1010ca);};}exports[_0x7e12('0x2e')]=function(_0x2c345e,_0x8d6d32){var _0x9c9912={},_0xe6493b={},_0x2938c3={'count':0x0,'rows':[]};var _0x44cf24=_[_0x7e12('0x2f')](db[_0x7e12('0x30')][_0x7e12('0x31')],function(_0x26955d){return{'name':_0x26955d[_0x7e12('0x32')],'type':_0x26955d[_0x7e12('0x33')][_0x7e12('0x34')]};});_0xe6493b['model']=_[_0x7e12('0x2f')](_0x44cf24,_0x7e12('0x2d'));_0xe6493b[_0x7e12('0x35')]=_[_0x7e12('0x36')](_0x2c345e[_0x7e12('0x35')]);_0xe6493b[_0x7e12('0x37')]=_[_0x7e12('0x38')](_0xe6493b['model'],_0xe6493b['query']);_0x9c9912[_0x7e12('0x39')]=_['intersection'](_0xe6493b[_0x7e12('0x3a')],qs[_0x7e12('0x3b')](_0x2c345e['query'][_0x7e12('0x3b')]));_0x9c9912[_0x7e12('0x39')]=_0x9c9912[_0x7e12('0x39')][_0x7e12('0x3c')]?_0x9c9912[_0x7e12('0x39')]:_0xe6493b[_0x7e12('0x3a')];if(!_0x2c345e['query'][_0x7e12('0x3d')]('nolimit')){_0x9c9912[_0x7e12('0x25')]=qs[_0x7e12('0x25')](_0x2c345e[_0x7e12('0x35')][_0x7e12('0x25')]);_0x9c9912[_0x7e12('0x23')]=qs[_0x7e12('0x23')](_0x2c345e[_0x7e12('0x35')]['offset']);}_0x9c9912[_0x7e12('0x3e')]=qs['sort'](_0x2c345e['query'][_0x7e12('0x3f')]);_0x9c9912['where']=qs[_0x7e12('0x37')](_[_0x7e12('0x40')](_0x2c345e[_0x7e12('0x35')],_0xe6493b['filters']),_0x44cf24);if(_0x2c345e[_0x7e12('0x35')][_0x7e12('0x41')]){_0x9c9912['where']=_['merge'](_0x9c9912[_0x7e12('0x42')],{'$or':_[_0x7e12('0x2f')](_0x44cf24,function(_0x405797){if(_0x405797[_0x7e12('0x33')]!==_0x7e12('0x43')){var _0x249572={};_0x249572[_0x405797[_0x7e12('0x2d')]]={'$like':'%'+_0x2c345e[_0x7e12('0x35')]['filter']+'%'};return _0x249572;}})});}_0x9c9912=_['merge']({},_0x9c9912,_0x2c345e[_0x7e12('0x44')]);var _0x401e18={'where':_0x9c9912['where']};return db[_0x7e12('0x30')][_0x7e12('0x26')](_0x401e18)[_0x7e12('0x2a')](function(_0xe1a80f){_0x2938c3[_0x7e12('0x26')]=_0xe1a80f;if(_0x2c345e[_0x7e12('0x35')]['includeAll']){_0x9c9912['include']=[{'all':!![]}];}return db['FaxQueue'][_0x7e12('0x45')](_0x9c9912);})[_0x7e12('0x2a')](function(_0x3be463){_0x2938c3[_0x7e12('0x46')]=_0x3be463;return _0x2938c3;})['then'](respondWithFilteredResult(_0x8d6d32,_0x9c9912))[_0x7e12('0x47')](handleError(_0x8d6d32,null));};exports['show']=function(_0x2fc0ff,_0x4de88b){var _0x468b3b={'raw':!![],'where':{'id':_0x2fc0ff[_0x7e12('0x48')]['id']}},_0x1da422={};_0x1da422[_0x7e12('0x3a')]=_[_0x7e12('0x36')](db[_0x7e12('0x30')]['rawAttributes']);_0x1da422['query']=_[_0x7e12('0x36')](_0x2fc0ff['query']);_0x1da422[_0x7e12('0x37')]=_[_0x7e12('0x38')](_0x1da422[_0x7e12('0x3a')],_0x1da422[_0x7e12('0x35')]);_0x468b3b[_0x7e12('0x39')]=_[_0x7e12('0x38')](_0x1da422[_0x7e12('0x3a')],qs[_0x7e12('0x3b')](_0x2fc0ff[_0x7e12('0x35')][_0x7e12('0x3b')]));_0x468b3b[_0x7e12('0x39')]=_0x468b3b[_0x7e12('0x39')][_0x7e12('0x3c')]?_0x468b3b[_0x7e12('0x39')]:_0x1da422['model'];if(_0x2fc0ff[_0x7e12('0x35')][_0x7e12('0x49')]){_0x468b3b[_0x7e12('0x4a')]=[{'all':!![]}];}_0x468b3b=_['merge']({},_0x468b3b,_0x2fc0ff['options']);return db['FaxQueue'][_0x7e12('0x4b')](_0x468b3b)[_0x7e12('0x2a')](handleEntityNotFound(_0x4de88b,null))['then'](respondWithResult(_0x4de88b,null))[_0x7e12('0x47')](handleError(_0x4de88b,null));};exports[_0x7e12('0x4c')]=function(_0xa1fe9b,_0x5cdb3f){return db[_0x7e12('0x30')]['create'](_0xa1fe9b[_0x7e12('0x4d')],{})['then'](function(_0x11faf2){var _0x5216b8=_0xa1fe9b[_0x7e12('0x4e')][_0x7e12('0x4f')]({'plain':!![]});if(!_0x5216b8)throw new Error(_0x7e12('0x50'));if(_0x5216b8[_0x7e12('0x51')]===_0x7e12('0x4e')){var _0x4e4640=_0x11faf2['get']({'plain':!![]});var _0x2cf450=_0x7e12('0x52');return db[_0x7e12('0x53')]['find']({'where':{'name':_0x2cf450,'userProfileId':_0x5216b8[_0x7e12('0x54')]},'raw':!![]})[_0x7e12('0x2a')](function(_0x27af34){if(_0x27af34&&_0x27af34[_0x7e12('0x55')]===0x0){return db[_0x7e12('0x2b')]['create']({'name':_0x4e4640['name'],'resourceId':_0x4e4640['id'],'type':_0x27af34[_0x7e12('0x2d')],'sectionId':_0x27af34['id']},{})[_0x7e12('0x2a')](function(){return _0x11faf2;});}else{return _0x11faf2;}})[_0x7e12('0x47')](function(_0x42f4c9){logger[_0x7e12('0x56')](_0x7e12('0x57'),_0x42f4c9);throw _0x42f4c9;});}return _0x11faf2;})[_0x7e12('0x2a')](respondWithResult(_0x5cdb3f,0xc9))['catch'](handleError(_0x5cdb3f,null));};exports['update']=function(_0x285bdd,_0x19f1b6){if(_0x285bdd[_0x7e12('0x4d')]['id']){delete _0x285bdd[_0x7e12('0x4d')]['id'];}return db[_0x7e12('0x30')][_0x7e12('0x4b')]({'where':{'id':_0x285bdd[_0x7e12('0x48')]['id']}})['then'](handleEntityNotFound(_0x19f1b6,null))[_0x7e12('0x2a')](saveUpdates(_0x285bdd[_0x7e12('0x4d')],null))[_0x7e12('0x2a')](respondWithResult(_0x19f1b6,null))[_0x7e12('0x47')](handleError(_0x19f1b6,null));};exports['destroy']=function(_0x6edb9c,_0x2397fb){return db['FaxQueue'][_0x7e12('0x4b')]({'where':{'id':_0x6edb9c['params']['id']}})[_0x7e12('0x2a')](handleEntityNotFound(_0x2397fb,null))[_0x7e12('0x2a')](removeEntity(_0x2397fb,null))['catch'](handleError(_0x2397fb,null));};exports[_0x7e12('0x58')]=function(_0x5d9465,_0x516896){return db[_0x7e12('0x30')][_0x7e12('0x58')]()[_0x7e12('0x2a')](respondWithResult(_0x516896,null))[_0x7e12('0x47')](handleError(_0x516896,null));};exports[_0x7e12('0x59')]=function(_0x2aba49,_0x145c58,_0x2c0541){var _0x177a7b={'raw':!![],'where':{}},_0x5233e9={},_0x4867d4;return db['FaxQueue'][_0x7e12('0x5a')]({'where':{'id':_0x2aba49[_0x7e12('0x48')]['id']}})[_0x7e12('0x2a')](handleEntityNotFound(_0x145c58,null))[_0x7e12('0x2a')](function(_0x5175ea){if(_0x5175ea){_0x4867d4=_0x5175ea[_0x7e12('0x4f')]({'plain':!![]});_0x5233e9[_0x7e12('0x3a')]=_[_0x7e12('0x36')](db[_0x7e12('0x5b')][_0x7e12('0x31')]);_0x5233e9[_0x7e12('0x35')]=_[_0x7e12('0x36')](_0x2aba49['query']);_0x5233e9[_0x7e12('0x37')]=_[_0x7e12('0x38')](_0x5233e9[_0x7e12('0x3a')],_0x5233e9[_0x7e12('0x35')]);_0x177a7b[_0x7e12('0x39')]=_[_0x7e12('0x38')](_0x5233e9[_0x7e12('0x3a')],qs[_0x7e12('0x3b')](_0x2aba49[_0x7e12('0x35')][_0x7e12('0x3b')]));_0x177a7b['attributes']=_0x177a7b[_0x7e12('0x39')][_0x7e12('0x3c')]?_0x177a7b[_0x7e12('0x39')]:_0x5233e9[_0x7e12('0x3a')];if(!_0x2aba49[_0x7e12('0x35')][_0x7e12('0x3d')](_0x7e12('0x5c'))){_0x177a7b[_0x7e12('0x25')]=qs[_0x7e12('0x25')](_0x2aba49['query'][_0x7e12('0x25')]);_0x177a7b['offset']=qs['offset'](_0x2aba49[_0x7e12('0x35')]['offset']);}_0x177a7b[_0x7e12('0x3e')]=qs[_0x7e12('0x3f')](_0x2aba49[_0x7e12('0x35')]['sort']);_0x177a7b[_0x7e12('0x42')]=qs[_0x7e12('0x37')](_[_0x7e12('0x40')](_0x2aba49['query'],_0x5233e9[_0x7e12('0x37')]));_0x177a7b[_0x7e12('0x42')]['FaxQueueId']=_0x5175ea['id'];if(_0x2aba49[_0x7e12('0x35')]['filter']){_0x177a7b[_0x7e12('0x42')]=_['merge'](_0x177a7b[_0x7e12('0x42')],{'$or':_['map'](_0x177a7b[_0x7e12('0x39')],function(_0x491e31){var _0x3697ed={};_0x3697ed[_0x491e31]={'$like':'%'+_0x2aba49[_0x7e12('0x35')]['filter']+'%'};return _0x3697ed;})});}_0x177a7b=_['merge']({},_0x177a7b,_0x2aba49[_0x7e12('0x44')]);return db['UserFaxQueue']['findAll'](_0x177a7b);}})[_0x7e12('0x2a')](function(_0x36fb68){if(_0x36fb68){return db[_0x7e12('0x5d')][_0x7e12('0x5e')]({'where':{'id':_[_0x7e12('0x2f')](_0x36fb68,_0x7e12('0x5f')),'role':_0x7e12('0x60')},'attributes':['id','name',_0x7e12('0x61'),_0x7e12('0x62'),_0x7e12('0x63')]});}})[_0x7e12('0x2a')](function(_0x4010b5){if(_0x4010b5){return{'count':_0x4010b5[_0x7e12('0x26')],'rows':_[_0x7e12('0x2f')](_0x4010b5['rows'],function(_0x4d34af){return{'membername':_0x4d34af['name'],'UserId':_0x4d34af['id'],'queue_name':_0x4867d4[_0x7e12('0x2d')],'FaxQueueId':_0x4867d4['id'],'interface':util['format']('%s/%s','SIP',_0x4d34af[_0x7e12('0x2d')]),'penalty':0x0,'paused':_0x4d34af['faxPause'],'createdAt':_0x4d34af[_0x7e12('0x63')],'updatedAt':_0x4d34af[_0x7e12('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x145c58,_0x177a7b))[_0x7e12('0x47')](handleError(_0x145c58,null));};exports['getTeams']=function(_0x376ec7,_0x58a820,_0x3766df){var _0x42ff05={};var _0x904c8e={};var _0x3a3124;var _0x3bd111;return db[_0x7e12('0x30')][_0x7e12('0x5a')]({'where':{'id':_0x376ec7[_0x7e12('0x48')]['id']}})[_0x7e12('0x2a')](handleEntityNotFound(_0x58a820,null))[_0x7e12('0x2a')](function(_0x5f0c99){if(_0x5f0c99){_0x3a3124=_0x5f0c99;_0x904c8e['model']=_['keys'](db['Team'][_0x7e12('0x31')]);_0x904c8e['query']=_[_0x7e12('0x36')](_0x376ec7['query']);_0x904c8e[_0x7e12('0x37')]=_[_0x7e12('0x38')](_0x904c8e['model'],_0x904c8e[_0x7e12('0x35')]);_0x42ff05['attributes']=_[_0x7e12('0x38')](_0x904c8e[_0x7e12('0x3a')],qs[_0x7e12('0x3b')](_0x376ec7[_0x7e12('0x35')][_0x7e12('0x3b')]));_0x42ff05[_0x7e12('0x39')]=_0x42ff05[_0x7e12('0x39')][_0x7e12('0x3c')]?_0x42ff05[_0x7e12('0x39')]:_0x904c8e[_0x7e12('0x3a')];_0x42ff05[_0x7e12('0x3e')]=qs[_0x7e12('0x3f')](_0x376ec7[_0x7e12('0x35')]['sort']);_0x42ff05[_0x7e12('0x42')]=qs[_0x7e12('0x37')](_[_0x7e12('0x40')](_0x376ec7['query'],_0x904c8e[_0x7e12('0x37')]));if(_0x376ec7['query']['filter']){_0x42ff05[_0x7e12('0x42')]=_[_0x7e12('0x64')](_0x42ff05[_0x7e12('0x42')],{'$or':_[_0x7e12('0x2f')](_0x42ff05['attributes'],function(_0x3dc41b){var _0xf8ebb5={};_0xf8ebb5[_0x3dc41b]={'$like':'%'+_0x376ec7[_0x7e12('0x35')]['filter']+'%'};return _0xf8ebb5;})});}_0x42ff05=_['merge']({},_0x42ff05,_0x376ec7[_0x7e12('0x44')]);return _0x3a3124['getTeams'](_0x42ff05);}})[_0x7e12('0x2a')](function(_0x46eb12){if(_0x46eb12){_0x3bd111=_0x46eb12[_0x7e12('0x3c')];if(!_0x376ec7['query'][_0x7e12('0x3d')](_0x7e12('0x5c'))){_0x42ff05[_0x7e12('0x25')]=qs['limit'](_0x376ec7[_0x7e12('0x35')]['limit']);_0x42ff05[_0x7e12('0x23')]=qs[_0x7e12('0x23')](_0x376ec7[_0x7e12('0x35')][_0x7e12('0x23')]);}return _0x3a3124['getTeams'](_0x42ff05);}})[_0x7e12('0x2a')](function(_0x1cf939){if(_0x1cf939){return _0x1cf939?{'count':_0x3bd111,'rows':_0x1cf939}:null;}})[_0x7e12('0x2a')](respondWithResult(_0x58a820,null))['catch'](handleError(_0x58a820,null));};exports[_0x7e12('0x65')]=function(_0x34958a,_0xb41d77,_0x45336d){var _0x4968ec=_0x34958a[_0x7e12('0x4d')]['ids'];return db['Team'][_0x7e12('0x45')]({'where':{'id':_0x4968ec},'attributes':['id'],'include':[{'model':db[_0x7e12('0x5d')],'as':'Agents','attributes':['id',_0x7e12('0x2d'),'online',_0x7e12('0x66'),_0x7e12('0x67')],'raw':!![]}]})[_0x7e12('0x2a')](function(_0xfe70b3){if(_0xfe70b3){var _0x9f882f=_[_0x7e12('0x68')](_0xfe70b3,function(_0x16805a){var _0x3acbb9=_0x16805a['get']({'plain':!![]});return _0x3acbb9[_0x7e12('0x69')];});return db[_0x7e12('0x30')][_0x7e12('0x4b')]({'where':{'id':_0x34958a['params']['id']}})['then'](function(_0x100177){return db[_0x7e12('0x6a')][_0x7e12('0x6b')](function(_0x27c839){return _0x100177[_0x7e12('0x65')](_0x4968ec,{'transaction':_0x27c839})[_0x7e12('0x2a')](function(){return BPromise[_0x7e12('0x6c')](_0x9f882f,function(_0x265ea3){return db['UserFaxQueue'][_0x7e12('0x6d')]({'where':{'UserId':_0x265ea3['id'],'FaxQueueId':_0x34958a['params']['id']},'transaction':_0x27c839});});})['then'](function(){_0x9f882f[_0x7e12('0x6e')](function(_0x3deb76){socket[_0x7e12('0x6f')]('userFaxQueue:save',{'UserId':_0x3deb76['id'],'FaxQueueId':_0x100177['id']});});});});});}})[_0x7e12('0x2a')](respondWithStatusCode(_0xb41d77,null))[_0x7e12('0x47')](handleError(_0xb41d77,null));};exports[_0x7e12('0x70')]=function(_0x1a78f3,_0x2a1bc3,_0x1fb7b2){return db['Team'][_0x7e12('0x45')]({'where':{'id':_0x1a78f3[_0x7e12('0x35')][_0x7e12('0x71')]},'attributes':['id'],'include':[{'model':db[_0x7e12('0x5d')],'as':_0x7e12('0x69'),'attributes':['id'],'raw':!![]}]})[_0x7e12('0x2a')](handleEntityNotFound(_0x2a1bc3,null))['then'](function(_0x14e70b){var _0x2d5e2c=_['map'](_0x14e70b,'id');var _0x4180c5=[];var _0x4d730e=[];var _0x1e156e=squel[_0x7e12('0x72')]();_0x1e156e[_0x7e12('0x73')](_0x7e12('0x74'))[_0x7e12('0x75')]('team_has_fax_queues','tq')['join'](_0x7e12('0x76'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x7e12('0x77'),_0x1a78f3[_0x7e12('0x48')]['id']);for(var _0x8957b6=0x0;_0x8957b6<_0x14e70b[_0x7e12('0x3c')];_0x8957b6+=0x1){let _0x43e037=_0x14e70b[_0x8957b6];for(var _0x41a652=0x0;_0x41a652<_0x43e037[_0x7e12('0x69')][_0x7e12('0x3c')];_0x41a652+=0x1){let _0x50e636=_0x43e037['Agents'][_0x41a652];var _0x528329=_0x1e156e[_0x7e12('0x78')]();_0x528329[_0x7e12('0x42')](_0x7e12('0x79'),_0x50e636['id']);_0x4d730e[_0x7e12('0x7a')](db[_0x7e12('0x6a')]['query'](_0x528329[_0x7e12('0x7b')](),{'type':db[_0x7e12('0x6a')]['QueryTypes'][_0x7e12('0x7c')]})[_0x7e12('0x2a')](function(_0x2d01ed){if(_0x2d01ed['length']===0x1){return _0x50e636['id'];}else{var _0x194a0b=_[_0x7e12('0x7d')](_[_0x7e12('0x2f')](_0x2d01ed,_0x7e12('0x7e')),function(_0x22c516){return _['includes'](_0x2d5e2c,_0x22c516);});if(_0x194a0b){return _0x50e636['id'];}}}));}}return BPromise['all'](_0x4d730e)[_0x7e12('0x2a')](function(_0x4cfcad){_0x4180c5=_(_0x4180c5)[_0x7e12('0x7f')](_0x4cfcad)[_0x7e12('0x80')]()['value']();return db[_0x7e12('0x30')][_0x7e12('0x4b')]({'where':{'id':_0x1a78f3['params']['id']}})['then'](function(_0x22e70b){return db[_0x7e12('0x6a')][_0x7e12('0x6b')](function(_0x2075e1){return _0x22e70b[_0x7e12('0x70')](_0x1a78f3['query'][_0x7e12('0x71')],{'transaction':_0x2075e1})[_0x7e12('0x2a')](function(){if(!_[_0x7e12('0x81')](_0x4180c5)){return _0x22e70b[_0x7e12('0x82')](_0x4180c5,{'transaction':_0x2075e1});}})[_0x7e12('0x2a')](function(){_0x4180c5[_0x7e12('0x6e')](function(_0x1eeb1d){socket['emit'](_0x7e12('0x83'),{'UserId':_0x1eeb1d,'FaxQueueId':_0x22e70b['id']});});});});});});})['then'](respondWithStatusCode(_0x2a1bc3,null))[_0x7e12('0x47')](handleError(_0x2a1bc3,null));};exports[_0x7e12('0x84')]=function(_0x58fe80,_0x49e381,_0xbb1f5e){return db[_0x7e12('0x30')][_0x7e12('0x4b')]({'where':{'id':_0x58fe80[_0x7e12('0x48')]['id']}})[_0x7e12('0x2a')](handleEntityNotFound(_0x49e381,null))['then'](function(_0x2ad52e){if(_0x2ad52e){return _0x2ad52e[_0x7e12('0x84')](_0x58fe80['body'][_0x7e12('0x71')],_[_0x7e12('0x85')](_0x58fe80['body'],['ids','id'])||{})['spread'](function(_0x429a25){for(var _0x2ce6e7=0x0;_0x2ce6e7<_0x58fe80[_0x7e12('0x4d')][_0x7e12('0x71')][_0x7e12('0x3c')];_0x2ce6e7+=0x1){socket['emit'](_0x7e12('0x86'),{'UserId':Number(_0x58fe80[_0x7e12('0x4d')][_0x7e12('0x71')][_0x2ce6e7]),'FaxQueueId':Number(_0x58fe80[_0x7e12('0x48')]['id'])});}return _0x429a25;});}})[_0x7e12('0x2a')](respondWithResult(_0x49e381,null))['catch'](handleError(_0x49e381,null));};exports[_0x7e12('0x82')]=function(_0x5a7607,_0xec4396,_0x484651){return db[_0x7e12('0x30')]['find']({'where':{'id':_0x5a7607[_0x7e12('0x48')]['id']}})['then'](handleEntityNotFound(_0xec4396,null))[_0x7e12('0x2a')](function(_0x27e20e){if(_0x27e20e){return _0x27e20e['removeAgents'](_0x5a7607[_0x7e12('0x35')][_0x7e12('0x71')])[_0x7e12('0x2a')](function(){if(_[_0x7e12('0x87')](_0x5a7607['query'][_0x7e12('0x71')])){for(var _0xc6df31=0x0;_0xc6df31<_0x5a7607['query']['ids'][_0x7e12('0x3c')];_0xc6df31+=0x1){socket[_0x7e12('0x6f')](_0x7e12('0x83'),{'UserId':Number(_0x5a7607[_0x7e12('0x35')][_0x7e12('0x71')][_0xc6df31]),'FaxQueueId':Number(_0x5a7607[_0x7e12('0x48')]['id'])});}}else{socket[_0x7e12('0x6f')](_0x7e12('0x83'),{'UserId':Number(_0x5a7607[_0x7e12('0x35')][_0x7e12('0x71')]),'FaxQueueId':Number(_0x5a7607[_0x7e12('0x48')]['id'])});}});}})[_0x7e12('0x2a')](respondWithStatusCode(_0xec4396,null))[_0x7e12('0x47')](handleError(_0xec4396,null));};exports[_0x7e12('0x88')]=function(_0xebcae7,_0x477a8b,_0x52be8b){var _0x545ff0={};var _0x4ec02f={};var _0x3f163a;var _0x56363a;return db[_0x7e12('0x30')][_0x7e12('0x5a')]({'where':{'id':_0xebcae7[_0x7e12('0x48')]['id']}})[_0x7e12('0x2a')](handleEntityNotFound(_0x477a8b,null))[_0x7e12('0x2a')](function(_0x2d645d){if(_0x2d645d){_0x3f163a=_0x2d645d;_0x4ec02f['model']=_['keys'](db['User']['rawAttributes']);_0x4ec02f[_0x7e12('0x35')]=_[_0x7e12('0x36')](_0xebcae7[_0x7e12('0x35')]);_0x4ec02f[_0x7e12('0x37')]=_['intersection'](_0x4ec02f[_0x7e12('0x3a')],_0x4ec02f[_0x7e12('0x35')]);_0x545ff0[_0x7e12('0x39')]=_[_0x7e12('0x38')](_0x4ec02f[_0x7e12('0x3a')],qs['fields'](_0xebcae7[_0x7e12('0x35')][_0x7e12('0x3b')]));_0x545ff0[_0x7e12('0x39')]=_0x545ff0['attributes'][_0x7e12('0x3c')]?_0x545ff0[_0x7e12('0x39')]:_0x4ec02f[_0x7e12('0x3a')];_0x545ff0[_0x7e12('0x3e')]=qs[_0x7e12('0x3f')](_0xebcae7[_0x7e12('0x35')][_0x7e12('0x3f')]);_0x545ff0[_0x7e12('0x42')]=qs[_0x7e12('0x37')](_[_0x7e12('0x40')](_0xebcae7[_0x7e12('0x35')],_0x4ec02f[_0x7e12('0x37')]));if(_0xebcae7[_0x7e12('0x35')][_0x7e12('0x41')]){_0x545ff0['where']=_['merge'](_0x545ff0[_0x7e12('0x42')],{'$or':_[_0x7e12('0x2f')](_0x545ff0[_0x7e12('0x39')],function(_0x55f142){var _0x509052={};_0x509052[_0x55f142]={'$like':'%'+_0xebcae7['query'][_0x7e12('0x41')]+'%'};return _0x509052;})});}_0x545ff0=_[_0x7e12('0x64')]({},_0x545ff0,_0xebcae7[_0x7e12('0x44')]);return _0x3f163a[_0x7e12('0x88')](_0x545ff0);}})[_0x7e12('0x2a')](function(_0x25e0e6){if(_0x25e0e6){_0x56363a=_0x25e0e6[_0x7e12('0x3c')];if(!_0xebcae7[_0x7e12('0x35')][_0x7e12('0x3d')](_0x7e12('0x5c'))){_0x545ff0[_0x7e12('0x25')]=qs[_0x7e12('0x25')](_0xebcae7[_0x7e12('0x35')]['limit']);_0x545ff0[_0x7e12('0x23')]=qs[_0x7e12('0x23')](_0xebcae7['query']['offset']);}return _0x3f163a[_0x7e12('0x88')](_0x545ff0);}})[_0x7e12('0x2a')](function(_0x5b1cb9){if(_0x5b1cb9){return _0x5b1cb9?{'count':_0x56363a,'rows':_0x5b1cb9}:null;}})[_0x7e12('0x2a')](respondWithResult(_0x477a8b,null))[_0x7e12('0x47')](handleError(_0x477a8b,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index dcf158d..5cabdee 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 _0xfe2f=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x2c2d29,_0x5ce202){var _0x287aca=function(_0x85059){while(--_0x85059){_0x2c2d29['push'](_0x2c2d29['shift']());}};_0x287aca(++_0x5ce202);}(_0xfe2f,0xcb));var _0xffe2=function(_0x1937c4,_0x14e752){_0x1937c4=_0x1937c4-0x0;var _0x34a30c=_0xfe2f[_0x1937c4];return _0x34a30c;};'use strict';var EventEmitter=require(_0xffe2('0x0'));var FaxQueue=require(_0xffe2('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xffe2('0x2')](0x0);var events={'afterCreate':_0xffe2('0x3'),'afterUpdate':_0xffe2('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3c8ee9){return function(_0x565b9f,_0x2cf5f9,_0x49be8c){FaxQueueEvents['emit'](_0x3c8ee9+':'+_0x565b9f['id'],_0x565b9f);FaxQueueEvents[_0xffe2('0x5')](_0x3c8ee9,_0x565b9f);_0x49be8c(null);};}for(var e in events){if(events[_0xffe2('0x6')](e)){var event=events[e];FaxQueue[_0xffe2('0x7')](e,emitEvent(event));}}module[_0xffe2('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0x8392=['hook','exports','../../mysqldb','update','remove','emit','hasOwnProperty'];(function(_0x112011,_0x4ec684){var _0x1dc653=function(_0x2e2199){while(--_0x2e2199){_0x112011['push'](_0x112011['shift']());}};_0x1dc653(++_0x4ec684);}(_0x8392,0x160));var _0x2839=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x8392[_0x19e35c];return _0x3e1fe8;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x2839('0x0'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x2839('0x1'),'afterDestroy':_0x2839('0x2')};function emitEvent(_0x218b0a){return function(_0x46b724,_0x4abea0,_0x2e6381){FaxQueueEvents['emit'](_0x218b0a+':'+_0x46b724['id'],_0x46b724);FaxQueueEvents[_0x2839('0x3')](_0x218b0a,_0x46b724);_0x2e6381(null);};}for(var e in events){if(events[_0x2839('0x4')](e)){var event=events[e];FaxQueue[_0x2839('0x5')](e,emitEvent(event));}}module[_0x2839('0x6')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index d5dc9f5..eb88d9e 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 _0x556e=['util','../../config/logger','moment','request-promise','rimraf','../../config/environment','exports','define','FaxQueue','fax_queues','lodash'];(function(_0x4eae9e,_0x2dea8c){var _0x254e45=function(_0x49d27a){while(--_0x49d27a){_0x4eae9e['push'](_0x4eae9e['shift']());}};_0x254e45(++_0x2dea8c);}(_0x556e,0x13e));var _0xe556=function(_0x5471ec,_0x1ce81a){_0x5471ec=_0x5471ec-0x0;var _0x121d4c=_0x556e[_0x5471ec];return _0x121d4c;};'use strict';var _=require(_0xe556('0x0'));var util=require(_0xe556('0x1'));var logger=require(_0xe556('0x2'))('api');var moment=require(_0xe556('0x3'));var BPromise=require('bluebird');var rp=require(_0xe556('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe556('0x5'));var config=require(_0xe556('0x6'));var attributes=require('./faxQueue.attributes');module[_0xe556('0x7')]=function(_0x1176da,_0x1b453f){return _0x1176da[_0xe556('0x8')](_0xe556('0x9'),attributes,{'tableName':_0xe556('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1dd1=['moment','bluebird','request-promise','path','rimraf','./faxQueue.attributes','exports','define','FaxQueue','lodash','util','../../config/logger','api'];(function(_0x42ea95,_0x5aab6b){var _0x25c59b=function(_0x206c86){while(--_0x206c86){_0x42ea95['push'](_0x42ea95['shift']());}};_0x25c59b(++_0x5aab6b);}(_0x1dd1,0x11a));var _0x11dd=function(_0x11b2ca,_0x5257ab){_0x11b2ca=_0x11b2ca-0x0;var _0x4fbdb9=_0x1dd1[_0x11b2ca];return _0x4fbdb9;};'use strict';var _=require(_0x11dd('0x0'));var util=require(_0x11dd('0x1'));var logger=require(_0x11dd('0x2'))(_0x11dd('0x3'));var moment=require(_0x11dd('0x4'));var BPromise=require(_0x11dd('0x5'));var rp=require(_0x11dd('0x6'));var fs=require('fs');var path=require(_0x11dd('0x7'));var rimraf=require(_0x11dd('0x8'));var config=require('../../config/environment');var attributes=require(_0x11dd('0x9'));module[_0x11dd('0xa')]=function(_0x112ad8,_0x54841b){return _0x112ad8[_0x11dd('0xb')](_0x11dd('0xc'),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 b1659c2..6f944a9 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 _0xcf30=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','request\x20sent','debug','stringify','error','FaxQueue,\x20%s,\x20%s','message','info','result','catch','GetFaxQueue','FaxQueue','findAll','options','where','attributes','limit','include','map','model','ShowFaxQueue','find','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x4d8666,_0x2ff19d){var _0x37175b=function(_0x1b8de6){while(--_0x1b8de6){_0x4d8666['push'](_0x4d8666['shift']());}};_0x37175b(++_0x2ff19d);}(_0xcf30,0x1bd));var _0x0cf3=function(_0x39126d,_0x4276b8){_0x39126d=_0x39126d-0x0;var _0x98b37e=_0xcf30[_0x39126d];return _0x98b37e;};'use strict';var _=require(_0x0cf3('0x0'));var util=require(_0x0cf3('0x1'));var moment=require(_0x0cf3('0x2'));var BPromise=require('bluebird');var rs=require(_0x0cf3('0x3'));var fs=require('fs');var Redis=require(_0x0cf3('0x4'));var db=require(_0x0cf3('0x5'))['db'];var utils=require(_0x0cf3('0x6'));var logger=require(_0x0cf3('0x7'))(_0x0cf3('0x8'));var config=require(_0x0cf3('0x9'));var jayson=require(_0x0cf3('0xa'));var client=jayson[_0x0cf3('0xb')]['http']({'port':0x232a});config['redis']=_[_0x0cf3('0xc')](config['redis'],{'host':_0x0cf3('0xd'),'port':0x18eb});var socket=require(_0x0cf3('0xe'))(new Redis(config['redis']));require(_0x0cf3('0xf'))[_0x0cf3('0x10')](socket);function respondWithRpcPromise(_0x4d5e6f,_0xc44e4,_0x125cd4){return new BPromise(function(_0x1cb848,_0x5b72db){return client[_0x0cf3('0x11')](_0x4d5e6f,_0x125cd4)[_0x0cf3('0x12')](function(_0x4fe8d8){logger['info']('FaxQueue,\x20%s,\x20%s',_0xc44e4,_0x0cf3('0x13'));logger[_0x0cf3('0x14')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0xc44e4,'request\x20sent',JSON[_0x0cf3('0x15')](_0x4fe8d8));if(_0x4fe8d8[_0x0cf3('0x16')]){if(_0x4fe8d8['error']['code']===0x1f4){logger[_0x0cf3('0x16')](_0x0cf3('0x17'),_0xc44e4,_0x4fe8d8[_0x0cf3('0x16')][_0x0cf3('0x18')]);return _0x5b72db(_0x4fe8d8['error']['message']);}logger['error']('FaxQueue,\x20%s,\x20%s',_0xc44e4,_0x4fe8d8[_0x0cf3('0x16')][_0x0cf3('0x18')]);return _0x1cb848(_0x4fe8d8[_0x0cf3('0x16')]['message']);}else{logger[_0x0cf3('0x19')](_0x0cf3('0x17'),_0xc44e4,_0x0cf3('0x13'));_0x1cb848(_0x4fe8d8[_0x0cf3('0x1a')]['message']);}})[_0x0cf3('0x1b')](function(_0xa2bfba){logger[_0x0cf3('0x16')](_0x0cf3('0x17'),_0xc44e4,_0xa2bfba);_0x5b72db(_0xa2bfba);});});}exports[_0x0cf3('0x1c')]=function(_0x2d625b){var _0x97958b=this;return new Promise(function(_0x1d0cfb,_0xe0ad9){return db[_0x0cf3('0x1d')][_0x0cf3('0x1e')]({'raw':_0x2d625b[_0x0cf3('0x1f')]?_0x2d625b[_0x0cf3('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x2d625b[_0x0cf3('0x1f')]?_0x2d625b[_0x0cf3('0x1f')][_0x0cf3('0x20')]||null:null,'attributes':_0x2d625b[_0x0cf3('0x1f')]?_0x2d625b[_0x0cf3('0x1f')][_0x0cf3('0x21')]||null:null,'limit':_0x2d625b[_0x0cf3('0x1f')]?_0x2d625b['options'][_0x0cf3('0x22')]||null:null,'include':_0x2d625b[_0x0cf3('0x1f')]?_0x2d625b['options'][_0x0cf3('0x23')]?_[_0x0cf3('0x24')](_0x2d625b['options']['include'],function(_0x2cfc6c){return{'model':db[_0x2cfc6c[_0x0cf3('0x25')]],'as':_0x2cfc6c['as'],'attributes':_0x2cfc6c[_0x0cf3('0x21')],'include':_0x2cfc6c[_0x0cf3('0x23')]?_[_0x0cf3('0x24')](_0x2cfc6c[_0x0cf3('0x23')],function(_0x132788){return{'model':db[_0x132788[_0x0cf3('0x25')]],'as':_0x132788['as'],'attributes':_0x132788['attributes'],'include':_0x132788[_0x0cf3('0x23')]?_[_0x0cf3('0x24')](_0x132788[_0x0cf3('0x23')],function(_0x2fedf9){return{'model':db[_0x2fedf9[_0x0cf3('0x25')]],'as':_0x2fedf9['as'],'attributes':_0x2fedf9['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x28585f){logger[_0x0cf3('0x19')](_0x0cf3('0x1c'),_0x2d625b);logger[_0x0cf3('0x14')](_0x0cf3('0x1c'),_0x2d625b,JSON[_0x0cf3('0x15')](_0x28585f));_0x1d0cfb(_0x28585f);})[_0x0cf3('0x1b')](function(_0xb18dc){logger['error'](_0x0cf3('0x1c'),_0xb18dc[_0x0cf3('0x18')],_0x2d625b);_0xe0ad9(_0x97958b[_0x0cf3('0x16')](0x1f4,_0xb18dc[_0x0cf3('0x18')]));});});};exports[_0x0cf3('0x26')]=function(_0x2308eb){var _0x945cd3=this;return new Promise(function(_0x303b70,_0x499119){return db[_0x0cf3('0x1d')][_0x0cf3('0x27')]({'raw':_0x2308eb[_0x0cf3('0x1f')]?_0x2308eb['options'][_0x0cf3('0x28')]===undefined?!![]:![]:!![],'where':_0x2308eb[_0x0cf3('0x1f')]?_0x2308eb['options'][_0x0cf3('0x20')]||null:null,'attributes':_0x2308eb['options']?_0x2308eb[_0x0cf3('0x1f')][_0x0cf3('0x21')]||null:null,'include':_0x2308eb[_0x0cf3('0x1f')]?_0x2308eb['options']['include']?_[_0x0cf3('0x24')](_0x2308eb['options'][_0x0cf3('0x23')],function(_0x549cb6){return{'model':db[_0x549cb6['model']],'as':_0x549cb6['as'],'attributes':_0x549cb6['attributes'],'include':_0x549cb6[_0x0cf3('0x23')]?_[_0x0cf3('0x24')](_0x549cb6[_0x0cf3('0x23')],function(_0x3f10e6){return{'model':db[_0x3f10e6[_0x0cf3('0x25')]],'as':_0x3f10e6['as'],'attributes':_0x3f10e6['attributes'],'include':_0x3f10e6[_0x0cf3('0x23')]?_[_0x0cf3('0x24')](_0x3f10e6[_0x0cf3('0x23')],function(_0x5f35c8){return{'model':db[_0x5f35c8[_0x0cf3('0x25')]],'as':_0x5f35c8['as'],'attributes':_0x5f35c8['attributes']};}):[]};}):[]};}):[]:[]})[_0x0cf3('0x12')](function(_0x2f7cf8){logger[_0x0cf3('0x19')](_0x0cf3('0x26'),_0x2308eb);logger[_0x0cf3('0x14')]('ShowFaxQueue',_0x2308eb,JSON[_0x0cf3('0x15')](_0x2f7cf8));_0x303b70(_0x2f7cf8);})['catch'](function(_0x3d24d1){logger[_0x0cf3('0x16')](_0x0cf3('0x26'),_0x3d24d1[_0x0cf3('0x18')],_0x2308eb);_0x499119(_0x945cd3[_0x0cf3('0x16')](0x1f4,_0x3d24d1[_0x0cf3('0x18')]));});});}; \ No newline at end of file +var _0x06c9=['options','where','attributes','limit','include','map','model','info','debug','stringify','ShowFaxQueue','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','register','then','FaxQueue,\x20%s,\x20%s','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetFaxQueue','FaxQueue'];(function(_0x43bc4c,_0x29021f){var _0x8bd98f=function(_0x43490b){while(--_0x43490b){_0x43bc4c['push'](_0x43bc4c['shift']());}};_0x8bd98f(++_0x29021f);}(_0x06c9,0x158));var _0x906c=function(_0x1e4195,_0x1fea58){_0x1e4195=_0x1e4195-0x0;var _0x5b7479=_0x06c9[_0x1e4195];return _0x5b7479;};'use strict';var _=require(_0x906c('0x0'));var util=require('util');var moment=require(_0x906c('0x1'));var BPromise=require(_0x906c('0x2'));var rs=require(_0x906c('0x3'));var fs=require('fs');var Redis=require(_0x906c('0x4'));var db=require(_0x906c('0x5'))['db'];var utils=require(_0x906c('0x6'));var logger=require('../../config/logger')(_0x906c('0x7'));var config=require(_0x906c('0x8'));var jayson=require(_0x906c('0x9'));var client=jayson[_0x906c('0xa')]['http']({'port':0x232a});config[_0x906c('0xb')]=_['defaults'](config[_0x906c('0xb')],{'host':_0x906c('0xc'),'port':0x18eb});var socket=require(_0x906c('0xd'))(new Redis(config[_0x906c('0xb')]));require('./faxQueue.socket')[_0x906c('0xe')](socket);function respondWithRpcPromise(_0x3fefa9,_0x485ca9,_0x1cbd30){return new BPromise(function(_0x122aa8,_0x2bdcf6){return client['request'](_0x3fefa9,_0x1cbd30)[_0x906c('0xf')](function(_0x35f65d){logger['info'](_0x906c('0x10'),_0x485ca9,'request\x20sent');logger['debug'](_0x906c('0x11'),_0x485ca9,_0x906c('0x12'),JSON['stringify'](_0x35f65d));if(_0x35f65d[_0x906c('0x13')]){if(_0x35f65d['error'][_0x906c('0x14')]===0x1f4){logger[_0x906c('0x13')]('FaxQueue,\x20%s,\x20%s',_0x485ca9,_0x35f65d['error'][_0x906c('0x15')]);return _0x2bdcf6(_0x35f65d[_0x906c('0x13')]['message']);}logger[_0x906c('0x13')](_0x906c('0x10'),_0x485ca9,_0x35f65d['error'][_0x906c('0x15')]);return _0x122aa8(_0x35f65d[_0x906c('0x13')]['message']);}else{logger['info']('FaxQueue,\x20%s,\x20%s',_0x485ca9,'request\x20sent');_0x122aa8(_0x35f65d[_0x906c('0x16')]['message']);}})[_0x906c('0x17')](function(_0x3b3c96){logger[_0x906c('0x13')](_0x906c('0x10'),_0x485ca9,_0x3b3c96);_0x2bdcf6(_0x3b3c96);});});}exports[_0x906c('0x18')]=function(_0x1e7097){var _0x18faa6=this;return new Promise(function(_0x118065,_0x34bfb5){return db[_0x906c('0x19')]['findAll']({'raw':_0x1e7097[_0x906c('0x1a')]?_0x1e7097[_0x906c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1e7097[_0x906c('0x1a')]?_0x1e7097['options'][_0x906c('0x1b')]||null:null,'attributes':_0x1e7097['options']?_0x1e7097[_0x906c('0x1a')][_0x906c('0x1c')]||null:null,'limit':_0x1e7097[_0x906c('0x1a')]?_0x1e7097[_0x906c('0x1a')][_0x906c('0x1d')]||null:null,'include':_0x1e7097['options']?_0x1e7097[_0x906c('0x1a')][_0x906c('0x1e')]?_[_0x906c('0x1f')](_0x1e7097[_0x906c('0x1a')]['include'],function(_0x27efb0){return{'model':db[_0x27efb0[_0x906c('0x20')]],'as':_0x27efb0['as'],'attributes':_0x27efb0[_0x906c('0x1c')],'include':_0x27efb0[_0x906c('0x1e')]?_['map'](_0x27efb0['include'],function(_0x38e4b8){return{'model':db[_0x38e4b8[_0x906c('0x20')]],'as':_0x38e4b8['as'],'attributes':_0x38e4b8[_0x906c('0x1c')],'include':_0x38e4b8[_0x906c('0x1e')]?_[_0x906c('0x1f')](_0x38e4b8['include'],function(_0x27f616){return{'model':db[_0x27f616[_0x906c('0x20')]],'as':_0x27f616['as'],'attributes':_0x27f616['attributes']};}):[]};}):[]};}):[]:[]})[_0x906c('0xf')](function(_0x4a3708){logger[_0x906c('0x21')](_0x906c('0x18'),_0x1e7097);logger[_0x906c('0x22')](_0x906c('0x18'),_0x1e7097,JSON[_0x906c('0x23')](_0x4a3708));_0x118065(_0x4a3708);})[_0x906c('0x17')](function(_0x70181a){logger[_0x906c('0x13')]('GetFaxQueue',_0x70181a[_0x906c('0x15')],_0x1e7097);_0x34bfb5(_0x18faa6['error'](0x1f4,_0x70181a['message']));});});};exports[_0x906c('0x24')]=function(_0x183d4e){var _0x15ad89=this;return new Promise(function(_0x467669,_0x1e3558){return db[_0x906c('0x19')]['find']({'raw':_0x183d4e[_0x906c('0x1a')]?_0x183d4e[_0x906c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x183d4e[_0x906c('0x1a')]?_0x183d4e[_0x906c('0x1a')][_0x906c('0x1b')]||null:null,'attributes':_0x183d4e['options']?_0x183d4e['options'][_0x906c('0x1c')]||null:null,'include':_0x183d4e['options']?_0x183d4e[_0x906c('0x1a')][_0x906c('0x1e')]?_[_0x906c('0x1f')](_0x183d4e[_0x906c('0x1a')]['include'],function(_0x4e4e63){return{'model':db[_0x4e4e63[_0x906c('0x20')]],'as':_0x4e4e63['as'],'attributes':_0x4e4e63[_0x906c('0x1c')],'include':_0x4e4e63[_0x906c('0x1e')]?_['map'](_0x4e4e63[_0x906c('0x1e')],function(_0x2dd667){return{'model':db[_0x2dd667[_0x906c('0x20')]],'as':_0x2dd667['as'],'attributes':_0x2dd667['attributes'],'include':_0x2dd667['include']?_[_0x906c('0x1f')](_0x2dd667['include'],function(_0x338655){return{'model':db[_0x338655[_0x906c('0x20')]],'as':_0x338655['as'],'attributes':_0x338655['attributes']};}):[]};}):[]};}):[]:[]})[_0x906c('0xf')](function(_0xf86796){logger[_0x906c('0x21')](_0x906c('0x24'),_0x183d4e);logger['debug'](_0x906c('0x24'),_0x183d4e,JSON[_0x906c('0x23')](_0xf86796));_0x467669(_0xf86796);})['catch'](function(_0x4a1a14){logger['error']('ShowFaxQueue',_0x4a1a14[_0x906c('0x15')],_0x183d4e);_0x1e3558(_0x15ad89[_0x906c('0x13')](0x1f4,_0x4a1a14['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index a99ba71..b36347e 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 _0x82c0=['length','faxQueue:','./faxQueue.events','remove','update','emit','removeListener','register'];(function(_0x54d5ba,_0x1f1ba9){var _0x6a592e=function(_0x394f8d){while(--_0x394f8d){_0x54d5ba['push'](_0x54d5ba['shift']());}};_0x6a592e(++_0x1f1ba9);}(_0x82c0,0xa2));var _0x082c=function(_0x480ca5,_0xac04a1){_0x480ca5=_0x480ca5-0x0;var _0x452a79=_0x82c0[_0x480ca5];return _0x452a79;};'use strict';var FaxQueueEvents=require(_0x082c('0x0'));var events=['save',_0x082c('0x1'),_0x082c('0x2')];function createListener(_0x37440b,_0x2e08b6){return function(_0xbaf5c){_0x2e08b6[_0x082c('0x3')](_0x37440b,_0xbaf5c);};}function removeListener(_0x471b3e,_0xa240df){return function(){FaxQueueEvents[_0x082c('0x4')](_0x471b3e,_0xa240df);};}exports[_0x082c('0x5')]=function(_0x5aa5ed){for(var _0x19a14d=0x0,_0x8e7f5=events[_0x082c('0x6')];_0x19a14d<_0x8e7f5;_0x19a14d++){var _0x50183f=events[_0x19a14d];var _0x1df217=createListener(_0x082c('0x7')+_0x50183f,_0x5aa5ed);FaxQueueEvents['on'](_0x50183f,_0x1df217);}}; \ No newline at end of file +var _0xeaaa=['length','./faxQueue.events','save','remove','update'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0xeaaa,0x13c));var _0xaeaa=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xeaaa[_0x397e5f];return _0x5302b8;};'use strict';var FaxQueueEvents=require(_0xaeaa('0x0'));var events=[_0xaeaa('0x1'),_0xaeaa('0x2'),_0xaeaa('0x3')];function createListener(_0x48542b,_0x47abd3){return function(_0xbed3d3){_0x47abd3['emit'](_0x48542b,_0xbed3d3);};}function removeListener(_0x51ae5d,_0x1c216e){return function(){FaxQueueEvents['removeListener'](_0x51ae5d,_0x1c216e);};}exports['register']=function(_0x18318d){for(var _0x1d1d6c=0x0,_0x313cc5=events[_0xaeaa('0x4')];_0x1d1d6c<_0x313cc5;_0x1d1d6c++){var _0x5c7bf2=events[_0x1d1d6c];var _0x85608d=createListener('faxQueue:'+_0x5c7bf2,_0x18318d);FaxQueueEvents['on'](_0x5c7bf2,_0x85608d);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index ec6cf47..f08c0d1 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 _0x38b8=['Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','/:id','show','/:id/members','getMembers','get','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','update','delete','destroy','removeAgents','exports','multer','path','connect-timeout'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x38b8,0x7f));var _0x838b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x38b8[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x838b('0x0'));var util=require('util');var path=require(_0x838b('0x1'));var timeout=require(_0x838b('0x2'));var express=require('express');var router=express[_0x838b('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x838b('0x4'));var config=require(_0x838b('0x5'));var controller=require('./faxQueue.controller');router['get']('/',auth[_0x838b('0x6')](),controller[_0x838b('0x7')]);router['get'](_0x838b('0x8'),auth[_0x838b('0x6')](),controller['describe']);router['get'](_0x838b('0x9'),auth[_0x838b('0x6')](),controller[_0x838b('0xa')]);router['get'](_0x838b('0xb'),auth['isAuthenticated'](),controller[_0x838b('0xc')]);router[_0x838b('0xd')](_0x838b('0xe'),auth[_0x838b('0x6')](),controller[_0x838b('0xf')]);router[_0x838b('0xd')]('/:id/users',auth[_0x838b('0x6')](),controller[_0x838b('0x10')]);router[_0x838b('0x11')]('/',auth[_0x838b('0x6')](),controller[_0x838b('0x12')]);router[_0x838b('0x11')](_0x838b('0xe'),auth[_0x838b('0x6')](),controller[_0x838b('0x13')]);router['post'](_0x838b('0x14'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x838b('0x9'),auth[_0x838b('0x6')](),controller[_0x838b('0x15')]);router[_0x838b('0x16')](_0x838b('0x9'),auth['isAuthenticated'](),controller[_0x838b('0x17')]);router[_0x838b('0x16')](_0x838b('0xe'),auth[_0x838b('0x6')](),controller['removeTeams']);router[_0x838b('0x16')](_0x838b('0x14'),auth['isAuthenticated'](),controller[_0x838b('0x18')]);module[_0x838b('0x19')]=router; \ No newline at end of file +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(_0x2dbe87,_0x2084bc){var _0x294b99=function(_0x519831){while(--_0x519831){_0x2dbe87['push'](_0x2dbe87['shift']());}};_0x294b99(++_0x2084bc);}(_0x4c60,0xc1));var _0x04c6=function(_0x5e7781,_0x1451eb){_0x5e7781=_0x5e7781-0x0;var _0x231dea=_0x4c60[_0x5e7781];return _0x231dea;};'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 diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 68bb3a8..7346968 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 _0xd8b1=['DATE','moment','sequelize','exports','STRING'];(function(_0x3905bf,_0x50c2d3){var _0x53a4b5=function(_0x1a5b4a){while(--_0x1a5b4a){_0x3905bf['push'](_0x3905bf['shift']());}};_0x53a4b5(++_0x50c2d3);}(_0xd8b1,0x105));var _0x1d8b=function(_0x36a974,_0x177b2a){_0x36a974=_0x36a974-0x0;var _0x3f04f=_0xd8b1[_0x36a974];return _0x3f04f;};'use strict';var moment=require(_0x1d8b('0x0'));var Sequelize=require(_0x1d8b('0x1'));module[_0x1d8b('0x2')]={'uniqueid':{'type':Sequelize[_0x1d8b('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x1d8b('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x1d8b('0x4')]},'acceptAt':{'type':Sequelize[_0x1d8b('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x1d8b('0x3')]}}; \ No newline at end of file +var _0x734b=['DATE','moment','exports','STRING'];(function(_0x17d114,_0x5a9988){var _0x95997b=function(_0x5e01e8){while(--_0x5e01e8){_0x17d114['push'](_0x17d114['shift']());}};_0x95997b(++_0x5a9988);}(_0x734b,0x15d));var _0xb734=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x734b[_0x51020b];return _0x371e47;};'use strict';var moment=require(_0xb734('0x0'));var Sequelize=require('sequelize');module[_0xb734('0x1')]={'uniqueid':{'type':Sequelize[_0xb734('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xb734('0x2')]},'joinAt':{'type':Sequelize[_0xb734('0x3')]},'leaveAt':{'type':Sequelize[_0xb734('0x3')]},'acceptAt':{'type':Sequelize[_0xb734('0x3')]},'exitAt':{'type':Sequelize[_0xb734('0x3')]},'reason':{'type':Sequelize[_0xb734('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 27d9b62..5b70fe0 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 _0xc576=['update','then','error','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','catch','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','ejs','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save'];(function(_0xc0a973,_0x17159c){var _0x236640=function(_0x250911){while(--_0x250911){_0xc0a973['push'](_0xc0a973['shift']());}};_0x236640(++_0x17159c);}(_0xc576,0x1ea));var _0x6c57=function(_0x4c7149,_0x335342){_0x4c7149=_0x4c7149-0x0;var _0x200122=_0xc576[_0x4c7149];return _0x200122;};'use strict';var emlformat=require(_0x6c57('0x0'));var rimraf=require(_0x6c57('0x1'));var zipdir=require(_0x6c57('0x2'));var jsonpatch=require(_0x6c57('0x3'));var rp=require(_0x6c57('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6c57('0x5'));var util=require('util');var path=require(_0x6c57('0x6'));var sox=require(_0x6c57('0x7'));var csv=require('to-csv');var ejs=require(_0x6c57('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6c57('0x9'));var squel=require(_0x6c57('0xa'));var crypto=require('crypto');var jsforce=require(_0x6c57('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6c57('0xc'));var querystring=require(_0x6c57('0xd'));var Papa=require('papaparse');var Redis=require(_0x6c57('0xe'));var authService=require(_0x6c57('0xf'));var qs=require(_0x6c57('0x10'));var as=require(_0x6c57('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6c57('0x12'))(_0x6c57('0x13'));var utils=require(_0x6c57('0x14'));var config=require(_0x6c57('0x15'));var licenseUtil=require(_0x6c57('0x16'));var db=require(_0x6c57('0x17'))['db'];function respondWithStatusCode(_0x50954b,_0xda7363){_0xda7363=_0xda7363||0xcc;return function(_0x117690){if(_0x117690){return _0x50954b[_0x6c57('0x18')](_0xda7363);}return _0x50954b[_0x6c57('0x19')](_0xda7363)[_0x6c57('0x1a')]();};}function respondWithResult(_0x5a8e23,_0x4b6b40){_0x4b6b40=_0x4b6b40||0xc8;return function(_0x21426a){if(_0x21426a){return _0x5a8e23[_0x6c57('0x19')](_0x4b6b40)[_0x6c57('0x1b')](_0x21426a);}};}function respondWithFilteredResult(_0x2f2fa8,_0x11c208){return function(_0x181c16){if(_0x181c16){var _0x2f0e59=typeof _0x11c208[_0x6c57('0x1c')]===_0x6c57('0x1d')&&typeof _0x11c208[_0x6c57('0x1e')]===_0x6c57('0x1d');var _0x119a62=_0x181c16[_0x6c57('0x1f')];var _0x48aabf=_0x2f0e59?0x0:_0x11c208[_0x6c57('0x1c')];var _0x5da2ef=_0x2f0e59?_0x181c16[_0x6c57('0x1f')]:_0x11c208[_0x6c57('0x1c')]+_0x11c208[_0x6c57('0x1e')];var _0x5d2a56;if(_0x5da2ef>=_0x119a62){_0x5da2ef=_0x119a62;_0x5d2a56=0xc8;}else{_0x5d2a56=0xce;}_0x2f2fa8['status'](_0x5d2a56);return _0x2f2fa8[_0x6c57('0x20')]('Content-Range',_0x48aabf+'-'+_0x5da2ef+'/'+_0x119a62)[_0x6c57('0x1b')](_0x181c16);}return null;};}function patchUpdates(_0x38cd27){return function(_0x417798){try{jsonpatch[_0x6c57('0x21')](_0x417798,_0x38cd27,!![]);}catch(_0x28ab79){return BPromise['reject'](_0x28ab79);}return _0x417798[_0x6c57('0x22')]();};}function saveUpdates(_0xd25f0e,_0x9bafb6){return function(_0x5b4ea9){if(_0x5b4ea9){return _0x5b4ea9[_0x6c57('0x23')](_0xd25f0e)[_0x6c57('0x24')](function(_0x45b685){return _0x45b685;});}return null;};}function removeEntity(_0xe5e648,_0x4b02c9){return function(_0x3b03e8){if(_0x3b03e8){return _0x3b03e8['destroy']()[_0x6c57('0x24')](function(){_0xe5e648['status'](0xcc)[_0x6c57('0x1a')]();});}};}function handleEntityNotFound(_0x5e829a,_0x2395c3){return function(_0x139f7f){if(!_0x139f7f){_0x5e829a[_0x6c57('0x18')](0x194);}return _0x139f7f;};}function handleError(_0x3de9d0,_0x132d0a){_0x132d0a=_0x132d0a||0x1f4;return function(_0x8be1b1){logger[_0x6c57('0x25')](_0x8be1b1[_0x6c57('0x26')]);if(_0x8be1b1[_0x6c57('0x27')]){delete _0x8be1b1[_0x6c57('0x27')];}_0x3de9d0[_0x6c57('0x19')](_0x132d0a)[_0x6c57('0x28')](_0x8be1b1);};}exports[_0x6c57('0x29')]=function(_0x5109fe,_0x3dfe9c){var _0x326aab={},_0x5a0d8f={},_0x3602a8={'count':0x0,'rows':[]};var _0x116a66=_[_0x6c57('0x2a')](db[_0x6c57('0x2b')][_0x6c57('0x2c')],function(_0x52a6dc){return{'name':_0x52a6dc[_0x6c57('0x2d')],'type':_0x52a6dc[_0x6c57('0x2e')][_0x6c57('0x2f')]};});_0x5a0d8f[_0x6c57('0x30')]=_[_0x6c57('0x2a')](_0x116a66,_0x6c57('0x27'));_0x5a0d8f['query']=_['keys'](_0x5109fe[_0x6c57('0x31')]);_0x5a0d8f[_0x6c57('0x32')]=_[_0x6c57('0x33')](_0x5a0d8f['model'],_0x5a0d8f['query']);_0x326aab['attributes']=_[_0x6c57('0x33')](_0x5a0d8f['model'],qs[_0x6c57('0x34')](_0x5109fe[_0x6c57('0x31')]['fields']));_0x326aab[_0x6c57('0x35')]=_0x326aab[_0x6c57('0x35')][_0x6c57('0x36')]?_0x326aab[_0x6c57('0x35')]:_0x5a0d8f['model'];if(!_0x5109fe[_0x6c57('0x31')][_0x6c57('0x37')]('nolimit')){_0x326aab[_0x6c57('0x1e')]=qs[_0x6c57('0x1e')](_0x5109fe[_0x6c57('0x31')]['limit']);_0x326aab[_0x6c57('0x1c')]=qs[_0x6c57('0x1c')](_0x5109fe[_0x6c57('0x31')][_0x6c57('0x1c')]);}_0x326aab[_0x6c57('0x38')]=qs[_0x6c57('0x39')](_0x5109fe[_0x6c57('0x31')][_0x6c57('0x39')]);_0x326aab[_0x6c57('0x3a')]=qs[_0x6c57('0x32')](_['pick'](_0x5109fe[_0x6c57('0x31')],_0x5a0d8f['filters']),_0x116a66);if(_0x5109fe[_0x6c57('0x31')][_0x6c57('0x3b')]){_0x326aab['where']=_[_0x6c57('0x3c')](_0x326aab[_0x6c57('0x3a')],{'$or':_[_0x6c57('0x2a')](_0x116a66,function(_0x4fee13){if(_0x4fee13['type']!==_0x6c57('0x3d')){var _0x143557={};_0x143557[_0x4fee13[_0x6c57('0x27')]]={'$like':'%'+_0x5109fe[_0x6c57('0x31')]['filter']+'%'};return _0x143557;}})});}_0x326aab=_['merge']({},_0x326aab,_0x5109fe[_0x6c57('0x3e')]);var _0x532922={'where':_0x326aab[_0x6c57('0x3a')]};return db[_0x6c57('0x2b')][_0x6c57('0x1f')](_0x532922)[_0x6c57('0x24')](function(_0x5cdf3d){_0x3602a8['count']=_0x5cdf3d;if(_0x5109fe[_0x6c57('0x31')][_0x6c57('0x3f')]){_0x326aab[_0x6c57('0x40')]=[{'all':!![]}];}return db[_0x6c57('0x2b')][_0x6c57('0x41')](_0x326aab);})[_0x6c57('0x24')](function(_0x12adc2){_0x3602a8[_0x6c57('0x42')]=_0x12adc2;return _0x3602a8;})[_0x6c57('0x24')](respondWithFilteredResult(_0x3dfe9c,_0x326aab))['catch'](handleError(_0x3dfe9c,null));};exports[_0x6c57('0x43')]=function(_0x2e588d,_0x57884f){var _0x4a413d={'raw':!![],'where':{'id':_0x2e588d['params']['id']}},_0x3c7a1e={};_0x3c7a1e[_0x6c57('0x30')]=_[_0x6c57('0x44')](db[_0x6c57('0x2b')][_0x6c57('0x2c')]);_0x3c7a1e[_0x6c57('0x31')]=_['keys'](_0x2e588d['query']);_0x3c7a1e['filters']=_[_0x6c57('0x33')](_0x3c7a1e[_0x6c57('0x30')],_0x3c7a1e[_0x6c57('0x31')]);_0x4a413d[_0x6c57('0x35')]=_[_0x6c57('0x33')](_0x3c7a1e[_0x6c57('0x30')],qs[_0x6c57('0x34')](_0x2e588d[_0x6c57('0x31')][_0x6c57('0x34')]));_0x4a413d[_0x6c57('0x35')]=_0x4a413d[_0x6c57('0x35')][_0x6c57('0x36')]?_0x4a413d[_0x6c57('0x35')]:_0x3c7a1e[_0x6c57('0x30')];if(_0x2e588d[_0x6c57('0x31')]['includeAll']){_0x4a413d[_0x6c57('0x40')]=[{'all':!![]}];}_0x4a413d=_[_0x6c57('0x3c')]({},_0x4a413d,_0x2e588d['options']);return db['FaxQueueReport']['find'](_0x4a413d)['then'](handleEntityNotFound(_0x57884f,null))[_0x6c57('0x24')](respondWithResult(_0x57884f,null))[_0x6c57('0x45')](handleError(_0x57884f,null));};exports[_0x6c57('0x46')]=function(_0x4c6817,_0x134425){return db[_0x6c57('0x2b')][_0x6c57('0x46')](_0x4c6817[_0x6c57('0x47')],{})['then'](respondWithResult(_0x134425,0xc9))[_0x6c57('0x45')](handleError(_0x134425,null));};exports[_0x6c57('0x23')]=function(_0x5b91d7,_0x5a6724){if(_0x5b91d7[_0x6c57('0x47')]['id']){delete _0x5b91d7['body']['id'];}return db[_0x6c57('0x2b')][_0x6c57('0x48')]({'where':{'id':_0x5b91d7[_0x6c57('0x49')]['id']}})[_0x6c57('0x24')](handleEntityNotFound(_0x5a6724,null))['then'](saveUpdates(_0x5b91d7['body'],null))[_0x6c57('0x24')](respondWithResult(_0x5a6724,null))[_0x6c57('0x45')](handleError(_0x5a6724,null));};exports['destroy']=function(_0x56e3a9,_0x311dcf){return db[_0x6c57('0x2b')]['find']({'where':{'id':_0x56e3a9[_0x6c57('0x49')]['id']}})[_0x6c57('0x24')](handleEntityNotFound(_0x311dcf,null))[_0x6c57('0x24')](removeEntity(_0x311dcf,null))['catch'](handleError(_0x311dcf,null));};exports[_0x6c57('0x4a')]=function(_0x352b83,_0x5c0cb8){return db[_0x6c57('0x2b')][_0x6c57('0x4a')]()[_0x6c57('0x24')](respondWithResult(_0x5c0cb8,null))[_0x6c57('0x45')](handleError(_0x5c0cb8,null));}; \ No newline at end of file +var _0x53d5=['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','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','apply','reject','save','then','destroy','error','name','index','FaxQueueReport','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util'];(function(_0x2e3210,_0x555b54){var _0x399fad=function(_0x104a6d){while(--_0x104a6d){_0x2e3210['push'](_0x2e3210['shift']());}};_0x399fad(++_0x555b54);}(_0x53d5,0x1cc));var _0x553d=function(_0xf1e6f9,_0x527826){_0xf1e6f9=_0xf1e6f9-0x0;var _0x30556c=_0x53d5[_0xf1e6f9];return _0x30556c;};'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'];function respondWithStatusCode(_0x1a54ea,_0x41f6c1){_0x41f6c1=_0x41f6c1||0xcc;return function(_0x4285c0){if(_0x4285c0){return _0x1a54ea[_0x553d('0x1b')](_0x41f6c1);}return _0x1a54ea[_0x553d('0x1c')](_0x41f6c1)[_0x553d('0x1d')]();};}function respondWithResult(_0x32b169,_0x3cb13c){_0x3cb13c=_0x3cb13c||0xc8;return function(_0xd11e74){if(_0xd11e74){return _0x32b169['status'](_0x3cb13c)[_0x553d('0x1e')](_0xd11e74);}};}function respondWithFilteredResult(_0x5caa96,_0x1d4f35){return function(_0x2de0c1){if(_0x2de0c1){var _0x12b505=typeof _0x1d4f35['offset']==='undefined'&&typeof _0x1d4f35[_0x553d('0x1f')]===_0x553d('0x20');var _0x2857c5=_0x2de0c1['count'];var _0x2ab468=_0x12b505?0x0:_0x1d4f35[_0x553d('0x21')];var _0x343ce5=_0x12b505?_0x2de0c1[_0x553d('0x22')]:_0x1d4f35[_0x553d('0x21')]+_0x1d4f35[_0x553d('0x1f')];var _0x719651;if(_0x343ce5>=_0x2857c5){_0x343ce5=_0x2857c5;_0x719651=0xc8;}else{_0x719651=0xce;}_0x5caa96[_0x553d('0x1c')](_0x719651);return _0x5caa96[_0x553d('0x23')](_0x553d('0x24'),_0x2ab468+'-'+_0x343ce5+'/'+_0x2857c5)[_0x553d('0x1e')](_0x2de0c1);}return null;};}function patchUpdates(_0x4950e7){return function(_0x11bc86){try{jsonpatch[_0x553d('0x25')](_0x11bc86,_0x4950e7,!![]);}catch(_0x4c5f0f){return BPromise[_0x553d('0x26')](_0x4c5f0f);}return _0x11bc86[_0x553d('0x27')]();};}function saveUpdates(_0x4d00e3,_0x5bbd2d){return function(_0x4a6e0e){if(_0x4a6e0e){return _0x4a6e0e['update'](_0x4d00e3)[_0x553d('0x28')](function(_0x53b217){return _0x53b217;});}return null;};}function removeEntity(_0x82dd3a,_0xacc984){return function(_0x2e4f1b){if(_0x2e4f1b){return _0x2e4f1b[_0x553d('0x29')]()[_0x553d('0x28')](function(){_0x82dd3a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2caed9,_0x491dc2){return function(_0x576c56){if(!_0x576c56){_0x2caed9[_0x553d('0x1b')](0x194);}return _0x576c56;};}function handleError(_0x517a1c,_0x677832){_0x677832=_0x677832||0x1f4;return function(_0x2c0484){logger[_0x553d('0x2a')](_0x2c0484['stack']);if(_0x2c0484[_0x553d('0x2b')]){delete _0x2c0484[_0x553d('0x2b')];}_0x517a1c[_0x553d('0x1c')](_0x677832)['send'](_0x2c0484);};}exports[_0x553d('0x2c')]=function(_0x39943d,_0x2bf05d){var _0x50fbc3={},_0x37ddd7={},_0x180a66={'count':0x0,'rows':[]};var _0xc3d157=_['map'](db[_0x553d('0x2d')]['rawAttributes'],function(_0x174fea){return{'name':_0x174fea[_0x553d('0x2e')],'type':_0x174fea[_0x553d('0x2f')][_0x553d('0x30')]};});_0x37ddd7[_0x553d('0x31')]=_[_0x553d('0x32')](_0xc3d157,_0x553d('0x2b'));_0x37ddd7[_0x553d('0x33')]=_['keys'](_0x39943d[_0x553d('0x33')]);_0x37ddd7[_0x553d('0x34')]=_[_0x553d('0x35')](_0x37ddd7[_0x553d('0x31')],_0x37ddd7[_0x553d('0x33')]);_0x50fbc3[_0x553d('0x36')]=_[_0x553d('0x35')](_0x37ddd7[_0x553d('0x31')],qs['fields'](_0x39943d[_0x553d('0x33')][_0x553d('0x37')]));_0x50fbc3[_0x553d('0x36')]=_0x50fbc3['attributes'][_0x553d('0x38')]?_0x50fbc3[_0x553d('0x36')]:_0x37ddd7[_0x553d('0x31')];if(!_0x39943d[_0x553d('0x33')][_0x553d('0x39')](_0x553d('0x3a'))){_0x50fbc3[_0x553d('0x1f')]=qs[_0x553d('0x1f')](_0x39943d['query']['limit']);_0x50fbc3[_0x553d('0x21')]=qs[_0x553d('0x21')](_0x39943d['query'][_0x553d('0x21')]);}_0x50fbc3['order']=qs['sort'](_0x39943d[_0x553d('0x33')]['sort']);_0x50fbc3[_0x553d('0x3b')]=qs['filters'](_[_0x553d('0x3c')](_0x39943d[_0x553d('0x33')],_0x37ddd7['filters']),_0xc3d157);if(_0x39943d['query'][_0x553d('0x3d')]){_0x50fbc3[_0x553d('0x3b')]=_[_0x553d('0x3e')](_0x50fbc3[_0x553d('0x3b')],{'$or':_['map'](_0xc3d157,function(_0x19ed0e){if(_0x19ed0e[_0x553d('0x2f')]!=='VIRTUAL'){var _0xfac8ee={};_0xfac8ee[_0x19ed0e['name']]={'$like':'%'+_0x39943d[_0x553d('0x33')][_0x553d('0x3d')]+'%'};return _0xfac8ee;}})});}_0x50fbc3=_[_0x553d('0x3e')]({},_0x50fbc3,_0x39943d[_0x553d('0x3f')]);var _0x50776a={'where':_0x50fbc3['where']};return db[_0x553d('0x2d')][_0x553d('0x22')](_0x50776a)[_0x553d('0x28')](function(_0x32dfb8){_0x180a66[_0x553d('0x22')]=_0x32dfb8;if(_0x39943d[_0x553d('0x33')][_0x553d('0x40')]){_0x50fbc3[_0x553d('0x41')]=[{'all':!![]}];}return db[_0x553d('0x2d')][_0x553d('0x42')](_0x50fbc3);})['then'](function(_0x431fdb){_0x180a66[_0x553d('0x43')]=_0x431fdb;return _0x180a66;})['then'](respondWithFilteredResult(_0x2bf05d,_0x50fbc3))[_0x553d('0x44')](handleError(_0x2bf05d,null));};exports[_0x553d('0x45')]=function(_0x5cfbbc,_0x1caab8){var _0x60cdd3={'raw':!![],'where':{'id':_0x5cfbbc[_0x553d('0x46')]['id']}},_0x40bc7a={};_0x40bc7a[_0x553d('0x31')]=_[_0x553d('0x47')](db['FaxQueueReport'][_0x553d('0x48')]);_0x40bc7a[_0x553d('0x33')]=_[_0x553d('0x47')](_0x5cfbbc['query']);_0x40bc7a[_0x553d('0x34')]=_[_0x553d('0x35')](_0x40bc7a['model'],_0x40bc7a[_0x553d('0x33')]);_0x60cdd3[_0x553d('0x36')]=_[_0x553d('0x35')](_0x40bc7a[_0x553d('0x31')],qs[_0x553d('0x37')](_0x5cfbbc[_0x553d('0x33')][_0x553d('0x37')]));_0x60cdd3[_0x553d('0x36')]=_0x60cdd3[_0x553d('0x36')]['length']?_0x60cdd3[_0x553d('0x36')]:_0x40bc7a['model'];if(_0x5cfbbc[_0x553d('0x33')]['includeAll']){_0x60cdd3[_0x553d('0x41')]=[{'all':!![]}];}_0x60cdd3=_[_0x553d('0x3e')]({},_0x60cdd3,_0x5cfbbc['options']);return db[_0x553d('0x2d')][_0x553d('0x49')](_0x60cdd3)[_0x553d('0x28')](handleEntityNotFound(_0x1caab8,null))[_0x553d('0x28')](respondWithResult(_0x1caab8,null))[_0x553d('0x44')](handleError(_0x1caab8,null));};exports['create']=function(_0x28a20b,_0x545dbf){return db[_0x553d('0x2d')][_0x553d('0x4a')](_0x28a20b[_0x553d('0x4b')],{})[_0x553d('0x28')](respondWithResult(_0x545dbf,0xc9))[_0x553d('0x44')](handleError(_0x545dbf,null));};exports[_0x553d('0x4c')]=function(_0xb6b182,_0x29259a){if(_0xb6b182[_0x553d('0x4b')]['id']){delete _0xb6b182[_0x553d('0x4b')]['id'];}return db[_0x553d('0x2d')][_0x553d('0x49')]({'where':{'id':_0xb6b182[_0x553d('0x46')]['id']}})[_0x553d('0x28')](handleEntityNotFound(_0x29259a,null))[_0x553d('0x28')](saveUpdates(_0xb6b182[_0x553d('0x4b')],null))[_0x553d('0x28')](respondWithResult(_0x29259a,null))['catch'](handleError(_0x29259a,null));};exports[_0x553d('0x29')]=function(_0x1ed718,_0x2e1ff6){return db[_0x553d('0x2d')]['find']({'where':{'id':_0x1ed718['params']['id']}})[_0x553d('0x28')](handleEntityNotFound(_0x2e1ff6,null))[_0x553d('0x28')](removeEntity(_0x2e1ff6,null))[_0x553d('0x44')](handleError(_0x2e1ff6,null));};exports[_0x553d('0x4d')]=function(_0x2f1746,_0x3576f0){return db[_0x553d('0x2d')][_0x553d('0x4d')]()[_0x553d('0x28')](respondWithResult(_0x3576f0,null))['catch'](handleError(_0x3576f0,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index a8116e2..23c811e 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(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x814b,0x1a2));var _0xb814=function(_0x460666,_0x24bfa0){_0x460666=_0x460666-0x0;var _0x555cbf=_0x814b[_0x460666];return _0x555cbf;};'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 _0x7fbe=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','../../config/logger','api'];(function(_0x220e1b,_0x1e0406){var _0x49e317=function(_0x38ccf3){while(--_0x38ccf3){_0x220e1b['push'](_0x220e1b['shift']());}};_0x49e317(++_0x1e0406);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x3b7db2,_0x5edd58){_0x3b7db2=_0x3b7db2-0x0;var _0x3a819e=_0x7fbe[_0x3b7db2];return _0x3a819e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xe7fb('0xc'),'fields':[_0xe7fb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 4d048d5..c80c302 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 _0xa860=['client','http','request','then','FaxQueueReport,\x20%s,\x20%s','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','debug','update','where','limit','UpdateFaxQueueReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x24db24,_0x1ff6a0){var _0x1c2c6b=function(_0x1014b0){while(--_0x1014b0){_0x24db24['push'](_0x24db24['shift']());}};_0x1c2c6b(++_0x1ff6a0);}(_0xa860,0x181));var _0x0a86=function(_0x530327,_0x2d4488){_0x530327=_0x530327-0x0;var _0x443c99=_0xa860[_0x530327];return _0x443c99;};'use strict';var _=require(_0x0a86('0x0'));var util=require(_0x0a86('0x1'));var moment=require(_0x0a86('0x2'));var BPromise=require(_0x0a86('0x3'));var rs=require(_0x0a86('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0a86('0x5'))['db'];var utils=require(_0x0a86('0x6'));var logger=require(_0x0a86('0x7'))(_0x0a86('0x8'));var config=require(_0x0a86('0x9'));var jayson=require(_0x0a86('0xa'));var client=jayson[_0x0a86('0xb')][_0x0a86('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xfe9e83,_0x9fe752,_0x37b45e){return new BPromise(function(_0x5e5739,_0x50f955){return client[_0x0a86('0xd')](_0xfe9e83,_0x37b45e)[_0x0a86('0xe')](function(_0x462835){logger['info'](_0x0a86('0xf'),_0x9fe752,'request\x20sent');logger['debug'](_0x0a86('0x10'),_0x9fe752,_0x0a86('0x11'),JSON[_0x0a86('0x12')](_0x462835));if(_0x462835[_0x0a86('0x13')]){if(_0x462835['error'][_0x0a86('0x14')]===0x1f4){logger[_0x0a86('0x13')](_0x0a86('0xf'),_0x9fe752,_0x462835[_0x0a86('0x13')][_0x0a86('0x15')]);return _0x50f955(_0x462835[_0x0a86('0x13')][_0x0a86('0x15')]);}logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x9fe752,_0x462835[_0x0a86('0x13')][_0x0a86('0x15')]);return _0x5e5739(_0x462835[_0x0a86('0x13')][_0x0a86('0x15')]);}else{logger[_0x0a86('0x16')](_0x0a86('0xf'),_0x9fe752,'request\x20sent');_0x5e5739(_0x462835[_0x0a86('0x17')][_0x0a86('0x15')]);}})[_0x0a86('0x18')](function(_0x5a0e59){logger[_0x0a86('0x13')](_0x0a86('0xf'),_0x9fe752,_0x5a0e59);_0x50f955(_0x5a0e59);});});}exports[_0x0a86('0x19')]=function(_0x357350){var _0x5be3ac=this;return new Promise(function(_0x2c02ad,_0x4c27e3){return db[_0x0a86('0x1a')][_0x0a86('0x1b')](_0x357350[_0x0a86('0x1c')],{'raw':_0x357350[_0x0a86('0x1d')]?_0x357350[_0x0a86('0x1d')][_0x0a86('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x12cb38){logger[_0x0a86('0x16')]('CreateFaxQueueReport',_0x357350);logger[_0x0a86('0x1f')](_0x0a86('0x19'),_0x357350,JSON[_0x0a86('0x12')](_0x12cb38));_0x2c02ad(_0x12cb38);})[_0x0a86('0x18')](function(_0x2e0463){logger['error']('CreateFaxQueueReport',_0x2e0463[_0x0a86('0x15')],_0x357350);_0x4c27e3(_0x5be3ac[_0x0a86('0x13')](0x1f4,_0x2e0463[_0x0a86('0x15')]));});});};exports['UpdateFaxQueueReport']=function(_0x16a8cb){var _0x2ee77a=this;return new Promise(function(_0x4386f1,_0x46095c){return db[_0x0a86('0x1a')][_0x0a86('0x20')](_0x16a8cb[_0x0a86('0x1c')],{'raw':_0x16a8cb[_0x0a86('0x1d')]?_0x16a8cb['options'][_0x0a86('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16a8cb[_0x0a86('0x1d')]?_0x16a8cb[_0x0a86('0x1d')][_0x0a86('0x21')]||null:null,'attributes':_0x16a8cb[_0x0a86('0x1d')]?_0x16a8cb['options']['attributes']||null:null,'limit':_0x16a8cb[_0x0a86('0x1d')]?_0x16a8cb[_0x0a86('0x1d')][_0x0a86('0x22')]||null:null})['then'](function(_0x4c587d){logger['info'](_0x0a86('0x23'),_0x16a8cb);logger['debug'](_0x0a86('0x23'),_0x16a8cb,JSON['stringify'](_0x4c587d));_0x4386f1(_0x4c587d);})[_0x0a86('0x18')](function(_0x1a50f7){logger['error']('UpdateFaxQueueReport',_0x1a50f7[_0x0a86('0x15')],_0x16a8cb);_0x46095c(_0x2ee77a[_0x0a86('0x13')](0x1f4,_0x1a50f7[_0x0a86('0x15')]));});});}; \ No newline at end of file +var _0xc19e=['request','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','CreateFaxQueueReport','create','body','options','raw','info','stringify','UpdateFaxQueueReport','FaxQueueReport','update','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client'];(function(_0x4e9274,_0x49576e){var _0x8b474c=function(_0x204cca){while(--_0x204cca){_0x4e9274['push'](_0x4e9274['shift']());}};_0x8b474c(++_0x49576e);}(_0xc19e,0x176));var _0xec19=function(_0x4c36ea,_0x204536){_0x4c36ea=_0x4c36ea-0x0;var _0x4292e8=_0xc19e[_0x4c36ea];return _0x4292e8;};'use strict';var _=require(_0xec19('0x0'));var util=require(_0xec19('0x1'));var moment=require(_0xec19('0x2'));var BPromise=require(_0xec19('0x3'));var rs=require(_0xec19('0x4'));var fs=require('fs');var Redis=require(_0xec19('0x5'));var db=require(_0xec19('0x6'))['db'];var utils=require(_0xec19('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xec19('0x8'));var client=jayson[_0xec19('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x50c771,_0x415c6a,_0x1e3004){return new BPromise(function(_0x31a477,_0x2389b7){return client[_0xec19('0xa')](_0x50c771,_0x1e3004)[_0xec19('0xb')](function(_0x36a8f3){logger['info'](_0xec19('0xc'),_0x415c6a,_0xec19('0xd'));logger[_0xec19('0xe')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x415c6a,_0xec19('0xd'),JSON['stringify'](_0x36a8f3));if(_0x36a8f3[_0xec19('0xf')]){if(_0x36a8f3[_0xec19('0xf')][_0xec19('0x10')]===0x1f4){logger['error'](_0xec19('0xc'),_0x415c6a,_0x36a8f3[_0xec19('0xf')][_0xec19('0x11')]);return _0x2389b7(_0x36a8f3[_0xec19('0xf')]['message']);}logger[_0xec19('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x415c6a,_0x36a8f3[_0xec19('0xf')][_0xec19('0x11')]);return _0x31a477(_0x36a8f3['error']['message']);}else{logger['info'](_0xec19('0xc'),_0x415c6a,'request\x20sent');_0x31a477(_0x36a8f3[_0xec19('0x12')][_0xec19('0x11')]);}})[_0xec19('0x13')](function(_0x5e7ede){logger[_0xec19('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x415c6a,_0x5e7ede);_0x2389b7(_0x5e7ede);});});}exports[_0xec19('0x14')]=function(_0x1e0f54){var _0x356148=this;return new Promise(function(_0x32bb15,_0x43c55e){return db['FaxQueueReport'][_0xec19('0x15')](_0x1e0f54[_0xec19('0x16')],{'raw':_0x1e0f54[_0xec19('0x17')]?_0x1e0f54[_0xec19('0x17')][_0xec19('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x2e3228){logger[_0xec19('0x19')](_0xec19('0x14'),_0x1e0f54);logger[_0xec19('0xe')](_0xec19('0x14'),_0x1e0f54,JSON[_0xec19('0x1a')](_0x2e3228));_0x32bb15(_0x2e3228);})['catch'](function(_0x1af12){logger[_0xec19('0xf')](_0xec19('0x14'),_0x1af12[_0xec19('0x11')],_0x1e0f54);_0x43c55e(_0x356148[_0xec19('0xf')](0x1f4,_0x1af12[_0xec19('0x11')]));});});};exports[_0xec19('0x1b')]=function(_0x23cd63){var _0x3ec214=this;return new Promise(function(_0x267586,_0x70c7df){return db[_0xec19('0x1c')][_0xec19('0x1d')](_0x23cd63[_0xec19('0x16')],{'raw':_0x23cd63[_0xec19('0x17')]?_0x23cd63[_0xec19('0x17')][_0xec19('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23cd63[_0xec19('0x17')]?_0x23cd63[_0xec19('0x17')][_0xec19('0x1e')]||null:null,'attributes':_0x23cd63[_0xec19('0x17')]?_0x23cd63[_0xec19('0x17')]['attributes']||null:null,'limit':_0x23cd63[_0xec19('0x17')]?_0x23cd63[_0xec19('0x17')][_0xec19('0x1f')]||null:null})[_0xec19('0xb')](function(_0x141f92){logger[_0xec19('0x19')]('UpdateFaxQueueReport',_0x23cd63);logger[_0xec19('0xe')](_0xec19('0x1b'),_0x23cd63,JSON[_0xec19('0x1a')](_0x141f92));_0x267586(_0x141f92);})['catch'](function(_0x12aced){logger['error'](_0xec19('0x1b'),_0x12aced[_0xec19('0x11')],_0x23cd63);_0x70c7df(_0x3ec214['error'](0x1f4,_0x12aced[_0xec19('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index e09057c..b33de95 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 _0x25ae=['update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','create','put'];(function(_0x558634,_0x83a0ad){var _0x1ee58b=function(_0x3d29dd){while(--_0x3d29dd){_0x558634['push'](_0x558634['shift']());}};_0x1ee58b(++_0x83a0ad);}(_0x25ae,0x1b8));var _0xe25a=function(_0x115767,_0x3f0dc2){_0x115767=_0x115767-0x0;var _0x413d8f=_0x25ae[_0x115767];return _0x413d8f;};'use strict';var multer=require(_0xe25a('0x0'));var util=require(_0xe25a('0x1'));var path=require('path');var timeout=require(_0xe25a('0x2'));var express=require(_0xe25a('0x3'));var router=express[_0xe25a('0x4')]();var fs_extra=require(_0xe25a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe25a('0x6'));var config=require(_0xe25a('0x7'));var controller=require('./faxQueueReport.controller');router[_0xe25a('0x8')]('/',auth[_0xe25a('0x9')](),controller[_0xe25a('0xa')]);router[_0xe25a('0x8')](_0xe25a('0xb'),auth[_0xe25a('0x9')](),controller[_0xe25a('0xc')]);router['get'](_0xe25a('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xe25a('0x9')](),controller[_0xe25a('0xe')]);router[_0xe25a('0xf')](_0xe25a('0xd'),auth[_0xe25a('0x9')](),controller[_0xe25a('0x10')]);router[_0xe25a('0x11')](_0xe25a('0xd'),auth['isAuthenticated'](),controller[_0xe25a('0x12')]);module['exports']=router; \ No newline at end of file +var _0xdde4=['show','post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','index','get','/describe','isAuthenticated','describe'];(function(_0x125b75,_0x5ed208){var _0x383527=function(_0x583184){while(--_0x583184){_0x125b75['push'](_0x125b75['shift']());}};_0x383527(++_0x5ed208);}(_0xdde4,0xb8));var _0x4dde=function(_0x12eb23,_0x38e217){_0x12eb23=_0x12eb23-0x0;var _0xf369e8=_0xdde4[_0x12eb23];return _0xf369e8;};'use strict';var multer=require(_0x4dde('0x0'));var util=require(_0x4dde('0x1'));var path=require(_0x4dde('0x2'));var timeout=require(_0x4dde('0x3'));var express=require(_0x4dde('0x4'));var router=express[_0x4dde('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4dde('0x6'));var config=require(_0x4dde('0x7'));var controller=require(_0x4dde('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x4dde('0x9')]);router[_0x4dde('0xa')](_0x4dde('0xb'),auth[_0x4dde('0xc')](),controller[_0x4dde('0xd')]);router[_0x4dde('0xa')]('/:id',auth[_0x4dde('0xc')](),controller[_0x4dde('0xe')]);router[_0x4dde('0xf')]('/',auth[_0x4dde('0xc')](),controller[_0x4dde('0x10')]);router[_0x4dde('0x11')](_0x4dde('0x12'),auth[_0x4dde('0xc')](),controller[_0x4dde('0x13')]);router[_0x4dde('0x14')](_0x4dde('0x12'),auth[_0x4dde('0xc')](),controller['destroy']);module[_0x4dde('0x15')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 4bd2fa7..729df8e 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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x2139a8,_0x2b74fc){var _0x1613f3=function(_0x19790d){while(--_0x19790d){_0x2139a8['push'](_0x2139a8['shift']());}};_0x1613f3(++_0x2b74fc);}(_0xf4eb,0xec));var _0xbf4e=function(_0xccf6a0,_0x4a6e3b){_0xccf6a0=_0xccf6a0-0x0;var _0x55b60a=_0xf4eb[_0xccf6a0];return _0x55b60a;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x1a5dcb,_0x7099c0){var _0x4b93dd=function(_0x399d9c){while(--_0x399d9c){_0x1a5dcb['push'](_0x1a5dcb['shift']());}};_0x4b93dd(++_0x7099c0);}(_0x00bb,0x1d8));var _0xb00b=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x00bb[_0x47b58b];return _0x46bebe;};'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 diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 1b6b64b..8f7be77 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 _0x23c9=['keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','FaxTransferReport','rows','catch','show','params','length','includeAll','include','find','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x23c9,0xef));var _0x923c=function(_0x274584,_0x501942){_0x274584=_0x274584-0x0;var _0x3a068=_0x23c9[_0x274584];return _0x3a068;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x923c('0x0'));var zipdir=require(_0x923c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x923c('0x2'));var moment=require(_0x923c('0x3'));var BPromise=require(_0x923c('0x4'));var Mustache=require(_0x923c('0x5'));var util=require(_0x923c('0x6'));var path=require(_0x923c('0x7'));var sox=require('sox');var csv=require(_0x923c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x923c('0x9'));var _=require(_0x923c('0xa'));var squel=require(_0x923c('0xb'));var crypto=require(_0x923c('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x923c('0xd'));var Papa=require(_0x923c('0xe'));var Redis=require(_0x923c('0xf'));var authService=require(_0x923c('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x923c('0x11'));var logger=require(_0x923c('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x923c('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x923c('0x14'))['db'];function respondWithStatusCode(_0x70a937,_0x3ed96e){_0x3ed96e=_0x3ed96e||0xcc;return function(_0x43c37f){if(_0x43c37f){return _0x70a937['sendStatus'](_0x3ed96e);}return _0x70a937[_0x923c('0x15')](_0x3ed96e)[_0x923c('0x16')]();};}function respondWithResult(_0x219f61,_0x2a7ffc){_0x2a7ffc=_0x2a7ffc||0xc8;return function(_0x342589){if(_0x342589){return _0x219f61[_0x923c('0x15')](_0x2a7ffc)[_0x923c('0x17')](_0x342589);}};}function respondWithFilteredResult(_0x5f38e3,_0x171f01){return function(_0x2b37a5){if(_0x2b37a5){var _0x55aef9=typeof _0x171f01[_0x923c('0x18')]==='undefined'&&typeof _0x171f01['limit']===_0x923c('0x19');var _0x266840=_0x2b37a5['count'];var _0x3cdd3b=_0x55aef9?0x0:_0x171f01['offset'];var _0xfc26c7=_0x55aef9?_0x2b37a5[_0x923c('0x1a')]:_0x171f01[_0x923c('0x18')]+_0x171f01[_0x923c('0x1b')];var _0x59362d;if(_0xfc26c7>=_0x266840){_0xfc26c7=_0x266840;_0x59362d=0xc8;}else{_0x59362d=0xce;}_0x5f38e3['status'](_0x59362d);return _0x5f38e3[_0x923c('0x1c')](_0x923c('0x1d'),_0x3cdd3b+'-'+_0xfc26c7+'/'+_0x266840)[_0x923c('0x17')](_0x2b37a5);}return null;};}function patchUpdates(_0xe2f871){return function(_0x439cd2){try{jsonpatch[_0x923c('0x1e')](_0x439cd2,_0xe2f871,!![]);}catch(_0x4d2da8){return BPromise['reject'](_0x4d2da8);}return _0x439cd2['save']();};}function saveUpdates(_0x5d226c,_0x38ad22){return function(_0x4cfc00){if(_0x4cfc00){return _0x4cfc00[_0x923c('0x1f')](_0x5d226c)[_0x923c('0x20')](function(_0x1bfa09){return _0x1bfa09;});}return null;};}function removeEntity(_0x4c6ba4,_0x460cf5){return function(_0x2f57c9){if(_0x2f57c9){return _0x2f57c9[_0x923c('0x21')]()['then'](function(){_0x4c6ba4[_0x923c('0x15')](0xcc)[_0x923c('0x16')]();});}};}function handleEntityNotFound(_0x42c82b,_0x988bc8){return function(_0x26254c){if(!_0x26254c){_0x42c82b['sendStatus'](0x194);}return _0x26254c;};}function handleError(_0x6dd8a7,_0x1c72ac){_0x1c72ac=_0x1c72ac||0x1f4;return function(_0x3f578c){logger[_0x923c('0x22')](_0x3f578c['stack']);if(_0x3f578c[_0x923c('0x23')]){delete _0x3f578c[_0x923c('0x23')];}_0x6dd8a7['status'](_0x1c72ac)[_0x923c('0x24')](_0x3f578c);};}exports[_0x923c('0x25')]=function(_0x2fd71e,_0x350043){var _0xc87b9d={},_0x1bc22e={},_0x4f6642={'count':0x0,'rows':[]};var _0x1e0afe=_[_0x923c('0x26')](db['FaxTransferReport'][_0x923c('0x27')],function(_0x36cbe0){return{'name':_0x36cbe0[_0x923c('0x28')],'type':_0x36cbe0[_0x923c('0x29')][_0x923c('0x2a')]};});_0x1bc22e[_0x923c('0x2b')]=_[_0x923c('0x26')](_0x1e0afe,'name');_0x1bc22e[_0x923c('0x2c')]=_[_0x923c('0x2d')](_0x2fd71e['query']);_0x1bc22e['filters']=_[_0x923c('0x2e')](_0x1bc22e['model'],_0x1bc22e['query']);_0xc87b9d['attributes']=_[_0x923c('0x2e')](_0x1bc22e[_0x923c('0x2b')],qs['fields'](_0x2fd71e['query'][_0x923c('0x2f')]));_0xc87b9d[_0x923c('0x30')]=_0xc87b9d[_0x923c('0x30')]['length']?_0xc87b9d[_0x923c('0x30')]:_0x1bc22e['model'];if(!_0x2fd71e[_0x923c('0x2c')][_0x923c('0x31')](_0x923c('0x32'))){_0xc87b9d[_0x923c('0x1b')]=qs['limit'](_0x2fd71e['query']['limit']);_0xc87b9d['offset']=qs[_0x923c('0x18')](_0x2fd71e['query']['offset']);}_0xc87b9d[_0x923c('0x33')]=qs[_0x923c('0x34')](_0x2fd71e[_0x923c('0x2c')][_0x923c('0x34')]);_0xc87b9d[_0x923c('0x35')]=qs[_0x923c('0x36')](_[_0x923c('0x37')](_0x2fd71e[_0x923c('0x2c')],_0x1bc22e[_0x923c('0x36')]),_0x1e0afe);if(_0x2fd71e[_0x923c('0x2c')][_0x923c('0x38')]){_0xc87b9d[_0x923c('0x35')]=_[_0x923c('0x39')](_0xc87b9d[_0x923c('0x35')],{'$or':_[_0x923c('0x26')](_0x1e0afe,function(_0x8d1777){if(_0x8d1777[_0x923c('0x29')]!=='VIRTUAL'){var _0x2b609a={};_0x2b609a[_0x8d1777[_0x923c('0x23')]]={'$like':'%'+_0x2fd71e[_0x923c('0x2c')][_0x923c('0x38')]+'%'};return _0x2b609a;}})});}_0xc87b9d=_[_0x923c('0x39')]({},_0xc87b9d,_0x2fd71e[_0x923c('0x3a')]);var _0x114d2f={'where':_0xc87b9d[_0x923c('0x35')]};return db['FaxTransferReport'][_0x923c('0x1a')](_0x114d2f)[_0x923c('0x20')](function(_0x11159d){_0x4f6642[_0x923c('0x1a')]=_0x11159d;if(_0x2fd71e[_0x923c('0x2c')]['includeAll']){_0xc87b9d['include']=[{'all':!![]}];}return db[_0x923c('0x3b')]['findAll'](_0xc87b9d);})[_0x923c('0x20')](function(_0x5dae82){_0x4f6642[_0x923c('0x3c')]=_0x5dae82;return _0x4f6642;})[_0x923c('0x20')](respondWithFilteredResult(_0x350043,_0xc87b9d))[_0x923c('0x3d')](handleError(_0x350043,null));};exports[_0x923c('0x3e')]=function(_0x2ed7fb,_0x2526bf){var _0x462285={'raw':!![],'where':{'id':_0x2ed7fb[_0x923c('0x3f')]['id']}},_0x1e01c0={};_0x1e01c0['model']=_[_0x923c('0x2d')](db[_0x923c('0x3b')][_0x923c('0x27')]);_0x1e01c0[_0x923c('0x2c')]=_[_0x923c('0x2d')](_0x2ed7fb[_0x923c('0x2c')]);_0x1e01c0[_0x923c('0x36')]=_[_0x923c('0x2e')](_0x1e01c0['model'],_0x1e01c0[_0x923c('0x2c')]);_0x462285[_0x923c('0x30')]=_[_0x923c('0x2e')](_0x1e01c0[_0x923c('0x2b')],qs[_0x923c('0x2f')](_0x2ed7fb[_0x923c('0x2c')][_0x923c('0x2f')]));_0x462285['attributes']=_0x462285[_0x923c('0x30')][_0x923c('0x40')]?_0x462285[_0x923c('0x30')]:_0x1e01c0['model'];if(_0x2ed7fb[_0x923c('0x2c')][_0x923c('0x41')]){_0x462285[_0x923c('0x42')]=[{'all':!![]}];}_0x462285=_['merge']({},_0x462285,_0x2ed7fb[_0x923c('0x3a')]);return db['FaxTransferReport'][_0x923c('0x43')](_0x462285)[_0x923c('0x20')](handleEntityNotFound(_0x2526bf,null))[_0x923c('0x20')](respondWithResult(_0x2526bf,null))[_0x923c('0x3d')](handleError(_0x2526bf,null));};exports[_0x923c('0x44')]=function(_0x5009dd,_0x5d5723){return db['FaxTransferReport'][_0x923c('0x44')](_0x5009dd[_0x923c('0x45')],{})['then'](respondWithResult(_0x5d5723,0xc9))['catch'](handleError(_0x5d5723,null));};exports[_0x923c('0x1f')]=function(_0x55fe1a,_0x349c0d){if(_0x55fe1a[_0x923c('0x45')]['id']){delete _0x55fe1a[_0x923c('0x45')]['id'];}return db[_0x923c('0x3b')][_0x923c('0x43')]({'where':{'id':_0x55fe1a[_0x923c('0x3f')]['id']}})[_0x923c('0x20')](handleEntityNotFound(_0x349c0d,null))[_0x923c('0x20')](saveUpdates(_0x55fe1a[_0x923c('0x45')],null))[_0x923c('0x20')](respondWithResult(_0x349c0d,null))[_0x923c('0x3d')](handleError(_0x349c0d,null));};exports[_0x923c('0x21')]=function(_0x29c6ef,_0x2fa71d){return db[_0x923c('0x3b')][_0x923c('0x43')]({'where':{'id':_0x29c6ef['params']['id']}})[_0x923c('0x20')](handleEntityNotFound(_0x2fa71d,null))[_0x923c('0x20')](removeEntity(_0x2fa71d,null))[_0x923c('0x3d')](handleError(_0x2fa71d,null));};exports['describe']=function(_0x1e8c6a,_0x74a038){return db['FaxTransferReport'][_0x923c('0x46')]()[_0x923c('0x20')](respondWithResult(_0x74a038,null))[_0x923c('0x3d')](handleError(_0x74a038,null));}; \ No newline at end of file +var _0x9423=['params','keys','rawAttributes','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','status','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','fieldName','type','key','model','map','query','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','name','options','includeAll','include','FaxTransferReport','findAll','rows','catch','show'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x9423,0x95));var _0x3942=function(_0x5678b9,_0x33f01f){_0x5678b9=_0x5678b9-0x0;var _0x251bc8=_0x9423[_0x5678b9];return _0x251bc8;};'use strict';var emlformat=require(_0x3942('0x0'));var rimraf=require(_0x3942('0x1'));var zipdir=require(_0x3942('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3942('0x3'));var moment=require(_0x3942('0x4'));var BPromise=require(_0x3942('0x5'));var Mustache=require('mustache');var util=require(_0x3942('0x6'));var path=require(_0x3942('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3942('0x8'));var fs=require('fs');var fs_extra=require(_0x3942('0x9'));var _=require('lodash');var squel=require(_0x3942('0xa'));var crypto=require(_0x3942('0xb'));var jsforce=require(_0x3942('0xc'));var deskjs=require(_0x3942('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3942('0xe'));var Redis=require(_0x3942('0xf'));var authService=require(_0x3942('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3942('0x11'));var logger=require(_0x3942('0x12'))('api');var utils=require(_0x3942('0x13'));var config=require(_0x3942('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d64c0,_0x5ad4f0){_0x5ad4f0=_0x5ad4f0||0xcc;return function(_0x1808f3){if(_0x1808f3){return _0x1d64c0['sendStatus'](_0x5ad4f0);}return _0x1d64c0['status'](_0x5ad4f0)['end']();};}function respondWithResult(_0x1e8b78,_0x4a0b85){_0x4a0b85=_0x4a0b85||0xc8;return function(_0xa96d4f){if(_0xa96d4f){return _0x1e8b78[_0x3942('0x15')](_0x4a0b85)['json'](_0xa96d4f);}};}function respondWithFilteredResult(_0x3d322a,_0x24e6c2){return function(_0x450c73){if(_0x450c73){var _0x8cd022=typeof _0x24e6c2[_0x3942('0x16')]===_0x3942('0x17')&&typeof _0x24e6c2['limit']==='undefined';var _0x2a9414=_0x450c73[_0x3942('0x18')];var _0xcaede=_0x8cd022?0x0:_0x24e6c2[_0x3942('0x16')];var _0x5d3a44=_0x8cd022?_0x450c73[_0x3942('0x18')]:_0x24e6c2[_0x3942('0x16')]+_0x24e6c2['limit'];var _0x5b720e;if(_0x5d3a44>=_0x2a9414){_0x5d3a44=_0x2a9414;_0x5b720e=0xc8;}else{_0x5b720e=0xce;}_0x3d322a['status'](_0x5b720e);return _0x3d322a[_0x3942('0x19')](_0x3942('0x1a'),_0xcaede+'-'+_0x5d3a44+'/'+_0x2a9414)['json'](_0x450c73);}return null;};}function patchUpdates(_0x15ca39){return function(_0x3e96c2){try{jsonpatch[_0x3942('0x1b')](_0x3e96c2,_0x15ca39,!![]);}catch(_0x325bcd){return BPromise[_0x3942('0x1c')](_0x325bcd);}return _0x3e96c2[_0x3942('0x1d')]();};}function saveUpdates(_0x4667f1,_0x4bc92e){return function(_0x9f0e73){if(_0x9f0e73){return _0x9f0e73[_0x3942('0x1e')](_0x4667f1)[_0x3942('0x1f')](function(_0x5ea246){return _0x5ea246;});}return null;};}function removeEntity(_0x1ce605,_0x4052c1){return function(_0x24fe1f){if(_0x24fe1f){return _0x24fe1f[_0x3942('0x20')]()[_0x3942('0x1f')](function(){_0x1ce605[_0x3942('0x15')](0xcc)[_0x3942('0x21')]();});}};}function handleEntityNotFound(_0x5798f2,_0x5e1413){return function(_0x5d22d8){if(!_0x5d22d8){_0x5798f2['sendStatus'](0x194);}return _0x5d22d8;};}function handleError(_0x96e528,_0x471e0d){_0x471e0d=_0x471e0d||0x1f4;return function(_0x5301e6){logger['error'](_0x5301e6[_0x3942('0x22')]);if(_0x5301e6['name']){delete _0x5301e6['name'];}_0x96e528[_0x3942('0x15')](_0x471e0d)['send'](_0x5301e6);};}exports['index']=function(_0x44df3d,_0x2d5583){var _0x1b4c5b={},_0x3a494f={},_0x24e1c2={'count':0x0,'rows':[]};var _0x3d6c26=_['map'](db['FaxTransferReport']['rawAttributes'],function(_0x30377d){return{'name':_0x30377d[_0x3942('0x23')],'type':_0x30377d[_0x3942('0x24')][_0x3942('0x25')]};});_0x3a494f[_0x3942('0x26')]=_[_0x3942('0x27')](_0x3d6c26,'name');_0x3a494f[_0x3942('0x28')]=_['keys'](_0x44df3d['query']);_0x3a494f['filters']=_[_0x3942('0x29')](_0x3a494f[_0x3942('0x26')],_0x3a494f['query']);_0x1b4c5b[_0x3942('0x2a')]=_[_0x3942('0x29')](_0x3a494f['model'],qs[_0x3942('0x2b')](_0x44df3d[_0x3942('0x28')][_0x3942('0x2b')]));_0x1b4c5b[_0x3942('0x2a')]=_0x1b4c5b[_0x3942('0x2a')][_0x3942('0x2c')]?_0x1b4c5b[_0x3942('0x2a')]:_0x3a494f[_0x3942('0x26')];if(!_0x44df3d[_0x3942('0x28')]['hasOwnProperty'](_0x3942('0x2d'))){_0x1b4c5b[_0x3942('0x2e')]=qs[_0x3942('0x2e')](_0x44df3d[_0x3942('0x28')][_0x3942('0x2e')]);_0x1b4c5b[_0x3942('0x16')]=qs[_0x3942('0x16')](_0x44df3d[_0x3942('0x28')]['offset']);}_0x1b4c5b[_0x3942('0x2f')]=qs[_0x3942('0x30')](_0x44df3d[_0x3942('0x28')]['sort']);_0x1b4c5b[_0x3942('0x31')]=qs[_0x3942('0x32')](_[_0x3942('0x33')](_0x44df3d[_0x3942('0x28')],_0x3a494f[_0x3942('0x32')]),_0x3d6c26);if(_0x44df3d[_0x3942('0x28')][_0x3942('0x34')]){_0x1b4c5b[_0x3942('0x31')]=_[_0x3942('0x35')](_0x1b4c5b[_0x3942('0x31')],{'$or':_[_0x3942('0x27')](_0x3d6c26,function(_0x99dde5){if(_0x99dde5[_0x3942('0x24')]!==_0x3942('0x36')){var _0x5592a8={};_0x5592a8[_0x99dde5[_0x3942('0x37')]]={'$like':'%'+_0x44df3d[_0x3942('0x28')][_0x3942('0x34')]+'%'};return _0x5592a8;}})});}_0x1b4c5b=_['merge']({},_0x1b4c5b,_0x44df3d[_0x3942('0x38')]);var _0x398c29={'where':_0x1b4c5b[_0x3942('0x31')]};return db['FaxTransferReport'][_0x3942('0x18')](_0x398c29)[_0x3942('0x1f')](function(_0xaa4faa){_0x24e1c2['count']=_0xaa4faa;if(_0x44df3d['query'][_0x3942('0x39')]){_0x1b4c5b[_0x3942('0x3a')]=[{'all':!![]}];}return db[_0x3942('0x3b')][_0x3942('0x3c')](_0x1b4c5b);})[_0x3942('0x1f')](function(_0x45dfd2){_0x24e1c2[_0x3942('0x3d')]=_0x45dfd2;return _0x24e1c2;})[_0x3942('0x1f')](respondWithFilteredResult(_0x2d5583,_0x1b4c5b))[_0x3942('0x3e')](handleError(_0x2d5583,null));};exports[_0x3942('0x3f')]=function(_0x5ae1d7,_0x4fe555){var _0x37b164={'raw':!![],'where':{'id':_0x5ae1d7[_0x3942('0x40')]['id']}},_0x2ba7ec={};_0x2ba7ec['model']=_[_0x3942('0x41')](db[_0x3942('0x3b')][_0x3942('0x42')]);_0x2ba7ec[_0x3942('0x28')]=_[_0x3942('0x41')](_0x5ae1d7[_0x3942('0x28')]);_0x2ba7ec['filters']=_['intersection'](_0x2ba7ec[_0x3942('0x26')],_0x2ba7ec[_0x3942('0x28')]);_0x37b164[_0x3942('0x2a')]=_['intersection'](_0x2ba7ec['model'],qs[_0x3942('0x2b')](_0x5ae1d7['query'][_0x3942('0x2b')]));_0x37b164[_0x3942('0x2a')]=_0x37b164['attributes'][_0x3942('0x2c')]?_0x37b164[_0x3942('0x2a')]:_0x2ba7ec[_0x3942('0x26')];if(_0x5ae1d7[_0x3942('0x28')][_0x3942('0x39')]){_0x37b164['include']=[{'all':!![]}];}_0x37b164=_['merge']({},_0x37b164,_0x5ae1d7[_0x3942('0x38')]);return db['FaxTransferReport']['find'](_0x37b164)[_0x3942('0x1f')](handleEntityNotFound(_0x4fe555,null))['then'](respondWithResult(_0x4fe555,null))[_0x3942('0x3e')](handleError(_0x4fe555,null));};exports[_0x3942('0x43')]=function(_0x5dab55,_0x284f66){return db['FaxTransferReport']['create'](_0x5dab55['body'],{})[_0x3942('0x1f')](respondWithResult(_0x284f66,0xc9))[_0x3942('0x3e')](handleError(_0x284f66,null));};exports['update']=function(_0xee71d6,_0xc84cff){if(_0xee71d6[_0x3942('0x44')]['id']){delete _0xee71d6[_0x3942('0x44')]['id'];}return db[_0x3942('0x3b')][_0x3942('0x45')]({'where':{'id':_0xee71d6[_0x3942('0x40')]['id']}})[_0x3942('0x1f')](handleEntityNotFound(_0xc84cff,null))['then'](saveUpdates(_0xee71d6['body'],null))[_0x3942('0x1f')](respondWithResult(_0xc84cff,null))[_0x3942('0x3e')](handleError(_0xc84cff,null));};exports[_0x3942('0x20')]=function(_0x103f25,_0x28cf7d){return db[_0x3942('0x3b')][_0x3942('0x45')]({'where':{'id':_0x103f25[_0x3942('0x40')]['id']}})['then'](handleEntityNotFound(_0x28cf7d,null))[_0x3942('0x1f')](removeEntity(_0x28cf7d,null))[_0x3942('0x3e')](handleError(_0x28cf7d,null));};exports[_0x3942('0x46')]=function(_0x1d5367,_0x34e4d3){return db[_0x3942('0x3b')][_0x3942('0x46')]()[_0x3942('0x1f')](respondWithResult(_0x34e4d3,null))[_0x3942('0x3e')](handleError(_0x34e4d3,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 3ae8902..db3f8d6 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 _0x18ba=['uniqueid','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./faxTransferReport.attributes','exports'];(function(_0x18beac,_0x1c38b9){var _0x4405c2=function(_0x1f7a98){while(--_0x1f7a98){_0x18beac['push'](_0x18beac['shift']());}};_0x4405c2(++_0x1c38b9);}(_0x18ba,0x1a3));var _0xa18b=function(_0x43ce6d,_0xa8f11c){_0x43ce6d=_0x43ce6d-0x0;var _0x10a272=_0x18ba[_0x43ce6d];return _0x10a272;};'use strict';var _=require(_0xa18b('0x0'));var util=require(_0xa18b('0x1'));var logger=require('../../config/logger')(_0xa18b('0x2'));var moment=require(_0xa18b('0x3'));var BPromise=require(_0xa18b('0x4'));var rp=require(_0xa18b('0x5'));var fs=require('fs');var path=require(_0xa18b('0x6'));var rimraf=require('rimraf');var config=require(_0xa18b('0x7'));var attributes=require(_0xa18b('0x8'));module[_0xa18b('0x9')]=function(_0x4420ee,_0x125d1e){return _0x4420ee['define']('FaxTransferReport',attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0xa18b('0xa'),'fields':[_0xa18b('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeb83=['exports','define','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./faxTransferReport.attributes'];(function(_0x30ae64,_0x3407f7){var _0x613e2a=function(_0x22e926){while(--_0x22e926){_0x30ae64['push'](_0x30ae64['shift']());}};_0x613e2a(++_0x3407f7);}(_0xeb83,0xad));var _0x3eb8=function(_0x3f7eaa,_0x547479){_0x3f7eaa=_0x3f7eaa-0x0;var _0x39e86a=_0xeb83[_0x3f7eaa];return _0x39e86a;};'use strict';var _=require(_0x3eb8('0x0'));var util=require(_0x3eb8('0x1'));var logger=require(_0x3eb8('0x2'))(_0x3eb8('0x3'));var moment=require('moment');var BPromise=require(_0x3eb8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3eb8('0x5'));var rimraf=require(_0x3eb8('0x6'));var config=require(_0x3eb8('0x7'));var attributes=require(_0x3eb8('0x8'));module[_0x3eb8('0x9')]=function(_0x26bd1d,_0x3b4253){return _0x26bd1d[_0x3eb8('0xa')]('FaxTransferReport',attributes,{'tableName':_0x3eb8('0xb'),'paranoid':![],'indexes':[{'name':_0x3eb8('0xc'),'fields':[_0x3eb8('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index c327fcc..7aa33b3 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 _0x6fc2=['request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http'];(function(_0x458d35,_0x1c3bb7){var _0x51f331=function(_0x417c4e){while(--_0x417c4e){_0x458d35['push'](_0x458d35['shift']());}};_0x51f331(++_0x1c3bb7);}(_0x6fc2,0x198));var _0x26fc=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x6fc2[_0x24f31b];return _0x488401;};'use strict';var _=require(_0x26fc('0x0'));var util=require(_0x26fc('0x1'));var moment=require('moment');var BPromise=require(_0x26fc('0x2'));var rs=require(_0x26fc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x26fc('0x4'))['db'];var utils=require(_0x26fc('0x5'));var logger=require('../../config/logger')(_0x26fc('0x6'));var config=require(_0x26fc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x26fc('0x8')][_0x26fc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e8b7f,_0x5116c6,_0x2a2fab){return new BPromise(function(_0x8742af,_0x195f32){return client[_0x26fc('0xa')](_0x5e8b7f,_0x2a2fab)[_0x26fc('0xb')](function(_0x181356){logger[_0x26fc('0xc')](_0x26fc('0xd'),_0x5116c6,_0x26fc('0xe'));logger['debug'](_0x26fc('0xf'),_0x5116c6,'request\x20sent',JSON['stringify'](_0x181356));if(_0x181356[_0x26fc('0x10')]){if(_0x181356['error'][_0x26fc('0x11')]===0x1f4){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x5116c6,_0x181356[_0x26fc('0x10')][_0x26fc('0x12')]);return _0x195f32(_0x181356[_0x26fc('0x10')][_0x26fc('0x12')]);}logger[_0x26fc('0x10')](_0x26fc('0xd'),_0x5116c6,_0x181356[_0x26fc('0x10')][_0x26fc('0x12')]);return _0x8742af(_0x181356[_0x26fc('0x10')]['message']);}else{logger[_0x26fc('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0x5116c6,_0x26fc('0xe'));_0x8742af(_0x181356['result'][_0x26fc('0x12')]);}})['catch'](function(_0x226b3a){logger[_0x26fc('0x10')](_0x26fc('0xd'),_0x5116c6,_0x226b3a);_0x195f32(_0x226b3a);});});} \ No newline at end of file +var _0xffed=['code','message','info','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x31b221,_0x308538){var _0x1ff83c=function(_0x3754cf){while(--_0x3754cf){_0x31b221['push'](_0x31b221['shift']());}};_0x1ff83c(++_0x308538);}(_0xffed,0x82));var _0xdffe=function(_0x4ae035,_0x3f592c){_0x4ae035=_0x4ae035-0x0;var _0x44c665=_0xffed[_0x4ae035];return _0x44c665;};'use strict';var _=require(_0xdffe('0x0'));var util=require(_0xdffe('0x1'));var moment=require('moment');var BPromise=require(_0xdffe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdffe('0x3'));var db=require(_0xdffe('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdffe('0x5'))(_0xdffe('0x6'));var config=require(_0xdffe('0x7'));var jayson=require(_0xdffe('0x8'));var client=jayson[_0xdffe('0x9')][_0xdffe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x537528,_0x2a40c9,_0x4658fb){return new BPromise(function(_0x1355cd,_0x4ef1b7){return client[_0xdffe('0xb')](_0x537528,_0x4658fb)['then'](function(_0x30ed64){logger['info'](_0xdffe('0xc'),_0x2a40c9,_0xdffe('0xd'));logger[_0xdffe('0xe')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x2a40c9,'request\x20sent',JSON[_0xdffe('0xf')](_0x30ed64));if(_0x30ed64[_0xdffe('0x10')]){if(_0x30ed64['error'][_0xdffe('0x11')]===0x1f4){logger[_0xdffe('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x2a40c9,_0x30ed64[_0xdffe('0x10')][_0xdffe('0x12')]);return _0x4ef1b7(_0x30ed64['error'][_0xdffe('0x12')]);}logger[_0xdffe('0x10')](_0xdffe('0xc'),_0x2a40c9,_0x30ed64[_0xdffe('0x10')][_0xdffe('0x12')]);return _0x1355cd(_0x30ed64[_0xdffe('0x10')][_0xdffe('0x12')]);}else{logger[_0xdffe('0x13')](_0xdffe('0xc'),_0x2a40c9,_0xdffe('0xd'));_0x1355cd(_0x30ed64['result'][_0xdffe('0x12')]);}})[_0xdffe('0x14')](function(_0x1fe21d){logger[_0xdffe('0x10')](_0xdffe('0xc'),_0x2a40c9,_0x1fe21d);_0x4ef1b7(_0x1fe21d);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 5244d61..b5cf0ed 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 _0x815c=['util','express','fs-extra','../../components/auth/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','/:id','delete','destroy','exports','multer'];(function(_0x4c3746,_0x3e7097){var _0x32a84b=function(_0x5a09ab){while(--_0x5a09ab){_0x4c3746['push'](_0x4c3746['shift']());}};_0x32a84b(++_0x3e7097);}(_0x815c,0x1ee));var _0xc815=function(_0x554f86,_0x1d8bd3){_0x554f86=_0x554f86-0x0;var _0x17dd87=_0x815c[_0x554f86];return _0x17dd87;};'use strict';var multer=require(_0xc815('0x0'));var util=require(_0xc815('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc815('0x2'));var router=express['Router']();var fs_extra=require(_0xc815('0x3'));var auth=require(_0xc815('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc815('0x5'));var controller=require(_0xc815('0x6'));router[_0xc815('0x7')]('/',auth[_0xc815('0x8')](),controller[_0xc815('0x9')]);router[_0xc815('0x7')](_0xc815('0xa'),auth[_0xc815('0x8')](),controller['describe']);router[_0xc815('0x7')]('/:id',auth[_0xc815('0x8')](),controller['show']);router['post']('/',auth[_0xc815('0x8')](),controller['create']);router['put'](_0xc815('0xb'),auth[_0xc815('0x8')](),controller['update']);router[_0xc815('0xc')](_0xc815('0xb'),auth[_0xc815('0x8')](),controller[_0xc815('0xd')]);module[_0xc815('0xe')]=router; \ No newline at end of file +var _0x713d=['create','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','post'];(function(_0x16bbd7,_0xed5042){var _0x5b99aa=function(_0x22167f){while(--_0x22167f){_0x16bbd7['push'](_0x16bbd7['shift']());}};_0x5b99aa(++_0xed5042);}(_0x713d,0x1d4));var _0xd713=function(_0x3d13b3,_0x469d9a){_0x3d13b3=_0x3d13b3-0x0;var _0x2c4d6e=_0x713d[_0x3d13b3];return _0x2c4d6e;};'use strict';var multer=require(_0xd713('0x0'));var util=require('util');var path=require(_0xd713('0x1'));var timeout=require(_0xd713('0x2'));var express=require('express');var router=express[_0xd713('0x3')]();var fs_extra=require(_0xd713('0x4'));var auth=require(_0xd713('0x5'));var interaction=require(_0xd713('0x6'));var config=require(_0xd713('0x7'));var controller=require(_0xd713('0x8'));router[_0xd713('0x9')]('/',auth[_0xd713('0xa')](),controller['index']);router[_0xd713('0x9')](_0xd713('0xb'),auth[_0xd713('0xa')](),controller[_0xd713('0xc')]);router[_0xd713('0x9')](_0xd713('0xd'),auth[_0xd713('0xa')](),controller['show']);router[_0xd713('0xe')]('/',auth[_0xd713('0xa')](),controller[_0xd713('0xf')]);router[_0xd713('0x10')](_0xd713('0xd'),auth[_0xd713('0xa')](),controller[_0xd713('0x11')]);router[_0xd713('0x12')](_0xd713('0xd'),auth[_0xd713('0xa')](),controller[_0xd713('0x13')]);module[_0xd713('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 0607ae3..76b8ae3 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 _0x75a7=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','/:id','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x8980,_0x3e943b){var _0x3491a6=function(_0x1acbf3){while(--_0x1acbf3){_0x8980['push'](_0x8980['shift']());}};_0x3491a6(++_0x3e943b);}(_0x75a7,0x124));var _0x775a=function(_0x2fe27e,_0x4a43be){_0x2fe27e=_0x2fe27e-0x0;var _0x1240a3=_0x75a7[_0x2fe27e];return _0x1240a3;};'use strict';var multer=require(_0x775a('0x0'));var util=require(_0x775a('0x1'));var path=require(_0x775a('0x2'));var timeout=require(_0x775a('0x3'));var express=require(_0x775a('0x4'));var router=express[_0x775a('0x5')]();var fs_extra=require(_0x775a('0x6'));var auth=require(_0x775a('0x7'));var interaction=require(_0x775a('0x8'));var config=require(_0x775a('0x9'));var controller=require(_0x775a('0xa'));router[_0x775a('0xb')]('/',auth[_0x775a('0xc')](),controller['index']);router[_0x775a('0xb')]('/:id',auth[_0x775a('0xc')](),controller[_0x775a('0xd')]);router[_0x775a('0xb')](_0x775a('0xe'),auth[_0x775a('0xc')](),controller[_0x775a('0xf')]);router[_0x775a('0xb')](_0x775a('0x10'),auth[_0x775a('0xc')](),controller['getFields']);router[_0x775a('0x11')]('/',auth[_0x775a('0xc')](),controller[_0x775a('0x12')]);router['post'](_0x775a('0xe'),auth[_0x775a('0xc')](),controller[_0x775a('0x13')]);router[_0x775a('0x14')](_0x775a('0x15'),auth[_0x775a('0xc')](),controller['update']);router['delete'](_0x775a('0x15'),auth[_0x775a('0xc')](),controller['destroy']);module[_0x775a('0x16')]=router; \ No newline at end of file +var _0x8718=['./intDeskAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','post','put','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x59a141,_0xaf822f){var _0x39edf0=function(_0x496c81){while(--_0x496c81){_0x59a141['push'](_0x59a141['shift']());}};_0x39edf0(++_0xaf822f);}(_0x8718,0x85));var _0x8871=function(_0x81e39d,_0x4c3934){_0x81e39d=_0x81e39d-0x0;var _0x548fbb=_0x8718[_0x81e39d];return _0x548fbb;};'use strict';var multer=require('multer');var util=require(_0x8871('0x0'));var path=require(_0x8871('0x1'));var timeout=require(_0x8871('0x2'));var express=require('express');var router=express[_0x8871('0x3')]();var fs_extra=require(_0x8871('0x4'));var auth=require(_0x8871('0x5'));var interaction=require(_0x8871('0x6'));var config=require('../../config/environment');var controller=require(_0x8871('0x7'));router[_0x8871('0x8')]('/',auth[_0x8871('0x9')](),controller[_0x8871('0xa')]);router[_0x8871('0x8')](_0x8871('0xb'),auth[_0x8871('0x9')](),controller['show']);router[_0x8871('0x8')](_0x8871('0xc'),auth[_0x8871('0x9')](),controller[_0x8871('0xd')]);router[_0x8871('0x8')](_0x8871('0xe'),auth[_0x8871('0x9')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x8871('0xf')](_0x8871('0xc'),auth[_0x8871('0x9')](),controller['addConfiguration']);router[_0x8871('0x10')](_0x8871('0xb'),auth[_0x8871('0x9')](),controller['update']);router[_0x8871('0x11')](_0x8871('0xb'),auth[_0x8871('0x9')](),controller[_0x8871('0x12')]);module[_0x8871('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 56c5d6b..0d18dde 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 _0xe85e=['exports','STRING','ENUM','basic','integrationTab','sequelize'];(function(_0x505fba,_0x5828cb){var _0x5f0a08=function(_0x15b04c){while(--_0x15b04c){_0x505fba['push'](_0x505fba['shift']());}};_0x5f0a08(++_0x5828cb);}(_0xe85e,0x137));var _0xee85=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe85e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xee85('0x0'));module[_0xee85('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xee85('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xee85('0x2')]},'authType':{'type':Sequelize[_0xee85('0x3')](_0xee85('0x4')),'defaultValue':_0xee85('0x4')},'password':{'type':Sequelize[_0xee85('0x2')]},'consumerKey':{'type':Sequelize[_0xee85('0x2')]},'consumerSecret':{'type':Sequelize[_0xee85('0x2')]},'token':{'type':Sequelize[_0xee85('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xee85('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xee85('0x3')](_0xee85('0x5'),'newTab'),'defaultValue':_0xee85('0x5')}}; \ No newline at end of file +var _0x73d8=['exports','STRING','ENUM','basic','integrationTab','newTab','sequelize'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x73d8,0x1cd));var _0x873d=function(_0x480465,_0x251df6){_0x480465=_0x480465-0x0;var _0x3312c2=_0x73d8[_0x480465];return _0x3312c2;};'use strict';var Sequelize=require(_0x873d('0x0'));module[_0x873d('0x1')]={'name':{'type':Sequelize[_0x873d('0x2')]},'description':{'type':Sequelize[_0x873d('0x2')]},'username':{'type':Sequelize[_0x873d('0x2')]},'remoteUri':{'type':Sequelize[_0x873d('0x2')]},'authType':{'type':Sequelize[_0x873d('0x3')](_0x873d('0x4')),'defaultValue':'basic'},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x873d('0x2')]},'token':{'type':Sequelize[_0x873d('0x2')]},'tokenSecret':{'type':Sequelize[_0x873d('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x873d('0x3')](_0x873d('0x5'),_0x873d('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index f9025ce..43f76b4 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 _0x4e4a=['remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','active','label','catch','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','DeskAccount','includeAll','include','rows','show','params','keys','create','body','update','find','getConfigurations','findOne','DeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','priority'];(function(_0x2c5b20,_0x552b9f){var _0x535c5e=function(_0xe1f7c){while(--_0xe1f7c){_0x2c5b20['push'](_0x2c5b20['shift']());}};_0x535c5e(++_0x552b9f);}(_0x4e4a,0x114));var _0xa4e4=function(_0x46b98,_0x202301){_0x46b98=_0x46b98-0x0;var _0x550fed=_0x4e4a[_0x46b98];return _0x550fed;};'use strict';var emlformat=require(_0xa4e4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa4e4('0x1'));var jsonpatch=require(_0xa4e4('0x2'));var rp=require(_0xa4e4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa4e4('0x4'));var util=require(_0xa4e4('0x5'));var path=require('path');var sox=require(_0xa4e4('0x6'));var csv=require(_0xa4e4('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa4e4('0x8'));var _=require(_0xa4e4('0x9'));var squel=require(_0xa4e4('0xa'));var crypto=require('crypto');var jsforce=require(_0xa4e4('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa4e4('0xc'));var Papa=require(_0xa4e4('0xd'));var Redis=require('ioredis');var authService=require(_0xa4e4('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xa4e4('0xf'));var hardwareService=require(_0xa4e4('0x10'));var logger=require(_0xa4e4('0x11'))('api');var utils=require(_0xa4e4('0x12'));var config=require(_0xa4e4('0x13'));var licenseUtil=require(_0xa4e4('0x14'));var db=require(_0xa4e4('0x15'))['db'];var integrations=require(_0xa4e4('0x16'));function respondWithStatusCode(_0x2a357b,_0x3b62b5){_0x3b62b5=_0x3b62b5||0xcc;return function(_0x4db533){if(_0x4db533){return _0x2a357b[_0xa4e4('0x17')](_0x3b62b5);}return _0x2a357b[_0xa4e4('0x18')](_0x3b62b5)['end']();};}function respondWithResult(_0x1f0490,_0x1f078f){_0x1f078f=_0x1f078f||0xc8;return function(_0x2279ff){if(_0x2279ff){return _0x1f0490[_0xa4e4('0x18')](_0x1f078f)['json'](_0x2279ff);}};}function respondWithFilteredResult(_0x443e0c,_0x5b47e7){return function(_0x120125){if(_0x120125){var _0x522962=typeof _0x5b47e7['offset']===_0xa4e4('0x19')&&typeof _0x5b47e7[_0xa4e4('0x1a')]===_0xa4e4('0x19');var _0xc2d934=_0x120125[_0xa4e4('0x1b')];var _0x608891=_0x522962?0x0:_0x5b47e7[_0xa4e4('0x1c')];var _0x257b29=_0x522962?_0x120125[_0xa4e4('0x1b')]:_0x5b47e7['offset']+_0x5b47e7[_0xa4e4('0x1a')];var _0x2ca3e4;if(_0x257b29>=_0xc2d934){_0x257b29=_0xc2d934;_0x2ca3e4=0xc8;}else{_0x2ca3e4=0xce;}_0x443e0c[_0xa4e4('0x18')](_0x2ca3e4);return _0x443e0c[_0xa4e4('0x1d')](_0xa4e4('0x1e'),_0x608891+'-'+_0x257b29+'/'+_0xc2d934)[_0xa4e4('0x1f')](_0x120125);}return null;};}function patchUpdates(_0x9ba2b1){return function(_0x208fa5){try{jsonpatch[_0xa4e4('0x20')](_0x208fa5,_0x9ba2b1,!![]);}catch(_0x318492){return BPromise[_0xa4e4('0x21')](_0x318492);}return _0x208fa5[_0xa4e4('0x22')]();};}function saveUpdates(_0x42550f,_0x4f12f5){return function(_0x102a99){if(_0x102a99){return _0x102a99['update'](_0x42550f)[_0xa4e4('0x23')](function(_0x8eae2b){return _0x8eae2b;});}return null;};}function removeEntity(_0x4a9388,_0x30b406){return function(_0x207213){if(_0x207213){return _0x207213[_0xa4e4('0x24')]()['then'](function(){_0x4a9388['status'](0xcc)[_0xa4e4('0x25')]();});}};}function handleEntityNotFound(_0x48cd0d,_0x204b58){return function(_0x1fca4d){if(!_0x1fca4d){_0x48cd0d[_0xa4e4('0x17')](0x194);}return _0x1fca4d;};}function handleError(_0x586551,_0x243f1a){_0x243f1a=_0x243f1a||0x1f4;return function(_0xa0d58b){logger['error'](_0xa0d58b[_0xa4e4('0x26')]);if(_0xa0d58b['name']){delete _0xa0d58b[_0xa4e4('0x27')];}_0x586551[_0xa4e4('0x18')](_0x243f1a)[_0xa4e4('0x28')](_0xa0d58b);};}exports[_0xa4e4('0x29')]=function(_0x268721,_0x27ac6b){var _0x507584={},_0x44d335={},_0x39e0b9={'count':0x0,'rows':[]};var _0x5b9f2c=_[_0xa4e4('0x2a')](db['DeskAccount'][_0xa4e4('0x2b')],function(_0x5ce9d1){return{'name':_0x5ce9d1[_0xa4e4('0x2c')],'type':_0x5ce9d1[_0xa4e4('0x2d')][_0xa4e4('0x2e')]};});_0x44d335[_0xa4e4('0x2f')]=_[_0xa4e4('0x2a')](_0x5b9f2c,_0xa4e4('0x27'));_0x44d335[_0xa4e4('0x30')]=_['keys'](_0x268721[_0xa4e4('0x30')]);_0x44d335[_0xa4e4('0x31')]=_[_0xa4e4('0x32')](_0x44d335[_0xa4e4('0x2f')],_0x44d335[_0xa4e4('0x30')]);_0x507584[_0xa4e4('0x33')]=_[_0xa4e4('0x32')](_0x44d335[_0xa4e4('0x2f')],qs[_0xa4e4('0x34')](_0x268721[_0xa4e4('0x30')]['fields']));_0x507584[_0xa4e4('0x33')]=_0x507584['attributes'][_0xa4e4('0x35')]?_0x507584['attributes']:_0x44d335[_0xa4e4('0x2f')];if(!_0x268721[_0xa4e4('0x30')][_0xa4e4('0x36')](_0xa4e4('0x37'))){_0x507584[_0xa4e4('0x1a')]=qs['limit'](_0x268721[_0xa4e4('0x30')]['limit']);_0x507584['offset']=qs[_0xa4e4('0x1c')](_0x268721[_0xa4e4('0x30')][_0xa4e4('0x1c')]);}_0x507584[_0xa4e4('0x38')]=qs[_0xa4e4('0x39')](_0x268721['query'][_0xa4e4('0x39')]);_0x507584[_0xa4e4('0x3a')]=qs['filters'](_[_0xa4e4('0x3b')](_0x268721[_0xa4e4('0x30')],_0x44d335[_0xa4e4('0x31')]),_0x5b9f2c);if(_0x268721[_0xa4e4('0x30')][_0xa4e4('0x3c')]){_0x507584[_0xa4e4('0x3a')]=_[_0xa4e4('0x3d')](_0x507584[_0xa4e4('0x3a')],{'$or':_[_0xa4e4('0x2a')](_0x5b9f2c,function(_0x1d206b){if(_0x1d206b[_0xa4e4('0x2d')]!==_0xa4e4('0x3e')){var _0x36c10f={};_0x36c10f[_0x1d206b[_0xa4e4('0x27')]]={'$like':'%'+_0x268721[_0xa4e4('0x30')][_0xa4e4('0x3c')]+'%'};return _0x36c10f;}})});}_0x507584=_[_0xa4e4('0x3d')]({},_0x507584,_0x268721[_0xa4e4('0x3f')]);var _0x468a1c={'where':_0x507584[_0xa4e4('0x3a')]};return db[_0xa4e4('0x40')][_0xa4e4('0x1b')](_0x468a1c)['then'](function(_0x2ebbd1){_0x39e0b9[_0xa4e4('0x1b')]=_0x2ebbd1;if(_0x268721[_0xa4e4('0x30')][_0xa4e4('0x41')]){_0x507584[_0xa4e4('0x42')]=[{'all':!![]}];}return db[_0xa4e4('0x40')]['findAll'](_0x507584);})[_0xa4e4('0x23')](function(_0x542120){_0x39e0b9[_0xa4e4('0x43')]=_0x542120;return _0x39e0b9;})[_0xa4e4('0x23')](respondWithFilteredResult(_0x27ac6b,_0x507584))['catch'](handleError(_0x27ac6b,null));};exports[_0xa4e4('0x44')]=function(_0x5342c8,_0x52f8f5){var _0x2fd81e={'raw':![],'where':{'id':_0x5342c8[_0xa4e4('0x45')]['id']}},_0x421f81={};_0x421f81[_0xa4e4('0x2f')]=_[_0xa4e4('0x46')](db['DeskAccount'][_0xa4e4('0x2b')]);_0x421f81[_0xa4e4('0x30')]=_['keys'](_0x5342c8[_0xa4e4('0x30')]);_0x421f81[_0xa4e4('0x31')]=_['intersection'](_0x421f81['model'],_0x421f81[_0xa4e4('0x30')]);_0x2fd81e[_0xa4e4('0x33')]=_[_0xa4e4('0x32')](_0x421f81[_0xa4e4('0x2f')],qs['fields'](_0x5342c8[_0xa4e4('0x30')][_0xa4e4('0x34')]));_0x2fd81e[_0xa4e4('0x33')]=_0x2fd81e['attributes'][_0xa4e4('0x35')]?_0x2fd81e[_0xa4e4('0x33')]:_0x421f81[_0xa4e4('0x2f')];if(_0x5342c8[_0xa4e4('0x30')][_0xa4e4('0x41')]){_0x2fd81e[_0xa4e4('0x42')]=[{'all':!![]}];}_0x2fd81e=_[_0xa4e4('0x3d')]({},_0x2fd81e,_0x5342c8['options']);return db['DeskAccount']['find'](_0x2fd81e)[_0xa4e4('0x23')](handleEntityNotFound(_0x52f8f5,null))[_0xa4e4('0x23')](respondWithResult(_0x52f8f5,null))['catch'](handleError(_0x52f8f5,null));};exports[_0xa4e4('0x47')]=function(_0x54abca,_0x37b59b){return db[_0xa4e4('0x40')][_0xa4e4('0x47')](_0x54abca[_0xa4e4('0x48')],{})[_0xa4e4('0x23')](respondWithResult(_0x37b59b,0xc9))['catch'](handleError(_0x37b59b,null));};exports[_0xa4e4('0x49')]=function(_0x5575b9,_0x593a24){if(_0x5575b9[_0xa4e4('0x48')]['id']){delete _0x5575b9[_0xa4e4('0x48')]['id'];}return db[_0xa4e4('0x40')][_0xa4e4('0x4a')]({'where':{'id':_0x5575b9[_0xa4e4('0x45')]['id']}})[_0xa4e4('0x23')](handleEntityNotFound(_0x593a24,null))['then'](saveUpdates(_0x5575b9['body'],null))[_0xa4e4('0x23')](respondWithResult(_0x593a24,null))['catch'](handleError(_0x593a24,null));};exports['destroy']=function(_0x1dc371,_0x3508d8){return db['DeskAccount'][_0xa4e4('0x4a')]({'where':{'id':_0x1dc371[_0xa4e4('0x45')]['id']}})['then'](handleEntityNotFound(_0x3508d8,null))[_0xa4e4('0x23')](removeEntity(_0x3508d8,null))['catch'](handleError(_0x3508d8,null));};exports[_0xa4e4('0x4b')]=function(_0x132e38,_0x515737,_0x429339){var _0x37dba3={};var _0x468669={};var _0x4bc0dd;var _0x1bd06b;return db[_0xa4e4('0x40')][_0xa4e4('0x4c')]({'where':{'id':_0x132e38[_0xa4e4('0x45')]['id']}})[_0xa4e4('0x23')](handleEntityNotFound(_0x515737,null))[_0xa4e4('0x23')](function(_0x358f4f){if(_0x358f4f){_0x4bc0dd=_0x358f4f;_0x468669['model']=_['keys'](db[_0xa4e4('0x4d')][_0xa4e4('0x2b')]);_0x468669[_0xa4e4('0x30')]=_[_0xa4e4('0x46')](_0x132e38[_0xa4e4('0x30')]);_0x468669['filters']=_[_0xa4e4('0x32')](_0x468669[_0xa4e4('0x2f')],_0x468669[_0xa4e4('0x30')]);_0x37dba3[_0xa4e4('0x33')]=_['intersection'](_0x468669[_0xa4e4('0x2f')],qs[_0xa4e4('0x34')](_0x132e38['query'][_0xa4e4('0x34')]));_0x37dba3['attributes']=_0x37dba3[_0xa4e4('0x33')]['length']?_0x37dba3[_0xa4e4('0x33')]:_0x468669[_0xa4e4('0x2f')];_0x37dba3[_0xa4e4('0x38')]=qs[_0xa4e4('0x39')](_0x132e38[_0xa4e4('0x30')]['sort']);_0x37dba3[_0xa4e4('0x3a')]=qs[_0xa4e4('0x31')](_['pick'](_0x132e38[_0xa4e4('0x30')],_0x468669[_0xa4e4('0x31')]));if(_0x132e38[_0xa4e4('0x30')][_0xa4e4('0x3c')]){_0x37dba3['where']=_[_0xa4e4('0x3d')](_0x37dba3[_0xa4e4('0x3a')],{'$or':_['map'](_0x37dba3[_0xa4e4('0x33')],function(_0x50f44b){var _0x1ce674={};_0x1ce674[_0x50f44b]={'$like':'%'+_0x132e38[_0xa4e4('0x30')][_0xa4e4('0x3c')]+'%'};return _0x1ce674;})});}_0x37dba3=_[_0xa4e4('0x3d')]({},_0x37dba3,_0x132e38[_0xa4e4('0x3f')]);return _0x4bc0dd[_0xa4e4('0x4b')](_0x37dba3);}})['then'](function(_0x5504a6){if(_0x5504a6){_0x1bd06b=_0x5504a6['length'];if(!_0x132e38[_0xa4e4('0x30')][_0xa4e4('0x36')]('nolimit')){_0x37dba3['limit']=qs[_0xa4e4('0x1a')](_0x132e38[_0xa4e4('0x30')][_0xa4e4('0x1a')]);_0x37dba3[_0xa4e4('0x1c')]=qs[_0xa4e4('0x1c')](_0x132e38['query']['offset']);}return _0x4bc0dd['getConfigurations'](_0x37dba3);}})[_0xa4e4('0x23')](function(_0x48dbdc){if(_0x48dbdc){return _0x48dbdc?{'count':_0x1bd06b,'rows':_0x48dbdc}:null;}})[_0xa4e4('0x23')](respondWithResult(_0x515737,null))['catch'](handleError(_0x515737,null));};exports[_0xa4e4('0x4e')]=function(_0x610c91,_0x31c3b7,_0x1570fd){if(_0x610c91[_0xa4e4('0x48')]['id']){delete _0x610c91['body']['id'];}return db[_0xa4e4('0x40')][_0xa4e4('0x4c')]({'where':{'id':_0x610c91['params']['id']}})[_0xa4e4('0x23')](handleEntityNotFound(_0x31c3b7,null))[_0xa4e4('0x23')](function(_0x320a61){if(_0x320a61){_0x610c91[_0xa4e4('0x48')][_0xa4e4('0x4f')]=_0x320a61['id'];_0x610c91['body'][_0xa4e4('0x50')]=integrations[_0xa4e4('0x51')](_0x610c91[_0xa4e4('0x48')][_0xa4e4('0x52')],_0x610c91[_0xa4e4('0x48')][_0xa4e4('0x2d')]);_0x610c91[_0xa4e4('0x48')][_0xa4e4('0x53')]=integrations[_0xa4e4('0x54')](_0x610c91['body'][_0xa4e4('0x52')],_0x610c91[_0xa4e4('0x48')]['type']);return db[_0xa4e4('0x4d')][_0xa4e4('0x47')](_0x610c91['body'],{'include':[{'model':db[_0xa4e4('0x55')],'as':_0xa4e4('0x50')},{'model':db['DeskField'],'as':_0xa4e4('0x53')}]});}return null;})[_0xa4e4('0x23')](respondWithResult(_0x31c3b7,null))['catch'](handleError(_0x31c3b7,null));};exports['getFields']=function(_0x45e447,_0x5d1373,_0x43ce41){var _0x449e11=[{'name':'priority','label':_0xa4e4('0x56'),'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 _0x41e7bb='';return db['DeskAccount'][_0xa4e4('0x4c')]({'where':{'id':_0x45e447['params']['id']},'attributes':['id',_0xa4e4('0x57'),_0xa4e4('0x58'),_0xa4e4('0x59'),_0xa4e4('0x5a'),_0xa4e4('0x5b'),_0xa4e4('0x5c'),_0xa4e4('0x5d'),_0xa4e4('0x5e')]})[_0xa4e4('0x23')](handleEntityNotFound(_0x5d1373,null))[_0xa4e4('0x23')](function(_0x4666a9){if(_0x4666a9){_0x41e7bb=_0x4666a9['remoteUri'];var _0x178d38=_0x41e7bb[_0xa4e4('0x5f')](-0x1);if(_0x178d38==='/'){_0x41e7bb=_0x41e7bb[_0xa4e4('0x60')](0x0,_0x41e7bb[_0xa4e4('0x61')](_0x178d38));}var _0x278b22={'method':_0xa4e4('0x62'),'uri':util[_0xa4e4('0x63')](_0xa4e4('0x64'),_0x41e7bb),'headers':{'Content-Type':_0xa4e4('0x65'),'Accept':_0xa4e4('0x65')},'json':!![]};if(_0x4666a9[_0xa4e4('0x58')]===_0xa4e4('0x66')){_0x278b22[_0xa4e4('0x67')][_0xa4e4('0x68')]=util['format'](_0xa4e4('0x69'),new Buffer(util['format'](_0xa4e4('0x6a'),_0x4666a9[_0xa4e4('0x59')],_0x4666a9[_0xa4e4('0x5a')]))[_0xa4e4('0x6b')](_0xa4e4('0x6c')));}return rp(_0x278b22)[_0xa4e4('0x23')](function(_0x5f35b0){return _0x449e11[_0xa4e4('0x6d')](_[_0xa4e4('0x2a')](_0x5f35b0[_0xa4e4('0x6e')]['entries'],function(_0x3057f9){return{'id':_0x3057f9[_0xa4e4('0x27')],'name':_0x3057f9[_0xa4e4('0x27')],'type':_0x3057f9[_0xa4e4('0x2d')],'active':_0x3057f9[_0xa4e4('0x6f')],'label':_0x3057f9[_0xa4e4('0x70')],'custom':!![]};}));});}})['then'](function(_0x139f74){return{'count':_0x139f74[_0xa4e4('0x35')],'rows':_0x139f74};})[_0xa4e4('0x23')](respondWithResult(_0x5d1373,null))[_0xa4e4('0x71')](function(_0x2c71d0){var _0xe9cdc5=_0x45e447[_0xa4e4('0x30')][_0xa4e4('0x72')]?0x1f4:_0x2c71d0[_0xa4e4('0x73')]||0x1f4;logger[_0xa4e4('0x74')](_0xa4e4('0x75'),_0xa4e4('0x76'),_0xe9cdc5,JSON[_0xa4e4('0x77')](_0x2c71d0));delete _0x2c71d0[_0xa4e4('0x27')];if(_0xe9cdc5===0x191){_0xe9cdc5=0x190;}_0x5d1373[_0xa4e4('0x18')](_0xe9cdc5)[_0xa4e4('0x28')](_0x45e447['query'][_0xa4e4('0x72')]?{'message':_0xa4e4('0x78'),'statusCode':_0x2c71d0[_0xa4e4('0x73')]}:_0x2c71d0);});}; \ No newline at end of file +var _0xd247=['DeskConfiguration','nolimit','AccountId','getSubjects','channel','Descriptions','DeskField','Subjects','getFields','priority','authType','username','consumerKey','consumerSecret','token','tokenSecret','remoteUri','slice','lastIndexOf','format','%s/custom_fields','application/json','basic','headers','Authorization','%s:%s','password','toString','base64','concat','_embedded','statusCode','stringify','test','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','crypto','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','end','limit','undefined','offset','count','Content-Range','json','apply','reject','then','destroy','sendStatus','error','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filter','merge','includeAll','findAll','rows','catch','show','params','length','options','create','body','update','find','getConfigurations','findOne'];(function(_0xce6f11,_0x3c3137){var _0x35b709=function(_0x1755c6){while(--_0x1755c6){_0xce6f11['push'](_0xce6f11['shift']());}};_0x35b709(++_0x3c3137);}(_0xd247,0x1d6));var _0x7d24=function(_0x281d23,_0x20d215){_0x281d23=_0x281d23-0x0;var _0x6b91db=_0xd247[_0x281d23];return _0x6b91db;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7d24('0x0'));var zipdir=require(_0x7d24('0x1'));var jsonpatch=require(_0x7d24('0x2'));var rp=require('request-promise');var moment=require(_0x7d24('0x3'));var BPromise=require(_0x7d24('0x4'));var Mustache=require(_0x7d24('0x5'));var util=require('util');var path=require(_0x7d24('0x6'));var sox=require('sox');var csv=require(_0x7d24('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7d24('0x8'));var _=require(_0x7d24('0x9'));var squel=require('squel');var crypto=require(_0x7d24('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x7d24('0xb'));var toCsv=require(_0x7d24('0x7'));var querystring=require(_0x7d24('0xc'));var Papa=require(_0x7d24('0xd'));var Redis=require(_0x7d24('0xe'));var authService=require(_0x7d24('0xf'));var qs=require(_0x7d24('0x10'));var as=require(_0x7d24('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7d24('0x12'))(_0x7d24('0x13'));var utils=require(_0x7d24('0x14'));var config=require(_0x7d24('0x15'));var licenseUtil=require(_0x7d24('0x16'));var db=require(_0x7d24('0x17'))['db'];var integrations=require(_0x7d24('0x18'));function respondWithStatusCode(_0x31e755,_0x5a6cba){_0x5a6cba=_0x5a6cba||0xcc;return function(_0x426539){if(_0x426539){return _0x31e755['sendStatus'](_0x5a6cba);}return _0x31e755[_0x7d24('0x19')](_0x5a6cba)[_0x7d24('0x1a')]();};}function respondWithResult(_0x367a74,_0x4c3064){_0x4c3064=_0x4c3064||0xc8;return function(_0x4540ba){if(_0x4540ba){return _0x367a74[_0x7d24('0x19')](_0x4c3064)['json'](_0x4540ba);}};}function respondWithFilteredResult(_0xd37e6e,_0x37001d){return function(_0x318a08){if(_0x318a08){var _0x336246=typeof _0x37001d['offset']==='undefined'&&typeof _0x37001d[_0x7d24('0x1b')]===_0x7d24('0x1c');var _0x14524a=_0x318a08['count'];var _0x1c6640=_0x336246?0x0:_0x37001d[_0x7d24('0x1d')];var _0x238615=_0x336246?_0x318a08[_0x7d24('0x1e')]:_0x37001d[_0x7d24('0x1d')]+_0x37001d['limit'];var _0x144bf0;if(_0x238615>=_0x14524a){_0x238615=_0x14524a;_0x144bf0=0xc8;}else{_0x144bf0=0xce;}_0xd37e6e[_0x7d24('0x19')](_0x144bf0);return _0xd37e6e['set'](_0x7d24('0x1f'),_0x1c6640+'-'+_0x238615+'/'+_0x14524a)[_0x7d24('0x20')](_0x318a08);}return null;};}function patchUpdates(_0x2f2937){return function(_0x27861b){try{jsonpatch[_0x7d24('0x21')](_0x27861b,_0x2f2937,!![]);}catch(_0x17497b){return BPromise[_0x7d24('0x22')](_0x17497b);}return _0x27861b['save']();};}function saveUpdates(_0x568f56,_0x46edfd){return function(_0x33a5ed){if(_0x33a5ed){return _0x33a5ed['update'](_0x568f56)[_0x7d24('0x23')](function(_0x38be44){return _0x38be44;});}return null;};}function removeEntity(_0x4dc528,_0x4cfcbb){return function(_0x55baf0){if(_0x55baf0){return _0x55baf0[_0x7d24('0x24')]()[_0x7d24('0x23')](function(){_0x4dc528['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e7d4,_0x248006){return function(_0x43f9e6){if(!_0x43f9e6){_0x3e7d4[_0x7d24('0x25')](0x194);}return _0x43f9e6;};}function handleError(_0x4d730f,_0x27f759){_0x27f759=_0x27f759||0x1f4;return function(_0x46a10d){logger[_0x7d24('0x26')](_0x46a10d[_0x7d24('0x27')]);if(_0x46a10d[_0x7d24('0x28')]){delete _0x46a10d[_0x7d24('0x28')];}_0x4d730f[_0x7d24('0x19')](_0x27f759)[_0x7d24('0x29')](_0x46a10d);};}exports[_0x7d24('0x2a')]=function(_0xfd98ff,_0xaa584){var _0x478598={},_0x5bbcd5={},_0x3b5c7d={'count':0x0,'rows':[]};var _0x3cfe9d=_[_0x7d24('0x2b')](db[_0x7d24('0x2c')][_0x7d24('0x2d')],function(_0x294bbe){return{'name':_0x294bbe[_0x7d24('0x2e')],'type':_0x294bbe[_0x7d24('0x2f')]['key']};});_0x5bbcd5[_0x7d24('0x30')]=_[_0x7d24('0x2b')](_0x3cfe9d,_0x7d24('0x28'));_0x5bbcd5[_0x7d24('0x31')]=_[_0x7d24('0x32')](_0xfd98ff['query']);_0x5bbcd5[_0x7d24('0x33')]=_[_0x7d24('0x34')](_0x5bbcd5[_0x7d24('0x30')],_0x5bbcd5['query']);_0x478598['attributes']=_[_0x7d24('0x34')](_0x5bbcd5[_0x7d24('0x30')],qs['fields'](_0xfd98ff['query'][_0x7d24('0x35')]));_0x478598[_0x7d24('0x36')]=_0x478598['attributes']['length']?_0x478598[_0x7d24('0x36')]:_0x5bbcd5['model'];if(!_0xfd98ff[_0x7d24('0x31')][_0x7d24('0x37')]('nolimit')){_0x478598['limit']=qs[_0x7d24('0x1b')](_0xfd98ff[_0x7d24('0x31')][_0x7d24('0x1b')]);_0x478598['offset']=qs[_0x7d24('0x1d')](_0xfd98ff['query']['offset']);}_0x478598['order']=qs[_0x7d24('0x38')](_0xfd98ff[_0x7d24('0x31')]['sort']);_0x478598[_0x7d24('0x39')]=qs[_0x7d24('0x33')](_[_0x7d24('0x3a')](_0xfd98ff['query'],_0x5bbcd5['filters']),_0x3cfe9d);if(_0xfd98ff['query'][_0x7d24('0x3b')]){_0x478598[_0x7d24('0x39')]=_[_0x7d24('0x3c')](_0x478598[_0x7d24('0x39')],{'$or':_['map'](_0x3cfe9d,function(_0x1d6c18){if(_0x1d6c18[_0x7d24('0x2f')]!=='VIRTUAL'){var _0x39395c={};_0x39395c[_0x1d6c18[_0x7d24('0x28')]]={'$like':'%'+_0xfd98ff[_0x7d24('0x31')]['filter']+'%'};return _0x39395c;}})});}_0x478598=_[_0x7d24('0x3c')]({},_0x478598,_0xfd98ff['options']);var _0x4c6159={'where':_0x478598[_0x7d24('0x39')]};return db['DeskAccount'][_0x7d24('0x1e')](_0x4c6159)[_0x7d24('0x23')](function(_0xe039b){_0x3b5c7d[_0x7d24('0x1e')]=_0xe039b;if(_0xfd98ff[_0x7d24('0x31')][_0x7d24('0x3d')]){_0x478598['include']=[{'all':!![]}];}return db[_0x7d24('0x2c')][_0x7d24('0x3e')](_0x478598);})[_0x7d24('0x23')](function(_0x12ea34){_0x3b5c7d[_0x7d24('0x3f')]=_0x12ea34;return _0x3b5c7d;})[_0x7d24('0x23')](respondWithFilteredResult(_0xaa584,_0x478598))[_0x7d24('0x40')](handleError(_0xaa584,null));};exports[_0x7d24('0x41')]=function(_0x14610e,_0x180eae){var _0x116883={'raw':![],'where':{'id':_0x14610e[_0x7d24('0x42')]['id']}},_0x38df54={};_0x38df54[_0x7d24('0x30')]=_[_0x7d24('0x32')](db[_0x7d24('0x2c')][_0x7d24('0x2d')]);_0x38df54[_0x7d24('0x31')]=_[_0x7d24('0x32')](_0x14610e['query']);_0x38df54[_0x7d24('0x33')]=_[_0x7d24('0x34')](_0x38df54[_0x7d24('0x30')],_0x38df54['query']);_0x116883[_0x7d24('0x36')]=_[_0x7d24('0x34')](_0x38df54['model'],qs['fields'](_0x14610e[_0x7d24('0x31')][_0x7d24('0x35')]));_0x116883[_0x7d24('0x36')]=_0x116883[_0x7d24('0x36')][_0x7d24('0x43')]?_0x116883[_0x7d24('0x36')]:_0x38df54['model'];if(_0x14610e['query'][_0x7d24('0x3d')]){_0x116883['include']=[{'all':!![]}];}_0x116883=_[_0x7d24('0x3c')]({},_0x116883,_0x14610e[_0x7d24('0x44')]);return db[_0x7d24('0x2c')]['find'](_0x116883)[_0x7d24('0x23')](handleEntityNotFound(_0x180eae,null))[_0x7d24('0x23')](respondWithResult(_0x180eae,null))[_0x7d24('0x40')](handleError(_0x180eae,null));};exports[_0x7d24('0x45')]=function(_0x36a3b4,_0x4312fb){return db[_0x7d24('0x2c')][_0x7d24('0x45')](_0x36a3b4[_0x7d24('0x46')],{})[_0x7d24('0x23')](respondWithResult(_0x4312fb,0xc9))['catch'](handleError(_0x4312fb,null));};exports[_0x7d24('0x47')]=function(_0x5c1341,_0x2039f0){if(_0x5c1341[_0x7d24('0x46')]['id']){delete _0x5c1341[_0x7d24('0x46')]['id'];}return db[_0x7d24('0x2c')][_0x7d24('0x48')]({'where':{'id':_0x5c1341[_0x7d24('0x42')]['id']}})[_0x7d24('0x23')](handleEntityNotFound(_0x2039f0,null))[_0x7d24('0x23')](saveUpdates(_0x5c1341[_0x7d24('0x46')],null))[_0x7d24('0x23')](respondWithResult(_0x2039f0,null))[_0x7d24('0x40')](handleError(_0x2039f0,null));};exports[_0x7d24('0x24')]=function(_0x291ade,_0x82096b){return db['DeskAccount'][_0x7d24('0x48')]({'where':{'id':_0x291ade['params']['id']}})[_0x7d24('0x23')](handleEntityNotFound(_0x82096b,null))[_0x7d24('0x23')](removeEntity(_0x82096b,null))[_0x7d24('0x40')](handleError(_0x82096b,null));};exports[_0x7d24('0x49')]=function(_0x5eced7,_0x212450,_0x4a0fdb){var _0xe82d5a={};var _0x244c28={};var _0x18f598;var _0x1dce1a;return db[_0x7d24('0x2c')][_0x7d24('0x4a')]({'where':{'id':_0x5eced7['params']['id']}})[_0x7d24('0x23')](handleEntityNotFound(_0x212450,null))['then'](function(_0x4d8d25){if(_0x4d8d25){_0x18f598=_0x4d8d25;_0x244c28[_0x7d24('0x30')]=_[_0x7d24('0x32')](db[_0x7d24('0x4b')]['rawAttributes']);_0x244c28[_0x7d24('0x31')]=_['keys'](_0x5eced7['query']);_0x244c28[_0x7d24('0x33')]=_[_0x7d24('0x34')](_0x244c28[_0x7d24('0x30')],_0x244c28[_0x7d24('0x31')]);_0xe82d5a[_0x7d24('0x36')]=_[_0x7d24('0x34')](_0x244c28[_0x7d24('0x30')],qs[_0x7d24('0x35')](_0x5eced7['query'][_0x7d24('0x35')]));_0xe82d5a[_0x7d24('0x36')]=_0xe82d5a[_0x7d24('0x36')][_0x7d24('0x43')]?_0xe82d5a[_0x7d24('0x36')]:_0x244c28[_0x7d24('0x30')];_0xe82d5a['order']=qs['sort'](_0x5eced7[_0x7d24('0x31')]['sort']);_0xe82d5a[_0x7d24('0x39')]=qs[_0x7d24('0x33')](_['pick'](_0x5eced7[_0x7d24('0x31')],_0x244c28[_0x7d24('0x33')]));if(_0x5eced7[_0x7d24('0x31')][_0x7d24('0x3b')]){_0xe82d5a[_0x7d24('0x39')]=_['merge'](_0xe82d5a[_0x7d24('0x39')],{'$or':_[_0x7d24('0x2b')](_0xe82d5a['attributes'],function(_0x3fac37){var _0x3c1207={};_0x3c1207[_0x3fac37]={'$like':'%'+_0x5eced7[_0x7d24('0x31')][_0x7d24('0x3b')]+'%'};return _0x3c1207;})});}_0xe82d5a=_[_0x7d24('0x3c')]({},_0xe82d5a,_0x5eced7[_0x7d24('0x44')]);return _0x18f598['getConfigurations'](_0xe82d5a);}})[_0x7d24('0x23')](function(_0x323163){if(_0x323163){_0x1dce1a=_0x323163[_0x7d24('0x43')];if(!_0x5eced7[_0x7d24('0x31')][_0x7d24('0x37')](_0x7d24('0x4c'))){_0xe82d5a[_0x7d24('0x1b')]=qs[_0x7d24('0x1b')](_0x5eced7[_0x7d24('0x31')][_0x7d24('0x1b')]);_0xe82d5a['offset']=qs[_0x7d24('0x1d')](_0x5eced7[_0x7d24('0x31')][_0x7d24('0x1d')]);}return _0x18f598[_0x7d24('0x49')](_0xe82d5a);}})[_0x7d24('0x23')](function(_0x3da368){if(_0x3da368){return _0x3da368?{'count':_0x1dce1a,'rows':_0x3da368}:null;}})[_0x7d24('0x23')](respondWithResult(_0x212450,null))[_0x7d24('0x40')](handleError(_0x212450,null));};exports['addConfiguration']=function(_0x48ffbe,_0x5c6bc5,_0x1f9f90){if(_0x48ffbe[_0x7d24('0x46')]['id']){delete _0x48ffbe[_0x7d24('0x46')]['id'];}return db['DeskAccount'][_0x7d24('0x4a')]({'where':{'id':_0x48ffbe[_0x7d24('0x42')]['id']}})['then'](handleEntityNotFound(_0x5c6bc5,null))[_0x7d24('0x23')](function(_0x349460){if(_0x349460){_0x48ffbe['body'][_0x7d24('0x4d')]=_0x349460['id'];_0x48ffbe['body']['Subjects']=integrations[_0x7d24('0x4e')](_0x48ffbe[_0x7d24('0x46')][_0x7d24('0x4f')],_0x48ffbe[_0x7d24('0x46')]['type']);_0x48ffbe[_0x7d24('0x46')][_0x7d24('0x50')]=integrations['getDescriptions'](_0x48ffbe[_0x7d24('0x46')][_0x7d24('0x4f')],_0x48ffbe[_0x7d24('0x46')][_0x7d24('0x2f')]);return db[_0x7d24('0x4b')][_0x7d24('0x45')](_0x48ffbe[_0x7d24('0x46')],{'include':[{'model':db[_0x7d24('0x51')],'as':_0x7d24('0x52')},{'model':db[_0x7d24('0x51')],'as':'Descriptions'}]});}return null;})[_0x7d24('0x23')](respondWithResult(_0x5c6bc5,null))[_0x7d24('0x40')](handleError(_0x5c6bc5,null));};exports[_0x7d24('0x53')]=function(_0x3f3645,_0x4ad183,_0x500f80){var _0x101d23=[{'name':_0x7d24('0x54'),'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 _0x4ead29='';return db[_0x7d24('0x2c')][_0x7d24('0x4a')]({'where':{'id':_0x3f3645['params']['id']},'attributes':['id','remoteUri',_0x7d24('0x55'),_0x7d24('0x56'),'password',_0x7d24('0x57'),_0x7d24('0x58'),_0x7d24('0x59'),_0x7d24('0x5a')]})[_0x7d24('0x23')](handleEntityNotFound(_0x4ad183,null))[_0x7d24('0x23')](function(_0x2a4dbb){if(_0x2a4dbb){_0x4ead29=_0x2a4dbb[_0x7d24('0x5b')];var _0x5a86f8=_0x4ead29[_0x7d24('0x5c')](-0x1);if(_0x5a86f8==='/'){_0x4ead29=_0x4ead29['substring'](0x0,_0x4ead29[_0x7d24('0x5d')](_0x5a86f8));}var _0x5370f5={'method':'GET','uri':util[_0x7d24('0x5e')](_0x7d24('0x5f'),_0x4ead29),'headers':{'Content-Type':_0x7d24('0x60'),'Accept':_0x7d24('0x60')},'json':!![]};if(_0x2a4dbb[_0x7d24('0x55')]===_0x7d24('0x61')){_0x5370f5[_0x7d24('0x62')][_0x7d24('0x63')]=util['format']('Basic\x20%s',new Buffer(util['format'](_0x7d24('0x64'),_0x2a4dbb['username'],_0x2a4dbb[_0x7d24('0x65')]))[_0x7d24('0x66')](_0x7d24('0x67')));}return rp(_0x5370f5)[_0x7d24('0x23')](function(_0x20cda0){return _0x101d23[_0x7d24('0x68')](_[_0x7d24('0x2b')](_0x20cda0[_0x7d24('0x69')]['entries'],function(_0x57ad5d){return{'id':_0x57ad5d[_0x7d24('0x28')],'name':_0x57ad5d[_0x7d24('0x28')],'type':_0x57ad5d[_0x7d24('0x2f')],'active':_0x57ad5d['active'],'label':_0x57ad5d['label'],'custom':!![]};}));});}})[_0x7d24('0x23')](function(_0x13c880){return{'count':_0x13c880['length'],'rows':_0x13c880};})[_0x7d24('0x23')](respondWithResult(_0x4ad183,null))[_0x7d24('0x40')](function(_0x42ac35){var _0x5c3ce4=_0x3f3645[_0x7d24('0x31')]['test']?0x1f4:_0x42ac35[_0x7d24('0x6a')]||0x1f4;logger[_0x7d24('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0x7d24('0x53'),_0x5c3ce4,JSON[_0x7d24('0x6b')](_0x42ac35));delete _0x42ac35[_0x7d24('0x28')];if(_0x5c3ce4===0x191){_0x5c3ce4=0x190;}_0x4ad183[_0x7d24('0x19')](_0x5c3ce4)[_0x7d24('0x29')](_0x3f3645[_0x7d24('0x31')][_0x7d24('0x6c')]?{'message':'Wrong\x20credentials','statusCode':_0x42ac35['statusCode']}:_0x42ac35);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index f469ad3..09d5ec5 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 _0x34ad=['../../config/environment','./intDeskAccount.attributes','define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x45096e,_0x17e82d){var _0xba1fa3=function(_0x29f43c){while(--_0x29f43c){_0x45096e['push'](_0x45096e['shift']());}};_0xba1fa3(++_0x17e82d);}(_0x34ad,0x144));var _0xd34a=function(_0x3a0f77,_0x39f605){_0x3a0f77=_0x3a0f77-0x0;var _0x54fd0c=_0x34ad[_0x3a0f77];return _0x54fd0c;};'use strict';var _=require(_0xd34a('0x0'));var util=require(_0xd34a('0x1'));var logger=require(_0xd34a('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd34a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd34a('0x4'));var rimraf=require(_0xd34a('0x5'));var config=require(_0xd34a('0x6'));var attributes=require(_0xd34a('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x4447b5,_0x5a4d48){return _0x4447b5[_0xd34a('0x8')](_0xd34a('0x9'),attributes,{'tableName':_0xd34a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xada9=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','define','DeskAccount','int_desk_accounts','lodash','util'];(function(_0x505744,_0x17f1a5){var _0x5ae88b=function(_0xe71a70){while(--_0xe71a70){_0x505744['push'](_0x505744['shift']());}};_0x5ae88b(++_0x17f1a5);}(_0xada9,0x132));var _0x9ada=function(_0x1c158c,_0x1a763d){_0x1c158c=_0x1c158c-0x0;var _0x4428a3=_0xada9[_0x1c158c];return _0x4428a3;};'use strict';var _=require(_0x9ada('0x0'));var util=require(_0x9ada('0x1'));var logger=require(_0x9ada('0x2'))('api');var moment=require(_0x9ada('0x3'));var BPromise=require(_0x9ada('0x4'));var rp=require(_0x9ada('0x5'));var fs=require('fs');var path=require(_0x9ada('0x6'));var rimraf=require(_0x9ada('0x7'));var config=require(_0x9ada('0x8'));var attributes=require(_0x9ada('0x9'));var integrations=require(_0x9ada('0xa'));module['exports']=function(_0x2d163d,_0x1ad37a){return _0x2d163d[_0x9ada('0xb')](_0x9ada('0xc'),attributes,{'tableName':_0x9ada('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 2083829..b25078c 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 _0xc7dd=['then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','limit','include','map','model','attributes','debug','stringify','ShowDeskAccount','find','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc7dd,0x139));var _0xdc7d=function(_0x4ec119,_0x5e20f7){_0x4ec119=_0x4ec119-0x0;var _0x1f45a9=_0xc7dd[_0x4ec119];return _0x1f45a9;};'use strict';var _=require(_0xdc7d('0x0'));var util=require(_0xdc7d('0x1'));var moment=require(_0xdc7d('0x2'));var BPromise=require('bluebird');var rs=require(_0xdc7d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdc7d('0x4'));var logger=require(_0xdc7d('0x5'))(_0xdc7d('0x6'));var config=require(_0xdc7d('0x7'));var jayson=require(_0xdc7d('0x8'));var client=jayson['client'][_0xdc7d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a0364,_0x3a5b5a,_0x27aca3){return new BPromise(function(_0xe25928,_0x4b2bb4){return client[_0xdc7d('0xa')](_0x2a0364,_0x27aca3)[_0xdc7d('0xb')](function(_0xf5592f){logger[_0xdc7d('0xc')](_0xdc7d('0xd'),_0x3a5b5a,_0xdc7d('0xe'));logger['debug'](_0xdc7d('0xf'),_0x3a5b5a,_0xdc7d('0xe'),JSON['stringify'](_0xf5592f));if(_0xf5592f[_0xdc7d('0x10')]){if(_0xf5592f['error'][_0xdc7d('0x11')]===0x1f4){logger[_0xdc7d('0x10')](_0xdc7d('0xd'),_0x3a5b5a,_0xf5592f[_0xdc7d('0x10')][_0xdc7d('0x12')]);return _0x4b2bb4(_0xf5592f[_0xdc7d('0x10')][_0xdc7d('0x12')]);}logger[_0xdc7d('0x10')](_0xdc7d('0xd'),_0x3a5b5a,_0xf5592f['error'][_0xdc7d('0x12')]);return _0xe25928(_0xf5592f[_0xdc7d('0x10')]['message']);}else{logger['info']('DeskAccount,\x20%s,\x20%s',_0x3a5b5a,_0xdc7d('0xe'));_0xe25928(_0xf5592f[_0xdc7d('0x13')]['message']);}})[_0xdc7d('0x14')](function(_0x1fc4fd){logger[_0xdc7d('0x10')](_0xdc7d('0xd'),_0x3a5b5a,_0x1fc4fd);_0x4b2bb4(_0x1fc4fd);});});}exports[_0xdc7d('0x15')]=function(_0x264dd8){var _0x42f4ed=this;return new Promise(function(_0x3d7137,_0x51046c){return db[_0xdc7d('0x16')][_0xdc7d('0x17')]({'raw':_0x264dd8[_0xdc7d('0x18')]?_0x264dd8[_0xdc7d('0x18')][_0xdc7d('0x19')]===undefined?!![]:![]:!![],'where':_0x264dd8[_0xdc7d('0x18')]?_0x264dd8['options'][_0xdc7d('0x1a')]||null:null,'attributes':_0x264dd8[_0xdc7d('0x18')]?_0x264dd8[_0xdc7d('0x18')]['attributes']||null:null,'limit':_0x264dd8['options']?_0x264dd8[_0xdc7d('0x18')][_0xdc7d('0x1b')]||null:null,'include':_0x264dd8[_0xdc7d('0x18')]?_0x264dd8['options'][_0xdc7d('0x1c')]?_[_0xdc7d('0x1d')](_0x264dd8['options'][_0xdc7d('0x1c')],function(_0x1f28b1){return{'model':db[_0x1f28b1[_0xdc7d('0x1e')]],'as':_0x1f28b1['as'],'attributes':_0x1f28b1[_0xdc7d('0x1f')],'include':_0x1f28b1[_0xdc7d('0x1c')]?_[_0xdc7d('0x1d')](_0x1f28b1[_0xdc7d('0x1c')],function(_0x42d1fc){return{'model':db[_0x42d1fc['model']],'as':_0x42d1fc['as'],'attributes':_0x42d1fc[_0xdc7d('0x1f')],'include':_0x42d1fc[_0xdc7d('0x1c')]?_['map'](_0x42d1fc[_0xdc7d('0x1c')],function(_0x1d1b0f){return{'model':db[_0x1d1b0f[_0xdc7d('0x1e')]],'as':_0x1d1b0f['as'],'attributes':_0x1d1b0f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5aa681){logger['info'](_0xdc7d('0x15'),_0x264dd8);logger[_0xdc7d('0x20')](_0xdc7d('0x15'),_0x264dd8,JSON[_0xdc7d('0x21')](_0x5aa681));_0x3d7137(_0x5aa681);})[_0xdc7d('0x14')](function(_0x5c0d95){logger[_0xdc7d('0x10')](_0xdc7d('0x15'),_0x5c0d95[_0xdc7d('0x12')],_0x264dd8);_0x51046c(_0x42f4ed[_0xdc7d('0x10')](0x1f4,_0x5c0d95[_0xdc7d('0x12')]));});});};exports[_0xdc7d('0x22')]=function(_0x48d973){var _0x56be79=this;return new Promise(function(_0x56d8e7,_0x2e6566){return db['DeskAccount'][_0xdc7d('0x23')]({'raw':_0x48d973[_0xdc7d('0x18')]?_0x48d973[_0xdc7d('0x18')][_0xdc7d('0x19')]===undefined?!![]:![]:!![],'where':_0x48d973[_0xdc7d('0x18')]?_0x48d973[_0xdc7d('0x18')]['where']||null:null,'attributes':_0x48d973[_0xdc7d('0x18')]?_0x48d973['options']['attributes']||null:null,'include':_0x48d973[_0xdc7d('0x18')]?_0x48d973[_0xdc7d('0x18')][_0xdc7d('0x1c')]?_[_0xdc7d('0x1d')](_0x48d973[_0xdc7d('0x18')][_0xdc7d('0x1c')],function(_0x1b1c38){return{'model':db[_0x1b1c38[_0xdc7d('0x1e')]],'as':_0x1b1c38['as'],'attributes':_0x1b1c38['attributes'],'include':_0x1b1c38[_0xdc7d('0x1c')]?_[_0xdc7d('0x1d')](_0x1b1c38['include'],function(_0xf83737){return{'model':db[_0xf83737[_0xdc7d('0x1e')]],'as':_0xf83737['as'],'attributes':_0xf83737[_0xdc7d('0x1f')],'include':_0xf83737[_0xdc7d('0x1c')]?_[_0xdc7d('0x1d')](_0xf83737['include'],function(_0x4576af){return{'model':db[_0x4576af[_0xdc7d('0x1e')]],'as':_0x4576af['as'],'attributes':_0x4576af[_0xdc7d('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xdc7d('0xb')](function(_0x2662d6){logger['info']('ShowDeskAccount',_0x48d973);logger[_0xdc7d('0x20')](_0xdc7d('0x22'),_0x48d973,JSON[_0xdc7d('0x21')](_0x2662d6));_0x56d8e7(_0x2662d6);})['catch'](function(_0x57b819){logger[_0xdc7d('0x10')](_0xdc7d('0x22'),_0x57b819['message'],_0x48d973);_0x2e6566(_0x56be79[_0xdc7d('0x10')](0x1f4,_0x57b819[_0xdc7d('0x12')]));});});}; \ No newline at end of file +var _0x3142=['catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','map','include','model','debug','ShowDeskAccount','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x4eb828,_0x80d55a){var _0x5ddbb3=function(_0xda3cdf){while(--_0xda3cdf){_0x4eb828['push'](_0x4eb828['shift']());}};_0x5ddbb3(++_0x80d55a);}(_0x3142,0x1a5));var _0x2314=function(_0x3a8c1b,_0x5d4e5d){_0x3a8c1b=_0x3a8c1b-0x0;var _0x2f3c39=_0x3142[_0x3a8c1b];return _0x2f3c39;};'use strict';var _=require(_0x2314('0x0'));var util=require('util');var moment=require(_0x2314('0x1'));var BPromise=require(_0x2314('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2314('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2314('0x4'));var logger=require(_0x2314('0x5'))(_0x2314('0x6'));var config=require('../../config/environment');var jayson=require(_0x2314('0x7'));var client=jayson[_0x2314('0x8')][_0x2314('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xc6df2d,_0x33f361,_0x428e61){return new BPromise(function(_0xcf7ef2,_0x552bcc){return client[_0x2314('0xa')](_0xc6df2d,_0x428e61)[_0x2314('0xb')](function(_0x4daf43){logger[_0x2314('0xc')](_0x2314('0xd'),_0x33f361,'request\x20sent');logger['debug'](_0x2314('0xe'),_0x33f361,_0x2314('0xf'),JSON[_0x2314('0x10')](_0x4daf43));if(_0x4daf43[_0x2314('0x11')]){if(_0x4daf43[_0x2314('0x11')][_0x2314('0x12')]===0x1f4){logger[_0x2314('0x11')]('DeskAccount,\x20%s,\x20%s',_0x33f361,_0x4daf43[_0x2314('0x11')]['message']);return _0x552bcc(_0x4daf43[_0x2314('0x11')]['message']);}logger[_0x2314('0x11')](_0x2314('0xd'),_0x33f361,_0x4daf43[_0x2314('0x11')][_0x2314('0x13')]);return _0xcf7ef2(_0x4daf43[_0x2314('0x11')]['message']);}else{logger[_0x2314('0xc')]('DeskAccount,\x20%s,\x20%s',_0x33f361,'request\x20sent');_0xcf7ef2(_0x4daf43[_0x2314('0x14')][_0x2314('0x13')]);}})[_0x2314('0x15')](function(_0x404517){logger[_0x2314('0x11')](_0x2314('0xd'),_0x33f361,_0x404517);_0x552bcc(_0x404517);});});}exports[_0x2314('0x16')]=function(_0x719ee8){var _0x557702=this;return new Promise(function(_0x4bd8e1,_0x229199){return db[_0x2314('0x17')][_0x2314('0x18')]({'raw':_0x719ee8['options']?_0x719ee8[_0x2314('0x19')][_0x2314('0x1a')]===undefined?!![]:![]:!![],'where':_0x719ee8[_0x2314('0x19')]?_0x719ee8[_0x2314('0x19')][_0x2314('0x1b')]||null:null,'attributes':_0x719ee8['options']?_0x719ee8['options'][_0x2314('0x1c')]||null:null,'limit':_0x719ee8['options']?_0x719ee8[_0x2314('0x19')]['limit']||null:null,'include':_0x719ee8['options']?_0x719ee8[_0x2314('0x19')]['include']?_[_0x2314('0x1d')](_0x719ee8['options'][_0x2314('0x1e')],function(_0x52bd47){return{'model':db[_0x52bd47[_0x2314('0x1f')]],'as':_0x52bd47['as'],'attributes':_0x52bd47[_0x2314('0x1c')],'include':_0x52bd47[_0x2314('0x1e')]?_[_0x2314('0x1d')](_0x52bd47['include'],function(_0x5a6b5c){return{'model':db[_0x5a6b5c[_0x2314('0x1f')]],'as':_0x5a6b5c['as'],'attributes':_0x5a6b5c['attributes'],'include':_0x5a6b5c[_0x2314('0x1e')]?_[_0x2314('0x1d')](_0x5a6b5c['include'],function(_0x163acd){return{'model':db[_0x163acd['model']],'as':_0x163acd['as'],'attributes':_0x163acd[_0x2314('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2314('0xb')](function(_0x18fa4e){logger['info'](_0x2314('0x16'),_0x719ee8);logger[_0x2314('0x20')](_0x2314('0x16'),_0x719ee8,JSON[_0x2314('0x10')](_0x18fa4e));_0x4bd8e1(_0x18fa4e);})[_0x2314('0x15')](function(_0x396949){logger[_0x2314('0x11')](_0x2314('0x16'),_0x396949[_0x2314('0x13')],_0x719ee8);_0x229199(_0x557702[_0x2314('0x11')](0x1f4,_0x396949[_0x2314('0x13')]));});});};exports[_0x2314('0x21')]=function(_0x4958b2){var _0x4fbc01=this;return new Promise(function(_0x216dec,_0x4f5114){return db[_0x2314('0x17')]['find']({'raw':_0x4958b2['options']?_0x4958b2[_0x2314('0x19')][_0x2314('0x1a')]===undefined?!![]:![]:!![],'where':_0x4958b2[_0x2314('0x19')]?_0x4958b2[_0x2314('0x19')][_0x2314('0x1b')]||null:null,'attributes':_0x4958b2['options']?_0x4958b2[_0x2314('0x19')][_0x2314('0x1c')]||null:null,'include':_0x4958b2['options']?_0x4958b2[_0x2314('0x19')][_0x2314('0x1e')]?_[_0x2314('0x1d')](_0x4958b2[_0x2314('0x19')][_0x2314('0x1e')],function(_0x25b47e){return{'model':db[_0x25b47e[_0x2314('0x1f')]],'as':_0x25b47e['as'],'attributes':_0x25b47e[_0x2314('0x1c')],'include':_0x25b47e[_0x2314('0x1e')]?_[_0x2314('0x1d')](_0x25b47e['include'],function(_0xcc51cd){return{'model':db[_0xcc51cd[_0x2314('0x1f')]],'as':_0xcc51cd['as'],'attributes':_0xcc51cd[_0x2314('0x1c')],'include':_0xcc51cd[_0x2314('0x1e')]?_[_0x2314('0x1d')](_0xcc51cd[_0x2314('0x1e')],function(_0x4362c2){return{'model':db[_0x4362c2[_0x2314('0x1f')]],'as':_0x4362c2['as'],'attributes':_0x4362c2['attributes']};}):[]};}):[]};}):[]:[]})[_0x2314('0xb')](function(_0x3c754f){logger['info']('ShowDeskAccount',_0x4958b2);logger['debug'](_0x2314('0x21'),_0x4958b2,JSON[_0x2314('0x10')](_0x3c754f));_0x216dec(_0x3c754f);})['catch'](function(_0x3f9d09){logger[_0x2314('0x11')](_0x2314('0x21'),_0x3f9d09[_0x2314('0x13')],_0x4958b2);_0x4f5114(_0x4fbc01[_0x2314('0x11')](0x1f4,_0x3f9d09[_0x2314('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index c87d2a2..3a6e765 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 _0x9c44=['destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDeskConfiguration.controller','isAuthenticated','index','get','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','/:id/tags','post','setTags','put','update'];(function(_0x1dc546,_0x12acd4){var _0x398a57=function(_0x24adac){while(--_0x24adac){_0x1dc546['push'](_0x1dc546['shift']());}};_0x398a57(++_0x12acd4);}(_0x9c44,0x178));var _0x49c4=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x9c44[_0x13e741];return _0x3f8bb3;};'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');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['show']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['get']('/:id/subjects',auth[_0x49c4('0x7')](),controller[_0x49c4('0xd')]);router['get'](_0x49c4('0xe'),auth[_0x49c4('0x7')](),controller['getDescriptions']);router['get'](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller['getTags']);router[_0x49c4('0x10')]('/',auth[_0x49c4('0x7')](),controller['create']);router[_0x49c4('0x10')](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x11')]);router[_0x49c4('0x12')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x13')]);router['delete'](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);module[_0x49c4('0x15')]=router; \ No newline at end of file +var _0x9957=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields'];(function(_0x397d92,_0x109651){var _0xc40251=function(_0x136056){while(--_0x136056){_0x397d92['push'](_0x397d92['shift']());}};_0xc40251(++_0x109651);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/fields',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/descriptions',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/tags',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x17')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller['destroy']);module[_0x7995('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 2450397..f4cdf3c 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 _0xa164=['exports','STRING'];(function(_0x3db0ba,_0x2be65c){var _0x2d8e9a=function(_0x780700){while(--_0x780700){_0x3db0ba['push'](_0x3db0ba['shift']());}};_0x2d8e9a(++_0x2be65c);}(_0xa164,0x154));var _0x4a16=function(_0x50bb05,_0x2567d9){_0x50bb05=_0x50bb05-0x0;var _0x3fa560=_0xa164[_0x50bb05];return _0x3fa560;};'use strict';var Sequelize=require('sequelize');module[_0x4a16('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4a16('0x1')]}}; \ No newline at end of file +var _0xfdfd=['sequelize','exports','STRING'];(function(_0x5130aa,_0x441b77){var _0x125ec6=function(_0x4d3bf2){while(--_0x4d3bf2){_0x5130aa['push'](_0x5130aa['shift']());}};_0x125ec6(++_0x441b77);}(_0xfdfd,0xfc));var _0xdfdf=function(_0x1ab203,_0x156141){_0x1ab203=_0x1ab203-0x0;var _0x1ebe2a=_0xfdfd[_0x1ab203];return _0x1ebe2a;};'use strict';var Sequelize=require(_0xdfdf('0x0'));module[_0xdfdf('0x1')]={'name':{'type':Sequelize[_0xdfdf('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 0e9b5c7..5c900eb 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 _0xadfd=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','end','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','key','query','keys','attributes','intersection','fields','model','hasOwnProperty','nolimit','order','sort','filters','where','merge','VIRTUAL','filter','options','includeAll','DeskConfiguration','findAll','rows','catch','show','params','include','create','body','find','destroy','getFields','findOne','DeskField','length','pick','getSubjects','getDescriptions','getTags','setTags','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','jsforce','querystring','ioredis'];(function(_0x460999,_0x16dbf1){var _0x43876b=function(_0x5dc6f2){while(--_0x5dc6f2){_0x460999['push'](_0x460999['shift']());}};_0x43876b(++_0x16dbf1);}(_0xadfd,0x93));var _0xdadf=function(_0x1a2de1,_0x3569b4){_0x1a2de1=_0x1a2de1-0x0;var _0x201c98=_0xadfd[_0x1a2de1];return _0x201c98;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdadf('0x0'));var zipdir=require(_0xdadf('0x1'));var jsonpatch=require(_0xdadf('0x2'));var rp=require(_0xdadf('0x3'));var moment=require(_0xdadf('0x4'));var BPromise=require(_0xdadf('0x5'));var Mustache=require(_0xdadf('0x6'));var util=require('util');var path=require(_0xdadf('0x7'));var sox=require('sox');var csv=require(_0xdadf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdadf('0x9'));var _=require(_0xdadf('0xa'));var squel=require(_0xdadf('0xb'));var crypto=require('crypto');var jsforce=require(_0xdadf('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xdadf('0x8'));var querystring=require(_0xdadf('0xd'));var Papa=require('papaparse');var Redis=require(_0xdadf('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xdadf('0xf'));var as=require(_0xdadf('0x10'));var hardwareService=require(_0xdadf('0x11'));var logger=require('../../config/logger')(_0xdadf('0x12'));var utils=require(_0xdadf('0x13'));var config=require(_0xdadf('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xdadf('0x15'))['db'];function respondWithStatusCode(_0x610eba,_0x5ef661){_0x5ef661=_0x5ef661||0xcc;return function(_0x2992b1){if(_0x2992b1){return _0x610eba['sendStatus'](_0x5ef661);}return _0x610eba[_0xdadf('0x16')](_0x5ef661)['end']();};}function respondWithResult(_0x3fcb35,_0x54bec8){_0x54bec8=_0x54bec8||0xc8;return function(_0x418ce9){if(_0x418ce9){return _0x3fcb35[_0xdadf('0x16')](_0x54bec8)[_0xdadf('0x17')](_0x418ce9);}};}function respondWithFilteredResult(_0xaa9bbf,_0x378731){return function(_0x33ba87){if(_0x33ba87){var _0x1b17fd=typeof _0x378731[_0xdadf('0x18')]==='undefined'&&typeof _0x378731['limit']===_0xdadf('0x19');var _0x27dea4=_0x33ba87[_0xdadf('0x1a')];var _0x31a5af=_0x1b17fd?0x0:_0x378731[_0xdadf('0x18')];var _0x21a706=_0x1b17fd?_0x33ba87['count']:_0x378731['offset']+_0x378731[_0xdadf('0x1b')];var _0x58dc56;if(_0x21a706>=_0x27dea4){_0x21a706=_0x27dea4;_0x58dc56=0xc8;}else{_0x58dc56=0xce;}_0xaa9bbf['status'](_0x58dc56);return _0xaa9bbf[_0xdadf('0x1c')]('Content-Range',_0x31a5af+'-'+_0x21a706+'/'+_0x27dea4)[_0xdadf('0x17')](_0x33ba87);}return null;};}function patchUpdates(_0x18be6){return function(_0x5bfe43){try{jsonpatch[_0xdadf('0x1d')](_0x5bfe43,_0x18be6,!![]);}catch(_0x574c1d){return BPromise[_0xdadf('0x1e')](_0x574c1d);}return _0x5bfe43[_0xdadf('0x1f')]();};}function saveUpdates(_0x5965fa,_0x125f8a){return function(_0x124422){if(_0x124422){return _0x124422[_0xdadf('0x20')](_0x5965fa)['then'](function(_0x3dd432){return _0x3dd432;});}return null;};}function removeEntity(_0x545ac0,_0x168c99){return function(_0x528f66){if(_0x528f66){return _0x528f66['destroy']()[_0xdadf('0x21')](function(){_0x545ac0[_0xdadf('0x16')](0xcc)[_0xdadf('0x22')]();});}};}function handleEntityNotFound(_0x4f3a15,_0x464d24){return function(_0xe210bf){if(!_0xe210bf){_0x4f3a15[_0xdadf('0x23')](0x194);}return _0xe210bf;};}function handleError(_0x356c0b,_0x2c9ae7){_0x2c9ae7=_0x2c9ae7||0x1f4;return function(_0x3fc89f){logger[_0xdadf('0x24')](_0x3fc89f[_0xdadf('0x25')]);if(_0x3fc89f[_0xdadf('0x26')]){delete _0x3fc89f[_0xdadf('0x26')];}_0x356c0b[_0xdadf('0x16')](_0x2c9ae7)['send'](_0x3fc89f);};}exports[_0xdadf('0x27')]=function(_0x53f607,_0x1dea0c){var _0x4742be={},_0x3b3af3={},_0x1df02c={'count':0x0,'rows':[]};var _0x2901dc=_[_0xdadf('0x28')](db['DeskConfiguration'][_0xdadf('0x29')],function(_0x1d1e4b){return{'name':_0x1d1e4b[_0xdadf('0x2a')],'type':_0x1d1e4b['type'][_0xdadf('0x2b')]};});_0x3b3af3['model']=_['map'](_0x2901dc,'name');_0x3b3af3[_0xdadf('0x2c')]=_[_0xdadf('0x2d')](_0x53f607[_0xdadf('0x2c')]);_0x3b3af3['filters']=_['intersection'](_0x3b3af3['model'],_0x3b3af3[_0xdadf('0x2c')]);_0x4742be[_0xdadf('0x2e')]=_[_0xdadf('0x2f')](_0x3b3af3['model'],qs[_0xdadf('0x30')](_0x53f607[_0xdadf('0x2c')][_0xdadf('0x30')]));_0x4742be[_0xdadf('0x2e')]=_0x4742be[_0xdadf('0x2e')]['length']?_0x4742be[_0xdadf('0x2e')]:_0x3b3af3[_0xdadf('0x31')];if(!_0x53f607[_0xdadf('0x2c')][_0xdadf('0x32')](_0xdadf('0x33'))){_0x4742be[_0xdadf('0x1b')]=qs[_0xdadf('0x1b')](_0x53f607[_0xdadf('0x2c')][_0xdadf('0x1b')]);_0x4742be['offset']=qs['offset'](_0x53f607['query'][_0xdadf('0x18')]);}_0x4742be[_0xdadf('0x34')]=qs[_0xdadf('0x35')](_0x53f607['query'][_0xdadf('0x35')]);_0x4742be['where']=qs['filters'](_['pick'](_0x53f607[_0xdadf('0x2c')],_0x3b3af3[_0xdadf('0x36')]),_0x2901dc);if(_0x53f607[_0xdadf('0x2c')]['filter']){_0x4742be[_0xdadf('0x37')]=_[_0xdadf('0x38')](_0x4742be['where'],{'$or':_['map'](_0x2901dc,function(_0x31cb50){if(_0x31cb50['type']!==_0xdadf('0x39')){var _0x5c0b33={};_0x5c0b33[_0x31cb50[_0xdadf('0x26')]]={'$like':'%'+_0x53f607['query'][_0xdadf('0x3a')]+'%'};return _0x5c0b33;}})});}_0x4742be=_[_0xdadf('0x38')]({},_0x4742be,_0x53f607[_0xdadf('0x3b')]);var _0x29fb72={'where':_0x4742be[_0xdadf('0x37')]};return db['DeskConfiguration']['count'](_0x29fb72)[_0xdadf('0x21')](function(_0x516473){_0x1df02c[_0xdadf('0x1a')]=_0x516473;if(_0x53f607['query'][_0xdadf('0x3c')]){_0x4742be['include']=[{'all':!![]}];}return db[_0xdadf('0x3d')][_0xdadf('0x3e')](_0x4742be);})[_0xdadf('0x21')](function(_0x55073f){_0x1df02c[_0xdadf('0x3f')]=_0x55073f;return _0x1df02c;})['then'](respondWithFilteredResult(_0x1dea0c,_0x4742be))[_0xdadf('0x40')](handleError(_0x1dea0c,null));};exports[_0xdadf('0x41')]=function(_0x33efdf,_0x114089){var _0x17bdda={'raw':![],'where':{'id':_0x33efdf[_0xdadf('0x42')]['id']}},_0x26b19d={};_0x26b19d[_0xdadf('0x31')]=_[_0xdadf('0x2d')](db['DeskConfiguration'][_0xdadf('0x29')]);_0x26b19d[_0xdadf('0x2c')]=_[_0xdadf('0x2d')](_0x33efdf[_0xdadf('0x2c')]);_0x26b19d['filters']=_[_0xdadf('0x2f')](_0x26b19d[_0xdadf('0x31')],_0x26b19d[_0xdadf('0x2c')]);_0x17bdda['attributes']=_['intersection'](_0x26b19d[_0xdadf('0x31')],qs['fields'](_0x33efdf[_0xdadf('0x2c')][_0xdadf('0x30')]));_0x17bdda[_0xdadf('0x2e')]=_0x17bdda['attributes']['length']?_0x17bdda['attributes']:_0x26b19d[_0xdadf('0x31')];if(_0x33efdf[_0xdadf('0x2c')]['includeAll']){_0x17bdda[_0xdadf('0x43')]=[{'all':!![]}];}_0x17bdda=_[_0xdadf('0x38')]({},_0x17bdda,_0x33efdf[_0xdadf('0x3b')]);return db[_0xdadf('0x3d')]['find'](_0x17bdda)[_0xdadf('0x21')](handleEntityNotFound(_0x114089,null))['then'](respondWithResult(_0x114089,null))[_0xdadf('0x40')](handleError(_0x114089,null));};exports['create']=function(_0x2c9410,_0x3b735e){return db['DeskConfiguration'][_0xdadf('0x44')](_0x2c9410[_0xdadf('0x45')],{})['then'](respondWithResult(_0x3b735e,0xc9))['catch'](handleError(_0x3b735e,null));};exports[_0xdadf('0x20')]=function(_0x46939e,_0x23f18c){if(_0x46939e[_0xdadf('0x45')]['id']){delete _0x46939e[_0xdadf('0x45')]['id'];}return db[_0xdadf('0x3d')][_0xdadf('0x46')]({'where':{'id':_0x46939e[_0xdadf('0x42')]['id']}})[_0xdadf('0x21')](handleEntityNotFound(_0x23f18c,null))[_0xdadf('0x21')](saveUpdates(_0x46939e[_0xdadf('0x45')],null))[_0xdadf('0x21')](respondWithResult(_0x23f18c,null))[_0xdadf('0x40')](handleError(_0x23f18c,null));};exports[_0xdadf('0x47')]=function(_0x8a4a6c,_0x58beb8){return db[_0xdadf('0x3d')][_0xdadf('0x46')]({'where':{'id':_0x8a4a6c[_0xdadf('0x42')]['id']}})[_0xdadf('0x21')](handleEntityNotFound(_0x58beb8,null))[_0xdadf('0x21')](removeEntity(_0x58beb8,null))[_0xdadf('0x40')](handleError(_0x58beb8,null));};exports[_0xdadf('0x48')]=function(_0x1a5749,_0x569bda,_0x36546b){var _0x2ab903={};var _0x37039e={};var _0x5b6851;var _0x316f21;return db[_0xdadf('0x3d')][_0xdadf('0x49')]({'where':{'id':_0x1a5749['params']['id']}})[_0xdadf('0x21')](handleEntityNotFound(_0x569bda,null))[_0xdadf('0x21')](function(_0x1173f6){if(_0x1173f6){_0x5b6851=_0x1173f6;_0x37039e[_0xdadf('0x31')]=_[_0xdadf('0x2d')](db[_0xdadf('0x4a')][_0xdadf('0x29')]);_0x37039e[_0xdadf('0x2c')]=_['keys'](_0x1a5749[_0xdadf('0x2c')]);_0x37039e[_0xdadf('0x36')]=_['intersection'](_0x37039e[_0xdadf('0x31')],_0x37039e[_0xdadf('0x2c')]);_0x2ab903[_0xdadf('0x2e')]=_[_0xdadf('0x2f')](_0x37039e[_0xdadf('0x31')],qs['fields'](_0x1a5749[_0xdadf('0x2c')]['fields']));_0x2ab903['attributes']=_0x2ab903[_0xdadf('0x2e')][_0xdadf('0x4b')]?_0x2ab903[_0xdadf('0x2e')]:_0x37039e[_0xdadf('0x31')];_0x2ab903[_0xdadf('0x34')]=qs[_0xdadf('0x35')](_0x1a5749[_0xdadf('0x2c')][_0xdadf('0x35')]);_0x2ab903['where']=qs[_0xdadf('0x36')](_[_0xdadf('0x4c')](_0x1a5749['query'],_0x37039e[_0xdadf('0x36')]));if(_0x1a5749[_0xdadf('0x2c')][_0xdadf('0x3a')]){_0x2ab903[_0xdadf('0x37')]=_['merge'](_0x2ab903[_0xdadf('0x37')],{'$or':_['map'](_0x2ab903[_0xdadf('0x2e')],function(_0x10d02b){var _0x154ced={};_0x154ced[_0x10d02b]={'$like':'%'+_0x1a5749[_0xdadf('0x2c')]['filter']+'%'};return _0x154ced;})});}_0x2ab903=_[_0xdadf('0x38')]({},_0x2ab903,_0x1a5749[_0xdadf('0x3b')]);return _0x5b6851['getFields'](_0x2ab903);}})[_0xdadf('0x21')](function(_0x4b9ddb){if(_0x4b9ddb){_0x316f21=_0x4b9ddb['length'];if(!_0x1a5749[_0xdadf('0x2c')][_0xdadf('0x32')](_0xdadf('0x33'))){_0x2ab903[_0xdadf('0x1b')]=qs[_0xdadf('0x1b')](_0x1a5749['query'][_0xdadf('0x1b')]);_0x2ab903['offset']=qs[_0xdadf('0x18')](_0x1a5749[_0xdadf('0x2c')][_0xdadf('0x18')]);}return _0x5b6851[_0xdadf('0x48')](_0x2ab903);}})[_0xdadf('0x21')](function(_0x3f9b20){if(_0x3f9b20){return _0x3f9b20?{'count':_0x316f21,'rows':_0x3f9b20}:null;}})[_0xdadf('0x21')](respondWithResult(_0x569bda,null))[_0xdadf('0x40')](handleError(_0x569bda,null));};exports[_0xdadf('0x4d')]=function(_0x41da28,_0x3ef74c,_0x4cc31e){var _0x53795e={};var _0x58830f={};var _0x328dc8;var _0x2e1ad2;return db[_0xdadf('0x3d')][_0xdadf('0x49')]({'where':{'id':_0x41da28[_0xdadf('0x42')]['id']}})[_0xdadf('0x21')](handleEntityNotFound(_0x3ef74c,null))['then'](function(_0x40711e){if(_0x40711e){_0x328dc8=_0x40711e;_0x58830f['model']=_[_0xdadf('0x2d')](db[_0xdadf('0x4a')][_0xdadf('0x29')]);_0x58830f['query']=_['keys'](_0x41da28[_0xdadf('0x2c')]);_0x58830f[_0xdadf('0x36')]=_[_0xdadf('0x2f')](_0x58830f['model'],_0x58830f['query']);_0x53795e[_0xdadf('0x2e')]=_[_0xdadf('0x2f')](_0x58830f[_0xdadf('0x31')],qs[_0xdadf('0x30')](_0x41da28[_0xdadf('0x2c')]['fields']));_0x53795e['attributes']=_0x53795e[_0xdadf('0x2e')][_0xdadf('0x4b')]?_0x53795e['attributes']:_0x58830f[_0xdadf('0x31')];_0x53795e[_0xdadf('0x34')]=qs['sort'](_0x41da28[_0xdadf('0x2c')][_0xdadf('0x35')]);_0x53795e[_0xdadf('0x37')]=qs[_0xdadf('0x36')](_['pick'](_0x41da28[_0xdadf('0x2c')],_0x58830f[_0xdadf('0x36')]));if(_0x41da28[_0xdadf('0x2c')][_0xdadf('0x3a')]){_0x53795e[_0xdadf('0x37')]=_[_0xdadf('0x38')](_0x53795e[_0xdadf('0x37')],{'$or':_['map'](_0x53795e['attributes'],function(_0x26ab05){var _0x48e376={};_0x48e376[_0x26ab05]={'$like':'%'+_0x41da28['query'][_0xdadf('0x3a')]+'%'};return _0x48e376;})});}_0x53795e=_[_0xdadf('0x38')]({},_0x53795e,_0x41da28[_0xdadf('0x3b')]);return _0x328dc8[_0xdadf('0x4d')](_0x53795e);}})[_0xdadf('0x21')](function(_0x2f12e2){if(_0x2f12e2){_0x2e1ad2=_0x2f12e2[_0xdadf('0x4b')];if(!_0x41da28[_0xdadf('0x2c')]['hasOwnProperty'](_0xdadf('0x33'))){_0x53795e[_0xdadf('0x1b')]=qs[_0xdadf('0x1b')](_0x41da28['query']['limit']);_0x53795e['offset']=qs[_0xdadf('0x18')](_0x41da28[_0xdadf('0x2c')]['offset']);}return _0x328dc8['getSubjects'](_0x53795e);}})[_0xdadf('0x21')](function(_0x279333){if(_0x279333){return _0x279333?{'count':_0x2e1ad2,'rows':_0x279333}:null;}})[_0xdadf('0x21')](respondWithResult(_0x3ef74c,null))[_0xdadf('0x40')](handleError(_0x3ef74c,null));};exports[_0xdadf('0x4e')]=function(_0x4d33f2,_0x407e4c,_0x51e006){var _0x577a94={};var _0x874060={};var _0xc2834c;var _0x521c72;return db[_0xdadf('0x3d')][_0xdadf('0x49')]({'where':{'id':_0x4d33f2[_0xdadf('0x42')]['id']}})[_0xdadf('0x21')](handleEntityNotFound(_0x407e4c,null))[_0xdadf('0x21')](function(_0x5158b7){if(_0x5158b7){_0xc2834c=_0x5158b7;_0x874060['model']=_['keys'](db[_0xdadf('0x4a')][_0xdadf('0x29')]);_0x874060['query']=_[_0xdadf('0x2d')](_0x4d33f2[_0xdadf('0x2c')]);_0x874060[_0xdadf('0x36')]=_['intersection'](_0x874060[_0xdadf('0x31')],_0x874060[_0xdadf('0x2c')]);_0x577a94['attributes']=_[_0xdadf('0x2f')](_0x874060[_0xdadf('0x31')],qs[_0xdadf('0x30')](_0x4d33f2[_0xdadf('0x2c')][_0xdadf('0x30')]));_0x577a94[_0xdadf('0x2e')]=_0x577a94[_0xdadf('0x2e')][_0xdadf('0x4b')]?_0x577a94[_0xdadf('0x2e')]:_0x874060['model'];_0x577a94['order']=qs[_0xdadf('0x35')](_0x4d33f2[_0xdadf('0x2c')][_0xdadf('0x35')]);_0x577a94['where']=qs['filters'](_[_0xdadf('0x4c')](_0x4d33f2[_0xdadf('0x2c')],_0x874060[_0xdadf('0x36')]));if(_0x4d33f2['query'][_0xdadf('0x3a')]){_0x577a94[_0xdadf('0x37')]=_[_0xdadf('0x38')](_0x577a94[_0xdadf('0x37')],{'$or':_['map'](_0x577a94[_0xdadf('0x2e')],function(_0xfd3eac){var _0x2dc279={};_0x2dc279[_0xfd3eac]={'$like':'%'+_0x4d33f2[_0xdadf('0x2c')][_0xdadf('0x3a')]+'%'};return _0x2dc279;})});}_0x577a94=_[_0xdadf('0x38')]({},_0x577a94,_0x4d33f2[_0xdadf('0x3b')]);return _0xc2834c[_0xdadf('0x4e')](_0x577a94);}})[_0xdadf('0x21')](function(_0x901227){if(_0x901227){_0x521c72=_0x901227['length'];if(!_0x4d33f2['query'][_0xdadf('0x32')]('nolimit')){_0x577a94[_0xdadf('0x1b')]=qs[_0xdadf('0x1b')](_0x4d33f2[_0xdadf('0x2c')][_0xdadf('0x1b')]);_0x577a94[_0xdadf('0x18')]=qs[_0xdadf('0x18')](_0x4d33f2[_0xdadf('0x2c')]['offset']);}return _0xc2834c[_0xdadf('0x4e')](_0x577a94);}})[_0xdadf('0x21')](function(_0x2d2a4d){if(_0x2d2a4d){return _0x2d2a4d?{'count':_0x521c72,'rows':_0x2d2a4d}:null;}})[_0xdadf('0x21')](respondWithResult(_0x407e4c,null))[_0xdadf('0x40')](handleError(_0x407e4c,null));};exports[_0xdadf('0x4f')]=function(_0x421079,_0x574f60,_0x28b26d){var _0x66011={};var _0x162002={};var _0x56cafe;var _0x36d5bb;return db[_0xdadf('0x3d')][_0xdadf('0x49')]({'where':{'id':_0x421079[_0xdadf('0x42')]['id']}})['then'](handleEntityNotFound(_0x574f60,null))['then'](function(_0x56e644){if(_0x56e644){_0x56cafe=_0x56e644;_0x162002[_0xdadf('0x31')]=_[_0xdadf('0x2d')](db['Tag'][_0xdadf('0x29')]);_0x162002[_0xdadf('0x2c')]=_[_0xdadf('0x2d')](_0x421079[_0xdadf('0x2c')]);_0x162002[_0xdadf('0x36')]=_[_0xdadf('0x2f')](_0x162002['model'],_0x162002['query']);_0x66011[_0xdadf('0x2e')]=_[_0xdadf('0x2f')](_0x162002[_0xdadf('0x31')],qs[_0xdadf('0x30')](_0x421079['query']['fields']));_0x66011['attributes']=_0x66011['attributes'][_0xdadf('0x4b')]?_0x66011[_0xdadf('0x2e')]:_0x162002[_0xdadf('0x31')];_0x66011[_0xdadf('0x34')]=qs[_0xdadf('0x35')](_0x421079[_0xdadf('0x2c')][_0xdadf('0x35')]);_0x66011[_0xdadf('0x37')]=qs[_0xdadf('0x36')](_[_0xdadf('0x4c')](_0x421079[_0xdadf('0x2c')],_0x162002[_0xdadf('0x36')]));if(_0x421079[_0xdadf('0x2c')][_0xdadf('0x3a')]){_0x66011[_0xdadf('0x37')]=_[_0xdadf('0x38')](_0x66011['where'],{'$or':_[_0xdadf('0x28')](_0x66011['attributes'],function(_0x37e586){var _0x27abc8={};_0x27abc8[_0x37e586]={'$like':'%'+_0x421079[_0xdadf('0x2c')][_0xdadf('0x3a')]+'%'};return _0x27abc8;})});}_0x66011=_[_0xdadf('0x38')]({},_0x66011,_0x421079[_0xdadf('0x3b')]);return _0x56cafe[_0xdadf('0x4f')](_0x66011);}})['then'](function(_0x2763b6){if(_0x2763b6){_0x36d5bb=_0x2763b6['length'];if(!_0x421079[_0xdadf('0x2c')][_0xdadf('0x32')](_0xdadf('0x33'))){_0x66011[_0xdadf('0x1b')]=qs[_0xdadf('0x1b')](_0x421079['query'][_0xdadf('0x1b')]);_0x66011[_0xdadf('0x18')]=qs[_0xdadf('0x18')](_0x421079[_0xdadf('0x2c')][_0xdadf('0x18')]);}return _0x56cafe[_0xdadf('0x4f')](_0x66011);}})[_0xdadf('0x21')](function(_0x4fa606){if(_0x4fa606){return _0x4fa606?{'count':_0x36d5bb,'rows':_0x4fa606}:null;}})[_0xdadf('0x21')](respondWithResult(_0x574f60,null))[_0xdadf('0x40')](handleError(_0x574f60,null));};exports['setTags']=function(_0x5cf597,_0x40e6fe,_0x2e5841){if(_0x5cf597[_0xdadf('0x45')]['id']){delete _0x5cf597[_0xdadf('0x45')]['id'];}return db['DeskConfiguration'][_0xdadf('0x49')]({'where':{'id':_0x5cf597['params']['id']}})['then'](handleEntityNotFound(_0x40e6fe,null))[_0xdadf('0x21')](function(_0x168a3c){if(_0x168a3c){return _0x168a3c[_0xdadf('0x50')](_0x5cf597[_0xdadf('0x45')]['ids']||[]);}return null;})['then'](respondWithResult(_0x40e6fe,null))[_0xdadf('0x40')](handleError(_0x40e6fe,null));}; \ No newline at end of file +var _0xa4c8=['findAll','rows','catch','show','params','length','find','create','update','body','destroy','getFields','getSubjects','findOne','DeskField','hasOwnProperty','getDescriptions','getTags','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include'];(function(_0x67d2b,_0xc3be07){var _0x23e7c1=function(_0x290c5e){while(--_0x290c5e){_0x67d2b['push'](_0x67d2b['shift']());}};_0x23e7c1(++_0xc3be07);}(_0xa4c8,0x1b3));var _0x8a4c=function(_0x4ad937,_0x3b1001){_0x4ad937=_0x4ad937-0x0;var _0x360227=_0xa4c8[_0x4ad937];return _0x360227;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8a4c('0x0'));var zipdir=require(_0x8a4c('0x1'));var jsonpatch=require(_0x8a4c('0x2'));var rp=require(_0x8a4c('0x3'));var moment=require(_0x8a4c('0x4'));var BPromise=require(_0x8a4c('0x5'));var Mustache=require(_0x8a4c('0x6'));var util=require(_0x8a4c('0x7'));var path=require(_0x8a4c('0x8'));var sox=require('sox');var csv=require(_0x8a4c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8a4c('0xa'));var squel=require('squel');var crypto=require(_0x8a4c('0xb'));var jsforce=require(_0x8a4c('0xc'));var deskjs=require(_0x8a4c('0xd'));var toCsv=require(_0x8a4c('0x9'));var querystring=require(_0x8a4c('0xe'));var Papa=require(_0x8a4c('0xf'));var Redis=require(_0x8a4c('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8a4c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8a4c('0x12'))(_0x8a4c('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8a4c('0x14'))['db'];function respondWithStatusCode(_0x303d14,_0x39348f){_0x39348f=_0x39348f||0xcc;return function(_0x106ea3){if(_0x106ea3){return _0x303d14[_0x8a4c('0x15')](_0x39348f);}return _0x303d14[_0x8a4c('0x16')](_0x39348f)[_0x8a4c('0x17')]();};}function respondWithResult(_0x3996ff,_0x499d3d){_0x499d3d=_0x499d3d||0xc8;return function(_0x2ea960){if(_0x2ea960){return _0x3996ff[_0x8a4c('0x16')](_0x499d3d)[_0x8a4c('0x18')](_0x2ea960);}};}function respondWithFilteredResult(_0x4acf61,_0x1ebf52){return function(_0x32748b){if(_0x32748b){var _0x7754da=typeof _0x1ebf52[_0x8a4c('0x19')]===_0x8a4c('0x1a')&&typeof _0x1ebf52[_0x8a4c('0x1b')]===_0x8a4c('0x1a');var _0x427680=_0x32748b[_0x8a4c('0x1c')];var _0x254f64=_0x7754da?0x0:_0x1ebf52[_0x8a4c('0x19')];var _0x327f65=_0x7754da?_0x32748b[_0x8a4c('0x1c')]:_0x1ebf52[_0x8a4c('0x19')]+_0x1ebf52[_0x8a4c('0x1b')];var _0x3e8c4f;if(_0x327f65>=_0x427680){_0x327f65=_0x427680;_0x3e8c4f=0xc8;}else{_0x3e8c4f=0xce;}_0x4acf61[_0x8a4c('0x16')](_0x3e8c4f);return _0x4acf61[_0x8a4c('0x1d')](_0x8a4c('0x1e'),_0x254f64+'-'+_0x327f65+'/'+_0x427680)[_0x8a4c('0x18')](_0x32748b);}return null;};}function patchUpdates(_0x44d8a6){return function(_0x30c609){try{jsonpatch[_0x8a4c('0x1f')](_0x30c609,_0x44d8a6,!![]);}catch(_0x169e80){return BPromise[_0x8a4c('0x20')](_0x169e80);}return _0x30c609[_0x8a4c('0x21')]();};}function saveUpdates(_0xf7eb65,_0x1367ca){return function(_0x599cee){if(_0x599cee){return _0x599cee['update'](_0xf7eb65)[_0x8a4c('0x22')](function(_0x58ce09){return _0x58ce09;});}return null;};}function removeEntity(_0x40df03,_0x11ef64){return function(_0x26cfaa){if(_0x26cfaa){return _0x26cfaa['destroy']()[_0x8a4c('0x22')](function(){_0x40df03[_0x8a4c('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22c84b,_0x2122e2){return function(_0x402547){if(!_0x402547){_0x22c84b['sendStatus'](0x194);}return _0x402547;};}function handleError(_0x36931c,_0x1f7b9a){_0x1f7b9a=_0x1f7b9a||0x1f4;return function(_0x4a218e){logger[_0x8a4c('0x23')](_0x4a218e['stack']);if(_0x4a218e['name']){delete _0x4a218e[_0x8a4c('0x24')];}_0x36931c[_0x8a4c('0x16')](_0x1f7b9a)[_0x8a4c('0x25')](_0x4a218e);};}exports[_0x8a4c('0x26')]=function(_0x39e039,_0x597b23){var _0x3cd626={},_0x2a220d={},_0x3b6d1f={'count':0x0,'rows':[]};var _0x221cd4=_[_0x8a4c('0x27')](db[_0x8a4c('0x28')][_0x8a4c('0x29')],function(_0x56099d){return{'name':_0x56099d[_0x8a4c('0x2a')],'type':_0x56099d[_0x8a4c('0x2b')][_0x8a4c('0x2c')]};});_0x2a220d[_0x8a4c('0x2d')]=_[_0x8a4c('0x27')](_0x221cd4,'name');_0x2a220d[_0x8a4c('0x2e')]=_[_0x8a4c('0x2f')](_0x39e039[_0x8a4c('0x2e')]);_0x2a220d[_0x8a4c('0x30')]=_[_0x8a4c('0x31')](_0x2a220d[_0x8a4c('0x2d')],_0x2a220d[_0x8a4c('0x2e')]);_0x3cd626[_0x8a4c('0x32')]=_['intersection'](_0x2a220d['model'],qs[_0x8a4c('0x33')](_0x39e039[_0x8a4c('0x2e')]['fields']));_0x3cd626['attributes']=_0x3cd626['attributes']['length']?_0x3cd626[_0x8a4c('0x32')]:_0x2a220d[_0x8a4c('0x2d')];if(!_0x39e039['query']['hasOwnProperty'](_0x8a4c('0x34'))){_0x3cd626[_0x8a4c('0x1b')]=qs['limit'](_0x39e039[_0x8a4c('0x2e')][_0x8a4c('0x1b')]);_0x3cd626[_0x8a4c('0x19')]=qs[_0x8a4c('0x19')](_0x39e039[_0x8a4c('0x2e')][_0x8a4c('0x19')]);}_0x3cd626[_0x8a4c('0x35')]=qs['sort'](_0x39e039['query'][_0x8a4c('0x36')]);_0x3cd626[_0x8a4c('0x37')]=qs[_0x8a4c('0x30')](_[_0x8a4c('0x38')](_0x39e039['query'],_0x2a220d['filters']),_0x221cd4);if(_0x39e039[_0x8a4c('0x2e')][_0x8a4c('0x39')]){_0x3cd626[_0x8a4c('0x37')]=_[_0x8a4c('0x3a')](_0x3cd626[_0x8a4c('0x37')],{'$or':_[_0x8a4c('0x27')](_0x221cd4,function(_0x248bcf){if(_0x248bcf[_0x8a4c('0x2b')]!==_0x8a4c('0x3b')){var _0x33cb4d={};_0x33cb4d[_0x248bcf[_0x8a4c('0x24')]]={'$like':'%'+_0x39e039['query']['filter']+'%'};return _0x33cb4d;}})});}_0x3cd626=_['merge']({},_0x3cd626,_0x39e039[_0x8a4c('0x3c')]);var _0x5a0dfa={'where':_0x3cd626[_0x8a4c('0x37')]};return db[_0x8a4c('0x28')]['count'](_0x5a0dfa)[_0x8a4c('0x22')](function(_0x19c481){_0x3b6d1f[_0x8a4c('0x1c')]=_0x19c481;if(_0x39e039[_0x8a4c('0x2e')][_0x8a4c('0x3d')]){_0x3cd626[_0x8a4c('0x3e')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x8a4c('0x3f')](_0x3cd626);})[_0x8a4c('0x22')](function(_0x5e29aa){_0x3b6d1f[_0x8a4c('0x40')]=_0x5e29aa;return _0x3b6d1f;})[_0x8a4c('0x22')](respondWithFilteredResult(_0x597b23,_0x3cd626))[_0x8a4c('0x41')](handleError(_0x597b23,null));};exports[_0x8a4c('0x42')]=function(_0x9792bd,_0x5af459){var _0x162dc7={'raw':![],'where':{'id':_0x9792bd[_0x8a4c('0x43')]['id']}},_0x38f8c4={};_0x38f8c4['model']=_[_0x8a4c('0x2f')](db[_0x8a4c('0x28')][_0x8a4c('0x29')]);_0x38f8c4[_0x8a4c('0x2e')]=_[_0x8a4c('0x2f')](_0x9792bd[_0x8a4c('0x2e')]);_0x38f8c4[_0x8a4c('0x30')]=_['intersection'](_0x38f8c4[_0x8a4c('0x2d')],_0x38f8c4[_0x8a4c('0x2e')]);_0x162dc7['attributes']=_['intersection'](_0x38f8c4[_0x8a4c('0x2d')],qs[_0x8a4c('0x33')](_0x9792bd[_0x8a4c('0x2e')][_0x8a4c('0x33')]));_0x162dc7[_0x8a4c('0x32')]=_0x162dc7[_0x8a4c('0x32')][_0x8a4c('0x44')]?_0x162dc7[_0x8a4c('0x32')]:_0x38f8c4['model'];if(_0x9792bd['query'][_0x8a4c('0x3d')]){_0x162dc7['include']=[{'all':!![]}];}_0x162dc7=_[_0x8a4c('0x3a')]({},_0x162dc7,_0x9792bd['options']);return db[_0x8a4c('0x28')][_0x8a4c('0x45')](_0x162dc7)[_0x8a4c('0x22')](handleEntityNotFound(_0x5af459,null))[_0x8a4c('0x22')](respondWithResult(_0x5af459,null))['catch'](handleError(_0x5af459,null));};exports['create']=function(_0x1336c2,_0x2358d5){return db[_0x8a4c('0x28')][_0x8a4c('0x46')](_0x1336c2['body'],{})[_0x8a4c('0x22')](respondWithResult(_0x2358d5,0xc9))[_0x8a4c('0x41')](handleError(_0x2358d5,null));};exports[_0x8a4c('0x47')]=function(_0x5c7607,_0x2cef56){if(_0x5c7607[_0x8a4c('0x48')]['id']){delete _0x5c7607['body']['id'];}return db[_0x8a4c('0x28')][_0x8a4c('0x45')]({'where':{'id':_0x5c7607[_0x8a4c('0x43')]['id']}})[_0x8a4c('0x22')](handleEntityNotFound(_0x2cef56,null))[_0x8a4c('0x22')](saveUpdates(_0x5c7607[_0x8a4c('0x48')],null))['then'](respondWithResult(_0x2cef56,null))['catch'](handleError(_0x2cef56,null));};exports[_0x8a4c('0x49')]=function(_0x115ea8,_0x2d066b){return db['DeskConfiguration'][_0x8a4c('0x45')]({'where':{'id':_0x115ea8[_0x8a4c('0x43')]['id']}})[_0x8a4c('0x22')](handleEntityNotFound(_0x2d066b,null))['then'](removeEntity(_0x2d066b,null))['catch'](handleError(_0x2d066b,null));};exports[_0x8a4c('0x4a')]=function(_0x837690,_0x5dab9b,_0x4dec98){var _0x1eac28={};var _0x24cde1={};var _0x3a8b0b;var _0x1caec4;return db['DeskConfiguration']['findOne']({'where':{'id':_0x837690[_0x8a4c('0x43')]['id']}})[_0x8a4c('0x22')](handleEntityNotFound(_0x5dab9b,null))[_0x8a4c('0x22')](function(_0x412a3c){if(_0x412a3c){_0x3a8b0b=_0x412a3c;_0x24cde1[_0x8a4c('0x2d')]=_[_0x8a4c('0x2f')](db['DeskField'][_0x8a4c('0x29')]);_0x24cde1[_0x8a4c('0x2e')]=_[_0x8a4c('0x2f')](_0x837690[_0x8a4c('0x2e')]);_0x24cde1['filters']=_[_0x8a4c('0x31')](_0x24cde1['model'],_0x24cde1[_0x8a4c('0x2e')]);_0x1eac28[_0x8a4c('0x32')]=_[_0x8a4c('0x31')](_0x24cde1[_0x8a4c('0x2d')],qs[_0x8a4c('0x33')](_0x837690[_0x8a4c('0x2e')][_0x8a4c('0x33')]));_0x1eac28[_0x8a4c('0x32')]=_0x1eac28[_0x8a4c('0x32')][_0x8a4c('0x44')]?_0x1eac28['attributes']:_0x24cde1['model'];_0x1eac28[_0x8a4c('0x35')]=qs['sort'](_0x837690[_0x8a4c('0x2e')][_0x8a4c('0x36')]);_0x1eac28[_0x8a4c('0x37')]=qs[_0x8a4c('0x30')](_[_0x8a4c('0x38')](_0x837690[_0x8a4c('0x2e')],_0x24cde1['filters']));if(_0x837690[_0x8a4c('0x2e')]['filter']){_0x1eac28[_0x8a4c('0x37')]=_[_0x8a4c('0x3a')](_0x1eac28['where'],{'$or':_[_0x8a4c('0x27')](_0x1eac28[_0x8a4c('0x32')],function(_0x5db9ff){var _0x59ae9b={};_0x59ae9b[_0x5db9ff]={'$like':'%'+_0x837690['query']['filter']+'%'};return _0x59ae9b;})});}_0x1eac28=_[_0x8a4c('0x3a')]({},_0x1eac28,_0x837690[_0x8a4c('0x3c')]);return _0x3a8b0b['getFields'](_0x1eac28);}})[_0x8a4c('0x22')](function(_0xcd1558){if(_0xcd1558){_0x1caec4=_0xcd1558['length'];if(!_0x837690[_0x8a4c('0x2e')]['hasOwnProperty'](_0x8a4c('0x34'))){_0x1eac28[_0x8a4c('0x1b')]=qs[_0x8a4c('0x1b')](_0x837690[_0x8a4c('0x2e')][_0x8a4c('0x1b')]);_0x1eac28[_0x8a4c('0x19')]=qs[_0x8a4c('0x19')](_0x837690[_0x8a4c('0x2e')][_0x8a4c('0x19')]);}return _0x3a8b0b[_0x8a4c('0x4a')](_0x1eac28);}})[_0x8a4c('0x22')](function(_0x52420b){if(_0x52420b){return _0x52420b?{'count':_0x1caec4,'rows':_0x52420b}:null;}})[_0x8a4c('0x22')](respondWithResult(_0x5dab9b,null))['catch'](handleError(_0x5dab9b,null));};exports[_0x8a4c('0x4b')]=function(_0x113039,_0xee5b02,_0xb6ed6a){var _0x27ec60={};var _0x39e575={};var _0x1cb565;var _0x3c0da6;return db[_0x8a4c('0x28')][_0x8a4c('0x4c')]({'where':{'id':_0x113039['params']['id']}})['then'](handleEntityNotFound(_0xee5b02,null))[_0x8a4c('0x22')](function(_0xd6067b){if(_0xd6067b){_0x1cb565=_0xd6067b;_0x39e575['model']=_['keys'](db[_0x8a4c('0x4d')][_0x8a4c('0x29')]);_0x39e575['query']=_[_0x8a4c('0x2f')](_0x113039[_0x8a4c('0x2e')]);_0x39e575['filters']=_[_0x8a4c('0x31')](_0x39e575[_0x8a4c('0x2d')],_0x39e575[_0x8a4c('0x2e')]);_0x27ec60[_0x8a4c('0x32')]=_[_0x8a4c('0x31')](_0x39e575['model'],qs[_0x8a4c('0x33')](_0x113039[_0x8a4c('0x2e')][_0x8a4c('0x33')]));_0x27ec60[_0x8a4c('0x32')]=_0x27ec60[_0x8a4c('0x32')][_0x8a4c('0x44')]?_0x27ec60['attributes']:_0x39e575['model'];_0x27ec60[_0x8a4c('0x35')]=qs[_0x8a4c('0x36')](_0x113039['query'][_0x8a4c('0x36')]);_0x27ec60[_0x8a4c('0x37')]=qs[_0x8a4c('0x30')](_[_0x8a4c('0x38')](_0x113039[_0x8a4c('0x2e')],_0x39e575[_0x8a4c('0x30')]));if(_0x113039[_0x8a4c('0x2e')][_0x8a4c('0x39')]){_0x27ec60[_0x8a4c('0x37')]=_['merge'](_0x27ec60[_0x8a4c('0x37')],{'$or':_[_0x8a4c('0x27')](_0x27ec60['attributes'],function(_0x4d7ed4){var _0x4d81f9={};_0x4d81f9[_0x4d7ed4]={'$like':'%'+_0x113039[_0x8a4c('0x2e')][_0x8a4c('0x39')]+'%'};return _0x4d81f9;})});}_0x27ec60=_[_0x8a4c('0x3a')]({},_0x27ec60,_0x113039[_0x8a4c('0x3c')]);return _0x1cb565[_0x8a4c('0x4b')](_0x27ec60);}})[_0x8a4c('0x22')](function(_0x380ae5){if(_0x380ae5){_0x3c0da6=_0x380ae5['length'];if(!_0x113039[_0x8a4c('0x2e')][_0x8a4c('0x4e')](_0x8a4c('0x34'))){_0x27ec60[_0x8a4c('0x1b')]=qs[_0x8a4c('0x1b')](_0x113039['query'][_0x8a4c('0x1b')]);_0x27ec60[_0x8a4c('0x19')]=qs['offset'](_0x113039[_0x8a4c('0x2e')]['offset']);}return _0x1cb565[_0x8a4c('0x4b')](_0x27ec60);}})[_0x8a4c('0x22')](function(_0x3b149c){if(_0x3b149c){return _0x3b149c?{'count':_0x3c0da6,'rows':_0x3b149c}:null;}})[_0x8a4c('0x22')](respondWithResult(_0xee5b02,null))['catch'](handleError(_0xee5b02,null));};exports['getDescriptions']=function(_0x95a404,_0x45d112,_0x3f07d6){var _0x4c146e={};var _0x2d0fc9={};var _0xc2506c;var _0x17d30e;return db['DeskConfiguration']['findOne']({'where':{'id':_0x95a404[_0x8a4c('0x43')]['id']}})[_0x8a4c('0x22')](handleEntityNotFound(_0x45d112,null))[_0x8a4c('0x22')](function(_0x311139){if(_0x311139){_0xc2506c=_0x311139;_0x2d0fc9[_0x8a4c('0x2d')]=_[_0x8a4c('0x2f')](db['DeskField'][_0x8a4c('0x29')]);_0x2d0fc9[_0x8a4c('0x2e')]=_[_0x8a4c('0x2f')](_0x95a404[_0x8a4c('0x2e')]);_0x2d0fc9[_0x8a4c('0x30')]=_[_0x8a4c('0x31')](_0x2d0fc9['model'],_0x2d0fc9[_0x8a4c('0x2e')]);_0x4c146e[_0x8a4c('0x32')]=_[_0x8a4c('0x31')](_0x2d0fc9[_0x8a4c('0x2d')],qs[_0x8a4c('0x33')](_0x95a404[_0x8a4c('0x2e')]['fields']));_0x4c146e[_0x8a4c('0x32')]=_0x4c146e['attributes'][_0x8a4c('0x44')]?_0x4c146e[_0x8a4c('0x32')]:_0x2d0fc9['model'];_0x4c146e[_0x8a4c('0x35')]=qs[_0x8a4c('0x36')](_0x95a404[_0x8a4c('0x2e')][_0x8a4c('0x36')]);_0x4c146e['where']=qs['filters'](_[_0x8a4c('0x38')](_0x95a404[_0x8a4c('0x2e')],_0x2d0fc9[_0x8a4c('0x30')]));if(_0x95a404[_0x8a4c('0x2e')][_0x8a4c('0x39')]){_0x4c146e[_0x8a4c('0x37')]=_[_0x8a4c('0x3a')](_0x4c146e['where'],{'$or':_['map'](_0x4c146e[_0x8a4c('0x32')],function(_0x4c10b2){var _0x26af75={};_0x26af75[_0x4c10b2]={'$like':'%'+_0x95a404['query'][_0x8a4c('0x39')]+'%'};return _0x26af75;})});}_0x4c146e=_[_0x8a4c('0x3a')]({},_0x4c146e,_0x95a404['options']);return _0xc2506c[_0x8a4c('0x4f')](_0x4c146e);}})[_0x8a4c('0x22')](function(_0x28eb7b){if(_0x28eb7b){_0x17d30e=_0x28eb7b[_0x8a4c('0x44')];if(!_0x95a404['query'][_0x8a4c('0x4e')]('nolimit')){_0x4c146e[_0x8a4c('0x1b')]=qs[_0x8a4c('0x1b')](_0x95a404[_0x8a4c('0x2e')][_0x8a4c('0x1b')]);_0x4c146e[_0x8a4c('0x19')]=qs[_0x8a4c('0x19')](_0x95a404[_0x8a4c('0x2e')][_0x8a4c('0x19')]);}return _0xc2506c[_0x8a4c('0x4f')](_0x4c146e);}})[_0x8a4c('0x22')](function(_0x593831){if(_0x593831){return _0x593831?{'count':_0x17d30e,'rows':_0x593831}:null;}})[_0x8a4c('0x22')](respondWithResult(_0x45d112,null))[_0x8a4c('0x41')](handleError(_0x45d112,null));};exports['getTags']=function(_0x3a412e,_0x25e8ab,_0x4f35b6){var _0x1cdf81={};var _0x273d44={};var _0x36f92a;var _0x368ea5;return db[_0x8a4c('0x28')][_0x8a4c('0x4c')]({'where':{'id':_0x3a412e[_0x8a4c('0x43')]['id']}})[_0x8a4c('0x22')](handleEntityNotFound(_0x25e8ab,null))[_0x8a4c('0x22')](function(_0x340d82){if(_0x340d82){_0x36f92a=_0x340d82;_0x273d44[_0x8a4c('0x2d')]=_['keys'](db['Tag'][_0x8a4c('0x29')]);_0x273d44['query']=_['keys'](_0x3a412e[_0x8a4c('0x2e')]);_0x273d44[_0x8a4c('0x30')]=_[_0x8a4c('0x31')](_0x273d44[_0x8a4c('0x2d')],_0x273d44['query']);_0x1cdf81[_0x8a4c('0x32')]=_[_0x8a4c('0x31')](_0x273d44[_0x8a4c('0x2d')],qs[_0x8a4c('0x33')](_0x3a412e['query'][_0x8a4c('0x33')]));_0x1cdf81[_0x8a4c('0x32')]=_0x1cdf81['attributes'][_0x8a4c('0x44')]?_0x1cdf81['attributes']:_0x273d44[_0x8a4c('0x2d')];_0x1cdf81['order']=qs[_0x8a4c('0x36')](_0x3a412e[_0x8a4c('0x2e')][_0x8a4c('0x36')]);_0x1cdf81[_0x8a4c('0x37')]=qs[_0x8a4c('0x30')](_['pick'](_0x3a412e['query'],_0x273d44[_0x8a4c('0x30')]));if(_0x3a412e[_0x8a4c('0x2e')][_0x8a4c('0x39')]){_0x1cdf81[_0x8a4c('0x37')]=_['merge'](_0x1cdf81[_0x8a4c('0x37')],{'$or':_[_0x8a4c('0x27')](_0x1cdf81[_0x8a4c('0x32')],function(_0xe5fff4){var _0x2acf44={};_0x2acf44[_0xe5fff4]={'$like':'%'+_0x3a412e['query'][_0x8a4c('0x39')]+'%'};return _0x2acf44;})});}_0x1cdf81=_['merge']({},_0x1cdf81,_0x3a412e[_0x8a4c('0x3c')]);return _0x36f92a['getTags'](_0x1cdf81);}})[_0x8a4c('0x22')](function(_0x41d5c2){if(_0x41d5c2){_0x368ea5=_0x41d5c2[_0x8a4c('0x44')];if(!_0x3a412e[_0x8a4c('0x2e')][_0x8a4c('0x4e')](_0x8a4c('0x34'))){_0x1cdf81['limit']=qs[_0x8a4c('0x1b')](_0x3a412e['query'][_0x8a4c('0x1b')]);_0x1cdf81[_0x8a4c('0x19')]=qs[_0x8a4c('0x19')](_0x3a412e[_0x8a4c('0x2e')][_0x8a4c('0x19')]);}return _0x36f92a[_0x8a4c('0x50')](_0x1cdf81);}})[_0x8a4c('0x22')](function(_0x3f32c3){if(_0x3f32c3){return _0x3f32c3?{'count':_0x368ea5,'rows':_0x3f32c3}:null;}})[_0x8a4c('0x22')](respondWithResult(_0x25e8ab,null))[_0x8a4c('0x41')](handleError(_0x25e8ab,null));};exports[_0x8a4c('0x51')]=function(_0x46acd6,_0x2df235,_0x45c73f){if(_0x46acd6[_0x8a4c('0x48')]['id']){delete _0x46acd6[_0x8a4c('0x48')]['id'];}return db['DeskConfiguration'][_0x8a4c('0x4c')]({'where':{'id':_0x46acd6['params']['id']}})[_0x8a4c('0x22')](handleEntityNotFound(_0x2df235,null))[_0x8a4c('0x22')](function(_0x21ce00){if(_0x21ce00){return _0x21ce00[_0x8a4c('0x51')](_0x46acd6[_0x8a4c('0x48')][_0x8a4c('0x52')]||[]);}return null;})[_0x8a4c('0x22')](respondWithResult(_0x2df235,null))['catch'](handleError(_0x2df235,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 4a74e97..58a5d37 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 _0xea0e=['path','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','bluebird'];(function(_0x2f30de,_0x5d86ff){var _0x1ce460=function(_0x3ede16){while(--_0x3ede16){_0x2f30de['push'](_0x2f30de['shift']());}};_0x1ce460(++_0x5d86ff);}(_0xea0e,0xf7));var _0xeea0=function(_0x2effa0,_0xad57ea){_0x2effa0=_0x2effa0-0x0;var _0x50878e=_0xea0e[_0x2effa0];return _0x50878e;};'use strict';var _=require(_0xeea0('0x0'));var util=require(_0xeea0('0x1'));var logger=require(_0xeea0('0x2'))(_0xeea0('0x3'));var moment=require('moment');var BPromise=require(_0xeea0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeea0('0x5'));var rimraf=require('rimraf');var config=require(_0xeea0('0x6'));var attributes=require(_0xeea0('0x7'));module[_0xeea0('0x8')]=function(_0x274a96,_0x122a14){return _0x274a96[_0xeea0('0x9')](_0xeea0('0xa'),attributes,{'tableName':_0xeea0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xae2b=['util','api','moment','bluebird','request-promise','path','rimraf','./intDeskConfiguration.attributes','define','lodash'];(function(_0x403069,_0x24bf55){var _0x3314ed=function(_0x2c6d8b){while(--_0x2c6d8b){_0x403069['push'](_0x403069['shift']());}};_0x3314ed(++_0x24bf55);}(_0xae2b,0xb3));var _0xbae2=function(_0x333d81,_0x18d63c){_0x333d81=_0x333d81-0x0;var _0x1294eb=_0xae2b[_0x333d81];return _0x1294eb;};'use strict';var _=require(_0xbae2('0x0'));var util=require(_0xbae2('0x1'));var logger=require('../../config/logger')(_0xbae2('0x2'));var moment=require(_0xbae2('0x3'));var BPromise=require(_0xbae2('0x4'));var rp=require(_0xbae2('0x5'));var fs=require('fs');var path=require(_0xbae2('0x6'));var rimraf=require(_0xbae2('0x7'));var config=require('../../config/environment');var attributes=require(_0xbae2('0x8'));module['exports']=function(_0x365175,_0xbfd83a){return _0x365175[_0xbae2('0x9')]('DeskConfiguration',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 43b7c4f..57c7c34 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 _0x5352=['request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','DeskConfiguration,\x20%s,\x20%s'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x5352,0x1ea));var _0x2535=function(_0x5a0534,_0x5d2a1c){_0x5a0534=_0x5a0534-0x0;var _0x4986fd=_0x5352[_0x5a0534];return _0x4986fd;};'use strict';var _=require(_0x2535('0x0'));var util=require(_0x2535('0x1'));var moment=require(_0x2535('0x2'));var BPromise=require(_0x2535('0x3'));var rs=require(_0x2535('0x4'));var fs=require('fs');var Redis=require(_0x2535('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2535('0x6'));var logger=require('../../config/logger')(_0x2535('0x7'));var config=require(_0x2535('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2535('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36c0c1,_0x4e1244,_0x55249b){return new BPromise(function(_0x3ff423,_0x53d3d8){return client[_0x2535('0xa')](_0x36c0c1,_0x55249b)[_0x2535('0xb')](function(_0x4a956e){logger[_0x2535('0xc')](_0x2535('0xd'),_0x4e1244,_0x2535('0xe'));logger['debug']('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4e1244,'request\x20sent',JSON[_0x2535('0xf')](_0x4a956e));if(_0x4a956e[_0x2535('0x10')]){if(_0x4a956e['error'][_0x2535('0x11')]===0x1f4){logger[_0x2535('0x10')](_0x2535('0xd'),_0x4e1244,_0x4a956e[_0x2535('0x10')][_0x2535('0x12')]);return _0x53d3d8(_0x4a956e[_0x2535('0x10')][_0x2535('0x12')]);}logger[_0x2535('0x10')](_0x2535('0xd'),_0x4e1244,_0x4a956e[_0x2535('0x10')][_0x2535('0x12')]);return _0x3ff423(_0x4a956e[_0x2535('0x10')][_0x2535('0x12')]);}else{logger[_0x2535('0xc')](_0x2535('0xd'),_0x4e1244,_0x2535('0xe'));_0x3ff423(_0x4a956e[_0x2535('0x13')][_0x2535('0x12')]);}})[_0x2535('0x14')](function(_0x28dba5){logger[_0x2535('0x10')](_0x2535('0xd'),_0x4e1244,_0x28dba5);_0x53d3d8(_0x28dba5);});});} \ No newline at end of file +var _0x627e=['request','info','DeskConfiguration,\x20%s,\x20%s','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http'];(function(_0x24fe4e,_0x3bd296){var _0x347327=function(_0x3e86e0){while(--_0x3e86e0){_0x24fe4e['push'](_0x24fe4e['shift']());}};_0x347327(++_0x3bd296);}(_0x627e,0x14a));var _0xe627=function(_0x251468,_0x685716){_0x251468=_0x251468-0x0;var _0x465240=_0x627e[_0x251468];return _0x465240;};'use strict';var _=require(_0xe627('0x0'));var util=require(_0xe627('0x1'));var moment=require(_0xe627('0x2'));var BPromise=require(_0xe627('0x3'));var rs=require(_0xe627('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe627('0x5'))['db'];var utils=require(_0xe627('0x6'));var logger=require(_0xe627('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe627('0x8')][_0xe627('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45e49a,_0x2d4f63,_0xd5016e){return new BPromise(function(_0xe065b,_0x4bae52){return client[_0xe627('0xa')](_0x45e49a,_0xd5016e)['then'](function(_0x56549e){logger[_0xe627('0xb')](_0xe627('0xc'),_0x2d4f63,'request\x20sent');logger['debug'](_0xe627('0xd'),_0x2d4f63,_0xe627('0xe'),JSON[_0xe627('0xf')](_0x56549e));if(_0x56549e[_0xe627('0x10')]){if(_0x56549e[_0xe627('0x10')][_0xe627('0x11')]===0x1f4){logger[_0xe627('0x10')](_0xe627('0xc'),_0x2d4f63,_0x56549e[_0xe627('0x10')]['message']);return _0x4bae52(_0x56549e[_0xe627('0x10')][_0xe627('0x12')]);}logger[_0xe627('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x2d4f63,_0x56549e[_0xe627('0x10')][_0xe627('0x12')]);return _0xe065b(_0x56549e[_0xe627('0x10')][_0xe627('0x12')]);}else{logger[_0xe627('0xb')](_0xe627('0xc'),_0x2d4f63,_0xe627('0xe'));_0xe065b(_0x56549e['result'][_0xe627('0x12')]);}})[_0xe627('0x13')](function(_0x16c2d7){logger[_0xe627('0x10')](_0xe627('0xc'),_0x2d4f63,_0x16c2d7);_0x4bae52(_0x16c2d7);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 36ff74a..0ade84c 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 _0x4910=['../../components/interaction/service','./intDeskField.controller','get','isAuthenticated','index','show','post','create','/:id','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5e3a45,_0x45f0c5){var _0x13419f=function(_0x5ac996){while(--_0x5ac996){_0x5e3a45['push'](_0x5e3a45['shift']());}};_0x13419f(++_0x45f0c5);}(_0x4910,0x1d9));var _0x0491=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x4910[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0x0491('0x0'));var util=require(_0x0491('0x1'));var path=require(_0x0491('0x2'));var timeout=require('connect-timeout');var express=require(_0x0491('0x3'));var router=express[_0x0491('0x4')]();var fs_extra=require(_0x0491('0x5'));var auth=require(_0x0491('0x6'));var interaction=require(_0x0491('0x7'));var config=require('../../config/environment');var controller=require(_0x0491('0x8'));router[_0x0491('0x9')]('/',auth[_0x0491('0xa')](),controller[_0x0491('0xb')]);router[_0x0491('0x9')]('/:id',auth[_0x0491('0xa')](),controller[_0x0491('0xc')]);router[_0x0491('0xd')]('/',auth[_0x0491('0xa')](),controller[_0x0491('0xe')]);router['put'](_0x0491('0xf'),auth['isAuthenticated'](),controller[_0x0491('0x10')]);router[_0x0491('0x11')](_0x0491('0xf'),auth[_0x0491('0xa')](),controller[_0x0491('0x12')]);module[_0x0491('0x13')]=router; \ No newline at end of file +var _0xa7d7=['index','show','post','isAuthenticated','put','/:id','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xa7d7,0x149));var _0x7a7d=function(_0x1cd674,_0x8d3638){_0x1cd674=_0x1cd674-0x0;var _0x27928f=_0xa7d7[_0x1cd674];return _0x27928f;};'use strict';var multer=require('multer');var util=require(_0x7a7d('0x0'));var path=require(_0x7a7d('0x1'));var timeout=require(_0x7a7d('0x2'));var express=require(_0x7a7d('0x3'));var router=express[_0x7a7d('0x4')]();var fs_extra=require(_0x7a7d('0x5'));var auth=require(_0x7a7d('0x6'));var interaction=require(_0x7a7d('0x7'));var config=require(_0x7a7d('0x8'));var controller=require(_0x7a7d('0x9'));router[_0x7a7d('0xa')]('/',auth['isAuthenticated'](),controller[_0x7a7d('0xb')]);router[_0x7a7d('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x7a7d('0xc')]);router[_0x7a7d('0xd')]('/',auth[_0x7a7d('0xe')](),controller['create']);router[_0x7a7d('0xf')]('/:id',auth[_0x7a7d('0xe')](),controller['update']);router['delete'](_0x7a7d('0x10'),auth[_0x7a7d('0xe')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 72fbf6d..c9d39cf 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 _0xf8a8=['keyValue','picklist','STRING','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x1895b9,_0x1831b5){var _0x58a3d5=function(_0x26a14a){while(--_0x26a14a){_0x1895b9['push'](_0x1895b9['shift']());}};_0x58a3d5(++_0x1831b5);}(_0xf8a8,0x13e));var _0x8f8a=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0xf8a8[_0x3de8a4];return _0x4635cf;};'use strict';var Sequelize=require(_0x8f8a('0x0'));module[_0x8f8a('0x1')]={'type':{'type':Sequelize[_0x8f8a('0x2')](_0x8f8a('0x3'),_0x8f8a('0x4'),_0x8f8a('0x5'),_0x8f8a('0x6'),_0x8f8a('0x7')),'defaultValue':_0x8f8a('0x3')},'content':{'type':Sequelize[_0x8f8a('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8f8a('0x2')](_0x8f8a('0x3'),'variable',_0x8f8a('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8f8a('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8f8a('0x8')]}}; \ No newline at end of file +var _0x131a=['customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x131a,0x91));var _0xa131=function(_0x4cbc95,_0x419639){_0x4cbc95=_0x4cbc95-0x0;var _0x24af3a=_0x131a[_0x4cbc95];return _0x24af3a;};'use strict';var Sequelize=require(_0xa131('0x0'));module[_0xa131('0x1')]={'type':{'type':Sequelize[_0xa131('0x2')](_0xa131('0x3'),_0xa131('0x4'),_0xa131('0x5'),_0xa131('0x6'),_0xa131('0x7')),'defaultValue':_0xa131('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xa131('0x8')]},'keyType':{'type':Sequelize[_0xa131('0x2')](_0xa131('0x3'),_0xa131('0x4'),_0xa131('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xa131('0x8')]},'nameField':{'type':Sequelize[_0xa131('0x8')]},'customField':{'type':Sequelize[_0xa131('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 2cd5210..98aa9f0 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 _0xa6ce=['../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','reject','save','destroy','then','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','order','sort','filters','pick','filter','where','merge','options','DeskField','include','findAll','rows','catch','rawAttributes','includeAll','find','create','update','body','params','eml-format','zip-dir','fast-json-patch','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','../../config/logger','api','../../config/utils','../../config/license/util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa6ce,0x15e));var _0xea6c=function(_0x529296,_0x1a6a23){_0x529296=_0x529296-0x0;var _0x1796bf=_0xa6ce[_0x529296];return _0x1796bf;};'use strict';var emlformat=require(_0xea6c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xea6c('0x1'));var jsonpatch=require(_0xea6c('0x2'));var rp=require('request-promise');var moment=require(_0xea6c('0x3'));var BPromise=require(_0xea6c('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xea6c('0x5'));var sox=require(_0xea6c('0x6'));var csv=require(_0xea6c('0x7'));var ejs=require(_0xea6c('0x8'));var fs=require('fs');var fs_extra=require(_0xea6c('0x9'));var _=require(_0xea6c('0xa'));var squel=require('squel');var crypto=require(_0xea6c('0xb'));var jsforce=require(_0xea6c('0xc'));var deskjs=require(_0xea6c('0xd'));var toCsv=require(_0xea6c('0x7'));var querystring=require(_0xea6c('0xe'));var Papa=require(_0xea6c('0xf'));var Redis=require(_0xea6c('0x10'));var authService=require(_0xea6c('0x11'));var qs=require(_0xea6c('0x12'));var as=require(_0xea6c('0x13'));var hardwareService=require(_0xea6c('0x14'));var logger=require(_0xea6c('0x15'))(_0xea6c('0x16'));var utils=require(_0xea6c('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xea6c('0x18'));var db=require(_0xea6c('0x19'))['db'];function respondWithStatusCode(_0x36c0a8,_0x5a7dcd){_0x5a7dcd=_0x5a7dcd||0xcc;return function(_0x723b5b){if(_0x723b5b){return _0x36c0a8[_0xea6c('0x1a')](_0x5a7dcd);}return _0x36c0a8['status'](_0x5a7dcd)[_0xea6c('0x1b')]();};}function respondWithResult(_0x3a0a37,_0x13fd94){_0x13fd94=_0x13fd94||0xc8;return function(_0xc5c82e){if(_0xc5c82e){return _0x3a0a37[_0xea6c('0x1c')](_0x13fd94)[_0xea6c('0x1d')](_0xc5c82e);}};}function respondWithFilteredResult(_0x5a51f9,_0x43cf5b){return function(_0x4f9c92){if(_0x4f9c92){var _0x25b150=typeof _0x43cf5b[_0xea6c('0x1e')]===_0xea6c('0x1f')&&typeof _0x43cf5b[_0xea6c('0x20')]===_0xea6c('0x1f');var _0x55f9e4=_0x4f9c92[_0xea6c('0x21')];var _0x2f4bd0=_0x25b150?0x0:_0x43cf5b[_0xea6c('0x1e')];var _0x2f89e8=_0x25b150?_0x4f9c92[_0xea6c('0x21')]:_0x43cf5b[_0xea6c('0x1e')]+_0x43cf5b[_0xea6c('0x20')];var _0x2238bd;if(_0x2f89e8>=_0x55f9e4){_0x2f89e8=_0x55f9e4;_0x2238bd=0xc8;}else{_0x2238bd=0xce;}_0x5a51f9[_0xea6c('0x1c')](_0x2238bd);return _0x5a51f9[_0xea6c('0x22')]('Content-Range',_0x2f4bd0+'-'+_0x2f89e8+'/'+_0x55f9e4)[_0xea6c('0x1d')](_0x4f9c92);}return null;};}function patchUpdates(_0x490ad5){return function(_0x34bf0c){try{jsonpatch['apply'](_0x34bf0c,_0x490ad5,!![]);}catch(_0x204e07){return BPromise[_0xea6c('0x23')](_0x204e07);}return _0x34bf0c[_0xea6c('0x24')]();};}function saveUpdates(_0x539b63,_0x417cfa){return function(_0x371327){if(_0x371327){return _0x371327['update'](_0x539b63)['then'](function(_0x3b3737){return _0x3b3737;});}return null;};}function removeEntity(_0x53d94c,_0x540406){return function(_0x270ce7){if(_0x270ce7){return _0x270ce7[_0xea6c('0x25')]()[_0xea6c('0x26')](function(){_0x53d94c[_0xea6c('0x1c')](0xcc)[_0xea6c('0x1b')]();});}};}function handleEntityNotFound(_0x4fa0ea,_0x3bfe88){return function(_0x565358){if(!_0x565358){_0x4fa0ea['sendStatus'](0x194);}return _0x565358;};}function handleError(_0x16e88d,_0x52953a){_0x52953a=_0x52953a||0x1f4;return function(_0x281717){logger[_0xea6c('0x27')](_0x281717[_0xea6c('0x28')]);if(_0x281717[_0xea6c('0x29')]){delete _0x281717[_0xea6c('0x29')];}_0x16e88d[_0xea6c('0x1c')](_0x52953a)[_0xea6c('0x2a')](_0x281717);};}exports[_0xea6c('0x2b')]=function(_0x348a38,_0x118385){var _0x15327f={},_0x22e059={},_0x562f57={'count':0x0,'rows':[]};var _0x2e076b=_[_0xea6c('0x2c')](db['DeskField']['rawAttributes'],function(_0x5c0c71){return{'name':_0x5c0c71[_0xea6c('0x2d')],'type':_0x5c0c71[_0xea6c('0x2e')][_0xea6c('0x2f')]};});_0x22e059[_0xea6c('0x30')]=_[_0xea6c('0x2c')](_0x2e076b,_0xea6c('0x29'));_0x22e059[_0xea6c('0x31')]=_[_0xea6c('0x32')](_0x348a38[_0xea6c('0x31')]);_0x22e059['filters']=_[_0xea6c('0x33')](_0x22e059[_0xea6c('0x30')],_0x22e059[_0xea6c('0x31')]);_0x15327f[_0xea6c('0x34')]=_[_0xea6c('0x33')](_0x22e059[_0xea6c('0x30')],qs['fields'](_0x348a38[_0xea6c('0x31')][_0xea6c('0x35')]));_0x15327f['attributes']=_0x15327f[_0xea6c('0x34')][_0xea6c('0x36')]?_0x15327f[_0xea6c('0x34')]:_0x22e059['model'];if(!_0x348a38['query']['hasOwnProperty']('nolimit')){_0x15327f['limit']=qs[_0xea6c('0x20')](_0x348a38[_0xea6c('0x31')][_0xea6c('0x20')]);_0x15327f[_0xea6c('0x1e')]=qs['offset'](_0x348a38[_0xea6c('0x31')][_0xea6c('0x1e')]);}_0x15327f[_0xea6c('0x37')]=qs['sort'](_0x348a38[_0xea6c('0x31')][_0xea6c('0x38')]);_0x15327f['where']=qs[_0xea6c('0x39')](_[_0xea6c('0x3a')](_0x348a38[_0xea6c('0x31')],_0x22e059[_0xea6c('0x39')]),_0x2e076b);if(_0x348a38[_0xea6c('0x31')][_0xea6c('0x3b')]){_0x15327f[_0xea6c('0x3c')]=_[_0xea6c('0x3d')](_0x15327f[_0xea6c('0x3c')],{'$or':_[_0xea6c('0x2c')](_0x2e076b,function(_0x2cd63b){if(_0x2cd63b[_0xea6c('0x2e')]!=='VIRTUAL'){var _0x21b561={};_0x21b561[_0x2cd63b['name']]={'$like':'%'+_0x348a38[_0xea6c('0x31')][_0xea6c('0x3b')]+'%'};return _0x21b561;}})});}_0x15327f=_[_0xea6c('0x3d')]({},_0x15327f,_0x348a38[_0xea6c('0x3e')]);var _0x2804ed={'where':_0x15327f['where']};return db[_0xea6c('0x3f')][_0xea6c('0x21')](_0x2804ed)[_0xea6c('0x26')](function(_0x5b288e){_0x562f57['count']=_0x5b288e;if(_0x348a38[_0xea6c('0x31')]['includeAll']){_0x15327f[_0xea6c('0x40')]=[{'all':!![]}];}return db[_0xea6c('0x3f')][_0xea6c('0x41')](_0x15327f);})[_0xea6c('0x26')](function(_0x595195){_0x562f57[_0xea6c('0x42')]=_0x595195;return _0x562f57;})[_0xea6c('0x26')](respondWithFilteredResult(_0x118385,_0x15327f))[_0xea6c('0x43')](handleError(_0x118385,null));};exports['show']=function(_0x244604,_0x4b12c7){var _0x43c41a={'raw':!![],'where':{'id':_0x244604['params']['id']}},_0x20861e={};_0x20861e[_0xea6c('0x30')]=_[_0xea6c('0x32')](db[_0xea6c('0x3f')][_0xea6c('0x44')]);_0x20861e[_0xea6c('0x31')]=_[_0xea6c('0x32')](_0x244604['query']);_0x20861e[_0xea6c('0x39')]=_[_0xea6c('0x33')](_0x20861e[_0xea6c('0x30')],_0x20861e[_0xea6c('0x31')]);_0x43c41a[_0xea6c('0x34')]=_[_0xea6c('0x33')](_0x20861e[_0xea6c('0x30')],qs[_0xea6c('0x35')](_0x244604[_0xea6c('0x31')][_0xea6c('0x35')]));_0x43c41a[_0xea6c('0x34')]=_0x43c41a[_0xea6c('0x34')][_0xea6c('0x36')]?_0x43c41a[_0xea6c('0x34')]:_0x20861e['model'];if(_0x244604[_0xea6c('0x31')][_0xea6c('0x45')]){_0x43c41a['include']=[{'all':!![]}];}_0x43c41a=_['merge']({},_0x43c41a,_0x244604[_0xea6c('0x3e')]);return db[_0xea6c('0x3f')][_0xea6c('0x46')](_0x43c41a)[_0xea6c('0x26')](handleEntityNotFound(_0x4b12c7,null))[_0xea6c('0x26')](respondWithResult(_0x4b12c7,null))[_0xea6c('0x43')](handleError(_0x4b12c7,null));};exports[_0xea6c('0x47')]=function(_0x2ad357,_0x228828){return db[_0xea6c('0x3f')]['create'](_0x2ad357['body'],{})[_0xea6c('0x26')](respondWithResult(_0x228828,0xc9))[_0xea6c('0x43')](handleError(_0x228828,null));};exports[_0xea6c('0x48')]=function(_0x50f3f1,_0x7c71a0){if(_0x50f3f1['body']['id']){delete _0x50f3f1[_0xea6c('0x49')]['id'];}return db[_0xea6c('0x3f')][_0xea6c('0x46')]({'where':{'id':_0x50f3f1['params']['id']}})[_0xea6c('0x26')](handleEntityNotFound(_0x7c71a0,null))['then'](saveUpdates(_0x50f3f1[_0xea6c('0x49')],null))[_0xea6c('0x26')](respondWithResult(_0x7c71a0,null))[_0xea6c('0x43')](handleError(_0x7c71a0,null));};exports[_0xea6c('0x25')]=function(_0x3fa695,_0x25c108){return db[_0xea6c('0x3f')][_0xea6c('0x46')]({'where':{'id':_0x3fa695[_0xea6c('0x4a')]['id']}})[_0xea6c('0x26')](handleEntityNotFound(_0x25c108,null))[_0xea6c('0x26')](removeEntity(_0x25c108,null))[_0xea6c('0x43')](handleError(_0x25c108,null));}; \ No newline at end of file +var _0x7c7f=['eml-format','rimraf','request-promise','moment','bluebird','util','path','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','end','error','stack','send','map','DeskField','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','name','options','include','rows','show','includeAll','create','catch','body','find','params','destroy'];(function(_0x1e24b1,_0x14ab30){var _0x212baf=function(_0x2bd3e9){while(--_0x2bd3e9){_0x1e24b1['push'](_0x1e24b1['shift']());}};_0x212baf(++_0x14ab30);}(_0x7c7f,0x163));var _0xf7c7=function(_0x3b1b23,_0x21bccd){_0x3b1b23=_0x3b1b23-0x0;var _0x1efc85=_0x7c7f[_0x3b1b23];return _0x1efc85;};'use strict';var emlformat=require(_0xf7c7('0x0'));var rimraf=require(_0xf7c7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf7c7('0x2'));var moment=require(_0xf7c7('0x3'));var BPromise=require(_0xf7c7('0x4'));var Mustache=require('mustache');var util=require(_0xf7c7('0x5'));var path=require(_0xf7c7('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf7c7('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf7c7('0x8'));var crypto=require(_0xf7c7('0x9'));var jsforce=require(_0xf7c7('0xa'));var deskjs=require(_0xf7c7('0xb'));var toCsv=require(_0xf7c7('0xc'));var querystring=require('querystring');var Papa=require(_0xf7c7('0xd'));var Redis=require('ioredis');var authService=require(_0xf7c7('0xe'));var qs=require(_0xf7c7('0xf'));var as=require(_0xf7c7('0x10'));var hardwareService=require(_0xf7c7('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xf7c7('0x12'));var licenseUtil=require(_0xf7c7('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5f3a76,_0x12167c){_0x12167c=_0x12167c||0xcc;return function(_0x2c3313){if(_0x2c3313){return _0x5f3a76[_0xf7c7('0x14')](_0x12167c);}return _0x5f3a76[_0xf7c7('0x15')](_0x12167c)['end']();};}function respondWithResult(_0x571e83,_0x103442){_0x103442=_0x103442||0xc8;return function(_0x491988){if(_0x491988){return _0x571e83[_0xf7c7('0x15')](_0x103442)[_0xf7c7('0x16')](_0x491988);}};}function respondWithFilteredResult(_0x3888c7,_0x52fc80){return function(_0x9cd3d2){if(_0x9cd3d2){var _0x75f675=typeof _0x52fc80[_0xf7c7('0x17')]==='undefined'&&typeof _0x52fc80[_0xf7c7('0x18')]==='undefined';var _0x36de35=_0x9cd3d2[_0xf7c7('0x19')];var _0x553ac2=_0x75f675?0x0:_0x52fc80[_0xf7c7('0x17')];var _0x51b3f3=_0x75f675?_0x9cd3d2['count']:_0x52fc80[_0xf7c7('0x17')]+_0x52fc80[_0xf7c7('0x18')];var _0x54338a;if(_0x51b3f3>=_0x36de35){_0x51b3f3=_0x36de35;_0x54338a=0xc8;}else{_0x54338a=0xce;}_0x3888c7[_0xf7c7('0x15')](_0x54338a);return _0x3888c7[_0xf7c7('0x1a')](_0xf7c7('0x1b'),_0x553ac2+'-'+_0x51b3f3+'/'+_0x36de35)[_0xf7c7('0x16')](_0x9cd3d2);}return null;};}function patchUpdates(_0x32df10){return function(_0x1d9d8d){try{jsonpatch[_0xf7c7('0x1c')](_0x1d9d8d,_0x32df10,!![]);}catch(_0x3b6c6c){return BPromise[_0xf7c7('0x1d')](_0x3b6c6c);}return _0x1d9d8d[_0xf7c7('0x1e')]();};}function saveUpdates(_0xcf6819,_0x675424){return function(_0x233dcb){if(_0x233dcb){return _0x233dcb[_0xf7c7('0x1f')](_0xcf6819)[_0xf7c7('0x20')](function(_0x4638d8){return _0x4638d8;});}return null;};}function removeEntity(_0x48fd83,_0x5da18c){return function(_0x5cfed5){if(_0x5cfed5){return _0x5cfed5['destroy']()[_0xf7c7('0x20')](function(){_0x48fd83['status'](0xcc)[_0xf7c7('0x21')]();});}};}function handleEntityNotFound(_0x46fff5,_0x2f292c){return function(_0x148a6f){if(!_0x148a6f){_0x46fff5[_0xf7c7('0x14')](0x194);}return _0x148a6f;};}function handleError(_0x5e5d87,_0x28adcd){_0x28adcd=_0x28adcd||0x1f4;return function(_0x3370f0){logger[_0xf7c7('0x22')](_0x3370f0[_0xf7c7('0x23')]);if(_0x3370f0['name']){delete _0x3370f0['name'];}_0x5e5d87[_0xf7c7('0x15')](_0x28adcd)[_0xf7c7('0x24')](_0x3370f0);};}exports['index']=function(_0x212fae,_0x446350){var _0x21d90f={},_0x32fcef={},_0x2ddf40={'count':0x0,'rows':[]};var _0x20adee=_[_0xf7c7('0x25')](db[_0xf7c7('0x26')][_0xf7c7('0x27')],function(_0x490323){return{'name':_0x490323[_0xf7c7('0x28')],'type':_0x490323[_0xf7c7('0x29')]['key']};});_0x32fcef[_0xf7c7('0x2a')]=_[_0xf7c7('0x25')](_0x20adee,'name');_0x32fcef[_0xf7c7('0x2b')]=_[_0xf7c7('0x2c')](_0x212fae[_0xf7c7('0x2b')]);_0x32fcef['filters']=_[_0xf7c7('0x2d')](_0x32fcef[_0xf7c7('0x2a')],_0x32fcef[_0xf7c7('0x2b')]);_0x21d90f[_0xf7c7('0x2e')]=_[_0xf7c7('0x2d')](_0x32fcef['model'],qs[_0xf7c7('0x2f')](_0x212fae[_0xf7c7('0x2b')][_0xf7c7('0x2f')]));_0x21d90f[_0xf7c7('0x2e')]=_0x21d90f[_0xf7c7('0x2e')][_0xf7c7('0x30')]?_0x21d90f['attributes']:_0x32fcef[_0xf7c7('0x2a')];if(!_0x212fae[_0xf7c7('0x2b')][_0xf7c7('0x31')](_0xf7c7('0x32'))){_0x21d90f[_0xf7c7('0x18')]=qs['limit'](_0x212fae['query']['limit']);_0x21d90f[_0xf7c7('0x17')]=qs[_0xf7c7('0x17')](_0x212fae[_0xf7c7('0x2b')][_0xf7c7('0x17')]);}_0x21d90f[_0xf7c7('0x33')]=qs[_0xf7c7('0x34')](_0x212fae['query'][_0xf7c7('0x34')]);_0x21d90f[_0xf7c7('0x35')]=qs[_0xf7c7('0x36')](_[_0xf7c7('0x37')](_0x212fae[_0xf7c7('0x2b')],_0x32fcef[_0xf7c7('0x36')]),_0x20adee);if(_0x212fae['query'][_0xf7c7('0x38')]){_0x21d90f[_0xf7c7('0x35')]=_[_0xf7c7('0x39')](_0x21d90f['where'],{'$or':_[_0xf7c7('0x25')](_0x20adee,function(_0x3a74b6){if(_0x3a74b6[_0xf7c7('0x29')]!==_0xf7c7('0x3a')){var _0x183b1c={};_0x183b1c[_0x3a74b6[_0xf7c7('0x3b')]]={'$like':'%'+_0x212fae['query']['filter']+'%'};return _0x183b1c;}})});}_0x21d90f=_['merge']({},_0x21d90f,_0x212fae[_0xf7c7('0x3c')]);var _0x5df012={'where':_0x21d90f[_0xf7c7('0x35')]};return db[_0xf7c7('0x26')][_0xf7c7('0x19')](_0x5df012)[_0xf7c7('0x20')](function(_0x439455){_0x2ddf40[_0xf7c7('0x19')]=_0x439455;if(_0x212fae[_0xf7c7('0x2b')]['includeAll']){_0x21d90f[_0xf7c7('0x3d')]=[{'all':!![]}];}return db[_0xf7c7('0x26')]['findAll'](_0x21d90f);})[_0xf7c7('0x20')](function(_0x3a122a){_0x2ddf40[_0xf7c7('0x3e')]=_0x3a122a;return _0x2ddf40;})[_0xf7c7('0x20')](respondWithFilteredResult(_0x446350,_0x21d90f))['catch'](handleError(_0x446350,null));};exports[_0xf7c7('0x3f')]=function(_0x5379d9,_0x4365e1){var _0x4ffde0={'raw':!![],'where':{'id':_0x5379d9['params']['id']}},_0x2aa9fe={};_0x2aa9fe['model']=_[_0xf7c7('0x2c')](db['DeskField'][_0xf7c7('0x27')]);_0x2aa9fe[_0xf7c7('0x2b')]=_[_0xf7c7('0x2c')](_0x5379d9[_0xf7c7('0x2b')]);_0x2aa9fe[_0xf7c7('0x36')]=_['intersection'](_0x2aa9fe[_0xf7c7('0x2a')],_0x2aa9fe[_0xf7c7('0x2b')]);_0x4ffde0[_0xf7c7('0x2e')]=_[_0xf7c7('0x2d')](_0x2aa9fe[_0xf7c7('0x2a')],qs['fields'](_0x5379d9[_0xf7c7('0x2b')]['fields']));_0x4ffde0[_0xf7c7('0x2e')]=_0x4ffde0['attributes'][_0xf7c7('0x30')]?_0x4ffde0[_0xf7c7('0x2e')]:_0x2aa9fe[_0xf7c7('0x2a')];if(_0x5379d9[_0xf7c7('0x2b')][_0xf7c7('0x40')]){_0x4ffde0[_0xf7c7('0x3d')]=[{'all':!![]}];}_0x4ffde0=_[_0xf7c7('0x39')]({},_0x4ffde0,_0x5379d9[_0xf7c7('0x3c')]);return db[_0xf7c7('0x26')]['find'](_0x4ffde0)[_0xf7c7('0x20')](handleEntityNotFound(_0x4365e1,null))['then'](respondWithResult(_0x4365e1,null))['catch'](handleError(_0x4365e1,null));};exports[_0xf7c7('0x41')]=function(_0x37d9e1,_0xd6aafa){return db[_0xf7c7('0x26')][_0xf7c7('0x41')](_0x37d9e1['body'],{})[_0xf7c7('0x20')](respondWithResult(_0xd6aafa,0xc9))[_0xf7c7('0x42')](handleError(_0xd6aafa,null));};exports['update']=function(_0x51d3fa,_0x58e349){if(_0x51d3fa[_0xf7c7('0x43')]['id']){delete _0x51d3fa[_0xf7c7('0x43')]['id'];}return db['DeskField'][_0xf7c7('0x44')]({'where':{'id':_0x51d3fa[_0xf7c7('0x45')]['id']}})[_0xf7c7('0x20')](handleEntityNotFound(_0x58e349,null))['then'](saveUpdates(_0x51d3fa[_0xf7c7('0x43')],null))['then'](respondWithResult(_0x58e349,null))[_0xf7c7('0x42')](handleError(_0x58e349,null));};exports[_0xf7c7('0x46')]=function(_0x3dbd2a,_0x222434){return db['DeskField'][_0xf7c7('0x44')]({'where':{'id':_0x3dbd2a[_0xf7c7('0x45')]['id']}})[_0xf7c7('0x20')](handleEntityNotFound(_0x222434,null))[_0xf7c7('0x20')](removeEntity(_0x222434,null))[_0xf7c7('0x42')](handleError(_0x222434,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index e2005f8..c95c3df 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 _0x1d5b=['desk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./intDeskField.attributes','define','DeskField','int_desk_fields'];(function(_0x44ca27,_0x81f0da){var _0x38bc17=function(_0x476f85){while(--_0x476f85){_0x44ca27['push'](_0x44ca27['shift']());}};_0x38bc17(++_0x81f0da);}(_0x1d5b,0x102));var _0xb1d5=function(_0xa1ff0f,_0x2ec303){_0xa1ff0f=_0xa1ff0f-0x0;var _0x3e8c7f=_0x1d5b[_0xa1ff0f];return _0x3e8c7f;};'use strict';var _=require(_0xb1d5('0x0'));var util=require(_0xb1d5('0x1'));var logger=require(_0xb1d5('0x2'))(_0xb1d5('0x3'));var moment=require(_0xb1d5('0x4'));var BPromise=require(_0xb1d5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb1d5('0x6'));var rimraf=require(_0xb1d5('0x7'));var config=require('../../config/environment');var attributes=require(_0xb1d5('0x8'));module['exports']=function(_0x1d1258,_0x5c1eab){return _0x1d1258[_0xb1d5('0x9')](_0xb1d5('0xa'),attributes,{'tableName':_0xb1d5('0xb'),'paranoid':![],'indexes':[{'name':_0xb1d5('0xc'),'fields':[_0xb1d5('0xd'),_0xb1d5('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7612=['api','moment','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','desk_unique_index','idField','../../config/logger'];(function(_0x4c699f,_0x44cc11){var _0x34bc34=function(_0x336097){while(--_0x336097){_0x4c699f['push'](_0x4c699f['shift']());}};_0x34bc34(++_0x44cc11);}(_0x7612,0x1df));var _0x2761=function(_0x2d8d69,_0x8e47ff){_0x2d8d69=_0x2d8d69-0x0;var _0x39ae22=_0x7612[_0x2d8d69];return _0x39ae22;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2761('0x0'))(_0x2761('0x1'));var moment=require(_0x2761('0x2'));var BPromise=require('bluebird');var rp=require(_0x2761('0x3'));var fs=require('fs');var path=require(_0x2761('0x4'));var rimraf=require(_0x2761('0x5'));var config=require(_0x2761('0x6'));var attributes=require(_0x2761('0x7'));module[_0x2761('0x8')]=function(_0x3b2b76,_0x2575d5){return _0x3b2b76[_0x2761('0x9')]('DeskField',attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x2761('0xa'),'fields':[_0x2761('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 4747419..a434572 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 _0xa9be=['request','then','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http'];(function(_0x26a4f1,_0x2a4aa9){var _0x560c61=function(_0x7d16a6){while(--_0x7d16a6){_0x26a4f1['push'](_0x26a4f1['shift']());}};_0x560c61(++_0x2a4aa9);}(_0xa9be,0xc9));var _0xea9b=function(_0x37946f,_0x1d9ef7){_0x37946f=_0x37946f-0x0;var _0x2df968=_0xa9be[_0x37946f];return _0x2df968;};'use strict';var _=require('lodash');var util=require(_0xea9b('0x0'));var moment=require(_0xea9b('0x1'));var BPromise=require(_0xea9b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xea9b('0x3'));var db=require(_0xea9b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xea9b('0x5'))(_0xea9b('0x6'));var config=require('../../config/environment');var jayson=require(_0xea9b('0x7'));var client=jayson['client'][_0xea9b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33f29e,_0x57d27e,_0x201363){return new BPromise(function(_0x24c882,_0x204124){return client[_0xea9b('0x9')](_0x33f29e,_0x201363)[_0xea9b('0xa')](function(_0x922a1f){logger['info'](_0xea9b('0xb'),_0x57d27e,_0xea9b('0xc'));logger[_0xea9b('0xd')](_0xea9b('0xe'),_0x57d27e,_0xea9b('0xc'),JSON[_0xea9b('0xf')](_0x922a1f));if(_0x922a1f[_0xea9b('0x10')]){if(_0x922a1f['error']['code']===0x1f4){logger[_0xea9b('0x10')](_0xea9b('0xb'),_0x57d27e,_0x922a1f[_0xea9b('0x10')][_0xea9b('0x11')]);return _0x204124(_0x922a1f[_0xea9b('0x10')][_0xea9b('0x11')]);}logger[_0xea9b('0x10')](_0xea9b('0xb'),_0x57d27e,_0x922a1f[_0xea9b('0x10')][_0xea9b('0x11')]);return _0x24c882(_0x922a1f[_0xea9b('0x10')][_0xea9b('0x11')]);}else{logger[_0xea9b('0x12')](_0xea9b('0xb'),_0x57d27e,_0xea9b('0xc'));_0x24c882(_0x922a1f[_0xea9b('0x13')]['message']);}})[_0xea9b('0x14')](function(_0xa05596){logger['error'](_0xea9b('0xb'),_0x57d27e,_0xa05596);_0x204124(_0xa05596);});});} \ No newline at end of file +var _0xa506=['then','DeskField,\x20%s,\x20%s','request\x20sent','error','message','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x29afe7,_0x335185){var _0x23c00f=function(_0x370a1d){while(--_0x370a1d){_0x29afe7['push'](_0x29afe7['shift']());}};_0x23c00f(++_0x335185);}(_0xa506,0x9e));var _0x6a50=function(_0x541b38,_0x52440d){_0x541b38=_0x541b38-0x0;var _0x1ff587=_0xa506[_0x541b38];return _0x1ff587;};'use strict';var _=require(_0x6a50('0x0'));var util=require('util');var moment=require(_0x6a50('0x1'));var BPromise=require(_0x6a50('0x2'));var rs=require(_0x6a50('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6a50('0x4'))['db'];var utils=require(_0x6a50('0x5'));var logger=require(_0x6a50('0x6'))(_0x6a50('0x7'));var config=require(_0x6a50('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6a50('0x9')][_0x6a50('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b6fb8,_0x559e39,_0x2b0012){return new BPromise(function(_0x3bec5a,_0x47bed4){return client[_0x6a50('0xb')](_0x2b6fb8,_0x2b0012)[_0x6a50('0xc')](function(_0x46c93b){logger['info'](_0x6a50('0xd'),_0x559e39,'request\x20sent');logger['debug']('DeskField,\x20%s,\x20%s,\x20%s',_0x559e39,_0x6a50('0xe'),JSON['stringify'](_0x46c93b));if(_0x46c93b[_0x6a50('0xf')]){if(_0x46c93b[_0x6a50('0xf')]['code']===0x1f4){logger[_0x6a50('0xf')](_0x6a50('0xd'),_0x559e39,_0x46c93b[_0x6a50('0xf')][_0x6a50('0x10')]);return _0x47bed4(_0x46c93b['error'][_0x6a50('0x10')]);}logger[_0x6a50('0xf')](_0x6a50('0xd'),_0x559e39,_0x46c93b['error']['message']);return _0x3bec5a(_0x46c93b[_0x6a50('0xf')]['message']);}else{logger['info']('DeskField,\x20%s,\x20%s',_0x559e39,_0x6a50('0xe'));_0x3bec5a(_0x46c93b['result'][_0x6a50('0x10')]);}})['catch'](function(_0x32177b){logger[_0x6a50('0xf')](_0x6a50('0xd'),_0x559e39,_0x32177b);_0x47bed4(_0x32177b);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index ad6175b..42d89a1 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 _0x083e=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','index','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','connect-timeout'];(function(_0x3651b8,_0x142e9f){var _0x3ee2ce=function(_0x35df31){while(--_0x35df31){_0x3651b8['push'](_0x3651b8['shift']());}};_0x3ee2ce(++_0x142e9f);}(_0x083e,0x137));var _0xe083=function(_0x414655,_0x79d916){_0x414655=_0x414655-0x0;var _0x237884=_0x083e[_0x414655];return _0x237884;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xe083('0x0'));var express=require(_0xe083('0x1'));var router=express[_0xe083('0x2')]();var fs_extra=require(_0xe083('0x3'));var auth=require(_0xe083('0x4'));var interaction=require(_0xe083('0x5'));var config=require(_0xe083('0x6'));var controller=require(_0xe083('0x7'));router[_0xe083('0x8')]('/',auth['isAuthenticated'](),controller[_0xe083('0x9')]);router[_0xe083('0x8')]('/:id',auth[_0xe083('0xa')](),controller[_0xe083('0xb')]);router[_0xe083('0x8')](_0xe083('0xc'),auth['isAuthenticated'](),controller[_0xe083('0xd')]);router[_0xe083('0x8')](_0xe083('0xe'),auth[_0xe083('0xa')](),controller[_0xe083('0xf')]);router[_0xe083('0x10')]('/',auth['isAuthenticated'](),controller[_0xe083('0x11')]);router[_0xe083('0x10')](_0xe083('0xc'),auth['isAuthenticated'](),controller[_0xe083('0x12')]);router[_0xe083('0x13')]('/:id',auth[_0xe083('0xa')](),controller[_0xe083('0x14')]);router[_0xe083('0x15')]('/:id',auth[_0xe083('0xa')](),controller[_0xe083('0x16')]);module[_0xe083('0x17')]=router; \ No newline at end of file +var _0x6882=['fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','put','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x5e38a4,_0x333514){var _0x401332=function(_0x18cd85){while(--_0x18cd85){_0x5e38a4['push'](_0x5e38a4['shift']());}};_0x401332(++_0x333514);}(_0x6882,0x1c6));var _0x2688=function(_0x3e1c0c,_0x2056ff){_0x3e1c0c=_0x3e1c0c-0x0;var _0x5d051a=_0x6882[_0x3e1c0c];return _0x5d051a;};'use strict';var multer=require(_0x2688('0x0'));var util=require(_0x2688('0x1'));var path=require(_0x2688('0x2'));var timeout=require(_0x2688('0x3'));var express=require(_0x2688('0x4'));var router=express[_0x2688('0x5')]();var fs_extra=require(_0x2688('0x6'));var auth=require(_0x2688('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x2688('0x8'));var controller=require(_0x2688('0x9'));router[_0x2688('0xa')]('/',auth[_0x2688('0xb')](),controller['index']);router[_0x2688('0xa')](_0x2688('0xc'),auth[_0x2688('0xb')](),controller[_0x2688('0xd')]);router[_0x2688('0xa')](_0x2688('0xe'),auth[_0x2688('0xb')](),controller[_0x2688('0xf')]);router[_0x2688('0xa')](_0x2688('0x10'),auth[_0x2688('0xb')](),controller[_0x2688('0x11')]);router[_0x2688('0x12')]('/',auth[_0x2688('0xb')](),controller['create']);router[_0x2688('0x12')](_0x2688('0xe'),auth[_0x2688('0xb')](),controller['addConfiguration']);router[_0x2688('0x13')]('/:id',auth[_0x2688('0xb')](),controller[_0x2688('0x14')]);router[_0x2688('0x15')]('/:id',auth[_0x2688('0xb')](),controller['destroy']);module[_0x2688('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 1fa6249..af741ae 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 _0x06bf=['BOOLEAN','sequelize','exports','STRING'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x06bf,0x105));var _0xf06b=function(_0x17449a,_0x2dc222){_0x17449a=_0x17449a-0x0;var _0x15bcd8=_0x06bf[_0x17449a];return _0x15bcd8;};'use strict';var Sequelize=require(_0xf06b('0x0'));module[_0xf06b('0x1')]={'name':{'type':Sequelize[_0xf06b('0x2')]},'username':{'type':Sequelize[_0xf06b('0x2')]},'password':{'type':Sequelize[_0xf06b('0x2')]},'remoteUri':{'type':Sequelize[_0xf06b('0x2')]},'tenantId':{'type':Sequelize[_0xf06b('0x2')]},'clientId':{'type':Sequelize[_0xf06b('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xf06b('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xf06b('0x2')]},'modernAuthentication':{'type':Sequelize[_0xf06b('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x1a0b=['sequelize','STRING','BOOLEAN'];(function(_0x504916,_0x1b3438){var _0x2745b6=function(_0x2cf9f0){while(--_0x2cf9f0){_0x504916['push'](_0x504916['shift']());}};_0x2745b6(++_0x1b3438);}(_0x1a0b,0x18f));var _0xb1a0=function(_0x2cc94f,_0x4bddc2){_0x2cc94f=_0x2cc94f-0x0;var _0x93d0e5=_0x1a0b[_0x2cc94f];return _0x93d0e5;};'use strict';var Sequelize=require(_0xb1a0('0x0'));module['exports']={'name':{'type':Sequelize[_0xb1a0('0x1')]},'username':{'type':Sequelize[_0xb1a0('0x1')]},'password':{'type':Sequelize[_0xb1a0('0x1')]},'remoteUri':{'type':Sequelize[_0xb1a0('0x1')]},'tenantId':{'type':Sequelize[_0xb1a0('0x1')]},'clientId':{'type':Sequelize[_0xb1a0('0x1')]},'clientSecret':{'type':Sequelize[_0xb1a0('0x1')]},'serverUrl':{'type':Sequelize[_0xb1a0('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xb1a0('0x1')]},'modernAuthentication':{'type':Sequelize[_0xb1a0('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index c99ad0d..fe282e0 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 _0xdca2=['responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','slaname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','username','password','remoteUri','tenantId','clientId','clientSecret','CloudProvider','data5','data7','modernAuthentication','access_token','/oauth2/token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','@odata.type','PicklistAttributeMetadata','push','all','forEach','isNil','BooleanAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','statusCode','error','stack',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','Value','DisplayName','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','lodash','../../config/logger','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','count','limit','update','then','destroy','sendStatus','name','send','index','Dynamics365Account','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','map','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','find','create','body','catch','params','getConfigurations','findOne','Dynamics365Configuration','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','phonenumber','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entityimage_timestamp','entityimage_url','escalatedon','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridname','owneridtype','parentcaseidname','primarycontactidname','prioritycodename','productidname','productserialnumber','resolvebykpiidname','responseby'];(function(_0x274bf7,_0xd2b4e0){var _0x22a999=function(_0x58998c){while(--_0x58998c){_0x274bf7['push'](_0x274bf7['shift']());}};_0x22a999(++_0xd2b4e0);}(_0xdca2,0xfd));var _0x2dca=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xdca2[_0x3ab51d];return _0x29a04e;};'use strict';var rp=require(_0x2dca('0x0'));var util=require('util');var _=require(_0x2dca('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x2dca('0x2'))('api');var db=require(_0x2dca('0x3'))['db'];var integrations=require(_0x2dca('0x4'));function respondWithResult(_0x594e44,_0x1655ca){_0x1655ca=_0x1655ca||0xc8;return function(_0x50d0c6){if(_0x50d0c6){return _0x594e44[_0x2dca('0x5')](_0x1655ca)[_0x2dca('0x6')](_0x50d0c6);}};}function respondWithFilteredResult(_0x53e2ac,_0x4de04b){return function(_0x3c78f1){if(_0x3c78f1){var _0x521c9e=typeof _0x4de04b[_0x2dca('0x7')]==='undefined'&&typeof _0x4de04b['limit']===_0x2dca('0x8');var _0x45717e=_0x3c78f1[_0x2dca('0x9')];var _0x1ca892=_0x521c9e?0x0:_0x4de04b['offset'];var _0x3c6641=_0x521c9e?_0x3c78f1['count']:_0x4de04b[_0x2dca('0x7')]+_0x4de04b[_0x2dca('0xa')];var _0x354f69;if(_0x3c6641>=_0x45717e){_0x3c6641=_0x45717e;_0x354f69=0xc8;}else{_0x354f69=0xce;}_0x53e2ac[_0x2dca('0x5')](_0x354f69);return _0x53e2ac['set']('Content-Range',_0x1ca892+'-'+_0x3c6641+'/'+_0x45717e)[_0x2dca('0x6')](_0x3c78f1);}return null;};}function saveUpdates(_0x2223b6){return function(_0x451c91){if(_0x451c91){return _0x451c91[_0x2dca('0xb')](_0x2223b6)[_0x2dca('0xc')](function(_0x4849c9){return _0x4849c9;});}return null;};}function removeEntity(_0x2cdfc8){return function(_0x246ea4){if(_0x246ea4){return _0x246ea4[_0x2dca('0xd')]()['then'](function(){_0x2cdfc8[_0x2dca('0x5')](0xcc)['end']();});}};}function handleEntityNotFound(_0x573390){return function(_0x3e8f9a){if(!_0x3e8f9a){_0x573390[_0x2dca('0xe')](0x194);}return _0x3e8f9a;};}function handleError(_0x34c526,_0x53ce05){_0x53ce05=_0x53ce05||0x1f4;return function(_0x49caaf){logger['error'](_0x49caaf['stack']);if(_0x49caaf[_0x2dca('0xf')]){delete _0x49caaf[_0x2dca('0xf')];}_0x34c526[_0x2dca('0x5')](_0x53ce05)[_0x2dca('0x10')](_0x49caaf);};}exports[_0x2dca('0x11')]=function(_0x5a59c5,_0x43e4ed){var _0x37e07f={},_0x181ade={},_0xdfc478={'count':0x0,'rows':[]};var _0x3964ee=_['map'](db[_0x2dca('0x12')][_0x2dca('0x13')],function(_0x1f59e2){return{'name':_0x1f59e2[_0x2dca('0x14')],'type':_0x1f59e2['type'][_0x2dca('0x15')]};});_0x181ade['model']=_['map'](_0x3964ee,_0x2dca('0xf'));_0x181ade[_0x2dca('0x16')]=_[_0x2dca('0x17')](_0x5a59c5[_0x2dca('0x16')]);_0x181ade[_0x2dca('0x18')]=_[_0x2dca('0x19')](_0x181ade[_0x2dca('0x1a')],_0x181ade['query']);_0x37e07f[_0x2dca('0x1b')]=_[_0x2dca('0x19')](_0x181ade['model'],qs['fields'](_0x5a59c5[_0x2dca('0x16')][_0x2dca('0x1c')]));_0x37e07f[_0x2dca('0x1b')]=_0x37e07f['attributes'][_0x2dca('0x1d')]?_0x37e07f[_0x2dca('0x1b')]:_0x181ade[_0x2dca('0x1a')];if(!_0x5a59c5[_0x2dca('0x16')][_0x2dca('0x1e')](_0x2dca('0x1f'))){_0x37e07f[_0x2dca('0xa')]=qs[_0x2dca('0xa')](_0x5a59c5['query']['limit']);_0x37e07f[_0x2dca('0x7')]=qs[_0x2dca('0x7')](_0x5a59c5[_0x2dca('0x16')]['offset']);}_0x37e07f[_0x2dca('0x20')]=qs[_0x2dca('0x21')](_0x5a59c5['query'][_0x2dca('0x21')]);_0x37e07f['where']=qs[_0x2dca('0x18')](_[_0x2dca('0x22')](_0x5a59c5[_0x2dca('0x16')],_0x181ade['filters']),_0x3964ee);if(_0x5a59c5[_0x2dca('0x16')][_0x2dca('0x23')]){_0x37e07f['where']=_['merge'](_0x37e07f[_0x2dca('0x24')],{'$or':_[_0x2dca('0x25')](_0x3964ee,function(_0x149ae3){if(_0x149ae3[_0x2dca('0x26')]!==_0x2dca('0x27')){var _0x1e2c6c={};_0x1e2c6c[_0x149ae3[_0x2dca('0xf')]]={'$like':'%'+_0x5a59c5[_0x2dca('0x16')]['filter']+'%'};return _0x1e2c6c;}})});}_0x37e07f=_[_0x2dca('0x28')]({},_0x37e07f,_0x5a59c5[_0x2dca('0x29')]);var _0x3ce35b={'where':_0x37e07f[_0x2dca('0x24')]};return db['Dynamics365Account'][_0x2dca('0x9')](_0x3ce35b)[_0x2dca('0xc')](function(_0x4ea05f){_0xdfc478['count']=_0x4ea05f;if(_0x5a59c5[_0x2dca('0x16')][_0x2dca('0x2a')]){_0x37e07f[_0x2dca('0x2b')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x2dca('0x2c')](_0x37e07f);})[_0x2dca('0xc')](function(_0x3329f2){_0xdfc478[_0x2dca('0x2d')]=_0x3329f2;return _0xdfc478;})[_0x2dca('0xc')](respondWithFilteredResult(_0x43e4ed,_0x37e07f))['catch'](handleError(_0x43e4ed,null));};exports[_0x2dca('0x2e')]=function(_0x75aea4,_0x44a1a0){var _0x4c1f05={'raw':![],'where':{'id':_0x75aea4['params']['id']}},_0xc11ce3={};_0xc11ce3[_0x2dca('0x1a')]=_[_0x2dca('0x17')](db[_0x2dca('0x12')][_0x2dca('0x13')]);_0xc11ce3['query']=_[_0x2dca('0x17')](_0x75aea4[_0x2dca('0x16')]);_0xc11ce3['filters']=_[_0x2dca('0x19')](_0xc11ce3[_0x2dca('0x1a')],_0xc11ce3['query']);_0x4c1f05[_0x2dca('0x1b')]=_[_0x2dca('0x19')](_0xc11ce3[_0x2dca('0x1a')],qs[_0x2dca('0x1c')](_0x75aea4[_0x2dca('0x16')][_0x2dca('0x1c')]));_0x4c1f05[_0x2dca('0x1b')]=_0x4c1f05[_0x2dca('0x1b')]['length']?_0x4c1f05[_0x2dca('0x1b')]:_0xc11ce3[_0x2dca('0x1a')];if(_0x75aea4['query'][_0x2dca('0x2a')]){_0x4c1f05['include']=[{'all':!![]}];}_0x4c1f05=_[_0x2dca('0x28')]({},_0x4c1f05,_0x75aea4[_0x2dca('0x29')]);return db[_0x2dca('0x12')][_0x2dca('0x2f')](_0x4c1f05)[_0x2dca('0xc')](handleEntityNotFound(_0x44a1a0,null))[_0x2dca('0xc')](respondWithResult(_0x44a1a0,null))['catch'](handleError(_0x44a1a0,null));};exports['create']=function(_0x166fcf,_0x4524ae){return db[_0x2dca('0x12')][_0x2dca('0x30')](_0x166fcf[_0x2dca('0x31')],{})[_0x2dca('0xc')](respondWithResult(_0x4524ae,0xc9))[_0x2dca('0x32')](handleError(_0x4524ae,null));};exports['update']=function(_0x2aa1ce,_0x397af1){if(_0x2aa1ce[_0x2dca('0x31')]['id']){delete _0x2aa1ce['body']['id'];}return db[_0x2dca('0x12')]['find']({'where':{'id':_0x2aa1ce[_0x2dca('0x33')]['id']}})[_0x2dca('0xc')](handleEntityNotFound(_0x397af1,null))[_0x2dca('0xc')](saveUpdates(_0x2aa1ce[_0x2dca('0x31')],null))[_0x2dca('0xc')](respondWithResult(_0x397af1,null))[_0x2dca('0x32')](handleError(_0x397af1,null));};exports[_0x2dca('0xd')]=function(_0x13a14d,_0x2a4277){return db[_0x2dca('0x12')]['find']({'where':{'id':_0x13a14d[_0x2dca('0x33')]['id']}})[_0x2dca('0xc')](handleEntityNotFound(_0x2a4277,null))[_0x2dca('0xc')](removeEntity(_0x2a4277,null))[_0x2dca('0x32')](handleError(_0x2a4277,null));};exports[_0x2dca('0x34')]=function(_0x299360,_0x2eef5b){var _0x58e8fe={};var _0x1f2816={};var _0x6a90ee;var _0xb915d4;return db[_0x2dca('0x12')][_0x2dca('0x35')]({'where':{'id':_0x299360[_0x2dca('0x33')]['id']}})[_0x2dca('0xc')](handleEntityNotFound(_0x2eef5b,null))['then'](function(_0x21a41c){if(_0x21a41c){_0x6a90ee=_0x21a41c;_0x1f2816['model']=_[_0x2dca('0x17')](db[_0x2dca('0x36')][_0x2dca('0x13')]);_0x1f2816['query']=_[_0x2dca('0x17')](_0x299360['query']);_0x1f2816[_0x2dca('0x18')]=_[_0x2dca('0x19')](_0x1f2816[_0x2dca('0x1a')],_0x1f2816[_0x2dca('0x16')]);_0x58e8fe[_0x2dca('0x1b')]=_[_0x2dca('0x19')](_0x1f2816[_0x2dca('0x1a')],qs[_0x2dca('0x1c')](_0x299360[_0x2dca('0x16')][_0x2dca('0x1c')]));_0x58e8fe['attributes']=_0x58e8fe[_0x2dca('0x1b')][_0x2dca('0x1d')]?_0x58e8fe[_0x2dca('0x1b')]:_0x1f2816['model'];_0x58e8fe['order']=qs[_0x2dca('0x21')](_0x299360[_0x2dca('0x16')][_0x2dca('0x21')]);_0x58e8fe['where']=qs[_0x2dca('0x18')](_[_0x2dca('0x22')](_0x299360['query'],_0x1f2816[_0x2dca('0x18')]));if(_0x299360[_0x2dca('0x16')][_0x2dca('0x23')]){_0x58e8fe[_0x2dca('0x24')]=_[_0x2dca('0x28')](_0x58e8fe[_0x2dca('0x24')],{'$or':_[_0x2dca('0x25')](_0x58e8fe[_0x2dca('0x1b')],function(_0x4a919a){var _0x18b6a3={};_0x18b6a3[_0x4a919a]={'$like':'%'+_0x299360[_0x2dca('0x16')][_0x2dca('0x23')]+'%'};return _0x18b6a3;})});}_0x58e8fe=_[_0x2dca('0x28')]({},_0x58e8fe,_0x299360['options']);return _0x6a90ee[_0x2dca('0x34')](_0x58e8fe);}})['then'](function(_0x64edf8){if(_0x64edf8){_0xb915d4=_0x64edf8[_0x2dca('0x1d')];if(!_0x299360['query'][_0x2dca('0x1e')](_0x2dca('0x1f'))){_0x58e8fe['limit']=qs[_0x2dca('0xa')](_0x299360['query']['limit']);_0x58e8fe['offset']=qs[_0x2dca('0x7')](_0x299360[_0x2dca('0x16')][_0x2dca('0x7')]);}return _0x6a90ee[_0x2dca('0x34')](_0x58e8fe);}})[_0x2dca('0xc')](function(_0x53ca85){if(_0x53ca85){return _0x53ca85?{'count':_0xb915d4,'rows':_0x53ca85}:null;}})[_0x2dca('0xc')](respondWithResult(_0x2eef5b,null))[_0x2dca('0x32')](handleError(_0x2eef5b,null));};exports[_0x2dca('0x37')]=function(_0x763721,_0x119578){if(_0x763721[_0x2dca('0x31')]['id']){delete _0x763721[_0x2dca('0x31')]['id'];}return db['Dynamics365Account']['findOne']({'where':{'id':_0x763721[_0x2dca('0x33')]['id']}})['then'](handleEntityNotFound(_0x119578,null))['then'](function(_0x41f6e4){if(_0x41f6e4){_0x763721[_0x2dca('0x31')]['AccountId']=_0x41f6e4['id'];_0x763721[_0x2dca('0x31')][_0x2dca('0x38')]=integrations[_0x2dca('0x39')](_0x763721[_0x2dca('0x31')][_0x2dca('0x3a')],_0x763721[_0x2dca('0x31')][_0x2dca('0x26')]);_0x763721[_0x2dca('0x31')][_0x2dca('0x3b')]=integrations[_0x2dca('0x3c')](_0x763721['body'][_0x2dca('0x3a')],_0x763721['body'][_0x2dca('0x26')]);return db[_0x2dca('0x36')][_0x2dca('0x30')](_0x763721[_0x2dca('0x31')],{'include':[{'model':db[_0x2dca('0x3d')],'as':_0x2dca('0x38')},{'model':db[_0x2dca('0x3d')],'as':_0x2dca('0x3b')}]});}return null;})[_0x2dca('0xc')](respondWithResult(_0x119578,null))[_0x2dca('0x32')](handleError(_0x119578,null));};function sanitizeRemoteUri(_0x8e444e){var _0x28be5f=_0x8e444e[_0x2dca('0x3e')](-0x1);if(_0x28be5f==='/')return _0x8e444e[_0x2dca('0x3f')](0x0,_0x8e444e[_0x2dca('0x40')](_0x28be5f));return _0x8e444e;}function getWebApiUrl(_0x19705){return util[_0x2dca('0x41')](_0x2dca('0x42'),_0x19705);}exports['getFields']=function(_0x54bd04,_0x4cb95f){var _0x185340=_0x54bd04['query'][_0x2dca('0x43')];var _0x598731=_0x185340===_0x2dca('0x44')?_0x2dca('0x45'):_0x2dca('0x46');var _0x57c3ce='';var _0x55a083='';var _0x238cf5='';var _0x614b04='';var _0x5c66c8='';var _0x1f8f64='';var _0x5b89c0='';var _0x22a67f='';var _0x3e7bf0=[_0x2dca('0x47'),_0x2dca('0x48'),_0x2dca('0x49'),_0x2dca('0x4a'),_0x2dca('0x4b'),'subject',_0x2dca('0x4c'),'regardingobjectid',_0x2dca('0x4d'),_0x2dca('0x4e')];var _0x26d560=[_0x2dca('0x4f'),_0x2dca('0x50'),_0x2dca('0x51'),_0x2dca('0x52'),'contactidname',_0x2dca('0x53'),_0x2dca('0x54'),_0x2dca('0x55'),_0x2dca('0x56'),_0x2dca('0x57'),_0x2dca('0x58'),_0x2dca('0x59'),_0x2dca('0x5a'),_0x2dca('0x5b'),_0x2dca('0x5c'),_0x2dca('0x5d'),_0x2dca('0x5e'),_0x2dca('0x5f'),_0x2dca('0x60'),'entitlementidname',_0x2dca('0x61'),_0x2dca('0x62'),_0x2dca('0x63'),'exchangerate',_0x2dca('0x64'),_0x2dca('0x65'),_0x2dca('0x66'),'influencescore',_0x2dca('0x67'),_0x2dca('0x68'),'masteridname','modifiedbyexternalpartyname',_0x2dca('0x69'),_0x2dca('0x6a'),_0x2dca('0x6b'),'modifiedon',_0x2dca('0x6c'),_0x2dca('0x6d'),_0x2dca('0x6e'),_0x2dca('0x6f'),'numberofchildincidents',_0x2dca('0x70'),_0x2dca('0x71'),_0x2dca('0x72'),_0x2dca('0x73'),'owneridyominame',_0x2dca('0x74'),_0x2dca('0x75'),'primarycontactidyominame',_0x2dca('0x76'),_0x2dca('0x77'),_0x2dca('0x78'),'resolveby',_0x2dca('0x79'),_0x2dca('0x7a'),_0x2dca('0x7b'),_0x2dca('0x7c'),'sentimentvalue',_0x2dca('0x7d'),_0x2dca('0x7e'),'socialprofileidname',_0x2dca('0x7f'),_0x2dca('0x80'),_0x2dca('0x81'),_0x2dca('0x82'),_0x2dca('0x83'),_0x2dca('0x84'),_0x2dca('0x85'),_0x2dca('0x86'),_0x2dca('0x87')];var _0x54db48=_0x3e7bf0['concat'](_0x26d560);return db[_0x2dca('0x12')][_0x2dca('0x35')]({'where':{'id':_0x54bd04['params']['id']},'attributes':['id',_0x2dca('0x88'),_0x2dca('0x89'),_0x2dca('0x8a'),_0x2dca('0x8b'),_0x2dca('0x8c'),_0x2dca('0x8d'),'modernAuthentication'],'include':[{'model':db[_0x2dca('0x8e')],'as':_0x2dca('0x8e'),'attributes':['id',_0x2dca('0x8f'),_0x2dca('0x90')]}]})[_0x2dca('0xc')](handleEntityNotFound(_0x4cb95f,null))[_0x2dca('0xc')](function(_0x35afd7){if(_0x35afd7){if(_0x35afd7[_0x2dca('0x91')]){_0x35afd7[_0x2dca('0x92')]=_0x35afd7[_0x2dca('0x8e')][_0x2dca('0x8f')];_0x22a67f=sanitizeRemoteUri(_0x35afd7['CloudProvider'][_0x2dca('0x90')]);_0x5b89c0=getWebApiUrl(_0x22a67f);return _0x35afd7;}_0x22a67f=sanitizeRemoteUri(_0x35afd7[_0x2dca('0x8a')]);_0x5b89c0=getWebApiUrl(_0x22a67f);var _0x186601={'method':'POST','uri':'https://login.microsoftonline.com/'+_0x35afd7['tenantId']+_0x2dca('0x93'),'form':{'client_id':_0x35afd7[_0x2dca('0x8c')],'resource':_0x22a67f,'username':_0x35afd7[_0x2dca('0x88')],'password':_0x35afd7[_0x2dca('0x89')],'grant_type':_0x2dca('0x89'),'client_secret':_0x35afd7['clientSecret']},'json':!![]};return rp(_0x186601);}})[_0x2dca('0xc')](function(_0x1c2ca4){_0x1f8f64=_0x1c2ca4[_0x2dca('0x92')];var _0x48534e={'method':_0x2dca('0x94'),'uri':encodeURI(_0x5b89c0+_0x2dca('0x95')+_0x598731+'\x27'),'headers':{'Authorization':_0x2dca('0x96')+_0x1f8f64,'If-None-Match':null,'OData-Version':_0x2dca('0x97')},'json':!![]};return rp(_0x48534e);})[_0x2dca('0xc')](function(_0x3483b1){var _0xc3cf32=_0x3483b1['value'][0x0];var _0x58c309=_0xc3cf32[_0x2dca('0x98')];var _0x418076={'method':'GET','uri':_0x5b89c0+_0x2dca('0x99')+_0x58c309+_0x2dca('0x9a'),'headers':{'Authorization':_0x2dca('0x96')+_0x1f8f64,'If-None-Match':null,'OData-Version':_0x2dca('0x97')},'json':!![]};return rp(_0x418076);})[_0x2dca('0xc')](function(_0x504126){_0x57c3ce=_0x504126;_0x55a083=_0x57c3ce[_0x2dca('0x9b')];_0x55a083=_[_0x2dca('0x9c')](_0x55a083,function(_0x18d64b){return!_0x54db48[_0x2dca('0x9d')](_0x18d64b[_0x2dca('0x9e')]);});var _0x3b8fd=[];var _0x3f5989=[];_0x55a083['forEach'](function(_0xd450ec){if(_0xd450ec[_0x2dca('0x9f')]){var _0x5498cd=_0xd450ec[_0x2dca('0x9f')]['substring'](_0xd450ec[_0x2dca('0x9f')]['lastIndexOf']('.')+0x1);if(_0x5498cd===_0x2dca('0xa0')){_0x3b8fd[_0x2dca('0xa1')](getSelectList(_0x5b89c0,_0x185340,_0x3f5989,_0x57c3ce['MetadataId'],_0xd450ec[_0x2dca('0x98')],_0x1f8f64));}}});return Promise[_0x2dca('0xa2')](_0x3b8fd);})['then'](function(_0x198d40){_0x238cf5=_0x198d40[0x0];var _0x4cb51b=[];var _0x2ffc35=[];_0x55a083[_0x2dca('0xa3')](function(_0xb9d365){if(!_[_0x2dca('0xa4')](_0xb9d365[_0x2dca('0x9f')])){var _0x2338cd=_0xb9d365[_0x2dca('0x9f')][_0x2dca('0x3f')](_0xb9d365[_0x2dca('0x9f')][_0x2dca('0x40')]('.')+0x1);if(_0x2338cd===_0x2dca('0xa5')){_0x4cb51b[_0x2dca('0xa1')](getBooleanList(_0x5b89c0,_0x185340,_0x2ffc35,_0x57c3ce['MetadataId'],_0xb9d365[_0x2dca('0x98')],_0x1f8f64));}}});return Promise[_0x2dca('0xa2')](_0x4cb51b);})[_0x2dca('0xc')](function(_0x3331c6){_0x614b04=_0x3331c6[0x0];var _0x654a5f=[];var _0x2423b1=[];_0x55a083[_0x2dca('0xa3')](function(_0x924f4d){if(_0x924f4d[_0x2dca('0x9f')]){var _0x4488dd=_0x924f4d[_0x2dca('0x9f')][_0x2dca('0x3f')](_0x924f4d[_0x2dca('0x9f')][_0x2dca('0x40')]('.')+0x1);if(_0x4488dd==='StringAttributeMetadata'||_0x4488dd==='DoubleAttributeMetadata'||_0x4488dd===_0x2dca('0xa6')||_0x4488dd===_0x2dca('0xa7')||_0x4488dd===_0x2dca('0xa8')||_0x4488dd===_0x2dca('0xa9')||_0x4488dd==='StatusAttributeMetadata'||_0x4488dd===_0x2dca('0xaa')||_0x4488dd===_0x2dca('0xab')||_0x4488dd==='DecimalAttributeMetadata'){_0x654a5f['push'](getInputList(_0x5b89c0,_0x185340,_0x4488dd,_0x2423b1,_0x57c3ce[_0x2dca('0x98')],_0x924f4d[_0x2dca('0x98')],_0x1f8f64));}}});return Promise['all'](_0x654a5f);})[_0x2dca('0xc')](function(_0x3221d2){_0x5c66c8=_0x3221d2[0x0];var _0x29ae98=_0x238cf5['concat'](_0x614b04)['concat'](_0x5c66c8);var _0x38906d={'count':_0x29ae98[_0x2dca('0x1d')],'rows':_0x29ae98};return _0x38906d;})[_0x2dca('0xc')](respondWithResult(_0x4cb95f,null))['catch'](function(_0x17e307){var _0xa9ee36=_0x54bd04[_0x2dca('0x16')]['test']?0x1f4:_0x17e307[_0x2dca('0xac')]||0x1f4;logger[_0x2dca('0xad')](_0x17e307[_0x2dca('0xae')]);delete _0x17e307[_0x2dca('0xf')];if(_0xa9ee36===0x191){_0xa9ee36=0x190;}_0x4cb95f[_0x2dca('0x5')](_0xa9ee36)[_0x2dca('0x10')](_0x54bd04[_0x2dca('0x16')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x17e307['statusCode']}:_0x17e307);});};function getSelectList(_0x197e48,_0x16aa85,_0x39954e,_0x1f172c,_0x31cfca,_0x229950){var _0x8a7698={'method':_0x2dca('0x94'),'uri':_0x197e48+_0x2dca('0x99')+_0x1f172c+_0x2dca('0xaf')+_0x31cfca+_0x2dca('0xb0')+_0x2dca('0xb1'),'headers':{'Authorization':_0x2dca('0x96')+_0x229950,'If-None-Match':null,'OData-Version':_0x2dca('0x97')},'json':!![]};return rp(_0x8a7698)[_0x2dca('0xc')](function(_0x4ad142){var _0x38e60d=[];var _0x56a132=_0x4ad142[_0x2dca('0xb2')]['Options'];_0x56a132[_0x2dca('0xa3')](function(_0x389e3b){_0x38e60d[_0x2dca('0xa1')]({'name':_0x389e3b[_0x2dca('0xb3')]['UserLocalizedLabel'][_0x2dca('0xb3')],'value':String(_0x389e3b[_0x2dca('0xb4')])});});var _0x51e99f={'id':_0x16aa85+'_'+_0x4ad142['LogicalName'],'name':_0x4ad142[_0x2dca('0xb5')][_0x2dca('0xb6')]['Label'],'custom':![],'options':_0x38e60d};_0x39954e[_0x2dca('0xa1')](_0x51e99f);return _0x39954e;});}function getBooleanList(_0x3539f1,_0x522d49,_0x25a9dc,_0x5f81a8,_0x10504c,_0x2fb42f){var _0x98cc51={'method':_0x2dca('0x94'),'uri':_0x3539f1+_0x2dca('0x99')+_0x5f81a8+_0x2dca('0xaf')+_0x10504c+_0x2dca('0xb7'),'headers':{'Authorization':_0x2dca('0x96')+_0x2fb42f,'If-None-Match':null,'OData-Version':_0x2dca('0x97')},'json':!![]};return rp(_0x98cc51)['then'](function(_0x285464){var _0x3eaef1=[];_0x3eaef1[_0x2dca('0xa1')]({'name':_0x285464[_0x2dca('0xb2')][_0x2dca('0xb8')][_0x2dca('0xb3')][_0x2dca('0xb6')]['Label'],'value':_0x2dca('0xb9')},{'name':_0x285464[_0x2dca('0xb2')]['FalseOption'][_0x2dca('0xb3')]['UserLocalizedLabel']['Label'],'value':'false'});var _0x372a2d={'id':_0x522d49+'_'+_0x285464['LogicalName'],'name':_0x285464[_0x2dca('0xb5')][_0x2dca('0xb6')]['Label'],'custom':![],'options':_0x3eaef1};_0x25a9dc['push'](_0x372a2d);return _0x25a9dc;});}function getInputList(_0x383a77,_0xe2da20,_0x4d4c29,_0x4c93ab,_0xd27508,_0x2519af,_0x140c47){var _0x143074={'method':_0x2dca('0x94'),'uri':_0x383a77+_0x2dca('0x99')+_0xd27508+')/Attributes('+_0x2519af+_0x2dca('0xba')+_0x4d4c29+_0x2dca('0xbb'),'headers':{'Authorization':_0x2dca('0x96')+_0x140c47,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x143074)[_0x2dca('0xc')](function(_0x482a7f){var _0x2c5685={'id':_0xe2da20+'_'+_0x482a7f[_0x2dca('0x9e')],'name':_0x482a7f[_0x2dca('0xb5')]['UserLocalizedLabel']?_0x482a7f[_0x2dca('0xb5')][_0x2dca('0xb6')][_0x2dca('0xb3')]:_0x482a7f[_0x2dca('0x9e')],'custom':![],'options':[]};_0x4c93ab[_0x2dca('0xa1')](_0x2c5685);return _0x4c93ab;});} \ No newline at end of file +var _0x0312=['getDescriptions','Dynamics365Field','slice','lastIndexOf','ticketType','incident','Incident','PhoneCall','title','description','customerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','accountidname','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','customeridname','customeridtype','customeridyominame','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridtype','parentcaseidname','primarycontactidyominame','productidname','resolvebykpiidname','responseby','responsiblecontactidname','sentimentvalue','slaname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','concat','username','password','remoteUri','tenantId','clientId','CloudProvider','data5','data7','modernAuthentication','access_token','POST','https://login.microsoftonline.com/','/oauth2/token','clientSecret','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','PicklistAttributeMetadata','push','MetadataId','all','forEach','isNil','@odata.type','substring','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Options','Label','UserLocalizedLabel',')/Attributes(','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','DisplayName','util','lodash','../../components/parsers/qs','api','../../components/integrations/configuration','status','json','offset','limit','undefined','count','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','index','Dynamics365Account','rawAttributes','type','key','map','query','keys','filters','model','attributes','intersection','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','params','fields','include','find','create','body','getConfigurations','findOne','Dynamics365Configuration','nolimit','Subjects','channel','Descriptions'];(function(_0xbce8a,_0x240b7d){var _0x1daaa8=function(_0x3be06d){while(--_0x3be06d){_0xbce8a['push'](_0xbce8a['shift']());}};_0x1daaa8(++_0x240b7d);}(_0x0312,0x7d));var _0x2031=function(_0x210d5a,_0x1ef622){_0x210d5a=_0x210d5a-0x0;var _0x489236=_0x0312[_0x210d5a];return _0x489236;};'use strict';var rp=require('request-promise');var util=require(_0x2031('0x0'));var _=require(_0x2031('0x1'));var qs=require(_0x2031('0x2'));var logger=require('../../config/logger')(_0x2031('0x3'));var db=require('../../mysqldb')['db'];var integrations=require(_0x2031('0x4'));function respondWithResult(_0x5718dc,_0x5955e0){_0x5955e0=_0x5955e0||0xc8;return function(_0x5293e1){if(_0x5293e1){return _0x5718dc[_0x2031('0x5')](_0x5955e0)[_0x2031('0x6')](_0x5293e1);}};}function respondWithFilteredResult(_0x2c7704,_0x208bc9){return function(_0x1b2e6b){if(_0x1b2e6b){var _0x3c12b5=typeof _0x208bc9[_0x2031('0x7')]==='undefined'&&typeof _0x208bc9[_0x2031('0x8')]===_0x2031('0x9');var _0x4f14cf=_0x1b2e6b[_0x2031('0xa')];var _0x26d6c4=_0x3c12b5?0x0:_0x208bc9[_0x2031('0x7')];var _0x19b688=_0x3c12b5?_0x1b2e6b[_0x2031('0xa')]:_0x208bc9['offset']+_0x208bc9['limit'];var _0x12d02f;if(_0x19b688>=_0x4f14cf){_0x19b688=_0x4f14cf;_0x12d02f=0xc8;}else{_0x12d02f=0xce;}_0x2c7704[_0x2031('0x5')](_0x12d02f);return _0x2c7704['set'](_0x2031('0xb'),_0x26d6c4+'-'+_0x19b688+'/'+_0x4f14cf)[_0x2031('0x6')](_0x1b2e6b);}return null;};}function saveUpdates(_0x5c1d7c){return function(_0x51c032){if(_0x51c032){return _0x51c032[_0x2031('0xc')](_0x5c1d7c)[_0x2031('0xd')](function(_0x104bec){return _0x104bec;});}return null;};}function removeEntity(_0xea2ee6){return function(_0x3a9f3e){if(_0x3a9f3e){return _0x3a9f3e[_0x2031('0xe')]()[_0x2031('0xd')](function(){_0xea2ee6[_0x2031('0x5')](0xcc)[_0x2031('0xf')]();});}};}function handleEntityNotFound(_0x593971){return function(_0x1f668f){if(!_0x1f668f){_0x593971[_0x2031('0x10')](0x194);}return _0x1f668f;};}function handleError(_0x5d64de,_0x42bdaf){_0x42bdaf=_0x42bdaf||0x1f4;return function(_0x53d42f){logger[_0x2031('0x11')](_0x53d42f[_0x2031('0x12')]);if(_0x53d42f[_0x2031('0x13')]){delete _0x53d42f['name'];}_0x5d64de[_0x2031('0x5')](_0x42bdaf)['send'](_0x53d42f);};}exports[_0x2031('0x14')]=function(_0x3a0d06,_0x10bc65){var _0x3d8b66={},_0x5cabc4={},_0x36aa4d={'count':0x0,'rows':[]};var _0x52288d=_['map'](db[_0x2031('0x15')][_0x2031('0x16')],function(_0x2f6ea7){return{'name':_0x2f6ea7['fieldName'],'type':_0x2f6ea7[_0x2031('0x17')][_0x2031('0x18')]};});_0x5cabc4['model']=_[_0x2031('0x19')](_0x52288d,_0x2031('0x13'));_0x5cabc4[_0x2031('0x1a')]=_[_0x2031('0x1b')](_0x3a0d06['query']);_0x5cabc4[_0x2031('0x1c')]=_['intersection'](_0x5cabc4[_0x2031('0x1d')],_0x5cabc4[_0x2031('0x1a')]);_0x3d8b66[_0x2031('0x1e')]=_[_0x2031('0x1f')](_0x5cabc4[_0x2031('0x1d')],qs['fields'](_0x3a0d06[_0x2031('0x1a')]['fields']));_0x3d8b66['attributes']=_0x3d8b66[_0x2031('0x1e')][_0x2031('0x20')]?_0x3d8b66['attributes']:_0x5cabc4[_0x2031('0x1d')];if(!_0x3a0d06[_0x2031('0x1a')][_0x2031('0x21')]('nolimit')){_0x3d8b66[_0x2031('0x8')]=qs['limit'](_0x3a0d06[_0x2031('0x1a')][_0x2031('0x8')]);_0x3d8b66[_0x2031('0x7')]=qs['offset'](_0x3a0d06[_0x2031('0x1a')][_0x2031('0x7')]);}_0x3d8b66[_0x2031('0x22')]=qs[_0x2031('0x23')](_0x3a0d06[_0x2031('0x1a')][_0x2031('0x23')]);_0x3d8b66['where']=qs[_0x2031('0x1c')](_[_0x2031('0x24')](_0x3a0d06[_0x2031('0x1a')],_0x5cabc4[_0x2031('0x1c')]),_0x52288d);if(_0x3a0d06[_0x2031('0x1a')]['filter']){_0x3d8b66[_0x2031('0x25')]=_[_0x2031('0x26')](_0x3d8b66[_0x2031('0x25')],{'$or':_[_0x2031('0x19')](_0x52288d,function(_0x4e35a9){if(_0x4e35a9[_0x2031('0x17')]!==_0x2031('0x27')){var _0x480ab3={};_0x480ab3[_0x4e35a9[_0x2031('0x13')]]={'$like':'%'+_0x3a0d06['query'][_0x2031('0x28')]+'%'};return _0x480ab3;}})});}_0x3d8b66=_['merge']({},_0x3d8b66,_0x3a0d06[_0x2031('0x29')]);var _0x5508de={'where':_0x3d8b66['where']};return db['Dynamics365Account'][_0x2031('0xa')](_0x5508de)[_0x2031('0xd')](function(_0x1a06f0){_0x36aa4d[_0x2031('0xa')]=_0x1a06f0;if(_0x3a0d06[_0x2031('0x1a')][_0x2031('0x2a')]){_0x3d8b66['include']=[{'all':!![]}];}return db[_0x2031('0x15')][_0x2031('0x2b')](_0x3d8b66);})[_0x2031('0xd')](function(_0x99ddb2){_0x36aa4d[_0x2031('0x2c')]=_0x99ddb2;return _0x36aa4d;})['then'](respondWithFilteredResult(_0x10bc65,_0x3d8b66))[_0x2031('0x2d')](handleError(_0x10bc65,null));};exports['show']=function(_0x43b7b6,_0x256ec5){var _0xb61876={'raw':![],'where':{'id':_0x43b7b6[_0x2031('0x2e')]['id']}},_0xdbdd28={};_0xdbdd28[_0x2031('0x1d')]=_['keys'](db[_0x2031('0x15')][_0x2031('0x16')]);_0xdbdd28[_0x2031('0x1a')]=_[_0x2031('0x1b')](_0x43b7b6[_0x2031('0x1a')]);_0xdbdd28['filters']=_[_0x2031('0x1f')](_0xdbdd28[_0x2031('0x1d')],_0xdbdd28['query']);_0xb61876[_0x2031('0x1e')]=_[_0x2031('0x1f')](_0xdbdd28[_0x2031('0x1d')],qs[_0x2031('0x2f')](_0x43b7b6['query'][_0x2031('0x2f')]));_0xb61876[_0x2031('0x1e')]=_0xb61876[_0x2031('0x1e')][_0x2031('0x20')]?_0xb61876[_0x2031('0x1e')]:_0xdbdd28[_0x2031('0x1d')];if(_0x43b7b6[_0x2031('0x1a')]['includeAll']){_0xb61876[_0x2031('0x30')]=[{'all':!![]}];}_0xb61876=_[_0x2031('0x26')]({},_0xb61876,_0x43b7b6[_0x2031('0x29')]);return db[_0x2031('0x15')][_0x2031('0x31')](_0xb61876)[_0x2031('0xd')](handleEntityNotFound(_0x256ec5,null))['then'](respondWithResult(_0x256ec5,null))[_0x2031('0x2d')](handleError(_0x256ec5,null));};exports[_0x2031('0x32')]=function(_0x4bb8ff,_0x55d43f){return db[_0x2031('0x15')][_0x2031('0x32')](_0x4bb8ff[_0x2031('0x33')],{})['then'](respondWithResult(_0x55d43f,0xc9))[_0x2031('0x2d')](handleError(_0x55d43f,null));};exports[_0x2031('0xc')]=function(_0x3e396f,_0x1c8df9){if(_0x3e396f[_0x2031('0x33')]['id']){delete _0x3e396f[_0x2031('0x33')]['id'];}return db['Dynamics365Account'][_0x2031('0x31')]({'where':{'id':_0x3e396f['params']['id']}})[_0x2031('0xd')](handleEntityNotFound(_0x1c8df9,null))[_0x2031('0xd')](saveUpdates(_0x3e396f['body'],null))['then'](respondWithResult(_0x1c8df9,null))[_0x2031('0x2d')](handleError(_0x1c8df9,null));};exports[_0x2031('0xe')]=function(_0x2fedc5,_0x5bad37){return db[_0x2031('0x15')][_0x2031('0x31')]({'where':{'id':_0x2fedc5['params']['id']}})[_0x2031('0xd')](handleEntityNotFound(_0x5bad37,null))['then'](removeEntity(_0x5bad37,null))['catch'](handleError(_0x5bad37,null));};exports[_0x2031('0x34')]=function(_0x498060,_0x251c68){var _0x5a6d08={};var _0x4ac6fe={};var _0x33a892;var _0x3a2acd;return db['Dynamics365Account'][_0x2031('0x35')]({'where':{'id':_0x498060[_0x2031('0x2e')]['id']}})[_0x2031('0xd')](handleEntityNotFound(_0x251c68,null))[_0x2031('0xd')](function(_0x14e2eb){if(_0x14e2eb){_0x33a892=_0x14e2eb;_0x4ac6fe[_0x2031('0x1d')]=_[_0x2031('0x1b')](db[_0x2031('0x36')][_0x2031('0x16')]);_0x4ac6fe[_0x2031('0x1a')]=_[_0x2031('0x1b')](_0x498060['query']);_0x4ac6fe[_0x2031('0x1c')]=_[_0x2031('0x1f')](_0x4ac6fe[_0x2031('0x1d')],_0x4ac6fe[_0x2031('0x1a')]);_0x5a6d08[_0x2031('0x1e')]=_['intersection'](_0x4ac6fe[_0x2031('0x1d')],qs[_0x2031('0x2f')](_0x498060[_0x2031('0x1a')][_0x2031('0x2f')]));_0x5a6d08[_0x2031('0x1e')]=_0x5a6d08[_0x2031('0x1e')][_0x2031('0x20')]?_0x5a6d08[_0x2031('0x1e')]:_0x4ac6fe[_0x2031('0x1d')];_0x5a6d08[_0x2031('0x22')]=qs[_0x2031('0x23')](_0x498060['query']['sort']);_0x5a6d08[_0x2031('0x25')]=qs['filters'](_['pick'](_0x498060['query'],_0x4ac6fe[_0x2031('0x1c')]));if(_0x498060[_0x2031('0x1a')][_0x2031('0x28')]){_0x5a6d08['where']=_['merge'](_0x5a6d08[_0x2031('0x25')],{'$or':_[_0x2031('0x19')](_0x5a6d08['attributes'],function(_0x26b39a){var _0x3dc070={};_0x3dc070[_0x26b39a]={'$like':'%'+_0x498060[_0x2031('0x1a')][_0x2031('0x28')]+'%'};return _0x3dc070;})});}_0x5a6d08=_[_0x2031('0x26')]({},_0x5a6d08,_0x498060[_0x2031('0x29')]);return _0x33a892[_0x2031('0x34')](_0x5a6d08);}})[_0x2031('0xd')](function(_0xf86d2){if(_0xf86d2){_0x3a2acd=_0xf86d2['length'];if(!_0x498060['query']['hasOwnProperty'](_0x2031('0x37'))){_0x5a6d08[_0x2031('0x8')]=qs[_0x2031('0x8')](_0x498060[_0x2031('0x1a')][_0x2031('0x8')]);_0x5a6d08['offset']=qs[_0x2031('0x7')](_0x498060[_0x2031('0x1a')]['offset']);}return _0x33a892['getConfigurations'](_0x5a6d08);}})[_0x2031('0xd')](function(_0x31a838){if(_0x31a838){return _0x31a838?{'count':_0x3a2acd,'rows':_0x31a838}:null;}})[_0x2031('0xd')](respondWithResult(_0x251c68,null))[_0x2031('0x2d')](handleError(_0x251c68,null));};exports['addConfiguration']=function(_0x267758,_0x48f1bf){if(_0x267758['body']['id']){delete _0x267758['body']['id'];}return db[_0x2031('0x15')][_0x2031('0x35')]({'where':{'id':_0x267758[_0x2031('0x2e')]['id']}})[_0x2031('0xd')](handleEntityNotFound(_0x48f1bf,null))[_0x2031('0xd')](function(_0x4de4d8){if(_0x4de4d8){_0x267758[_0x2031('0x33')]['AccountId']=_0x4de4d8['id'];_0x267758[_0x2031('0x33')][_0x2031('0x38')]=integrations['getSubjects'](_0x267758[_0x2031('0x33')][_0x2031('0x39')],_0x267758['body'][_0x2031('0x17')]);_0x267758[_0x2031('0x33')][_0x2031('0x3a')]=integrations[_0x2031('0x3b')](_0x267758[_0x2031('0x33')][_0x2031('0x39')],_0x267758[_0x2031('0x33')][_0x2031('0x17')]);return db[_0x2031('0x36')][_0x2031('0x32')](_0x267758['body'],{'include':[{'model':db[_0x2031('0x3c')],'as':_0x2031('0x38')},{'model':db[_0x2031('0x3c')],'as':_0x2031('0x3a')}]});}return null;})['then'](respondWithResult(_0x48f1bf,null))[_0x2031('0x2d')](handleError(_0x48f1bf,null));};function sanitizeRemoteUri(_0x45dcef){var _0x52d761=_0x45dcef[_0x2031('0x3d')](-0x1);if(_0x52d761==='/')return _0x45dcef['substring'](0x0,_0x45dcef[_0x2031('0x3e')](_0x52d761));return _0x45dcef;}function getWebApiUrl(_0x299356){return util['format']('%s/api/data/v9.0/',_0x299356);}exports['getFields']=function(_0x48a486,_0x2d57c6){var _0x4a36f9=_0x48a486[_0x2031('0x1a')][_0x2031('0x3f')];var _0x4a690c=_0x4a36f9===_0x2031('0x40')?_0x2031('0x41'):_0x2031('0x42');var _0x213db6='';var _0x28cf5b='';var _0x3f6096='';var _0x62d238='';var _0x9a8cfc='';var _0x178fc4='';var _0x4476cf='';var _0x3df746='';var _0x161d3f=[_0x2031('0x43'),_0x2031('0x44'),_0x2031('0x45'),'ownerid',_0x2031('0x46'),_0x2031('0x47'),_0x2031('0x48'),_0x2031('0x49'),_0x2031('0x4a'),'phonecall_activity_parties'];var _0x3b4706=[_0x2031('0x4b'),'accountidyominame',_0x2031('0x4c'),_0x2031('0x4d'),'contactidname',_0x2031('0x4e'),_0x2031('0x4f'),_0x2031('0x50'),'createdbyexternalpartyname',_0x2031('0x51'),_0x2031('0x52'),_0x2031('0x53'),_0x2031('0x54'),_0x2031('0x55'),'createdonbehalfbyyominame',_0x2031('0x56'),_0x2031('0x57'),_0x2031('0x58'),'emailaddress','entitlementidname',_0x2031('0x59'),_0x2031('0x5a'),_0x2031('0x5b'),_0x2031('0x5c'),_0x2031('0x5d'),_0x2031('0x5e'),_0x2031('0x5f'),_0x2031('0x60'),_0x2031('0x61'),_0x2031('0x62'),'masteridname',_0x2031('0x63'),_0x2031('0x64'),_0x2031('0x65'),'modifiedbyyominame',_0x2031('0x66'),_0x2031('0x67'),_0x2031('0x68'),_0x2031('0x69'),'msdyn_iotalertname',_0x2031('0x6a'),_0x2031('0x6b'),_0x2031('0x6c'),'owneridname',_0x2031('0x6d'),'owneridyominame',_0x2031('0x6e'),'primarycontactidname',_0x2031('0x6f'),'prioritycodename',_0x2031('0x70'),'productserialnumber','resolveby',_0x2031('0x71'),_0x2031('0x72'),_0x2031('0x73'),'responsiblecontactidyominame',_0x2031('0x74'),'slainvokedidname',_0x2031('0x75'),'socialprofileidname',_0x2031('0x76'),_0x2031('0x77'),_0x2031('0x78'),_0x2031('0x79'),_0x2031('0x7a'),'transactioncurrencyidname',_0x2031('0x7b'),_0x2031('0x7c'),'versionnumber'];var _0x40921b=_0x161d3f[_0x2031('0x7d')](_0x3b4706);return db[_0x2031('0x15')][_0x2031('0x35')]({'where':{'id':_0x48a486['params']['id']},'attributes':['id',_0x2031('0x7e'),_0x2031('0x7f'),_0x2031('0x80'),_0x2031('0x81'),_0x2031('0x82'),'clientSecret','modernAuthentication'],'include':[{'model':db[_0x2031('0x83')],'as':'CloudProvider','attributes':['id',_0x2031('0x84'),_0x2031('0x85')]}]})[_0x2031('0xd')](handleEntityNotFound(_0x2d57c6,null))['then'](function(_0xa73f2a){if(_0xa73f2a){if(_0xa73f2a[_0x2031('0x86')]){_0xa73f2a[_0x2031('0x87')]=_0xa73f2a['CloudProvider'][_0x2031('0x84')];_0x3df746=sanitizeRemoteUri(_0xa73f2a['CloudProvider']['data7']);_0x4476cf=getWebApiUrl(_0x3df746);return _0xa73f2a;}_0x3df746=sanitizeRemoteUri(_0xa73f2a[_0x2031('0x80')]);_0x4476cf=getWebApiUrl(_0x3df746);var _0xa50a0c={'method':_0x2031('0x88'),'uri':_0x2031('0x89')+_0xa73f2a[_0x2031('0x81')]+_0x2031('0x8a'),'form':{'client_id':_0xa73f2a[_0x2031('0x82')],'resource':_0x3df746,'username':_0xa73f2a[_0x2031('0x7e')],'password':_0xa73f2a[_0x2031('0x7f')],'grant_type':_0x2031('0x7f'),'client_secret':_0xa73f2a[_0x2031('0x8b')]},'json':!![]};return rp(_0xa50a0c);}})[_0x2031('0xd')](function(_0x57baab){_0x178fc4=_0x57baab['access_token'];var _0x3a00c4={'method':_0x2031('0x8c'),'uri':encodeURI(_0x4476cf+_0x2031('0x8d')+_0x4a690c+'\x27'),'headers':{'Authorization':_0x2031('0x8e')+_0x178fc4,'If-None-Match':null,'OData-Version':_0x2031('0x8f')},'json':!![]};return rp(_0x3a00c4);})[_0x2031('0xd')](function(_0x28f7fa){var _0x23b88f=_0x28f7fa[_0x2031('0x90')][0x0];var _0x478a4d=_0x23b88f['MetadataId'];var _0x3ebd8b={'method':_0x2031('0x8c'),'uri':_0x4476cf+_0x2031('0x91')+_0x478a4d+_0x2031('0x92'),'headers':{'Authorization':'Bearer\x20'+_0x178fc4,'If-None-Match':null,'OData-Version':_0x2031('0x8f')},'json':!![]};return rp(_0x3ebd8b);})[_0x2031('0xd')](function(_0x43e0b3){_0x213db6=_0x43e0b3;_0x28cf5b=_0x213db6[_0x2031('0x93')];_0x28cf5b=_[_0x2031('0x94')](_0x28cf5b,function(_0x40033a){return!_0x40921b[_0x2031('0x95')](_0x40033a[_0x2031('0x96')]);});var _0x3b6a90=[];var _0x43fe3a=[];_0x28cf5b['forEach'](function(_0x503dbc){if(_0x503dbc['@odata.type']){var _0x753997=_0x503dbc['@odata.type']['substring'](_0x503dbc['@odata.type'][_0x2031('0x3e')]('.')+0x1);if(_0x753997===_0x2031('0x97')){_0x3b6a90[_0x2031('0x98')](getSelectList(_0x4476cf,_0x4a36f9,_0x43fe3a,_0x213db6[_0x2031('0x99')],_0x503dbc[_0x2031('0x99')],_0x178fc4));}}});return Promise[_0x2031('0x9a')](_0x3b6a90);})[_0x2031('0xd')](function(_0x465073){_0x3f6096=_0x465073[0x0];var _0x59be46=[];var _0x21b4c8=[];_0x28cf5b[_0x2031('0x9b')](function(_0x23a332){if(!_[_0x2031('0x9c')](_0x23a332[_0x2031('0x9d')])){var _0x563b32=_0x23a332['@odata.type'][_0x2031('0x9e')](_0x23a332[_0x2031('0x9d')][_0x2031('0x3e')]('.')+0x1);if(_0x563b32===_0x2031('0x9f')){_0x59be46[_0x2031('0x98')](getBooleanList(_0x4476cf,_0x4a36f9,_0x21b4c8,_0x213db6['MetadataId'],_0x23a332[_0x2031('0x99')],_0x178fc4));}}});return Promise[_0x2031('0x9a')](_0x59be46);})[_0x2031('0xd')](function(_0x22f223){_0x62d238=_0x22f223[0x0];var _0x482319=[];var _0x892ab5=[];_0x28cf5b[_0x2031('0x9b')](function(_0x503ecc){if(_0x503ecc[_0x2031('0x9d')]){var _0x262fda=_0x503ecc['@odata.type']['substring'](_0x503ecc[_0x2031('0x9d')][_0x2031('0x3e')]('.')+0x1);if(_0x262fda===_0x2031('0xa0')||_0x262fda===_0x2031('0xa1')||_0x262fda===_0x2031('0xa2')||_0x262fda==='IntegerAttributeMetadata'||_0x262fda===_0x2031('0xa3')||_0x262fda==='DateTimeAttributeMetadata'||_0x262fda===_0x2031('0xa4')||_0x262fda===_0x2031('0xa5')||_0x262fda===_0x2031('0xa6')||_0x262fda===_0x2031('0xa7')){_0x482319['push'](getInputList(_0x4476cf,_0x4a36f9,_0x262fda,_0x892ab5,_0x213db6['MetadataId'],_0x503ecc[_0x2031('0x99')],_0x178fc4));}}});return Promise[_0x2031('0x9a')](_0x482319);})[_0x2031('0xd')](function(_0x30f4ca){_0x9a8cfc=_0x30f4ca[0x0];var _0x3a3dc6=_0x3f6096[_0x2031('0x7d')](_0x62d238)[_0x2031('0x7d')](_0x9a8cfc);var _0x1a0f6b={'count':_0x3a3dc6[_0x2031('0x20')],'rows':_0x3a3dc6};return _0x1a0f6b;})['then'](respondWithResult(_0x2d57c6,null))[_0x2031('0x2d')](function(_0x558d63){var _0x5d3da1=_0x48a486[_0x2031('0x1a')][_0x2031('0xa8')]?0x1f4:_0x558d63[_0x2031('0xa9')]||0x1f4;logger['error'](_0x558d63['stack']);delete _0x558d63[_0x2031('0x13')];if(_0x5d3da1===0x191){_0x5d3da1=0x190;}_0x2d57c6[_0x2031('0x5')](_0x5d3da1)['send'](_0x48a486[_0x2031('0x1a')][_0x2031('0xa8')]?{'message':_0x2031('0xaa'),'statusCode':_0x558d63[_0x2031('0xa9')]}:_0x558d63);});};function getSelectList(_0x4d8d56,_0x10176d,_0x4a11f7,_0x1d7a98,_0xe59306,_0x42e0a9){var _0x32c997={'method':'GET','uri':_0x4d8d56+'EntityDefinitions('+_0x1d7a98+')/Attributes('+_0xe59306+_0x2031('0xab')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x2031('0x8e')+_0x42e0a9,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x32c997)[_0x2031('0xd')](function(_0x2d63db){var _0x2f1cee=[];var _0x362a44=_0x2d63db[_0x2031('0xac')][_0x2031('0xad')];_0x362a44[_0x2031('0x9b')](function(_0x22d787){_0x2f1cee['push']({'name':_0x22d787[_0x2031('0xae')][_0x2031('0xaf')][_0x2031('0xae')],'value':String(_0x22d787['Value'])});});var _0x343fc6={'id':_0x10176d+'_'+_0x2d63db[_0x2031('0x96')],'name':_0x2d63db['DisplayName']['UserLocalizedLabel'][_0x2031('0xae')],'custom':![],'options':_0x2f1cee};_0x4a11f7[_0x2031('0x98')](_0x343fc6);return _0x4a11f7;});}function getBooleanList(_0xd34704,_0xcffe7c,_0x41d45c,_0xd4691c,_0x20b264,_0x2b7ffc){var _0x4526ec={'method':'GET','uri':_0xd34704+_0x2031('0x91')+_0xd4691c+_0x2031('0xb0')+_0x20b264+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x2031('0x8e')+_0x2b7ffc,'If-None-Match':null,'OData-Version':_0x2031('0x8f')},'json':!![]};return rp(_0x4526ec)['then'](function(_0x51b394){var _0x24cf6b=[];_0x24cf6b['push']({'name':_0x51b394[_0x2031('0xac')][_0x2031('0xb1')][_0x2031('0xae')][_0x2031('0xaf')]['Label'],'value':_0x2031('0xb2')},{'name':_0x51b394[_0x2031('0xac')][_0x2031('0xb3')][_0x2031('0xae')]['UserLocalizedLabel']['Label'],'value':_0x2031('0xb4')});var _0x1a1491={'id':_0xcffe7c+'_'+_0x51b394['LogicalName'],'name':_0x51b394['DisplayName']['UserLocalizedLabel']['Label'],'custom':![],'options':_0x24cf6b};_0x41d45c['push'](_0x1a1491);return _0x41d45c;});}function getInputList(_0x26c40a,_0x5030dd,_0x23bf9a,_0x35c219,_0x79d392,_0x2a3c71,_0x86424b){var _0x50aefb={'method':_0x2031('0x8c'),'uri':_0x26c40a+_0x2031('0x91')+_0x79d392+')/Attributes('+_0x2a3c71+_0x2031('0xb5')+_0x23bf9a+_0x2031('0xb6'),'headers':{'Authorization':_0x2031('0x8e')+_0x86424b,'If-None-Match':null,'OData-Version':_0x2031('0x8f')},'json':!![]};return rp(_0x50aefb)['then'](function(_0x2ee360){var _0x51b1b6={'id':_0x5030dd+'_'+_0x2ee360[_0x2031('0x96')],'name':_0x2ee360[_0x2031('0xb7')][_0x2031('0xaf')]?_0x2ee360[_0x2031('0xb7')][_0x2031('0xaf')][_0x2031('0xae')]:_0x2ee360['LogicalName'],'custom':![],'options':[]};_0x35c219[_0x2031('0x98')](_0x51b1b6);return _0x35c219;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index c9594e9..1f30f1b 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 _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xf71f73,_0xdd34e9){var _0xe2021c=function(_0x5ec1c4){while(--_0x5ec1c4){_0xf71f73['push'](_0xf71f73['shift']());}};_0xe2021c(++_0xdd34e9);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0d8b('0x7')]=function(_0x227c63,_0x39f43a){return _0x227c63['define'](_0x0d8b('0x8'),attributes,{'tableName':_0x0d8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x4a9c61,_0x35cbcc){var _0x545910=function(_0x5d971f){while(--_0x5d971f){_0x4a9c61['push'](_0x4a9c61['shift']());}};_0x545910(++_0x35cbcc);}(_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'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','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 f8f4952..b2632e2 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 _0xa9d8=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','attributes','limit','include','map','model','ShowDynamics365Account','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x2ff5c1,_0x257e33){var _0x1fb279=function(_0x1930ee){while(--_0x1930ee){_0x2ff5c1['push'](_0x2ff5c1['shift']());}};_0x1fb279(++_0x257e33);}(_0xa9d8,0x1b5));var _0x8a9d=function(_0x2a7d88,_0x655229){_0x2a7d88=_0x2a7d88-0x0;var _0x26a5bb=_0xa9d8[_0x2a7d88];return _0x26a5bb;};'use strict';var _=require(_0x8a9d('0x0'));var util=require(_0x8a9d('0x1'));var moment=require(_0x8a9d('0x2'));var BPromise=require(_0x8a9d('0x3'));var rs=require(_0x8a9d('0x4'));var fs=require('fs');var Redis=require(_0x8a9d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8a9d('0x6'));var logger=require(_0x8a9d('0x7'))(_0x8a9d('0x8'));var config=require(_0x8a9d('0x9'));var jayson=require(_0x8a9d('0xa'));var client=jayson[_0x8a9d('0xb')][_0x8a9d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2d0065,_0x211ca4,_0x2f45d2){return new BPromise(function(_0x1db955,_0x2c79b1){return client['request'](_0x2d0065,_0x2f45d2)[_0x8a9d('0xd')](function(_0x16d428){logger[_0x8a9d('0xe')]('Dynamics365Account,\x20%s,\x20%s',_0x211ca4,_0x8a9d('0xf'));logger[_0x8a9d('0x10')](_0x8a9d('0x11'),_0x211ca4,'request\x20sent',JSON[_0x8a9d('0x12')](_0x16d428));if(_0x16d428[_0x8a9d('0x13')]){if(_0x16d428[_0x8a9d('0x13')][_0x8a9d('0x14')]===0x1f4){logger[_0x8a9d('0x13')](_0x8a9d('0x15'),_0x211ca4,_0x16d428[_0x8a9d('0x13')][_0x8a9d('0x16')]);return _0x2c79b1(_0x16d428[_0x8a9d('0x13')][_0x8a9d('0x16')]);}logger[_0x8a9d('0x13')](_0x8a9d('0x15'),_0x211ca4,_0x16d428[_0x8a9d('0x13')][_0x8a9d('0x16')]);return _0x1db955(_0x16d428[_0x8a9d('0x13')][_0x8a9d('0x16')]);}else{logger['info'](_0x8a9d('0x15'),_0x211ca4,_0x8a9d('0xf'));_0x1db955(_0x16d428[_0x8a9d('0x17')][_0x8a9d('0x16')]);}})[_0x8a9d('0x18')](function(_0x2fb44b){logger['error'](_0x8a9d('0x15'),_0x211ca4,_0x2fb44b);_0x2c79b1(_0x2fb44b);});});}exports[_0x8a9d('0x19')]=function(_0x87ec6){var _0xbaed12=this;return new Promise(function(_0x562a38,_0x2ef3ff){return db[_0x8a9d('0x1a')][_0x8a9d('0x1b')]({'raw':_0x87ec6[_0x8a9d('0x1c')]?_0x87ec6[_0x8a9d('0x1c')][_0x8a9d('0x1d')]===undefined?!![]:![]:!![],'where':_0x87ec6[_0x8a9d('0x1c')]?_0x87ec6[_0x8a9d('0x1c')]['where']||null:null,'attributes':_0x87ec6[_0x8a9d('0x1c')]?_0x87ec6['options'][_0x8a9d('0x1e')]||null:null,'limit':_0x87ec6['options']?_0x87ec6[_0x8a9d('0x1c')][_0x8a9d('0x1f')]||null:null,'include':_0x87ec6[_0x8a9d('0x1c')]?_0x87ec6[_0x8a9d('0x1c')][_0x8a9d('0x20')]?_[_0x8a9d('0x21')](_0x87ec6[_0x8a9d('0x1c')][_0x8a9d('0x20')],function(_0xd52401){return{'model':db[_0xd52401[_0x8a9d('0x22')]],'as':_0xd52401['as'],'attributes':_0xd52401['attributes'],'include':_0xd52401[_0x8a9d('0x20')]?_[_0x8a9d('0x21')](_0xd52401[_0x8a9d('0x20')],function(_0x4f7f3d){return{'model':db[_0x4f7f3d[_0x8a9d('0x22')]],'as':_0x4f7f3d['as'],'attributes':_0x4f7f3d['attributes'],'include':_0x4f7f3d['include']?_['map'](_0x4f7f3d[_0x8a9d('0x20')],function(_0x36e2c3){return{'model':db[_0x36e2c3[_0x8a9d('0x22')]],'as':_0x36e2c3['as'],'attributes':_0x36e2c3[_0x8a9d('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5075e6){logger[_0x8a9d('0xe')](_0x8a9d('0x19'),_0x87ec6);logger['debug'](_0x8a9d('0x19'),_0x87ec6,JSON[_0x8a9d('0x12')](_0x5075e6));_0x562a38(_0x5075e6);})[_0x8a9d('0x18')](function(_0x3b050c){logger[_0x8a9d('0x13')](_0x8a9d('0x19'),_0x3b050c['message'],_0x87ec6);_0x2ef3ff(_0xbaed12[_0x8a9d('0x13')](0x1f4,_0x3b050c[_0x8a9d('0x16')]));});});};exports[_0x8a9d('0x23')]=function(_0x1035c3){var _0x5a122f=this;return new Promise(function(_0x4e9111,_0x3883fd){return db['Dynamics365Account'][_0x8a9d('0x24')]({'raw':_0x1035c3[_0x8a9d('0x1c')]?_0x1035c3[_0x8a9d('0x1c')][_0x8a9d('0x1d')]===undefined?!![]:![]:!![],'where':_0x1035c3['options']?_0x1035c3[_0x8a9d('0x1c')]['where']||null:null,'attributes':_0x1035c3[_0x8a9d('0x1c')]?_0x1035c3['options']['attributes']||null:null,'include':_0x1035c3[_0x8a9d('0x1c')]?_0x1035c3['options'][_0x8a9d('0x20')]?_[_0x8a9d('0x21')](_0x1035c3['options']['include'],function(_0xc9ed52){return{'model':db[_0xc9ed52[_0x8a9d('0x22')]],'as':_0xc9ed52['as'],'attributes':_0xc9ed52[_0x8a9d('0x1e')],'include':_0xc9ed52[_0x8a9d('0x20')]?_[_0x8a9d('0x21')](_0xc9ed52[_0x8a9d('0x20')],function(_0x357c36){return{'model':db[_0x357c36[_0x8a9d('0x22')]],'as':_0x357c36['as'],'attributes':_0x357c36[_0x8a9d('0x1e')],'include':_0x357c36[_0x8a9d('0x20')]?_[_0x8a9d('0x21')](_0x357c36[_0x8a9d('0x20')],function(_0x23ce4d){return{'model':db[_0x23ce4d[_0x8a9d('0x22')]],'as':_0x23ce4d['as'],'attributes':_0x23ce4d[_0x8a9d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8a9d('0xd')](function(_0x79c925){logger[_0x8a9d('0xe')](_0x8a9d('0x23'),_0x1035c3);logger['debug']('ShowDynamics365Account',_0x1035c3,JSON[_0x8a9d('0x12')](_0x79c925));_0x4e9111(_0x79c925);})['catch'](function(_0xbb9100){logger[_0x8a9d('0x13')](_0x8a9d('0x23'),_0xbb9100[_0x8a9d('0x16')],_0x1035c3);_0x3883fd(_0x5a122f[_0x8a9d('0x13')](0x1f4,_0xbb9100[_0x8a9d('0x16')]));});});}; \ No newline at end of file +var _0xccdb=['then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','options','raw','where','attributes','include','map','model','ShowDynamics365Account','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x3e6cc8,_0x7c29e0){var _0x59bdc2=function(_0x812951){while(--_0x812951){_0x3e6cc8['push'](_0x3e6cc8['shift']());}};_0x59bdc2(++_0x7c29e0);}(_0xccdb,0x13f));var _0xbccd=function(_0x4c2249,_0x3a67a9){_0x4c2249=_0x4c2249-0x0;var _0x126d3c=_0xccdb[_0x4c2249];return _0x126d3c;};'use strict';var _=require('lodash');var util=require(_0xbccd('0x0'));var moment=require(_0xbccd('0x1'));var BPromise=require(_0xbccd('0x2'));var rs=require(_0xbccd('0x3'));var fs=require('fs');var Redis=require(_0xbccd('0x4'));var db=require(_0xbccd('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbccd('0x6'))(_0xbccd('0x7'));var config=require(_0xbccd('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbccd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1fc980,_0x47a174,_0x18698d){return new BPromise(function(_0x4afaab,_0x5c4ba8){return client[_0xbccd('0xa')](_0x1fc980,_0x18698d)[_0xbccd('0xb')](function(_0x194295){logger[_0xbccd('0xc')](_0xbccd('0xd'),_0x47a174,_0xbccd('0xe'));logger[_0xbccd('0xf')](_0xbccd('0x10'),_0x47a174,_0xbccd('0xe'),JSON[_0xbccd('0x11')](_0x194295));if(_0x194295[_0xbccd('0x12')]){if(_0x194295[_0xbccd('0x12')][_0xbccd('0x13')]===0x1f4){logger[_0xbccd('0x12')](_0xbccd('0xd'),_0x47a174,_0x194295['error'][_0xbccd('0x14')]);return _0x5c4ba8(_0x194295[_0xbccd('0x12')]['message']);}logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x47a174,_0x194295['error'][_0xbccd('0x14')]);return _0x4afaab(_0x194295[_0xbccd('0x12')][_0xbccd('0x14')]);}else{logger[_0xbccd('0xc')](_0xbccd('0xd'),_0x47a174,_0xbccd('0xe'));_0x4afaab(_0x194295[_0xbccd('0x15')][_0xbccd('0x14')]);}})[_0xbccd('0x16')](function(_0xee4829){logger[_0xbccd('0x12')](_0xbccd('0xd'),_0x47a174,_0xee4829);_0x5c4ba8(_0xee4829);});});}exports[_0xbccd('0x17')]=function(_0x5b929c){var _0x12df0a=this;return new Promise(function(_0x420163,_0x17d73b){return db[_0xbccd('0x18')]['findAll']({'raw':_0x5b929c[_0xbccd('0x19')]?_0x5b929c[_0xbccd('0x19')][_0xbccd('0x1a')]===undefined?!![]:![]:!![],'where':_0x5b929c[_0xbccd('0x19')]?_0x5b929c[_0xbccd('0x19')][_0xbccd('0x1b')]||null:null,'attributes':_0x5b929c['options']?_0x5b929c[_0xbccd('0x19')][_0xbccd('0x1c')]||null:null,'limit':_0x5b929c[_0xbccd('0x19')]?_0x5b929c['options']['limit']||null:null,'include':_0x5b929c[_0xbccd('0x19')]?_0x5b929c[_0xbccd('0x19')][_0xbccd('0x1d')]?_[_0xbccd('0x1e')](_0x5b929c[_0xbccd('0x19')][_0xbccd('0x1d')],function(_0x5e44c8){return{'model':db[_0x5e44c8[_0xbccd('0x1f')]],'as':_0x5e44c8['as'],'attributes':_0x5e44c8[_0xbccd('0x1c')],'include':_0x5e44c8['include']?_[_0xbccd('0x1e')](_0x5e44c8[_0xbccd('0x1d')],function(_0x7d16e8){return{'model':db[_0x7d16e8[_0xbccd('0x1f')]],'as':_0x7d16e8['as'],'attributes':_0x7d16e8['attributes'],'include':_0x7d16e8[_0xbccd('0x1d')]?_['map'](_0x7d16e8[_0xbccd('0x1d')],function(_0x1155f9){return{'model':db[_0x1155f9[_0xbccd('0x1f')]],'as':_0x1155f9['as'],'attributes':_0x1155f9['attributes']};}):[]};}):[]};}):[]:[]})[_0xbccd('0xb')](function(_0x289afa){logger[_0xbccd('0xc')](_0xbccd('0x17'),_0x5b929c);logger[_0xbccd('0xf')](_0xbccd('0x17'),_0x5b929c,JSON[_0xbccd('0x11')](_0x289afa));_0x420163(_0x289afa);})[_0xbccd('0x16')](function(_0x30d546){logger[_0xbccd('0x12')](_0xbccd('0x17'),_0x30d546[_0xbccd('0x14')],_0x5b929c);_0x17d73b(_0x12df0a['error'](0x1f4,_0x30d546['message']));});});};exports[_0xbccd('0x20')]=function(_0x40a34e){var _0x3791a8=this;return new Promise(function(_0x103dbb,_0x3b60bb){return db[_0xbccd('0x18')]['find']({'raw':_0x40a34e[_0xbccd('0x19')]?_0x40a34e[_0xbccd('0x19')][_0xbccd('0x1a')]===undefined?!![]:![]:!![],'where':_0x40a34e['options']?_0x40a34e[_0xbccd('0x19')][_0xbccd('0x1b')]||null:null,'attributes':_0x40a34e['options']?_0x40a34e[_0xbccd('0x19')][_0xbccd('0x1c')]||null:null,'include':_0x40a34e[_0xbccd('0x19')]?_0x40a34e[_0xbccd('0x19')][_0xbccd('0x1d')]?_[_0xbccd('0x1e')](_0x40a34e[_0xbccd('0x19')]['include'],function(_0x2e4b5d){return{'model':db[_0x2e4b5d[_0xbccd('0x1f')]],'as':_0x2e4b5d['as'],'attributes':_0x2e4b5d[_0xbccd('0x1c')],'include':_0x2e4b5d[_0xbccd('0x1d')]?_[_0xbccd('0x1e')](_0x2e4b5d[_0xbccd('0x1d')],function(_0x55870c){return{'model':db[_0x55870c[_0xbccd('0x1f')]],'as':_0x55870c['as'],'attributes':_0x55870c[_0xbccd('0x1c')],'include':_0x55870c[_0xbccd('0x1d')]?_[_0xbccd('0x1e')](_0x55870c[_0xbccd('0x1d')],function(_0x25027e){return{'model':db[_0x25027e[_0xbccd('0x1f')]],'as':_0x25027e['as'],'attributes':_0x25027e[_0xbccd('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xbccd('0xb')](function(_0x166e9d){logger['info']('ShowDynamics365Account',_0x40a34e);logger[_0xbccd('0xf')]('ShowDynamics365Account',_0x40a34e,JSON['stringify'](_0x166e9d));_0x103dbb(_0x166e9d);})[_0xbccd('0x16')](function(_0xff00f8){logger[_0xbccd('0x12')](_0xbccd('0x20'),_0xff00f8[_0xbccd('0x14')],_0x40a34e);_0x3b60bb(_0x3791a8['error'](0x1f4,_0xff00f8['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 1b9157a..0c8088f 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 _0xaf6e=['getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','getFields','/:id/subjects'];(function(_0x13b7fd,_0x4eaf7f){var _0x32a74a=function(_0x2c5d80){while(--_0x2c5d80){_0x13b7fd['push'](_0x13b7fd['shift']());}};_0x32a74a(++_0x4eaf7f);}(_0xaf6e,0x16e));var _0xeaf6=function(_0x3ea96e,_0x37f295){_0x3ea96e=_0x3ea96e-0x0;var _0x313691=_0xaf6e[_0x3ea96e];return _0x313691;};'use strict';var multer=require(_0xeaf6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xeaf6('0x1'));var express=require(_0xeaf6('0x2'));var router=express[_0xeaf6('0x3')]();var fs_extra=require(_0xeaf6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xeaf6('0x5'));var config=require(_0xeaf6('0x6'));var controller=require(_0xeaf6('0x7'));router[_0xeaf6('0x8')]('/',auth[_0xeaf6('0x9')](),controller['index']);router['get']('/:id',auth[_0xeaf6('0x9')](),controller['show']);router[_0xeaf6('0x8')]('/:id/fields',auth[_0xeaf6('0x9')](),controller[_0xeaf6('0xa')]);router[_0xeaf6('0x8')](_0xeaf6('0xb'),auth[_0xeaf6('0x9')](),controller[_0xeaf6('0xc')]);router[_0xeaf6('0x8')](_0xeaf6('0xd'),auth[_0xeaf6('0x9')](),controller[_0xeaf6('0xe')]);router[_0xeaf6('0xf')]('/',auth['isAuthenticated'](),controller[_0xeaf6('0x10')]);router[_0xeaf6('0x11')](_0xeaf6('0x12'),auth[_0xeaf6('0x9')](),controller[_0xeaf6('0x13')]);router[_0xeaf6('0x14')](_0xeaf6('0x12'),auth[_0xeaf6('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6e90=['update','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','create','put'];(function(_0x4fbb86,_0x374ed0){var _0xb141fe=function(_0x382195){while(--_0x382195){_0x4fbb86['push'](_0x4fbb86['shift']());}};_0xb141fe(++_0x374ed0);}(_0x6e90,0xf5));var _0x06e9=function(_0xd00d6f,_0x2475ed){_0xd00d6f=_0xd00d6f-0x0;var _0x262b18=_0x6e90[_0xd00d6f];return _0x262b18;};'use strict';var multer=require(_0x06e9('0x0'));var util=require(_0x06e9('0x1'));var path=require(_0x06e9('0x2'));var timeout=require('connect-timeout');var express=require(_0x06e9('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x06e9('0x4'));var interaction=require(_0x06e9('0x5'));var config=require(_0x06e9('0x6'));var controller=require(_0x06e9('0x7'));router[_0x06e9('0x8')]('/',auth[_0x06e9('0x9')](),controller['index']);router[_0x06e9('0x8')](_0x06e9('0xa'),auth[_0x06e9('0x9')](),controller[_0x06e9('0xb')]);router[_0x06e9('0x8')](_0x06e9('0xc'),auth[_0x06e9('0x9')](),controller[_0x06e9('0xd')]);router[_0x06e9('0x8')](_0x06e9('0xe'),auth[_0x06e9('0x9')](),controller[_0x06e9('0xf')]);router[_0x06e9('0x8')](_0x06e9('0x10'),auth[_0x06e9('0x9')](),controller['getDescriptions']);router['post']('/',auth[_0x06e9('0x9')](),controller[_0x06e9('0x11')]);router[_0x06e9('0x12')](_0x06e9('0xa'),auth[_0x06e9('0x9')](),controller[_0x06e9('0x13')]);router['delete'](_0x06e9('0xa'),auth[_0x06e9('0x9')](),controller[_0x06e9('0x14')]);module[_0x06e9('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 158415c..e6b318e 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 _0x52b6=['sequelize','exports','STRING','incident','ENUM','contact','nothing','BOOLEAN'];(function(_0x24b0ac,_0x463141){var _0x44ac5f=function(_0x39c195){while(--_0x39c195){_0x24b0ac['push'](_0x24b0ac['shift']());}};_0x44ac5f(++_0x463141);}(_0x52b6,0x1e8));var _0x652b=function(_0x15f89f,_0x3222ad){_0x15f89f=_0x15f89f-0x0;var _0x20f6af=_0x52b6[_0x15f89f];return _0x20f6af;};'use strict';var Sequelize=require(_0x652b('0x0'));module[_0x652b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x652b('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x652b('0x3'),'phonecall'),'defaultValue':_0x652b('0x3')},'moduleCreate':{'type':Sequelize[_0x652b('0x4')](_0x652b('0x5'),_0x652b('0x6')),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x652b('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x652b('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x2462=['incident','phonecall','contact','nothing','BOOLEAN','sequelize','exports','STRING','ENUM'];(function(_0x58d8d7,_0x108377){var _0x339d20=function(_0x45849e){while(--_0x45849e){_0x58d8d7['push'](_0x58d8d7['shift']());}};_0x339d20(++_0x108377);}(_0x2462,0x83));var _0x2246=function(_0x336168,_0x9b05d1){_0x336168=_0x336168-0x0;var _0x544351=_0x2462[_0x336168];return _0x544351;};'use strict';var Sequelize=require(_0x2246('0x0'));module[_0x2246('0x1')]={'name':{'type':Sequelize[_0x2246('0x2')]},'description':{'type':Sequelize[_0x2246('0x2')]},'ticketType':{'type':Sequelize[_0x2246('0x3')](_0x2246('0x4'),_0x2246('0x5')),'defaultValue':_0x2246('0x4')},'moduleCreate':{'type':Sequelize['ENUM'](_0x2246('0x6'),_0x2246('0x7')),'defaultValue':_0x2246('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x2246('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x2246('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 7fdda74..cb16958 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 _0x858a=['type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','create','body','getFields','Dynamics365Field','pick','getSubjects','findOne','order','getDescriptions','eml-format','rimraf','request-promise','bluebird','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName'];(function(_0x102b0c,_0x33dee4){var _0x9b15ca=function(_0x42d504){while(--_0x42d504){_0x102b0c['push'](_0x102b0c['shift']());}};_0x9b15ca(++_0x33dee4);}(_0x858a,0xc1));var _0xa858=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x858a[_0x2064e5];return _0x21a233;};'use strict';var emlformat=require(_0xa858('0x0'));var rimraf=require(_0xa858('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa858('0x2'));var moment=require('moment');var BPromise=require(_0xa858('0x3'));var Mustache=require(_0xa858('0x4'));var util=require(_0xa858('0x5'));var path=require('path');var sox=require(_0xa858('0x6'));var csv=require(_0xa858('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa858('0x8'));var squel=require('squel');var crypto=require(_0xa858('0x9'));var jsforce=require(_0xa858('0xa'));var deskjs=require(_0xa858('0xb'));var toCsv=require(_0xa858('0x7'));var querystring=require(_0xa858('0xc'));var Papa=require(_0xa858('0xd'));var Redis=require('ioredis');var authService=require(_0xa858('0xe'));var qs=require(_0xa858('0xf'));var as=require(_0xa858('0x10'));var hardwareService=require(_0xa858('0x11'));var logger=require(_0xa858('0x12'))(_0xa858('0x13'));var utils=require(_0xa858('0x14'));var config=require(_0xa858('0x15'));var licenseUtil=require(_0xa858('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4fa66a,_0x1e281e){_0x1e281e=_0x1e281e||0xcc;return function(_0x1f179a){if(_0x1f179a){return _0x4fa66a[_0xa858('0x17')](_0x1e281e);}return _0x4fa66a['status'](_0x1e281e)[_0xa858('0x18')]();};}function respondWithResult(_0x26ec68,_0x7c131e){_0x7c131e=_0x7c131e||0xc8;return function(_0x4f406b){if(_0x4f406b){return _0x26ec68[_0xa858('0x19')](_0x7c131e)[_0xa858('0x1a')](_0x4f406b);}};}function respondWithFilteredResult(_0x4d1cb6,_0x5c6dac){return function(_0x23aaa3){if(_0x23aaa3){var _0x2f74d7=typeof _0x5c6dac[_0xa858('0x1b')]===_0xa858('0x1c')&&typeof _0x5c6dac[_0xa858('0x1d')]==='undefined';var _0x160ea6=_0x23aaa3[_0xa858('0x1e')];var _0x1fb0a3=_0x2f74d7?0x0:_0x5c6dac[_0xa858('0x1b')];var _0x193555=_0x2f74d7?_0x23aaa3[_0xa858('0x1e')]:_0x5c6dac[_0xa858('0x1b')]+_0x5c6dac[_0xa858('0x1d')];var _0x514e70;if(_0x193555>=_0x160ea6){_0x193555=_0x160ea6;_0x514e70=0xc8;}else{_0x514e70=0xce;}_0x4d1cb6['status'](_0x514e70);return _0x4d1cb6['set'](_0xa858('0x1f'),_0x1fb0a3+'-'+_0x193555+'/'+_0x160ea6)[_0xa858('0x1a')](_0x23aaa3);}return null;};}function patchUpdates(_0x5f1731){return function(_0x2d1947){try{jsonpatch[_0xa858('0x20')](_0x2d1947,_0x5f1731,!![]);}catch(_0x1a1883){return BPromise[_0xa858('0x21')](_0x1a1883);}return _0x2d1947[_0xa858('0x22')]();};}function saveUpdates(_0x5aa385,_0x1333e4){return function(_0x5c322b){if(_0x5c322b){return _0x5c322b[_0xa858('0x23')](_0x5aa385)[_0xa858('0x24')](function(_0xf966ba){return _0xf966ba;});}return null;};}function removeEntity(_0x2c5153,_0x4dfb7d){return function(_0x80b1b2){if(_0x80b1b2){return _0x80b1b2[_0xa858('0x25')]()['then'](function(){_0x2c5153[_0xa858('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4958c,_0x2da656){return function(_0x5aa3ed){if(!_0x5aa3ed){_0x4958c[_0xa858('0x17')](0x194);}return _0x5aa3ed;};}function handleError(_0x507e93,_0x4bcd80){_0x4bcd80=_0x4bcd80||0x1f4;return function(_0x286ba1){logger[_0xa858('0x26')](_0x286ba1[_0xa858('0x27')]);if(_0x286ba1[_0xa858('0x28')]){delete _0x286ba1[_0xa858('0x28')];}_0x507e93[_0xa858('0x19')](_0x4bcd80)[_0xa858('0x29')](_0x286ba1);};}exports[_0xa858('0x2a')]=function(_0x5dd77d,_0x9f07f6){var _0xbcb73a={},_0x56d641={},_0x598f7b={'count':0x0,'rows':[]};var _0x1c7afe=_[_0xa858('0x2b')](db[_0xa858('0x2c')][_0xa858('0x2d')],function(_0x34f8cb){return{'name':_0x34f8cb[_0xa858('0x2e')],'type':_0x34f8cb[_0xa858('0x2f')][_0xa858('0x30')]};});_0x56d641[_0xa858('0x31')]=_[_0xa858('0x2b')](_0x1c7afe,'name');_0x56d641['query']=_[_0xa858('0x32')](_0x5dd77d[_0xa858('0x33')]);_0x56d641['filters']=_[_0xa858('0x34')](_0x56d641[_0xa858('0x31')],_0x56d641[_0xa858('0x33')]);_0xbcb73a[_0xa858('0x35')]=_[_0xa858('0x34')](_0x56d641[_0xa858('0x31')],qs[_0xa858('0x36')](_0x5dd77d[_0xa858('0x33')][_0xa858('0x36')]));_0xbcb73a[_0xa858('0x35')]=_0xbcb73a[_0xa858('0x35')][_0xa858('0x37')]?_0xbcb73a[_0xa858('0x35')]:_0x56d641['model'];if(!_0x5dd77d['query'][_0xa858('0x38')](_0xa858('0x39'))){_0xbcb73a['limit']=qs['limit'](_0x5dd77d[_0xa858('0x33')][_0xa858('0x1d')]);_0xbcb73a[_0xa858('0x1b')]=qs[_0xa858('0x1b')](_0x5dd77d[_0xa858('0x33')][_0xa858('0x1b')]);}_0xbcb73a['order']=qs[_0xa858('0x3a')](_0x5dd77d[_0xa858('0x33')][_0xa858('0x3a')]);_0xbcb73a['where']=qs[_0xa858('0x3b')](_['pick'](_0x5dd77d['query'],_0x56d641[_0xa858('0x3b')]),_0x1c7afe);if(_0x5dd77d[_0xa858('0x33')][_0xa858('0x3c')]){_0xbcb73a[_0xa858('0x3d')]=_[_0xa858('0x3e')](_0xbcb73a['where'],{'$or':_[_0xa858('0x2b')](_0x1c7afe,function(_0x1c212f){if(_0x1c212f[_0xa858('0x2f')]!==_0xa858('0x3f')){var _0x26684d={};_0x26684d[_0x1c212f[_0xa858('0x28')]]={'$like':'%'+_0x5dd77d[_0xa858('0x33')][_0xa858('0x3c')]+'%'};return _0x26684d;}})});}_0xbcb73a=_['merge']({},_0xbcb73a,_0x5dd77d[_0xa858('0x40')]);var _0x1dcf46={'where':_0xbcb73a[_0xa858('0x3d')]};return db[_0xa858('0x2c')][_0xa858('0x1e')](_0x1dcf46)[_0xa858('0x24')](function(_0x3fc7cb){_0x598f7b[_0xa858('0x1e')]=_0x3fc7cb;if(_0x5dd77d[_0xa858('0x33')][_0xa858('0x41')]){_0xbcb73a[_0xa858('0x42')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0xa858('0x43')](_0xbcb73a);})[_0xa858('0x24')](function(_0x1be2d6){_0x598f7b[_0xa858('0x44')]=_0x1be2d6;return _0x598f7b;})['then'](respondWithFilteredResult(_0x9f07f6,_0xbcb73a))[_0xa858('0x45')](handleError(_0x9f07f6,null));};exports['show']=function(_0x48a131,_0x314ee8){var _0x4c7f21={'raw':![],'where':{'id':_0x48a131[_0xa858('0x46')]['id']}},_0x5e84dd={};_0x5e84dd[_0xa858('0x31')]=_[_0xa858('0x32')](db['Dynamics365Configuration'][_0xa858('0x2d')]);_0x5e84dd[_0xa858('0x33')]=_[_0xa858('0x32')](_0x48a131[_0xa858('0x33')]);_0x5e84dd[_0xa858('0x3b')]=_[_0xa858('0x34')](_0x5e84dd['model'],_0x5e84dd['query']);_0x4c7f21['attributes']=_['intersection'](_0x5e84dd[_0xa858('0x31')],qs[_0xa858('0x36')](_0x48a131['query'][_0xa858('0x36')]));_0x4c7f21[_0xa858('0x35')]=_0x4c7f21[_0xa858('0x35')][_0xa858('0x37')]?_0x4c7f21[_0xa858('0x35')]:_0x5e84dd['model'];if(_0x48a131[_0xa858('0x33')][_0xa858('0x41')]){_0x4c7f21[_0xa858('0x42')]=[{'all':!![]}];}_0x4c7f21=_[_0xa858('0x3e')]({},_0x4c7f21,_0x48a131[_0xa858('0x40')]);return db[_0xa858('0x2c')]['find'](_0x4c7f21)[_0xa858('0x24')](handleEntityNotFound(_0x314ee8,null))[_0xa858('0x24')](respondWithResult(_0x314ee8,null))[_0xa858('0x45')](handleError(_0x314ee8,null));};exports[_0xa858('0x47')]=function(_0x5e443c,_0x4608be){return db['Dynamics365Configuration'][_0xa858('0x47')](_0x5e443c[_0xa858('0x48')],{})['then'](respondWithResult(_0x4608be,0xc9))[_0xa858('0x45')](handleError(_0x4608be,null));};exports[_0xa858('0x23')]=function(_0x27f51b,_0x40ef5c){if(_0x27f51b['body']['id']){delete _0x27f51b[_0xa858('0x48')]['id'];}return db['Dynamics365Configuration']['find']({'where':{'id':_0x27f51b['params']['id']}})[_0xa858('0x24')](handleEntityNotFound(_0x40ef5c,null))[_0xa858('0x24')](saveUpdates(_0x27f51b[_0xa858('0x48')],null))[_0xa858('0x24')](respondWithResult(_0x40ef5c,null))['catch'](handleError(_0x40ef5c,null));};exports['destroy']=function(_0x4aeb69,_0x162876){return db['Dynamics365Configuration']['find']({'where':{'id':_0x4aeb69['params']['id']}})[_0xa858('0x24')](handleEntityNotFound(_0x162876,null))[_0xa858('0x24')](removeEntity(_0x162876,null))['catch'](handleError(_0x162876,null));};exports[_0xa858('0x49')]=function(_0x5b81b4,_0x2b4581,_0x3068ba){var _0x5e44fc={};var _0xeccd5d={};var _0x25f5f0;var _0x343795;return db[_0xa858('0x2c')]['findOne']({'where':{'id':_0x5b81b4[_0xa858('0x46')]['id']}})[_0xa858('0x24')](handleEntityNotFound(_0x2b4581,null))[_0xa858('0x24')](function(_0x23a4a6){if(_0x23a4a6){_0x25f5f0=_0x23a4a6;_0xeccd5d['model']=_['keys'](db[_0xa858('0x4a')][_0xa858('0x2d')]);_0xeccd5d[_0xa858('0x33')]=_[_0xa858('0x32')](_0x5b81b4['query']);_0xeccd5d['filters']=_[_0xa858('0x34')](_0xeccd5d[_0xa858('0x31')],_0xeccd5d[_0xa858('0x33')]);_0x5e44fc[_0xa858('0x35')]=_['intersection'](_0xeccd5d['model'],qs[_0xa858('0x36')](_0x5b81b4[_0xa858('0x33')][_0xa858('0x36')]));_0x5e44fc[_0xa858('0x35')]=_0x5e44fc[_0xa858('0x35')]['length']?_0x5e44fc[_0xa858('0x35')]:_0xeccd5d[_0xa858('0x31')];_0x5e44fc['order']=qs[_0xa858('0x3a')](_0x5b81b4[_0xa858('0x33')][_0xa858('0x3a')]);_0x5e44fc['where']=qs[_0xa858('0x3b')](_[_0xa858('0x4b')](_0x5b81b4['query'],_0xeccd5d[_0xa858('0x3b')]));if(_0x5b81b4[_0xa858('0x33')][_0xa858('0x3c')]){_0x5e44fc[_0xa858('0x3d')]=_[_0xa858('0x3e')](_0x5e44fc[_0xa858('0x3d')],{'$or':_['map'](_0x5e44fc[_0xa858('0x35')],function(_0x421e1b){var _0x325151={};_0x325151[_0x421e1b]={'$like':'%'+_0x5b81b4[_0xa858('0x33')][_0xa858('0x3c')]+'%'};return _0x325151;})});}_0x5e44fc=_[_0xa858('0x3e')]({},_0x5e44fc,_0x5b81b4[_0xa858('0x40')]);return _0x25f5f0['getFields'](_0x5e44fc);}})[_0xa858('0x24')](function(_0x106e65){if(_0x106e65){_0x343795=_0x106e65[_0xa858('0x37')];if(!_0x5b81b4['query'][_0xa858('0x38')](_0xa858('0x39'))){_0x5e44fc[_0xa858('0x1d')]=qs[_0xa858('0x1d')](_0x5b81b4[_0xa858('0x33')][_0xa858('0x1d')]);_0x5e44fc[_0xa858('0x1b')]=qs[_0xa858('0x1b')](_0x5b81b4[_0xa858('0x33')][_0xa858('0x1b')]);}return _0x25f5f0[_0xa858('0x49')](_0x5e44fc);}})[_0xa858('0x24')](function(_0x3824b6){if(_0x3824b6){return _0x3824b6?{'count':_0x343795,'rows':_0x3824b6}:null;}})[_0xa858('0x24')](respondWithResult(_0x2b4581,null))['catch'](handleError(_0x2b4581,null));};exports[_0xa858('0x4c')]=function(_0x487a5c,_0x2a39cf,_0x242d8e){var _0x4d8501={};var _0x1d1649={};var _0xa8a0b8;var _0x15a311;return db[_0xa858('0x2c')][_0xa858('0x4d')]({'where':{'id':_0x487a5c[_0xa858('0x46')]['id']}})[_0xa858('0x24')](handleEntityNotFound(_0x2a39cf,null))[_0xa858('0x24')](function(_0x534f94){if(_0x534f94){_0xa8a0b8=_0x534f94;_0x1d1649['model']=_[_0xa858('0x32')](db['Dynamics365Field'][_0xa858('0x2d')]);_0x1d1649[_0xa858('0x33')]=_['keys'](_0x487a5c[_0xa858('0x33')]);_0x1d1649['filters']=_[_0xa858('0x34')](_0x1d1649[_0xa858('0x31')],_0x1d1649[_0xa858('0x33')]);_0x4d8501[_0xa858('0x35')]=_[_0xa858('0x34')](_0x1d1649[_0xa858('0x31')],qs['fields'](_0x487a5c[_0xa858('0x33')][_0xa858('0x36')]));_0x4d8501[_0xa858('0x35')]=_0x4d8501[_0xa858('0x35')][_0xa858('0x37')]?_0x4d8501[_0xa858('0x35')]:_0x1d1649[_0xa858('0x31')];_0x4d8501[_0xa858('0x4e')]=qs[_0xa858('0x3a')](_0x487a5c[_0xa858('0x33')][_0xa858('0x3a')]);_0x4d8501['where']=qs[_0xa858('0x3b')](_[_0xa858('0x4b')](_0x487a5c[_0xa858('0x33')],_0x1d1649[_0xa858('0x3b')]));if(_0x487a5c['query'][_0xa858('0x3c')]){_0x4d8501['where']=_[_0xa858('0x3e')](_0x4d8501[_0xa858('0x3d')],{'$or':_[_0xa858('0x2b')](_0x4d8501[_0xa858('0x35')],function(_0xfab9c1){var _0x5a5f9c={};_0x5a5f9c[_0xfab9c1]={'$like':'%'+_0x487a5c[_0xa858('0x33')]['filter']+'%'};return _0x5a5f9c;})});}_0x4d8501=_[_0xa858('0x3e')]({},_0x4d8501,_0x487a5c[_0xa858('0x40')]);return _0xa8a0b8[_0xa858('0x4c')](_0x4d8501);}})[_0xa858('0x24')](function(_0x1bf7ec){if(_0x1bf7ec){_0x15a311=_0x1bf7ec['length'];if(!_0x487a5c[_0xa858('0x33')][_0xa858('0x38')](_0xa858('0x39'))){_0x4d8501[_0xa858('0x1d')]=qs['limit'](_0x487a5c[_0xa858('0x33')][_0xa858('0x1d')]);_0x4d8501['offset']=qs['offset'](_0x487a5c['query']['offset']);}return _0xa8a0b8[_0xa858('0x4c')](_0x4d8501);}})[_0xa858('0x24')](function(_0x3f26ce){if(_0x3f26ce){return _0x3f26ce?{'count':_0x15a311,'rows':_0x3f26ce}:null;}})['then'](respondWithResult(_0x2a39cf,null))[_0xa858('0x45')](handleError(_0x2a39cf,null));};exports[_0xa858('0x4f')]=function(_0x19a2d2,_0x2ed695,_0x283c8d){var _0x25f0f3={};var _0x28c462={};var _0x5b0e0a;var _0x49cdab;return db[_0xa858('0x2c')][_0xa858('0x4d')]({'where':{'id':_0x19a2d2['params']['id']}})['then'](handleEntityNotFound(_0x2ed695,null))[_0xa858('0x24')](function(_0x373f82){if(_0x373f82){_0x5b0e0a=_0x373f82;_0x28c462[_0xa858('0x31')]=_['keys'](db[_0xa858('0x4a')][_0xa858('0x2d')]);_0x28c462[_0xa858('0x33')]=_['keys'](_0x19a2d2['query']);_0x28c462[_0xa858('0x3b')]=_[_0xa858('0x34')](_0x28c462['model'],_0x28c462[_0xa858('0x33')]);_0x25f0f3['attributes']=_[_0xa858('0x34')](_0x28c462[_0xa858('0x31')],qs[_0xa858('0x36')](_0x19a2d2[_0xa858('0x33')][_0xa858('0x36')]));_0x25f0f3[_0xa858('0x35')]=_0x25f0f3[_0xa858('0x35')]['length']?_0x25f0f3[_0xa858('0x35')]:_0x28c462[_0xa858('0x31')];_0x25f0f3[_0xa858('0x4e')]=qs[_0xa858('0x3a')](_0x19a2d2[_0xa858('0x33')]['sort']);_0x25f0f3[_0xa858('0x3d')]=qs[_0xa858('0x3b')](_['pick'](_0x19a2d2[_0xa858('0x33')],_0x28c462[_0xa858('0x3b')]));if(_0x19a2d2[_0xa858('0x33')][_0xa858('0x3c')]){_0x25f0f3['where']=_[_0xa858('0x3e')](_0x25f0f3[_0xa858('0x3d')],{'$or':_[_0xa858('0x2b')](_0x25f0f3['attributes'],function(_0x48ddbe){var _0x42760d={};_0x42760d[_0x48ddbe]={'$like':'%'+_0x19a2d2['query'][_0xa858('0x3c')]+'%'};return _0x42760d;})});}_0x25f0f3=_[_0xa858('0x3e')]({},_0x25f0f3,_0x19a2d2[_0xa858('0x40')]);return _0x5b0e0a['getDescriptions'](_0x25f0f3);}})['then'](function(_0x138cd5){if(_0x138cd5){_0x49cdab=_0x138cd5[_0xa858('0x37')];if(!_0x19a2d2['query'][_0xa858('0x38')](_0xa858('0x39'))){_0x25f0f3[_0xa858('0x1d')]=qs[_0xa858('0x1d')](_0x19a2d2[_0xa858('0x33')][_0xa858('0x1d')]);_0x25f0f3['offset']=qs[_0xa858('0x1b')](_0x19a2d2[_0xa858('0x33')][_0xa858('0x1b')]);}return _0x5b0e0a[_0xa858('0x4f')](_0x25f0f3);}})[_0xa858('0x24')](function(_0x5a03ae){if(_0x5a03ae){return _0x5a03ae?{'count':_0x49cdab,'rows':_0x5a03ae}:null;}})[_0xa858('0x24')](respondWithResult(_0x2ed695,null))['catch'](handleError(_0x2ed695,null));}; \ No newline at end of file +var _0x0ccb=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','Dynamics365Configuration','fieldName','key','model','query','keys','filters','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','attributes','options','find','create','body','findOne','Dynamics365Field','pick','getFields','rawAttributes','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x36d426,_0x311192){var _0x9a6750=function(_0x3d21a4){while(--_0x3d21a4){_0x36d426['push'](_0x36d426['shift']());}};_0x9a6750(++_0x311192);}(_0x0ccb,0x8f));var _0xb0cc=function(_0x40827f,_0x415800){_0x40827f=_0x40827f-0x0;var _0x109173=_0x0ccb[_0x40827f];return _0x109173;};'use strict';var emlformat=require(_0xb0cc('0x0'));var rimraf=require(_0xb0cc('0x1'));var zipdir=require(_0xb0cc('0x2'));var jsonpatch=require(_0xb0cc('0x3'));var rp=require(_0xb0cc('0x4'));var moment=require(_0xb0cc('0x5'));var BPromise=require(_0xb0cc('0x6'));var Mustache=require(_0xb0cc('0x7'));var util=require(_0xb0cc('0x8'));var path=require(_0xb0cc('0x9'));var sox=require(_0xb0cc('0xa'));var csv=require(_0xb0cc('0xb'));var ejs=require(_0xb0cc('0xc'));var fs=require('fs');var fs_extra=require(_0xb0cc('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb0cc('0xe'));var deskjs=require(_0xb0cc('0xf'));var toCsv=require(_0xb0cc('0xb'));var querystring=require(_0xb0cc('0x10'));var Papa=require(_0xb0cc('0x11'));var Redis=require(_0xb0cc('0x12'));var authService=require(_0xb0cc('0x13'));var qs=require(_0xb0cc('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb0cc('0x15'))(_0xb0cc('0x16'));var utils=require(_0xb0cc('0x17'));var config=require(_0xb0cc('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xb0cc('0x19'))['db'];function respondWithStatusCode(_0x227b65,_0x23f8a3){_0x23f8a3=_0x23f8a3||0xcc;return function(_0x44e4d5){if(_0x44e4d5){return _0x227b65[_0xb0cc('0x1a')](_0x23f8a3);}return _0x227b65[_0xb0cc('0x1b')](_0x23f8a3)[_0xb0cc('0x1c')]();};}function respondWithResult(_0x53fd29,_0x27e107){_0x27e107=_0x27e107||0xc8;return function(_0x494d71){if(_0x494d71){return _0x53fd29['status'](_0x27e107)[_0xb0cc('0x1d')](_0x494d71);}};}function respondWithFilteredResult(_0x1b7e8b,_0x3cbeec){return function(_0x2b77ec){if(_0x2b77ec){var _0x8fea34=typeof _0x3cbeec[_0xb0cc('0x1e')]===_0xb0cc('0x1f')&&typeof _0x3cbeec[_0xb0cc('0x20')]===_0xb0cc('0x1f');var _0x4c7f76=_0x2b77ec[_0xb0cc('0x21')];var _0x1b3cda=_0x8fea34?0x0:_0x3cbeec[_0xb0cc('0x1e')];var _0x5431b7=_0x8fea34?_0x2b77ec['count']:_0x3cbeec[_0xb0cc('0x1e')]+_0x3cbeec['limit'];var _0x36ea93;if(_0x5431b7>=_0x4c7f76){_0x5431b7=_0x4c7f76;_0x36ea93=0xc8;}else{_0x36ea93=0xce;}_0x1b7e8b[_0xb0cc('0x1b')](_0x36ea93);return _0x1b7e8b['set'](_0xb0cc('0x22'),_0x1b3cda+'-'+_0x5431b7+'/'+_0x4c7f76)[_0xb0cc('0x1d')](_0x2b77ec);}return null;};}function patchUpdates(_0x3ab1a4){return function(_0x32be50){try{jsonpatch[_0xb0cc('0x23')](_0x32be50,_0x3ab1a4,!![]);}catch(_0x24a2c3){return BPromise[_0xb0cc('0x24')](_0x24a2c3);}return _0x32be50[_0xb0cc('0x25')]();};}function saveUpdates(_0x59047d,_0xfac0ae){return function(_0x120ab6){if(_0x120ab6){return _0x120ab6[_0xb0cc('0x26')](_0x59047d)[_0xb0cc('0x27')](function(_0x2919f6){return _0x2919f6;});}return null;};}function removeEntity(_0x48f82c,_0x2980bb){return function(_0x5a8e89){if(_0x5a8e89){return _0x5a8e89[_0xb0cc('0x28')]()[_0xb0cc('0x27')](function(){_0x48f82c[_0xb0cc('0x1b')](0xcc)[_0xb0cc('0x1c')]();});}};}function handleEntityNotFound(_0x87a17b,_0x24a141){return function(_0x3972dd){if(!_0x3972dd){_0x87a17b[_0xb0cc('0x1a')](0x194);}return _0x3972dd;};}function handleError(_0x5a2e10,_0x5b9beb){_0x5b9beb=_0x5b9beb||0x1f4;return function(_0x588fe8){logger[_0xb0cc('0x29')](_0x588fe8['stack']);if(_0x588fe8['name']){delete _0x588fe8[_0xb0cc('0x2a')];}_0x5a2e10[_0xb0cc('0x1b')](_0x5b9beb)[_0xb0cc('0x2b')](_0x588fe8);};}exports['index']=function(_0x42d08b,_0x2faad7){var _0x27a809={},_0x413de9={},_0x2d0c87={'count':0x0,'rows':[]};var _0x425878=_[_0xb0cc('0x2c')](db[_0xb0cc('0x2d')]['rawAttributes'],function(_0x3a98fd){return{'name':_0x3a98fd[_0xb0cc('0x2e')],'type':_0x3a98fd['type'][_0xb0cc('0x2f')]};});_0x413de9[_0xb0cc('0x30')]=_[_0xb0cc('0x2c')](_0x425878,'name');_0x413de9[_0xb0cc('0x31')]=_[_0xb0cc('0x32')](_0x42d08b[_0xb0cc('0x31')]);_0x413de9[_0xb0cc('0x33')]=_[_0xb0cc('0x34')](_0x413de9[_0xb0cc('0x30')],_0x413de9['query']);_0x27a809['attributes']=_[_0xb0cc('0x34')](_0x413de9['model'],qs[_0xb0cc('0x35')](_0x42d08b[_0xb0cc('0x31')][_0xb0cc('0x35')]));_0x27a809['attributes']=_0x27a809['attributes'][_0xb0cc('0x36')]?_0x27a809['attributes']:_0x413de9[_0xb0cc('0x30')];if(!_0x42d08b[_0xb0cc('0x31')][_0xb0cc('0x37')](_0xb0cc('0x38'))){_0x27a809[_0xb0cc('0x20')]=qs[_0xb0cc('0x20')](_0x42d08b[_0xb0cc('0x31')][_0xb0cc('0x20')]);_0x27a809[_0xb0cc('0x1e')]=qs['offset'](_0x42d08b[_0xb0cc('0x31')][_0xb0cc('0x1e')]);}_0x27a809[_0xb0cc('0x39')]=qs['sort'](_0x42d08b[_0xb0cc('0x31')][_0xb0cc('0x3a')]);_0x27a809[_0xb0cc('0x3b')]=qs[_0xb0cc('0x33')](_['pick'](_0x42d08b[_0xb0cc('0x31')],_0x413de9[_0xb0cc('0x33')]),_0x425878);if(_0x42d08b['query'][_0xb0cc('0x3c')]){_0x27a809[_0xb0cc('0x3b')]=_[_0xb0cc('0x3d')](_0x27a809[_0xb0cc('0x3b')],{'$or':_[_0xb0cc('0x2c')](_0x425878,function(_0x49f23f){if(_0x49f23f['type']!==_0xb0cc('0x3e')){var _0xb35d06={};_0xb35d06[_0x49f23f['name']]={'$like':'%'+_0x42d08b[_0xb0cc('0x31')][_0xb0cc('0x3c')]+'%'};return _0xb35d06;}})});}_0x27a809=_[_0xb0cc('0x3d')]({},_0x27a809,_0x42d08b['options']);var _0x4c3483={'where':_0x27a809[_0xb0cc('0x3b')]};return db[_0xb0cc('0x2d')]['count'](_0x4c3483)[_0xb0cc('0x27')](function(_0x304df6){_0x2d0c87['count']=_0x304df6;if(_0x42d08b[_0xb0cc('0x31')][_0xb0cc('0x3f')]){_0x27a809[_0xb0cc('0x40')]=[{'all':!![]}];}return db[_0xb0cc('0x2d')][_0xb0cc('0x41')](_0x27a809);})[_0xb0cc('0x27')](function(_0x9ddb43){_0x2d0c87[_0xb0cc('0x42')]=_0x9ddb43;return _0x2d0c87;})[_0xb0cc('0x27')](respondWithFilteredResult(_0x2faad7,_0x27a809))[_0xb0cc('0x43')](handleError(_0x2faad7,null));};exports[_0xb0cc('0x44')]=function(_0x15acc0,_0x549820){var _0x218f0b={'raw':![],'where':{'id':_0x15acc0[_0xb0cc('0x45')]['id']}},_0x7acb40={};_0x7acb40[_0xb0cc('0x30')]=_['keys'](db['Dynamics365Configuration']['rawAttributes']);_0x7acb40['query']=_[_0xb0cc('0x32')](_0x15acc0[_0xb0cc('0x31')]);_0x7acb40[_0xb0cc('0x33')]=_[_0xb0cc('0x34')](_0x7acb40['model'],_0x7acb40[_0xb0cc('0x31')]);_0x218f0b['attributes']=_[_0xb0cc('0x34')](_0x7acb40['model'],qs[_0xb0cc('0x35')](_0x15acc0[_0xb0cc('0x31')]['fields']));_0x218f0b[_0xb0cc('0x46')]=_0x218f0b[_0xb0cc('0x46')][_0xb0cc('0x36')]?_0x218f0b[_0xb0cc('0x46')]:_0x7acb40[_0xb0cc('0x30')];if(_0x15acc0[_0xb0cc('0x31')][_0xb0cc('0x3f')]){_0x218f0b[_0xb0cc('0x40')]=[{'all':!![]}];}_0x218f0b=_[_0xb0cc('0x3d')]({},_0x218f0b,_0x15acc0[_0xb0cc('0x47')]);return db[_0xb0cc('0x2d')][_0xb0cc('0x48')](_0x218f0b)[_0xb0cc('0x27')](handleEntityNotFound(_0x549820,null))[_0xb0cc('0x27')](respondWithResult(_0x549820,null))[_0xb0cc('0x43')](handleError(_0x549820,null));};exports[_0xb0cc('0x49')]=function(_0x48f0ad,_0x3a0e69){return db[_0xb0cc('0x2d')][_0xb0cc('0x49')](_0x48f0ad['body'],{})['then'](respondWithResult(_0x3a0e69,0xc9))[_0xb0cc('0x43')](handleError(_0x3a0e69,null));};exports[_0xb0cc('0x26')]=function(_0x23abec,_0x281a7c){if(_0x23abec[_0xb0cc('0x4a')]['id']){delete _0x23abec[_0xb0cc('0x4a')]['id'];}return db[_0xb0cc('0x2d')]['find']({'where':{'id':_0x23abec[_0xb0cc('0x45')]['id']}})['then'](handleEntityNotFound(_0x281a7c,null))['then'](saveUpdates(_0x23abec[_0xb0cc('0x4a')],null))['then'](respondWithResult(_0x281a7c,null))[_0xb0cc('0x43')](handleError(_0x281a7c,null));};exports[_0xb0cc('0x28')]=function(_0x378315,_0x57c619){return db[_0xb0cc('0x2d')][_0xb0cc('0x48')]({'where':{'id':_0x378315[_0xb0cc('0x45')]['id']}})[_0xb0cc('0x27')](handleEntityNotFound(_0x57c619,null))[_0xb0cc('0x27')](removeEntity(_0x57c619,null))[_0xb0cc('0x43')](handleError(_0x57c619,null));};exports['getFields']=function(_0x4d31c4,_0x27f9cf,_0xfce8cd){var _0x59b447={};var _0x243a4a={};var _0x3ac5c0;var _0x304c6e;return db['Dynamics365Configuration'][_0xb0cc('0x4b')]({'where':{'id':_0x4d31c4[_0xb0cc('0x45')]['id']}})[_0xb0cc('0x27')](handleEntityNotFound(_0x27f9cf,null))[_0xb0cc('0x27')](function(_0x49cb41){if(_0x49cb41){_0x3ac5c0=_0x49cb41;_0x243a4a[_0xb0cc('0x30')]=_['keys'](db[_0xb0cc('0x4c')]['rawAttributes']);_0x243a4a[_0xb0cc('0x31')]=_[_0xb0cc('0x32')](_0x4d31c4[_0xb0cc('0x31')]);_0x243a4a[_0xb0cc('0x33')]=_['intersection'](_0x243a4a['model'],_0x243a4a[_0xb0cc('0x31')]);_0x59b447[_0xb0cc('0x46')]=_[_0xb0cc('0x34')](_0x243a4a[_0xb0cc('0x30')],qs['fields'](_0x4d31c4[_0xb0cc('0x31')][_0xb0cc('0x35')]));_0x59b447[_0xb0cc('0x46')]=_0x59b447[_0xb0cc('0x46')][_0xb0cc('0x36')]?_0x59b447[_0xb0cc('0x46')]:_0x243a4a[_0xb0cc('0x30')];_0x59b447[_0xb0cc('0x39')]=qs[_0xb0cc('0x3a')](_0x4d31c4[_0xb0cc('0x31')][_0xb0cc('0x3a')]);_0x59b447[_0xb0cc('0x3b')]=qs[_0xb0cc('0x33')](_[_0xb0cc('0x4d')](_0x4d31c4[_0xb0cc('0x31')],_0x243a4a[_0xb0cc('0x33')]));if(_0x4d31c4['query'][_0xb0cc('0x3c')]){_0x59b447[_0xb0cc('0x3b')]=_[_0xb0cc('0x3d')](_0x59b447[_0xb0cc('0x3b')],{'$or':_['map'](_0x59b447[_0xb0cc('0x46')],function(_0x11de53){var _0xf9948={};_0xf9948[_0x11de53]={'$like':'%'+_0x4d31c4[_0xb0cc('0x31')]['filter']+'%'};return _0xf9948;})});}_0x59b447=_[_0xb0cc('0x3d')]({},_0x59b447,_0x4d31c4[_0xb0cc('0x47')]);return _0x3ac5c0[_0xb0cc('0x4e')](_0x59b447);}})[_0xb0cc('0x27')](function(_0x257ecf){if(_0x257ecf){_0x304c6e=_0x257ecf['length'];if(!_0x4d31c4[_0xb0cc('0x31')][_0xb0cc('0x37')]('nolimit')){_0x59b447['limit']=qs[_0xb0cc('0x20')](_0x4d31c4[_0xb0cc('0x31')][_0xb0cc('0x20')]);_0x59b447[_0xb0cc('0x1e')]=qs['offset'](_0x4d31c4[_0xb0cc('0x31')][_0xb0cc('0x1e')]);}return _0x3ac5c0['getFields'](_0x59b447);}})[_0xb0cc('0x27')](function(_0x3baec7){if(_0x3baec7){return _0x3baec7?{'count':_0x304c6e,'rows':_0x3baec7}:null;}})[_0xb0cc('0x27')](respondWithResult(_0x27f9cf,null))[_0xb0cc('0x43')](handleError(_0x27f9cf,null));};exports['getSubjects']=function(_0x1fae65,_0x3f6d35,_0x4dbbac){var _0x7e0a77={};var _0x542280={};var _0x3cca37;var _0x2c79b3;return db[_0xb0cc('0x2d')][_0xb0cc('0x4b')]({'where':{'id':_0x1fae65[_0xb0cc('0x45')]['id']}})[_0xb0cc('0x27')](handleEntityNotFound(_0x3f6d35,null))['then'](function(_0x1e15ff){if(_0x1e15ff){_0x3cca37=_0x1e15ff;_0x542280['model']=_['keys'](db[_0xb0cc('0x4c')][_0xb0cc('0x4f')]);_0x542280['query']=_['keys'](_0x1fae65['query']);_0x542280[_0xb0cc('0x33')]=_[_0xb0cc('0x34')](_0x542280[_0xb0cc('0x30')],_0x542280[_0xb0cc('0x31')]);_0x7e0a77[_0xb0cc('0x46')]=_[_0xb0cc('0x34')](_0x542280[_0xb0cc('0x30')],qs[_0xb0cc('0x35')](_0x1fae65['query'][_0xb0cc('0x35')]));_0x7e0a77[_0xb0cc('0x46')]=_0x7e0a77[_0xb0cc('0x46')]['length']?_0x7e0a77[_0xb0cc('0x46')]:_0x542280['model'];_0x7e0a77[_0xb0cc('0x39')]=qs[_0xb0cc('0x3a')](_0x1fae65['query'][_0xb0cc('0x3a')]);_0x7e0a77['where']=qs['filters'](_[_0xb0cc('0x4d')](_0x1fae65['query'],_0x542280[_0xb0cc('0x33')]));if(_0x1fae65['query'][_0xb0cc('0x3c')]){_0x7e0a77[_0xb0cc('0x3b')]=_[_0xb0cc('0x3d')](_0x7e0a77[_0xb0cc('0x3b')],{'$or':_[_0xb0cc('0x2c')](_0x7e0a77[_0xb0cc('0x46')],function(_0x26409f){var _0x136614={};_0x136614[_0x26409f]={'$like':'%'+_0x1fae65[_0xb0cc('0x31')][_0xb0cc('0x3c')]+'%'};return _0x136614;})});}_0x7e0a77=_[_0xb0cc('0x3d')]({},_0x7e0a77,_0x1fae65['options']);return _0x3cca37['getSubjects'](_0x7e0a77);}})['then'](function(_0x5954a8){if(_0x5954a8){_0x2c79b3=_0x5954a8[_0xb0cc('0x36')];if(!_0x1fae65[_0xb0cc('0x31')][_0xb0cc('0x37')](_0xb0cc('0x38'))){_0x7e0a77[_0xb0cc('0x20')]=qs[_0xb0cc('0x20')](_0x1fae65[_0xb0cc('0x31')][_0xb0cc('0x20')]);_0x7e0a77['offset']=qs[_0xb0cc('0x1e')](_0x1fae65[_0xb0cc('0x31')]['offset']);}return _0x3cca37[_0xb0cc('0x50')](_0x7e0a77);}})[_0xb0cc('0x27')](function(_0x49b15e){if(_0x49b15e){return _0x49b15e?{'count':_0x2c79b3,'rows':_0x49b15e}:null;}})[_0xb0cc('0x27')](respondWithResult(_0x3f6d35,null))[_0xb0cc('0x43')](handleError(_0x3f6d35,null));};exports[_0xb0cc('0x51')]=function(_0x4bed0c,_0x3f0e64,_0x3966ce){var _0x39b4cc={};var _0x346edb={};var _0x44615c;var _0x19ae45;return db[_0xb0cc('0x2d')][_0xb0cc('0x4b')]({'where':{'id':_0x4bed0c[_0xb0cc('0x45')]['id']}})[_0xb0cc('0x27')](handleEntityNotFound(_0x3f0e64,null))['then'](function(_0x21f2b8){if(_0x21f2b8){_0x44615c=_0x21f2b8;_0x346edb['model']=_[_0xb0cc('0x32')](db[_0xb0cc('0x4c')][_0xb0cc('0x4f')]);_0x346edb[_0xb0cc('0x31')]=_[_0xb0cc('0x32')](_0x4bed0c[_0xb0cc('0x31')]);_0x346edb['filters']=_['intersection'](_0x346edb[_0xb0cc('0x30')],_0x346edb[_0xb0cc('0x31')]);_0x39b4cc[_0xb0cc('0x46')]=_['intersection'](_0x346edb[_0xb0cc('0x30')],qs[_0xb0cc('0x35')](_0x4bed0c[_0xb0cc('0x31')][_0xb0cc('0x35')]));_0x39b4cc[_0xb0cc('0x46')]=_0x39b4cc[_0xb0cc('0x46')]['length']?_0x39b4cc[_0xb0cc('0x46')]:_0x346edb[_0xb0cc('0x30')];_0x39b4cc[_0xb0cc('0x39')]=qs[_0xb0cc('0x3a')](_0x4bed0c['query'][_0xb0cc('0x3a')]);_0x39b4cc[_0xb0cc('0x3b')]=qs[_0xb0cc('0x33')](_[_0xb0cc('0x4d')](_0x4bed0c[_0xb0cc('0x31')],_0x346edb[_0xb0cc('0x33')]));if(_0x4bed0c[_0xb0cc('0x31')]['filter']){_0x39b4cc[_0xb0cc('0x3b')]=_[_0xb0cc('0x3d')](_0x39b4cc[_0xb0cc('0x3b')],{'$or':_[_0xb0cc('0x2c')](_0x39b4cc[_0xb0cc('0x46')],function(_0x3dfcd0){var _0x1e500c={};_0x1e500c[_0x3dfcd0]={'$like':'%'+_0x4bed0c[_0xb0cc('0x31')]['filter']+'%'};return _0x1e500c;})});}_0x39b4cc=_['merge']({},_0x39b4cc,_0x4bed0c[_0xb0cc('0x47')]);return _0x44615c[_0xb0cc('0x51')](_0x39b4cc);}})['then'](function(_0x3b6301){if(_0x3b6301){_0x19ae45=_0x3b6301['length'];if(!_0x4bed0c['query'][_0xb0cc('0x37')](_0xb0cc('0x38'))){_0x39b4cc['limit']=qs[_0xb0cc('0x20')](_0x4bed0c['query'][_0xb0cc('0x20')]);_0x39b4cc[_0xb0cc('0x1e')]=qs[_0xb0cc('0x1e')](_0x4bed0c[_0xb0cc('0x31')][_0xb0cc('0x1e')]);}return _0x44615c[_0xb0cc('0x51')](_0x39b4cc);}})[_0xb0cc('0x27')](function(_0x212b40){if(_0x212b40){return _0x212b40?{'count':_0x19ae45,'rows':_0x212b40}:null;}})[_0xb0cc('0x27')](respondWithResult(_0x3f0e64,null))[_0xb0cc('0x43')](handleError(_0x3f0e64,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 2788aa8..80928b7 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 _0xd6d6=['path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x14fdb2,_0x495ac2){var _0xf296d1=function(_0x46758e){while(--_0x46758e){_0x14fdb2['push'](_0x14fdb2['shift']());}};_0xf296d1(++_0x495ac2);}(_0xd6d6,0xbe));var _0x6d6d=function(_0xa9859c,_0x476c35){_0xa9859c=_0xa9859c-0x0;var _0x5811a0=_0xd6d6[_0xa9859c];return _0x5811a0;};'use strict';var _=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var logger=require(_0x6d6d('0x2'))(_0x6d6d('0x3'));var moment=require('moment');var BPromise=require(_0x6d6d('0x4'));var rp=require(_0x6d6d('0x5'));var fs=require('fs');var path=require(_0x6d6d('0x6'));var rimraf=require(_0x6d6d('0x7'));var config=require(_0x6d6d('0x8'));var attributes=require(_0x6d6d('0x9'));module[_0x6d6d('0xa')]=function(_0x5702dc,_0x210ff7){return _0x5702dc[_0x6d6d('0xb')](_0x6d6d('0xc'),attributes,{'tableName':_0x6d6d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a19=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x9a19,0x114));var _0x99a1=function(_0x313c96,_0x3cee6e){_0x313c96=_0x313c96-0x0;var _0x522f53=_0x9a19[_0x313c96];return _0x522f53;};'use strict';var _=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var logger=require(_0x99a1('0x2'))('api');var moment=require(_0x99a1('0x3'));var BPromise=require(_0x99a1('0x4'));var rp=require(_0x99a1('0x5'));var fs=require('fs');var path=require(_0x99a1('0x6'));var rimraf=require(_0x99a1('0x7'));var config=require(_0x99a1('0x8'));var attributes=require(_0x99a1('0x9'));module[_0x99a1('0xa')]=function(_0x3eff4a,_0xff0240){return _0x3eff4a[_0x99a1('0xb')]('Dynamics365Configuration',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 4bf1fdf..b5d573c 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 _0xfaa1=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xce0f5c,_0x2c63f3){var _0x6392d8=function(_0x4dd793){while(--_0x4dd793){_0xce0f5c['push'](_0xce0f5c['shift']());}};_0x6392d8(++_0x2c63f3);}(_0xfaa1,0x101));var _0x1faa=function(_0x3c3aa9,_0xa5d230){_0x3c3aa9=_0x3c3aa9-0x0;var _0x13ad7f=_0xfaa1[_0x3c3aa9];return _0x13ad7f;};'use strict';var _=require(_0x1faa('0x0'));var util=require('util');var moment=require(_0x1faa('0x1'));var BPromise=require(_0x1faa('0x2'));var rs=require(_0x1faa('0x3'));var fs=require('fs');var Redis=require(_0x1faa('0x4'));var db=require(_0x1faa('0x5'))['db'];var utils=require(_0x1faa('0x6'));var logger=require(_0x1faa('0x7'))(_0x1faa('0x8'));var config=require(_0x1faa('0x9'));var jayson=require(_0x1faa('0xa'));var client=jayson[_0x1faa('0xb')][_0x1faa('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5b08e2,_0x4953b5,_0x258b1b){return new BPromise(function(_0x5c09d1,_0x3817e4){return client[_0x1faa('0xd')](_0x5b08e2,_0x258b1b)[_0x1faa('0xe')](function(_0x2ebf96){logger[_0x1faa('0xf')](_0x1faa('0x10'),_0x4953b5,_0x1faa('0x11'));logger['debug'](_0x1faa('0x12'),_0x4953b5,_0x1faa('0x11'),JSON[_0x1faa('0x13')](_0x2ebf96));if(_0x2ebf96['error']){if(_0x2ebf96[_0x1faa('0x14')][_0x1faa('0x15')]===0x1f4){logger['error'](_0x1faa('0x10'),_0x4953b5,_0x2ebf96[_0x1faa('0x14')][_0x1faa('0x16')]);return _0x3817e4(_0x2ebf96[_0x1faa('0x14')][_0x1faa('0x16')]);}logger[_0x1faa('0x14')]('Dynamics365Configuration,\x20%s,\x20%s',_0x4953b5,_0x2ebf96[_0x1faa('0x14')][_0x1faa('0x16')]);return _0x5c09d1(_0x2ebf96[_0x1faa('0x14')][_0x1faa('0x16')]);}else{logger[_0x1faa('0xf')](_0x1faa('0x10'),_0x4953b5,_0x1faa('0x11'));_0x5c09d1(_0x2ebf96[_0x1faa('0x17')][_0x1faa('0x16')]);}})['catch'](function(_0xec88fb){logger[_0x1faa('0x14')](_0x1faa('0x10'),_0x4953b5,_0xec88fb);_0x3817e4(_0xec88fb);});});} \ No newline at end of file +var _0x6db3=['then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xae7b21,_0x55be5f){var _0x3dd709=function(_0x40f76d){while(--_0x40f76d){_0xae7b21['push'](_0xae7b21['shift']());}};_0x3dd709(++_0x55be5f);}(_0x6db3,0x1d8));var _0x36db=function(_0x308c81,_0x3b1c85){_0x308c81=_0x308c81-0x0;var _0x5cc912=_0x6db3[_0x308c81];return _0x5cc912;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x36db('0x0'));var BPromise=require(_0x36db('0x1'));var rs=require(_0x36db('0x2'));var fs=require('fs');var Redis=require(_0x36db('0x3'));var db=require(_0x36db('0x4'))['db'];var utils=require(_0x36db('0x5'));var logger=require(_0x36db('0x6'))(_0x36db('0x7'));var config=require(_0x36db('0x8'));var jayson=require(_0x36db('0x9'));var client=jayson[_0x36db('0xa')][_0x36db('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x56e549,_0x1fa988,_0x3421f3){return new BPromise(function(_0x145f31,_0x1e0bdd){return client['request'](_0x56e549,_0x3421f3)[_0x36db('0xc')](function(_0x14ad33){logger[_0x36db('0xd')](_0x36db('0xe'),_0x1fa988,_0x36db('0xf'));logger[_0x36db('0x10')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x1fa988,_0x36db('0xf'),JSON[_0x36db('0x11')](_0x14ad33));if(_0x14ad33[_0x36db('0x12')]){if(_0x14ad33[_0x36db('0x12')][_0x36db('0x13')]===0x1f4){logger[_0x36db('0x12')](_0x36db('0xe'),_0x1fa988,_0x14ad33[_0x36db('0x12')][_0x36db('0x14')]);return _0x1e0bdd(_0x14ad33['error']['message']);}logger[_0x36db('0x12')](_0x36db('0xe'),_0x1fa988,_0x14ad33['error'][_0x36db('0x14')]);return _0x145f31(_0x14ad33['error'][_0x36db('0x14')]);}else{logger[_0x36db('0xd')](_0x36db('0xe'),_0x1fa988,_0x36db('0xf'));_0x145f31(_0x14ad33['result'][_0x36db('0x14')]);}})[_0x36db('0x15')](function(_0x433af7){logger[_0x36db('0x12')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1fa988,_0x433af7);_0x1e0bdd(_0x433af7);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index aaad91a..456f07d 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 _0xd09d=['show','post','create','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','index','get','/:id','isAuthenticated'];(function(_0x299089,_0x3cff81){var _0x11c91f=function(_0x3e135b){while(--_0x3e135b){_0x299089['push'](_0x299089['shift']());}};_0x11c91f(++_0x3cff81);}(_0xd09d,0x149));var _0xdd09=function(_0x5736e2,_0x179927){_0x5736e2=_0x5736e2-0x0;var _0x1628c8=_0xd09d[_0x5736e2];return _0x1628c8;};'use strict';var multer=require(_0xdd09('0x0'));var util=require('util');var path=require(_0xdd09('0x1'));var timeout=require(_0xdd09('0x2'));var express=require(_0xdd09('0x3'));var router=express[_0xdd09('0x4')]();var fs_extra=require(_0xdd09('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xdd09('0x6'));var config=require(_0xdd09('0x7'));var controller=require(_0xdd09('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xdd09('0x9')]);router[_0xdd09('0xa')](_0xdd09('0xb'),auth[_0xdd09('0xc')](),controller[_0xdd09('0xd')]);router[_0xdd09('0xe')]('/',auth[_0xdd09('0xc')](),controller[_0xdd09('0xf')]);router['put']('/:id',auth[_0xdd09('0xc')](),controller['update']);router[_0xdd09('0x10')](_0xdd09('0xb'),auth['isAuthenticated'](),controller[_0xdd09('0x11')]);module['exports']=router; \ No newline at end of file +var _0x3594=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','destroy','exports'];(function(_0x500649,_0x669569){var _0xec40d8=function(_0x1deca4){while(--_0x1deca4){_0x500649['push'](_0x500649['shift']());}};_0xec40d8(++_0x669569);}(_0x3594,0x165));var _0x4359=function(_0x4918cf,_0x1997e8){_0x4918cf=_0x4918cf-0x0;var _0x6e3ae4=_0x3594[_0x4918cf];return _0x6e3ae4;};'use strict';var multer=require(_0x4359('0x0'));var util=require(_0x4359('0x1'));var path=require('path');var timeout=require(_0x4359('0x2'));var express=require(_0x4359('0x3'));var router=express[_0x4359('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4359('0x5'));var interaction=require(_0x4359('0x6'));var config=require(_0x4359('0x7'));var controller=require('./intDynamics365Field.controller');router['get']('/',auth[_0x4359('0x8')](),controller[_0x4359('0x9')]);router[_0x4359('0xa')](_0x4359('0xb'),auth['isAuthenticated'](),controller[_0x4359('0xc')]);router[_0x4359('0xd')]('/',auth[_0x4359('0x8')](),controller[_0x4359('0xe')]);router['put'](_0x4359('0xb'),auth[_0x4359('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x4359('0xf')]);module[_0x4359('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 69ed1ec..0a7b284 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 _0x6fd6=['string','customVariable','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x6fd6,0x1be));var _0x66fd=function(_0x258421,_0x24f471){_0x258421=_0x258421-0x0;var _0x69467e=_0x6fd6[_0x258421];return _0x69467e;};'use strict';var Sequelize=require(_0x66fd('0x0'));module[_0x66fd('0x1')]={'type':{'type':Sequelize['ENUM'](_0x66fd('0x2'),'variable',_0x66fd('0x3'),'keyValue',_0x66fd('0x4')),'defaultValue':_0x66fd('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x66fd('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x66fd('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x66fd('0x5')]},'idField':{'type':Sequelize[_0x66fd('0x5')]},'nameField':{'type':Sequelize[_0x66fd('0x5')]},'customField':{'type':Sequelize[_0x66fd('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x66fd('0x5')]}}; \ No newline at end of file +var _0x0891=['BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','picklist','string','STRING'];(function(_0x5ddb8f,_0x349733){var _0xe22d4f=function(_0x45e0d2){while(--_0x45e0d2){_0x5ddb8f['push'](_0x5ddb8f['shift']());}};_0xe22d4f(++_0x349733);}(_0x0891,0xc9));var _0x1089=function(_0x21f5f3,_0x1d563d){_0x21f5f3=_0x21f5f3-0x0;var _0x53dc8c=_0x0891[_0x21f5f3];return _0x53dc8c;};'use strict';var Sequelize=require(_0x1089('0x0'));module[_0x1089('0x1')]={'type':{'type':Sequelize[_0x1089('0x2')]('string',_0x1089('0x3'),_0x1089('0x4'),_0x1089('0x5'),_0x1089('0x6')),'defaultValue':_0x1089('0x7')},'content':{'type':Sequelize[_0x1089('0x8')]},'key':{'type':Sequelize[_0x1089('0x8')]},'keyType':{'type':Sequelize[_0x1089('0x2')](_0x1089('0x7'),'variable',_0x1089('0x4'))},'keyContent':{'type':Sequelize[_0x1089('0x8')]},'idField':{'type':Sequelize[_0x1089('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x1089('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1089('0x8')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 5ee2541..2c050cf 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 _0xe29b=['then','error','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','options','Dynamics365Field','includeAll','include','findAll','rows','catch','show','params','find','create','body','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','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','sendStatus','status','end','undefined','limit','offset','count','set','json','reject','save','update','destroy'];(function(_0xdf4976,_0x4421db){var _0x28e15a=function(_0x129318){while(--_0x129318){_0xdf4976['push'](_0xdf4976['shift']());}};_0x28e15a(++_0x4421db);}(_0xe29b,0x6f));var _0xbe29=function(_0x4939d9,_0x224f8a){_0x4939d9=_0x4939d9-0x0;var _0x3e8084=_0xe29b[_0x4939d9];return _0x3e8084;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbe29('0x0'));var zipdir=require(_0xbe29('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbe29('0x2'));var moment=require('moment');var BPromise=require(_0xbe29('0x3'));var Mustache=require(_0xbe29('0x4'));var util=require(_0xbe29('0x5'));var path=require(_0xbe29('0x6'));var sox=require(_0xbe29('0x7'));var csv=require('to-csv');var ejs=require(_0xbe29('0x8'));var fs=require('fs');var fs_extra=require(_0xbe29('0x9'));var _=require(_0xbe29('0xa'));var squel=require(_0xbe29('0xb'));var crypto=require(_0xbe29('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbe29('0xd'));var toCsv=require('to-csv');var querystring=require(_0xbe29('0xe'));var Papa=require(_0xbe29('0xf'));var Redis=require(_0xbe29('0x10'));var authService=require(_0xbe29('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xbe29('0x12'));var hardwareService=require(_0xbe29('0x13'));var logger=require(_0xbe29('0x14'))(_0xbe29('0x15'));var utils=require(_0xbe29('0x16'));var config=require(_0xbe29('0x17'));var licenseUtil=require(_0xbe29('0x18'));var db=require(_0xbe29('0x19'))['db'];function respondWithStatusCode(_0x36f3c1,_0x4f68eb){_0x4f68eb=_0x4f68eb||0xcc;return function(_0x31a04f){if(_0x31a04f){return _0x36f3c1[_0xbe29('0x1a')](_0x4f68eb);}return _0x36f3c1[_0xbe29('0x1b')](_0x4f68eb)[_0xbe29('0x1c')]();};}function respondWithResult(_0x353ccd,_0x2c8c60){_0x2c8c60=_0x2c8c60||0xc8;return function(_0xcf2cd1){if(_0xcf2cd1){return _0x353ccd['status'](_0x2c8c60)['json'](_0xcf2cd1);}};}function respondWithFilteredResult(_0x2a2a88,_0x48aaca){return function(_0x236f38){if(_0x236f38){var _0xcb83b8=typeof _0x48aaca['offset']===_0xbe29('0x1d')&&typeof _0x48aaca[_0xbe29('0x1e')]===_0xbe29('0x1d');var _0x2f0291=_0x236f38['count'];var _0x141221=_0xcb83b8?0x0:_0x48aaca[_0xbe29('0x1f')];var _0x53fe7c=_0xcb83b8?_0x236f38[_0xbe29('0x20')]:_0x48aaca[_0xbe29('0x1f')]+_0x48aaca[_0xbe29('0x1e')];var _0x17ddb7;if(_0x53fe7c>=_0x2f0291){_0x53fe7c=_0x2f0291;_0x17ddb7=0xc8;}else{_0x17ddb7=0xce;}_0x2a2a88[_0xbe29('0x1b')](_0x17ddb7);return _0x2a2a88[_0xbe29('0x21')]('Content-Range',_0x141221+'-'+_0x53fe7c+'/'+_0x2f0291)[_0xbe29('0x22')](_0x236f38);}return null;};}function patchUpdates(_0x2d7a5f){return function(_0x204218){try{jsonpatch['apply'](_0x204218,_0x2d7a5f,!![]);}catch(_0x69cd4){return BPromise[_0xbe29('0x23')](_0x69cd4);}return _0x204218[_0xbe29('0x24')]();};}function saveUpdates(_0x2e91f7,_0xc02479){return function(_0x5c7f5a){if(_0x5c7f5a){return _0x5c7f5a[_0xbe29('0x25')](_0x2e91f7)['then'](function(_0x54014a){return _0x54014a;});}return null;};}function removeEntity(_0x2f05a7,_0x17ce62){return function(_0x154c57){if(_0x154c57){return _0x154c57[_0xbe29('0x26')]()[_0xbe29('0x27')](function(){_0x2f05a7[_0xbe29('0x1b')](0xcc)[_0xbe29('0x1c')]();});}};}function handleEntityNotFound(_0x5ee5f6,_0x56d575){return function(_0x150ecc){if(!_0x150ecc){_0x5ee5f6[_0xbe29('0x1a')](0x194);}return _0x150ecc;};}function handleError(_0xcf967d,_0x140456){_0x140456=_0x140456||0x1f4;return function(_0x222de7){logger[_0xbe29('0x28')](_0x222de7[_0xbe29('0x29')]);if(_0x222de7[_0xbe29('0x2a')]){delete _0x222de7[_0xbe29('0x2a')];}_0xcf967d[_0xbe29('0x1b')](_0x140456)[_0xbe29('0x2b')](_0x222de7);};}exports[_0xbe29('0x2c')]=function(_0x180817,_0x13825b){var _0x2eda2e={},_0x2b884a={},_0x4d0f88={'count':0x0,'rows':[]};var _0x1091fd=_['map'](db['Dynamics365Field'][_0xbe29('0x2d')],function(_0x1416f4){return{'name':_0x1416f4['fieldName'],'type':_0x1416f4[_0xbe29('0x2e')][_0xbe29('0x2f')]};});_0x2b884a[_0xbe29('0x30')]=_[_0xbe29('0x31')](_0x1091fd,_0xbe29('0x2a'));_0x2b884a[_0xbe29('0x32')]=_[_0xbe29('0x33')](_0x180817['query']);_0x2b884a['filters']=_['intersection'](_0x2b884a['model'],_0x2b884a[_0xbe29('0x32')]);_0x2eda2e[_0xbe29('0x34')]=_[_0xbe29('0x35')](_0x2b884a['model'],qs[_0xbe29('0x36')](_0x180817[_0xbe29('0x32')][_0xbe29('0x36')]));_0x2eda2e['attributes']=_0x2eda2e[_0xbe29('0x34')][_0xbe29('0x37')]?_0x2eda2e[_0xbe29('0x34')]:_0x2b884a['model'];if(!_0x180817['query'][_0xbe29('0x38')](_0xbe29('0x39'))){_0x2eda2e[_0xbe29('0x1e')]=qs[_0xbe29('0x1e')](_0x180817[_0xbe29('0x32')][_0xbe29('0x1e')]);_0x2eda2e['offset']=qs[_0xbe29('0x1f')](_0x180817['query'][_0xbe29('0x1f')]);}_0x2eda2e[_0xbe29('0x3a')]=qs['sort'](_0x180817[_0xbe29('0x32')][_0xbe29('0x3b')]);_0x2eda2e[_0xbe29('0x3c')]=qs[_0xbe29('0x3d')](_['pick'](_0x180817['query'],_0x2b884a[_0xbe29('0x3d')]),_0x1091fd);if(_0x180817[_0xbe29('0x32')]['filter']){_0x2eda2e[_0xbe29('0x3c')]=_[_0xbe29('0x3e')](_0x2eda2e['where'],{'$or':_['map'](_0x1091fd,function(_0x11d821){if(_0x11d821['type']!=='VIRTUAL'){var _0x5d84b9={};_0x5d84b9[_0x11d821['name']]={'$like':'%'+_0x180817[_0xbe29('0x32')]['filter']+'%'};return _0x5d84b9;}})});}_0x2eda2e=_[_0xbe29('0x3e')]({},_0x2eda2e,_0x180817[_0xbe29('0x3f')]);var _0x5aaba8={'where':_0x2eda2e[_0xbe29('0x3c')]};return db[_0xbe29('0x40')]['count'](_0x5aaba8)['then'](function(_0x27d2da){_0x4d0f88[_0xbe29('0x20')]=_0x27d2da;if(_0x180817[_0xbe29('0x32')][_0xbe29('0x41')]){_0x2eda2e[_0xbe29('0x42')]=[{'all':!![]}];}return db[_0xbe29('0x40')][_0xbe29('0x43')](_0x2eda2e);})[_0xbe29('0x27')](function(_0x571cb0){_0x4d0f88[_0xbe29('0x44')]=_0x571cb0;return _0x4d0f88;})[_0xbe29('0x27')](respondWithFilteredResult(_0x13825b,_0x2eda2e))[_0xbe29('0x45')](handleError(_0x13825b,null));};exports[_0xbe29('0x46')]=function(_0x84642f,_0xe328dc){var _0x530f1f={'raw':!![],'where':{'id':_0x84642f[_0xbe29('0x47')]['id']}},_0x551ccb={};_0x551ccb['model']=_[_0xbe29('0x33')](db[_0xbe29('0x40')][_0xbe29('0x2d')]);_0x551ccb[_0xbe29('0x32')]=_[_0xbe29('0x33')](_0x84642f[_0xbe29('0x32')]);_0x551ccb[_0xbe29('0x3d')]=_[_0xbe29('0x35')](_0x551ccb[_0xbe29('0x30')],_0x551ccb[_0xbe29('0x32')]);_0x530f1f[_0xbe29('0x34')]=_['intersection'](_0x551ccb[_0xbe29('0x30')],qs[_0xbe29('0x36')](_0x84642f['query'][_0xbe29('0x36')]));_0x530f1f[_0xbe29('0x34')]=_0x530f1f[_0xbe29('0x34')][_0xbe29('0x37')]?_0x530f1f[_0xbe29('0x34')]:_0x551ccb[_0xbe29('0x30')];if(_0x84642f[_0xbe29('0x32')][_0xbe29('0x41')]){_0x530f1f[_0xbe29('0x42')]=[{'all':!![]}];}_0x530f1f=_[_0xbe29('0x3e')]({},_0x530f1f,_0x84642f[_0xbe29('0x3f')]);return db[_0xbe29('0x40')][_0xbe29('0x48')](_0x530f1f)[_0xbe29('0x27')](handleEntityNotFound(_0xe328dc,null))[_0xbe29('0x27')](respondWithResult(_0xe328dc,null))[_0xbe29('0x45')](handleError(_0xe328dc,null));};exports[_0xbe29('0x49')]=function(_0x4a9bb6,_0x28a6a8){return db['Dynamics365Field']['create'](_0x4a9bb6[_0xbe29('0x4a')],{})[_0xbe29('0x27')](respondWithResult(_0x28a6a8,0xc9))[_0xbe29('0x45')](handleError(_0x28a6a8,null));};exports['update']=function(_0x4464ee,_0x5c3a02){if(_0x4464ee['body']['id']){delete _0x4464ee[_0xbe29('0x4a')]['id'];}return db[_0xbe29('0x40')][_0xbe29('0x48')]({'where':{'id':_0x4464ee[_0xbe29('0x47')]['id']}})[_0xbe29('0x27')](handleEntityNotFound(_0x5c3a02,null))[_0xbe29('0x27')](saveUpdates(_0x4464ee[_0xbe29('0x4a')],null))[_0xbe29('0x27')](respondWithResult(_0x5c3a02,null))[_0xbe29('0x45')](handleError(_0x5c3a02,null));};exports[_0xbe29('0x26')]=function(_0x37a289,_0x4f5478){return db['Dynamics365Field'][_0xbe29('0x48')]({'where':{'id':_0x37a289[_0xbe29('0x47')]['id']}})['then'](handleEntityNotFound(_0x4f5478,null))[_0xbe29('0x27')](removeEntity(_0x4f5478,null))['catch'](handleError(_0x4f5478,null));}; \ No newline at end of file +var _0x23ac=['query','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','catch','show','params','keys','includeAll','find','create','body','eml-format','zip-dir','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/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','stack','name','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x1e9a51,_0x143522){var _0x2839b8=function(_0x3a242e){while(--_0x3a242e){_0x1e9a51['push'](_0x1e9a51['shift']());}};_0x2839b8(++_0x143522);}(_0x23ac,0x1d5));var _0xc23a=function(_0x3f8743,_0x33973f){_0x3f8743=_0x3f8743-0x0;var _0x1f844c=_0x23ac[_0x3f8743];return _0x1f844c;};'use strict';var emlformat=require(_0xc23a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc23a('0x1'));var jsonpatch=require(_0xc23a('0x2'));var rp=require(_0xc23a('0x3'));var moment=require(_0xc23a('0x4'));var BPromise=require(_0xc23a('0x5'));var Mustache=require(_0xc23a('0x6'));var util=require(_0xc23a('0x7'));var path=require(_0xc23a('0x8'));var sox=require(_0xc23a('0x9'));var csv=require(_0xc23a('0xa'));var ejs=require(_0xc23a('0xb'));var fs=require('fs');var fs_extra=require(_0xc23a('0xc'));var _=require(_0xc23a('0xd'));var squel=require(_0xc23a('0xe'));var crypto=require(_0xc23a('0xf'));var jsforce=require(_0xc23a('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xc23a('0xa'));var querystring=require(_0xc23a('0x11'));var Papa=require(_0xc23a('0x12'));var Redis=require(_0xc23a('0x13'));var authService=require(_0xc23a('0x14'));var qs=require(_0xc23a('0x15'));var as=require(_0xc23a('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc23a('0x17'))('api');var utils=require(_0xc23a('0x18'));var config=require(_0xc23a('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44a62d,_0x414d32){_0x414d32=_0x414d32||0xcc;return function(_0x5eb912){if(_0x5eb912){return _0x44a62d[_0xc23a('0x1a')](_0x414d32);}return _0x44a62d[_0xc23a('0x1b')](_0x414d32)[_0xc23a('0x1c')]();};}function respondWithResult(_0x2df06d,_0x2a0f49){_0x2a0f49=_0x2a0f49||0xc8;return function(_0x3516a7){if(_0x3516a7){return _0x2df06d['status'](_0x2a0f49)[_0xc23a('0x1d')](_0x3516a7);}};}function respondWithFilteredResult(_0x21731f,_0x43f5c5){return function(_0xdf4d92){if(_0xdf4d92){var _0x4c0342=typeof _0x43f5c5[_0xc23a('0x1e')]===_0xc23a('0x1f')&&typeof _0x43f5c5[_0xc23a('0x20')]==='undefined';var _0x457723=_0xdf4d92[_0xc23a('0x21')];var _0x54bb6c=_0x4c0342?0x0:_0x43f5c5[_0xc23a('0x1e')];var _0x559628=_0x4c0342?_0xdf4d92[_0xc23a('0x21')]:_0x43f5c5[_0xc23a('0x1e')]+_0x43f5c5[_0xc23a('0x20')];var _0x5379dc;if(_0x559628>=_0x457723){_0x559628=_0x457723;_0x5379dc=0xc8;}else{_0x5379dc=0xce;}_0x21731f[_0xc23a('0x1b')](_0x5379dc);return _0x21731f[_0xc23a('0x22')](_0xc23a('0x23'),_0x54bb6c+'-'+_0x559628+'/'+_0x457723)[_0xc23a('0x1d')](_0xdf4d92);}return null;};}function patchUpdates(_0x43a3ec){return function(_0x378a69){try{jsonpatch[_0xc23a('0x24')](_0x378a69,_0x43a3ec,!![]);}catch(_0x1953a0){return BPromise['reject'](_0x1953a0);}return _0x378a69['save']();};}function saveUpdates(_0x14bebb,_0x36a3e2){return function(_0x1cdd1b){if(_0x1cdd1b){return _0x1cdd1b[_0xc23a('0x25')](_0x14bebb)[_0xc23a('0x26')](function(_0x22e489){return _0x22e489;});}return null;};}function removeEntity(_0x39a999,_0x515653){return function(_0x2c4f1c){if(_0x2c4f1c){return _0x2c4f1c['destroy']()[_0xc23a('0x26')](function(){_0x39a999[_0xc23a('0x1b')](0xcc)[_0xc23a('0x1c')]();});}};}function handleEntityNotFound(_0x4cb075,_0x4be8f6){return function(_0x3896ab){if(!_0x3896ab){_0x4cb075[_0xc23a('0x1a')](0x194);}return _0x3896ab;};}function handleError(_0xaba175,_0x460410){_0x460410=_0x460410||0x1f4;return function(_0x5dfcee){logger['error'](_0x5dfcee[_0xc23a('0x27')]);if(_0x5dfcee[_0xc23a('0x28')]){delete _0x5dfcee[_0xc23a('0x28')];}_0xaba175[_0xc23a('0x1b')](_0x460410)['send'](_0x5dfcee);};}exports[_0xc23a('0x29')]=function(_0x296c97,_0x2a6660){var _0x1da5dc={},_0x293c9c={},_0x286704={'count':0x0,'rows':[]};var _0x2d269e=_[_0xc23a('0x2a')](db[_0xc23a('0x2b')][_0xc23a('0x2c')],function(_0x231e95){return{'name':_0x231e95[_0xc23a('0x2d')],'type':_0x231e95[_0xc23a('0x2e')][_0xc23a('0x2f')]};});_0x293c9c[_0xc23a('0x30')]=_['map'](_0x2d269e,'name');_0x293c9c['query']=_['keys'](_0x296c97['query']);_0x293c9c[_0xc23a('0x31')]=_[_0xc23a('0x32')](_0x293c9c[_0xc23a('0x30')],_0x293c9c['query']);_0x1da5dc[_0xc23a('0x33')]=_[_0xc23a('0x32')](_0x293c9c[_0xc23a('0x30')],qs['fields'](_0x296c97['query'][_0xc23a('0x34')]));_0x1da5dc['attributes']=_0x1da5dc['attributes'][_0xc23a('0x35')]?_0x1da5dc[_0xc23a('0x33')]:_0x293c9c[_0xc23a('0x30')];if(!_0x296c97['query'][_0xc23a('0x36')](_0xc23a('0x37'))){_0x1da5dc[_0xc23a('0x20')]=qs[_0xc23a('0x20')](_0x296c97[_0xc23a('0x38')][_0xc23a('0x20')]);_0x1da5dc[_0xc23a('0x1e')]=qs['offset'](_0x296c97[_0xc23a('0x38')][_0xc23a('0x1e')]);}_0x1da5dc[_0xc23a('0x39')]=qs[_0xc23a('0x3a')](_0x296c97[_0xc23a('0x38')][_0xc23a('0x3a')]);_0x1da5dc['where']=qs[_0xc23a('0x31')](_[_0xc23a('0x3b')](_0x296c97[_0xc23a('0x38')],_0x293c9c[_0xc23a('0x31')]),_0x2d269e);if(_0x296c97[_0xc23a('0x38')][_0xc23a('0x3c')]){_0x1da5dc[_0xc23a('0x3d')]=_[_0xc23a('0x3e')](_0x1da5dc[_0xc23a('0x3d')],{'$or':_[_0xc23a('0x2a')](_0x2d269e,function(_0x3c842c){if(_0x3c842c[_0xc23a('0x2e')]!==_0xc23a('0x3f')){var _0x4d8758={};_0x4d8758[_0x3c842c[_0xc23a('0x28')]]={'$like':'%'+_0x296c97[_0xc23a('0x38')][_0xc23a('0x3c')]+'%'};return _0x4d8758;}})});}_0x1da5dc=_[_0xc23a('0x3e')]({},_0x1da5dc,_0x296c97[_0xc23a('0x40')]);var _0x2b40f0={'where':_0x1da5dc[_0xc23a('0x3d')]};return db[_0xc23a('0x2b')][_0xc23a('0x21')](_0x2b40f0)['then'](function(_0x26e5ac){_0x286704[_0xc23a('0x21')]=_0x26e5ac;if(_0x296c97['query']['includeAll']){_0x1da5dc[_0xc23a('0x41')]=[{'all':!![]}];}return db[_0xc23a('0x2b')][_0xc23a('0x42')](_0x1da5dc);})[_0xc23a('0x26')](function(_0x45d464){_0x286704['rows']=_0x45d464;return _0x286704;})[_0xc23a('0x26')](respondWithFilteredResult(_0x2a6660,_0x1da5dc))[_0xc23a('0x43')](handleError(_0x2a6660,null));};exports[_0xc23a('0x44')]=function(_0xbc5451,_0xc2b5db){var _0x294be4={'raw':!![],'where':{'id':_0xbc5451[_0xc23a('0x45')]['id']}},_0xc61565={};_0xc61565[_0xc23a('0x30')]=_[_0xc23a('0x46')](db[_0xc23a('0x2b')]['rawAttributes']);_0xc61565['query']=_[_0xc23a('0x46')](_0xbc5451['query']);_0xc61565[_0xc23a('0x31')]=_[_0xc23a('0x32')](_0xc61565[_0xc23a('0x30')],_0xc61565[_0xc23a('0x38')]);_0x294be4[_0xc23a('0x33')]=_['intersection'](_0xc61565[_0xc23a('0x30')],qs[_0xc23a('0x34')](_0xbc5451['query']['fields']));_0x294be4['attributes']=_0x294be4[_0xc23a('0x33')]['length']?_0x294be4['attributes']:_0xc61565['model'];if(_0xbc5451['query'][_0xc23a('0x47')]){_0x294be4[_0xc23a('0x41')]=[{'all':!![]}];}_0x294be4=_[_0xc23a('0x3e')]({},_0x294be4,_0xbc5451[_0xc23a('0x40')]);return db['Dynamics365Field'][_0xc23a('0x48')](_0x294be4)[_0xc23a('0x26')](handleEntityNotFound(_0xc2b5db,null))[_0xc23a('0x26')](respondWithResult(_0xc2b5db,null))['catch'](handleError(_0xc2b5db,null));};exports['create']=function(_0x1915c1,_0x262dae){return db[_0xc23a('0x2b')][_0xc23a('0x49')](_0x1915c1[_0xc23a('0x4a')],{})[_0xc23a('0x26')](respondWithResult(_0x262dae,0xc9))['catch'](handleError(_0x262dae,null));};exports['update']=function(_0x1700a1,_0x14cfae){if(_0x1700a1[_0xc23a('0x4a')]['id']){delete _0x1700a1['body']['id'];}return db[_0xc23a('0x2b')][_0xc23a('0x48')]({'where':{'id':_0x1700a1[_0xc23a('0x45')]['id']}})['then'](handleEntityNotFound(_0x14cfae,null))[_0xc23a('0x26')](saveUpdates(_0x1700a1[_0xc23a('0x4a')],null))['then'](respondWithResult(_0x14cfae,null))['catch'](handleError(_0x14cfae,null));};exports['destroy']=function(_0xab7975,_0x90dda8){return db[_0xc23a('0x2b')][_0xc23a('0x48')]({'where':{'id':_0xab7975['params']['id']}})[_0xc23a('0x26')](handleEntityNotFound(_0x90dda8,null))[_0xc23a('0x26')](removeEntity(_0x90dda8,null))[_0xc23a('0x43')](handleError(_0x90dda8,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index e534ee4..818e96a 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 _0xc940=['define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xd686bd,_0x516f59){var _0x2eb6ff=function(_0x50ce70){while(--_0x50ce70){_0xd686bd['push'](_0xd686bd['shift']());}};_0x2eb6ff(++_0x516f59);}(_0xc940,0xc5));var _0x0c94=function(_0x26d3d0,_0x70cf7){_0x26d3d0=_0x26d3d0-0x0;var _0x10f162=_0xc940[_0x26d3d0];return _0x10f162;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x0c94('0x0'));var moment=require(_0x0c94('0x1'));var BPromise=require(_0x0c94('0x2'));var rp=require(_0x0c94('0x3'));var fs=require('fs');var path=require(_0x0c94('0x4'));var rimraf=require(_0x0c94('0x5'));var config=require(_0x0c94('0x6'));var attributes=require('./intDynamics365Field.attributes');module['exports']=function(_0x29a6a2,_0x2e757c){return _0x29a6a2[_0x0c94('0x7')](_0x0c94('0x8'),attributes,{'tableName':_0x0c94('0x9'),'paranoid':![],'indexes':[{'name':_0x0c94('0xa'),'fields':[_0x0c94('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x890c=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','exports','Dynamics365Field','idField','FieldId','lodash'];(function(_0x2e68df,_0x46f8dc){var _0x33af7f=function(_0x28805a){while(--_0x28805a){_0x2e68df['push'](_0x2e68df['shift']());}};_0x33af7f(++_0x46f8dc);}(_0x890c,0x107));var _0xc890=function(_0x48448e,_0x2ac090){_0x48448e=_0x48448e-0x0;var _0x12d9d9=_0x890c[_0x48448e];return _0x12d9d9;};'use strict';var _=require(_0xc890('0x0'));var util=require(_0xc890('0x1'));var logger=require(_0xc890('0x2'))(_0xc890('0x3'));var moment=require('moment');var BPromise=require(_0xc890('0x4'));var rp=require(_0xc890('0x5'));var fs=require('fs');var path=require(_0xc890('0x6'));var rimraf=require(_0xc890('0x7'));var config=require('../../config/environment');var attributes=require('./intDynamics365Field.attributes');module[_0xc890('0x8')]=function(_0x6aeed6,_0x530519){return _0x6aeed6['define'](_0xc890('0x9'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0xc890('0xa'),_0xc890('0xb')],'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 7340857..573e8be 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 _0xe838=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','error','code','message','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x132ba1,_0x352097){var _0x1af422=function(_0x4622f9){while(--_0x4622f9){_0x132ba1['push'](_0x132ba1['shift']());}};_0x1af422(++_0x352097);}(_0xe838,0xe1));var _0x8e83=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe838[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8e83('0x0'));var util=require(_0x8e83('0x1'));var moment=require(_0x8e83('0x2'));var BPromise=require(_0x8e83('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8e83('0x4'));var db=require(_0x8e83('0x5'))['db'];var utils=require(_0x8e83('0x6'));var logger=require(_0x8e83('0x7'))(_0x8e83('0x8'));var config=require(_0x8e83('0x9'));var jayson=require(_0x8e83('0xa'));var client=jayson[_0x8e83('0xb')][_0x8e83('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xb3afc1,_0x5e90c0,_0x4eac4a){return new BPromise(function(_0x4ab976,_0xcf48f8){return client[_0x8e83('0xd')](_0xb3afc1,_0x4eac4a)['then'](function(_0x26ed49){logger[_0x8e83('0xe')](_0x8e83('0xf'),_0x5e90c0,_0x8e83('0x10'));logger[_0x8e83('0x11')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x5e90c0,'request\x20sent',JSON['stringify'](_0x26ed49));if(_0x26ed49['error']){if(_0x26ed49[_0x8e83('0x12')][_0x8e83('0x13')]===0x1f4){logger[_0x8e83('0x12')](_0x8e83('0xf'),_0x5e90c0,_0x26ed49[_0x8e83('0x12')][_0x8e83('0x14')]);return _0xcf48f8(_0x26ed49[_0x8e83('0x12')][_0x8e83('0x14')]);}logger['error'](_0x8e83('0xf'),_0x5e90c0,_0x26ed49['error']['message']);return _0x4ab976(_0x26ed49[_0x8e83('0x12')]['message']);}else{logger[_0x8e83('0xe')](_0x8e83('0xf'),_0x5e90c0,_0x8e83('0x10'));_0x4ab976(_0x26ed49['result'][_0x8e83('0x14')]);}})['catch'](function(_0x7dcff7){logger[_0x8e83('0x12')]('Dynamics365Field,\x20%s,\x20%s',_0x5e90c0,_0x7dcff7);_0xcf48f8(_0x7dcff7);});});} \ No newline at end of file +var _0x81f7=['Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info'];(function(_0x3eb25b,_0x87b21e){var _0x524d21=function(_0x189966){while(--_0x189966){_0x3eb25b['push'](_0x3eb25b['shift']());}};_0x524d21(++_0x87b21e);}(_0x81f7,0x1d4));var _0x781f=function(_0x43e686,_0x42eb32){_0x43e686=_0x43e686-0x0;var _0x336b4d=_0x81f7[_0x43e686];return _0x336b4d;};'use strict';var _=require(_0x781f('0x0'));var util=require('util');var moment=require(_0x781f('0x1'));var BPromise=require(_0x781f('0x2'));var rs=require(_0x781f('0x3'));var fs=require('fs');var Redis=require(_0x781f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x781f('0x5'))(_0x781f('0x6'));var config=require(_0x781f('0x7'));var jayson=require(_0x781f('0x8'));var client=jayson[_0x781f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb18813,_0x342cb1,_0x50b0a6){return new BPromise(function(_0x5106d9,_0x2c1453){return client['request'](_0xb18813,_0x50b0a6)[_0x781f('0xa')](function(_0xfee36f){logger[_0x781f('0xb')](_0x781f('0xc'),_0x342cb1,_0x781f('0xd'));logger[_0x781f('0xe')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x342cb1,'request\x20sent',JSON[_0x781f('0xf')](_0xfee36f));if(_0xfee36f['error']){if(_0xfee36f[_0x781f('0x10')]['code']===0x1f4){logger[_0x781f('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x342cb1,_0xfee36f[_0x781f('0x10')]['message']);return _0x2c1453(_0xfee36f[_0x781f('0x10')][_0x781f('0x11')]);}logger[_0x781f('0x10')](_0x781f('0xc'),_0x342cb1,_0xfee36f[_0x781f('0x10')][_0x781f('0x11')]);return _0x5106d9(_0xfee36f[_0x781f('0x10')][_0x781f('0x11')]);}else{logger[_0x781f('0xb')](_0x781f('0xc'),_0x342cb1,_0x781f('0xd'));_0x5106d9(_0xfee36f[_0x781f('0x12')][_0x781f('0x11')]);}})[_0x781f('0x13')](function(_0x3dc97c){logger[_0x781f('0x10')](_0x781f('0xc'),_0x342cb1,_0x3dc97c);_0x2c1453(_0x3dc97c);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 4889765..b96f028 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 _0x36ec=['create','addConfiguration','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','show','/:id/configurations','/:id/fields','getFields','post'];(function(_0x2fe37e,_0x4083bf){var _0x2dfde5=function(_0x17f9e9){while(--_0x17f9e9){_0x2fe37e['push'](_0x2fe37e['shift']());}};_0x2dfde5(++_0x4083bf);}(_0x36ec,0x148));var _0xc36e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36ec[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc36e('0x0'));var util=require(_0xc36e('0x1'));var path=require(_0xc36e('0x2'));var timeout=require(_0xc36e('0x3'));var express=require(_0xc36e('0x4'));var router=express[_0xc36e('0x5')]();var fs_extra=require(_0xc36e('0x6'));var auth=require(_0xc36e('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xc36e('0x8'));var controller=require(_0xc36e('0x9'));router[_0xc36e('0xa')]('/',auth[_0xc36e('0xb')](),controller['index']);router[_0xc36e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc36e('0xc')]);router[_0xc36e('0xa')](_0xc36e('0xd'),auth[_0xc36e('0xb')](),controller['getConfigurations']);router['get'](_0xc36e('0xe'),auth[_0xc36e('0xb')](),controller[_0xc36e('0xf')]);router[_0xc36e('0x10')]('/',auth[_0xc36e('0xb')](),controller[_0xc36e('0x11')]);router[_0xc36e('0x10')](_0xc36e('0xd'),auth[_0xc36e('0xb')](),controller[_0xc36e('0x12')]);router['put'](_0xc36e('0x13'),auth['isAuthenticated'](),controller[_0xc36e('0x14')]);router['delete'](_0xc36e('0x13'),auth[_0xc36e('0xb')](),controller[_0xc36e('0x15')]);module[_0xc36e('0x16')]=router; \ No newline at end of file +var _0x5e36=['index','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get'];(function(_0x218296,_0x515d36){var _0x459579=function(_0x6a825){while(--_0x6a825){_0x218296['push'](_0x218296['shift']());}};_0x459579(++_0x515d36);}(_0x5e36,0xe7));var _0x65e3=function(_0x5c3cd6,_0x27a538){_0x5c3cd6=_0x5c3cd6-0x0;var _0x515462=_0x5e36[_0x5c3cd6];return _0x515462;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x65e3('0x0'));var timeout=require('connect-timeout');var express=require(_0x65e3('0x1'));var router=express[_0x65e3('0x2')]();var fs_extra=require(_0x65e3('0x3'));var auth=require(_0x65e3('0x4'));var interaction=require(_0x65e3('0x5'));var config=require(_0x65e3('0x6'));var controller=require(_0x65e3('0x7'));router[_0x65e3('0x8')]('/',auth['isAuthenticated'](),controller[_0x65e3('0x9')]);router['get']('/:id',auth[_0x65e3('0xa')](),controller[_0x65e3('0xb')]);router['get'](_0x65e3('0xc'),auth['isAuthenticated'](),controller[_0x65e3('0xd')]);router[_0x65e3('0x8')](_0x65e3('0xe'),auth[_0x65e3('0xa')](),controller[_0x65e3('0xf')]);router[_0x65e3('0x10')]('/',auth[_0x65e3('0xa')](),controller[_0x65e3('0x11')]);router['post'](_0x65e3('0xc'),auth['isAuthenticated'](),controller[_0x65e3('0x12')]);router[_0x65e3('0x13')](_0x65e3('0x14'),auth[_0x65e3('0xa')](),controller[_0x65e3('0x15')]);router[_0x65e3('0x16')]('/:id',auth[_0x65e3('0xa')](),controller[_0x65e3('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 2cf4e37..e7eb3e2 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 _0xadb5=['remoteUri','exports','STRING','username'];(function(_0x47df54,_0x1aeb61){var _0x261b87=function(_0x54bc77){while(--_0x54bc77){_0x47df54['push'](_0x47df54['shift']());}};_0x261b87(++_0x1aeb61);}(_0xadb5,0xad));var _0x5adb=function(_0xe61c85,_0x97e037){_0xe61c85=_0xe61c85-0x0;var _0x40717d=_0xadb5[_0xe61c85];return _0x40717d;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5adb('0x1')]},'username':{'type':Sequelize[_0x5adb('0x1')],'unique':_0x5adb('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x5adb('0x1')],'unique':_0x5adb('0x3')},'serverUrl':{'type':Sequelize[_0x5adb('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xd943=['exports','STRING','username','remoteUri','sequelize'];(function(_0x5ed85c,_0x533d56){var _0x3db7c6=function(_0x4f62c2){while(--_0x4f62c2){_0x5ed85c['push'](_0x5ed85c['shift']());}};_0x3db7c6(++_0x533d56);}(_0xd943,0x15d));var _0x3d94=function(_0x44110b,_0x1b267b){_0x44110b=_0x44110b-0x0;var _0x1f4f50=_0xd943[_0x44110b];return _0x1f4f50;};'use strict';var Sequelize=require(_0x3d94('0x0'));module[_0x3d94('0x1')]={'name':{'type':Sequelize[_0x3d94('0x2')]},'description':{'type':Sequelize[_0x3d94('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x3d94('0x3')},'apiKey':{'type':Sequelize[_0x3d94('0x2')]},'remoteUri':{'type':Sequelize[_0x3d94('0x2')],'unique':_0x3d94('0x4')},'serverUrl':{'type':Sequelize[_0x3d94('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 69d4342..3a9dc81 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 _0x1b32=['toString','base64','subject','agent','description','priority','group','source','ticket_type','company','includes','custom_dropdown','label','choices','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','destroy','then','error','name','index','map','FreshdeskAccount','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','type','VIRTUAL','findAll','catch','show','params','options','find','create','body','getConfigurations','findOne','pick','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshdeskConfiguration','FreshdeskField','Descriptions','slice','substring','lastIndexOf','GET','%s/%s','api/v2/ticket_fields','format','%s:X'];(function(_0xc14df7,_0x163f90){var _0x34a445=function(_0x1bbf28){while(--_0x1bbf28){_0xc14df7['push'](_0xc14df7['shift']());}};_0x34a445(++_0x163f90);}(_0x1b32,0x85));var _0x21b3=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x1b32[_0x599f41];return _0x2e4d58;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x21b3('0x0'));var zipdir=require(_0x21b3('0x1'));var jsonpatch=require(_0x21b3('0x2'));var rp=require(_0x21b3('0x3'));var moment=require(_0x21b3('0x4'));var BPromise=require(_0x21b3('0x5'));var Mustache=require(_0x21b3('0x6'));var util=require(_0x21b3('0x7'));var path=require(_0x21b3('0x8'));var sox=require(_0x21b3('0x9'));var csv=require(_0x21b3('0xa'));var ejs=require(_0x21b3('0xb'));var fs=require('fs');var fs_extra=require(_0x21b3('0xc'));var _=require(_0x21b3('0xd'));var squel=require(_0x21b3('0xe'));var crypto=require('crypto');var jsforce=require(_0x21b3('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x21b3('0x10'));var Redis=require(_0x21b3('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x21b3('0x12'));var hardwareService=require(_0x21b3('0x13'));var logger=require(_0x21b3('0x14'))('api');var utils=require(_0x21b3('0x15'));var config=require(_0x21b3('0x16'));var licenseUtil=require(_0x21b3('0x17'));var db=require(_0x21b3('0x18'))['db'];var integrations=require(_0x21b3('0x19'));function respondWithStatusCode(_0x2c7abb,_0x3bff49){_0x3bff49=_0x3bff49||0xcc;return function(_0x41ffa2){if(_0x41ffa2){return _0x2c7abb[_0x21b3('0x1a')](_0x3bff49);}return _0x2c7abb['status'](_0x3bff49)[_0x21b3('0x1b')]();};}function respondWithResult(_0x810f46,_0x43bede){_0x43bede=_0x43bede||0xc8;return function(_0x581c13){if(_0x581c13){return _0x810f46[_0x21b3('0x1c')](_0x43bede)['json'](_0x581c13);}};}function respondWithFilteredResult(_0x3f7b4a,_0x579a37){return function(_0x15662a){if(_0x15662a){var _0xe6b2b7=typeof _0x579a37[_0x21b3('0x1d')]===_0x21b3('0x1e')&&typeof _0x579a37['limit']===_0x21b3('0x1e');var _0x47ae6c=_0x15662a[_0x21b3('0x1f')];var _0x2af6e4=_0xe6b2b7?0x0:_0x579a37[_0x21b3('0x1d')];var _0x21921b=_0xe6b2b7?_0x15662a['count']:_0x579a37[_0x21b3('0x1d')]+_0x579a37[_0x21b3('0x20')];var _0x3f4040;if(_0x21921b>=_0x47ae6c){_0x21921b=_0x47ae6c;_0x3f4040=0xc8;}else{_0x3f4040=0xce;}_0x3f7b4a['status'](_0x3f4040);return _0x3f7b4a[_0x21b3('0x21')](_0x21b3('0x22'),_0x2af6e4+'-'+_0x21921b+'/'+_0x47ae6c)[_0x21b3('0x23')](_0x15662a);}return null;};}function patchUpdates(_0x3fe141){return function(_0x360e57){try{jsonpatch[_0x21b3('0x24')](_0x360e57,_0x3fe141,!![]);}catch(_0x1e5181){return BPromise['reject'](_0x1e5181);}return _0x360e57[_0x21b3('0x25')]();};}function saveUpdates(_0x54695b,_0x139672){return function(_0x3afede){if(_0x3afede){return _0x3afede[_0x21b3('0x26')](_0x54695b)['then'](function(_0x19ba2c){return _0x19ba2c;});}return null;};}function removeEntity(_0x5bda6e,_0x3ee234){return function(_0x40e17e){if(_0x40e17e){return _0x40e17e[_0x21b3('0x27')]()[_0x21b3('0x28')](function(){_0x5bda6e[_0x21b3('0x1c')](0xcc)[_0x21b3('0x1b')]();});}};}function handleEntityNotFound(_0x58822d,_0x5b752c){return function(_0x49aab8){if(!_0x49aab8){_0x58822d[_0x21b3('0x1a')](0x194);}return _0x49aab8;};}function handleError(_0x2e3758,_0x3c1a3b){_0x3c1a3b=_0x3c1a3b||0x1f4;return function(_0x31cbd5){logger[_0x21b3('0x29')](_0x31cbd5['stack']);if(_0x31cbd5[_0x21b3('0x2a')]){delete _0x31cbd5['name'];}_0x2e3758[_0x21b3('0x1c')](_0x3c1a3b)['send'](_0x31cbd5);};}exports[_0x21b3('0x2b')]=function(_0xf48fc7,_0x81ee7e){var _0x4f6432={},_0x291e52={},_0x300977={'count':0x0,'rows':[]};var _0x336b1e=_[_0x21b3('0x2c')](db[_0x21b3('0x2d')][_0x21b3('0x2e')],function(_0x2cc056){return{'name':_0x2cc056['fieldName'],'type':_0x2cc056['type'][_0x21b3('0x2f')]};});_0x291e52[_0x21b3('0x30')]=_['map'](_0x336b1e,_0x21b3('0x2a'));_0x291e52[_0x21b3('0x31')]=_[_0x21b3('0x32')](_0xf48fc7[_0x21b3('0x31')]);_0x291e52[_0x21b3('0x33')]=_[_0x21b3('0x34')](_0x291e52[_0x21b3('0x30')],_0x291e52[_0x21b3('0x31')]);_0x4f6432[_0x21b3('0x35')]=_['intersection'](_0x291e52['model'],qs[_0x21b3('0x36')](_0xf48fc7['query'][_0x21b3('0x36')]));_0x4f6432[_0x21b3('0x35')]=_0x4f6432['attributes'][_0x21b3('0x37')]?_0x4f6432[_0x21b3('0x35')]:_0x291e52[_0x21b3('0x30')];if(!_0xf48fc7[_0x21b3('0x31')]['hasOwnProperty'](_0x21b3('0x38'))){_0x4f6432[_0x21b3('0x20')]=qs[_0x21b3('0x20')](_0xf48fc7[_0x21b3('0x31')]['limit']);_0x4f6432[_0x21b3('0x1d')]=qs['offset'](_0xf48fc7[_0x21b3('0x31')][_0x21b3('0x1d')]);}_0x4f6432[_0x21b3('0x39')]=qs[_0x21b3('0x3a')](_0xf48fc7[_0x21b3('0x31')][_0x21b3('0x3a')]);_0x4f6432[_0x21b3('0x3b')]=qs['filters'](_['pick'](_0xf48fc7[_0x21b3('0x31')],_0x291e52[_0x21b3('0x33')]),_0x336b1e);if(_0xf48fc7[_0x21b3('0x31')][_0x21b3('0x3c')]){_0x4f6432['where']=_[_0x21b3('0x3d')](_0x4f6432[_0x21b3('0x3b')],{'$or':_[_0x21b3('0x2c')](_0x336b1e,function(_0x42889a){if(_0x42889a[_0x21b3('0x3e')]!==_0x21b3('0x3f')){var _0xbb93cd={};_0xbb93cd[_0x42889a[_0x21b3('0x2a')]]={'$like':'%'+_0xf48fc7[_0x21b3('0x31')][_0x21b3('0x3c')]+'%'};return _0xbb93cd;}})});}_0x4f6432=_[_0x21b3('0x3d')]({},_0x4f6432,_0xf48fc7['options']);var _0x1942c0={'where':_0x4f6432[_0x21b3('0x3b')]};return db['FreshdeskAccount'][_0x21b3('0x1f')](_0x1942c0)['then'](function(_0x920e5e){_0x300977[_0x21b3('0x1f')]=_0x920e5e;if(_0xf48fc7['query']['includeAll']){_0x4f6432['include']=[{'all':!![]}];}return db[_0x21b3('0x2d')][_0x21b3('0x40')](_0x4f6432);})[_0x21b3('0x28')](function(_0x14fa93){_0x300977['rows']=_0x14fa93;return _0x300977;})['then'](respondWithFilteredResult(_0x81ee7e,_0x4f6432))[_0x21b3('0x41')](handleError(_0x81ee7e,null));};exports[_0x21b3('0x42')]=function(_0x1c97e7,_0x28adbc){var _0x306bf2={'raw':![],'where':{'id':_0x1c97e7[_0x21b3('0x43')]['id']}},_0x2be5ae={};_0x2be5ae['model']=_[_0x21b3('0x32')](db[_0x21b3('0x2d')][_0x21b3('0x2e')]);_0x2be5ae[_0x21b3('0x31')]=_[_0x21b3('0x32')](_0x1c97e7[_0x21b3('0x31')]);_0x2be5ae['filters']=_['intersection'](_0x2be5ae[_0x21b3('0x30')],_0x2be5ae[_0x21b3('0x31')]);_0x306bf2[_0x21b3('0x35')]=_['intersection'](_0x2be5ae[_0x21b3('0x30')],qs[_0x21b3('0x36')](_0x1c97e7[_0x21b3('0x31')][_0x21b3('0x36')]));_0x306bf2[_0x21b3('0x35')]=_0x306bf2[_0x21b3('0x35')]['length']?_0x306bf2[_0x21b3('0x35')]:_0x2be5ae[_0x21b3('0x30')];if(_0x1c97e7[_0x21b3('0x31')]['includeAll']){_0x306bf2['include']=[{'all':!![]}];}_0x306bf2=_['merge']({},_0x306bf2,_0x1c97e7[_0x21b3('0x44')]);return db[_0x21b3('0x2d')][_0x21b3('0x45')](_0x306bf2)[_0x21b3('0x28')](handleEntityNotFound(_0x28adbc,null))[_0x21b3('0x28')](respondWithResult(_0x28adbc,null))[_0x21b3('0x41')](handleError(_0x28adbc,null));};exports[_0x21b3('0x46')]=function(_0x30d48b,_0x2e878b){return db['FreshdeskAccount']['create'](_0x30d48b['body'],{})[_0x21b3('0x28')](respondWithResult(_0x2e878b,0xc9))[_0x21b3('0x41')](handleError(_0x2e878b,null));};exports[_0x21b3('0x26')]=function(_0x2e4add,_0x2d1e5f){if(_0x2e4add[_0x21b3('0x47')]['id']){delete _0x2e4add[_0x21b3('0x47')]['id'];}return db[_0x21b3('0x2d')][_0x21b3('0x45')]({'where':{'id':_0x2e4add[_0x21b3('0x43')]['id']}})['then'](handleEntityNotFound(_0x2d1e5f,null))[_0x21b3('0x28')](saveUpdates(_0x2e4add[_0x21b3('0x47')],null))[_0x21b3('0x28')](respondWithResult(_0x2d1e5f,null))[_0x21b3('0x41')](handleError(_0x2d1e5f,null));};exports[_0x21b3('0x27')]=function(_0x2c7019,_0xf10700){return db[_0x21b3('0x2d')][_0x21b3('0x45')]({'where':{'id':_0x2c7019['params']['id']}})[_0x21b3('0x28')](handleEntityNotFound(_0xf10700,null))[_0x21b3('0x28')](removeEntity(_0xf10700,null))[_0x21b3('0x41')](handleError(_0xf10700,null));};exports[_0x21b3('0x48')]=function(_0x3805b9,_0x5d7ee7,_0x595c3a){var _0x3f8aab={};var _0x4bd19f={};var _0x37a455;var _0x1be6d3;return db[_0x21b3('0x2d')][_0x21b3('0x49')]({'where':{'id':_0x3805b9['params']['id']}})['then'](handleEntityNotFound(_0x5d7ee7,null))[_0x21b3('0x28')](function(_0xc28070){if(_0xc28070){_0x37a455=_0xc28070;_0x4bd19f[_0x21b3('0x30')]=_[_0x21b3('0x32')](db['FreshdeskConfiguration'][_0x21b3('0x2e')]);_0x4bd19f['query']=_[_0x21b3('0x32')](_0x3805b9[_0x21b3('0x31')]);_0x4bd19f['filters']=_['intersection'](_0x4bd19f[_0x21b3('0x30')],_0x4bd19f[_0x21b3('0x31')]);_0x3f8aab[_0x21b3('0x35')]=_[_0x21b3('0x34')](_0x4bd19f[_0x21b3('0x30')],qs[_0x21b3('0x36')](_0x3805b9[_0x21b3('0x31')]['fields']));_0x3f8aab[_0x21b3('0x35')]=_0x3f8aab[_0x21b3('0x35')][_0x21b3('0x37')]?_0x3f8aab[_0x21b3('0x35')]:_0x4bd19f[_0x21b3('0x30')];_0x3f8aab['order']=qs['sort'](_0x3805b9[_0x21b3('0x31')][_0x21b3('0x3a')]);_0x3f8aab[_0x21b3('0x3b')]=qs[_0x21b3('0x33')](_[_0x21b3('0x4a')](_0x3805b9[_0x21b3('0x31')],_0x4bd19f['filters']));if(_0x3805b9[_0x21b3('0x31')][_0x21b3('0x3c')]){_0x3f8aab['where']=_[_0x21b3('0x3d')](_0x3f8aab['where'],{'$or':_[_0x21b3('0x2c')](_0x3f8aab[_0x21b3('0x35')],function(_0x2401bf){var _0x164a81={};_0x164a81[_0x2401bf]={'$like':'%'+_0x3805b9['query'][_0x21b3('0x3c')]+'%'};return _0x164a81;})});}_0x3f8aab=_['merge']({},_0x3f8aab,_0x3805b9[_0x21b3('0x44')]);return _0x37a455[_0x21b3('0x48')](_0x3f8aab);}})[_0x21b3('0x28')](function(_0x46b2ae){if(_0x46b2ae){_0x1be6d3=_0x46b2ae[_0x21b3('0x37')];if(!_0x3805b9['query'][_0x21b3('0x4b')](_0x21b3('0x38'))){_0x3f8aab[_0x21b3('0x20')]=qs[_0x21b3('0x20')](_0x3805b9[_0x21b3('0x31')][_0x21b3('0x20')]);_0x3f8aab[_0x21b3('0x1d')]=qs[_0x21b3('0x1d')](_0x3805b9[_0x21b3('0x31')][_0x21b3('0x1d')]);}return _0x37a455[_0x21b3('0x48')](_0x3f8aab);}})[_0x21b3('0x28')](function(_0x1db904){if(_0x1db904){return _0x1db904?{'count':_0x1be6d3,'rows':_0x1db904}:null;}})[_0x21b3('0x28')](respondWithResult(_0x5d7ee7,null))[_0x21b3('0x41')](handleError(_0x5d7ee7,null));};exports[_0x21b3('0x4c')]=function(_0x2039be,_0x128730,_0x5e9335){if(_0x2039be[_0x21b3('0x47')]['id']){delete _0x2039be[_0x21b3('0x47')]['id'];}return db[_0x21b3('0x2d')]['findOne']({'where':{'id':_0x2039be[_0x21b3('0x43')]['id']}})[_0x21b3('0x28')](handleEntityNotFound(_0x128730,null))[_0x21b3('0x28')](function(_0x5bb28f){if(_0x5bb28f){_0x2039be[_0x21b3('0x47')][_0x21b3('0x4d')]=_0x5bb28f['id'];_0x2039be[_0x21b3('0x47')][_0x21b3('0x4e')]=integrations[_0x21b3('0x4f')](_0x2039be[_0x21b3('0x47')][_0x21b3('0x50')],_0x2039be['body']['type']);_0x2039be[_0x21b3('0x47')]['Descriptions']=integrations[_0x21b3('0x51')](_0x2039be[_0x21b3('0x47')][_0x21b3('0x50')],_0x2039be['body'][_0x21b3('0x3e')]);return db[_0x21b3('0x52')][_0x21b3('0x46')](_0x2039be[_0x21b3('0x47')],{'include':[{'model':db[_0x21b3('0x53')],'as':_0x21b3('0x4e')},{'model':db[_0x21b3('0x53')],'as':_0x21b3('0x54')}]});}return null;})['then'](respondWithResult(_0x128730,null))['catch'](handleError(_0x128730,null));};exports['getFields']=function(_0x3a7461,_0x4a6fb4,_0x372132){var _0x3b0ffb='';return db[_0x21b3('0x2d')][_0x21b3('0x49')]({'where':{'id':_0x3a7461[_0x21b3('0x43')]['id']},'attributes':['id','remoteUri','apiKey']})[_0x21b3('0x28')](handleEntityNotFound(_0x4a6fb4,null))[_0x21b3('0x28')](function(_0x639eeb){if(_0x639eeb){_0x3b0ffb=_0x639eeb['remoteUri'];var _0x46f71c=_0x3b0ffb[_0x21b3('0x55')](-0x1);if(_0x46f71c==='/'){_0x3b0ffb=_0x3b0ffb[_0x21b3('0x56')](0x0,_0x3b0ffb[_0x21b3('0x57')](_0x46f71c));}return rp({'method':_0x21b3('0x58'),'uri':util['format'](_0x21b3('0x59'),_0x3b0ffb,_0x21b3('0x5a')),'headers':{'Authorization':util[_0x21b3('0x5b')]('Basic\x20%s',new Buffer(util[_0x21b3('0x5b')](_0x21b3('0x5c'),_0x639eeb['apiKey']))[_0x21b3('0x5d')](_0x21b3('0x5e')))},'json':!![]});}})[_0x21b3('0x28')](function(_0x42f80a){if(_0x42f80a){var _0x43d01c=['requester',_0x21b3('0x5f'),_0x21b3('0x60'),_0x21b3('0x61'),_0x21b3('0x1c'),_0x21b3('0x62'),_0x21b3('0x63'),_0x21b3('0x64'),_0x21b3('0x65'),_0x21b3('0x63'),_0x21b3('0x66')];_['remove'](_0x42f80a,function(_0x18ba6b){return _0x43d01c[_0x21b3('0x67')](_0x18ba6b[_0x21b3('0x2a')])||!_0x18ba6b['default']&&_0x18ba6b[_0x21b3('0x3e')]!=='custom_text'&&_0x18ba6b[_0x21b3('0x3e')]!==_0x21b3('0x68');});return{'count':_0x42f80a[_0x21b3('0x37')],'rows':_[_0x21b3('0x2c')](_0x42f80a,function(_0x5f1e6e){return{'id':_0x5f1e6e[_0x21b3('0x2a')],'name':_0x5f1e6e[_0x21b3('0x69')],'custom':!_0x5f1e6e['default'],'options':_0x5f1e6e[_0x21b3('0x6a')]?_['map'](_0x5f1e6e[_0x21b3('0x6a')],function(_0x47e9cc){return{'name':_['capitalize'](_0x47e9cc),'value':_0x47e9cc};}):[]};})};}})['then'](respondWithResult(_0x4a6fb4,null))['catch'](function(_0x2634c2){var _0x47c73a=_0x3a7461['query'][_0x21b3('0x6b')]?0x1f4:_0x2634c2[_0x21b3('0x6c')]||0x1f4;logger[_0x21b3('0x29')](_0x21b3('0x6d'),_0x21b3('0x6e'),_0x47c73a,JSON[_0x21b3('0x6f')](_0x2634c2));delete _0x2634c2[_0x21b3('0x2a')];if(_0x47c73a===0x191){_0x47c73a=0x190;}_0x4a6fb4['status'](_0x47c73a)['send'](_0x3a7461['query'][_0x21b3('0x6b')]?{'message':_0x21b3('0x70'),'statusCode':_0x2634c2[_0x21b3('0x6c')]}:_0x2634c2);});}; \ No newline at end of file +var _0x4a3d=['custom_text','label','default','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','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','sendStatus','status','end','offset','undefined','count','set','apply','update','destroy','then','error','stack','name','send','map','FreshdeskAccount','rawAttributes','fieldName','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','create','catch','body','getConfigurations','nolimit','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','FreshdeskField','getFields','apiKey','remoteUri','slice','substring','lastIndexOf','GET','%s/%s','api/v2/ticket_fields','format','Basic\x20%s','toString','base64','agent','description','priority','group','company','remove','includes'];(function(_0x17ac83,_0x17c298){var _0xd04a2b=function(_0x76bc9a){while(--_0x76bc9a){_0x17ac83['push'](_0x17ac83['shift']());}};_0xd04a2b(++_0x17c298);}(_0x4a3d,0x79));var _0xd4a3=function(_0x3a7155,_0x59e035){_0x3a7155=_0x3a7155-0x0;var _0x1f2c15=_0x4a3d[_0x3a7155];return _0x1f2c15;};'use strict';var emlformat=require(_0xd4a3('0x0'));var rimraf=require(_0xd4a3('0x1'));var zipdir=require(_0xd4a3('0x2'));var jsonpatch=require(_0xd4a3('0x3'));var rp=require(_0xd4a3('0x4'));var moment=require(_0xd4a3('0x5'));var BPromise=require(_0xd4a3('0x6'));var Mustache=require(_0xd4a3('0x7'));var util=require(_0xd4a3('0x8'));var path=require(_0xd4a3('0x9'));var sox=require(_0xd4a3('0xa'));var csv=require(_0xd4a3('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd4a3('0xc'));var squel=require(_0xd4a3('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd4a3('0xe'));var toCsv=require(_0xd4a3('0xb'));var querystring=require(_0xd4a3('0xf'));var Papa=require(_0xd4a3('0x10'));var Redis=require(_0xd4a3('0x11'));var authService=require(_0xd4a3('0x12'));var qs=require(_0xd4a3('0x13'));var as=require(_0xd4a3('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd4a3('0x15'))(_0xd4a3('0x16'));var utils=require(_0xd4a3('0x17'));var config=require(_0xd4a3('0x18'));var licenseUtil=require(_0xd4a3('0x19'));var db=require(_0xd4a3('0x1a'))['db'];var integrations=require(_0xd4a3('0x1b'));function respondWithStatusCode(_0x57bd90,_0x3548e4){_0x3548e4=_0x3548e4||0xcc;return function(_0x2f4009){if(_0x2f4009){return _0x57bd90[_0xd4a3('0x1c')](_0x3548e4);}return _0x57bd90[_0xd4a3('0x1d')](_0x3548e4)[_0xd4a3('0x1e')]();};}function respondWithResult(_0x11f325,_0x2bfeb6){_0x2bfeb6=_0x2bfeb6||0xc8;return function(_0x306926){if(_0x306926){return _0x11f325['status'](_0x2bfeb6)['json'](_0x306926);}};}function respondWithFilteredResult(_0x140379,_0x2f96bb){return function(_0x124d03){if(_0x124d03){var _0xfd502c=typeof _0x2f96bb[_0xd4a3('0x1f')]===_0xd4a3('0x20')&&typeof _0x2f96bb['limit']===_0xd4a3('0x20');var _0x56ab48=_0x124d03[_0xd4a3('0x21')];var _0x592077=_0xfd502c?0x0:_0x2f96bb[_0xd4a3('0x1f')];var _0x4b8850=_0xfd502c?_0x124d03[_0xd4a3('0x21')]:_0x2f96bb[_0xd4a3('0x1f')]+_0x2f96bb['limit'];var _0x40973a;if(_0x4b8850>=_0x56ab48){_0x4b8850=_0x56ab48;_0x40973a=0xc8;}else{_0x40973a=0xce;}_0x140379[_0xd4a3('0x1d')](_0x40973a);return _0x140379[_0xd4a3('0x22')]('Content-Range',_0x592077+'-'+_0x4b8850+'/'+_0x56ab48)['json'](_0x124d03);}return null;};}function patchUpdates(_0x21efd7){return function(_0x5b2526){try{jsonpatch[_0xd4a3('0x23')](_0x5b2526,_0x21efd7,!![]);}catch(_0x1d7134){return BPromise['reject'](_0x1d7134);}return _0x5b2526['save']();};}function saveUpdates(_0x4f957f,_0x40535d){return function(_0xd558a8){if(_0xd558a8){return _0xd558a8[_0xd4a3('0x24')](_0x4f957f)['then'](function(_0x2de130){return _0x2de130;});}return null;};}function removeEntity(_0x137bba,_0x1a4ced){return function(_0x2e632f){if(_0x2e632f){return _0x2e632f[_0xd4a3('0x25')]()[_0xd4a3('0x26')](function(){_0x137bba['status'](0xcc)[_0xd4a3('0x1e')]();});}};}function handleEntityNotFound(_0x1dea89,_0x50c8ac){return function(_0x2b6cd8){if(!_0x2b6cd8){_0x1dea89[_0xd4a3('0x1c')](0x194);}return _0x2b6cd8;};}function handleError(_0x26cb96,_0x4ce98a){_0x4ce98a=_0x4ce98a||0x1f4;return function(_0x37f09e){logger[_0xd4a3('0x27')](_0x37f09e[_0xd4a3('0x28')]);if(_0x37f09e['name']){delete _0x37f09e[_0xd4a3('0x29')];}_0x26cb96['status'](_0x4ce98a)[_0xd4a3('0x2a')](_0x37f09e);};}exports['index']=function(_0x3019a4,_0x5d84f2){var _0x2769b7={},_0x535ecd={},_0x3e471e={'count':0x0,'rows':[]};var _0x5d1039=_[_0xd4a3('0x2b')](db[_0xd4a3('0x2c')][_0xd4a3('0x2d')],function(_0x318159){return{'name':_0x318159[_0xd4a3('0x2e')],'type':_0x318159['type']['key']};});_0x535ecd[_0xd4a3('0x2f')]=_[_0xd4a3('0x2b')](_0x5d1039,_0xd4a3('0x29'));_0x535ecd[_0xd4a3('0x30')]=_['keys'](_0x3019a4[_0xd4a3('0x30')]);_0x535ecd[_0xd4a3('0x31')]=_['intersection'](_0x535ecd[_0xd4a3('0x2f')],_0x535ecd['query']);_0x2769b7[_0xd4a3('0x32')]=_[_0xd4a3('0x33')](_0x535ecd[_0xd4a3('0x2f')],qs[_0xd4a3('0x34')](_0x3019a4[_0xd4a3('0x30')][_0xd4a3('0x34')]));_0x2769b7[_0xd4a3('0x32')]=_0x2769b7[_0xd4a3('0x32')][_0xd4a3('0x35')]?_0x2769b7['attributes']:_0x535ecd[_0xd4a3('0x2f')];if(!_0x3019a4[_0xd4a3('0x30')][_0xd4a3('0x36')]('nolimit')){_0x2769b7[_0xd4a3('0x37')]=qs[_0xd4a3('0x37')](_0x3019a4[_0xd4a3('0x30')][_0xd4a3('0x37')]);_0x2769b7[_0xd4a3('0x1f')]=qs[_0xd4a3('0x1f')](_0x3019a4[_0xd4a3('0x30')]['offset']);}_0x2769b7[_0xd4a3('0x38')]=qs['sort'](_0x3019a4['query'][_0xd4a3('0x39')]);_0x2769b7[_0xd4a3('0x3a')]=qs[_0xd4a3('0x31')](_[_0xd4a3('0x3b')](_0x3019a4['query'],_0x535ecd[_0xd4a3('0x31')]),_0x5d1039);if(_0x3019a4['query'][_0xd4a3('0x3c')]){_0x2769b7[_0xd4a3('0x3a')]=_[_0xd4a3('0x3d')](_0x2769b7[_0xd4a3('0x3a')],{'$or':_['map'](_0x5d1039,function(_0x23c13a){if(_0x23c13a[_0xd4a3('0x3e')]!==_0xd4a3('0x3f')){var _0xa307c5={};_0xa307c5[_0x23c13a['name']]={'$like':'%'+_0x3019a4['query'][_0xd4a3('0x3c')]+'%'};return _0xa307c5;}})});}_0x2769b7=_[_0xd4a3('0x3d')]({},_0x2769b7,_0x3019a4[_0xd4a3('0x40')]);var _0x3c3cb8={'where':_0x2769b7[_0xd4a3('0x3a')]};return db[_0xd4a3('0x2c')][_0xd4a3('0x21')](_0x3c3cb8)['then'](function(_0x55b03c){_0x3e471e[_0xd4a3('0x21')]=_0x55b03c;if(_0x3019a4[_0xd4a3('0x30')][_0xd4a3('0x41')]){_0x2769b7[_0xd4a3('0x42')]=[{'all':!![]}];}return db[_0xd4a3('0x2c')][_0xd4a3('0x43')](_0x2769b7);})[_0xd4a3('0x26')](function(_0x27c840){_0x3e471e[_0xd4a3('0x44')]=_0x27c840;return _0x3e471e;})[_0xd4a3('0x26')](respondWithFilteredResult(_0x5d84f2,_0x2769b7))['catch'](handleError(_0x5d84f2,null));};exports[_0xd4a3('0x45')]=function(_0x29955b,_0x6e7362){var _0x40b847={'raw':![],'where':{'id':_0x29955b[_0xd4a3('0x46')]['id']}},_0x48256e={};_0x48256e['model']=_[_0xd4a3('0x47')](db['FreshdeskAccount'][_0xd4a3('0x2d')]);_0x48256e[_0xd4a3('0x30')]=_[_0xd4a3('0x47')](_0x29955b[_0xd4a3('0x30')]);_0x48256e[_0xd4a3('0x31')]=_['intersection'](_0x48256e[_0xd4a3('0x2f')],_0x48256e[_0xd4a3('0x30')]);_0x40b847[_0xd4a3('0x32')]=_['intersection'](_0x48256e[_0xd4a3('0x2f')],qs[_0xd4a3('0x34')](_0x29955b['query'][_0xd4a3('0x34')]));_0x40b847[_0xd4a3('0x32')]=_0x40b847[_0xd4a3('0x32')][_0xd4a3('0x35')]?_0x40b847[_0xd4a3('0x32')]:_0x48256e['model'];if(_0x29955b['query'][_0xd4a3('0x41')]){_0x40b847[_0xd4a3('0x42')]=[{'all':!![]}];}_0x40b847=_[_0xd4a3('0x3d')]({},_0x40b847,_0x29955b[_0xd4a3('0x40')]);return db[_0xd4a3('0x2c')][_0xd4a3('0x48')](_0x40b847)[_0xd4a3('0x26')](handleEntityNotFound(_0x6e7362,null))[_0xd4a3('0x26')](respondWithResult(_0x6e7362,null))['catch'](handleError(_0x6e7362,null));};exports[_0xd4a3('0x49')]=function(_0x1ba4b9,_0x52e74e){return db['FreshdeskAccount'][_0xd4a3('0x49')](_0x1ba4b9['body'],{})['then'](respondWithResult(_0x52e74e,0xc9))[_0xd4a3('0x4a')](handleError(_0x52e74e,null));};exports[_0xd4a3('0x24')]=function(_0x1b0051,_0x3f5c3a){if(_0x1b0051[_0xd4a3('0x4b')]['id']){delete _0x1b0051[_0xd4a3('0x4b')]['id'];}return db['FreshdeskAccount']['find']({'where':{'id':_0x1b0051['params']['id']}})[_0xd4a3('0x26')](handleEntityNotFound(_0x3f5c3a,null))['then'](saveUpdates(_0x1b0051[_0xd4a3('0x4b')],null))[_0xd4a3('0x26')](respondWithResult(_0x3f5c3a,null))[_0xd4a3('0x4a')](handleError(_0x3f5c3a,null));};exports[_0xd4a3('0x25')]=function(_0x37cdd3,_0x1ec9a3){return db[_0xd4a3('0x2c')]['find']({'where':{'id':_0x37cdd3[_0xd4a3('0x46')]['id']}})['then'](handleEntityNotFound(_0x1ec9a3,null))[_0xd4a3('0x26')](removeEntity(_0x1ec9a3,null))['catch'](handleError(_0x1ec9a3,null));};exports[_0xd4a3('0x4c')]=function(_0x31d2ca,_0x4f5039,_0x347049){var _0xd9ec86={};var _0x4f0db6={};var _0x40087b;var _0x155744;return db[_0xd4a3('0x2c')]['findOne']({'where':{'id':_0x31d2ca[_0xd4a3('0x46')]['id']}})[_0xd4a3('0x26')](handleEntityNotFound(_0x4f5039,null))[_0xd4a3('0x26')](function(_0x4d4491){if(_0x4d4491){_0x40087b=_0x4d4491;_0x4f0db6[_0xd4a3('0x2f')]=_[_0xd4a3('0x47')](db['FreshdeskConfiguration'][_0xd4a3('0x2d')]);_0x4f0db6[_0xd4a3('0x30')]=_[_0xd4a3('0x47')](_0x31d2ca[_0xd4a3('0x30')]);_0x4f0db6[_0xd4a3('0x31')]=_[_0xd4a3('0x33')](_0x4f0db6['model'],_0x4f0db6[_0xd4a3('0x30')]);_0xd9ec86[_0xd4a3('0x32')]=_[_0xd4a3('0x33')](_0x4f0db6[_0xd4a3('0x2f')],qs[_0xd4a3('0x34')](_0x31d2ca[_0xd4a3('0x30')][_0xd4a3('0x34')]));_0xd9ec86[_0xd4a3('0x32')]=_0xd9ec86[_0xd4a3('0x32')][_0xd4a3('0x35')]?_0xd9ec86[_0xd4a3('0x32')]:_0x4f0db6[_0xd4a3('0x2f')];_0xd9ec86[_0xd4a3('0x38')]=qs[_0xd4a3('0x39')](_0x31d2ca[_0xd4a3('0x30')][_0xd4a3('0x39')]);_0xd9ec86[_0xd4a3('0x3a')]=qs[_0xd4a3('0x31')](_['pick'](_0x31d2ca[_0xd4a3('0x30')],_0x4f0db6[_0xd4a3('0x31')]));if(_0x31d2ca[_0xd4a3('0x30')][_0xd4a3('0x3c')]){_0xd9ec86[_0xd4a3('0x3a')]=_[_0xd4a3('0x3d')](_0xd9ec86[_0xd4a3('0x3a')],{'$or':_['map'](_0xd9ec86['attributes'],function(_0x4293bf){var _0x55edc8={};_0x55edc8[_0x4293bf]={'$like':'%'+_0x31d2ca[_0xd4a3('0x30')][_0xd4a3('0x3c')]+'%'};return _0x55edc8;})});}_0xd9ec86=_[_0xd4a3('0x3d')]({},_0xd9ec86,_0x31d2ca[_0xd4a3('0x40')]);return _0x40087b[_0xd4a3('0x4c')](_0xd9ec86);}})['then'](function(_0x590c22){if(_0x590c22){_0x155744=_0x590c22[_0xd4a3('0x35')];if(!_0x31d2ca[_0xd4a3('0x30')][_0xd4a3('0x36')](_0xd4a3('0x4d'))){_0xd9ec86['limit']=qs['limit'](_0x31d2ca[_0xd4a3('0x30')][_0xd4a3('0x37')]);_0xd9ec86[_0xd4a3('0x1f')]=qs['offset'](_0x31d2ca['query']['offset']);}return _0x40087b[_0xd4a3('0x4c')](_0xd9ec86);}})['then'](function(_0x2fc74c){if(_0x2fc74c){return _0x2fc74c?{'count':_0x155744,'rows':_0x2fc74c}:null;}})[_0xd4a3('0x26')](respondWithResult(_0x4f5039,null))[_0xd4a3('0x4a')](handleError(_0x4f5039,null));};exports[_0xd4a3('0x4e')]=function(_0x4b0398,_0x2d152c,_0x4193be){if(_0x4b0398['body']['id']){delete _0x4b0398[_0xd4a3('0x4b')]['id'];}return db[_0xd4a3('0x2c')]['findOne']({'where':{'id':_0x4b0398['params']['id']}})['then'](handleEntityNotFound(_0x2d152c,null))[_0xd4a3('0x26')](function(_0x3b5037){if(_0x3b5037){_0x4b0398[_0xd4a3('0x4b')][_0xd4a3('0x4f')]=_0x3b5037['id'];_0x4b0398[_0xd4a3('0x4b')][_0xd4a3('0x50')]=integrations['getSubjects'](_0x4b0398[_0xd4a3('0x4b')]['channel'],_0x4b0398['body']['type']);_0x4b0398[_0xd4a3('0x4b')][_0xd4a3('0x51')]=integrations[_0xd4a3('0x52')](_0x4b0398[_0xd4a3('0x4b')][_0xd4a3('0x53')],_0x4b0398[_0xd4a3('0x4b')][_0xd4a3('0x3e')]);return db['FreshdeskConfiguration'][_0xd4a3('0x49')](_0x4b0398[_0xd4a3('0x4b')],{'include':[{'model':db[_0xd4a3('0x54')],'as':_0xd4a3('0x50')},{'model':db[_0xd4a3('0x54')],'as':_0xd4a3('0x51')}]});}return null;})[_0xd4a3('0x26')](respondWithResult(_0x2d152c,null))[_0xd4a3('0x4a')](handleError(_0x2d152c,null));};exports[_0xd4a3('0x55')]=function(_0x320c05,_0x49f4c5,_0x446d14){var _0x5b688e='';return db[_0xd4a3('0x2c')]['findOne']({'where':{'id':_0x320c05['params']['id']},'attributes':['id','remoteUri',_0xd4a3('0x56')]})[_0xd4a3('0x26')](handleEntityNotFound(_0x49f4c5,null))[_0xd4a3('0x26')](function(_0x5dcb3e){if(_0x5dcb3e){_0x5b688e=_0x5dcb3e[_0xd4a3('0x57')];var _0x524457=_0x5b688e[_0xd4a3('0x58')](-0x1);if(_0x524457==='/'){_0x5b688e=_0x5b688e[_0xd4a3('0x59')](0x0,_0x5b688e[_0xd4a3('0x5a')](_0x524457));}return rp({'method':_0xd4a3('0x5b'),'uri':util['format'](_0xd4a3('0x5c'),_0x5b688e,_0xd4a3('0x5d')),'headers':{'Authorization':util[_0xd4a3('0x5e')](_0xd4a3('0x5f'),new Buffer(util['format']('%s:X',_0x5dcb3e[_0xd4a3('0x56')]))[_0xd4a3('0x60')](_0xd4a3('0x61')))},'json':!![]});}})[_0xd4a3('0x26')](function(_0x4dc642){if(_0x4dc642){var _0x629f2d=['requester','subject',_0xd4a3('0x62'),_0xd4a3('0x63'),_0xd4a3('0x1d'),_0xd4a3('0x64'),_0xd4a3('0x65'),'source','ticket_type','group',_0xd4a3('0x66')];_[_0xd4a3('0x67')](_0x4dc642,function(_0x4e1992){return _0x629f2d[_0xd4a3('0x68')](_0x4e1992[_0xd4a3('0x29')])||!_0x4e1992['default']&&_0x4e1992[_0xd4a3('0x3e')]!==_0xd4a3('0x69')&&_0x4e1992['type']!=='custom_dropdown';});return{'count':_0x4dc642[_0xd4a3('0x35')],'rows':_[_0xd4a3('0x2b')](_0x4dc642,function(_0xd7b2cc){return{'id':_0xd7b2cc['name'],'name':_0xd7b2cc[_0xd4a3('0x6a')],'custom':!_0xd7b2cc[_0xd4a3('0x6b')],'options':_0xd7b2cc[_0xd4a3('0x6c')]?_[_0xd4a3('0x2b')](_0xd7b2cc[_0xd4a3('0x6c')],function(_0x10dd25){return{'name':_[_0xd4a3('0x6d')](_0x10dd25),'value':_0x10dd25};}):[]};})};}})[_0xd4a3('0x26')](respondWithResult(_0x49f4c5,null))[_0xd4a3('0x4a')](function(_0xa7a83b){var _0xb83eff=_0x320c05['query'][_0xd4a3('0x6e')]?0x1f4:_0xa7a83b[_0xd4a3('0x6f')]||0x1f4;logger['error'](_0xd4a3('0x70'),_0xd4a3('0x55'),_0xb83eff,JSON['stringify'](_0xa7a83b));delete _0xa7a83b[_0xd4a3('0x29')];if(_0xb83eff===0x191){_0xb83eff=0x190;}_0x49f4c5[_0xd4a3('0x1d')](_0xb83eff)[_0xd4a3('0x2a')](_0x320c05[_0xd4a3('0x30')][_0xd4a3('0x6e')]?{'message':'Wrong\x20credentials','statusCode':_0xa7a83b[_0xd4a3('0x6f')]}:_0xa7a83b);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 98bf0db..191251c 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 _0xd8ac=['int_freshdesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../components/integrations/configuration','exports','define'];(function(_0x55894d,_0xaf2869){var _0x3a86ed=function(_0x432fed){while(--_0x432fed){_0x55894d['push'](_0x55894d['shift']());}};_0x3a86ed(++_0xaf2869);}(_0xd8ac,0x112));var _0xcd8a=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xd8ac[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xcd8a('0x0'));var util=require(_0xcd8a('0x1'));var logger=require(_0xcd8a('0x2'))(_0xcd8a('0x3'));var moment=require(_0xcd8a('0x4'));var BPromise=require(_0xcd8a('0x5'));var rp=require(_0xcd8a('0x6'));var fs=require('fs');var path=require(_0xcd8a('0x7'));var rimraf=require(_0xcd8a('0x8'));var config=require('../../config/environment');var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0xcd8a('0x9'));module[_0xcd8a('0xa')]=function(_0x586db5,_0x5e27a3){return _0x586db5[_0xcd8a('0xb')]('FreshdeskAccount',attributes,{'tableName':_0xcd8a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x415a=['int_freshdesk_accounts','lodash','util','api','moment','bluebird','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','define','FreshdeskAccount'];(function(_0x864244,_0x5cd4d6){var _0x6b0119=function(_0x3e195e){while(--_0x3e195e){_0x864244['push'](_0x864244['shift']());}};_0x6b0119(++_0x5cd4d6);}(_0x415a,0x1b1));var _0xa415=function(_0x46afce,_0xde35ef){_0x46afce=_0x46afce-0x0;var _0x382f7e=_0x415a[_0x46afce];return _0x382f7e;};'use strict';var _=require(_0xa415('0x0'));var util=require(_0xa415('0x1'));var logger=require('../../config/logger')(_0xa415('0x2'));var moment=require(_0xa415('0x3'));var BPromise=require(_0xa415('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa415('0x5'));var config=require(_0xa415('0x6'));var attributes=require(_0xa415('0x7'));var integrations=require(_0xa415('0x8'));module['exports']=function(_0x3be544,_0x122313){return _0x3be544[_0xa415('0x9')](_0xa415('0xa'),attributes,{'tableName':_0xa415('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 482b87c..cf13a91 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 _0x8767=['error','code','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','raw','options','attributes','limit','include','model','map','info','stringify','ShowFreshdeskAccount','find','where','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x8767,0x134));var _0x7876=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8767[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x7876('0x0'));var moment=require(_0x7876('0x1'));var BPromise=require(_0x7876('0x2'));var rs=require(_0x7876('0x3'));var fs=require('fs');var Redis=require(_0x7876('0x4'));var db=require(_0x7876('0x5'))['db'];var utils=require(_0x7876('0x6'));var logger=require(_0x7876('0x7'))(_0x7876('0x8'));var config=require(_0x7876('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7876('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x484227,_0x43e86f,_0x167524){return new BPromise(function(_0x11fdd1,_0x19e7d3){return client['request'](_0x484227,_0x167524)[_0x7876('0xb')](function(_0x50136a){logger['info'](_0x7876('0xc'),_0x43e86f,_0x7876('0xd'));logger[_0x7876('0xe')](_0x7876('0xf'),_0x43e86f,_0x7876('0xd'),JSON['stringify'](_0x50136a));if(_0x50136a[_0x7876('0x10')]){if(_0x50136a[_0x7876('0x10')][_0x7876('0x11')]===0x1f4){logger[_0x7876('0x10')](_0x7876('0xc'),_0x43e86f,_0x50136a[_0x7876('0x10')][_0x7876('0x12')]);return _0x19e7d3(_0x50136a[_0x7876('0x10')][_0x7876('0x12')]);}logger[_0x7876('0x10')](_0x7876('0xc'),_0x43e86f,_0x50136a[_0x7876('0x10')]['message']);return _0x11fdd1(_0x50136a[_0x7876('0x10')][_0x7876('0x12')]);}else{logger['info'](_0x7876('0xc'),_0x43e86f,'request\x20sent');_0x11fdd1(_0x50136a[_0x7876('0x13')][_0x7876('0x12')]);}})[_0x7876('0x14')](function(_0x4c825d){logger[_0x7876('0x10')](_0x7876('0xc'),_0x43e86f,_0x4c825d);_0x19e7d3(_0x4c825d);});});}exports[_0x7876('0x15')]=function(_0x18a301){var _0x594503=this;return new Promise(function(_0xaf8a14,_0x8c969e){return db[_0x7876('0x16')][_0x7876('0x17')]({'raw':_0x18a301['options']?_0x18a301['options'][_0x7876('0x18')]===undefined?!![]:![]:!![],'where':_0x18a301['options']?_0x18a301[_0x7876('0x19')]['where']||null:null,'attributes':_0x18a301[_0x7876('0x19')]?_0x18a301[_0x7876('0x19')][_0x7876('0x1a')]||null:null,'limit':_0x18a301['options']?_0x18a301[_0x7876('0x19')][_0x7876('0x1b')]||null:null,'include':_0x18a301[_0x7876('0x19')]?_0x18a301['options'][_0x7876('0x1c')]?_['map'](_0x18a301[_0x7876('0x19')][_0x7876('0x1c')],function(_0x140f5e){return{'model':db[_0x140f5e[_0x7876('0x1d')]],'as':_0x140f5e['as'],'attributes':_0x140f5e[_0x7876('0x1a')],'include':_0x140f5e[_0x7876('0x1c')]?_[_0x7876('0x1e')](_0x140f5e['include'],function(_0x30bfed){return{'model':db[_0x30bfed[_0x7876('0x1d')]],'as':_0x30bfed['as'],'attributes':_0x30bfed[_0x7876('0x1a')],'include':_0x30bfed[_0x7876('0x1c')]?_[_0x7876('0x1e')](_0x30bfed['include'],function(_0x35ce2b){return{'model':db[_0x35ce2b[_0x7876('0x1d')]],'as':_0x35ce2b['as'],'attributes':_0x35ce2b[_0x7876('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x7876('0xb')](function(_0x3a6646){logger[_0x7876('0x1f')](_0x7876('0x15'),_0x18a301);logger[_0x7876('0xe')](_0x7876('0x15'),_0x18a301,JSON[_0x7876('0x20')](_0x3a6646));_0xaf8a14(_0x3a6646);})[_0x7876('0x14')](function(_0x346799){logger[_0x7876('0x10')](_0x7876('0x15'),_0x346799[_0x7876('0x12')],_0x18a301);_0x8c969e(_0x594503[_0x7876('0x10')](0x1f4,_0x346799[_0x7876('0x12')]));});});};exports[_0x7876('0x21')]=function(_0x3aceab){var _0x307cb2=this;return new Promise(function(_0x49648a,_0x3c614a){return db[_0x7876('0x16')][_0x7876('0x22')]({'raw':_0x3aceab[_0x7876('0x19')]?_0x3aceab['options'][_0x7876('0x18')]===undefined?!![]:![]:!![],'where':_0x3aceab[_0x7876('0x19')]?_0x3aceab[_0x7876('0x19')][_0x7876('0x23')]||null:null,'attributes':_0x3aceab[_0x7876('0x19')]?_0x3aceab['options'][_0x7876('0x1a')]||null:null,'include':_0x3aceab[_0x7876('0x19')]?_0x3aceab[_0x7876('0x19')][_0x7876('0x1c')]?_[_0x7876('0x1e')](_0x3aceab[_0x7876('0x19')][_0x7876('0x1c')],function(_0x4f5ab6){return{'model':db[_0x4f5ab6[_0x7876('0x1d')]],'as':_0x4f5ab6['as'],'attributes':_0x4f5ab6[_0x7876('0x1a')],'include':_0x4f5ab6['include']?_[_0x7876('0x1e')](_0x4f5ab6[_0x7876('0x1c')],function(_0x5d301f){return{'model':db[_0x5d301f[_0x7876('0x1d')]],'as':_0x5d301f['as'],'attributes':_0x5d301f[_0x7876('0x1a')],'include':_0x5d301f[_0x7876('0x1c')]?_[_0x7876('0x1e')](_0x5d301f[_0x7876('0x1c')],function(_0x3e382b){return{'model':db[_0x3e382b['model']],'as':_0x3e382b['as'],'attributes':_0x3e382b['attributes']};}):[]};}):[]};}):[]:[]})[_0x7876('0xb')](function(_0x326cc9){logger[_0x7876('0x1f')](_0x7876('0x21'),_0x3aceab);logger[_0x7876('0xe')](_0x7876('0x21'),_0x3aceab,JSON[_0x7876('0x20')](_0x326cc9));_0x49648a(_0x326cc9);})[_0x7876('0x14')](function(_0x2ca9fe){logger['error'](_0x7876('0x21'),_0x2ca9fe['message'],_0x3aceab);_0x3c614a(_0x307cb2[_0x7876('0x10')](0x1f4,_0x2ca9fe[_0x7876('0x12')]));});});}; \ No newline at end of file +var _0x8aa5=['limit','include','map','model','ShowFreshdeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x8aa5,0x78));var _0x58aa=function(_0x5f3b50,_0x226ca7){_0x5f3b50=_0x5f3b50-0x0;var _0xf3ec36=_0x8aa5[_0x5f3b50];return _0xf3ec36;};'use strict';var _=require(_0x58aa('0x0'));var util=require(_0x58aa('0x1'));var moment=require(_0x58aa('0x2'));var BPromise=require(_0x58aa('0x3'));var rs=require(_0x58aa('0x4'));var fs=require('fs');var Redis=require(_0x58aa('0x5'));var db=require(_0x58aa('0x6'))['db'];var utils=require(_0x58aa('0x7'));var logger=require(_0x58aa('0x8'))(_0x58aa('0x9'));var config=require('../../config/environment');var jayson=require(_0x58aa('0xa'));var client=jayson[_0x58aa('0xb')][_0x58aa('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x8c5e44,_0x47d691,_0x1fd061){return new BPromise(function(_0x4a70f2,_0x7f3997){return client['request'](_0x8c5e44,_0x1fd061)[_0x58aa('0xd')](function(_0x35faad){logger[_0x58aa('0xe')](_0x58aa('0xf'),_0x47d691,_0x58aa('0x10'));logger[_0x58aa('0x11')](_0x58aa('0x12'),_0x47d691,_0x58aa('0x10'),JSON[_0x58aa('0x13')](_0x35faad));if(_0x35faad[_0x58aa('0x14')]){if(_0x35faad['error'][_0x58aa('0x15')]===0x1f4){logger['error'](_0x58aa('0xf'),_0x47d691,_0x35faad['error'][_0x58aa('0x16')]);return _0x7f3997(_0x35faad[_0x58aa('0x14')][_0x58aa('0x16')]);}logger[_0x58aa('0x14')](_0x58aa('0xf'),_0x47d691,_0x35faad[_0x58aa('0x14')][_0x58aa('0x16')]);return _0x4a70f2(_0x35faad[_0x58aa('0x14')][_0x58aa('0x16')]);}else{logger[_0x58aa('0xe')]('FreshdeskAccount,\x20%s,\x20%s',_0x47d691,_0x58aa('0x10'));_0x4a70f2(_0x35faad[_0x58aa('0x17')][_0x58aa('0x16')]);}})[_0x58aa('0x18')](function(_0x1baffc){logger[_0x58aa('0x14')](_0x58aa('0xf'),_0x47d691,_0x1baffc);_0x7f3997(_0x1baffc);});});}exports[_0x58aa('0x19')]=function(_0x542386){var _0x489663=this;return new Promise(function(_0x1ee792,_0x436092){return db[_0x58aa('0x1a')][_0x58aa('0x1b')]({'raw':_0x542386[_0x58aa('0x1c')]?_0x542386[_0x58aa('0x1c')][_0x58aa('0x1d')]===undefined?!![]:![]:!![],'where':_0x542386[_0x58aa('0x1c')]?_0x542386[_0x58aa('0x1c')][_0x58aa('0x1e')]||null:null,'attributes':_0x542386[_0x58aa('0x1c')]?_0x542386[_0x58aa('0x1c')][_0x58aa('0x1f')]||null:null,'limit':_0x542386[_0x58aa('0x1c')]?_0x542386[_0x58aa('0x1c')][_0x58aa('0x20')]||null:null,'include':_0x542386[_0x58aa('0x1c')]?_0x542386[_0x58aa('0x1c')][_0x58aa('0x21')]?_[_0x58aa('0x22')](_0x542386[_0x58aa('0x1c')][_0x58aa('0x21')],function(_0xbfafe7){return{'model':db[_0xbfafe7['model']],'as':_0xbfafe7['as'],'attributes':_0xbfafe7['attributes'],'include':_0xbfafe7[_0x58aa('0x21')]?_[_0x58aa('0x22')](_0xbfafe7[_0x58aa('0x21')],function(_0x2041c6){return{'model':db[_0x2041c6['model']],'as':_0x2041c6['as'],'attributes':_0x2041c6[_0x58aa('0x1f')],'include':_0x2041c6['include']?_[_0x58aa('0x22')](_0x2041c6[_0x58aa('0x21')],function(_0xe7ae31){return{'model':db[_0xe7ae31[_0x58aa('0x23')]],'as':_0xe7ae31['as'],'attributes':_0xe7ae31[_0x58aa('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x595d21){logger['info'](_0x58aa('0x19'),_0x542386);logger['debug']('GetFreshdeskAccount',_0x542386,JSON[_0x58aa('0x13')](_0x595d21));_0x1ee792(_0x595d21);})[_0x58aa('0x18')](function(_0x27c8be){logger['error'](_0x58aa('0x19'),_0x27c8be[_0x58aa('0x16')],_0x542386);_0x436092(_0x489663[_0x58aa('0x14')](0x1f4,_0x27c8be[_0x58aa('0x16')]));});});};exports[_0x58aa('0x24')]=function(_0x2d535c){var _0x4de66c=this;return new Promise(function(_0x70f1e4,_0x14bf7a){return db[_0x58aa('0x1a')][_0x58aa('0x25')]({'raw':_0x2d535c[_0x58aa('0x1c')]?_0x2d535c[_0x58aa('0x1c')][_0x58aa('0x1d')]===undefined?!![]:![]:!![],'where':_0x2d535c[_0x58aa('0x1c')]?_0x2d535c['options'][_0x58aa('0x1e')]||null:null,'attributes':_0x2d535c[_0x58aa('0x1c')]?_0x2d535c[_0x58aa('0x1c')][_0x58aa('0x1f')]||null:null,'include':_0x2d535c[_0x58aa('0x1c')]?_0x2d535c[_0x58aa('0x1c')][_0x58aa('0x21')]?_[_0x58aa('0x22')](_0x2d535c[_0x58aa('0x1c')][_0x58aa('0x21')],function(_0x1f7550){return{'model':db[_0x1f7550['model']],'as':_0x1f7550['as'],'attributes':_0x1f7550['attributes'],'include':_0x1f7550['include']?_[_0x58aa('0x22')](_0x1f7550[_0x58aa('0x21')],function(_0x49d666){return{'model':db[_0x49d666[_0x58aa('0x23')]],'as':_0x49d666['as'],'attributes':_0x49d666[_0x58aa('0x1f')],'include':_0x49d666[_0x58aa('0x21')]?_[_0x58aa('0x22')](_0x49d666[_0x58aa('0x21')],function(_0x4a680e){return{'model':db[_0x4a680e[_0x58aa('0x23')]],'as':_0x4a680e['as'],'attributes':_0x4a680e[_0x58aa('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e8390){logger[_0x58aa('0xe')](_0x58aa('0x24'),_0x2d535c);logger[_0x58aa('0x11')](_0x58aa('0x24'),_0x2d535c,JSON[_0x58aa('0x13')](_0x3e8390));_0x70f1e4(_0x3e8390);})[_0x58aa('0x18')](function(_0x4725b1){logger['error'](_0x58aa('0x24'),_0x4725b1['message'],_0x2d535c);_0x14bf7a(_0x4de66c[_0x58aa('0x14')](0x1f4,_0x4725b1[_0x58aa('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index c45a72b..f8fa443 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 _0xeabd=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','post','create','setTags','put','delete','exports','multer','util'];(function(_0x231eb9,_0x30d1e5){var _0x3a778c=function(_0x348a7b){while(--_0x348a7b){_0x231eb9['push'](_0x231eb9['shift']());}};_0x3a778c(++_0x30d1e5);}(_0xeabd,0x18e));var _0xdeab=function(_0x300cbb,_0x116697){_0x300cbb=_0x300cbb-0x0;var _0x390c66=_0xeabd[_0x300cbb];return _0x390c66;};'use strict';var multer=require(_0xdeab('0x0'));var util=require(_0xdeab('0x1'));var path=require('path');var timeout=require(_0xdeab('0x2'));var express=require(_0xdeab('0x3'));var router=express[_0xdeab('0x4')]();var fs_extra=require(_0xdeab('0x5'));var auth=require(_0xdeab('0x6'));var interaction=require(_0xdeab('0x7'));var config=require(_0xdeab('0x8'));var controller=require(_0xdeab('0x9'));router[_0xdeab('0xa')]('/',auth[_0xdeab('0xb')](),controller[_0xdeab('0xc')]);router[_0xdeab('0xa')](_0xdeab('0xd'),auth[_0xdeab('0xb')](),controller['show']);router[_0xdeab('0xa')](_0xdeab('0xe'),auth[_0xdeab('0xb')](),controller['getFields']);router[_0xdeab('0xa')](_0xdeab('0xf'),auth[_0xdeab('0xb')](),controller[_0xdeab('0x10')]);router[_0xdeab('0xa')]('/:id/descriptions',auth[_0xdeab('0xb')](),controller[_0xdeab('0x11')]);router[_0xdeab('0xa')](_0xdeab('0x12'),auth[_0xdeab('0xb')](),controller['getTags']);router[_0xdeab('0x13')]('/',auth['isAuthenticated'](),controller[_0xdeab('0x14')]);router[_0xdeab('0x13')]('/:id/tags',auth[_0xdeab('0xb')](),controller[_0xdeab('0x15')]);router[_0xdeab('0x16')](_0xdeab('0xd'),auth[_0xdeab('0xb')](),controller['update']);router[_0xdeab('0x17')](_0xdeab('0xd'),auth[_0xdeab('0xb')](),controller['destroy']);module[_0xdeab('0x18')]=router; \ No newline at end of file +var _0xc097=['put','update','destroy','exports','multer','util','path','connect-timeout','fs-extra','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','getSubjects','/:id/tags','getTags','post'];(function(_0x55ff3e,_0x41077f){var _0x2709eb=function(_0x45563a){while(--_0x45563a){_0x55ff3e['push'](_0x55ff3e['shift']());}};_0x2709eb(++_0x41077f);}(_0xc097,0xb8));var _0x7c09=function(_0x16ec83,_0x5b853d){_0x16ec83=_0x16ec83-0x0;var _0x449b22=_0xc097[_0x16ec83];return _0x449b22;};'use strict';var multer=require(_0x7c09('0x0'));var util=require(_0x7c09('0x1'));var path=require(_0x7c09('0x2'));var timeout=require(_0x7c09('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7c09('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7c09('0x5'));router[_0x7c09('0x6')]('/',auth[_0x7c09('0x7')](),controller[_0x7c09('0x8')]);router[_0x7c09('0x6')](_0x7c09('0x9'),auth[_0x7c09('0x7')](),controller['show']);router[_0x7c09('0x6')](_0x7c09('0xa'),auth['isAuthenticated'](),controller[_0x7c09('0xb')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0x7c09('0xc')]);router[_0x7c09('0x6')]('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router[_0x7c09('0x6')](_0x7c09('0xd'),auth[_0x7c09('0x7')](),controller[_0x7c09('0xe')]);router[_0x7c09('0xf')]('/',auth[_0x7c09('0x7')](),controller['create']);router[_0x7c09('0xf')](_0x7c09('0xd'),auth[_0x7c09('0x7')](),controller['setTags']);router[_0x7c09('0x10')](_0x7c09('0x9'),auth[_0x7c09('0x7')](),controller[_0x7c09('0x11')]);router['delete'](_0x7c09('0x9'),auth[_0x7c09('0x7')](),controller[_0x7c09('0x12')]);module[_0x7c09('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index a18ea41..72e0cfa 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 _0x4af9=['sequelize','STRING'];(function(_0x50f01f,_0x21fed8){var _0x4c4f95=function(_0x2f6547){while(--_0x2f6547){_0x50f01f['push'](_0x50f01f['shift']());}};_0x4c4f95(++_0x21fed8);}(_0x4af9,0x180));var _0x94af=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x4af9[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0x94af('0x0'));module['exports']={'name':{'type':Sequelize[_0x94af('0x1')]},'description':{'type':Sequelize[_0x94af('0x1')]}}; \ No newline at end of file +var _0xb101=['exports','STRING','sequelize'];(function(_0x3b711c,_0x4b22dc){var _0x2685f0=function(_0x3b5ba6){while(--_0x3b5ba6){_0x3b711c['push'](_0x3b711c['shift']());}};_0x2685f0(++_0x4b22dc);}(_0xb101,0xda));var _0x1b10=function(_0x4a14dd,_0x431e28){_0x4a14dd=_0x4a14dd-0x0;var _0x30214f=_0xb101[_0x4a14dd];return _0x30214f;};'use strict';var Sequelize=require(_0x1b10('0x0'));module[_0x1b10('0x1')]={'name':{'type':Sequelize[_0x1b10('0x2')]},'description':{'type':Sequelize[_0x1b10('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index d63f577..6be5792 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 _0xa334=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','destroy','error','stack','name','map','FreshdeskConfiguration','rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','findOne','FreshdeskField','nolimit','getSubjects','getDescriptions','hasOwnProperty','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xa334,0xf7));var _0x4a33=function(_0xdf3b47,_0x4cf854){_0xdf3b47=_0xdf3b47-0x0;var _0x215487=_0xa334[_0xdf3b47];return _0x215487;};'use strict';var emlformat=require(_0x4a33('0x0'));var rimraf=require(_0x4a33('0x1'));var zipdir=require(_0x4a33('0x2'));var jsonpatch=require(_0x4a33('0x3'));var rp=require(_0x4a33('0x4'));var moment=require(_0x4a33('0x5'));var BPromise=require(_0x4a33('0x6'));var Mustache=require(_0x4a33('0x7'));var util=require('util');var path=require(_0x4a33('0x8'));var sox=require(_0x4a33('0x9'));var csv=require(_0x4a33('0xa'));var ejs=require(_0x4a33('0xb'));var fs=require('fs');var fs_extra=require(_0x4a33('0xc'));var _=require(_0x4a33('0xd'));var squel=require(_0x4a33('0xe'));var crypto=require(_0x4a33('0xf'));var jsforce=require(_0x4a33('0x10'));var deskjs=require(_0x4a33('0x11'));var toCsv=require(_0x4a33('0xa'));var querystring=require('querystring');var Papa=require(_0x4a33('0x12'));var Redis=require(_0x4a33('0x13'));var authService=require(_0x4a33('0x14'));var qs=require(_0x4a33('0x15'));var as=require(_0x4a33('0x16'));var hardwareService=require(_0x4a33('0x17'));var logger=require('../../config/logger')(_0x4a33('0x18'));var utils=require(_0x4a33('0x19'));var config=require(_0x4a33('0x1a'));var licenseUtil=require(_0x4a33('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b8420,_0xb791e5){_0xb791e5=_0xb791e5||0xcc;return function(_0x445541){if(_0x445541){return _0x2b8420[_0x4a33('0x1c')](_0xb791e5);}return _0x2b8420[_0x4a33('0x1d')](_0xb791e5)[_0x4a33('0x1e')]();};}function respondWithResult(_0x5ad354,_0x584d56){_0x584d56=_0x584d56||0xc8;return function(_0x4fe3e6){if(_0x4fe3e6){return _0x5ad354[_0x4a33('0x1d')](_0x584d56)[_0x4a33('0x1f')](_0x4fe3e6);}};}function respondWithFilteredResult(_0x55d16c,_0x620e10){return function(_0x28daf3){if(_0x28daf3){var _0x42804e=typeof _0x620e10[_0x4a33('0x20')]===_0x4a33('0x21')&&typeof _0x620e10['limit']==='undefined';var _0x1f8d3c=_0x28daf3[_0x4a33('0x22')];var _0x5ed2a7=_0x42804e?0x0:_0x620e10['offset'];var _0x5b04ac=_0x42804e?_0x28daf3[_0x4a33('0x22')]:_0x620e10[_0x4a33('0x20')]+_0x620e10[_0x4a33('0x23')];var _0x535e3e;if(_0x5b04ac>=_0x1f8d3c){_0x5b04ac=_0x1f8d3c;_0x535e3e=0xc8;}else{_0x535e3e=0xce;}_0x55d16c[_0x4a33('0x1d')](_0x535e3e);return _0x55d16c['set'](_0x4a33('0x24'),_0x5ed2a7+'-'+_0x5b04ac+'/'+_0x1f8d3c)[_0x4a33('0x1f')](_0x28daf3);}return null;};}function patchUpdates(_0x1fd64d){return function(_0x5a4df7){try{jsonpatch[_0x4a33('0x25')](_0x5a4df7,_0x1fd64d,!![]);}catch(_0x584edb){return BPromise[_0x4a33('0x26')](_0x584edb);}return _0x5a4df7['save']();};}function saveUpdates(_0x5d0b51,_0x5a7bfa){return function(_0x3259f9){if(_0x3259f9){return _0x3259f9[_0x4a33('0x27')](_0x5d0b51)[_0x4a33('0x28')](function(_0x4e828b){return _0x4e828b;});}return null;};}function removeEntity(_0x1b4167,_0xaa0313){return function(_0x946d8b){if(_0x946d8b){return _0x946d8b[_0x4a33('0x29')]()['then'](function(){_0x1b4167[_0x4a33('0x1d')](0xcc)[_0x4a33('0x1e')]();});}};}function handleEntityNotFound(_0x3b753a,_0x3751aa){return function(_0x2c2819){if(!_0x2c2819){_0x3b753a[_0x4a33('0x1c')](0x194);}return _0x2c2819;};}function handleError(_0x45322f,_0x16579f){_0x16579f=_0x16579f||0x1f4;return function(_0x3b5a3a){logger[_0x4a33('0x2a')](_0x3b5a3a[_0x4a33('0x2b')]);if(_0x3b5a3a[_0x4a33('0x2c')]){delete _0x3b5a3a[_0x4a33('0x2c')];}_0x45322f['status'](_0x16579f)['send'](_0x3b5a3a);};}exports['index']=function(_0x3e3e9a,_0x4c27b2){var _0x3b39d5={},_0x2cc885={},_0x241ccf={'count':0x0,'rows':[]};var _0x23741c=_[_0x4a33('0x2d')](db[_0x4a33('0x2e')][_0x4a33('0x2f')],function(_0x3a693b){return{'name':_0x3a693b[_0x4a33('0x30')],'type':_0x3a693b[_0x4a33('0x31')]['key']};});_0x2cc885[_0x4a33('0x32')]=_[_0x4a33('0x2d')](_0x23741c,_0x4a33('0x2c'));_0x2cc885['query']=_[_0x4a33('0x33')](_0x3e3e9a['query']);_0x2cc885[_0x4a33('0x34')]=_[_0x4a33('0x35')](_0x2cc885['model'],_0x2cc885[_0x4a33('0x36')]);_0x3b39d5[_0x4a33('0x37')]=_[_0x4a33('0x35')](_0x2cc885['model'],qs[_0x4a33('0x38')](_0x3e3e9a['query'][_0x4a33('0x38')]));_0x3b39d5['attributes']=_0x3b39d5[_0x4a33('0x37')][_0x4a33('0x39')]?_0x3b39d5['attributes']:_0x2cc885[_0x4a33('0x32')];if(!_0x3e3e9a[_0x4a33('0x36')]['hasOwnProperty']('nolimit')){_0x3b39d5[_0x4a33('0x23')]=qs[_0x4a33('0x23')](_0x3e3e9a[_0x4a33('0x36')][_0x4a33('0x23')]);_0x3b39d5['offset']=qs[_0x4a33('0x20')](_0x3e3e9a[_0x4a33('0x36')][_0x4a33('0x20')]);}_0x3b39d5[_0x4a33('0x3a')]=qs['sort'](_0x3e3e9a[_0x4a33('0x36')][_0x4a33('0x3b')]);_0x3b39d5[_0x4a33('0x3c')]=qs[_0x4a33('0x34')](_[_0x4a33('0x3d')](_0x3e3e9a[_0x4a33('0x36')],_0x2cc885['filters']),_0x23741c);if(_0x3e3e9a[_0x4a33('0x36')][_0x4a33('0x3e')]){_0x3b39d5[_0x4a33('0x3c')]=_[_0x4a33('0x3f')](_0x3b39d5[_0x4a33('0x3c')],{'$or':_[_0x4a33('0x2d')](_0x23741c,function(_0x4a9213){if(_0x4a9213[_0x4a33('0x31')]!=='VIRTUAL'){var _0xd58c8f={};_0xd58c8f[_0x4a9213[_0x4a33('0x2c')]]={'$like':'%'+_0x3e3e9a['query'][_0x4a33('0x3e')]+'%'};return _0xd58c8f;}})});}_0x3b39d5=_['merge']({},_0x3b39d5,_0x3e3e9a[_0x4a33('0x40')]);var _0x3be38e={'where':_0x3b39d5[_0x4a33('0x3c')]};return db[_0x4a33('0x2e')][_0x4a33('0x22')](_0x3be38e)['then'](function(_0x2d7dbf){_0x241ccf[_0x4a33('0x22')]=_0x2d7dbf;if(_0x3e3e9a['query'][_0x4a33('0x41')]){_0x3b39d5[_0x4a33('0x42')]=[{'all':!![]}];}return db[_0x4a33('0x2e')][_0x4a33('0x43')](_0x3b39d5);})[_0x4a33('0x28')](function(_0x17e89f){_0x241ccf[_0x4a33('0x44')]=_0x17e89f;return _0x241ccf;})[_0x4a33('0x28')](respondWithFilteredResult(_0x4c27b2,_0x3b39d5))[_0x4a33('0x45')](handleError(_0x4c27b2,null));};exports[_0x4a33('0x46')]=function(_0x1d32ae,_0x290f35){var _0x5721f7={'raw':![],'where':{'id':_0x1d32ae[_0x4a33('0x47')]['id']}},_0x5bd8a7={};_0x5bd8a7[_0x4a33('0x32')]=_['keys'](db[_0x4a33('0x2e')]['rawAttributes']);_0x5bd8a7['query']=_[_0x4a33('0x33')](_0x1d32ae['query']);_0x5bd8a7[_0x4a33('0x34')]=_['intersection'](_0x5bd8a7[_0x4a33('0x32')],_0x5bd8a7['query']);_0x5721f7[_0x4a33('0x37')]=_['intersection'](_0x5bd8a7['model'],qs[_0x4a33('0x38')](_0x1d32ae[_0x4a33('0x36')]['fields']));_0x5721f7[_0x4a33('0x37')]=_0x5721f7[_0x4a33('0x37')]['length']?_0x5721f7[_0x4a33('0x37')]:_0x5bd8a7[_0x4a33('0x32')];if(_0x1d32ae[_0x4a33('0x36')][_0x4a33('0x41')]){_0x5721f7[_0x4a33('0x42')]=[{'all':!![]}];}_0x5721f7=_['merge']({},_0x5721f7,_0x1d32ae[_0x4a33('0x40')]);return db[_0x4a33('0x2e')][_0x4a33('0x48')](_0x5721f7)[_0x4a33('0x28')](handleEntityNotFound(_0x290f35,null))[_0x4a33('0x28')](respondWithResult(_0x290f35,null))[_0x4a33('0x45')](handleError(_0x290f35,null));};exports[_0x4a33('0x49')]=function(_0x541ef6,_0x2308fe){return db['FreshdeskConfiguration'][_0x4a33('0x49')](_0x541ef6[_0x4a33('0x4a')],{})[_0x4a33('0x28')](respondWithResult(_0x2308fe,0xc9))[_0x4a33('0x45')](handleError(_0x2308fe,null));};exports['update']=function(_0x1a7fc9,_0x4c0fb5){if(_0x1a7fc9[_0x4a33('0x4a')]['id']){delete _0x1a7fc9[_0x4a33('0x4a')]['id'];}return db[_0x4a33('0x2e')][_0x4a33('0x48')]({'where':{'id':_0x1a7fc9[_0x4a33('0x47')]['id']}})[_0x4a33('0x28')](handleEntityNotFound(_0x4c0fb5,null))['then'](saveUpdates(_0x1a7fc9['body'],null))[_0x4a33('0x28')](respondWithResult(_0x4c0fb5,null))[_0x4a33('0x45')](handleError(_0x4c0fb5,null));};exports[_0x4a33('0x29')]=function(_0x3c25a9,_0x3782a6){return db[_0x4a33('0x2e')][_0x4a33('0x48')]({'where':{'id':_0x3c25a9[_0x4a33('0x47')]['id']}})[_0x4a33('0x28')](handleEntityNotFound(_0x3782a6,null))[_0x4a33('0x28')](removeEntity(_0x3782a6,null))[_0x4a33('0x45')](handleError(_0x3782a6,null));};exports[_0x4a33('0x4b')]=function(_0xd343fc,_0x2bdc51,_0x48a597){var _0x507030={};var _0xbb18d9={};var _0x341774;var _0x2c3af6;return db['FreshdeskConfiguration'][_0x4a33('0x4c')]({'where':{'id':_0xd343fc[_0x4a33('0x47')]['id']}})[_0x4a33('0x28')](handleEntityNotFound(_0x2bdc51,null))['then'](function(_0xd579c3){if(_0xd579c3){_0x341774=_0xd579c3;_0xbb18d9[_0x4a33('0x32')]=_[_0x4a33('0x33')](db[_0x4a33('0x4d')]['rawAttributes']);_0xbb18d9['query']=_[_0x4a33('0x33')](_0xd343fc[_0x4a33('0x36')]);_0xbb18d9[_0x4a33('0x34')]=_[_0x4a33('0x35')](_0xbb18d9[_0x4a33('0x32')],_0xbb18d9[_0x4a33('0x36')]);_0x507030[_0x4a33('0x37')]=_[_0x4a33('0x35')](_0xbb18d9[_0x4a33('0x32')],qs[_0x4a33('0x38')](_0xd343fc[_0x4a33('0x36')]['fields']));_0x507030[_0x4a33('0x37')]=_0x507030[_0x4a33('0x37')]['length']?_0x507030['attributes']:_0xbb18d9[_0x4a33('0x32')];_0x507030[_0x4a33('0x3a')]=qs[_0x4a33('0x3b')](_0xd343fc[_0x4a33('0x36')][_0x4a33('0x3b')]);_0x507030[_0x4a33('0x3c')]=qs[_0x4a33('0x34')](_[_0x4a33('0x3d')](_0xd343fc[_0x4a33('0x36')],_0xbb18d9[_0x4a33('0x34')]));if(_0xd343fc['query'][_0x4a33('0x3e')]){_0x507030[_0x4a33('0x3c')]=_[_0x4a33('0x3f')](_0x507030[_0x4a33('0x3c')],{'$or':_['map'](_0x507030[_0x4a33('0x37')],function(_0x4f7c90){var _0x63647e={};_0x63647e[_0x4f7c90]={'$like':'%'+_0xd343fc[_0x4a33('0x36')][_0x4a33('0x3e')]+'%'};return _0x63647e;})});}_0x507030=_[_0x4a33('0x3f')]({},_0x507030,_0xd343fc['options']);return _0x341774[_0x4a33('0x4b')](_0x507030);}})[_0x4a33('0x28')](function(_0x20ba82){if(_0x20ba82){_0x2c3af6=_0x20ba82[_0x4a33('0x39')];if(!_0xd343fc[_0x4a33('0x36')]['hasOwnProperty'](_0x4a33('0x4e'))){_0x507030[_0x4a33('0x23')]=qs[_0x4a33('0x23')](_0xd343fc['query'][_0x4a33('0x23')]);_0x507030[_0x4a33('0x20')]=qs[_0x4a33('0x20')](_0xd343fc['query']['offset']);}return _0x341774[_0x4a33('0x4b')](_0x507030);}})['then'](function(_0x129743){if(_0x129743){return _0x129743?{'count':_0x2c3af6,'rows':_0x129743}:null;}})[_0x4a33('0x28')](respondWithResult(_0x2bdc51,null))[_0x4a33('0x45')](handleError(_0x2bdc51,null));};exports[_0x4a33('0x4f')]=function(_0x1e77b4,_0x145aa9,_0x5148ac){var _0x5c5f20={};var _0x5efd2={};var _0x212af1;var _0x4eee28;return db[_0x4a33('0x2e')][_0x4a33('0x4c')]({'where':{'id':_0x1e77b4['params']['id']}})['then'](handleEntityNotFound(_0x145aa9,null))[_0x4a33('0x28')](function(_0x283cb8){if(_0x283cb8){_0x212af1=_0x283cb8;_0x5efd2[_0x4a33('0x32')]=_['keys'](db[_0x4a33('0x4d')][_0x4a33('0x2f')]);_0x5efd2[_0x4a33('0x36')]=_['keys'](_0x1e77b4['query']);_0x5efd2[_0x4a33('0x34')]=_[_0x4a33('0x35')](_0x5efd2[_0x4a33('0x32')],_0x5efd2['query']);_0x5c5f20[_0x4a33('0x37')]=_[_0x4a33('0x35')](_0x5efd2[_0x4a33('0x32')],qs[_0x4a33('0x38')](_0x1e77b4[_0x4a33('0x36')]['fields']));_0x5c5f20[_0x4a33('0x37')]=_0x5c5f20['attributes'][_0x4a33('0x39')]?_0x5c5f20[_0x4a33('0x37')]:_0x5efd2[_0x4a33('0x32')];_0x5c5f20[_0x4a33('0x3a')]=qs['sort'](_0x1e77b4[_0x4a33('0x36')][_0x4a33('0x3b')]);_0x5c5f20[_0x4a33('0x3c')]=qs[_0x4a33('0x34')](_['pick'](_0x1e77b4[_0x4a33('0x36')],_0x5efd2[_0x4a33('0x34')]));if(_0x1e77b4['query'][_0x4a33('0x3e')]){_0x5c5f20['where']=_[_0x4a33('0x3f')](_0x5c5f20[_0x4a33('0x3c')],{'$or':_[_0x4a33('0x2d')](_0x5c5f20[_0x4a33('0x37')],function(_0xfc10d7){var _0x2e5744={};_0x2e5744[_0xfc10d7]={'$like':'%'+_0x1e77b4[_0x4a33('0x36')][_0x4a33('0x3e')]+'%'};return _0x2e5744;})});}_0x5c5f20=_[_0x4a33('0x3f')]({},_0x5c5f20,_0x1e77b4[_0x4a33('0x40')]);return _0x212af1['getSubjects'](_0x5c5f20);}})['then'](function(_0x5adf8a){if(_0x5adf8a){_0x4eee28=_0x5adf8a[_0x4a33('0x39')];if(!_0x1e77b4[_0x4a33('0x36')]['hasOwnProperty'](_0x4a33('0x4e'))){_0x5c5f20[_0x4a33('0x23')]=qs[_0x4a33('0x23')](_0x1e77b4['query']['limit']);_0x5c5f20[_0x4a33('0x20')]=qs[_0x4a33('0x20')](_0x1e77b4[_0x4a33('0x36')][_0x4a33('0x20')]);}return _0x212af1[_0x4a33('0x4f')](_0x5c5f20);}})[_0x4a33('0x28')](function(_0x301f74){if(_0x301f74){return _0x301f74?{'count':_0x4eee28,'rows':_0x301f74}:null;}})[_0x4a33('0x28')](respondWithResult(_0x145aa9,null))['catch'](handleError(_0x145aa9,null));};exports[_0x4a33('0x50')]=function(_0x149473,_0x542154,_0x12bf17){var _0x3694df={};var _0x4184a2={};var _0x4c53cb;var _0x5ed071;return db[_0x4a33('0x2e')][_0x4a33('0x4c')]({'where':{'id':_0x149473[_0x4a33('0x47')]['id']}})['then'](handleEntityNotFound(_0x542154,null))[_0x4a33('0x28')](function(_0x4aaa99){if(_0x4aaa99){_0x4c53cb=_0x4aaa99;_0x4184a2[_0x4a33('0x32')]=_[_0x4a33('0x33')](db[_0x4a33('0x4d')]['rawAttributes']);_0x4184a2['query']=_[_0x4a33('0x33')](_0x149473[_0x4a33('0x36')]);_0x4184a2['filters']=_[_0x4a33('0x35')](_0x4184a2[_0x4a33('0x32')],_0x4184a2[_0x4a33('0x36')]);_0x3694df[_0x4a33('0x37')]=_[_0x4a33('0x35')](_0x4184a2[_0x4a33('0x32')],qs['fields'](_0x149473[_0x4a33('0x36')][_0x4a33('0x38')]));_0x3694df['attributes']=_0x3694df[_0x4a33('0x37')][_0x4a33('0x39')]?_0x3694df[_0x4a33('0x37')]:_0x4184a2[_0x4a33('0x32')];_0x3694df[_0x4a33('0x3a')]=qs['sort'](_0x149473[_0x4a33('0x36')][_0x4a33('0x3b')]);_0x3694df[_0x4a33('0x3c')]=qs['filters'](_['pick'](_0x149473[_0x4a33('0x36')],_0x4184a2[_0x4a33('0x34')]));if(_0x149473[_0x4a33('0x36')][_0x4a33('0x3e')]){_0x3694df['where']=_[_0x4a33('0x3f')](_0x3694df[_0x4a33('0x3c')],{'$or':_[_0x4a33('0x2d')](_0x3694df[_0x4a33('0x37')],function(_0x577fc1){var _0x1c484b={};_0x1c484b[_0x577fc1]={'$like':'%'+_0x149473[_0x4a33('0x36')][_0x4a33('0x3e')]+'%'};return _0x1c484b;})});}_0x3694df=_[_0x4a33('0x3f')]({},_0x3694df,_0x149473[_0x4a33('0x40')]);return _0x4c53cb['getDescriptions'](_0x3694df);}})[_0x4a33('0x28')](function(_0x57956b){if(_0x57956b){_0x5ed071=_0x57956b['length'];if(!_0x149473[_0x4a33('0x36')][_0x4a33('0x51')](_0x4a33('0x4e'))){_0x3694df[_0x4a33('0x23')]=qs[_0x4a33('0x23')](_0x149473[_0x4a33('0x36')][_0x4a33('0x23')]);_0x3694df[_0x4a33('0x20')]=qs[_0x4a33('0x20')](_0x149473[_0x4a33('0x36')][_0x4a33('0x20')]);}return _0x4c53cb[_0x4a33('0x50')](_0x3694df);}})[_0x4a33('0x28')](function(_0x510014){if(_0x510014){return _0x510014?{'count':_0x5ed071,'rows':_0x510014}:null;}})[_0x4a33('0x28')](respondWithResult(_0x542154,null))[_0x4a33('0x45')](handleError(_0x542154,null));};exports[_0x4a33('0x52')]=function(_0x248606,_0x323fbc,_0x1c0b41){var _0x1e6814={};var _0x1e7fbd={};var _0x541da7;var _0x32b01b;return db[_0x4a33('0x2e')][_0x4a33('0x4c')]({'where':{'id':_0x248606[_0x4a33('0x47')]['id']}})[_0x4a33('0x28')](handleEntityNotFound(_0x323fbc,null))['then'](function(_0x23c7d0){if(_0x23c7d0){_0x541da7=_0x23c7d0;_0x1e7fbd[_0x4a33('0x32')]=_[_0x4a33('0x33')](db[_0x4a33('0x53')][_0x4a33('0x2f')]);_0x1e7fbd['query']=_[_0x4a33('0x33')](_0x248606[_0x4a33('0x36')]);_0x1e7fbd[_0x4a33('0x34')]=_[_0x4a33('0x35')](_0x1e7fbd[_0x4a33('0x32')],_0x1e7fbd[_0x4a33('0x36')]);_0x1e6814[_0x4a33('0x37')]=_[_0x4a33('0x35')](_0x1e7fbd[_0x4a33('0x32')],qs['fields'](_0x248606['query'][_0x4a33('0x38')]));_0x1e6814[_0x4a33('0x37')]=_0x1e6814[_0x4a33('0x37')][_0x4a33('0x39')]?_0x1e6814[_0x4a33('0x37')]:_0x1e7fbd[_0x4a33('0x32')];_0x1e6814[_0x4a33('0x3a')]=qs[_0x4a33('0x3b')](_0x248606[_0x4a33('0x36')]['sort']);_0x1e6814[_0x4a33('0x3c')]=qs['filters'](_['pick'](_0x248606[_0x4a33('0x36')],_0x1e7fbd[_0x4a33('0x34')]));if(_0x248606[_0x4a33('0x36')][_0x4a33('0x3e')]){_0x1e6814[_0x4a33('0x3c')]=_[_0x4a33('0x3f')](_0x1e6814[_0x4a33('0x3c')],{'$or':_['map'](_0x1e6814[_0x4a33('0x37')],function(_0x1ceb30){var _0x1280d5={};_0x1280d5[_0x1ceb30]={'$like':'%'+_0x248606[_0x4a33('0x36')][_0x4a33('0x3e')]+'%'};return _0x1280d5;})});}_0x1e6814=_[_0x4a33('0x3f')]({},_0x1e6814,_0x248606[_0x4a33('0x40')]);return _0x541da7['getTags'](_0x1e6814);}})['then'](function(_0x5ddd3f){if(_0x5ddd3f){_0x32b01b=_0x5ddd3f[_0x4a33('0x39')];if(!_0x248606[_0x4a33('0x36')][_0x4a33('0x51')](_0x4a33('0x4e'))){_0x1e6814['limit']=qs[_0x4a33('0x23')](_0x248606[_0x4a33('0x36')][_0x4a33('0x23')]);_0x1e6814['offset']=qs[_0x4a33('0x20')](_0x248606[_0x4a33('0x36')][_0x4a33('0x20')]);}return _0x541da7[_0x4a33('0x52')](_0x1e6814);}})[_0x4a33('0x28')](function(_0x4f047c){if(_0x4f047c){return _0x4f047c?{'count':_0x32b01b,'rows':_0x4f047c}:null;}})[_0x4a33('0x28')](respondWithResult(_0x323fbc,null))['catch'](handleError(_0x323fbc,null));};exports[_0x4a33('0x54')]=function(_0x1cd6ce,_0x225396,_0x73692d){if(_0x1cd6ce[_0x4a33('0x4a')]['id']){delete _0x1cd6ce[_0x4a33('0x4a')]['id'];}return db[_0x4a33('0x2e')][_0x4a33('0x4c')]({'where':{'id':_0x1cd6ce[_0x4a33('0x47')]['id']}})[_0x4a33('0x28')](handleEntityNotFound(_0x225396,null))[_0x4a33('0x28')](function(_0x3d4bd2){if(_0x3d4bd2){return _0x3d4bd2['setTags'](_0x1cd6ce['body'][_0x4a33('0x55')]||[]);}return null;})[_0x4a33('0x28')](respondWithResult(_0x225396,null))['catch'](handleError(_0x225396,null));}; \ No newline at end of file +var _0x33f1=['name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','findAll','catch','show','params','include','body','update','find','destroy','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','Tag','getTags','setTags','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','squel','crypto','jsforce','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','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','stack'];(function(_0x492221,_0x9e2521){var _0x398bf9=function(_0x303c5b){while(--_0x303c5b){_0x492221['push'](_0x492221['shift']());}};_0x398bf9(++_0x9e2521);}(_0x33f1,0xce));var _0x133f=function(_0x4605dc,_0x3f7ae5){_0x4605dc=_0x4605dc-0x0;var _0x5d3e81=_0x33f1[_0x4605dc];return _0x5d3e81;};'use strict';var emlformat=require(_0x133f('0x0'));var rimraf=require(_0x133f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x133f('0x2'));var rp=require(_0x133f('0x3'));var moment=require(_0x133f('0x4'));var BPromise=require(_0x133f('0x5'));var Mustache=require(_0x133f('0x6'));var util=require(_0x133f('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x133f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x133f('0x9'));var _=require('lodash');var squel=require(_0x133f('0xa'));var crypto=require(_0x133f('0xb'));var jsforce=require(_0x133f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x133f('0x8'));var querystring=require(_0x133f('0xd'));var Papa=require(_0x133f('0xe'));var Redis=require(_0x133f('0xf'));var authService=require(_0x133f('0x10'));var qs=require(_0x133f('0x11'));var as=require(_0x133f('0x12'));var hardwareService=require(_0x133f('0x13'));var logger=require('../../config/logger')(_0x133f('0x14'));var utils=require(_0x133f('0x15'));var config=require(_0x133f('0x16'));var licenseUtil=require(_0x133f('0x17'));var db=require(_0x133f('0x18'))['db'];function respondWithStatusCode(_0x3e26f4,_0x1cfdb4){_0x1cfdb4=_0x1cfdb4||0xcc;return function(_0x2e0306){if(_0x2e0306){return _0x3e26f4['sendStatus'](_0x1cfdb4);}return _0x3e26f4[_0x133f('0x19')](_0x1cfdb4)[_0x133f('0x1a')]();};}function respondWithResult(_0x13f735,_0x3a280b){_0x3a280b=_0x3a280b||0xc8;return function(_0x367136){if(_0x367136){return _0x13f735[_0x133f('0x19')](_0x3a280b)[_0x133f('0x1b')](_0x367136);}};}function respondWithFilteredResult(_0x3b8e75,_0x1f9885){return function(_0x2a765d){if(_0x2a765d){var _0x5387b5=typeof _0x1f9885[_0x133f('0x1c')]===_0x133f('0x1d')&&typeof _0x1f9885[_0x133f('0x1e')]==='undefined';var _0x175265=_0x2a765d[_0x133f('0x1f')];var _0x3b26a5=_0x5387b5?0x0:_0x1f9885[_0x133f('0x1c')];var _0x454b9a=_0x5387b5?_0x2a765d[_0x133f('0x1f')]:_0x1f9885[_0x133f('0x1c')]+_0x1f9885[_0x133f('0x1e')];var _0x6dd94f;if(_0x454b9a>=_0x175265){_0x454b9a=_0x175265;_0x6dd94f=0xc8;}else{_0x6dd94f=0xce;}_0x3b8e75[_0x133f('0x19')](_0x6dd94f);return _0x3b8e75[_0x133f('0x20')](_0x133f('0x21'),_0x3b26a5+'-'+_0x454b9a+'/'+_0x175265)[_0x133f('0x1b')](_0x2a765d);}return null;};}function patchUpdates(_0x40cb71){return function(_0x537c51){try{jsonpatch[_0x133f('0x22')](_0x537c51,_0x40cb71,!![]);}catch(_0x17ff23){return BPromise[_0x133f('0x23')](_0x17ff23);}return _0x537c51[_0x133f('0x24')]();};}function saveUpdates(_0x28076d,_0xf42ac1){return function(_0x34ff1a){if(_0x34ff1a){return _0x34ff1a['update'](_0x28076d)[_0x133f('0x25')](function(_0x30727c){return _0x30727c;});}return null;};}function removeEntity(_0x1c82ff,_0x330a4c){return function(_0x55eb55){if(_0x55eb55){return _0x55eb55['destroy']()[_0x133f('0x25')](function(){_0x1c82ff[_0x133f('0x19')](0xcc)[_0x133f('0x1a')]();});}};}function handleEntityNotFound(_0x128f4d,_0x27aaa9){return function(_0x42915b){if(!_0x42915b){_0x128f4d['sendStatus'](0x194);}return _0x42915b;};}function handleError(_0x27e35f,_0x4e270d){_0x4e270d=_0x4e270d||0x1f4;return function(_0x4b2551){logger[_0x133f('0x26')](_0x4b2551[_0x133f('0x27')]);if(_0x4b2551['name']){delete _0x4b2551[_0x133f('0x28')];}_0x27e35f[_0x133f('0x19')](_0x4e270d)[_0x133f('0x29')](_0x4b2551);};}exports[_0x133f('0x2a')]=function(_0x4c9e14,_0x30592f){var _0x33a69b={},_0x841fa9={},_0x5d3cfb={'count':0x0,'rows':[]};var _0x39c66a=_[_0x133f('0x2b')](db[_0x133f('0x2c')][_0x133f('0x2d')],function(_0x300aeb){return{'name':_0x300aeb[_0x133f('0x2e')],'type':_0x300aeb[_0x133f('0x2f')]['key']};});_0x841fa9[_0x133f('0x30')]=_[_0x133f('0x2b')](_0x39c66a,'name');_0x841fa9[_0x133f('0x31')]=_[_0x133f('0x32')](_0x4c9e14[_0x133f('0x31')]);_0x841fa9[_0x133f('0x33')]=_[_0x133f('0x34')](_0x841fa9['model'],_0x841fa9[_0x133f('0x31')]);_0x33a69b['attributes']=_['intersection'](_0x841fa9[_0x133f('0x30')],qs[_0x133f('0x35')](_0x4c9e14[_0x133f('0x31')]['fields']));_0x33a69b[_0x133f('0x36')]=_0x33a69b[_0x133f('0x36')][_0x133f('0x37')]?_0x33a69b['attributes']:_0x841fa9['model'];if(!_0x4c9e14['query'][_0x133f('0x38')](_0x133f('0x39'))){_0x33a69b[_0x133f('0x1e')]=qs[_0x133f('0x1e')](_0x4c9e14[_0x133f('0x31')][_0x133f('0x1e')]);_0x33a69b[_0x133f('0x1c')]=qs[_0x133f('0x1c')](_0x4c9e14[_0x133f('0x31')]['offset']);}_0x33a69b[_0x133f('0x3a')]=qs[_0x133f('0x3b')](_0x4c9e14['query'][_0x133f('0x3b')]);_0x33a69b[_0x133f('0x3c')]=qs[_0x133f('0x33')](_[_0x133f('0x3d')](_0x4c9e14['query'],_0x841fa9[_0x133f('0x33')]),_0x39c66a);if(_0x4c9e14['query'][_0x133f('0x3e')]){_0x33a69b[_0x133f('0x3c')]=_[_0x133f('0x3f')](_0x33a69b[_0x133f('0x3c')],{'$or':_[_0x133f('0x2b')](_0x39c66a,function(_0x1cd4a9){if(_0x1cd4a9[_0x133f('0x2f')]!=='VIRTUAL'){var _0x29af33={};_0x29af33[_0x1cd4a9[_0x133f('0x28')]]={'$like':'%'+_0x4c9e14[_0x133f('0x31')]['filter']+'%'};return _0x29af33;}})});}_0x33a69b=_[_0x133f('0x3f')]({},_0x33a69b,_0x4c9e14[_0x133f('0x40')]);var _0x3feae9={'where':_0x33a69b[_0x133f('0x3c')]};return db['FreshdeskConfiguration'][_0x133f('0x1f')](_0x3feae9)[_0x133f('0x25')](function(_0x5bb24d){_0x5d3cfb['count']=_0x5bb24d;if(_0x4c9e14[_0x133f('0x31')]['includeAll']){_0x33a69b['include']=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x133f('0x41')](_0x33a69b);})[_0x133f('0x25')](function(_0x58feff){_0x5d3cfb['rows']=_0x58feff;return _0x5d3cfb;})[_0x133f('0x25')](respondWithFilteredResult(_0x30592f,_0x33a69b))[_0x133f('0x42')](handleError(_0x30592f,null));};exports[_0x133f('0x43')]=function(_0x3f996f,_0x130f29){var _0x47ed39={'raw':![],'where':{'id':_0x3f996f[_0x133f('0x44')]['id']}},_0x157f78={};_0x157f78['model']=_[_0x133f('0x32')](db['FreshdeskConfiguration']['rawAttributes']);_0x157f78[_0x133f('0x31')]=_[_0x133f('0x32')](_0x3f996f['query']);_0x157f78['filters']=_['intersection'](_0x157f78['model'],_0x157f78[_0x133f('0x31')]);_0x47ed39['attributes']=_[_0x133f('0x34')](_0x157f78[_0x133f('0x30')],qs['fields'](_0x3f996f[_0x133f('0x31')][_0x133f('0x35')]));_0x47ed39[_0x133f('0x36')]=_0x47ed39[_0x133f('0x36')]['length']?_0x47ed39['attributes']:_0x157f78[_0x133f('0x30')];if(_0x3f996f['query']['includeAll']){_0x47ed39[_0x133f('0x45')]=[{'all':!![]}];}_0x47ed39=_[_0x133f('0x3f')]({},_0x47ed39,_0x3f996f[_0x133f('0x40')]);return db[_0x133f('0x2c')]['find'](_0x47ed39)[_0x133f('0x25')](handleEntityNotFound(_0x130f29,null))[_0x133f('0x25')](respondWithResult(_0x130f29,null))['catch'](handleError(_0x130f29,null));};exports['create']=function(_0xb23ed1,_0x3a60d3){return db[_0x133f('0x2c')]['create'](_0xb23ed1[_0x133f('0x46')],{})[_0x133f('0x25')](respondWithResult(_0x3a60d3,0xc9))['catch'](handleError(_0x3a60d3,null));};exports[_0x133f('0x47')]=function(_0x3af25d,_0x5c86f3){if(_0x3af25d[_0x133f('0x46')]['id']){delete _0x3af25d['body']['id'];}return db[_0x133f('0x2c')][_0x133f('0x48')]({'where':{'id':_0x3af25d['params']['id']}})[_0x133f('0x25')](handleEntityNotFound(_0x5c86f3,null))[_0x133f('0x25')](saveUpdates(_0x3af25d[_0x133f('0x46')],null))[_0x133f('0x25')](respondWithResult(_0x5c86f3,null))['catch'](handleError(_0x5c86f3,null));};exports[_0x133f('0x49')]=function(_0x31cbf0,_0x2165ac){return db['FreshdeskConfiguration'][_0x133f('0x48')]({'where':{'id':_0x31cbf0[_0x133f('0x44')]['id']}})['then'](handleEntityNotFound(_0x2165ac,null))[_0x133f('0x25')](removeEntity(_0x2165ac,null))['catch'](handleError(_0x2165ac,null));};exports[_0x133f('0x4a')]=function(_0x1239c6,_0x3d6c88,_0x490da0){var _0x4ed605={};var _0x6a689c={};var _0x88b60d;var _0x5d8a07;return db[_0x133f('0x2c')][_0x133f('0x4b')]({'where':{'id':_0x1239c6['params']['id']}})['then'](handleEntityNotFound(_0x3d6c88,null))[_0x133f('0x25')](function(_0x568a56){if(_0x568a56){_0x88b60d=_0x568a56;_0x6a689c['model']=_['keys'](db[_0x133f('0x4c')][_0x133f('0x2d')]);_0x6a689c[_0x133f('0x31')]=_[_0x133f('0x32')](_0x1239c6[_0x133f('0x31')]);_0x6a689c[_0x133f('0x33')]=_[_0x133f('0x34')](_0x6a689c[_0x133f('0x30')],_0x6a689c['query']);_0x4ed605[_0x133f('0x36')]=_[_0x133f('0x34')](_0x6a689c[_0x133f('0x30')],qs[_0x133f('0x35')](_0x1239c6[_0x133f('0x31')][_0x133f('0x35')]));_0x4ed605[_0x133f('0x36')]=_0x4ed605[_0x133f('0x36')]['length']?_0x4ed605['attributes']:_0x6a689c[_0x133f('0x30')];_0x4ed605[_0x133f('0x3a')]=qs[_0x133f('0x3b')](_0x1239c6[_0x133f('0x31')][_0x133f('0x3b')]);_0x4ed605['where']=qs['filters'](_[_0x133f('0x3d')](_0x1239c6['query'],_0x6a689c[_0x133f('0x33')]));if(_0x1239c6[_0x133f('0x31')][_0x133f('0x3e')]){_0x4ed605[_0x133f('0x3c')]=_[_0x133f('0x3f')](_0x4ed605[_0x133f('0x3c')],{'$or':_[_0x133f('0x2b')](_0x4ed605[_0x133f('0x36')],function(_0x5381dd){var _0x565255={};_0x565255[_0x5381dd]={'$like':'%'+_0x1239c6[_0x133f('0x31')][_0x133f('0x3e')]+'%'};return _0x565255;})});}_0x4ed605=_[_0x133f('0x3f')]({},_0x4ed605,_0x1239c6[_0x133f('0x40')]);return _0x88b60d['getFields'](_0x4ed605);}})['then'](function(_0x26af6e){if(_0x26af6e){_0x5d8a07=_0x26af6e[_0x133f('0x37')];if(!_0x1239c6[_0x133f('0x31')][_0x133f('0x38')](_0x133f('0x39'))){_0x4ed605[_0x133f('0x1e')]=qs[_0x133f('0x1e')](_0x1239c6[_0x133f('0x31')][_0x133f('0x1e')]);_0x4ed605[_0x133f('0x1c')]=qs[_0x133f('0x1c')](_0x1239c6[_0x133f('0x31')][_0x133f('0x1c')]);}return _0x88b60d[_0x133f('0x4a')](_0x4ed605);}})[_0x133f('0x25')](function(_0x209bce){if(_0x209bce){return _0x209bce?{'count':_0x5d8a07,'rows':_0x209bce}:null;}})[_0x133f('0x25')](respondWithResult(_0x3d6c88,null))[_0x133f('0x42')](handleError(_0x3d6c88,null));};exports[_0x133f('0x4d')]=function(_0x10ec94,_0x262b40,_0x4e31c3){var _0x284cda={};var _0x1da48b={};var _0x3db9d0;var _0x421849;return db[_0x133f('0x2c')][_0x133f('0x4b')]({'where':{'id':_0x10ec94['params']['id']}})['then'](handleEntityNotFound(_0x262b40,null))[_0x133f('0x25')](function(_0x78cf0e){if(_0x78cf0e){_0x3db9d0=_0x78cf0e;_0x1da48b['model']=_[_0x133f('0x32')](db['FreshdeskField'][_0x133f('0x2d')]);_0x1da48b[_0x133f('0x31')]=_[_0x133f('0x32')](_0x10ec94['query']);_0x1da48b[_0x133f('0x33')]=_[_0x133f('0x34')](_0x1da48b[_0x133f('0x30')],_0x1da48b['query']);_0x284cda['attributes']=_[_0x133f('0x34')](_0x1da48b[_0x133f('0x30')],qs[_0x133f('0x35')](_0x10ec94[_0x133f('0x31')][_0x133f('0x35')]));_0x284cda['attributes']=_0x284cda[_0x133f('0x36')][_0x133f('0x37')]?_0x284cda[_0x133f('0x36')]:_0x1da48b[_0x133f('0x30')];_0x284cda[_0x133f('0x3a')]=qs['sort'](_0x10ec94[_0x133f('0x31')]['sort']);_0x284cda['where']=qs['filters'](_[_0x133f('0x3d')](_0x10ec94[_0x133f('0x31')],_0x1da48b[_0x133f('0x33')]));if(_0x10ec94[_0x133f('0x31')]['filter']){_0x284cda['where']=_[_0x133f('0x3f')](_0x284cda[_0x133f('0x3c')],{'$or':_[_0x133f('0x2b')](_0x284cda[_0x133f('0x36')],function(_0x2cfd62){var _0x3605d7={};_0x3605d7[_0x2cfd62]={'$like':'%'+_0x10ec94['query']['filter']+'%'};return _0x3605d7;})});}_0x284cda=_[_0x133f('0x3f')]({},_0x284cda,_0x10ec94[_0x133f('0x40')]);return _0x3db9d0['getSubjects'](_0x284cda);}})[_0x133f('0x25')](function(_0x205f77){if(_0x205f77){_0x421849=_0x205f77[_0x133f('0x37')];if(!_0x10ec94['query']['hasOwnProperty'](_0x133f('0x39'))){_0x284cda[_0x133f('0x1e')]=qs[_0x133f('0x1e')](_0x10ec94['query']['limit']);_0x284cda[_0x133f('0x1c')]=qs[_0x133f('0x1c')](_0x10ec94[_0x133f('0x31')][_0x133f('0x1c')]);}return _0x3db9d0[_0x133f('0x4d')](_0x284cda);}})[_0x133f('0x25')](function(_0x2a196b){if(_0x2a196b){return _0x2a196b?{'count':_0x421849,'rows':_0x2a196b}:null;}})[_0x133f('0x25')](respondWithResult(_0x262b40,null))['catch'](handleError(_0x262b40,null));};exports[_0x133f('0x4e')]=function(_0x56b899,_0x59d210,_0x16eac2){var _0x1e7343={};var _0x3e2b49={};var _0xf9d64;var _0x2aeabf;return db[_0x133f('0x2c')][_0x133f('0x4b')]({'where':{'id':_0x56b899[_0x133f('0x44')]['id']}})[_0x133f('0x25')](handleEntityNotFound(_0x59d210,null))[_0x133f('0x25')](function(_0x5bbdad){if(_0x5bbdad){_0xf9d64=_0x5bbdad;_0x3e2b49[_0x133f('0x30')]=_[_0x133f('0x32')](db[_0x133f('0x4c')][_0x133f('0x2d')]);_0x3e2b49[_0x133f('0x31')]=_['keys'](_0x56b899[_0x133f('0x31')]);_0x3e2b49['filters']=_[_0x133f('0x34')](_0x3e2b49[_0x133f('0x30')],_0x3e2b49[_0x133f('0x31')]);_0x1e7343[_0x133f('0x36')]=_[_0x133f('0x34')](_0x3e2b49['model'],qs['fields'](_0x56b899['query']['fields']));_0x1e7343[_0x133f('0x36')]=_0x1e7343[_0x133f('0x36')][_0x133f('0x37')]?_0x1e7343[_0x133f('0x36')]:_0x3e2b49[_0x133f('0x30')];_0x1e7343[_0x133f('0x3a')]=qs['sort'](_0x56b899[_0x133f('0x31')][_0x133f('0x3b')]);_0x1e7343[_0x133f('0x3c')]=qs[_0x133f('0x33')](_[_0x133f('0x3d')](_0x56b899[_0x133f('0x31')],_0x3e2b49[_0x133f('0x33')]));if(_0x56b899[_0x133f('0x31')]['filter']){_0x1e7343[_0x133f('0x3c')]=_[_0x133f('0x3f')](_0x1e7343[_0x133f('0x3c')],{'$or':_[_0x133f('0x2b')](_0x1e7343['attributes'],function(_0x1463c0){var _0x11039c={};_0x11039c[_0x1463c0]={'$like':'%'+_0x56b899[_0x133f('0x31')]['filter']+'%'};return _0x11039c;})});}_0x1e7343=_[_0x133f('0x3f')]({},_0x1e7343,_0x56b899['options']);return _0xf9d64[_0x133f('0x4e')](_0x1e7343);}})['then'](function(_0x58c12c){if(_0x58c12c){_0x2aeabf=_0x58c12c[_0x133f('0x37')];if(!_0x56b899[_0x133f('0x31')][_0x133f('0x38')](_0x133f('0x39'))){_0x1e7343[_0x133f('0x1e')]=qs[_0x133f('0x1e')](_0x56b899['query'][_0x133f('0x1e')]);_0x1e7343[_0x133f('0x1c')]=qs['offset'](_0x56b899['query'][_0x133f('0x1c')]);}return _0xf9d64['getDescriptions'](_0x1e7343);}})[_0x133f('0x25')](function(_0x104168){if(_0x104168){return _0x104168?{'count':_0x2aeabf,'rows':_0x104168}:null;}})[_0x133f('0x25')](respondWithResult(_0x59d210,null))[_0x133f('0x42')](handleError(_0x59d210,null));};exports['getTags']=function(_0x28d398,_0x32aeed,_0x57d80d){var _0x3012f8={};var _0x10ce6d={};var _0x1c7a2a;var _0x2f2d64;return db[_0x133f('0x2c')][_0x133f('0x4b')]({'where':{'id':_0x28d398[_0x133f('0x44')]['id']}})[_0x133f('0x25')](handleEntityNotFound(_0x32aeed,null))[_0x133f('0x25')](function(_0x5af047){if(_0x5af047){_0x1c7a2a=_0x5af047;_0x10ce6d['model']=_['keys'](db[_0x133f('0x4f')]['rawAttributes']);_0x10ce6d[_0x133f('0x31')]=_[_0x133f('0x32')](_0x28d398[_0x133f('0x31')]);_0x10ce6d[_0x133f('0x33')]=_[_0x133f('0x34')](_0x10ce6d['model'],_0x10ce6d['query']);_0x3012f8['attributes']=_[_0x133f('0x34')](_0x10ce6d['model'],qs[_0x133f('0x35')](_0x28d398[_0x133f('0x31')]['fields']));_0x3012f8[_0x133f('0x36')]=_0x3012f8[_0x133f('0x36')][_0x133f('0x37')]?_0x3012f8[_0x133f('0x36')]:_0x10ce6d['model'];_0x3012f8['order']=qs[_0x133f('0x3b')](_0x28d398['query'][_0x133f('0x3b')]);_0x3012f8[_0x133f('0x3c')]=qs[_0x133f('0x33')](_[_0x133f('0x3d')](_0x28d398[_0x133f('0x31')],_0x10ce6d[_0x133f('0x33')]));if(_0x28d398[_0x133f('0x31')][_0x133f('0x3e')]){_0x3012f8[_0x133f('0x3c')]=_['merge'](_0x3012f8[_0x133f('0x3c')],{'$or':_['map'](_0x3012f8['attributes'],function(_0x24a228){var _0x4151c7={};_0x4151c7[_0x24a228]={'$like':'%'+_0x28d398['query'][_0x133f('0x3e')]+'%'};return _0x4151c7;})});}_0x3012f8=_[_0x133f('0x3f')]({},_0x3012f8,_0x28d398[_0x133f('0x40')]);return _0x1c7a2a[_0x133f('0x50')](_0x3012f8);}})[_0x133f('0x25')](function(_0x36903a){if(_0x36903a){_0x2f2d64=_0x36903a[_0x133f('0x37')];if(!_0x28d398[_0x133f('0x31')][_0x133f('0x38')](_0x133f('0x39'))){_0x3012f8['limit']=qs[_0x133f('0x1e')](_0x28d398[_0x133f('0x31')][_0x133f('0x1e')]);_0x3012f8['offset']=qs['offset'](_0x28d398[_0x133f('0x31')][_0x133f('0x1c')]);}return _0x1c7a2a[_0x133f('0x50')](_0x3012f8);}})[_0x133f('0x25')](function(_0x38dcf8){if(_0x38dcf8){return _0x38dcf8?{'count':_0x2f2d64,'rows':_0x38dcf8}:null;}})[_0x133f('0x25')](respondWithResult(_0x32aeed,null))[_0x133f('0x42')](handleError(_0x32aeed,null));};exports[_0x133f('0x51')]=function(_0x92eabc,_0x9a8d91,_0x3c7099){if(_0x92eabc['body']['id']){delete _0x92eabc[_0x133f('0x46')]['id'];}return db[_0x133f('0x2c')][_0x133f('0x4b')]({'where':{'id':_0x92eabc[_0x133f('0x44')]['id']}})['then'](handleEntityNotFound(_0x9a8d91,null))[_0x133f('0x25')](function(_0x16e17f){if(_0x16e17f){return _0x16e17f['setTags'](_0x92eabc['body']['ids']||[]);}return null;})[_0x133f('0x25')](respondWithResult(_0x9a8d91,null))[_0x133f('0x42')](handleError(_0x9a8d91,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 0a76264..6377960 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 _0x7d88=['rimraf','./intFreshdeskConfiguration.attributes','exports','FreshdeskConfiguration','lodash','../../config/logger','moment','request-promise','path'];(function(_0x3ecef8,_0x39063e){var _0x1adf92=function(_0x8b574a){while(--_0x8b574a){_0x3ecef8['push'](_0x3ecef8['shift']());}};_0x1adf92(++_0x39063e);}(_0x7d88,0xe5));var _0x87d8=function(_0x57b65e,_0x1b300f){_0x57b65e=_0x57b65e-0x0;var _0x1163b8=_0x7d88[_0x57b65e];return _0x1163b8;};'use strict';var _=require(_0x87d8('0x0'));var util=require('util');var logger=require(_0x87d8('0x1'))('api');var moment=require(_0x87d8('0x2'));var BPromise=require('bluebird');var rp=require(_0x87d8('0x3'));var fs=require('fs');var path=require(_0x87d8('0x4'));var rimraf=require(_0x87d8('0x5'));var config=require('../../config/environment');var attributes=require(_0x87d8('0x6'));module[_0x87d8('0x7')]=function(_0xd12664,_0x3d31e2){return _0xd12664['define'](_0x87d8('0x8'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d19=['moment','bluebird','path','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','../../config/logger','api'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x2d19,0xed));var _0x92d1=function(_0x4bc65f,_0x39ec43){_0x4bc65f=_0x4bc65f-0x0;var _0x44f85f=_0x2d19[_0x4bc65f];return _0x44f85f;};'use strict';var _=require(_0x92d1('0x0'));var util=require('util');var logger=require(_0x92d1('0x1'))(_0x92d1('0x2'));var moment=require(_0x92d1('0x3'));var BPromise=require(_0x92d1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x92d1('0x5'));var rimraf=require('rimraf');var config=require(_0x92d1('0x6'));var attributes=require(_0x92d1('0x7'));module[_0x92d1('0x8')]=function(_0x1176c3,_0xc889bb){return _0x1176c3[_0x92d1('0x9')](_0x92d1('0xa'),attributes,{'tableName':_0x92d1('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 e1f9686..b4b4b0f 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 _0x2386=['../../config/logger','rpc','jayson/promise','http','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x10791d,_0x2562b6){var _0x1b4f9c=function(_0x3b2815){while(--_0x3b2815){_0x10791d['push'](_0x10791d['shift']());}};_0x1b4f9c(++_0x2562b6);}(_0x2386,0xb6));var _0x6238=function(_0x21f013,_0x3a2050){_0x21f013=_0x21f013-0x0;var _0x1addf8=_0x2386[_0x21f013];return _0x1addf8;};'use strict';var _=require('lodash');var util=require(_0x6238('0x0'));var moment=require(_0x6238('0x1'));var BPromise=require(_0x6238('0x2'));var rs=require(_0x6238('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6238('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6238('0x5'))(_0x6238('0x6'));var config=require('../../config/environment');var jayson=require(_0x6238('0x7'));var client=jayson['client'][_0x6238('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x8af44a,_0x21f673,_0x567713){return new BPromise(function(_0x3a2af4,_0x4aec77){return client['request'](_0x8af44a,_0x567713)['then'](function(_0x421580){logger[_0x6238('0x9')](_0x6238('0xa'),_0x21f673,_0x6238('0xb'));logger['debug']('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x21f673,'request\x20sent',JSON[_0x6238('0xc')](_0x421580));if(_0x421580[_0x6238('0xd')]){if(_0x421580[_0x6238('0xd')][_0x6238('0xe')]===0x1f4){logger[_0x6238('0xd')](_0x6238('0xa'),_0x21f673,_0x421580[_0x6238('0xd')]['message']);return _0x4aec77(_0x421580[_0x6238('0xd')]['message']);}logger[_0x6238('0xd')](_0x6238('0xa'),_0x21f673,_0x421580['error']['message']);return _0x3a2af4(_0x421580[_0x6238('0xd')][_0x6238('0xf')]);}else{logger[_0x6238('0x9')](_0x6238('0xa'),_0x21f673,_0x6238('0xb'));_0x3a2af4(_0x421580[_0x6238('0x10')]['message']);}})['catch'](function(_0x5461e2){logger[_0x6238('0xd')](_0x6238('0xa'),_0x21f673,_0x5461e2);_0x4aec77(_0x5461e2);});});} \ No newline at end of file +var _0xf253=['message','info','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x493414,_0x44b9fd){var _0x1ec60a=function(_0x58215b){while(--_0x58215b){_0x493414['push'](_0x493414['shift']());}};_0x1ec60a(++_0x44b9fd);}(_0xf253,0xca));var _0x3f25=function(_0x4c0d77,_0xa04a6a){_0x4c0d77=_0x4c0d77-0x0;var _0xb37e0c=_0xf253[_0x4c0d77];return _0xb37e0c;};'use strict';var _=require('lodash');var util=require(_0x3f25('0x0'));var moment=require(_0x3f25('0x1'));var BPromise=require(_0x3f25('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3f25('0x3'));var db=require(_0x3f25('0x4'))['db'];var utils=require(_0x3f25('0x5'));var logger=require(_0x3f25('0x6'))(_0x3f25('0x7'));var config=require(_0x3f25('0x8'));var jayson=require(_0x3f25('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xd17774,_0x11e976,_0x3e8e14){return new BPromise(function(_0x373373,_0x52d0aa){return client[_0x3f25('0xa')](_0xd17774,_0x3e8e14)['then'](function(_0x418457){logger['info'](_0x3f25('0xb'),_0x11e976,_0x3f25('0xc'));logger[_0x3f25('0xd')](_0x3f25('0xe'),_0x11e976,_0x3f25('0xc'),JSON[_0x3f25('0xf')](_0x418457));if(_0x418457[_0x3f25('0x10')]){if(_0x418457['error'][_0x3f25('0x11')]===0x1f4){logger[_0x3f25('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x11e976,_0x418457['error'][_0x3f25('0x12')]);return _0x52d0aa(_0x418457[_0x3f25('0x10')][_0x3f25('0x12')]);}logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x11e976,_0x418457[_0x3f25('0x10')]['message']);return _0x373373(_0x418457['error'][_0x3f25('0x12')]);}else{logger[_0x3f25('0x13')](_0x3f25('0xb'),_0x11e976,'request\x20sent');_0x373373(_0x418457[_0x3f25('0x14')]['message']);}})[_0x3f25('0x15')](function(_0x3c8997){logger[_0x3f25('0x10')](_0x3f25('0xb'),_0x11e976,_0x3c8997);_0x52d0aa(_0x3c8997);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index b99be50..57cbb05 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 _0x6c94=['/:id','show','post','update','delete','destroy','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intFreshdeskField.controller','isAuthenticated','get'];(function(_0x4e2861,_0x199be0){var _0x2265e3=function(_0x469693){while(--_0x469693){_0x4e2861['push'](_0x4e2861['shift']());}};_0x2265e3(++_0x199be0);}(_0x6c94,0x150));var _0x46c9=function(_0x1c8c53,_0x96c0a1){_0x1c8c53=_0x1c8c53-0x0;var _0x215cfe=_0x6c94[_0x1c8c53];return _0x215cfe;};'use strict';var multer=require('multer');var util=require(_0x46c9('0x0'));var path=require('path');var timeout=require(_0x46c9('0x1'));var express=require(_0x46c9('0x2'));var router=express[_0x46c9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x46c9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x46c9('0x5'));var controller=require(_0x46c9('0x6'));router['get']('/',auth[_0x46c9('0x7')](),controller['index']);router[_0x46c9('0x8')](_0x46c9('0x9'),auth['isAuthenticated'](),controller[_0x46c9('0xa')]);router[_0x46c9('0xb')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x46c9('0x7')](),controller[_0x46c9('0xc')]);router[_0x46c9('0xd')](_0x46c9('0x9'),auth[_0x46c9('0x7')](),controller[_0x46c9('0xe')]);module['exports']=router; \ No newline at end of file +var _0xbb34=['path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','show','post','update','delete','destroy','exports','multer','util'];(function(_0x1e280d,_0x21a932){var _0x3abb95=function(_0x11b104){while(--_0x11b104){_0x1e280d['push'](_0x1e280d['shift']());}};_0x3abb95(++_0x21a932);}(_0xbb34,0x11b));var _0x4bb3=function(_0x1e55d9,_0x5ce14a){_0x1e55d9=_0x1e55d9-0x0;var _0x6dc799=_0xbb34[_0x1e55d9];return _0x6dc799;};'use strict';var multer=require(_0x4bb3('0x0'));var util=require(_0x4bb3('0x1'));var path=require(_0x4bb3('0x2'));var timeout=require(_0x4bb3('0x3'));var express=require(_0x4bb3('0x4'));var router=express['Router']();var fs_extra=require(_0x4bb3('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4bb3('0x6'));var config=require(_0x4bb3('0x7'));var controller=require(_0x4bb3('0x8'));router[_0x4bb3('0x9')]('/',auth[_0x4bb3('0xa')](),controller[_0x4bb3('0xb')]);router['get'](_0x4bb3('0xc'),auth[_0x4bb3('0xa')](),controller[_0x4bb3('0xd')]);router[_0x4bb3('0xe')]('/',auth[_0x4bb3('0xa')](),controller['create']);router['put'](_0x4bb3('0xc'),auth[_0x4bb3('0xa')](),controller[_0x4bb3('0xf')]);router[_0x4bb3('0x10')](_0x4bb3('0xc'),auth[_0x4bb3('0xa')](),controller[_0x4bb3('0x11')]);module[_0x4bb3('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 8efc861..b5181e3 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 _0x0e52=['customVariable','keyValue','picklist','string','STRING','BOOLEAN','sequelize','exports','ENUM','variable'];(function(_0xad91a9,_0x3c06d8){var _0x2330cf=function(_0x114a6f){while(--_0x114a6f){_0xad91a9['push'](_0xad91a9['shift']());}};_0x2330cf(++_0x3c06d8);}(_0x0e52,0x74));var _0x20e5=function(_0x2ff933,_0x387b37){_0x2ff933=_0x2ff933-0x0;var _0x4ba201=_0x0e52[_0x2ff933];return _0x4ba201;};'use strict';var Sequelize=require(_0x20e5('0x0'));module[_0x20e5('0x1')]={'type':{'type':Sequelize[_0x20e5('0x2')]('string',_0x20e5('0x3'),_0x20e5('0x4'),_0x20e5('0x5'),_0x20e5('0x6')),'defaultValue':_0x20e5('0x7')},'content':{'type':Sequelize[_0x20e5('0x8')]},'key':{'type':Sequelize[_0x20e5('0x8')]},'keyType':{'type':Sequelize['ENUM']('string',_0x20e5('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x20e5('0x8')]},'idField':{'type':Sequelize[_0x20e5('0x8')]},'nameField':{'type':Sequelize[_0x20e5('0x8')]},'customField':{'type':Sequelize[_0x20e5('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x20e5('0x8')]}}; \ No newline at end of file +var _0xe45f=['customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue','STRING'];(function(_0x350218,_0x553cee){var _0x29a58d=function(_0x190f54){while(--_0x190f54){_0x350218['push'](_0x350218['shift']());}};_0x29a58d(++_0x553cee);}(_0xe45f,0xda));var _0xfe45=function(_0x58025c,_0xb0060f){_0x58025c=_0x58025c-0x0;var _0x4ae559=_0xe45f[_0x58025c];return _0x4ae559;};'use strict';var Sequelize=require(_0xfe45('0x0'));module[_0xfe45('0x1')]={'type':{'type':Sequelize[_0xfe45('0x2')](_0xfe45('0x3'),_0xfe45('0x4'),'customVariable',_0xfe45('0x5'),'picklist'),'defaultValue':_0xfe45('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xfe45('0x6')]},'keyType':{'type':Sequelize[_0xfe45('0x2')]('string','variable',_0xfe45('0x7'))},'keyContent':{'type':Sequelize[_0xfe45('0x6')]},'idField':{'type':Sequelize[_0xfe45('0x6')]},'nameField':{'type':Sequelize[_0xfe45('0x6')]},'customField':{'type':Sequelize[_0xfe45('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfe45('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 3a8449d..c1d9418 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 _0x5b02=['length','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','error','name','map','FreshdeskField','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys'];(function(_0x2447ce,_0x5bbf35){var _0x163240=function(_0x1d872a){while(--_0x1d872a){_0x2447ce['push'](_0x2447ce['shift']());}};_0x163240(++_0x5bbf35);}(_0x5b02,0xe9));var _0x25b0=function(_0x4cf4d6,_0x16c785){_0x4cf4d6=_0x4cf4d6-0x0;var _0x40d035=_0x5b02[_0x4cf4d6];return _0x40d035;};'use strict';var emlformat=require(_0x25b0('0x0'));var rimraf=require(_0x25b0('0x1'));var zipdir=require(_0x25b0('0x2'));var jsonpatch=require(_0x25b0('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x25b0('0x4'));var Mustache=require('mustache');var util=require(_0x25b0('0x5'));var path=require(_0x25b0('0x6'));var sox=require(_0x25b0('0x7'));var csv=require(_0x25b0('0x8'));var ejs=require(_0x25b0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x25b0('0xa'));var squel=require(_0x25b0('0xb'));var crypto=require('crypto');var jsforce=require(_0x25b0('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x25b0('0xd'));var Papa=require(_0x25b0('0xe'));var Redis=require(_0x25b0('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x25b0('0x10'));var as=require(_0x25b0('0x11'));var hardwareService=require(_0x25b0('0x12'));var logger=require(_0x25b0('0x13'))(_0x25b0('0x14'));var utils=require(_0x25b0('0x15'));var config=require(_0x25b0('0x16'));var licenseUtil=require(_0x25b0('0x17'));var db=require(_0x25b0('0x18'))['db'];function respondWithStatusCode(_0x1d3178,_0x184452){_0x184452=_0x184452||0xcc;return function(_0x26a34f){if(_0x26a34f){return _0x1d3178[_0x25b0('0x19')](_0x184452);}return _0x1d3178[_0x25b0('0x1a')](_0x184452)[_0x25b0('0x1b')]();};}function respondWithResult(_0x42cc07,_0x293203){_0x293203=_0x293203||0xc8;return function(_0x211658){if(_0x211658){return _0x42cc07[_0x25b0('0x1a')](_0x293203)[_0x25b0('0x1c')](_0x211658);}};}function respondWithFilteredResult(_0x40071c,_0x5ac18d){return function(_0x51542b){if(_0x51542b){var _0xfe1ea6=typeof _0x5ac18d['offset']===_0x25b0('0x1d')&&typeof _0x5ac18d[_0x25b0('0x1e')]===_0x25b0('0x1d');var _0x3267b9=_0x51542b['count'];var _0x1d850f=_0xfe1ea6?0x0:_0x5ac18d[_0x25b0('0x1f')];var _0x20762e=_0xfe1ea6?_0x51542b[_0x25b0('0x20')]:_0x5ac18d[_0x25b0('0x1f')]+_0x5ac18d[_0x25b0('0x1e')];var _0x54f458;if(_0x20762e>=_0x3267b9){_0x20762e=_0x3267b9;_0x54f458=0xc8;}else{_0x54f458=0xce;}_0x40071c[_0x25b0('0x1a')](_0x54f458);return _0x40071c[_0x25b0('0x21')](_0x25b0('0x22'),_0x1d850f+'-'+_0x20762e+'/'+_0x3267b9)[_0x25b0('0x1c')](_0x51542b);}return null;};}function patchUpdates(_0x1dc691){return function(_0xea4162){try{jsonpatch[_0x25b0('0x23')](_0xea4162,_0x1dc691,!![]);}catch(_0x19599b){return BPromise[_0x25b0('0x24')](_0x19599b);}return _0xea4162[_0x25b0('0x25')]();};}function saveUpdates(_0x2b2eda,_0x3ce1da){return function(_0x5cb746){if(_0x5cb746){return _0x5cb746[_0x25b0('0x26')](_0x2b2eda)[_0x25b0('0x27')](function(_0x517ec5){return _0x517ec5;});}return null;};}function removeEntity(_0x2d7c17,_0x2023d8){return function(_0x3546f0){if(_0x3546f0){return _0x3546f0['destroy']()['then'](function(){_0x2d7c17['status'](0xcc)[_0x25b0('0x1b')]();});}};}function handleEntityNotFound(_0x433085,_0x99bd3a){return function(_0x24f847){if(!_0x24f847){_0x433085[_0x25b0('0x19')](0x194);}return _0x24f847;};}function handleError(_0x23b396,_0x40268a){_0x40268a=_0x40268a||0x1f4;return function(_0x75ce7a){logger[_0x25b0('0x28')](_0x75ce7a['stack']);if(_0x75ce7a[_0x25b0('0x29')]){delete _0x75ce7a[_0x25b0('0x29')];}_0x23b396['status'](_0x40268a)['send'](_0x75ce7a);};}exports['index']=function(_0x1a6212,_0x3f0a54){var _0x251fad={},_0x105129={},_0x214377={'count':0x0,'rows':[]};var _0x3285ae=_[_0x25b0('0x2a')](db[_0x25b0('0x2b')][_0x25b0('0x2c')],function(_0x285a2b){return{'name':_0x285a2b[_0x25b0('0x2d')],'type':_0x285a2b[_0x25b0('0x2e')][_0x25b0('0x2f')]};});_0x105129['model']=_['map'](_0x3285ae,_0x25b0('0x29'));_0x105129['query']=_['keys'](_0x1a6212[_0x25b0('0x30')]);_0x105129[_0x25b0('0x31')]=_[_0x25b0('0x32')](_0x105129[_0x25b0('0x33')],_0x105129[_0x25b0('0x30')]);_0x251fad['attributes']=_[_0x25b0('0x32')](_0x105129[_0x25b0('0x33')],qs['fields'](_0x1a6212[_0x25b0('0x30')][_0x25b0('0x34')]));_0x251fad['attributes']=_0x251fad[_0x25b0('0x35')]['length']?_0x251fad[_0x25b0('0x35')]:_0x105129[_0x25b0('0x33')];if(!_0x1a6212[_0x25b0('0x30')][_0x25b0('0x36')](_0x25b0('0x37'))){_0x251fad[_0x25b0('0x1e')]=qs[_0x25b0('0x1e')](_0x1a6212[_0x25b0('0x30')][_0x25b0('0x1e')]);_0x251fad['offset']=qs[_0x25b0('0x1f')](_0x1a6212[_0x25b0('0x30')][_0x25b0('0x1f')]);}_0x251fad[_0x25b0('0x38')]=qs[_0x25b0('0x39')](_0x1a6212[_0x25b0('0x30')][_0x25b0('0x39')]);_0x251fad[_0x25b0('0x3a')]=qs[_0x25b0('0x31')](_[_0x25b0('0x3b')](_0x1a6212['query'],_0x105129[_0x25b0('0x31')]),_0x3285ae);if(_0x1a6212[_0x25b0('0x30')][_0x25b0('0x3c')]){_0x251fad['where']=_[_0x25b0('0x3d')](_0x251fad[_0x25b0('0x3a')],{'$or':_[_0x25b0('0x2a')](_0x3285ae,function(_0x43e140){if(_0x43e140[_0x25b0('0x2e')]!==_0x25b0('0x3e')){var _0x28f1cd={};_0x28f1cd[_0x43e140[_0x25b0('0x29')]]={'$like':'%'+_0x1a6212['query']['filter']+'%'};return _0x28f1cd;}})});}_0x251fad=_[_0x25b0('0x3d')]({},_0x251fad,_0x1a6212[_0x25b0('0x3f')]);var _0x3f4ae0={'where':_0x251fad['where']};return db[_0x25b0('0x2b')]['count'](_0x3f4ae0)[_0x25b0('0x27')](function(_0x39617a){_0x214377[_0x25b0('0x20')]=_0x39617a;if(_0x1a6212[_0x25b0('0x30')][_0x25b0('0x40')]){_0x251fad['include']=[{'all':!![]}];}return db[_0x25b0('0x2b')][_0x25b0('0x41')](_0x251fad);})[_0x25b0('0x27')](function(_0x376d8a){_0x214377[_0x25b0('0x42')]=_0x376d8a;return _0x214377;})['then'](respondWithFilteredResult(_0x3f0a54,_0x251fad))[_0x25b0('0x43')](handleError(_0x3f0a54,null));};exports[_0x25b0('0x44')]=function(_0x3d1262,_0x44c400){var _0x35fc00={'raw':!![],'where':{'id':_0x3d1262[_0x25b0('0x45')]['id']}},_0x1adf8d={};_0x1adf8d[_0x25b0('0x33')]=_[_0x25b0('0x46')](db[_0x25b0('0x2b')][_0x25b0('0x2c')]);_0x1adf8d['query']=_[_0x25b0('0x46')](_0x3d1262['query']);_0x1adf8d[_0x25b0('0x31')]=_[_0x25b0('0x32')](_0x1adf8d[_0x25b0('0x33')],_0x1adf8d[_0x25b0('0x30')]);_0x35fc00['attributes']=_[_0x25b0('0x32')](_0x1adf8d[_0x25b0('0x33')],qs[_0x25b0('0x34')](_0x3d1262['query'][_0x25b0('0x34')]));_0x35fc00[_0x25b0('0x35')]=_0x35fc00[_0x25b0('0x35')][_0x25b0('0x47')]?_0x35fc00[_0x25b0('0x35')]:_0x1adf8d[_0x25b0('0x33')];if(_0x3d1262[_0x25b0('0x30')]['includeAll']){_0x35fc00[_0x25b0('0x48')]=[{'all':!![]}];}_0x35fc00=_[_0x25b0('0x3d')]({},_0x35fc00,_0x3d1262[_0x25b0('0x3f')]);return db['FreshdeskField'][_0x25b0('0x49')](_0x35fc00)[_0x25b0('0x27')](handleEntityNotFound(_0x44c400,null))[_0x25b0('0x27')](respondWithResult(_0x44c400,null))[_0x25b0('0x43')](handleError(_0x44c400,null));};exports[_0x25b0('0x4a')]=function(_0x568d83,_0x1e8a8d){return db[_0x25b0('0x2b')][_0x25b0('0x4a')](_0x568d83['body'],{})[_0x25b0('0x27')](respondWithResult(_0x1e8a8d,0xc9))[_0x25b0('0x43')](handleError(_0x1e8a8d,null));};exports[_0x25b0('0x26')]=function(_0x1d6d55,_0x29165e){if(_0x1d6d55[_0x25b0('0x4b')]['id']){delete _0x1d6d55['body']['id'];}return db['FreshdeskField']['find']({'where':{'id':_0x1d6d55[_0x25b0('0x45')]['id']}})['then'](handleEntityNotFound(_0x29165e,null))['then'](saveUpdates(_0x1d6d55[_0x25b0('0x4b')],null))['then'](respondWithResult(_0x29165e,null))[_0x25b0('0x43')](handleError(_0x29165e,null));};exports['destroy']=function(_0x4fc22d,_0x394e52){return db[_0x25b0('0x2b')][_0x25b0('0x49')]({'where':{'id':_0x4fc22d[_0x25b0('0x45')]['id']}})[_0x25b0('0x27')](handleEntityNotFound(_0x394e52,null))[_0x25b0('0x27')](removeEntity(_0x394e52,null))[_0x25b0('0x43')](handleError(_0x394e52,null));}; \ No newline at end of file +var _0xc901=['save','update','destroy','then','error','stack','name','send','index','map','FreshdeskField','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','include','rows','includeAll','find','catch','create','body','params','eml-format','moment','bluebird','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/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject'];(function(_0x23a9af,_0x2bc11c){var _0x11d0eb=function(_0x46f889){while(--_0x46f889){_0x23a9af['push'](_0x23a9af['shift']());}};_0x11d0eb(++_0x2bc11c);}(_0xc901,0x142));var _0x1c90=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xc901[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require(_0x1c90('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1c90('0x1'));var BPromise=require(_0x1c90('0x2'));var Mustache=require('mustache');var util=require(_0x1c90('0x3'));var path=require(_0x1c90('0x4'));var sox=require(_0x1c90('0x5'));var csv=require(_0x1c90('0x6'));var ejs=require(_0x1c90('0x7'));var fs=require('fs');var fs_extra=require(_0x1c90('0x8'));var _=require(_0x1c90('0x9'));var squel=require(_0x1c90('0xa'));var crypto=require(_0x1c90('0xb'));var jsforce=require(_0x1c90('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1c90('0x6'));var querystring=require(_0x1c90('0xd'));var Papa=require(_0x1c90('0xe'));var Redis=require(_0x1c90('0xf'));var authService=require(_0x1c90('0x10'));var qs=require(_0x1c90('0x11'));var as=require(_0x1c90('0x12'));var hardwareService=require(_0x1c90('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x1c90('0x14'));var config=require(_0x1c90('0x15'));var licenseUtil=require(_0x1c90('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4da158,_0x3a38ed){_0x3a38ed=_0x3a38ed||0xcc;return function(_0x3353e3){if(_0x3353e3){return _0x4da158['sendStatus'](_0x3a38ed);}return _0x4da158[_0x1c90('0x17')](_0x3a38ed)[_0x1c90('0x18')]();};}function respondWithResult(_0xf72b98,_0x589c97){_0x589c97=_0x589c97||0xc8;return function(_0x42cb94){if(_0x42cb94){return _0xf72b98['status'](_0x589c97)[_0x1c90('0x19')](_0x42cb94);}};}function respondWithFilteredResult(_0x210ef4,_0x7a88dc){return function(_0x42d8a4){if(_0x42d8a4){var _0x48bd5e=typeof _0x7a88dc[_0x1c90('0x1a')]==='undefined'&&typeof _0x7a88dc[_0x1c90('0x1b')]===_0x1c90('0x1c');var _0x5f1025=_0x42d8a4[_0x1c90('0x1d')];var _0x4ec354=_0x48bd5e?0x0:_0x7a88dc['offset'];var _0x128bf0=_0x48bd5e?_0x42d8a4['count']:_0x7a88dc[_0x1c90('0x1a')]+_0x7a88dc[_0x1c90('0x1b')];var _0x2a5b73;if(_0x128bf0>=_0x5f1025){_0x128bf0=_0x5f1025;_0x2a5b73=0xc8;}else{_0x2a5b73=0xce;}_0x210ef4[_0x1c90('0x17')](_0x2a5b73);return _0x210ef4['set'](_0x1c90('0x1e'),_0x4ec354+'-'+_0x128bf0+'/'+_0x5f1025)['json'](_0x42d8a4);}return null;};}function patchUpdates(_0x525997){return function(_0x38f997){try{jsonpatch[_0x1c90('0x1f')](_0x38f997,_0x525997,!![]);}catch(_0x47fd11){return BPromise[_0x1c90('0x20')](_0x47fd11);}return _0x38f997[_0x1c90('0x21')]();};}function saveUpdates(_0x445664,_0x4074fd){return function(_0x13fc42){if(_0x13fc42){return _0x13fc42[_0x1c90('0x22')](_0x445664)['then'](function(_0x418f4c){return _0x418f4c;});}return null;};}function removeEntity(_0x46baa1,_0xab232a){return function(_0x33c88b){if(_0x33c88b){return _0x33c88b[_0x1c90('0x23')]()[_0x1c90('0x24')](function(){_0x46baa1[_0x1c90('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x64ca90,_0x435c3a){return function(_0x3923a9){if(!_0x3923a9){_0x64ca90['sendStatus'](0x194);}return _0x3923a9;};}function handleError(_0xb5666e,_0x44387f){_0x44387f=_0x44387f||0x1f4;return function(_0x4abffe){logger[_0x1c90('0x25')](_0x4abffe[_0x1c90('0x26')]);if(_0x4abffe['name']){delete _0x4abffe[_0x1c90('0x27')];}_0xb5666e[_0x1c90('0x17')](_0x44387f)[_0x1c90('0x28')](_0x4abffe);};}exports[_0x1c90('0x29')]=function(_0x395edb,_0x111e20){var _0xd0a607={},_0x35c843={},_0x52c308={'count':0x0,'rows':[]};var _0xc1a571=_[_0x1c90('0x2a')](db[_0x1c90('0x2b')][_0x1c90('0x2c')],function(_0x1979de){return{'name':_0x1979de[_0x1c90('0x2d')],'type':_0x1979de[_0x1c90('0x2e')][_0x1c90('0x2f')]};});_0x35c843[_0x1c90('0x30')]=_[_0x1c90('0x2a')](_0xc1a571,_0x1c90('0x27'));_0x35c843['query']=_[_0x1c90('0x31')](_0x395edb[_0x1c90('0x32')]);_0x35c843['filters']=_[_0x1c90('0x33')](_0x35c843['model'],_0x35c843[_0x1c90('0x32')]);_0xd0a607['attributes']=_[_0x1c90('0x33')](_0x35c843['model'],qs[_0x1c90('0x34')](_0x395edb[_0x1c90('0x32')]['fields']));_0xd0a607[_0x1c90('0x35')]=_0xd0a607[_0x1c90('0x35')]['length']?_0xd0a607[_0x1c90('0x35')]:_0x35c843[_0x1c90('0x30')];if(!_0x395edb[_0x1c90('0x32')][_0x1c90('0x36')](_0x1c90('0x37'))){_0xd0a607['limit']=qs['limit'](_0x395edb['query']['limit']);_0xd0a607['offset']=qs[_0x1c90('0x1a')](_0x395edb[_0x1c90('0x32')][_0x1c90('0x1a')]);}_0xd0a607['order']=qs[_0x1c90('0x38')](_0x395edb['query'][_0x1c90('0x38')]);_0xd0a607[_0x1c90('0x39')]=qs['filters'](_['pick'](_0x395edb[_0x1c90('0x32')],_0x35c843[_0x1c90('0x3a')]),_0xc1a571);if(_0x395edb[_0x1c90('0x32')][_0x1c90('0x3b')]){_0xd0a607[_0x1c90('0x39')]=_[_0x1c90('0x3c')](_0xd0a607[_0x1c90('0x39')],{'$or':_['map'](_0xc1a571,function(_0x508025){if(_0x508025[_0x1c90('0x2e')]!==_0x1c90('0x3d')){var _0x134501={};_0x134501[_0x508025[_0x1c90('0x27')]]={'$like':'%'+_0x395edb[_0x1c90('0x32')][_0x1c90('0x3b')]+'%'};return _0x134501;}})});}_0xd0a607=_[_0x1c90('0x3c')]({},_0xd0a607,_0x395edb[_0x1c90('0x3e')]);var _0x398ee9={'where':_0xd0a607[_0x1c90('0x39')]};return db['FreshdeskField'][_0x1c90('0x1d')](_0x398ee9)['then'](function(_0x5a8eea){_0x52c308[_0x1c90('0x1d')]=_0x5a8eea;if(_0x395edb['query']['includeAll']){_0xd0a607[_0x1c90('0x3f')]=[{'all':!![]}];}return db[_0x1c90('0x2b')]['findAll'](_0xd0a607);})[_0x1c90('0x24')](function(_0x3271ea){_0x52c308[_0x1c90('0x40')]=_0x3271ea;return _0x52c308;})[_0x1c90('0x24')](respondWithFilteredResult(_0x111e20,_0xd0a607))['catch'](handleError(_0x111e20,null));};exports['show']=function(_0x19e689,_0x171ca0){var _0x5680fe={'raw':!![],'where':{'id':_0x19e689['params']['id']}},_0x35952a={};_0x35952a[_0x1c90('0x30')]=_[_0x1c90('0x31')](db['FreshdeskField'][_0x1c90('0x2c')]);_0x35952a[_0x1c90('0x32')]=_[_0x1c90('0x31')](_0x19e689[_0x1c90('0x32')]);_0x35952a[_0x1c90('0x3a')]=_[_0x1c90('0x33')](_0x35952a[_0x1c90('0x30')],_0x35952a[_0x1c90('0x32')]);_0x5680fe[_0x1c90('0x35')]=_[_0x1c90('0x33')](_0x35952a[_0x1c90('0x30')],qs['fields'](_0x19e689[_0x1c90('0x32')]['fields']));_0x5680fe[_0x1c90('0x35')]=_0x5680fe['attributes']['length']?_0x5680fe[_0x1c90('0x35')]:_0x35952a[_0x1c90('0x30')];if(_0x19e689[_0x1c90('0x32')][_0x1c90('0x41')]){_0x5680fe[_0x1c90('0x3f')]=[{'all':!![]}];}_0x5680fe=_[_0x1c90('0x3c')]({},_0x5680fe,_0x19e689[_0x1c90('0x3e')]);return db[_0x1c90('0x2b')][_0x1c90('0x42')](_0x5680fe)['then'](handleEntityNotFound(_0x171ca0,null))['then'](respondWithResult(_0x171ca0,null))[_0x1c90('0x43')](handleError(_0x171ca0,null));};exports[_0x1c90('0x44')]=function(_0x68fac8,_0x2d30f5){return db[_0x1c90('0x2b')][_0x1c90('0x44')](_0x68fac8[_0x1c90('0x45')],{})[_0x1c90('0x24')](respondWithResult(_0x2d30f5,0xc9))['catch'](handleError(_0x2d30f5,null));};exports[_0x1c90('0x22')]=function(_0x24016a,_0x9524b6){if(_0x24016a['body']['id']){delete _0x24016a['body']['id'];}return db[_0x1c90('0x2b')]['find']({'where':{'id':_0x24016a[_0x1c90('0x46')]['id']}})['then'](handleEntityNotFound(_0x9524b6,null))['then'](saveUpdates(_0x24016a[_0x1c90('0x45')],null))[_0x1c90('0x24')](respondWithResult(_0x9524b6,null))['catch'](handleError(_0x9524b6,null));};exports['destroy']=function(_0x394177,_0x53f158){return db[_0x1c90('0x2b')][_0x1c90('0x42')]({'where':{'id':_0x394177[_0x1c90('0x46')]['id']}})[_0x1c90('0x24')](handleEntityNotFound(_0x53f158,null))['then'](removeEntity(_0x53f158,null))['catch'](handleError(_0x53f158,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index d8e395a..1f98597 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 _0xd1d7=['request-promise','rimraf','../../config/environment','./intFreshdeskField.attributes','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x959987,_0x218f52){var _0x146f45=function(_0x43b1ab){while(--_0x43b1ab){_0x959987['push'](_0x959987['shift']());}};_0x146f45(++_0x218f52);}(_0xd1d7,0x144));var _0x7d1d=function(_0x2c7192,_0x133f6b){_0x2c7192=_0x2c7192-0x0;var _0x5117d0=_0xd1d7[_0x2c7192];return _0x5117d0;};'use strict';var _=require(_0x7d1d('0x0'));var util=require(_0x7d1d('0x1'));var logger=require(_0x7d1d('0x2'))(_0x7d1d('0x3'));var moment=require(_0x7d1d('0x4'));var BPromise=require(_0x7d1d('0x5'));var rp=require(_0x7d1d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7d1d('0x7'));var config=require(_0x7d1d('0x8'));var attributes=require(_0x7d1d('0x9'));module['exports']=function(_0xe5d630,_0xd02a7b){return _0xe5d630[_0x7d1d('0xa')](_0x7d1d('0xb'),attributes,{'tableName':_0x7d1d('0xc'),'paranoid':![],'indexes':[{'name':_0x7d1d('0xd'),'fields':[_0x7d1d('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7079=['exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','lodash','util','api','moment','request-promise','path','rimraf','./intFreshdeskField.attributes'];(function(_0x36a8dd,_0x18263b){var _0x306e43=function(_0xe899c0){while(--_0xe899c0){_0x36a8dd['push'](_0x36a8dd['shift']());}};_0x306e43(++_0x18263b);}(_0x7079,0x68));var _0x9707=function(_0x483733,_0x5b2261){_0x483733=_0x483733-0x0;var _0x323ea7=_0x7079[_0x483733];return _0x323ea7;};'use strict';var _=require(_0x9707('0x0'));var util=require(_0x9707('0x1'));var logger=require('../../config/logger')(_0x9707('0x2'));var moment=require(_0x9707('0x3'));var BPromise=require('bluebird');var rp=require(_0x9707('0x4'));var fs=require('fs');var path=require(_0x9707('0x5'));var rimraf=require(_0x9707('0x6'));var config=require('../../config/environment');var attributes=require(_0x9707('0x7'));module[_0x9707('0x8')]=function(_0x4dcb1b,_0x2c7b04){return _0x4dcb1b[_0x9707('0x9')](_0x9707('0xa'),attributes,{'tableName':_0x9707('0xb'),'paranoid':![],'indexes':[{'name':_0x9707('0xc'),'fields':[_0x9707('0xd'),'FieldId'],'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 0047b43..a568854 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 _0x934b=['stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','then','FreshdeskField,\x20%s,\x20%s','request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s'];(function(_0x4a310d,_0x33322d){var _0x5eaf36=function(_0x233014){while(--_0x233014){_0x4a310d['push'](_0x4a310d['shift']());}};_0x5eaf36(++_0x33322d);}(_0x934b,0xce));var _0xb934=function(_0x508acd,_0x852c77){_0x508acd=_0x508acd-0x0;var _0x4e8524=_0x934b[_0x508acd];return _0x4e8524;};'use strict';var _=require('lodash');var util=require(_0xb934('0x0'));var moment=require(_0xb934('0x1'));var BPromise=require(_0xb934('0x2'));var rs=require(_0xb934('0x3'));var fs=require('fs');var Redis=require(_0xb934('0x4'));var db=require(_0xb934('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xb934('0x6'));var jayson=require(_0xb934('0x7'));var client=jayson[_0xb934('0x8')][_0xb934('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x173590,_0x4defa6,_0x33c9de){return new BPromise(function(_0x5a37ab,_0x2ccfc0){return client['request'](_0x173590,_0x33c9de)[_0xb934('0xa')](function(_0x121f0c){logger['info'](_0xb934('0xb'),_0x4defa6,_0xb934('0xc'));logger['debug'](_0xb934('0xd'),_0x4defa6,_0xb934('0xc'),JSON[_0xb934('0xe')](_0x121f0c));if(_0x121f0c['error']){if(_0x121f0c[_0xb934('0xf')][_0xb934('0x10')]===0x1f4){logger[_0xb934('0xf')](_0xb934('0xb'),_0x4defa6,_0x121f0c['error'][_0xb934('0x11')]);return _0x2ccfc0(_0x121f0c[_0xb934('0xf')][_0xb934('0x11')]);}logger[_0xb934('0xf')]('FreshdeskField,\x20%s,\x20%s',_0x4defa6,_0x121f0c[_0xb934('0xf')]['message']);return _0x5a37ab(_0x121f0c[_0xb934('0xf')][_0xb934('0x11')]);}else{logger['info']('FreshdeskField,\x20%s,\x20%s',_0x4defa6,_0xb934('0xc'));_0x5a37ab(_0x121f0c[_0xb934('0x12')][_0xb934('0x11')]);}})[_0xb934('0x13')](function(_0x17faee){logger[_0xb934('0xf')](_0xb934('0xb'),_0x4defa6,_0x17faee);_0x2ccfc0(_0x17faee);});});} \ No newline at end of file +var _0xe906=['message','FreshdeskField,\x20%s,\x20%s','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xe906,0x1e8));var _0x6e90=function(_0x2b8a8f,_0x4ae23c){_0x2b8a8f=_0x2b8a8f-0x0;var _0x224073=_0xe906[_0x2b8a8f];return _0x224073;};'use strict';var _=require('lodash');var util=require(_0x6e90('0x0'));var moment=require(_0x6e90('0x1'));var BPromise=require(_0x6e90('0x2'));var rs=require(_0x6e90('0x3'));var fs=require('fs');var Redis=require(_0x6e90('0x4'));var db=require(_0x6e90('0x5'))['db'];var utils=require(_0x6e90('0x6'));var logger=require(_0x6e90('0x7'))(_0x6e90('0x8'));var config=require(_0x6e90('0x9'));var jayson=require(_0x6e90('0xa'));var client=jayson[_0x6e90('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c63ca,_0xaabd13,_0x2bee35){return new BPromise(function(_0x2d9ecd,_0x20837d){return client['request'](_0x5c63ca,_0x2bee35)[_0x6e90('0xc')](function(_0x3ae388){logger['info']('FreshdeskField,\x20%s,\x20%s',_0xaabd13,_0x6e90('0xd'));logger[_0x6e90('0xe')](_0x6e90('0xf'),_0xaabd13,_0x6e90('0xd'),JSON['stringify'](_0x3ae388));if(_0x3ae388['error']){if(_0x3ae388[_0x6e90('0x10')][_0x6e90('0x11')]===0x1f4){logger[_0x6e90('0x10')]('FreshdeskField,\x20%s,\x20%s',_0xaabd13,_0x3ae388[_0x6e90('0x10')][_0x6e90('0x12')]);return _0x20837d(_0x3ae388[_0x6e90('0x10')]['message']);}logger['error'](_0x6e90('0x13'),_0xaabd13,_0x3ae388['error'][_0x6e90('0x12')]);return _0x2d9ecd(_0x3ae388[_0x6e90('0x10')][_0x6e90('0x12')]);}else{logger[_0x6e90('0x14')](_0x6e90('0x13'),_0xaabd13,_0x6e90('0xd'));_0x2d9ecd(_0x3ae388[_0x6e90('0x15')]['message']);}})[_0x6e90('0x16')](function(_0xa12cce){logger[_0x6e90('0x10')](_0x6e90('0x13'),_0xaabd13,_0xa12cce);_0x20837d(_0xa12cce);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 113dabf..b79c90e 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 _0x5eb8=['./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5f0fcf,_0x5305d3){var _0x4176fb=function(_0x123a2c){while(--_0x123a2c){_0x5f0fcf['push'](_0x5f0fcf['shift']());}};_0x4176fb(++_0x5305d3);}(_0x5eb8,0xb0));var _0x85eb=function(_0x21ae22,_0x54911f){_0x21ae22=_0x21ae22-0x0;var _0x1e610a=_0x5eb8[_0x21ae22];return _0x1e610a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['get'](_0x85eb('0xe'),auth['isAuthenticated'](),controller[_0x85eb('0xf')]);router[_0x85eb('0x9')](_0x85eb('0x10'),auth[_0x85eb('0xa')](),controller[_0x85eb('0x11')]);router[_0x85eb('0x12')]('/',auth[_0x85eb('0xa')](),controller['create']);router[_0x85eb('0x12')](_0x85eb('0xe'),auth['isAuthenticated'](),controller[_0x85eb('0x13')]);router[_0x85eb('0x14')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller['update']);router['delete'](_0x85eb('0xc'),auth['isAuthenticated'](),controller[_0x85eb('0x15')]);module[_0x85eb('0x16')]=router; \ No newline at end of file +var _0xb62e=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','isAuthenticated','index','get','show','/:id/configurations','/:id/fields','getFields','post','create','put','/:id','update','destroy','multer','util','path','connect-timeout','Router'];(function(_0x2e127a,_0xe316bf){var _0x2aa888=function(_0x19ec38){while(--_0x19ec38){_0x2e127a['push'](_0x2e127a['shift']());}};_0x2aa888(++_0xe316bf);}(_0xb62e,0x1de));var _0xeb62=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xb62e[_0x1035c1];return _0x308d67;};'use strict';var multer=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var path=require(_0xeb62('0x2'));var timeout=require(_0xeb62('0x3'));var express=require('express');var router=express[_0xeb62('0x4')]();var fs_extra=require(_0xeb62('0x5'));var auth=require(_0xeb62('0x6'));var interaction=require(_0xeb62('0x7'));var config=require(_0xeb62('0x8'));var controller=require(_0xeb62('0x9'));router['get']('/',auth[_0xeb62('0xa')](),controller[_0xeb62('0xb')]);router[_0xeb62('0xc')]('/:id',auth[_0xeb62('0xa')](),controller[_0xeb62('0xd')]);router[_0xeb62('0xc')](_0xeb62('0xe'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xeb62('0xc')](_0xeb62('0xf'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x10')]);router[_0xeb62('0x11')]('/',auth[_0xeb62('0xa')](),controller[_0xeb62('0x12')]);router[_0xeb62('0x11')](_0xeb62('0xe'),auth[_0xeb62('0xa')](),controller['addConfiguration']);router[_0xeb62('0x13')](_0xeb62('0x14'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x15')]);router['delete'](_0xeb62('0x14'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 3cfb0cb..8ee07b5 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 _0x1a85=['STRING','remoteUri'];(function(_0x297954,_0x34e5d7){var _0x2c7852=function(_0x5b8c4d){while(--_0x5b8c4d){_0x297954['push'](_0x297954['shift']());}};_0x2c7852(++_0x34e5d7);}(_0x1a85,0x178));var _0x51a8=function(_0x79324e,_0x4af67e){_0x79324e=_0x79324e-0x0;var _0x555666=_0x1a85[_0x79324e];return _0x555666;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x51a8('0x0')]},'description':{'type':Sequelize[_0x51a8('0x0')]},'username':{'type':Sequelize[_0x51a8('0x0')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x51a8('0x0')],'unique':_0x51a8('0x1')},'serverUrl':{'type':Sequelize[_0x51a8('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0x0120=['remoteUri','sequelize','exports','STRING','username'];(function(_0x296cff,_0x16d1e8){var _0x51c99e=function(_0x33b914){while(--_0x33b914){_0x296cff['push'](_0x296cff['shift']());}};_0x51c99e(++_0x16d1e8);}(_0x0120,0x6f));var _0x0012=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x0120[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0x0012('0x0'));module[_0x0012('0x1')]={'name':{'type':Sequelize[_0x0012('0x2')]},'description':{'type':Sequelize[_0x0012('0x2')]},'username':{'type':Sequelize[_0x0012('0x2')],'unique':_0x0012('0x3')},'apiKey':{'type':Sequelize[_0x0012('0x2')]},'remoteUri':{'type':Sequelize[_0x0012('0x2')],'unique':_0x0012('0x4')},'serverUrl':{'type':Sequelize[_0x0012('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 694458c..3278a88 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 _0x9e35=['rows','catch','show','params','includeAll','options','find','create','body','FreshsalesConfiguration','getConfigurations','addConfiguration','findOne','AccountId','getSubjects','channel','Descriptions','Subjects','FreshsalesField','getFields','username','remoteUri','apiKey','substring','GET','format','%s%s','/api/selector/owners','Token\x20token=','email','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','rimraf','zip-dir','request-promise','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','limit','count','set','json','apply','reject','save','update','destroy','stack','name','send','index','FreshsalesAccount','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','include','findAll','then'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x9e35,0x8c));var _0x59e3=function(_0x45b1cb,_0x2238e0){_0x45b1cb=_0x45b1cb-0x0;var _0x2f7462=_0x9e35[_0x45b1cb];return _0x2f7462;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x59e3('0x0'));var zipdir=require(_0x59e3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x59e3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x59e3('0x3'));var util=require('util');var path=require(_0x59e3('0x4'));var sox=require('sox');var csv=require(_0x59e3('0x5'));var ejs=require(_0x59e3('0x6'));var fs=require('fs');var fs_extra=require(_0x59e3('0x7'));var _=require(_0x59e3('0x8'));var squel=require(_0x59e3('0x9'));var crypto=require(_0x59e3('0xa'));var jsforce=require(_0x59e3('0xb'));var deskjs=require(_0x59e3('0xc'));var toCsv=require(_0x59e3('0x5'));var querystring=require(_0x59e3('0xd'));var Papa=require(_0x59e3('0xe'));var Redis=require(_0x59e3('0xf'));var authService=require(_0x59e3('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x59e3('0x11'));var hardwareService=require(_0x59e3('0x12'));var logger=require('../../config/logger')(_0x59e3('0x13'));var utils=require(_0x59e3('0x14'));var config=require(_0x59e3('0x15'));var licenseUtil=require(_0x59e3('0x16'));var db=require(_0x59e3('0x17'))['db'];var integrations=require(_0x59e3('0x18'));function respondWithStatusCode(_0x351c9d,_0x2b3ba1){_0x2b3ba1=_0x2b3ba1||0xcc;return function(_0x10a63f){if(_0x10a63f){return _0x351c9d[_0x59e3('0x19')](_0x2b3ba1);}return _0x351c9d[_0x59e3('0x1a')](_0x2b3ba1)[_0x59e3('0x1b')]();};}function respondWithResult(_0x486482,_0x41b8b5){_0x41b8b5=_0x41b8b5||0xc8;return function(_0xb51599){if(_0xb51599){return _0x486482[_0x59e3('0x1a')](_0x41b8b5)['json'](_0xb51599);}};}function respondWithFilteredResult(_0x5029c0,_0x5718b8){return function(_0x29a439){if(_0x29a439){var _0xa8eec=typeof _0x5718b8[_0x59e3('0x1c')]==='undefined'&&typeof _0x5718b8[_0x59e3('0x1d')]==='undefined';var _0x3fa9e4=_0x29a439[_0x59e3('0x1e')];var _0x218dcb=_0xa8eec?0x0:_0x5718b8[_0x59e3('0x1c')];var _0xd06481=_0xa8eec?_0x29a439[_0x59e3('0x1e')]:_0x5718b8['offset']+_0x5718b8['limit'];var _0x414d18;if(_0xd06481>=_0x3fa9e4){_0xd06481=_0x3fa9e4;_0x414d18=0xc8;}else{_0x414d18=0xce;}_0x5029c0['status'](_0x414d18);return _0x5029c0[_0x59e3('0x1f')]('Content-Range',_0x218dcb+'-'+_0xd06481+'/'+_0x3fa9e4)[_0x59e3('0x20')](_0x29a439);}return null;};}function patchUpdates(_0x2bfb66){return function(_0x34fe3c){try{jsonpatch[_0x59e3('0x21')](_0x34fe3c,_0x2bfb66,!![]);}catch(_0x552067){return BPromise[_0x59e3('0x22')](_0x552067);}return _0x34fe3c[_0x59e3('0x23')]();};}function saveUpdates(_0x43e8d9,_0x580a63){return function(_0x297c69){if(_0x297c69){return _0x297c69[_0x59e3('0x24')](_0x43e8d9)['then'](function(_0x20bcd3){return _0x20bcd3;});}return null;};}function removeEntity(_0x385bb8,_0x5d27b0){return function(_0x47f7ad){if(_0x47f7ad){return _0x47f7ad[_0x59e3('0x25')]()['then'](function(){_0x385bb8[_0x59e3('0x1a')](0xcc)[_0x59e3('0x1b')]();});}};}function handleEntityNotFound(_0x409f17,_0x11f264){return function(_0x494503){if(!_0x494503){_0x409f17['sendStatus'](0x194);}return _0x494503;};}function handleError(_0x2d3ee0,_0x1d3686){_0x1d3686=_0x1d3686||0x1f4;return function(_0x42ec41){logger['error'](_0x42ec41[_0x59e3('0x26')]);if(_0x42ec41[_0x59e3('0x27')]){delete _0x42ec41[_0x59e3('0x27')];}_0x2d3ee0[_0x59e3('0x1a')](_0x1d3686)[_0x59e3('0x28')](_0x42ec41);};}exports[_0x59e3('0x29')]=function(_0x5e1b83,_0x1b049f){var _0x4f0d78={},_0x5e49b4={},_0x52091a={'count':0x0,'rows':[]};var _0x9d1f1=_['map'](db[_0x59e3('0x2a')][_0x59e3('0x2b')],function(_0xa0f110){return{'name':_0xa0f110[_0x59e3('0x2c')],'type':_0xa0f110[_0x59e3('0x2d')][_0x59e3('0x2e')]};});_0x5e49b4[_0x59e3('0x2f')]=_[_0x59e3('0x30')](_0x9d1f1,_0x59e3('0x27'));_0x5e49b4['query']=_[_0x59e3('0x31')](_0x5e1b83[_0x59e3('0x32')]);_0x5e49b4[_0x59e3('0x33')]=_[_0x59e3('0x34')](_0x5e49b4[_0x59e3('0x2f')],_0x5e49b4[_0x59e3('0x32')]);_0x4f0d78[_0x59e3('0x35')]=_[_0x59e3('0x34')](_0x5e49b4[_0x59e3('0x2f')],qs[_0x59e3('0x36')](_0x5e1b83[_0x59e3('0x32')][_0x59e3('0x36')]));_0x4f0d78[_0x59e3('0x35')]=_0x4f0d78[_0x59e3('0x35')][_0x59e3('0x37')]?_0x4f0d78['attributes']:_0x5e49b4[_0x59e3('0x2f')];if(!_0x5e1b83['query'][_0x59e3('0x38')](_0x59e3('0x39'))){_0x4f0d78[_0x59e3('0x1d')]=qs[_0x59e3('0x1d')](_0x5e1b83[_0x59e3('0x32')][_0x59e3('0x1d')]);_0x4f0d78['offset']=qs['offset'](_0x5e1b83[_0x59e3('0x32')][_0x59e3('0x1c')]);}_0x4f0d78[_0x59e3('0x3a')]=qs[_0x59e3('0x3b')](_0x5e1b83[_0x59e3('0x32')][_0x59e3('0x3b')]);_0x4f0d78['where']=qs[_0x59e3('0x33')](_[_0x59e3('0x3c')](_0x5e1b83[_0x59e3('0x32')],_0x5e49b4[_0x59e3('0x33')]),_0x9d1f1);if(_0x5e1b83[_0x59e3('0x32')][_0x59e3('0x3d')]){_0x4f0d78[_0x59e3('0x3e')]=_['merge'](_0x4f0d78[_0x59e3('0x3e')],{'$or':_[_0x59e3('0x30')](_0x9d1f1,function(_0x377217){if(_0x377217[_0x59e3('0x2d')]!==_0x59e3('0x3f')){var _0x4ba8a8={};_0x4ba8a8[_0x377217[_0x59e3('0x27')]]={'$like':'%'+_0x5e1b83[_0x59e3('0x32')]['filter']+'%'};return _0x4ba8a8;}})});}_0x4f0d78=_[_0x59e3('0x40')]({},_0x4f0d78,_0x5e1b83['options']);var _0x87122e={'where':_0x4f0d78[_0x59e3('0x3e')]};return db[_0x59e3('0x2a')][_0x59e3('0x1e')](_0x87122e)['then'](function(_0x1a4a9a){_0x52091a['count']=_0x1a4a9a;if(_0x5e1b83[_0x59e3('0x32')]['includeAll']){_0x4f0d78[_0x59e3('0x41')]=[{'all':!![]}];}return db[_0x59e3('0x2a')][_0x59e3('0x42')](_0x4f0d78);})[_0x59e3('0x43')](function(_0x5aac81){_0x52091a[_0x59e3('0x44')]=_0x5aac81;return _0x52091a;})[_0x59e3('0x43')](respondWithFilteredResult(_0x1b049f,_0x4f0d78))[_0x59e3('0x45')](handleError(_0x1b049f,null));};exports[_0x59e3('0x46')]=function(_0x5913d9,_0x21d550){var _0xd5cba0={'raw':![],'where':{'id':_0x5913d9[_0x59e3('0x47')]['id']}},_0x22fcf9={};_0x22fcf9['model']=_['keys'](db[_0x59e3('0x2a')][_0x59e3('0x2b')]);_0x22fcf9['query']=_['keys'](_0x5913d9[_0x59e3('0x32')]);_0x22fcf9[_0x59e3('0x33')]=_[_0x59e3('0x34')](_0x22fcf9[_0x59e3('0x2f')],_0x22fcf9[_0x59e3('0x32')]);_0xd5cba0['attributes']=_[_0x59e3('0x34')](_0x22fcf9[_0x59e3('0x2f')],qs[_0x59e3('0x36')](_0x5913d9[_0x59e3('0x32')][_0x59e3('0x36')]));_0xd5cba0['attributes']=_0xd5cba0['attributes'][_0x59e3('0x37')]?_0xd5cba0[_0x59e3('0x35')]:_0x22fcf9[_0x59e3('0x2f')];if(_0x5913d9[_0x59e3('0x32')][_0x59e3('0x48')]){_0xd5cba0['include']=[{'all':!![]}];}_0xd5cba0=_['merge']({},_0xd5cba0,_0x5913d9[_0x59e3('0x49')]);return db[_0x59e3('0x2a')][_0x59e3('0x4a')](_0xd5cba0)[_0x59e3('0x43')](handleEntityNotFound(_0x21d550,null))[_0x59e3('0x43')](respondWithResult(_0x21d550,null))['catch'](handleError(_0x21d550,null));};exports[_0x59e3('0x4b')]=function(_0x27c71f,_0x18f7b0){return db[_0x59e3('0x2a')][_0x59e3('0x4b')](_0x27c71f[_0x59e3('0x4c')],{})[_0x59e3('0x43')](respondWithResult(_0x18f7b0,0xc9))['catch'](handleError(_0x18f7b0,null));};exports['update']=function(_0x34adce,_0x3767eb){if(_0x34adce[_0x59e3('0x4c')]['id']){delete _0x34adce[_0x59e3('0x4c')]['id'];}return db['FreshsalesAccount']['find']({'where':{'id':_0x34adce[_0x59e3('0x47')]['id']}})['then'](handleEntityNotFound(_0x3767eb,null))[_0x59e3('0x43')](saveUpdates(_0x34adce[_0x59e3('0x4c')],null))[_0x59e3('0x43')](respondWithResult(_0x3767eb,null))['catch'](handleError(_0x3767eb,null));};exports[_0x59e3('0x25')]=function(_0x2f5c11,_0x29d1c2){return db[_0x59e3('0x2a')][_0x59e3('0x4a')]({'where':{'id':_0x2f5c11[_0x59e3('0x47')]['id']}})[_0x59e3('0x43')](handleEntityNotFound(_0x29d1c2,null))[_0x59e3('0x43')](removeEntity(_0x29d1c2,null))[_0x59e3('0x45')](handleError(_0x29d1c2,null));};exports['getConfigurations']=function(_0x21e824,_0x14cfa8,_0x5e650f){var _0x45d3c8={};var _0x359532={};var _0x25b910;var _0x1831b4;return db['FreshsalesAccount']['findOne']({'where':{'id':_0x21e824[_0x59e3('0x47')]['id']}})[_0x59e3('0x43')](handleEntityNotFound(_0x14cfa8,null))[_0x59e3('0x43')](function(_0x1a3df6){if(_0x1a3df6){_0x25b910=_0x1a3df6;_0x359532[_0x59e3('0x2f')]=_[_0x59e3('0x31')](db[_0x59e3('0x4d')][_0x59e3('0x2b')]);_0x359532[_0x59e3('0x32')]=_[_0x59e3('0x31')](_0x21e824[_0x59e3('0x32')]);_0x359532[_0x59e3('0x33')]=_[_0x59e3('0x34')](_0x359532['model'],_0x359532['query']);_0x45d3c8[_0x59e3('0x35')]=_[_0x59e3('0x34')](_0x359532[_0x59e3('0x2f')],qs['fields'](_0x21e824[_0x59e3('0x32')][_0x59e3('0x36')]));_0x45d3c8[_0x59e3('0x35')]=_0x45d3c8[_0x59e3('0x35')][_0x59e3('0x37')]?_0x45d3c8['attributes']:_0x359532[_0x59e3('0x2f')];_0x45d3c8[_0x59e3('0x3a')]=qs[_0x59e3('0x3b')](_0x21e824[_0x59e3('0x32')][_0x59e3('0x3b')]);_0x45d3c8[_0x59e3('0x3e')]=qs[_0x59e3('0x33')](_[_0x59e3('0x3c')](_0x21e824[_0x59e3('0x32')],_0x359532[_0x59e3('0x33')]));if(_0x21e824['query'][_0x59e3('0x3d')]){_0x45d3c8[_0x59e3('0x3e')]=_['merge'](_0x45d3c8[_0x59e3('0x3e')],{'$or':_['map'](_0x45d3c8[_0x59e3('0x35')],function(_0x4232fc){var _0x3399d8={};_0x3399d8[_0x4232fc]={'$like':'%'+_0x21e824[_0x59e3('0x32')][_0x59e3('0x3d')]+'%'};return _0x3399d8;})});}_0x45d3c8=_[_0x59e3('0x40')]({},_0x45d3c8,_0x21e824[_0x59e3('0x49')]);return _0x25b910['getConfigurations'](_0x45d3c8);}})[_0x59e3('0x43')](function(_0x227953){if(_0x227953){_0x1831b4=_0x227953[_0x59e3('0x37')];if(!_0x21e824[_0x59e3('0x32')]['hasOwnProperty'](_0x59e3('0x39'))){_0x45d3c8[_0x59e3('0x1d')]=qs[_0x59e3('0x1d')](_0x21e824[_0x59e3('0x32')]['limit']);_0x45d3c8['offset']=qs[_0x59e3('0x1c')](_0x21e824['query']['offset']);}return _0x25b910[_0x59e3('0x4e')](_0x45d3c8);}})[_0x59e3('0x43')](function(_0x29b53b){if(_0x29b53b){return _0x29b53b?{'count':_0x1831b4,'rows':_0x29b53b}:null;}})[_0x59e3('0x43')](respondWithResult(_0x14cfa8,null))[_0x59e3('0x45')](handleError(_0x14cfa8,null));};exports[_0x59e3('0x4f')]=function(_0x2e2ecd,_0x7e72fe,_0x368add){if(_0x2e2ecd[_0x59e3('0x4c')]['id']){delete _0x2e2ecd[_0x59e3('0x4c')]['id'];}return db[_0x59e3('0x2a')][_0x59e3('0x50')]({'where':{'id':_0x2e2ecd[_0x59e3('0x47')]['id']}})['then'](handleEntityNotFound(_0x7e72fe,null))[_0x59e3('0x43')](function(_0x27a87c){if(_0x27a87c){_0x2e2ecd['body'][_0x59e3('0x51')]=_0x27a87c['id'];_0x2e2ecd['body']['Subjects']=integrations[_0x59e3('0x52')](_0x2e2ecd['body'][_0x59e3('0x53')],_0x2e2ecd[_0x59e3('0x4c')][_0x59e3('0x2d')]);_0x2e2ecd[_0x59e3('0x4c')][_0x59e3('0x54')]=integrations['getDescriptions'](_0x2e2ecd[_0x59e3('0x4c')][_0x59e3('0x53')],_0x2e2ecd[_0x59e3('0x4c')][_0x59e3('0x2d')]);return db[_0x59e3('0x4d')][_0x59e3('0x4b')](_0x2e2ecd[_0x59e3('0x4c')],{'include':[{'model':db['FreshsalesField'],'as':_0x59e3('0x55')},{'model':db[_0x59e3('0x56')],'as':_0x59e3('0x54')}]});}return null;})[_0x59e3('0x43')](respondWithResult(_0x7e72fe,null))[_0x59e3('0x45')](handleError(_0x7e72fe,null));};exports[_0x59e3('0x57')]=function(_0x4347c0,_0x22bc3b,_0x230c4f){var _0x46e88f='';var _0x19603d='';return db[_0x59e3('0x2a')]['findOne']({'where':{'id':_0x4347c0[_0x59e3('0x47')]['id']},'attributes':['id',_0x59e3('0x58'),_0x59e3('0x59'),_0x59e3('0x5a')]})[_0x59e3('0x43')](handleEntityNotFound(_0x22bc3b,null))['then'](function(_0x1bd7c8){if(_0x1bd7c8){_0x19603d=_0x1bd7c8['username'];_0x46e88f=_0x1bd7c8[_0x59e3('0x59')];var _0x206976=_0x1bd7c8[_0x59e3('0x59')]['slice'](-0x1);if(_0x206976==='/'){_0x46e88f=_0x46e88f[_0x59e3('0x5b')](0x0,_0x46e88f['lastIndexOf'](_0x206976));}return rp({'method':_0x59e3('0x5c'),'uri':util[_0x59e3('0x5d')](_0x59e3('0x5e'),_0x46e88f,_0x59e3('0x5f')),'headers':{'Authorization':_0x59e3('0x60')+_0x1bd7c8['apiKey']},'json':!![]});}})[_0x59e3('0x43')](function(_0x321f94){if(_0x321f94){var _0x292bc5=_0x321f94['users'];var _0x2bbdff=![];var _0x154c27=null;for(_0x154c27=0x0;_0x154c27<_0x292bc5[_0x59e3('0x37')];_0x154c27++){if(_0x292bc5[_0x154c27][_0x59e3('0x61')]===_0x19603d){_0x2bbdff=!![];}}if(_0x2bbdff){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x59e3('0x43')](respondWithResult(_0x22bc3b,null))[_0x59e3('0x45')](function(_0x4ef19e){var _0x253ecc=_0x4347c0[_0x59e3('0x32')]['test']?0x1f4:_0x4ef19e[_0x59e3('0x62')]||0x1f4;logger[_0x59e3('0x63')](_0x59e3('0x64'),'getFields',_0x253ecc,JSON[_0x59e3('0x65')](_0x4ef19e));delete _0x4ef19e[_0x59e3('0x27')];if(_0x253ecc===0x191){_0x253ecc=0x190;}_0x22bc3b['status'](_0x253ecc)['send'](_0x4347c0[_0x59e3('0x32')][_0x59e3('0x66')]?{'message':_0x59e3('0x67'),'statusCode':_0x4ef19e[_0x59e3('0x62')]}:_0x4ef19e);});}; \ No newline at end of file +var _0x12c2=['test','statusCode','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','count','limit','set','json','apply','then','destroy','error','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','nolimit','offset','order','where','pick','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','merge','find','create','body','update','params','getConfigurations','findOne','FreshsalesConfiguration','sort','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','apiKey','remoteUri','slice','substring','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found'];(function(_0x3f2621,_0x569366){var _0x43018c=function(_0x441a01){while(--_0x441a01){_0x3f2621['push'](_0x3f2621['shift']());}};_0x43018c(++_0x569366);}(_0x12c2,0xc7));var _0x212c=function(_0x138ad5,_0x3bb524){_0x138ad5=_0x138ad5-0x0;var _0x22a464=_0x12c2[_0x138ad5];return _0x22a464;};'use strict';var emlformat=require(_0x212c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x212c('0x1'));var jsonpatch=require(_0x212c('0x2'));var rp=require(_0x212c('0x3'));var moment=require(_0x212c('0x4'));var BPromise=require(_0x212c('0x5'));var Mustache=require(_0x212c('0x6'));var util=require(_0x212c('0x7'));var path=require('path');var sox=require(_0x212c('0x8'));var csv=require('to-csv');var ejs=require(_0x212c('0x9'));var fs=require('fs');var fs_extra=require(_0x212c('0xa'));var _=require(_0x212c('0xb'));var squel=require(_0x212c('0xc'));var crypto=require(_0x212c('0xd'));var jsforce=require(_0x212c('0xe'));var deskjs=require(_0x212c('0xf'));var toCsv=require(_0x212c('0x10'));var querystring=require(_0x212c('0x11'));var Papa=require(_0x212c('0x12'));var Redis=require(_0x212c('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x212c('0x14'));var as=require(_0x212c('0x15'));var hardwareService=require(_0x212c('0x16'));var logger=require(_0x212c('0x17'))(_0x212c('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x212c('0x19'));var db=require(_0x212c('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4385ec,_0x4bde0e){_0x4bde0e=_0x4bde0e||0xcc;return function(_0x35dd51){if(_0x35dd51){return _0x4385ec[_0x212c('0x1b')](_0x4bde0e);}return _0x4385ec[_0x212c('0x1c')](_0x4bde0e)[_0x212c('0x1d')]();};}function respondWithResult(_0x5a3874,_0x514e93){_0x514e93=_0x514e93||0xc8;return function(_0x576e78){if(_0x576e78){return _0x5a3874['status'](_0x514e93)['json'](_0x576e78);}};}function respondWithFilteredResult(_0x52439f,_0x202c69){return function(_0xc56e70){if(_0xc56e70){var _0x4fc369=typeof _0x202c69['offset']==='undefined'&&typeof _0x202c69['limit']==='undefined';var _0x10bea2=_0xc56e70[_0x212c('0x1e')];var _0x421249=_0x4fc369?0x0:_0x202c69['offset'];var _0x177596=_0x4fc369?_0xc56e70[_0x212c('0x1e')]:_0x202c69['offset']+_0x202c69[_0x212c('0x1f')];var _0x47de3d;if(_0x177596>=_0x10bea2){_0x177596=_0x10bea2;_0x47de3d=0xc8;}else{_0x47de3d=0xce;}_0x52439f[_0x212c('0x1c')](_0x47de3d);return _0x52439f[_0x212c('0x20')]('Content-Range',_0x421249+'-'+_0x177596+'/'+_0x10bea2)[_0x212c('0x21')](_0xc56e70);}return null;};}function patchUpdates(_0x13af30){return function(_0x56fd3c){try{jsonpatch[_0x212c('0x22')](_0x56fd3c,_0x13af30,!![]);}catch(_0x32fe7c){return BPromise['reject'](_0x32fe7c);}return _0x56fd3c['save']();};}function saveUpdates(_0x163278,_0x3def08){return function(_0x1704a9){if(_0x1704a9){return _0x1704a9['update'](_0x163278)[_0x212c('0x23')](function(_0x20a396){return _0x20a396;});}return null;};}function removeEntity(_0x3bbc42,_0x4ddcd8){return function(_0x5efebd){if(_0x5efebd){return _0x5efebd[_0x212c('0x24')]()[_0x212c('0x23')](function(){_0x3bbc42['status'](0xcc)[_0x212c('0x1d')]();});}};}function handleEntityNotFound(_0x5bf964,_0x3ba462){return function(_0x45d7a3){if(!_0x45d7a3){_0x5bf964[_0x212c('0x1b')](0x194);}return _0x45d7a3;};}function handleError(_0xc7c7ea,_0x22817b){_0x22817b=_0x22817b||0x1f4;return function(_0x40159f){logger[_0x212c('0x25')](_0x40159f[_0x212c('0x26')]);if(_0x40159f[_0x212c('0x27')]){delete _0x40159f[_0x212c('0x27')];}_0xc7c7ea[_0x212c('0x1c')](_0x22817b)[_0x212c('0x28')](_0x40159f);};}exports[_0x212c('0x29')]=function(_0x3d80e9,_0x14dd87){var _0x5dbbdb={},_0x10c25e={},_0x4bc01c={'count':0x0,'rows':[]};var _0x18dd86=_[_0x212c('0x2a')](db[_0x212c('0x2b')][_0x212c('0x2c')],function(_0x3afdc2){return{'name':_0x3afdc2[_0x212c('0x2d')],'type':_0x3afdc2['type']['key']};});_0x10c25e[_0x212c('0x2e')]=_[_0x212c('0x2a')](_0x18dd86,_0x212c('0x27'));_0x10c25e['query']=_[_0x212c('0x2f')](_0x3d80e9[_0x212c('0x30')]);_0x10c25e[_0x212c('0x31')]=_[_0x212c('0x32')](_0x10c25e[_0x212c('0x2e')],_0x10c25e['query']);_0x5dbbdb['attributes']=_[_0x212c('0x32')](_0x10c25e[_0x212c('0x2e')],qs['fields'](_0x3d80e9[_0x212c('0x30')][_0x212c('0x33')]));_0x5dbbdb[_0x212c('0x34')]=_0x5dbbdb[_0x212c('0x34')][_0x212c('0x35')]?_0x5dbbdb[_0x212c('0x34')]:_0x10c25e[_0x212c('0x2e')];if(!_0x3d80e9[_0x212c('0x30')]['hasOwnProperty'](_0x212c('0x36'))){_0x5dbbdb[_0x212c('0x1f')]=qs[_0x212c('0x1f')](_0x3d80e9[_0x212c('0x30')][_0x212c('0x1f')]);_0x5dbbdb[_0x212c('0x37')]=qs[_0x212c('0x37')](_0x3d80e9[_0x212c('0x30')][_0x212c('0x37')]);}_0x5dbbdb[_0x212c('0x38')]=qs['sort'](_0x3d80e9[_0x212c('0x30')]['sort']);_0x5dbbdb[_0x212c('0x39')]=qs['filters'](_[_0x212c('0x3a')](_0x3d80e9['query'],_0x10c25e['filters']),_0x18dd86);if(_0x3d80e9[_0x212c('0x30')]['filter']){_0x5dbbdb[_0x212c('0x39')]=_['merge'](_0x5dbbdb['where'],{'$or':_[_0x212c('0x2a')](_0x18dd86,function(_0x418240){if(_0x418240[_0x212c('0x3b')]!==_0x212c('0x3c')){var _0x263546={};_0x263546[_0x418240[_0x212c('0x27')]]={'$like':'%'+_0x3d80e9['query'][_0x212c('0x3d')]+'%'};return _0x263546;}})});}_0x5dbbdb=_['merge']({},_0x5dbbdb,_0x3d80e9[_0x212c('0x3e')]);var _0x448e39={'where':_0x5dbbdb['where']};return db[_0x212c('0x2b')][_0x212c('0x1e')](_0x448e39)[_0x212c('0x23')](function(_0x2f5ed9){_0x4bc01c['count']=_0x2f5ed9;if(_0x3d80e9[_0x212c('0x30')][_0x212c('0x3f')]){_0x5dbbdb[_0x212c('0x40')]=[{'all':!![]}];}return db[_0x212c('0x2b')][_0x212c('0x41')](_0x5dbbdb);})[_0x212c('0x23')](function(_0x29bf02){_0x4bc01c[_0x212c('0x42')]=_0x29bf02;return _0x4bc01c;})[_0x212c('0x23')](respondWithFilteredResult(_0x14dd87,_0x5dbbdb))[_0x212c('0x43')](handleError(_0x14dd87,null));};exports['show']=function(_0x1a002a,_0x1b9c14){var _0x1a94f2={'raw':![],'where':{'id':_0x1a002a['params']['id']}},_0x57071e={};_0x57071e[_0x212c('0x2e')]=_['keys'](db[_0x212c('0x2b')][_0x212c('0x2c')]);_0x57071e[_0x212c('0x30')]=_[_0x212c('0x2f')](_0x1a002a[_0x212c('0x30')]);_0x57071e[_0x212c('0x31')]=_['intersection'](_0x57071e[_0x212c('0x2e')],_0x57071e['query']);_0x1a94f2['attributes']=_['intersection'](_0x57071e[_0x212c('0x2e')],qs[_0x212c('0x33')](_0x1a002a['query'][_0x212c('0x33')]));_0x1a94f2['attributes']=_0x1a94f2['attributes']['length']?_0x1a94f2['attributes']:_0x57071e[_0x212c('0x2e')];if(_0x1a002a[_0x212c('0x30')][_0x212c('0x3f')]){_0x1a94f2[_0x212c('0x40')]=[{'all':!![]}];}_0x1a94f2=_[_0x212c('0x44')]({},_0x1a94f2,_0x1a002a[_0x212c('0x3e')]);return db['FreshsalesAccount'][_0x212c('0x45')](_0x1a94f2)[_0x212c('0x23')](handleEntityNotFound(_0x1b9c14,null))[_0x212c('0x23')](respondWithResult(_0x1b9c14,null))[_0x212c('0x43')](handleError(_0x1b9c14,null));};exports['create']=function(_0x5ab0be,_0x2ab44c){return db[_0x212c('0x2b')][_0x212c('0x46')](_0x5ab0be[_0x212c('0x47')],{})[_0x212c('0x23')](respondWithResult(_0x2ab44c,0xc9))['catch'](handleError(_0x2ab44c,null));};exports[_0x212c('0x48')]=function(_0x8b5bd1,_0x554c7){if(_0x8b5bd1['body']['id']){delete _0x8b5bd1[_0x212c('0x47')]['id'];}return db[_0x212c('0x2b')][_0x212c('0x45')]({'where':{'id':_0x8b5bd1[_0x212c('0x49')]['id']}})['then'](handleEntityNotFound(_0x554c7,null))['then'](saveUpdates(_0x8b5bd1[_0x212c('0x47')],null))['then'](respondWithResult(_0x554c7,null))['catch'](handleError(_0x554c7,null));};exports[_0x212c('0x24')]=function(_0xed7565,_0xc8f839){return db[_0x212c('0x2b')]['find']({'where':{'id':_0xed7565[_0x212c('0x49')]['id']}})[_0x212c('0x23')](handleEntityNotFound(_0xc8f839,null))[_0x212c('0x23')](removeEntity(_0xc8f839,null))[_0x212c('0x43')](handleError(_0xc8f839,null));};exports[_0x212c('0x4a')]=function(_0x5d89af,_0x161bd6,_0x5204a8){var _0x299e7f={};var _0x3754a8={};var _0x23e0d4;var _0x47f91d;return db[_0x212c('0x2b')][_0x212c('0x4b')]({'where':{'id':_0x5d89af['params']['id']}})['then'](handleEntityNotFound(_0x161bd6,null))[_0x212c('0x23')](function(_0x5437fe){if(_0x5437fe){_0x23e0d4=_0x5437fe;_0x3754a8['model']=_[_0x212c('0x2f')](db[_0x212c('0x4c')][_0x212c('0x2c')]);_0x3754a8[_0x212c('0x30')]=_[_0x212c('0x2f')](_0x5d89af['query']);_0x3754a8['filters']=_['intersection'](_0x3754a8[_0x212c('0x2e')],_0x3754a8[_0x212c('0x30')]);_0x299e7f[_0x212c('0x34')]=_['intersection'](_0x3754a8[_0x212c('0x2e')],qs[_0x212c('0x33')](_0x5d89af['query']['fields']));_0x299e7f[_0x212c('0x34')]=_0x299e7f[_0x212c('0x34')]['length']?_0x299e7f['attributes']:_0x3754a8[_0x212c('0x2e')];_0x299e7f[_0x212c('0x38')]=qs[_0x212c('0x4d')](_0x5d89af['query'][_0x212c('0x4d')]);_0x299e7f[_0x212c('0x39')]=qs[_0x212c('0x31')](_['pick'](_0x5d89af[_0x212c('0x30')],_0x3754a8[_0x212c('0x31')]));if(_0x5d89af[_0x212c('0x30')][_0x212c('0x3d')]){_0x299e7f[_0x212c('0x39')]=_[_0x212c('0x44')](_0x299e7f['where'],{'$or':_[_0x212c('0x2a')](_0x299e7f[_0x212c('0x34')],function(_0x179b96){var _0x1c4288={};_0x1c4288[_0x179b96]={'$like':'%'+_0x5d89af[_0x212c('0x30')][_0x212c('0x3d')]+'%'};return _0x1c4288;})});}_0x299e7f=_[_0x212c('0x44')]({},_0x299e7f,_0x5d89af[_0x212c('0x3e')]);return _0x23e0d4[_0x212c('0x4a')](_0x299e7f);}})[_0x212c('0x23')](function(_0x647baa){if(_0x647baa){_0x47f91d=_0x647baa[_0x212c('0x35')];if(!_0x5d89af[_0x212c('0x30')]['hasOwnProperty'](_0x212c('0x36'))){_0x299e7f[_0x212c('0x1f')]=qs['limit'](_0x5d89af[_0x212c('0x30')][_0x212c('0x1f')]);_0x299e7f[_0x212c('0x37')]=qs[_0x212c('0x37')](_0x5d89af[_0x212c('0x30')][_0x212c('0x37')]);}return _0x23e0d4[_0x212c('0x4a')](_0x299e7f);}})[_0x212c('0x23')](function(_0x3ff15e){if(_0x3ff15e){return _0x3ff15e?{'count':_0x47f91d,'rows':_0x3ff15e}:null;}})['then'](respondWithResult(_0x161bd6,null))['catch'](handleError(_0x161bd6,null));};exports[_0x212c('0x4e')]=function(_0x5651a0,_0x525bdd,_0xa6b430){if(_0x5651a0[_0x212c('0x47')]['id']){delete _0x5651a0[_0x212c('0x47')]['id'];}return db[_0x212c('0x2b')][_0x212c('0x4b')]({'where':{'id':_0x5651a0['params']['id']}})[_0x212c('0x23')](handleEntityNotFound(_0x525bdd,null))[_0x212c('0x23')](function(_0xcabf3e){if(_0xcabf3e){_0x5651a0[_0x212c('0x47')]['AccountId']=_0xcabf3e['id'];_0x5651a0[_0x212c('0x47')][_0x212c('0x4f')]=integrations[_0x212c('0x50')](_0x5651a0[_0x212c('0x47')][_0x212c('0x51')],_0x5651a0[_0x212c('0x47')][_0x212c('0x3b')]);_0x5651a0['body'][_0x212c('0x52')]=integrations[_0x212c('0x53')](_0x5651a0[_0x212c('0x47')][_0x212c('0x51')],_0x5651a0[_0x212c('0x47')]['type']);return db[_0x212c('0x4c')][_0x212c('0x46')](_0x5651a0['body'],{'include':[{'model':db[_0x212c('0x54')],'as':'Subjects'},{'model':db[_0x212c('0x54')],'as':'Descriptions'}]});}return null;})[_0x212c('0x23')](respondWithResult(_0x525bdd,null))[_0x212c('0x43')](handleError(_0x525bdd,null));};exports[_0x212c('0x55')]=function(_0x247853,_0x1c2540,_0x3f27c0){var _0x42831c='';var _0x50536d='';return db[_0x212c('0x2b')][_0x212c('0x4b')]({'where':{'id':_0x247853[_0x212c('0x49')]['id']},'attributes':['id',_0x212c('0x56'),'remoteUri',_0x212c('0x57')]})[_0x212c('0x23')](handleEntityNotFound(_0x1c2540,null))[_0x212c('0x23')](function(_0x410edc){if(_0x410edc){_0x50536d=_0x410edc['username'];_0x42831c=_0x410edc[_0x212c('0x58')];var _0x41f029=_0x410edc[_0x212c('0x58')][_0x212c('0x59')](-0x1);if(_0x41f029==='/'){_0x42831c=_0x42831c[_0x212c('0x5a')](0x0,_0x42831c['lastIndexOf'](_0x41f029));}return rp({'method':'GET','uri':util['format']('%s%s',_0x42831c,'/api/selector/owners'),'headers':{'Authorization':_0x212c('0x5b')+_0x410edc[_0x212c('0x57')]},'json':!![]});}})[_0x212c('0x23')](function(_0x53e9d1){if(_0x53e9d1){var _0x332263=_0x53e9d1[_0x212c('0x5c')];var _0x25d505=![];var _0x1571e9=null;for(_0x1571e9=0x0;_0x1571e9<_0x332263[_0x212c('0x35')];_0x1571e9++){if(_0x332263[_0x1571e9][_0x212c('0x5d')]===_0x50536d){_0x25d505=!![];}}if(_0x25d505){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x212c('0x5e')});}}})[_0x212c('0x23')](respondWithResult(_0x1c2540,null))['catch'](function(_0x4c9458){var _0x1f29e5=_0x247853[_0x212c('0x30')][_0x212c('0x5f')]?0x1f4:_0x4c9458[_0x212c('0x60')]||0x1f4;logger[_0x212c('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0x212c('0x55'),_0x1f29e5,JSON['stringify'](_0x4c9458));delete _0x4c9458[_0x212c('0x27')];if(_0x1f29e5===0x191){_0x1f29e5=0x190;}_0x1c2540[_0x212c('0x1c')](_0x1f29e5)[_0x212c('0x28')](_0x247853[_0x212c('0x30')][_0x212c('0x5f')]?{'message':_0x212c('0x61'),'statusCode':_0x4c9458['statusCode']}:_0x4c9458);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 919145a..cbfedd0 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 _0xc4aa=['bluebird','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','lodash','util','../../config/logger','api','moment'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xc4aa[_0x11005e];return _0x29338f;};'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'));var integrations=require(_0xac4a('0x8'));module[_0xac4a('0x9')]=function(_0x96be2b,_0x15cd34){return _0x96be2b[_0xac4a('0xa')](_0xac4a('0xb'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x71ab=['path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','util','api','bluebird','request-promise'];(function(_0x481291,_0x3400e0){var _0x35dc78=function(_0x13bf87){while(--_0x13bf87){_0x481291['push'](_0x481291['shift']());}};_0x35dc78(++_0x3400e0);}(_0x71ab,0x64));var _0xb71a=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x71ab[_0x138adb];return _0x1b27f2;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var logger=require('../../config/logger')(_0xb71a('0x1'));var moment=require('moment');var BPromise=require(_0xb71a('0x2'));var rp=require(_0xb71a('0x3'));var fs=require('fs');var path=require(_0xb71a('0x4'));var rimraf=require(_0xb71a('0x5'));var config=require(_0xb71a('0x6'));var attributes=require(_0xb71a('0x7'));var integrations=require(_0xb71a('0x8'));module[_0xb71a('0x9')]=function(_0x22c072,_0x35a84e){return _0x22c072[_0xb71a('0xa')](_0xb71a('0xb'),attributes,{'tableName':_0xb71a('0xc'),'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 f99c014..5947fca 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 _0x5204=['catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','attributes','include','model','map','then','ShowFreshsalesAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5204,0xdf));var _0x4520=function(_0x5ff517,_0x3e4ee0){_0x5ff517=_0x5ff517-0x0;var _0x19a245=_0x5204[_0x5ff517];return _0x19a245;};'use strict';var _=require(_0x4520('0x0'));var util=require(_0x4520('0x1'));var moment=require('moment');var BPromise=require(_0x4520('0x2'));var rs=require(_0x4520('0x3'));var fs=require('fs');var Redis=require(_0x4520('0x4'));var db=require(_0x4520('0x5'))['db'];var utils=require(_0x4520('0x6'));var logger=require('../../config/logger')(_0x4520('0x7'));var config=require('../../config/environment');var jayson=require(_0x4520('0x8'));var client=jayson[_0x4520('0x9')][_0x4520('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe741c2,_0x396d29,_0x446dc9){return new BPromise(function(_0x27890f,_0x55b44f){return client[_0x4520('0xb')](_0xe741c2,_0x446dc9)['then'](function(_0x168e62){logger[_0x4520('0xc')](_0x4520('0xd'),_0x396d29,_0x4520('0xe'));logger[_0x4520('0xf')](_0x4520('0x10'),_0x396d29,_0x4520('0xe'),JSON[_0x4520('0x11')](_0x168e62));if(_0x168e62[_0x4520('0x12')]){if(_0x168e62[_0x4520('0x12')][_0x4520('0x13')]===0x1f4){logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);return _0x55b44f(_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);}logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);return _0x27890f(_0x168e62['error'][_0x4520('0x14')]);}else{logger[_0x4520('0xc')](_0x4520('0xd'),_0x396d29,_0x4520('0xe'));_0x27890f(_0x168e62[_0x4520('0x15')]['message']);}})[_0x4520('0x16')](function(_0x33ac29){logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x33ac29);_0x55b44f(_0x33ac29);});});}exports[_0x4520('0x17')]=function(_0x2e00f4){var _0x1dcf51=this;return new Promise(function(_0x4ba69f,_0x3791b6){return db[_0x4520('0x18')][_0x4520('0x19')]({'raw':_0x2e00f4[_0x4520('0x1a')]?_0x2e00f4['options'][_0x4520('0x1b')]===undefined?!![]:![]:!![],'where':_0x2e00f4['options']?_0x2e00f4['options']['where']||null:null,'attributes':_0x2e00f4[_0x4520('0x1a')]?_0x2e00f4['options'][_0x4520('0x1c')]||null:null,'limit':_0x2e00f4[_0x4520('0x1a')]?_0x2e00f4[_0x4520('0x1a')]['limit']||null:null,'include':_0x2e00f4[_0x4520('0x1a')]?_0x2e00f4[_0x4520('0x1a')][_0x4520('0x1d')]?_['map'](_0x2e00f4[_0x4520('0x1a')][_0x4520('0x1d')],function(_0x24eacd){return{'model':db[_0x24eacd[_0x4520('0x1e')]],'as':_0x24eacd['as'],'attributes':_0x24eacd[_0x4520('0x1c')],'include':_0x24eacd['include']?_[_0x4520('0x1f')](_0x24eacd[_0x4520('0x1d')],function(_0x3532aa){return{'model':db[_0x3532aa[_0x4520('0x1e')]],'as':_0x3532aa['as'],'attributes':_0x3532aa['attributes'],'include':_0x3532aa[_0x4520('0x1d')]?_[_0x4520('0x1f')](_0x3532aa[_0x4520('0x1d')],function(_0x21e1f3){return{'model':db[_0x21e1f3[_0x4520('0x1e')]],'as':_0x21e1f3['as'],'attributes':_0x21e1f3[_0x4520('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4520('0x20')](function(_0x195c58){logger[_0x4520('0xc')](_0x4520('0x17'),_0x2e00f4);logger['debug'](_0x4520('0x17'),_0x2e00f4,JSON['stringify'](_0x195c58));_0x4ba69f(_0x195c58);})[_0x4520('0x16')](function(_0x14778a){logger[_0x4520('0x12')](_0x4520('0x17'),_0x14778a[_0x4520('0x14')],_0x2e00f4);_0x3791b6(_0x1dcf51[_0x4520('0x12')](0x1f4,_0x14778a['message']));});});};exports[_0x4520('0x21')]=function(_0x508c05){var _0x2585eb=this;return new Promise(function(_0x4a6755,_0xf6caff){return db['FreshsalesAccount'][_0x4520('0x22')]({'raw':_0x508c05['options']?_0x508c05['options'][_0x4520('0x1b')]===undefined?!![]:![]:!![],'where':_0x508c05[_0x4520('0x1a')]?_0x508c05[_0x4520('0x1a')]['where']||null:null,'attributes':_0x508c05[_0x4520('0x1a')]?_0x508c05[_0x4520('0x1a')][_0x4520('0x1c')]||null:null,'include':_0x508c05[_0x4520('0x1a')]?_0x508c05['options']['include']?_[_0x4520('0x1f')](_0x508c05[_0x4520('0x1a')]['include'],function(_0x779e94){return{'model':db[_0x779e94[_0x4520('0x1e')]],'as':_0x779e94['as'],'attributes':_0x779e94[_0x4520('0x1c')],'include':_0x779e94[_0x4520('0x1d')]?_[_0x4520('0x1f')](_0x779e94[_0x4520('0x1d')],function(_0x550a0f){return{'model':db[_0x550a0f[_0x4520('0x1e')]],'as':_0x550a0f['as'],'attributes':_0x550a0f[_0x4520('0x1c')],'include':_0x550a0f['include']?_[_0x4520('0x1f')](_0x550a0f['include'],function(_0x8bf557){return{'model':db[_0x8bf557[_0x4520('0x1e')]],'as':_0x8bf557['as'],'attributes':_0x8bf557['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5527a6){logger[_0x4520('0xc')](_0x4520('0x21'),_0x508c05);logger[_0x4520('0xf')](_0x4520('0x21'),_0x508c05,JSON[_0x4520('0x11')](_0x5527a6));_0x4a6755(_0x5527a6);})[_0x4520('0x16')](function(_0x3bfc83){logger['error'](_0x4520('0x21'),_0x3bfc83[_0x4520('0x14')],_0x508c05);_0xf6caff(_0x2585eb[_0x4520('0x12')](0x1f4,_0x3bfc83['message']));});});}; \ No newline at end of file +var _0x4991=['where','attributes','limit','include','map','model','catch','ShowFreshsalesAccount','find','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetFreshsalesAccount','findAll','options','raw'];(function(_0x1123c0,_0x403255){var _0x1af339=function(_0x55f675){while(--_0x55f675){_0x1123c0['push'](_0x1123c0['shift']());}};_0x1af339(++_0x403255);}(_0x4991,0xf7));var _0x1499=function(_0x2e8000,_0x25b2b5){_0x2e8000=_0x2e8000-0x0;var _0x3f41bd=_0x4991[_0x2e8000];return _0x3f41bd;};'use strict';var _=require(_0x1499('0x0'));var util=require('util');var moment=require(_0x1499('0x1'));var BPromise=require('bluebird');var rs=require(_0x1499('0x2'));var fs=require('fs');var Redis=require(_0x1499('0x3'));var db=require(_0x1499('0x4'))['db'];var utils=require(_0x1499('0x5'));var logger=require(_0x1499('0x6'))(_0x1499('0x7'));var config=require(_0x1499('0x8'));var jayson=require(_0x1499('0x9'));var client=jayson['client'][_0x1499('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c3bd7,_0x1c65c3,_0x33b261){return new BPromise(function(_0x133bae,_0x380e48){return client[_0x1499('0xb')](_0x1c3bd7,_0x33b261)[_0x1499('0xc')](function(_0x48d2ca){logger[_0x1499('0xd')](_0x1499('0xe'),_0x1c65c3,'request\x20sent');logger[_0x1499('0xf')](_0x1499('0x10'),_0x1c65c3,'request\x20sent',JSON[_0x1499('0x11')](_0x48d2ca));if(_0x48d2ca[_0x1499('0x12')]){if(_0x48d2ca['error']['code']===0x1f4){logger['error'](_0x1499('0xe'),_0x1c65c3,_0x48d2ca[_0x1499('0x12')][_0x1499('0x13')]);return _0x380e48(_0x48d2ca[_0x1499('0x12')][_0x1499('0x13')]);}logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x1c65c3,_0x48d2ca[_0x1499('0x12')]['message']);return _0x133bae(_0x48d2ca[_0x1499('0x12')][_0x1499('0x13')]);}else{logger[_0x1499('0xd')](_0x1499('0xe'),_0x1c65c3,'request\x20sent');_0x133bae(_0x48d2ca[_0x1499('0x14')][_0x1499('0x13')]);}})['catch'](function(_0x25164c){logger[_0x1499('0x12')](_0x1499('0xe'),_0x1c65c3,_0x25164c);_0x380e48(_0x25164c);});});}exports[_0x1499('0x15')]=function(_0x1e45a9){var _0x27e533=this;return new Promise(function(_0x5b9859,_0x541477){return db['FreshsalesAccount'][_0x1499('0x16')]({'raw':_0x1e45a9[_0x1499('0x17')]?_0x1e45a9['options'][_0x1499('0x18')]===undefined?!![]:![]:!![],'where':_0x1e45a9[_0x1499('0x17')]?_0x1e45a9[_0x1499('0x17')][_0x1499('0x19')]||null:null,'attributes':_0x1e45a9[_0x1499('0x17')]?_0x1e45a9[_0x1499('0x17')][_0x1499('0x1a')]||null:null,'limit':_0x1e45a9[_0x1499('0x17')]?_0x1e45a9[_0x1499('0x17')][_0x1499('0x1b')]||null:null,'include':_0x1e45a9[_0x1499('0x17')]?_0x1e45a9[_0x1499('0x17')][_0x1499('0x1c')]?_[_0x1499('0x1d')](_0x1e45a9[_0x1499('0x17')][_0x1499('0x1c')],function(_0x2c7f57){return{'model':db[_0x2c7f57['model']],'as':_0x2c7f57['as'],'attributes':_0x2c7f57[_0x1499('0x1a')],'include':_0x2c7f57[_0x1499('0x1c')]?_[_0x1499('0x1d')](_0x2c7f57[_0x1499('0x1c')],function(_0x3968e0){return{'model':db[_0x3968e0[_0x1499('0x1e')]],'as':_0x3968e0['as'],'attributes':_0x3968e0['attributes'],'include':_0x3968e0['include']?_[_0x1499('0x1d')](_0x3968e0[_0x1499('0x1c')],function(_0x3b9259){return{'model':db[_0x3b9259[_0x1499('0x1e')]],'as':_0x3b9259['as'],'attributes':_0x3b9259[_0x1499('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e5ed1){logger['info']('GetFreshsalesAccount',_0x1e45a9);logger['debug'](_0x1499('0x15'),_0x1e45a9,JSON[_0x1499('0x11')](_0x3e5ed1));_0x5b9859(_0x3e5ed1);})[_0x1499('0x1f')](function(_0x1b460b){logger[_0x1499('0x12')](_0x1499('0x15'),_0x1b460b[_0x1499('0x13')],_0x1e45a9);_0x541477(_0x27e533['error'](0x1f4,_0x1b460b[_0x1499('0x13')]));});});};exports[_0x1499('0x20')]=function(_0x39995b){var _0x5b59ea=this;return new Promise(function(_0x2dae84,_0x16466c){return db['FreshsalesAccount'][_0x1499('0x21')]({'raw':_0x39995b[_0x1499('0x17')]?_0x39995b['options'][_0x1499('0x18')]===undefined?!![]:![]:!![],'where':_0x39995b[_0x1499('0x17')]?_0x39995b[_0x1499('0x17')][_0x1499('0x19')]||null:null,'attributes':_0x39995b[_0x1499('0x17')]?_0x39995b[_0x1499('0x17')][_0x1499('0x1a')]||null:null,'include':_0x39995b[_0x1499('0x17')]?_0x39995b[_0x1499('0x17')][_0x1499('0x1c')]?_[_0x1499('0x1d')](_0x39995b[_0x1499('0x17')][_0x1499('0x1c')],function(_0x3f4c1a){return{'model':db[_0x3f4c1a[_0x1499('0x1e')]],'as':_0x3f4c1a['as'],'attributes':_0x3f4c1a[_0x1499('0x1a')],'include':_0x3f4c1a[_0x1499('0x1c')]?_[_0x1499('0x1d')](_0x3f4c1a[_0x1499('0x1c')],function(_0x29e89e){return{'model':db[_0x29e89e['model']],'as':_0x29e89e['as'],'attributes':_0x29e89e[_0x1499('0x1a')],'include':_0x29e89e[_0x1499('0x1c')]?_[_0x1499('0x1d')](_0x29e89e[_0x1499('0x1c')],function(_0x31251c){return{'model':db[_0x31251c[_0x1499('0x1e')]],'as':_0x31251c['as'],'attributes':_0x31251c[_0x1499('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1499('0xc')](function(_0x12cf93){logger[_0x1499('0xd')](_0x1499('0x20'),_0x39995b);logger['debug']('ShowFreshsalesAccount',_0x39995b,JSON[_0x1499('0x11')](_0x12cf93));_0x2dae84(_0x12cf93);})['catch'](function(_0x29bb8f){logger['error'](_0x1499('0x20'),_0x29bb8f[_0x1499('0x13')],_0x39995b);_0x16466c(_0x5b59ea[_0x1499('0x12')](0x1f4,_0x29bb8f[_0x1499('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index e10f9fb..e3f3aae 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 _0xfa03=['connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','show','/:id/subjects','getDescriptions','getFields','post','create','put','/:id','delete','destroy','multer','util','path'];(function(_0x5dcfb9,_0x5703f4){var _0x440d56=function(_0x4b1261){while(--_0x4b1261){_0x5dcfb9['push'](_0x5dcfb9['shift']());}};_0x440d56(++_0x5703f4);}(_0xfa03,0x66));var _0x3fa0=function(_0x2eb7e1,_0xcb8320){_0x2eb7e1=_0x2eb7e1-0x0;var _0x467154=_0xfa03[_0x2eb7e1];return _0x467154;};'use strict';var multer=require(_0x3fa0('0x0'));var util=require(_0x3fa0('0x1'));var path=require(_0x3fa0('0x2'));var timeout=require(_0x3fa0('0x3'));var express=require(_0x3fa0('0x4'));var router=express[_0x3fa0('0x5')]();var fs_extra=require(_0x3fa0('0x6'));var auth=require(_0x3fa0('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshsalesConfiguration.controller');router[_0x3fa0('0x8')]('/',auth[_0x3fa0('0x9')](),controller[_0x3fa0('0xa')]);router[_0x3fa0('0x8')]('/:id',auth[_0x3fa0('0x9')](),controller[_0x3fa0('0xb')]);router['get'](_0x3fa0('0xc'),auth[_0x3fa0('0x9')](),controller['getSubjects']);router[_0x3fa0('0x8')]('/:id/descriptions',auth[_0x3fa0('0x9')](),controller[_0x3fa0('0xd')]);router[_0x3fa0('0x8')]('/:id/fields',auth[_0x3fa0('0x9')](),controller[_0x3fa0('0xe')]);router[_0x3fa0('0xf')]('/',auth['isAuthenticated'](),controller[_0x3fa0('0x10')]);router[_0x3fa0('0x11')](_0x3fa0('0x12'),auth[_0x3fa0('0x9')](),controller['update']);router[_0x3fa0('0x13')](_0x3fa0('0x12'),auth[_0x3fa0('0x9')](),controller[_0x3fa0('0x14')]);module['exports']=router; \ No newline at end of file +var _0xe2c1=['/:id/descriptions','getDescriptions','/:id/fields','getFields','post','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','/:id','show','getSubjects'];(function(_0x47a8e6,_0x85eb5a){var _0x1070bf=function(_0x29d3d7){while(--_0x29d3d7){_0x47a8e6['push'](_0x47a8e6['shift']());}};_0x1070bf(++_0x85eb5a);}(_0xe2c1,0x1a8));var _0x1e2c=function(_0x48d63e,_0x41af3d){_0x48d63e=_0x48d63e-0x0;var _0x5a3f4b=_0xe2c1[_0x48d63e];return _0x5a3f4b;};'use strict';var multer=require(_0x1e2c('0x0'));var util=require(_0x1e2c('0x1'));var path=require(_0x1e2c('0x2'));var timeout=require('connect-timeout');var express=require(_0x1e2c('0x3'));var router=express[_0x1e2c('0x4')]();var fs_extra=require(_0x1e2c('0x5'));var auth=require(_0x1e2c('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1e2c('0x7'));router[_0x1e2c('0x8')]('/',auth[_0x1e2c('0x9')](),controller['index']);router[_0x1e2c('0x8')](_0x1e2c('0xa'),auth[_0x1e2c('0x9')](),controller[_0x1e2c('0xb')]);router[_0x1e2c('0x8')]('/:id/subjects',auth[_0x1e2c('0x9')](),controller[_0x1e2c('0xc')]);router[_0x1e2c('0x8')](_0x1e2c('0xd'),auth[_0x1e2c('0x9')](),controller[_0x1e2c('0xe')]);router['get'](_0x1e2c('0xf'),auth[_0x1e2c('0x9')](),controller[_0x1e2c('0x10')]);router[_0x1e2c('0x11')]('/',auth[_0x1e2c('0x9')](),controller['create']);router[_0x1e2c('0x12')](_0x1e2c('0xa'),auth[_0x1e2c('0x9')](),controller[_0x1e2c('0x13')]);router[_0x1e2c('0x14')](_0x1e2c('0xa'),auth['isAuthenticated'](),controller[_0x1e2c('0x15')]);module[_0x1e2c('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 6361102..5b8dec4 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 _0x704e=['exports','STRING'];(function(_0x538199,_0x535d01){var _0x530334=function(_0x5cf052){while(--_0x5cf052){_0x538199['push'](_0x538199['shift']());}};_0x530334(++_0x535d01);}(_0x704e,0xa0));var _0xe704=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x704e[_0x465a0c];return _0x1e202e;};'use strict';var Sequelize=require('sequelize');module[_0xe704('0x0')]={'name':{'type':Sequelize[_0xe704('0x1')]},'description':{'type':Sequelize[_0xe704('0x1')]}}; \ No newline at end of file +var _0x525d=['exports','STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x525d,0x1e2));var _0xd525=function(_0x381fe7,_0x444931){_0x381fe7=_0x381fe7-0x0;var _0x536366=_0x525d[_0x381fe7];return _0x536366;};'use strict';var Sequelize=require(_0xd525('0x0'));module[_0xd525('0x1')]={'name':{'type':Sequelize[_0xd525('0x2')]},'description':{'type':Sequelize[_0xd525('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 3ceb199..319be93 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 _0xa992=['fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','includeAll','rows','catch','show','params','length','find','create','body','getSubjects','findOne','pick','nolimit','getDescriptions','FreshsalesField','getFields','eml-format','request-promise','moment','mustache','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','index','map','FreshsalesConfiguration','rawAttributes'];(function(_0x38d54a,_0x22191c){var _0xf95688=function(_0x45bb7e){while(--_0x45bb7e){_0x38d54a['push'](_0x38d54a['shift']());}};_0xf95688(++_0x22191c);}(_0xa992,0xc4));var _0x2a99=function(_0x7a6f6b,_0x368aaa){_0x7a6f6b=_0x7a6f6b-0x0;var _0x159c52=_0xa992[_0x7a6f6b];return _0x159c52;};'use strict';var emlformat=require(_0x2a99('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2a99('0x1'));var moment=require(_0x2a99('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x2a99('0x3'));var util=require('util');var path=require(_0x2a99('0x4'));var sox=require('sox');var csv=require(_0x2a99('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2a99('0x6'));var _=require(_0x2a99('0x7'));var squel=require(_0x2a99('0x8'));var crypto=require(_0x2a99('0x9'));var jsforce=require(_0x2a99('0xa'));var deskjs=require(_0x2a99('0xb'));var toCsv=require(_0x2a99('0x5'));var querystring=require(_0x2a99('0xc'));var Papa=require(_0x2a99('0xd'));var Redis=require(_0x2a99('0xe'));var authService=require(_0x2a99('0xf'));var qs=require(_0x2a99('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2a99('0x11'));var logger=require(_0x2a99('0x12'))(_0x2a99('0x13'));var utils=require(_0x2a99('0x14'));var config=require(_0x2a99('0x15'));var licenseUtil=require(_0x2a99('0x16'));var db=require(_0x2a99('0x17'))['db'];function respondWithStatusCode(_0x59b81b,_0x1d5c6c){_0x1d5c6c=_0x1d5c6c||0xcc;return function(_0x2f0913){if(_0x2f0913){return _0x59b81b[_0x2a99('0x18')](_0x1d5c6c);}return _0x59b81b[_0x2a99('0x19')](_0x1d5c6c)['end']();};}function respondWithResult(_0x4fe5df,_0xda7a49){_0xda7a49=_0xda7a49||0xc8;return function(_0x317603){if(_0x317603){return _0x4fe5df[_0x2a99('0x19')](_0xda7a49)[_0x2a99('0x1a')](_0x317603);}};}function respondWithFilteredResult(_0x557801,_0x5653c8){return function(_0x1a0e02){if(_0x1a0e02){var _0x5b3024=typeof _0x5653c8[_0x2a99('0x1b')]===_0x2a99('0x1c')&&typeof _0x5653c8[_0x2a99('0x1d')]===_0x2a99('0x1c');var _0x2f2821=_0x1a0e02[_0x2a99('0x1e')];var _0x3a7c14=_0x5b3024?0x0:_0x5653c8[_0x2a99('0x1b')];var _0xf88a7c=_0x5b3024?_0x1a0e02[_0x2a99('0x1e')]:_0x5653c8[_0x2a99('0x1b')]+_0x5653c8['limit'];var _0xa2c95b;if(_0xf88a7c>=_0x2f2821){_0xf88a7c=_0x2f2821;_0xa2c95b=0xc8;}else{_0xa2c95b=0xce;}_0x557801['status'](_0xa2c95b);return _0x557801[_0x2a99('0x1f')](_0x2a99('0x20'),_0x3a7c14+'-'+_0xf88a7c+'/'+_0x2f2821)[_0x2a99('0x1a')](_0x1a0e02);}return null;};}function patchUpdates(_0x5aeb93){return function(_0x45eef8){try{jsonpatch[_0x2a99('0x21')](_0x45eef8,_0x5aeb93,!![]);}catch(_0x4fab61){return BPromise[_0x2a99('0x22')](_0x4fab61);}return _0x45eef8[_0x2a99('0x23')]();};}function saveUpdates(_0x209e48,_0x5f551d){return function(_0x398faa){if(_0x398faa){return _0x398faa[_0x2a99('0x24')](_0x209e48)['then'](function(_0x3e0629){return _0x3e0629;});}return null;};}function removeEntity(_0x2cc7aa,_0x3b2f02){return function(_0x5d1476){if(_0x5d1476){return _0x5d1476[_0x2a99('0x25')]()[_0x2a99('0x26')](function(){_0x2cc7aa[_0x2a99('0x19')](0xcc)[_0x2a99('0x27')]();});}};}function handleEntityNotFound(_0x4aae4e,_0x2ff8b1){return function(_0x220d5e){if(!_0x220d5e){_0x4aae4e[_0x2a99('0x18')](0x194);}return _0x220d5e;};}function handleError(_0x31ec40,_0x3366e4){_0x3366e4=_0x3366e4||0x1f4;return function(_0x478344){logger[_0x2a99('0x28')](_0x478344[_0x2a99('0x29')]);if(_0x478344['name']){delete _0x478344[_0x2a99('0x2a')];}_0x31ec40[_0x2a99('0x19')](_0x3366e4)['send'](_0x478344);};}exports[_0x2a99('0x2b')]=function(_0x2043c4,_0x17056b){var _0x5a3333={},_0x5c607d={},_0x5d318f={'count':0x0,'rows':[]};var _0x14f536=_[_0x2a99('0x2c')](db[_0x2a99('0x2d')][_0x2a99('0x2e')],function(_0x3e8ad4){return{'name':_0x3e8ad4[_0x2a99('0x2f')],'type':_0x3e8ad4[_0x2a99('0x30')][_0x2a99('0x31')]};});_0x5c607d[_0x2a99('0x32')]=_[_0x2a99('0x2c')](_0x14f536,_0x2a99('0x2a'));_0x5c607d[_0x2a99('0x33')]=_[_0x2a99('0x34')](_0x2043c4[_0x2a99('0x33')]);_0x5c607d[_0x2a99('0x35')]=_[_0x2a99('0x36')](_0x5c607d['model'],_0x5c607d[_0x2a99('0x33')]);_0x5a3333[_0x2a99('0x37')]=_['intersection'](_0x5c607d[_0x2a99('0x32')],qs[_0x2a99('0x38')](_0x2043c4[_0x2a99('0x33')][_0x2a99('0x38')]));_0x5a3333[_0x2a99('0x37')]=_0x5a3333[_0x2a99('0x37')]['length']?_0x5a3333['attributes']:_0x5c607d[_0x2a99('0x32')];if(!_0x2043c4[_0x2a99('0x33')][_0x2a99('0x39')]('nolimit')){_0x5a3333[_0x2a99('0x1d')]=qs[_0x2a99('0x1d')](_0x2043c4[_0x2a99('0x33')][_0x2a99('0x1d')]);_0x5a3333['offset']=qs[_0x2a99('0x1b')](_0x2043c4[_0x2a99('0x33')][_0x2a99('0x1b')]);}_0x5a3333[_0x2a99('0x3a')]=qs['sort'](_0x2043c4[_0x2a99('0x33')][_0x2a99('0x3b')]);_0x5a3333[_0x2a99('0x3c')]=qs[_0x2a99('0x35')](_['pick'](_0x2043c4[_0x2a99('0x33')],_0x5c607d['filters']),_0x14f536);if(_0x2043c4[_0x2a99('0x33')][_0x2a99('0x3d')]){_0x5a3333[_0x2a99('0x3c')]=_['merge'](_0x5a3333[_0x2a99('0x3c')],{'$or':_[_0x2a99('0x2c')](_0x14f536,function(_0x381725){if(_0x381725[_0x2a99('0x30')]!==_0x2a99('0x3e')){var _0x22793b={};_0x22793b[_0x381725[_0x2a99('0x2a')]]={'$like':'%'+_0x2043c4[_0x2a99('0x33')][_0x2a99('0x3d')]+'%'};return _0x22793b;}})});}_0x5a3333=_[_0x2a99('0x3f')]({},_0x5a3333,_0x2043c4[_0x2a99('0x40')]);var _0x401acb={'where':_0x5a3333[_0x2a99('0x3c')]};return db[_0x2a99('0x2d')]['count'](_0x401acb)['then'](function(_0x4b1fd1){_0x5d318f[_0x2a99('0x1e')]=_0x4b1fd1;if(_0x2043c4['query'][_0x2a99('0x41')]){_0x5a3333['include']=[{'all':!![]}];}return db[_0x2a99('0x2d')]['findAll'](_0x5a3333);})['then'](function(_0x5e1b51){_0x5d318f[_0x2a99('0x42')]=_0x5e1b51;return _0x5d318f;})[_0x2a99('0x26')](respondWithFilteredResult(_0x17056b,_0x5a3333))[_0x2a99('0x43')](handleError(_0x17056b,null));};exports[_0x2a99('0x44')]=function(_0x4726b0,_0x1b0ac9){var _0x4e4e3a={'raw':![],'where':{'id':_0x4726b0[_0x2a99('0x45')]['id']}},_0x59bca3={};_0x59bca3['model']=_[_0x2a99('0x34')](db['FreshsalesConfiguration'][_0x2a99('0x2e')]);_0x59bca3[_0x2a99('0x33')]=_['keys'](_0x4726b0[_0x2a99('0x33')]);_0x59bca3[_0x2a99('0x35')]=_[_0x2a99('0x36')](_0x59bca3[_0x2a99('0x32')],_0x59bca3['query']);_0x4e4e3a[_0x2a99('0x37')]=_[_0x2a99('0x36')](_0x59bca3['model'],qs['fields'](_0x4726b0[_0x2a99('0x33')][_0x2a99('0x38')]));_0x4e4e3a['attributes']=_0x4e4e3a[_0x2a99('0x37')][_0x2a99('0x46')]?_0x4e4e3a['attributes']:_0x59bca3[_0x2a99('0x32')];if(_0x4726b0['query'][_0x2a99('0x41')]){_0x4e4e3a['include']=[{'all':!![]}];}_0x4e4e3a=_[_0x2a99('0x3f')]({},_0x4e4e3a,_0x4726b0[_0x2a99('0x40')]);return db['FreshsalesConfiguration'][_0x2a99('0x47')](_0x4e4e3a)[_0x2a99('0x26')](handleEntityNotFound(_0x1b0ac9,null))[_0x2a99('0x26')](respondWithResult(_0x1b0ac9,null))[_0x2a99('0x43')](handleError(_0x1b0ac9,null));};exports[_0x2a99('0x48')]=function(_0x1754c3,_0x2eb5b0){return db['FreshsalesConfiguration'][_0x2a99('0x48')](_0x1754c3[_0x2a99('0x49')],{})[_0x2a99('0x26')](respondWithResult(_0x2eb5b0,0xc9))[_0x2a99('0x43')](handleError(_0x2eb5b0,null));};exports[_0x2a99('0x24')]=function(_0x3fe122,_0x58e31a){if(_0x3fe122[_0x2a99('0x49')]['id']){delete _0x3fe122[_0x2a99('0x49')]['id'];}return db[_0x2a99('0x2d')][_0x2a99('0x47')]({'where':{'id':_0x3fe122[_0x2a99('0x45')]['id']}})[_0x2a99('0x26')](handleEntityNotFound(_0x58e31a,null))[_0x2a99('0x26')](saveUpdates(_0x3fe122[_0x2a99('0x49')],null))[_0x2a99('0x26')](respondWithResult(_0x58e31a,null))[_0x2a99('0x43')](handleError(_0x58e31a,null));};exports[_0x2a99('0x25')]=function(_0x198a58,_0xfe5737){return db['FreshsalesConfiguration'][_0x2a99('0x47')]({'where':{'id':_0x198a58[_0x2a99('0x45')]['id']}})['then'](handleEntityNotFound(_0xfe5737,null))[_0x2a99('0x26')](removeEntity(_0xfe5737,null))['catch'](handleError(_0xfe5737,null));};exports[_0x2a99('0x4a')]=function(_0x13b955,_0x46b9d9,_0x395382){var _0x38fadf={};var _0x235631={};var _0xfe839d;var _0x1f690b;return db[_0x2a99('0x2d')][_0x2a99('0x4b')]({'where':{'id':_0x13b955[_0x2a99('0x45')]['id']}})['then'](handleEntityNotFound(_0x46b9d9,null))[_0x2a99('0x26')](function(_0x28a3c7){if(_0x28a3c7){_0xfe839d=_0x28a3c7;_0x235631[_0x2a99('0x32')]=_['keys'](db['FreshsalesField'][_0x2a99('0x2e')]);_0x235631[_0x2a99('0x33')]=_[_0x2a99('0x34')](_0x13b955[_0x2a99('0x33')]);_0x235631[_0x2a99('0x35')]=_[_0x2a99('0x36')](_0x235631['model'],_0x235631[_0x2a99('0x33')]);_0x38fadf[_0x2a99('0x37')]=_['intersection'](_0x235631[_0x2a99('0x32')],qs['fields'](_0x13b955[_0x2a99('0x33')][_0x2a99('0x38')]));_0x38fadf['attributes']=_0x38fadf[_0x2a99('0x37')][_0x2a99('0x46')]?_0x38fadf[_0x2a99('0x37')]:_0x235631[_0x2a99('0x32')];_0x38fadf[_0x2a99('0x3a')]=qs['sort'](_0x13b955[_0x2a99('0x33')][_0x2a99('0x3b')]);_0x38fadf[_0x2a99('0x3c')]=qs[_0x2a99('0x35')](_[_0x2a99('0x4c')](_0x13b955[_0x2a99('0x33')],_0x235631['filters']));if(_0x13b955['query'][_0x2a99('0x3d')]){_0x38fadf[_0x2a99('0x3c')]=_['merge'](_0x38fadf['where'],{'$or':_[_0x2a99('0x2c')](_0x38fadf[_0x2a99('0x37')],function(_0x37e1c5){var _0x538420={};_0x538420[_0x37e1c5]={'$like':'%'+_0x13b955[_0x2a99('0x33')]['filter']+'%'};return _0x538420;})});}_0x38fadf=_[_0x2a99('0x3f')]({},_0x38fadf,_0x13b955['options']);return _0xfe839d[_0x2a99('0x4a')](_0x38fadf);}})['then'](function(_0x22a09f){if(_0x22a09f){_0x1f690b=_0x22a09f['length'];if(!_0x13b955[_0x2a99('0x33')][_0x2a99('0x39')](_0x2a99('0x4d'))){_0x38fadf[_0x2a99('0x1d')]=qs[_0x2a99('0x1d')](_0x13b955[_0x2a99('0x33')][_0x2a99('0x1d')]);_0x38fadf[_0x2a99('0x1b')]=qs[_0x2a99('0x1b')](_0x13b955[_0x2a99('0x33')][_0x2a99('0x1b')]);}return _0xfe839d['getSubjects'](_0x38fadf);}})['then'](function(_0x1b82ab){if(_0x1b82ab){return _0x1b82ab?{'count':_0x1f690b,'rows':_0x1b82ab}:null;}})[_0x2a99('0x26')](respondWithResult(_0x46b9d9,null))['catch'](handleError(_0x46b9d9,null));};exports[_0x2a99('0x4e')]=function(_0x344b7b,_0x3797f6,_0x780311){var _0x428916={};var _0x145fa1={};var _0x42e5f9;var _0x1c5c7a;return db[_0x2a99('0x2d')][_0x2a99('0x4b')]({'where':{'id':_0x344b7b[_0x2a99('0x45')]['id']}})['then'](handleEntityNotFound(_0x3797f6,null))[_0x2a99('0x26')](function(_0x388ed8){if(_0x388ed8){_0x42e5f9=_0x388ed8;_0x145fa1[_0x2a99('0x32')]=_[_0x2a99('0x34')](db[_0x2a99('0x4f')][_0x2a99('0x2e')]);_0x145fa1[_0x2a99('0x33')]=_['keys'](_0x344b7b['query']);_0x145fa1[_0x2a99('0x35')]=_[_0x2a99('0x36')](_0x145fa1[_0x2a99('0x32')],_0x145fa1[_0x2a99('0x33')]);_0x428916[_0x2a99('0x37')]=_[_0x2a99('0x36')](_0x145fa1[_0x2a99('0x32')],qs['fields'](_0x344b7b[_0x2a99('0x33')][_0x2a99('0x38')]));_0x428916[_0x2a99('0x37')]=_0x428916[_0x2a99('0x37')]['length']?_0x428916['attributes']:_0x145fa1[_0x2a99('0x32')];_0x428916['order']=qs[_0x2a99('0x3b')](_0x344b7b[_0x2a99('0x33')][_0x2a99('0x3b')]);_0x428916[_0x2a99('0x3c')]=qs[_0x2a99('0x35')](_[_0x2a99('0x4c')](_0x344b7b['query'],_0x145fa1[_0x2a99('0x35')]));if(_0x344b7b['query'][_0x2a99('0x3d')]){_0x428916[_0x2a99('0x3c')]=_[_0x2a99('0x3f')](_0x428916[_0x2a99('0x3c')],{'$or':_[_0x2a99('0x2c')](_0x428916['attributes'],function(_0xa13528){var _0x17a1e9={};_0x17a1e9[_0xa13528]={'$like':'%'+_0x344b7b[_0x2a99('0x33')]['filter']+'%'};return _0x17a1e9;})});}_0x428916=_[_0x2a99('0x3f')]({},_0x428916,_0x344b7b[_0x2a99('0x40')]);return _0x42e5f9[_0x2a99('0x4e')](_0x428916);}})['then'](function(_0xc3790a){if(_0xc3790a){_0x1c5c7a=_0xc3790a[_0x2a99('0x46')];if(!_0x344b7b['query'][_0x2a99('0x39')](_0x2a99('0x4d'))){_0x428916[_0x2a99('0x1d')]=qs['limit'](_0x344b7b[_0x2a99('0x33')]['limit']);_0x428916['offset']=qs['offset'](_0x344b7b['query'][_0x2a99('0x1b')]);}return _0x42e5f9[_0x2a99('0x4e')](_0x428916);}})['then'](function(_0x370353){if(_0x370353){return _0x370353?{'count':_0x1c5c7a,'rows':_0x370353}:null;}})[_0x2a99('0x26')](respondWithResult(_0x3797f6,null))[_0x2a99('0x43')](handleError(_0x3797f6,null));};exports[_0x2a99('0x50')]=function(_0x22c613,_0x345fd8,_0x597144){var _0xfb0490={};var _0x494b70={};var _0x583f06;var _0x309b23;return db[_0x2a99('0x2d')][_0x2a99('0x4b')]({'where':{'id':_0x22c613[_0x2a99('0x45')]['id']}})[_0x2a99('0x26')](handleEntityNotFound(_0x345fd8,null))[_0x2a99('0x26')](function(_0x4f38a0){if(_0x4f38a0){_0x583f06=_0x4f38a0;_0x494b70[_0x2a99('0x32')]=_[_0x2a99('0x34')](db[_0x2a99('0x4f')][_0x2a99('0x2e')]);_0x494b70['query']=_[_0x2a99('0x34')](_0x22c613[_0x2a99('0x33')]);_0x494b70[_0x2a99('0x35')]=_['intersection'](_0x494b70[_0x2a99('0x32')],_0x494b70['query']);_0xfb0490['attributes']=_[_0x2a99('0x36')](_0x494b70[_0x2a99('0x32')],qs[_0x2a99('0x38')](_0x22c613['query'][_0x2a99('0x38')]));_0xfb0490[_0x2a99('0x37')]=_0xfb0490[_0x2a99('0x37')]['length']?_0xfb0490[_0x2a99('0x37')]:_0x494b70[_0x2a99('0x32')];_0xfb0490[_0x2a99('0x3a')]=qs[_0x2a99('0x3b')](_0x22c613[_0x2a99('0x33')][_0x2a99('0x3b')]);_0xfb0490[_0x2a99('0x3c')]=qs[_0x2a99('0x35')](_[_0x2a99('0x4c')](_0x22c613[_0x2a99('0x33')],_0x494b70[_0x2a99('0x35')]));if(_0x22c613['query'][_0x2a99('0x3d')]){_0xfb0490['where']=_[_0x2a99('0x3f')](_0xfb0490[_0x2a99('0x3c')],{'$or':_[_0x2a99('0x2c')](_0xfb0490[_0x2a99('0x37')],function(_0x141f52){var _0x16921c={};_0x16921c[_0x141f52]={'$like':'%'+_0x22c613[_0x2a99('0x33')][_0x2a99('0x3d')]+'%'};return _0x16921c;})});}_0xfb0490=_[_0x2a99('0x3f')]({},_0xfb0490,_0x22c613[_0x2a99('0x40')]);return _0x583f06['getFields'](_0xfb0490);}})[_0x2a99('0x26')](function(_0x8bc6c4){if(_0x8bc6c4){_0x309b23=_0x8bc6c4['length'];if(!_0x22c613[_0x2a99('0x33')][_0x2a99('0x39')](_0x2a99('0x4d'))){_0xfb0490['limit']=qs['limit'](_0x22c613[_0x2a99('0x33')]['limit']);_0xfb0490[_0x2a99('0x1b')]=qs[_0x2a99('0x1b')](_0x22c613[_0x2a99('0x33')]['offset']);}return _0x583f06['getFields'](_0xfb0490);}})['then'](function(_0x57faa6){if(_0x57faa6){return _0x57faa6?{'count':_0x309b23,'rows':_0x57faa6}:null;}})['then'](respondWithResult(_0x345fd8,null))[_0x2a99('0x43')](handleError(_0x345fd8,null));}; \ No newline at end of file +var _0x0400=['rows','catch','params','keys','find','create','body','getSubjects','getDescriptions','findOne','FreshsalesField','getFields','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','set','Content-Range','json','reject','save','update','then','destroy','end','error','name','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll'];(function(_0x4a6cf8,_0x5534ef){var _0x22205e=function(_0x3f4d0d){while(--_0x3f4d0d){_0x4a6cf8['push'](_0x4a6cf8['shift']());}};_0x22205e(++_0x5534ef);}(_0x0400,0x197));var _0x0040=function(_0x52f159,_0x419d8a){_0x52f159=_0x52f159-0x0;var _0x156799=_0x0400[_0x52f159];return _0x156799;};'use strict';var emlformat=require(_0x0040('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0040('0x1'));var jsonpatch=require(_0x0040('0x2'));var rp=require(_0x0040('0x3'));var moment=require(_0x0040('0x4'));var BPromise=require(_0x0040('0x5'));var Mustache=require(_0x0040('0x6'));var util=require('util');var path=require(_0x0040('0x7'));var sox=require(_0x0040('0x8'));var csv=require(_0x0040('0x9'));var ejs=require(_0x0040('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0040('0xb'));var squel=require('squel');var crypto=require(_0x0040('0xc'));var jsforce=require(_0x0040('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0040('0x9'));var querystring=require(_0x0040('0xe'));var Papa=require('papaparse');var Redis=require(_0x0040('0xf'));var authService=require(_0x0040('0x10'));var qs=require(_0x0040('0x11'));var as=require(_0x0040('0x12'));var hardwareService=require(_0x0040('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x0040('0x14'));var config=require(_0x0040('0x15'));var licenseUtil=require(_0x0040('0x16'));var db=require(_0x0040('0x17'))['db'];function respondWithStatusCode(_0x5ab224,_0x278701){_0x278701=_0x278701||0xcc;return function(_0x1f2aee){if(_0x1f2aee){return _0x5ab224[_0x0040('0x18')](_0x278701);}return _0x5ab224[_0x0040('0x19')](_0x278701)['end']();};}function respondWithResult(_0x2d4ed5,_0x4762db){_0x4762db=_0x4762db||0xc8;return function(_0x3c168c){if(_0x3c168c){return _0x2d4ed5[_0x0040('0x19')](_0x4762db)['json'](_0x3c168c);}};}function respondWithFilteredResult(_0x530c2a,_0x2519cf){return function(_0x4fd7c1){if(_0x4fd7c1){var _0x5962c9=typeof _0x2519cf[_0x0040('0x1a')]===_0x0040('0x1b')&&typeof _0x2519cf[_0x0040('0x1c')]==='undefined';var _0x28f5e3=_0x4fd7c1['count'];var _0x133b65=_0x5962c9?0x0:_0x2519cf[_0x0040('0x1a')];var _0x3b2ae4=_0x5962c9?_0x4fd7c1['count']:_0x2519cf[_0x0040('0x1a')]+_0x2519cf[_0x0040('0x1c')];var _0x22b3d4;if(_0x3b2ae4>=_0x28f5e3){_0x3b2ae4=_0x28f5e3;_0x22b3d4=0xc8;}else{_0x22b3d4=0xce;}_0x530c2a[_0x0040('0x19')](_0x22b3d4);return _0x530c2a[_0x0040('0x1d')](_0x0040('0x1e'),_0x133b65+'-'+_0x3b2ae4+'/'+_0x28f5e3)[_0x0040('0x1f')](_0x4fd7c1);}return null;};}function patchUpdates(_0x2d2fb6){return function(_0x2d2de8){try{jsonpatch['apply'](_0x2d2de8,_0x2d2fb6,!![]);}catch(_0x382015){return BPromise[_0x0040('0x20')](_0x382015);}return _0x2d2de8[_0x0040('0x21')]();};}function saveUpdates(_0xc93e04,_0x4ed33e){return function(_0x3cc96d){if(_0x3cc96d){return _0x3cc96d[_0x0040('0x22')](_0xc93e04)[_0x0040('0x23')](function(_0x183908){return _0x183908;});}return null;};}function removeEntity(_0x40d3e6,_0x3e8965){return function(_0x5486b7){if(_0x5486b7){return _0x5486b7[_0x0040('0x24')]()[_0x0040('0x23')](function(){_0x40d3e6[_0x0040('0x19')](0xcc)[_0x0040('0x25')]();});}};}function handleEntityNotFound(_0xa931b0,_0x424af3){return function(_0x5174f3){if(!_0x5174f3){_0xa931b0[_0x0040('0x18')](0x194);}return _0x5174f3;};}function handleError(_0x5f1d3c,_0x28db90){_0x28db90=_0x28db90||0x1f4;return function(_0x1e0040){logger[_0x0040('0x26')](_0x1e0040['stack']);if(_0x1e0040[_0x0040('0x27')]){delete _0x1e0040[_0x0040('0x27')];}_0x5f1d3c[_0x0040('0x19')](_0x28db90)['send'](_0x1e0040);};}exports['index']=function(_0x2ddc28,_0x1dba11){var _0x18278b={},_0x295ce4={},_0x197e1c={'count':0x0,'rows':[]};var _0x3cd15f=_[_0x0040('0x28')](db[_0x0040('0x29')][_0x0040('0x2a')],function(_0x492ae5){return{'name':_0x492ae5[_0x0040('0x2b')],'type':_0x492ae5[_0x0040('0x2c')][_0x0040('0x2d')]};});_0x295ce4[_0x0040('0x2e')]=_['map'](_0x3cd15f,_0x0040('0x27'));_0x295ce4[_0x0040('0x2f')]=_['keys'](_0x2ddc28[_0x0040('0x2f')]);_0x295ce4[_0x0040('0x30')]=_[_0x0040('0x31')](_0x295ce4['model'],_0x295ce4[_0x0040('0x2f')]);_0x18278b[_0x0040('0x32')]=_['intersection'](_0x295ce4[_0x0040('0x2e')],qs[_0x0040('0x33')](_0x2ddc28[_0x0040('0x2f')][_0x0040('0x33')]));_0x18278b[_0x0040('0x32')]=_0x18278b[_0x0040('0x32')][_0x0040('0x34')]?_0x18278b['attributes']:_0x295ce4[_0x0040('0x2e')];if(!_0x2ddc28['query'][_0x0040('0x35')](_0x0040('0x36'))){_0x18278b[_0x0040('0x1c')]=qs[_0x0040('0x1c')](_0x2ddc28['query']['limit']);_0x18278b['offset']=qs['offset'](_0x2ddc28[_0x0040('0x2f')][_0x0040('0x1a')]);}_0x18278b[_0x0040('0x37')]=qs[_0x0040('0x38')](_0x2ddc28[_0x0040('0x2f')][_0x0040('0x38')]);_0x18278b['where']=qs[_0x0040('0x30')](_[_0x0040('0x39')](_0x2ddc28[_0x0040('0x2f')],_0x295ce4[_0x0040('0x30')]),_0x3cd15f);if(_0x2ddc28[_0x0040('0x2f')][_0x0040('0x3a')]){_0x18278b[_0x0040('0x3b')]=_[_0x0040('0x3c')](_0x18278b['where'],{'$or':_[_0x0040('0x28')](_0x3cd15f,function(_0x50288f){if(_0x50288f[_0x0040('0x2c')]!==_0x0040('0x3d')){var _0x1434dd={};_0x1434dd[_0x50288f[_0x0040('0x27')]]={'$like':'%'+_0x2ddc28['query'][_0x0040('0x3a')]+'%'};return _0x1434dd;}})});}_0x18278b=_[_0x0040('0x3c')]({},_0x18278b,_0x2ddc28[_0x0040('0x3e')]);var _0x4db4fb={'where':_0x18278b[_0x0040('0x3b')]};return db[_0x0040('0x29')][_0x0040('0x3f')](_0x4db4fb)['then'](function(_0x1bd29e){_0x197e1c['count']=_0x1bd29e;if(_0x2ddc28['query'][_0x0040('0x40')]){_0x18278b[_0x0040('0x41')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x0040('0x42')](_0x18278b);})[_0x0040('0x23')](function(_0x288c2d){_0x197e1c[_0x0040('0x43')]=_0x288c2d;return _0x197e1c;})[_0x0040('0x23')](respondWithFilteredResult(_0x1dba11,_0x18278b))[_0x0040('0x44')](handleError(_0x1dba11,null));};exports['show']=function(_0xf7bb9b,_0x347926){var _0x2379a2={'raw':![],'where':{'id':_0xf7bb9b[_0x0040('0x45')]['id']}},_0x52e036={};_0x52e036[_0x0040('0x2e')]=_[_0x0040('0x46')](db[_0x0040('0x29')]['rawAttributes']);_0x52e036[_0x0040('0x2f')]=_[_0x0040('0x46')](_0xf7bb9b[_0x0040('0x2f')]);_0x52e036[_0x0040('0x30')]=_['intersection'](_0x52e036[_0x0040('0x2e')],_0x52e036[_0x0040('0x2f')]);_0x2379a2[_0x0040('0x32')]=_[_0x0040('0x31')](_0x52e036[_0x0040('0x2e')],qs[_0x0040('0x33')](_0xf7bb9b['query']['fields']));_0x2379a2[_0x0040('0x32')]=_0x2379a2[_0x0040('0x32')]['length']?_0x2379a2[_0x0040('0x32')]:_0x52e036[_0x0040('0x2e')];if(_0xf7bb9b[_0x0040('0x2f')][_0x0040('0x40')]){_0x2379a2['include']=[{'all':!![]}];}_0x2379a2=_[_0x0040('0x3c')]({},_0x2379a2,_0xf7bb9b['options']);return db[_0x0040('0x29')][_0x0040('0x47')](_0x2379a2)[_0x0040('0x23')](handleEntityNotFound(_0x347926,null))[_0x0040('0x23')](respondWithResult(_0x347926,null))[_0x0040('0x44')](handleError(_0x347926,null));};exports[_0x0040('0x48')]=function(_0x416925,_0x5a6bfe){return db['FreshsalesConfiguration'][_0x0040('0x48')](_0x416925[_0x0040('0x49')],{})[_0x0040('0x23')](respondWithResult(_0x5a6bfe,0xc9))[_0x0040('0x44')](handleError(_0x5a6bfe,null));};exports['update']=function(_0x221a7a,_0x33493b){if(_0x221a7a[_0x0040('0x49')]['id']){delete _0x221a7a[_0x0040('0x49')]['id'];}return db[_0x0040('0x29')][_0x0040('0x47')]({'where':{'id':_0x221a7a[_0x0040('0x45')]['id']}})['then'](handleEntityNotFound(_0x33493b,null))['then'](saveUpdates(_0x221a7a[_0x0040('0x49')],null))[_0x0040('0x23')](respondWithResult(_0x33493b,null))[_0x0040('0x44')](handleError(_0x33493b,null));};exports['destroy']=function(_0x279fa1,_0x140508){return db['FreshsalesConfiguration'][_0x0040('0x47')]({'where':{'id':_0x279fa1[_0x0040('0x45')]['id']}})[_0x0040('0x23')](handleEntityNotFound(_0x140508,null))[_0x0040('0x23')](removeEntity(_0x140508,null))[_0x0040('0x44')](handleError(_0x140508,null));};exports['getSubjects']=function(_0xdafdf2,_0x1c2995,_0x2e7fdc){var _0x37ef29={};var _0x22c782={};var _0x16dc85;var _0x124cfc;return db[_0x0040('0x29')]['findOne']({'where':{'id':_0xdafdf2['params']['id']}})[_0x0040('0x23')](handleEntityNotFound(_0x1c2995,null))[_0x0040('0x23')](function(_0x4ccb1f){if(_0x4ccb1f){_0x16dc85=_0x4ccb1f;_0x22c782[_0x0040('0x2e')]=_[_0x0040('0x46')](db['FreshsalesField'][_0x0040('0x2a')]);_0x22c782['query']=_[_0x0040('0x46')](_0xdafdf2['query']);_0x22c782[_0x0040('0x30')]=_[_0x0040('0x31')](_0x22c782[_0x0040('0x2e')],_0x22c782[_0x0040('0x2f')]);_0x37ef29[_0x0040('0x32')]=_[_0x0040('0x31')](_0x22c782['model'],qs[_0x0040('0x33')](_0xdafdf2[_0x0040('0x2f')][_0x0040('0x33')]));_0x37ef29['attributes']=_0x37ef29['attributes'][_0x0040('0x34')]?_0x37ef29['attributes']:_0x22c782[_0x0040('0x2e')];_0x37ef29[_0x0040('0x37')]=qs[_0x0040('0x38')](_0xdafdf2[_0x0040('0x2f')][_0x0040('0x38')]);_0x37ef29[_0x0040('0x3b')]=qs[_0x0040('0x30')](_[_0x0040('0x39')](_0xdafdf2[_0x0040('0x2f')],_0x22c782['filters']));if(_0xdafdf2[_0x0040('0x2f')][_0x0040('0x3a')]){_0x37ef29[_0x0040('0x3b')]=_[_0x0040('0x3c')](_0x37ef29[_0x0040('0x3b')],{'$or':_[_0x0040('0x28')](_0x37ef29[_0x0040('0x32')],function(_0x2990c2){var _0xf9a28a={};_0xf9a28a[_0x2990c2]={'$like':'%'+_0xdafdf2['query'][_0x0040('0x3a')]+'%'};return _0xf9a28a;})});}_0x37ef29=_[_0x0040('0x3c')]({},_0x37ef29,_0xdafdf2['options']);return _0x16dc85[_0x0040('0x4a')](_0x37ef29);}})[_0x0040('0x23')](function(_0x25fa25){if(_0x25fa25){_0x124cfc=_0x25fa25[_0x0040('0x34')];if(!_0xdafdf2['query'][_0x0040('0x35')](_0x0040('0x36'))){_0x37ef29[_0x0040('0x1c')]=qs[_0x0040('0x1c')](_0xdafdf2[_0x0040('0x2f')][_0x0040('0x1c')]);_0x37ef29['offset']=qs[_0x0040('0x1a')](_0xdafdf2[_0x0040('0x2f')][_0x0040('0x1a')]);}return _0x16dc85['getSubjects'](_0x37ef29);}})['then'](function(_0xbe94c7){if(_0xbe94c7){return _0xbe94c7?{'count':_0x124cfc,'rows':_0xbe94c7}:null;}})['then'](respondWithResult(_0x1c2995,null))[_0x0040('0x44')](handleError(_0x1c2995,null));};exports[_0x0040('0x4b')]=function(_0x49a05b,_0x71675,_0x4b1f2a){var _0x859176={};var _0x29246f={};var _0x37dba9;var _0x52f5fe;return db[_0x0040('0x29')][_0x0040('0x4c')]({'where':{'id':_0x49a05b['params']['id']}})[_0x0040('0x23')](handleEntityNotFound(_0x71675,null))['then'](function(_0x446379){if(_0x446379){_0x37dba9=_0x446379;_0x29246f['model']=_['keys'](db[_0x0040('0x4d')][_0x0040('0x2a')]);_0x29246f[_0x0040('0x2f')]=_[_0x0040('0x46')](_0x49a05b[_0x0040('0x2f')]);_0x29246f['filters']=_['intersection'](_0x29246f[_0x0040('0x2e')],_0x29246f[_0x0040('0x2f')]);_0x859176[_0x0040('0x32')]=_['intersection'](_0x29246f[_0x0040('0x2e')],qs[_0x0040('0x33')](_0x49a05b[_0x0040('0x2f')][_0x0040('0x33')]));_0x859176[_0x0040('0x32')]=_0x859176[_0x0040('0x32')][_0x0040('0x34')]?_0x859176[_0x0040('0x32')]:_0x29246f[_0x0040('0x2e')];_0x859176[_0x0040('0x37')]=qs[_0x0040('0x38')](_0x49a05b['query']['sort']);_0x859176[_0x0040('0x3b')]=qs['filters'](_[_0x0040('0x39')](_0x49a05b[_0x0040('0x2f')],_0x29246f[_0x0040('0x30')]));if(_0x49a05b['query'][_0x0040('0x3a')]){_0x859176[_0x0040('0x3b')]=_['merge'](_0x859176[_0x0040('0x3b')],{'$or':_[_0x0040('0x28')](_0x859176['attributes'],function(_0x4d8d87){var _0x5909eb={};_0x5909eb[_0x4d8d87]={'$like':'%'+_0x49a05b[_0x0040('0x2f')][_0x0040('0x3a')]+'%'};return _0x5909eb;})});}_0x859176=_[_0x0040('0x3c')]({},_0x859176,_0x49a05b[_0x0040('0x3e')]);return _0x37dba9['getDescriptions'](_0x859176);}})['then'](function(_0x5bead4){if(_0x5bead4){_0x52f5fe=_0x5bead4[_0x0040('0x34')];if(!_0x49a05b['query'][_0x0040('0x35')](_0x0040('0x36'))){_0x859176[_0x0040('0x1c')]=qs['limit'](_0x49a05b['query']['limit']);_0x859176[_0x0040('0x1a')]=qs[_0x0040('0x1a')](_0x49a05b[_0x0040('0x2f')][_0x0040('0x1a')]);}return _0x37dba9[_0x0040('0x4b')](_0x859176);}})[_0x0040('0x23')](function(_0x1d8fed){if(_0x1d8fed){return _0x1d8fed?{'count':_0x52f5fe,'rows':_0x1d8fed}:null;}})[_0x0040('0x23')](respondWithResult(_0x71675,null))[_0x0040('0x44')](handleError(_0x71675,null));};exports[_0x0040('0x4e')]=function(_0x34cd4c,_0x50007f,_0x577906){var _0x1d6aa0={};var _0x103917={};var _0x388e4a;var _0x3b9f88;return db['FreshsalesConfiguration'][_0x0040('0x4c')]({'where':{'id':_0x34cd4c[_0x0040('0x45')]['id']}})['then'](handleEntityNotFound(_0x50007f,null))[_0x0040('0x23')](function(_0x2dfe1f){if(_0x2dfe1f){_0x388e4a=_0x2dfe1f;_0x103917[_0x0040('0x2e')]=_[_0x0040('0x46')](db[_0x0040('0x4d')]['rawAttributes']);_0x103917[_0x0040('0x2f')]=_[_0x0040('0x46')](_0x34cd4c[_0x0040('0x2f')]);_0x103917[_0x0040('0x30')]=_[_0x0040('0x31')](_0x103917[_0x0040('0x2e')],_0x103917[_0x0040('0x2f')]);_0x1d6aa0[_0x0040('0x32')]=_['intersection'](_0x103917[_0x0040('0x2e')],qs[_0x0040('0x33')](_0x34cd4c[_0x0040('0x2f')][_0x0040('0x33')]));_0x1d6aa0[_0x0040('0x32')]=_0x1d6aa0['attributes'][_0x0040('0x34')]?_0x1d6aa0[_0x0040('0x32')]:_0x103917[_0x0040('0x2e')];_0x1d6aa0[_0x0040('0x37')]=qs[_0x0040('0x38')](_0x34cd4c['query'][_0x0040('0x38')]);_0x1d6aa0[_0x0040('0x3b')]=qs[_0x0040('0x30')](_['pick'](_0x34cd4c[_0x0040('0x2f')],_0x103917[_0x0040('0x30')]));if(_0x34cd4c[_0x0040('0x2f')][_0x0040('0x3a')]){_0x1d6aa0['where']=_['merge'](_0x1d6aa0[_0x0040('0x3b')],{'$or':_[_0x0040('0x28')](_0x1d6aa0[_0x0040('0x32')],function(_0x4c069b){var _0x391faf={};_0x391faf[_0x4c069b]={'$like':'%'+_0x34cd4c[_0x0040('0x2f')][_0x0040('0x3a')]+'%'};return _0x391faf;})});}_0x1d6aa0=_['merge']({},_0x1d6aa0,_0x34cd4c[_0x0040('0x3e')]);return _0x388e4a[_0x0040('0x4e')](_0x1d6aa0);}})['then'](function(_0x4dfbc0){if(_0x4dfbc0){_0x3b9f88=_0x4dfbc0['length'];if(!_0x34cd4c[_0x0040('0x2f')][_0x0040('0x35')]('nolimit')){_0x1d6aa0[_0x0040('0x1c')]=qs[_0x0040('0x1c')](_0x34cd4c[_0x0040('0x2f')][_0x0040('0x1c')]);_0x1d6aa0[_0x0040('0x1a')]=qs[_0x0040('0x1a')](_0x34cd4c[_0x0040('0x2f')][_0x0040('0x1a')]);}return _0x388e4a[_0x0040('0x4e')](_0x1d6aa0);}})[_0x0040('0x23')](function(_0x3d1443){if(_0x3d1443){return _0x3d1443?{'count':_0x3b9f88,'rows':_0x3d1443}:null;}})[_0x0040('0x23')](respondWithResult(_0x50007f,null))[_0x0040('0x44')](handleError(_0x50007f,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index bf24bfc..1b3495b 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 _0xeb30=['FreshsalesConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define'];(function(_0xee5337,_0x58150e){var _0x2289a8=function(_0x7bb5f9){while(--_0x7bb5f9){_0xee5337['push'](_0xee5337['shift']());}};_0x2289a8(++_0x58150e);}(_0xeb30,0x76));var _0x0eb3=function(_0x4d266d,_0x1ec0c2){_0x4d266d=_0x4d266d-0x0;var _0x313341=_0xeb30[_0x4d266d];return _0x313341;};'use strict';var _=require(_0x0eb3('0x0'));var util=require(_0x0eb3('0x1'));var logger=require(_0x0eb3('0x2'))(_0x0eb3('0x3'));var moment=require(_0x0eb3('0x4'));var BPromise=require(_0x0eb3('0x5'));var rp=require(_0x0eb3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0eb3('0x7'));var config=require(_0x0eb3('0x8'));var attributes=require(_0x0eb3('0x9'));module[_0x0eb3('0xa')]=function(_0x1f683a,_0x49b704){return _0x1f683a[_0x0eb3('0xb')](_0x0eb3('0xc'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x252a=['api','moment','request-promise','path','rimraf','../../config/environment','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger'];(function(_0x2ad656,_0x25c2fd){var _0x3f861f=function(_0x1e9e75){while(--_0x1e9e75){_0x2ad656['push'](_0x2ad656['shift']());}};_0x3f861f(++_0x25c2fd);}(_0x252a,0x81));var _0xa252=function(_0x4ba8ad,_0x573d37){_0x4ba8ad=_0x4ba8ad-0x0;var _0x203a0b=_0x252a[_0x4ba8ad];return _0x203a0b;};'use strict';var _=require(_0xa252('0x0'));var util=require(_0xa252('0x1'));var logger=require(_0xa252('0x2'))(_0xa252('0x3'));var moment=require(_0xa252('0x4'));var BPromise=require('bluebird');var rp=require(_0xa252('0x5'));var fs=require('fs');var path=require(_0xa252('0x6'));var rimraf=require(_0xa252('0x7'));var config=require(_0xa252('0x8'));var attributes=require('./intFreshsalesConfiguration.attributes');module['exports']=function(_0x2a53dc,_0x7006a0){return _0x2a53dc[_0xa252('0x9')](_0xa252('0xa'),attributes,{'tableName':_0xa252('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 6dfb8e0..8dca3d7 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 _0x6547=['info','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','FreshsalesConfiguration,\x20%s,\x20%s','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x2b3e39,_0x131216){var _0x4c0a21=function(_0x138a58){while(--_0x138a58){_0x2b3e39['push'](_0x2b3e39['shift']());}};_0x4c0a21(++_0x131216);}(_0x6547,0xe0));var _0x7654=function(_0x30a73e,_0x4ac86b){_0x30a73e=_0x30a73e-0x0;var _0x1687d9=_0x6547[_0x30a73e];return _0x1687d9;};'use strict';var _=require(_0x7654('0x0'));var util=require(_0x7654('0x1'));var moment=require(_0x7654('0x2'));var BPromise=require(_0x7654('0x3'));var rs=require(_0x7654('0x4'));var fs=require('fs');var Redis=require(_0x7654('0x5'));var db=require(_0x7654('0x6'))['db'];var utils=require(_0x7654('0x7'));var logger=require(_0x7654('0x8'))(_0x7654('0x9'));var config=require(_0x7654('0xa'));var jayson=require(_0x7654('0xb'));var client=jayson[_0x7654('0xc')][_0x7654('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4a62fa,_0x5d2ebc,_0x417d3b){return new BPromise(function(_0x410d18,_0x1071a8){return client[_0x7654('0xe')](_0x4a62fa,_0x417d3b)[_0x7654('0xf')](function(_0x7ddeb){logger[_0x7654('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5d2ebc,_0x7654('0x11'));logger[_0x7654('0x12')](_0x7654('0x13'),_0x5d2ebc,_0x7654('0x11'),JSON['stringify'](_0x7ddeb));if(_0x7ddeb[_0x7654('0x14')]){if(_0x7ddeb[_0x7654('0x14')][_0x7654('0x15')]===0x1f4){logger[_0x7654('0x14')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5d2ebc,_0x7ddeb['error']['message']);return _0x1071a8(_0x7ddeb[_0x7654('0x14')][_0x7654('0x16')]);}logger[_0x7654('0x14')](_0x7654('0x17'),_0x5d2ebc,_0x7ddeb[_0x7654('0x14')][_0x7654('0x16')]);return _0x410d18(_0x7ddeb[_0x7654('0x14')][_0x7654('0x16')]);}else{logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x5d2ebc,_0x7654('0x11'));_0x410d18(_0x7ddeb['result']['message']);}})['catch'](function(_0x13f759){logger['error'](_0x7654('0x17'),_0x5d2ebc,_0x13f759);_0x1071a8(_0x13f759);});});} \ No newline at end of file +var _0x5eca=['FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','message','info','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then'];(function(_0x5023cb,_0x5ae9a6){var _0x52c5d6=function(_0x4fe596){while(--_0x4fe596){_0x5023cb['push'](_0x5023cb['shift']());}};_0x52c5d6(++_0x5ae9a6);}(_0x5eca,0xb3));var _0xa5ec=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5eca[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0xa5ec('0x0'));var moment=require(_0xa5ec('0x1'));var BPromise=require(_0xa5ec('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa5ec('0x3'));var db=require(_0xa5ec('0x4'))['db'];var utils=require(_0xa5ec('0x5'));var logger=require('../../config/logger')(_0xa5ec('0x6'));var config=require(_0xa5ec('0x7'));var jayson=require(_0xa5ec('0x8'));var client=jayson['client'][_0xa5ec('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2cec42,_0x17fedd,_0x1ac216){return new BPromise(function(_0x544f42,_0x2181f1){return client['request'](_0x2cec42,_0x1ac216)[_0xa5ec('0xa')](function(_0x53910b){logger['info'](_0xa5ec('0xb'),_0x17fedd,_0xa5ec('0xc'));logger[_0xa5ec('0xd')](_0xa5ec('0xe'),_0x17fedd,_0xa5ec('0xc'),JSON['stringify'](_0x53910b));if(_0x53910b['error']){if(_0x53910b[_0xa5ec('0xf')]['code']===0x1f4){logger[_0xa5ec('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x17fedd,_0x53910b[_0xa5ec('0xf')][_0xa5ec('0x10')]);return _0x2181f1(_0x53910b[_0xa5ec('0xf')][_0xa5ec('0x10')]);}logger[_0xa5ec('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x17fedd,_0x53910b['error']['message']);return _0x544f42(_0x53910b[_0xa5ec('0xf')][_0xa5ec('0x10')]);}else{logger[_0xa5ec('0x11')](_0xa5ec('0xb'),_0x17fedd,_0xa5ec('0xc'));_0x544f42(_0x53910b[_0xa5ec('0x12')]['message']);}})['catch'](function(_0x1de808){logger[_0xa5ec('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x17fedd,_0x1de808);_0x2181f1(_0x1de808);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 092ac8f..59c1715 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 _0xd82a=['index','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated'];(function(_0x3d064a,_0x12cf18){var _0x5b2a83=function(_0x241866){while(--_0x241866){_0x3d064a['push'](_0x3d064a['shift']());}};_0x5b2a83(++_0x12cf18);}(_0xd82a,0xbd));var _0xad82=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0xd82a[_0xef8146];return _0x5a6cb0;};'use strict';var multer=require(_0xad82('0x0'));var util=require(_0xad82('0x1'));var path=require(_0xad82('0x2'));var timeout=require(_0xad82('0x3'));var express=require('express');var router=express[_0xad82('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xad82('0x5'));var interaction=require(_0xad82('0x6'));var config=require(_0xad82('0x7'));var controller=require(_0xad82('0x8'));router[_0xad82('0x9')]('/',auth[_0xad82('0xa')](),controller[_0xad82('0xb')]);router[_0xad82('0x9')](_0xad82('0xc'),auth[_0xad82('0xa')](),controller['show']);router[_0xad82('0xd')]('/',auth[_0xad82('0xa')](),controller[_0xad82('0xe')]);router[_0xad82('0xf')](_0xad82('0xc'),auth[_0xad82('0xa')](),controller[_0xad82('0x10')]);router[_0xad82('0x11')](_0xad82('0xc'),auth[_0xad82('0xa')](),controller[_0xad82('0x12')]);module[_0xad82('0x13')]=router; \ No newline at end of file +var _0x35aa=['isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get'];(function(_0x4060ce,_0x3259a5){var _0x4bbecc=function(_0x3b573e){while(--_0x3b573e){_0x4060ce['push'](_0x4060ce['shift']());}};_0x4bbecc(++_0x3259a5);}(_0x35aa,0xbe));var _0xa35a=function(_0x2673bb,_0x292576){_0x2673bb=_0x2673bb-0x0;var _0x3edc1c=_0x35aa[_0x2673bb];return _0x3edc1c;};'use strict';var multer=require('multer');var util=require(_0xa35a('0x0'));var path=require(_0xa35a('0x1'));var timeout=require(_0xa35a('0x2'));var express=require(_0xa35a('0x3'));var router=express['Router']();var fs_extra=require(_0xa35a('0x4'));var auth=require(_0xa35a('0x5'));var interaction=require(_0xa35a('0x6'));var config=require(_0xa35a('0x7'));var controller=require(_0xa35a('0x8'));router[_0xa35a('0x9')]('/',auth[_0xa35a('0xa')](),controller[_0xa35a('0xb')]);router['get'](_0xa35a('0xc'),auth['isAuthenticated'](),controller[_0xa35a('0xd')]);router[_0xa35a('0xe')]('/',auth[_0xa35a('0xa')](),controller[_0xa35a('0xf')]);router[_0xa35a('0x10')](_0xa35a('0xc'),auth['isAuthenticated'](),controller[_0xa35a('0x11')]);router[_0xa35a('0x12')](_0xa35a('0xc'),auth[_0xa35a('0xa')](),controller['destroy']);module[_0xa35a('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index ab2fa08..19c9bb0 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 _0x0057=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x50641e,_0x3bc2fe){var _0x426fa1=function(_0x509a53){while(--_0x509a53){_0x50641e['push'](_0x50641e['shift']());}};_0x426fa1(++_0x3bc2fe);}(_0x0057,0x1a2));var _0x7005=function(_0x17630c,_0x1637f1){_0x17630c=_0x17630c-0x0;var _0x11641b=_0x0057[_0x17630c];return _0x11641b;};'use strict';var Sequelize=require(_0x7005('0x0'));module[_0x7005('0x1')]={'type':{'type':Sequelize[_0x7005('0x2')](_0x7005('0x3'),_0x7005('0x4'),_0x7005('0x5'),'keyValue','picklist'),'defaultValue':_0x7005('0x3')},'content':{'type':Sequelize[_0x7005('0x6')]},'key':{'type':Sequelize[_0x7005('0x6')]},'keyType':{'type':Sequelize[_0x7005('0x2')](_0x7005('0x3'),_0x7005('0x4'),_0x7005('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x7005('0x6')]},'customField':{'type':Sequelize[_0x7005('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7005('0x6')]}}; \ No newline at end of file +var _0x98b3=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize'];(function(_0x491ded,_0x17abba){var _0x4ea2c9=function(_0x4013d3){while(--_0x4013d3){_0x491ded['push'](_0x491ded['shift']());}};_0x4ea2c9(++_0x17abba);}(_0x98b3,0x1ad));var _0x398b=function(_0x2cdab0,_0x54b1d8){_0x2cdab0=_0x2cdab0-0x0;var _0x499ff1=_0x98b3[_0x2cdab0];return _0x499ff1;};'use strict';var Sequelize=require(_0x398b('0x0'));module[_0x398b('0x1')]={'type':{'type':Sequelize[_0x398b('0x2')](_0x398b('0x3'),_0x398b('0x4'),_0x398b('0x5'),_0x398b('0x6'),_0x398b('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0x398b('0x8')]},'key':{'type':Sequelize[_0x398b('0x8')]},'keyType':{'type':Sequelize[_0x398b('0x2')](_0x398b('0x3'),_0x398b('0x4'),_0x398b('0x5'))},'keyContent':{'type':Sequelize[_0x398b('0x8')]},'idField':{'type':Sequelize[_0x398b('0x8')]},'nameField':{'type':Sequelize[_0x398b('0x8')]},'customField':{'type':Sequelize[_0x398b('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x398b('0x8')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index ea2015f..5f06a60 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 _0xca1b=['merge','options','include','findAll','catch','show','params','keys','length','includeAll','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','update','then','error','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter'];(function(_0x2a56ad,_0x2b94bf){var _0x425175=function(_0x342f20){while(--_0x342f20){_0x2a56ad['push'](_0x2a56ad['shift']());}};_0x425175(++_0x2b94bf);}(_0xca1b,0xf8));var _0xbca1=function(_0xf51106,_0x528474){_0xf51106=_0xf51106-0x0;var _0x1a9286=_0xca1b[_0xf51106];return _0x1a9286;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbca1('0x0'));var zipdir=require(_0xbca1('0x1'));var jsonpatch=require(_0xbca1('0x2'));var rp=require(_0xbca1('0x3'));var moment=require(_0xbca1('0x4'));var BPromise=require(_0xbca1('0x5'));var Mustache=require(_0xbca1('0x6'));var util=require(_0xbca1('0x7'));var path=require('path');var sox=require(_0xbca1('0x8'));var csv=require(_0xbca1('0x9'));var ejs=require(_0xbca1('0xa'));var fs=require('fs');var fs_extra=require(_0xbca1('0xb'));var _=require(_0xbca1('0xc'));var squel=require(_0xbca1('0xd'));var crypto=require(_0xbca1('0xe'));var jsforce=require(_0xbca1('0xf'));var deskjs=require(_0xbca1('0x10'));var toCsv=require(_0xbca1('0x9'));var querystring=require(_0xbca1('0x11'));var Papa=require(_0xbca1('0x12'));var Redis=require(_0xbca1('0x13'));var authService=require(_0xbca1('0x14'));var qs=require(_0xbca1('0x15'));var as=require(_0xbca1('0x16'));var hardwareService=require(_0xbca1('0x17'));var logger=require(_0xbca1('0x18'))(_0xbca1('0x19'));var utils=require(_0xbca1('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0xbca1('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29ca84,_0x3339f9){_0x3339f9=_0x3339f9||0xcc;return function(_0xf24a55){if(_0xf24a55){return _0x29ca84[_0xbca1('0x1c')](_0x3339f9);}return _0x29ca84[_0xbca1('0x1d')](_0x3339f9)[_0xbca1('0x1e')]();};}function respondWithResult(_0x417b9c,_0x1eaee7){_0x1eaee7=_0x1eaee7||0xc8;return function(_0x2dd31e){if(_0x2dd31e){return _0x417b9c[_0xbca1('0x1d')](_0x1eaee7)[_0xbca1('0x1f')](_0x2dd31e);}};}function respondWithFilteredResult(_0x510a4c,_0x3879bd){return function(_0x3cc216){if(_0x3cc216){var _0x29e520=typeof _0x3879bd[_0xbca1('0x20')]===_0xbca1('0x21')&&typeof _0x3879bd['limit']==='undefined';var _0x590c03=_0x3cc216[_0xbca1('0x22')];var _0x5b156a=_0x29e520?0x0:_0x3879bd[_0xbca1('0x20')];var _0x287b4b=_0x29e520?_0x3cc216['count']:_0x3879bd[_0xbca1('0x20')]+_0x3879bd[_0xbca1('0x23')];var _0x1a0826;if(_0x287b4b>=_0x590c03){_0x287b4b=_0x590c03;_0x1a0826=0xc8;}else{_0x1a0826=0xce;}_0x510a4c[_0xbca1('0x1d')](_0x1a0826);return _0x510a4c['set'](_0xbca1('0x24'),_0x5b156a+'-'+_0x287b4b+'/'+_0x590c03)[_0xbca1('0x1f')](_0x3cc216);}return null;};}function patchUpdates(_0x4d7ea9){return function(_0x4f6198){try{jsonpatch[_0xbca1('0x25')](_0x4f6198,_0x4d7ea9,!![]);}catch(_0x4e8e13){return BPromise['reject'](_0x4e8e13);}return _0x4f6198['save']();};}function saveUpdates(_0x5ca897,_0x8b6b0a){return function(_0x3b9c01){if(_0x3b9c01){return _0x3b9c01[_0xbca1('0x26')](_0x5ca897)[_0xbca1('0x27')](function(_0x49506c){return _0x49506c;});}return null;};}function removeEntity(_0x49b37a,_0x3482ba){return function(_0x3eba63){if(_0x3eba63){return _0x3eba63['destroy']()[_0xbca1('0x27')](function(){_0x49b37a['status'](0xcc)[_0xbca1('0x1e')]();});}};}function handleEntityNotFound(_0x4e0e9d,_0xdda5e4){return function(_0x590036){if(!_0x590036){_0x4e0e9d[_0xbca1('0x1c')](0x194);}return _0x590036;};}function handleError(_0x2851dd,_0x2c1c6b){_0x2c1c6b=_0x2c1c6b||0x1f4;return function(_0xfc4eb8){logger[_0xbca1('0x28')](_0xfc4eb8['stack']);if(_0xfc4eb8[_0xbca1('0x29')]){delete _0xfc4eb8['name'];}_0x2851dd[_0xbca1('0x1d')](_0x2c1c6b)[_0xbca1('0x2a')](_0xfc4eb8);};}exports[_0xbca1('0x2b')]=function(_0x1b6ec1,_0x484488){var _0x16f41c={},_0x13c8ee={},_0x4add5e={'count':0x0,'rows':[]};var _0x3010b5=_[_0xbca1('0x2c')](db[_0xbca1('0x2d')][_0xbca1('0x2e')],function(_0x3c8d79){return{'name':_0x3c8d79[_0xbca1('0x2f')],'type':_0x3c8d79[_0xbca1('0x30')][_0xbca1('0x31')]};});_0x13c8ee[_0xbca1('0x32')]=_[_0xbca1('0x2c')](_0x3010b5,_0xbca1('0x29'));_0x13c8ee[_0xbca1('0x33')]=_['keys'](_0x1b6ec1['query']);_0x13c8ee[_0xbca1('0x34')]=_[_0xbca1('0x35')](_0x13c8ee['model'],_0x13c8ee[_0xbca1('0x33')]);_0x16f41c[_0xbca1('0x36')]=_['intersection'](_0x13c8ee['model'],qs[_0xbca1('0x37')](_0x1b6ec1[_0xbca1('0x33')][_0xbca1('0x37')]));_0x16f41c['attributes']=_0x16f41c[_0xbca1('0x36')]['length']?_0x16f41c[_0xbca1('0x36')]:_0x13c8ee[_0xbca1('0x32')];if(!_0x1b6ec1['query'][_0xbca1('0x38')](_0xbca1('0x39'))){_0x16f41c[_0xbca1('0x23')]=qs[_0xbca1('0x23')](_0x1b6ec1[_0xbca1('0x33')][_0xbca1('0x23')]);_0x16f41c[_0xbca1('0x20')]=qs[_0xbca1('0x20')](_0x1b6ec1[_0xbca1('0x33')][_0xbca1('0x20')]);}_0x16f41c[_0xbca1('0x3a')]=qs[_0xbca1('0x3b')](_0x1b6ec1['query'][_0xbca1('0x3b')]);_0x16f41c[_0xbca1('0x3c')]=qs[_0xbca1('0x34')](_[_0xbca1('0x3d')](_0x1b6ec1[_0xbca1('0x33')],_0x13c8ee[_0xbca1('0x34')]),_0x3010b5);if(_0x1b6ec1['query']['filter']){_0x16f41c[_0xbca1('0x3c')]=_['merge'](_0x16f41c[_0xbca1('0x3c')],{'$or':_[_0xbca1('0x2c')](_0x3010b5,function(_0x1c4cdb){if(_0x1c4cdb['type']!==_0xbca1('0x3e')){var _0x1c7eaf={};_0x1c7eaf[_0x1c4cdb[_0xbca1('0x29')]]={'$like':'%'+_0x1b6ec1[_0xbca1('0x33')][_0xbca1('0x3f')]+'%'};return _0x1c7eaf;}})});}_0x16f41c=_[_0xbca1('0x40')]({},_0x16f41c,_0x1b6ec1[_0xbca1('0x41')]);var _0x5aa80b={'where':_0x16f41c[_0xbca1('0x3c')]};return db['FreshsalesField'][_0xbca1('0x22')](_0x5aa80b)[_0xbca1('0x27')](function(_0x184da7){_0x4add5e[_0xbca1('0x22')]=_0x184da7;if(_0x1b6ec1[_0xbca1('0x33')]['includeAll']){_0x16f41c[_0xbca1('0x42')]=[{'all':!![]}];}return db['FreshsalesField'][_0xbca1('0x43')](_0x16f41c);})[_0xbca1('0x27')](function(_0x298c07){_0x4add5e['rows']=_0x298c07;return _0x4add5e;})[_0xbca1('0x27')](respondWithFilteredResult(_0x484488,_0x16f41c))[_0xbca1('0x44')](handleError(_0x484488,null));};exports[_0xbca1('0x45')]=function(_0x545208,_0x573ce0){var _0x3bfb9e={'raw':!![],'where':{'id':_0x545208[_0xbca1('0x46')]['id']}},_0x490c52={};_0x490c52[_0xbca1('0x32')]=_[_0xbca1('0x47')](db[_0xbca1('0x2d')]['rawAttributes']);_0x490c52[_0xbca1('0x33')]=_[_0xbca1('0x47')](_0x545208['query']);_0x490c52[_0xbca1('0x34')]=_[_0xbca1('0x35')](_0x490c52[_0xbca1('0x32')],_0x490c52['query']);_0x3bfb9e[_0xbca1('0x36')]=_[_0xbca1('0x35')](_0x490c52[_0xbca1('0x32')],qs[_0xbca1('0x37')](_0x545208[_0xbca1('0x33')]['fields']));_0x3bfb9e['attributes']=_0x3bfb9e[_0xbca1('0x36')][_0xbca1('0x48')]?_0x3bfb9e[_0xbca1('0x36')]:_0x490c52[_0xbca1('0x32')];if(_0x545208[_0xbca1('0x33')][_0xbca1('0x49')]){_0x3bfb9e[_0xbca1('0x42')]=[{'all':!![]}];}_0x3bfb9e=_[_0xbca1('0x40')]({},_0x3bfb9e,_0x545208[_0xbca1('0x41')]);return db['FreshsalesField'][_0xbca1('0x4a')](_0x3bfb9e)[_0xbca1('0x27')](handleEntityNotFound(_0x573ce0,null))[_0xbca1('0x27')](respondWithResult(_0x573ce0,null))[_0xbca1('0x44')](handleError(_0x573ce0,null));};exports[_0xbca1('0x4b')]=function(_0x1028d6,_0xe1640){return db[_0xbca1('0x2d')][_0xbca1('0x4b')](_0x1028d6['body'],{})[_0xbca1('0x27')](respondWithResult(_0xe1640,0xc9))[_0xbca1('0x44')](handleError(_0xe1640,null));};exports['update']=function(_0x1504a8,_0x3a37a1){if(_0x1504a8[_0xbca1('0x4c')]['id']){delete _0x1504a8['body']['id'];}return db[_0xbca1('0x2d')][_0xbca1('0x4a')]({'where':{'id':_0x1504a8['params']['id']}})[_0xbca1('0x27')](handleEntityNotFound(_0x3a37a1,null))['then'](saveUpdates(_0x1504a8['body'],null))[_0xbca1('0x27')](respondWithResult(_0x3a37a1,null))[_0xbca1('0x44')](handleError(_0x3a37a1,null));};exports[_0xbca1('0x4d')]=function(_0xaaa5bb,_0x5096a9){return db[_0xbca1('0x2d')][_0xbca1('0x4a')]({'where':{'id':_0xaaa5bb[_0xbca1('0x46')]['id']}})[_0xbca1('0x27')](handleEntityNotFound(_0x5096a9,null))[_0xbca1('0x27')](removeEntity(_0x5096a9,null))['catch'](handleError(_0x5096a9,null));}; \ No newline at end of file +var _0x48fc=['fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','FreshsalesField','includeAll','include','findAll','rows','catch','show','params','find','create','body','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','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','json','apply','reject','update','then','destroy','end','sendStatus','error','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','intersection'];(function(_0x4fa7b8,_0x147a39){var _0x2c811b=function(_0x33ad7e){while(--_0x33ad7e){_0x4fa7b8['push'](_0x4fa7b8['shift']());}};_0x2c811b(++_0x147a39);}(_0x48fc,0x102));var _0xc48f=function(_0x4e5fe9,_0x69af0c){_0x4e5fe9=_0x4e5fe9-0x0;var _0x5f3127=_0x48fc[_0x4e5fe9];return _0x5f3127;};'use strict';var emlformat=require(_0xc48f('0x0'));var rimraf=require(_0xc48f('0x1'));var zipdir=require(_0xc48f('0x2'));var jsonpatch=require(_0xc48f('0x3'));var rp=require('request-promise');var moment=require(_0xc48f('0x4'));var BPromise=require(_0xc48f('0x5'));var Mustache=require(_0xc48f('0x6'));var util=require(_0xc48f('0x7'));var path=require(_0xc48f('0x8'));var sox=require(_0xc48f('0x9'));var csv=require(_0xc48f('0xa'));var ejs=require(_0xc48f('0xb'));var fs=require('fs');var fs_extra=require(_0xc48f('0xc'));var _=require(_0xc48f('0xd'));var squel=require(_0xc48f('0xe'));var crypto=require(_0xc48f('0xf'));var jsforce=require(_0xc48f('0x10'));var deskjs=require(_0xc48f('0x11'));var toCsv=require(_0xc48f('0xa'));var querystring=require(_0xc48f('0x12'));var Papa=require(_0xc48f('0x13'));var Redis=require('ioredis');var authService=require(_0xc48f('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc48f('0x15'));var logger=require(_0xc48f('0x16'))(_0xc48f('0x17'));var utils=require('../../config/utils');var config=require(_0xc48f('0x18'));var licenseUtil=require(_0xc48f('0x19'));var db=require(_0xc48f('0x1a'))['db'];function respondWithStatusCode(_0x2542b0,_0x3614cd){_0x3614cd=_0x3614cd||0xcc;return function(_0xe70dd0){if(_0xe70dd0){return _0x2542b0['sendStatus'](_0x3614cd);}return _0x2542b0[_0xc48f('0x1b')](_0x3614cd)['end']();};}function respondWithResult(_0x14381d,_0x13b87c){_0x13b87c=_0x13b87c||0xc8;return function(_0x19e168){if(_0x19e168){return _0x14381d[_0xc48f('0x1b')](_0x13b87c)['json'](_0x19e168);}};}function respondWithFilteredResult(_0x5d568b,_0x42bb37){return function(_0x56acf0){if(_0x56acf0){var _0x418023=typeof _0x42bb37[_0xc48f('0x1c')]===_0xc48f('0x1d')&&typeof _0x42bb37[_0xc48f('0x1e')]==='undefined';var _0x1529fe=_0x56acf0[_0xc48f('0x1f')];var _0x1d4a24=_0x418023?0x0:_0x42bb37[_0xc48f('0x1c')];var _0x3dacd6=_0x418023?_0x56acf0['count']:_0x42bb37[_0xc48f('0x1c')]+_0x42bb37[_0xc48f('0x1e')];var _0x1351c2;if(_0x3dacd6>=_0x1529fe){_0x3dacd6=_0x1529fe;_0x1351c2=0xc8;}else{_0x1351c2=0xce;}_0x5d568b[_0xc48f('0x1b')](_0x1351c2);return _0x5d568b[_0xc48f('0x20')]('Content-Range',_0x1d4a24+'-'+_0x3dacd6+'/'+_0x1529fe)[_0xc48f('0x21')](_0x56acf0);}return null;};}function patchUpdates(_0x543796){return function(_0x280169){try{jsonpatch[_0xc48f('0x22')](_0x280169,_0x543796,!![]);}catch(_0x3e793b){return BPromise[_0xc48f('0x23')](_0x3e793b);}return _0x280169['save']();};}function saveUpdates(_0x39e587,_0x59e2c2){return function(_0x54ef30){if(_0x54ef30){return _0x54ef30[_0xc48f('0x24')](_0x39e587)[_0xc48f('0x25')](function(_0x2a3fa1){return _0x2a3fa1;});}return null;};}function removeEntity(_0x26e09b,_0x4c5f53){return function(_0x2c6513){if(_0x2c6513){return _0x2c6513[_0xc48f('0x26')]()[_0xc48f('0x25')](function(){_0x26e09b[_0xc48f('0x1b')](0xcc)[_0xc48f('0x27')]();});}};}function handleEntityNotFound(_0x1e87c2,_0x43378a){return function(_0x907ef9){if(!_0x907ef9){_0x1e87c2[_0xc48f('0x28')](0x194);}return _0x907ef9;};}function handleError(_0x1c8089,_0x5617b0){_0x5617b0=_0x5617b0||0x1f4;return function(_0x4f6623){logger[_0xc48f('0x29')](_0x4f6623['stack']);if(_0x4f6623['name']){delete _0x4f6623[_0xc48f('0x2a')];}_0x1c8089[_0xc48f('0x1b')](_0x5617b0)[_0xc48f('0x2b')](_0x4f6623);};}exports[_0xc48f('0x2c')]=function(_0x12065c,_0x82558a){var _0x543b30={},_0x4be1b3={},_0x142cb0={'count':0x0,'rows':[]};var _0x2bfecf=_['map'](db['FreshsalesField'][_0xc48f('0x2d')],function(_0x418b93){return{'name':_0x418b93[_0xc48f('0x2e')],'type':_0x418b93[_0xc48f('0x2f')][_0xc48f('0x30')]};});_0x4be1b3[_0xc48f('0x31')]=_[_0xc48f('0x32')](_0x2bfecf,_0xc48f('0x2a'));_0x4be1b3[_0xc48f('0x33')]=_[_0xc48f('0x34')](_0x12065c[_0xc48f('0x33')]);_0x4be1b3['filters']=_[_0xc48f('0x35')](_0x4be1b3[_0xc48f('0x31')],_0x4be1b3[_0xc48f('0x33')]);_0x543b30['attributes']=_[_0xc48f('0x35')](_0x4be1b3[_0xc48f('0x31')],qs[_0xc48f('0x36')](_0x12065c[_0xc48f('0x33')][_0xc48f('0x36')]));_0x543b30[_0xc48f('0x37')]=_0x543b30[_0xc48f('0x37')][_0xc48f('0x38')]?_0x543b30['attributes']:_0x4be1b3[_0xc48f('0x31')];if(!_0x12065c['query'][_0xc48f('0x39')](_0xc48f('0x3a'))){_0x543b30[_0xc48f('0x1e')]=qs[_0xc48f('0x1e')](_0x12065c[_0xc48f('0x33')][_0xc48f('0x1e')]);_0x543b30[_0xc48f('0x1c')]=qs[_0xc48f('0x1c')](_0x12065c[_0xc48f('0x33')][_0xc48f('0x1c')]);}_0x543b30[_0xc48f('0x3b')]=qs['sort'](_0x12065c[_0xc48f('0x33')][_0xc48f('0x3c')]);_0x543b30[_0xc48f('0x3d')]=qs[_0xc48f('0x3e')](_[_0xc48f('0x3f')](_0x12065c[_0xc48f('0x33')],_0x4be1b3[_0xc48f('0x3e')]),_0x2bfecf);if(_0x12065c['query'][_0xc48f('0x40')]){_0x543b30[_0xc48f('0x3d')]=_['merge'](_0x543b30[_0xc48f('0x3d')],{'$or':_[_0xc48f('0x32')](_0x2bfecf,function(_0x677ed7){if(_0x677ed7[_0xc48f('0x2f')]!=='VIRTUAL'){var _0xf9f347={};_0xf9f347[_0x677ed7[_0xc48f('0x2a')]]={'$like':'%'+_0x12065c[_0xc48f('0x33')][_0xc48f('0x40')]+'%'};return _0xf9f347;}})});}_0x543b30=_[_0xc48f('0x41')]({},_0x543b30,_0x12065c[_0xc48f('0x42')]);var _0xaa960a={'where':_0x543b30['where']};return db[_0xc48f('0x43')][_0xc48f('0x1f')](_0xaa960a)['then'](function(_0xa807af){_0x142cb0['count']=_0xa807af;if(_0x12065c[_0xc48f('0x33')][_0xc48f('0x44')]){_0x543b30[_0xc48f('0x45')]=[{'all':!![]}];}return db[_0xc48f('0x43')][_0xc48f('0x46')](_0x543b30);})[_0xc48f('0x25')](function(_0x69daa2){_0x142cb0[_0xc48f('0x47')]=_0x69daa2;return _0x142cb0;})[_0xc48f('0x25')](respondWithFilteredResult(_0x82558a,_0x543b30))[_0xc48f('0x48')](handleError(_0x82558a,null));};exports[_0xc48f('0x49')]=function(_0x380ed0,_0x30e670){var _0xe36ab8={'raw':!![],'where':{'id':_0x380ed0[_0xc48f('0x4a')]['id']}},_0x1e598e={};_0x1e598e[_0xc48f('0x31')]=_[_0xc48f('0x34')](db[_0xc48f('0x43')]['rawAttributes']);_0x1e598e[_0xc48f('0x33')]=_[_0xc48f('0x34')](_0x380ed0[_0xc48f('0x33')]);_0x1e598e[_0xc48f('0x3e')]=_[_0xc48f('0x35')](_0x1e598e['model'],_0x1e598e[_0xc48f('0x33')]);_0xe36ab8[_0xc48f('0x37')]=_['intersection'](_0x1e598e[_0xc48f('0x31')],qs[_0xc48f('0x36')](_0x380ed0[_0xc48f('0x33')][_0xc48f('0x36')]));_0xe36ab8[_0xc48f('0x37')]=_0xe36ab8['attributes'][_0xc48f('0x38')]?_0xe36ab8[_0xc48f('0x37')]:_0x1e598e[_0xc48f('0x31')];if(_0x380ed0[_0xc48f('0x33')][_0xc48f('0x44')]){_0xe36ab8[_0xc48f('0x45')]=[{'all':!![]}];}_0xe36ab8=_[_0xc48f('0x41')]({},_0xe36ab8,_0x380ed0[_0xc48f('0x42')]);return db[_0xc48f('0x43')][_0xc48f('0x4b')](_0xe36ab8)['then'](handleEntityNotFound(_0x30e670,null))[_0xc48f('0x25')](respondWithResult(_0x30e670,null))[_0xc48f('0x48')](handleError(_0x30e670,null));};exports[_0xc48f('0x4c')]=function(_0x1ecc14,_0x5b6c7d){return db[_0xc48f('0x43')][_0xc48f('0x4c')](_0x1ecc14['body'],{})['then'](respondWithResult(_0x5b6c7d,0xc9))['catch'](handleError(_0x5b6c7d,null));};exports['update']=function(_0x59910b,_0x5aa342){if(_0x59910b[_0xc48f('0x4d')]['id']){delete _0x59910b[_0xc48f('0x4d')]['id'];}return db['FreshsalesField'][_0xc48f('0x4b')]({'where':{'id':_0x59910b[_0xc48f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5aa342,null))[_0xc48f('0x25')](saveUpdates(_0x59910b['body'],null))[_0xc48f('0x25')](respondWithResult(_0x5aa342,null))[_0xc48f('0x48')](handleError(_0x5aa342,null));};exports['destroy']=function(_0x523dd2,_0x566758){return db[_0xc48f('0x43')][_0xc48f('0x4b')]({'where':{'id':_0x523dd2['params']['id']}})[_0xc48f('0x25')](handleEntityNotFound(_0x566758,null))[_0xc48f('0x25')](removeEntity(_0x566758,null))['catch'](handleError(_0x566758,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index b635c1c..51830db 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 _0xf963=['path','rimraf','../../config/environment','./intFreshsalesField.attributes','define','FreshsalesField','int_freshsales_fields','idField','FieldId','lodash','api','moment'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0xf963,0x11d));var _0x3f96=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xf963[_0x5f1391];return _0x50ebe3;};'use strict';var _=require(_0x3f96('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3f96('0x1'));var moment=require(_0x3f96('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3f96('0x3'));var rimraf=require(_0x3f96('0x4'));var config=require(_0x3f96('0x5'));var attributes=require(_0x3f96('0x6'));module['exports']=function(_0x2ecae8,_0x56c663){return _0x2ecae8[_0x3f96('0x7')](_0x3f96('0x8'),attributes,{'tableName':_0x3f96('0x9'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x3f96('0xa'),_0x3f96('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x337f=['bluebird','request-promise','rimraf','../../config/environment','exports','FreshsalesField','idField','FieldId','lodash','util','../../config/logger','moment'];(function(_0x18dab5,_0xb76cc5){var _0x28a919=function(_0x54562a){while(--_0x54562a){_0x18dab5['push'](_0x18dab5['shift']());}};_0x28a919(++_0xb76cc5);}(_0x337f,0x11c));var _0xf337=function(_0x584a05,_0x4528ce){_0x584a05=_0x584a05-0x0;var _0x2d414d=_0x337f[_0x584a05];return _0x2d414d;};'use strict';var _=require(_0xf337('0x0'));var util=require(_0xf337('0x1'));var logger=require(_0xf337('0x2'))('api');var moment=require(_0xf337('0x3'));var BPromise=require(_0xf337('0x4'));var rp=require(_0xf337('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf337('0x6'));var config=require(_0xf337('0x7'));var attributes=require('./intFreshsalesField.attributes');module[_0xf337('0x8')]=function(_0x485b2a,_0x4580a3){return _0x485b2a['define'](_0xf337('0x9'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xf337('0xa'),_0xf337('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 3761d48..0ef61f2 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 _0x31f0=['../../config/environment','request','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x546ce7,_0x135234){var _0x1e1530=function(_0x4459f6){while(--_0x4459f6){_0x546ce7['push'](_0x546ce7['shift']());}};_0x1e1530(++_0x135234);}(_0x31f0,0xb7));var _0x031f=function(_0x1c318a,_0x1552f4){_0x1c318a=_0x1c318a-0x0;var _0x41dbcb=_0x31f0[_0x1c318a];return _0x41dbcb;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var moment=require(_0x031f('0x1'));var BPromise=require('bluebird');var rs=require(_0x031f('0x2'));var fs=require('fs');var Redis=require(_0x031f('0x3'));var db=require(_0x031f('0x4'))['db'];var utils=require(_0x031f('0x5'));var logger=require('../../config/logger')(_0x031f('0x6'));var config=require(_0x031f('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3dc98e,_0x487e65,_0x365f59){return new BPromise(function(_0x4300b4,_0x2569b6){return client[_0x031f('0x8')](_0x3dc98e,_0x365f59)['then'](function(_0x2e5624){logger[_0x031f('0x9')](_0x031f('0xa'),_0x487e65,_0x031f('0xb'));logger[_0x031f('0xc')](_0x031f('0xd'),_0x487e65,_0x031f('0xb'),JSON[_0x031f('0xe')](_0x2e5624));if(_0x2e5624['error']){if(_0x2e5624[_0x031f('0xf')][_0x031f('0x10')]===0x1f4){logger[_0x031f('0xf')](_0x031f('0xa'),_0x487e65,_0x2e5624[_0x031f('0xf')][_0x031f('0x11')]);return _0x2569b6(_0x2e5624[_0x031f('0xf')]['message']);}logger[_0x031f('0xf')](_0x031f('0xa'),_0x487e65,_0x2e5624[_0x031f('0xf')][_0x031f('0x11')]);return _0x4300b4(_0x2e5624[_0x031f('0xf')]['message']);}else{logger['info'](_0x031f('0xa'),_0x487e65,_0x031f('0xb'));_0x4300b4(_0x2e5624[_0x031f('0x12')][_0x031f('0x11')]);}})['catch'](function(_0x1dc4a7){logger[_0x031f('0xf')]('FreshsalesField,\x20%s,\x20%s',_0x487e65,_0x1dc4a7);_0x2569b6(_0x1dc4a7);});});} \ 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(_0x2254a0,_0x41f33e){var _0x35cd31=function(_0x5242d5){while(--_0x5242d5){_0x2254a0['push'](_0x2254a0['shift']());}};_0x35cd31(++_0x41f33e);}(_0x5d58,0x187));var _0x85d5=function(_0x5e4612,_0x433f67){_0x5e4612=_0x5e4612-0x0;var _0x5c22fd=_0x5d58[_0x5e4612];return _0x5c22fd;};'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 9be8a5d..9036b8e 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(_0x52e162,_0x1f89ca){var _0x5b8a07=function(_0x1bbb2e){while(--_0x1bbb2e){_0x52e162['push'](_0x52e162['shift']());}};_0x5b8a07(++_0x1f89ca);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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(_0x5d4571,_0x15eeef){var _0xff47eb=function(_0x203e7e){while(--_0x203e7e){_0x5d4571['push'](_0x5d4571['shift']());}};_0xff47eb(++_0x15eeef);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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 5645ac4..c96ac72 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 _0x7008=['username','ENUM','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x11ae28,_0x5a2fa9){var _0x5012ec=function(_0x520237){while(--_0x520237){_0x11ae28['push'](_0x11ae28['shift']());}};_0x5012ec(++_0x5a2fa9);}(_0x7008,0x185));var _0x8700=function(_0x3d00c2,_0xefc21f){_0x3d00c2=_0x3d00c2-0x0;var _0x488bfe=_0x7008[_0x3d00c2];return _0x488bfe;};'use strict';var Sequelize=require(_0x8700('0x0'));module[_0x8700('0x1')]={'name':{'type':Sequelize[_0x8700('0x2')]},'description':{'type':Sequelize[_0x8700('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x8700('0x3')},'remoteUri':{'type':Sequelize[_0x8700('0x2')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x8700('0x2')]},'clientSecret':{'type':Sequelize[_0x8700('0x2')]},'securityToken':{'type':Sequelize[_0x8700('0x2')]},'serverUrl':{'type':Sequelize[_0x8700('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x8700('0x4')](_0x8700('0x5'),_0x8700('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x937d=['sequelize','STRING','username','ENUM','integrationTab'];(function(_0x3df223,_0x1740fc){var _0x562d11=function(_0x343009){while(--_0x343009){_0x3df223['push'](_0x3df223['shift']());}};_0x562d11(++_0x1740fc);}(_0x937d,0x1f4));var _0xd937=function(_0x15f059,_0x230760){_0x15f059=_0x15f059-0x0;var _0x5188e4=_0x937d[_0x15f059];return _0x5188e4;};'use strict';var Sequelize=require(_0xd937('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xd937('0x1')],'unique':_0xd937('0x2')},'remoteUri':{'type':Sequelize[_0xd937('0x1')]},'password':{'type':Sequelize[_0xd937('0x1')]},'clientId':{'type':Sequelize[_0xd937('0x1')]},'clientSecret':{'type':Sequelize[_0xd937('0x1')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xd937('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xd937('0x3')](_0xd937('0x4'),'newTab'),'defaultValue':_0xd937('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 793c4c8..6bde7c2 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 _0xe1fc=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','undefined','limit','count','offset','apply','reject','save','update','then','end','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','params','find','create','body','getConfigurations','findOne','SalesforceConfiguration','AccountId','Descriptions','channel','SalesforceField','Subjects','getFields','Task','clientSecret','username','password','securityToken','remoteUri','substring','lastIndexOf','Connection','clientId','login','isNil','ticketType','describe','OwnerId','IsReminderSet','Subject','Description','int','picklist','boolean','email','textarea','remove','includes','custom','picklistValues','value','True','False','test','error','stringify','statusCode','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'];(function(_0x333999,_0x16301b){var _0xaccdac=function(_0x111bd8){while(--_0x111bd8){_0x333999['push'](_0x333999['shift']());}};_0xaccdac(++_0x16301b);}(_0xe1fc,0x64));var _0xce1f=function(_0x5235dd,_0x3f91cf){_0x5235dd=_0x5235dd-0x0;var _0x13059d=_0xe1fc[_0x5235dd];return _0x13059d;};'use strict';var emlformat=require(_0xce1f('0x0'));var rimraf=require(_0xce1f('0x1'));var zipdir=require(_0xce1f('0x2'));var jsonpatch=require(_0xce1f('0x3'));var rp=require('request-promise');var moment=require(_0xce1f('0x4'));var BPromise=require(_0xce1f('0x5'));var Mustache=require(_0xce1f('0x6'));var util=require(_0xce1f('0x7'));var path=require(_0xce1f('0x8'));var sox=require(_0xce1f('0x9'));var csv=require(_0xce1f('0xa'));var ejs=require(_0xce1f('0xb'));var fs=require('fs');var fs_extra=require(_0xce1f('0xc'));var _=require(_0xce1f('0xd'));var squel=require(_0xce1f('0xe'));var crypto=require(_0xce1f('0xf'));var jsforce=require(_0xce1f('0x10'));var deskjs=require(_0xce1f('0x11'));var toCsv=require(_0xce1f('0xa'));var querystring=require(_0xce1f('0x12'));var Papa=require(_0xce1f('0x13'));var Redis=require('ioredis');var authService=require(_0xce1f('0x14'));var qs=require(_0xce1f('0x15'));var as=require(_0xce1f('0x16'));var hardwareService=require(_0xce1f('0x17'));var logger=require(_0xce1f('0x18'))('api');var utils=require(_0xce1f('0x19'));var config=require(_0xce1f('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xce1f('0x1b'))['db'];var integrations=require(_0xce1f('0x1c'));function respondWithStatusCode(_0x35fc4e,_0x395e0c){_0x395e0c=_0x395e0c||0xcc;return function(_0x35b6a3){if(_0x35b6a3){return _0x35fc4e[_0xce1f('0x1d')](_0x395e0c);}return _0x35fc4e[_0xce1f('0x1e')](_0x395e0c)['end']();};}function respondWithResult(_0x292563,_0x34cccf){_0x34cccf=_0x34cccf||0xc8;return function(_0x355fae){if(_0x355fae){return _0x292563[_0xce1f('0x1e')](_0x34cccf)[_0xce1f('0x1f')](_0x355fae);}};}function respondWithFilteredResult(_0x363d4d,_0x38c130){return function(_0x244e17){if(_0x244e17){var _0x1c9d7f=typeof _0x38c130['offset']===_0xce1f('0x20')&&typeof _0x38c130[_0xce1f('0x21')]===_0xce1f('0x20');var _0x2e7f09=_0x244e17[_0xce1f('0x22')];var _0x349717=_0x1c9d7f?0x0:_0x38c130[_0xce1f('0x23')];var _0x5088d7=_0x1c9d7f?_0x244e17[_0xce1f('0x22')]:_0x38c130[_0xce1f('0x23')]+_0x38c130[_0xce1f('0x21')];var _0x4b6868;if(_0x5088d7>=_0x2e7f09){_0x5088d7=_0x2e7f09;_0x4b6868=0xc8;}else{_0x4b6868=0xce;}_0x363d4d[_0xce1f('0x1e')](_0x4b6868);return _0x363d4d['set']('Content-Range',_0x349717+'-'+_0x5088d7+'/'+_0x2e7f09)[_0xce1f('0x1f')](_0x244e17);}return null;};}function patchUpdates(_0x427f1c){return function(_0x109d20){try{jsonpatch[_0xce1f('0x24')](_0x109d20,_0x427f1c,!![]);}catch(_0x350851){return BPromise[_0xce1f('0x25')](_0x350851);}return _0x109d20[_0xce1f('0x26')]();};}function saveUpdates(_0x1b28de,_0x25ff78){return function(_0x195fe7){if(_0x195fe7){return _0x195fe7[_0xce1f('0x27')](_0x1b28de)['then'](function(_0x96af85){return _0x96af85;});}return null;};}function removeEntity(_0x113e8c,_0x21df44){return function(_0x43aaec){if(_0x43aaec){return _0x43aaec['destroy']()[_0xce1f('0x28')](function(){_0x113e8c[_0xce1f('0x1e')](0xcc)[_0xce1f('0x29')]();});}};}function handleEntityNotFound(_0x375023,_0x2fb73c){return function(_0x5e70cd){if(!_0x5e70cd){_0x375023[_0xce1f('0x1d')](0x194);}return _0x5e70cd;};}function handleError(_0x2a44e3,_0x5352bc){_0x5352bc=_0x5352bc||0x1f4;return function(_0x104a5f){logger['error'](_0x104a5f['stack']);if(_0x104a5f['name']){delete _0x104a5f[_0xce1f('0x2a')];}_0x2a44e3[_0xce1f('0x1e')](_0x5352bc)[_0xce1f('0x2b')](_0x104a5f);};}exports[_0xce1f('0x2c')]=function(_0xa7058d,_0xbb24ec){var _0x1339d8={},_0x143194={},_0x2c7887={'count':0x0,'rows':[]};var _0x127708=_[_0xce1f('0x2d')](db[_0xce1f('0x2e')][_0xce1f('0x2f')],function(_0x2ad583){return{'name':_0x2ad583[_0xce1f('0x30')],'type':_0x2ad583[_0xce1f('0x31')][_0xce1f('0x32')]};});_0x143194[_0xce1f('0x33')]=_[_0xce1f('0x2d')](_0x127708,'name');_0x143194[_0xce1f('0x34')]=_[_0xce1f('0x35')](_0xa7058d[_0xce1f('0x34')]);_0x143194[_0xce1f('0x36')]=_[_0xce1f('0x37')](_0x143194[_0xce1f('0x33')],_0x143194[_0xce1f('0x34')]);_0x1339d8[_0xce1f('0x38')]=_[_0xce1f('0x37')](_0x143194[_0xce1f('0x33')],qs[_0xce1f('0x39')](_0xa7058d[_0xce1f('0x34')][_0xce1f('0x39')]));_0x1339d8[_0xce1f('0x38')]=_0x1339d8[_0xce1f('0x38')][_0xce1f('0x3a')]?_0x1339d8['attributes']:_0x143194[_0xce1f('0x33')];if(!_0xa7058d[_0xce1f('0x34')][_0xce1f('0x3b')]('nolimit')){_0x1339d8[_0xce1f('0x21')]=qs[_0xce1f('0x21')](_0xa7058d['query'][_0xce1f('0x21')]);_0x1339d8['offset']=qs['offset'](_0xa7058d['query']['offset']);}_0x1339d8[_0xce1f('0x3c')]=qs[_0xce1f('0x3d')](_0xa7058d[_0xce1f('0x34')][_0xce1f('0x3d')]);_0x1339d8[_0xce1f('0x3e')]=qs['filters'](_[_0xce1f('0x3f')](_0xa7058d[_0xce1f('0x34')],_0x143194[_0xce1f('0x36')]),_0x127708);if(_0xa7058d[_0xce1f('0x34')][_0xce1f('0x40')]){_0x1339d8[_0xce1f('0x3e')]=_[_0xce1f('0x41')](_0x1339d8[_0xce1f('0x3e')],{'$or':_[_0xce1f('0x2d')](_0x127708,function(_0x14e0ab){if(_0x14e0ab[_0xce1f('0x31')]!=='VIRTUAL'){var _0x150334={};_0x150334[_0x14e0ab['name']]={'$like':'%'+_0xa7058d['query'][_0xce1f('0x40')]+'%'};return _0x150334;}})});}_0x1339d8=_[_0xce1f('0x41')]({},_0x1339d8,_0xa7058d[_0xce1f('0x42')]);var _0x2260a4={'where':_0x1339d8[_0xce1f('0x3e')]};return db[_0xce1f('0x2e')][_0xce1f('0x22')](_0x2260a4)['then'](function(_0x152ded){_0x2c7887[_0xce1f('0x22')]=_0x152ded;if(_0xa7058d[_0xce1f('0x34')][_0xce1f('0x43')]){_0x1339d8[_0xce1f('0x44')]=[{'all':!![]}];}return db[_0xce1f('0x2e')][_0xce1f('0x45')](_0x1339d8);})[_0xce1f('0x28')](function(_0x3233e3){_0x2c7887['rows']=_0x3233e3;return _0x2c7887;})[_0xce1f('0x28')](respondWithFilteredResult(_0xbb24ec,_0x1339d8))[_0xce1f('0x46')](handleError(_0xbb24ec,null));};exports['show']=function(_0x23c141,_0x5ed872){var _0xf3db51={'raw':![],'where':{'id':_0x23c141[_0xce1f('0x47')]['id']}},_0x89998c={};_0x89998c[_0xce1f('0x33')]=_[_0xce1f('0x35')](db['SalesforceAccount']['rawAttributes']);_0x89998c['query']=_['keys'](_0x23c141[_0xce1f('0x34')]);_0x89998c[_0xce1f('0x36')]=_[_0xce1f('0x37')](_0x89998c[_0xce1f('0x33')],_0x89998c[_0xce1f('0x34')]);_0xf3db51[_0xce1f('0x38')]=_[_0xce1f('0x37')](_0x89998c[_0xce1f('0x33')],qs[_0xce1f('0x39')](_0x23c141[_0xce1f('0x34')][_0xce1f('0x39')]));_0xf3db51['attributes']=_0xf3db51[_0xce1f('0x38')][_0xce1f('0x3a')]?_0xf3db51[_0xce1f('0x38')]:_0x89998c['model'];if(_0x23c141['query']['includeAll']){_0xf3db51['include']=[{'all':!![]}];}_0xf3db51=_[_0xce1f('0x41')]({},_0xf3db51,_0x23c141[_0xce1f('0x42')]);return db[_0xce1f('0x2e')][_0xce1f('0x48')](_0xf3db51)[_0xce1f('0x28')](handleEntityNotFound(_0x5ed872,null))[_0xce1f('0x28')](respondWithResult(_0x5ed872,null))[_0xce1f('0x46')](handleError(_0x5ed872,null));};exports[_0xce1f('0x49')]=function(_0x4423dc,_0x316159){return db[_0xce1f('0x2e')]['create'](_0x4423dc[_0xce1f('0x4a')],{})[_0xce1f('0x28')](respondWithResult(_0x316159,0xc9))['catch'](handleError(_0x316159,null));};exports['update']=function(_0x3d5d8d,_0x35c84d){if(_0x3d5d8d[_0xce1f('0x4a')]['id']){delete _0x3d5d8d[_0xce1f('0x4a')]['id'];}return db[_0xce1f('0x2e')][_0xce1f('0x48')]({'where':{'id':_0x3d5d8d[_0xce1f('0x47')]['id']}})[_0xce1f('0x28')](handleEntityNotFound(_0x35c84d,null))[_0xce1f('0x28')](saveUpdates(_0x3d5d8d[_0xce1f('0x4a')],null))[_0xce1f('0x28')](respondWithResult(_0x35c84d,null))['catch'](handleError(_0x35c84d,null));};exports['destroy']=function(_0x5e8862,_0x3935c0){return db[_0xce1f('0x2e')][_0xce1f('0x48')]({'where':{'id':_0x5e8862[_0xce1f('0x47')]['id']}})['then'](handleEntityNotFound(_0x3935c0,null))[_0xce1f('0x28')](removeEntity(_0x3935c0,null))[_0xce1f('0x46')](handleError(_0x3935c0,null));};exports[_0xce1f('0x4b')]=function(_0x187acd,_0x2dd0f4,_0x25a1d1){var _0xcfcf2={};var _0xbafc94={};var _0x6b8bb9;var _0x1fa5b2;return db[_0xce1f('0x2e')][_0xce1f('0x4c')]({'where':{'id':_0x187acd[_0xce1f('0x47')]['id']}})['then'](handleEntityNotFound(_0x2dd0f4,null))['then'](function(_0x3e546f){if(_0x3e546f){_0x6b8bb9=_0x3e546f;_0xbafc94['model']=_[_0xce1f('0x35')](db[_0xce1f('0x4d')][_0xce1f('0x2f')]);_0xbafc94[_0xce1f('0x34')]=_[_0xce1f('0x35')](_0x187acd[_0xce1f('0x34')]);_0xbafc94[_0xce1f('0x36')]=_[_0xce1f('0x37')](_0xbafc94[_0xce1f('0x33')],_0xbafc94[_0xce1f('0x34')]);_0xcfcf2[_0xce1f('0x38')]=_['intersection'](_0xbafc94[_0xce1f('0x33')],qs[_0xce1f('0x39')](_0x187acd[_0xce1f('0x34')][_0xce1f('0x39')]));_0xcfcf2[_0xce1f('0x38')]=_0xcfcf2[_0xce1f('0x38')][_0xce1f('0x3a')]?_0xcfcf2[_0xce1f('0x38')]:_0xbafc94[_0xce1f('0x33')];_0xcfcf2['order']=qs[_0xce1f('0x3d')](_0x187acd[_0xce1f('0x34')][_0xce1f('0x3d')]);_0xcfcf2[_0xce1f('0x3e')]=qs[_0xce1f('0x36')](_[_0xce1f('0x3f')](_0x187acd[_0xce1f('0x34')],_0xbafc94[_0xce1f('0x36')]));if(_0x187acd[_0xce1f('0x34')][_0xce1f('0x40')]){_0xcfcf2[_0xce1f('0x3e')]=_['merge'](_0xcfcf2[_0xce1f('0x3e')],{'$or':_['map'](_0xcfcf2[_0xce1f('0x38')],function(_0x4caf1f){var _0x379d5a={};_0x379d5a[_0x4caf1f]={'$like':'%'+_0x187acd[_0xce1f('0x34')][_0xce1f('0x40')]+'%'};return _0x379d5a;})});}_0xcfcf2=_['merge']({},_0xcfcf2,_0x187acd[_0xce1f('0x42')]);return _0x6b8bb9['getConfigurations'](_0xcfcf2);}})[_0xce1f('0x28')](function(_0x211364){if(_0x211364){_0x1fa5b2=_0x211364['length'];if(!_0x187acd['query'][_0xce1f('0x3b')]('nolimit')){_0xcfcf2[_0xce1f('0x21')]=qs[_0xce1f('0x21')](_0x187acd[_0xce1f('0x34')]['limit']);_0xcfcf2[_0xce1f('0x23')]=qs['offset'](_0x187acd[_0xce1f('0x34')][_0xce1f('0x23')]);}return _0x6b8bb9[_0xce1f('0x4b')](_0xcfcf2);}})[_0xce1f('0x28')](function(_0x4eac4e){if(_0x4eac4e){return _0x4eac4e?{'count':_0x1fa5b2,'rows':_0x4eac4e}:null;}})[_0xce1f('0x28')](respondWithResult(_0x2dd0f4,null))[_0xce1f('0x46')](handleError(_0x2dd0f4,null));};exports['addConfiguration']=function(_0x50e947,_0x6d48ae,_0x2e8b75){if(_0x50e947[_0xce1f('0x4a')]['id']){delete _0x50e947['body']['id'];}return db[_0xce1f('0x2e')][_0xce1f('0x4c')]({'where':{'id':_0x50e947['params']['id']}})[_0xce1f('0x28')](handleEntityNotFound(_0x6d48ae,null))['then'](function(_0x202660){if(_0x202660){_0x50e947[_0xce1f('0x4a')][_0xce1f('0x4e')]=_0x202660['id'];_0x50e947[_0xce1f('0x4a')]['Subjects']=integrations['getSubjects'](_0x50e947[_0xce1f('0x4a')]['channel'],_0x50e947['body'][_0xce1f('0x31')]);_0x50e947[_0xce1f('0x4a')][_0xce1f('0x4f')]=integrations['getDescriptions'](_0x50e947['body'][_0xce1f('0x50')],_0x50e947[_0xce1f('0x4a')]['type']);return db[_0xce1f('0x4d')][_0xce1f('0x49')](_0x50e947[_0xce1f('0x4a')],{'include':[{'model':db[_0xce1f('0x51')],'as':_0xce1f('0x52')},{'model':db[_0xce1f('0x51')],'as':'Descriptions'}]});}return null;})[_0xce1f('0x28')](respondWithResult(_0x6d48ae,null))[_0xce1f('0x46')](handleError(_0x6d48ae,null));};exports[_0xce1f('0x53')]=function(_0x5269a7,_0x5bf790,_0x4eea4e){var _0x13648d;var _0x57b9e3='';var _0x51b497=_0xce1f('0x54');return db[_0xce1f('0x2e')]['findOne']({'where':{'id':_0x5269a7[_0xce1f('0x47')]['id']},'attributes':['id','remoteUri','clientId',_0xce1f('0x55'),_0xce1f('0x56'),_0xce1f('0x57'),_0xce1f('0x58')]})[_0xce1f('0x28')](handleEntityNotFound(_0x5bf790,null))[_0xce1f('0x28')](function(_0x4c5805){if(_0x4c5805){_0x57b9e3=_0x4c5805[_0xce1f('0x59')];var _0x4a80ea=_0x57b9e3['slice'](-0x1);if(_0x4a80ea==='/'){_0x57b9e3=_0x57b9e3[_0xce1f('0x5a')](0x0,_0x57b9e3[_0xce1f('0x5b')](_0x4a80ea));}_0x13648d=new jsforce[(_0xce1f('0x5c'))]({'oauth2':{'loginUrl':_0x57b9e3,'clientId':_0x4c5805[_0xce1f('0x5d')],'clientSecret':_0x4c5805['clientSecret']}});return _0x13648d[_0xce1f('0x5e')](_0x4c5805[_0xce1f('0x56')],_0x4c5805[_0xce1f('0x57')]['concat'](_0x4c5805['securityToken']));}})['then'](function(_0x4e37d4){if(_0x4e37d4){if(!_[_0xce1f('0x5f')](_0x5269a7[_0xce1f('0x34')][_0xce1f('0x60')])){_0x51b497=_0x5269a7[_0xce1f('0x34')]['ticketType'];}return _0x13648d['sobject'](_0x51b497)[_0xce1f('0x61')]();}})[_0xce1f('0x28')](function(_0x49a98c){var _0x17b27a=[_0xce1f('0x62'),'ActivityDate',_0xce1f('0x63'),'IsRecurrence',_0xce1f('0x64'),_0xce1f('0x65')];var _0x1f9d18=['string',_0xce1f('0x66'),_0xce1f('0x67'),_0xce1f('0x68'),_0xce1f('0x69'),_0xce1f('0x6a'),'phone'];if(_0x49a98c){_[_0xce1f('0x6b')](_0x49a98c[_0xce1f('0x39')],function(_0x314b31){return _0x17b27a['includes'](_0x314b31[_0xce1f('0x2a')])||!_0x1f9d18[_0xce1f('0x6c')](_0x314b31[_0xce1f('0x31')]);});return{'count':_0x49a98c['fields'][_0xce1f('0x3a')],'rows':_['map'](_0x49a98c[_0xce1f('0x39')],function(_0x35a4d3){return{'id':_0x35a4d3[_0xce1f('0x2a')],'name':_0x35a4d3['label'],'custom':_0x35a4d3[_0xce1f('0x6d')],'options':_0x35a4d3[_0xce1f('0x6e')]['length']>0x0?_['map'](_0x35a4d3[_0xce1f('0x6e')],function(_0x5d9db5){return{'name':_0x5d9db5['label'],'value':_0x5d9db5[_0xce1f('0x6f')]};}):_0x35a4d3[_0xce1f('0x31')]==_0xce1f('0x68')?[{'name':_0xce1f('0x70'),'value':'true'},{'name':_0xce1f('0x71'),'value':'false'}]:[]};})};}})[_0xce1f('0x28')](respondWithResult(_0x5bf790,null))[_0xce1f('0x46')](function(_0x136849){var _0x1b7a88=_0x5269a7[_0xce1f('0x34')][_0xce1f('0x72')]?0x1f4:_0x136849['statusCode']||0x1f4;logger[_0xce1f('0x73')]('getFields,\x20%s,\x20%s,\x20%s',_0xce1f('0x53'),_0x1b7a88,JSON[_0xce1f('0x74')](_0x136849));delete _0x136849['name'];if(_0x1b7a88===0x191){_0x1b7a88=0x190;}_0x5bf790[_0xce1f('0x1e')](_0x1b7a88)[_0xce1f('0x2b')](_0x5269a7[_0xce1f('0x34')][_0xce1f('0x72')]?{'message':'Wrong\x20credentials','statusCode':_0x136849[_0xce1f('0x75')]}:_0x136849);});}; \ No newline at end of file +var _0x4dab=['order','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','Subjects','getFields','Task','remoteUri','clientId','password','slice','substring','lastIndexOf','clientSecret','login','username','securityToken','isNil','ticketType','describe','OwnerId','IsReminderSet','IsRecurrence','Subject','Description','string','int','boolean','textarea','phone','remove','includes','custom','picklistValues','label','value','true','False','false','statusCode','stringify','test','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','then','destroy','error','name','send','index','map','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','SalesforceAccount','includeAll','include','findAll','rows','show','options','find','create','catch','update','body','params','getConfigurations','findOne','SalesforceConfiguration'];(function(_0x191d70,_0x18c726){var _0x2133fa=function(_0x1cdad5){while(--_0x1cdad5){_0x191d70['push'](_0x191d70['shift']());}};_0x2133fa(++_0x18c726);}(_0x4dab,0xad));var _0xb4da=function(_0x56f220,_0x9e6544){_0x56f220=_0x56f220-0x0;var _0x187aaa=_0x4dab[_0x56f220];return _0x187aaa;};'use strict';var emlformat=require(_0xb4da('0x0'));var rimraf=require(_0xb4da('0x1'));var zipdir=require(_0xb4da('0x2'));var jsonpatch=require(_0xb4da('0x3'));var rp=require(_0xb4da('0x4'));var moment=require(_0xb4da('0x5'));var BPromise=require(_0xb4da('0x6'));var Mustache=require(_0xb4da('0x7'));var util=require(_0xb4da('0x8'));var path=require(_0xb4da('0x9'));var sox=require(_0xb4da('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb4da('0xb'));var _=require(_0xb4da('0xc'));var squel=require(_0xb4da('0xd'));var crypto=require(_0xb4da('0xe'));var jsforce=require(_0xb4da('0xf'));var deskjs=require(_0xb4da('0x10'));var toCsv=require(_0xb4da('0x11'));var querystring=require('querystring');var Papa=require(_0xb4da('0x12'));var Redis=require(_0xb4da('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xb4da('0x14'));var as=require(_0xb4da('0x15'));var hardwareService=require(_0xb4da('0x16'));var logger=require(_0xb4da('0x17'))('api');var utils=require(_0xb4da('0x18'));var config=require(_0xb4da('0x19'));var licenseUtil=require(_0xb4da('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require(_0xb4da('0x1b'));function respondWithStatusCode(_0x344ffa,_0x552adb){_0x552adb=_0x552adb||0xcc;return function(_0x59a600){if(_0x59a600){return _0x344ffa[_0xb4da('0x1c')](_0x552adb);}return _0x344ffa[_0xb4da('0x1d')](_0x552adb)[_0xb4da('0x1e')]();};}function respondWithResult(_0x31a4bb,_0x7c994b){_0x7c994b=_0x7c994b||0xc8;return function(_0x45c9af){if(_0x45c9af){return _0x31a4bb[_0xb4da('0x1d')](_0x7c994b)[_0xb4da('0x1f')](_0x45c9af);}};}function respondWithFilteredResult(_0x451798,_0xc5fb72){return function(_0x5d48b3){if(_0x5d48b3){var _0x3219f2=typeof _0xc5fb72[_0xb4da('0x20')]===_0xb4da('0x21')&&typeof _0xc5fb72['limit']===_0xb4da('0x21');var _0x2a5279=_0x5d48b3[_0xb4da('0x22')];var _0x878508=_0x3219f2?0x0:_0xc5fb72['offset'];var _0x38bb1=_0x3219f2?_0x5d48b3['count']:_0xc5fb72[_0xb4da('0x20')]+_0xc5fb72[_0xb4da('0x23')];var _0x215d9e;if(_0x38bb1>=_0x2a5279){_0x38bb1=_0x2a5279;_0x215d9e=0xc8;}else{_0x215d9e=0xce;}_0x451798[_0xb4da('0x1d')](_0x215d9e);return _0x451798[_0xb4da('0x24')](_0xb4da('0x25'),_0x878508+'-'+_0x38bb1+'/'+_0x2a5279)['json'](_0x5d48b3);}return null;};}function patchUpdates(_0x18f843){return function(_0x62918f){try{jsonpatch[_0xb4da('0x26')](_0x62918f,_0x18f843,!![]);}catch(_0x4cb726){return BPromise[_0xb4da('0x27')](_0x4cb726);}return _0x62918f['save']();};}function saveUpdates(_0x25bae4,_0x5abf4e){return function(_0x4d1134){if(_0x4d1134){return _0x4d1134['update'](_0x25bae4)[_0xb4da('0x28')](function(_0x4acbee){return _0x4acbee;});}return null;};}function removeEntity(_0x1cdbcb,_0x2ce684){return function(_0x2dcd5c){if(_0x2dcd5c){return _0x2dcd5c[_0xb4da('0x29')]()[_0xb4da('0x28')](function(){_0x1cdbcb[_0xb4da('0x1d')](0xcc)[_0xb4da('0x1e')]();});}};}function handleEntityNotFound(_0x1f1886,_0x42f96b){return function(_0x22d2a9){if(!_0x22d2a9){_0x1f1886[_0xb4da('0x1c')](0x194);}return _0x22d2a9;};}function handleError(_0x5c8594,_0x39e7e9){_0x39e7e9=_0x39e7e9||0x1f4;return function(_0x444996){logger[_0xb4da('0x2a')](_0x444996['stack']);if(_0x444996[_0xb4da('0x2b')]){delete _0x444996['name'];}_0x5c8594[_0xb4da('0x1d')](_0x39e7e9)[_0xb4da('0x2c')](_0x444996);};}exports[_0xb4da('0x2d')]=function(_0x1ba154,_0x30c232){var _0x1492d6={},_0x3278c5={},_0x43092f={'count':0x0,'rows':[]};var _0x2ef16c=_[_0xb4da('0x2e')](db['SalesforceAccount'][_0xb4da('0x2f')],function(_0x10c003){return{'name':_0x10c003['fieldName'],'type':_0x10c003[_0xb4da('0x30')][_0xb4da('0x31')]};});_0x3278c5[_0xb4da('0x32')]=_[_0xb4da('0x2e')](_0x2ef16c,_0xb4da('0x2b'));_0x3278c5['query']=_[_0xb4da('0x33')](_0x1ba154[_0xb4da('0x34')]);_0x3278c5[_0xb4da('0x35')]=_[_0xb4da('0x36')](_0x3278c5[_0xb4da('0x32')],_0x3278c5[_0xb4da('0x34')]);_0x1492d6[_0xb4da('0x37')]=_['intersection'](_0x3278c5[_0xb4da('0x32')],qs[_0xb4da('0x38')](_0x1ba154[_0xb4da('0x34')]['fields']));_0x1492d6[_0xb4da('0x37')]=_0x1492d6['attributes'][_0xb4da('0x39')]?_0x1492d6['attributes']:_0x3278c5[_0xb4da('0x32')];if(!_0x1ba154[_0xb4da('0x34')][_0xb4da('0x3a')](_0xb4da('0x3b'))){_0x1492d6[_0xb4da('0x23')]=qs[_0xb4da('0x23')](_0x1ba154[_0xb4da('0x34')][_0xb4da('0x23')]);_0x1492d6['offset']=qs[_0xb4da('0x20')](_0x1ba154[_0xb4da('0x34')][_0xb4da('0x20')]);}_0x1492d6['order']=qs['sort'](_0x1ba154[_0xb4da('0x34')][_0xb4da('0x3c')]);_0x1492d6['where']=qs[_0xb4da('0x35')](_[_0xb4da('0x3d')](_0x1ba154[_0xb4da('0x34')],_0x3278c5[_0xb4da('0x35')]),_0x2ef16c);if(_0x1ba154[_0xb4da('0x34')][_0xb4da('0x3e')]){_0x1492d6[_0xb4da('0x3f')]=_[_0xb4da('0x40')](_0x1492d6[_0xb4da('0x3f')],{'$or':_[_0xb4da('0x2e')](_0x2ef16c,function(_0x3bffce){if(_0x3bffce[_0xb4da('0x30')]!=='VIRTUAL'){var _0x4f0776={};_0x4f0776[_0x3bffce[_0xb4da('0x2b')]]={'$like':'%'+_0x1ba154[_0xb4da('0x34')][_0xb4da('0x3e')]+'%'};return _0x4f0776;}})});}_0x1492d6=_[_0xb4da('0x40')]({},_0x1492d6,_0x1ba154['options']);var _0x5646fb={'where':_0x1492d6[_0xb4da('0x3f')]};return db[_0xb4da('0x41')][_0xb4da('0x22')](_0x5646fb)[_0xb4da('0x28')](function(_0x94bd){_0x43092f[_0xb4da('0x22')]=_0x94bd;if(_0x1ba154[_0xb4da('0x34')][_0xb4da('0x42')]){_0x1492d6[_0xb4da('0x43')]=[{'all':!![]}];}return db[_0xb4da('0x41')][_0xb4da('0x44')](_0x1492d6);})['then'](function(_0x5b4ac5){_0x43092f[_0xb4da('0x45')]=_0x5b4ac5;return _0x43092f;})[_0xb4da('0x28')](respondWithFilteredResult(_0x30c232,_0x1492d6))['catch'](handleError(_0x30c232,null));};exports[_0xb4da('0x46')]=function(_0x567d11,_0x4c2b73){var _0xb056b7={'raw':![],'where':{'id':_0x567d11['params']['id']}},_0x25873e={};_0x25873e['model']=_[_0xb4da('0x33')](db[_0xb4da('0x41')]['rawAttributes']);_0x25873e[_0xb4da('0x34')]=_['keys'](_0x567d11['query']);_0x25873e[_0xb4da('0x35')]=_['intersection'](_0x25873e[_0xb4da('0x32')],_0x25873e['query']);_0xb056b7[_0xb4da('0x37')]=_[_0xb4da('0x36')](_0x25873e['model'],qs[_0xb4da('0x38')](_0x567d11['query'][_0xb4da('0x38')]));_0xb056b7[_0xb4da('0x37')]=_0xb056b7[_0xb4da('0x37')][_0xb4da('0x39')]?_0xb056b7[_0xb4da('0x37')]:_0x25873e['model'];if(_0x567d11['query'][_0xb4da('0x42')]){_0xb056b7[_0xb4da('0x43')]=[{'all':!![]}];}_0xb056b7=_[_0xb4da('0x40')]({},_0xb056b7,_0x567d11[_0xb4da('0x47')]);return db[_0xb4da('0x41')][_0xb4da('0x48')](_0xb056b7)[_0xb4da('0x28')](handleEntityNotFound(_0x4c2b73,null))[_0xb4da('0x28')](respondWithResult(_0x4c2b73,null))['catch'](handleError(_0x4c2b73,null));};exports[_0xb4da('0x49')]=function(_0x2afb25,_0x2acc4f){return db[_0xb4da('0x41')]['create'](_0x2afb25['body'],{})[_0xb4da('0x28')](respondWithResult(_0x2acc4f,0xc9))[_0xb4da('0x4a')](handleError(_0x2acc4f,null));};exports[_0xb4da('0x4b')]=function(_0x175762,_0x2b766f){if(_0x175762['body']['id']){delete _0x175762[_0xb4da('0x4c')]['id'];}return db['SalesforceAccount']['find']({'where':{'id':_0x175762[_0xb4da('0x4d')]['id']}})[_0xb4da('0x28')](handleEntityNotFound(_0x2b766f,null))['then'](saveUpdates(_0x175762[_0xb4da('0x4c')],null))[_0xb4da('0x28')](respondWithResult(_0x2b766f,null))[_0xb4da('0x4a')](handleError(_0x2b766f,null));};exports['destroy']=function(_0x669f9d,_0x306f13){return db['SalesforceAccount'][_0xb4da('0x48')]({'where':{'id':_0x669f9d['params']['id']}})[_0xb4da('0x28')](handleEntityNotFound(_0x306f13,null))[_0xb4da('0x28')](removeEntity(_0x306f13,null))[_0xb4da('0x4a')](handleError(_0x306f13,null));};exports[_0xb4da('0x4e')]=function(_0x394ac1,_0x2f170f,_0x1282d1){var _0x29379b={};var _0x3ce9f8={};var _0x53f43d;var _0x4893ef;return db[_0xb4da('0x41')][_0xb4da('0x4f')]({'where':{'id':_0x394ac1[_0xb4da('0x4d')]['id']}})[_0xb4da('0x28')](handleEntityNotFound(_0x2f170f,null))[_0xb4da('0x28')](function(_0x60f892){if(_0x60f892){_0x53f43d=_0x60f892;_0x3ce9f8[_0xb4da('0x32')]=_[_0xb4da('0x33')](db[_0xb4da('0x50')][_0xb4da('0x2f')]);_0x3ce9f8['query']=_[_0xb4da('0x33')](_0x394ac1['query']);_0x3ce9f8[_0xb4da('0x35')]=_[_0xb4da('0x36')](_0x3ce9f8[_0xb4da('0x32')],_0x3ce9f8['query']);_0x29379b[_0xb4da('0x37')]=_[_0xb4da('0x36')](_0x3ce9f8[_0xb4da('0x32')],qs[_0xb4da('0x38')](_0x394ac1['query']['fields']));_0x29379b[_0xb4da('0x37')]=_0x29379b[_0xb4da('0x37')][_0xb4da('0x39')]?_0x29379b[_0xb4da('0x37')]:_0x3ce9f8[_0xb4da('0x32')];_0x29379b[_0xb4da('0x51')]=qs['sort'](_0x394ac1[_0xb4da('0x34')][_0xb4da('0x3c')]);_0x29379b['where']=qs[_0xb4da('0x35')](_[_0xb4da('0x3d')](_0x394ac1['query'],_0x3ce9f8[_0xb4da('0x35')]));if(_0x394ac1[_0xb4da('0x34')][_0xb4da('0x3e')]){_0x29379b[_0xb4da('0x3f')]=_[_0xb4da('0x40')](_0x29379b['where'],{'$or':_[_0xb4da('0x2e')](_0x29379b[_0xb4da('0x37')],function(_0xaa1eea){var _0x2da14b={};_0x2da14b[_0xaa1eea]={'$like':'%'+_0x394ac1['query'][_0xb4da('0x3e')]+'%'};return _0x2da14b;})});}_0x29379b=_[_0xb4da('0x40')]({},_0x29379b,_0x394ac1[_0xb4da('0x47')]);return _0x53f43d['getConfigurations'](_0x29379b);}})[_0xb4da('0x28')](function(_0x59f582){if(_0x59f582){_0x4893ef=_0x59f582[_0xb4da('0x39')];if(!_0x394ac1[_0xb4da('0x34')][_0xb4da('0x3a')](_0xb4da('0x3b'))){_0x29379b[_0xb4da('0x23')]=qs[_0xb4da('0x23')](_0x394ac1[_0xb4da('0x34')][_0xb4da('0x23')]);_0x29379b[_0xb4da('0x20')]=qs[_0xb4da('0x20')](_0x394ac1[_0xb4da('0x34')][_0xb4da('0x20')]);}return _0x53f43d[_0xb4da('0x4e')](_0x29379b);}})['then'](function(_0x3dbbf7){if(_0x3dbbf7){return _0x3dbbf7?{'count':_0x4893ef,'rows':_0x3dbbf7}:null;}})[_0xb4da('0x28')](respondWithResult(_0x2f170f,null))[_0xb4da('0x4a')](handleError(_0x2f170f,null));};exports[_0xb4da('0x52')]=function(_0x1ad4e1,_0x2d67be,_0x1e2ba8){if(_0x1ad4e1[_0xb4da('0x4c')]['id']){delete _0x1ad4e1[_0xb4da('0x4c')]['id'];}return db[_0xb4da('0x41')][_0xb4da('0x4f')]({'where':{'id':_0x1ad4e1[_0xb4da('0x4d')]['id']}})[_0xb4da('0x28')](handleEntityNotFound(_0x2d67be,null))[_0xb4da('0x28')](function(_0x45e1eb){if(_0x45e1eb){_0x1ad4e1['body'][_0xb4da('0x53')]=_0x45e1eb['id'];_0x1ad4e1[_0xb4da('0x4c')]['Subjects']=integrations[_0xb4da('0x54')](_0x1ad4e1[_0xb4da('0x4c')][_0xb4da('0x55')],_0x1ad4e1[_0xb4da('0x4c')][_0xb4da('0x30')]);_0x1ad4e1['body'][_0xb4da('0x56')]=integrations[_0xb4da('0x57')](_0x1ad4e1[_0xb4da('0x4c')][_0xb4da('0x55')],_0x1ad4e1['body'][_0xb4da('0x30')]);return db[_0xb4da('0x50')]['create'](_0x1ad4e1[_0xb4da('0x4c')],{'include':[{'model':db[_0xb4da('0x58')],'as':_0xb4da('0x59')},{'model':db[_0xb4da('0x58')],'as':_0xb4da('0x56')}]});}return null;})[_0xb4da('0x28')](respondWithResult(_0x2d67be,null))[_0xb4da('0x4a')](handleError(_0x2d67be,null));};exports[_0xb4da('0x5a')]=function(_0x42dea2,_0x37a2bf,_0x3af2fd){var _0x3ceea9;var _0xbc678f='';var _0x3301c2=_0xb4da('0x5b');return db['SalesforceAccount'][_0xb4da('0x4f')]({'where':{'id':_0x42dea2[_0xb4da('0x4d')]['id']},'attributes':['id',_0xb4da('0x5c'),_0xb4da('0x5d'),'clientSecret','username',_0xb4da('0x5e'),'securityToken']})[_0xb4da('0x28')](handleEntityNotFound(_0x37a2bf,null))['then'](function(_0x498e64){if(_0x498e64){_0xbc678f=_0x498e64[_0xb4da('0x5c')];var _0x525e34=_0xbc678f[_0xb4da('0x5f')](-0x1);if(_0x525e34==='/'){_0xbc678f=_0xbc678f[_0xb4da('0x60')](0x0,_0xbc678f[_0xb4da('0x61')](_0x525e34));}_0x3ceea9=new jsforce['Connection']({'oauth2':{'loginUrl':_0xbc678f,'clientId':_0x498e64[_0xb4da('0x5d')],'clientSecret':_0x498e64[_0xb4da('0x62')]}});return _0x3ceea9[_0xb4da('0x63')](_0x498e64[_0xb4da('0x64')],_0x498e64[_0xb4da('0x5e')]['concat'](_0x498e64[_0xb4da('0x65')]));}})[_0xb4da('0x28')](function(_0x1bf96c){if(_0x1bf96c){if(!_[_0xb4da('0x66')](_0x42dea2[_0xb4da('0x34')][_0xb4da('0x67')])){_0x3301c2=_0x42dea2[_0xb4da('0x34')][_0xb4da('0x67')];}return _0x3ceea9['sobject'](_0x3301c2)[_0xb4da('0x68')]();}})[_0xb4da('0x28')](function(_0x461b97){var _0x243608=[_0xb4da('0x69'),'ActivityDate',_0xb4da('0x6a'),_0xb4da('0x6b'),_0xb4da('0x6c'),_0xb4da('0x6d')];var _0x55a9e4=[_0xb4da('0x6e'),_0xb4da('0x6f'),'picklist',_0xb4da('0x70'),'email',_0xb4da('0x71'),_0xb4da('0x72')];if(_0x461b97){_[_0xb4da('0x73')](_0x461b97[_0xb4da('0x38')],function(_0x164253){return _0x243608[_0xb4da('0x74')](_0x164253[_0xb4da('0x2b')])||!_0x55a9e4[_0xb4da('0x74')](_0x164253[_0xb4da('0x30')]);});return{'count':_0x461b97['fields'][_0xb4da('0x39')],'rows':_[_0xb4da('0x2e')](_0x461b97[_0xb4da('0x38')],function(_0x1ecd83){return{'id':_0x1ecd83[_0xb4da('0x2b')],'name':_0x1ecd83['label'],'custom':_0x1ecd83[_0xb4da('0x75')],'options':_0x1ecd83[_0xb4da('0x76')][_0xb4da('0x39')]>0x0?_[_0xb4da('0x2e')](_0x1ecd83['picklistValues'],function(_0x5731e1){return{'name':_0x5731e1[_0xb4da('0x77')],'value':_0x5731e1[_0xb4da('0x78')]};}):_0x1ecd83[_0xb4da('0x30')]==_0xb4da('0x70')?[{'name':'True','value':_0xb4da('0x79')},{'name':_0xb4da('0x7a'),'value':_0xb4da('0x7b')}]:[]};})};}})['then'](respondWithResult(_0x37a2bf,null))['catch'](function(_0x4dd415){var _0x6a8e08=_0x42dea2[_0xb4da('0x34')]['test']?0x1f4:_0x4dd415[_0xb4da('0x7c')]||0x1f4;logger[_0xb4da('0x2a')]('getFields,\x20%s,\x20%s,\x20%s',_0xb4da('0x5a'),_0x6a8e08,JSON[_0xb4da('0x7d')](_0x4dd415));delete _0x4dd415[_0xb4da('0x2b')];if(_0x6a8e08===0x191){_0x6a8e08=0x190;}_0x37a2bf['status'](_0x6a8e08)[_0xb4da('0x2c')](_0x42dea2[_0xb4da('0x34')][_0xb4da('0x7e')]?{'message':'Wrong\x20credentials','statusCode':_0x4dd415[_0xb4da('0x7c')]}:_0x4dd415);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 6d9f6a1..07e0ebb 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 _0x5d6c=['bluebird','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','lodash','../../config/logger','api','moment'];(function(_0x593992,_0x32a738){var _0xee2202=function(_0x3c4e7d){while(--_0x3c4e7d){_0x593992['push'](_0x593992['shift']());}};_0xee2202(++_0x32a738);}(_0x5d6c,0x100));var _0xc5d6=function(_0x1ac6fb,_0x49336e){_0x1ac6fb=_0x1ac6fb-0x0;var _0x3644a8=_0x5d6c[_0x1ac6fb];return _0x3644a8;};'use strict';var _=require(_0xc5d6('0x0'));var util=require('util');var logger=require(_0xc5d6('0x1'))(_0xc5d6('0x2'));var moment=require(_0xc5d6('0x3'));var BPromise=require(_0xc5d6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc5d6('0x5'));var rimraf=require(_0xc5d6('0x6'));var config=require(_0xc5d6('0x7'));var attributes=require(_0xc5d6('0x8'));var integrations=require(_0xc5d6('0x9'));module[_0xc5d6('0xa')]=function(_0x86be35,_0x41bf4c){return _0x86be35[_0xc5d6('0xb')](_0xc5d6('0xc'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc078=['int_salesforce_accounts','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount'];(function(_0x39f309,_0x15a64c){var _0x584700=function(_0x484467){while(--_0x484467){_0x39f309['push'](_0x39f309['shift']());}};_0x584700(++_0x15a64c);}(_0xc078,0xfd));var _0x8c07=function(_0x4f3378,_0x249480){_0x4f3378=_0x4f3378-0x0;var _0x2fad35=_0xc078[_0x4f3378];return _0x2fad35;};'use strict';var _=require('lodash');var util=require(_0x8c07('0x0'));var logger=require(_0x8c07('0x1'))(_0x8c07('0x2'));var moment=require(_0x8c07('0x3'));var BPromise=require(_0x8c07('0x4'));var rp=require(_0x8c07('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8c07('0x6'));var config=require(_0x8c07('0x7'));var attributes=require(_0x8c07('0x8'));var integrations=require(_0x8c07('0x9'));module[_0x8c07('0xa')]=function(_0x585966,_0x57d02b){return _0x585966[_0x8c07('0xb')](_0x8c07('0xc'),attributes,{'tableName':_0x8c07('0xd'),'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 e5262db..dcaf583 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 _0xfca3=['where','include','model','attributes','map','GetSalesforceAccount','ShowSalesforceAccount','find','lodash','util','bluebird','ioredis','../../mysqldb','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SalesforceAccount','findAll','options','raw'];(function(_0xf583cd,_0x202b5c){var _0x188a14=function(_0xb94539){while(--_0xb94539){_0xf583cd['push'](_0xf583cd['shift']());}};_0x188a14(++_0x202b5c);}(_0xfca3,0x110));var _0x3fca=function(_0x18d4d7,_0x1b893c){_0x18d4d7=_0x18d4d7-0x0;var _0x1f6a0c=_0xfca3[_0x18d4d7];return _0x1f6a0c;};'use strict';var _=require(_0x3fca('0x0'));var util=require(_0x3fca('0x1'));var moment=require('moment');var BPromise=require(_0x3fca('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3fca('0x3'));var db=require(_0x3fca('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x3fca('0x5'));var client=jayson[_0x3fca('0x6')][_0x3fca('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x503426,_0x2c3cef,_0x199329){return new BPromise(function(_0x383150,_0x16c48b){return client[_0x3fca('0x8')](_0x503426,_0x199329)[_0x3fca('0x9')](function(_0x281e09){logger[_0x3fca('0xa')](_0x3fca('0xb'),_0x2c3cef,_0x3fca('0xc'));logger[_0x3fca('0xd')](_0x3fca('0xe'),_0x2c3cef,_0x3fca('0xc'),JSON[_0x3fca('0xf')](_0x281e09));if(_0x281e09['error']){if(_0x281e09[_0x3fca('0x10')][_0x3fca('0x11')]===0x1f4){logger[_0x3fca('0x10')](_0x3fca('0xb'),_0x2c3cef,_0x281e09['error'][_0x3fca('0x12')]);return _0x16c48b(_0x281e09[_0x3fca('0x10')][_0x3fca('0x12')]);}logger[_0x3fca('0x10')](_0x3fca('0xb'),_0x2c3cef,_0x281e09['error'][_0x3fca('0x12')]);return _0x383150(_0x281e09[_0x3fca('0x10')][_0x3fca('0x12')]);}else{logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x2c3cef,_0x3fca('0xc'));_0x383150(_0x281e09[_0x3fca('0x13')][_0x3fca('0x12')]);}})[_0x3fca('0x14')](function(_0x1a7a15){logger[_0x3fca('0x10')](_0x3fca('0xb'),_0x2c3cef,_0x1a7a15);_0x16c48b(_0x1a7a15);});});}exports['GetSalesforceAccount']=function(_0x44fe42){var _0x3f1aea=this;return new Promise(function(_0x3af634,_0x3cedc6){return db[_0x3fca('0x15')][_0x3fca('0x16')]({'raw':_0x44fe42[_0x3fca('0x17')]?_0x44fe42[_0x3fca('0x17')][_0x3fca('0x18')]===undefined?!![]:![]:!![],'where':_0x44fe42['options']?_0x44fe42[_0x3fca('0x17')][_0x3fca('0x19')]||null:null,'attributes':_0x44fe42['options']?_0x44fe42[_0x3fca('0x17')]['attributes']||null:null,'limit':_0x44fe42['options']?_0x44fe42['options']['limit']||null:null,'include':_0x44fe42[_0x3fca('0x17')]?_0x44fe42['options']['include']?_['map'](_0x44fe42[_0x3fca('0x17')][_0x3fca('0x1a')],function(_0x354b21){return{'model':db[_0x354b21[_0x3fca('0x1b')]],'as':_0x354b21['as'],'attributes':_0x354b21[_0x3fca('0x1c')],'include':_0x354b21['include']?_['map'](_0x354b21[_0x3fca('0x1a')],function(_0x2fca24){return{'model':db[_0x2fca24[_0x3fca('0x1b')]],'as':_0x2fca24['as'],'attributes':_0x2fca24[_0x3fca('0x1c')],'include':_0x2fca24[_0x3fca('0x1a')]?_[_0x3fca('0x1d')](_0x2fca24['include'],function(_0xdc33de){return{'model':db[_0xdc33de[_0x3fca('0x1b')]],'as':_0xdc33de['as'],'attributes':_0xdc33de['attributes']};}):[]};}):[]};}):[]:[]})[_0x3fca('0x9')](function(_0x2b7bfb){logger[_0x3fca('0xa')](_0x3fca('0x1e'),_0x44fe42);logger[_0x3fca('0xd')](_0x3fca('0x1e'),_0x44fe42,JSON[_0x3fca('0xf')](_0x2b7bfb));_0x3af634(_0x2b7bfb);})[_0x3fca('0x14')](function(_0x4a9feb){logger[_0x3fca('0x10')](_0x3fca('0x1e'),_0x4a9feb[_0x3fca('0x12')],_0x44fe42);_0x3cedc6(_0x3f1aea[_0x3fca('0x10')](0x1f4,_0x4a9feb['message']));});});};exports[_0x3fca('0x1f')]=function(_0x189046){var _0x214237=this;return new Promise(function(_0xe5d038,_0x286296){return db[_0x3fca('0x15')][_0x3fca('0x20')]({'raw':_0x189046[_0x3fca('0x17')]?_0x189046['options'][_0x3fca('0x18')]===undefined?!![]:![]:!![],'where':_0x189046[_0x3fca('0x17')]?_0x189046[_0x3fca('0x17')][_0x3fca('0x19')]||null:null,'attributes':_0x189046[_0x3fca('0x17')]?_0x189046['options'][_0x3fca('0x1c')]||null:null,'include':_0x189046[_0x3fca('0x17')]?_0x189046[_0x3fca('0x17')][_0x3fca('0x1a')]?_['map'](_0x189046['options'][_0x3fca('0x1a')],function(_0x46ffa4){return{'model':db[_0x46ffa4[_0x3fca('0x1b')]],'as':_0x46ffa4['as'],'attributes':_0x46ffa4['attributes'],'include':_0x46ffa4[_0x3fca('0x1a')]?_[_0x3fca('0x1d')](_0x46ffa4['include'],function(_0x18ef9b){return{'model':db[_0x18ef9b[_0x3fca('0x1b')]],'as':_0x18ef9b['as'],'attributes':_0x18ef9b[_0x3fca('0x1c')],'include':_0x18ef9b['include']?_[_0x3fca('0x1d')](_0x18ef9b[_0x3fca('0x1a')],function(_0x2ac008){return{'model':db[_0x2ac008[_0x3fca('0x1b')]],'as':_0x2ac008['as'],'attributes':_0x2ac008[_0x3fca('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3fca('0x9')](function(_0x492278){logger[_0x3fca('0xa')](_0x3fca('0x1f'),_0x189046);logger[_0x3fca('0xd')](_0x3fca('0x1f'),_0x189046,JSON[_0x3fca('0xf')](_0x492278));_0xe5d038(_0x492278);})['catch'](function(_0x1cef2a){logger[_0x3fca('0x10')](_0x3fca('0x1f'),_0x1cef2a[_0x3fca('0x12')],_0x189046);_0x286296(_0x214237[_0x3fca('0x10')](0x1f4,_0x1cef2a[_0x3fca('0x12')]));});});}; \ No newline at end of file +var _0x9129=['debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','SalesforceAccount,\x20%s,\x20%s','catch','GetSalesforceAccount','findAll','options','raw','attributes','limit','map','include','model','where','ShowSalesforceAccount','lodash','util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent'];(function(_0x592ea0,_0xf096b2){var _0x55a2be=function(_0x1848b5){while(--_0x1848b5){_0x592ea0['push'](_0x592ea0['shift']());}};_0x55a2be(++_0xf096b2);}(_0x9129,0xcc));var _0x9912=function(_0x16dbcd,_0x274516){_0x16dbcd=_0x16dbcd-0x0;var _0x34706e=_0x9129[_0x16dbcd];return _0x34706e;};'use strict';var _=require(_0x9912('0x0'));var util=require(_0x9912('0x1'));var moment=require('moment');var BPromise=require(_0x9912('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9912('0x3'));var db=require(_0x9912('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9912('0x5'));var config=require(_0x9912('0x6'));var jayson=require(_0x9912('0x7'));var client=jayson[_0x9912('0x8')][_0x9912('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4b039a,_0x75f6b3,_0x67a3aa){return new BPromise(function(_0x3e1176,_0x536e71){return client['request'](_0x4b039a,_0x67a3aa)[_0x9912('0xa')](function(_0x498a0c){logger[_0x9912('0xb')]('SalesforceAccount,\x20%s,\x20%s',_0x75f6b3,_0x9912('0xc'));logger[_0x9912('0xd')](_0x9912('0xe'),_0x75f6b3,_0x9912('0xc'),JSON[_0x9912('0xf')](_0x498a0c));if(_0x498a0c[_0x9912('0x10')]){if(_0x498a0c[_0x9912('0x10')]['code']===0x1f4){logger[_0x9912('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x75f6b3,_0x498a0c[_0x9912('0x10')][_0x9912('0x11')]);return _0x536e71(_0x498a0c[_0x9912('0x10')][_0x9912('0x11')]);}logger[_0x9912('0x10')](_0x9912('0x12'),_0x75f6b3,_0x498a0c[_0x9912('0x10')][_0x9912('0x11')]);return _0x3e1176(_0x498a0c['error'][_0x9912('0x11')]);}else{logger[_0x9912('0xb')](_0x9912('0x12'),_0x75f6b3,_0x9912('0xc'));_0x3e1176(_0x498a0c['result'][_0x9912('0x11')]);}})[_0x9912('0x13')](function(_0xa59603){logger[_0x9912('0x10')](_0x9912('0x12'),_0x75f6b3,_0xa59603);_0x536e71(_0xa59603);});});}exports[_0x9912('0x14')]=function(_0x33098e){var _0xc7c035=this;return new Promise(function(_0x3d187a,_0x3b8b58){return db['SalesforceAccount'][_0x9912('0x15')]({'raw':_0x33098e['options']?_0x33098e[_0x9912('0x16')][_0x9912('0x17')]===undefined?!![]:![]:!![],'where':_0x33098e['options']?_0x33098e[_0x9912('0x16')]['where']||null:null,'attributes':_0x33098e[_0x9912('0x16')]?_0x33098e[_0x9912('0x16')][_0x9912('0x18')]||null:null,'limit':_0x33098e[_0x9912('0x16')]?_0x33098e[_0x9912('0x16')][_0x9912('0x19')]||null:null,'include':_0x33098e[_0x9912('0x16')]?_0x33098e[_0x9912('0x16')]['include']?_[_0x9912('0x1a')](_0x33098e[_0x9912('0x16')][_0x9912('0x1b')],function(_0x5cf142){return{'model':db[_0x5cf142[_0x9912('0x1c')]],'as':_0x5cf142['as'],'attributes':_0x5cf142[_0x9912('0x18')],'include':_0x5cf142[_0x9912('0x1b')]?_[_0x9912('0x1a')](_0x5cf142[_0x9912('0x1b')],function(_0x498d00){return{'model':db[_0x498d00[_0x9912('0x1c')]],'as':_0x498d00['as'],'attributes':_0x498d00[_0x9912('0x18')],'include':_0x498d00[_0x9912('0x1b')]?_[_0x9912('0x1a')](_0x498d00['include'],function(_0x329ea1){return{'model':db[_0x329ea1[_0x9912('0x1c')]],'as':_0x329ea1['as'],'attributes':_0x329ea1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x9b7349){logger[_0x9912('0xb')]('GetSalesforceAccount',_0x33098e);logger[_0x9912('0xd')](_0x9912('0x14'),_0x33098e,JSON[_0x9912('0xf')](_0x9b7349));_0x3d187a(_0x9b7349);})[_0x9912('0x13')](function(_0x16c395){logger[_0x9912('0x10')](_0x9912('0x14'),_0x16c395[_0x9912('0x11')],_0x33098e);_0x3b8b58(_0xc7c035[_0x9912('0x10')](0x1f4,_0x16c395['message']));});});};exports['ShowSalesforceAccount']=function(_0x23fd77){var _0x9030fb=this;return new Promise(function(_0x26cc1a,_0xb635a5){return db['SalesforceAccount']['find']({'raw':_0x23fd77[_0x9912('0x16')]?_0x23fd77[_0x9912('0x16')][_0x9912('0x17')]===undefined?!![]:![]:!![],'where':_0x23fd77['options']?_0x23fd77['options'][_0x9912('0x1d')]||null:null,'attributes':_0x23fd77[_0x9912('0x16')]?_0x23fd77[_0x9912('0x16')]['attributes']||null:null,'include':_0x23fd77[_0x9912('0x16')]?_0x23fd77['options'][_0x9912('0x1b')]?_[_0x9912('0x1a')](_0x23fd77[_0x9912('0x16')]['include'],function(_0x3c8aa3){return{'model':db[_0x3c8aa3[_0x9912('0x1c')]],'as':_0x3c8aa3['as'],'attributes':_0x3c8aa3[_0x9912('0x18')],'include':_0x3c8aa3[_0x9912('0x1b')]?_['map'](_0x3c8aa3[_0x9912('0x1b')],function(_0x27512b){return{'model':db[_0x27512b[_0x9912('0x1c')]],'as':_0x27512b['as'],'attributes':_0x27512b['attributes'],'include':_0x27512b[_0x9912('0x1b')]?_[_0x9912('0x1a')](_0x27512b[_0x9912('0x1b')],function(_0x4fa378){return{'model':db[_0x4fa378[_0x9912('0x1c')]],'as':_0x4fa378['as'],'attributes':_0x4fa378[_0x9912('0x18')]};}):[]};}):[]};}):[]:[]})[_0x9912('0xa')](function(_0x1f273d){logger['info'](_0x9912('0x1e'),_0x23fd77);logger[_0x9912('0xd')](_0x9912('0x1e'),_0x23fd77,JSON[_0x9912('0xf')](_0x1f273d));_0x26cc1a(_0x1f273d);})['catch'](function(_0x50c6b7){logger['error']('ShowSalesforceAccount',_0x50c6b7[_0x9912('0x11')],_0x23fd77);_0xb635a5(_0x9030fb[_0x9912('0x10')](0x1f4,_0x50c6b7[_0x9912('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 75d5231..19faf17 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(_0x3eb16d,_0x1010bc){var _0x202355=function(_0x25b551){while(--_0x25b551){_0x3eb16d['push'](_0x3eb16d['shift']());}};_0x202355(++_0x1010bc);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4be301,_0x415580){_0x4be301=_0x4be301-0x0;var _0x1c6714=_0x5f2f[_0x4be301];return _0x1c6714;};'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 _0x2ef3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','exports','multer','util','path'];(function(_0x2c6470,_0x590d58){var _0x3ddf3c=function(_0x373b74){while(--_0x373b74){_0x2c6470['push'](_0x2c6470['shift']());}};_0x3ddf3c(++_0x590d58);}(_0x2ef3,0xba));var _0x32ef=function(_0x56ae24,_0x205ad6){_0x56ae24=_0x56ae24-0x0;var _0x7291c9=_0x2ef3[_0x56ae24];return _0x7291c9;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x12')]('/:id',auth[_0x32ef('0xb')](),controller[_0x32ef('0x13')]);router['delete']('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 532682a..db31301 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 _0x79d2=['contact','lead','account_contact_lead','account','nothing','exports','STRING','ENUM','Case','Task','contact_lead'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0x79d2,0xd6));var _0x279d=function(_0x364edc,_0x20b3c1){_0x364edc=_0x364edc-0x0;var _0x53e6a1=_0x79d2[_0x364edc];return _0x53e6a1;};'use strict';var Sequelize=require('sequelize');module[_0x279d('0x0')]={'name':{'type':Sequelize[_0x279d('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x279d('0x2')]('Task',_0x279d('0x3')),'defaultValue':_0x279d('0x4')},'moduleSearch':{'type':Sequelize[_0x279d('0x2')](_0x279d('0x5'),_0x279d('0x6'),_0x279d('0x7'),_0x279d('0x8'),_0x279d('0x9')),'defaultValue':_0x279d('0x5')},'moduleCreate':{'type':Sequelize['ENUM'](_0x279d('0xa'),_0x279d('0x6'),_0x279d('0x7'),_0x279d('0x9')),'defaultValue':'lead'},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0x279d('0x1')]},'additionalSearchLead':{'type':Sequelize[_0x279d('0x1')]}}; \ No newline at end of file +var _0x2a43=['Task','contact_lead','contact','lead','nothing','account','sequelize','exports','STRING','ENUM'];(function(_0x1192c7,_0x403d79){var _0x50ae76=function(_0x5efe50){while(--_0x5efe50){_0x1192c7['push'](_0x1192c7['shift']());}};_0x50ae76(++_0x403d79);}(_0x2a43,0x1b4));var _0x32a4=function(_0x1700cb,_0x232eb5){_0x1700cb=_0x1700cb-0x0;var _0x3a2d56=_0x2a43[_0x1700cb];return _0x3a2d56;};'use strict';var Sequelize=require(_0x32a4('0x0'));module[_0x32a4('0x1')]={'name':{'type':Sequelize[_0x32a4('0x2')]},'description':{'type':Sequelize[_0x32a4('0x2')]},'ticketType':{'type':Sequelize[_0x32a4('0x3')](_0x32a4('0x4'),'Case'),'defaultValue':_0x32a4('0x4')},'moduleSearch':{'type':Sequelize[_0x32a4('0x3')](_0x32a4('0x5'),_0x32a4('0x6'),_0x32a4('0x7'),'account_contact_lead','account'),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x32a4('0x3')](_0x32a4('0x8'),_0x32a4('0x6'),_0x32a4('0x7'),_0x32a4('0x9')),'defaultValue':_0x32a4('0x7')},'leadId':{'type':Sequelize[_0x32a4('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x32a4('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x32a4('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x32a4('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index b4dcee2..146bb6e 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 _0xbe22=['crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','apply','update','then','name','send','index','SalesforceConfiguration','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','rows','catch','params','fields','options','find','create','body','destroy','getFields','findOne','SalesforceField','nolimit','getSubjects','getDescriptions','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel'];(function(_0x51213e,_0x50b8b7){var _0x1a571c=function(_0x26daee){while(--_0x26daee){_0x51213e['push'](_0x51213e['shift']());}};_0x1a571c(++_0x50b8b7);}(_0xbe22,0x1c1));var _0x2be2=function(_0x50141e,_0x3668c7){_0x50141e=_0x50141e-0x0;var _0x4f90d3=_0xbe22[_0x50141e];return _0x4f90d3;};'use strict';var emlformat=require(_0x2be2('0x0'));var rimraf=require(_0x2be2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2be2('0x2'));var moment=require(_0x2be2('0x3'));var BPromise=require(_0x2be2('0x4'));var Mustache=require(_0x2be2('0x5'));var util=require(_0x2be2('0x6'));var path=require(_0x2be2('0x7'));var sox=require(_0x2be2('0x8'));var csv=require(_0x2be2('0x9'));var ejs=require(_0x2be2('0xa'));var fs=require('fs');var fs_extra=require(_0x2be2('0xb'));var _=require('lodash');var squel=require(_0x2be2('0xc'));var crypto=require(_0x2be2('0xd'));var jsforce=require(_0x2be2('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2be2('0x9'));var querystring=require(_0x2be2('0xf'));var Papa=require(_0x2be2('0x10'));var Redis=require(_0x2be2('0x11'));var authService=require(_0x2be2('0x12'));var qs=require(_0x2be2('0x13'));var as=require(_0x2be2('0x14'));var hardwareService=require(_0x2be2('0x15'));var logger=require('../../config/logger')(_0x2be2('0x16'));var utils=require(_0x2be2('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2be2('0x18'));var db=require(_0x2be2('0x19'))['db'];function respondWithStatusCode(_0x37667f,_0x4de1eb){_0x4de1eb=_0x4de1eb||0xcc;return function(_0x236e08){if(_0x236e08){return _0x37667f[_0x2be2('0x1a')](_0x4de1eb);}return _0x37667f['status'](_0x4de1eb)[_0x2be2('0x1b')]();};}function respondWithResult(_0x2f61aa,_0x1a3ae0){_0x1a3ae0=_0x1a3ae0||0xc8;return function(_0x48df91){if(_0x48df91){return _0x2f61aa[_0x2be2('0x1c')](_0x1a3ae0)[_0x2be2('0x1d')](_0x48df91);}};}function respondWithFilteredResult(_0x528d4e,_0x18c13e){return function(_0x358bf5){if(_0x358bf5){var _0x5d9719=typeof _0x18c13e[_0x2be2('0x1e')]==='undefined'&&typeof _0x18c13e[_0x2be2('0x1f')]===_0x2be2('0x20');var _0x564371=_0x358bf5[_0x2be2('0x21')];var _0x20c5fa=_0x5d9719?0x0:_0x18c13e[_0x2be2('0x1e')];var _0x504b07=_0x5d9719?_0x358bf5[_0x2be2('0x21')]:_0x18c13e[_0x2be2('0x1e')]+_0x18c13e[_0x2be2('0x1f')];var _0x59e2c6;if(_0x504b07>=_0x564371){_0x504b07=_0x564371;_0x59e2c6=0xc8;}else{_0x59e2c6=0xce;}_0x528d4e['status'](_0x59e2c6);return _0x528d4e[_0x2be2('0x22')]('Content-Range',_0x20c5fa+'-'+_0x504b07+'/'+_0x564371)[_0x2be2('0x1d')](_0x358bf5);}return null;};}function patchUpdates(_0xefbaf5){return function(_0xcc5dbf){try{jsonpatch[_0x2be2('0x23')](_0xcc5dbf,_0xefbaf5,!![]);}catch(_0x173862){return BPromise['reject'](_0x173862);}return _0xcc5dbf['save']();};}function saveUpdates(_0x5c2d00,_0x2c32c7){return function(_0x155755){if(_0x155755){return _0x155755[_0x2be2('0x24')](_0x5c2d00)[_0x2be2('0x25')](function(_0x281853){return _0x281853;});}return null;};}function removeEntity(_0x16a512,_0x4d68ef){return function(_0x2564ca){if(_0x2564ca){return _0x2564ca['destroy']()[_0x2be2('0x25')](function(){_0x16a512[_0x2be2('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36057c,_0x1952db){return function(_0x2fbbae){if(!_0x2fbbae){_0x36057c['sendStatus'](0x194);}return _0x2fbbae;};}function handleError(_0x5e6e80,_0x36dfb9){_0x36dfb9=_0x36dfb9||0x1f4;return function(_0x47618d){logger['error'](_0x47618d['stack']);if(_0x47618d[_0x2be2('0x26')]){delete _0x47618d[_0x2be2('0x26')];}_0x5e6e80['status'](_0x36dfb9)[_0x2be2('0x27')](_0x47618d);};}exports[_0x2be2('0x28')]=function(_0x42015b,_0xe19c2d){var _0x170973={},_0x156de8={},_0x1ddcd2={'count':0x0,'rows':[]};var _0x26658d=_['map'](db[_0x2be2('0x29')][_0x2be2('0x2a')],function(_0x132bbe){return{'name':_0x132bbe['fieldName'],'type':_0x132bbe[_0x2be2('0x2b')]['key']};});_0x156de8[_0x2be2('0x2c')]=_[_0x2be2('0x2d')](_0x26658d,_0x2be2('0x26'));_0x156de8[_0x2be2('0x2e')]=_[_0x2be2('0x2f')](_0x42015b[_0x2be2('0x2e')]);_0x156de8[_0x2be2('0x30')]=_[_0x2be2('0x31')](_0x156de8[_0x2be2('0x2c')],_0x156de8[_0x2be2('0x2e')]);_0x170973['attributes']=_[_0x2be2('0x31')](_0x156de8[_0x2be2('0x2c')],qs['fields'](_0x42015b[_0x2be2('0x2e')]['fields']));_0x170973[_0x2be2('0x32')]=_0x170973[_0x2be2('0x32')][_0x2be2('0x33')]?_0x170973['attributes']:_0x156de8[_0x2be2('0x2c')];if(!_0x42015b[_0x2be2('0x2e')][_0x2be2('0x34')]('nolimit')){_0x170973[_0x2be2('0x1f')]=qs[_0x2be2('0x1f')](_0x42015b[_0x2be2('0x2e')][_0x2be2('0x1f')]);_0x170973[_0x2be2('0x1e')]=qs[_0x2be2('0x1e')](_0x42015b[_0x2be2('0x2e')][_0x2be2('0x1e')]);}_0x170973[_0x2be2('0x35')]=qs[_0x2be2('0x36')](_0x42015b[_0x2be2('0x2e')][_0x2be2('0x36')]);_0x170973['where']=qs[_0x2be2('0x30')](_[_0x2be2('0x37')](_0x42015b[_0x2be2('0x2e')],_0x156de8['filters']),_0x26658d);if(_0x42015b['query'][_0x2be2('0x38')]){_0x170973[_0x2be2('0x39')]=_[_0x2be2('0x3a')](_0x170973['where'],{'$or':_[_0x2be2('0x2d')](_0x26658d,function(_0x11c0d1){if(_0x11c0d1[_0x2be2('0x2b')]!==_0x2be2('0x3b')){var _0x108e1d={};_0x108e1d[_0x11c0d1[_0x2be2('0x26')]]={'$like':'%'+_0x42015b[_0x2be2('0x2e')][_0x2be2('0x38')]+'%'};return _0x108e1d;}})});}_0x170973=_[_0x2be2('0x3a')]({},_0x170973,_0x42015b['options']);var _0x7d1bac={'where':_0x170973[_0x2be2('0x39')]};return db['SalesforceConfiguration'][_0x2be2('0x21')](_0x7d1bac)[_0x2be2('0x25')](function(_0x211320){_0x1ddcd2['count']=_0x211320;if(_0x42015b[_0x2be2('0x2e')][_0x2be2('0x3c')]){_0x170973[_0x2be2('0x3d')]=[{'all':!![]}];}return db[_0x2be2('0x29')]['findAll'](_0x170973);})['then'](function(_0x468fa3){_0x1ddcd2[_0x2be2('0x3e')]=_0x468fa3;return _0x1ddcd2;})[_0x2be2('0x25')](respondWithFilteredResult(_0xe19c2d,_0x170973))[_0x2be2('0x3f')](handleError(_0xe19c2d,null));};exports['show']=function(_0x4900b6,_0x4c4aa9){var _0x4c4081={'raw':![],'where':{'id':_0x4900b6[_0x2be2('0x40')]['id']}},_0x46cf4f={};_0x46cf4f[_0x2be2('0x2c')]=_[_0x2be2('0x2f')](db['SalesforceConfiguration'][_0x2be2('0x2a')]);_0x46cf4f[_0x2be2('0x2e')]=_[_0x2be2('0x2f')](_0x4900b6['query']);_0x46cf4f[_0x2be2('0x30')]=_[_0x2be2('0x31')](_0x46cf4f[_0x2be2('0x2c')],_0x46cf4f[_0x2be2('0x2e')]);_0x4c4081['attributes']=_[_0x2be2('0x31')](_0x46cf4f['model'],qs[_0x2be2('0x41')](_0x4900b6['query']['fields']));_0x4c4081[_0x2be2('0x32')]=_0x4c4081[_0x2be2('0x32')][_0x2be2('0x33')]?_0x4c4081[_0x2be2('0x32')]:_0x46cf4f[_0x2be2('0x2c')];if(_0x4900b6['query'][_0x2be2('0x3c')]){_0x4c4081[_0x2be2('0x3d')]=[{'all':!![]}];}_0x4c4081=_['merge']({},_0x4c4081,_0x4900b6[_0x2be2('0x42')]);return db[_0x2be2('0x29')][_0x2be2('0x43')](_0x4c4081)['then'](handleEntityNotFound(_0x4c4aa9,null))[_0x2be2('0x25')](respondWithResult(_0x4c4aa9,null))['catch'](handleError(_0x4c4aa9,null));};exports[_0x2be2('0x44')]=function(_0x2bf589,_0x48ef0b){return db[_0x2be2('0x29')][_0x2be2('0x44')](_0x2bf589[_0x2be2('0x45')],{})['then'](respondWithResult(_0x48ef0b,0xc9))[_0x2be2('0x3f')](handleError(_0x48ef0b,null));};exports[_0x2be2('0x24')]=function(_0x44418a,_0xb70cae){if(_0x44418a[_0x2be2('0x45')]['id']){delete _0x44418a['body']['id'];}return db['SalesforceConfiguration'][_0x2be2('0x43')]({'where':{'id':_0x44418a[_0x2be2('0x40')]['id']}})[_0x2be2('0x25')](handleEntityNotFound(_0xb70cae,null))['then'](saveUpdates(_0x44418a[_0x2be2('0x45')],null))[_0x2be2('0x25')](respondWithResult(_0xb70cae,null))[_0x2be2('0x3f')](handleError(_0xb70cae,null));};exports[_0x2be2('0x46')]=function(_0x456b0a,_0x5df58b){return db['SalesforceConfiguration']['find']({'where':{'id':_0x456b0a[_0x2be2('0x40')]['id']}})[_0x2be2('0x25')](handleEntityNotFound(_0x5df58b,null))['then'](removeEntity(_0x5df58b,null))['catch'](handleError(_0x5df58b,null));};exports[_0x2be2('0x47')]=function(_0x142820,_0xa330f0,_0x577f2c){var _0x5c13f1={};var _0x107f1c={};var _0x1edc20;var _0x3db17d;return db['SalesforceConfiguration'][_0x2be2('0x48')]({'where':{'id':_0x142820['params']['id']}})[_0x2be2('0x25')](handleEntityNotFound(_0xa330f0,null))[_0x2be2('0x25')](function(_0x1b6ac0){if(_0x1b6ac0){_0x1edc20=_0x1b6ac0;_0x107f1c[_0x2be2('0x2c')]=_[_0x2be2('0x2f')](db[_0x2be2('0x49')][_0x2be2('0x2a')]);_0x107f1c[_0x2be2('0x2e')]=_['keys'](_0x142820['query']);_0x107f1c[_0x2be2('0x30')]=_[_0x2be2('0x31')](_0x107f1c[_0x2be2('0x2c')],_0x107f1c[_0x2be2('0x2e')]);_0x5c13f1[_0x2be2('0x32')]=_[_0x2be2('0x31')](_0x107f1c[_0x2be2('0x2c')],qs[_0x2be2('0x41')](_0x142820[_0x2be2('0x2e')][_0x2be2('0x41')]));_0x5c13f1[_0x2be2('0x32')]=_0x5c13f1[_0x2be2('0x32')][_0x2be2('0x33')]?_0x5c13f1['attributes']:_0x107f1c[_0x2be2('0x2c')];_0x5c13f1['order']=qs[_0x2be2('0x36')](_0x142820['query'][_0x2be2('0x36')]);_0x5c13f1[_0x2be2('0x39')]=qs[_0x2be2('0x30')](_[_0x2be2('0x37')](_0x142820[_0x2be2('0x2e')],_0x107f1c['filters']));if(_0x142820[_0x2be2('0x2e')]['filter']){_0x5c13f1[_0x2be2('0x39')]=_['merge'](_0x5c13f1[_0x2be2('0x39')],{'$or':_[_0x2be2('0x2d')](_0x5c13f1[_0x2be2('0x32')],function(_0x2eb49a){var _0x3aab4e={};_0x3aab4e[_0x2eb49a]={'$like':'%'+_0x142820['query'][_0x2be2('0x38')]+'%'};return _0x3aab4e;})});}_0x5c13f1=_[_0x2be2('0x3a')]({},_0x5c13f1,_0x142820['options']);return _0x1edc20['getFields'](_0x5c13f1);}})[_0x2be2('0x25')](function(_0x5a747a){if(_0x5a747a){_0x3db17d=_0x5a747a[_0x2be2('0x33')];if(!_0x142820[_0x2be2('0x2e')][_0x2be2('0x34')](_0x2be2('0x4a'))){_0x5c13f1[_0x2be2('0x1f')]=qs[_0x2be2('0x1f')](_0x142820['query']['limit']);_0x5c13f1['offset']=qs[_0x2be2('0x1e')](_0x142820[_0x2be2('0x2e')]['offset']);}return _0x1edc20[_0x2be2('0x47')](_0x5c13f1);}})['then'](function(_0x4af59a){if(_0x4af59a){return _0x4af59a?{'count':_0x3db17d,'rows':_0x4af59a}:null;}})['then'](respondWithResult(_0xa330f0,null))['catch'](handleError(_0xa330f0,null));};exports[_0x2be2('0x4b')]=function(_0x27b5f0,_0x1081b6,_0x2277e7){var _0x48cf89={};var _0x1db496={};var _0x88a371;var _0x963648;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x27b5f0[_0x2be2('0x40')]['id']}})[_0x2be2('0x25')](handleEntityNotFound(_0x1081b6,null))[_0x2be2('0x25')](function(_0x22b1b7){if(_0x22b1b7){_0x88a371=_0x22b1b7;_0x1db496[_0x2be2('0x2c')]=_[_0x2be2('0x2f')](db[_0x2be2('0x49')][_0x2be2('0x2a')]);_0x1db496['query']=_['keys'](_0x27b5f0[_0x2be2('0x2e')]);_0x1db496['filters']=_[_0x2be2('0x31')](_0x1db496[_0x2be2('0x2c')],_0x1db496[_0x2be2('0x2e')]);_0x48cf89[_0x2be2('0x32')]=_[_0x2be2('0x31')](_0x1db496[_0x2be2('0x2c')],qs[_0x2be2('0x41')](_0x27b5f0['query'][_0x2be2('0x41')]));_0x48cf89[_0x2be2('0x32')]=_0x48cf89[_0x2be2('0x32')][_0x2be2('0x33')]?_0x48cf89[_0x2be2('0x32')]:_0x1db496[_0x2be2('0x2c')];_0x48cf89[_0x2be2('0x35')]=qs[_0x2be2('0x36')](_0x27b5f0[_0x2be2('0x2e')][_0x2be2('0x36')]);_0x48cf89[_0x2be2('0x39')]=qs[_0x2be2('0x30')](_[_0x2be2('0x37')](_0x27b5f0[_0x2be2('0x2e')],_0x1db496[_0x2be2('0x30')]));if(_0x27b5f0['query'][_0x2be2('0x38')]){_0x48cf89[_0x2be2('0x39')]=_[_0x2be2('0x3a')](_0x48cf89[_0x2be2('0x39')],{'$or':_['map'](_0x48cf89[_0x2be2('0x32')],function(_0x4461c6){var _0x18627b={};_0x18627b[_0x4461c6]={'$like':'%'+_0x27b5f0['query']['filter']+'%'};return _0x18627b;})});}_0x48cf89=_[_0x2be2('0x3a')]({},_0x48cf89,_0x27b5f0['options']);return _0x88a371[_0x2be2('0x4b')](_0x48cf89);}})[_0x2be2('0x25')](function(_0xddbcd5){if(_0xddbcd5){_0x963648=_0xddbcd5[_0x2be2('0x33')];if(!_0x27b5f0[_0x2be2('0x2e')][_0x2be2('0x34')](_0x2be2('0x4a'))){_0x48cf89[_0x2be2('0x1f')]=qs[_0x2be2('0x1f')](_0x27b5f0[_0x2be2('0x2e')][_0x2be2('0x1f')]);_0x48cf89[_0x2be2('0x1e')]=qs[_0x2be2('0x1e')](_0x27b5f0[_0x2be2('0x2e')][_0x2be2('0x1e')]);}return _0x88a371[_0x2be2('0x4b')](_0x48cf89);}})['then'](function(_0x3a4d3e){if(_0x3a4d3e){return _0x3a4d3e?{'count':_0x963648,'rows':_0x3a4d3e}:null;}})[_0x2be2('0x25')](respondWithResult(_0x1081b6,null))[_0x2be2('0x3f')](handleError(_0x1081b6,null));};exports[_0x2be2('0x4c')]=function(_0x5dded9,_0x28f787,_0x9be5a4){var _0x162489={};var _0x31a5ed={};var _0x3ef16f;var _0x4c21e7;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x5dded9[_0x2be2('0x40')]['id']}})[_0x2be2('0x25')](handleEntityNotFound(_0x28f787,null))[_0x2be2('0x25')](function(_0x134c46){if(_0x134c46){_0x3ef16f=_0x134c46;_0x31a5ed['model']=_['keys'](db[_0x2be2('0x49')][_0x2be2('0x2a')]);_0x31a5ed[_0x2be2('0x2e')]=_['keys'](_0x5dded9['query']);_0x31a5ed[_0x2be2('0x30')]=_['intersection'](_0x31a5ed[_0x2be2('0x2c')],_0x31a5ed[_0x2be2('0x2e')]);_0x162489[_0x2be2('0x32')]=_[_0x2be2('0x31')](_0x31a5ed['model'],qs[_0x2be2('0x41')](_0x5dded9[_0x2be2('0x2e')][_0x2be2('0x41')]));_0x162489[_0x2be2('0x32')]=_0x162489[_0x2be2('0x32')][_0x2be2('0x33')]?_0x162489['attributes']:_0x31a5ed[_0x2be2('0x2c')];_0x162489[_0x2be2('0x35')]=qs[_0x2be2('0x36')](_0x5dded9[_0x2be2('0x2e')]['sort']);_0x162489[_0x2be2('0x39')]=qs[_0x2be2('0x30')](_[_0x2be2('0x37')](_0x5dded9[_0x2be2('0x2e')],_0x31a5ed['filters']));if(_0x5dded9[_0x2be2('0x2e')][_0x2be2('0x38')]){_0x162489[_0x2be2('0x39')]=_[_0x2be2('0x3a')](_0x162489[_0x2be2('0x39')],{'$or':_[_0x2be2('0x2d')](_0x162489[_0x2be2('0x32')],function(_0x2b9136){var _0x472753={};_0x472753[_0x2b9136]={'$like':'%'+_0x5dded9[_0x2be2('0x2e')][_0x2be2('0x38')]+'%'};return _0x472753;})});}_0x162489=_[_0x2be2('0x3a')]({},_0x162489,_0x5dded9['options']);return _0x3ef16f[_0x2be2('0x4c')](_0x162489);}})[_0x2be2('0x25')](function(_0x5dd13b){if(_0x5dd13b){_0x4c21e7=_0x5dd13b['length'];if(!_0x5dded9[_0x2be2('0x2e')][_0x2be2('0x34')]('nolimit')){_0x162489[_0x2be2('0x1f')]=qs[_0x2be2('0x1f')](_0x5dded9[_0x2be2('0x2e')][_0x2be2('0x1f')]);_0x162489[_0x2be2('0x1e')]=qs[_0x2be2('0x1e')](_0x5dded9[_0x2be2('0x2e')][_0x2be2('0x1e')]);}return _0x3ef16f[_0x2be2('0x4c')](_0x162489);}})[_0x2be2('0x25')](function(_0xbcbe1f){if(_0xbcbe1f){return _0xbcbe1f?{'count':_0x4c21e7,'rows':_0xbcbe1f}:null;}})[_0x2be2('0x25')](respondWithResult(_0x28f787,null))[_0x2be2('0x3f')](handleError(_0x28f787,null));}; \ No newline at end of file +var _0x5c54=['attributes','fields','query','hasOwnProperty','nolimit','order','sort','pick','filters','where','VIRTUAL','filter','merge','includeAll','include','findAll','rows','show','params','keys','length','options','find','catch','create','body','destroy','getFields','findOne','SalesforceField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','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','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','update','then','name','send','index','map','SalesforceConfiguration','rawAttributes','type','key','model','intersection'];(function(_0x3d4876,_0x366386){var _0x58ca9d=function(_0x5bd045){while(--_0x5bd045){_0x3d4876['push'](_0x3d4876['shift']());}};_0x58ca9d(++_0x366386);}(_0x5c54,0x71));var _0x45c5=function(_0x45b26b,_0x76397b){_0x45b26b=_0x45b26b-0x0;var _0x6330f1=_0x5c54[_0x45b26b];return _0x6330f1;};'use strict';var emlformat=require(_0x45c5('0x0'));var rimraf=require(_0x45c5('0x1'));var zipdir=require(_0x45c5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x45c5('0x3'));var BPromise=require(_0x45c5('0x4'));var Mustache=require(_0x45c5('0x5'));var util=require('util');var path=require(_0x45c5('0x6'));var sox=require(_0x45c5('0x7'));var csv=require('to-csv');var ejs=require(_0x45c5('0x8'));var fs=require('fs');var fs_extra=require(_0x45c5('0x9'));var _=require(_0x45c5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x45c5('0xb'));var deskjs=require(_0x45c5('0xc'));var toCsv=require(_0x45c5('0xd'));var querystring=require(_0x45c5('0xe'));var Papa=require(_0x45c5('0xf'));var Redis=require(_0x45c5('0x10'));var authService=require(_0x45c5('0x11'));var qs=require(_0x45c5('0x12'));var as=require(_0x45c5('0x13'));var hardwareService=require(_0x45c5('0x14'));var logger=require(_0x45c5('0x15'))(_0x45c5('0x16'));var utils=require(_0x45c5('0x17'));var config=require(_0x45c5('0x18'));var licenseUtil=require(_0x45c5('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28709d,_0x2b48db){_0x2b48db=_0x2b48db||0xcc;return function(_0x340526){if(_0x340526){return _0x28709d[_0x45c5('0x1a')](_0x2b48db);}return _0x28709d[_0x45c5('0x1b')](_0x2b48db)[_0x45c5('0x1c')]();};}function respondWithResult(_0x44e707,_0x2e0329){_0x2e0329=_0x2e0329||0xc8;return function(_0x1b7d6c){if(_0x1b7d6c){return _0x44e707[_0x45c5('0x1b')](_0x2e0329)[_0x45c5('0x1d')](_0x1b7d6c);}};}function respondWithFilteredResult(_0x1945de,_0x1e09ff){return function(_0x43e136){if(_0x43e136){var _0x4605fb=typeof _0x1e09ff['offset']==='undefined'&&typeof _0x1e09ff['limit']===_0x45c5('0x1e');var _0x5f1068=_0x43e136[_0x45c5('0x1f')];var _0x30b98f=_0x4605fb?0x0:_0x1e09ff[_0x45c5('0x20')];var _0x3e6f5e=_0x4605fb?_0x43e136[_0x45c5('0x1f')]:_0x1e09ff[_0x45c5('0x20')]+_0x1e09ff[_0x45c5('0x21')];var _0x1c93a0;if(_0x3e6f5e>=_0x5f1068){_0x3e6f5e=_0x5f1068;_0x1c93a0=0xc8;}else{_0x1c93a0=0xce;}_0x1945de[_0x45c5('0x1b')](_0x1c93a0);return _0x1945de['set'](_0x45c5('0x22'),_0x30b98f+'-'+_0x3e6f5e+'/'+_0x5f1068)['json'](_0x43e136);}return null;};}function patchUpdates(_0x2e4361){return function(_0x271b79){try{jsonpatch[_0x45c5('0x23')](_0x271b79,_0x2e4361,!![]);}catch(_0x20c043){return BPromise[_0x45c5('0x24')](_0x20c043);}return _0x271b79['save']();};}function saveUpdates(_0x16b768,_0x11085e){return function(_0x5ef95b){if(_0x5ef95b){return _0x5ef95b[_0x45c5('0x25')](_0x16b768)[_0x45c5('0x26')](function(_0x1c80fe){return _0x1c80fe;});}return null;};}function removeEntity(_0x88795,_0x4612f1){return function(_0x122f7d){if(_0x122f7d){return _0x122f7d['destroy']()[_0x45c5('0x26')](function(){_0x88795[_0x45c5('0x1b')](0xcc)[_0x45c5('0x1c')]();});}};}function handleEntityNotFound(_0x24dc76,_0x321a78){return function(_0x292a46){if(!_0x292a46){_0x24dc76[_0x45c5('0x1a')](0x194);}return _0x292a46;};}function handleError(_0x23c259,_0x27369a){_0x27369a=_0x27369a||0x1f4;return function(_0x865b11){logger['error'](_0x865b11['stack']);if(_0x865b11[_0x45c5('0x27')]){delete _0x865b11[_0x45c5('0x27')];}_0x23c259[_0x45c5('0x1b')](_0x27369a)[_0x45c5('0x28')](_0x865b11);};}exports[_0x45c5('0x29')]=function(_0x1c9ca8,_0x1ea63a){var _0x133871={},_0x2117b1={},_0x175917={'count':0x0,'rows':[]};var _0x598f54=_[_0x45c5('0x2a')](db[_0x45c5('0x2b')][_0x45c5('0x2c')],function(_0x4a4c25){return{'name':_0x4a4c25['fieldName'],'type':_0x4a4c25[_0x45c5('0x2d')][_0x45c5('0x2e')]};});_0x2117b1[_0x45c5('0x2f')]=_[_0x45c5('0x2a')](_0x598f54,_0x45c5('0x27'));_0x2117b1['query']=_['keys'](_0x1c9ca8['query']);_0x2117b1['filters']=_[_0x45c5('0x30')](_0x2117b1['model'],_0x2117b1['query']);_0x133871[_0x45c5('0x31')]=_[_0x45c5('0x30')](_0x2117b1[_0x45c5('0x2f')],qs[_0x45c5('0x32')](_0x1c9ca8['query']['fields']));_0x133871[_0x45c5('0x31')]=_0x133871[_0x45c5('0x31')]['length']?_0x133871[_0x45c5('0x31')]:_0x2117b1[_0x45c5('0x2f')];if(!_0x1c9ca8[_0x45c5('0x33')][_0x45c5('0x34')](_0x45c5('0x35'))){_0x133871['limit']=qs['limit'](_0x1c9ca8[_0x45c5('0x33')][_0x45c5('0x21')]);_0x133871[_0x45c5('0x20')]=qs[_0x45c5('0x20')](_0x1c9ca8['query'][_0x45c5('0x20')]);}_0x133871[_0x45c5('0x36')]=qs[_0x45c5('0x37')](_0x1c9ca8[_0x45c5('0x33')][_0x45c5('0x37')]);_0x133871['where']=qs['filters'](_[_0x45c5('0x38')](_0x1c9ca8[_0x45c5('0x33')],_0x2117b1[_0x45c5('0x39')]),_0x598f54);if(_0x1c9ca8[_0x45c5('0x33')]['filter']){_0x133871['where']=_['merge'](_0x133871[_0x45c5('0x3a')],{'$or':_['map'](_0x598f54,function(_0x34a1dd){if(_0x34a1dd[_0x45c5('0x2d')]!==_0x45c5('0x3b')){var _0x1fe904={};_0x1fe904[_0x34a1dd['name']]={'$like':'%'+_0x1c9ca8[_0x45c5('0x33')][_0x45c5('0x3c')]+'%'};return _0x1fe904;}})});}_0x133871=_[_0x45c5('0x3d')]({},_0x133871,_0x1c9ca8['options']);var _0x595fe0={'where':_0x133871[_0x45c5('0x3a')]};return db[_0x45c5('0x2b')][_0x45c5('0x1f')](_0x595fe0)[_0x45c5('0x26')](function(_0x4ee112){_0x175917[_0x45c5('0x1f')]=_0x4ee112;if(_0x1c9ca8['query'][_0x45c5('0x3e')]){_0x133871[_0x45c5('0x3f')]=[{'all':!![]}];}return db[_0x45c5('0x2b')][_0x45c5('0x40')](_0x133871);})[_0x45c5('0x26')](function(_0x4dc61c){_0x175917[_0x45c5('0x41')]=_0x4dc61c;return _0x175917;})[_0x45c5('0x26')](respondWithFilteredResult(_0x1ea63a,_0x133871))['catch'](handleError(_0x1ea63a,null));};exports[_0x45c5('0x42')]=function(_0x4d059a,_0x16fa42){var _0x106673={'raw':![],'where':{'id':_0x4d059a[_0x45c5('0x43')]['id']}},_0x1d2544={};_0x1d2544['model']=_[_0x45c5('0x44')](db[_0x45c5('0x2b')][_0x45c5('0x2c')]);_0x1d2544[_0x45c5('0x33')]=_[_0x45c5('0x44')](_0x4d059a['query']);_0x1d2544[_0x45c5('0x39')]=_['intersection'](_0x1d2544['model'],_0x1d2544[_0x45c5('0x33')]);_0x106673['attributes']=_[_0x45c5('0x30')](_0x1d2544[_0x45c5('0x2f')],qs[_0x45c5('0x32')](_0x4d059a[_0x45c5('0x33')][_0x45c5('0x32')]));_0x106673['attributes']=_0x106673['attributes'][_0x45c5('0x45')]?_0x106673[_0x45c5('0x31')]:_0x1d2544['model'];if(_0x4d059a[_0x45c5('0x33')][_0x45c5('0x3e')]){_0x106673[_0x45c5('0x3f')]=[{'all':!![]}];}_0x106673=_[_0x45c5('0x3d')]({},_0x106673,_0x4d059a[_0x45c5('0x46')]);return db[_0x45c5('0x2b')][_0x45c5('0x47')](_0x106673)[_0x45c5('0x26')](handleEntityNotFound(_0x16fa42,null))[_0x45c5('0x26')](respondWithResult(_0x16fa42,null))[_0x45c5('0x48')](handleError(_0x16fa42,null));};exports[_0x45c5('0x49')]=function(_0x1fc94d,_0x46b35e){return db[_0x45c5('0x2b')][_0x45c5('0x49')](_0x1fc94d[_0x45c5('0x4a')],{})[_0x45c5('0x26')](respondWithResult(_0x46b35e,0xc9))[_0x45c5('0x48')](handleError(_0x46b35e,null));};exports['update']=function(_0x32d9a3,_0x106594){if(_0x32d9a3[_0x45c5('0x4a')]['id']){delete _0x32d9a3[_0x45c5('0x4a')]['id'];}return db['SalesforceConfiguration'][_0x45c5('0x47')]({'where':{'id':_0x32d9a3['params']['id']}})[_0x45c5('0x26')](handleEntityNotFound(_0x106594,null))[_0x45c5('0x26')](saveUpdates(_0x32d9a3[_0x45c5('0x4a')],null))[_0x45c5('0x26')](respondWithResult(_0x106594,null))[_0x45c5('0x48')](handleError(_0x106594,null));};exports[_0x45c5('0x4b')]=function(_0x776c97,_0xaf8a74){return db['SalesforceConfiguration'][_0x45c5('0x47')]({'where':{'id':_0x776c97[_0x45c5('0x43')]['id']}})[_0x45c5('0x26')](handleEntityNotFound(_0xaf8a74,null))[_0x45c5('0x26')](removeEntity(_0xaf8a74,null))[_0x45c5('0x48')](handleError(_0xaf8a74,null));};exports[_0x45c5('0x4c')]=function(_0xd9aa70,_0x16447f,_0xfa55eb){var _0x5d0b55={};var _0x523eea={};var _0x4631e5;var _0x1cd133;return db[_0x45c5('0x2b')][_0x45c5('0x4d')]({'where':{'id':_0xd9aa70[_0x45c5('0x43')]['id']}})['then'](handleEntityNotFound(_0x16447f,null))[_0x45c5('0x26')](function(_0x424d9d){if(_0x424d9d){_0x4631e5=_0x424d9d;_0x523eea['model']=_[_0x45c5('0x44')](db[_0x45c5('0x4e')][_0x45c5('0x2c')]);_0x523eea[_0x45c5('0x33')]=_[_0x45c5('0x44')](_0xd9aa70[_0x45c5('0x33')]);_0x523eea['filters']=_[_0x45c5('0x30')](_0x523eea['model'],_0x523eea['query']);_0x5d0b55[_0x45c5('0x31')]=_[_0x45c5('0x30')](_0x523eea[_0x45c5('0x2f')],qs[_0x45c5('0x32')](_0xd9aa70[_0x45c5('0x33')][_0x45c5('0x32')]));_0x5d0b55['attributes']=_0x5d0b55[_0x45c5('0x31')]['length']?_0x5d0b55['attributes']:_0x523eea[_0x45c5('0x2f')];_0x5d0b55[_0x45c5('0x36')]=qs['sort'](_0xd9aa70[_0x45c5('0x33')][_0x45c5('0x37')]);_0x5d0b55['where']=qs['filters'](_[_0x45c5('0x38')](_0xd9aa70[_0x45c5('0x33')],_0x523eea[_0x45c5('0x39')]));if(_0xd9aa70[_0x45c5('0x33')][_0x45c5('0x3c')]){_0x5d0b55[_0x45c5('0x3a')]=_[_0x45c5('0x3d')](_0x5d0b55[_0x45c5('0x3a')],{'$or':_['map'](_0x5d0b55[_0x45c5('0x31')],function(_0x3132d3){var _0x5c33c5={};_0x5c33c5[_0x3132d3]={'$like':'%'+_0xd9aa70[_0x45c5('0x33')]['filter']+'%'};return _0x5c33c5;})});}_0x5d0b55=_[_0x45c5('0x3d')]({},_0x5d0b55,_0xd9aa70[_0x45c5('0x46')]);return _0x4631e5[_0x45c5('0x4c')](_0x5d0b55);}})[_0x45c5('0x26')](function(_0x9c0082){if(_0x9c0082){_0x1cd133=_0x9c0082[_0x45c5('0x45')];if(!_0xd9aa70[_0x45c5('0x33')][_0x45c5('0x34')](_0x45c5('0x35'))){_0x5d0b55[_0x45c5('0x21')]=qs[_0x45c5('0x21')](_0xd9aa70[_0x45c5('0x33')]['limit']);_0x5d0b55[_0x45c5('0x20')]=qs['offset'](_0xd9aa70[_0x45c5('0x33')]['offset']);}return _0x4631e5[_0x45c5('0x4c')](_0x5d0b55);}})[_0x45c5('0x26')](function(_0x4c104e){if(_0x4c104e){return _0x4c104e?{'count':_0x1cd133,'rows':_0x4c104e}:null;}})[_0x45c5('0x26')](respondWithResult(_0x16447f,null))[_0x45c5('0x48')](handleError(_0x16447f,null));};exports[_0x45c5('0x4f')]=function(_0x58db43,_0x3cc87a,_0x2c43b5){var _0x47c2fa={};var _0x58add6={};var _0x1859f7;var _0x10ec30;return db['SalesforceConfiguration'][_0x45c5('0x4d')]({'where':{'id':_0x58db43[_0x45c5('0x43')]['id']}})[_0x45c5('0x26')](handleEntityNotFound(_0x3cc87a,null))[_0x45c5('0x26')](function(_0x1ecaea){if(_0x1ecaea){_0x1859f7=_0x1ecaea;_0x58add6[_0x45c5('0x2f')]=_[_0x45c5('0x44')](db['SalesforceField'][_0x45c5('0x2c')]);_0x58add6[_0x45c5('0x33')]=_[_0x45c5('0x44')](_0x58db43[_0x45c5('0x33')]);_0x58add6[_0x45c5('0x39')]=_[_0x45c5('0x30')](_0x58add6[_0x45c5('0x2f')],_0x58add6[_0x45c5('0x33')]);_0x47c2fa['attributes']=_[_0x45c5('0x30')](_0x58add6['model'],qs[_0x45c5('0x32')](_0x58db43['query'][_0x45c5('0x32')]));_0x47c2fa['attributes']=_0x47c2fa['attributes'][_0x45c5('0x45')]?_0x47c2fa['attributes']:_0x58add6[_0x45c5('0x2f')];_0x47c2fa[_0x45c5('0x36')]=qs[_0x45c5('0x37')](_0x58db43['query']['sort']);_0x47c2fa[_0x45c5('0x3a')]=qs['filters'](_[_0x45c5('0x38')](_0x58db43[_0x45c5('0x33')],_0x58add6[_0x45c5('0x39')]));if(_0x58db43[_0x45c5('0x33')][_0x45c5('0x3c')]){_0x47c2fa[_0x45c5('0x3a')]=_[_0x45c5('0x3d')](_0x47c2fa[_0x45c5('0x3a')],{'$or':_[_0x45c5('0x2a')](_0x47c2fa[_0x45c5('0x31')],function(_0x503d76){var _0x1e0eb9={};_0x1e0eb9[_0x503d76]={'$like':'%'+_0x58db43[_0x45c5('0x33')][_0x45c5('0x3c')]+'%'};return _0x1e0eb9;})});}_0x47c2fa=_['merge']({},_0x47c2fa,_0x58db43[_0x45c5('0x46')]);return _0x1859f7[_0x45c5('0x4f')](_0x47c2fa);}})[_0x45c5('0x26')](function(_0x523bfc){if(_0x523bfc){_0x10ec30=_0x523bfc[_0x45c5('0x45')];if(!_0x58db43['query'][_0x45c5('0x34')](_0x45c5('0x35'))){_0x47c2fa[_0x45c5('0x21')]=qs[_0x45c5('0x21')](_0x58db43['query'][_0x45c5('0x21')]);_0x47c2fa[_0x45c5('0x20')]=qs[_0x45c5('0x20')](_0x58db43['query'][_0x45c5('0x20')]);}return _0x1859f7[_0x45c5('0x4f')](_0x47c2fa);}})[_0x45c5('0x26')](function(_0x1978be){if(_0x1978be){return _0x1978be?{'count':_0x10ec30,'rows':_0x1978be}:null;}})[_0x45c5('0x26')](respondWithResult(_0x3cc87a,null))[_0x45c5('0x48')](handleError(_0x3cc87a,null));};exports[_0x45c5('0x50')]=function(_0x348acb,_0x47f437,_0x423201){var _0x47436b={};var _0x4f18d0={};var _0x55c1a0;var _0x31a537;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x348acb[_0x45c5('0x43')]['id']}})[_0x45c5('0x26')](handleEntityNotFound(_0x47f437,null))[_0x45c5('0x26')](function(_0x199170){if(_0x199170){_0x55c1a0=_0x199170;_0x4f18d0['model']=_['keys'](db['SalesforceField'][_0x45c5('0x2c')]);_0x4f18d0[_0x45c5('0x33')]=_['keys'](_0x348acb['query']);_0x4f18d0[_0x45c5('0x39')]=_[_0x45c5('0x30')](_0x4f18d0[_0x45c5('0x2f')],_0x4f18d0[_0x45c5('0x33')]);_0x47436b[_0x45c5('0x31')]=_[_0x45c5('0x30')](_0x4f18d0[_0x45c5('0x2f')],qs[_0x45c5('0x32')](_0x348acb[_0x45c5('0x33')][_0x45c5('0x32')]));_0x47436b['attributes']=_0x47436b[_0x45c5('0x31')]['length']?_0x47436b[_0x45c5('0x31')]:_0x4f18d0[_0x45c5('0x2f')];_0x47436b[_0x45c5('0x36')]=qs[_0x45c5('0x37')](_0x348acb[_0x45c5('0x33')][_0x45c5('0x37')]);_0x47436b[_0x45c5('0x3a')]=qs[_0x45c5('0x39')](_[_0x45c5('0x38')](_0x348acb[_0x45c5('0x33')],_0x4f18d0['filters']));if(_0x348acb[_0x45c5('0x33')][_0x45c5('0x3c')]){_0x47436b[_0x45c5('0x3a')]=_[_0x45c5('0x3d')](_0x47436b[_0x45c5('0x3a')],{'$or':_[_0x45c5('0x2a')](_0x47436b[_0x45c5('0x31')],function(_0x179720){var _0x39ec1b={};_0x39ec1b[_0x179720]={'$like':'%'+_0x348acb[_0x45c5('0x33')][_0x45c5('0x3c')]+'%'};return _0x39ec1b;})});}_0x47436b=_[_0x45c5('0x3d')]({},_0x47436b,_0x348acb[_0x45c5('0x46')]);return _0x55c1a0[_0x45c5('0x50')](_0x47436b);}})[_0x45c5('0x26')](function(_0x4a21c8){if(_0x4a21c8){_0x31a537=_0x4a21c8[_0x45c5('0x45')];if(!_0x348acb[_0x45c5('0x33')]['hasOwnProperty'](_0x45c5('0x35'))){_0x47436b[_0x45c5('0x21')]=qs[_0x45c5('0x21')](_0x348acb[_0x45c5('0x33')][_0x45c5('0x21')]);_0x47436b[_0x45c5('0x20')]=qs[_0x45c5('0x20')](_0x348acb[_0x45c5('0x33')][_0x45c5('0x20')]);}return _0x55c1a0[_0x45c5('0x50')](_0x47436b);}})[_0x45c5('0x26')](function(_0x2594cd){if(_0x2594cd){return _0x2594cd?{'count':_0x31a537,'rows':_0x2594cd}:null;}})[_0x45c5('0x26')](respondWithResult(_0x47f437,null))['catch'](handleError(_0x47f437,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 44821fe..9f8c528 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 _0x4b54=['SalesforceConfiguration','int_salesforce_configurations','../../config/logger','bluebird','request-promise','path','rimraf','./intSalesforceConfiguration.attributes','define'];(function(_0x23ae32,_0x1726ea){var _0x20c00e=function(_0xf8415b){while(--_0xf8415b){_0x23ae32['push'](_0x23ae32['shift']());}};_0x20c00e(++_0x1726ea);}(_0x4b54,0xa4));var _0x44b5=function(_0x2d086e,_0x5516c7){_0x2d086e=_0x2d086e-0x0;var _0x39bd87=_0x4b54[_0x2d086e];return _0x39bd87;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x44b5('0x0'))('api');var moment=require('moment');var BPromise=require(_0x44b5('0x1'));var rp=require(_0x44b5('0x2'));var fs=require('fs');var path=require(_0x44b5('0x3'));var rimraf=require(_0x44b5('0x4'));var config=require('../../config/environment');var attributes=require(_0x44b5('0x5'));module['exports']=function(_0x290f62,_0xa66529){return _0x290f62[_0x44b5('0x6')](_0x44b5('0x7'),attributes,{'tableName':_0x44b5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x14a7=['../../config/environment','./intSalesforceConfiguration.attributes','exports','define','int_salesforce_configurations','lodash','util','api','moment','bluebird','path','rimraf'];(function(_0x133f78,_0x32c4af){var _0x213cd3=function(_0x344b8c){while(--_0x344b8c){_0x133f78['push'](_0x133f78['shift']());}};_0x213cd3(++_0x32c4af);}(_0x14a7,0x149));var _0x714a=function(_0x1faed1,_0x4330d3){_0x1faed1=_0x1faed1-0x0;var _0x16c1c9=_0x14a7[_0x1faed1];return _0x16c1c9;};'use strict';var _=require(_0x714a('0x0'));var util=require(_0x714a('0x1'));var logger=require('../../config/logger')(_0x714a('0x2'));var moment=require(_0x714a('0x3'));var BPromise=require(_0x714a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x714a('0x5'));var rimraf=require(_0x714a('0x6'));var config=require(_0x714a('0x7'));var attributes=require(_0x714a('0x8'));module[_0x714a('0x9')]=function(_0x30c41a,_0x3a06c8){return _0x30c41a[_0x714a('0xa')]('SalesforceConfiguration',attributes,{'tableName':_0x714a('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 6eb5a0a..d2d0ccf 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 _0xf4ce=['http','request','info','request\x20sent','debug','stringify','error','code','message','SalesforceConfiguration,\x20%s,\x20%s','result','catch','bluebird','ioredis','../../config/logger','../../config/environment','client'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf4ce,0x72));var _0xef4c=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xf4ce[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xef4c('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xef4c('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xef4c('0x2'))('rpc');var config=require(_0xef4c('0x3'));var jayson=require('jayson/promise');var client=jayson[_0xef4c('0x4')][_0xef4c('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x21ccb9,_0x4e2da0,_0x2f332f){return new BPromise(function(_0x48cb96,_0x352409){return client[_0xef4c('0x6')](_0x21ccb9,_0x2f332f)['then'](function(_0x5268a5){logger[_0xef4c('0x7')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4e2da0,_0xef4c('0x8'));logger[_0xef4c('0x9')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x4e2da0,_0xef4c('0x8'),JSON[_0xef4c('0xa')](_0x5268a5));if(_0x5268a5[_0xef4c('0xb')]){if(_0x5268a5[_0xef4c('0xb')][_0xef4c('0xc')]===0x1f4){logger[_0xef4c('0xb')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4e2da0,_0x5268a5[_0xef4c('0xb')][_0xef4c('0xd')]);return _0x352409(_0x5268a5[_0xef4c('0xb')][_0xef4c('0xd')]);}logger[_0xef4c('0xb')](_0xef4c('0xe'),_0x4e2da0,_0x5268a5['error'][_0xef4c('0xd')]);return _0x48cb96(_0x5268a5[_0xef4c('0xb')][_0xef4c('0xd')]);}else{logger[_0xef4c('0x7')](_0xef4c('0xe'),_0x4e2da0,_0xef4c('0x8'));_0x48cb96(_0x5268a5[_0xef4c('0xf')][_0xef4c('0xd')]);}})[_0xef4c('0x10')](function(_0x3c1e90){logger[_0xef4c('0xb')](_0xef4c('0xe'),_0x4e2da0,_0x3c1e90);_0x352409(_0x3c1e90);});});} \ No newline at end of file +var _0xfb8c=['client','http','request','then','info','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0xc7b3c7,_0x4755d5){var _0x51c8d9=function(_0x43dab8){while(--_0x43dab8){_0xc7b3c7['push'](_0xc7b3c7['shift']());}};_0x51c8d9(++_0x4755d5);}(_0xfb8c,0xbe));var _0xcfb8=function(_0x54d1f4,_0x195be5){_0x54d1f4=_0x54d1f4-0x0;var _0x3bfb51=_0xfb8c[_0x54d1f4];return _0x3bfb51;};'use strict';var _=require(_0xcfb8('0x0'));var util=require('util');var moment=require(_0xcfb8('0x1'));var BPromise=require(_0xcfb8('0x2'));var rs=require(_0xcfb8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcfb8('0x4'));var logger=require(_0xcfb8('0x5'))('rpc');var config=require(_0xcfb8('0x6'));var jayson=require(_0xcfb8('0x7'));var client=jayson[_0xcfb8('0x8')][_0xcfb8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e9403,_0x1062d4,_0x1608d7){return new BPromise(function(_0x419e9d,_0x44ec1a){return client[_0xcfb8('0xa')](_0x2e9403,_0x1608d7)[_0xcfb8('0xb')](function(_0x5cfc7f){logger[_0xcfb8('0xc')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1062d4,_0xcfb8('0xd'));logger[_0xcfb8('0xe')](_0xcfb8('0xf'),_0x1062d4,'request\x20sent',JSON[_0xcfb8('0x10')](_0x5cfc7f));if(_0x5cfc7f[_0xcfb8('0x11')]){if(_0x5cfc7f[_0xcfb8('0x11')][_0xcfb8('0x12')]===0x1f4){logger[_0xcfb8('0x11')](_0xcfb8('0x13'),_0x1062d4,_0x5cfc7f['error'][_0xcfb8('0x14')]);return _0x44ec1a(_0x5cfc7f[_0xcfb8('0x11')]['message']);}logger[_0xcfb8('0x11')](_0xcfb8('0x13'),_0x1062d4,_0x5cfc7f[_0xcfb8('0x11')][_0xcfb8('0x14')]);return _0x419e9d(_0x5cfc7f['error']['message']);}else{logger[_0xcfb8('0xc')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1062d4,_0xcfb8('0xd'));_0x419e9d(_0x5cfc7f[_0xcfb8('0x15')][_0xcfb8('0x14')]);}})['catch'](function(_0x39c750){logger[_0xcfb8('0x11')](_0xcfb8('0x13'),_0x1062d4,_0x39c750);_0x44ec1a(_0x39c750);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 43f6b35..4d1e9db 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 _0x54e6=['isAuthenticated','index','show','post','create','/:id','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x49bd83,_0x7265c8){var _0x375275=function(_0x2b56fb){while(--_0x2b56fb){_0x49bd83['push'](_0x49bd83['shift']());}};_0x375275(++_0x7265c8);}(_0x54e6,0xf5));var _0x654e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x54e6[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x654e('0x0'));var util=require(_0x654e('0x1'));var path=require(_0x654e('0x2'));var timeout=require(_0x654e('0x3'));var express=require(_0x654e('0x4'));var router=express['Router']();var fs_extra=require(_0x654e('0x5'));var auth=require(_0x654e('0x6'));var interaction=require(_0x654e('0x7'));var config=require(_0x654e('0x8'));var controller=require('./intSalesforceField.controller');router[_0x654e('0x9')]('/',auth[_0x654e('0xa')](),controller[_0x654e('0xb')]);router[_0x654e('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x654e('0xc')]);router[_0x654e('0xd')]('/',auth[_0x654e('0xa')](),controller[_0x654e('0xe')]);router['put'](_0x654e('0xf'),auth[_0x654e('0xa')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x654e('0x10')]);module['exports']=router; \ No newline at end of file +var _0x0006=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','/:id','isAuthenticated','show','post','update','delete','destroy','exports','multer'];(function(_0x2ed3a2,_0x5cc62a){var _0xf11bbc=function(_0x241d9d){while(--_0x241d9d){_0x2ed3a2['push'](_0x2ed3a2['shift']());}};_0xf11bbc(++_0x5cc62a);}(_0x0006,0x18f));var _0x6000=function(_0x5447a1,_0x226452){_0x5447a1=_0x5447a1-0x0;var _0x59bf42=_0x0006[_0x5447a1];return _0x59bf42;};'use strict';var multer=require(_0x6000('0x0'));var util=require(_0x6000('0x1'));var path=require(_0x6000('0x2'));var timeout=require(_0x6000('0x3'));var express=require(_0x6000('0x4'));var router=express[_0x6000('0x5')]();var fs_extra=require(_0x6000('0x6'));var auth=require(_0x6000('0x7'));var interaction=require(_0x6000('0x8'));var config=require(_0x6000('0x9'));var controller=require(_0x6000('0xa'));router[_0x6000('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6000('0xb')](_0x6000('0xc'),auth[_0x6000('0xd')](),controller[_0x6000('0xe')]);router[_0x6000('0xf')]('/',auth[_0x6000('0xd')](),controller['create']);router['put'](_0x6000('0xc'),auth[_0x6000('0xd')](),controller[_0x6000('0x10')]);router[_0x6000('0x11')]('/:id',auth[_0x6000('0xd')](),controller[_0x6000('0x12')]);module[_0x6000('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 48bf289..4d0b07f 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 _0x40c1=['STRING','sequelize','exports','ENUM','string','variable','customVariable','picklist'];(function(_0x179557,_0x539c5e){var _0x4caaa3=function(_0x126083){while(--_0x126083){_0x179557['push'](_0x179557['shift']());}};_0x4caaa3(++_0x539c5e);}(_0x40c1,0xd1));var _0x140c=function(_0x4eca25,_0x1423e2){_0x4eca25=_0x4eca25-0x0;var _0x48fcf5=_0x40c1[_0x4eca25];return _0x48fcf5;};'use strict';var Sequelize=require(_0x140c('0x0'));module[_0x140c('0x1')]={'type':{'type':Sequelize[_0x140c('0x2')](_0x140c('0x3'),_0x140c('0x4'),_0x140c('0x5'),'keyValue',_0x140c('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x140c('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x140c('0x2')](_0x140c('0x3'),_0x140c('0x4'),_0x140c('0x5'))},'keyContent':{'type':Sequelize[_0x140c('0x7')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x140c('0x7')]}}; \ No newline at end of file +var _0xf55b=['exports','string','customVariable','keyValue','STRING','variable','sequelize'];(function(_0x45a85e,_0x292dd7){var _0x4c85b7=function(_0x10059f){while(--_0x10059f){_0x45a85e['push'](_0x45a85e['shift']());}};_0x4c85b7(++_0x292dd7);}(_0xf55b,0x1bf));var _0xbf55=function(_0xf9968b,_0x2a7d07){_0xf9968b=_0xf9968b-0x0;var _0x206bd5=_0xf55b[_0xf9968b];return _0x206bd5;};'use strict';var Sequelize=require(_0xbf55('0x0'));module[_0xbf55('0x1')]={'type':{'type':Sequelize['ENUM'](_0xbf55('0x2'),'variable',_0xbf55('0x3'),_0xbf55('0x4'),'picklist'),'defaultValue':_0xbf55('0x2')},'content':{'type':Sequelize[_0xbf55('0x5')]},'key':{'type':Sequelize[_0xbf55('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xbf55('0x2'),_0xbf55('0x6'),_0xbf55('0x3'))},'keyContent':{'type':Sequelize[_0xbf55('0x5')]},'idField':{'type':Sequelize[_0xbf55('0x5')]},'variableName':{'type':Sequelize[_0xbf55('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 1f7a8d8..f95a700 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 _0xf47a=['rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','options','create','body','find','params','rimraf','zip-dir','fast-json-patch','request-promise','mustache','sox','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','count','status','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','SalesforceField'];(function(_0x1c5dc4,_0x4e3972){var _0x5ebc43=function(_0x110693){while(--_0x110693){_0x1c5dc4['push'](_0x1c5dc4['shift']());}};_0x5ebc43(++_0x4e3972);}(_0xf47a,0x176));var _0xaf47=function(_0x2d79ca,_0x45b4c0){_0x2d79ca=_0x2d79ca-0x0;var _0x18a68e=_0xf47a[_0x2d79ca];return _0x18a68e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaf47('0x0'));var zipdir=require(_0xaf47('0x1'));var jsonpatch=require(_0xaf47('0x2'));var rp=require(_0xaf47('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xaf47('0x4'));var util=require('util');var path=require('path');var sox=require(_0xaf47('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaf47('0x6'));var _=require(_0xaf47('0x7'));var squel=require(_0xaf47('0x8'));var crypto=require(_0xaf47('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaf47('0xa'));var Papa=require(_0xaf47('0xb'));var Redis=require(_0xaf47('0xc'));var authService=require(_0xaf47('0xd'));var qs=require(_0xaf47('0xe'));var as=require(_0xaf47('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xaf47('0x10'));var utils=require(_0xaf47('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xaf47('0x12'));var db=require(_0xaf47('0x13'))['db'];function respondWithStatusCode(_0x3b5529,_0x464eea){_0x464eea=_0x464eea||0xcc;return function(_0x1b3769){if(_0x1b3769){return _0x3b5529[_0xaf47('0x14')](_0x464eea);}return _0x3b5529['status'](_0x464eea)[_0xaf47('0x15')]();};}function respondWithResult(_0x442e78,_0x9c1569){_0x9c1569=_0x9c1569||0xc8;return function(_0x2dcacb){if(_0x2dcacb){return _0x442e78['status'](_0x9c1569)[_0xaf47('0x16')](_0x2dcacb);}};}function respondWithFilteredResult(_0x1626b5,_0x3e846c){return function(_0xd1ff2d){if(_0xd1ff2d){var _0x31f581=typeof _0x3e846c[_0xaf47('0x17')]==='undefined'&&typeof _0x3e846c[_0xaf47('0x18')]==='undefined';var _0x4c3dc3=_0xd1ff2d['count'];var _0x3676da=_0x31f581?0x0:_0x3e846c[_0xaf47('0x17')];var _0x39302b=_0x31f581?_0xd1ff2d[_0xaf47('0x19')]:_0x3e846c[_0xaf47('0x17')]+_0x3e846c[_0xaf47('0x18')];var _0x2713f6;if(_0x39302b>=_0x4c3dc3){_0x39302b=_0x4c3dc3;_0x2713f6=0xc8;}else{_0x2713f6=0xce;}_0x1626b5[_0xaf47('0x1a')](_0x2713f6);return _0x1626b5[_0xaf47('0x1b')](_0xaf47('0x1c'),_0x3676da+'-'+_0x39302b+'/'+_0x4c3dc3)['json'](_0xd1ff2d);}return null;};}function patchUpdates(_0x5ae283){return function(_0xfe22e7){try{jsonpatch[_0xaf47('0x1d')](_0xfe22e7,_0x5ae283,!![]);}catch(_0x5528a0){return BPromise[_0xaf47('0x1e')](_0x5528a0);}return _0xfe22e7['save']();};}function saveUpdates(_0x2296a2,_0x2f7623){return function(_0x155d55){if(_0x155d55){return _0x155d55[_0xaf47('0x1f')](_0x2296a2)[_0xaf47('0x20')](function(_0x2e24ec){return _0x2e24ec;});}return null;};}function removeEntity(_0x2e1e3c,_0x1cac3e){return function(_0x4ab53d){if(_0x4ab53d){return _0x4ab53d[_0xaf47('0x21')]()[_0xaf47('0x20')](function(){_0x2e1e3c[_0xaf47('0x1a')](0xcc)[_0xaf47('0x15')]();});}};}function handleEntityNotFound(_0x3a7c8e,_0x5de906){return function(_0x2b7265){if(!_0x2b7265){_0x3a7c8e[_0xaf47('0x14')](0x194);}return _0x2b7265;};}function handleError(_0x3956d2,_0x2e9f6b){_0x2e9f6b=_0x2e9f6b||0x1f4;return function(_0x51af81){logger[_0xaf47('0x22')](_0x51af81[_0xaf47('0x23')]);if(_0x51af81[_0xaf47('0x24')]){delete _0x51af81[_0xaf47('0x24')];}_0x3956d2['status'](_0x2e9f6b)['send'](_0x51af81);};}exports[_0xaf47('0x25')]=function(_0x35dd01,_0x26ccaa){var _0x5bdbc8={},_0x62e33e={},_0x1494cd={'count':0x0,'rows':[]};var _0xcb8e5e=_[_0xaf47('0x26')](db[_0xaf47('0x27')][_0xaf47('0x28')],function(_0x4427dc){return{'name':_0x4427dc[_0xaf47('0x29')],'type':_0x4427dc[_0xaf47('0x2a')]['key']};});_0x62e33e[_0xaf47('0x2b')]=_[_0xaf47('0x26')](_0xcb8e5e,'name');_0x62e33e[_0xaf47('0x2c')]=_[_0xaf47('0x2d')](_0x35dd01['query']);_0x62e33e[_0xaf47('0x2e')]=_[_0xaf47('0x2f')](_0x62e33e[_0xaf47('0x2b')],_0x62e33e[_0xaf47('0x2c')]);_0x5bdbc8[_0xaf47('0x30')]=_[_0xaf47('0x2f')](_0x62e33e[_0xaf47('0x2b')],qs[_0xaf47('0x31')](_0x35dd01[_0xaf47('0x2c')]['fields']));_0x5bdbc8[_0xaf47('0x30')]=_0x5bdbc8[_0xaf47('0x30')][_0xaf47('0x32')]?_0x5bdbc8[_0xaf47('0x30')]:_0x62e33e[_0xaf47('0x2b')];if(!_0x35dd01[_0xaf47('0x2c')][_0xaf47('0x33')]('nolimit')){_0x5bdbc8[_0xaf47('0x18')]=qs[_0xaf47('0x18')](_0x35dd01[_0xaf47('0x2c')][_0xaf47('0x18')]);_0x5bdbc8[_0xaf47('0x17')]=qs['offset'](_0x35dd01[_0xaf47('0x2c')][_0xaf47('0x17')]);}_0x5bdbc8[_0xaf47('0x34')]=qs[_0xaf47('0x35')](_0x35dd01[_0xaf47('0x2c')][_0xaf47('0x35')]);_0x5bdbc8[_0xaf47('0x36')]=qs[_0xaf47('0x2e')](_[_0xaf47('0x37')](_0x35dd01[_0xaf47('0x2c')],_0x62e33e[_0xaf47('0x2e')]),_0xcb8e5e);if(_0x35dd01[_0xaf47('0x2c')][_0xaf47('0x38')]){_0x5bdbc8['where']=_[_0xaf47('0x39')](_0x5bdbc8[_0xaf47('0x36')],{'$or':_[_0xaf47('0x26')](_0xcb8e5e,function(_0xaccd69){if(_0xaccd69[_0xaf47('0x2a')]!=='VIRTUAL'){var _0x58639b={};_0x58639b[_0xaccd69[_0xaf47('0x24')]]={'$like':'%'+_0x35dd01[_0xaf47('0x2c')][_0xaf47('0x38')]+'%'};return _0x58639b;}})});}_0x5bdbc8=_['merge']({},_0x5bdbc8,_0x35dd01['options']);var _0xbdaa46={'where':_0x5bdbc8[_0xaf47('0x36')]};return db[_0xaf47('0x27')][_0xaf47('0x19')](_0xbdaa46)[_0xaf47('0x20')](function(_0x5157b8){_0x1494cd[_0xaf47('0x19')]=_0x5157b8;if(_0x35dd01[_0xaf47('0x2c')][_0xaf47('0x3a')]){_0x5bdbc8[_0xaf47('0x3b')]=[{'all':!![]}];}return db['SalesforceField'][_0xaf47('0x3c')](_0x5bdbc8);})[_0xaf47('0x20')](function(_0x115d55){_0x1494cd[_0xaf47('0x3d')]=_0x115d55;return _0x1494cd;})[_0xaf47('0x20')](respondWithFilteredResult(_0x26ccaa,_0x5bdbc8))[_0xaf47('0x3e')](handleError(_0x26ccaa,null));};exports[_0xaf47('0x3f')]=function(_0x139d60,_0x3e4078){var _0x29f2c1={'raw':!![],'where':{'id':_0x139d60['params']['id']}},_0xb4a1bc={};_0xb4a1bc['model']=_[_0xaf47('0x2d')](db['SalesforceField']['rawAttributes']);_0xb4a1bc[_0xaf47('0x2c')]=_[_0xaf47('0x2d')](_0x139d60['query']);_0xb4a1bc[_0xaf47('0x2e')]=_[_0xaf47('0x2f')](_0xb4a1bc[_0xaf47('0x2b')],_0xb4a1bc['query']);_0x29f2c1[_0xaf47('0x30')]=_['intersection'](_0xb4a1bc[_0xaf47('0x2b')],qs[_0xaf47('0x31')](_0x139d60['query'][_0xaf47('0x31')]));_0x29f2c1[_0xaf47('0x30')]=_0x29f2c1['attributes'][_0xaf47('0x32')]?_0x29f2c1[_0xaf47('0x30')]:_0xb4a1bc['model'];if(_0x139d60[_0xaf47('0x2c')]['includeAll']){_0x29f2c1[_0xaf47('0x3b')]=[{'all':!![]}];}_0x29f2c1=_[_0xaf47('0x39')]({},_0x29f2c1,_0x139d60[_0xaf47('0x40')]);return db[_0xaf47('0x27')]['find'](_0x29f2c1)['then'](handleEntityNotFound(_0x3e4078,null))[_0xaf47('0x20')](respondWithResult(_0x3e4078,null))[_0xaf47('0x3e')](handleError(_0x3e4078,null));};exports[_0xaf47('0x41')]=function(_0x346a01,_0x413e56){return db[_0xaf47('0x27')][_0xaf47('0x41')](_0x346a01[_0xaf47('0x42')],{})[_0xaf47('0x20')](respondWithResult(_0x413e56,0xc9))['catch'](handleError(_0x413e56,null));};exports[_0xaf47('0x1f')]=function(_0x5a0364,_0x22916d){if(_0x5a0364[_0xaf47('0x42')]['id']){delete _0x5a0364[_0xaf47('0x42')]['id'];}return db[_0xaf47('0x27')][_0xaf47('0x43')]({'where':{'id':_0x5a0364[_0xaf47('0x44')]['id']}})[_0xaf47('0x20')](handleEntityNotFound(_0x22916d,null))[_0xaf47('0x20')](saveUpdates(_0x5a0364[_0xaf47('0x42')],null))['then'](respondWithResult(_0x22916d,null))['catch'](handleError(_0x22916d,null));};exports['destroy']=function(_0x3b5a7b,_0x3ef0a7){return db[_0xaf47('0x27')][_0xaf47('0x43')]({'where':{'id':_0x3b5a7b['params']['id']}})['then'](handleEntityNotFound(_0x3ef0a7,null))['then'](removeEntity(_0x3ef0a7,null))['catch'](handleError(_0x3ef0a7,null));}; \ No newline at end of file +var _0xf77a=['filter','options','includeAll','include','rows','params','rawAttributes','merge','find','create','body','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','SalesforceField','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x4b2c0f,_0x342192){var _0x332132=function(_0x318683){while(--_0x318683){_0x4b2c0f['push'](_0x4b2c0f['shift']());}};_0x332132(++_0x342192);}(_0xf77a,0xa4));var _0xaf77=function(_0x9458c0,_0x513288){_0x9458c0=_0x9458c0-0x0;var _0x45656e=_0xf77a[_0x9458c0];return _0x45656e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaf77('0x0'));var zipdir=require(_0xaf77('0x1'));var jsonpatch=require(_0xaf77('0x2'));var rp=require(_0xaf77('0x3'));var moment=require(_0xaf77('0x4'));var BPromise=require(_0xaf77('0x5'));var Mustache=require('mustache');var util=require(_0xaf77('0x6'));var path=require('path');var sox=require(_0xaf77('0x7'));var csv=require(_0xaf77('0x8'));var ejs=require(_0xaf77('0x9'));var fs=require('fs');var fs_extra=require(_0xaf77('0xa'));var _=require(_0xaf77('0xb'));var squel=require(_0xaf77('0xc'));var crypto=require(_0xaf77('0xd'));var jsforce=require(_0xaf77('0xe'));var deskjs=require(_0xaf77('0xf'));var toCsv=require(_0xaf77('0x8'));var querystring=require(_0xaf77('0x10'));var Papa=require(_0xaf77('0x11'));var Redis=require(_0xaf77('0x12'));var authService=require(_0xaf77('0x13'));var qs=require(_0xaf77('0x14'));var as=require(_0xaf77('0x15'));var hardwareService=require(_0xaf77('0x16'));var logger=require(_0xaf77('0x17'))(_0xaf77('0x18'));var utils=require(_0xaf77('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xaf77('0x1a'));var db=require(_0xaf77('0x1b'))['db'];function respondWithStatusCode(_0x139dc7,_0x20b82a){_0x20b82a=_0x20b82a||0xcc;return function(_0x44195d){if(_0x44195d){return _0x139dc7[_0xaf77('0x1c')](_0x20b82a);}return _0x139dc7[_0xaf77('0x1d')](_0x20b82a)[_0xaf77('0x1e')]();};}function respondWithResult(_0x216cfd,_0x35617c){_0x35617c=_0x35617c||0xc8;return function(_0x2b92e2){if(_0x2b92e2){return _0x216cfd[_0xaf77('0x1d')](_0x35617c)[_0xaf77('0x1f')](_0x2b92e2);}};}function respondWithFilteredResult(_0x30b8ee,_0x58c076){return function(_0x418bef){if(_0x418bef){var _0x32523f=typeof _0x58c076[_0xaf77('0x20')]===_0xaf77('0x21')&&typeof _0x58c076[_0xaf77('0x22')]==='undefined';var _0x329128=_0x418bef[_0xaf77('0x23')];var _0x256890=_0x32523f?0x0:_0x58c076[_0xaf77('0x20')];var _0x4cd94f=_0x32523f?_0x418bef[_0xaf77('0x23')]:_0x58c076[_0xaf77('0x20')]+_0x58c076[_0xaf77('0x22')];var _0x2fd0ad;if(_0x4cd94f>=_0x329128){_0x4cd94f=_0x329128;_0x2fd0ad=0xc8;}else{_0x2fd0ad=0xce;}_0x30b8ee[_0xaf77('0x1d')](_0x2fd0ad);return _0x30b8ee['set'](_0xaf77('0x24'),_0x256890+'-'+_0x4cd94f+'/'+_0x329128)[_0xaf77('0x1f')](_0x418bef);}return null;};}function patchUpdates(_0xaa14f3){return function(_0x2e722f){try{jsonpatch[_0xaf77('0x25')](_0x2e722f,_0xaa14f3,!![]);}catch(_0x341406){return BPromise[_0xaf77('0x26')](_0x341406);}return _0x2e722f[_0xaf77('0x27')]();};}function saveUpdates(_0x17672d,_0x106d33){return function(_0x174f96){if(_0x174f96){return _0x174f96[_0xaf77('0x28')](_0x17672d)[_0xaf77('0x29')](function(_0x4887dd){return _0x4887dd;});}return null;};}function removeEntity(_0x6bd263,_0x7d7374){return function(_0x2804f9){if(_0x2804f9){return _0x2804f9[_0xaf77('0x2a')]()[_0xaf77('0x29')](function(){_0x6bd263['status'](0xcc)[_0xaf77('0x1e')]();});}};}function handleEntityNotFound(_0x4a6f0b,_0x579acf){return function(_0x2880da){if(!_0x2880da){_0x4a6f0b[_0xaf77('0x1c')](0x194);}return _0x2880da;};}function handleError(_0x243ac1,_0x26ff1d){_0x26ff1d=_0x26ff1d||0x1f4;return function(_0x4ae7ed){logger[_0xaf77('0x2b')](_0x4ae7ed[_0xaf77('0x2c')]);if(_0x4ae7ed[_0xaf77('0x2d')]){delete _0x4ae7ed['name'];}_0x243ac1['status'](_0x26ff1d)['send'](_0x4ae7ed);};}exports[_0xaf77('0x2e')]=function(_0x114e6f,_0x48ac2a){var _0x1159f2={},_0xe7f67={},_0x2aadea={'count':0x0,'rows':[]};var _0xd86de4=_[_0xaf77('0x2f')](db[_0xaf77('0x30')]['rawAttributes'],function(_0x85986b){return{'name':_0x85986b[_0xaf77('0x31')],'type':_0x85986b[_0xaf77('0x32')]['key']};});_0xe7f67['model']=_[_0xaf77('0x2f')](_0xd86de4,_0xaf77('0x2d'));_0xe7f67[_0xaf77('0x33')]=_[_0xaf77('0x34')](_0x114e6f[_0xaf77('0x33')]);_0xe7f67[_0xaf77('0x35')]=_[_0xaf77('0x36')](_0xe7f67[_0xaf77('0x37')],_0xe7f67[_0xaf77('0x33')]);_0x1159f2['attributes']=_['intersection'](_0xe7f67[_0xaf77('0x37')],qs[_0xaf77('0x38')](_0x114e6f['query']['fields']));_0x1159f2['attributes']=_0x1159f2[_0xaf77('0x39')][_0xaf77('0x3a')]?_0x1159f2[_0xaf77('0x39')]:_0xe7f67[_0xaf77('0x37')];if(!_0x114e6f['query'][_0xaf77('0x3b')](_0xaf77('0x3c'))){_0x1159f2[_0xaf77('0x22')]=qs['limit'](_0x114e6f['query']['limit']);_0x1159f2[_0xaf77('0x20')]=qs['offset'](_0x114e6f[_0xaf77('0x33')]['offset']);}_0x1159f2[_0xaf77('0x3d')]=qs[_0xaf77('0x3e')](_0x114e6f['query']['sort']);_0x1159f2[_0xaf77('0x3f')]=qs[_0xaf77('0x35')](_['pick'](_0x114e6f[_0xaf77('0x33')],_0xe7f67[_0xaf77('0x35')]),_0xd86de4);if(_0x114e6f[_0xaf77('0x33')]['filter']){_0x1159f2[_0xaf77('0x3f')]=_['merge'](_0x1159f2[_0xaf77('0x3f')],{'$or':_[_0xaf77('0x2f')](_0xd86de4,function(_0x5bb90a){if(_0x5bb90a['type']!=='VIRTUAL'){var _0x20f76c={};_0x20f76c[_0x5bb90a[_0xaf77('0x2d')]]={'$like':'%'+_0x114e6f['query'][_0xaf77('0x40')]+'%'};return _0x20f76c;}})});}_0x1159f2=_['merge']({},_0x1159f2,_0x114e6f[_0xaf77('0x41')]);var _0x179999={'where':_0x1159f2['where']};return db[_0xaf77('0x30')][_0xaf77('0x23')](_0x179999)['then'](function(_0xf2fda5){_0x2aadea['count']=_0xf2fda5;if(_0x114e6f['query'][_0xaf77('0x42')]){_0x1159f2[_0xaf77('0x43')]=[{'all':!![]}];}return db[_0xaf77('0x30')]['findAll'](_0x1159f2);})[_0xaf77('0x29')](function(_0x37b18d){_0x2aadea[_0xaf77('0x44')]=_0x37b18d;return _0x2aadea;})[_0xaf77('0x29')](respondWithFilteredResult(_0x48ac2a,_0x1159f2))['catch'](handleError(_0x48ac2a,null));};exports['show']=function(_0x1b4e85,_0x1e4e31){var _0x399bf2={'raw':!![],'where':{'id':_0x1b4e85[_0xaf77('0x45')]['id']}},_0x5c944a={};_0x5c944a[_0xaf77('0x37')]=_[_0xaf77('0x34')](db[_0xaf77('0x30')][_0xaf77('0x46')]);_0x5c944a[_0xaf77('0x33')]=_[_0xaf77('0x34')](_0x1b4e85[_0xaf77('0x33')]);_0x5c944a['filters']=_[_0xaf77('0x36')](_0x5c944a[_0xaf77('0x37')],_0x5c944a[_0xaf77('0x33')]);_0x399bf2[_0xaf77('0x39')]=_['intersection'](_0x5c944a[_0xaf77('0x37')],qs[_0xaf77('0x38')](_0x1b4e85[_0xaf77('0x33')][_0xaf77('0x38')]));_0x399bf2[_0xaf77('0x39')]=_0x399bf2[_0xaf77('0x39')][_0xaf77('0x3a')]?_0x399bf2['attributes']:_0x5c944a['model'];if(_0x1b4e85[_0xaf77('0x33')][_0xaf77('0x42')]){_0x399bf2['include']=[{'all':!![]}];}_0x399bf2=_[_0xaf77('0x47')]({},_0x399bf2,_0x1b4e85['options']);return db['SalesforceField'][_0xaf77('0x48')](_0x399bf2)[_0xaf77('0x29')](handleEntityNotFound(_0x1e4e31,null))[_0xaf77('0x29')](respondWithResult(_0x1e4e31,null))['catch'](handleError(_0x1e4e31,null));};exports['create']=function(_0x322f3e,_0x2cc07d){return db[_0xaf77('0x30')][_0xaf77('0x49')](_0x322f3e[_0xaf77('0x4a')],{})[_0xaf77('0x29')](respondWithResult(_0x2cc07d,0xc9))[_0xaf77('0x4b')](handleError(_0x2cc07d,null));};exports[_0xaf77('0x28')]=function(_0x13286b,_0x3c67cb){if(_0x13286b['body']['id']){delete _0x13286b['body']['id'];}return db[_0xaf77('0x30')]['find']({'where':{'id':_0x13286b[_0xaf77('0x45')]['id']}})[_0xaf77('0x29')](handleEntityNotFound(_0x3c67cb,null))[_0xaf77('0x29')](saveUpdates(_0x13286b['body'],null))['then'](respondWithResult(_0x3c67cb,null))['catch'](handleError(_0x3c67cb,null));};exports['destroy']=function(_0x258b3d,_0x3e2455){return db[_0xaf77('0x30')][_0xaf77('0x48')]({'where':{'id':_0x258b3d[_0xaf77('0x45')]['id']}})[_0xaf77('0x29')](handleEntityNotFound(_0x3e2455,null))['then'](removeEntity(_0x3e2455,null))[_0xaf77('0x4b')](handleError(_0x3e2455,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index e9ced82..a3cbaeb 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 _0xf511=['util','api','bluebird','request-promise','path','../../config/environment','./intSalesforceField.attributes','define','int_salesforce_fields','salesforce_unique_index','lodash'];(function(_0x29379a,_0x16b64f){var _0x125b52=function(_0xea6150){while(--_0xea6150){_0x29379a['push'](_0x29379a['shift']());}};_0x125b52(++_0x16b64f);}(_0xf511,0xba));var _0x1f51=function(_0x999b85,_0x1edc2b){_0x999b85=_0x999b85-0x0;var _0x1d7124=_0xf511[_0x999b85];return _0x1d7124;};'use strict';var _=require(_0x1f51('0x0'));var util=require(_0x1f51('0x1'));var logger=require('../../config/logger')(_0x1f51('0x2'));var moment=require('moment');var BPromise=require(_0x1f51('0x3'));var rp=require(_0x1f51('0x4'));var fs=require('fs');var path=require(_0x1f51('0x5'));var rimraf=require('rimraf');var config=require(_0x1f51('0x6'));var attributes=require(_0x1f51('0x7'));module['exports']=function(_0x5d7f83,_0x46d92a){return _0x5d7f83[_0x1f51('0x8')]('SalesforceField',attributes,{'tableName':_0x1f51('0x9'),'paranoid':![],'indexes':[{'name':_0x1f51('0xa'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x63df=['exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes'];(function(_0x35b1eb,_0x215907){var _0x4a93b3=function(_0x3e8420){while(--_0x3e8420){_0x35b1eb['push'](_0x35b1eb['shift']());}};_0x4a93b3(++_0x215907);}(_0x63df,0x1e1));var _0xf63d=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x63df[_0x5f3f88];return _0xd08119;};'use strict';var _=require(_0xf63d('0x0'));var util=require('util');var logger=require(_0xf63d('0x1'))(_0xf63d('0x2'));var moment=require('moment');var BPromise=require(_0xf63d('0x3'));var rp=require(_0xf63d('0x4'));var fs=require('fs');var path=require(_0xf63d('0x5'));var rimraf=require(_0xf63d('0x6'));var config=require(_0xf63d('0x7'));var attributes=require(_0xf63d('0x8'));module[_0xf63d('0x9')]=function(_0x16200d,_0x16fd9e){return _0x16200d[_0xf63d('0xa')](_0xf63d('0xb'),attributes,{'tableName':_0xf63d('0xc'),'paranoid':![],'indexes':[{'name':_0xf63d('0xd'),'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 0e6d518..fd37446 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 _0x6de7=['debug','SalesforceField,\x20%s,\x20%s,\x20%s','error','message','SalesforceField,\x20%s,\x20%s','result','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0x6de7,0x118));var _0x76de=function(_0x4cd9c6,_0x766862){_0x4cd9c6=_0x4cd9c6-0x0;var _0x53a566=_0x6de7[_0x4cd9c6];return _0x53a566;};'use strict';var _=require('lodash');var util=require(_0x76de('0x0'));var moment=require(_0x76de('0x1'));var BPromise=require('bluebird');var rs=require(_0x76de('0x2'));var fs=require('fs');var Redis=require(_0x76de('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x76de('0x4'));var logger=require(_0x76de('0x5'))(_0x76de('0x6'));var config=require(_0x76de('0x7'));var jayson=require(_0x76de('0x8'));var client=jayson['client'][_0x76de('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ca89a,_0xdb1bba,_0x34b7ff){return new BPromise(function(_0x3b0037,_0x540a78){return client[_0x76de('0xa')](_0x3ca89a,_0x34b7ff)[_0x76de('0xb')](function(_0x44ee85){logger[_0x76de('0xc')]('SalesforceField,\x20%s,\x20%s',_0xdb1bba,_0x76de('0xd'));logger[_0x76de('0xe')](_0x76de('0xf'),_0xdb1bba,'request\x20sent',JSON['stringify'](_0x44ee85));if(_0x44ee85[_0x76de('0x10')]){if(_0x44ee85['error']['code']===0x1f4){logger['error']('SalesforceField,\x20%s,\x20%s',_0xdb1bba,_0x44ee85[_0x76de('0x10')][_0x76de('0x11')]);return _0x540a78(_0x44ee85['error'][_0x76de('0x11')]);}logger[_0x76de('0x10')](_0x76de('0x12'),_0xdb1bba,_0x44ee85[_0x76de('0x10')][_0x76de('0x11')]);return _0x3b0037(_0x44ee85[_0x76de('0x10')]['message']);}else{logger[_0x76de('0xc')](_0x76de('0x12'),_0xdb1bba,_0x76de('0xd'));_0x3b0037(_0x44ee85[_0x76de('0x13')][_0x76de('0x11')]);}})[_0x76de('0x14')](function(_0x6fb9a8){logger[_0x76de('0x10')](_0x76de('0x12'),_0xdb1bba,_0x6fb9a8);_0x540a78(_0x6fb9a8);});});} \ No newline at end of file +var _0x3140=['info','SalesforceField,\x20%s,\x20%s','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','request','then'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3140,0x6f));var _0x0314=function(_0x33e4a7,_0x2e80a2){_0x33e4a7=_0x33e4a7-0x0;var _0x598620=_0x3140[_0x33e4a7];return _0x598620;};'use strict';var _=require(_0x0314('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0314('0x1'));var rs=require(_0x0314('0x2'));var fs=require('fs');var Redis=require(_0x0314('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0314('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0314('0x5'));var client=jayson[_0x0314('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d194c,_0x32eb2a,_0x32d5c3){return new BPromise(function(_0x54489e,_0x1538ec){return client[_0x0314('0x7')](_0x1d194c,_0x32d5c3)[_0x0314('0x8')](function(_0xd2f779){logger[_0x0314('0x9')](_0x0314('0xa'),_0x32eb2a,'request\x20sent');logger[_0x0314('0xb')](_0x0314('0xc'),_0x32eb2a,_0x0314('0xd'),JSON[_0x0314('0xe')](_0xd2f779));if(_0xd2f779['error']){if(_0xd2f779['error'][_0x0314('0xf')]===0x1f4){logger[_0x0314('0x10')](_0x0314('0xa'),_0x32eb2a,_0xd2f779[_0x0314('0x10')][_0x0314('0x11')]);return _0x1538ec(_0xd2f779[_0x0314('0x10')][_0x0314('0x11')]);}logger[_0x0314('0x10')]('SalesforceField,\x20%s,\x20%s',_0x32eb2a,_0xd2f779['error'][_0x0314('0x11')]);return _0x54489e(_0xd2f779[_0x0314('0x10')][_0x0314('0x11')]);}else{logger[_0x0314('0x9')]('SalesforceField,\x20%s,\x20%s',_0x32eb2a,_0x0314('0xd'));_0x54489e(_0xd2f779[_0x0314('0x12')][_0x0314('0x11')]);}})[_0x0314('0x13')](function(_0x1b3779){logger['error'](_0x0314('0xa'),_0x32eb2a,_0x1b3779);_0x1538ec(_0x1b3779);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 59d1d76..77e2b8d 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 _0xc17f=['../../config/environment','./intServicenowAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','create','post','addConfiguration','put','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x16dd6f,_0x584991){var _0x1cb81c=function(_0x2d7c3e){while(--_0x2d7c3e){_0x16dd6f['push'](_0x16dd6f['shift']());}};_0x1cb81c(++_0x584991);}(_0xc17f,0xb8));var _0xfc17=function(_0x17a057,_0x51ef19){_0x17a057=_0x17a057-0x0;var _0x5b34d2=_0xc17f[_0x17a057];return _0x5b34d2;};'use strict';var multer=require(_0xfc17('0x0'));var util=require(_0xfc17('0x1'));var path=require(_0xfc17('0x2'));var timeout=require(_0xfc17('0x3'));var express=require(_0xfc17('0x4'));var router=express[_0xfc17('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xfc17('0x6'));var interaction=require(_0xfc17('0x7'));var config=require(_0xfc17('0x8'));var controller=require(_0xfc17('0x9'));router['get']('/',auth[_0xfc17('0xa')](),controller[_0xfc17('0xb')]);router[_0xfc17('0xc')](_0xfc17('0xd'),auth[_0xfc17('0xa')](),controller[_0xfc17('0xe')]);router[_0xfc17('0xc')](_0xfc17('0xf'),auth['isAuthenticated'](),controller[_0xfc17('0x10')]);router[_0xfc17('0xc')](_0xfc17('0x11'),auth[_0xfc17('0xa')](),controller['getFields']);router['post']('/',auth[_0xfc17('0xa')](),controller[_0xfc17('0x12')]);router[_0xfc17('0x13')](_0xfc17('0xf'),auth[_0xfc17('0xa')](),controller[_0xfc17('0x14')]);router[_0xfc17('0x15')](_0xfc17('0xd'),auth[_0xfc17('0xa')](),controller[_0xfc17('0x16')]);router['delete'](_0xfc17('0xd'),auth[_0xfc17('0xa')](),controller[_0xfc17('0x17')]);module['exports']=router; \ No newline at end of file +var _0x5145=['./intServicenowAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','/:id','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x588141,_0x116b5d){var _0x3dd7ab=function(_0x52878b){while(--_0x52878b){_0x588141['push'](_0x588141['shift']());}};_0x3dd7ab(++_0x116b5d);}(_0x5145,0x1bf));var _0x5514=function(_0x1d562b,_0x125e5a){_0x1d562b=_0x1d562b-0x0;var _0x53a5bb=_0x5145[_0x1d562b];return _0x53a5bb;};'use strict';var multer=require(_0x5514('0x0'));var util=require(_0x5514('0x1'));var path=require(_0x5514('0x2'));var timeout=require(_0x5514('0x3'));var express=require(_0x5514('0x4'));var router=express[_0x5514('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5514('0x6'));var interaction=require(_0x5514('0x7'));var config=require(_0x5514('0x8'));var controller=require(_0x5514('0x9'));router[_0x5514('0xa')]('/',auth[_0x5514('0xb')](),controller[_0x5514('0xc')]);router['get']('/:id',auth[_0x5514('0xb')](),controller[_0x5514('0xd')]);router[_0x5514('0xa')](_0x5514('0xe'),auth[_0x5514('0xb')](),controller[_0x5514('0xf')]);router[_0x5514('0xa')](_0x5514('0x10'),auth['isAuthenticated'](),controller[_0x5514('0x11')]);router[_0x5514('0x12')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x5514('0xe'),auth['isAuthenticated'](),controller[_0x5514('0x13')]);router[_0x5514('0x14')]('/:id',auth[_0x5514('0xb')](),controller[_0x5514('0x15')]);router['delete'](_0x5514('0x16'),auth['isAuthenticated'](),controller[_0x5514('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index dec9006..120bf8b 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 _0x931a=['STRING','remoteUri','sequelize','exports'];(function(_0xeec739,_0x10a2e0){var _0x272e0a=function(_0x2faba1){while(--_0x2faba1){_0xeec739['push'](_0xeec739['shift']());}};_0x272e0a(++_0x10a2e0);}(_0x931a,0x1e2));var _0xa931=function(_0x200490,_0x38bbf3){_0x200490=_0x200490-0x0;var _0x40aa6d=_0x931a[_0x200490];return _0x40aa6d;};'use strict';var Sequelize=require(_0xa931('0x0'));module[_0xa931('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa931('0x2')]},'username':{'type':Sequelize[_0xa931('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xa931('0x2')]},'email':{'type':Sequelize[_0xa931('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xa931('0x3')},'serverUrl':{'type':Sequelize[_0xa931('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xe8fb=['sequelize','exports','STRING','remoteUri'];(function(_0x59ab20,_0xbc8e3e){var _0x110a1b=function(_0x281e15){while(--_0x281e15){_0x59ab20['push'](_0x59ab20['shift']());}};_0x110a1b(++_0xbc8e3e);}(_0xe8fb,0x16c));var _0xbe8f=function(_0x5524b3,_0x4251d9){_0x5524b3=_0x5524b3-0x0;var _0x1d417c=_0xe8fb[_0x5524b3];return _0x1d417c;};'use strict';var Sequelize=require(_0xbe8f('0x0'));module[_0xbe8f('0x1')]={'name':{'type':Sequelize[_0xbe8f('0x2')]},'description':{'type':Sequelize[_0xbe8f('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize[_0xbe8f('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xbe8f('0x2')],'unique':_0xbe8f('0x3')},'serverUrl':{'type':Sequelize[_0xbe8f('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index e790ea7..9c10e84 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 _0x308b=['log','incident\x20table\x20objects','assign','remove','includes','internalType','label','push','all','TCL:\x20_object','forEach','concat','ServiceNow\x20error:\x20','statusCode','test','boolean','true','False','false','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','sendStatus','error','stack','name','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','find','create','body','catch','getConfigurations','findOne','ServicenowConfiguration','addConfiguration','Subjects','getSubjects','channel','getDescriptions','ServicenowField','Descriptions','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent','watch_list','upon_reject','sys_updated_on','child_incidents','hold_reason','approval_history','number','sys_updated_by','opened_by','user_input','sys_created_on','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','opened_at','business_duration','group_list','work_end','reopened_time','approval_set','correlation_display','assignment_group','additional_assignee_list','description','calendar_duration','sys_class_name','closed_by','follow_up','parent_incident','contact_type','problem_id','company','reassignment_count','activity_due','assigned_to','sla_due','approval','due_date','sys_mod_count','correlation_id','location','username','password','email','remoteUri','serverUrl','lastIndexOf','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','result'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x308b,0xc7));var _0xb308=function(_0x2ab5c1,_0x2f9731){_0x2ab5c1=_0x2ab5c1-0x0;var _0x139c84=_0x308b[_0x2ab5c1];return _0x139c84;};'use strict';var emlformat=require(_0xb308('0x0'));var rimraf=require(_0xb308('0x1'));var zipdir=require(_0xb308('0x2'));var jsonpatch=require(_0xb308('0x3'));var rp=require(_0xb308('0x4'));var moment=require(_0xb308('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb308('0x6'));var util=require('util');var path=require('path');var sox=require(_0xb308('0x7'));var csv=require(_0xb308('0x8'));var ejs=require(_0xb308('0x9'));var fs=require('fs');var fs_extra=require(_0xb308('0xa'));var _=require(_0xb308('0xb'));var squel=require(_0xb308('0xc'));var crypto=require(_0xb308('0xd'));var jsforce=require(_0xb308('0xe'));var deskjs=require(_0xb308('0xf'));var toCsv=require(_0xb308('0x8'));var querystring=require(_0xb308('0x10'));var Papa=require('papaparse');var Redis=require(_0xb308('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb308('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb308('0x13'))(_0xb308('0x14'));var utils=require(_0xb308('0x15'));var config=require(_0xb308('0x16'));var licenseUtil=require(_0xb308('0x17'));var db=require(_0xb308('0x18'))['db'];var integrations=require(_0xb308('0x19'));function respondWithStatusCode(_0x16d5fb,_0x3cc1db){_0x3cc1db=_0x3cc1db||0xcc;return function(_0x58ad2c){if(_0x58ad2c){return _0x16d5fb['sendStatus'](_0x3cc1db);}return _0x16d5fb[_0xb308('0x1a')](_0x3cc1db)[_0xb308('0x1b')]();};}function respondWithResult(_0x71db36,_0x34b0f0){_0x34b0f0=_0x34b0f0||0xc8;return function(_0x79d97f){if(_0x79d97f){return _0x71db36[_0xb308('0x1a')](_0x34b0f0)[_0xb308('0x1c')](_0x79d97f);}};}function respondWithFilteredResult(_0x15df42,_0x460dd9){return function(_0x454055){if(_0x454055){var _0x309da1=typeof _0x460dd9[_0xb308('0x1d')]===_0xb308('0x1e')&&typeof _0x460dd9[_0xb308('0x1f')]===_0xb308('0x1e');var _0x24c27f=_0x454055['count'];var _0x1501e8=_0x309da1?0x0:_0x460dd9[_0xb308('0x1d')];var _0x2deea1=_0x309da1?_0x454055[_0xb308('0x20')]:_0x460dd9['offset']+_0x460dd9[_0xb308('0x1f')];var _0x570f4d;if(_0x2deea1>=_0x24c27f){_0x2deea1=_0x24c27f;_0x570f4d=0xc8;}else{_0x570f4d=0xce;}_0x15df42[_0xb308('0x1a')](_0x570f4d);return _0x15df42[_0xb308('0x21')](_0xb308('0x22'),_0x1501e8+'-'+_0x2deea1+'/'+_0x24c27f)[_0xb308('0x1c')](_0x454055);}return null;};}function patchUpdates(_0x40b80c){return function(_0x76a218){try{jsonpatch[_0xb308('0x23')](_0x76a218,_0x40b80c,!![]);}catch(_0x2d9f75){return BPromise[_0xb308('0x24')](_0x2d9f75);}return _0x76a218[_0xb308('0x25')]();};}function saveUpdates(_0x55dc39,_0x20a8d5){return function(_0x580265){if(_0x580265){return _0x580265['update'](_0x55dc39)['then'](function(_0x1511c1){return _0x1511c1;});}return null;};}function removeEntity(_0x1417b6,_0x53b7aa){return function(_0x3eeb7f){if(_0x3eeb7f){return _0x3eeb7f[_0xb308('0x26')]()[_0xb308('0x27')](function(){_0x1417b6[_0xb308('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2735d9,_0x569216){return function(_0x3475e7){if(!_0x3475e7){_0x2735d9[_0xb308('0x28')](0x194);}return _0x3475e7;};}function handleError(_0x644aaa,_0x255721){_0x255721=_0x255721||0x1f4;return function(_0x17b8d4){logger[_0xb308('0x29')](_0x17b8d4[_0xb308('0x2a')]);if(_0x17b8d4[_0xb308('0x2b')]){delete _0x17b8d4[_0xb308('0x2b')];}_0x644aaa[_0xb308('0x1a')](_0x255721)['send'](_0x17b8d4);};}exports[_0xb308('0x2c')]=function(_0x561fcf,_0x7b58d8){var _0x541217={},_0x2fd637={},_0x4c802d={'count':0x0,'rows':[]};var _0x4d3599=_[_0xb308('0x2d')](db[_0xb308('0x2e')][_0xb308('0x2f')],function(_0x15341c){return{'name':_0x15341c[_0xb308('0x30')],'type':_0x15341c[_0xb308('0x31')][_0xb308('0x32')]};});_0x2fd637[_0xb308('0x33')]=_[_0xb308('0x2d')](_0x4d3599,_0xb308('0x2b'));_0x2fd637[_0xb308('0x34')]=_[_0xb308('0x35')](_0x561fcf[_0xb308('0x34')]);_0x2fd637[_0xb308('0x36')]=_[_0xb308('0x37')](_0x2fd637['model'],_0x2fd637['query']);_0x541217[_0xb308('0x38')]=_['intersection'](_0x2fd637['model'],qs[_0xb308('0x39')](_0x561fcf[_0xb308('0x34')][_0xb308('0x39')]));_0x541217[_0xb308('0x38')]=_0x541217[_0xb308('0x38')][_0xb308('0x3a')]?_0x541217[_0xb308('0x38')]:_0x2fd637[_0xb308('0x33')];if(!_0x561fcf['query'][_0xb308('0x3b')](_0xb308('0x3c'))){_0x541217['limit']=qs['limit'](_0x561fcf['query'][_0xb308('0x1f')]);_0x541217[_0xb308('0x1d')]=qs[_0xb308('0x1d')](_0x561fcf[_0xb308('0x34')]['offset']);}_0x541217[_0xb308('0x3d')]=qs['sort'](_0x561fcf['query'][_0xb308('0x3e')]);_0x541217['where']=qs[_0xb308('0x36')](_[_0xb308('0x3f')](_0x561fcf['query'],_0x2fd637[_0xb308('0x36')]),_0x4d3599);if(_0x561fcf[_0xb308('0x34')]['filter']){_0x541217[_0xb308('0x40')]=_[_0xb308('0x41')](_0x541217[_0xb308('0x40')],{'$or':_['map'](_0x4d3599,function(_0x377af9){if(_0x377af9[_0xb308('0x31')]!==_0xb308('0x42')){var _0x55462e={};_0x55462e[_0x377af9[_0xb308('0x2b')]]={'$like':'%'+_0x561fcf[_0xb308('0x34')][_0xb308('0x43')]+'%'};return _0x55462e;}})});}_0x541217=_[_0xb308('0x41')]({},_0x541217,_0x561fcf[_0xb308('0x44')]);var _0x1b50bf={'where':_0x541217[_0xb308('0x40')]};return db[_0xb308('0x2e')][_0xb308('0x20')](_0x1b50bf)[_0xb308('0x27')](function(_0x4eba0f){_0x4c802d[_0xb308('0x20')]=_0x4eba0f;if(_0x561fcf[_0xb308('0x34')][_0xb308('0x45')]){_0x541217[_0xb308('0x46')]=[{'all':!![]}];}return db['ServicenowAccount'][_0xb308('0x47')](_0x541217);})['then'](function(_0x1ebbe3){_0x4c802d[_0xb308('0x48')]=_0x1ebbe3;return _0x4c802d;})['then'](respondWithFilteredResult(_0x7b58d8,_0x541217))['catch'](handleError(_0x7b58d8,null));};exports['show']=function(_0x227a6e,_0x113682){var _0x3b87b4={'raw':![],'where':{'id':_0x227a6e[_0xb308('0x49')]['id']}},_0x5ebcbe={};_0x5ebcbe[_0xb308('0x33')]=_['keys'](db[_0xb308('0x2e')]['rawAttributes']);_0x5ebcbe[_0xb308('0x34')]=_['keys'](_0x227a6e[_0xb308('0x34')]);_0x5ebcbe[_0xb308('0x36')]=_[_0xb308('0x37')](_0x5ebcbe[_0xb308('0x33')],_0x5ebcbe[_0xb308('0x34')]);_0x3b87b4[_0xb308('0x38')]=_['intersection'](_0x5ebcbe[_0xb308('0x33')],qs[_0xb308('0x39')](_0x227a6e['query'][_0xb308('0x39')]));_0x3b87b4[_0xb308('0x38')]=_0x3b87b4['attributes']['length']?_0x3b87b4[_0xb308('0x38')]:_0x5ebcbe[_0xb308('0x33')];if(_0x227a6e[_0xb308('0x34')][_0xb308('0x45')]){_0x3b87b4['include']=[{'all':!![]}];}_0x3b87b4=_[_0xb308('0x41')]({},_0x3b87b4,_0x227a6e[_0xb308('0x44')]);return db[_0xb308('0x2e')][_0xb308('0x4a')](_0x3b87b4)[_0xb308('0x27')](handleEntityNotFound(_0x113682,null))['then'](respondWithResult(_0x113682,null))['catch'](handleError(_0x113682,null));};exports['create']=function(_0x9acd60,_0x48aa88){return db[_0xb308('0x2e')][_0xb308('0x4b')](_0x9acd60[_0xb308('0x4c')],{})['then'](respondWithResult(_0x48aa88,0xc9))['catch'](handleError(_0x48aa88,null));};exports['update']=function(_0x155b28,_0x58d128){if(_0x155b28[_0xb308('0x4c')]['id']){delete _0x155b28[_0xb308('0x4c')]['id'];}return db[_0xb308('0x2e')][_0xb308('0x4a')]({'where':{'id':_0x155b28['params']['id']}})[_0xb308('0x27')](handleEntityNotFound(_0x58d128,null))[_0xb308('0x27')](saveUpdates(_0x155b28['body'],null))[_0xb308('0x27')](respondWithResult(_0x58d128,null))[_0xb308('0x4d')](handleError(_0x58d128,null));};exports['destroy']=function(_0x27d087,_0xfc0ec5){return db[_0xb308('0x2e')][_0xb308('0x4a')]({'where':{'id':_0x27d087[_0xb308('0x49')]['id']}})[_0xb308('0x27')](handleEntityNotFound(_0xfc0ec5,null))[_0xb308('0x27')](removeEntity(_0xfc0ec5,null))[_0xb308('0x4d')](handleError(_0xfc0ec5,null));};exports[_0xb308('0x4e')]=function(_0x611613,_0x7c27ac,_0x44c9ee){var _0x360ebe={};var _0x41822c={};var _0x5e3f80;var _0x3cdb54;return db[_0xb308('0x2e')][_0xb308('0x4f')]({'where':{'id':_0x611613[_0xb308('0x49')]['id']}})[_0xb308('0x27')](handleEntityNotFound(_0x7c27ac,null))[_0xb308('0x27')](function(_0x2815b7){if(_0x2815b7){_0x5e3f80=_0x2815b7;_0x41822c[_0xb308('0x33')]=_[_0xb308('0x35')](db[_0xb308('0x50')][_0xb308('0x2f')]);_0x41822c[_0xb308('0x34')]=_[_0xb308('0x35')](_0x611613['query']);_0x41822c['filters']=_[_0xb308('0x37')](_0x41822c[_0xb308('0x33')],_0x41822c[_0xb308('0x34')]);_0x360ebe[_0xb308('0x38')]=_[_0xb308('0x37')](_0x41822c[_0xb308('0x33')],qs[_0xb308('0x39')](_0x611613[_0xb308('0x34')]['fields']));_0x360ebe[_0xb308('0x38')]=_0x360ebe[_0xb308('0x38')]['length']?_0x360ebe[_0xb308('0x38')]:_0x41822c[_0xb308('0x33')];_0x360ebe[_0xb308('0x3d')]=qs[_0xb308('0x3e')](_0x611613[_0xb308('0x34')][_0xb308('0x3e')]);_0x360ebe[_0xb308('0x40')]=qs[_0xb308('0x36')](_[_0xb308('0x3f')](_0x611613[_0xb308('0x34')],_0x41822c[_0xb308('0x36')]));if(_0x611613[_0xb308('0x34')][_0xb308('0x43')]){_0x360ebe[_0xb308('0x40')]=_[_0xb308('0x41')](_0x360ebe[_0xb308('0x40')],{'$or':_['map'](_0x360ebe[_0xb308('0x38')],function(_0x40c3ec){var _0x394890={};_0x394890[_0x40c3ec]={'$like':'%'+_0x611613[_0xb308('0x34')]['filter']+'%'};return _0x394890;})});}_0x360ebe=_[_0xb308('0x41')]({},_0x360ebe,_0x611613[_0xb308('0x44')]);return _0x5e3f80[_0xb308('0x4e')](_0x360ebe);}})[_0xb308('0x27')](function(_0x458de9){if(_0x458de9){_0x3cdb54=_0x458de9[_0xb308('0x3a')];if(!_0x611613[_0xb308('0x34')][_0xb308('0x3b')](_0xb308('0x3c'))){_0x360ebe['limit']=qs[_0xb308('0x1f')](_0x611613[_0xb308('0x34')][_0xb308('0x1f')]);_0x360ebe[_0xb308('0x1d')]=qs['offset'](_0x611613['query'][_0xb308('0x1d')]);}return _0x5e3f80[_0xb308('0x4e')](_0x360ebe);}})[_0xb308('0x27')](function(_0x53e101){if(_0x53e101){return _0x53e101?{'count':_0x3cdb54,'rows':_0x53e101}:null;}})[_0xb308('0x27')](respondWithResult(_0x7c27ac,null))[_0xb308('0x4d')](handleError(_0x7c27ac,null));};exports[_0xb308('0x51')]=function(_0x333dea,_0x77566f,_0x52c5a0){if(_0x333dea['body']['id']){delete _0x333dea[_0xb308('0x4c')]['id'];}return db['ServicenowAccount'][_0xb308('0x4f')]({'where':{'id':_0x333dea[_0xb308('0x49')]['id']}})[_0xb308('0x27')](handleEntityNotFound(_0x77566f,null))[_0xb308('0x27')](function(_0x270bc1){if(_0x270bc1){_0x333dea[_0xb308('0x4c')]['AccountId']=_0x270bc1['id'];_0x333dea['body'][_0xb308('0x52')]=integrations[_0xb308('0x53')](_0x333dea[_0xb308('0x4c')][_0xb308('0x54')],_0x333dea[_0xb308('0x4c')]['type']);_0x333dea[_0xb308('0x4c')]['Descriptions']=integrations[_0xb308('0x55')](_0x333dea[_0xb308('0x4c')][_0xb308('0x54')],_0x333dea[_0xb308('0x4c')][_0xb308('0x31')]);return db['ServicenowConfiguration'][_0xb308('0x4b')](_0x333dea[_0xb308('0x4c')],{'include':[{'model':db[_0xb308('0x56')],'as':_0xb308('0x52')},{'model':db[_0xb308('0x56')],'as':_0xb308('0x57')}]});}return null;})[_0xb308('0x27')](respondWithResult(_0x77566f,null))[_0xb308('0x4d')](handleError(_0x77566f,null));};exports['getFields']=function(_0x4b5d23,_0x3d7ded,_0x29f133){var _0x1b5e6d=['made_sla','hold_reason',_0xb308('0x58'),_0xb308('0x59'),_0xb308('0x5a'),_0xb308('0x5b'),_0xb308('0x5c'),_0xb308('0x5d'),_0xb308('0x5e')];var _0x11d418=[_0xb308('0x5f'),'made_sla','caused_by',_0xb308('0x60'),_0xb308('0x61'),_0xb308('0x62'),_0xb308('0x63'),_0xb308('0x64'),_0xb308('0x65'),_0xb308('0x66'),'resolved_by',_0xb308('0x67'),_0xb308('0x68'),_0xb308('0x69'),_0xb308('0x6a'),'sys_domain','state',_0xb308('0x6b'),_0xb308('0x58'),_0xb308('0x3d'),_0xb308('0x6c'),_0xb308('0x6d'),_0xb308('0x6e'),_0xb308('0x6f'),_0xb308('0x70'),'active',_0xb308('0x71'),_0xb308('0x72'),_0xb308('0x73'),_0xb308('0x74'),_0xb308('0x75'),_0xb308('0x76'),'expected_start',_0xb308('0x77'),_0xb308('0x78'),_0xb308('0x79'),_0xb308('0x7a'),_0xb308('0x7b'),'resolved_at','caller_id',_0xb308('0x7c'),_0xb308('0x59'),'work_notes','short_description',_0xb308('0x5a'),_0xb308('0x7d'),'delivery_task','work_start',_0xb308('0x7e'),'business_stc',_0xb308('0x7f'),_0xb308('0x80'),_0xb308('0x81'),_0xb308('0x5b'),_0xb308('0x82'),'close_notes',_0xb308('0x83'),_0xb308('0x84'),_0xb308('0x85'),'sys_id',_0xb308('0x86'),'reopened_by',_0xb308('0x5c'),'urgency',_0xb308('0x87'),_0xb308('0x88'),_0xb308('0x89'),_0xb308('0x8a'),_0xb308('0x8b'),'severity','comments',_0xb308('0x8c'),_0xb308('0x8d'),'comments_and_work_notes',_0xb308('0x8e'),_0xb308('0x8f'),'reopen_count','sys_tags','escalation','upon_approval',_0xb308('0x90'),_0xb308('0x91'),_0xb308('0x5e')];var _0x18dbdf='';var _0x5b3cb9='';var _0x1be8f0=[];var _0x2f80c3='';var _0x150fbb='';var _0x81ef05=[];var _0x26f36a='';var _0x37d029='';var _0x5534bf={};var _0x144ce0='';return db[_0xb308('0x2e')]['findOne']({'where':{'id':_0x4b5d23[_0xb308('0x49')]['id']},'attributes':['id',_0xb308('0x92'),_0xb308('0x93'),_0xb308('0x94'),_0xb308('0x95'),_0xb308('0x96')]})[_0xb308('0x27')](handleEntityNotFound(_0x3d7ded,null))[_0xb308('0x27')](function(_0x2cb344){if(_0x2cb344){_0x144ce0=_0x2cb344[_0xb308('0x95')];var _0x5b874e=_0x144ce0['slice'](-0x1);if(_0x5b874e==='/'){_0x144ce0=_0x144ce0['substring'](0x0,_0x144ce0[_0xb308('0x97')](_0x5b874e));}_0x37d029=util[_0xb308('0x98')]('%s/api/now/doc/table/schema/',_0x144ce0);_0x26f36a=util[_0xb308('0x98')](_0xb308('0x99'),_0x144ce0);_0x5534bf={'user':_0x2cb344[_0xb308('0x92')],'pass':_0x2cb344[_0xb308('0x93')]};var _0xe03696={'method':_0xb308('0x9a'),'uri':_0x37d029+_0xb308('0x9b'),'auth':_0x5534bf,'json':!![]};return rp(_0xe03696);}})[_0xb308('0x27')](function(_0x1f9501){if(_0x1f9501[_0xb308('0x9c')][_0xb308('0x3a')]>0x0){_0x18dbdf=_0x1f9501['result'];}console[_0xb308('0x9d')](_0xb308('0x9e'),_0x18dbdf);_0x81ef05=[];_0x5b3cb9=Object[_0xb308('0x9f')]([],_0x18dbdf);_[_0xb308('0xa0')](_0x5b3cb9,function(_0x3bb026){return!_0x1b5e6d[_0xb308('0xa1')](_0x3bb026[_0xb308('0x2b')]);});_0x5b3cb9['forEach'](function(_0x58163a){var _0x1b5b92=createFieldObject(_0x26f36a,_0x5534bf,_0x58163a[_0xb308('0xa2')],_0x58163a['name'],_0x58163a[_0xb308('0xa3')],![]);_0x81ef05[_0xb308('0xa4')](_0x1b5b92);});return Promise[_0xb308('0xa5')](_0x81ef05);})[_0xb308('0x27')](function(_0x19432d){_0x1be8f0=_0x19432d;_0x2f80c3=Object[_0xb308('0x9f')]([],_0x18dbdf);console[_0xb308('0x9d')](_0xb308('0xa6'),_0x18dbdf);_['remove'](_0x2f80c3,function(_0xeb0c43){return _0x11d418[_0xb308('0xa1')](_0xeb0c43['name']);});console[_0xb308('0x9d')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x2f80c3);_0x81ef05=[];_0x2f80c3[_0xb308('0xa7')](function(_0x39ade0){var _0x33bb6e=createFieldObject(_0x26f36a,_0x5534bf,_0x39ade0['internalType'],_0x39ade0[_0xb308('0x2b')],_0x39ade0[_0xb308('0xa3')],!![]);_0x81ef05[_0xb308('0xa4')](_0x33bb6e);});return Promise[_0xb308('0xa5')](_0x81ef05);})[_0xb308('0x27')](function(_0x49a8a1){_0x150fbb=_0x49a8a1;var _0x12f4f2=_0x1be8f0[_0xb308('0xa8')](_0x150fbb);return{'count':_0x12f4f2['length'],'rows':_0x12f4f2};})[_0xb308('0x27')](respondWithResult(_0x3d7ded,null))[_0xb308('0x4d')](function(_0x1e94cb){console[_0xb308('0x9d')](_0xb308('0xa9')+_0x1e94cb);var _0x537beb=_0x4b5d23[_0xb308('0x34')]['test']?0x1f4:_0x1e94cb[_0xb308('0xaa')]||0x1f4;logger[_0xb308('0x29')](_0x1e94cb[_0xb308('0x2a')]);delete _0x1e94cb['name'];if(_0x537beb===0x191){_0x537beb=0x190;}_0x3d7ded[_0xb308('0x1a')](_0x537beb)['send'](_0x4b5d23[_0xb308('0x34')][_0xb308('0xab')]?{'message':'Wrong\x20credentials','statusCode':_0x1e94cb[_0xb308('0xaa')]}:_0x1e94cb);});};function createFieldObject(_0x5f395d,_0x5dddf5,_0x4cd78f,_0x312afd,_0x4619c4,_0x5573b3){return new Promise(function(_0x423188,_0x2421cd){var _0x3eba13={'id':_0x312afd,'name':_0x4619c4,'custom':_0x5573b3};if(_0x4cd78f===_0xb308('0xac')){_0x3eba13[_0xb308('0x44')]=[{'name':'True','value':_0xb308('0xad')},{'name':_0xb308('0xae'),'value':_0xb308('0xaf')}];_0x423188(_0x3eba13);}else{var _0x3decee={'method':_0xb308('0x9a'),'uri':_0x5f395d+'sys_choice?sysparm_query=name=incident^element='+_0x312afd,'auth':_0x5dddf5,'json':!![]};return rp(_0x3decee)['then'](function(_0x1d282b){var _0x4b6c04=[];if(_0x1d282b['result'][_0xb308('0x3a')]>0x0){_0x1d282b[_0xb308('0x9c')][_0xb308('0xa7')](function(_0x4412e5){if(_0x4412e5[_0xb308('0xb0')]===_0xb308('0xaf')){var _0x581aba={'name':_0x4412e5[_0xb308('0xa3')],'value':_0x4412e5[_0xb308('0xb1')]};_0x4b6c04[_0xb308('0xa4')](_0x581aba);}});}_0x3eba13[_0xb308('0x44')]=_0x4b6c04;if(_0x3eba13[_0xb308('0x44')][_0xb308('0x3a')]>0x0){_0x423188(_0x3eba13);}else{if(_0x5573b3==![]){_0x423188();}else{_0x423188(_0x3eba13);}}});}});} \ No newline at end of file +var _0xa504=['map','ServicenowAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','fields','options','find','create','body','destroy','getConfigurations','findOne','ServicenowConfiguration','filter','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent','made_sla','caused_by','watch_list','upon_reject','child_incidents','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','state','sys_created_by','cmdb_ci','delivery_plan','impact','active','priority','rfc','time_worked','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','short_description','work_start','assignment_group','additional_assignee_list','description','close_notes','closed_by','follow_up','sys_id','contact_type','urgency','problem_id','activity_due','assigned_to','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','escalation','upon_approval','correlation_id','location','password','email','remoteUri','serverUrl','slice','lastIndexOf','format','%s/api/now/doc/table/schema/','username','incident?sysparm_display_value=all','result','log','assign','remove','includes','forEach','internalType','label','push','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','all','concat','ServiceNow\x20error:\x20','test','statusCode','stack','Wrong\x20credentials','boolean','True','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','apply','reject','save','update','then','error','name','send','index'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0xa504,0x148));var _0x4a50=function(_0x34784c,_0x50f529){_0x34784c=_0x34784c-0x0;var _0x4a63ba=_0xa504[_0x34784c];return _0x4a63ba;};'use strict';var emlformat=require(_0x4a50('0x0'));var rimraf=require(_0x4a50('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4a50('0x2'));var rp=require(_0x4a50('0x3'));var moment=require('moment');var BPromise=require(_0x4a50('0x4'));var Mustache=require(_0x4a50('0x5'));var util=require(_0x4a50('0x6'));var path=require(_0x4a50('0x7'));var sox=require('sox');var csv=require(_0x4a50('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4a50('0x9'));var _=require('lodash');var squel=require(_0x4a50('0xa'));var crypto=require(_0x4a50('0xb'));var jsforce=require(_0x4a50('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4a50('0x8'));var querystring=require('querystring');var Papa=require(_0x4a50('0xd'));var Redis=require(_0x4a50('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x4a50('0xf'));var as=require(_0x4a50('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x4a50('0x11'));var config=require(_0x4a50('0x12'));var licenseUtil=require(_0x4a50('0x13'));var db=require(_0x4a50('0x14'))['db'];var integrations=require(_0x4a50('0x15'));function respondWithStatusCode(_0x34f5b9,_0x57eb88){_0x57eb88=_0x57eb88||0xcc;return function(_0xc54b2){if(_0xc54b2){return _0x34f5b9[_0x4a50('0x16')](_0x57eb88);}return _0x34f5b9[_0x4a50('0x17')](_0x57eb88)[_0x4a50('0x18')]();};}function respondWithResult(_0x23a141,_0x58df8f){_0x58df8f=_0x58df8f||0xc8;return function(_0xae1d66){if(_0xae1d66){return _0x23a141['status'](_0x58df8f)[_0x4a50('0x19')](_0xae1d66);}};}function respondWithFilteredResult(_0x5f151f,_0x5f2229){return function(_0x1a8b38){if(_0x1a8b38){var _0x58b10d=typeof _0x5f2229['offset']===_0x4a50('0x1a')&&typeof _0x5f2229[_0x4a50('0x1b')]===_0x4a50('0x1a');var _0x5e2af7=_0x1a8b38['count'];var _0x2c055c=_0x58b10d?0x0:_0x5f2229[_0x4a50('0x1c')];var _0x2f1809=_0x58b10d?_0x1a8b38['count']:_0x5f2229[_0x4a50('0x1c')]+_0x5f2229['limit'];var _0x1412ce;if(_0x2f1809>=_0x5e2af7){_0x2f1809=_0x5e2af7;_0x1412ce=0xc8;}else{_0x1412ce=0xce;}_0x5f151f[_0x4a50('0x17')](_0x1412ce);return _0x5f151f[_0x4a50('0x1d')](_0x4a50('0x1e'),_0x2c055c+'-'+_0x2f1809+'/'+_0x5e2af7)[_0x4a50('0x19')](_0x1a8b38);}return null;};}function patchUpdates(_0x53fdb3){return function(_0xa58178){try{jsonpatch[_0x4a50('0x1f')](_0xa58178,_0x53fdb3,!![]);}catch(_0x596627){return BPromise[_0x4a50('0x20')](_0x596627);}return _0xa58178[_0x4a50('0x21')]();};}function saveUpdates(_0x42ff06,_0x3c15b9){return function(_0x1bde67){if(_0x1bde67){return _0x1bde67[_0x4a50('0x22')](_0x42ff06)[_0x4a50('0x23')](function(_0x3942b9){return _0x3942b9;});}return null;};}function removeEntity(_0x423233,_0x2ae9a7){return function(_0x2eee00){if(_0x2eee00){return _0x2eee00['destroy']()[_0x4a50('0x23')](function(){_0x423233[_0x4a50('0x17')](0xcc)[_0x4a50('0x18')]();});}};}function handleEntityNotFound(_0x2cfb7e,_0x20e074){return function(_0x40341c){if(!_0x40341c){_0x2cfb7e['sendStatus'](0x194);}return _0x40341c;};}function handleError(_0x42300f,_0xb5b1d7){_0xb5b1d7=_0xb5b1d7||0x1f4;return function(_0x29811f){logger[_0x4a50('0x24')](_0x29811f['stack']);if(_0x29811f[_0x4a50('0x25')]){delete _0x29811f[_0x4a50('0x25')];}_0x42300f['status'](_0xb5b1d7)[_0x4a50('0x26')](_0x29811f);};}exports[_0x4a50('0x27')]=function(_0x4e7bf0,_0x162f4b){var _0x19ca66={},_0x1f2375={},_0x28ab64={'count':0x0,'rows':[]};var _0x35e791=_[_0x4a50('0x28')](db[_0x4a50('0x29')][_0x4a50('0x2a')],function(_0x268c3e){return{'name':_0x268c3e[_0x4a50('0x2b')],'type':_0x268c3e['type'][_0x4a50('0x2c')]};});_0x1f2375[_0x4a50('0x2d')]=_[_0x4a50('0x28')](_0x35e791,_0x4a50('0x25'));_0x1f2375[_0x4a50('0x2e')]=_[_0x4a50('0x2f')](_0x4e7bf0['query']);_0x1f2375[_0x4a50('0x30')]=_[_0x4a50('0x31')](_0x1f2375['model'],_0x1f2375['query']);_0x19ca66[_0x4a50('0x32')]=_['intersection'](_0x1f2375[_0x4a50('0x2d')],qs['fields'](_0x4e7bf0[_0x4a50('0x2e')]['fields']));_0x19ca66[_0x4a50('0x32')]=_0x19ca66[_0x4a50('0x32')][_0x4a50('0x33')]?_0x19ca66[_0x4a50('0x32')]:_0x1f2375[_0x4a50('0x2d')];if(!_0x4e7bf0['query'][_0x4a50('0x34')](_0x4a50('0x35'))){_0x19ca66[_0x4a50('0x1b')]=qs[_0x4a50('0x1b')](_0x4e7bf0[_0x4a50('0x2e')][_0x4a50('0x1b')]);_0x19ca66[_0x4a50('0x1c')]=qs[_0x4a50('0x1c')](_0x4e7bf0['query']['offset']);}_0x19ca66[_0x4a50('0x36')]=qs[_0x4a50('0x37')](_0x4e7bf0[_0x4a50('0x2e')][_0x4a50('0x37')]);_0x19ca66[_0x4a50('0x38')]=qs['filters'](_[_0x4a50('0x39')](_0x4e7bf0[_0x4a50('0x2e')],_0x1f2375[_0x4a50('0x30')]),_0x35e791);if(_0x4e7bf0[_0x4a50('0x2e')]['filter']){_0x19ca66['where']=_[_0x4a50('0x3a')](_0x19ca66[_0x4a50('0x38')],{'$or':_[_0x4a50('0x28')](_0x35e791,function(_0x1a87dd){if(_0x1a87dd[_0x4a50('0x3b')]!==_0x4a50('0x3c')){var _0x33aea5={};_0x33aea5[_0x1a87dd[_0x4a50('0x25')]]={'$like':'%'+_0x4e7bf0[_0x4a50('0x2e')]['filter']+'%'};return _0x33aea5;}})});}_0x19ca66=_[_0x4a50('0x3a')]({},_0x19ca66,_0x4e7bf0['options']);var _0x325751={'where':_0x19ca66[_0x4a50('0x38')]};return db[_0x4a50('0x29')][_0x4a50('0x3d')](_0x325751)[_0x4a50('0x23')](function(_0x348fc2){_0x28ab64[_0x4a50('0x3d')]=_0x348fc2;if(_0x4e7bf0[_0x4a50('0x2e')][_0x4a50('0x3e')]){_0x19ca66[_0x4a50('0x3f')]=[{'all':!![]}];}return db[_0x4a50('0x29')][_0x4a50('0x40')](_0x19ca66);})[_0x4a50('0x23')](function(_0x17eb10){_0x28ab64[_0x4a50('0x41')]=_0x17eb10;return _0x28ab64;})[_0x4a50('0x23')](respondWithFilteredResult(_0x162f4b,_0x19ca66))[_0x4a50('0x42')](handleError(_0x162f4b,null));};exports[_0x4a50('0x43')]=function(_0x19fc30,_0x411e80){var _0x430e96={'raw':![],'where':{'id':_0x19fc30[_0x4a50('0x44')]['id']}},_0x54645c={};_0x54645c[_0x4a50('0x2d')]=_[_0x4a50('0x2f')](db[_0x4a50('0x29')][_0x4a50('0x2a')]);_0x54645c[_0x4a50('0x2e')]=_[_0x4a50('0x2f')](_0x19fc30['query']);_0x54645c['filters']=_['intersection'](_0x54645c[_0x4a50('0x2d')],_0x54645c['query']);_0x430e96[_0x4a50('0x32')]=_[_0x4a50('0x31')](_0x54645c['model'],qs[_0x4a50('0x45')](_0x19fc30[_0x4a50('0x2e')][_0x4a50('0x45')]));_0x430e96[_0x4a50('0x32')]=_0x430e96[_0x4a50('0x32')][_0x4a50('0x33')]?_0x430e96[_0x4a50('0x32')]:_0x54645c[_0x4a50('0x2d')];if(_0x19fc30[_0x4a50('0x2e')][_0x4a50('0x3e')]){_0x430e96[_0x4a50('0x3f')]=[{'all':!![]}];}_0x430e96=_[_0x4a50('0x3a')]({},_0x430e96,_0x19fc30[_0x4a50('0x46')]);return db[_0x4a50('0x29')][_0x4a50('0x47')](_0x430e96)[_0x4a50('0x23')](handleEntityNotFound(_0x411e80,null))['then'](respondWithResult(_0x411e80,null))[_0x4a50('0x42')](handleError(_0x411e80,null));};exports[_0x4a50('0x48')]=function(_0x2b080f,_0x7bc776){return db[_0x4a50('0x29')][_0x4a50('0x48')](_0x2b080f[_0x4a50('0x49')],{})[_0x4a50('0x23')](respondWithResult(_0x7bc776,0xc9))['catch'](handleError(_0x7bc776,null));};exports['update']=function(_0x589861,_0x306ed0){if(_0x589861[_0x4a50('0x49')]['id']){delete _0x589861[_0x4a50('0x49')]['id'];}return db[_0x4a50('0x29')]['find']({'where':{'id':_0x589861[_0x4a50('0x44')]['id']}})[_0x4a50('0x23')](handleEntityNotFound(_0x306ed0,null))[_0x4a50('0x23')](saveUpdates(_0x589861[_0x4a50('0x49')],null))[_0x4a50('0x23')](respondWithResult(_0x306ed0,null))['catch'](handleError(_0x306ed0,null));};exports[_0x4a50('0x4a')]=function(_0x5e1d10,_0x25d0d9){return db['ServicenowAccount'][_0x4a50('0x47')]({'where':{'id':_0x5e1d10['params']['id']}})[_0x4a50('0x23')](handleEntityNotFound(_0x25d0d9,null))['then'](removeEntity(_0x25d0d9,null))[_0x4a50('0x42')](handleError(_0x25d0d9,null));};exports[_0x4a50('0x4b')]=function(_0x2261c1,_0x33dd74,_0xe7d59e){var _0x34e7de={};var _0x43e3ba={};var _0x15790c;var _0x11de50;return db[_0x4a50('0x29')][_0x4a50('0x4c')]({'where':{'id':_0x2261c1[_0x4a50('0x44')]['id']}})[_0x4a50('0x23')](handleEntityNotFound(_0x33dd74,null))[_0x4a50('0x23')](function(_0x277f60){if(_0x277f60){_0x15790c=_0x277f60;_0x43e3ba[_0x4a50('0x2d')]=_[_0x4a50('0x2f')](db[_0x4a50('0x4d')][_0x4a50('0x2a')]);_0x43e3ba[_0x4a50('0x2e')]=_[_0x4a50('0x2f')](_0x2261c1[_0x4a50('0x2e')]);_0x43e3ba[_0x4a50('0x30')]=_[_0x4a50('0x31')](_0x43e3ba['model'],_0x43e3ba[_0x4a50('0x2e')]);_0x34e7de[_0x4a50('0x32')]=_[_0x4a50('0x31')](_0x43e3ba[_0x4a50('0x2d')],qs[_0x4a50('0x45')](_0x2261c1[_0x4a50('0x2e')][_0x4a50('0x45')]));_0x34e7de['attributes']=_0x34e7de[_0x4a50('0x32')]['length']?_0x34e7de[_0x4a50('0x32')]:_0x43e3ba[_0x4a50('0x2d')];_0x34e7de[_0x4a50('0x36')]=qs[_0x4a50('0x37')](_0x2261c1[_0x4a50('0x2e')][_0x4a50('0x37')]);_0x34e7de[_0x4a50('0x38')]=qs[_0x4a50('0x30')](_['pick'](_0x2261c1[_0x4a50('0x2e')],_0x43e3ba[_0x4a50('0x30')]));if(_0x2261c1[_0x4a50('0x2e')][_0x4a50('0x4e')]){_0x34e7de[_0x4a50('0x38')]=_[_0x4a50('0x3a')](_0x34e7de[_0x4a50('0x38')],{'$or':_[_0x4a50('0x28')](_0x34e7de[_0x4a50('0x32')],function(_0x5501da){var _0x50994f={};_0x50994f[_0x5501da]={'$like':'%'+_0x2261c1[_0x4a50('0x2e')][_0x4a50('0x4e')]+'%'};return _0x50994f;})});}_0x34e7de=_[_0x4a50('0x3a')]({},_0x34e7de,_0x2261c1[_0x4a50('0x46')]);return _0x15790c[_0x4a50('0x4b')](_0x34e7de);}})[_0x4a50('0x23')](function(_0x3fb84a){if(_0x3fb84a){_0x11de50=_0x3fb84a[_0x4a50('0x33')];if(!_0x2261c1[_0x4a50('0x2e')][_0x4a50('0x34')](_0x4a50('0x35'))){_0x34e7de[_0x4a50('0x1b')]=qs[_0x4a50('0x1b')](_0x2261c1[_0x4a50('0x2e')][_0x4a50('0x1b')]);_0x34e7de[_0x4a50('0x1c')]=qs['offset'](_0x2261c1['query'][_0x4a50('0x1c')]);}return _0x15790c[_0x4a50('0x4b')](_0x34e7de);}})['then'](function(_0x497c99){if(_0x497c99){return _0x497c99?{'count':_0x11de50,'rows':_0x497c99}:null;}})['then'](respondWithResult(_0x33dd74,null))['catch'](handleError(_0x33dd74,null));};exports[_0x4a50('0x4f')]=function(_0xf92f25,_0x507475,_0x2a8295){if(_0xf92f25[_0x4a50('0x49')]['id']){delete _0xf92f25['body']['id'];}return db[_0x4a50('0x29')][_0x4a50('0x4c')]({'where':{'id':_0xf92f25['params']['id']}})[_0x4a50('0x23')](handleEntityNotFound(_0x507475,null))[_0x4a50('0x23')](function(_0x2a2801){if(_0x2a2801){_0xf92f25[_0x4a50('0x49')][_0x4a50('0x50')]=_0x2a2801['id'];_0xf92f25[_0x4a50('0x49')][_0x4a50('0x51')]=integrations[_0x4a50('0x52')](_0xf92f25['body'][_0x4a50('0x53')],_0xf92f25['body']['type']);_0xf92f25['body'][_0x4a50('0x54')]=integrations[_0x4a50('0x55')](_0xf92f25[_0x4a50('0x49')][_0x4a50('0x53')],_0xf92f25[_0x4a50('0x49')][_0x4a50('0x3b')]);return db[_0x4a50('0x4d')][_0x4a50('0x48')](_0xf92f25[_0x4a50('0x49')],{'include':[{'model':db[_0x4a50('0x56')],'as':_0x4a50('0x51')},{'model':db[_0x4a50('0x56')],'as':_0x4a50('0x54')}]});}return null;})[_0x4a50('0x23')](respondWithResult(_0x507475,null))['catch'](handleError(_0x507475,null));};exports[_0x4a50('0x57')]=function(_0x59a811,_0x1df4fe,_0x347823){var _0x155af7=['made_sla',_0x4a50('0x58'),_0x4a50('0x59'),_0x4a50('0x5a'),_0x4a50('0x5b'),_0x4a50('0x5c'),_0x4a50('0x5d'),_0x4a50('0x5e'),_0x4a50('0x5f')];var _0x24304b=[_0x4a50('0x60'),_0x4a50('0x61'),_0x4a50('0x62'),_0x4a50('0x63'),_0x4a50('0x64'),'sys_updated_on',_0x4a50('0x65'),_0x4a50('0x58'),'approval_history',_0x4a50('0x66'),_0x4a50('0x67'),_0x4a50('0x68'),_0x4a50('0x69'),_0x4a50('0x6a'),_0x4a50('0x6b'),'sys_domain',_0x4a50('0x6c'),_0x4a50('0x6d'),_0x4a50('0x59'),'order','calendar_stc','closed_at',_0x4a50('0x6e'),_0x4a50('0x6f'),_0x4a50('0x70'),_0x4a50('0x71'),'work_notes_list','business_service',_0x4a50('0x72'),'sys_domain_path',_0x4a50('0x73'),_0x4a50('0x74'),'expected_start',_0x4a50('0x75'),_0x4a50('0x76'),_0x4a50('0x77'),_0x4a50('0x78'),_0x4a50('0x79'),_0x4a50('0x7a'),_0x4a50('0x7b'),_0x4a50('0x7c'),'subcategory','work_notes',_0x4a50('0x7d'),_0x4a50('0x5b'),'correlation_display','delivery_task',_0x4a50('0x7e'),_0x4a50('0x7f'),'business_stc',_0x4a50('0x80'),_0x4a50('0x81'),'calendar_duration',_0x4a50('0x5c'),'sys_class_name',_0x4a50('0x82'),_0x4a50('0x83'),_0x4a50('0x84'),'parent_incident',_0x4a50('0x85'),_0x4a50('0x86'),'reopened_by',_0x4a50('0x5d'),_0x4a50('0x87'),_0x4a50('0x88'),'company','reassignment_count',_0x4a50('0x89'),_0x4a50('0x8a'),_0x4a50('0x5e'),'comments',_0x4a50('0x8b'),_0x4a50('0x8c'),_0x4a50('0x8d'),_0x4a50('0x8e'),_0x4a50('0x8f'),_0x4a50('0x90'),'sys_tags',_0x4a50('0x91'),_0x4a50('0x92'),_0x4a50('0x93'),_0x4a50('0x94'),'category'];var _0x429678='';var _0x47f867='';var _0x5041e2=[];var _0xe9eb='';var _0x48f66a='';var _0x138c05=[];var _0x345044='';var _0x56b0fe='';var _0x177cb1={};var _0x251007='';return db[_0x4a50('0x29')][_0x4a50('0x4c')]({'where':{'id':_0x59a811['params']['id']},'attributes':['id','username',_0x4a50('0x95'),_0x4a50('0x96'),_0x4a50('0x97'),_0x4a50('0x98')]})[_0x4a50('0x23')](handleEntityNotFound(_0x1df4fe,null))[_0x4a50('0x23')](function(_0x4760bc){if(_0x4760bc){_0x251007=_0x4760bc['remoteUri'];var _0x1ac9e2=_0x251007[_0x4a50('0x99')](-0x1);if(_0x1ac9e2==='/'){_0x251007=_0x251007['substring'](0x0,_0x251007[_0x4a50('0x9a')](_0x1ac9e2));}_0x56b0fe=util[_0x4a50('0x9b')](_0x4a50('0x9c'),_0x251007);_0x345044=util[_0x4a50('0x9b')]('%s/api/now/table/',_0x251007);_0x177cb1={'user':_0x4760bc[_0x4a50('0x9d')],'pass':_0x4760bc[_0x4a50('0x95')]};var _0x212458={'method':'GET','uri':_0x56b0fe+_0x4a50('0x9e'),'auth':_0x177cb1,'json':!![]};return rp(_0x212458);}})[_0x4a50('0x23')](function(_0x5d26c4){if(_0x5d26c4['result'][_0x4a50('0x33')]>0x0){_0x429678=_0x5d26c4[_0x4a50('0x9f')];}console[_0x4a50('0xa0')]('incident\x20table\x20objects',_0x429678);_0x138c05=[];_0x47f867=Object[_0x4a50('0xa1')]([],_0x429678);_[_0x4a50('0xa2')](_0x47f867,function(_0x4abad3){return!_0x155af7[_0x4a50('0xa3')](_0x4abad3[_0x4a50('0x25')]);});_0x47f867[_0x4a50('0xa4')](function(_0x5c9fa3){var _0x10f2b9=createFieldObject(_0x345044,_0x177cb1,_0x5c9fa3[_0x4a50('0xa5')],_0x5c9fa3['name'],_0x5c9fa3[_0x4a50('0xa6')],![]);_0x138c05[_0x4a50('0xa7')](_0x10f2b9);});return Promise['all'](_0x138c05);})[_0x4a50('0x23')](function(_0x28b830){_0x5041e2=_0x28b830;_0xe9eb=Object['assign']([],_0x429678);console[_0x4a50('0xa0')](_0x4a50('0xa8'),_0x429678);_[_0x4a50('0xa2')](_0xe9eb,function(_0x5f3262){return _0x24304b['includes'](_0x5f3262[_0x4a50('0x25')]);});console[_0x4a50('0xa0')](_0x4a50('0xa9'),_0xe9eb);_0x138c05=[];_0xe9eb['forEach'](function(_0x9a7fba){var _0x24234a=createFieldObject(_0x345044,_0x177cb1,_0x9a7fba[_0x4a50('0xa5')],_0x9a7fba[_0x4a50('0x25')],_0x9a7fba[_0x4a50('0xa6')],!![]);_0x138c05[_0x4a50('0xa7')](_0x24234a);});return Promise[_0x4a50('0xaa')](_0x138c05);})[_0x4a50('0x23')](function(_0x2baa0d){_0x48f66a=_0x2baa0d;var _0x4481ac=_0x5041e2[_0x4a50('0xab')](_0x48f66a);return{'count':_0x4481ac[_0x4a50('0x33')],'rows':_0x4481ac};})[_0x4a50('0x23')](respondWithResult(_0x1df4fe,null))[_0x4a50('0x42')](function(_0x1641f1){console['log'](_0x4a50('0xac')+_0x1641f1);var _0x397163=_0x59a811['query'][_0x4a50('0xad')]?0x1f4:_0x1641f1[_0x4a50('0xae')]||0x1f4;logger[_0x4a50('0x24')](_0x1641f1[_0x4a50('0xaf')]);delete _0x1641f1[_0x4a50('0x25')];if(_0x397163===0x191){_0x397163=0x190;}_0x1df4fe[_0x4a50('0x17')](_0x397163)[_0x4a50('0x26')](_0x59a811[_0x4a50('0x2e')][_0x4a50('0xad')]?{'message':_0x4a50('0xb0'),'statusCode':_0x1641f1['statusCode']}:_0x1641f1);});};function createFieldObject(_0x11861d,_0x5ba4c5,_0x55b141,_0x5d60c2,_0x638253,_0x51fc98){return new Promise(function(_0x2de37d,_0x4c0b3d){var _0x2395b5={'id':_0x5d60c2,'name':_0x638253,'custom':_0x51fc98};if(_0x55b141===_0x4a50('0xb1')){_0x2395b5[_0x4a50('0x46')]=[{'name':_0x4a50('0xb2'),'value':'true'},{'name':_0x4a50('0xb3'),'value':_0x4a50('0xb4')}];_0x2de37d(_0x2395b5);}else{var _0x2af6ac={'method':'GET','uri':_0x11861d+_0x4a50('0xb5')+_0x5d60c2,'auth':_0x5ba4c5,'json':!![]};return rp(_0x2af6ac)[_0x4a50('0x23')](function(_0x1465b4){var _0x2edca8=[];if(_0x1465b4['result'][_0x4a50('0x33')]>0x0){_0x1465b4[_0x4a50('0x9f')]['forEach'](function(_0xdf6d5e){if(_0xdf6d5e[_0x4a50('0xb6')]==='false'){var _0x1761db={'name':_0xdf6d5e[_0x4a50('0xa6')],'value':_0xdf6d5e[_0x4a50('0xb7')]};_0x2edca8['push'](_0x1761db);}});}_0x2395b5[_0x4a50('0x46')]=_0x2edca8;if(_0x2395b5[_0x4a50('0x46')][_0x4a50('0x33')]>0x0){_0x2de37d(_0x2395b5);}else{if(_0x51fc98==![]){_0x2de37d();}else{_0x2de37d(_0x2395b5);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index bf1afee..f78d620 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 _0x8958=['exports','define','ServicenowAccount','util','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes'];(function(_0x2533d5,_0x3d1458){var _0x388da4=function(_0x47ce8c){while(--_0x47ce8c){_0x2533d5['push'](_0x2533d5['shift']());}};_0x388da4(++_0x3d1458);}(_0x8958,0x93));var _0x8895=function(_0x313dc6,_0x1b0c7b){_0x313dc6=_0x313dc6-0x0;var _0x4fb745=_0x8958[_0x313dc6];return _0x4fb745;};'use strict';var _=require('lodash');var util=require(_0x8895('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8895('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8895('0x2'));var config=require(_0x8895('0x3'));var attributes=require(_0x8895('0x4'));var integrations=require('../../components/integrations/configuration');module[_0x8895('0x5')]=function(_0x2f03ad,_0x124e1e){return _0x2f03ad[_0x8895('0x6')](_0x8895('0x7'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8958=['exports','define','ServicenowAccount','util','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes'];(function(_0x52c864,_0x53694a){var _0x506bcf=function(_0x5ec764){while(--_0x5ec764){_0x52c864['push'](_0x52c864['shift']());}};_0x506bcf(++_0x53694a);}(_0x8958,0x93));var _0x8895=function(_0x40ec45,_0x30f25a){_0x40ec45=_0x40ec45-0x0;var _0xd4399a=_0x8958[_0x40ec45];return _0xd4399a;};'use strict';var _=require('lodash');var util=require(_0x8895('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8895('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8895('0x2'));var config=require(_0x8895('0x3'));var attributes=require(_0x8895('0x4'));var integrations=require('../../components/integrations/configuration');module[_0x8895('0x5')]=function(_0x2f03ad,_0x124e1e){return _0x2f03ad[_0x8895('0x6')](_0x8895('0x7'),attributes,{'tableName':'int_servicenow_accounts','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 1273dd2..6ac63d1 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 _0xb4d3=['code','ServicenowAccount,\x20%s,\x20%s','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','where','attributes','limit','include','model','map','debug','ShowServicenowAccount','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','request\x20sent','stringify','error'];(function(_0x5ca1d8,_0x1d780a){var _0x580461=function(_0xdfff6b){while(--_0xdfff6b){_0x5ca1d8['push'](_0x5ca1d8['shift']());}};_0x580461(++_0x1d780a);}(_0xb4d3,0x95));var _0x3b4d=function(_0x5dc45d,_0x55f90f){_0x5dc45d=_0x5dc45d-0x0;var _0x4ce697=_0xb4d3[_0x5dc45d];return _0x4ce697;};'use strict';var _=require(_0x3b4d('0x0'));var util=require(_0x3b4d('0x1'));var moment=require('moment');var BPromise=require(_0x3b4d('0x2'));var rs=require(_0x3b4d('0x3'));var fs=require('fs');var Redis=require(_0x3b4d('0x4'));var db=require(_0x3b4d('0x5'))['db'];var utils=require(_0x3b4d('0x6'));var logger=require('../../config/logger')(_0x3b4d('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3b4d('0x8')][_0x3b4d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x76faee,_0x267e3c,_0x165983){return new BPromise(function(_0x1f1d37,_0x5c946f){return client[_0x3b4d('0xa')](_0x76faee,_0x165983)[_0x3b4d('0xb')](function(_0x29d518){logger[_0x3b4d('0xc')]('ServicenowAccount,\x20%s,\x20%s',_0x267e3c,_0x3b4d('0xd'));logger['debug']('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x267e3c,'request\x20sent',JSON[_0x3b4d('0xe')](_0x29d518));if(_0x29d518[_0x3b4d('0xf')]){if(_0x29d518[_0x3b4d('0xf')][_0x3b4d('0x10')]===0x1f4){logger[_0x3b4d('0xf')](_0x3b4d('0x11'),_0x267e3c,_0x29d518['error']['message']);return _0x5c946f(_0x29d518[_0x3b4d('0xf')]['message']);}logger[_0x3b4d('0xf')](_0x3b4d('0x11'),_0x267e3c,_0x29d518[_0x3b4d('0xf')][_0x3b4d('0x12')]);return _0x1f1d37(_0x29d518[_0x3b4d('0xf')]['message']);}else{logger['info'](_0x3b4d('0x11'),_0x267e3c,_0x3b4d('0xd'));_0x1f1d37(_0x29d518[_0x3b4d('0x13')][_0x3b4d('0x12')]);}})[_0x3b4d('0x14')](function(_0x2518fb){logger[_0x3b4d('0xf')](_0x3b4d('0x11'),_0x267e3c,_0x2518fb);_0x5c946f(_0x2518fb);});});}exports[_0x3b4d('0x15')]=function(_0x582422){var _0x4df647=this;return new Promise(function(_0x42470b,_0x5466ab){return db[_0x3b4d('0x16')][_0x3b4d('0x17')]({'raw':_0x582422[_0x3b4d('0x18')]?_0x582422['options']['raw']===undefined?!![]:![]:!![],'where':_0x582422[_0x3b4d('0x18')]?_0x582422[_0x3b4d('0x18')][_0x3b4d('0x19')]||null:null,'attributes':_0x582422[_0x3b4d('0x18')]?_0x582422[_0x3b4d('0x18')][_0x3b4d('0x1a')]||null:null,'limit':_0x582422[_0x3b4d('0x18')]?_0x582422[_0x3b4d('0x18')][_0x3b4d('0x1b')]||null:null,'include':_0x582422[_0x3b4d('0x18')]?_0x582422[_0x3b4d('0x18')]['include']?_['map'](_0x582422[_0x3b4d('0x18')][_0x3b4d('0x1c')],function(_0x4c0f08){return{'model':db[_0x4c0f08[_0x3b4d('0x1d')]],'as':_0x4c0f08['as'],'attributes':_0x4c0f08['attributes'],'include':_0x4c0f08[_0x3b4d('0x1c')]?_[_0x3b4d('0x1e')](_0x4c0f08[_0x3b4d('0x1c')],function(_0x59b616){return{'model':db[_0x59b616[_0x3b4d('0x1d')]],'as':_0x59b616['as'],'attributes':_0x59b616['attributes'],'include':_0x59b616['include']?_[_0x3b4d('0x1e')](_0x59b616[_0x3b4d('0x1c')],function(_0x2b5c1c){return{'model':db[_0x2b5c1c['model']],'as':_0x2b5c1c['as'],'attributes':_0x2b5c1c[_0x3b4d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3b4d('0xb')](function(_0x18101e){logger['info'](_0x3b4d('0x15'),_0x582422);logger[_0x3b4d('0x1f')](_0x3b4d('0x15'),_0x582422,JSON[_0x3b4d('0xe')](_0x18101e));_0x42470b(_0x18101e);})[_0x3b4d('0x14')](function(_0x5496ff){logger['error'](_0x3b4d('0x15'),_0x5496ff[_0x3b4d('0x12')],_0x582422);_0x5466ab(_0x4df647[_0x3b4d('0xf')](0x1f4,_0x5496ff[_0x3b4d('0x12')]));});});};exports['ShowServicenowAccount']=function(_0x129409){var _0x655a47=this;return new Promise(function(_0x268605,_0x139769){return db[_0x3b4d('0x16')]['find']({'raw':_0x129409[_0x3b4d('0x18')]?_0x129409[_0x3b4d('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x129409[_0x3b4d('0x18')]?_0x129409[_0x3b4d('0x18')][_0x3b4d('0x19')]||null:null,'attributes':_0x129409[_0x3b4d('0x18')]?_0x129409[_0x3b4d('0x18')]['attributes']||null:null,'include':_0x129409[_0x3b4d('0x18')]?_0x129409[_0x3b4d('0x18')][_0x3b4d('0x1c')]?_[_0x3b4d('0x1e')](_0x129409['options'][_0x3b4d('0x1c')],function(_0x6ad942){return{'model':db[_0x6ad942[_0x3b4d('0x1d')]],'as':_0x6ad942['as'],'attributes':_0x6ad942[_0x3b4d('0x1a')],'include':_0x6ad942[_0x3b4d('0x1c')]?_[_0x3b4d('0x1e')](_0x6ad942[_0x3b4d('0x1c')],function(_0x36085f){return{'model':db[_0x36085f[_0x3b4d('0x1d')]],'as':_0x36085f['as'],'attributes':_0x36085f[_0x3b4d('0x1a')],'include':_0x36085f[_0x3b4d('0x1c')]?_[_0x3b4d('0x1e')](_0x36085f[_0x3b4d('0x1c')],function(_0xb3abb4){return{'model':db[_0xb3abb4[_0x3b4d('0x1d')]],'as':_0xb3abb4['as'],'attributes':_0xb3abb4[_0x3b4d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3b4d('0xb')](function(_0x1d46d7){logger[_0x3b4d('0xc')](_0x3b4d('0x20'),_0x129409);logger[_0x3b4d('0x1f')](_0x3b4d('0x20'),_0x129409,JSON['stringify'](_0x1d46d7));_0x268605(_0x1d46d7);})[_0x3b4d('0x14')](function(_0x55cea1){logger[_0x3b4d('0xf')](_0x3b4d('0x20'),_0x55cea1[_0x3b4d('0x12')],_0x129409);_0x139769(_0x655a47['error'](0x1f4,_0x55cea1[_0x3b4d('0x12')]));});});}; \ No newline at end of file +var _0x85ab=['then','request\x20sent','debug','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','info','GetServicenowAccount','ServicenowAccount','raw','options','where','attributes','limit','include','model','map','catch','ShowServicenowAccount','find','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x5efb33,_0x426463){var _0xe0778d=function(_0x1befe7){while(--_0x1befe7){_0x5efb33['push'](_0x5efb33['shift']());}};_0xe0778d(++_0x426463);}(_0x85ab,0x104));var _0xb85a=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x85ab[_0x263a74];return _0x2aa86c;};'use strict';var _=require(_0xb85a('0x0'));var util=require(_0xb85a('0x1'));var moment=require('moment');var BPromise=require(_0xb85a('0x2'));var rs=require(_0xb85a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb85a('0x4'))['db'];var utils=require(_0xb85a('0x5'));var logger=require(_0xb85a('0x6'))('rpc');var config=require(_0xb85a('0x7'));var jayson=require(_0xb85a('0x8'));var client=jayson[_0xb85a('0x9')][_0xb85a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x38741e,_0x31362e,_0xd4f040){return new BPromise(function(_0x351720,_0x1c46d7){return client[_0xb85a('0xb')](_0x38741e,_0xd4f040)[_0xb85a('0xc')](function(_0x3aafe2){logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x31362e,_0xb85a('0xd'));logger[_0xb85a('0xe')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x31362e,_0xb85a('0xd'),JSON[_0xb85a('0xf')](_0x3aafe2));if(_0x3aafe2[_0xb85a('0x10')]){if(_0x3aafe2['error'][_0xb85a('0x11')]===0x1f4){logger['error'](_0xb85a('0x12'),_0x31362e,_0x3aafe2[_0xb85a('0x10')]['message']);return _0x1c46d7(_0x3aafe2[_0xb85a('0x10')]['message']);}logger[_0xb85a('0x10')](_0xb85a('0x12'),_0x31362e,_0x3aafe2[_0xb85a('0x10')][_0xb85a('0x13')]);return _0x351720(_0x3aafe2[_0xb85a('0x10')][_0xb85a('0x13')]);}else{logger[_0xb85a('0x14')](_0xb85a('0x12'),_0x31362e,_0xb85a('0xd'));_0x351720(_0x3aafe2['result'][_0xb85a('0x13')]);}})['catch'](function(_0x212273){logger[_0xb85a('0x10')](_0xb85a('0x12'),_0x31362e,_0x212273);_0x1c46d7(_0x212273);});});}exports[_0xb85a('0x15')]=function(_0x14eecc){var _0x496650=this;return new Promise(function(_0x23d404,_0x273e2d){return db[_0xb85a('0x16')]['findAll']({'raw':_0x14eecc['options']?_0x14eecc['options'][_0xb85a('0x17')]===undefined?!![]:![]:!![],'where':_0x14eecc[_0xb85a('0x18')]?_0x14eecc[_0xb85a('0x18')][_0xb85a('0x19')]||null:null,'attributes':_0x14eecc['options']?_0x14eecc[_0xb85a('0x18')][_0xb85a('0x1a')]||null:null,'limit':_0x14eecc['options']?_0x14eecc['options'][_0xb85a('0x1b')]||null:null,'include':_0x14eecc['options']?_0x14eecc[_0xb85a('0x18')]['include']?_['map'](_0x14eecc[_0xb85a('0x18')][_0xb85a('0x1c')],function(_0x4e4738){return{'model':db[_0x4e4738[_0xb85a('0x1d')]],'as':_0x4e4738['as'],'attributes':_0x4e4738[_0xb85a('0x1a')],'include':_0x4e4738[_0xb85a('0x1c')]?_[_0xb85a('0x1e')](_0x4e4738['include'],function(_0x508c23){return{'model':db[_0x508c23['model']],'as':_0x508c23['as'],'attributes':_0x508c23[_0xb85a('0x1a')],'include':_0x508c23['include']?_[_0xb85a('0x1e')](_0x508c23[_0xb85a('0x1c')],function(_0x5a9e67){return{'model':db[_0x5a9e67[_0xb85a('0x1d')]],'as':_0x5a9e67['as'],'attributes':_0x5a9e67[_0xb85a('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xb6af7){logger[_0xb85a('0x14')](_0xb85a('0x15'),_0x14eecc);logger[_0xb85a('0xe')](_0xb85a('0x15'),_0x14eecc,JSON[_0xb85a('0xf')](_0xb6af7));_0x23d404(_0xb6af7);})[_0xb85a('0x1f')](function(_0x3cbac5){logger[_0xb85a('0x10')]('GetServicenowAccount',_0x3cbac5[_0xb85a('0x13')],_0x14eecc);_0x273e2d(_0x496650['error'](0x1f4,_0x3cbac5['message']));});});};exports[_0xb85a('0x20')]=function(_0x35dfbb){var _0x2656a3=this;return new Promise(function(_0x93b506,_0x2cf882){return db[_0xb85a('0x16')][_0xb85a('0x21')]({'raw':_0x35dfbb['options']?_0x35dfbb[_0xb85a('0x18')][_0xb85a('0x17')]===undefined?!![]:![]:!![],'where':_0x35dfbb[_0xb85a('0x18')]?_0x35dfbb[_0xb85a('0x18')][_0xb85a('0x19')]||null:null,'attributes':_0x35dfbb[_0xb85a('0x18')]?_0x35dfbb[_0xb85a('0x18')][_0xb85a('0x1a')]||null:null,'include':_0x35dfbb[_0xb85a('0x18')]?_0x35dfbb[_0xb85a('0x18')][_0xb85a('0x1c')]?_[_0xb85a('0x1e')](_0x35dfbb[_0xb85a('0x18')][_0xb85a('0x1c')],function(_0x52255c){return{'model':db[_0x52255c[_0xb85a('0x1d')]],'as':_0x52255c['as'],'attributes':_0x52255c['attributes'],'include':_0x52255c[_0xb85a('0x1c')]?_['map'](_0x52255c[_0xb85a('0x1c')],function(_0x1f6a24){return{'model':db[_0x1f6a24[_0xb85a('0x1d')]],'as':_0x1f6a24['as'],'attributes':_0x1f6a24[_0xb85a('0x1a')],'include':_0x1f6a24[_0xb85a('0x1c')]?_['map'](_0x1f6a24['include'],function(_0x5ce6ae){return{'model':db[_0x5ce6ae[_0xb85a('0x1d')]],'as':_0x5ce6ae['as'],'attributes':_0x5ce6ae[_0xb85a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xb85a('0xc')](function(_0x27719d){logger[_0xb85a('0x14')](_0xb85a('0x20'),_0x35dfbb);logger[_0xb85a('0xe')](_0xb85a('0x20'),_0x35dfbb,JSON['stringify'](_0x27719d));_0x93b506(_0x27719d);})[_0xb85a('0x1f')](function(_0x33e069){logger[_0xb85a('0x10')](_0xb85a('0x20'),_0x33e069[_0xb85a('0x13')],_0x35dfbb);_0x2cf882(_0x2656a3[_0xb85a('0x10')](0x1f4,_0x33e069[_0xb85a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index d128586..712349b 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 _0x970c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','get','index','/:id','show','/:id/fields','isAuthenticated','getFields','/:id/subjects','post','create','put','update','delete','destroy'];(function(_0x335d80,_0x451d6d){var _0x524487=function(_0x441ba5){while(--_0x441ba5){_0x335d80['push'](_0x335d80['shift']());}};_0x524487(++_0x451d6d);}(_0x970c,0x109));var _0xc970=function(_0x21c1cd,_0x2fd7f5){_0x21c1cd=_0x21c1cd-0x0;var _0xa846c8=_0x970c[_0x21c1cd];return _0xa846c8;};'use strict';var multer=require(_0xc970('0x0'));var util=require(_0xc970('0x1'));var path=require(_0xc970('0x2'));var timeout=require(_0xc970('0x3'));var express=require(_0xc970('0x4'));var router=express['Router']();var fs_extra=require(_0xc970('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc970('0x6'));var config=require('../../config/environment');var controller=require('./intServicenowConfiguration.controller');router[_0xc970('0x7')]('/',auth['isAuthenticated'](),controller[_0xc970('0x8')]);router[_0xc970('0x7')](_0xc970('0x9'),auth['isAuthenticated'](),controller[_0xc970('0xa')]);router['get'](_0xc970('0xb'),auth[_0xc970('0xc')](),controller[_0xc970('0xd')]);router[_0xc970('0x7')](_0xc970('0xe'),auth[_0xc970('0xc')](),controller['getSubjects']);router[_0xc970('0x7')]('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router[_0xc970('0xf')]('/',auth[_0xc970('0xc')](),controller[_0xc970('0x10')]);router[_0xc970('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc970('0x12')]);router[_0xc970('0x13')]('/:id',auth[_0xc970('0xc')](),controller[_0xc970('0x14')]);module[_0xc970('0x15')]=router; \ No newline at end of file +var _0x741f=['put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','/:id','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create'];(function(_0x415ac5,_0x663a59){var _0x2fb770=function(_0x2286c4){while(--_0x2286c4){_0x415ac5['push'](_0x415ac5['shift']());}};_0x2fb770(++_0x663a59);}(_0x741f,0xdc));var _0xf741=function(_0x2ca071,_0x5893c5){_0x2ca071=_0x2ca071-0x0;var _0x353fe3=_0x741f[_0x2ca071];return _0x353fe3;};'use strict';var multer=require(_0xf741('0x0'));var util=require(_0xf741('0x1'));var path=require(_0xf741('0x2'));var timeout=require(_0xf741('0x3'));var express=require('express');var router=express[_0xf741('0x4')]();var fs_extra=require(_0xf741('0x5'));var auth=require(_0xf741('0x6'));var interaction=require(_0xf741('0x7'));var config=require(_0xf741('0x8'));var controller=require(_0xf741('0x9'));router[_0xf741('0xa')]('/',auth[_0xf741('0xb')](),controller['index']);router[_0xf741('0xa')](_0xf741('0xc'),auth[_0xf741('0xb')](),controller['show']);router[_0xf741('0xa')]('/:id/fields',auth[_0xf741('0xb')](),controller[_0xf741('0xd')]);router[_0xf741('0xa')](_0xf741('0xe'),auth[_0xf741('0xb')](),controller[_0xf741('0xf')]);router[_0xf741('0xa')](_0xf741('0x10'),auth[_0xf741('0xb')](),controller[_0xf741('0x11')]);router[_0xf741('0x12')]('/',auth[_0xf741('0xb')](),controller[_0xf741('0x13')]);router[_0xf741('0x14')](_0xf741('0xc'),auth['isAuthenticated'](),controller[_0xf741('0x15')]);router[_0xf741('0x16')](_0xf741('0xc'),auth[_0xf741('0xb')](),controller[_0xf741('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 9320edc..7930405 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 _0xf345=['STRING','sequelize','exports'];(function(_0x51a7aa,_0x2258d9){var _0x1c1ded=function(_0x35814e){while(--_0x35814e){_0x51a7aa['push'](_0x51a7aa['shift']());}};_0x1c1ded(++_0x2258d9);}(_0xf345,0x1de));var _0x5f34=function(_0x4c04c0,_0x510515){_0x4c04c0=_0x4c04c0-0x0;var _0x4aacc1=_0xf345[_0x4c04c0];return _0x4aacc1;};'use strict';var Sequelize=require(_0x5f34('0x0'));module[_0x5f34('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5f34('0x2')]}}; \ No newline at end of file +var _0x6edb=['STRING'];(function(_0x3db023,_0x2e88bc){var _0x20f63c=function(_0xeb15f8){while(--_0xeb15f8){_0x3db023['push'](_0x3db023['shift']());}};_0x20f63c(++_0x2e88bc);}(_0x6edb,0xcc));var _0xb6ed=function(_0x100a95,_0x3188df){_0x100a95=_0x100a95-0x0;var _0x19c632=_0x6edb[_0x100a95];return _0x19c632;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb6ed('0x0')]},'description':{'type':Sequelize[_0xb6ed('0x0')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index e3683f6..0851e66 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 _0x6ed2=['catch','show','params','keys','find','create','body','getFields','findOne','ServicenowField','pick','nolimit','getSubjects','getDescriptions','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','ServicenowConfiguration','rawAttributes','fieldName','key','map','query','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows'];(function(_0x532f50,_0x15a0ab){var _0x43ad00=function(_0x45b5ec){while(--_0x45b5ec){_0x532f50['push'](_0x532f50['shift']());}};_0x43ad00(++_0x15a0ab);}(_0x6ed2,0xb0));var _0x26ed=function(_0x5c80fa,_0x4c932a){_0x5c80fa=_0x5c80fa-0x0;var _0x34c1f9=_0x6ed2[_0x5c80fa];return _0x34c1f9;};'use strict';var emlformat=require(_0x26ed('0x0'));var rimraf=require(_0x26ed('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x26ed('0x2'));var moment=require(_0x26ed('0x3'));var BPromise=require(_0x26ed('0x4'));var Mustache=require(_0x26ed('0x5'));var util=require(_0x26ed('0x6'));var path=require(_0x26ed('0x7'));var sox=require(_0x26ed('0x8'));var csv=require(_0x26ed('0x9'));var ejs=require(_0x26ed('0xa'));var fs=require('fs');var fs_extra=require(_0x26ed('0xb'));var _=require(_0x26ed('0xc'));var squel=require(_0x26ed('0xd'));var crypto=require(_0x26ed('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x26ed('0xf'));var toCsv=require('to-csv');var querystring=require(_0x26ed('0x10'));var Papa=require(_0x26ed('0x11'));var Redis=require('ioredis');var authService=require(_0x26ed('0x12'));var qs=require(_0x26ed('0x13'));var as=require(_0x26ed('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x26ed('0x15'))(_0x26ed('0x16'));var utils=require(_0x26ed('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x26ed('0x18'))['db'];function respondWithStatusCode(_0x23efb5,_0x1ab8aa){_0x1ab8aa=_0x1ab8aa||0xcc;return function(_0xbb46b7){if(_0xbb46b7){return _0x23efb5['sendStatus'](_0x1ab8aa);}return _0x23efb5[_0x26ed('0x19')](_0x1ab8aa)[_0x26ed('0x1a')]();};}function respondWithResult(_0x170520,_0x3c487d){_0x3c487d=_0x3c487d||0xc8;return function(_0x1d9ec1){if(_0x1d9ec1){return _0x170520['status'](_0x3c487d)[_0x26ed('0x1b')](_0x1d9ec1);}};}function respondWithFilteredResult(_0x54f55e,_0x1a94bd){return function(_0x42b4d7){if(_0x42b4d7){var _0x278772=typeof _0x1a94bd[_0x26ed('0x1c')]===_0x26ed('0x1d')&&typeof _0x1a94bd[_0x26ed('0x1e')]==='undefined';var _0x550a39=_0x42b4d7[_0x26ed('0x1f')];var _0x2b262f=_0x278772?0x0:_0x1a94bd[_0x26ed('0x1c')];var _0x29911a=_0x278772?_0x42b4d7['count']:_0x1a94bd[_0x26ed('0x1c')]+_0x1a94bd['limit'];var _0x4d8159;if(_0x29911a>=_0x550a39){_0x29911a=_0x550a39;_0x4d8159=0xc8;}else{_0x4d8159=0xce;}_0x54f55e['status'](_0x4d8159);return _0x54f55e[_0x26ed('0x20')](_0x26ed('0x21'),_0x2b262f+'-'+_0x29911a+'/'+_0x550a39)[_0x26ed('0x1b')](_0x42b4d7);}return null;};}function patchUpdates(_0x3d3988){return function(_0xe6b8dd){try{jsonpatch[_0x26ed('0x22')](_0xe6b8dd,_0x3d3988,!![]);}catch(_0x51b53b){return BPromise[_0x26ed('0x23')](_0x51b53b);}return _0xe6b8dd['save']();};}function saveUpdates(_0x2f43a0,_0x2d594f){return function(_0x201fed){if(_0x201fed){return _0x201fed[_0x26ed('0x24')](_0x2f43a0)['then'](function(_0x56a337){return _0x56a337;});}return null;};}function removeEntity(_0x3addf4,_0x200e06){return function(_0x2fbff5){if(_0x2fbff5){return _0x2fbff5[_0x26ed('0x25')]()[_0x26ed('0x26')](function(){_0x3addf4['status'](0xcc)[_0x26ed('0x1a')]();});}};}function handleEntityNotFound(_0x291c0f,_0x48c3a1){return function(_0xd53ff3){if(!_0xd53ff3){_0x291c0f['sendStatus'](0x194);}return _0xd53ff3;};}function handleError(_0x2a907d,_0x6cd77c){_0x6cd77c=_0x6cd77c||0x1f4;return function(_0x346e0b){logger[_0x26ed('0x27')](_0x346e0b[_0x26ed('0x28')]);if(_0x346e0b[_0x26ed('0x29')]){delete _0x346e0b[_0x26ed('0x29')];}_0x2a907d[_0x26ed('0x19')](_0x6cd77c)['send'](_0x346e0b);};}exports['index']=function(_0x2b63ac,_0x115075){var _0x3ed475={},_0x286917={},_0x29f227={'count':0x0,'rows':[]};var _0xf85c42=_['map'](db[_0x26ed('0x2a')][_0x26ed('0x2b')],function(_0x11298c){return{'name':_0x11298c[_0x26ed('0x2c')],'type':_0x11298c['type'][_0x26ed('0x2d')]};});_0x286917['model']=_[_0x26ed('0x2e')](_0xf85c42,'name');_0x286917[_0x26ed('0x2f')]=_['keys'](_0x2b63ac[_0x26ed('0x2f')]);_0x286917['filters']=_[_0x26ed('0x30')](_0x286917[_0x26ed('0x31')],_0x286917[_0x26ed('0x2f')]);_0x3ed475['attributes']=_[_0x26ed('0x30')](_0x286917['model'],qs[_0x26ed('0x32')](_0x2b63ac[_0x26ed('0x2f')][_0x26ed('0x32')]));_0x3ed475[_0x26ed('0x33')]=_0x3ed475[_0x26ed('0x33')][_0x26ed('0x34')]?_0x3ed475[_0x26ed('0x33')]:_0x286917[_0x26ed('0x31')];if(!_0x2b63ac['query'][_0x26ed('0x35')]('nolimit')){_0x3ed475['limit']=qs['limit'](_0x2b63ac[_0x26ed('0x2f')][_0x26ed('0x1e')]);_0x3ed475[_0x26ed('0x1c')]=qs[_0x26ed('0x1c')](_0x2b63ac[_0x26ed('0x2f')][_0x26ed('0x1c')]);}_0x3ed475[_0x26ed('0x36')]=qs['sort'](_0x2b63ac['query'][_0x26ed('0x37')]);_0x3ed475[_0x26ed('0x38')]=qs[_0x26ed('0x39')](_['pick'](_0x2b63ac[_0x26ed('0x2f')],_0x286917[_0x26ed('0x39')]),_0xf85c42);if(_0x2b63ac[_0x26ed('0x2f')][_0x26ed('0x3a')]){_0x3ed475[_0x26ed('0x38')]=_[_0x26ed('0x3b')](_0x3ed475['where'],{'$or':_[_0x26ed('0x2e')](_0xf85c42,function(_0x4d5e9f){if(_0x4d5e9f[_0x26ed('0x3c')]!==_0x26ed('0x3d')){var _0x24b384={};_0x24b384[_0x4d5e9f[_0x26ed('0x29')]]={'$like':'%'+_0x2b63ac[_0x26ed('0x2f')]['filter']+'%'};return _0x24b384;}})});}_0x3ed475=_[_0x26ed('0x3b')]({},_0x3ed475,_0x2b63ac[_0x26ed('0x3e')]);var _0x1f7c9d={'where':_0x3ed475[_0x26ed('0x38')]};return db['ServicenowConfiguration'][_0x26ed('0x1f')](_0x1f7c9d)[_0x26ed('0x26')](function(_0x72496e){_0x29f227['count']=_0x72496e;if(_0x2b63ac[_0x26ed('0x2f')][_0x26ed('0x3f')]){_0x3ed475[_0x26ed('0x40')]=[{'all':!![]}];}return db[_0x26ed('0x2a')][_0x26ed('0x41')](_0x3ed475);})[_0x26ed('0x26')](function(_0x2d5bdc){_0x29f227[_0x26ed('0x42')]=_0x2d5bdc;return _0x29f227;})[_0x26ed('0x26')](respondWithFilteredResult(_0x115075,_0x3ed475))[_0x26ed('0x43')](handleError(_0x115075,null));};exports[_0x26ed('0x44')]=function(_0x181c88,_0x34225e){var _0x482271={'raw':![],'where':{'id':_0x181c88[_0x26ed('0x45')]['id']}},_0x15a666={};_0x15a666[_0x26ed('0x31')]=_['keys'](db['ServicenowConfiguration']['rawAttributes']);_0x15a666[_0x26ed('0x2f')]=_[_0x26ed('0x46')](_0x181c88['query']);_0x15a666[_0x26ed('0x39')]=_[_0x26ed('0x30')](_0x15a666[_0x26ed('0x31')],_0x15a666['query']);_0x482271[_0x26ed('0x33')]=_[_0x26ed('0x30')](_0x15a666[_0x26ed('0x31')],qs[_0x26ed('0x32')](_0x181c88[_0x26ed('0x2f')]['fields']));_0x482271[_0x26ed('0x33')]=_0x482271[_0x26ed('0x33')][_0x26ed('0x34')]?_0x482271[_0x26ed('0x33')]:_0x15a666[_0x26ed('0x31')];if(_0x181c88[_0x26ed('0x2f')][_0x26ed('0x3f')]){_0x482271['include']=[{'all':!![]}];}_0x482271=_[_0x26ed('0x3b')]({},_0x482271,_0x181c88[_0x26ed('0x3e')]);return db[_0x26ed('0x2a')][_0x26ed('0x47')](_0x482271)['then'](handleEntityNotFound(_0x34225e,null))[_0x26ed('0x26')](respondWithResult(_0x34225e,null))[_0x26ed('0x43')](handleError(_0x34225e,null));};exports['create']=function(_0x1843ef,_0xb7a5e8){return db[_0x26ed('0x2a')][_0x26ed('0x48')](_0x1843ef[_0x26ed('0x49')],{})[_0x26ed('0x26')](respondWithResult(_0xb7a5e8,0xc9))[_0x26ed('0x43')](handleError(_0xb7a5e8,null));};exports[_0x26ed('0x24')]=function(_0x165d19,_0x5ee250){if(_0x165d19[_0x26ed('0x49')]['id']){delete _0x165d19[_0x26ed('0x49')]['id'];}return db['ServicenowConfiguration']['find']({'where':{'id':_0x165d19['params']['id']}})['then'](handleEntityNotFound(_0x5ee250,null))['then'](saveUpdates(_0x165d19[_0x26ed('0x49')],null))[_0x26ed('0x26')](respondWithResult(_0x5ee250,null))[_0x26ed('0x43')](handleError(_0x5ee250,null));};exports[_0x26ed('0x25')]=function(_0x450762,_0x97c722){return db['ServicenowConfiguration'][_0x26ed('0x47')]({'where':{'id':_0x450762[_0x26ed('0x45')]['id']}})['then'](handleEntityNotFound(_0x97c722,null))[_0x26ed('0x26')](removeEntity(_0x97c722,null))[_0x26ed('0x43')](handleError(_0x97c722,null));};exports[_0x26ed('0x4a')]=function(_0x17be53,_0x54fff0,_0x452370){var _0xe8de7e={};var _0x3b8f39={};var _0x153432;var _0x449193;return db[_0x26ed('0x2a')][_0x26ed('0x4b')]({'where':{'id':_0x17be53['params']['id']}})[_0x26ed('0x26')](handleEntityNotFound(_0x54fff0,null))['then'](function(_0x5369d2){if(_0x5369d2){_0x153432=_0x5369d2;_0x3b8f39[_0x26ed('0x31')]=_[_0x26ed('0x46')](db[_0x26ed('0x4c')][_0x26ed('0x2b')]);_0x3b8f39[_0x26ed('0x2f')]=_['keys'](_0x17be53[_0x26ed('0x2f')]);_0x3b8f39[_0x26ed('0x39')]=_[_0x26ed('0x30')](_0x3b8f39[_0x26ed('0x31')],_0x3b8f39[_0x26ed('0x2f')]);_0xe8de7e[_0x26ed('0x33')]=_[_0x26ed('0x30')](_0x3b8f39[_0x26ed('0x31')],qs[_0x26ed('0x32')](_0x17be53[_0x26ed('0x2f')]['fields']));_0xe8de7e[_0x26ed('0x33')]=_0xe8de7e[_0x26ed('0x33')][_0x26ed('0x34')]?_0xe8de7e[_0x26ed('0x33')]:_0x3b8f39[_0x26ed('0x31')];_0xe8de7e['order']=qs[_0x26ed('0x37')](_0x17be53[_0x26ed('0x2f')][_0x26ed('0x37')]);_0xe8de7e[_0x26ed('0x38')]=qs[_0x26ed('0x39')](_[_0x26ed('0x4d')](_0x17be53[_0x26ed('0x2f')],_0x3b8f39[_0x26ed('0x39')]));if(_0x17be53[_0x26ed('0x2f')][_0x26ed('0x3a')]){_0xe8de7e[_0x26ed('0x38')]=_[_0x26ed('0x3b')](_0xe8de7e[_0x26ed('0x38')],{'$or':_[_0x26ed('0x2e')](_0xe8de7e[_0x26ed('0x33')],function(_0xf92ed5){var _0x4eab2f={};_0x4eab2f[_0xf92ed5]={'$like':'%'+_0x17be53[_0x26ed('0x2f')][_0x26ed('0x3a')]+'%'};return _0x4eab2f;})});}_0xe8de7e=_[_0x26ed('0x3b')]({},_0xe8de7e,_0x17be53['options']);return _0x153432['getFields'](_0xe8de7e);}})[_0x26ed('0x26')](function(_0x30b076){if(_0x30b076){_0x449193=_0x30b076[_0x26ed('0x34')];if(!_0x17be53[_0x26ed('0x2f')][_0x26ed('0x35')](_0x26ed('0x4e'))){_0xe8de7e['limit']=qs[_0x26ed('0x1e')](_0x17be53[_0x26ed('0x2f')][_0x26ed('0x1e')]);_0xe8de7e[_0x26ed('0x1c')]=qs[_0x26ed('0x1c')](_0x17be53[_0x26ed('0x2f')][_0x26ed('0x1c')]);}return _0x153432[_0x26ed('0x4a')](_0xe8de7e);}})[_0x26ed('0x26')](function(_0xda834){if(_0xda834){return _0xda834?{'count':_0x449193,'rows':_0xda834}:null;}})[_0x26ed('0x26')](respondWithResult(_0x54fff0,null))['catch'](handleError(_0x54fff0,null));};exports[_0x26ed('0x4f')]=function(_0x4d43d1,_0x9a6066,_0x2824d8){var _0x57a097={};var _0x3a9c4b={};var _0x34fd0d;var _0x334236;return db[_0x26ed('0x2a')]['findOne']({'where':{'id':_0x4d43d1[_0x26ed('0x45')]['id']}})[_0x26ed('0x26')](handleEntityNotFound(_0x9a6066,null))[_0x26ed('0x26')](function(_0x329d89){if(_0x329d89){_0x34fd0d=_0x329d89;_0x3a9c4b[_0x26ed('0x31')]=_[_0x26ed('0x46')](db[_0x26ed('0x4c')]['rawAttributes']);_0x3a9c4b['query']=_['keys'](_0x4d43d1[_0x26ed('0x2f')]);_0x3a9c4b[_0x26ed('0x39')]=_[_0x26ed('0x30')](_0x3a9c4b[_0x26ed('0x31')],_0x3a9c4b['query']);_0x57a097[_0x26ed('0x33')]=_['intersection'](_0x3a9c4b[_0x26ed('0x31')],qs['fields'](_0x4d43d1[_0x26ed('0x2f')][_0x26ed('0x32')]));_0x57a097[_0x26ed('0x33')]=_0x57a097[_0x26ed('0x33')]['length']?_0x57a097[_0x26ed('0x33')]:_0x3a9c4b['model'];_0x57a097[_0x26ed('0x36')]=qs[_0x26ed('0x37')](_0x4d43d1[_0x26ed('0x2f')][_0x26ed('0x37')]);_0x57a097[_0x26ed('0x38')]=qs[_0x26ed('0x39')](_[_0x26ed('0x4d')](_0x4d43d1[_0x26ed('0x2f')],_0x3a9c4b[_0x26ed('0x39')]));if(_0x4d43d1[_0x26ed('0x2f')][_0x26ed('0x3a')]){_0x57a097['where']=_[_0x26ed('0x3b')](_0x57a097[_0x26ed('0x38')],{'$or':_[_0x26ed('0x2e')](_0x57a097['attributes'],function(_0x34001a){var _0xe1b856={};_0xe1b856[_0x34001a]={'$like':'%'+_0x4d43d1[_0x26ed('0x2f')]['filter']+'%'};return _0xe1b856;})});}_0x57a097=_[_0x26ed('0x3b')]({},_0x57a097,_0x4d43d1[_0x26ed('0x3e')]);return _0x34fd0d['getSubjects'](_0x57a097);}})[_0x26ed('0x26')](function(_0x319835){if(_0x319835){_0x334236=_0x319835[_0x26ed('0x34')];if(!_0x4d43d1[_0x26ed('0x2f')][_0x26ed('0x35')](_0x26ed('0x4e'))){_0x57a097[_0x26ed('0x1e')]=qs['limit'](_0x4d43d1['query'][_0x26ed('0x1e')]);_0x57a097[_0x26ed('0x1c')]=qs[_0x26ed('0x1c')](_0x4d43d1[_0x26ed('0x2f')][_0x26ed('0x1c')]);}return _0x34fd0d[_0x26ed('0x4f')](_0x57a097);}})[_0x26ed('0x26')](function(_0x4cdba1){if(_0x4cdba1){return _0x4cdba1?{'count':_0x334236,'rows':_0x4cdba1}:null;}})[_0x26ed('0x26')](respondWithResult(_0x9a6066,null))['catch'](handleError(_0x9a6066,null));};exports[_0x26ed('0x50')]=function(_0x13ca38,_0x1dad6d,_0x2605ff){var _0x1dd2b0={};var _0x43d5cc={};var _0x16a84e;var _0x100efa;return db[_0x26ed('0x2a')]['findOne']({'where':{'id':_0x13ca38[_0x26ed('0x45')]['id']}})[_0x26ed('0x26')](handleEntityNotFound(_0x1dad6d,null))['then'](function(_0x1e6738){if(_0x1e6738){_0x16a84e=_0x1e6738;_0x43d5cc[_0x26ed('0x31')]=_[_0x26ed('0x46')](db[_0x26ed('0x4c')][_0x26ed('0x2b')]);_0x43d5cc[_0x26ed('0x2f')]=_[_0x26ed('0x46')](_0x13ca38['query']);_0x43d5cc['filters']=_[_0x26ed('0x30')](_0x43d5cc[_0x26ed('0x31')],_0x43d5cc[_0x26ed('0x2f')]);_0x1dd2b0[_0x26ed('0x33')]=_['intersection'](_0x43d5cc[_0x26ed('0x31')],qs['fields'](_0x13ca38[_0x26ed('0x2f')][_0x26ed('0x32')]));_0x1dd2b0['attributes']=_0x1dd2b0[_0x26ed('0x33')][_0x26ed('0x34')]?_0x1dd2b0['attributes']:_0x43d5cc[_0x26ed('0x31')];_0x1dd2b0[_0x26ed('0x36')]=qs[_0x26ed('0x37')](_0x13ca38[_0x26ed('0x2f')][_0x26ed('0x37')]);_0x1dd2b0[_0x26ed('0x38')]=qs[_0x26ed('0x39')](_[_0x26ed('0x4d')](_0x13ca38[_0x26ed('0x2f')],_0x43d5cc[_0x26ed('0x39')]));if(_0x13ca38['query'][_0x26ed('0x3a')]){_0x1dd2b0[_0x26ed('0x38')]=_[_0x26ed('0x3b')](_0x1dd2b0[_0x26ed('0x38')],{'$or':_[_0x26ed('0x2e')](_0x1dd2b0[_0x26ed('0x33')],function(_0x515d44){var _0x5756de={};_0x5756de[_0x515d44]={'$like':'%'+_0x13ca38[_0x26ed('0x2f')][_0x26ed('0x3a')]+'%'};return _0x5756de;})});}_0x1dd2b0=_[_0x26ed('0x3b')]({},_0x1dd2b0,_0x13ca38['options']);return _0x16a84e[_0x26ed('0x50')](_0x1dd2b0);}})[_0x26ed('0x26')](function(_0x1966a9){if(_0x1966a9){_0x100efa=_0x1966a9[_0x26ed('0x34')];if(!_0x13ca38[_0x26ed('0x2f')][_0x26ed('0x35')](_0x26ed('0x4e'))){_0x1dd2b0[_0x26ed('0x1e')]=qs[_0x26ed('0x1e')](_0x13ca38[_0x26ed('0x2f')][_0x26ed('0x1e')]);_0x1dd2b0['offset']=qs[_0x26ed('0x1c')](_0x13ca38['query'][_0x26ed('0x1c')]);}return _0x16a84e[_0x26ed('0x50')](_0x1dd2b0);}})['then'](function(_0x25feac){if(_0x25feac){return _0x25feac?{'count':_0x100efa,'rows':_0x25feac}:null;}})[_0x26ed('0x26')](respondWithResult(_0x1dad6d,null))[_0x26ed('0x43')](handleError(_0x1dad6d,null));}; \ No newline at end of file +var _0xfb99=['fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','where','pick','merge','includeAll','include','rows','show','keys','find','catch','create','body','params','ServicenowField','sort','filter','options','getFields','getSubjects','findOne','getDescriptions','eml-format','rimraf','fast-json-patch','moment','mustache','util','to-csv'];(function(_0x22f53f,_0x14ef66){var _0x57bc67=function(_0x375f18){while(--_0x375f18){_0x22f53f['push'](_0x22f53f['shift']());}};_0x57bc67(++_0x14ef66);}(_0xfb99,0x1b5));var _0x9fb9=function(_0x39c745,_0xa4b72a){_0x39c745=_0x39c745-0x0;var _0x3b4c9c=_0xfb99[_0x39c745];return _0x3b4c9c;};'use strict';var emlformat=require(_0x9fb9('0x0'));var rimraf=require(_0x9fb9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9fb9('0x2'));var rp=require('request-promise');var moment=require(_0x9fb9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9fb9('0x4'));var util=require(_0x9fb9('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x9fb9('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9fb9('0x7'));var _=require(_0x9fb9('0x8'));var squel=require('squel');var crypto=require(_0x9fb9('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x9fb9('0xa'));var toCsv=require(_0x9fb9('0x6'));var querystring=require('querystring');var Papa=require(_0x9fb9('0xb'));var Redis=require(_0x9fb9('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x9fb9('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x9fb9('0xe'));var config=require(_0x9fb9('0xf'));var licenseUtil=require(_0x9fb9('0x10'));var db=require(_0x9fb9('0x11'))['db'];function respondWithStatusCode(_0x14607f,_0x445173){_0x445173=_0x445173||0xcc;return function(_0x44f5c8){if(_0x44f5c8){return _0x14607f[_0x9fb9('0x12')](_0x445173);}return _0x14607f['status'](_0x445173)[_0x9fb9('0x13')]();};}function respondWithResult(_0x3526bb,_0x4e754d){_0x4e754d=_0x4e754d||0xc8;return function(_0x10baca){if(_0x10baca){return _0x3526bb[_0x9fb9('0x14')](_0x4e754d)[_0x9fb9('0x15')](_0x10baca);}};}function respondWithFilteredResult(_0x42115b,_0x181242){return function(_0x25b786){if(_0x25b786){var _0x150807=typeof _0x181242[_0x9fb9('0x16')]==='undefined'&&typeof _0x181242['limit']===_0x9fb9('0x17');var _0x3b8444=_0x25b786[_0x9fb9('0x18')];var _0x5e0705=_0x150807?0x0:_0x181242[_0x9fb9('0x16')];var _0x3e0b35=_0x150807?_0x25b786['count']:_0x181242[_0x9fb9('0x16')]+_0x181242['limit'];var _0x36a2b8;if(_0x3e0b35>=_0x3b8444){_0x3e0b35=_0x3b8444;_0x36a2b8=0xc8;}else{_0x36a2b8=0xce;}_0x42115b[_0x9fb9('0x14')](_0x36a2b8);return _0x42115b['set'](_0x9fb9('0x19'),_0x5e0705+'-'+_0x3e0b35+'/'+_0x3b8444)['json'](_0x25b786);}return null;};}function patchUpdates(_0x344009){return function(_0x30e1eb){try{jsonpatch['apply'](_0x30e1eb,_0x344009,!![]);}catch(_0x3cdd03){return BPromise[_0x9fb9('0x1a')](_0x3cdd03);}return _0x30e1eb[_0x9fb9('0x1b')]();};}function saveUpdates(_0x260af4,_0x3d9790){return function(_0x21b4d0){if(_0x21b4d0){return _0x21b4d0[_0x9fb9('0x1c')](_0x260af4)[_0x9fb9('0x1d')](function(_0x99768f){return _0x99768f;});}return null;};}function removeEntity(_0x53d524,_0x59e1a3){return function(_0x107667){if(_0x107667){return _0x107667[_0x9fb9('0x1e')]()[_0x9fb9('0x1d')](function(){_0x53d524['status'](0xcc)[_0x9fb9('0x13')]();});}};}function handleEntityNotFound(_0x22d25a,_0x240f4d){return function(_0x4039af){if(!_0x4039af){_0x22d25a[_0x9fb9('0x12')](0x194);}return _0x4039af;};}function handleError(_0x5554cd,_0x366c21){_0x366c21=_0x366c21||0x1f4;return function(_0x280b1d){logger[_0x9fb9('0x1f')](_0x280b1d[_0x9fb9('0x20')]);if(_0x280b1d[_0x9fb9('0x21')]){delete _0x280b1d[_0x9fb9('0x21')];}_0x5554cd[_0x9fb9('0x14')](_0x366c21)[_0x9fb9('0x22')](_0x280b1d);};}exports[_0x9fb9('0x23')]=function(_0x373250,_0x332bdf){var _0x10b57c={},_0x626c2a={},_0xfdcb19={'count':0x0,'rows':[]};var _0x1bd976=_[_0x9fb9('0x24')](db[_0x9fb9('0x25')][_0x9fb9('0x26')],function(_0x5212c1){return{'name':_0x5212c1[_0x9fb9('0x27')],'type':_0x5212c1[_0x9fb9('0x28')][_0x9fb9('0x29')]};});_0x626c2a[_0x9fb9('0x2a')]=_['map'](_0x1bd976,'name');_0x626c2a[_0x9fb9('0x2b')]=_['keys'](_0x373250[_0x9fb9('0x2b')]);_0x626c2a[_0x9fb9('0x2c')]=_[_0x9fb9('0x2d')](_0x626c2a[_0x9fb9('0x2a')],_0x626c2a[_0x9fb9('0x2b')]);_0x10b57c['attributes']=_[_0x9fb9('0x2d')](_0x626c2a['model'],qs['fields'](_0x373250['query'][_0x9fb9('0x2e')]));_0x10b57c[_0x9fb9('0x2f')]=_0x10b57c['attributes'][_0x9fb9('0x30')]?_0x10b57c[_0x9fb9('0x2f')]:_0x626c2a[_0x9fb9('0x2a')];if(!_0x373250['query'][_0x9fb9('0x31')](_0x9fb9('0x32'))){_0x10b57c[_0x9fb9('0x33')]=qs[_0x9fb9('0x33')](_0x373250['query'][_0x9fb9('0x33')]);_0x10b57c[_0x9fb9('0x16')]=qs['offset'](_0x373250[_0x9fb9('0x2b')][_0x9fb9('0x16')]);}_0x10b57c[_0x9fb9('0x34')]=qs['sort'](_0x373250['query']['sort']);_0x10b57c[_0x9fb9('0x35')]=qs[_0x9fb9('0x2c')](_[_0x9fb9('0x36')](_0x373250[_0x9fb9('0x2b')],_0x626c2a[_0x9fb9('0x2c')]),_0x1bd976);if(_0x373250[_0x9fb9('0x2b')]['filter']){_0x10b57c[_0x9fb9('0x35')]=_['merge'](_0x10b57c[_0x9fb9('0x35')],{'$or':_[_0x9fb9('0x24')](_0x1bd976,function(_0x270d9c){if(_0x270d9c[_0x9fb9('0x28')]!=='VIRTUAL'){var _0x53b64f={};_0x53b64f[_0x270d9c[_0x9fb9('0x21')]]={'$like':'%'+_0x373250[_0x9fb9('0x2b')]['filter']+'%'};return _0x53b64f;}})});}_0x10b57c=_[_0x9fb9('0x37')]({},_0x10b57c,_0x373250['options']);var _0x2d3038={'where':_0x10b57c[_0x9fb9('0x35')]};return db[_0x9fb9('0x25')]['count'](_0x2d3038)['then'](function(_0x220a9c){_0xfdcb19['count']=_0x220a9c;if(_0x373250[_0x9fb9('0x2b')][_0x9fb9('0x38')]){_0x10b57c[_0x9fb9('0x39')]=[{'all':!![]}];}return db[_0x9fb9('0x25')]['findAll'](_0x10b57c);})['then'](function(_0x2f8a1b){_0xfdcb19[_0x9fb9('0x3a')]=_0x2f8a1b;return _0xfdcb19;})[_0x9fb9('0x1d')](respondWithFilteredResult(_0x332bdf,_0x10b57c))['catch'](handleError(_0x332bdf,null));};exports[_0x9fb9('0x3b')]=function(_0x26d9f5,_0x1820ae){var _0x52455f={'raw':![],'where':{'id':_0x26d9f5['params']['id']}},_0x338e4e={};_0x338e4e[_0x9fb9('0x2a')]=_[_0x9fb9('0x3c')](db[_0x9fb9('0x25')][_0x9fb9('0x26')]);_0x338e4e[_0x9fb9('0x2b')]=_[_0x9fb9('0x3c')](_0x26d9f5['query']);_0x338e4e[_0x9fb9('0x2c')]=_[_0x9fb9('0x2d')](_0x338e4e['model'],_0x338e4e[_0x9fb9('0x2b')]);_0x52455f[_0x9fb9('0x2f')]=_[_0x9fb9('0x2d')](_0x338e4e[_0x9fb9('0x2a')],qs[_0x9fb9('0x2e')](_0x26d9f5[_0x9fb9('0x2b')]['fields']));_0x52455f['attributes']=_0x52455f[_0x9fb9('0x2f')]['length']?_0x52455f[_0x9fb9('0x2f')]:_0x338e4e[_0x9fb9('0x2a')];if(_0x26d9f5[_0x9fb9('0x2b')][_0x9fb9('0x38')]){_0x52455f[_0x9fb9('0x39')]=[{'all':!![]}];}_0x52455f=_[_0x9fb9('0x37')]({},_0x52455f,_0x26d9f5['options']);return db['ServicenowConfiguration'][_0x9fb9('0x3d')](_0x52455f)[_0x9fb9('0x1d')](handleEntityNotFound(_0x1820ae,null))[_0x9fb9('0x1d')](respondWithResult(_0x1820ae,null))[_0x9fb9('0x3e')](handleError(_0x1820ae,null));};exports[_0x9fb9('0x3f')]=function(_0x38cb73,_0x4ab261){return db[_0x9fb9('0x25')][_0x9fb9('0x3f')](_0x38cb73[_0x9fb9('0x40')],{})['then'](respondWithResult(_0x4ab261,0xc9))['catch'](handleError(_0x4ab261,null));};exports['update']=function(_0x2105f4,_0x12bb0c){if(_0x2105f4[_0x9fb9('0x40')]['id']){delete _0x2105f4[_0x9fb9('0x40')]['id'];}return db[_0x9fb9('0x25')][_0x9fb9('0x3d')]({'where':{'id':_0x2105f4['params']['id']}})[_0x9fb9('0x1d')](handleEntityNotFound(_0x12bb0c,null))[_0x9fb9('0x1d')](saveUpdates(_0x2105f4[_0x9fb9('0x40')],null))[_0x9fb9('0x1d')](respondWithResult(_0x12bb0c,null))[_0x9fb9('0x3e')](handleError(_0x12bb0c,null));};exports['destroy']=function(_0x245a4b,_0x5a052c){return db['ServicenowConfiguration'][_0x9fb9('0x3d')]({'where':{'id':_0x245a4b[_0x9fb9('0x41')]['id']}})[_0x9fb9('0x1d')](handleEntityNotFound(_0x5a052c,null))[_0x9fb9('0x1d')](removeEntity(_0x5a052c,null))[_0x9fb9('0x3e')](handleError(_0x5a052c,null));};exports['getFields']=function(_0xeed5cf,_0x27d9d1,_0x815f01){var _0x5a8d34={};var _0x4b93a7={};var _0x4d8ccb;var _0x55a1d0;return db[_0x9fb9('0x25')]['findOne']({'where':{'id':_0xeed5cf['params']['id']}})[_0x9fb9('0x1d')](handleEntityNotFound(_0x27d9d1,null))[_0x9fb9('0x1d')](function(_0x4a5dd7){if(_0x4a5dd7){_0x4d8ccb=_0x4a5dd7;_0x4b93a7['model']=_[_0x9fb9('0x3c')](db[_0x9fb9('0x42')][_0x9fb9('0x26')]);_0x4b93a7[_0x9fb9('0x2b')]=_[_0x9fb9('0x3c')](_0xeed5cf['query']);_0x4b93a7['filters']=_[_0x9fb9('0x2d')](_0x4b93a7[_0x9fb9('0x2a')],_0x4b93a7[_0x9fb9('0x2b')]);_0x5a8d34['attributes']=_['intersection'](_0x4b93a7[_0x9fb9('0x2a')],qs['fields'](_0xeed5cf[_0x9fb9('0x2b')]['fields']));_0x5a8d34[_0x9fb9('0x2f')]=_0x5a8d34['attributes'][_0x9fb9('0x30')]?_0x5a8d34[_0x9fb9('0x2f')]:_0x4b93a7[_0x9fb9('0x2a')];_0x5a8d34[_0x9fb9('0x34')]=qs['sort'](_0xeed5cf[_0x9fb9('0x2b')][_0x9fb9('0x43')]);_0x5a8d34[_0x9fb9('0x35')]=qs[_0x9fb9('0x2c')](_[_0x9fb9('0x36')](_0xeed5cf[_0x9fb9('0x2b')],_0x4b93a7['filters']));if(_0xeed5cf[_0x9fb9('0x2b')][_0x9fb9('0x44')]){_0x5a8d34['where']=_[_0x9fb9('0x37')](_0x5a8d34[_0x9fb9('0x35')],{'$or':_[_0x9fb9('0x24')](_0x5a8d34['attributes'],function(_0x5aa0de){var _0x455c42={};_0x455c42[_0x5aa0de]={'$like':'%'+_0xeed5cf[_0x9fb9('0x2b')]['filter']+'%'};return _0x455c42;})});}_0x5a8d34=_[_0x9fb9('0x37')]({},_0x5a8d34,_0xeed5cf[_0x9fb9('0x45')]);return _0x4d8ccb[_0x9fb9('0x46')](_0x5a8d34);}})[_0x9fb9('0x1d')](function(_0x5513a2){if(_0x5513a2){_0x55a1d0=_0x5513a2[_0x9fb9('0x30')];if(!_0xeed5cf['query'][_0x9fb9('0x31')](_0x9fb9('0x32'))){_0x5a8d34[_0x9fb9('0x33')]=qs[_0x9fb9('0x33')](_0xeed5cf[_0x9fb9('0x2b')][_0x9fb9('0x33')]);_0x5a8d34[_0x9fb9('0x16')]=qs[_0x9fb9('0x16')](_0xeed5cf[_0x9fb9('0x2b')][_0x9fb9('0x16')]);}return _0x4d8ccb[_0x9fb9('0x46')](_0x5a8d34);}})[_0x9fb9('0x1d')](function(_0x4a6282){if(_0x4a6282){return _0x4a6282?{'count':_0x55a1d0,'rows':_0x4a6282}:null;}})['then'](respondWithResult(_0x27d9d1,null))[_0x9fb9('0x3e')](handleError(_0x27d9d1,null));};exports[_0x9fb9('0x47')]=function(_0x3dfdb3,_0x3a69c3,_0x2ba4a5){var _0x17fe35={};var _0x58beca={};var _0x5becf1;var _0x1ba772;return db[_0x9fb9('0x25')][_0x9fb9('0x48')]({'where':{'id':_0x3dfdb3[_0x9fb9('0x41')]['id']}})['then'](handleEntityNotFound(_0x3a69c3,null))['then'](function(_0x4263e8){if(_0x4263e8){_0x5becf1=_0x4263e8;_0x58beca[_0x9fb9('0x2a')]=_[_0x9fb9('0x3c')](db[_0x9fb9('0x42')][_0x9fb9('0x26')]);_0x58beca[_0x9fb9('0x2b')]=_['keys'](_0x3dfdb3[_0x9fb9('0x2b')]);_0x58beca[_0x9fb9('0x2c')]=_[_0x9fb9('0x2d')](_0x58beca[_0x9fb9('0x2a')],_0x58beca[_0x9fb9('0x2b')]);_0x17fe35[_0x9fb9('0x2f')]=_[_0x9fb9('0x2d')](_0x58beca[_0x9fb9('0x2a')],qs[_0x9fb9('0x2e')](_0x3dfdb3['query']['fields']));_0x17fe35['attributes']=_0x17fe35['attributes']['length']?_0x17fe35[_0x9fb9('0x2f')]:_0x58beca[_0x9fb9('0x2a')];_0x17fe35[_0x9fb9('0x34')]=qs[_0x9fb9('0x43')](_0x3dfdb3['query'][_0x9fb9('0x43')]);_0x17fe35['where']=qs['filters'](_[_0x9fb9('0x36')](_0x3dfdb3[_0x9fb9('0x2b')],_0x58beca[_0x9fb9('0x2c')]));if(_0x3dfdb3[_0x9fb9('0x2b')]['filter']){_0x17fe35[_0x9fb9('0x35')]=_['merge'](_0x17fe35[_0x9fb9('0x35')],{'$or':_[_0x9fb9('0x24')](_0x17fe35['attributes'],function(_0x4fd2ce){var _0x674feb={};_0x674feb[_0x4fd2ce]={'$like':'%'+_0x3dfdb3[_0x9fb9('0x2b')]['filter']+'%'};return _0x674feb;})});}_0x17fe35=_['merge']({},_0x17fe35,_0x3dfdb3[_0x9fb9('0x45')]);return _0x5becf1['getSubjects'](_0x17fe35);}})[_0x9fb9('0x1d')](function(_0x45f7cc){if(_0x45f7cc){_0x1ba772=_0x45f7cc[_0x9fb9('0x30')];if(!_0x3dfdb3['query']['hasOwnProperty'](_0x9fb9('0x32'))){_0x17fe35[_0x9fb9('0x33')]=qs[_0x9fb9('0x33')](_0x3dfdb3[_0x9fb9('0x2b')][_0x9fb9('0x33')]);_0x17fe35[_0x9fb9('0x16')]=qs['offset'](_0x3dfdb3[_0x9fb9('0x2b')][_0x9fb9('0x16')]);}return _0x5becf1[_0x9fb9('0x47')](_0x17fe35);}})['then'](function(_0x2e63d7){if(_0x2e63d7){return _0x2e63d7?{'count':_0x1ba772,'rows':_0x2e63d7}:null;}})[_0x9fb9('0x1d')](respondWithResult(_0x3a69c3,null))['catch'](handleError(_0x3a69c3,null));};exports[_0x9fb9('0x49')]=function(_0x3db9a4,_0x1c4dd9,_0x2e5d2a){var _0x35fca5={};var _0x390249={};var _0x1cf8d0;var _0x29934c;return db[_0x9fb9('0x25')][_0x9fb9('0x48')]({'where':{'id':_0x3db9a4['params']['id']}})['then'](handleEntityNotFound(_0x1c4dd9,null))[_0x9fb9('0x1d')](function(_0xef2dad){if(_0xef2dad){_0x1cf8d0=_0xef2dad;_0x390249[_0x9fb9('0x2a')]=_[_0x9fb9('0x3c')](db['ServicenowField'][_0x9fb9('0x26')]);_0x390249[_0x9fb9('0x2b')]=_[_0x9fb9('0x3c')](_0x3db9a4[_0x9fb9('0x2b')]);_0x390249[_0x9fb9('0x2c')]=_['intersection'](_0x390249[_0x9fb9('0x2a')],_0x390249[_0x9fb9('0x2b')]);_0x35fca5[_0x9fb9('0x2f')]=_['intersection'](_0x390249[_0x9fb9('0x2a')],qs['fields'](_0x3db9a4['query'][_0x9fb9('0x2e')]));_0x35fca5[_0x9fb9('0x2f')]=_0x35fca5[_0x9fb9('0x2f')][_0x9fb9('0x30')]?_0x35fca5['attributes']:_0x390249[_0x9fb9('0x2a')];_0x35fca5[_0x9fb9('0x34')]=qs['sort'](_0x3db9a4[_0x9fb9('0x2b')][_0x9fb9('0x43')]);_0x35fca5[_0x9fb9('0x35')]=qs[_0x9fb9('0x2c')](_[_0x9fb9('0x36')](_0x3db9a4[_0x9fb9('0x2b')],_0x390249[_0x9fb9('0x2c')]));if(_0x3db9a4[_0x9fb9('0x2b')]['filter']){_0x35fca5['where']=_['merge'](_0x35fca5[_0x9fb9('0x35')],{'$or':_[_0x9fb9('0x24')](_0x35fca5[_0x9fb9('0x2f')],function(_0x38bd9c){var _0x2a0542={};_0x2a0542[_0x38bd9c]={'$like':'%'+_0x3db9a4[_0x9fb9('0x2b')][_0x9fb9('0x44')]+'%'};return _0x2a0542;})});}_0x35fca5=_[_0x9fb9('0x37')]({},_0x35fca5,_0x3db9a4[_0x9fb9('0x45')]);return _0x1cf8d0['getDescriptions'](_0x35fca5);}})[_0x9fb9('0x1d')](function(_0x14adf7){if(_0x14adf7){_0x29934c=_0x14adf7['length'];if(!_0x3db9a4['query'][_0x9fb9('0x31')](_0x9fb9('0x32'))){_0x35fca5[_0x9fb9('0x33')]=qs[_0x9fb9('0x33')](_0x3db9a4['query']['limit']);_0x35fca5[_0x9fb9('0x16')]=qs['offset'](_0x3db9a4[_0x9fb9('0x2b')][_0x9fb9('0x16')]);}return _0x1cf8d0['getDescriptions'](_0x35fca5);}})[_0x9fb9('0x1d')](function(_0xee3578){if(_0xee3578){return _0xee3578?{'count':_0x29934c,'rows':_0xee3578}:null;}})[_0x9fb9('0x1d')](respondWithResult(_0x1c4dd9,null))[_0x9fb9('0x3e')](handleError(_0x1c4dd9,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 472d044..93e4076 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 _0x7708=['../../config/environment','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','api','rimraf'];(function(_0xcade3c,_0x1101c4){var _0x504f07=function(_0x2039d3){while(--_0x2039d3){_0xcade3c['push'](_0xcade3c['shift']());}};_0x504f07(++_0x1101c4);}(_0x7708,0x188));var _0x8770=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x7708[_0x92c450];return _0x2a9599;};'use strict';var _=require(_0x8770('0x0'));var util=require(_0x8770('0x1'));var logger=require('../../config/logger')(_0x8770('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(_0x8770('0x3'));var config=require(_0x8770('0x4'));var attributes=require('./intServicenowConfiguration.attributes');module[_0x8770('0x5')]=function(_0x50bab7,_0x31390d){return _0x50bab7[_0x8770('0x6')](_0x8770('0x7'),attributes,{'tableName':_0x8770('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa45b=['../../config/logger','request-promise','path','rimraf','../../config/environment','exports','define','ServicenowConfiguration','int_servicenow_configurations','util'];(function(_0x2b6cd4,_0x3052c0){var _0x50784f=function(_0xdb031f){while(--_0xdb031f){_0x2b6cd4['push'](_0x2b6cd4['shift']());}};_0x50784f(++_0x3052c0);}(_0xa45b,0x199));var _0xba45=function(_0x50045c,_0x5cf17b){_0x50045c=_0x50045c-0x0;var _0x57f956=_0xa45b[_0x50045c];return _0x57f956;};'use strict';var _=require('lodash');var util=require(_0xba45('0x0'));var logger=require(_0xba45('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xba45('0x2'));var fs=require('fs');var path=require(_0xba45('0x3'));var rimraf=require(_0xba45('0x4'));var config=require(_0xba45('0x5'));var attributes=require('./intServicenowConfiguration.attributes');module[_0xba45('0x6')]=function(_0x14ee6c,_0x330e53){return _0x14ee6c[_0xba45('0x7')](_0xba45('0x8'),attributes,{'tableName':_0xba45('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 26598e3..90e3ec6 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 _0x677e=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message'];(function(_0x1766a9,_0x4285b4){var _0x59ae69=function(_0x4f668d){while(--_0x4f668d){_0x1766a9['push'](_0x1766a9['shift']());}};_0x59ae69(++_0x4285b4);}(_0x677e,0x7a));var _0xe677=function(_0x4fecb6,_0x45ed64){_0x4fecb6=_0x4fecb6-0x0;var _0xa9a47=_0x677e[_0x4fecb6];return _0xa9a47;};'use strict';var _=require(_0xe677('0x0'));var util=require(_0xe677('0x1'));var moment=require(_0xe677('0x2'));var BPromise=require(_0xe677('0x3'));var rs=require(_0xe677('0x4'));var fs=require('fs');var Redis=require(_0xe677('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe677('0x6'));var logger=require(_0xe677('0x7'))(_0xe677('0x8'));var config=require('../../config/environment');var jayson=require(_0xe677('0x9'));var client=jayson[_0xe677('0xa')][_0xe677('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5239bf,_0x3fb9d3,_0x19153e){return new BPromise(function(_0x23da2b,_0x598795){return client['request'](_0x5239bf,_0x19153e)[_0xe677('0xc')](function(_0x42a067){logger[_0xe677('0xd')](_0xe677('0xe'),_0x3fb9d3,'request\x20sent');logger[_0xe677('0xf')](_0xe677('0x10'),_0x3fb9d3,_0xe677('0x11'),JSON[_0xe677('0x12')](_0x42a067));if(_0x42a067['error']){if(_0x42a067['error'][_0xe677('0x13')]===0x1f4){logger[_0xe677('0x14')](_0xe677('0xe'),_0x3fb9d3,_0x42a067[_0xe677('0x14')][_0xe677('0x15')]);return _0x598795(_0x42a067[_0xe677('0x14')][_0xe677('0x15')]);}logger[_0xe677('0x14')](_0xe677('0xe'),_0x3fb9d3,_0x42a067[_0xe677('0x14')][_0xe677('0x15')]);return _0x23da2b(_0x42a067[_0xe677('0x14')][_0xe677('0x15')]);}else{logger[_0xe677('0xd')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3fb9d3,_0xe677('0x11'));_0x23da2b(_0x42a067[_0xe677('0x16')][_0xe677('0x15')]);}})[_0xe677('0x17')](function(_0x1618d3){logger[_0xe677('0x14')](_0xe677('0xe'),_0x3fb9d3,_0x1618d3);_0x598795(_0x1618d3);});});} \ No newline at end of file +var _0x855e=['rpc','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0xc78d91,_0x56f506){var _0xe3c019=function(_0x1cc61e){while(--_0x1cc61e){_0xc78d91['push'](_0xc78d91['shift']());}};_0xe3c019(++_0x56f506);}(_0x855e,0x1f2));var _0xe855=function(_0x28e24b,_0x3a39a1){_0x28e24b=_0x28e24b-0x0;var _0x408dc7=_0x855e[_0x28e24b];return _0x408dc7;};'use strict';var _=require(_0xe855('0x0'));var util=require(_0xe855('0x1'));var moment=require(_0xe855('0x2'));var BPromise=require(_0xe855('0x3'));var rs=require(_0xe855('0x4'));var fs=require('fs');var Redis=require(_0xe855('0x5'));var db=require(_0xe855('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe855('0x7'))(_0xe855('0x8'));var config=require('../../config/environment');var jayson=require(_0xe855('0x9'));var client=jayson[_0xe855('0xa')][_0xe855('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x12e649,_0x3a4782,_0x259097){return new BPromise(function(_0x23cfb3,_0x3f1437){return client[_0xe855('0xc')](_0x12e649,_0x259097)[_0xe855('0xd')](function(_0x481620){logger[_0xe855('0xe')](_0xe855('0xf'),_0x3a4782,_0xe855('0x10'));logger[_0xe855('0x11')](_0xe855('0x12'),_0x3a4782,_0xe855('0x10'),JSON['stringify'](_0x481620));if(_0x481620[_0xe855('0x13')]){if(_0x481620[_0xe855('0x13')][_0xe855('0x14')]===0x1f4){logger[_0xe855('0x13')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3a4782,_0x481620[_0xe855('0x13')][_0xe855('0x15')]);return _0x3f1437(_0x481620['error'][_0xe855('0x15')]);}logger[_0xe855('0x13')](_0xe855('0xf'),_0x3a4782,_0x481620['error'][_0xe855('0x15')]);return _0x23cfb3(_0x481620['error'][_0xe855('0x15')]);}else{logger[_0xe855('0xe')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3a4782,'request\x20sent');_0x23cfb3(_0x481620[_0xe855('0x16')][_0xe855('0x15')]);}})['catch'](function(_0x7522be){logger[_0xe855('0x13')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3a4782,_0x7522be);_0x3f1437(_0x7522be);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 8bd738a..4d570dd 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 _0x1110=['./intServicenowField.controller','get','isAuthenticated','index','show','create','put','/:id','update','delete','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x1110,0x9b));var _0x0111=function(_0x16fa8d,_0x3a1ca5){_0x16fa8d=_0x16fa8d-0x0;var _0x1948d8=_0x1110[_0x16fa8d];return _0x1948d8;};'use strict';var multer=require('multer');var util=require(_0x0111('0x0'));var path=require(_0x0111('0x1'));var timeout=require('connect-timeout');var express=require(_0x0111('0x2'));var router=express['Router']();var fs_extra=require(_0x0111('0x3'));var auth=require(_0x0111('0x4'));var interaction=require(_0x0111('0x5'));var config=require(_0x0111('0x6'));var controller=require(_0x0111('0x7'));router[_0x0111('0x8')]('/',auth[_0x0111('0x9')](),controller[_0x0111('0xa')]);router['get']('/:id',auth[_0x0111('0x9')](),controller[_0x0111('0xb')]);router['post']('/',auth[_0x0111('0x9')](),controller[_0x0111('0xc')]);router[_0x0111('0xd')](_0x0111('0xe'),auth[_0x0111('0x9')](),controller[_0x0111('0xf')]);router[_0x0111('0x10')](_0x0111('0xe'),auth[_0x0111('0x9')](),controller['destroy']);module[_0x0111('0x11')]=router; \ No newline at end of file +var _0x02fc=['delete','destroy','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','post','/:id'];(function(_0x3055a3,_0x5b79a6){var _0x3801ac=function(_0x2ce9fd){while(--_0x2ce9fd){_0x3055a3['push'](_0x3055a3['shift']());}};_0x3801ac(++_0x5b79a6);}(_0x02fc,0x6a));var _0xc02f=function(_0xf36f8f,_0x1f32bd){_0xf36f8f=_0xf36f8f-0x0;var _0x35c2c7=_0x02fc[_0xf36f8f];return _0x35c2c7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc02f('0x0'));var timeout=require(_0xc02f('0x1'));var express=require(_0xc02f('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc02f('0x3'));var interaction=require(_0xc02f('0x4'));var config=require(_0xc02f('0x5'));var controller=require(_0xc02f('0x6'));router[_0xc02f('0x7')]('/',auth[_0xc02f('0x8')](),controller['index']);router[_0xc02f('0x7')]('/:id',auth[_0xc02f('0x8')](),controller['show']);router[_0xc02f('0x9')]('/',auth[_0xc02f('0x8')](),controller['create']);router['put'](_0xc02f('0xa'),auth[_0xc02f('0x8')](),controller['update']);router[_0xc02f('0xb')](_0xc02f('0xa'),auth[_0xc02f('0x8')](),controller[_0xc02f('0xc')]);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 652905d..a0a2d5b 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 _0xdde6=['exports','ENUM','customVariable','keyValue','STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdde6,0x9b));var _0x6dde=function(_0x11e1a3,_0x1ed068){_0x11e1a3=_0x11e1a3-0x0;var _0xd757a8=_0xdde6[_0x11e1a3];return _0xd757a8;};'use strict';var Sequelize=require(_0x6dde('0x0'));module[_0x6dde('0x1')]={'type':{'type':Sequelize[_0x6dde('0x2')]('string','variable',_0x6dde('0x3'),_0x6dde('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x6dde('0x5')]},'keyType':{'type':Sequelize[_0x6dde('0x2')]('string','variable',_0x6dde('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x6dde('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x339f=['customVariable','keyValue','STRING','ENUM','BOOLEAN','sequelize','exports','string','variable'];(function(_0x41ccbb,_0x3771e8){var _0x519c61=function(_0x4724a6){while(--_0x4724a6){_0x41ccbb['push'](_0x41ccbb['shift']());}};_0x519c61(++_0x3771e8);}(_0x339f,0x176));var _0xf339=function(_0x5549a5,_0x135bf1){_0x5549a5=_0x5549a5-0x0;var _0x3efdd3=_0x339f[_0x5549a5];return _0x3efdd3;};'use strict';var Sequelize=require(_0xf339('0x0'));module[_0xf339('0x1')]={'type':{'type':Sequelize['ENUM'](_0xf339('0x2'),_0xf339('0x3'),_0xf339('0x4'),_0xf339('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xf339('0x6')]},'key':{'type':Sequelize[_0xf339('0x6')]},'keyType':{'type':Sequelize[_0xf339('0x7')]('string',_0xf339('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xf339('0x6')]},'nameField':{'type':Sequelize[_0xf339('0x6')]},'customField':{'type':Sequelize[_0xf339('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf339('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 4016490..3afb7e8 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 _0xa185=['params','include','find','catch','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','reject','save','then','destroy','stack','name','send','index','map','rawAttributes','key','model','keys','query','intersection','attributes','fields','length','nolimit','order','where','filters','filter','merge','type','options','ServicenowField','includeAll','findAll'];(function(_0xe92be7,_0x402fa8){var _0x5c1e71=function(_0x4cd154){while(--_0x4cd154){_0xe92be7['push'](_0xe92be7['shift']());}};_0x5c1e71(++_0x402fa8);}(_0xa185,0x19f));var _0x5a18=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xa185[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0x5a18('0x0'));var rimraf=require(_0x5a18('0x1'));var zipdir=require(_0x5a18('0x2'));var jsonpatch=require(_0x5a18('0x3'));var rp=require(_0x5a18('0x4'));var moment=require(_0x5a18('0x5'));var BPromise=require(_0x5a18('0x6'));var Mustache=require(_0x5a18('0x7'));var util=require(_0x5a18('0x8'));var path=require(_0x5a18('0x9'));var sox=require(_0x5a18('0xa'));var csv=require(_0x5a18('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5a18('0xc'));var squel=require(_0x5a18('0xd'));var crypto=require(_0x5a18('0xe'));var jsforce=require(_0x5a18('0xf'));var deskjs=require(_0x5a18('0x10'));var toCsv=require(_0x5a18('0xb'));var querystring=require(_0x5a18('0x11'));var Papa=require(_0x5a18('0x12'));var Redis=require(_0x5a18('0x13'));var authService=require(_0x5a18('0x14'));var qs=require(_0x5a18('0x15'));var as=require(_0x5a18('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x5a18('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5a18('0x18'))['db'];function respondWithStatusCode(_0x1f9eb0,_0x2016aa){_0x2016aa=_0x2016aa||0xcc;return function(_0xdecf0b){if(_0xdecf0b){return _0x1f9eb0[_0x5a18('0x19')](_0x2016aa);}return _0x1f9eb0[_0x5a18('0x1a')](_0x2016aa)[_0x5a18('0x1b')]();};}function respondWithResult(_0x5f09df,_0x18d5ac){_0x18d5ac=_0x18d5ac||0xc8;return function(_0x3246dd){if(_0x3246dd){return _0x5f09df[_0x5a18('0x1a')](_0x18d5ac)['json'](_0x3246dd);}};}function respondWithFilteredResult(_0x3c4015,_0x35489b){return function(_0x45b97e){if(_0x45b97e){var _0x23a68e=typeof _0x35489b[_0x5a18('0x1c')]===_0x5a18('0x1d')&&typeof _0x35489b[_0x5a18('0x1e')]===_0x5a18('0x1d');var _0x553521=_0x45b97e[_0x5a18('0x1f')];var _0x2d097e=_0x23a68e?0x0:_0x35489b[_0x5a18('0x1c')];var _0x27791e=_0x23a68e?_0x45b97e[_0x5a18('0x1f')]:_0x35489b[_0x5a18('0x1c')]+_0x35489b[_0x5a18('0x1e')];var _0x339f97;if(_0x27791e>=_0x553521){_0x27791e=_0x553521;_0x339f97=0xc8;}else{_0x339f97=0xce;}_0x3c4015[_0x5a18('0x1a')](_0x339f97);return _0x3c4015['set']('Content-Range',_0x2d097e+'-'+_0x27791e+'/'+_0x553521)['json'](_0x45b97e);}return null;};}function patchUpdates(_0x2698c8){return function(_0x3820b3){try{jsonpatch['apply'](_0x3820b3,_0x2698c8,!![]);}catch(_0x2332bf){return BPromise[_0x5a18('0x20')](_0x2332bf);}return _0x3820b3[_0x5a18('0x21')]();};}function saveUpdates(_0x1f15ad,_0x2a343f){return function(_0x3362a7){if(_0x3362a7){return _0x3362a7['update'](_0x1f15ad)[_0x5a18('0x22')](function(_0x237cac){return _0x237cac;});}return null;};}function removeEntity(_0x5e3a7b,_0xd66d77){return function(_0x7c5b11){if(_0x7c5b11){return _0x7c5b11[_0x5a18('0x23')]()[_0x5a18('0x22')](function(){_0x5e3a7b[_0x5a18('0x1a')](0xcc)[_0x5a18('0x1b')]();});}};}function handleEntityNotFound(_0x4a1f99,_0x2e6585){return function(_0x4b476f){if(!_0x4b476f){_0x4a1f99[_0x5a18('0x19')](0x194);}return _0x4b476f;};}function handleError(_0x2091c5,_0x293223){_0x293223=_0x293223||0x1f4;return function(_0x3bd9a0){logger['error'](_0x3bd9a0[_0x5a18('0x24')]);if(_0x3bd9a0[_0x5a18('0x25')]){delete _0x3bd9a0[_0x5a18('0x25')];}_0x2091c5['status'](_0x293223)[_0x5a18('0x26')](_0x3bd9a0);};}exports[_0x5a18('0x27')]=function(_0x2d0403,_0x688c11){var _0x1d007c={},_0x1e35ba={},_0x55d9d1={'count':0x0,'rows':[]};var _0x5715b4=_[_0x5a18('0x28')](db['ServicenowField'][_0x5a18('0x29')],function(_0x4441dc){return{'name':_0x4441dc['fieldName'],'type':_0x4441dc['type'][_0x5a18('0x2a')]};});_0x1e35ba[_0x5a18('0x2b')]=_[_0x5a18('0x28')](_0x5715b4,_0x5a18('0x25'));_0x1e35ba['query']=_[_0x5a18('0x2c')](_0x2d0403[_0x5a18('0x2d')]);_0x1e35ba['filters']=_[_0x5a18('0x2e')](_0x1e35ba['model'],_0x1e35ba[_0x5a18('0x2d')]);_0x1d007c[_0x5a18('0x2f')]=_['intersection'](_0x1e35ba['model'],qs[_0x5a18('0x30')](_0x2d0403[_0x5a18('0x2d')]['fields']));_0x1d007c[_0x5a18('0x2f')]=_0x1d007c[_0x5a18('0x2f')][_0x5a18('0x31')]?_0x1d007c[_0x5a18('0x2f')]:_0x1e35ba['model'];if(!_0x2d0403[_0x5a18('0x2d')]['hasOwnProperty'](_0x5a18('0x32'))){_0x1d007c[_0x5a18('0x1e')]=qs[_0x5a18('0x1e')](_0x2d0403[_0x5a18('0x2d')][_0x5a18('0x1e')]);_0x1d007c[_0x5a18('0x1c')]=qs['offset'](_0x2d0403[_0x5a18('0x2d')][_0x5a18('0x1c')]);}_0x1d007c[_0x5a18('0x33')]=qs['sort'](_0x2d0403[_0x5a18('0x2d')]['sort']);_0x1d007c[_0x5a18('0x34')]=qs[_0x5a18('0x35')](_['pick'](_0x2d0403[_0x5a18('0x2d')],_0x1e35ba[_0x5a18('0x35')]),_0x5715b4);if(_0x2d0403['query'][_0x5a18('0x36')]){_0x1d007c[_0x5a18('0x34')]=_[_0x5a18('0x37')](_0x1d007c[_0x5a18('0x34')],{'$or':_[_0x5a18('0x28')](_0x5715b4,function(_0x5e073b){if(_0x5e073b[_0x5a18('0x38')]!=='VIRTUAL'){var _0xca6eb={};_0xca6eb[_0x5e073b[_0x5a18('0x25')]]={'$like':'%'+_0x2d0403[_0x5a18('0x2d')][_0x5a18('0x36')]+'%'};return _0xca6eb;}})});}_0x1d007c=_[_0x5a18('0x37')]({},_0x1d007c,_0x2d0403[_0x5a18('0x39')]);var _0x5f472e={'where':_0x1d007c['where']};return db[_0x5a18('0x3a')][_0x5a18('0x1f')](_0x5f472e)[_0x5a18('0x22')](function(_0x3165bc){_0x55d9d1[_0x5a18('0x1f')]=_0x3165bc;if(_0x2d0403[_0x5a18('0x2d')][_0x5a18('0x3b')]){_0x1d007c['include']=[{'all':!![]}];}return db[_0x5a18('0x3a')][_0x5a18('0x3c')](_0x1d007c);})[_0x5a18('0x22')](function(_0x4cccd6){_0x55d9d1['rows']=_0x4cccd6;return _0x55d9d1;})[_0x5a18('0x22')](respondWithFilteredResult(_0x688c11,_0x1d007c))['catch'](handleError(_0x688c11,null));};exports['show']=function(_0x45cf90,_0x3f8c35){var _0x2588e5={'raw':!![],'where':{'id':_0x45cf90[_0x5a18('0x3d')]['id']}},_0x5123dd={};_0x5123dd[_0x5a18('0x2b')]=_['keys'](db[_0x5a18('0x3a')][_0x5a18('0x29')]);_0x5123dd['query']=_[_0x5a18('0x2c')](_0x45cf90['query']);_0x5123dd[_0x5a18('0x35')]=_[_0x5a18('0x2e')](_0x5123dd['model'],_0x5123dd[_0x5a18('0x2d')]);_0x2588e5[_0x5a18('0x2f')]=_['intersection'](_0x5123dd[_0x5a18('0x2b')],qs[_0x5a18('0x30')](_0x45cf90[_0x5a18('0x2d')][_0x5a18('0x30')]));_0x2588e5['attributes']=_0x2588e5[_0x5a18('0x2f')]['length']?_0x2588e5[_0x5a18('0x2f')]:_0x5123dd[_0x5a18('0x2b')];if(_0x45cf90[_0x5a18('0x2d')]['includeAll']){_0x2588e5[_0x5a18('0x3e')]=[{'all':!![]}];}_0x2588e5=_[_0x5a18('0x37')]({},_0x2588e5,_0x45cf90[_0x5a18('0x39')]);return db[_0x5a18('0x3a')][_0x5a18('0x3f')](_0x2588e5)['then'](handleEntityNotFound(_0x3f8c35,null))['then'](respondWithResult(_0x3f8c35,null))[_0x5a18('0x40')](handleError(_0x3f8c35,null));};exports[_0x5a18('0x41')]=function(_0x105e22,_0x433b5a){return db[_0x5a18('0x3a')][_0x5a18('0x41')](_0x105e22[_0x5a18('0x42')],{})['then'](respondWithResult(_0x433b5a,0xc9))[_0x5a18('0x40')](handleError(_0x433b5a,null));};exports[_0x5a18('0x43')]=function(_0x13f56a,_0x2cd040){if(_0x13f56a[_0x5a18('0x42')]['id']){delete _0x13f56a[_0x5a18('0x42')]['id'];}return db['ServicenowField'][_0x5a18('0x3f')]({'where':{'id':_0x13f56a[_0x5a18('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2cd040,null))[_0x5a18('0x22')](saveUpdates(_0x13f56a[_0x5a18('0x42')],null))[_0x5a18('0x22')](respondWithResult(_0x2cd040,null))[_0x5a18('0x40')](handleError(_0x2cd040,null));};exports[_0x5a18('0x23')]=function(_0x435439,_0x25a682){return db[_0x5a18('0x3a')][_0x5a18('0x3f')]({'where':{'id':_0x435439[_0x5a18('0x3d')]['id']}})[_0x5a18('0x22')](handleEntityNotFound(_0x25a682,null))[_0x5a18('0x22')](removeEntity(_0x25a682,null))[_0x5a18('0x40')](handleError(_0x25a682,null));}; \ No newline at end of file +var _0xa457=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','ServicenowField','findAll','catch','show','params','length','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xa457,0x1b1));var _0x7a45=function(_0x2ede8d,_0x584c77){_0x2ede8d=_0x2ede8d-0x0;var _0x291827=_0xa457[_0x2ede8d];return _0x291827;};'use strict';var emlformat=require(_0x7a45('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7a45('0x1'));var jsonpatch=require(_0x7a45('0x2'));var rp=require(_0x7a45('0x3'));var moment=require(_0x7a45('0x4'));var BPromise=require(_0x7a45('0x5'));var Mustache=require(_0x7a45('0x6'));var util=require('util');var path=require(_0x7a45('0x7'));var sox=require(_0x7a45('0x8'));var csv=require(_0x7a45('0x9'));var ejs=require(_0x7a45('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7a45('0xb'));var squel=require(_0x7a45('0xc'));var crypto=require(_0x7a45('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7a45('0xe'));var toCsv=require(_0x7a45('0x9'));var querystring=require(_0x7a45('0xf'));var Papa=require(_0x7a45('0x10'));var Redis=require(_0x7a45('0x11'));var authService=require(_0x7a45('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7a45('0x13'));var hardwareService=require(_0x7a45('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x7a45('0x15'));var config=require(_0x7a45('0x16'));var licenseUtil=require(_0x7a45('0x17'));var db=require(_0x7a45('0x18'))['db'];function respondWithStatusCode(_0x4eea4e,_0x5867d9){_0x5867d9=_0x5867d9||0xcc;return function(_0x59974a){if(_0x59974a){return _0x4eea4e[_0x7a45('0x19')](_0x5867d9);}return _0x4eea4e[_0x7a45('0x1a')](_0x5867d9)[_0x7a45('0x1b')]();};}function respondWithResult(_0x2f948f,_0x516ef3){_0x516ef3=_0x516ef3||0xc8;return function(_0x595967){if(_0x595967){return _0x2f948f['status'](_0x516ef3)[_0x7a45('0x1c')](_0x595967);}};}function respondWithFilteredResult(_0x1a20fd,_0x2cd724){return function(_0x20b63a){if(_0x20b63a){var _0x4f05a0=typeof _0x2cd724[_0x7a45('0x1d')]===_0x7a45('0x1e')&&typeof _0x2cd724[_0x7a45('0x1f')]===_0x7a45('0x1e');var _0x1dcff9=_0x20b63a['count'];var _0x1416ac=_0x4f05a0?0x0:_0x2cd724[_0x7a45('0x1d')];var _0x26e430=_0x4f05a0?_0x20b63a[_0x7a45('0x20')]:_0x2cd724[_0x7a45('0x1d')]+_0x2cd724[_0x7a45('0x1f')];var _0x2aaa9d;if(_0x26e430>=_0x1dcff9){_0x26e430=_0x1dcff9;_0x2aaa9d=0xc8;}else{_0x2aaa9d=0xce;}_0x1a20fd[_0x7a45('0x1a')](_0x2aaa9d);return _0x1a20fd[_0x7a45('0x21')]('Content-Range',_0x1416ac+'-'+_0x26e430+'/'+_0x1dcff9)['json'](_0x20b63a);}return null;};}function patchUpdates(_0x149b65){return function(_0x2a8545){try{jsonpatch[_0x7a45('0x22')](_0x2a8545,_0x149b65,!![]);}catch(_0x474fd7){return BPromise[_0x7a45('0x23')](_0x474fd7);}return _0x2a8545[_0x7a45('0x24')]();};}function saveUpdates(_0x51f120,_0x4a65ff){return function(_0x338b8e){if(_0x338b8e){return _0x338b8e[_0x7a45('0x25')](_0x51f120)['then'](function(_0x1fa8a1){return _0x1fa8a1;});}return null;};}function removeEntity(_0x354959,_0x4294a4){return function(_0x448d93){if(_0x448d93){return _0x448d93[_0x7a45('0x26')]()[_0x7a45('0x27')](function(){_0x354959[_0x7a45('0x1a')](0xcc)[_0x7a45('0x1b')]();});}};}function handleEntityNotFound(_0x2401f7,_0x19a1df){return function(_0x11862a){if(!_0x11862a){_0x2401f7[_0x7a45('0x19')](0x194);}return _0x11862a;};}function handleError(_0x30bb5a,_0x4964cf){_0x4964cf=_0x4964cf||0x1f4;return function(_0x181228){logger[_0x7a45('0x28')](_0x181228[_0x7a45('0x29')]);if(_0x181228[_0x7a45('0x2a')]){delete _0x181228[_0x7a45('0x2a')];}_0x30bb5a[_0x7a45('0x1a')](_0x4964cf)[_0x7a45('0x2b')](_0x181228);};}exports[_0x7a45('0x2c')]=function(_0x213215,_0x2f23f1){var _0x50f904={},_0x41b137={},_0x5478f7={'count':0x0,'rows':[]};var _0x6ef67a=_[_0x7a45('0x2d')](db['ServicenowField'][_0x7a45('0x2e')],function(_0x30faba){return{'name':_0x30faba[_0x7a45('0x2f')],'type':_0x30faba[_0x7a45('0x30')]['key']};});_0x41b137[_0x7a45('0x31')]=_['map'](_0x6ef67a,_0x7a45('0x2a'));_0x41b137[_0x7a45('0x32')]=_[_0x7a45('0x33')](_0x213215[_0x7a45('0x32')]);_0x41b137[_0x7a45('0x34')]=_[_0x7a45('0x35')](_0x41b137[_0x7a45('0x31')],_0x41b137[_0x7a45('0x32')]);_0x50f904[_0x7a45('0x36')]=_[_0x7a45('0x35')](_0x41b137[_0x7a45('0x31')],qs[_0x7a45('0x37')](_0x213215[_0x7a45('0x32')][_0x7a45('0x37')]));_0x50f904[_0x7a45('0x36')]=_0x50f904[_0x7a45('0x36')]['length']?_0x50f904['attributes']:_0x41b137[_0x7a45('0x31')];if(!_0x213215[_0x7a45('0x32')][_0x7a45('0x38')](_0x7a45('0x39'))){_0x50f904['limit']=qs[_0x7a45('0x1f')](_0x213215['query'][_0x7a45('0x1f')]);_0x50f904[_0x7a45('0x1d')]=qs['offset'](_0x213215['query'][_0x7a45('0x1d')]);}_0x50f904[_0x7a45('0x3a')]=qs[_0x7a45('0x3b')](_0x213215[_0x7a45('0x32')][_0x7a45('0x3b')]);_0x50f904[_0x7a45('0x3c')]=qs['filters'](_['pick'](_0x213215[_0x7a45('0x32')],_0x41b137[_0x7a45('0x34')]),_0x6ef67a);if(_0x213215['query'][_0x7a45('0x3d')]){_0x50f904[_0x7a45('0x3c')]=_[_0x7a45('0x3e')](_0x50f904[_0x7a45('0x3c')],{'$or':_[_0x7a45('0x2d')](_0x6ef67a,function(_0x1efd3e){if(_0x1efd3e[_0x7a45('0x30')]!==_0x7a45('0x3f')){var _0x32e7cb={};_0x32e7cb[_0x1efd3e[_0x7a45('0x2a')]]={'$like':'%'+_0x213215[_0x7a45('0x32')][_0x7a45('0x3d')]+'%'};return _0x32e7cb;}})});}_0x50f904=_[_0x7a45('0x3e')]({},_0x50f904,_0x213215[_0x7a45('0x40')]);var _0x5b2b35={'where':_0x50f904[_0x7a45('0x3c')]};return db['ServicenowField'][_0x7a45('0x20')](_0x5b2b35)[_0x7a45('0x27')](function(_0x309d2e){_0x5478f7[_0x7a45('0x20')]=_0x309d2e;if(_0x213215[_0x7a45('0x32')][_0x7a45('0x41')]){_0x50f904[_0x7a45('0x42')]=[{'all':!![]}];}return db[_0x7a45('0x43')][_0x7a45('0x44')](_0x50f904);})['then'](function(_0x78d816){_0x5478f7['rows']=_0x78d816;return _0x5478f7;})['then'](respondWithFilteredResult(_0x2f23f1,_0x50f904))[_0x7a45('0x45')](handleError(_0x2f23f1,null));};exports[_0x7a45('0x46')]=function(_0x51b197,_0x2f83ed){var _0x1203af={'raw':!![],'where':{'id':_0x51b197[_0x7a45('0x47')]['id']}},_0x32111f={};_0x32111f['model']=_[_0x7a45('0x33')](db[_0x7a45('0x43')][_0x7a45('0x2e')]);_0x32111f[_0x7a45('0x32')]=_[_0x7a45('0x33')](_0x51b197[_0x7a45('0x32')]);_0x32111f['filters']=_[_0x7a45('0x35')](_0x32111f[_0x7a45('0x31')],_0x32111f[_0x7a45('0x32')]);_0x1203af[_0x7a45('0x36')]=_[_0x7a45('0x35')](_0x32111f[_0x7a45('0x31')],qs[_0x7a45('0x37')](_0x51b197[_0x7a45('0x32')][_0x7a45('0x37')]));_0x1203af[_0x7a45('0x36')]=_0x1203af['attributes'][_0x7a45('0x48')]?_0x1203af[_0x7a45('0x36')]:_0x32111f['model'];if(_0x51b197[_0x7a45('0x32')][_0x7a45('0x41')]){_0x1203af[_0x7a45('0x42')]=[{'all':!![]}];}_0x1203af=_['merge']({},_0x1203af,_0x51b197[_0x7a45('0x40')]);return db[_0x7a45('0x43')][_0x7a45('0x49')](_0x1203af)[_0x7a45('0x27')](handleEntityNotFound(_0x2f83ed,null))[_0x7a45('0x27')](respondWithResult(_0x2f83ed,null))['catch'](handleError(_0x2f83ed,null));};exports[_0x7a45('0x4a')]=function(_0x5bc505,_0x37099f){return db[_0x7a45('0x43')][_0x7a45('0x4a')](_0x5bc505[_0x7a45('0x4b')],{})[_0x7a45('0x27')](respondWithResult(_0x37099f,0xc9))[_0x7a45('0x45')](handleError(_0x37099f,null));};exports['update']=function(_0x13a4e9,_0x29ee07){if(_0x13a4e9[_0x7a45('0x4b')]['id']){delete _0x13a4e9[_0x7a45('0x4b')]['id'];}return db[_0x7a45('0x43')]['find']({'where':{'id':_0x13a4e9[_0x7a45('0x47')]['id']}})[_0x7a45('0x27')](handleEntityNotFound(_0x29ee07,null))['then'](saveUpdates(_0x13a4e9[_0x7a45('0x4b')],null))[_0x7a45('0x27')](respondWithResult(_0x29ee07,null))[_0x7a45('0x45')](handleError(_0x29ee07,null));};exports[_0x7a45('0x26')]=function(_0xf43a18,_0x3d06c8){return db[_0x7a45('0x43')][_0x7a45('0x49')]({'where':{'id':_0xf43a18[_0x7a45('0x47')]['id']}})[_0x7a45('0x27')](handleEntityNotFound(_0x3d06c8,null))[_0x7a45('0x27')](removeEntity(_0x3d06c8,null))[_0x7a45('0x45')](handleError(_0x3d06c8,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index d5cbbdc..c2f045f 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 _0x3670=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','define','ServicenowField'];(function(_0x2eaf12,_0x3992a5){var _0x57d59c=function(_0x3112ed){while(--_0x3112ed){_0x2eaf12['push'](_0x2eaf12['shift']());}};_0x57d59c(++_0x3992a5);}(_0x3670,0xa9));var _0x0367=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x3670[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0367('0x0'));var util=require(_0x0367('0x1'));var logger=require(_0x0367('0x2'))(_0x0367('0x3'));var moment=require(_0x0367('0x4'));var BPromise=require(_0x0367('0x5'));var rp=require(_0x0367('0x6'));var fs=require('fs');var path=require(_0x0367('0x7'));var rimraf=require(_0x0367('0x8'));var config=require(_0x0367('0x9'));var attributes=require(_0x0367('0xa'));module['exports']=function(_0x36c84f,_0x359d3d){return _0x36c84f[_0x0367('0xb')](_0x0367('0xc'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8bc=['lodash','util','../../config/logger','api','path','rimraf','../../config/environment','exports','define','ServicenowField','int_servicenow_fields','idField','FieldId'];(function(_0x1ef5ff,_0x175709){var _0x17041e=function(_0x3547a7){while(--_0x3547a7){_0x1ef5ff['push'](_0x1ef5ff['shift']());}};_0x17041e(++_0x175709);}(_0xd8bc,0x186));var _0xcd8b=function(_0xed83f9,_0x27350b){_0xed83f9=_0xed83f9-0x0;var _0x5b599c=_0xd8bc[_0xed83f9];return _0x5b599c;};'use strict';var _=require(_0xcd8b('0x0'));var util=require(_0xcd8b('0x1'));var logger=require(_0xcd8b('0x2'))(_0xcd8b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcd8b('0x4'));var rimraf=require(_0xcd8b('0x5'));var config=require(_0xcd8b('0x6'));var attributes=require('./intServicenowField.attributes');module[_0xcd8b('0x7')]=function(_0x23012b,_0x1243f0){return _0x23012b[_0xcd8b('0x8')](_0xcd8b('0x9'),attributes,{'tableName':_0xcd8b('0xa'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0xcd8b('0xb'),_0xcd8b('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index a8b4e3a..b1c2934 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 _0xe706=['http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3e03cb,_0x1fb497){var _0x24688f=function(_0x2002f8){while(--_0x2002f8){_0x3e03cb['push'](_0x3e03cb['shift']());}};_0x24688f(++_0x1fb497);}(_0xe706,0xa3));var _0x6e70=function(_0x36eb7f,_0x57dca4){_0x36eb7f=_0x36eb7f-0x0;var _0x50023b=_0xe706[_0x36eb7f];return _0x50023b;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('ServicenowField,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ 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(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xac4a,0x13f));var _0xaac4=function(_0x6551a,_0x56a406){_0x6551a=_0x6551a-0x0;var _0x13e0a5=_0xac4a[_0x6551a];return _0x13e0a5;};'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 2ddd088..55d78fd 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(_0x272949,_0x3b575a){var _0x41f151=function(_0x348024){while(--_0x348024){_0x272949['push'](_0x272949['shift']());}};_0x41f151(++_0x3b575a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'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','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x234d67,_0x2f2827){var _0x4d58bd=function(_0x20a20c){while(--_0x20a20c){_0x234d67['push'](_0x234d67['shift']());}};_0x4d58bd(++_0x2f2827);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 5393668..4d9f2f9 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(_0xe926d0,_0x462174){var _0x3d738a=function(_0x28f995){while(--_0x28f995){_0xe926d0['push'](_0xe926d0['shift']());}};_0x3d738a(++_0x462174);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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(_0x40fb10,_0x453676){var _0x110a3f=function(_0x413490){while(--_0x413490){_0x40fb10['push'](_0x40fb10['shift']());}};_0x110a3f(++_0x453676);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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 33d714c..ef9ee18 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 _0x9cee=['getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','stack','name','send','map','SugarcrmAccount','rawAttributes','fieldName','query','intersection','attributes','model','fields','length','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','keys','merge','create','body','update','find','getConfigurations','SugarcrmConfiguration','hasOwnProperty','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','lastIndexOf','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','POST','get_module_fields','Calls','module_fields','remove','includes','label','endsWith','values','test','statusCode','error'];(function(_0x540dcb,_0x4eacb6){var _0x49353c=function(_0x449bb1){while(--_0x449bb1){_0x540dcb['push'](_0x540dcb['shift']());}};_0x49353c(++_0x4eacb6);}(_0x9cee,0x176));var _0xe9ce=function(_0x1455a7,_0x2eb7a4){_0x1455a7=_0x1455a7-0x0;var _0x9327e4=_0x9cee[_0x1455a7];return _0x9327e4;};'use strict';var emlformat=require(_0xe9ce('0x0'));var rimraf=require(_0xe9ce('0x1'));var zipdir=require(_0xe9ce('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe9ce('0x3'));var BPromise=require(_0xe9ce('0x4'));var Mustache=require(_0xe9ce('0x5'));var util=require(_0xe9ce('0x6'));var path=require(_0xe9ce('0x7'));var sox=require(_0xe9ce('0x8'));var csv=require(_0xe9ce('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9ce('0xa'));var _=require(_0xe9ce('0xb'));var squel=require(_0xe9ce('0xc'));var crypto=require(_0xe9ce('0xd'));var jsforce=require(_0xe9ce('0xe'));var deskjs=require(_0xe9ce('0xf'));var toCsv=require(_0xe9ce('0x9'));var querystring=require('querystring');var Papa=require(_0xe9ce('0x10'));var Redis=require('ioredis');var authService=require(_0xe9ce('0x11'));var qs=require(_0xe9ce('0x12'));var as=require(_0xe9ce('0x13'));var hardwareService=require(_0xe9ce('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xe9ce('0x15'));var config=require(_0xe9ce('0x16'));var licenseUtil=require(_0xe9ce('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xe9ce('0x18'));function respondWithStatusCode(_0x804b02,_0x5641f3){_0x5641f3=_0x5641f3||0xcc;return function(_0x5bc923){if(_0x5bc923){return _0x804b02['sendStatus'](_0x5641f3);}return _0x804b02[_0xe9ce('0x19')](_0x5641f3)[_0xe9ce('0x1a')]();};}function respondWithResult(_0x18c51c,_0x1d2a6a){_0x1d2a6a=_0x1d2a6a||0xc8;return function(_0x4061d0){if(_0x4061d0){return _0x18c51c[_0xe9ce('0x19')](_0x1d2a6a)[_0xe9ce('0x1b')](_0x4061d0);}};}function respondWithFilteredResult(_0x1c7e4e,_0x50b4f4){return function(_0x303c1e){if(_0x303c1e){var _0x546731=typeof _0x50b4f4[_0xe9ce('0x1c')]===_0xe9ce('0x1d')&&typeof _0x50b4f4['limit']===_0xe9ce('0x1d');var _0x5092c6=_0x303c1e[_0xe9ce('0x1e')];var _0x432f7c=_0x546731?0x0:_0x50b4f4[_0xe9ce('0x1c')];var _0x2544d1=_0x546731?_0x303c1e[_0xe9ce('0x1e')]:_0x50b4f4[_0xe9ce('0x1c')]+_0x50b4f4[_0xe9ce('0x1f')];var _0x14e5b4;if(_0x2544d1>=_0x5092c6){_0x2544d1=_0x5092c6;_0x14e5b4=0xc8;}else{_0x14e5b4=0xce;}_0x1c7e4e['status'](_0x14e5b4);return _0x1c7e4e[_0xe9ce('0x20')](_0xe9ce('0x21'),_0x432f7c+'-'+_0x2544d1+'/'+_0x5092c6)['json'](_0x303c1e);}return null;};}function patchUpdates(_0x254252){return function(_0xfbd57e){try{jsonpatch[_0xe9ce('0x22')](_0xfbd57e,_0x254252,!![]);}catch(_0x3415fc){return BPromise[_0xe9ce('0x23')](_0x3415fc);}return _0xfbd57e[_0xe9ce('0x24')]();};}function saveUpdates(_0x66b62c,_0x181750){return function(_0x2b7575){if(_0x2b7575){return _0x2b7575['update'](_0x66b62c)['then'](function(_0x4ae399){return _0x4ae399;});}return null;};}function removeEntity(_0x463bf3,_0x1fb34d){return function(_0x1c1da5){if(_0x1c1da5){return _0x1c1da5[_0xe9ce('0x25')]()['then'](function(){_0x463bf3[_0xe9ce('0x19')](0xcc)[_0xe9ce('0x1a')]();});}};}function handleEntityNotFound(_0x42861e,_0xa3272b){return function(_0x5620a6){if(!_0x5620a6){_0x42861e['sendStatus'](0x194);}return _0x5620a6;};}function handleError(_0x1e41a8,_0x2783cc){_0x2783cc=_0x2783cc||0x1f4;return function(_0x1adbd8){logger['error'](_0x1adbd8[_0xe9ce('0x26')]);if(_0x1adbd8[_0xe9ce('0x27')]){delete _0x1adbd8[_0xe9ce('0x27')];}_0x1e41a8[_0xe9ce('0x19')](_0x2783cc)[_0xe9ce('0x28')](_0x1adbd8);};}exports['index']=function(_0x1cf4d4,_0x3c927f){var _0x159ce7={},_0x3f84a9={},_0x2b66ab={'count':0x0,'rows':[]};var _0x41804a=_[_0xe9ce('0x29')](db[_0xe9ce('0x2a')][_0xe9ce('0x2b')],function(_0x4d9695){return{'name':_0x4d9695[_0xe9ce('0x2c')],'type':_0x4d9695['type']['key']};});_0x3f84a9['model']=_[_0xe9ce('0x29')](_0x41804a,_0xe9ce('0x27'));_0x3f84a9['query']=_['keys'](_0x1cf4d4[_0xe9ce('0x2d')]);_0x3f84a9['filters']=_[_0xe9ce('0x2e')](_0x3f84a9['model'],_0x3f84a9[_0xe9ce('0x2d')]);_0x159ce7[_0xe9ce('0x2f')]=_[_0xe9ce('0x2e')](_0x3f84a9[_0xe9ce('0x30')],qs[_0xe9ce('0x31')](_0x1cf4d4[_0xe9ce('0x2d')][_0xe9ce('0x31')]));_0x159ce7[_0xe9ce('0x2f')]=_0x159ce7[_0xe9ce('0x2f')][_0xe9ce('0x32')]?_0x159ce7[_0xe9ce('0x2f')]:_0x3f84a9[_0xe9ce('0x30')];if(!_0x1cf4d4[_0xe9ce('0x2d')]['hasOwnProperty'](_0xe9ce('0x33'))){_0x159ce7[_0xe9ce('0x1f')]=qs[_0xe9ce('0x1f')](_0x1cf4d4[_0xe9ce('0x2d')][_0xe9ce('0x1f')]);_0x159ce7[_0xe9ce('0x1c')]=qs['offset'](_0x1cf4d4[_0xe9ce('0x2d')][_0xe9ce('0x1c')]);}_0x159ce7[_0xe9ce('0x34')]=qs[_0xe9ce('0x35')](_0x1cf4d4[_0xe9ce('0x2d')][_0xe9ce('0x35')]);_0x159ce7[_0xe9ce('0x36')]=qs[_0xe9ce('0x37')](_[_0xe9ce('0x38')](_0x1cf4d4[_0xe9ce('0x2d')],_0x3f84a9[_0xe9ce('0x37')]),_0x41804a);if(_0x1cf4d4[_0xe9ce('0x2d')][_0xe9ce('0x39')]){_0x159ce7[_0xe9ce('0x36')]=_['merge'](_0x159ce7[_0xe9ce('0x36')],{'$or':_[_0xe9ce('0x29')](_0x41804a,function(_0x32a637){if(_0x32a637[_0xe9ce('0x3a')]!==_0xe9ce('0x3b')){var _0x58dc19={};_0x58dc19[_0x32a637[_0xe9ce('0x27')]]={'$like':'%'+_0x1cf4d4[_0xe9ce('0x2d')][_0xe9ce('0x39')]+'%'};return _0x58dc19;}})});}_0x159ce7=_['merge']({},_0x159ce7,_0x1cf4d4[_0xe9ce('0x3c')]);var _0x5edcdd={'where':_0x159ce7['where']};return db[_0xe9ce('0x2a')][_0xe9ce('0x1e')](_0x5edcdd)[_0xe9ce('0x3d')](function(_0x2dbf24){_0x2b66ab[_0xe9ce('0x1e')]=_0x2dbf24;if(_0x1cf4d4[_0xe9ce('0x2d')][_0xe9ce('0x3e')]){_0x159ce7[_0xe9ce('0x3f')]=[{'all':!![]}];}return db[_0xe9ce('0x2a')][_0xe9ce('0x40')](_0x159ce7);})['then'](function(_0xecf7fe){_0x2b66ab[_0xe9ce('0x41')]=_0xecf7fe;return _0x2b66ab;})[_0xe9ce('0x3d')](respondWithFilteredResult(_0x3c927f,_0x159ce7))[_0xe9ce('0x42')](handleError(_0x3c927f,null));};exports[_0xe9ce('0x43')]=function(_0x4842c5,_0x555203){var _0x316f8b={'raw':![],'where':{'id':_0x4842c5[_0xe9ce('0x44')]['id']}},_0x2501a9={};_0x2501a9[_0xe9ce('0x30')]=_['keys'](db[_0xe9ce('0x2a')]['rawAttributes']);_0x2501a9[_0xe9ce('0x2d')]=_[_0xe9ce('0x45')](_0x4842c5[_0xe9ce('0x2d')]);_0x2501a9['filters']=_['intersection'](_0x2501a9['model'],_0x2501a9['query']);_0x316f8b[_0xe9ce('0x2f')]=_['intersection'](_0x2501a9['model'],qs[_0xe9ce('0x31')](_0x4842c5[_0xe9ce('0x2d')][_0xe9ce('0x31')]));_0x316f8b[_0xe9ce('0x2f')]=_0x316f8b[_0xe9ce('0x2f')][_0xe9ce('0x32')]?_0x316f8b[_0xe9ce('0x2f')]:_0x2501a9[_0xe9ce('0x30')];if(_0x4842c5[_0xe9ce('0x2d')]['includeAll']){_0x316f8b[_0xe9ce('0x3f')]=[{'all':!![]}];}_0x316f8b=_[_0xe9ce('0x46')]({},_0x316f8b,_0x4842c5[_0xe9ce('0x3c')]);return db[_0xe9ce('0x2a')]['find'](_0x316f8b)[_0xe9ce('0x3d')](handleEntityNotFound(_0x555203,null))[_0xe9ce('0x3d')](respondWithResult(_0x555203,null))[_0xe9ce('0x42')](handleError(_0x555203,null));};exports[_0xe9ce('0x47')]=function(_0x2a8f65,_0x5186a4){return db[_0xe9ce('0x2a')][_0xe9ce('0x47')](_0x2a8f65[_0xe9ce('0x48')],{})[_0xe9ce('0x3d')](respondWithResult(_0x5186a4,0xc9))[_0xe9ce('0x42')](handleError(_0x5186a4,null));};exports[_0xe9ce('0x49')]=function(_0x4926b1,_0x4c9b19){if(_0x4926b1[_0xe9ce('0x48')]['id']){delete _0x4926b1['body']['id'];}return db[_0xe9ce('0x2a')]['find']({'where':{'id':_0x4926b1['params']['id']}})['then'](handleEntityNotFound(_0x4c9b19,null))['then'](saveUpdates(_0x4926b1[_0xe9ce('0x48')],null))[_0xe9ce('0x3d')](respondWithResult(_0x4c9b19,null))['catch'](handleError(_0x4c9b19,null));};exports[_0xe9ce('0x25')]=function(_0x5948a9,_0x42cbf6){return db[_0xe9ce('0x2a')][_0xe9ce('0x4a')]({'where':{'id':_0x5948a9[_0xe9ce('0x44')]['id']}})[_0xe9ce('0x3d')](handleEntityNotFound(_0x42cbf6,null))['then'](removeEntity(_0x42cbf6,null))[_0xe9ce('0x42')](handleError(_0x42cbf6,null));};exports[_0xe9ce('0x4b')]=function(_0x7ed500,_0x1ffdb0,_0x306a43){var _0x536731={};var _0x8c379={};var _0x55f1f8;var _0x1e0aec;return db['SugarcrmAccount']['findOne']({'where':{'id':_0x7ed500[_0xe9ce('0x44')]['id']}})['then'](handleEntityNotFound(_0x1ffdb0,null))[_0xe9ce('0x3d')](function(_0x3fa38f){if(_0x3fa38f){_0x55f1f8=_0x3fa38f;_0x8c379['model']=_['keys'](db[_0xe9ce('0x4c')]['rawAttributes']);_0x8c379['query']=_[_0xe9ce('0x45')](_0x7ed500[_0xe9ce('0x2d')]);_0x8c379[_0xe9ce('0x37')]=_[_0xe9ce('0x2e')](_0x8c379[_0xe9ce('0x30')],_0x8c379[_0xe9ce('0x2d')]);_0x536731['attributes']=_[_0xe9ce('0x2e')](_0x8c379[_0xe9ce('0x30')],qs[_0xe9ce('0x31')](_0x7ed500[_0xe9ce('0x2d')][_0xe9ce('0x31')]));_0x536731[_0xe9ce('0x2f')]=_0x536731[_0xe9ce('0x2f')]['length']?_0x536731[_0xe9ce('0x2f')]:_0x8c379[_0xe9ce('0x30')];_0x536731[_0xe9ce('0x34')]=qs[_0xe9ce('0x35')](_0x7ed500[_0xe9ce('0x2d')][_0xe9ce('0x35')]);_0x536731['where']=qs[_0xe9ce('0x37')](_['pick'](_0x7ed500[_0xe9ce('0x2d')],_0x8c379[_0xe9ce('0x37')]));if(_0x7ed500[_0xe9ce('0x2d')][_0xe9ce('0x39')]){_0x536731[_0xe9ce('0x36')]=_[_0xe9ce('0x46')](_0x536731[_0xe9ce('0x36')],{'$or':_[_0xe9ce('0x29')](_0x536731[_0xe9ce('0x2f')],function(_0xbbce6d){var _0x26bafa={};_0x26bafa[_0xbbce6d]={'$like':'%'+_0x7ed500['query'][_0xe9ce('0x39')]+'%'};return _0x26bafa;})});}_0x536731=_[_0xe9ce('0x46')]({},_0x536731,_0x7ed500['options']);return _0x55f1f8[_0xe9ce('0x4b')](_0x536731);}})[_0xe9ce('0x3d')](function(_0x210d29){if(_0x210d29){_0x1e0aec=_0x210d29[_0xe9ce('0x32')];if(!_0x7ed500[_0xe9ce('0x2d')][_0xe9ce('0x4d')](_0xe9ce('0x33'))){_0x536731[_0xe9ce('0x1f')]=qs[_0xe9ce('0x1f')](_0x7ed500['query'][_0xe9ce('0x1f')]);_0x536731[_0xe9ce('0x1c')]=qs['offset'](_0x7ed500[_0xe9ce('0x2d')][_0xe9ce('0x1c')]);}return _0x55f1f8[_0xe9ce('0x4b')](_0x536731);}})[_0xe9ce('0x3d')](function(_0x4d3e2d){if(_0x4d3e2d){return _0x4d3e2d?{'count':_0x1e0aec,'rows':_0x4d3e2d}:null;}})['then'](respondWithResult(_0x1ffdb0,null))[_0xe9ce('0x42')](handleError(_0x1ffdb0,null));};exports[_0xe9ce('0x4e')]=function(_0xcc2a22,_0x410eff,_0x1eca01){if(_0xcc2a22[_0xe9ce('0x48')]['id']){delete _0xcc2a22[_0xe9ce('0x48')]['id'];}return db['SugarcrmAccount'][_0xe9ce('0x4f')]({'where':{'id':_0xcc2a22[_0xe9ce('0x44')]['id']}})[_0xe9ce('0x3d')](handleEntityNotFound(_0x410eff,null))[_0xe9ce('0x3d')](function(_0x27d1eb){if(_0x27d1eb){_0xcc2a22[_0xe9ce('0x48')]['AccountId']=_0x27d1eb['id'];_0xcc2a22[_0xe9ce('0x48')][_0xe9ce('0x50')]=integrations[_0xe9ce('0x51')](_0xcc2a22[_0xe9ce('0x48')][_0xe9ce('0x52')],_0xcc2a22[_0xe9ce('0x48')][_0xe9ce('0x3a')]);_0xcc2a22[_0xe9ce('0x48')][_0xe9ce('0x53')]=integrations['getDescriptions'](_0xcc2a22[_0xe9ce('0x48')][_0xe9ce('0x52')],_0xcc2a22[_0xe9ce('0x48')][_0xe9ce('0x3a')]);return db[_0xe9ce('0x4c')]['create'](_0xcc2a22[_0xe9ce('0x48')],{'include':[{'model':db['SugarcrmField'],'as':'Subjects'},{'model':db[_0xe9ce('0x54')],'as':_0xe9ce('0x53')}]});}return null;})[_0xe9ce('0x3d')](respondWithResult(_0x410eff,null))[_0xe9ce('0x42')](handleError(_0x410eff,null));};exports[_0xe9ce('0x55')]=function(_0x53eea6,_0x1de91d,_0x10ad8a){var _0xd38bb9='';var _0x492645=['id','name',_0xe9ce('0x56'),_0xe9ce('0x57'),_0xe9ce('0x58'),_0xe9ce('0x59'),'duration_hours',_0xe9ce('0x5a'),_0xe9ce('0x5b'),_0xe9ce('0x5c'),_0xe9ce('0x5d'),_0xe9ce('0x5e')];return db[_0xe9ce('0x2a')][_0xe9ce('0x4f')]({'where':{'id':_0x53eea6[_0xe9ce('0x44')]['id']},'attributes':['id',_0xe9ce('0x5f'),_0xe9ce('0x60'),'remoteUri']})[_0xe9ce('0x3d')](handleEntityNotFound(_0x1de91d,null))[_0xe9ce('0x3d')](function(_0x6821dd){if(_0x6821dd){_0xd38bb9=_0x6821dd[_0xe9ce('0x61')];var _0x168e0d=_0xd38bb9[_0xe9ce('0x62')](-0x1);if(_0x168e0d==='/'){_0xd38bb9=_0xd38bb9['substring'](0x0,_0xd38bb9[_0xe9ce('0x63')](_0x168e0d));}return rp({'method':'POST','uri':util[_0xe9ce('0x64')](_0xe9ce('0x65'),_0xd38bb9,_0xe9ce('0x66')),'json':!![],'form':{'method':_0xe9ce('0x67'),'input_type':_0xe9ce('0x68'),'response_type':_0xe9ce('0x68'),'rest_data':JSON[_0xe9ce('0x69')]({'user_auth':{'user_name':_0x6821dd[_0xe9ce('0x5f')],'password':_0x6821dd[_0xe9ce('0x60')],'encryption':_0xe9ce('0x6a')},'application':_0xe9ce('0x6b')})}});}})[_0xe9ce('0x3d')](function(_0x1427a0){if(_0x1427a0&&_0x1427a0['name']!==_0xe9ce('0x6c')&&_0x1427a0[_0xe9ce('0x27')]!==_0xe9ce('0x6d')){return rp({'method':_0xe9ce('0x6e'),'uri':util[_0xe9ce('0x64')](_0xe9ce('0x65'),_0xd38bb9,_0xe9ce('0x66')),'json':!![],'form':{'method':_0xe9ce('0x6f'),'input_type':'JSON','response_type':_0xe9ce('0x68'),'rest_data':JSON[_0xe9ce('0x69')]({'session':_0x1427a0['id'],'module_name':_0xe9ce('0x70')})}})[_0xe9ce('0x3d')](function(_0x2a7782){if(_0x2a7782){var _0x239bc3=_['values'](_0x2a7782[_0xe9ce('0x71')]);_[_0xe9ce('0x72')](_0x239bc3,function(_0x49810c){return _0x492645[_0xe9ce('0x73')](_0x49810c[_0xe9ce('0x27')]);});return{'count':_0x239bc3[_0xe9ce('0x32')],'rows':_[_0xe9ce('0x29')](_0x239bc3,function(_0x456e52){return{'id':_0x456e52[_0xe9ce('0x27')],'name':_0x456e52[_0xe9ce('0x74')],'custom':_[_0xe9ce('0x75')](_0x456e52['name'],'_c')?!![]:![],'options':_0x456e52[_0xe9ce('0x3c')]?_['map'](_[_0xe9ce('0x76')](_0x456e52[_0xe9ce('0x3c')]),function(_0x248810){return{'name':_0x248810['value'],'value':_0x248810['name']};}):[]};})};}})[_0xe9ce('0x3d')](respondWithResult(_0x1de91d,null))[_0xe9ce('0x42')](function(_0x33b3a4){var _0xdef755=_0x53eea6[_0xe9ce('0x2d')][_0xe9ce('0x77')]?0x1f4:_0x33b3a4[_0xe9ce('0x78')]||0x1f4;logger[_0xe9ce('0x79')](_0xe9ce('0x7a'),_0xe9ce('0x55'),_0xdef755,JSON[_0xe9ce('0x69')](_0x33b3a4));delete _0x33b3a4['name'];if(_0xdef755===0x191){_0xdef755=0x190;}_0x1de91d[_0xe9ce('0x19')](_0xdef755)[_0xe9ce('0x28')](_0x53eea6[_0xe9ce('0x2d')][_0xe9ce('0x77')]?{'message':_0xe9ce('0x7b'),'statusCode':_0x33b3a4[_0xe9ce('0x78')]}:_0x33b3a4);});}else{var _0x491fd4=0x1f4;_0x1de91d['status'](_0x491fd4)[_0xe9ce('0x28')]({'message':_0xe9ce('0x7b'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xa8f0=['show','params','length','create','body','destroy','find','findOne','SugarcrmConfiguration','pick','getConfigurations','AccountId','Subjects','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','duration_hours','duration_minutes','parent_id','parent_type','direction','username','password','remoteUri','slice','lastIndexOf','POST','format','%s%s','login','JSON','stringify','PLAIN','Invalid\x20Login','Password\x20Expired','/service/v4_1/rest.php','get_module_fields','Calls','values','module_fields','remove','includes','endsWith','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','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','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','stack','name','send','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','SugarcrmAccount','includeAll','include','findAll','rows','catch'];(function(_0x203f53,_0x5b2ce9){var _0x44f626=function(_0x1e1b01){while(--_0x1e1b01){_0x203f53['push'](_0x203f53['shift']());}};_0x44f626(++_0x5b2ce9);}(_0xa8f0,0x123));var _0x0a8f=function(_0x43f5c7,_0x118763){_0x43f5c7=_0x43f5c7-0x0;var _0x46be5f=_0xa8f0[_0x43f5c7];return _0x46be5f;};'use strict';var emlformat=require(_0x0a8f('0x0'));var rimraf=require(_0x0a8f('0x1'));var zipdir=require(_0x0a8f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0a8f('0x3'));var moment=require(_0x0a8f('0x4'));var BPromise=require(_0x0a8f('0x5'));var Mustache=require(_0x0a8f('0x6'));var util=require(_0x0a8f('0x7'));var path=require(_0x0a8f('0x8'));var sox=require(_0x0a8f('0x9'));var csv=require(_0x0a8f('0xa'));var ejs=require(_0x0a8f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0a8f('0xc'));var squel=require('squel');var crypto=require(_0x0a8f('0xd'));var jsforce=require(_0x0a8f('0xe'));var deskjs=require(_0x0a8f('0xf'));var toCsv=require(_0x0a8f('0xa'));var querystring=require(_0x0a8f('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0a8f('0x11'));var qs=require(_0x0a8f('0x12'));var as=require(_0x0a8f('0x13'));var hardwareService=require(_0x0a8f('0x14'));var logger=require(_0x0a8f('0x15'))('api');var utils=require(_0x0a8f('0x16'));var config=require(_0x0a8f('0x17'));var licenseUtil=require(_0x0a8f('0x18'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x197ca3,_0x323b78){_0x323b78=_0x323b78||0xcc;return function(_0x15f717){if(_0x15f717){return _0x197ca3[_0x0a8f('0x19')](_0x323b78);}return _0x197ca3[_0x0a8f('0x1a')](_0x323b78)[_0x0a8f('0x1b')]();};}function respondWithResult(_0x260910,_0x180a70){_0x180a70=_0x180a70||0xc8;return function(_0xd59e80){if(_0xd59e80){return _0x260910['status'](_0x180a70)[_0x0a8f('0x1c')](_0xd59e80);}};}function respondWithFilteredResult(_0x195f48,_0x73e614){return function(_0xdcdc72){if(_0xdcdc72){var _0x24e8c9=typeof _0x73e614[_0x0a8f('0x1d')]===_0x0a8f('0x1e')&&typeof _0x73e614[_0x0a8f('0x1f')]==='undefined';var _0x277663=_0xdcdc72[_0x0a8f('0x20')];var _0x1aac1b=_0x24e8c9?0x0:_0x73e614[_0x0a8f('0x1d')];var _0x59182e=_0x24e8c9?_0xdcdc72['count']:_0x73e614['offset']+_0x73e614['limit'];var _0x5e1f5a;if(_0x59182e>=_0x277663){_0x59182e=_0x277663;_0x5e1f5a=0xc8;}else{_0x5e1f5a=0xce;}_0x195f48[_0x0a8f('0x1a')](_0x5e1f5a);return _0x195f48[_0x0a8f('0x21')](_0x0a8f('0x22'),_0x1aac1b+'-'+_0x59182e+'/'+_0x277663)['json'](_0xdcdc72);}return null;};}function patchUpdates(_0x3a98b0){return function(_0x1d1e33){try{jsonpatch[_0x0a8f('0x23')](_0x1d1e33,_0x3a98b0,!![]);}catch(_0x50ed6e){return BPromise[_0x0a8f('0x24')](_0x50ed6e);}return _0x1d1e33[_0x0a8f('0x25')]();};}function saveUpdates(_0x5c530f,_0x55c3d8){return function(_0x7b38c1){if(_0x7b38c1){return _0x7b38c1['update'](_0x5c530f)[_0x0a8f('0x26')](function(_0x134379){return _0x134379;});}return null;};}function removeEntity(_0x46e786,_0x442b34){return function(_0x58f8a0){if(_0x58f8a0){return _0x58f8a0['destroy']()[_0x0a8f('0x26')](function(){_0x46e786[_0x0a8f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x89e09a,_0x39893d){return function(_0x5e4fef){if(!_0x5e4fef){_0x89e09a['sendStatus'](0x194);}return _0x5e4fef;};}function handleError(_0x18c7b5,_0x1b6e9d){_0x1b6e9d=_0x1b6e9d||0x1f4;return function(_0x4ff187){logger['error'](_0x4ff187[_0x0a8f('0x27')]);if(_0x4ff187[_0x0a8f('0x28')]){delete _0x4ff187[_0x0a8f('0x28')];}_0x18c7b5[_0x0a8f('0x1a')](_0x1b6e9d)[_0x0a8f('0x29')](_0x4ff187);};}exports['index']=function(_0x5828e2,_0x509fa5){var _0x49f39f={},_0x538458={},_0x401aa3={'count':0x0,'rows':[]};var _0xd4f4de=_['map'](db['SugarcrmAccount'][_0x0a8f('0x2a')],function(_0x37e8ff){return{'name':_0x37e8ff[_0x0a8f('0x2b')],'type':_0x37e8ff[_0x0a8f('0x2c')][_0x0a8f('0x2d')]};});_0x538458[_0x0a8f('0x2e')]=_[_0x0a8f('0x2f')](_0xd4f4de,_0x0a8f('0x28'));_0x538458['query']=_[_0x0a8f('0x30')](_0x5828e2[_0x0a8f('0x31')]);_0x538458[_0x0a8f('0x32')]=_[_0x0a8f('0x33')](_0x538458['model'],_0x538458[_0x0a8f('0x31')]);_0x49f39f['attributes']=_['intersection'](_0x538458[_0x0a8f('0x2e')],qs[_0x0a8f('0x34')](_0x5828e2[_0x0a8f('0x31')][_0x0a8f('0x34')]));_0x49f39f[_0x0a8f('0x35')]=_0x49f39f[_0x0a8f('0x35')]['length']?_0x49f39f[_0x0a8f('0x35')]:_0x538458[_0x0a8f('0x2e')];if(!_0x5828e2[_0x0a8f('0x31')][_0x0a8f('0x36')](_0x0a8f('0x37'))){_0x49f39f[_0x0a8f('0x1f')]=qs['limit'](_0x5828e2[_0x0a8f('0x31')]['limit']);_0x49f39f['offset']=qs['offset'](_0x5828e2[_0x0a8f('0x31')][_0x0a8f('0x1d')]);}_0x49f39f[_0x0a8f('0x38')]=qs['sort'](_0x5828e2[_0x0a8f('0x31')][_0x0a8f('0x39')]);_0x49f39f[_0x0a8f('0x3a')]=qs[_0x0a8f('0x32')](_['pick'](_0x5828e2[_0x0a8f('0x31')],_0x538458[_0x0a8f('0x32')]),_0xd4f4de);if(_0x5828e2[_0x0a8f('0x31')][_0x0a8f('0x3b')]){_0x49f39f[_0x0a8f('0x3a')]=_[_0x0a8f('0x3c')](_0x49f39f[_0x0a8f('0x3a')],{'$or':_[_0x0a8f('0x2f')](_0xd4f4de,function(_0x49e104){if(_0x49e104[_0x0a8f('0x2c')]!==_0x0a8f('0x3d')){var _0x2ea8e5={};_0x2ea8e5[_0x49e104[_0x0a8f('0x28')]]={'$like':'%'+_0x5828e2[_0x0a8f('0x31')][_0x0a8f('0x3b')]+'%'};return _0x2ea8e5;}})});}_0x49f39f=_['merge']({},_0x49f39f,_0x5828e2[_0x0a8f('0x3e')]);var _0x1305c1={'where':_0x49f39f[_0x0a8f('0x3a')]};return db[_0x0a8f('0x3f')][_0x0a8f('0x20')](_0x1305c1)['then'](function(_0x2d5491){_0x401aa3[_0x0a8f('0x20')]=_0x2d5491;if(_0x5828e2['query'][_0x0a8f('0x40')]){_0x49f39f[_0x0a8f('0x41')]=[{'all':!![]}];}return db[_0x0a8f('0x3f')][_0x0a8f('0x42')](_0x49f39f);})['then'](function(_0x1790b2){_0x401aa3[_0x0a8f('0x43')]=_0x1790b2;return _0x401aa3;})[_0x0a8f('0x26')](respondWithFilteredResult(_0x509fa5,_0x49f39f))[_0x0a8f('0x44')](handleError(_0x509fa5,null));};exports[_0x0a8f('0x45')]=function(_0xc7a79f,_0x3ae6ff){var _0xed6c0e={'raw':![],'where':{'id':_0xc7a79f[_0x0a8f('0x46')]['id']}},_0x3b36f6={};_0x3b36f6[_0x0a8f('0x2e')]=_[_0x0a8f('0x30')](db[_0x0a8f('0x3f')][_0x0a8f('0x2a')]);_0x3b36f6[_0x0a8f('0x31')]=_[_0x0a8f('0x30')](_0xc7a79f[_0x0a8f('0x31')]);_0x3b36f6[_0x0a8f('0x32')]=_[_0x0a8f('0x33')](_0x3b36f6[_0x0a8f('0x2e')],_0x3b36f6['query']);_0xed6c0e[_0x0a8f('0x35')]=_[_0x0a8f('0x33')](_0x3b36f6[_0x0a8f('0x2e')],qs[_0x0a8f('0x34')](_0xc7a79f[_0x0a8f('0x31')][_0x0a8f('0x34')]));_0xed6c0e['attributes']=_0xed6c0e[_0x0a8f('0x35')][_0x0a8f('0x47')]?_0xed6c0e[_0x0a8f('0x35')]:_0x3b36f6[_0x0a8f('0x2e')];if(_0xc7a79f['query']['includeAll']){_0xed6c0e['include']=[{'all':!![]}];}_0xed6c0e=_[_0x0a8f('0x3c')]({},_0xed6c0e,_0xc7a79f[_0x0a8f('0x3e')]);return db[_0x0a8f('0x3f')]['find'](_0xed6c0e)['then'](handleEntityNotFound(_0x3ae6ff,null))[_0x0a8f('0x26')](respondWithResult(_0x3ae6ff,null))[_0x0a8f('0x44')](handleError(_0x3ae6ff,null));};exports[_0x0a8f('0x48')]=function(_0x5e5301,_0x53fe2b){return db[_0x0a8f('0x3f')][_0x0a8f('0x48')](_0x5e5301[_0x0a8f('0x49')],{})[_0x0a8f('0x26')](respondWithResult(_0x53fe2b,0xc9))['catch'](handleError(_0x53fe2b,null));};exports['update']=function(_0x3c9066,_0x39be5f){if(_0x3c9066[_0x0a8f('0x49')]['id']){delete _0x3c9066[_0x0a8f('0x49')]['id'];}return db[_0x0a8f('0x3f')]['find']({'where':{'id':_0x3c9066[_0x0a8f('0x46')]['id']}})['then'](handleEntityNotFound(_0x39be5f,null))[_0x0a8f('0x26')](saveUpdates(_0x3c9066['body'],null))[_0x0a8f('0x26')](respondWithResult(_0x39be5f,null))[_0x0a8f('0x44')](handleError(_0x39be5f,null));};exports[_0x0a8f('0x4a')]=function(_0x19f040,_0x25a364){return db[_0x0a8f('0x3f')][_0x0a8f('0x4b')]({'where':{'id':_0x19f040[_0x0a8f('0x46')]['id']}})[_0x0a8f('0x26')](handleEntityNotFound(_0x25a364,null))['then'](removeEntity(_0x25a364,null))[_0x0a8f('0x44')](handleError(_0x25a364,null));};exports['getConfigurations']=function(_0x208b61,_0x1de76c,_0x899d4f){var _0x172bc6={};var _0x2df1fa={};var _0x1e664b;var _0x2b656b;return db[_0x0a8f('0x3f')][_0x0a8f('0x4c')]({'where':{'id':_0x208b61[_0x0a8f('0x46')]['id']}})['then'](handleEntityNotFound(_0x1de76c,null))[_0x0a8f('0x26')](function(_0x4a4834){if(_0x4a4834){_0x1e664b=_0x4a4834;_0x2df1fa['model']=_[_0x0a8f('0x30')](db[_0x0a8f('0x4d')][_0x0a8f('0x2a')]);_0x2df1fa[_0x0a8f('0x31')]=_[_0x0a8f('0x30')](_0x208b61['query']);_0x2df1fa[_0x0a8f('0x32')]=_[_0x0a8f('0x33')](_0x2df1fa[_0x0a8f('0x2e')],_0x2df1fa['query']);_0x172bc6[_0x0a8f('0x35')]=_[_0x0a8f('0x33')](_0x2df1fa[_0x0a8f('0x2e')],qs[_0x0a8f('0x34')](_0x208b61[_0x0a8f('0x31')]['fields']));_0x172bc6['attributes']=_0x172bc6[_0x0a8f('0x35')][_0x0a8f('0x47')]?_0x172bc6[_0x0a8f('0x35')]:_0x2df1fa[_0x0a8f('0x2e')];_0x172bc6[_0x0a8f('0x38')]=qs[_0x0a8f('0x39')](_0x208b61[_0x0a8f('0x31')][_0x0a8f('0x39')]);_0x172bc6[_0x0a8f('0x3a')]=qs[_0x0a8f('0x32')](_[_0x0a8f('0x4e')](_0x208b61[_0x0a8f('0x31')],_0x2df1fa[_0x0a8f('0x32')]));if(_0x208b61[_0x0a8f('0x31')][_0x0a8f('0x3b')]){_0x172bc6[_0x0a8f('0x3a')]=_[_0x0a8f('0x3c')](_0x172bc6[_0x0a8f('0x3a')],{'$or':_[_0x0a8f('0x2f')](_0x172bc6[_0x0a8f('0x35')],function(_0x59cb53){var _0x132bd4={};_0x132bd4[_0x59cb53]={'$like':'%'+_0x208b61[_0x0a8f('0x31')][_0x0a8f('0x3b')]+'%'};return _0x132bd4;})});}_0x172bc6=_[_0x0a8f('0x3c')]({},_0x172bc6,_0x208b61['options']);return _0x1e664b['getConfigurations'](_0x172bc6);}})[_0x0a8f('0x26')](function(_0xa2fa6){if(_0xa2fa6){_0x2b656b=_0xa2fa6[_0x0a8f('0x47')];if(!_0x208b61[_0x0a8f('0x31')][_0x0a8f('0x36')](_0x0a8f('0x37'))){_0x172bc6['limit']=qs[_0x0a8f('0x1f')](_0x208b61[_0x0a8f('0x31')][_0x0a8f('0x1f')]);_0x172bc6['offset']=qs[_0x0a8f('0x1d')](_0x208b61[_0x0a8f('0x31')][_0x0a8f('0x1d')]);}return _0x1e664b[_0x0a8f('0x4f')](_0x172bc6);}})[_0x0a8f('0x26')](function(_0x5c859c){if(_0x5c859c){return _0x5c859c?{'count':_0x2b656b,'rows':_0x5c859c}:null;}})[_0x0a8f('0x26')](respondWithResult(_0x1de76c,null))[_0x0a8f('0x44')](handleError(_0x1de76c,null));};exports['addConfiguration']=function(_0x2a66f8,_0x35bbed,_0x1c02d3){if(_0x2a66f8[_0x0a8f('0x49')]['id']){delete _0x2a66f8[_0x0a8f('0x49')]['id'];}return db[_0x0a8f('0x3f')][_0x0a8f('0x4c')]({'where':{'id':_0x2a66f8[_0x0a8f('0x46')]['id']}})[_0x0a8f('0x26')](handleEntityNotFound(_0x35bbed,null))[_0x0a8f('0x26')](function(_0x3ea59b){if(_0x3ea59b){_0x2a66f8[_0x0a8f('0x49')][_0x0a8f('0x50')]=_0x3ea59b['id'];_0x2a66f8[_0x0a8f('0x49')][_0x0a8f('0x51')]=integrations['getSubjects'](_0x2a66f8[_0x0a8f('0x49')]['channel'],_0x2a66f8['body'][_0x0a8f('0x2c')]);_0x2a66f8[_0x0a8f('0x49')][_0x0a8f('0x52')]=integrations[_0x0a8f('0x53')](_0x2a66f8['body']['channel'],_0x2a66f8['body'][_0x0a8f('0x2c')]);return db[_0x0a8f('0x4d')][_0x0a8f('0x48')](_0x2a66f8[_0x0a8f('0x49')],{'include':[{'model':db[_0x0a8f('0x54')],'as':_0x0a8f('0x51')},{'model':db['SugarcrmField'],'as':_0x0a8f('0x52')}]});}return null;})[_0x0a8f('0x26')](respondWithResult(_0x35bbed,null))[_0x0a8f('0x44')](handleError(_0x35bbed,null));};exports[_0x0a8f('0x55')]=function(_0x9add1d,_0x50218e,_0x5db4c0){var _0x4dff97='';var _0x254cb1=['id',_0x0a8f('0x28'),_0x0a8f('0x56'),_0x0a8f('0x57'),'description','date_start',_0x0a8f('0x58'),_0x0a8f('0x59'),_0x0a8f('0x5a'),_0x0a8f('0x5b'),'parent_name',_0x0a8f('0x5c')];return db[_0x0a8f('0x3f')][_0x0a8f('0x4c')]({'where':{'id':_0x9add1d[_0x0a8f('0x46')]['id']},'attributes':['id',_0x0a8f('0x5d'),_0x0a8f('0x5e'),'remoteUri']})[_0x0a8f('0x26')](handleEntityNotFound(_0x50218e,null))[_0x0a8f('0x26')](function(_0xa11df4){if(_0xa11df4){_0x4dff97=_0xa11df4[_0x0a8f('0x5f')];var _0x5a88cf=_0x4dff97[_0x0a8f('0x60')](-0x1);if(_0x5a88cf==='/'){_0x4dff97=_0x4dff97['substring'](0x0,_0x4dff97[_0x0a8f('0x61')](_0x5a88cf));}return rp({'method':_0x0a8f('0x62'),'uri':util[_0x0a8f('0x63')](_0x0a8f('0x64'),_0x4dff97,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x0a8f('0x65'),'input_type':_0x0a8f('0x66'),'response_type':_0x0a8f('0x66'),'rest_data':JSON[_0x0a8f('0x67')]({'user_auth':{'user_name':_0xa11df4['username'],'password':_0xa11df4[_0x0a8f('0x5e')],'encryption':_0x0a8f('0x68')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x0a8f('0x26')](function(_0x289d73){if(_0x289d73&&_0x289d73[_0x0a8f('0x28')]!==_0x0a8f('0x69')&&_0x289d73[_0x0a8f('0x28')]!==_0x0a8f('0x6a')){return rp({'method':_0x0a8f('0x62'),'uri':util[_0x0a8f('0x63')](_0x0a8f('0x64'),_0x4dff97,_0x0a8f('0x6b')),'json':!![],'form':{'method':_0x0a8f('0x6c'),'input_type':_0x0a8f('0x66'),'response_type':_0x0a8f('0x66'),'rest_data':JSON[_0x0a8f('0x67')]({'session':_0x289d73['id'],'module_name':_0x0a8f('0x6d')})}})[_0x0a8f('0x26')](function(_0x5ef6c8){if(_0x5ef6c8){var _0x2174d9=_[_0x0a8f('0x6e')](_0x5ef6c8[_0x0a8f('0x6f')]);_[_0x0a8f('0x70')](_0x2174d9,function(_0x1c0de3){return _0x254cb1[_0x0a8f('0x71')](_0x1c0de3['name']);});return{'count':_0x2174d9[_0x0a8f('0x47')],'rows':_['map'](_0x2174d9,function(_0x48fc03){return{'id':_0x48fc03['name'],'name':_0x48fc03['label'],'custom':_[_0x0a8f('0x72')](_0x48fc03[_0x0a8f('0x28')],'_c')?!![]:![],'options':_0x48fc03[_0x0a8f('0x3e')]?_[_0x0a8f('0x2f')](_['values'](_0x48fc03[_0x0a8f('0x3e')]),function(_0x483795){return{'name':_0x483795['value'],'value':_0x483795[_0x0a8f('0x28')]};}):[]};})};}})[_0x0a8f('0x26')](respondWithResult(_0x50218e,null))[_0x0a8f('0x44')](function(_0x190594){var _0x4d7b63=_0x9add1d['query'][_0x0a8f('0x73')]?0x1f4:_0x190594[_0x0a8f('0x74')]||0x1f4;logger[_0x0a8f('0x75')](_0x0a8f('0x76'),'getFields',_0x4d7b63,JSON[_0x0a8f('0x67')](_0x190594));delete _0x190594[_0x0a8f('0x28')];if(_0x4d7b63===0x191){_0x4d7b63=0x190;}_0x50218e['status'](_0x4d7b63)[_0x0a8f('0x29')](_0x9add1d[_0x0a8f('0x31')]['test']?{'message':_0x0a8f('0x77'),'statusCode':_0x190594['statusCode']}:_0x190594);});}else{var _0x3ef80e=0x1f4;_0x50218e[_0x0a8f('0x1a')](_0x3ef80e)[_0x0a8f('0x29')]({'message':'Wrong\x20credentials','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 a715b31..5e21fd7 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 _0x8a85=['int_sugarcrm_accounts','util','api','moment','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','define','SugarcrmAccount'];(function(_0x40f340,_0x261cde){var _0x170d3e=function(_0x49c443){while(--_0x49c443){_0x40f340['push'](_0x40f340['shift']());}};_0x170d3e(++_0x261cde);}(_0x8a85,0x64));var _0x58a8=function(_0x22559a,_0x22b33a){_0x22559a=_0x22559a-0x0;var _0x2b81d8=_0x8a85[_0x22559a];return _0x2b81d8;};'use strict';var _=require('lodash');var util=require(_0x58a8('0x0'));var logger=require('../../config/logger')(_0x58a8('0x1'));var moment=require(_0x58a8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x58a8('0x3'));var rimraf=require(_0x58a8('0x4'));var config=require(_0x58a8('0x5'));var attributes=require(_0x58a8('0x6'));var integrations=require(_0x58a8('0x7'));module['exports']=function(_0x5f37a6,_0x2b35d4){return _0x5f37a6[_0x58a8('0x8')](_0x58a8('0x9'),attributes,{'tableName':_0x58a8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe4f9=['rimraf','../../config/environment','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','api','moment'];(function(_0x66ae90,_0x1fbf4c){var _0x3a418e=function(_0x3618e2){while(--_0x3618e2){_0x66ae90['push'](_0x66ae90['shift']());}};_0x3a418e(++_0x1fbf4c);}(_0xe4f9,0xa8));var _0x9e4f=function(_0x57a822,_0x3e34f1){_0x57a822=_0x57a822-0x0;var _0x22b1d7=_0xe4f9[_0x57a822];return _0x22b1d7;};'use strict';var _=require(_0x9e4f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9e4f('0x1'));var moment=require(_0x9e4f('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9e4f('0x3'));var config=require(_0x9e4f('0x4'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x9e4f('0x5')]=function(_0x2da0dd,_0x503d35){return _0x2da0dd[_0x9e4f('0x6')](_0x9e4f('0x7'),attributes,{'tableName':_0x9e4f('0x8'),'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 99ed30b..bde2728 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 _0x6124=['then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowSugarcrmAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x380dd6,_0x2f62b3){var _0x59aba1=function(_0x1961f3){while(--_0x1961f3){_0x380dd6['push'](_0x380dd6['shift']());}};_0x59aba1(++_0x2f62b3);}(_0x6124,0x140));var _0x4612=function(_0xfb648e,_0xf94bae){_0xfb648e=_0xfb648e-0x0;var _0x3024a9=_0x6124[_0xfb648e];return _0x3024a9;};'use strict';var _=require(_0x4612('0x0'));var util=require(_0x4612('0x1'));var moment=require(_0x4612('0x2'));var BPromise=require('bluebird');var rs=require(_0x4612('0x3'));var fs=require('fs');var Redis=require(_0x4612('0x4'));var db=require(_0x4612('0x5'))['db'];var utils=require(_0x4612('0x6'));var logger=require(_0x4612('0x7'))(_0x4612('0x8'));var config=require(_0x4612('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4612('0xa')][_0x4612('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc31d0,_0x220bf8,_0x550249){return new BPromise(function(_0x151178,_0x3de0c8){return client[_0x4612('0xc')](_0xc31d0,_0x550249)[_0x4612('0xd')](function(_0x332280){logger[_0x4612('0xe')](_0x4612('0xf'),_0x220bf8,_0x4612('0x10'));logger[_0x4612('0x11')](_0x4612('0x12'),_0x220bf8,_0x4612('0x10'),JSON[_0x4612('0x13')](_0x332280));if(_0x332280[_0x4612('0x14')]){if(_0x332280[_0x4612('0x14')][_0x4612('0x15')]===0x1f4){logger[_0x4612('0x14')](_0x4612('0xf'),_0x220bf8,_0x332280['error'][_0x4612('0x16')]);return _0x3de0c8(_0x332280[_0x4612('0x14')][_0x4612('0x16')]);}logger[_0x4612('0x14')](_0x4612('0xf'),_0x220bf8,_0x332280['error']['message']);return _0x151178(_0x332280[_0x4612('0x14')]['message']);}else{logger['info'](_0x4612('0xf'),_0x220bf8,_0x4612('0x10'));_0x151178(_0x332280[_0x4612('0x17')][_0x4612('0x16')]);}})[_0x4612('0x18')](function(_0x2db1b4){logger[_0x4612('0x14')](_0x4612('0xf'),_0x220bf8,_0x2db1b4);_0x3de0c8(_0x2db1b4);});});}exports[_0x4612('0x19')]=function(_0x841ffd){var _0x2f8990=this;return new Promise(function(_0x1b4358,_0x2167ed){return db[_0x4612('0x1a')][_0x4612('0x1b')]({'raw':_0x841ffd['options']?_0x841ffd[_0x4612('0x1c')][_0x4612('0x1d')]===undefined?!![]:![]:!![],'where':_0x841ffd[_0x4612('0x1c')]?_0x841ffd[_0x4612('0x1c')][_0x4612('0x1e')]||null:null,'attributes':_0x841ffd[_0x4612('0x1c')]?_0x841ffd[_0x4612('0x1c')][_0x4612('0x1f')]||null:null,'limit':_0x841ffd[_0x4612('0x1c')]?_0x841ffd[_0x4612('0x1c')][_0x4612('0x20')]||null:null,'include':_0x841ffd[_0x4612('0x1c')]?_0x841ffd['options'][_0x4612('0x21')]?_[_0x4612('0x22')](_0x841ffd[_0x4612('0x1c')]['include'],function(_0x1da5fa){return{'model':db[_0x1da5fa[_0x4612('0x23')]],'as':_0x1da5fa['as'],'attributes':_0x1da5fa[_0x4612('0x1f')],'include':_0x1da5fa[_0x4612('0x21')]?_[_0x4612('0x22')](_0x1da5fa[_0x4612('0x21')],function(_0x1866a8){return{'model':db[_0x1866a8[_0x4612('0x23')]],'as':_0x1866a8['as'],'attributes':_0x1866a8[_0x4612('0x1f')],'include':_0x1866a8[_0x4612('0x21')]?_[_0x4612('0x22')](_0x1866a8['include'],function(_0x230110){return{'model':db[_0x230110[_0x4612('0x23')]],'as':_0x230110['as'],'attributes':_0x230110[_0x4612('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x4612('0xd')](function(_0x5b8786){logger['info'](_0x4612('0x19'),_0x841ffd);logger[_0x4612('0x11')]('GetSugarcrmAccount',_0x841ffd,JSON[_0x4612('0x13')](_0x5b8786));_0x1b4358(_0x5b8786);})[_0x4612('0x18')](function(_0x19e4d9){logger[_0x4612('0x14')](_0x4612('0x19'),_0x19e4d9[_0x4612('0x16')],_0x841ffd);_0x2167ed(_0x2f8990[_0x4612('0x14')](0x1f4,_0x19e4d9[_0x4612('0x16')]));});});};exports[_0x4612('0x24')]=function(_0x269d3e){var _0x5af8d2=this;return new Promise(function(_0x6c1b6d,_0x382a69){return db[_0x4612('0x1a')]['find']({'raw':_0x269d3e[_0x4612('0x1c')]?_0x269d3e[_0x4612('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x269d3e['options']?_0x269d3e[_0x4612('0x1c')]['where']||null:null,'attributes':_0x269d3e['options']?_0x269d3e[_0x4612('0x1c')][_0x4612('0x1f')]||null:null,'include':_0x269d3e[_0x4612('0x1c')]?_0x269d3e[_0x4612('0x1c')]['include']?_['map'](_0x269d3e[_0x4612('0x1c')][_0x4612('0x21')],function(_0x494ecf){return{'model':db[_0x494ecf[_0x4612('0x23')]],'as':_0x494ecf['as'],'attributes':_0x494ecf[_0x4612('0x1f')],'include':_0x494ecf[_0x4612('0x21')]?_[_0x4612('0x22')](_0x494ecf[_0x4612('0x21')],function(_0x49f43e){return{'model':db[_0x49f43e[_0x4612('0x23')]],'as':_0x49f43e['as'],'attributes':_0x49f43e[_0x4612('0x1f')],'include':_0x49f43e[_0x4612('0x21')]?_['map'](_0x49f43e['include'],function(_0x301b27){return{'model':db[_0x301b27['model']],'as':_0x301b27['as'],'attributes':_0x301b27[_0x4612('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b816e){logger[_0x4612('0xe')](_0x4612('0x24'),_0x269d3e);logger[_0x4612('0x11')](_0x4612('0x24'),_0x269d3e,JSON[_0x4612('0x13')](_0x1b816e));_0x6c1b6d(_0x1b816e);})[_0x4612('0x18')](function(_0x42ea03){logger[_0x4612('0x14')](_0x4612('0x24'),_0x42ea03[_0x4612('0x16')],_0x269d3e);_0x382a69(_0x5af8d2[_0x4612('0x14')](0x1f4,_0x42ea03['message']));});});}; \ No newline at end of file +var _0xfbca=['include','map','model','stringify','find','ShowSugarcrmAccount','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','message','SugarcrmAccount,\x20%s,\x20%s','result','catch','GetSugarcrmAccount','SugarcrmAccount','options','raw','where','attributes','limit'];(function(_0x2f9b0c,_0x4bf62a){var _0x4a3c19=function(_0x162314){while(--_0x162314){_0x2f9b0c['push'](_0x2f9b0c['shift']());}};_0x4a3c19(++_0x4bf62a);}(_0xfbca,0xb0));var _0xafbc=function(_0x3a5966,_0x1d60c4){_0x3a5966=_0x3a5966-0x0;var _0x8469b6=_0xfbca[_0x3a5966];return _0x8469b6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xafbc('0x0'));var BPromise=require('bluebird');var rs=require(_0xafbc('0x1'));var fs=require('fs');var Redis=require(_0xafbc('0x2'));var db=require(_0xafbc('0x3'))['db'];var utils=require(_0xafbc('0x4'));var logger=require(_0xafbc('0x5'))(_0xafbc('0x6'));var config=require(_0xafbc('0x7'));var jayson=require(_0xafbc('0x8'));var client=jayson['client'][_0xafbc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x46fb98,_0x91dec9,_0xbb7bcb){return new BPromise(function(_0x587dce,_0x587175){return client[_0xafbc('0xa')](_0x46fb98,_0xbb7bcb)[_0xafbc('0xb')](function(_0x55423c){logger[_0xafbc('0xc')]('SugarcrmAccount,\x20%s,\x20%s',_0x91dec9,_0xafbc('0xd'));logger[_0xafbc('0xe')](_0xafbc('0xf'),_0x91dec9,_0xafbc('0xd'),JSON['stringify'](_0x55423c));if(_0x55423c[_0xafbc('0x10')]){if(_0x55423c['error']['code']===0x1f4){logger[_0xafbc('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x91dec9,_0x55423c[_0xafbc('0x10')][_0xafbc('0x11')]);return _0x587175(_0x55423c['error'][_0xafbc('0x11')]);}logger[_0xafbc('0x10')](_0xafbc('0x12'),_0x91dec9,_0x55423c[_0xafbc('0x10')][_0xafbc('0x11')]);return _0x587dce(_0x55423c[_0xafbc('0x10')][_0xafbc('0x11')]);}else{logger['info'](_0xafbc('0x12'),_0x91dec9,'request\x20sent');_0x587dce(_0x55423c[_0xafbc('0x13')][_0xafbc('0x11')]);}})[_0xafbc('0x14')](function(_0x22a3b7){logger[_0xafbc('0x10')](_0xafbc('0x12'),_0x91dec9,_0x22a3b7);_0x587175(_0x22a3b7);});});}exports[_0xafbc('0x15')]=function(_0x2c391c){var _0x13e3fa=this;return new Promise(function(_0x4f8830,_0x57e1d2){return db[_0xafbc('0x16')]['findAll']({'raw':_0x2c391c['options']?_0x2c391c[_0xafbc('0x17')][_0xafbc('0x18')]===undefined?!![]:![]:!![],'where':_0x2c391c[_0xafbc('0x17')]?_0x2c391c[_0xafbc('0x17')][_0xafbc('0x19')]||null:null,'attributes':_0x2c391c[_0xafbc('0x17')]?_0x2c391c[_0xafbc('0x17')][_0xafbc('0x1a')]||null:null,'limit':_0x2c391c[_0xafbc('0x17')]?_0x2c391c['options'][_0xafbc('0x1b')]||null:null,'include':_0x2c391c[_0xafbc('0x17')]?_0x2c391c['options'][_0xafbc('0x1c')]?_[_0xafbc('0x1d')](_0x2c391c[_0xafbc('0x17')]['include'],function(_0x347d0c){return{'model':db[_0x347d0c[_0xafbc('0x1e')]],'as':_0x347d0c['as'],'attributes':_0x347d0c[_0xafbc('0x1a')],'include':_0x347d0c[_0xafbc('0x1c')]?_[_0xafbc('0x1d')](_0x347d0c['include'],function(_0x28869c){return{'model':db[_0x28869c[_0xafbc('0x1e')]],'as':_0x28869c['as'],'attributes':_0x28869c[_0xafbc('0x1a')],'include':_0x28869c[_0xafbc('0x1c')]?_[_0xafbc('0x1d')](_0x28869c['include'],function(_0x38a8c2){return{'model':db[_0x38a8c2[_0xafbc('0x1e')]],'as':_0x38a8c2['as'],'attributes':_0x38a8c2[_0xafbc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xafbc('0xb')](function(_0x5b768d){logger[_0xafbc('0xc')]('GetSugarcrmAccount',_0x2c391c);logger[_0xafbc('0xe')](_0xafbc('0x15'),_0x2c391c,JSON[_0xafbc('0x1f')](_0x5b768d));_0x4f8830(_0x5b768d);})[_0xafbc('0x14')](function(_0x2a88d7){logger[_0xafbc('0x10')](_0xafbc('0x15'),_0x2a88d7['message'],_0x2c391c);_0x57e1d2(_0x13e3fa[_0xafbc('0x10')](0x1f4,_0x2a88d7['message']));});});};exports['ShowSugarcrmAccount']=function(_0x1188dc){var _0x39551d=this;return new Promise(function(_0x6d8da2,_0xc663da){return db[_0xafbc('0x16')][_0xafbc('0x20')]({'raw':_0x1188dc['options']?_0x1188dc[_0xafbc('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x1188dc[_0xafbc('0x17')]?_0x1188dc[_0xafbc('0x17')]['where']||null:null,'attributes':_0x1188dc[_0xafbc('0x17')]?_0x1188dc[_0xafbc('0x17')][_0xafbc('0x1a')]||null:null,'include':_0x1188dc[_0xafbc('0x17')]?_0x1188dc[_0xafbc('0x17')]['include']?_[_0xafbc('0x1d')](_0x1188dc[_0xafbc('0x17')][_0xafbc('0x1c')],function(_0x2d421b){return{'model':db[_0x2d421b[_0xafbc('0x1e')]],'as':_0x2d421b['as'],'attributes':_0x2d421b[_0xafbc('0x1a')],'include':_0x2d421b[_0xafbc('0x1c')]?_['map'](_0x2d421b['include'],function(_0x4f03f0){return{'model':db[_0x4f03f0[_0xafbc('0x1e')]],'as':_0x4f03f0['as'],'attributes':_0x4f03f0[_0xafbc('0x1a')],'include':_0x4f03f0['include']?_[_0xafbc('0x1d')](_0x4f03f0[_0xafbc('0x1c')],function(_0x2003b3){return{'model':db[_0x2003b3[_0xafbc('0x1e')]],'as':_0x2003b3['as'],'attributes':_0x2003b3[_0xafbc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xafbc('0xb')](function(_0x49b490){logger['info']('ShowSugarcrmAccount',_0x1188dc);logger[_0xafbc('0xe')](_0xafbc('0x21'),_0x1188dc,JSON['stringify'](_0x49b490));_0x6d8da2(_0x49b490);})[_0xafbc('0x14')](function(_0x6330e7){logger['error'](_0xafbc('0x21'),_0x6330e7[_0xafbc('0x11')],_0x1188dc);_0xc663da(_0x39551d[_0xafbc('0x10')](0x1f4,_0x6330e7[_0xafbc('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 67d6f31..f99823c 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 _0xf5e2=['create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xf5e2,0xa7));var _0x2f5e=function(_0x5f2960,_0x225ff6){_0x5f2960=_0x5f2960-0x0;var _0x26ae6b=_0xf5e2[_0x5f2960];return _0x26ae6b;};'use strict';var multer=require(_0x2f5e('0x0'));var util=require(_0x2f5e('0x1'));var path=require(_0x2f5e('0x2'));var timeout=require(_0x2f5e('0x3'));var express=require(_0x2f5e('0x4'));var router=express['Router']();var fs_extra=require(_0x2f5e('0x5'));var auth=require(_0x2f5e('0x6'));var interaction=require(_0x2f5e('0x7'));var config=require(_0x2f5e('0x8'));var controller=require(_0x2f5e('0x9'));router[_0x2f5e('0xa')]('/',auth[_0x2f5e('0xb')](),controller[_0x2f5e('0xc')]);router[_0x2f5e('0xa')](_0x2f5e('0xd'),auth[_0x2f5e('0xb')](),controller[_0x2f5e('0xe')]);router[_0x2f5e('0xa')](_0x2f5e('0xf'),auth['isAuthenticated'](),controller[_0x2f5e('0x10')]);router[_0x2f5e('0xa')](_0x2f5e('0x11'),auth['isAuthenticated'](),controller[_0x2f5e('0x12')]);router[_0x2f5e('0xa')](_0x2f5e('0x13'),auth[_0x2f5e('0xb')](),controller[_0x2f5e('0x14')]);router[_0x2f5e('0x15')]('/',auth[_0x2f5e('0xb')](),controller[_0x2f5e('0x16')]);router['put'](_0x2f5e('0xd'),auth['isAuthenticated'](),controller[_0x2f5e('0x17')]);router[_0x2f5e('0x18')](_0x2f5e('0xd'),auth[_0x2f5e('0xb')](),controller[_0x2f5e('0x19')]);module[_0x2f5e('0x1a')]=router; \ No newline at end of file +var _0x2e77=['delete','multer','util','path','express','../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','getDescriptions','post','put','update'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x2e77,0x141));var _0x72e7=function(_0x6087c2,_0x37bef6){_0x6087c2=_0x6087c2-0x0;var _0x88e7c=_0x2e77[_0x6087c2];return _0x88e7c;};'use strict';var multer=require(_0x72e7('0x0'));var util=require(_0x72e7('0x1'));var path=require(_0x72e7('0x2'));var timeout=require('connect-timeout');var express=require(_0x72e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x72e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x72e7('0x5'));var controller=require(_0x72e7('0x6'));router[_0x72e7('0x7')]('/',auth[_0x72e7('0x8')](),controller[_0x72e7('0x9')]);router['get'](_0x72e7('0xa'),auth['isAuthenticated'](),controller[_0x72e7('0xb')]);router[_0x72e7('0x7')](_0x72e7('0xc'),auth[_0x72e7('0x8')](),controller[_0x72e7('0xd')]);router[_0x72e7('0x7')]('/:id/subjects',auth[_0x72e7('0x8')](),controller[_0x72e7('0xe')]);router[_0x72e7('0x7')]('/:id/descriptions',auth[_0x72e7('0x8')](),controller[_0x72e7('0xf')]);router[_0x72e7('0x10')]('/',auth[_0x72e7('0x8')](),controller['create']);router[_0x72e7('0x11')](_0x72e7('0xa'),auth[_0x72e7('0x8')](),controller[_0x72e7('0x12')]);router[_0x72e7('0x13')](_0x72e7('0xa'),auth[_0x72e7('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index e2b417e..a785212 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 _0xc256=['sequelize','exports','STRING'];(function(_0x449aea,_0x532e48){var _0x26a357=function(_0x65c0a0){while(--_0x65c0a0){_0x449aea['push'](_0x449aea['shift']());}};_0x26a357(++_0x532e48);}(_0xc256,0x1e6));var _0x6c25=function(_0x1d21bb,_0x66aa27){_0x1d21bb=_0x1d21bb-0x0;var _0x34cb4e=_0xc256[_0x1d21bb];return _0x34cb4e;};'use strict';var Sequelize=require(_0x6c25('0x0'));module[_0x6c25('0x1')]={'name':{'type':Sequelize[_0x6c25('0x2')]},'description':{'type':Sequelize[_0x6c25('0x2')]}}; \ No newline at end of file +var _0xd6c9=['sequelize','exports','STRING'];(function(_0x5c08cb,_0x456960){var _0x147907=function(_0x1da1be){while(--_0x1da1be){_0x5c08cb['push'](_0x5c08cb['shift']());}};_0x147907(++_0x456960);}(_0xd6c9,0x102));var _0x9d6c=function(_0x53d147,_0x259f9e){_0x53d147=_0x53d147-0x0;var _0x3bc064=_0xd6c9[_0x53d147];return _0x3bc064;};'use strict';var Sequelize=require(_0x9d6c('0x0'));module[_0x9d6c('0x1')]={'name':{'type':Sequelize[_0x9d6c('0x2')]},'description':{'type':Sequelize[_0x9d6c('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index fcdfb9d..2cfb8c6 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 _0xb2e8=['limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','keys','include','find','create','body','catch','params','getFields','findOne','SugarcrmField','order','pick','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined'];(function(_0x4f288e,_0x31286a){var _0x5087db=function(_0x1cbb9f){while(--_0x1cbb9f){_0x4f288e['push'](_0x4f288e['shift']());}};_0x5087db(++_0x31286a);}(_0xb2e8,0xdb));var _0x8b2e=function(_0xba6293,_0x2e9a59){_0xba6293=_0xba6293-0x0;var _0x43c501=_0xb2e8[_0xba6293];return _0x43c501;};'use strict';var emlformat=require(_0x8b2e('0x0'));var rimraf=require(_0x8b2e('0x1'));var zipdir=require(_0x8b2e('0x2'));var jsonpatch=require(_0x8b2e('0x3'));var rp=require(_0x8b2e('0x4'));var moment=require('moment');var BPromise=require(_0x8b2e('0x5'));var Mustache=require(_0x8b2e('0x6'));var util=require(_0x8b2e('0x7'));var path=require('path');var sox=require(_0x8b2e('0x8'));var csv=require('to-csv');var ejs=require(_0x8b2e('0x9'));var fs=require('fs');var fs_extra=require(_0x8b2e('0xa'));var _=require(_0x8b2e('0xb'));var squel=require(_0x8b2e('0xc'));var crypto=require('crypto');var jsforce=require(_0x8b2e('0xd'));var deskjs=require(_0x8b2e('0xe'));var toCsv=require(_0x8b2e('0xf'));var querystring=require(_0x8b2e('0x10'));var Papa=require(_0x8b2e('0x11'));var Redis=require('ioredis');var authService=require(_0x8b2e('0x12'));var qs=require(_0x8b2e('0x13'));var as=require(_0x8b2e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8b2e('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x8b2e('0x16'));var licenseUtil=require(_0x8b2e('0x17'));var db=require(_0x8b2e('0x18'))['db'];function respondWithStatusCode(_0x2b5bd3,_0x3d8824){_0x3d8824=_0x3d8824||0xcc;return function(_0x1472ba){if(_0x1472ba){return _0x2b5bd3['sendStatus'](_0x3d8824);}return _0x2b5bd3[_0x8b2e('0x19')](_0x3d8824)[_0x8b2e('0x1a')]();};}function respondWithResult(_0x3ade61,_0x302d5e){_0x302d5e=_0x302d5e||0xc8;return function(_0x568bf8){if(_0x568bf8){return _0x3ade61[_0x8b2e('0x19')](_0x302d5e)[_0x8b2e('0x1b')](_0x568bf8);}};}function respondWithFilteredResult(_0x3fcfcf,_0x2e3059){return function(_0x4d5a65){if(_0x4d5a65){var _0x3c36bd=typeof _0x2e3059[_0x8b2e('0x1c')]===_0x8b2e('0x1d')&&typeof _0x2e3059[_0x8b2e('0x1e')]===_0x8b2e('0x1d');var _0xc94219=_0x4d5a65[_0x8b2e('0x1f')];var _0x4c1bae=_0x3c36bd?0x0:_0x2e3059['offset'];var _0x189515=_0x3c36bd?_0x4d5a65[_0x8b2e('0x1f')]:_0x2e3059[_0x8b2e('0x1c')]+_0x2e3059[_0x8b2e('0x1e')];var _0x56ba2a;if(_0x189515>=_0xc94219){_0x189515=_0xc94219;_0x56ba2a=0xc8;}else{_0x56ba2a=0xce;}_0x3fcfcf[_0x8b2e('0x19')](_0x56ba2a);return _0x3fcfcf[_0x8b2e('0x20')](_0x8b2e('0x21'),_0x4c1bae+'-'+_0x189515+'/'+_0xc94219)[_0x8b2e('0x1b')](_0x4d5a65);}return null;};}function patchUpdates(_0x2c0363){return function(_0x239306){try{jsonpatch[_0x8b2e('0x22')](_0x239306,_0x2c0363,!![]);}catch(_0x307812){return BPromise[_0x8b2e('0x23')](_0x307812);}return _0x239306[_0x8b2e('0x24')]();};}function saveUpdates(_0x28cc14,_0x30ba8c){return function(_0x46d1f8){if(_0x46d1f8){return _0x46d1f8[_0x8b2e('0x25')](_0x28cc14)[_0x8b2e('0x26')](function(_0x2d5875){return _0x2d5875;});}return null;};}function removeEntity(_0x21242b,_0x2e4cd7){return function(_0x1ce759){if(_0x1ce759){return _0x1ce759[_0x8b2e('0x27')]()[_0x8b2e('0x26')](function(){_0x21242b[_0x8b2e('0x19')](0xcc)[_0x8b2e('0x1a')]();});}};}function handleEntityNotFound(_0x125167,_0x2933fc){return function(_0x219e74){if(!_0x219e74){_0x125167[_0x8b2e('0x28')](0x194);}return _0x219e74;};}function handleError(_0x4005fc,_0x31320b){_0x31320b=_0x31320b||0x1f4;return function(_0x1e373f){logger[_0x8b2e('0x29')](_0x1e373f[_0x8b2e('0x2a')]);if(_0x1e373f[_0x8b2e('0x2b')]){delete _0x1e373f[_0x8b2e('0x2b')];}_0x4005fc[_0x8b2e('0x19')](_0x31320b)[_0x8b2e('0x2c')](_0x1e373f);};}exports[_0x8b2e('0x2d')]=function(_0x253876,_0x24ab92){var _0x38b6f8={},_0x202a76={},_0x3199e8={'count':0x0,'rows':[]};var _0x437fb9=_[_0x8b2e('0x2e')](db[_0x8b2e('0x2f')][_0x8b2e('0x30')],function(_0x93b01c){return{'name':_0x93b01c['fieldName'],'type':_0x93b01c[_0x8b2e('0x31')]['key']};});_0x202a76[_0x8b2e('0x32')]=_['map'](_0x437fb9,_0x8b2e('0x2b'));_0x202a76[_0x8b2e('0x33')]=_['keys'](_0x253876[_0x8b2e('0x33')]);_0x202a76[_0x8b2e('0x34')]=_[_0x8b2e('0x35')](_0x202a76[_0x8b2e('0x32')],_0x202a76[_0x8b2e('0x33')]);_0x38b6f8[_0x8b2e('0x36')]=_['intersection'](_0x202a76[_0x8b2e('0x32')],qs[_0x8b2e('0x37')](_0x253876['query'][_0x8b2e('0x37')]));_0x38b6f8[_0x8b2e('0x36')]=_0x38b6f8['attributes'][_0x8b2e('0x38')]?_0x38b6f8[_0x8b2e('0x36')]:_0x202a76[_0x8b2e('0x32')];if(!_0x253876[_0x8b2e('0x33')][_0x8b2e('0x39')]('nolimit')){_0x38b6f8[_0x8b2e('0x1e')]=qs[_0x8b2e('0x1e')](_0x253876[_0x8b2e('0x33')]['limit']);_0x38b6f8['offset']=qs[_0x8b2e('0x1c')](_0x253876[_0x8b2e('0x33')][_0x8b2e('0x1c')]);}_0x38b6f8['order']=qs['sort'](_0x253876[_0x8b2e('0x33')][_0x8b2e('0x3a')]);_0x38b6f8[_0x8b2e('0x3b')]=qs[_0x8b2e('0x34')](_['pick'](_0x253876[_0x8b2e('0x33')],_0x202a76[_0x8b2e('0x34')]),_0x437fb9);if(_0x253876['query'][_0x8b2e('0x3c')]){_0x38b6f8[_0x8b2e('0x3b')]=_[_0x8b2e('0x3d')](_0x38b6f8[_0x8b2e('0x3b')],{'$or':_[_0x8b2e('0x2e')](_0x437fb9,function(_0x5e5435){if(_0x5e5435[_0x8b2e('0x31')]!==_0x8b2e('0x3e')){var _0x52feb9={};_0x52feb9[_0x5e5435[_0x8b2e('0x2b')]]={'$like':'%'+_0x253876['query'][_0x8b2e('0x3c')]+'%'};return _0x52feb9;}})});}_0x38b6f8=_[_0x8b2e('0x3d')]({},_0x38b6f8,_0x253876[_0x8b2e('0x3f')]);var _0x4b0248={'where':_0x38b6f8['where']};return db[_0x8b2e('0x2f')][_0x8b2e('0x1f')](_0x4b0248)[_0x8b2e('0x26')](function(_0xd21236){_0x3199e8[_0x8b2e('0x1f')]=_0xd21236;if(_0x253876[_0x8b2e('0x33')][_0x8b2e('0x40')]){_0x38b6f8['include']=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x8b2e('0x41')](_0x38b6f8);})['then'](function(_0x204398){_0x3199e8[_0x8b2e('0x42')]=_0x204398;return _0x3199e8;})['then'](respondWithFilteredResult(_0x24ab92,_0x38b6f8))['catch'](handleError(_0x24ab92,null));};exports[_0x8b2e('0x43')]=function(_0x4bd1cc,_0x2cd4bd){var _0x1740bc={'raw':![],'where':{'id':_0x4bd1cc['params']['id']}},_0x3d3f09={};_0x3d3f09[_0x8b2e('0x32')]=_[_0x8b2e('0x44')](db[_0x8b2e('0x2f')][_0x8b2e('0x30')]);_0x3d3f09[_0x8b2e('0x33')]=_['keys'](_0x4bd1cc['query']);_0x3d3f09[_0x8b2e('0x34')]=_[_0x8b2e('0x35')](_0x3d3f09[_0x8b2e('0x32')],_0x3d3f09[_0x8b2e('0x33')]);_0x1740bc['attributes']=_[_0x8b2e('0x35')](_0x3d3f09['model'],qs[_0x8b2e('0x37')](_0x4bd1cc[_0x8b2e('0x33')][_0x8b2e('0x37')]));_0x1740bc['attributes']=_0x1740bc['attributes'][_0x8b2e('0x38')]?_0x1740bc[_0x8b2e('0x36')]:_0x3d3f09[_0x8b2e('0x32')];if(_0x4bd1cc['query']['includeAll']){_0x1740bc[_0x8b2e('0x45')]=[{'all':!![]}];}_0x1740bc=_[_0x8b2e('0x3d')]({},_0x1740bc,_0x4bd1cc[_0x8b2e('0x3f')]);return db[_0x8b2e('0x2f')][_0x8b2e('0x46')](_0x1740bc)[_0x8b2e('0x26')](handleEntityNotFound(_0x2cd4bd,null))[_0x8b2e('0x26')](respondWithResult(_0x2cd4bd,null))['catch'](handleError(_0x2cd4bd,null));};exports['create']=function(_0x4588ad,_0x26e784){return db[_0x8b2e('0x2f')][_0x8b2e('0x47')](_0x4588ad[_0x8b2e('0x48')],{})['then'](respondWithResult(_0x26e784,0xc9))[_0x8b2e('0x49')](handleError(_0x26e784,null));};exports['update']=function(_0x2c24f6,_0xaabf9a){if(_0x2c24f6[_0x8b2e('0x48')]['id']){delete _0x2c24f6['body']['id'];}return db[_0x8b2e('0x2f')][_0x8b2e('0x46')]({'where':{'id':_0x2c24f6[_0x8b2e('0x4a')]['id']}})[_0x8b2e('0x26')](handleEntityNotFound(_0xaabf9a,null))['then'](saveUpdates(_0x2c24f6[_0x8b2e('0x48')],null))[_0x8b2e('0x26')](respondWithResult(_0xaabf9a,null))[_0x8b2e('0x49')](handleError(_0xaabf9a,null));};exports[_0x8b2e('0x27')]=function(_0x50cdbb,_0x17a917){return db[_0x8b2e('0x2f')]['find']({'where':{'id':_0x50cdbb[_0x8b2e('0x4a')]['id']}})[_0x8b2e('0x26')](handleEntityNotFound(_0x17a917,null))[_0x8b2e('0x26')](removeEntity(_0x17a917,null))[_0x8b2e('0x49')](handleError(_0x17a917,null));};exports[_0x8b2e('0x4b')]=function(_0x1ed866,_0x307913,_0x367878){var _0x5b404d={};var _0x4b7cbc={};var _0x3e0bdd;var _0x2c7dae;return db[_0x8b2e('0x2f')][_0x8b2e('0x4c')]({'where':{'id':_0x1ed866[_0x8b2e('0x4a')]['id']}})[_0x8b2e('0x26')](handleEntityNotFound(_0x307913,null))[_0x8b2e('0x26')](function(_0x3e2f2b){if(_0x3e2f2b){_0x3e0bdd=_0x3e2f2b;_0x4b7cbc[_0x8b2e('0x32')]=_[_0x8b2e('0x44')](db[_0x8b2e('0x4d')]['rawAttributes']);_0x4b7cbc[_0x8b2e('0x33')]=_['keys'](_0x1ed866[_0x8b2e('0x33')]);_0x4b7cbc['filters']=_[_0x8b2e('0x35')](_0x4b7cbc[_0x8b2e('0x32')],_0x4b7cbc[_0x8b2e('0x33')]);_0x5b404d[_0x8b2e('0x36')]=_['intersection'](_0x4b7cbc[_0x8b2e('0x32')],qs[_0x8b2e('0x37')](_0x1ed866[_0x8b2e('0x33')][_0x8b2e('0x37')]));_0x5b404d['attributes']=_0x5b404d['attributes'][_0x8b2e('0x38')]?_0x5b404d[_0x8b2e('0x36')]:_0x4b7cbc[_0x8b2e('0x32')];_0x5b404d[_0x8b2e('0x4e')]=qs[_0x8b2e('0x3a')](_0x1ed866[_0x8b2e('0x33')][_0x8b2e('0x3a')]);_0x5b404d[_0x8b2e('0x3b')]=qs[_0x8b2e('0x34')](_[_0x8b2e('0x4f')](_0x1ed866['query'],_0x4b7cbc[_0x8b2e('0x34')]));if(_0x1ed866[_0x8b2e('0x33')][_0x8b2e('0x3c')]){_0x5b404d['where']=_[_0x8b2e('0x3d')](_0x5b404d['where'],{'$or':_['map'](_0x5b404d[_0x8b2e('0x36')],function(_0x3dbd22){var _0x5af49e={};_0x5af49e[_0x3dbd22]={'$like':'%'+_0x1ed866['query']['filter']+'%'};return _0x5af49e;})});}_0x5b404d=_[_0x8b2e('0x3d')]({},_0x5b404d,_0x1ed866['options']);return _0x3e0bdd['getFields'](_0x5b404d);}})['then'](function(_0xeb7e3e){if(_0xeb7e3e){_0x2c7dae=_0xeb7e3e[_0x8b2e('0x38')];if(!_0x1ed866[_0x8b2e('0x33')][_0x8b2e('0x39')](_0x8b2e('0x50'))){_0x5b404d['limit']=qs[_0x8b2e('0x1e')](_0x1ed866['query'][_0x8b2e('0x1e')]);_0x5b404d[_0x8b2e('0x1c')]=qs[_0x8b2e('0x1c')](_0x1ed866['query'][_0x8b2e('0x1c')]);}return _0x3e0bdd[_0x8b2e('0x4b')](_0x5b404d);}})['then'](function(_0x59a96d){if(_0x59a96d){return _0x59a96d?{'count':_0x2c7dae,'rows':_0x59a96d}:null;}})[_0x8b2e('0x26')](respondWithResult(_0x307913,null))[_0x8b2e('0x49')](handleError(_0x307913,null));};exports[_0x8b2e('0x51')]=function(_0x558015,_0x59388a,_0x19dc52){var _0x2cdb24={};var _0x2c68dd={};var _0x130766;var _0x288f69;return db['SugarcrmConfiguration'][_0x8b2e('0x4c')]({'where':{'id':_0x558015[_0x8b2e('0x4a')]['id']}})[_0x8b2e('0x26')](handleEntityNotFound(_0x59388a,null))[_0x8b2e('0x26')](function(_0x436db0){if(_0x436db0){_0x130766=_0x436db0;_0x2c68dd[_0x8b2e('0x32')]=_['keys'](db[_0x8b2e('0x4d')][_0x8b2e('0x30')]);_0x2c68dd[_0x8b2e('0x33')]=_[_0x8b2e('0x44')](_0x558015[_0x8b2e('0x33')]);_0x2c68dd['filters']=_['intersection'](_0x2c68dd[_0x8b2e('0x32')],_0x2c68dd[_0x8b2e('0x33')]);_0x2cdb24[_0x8b2e('0x36')]=_[_0x8b2e('0x35')](_0x2c68dd[_0x8b2e('0x32')],qs['fields'](_0x558015['query'][_0x8b2e('0x37')]));_0x2cdb24[_0x8b2e('0x36')]=_0x2cdb24['attributes']['length']?_0x2cdb24[_0x8b2e('0x36')]:_0x2c68dd[_0x8b2e('0x32')];_0x2cdb24['order']=qs[_0x8b2e('0x3a')](_0x558015[_0x8b2e('0x33')][_0x8b2e('0x3a')]);_0x2cdb24[_0x8b2e('0x3b')]=qs['filters'](_[_0x8b2e('0x4f')](_0x558015[_0x8b2e('0x33')],_0x2c68dd[_0x8b2e('0x34')]));if(_0x558015['query']['filter']){_0x2cdb24[_0x8b2e('0x3b')]=_[_0x8b2e('0x3d')](_0x2cdb24[_0x8b2e('0x3b')],{'$or':_[_0x8b2e('0x2e')](_0x2cdb24[_0x8b2e('0x36')],function(_0x2c8a09){var _0x534edb={};_0x534edb[_0x2c8a09]={'$like':'%'+_0x558015[_0x8b2e('0x33')]['filter']+'%'};return _0x534edb;})});}_0x2cdb24=_[_0x8b2e('0x3d')]({},_0x2cdb24,_0x558015[_0x8b2e('0x3f')]);return _0x130766['getSubjects'](_0x2cdb24);}})[_0x8b2e('0x26')](function(_0x24bdd8){if(_0x24bdd8){_0x288f69=_0x24bdd8[_0x8b2e('0x38')];if(!_0x558015[_0x8b2e('0x33')]['hasOwnProperty'](_0x8b2e('0x50'))){_0x2cdb24[_0x8b2e('0x1e')]=qs['limit'](_0x558015[_0x8b2e('0x33')][_0x8b2e('0x1e')]);_0x2cdb24[_0x8b2e('0x1c')]=qs[_0x8b2e('0x1c')](_0x558015['query']['offset']);}return _0x130766[_0x8b2e('0x51')](_0x2cdb24);}})[_0x8b2e('0x26')](function(_0x4c1eed){if(_0x4c1eed){return _0x4c1eed?{'count':_0x288f69,'rows':_0x4c1eed}:null;}})[_0x8b2e('0x26')](respondWithResult(_0x59388a,null))[_0x8b2e('0x49')](handleError(_0x59388a,null));};exports[_0x8b2e('0x52')]=function(_0x1a1c16,_0x1fa125,_0xa4461e){var _0x2fe6d7={};var _0x50756b={};var _0x586b21;var _0x244a66;return db[_0x8b2e('0x2f')][_0x8b2e('0x4c')]({'where':{'id':_0x1a1c16['params']['id']}})['then'](handleEntityNotFound(_0x1fa125,null))[_0x8b2e('0x26')](function(_0x482c30){if(_0x482c30){_0x586b21=_0x482c30;_0x50756b[_0x8b2e('0x32')]=_[_0x8b2e('0x44')](db[_0x8b2e('0x4d')][_0x8b2e('0x30')]);_0x50756b[_0x8b2e('0x33')]=_[_0x8b2e('0x44')](_0x1a1c16[_0x8b2e('0x33')]);_0x50756b[_0x8b2e('0x34')]=_['intersection'](_0x50756b[_0x8b2e('0x32')],_0x50756b['query']);_0x2fe6d7[_0x8b2e('0x36')]=_[_0x8b2e('0x35')](_0x50756b[_0x8b2e('0x32')],qs[_0x8b2e('0x37')](_0x1a1c16[_0x8b2e('0x33')][_0x8b2e('0x37')]));_0x2fe6d7['attributes']=_0x2fe6d7[_0x8b2e('0x36')]['length']?_0x2fe6d7[_0x8b2e('0x36')]:_0x50756b[_0x8b2e('0x32')];_0x2fe6d7['order']=qs[_0x8b2e('0x3a')](_0x1a1c16[_0x8b2e('0x33')][_0x8b2e('0x3a')]);_0x2fe6d7['where']=qs[_0x8b2e('0x34')](_[_0x8b2e('0x4f')](_0x1a1c16['query'],_0x50756b['filters']));if(_0x1a1c16[_0x8b2e('0x33')][_0x8b2e('0x3c')]){_0x2fe6d7[_0x8b2e('0x3b')]=_[_0x8b2e('0x3d')](_0x2fe6d7[_0x8b2e('0x3b')],{'$or':_['map'](_0x2fe6d7['attributes'],function(_0x38e282){var _0x44dc93={};_0x44dc93[_0x38e282]={'$like':'%'+_0x1a1c16[_0x8b2e('0x33')][_0x8b2e('0x3c')]+'%'};return _0x44dc93;})});}_0x2fe6d7=_[_0x8b2e('0x3d')]({},_0x2fe6d7,_0x1a1c16[_0x8b2e('0x3f')]);return _0x586b21[_0x8b2e('0x52')](_0x2fe6d7);}})['then'](function(_0xd9caca){if(_0xd9caca){_0x244a66=_0xd9caca[_0x8b2e('0x38')];if(!_0x1a1c16['query'][_0x8b2e('0x39')](_0x8b2e('0x50'))){_0x2fe6d7[_0x8b2e('0x1e')]=qs[_0x8b2e('0x1e')](_0x1a1c16[_0x8b2e('0x33')]['limit']);_0x2fe6d7[_0x8b2e('0x1c')]=qs['offset'](_0x1a1c16['query']['offset']);}return _0x586b21[_0x8b2e('0x52')](_0x2fe6d7);}})['then'](function(_0x58fb4f){if(_0x58fb4f){return _0x58fb4f?{'count':_0x244a66,'rows':_0x58fb4f}:null;}})[_0x8b2e('0x26')](respondWithResult(_0x1fa125,null))['catch'](handleError(_0x1fa125,null));}; \ No newline at end of file +var _0x7ea7=['query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','rawAttributes','find','catch','create','body','params','getFields','SugarcrmField','hasOwnProperty','findOne','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','error','name','send','index','map','SugarcrmConfiguration','fieldName','type','model'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x7ea7,0x6c));var _0x77ea=function(_0x59eacf,_0x56ec4a){_0x59eacf=_0x59eacf-0x0;var _0x5d74f2=_0x7ea7[_0x59eacf];return _0x5d74f2;};'use strict';var emlformat=require(_0x77ea('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x77ea('0x1'));var jsonpatch=require(_0x77ea('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x77ea('0x3'));var util=require(_0x77ea('0x4'));var path=require(_0x77ea('0x5'));var sox=require(_0x77ea('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x77ea('0x7'));var _=require(_0x77ea('0x8'));var squel=require(_0x77ea('0x9'));var crypto=require('crypto');var jsforce=require(_0x77ea('0xa'));var deskjs=require(_0x77ea('0xb'));var toCsv=require('to-csv');var querystring=require(_0x77ea('0xc'));var Papa=require('papaparse');var Redis=require(_0x77ea('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x77ea('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x77ea('0xf'));var logger=require(_0x77ea('0x10'))(_0x77ea('0x11'));var utils=require(_0x77ea('0x12'));var config=require(_0x77ea('0x13'));var licenseUtil=require(_0x77ea('0x14'));var db=require(_0x77ea('0x15'))['db'];function respondWithStatusCode(_0x3e3c20,_0x1ced1){_0x1ced1=_0x1ced1||0xcc;return function(_0x132e36){if(_0x132e36){return _0x3e3c20[_0x77ea('0x16')](_0x1ced1);}return _0x3e3c20[_0x77ea('0x17')](_0x1ced1)['end']();};}function respondWithResult(_0xf5ea13,_0x1f0bd5){_0x1f0bd5=_0x1f0bd5||0xc8;return function(_0x37305f){if(_0x37305f){return _0xf5ea13[_0x77ea('0x17')](_0x1f0bd5)['json'](_0x37305f);}};}function respondWithFilteredResult(_0x17adf3,_0x1b9b53){return function(_0x125ff2){if(_0x125ff2){var _0x58b605=typeof _0x1b9b53[_0x77ea('0x18')]==='undefined'&&typeof _0x1b9b53[_0x77ea('0x19')]===_0x77ea('0x1a');var _0x3adee8=_0x125ff2[_0x77ea('0x1b')];var _0x1d8ba4=_0x58b605?0x0:_0x1b9b53['offset'];var _0x14a162=_0x58b605?_0x125ff2[_0x77ea('0x1b')]:_0x1b9b53['offset']+_0x1b9b53[_0x77ea('0x19')];var _0x3f1b80;if(_0x14a162>=_0x3adee8){_0x14a162=_0x3adee8;_0x3f1b80=0xc8;}else{_0x3f1b80=0xce;}_0x17adf3[_0x77ea('0x17')](_0x3f1b80);return _0x17adf3[_0x77ea('0x1c')]('Content-Range',_0x1d8ba4+'-'+_0x14a162+'/'+_0x3adee8)['json'](_0x125ff2);}return null;};}function patchUpdates(_0x54e024){return function(_0x1cd84d){try{jsonpatch[_0x77ea('0x1d')](_0x1cd84d,_0x54e024,!![]);}catch(_0x476c03){return BPromise[_0x77ea('0x1e')](_0x476c03);}return _0x1cd84d[_0x77ea('0x1f')]();};}function saveUpdates(_0x56f527,_0xda700f){return function(_0x49dbc8){if(_0x49dbc8){return _0x49dbc8[_0x77ea('0x20')](_0x56f527)[_0x77ea('0x21')](function(_0x563fc6){return _0x563fc6;});}return null;};}function removeEntity(_0x2c4e6d,_0x2d6540){return function(_0x2a6831){if(_0x2a6831){return _0x2a6831[_0x77ea('0x22')]()[_0x77ea('0x21')](function(){_0x2c4e6d[_0x77ea('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x446839,_0x1ee03c){return function(_0x17c179){if(!_0x17c179){_0x446839[_0x77ea('0x16')](0x194);}return _0x17c179;};}function handleError(_0x57a161,_0x19f376){_0x19f376=_0x19f376||0x1f4;return function(_0x5f00dd){logger[_0x77ea('0x23')](_0x5f00dd['stack']);if(_0x5f00dd[_0x77ea('0x24')]){delete _0x5f00dd['name'];}_0x57a161[_0x77ea('0x17')](_0x19f376)[_0x77ea('0x25')](_0x5f00dd);};}exports[_0x77ea('0x26')]=function(_0x13b8cd,_0x32a99e){var _0x2a5bdc={},_0x3cedd2={},_0x1011a3={'count':0x0,'rows':[]};var _0x12a465=_[_0x77ea('0x27')](db[_0x77ea('0x28')]['rawAttributes'],function(_0x16bd7d){return{'name':_0x16bd7d[_0x77ea('0x29')],'type':_0x16bd7d[_0x77ea('0x2a')]['key']};});_0x3cedd2[_0x77ea('0x2b')]=_['map'](_0x12a465,'name');_0x3cedd2[_0x77ea('0x2c')]=_[_0x77ea('0x2d')](_0x13b8cd[_0x77ea('0x2c')]);_0x3cedd2[_0x77ea('0x2e')]=_[_0x77ea('0x2f')](_0x3cedd2[_0x77ea('0x2b')],_0x3cedd2['query']);_0x2a5bdc[_0x77ea('0x30')]=_['intersection'](_0x3cedd2[_0x77ea('0x2b')],qs[_0x77ea('0x31')](_0x13b8cd[_0x77ea('0x2c')]['fields']));_0x2a5bdc[_0x77ea('0x30')]=_0x2a5bdc[_0x77ea('0x30')][_0x77ea('0x32')]?_0x2a5bdc[_0x77ea('0x30')]:_0x3cedd2[_0x77ea('0x2b')];if(!_0x13b8cd[_0x77ea('0x2c')]['hasOwnProperty'](_0x77ea('0x33'))){_0x2a5bdc[_0x77ea('0x19')]=qs['limit'](_0x13b8cd[_0x77ea('0x2c')][_0x77ea('0x19')]);_0x2a5bdc[_0x77ea('0x18')]=qs['offset'](_0x13b8cd[_0x77ea('0x2c')][_0x77ea('0x18')]);}_0x2a5bdc[_0x77ea('0x34')]=qs[_0x77ea('0x35')](_0x13b8cd[_0x77ea('0x2c')][_0x77ea('0x35')]);_0x2a5bdc[_0x77ea('0x36')]=qs[_0x77ea('0x2e')](_[_0x77ea('0x37')](_0x13b8cd['query'],_0x3cedd2[_0x77ea('0x2e')]),_0x12a465);if(_0x13b8cd[_0x77ea('0x2c')]['filter']){_0x2a5bdc[_0x77ea('0x36')]=_[_0x77ea('0x38')](_0x2a5bdc[_0x77ea('0x36')],{'$or':_[_0x77ea('0x27')](_0x12a465,function(_0x16b47b){if(_0x16b47b[_0x77ea('0x2a')]!==_0x77ea('0x39')){var _0x620ca9={};_0x620ca9[_0x16b47b[_0x77ea('0x24')]]={'$like':'%'+_0x13b8cd[_0x77ea('0x2c')][_0x77ea('0x3a')]+'%'};return _0x620ca9;}})});}_0x2a5bdc=_[_0x77ea('0x38')]({},_0x2a5bdc,_0x13b8cd[_0x77ea('0x3b')]);var _0xf9276d={'where':_0x2a5bdc[_0x77ea('0x36')]};return db[_0x77ea('0x28')][_0x77ea('0x1b')](_0xf9276d)[_0x77ea('0x21')](function(_0x53b820){_0x1011a3[_0x77ea('0x1b')]=_0x53b820;if(_0x13b8cd[_0x77ea('0x2c')][_0x77ea('0x3c')]){_0x2a5bdc[_0x77ea('0x3d')]=[{'all':!![]}];}return db[_0x77ea('0x28')][_0x77ea('0x3e')](_0x2a5bdc);})[_0x77ea('0x21')](function(_0x2aaafc){_0x1011a3['rows']=_0x2aaafc;return _0x1011a3;})[_0x77ea('0x21')](respondWithFilteredResult(_0x32a99e,_0x2a5bdc))['catch'](handleError(_0x32a99e,null));};exports[_0x77ea('0x3f')]=function(_0x35b9b3,_0x165f69){var _0x39d196={'raw':![],'where':{'id':_0x35b9b3['params']['id']}},_0x4e783a={};_0x4e783a[_0x77ea('0x2b')]=_[_0x77ea('0x2d')](db[_0x77ea('0x28')][_0x77ea('0x40')]);_0x4e783a[_0x77ea('0x2c')]=_[_0x77ea('0x2d')](_0x35b9b3[_0x77ea('0x2c')]);_0x4e783a['filters']=_[_0x77ea('0x2f')](_0x4e783a[_0x77ea('0x2b')],_0x4e783a['query']);_0x39d196['attributes']=_[_0x77ea('0x2f')](_0x4e783a[_0x77ea('0x2b')],qs[_0x77ea('0x31')](_0x35b9b3[_0x77ea('0x2c')]['fields']));_0x39d196[_0x77ea('0x30')]=_0x39d196[_0x77ea('0x30')][_0x77ea('0x32')]?_0x39d196[_0x77ea('0x30')]:_0x4e783a['model'];if(_0x35b9b3[_0x77ea('0x2c')][_0x77ea('0x3c')]){_0x39d196['include']=[{'all':!![]}];}_0x39d196=_['merge']({},_0x39d196,_0x35b9b3[_0x77ea('0x3b')]);return db[_0x77ea('0x28')][_0x77ea('0x41')](_0x39d196)[_0x77ea('0x21')](handleEntityNotFound(_0x165f69,null))[_0x77ea('0x21')](respondWithResult(_0x165f69,null))[_0x77ea('0x42')](handleError(_0x165f69,null));};exports[_0x77ea('0x43')]=function(_0xfed73,_0x191a1d){return db[_0x77ea('0x28')][_0x77ea('0x43')](_0xfed73[_0x77ea('0x44')],{})[_0x77ea('0x21')](respondWithResult(_0x191a1d,0xc9))[_0x77ea('0x42')](handleError(_0x191a1d,null));};exports[_0x77ea('0x20')]=function(_0x57ea2a,_0x37768e){if(_0x57ea2a[_0x77ea('0x44')]['id']){delete _0x57ea2a[_0x77ea('0x44')]['id'];}return db['SugarcrmConfiguration']['find']({'where':{'id':_0x57ea2a[_0x77ea('0x45')]['id']}})['then'](handleEntityNotFound(_0x37768e,null))['then'](saveUpdates(_0x57ea2a[_0x77ea('0x44')],null))[_0x77ea('0x21')](respondWithResult(_0x37768e,null))['catch'](handleError(_0x37768e,null));};exports[_0x77ea('0x22')]=function(_0x24bc15,_0x1db656){return db['SugarcrmConfiguration'][_0x77ea('0x41')]({'where':{'id':_0x24bc15['params']['id']}})['then'](handleEntityNotFound(_0x1db656,null))[_0x77ea('0x21')](removeEntity(_0x1db656,null))[_0x77ea('0x42')](handleError(_0x1db656,null));};exports[_0x77ea('0x46')]=function(_0x4c513e,_0x5689b5,_0x23e0f5){var _0x3fc652={};var _0x3f135b={};var _0x5eae76;var _0x1d778f;return db[_0x77ea('0x28')]['findOne']({'where':{'id':_0x4c513e[_0x77ea('0x45')]['id']}})[_0x77ea('0x21')](handleEntityNotFound(_0x5689b5,null))['then'](function(_0x53b85d){if(_0x53b85d){_0x5eae76=_0x53b85d;_0x3f135b[_0x77ea('0x2b')]=_['keys'](db[_0x77ea('0x47')]['rawAttributes']);_0x3f135b[_0x77ea('0x2c')]=_[_0x77ea('0x2d')](_0x4c513e[_0x77ea('0x2c')]);_0x3f135b[_0x77ea('0x2e')]=_[_0x77ea('0x2f')](_0x3f135b[_0x77ea('0x2b')],_0x3f135b[_0x77ea('0x2c')]);_0x3fc652[_0x77ea('0x30')]=_['intersection'](_0x3f135b['model'],qs[_0x77ea('0x31')](_0x4c513e[_0x77ea('0x2c')][_0x77ea('0x31')]));_0x3fc652[_0x77ea('0x30')]=_0x3fc652[_0x77ea('0x30')]['length']?_0x3fc652[_0x77ea('0x30')]:_0x3f135b[_0x77ea('0x2b')];_0x3fc652[_0x77ea('0x34')]=qs[_0x77ea('0x35')](_0x4c513e['query'][_0x77ea('0x35')]);_0x3fc652['where']=qs[_0x77ea('0x2e')](_['pick'](_0x4c513e[_0x77ea('0x2c')],_0x3f135b['filters']));if(_0x4c513e[_0x77ea('0x2c')][_0x77ea('0x3a')]){_0x3fc652[_0x77ea('0x36')]=_['merge'](_0x3fc652[_0x77ea('0x36')],{'$or':_[_0x77ea('0x27')](_0x3fc652['attributes'],function(_0x524b04){var _0x17f846={};_0x17f846[_0x524b04]={'$like':'%'+_0x4c513e[_0x77ea('0x2c')][_0x77ea('0x3a')]+'%'};return _0x17f846;})});}_0x3fc652=_['merge']({},_0x3fc652,_0x4c513e[_0x77ea('0x3b')]);return _0x5eae76[_0x77ea('0x46')](_0x3fc652);}})[_0x77ea('0x21')](function(_0x478f80){if(_0x478f80){_0x1d778f=_0x478f80['length'];if(!_0x4c513e['query'][_0x77ea('0x48')](_0x77ea('0x33'))){_0x3fc652[_0x77ea('0x19')]=qs[_0x77ea('0x19')](_0x4c513e[_0x77ea('0x2c')][_0x77ea('0x19')]);_0x3fc652[_0x77ea('0x18')]=qs[_0x77ea('0x18')](_0x4c513e[_0x77ea('0x2c')][_0x77ea('0x18')]);}return _0x5eae76[_0x77ea('0x46')](_0x3fc652);}})['then'](function(_0x47378f){if(_0x47378f){return _0x47378f?{'count':_0x1d778f,'rows':_0x47378f}:null;}})[_0x77ea('0x21')](respondWithResult(_0x5689b5,null))[_0x77ea('0x42')](handleError(_0x5689b5,null));};exports['getSubjects']=function(_0x5179e2,_0x2f7bc9,_0x321de0){var _0x2cc33d={};var _0x3bd34a={};var _0x210d8d;var _0x197281;return db[_0x77ea('0x28')][_0x77ea('0x49')]({'where':{'id':_0x5179e2[_0x77ea('0x45')]['id']}})[_0x77ea('0x21')](handleEntityNotFound(_0x2f7bc9,null))['then'](function(_0x57c53f){if(_0x57c53f){_0x210d8d=_0x57c53f;_0x3bd34a[_0x77ea('0x2b')]=_[_0x77ea('0x2d')](db['SugarcrmField'][_0x77ea('0x40')]);_0x3bd34a[_0x77ea('0x2c')]=_[_0x77ea('0x2d')](_0x5179e2[_0x77ea('0x2c')]);_0x3bd34a['filters']=_[_0x77ea('0x2f')](_0x3bd34a[_0x77ea('0x2b')],_0x3bd34a[_0x77ea('0x2c')]);_0x2cc33d[_0x77ea('0x30')]=_[_0x77ea('0x2f')](_0x3bd34a['model'],qs['fields'](_0x5179e2[_0x77ea('0x2c')][_0x77ea('0x31')]));_0x2cc33d[_0x77ea('0x30')]=_0x2cc33d[_0x77ea('0x30')][_0x77ea('0x32')]?_0x2cc33d[_0x77ea('0x30')]:_0x3bd34a[_0x77ea('0x2b')];_0x2cc33d[_0x77ea('0x34')]=qs['sort'](_0x5179e2[_0x77ea('0x2c')]['sort']);_0x2cc33d[_0x77ea('0x36')]=qs['filters'](_[_0x77ea('0x37')](_0x5179e2['query'],_0x3bd34a['filters']));if(_0x5179e2['query']['filter']){_0x2cc33d[_0x77ea('0x36')]=_[_0x77ea('0x38')](_0x2cc33d[_0x77ea('0x36')],{'$or':_[_0x77ea('0x27')](_0x2cc33d['attributes'],function(_0x398cda){var _0x52d64f={};_0x52d64f[_0x398cda]={'$like':'%'+_0x5179e2['query'][_0x77ea('0x3a')]+'%'};return _0x52d64f;})});}_0x2cc33d=_[_0x77ea('0x38')]({},_0x2cc33d,_0x5179e2['options']);return _0x210d8d['getSubjects'](_0x2cc33d);}})[_0x77ea('0x21')](function(_0x523ece){if(_0x523ece){_0x197281=_0x523ece[_0x77ea('0x32')];if(!_0x5179e2[_0x77ea('0x2c')]['hasOwnProperty'](_0x77ea('0x33'))){_0x2cc33d[_0x77ea('0x19')]=qs[_0x77ea('0x19')](_0x5179e2['query']['limit']);_0x2cc33d[_0x77ea('0x18')]=qs[_0x77ea('0x18')](_0x5179e2[_0x77ea('0x2c')][_0x77ea('0x18')]);}return _0x210d8d[_0x77ea('0x4a')](_0x2cc33d);}})[_0x77ea('0x21')](function(_0x112ca3){if(_0x112ca3){return _0x112ca3?{'count':_0x197281,'rows':_0x112ca3}:null;}})[_0x77ea('0x21')](respondWithResult(_0x2f7bc9,null))[_0x77ea('0x42')](handleError(_0x2f7bc9,null));};exports[_0x77ea('0x4b')]=function(_0x33f84a,_0x298bc1,_0x2059e7){var _0x13de01={};var _0x3e6b90={};var _0x114ff1;var _0x11a639;return db[_0x77ea('0x28')][_0x77ea('0x49')]({'where':{'id':_0x33f84a[_0x77ea('0x45')]['id']}})[_0x77ea('0x21')](handleEntityNotFound(_0x298bc1,null))[_0x77ea('0x21')](function(_0x35c46c){if(_0x35c46c){_0x114ff1=_0x35c46c;_0x3e6b90[_0x77ea('0x2b')]=_[_0x77ea('0x2d')](db[_0x77ea('0x47')][_0x77ea('0x40')]);_0x3e6b90[_0x77ea('0x2c')]=_[_0x77ea('0x2d')](_0x33f84a[_0x77ea('0x2c')]);_0x3e6b90[_0x77ea('0x2e')]=_[_0x77ea('0x2f')](_0x3e6b90[_0x77ea('0x2b')],_0x3e6b90[_0x77ea('0x2c')]);_0x13de01[_0x77ea('0x30')]=_['intersection'](_0x3e6b90[_0x77ea('0x2b')],qs['fields'](_0x33f84a[_0x77ea('0x2c')][_0x77ea('0x31')]));_0x13de01[_0x77ea('0x30')]=_0x13de01[_0x77ea('0x30')]['length']?_0x13de01[_0x77ea('0x30')]:_0x3e6b90[_0x77ea('0x2b')];_0x13de01[_0x77ea('0x34')]=qs[_0x77ea('0x35')](_0x33f84a[_0x77ea('0x2c')][_0x77ea('0x35')]);_0x13de01[_0x77ea('0x36')]=qs[_0x77ea('0x2e')](_[_0x77ea('0x37')](_0x33f84a['query'],_0x3e6b90['filters']));if(_0x33f84a[_0x77ea('0x2c')][_0x77ea('0x3a')]){_0x13de01[_0x77ea('0x36')]=_[_0x77ea('0x38')](_0x13de01[_0x77ea('0x36')],{'$or':_[_0x77ea('0x27')](_0x13de01['attributes'],function(_0x23b5c2){var _0x3bc818={};_0x3bc818[_0x23b5c2]={'$like':'%'+_0x33f84a['query']['filter']+'%'};return _0x3bc818;})});}_0x13de01=_['merge']({},_0x13de01,_0x33f84a['options']);return _0x114ff1['getDescriptions'](_0x13de01);}})[_0x77ea('0x21')](function(_0x3820f1){if(_0x3820f1){_0x11a639=_0x3820f1[_0x77ea('0x32')];if(!_0x33f84a[_0x77ea('0x2c')]['hasOwnProperty'](_0x77ea('0x33'))){_0x13de01[_0x77ea('0x19')]=qs['limit'](_0x33f84a[_0x77ea('0x2c')][_0x77ea('0x19')]);_0x13de01[_0x77ea('0x18')]=qs['offset'](_0x33f84a[_0x77ea('0x2c')][_0x77ea('0x18')]);}return _0x114ff1['getDescriptions'](_0x13de01);}})['then'](function(_0x3c4bba){if(_0x3c4bba){return _0x3c4bba?{'count':_0x11a639,'rows':_0x3c4bba}:null;}})[_0x77ea('0x21')](respondWithResult(_0x298bc1,null))['catch'](handleError(_0x298bc1,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 905592c..8fb1653 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 _0x023c=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','SugarcrmConfiguration','int_sugarcrm_configurations'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x023c,0x82));var _0xc023=function(_0x464059,_0x143e2b){_0x464059=_0x464059-0x0;var _0x2ee156=_0x023c[_0x464059];return _0x2ee156;};'use strict';var _=require(_0xc023('0x0'));var util=require(_0xc023('0x1'));var logger=require(_0xc023('0x2'))(_0xc023('0x3'));var moment=require(_0xc023('0x4'));var BPromise=require(_0xc023('0x5'));var rp=require(_0xc023('0x6'));var fs=require('fs');var path=require(_0xc023('0x7'));var rimraf=require(_0xc023('0x8'));var config=require(_0xc023('0x9'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0xc023('0xa')]=function(_0x2fcc62,_0x574791){return _0x2fcc62['define'](_0xc023('0xb'),attributes,{'tableName':_0xc023('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x814c=['request-promise','path','rimraf','../../config/environment','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','moment','bluebird'];(function(_0x3cdfdb,_0x40545d){var _0x57d4d8=function(_0x3e7f86){while(--_0x3e7f86){_0x3cdfdb['push'](_0x3cdfdb['shift']());}};_0x57d4d8(++_0x40545d);}(_0x814c,0xd3));var _0xc814=function(_0x60cc61,_0x563ce9){_0x60cc61=_0x60cc61-0x0;var _0x4824b6=_0x814c[_0x60cc61];return _0x4824b6;};'use strict';var _=require(_0xc814('0x0'));var util=require(_0xc814('0x1'));var logger=require(_0xc814('0x2'))('api');var moment=require(_0xc814('0x3'));var BPromise=require(_0xc814('0x4'));var rp=require(_0xc814('0x5'));var fs=require('fs');var path=require(_0xc814('0x6'));var rimraf=require(_0xc814('0x7'));var config=require(_0xc814('0x8'));var attributes=require('./intSugarcrmConfiguration.attributes');module['exports']=function(_0x460fa8,_0x36c7c5){return _0x460fa8[_0xc814('0x9')](_0xc814('0xa'),attributes,{'tableName':_0xc814('0xb'),'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 80dacf6..3534789 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 _0x7750=['request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','SugarcrmConfiguration,\x20%s,\x20%s','message','result','lodash','moment','randomstring','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x7750,0x18c));var _0x0775=function(_0x435dde,_0x29c8a1){_0x435dde=_0x435dde-0x0;var _0x537d1c=_0x7750[_0x435dde];return _0x537d1c;};'use strict';var _=require(_0x0775('0x0'));var util=require('util');var moment=require(_0x0775('0x1'));var BPromise=require('bluebird');var rs=require(_0x0775('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0775('0x3'))(_0x0775('0x4'));var config=require(_0x0775('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x0775('0x6')][_0x0775('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4c6fce,_0x1c0c51,_0x4749c1){return new BPromise(function(_0x27e4bf,_0x4abcde){return client[_0x0775('0x8')](_0x4c6fce,_0x4749c1)['then'](function(_0x3b53a2){logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x1c0c51,_0x0775('0x9'));logger['debug'](_0x0775('0xa'),_0x1c0c51,'request\x20sent',JSON['stringify'](_0x3b53a2));if(_0x3b53a2[_0x0775('0xb')]){if(_0x3b53a2[_0x0775('0xb')]['code']===0x1f4){logger[_0x0775('0xb')](_0x0775('0xc'),_0x1c0c51,_0x3b53a2[_0x0775('0xb')][_0x0775('0xd')]);return _0x4abcde(_0x3b53a2[_0x0775('0xb')][_0x0775('0xd')]);}logger['error'](_0x0775('0xc'),_0x1c0c51,_0x3b53a2[_0x0775('0xb')][_0x0775('0xd')]);return _0x27e4bf(_0x3b53a2['error']['message']);}else{logger['info'](_0x0775('0xc'),_0x1c0c51,_0x0775('0x9'));_0x27e4bf(_0x3b53a2[_0x0775('0xe')]['message']);}})['catch'](function(_0x599f14){logger[_0x0775('0xb')](_0x0775('0xc'),_0x1c0c51,_0x599f14);_0x4abcde(_0x599f14);});});} \ No newline at end of file +var _0x07a5=['moment','bluebird','randomstring','../../config/utils','../../config/logger','http','then','info','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch'];(function(_0x426897,_0xd4bbb0){var _0x185fa7=function(_0x58342f){while(--_0x58342f){_0x426897['push'](_0x426897['shift']());}};_0x185fa7(++_0xd4bbb0);}(_0x07a5,0x154));var _0x507a=function(_0x2f1089,_0x42d03d){_0x2f1089=_0x2f1089-0x0;var _0x1af573=_0x07a5[_0x2f1089];return _0x1af573;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x507a('0x0'));var BPromise=require(_0x507a('0x1'));var rs=require(_0x507a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x507a('0x3'));var logger=require(_0x507a('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x507a('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x5031bb,_0xed7e8,_0x4daec7){return new BPromise(function(_0x36d06b,_0x47d03c){return client['request'](_0x5031bb,_0x4daec7)[_0x507a('0x6')](function(_0x3cd369){logger[_0x507a('0x7')]('SugarcrmConfiguration,\x20%s,\x20%s',_0xed7e8,'request\x20sent');logger[_0x507a('0x8')](_0x507a('0x9'),_0xed7e8,_0x507a('0xa'),JSON['stringify'](_0x3cd369));if(_0x3cd369[_0x507a('0xb')]){if(_0x3cd369[_0x507a('0xb')][_0x507a('0xc')]===0x1f4){logger[_0x507a('0xb')](_0x507a('0xd'),_0xed7e8,_0x3cd369[_0x507a('0xb')][_0x507a('0xe')]);return _0x47d03c(_0x3cd369[_0x507a('0xb')][_0x507a('0xe')]);}logger[_0x507a('0xb')](_0x507a('0xd'),_0xed7e8,_0x3cd369[_0x507a('0xb')][_0x507a('0xe')]);return _0x36d06b(_0x3cd369['error'][_0x507a('0xe')]);}else{logger['info'](_0x507a('0xd'),_0xed7e8,_0x507a('0xa'));_0x36d06b(_0x3cd369[_0x507a('0xf')][_0x507a('0xe')]);}})[_0x507a('0x10')](function(_0x5746b5){logger[_0x507a('0xb')](_0x507a('0xd'),_0xed7e8,_0x5746b5);_0x47d03c(_0x5746b5);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index fa05e2e..c43133a 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 _0xaff9=['isAuthenticated','index','/:id','show','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intSugarcrmField.controller','get'];(function(_0x26280b,_0x261fcd){var _0x21ba22=function(_0x14b4aa){while(--_0x14b4aa){_0x26280b['push'](_0x26280b['shift']());}};_0x21ba22(++_0x261fcd);}(_0xaff9,0x194));var _0x9aff=function(_0x53be72,_0x302714){_0x53be72=_0x53be72-0x0;var _0x4cafd8=_0xaff9[_0x53be72];return _0x4cafd8;};'use strict';var multer=require(_0x9aff('0x0'));var util=require(_0x9aff('0x1'));var path=require(_0x9aff('0x2'));var timeout=require(_0x9aff('0x3'));var express=require(_0x9aff('0x4'));var router=express[_0x9aff('0x5')]();var fs_extra=require(_0x9aff('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9aff('0x7'));var config=require('../../config/environment');var controller=require(_0x9aff('0x8'));router[_0x9aff('0x9')]('/',auth[_0x9aff('0xa')](),controller[_0x9aff('0xb')]);router[_0x9aff('0x9')](_0x9aff('0xc'),auth[_0x9aff('0xa')](),controller[_0x9aff('0xd')]);router['post']('/',auth[_0x9aff('0xa')](),controller['create']);router[_0x9aff('0xe')]('/:id',auth[_0x9aff('0xa')](),controller['update']);router[_0x9aff('0xf')](_0x9aff('0xc'),auth[_0x9aff('0xa')](),controller[_0x9aff('0x10')]);module[_0x9aff('0x11')]=router; \ No newline at end of file +var _0xd126=['update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','get','/:id','show','post','isAuthenticated','create','put'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xd126,0xe8));var _0x6d12=function(_0x4da382,_0x4cfc5d){_0x4da382=_0x4da382-0x0;var _0x10073f=_0xd126[_0x4da382];return _0x10073f;};'use strict';var multer=require(_0x6d12('0x0'));var util=require(_0x6d12('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6d12('0x2'));var router=express[_0x6d12('0x3')]();var fs_extra=require(_0x6d12('0x4'));var auth=require(_0x6d12('0x5'));var interaction=require(_0x6d12('0x6'));var config=require('../../config/environment');var controller=require(_0x6d12('0x7'));router[_0x6d12('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x6d12('0x9'),auth['isAuthenticated'](),controller[_0x6d12('0xa')]);router[_0x6d12('0xb')]('/',auth[_0x6d12('0xc')](),controller[_0x6d12('0xd')]);router[_0x6d12('0xe')](_0x6d12('0x9'),auth['isAuthenticated'](),controller[_0x6d12('0xf')]);router[_0x6d12('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x6d12('0x11')]);module[_0x6d12('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index eb4e5a1..aa88ae7 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 _0x7b6b=['customVariable','STRING','ENUM','sequelize','string','variable'];(function(_0x3fb563,_0x4b6213){var _0x80a8f4=function(_0x32af8f){while(--_0x32af8f){_0x3fb563['push'](_0x3fb563['shift']());}};_0x80a8f4(++_0x4b6213);}(_0x7b6b,0xc3));var _0xb7b6=function(_0x1d4d7b,_0x53247c){_0x1d4d7b=_0x1d4d7b-0x0;var _0x1cd821=_0x7b6b[_0x1d4d7b];return _0x1cd821;};'use strict';var Sequelize=require(_0xb7b6('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xb7b6('0x1'),_0xb7b6('0x2'),_0xb7b6('0x3'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xb7b6('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xb7b6('0x5')](_0xb7b6('0x1'),_0xb7b6('0x2'),_0xb7b6('0x3'))},'keyContent':{'type':Sequelize[_0xb7b6('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xb7b6('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb7b6('0x4')]}}; \ No newline at end of file +var _0xf2ac=['STRING','sequelize','exports','ENUM','string','variable','keyValue','picklist'];(function(_0x2688d8,_0x5e544b){var _0x5e8f99=function(_0x4041f0){while(--_0x4041f0){_0x2688d8['push'](_0x2688d8['shift']());}};_0x5e8f99(++_0x5e544b);}(_0xf2ac,0x1c1));var _0xcf2a=function(_0x29249d,_0x26c095){_0x29249d=_0x29249d-0x0;var _0x572db9=_0xf2ac[_0x29249d];return _0x572db9;};'use strict';var Sequelize=require(_0xcf2a('0x0'));module[_0xcf2a('0x1')]={'type':{'type':Sequelize[_0xcf2a('0x2')](_0xcf2a('0x3'),_0xcf2a('0x4'),'customVariable',_0xcf2a('0x5'),_0xcf2a('0x6')),'defaultValue':_0xcf2a('0x3')},'content':{'type':Sequelize[_0xcf2a('0x7')]},'key':{'type':Sequelize[_0xcf2a('0x7')]},'keyType':{'type':Sequelize[_0xcf2a('0x2')]('string',_0xcf2a('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xcf2a('0x7')]},'idField':{'type':Sequelize[_0xcf2a('0x7')]},'nameField':{'type':Sequelize[_0xcf2a('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcf2a('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index ad50273..c733a5e 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 _0xe241=['end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','params','fields','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0x112b61,_0x113b6e){var _0x13e28a=function(_0x344855){while(--_0x344855){_0x112b61['push'](_0x112b61['shift']());}};_0x13e28a(++_0x113b6e);}(_0xe241,0xc9));var _0x1e24=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0xe241[_0x2e4e19];return _0x9ba20b;};'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('mustache');var util=require(_0x1e24('0x6'));var path=require(_0x1e24('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1e24('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1e24('0x9'));var squel=require('squel');var crypto=require(_0x1e24('0xa'));var jsforce=require(_0x1e24('0xb'));var deskjs=require(_0x1e24('0xc'));var toCsv=require(_0x1e24('0xd'));var querystring=require(_0x1e24('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1e24('0xf'));var qs=require(_0x1e24('0x10'));var as=require(_0x1e24('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1e24('0x12'))('api');var utils=require(_0x1e24('0x13'));var config=require(_0x1e24('0x14'));var licenseUtil=require(_0x1e24('0x15'));var db=require(_0x1e24('0x16'))['db'];function respondWithStatusCode(_0x3f20e9,_0x406048){_0x406048=_0x406048||0xcc;return function(_0x418165){if(_0x418165){return _0x3f20e9['sendStatus'](_0x406048);}return _0x3f20e9[_0x1e24('0x17')](_0x406048)[_0x1e24('0x18')]();};}function respondWithResult(_0x2fd602,_0x1270cc){_0x1270cc=_0x1270cc||0xc8;return function(_0x5215e7){if(_0x5215e7){return _0x2fd602[_0x1e24('0x17')](_0x1270cc)[_0x1e24('0x19')](_0x5215e7);}};}function respondWithFilteredResult(_0x994952,_0xab0fbc){return function(_0x3d8a21){if(_0x3d8a21){var _0x4b5883=typeof _0xab0fbc[_0x1e24('0x1a')]===_0x1e24('0x1b')&&typeof _0xab0fbc[_0x1e24('0x1c')]===_0x1e24('0x1b');var _0xdce1d8=_0x3d8a21[_0x1e24('0x1d')];var _0x99833f=_0x4b5883?0x0:_0xab0fbc[_0x1e24('0x1a')];var _0x234181=_0x4b5883?_0x3d8a21[_0x1e24('0x1d')]:_0xab0fbc['offset']+_0xab0fbc['limit'];var _0x53e354;if(_0x234181>=_0xdce1d8){_0x234181=_0xdce1d8;_0x53e354=0xc8;}else{_0x53e354=0xce;}_0x994952[_0x1e24('0x17')](_0x53e354);return _0x994952[_0x1e24('0x1e')](_0x1e24('0x1f'),_0x99833f+'-'+_0x234181+'/'+_0xdce1d8)[_0x1e24('0x19')](_0x3d8a21);}return null;};}function patchUpdates(_0x3aeb21){return function(_0x20a883){try{jsonpatch['apply'](_0x20a883,_0x3aeb21,!![]);}catch(_0x5934ef){return BPromise[_0x1e24('0x20')](_0x5934ef);}return _0x20a883[_0x1e24('0x21')]();};}function saveUpdates(_0x5b0725,_0x3a457a){return function(_0x4b381f){if(_0x4b381f){return _0x4b381f[_0x1e24('0x22')](_0x5b0725)[_0x1e24('0x23')](function(_0x154e06){return _0x154e06;});}return null;};}function removeEntity(_0x110508,_0x461cc3){return function(_0x2e6564){if(_0x2e6564){return _0x2e6564[_0x1e24('0x24')]()['then'](function(){_0x110508['status'](0xcc)[_0x1e24('0x18')]();});}};}function handleEntityNotFound(_0x29a53f,_0x4f6b0a){return function(_0xb2b4d1){if(!_0xb2b4d1){_0x29a53f[_0x1e24('0x25')](0x194);}return _0xb2b4d1;};}function handleError(_0xff7f3f,_0x5da246){_0x5da246=_0x5da246||0x1f4;return function(_0x43caca){logger[_0x1e24('0x26')](_0x43caca[_0x1e24('0x27')]);if(_0x43caca['name']){delete _0x43caca[_0x1e24('0x28')];}_0xff7f3f[_0x1e24('0x17')](_0x5da246)[_0x1e24('0x29')](_0x43caca);};}exports[_0x1e24('0x2a')]=function(_0x19d473,_0x2218ce){var _0x50808b={},_0x1d3e87={},_0x1fbe48={'count':0x0,'rows':[]};var _0x268e84=_[_0x1e24('0x2b')](db[_0x1e24('0x2c')][_0x1e24('0x2d')],function(_0xe3d381){return{'name':_0xe3d381[_0x1e24('0x2e')],'type':_0xe3d381[_0x1e24('0x2f')][_0x1e24('0x30')]};});_0x1d3e87['model']=_[_0x1e24('0x2b')](_0x268e84,_0x1e24('0x28'));_0x1d3e87[_0x1e24('0x31')]=_[_0x1e24('0x32')](_0x19d473[_0x1e24('0x31')]);_0x1d3e87[_0x1e24('0x33')]=_[_0x1e24('0x34')](_0x1d3e87[_0x1e24('0x35')],_0x1d3e87['query']);_0x50808b['attributes']=_[_0x1e24('0x34')](_0x1d3e87[_0x1e24('0x35')],qs['fields'](_0x19d473[_0x1e24('0x31')]['fields']));_0x50808b[_0x1e24('0x36')]=_0x50808b['attributes'][_0x1e24('0x37')]?_0x50808b[_0x1e24('0x36')]:_0x1d3e87[_0x1e24('0x35')];if(!_0x19d473[_0x1e24('0x31')][_0x1e24('0x38')](_0x1e24('0x39'))){_0x50808b[_0x1e24('0x1c')]=qs[_0x1e24('0x1c')](_0x19d473[_0x1e24('0x31')][_0x1e24('0x1c')]);_0x50808b[_0x1e24('0x1a')]=qs['offset'](_0x19d473[_0x1e24('0x31')][_0x1e24('0x1a')]);}_0x50808b[_0x1e24('0x3a')]=qs[_0x1e24('0x3b')](_0x19d473[_0x1e24('0x31')]['sort']);_0x50808b[_0x1e24('0x3c')]=qs[_0x1e24('0x33')](_[_0x1e24('0x3d')](_0x19d473[_0x1e24('0x31')],_0x1d3e87[_0x1e24('0x33')]),_0x268e84);if(_0x19d473[_0x1e24('0x31')][_0x1e24('0x3e')]){_0x50808b[_0x1e24('0x3c')]=_['merge'](_0x50808b[_0x1e24('0x3c')],{'$or':_[_0x1e24('0x2b')](_0x268e84,function(_0x150196){if(_0x150196[_0x1e24('0x2f')]!=='VIRTUAL'){var _0x1e7d19={};_0x1e7d19[_0x150196['name']]={'$like':'%'+_0x19d473[_0x1e24('0x31')]['filter']+'%'};return _0x1e7d19;}})});}_0x50808b=_[_0x1e24('0x3f')]({},_0x50808b,_0x19d473[_0x1e24('0x40')]);var _0x3e14e6={'where':_0x50808b['where']};return db['SugarcrmField'][_0x1e24('0x1d')](_0x3e14e6)['then'](function(_0x41e549){_0x1fbe48[_0x1e24('0x1d')]=_0x41e549;if(_0x19d473[_0x1e24('0x31')][_0x1e24('0x41')]){_0x50808b[_0x1e24('0x42')]=[{'all':!![]}];}return db[_0x1e24('0x2c')][_0x1e24('0x43')](_0x50808b);})[_0x1e24('0x23')](function(_0x2d7696){_0x1fbe48['rows']=_0x2d7696;return _0x1fbe48;})[_0x1e24('0x23')](respondWithFilteredResult(_0x2218ce,_0x50808b))['catch'](handleError(_0x2218ce,null));};exports[_0x1e24('0x44')]=function(_0x2d601b,_0x5c9552){var _0x36b633={'raw':!![],'where':{'id':_0x2d601b[_0x1e24('0x45')]['id']}},_0x5d5364={};_0x5d5364[_0x1e24('0x35')]=_[_0x1e24('0x32')](db[_0x1e24('0x2c')][_0x1e24('0x2d')]);_0x5d5364['query']=_['keys'](_0x2d601b[_0x1e24('0x31')]);_0x5d5364['filters']=_[_0x1e24('0x34')](_0x5d5364['model'],_0x5d5364[_0x1e24('0x31')]);_0x36b633['attributes']=_[_0x1e24('0x34')](_0x5d5364[_0x1e24('0x35')],qs[_0x1e24('0x46')](_0x2d601b[_0x1e24('0x31')]['fields']));_0x36b633[_0x1e24('0x36')]=_0x36b633['attributes'][_0x1e24('0x37')]?_0x36b633[_0x1e24('0x36')]:_0x5d5364[_0x1e24('0x35')];if(_0x2d601b[_0x1e24('0x31')][_0x1e24('0x41')]){_0x36b633[_0x1e24('0x42')]=[{'all':!![]}];}_0x36b633=_[_0x1e24('0x3f')]({},_0x36b633,_0x2d601b[_0x1e24('0x40')]);return db[_0x1e24('0x2c')][_0x1e24('0x47')](_0x36b633)[_0x1e24('0x23')](handleEntityNotFound(_0x5c9552,null))['then'](respondWithResult(_0x5c9552,null))[_0x1e24('0x48')](handleError(_0x5c9552,null));};exports[_0x1e24('0x49')]=function(_0x217cb6,_0x15bd9b){return db[_0x1e24('0x2c')][_0x1e24('0x49')](_0x217cb6[_0x1e24('0x4a')],{})[_0x1e24('0x23')](respondWithResult(_0x15bd9b,0xc9))[_0x1e24('0x48')](handleError(_0x15bd9b,null));};exports[_0x1e24('0x22')]=function(_0x818675,_0x1969fa){if(_0x818675[_0x1e24('0x4a')]['id']){delete _0x818675[_0x1e24('0x4a')]['id'];}return db[_0x1e24('0x2c')][_0x1e24('0x47')]({'where':{'id':_0x818675[_0x1e24('0x45')]['id']}})['then'](handleEntityNotFound(_0x1969fa,null))[_0x1e24('0x23')](saveUpdates(_0x818675[_0x1e24('0x4a')],null))[_0x1e24('0x23')](respondWithResult(_0x1969fa,null))['catch'](handleError(_0x1969fa,null));};exports[_0x1e24('0x24')]=function(_0x4d5ce7,_0x490937){return db['SugarcrmField'][_0x1e24('0x47')]({'where':{'id':_0x4d5ce7['params']['id']}})[_0x1e24('0x23')](handleEntityNotFound(_0x490937,null))[_0x1e24('0x23')](removeEntity(_0x490937,null))[_0x1e24('0x48')](handleError(_0x490937,null));}; \ No newline at end of file +var _0xe0b8=['desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','count','limit','set','json','reject','save','update','then','sendStatus','error','stack','name','send','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','keys','create','body','find','destroy','params','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce'];(function(_0x2579e8,_0xcaef90){var _0x56c607=function(_0x596c73){while(--_0x596c73){_0x2579e8['push'](_0x2579e8['shift']());}};_0x56c607(++_0xcaef90);}(_0xe0b8,0x1ec));var _0x8e0b=function(_0x4db0ad,_0x39acd0){_0x4db0ad=_0x4db0ad-0x0;var _0x989cd2=_0xe0b8[_0x4db0ad];return _0x989cd2;};'use strict';var emlformat=require(_0x8e0b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8e0b('0x1'));var jsonpatch=require(_0x8e0b('0x2'));var rp=require(_0x8e0b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8e0b('0x4'));var util=require(_0x8e0b('0x5'));var path=require(_0x8e0b('0x6'));var sox=require('sox');var csv=require(_0x8e0b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8e0b('0x8'));var _=require(_0x8e0b('0x9'));var squel=require('squel');var crypto=require(_0x8e0b('0xa'));var jsforce=require(_0x8e0b('0xb'));var deskjs=require(_0x8e0b('0xc'));var toCsv=require(_0x8e0b('0x7'));var querystring=require('querystring');var Papa=require(_0x8e0b('0xd'));var Redis=require(_0x8e0b('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8e0b('0xf'));var logger=require(_0x8e0b('0x10'))('api');var utils=require(_0x8e0b('0x11'));var config=require(_0x8e0b('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x8e0b('0x13'))['db'];function respondWithStatusCode(_0x2ade87,_0x4dfa75){_0x4dfa75=_0x4dfa75||0xcc;return function(_0x46078e){if(_0x46078e){return _0x2ade87['sendStatus'](_0x4dfa75);}return _0x2ade87[_0x8e0b('0x14')](_0x4dfa75)[_0x8e0b('0x15')]();};}function respondWithResult(_0x10d7a8,_0x605715){_0x605715=_0x605715||0xc8;return function(_0x921ba8){if(_0x921ba8){return _0x10d7a8[_0x8e0b('0x14')](_0x605715)['json'](_0x921ba8);}};}function respondWithFilteredResult(_0xe24ff1,_0x40b582){return function(_0x902d2f){if(_0x902d2f){var _0x24bdd9=typeof _0x40b582[_0x8e0b('0x16')]===_0x8e0b('0x17')&&typeof _0x40b582['limit']==='undefined';var _0xbaa387=_0x902d2f[_0x8e0b('0x18')];var _0x2aea52=_0x24bdd9?0x0:_0x40b582[_0x8e0b('0x16')];var _0x4a19df=_0x24bdd9?_0x902d2f[_0x8e0b('0x18')]:_0x40b582[_0x8e0b('0x16')]+_0x40b582[_0x8e0b('0x19')];var _0x15ab24;if(_0x4a19df>=_0xbaa387){_0x4a19df=_0xbaa387;_0x15ab24=0xc8;}else{_0x15ab24=0xce;}_0xe24ff1[_0x8e0b('0x14')](_0x15ab24);return _0xe24ff1[_0x8e0b('0x1a')]('Content-Range',_0x2aea52+'-'+_0x4a19df+'/'+_0xbaa387)[_0x8e0b('0x1b')](_0x902d2f);}return null;};}function patchUpdates(_0x1b6560){return function(_0x109808){try{jsonpatch['apply'](_0x109808,_0x1b6560,!![]);}catch(_0x872a8f){return BPromise[_0x8e0b('0x1c')](_0x872a8f);}return _0x109808[_0x8e0b('0x1d')]();};}function saveUpdates(_0x453cb7,_0x133476){return function(_0x355cba){if(_0x355cba){return _0x355cba[_0x8e0b('0x1e')](_0x453cb7)[_0x8e0b('0x1f')](function(_0x39e784){return _0x39e784;});}return null;};}function removeEntity(_0x1276fb,_0x4a7a2a){return function(_0x29e81f){if(_0x29e81f){return _0x29e81f['destroy']()[_0x8e0b('0x1f')](function(){_0x1276fb['status'](0xcc)[_0x8e0b('0x15')]();});}};}function handleEntityNotFound(_0x1c521a,_0x245593){return function(_0x1984c0){if(!_0x1984c0){_0x1c521a[_0x8e0b('0x20')](0x194);}return _0x1984c0;};}function handleError(_0x2673dd,_0x5720fa){_0x5720fa=_0x5720fa||0x1f4;return function(_0x4e9cbb){logger[_0x8e0b('0x21')](_0x4e9cbb[_0x8e0b('0x22')]);if(_0x4e9cbb[_0x8e0b('0x23')]){delete _0x4e9cbb[_0x8e0b('0x23')];}_0x2673dd['status'](_0x5720fa)[_0x8e0b('0x24')](_0x4e9cbb);};}exports['index']=function(_0xf501e0,_0x3ffd62){var _0x301ed4={},_0x540e0b={},_0x389119={'count':0x0,'rows':[]};var _0x1e6937=_[_0x8e0b('0x25')](db[_0x8e0b('0x26')][_0x8e0b('0x27')],function(_0x3cd0ba){return{'name':_0x3cd0ba[_0x8e0b('0x28')],'type':_0x3cd0ba[_0x8e0b('0x29')][_0x8e0b('0x2a')]};});_0x540e0b[_0x8e0b('0x2b')]=_[_0x8e0b('0x25')](_0x1e6937,_0x8e0b('0x23'));_0x540e0b['query']=_['keys'](_0xf501e0[_0x8e0b('0x2c')]);_0x540e0b[_0x8e0b('0x2d')]=_[_0x8e0b('0x2e')](_0x540e0b[_0x8e0b('0x2b')],_0x540e0b[_0x8e0b('0x2c')]);_0x301ed4[_0x8e0b('0x2f')]=_[_0x8e0b('0x2e')](_0x540e0b[_0x8e0b('0x2b')],qs[_0x8e0b('0x30')](_0xf501e0[_0x8e0b('0x2c')][_0x8e0b('0x30')]));_0x301ed4[_0x8e0b('0x2f')]=_0x301ed4[_0x8e0b('0x2f')][_0x8e0b('0x31')]?_0x301ed4['attributes']:_0x540e0b[_0x8e0b('0x2b')];if(!_0xf501e0[_0x8e0b('0x2c')][_0x8e0b('0x32')](_0x8e0b('0x33'))){_0x301ed4[_0x8e0b('0x19')]=qs['limit'](_0xf501e0[_0x8e0b('0x2c')][_0x8e0b('0x19')]);_0x301ed4[_0x8e0b('0x16')]=qs['offset'](_0xf501e0[_0x8e0b('0x2c')]['offset']);}_0x301ed4[_0x8e0b('0x34')]=qs[_0x8e0b('0x35')](_0xf501e0[_0x8e0b('0x2c')]['sort']);_0x301ed4['where']=qs['filters'](_[_0x8e0b('0x36')](_0xf501e0['query'],_0x540e0b['filters']),_0x1e6937);if(_0xf501e0[_0x8e0b('0x2c')]['filter']){_0x301ed4[_0x8e0b('0x37')]=_[_0x8e0b('0x38')](_0x301ed4[_0x8e0b('0x37')],{'$or':_[_0x8e0b('0x25')](_0x1e6937,function(_0x4677bf){if(_0x4677bf['type']!==_0x8e0b('0x39')){var _0x321254={};_0x321254[_0x4677bf[_0x8e0b('0x23')]]={'$like':'%'+_0xf501e0['query'][_0x8e0b('0x3a')]+'%'};return _0x321254;}})});}_0x301ed4=_[_0x8e0b('0x38')]({},_0x301ed4,_0xf501e0[_0x8e0b('0x3b')]);var _0x19e920={'where':_0x301ed4[_0x8e0b('0x37')]};return db[_0x8e0b('0x26')]['count'](_0x19e920)[_0x8e0b('0x1f')](function(_0x3b5f4f){_0x389119[_0x8e0b('0x18')]=_0x3b5f4f;if(_0xf501e0['query'][_0x8e0b('0x3c')]){_0x301ed4[_0x8e0b('0x3d')]=[{'all':!![]}];}return db['SugarcrmField'][_0x8e0b('0x3e')](_0x301ed4);})[_0x8e0b('0x1f')](function(_0x470760){_0x389119[_0x8e0b('0x3f')]=_0x470760;return _0x389119;})[_0x8e0b('0x1f')](respondWithFilteredResult(_0x3ffd62,_0x301ed4))[_0x8e0b('0x40')](handleError(_0x3ffd62,null));};exports[_0x8e0b('0x41')]=function(_0x1cbc2c,_0x3286a9){var _0x4a1ea3={'raw':!![],'where':{'id':_0x1cbc2c['params']['id']}},_0x1e608c={};_0x1e608c[_0x8e0b('0x2b')]=_['keys'](db[_0x8e0b('0x26')][_0x8e0b('0x27')]);_0x1e608c[_0x8e0b('0x2c')]=_[_0x8e0b('0x42')](_0x1cbc2c[_0x8e0b('0x2c')]);_0x1e608c[_0x8e0b('0x2d')]=_['intersection'](_0x1e608c[_0x8e0b('0x2b')],_0x1e608c[_0x8e0b('0x2c')]);_0x4a1ea3[_0x8e0b('0x2f')]=_['intersection'](_0x1e608c[_0x8e0b('0x2b')],qs[_0x8e0b('0x30')](_0x1cbc2c['query'][_0x8e0b('0x30')]));_0x4a1ea3[_0x8e0b('0x2f')]=_0x4a1ea3[_0x8e0b('0x2f')][_0x8e0b('0x31')]?_0x4a1ea3[_0x8e0b('0x2f')]:_0x1e608c['model'];if(_0x1cbc2c[_0x8e0b('0x2c')][_0x8e0b('0x3c')]){_0x4a1ea3[_0x8e0b('0x3d')]=[{'all':!![]}];}_0x4a1ea3=_[_0x8e0b('0x38')]({},_0x4a1ea3,_0x1cbc2c['options']);return db[_0x8e0b('0x26')]['find'](_0x4a1ea3)[_0x8e0b('0x1f')](handleEntityNotFound(_0x3286a9,null))['then'](respondWithResult(_0x3286a9,null))[_0x8e0b('0x40')](handleError(_0x3286a9,null));};exports[_0x8e0b('0x43')]=function(_0x5dc13f,_0x2b3cbd){return db['SugarcrmField'][_0x8e0b('0x43')](_0x5dc13f[_0x8e0b('0x44')],{})[_0x8e0b('0x1f')](respondWithResult(_0x2b3cbd,0xc9))['catch'](handleError(_0x2b3cbd,null));};exports[_0x8e0b('0x1e')]=function(_0xad331c,_0x157091){if(_0xad331c[_0x8e0b('0x44')]['id']){delete _0xad331c['body']['id'];}return db[_0x8e0b('0x26')][_0x8e0b('0x45')]({'where':{'id':_0xad331c['params']['id']}})['then'](handleEntityNotFound(_0x157091,null))['then'](saveUpdates(_0xad331c[_0x8e0b('0x44')],null))[_0x8e0b('0x1f')](respondWithResult(_0x157091,null))[_0x8e0b('0x40')](handleError(_0x157091,null));};exports[_0x8e0b('0x46')]=function(_0x36032e,_0xb8d7d1){return db['SugarcrmField'][_0x8e0b('0x45')]({'where':{'id':_0x36032e[_0x8e0b('0x47')]['id']}})[_0x8e0b('0x1f')](handleEntityNotFound(_0xb8d7d1,null))[_0x8e0b('0x1f')](removeEntity(_0xb8d7d1,null))[_0x8e0b('0x40')](handleError(_0xb8d7d1,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index b956358..af6c3f2 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 _0xb178=['rimraf','../../config/environment','./intSugarcrmField.attributes','SugarcrmField','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xb178,0x1d8));var _0x8b17=function(_0xf30651,_0x964c8){_0xf30651=_0xf30651-0x0;var _0x5382a0=_0xb178[_0xf30651];return _0x5382a0;};'use strict';var _=require(_0x8b17('0x0'));var util=require(_0x8b17('0x1'));var logger=require(_0x8b17('0x2'))(_0x8b17('0x3'));var moment=require(_0x8b17('0x4'));var BPromise=require(_0x8b17('0x5'));var rp=require(_0x8b17('0x6'));var fs=require('fs');var path=require(_0x8b17('0x7'));var rimraf=require(_0x8b17('0x8'));var config=require(_0x8b17('0x9'));var attributes=require(_0x8b17('0xa'));module['exports']=function(_0x1c0c3f,_0x18d459){return _0x1c0c3f['define'](_0x8b17('0xb'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x8b17('0xc'),'fields':[_0x8b17('0xd'),_0x8b17('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe219=['SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./intSugarcrmField.attributes','define'];(function(_0x210e7f,_0x853523){var _0x3aab55=function(_0x2916ac){while(--_0x2916ac){_0x210e7f['push'](_0x210e7f['shift']());}};_0x3aab55(++_0x853523);}(_0xe219,0x101));var _0x9e21=function(_0x20b0bd,_0x26e296){_0x20b0bd=_0x20b0bd-0x0;var _0x2051c8=_0xe219[_0x20b0bd];return _0x2051c8;};'use strict';var _=require(_0x9e21('0x0'));var util=require(_0x9e21('0x1'));var logger=require(_0x9e21('0x2'))(_0x9e21('0x3'));var moment=require('moment');var BPromise=require(_0x9e21('0x4'));var rp=require(_0x9e21('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9e21('0x6'));var attributes=require(_0x9e21('0x7'));module['exports']=function(_0x1b68c2,_0x104e80){return _0x1b68c2[_0x9e21('0x8')](_0x9e21('0x9'),attributes,{'tableName':_0x9e21('0xa'),'paranoid':![],'indexes':[{'name':_0x9e21('0xb'),'fields':[_0x9e21('0xc'),_0x9e21('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 068e576..b2b0b99 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 _0x9127=['SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info'];(function(_0x2011f0,_0x2443e5){var _0x573d26=function(_0x4c1f23){while(--_0x4c1f23){_0x2011f0['push'](_0x2011f0['shift']());}};_0x573d26(++_0x2443e5);}(_0x9127,0xfb));var _0x7912=function(_0x1fafa5,_0x1aa281){_0x1fafa5=_0x1fafa5-0x0;var _0xcf08c9=_0x9127[_0x1fafa5];return _0xcf08c9;};'use strict';var _=require(_0x7912('0x0'));var util=require('util');var moment=require(_0x7912('0x1'));var BPromise=require(_0x7912('0x2'));var rs=require(_0x7912('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7912('0x4'))['db'];var utils=require(_0x7912('0x5'));var logger=require(_0x7912('0x6'))(_0x7912('0x7'));var config=require(_0x7912('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7912('0x9')][_0x7912('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x567663,_0x144d0c,_0x592f4b){return new BPromise(function(_0xb3314f,_0xe8f433){return client[_0x7912('0xb')](_0x567663,_0x592f4b)['then'](function(_0x2dbbe6){logger[_0x7912('0xc')](_0x7912('0xd'),_0x144d0c,_0x7912('0xe'));logger[_0x7912('0xf')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x144d0c,_0x7912('0xe'),JSON[_0x7912('0x10')](_0x2dbbe6));if(_0x2dbbe6[_0x7912('0x11')]){if(_0x2dbbe6[_0x7912('0x11')][_0x7912('0x12')]===0x1f4){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x144d0c,_0x2dbbe6['error'][_0x7912('0x13')]);return _0xe8f433(_0x2dbbe6[_0x7912('0x11')][_0x7912('0x13')]);}logger[_0x7912('0x11')]('SugarcrmField,\x20%s,\x20%s',_0x144d0c,_0x2dbbe6['error'][_0x7912('0x13')]);return _0xb3314f(_0x2dbbe6[_0x7912('0x11')][_0x7912('0x13')]);}else{logger[_0x7912('0xc')](_0x7912('0xd'),_0x144d0c,_0x7912('0xe'));_0xb3314f(_0x2dbbe6[_0x7912('0x14')][_0x7912('0x13')]);}})[_0x7912('0x15')](function(_0x461d83){logger['error'](_0x7912('0xd'),_0x144d0c,_0x461d83);_0xe8f433(_0x461d83);});});} \ No newline at end of file +var _0x65f1=['SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3215a2,_0x591d21){var _0x17dc60=function(_0x72a8f){while(--_0x72a8f){_0x3215a2['push'](_0x3215a2['shift']());}};_0x17dc60(++_0x591d21);}(_0x65f1,0x182));var _0x165f=function(_0x154192,_0x2d360f){_0x154192=_0x154192-0x0;var _0x3c2792=_0x65f1[_0x154192];return _0x3c2792;};'use strict';var _=require('lodash');var util=require(_0x165f('0x0'));var moment=require(_0x165f('0x1'));var BPromise=require('bluebird');var rs=require(_0x165f('0x2'));var fs=require('fs');var Redis=require(_0x165f('0x3'));var db=require(_0x165f('0x4'))['db'];var utils=require(_0x165f('0x5'));var logger=require(_0x165f('0x6'))(_0x165f('0x7'));var config=require('../../config/environment');var jayson=require(_0x165f('0x8'));var client=jayson[_0x165f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36f759,_0x21f1b9,_0x33c2ba){return new BPromise(function(_0x2d3434,_0xe96d7b){return client['request'](_0x36f759,_0x33c2ba)['then'](function(_0x17ed27){logger[_0x165f('0xa')](_0x165f('0xb'),_0x21f1b9,_0x165f('0xc'));logger[_0x165f('0xd')](_0x165f('0xe'),_0x21f1b9,'request\x20sent',JSON[_0x165f('0xf')](_0x17ed27));if(_0x17ed27[_0x165f('0x10')]){if(_0x17ed27[_0x165f('0x10')][_0x165f('0x11')]===0x1f4){logger[_0x165f('0x10')](_0x165f('0xb'),_0x21f1b9,_0x17ed27[_0x165f('0x10')][_0x165f('0x12')]);return _0xe96d7b(_0x17ed27['error'][_0x165f('0x12')]);}logger['error'](_0x165f('0xb'),_0x21f1b9,_0x17ed27[_0x165f('0x10')][_0x165f('0x12')]);return _0x2d3434(_0x17ed27[_0x165f('0x10')]['message']);}else{logger['info']('SugarcrmField,\x20%s,\x20%s',_0x21f1b9,_0x165f('0xc'));_0x2d3434(_0x17ed27['result'][_0x165f('0x12')]);}})[_0x165f('0x13')](function(_0x16e464){logger[_0x165f('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x21f1b9,_0x16e464);_0xe96d7b(_0x16e464);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 4d70d21..0c1cf0b 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 _0x1599=['util','connect-timeout','Router','../../components/auth/service','./intVtigerAccount.controller','get','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','update','delete','exports','multer'];(function(_0x1e0191,_0x373e98){var _0x2d3522=function(_0x399dce){while(--_0x399dce){_0x1e0191['push'](_0x1e0191['shift']());}};_0x2d3522(++_0x373e98);}(_0x1599,0xaa));var _0x9159=function(_0x4cc1c2,_0x3b717e){_0x4cc1c2=_0x4cc1c2-0x0;var _0x4a34a5=_0x1599[_0x4cc1c2];return _0x4a34a5;};'use strict';var multer=require(_0x9159('0x0'));var util=require(_0x9159('0x1'));var path=require('path');var timeout=require(_0x9159('0x2'));var express=require('express');var router=express[_0x9159('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9159('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9159('0x5'));router[_0x9159('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x9159('0x7'),auth[_0x9159('0x8')](),controller[_0x9159('0x9')]);router[_0x9159('0x6')]('/:id/configurations',auth[_0x9159('0x8')](),controller[_0x9159('0xa')]);router[_0x9159('0x6')](_0x9159('0xb'),auth['isAuthenticated'](),controller[_0x9159('0xc')]);router[_0x9159('0xd')]('/',auth['isAuthenticated'](),controller[_0x9159('0xe')]);router[_0x9159('0xd')](_0x9159('0xf'),auth['isAuthenticated'](),controller['addConfiguration']);router['put']('/:id',auth[_0x9159('0x8')](),controller[_0x9159('0x10')]);router[_0x9159('0x11')](_0x9159('0x7'),auth[_0x9159('0x8')](),controller['destroy']);module[_0x9159('0x12')]=router; \ No newline at end of file +var _0x31c2=['isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get'];(function(_0x1bd3e7,_0x48d960){var _0x56d747=function(_0x156e21){while(--_0x156e21){_0x1bd3e7['push'](_0x1bd3e7['shift']());}};_0x56d747(++_0x48d960);}(_0x31c2,0x98));var _0x231c=function(_0xfdc55a,_0xc1ab2a){_0xfdc55a=_0xfdc55a-0x0;var _0x3cbdf8=_0x31c2[_0xfdc55a];return _0x3cbdf8;};'use strict';var multer=require(_0x231c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x231c('0x1'));var express=require(_0x231c('0x2'));var router=express['Router']();var fs_extra=require(_0x231c('0x3'));var auth=require(_0x231c('0x4'));var interaction=require(_0x231c('0x5'));var config=require(_0x231c('0x6'));var controller=require(_0x231c('0x7'));router[_0x231c('0x8')]('/',auth[_0x231c('0x9')](),controller[_0x231c('0xa')]);router['get'](_0x231c('0xb'),auth['isAuthenticated'](),controller[_0x231c('0xc')]);router[_0x231c('0x8')](_0x231c('0xd'),auth[_0x231c('0x9')](),controller['getConfigurations']);router[_0x231c('0x8')](_0x231c('0xe'),auth[_0x231c('0x9')](),controller[_0x231c('0xf')]);router[_0x231c('0x10')]('/',auth[_0x231c('0x9')](),controller['create']);router['post']('/:id/configurations',auth[_0x231c('0x9')](),controller[_0x231c('0x11')]);router[_0x231c('0x12')](_0x231c('0xb'),auth[_0x231c('0x9')](),controller[_0x231c('0x13')]);router[_0x231c('0x14')](_0x231c('0xb'),auth[_0x231c('0x9')](),controller[_0x231c('0x15')]);module[_0x231c('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 1df927e..629dea2 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 _0xdb3d=['STRING','HelpDesk','sequelize'];(function(_0x577d50,_0x5ca637){var _0x4eade3=function(_0x25ee51){while(--_0x25ee51){_0x577d50['push'](_0x577d50['shift']());}};_0x4eade3(++_0x5ca637);}(_0xdb3d,0xef));var _0xddb3=function(_0x39346a,_0x5c3ed1){_0x39346a=_0x39346a-0x0;var _0x335564=_0xdb3d[_0x39346a];return _0x335564;};'use strict';var Sequelize=require(_0xddb3('0x0'));module['exports']={'name':{'type':Sequelize[_0xddb3('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xddb3('0x1')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0xddb3('0x1')],'allowNull':![],'defaultValue':_0xddb3('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xddb3('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x8d8d=['sequelize','exports','STRING'];(function(_0x2c1e7a,_0x155f86){var _0xcacb4f=function(_0x2b2eb3){while(--_0x2b2eb3){_0x2c1e7a['push'](_0x2c1e7a['shift']());}};_0xcacb4f(++_0x155f86);}(_0x8d8d,0x171));var _0xd8d8=function(_0x161424,_0x30fb0e){_0x161424=_0x161424-0x0;var _0x17ed8c=_0x8d8d[_0x161424];return _0x17ed8c;};'use strict';var Sequelize=require(_0xd8d8('0x0'));module[_0xd8d8('0x1')]={'name':{'type':Sequelize[_0xd8d8('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xd8d8('0x2')]},'username':{'type':Sequelize[_0xd8d8('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xd8d8('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0xd8d8('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0xd8d8('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 5c48271..6af7387 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 _0x1585=['apply','save','destroy','then','sendStatus','error','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','fields','include','find','create','body','findOne','VtigerConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','md5','getFields','username','description','moduleName','remoteUri','accessKey','slice','substring','%s/webservice.php','GET','getchallenge','success','POST','login','token','describe','result','sessionName','reference','remove','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','count','limit','set','Content-Range'];(function(_0x1c953d,_0x1107ff){var _0x34dbd5=function(_0x23b622){while(--_0x23b622){_0x1c953d['push'](_0x1c953d['shift']());}};_0x34dbd5(++_0x1107ff);}(_0x1585,0x1d8));var _0x5158=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x1585[_0x4e9628];return _0x27bc8c;};'use strict';var emlformat=require(_0x5158('0x0'));var rimraf=require(_0x5158('0x1'));var zipdir=require(_0x5158('0x2'));var jsonpatch=require(_0x5158('0x3'));var rp=require('request-promise');var moment=require(_0x5158('0x4'));var BPromise=require(_0x5158('0x5'));var Mustache=require('mustache');var util=require(_0x5158('0x6'));var path=require(_0x5158('0x7'));var sox=require('sox');var csv=require(_0x5158('0x8'));var ejs=require(_0x5158('0x9'));var fs=require('fs');var fs_extra=require(_0x5158('0xa'));var _=require(_0x5158('0xb'));var squel=require(_0x5158('0xc'));var crypto=require('crypto');var jsforce=require(_0x5158('0xd'));var deskjs=require(_0x5158('0xe'));var toCsv=require(_0x5158('0x8'));var querystring=require(_0x5158('0xf'));var Papa=require(_0x5158('0x10'));var Redis=require(_0x5158('0x11'));var authService=require(_0x5158('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5158('0x13'));var hardwareService=require(_0x5158('0x14'));var logger=require('../../config/logger')(_0x5158('0x15'));var utils=require(_0x5158('0x16'));var config=require(_0x5158('0x17'));var licenseUtil=require(_0x5158('0x18'));var db=require(_0x5158('0x19'))['db'];var integrations=require(_0x5158('0x1a'));function respondWithStatusCode(_0x309226,_0xbbf75f){_0xbbf75f=_0xbbf75f||0xcc;return function(_0x1e08d3){if(_0x1e08d3){return _0x309226['sendStatus'](_0xbbf75f);}return _0x309226[_0x5158('0x1b')](_0xbbf75f)[_0x5158('0x1c')]();};}function respondWithResult(_0x196ebb,_0x1e143c){_0x1e143c=_0x1e143c||0xc8;return function(_0x5aa9f9){if(_0x5aa9f9){return _0x196ebb[_0x5158('0x1b')](_0x1e143c)[_0x5158('0x1d')](_0x5aa9f9);}};}function respondWithFilteredResult(_0x26d2ab,_0x3b04e2){return function(_0x22c9f6){if(_0x22c9f6){var _0xb135e1=typeof _0x3b04e2[_0x5158('0x1e')]===_0x5158('0x1f')&&typeof _0x3b04e2['limit']===_0x5158('0x1f');var _0x251cec=_0x22c9f6[_0x5158('0x20')];var _0x582298=_0xb135e1?0x0:_0x3b04e2[_0x5158('0x1e')];var _0x467855=_0xb135e1?_0x22c9f6[_0x5158('0x20')]:_0x3b04e2['offset']+_0x3b04e2[_0x5158('0x21')];var _0x249920;if(_0x467855>=_0x251cec){_0x467855=_0x251cec;_0x249920=0xc8;}else{_0x249920=0xce;}_0x26d2ab['status'](_0x249920);return _0x26d2ab[_0x5158('0x22')](_0x5158('0x23'),_0x582298+'-'+_0x467855+'/'+_0x251cec)[_0x5158('0x1d')](_0x22c9f6);}return null;};}function patchUpdates(_0x4c3a68){return function(_0x3066f8){try{jsonpatch[_0x5158('0x24')](_0x3066f8,_0x4c3a68,!![]);}catch(_0x1bf282){return BPromise['reject'](_0x1bf282);}return _0x3066f8[_0x5158('0x25')]();};}function saveUpdates(_0x2c7ddd,_0x11f1c8){return function(_0x447c20){if(_0x447c20){return _0x447c20['update'](_0x2c7ddd)['then'](function(_0x33371e){return _0x33371e;});}return null;};}function removeEntity(_0x388d0c,_0x54841c){return function(_0x2280de){if(_0x2280de){return _0x2280de[_0x5158('0x26')]()[_0x5158('0x27')](function(){_0x388d0c[_0x5158('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4623c3,_0x2da6f3){return function(_0x3746bb){if(!_0x3746bb){_0x4623c3[_0x5158('0x28')](0x194);}return _0x3746bb;};}function handleError(_0x1e1ffd,_0x2238cc){_0x2238cc=_0x2238cc||0x1f4;return function(_0x37b562){logger[_0x5158('0x29')](_0x37b562[_0x5158('0x2a')]);if(_0x37b562[_0x5158('0x2b')]){delete _0x37b562[_0x5158('0x2b')];}_0x1e1ffd[_0x5158('0x1b')](_0x2238cc)[_0x5158('0x2c')](_0x37b562);};}exports[_0x5158('0x2d')]=function(_0x2ffcf7,_0x593671){var _0x2c4cc3={},_0x40c35d={},_0x3e9ff4={'count':0x0,'rows':[]};var _0x2fff37=_[_0x5158('0x2e')](db[_0x5158('0x2f')][_0x5158('0x30')],function(_0x459e10){return{'name':_0x459e10[_0x5158('0x31')],'type':_0x459e10['type'][_0x5158('0x32')]};});_0x40c35d[_0x5158('0x33')]=_['map'](_0x2fff37,_0x5158('0x2b'));_0x40c35d['query']=_[_0x5158('0x34')](_0x2ffcf7['query']);_0x40c35d[_0x5158('0x35')]=_[_0x5158('0x36')](_0x40c35d[_0x5158('0x33')],_0x40c35d[_0x5158('0x37')]);_0x2c4cc3[_0x5158('0x38')]=_[_0x5158('0x36')](_0x40c35d[_0x5158('0x33')],qs['fields'](_0x2ffcf7[_0x5158('0x37')]['fields']));_0x2c4cc3[_0x5158('0x38')]=_0x2c4cc3['attributes'][_0x5158('0x39')]?_0x2c4cc3[_0x5158('0x38')]:_0x40c35d[_0x5158('0x33')];if(!_0x2ffcf7[_0x5158('0x37')][_0x5158('0x3a')](_0x5158('0x3b'))){_0x2c4cc3[_0x5158('0x21')]=qs['limit'](_0x2ffcf7[_0x5158('0x37')][_0x5158('0x21')]);_0x2c4cc3[_0x5158('0x1e')]=qs[_0x5158('0x1e')](_0x2ffcf7[_0x5158('0x37')][_0x5158('0x1e')]);}_0x2c4cc3[_0x5158('0x3c')]=qs[_0x5158('0x3d')](_0x2ffcf7[_0x5158('0x37')][_0x5158('0x3d')]);_0x2c4cc3[_0x5158('0x3e')]=qs[_0x5158('0x35')](_[_0x5158('0x3f')](_0x2ffcf7[_0x5158('0x37')],_0x40c35d['filters']),_0x2fff37);if(_0x2ffcf7[_0x5158('0x37')][_0x5158('0x40')]){_0x2c4cc3[_0x5158('0x3e')]=_[_0x5158('0x41')](_0x2c4cc3[_0x5158('0x3e')],{'$or':_[_0x5158('0x2e')](_0x2fff37,function(_0x33beed){if(_0x33beed['type']!==_0x5158('0x42')){var _0x5cda88={};_0x5cda88[_0x33beed[_0x5158('0x2b')]]={'$like':'%'+_0x2ffcf7[_0x5158('0x37')][_0x5158('0x40')]+'%'};return _0x5cda88;}})});}_0x2c4cc3=_[_0x5158('0x41')]({},_0x2c4cc3,_0x2ffcf7[_0x5158('0x43')]);var _0xb9b8c4={'where':_0x2c4cc3[_0x5158('0x3e')]};return db['VtigerAccount'][_0x5158('0x20')](_0xb9b8c4)[_0x5158('0x27')](function(_0x3b8089){_0x3e9ff4[_0x5158('0x20')]=_0x3b8089;if(_0x2ffcf7['query'][_0x5158('0x44')]){_0x2c4cc3['include']=[{'all':!![]}];}return db[_0x5158('0x2f')][_0x5158('0x45')](_0x2c4cc3);})[_0x5158('0x27')](function(_0x28fea6){_0x3e9ff4[_0x5158('0x46')]=_0x28fea6;return _0x3e9ff4;})['then'](respondWithFilteredResult(_0x593671,_0x2c4cc3))[_0x5158('0x47')](handleError(_0x593671,null));};exports[_0x5158('0x48')]=function(_0x4e7b91,_0x995991){var _0x1123db={'raw':![],'where':{'id':_0x4e7b91[_0x5158('0x49')]['id']}},_0x578419={};_0x578419['model']=_['keys'](db['VtigerAccount']['rawAttributes']);_0x578419['query']=_[_0x5158('0x34')](_0x4e7b91['query']);_0x578419[_0x5158('0x35')]=_['intersection'](_0x578419['model'],_0x578419['query']);_0x1123db[_0x5158('0x38')]=_[_0x5158('0x36')](_0x578419[_0x5158('0x33')],qs[_0x5158('0x4a')](_0x4e7b91[_0x5158('0x37')]['fields']));_0x1123db[_0x5158('0x38')]=_0x1123db['attributes'][_0x5158('0x39')]?_0x1123db[_0x5158('0x38')]:_0x578419['model'];if(_0x4e7b91[_0x5158('0x37')][_0x5158('0x44')]){_0x1123db[_0x5158('0x4b')]=[{'all':!![]}];}_0x1123db=_['merge']({},_0x1123db,_0x4e7b91[_0x5158('0x43')]);return db[_0x5158('0x2f')][_0x5158('0x4c')](_0x1123db)['then'](handleEntityNotFound(_0x995991,null))[_0x5158('0x27')](respondWithResult(_0x995991,null))[_0x5158('0x47')](handleError(_0x995991,null));};exports['create']=function(_0x340974,_0x551bee){return db[_0x5158('0x2f')][_0x5158('0x4d')](_0x340974[_0x5158('0x4e')],{})[_0x5158('0x27')](respondWithResult(_0x551bee,0xc9))[_0x5158('0x47')](handleError(_0x551bee,null));};exports['update']=function(_0x28242a,_0x1a64bd){if(_0x28242a[_0x5158('0x4e')]['id']){delete _0x28242a[_0x5158('0x4e')]['id'];}return db[_0x5158('0x2f')][_0x5158('0x4c')]({'where':{'id':_0x28242a[_0x5158('0x49')]['id']}})[_0x5158('0x27')](handleEntityNotFound(_0x1a64bd,null))[_0x5158('0x27')](saveUpdates(_0x28242a[_0x5158('0x4e')],null))[_0x5158('0x27')](respondWithResult(_0x1a64bd,null))[_0x5158('0x47')](handleError(_0x1a64bd,null));};exports[_0x5158('0x26')]=function(_0x2f15f4,_0x4452ed){return db[_0x5158('0x2f')][_0x5158('0x4c')]({'where':{'id':_0x2f15f4[_0x5158('0x49')]['id']}})[_0x5158('0x27')](handleEntityNotFound(_0x4452ed,null))[_0x5158('0x27')](removeEntity(_0x4452ed,null))[_0x5158('0x47')](handleError(_0x4452ed,null));};exports['getConfigurations']=function(_0x2f6b81,_0x3e9685,_0x1c8aa2){var _0x2bea7d={};var _0x504058={};var _0x24fee9;var _0x448ad1;return db[_0x5158('0x2f')][_0x5158('0x4f')]({'where':{'id':_0x2f6b81['params']['id']}})[_0x5158('0x27')](handleEntityNotFound(_0x3e9685,null))['then'](function(_0x3b5e09){if(_0x3b5e09){_0x24fee9=_0x3b5e09;_0x504058[_0x5158('0x33')]=_[_0x5158('0x34')](db[_0x5158('0x50')][_0x5158('0x30')]);_0x504058[_0x5158('0x37')]=_['keys'](_0x2f6b81[_0x5158('0x37')]);_0x504058[_0x5158('0x35')]=_[_0x5158('0x36')](_0x504058[_0x5158('0x33')],_0x504058[_0x5158('0x37')]);_0x2bea7d[_0x5158('0x38')]=_[_0x5158('0x36')](_0x504058[_0x5158('0x33')],qs[_0x5158('0x4a')](_0x2f6b81[_0x5158('0x37')][_0x5158('0x4a')]));_0x2bea7d['attributes']=_0x2bea7d[_0x5158('0x38')][_0x5158('0x39')]?_0x2bea7d[_0x5158('0x38')]:_0x504058[_0x5158('0x33')];_0x2bea7d[_0x5158('0x3c')]=qs[_0x5158('0x3d')](_0x2f6b81[_0x5158('0x37')]['sort']);_0x2bea7d[_0x5158('0x3e')]=qs['filters'](_[_0x5158('0x3f')](_0x2f6b81[_0x5158('0x37')],_0x504058[_0x5158('0x35')]));if(_0x2f6b81[_0x5158('0x37')][_0x5158('0x40')]){_0x2bea7d[_0x5158('0x3e')]=_['merge'](_0x2bea7d[_0x5158('0x3e')],{'$or':_[_0x5158('0x2e')](_0x2bea7d['attributes'],function(_0x23755e){var _0x4b268e={};_0x4b268e[_0x23755e]={'$like':'%'+_0x2f6b81[_0x5158('0x37')][_0x5158('0x40')]+'%'};return _0x4b268e;})});}_0x2bea7d=_['merge']({},_0x2bea7d,_0x2f6b81['options']);return _0x24fee9['getConfigurations'](_0x2bea7d);}})[_0x5158('0x27')](function(_0xded4dc){if(_0xded4dc){_0x448ad1=_0xded4dc[_0x5158('0x39')];if(!_0x2f6b81[_0x5158('0x37')][_0x5158('0x3a')](_0x5158('0x3b'))){_0x2bea7d[_0x5158('0x21')]=qs['limit'](_0x2f6b81['query'][_0x5158('0x21')]);_0x2bea7d[_0x5158('0x1e')]=qs[_0x5158('0x1e')](_0x2f6b81[_0x5158('0x37')][_0x5158('0x1e')]);}return _0x24fee9[_0x5158('0x51')](_0x2bea7d);}})[_0x5158('0x27')](function(_0x42c5f4){if(_0x42c5f4){return _0x42c5f4?{'count':_0x448ad1,'rows':_0x42c5f4}:null;}})[_0x5158('0x27')](respondWithResult(_0x3e9685,null))[_0x5158('0x47')](handleError(_0x3e9685,null));};exports[_0x5158('0x52')]=function(_0x1be932,_0x1c9f8a,_0x18788b){if(_0x1be932[_0x5158('0x4e')]['id']){delete _0x1be932['body']['id'];}return db[_0x5158('0x2f')][_0x5158('0x4f')]({'where':{'id':_0x1be932[_0x5158('0x49')]['id']}})[_0x5158('0x27')](handleEntityNotFound(_0x1c9f8a,null))['then'](function(_0x3efdab){if(_0x3efdab){_0x1be932[_0x5158('0x4e')][_0x5158('0x53')]=_0x3efdab['id'];_0x1be932[_0x5158('0x4e')][_0x5158('0x54')]=integrations[_0x5158('0x55')](_0x1be932[_0x5158('0x4e')][_0x5158('0x56')],_0x1be932['body'][_0x5158('0x57')]);_0x1be932['body'][_0x5158('0x58')]=integrations[_0x5158('0x59')](_0x1be932[_0x5158('0x4e')][_0x5158('0x56')],_0x1be932[_0x5158('0x4e')][_0x5158('0x57')]);return db['VtigerConfiguration'][_0x5158('0x4d')](_0x1be932[_0x5158('0x4e')],{'include':[{'model':db['VtigerField'],'as':_0x5158('0x54')},{'model':db['VtigerField'],'as':'Descriptions'}]});}return null;})[_0x5158('0x27')](respondWithResult(_0x1c9f8a,null))[_0x5158('0x47')](handleError(_0x1c9f8a,null));};var md5=require(_0x5158('0x5a'));exports[_0x5158('0x5b')]=function(_0x3bfcbf,_0x4349c0,_0x538f21){var _0x142d86=null;var _0x4c788f=null;var _0x163a28=null;var _0x52edb0=null;var _0x3608e8='';return db[_0x5158('0x2f')][_0x5158('0x4f')]({'where':{'id':_0x3bfcbf['params']['id']},'attributes':['id',_0x5158('0x2b'),_0x5158('0x5c'),_0x5158('0x5d'),_0x5158('0x5e'),_0x5158('0x5f'),'serverUrl','accessKey']})[_0x5158('0x27')](handleEntityNotFound(_0x4349c0,null))[_0x5158('0x27')](function(_0x3739d4){if(_0x3739d4){_0x142d86=_0x3739d4[_0x5158('0x5c')];_0x4c788f=_0x3739d4[_0x5158('0x60')];_0x163a28=_0x3739d4[_0x5158('0x5e')];_0x3608e8=_0x3739d4[_0x5158('0x5f')];var _0x38446b=_0x3608e8[_0x5158('0x61')](-0x1);if(_0x38446b==='/'){_0x3608e8=_0x3608e8[_0x5158('0x62')](0x0,_0x3608e8['lastIndexOf'](_0x38446b));}_0x52edb0=util['format'](_0x5158('0x63'),_0x3608e8);var _0xce080={'method':_0x5158('0x64'),'uri':_0x52edb0,'qs':{'operation':_0x5158('0x65'),'username':_0x3739d4[_0x5158('0x5c')]},'json':!![]};return rp(_0xce080);}})[_0x5158('0x27')](function(_0x5a58a2){if(_0x5a58a2[_0x5158('0x66')]){var _0x1573a2={'method':_0x5158('0x67'),'uri':_0x52edb0,'form':{'operation':_0x5158('0x68'),'username':_0x142d86,'accessKey':md5(_0x5a58a2['result'][_0x5158('0x69')]+_0x4c788f)},'json':!![]};return rp(_0x1573a2);}})[_0x5158('0x27')](function(_0x236485){if(_0x236485['success']){var _0x5d5d66={'method':'GET','uri':_0x52edb0,'qs':{'operation':_0x5158('0x6a'),'username':_0x142d86,'sessionName':_0x236485[_0x5158('0x6b')][_0x5158('0x6c')],'elementType':_0x163a28},'json':!![]};return rp(_0x5d5d66);}})['then'](function(_0x150f97){if(_0x150f97[_0x5158('0x66')]){var _0x24a6e8=['autogenerated',_0x5158('0x6d'),'owner'];_[_0x5158('0x6e')](_0x150f97[_0x5158('0x6b')][_0x5158('0x4a')],function(_0x925e93){return _0x24a6e8[_0x5158('0x6f')](_0x925e93[_0x5158('0x57')][_0x5158('0x2b')]);});_['remove'](_0x150f97['result']['fields'],function(_0x56caec){return _0x56caec[_0x5158('0x70')]===_0x5158('0x71');});return{'count':_0x150f97[_0x5158('0x6b')]['fields'][_0x5158('0x39')],'rows':_[_0x5158('0x2e')](_0x150f97[_0x5158('0x6b')]['fields'],function(_0x502929){return{'id':_0x502929[_0x5158('0x2b')],'name':_0x502929[_0x5158('0x72')],'custom':_[_0x5158('0x73')](_0x502929[_0x5158('0x2b')],_0x5158('0x74'))?!![]:![],'options':_0x502929[_0x5158('0x57')][_0x5158('0x2b')]===_0x5158('0x75')&&_0x502929[_0x5158('0x57')][_0x5158('0x76')][_0x5158('0x39')]>0x0?_['map'](_0x502929[_0x5158('0x57')][_0x5158('0x76')],function(_0x103a0d){return{'name':_0x103a0d[_0x5158('0x72')],'value':_0x103a0d[_0x5158('0x77')]};}):[]};})};}})['then'](respondWithResult(_0x4349c0,null))[_0x5158('0x47')](function(_0x26c2bc){console[_0x5158('0x78')](_0x5158('0x79')+_0x26c2bc);var _0x8a9c6a=_0x3bfcbf['query'][_0x5158('0x7a')]?0x1f4:_0x26c2bc[_0x5158('0x7b')]||0x1f4;logger[_0x5158('0x29')](_0x5158('0x7c'),_0x5158('0x5b'),_0x8a9c6a,JSON[_0x5158('0x7d')](_0x26c2bc));delete _0x26c2bc[_0x5158('0x2b')];if(_0x8a9c6a===0x191){_0x8a9c6a=0x190;}_0x4349c0[_0x5158('0x1b')](_0x8a9c6a)[_0x5158('0x2c')](_0x3bfcbf[_0x5158('0x37')]['test']?{'message':_0x5158('0x7e'),'statusCode':_0x26c2bc[_0x5158('0x7b')]}:_0x26c2bc);});}; \ No newline at end of file +var _0xec76=['desk.js','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','update','then','destroy','error','stack','name','send','index','VtigerAccount','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','getConfigurations','params','VtigerConfiguration','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','username','moduleName','remoteUri','accessKey','slice','substring','lastIndexOf','format','getchallenge','success','POST','login','result','token','GET','describe','sessionName','autogenerated','owner','remove','includes','editable','label','startsWith','cf_','picklist','picklistValues','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','path','sox','ejs','fs-extra','crypto','jsforce'];(function(_0x3eb043,_0x13419c){var _0x338b2b=function(_0x103cf2){while(--_0x103cf2){_0x3eb043['push'](_0x3eb043['shift']());}};_0x338b2b(++_0x13419c);}(_0xec76,0x1cd));var _0x6ec7=function(_0x2d3d48,_0x20c963){_0x2d3d48=_0x2d3d48-0x0;var _0x27764a=_0xec76[_0x2d3d48];return _0x27764a;};'use strict';var emlformat=require(_0x6ec7('0x0'));var rimraf=require(_0x6ec7('0x1'));var zipdir=require(_0x6ec7('0x2'));var jsonpatch=require(_0x6ec7('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6ec7('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6ec7('0x5'));var sox=require(_0x6ec7('0x6'));var csv=require('to-csv');var ejs=require(_0x6ec7('0x7'));var fs=require('fs');var fs_extra=require(_0x6ec7('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6ec7('0x9'));var jsforce=require(_0x6ec7('0xa'));var deskjs=require(_0x6ec7('0xb'));var toCsv=require(_0x6ec7('0xc'));var querystring=require(_0x6ec7('0xd'));var Papa=require(_0x6ec7('0xe'));var Redis=require(_0x6ec7('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6ec7('0x10'));var logger=require(_0x6ec7('0x11'))(_0x6ec7('0x12'));var utils=require(_0x6ec7('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x6ec7('0x14'));function respondWithStatusCode(_0x367810,_0x2bf35c){_0x2bf35c=_0x2bf35c||0xcc;return function(_0x1391ff){if(_0x1391ff){return _0x367810[_0x6ec7('0x15')](_0x2bf35c);}return _0x367810[_0x6ec7('0x16')](_0x2bf35c)[_0x6ec7('0x17')]();};}function respondWithResult(_0x58b0c2,_0x4be636){_0x4be636=_0x4be636||0xc8;return function(_0x8958b8){if(_0x8958b8){return _0x58b0c2['status'](_0x4be636)[_0x6ec7('0x18')](_0x8958b8);}};}function respondWithFilteredResult(_0x28d0b0,_0x1bba52){return function(_0x508b49){if(_0x508b49){var _0x27553f=typeof _0x1bba52[_0x6ec7('0x19')]==='undefined'&&typeof _0x1bba52[_0x6ec7('0x1a')]===_0x6ec7('0x1b');var _0x3a040f=_0x508b49[_0x6ec7('0x1c')];var _0x1e9656=_0x27553f?0x0:_0x1bba52[_0x6ec7('0x19')];var _0x534d06=_0x27553f?_0x508b49[_0x6ec7('0x1c')]:_0x1bba52['offset']+_0x1bba52['limit'];var _0x3a530a;if(_0x534d06>=_0x3a040f){_0x534d06=_0x3a040f;_0x3a530a=0xc8;}else{_0x3a530a=0xce;}_0x28d0b0[_0x6ec7('0x16')](_0x3a530a);return _0x28d0b0['set'](_0x6ec7('0x1d'),_0x1e9656+'-'+_0x534d06+'/'+_0x3a040f)[_0x6ec7('0x18')](_0x508b49);}return null;};}function patchUpdates(_0x16f02d){return function(_0x338e6e){try{jsonpatch['apply'](_0x338e6e,_0x16f02d,!![]);}catch(_0x44ff35){return BPromise[_0x6ec7('0x1e')](_0x44ff35);}return _0x338e6e['save']();};}function saveUpdates(_0x4ca0ac,_0x51ce16){return function(_0x511075){if(_0x511075){return _0x511075[_0x6ec7('0x1f')](_0x4ca0ac)[_0x6ec7('0x20')](function(_0x195efa){return _0x195efa;});}return null;};}function removeEntity(_0x316c3b,_0x3406c9){return function(_0x3dbad4){if(_0x3dbad4){return _0x3dbad4[_0x6ec7('0x21')]()[_0x6ec7('0x20')](function(){_0x316c3b[_0x6ec7('0x16')](0xcc)[_0x6ec7('0x17')]();});}};}function handleEntityNotFound(_0x48a21f,_0x33c53f){return function(_0x277ad3){if(!_0x277ad3){_0x48a21f['sendStatus'](0x194);}return _0x277ad3;};}function handleError(_0x59467b,_0x103cc2){_0x103cc2=_0x103cc2||0x1f4;return function(_0x3ce0c4){logger[_0x6ec7('0x22')](_0x3ce0c4[_0x6ec7('0x23')]);if(_0x3ce0c4[_0x6ec7('0x24')]){delete _0x3ce0c4[_0x6ec7('0x24')];}_0x59467b['status'](_0x103cc2)[_0x6ec7('0x25')](_0x3ce0c4);};}exports[_0x6ec7('0x26')]=function(_0x1a8bd7,_0xc66838){var _0x1ddb02={},_0x5a0698={},_0x1964ad={'count':0x0,'rows':[]};var _0x5f16fb=_['map'](db[_0x6ec7('0x27')]['rawAttributes'],function(_0x1c8744){return{'name':_0x1c8744[_0x6ec7('0x28')],'type':_0x1c8744[_0x6ec7('0x29')][_0x6ec7('0x2a')]};});_0x5a0698['model']=_[_0x6ec7('0x2b')](_0x5f16fb,_0x6ec7('0x24'));_0x5a0698[_0x6ec7('0x2c')]=_[_0x6ec7('0x2d')](_0x1a8bd7[_0x6ec7('0x2c')]);_0x5a0698[_0x6ec7('0x2e')]=_[_0x6ec7('0x2f')](_0x5a0698[_0x6ec7('0x30')],_0x5a0698[_0x6ec7('0x2c')]);_0x1ddb02[_0x6ec7('0x31')]=_['intersection'](_0x5a0698[_0x6ec7('0x30')],qs[_0x6ec7('0x32')](_0x1a8bd7['query'][_0x6ec7('0x32')]));_0x1ddb02[_0x6ec7('0x31')]=_0x1ddb02[_0x6ec7('0x31')][_0x6ec7('0x33')]?_0x1ddb02[_0x6ec7('0x31')]:_0x5a0698[_0x6ec7('0x30')];if(!_0x1a8bd7[_0x6ec7('0x2c')][_0x6ec7('0x34')]('nolimit')){_0x1ddb02[_0x6ec7('0x1a')]=qs['limit'](_0x1a8bd7[_0x6ec7('0x2c')]['limit']);_0x1ddb02[_0x6ec7('0x19')]=qs[_0x6ec7('0x19')](_0x1a8bd7['query'][_0x6ec7('0x19')]);}_0x1ddb02[_0x6ec7('0x35')]=qs[_0x6ec7('0x36')](_0x1a8bd7[_0x6ec7('0x2c')][_0x6ec7('0x36')]);_0x1ddb02[_0x6ec7('0x37')]=qs[_0x6ec7('0x2e')](_['pick'](_0x1a8bd7['query'],_0x5a0698[_0x6ec7('0x2e')]),_0x5f16fb);if(_0x1a8bd7[_0x6ec7('0x2c')][_0x6ec7('0x38')]){_0x1ddb02[_0x6ec7('0x37')]=_['merge'](_0x1ddb02['where'],{'$or':_['map'](_0x5f16fb,function(_0xd82a3e){if(_0xd82a3e[_0x6ec7('0x29')]!==_0x6ec7('0x39')){var _0x8bef96={};_0x8bef96[_0xd82a3e[_0x6ec7('0x24')]]={'$like':'%'+_0x1a8bd7[_0x6ec7('0x2c')]['filter']+'%'};return _0x8bef96;}})});}_0x1ddb02=_[_0x6ec7('0x3a')]({},_0x1ddb02,_0x1a8bd7[_0x6ec7('0x3b')]);var _0x1e9f43={'where':_0x1ddb02['where']};return db[_0x6ec7('0x27')][_0x6ec7('0x1c')](_0x1e9f43)[_0x6ec7('0x20')](function(_0x77ef97){_0x1964ad['count']=_0x77ef97;if(_0x1a8bd7[_0x6ec7('0x2c')][_0x6ec7('0x3c')]){_0x1ddb02[_0x6ec7('0x3d')]=[{'all':!![]}];}return db[_0x6ec7('0x27')][_0x6ec7('0x3e')](_0x1ddb02);})[_0x6ec7('0x20')](function(_0x29a1b4){_0x1964ad[_0x6ec7('0x3f')]=_0x29a1b4;return _0x1964ad;})[_0x6ec7('0x20')](respondWithFilteredResult(_0xc66838,_0x1ddb02))[_0x6ec7('0x40')](handleError(_0xc66838,null));};exports[_0x6ec7('0x41')]=function(_0xa8aa26,_0x3d515a){var _0x57a70a={'raw':![],'where':{'id':_0xa8aa26['params']['id']}},_0x1cc537={};_0x1cc537[_0x6ec7('0x30')]=_[_0x6ec7('0x2d')](db['VtigerAccount'][_0x6ec7('0x42')]);_0x1cc537[_0x6ec7('0x2c')]=_[_0x6ec7('0x2d')](_0xa8aa26['query']);_0x1cc537[_0x6ec7('0x2e')]=_[_0x6ec7('0x2f')](_0x1cc537[_0x6ec7('0x30')],_0x1cc537['query']);_0x57a70a[_0x6ec7('0x31')]=_[_0x6ec7('0x2f')](_0x1cc537[_0x6ec7('0x30')],qs[_0x6ec7('0x32')](_0xa8aa26[_0x6ec7('0x2c')]['fields']));_0x57a70a[_0x6ec7('0x31')]=_0x57a70a['attributes'][_0x6ec7('0x33')]?_0x57a70a[_0x6ec7('0x31')]:_0x1cc537['model'];if(_0xa8aa26[_0x6ec7('0x2c')][_0x6ec7('0x3c')]){_0x57a70a[_0x6ec7('0x3d')]=[{'all':!![]}];}_0x57a70a=_[_0x6ec7('0x3a')]({},_0x57a70a,_0xa8aa26['options']);return db[_0x6ec7('0x27')][_0x6ec7('0x43')](_0x57a70a)['then'](handleEntityNotFound(_0x3d515a,null))[_0x6ec7('0x20')](respondWithResult(_0x3d515a,null))['catch'](handleError(_0x3d515a,null));};exports[_0x6ec7('0x44')]=function(_0x51998d,_0x295fd1){return db['VtigerAccount'][_0x6ec7('0x44')](_0x51998d[_0x6ec7('0x45')],{})[_0x6ec7('0x20')](respondWithResult(_0x295fd1,0xc9))[_0x6ec7('0x40')](handleError(_0x295fd1,null));};exports['update']=function(_0x548bfb,_0x2124ab){if(_0x548bfb[_0x6ec7('0x45')]['id']){delete _0x548bfb['body']['id'];}return db[_0x6ec7('0x27')][_0x6ec7('0x43')]({'where':{'id':_0x548bfb['params']['id']}})[_0x6ec7('0x20')](handleEntityNotFound(_0x2124ab,null))[_0x6ec7('0x20')](saveUpdates(_0x548bfb['body'],null))['then'](respondWithResult(_0x2124ab,null))[_0x6ec7('0x40')](handleError(_0x2124ab,null));};exports['destroy']=function(_0x488f7b,_0x24f678){return db[_0x6ec7('0x27')][_0x6ec7('0x43')]({'where':{'id':_0x488f7b['params']['id']}})[_0x6ec7('0x20')](handleEntityNotFound(_0x24f678,null))[_0x6ec7('0x20')](removeEntity(_0x24f678,null))[_0x6ec7('0x40')](handleError(_0x24f678,null));};exports[_0x6ec7('0x46')]=function(_0x4ac485,_0x1dbc5c,_0x454199){var _0x1f3d76={};var _0x41fdde={};var _0x9587a4;var _0xf6c178;return db[_0x6ec7('0x27')]['findOne']({'where':{'id':_0x4ac485[_0x6ec7('0x47')]['id']}})[_0x6ec7('0x20')](handleEntityNotFound(_0x1dbc5c,null))[_0x6ec7('0x20')](function(_0xa245ae){if(_0xa245ae){_0x9587a4=_0xa245ae;_0x41fdde[_0x6ec7('0x30')]=_[_0x6ec7('0x2d')](db[_0x6ec7('0x48')][_0x6ec7('0x42')]);_0x41fdde[_0x6ec7('0x2c')]=_[_0x6ec7('0x2d')](_0x4ac485['query']);_0x41fdde[_0x6ec7('0x2e')]=_[_0x6ec7('0x2f')](_0x41fdde[_0x6ec7('0x30')],_0x41fdde[_0x6ec7('0x2c')]);_0x1f3d76['attributes']=_[_0x6ec7('0x2f')](_0x41fdde[_0x6ec7('0x30')],qs[_0x6ec7('0x32')](_0x4ac485['query'][_0x6ec7('0x32')]));_0x1f3d76[_0x6ec7('0x31')]=_0x1f3d76[_0x6ec7('0x31')][_0x6ec7('0x33')]?_0x1f3d76[_0x6ec7('0x31')]:_0x41fdde[_0x6ec7('0x30')];_0x1f3d76['order']=qs['sort'](_0x4ac485[_0x6ec7('0x2c')][_0x6ec7('0x36')]);_0x1f3d76[_0x6ec7('0x37')]=qs['filters'](_['pick'](_0x4ac485[_0x6ec7('0x2c')],_0x41fdde['filters']));if(_0x4ac485[_0x6ec7('0x2c')][_0x6ec7('0x38')]){_0x1f3d76['where']=_[_0x6ec7('0x3a')](_0x1f3d76[_0x6ec7('0x37')],{'$or':_[_0x6ec7('0x2b')](_0x1f3d76['attributes'],function(_0x5d0cf2){var _0x25a49b={};_0x25a49b[_0x5d0cf2]={'$like':'%'+_0x4ac485['query'][_0x6ec7('0x38')]+'%'};return _0x25a49b;})});}_0x1f3d76=_[_0x6ec7('0x3a')]({},_0x1f3d76,_0x4ac485[_0x6ec7('0x3b')]);return _0x9587a4[_0x6ec7('0x46')](_0x1f3d76);}})[_0x6ec7('0x20')](function(_0x2ded96){if(_0x2ded96){_0xf6c178=_0x2ded96['length'];if(!_0x4ac485[_0x6ec7('0x2c')]['hasOwnProperty'](_0x6ec7('0x49'))){_0x1f3d76[_0x6ec7('0x1a')]=qs[_0x6ec7('0x1a')](_0x4ac485[_0x6ec7('0x2c')]['limit']);_0x1f3d76[_0x6ec7('0x19')]=qs[_0x6ec7('0x19')](_0x4ac485[_0x6ec7('0x2c')]['offset']);}return _0x9587a4[_0x6ec7('0x46')](_0x1f3d76);}})[_0x6ec7('0x20')](function(_0x4660fa){if(_0x4660fa){return _0x4660fa?{'count':_0xf6c178,'rows':_0x4660fa}:null;}})[_0x6ec7('0x20')](respondWithResult(_0x1dbc5c,null))[_0x6ec7('0x40')](handleError(_0x1dbc5c,null));};exports[_0x6ec7('0x4a')]=function(_0x32ff38,_0x4485d2,_0x2c9bf1){if(_0x32ff38[_0x6ec7('0x45')]['id']){delete _0x32ff38[_0x6ec7('0x45')]['id'];}return db[_0x6ec7('0x27')][_0x6ec7('0x4b')]({'where':{'id':_0x32ff38['params']['id']}})[_0x6ec7('0x20')](handleEntityNotFound(_0x4485d2,null))[_0x6ec7('0x20')](function(_0x55057e){if(_0x55057e){_0x32ff38['body'][_0x6ec7('0x4c')]=_0x55057e['id'];_0x32ff38[_0x6ec7('0x45')][_0x6ec7('0x4d')]=integrations[_0x6ec7('0x4e')](_0x32ff38[_0x6ec7('0x45')][_0x6ec7('0x4f')],_0x32ff38[_0x6ec7('0x45')][_0x6ec7('0x29')]);_0x32ff38[_0x6ec7('0x45')][_0x6ec7('0x50')]=integrations[_0x6ec7('0x51')](_0x32ff38[_0x6ec7('0x45')][_0x6ec7('0x4f')],_0x32ff38['body'][_0x6ec7('0x29')]);return db[_0x6ec7('0x48')][_0x6ec7('0x44')](_0x32ff38[_0x6ec7('0x45')],{'include':[{'model':db[_0x6ec7('0x52')],'as':'Subjects'},{'model':db[_0x6ec7('0x52')],'as':_0x6ec7('0x50')}]});}return null;})[_0x6ec7('0x20')](respondWithResult(_0x4485d2,null))[_0x6ec7('0x40')](handleError(_0x4485d2,null));};var md5=require(_0x6ec7('0x53'));exports['getFields']=function(_0x4ee838,_0x402854,_0x5fd229){var _0x1ae8ad=null;var _0x57039a=null;var _0x4af8df=null;var _0x10eae1=null;var _0x2be2be='';return db[_0x6ec7('0x27')][_0x6ec7('0x4b')]({'where':{'id':_0x4ee838[_0x6ec7('0x47')]['id']},'attributes':['id',_0x6ec7('0x24'),_0x6ec7('0x54'),'description',_0x6ec7('0x55'),_0x6ec7('0x56'),'serverUrl',_0x6ec7('0x57')]})[_0x6ec7('0x20')](handleEntityNotFound(_0x402854,null))['then'](function(_0x100489){if(_0x100489){_0x1ae8ad=_0x100489[_0x6ec7('0x54')];_0x57039a=_0x100489[_0x6ec7('0x57')];_0x4af8df=_0x100489[_0x6ec7('0x55')];_0x2be2be=_0x100489[_0x6ec7('0x56')];var _0x488dea=_0x2be2be[_0x6ec7('0x58')](-0x1);if(_0x488dea==='/'){_0x2be2be=_0x2be2be[_0x6ec7('0x59')](0x0,_0x2be2be[_0x6ec7('0x5a')](_0x488dea));}_0x10eae1=util[_0x6ec7('0x5b')]('%s/webservice.php',_0x2be2be);var _0x5cfce5={'method':'GET','uri':_0x10eae1,'qs':{'operation':_0x6ec7('0x5c'),'username':_0x100489['username']},'json':!![]};return rp(_0x5cfce5);}})['then'](function(_0x2f2f4e){if(_0x2f2f4e[_0x6ec7('0x5d')]){var _0x4bdb5a={'method':_0x6ec7('0x5e'),'uri':_0x10eae1,'form':{'operation':_0x6ec7('0x5f'),'username':_0x1ae8ad,'accessKey':md5(_0x2f2f4e[_0x6ec7('0x60')][_0x6ec7('0x61')]+_0x57039a)},'json':!![]};return rp(_0x4bdb5a);}})[_0x6ec7('0x20')](function(_0xa88de8){if(_0xa88de8[_0x6ec7('0x5d')]){var _0x2a61aa={'method':_0x6ec7('0x62'),'uri':_0x10eae1,'qs':{'operation':_0x6ec7('0x63'),'username':_0x1ae8ad,'sessionName':_0xa88de8[_0x6ec7('0x60')][_0x6ec7('0x64')],'elementType':_0x4af8df},'json':!![]};return rp(_0x2a61aa);}})[_0x6ec7('0x20')](function(_0x950ac3){if(_0x950ac3[_0x6ec7('0x5d')]){var _0x201209=[_0x6ec7('0x65'),'reference',_0x6ec7('0x66')];_[_0x6ec7('0x67')](_0x950ac3[_0x6ec7('0x60')][_0x6ec7('0x32')],function(_0x51931c){return _0x201209[_0x6ec7('0x68')](_0x51931c[_0x6ec7('0x29')]['name']);});_[_0x6ec7('0x67')](_0x950ac3[_0x6ec7('0x60')]['fields'],function(_0x58d330){return _0x58d330[_0x6ec7('0x69')]==='false';});return{'count':_0x950ac3[_0x6ec7('0x60')]['fields']['length'],'rows':_['map'](_0x950ac3[_0x6ec7('0x60')][_0x6ec7('0x32')],function(_0x426794){return{'id':_0x426794[_0x6ec7('0x24')],'name':_0x426794[_0x6ec7('0x6a')],'custom':_[_0x6ec7('0x6b')](_0x426794[_0x6ec7('0x24')],_0x6ec7('0x6c'))?!![]:![],'options':_0x426794['type']['name']===_0x6ec7('0x6d')&&_0x426794[_0x6ec7('0x29')][_0x6ec7('0x6e')][_0x6ec7('0x33')]>0x0?_[_0x6ec7('0x2b')](_0x426794['type'][_0x6ec7('0x6e')],function(_0x31c730){return{'name':_0x31c730[_0x6ec7('0x6a')],'value':_0x31c730['value']};}):[]};})};}})[_0x6ec7('0x20')](respondWithResult(_0x402854,null))[_0x6ec7('0x40')](function(_0x5e8246){console[_0x6ec7('0x6f')](_0x6ec7('0x70')+_0x5e8246);var _0x35c5ec=_0x4ee838['query'][_0x6ec7('0x71')]?0x1f4:_0x5e8246[_0x6ec7('0x72')]||0x1f4;logger[_0x6ec7('0x22')](_0x6ec7('0x73'),_0x6ec7('0x74'),_0x35c5ec,JSON[_0x6ec7('0x75')](_0x5e8246));delete _0x5e8246[_0x6ec7('0x24')];if(_0x35c5ec===0x191){_0x35c5ec=0x190;}_0x402854[_0x6ec7('0x16')](_0x35c5ec)[_0x6ec7('0x25')](_0x4ee838[_0x6ec7('0x2c')][_0x6ec7('0x71')]?{'message':'Wrong\x20credentials','statusCode':_0x5e8246['statusCode']}:_0x5e8246);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index f0bd41e..8e99b7f 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 _0xd463=['path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','lodash','util','../../config/logger','api','bluebird'];(function(_0x1089fb,_0x2a412d){var _0x5deb2a=function(_0x4c3b10){while(--_0x4c3b10){_0x1089fb['push'](_0x1089fb['shift']());}};_0x5deb2a(++_0x2a412d);}(_0xd463,0x11b));var _0x3d46=function(_0x4b5733,_0x345f7a){_0x4b5733=_0x4b5733-0x0;var _0x511d04=_0xd463[_0x4b5733];return _0x511d04;};'use strict';var _=require(_0x3d46('0x0'));var util=require(_0x3d46('0x1'));var logger=require(_0x3d46('0x2'))(_0x3d46('0x3'));var moment=require('moment');var BPromise=require(_0x3d46('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3d46('0x5'));var rimraf=require(_0x3d46('0x6'));var config=require(_0x3d46('0x7'));var attributes=require(_0x3d46('0x8'));var integrations=require(_0x3d46('0x9'));module[_0x3d46('0xa')]=function(_0x2e8f8b,_0x59d9c6){return _0x2e8f8b[_0x3d46('0xb')]('VtigerAccount',attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa753=['bluebird','request-promise','path','./intVtigerAccount.attributes','../../components/integrations/configuration','VtigerAccount','lodash','util','../../config/logger','moment'];(function(_0xd9f102,_0x5a0d28){var _0x2652e4=function(_0x5021a1){while(--_0x5021a1){_0xd9f102['push'](_0xd9f102['shift']());}};_0x2652e4(++_0x5a0d28);}(_0xa753,0xa6));var _0x3a75=function(_0x19f73c,_0x21ad86){_0x19f73c=_0x19f73c-0x0;var _0x3f3323=_0xa753[_0x19f73c];return _0x3f3323;};'use strict';var _=require(_0x3a75('0x0'));var util=require(_0x3a75('0x1'));var logger=require(_0x3a75('0x2'))('api');var moment=require(_0x3a75('0x3'));var BPromise=require(_0x3a75('0x4'));var rp=require(_0x3a75('0x5'));var fs=require('fs');var path=require(_0x3a75('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3a75('0x7'));var integrations=require(_0x3a75('0x8'));module['exports']=function(_0x3a8514,_0x26ea73){return _0x3a8514['define'](_0x3a75('0x9'),attributes,{'tableName':'int_vtiger_accounts','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 075bb63..602828f 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 _0x282b=['map','model','ShowVtigerAccount','VtigerAccount','debug','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','VtigerAccount,\x20%s,\x20%s','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetVtigerAccount','findAll','options','raw','where','attributes','include'];(function(_0x1fdea5,_0x454f11){var _0x45de6d=function(_0x336a8d){while(--_0x336a8d){_0x1fdea5['push'](_0x1fdea5['shift']());}};_0x45de6d(++_0x454f11);}(_0x282b,0xec));var _0xb282=function(_0x24be6e,_0x43e005){_0x24be6e=_0x24be6e-0x0;var _0x3c6a25=_0x282b[_0x24be6e];return _0x3c6a25;};'use strict';var _=require(_0xb282('0x0'));var util=require(_0xb282('0x1'));var moment=require(_0xb282('0x2'));var BPromise=require(_0xb282('0x3'));var rs=require(_0xb282('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb282('0x5'));var logger=require('../../config/logger')(_0xb282('0x6'));var config=require(_0xb282('0x7'));var jayson=require(_0xb282('0x8'));var client=jayson[_0xb282('0x9')][_0xb282('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33635f,_0x4f0410,_0x4a0d28){return new BPromise(function(_0x17fba1,_0x436eaa){return client['request'](_0x33635f,_0x4a0d28)[_0xb282('0xb')](function(_0x20f517){logger[_0xb282('0xc')](_0xb282('0xd'),_0x4f0410,'request\x20sent');logger['debug'](_0xb282('0xe'),_0x4f0410,_0xb282('0xf'),JSON[_0xb282('0x10')](_0x20f517));if(_0x20f517[_0xb282('0x11')]){if(_0x20f517[_0xb282('0x11')]['code']===0x1f4){logger['error'](_0xb282('0xd'),_0x4f0410,_0x20f517[_0xb282('0x11')][_0xb282('0x12')]);return _0x436eaa(_0x20f517[_0xb282('0x11')][_0xb282('0x12')]);}logger['error'](_0xb282('0xd'),_0x4f0410,_0x20f517['error'][_0xb282('0x12')]);return _0x17fba1(_0x20f517[_0xb282('0x11')]['message']);}else{logger['info']('VtigerAccount,\x20%s,\x20%s',_0x4f0410,_0xb282('0xf'));_0x17fba1(_0x20f517[_0xb282('0x13')][_0xb282('0x12')]);}})[_0xb282('0x14')](function(_0x438a05){logger['error'](_0xb282('0xd'),_0x4f0410,_0x438a05);_0x436eaa(_0x438a05);});});}exports[_0xb282('0x15')]=function(_0xca5f12){var _0x45b070=this;return new Promise(function(_0x3f8a3f,_0x492d20){return db['VtigerAccount'][_0xb282('0x16')]({'raw':_0xca5f12[_0xb282('0x17')]?_0xca5f12['options'][_0xb282('0x18')]===undefined?!![]:![]:!![],'where':_0xca5f12[_0xb282('0x17')]?_0xca5f12[_0xb282('0x17')][_0xb282('0x19')]||null:null,'attributes':_0xca5f12[_0xb282('0x17')]?_0xca5f12['options'][_0xb282('0x1a')]||null:null,'limit':_0xca5f12[_0xb282('0x17')]?_0xca5f12[_0xb282('0x17')]['limit']||null:null,'include':_0xca5f12[_0xb282('0x17')]?_0xca5f12[_0xb282('0x17')][_0xb282('0x1b')]?_[_0xb282('0x1c')](_0xca5f12[_0xb282('0x17')]['include'],function(_0x4d624f){return{'model':db[_0x4d624f[_0xb282('0x1d')]],'as':_0x4d624f['as'],'attributes':_0x4d624f[_0xb282('0x1a')],'include':_0x4d624f['include']?_['map'](_0x4d624f[_0xb282('0x1b')],function(_0x114f77){return{'model':db[_0x114f77[_0xb282('0x1d')]],'as':_0x114f77['as'],'attributes':_0x114f77[_0xb282('0x1a')],'include':_0x114f77[_0xb282('0x1b')]?_[_0xb282('0x1c')](_0x114f77['include'],function(_0xa0d7fb){return{'model':db[_0xa0d7fb[_0xb282('0x1d')]],'as':_0xa0d7fb['as'],'attributes':_0xa0d7fb['attributes']};}):[]};}):[]};}):[]:[]})[_0xb282('0xb')](function(_0x38a1f8){logger[_0xb282('0xc')](_0xb282('0x15'),_0xca5f12);logger['debug'](_0xb282('0x15'),_0xca5f12,JSON[_0xb282('0x10')](_0x38a1f8));_0x3f8a3f(_0x38a1f8);})[_0xb282('0x14')](function(_0x433ad5){logger[_0xb282('0x11')](_0xb282('0x15'),_0x433ad5[_0xb282('0x12')],_0xca5f12);_0x492d20(_0x45b070['error'](0x1f4,_0x433ad5[_0xb282('0x12')]));});});};exports[_0xb282('0x1e')]=function(_0x3eb294){var _0xd8780b=this;return new Promise(function(_0x42ef75,_0x5f3ddf){return db[_0xb282('0x1f')]['find']({'raw':_0x3eb294[_0xb282('0x17')]?_0x3eb294[_0xb282('0x17')][_0xb282('0x18')]===undefined?!![]:![]:!![],'where':_0x3eb294['options']?_0x3eb294[_0xb282('0x17')]['where']||null:null,'attributes':_0x3eb294[_0xb282('0x17')]?_0x3eb294[_0xb282('0x17')][_0xb282('0x1a')]||null:null,'include':_0x3eb294[_0xb282('0x17')]?_0x3eb294[_0xb282('0x17')][_0xb282('0x1b')]?_['map'](_0x3eb294[_0xb282('0x17')][_0xb282('0x1b')],function(_0x4ede9d){return{'model':db[_0x4ede9d['model']],'as':_0x4ede9d['as'],'attributes':_0x4ede9d[_0xb282('0x1a')],'include':_0x4ede9d[_0xb282('0x1b')]?_[_0xb282('0x1c')](_0x4ede9d['include'],function(_0x4a76ce){return{'model':db[_0x4a76ce['model']],'as':_0x4a76ce['as'],'attributes':_0x4a76ce[_0xb282('0x1a')],'include':_0x4a76ce[_0xb282('0x1b')]?_[_0xb282('0x1c')](_0x4a76ce[_0xb282('0x1b')],function(_0x17c1e4){return{'model':db[_0x17c1e4[_0xb282('0x1d')]],'as':_0x17c1e4['as'],'attributes':_0x17c1e4[_0xb282('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3dc171){logger['info'](_0xb282('0x1e'),_0x3eb294);logger[_0xb282('0x20')](_0xb282('0x1e'),_0x3eb294,JSON['stringify'](_0x3dc171));_0x42ef75(_0x3dc171);})[_0xb282('0x14')](function(_0x4beef2){logger[_0xb282('0x11')](_0xb282('0x1e'),_0x4beef2[_0xb282('0x12')],_0x3eb294);_0x5f3ddf(_0xd8780b[_0xb282('0x11')](0x1f4,_0x4beef2['message']));});});}; \ No newline at end of file +var _0x04b8=['jayson/promise','http','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetVtigerAccount','VtigerAccount','findAll','options','where','attributes','limit','map','model','include','debug','catch','ShowVtigerAccount','find','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x2e6c19,_0x131233){var _0x52885d=function(_0x38f224){while(--_0x38f224){_0x2e6c19['push'](_0x2e6c19['shift']());}};_0x52885d(++_0x131233);}(_0x04b8,0x159));var _0x804b=function(_0x48d138,_0x2fa9df){_0x48d138=_0x48d138-0x0;var _0x1e1ed8=_0x04b8[_0x48d138];return _0x1e1ed8;};'use strict';var _=require('lodash');var util=require(_0x804b('0x0'));var moment=require('moment');var BPromise=require(_0x804b('0x1'));var rs=require(_0x804b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x804b('0x3'))['db'];var utils=require(_0x804b('0x4'));var logger=require('../../config/logger')(_0x804b('0x5'));var config=require(_0x804b('0x6'));var jayson=require(_0x804b('0x7'));var client=jayson['client'][_0x804b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3c5404,_0x476262,_0x50826d){return new BPromise(function(_0x27e950,_0x1071b4){return client['request'](_0x3c5404,_0x50826d)[_0x804b('0x9')](function(_0x336325){logger[_0x804b('0xa')](_0x804b('0xb'),_0x476262,_0x804b('0xc'));logger['debug'](_0x804b('0xd'),_0x476262,_0x804b('0xc'),JSON[_0x804b('0xe')](_0x336325));if(_0x336325[_0x804b('0xf')]){if(_0x336325[_0x804b('0xf')][_0x804b('0x10')]===0x1f4){logger['error'](_0x804b('0xb'),_0x476262,_0x336325['error'][_0x804b('0x11')]);return _0x1071b4(_0x336325[_0x804b('0xf')][_0x804b('0x11')]);}logger[_0x804b('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x476262,_0x336325[_0x804b('0xf')][_0x804b('0x11')]);return _0x27e950(_0x336325[_0x804b('0xf')][_0x804b('0x11')]);}else{logger['info'](_0x804b('0xb'),_0x476262,_0x804b('0xc'));_0x27e950(_0x336325['result'][_0x804b('0x11')]);}})['catch'](function(_0x2c90b9){logger[_0x804b('0xf')](_0x804b('0xb'),_0x476262,_0x2c90b9);_0x1071b4(_0x2c90b9);});});}exports[_0x804b('0x12')]=function(_0x3a05c0){var _0x5a0a82=this;return new Promise(function(_0x871d6c,_0x50b4fe){return db[_0x804b('0x13')][_0x804b('0x14')]({'raw':_0x3a05c0[_0x804b('0x15')]?_0x3a05c0[_0x804b('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x3a05c0[_0x804b('0x15')]?_0x3a05c0[_0x804b('0x15')][_0x804b('0x16')]||null:null,'attributes':_0x3a05c0[_0x804b('0x15')]?_0x3a05c0[_0x804b('0x15')][_0x804b('0x17')]||null:null,'limit':_0x3a05c0[_0x804b('0x15')]?_0x3a05c0[_0x804b('0x15')][_0x804b('0x18')]||null:null,'include':_0x3a05c0[_0x804b('0x15')]?_0x3a05c0[_0x804b('0x15')]['include']?_[_0x804b('0x19')](_0x3a05c0[_0x804b('0x15')]['include'],function(_0x44a921){return{'model':db[_0x44a921[_0x804b('0x1a')]],'as':_0x44a921['as'],'attributes':_0x44a921[_0x804b('0x17')],'include':_0x44a921[_0x804b('0x1b')]?_[_0x804b('0x19')](_0x44a921['include'],function(_0x2de812){return{'model':db[_0x2de812[_0x804b('0x1a')]],'as':_0x2de812['as'],'attributes':_0x2de812['attributes'],'include':_0x2de812[_0x804b('0x1b')]?_[_0x804b('0x19')](_0x2de812[_0x804b('0x1b')],function(_0x27d5ec){return{'model':db[_0x27d5ec[_0x804b('0x1a')]],'as':_0x27d5ec['as'],'attributes':_0x27d5ec['attributes']};}):[]};}):[]};}):[]:[]})[_0x804b('0x9')](function(_0x22f822){logger[_0x804b('0xa')](_0x804b('0x12'),_0x3a05c0);logger[_0x804b('0x1c')]('GetVtigerAccount',_0x3a05c0,JSON[_0x804b('0xe')](_0x22f822));_0x871d6c(_0x22f822);})[_0x804b('0x1d')](function(_0x410871){logger['error'](_0x804b('0x12'),_0x410871[_0x804b('0x11')],_0x3a05c0);_0x50b4fe(_0x5a0a82[_0x804b('0xf')](0x1f4,_0x410871['message']));});});};exports[_0x804b('0x1e')]=function(_0x471c04){var _0x5e8f85=this;return new Promise(function(_0x391376,_0x37dd3e){return db[_0x804b('0x13')][_0x804b('0x1f')]({'raw':_0x471c04[_0x804b('0x15')]?_0x471c04[_0x804b('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x471c04[_0x804b('0x15')]?_0x471c04[_0x804b('0x15')][_0x804b('0x16')]||null:null,'attributes':_0x471c04[_0x804b('0x15')]?_0x471c04[_0x804b('0x15')][_0x804b('0x17')]||null:null,'include':_0x471c04[_0x804b('0x15')]?_0x471c04[_0x804b('0x15')][_0x804b('0x1b')]?_[_0x804b('0x19')](_0x471c04[_0x804b('0x15')][_0x804b('0x1b')],function(_0x34d5d0){return{'model':db[_0x34d5d0[_0x804b('0x1a')]],'as':_0x34d5d0['as'],'attributes':_0x34d5d0[_0x804b('0x17')],'include':_0x34d5d0[_0x804b('0x1b')]?_[_0x804b('0x19')](_0x34d5d0[_0x804b('0x1b')],function(_0xf47023){return{'model':db[_0xf47023[_0x804b('0x1a')]],'as':_0xf47023['as'],'attributes':_0xf47023[_0x804b('0x17')],'include':_0xf47023[_0x804b('0x1b')]?_[_0x804b('0x19')](_0xf47023[_0x804b('0x1b')],function(_0x35150b){return{'model':db[_0x35150b['model']],'as':_0x35150b['as'],'attributes':_0x35150b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3da331){logger[_0x804b('0xa')](_0x804b('0x1e'),_0x471c04);logger['debug']('ShowVtigerAccount',_0x471c04,JSON['stringify'](_0x3da331));_0x391376(_0x3da331);})[_0x804b('0x1d')](function(_0x1aaa47){logger[_0x804b('0xf')](_0x804b('0x1e'),_0x1aaa47[_0x804b('0x11')],_0x471c04);_0x37dd3e(_0x5e8f85[_0x804b('0xf')](0x1f4,_0x1aaa47[_0x804b('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 7c8b967..bb81ec6 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 _0x47d8=['get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','put','update','exports','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','isAuthenticated','index'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x47d8,0x160));var _0x847d=function(_0x4188ce,_0x30be53){_0x4188ce=_0x4188ce-0x0;var _0x49ed2f=_0x47d8[_0x4188ce];return _0x49ed2f;};'use strict';var multer=require('multer');var util=require(_0x847d('0x0'));var path=require(_0x847d('0x1'));var timeout=require(_0x847d('0x2'));var express=require(_0x847d('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x847d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x847d('0x5'));var controller=require('./intVtigerConfiguration.controller');router['get']('/',auth[_0x847d('0x6')](),controller[_0x847d('0x7')]);router[_0x847d('0x8')](_0x847d('0x9'),auth['isAuthenticated'](),controller[_0x847d('0xa')]);router['get'](_0x847d('0xb'),auth['isAuthenticated'](),controller[_0x847d('0xc')]);router[_0x847d('0x8')](_0x847d('0xd'),auth['isAuthenticated'](),controller[_0x847d('0xe')]);router[_0x847d('0x8')](_0x847d('0xf'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x847d('0x10')]('/',auth[_0x847d('0x6')](),controller['create']);router[_0x847d('0x11')]('/:id',auth[_0x847d('0x6')](),controller[_0x847d('0x12')]);router['delete']('/:id',auth[_0x847d('0x6')](),controller['destroy']);module[_0x847d('0x13')]=router; \ No newline at end of file +var _0x8b2f=['delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update'];(function(_0x59ee92,_0x4f57d0){var _0x3ad8df=function(_0x359b50){while(--_0x359b50){_0x59ee92['push'](_0x59ee92['shift']());}};_0x3ad8df(++_0x4f57d0);}(_0x8b2f,0x172));var _0xf8b2=function(_0x4db498,_0x1b9c7d){_0x4db498=_0x4db498-0x0;var _0x483a1b=_0x8b2f[_0x4db498];return _0x483a1b;};'use strict';var multer=require(_0xf8b2('0x0'));var util=require(_0xf8b2('0x1'));var path=require(_0xf8b2('0x2'));var timeout=require(_0xf8b2('0x3'));var express=require('express');var router=express[_0xf8b2('0x4')]();var fs_extra=require(_0xf8b2('0x5'));var auth=require(_0xf8b2('0x6'));var interaction=require(_0xf8b2('0x7'));var config=require(_0xf8b2('0x8'));var controller=require('./intVtigerConfiguration.controller');router[_0xf8b2('0x9')]('/',auth[_0xf8b2('0xa')](),controller[_0xf8b2('0xb')]);router[_0xf8b2('0x9')](_0xf8b2('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xf8b2('0x9')](_0xf8b2('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0xf8b2('0x9')](_0xf8b2('0xe'),auth[_0xf8b2('0xa')](),controller[_0xf8b2('0xf')]);router['get'](_0xf8b2('0x10'),auth[_0xf8b2('0xa')](),controller[_0xf8b2('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf8b2('0x12')]);router[_0xf8b2('0x13')](_0xf8b2('0xc'),auth['isAuthenticated'](),controller[_0xf8b2('0x14')]);router[_0xf8b2('0x15')]('/:id',auth[_0xf8b2('0xa')](),controller[_0xf8b2('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index a2d2333..033b6ac 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 _0x4c54=['STRING','sequelize','exports'];(function(_0x49db04,_0x3088cb){var _0x199531=function(_0x36f723){while(--_0x36f723){_0x49db04['push'](_0x49db04['shift']());}};_0x199531(++_0x3088cb);}(_0x4c54,0xd0));var _0x44c5=function(_0x4d5fe2,_0x167006){_0x4d5fe2=_0x4d5fe2-0x0;var _0x11e215=_0x4c54[_0x4d5fe2];return _0x11e215;};'use strict';var Sequelize=require(_0x44c5('0x0'));module[_0x44c5('0x1')]={'name':{'type':Sequelize[_0x44c5('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbacd=['sequelize','exports','STRING'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xbacd,0x1aa));var _0xdbac=function(_0x35199e,_0x585fa1){_0x35199e=_0x35199e-0x0;var _0x13d0cc=_0xbacd[_0x35199e];return _0x13d0cc;};'use strict';var Sequelize=require(_0xdbac('0x0'));module[_0xdbac('0x1')]={'name':{'type':Sequelize[_0xdbac('0x2')]},'description':{'type':Sequelize[_0xdbac('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index a29190f..0e9feb0 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 _0xc1fa=['lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','keys','query','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','getFields','findOne','VtigerField','intersection','order','getSubjects','getDescriptions','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','fs-extra'];(function(_0x52974b,_0xd9489a){var _0x23cffb=function(_0xfdd78b){while(--_0xfdd78b){_0x52974b['push'](_0x52974b['shift']());}};_0x23cffb(++_0xd9489a);}(_0xc1fa,0xe5));var _0xac1f=function(_0x37c07d,_0xdbdb5f){_0x37c07d=_0x37c07d-0x0;var _0x10dadc=_0xc1fa[_0x37c07d];return _0x10dadc;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xac1f('0x0'));var jsonpatch=require(_0xac1f('0x1'));var rp=require(_0xac1f('0x2'));var moment=require('moment');var BPromise=require(_0xac1f('0x3'));var Mustache=require('mustache');var util=require(_0xac1f('0x4'));var path=require(_0xac1f('0x5'));var sox=require('sox');var csv=require(_0xac1f('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xac1f('0x7'));var _=require(_0xac1f('0x8'));var squel=require('squel');var crypto=require(_0xac1f('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xac1f('0xa'));var toCsv=require(_0xac1f('0x6'));var querystring=require(_0xac1f('0xb'));var Papa=require(_0xac1f('0xc'));var Redis=require('ioredis');var authService=require(_0xac1f('0xd'));var qs=require(_0xac1f('0xe'));var as=require(_0xac1f('0xf'));var hardwareService=require(_0xac1f('0x10'));var logger=require('../../config/logger')(_0xac1f('0x11'));var utils=require('../../config/utils');var config=require(_0xac1f('0x12'));var licenseUtil=require(_0xac1f('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc32dc8,_0x3335a0){_0x3335a0=_0x3335a0||0xcc;return function(_0x49b47a){if(_0x49b47a){return _0xc32dc8[_0xac1f('0x14')](_0x3335a0);}return _0xc32dc8[_0xac1f('0x15')](_0x3335a0)[_0xac1f('0x16')]();};}function respondWithResult(_0x1efd83,_0x40e2ca){_0x40e2ca=_0x40e2ca||0xc8;return function(_0x265728){if(_0x265728){return _0x1efd83[_0xac1f('0x15')](_0x40e2ca)[_0xac1f('0x17')](_0x265728);}};}function respondWithFilteredResult(_0x3ab3cd,_0x5a8bba){return function(_0x219d28){if(_0x219d28){var _0x5d39bf=typeof _0x5a8bba[_0xac1f('0x18')]===_0xac1f('0x19')&&typeof _0x5a8bba[_0xac1f('0x1a')]===_0xac1f('0x19');var _0x23c9eb=_0x219d28[_0xac1f('0x1b')];var _0xa94c0c=_0x5d39bf?0x0:_0x5a8bba[_0xac1f('0x18')];var _0x2f1c43=_0x5d39bf?_0x219d28['count']:_0x5a8bba['offset']+_0x5a8bba[_0xac1f('0x1a')];var _0x3ea6fe;if(_0x2f1c43>=_0x23c9eb){_0x2f1c43=_0x23c9eb;_0x3ea6fe=0xc8;}else{_0x3ea6fe=0xce;}_0x3ab3cd[_0xac1f('0x15')](_0x3ea6fe);return _0x3ab3cd[_0xac1f('0x1c')](_0xac1f('0x1d'),_0xa94c0c+'-'+_0x2f1c43+'/'+_0x23c9eb)[_0xac1f('0x17')](_0x219d28);}return null;};}function patchUpdates(_0xc83c32){return function(_0x263a0b){try{jsonpatch[_0xac1f('0x1e')](_0x263a0b,_0xc83c32,!![]);}catch(_0x12c04f){return BPromise['reject'](_0x12c04f);}return _0x263a0b[_0xac1f('0x1f')]();};}function saveUpdates(_0x151ba3,_0x5bc37f){return function(_0x25b16c){if(_0x25b16c){return _0x25b16c[_0xac1f('0x20')](_0x151ba3)[_0xac1f('0x21')](function(_0x479572){return _0x479572;});}return null;};}function removeEntity(_0x213238,_0x1e50d5){return function(_0x71b49d){if(_0x71b49d){return _0x71b49d[_0xac1f('0x22')]()[_0xac1f('0x21')](function(){_0x213238['status'](0xcc)[_0xac1f('0x16')]();});}};}function handleEntityNotFound(_0x1f60ab,_0x26533c){return function(_0x328257){if(!_0x328257){_0x1f60ab['sendStatus'](0x194);}return _0x328257;};}function handleError(_0x47dbda,_0x2f31a3){_0x2f31a3=_0x2f31a3||0x1f4;return function(_0xcce02d){logger[_0xac1f('0x23')](_0xcce02d[_0xac1f('0x24')]);if(_0xcce02d[_0xac1f('0x25')]){delete _0xcce02d[_0xac1f('0x25')];}_0x47dbda[_0xac1f('0x15')](_0x2f31a3)[_0xac1f('0x26')](_0xcce02d);};}exports[_0xac1f('0x27')]=function(_0x5678d7,_0x22b52c){var _0xebdd52={},_0x10f2a7={},_0x2f62f8={'count':0x0,'rows':[]};var _0x23fd61=_[_0xac1f('0x28')](db[_0xac1f('0x29')][_0xac1f('0x2a')],function(_0x2fc4aa){return{'name':_0x2fc4aa[_0xac1f('0x2b')],'type':_0x2fc4aa[_0xac1f('0x2c')][_0xac1f('0x2d')]};});_0x10f2a7[_0xac1f('0x2e')]=_[_0xac1f('0x28')](_0x23fd61,_0xac1f('0x25'));_0x10f2a7['query']=_[_0xac1f('0x2f')](_0x5678d7[_0xac1f('0x30')]);_0x10f2a7['filters']=_['intersection'](_0x10f2a7[_0xac1f('0x2e')],_0x10f2a7[_0xac1f('0x30')]);_0xebdd52['attributes']=_['intersection'](_0x10f2a7[_0xac1f('0x2e')],qs[_0xac1f('0x31')](_0x5678d7['query']['fields']));_0xebdd52[_0xac1f('0x32')]=_0xebdd52[_0xac1f('0x32')][_0xac1f('0x33')]?_0xebdd52[_0xac1f('0x32')]:_0x10f2a7[_0xac1f('0x2e')];if(!_0x5678d7[_0xac1f('0x30')][_0xac1f('0x34')](_0xac1f('0x35'))){_0xebdd52[_0xac1f('0x1a')]=qs[_0xac1f('0x1a')](_0x5678d7['query'][_0xac1f('0x1a')]);_0xebdd52[_0xac1f('0x18')]=qs[_0xac1f('0x18')](_0x5678d7[_0xac1f('0x30')]['offset']);}_0xebdd52['order']=qs[_0xac1f('0x36')](_0x5678d7[_0xac1f('0x30')][_0xac1f('0x36')]);_0xebdd52['where']=qs[_0xac1f('0x37')](_[_0xac1f('0x38')](_0x5678d7[_0xac1f('0x30')],_0x10f2a7[_0xac1f('0x37')]),_0x23fd61);if(_0x5678d7['query']['filter']){_0xebdd52[_0xac1f('0x39')]=_[_0xac1f('0x3a')](_0xebdd52[_0xac1f('0x39')],{'$or':_[_0xac1f('0x28')](_0x23fd61,function(_0x4231c7){if(_0x4231c7[_0xac1f('0x2c')]!==_0xac1f('0x3b')){var _0x572f6e={};_0x572f6e[_0x4231c7[_0xac1f('0x25')]]={'$like':'%'+_0x5678d7[_0xac1f('0x30')][_0xac1f('0x3c')]+'%'};return _0x572f6e;}})});}_0xebdd52=_[_0xac1f('0x3a')]({},_0xebdd52,_0x5678d7[_0xac1f('0x3d')]);var _0x31d627={'where':_0xebdd52[_0xac1f('0x39')]};return db['VtigerConfiguration']['count'](_0x31d627)['then'](function(_0x54ad5a){_0x2f62f8[_0xac1f('0x1b')]=_0x54ad5a;if(_0x5678d7['query'][_0xac1f('0x3e')]){_0xebdd52[_0xac1f('0x3f')]=[{'all':!![]}];}return db[_0xac1f('0x29')][_0xac1f('0x40')](_0xebdd52);})[_0xac1f('0x21')](function(_0x4ac866){_0x2f62f8[_0xac1f('0x41')]=_0x4ac866;return _0x2f62f8;})['then'](respondWithFilteredResult(_0x22b52c,_0xebdd52))['catch'](handleError(_0x22b52c,null));};exports[_0xac1f('0x42')]=function(_0x55d0d4,_0x51b6c0){var _0x34cc29={'raw':![],'where':{'id':_0x55d0d4[_0xac1f('0x43')]['id']}},_0x5261a1={};_0x5261a1[_0xac1f('0x2e')]=_[_0xac1f('0x2f')](db[_0xac1f('0x29')][_0xac1f('0x2a')]);_0x5261a1['query']=_[_0xac1f('0x2f')](_0x55d0d4['query']);_0x5261a1[_0xac1f('0x37')]=_['intersection'](_0x5261a1[_0xac1f('0x2e')],_0x5261a1['query']);_0x34cc29[_0xac1f('0x32')]=_['intersection'](_0x5261a1[_0xac1f('0x2e')],qs[_0xac1f('0x31')](_0x55d0d4['query'][_0xac1f('0x31')]));_0x34cc29['attributes']=_0x34cc29[_0xac1f('0x32')][_0xac1f('0x33')]?_0x34cc29[_0xac1f('0x32')]:_0x5261a1[_0xac1f('0x2e')];if(_0x55d0d4['query'][_0xac1f('0x3e')]){_0x34cc29['include']=[{'all':!![]}];}_0x34cc29=_[_0xac1f('0x3a')]({},_0x34cc29,_0x55d0d4[_0xac1f('0x3d')]);return db[_0xac1f('0x29')][_0xac1f('0x44')](_0x34cc29)['then'](handleEntityNotFound(_0x51b6c0,null))[_0xac1f('0x21')](respondWithResult(_0x51b6c0,null))[_0xac1f('0x45')](handleError(_0x51b6c0,null));};exports[_0xac1f('0x46')]=function(_0x43d834,_0x505733){return db[_0xac1f('0x29')][_0xac1f('0x46')](_0x43d834[_0xac1f('0x47')],{})[_0xac1f('0x21')](respondWithResult(_0x505733,0xc9))[_0xac1f('0x45')](handleError(_0x505733,null));};exports[_0xac1f('0x20')]=function(_0x21595a,_0x3a4a05){if(_0x21595a['body']['id']){delete _0x21595a['body']['id'];}return db[_0xac1f('0x29')][_0xac1f('0x44')]({'where':{'id':_0x21595a[_0xac1f('0x43')]['id']}})[_0xac1f('0x21')](handleEntityNotFound(_0x3a4a05,null))['then'](saveUpdates(_0x21595a['body'],null))[_0xac1f('0x21')](respondWithResult(_0x3a4a05,null))[_0xac1f('0x45')](handleError(_0x3a4a05,null));};exports[_0xac1f('0x22')]=function(_0x463a02,_0x5b6a30){return db['VtigerConfiguration'][_0xac1f('0x44')]({'where':{'id':_0x463a02[_0xac1f('0x43')]['id']}})[_0xac1f('0x21')](handleEntityNotFound(_0x5b6a30,null))['then'](removeEntity(_0x5b6a30,null))[_0xac1f('0x45')](handleError(_0x5b6a30,null));};exports[_0xac1f('0x48')]=function(_0x4ad507,_0x3c9bae,_0x5193e6){var _0x37ac6e={};var _0x3febcd={};var _0x51efcc;var _0x10a7f1;return db[_0xac1f('0x29')][_0xac1f('0x49')]({'where':{'id':_0x4ad507[_0xac1f('0x43')]['id']}})[_0xac1f('0x21')](handleEntityNotFound(_0x3c9bae,null))[_0xac1f('0x21')](function(_0x248b07){if(_0x248b07){_0x51efcc=_0x248b07;_0x3febcd[_0xac1f('0x2e')]=_['keys'](db[_0xac1f('0x4a')][_0xac1f('0x2a')]);_0x3febcd[_0xac1f('0x30')]=_['keys'](_0x4ad507[_0xac1f('0x30')]);_0x3febcd['filters']=_[_0xac1f('0x4b')](_0x3febcd[_0xac1f('0x2e')],_0x3febcd[_0xac1f('0x30')]);_0x37ac6e[_0xac1f('0x32')]=_[_0xac1f('0x4b')](_0x3febcd[_0xac1f('0x2e')],qs['fields'](_0x4ad507[_0xac1f('0x30')][_0xac1f('0x31')]));_0x37ac6e[_0xac1f('0x32')]=_0x37ac6e[_0xac1f('0x32')]['length']?_0x37ac6e['attributes']:_0x3febcd[_0xac1f('0x2e')];_0x37ac6e[_0xac1f('0x4c')]=qs[_0xac1f('0x36')](_0x4ad507[_0xac1f('0x30')][_0xac1f('0x36')]);_0x37ac6e[_0xac1f('0x39')]=qs[_0xac1f('0x37')](_[_0xac1f('0x38')](_0x4ad507['query'],_0x3febcd['filters']));if(_0x4ad507[_0xac1f('0x30')][_0xac1f('0x3c')]){_0x37ac6e[_0xac1f('0x39')]=_['merge'](_0x37ac6e['where'],{'$or':_['map'](_0x37ac6e[_0xac1f('0x32')],function(_0x5c99c7){var _0x15d94d={};_0x15d94d[_0x5c99c7]={'$like':'%'+_0x4ad507['query'][_0xac1f('0x3c')]+'%'};return _0x15d94d;})});}_0x37ac6e=_[_0xac1f('0x3a')]({},_0x37ac6e,_0x4ad507[_0xac1f('0x3d')]);return _0x51efcc[_0xac1f('0x48')](_0x37ac6e);}})[_0xac1f('0x21')](function(_0x363e92){if(_0x363e92){_0x10a7f1=_0x363e92[_0xac1f('0x33')];if(!_0x4ad507[_0xac1f('0x30')][_0xac1f('0x34')](_0xac1f('0x35'))){_0x37ac6e['limit']=qs[_0xac1f('0x1a')](_0x4ad507['query'][_0xac1f('0x1a')]);_0x37ac6e[_0xac1f('0x18')]=qs[_0xac1f('0x18')](_0x4ad507['query'][_0xac1f('0x18')]);}return _0x51efcc['getFields'](_0x37ac6e);}})[_0xac1f('0x21')](function(_0x4e5e6f){if(_0x4e5e6f){return _0x4e5e6f?{'count':_0x10a7f1,'rows':_0x4e5e6f}:null;}})[_0xac1f('0x21')](respondWithResult(_0x3c9bae,null))[_0xac1f('0x45')](handleError(_0x3c9bae,null));};exports[_0xac1f('0x4d')]=function(_0x382557,_0x3218c1,_0x447fee){var _0x3b600a={};var _0x3df362={};var _0x1ba7f6;var _0x1e5e83;return db[_0xac1f('0x29')][_0xac1f('0x49')]({'where':{'id':_0x382557[_0xac1f('0x43')]['id']}})[_0xac1f('0x21')](handleEntityNotFound(_0x3218c1,null))['then'](function(_0x2df942){if(_0x2df942){_0x1ba7f6=_0x2df942;_0x3df362[_0xac1f('0x2e')]=_['keys'](db[_0xac1f('0x4a')][_0xac1f('0x2a')]);_0x3df362['query']=_[_0xac1f('0x2f')](_0x382557[_0xac1f('0x30')]);_0x3df362[_0xac1f('0x37')]=_[_0xac1f('0x4b')](_0x3df362['model'],_0x3df362['query']);_0x3b600a[_0xac1f('0x32')]=_[_0xac1f('0x4b')](_0x3df362['model'],qs[_0xac1f('0x31')](_0x382557[_0xac1f('0x30')][_0xac1f('0x31')]));_0x3b600a['attributes']=_0x3b600a[_0xac1f('0x32')]['length']?_0x3b600a['attributes']:_0x3df362['model'];_0x3b600a['order']=qs[_0xac1f('0x36')](_0x382557['query'][_0xac1f('0x36')]);_0x3b600a[_0xac1f('0x39')]=qs['filters'](_[_0xac1f('0x38')](_0x382557[_0xac1f('0x30')],_0x3df362[_0xac1f('0x37')]));if(_0x382557[_0xac1f('0x30')][_0xac1f('0x3c')]){_0x3b600a[_0xac1f('0x39')]=_['merge'](_0x3b600a[_0xac1f('0x39')],{'$or':_[_0xac1f('0x28')](_0x3b600a['attributes'],function(_0x176529){var _0x5d6934={};_0x5d6934[_0x176529]={'$like':'%'+_0x382557[_0xac1f('0x30')]['filter']+'%'};return _0x5d6934;})});}_0x3b600a=_[_0xac1f('0x3a')]({},_0x3b600a,_0x382557[_0xac1f('0x3d')]);return _0x1ba7f6[_0xac1f('0x4d')](_0x3b600a);}})[_0xac1f('0x21')](function(_0x41adba){if(_0x41adba){_0x1e5e83=_0x41adba[_0xac1f('0x33')];if(!_0x382557[_0xac1f('0x30')][_0xac1f('0x34')]('nolimit')){_0x3b600a['limit']=qs[_0xac1f('0x1a')](_0x382557[_0xac1f('0x30')]['limit']);_0x3b600a[_0xac1f('0x18')]=qs[_0xac1f('0x18')](_0x382557[_0xac1f('0x30')][_0xac1f('0x18')]);}return _0x1ba7f6['getSubjects'](_0x3b600a);}})[_0xac1f('0x21')](function(_0x3e7d1d){if(_0x3e7d1d){return _0x3e7d1d?{'count':_0x1e5e83,'rows':_0x3e7d1d}:null;}})[_0xac1f('0x21')](respondWithResult(_0x3218c1,null))[_0xac1f('0x45')](handleError(_0x3218c1,null));};exports['getDescriptions']=function(_0x51614,_0x33b256,_0x448bb8){var _0x468bc9={};var _0x8adc1f={};var _0x1936e6;var _0x240261;return db[_0xac1f('0x29')][_0xac1f('0x49')]({'where':{'id':_0x51614[_0xac1f('0x43')]['id']}})[_0xac1f('0x21')](handleEntityNotFound(_0x33b256,null))[_0xac1f('0x21')](function(_0x22a390){if(_0x22a390){_0x1936e6=_0x22a390;_0x8adc1f[_0xac1f('0x2e')]=_[_0xac1f('0x2f')](db['VtigerField'][_0xac1f('0x2a')]);_0x8adc1f[_0xac1f('0x30')]=_[_0xac1f('0x2f')](_0x51614[_0xac1f('0x30')]);_0x8adc1f[_0xac1f('0x37')]=_[_0xac1f('0x4b')](_0x8adc1f[_0xac1f('0x2e')],_0x8adc1f[_0xac1f('0x30')]);_0x468bc9['attributes']=_[_0xac1f('0x4b')](_0x8adc1f[_0xac1f('0x2e')],qs[_0xac1f('0x31')](_0x51614[_0xac1f('0x30')][_0xac1f('0x31')]));_0x468bc9[_0xac1f('0x32')]=_0x468bc9[_0xac1f('0x32')][_0xac1f('0x33')]?_0x468bc9['attributes']:_0x8adc1f['model'];_0x468bc9[_0xac1f('0x4c')]=qs['sort'](_0x51614[_0xac1f('0x30')][_0xac1f('0x36')]);_0x468bc9[_0xac1f('0x39')]=qs[_0xac1f('0x37')](_[_0xac1f('0x38')](_0x51614[_0xac1f('0x30')],_0x8adc1f[_0xac1f('0x37')]));if(_0x51614['query']['filter']){_0x468bc9[_0xac1f('0x39')]=_['merge'](_0x468bc9[_0xac1f('0x39')],{'$or':_['map'](_0x468bc9[_0xac1f('0x32')],function(_0x419e59){var _0x3aa84a={};_0x3aa84a[_0x419e59]={'$like':'%'+_0x51614['query']['filter']+'%'};return _0x3aa84a;})});}_0x468bc9=_[_0xac1f('0x3a')]({},_0x468bc9,_0x51614['options']);return _0x1936e6['getDescriptions'](_0x468bc9);}})[_0xac1f('0x21')](function(_0xb61b00){if(_0xb61b00){_0x240261=_0xb61b00[_0xac1f('0x33')];if(!_0x51614[_0xac1f('0x30')][_0xac1f('0x34')]('nolimit')){_0x468bc9[_0xac1f('0x1a')]=qs[_0xac1f('0x1a')](_0x51614[_0xac1f('0x30')][_0xac1f('0x1a')]);_0x468bc9[_0xac1f('0x18')]=qs['offset'](_0x51614[_0xac1f('0x30')][_0xac1f('0x18')]);}return _0x1936e6[_0xac1f('0x4e')](_0x468bc9);}})[_0xac1f('0x21')](function(_0x442c3d){if(_0x442c3d){return _0x442c3d?{'count':_0x240261,'rows':_0x442c3d}:null;}})[_0xac1f('0x21')](respondWithResult(_0x33b256,null))[_0xac1f('0x45')](handleError(_0x33b256,null));}; \ No newline at end of file +var _0xb63c=['getDescriptions','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','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','catch','create','find','params','body','getFields','findOne','getSubjects','VtigerField'];(function(_0x2152be,_0x232f64){var _0x1af596=function(_0x4ae0c8){while(--_0x4ae0c8){_0x2152be['push'](_0x2152be['shift']());}};_0x1af596(++_0x232f64);}(_0xb63c,0x155));var _0xcb63=function(_0x3a07b4,_0x469816){_0x3a07b4=_0x3a07b4-0x0;var _0x51dfa1=_0xb63c[_0x3a07b4];return _0x51dfa1;};'use strict';var emlformat=require(_0xcb63('0x0'));var rimraf=require(_0xcb63('0x1'));var zipdir=require(_0xcb63('0x2'));var jsonpatch=require(_0xcb63('0x3'));var rp=require(_0xcb63('0x4'));var moment=require(_0xcb63('0x5'));var BPromise=require(_0xcb63('0x6'));var Mustache=require(_0xcb63('0x7'));var util=require(_0xcb63('0x8'));var path=require(_0xcb63('0x9'));var sox=require(_0xcb63('0xa'));var csv=require(_0xcb63('0xb'));var ejs=require(_0xcb63('0xc'));var fs=require('fs');var fs_extra=require(_0xcb63('0xd'));var _=require(_0xcb63('0xe'));var squel=require(_0xcb63('0xf'));var crypto=require(_0xcb63('0x10'));var jsforce=require(_0xcb63('0x11'));var deskjs=require(_0xcb63('0x12'));var toCsv=require(_0xcb63('0xb'));var querystring=require(_0xcb63('0x13'));var Papa=require(_0xcb63('0x14'));var Redis=require('ioredis');var authService=require(_0xcb63('0x15'));var qs=require(_0xcb63('0x16'));var as=require(_0xcb63('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xcb63('0x18'));var utils=require(_0xcb63('0x19'));var config=require(_0xcb63('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xcb63('0x1b'))['db'];function respondWithStatusCode(_0x19940c,_0x575124){_0x575124=_0x575124||0xcc;return function(_0x1d4d72){if(_0x1d4d72){return _0x19940c[_0xcb63('0x1c')](_0x575124);}return _0x19940c[_0xcb63('0x1d')](_0x575124)[_0xcb63('0x1e')]();};}function respondWithResult(_0x4d4e57,_0xce72d3){_0xce72d3=_0xce72d3||0xc8;return function(_0x5191cb){if(_0x5191cb){return _0x4d4e57[_0xcb63('0x1d')](_0xce72d3)['json'](_0x5191cb);}};}function respondWithFilteredResult(_0x2363b9,_0x404f2a){return function(_0x44f13f){if(_0x44f13f){var _0x521bb7=typeof _0x404f2a[_0xcb63('0x1f')]===_0xcb63('0x20')&&typeof _0x404f2a[_0xcb63('0x21')]==='undefined';var _0x1bb242=_0x44f13f['count'];var _0x4a2ef0=_0x521bb7?0x0:_0x404f2a['offset'];var _0x234134=_0x521bb7?_0x44f13f['count']:_0x404f2a[_0xcb63('0x1f')]+_0x404f2a[_0xcb63('0x21')];var _0x48748d;if(_0x234134>=_0x1bb242){_0x234134=_0x1bb242;_0x48748d=0xc8;}else{_0x48748d=0xce;}_0x2363b9['status'](_0x48748d);return _0x2363b9['set'](_0xcb63('0x22'),_0x4a2ef0+'-'+_0x234134+'/'+_0x1bb242)[_0xcb63('0x23')](_0x44f13f);}return null;};}function patchUpdates(_0x10c6e4){return function(_0x518e47){try{jsonpatch[_0xcb63('0x24')](_0x518e47,_0x10c6e4,!![]);}catch(_0xf0c3c7){return BPromise[_0xcb63('0x25')](_0xf0c3c7);}return _0x518e47[_0xcb63('0x26')]();};}function saveUpdates(_0x5aad6f,_0x4a41b3){return function(_0x1b06e8){if(_0x1b06e8){return _0x1b06e8[_0xcb63('0x27')](_0x5aad6f)[_0xcb63('0x28')](function(_0x535279){return _0x535279;});}return null;};}function removeEntity(_0x2b3e4a,_0x27c6ee){return function(_0x3edbaa){if(_0x3edbaa){return _0x3edbaa[_0xcb63('0x29')]()[_0xcb63('0x28')](function(){_0x2b3e4a[_0xcb63('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28b194,_0x5c2ca3){return function(_0x2574a0){if(!_0x2574a0){_0x28b194['sendStatus'](0x194);}return _0x2574a0;};}function handleError(_0x4077bf,_0x48fb9d){_0x48fb9d=_0x48fb9d||0x1f4;return function(_0x47931e){logger[_0xcb63('0x2a')](_0x47931e['stack']);if(_0x47931e[_0xcb63('0x2b')]){delete _0x47931e[_0xcb63('0x2b')];}_0x4077bf['status'](_0x48fb9d)[_0xcb63('0x2c')](_0x47931e);};}exports[_0xcb63('0x2d')]=function(_0xdf9b3b,_0x1dc084){var _0x5c057c={},_0xcc45e9={},_0x994e92={'count':0x0,'rows':[]};var _0x36820a=_[_0xcb63('0x2e')](db[_0xcb63('0x2f')][_0xcb63('0x30')],function(_0x4a8420){return{'name':_0x4a8420[_0xcb63('0x31')],'type':_0x4a8420[_0xcb63('0x32')]['key']};});_0xcc45e9[_0xcb63('0x33')]=_[_0xcb63('0x2e')](_0x36820a,_0xcb63('0x2b'));_0xcc45e9[_0xcb63('0x34')]=_[_0xcb63('0x35')](_0xdf9b3b[_0xcb63('0x34')]);_0xcc45e9[_0xcb63('0x36')]=_['intersection'](_0xcc45e9[_0xcb63('0x33')],_0xcc45e9['query']);_0x5c057c[_0xcb63('0x37')]=_[_0xcb63('0x38')](_0xcc45e9[_0xcb63('0x33')],qs[_0xcb63('0x39')](_0xdf9b3b[_0xcb63('0x34')][_0xcb63('0x39')]));_0x5c057c['attributes']=_0x5c057c[_0xcb63('0x37')][_0xcb63('0x3a')]?_0x5c057c[_0xcb63('0x37')]:_0xcc45e9[_0xcb63('0x33')];if(!_0xdf9b3b['query'][_0xcb63('0x3b')](_0xcb63('0x3c'))){_0x5c057c[_0xcb63('0x21')]=qs[_0xcb63('0x21')](_0xdf9b3b[_0xcb63('0x34')][_0xcb63('0x21')]);_0x5c057c[_0xcb63('0x1f')]=qs[_0xcb63('0x1f')](_0xdf9b3b['query'][_0xcb63('0x1f')]);}_0x5c057c[_0xcb63('0x3d')]=qs[_0xcb63('0x3e')](_0xdf9b3b[_0xcb63('0x34')][_0xcb63('0x3e')]);_0x5c057c[_0xcb63('0x3f')]=qs['filters'](_[_0xcb63('0x40')](_0xdf9b3b['query'],_0xcc45e9[_0xcb63('0x36')]),_0x36820a);if(_0xdf9b3b[_0xcb63('0x34')][_0xcb63('0x41')]){_0x5c057c[_0xcb63('0x3f')]=_[_0xcb63('0x42')](_0x5c057c[_0xcb63('0x3f')],{'$or':_['map'](_0x36820a,function(_0x360076){if(_0x360076[_0xcb63('0x32')]!==_0xcb63('0x43')){var _0x4e7dc2={};_0x4e7dc2[_0x360076[_0xcb63('0x2b')]]={'$like':'%'+_0xdf9b3b[_0xcb63('0x34')][_0xcb63('0x41')]+'%'};return _0x4e7dc2;}})});}_0x5c057c=_['merge']({},_0x5c057c,_0xdf9b3b[_0xcb63('0x44')]);var _0x85598e={'where':_0x5c057c[_0xcb63('0x3f')]};return db['VtigerConfiguration']['count'](_0x85598e)[_0xcb63('0x28')](function(_0x45782b){_0x994e92[_0xcb63('0x45')]=_0x45782b;if(_0xdf9b3b[_0xcb63('0x34')][_0xcb63('0x46')]){_0x5c057c[_0xcb63('0x47')]=[{'all':!![]}];}return db[_0xcb63('0x2f')][_0xcb63('0x48')](_0x5c057c);})[_0xcb63('0x28')](function(_0x4e7f31){_0x994e92[_0xcb63('0x49')]=_0x4e7f31;return _0x994e92;})['then'](respondWithFilteredResult(_0x1dc084,_0x5c057c))['catch'](handleError(_0x1dc084,null));};exports[_0xcb63('0x4a')]=function(_0x17072d,_0xb80c4a){var _0x114da6={'raw':![],'where':{'id':_0x17072d['params']['id']}},_0x38ecf0={};_0x38ecf0[_0xcb63('0x33')]=_['keys'](db[_0xcb63('0x2f')][_0xcb63('0x30')]);_0x38ecf0[_0xcb63('0x34')]=_[_0xcb63('0x35')](_0x17072d[_0xcb63('0x34')]);_0x38ecf0[_0xcb63('0x36')]=_[_0xcb63('0x38')](_0x38ecf0[_0xcb63('0x33')],_0x38ecf0[_0xcb63('0x34')]);_0x114da6[_0xcb63('0x37')]=_[_0xcb63('0x38')](_0x38ecf0['model'],qs[_0xcb63('0x39')](_0x17072d[_0xcb63('0x34')]['fields']));_0x114da6[_0xcb63('0x37')]=_0x114da6[_0xcb63('0x37')][_0xcb63('0x3a')]?_0x114da6[_0xcb63('0x37')]:_0x38ecf0[_0xcb63('0x33')];if(_0x17072d[_0xcb63('0x34')][_0xcb63('0x46')]){_0x114da6[_0xcb63('0x47')]=[{'all':!![]}];}_0x114da6=_[_0xcb63('0x42')]({},_0x114da6,_0x17072d[_0xcb63('0x44')]);return db[_0xcb63('0x2f')]['find'](_0x114da6)[_0xcb63('0x28')](handleEntityNotFound(_0xb80c4a,null))['then'](respondWithResult(_0xb80c4a,null))[_0xcb63('0x4b')](handleError(_0xb80c4a,null));};exports[_0xcb63('0x4c')]=function(_0x1af3b2,_0x832908){return db[_0xcb63('0x2f')][_0xcb63('0x4c')](_0x1af3b2['body'],{})[_0xcb63('0x28')](respondWithResult(_0x832908,0xc9))[_0xcb63('0x4b')](handleError(_0x832908,null));};exports[_0xcb63('0x27')]=function(_0x1230d5,_0x28105a){if(_0x1230d5['body']['id']){delete _0x1230d5['body']['id'];}return db[_0xcb63('0x2f')][_0xcb63('0x4d')]({'where':{'id':_0x1230d5[_0xcb63('0x4e')]['id']}})[_0xcb63('0x28')](handleEntityNotFound(_0x28105a,null))[_0xcb63('0x28')](saveUpdates(_0x1230d5[_0xcb63('0x4f')],null))[_0xcb63('0x28')](respondWithResult(_0x28105a,null))[_0xcb63('0x4b')](handleError(_0x28105a,null));};exports[_0xcb63('0x29')]=function(_0x184b9f,_0x17227c){return db[_0xcb63('0x2f')][_0xcb63('0x4d')]({'where':{'id':_0x184b9f[_0xcb63('0x4e')]['id']}})['then'](handleEntityNotFound(_0x17227c,null))[_0xcb63('0x28')](removeEntity(_0x17227c,null))['catch'](handleError(_0x17227c,null));};exports[_0xcb63('0x50')]=function(_0x5ae0c9,_0x46f891,_0x2bebb2){var _0x49d1fd={};var _0x45f55b={};var _0x2168aa;var _0xe4a88f;return db[_0xcb63('0x2f')][_0xcb63('0x51')]({'where':{'id':_0x5ae0c9[_0xcb63('0x4e')]['id']}})[_0xcb63('0x28')](handleEntityNotFound(_0x46f891,null))[_0xcb63('0x28')](function(_0x2876eb){if(_0x2876eb){_0x2168aa=_0x2876eb;_0x45f55b['model']=_[_0xcb63('0x35')](db['VtigerField'][_0xcb63('0x30')]);_0x45f55b[_0xcb63('0x34')]=_['keys'](_0x5ae0c9['query']);_0x45f55b[_0xcb63('0x36')]=_[_0xcb63('0x38')](_0x45f55b[_0xcb63('0x33')],_0x45f55b[_0xcb63('0x34')]);_0x49d1fd[_0xcb63('0x37')]=_['intersection'](_0x45f55b[_0xcb63('0x33')],qs[_0xcb63('0x39')](_0x5ae0c9['query'][_0xcb63('0x39')]));_0x49d1fd[_0xcb63('0x37')]=_0x49d1fd[_0xcb63('0x37')][_0xcb63('0x3a')]?_0x49d1fd[_0xcb63('0x37')]:_0x45f55b[_0xcb63('0x33')];_0x49d1fd['order']=qs[_0xcb63('0x3e')](_0x5ae0c9[_0xcb63('0x34')][_0xcb63('0x3e')]);_0x49d1fd[_0xcb63('0x3f')]=qs['filters'](_[_0xcb63('0x40')](_0x5ae0c9[_0xcb63('0x34')],_0x45f55b[_0xcb63('0x36')]));if(_0x5ae0c9[_0xcb63('0x34')]['filter']){_0x49d1fd[_0xcb63('0x3f')]=_[_0xcb63('0x42')](_0x49d1fd[_0xcb63('0x3f')],{'$or':_[_0xcb63('0x2e')](_0x49d1fd['attributes'],function(_0x48f36c){var _0x48ddcb={};_0x48ddcb[_0x48f36c]={'$like':'%'+_0x5ae0c9['query'][_0xcb63('0x41')]+'%'};return _0x48ddcb;})});}_0x49d1fd=_[_0xcb63('0x42')]({},_0x49d1fd,_0x5ae0c9['options']);return _0x2168aa[_0xcb63('0x50')](_0x49d1fd);}})['then'](function(_0x5d38d5){if(_0x5d38d5){_0xe4a88f=_0x5d38d5[_0xcb63('0x3a')];if(!_0x5ae0c9['query'][_0xcb63('0x3b')](_0xcb63('0x3c'))){_0x49d1fd['limit']=qs['limit'](_0x5ae0c9[_0xcb63('0x34')][_0xcb63('0x21')]);_0x49d1fd[_0xcb63('0x1f')]=qs['offset'](_0x5ae0c9[_0xcb63('0x34')][_0xcb63('0x1f')]);}return _0x2168aa[_0xcb63('0x50')](_0x49d1fd);}})[_0xcb63('0x28')](function(_0x4f153a){if(_0x4f153a){return _0x4f153a?{'count':_0xe4a88f,'rows':_0x4f153a}:null;}})[_0xcb63('0x28')](respondWithResult(_0x46f891,null))[_0xcb63('0x4b')](handleError(_0x46f891,null));};exports[_0xcb63('0x52')]=function(_0x850f4b,_0x2a5eeb,_0x55ccc2){var _0x2edc4e={};var _0x309ffb={};var _0x4a3bc0;var _0x572fc0;return db[_0xcb63('0x2f')][_0xcb63('0x51')]({'where':{'id':_0x850f4b[_0xcb63('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2a5eeb,null))[_0xcb63('0x28')](function(_0xbb5259){if(_0xbb5259){_0x4a3bc0=_0xbb5259;_0x309ffb[_0xcb63('0x33')]=_[_0xcb63('0x35')](db['VtigerField'][_0xcb63('0x30')]);_0x309ffb[_0xcb63('0x34')]=_[_0xcb63('0x35')](_0x850f4b[_0xcb63('0x34')]);_0x309ffb[_0xcb63('0x36')]=_['intersection'](_0x309ffb['model'],_0x309ffb[_0xcb63('0x34')]);_0x2edc4e[_0xcb63('0x37')]=_[_0xcb63('0x38')](_0x309ffb['model'],qs['fields'](_0x850f4b[_0xcb63('0x34')][_0xcb63('0x39')]));_0x2edc4e[_0xcb63('0x37')]=_0x2edc4e['attributes'][_0xcb63('0x3a')]?_0x2edc4e['attributes']:_0x309ffb[_0xcb63('0x33')];_0x2edc4e[_0xcb63('0x3d')]=qs[_0xcb63('0x3e')](_0x850f4b[_0xcb63('0x34')][_0xcb63('0x3e')]);_0x2edc4e[_0xcb63('0x3f')]=qs['filters'](_[_0xcb63('0x40')](_0x850f4b[_0xcb63('0x34')],_0x309ffb[_0xcb63('0x36')]));if(_0x850f4b[_0xcb63('0x34')][_0xcb63('0x41')]){_0x2edc4e[_0xcb63('0x3f')]=_[_0xcb63('0x42')](_0x2edc4e[_0xcb63('0x3f')],{'$or':_['map'](_0x2edc4e[_0xcb63('0x37')],function(_0x2a6c0e){var _0x436bc6={};_0x436bc6[_0x2a6c0e]={'$like':'%'+_0x850f4b[_0xcb63('0x34')][_0xcb63('0x41')]+'%'};return _0x436bc6;})});}_0x2edc4e=_[_0xcb63('0x42')]({},_0x2edc4e,_0x850f4b[_0xcb63('0x44')]);return _0x4a3bc0[_0xcb63('0x52')](_0x2edc4e);}})[_0xcb63('0x28')](function(_0x3088ca){if(_0x3088ca){_0x572fc0=_0x3088ca[_0xcb63('0x3a')];if(!_0x850f4b[_0xcb63('0x34')][_0xcb63('0x3b')](_0xcb63('0x3c'))){_0x2edc4e['limit']=qs['limit'](_0x850f4b[_0xcb63('0x34')][_0xcb63('0x21')]);_0x2edc4e[_0xcb63('0x1f')]=qs['offset'](_0x850f4b[_0xcb63('0x34')][_0xcb63('0x1f')]);}return _0x4a3bc0[_0xcb63('0x52')](_0x2edc4e);}})[_0xcb63('0x28')](function(_0x4efd6d){if(_0x4efd6d){return _0x4efd6d?{'count':_0x572fc0,'rows':_0x4efd6d}:null;}})['then'](respondWithResult(_0x2a5eeb,null))[_0xcb63('0x4b')](handleError(_0x2a5eeb,null));};exports['getDescriptions']=function(_0x4994ac,_0x8dfe88,_0x28f7b1){var _0x36a8ce={};var _0x3575bf={};var _0x12b782;var _0x128525;return db[_0xcb63('0x2f')][_0xcb63('0x51')]({'where':{'id':_0x4994ac['params']['id']}})[_0xcb63('0x28')](handleEntityNotFound(_0x8dfe88,null))['then'](function(_0x5c26cd){if(_0x5c26cd){_0x12b782=_0x5c26cd;_0x3575bf[_0xcb63('0x33')]=_[_0xcb63('0x35')](db[_0xcb63('0x53')]['rawAttributes']);_0x3575bf[_0xcb63('0x34')]=_[_0xcb63('0x35')](_0x4994ac['query']);_0x3575bf[_0xcb63('0x36')]=_[_0xcb63('0x38')](_0x3575bf['model'],_0x3575bf[_0xcb63('0x34')]);_0x36a8ce['attributes']=_[_0xcb63('0x38')](_0x3575bf[_0xcb63('0x33')],qs[_0xcb63('0x39')](_0x4994ac['query'][_0xcb63('0x39')]));_0x36a8ce[_0xcb63('0x37')]=_0x36a8ce[_0xcb63('0x37')][_0xcb63('0x3a')]?_0x36a8ce[_0xcb63('0x37')]:_0x3575bf[_0xcb63('0x33')];_0x36a8ce[_0xcb63('0x3d')]=qs[_0xcb63('0x3e')](_0x4994ac[_0xcb63('0x34')]['sort']);_0x36a8ce[_0xcb63('0x3f')]=qs[_0xcb63('0x36')](_[_0xcb63('0x40')](_0x4994ac[_0xcb63('0x34')],_0x3575bf['filters']));if(_0x4994ac[_0xcb63('0x34')]['filter']){_0x36a8ce['where']=_[_0xcb63('0x42')](_0x36a8ce['where'],{'$or':_[_0xcb63('0x2e')](_0x36a8ce[_0xcb63('0x37')],function(_0x1b7a42){var _0x59cbf6={};_0x59cbf6[_0x1b7a42]={'$like':'%'+_0x4994ac[_0xcb63('0x34')][_0xcb63('0x41')]+'%'};return _0x59cbf6;})});}_0x36a8ce=_[_0xcb63('0x42')]({},_0x36a8ce,_0x4994ac[_0xcb63('0x44')]);return _0x12b782[_0xcb63('0x54')](_0x36a8ce);}})[_0xcb63('0x28')](function(_0x2dc581){if(_0x2dc581){_0x128525=_0x2dc581[_0xcb63('0x3a')];if(!_0x4994ac['query'][_0xcb63('0x3b')]('nolimit')){_0x36a8ce['limit']=qs['limit'](_0x4994ac[_0xcb63('0x34')][_0xcb63('0x21')]);_0x36a8ce[_0xcb63('0x1f')]=qs[_0xcb63('0x1f')](_0x4994ac[_0xcb63('0x34')][_0xcb63('0x1f')]);}return _0x12b782[_0xcb63('0x54')](_0x36a8ce);}})[_0xcb63('0x28')](function(_0x32b791){if(_0x32b791){return _0x32b791?{'count':_0x128525,'rows':_0x32b791}:null;}})['then'](respondWithResult(_0x8dfe88,null))[_0xcb63('0x4b')](handleError(_0x8dfe88,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index ec6c832..6fefaf5 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 _0x5578=['lodash','util','../../config/logger','api','moment','bluebird','./intVtigerConfiguration.attributes','exports','define'];(function(_0xe2a03e,_0x26e180){var _0x5e8538=function(_0x1e3a1d){while(--_0x1e3a1d){_0xe2a03e['push'](_0xe2a03e['shift']());}};_0x5e8538(++_0x26e180);}(_0x5578,0x17a));var _0x8557=function(_0x4f5108,_0x46a54b){_0x4f5108=_0x4f5108-0x0;var _0x2d56ca=_0x5578[_0x4f5108];return _0x2d56ca;};'use strict';var _=require(_0x8557('0x0'));var util=require(_0x8557('0x1'));var logger=require(_0x8557('0x2'))(_0x8557('0x3'));var moment=require(_0x8557('0x4'));var BPromise=require(_0x8557('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(_0x8557('0x6'));module[_0x8557('0x7')]=function(_0x389179,_0x393671){return _0x389179[_0x8557('0x8')]('VtigerConfiguration',attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x85c2=['request-promise','path','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','bluebird'];(function(_0x45b29d,_0x44ce43){var _0x32d74=function(_0x559eff){while(--_0x559eff){_0x45b29d['push'](_0x45b29d['shift']());}};_0x32d74(++_0x44ce43);}(_0x85c2,0x1f4));var _0x285c=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0x85c2[_0x101e7b];return _0x4995c0;};'use strict';var _=require(_0x285c('0x0'));var util=require(_0x285c('0x1'));var logger=require(_0x285c('0x2'))('api');var moment=require('moment');var BPromise=require(_0x285c('0x3'));var rp=require(_0x285c('0x4'));var fs=require('fs');var path=require(_0x285c('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intVtigerConfiguration.attributes');module['exports']=function(_0x413d19,_0x4e937f){return _0x413d19[_0x285c('0x6')](_0x285c('0x7'),attributes,{'tableName':_0x285c('0x8'),'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 254f750..33dda00 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 _0xc169=['stringify','error','message','info','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x548e4b,_0x149c4c){var _0x2694b2=function(_0xdc56f6){while(--_0xdc56f6){_0x548e4b['push'](_0x548e4b['shift']());}};_0x2694b2(++_0x149c4c);}(_0xc169,0x16e));var _0x9c16=function(_0x35e534,_0x6337d9){_0x35e534=_0x35e534-0x0;var _0x1304e4=_0xc169[_0x35e534];return _0x1304e4;};'use strict';var _=require(_0x9c16('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9c16('0x1'));var fs=require('fs');var Redis=require(_0x9c16('0x2'));var db=require(_0x9c16('0x3'))['db'];var utils=require(_0x9c16('0x4'));var logger=require(_0x9c16('0x5'))(_0x9c16('0x6'));var config=require('../../config/environment');var jayson=require(_0x9c16('0x7'));var client=jayson[_0x9c16('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x50cc97,_0x32a641,_0x31f5da){return new BPromise(function(_0x9009c1,_0x50c490){return client['request'](_0x50cc97,_0x31f5da)[_0x9c16('0x9')](function(_0x2f9fec){logger['info'](_0x9c16('0xa'),_0x32a641,_0x9c16('0xb'));logger[_0x9c16('0xc')](_0x9c16('0xd'),_0x32a641,_0x9c16('0xb'),JSON[_0x9c16('0xe')](_0x2f9fec));if(_0x2f9fec[_0x9c16('0xf')]){if(_0x2f9fec[_0x9c16('0xf')]['code']===0x1f4){logger[_0x9c16('0xf')](_0x9c16('0xa'),_0x32a641,_0x2f9fec[_0x9c16('0xf')][_0x9c16('0x10')]);return _0x50c490(_0x2f9fec[_0x9c16('0xf')][_0x9c16('0x10')]);}logger[_0x9c16('0xf')]('VtigerConfiguration,\x20%s,\x20%s',_0x32a641,_0x2f9fec['error']['message']);return _0x9009c1(_0x2f9fec[_0x9c16('0xf')][_0x9c16('0x10')]);}else{logger[_0x9c16('0x11')](_0x9c16('0xa'),_0x32a641,'request\x20sent');_0x9009c1(_0x2f9fec[_0x9c16('0x12')]['message']);}})[_0x9c16('0x13')](function(_0x2a352d){logger[_0x9c16('0xf')](_0x9c16('0xa'),_0x32a641,_0x2a352d);_0x50c490(_0x2a352d);});});} \ No newline at end of file +var _0xea86=['debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x102bdd,_0x3b05ba){var _0x1fc2d0=function(_0x5651b6){while(--_0x5651b6){_0x102bdd['push'](_0x102bdd['shift']());}};_0x1fc2d0(++_0x3b05ba);}(_0xea86,0x110));var _0x6ea8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xea86[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x6ea8('0x0'));var util=require('util');var moment=require(_0x6ea8('0x1'));var BPromise=require(_0x6ea8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ea8('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6ea8('0x4'))(_0x6ea8('0x5'));var config=require(_0x6ea8('0x6'));var jayson=require(_0x6ea8('0x7'));var client=jayson[_0x6ea8('0x8')][_0x6ea8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x195458,_0x36af26,_0x46e31d){return new BPromise(function(_0x3b5316,_0x2cb03d){return client[_0x6ea8('0xa')](_0x195458,_0x46e31d)['then'](function(_0x360ead){logger[_0x6ea8('0xb')](_0x6ea8('0xc'),_0x36af26,_0x6ea8('0xd'));logger[_0x6ea8('0xe')](_0x6ea8('0xf'),_0x36af26,_0x6ea8('0xd'),JSON[_0x6ea8('0x10')](_0x360ead));if(_0x360ead[_0x6ea8('0x11')]){if(_0x360ead[_0x6ea8('0x11')][_0x6ea8('0x12')]===0x1f4){logger[_0x6ea8('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x36af26,_0x360ead[_0x6ea8('0x11')][_0x6ea8('0x13')]);return _0x2cb03d(_0x360ead[_0x6ea8('0x11')]['message']);}logger[_0x6ea8('0x11')](_0x6ea8('0xc'),_0x36af26,_0x360ead[_0x6ea8('0x11')][_0x6ea8('0x13')]);return _0x3b5316(_0x360ead['error'][_0x6ea8('0x13')]);}else{logger[_0x6ea8('0xb')](_0x6ea8('0xc'),_0x36af26,'request\x20sent');_0x3b5316(_0x360ead[_0x6ea8('0x14')][_0x6ea8('0x13')]);}})[_0x6ea8('0x15')](function(_0x15ece9){logger['error'](_0x6ea8('0xc'),_0x36af26,_0x15ece9);_0x2cb03d(_0x15ece9);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 2e1afb5..d78cd79 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 _0x5562=['multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','create','put','update','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x5562,0xaa));var _0x2556=function(_0x5e07a7,_0x1438b3){_0x5e07a7=_0x5e07a7-0x0;var _0x22ced5=_0x5562[_0x5e07a7];return _0x22ced5;};'use strict';var multer=require(_0x2556('0x0'));var util=require('util');var path=require(_0x2556('0x1'));var timeout=require(_0x2556('0x2'));var express=require(_0x2556('0x3'));var router=express['Router']();var fs_extra=require(_0x2556('0x4'));var auth=require(_0x2556('0x5'));var interaction=require(_0x2556('0x6'));var config=require(_0x2556('0x7'));var controller=require(_0x2556('0x8'));router[_0x2556('0x9')]('/',auth[_0x2556('0xa')](),controller[_0x2556('0xb')]);router['get'](_0x2556('0xc'),auth[_0x2556('0xa')](),controller['show']);router['post']('/',auth[_0x2556('0xa')](),controller[_0x2556('0xd')]);router[_0x2556('0xe')](_0x2556('0xc'),auth['isAuthenticated'](),controller[_0x2556('0xf')]);router['delete'](_0x2556('0xc'),auth[_0x2556('0xa')](),controller['destroy']);module[_0x2556('0x10')]=router; \ No newline at end of file +var _0xf0a4=['show','post','create','put','/:id','update','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x38facd,_0x5ad181){var _0x192066=function(_0x5469e1){while(--_0x5469e1){_0x38facd['push'](_0x38facd['shift']());}};_0x192066(++_0x5ad181);}(_0xf0a4,0x178));var _0x4f0a=function(_0x20bf79,_0x53b0d2){_0x20bf79=_0x20bf79-0x0;var _0x2a791f=_0xf0a4[_0x20bf79];return _0x2a791f;};'use strict';var multer=require(_0x4f0a('0x0'));var util=require('util');var path=require(_0x4f0a('0x1'));var timeout=require('connect-timeout');var express=require(_0x4f0a('0x2'));var router=express[_0x4f0a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4f0a('0x4'));var interaction=require(_0x4f0a('0x5'));var config=require(_0x4f0a('0x6'));var controller=require('./intVtigerField.controller');router['get']('/',auth[_0x4f0a('0x7')](),controller['index']);router['get']('/:id',auth[_0x4f0a('0x7')](),controller[_0x4f0a('0x8')]);router[_0x4f0a('0x9')]('/',auth[_0x4f0a('0x7')](),controller[_0x4f0a('0xa')]);router[_0x4f0a('0xb')](_0x4f0a('0xc'),auth[_0x4f0a('0x7')](),controller[_0x4f0a('0xd')]);router['delete']('/:id',auth[_0x4f0a('0x7')](),controller[_0x4f0a('0xe')]);module[_0x4f0a('0xf')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 0f664e8..8a7750d 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 _0xd9db=['customVariable','keyValue','string','STRING','variable','sequelize','ENUM'];(function(_0x4b9511,_0x4c4f39){var _0x329782=function(_0x212662){while(--_0x212662){_0x4b9511['push'](_0x4b9511['shift']());}};_0x329782(++_0x4c4f39);}(_0xd9db,0x124));var _0xbd9d=function(_0x4ef783,_0x12b4f0){_0x4ef783=_0x4ef783-0x0;var _0x3eae9a=_0xd9db[_0x4ef783];return _0x3eae9a;};'use strict';var Sequelize=require(_0xbd9d('0x0'));module['exports']={'type':{'type':Sequelize[_0xbd9d('0x1')]('string','variable',_0xbd9d('0x2'),_0xbd9d('0x3'),'picklist'),'defaultValue':_0xbd9d('0x4')},'content':{'type':Sequelize[_0xbd9d('0x5')]},'key':{'type':Sequelize[_0xbd9d('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xbd9d('0x4'),_0xbd9d('0x6'),_0xbd9d('0x2'))},'keyContent':{'type':Sequelize[_0xbd9d('0x5')]},'idField':{'type':Sequelize[_0xbd9d('0x5')]},'nameField':{'type':Sequelize[_0xbd9d('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbd9d('0x5')]}}; \ No newline at end of file +var _0x3098=['exports','string','STRING','ENUM','customVariable','sequelize'];(function(_0x1b9e66,_0x7ba3ac){var _0x1efadc=function(_0x111634){while(--_0x111634){_0x1b9e66['push'](_0x1b9e66['shift']());}};_0x1efadc(++_0x7ba3ac);}(_0x3098,0x113));var _0x8309=function(_0x1d7037,_0x57dd95){_0x1d7037=_0x1d7037-0x0;var _0x4d6568=_0x3098[_0x1d7037];return _0x4d6568;};'use strict';var Sequelize=require(_0x8309('0x0'));module[_0x8309('0x1')]={'type':{'type':Sequelize['ENUM'](_0x8309('0x2'),'variable','customVariable','keyValue','picklist'),'defaultValue':_0x8309('0x2')},'content':{'type':Sequelize[_0x8309('0x3')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8309('0x4')](_0x8309('0x2'),'variable',_0x8309('0x5'))},'keyContent':{'type':Sequelize[_0x8309('0x3')]},'idField':{'type':Sequelize[_0x8309('0x3')]},'nameField':{'type':Sequelize[_0x8309('0x3')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 48cf92b..0570a52 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 _0xd1d5=['fieldName','key','keys','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','catch','show','params','length','includeAll','include','find','create','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','name','send','index','map','VtigerField','rawAttributes'];(function(_0x39e9df,_0x3deb89){var _0x16a774=function(_0x24a3f4){while(--_0x24a3f4){_0x39e9df['push'](_0x39e9df['shift']());}};_0x16a774(++_0x3deb89);}(_0xd1d5,0x1eb));var _0x5d1d=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xd1d5[_0x126558];return _0x1f6d14;};'use strict';var emlformat=require(_0x5d1d('0x0'));var rimraf=require(_0x5d1d('0x1'));var zipdir=require(_0x5d1d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5d1d('0x3'));var moment=require(_0x5d1d('0x4'));var BPromise=require(_0x5d1d('0x5'));var Mustache=require(_0x5d1d('0x6'));var util=require(_0x5d1d('0x7'));var path=require('path');var sox=require(_0x5d1d('0x8'));var csv=require(_0x5d1d('0x9'));var ejs=require(_0x5d1d('0xa'));var fs=require('fs');var fs_extra=require(_0x5d1d('0xb'));var _=require(_0x5d1d('0xc'));var squel=require(_0x5d1d('0xd'));var crypto=require(_0x5d1d('0xe'));var jsforce=require(_0x5d1d('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x5d1d('0x9'));var querystring=require(_0x5d1d('0x10'));var Papa=require('papaparse');var Redis=require(_0x5d1d('0x11'));var authService=require(_0x5d1d('0x12'));var qs=require(_0x5d1d('0x13'));var as=require(_0x5d1d('0x14'));var hardwareService=require(_0x5d1d('0x15'));var logger=require('../../config/logger')(_0x5d1d('0x16'));var utils=require(_0x5d1d('0x17'));var config=require(_0x5d1d('0x18'));var licenseUtil=require(_0x5d1d('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59982d,_0x15e960){_0x15e960=_0x15e960||0xcc;return function(_0x3905a2){if(_0x3905a2){return _0x59982d['sendStatus'](_0x15e960);}return _0x59982d[_0x5d1d('0x1a')](_0x15e960)[_0x5d1d('0x1b')]();};}function respondWithResult(_0x57e392,_0x45a119){_0x45a119=_0x45a119||0xc8;return function(_0x3ab5f8){if(_0x3ab5f8){return _0x57e392['status'](_0x45a119)[_0x5d1d('0x1c')](_0x3ab5f8);}};}function respondWithFilteredResult(_0xd561ae,_0x4cae93){return function(_0x30d217){if(_0x30d217){var _0x34c164=typeof _0x4cae93[_0x5d1d('0x1d')]===_0x5d1d('0x1e')&&typeof _0x4cae93[_0x5d1d('0x1f')]===_0x5d1d('0x1e');var _0x5355fd=_0x30d217[_0x5d1d('0x20')];var _0x24e1d0=_0x34c164?0x0:_0x4cae93[_0x5d1d('0x1d')];var _0x1e78f5=_0x34c164?_0x30d217[_0x5d1d('0x20')]:_0x4cae93[_0x5d1d('0x1d')]+_0x4cae93[_0x5d1d('0x1f')];var _0x28ea5c;if(_0x1e78f5>=_0x5355fd){_0x1e78f5=_0x5355fd;_0x28ea5c=0xc8;}else{_0x28ea5c=0xce;}_0xd561ae[_0x5d1d('0x1a')](_0x28ea5c);return _0xd561ae[_0x5d1d('0x21')](_0x5d1d('0x22'),_0x24e1d0+'-'+_0x1e78f5+'/'+_0x5355fd)[_0x5d1d('0x1c')](_0x30d217);}return null;};}function patchUpdates(_0x31e586){return function(_0x2b13d2){try{jsonpatch[_0x5d1d('0x23')](_0x2b13d2,_0x31e586,!![]);}catch(_0x21c6c9){return BPromise[_0x5d1d('0x24')](_0x21c6c9);}return _0x2b13d2[_0x5d1d('0x25')]();};}function saveUpdates(_0x214e19,_0x115930){return function(_0x501f32){if(_0x501f32){return _0x501f32[_0x5d1d('0x26')](_0x214e19)[_0x5d1d('0x27')](function(_0x17d2d1){return _0x17d2d1;});}return null;};}function removeEntity(_0x5ebc09,_0x6eff84){return function(_0x26b7b1){if(_0x26b7b1){return _0x26b7b1['destroy']()['then'](function(){_0x5ebc09[_0x5d1d('0x1a')](0xcc)[_0x5d1d('0x1b')]();});}};}function handleEntityNotFound(_0x4749d3,_0x3c0a43){return function(_0xfdf0ad){if(!_0xfdf0ad){_0x4749d3[_0x5d1d('0x28')](0x194);}return _0xfdf0ad;};}function handleError(_0x2ef4d0,_0x58091a){_0x58091a=_0x58091a||0x1f4;return function(_0x5142db){logger[_0x5d1d('0x29')](_0x5142db['stack']);if(_0x5142db[_0x5d1d('0x2a')]){delete _0x5142db['name'];}_0x2ef4d0[_0x5d1d('0x1a')](_0x58091a)[_0x5d1d('0x2b')](_0x5142db);};}exports[_0x5d1d('0x2c')]=function(_0x3030a2,_0x1c72cf){var _0x4a7f0d={},_0xb6f964={},_0x4a8845={'count':0x0,'rows':[]};var _0x30c6b2=_[_0x5d1d('0x2d')](db[_0x5d1d('0x2e')][_0x5d1d('0x2f')],function(_0x4d29d1){return{'name':_0x4d29d1[_0x5d1d('0x30')],'type':_0x4d29d1['type'][_0x5d1d('0x31')]};});_0xb6f964['model']=_[_0x5d1d('0x2d')](_0x30c6b2,_0x5d1d('0x2a'));_0xb6f964['query']=_[_0x5d1d('0x32')](_0x3030a2[_0x5d1d('0x33')]);_0xb6f964[_0x5d1d('0x34')]=_[_0x5d1d('0x35')](_0xb6f964[_0x5d1d('0x36')],_0xb6f964[_0x5d1d('0x33')]);_0x4a7f0d['attributes']=_[_0x5d1d('0x35')](_0xb6f964[_0x5d1d('0x36')],qs[_0x5d1d('0x37')](_0x3030a2[_0x5d1d('0x33')][_0x5d1d('0x37')]));_0x4a7f0d['attributes']=_0x4a7f0d['attributes']['length']?_0x4a7f0d[_0x5d1d('0x38')]:_0xb6f964['model'];if(!_0x3030a2[_0x5d1d('0x33')][_0x5d1d('0x39')](_0x5d1d('0x3a'))){_0x4a7f0d['limit']=qs[_0x5d1d('0x1f')](_0x3030a2[_0x5d1d('0x33')]['limit']);_0x4a7f0d[_0x5d1d('0x1d')]=qs[_0x5d1d('0x1d')](_0x3030a2[_0x5d1d('0x33')][_0x5d1d('0x1d')]);}_0x4a7f0d[_0x5d1d('0x3b')]=qs[_0x5d1d('0x3c')](_0x3030a2[_0x5d1d('0x33')][_0x5d1d('0x3c')]);_0x4a7f0d[_0x5d1d('0x3d')]=qs[_0x5d1d('0x34')](_[_0x5d1d('0x3e')](_0x3030a2[_0x5d1d('0x33')],_0xb6f964[_0x5d1d('0x34')]),_0x30c6b2);if(_0x3030a2['query'][_0x5d1d('0x3f')]){_0x4a7f0d['where']=_[_0x5d1d('0x40')](_0x4a7f0d['where'],{'$or':_[_0x5d1d('0x2d')](_0x30c6b2,function(_0x2df2ac){if(_0x2df2ac[_0x5d1d('0x41')]!=='VIRTUAL'){var _0x2c151f={};_0x2c151f[_0x2df2ac[_0x5d1d('0x2a')]]={'$like':'%'+_0x3030a2[_0x5d1d('0x33')][_0x5d1d('0x3f')]+'%'};return _0x2c151f;}})});}_0x4a7f0d=_['merge']({},_0x4a7f0d,_0x3030a2[_0x5d1d('0x42')]);var _0x245fd5={'where':_0x4a7f0d[_0x5d1d('0x3d')]};return db[_0x5d1d('0x2e')][_0x5d1d('0x20')](_0x245fd5)[_0x5d1d('0x27')](function(_0x558fdd){_0x4a8845[_0x5d1d('0x20')]=_0x558fdd;if(_0x3030a2[_0x5d1d('0x33')]['includeAll']){_0x4a7f0d['include']=[{'all':!![]}];}return db[_0x5d1d('0x2e')]['findAll'](_0x4a7f0d);})[_0x5d1d('0x27')](function(_0x304fe1){_0x4a8845['rows']=_0x304fe1;return _0x4a8845;})['then'](respondWithFilteredResult(_0x1c72cf,_0x4a7f0d))[_0x5d1d('0x43')](handleError(_0x1c72cf,null));};exports[_0x5d1d('0x44')]=function(_0x470432,_0x2e0480){var _0x560343={'raw':!![],'where':{'id':_0x470432[_0x5d1d('0x45')]['id']}},_0x1ab388={};_0x1ab388[_0x5d1d('0x36')]=_[_0x5d1d('0x32')](db[_0x5d1d('0x2e')][_0x5d1d('0x2f')]);_0x1ab388[_0x5d1d('0x33')]=_[_0x5d1d('0x32')](_0x470432[_0x5d1d('0x33')]);_0x1ab388['filters']=_[_0x5d1d('0x35')](_0x1ab388[_0x5d1d('0x36')],_0x1ab388['query']);_0x560343[_0x5d1d('0x38')]=_[_0x5d1d('0x35')](_0x1ab388[_0x5d1d('0x36')],qs[_0x5d1d('0x37')](_0x470432[_0x5d1d('0x33')]['fields']));_0x560343[_0x5d1d('0x38')]=_0x560343['attributes'][_0x5d1d('0x46')]?_0x560343[_0x5d1d('0x38')]:_0x1ab388['model'];if(_0x470432['query'][_0x5d1d('0x47')]){_0x560343[_0x5d1d('0x48')]=[{'all':!![]}];}_0x560343=_[_0x5d1d('0x40')]({},_0x560343,_0x470432[_0x5d1d('0x42')]);return db['VtigerField'][_0x5d1d('0x49')](_0x560343)[_0x5d1d('0x27')](handleEntityNotFound(_0x2e0480,null))[_0x5d1d('0x27')](respondWithResult(_0x2e0480,null))['catch'](handleError(_0x2e0480,null));};exports[_0x5d1d('0x4a')]=function(_0x416091,_0x157235){return db[_0x5d1d('0x2e')][_0x5d1d('0x4a')](_0x416091[_0x5d1d('0x4b')],{})[_0x5d1d('0x27')](respondWithResult(_0x157235,0xc9))[_0x5d1d('0x43')](handleError(_0x157235,null));};exports[_0x5d1d('0x26')]=function(_0x4294fc,_0x53a37c){if(_0x4294fc[_0x5d1d('0x4b')]['id']){delete _0x4294fc['body']['id'];}return db['VtigerField']['find']({'where':{'id':_0x4294fc[_0x5d1d('0x45')]['id']}})[_0x5d1d('0x27')](handleEntityNotFound(_0x53a37c,null))[_0x5d1d('0x27')](saveUpdates(_0x4294fc[_0x5d1d('0x4b')],null))['then'](respondWithResult(_0x53a37c,null))[_0x5d1d('0x43')](handleError(_0x53a37c,null));};exports[_0x5d1d('0x4c')]=function(_0x551f7d,_0x3e6625){return db[_0x5d1d('0x2e')]['find']({'where':{'id':_0x551f7d['params']['id']}})[_0x5d1d('0x27')](handleEntityNotFound(_0x3e6625,null))[_0x5d1d('0x27')](removeEntity(_0x3e6625,null))[_0x5d1d('0x43')](handleError(_0x3e6625,null));}; \ No newline at end of file +var _0xc5f6=['fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../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','reject','save','then','destroy','end','error','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','update','eml-format','rimraf','zip-dir'];(function(_0x557ffa,_0x453787){var _0x2a23af=function(_0x2b1ae4){while(--_0x2b1ae4){_0x557ffa['push'](_0x557ffa['shift']());}};_0x2a23af(++_0x453787);}(_0xc5f6,0x9d));var _0x6c5f=function(_0x457496,_0x4ce59e){_0x457496=_0x457496-0x0;var _0x4db06b=_0xc5f6[_0x457496];return _0x4db06b;};'use strict';var emlformat=require(_0x6c5f('0x0'));var rimraf=require(_0x6c5f('0x1'));var zipdir=require(_0x6c5f('0x2'));var jsonpatch=require(_0x6c5f('0x3'));var rp=require(_0x6c5f('0x4'));var moment=require(_0x6c5f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6c5f('0x6'));var util=require(_0x6c5f('0x7'));var path=require('path');var sox=require(_0x6c5f('0x8'));var csv=require(_0x6c5f('0x9'));var ejs=require(_0x6c5f('0xa'));var fs=require('fs');var fs_extra=require(_0x6c5f('0xb'));var _=require(_0x6c5f('0xc'));var squel=require(_0x6c5f('0xd'));var crypto=require('crypto');var jsforce=require(_0x6c5f('0xe'));var deskjs=require(_0x6c5f('0xf'));var toCsv=require(_0x6c5f('0x9'));var querystring=require(_0x6c5f('0x10'));var Papa=require(_0x6c5f('0x11'));var Redis=require(_0x6c5f('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6c5f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6c5f('0x14'));var logger=require(_0x6c5f('0x15'))(_0x6c5f('0x16'));var utils=require(_0x6c5f('0x17'));var config=require(_0x6c5f('0x18'));var licenseUtil=require(_0x6c5f('0x19'));var db=require(_0x6c5f('0x1a'))['db'];function respondWithStatusCode(_0x37f630,_0x117838){_0x117838=_0x117838||0xcc;return function(_0x4f75a4){if(_0x4f75a4){return _0x37f630[_0x6c5f('0x1b')](_0x117838);}return _0x37f630[_0x6c5f('0x1c')](_0x117838)['end']();};}function respondWithResult(_0x1ba28c,_0x40df61){_0x40df61=_0x40df61||0xc8;return function(_0x28ddb9){if(_0x28ddb9){return _0x1ba28c[_0x6c5f('0x1c')](_0x40df61)['json'](_0x28ddb9);}};}function respondWithFilteredResult(_0x430aae,_0x31c28a){return function(_0x293e41){if(_0x293e41){var _0x380c00=typeof _0x31c28a[_0x6c5f('0x1d')]===_0x6c5f('0x1e')&&typeof _0x31c28a[_0x6c5f('0x1f')]===_0x6c5f('0x1e');var _0x1db043=_0x293e41['count'];var _0x3f84c2=_0x380c00?0x0:_0x31c28a[_0x6c5f('0x1d')];var _0x363f8b=_0x380c00?_0x293e41[_0x6c5f('0x20')]:_0x31c28a[_0x6c5f('0x1d')]+_0x31c28a[_0x6c5f('0x1f')];var _0x361220;if(_0x363f8b>=_0x1db043){_0x363f8b=_0x1db043;_0x361220=0xc8;}else{_0x361220=0xce;}_0x430aae[_0x6c5f('0x1c')](_0x361220);return _0x430aae[_0x6c5f('0x21')](_0x6c5f('0x22'),_0x3f84c2+'-'+_0x363f8b+'/'+_0x1db043)[_0x6c5f('0x23')](_0x293e41);}return null;};}function patchUpdates(_0x12c500){return function(_0x4c728b){try{jsonpatch[_0x6c5f('0x24')](_0x4c728b,_0x12c500,!![]);}catch(_0x4058fa){return BPromise[_0x6c5f('0x25')](_0x4058fa);}return _0x4c728b[_0x6c5f('0x26')]();};}function saveUpdates(_0xcaaafd,_0x1b6600){return function(_0x1bc82f){if(_0x1bc82f){return _0x1bc82f['update'](_0xcaaafd)[_0x6c5f('0x27')](function(_0xd7cf3b){return _0xd7cf3b;});}return null;};}function removeEntity(_0x492bd3,_0x11360f){return function(_0x4b61b8){if(_0x4b61b8){return _0x4b61b8[_0x6c5f('0x28')]()[_0x6c5f('0x27')](function(){_0x492bd3['status'](0xcc)[_0x6c5f('0x29')]();});}};}function handleEntityNotFound(_0x187240,_0x4d9c75){return function(_0xa87698){if(!_0xa87698){_0x187240['sendStatus'](0x194);}return _0xa87698;};}function handleError(_0x11c359,_0x52756f){_0x52756f=_0x52756f||0x1f4;return function(_0x338723){logger[_0x6c5f('0x2a')](_0x338723[_0x6c5f('0x2b')]);if(_0x338723[_0x6c5f('0x2c')]){delete _0x338723['name'];}_0x11c359[_0x6c5f('0x1c')](_0x52756f)[_0x6c5f('0x2d')](_0x338723);};}exports[_0x6c5f('0x2e')]=function(_0x56675f,_0x1832c0){var _0x307fc6={},_0x872fdc={},_0x4fec1f={'count':0x0,'rows':[]};var _0x15cee=_[_0x6c5f('0x2f')](db[_0x6c5f('0x30')][_0x6c5f('0x31')],function(_0x26b5fe){return{'name':_0x26b5fe[_0x6c5f('0x32')],'type':_0x26b5fe[_0x6c5f('0x33')][_0x6c5f('0x34')]};});_0x872fdc[_0x6c5f('0x35')]=_['map'](_0x15cee,_0x6c5f('0x2c'));_0x872fdc[_0x6c5f('0x36')]=_[_0x6c5f('0x37')](_0x56675f[_0x6c5f('0x36')]);_0x872fdc[_0x6c5f('0x38')]=_['intersection'](_0x872fdc[_0x6c5f('0x35')],_0x872fdc['query']);_0x307fc6[_0x6c5f('0x39')]=_[_0x6c5f('0x3a')](_0x872fdc[_0x6c5f('0x35')],qs[_0x6c5f('0x3b')](_0x56675f[_0x6c5f('0x36')]['fields']));_0x307fc6[_0x6c5f('0x39')]=_0x307fc6[_0x6c5f('0x39')]['length']?_0x307fc6['attributes']:_0x872fdc['model'];if(!_0x56675f['query']['hasOwnProperty'](_0x6c5f('0x3c'))){_0x307fc6['limit']=qs[_0x6c5f('0x1f')](_0x56675f[_0x6c5f('0x36')]['limit']);_0x307fc6[_0x6c5f('0x1d')]=qs[_0x6c5f('0x1d')](_0x56675f['query'][_0x6c5f('0x1d')]);}_0x307fc6[_0x6c5f('0x3d')]=qs['sort'](_0x56675f['query'][_0x6c5f('0x3e')]);_0x307fc6[_0x6c5f('0x3f')]=qs[_0x6c5f('0x38')](_[_0x6c5f('0x40')](_0x56675f[_0x6c5f('0x36')],_0x872fdc[_0x6c5f('0x38')]),_0x15cee);if(_0x56675f[_0x6c5f('0x36')][_0x6c5f('0x41')]){_0x307fc6[_0x6c5f('0x3f')]=_[_0x6c5f('0x42')](_0x307fc6[_0x6c5f('0x3f')],{'$or':_[_0x6c5f('0x2f')](_0x15cee,function(_0x20a2e7){if(_0x20a2e7[_0x6c5f('0x33')]!==_0x6c5f('0x43')){var _0x3abb51={};_0x3abb51[_0x20a2e7[_0x6c5f('0x2c')]]={'$like':'%'+_0x56675f[_0x6c5f('0x36')]['filter']+'%'};return _0x3abb51;}})});}_0x307fc6=_[_0x6c5f('0x42')]({},_0x307fc6,_0x56675f[_0x6c5f('0x44')]);var _0x48c67f={'where':_0x307fc6[_0x6c5f('0x3f')]};return db[_0x6c5f('0x30')]['count'](_0x48c67f)[_0x6c5f('0x27')](function(_0x300022){_0x4fec1f[_0x6c5f('0x20')]=_0x300022;if(_0x56675f[_0x6c5f('0x36')][_0x6c5f('0x45')]){_0x307fc6[_0x6c5f('0x46')]=[{'all':!![]}];}return db[_0x6c5f('0x30')][_0x6c5f('0x47')](_0x307fc6);})[_0x6c5f('0x27')](function(_0x5288b1){_0x4fec1f[_0x6c5f('0x48')]=_0x5288b1;return _0x4fec1f;})[_0x6c5f('0x27')](respondWithFilteredResult(_0x1832c0,_0x307fc6))[_0x6c5f('0x49')](handleError(_0x1832c0,null));};exports['show']=function(_0x20ca50,_0x1b380d){var _0x455cc2={'raw':!![],'where':{'id':_0x20ca50[_0x6c5f('0x4a')]['id']}},_0x462854={};_0x462854[_0x6c5f('0x35')]=_[_0x6c5f('0x37')](db[_0x6c5f('0x30')][_0x6c5f('0x31')]);_0x462854[_0x6c5f('0x36')]=_['keys'](_0x20ca50[_0x6c5f('0x36')]);_0x462854[_0x6c5f('0x38')]=_[_0x6c5f('0x3a')](_0x462854[_0x6c5f('0x35')],_0x462854[_0x6c5f('0x36')]);_0x455cc2['attributes']=_[_0x6c5f('0x3a')](_0x462854['model'],qs[_0x6c5f('0x3b')](_0x20ca50[_0x6c5f('0x36')][_0x6c5f('0x3b')]));_0x455cc2[_0x6c5f('0x39')]=_0x455cc2['attributes'][_0x6c5f('0x4b')]?_0x455cc2[_0x6c5f('0x39')]:_0x462854['model'];if(_0x20ca50['query']['includeAll']){_0x455cc2[_0x6c5f('0x46')]=[{'all':!![]}];}_0x455cc2=_[_0x6c5f('0x42')]({},_0x455cc2,_0x20ca50[_0x6c5f('0x44')]);return db[_0x6c5f('0x30')][_0x6c5f('0x4c')](_0x455cc2)['then'](handleEntityNotFound(_0x1b380d,null))[_0x6c5f('0x27')](respondWithResult(_0x1b380d,null))['catch'](handleError(_0x1b380d,null));};exports['create']=function(_0x49de7f,_0x33e36c){return db[_0x6c5f('0x30')][_0x6c5f('0x4d')](_0x49de7f[_0x6c5f('0x4e')],{})[_0x6c5f('0x27')](respondWithResult(_0x33e36c,0xc9))[_0x6c5f('0x49')](handleError(_0x33e36c,null));};exports[_0x6c5f('0x4f')]=function(_0xadd77c,_0x4f9cdc){if(_0xadd77c[_0x6c5f('0x4e')]['id']){delete _0xadd77c[_0x6c5f('0x4e')]['id'];}return db['VtigerField'][_0x6c5f('0x4c')]({'where':{'id':_0xadd77c[_0x6c5f('0x4a')]['id']}})[_0x6c5f('0x27')](handleEntityNotFound(_0x4f9cdc,null))['then'](saveUpdates(_0xadd77c[_0x6c5f('0x4e')],null))['then'](respondWithResult(_0x4f9cdc,null))[_0x6c5f('0x49')](handleError(_0x4f9cdc,null));};exports[_0x6c5f('0x28')]=function(_0x1182a5,_0xf37568){return db[_0x6c5f('0x30')][_0x6c5f('0x4c')]({'where':{'id':_0x1182a5[_0x6c5f('0x4a')]['id']}})[_0x6c5f('0x27')](handleEntityNotFound(_0xf37568,null))[_0x6c5f('0x27')](removeEntity(_0xf37568,null))[_0x6c5f('0x49')](handleError(_0xf37568,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index acf68a5..27849f6 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 _0x6db7=['rimraf','./intVtigerField.attributes','define','int_vtiger_fields','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x4f7fd2,_0x5c534c){var _0x370a48=function(_0x3b5d61){while(--_0x3b5d61){_0x4f7fd2['push'](_0x4f7fd2['shift']());}};_0x370a48(++_0x5c534c);}(_0x6db7,0x12e));var _0x76db=function(_0x19e08e,_0x178f46){_0x19e08e=_0x19e08e-0x0;var _0x14c229=_0x6db7[_0x19e08e];return _0x14c229;};'use strict';var _=require(_0x76db('0x0'));var util=require(_0x76db('0x1'));var logger=require(_0x76db('0x2'))('api');var moment=require(_0x76db('0x3'));var BPromise=require(_0x76db('0x4'));var rp=require(_0x76db('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x76db('0x6'));var config=require('../../config/environment');var attributes=require(_0x76db('0x7'));module['exports']=function(_0x52af9f,_0x476bfb){return _0x52af9f[_0x76db('0x8')]('VtigerField',attributes,{'tableName':_0x76db('0x9'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':['idField',_0x76db('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcdc7=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash'];(function(_0x15781b,_0x4db9bb){var _0x20f955=function(_0x636ad0){while(--_0x636ad0){_0x15781b['push'](_0x15781b['shift']());}};_0x20f955(++_0x4db9bb);}(_0xcdc7,0x77));var _0x7cdc=function(_0xd9c5f7,_0x1a7b27){_0xd9c5f7=_0xd9c5f7-0x0;var _0x264ece=_0xcdc7[_0xd9c5f7];return _0x264ece;};'use strict';var _=require(_0x7cdc('0x0'));var util=require('util');var logger=require(_0x7cdc('0x1'))(_0x7cdc('0x2'));var moment=require('moment');var BPromise=require(_0x7cdc('0x3'));var rp=require(_0x7cdc('0x4'));var fs=require('fs');var path=require(_0x7cdc('0x5'));var rimraf=require(_0x7cdc('0x6'));var config=require(_0x7cdc('0x7'));var attributes=require(_0x7cdc('0x8'));module[_0x7cdc('0x9')]=function(_0x417166,_0x5282f5){return _0x417166[_0x7cdc('0xa')]('VtigerField',attributes,{'tableName':_0x7cdc('0xb'),'paranoid':![],'indexes':[{'name':_0x7cdc('0xc'),'fields':[_0x7cdc('0xd'),_0x7cdc('0xe')],'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 b476970..afd43d1 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 _0x8a55=['client','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x205c2e,_0x21f724){var _0x528c1d=function(_0x55fabb){while(--_0x55fabb){_0x205c2e['push'](_0x205c2e['shift']());}};_0x528c1d(++_0x21f724);}(_0x8a55,0x185));var _0x58a5=function(_0x482eba,_0x2cf70f){_0x482eba=_0x482eba-0x0;var _0x3bafe6=_0x8a55[_0x482eba];return _0x3bafe6;};'use strict';var _=require(_0x58a5('0x0'));var util=require(_0x58a5('0x1'));var moment=require(_0x58a5('0x2'));var BPromise=require(_0x58a5('0x3'));var rs=require(_0x58a5('0x4'));var fs=require('fs');var Redis=require(_0x58a5('0x5'));var db=require(_0x58a5('0x6'))['db'];var utils=require(_0x58a5('0x7'));var logger=require('../../config/logger')(_0x58a5('0x8'));var config=require(_0x58a5('0x9'));var jayson=require(_0x58a5('0xa'));var client=jayson[_0x58a5('0xb')][_0x58a5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1690bc,_0x1f135e,_0xd63fc7){return new BPromise(function(_0x36d8a4,_0x59860d){return client[_0x58a5('0xd')](_0x1690bc,_0xd63fc7)[_0x58a5('0xe')](function(_0x2cca61){logger[_0x58a5('0xf')](_0x58a5('0x10'),_0x1f135e,_0x58a5('0x11'));logger[_0x58a5('0x12')](_0x58a5('0x13'),_0x1f135e,_0x58a5('0x11'),JSON[_0x58a5('0x14')](_0x2cca61));if(_0x2cca61[_0x58a5('0x15')]){if(_0x2cca61[_0x58a5('0x15')][_0x58a5('0x16')]===0x1f4){logger[_0x58a5('0x15')]('VtigerField,\x20%s,\x20%s',_0x1f135e,_0x2cca61[_0x58a5('0x15')][_0x58a5('0x17')]);return _0x59860d(_0x2cca61[_0x58a5('0x15')][_0x58a5('0x17')]);}logger[_0x58a5('0x15')]('VtigerField,\x20%s,\x20%s',_0x1f135e,_0x2cca61['error'][_0x58a5('0x17')]);return _0x36d8a4(_0x2cca61[_0x58a5('0x15')][_0x58a5('0x17')]);}else{logger[_0x58a5('0xf')](_0x58a5('0x10'),_0x1f135e,'request\x20sent');_0x36d8a4(_0x2cca61[_0x58a5('0x18')][_0x58a5('0x17')]);}})['catch'](function(_0x2594e3){logger[_0x58a5('0x15')]('VtigerField,\x20%s,\x20%s',_0x1f135e,_0x2594e3);_0x59860d(_0x2594e3);});});} \ No newline at end of file +var _0xa9ec=['lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','error','code','message','VtigerField,\x20%s,\x20%s','result'];(function(_0xe0b8f,_0x7a5369){var _0x2609a0=function(_0x29f1db){while(--_0x29f1db){_0xe0b8f['push'](_0xe0b8f['shift']());}};_0x2609a0(++_0x7a5369);}(_0xa9ec,0x13b));var _0xca9e=function(_0x4a002e,_0x14a5f6){_0x4a002e=_0x4a002e-0x0;var _0xb86ae3=_0xa9ec[_0x4a002e];return _0xb86ae3;};'use strict';var _=require(_0xca9e('0x0'));var util=require('util');var moment=require(_0xca9e('0x1'));var BPromise=require(_0xca9e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xca9e('0x3'));var db=require(_0xca9e('0x4'))['db'];var utils=require(_0xca9e('0x5'));var logger=require(_0xca9e('0x6'))(_0xca9e('0x7'));var config=require(_0xca9e('0x8'));var jayson=require(_0xca9e('0x9'));var client=jayson[_0xca9e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36c21f,_0xa74283,_0x1dd333){return new BPromise(function(_0x201fe3,_0x496af7){return client[_0xca9e('0xb')](_0x36c21f,_0x1dd333)['then'](function(_0x899200){logger[_0xca9e('0xc')]('VtigerField,\x20%s,\x20%s',_0xa74283,_0xca9e('0xd'));logger[_0xca9e('0xe')](_0xca9e('0xf'),_0xa74283,'request\x20sent',JSON['stringify'](_0x899200));if(_0x899200[_0xca9e('0x10')]){if(_0x899200[_0xca9e('0x10')][_0xca9e('0x11')]===0x1f4){logger[_0xca9e('0x10')]('VtigerField,\x20%s,\x20%s',_0xa74283,_0x899200[_0xca9e('0x10')]['message']);return _0x496af7(_0x899200[_0xca9e('0x10')][_0xca9e('0x12')]);}logger[_0xca9e('0x10')](_0xca9e('0x13'),_0xa74283,_0x899200[_0xca9e('0x10')][_0xca9e('0x12')]);return _0x201fe3(_0x899200[_0xca9e('0x10')][_0xca9e('0x12')]);}else{logger['info'](_0xca9e('0x13'),_0xa74283,_0xca9e('0xd'));_0x201fe3(_0x899200[_0xca9e('0x14')][_0xca9e('0x12')]);}})['catch'](function(_0x5c919b){logger[_0xca9e('0x10')]('VtigerField,\x20%s,\x20%s',_0xa74283,_0x5c919b);_0x496af7(_0x5c919b);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 44ba3a6..aaf868b 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 _0xe227=['/:id/configurations','getConfigurations','post','put','update','destroy','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show'];(function(_0x2ffa6b,_0x4195fd){var _0x4f3516=function(_0x2e77f5){while(--_0x2e77f5){_0x2ffa6b['push'](_0x2ffa6b['shift']());}};_0x4f3516(++_0x4195fd);}(_0xe227,0x170));var _0x7e22=function(_0x575a38,_0x2e83d7){_0x575a38=_0x575a38-0x0;var _0x5a7bdd=_0xe227[_0x575a38];return _0x5a7bdd;};'use strict';var multer=require('multer');var util=require(_0x7e22('0x0'));var path=require(_0x7e22('0x1'));var timeout=require(_0x7e22('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7e22('0x3'));var auth=require(_0x7e22('0x4'));var interaction=require(_0x7e22('0x5'));var config=require(_0x7e22('0x6'));var controller=require('./intZendeskAccount.controller');router['get']('/',auth[_0x7e22('0x7')](),controller[_0x7e22('0x8')]);router[_0x7e22('0x9')](_0x7e22('0xa'),auth['isAuthenticated'](),controller[_0x7e22('0xb')]);router[_0x7e22('0x9')](_0x7e22('0xc'),auth[_0x7e22('0x7')](),controller[_0x7e22('0xd')]);router['get']('/:id/fields',auth[_0x7e22('0x7')](),controller['getFields']);router['post']('/',auth[_0x7e22('0x7')](),controller['create']);router[_0x7e22('0xe')](_0x7e22('0xc'),auth[_0x7e22('0x7')](),controller['addConfiguration']);router[_0x7e22('0xf')]('/:id',auth[_0x7e22('0x7')](),controller[_0x7e22('0x10')]);router['delete'](_0x7e22('0xa'),auth[_0x7e22('0x7')](),controller[_0x7e22('0x11')]);module[_0x7e22('0x12')]=router; \ No newline at end of file +var _0x450a=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x450a,0x149));var _0xa450=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x450a[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0xa450('0x0'));var util=require(_0xa450('0x1'));var path=require(_0xa450('0x2'));var timeout=require(_0xa450('0x3'));var express=require(_0xa450('0x4'));var router=express[_0xa450('0x5')]();var fs_extra=require(_0xa450('0x6'));var auth=require(_0xa450('0x7'));var interaction=require(_0xa450('0x8'));var config=require(_0xa450('0x9'));var controller=require('./intZendeskAccount.controller');router[_0xa450('0xa')]('/',auth[_0xa450('0xb')](),controller['index']);router['get'](_0xa450('0xc'),auth['isAuthenticated'](),controller[_0xa450('0xd')]);router[_0xa450('0xa')](_0xa450('0xe'),auth[_0xa450('0xb')](),controller[_0xa450('0xf')]);router['get'](_0xa450('0x10'),auth[_0xa450('0xb')](),controller[_0xa450('0x11')]);router[_0xa450('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa450('0x12')](_0xa450('0xe'),auth[_0xa450('0xb')](),controller[_0xa450('0x13')]);router[_0xa450('0x14')](_0xa450('0xc'),auth[_0xa450('0xb')](),controller[_0xa450('0x15')]);router[_0xa450('0x16')](_0xa450('0xc'),auth[_0xa450('0xb')](),controller['destroy']);module[_0xa450('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 6c86793..4eaf098 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 _0xf981=['remoteUri','ENUM','password','token','integrationTab','sequelize','exports','STRING','username'];(function(_0xf34613,_0x509389){var _0x10b53e=function(_0x251793){while(--_0x251793){_0xf34613['push'](_0xf34613['shift']());}};_0x10b53e(++_0x509389);}(_0xf981,0xe6));var _0x1f98=function(_0x180cf5,_0x69c3f2){_0x180cf5=_0x180cf5-0x0;var _0x1d9167=_0xf981[_0x180cf5];return _0x1d9167;};'use strict';var Sequelize=require(_0x1f98('0x0'));module[_0x1f98('0x1')]={'name':{'type':Sequelize[_0x1f98('0x2')]},'description':{'type':Sequelize[_0x1f98('0x2')]},'username':{'type':Sequelize[_0x1f98('0x2')],'unique':_0x1f98('0x3')},'password':{'type':Sequelize[_0x1f98('0x2')]},'token':{'type':Sequelize[_0x1f98('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x1f98('0x4')},'authType':{'type':Sequelize[_0x1f98('0x5')](_0x1f98('0x6'),_0x1f98('0x7')),'defaultValue':_0x1f98('0x6')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x1f98('0x8'),'newTab'),'defaultValue':_0x1f98('0x8')}}; \ No newline at end of file +var _0xdeb3=['newTab','exports','STRING','remoteUri','ENUM','token','integrationTab'];(function(_0x4f6651,_0x446266){var _0x389ef0=function(_0x4e6fa3){while(--_0x4e6fa3){_0x4f6651['push'](_0x4f6651['shift']());}};_0x389ef0(++_0x446266);}(_0xdeb3,0xb7));var _0x3deb=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xdeb3[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require('sequelize');module[_0x3deb('0x0')]={'name':{'type':Sequelize[_0x3deb('0x1')]},'description':{'type':Sequelize[_0x3deb('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize[_0x3deb('0x1')]},'token':{'type':Sequelize[_0x3deb('0x1')]},'remoteUri':{'type':Sequelize[_0x3deb('0x1')],'unique':_0x3deb('0x2')},'authType':{'type':Sequelize[_0x3deb('0x3')]('password',_0x3deb('0x4')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x3deb('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x3deb('0x5'),_0x3deb('0x6')),'defaultValue':_0x3deb('0x5')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 0b200f7..84b9007 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 _0x4e81=['limit','count','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','ZendeskAccount','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','merge','options','where','includeAll','include','findAll','show','params','find','catch','create','body','findOne','ZendeskConfiguration','getConfigurations','nolimit','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','ZendeskField','username','token','authType','remoteUri','slice','substring','lastIndexOf','GET','password','headers','Basic\x20%s','toString','base64','format','%s/token:%s','Sequelize','ValidationError','subject','description','group','assignee','remove','ticket_fields','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined'];(function(_0x1ef5d7,_0x1ec98d){var _0x297c93=function(_0x45855c){while(--_0x45855c){_0x1ef5d7['push'](_0x1ef5d7['shift']());}};_0x297c93(++_0x1ec98d);}(_0x4e81,0x1bc));var _0x14e8=function(_0x1d50f2,_0x3c3ec6){_0x1d50f2=_0x1d50f2-0x0;var _0x3769b8=_0x4e81[_0x1d50f2];return _0x3769b8;};'use strict';var emlformat=require(_0x14e8('0x0'));var rimraf=require(_0x14e8('0x1'));var zipdir=require(_0x14e8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x14e8('0x3'));var Mustache=require(_0x14e8('0x4'));var util=require(_0x14e8('0x5'));var path=require(_0x14e8('0x6'));var sox=require(_0x14e8('0x7'));var csv=require(_0x14e8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x14e8('0x9'));var squel=require(_0x14e8('0xa'));var crypto=require(_0x14e8('0xb'));var jsforce=require(_0x14e8('0xc'));var deskjs=require(_0x14e8('0xd'));var toCsv=require(_0x14e8('0x8'));var querystring=require(_0x14e8('0xe'));var Papa=require(_0x14e8('0xf'));var Redis=require(_0x14e8('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x14e8('0x11'));var as=require(_0x14e8('0x12'));var hardwareService=require(_0x14e8('0x13'));var logger=require(_0x14e8('0x14'))(_0x14e8('0x15'));var utils=require(_0x14e8('0x16'));var config=require(_0x14e8('0x17'));var licenseUtil=require(_0x14e8('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x14e8('0x19'));function respondWithStatusCode(_0x59c6c9,_0x2607ef){_0x2607ef=_0x2607ef||0xcc;return function(_0x341d40){if(_0x341d40){return _0x59c6c9[_0x14e8('0x1a')](_0x2607ef);}return _0x59c6c9['status'](_0x2607ef)[_0x14e8('0x1b')]();};}function respondWithResult(_0x4e1064,_0x458e4a){_0x458e4a=_0x458e4a||0xc8;return function(_0x58d26e){if(_0x58d26e){return _0x4e1064[_0x14e8('0x1c')](_0x458e4a)[_0x14e8('0x1d')](_0x58d26e);}};}function respondWithFilteredResult(_0xc6101f,_0x135996){return function(_0x52e64f){if(_0x52e64f){var _0x10c4a9=typeof _0x135996[_0x14e8('0x1e')]===_0x14e8('0x1f')&&typeof _0x135996[_0x14e8('0x20')]===_0x14e8('0x1f');var _0x1f1a0d=_0x52e64f[_0x14e8('0x21')];var _0x462259=_0x10c4a9?0x0:_0x135996['offset'];var _0x328c5a=_0x10c4a9?_0x52e64f[_0x14e8('0x21')]:_0x135996[_0x14e8('0x1e')]+_0x135996[_0x14e8('0x20')];var _0x246c5d;if(_0x328c5a>=_0x1f1a0d){_0x328c5a=_0x1f1a0d;_0x246c5d=0xc8;}else{_0x246c5d=0xce;}_0xc6101f['status'](_0x246c5d);return _0xc6101f[_0x14e8('0x22')](_0x14e8('0x23'),_0x462259+'-'+_0x328c5a+'/'+_0x1f1a0d)[_0x14e8('0x1d')](_0x52e64f);}return null;};}function patchUpdates(_0x48e30a){return function(_0x2c3f45){try{jsonpatch['apply'](_0x2c3f45,_0x48e30a,!![]);}catch(_0x4cca43){return BPromise[_0x14e8('0x24')](_0x4cca43);}return _0x2c3f45[_0x14e8('0x25')]();};}function saveUpdates(_0x117b00,_0xcf673){return function(_0x4ad25d){if(_0x4ad25d){return _0x4ad25d[_0x14e8('0x26')](_0x117b00)['then'](function(_0x31bdd3){return _0x31bdd3;});}return null;};}function removeEntity(_0x185a0e,_0x4ffc8b){return function(_0x58a3a1){if(_0x58a3a1){return _0x58a3a1['destroy']()[_0x14e8('0x27')](function(){_0x185a0e[_0x14e8('0x1c')](0xcc)[_0x14e8('0x1b')]();});}};}function handleEntityNotFound(_0x20bfe8,_0x333d44){return function(_0x57eb46){if(!_0x57eb46){_0x20bfe8[_0x14e8('0x1a')](0x194);}return _0x57eb46;};}function handleError(_0x3fd96d,_0x3c09cb){_0x3c09cb=_0x3c09cb||0x1f4;return function(_0x2f5818){logger[_0x14e8('0x28')](_0x2f5818[_0x14e8('0x29')]);if(_0x2f5818[_0x14e8('0x2a')]){delete _0x2f5818['name'];}_0x3fd96d[_0x14e8('0x1c')](_0x3c09cb)[_0x14e8('0x2b')](_0x2f5818);};}exports[_0x14e8('0x2c')]=function(_0x5f5abb,_0x48eed0){var _0x5cacd7={},_0x8fe0e2={},_0x2a408d={'count':0x0,'rows':[]};var _0x567385=_[_0x14e8('0x2d')](db[_0x14e8('0x2e')][_0x14e8('0x2f')],function(_0xa83433){return{'name':_0xa83433['fieldName'],'type':_0xa83433[_0x14e8('0x30')][_0x14e8('0x31')]};});_0x8fe0e2[_0x14e8('0x32')]=_[_0x14e8('0x2d')](_0x567385,_0x14e8('0x2a'));_0x8fe0e2['query']=_[_0x14e8('0x33')](_0x5f5abb[_0x14e8('0x34')]);_0x8fe0e2[_0x14e8('0x35')]=_[_0x14e8('0x36')](_0x8fe0e2['model'],_0x8fe0e2[_0x14e8('0x34')]);_0x5cacd7['attributes']=_[_0x14e8('0x36')](_0x8fe0e2[_0x14e8('0x32')],qs[_0x14e8('0x37')](_0x5f5abb[_0x14e8('0x34')][_0x14e8('0x37')]));_0x5cacd7[_0x14e8('0x38')]=_0x5cacd7[_0x14e8('0x38')][_0x14e8('0x39')]?_0x5cacd7[_0x14e8('0x38')]:_0x8fe0e2[_0x14e8('0x32')];if(!_0x5f5abb[_0x14e8('0x34')][_0x14e8('0x3a')]('nolimit')){_0x5cacd7['limit']=qs['limit'](_0x5f5abb[_0x14e8('0x34')]['limit']);_0x5cacd7[_0x14e8('0x1e')]=qs['offset'](_0x5f5abb[_0x14e8('0x34')][_0x14e8('0x1e')]);}_0x5cacd7[_0x14e8('0x3b')]=qs[_0x14e8('0x3c')](_0x5f5abb['query'][_0x14e8('0x3c')]);_0x5cacd7['where']=qs[_0x14e8('0x35')](_[_0x14e8('0x3d')](_0x5f5abb[_0x14e8('0x34')],_0x8fe0e2[_0x14e8('0x35')]),_0x567385);if(_0x5f5abb[_0x14e8('0x34')][_0x14e8('0x3e')]){_0x5cacd7['where']=_[_0x14e8('0x3f')](_0x5cacd7['where'],{'$or':_[_0x14e8('0x2d')](_0x567385,function(_0x20f69d){if(_0x20f69d[_0x14e8('0x30')]!=='VIRTUAL'){var _0x27d51b={};_0x27d51b[_0x20f69d[_0x14e8('0x2a')]]={'$like':'%'+_0x5f5abb['query'][_0x14e8('0x3e')]+'%'};return _0x27d51b;}})});}_0x5cacd7=_[_0x14e8('0x3f')]({},_0x5cacd7,_0x5f5abb[_0x14e8('0x40')]);var _0x3a7aa7={'where':_0x5cacd7[_0x14e8('0x41')]};return db[_0x14e8('0x2e')][_0x14e8('0x21')](_0x3a7aa7)[_0x14e8('0x27')](function(_0x33743a){_0x2a408d[_0x14e8('0x21')]=_0x33743a;if(_0x5f5abb[_0x14e8('0x34')][_0x14e8('0x42')]){_0x5cacd7[_0x14e8('0x43')]=[{'all':!![]}];}return db[_0x14e8('0x2e')][_0x14e8('0x44')](_0x5cacd7);})['then'](function(_0x24c9e6){_0x2a408d['rows']=_0x24c9e6;return _0x2a408d;})['then'](respondWithFilteredResult(_0x48eed0,_0x5cacd7))['catch'](handleError(_0x48eed0,null));};exports[_0x14e8('0x45')]=function(_0x5ed821,_0x46a3c4){var _0x45bff0={'raw':![],'where':{'id':_0x5ed821[_0x14e8('0x46')]['id']}},_0x7907e8={};_0x7907e8[_0x14e8('0x32')]=_[_0x14e8('0x33')](db[_0x14e8('0x2e')][_0x14e8('0x2f')]);_0x7907e8[_0x14e8('0x34')]=_[_0x14e8('0x33')](_0x5ed821[_0x14e8('0x34')]);_0x7907e8['filters']=_[_0x14e8('0x36')](_0x7907e8[_0x14e8('0x32')],_0x7907e8[_0x14e8('0x34')]);_0x45bff0[_0x14e8('0x38')]=_['intersection'](_0x7907e8[_0x14e8('0x32')],qs[_0x14e8('0x37')](_0x5ed821['query']['fields']));_0x45bff0[_0x14e8('0x38')]=_0x45bff0['attributes']['length']?_0x45bff0[_0x14e8('0x38')]:_0x7907e8[_0x14e8('0x32')];if(_0x5ed821['query'][_0x14e8('0x42')]){_0x45bff0[_0x14e8('0x43')]=[{'all':!![]}];}_0x45bff0=_['merge']({},_0x45bff0,_0x5ed821[_0x14e8('0x40')]);return db[_0x14e8('0x2e')][_0x14e8('0x47')](_0x45bff0)[_0x14e8('0x27')](handleEntityNotFound(_0x46a3c4,null))[_0x14e8('0x27')](respondWithResult(_0x46a3c4,null))[_0x14e8('0x48')](handleError(_0x46a3c4,null));};exports[_0x14e8('0x49')]=function(_0x2541ad,_0x146e2c){return db[_0x14e8('0x2e')][_0x14e8('0x49')](_0x2541ad[_0x14e8('0x4a')],{})[_0x14e8('0x27')](respondWithResult(_0x146e2c,0xc9))[_0x14e8('0x48')](handleError(_0x146e2c,null));};exports[_0x14e8('0x26')]=function(_0x1f50bc,_0x59820f){if(_0x1f50bc[_0x14e8('0x4a')]['id']){delete _0x1f50bc['body']['id'];}return db[_0x14e8('0x2e')][_0x14e8('0x47')]({'where':{'id':_0x1f50bc[_0x14e8('0x46')]['id']}})[_0x14e8('0x27')](handleEntityNotFound(_0x59820f,null))['then'](saveUpdates(_0x1f50bc['body'],null))['then'](respondWithResult(_0x59820f,null))[_0x14e8('0x48')](handleError(_0x59820f,null));};exports['destroy']=function(_0x55f9b0,_0xd2b281){return db[_0x14e8('0x2e')]['find']({'where':{'id':_0x55f9b0[_0x14e8('0x46')]['id']}})[_0x14e8('0x27')](handleEntityNotFound(_0xd2b281,null))[_0x14e8('0x27')](removeEntity(_0xd2b281,null))[_0x14e8('0x48')](handleError(_0xd2b281,null));};exports['getConfigurations']=function(_0x519c9c,_0x1cdcca,_0xc602b1){var _0x15464a={};var _0x3a09b7={};var _0x41b5ab;var _0x2fbac7;return db['ZendeskAccount'][_0x14e8('0x4b')]({'where':{'id':_0x519c9c[_0x14e8('0x46')]['id']}})[_0x14e8('0x27')](handleEntityNotFound(_0x1cdcca,null))[_0x14e8('0x27')](function(_0x5e6083){if(_0x5e6083){_0x41b5ab=_0x5e6083;_0x3a09b7[_0x14e8('0x32')]=_[_0x14e8('0x33')](db[_0x14e8('0x4c')][_0x14e8('0x2f')]);_0x3a09b7['query']=_[_0x14e8('0x33')](_0x519c9c[_0x14e8('0x34')]);_0x3a09b7[_0x14e8('0x35')]=_[_0x14e8('0x36')](_0x3a09b7[_0x14e8('0x32')],_0x3a09b7[_0x14e8('0x34')]);_0x15464a[_0x14e8('0x38')]=_[_0x14e8('0x36')](_0x3a09b7['model'],qs['fields'](_0x519c9c[_0x14e8('0x34')][_0x14e8('0x37')]));_0x15464a[_0x14e8('0x38')]=_0x15464a[_0x14e8('0x38')][_0x14e8('0x39')]?_0x15464a['attributes']:_0x3a09b7['model'];_0x15464a['order']=qs[_0x14e8('0x3c')](_0x519c9c[_0x14e8('0x34')][_0x14e8('0x3c')]);_0x15464a['where']=qs[_0x14e8('0x35')](_[_0x14e8('0x3d')](_0x519c9c[_0x14e8('0x34')],_0x3a09b7['filters']));if(_0x519c9c[_0x14e8('0x34')][_0x14e8('0x3e')]){_0x15464a[_0x14e8('0x41')]=_[_0x14e8('0x3f')](_0x15464a[_0x14e8('0x41')],{'$or':_[_0x14e8('0x2d')](_0x15464a[_0x14e8('0x38')],function(_0x12a2b3){var _0x2da07b={};_0x2da07b[_0x12a2b3]={'$like':'%'+_0x519c9c[_0x14e8('0x34')][_0x14e8('0x3e')]+'%'};return _0x2da07b;})});}_0x15464a=_['merge']({},_0x15464a,_0x519c9c[_0x14e8('0x40')]);return _0x41b5ab[_0x14e8('0x4d')](_0x15464a);}})[_0x14e8('0x27')](function(_0x38e79a){if(_0x38e79a){_0x2fbac7=_0x38e79a[_0x14e8('0x39')];if(!_0x519c9c[_0x14e8('0x34')][_0x14e8('0x3a')](_0x14e8('0x4e'))){_0x15464a[_0x14e8('0x20')]=qs[_0x14e8('0x20')](_0x519c9c[_0x14e8('0x34')][_0x14e8('0x20')]);_0x15464a['offset']=qs[_0x14e8('0x1e')](_0x519c9c[_0x14e8('0x34')]['offset']);}return _0x41b5ab[_0x14e8('0x4d')](_0x15464a);}})[_0x14e8('0x27')](function(_0x31e785){if(_0x31e785){return _0x31e785?{'count':_0x2fbac7,'rows':_0x31e785}:null;}})[_0x14e8('0x27')](respondWithResult(_0x1cdcca,null))[_0x14e8('0x48')](handleError(_0x1cdcca,null));};exports[_0x14e8('0x4f')]=function(_0x139405,_0x5b6e28,_0x4c30dd){if(_0x139405['body']['id']){delete _0x139405[_0x14e8('0x4a')]['id'];}return db[_0x14e8('0x2e')][_0x14e8('0x4b')]({'where':{'id':_0x139405[_0x14e8('0x46')]['id']}})[_0x14e8('0x27')](handleEntityNotFound(_0x5b6e28,null))[_0x14e8('0x27')](function(_0x402956){if(_0x402956){_0x139405['body'][_0x14e8('0x50')]=_0x402956['id'];_0x139405[_0x14e8('0x4a')]['Subjects']=integrations[_0x14e8('0x51')](_0x139405[_0x14e8('0x4a')]['channel'],_0x139405['body']['type']);_0x139405[_0x14e8('0x4a')][_0x14e8('0x52')]=integrations[_0x14e8('0x53')](_0x139405[_0x14e8('0x4a')]['channel'],_0x139405[_0x14e8('0x4a')][_0x14e8('0x30')]);return db[_0x14e8('0x4c')][_0x14e8('0x49')](_0x139405[_0x14e8('0x4a')],{'include':[{'model':db[_0x14e8('0x54')],'as':'Subjects'},{'model':db[_0x14e8('0x54')],'as':_0x14e8('0x52')}]});}return null;})[_0x14e8('0x27')](respondWithResult(_0x5b6e28,null))['catch'](handleError(_0x5b6e28,null));};exports['getFields']=function(_0x20a598,_0x53d0c8,_0x25f63c){var _0x5cbce8='';return db[_0x14e8('0x2e')]['findOne']({'where':{'id':_0x20a598[_0x14e8('0x46')]['id']},'attributes':['id',_0x14e8('0x55'),'password',_0x14e8('0x56'),_0x14e8('0x57'),_0x14e8('0x58')]})[_0x14e8('0x27')](handleEntityNotFound(_0x53d0c8,null))[_0x14e8('0x27')](function(_0x6dee32){if(_0x6dee32){_0x5cbce8=_0x6dee32[_0x14e8('0x58')];var _0x2ba695=_0x5cbce8[_0x14e8('0x59')](-0x1);if(_0x2ba695==='/'){_0x5cbce8=_0x5cbce8[_0x14e8('0x5a')](0x0,_0x5cbce8[_0x14e8('0x5b')](_0x2ba695));}var _0x2e0e7d={'method':_0x14e8('0x5c'),'uri':util['format']('%s/%s',_0x5cbce8,'ticket_fields'),'json':!![]};switch(_0x6dee32[_0x14e8('0x57')]){case _0x14e8('0x5d'):_0x2e0e7d[_0x14e8('0x5e')]={'Authorization':util['format'](_0x14e8('0x5f'),new Buffer(util['format']('%s:%s',_0x6dee32['username'],_0x6dee32[_0x14e8('0x5d')]))[_0x14e8('0x60')](_0x14e8('0x61')))};break;case'token':_0x2e0e7d[_0x14e8('0x5e')]={'Authorization':util['format'](_0x14e8('0x5f'),new Buffer(util[_0x14e8('0x62')](_0x14e8('0x63'),_0x6dee32[_0x14e8('0x55')],_0x6dee32[_0x14e8('0x56')]))[_0x14e8('0x60')](_0x14e8('0x61')))};break;default:throw new db[(_0x14e8('0x64'))][(_0x14e8('0x65'))]('Unknown\x20authentication\x20type');}return rp(_0x2e0e7d);}})[_0x14e8('0x27')](function(_0x4eb2ef){if(_0x4eb2ef){var _0x355395=[_0x14e8('0x66'),_0x14e8('0x67'),_0x14e8('0x68'),_0x14e8('0x69')];_[_0x14e8('0x6a')](_0x4eb2ef[_0x14e8('0x6b')],function(_0x308617){return _0x355395[_0x14e8('0x6c')](_0x308617['type']);});return{'count':_0x4eb2ef[_0x14e8('0x6b')][_0x14e8('0x39')],'rows':_[_0x14e8('0x2d')](_0x4eb2ef[_0x14e8('0x6b')],function(_0x492757){return{'id':_0x492757['id'],'name':_0x492757[_0x14e8('0x6d')]>0x7?_0x492757[_0x14e8('0x6e')]:_0x492757[_0x14e8('0x30')],'custom':_0x492757[_0x14e8('0x6d')]>0x7?!![]:![],'options':_0x492757['system_field_options']?_0x492757[_0x14e8('0x6f')]:_0x492757['custom_field_options']?_0x492757[_0x14e8('0x70')]:[]};})};}})['then'](respondWithResult(_0x53d0c8,null))['catch'](function(_0x3e820f){var _0xb68079=_0x20a598[_0x14e8('0x34')][_0x14e8('0x71')]?0x1f4:_0x3e820f[_0x14e8('0x72')]||0x1f4;logger[_0x14e8('0x28')](_0x14e8('0x73'),_0x14e8('0x74'),_0xb68079,JSON[_0x14e8('0x75')](_0x3e820f));delete _0x3e820f[_0x14e8('0x2a')];if(_0xb68079===0x191){_0xb68079=0x190;}_0x53d0c8[_0x14e8('0x1c')](_0xb68079)['send'](_0x20a598[_0x14e8('0x34')][_0x14e8('0x71')]?{'message':_0x14e8('0x76'),'statusCode':_0x3e820f['statusCode']}:_0x3e820f);});}; \ No newline at end of file +var _0xe511=['getConfigurations','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','ZendeskConfiguration','create','getFields','username','password','authType','remoteUri','substring','format','ticket_fields','headers','Basic\x20%s','%s:%s','toString','token','%s/token:%s','base64','ValidationError','Unknown\x20authentication\x20type','subject','description','assignee','remove','includes','position','system_field_options','custom_field_options','send','test','statusCode','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','update','then','stack','index','fieldName','type','key','model','map','name','query','keys','filters','attributes','intersection','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','ZendeskAccount','includeAll','include','findAll','catch','show','params','rawAttributes','fields','options','body','find','nolimit'];(function(_0x4272c4,_0x379c31){var _0x2024b3=function(_0x3926cc){while(--_0x3926cc){_0x4272c4['push'](_0x4272c4['shift']());}};_0x2024b3(++_0x379c31);}(_0xe511,0x16f));var _0x1e51=function(_0x229527,_0x337664){_0x229527=_0x229527-0x0;var _0x1b88d3=_0xe511[_0x229527];return _0x1b88d3;};'use strict';var emlformat=require(_0x1e51('0x0'));var rimraf=require(_0x1e51('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1e51('0x2'));var rp=require('request-promise');var moment=require(_0x1e51('0x3'));var BPromise=require(_0x1e51('0x4'));var Mustache=require('mustache');var util=require(_0x1e51('0x5'));var path=require(_0x1e51('0x6'));var sox=require(_0x1e51('0x7'));var csv=require(_0x1e51('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1e51('0x9'));var _=require(_0x1e51('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1e51('0xb'));var deskjs=require(_0x1e51('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1e51('0xd'));var Redis=require(_0x1e51('0xe'));var authService=require(_0x1e51('0xf'));var qs=require(_0x1e51('0x10'));var as=require(_0x1e51('0x11'));var hardwareService=require(_0x1e51('0x12'));var logger=require('../../config/logger')(_0x1e51('0x13'));var utils=require(_0x1e51('0x14'));var config=require(_0x1e51('0x15'));var licenseUtil=require(_0x1e51('0x16'));var db=require(_0x1e51('0x17'))['db'];var integrations=require(_0x1e51('0x18'));function respondWithStatusCode(_0x5544eb,_0x408a77){_0x408a77=_0x408a77||0xcc;return function(_0x102f01){if(_0x102f01){return _0x5544eb[_0x1e51('0x19')](_0x408a77);}return _0x5544eb[_0x1e51('0x1a')](_0x408a77)[_0x1e51('0x1b')]();};}function respondWithResult(_0x32945d,_0x441c70){_0x441c70=_0x441c70||0xc8;return function(_0x467e77){if(_0x467e77){return _0x32945d[_0x1e51('0x1a')](_0x441c70)[_0x1e51('0x1c')](_0x467e77);}};}function respondWithFilteredResult(_0x5a5c07,_0x3b01b7){return function(_0x24db4f){if(_0x24db4f){var _0x4526b4=typeof _0x3b01b7['offset']===_0x1e51('0x1d')&&typeof _0x3b01b7['limit']==='undefined';var _0x1f6f4e=_0x24db4f[_0x1e51('0x1e')];var _0x40ae4c=_0x4526b4?0x0:_0x3b01b7[_0x1e51('0x1f')];var _0x4d1aae=_0x4526b4?_0x24db4f[_0x1e51('0x1e')]:_0x3b01b7['offset']+_0x3b01b7[_0x1e51('0x20')];var _0x4a9272;if(_0x4d1aae>=_0x1f6f4e){_0x4d1aae=_0x1f6f4e;_0x4a9272=0xc8;}else{_0x4a9272=0xce;}_0x5a5c07[_0x1e51('0x1a')](_0x4a9272);return _0x5a5c07[_0x1e51('0x21')](_0x1e51('0x22'),_0x40ae4c+'-'+_0x4d1aae+'/'+_0x1f6f4e)[_0x1e51('0x1c')](_0x24db4f);}return null;};}function patchUpdates(_0x506f40){return function(_0x5223c3){try{jsonpatch['apply'](_0x5223c3,_0x506f40,!![]);}catch(_0x548c32){return BPromise[_0x1e51('0x23')](_0x548c32);}return _0x5223c3['save']();};}function saveUpdates(_0x3f7340,_0x28aacb){return function(_0x415154){if(_0x415154){return _0x415154[_0x1e51('0x24')](_0x3f7340)[_0x1e51('0x25')](function(_0xf9298){return _0xf9298;});}return null;};}function removeEntity(_0x270adf,_0x461d3d){return function(_0x4bcdd3){if(_0x4bcdd3){return _0x4bcdd3['destroy']()[_0x1e51('0x25')](function(){_0x270adf[_0x1e51('0x1a')](0xcc)[_0x1e51('0x1b')]();});}};}function handleEntityNotFound(_0x1386db,_0x505d79){return function(_0x54d031){if(!_0x54d031){_0x1386db['sendStatus'](0x194);}return _0x54d031;};}function handleError(_0x1eb83f,_0x2a1561){_0x2a1561=_0x2a1561||0x1f4;return function(_0x433c2d){logger['error'](_0x433c2d[_0x1e51('0x26')]);if(_0x433c2d['name']){delete _0x433c2d['name'];}_0x1eb83f[_0x1e51('0x1a')](_0x2a1561)['send'](_0x433c2d);};}exports[_0x1e51('0x27')]=function(_0x1eb79f,_0x56722f){var _0x3e6ef2={},_0x10ee23={},_0x71c7af={'count':0x0,'rows':[]};var _0x6862d1=_['map'](db['ZendeskAccount']['rawAttributes'],function(_0x20eb9b){return{'name':_0x20eb9b[_0x1e51('0x28')],'type':_0x20eb9b[_0x1e51('0x29')][_0x1e51('0x2a')]};});_0x10ee23[_0x1e51('0x2b')]=_[_0x1e51('0x2c')](_0x6862d1,_0x1e51('0x2d'));_0x10ee23[_0x1e51('0x2e')]=_[_0x1e51('0x2f')](_0x1eb79f[_0x1e51('0x2e')]);_0x10ee23[_0x1e51('0x30')]=_['intersection'](_0x10ee23[_0x1e51('0x2b')],_0x10ee23[_0x1e51('0x2e')]);_0x3e6ef2[_0x1e51('0x31')]=_[_0x1e51('0x32')](_0x10ee23[_0x1e51('0x2b')],qs['fields'](_0x1eb79f[_0x1e51('0x2e')]['fields']));_0x3e6ef2[_0x1e51('0x31')]=_0x3e6ef2[_0x1e51('0x31')][_0x1e51('0x33')]?_0x3e6ef2['attributes']:_0x10ee23[_0x1e51('0x2b')];if(!_0x1eb79f['query'][_0x1e51('0x34')]('nolimit')){_0x3e6ef2['limit']=qs[_0x1e51('0x20')](_0x1eb79f[_0x1e51('0x2e')][_0x1e51('0x20')]);_0x3e6ef2['offset']=qs[_0x1e51('0x1f')](_0x1eb79f['query'][_0x1e51('0x1f')]);}_0x3e6ef2[_0x1e51('0x35')]=qs['sort'](_0x1eb79f[_0x1e51('0x2e')][_0x1e51('0x36')]);_0x3e6ef2[_0x1e51('0x37')]=qs[_0x1e51('0x30')](_[_0x1e51('0x38')](_0x1eb79f[_0x1e51('0x2e')],_0x10ee23['filters']),_0x6862d1);if(_0x1eb79f['query'][_0x1e51('0x39')]){_0x3e6ef2['where']=_[_0x1e51('0x3a')](_0x3e6ef2[_0x1e51('0x37')],{'$or':_[_0x1e51('0x2c')](_0x6862d1,function(_0xcfa1d8){if(_0xcfa1d8[_0x1e51('0x29')]!==_0x1e51('0x3b')){var _0x845a62={};_0x845a62[_0xcfa1d8[_0x1e51('0x2d')]]={'$like':'%'+_0x1eb79f[_0x1e51('0x2e')][_0x1e51('0x39')]+'%'};return _0x845a62;}})});}_0x3e6ef2=_[_0x1e51('0x3a')]({},_0x3e6ef2,_0x1eb79f['options']);var _0x29a689={'where':_0x3e6ef2['where']};return db[_0x1e51('0x3c')][_0x1e51('0x1e')](_0x29a689)[_0x1e51('0x25')](function(_0x471386){_0x71c7af[_0x1e51('0x1e')]=_0x471386;if(_0x1eb79f[_0x1e51('0x2e')][_0x1e51('0x3d')]){_0x3e6ef2[_0x1e51('0x3e')]=[{'all':!![]}];}return db[_0x1e51('0x3c')][_0x1e51('0x3f')](_0x3e6ef2);})[_0x1e51('0x25')](function(_0x5b4b3f){_0x71c7af['rows']=_0x5b4b3f;return _0x71c7af;})[_0x1e51('0x25')](respondWithFilteredResult(_0x56722f,_0x3e6ef2))[_0x1e51('0x40')](handleError(_0x56722f,null));};exports[_0x1e51('0x41')]=function(_0x4650e4,_0x1ef3d3){var _0x1a9e0d={'raw':![],'where':{'id':_0x4650e4[_0x1e51('0x42')]['id']}},_0x25592c={};_0x25592c['model']=_[_0x1e51('0x2f')](db[_0x1e51('0x3c')][_0x1e51('0x43')]);_0x25592c[_0x1e51('0x2e')]=_[_0x1e51('0x2f')](_0x4650e4[_0x1e51('0x2e')]);_0x25592c[_0x1e51('0x30')]=_['intersection'](_0x25592c[_0x1e51('0x2b')],_0x25592c[_0x1e51('0x2e')]);_0x1a9e0d['attributes']=_[_0x1e51('0x32')](_0x25592c[_0x1e51('0x2b')],qs[_0x1e51('0x44')](_0x4650e4['query'][_0x1e51('0x44')]));_0x1a9e0d[_0x1e51('0x31')]=_0x1a9e0d[_0x1e51('0x31')][_0x1e51('0x33')]?_0x1a9e0d[_0x1e51('0x31')]:_0x25592c[_0x1e51('0x2b')];if(_0x4650e4[_0x1e51('0x2e')][_0x1e51('0x3d')]){_0x1a9e0d[_0x1e51('0x3e')]=[{'all':!![]}];}_0x1a9e0d=_['merge']({},_0x1a9e0d,_0x4650e4[_0x1e51('0x45')]);return db[_0x1e51('0x3c')]['find'](_0x1a9e0d)[_0x1e51('0x25')](handleEntityNotFound(_0x1ef3d3,null))[_0x1e51('0x25')](respondWithResult(_0x1ef3d3,null))[_0x1e51('0x40')](handleError(_0x1ef3d3,null));};exports['create']=function(_0x44468a,_0x4634de){return db[_0x1e51('0x3c')]['create'](_0x44468a[_0x1e51('0x46')],{})['then'](respondWithResult(_0x4634de,0xc9))['catch'](handleError(_0x4634de,null));};exports['update']=function(_0x169e6c,_0x2e79ca){if(_0x169e6c['body']['id']){delete _0x169e6c['body']['id'];}return db[_0x1e51('0x3c')][_0x1e51('0x47')]({'where':{'id':_0x169e6c[_0x1e51('0x42')]['id']}})[_0x1e51('0x25')](handleEntityNotFound(_0x2e79ca,null))[_0x1e51('0x25')](saveUpdates(_0x169e6c[_0x1e51('0x46')],null))['then'](respondWithResult(_0x2e79ca,null))[_0x1e51('0x40')](handleError(_0x2e79ca,null));};exports['destroy']=function(_0xf6bd35,_0x43589a){return db['ZendeskAccount']['find']({'where':{'id':_0xf6bd35['params']['id']}})[_0x1e51('0x25')](handleEntityNotFound(_0x43589a,null))[_0x1e51('0x25')](removeEntity(_0x43589a,null))[_0x1e51('0x40')](handleError(_0x43589a,null));};exports['getConfigurations']=function(_0x2fdee1,_0x1fe669,_0x4226da){var _0x2100d4={};var _0x1ccb55={};var _0x12584c;var _0x32fe1f;return db[_0x1e51('0x3c')]['findOne']({'where':{'id':_0x2fdee1[_0x1e51('0x42')]['id']}})[_0x1e51('0x25')](handleEntityNotFound(_0x1fe669,null))[_0x1e51('0x25')](function(_0x213edb){if(_0x213edb){_0x12584c=_0x213edb;_0x1ccb55[_0x1e51('0x2b')]=_[_0x1e51('0x2f')](db['ZendeskConfiguration'][_0x1e51('0x43')]);_0x1ccb55['query']=_['keys'](_0x2fdee1['query']);_0x1ccb55[_0x1e51('0x30')]=_[_0x1e51('0x32')](_0x1ccb55[_0x1e51('0x2b')],_0x1ccb55['query']);_0x2100d4[_0x1e51('0x31')]=_[_0x1e51('0x32')](_0x1ccb55[_0x1e51('0x2b')],qs['fields'](_0x2fdee1[_0x1e51('0x2e')][_0x1e51('0x44')]));_0x2100d4[_0x1e51('0x31')]=_0x2100d4['attributes'][_0x1e51('0x33')]?_0x2100d4[_0x1e51('0x31')]:_0x1ccb55[_0x1e51('0x2b')];_0x2100d4[_0x1e51('0x35')]=qs[_0x1e51('0x36')](_0x2fdee1[_0x1e51('0x2e')][_0x1e51('0x36')]);_0x2100d4[_0x1e51('0x37')]=qs['filters'](_[_0x1e51('0x38')](_0x2fdee1[_0x1e51('0x2e')],_0x1ccb55['filters']));if(_0x2fdee1['query']['filter']){_0x2100d4[_0x1e51('0x37')]=_[_0x1e51('0x3a')](_0x2100d4[_0x1e51('0x37')],{'$or':_[_0x1e51('0x2c')](_0x2100d4[_0x1e51('0x31')],function(_0x3c322c){var _0x45b649={};_0x45b649[_0x3c322c]={'$like':'%'+_0x2fdee1[_0x1e51('0x2e')][_0x1e51('0x39')]+'%'};return _0x45b649;})});}_0x2100d4=_['merge']({},_0x2100d4,_0x2fdee1['options']);return _0x12584c['getConfigurations'](_0x2100d4);}})[_0x1e51('0x25')](function(_0x4048a4){if(_0x4048a4){_0x32fe1f=_0x4048a4['length'];if(!_0x2fdee1['query'][_0x1e51('0x34')](_0x1e51('0x48'))){_0x2100d4['limit']=qs[_0x1e51('0x20')](_0x2fdee1[_0x1e51('0x2e')][_0x1e51('0x20')]);_0x2100d4[_0x1e51('0x1f')]=qs[_0x1e51('0x1f')](_0x2fdee1[_0x1e51('0x2e')][_0x1e51('0x1f')]);}return _0x12584c[_0x1e51('0x49')](_0x2100d4);}})[_0x1e51('0x25')](function(_0x32863f){if(_0x32863f){return _0x32863f?{'count':_0x32fe1f,'rows':_0x32863f}:null;}})['then'](respondWithResult(_0x1fe669,null))[_0x1e51('0x40')](handleError(_0x1fe669,null));};exports[_0x1e51('0x4a')]=function(_0x3657a2,_0x402bbd,_0xc720e2){if(_0x3657a2[_0x1e51('0x46')]['id']){delete _0x3657a2['body']['id'];}return db['ZendeskAccount'][_0x1e51('0x4b')]({'where':{'id':_0x3657a2[_0x1e51('0x42')]['id']}})[_0x1e51('0x25')](handleEntityNotFound(_0x402bbd,null))[_0x1e51('0x25')](function(_0x52a439){if(_0x52a439){_0x3657a2['body']['AccountId']=_0x52a439['id'];_0x3657a2[_0x1e51('0x46')][_0x1e51('0x4c')]=integrations[_0x1e51('0x4d')](_0x3657a2[_0x1e51('0x46')][_0x1e51('0x4e')],_0x3657a2['body'][_0x1e51('0x29')]);_0x3657a2[_0x1e51('0x46')][_0x1e51('0x4f')]=integrations['getDescriptions'](_0x3657a2[_0x1e51('0x46')][_0x1e51('0x4e')],_0x3657a2[_0x1e51('0x46')]['type']);return db[_0x1e51('0x50')][_0x1e51('0x51')](_0x3657a2['body'],{'include':[{'model':db['ZendeskField'],'as':_0x1e51('0x4c')},{'model':db['ZendeskField'],'as':_0x1e51('0x4f')}]});}return null;})['then'](respondWithResult(_0x402bbd,null))[_0x1e51('0x40')](handleError(_0x402bbd,null));};exports[_0x1e51('0x52')]=function(_0x35f12e,_0x457e4a,_0x5142ed){var _0x37f3e6='';return db['ZendeskAccount']['findOne']({'where':{'id':_0x35f12e[_0x1e51('0x42')]['id']},'attributes':['id',_0x1e51('0x53'),_0x1e51('0x54'),'token',_0x1e51('0x55'),_0x1e51('0x56')]})[_0x1e51('0x25')](handleEntityNotFound(_0x457e4a,null))[_0x1e51('0x25')](function(_0x5b76ae){if(_0x5b76ae){_0x37f3e6=_0x5b76ae[_0x1e51('0x56')];var _0x5ef17b=_0x37f3e6['slice'](-0x1);if(_0x5ef17b==='/'){_0x37f3e6=_0x37f3e6[_0x1e51('0x57')](0x0,_0x37f3e6['lastIndexOf'](_0x5ef17b));}var _0x35ece9={'method':'GET','uri':util[_0x1e51('0x58')]('%s/%s',_0x37f3e6,_0x1e51('0x59')),'json':!![]};switch(_0x5b76ae[_0x1e51('0x55')]){case'password':_0x35ece9[_0x1e51('0x5a')]={'Authorization':util['format'](_0x1e51('0x5b'),new Buffer(util[_0x1e51('0x58')](_0x1e51('0x5c'),_0x5b76ae[_0x1e51('0x53')],_0x5b76ae[_0x1e51('0x54')]))[_0x1e51('0x5d')]('base64'))};break;case _0x1e51('0x5e'):_0x35ece9['headers']={'Authorization':util['format'](_0x1e51('0x5b'),new Buffer(util[_0x1e51('0x58')](_0x1e51('0x5f'),_0x5b76ae[_0x1e51('0x53')],_0x5b76ae[_0x1e51('0x5e')]))[_0x1e51('0x5d')](_0x1e51('0x60')))};break;default:throw new db['Sequelize'][(_0x1e51('0x61'))](_0x1e51('0x62'));}return rp(_0x35ece9);}})[_0x1e51('0x25')](function(_0x4c6920){if(_0x4c6920){var _0x4da887=[_0x1e51('0x63'),_0x1e51('0x64'),'group',_0x1e51('0x65')];_[_0x1e51('0x66')](_0x4c6920['ticket_fields'],function(_0x5eb939){return _0x4da887[_0x1e51('0x67')](_0x5eb939[_0x1e51('0x29')]);});return{'count':_0x4c6920[_0x1e51('0x59')][_0x1e51('0x33')],'rows':_[_0x1e51('0x2c')](_0x4c6920[_0x1e51('0x59')],function(_0x3718d9){return{'id':_0x3718d9['id'],'name':_0x3718d9['position']>0x7?_0x3718d9['title']:_0x3718d9[_0x1e51('0x29')],'custom':_0x3718d9[_0x1e51('0x68')]>0x7?!![]:![],'options':_0x3718d9['system_field_options']?_0x3718d9[_0x1e51('0x69')]:_0x3718d9[_0x1e51('0x6a')]?_0x3718d9['custom_field_options']:[]};})};}})[_0x1e51('0x25')](respondWithResult(_0x457e4a,null))['catch'](function(_0x34b98f){var _0x561812=_0x35f12e['query']['test']?0x1f4:_0x34b98f['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x1e51('0x52'),_0x561812,JSON['stringify'](_0x34b98f));delete _0x34b98f[_0x1e51('0x2d')];if(_0x561812===0x191){_0x561812=0x190;}_0x457e4a['status'](_0x561812)[_0x1e51('0x6b')](_0x35f12e[_0x1e51('0x2e')][_0x1e51('0x6c')]?{'message':'Wrong\x20credentials','statusCode':_0x34b98f[_0x1e51('0x6d')]}:_0x34b98f);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 48a53c6..d7c322a 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 _0x8564=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','ZendeskAccount','int_zendesk_accounts','lodash'];(function(_0x1e1dea,_0x16fe92){var _0x360ed7=function(_0x3fd6d5){while(--_0x3fd6d5){_0x1e1dea['push'](_0x1e1dea['shift']());}};_0x360ed7(++_0x16fe92);}(_0x8564,0xef));var _0x4856=function(_0x11fe81,_0x3dad37){_0x11fe81=_0x11fe81-0x0;var _0x38d64a=_0x8564[_0x11fe81];return _0x38d64a;};'use strict';var _=require(_0x4856('0x0'));var util=require(_0x4856('0x1'));var logger=require(_0x4856('0x2'))(_0x4856('0x3'));var moment=require(_0x4856('0x4'));var BPromise=require(_0x4856('0x5'));var rp=require(_0x4856('0x6'));var fs=require('fs');var path=require(_0x4856('0x7'));var rimraf=require(_0x4856('0x8'));var config=require(_0x4856('0x9'));var attributes=require(_0x4856('0xa'));var integrations=require(_0x4856('0xb'));module[_0x4856('0xc')]=function(_0x413489,_0x13c47d){return _0x413489['define'](_0x4856('0xd'),attributes,{'tableName':_0x4856('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa927=['../../config/logger','moment','path','./intZendeskAccount.attributes','define','ZendeskAccount','int_zendesk_accounts','lodash'];(function(_0x296fe9,_0x1e39d6){var _0x306a95=function(_0x29d160){while(--_0x29d160){_0x296fe9['push'](_0x296fe9['shift']());}};_0x306a95(++_0x1e39d6);}(_0xa927,0xc7));var _0x7a92=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xa927[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x7a92('0x0'));var util=require('util');var logger=require(_0x7a92('0x1'))('api');var moment=require(_0x7a92('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7a92('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7a92('0x4'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x5471fb,_0x994dc0){return _0x5471fb[_0x7a92('0x5')](_0x7a92('0x6'),attributes,{'tableName':_0x7a92('0x7'),'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 88204be..a37f3de 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 _0xd51a=['../../config/logger','rpc','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','find','ShowZendeskAccount','lodash','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x23ec06,_0x561142){var _0x2831d4=function(_0x3802bc){while(--_0x3802bc){_0x23ec06['push'](_0x23ec06['shift']());}};_0x2831d4(++_0x561142);}(_0xd51a,0x1c1));var _0xad51=function(_0x7203b1,_0x2ebda0){_0x7203b1=_0x7203b1-0x0;var _0xc9993c=_0xd51a[_0x7203b1];return _0xc9993c;};'use strict';var _=require(_0xad51('0x0'));var util=require(_0xad51('0x1'));var moment=require(_0xad51('0x2'));var BPromise=require(_0xad51('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xad51('0x4'))['db'];var utils=require(_0xad51('0x5'));var logger=require(_0xad51('0x6'))(_0xad51('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xad51('0x8')][_0xad51('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c66e8,_0x1cfe46,_0x155aec){return new BPromise(function(_0x2f323e,_0x3a9d6c){return client[_0xad51('0xa')](_0x2c66e8,_0x155aec)[_0xad51('0xb')](function(_0x17b256){logger[_0xad51('0xc')](_0xad51('0xd'),_0x1cfe46,_0xad51('0xe'));logger['debug'](_0xad51('0xf'),_0x1cfe46,_0xad51('0xe'),JSON[_0xad51('0x10')](_0x17b256));if(_0x17b256[_0xad51('0x11')]){if(_0x17b256['error']['code']===0x1f4){logger[_0xad51('0x11')](_0xad51('0xd'),_0x1cfe46,_0x17b256[_0xad51('0x11')]['message']);return _0x3a9d6c(_0x17b256['error']['message']);}logger['error'](_0xad51('0xd'),_0x1cfe46,_0x17b256[_0xad51('0x11')][_0xad51('0x12')]);return _0x2f323e(_0x17b256[_0xad51('0x11')][_0xad51('0x12')]);}else{logger[_0xad51('0xc')](_0xad51('0xd'),_0x1cfe46,_0xad51('0xe'));_0x2f323e(_0x17b256[_0xad51('0x13')][_0xad51('0x12')]);}})[_0xad51('0x14')](function(_0x55d4f6){logger[_0xad51('0x11')]('ZendeskAccount,\x20%s,\x20%s',_0x1cfe46,_0x55d4f6);_0x3a9d6c(_0x55d4f6);});});}exports[_0xad51('0x15')]=function(_0x2caa8f){var _0xe0b98a=this;return new Promise(function(_0x1d650b,_0x24b1c0){return db[_0xad51('0x16')][_0xad51('0x17')]({'raw':_0x2caa8f[_0xad51('0x18')]?_0x2caa8f[_0xad51('0x18')][_0xad51('0x19')]===undefined?!![]:![]:!![],'where':_0x2caa8f['options']?_0x2caa8f[_0xad51('0x18')][_0xad51('0x1a')]||null:null,'attributes':_0x2caa8f[_0xad51('0x18')]?_0x2caa8f[_0xad51('0x18')][_0xad51('0x1b')]||null:null,'limit':_0x2caa8f[_0xad51('0x18')]?_0x2caa8f[_0xad51('0x18')][_0xad51('0x1c')]||null:null,'include':_0x2caa8f['options']?_0x2caa8f[_0xad51('0x18')][_0xad51('0x1d')]?_[_0xad51('0x1e')](_0x2caa8f[_0xad51('0x18')]['include'],function(_0x55399a){return{'model':db[_0x55399a['model']],'as':_0x55399a['as'],'attributes':_0x55399a[_0xad51('0x1b')],'include':_0x55399a[_0xad51('0x1d')]?_[_0xad51('0x1e')](_0x55399a[_0xad51('0x1d')],function(_0x565b8e){return{'model':db[_0x565b8e[_0xad51('0x1f')]],'as':_0x565b8e['as'],'attributes':_0x565b8e[_0xad51('0x1b')],'include':_0x565b8e[_0xad51('0x1d')]?_[_0xad51('0x1e')](_0x565b8e[_0xad51('0x1d')],function(_0x130340){return{'model':db[_0x130340[_0xad51('0x1f')]],'as':_0x130340['as'],'attributes':_0x130340[_0xad51('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xad51('0xb')](function(_0x43e0c5){logger[_0xad51('0xc')]('GetZendeskAccount',_0x2caa8f);logger[_0xad51('0x20')](_0xad51('0x15'),_0x2caa8f,JSON[_0xad51('0x10')](_0x43e0c5));_0x1d650b(_0x43e0c5);})[_0xad51('0x14')](function(_0x4a6a9a){logger[_0xad51('0x11')](_0xad51('0x15'),_0x4a6a9a[_0xad51('0x12')],_0x2caa8f);_0x24b1c0(_0xe0b98a[_0xad51('0x11')](0x1f4,_0x4a6a9a[_0xad51('0x12')]));});});};exports['ShowZendeskAccount']=function(_0x3c6253){var _0x44b58e=this;return new Promise(function(_0x31c2da,_0x479e3b){return db[_0xad51('0x16')][_0xad51('0x21')]({'raw':_0x3c6253['options']?_0x3c6253[_0xad51('0x18')][_0xad51('0x19')]===undefined?!![]:![]:!![],'where':_0x3c6253[_0xad51('0x18')]?_0x3c6253[_0xad51('0x18')][_0xad51('0x1a')]||null:null,'attributes':_0x3c6253[_0xad51('0x18')]?_0x3c6253[_0xad51('0x18')][_0xad51('0x1b')]||null:null,'include':_0x3c6253[_0xad51('0x18')]?_0x3c6253[_0xad51('0x18')][_0xad51('0x1d')]?_[_0xad51('0x1e')](_0x3c6253[_0xad51('0x18')][_0xad51('0x1d')],function(_0x41e639){return{'model':db[_0x41e639[_0xad51('0x1f')]],'as':_0x41e639['as'],'attributes':_0x41e639[_0xad51('0x1b')],'include':_0x41e639['include']?_[_0xad51('0x1e')](_0x41e639['include'],function(_0x50d83a){return{'model':db[_0x50d83a[_0xad51('0x1f')]],'as':_0x50d83a['as'],'attributes':_0x50d83a['attributes'],'include':_0x50d83a[_0xad51('0x1d')]?_[_0xad51('0x1e')](_0x50d83a[_0xad51('0x1d')],function(_0x11f842){return{'model':db[_0x11f842[_0xad51('0x1f')]],'as':_0x11f842['as'],'attributes':_0x11f842[_0xad51('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xad51('0xb')](function(_0x3562a7){logger[_0xad51('0xc')](_0xad51('0x22'),_0x3c6253);logger[_0xad51('0x20')](_0xad51('0x22'),_0x3c6253,JSON[_0xad51('0x10')](_0x3562a7));_0x31c2da(_0x3562a7);})[_0xad51('0x14')](function(_0x53cdcd){logger[_0xad51('0x11')](_0xad51('0x22'),_0x53cdcd[_0xad51('0x12')],_0x3c6253);_0x479e3b(_0x44b58e[_0xad51('0x11')](0x1f4,_0x53cdcd[_0xad51('0x12')]));});});}; \ No newline at end of file +var _0xb4d5=['debug','catch','find','ShowZendeskAccount','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','include','model','map'];(function(_0x5186bc,_0x42fd3d){var _0x59f772=function(_0x120154){while(--_0x120154){_0x5186bc['push'](_0x5186bc['shift']());}};_0x59f772(++_0x42fd3d);}(_0xb4d5,0x162));var _0x5b4d=function(_0x5a225e,_0x3696b7){_0x5a225e=_0x5a225e-0x0;var _0x475110=_0xb4d5[_0x5a225e];return _0x475110;};'use strict';var _=require('lodash');var util=require(_0x5b4d('0x0'));var moment=require('moment');var BPromise=require(_0x5b4d('0x1'));var rs=require(_0x5b4d('0x2'));var fs=require('fs');var Redis=require(_0x5b4d('0x3'));var db=require(_0x5b4d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5b4d('0x5'))(_0x5b4d('0x6'));var config=require('../../config/environment');var jayson=require(_0x5b4d('0x7'));var client=jayson[_0x5b4d('0x8')][_0x5b4d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x202411,_0x1ec6cc,_0x14cd0d){return new BPromise(function(_0x3eb451,_0x6a48bc){return client[_0x5b4d('0xa')](_0x202411,_0x14cd0d)[_0x5b4d('0xb')](function(_0x5d08c8){logger[_0x5b4d('0xc')](_0x5b4d('0xd'),_0x1ec6cc,_0x5b4d('0xe'));logger['debug']('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x1ec6cc,_0x5b4d('0xe'),JSON[_0x5b4d('0xf')](_0x5d08c8));if(_0x5d08c8[_0x5b4d('0x10')]){if(_0x5d08c8[_0x5b4d('0x10')][_0x5b4d('0x11')]===0x1f4){logger[_0x5b4d('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x1ec6cc,_0x5d08c8[_0x5b4d('0x10')][_0x5b4d('0x12')]);return _0x6a48bc(_0x5d08c8['error'][_0x5b4d('0x12')]);}logger[_0x5b4d('0x10')](_0x5b4d('0xd'),_0x1ec6cc,_0x5d08c8[_0x5b4d('0x10')][_0x5b4d('0x12')]);return _0x3eb451(_0x5d08c8[_0x5b4d('0x10')]['message']);}else{logger[_0x5b4d('0xc')](_0x5b4d('0xd'),_0x1ec6cc,_0x5b4d('0xe'));_0x3eb451(_0x5d08c8[_0x5b4d('0x13')][_0x5b4d('0x12')]);}})['catch'](function(_0x3023a5){logger[_0x5b4d('0x10')](_0x5b4d('0xd'),_0x1ec6cc,_0x3023a5);_0x6a48bc(_0x3023a5);});});}exports[_0x5b4d('0x14')]=function(_0x12aa05){var _0x41b0d1=this;return new Promise(function(_0x307d7e,_0x23a728){return db[_0x5b4d('0x15')][_0x5b4d('0x16')]({'raw':_0x12aa05[_0x5b4d('0x17')]?_0x12aa05['options'][_0x5b4d('0x18')]===undefined?!![]:![]:!![],'where':_0x12aa05[_0x5b4d('0x17')]?_0x12aa05['options'][_0x5b4d('0x19')]||null:null,'attributes':_0x12aa05[_0x5b4d('0x17')]?_0x12aa05['options'][_0x5b4d('0x1a')]||null:null,'limit':_0x12aa05[_0x5b4d('0x17')]?_0x12aa05['options'][_0x5b4d('0x1b')]||null:null,'include':_0x12aa05[_0x5b4d('0x17')]?_0x12aa05['options']['include']?_['map'](_0x12aa05[_0x5b4d('0x17')][_0x5b4d('0x1c')],function(_0x5de624){return{'model':db[_0x5de624[_0x5b4d('0x1d')]],'as':_0x5de624['as'],'attributes':_0x5de624[_0x5b4d('0x1a')],'include':_0x5de624[_0x5b4d('0x1c')]?_[_0x5b4d('0x1e')](_0x5de624[_0x5b4d('0x1c')],function(_0x31f636){return{'model':db[_0x31f636[_0x5b4d('0x1d')]],'as':_0x31f636['as'],'attributes':_0x31f636[_0x5b4d('0x1a')],'include':_0x31f636[_0x5b4d('0x1c')]?_[_0x5b4d('0x1e')](_0x31f636[_0x5b4d('0x1c')],function(_0x585957){return{'model':db[_0x585957[_0x5b4d('0x1d')]],'as':_0x585957['as'],'attributes':_0x585957['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xf0bf08){logger[_0x5b4d('0xc')](_0x5b4d('0x14'),_0x12aa05);logger[_0x5b4d('0x1f')](_0x5b4d('0x14'),_0x12aa05,JSON['stringify'](_0xf0bf08));_0x307d7e(_0xf0bf08);})[_0x5b4d('0x20')](function(_0x5b3424){logger[_0x5b4d('0x10')](_0x5b4d('0x14'),_0x5b3424[_0x5b4d('0x12')],_0x12aa05);_0x23a728(_0x41b0d1[_0x5b4d('0x10')](0x1f4,_0x5b3424[_0x5b4d('0x12')]));});});};exports['ShowZendeskAccount']=function(_0x109d6f){var _0x5ce43f=this;return new Promise(function(_0x46bdc8,_0x498882){return db['ZendeskAccount'][_0x5b4d('0x21')]({'raw':_0x109d6f[_0x5b4d('0x17')]?_0x109d6f[_0x5b4d('0x17')][_0x5b4d('0x18')]===undefined?!![]:![]:!![],'where':_0x109d6f['options']?_0x109d6f[_0x5b4d('0x17')]['where']||null:null,'attributes':_0x109d6f[_0x5b4d('0x17')]?_0x109d6f[_0x5b4d('0x17')][_0x5b4d('0x1a')]||null:null,'include':_0x109d6f[_0x5b4d('0x17')]?_0x109d6f[_0x5b4d('0x17')][_0x5b4d('0x1c')]?_[_0x5b4d('0x1e')](_0x109d6f[_0x5b4d('0x17')][_0x5b4d('0x1c')],function(_0x5122db){return{'model':db[_0x5122db[_0x5b4d('0x1d')]],'as':_0x5122db['as'],'attributes':_0x5122db[_0x5b4d('0x1a')],'include':_0x5122db['include']?_[_0x5b4d('0x1e')](_0x5122db['include'],function(_0x2b1058){return{'model':db[_0x2b1058[_0x5b4d('0x1d')]],'as':_0x2b1058['as'],'attributes':_0x2b1058[_0x5b4d('0x1a')],'include':_0x2b1058[_0x5b4d('0x1c')]?_[_0x5b4d('0x1e')](_0x2b1058[_0x5b4d('0x1c')],function(_0x2216ac){return{'model':db[_0x2216ac[_0x5b4d('0x1d')]],'as':_0x2216ac['as'],'attributes':_0x2216ac[_0x5b4d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5b4d('0xb')](function(_0x33c91d){logger['info'](_0x5b4d('0x22'),_0x109d6f);logger[_0x5b4d('0x1f')](_0x5b4d('0x22'),_0x109d6f,JSON[_0x5b4d('0xf')](_0x33c91d));_0x46bdc8(_0x33c91d);})[_0x5b4d('0x20')](function(_0x1487ba){logger[_0x5b4d('0x10')](_0x5b4d('0x22'),_0x1487ba[_0x5b4d('0x12')],_0x109d6f);_0x498882(_0x5ce43f[_0x5b4d('0x10')](0x1f4,_0x1487ba[_0x5b4d('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 8ae0d1a..359cc2b 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 _0xbdb7=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskConfiguration.controller','index','get','show','getFields','/:id/subjects','isAuthenticated','getSubjects','/:id/descriptions','getTags','/:id/tags','update','delete','/:id'];(function(_0x5e4a6a,_0x287632){var _0xc8879f=function(_0x4a5f5a){while(--_0x4a5f5a){_0x5e4a6a['push'](_0x5e4a6a['shift']());}};_0xc8879f(++_0x287632);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x1d34e3,_0x4f5844){_0x1d34e3=_0x1d34e3-0x0;var _0x34266b=_0xbdb7[_0x1d34e3];return _0x34266b;};'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')]('/:id',auth['isAuthenticated'](),controller[_0x7bdb('0xc')]);router[_0x7bdb('0xb')]('/:id/fields',auth['isAuthenticated'](),controller[_0x7bdb('0xd')]);router[_0x7bdb('0xb')](_0x7bdb('0xe'),auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x10')]);router[_0x7bdb('0xb')](_0x7bdb('0x11'),auth[_0x7bdb('0xf')](),controller['getDescriptions']);router['get']('/:id/tags',auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x12')]);router['post']('/',auth[_0x7bdb('0xf')](),controller['create']);router['post'](_0x7bdb('0x13'),auth[_0x7bdb('0xf')](),controller['setTags']);router['put']('/:id',auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x14')]);router[_0x7bdb('0x15')](_0x7bdb('0x16'),auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x17')]);module[_0x7bdb('0x18')]=router; \ No newline at end of file +var _0xb10b=['getFields','/:id/subjects','/:id/descriptions','getTags','post','create','setTags','put','/:id','update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','index','isAuthenticated','show','/:id/fields'];(function(_0x428901,_0x37bac1){var _0x1348c6=function(_0x1c6aa9){while(--_0x1c6aa9){_0x428901['push'](_0x428901['shift']());}};_0x1348c6(++_0x37bac1);}(_0xb10b,0x12a));var _0xbb10=function(_0xb0ed0c,_0x1a1fb1){_0xb0ed0c=_0xb0ed0c-0x0;var _0x5d5356=_0xb10b[_0xb0ed0c];return _0x5d5356;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getDescriptions']);router[_0xbb10('0x9')]('/:id/tags',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x12')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router[_0xbb10('0x12')]('/:id/tags',auth[_0xbb10('0xb')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x15')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x18')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index c648c47..4bce9a0 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 _0x02b1=['exports'];(function(_0x5f4344,_0x1bd0fd){var _0x1bacdc=function(_0x4ac80a){while(--_0x4ac80a){_0x5f4344['push'](_0x5f4344['shift']());}};_0x1bacdc(++_0x1bd0fd);}(_0x02b1,0x164));var _0x102b=function(_0x2e2cab,_0x31107d){_0x2e2cab=_0x2e2cab-0x0;var _0x321f04=_0x02b1[_0x2e2cab];return _0x321f04;};'use strict';var Sequelize=require('sequelize');module[_0x102b('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb90a=['STRING','sequelize','exports'];(function(_0x59f5cc,_0x21d4ee){var _0xb46d3f=function(_0x427cba){while(--_0x427cba){_0x59f5cc['push'](_0x59f5cc['shift']());}};_0xb46d3f(++_0x21d4ee);}(_0xb90a,0xfa));var _0xab90=function(_0x413935,_0x34e81b){_0x413935=_0x413935-0x0;var _0x3ef383=_0xb90a[_0x413935];return _0x3ef383;};'use strict';var Sequelize=require(_0xab90('0x0'));module[_0xab90('0x1')]={'name':{'type':Sequelize[_0xab90('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 bdf579b..4d5984a 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 _0x7fe8=['count','set','Content-Range','reject','save','then','error','stack','name','send','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','include','findAll','catch','show','params','fields','length','find','create','body','destroy','getFields','ZendeskField','pick','getSubjects','getDescriptions','findOne','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','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','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit'];(function(_0x4cda06,_0x3cb29c){var _0x48f3fa=function(_0x21f3a6){while(--_0x21f3a6){_0x4cda06['push'](_0x4cda06['shift']());}};_0x48f3fa(++_0x3cb29c);}(_0x7fe8,0x12f));var _0x87fe=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0x7fe8[_0x556bb1];return _0x45455f;};'use strict';var emlformat=require(_0x87fe('0x0'));var rimraf=require(_0x87fe('0x1'));var zipdir=require(_0x87fe('0x2'));var jsonpatch=require(_0x87fe('0x3'));var rp=require('request-promise');var moment=require(_0x87fe('0x4'));var BPromise=require(_0x87fe('0x5'));var Mustache=require(_0x87fe('0x6'));var util=require(_0x87fe('0x7'));var path=require(_0x87fe('0x8'));var sox=require(_0x87fe('0x9'));var csv=require(_0x87fe('0xa'));var ejs=require(_0x87fe('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x87fe('0xc'));var squel=require(_0x87fe('0xd'));var crypto=require(_0x87fe('0xe'));var jsforce=require(_0x87fe('0xf'));var deskjs=require(_0x87fe('0x10'));var toCsv=require(_0x87fe('0xa'));var querystring=require(_0x87fe('0x11'));var Papa=require(_0x87fe('0x12'));var Redis=require(_0x87fe('0x13'));var authService=require(_0x87fe('0x14'));var qs=require(_0x87fe('0x15'));var as=require(_0x87fe('0x16'));var hardwareService=require(_0x87fe('0x17'));var logger=require('../../config/logger')(_0x87fe('0x18'));var utils=require(_0x87fe('0x19'));var config=require(_0x87fe('0x1a'));var licenseUtil=require(_0x87fe('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x397d8a,_0x48c5e7){_0x48c5e7=_0x48c5e7||0xcc;return function(_0xc933a5){if(_0xc933a5){return _0x397d8a[_0x87fe('0x1c')](_0x48c5e7);}return _0x397d8a['status'](_0x48c5e7)['end']();};}function respondWithResult(_0x3e3844,_0x4a321d){_0x4a321d=_0x4a321d||0xc8;return function(_0x4c88d8){if(_0x4c88d8){return _0x3e3844[_0x87fe('0x1d')](_0x4a321d)[_0x87fe('0x1e')](_0x4c88d8);}};}function respondWithFilteredResult(_0x29ace6,_0x522f34){return function(_0x3d055b){if(_0x3d055b){var _0x39e90b=typeof _0x522f34[_0x87fe('0x1f')]==='undefined'&&typeof _0x522f34[_0x87fe('0x20')]==='undefined';var _0x290a8b=_0x3d055b[_0x87fe('0x21')];var _0x57c012=_0x39e90b?0x0:_0x522f34['offset'];var _0x24b7cf=_0x39e90b?_0x3d055b['count']:_0x522f34[_0x87fe('0x1f')]+_0x522f34[_0x87fe('0x20')];var _0x45b180;if(_0x24b7cf>=_0x290a8b){_0x24b7cf=_0x290a8b;_0x45b180=0xc8;}else{_0x45b180=0xce;}_0x29ace6[_0x87fe('0x1d')](_0x45b180);return _0x29ace6[_0x87fe('0x22')](_0x87fe('0x23'),_0x57c012+'-'+_0x24b7cf+'/'+_0x290a8b)['json'](_0x3d055b);}return null;};}function patchUpdates(_0x9e3498){return function(_0x201979){try{jsonpatch['apply'](_0x201979,_0x9e3498,!![]);}catch(_0x4a16fd){return BPromise[_0x87fe('0x24')](_0x4a16fd);}return _0x201979[_0x87fe('0x25')]();};}function saveUpdates(_0x40d3a7,_0x26193e){return function(_0x1dac65){if(_0x1dac65){return _0x1dac65['update'](_0x40d3a7)[_0x87fe('0x26')](function(_0x50de5c){return _0x50de5c;});}return null;};}function removeEntity(_0x49881e,_0x2853af){return function(_0x1643b3){if(_0x1643b3){return _0x1643b3['destroy']()[_0x87fe('0x26')](function(){_0x49881e[_0x87fe('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23052a,_0x359fae){return function(_0xf91e70){if(!_0xf91e70){_0x23052a[_0x87fe('0x1c')](0x194);}return _0xf91e70;};}function handleError(_0x5528ea,_0x17dd31){_0x17dd31=_0x17dd31||0x1f4;return function(_0x32286a){logger[_0x87fe('0x27')](_0x32286a[_0x87fe('0x28')]);if(_0x32286a[_0x87fe('0x29')]){delete _0x32286a[_0x87fe('0x29')];}_0x5528ea['status'](_0x17dd31)[_0x87fe('0x2a')](_0x32286a);};}exports['index']=function(_0x373319,_0x1b2fa6){var _0x41aa33={},_0x58ba71={},_0x190016={'count':0x0,'rows':[]};var _0x5d1568=_['map'](db[_0x87fe('0x2b')][_0x87fe('0x2c')],function(_0x1b9f79){return{'name':_0x1b9f79[_0x87fe('0x2d')],'type':_0x1b9f79[_0x87fe('0x2e')][_0x87fe('0x2f')]};});_0x58ba71[_0x87fe('0x30')]=_[_0x87fe('0x31')](_0x5d1568,_0x87fe('0x29'));_0x58ba71['query']=_[_0x87fe('0x32')](_0x373319[_0x87fe('0x33')]);_0x58ba71[_0x87fe('0x34')]=_[_0x87fe('0x35')](_0x58ba71['model'],_0x58ba71[_0x87fe('0x33')]);_0x41aa33[_0x87fe('0x36')]=_[_0x87fe('0x35')](_0x58ba71[_0x87fe('0x30')],qs['fields'](_0x373319['query']['fields']));_0x41aa33[_0x87fe('0x36')]=_0x41aa33[_0x87fe('0x36')]['length']?_0x41aa33[_0x87fe('0x36')]:_0x58ba71['model'];if(!_0x373319['query'][_0x87fe('0x37')](_0x87fe('0x38'))){_0x41aa33['limit']=qs[_0x87fe('0x20')](_0x373319[_0x87fe('0x33')][_0x87fe('0x20')]);_0x41aa33[_0x87fe('0x1f')]=qs['offset'](_0x373319[_0x87fe('0x33')][_0x87fe('0x1f')]);}_0x41aa33[_0x87fe('0x39')]=qs[_0x87fe('0x3a')](_0x373319[_0x87fe('0x33')][_0x87fe('0x3a')]);_0x41aa33[_0x87fe('0x3b')]=qs[_0x87fe('0x34')](_['pick'](_0x373319[_0x87fe('0x33')],_0x58ba71['filters']),_0x5d1568);if(_0x373319['query'][_0x87fe('0x3c')]){_0x41aa33['where']=_[_0x87fe('0x3d')](_0x41aa33['where'],{'$or':_[_0x87fe('0x31')](_0x5d1568,function(_0x36e5f9){if(_0x36e5f9[_0x87fe('0x2e')]!=='VIRTUAL'){var _0x59da4a={};_0x59da4a[_0x36e5f9[_0x87fe('0x29')]]={'$like':'%'+_0x373319[_0x87fe('0x33')][_0x87fe('0x3c')]+'%'};return _0x59da4a;}})});}_0x41aa33=_[_0x87fe('0x3d')]({},_0x41aa33,_0x373319[_0x87fe('0x3e')]);var _0x45c13f={'where':_0x41aa33['where']};return db[_0x87fe('0x2b')]['count'](_0x45c13f)[_0x87fe('0x26')](function(_0x20526d){_0x190016[_0x87fe('0x21')]=_0x20526d;if(_0x373319['query']['includeAll']){_0x41aa33[_0x87fe('0x3f')]=[{'all':!![]}];}return db[_0x87fe('0x2b')][_0x87fe('0x40')](_0x41aa33);})[_0x87fe('0x26')](function(_0xb4ae29){_0x190016['rows']=_0xb4ae29;return _0x190016;})[_0x87fe('0x26')](respondWithFilteredResult(_0x1b2fa6,_0x41aa33))[_0x87fe('0x41')](handleError(_0x1b2fa6,null));};exports[_0x87fe('0x42')]=function(_0x309fa9,_0x5294b5){var _0xc2539e={'raw':![],'where':{'id':_0x309fa9[_0x87fe('0x43')]['id']}},_0x45dbf0={};_0x45dbf0[_0x87fe('0x30')]=_[_0x87fe('0x32')](db[_0x87fe('0x2b')][_0x87fe('0x2c')]);_0x45dbf0[_0x87fe('0x33')]=_[_0x87fe('0x32')](_0x309fa9[_0x87fe('0x33')]);_0x45dbf0['filters']=_[_0x87fe('0x35')](_0x45dbf0[_0x87fe('0x30')],_0x45dbf0[_0x87fe('0x33')]);_0xc2539e[_0x87fe('0x36')]=_[_0x87fe('0x35')](_0x45dbf0['model'],qs[_0x87fe('0x44')](_0x309fa9[_0x87fe('0x33')][_0x87fe('0x44')]));_0xc2539e[_0x87fe('0x36')]=_0xc2539e[_0x87fe('0x36')][_0x87fe('0x45')]?_0xc2539e[_0x87fe('0x36')]:_0x45dbf0[_0x87fe('0x30')];if(_0x309fa9[_0x87fe('0x33')]['includeAll']){_0xc2539e['include']=[{'all':!![]}];}_0xc2539e=_[_0x87fe('0x3d')]({},_0xc2539e,_0x309fa9['options']);return db['ZendeskConfiguration'][_0x87fe('0x46')](_0xc2539e)[_0x87fe('0x26')](handleEntityNotFound(_0x5294b5,null))[_0x87fe('0x26')](respondWithResult(_0x5294b5,null))['catch'](handleError(_0x5294b5,null));};exports[_0x87fe('0x47')]=function(_0x13ad22,_0x258e70){return db['ZendeskConfiguration'][_0x87fe('0x47')](_0x13ad22[_0x87fe('0x48')],{})[_0x87fe('0x26')](respondWithResult(_0x258e70,0xc9))[_0x87fe('0x41')](handleError(_0x258e70,null));};exports['update']=function(_0x5df41d,_0xc20065){if(_0x5df41d[_0x87fe('0x48')]['id']){delete _0x5df41d[_0x87fe('0x48')]['id'];}return db[_0x87fe('0x2b')][_0x87fe('0x46')]({'where':{'id':_0x5df41d[_0x87fe('0x43')]['id']}})[_0x87fe('0x26')](handleEntityNotFound(_0xc20065,null))[_0x87fe('0x26')](saveUpdates(_0x5df41d[_0x87fe('0x48')],null))[_0x87fe('0x26')](respondWithResult(_0xc20065,null))[_0x87fe('0x41')](handleError(_0xc20065,null));};exports[_0x87fe('0x49')]=function(_0x148c5b,_0x4c3385){return db[_0x87fe('0x2b')][_0x87fe('0x46')]({'where':{'id':_0x148c5b[_0x87fe('0x43')]['id']}})[_0x87fe('0x26')](handleEntityNotFound(_0x4c3385,null))[_0x87fe('0x26')](removeEntity(_0x4c3385,null))[_0x87fe('0x41')](handleError(_0x4c3385,null));};exports[_0x87fe('0x4a')]=function(_0x462468,_0xf3c12b,_0x55dc0e){var _0x1c921e={};var _0x3e3495={};var _0x472947;var _0x3e03f1;return db[_0x87fe('0x2b')]['findOne']({'where':{'id':_0x462468[_0x87fe('0x43')]['id']}})[_0x87fe('0x26')](handleEntityNotFound(_0xf3c12b,null))[_0x87fe('0x26')](function(_0x3a0d01){if(_0x3a0d01){_0x472947=_0x3a0d01;_0x3e3495[_0x87fe('0x30')]=_[_0x87fe('0x32')](db['ZendeskField'][_0x87fe('0x2c')]);_0x3e3495['query']=_['keys'](_0x462468['query']);_0x3e3495['filters']=_[_0x87fe('0x35')](_0x3e3495['model'],_0x3e3495[_0x87fe('0x33')]);_0x1c921e[_0x87fe('0x36')]=_[_0x87fe('0x35')](_0x3e3495[_0x87fe('0x30')],qs['fields'](_0x462468['query'][_0x87fe('0x44')]));_0x1c921e[_0x87fe('0x36')]=_0x1c921e[_0x87fe('0x36')][_0x87fe('0x45')]?_0x1c921e[_0x87fe('0x36')]:_0x3e3495[_0x87fe('0x30')];_0x1c921e[_0x87fe('0x39')]=qs[_0x87fe('0x3a')](_0x462468['query'][_0x87fe('0x3a')]);_0x1c921e[_0x87fe('0x3b')]=qs[_0x87fe('0x34')](_['pick'](_0x462468[_0x87fe('0x33')],_0x3e3495['filters']));if(_0x462468[_0x87fe('0x33')][_0x87fe('0x3c')]){_0x1c921e['where']=_[_0x87fe('0x3d')](_0x1c921e[_0x87fe('0x3b')],{'$or':_[_0x87fe('0x31')](_0x1c921e[_0x87fe('0x36')],function(_0x344053){var _0x7305d8={};_0x7305d8[_0x344053]={'$like':'%'+_0x462468[_0x87fe('0x33')][_0x87fe('0x3c')]+'%'};return _0x7305d8;})});}_0x1c921e=_[_0x87fe('0x3d')]({},_0x1c921e,_0x462468[_0x87fe('0x3e')]);return _0x472947[_0x87fe('0x4a')](_0x1c921e);}})['then'](function(_0x9fa911){if(_0x9fa911){_0x3e03f1=_0x9fa911['length'];if(!_0x462468['query'][_0x87fe('0x37')](_0x87fe('0x38'))){_0x1c921e['limit']=qs[_0x87fe('0x20')](_0x462468[_0x87fe('0x33')][_0x87fe('0x20')]);_0x1c921e['offset']=qs[_0x87fe('0x1f')](_0x462468[_0x87fe('0x33')]['offset']);}return _0x472947[_0x87fe('0x4a')](_0x1c921e);}})[_0x87fe('0x26')](function(_0xf619ad){if(_0xf619ad){return _0xf619ad?{'count':_0x3e03f1,'rows':_0xf619ad}:null;}})[_0x87fe('0x26')](respondWithResult(_0xf3c12b,null))['catch'](handleError(_0xf3c12b,null));};exports['getSubjects']=function(_0x2337cf,_0x12ceb9,_0x30cf6f){var _0x3646e6={};var _0x28be63={};var _0x18744f;var _0x3a7dcf;return db[_0x87fe('0x2b')]['findOne']({'where':{'id':_0x2337cf[_0x87fe('0x43')]['id']}})[_0x87fe('0x26')](handleEntityNotFound(_0x12ceb9,null))['then'](function(_0x3496d4){if(_0x3496d4){_0x18744f=_0x3496d4;_0x28be63[_0x87fe('0x30')]=_[_0x87fe('0x32')](db[_0x87fe('0x4b')]['rawAttributes']);_0x28be63[_0x87fe('0x33')]=_['keys'](_0x2337cf[_0x87fe('0x33')]);_0x28be63[_0x87fe('0x34')]=_[_0x87fe('0x35')](_0x28be63[_0x87fe('0x30')],_0x28be63[_0x87fe('0x33')]);_0x3646e6[_0x87fe('0x36')]=_[_0x87fe('0x35')](_0x28be63[_0x87fe('0x30')],qs['fields'](_0x2337cf['query'][_0x87fe('0x44')]));_0x3646e6[_0x87fe('0x36')]=_0x3646e6['attributes']['length']?_0x3646e6[_0x87fe('0x36')]:_0x28be63[_0x87fe('0x30')];_0x3646e6[_0x87fe('0x39')]=qs[_0x87fe('0x3a')](_0x2337cf['query']['sort']);_0x3646e6['where']=qs[_0x87fe('0x34')](_[_0x87fe('0x4c')](_0x2337cf['query'],_0x28be63[_0x87fe('0x34')]));if(_0x2337cf[_0x87fe('0x33')][_0x87fe('0x3c')]){_0x3646e6[_0x87fe('0x3b')]=_[_0x87fe('0x3d')](_0x3646e6['where'],{'$or':_[_0x87fe('0x31')](_0x3646e6[_0x87fe('0x36')],function(_0x265935){var _0x573396={};_0x573396[_0x265935]={'$like':'%'+_0x2337cf[_0x87fe('0x33')]['filter']+'%'};return _0x573396;})});}_0x3646e6=_['merge']({},_0x3646e6,_0x2337cf[_0x87fe('0x3e')]);return _0x18744f[_0x87fe('0x4d')](_0x3646e6);}})[_0x87fe('0x26')](function(_0x369aed){if(_0x369aed){_0x3a7dcf=_0x369aed[_0x87fe('0x45')];if(!_0x2337cf[_0x87fe('0x33')][_0x87fe('0x37')](_0x87fe('0x38'))){_0x3646e6[_0x87fe('0x20')]=qs[_0x87fe('0x20')](_0x2337cf[_0x87fe('0x33')]['limit']);_0x3646e6[_0x87fe('0x1f')]=qs[_0x87fe('0x1f')](_0x2337cf[_0x87fe('0x33')][_0x87fe('0x1f')]);}return _0x18744f[_0x87fe('0x4d')](_0x3646e6);}})['then'](function(_0xc6ead){if(_0xc6ead){return _0xc6ead?{'count':_0x3a7dcf,'rows':_0xc6ead}:null;}})[_0x87fe('0x26')](respondWithResult(_0x12ceb9,null))[_0x87fe('0x41')](handleError(_0x12ceb9,null));};exports[_0x87fe('0x4e')]=function(_0x46ce6e,_0x35a556,_0xcacfdd){var _0x7e597b={};var _0x14f115={};var _0x5c19ee;var _0x4b8ecd;return db[_0x87fe('0x2b')][_0x87fe('0x4f')]({'where':{'id':_0x46ce6e[_0x87fe('0x43')]['id']}})[_0x87fe('0x26')](handleEntityNotFound(_0x35a556,null))[_0x87fe('0x26')](function(_0x3a35fe){if(_0x3a35fe){_0x5c19ee=_0x3a35fe;_0x14f115['model']=_[_0x87fe('0x32')](db[_0x87fe('0x4b')]['rawAttributes']);_0x14f115[_0x87fe('0x33')]=_[_0x87fe('0x32')](_0x46ce6e[_0x87fe('0x33')]);_0x14f115[_0x87fe('0x34')]=_['intersection'](_0x14f115[_0x87fe('0x30')],_0x14f115[_0x87fe('0x33')]);_0x7e597b['attributes']=_['intersection'](_0x14f115[_0x87fe('0x30')],qs[_0x87fe('0x44')](_0x46ce6e[_0x87fe('0x33')]['fields']));_0x7e597b[_0x87fe('0x36')]=_0x7e597b[_0x87fe('0x36')][_0x87fe('0x45')]?_0x7e597b[_0x87fe('0x36')]:_0x14f115[_0x87fe('0x30')];_0x7e597b[_0x87fe('0x39')]=qs[_0x87fe('0x3a')](_0x46ce6e['query'][_0x87fe('0x3a')]);_0x7e597b[_0x87fe('0x3b')]=qs['filters'](_[_0x87fe('0x4c')](_0x46ce6e['query'],_0x14f115[_0x87fe('0x34')]));if(_0x46ce6e[_0x87fe('0x33')]['filter']){_0x7e597b[_0x87fe('0x3b')]=_[_0x87fe('0x3d')](_0x7e597b['where'],{'$or':_['map'](_0x7e597b[_0x87fe('0x36')],function(_0xa109a4){var _0x45381d={};_0x45381d[_0xa109a4]={'$like':'%'+_0x46ce6e[_0x87fe('0x33')]['filter']+'%'};return _0x45381d;})});}_0x7e597b=_[_0x87fe('0x3d')]({},_0x7e597b,_0x46ce6e[_0x87fe('0x3e')]);return _0x5c19ee[_0x87fe('0x4e')](_0x7e597b);}})[_0x87fe('0x26')](function(_0x344ffb){if(_0x344ffb){_0x4b8ecd=_0x344ffb[_0x87fe('0x45')];if(!_0x46ce6e[_0x87fe('0x33')]['hasOwnProperty'](_0x87fe('0x38'))){_0x7e597b['limit']=qs[_0x87fe('0x20')](_0x46ce6e[_0x87fe('0x33')][_0x87fe('0x20')]);_0x7e597b[_0x87fe('0x1f')]=qs['offset'](_0x46ce6e[_0x87fe('0x33')][_0x87fe('0x1f')]);}return _0x5c19ee['getDescriptions'](_0x7e597b);}})[_0x87fe('0x26')](function(_0x198b7e){if(_0x198b7e){return _0x198b7e?{'count':_0x4b8ecd,'rows':_0x198b7e}:null;}})[_0x87fe('0x26')](respondWithResult(_0x35a556,null))['catch'](handleError(_0x35a556,null));};exports[_0x87fe('0x50')]=function(_0x3a029d,_0x3b430a,_0x460621){var _0x5d8a8b={};var _0x227726={};var _0x29da4a;var _0x5942ad;return db[_0x87fe('0x2b')][_0x87fe('0x4f')]({'where':{'id':_0x3a029d[_0x87fe('0x43')]['id']}})[_0x87fe('0x26')](handleEntityNotFound(_0x3b430a,null))[_0x87fe('0x26')](function(_0x2d9e38){if(_0x2d9e38){_0x29da4a=_0x2d9e38;_0x227726[_0x87fe('0x30')]=_['keys'](db[_0x87fe('0x51')][_0x87fe('0x2c')]);_0x227726[_0x87fe('0x33')]=_[_0x87fe('0x32')](_0x3a029d[_0x87fe('0x33')]);_0x227726['filters']=_[_0x87fe('0x35')](_0x227726['model'],_0x227726[_0x87fe('0x33')]);_0x5d8a8b['attributes']=_[_0x87fe('0x35')](_0x227726[_0x87fe('0x30')],qs[_0x87fe('0x44')](_0x3a029d[_0x87fe('0x33')][_0x87fe('0x44')]));_0x5d8a8b['attributes']=_0x5d8a8b[_0x87fe('0x36')]['length']?_0x5d8a8b['attributes']:_0x227726[_0x87fe('0x30')];_0x5d8a8b[_0x87fe('0x39')]=qs['sort'](_0x3a029d['query'][_0x87fe('0x3a')]);_0x5d8a8b[_0x87fe('0x3b')]=qs['filters'](_[_0x87fe('0x4c')](_0x3a029d['query'],_0x227726['filters']));if(_0x3a029d[_0x87fe('0x33')]['filter']){_0x5d8a8b[_0x87fe('0x3b')]=_['merge'](_0x5d8a8b['where'],{'$or':_['map'](_0x5d8a8b[_0x87fe('0x36')],function(_0x472f01){var _0x310548={};_0x310548[_0x472f01]={'$like':'%'+_0x3a029d['query'][_0x87fe('0x3c')]+'%'};return _0x310548;})});}_0x5d8a8b=_[_0x87fe('0x3d')]({},_0x5d8a8b,_0x3a029d[_0x87fe('0x3e')]);return _0x29da4a[_0x87fe('0x50')](_0x5d8a8b);}})[_0x87fe('0x26')](function(_0xa18a2){if(_0xa18a2){_0x5942ad=_0xa18a2[_0x87fe('0x45')];if(!_0x3a029d[_0x87fe('0x33')]['hasOwnProperty'](_0x87fe('0x38'))){_0x5d8a8b[_0x87fe('0x20')]=qs[_0x87fe('0x20')](_0x3a029d[_0x87fe('0x33')]['limit']);_0x5d8a8b['offset']=qs[_0x87fe('0x1f')](_0x3a029d[_0x87fe('0x33')]['offset']);}return _0x29da4a[_0x87fe('0x50')](_0x5d8a8b);}})[_0x87fe('0x26')](function(_0x464500){if(_0x464500){return _0x464500?{'count':_0x5942ad,'rows':_0x464500}:null;}})[_0x87fe('0x26')](respondWithResult(_0x3b430a,null))['catch'](handleError(_0x3b430a,null));};exports['setTags']=function(_0x58236e,_0x10f55b,_0x56452d){if(_0x58236e[_0x87fe('0x48')]['id']){delete _0x58236e[_0x87fe('0x48')]['id'];}return db[_0x87fe('0x2b')][_0x87fe('0x4f')]({'where':{'id':_0x58236e[_0x87fe('0x43')]['id']}})['then'](handleEntityNotFound(_0x10f55b,null))['then'](function(_0x463ab3){if(_0x463ab3){return _0x463ab3[_0x87fe('0x52')](_0x58236e['body'][_0x87fe('0x53')]||[]);}return null;})[_0x87fe('0x26')](respondWithResult(_0x10f55b,null))[_0x87fe('0x41')](handleError(_0x10f55b,null));}; \ No newline at end of file +var _0xdbd1=['ZendeskConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','where','pick','map','filter','options','includeAll','include','findAll','rows','catch','show','length','merge','find','create','body','params','destroy','getFields','sort','getSubjects','getDescriptions','ZendeskField','getTags','findOne','Tag','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','offset','count','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index'];(function(_0x5f5995,_0x2323ae){var _0x125d06=function(_0x4f46c3){while(--_0x4f46c3){_0x5f5995['push'](_0x5f5995['shift']());}};_0x125d06(++_0x2323ae);}(_0xdbd1,0x132));var _0x1dbd=function(_0x2a1b33,_0x409f50){_0x2a1b33=_0x2a1b33-0x0;var _0x4c50e7=_0xdbd1[_0x2a1b33];return _0x4c50e7;};'use strict';var emlformat=require(_0x1dbd('0x0'));var rimraf=require(_0x1dbd('0x1'));var zipdir=require(_0x1dbd('0x2'));var jsonpatch=require(_0x1dbd('0x3'));var rp=require(_0x1dbd('0x4'));var moment=require('moment');var BPromise=require(_0x1dbd('0x5'));var Mustache=require(_0x1dbd('0x6'));var util=require(_0x1dbd('0x7'));var path=require(_0x1dbd('0x8'));var sox=require(_0x1dbd('0x9'));var csv=require('to-csv');var ejs=require(_0x1dbd('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1dbd('0xb'));var squel=require(_0x1dbd('0xc'));var crypto=require('crypto');var jsforce=require(_0x1dbd('0xd'));var deskjs=require(_0x1dbd('0xe'));var toCsv=require(_0x1dbd('0xf'));var querystring=require(_0x1dbd('0x10'));var Papa=require(_0x1dbd('0x11'));var Redis=require(_0x1dbd('0x12'));var authService=require(_0x1dbd('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1dbd('0x14'))(_0x1dbd('0x15'));var utils=require(_0x1dbd('0x16'));var config=require(_0x1dbd('0x17'));var licenseUtil=require(_0x1dbd('0x18'));var db=require(_0x1dbd('0x19'))['db'];function respondWithStatusCode(_0x2cb37b,_0x5cb03c){_0x5cb03c=_0x5cb03c||0xcc;return function(_0x1aff33){if(_0x1aff33){return _0x2cb37b[_0x1dbd('0x1a')](_0x5cb03c);}return _0x2cb37b[_0x1dbd('0x1b')](_0x5cb03c)['end']();};}function respondWithResult(_0x596623,_0x3a9340){_0x3a9340=_0x3a9340||0xc8;return function(_0x36f5e9){if(_0x36f5e9){return _0x596623[_0x1dbd('0x1b')](_0x3a9340)[_0x1dbd('0x1c')](_0x36f5e9);}};}function respondWithFilteredResult(_0x502389,_0x2692d8){return function(_0x7def42){if(_0x7def42){var _0x38fb0f=typeof _0x2692d8['offset']==='undefined'&&typeof _0x2692d8[_0x1dbd('0x1d')]===_0x1dbd('0x1e');var _0x2f4215=_0x7def42['count'];var _0x15a237=_0x38fb0f?0x0:_0x2692d8[_0x1dbd('0x1f')];var _0x34e3a7=_0x38fb0f?_0x7def42[_0x1dbd('0x20')]:_0x2692d8['offset']+_0x2692d8['limit'];var _0x15f0c8;if(_0x34e3a7>=_0x2f4215){_0x34e3a7=_0x2f4215;_0x15f0c8=0xc8;}else{_0x15f0c8=0xce;}_0x502389['status'](_0x15f0c8);return _0x502389[_0x1dbd('0x21')](_0x1dbd('0x22'),_0x15a237+'-'+_0x34e3a7+'/'+_0x2f4215)[_0x1dbd('0x1c')](_0x7def42);}return null;};}function patchUpdates(_0x48b8a2){return function(_0x927800){try{jsonpatch[_0x1dbd('0x23')](_0x927800,_0x48b8a2,!![]);}catch(_0x433c2d){return BPromise[_0x1dbd('0x24')](_0x433c2d);}return _0x927800[_0x1dbd('0x25')]();};}function saveUpdates(_0x2817eb,_0x155f42){return function(_0x31b440){if(_0x31b440){return _0x31b440[_0x1dbd('0x26')](_0x2817eb)[_0x1dbd('0x27')](function(_0xe771f3){return _0xe771f3;});}return null;};}function removeEntity(_0x215b35,_0x1264ab){return function(_0x4445e1){if(_0x4445e1){return _0x4445e1['destroy']()['then'](function(){_0x215b35['status'](0xcc)[_0x1dbd('0x28')]();});}};}function handleEntityNotFound(_0xc9576e,_0x5e3845){return function(_0x4ff7a1){if(!_0x4ff7a1){_0xc9576e[_0x1dbd('0x1a')](0x194);}return _0x4ff7a1;};}function handleError(_0x4b426b,_0x8a1ef8){_0x8a1ef8=_0x8a1ef8||0x1f4;return function(_0x28a595){logger[_0x1dbd('0x29')](_0x28a595[_0x1dbd('0x2a')]);if(_0x28a595[_0x1dbd('0x2b')]){delete _0x28a595[_0x1dbd('0x2b')];}_0x4b426b[_0x1dbd('0x1b')](_0x8a1ef8)[_0x1dbd('0x2c')](_0x28a595);};}exports[_0x1dbd('0x2d')]=function(_0x540299,_0x4fcbfd){var _0x3e2f07={},_0x47dc61={},_0x398be3={'count':0x0,'rows':[]};var _0x4910c6=_['map'](db[_0x1dbd('0x2e')][_0x1dbd('0x2f')],function(_0x30c1c7){return{'name':_0x30c1c7[_0x1dbd('0x30')],'type':_0x30c1c7[_0x1dbd('0x31')][_0x1dbd('0x32')]};});_0x47dc61['model']=_['map'](_0x4910c6,_0x1dbd('0x2b'));_0x47dc61[_0x1dbd('0x33')]=_[_0x1dbd('0x34')](_0x540299['query']);_0x47dc61[_0x1dbd('0x35')]=_[_0x1dbd('0x36')](_0x47dc61[_0x1dbd('0x37')],_0x47dc61[_0x1dbd('0x33')]);_0x3e2f07[_0x1dbd('0x38')]=_[_0x1dbd('0x36')](_0x47dc61[_0x1dbd('0x37')],qs[_0x1dbd('0x39')](_0x540299['query'][_0x1dbd('0x39')]));_0x3e2f07[_0x1dbd('0x38')]=_0x3e2f07[_0x1dbd('0x38')]['length']?_0x3e2f07[_0x1dbd('0x38')]:_0x47dc61[_0x1dbd('0x37')];if(!_0x540299['query'][_0x1dbd('0x3a')](_0x1dbd('0x3b'))){_0x3e2f07['limit']=qs['limit'](_0x540299[_0x1dbd('0x33')][_0x1dbd('0x1d')]);_0x3e2f07[_0x1dbd('0x1f')]=qs[_0x1dbd('0x1f')](_0x540299['query'][_0x1dbd('0x1f')]);}_0x3e2f07[_0x1dbd('0x3c')]=qs['sort'](_0x540299['query']['sort']);_0x3e2f07[_0x1dbd('0x3d')]=qs[_0x1dbd('0x35')](_[_0x1dbd('0x3e')](_0x540299[_0x1dbd('0x33')],_0x47dc61[_0x1dbd('0x35')]),_0x4910c6);if(_0x540299['query']['filter']){_0x3e2f07[_0x1dbd('0x3d')]=_['merge'](_0x3e2f07[_0x1dbd('0x3d')],{'$or':_[_0x1dbd('0x3f')](_0x4910c6,function(_0x17870b){if(_0x17870b['type']!=='VIRTUAL'){var _0xc0f2d7={};_0xc0f2d7[_0x17870b[_0x1dbd('0x2b')]]={'$like':'%'+_0x540299[_0x1dbd('0x33')][_0x1dbd('0x40')]+'%'};return _0xc0f2d7;}})});}_0x3e2f07=_['merge']({},_0x3e2f07,_0x540299[_0x1dbd('0x41')]);var _0x4b4a9c={'where':_0x3e2f07[_0x1dbd('0x3d')]};return db[_0x1dbd('0x2e')][_0x1dbd('0x20')](_0x4b4a9c)[_0x1dbd('0x27')](function(_0x4d82e3){_0x398be3['count']=_0x4d82e3;if(_0x540299[_0x1dbd('0x33')][_0x1dbd('0x42')]){_0x3e2f07[_0x1dbd('0x43')]=[{'all':!![]}];}return db[_0x1dbd('0x2e')][_0x1dbd('0x44')](_0x3e2f07);})['then'](function(_0x2ca3c8){_0x398be3[_0x1dbd('0x45')]=_0x2ca3c8;return _0x398be3;})[_0x1dbd('0x27')](respondWithFilteredResult(_0x4fcbfd,_0x3e2f07))[_0x1dbd('0x46')](handleError(_0x4fcbfd,null));};exports[_0x1dbd('0x47')]=function(_0x2ab1e1,_0x530a9b){var _0x1b89ba={'raw':![],'where':{'id':_0x2ab1e1['params']['id']}},_0x32498d={};_0x32498d[_0x1dbd('0x37')]=_['keys'](db['ZendeskConfiguration'][_0x1dbd('0x2f')]);_0x32498d['query']=_[_0x1dbd('0x34')](_0x2ab1e1[_0x1dbd('0x33')]);_0x32498d[_0x1dbd('0x35')]=_[_0x1dbd('0x36')](_0x32498d[_0x1dbd('0x37')],_0x32498d[_0x1dbd('0x33')]);_0x1b89ba[_0x1dbd('0x38')]=_[_0x1dbd('0x36')](_0x32498d[_0x1dbd('0x37')],qs[_0x1dbd('0x39')](_0x2ab1e1[_0x1dbd('0x33')][_0x1dbd('0x39')]));_0x1b89ba[_0x1dbd('0x38')]=_0x1b89ba['attributes'][_0x1dbd('0x48')]?_0x1b89ba[_0x1dbd('0x38')]:_0x32498d[_0x1dbd('0x37')];if(_0x2ab1e1[_0x1dbd('0x33')]['includeAll']){_0x1b89ba[_0x1dbd('0x43')]=[{'all':!![]}];}_0x1b89ba=_[_0x1dbd('0x49')]({},_0x1b89ba,_0x2ab1e1[_0x1dbd('0x41')]);return db[_0x1dbd('0x2e')][_0x1dbd('0x4a')](_0x1b89ba)[_0x1dbd('0x27')](handleEntityNotFound(_0x530a9b,null))[_0x1dbd('0x27')](respondWithResult(_0x530a9b,null))['catch'](handleError(_0x530a9b,null));};exports[_0x1dbd('0x4b')]=function(_0x9c581d,_0x277104){return db[_0x1dbd('0x2e')][_0x1dbd('0x4b')](_0x9c581d[_0x1dbd('0x4c')],{})['then'](respondWithResult(_0x277104,0xc9))[_0x1dbd('0x46')](handleError(_0x277104,null));};exports[_0x1dbd('0x26')]=function(_0x18ef48,_0x26ad09){if(_0x18ef48[_0x1dbd('0x4c')]['id']){delete _0x18ef48[_0x1dbd('0x4c')]['id'];}return db[_0x1dbd('0x2e')][_0x1dbd('0x4a')]({'where':{'id':_0x18ef48[_0x1dbd('0x4d')]['id']}})[_0x1dbd('0x27')](handleEntityNotFound(_0x26ad09,null))['then'](saveUpdates(_0x18ef48[_0x1dbd('0x4c')],null))['then'](respondWithResult(_0x26ad09,null))[_0x1dbd('0x46')](handleError(_0x26ad09,null));};exports[_0x1dbd('0x4e')]=function(_0x53d1c8,_0x20d5aa){return db[_0x1dbd('0x2e')][_0x1dbd('0x4a')]({'where':{'id':_0x53d1c8[_0x1dbd('0x4d')]['id']}})[_0x1dbd('0x27')](handleEntityNotFound(_0x20d5aa,null))[_0x1dbd('0x27')](removeEntity(_0x20d5aa,null))[_0x1dbd('0x46')](handleError(_0x20d5aa,null));};exports[_0x1dbd('0x4f')]=function(_0x1c47b9,_0x1ece23,_0x4b4bc6){var _0x5896d4={};var _0x4387de={};var _0x463011;var _0x30903d;return db[_0x1dbd('0x2e')]['findOne']({'where':{'id':_0x1c47b9[_0x1dbd('0x4d')]['id']}})[_0x1dbd('0x27')](handleEntityNotFound(_0x1ece23,null))['then'](function(_0x538103){if(_0x538103){_0x463011=_0x538103;_0x4387de[_0x1dbd('0x37')]=_['keys'](db['ZendeskField'][_0x1dbd('0x2f')]);_0x4387de['query']=_[_0x1dbd('0x34')](_0x1c47b9[_0x1dbd('0x33')]);_0x4387de['filters']=_['intersection'](_0x4387de[_0x1dbd('0x37')],_0x4387de[_0x1dbd('0x33')]);_0x5896d4[_0x1dbd('0x38')]=_[_0x1dbd('0x36')](_0x4387de[_0x1dbd('0x37')],qs[_0x1dbd('0x39')](_0x1c47b9['query'][_0x1dbd('0x39')]));_0x5896d4['attributes']=_0x5896d4[_0x1dbd('0x38')][_0x1dbd('0x48')]?_0x5896d4[_0x1dbd('0x38')]:_0x4387de[_0x1dbd('0x37')];_0x5896d4['order']=qs['sort'](_0x1c47b9[_0x1dbd('0x33')][_0x1dbd('0x50')]);_0x5896d4[_0x1dbd('0x3d')]=qs[_0x1dbd('0x35')](_[_0x1dbd('0x3e')](_0x1c47b9[_0x1dbd('0x33')],_0x4387de[_0x1dbd('0x35')]));if(_0x1c47b9[_0x1dbd('0x33')][_0x1dbd('0x40')]){_0x5896d4[_0x1dbd('0x3d')]=_[_0x1dbd('0x49')](_0x5896d4[_0x1dbd('0x3d')],{'$or':_[_0x1dbd('0x3f')](_0x5896d4[_0x1dbd('0x38')],function(_0x1fac49){var _0x41e56a={};_0x41e56a[_0x1fac49]={'$like':'%'+_0x1c47b9[_0x1dbd('0x33')][_0x1dbd('0x40')]+'%'};return _0x41e56a;})});}_0x5896d4=_[_0x1dbd('0x49')]({},_0x5896d4,_0x1c47b9['options']);return _0x463011[_0x1dbd('0x4f')](_0x5896d4);}})['then'](function(_0x506e9f){if(_0x506e9f){_0x30903d=_0x506e9f['length'];if(!_0x1c47b9[_0x1dbd('0x33')][_0x1dbd('0x3a')](_0x1dbd('0x3b'))){_0x5896d4[_0x1dbd('0x1d')]=qs[_0x1dbd('0x1d')](_0x1c47b9[_0x1dbd('0x33')][_0x1dbd('0x1d')]);_0x5896d4[_0x1dbd('0x1f')]=qs[_0x1dbd('0x1f')](_0x1c47b9['query']['offset']);}return _0x463011[_0x1dbd('0x4f')](_0x5896d4);}})[_0x1dbd('0x27')](function(_0x37f489){if(_0x37f489){return _0x37f489?{'count':_0x30903d,'rows':_0x37f489}:null;}})[_0x1dbd('0x27')](respondWithResult(_0x1ece23,null))[_0x1dbd('0x46')](handleError(_0x1ece23,null));};exports[_0x1dbd('0x51')]=function(_0x5729ac,_0x434972,_0x7d43f4){var _0x14715b={};var _0x1b59f0={};var _0x2a022a;var _0x45336a;return db[_0x1dbd('0x2e')]['findOne']({'where':{'id':_0x5729ac[_0x1dbd('0x4d')]['id']}})[_0x1dbd('0x27')](handleEntityNotFound(_0x434972,null))[_0x1dbd('0x27')](function(_0x3590e1){if(_0x3590e1){_0x2a022a=_0x3590e1;_0x1b59f0[_0x1dbd('0x37')]=_[_0x1dbd('0x34')](db['ZendeskField'][_0x1dbd('0x2f')]);_0x1b59f0[_0x1dbd('0x33')]=_[_0x1dbd('0x34')](_0x5729ac['query']);_0x1b59f0[_0x1dbd('0x35')]=_['intersection'](_0x1b59f0[_0x1dbd('0x37')],_0x1b59f0[_0x1dbd('0x33')]);_0x14715b[_0x1dbd('0x38')]=_[_0x1dbd('0x36')](_0x1b59f0[_0x1dbd('0x37')],qs['fields'](_0x5729ac[_0x1dbd('0x33')][_0x1dbd('0x39')]));_0x14715b['attributes']=_0x14715b['attributes']['length']?_0x14715b['attributes']:_0x1b59f0[_0x1dbd('0x37')];_0x14715b[_0x1dbd('0x3c')]=qs[_0x1dbd('0x50')](_0x5729ac[_0x1dbd('0x33')][_0x1dbd('0x50')]);_0x14715b[_0x1dbd('0x3d')]=qs['filters'](_[_0x1dbd('0x3e')](_0x5729ac[_0x1dbd('0x33')],_0x1b59f0[_0x1dbd('0x35')]));if(_0x5729ac['query'][_0x1dbd('0x40')]){_0x14715b['where']=_[_0x1dbd('0x49')](_0x14715b['where'],{'$or':_[_0x1dbd('0x3f')](_0x14715b[_0x1dbd('0x38')],function(_0x53a9e0){var _0xa5b72e={};_0xa5b72e[_0x53a9e0]={'$like':'%'+_0x5729ac[_0x1dbd('0x33')][_0x1dbd('0x40')]+'%'};return _0xa5b72e;})});}_0x14715b=_['merge']({},_0x14715b,_0x5729ac[_0x1dbd('0x41')]);return _0x2a022a[_0x1dbd('0x51')](_0x14715b);}})[_0x1dbd('0x27')](function(_0x408a35){if(_0x408a35){_0x45336a=_0x408a35[_0x1dbd('0x48')];if(!_0x5729ac[_0x1dbd('0x33')]['hasOwnProperty'](_0x1dbd('0x3b'))){_0x14715b[_0x1dbd('0x1d')]=qs[_0x1dbd('0x1d')](_0x5729ac[_0x1dbd('0x33')][_0x1dbd('0x1d')]);_0x14715b['offset']=qs[_0x1dbd('0x1f')](_0x5729ac['query'][_0x1dbd('0x1f')]);}return _0x2a022a[_0x1dbd('0x51')](_0x14715b);}})['then'](function(_0x84af42){if(_0x84af42){return _0x84af42?{'count':_0x45336a,'rows':_0x84af42}:null;}})[_0x1dbd('0x27')](respondWithResult(_0x434972,null))[_0x1dbd('0x46')](handleError(_0x434972,null));};exports[_0x1dbd('0x52')]=function(_0x37187a,_0x2bfd5a,_0x1ff6fc){var _0x2e529e={};var _0x2a324f={};var _0x339b8a;var _0xa9e250;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x37187a[_0x1dbd('0x4d')]['id']}})[_0x1dbd('0x27')](handleEntityNotFound(_0x2bfd5a,null))[_0x1dbd('0x27')](function(_0xd83a7e){if(_0xd83a7e){_0x339b8a=_0xd83a7e;_0x2a324f[_0x1dbd('0x37')]=_[_0x1dbd('0x34')](db[_0x1dbd('0x53')][_0x1dbd('0x2f')]);_0x2a324f['query']=_[_0x1dbd('0x34')](_0x37187a['query']);_0x2a324f[_0x1dbd('0x35')]=_[_0x1dbd('0x36')](_0x2a324f[_0x1dbd('0x37')],_0x2a324f[_0x1dbd('0x33')]);_0x2e529e[_0x1dbd('0x38')]=_[_0x1dbd('0x36')](_0x2a324f[_0x1dbd('0x37')],qs['fields'](_0x37187a[_0x1dbd('0x33')][_0x1dbd('0x39')]));_0x2e529e['attributes']=_0x2e529e['attributes'][_0x1dbd('0x48')]?_0x2e529e[_0x1dbd('0x38')]:_0x2a324f[_0x1dbd('0x37')];_0x2e529e[_0x1dbd('0x3c')]=qs[_0x1dbd('0x50')](_0x37187a[_0x1dbd('0x33')]['sort']);_0x2e529e[_0x1dbd('0x3d')]=qs[_0x1dbd('0x35')](_[_0x1dbd('0x3e')](_0x37187a[_0x1dbd('0x33')],_0x2a324f[_0x1dbd('0x35')]));if(_0x37187a[_0x1dbd('0x33')][_0x1dbd('0x40')]){_0x2e529e[_0x1dbd('0x3d')]=_[_0x1dbd('0x49')](_0x2e529e[_0x1dbd('0x3d')],{'$or':_['map'](_0x2e529e[_0x1dbd('0x38')],function(_0x67a641){var _0x993613={};_0x993613[_0x67a641]={'$like':'%'+_0x37187a[_0x1dbd('0x33')][_0x1dbd('0x40')]+'%'};return _0x993613;})});}_0x2e529e=_[_0x1dbd('0x49')]({},_0x2e529e,_0x37187a[_0x1dbd('0x41')]);return _0x339b8a[_0x1dbd('0x52')](_0x2e529e);}})['then'](function(_0x49ce62){if(_0x49ce62){_0xa9e250=_0x49ce62[_0x1dbd('0x48')];if(!_0x37187a['query'][_0x1dbd('0x3a')]('nolimit')){_0x2e529e[_0x1dbd('0x1d')]=qs[_0x1dbd('0x1d')](_0x37187a[_0x1dbd('0x33')]['limit']);_0x2e529e['offset']=qs[_0x1dbd('0x1f')](_0x37187a['query'][_0x1dbd('0x1f')]);}return _0x339b8a[_0x1dbd('0x52')](_0x2e529e);}})['then'](function(_0x2488c6){if(_0x2488c6){return _0x2488c6?{'count':_0xa9e250,'rows':_0x2488c6}:null;}})[_0x1dbd('0x27')](respondWithResult(_0x2bfd5a,null))[_0x1dbd('0x46')](handleError(_0x2bfd5a,null));};exports[_0x1dbd('0x54')]=function(_0x586ff5,_0x5cae70,_0x2d06a3){var _0xbefd52={};var _0x9f868a={};var _0x1e8975;var _0x23c5d0;return db[_0x1dbd('0x2e')][_0x1dbd('0x55')]({'where':{'id':_0x586ff5[_0x1dbd('0x4d')]['id']}})[_0x1dbd('0x27')](handleEntityNotFound(_0x5cae70,null))['then'](function(_0x2b3832){if(_0x2b3832){_0x1e8975=_0x2b3832;_0x9f868a['model']=_[_0x1dbd('0x34')](db[_0x1dbd('0x56')][_0x1dbd('0x2f')]);_0x9f868a[_0x1dbd('0x33')]=_[_0x1dbd('0x34')](_0x586ff5[_0x1dbd('0x33')]);_0x9f868a[_0x1dbd('0x35')]=_['intersection'](_0x9f868a[_0x1dbd('0x37')],_0x9f868a['query']);_0xbefd52['attributes']=_[_0x1dbd('0x36')](_0x9f868a[_0x1dbd('0x37')],qs[_0x1dbd('0x39')](_0x586ff5[_0x1dbd('0x33')][_0x1dbd('0x39')]));_0xbefd52[_0x1dbd('0x38')]=_0xbefd52['attributes'][_0x1dbd('0x48')]?_0xbefd52[_0x1dbd('0x38')]:_0x9f868a['model'];_0xbefd52[_0x1dbd('0x3c')]=qs[_0x1dbd('0x50')](_0x586ff5[_0x1dbd('0x33')][_0x1dbd('0x50')]);_0xbefd52[_0x1dbd('0x3d')]=qs['filters'](_[_0x1dbd('0x3e')](_0x586ff5[_0x1dbd('0x33')],_0x9f868a[_0x1dbd('0x35')]));if(_0x586ff5['query']['filter']){_0xbefd52['where']=_[_0x1dbd('0x49')](_0xbefd52['where'],{'$or':_[_0x1dbd('0x3f')](_0xbefd52[_0x1dbd('0x38')],function(_0x974450){var _0x991213={};_0x991213[_0x974450]={'$like':'%'+_0x586ff5[_0x1dbd('0x33')]['filter']+'%'};return _0x991213;})});}_0xbefd52=_[_0x1dbd('0x49')]({},_0xbefd52,_0x586ff5[_0x1dbd('0x41')]);return _0x1e8975['getTags'](_0xbefd52);}})['then'](function(_0x3392a0){if(_0x3392a0){_0x23c5d0=_0x3392a0[_0x1dbd('0x48')];if(!_0x586ff5['query'][_0x1dbd('0x3a')]('nolimit')){_0xbefd52[_0x1dbd('0x1d')]=qs[_0x1dbd('0x1d')](_0x586ff5['query']['limit']);_0xbefd52['offset']=qs[_0x1dbd('0x1f')](_0x586ff5[_0x1dbd('0x33')]['offset']);}return _0x1e8975[_0x1dbd('0x54')](_0xbefd52);}})['then'](function(_0x22ecff){if(_0x22ecff){return _0x22ecff?{'count':_0x23c5d0,'rows':_0x22ecff}:null;}})[_0x1dbd('0x27')](respondWithResult(_0x5cae70,null))[_0x1dbd('0x46')](handleError(_0x5cae70,null));};exports['setTags']=function(_0x30a005,_0x32dc0b,_0x279f3f){if(_0x30a005[_0x1dbd('0x4c')]['id']){delete _0x30a005['body']['id'];}return db[_0x1dbd('0x2e')][_0x1dbd('0x55')]({'where':{'id':_0x30a005[_0x1dbd('0x4d')]['id']}})[_0x1dbd('0x27')](handleEntityNotFound(_0x32dc0b,null))['then'](function(_0x353e76){if(_0x353e76){return _0x353e76['setTags'](_0x30a005[_0x1dbd('0x4c')][_0x1dbd('0x57')]||[]);}return null;})[_0x1dbd('0x27')](respondWithResult(_0x32dc0b,null))[_0x1dbd('0x46')](handleError(_0x32dc0b,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index aa863dd..7abb63e 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 _0x3f8c=['exports','define','ZendeskConfiguration','int_zendesk_configurations','../../config/logger','api','moment','bluebird'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x3f8c,0x104));var _0xc3f8=function(_0x253944,_0x1e5a01){_0x253944=_0x253944-0x0;var _0xb8a410=_0x3f8c[_0x253944];return _0xb8a410;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc3f8('0x0'))(_0xc3f8('0x1'));var moment=require(_0xc3f8('0x2'));var BPromise=require(_0xc3f8('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('./intZendeskConfiguration.attributes');module[_0xc3f8('0x4')]=function(_0x1a6976,_0x3a4e2f){return _0x1a6976[_0xc3f8('0x5')](_0xc3f8('0x6'),attributes,{'tableName':_0xc3f8('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4fc2=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intZendeskConfiguration.attributes','ZendeskConfiguration','int_zendesk_configurations','lodash','util'];(function(_0xd2e2ab,_0x2440cf){var _0x1703a2=function(_0x23deba){while(--_0x23deba){_0xd2e2ab['push'](_0xd2e2ab['shift']());}};_0x1703a2(++_0x2440cf);}(_0x4fc2,0x111));var _0x24fc=function(_0x5b50ae,_0x7da7e1){_0x5b50ae=_0x5b50ae-0x0;var _0x84eb56=_0x4fc2[_0x5b50ae];return _0x84eb56;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var logger=require(_0x24fc('0x2'))(_0x24fc('0x3'));var moment=require('moment');var BPromise=require(_0x24fc('0x4'));var rp=require(_0x24fc('0x5'));var fs=require('fs');var path=require(_0x24fc('0x6'));var rimraf=require('rimraf');var config=require(_0x24fc('0x7'));var attributes=require(_0x24fc('0x8'));module['exports']=function(_0x26fcc6,_0x12d602){return _0x26fcc6['define'](_0x24fc('0x9'),attributes,{'tableName':_0x24fc('0xa'),'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 e89fd5d..99da466 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 _0xec04=['ZendeskConfiguration,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4f042f,_0x4e834a){var _0x5e9a2c=function(_0x528143){while(--_0x528143){_0x4f042f['push'](_0x4f042f['shift']());}};_0x5e9a2c(++_0x4e834a);}(_0xec04,0x173));var _0x4ec0=function(_0x2cd5d7,_0xad51b){_0x2cd5d7=_0x2cd5d7-0x0;var _0x2920a9=_0xec04[_0x2cd5d7];return _0x2920a9;};'use strict';var _=require(_0x4ec0('0x0'));var util=require(_0x4ec0('0x1'));var moment=require(_0x4ec0('0x2'));var BPromise=require(_0x4ec0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ec0('0x4'))['db'];var utils=require(_0x4ec0('0x5'));var logger=require(_0x4ec0('0x6'))(_0x4ec0('0x7'));var config=require(_0x4ec0('0x8'));var jayson=require(_0x4ec0('0x9'));var client=jayson[_0x4ec0('0xa')][_0x4ec0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54ccf7,_0x3032e7,_0x554a38){return new BPromise(function(_0x4d2de5,_0x10b5a9){return client[_0x4ec0('0xc')](_0x54ccf7,_0x554a38)[_0x4ec0('0xd')](function(_0x57f149){logger[_0x4ec0('0xe')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3032e7,_0x4ec0('0xf'));logger['debug'](_0x4ec0('0x10'),_0x3032e7,_0x4ec0('0xf'),JSON[_0x4ec0('0x11')](_0x57f149));if(_0x57f149[_0x4ec0('0x12')]){if(_0x57f149[_0x4ec0('0x12')][_0x4ec0('0x13')]===0x1f4){logger['error'](_0x4ec0('0x14'),_0x3032e7,_0x57f149['error'][_0x4ec0('0x15')]);return _0x10b5a9(_0x57f149[_0x4ec0('0x12')][_0x4ec0('0x15')]);}logger[_0x4ec0('0x12')](_0x4ec0('0x14'),_0x3032e7,_0x57f149[_0x4ec0('0x12')]['message']);return _0x4d2de5(_0x57f149[_0x4ec0('0x12')][_0x4ec0('0x15')]);}else{logger['info'](_0x4ec0('0x14'),_0x3032e7,_0x4ec0('0xf'));_0x4d2de5(_0x57f149['result'][_0x4ec0('0x15')]);}})[_0x4ec0('0x16')](function(_0x3d3d26){logger['error'](_0x4ec0('0x14'),_0x3032e7,_0x3d3d26);_0x10b5a9(_0x3d3d26);});});} \ No newline at end of file +var _0xc099=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','util','ioredis','../../config/utils','../../config/logger'];(function(_0x298510,_0x122dcc){var _0xaf1de9=function(_0x3cced9){while(--_0x3cced9){_0x298510['push'](_0x298510['shift']());}};_0xaf1de9(++_0x122dcc);}(_0xc099,0x18c));var _0x9c09=function(_0x1c8d31,_0x53a36d){_0x1c8d31=_0x1c8d31-0x0;var _0x3cf0f7=_0xc099[_0x1c8d31];return _0x3cf0f7;};'use strict';var _=require('lodash');var util=require(_0x9c09('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9c09('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x9c09('0x2'));var logger=require(_0x9c09('0x3'))(_0x9c09('0x4'));var config=require(_0x9c09('0x5'));var jayson=require(_0x9c09('0x6'));var client=jayson[_0x9c09('0x7')][_0x9c09('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3e5d1b,_0x445e24,_0x34bf09){return new BPromise(function(_0x511df0,_0x244518){return client[_0x9c09('0x9')](_0x3e5d1b,_0x34bf09)[_0x9c09('0xa')](function(_0x5cf60a){logger[_0x9c09('0xb')](_0x9c09('0xc'),_0x445e24,'request\x20sent');logger[_0x9c09('0xd')](_0x9c09('0xe'),_0x445e24,_0x9c09('0xf'),JSON['stringify'](_0x5cf60a));if(_0x5cf60a[_0x9c09('0x10')]){if(_0x5cf60a[_0x9c09('0x10')][_0x9c09('0x11')]===0x1f4){logger[_0x9c09('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x445e24,_0x5cf60a[_0x9c09('0x10')][_0x9c09('0x12')]);return _0x244518(_0x5cf60a[_0x9c09('0x10')][_0x9c09('0x12')]);}logger[_0x9c09('0x10')](_0x9c09('0xc'),_0x445e24,_0x5cf60a[_0x9c09('0x10')][_0x9c09('0x12')]);return _0x511df0(_0x5cf60a['error'][_0x9c09('0x12')]);}else{logger[_0x9c09('0xb')]('ZendeskConfiguration,\x20%s,\x20%s',_0x445e24,_0x9c09('0xf'));_0x511df0(_0x5cf60a['result'][_0x9c09('0x12')]);}})[_0x9c09('0x13')](function(_0x103100){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x445e24,_0x103100);_0x244518(_0x103100);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 5744c84..3a24170 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 _0xd70a=['../../components/interaction/service','../../config/environment','./intZendeskField.controller','index','get','/:id','isAuthenticated','show','post','create','put','update','destroy','util','connect-timeout','express','../../components/auth/service'];(function(_0x21862c,_0x51448b){var _0x167927=function(_0x5de9f3){while(--_0x5de9f3){_0x21862c['push'](_0x21862c['shift']());}};_0x167927(++_0x51448b);}(_0xd70a,0x84));var _0xad70=function(_0xb833b1,_0x1c3d3f){_0xb833b1=_0xb833b1-0x0;var _0x1ab87a=_0xd70a[_0xb833b1];return _0x1ab87a;};'use strict';var multer=require('multer');var util=require(_0xad70('0x0'));var path=require('path');var timeout=require(_0xad70('0x1'));var express=require(_0xad70('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xad70('0x3'));var interaction=require(_0xad70('0x4'));var config=require(_0xad70('0x5'));var controller=require(_0xad70('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xad70('0x7')]);router[_0xad70('0x8')](_0xad70('0x9'),auth[_0xad70('0xa')](),controller[_0xad70('0xb')]);router[_0xad70('0xc')]('/',auth[_0xad70('0xa')](),controller[_0xad70('0xd')]);router[_0xad70('0xe')](_0xad70('0x9'),auth[_0xad70('0xa')](),controller[_0xad70('0xf')]);router['delete'](_0xad70('0x9'),auth['isAuthenticated'](),controller[_0xad70('0x10')]);module['exports']=router; \ No newline at end of file +var _0x2855=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','post','create','delete','multer','util','connect-timeout','Router'];(function(_0x53e699,_0xca858d){var _0x16e570=function(_0x2163a1){while(--_0x2163a1){_0x53e699['push'](_0x53e699['shift']());}};_0x16e570(++_0xca858d);}(_0x2855,0x95));var _0x5285=function(_0x4d1ee9,_0x394a78){_0x4d1ee9=_0x4d1ee9-0x0;var _0x9a5456=_0x2855[_0x4d1ee9];return _0x9a5456;};'use strict';var multer=require(_0x5285('0x0'));var util=require(_0x5285('0x1'));var path=require('path');var timeout=require(_0x5285('0x2'));var express=require('express');var router=express[_0x5285('0x3')]();var fs_extra=require(_0x5285('0x4'));var auth=require(_0x5285('0x5'));var interaction=require(_0x5285('0x6'));var config=require(_0x5285('0x7'));var controller=require(_0x5285('0x8'));router[_0x5285('0x9')]('/',auth[_0x5285('0xa')](),controller[_0x5285('0xb')]);router[_0x5285('0x9')](_0x5285('0xc'),auth[_0x5285('0xa')](),controller[_0x5285('0xd')]);router[_0x5285('0xe')]('/',auth[_0x5285('0xa')](),controller[_0x5285('0xf')]);router['put'](_0x5285('0xc'),auth[_0x5285('0xa')](),controller['update']);router[_0x5285('0x10')]('/:id',auth[_0x5285('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 0374a46..0eee9cd 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 _0xbd1b=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','sequelize'];(function(_0x297a0f,_0x16e66a){var _0x2e0a40=function(_0x44fb83){while(--_0x44fb83){_0x297a0f['push'](_0x297a0f['shift']());}};_0x2e0a40(++_0x16e66a);}(_0xbd1b,0x155));var _0xbbd1=function(_0x38bf14,_0x1c3ab4){_0x38bf14=_0x38bf14-0x0;var _0x57cee3=_0xbd1b[_0x38bf14];return _0x57cee3;};'use strict';var Sequelize=require(_0xbbd1('0x0'));module[_0xbbd1('0x1')]={'type':{'type':Sequelize[_0xbbd1('0x2')](_0xbbd1('0x3'),_0xbbd1('0x4'),_0xbbd1('0x5'),_0xbbd1('0x6'),_0xbbd1('0x7')),'defaultValue':_0xbbd1('0x3')},'content':{'type':Sequelize[_0xbbd1('0x8')]},'key':{'type':Sequelize[_0xbbd1('0x8')]},'keyType':{'type':Sequelize['ENUM']('string',_0xbbd1('0x4'),_0xbbd1('0x5'))},'keyContent':{'type':Sequelize[_0xbbd1('0x8')]},'idField':{'type':Sequelize[_0xbbd1('0x8')]},'nameField':{'type':Sequelize[_0xbbd1('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb618=['ENUM','customVariable','keyValue','STRING','string','BOOLEAN','sequelize'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0xb618,0x180));var _0x8b61=function(_0x608e20,_0x2c546d){_0x608e20=_0x608e20-0x0;var _0x5f498a=_0xb618[_0x608e20];return _0x5f498a;};'use strict';var Sequelize=require(_0x8b61('0x0'));module['exports']={'type':{'type':Sequelize[_0x8b61('0x1')]('string','variable',_0x8b61('0x2'),_0x8b61('0x3'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x8b61('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x8b61('0x5'),'variable',_0x8b61('0x2'))},'keyContent':{'type':Sequelize[_0x8b61('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x8b61('0x4')]},'customField':{'type':Sequelize[_0x8b61('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8b61('0x4')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 3e01181..df0ecb5 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 _0x53cb=['show','attributes','find','create','body','update','params','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','fs-extra','lodash','to-csv','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','send','index','ZendeskField','rawAttributes','fieldName','type','key','map','name','query','keys','filters','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch'];(function(_0x3513b9,_0x1e9a94){var _0x591784=function(_0x402c69){while(--_0x402c69){_0x3513b9['push'](_0x3513b9['shift']());}};_0x591784(++_0x1e9a94);}(_0x53cb,0x93));var _0xb53c=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x53cb[_0x4d613c];return _0x301fe3;};'use strict';var emlformat=require(_0xb53c('0x0'));var rimraf=require(_0xb53c('0x1'));var zipdir=require(_0xb53c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb53c('0x3'));var moment=require(_0xb53c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb53c('0x5'));var util=require(_0xb53c('0x6'));var path=require(_0xb53c('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb53c('0x8'));var _=require(_0xb53c('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb53c('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb53c('0xb'));var authService=require('../../components/auth/service');var qs=require(_0xb53c('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb53c('0xd'));var logger=require(_0xb53c('0xe'))(_0xb53c('0xf'));var utils=require(_0xb53c('0x10'));var config=require(_0xb53c('0x11'));var licenseUtil=require(_0xb53c('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ca0a0,_0x419b17){_0x419b17=_0x419b17||0xcc;return function(_0x2524a1){if(_0x2524a1){return _0x5ca0a0['sendStatus'](_0x419b17);}return _0x5ca0a0[_0xb53c('0x13')](_0x419b17)[_0xb53c('0x14')]();};}function respondWithResult(_0x56d3f1,_0x13973f){_0x13973f=_0x13973f||0xc8;return function(_0x1f5aa4){if(_0x1f5aa4){return _0x56d3f1[_0xb53c('0x13')](_0x13973f)[_0xb53c('0x15')](_0x1f5aa4);}};}function respondWithFilteredResult(_0x4c3714,_0xaf4f6f){return function(_0x2dba5a){if(_0x2dba5a){var _0x5e004d=typeof _0xaf4f6f[_0xb53c('0x16')]==='undefined'&&typeof _0xaf4f6f[_0xb53c('0x17')]===_0xb53c('0x18');var _0x3152e2=_0x2dba5a['count'];var _0x34d225=_0x5e004d?0x0:_0xaf4f6f[_0xb53c('0x16')];var _0x4f7796=_0x5e004d?_0x2dba5a[_0xb53c('0x19')]:_0xaf4f6f[_0xb53c('0x16')]+_0xaf4f6f['limit'];var _0x59380e;if(_0x4f7796>=_0x3152e2){_0x4f7796=_0x3152e2;_0x59380e=0xc8;}else{_0x59380e=0xce;}_0x4c3714[_0xb53c('0x13')](_0x59380e);return _0x4c3714[_0xb53c('0x1a')](_0xb53c('0x1b'),_0x34d225+'-'+_0x4f7796+'/'+_0x3152e2)[_0xb53c('0x15')](_0x2dba5a);}return null;};}function patchUpdates(_0x4e8714){return function(_0xcab6b9){try{jsonpatch[_0xb53c('0x1c')](_0xcab6b9,_0x4e8714,!![]);}catch(_0x4fd9d3){return BPromise[_0xb53c('0x1d')](_0x4fd9d3);}return _0xcab6b9[_0xb53c('0x1e')]();};}function saveUpdates(_0x2068bd,_0x4dbfdc){return function(_0x5eb866){if(_0x5eb866){return _0x5eb866['update'](_0x2068bd)[_0xb53c('0x1f')](function(_0x3aa9b2){return _0x3aa9b2;});}return null;};}function removeEntity(_0x113fcb,_0x2ce152){return function(_0x117e1f){if(_0x117e1f){return _0x117e1f[_0xb53c('0x20')]()[_0xb53c('0x1f')](function(){_0x113fcb[_0xb53c('0x13')](0xcc)[_0xb53c('0x14')]();});}};}function handleEntityNotFound(_0x2bdd5b,_0x511388){return function(_0x243ec7){if(!_0x243ec7){_0x2bdd5b[_0xb53c('0x21')](0x194);}return _0x243ec7;};}function handleError(_0x2e5dfc,_0x33f6fb){_0x33f6fb=_0x33f6fb||0x1f4;return function(_0x4d9fe7){logger['error'](_0x4d9fe7['stack']);if(_0x4d9fe7['name']){delete _0x4d9fe7['name'];}_0x2e5dfc[_0xb53c('0x13')](_0x33f6fb)[_0xb53c('0x22')](_0x4d9fe7);};}exports[_0xb53c('0x23')]=function(_0x18cba6,_0x144c60){var _0x21a6b7={},_0x1d5a65={},_0x47607d={'count':0x0,'rows':[]};var _0x44cf97=_['map'](db[_0xb53c('0x24')][_0xb53c('0x25')],function(_0xbad63a){return{'name':_0xbad63a[_0xb53c('0x26')],'type':_0xbad63a[_0xb53c('0x27')][_0xb53c('0x28')]};});_0x1d5a65['model']=_[_0xb53c('0x29')](_0x44cf97,_0xb53c('0x2a'));_0x1d5a65[_0xb53c('0x2b')]=_[_0xb53c('0x2c')](_0x18cba6[_0xb53c('0x2b')]);_0x1d5a65[_0xb53c('0x2d')]=_[_0xb53c('0x2e')](_0x1d5a65[_0xb53c('0x2f')],_0x1d5a65[_0xb53c('0x2b')]);_0x21a6b7['attributes']=_[_0xb53c('0x2e')](_0x1d5a65[_0xb53c('0x2f')],qs['fields'](_0x18cba6[_0xb53c('0x2b')][_0xb53c('0x30')]));_0x21a6b7['attributes']=_0x21a6b7['attributes'][_0xb53c('0x31')]?_0x21a6b7['attributes']:_0x1d5a65[_0xb53c('0x2f')];if(!_0x18cba6['query'][_0xb53c('0x32')](_0xb53c('0x33'))){_0x21a6b7[_0xb53c('0x17')]=qs['limit'](_0x18cba6[_0xb53c('0x2b')][_0xb53c('0x17')]);_0x21a6b7[_0xb53c('0x16')]=qs[_0xb53c('0x16')](_0x18cba6[_0xb53c('0x2b')][_0xb53c('0x16')]);}_0x21a6b7[_0xb53c('0x34')]=qs[_0xb53c('0x35')](_0x18cba6['query'][_0xb53c('0x35')]);_0x21a6b7[_0xb53c('0x36')]=qs['filters'](_[_0xb53c('0x37')](_0x18cba6[_0xb53c('0x2b')],_0x1d5a65[_0xb53c('0x2d')]),_0x44cf97);if(_0x18cba6[_0xb53c('0x2b')][_0xb53c('0x38')]){_0x21a6b7[_0xb53c('0x36')]=_['merge'](_0x21a6b7[_0xb53c('0x36')],{'$or':_[_0xb53c('0x29')](_0x44cf97,function(_0x3558f9){if(_0x3558f9[_0xb53c('0x27')]!=='VIRTUAL'){var _0x5110b1={};_0x5110b1[_0x3558f9[_0xb53c('0x2a')]]={'$like':'%'+_0x18cba6['query'][_0xb53c('0x38')]+'%'};return _0x5110b1;}})});}_0x21a6b7=_[_0xb53c('0x39')]({},_0x21a6b7,_0x18cba6[_0xb53c('0x3a')]);var _0x5690ae={'where':_0x21a6b7[_0xb53c('0x36')]};return db[_0xb53c('0x24')][_0xb53c('0x19')](_0x5690ae)['then'](function(_0x4c897e){_0x47607d[_0xb53c('0x19')]=_0x4c897e;if(_0x18cba6[_0xb53c('0x2b')][_0xb53c('0x3b')]){_0x21a6b7['include']=[{'all':!![]}];}return db[_0xb53c('0x24')][_0xb53c('0x3c')](_0x21a6b7);})[_0xb53c('0x1f')](function(_0x3a7ea1){_0x47607d[_0xb53c('0x3d')]=_0x3a7ea1;return _0x47607d;})[_0xb53c('0x1f')](respondWithFilteredResult(_0x144c60,_0x21a6b7))[_0xb53c('0x3e')](handleError(_0x144c60,null));};exports[_0xb53c('0x3f')]=function(_0x2accaf,_0x3ee061){var _0x164ae2={'raw':!![],'where':{'id':_0x2accaf['params']['id']}},_0x570a41={};_0x570a41[_0xb53c('0x2f')]=_[_0xb53c('0x2c')](db[_0xb53c('0x24')][_0xb53c('0x25')]);_0x570a41[_0xb53c('0x2b')]=_[_0xb53c('0x2c')](_0x2accaf['query']);_0x570a41[_0xb53c('0x2d')]=_['intersection'](_0x570a41[_0xb53c('0x2f')],_0x570a41['query']);_0x164ae2[_0xb53c('0x40')]=_['intersection'](_0x570a41[_0xb53c('0x2f')],qs[_0xb53c('0x30')](_0x2accaf['query'][_0xb53c('0x30')]));_0x164ae2[_0xb53c('0x40')]=_0x164ae2[_0xb53c('0x40')][_0xb53c('0x31')]?_0x164ae2[_0xb53c('0x40')]:_0x570a41[_0xb53c('0x2f')];if(_0x2accaf[_0xb53c('0x2b')][_0xb53c('0x3b')]){_0x164ae2['include']=[{'all':!![]}];}_0x164ae2=_[_0xb53c('0x39')]({},_0x164ae2,_0x2accaf[_0xb53c('0x3a')]);return db[_0xb53c('0x24')][_0xb53c('0x41')](_0x164ae2)[_0xb53c('0x1f')](handleEntityNotFound(_0x3ee061,null))[_0xb53c('0x1f')](respondWithResult(_0x3ee061,null))[_0xb53c('0x3e')](handleError(_0x3ee061,null));};exports[_0xb53c('0x42')]=function(_0x51da2e,_0x4d27f4){return db['ZendeskField'][_0xb53c('0x42')](_0x51da2e[_0xb53c('0x43')],{})[_0xb53c('0x1f')](respondWithResult(_0x4d27f4,0xc9))[_0xb53c('0x3e')](handleError(_0x4d27f4,null));};exports[_0xb53c('0x44')]=function(_0xa3d1bd,_0x47a781){if(_0xa3d1bd['body']['id']){delete _0xa3d1bd[_0xb53c('0x43')]['id'];}return db[_0xb53c('0x24')][_0xb53c('0x41')]({'where':{'id':_0xa3d1bd[_0xb53c('0x45')]['id']}})[_0xb53c('0x1f')](handleEntityNotFound(_0x47a781,null))['then'](saveUpdates(_0xa3d1bd[_0xb53c('0x43')],null))[_0xb53c('0x1f')](respondWithResult(_0x47a781,null))[_0xb53c('0x3e')](handleError(_0x47a781,null));};exports[_0xb53c('0x20')]=function(_0x2d7de0,_0x572df3){return db[_0xb53c('0x24')][_0xb53c('0x41')]({'where':{'id':_0x2d7de0['params']['id']}})['then'](handleEntityNotFound(_0x572df3,null))['then'](removeEntity(_0x572df3,null))[_0xb53c('0x3e')](handleError(_0x572df3,null));}; \ No newline at end of file +var _0x5493=['count','set','json','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','ZendeskField','findAll','rows','show','params','keys','find','catch','create','body','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','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','sendStatus','status','end','offset','undefined','limit'];(function(_0x2274d7,_0x466a90){var _0x4ad3fa=function(_0x3f595c){while(--_0x3f595c){_0x2274d7['push'](_0x2274d7['shift']());}};_0x4ad3fa(++_0x466a90);}(_0x5493,0x1ae));var _0x3549=function(_0x23ae03,_0x373bd7){_0x23ae03=_0x23ae03-0x0;var _0x320c15=_0x5493[_0x23ae03];return _0x320c15;};'use strict';var emlformat=require(_0x3549('0x0'));var rimraf=require(_0x3549('0x1'));var zipdir=require(_0x3549('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3549('0x3'));var BPromise=require(_0x3549('0x4'));var Mustache=require(_0x3549('0x5'));var util=require(_0x3549('0x6'));var path=require(_0x3549('0x7'));var sox=require(_0x3549('0x8'));var csv=require(_0x3549('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3549('0xa'));var _=require(_0x3549('0xb'));var squel=require('squel');var crypto=require(_0x3549('0xc'));var jsforce=require(_0x3549('0xd'));var deskjs=require(_0x3549('0xe'));var toCsv=require(_0x3549('0x9'));var querystring=require(_0x3549('0xf'));var Papa=require(_0x3549('0x10'));var Redis=require(_0x3549('0x11'));var authService=require(_0x3549('0x12'));var qs=require(_0x3549('0x13'));var as=require(_0x3549('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3549('0x15'))(_0x3549('0x16'));var utils=require(_0x3549('0x17'));var config=require(_0x3549('0x18'));var licenseUtil=require(_0x3549('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1fbc0e,_0x25a8fb){_0x25a8fb=_0x25a8fb||0xcc;return function(_0x1621bd){if(_0x1621bd){return _0x1fbc0e[_0x3549('0x1a')](_0x25a8fb);}return _0x1fbc0e[_0x3549('0x1b')](_0x25a8fb)[_0x3549('0x1c')]();};}function respondWithResult(_0x87c0f,_0x46691a){_0x46691a=_0x46691a||0xc8;return function(_0x5703a4){if(_0x5703a4){return _0x87c0f['status'](_0x46691a)['json'](_0x5703a4);}};}function respondWithFilteredResult(_0x2c8f7c,_0x16eae5){return function(_0x3ca135){if(_0x3ca135){var _0x2d399b=typeof _0x16eae5[_0x3549('0x1d')]===_0x3549('0x1e')&&typeof _0x16eae5[_0x3549('0x1f')]===_0x3549('0x1e');var _0x512b9d=_0x3ca135[_0x3549('0x20')];var _0x26ee13=_0x2d399b?0x0:_0x16eae5[_0x3549('0x1d')];var _0x2e8e1d=_0x2d399b?_0x3ca135[_0x3549('0x20')]:_0x16eae5['offset']+_0x16eae5['limit'];var _0xf0055b;if(_0x2e8e1d>=_0x512b9d){_0x2e8e1d=_0x512b9d;_0xf0055b=0xc8;}else{_0xf0055b=0xce;}_0x2c8f7c[_0x3549('0x1b')](_0xf0055b);return _0x2c8f7c[_0x3549('0x21')]('Content-Range',_0x26ee13+'-'+_0x2e8e1d+'/'+_0x512b9d)[_0x3549('0x22')](_0x3ca135);}return null;};}function patchUpdates(_0x55afd2){return function(_0x433888){try{jsonpatch[_0x3549('0x23')](_0x433888,_0x55afd2,!![]);}catch(_0x2a9a21){return BPromise[_0x3549('0x24')](_0x2a9a21);}return _0x433888[_0x3549('0x25')]();};}function saveUpdates(_0x2d3753,_0x16b340){return function(_0x4c673d){if(_0x4c673d){return _0x4c673d[_0x3549('0x26')](_0x2d3753)[_0x3549('0x27')](function(_0x11697b){return _0x11697b;});}return null;};}function removeEntity(_0x4a6ce2,_0x450d18){return function(_0x53c0b0){if(_0x53c0b0){return _0x53c0b0[_0x3549('0x28')]()[_0x3549('0x27')](function(){_0x4a6ce2[_0x3549('0x1b')](0xcc)[_0x3549('0x1c')]();});}};}function handleEntityNotFound(_0x27e5a3,_0x37b465){return function(_0x5cb964){if(!_0x5cb964){_0x27e5a3[_0x3549('0x1a')](0x194);}return _0x5cb964;};}function handleError(_0x452e05,_0x12dd5c){_0x12dd5c=_0x12dd5c||0x1f4;return function(_0xe15438){logger['error'](_0xe15438[_0x3549('0x29')]);if(_0xe15438[_0x3549('0x2a')]){delete _0xe15438[_0x3549('0x2a')];}_0x452e05[_0x3549('0x1b')](_0x12dd5c)[_0x3549('0x2b')](_0xe15438);};}exports[_0x3549('0x2c')]=function(_0x554f11,_0x4dc85a){var _0x5f4299={},_0x5cb488={},_0x681e03={'count':0x0,'rows':[]};var _0x4e54fc=_[_0x3549('0x2d')](db['ZendeskField'][_0x3549('0x2e')],function(_0x3657a5){return{'name':_0x3657a5[_0x3549('0x2f')],'type':_0x3657a5[_0x3549('0x30')]['key']};});_0x5cb488['model']=_[_0x3549('0x2d')](_0x4e54fc,_0x3549('0x2a'));_0x5cb488[_0x3549('0x31')]=_['keys'](_0x554f11[_0x3549('0x31')]);_0x5cb488[_0x3549('0x32')]=_[_0x3549('0x33')](_0x5cb488[_0x3549('0x34')],_0x5cb488[_0x3549('0x31')]);_0x5f4299['attributes']=_[_0x3549('0x33')](_0x5cb488[_0x3549('0x34')],qs[_0x3549('0x35')](_0x554f11[_0x3549('0x31')][_0x3549('0x35')]));_0x5f4299[_0x3549('0x36')]=_0x5f4299['attributes'][_0x3549('0x37')]?_0x5f4299['attributes']:_0x5cb488[_0x3549('0x34')];if(!_0x554f11['query'][_0x3549('0x38')](_0x3549('0x39'))){_0x5f4299[_0x3549('0x1f')]=qs[_0x3549('0x1f')](_0x554f11[_0x3549('0x31')][_0x3549('0x1f')]);_0x5f4299[_0x3549('0x1d')]=qs[_0x3549('0x1d')](_0x554f11[_0x3549('0x31')]['offset']);}_0x5f4299[_0x3549('0x3a')]=qs['sort'](_0x554f11[_0x3549('0x31')][_0x3549('0x3b')]);_0x5f4299[_0x3549('0x3c')]=qs[_0x3549('0x32')](_[_0x3549('0x3d')](_0x554f11[_0x3549('0x31')],_0x5cb488['filters']),_0x4e54fc);if(_0x554f11[_0x3549('0x31')][_0x3549('0x3e')]){_0x5f4299[_0x3549('0x3c')]=_[_0x3549('0x3f')](_0x5f4299[_0x3549('0x3c')],{'$or':_[_0x3549('0x2d')](_0x4e54fc,function(_0x43d790){if(_0x43d790['type']!==_0x3549('0x40')){var _0xc31c11={};_0xc31c11[_0x43d790[_0x3549('0x2a')]]={'$like':'%'+_0x554f11[_0x3549('0x31')]['filter']+'%'};return _0xc31c11;}})});}_0x5f4299=_['merge']({},_0x5f4299,_0x554f11['options']);var _0x1247ff={'where':_0x5f4299['where']};return db['ZendeskField'][_0x3549('0x20')](_0x1247ff)[_0x3549('0x27')](function(_0x8ad13a){_0x681e03[_0x3549('0x20')]=_0x8ad13a;if(_0x554f11[_0x3549('0x31')][_0x3549('0x41')]){_0x5f4299[_0x3549('0x42')]=[{'all':!![]}];}return db[_0x3549('0x43')][_0x3549('0x44')](_0x5f4299);})[_0x3549('0x27')](function(_0x2b901d){_0x681e03[_0x3549('0x45')]=_0x2b901d;return _0x681e03;})[_0x3549('0x27')](respondWithFilteredResult(_0x4dc85a,_0x5f4299))['catch'](handleError(_0x4dc85a,null));};exports[_0x3549('0x46')]=function(_0x73875a,_0x190467){var _0x32f67e={'raw':!![],'where':{'id':_0x73875a[_0x3549('0x47')]['id']}},_0x251f1c={};_0x251f1c[_0x3549('0x34')]=_[_0x3549('0x48')](db[_0x3549('0x43')]['rawAttributes']);_0x251f1c[_0x3549('0x31')]=_[_0x3549('0x48')](_0x73875a[_0x3549('0x31')]);_0x251f1c['filters']=_[_0x3549('0x33')](_0x251f1c[_0x3549('0x34')],_0x251f1c[_0x3549('0x31')]);_0x32f67e[_0x3549('0x36')]=_[_0x3549('0x33')](_0x251f1c[_0x3549('0x34')],qs['fields'](_0x73875a['query']['fields']));_0x32f67e[_0x3549('0x36')]=_0x32f67e[_0x3549('0x36')][_0x3549('0x37')]?_0x32f67e[_0x3549('0x36')]:_0x251f1c[_0x3549('0x34')];if(_0x73875a[_0x3549('0x31')][_0x3549('0x41')]){_0x32f67e['include']=[{'all':!![]}];}_0x32f67e=_['merge']({},_0x32f67e,_0x73875a['options']);return db[_0x3549('0x43')][_0x3549('0x49')](_0x32f67e)[_0x3549('0x27')](handleEntityNotFound(_0x190467,null))[_0x3549('0x27')](respondWithResult(_0x190467,null))[_0x3549('0x4a')](handleError(_0x190467,null));};exports[_0x3549('0x4b')]=function(_0xaffb90,_0x45cee9){return db[_0x3549('0x43')][_0x3549('0x4b')](_0xaffb90[_0x3549('0x4c')],{})[_0x3549('0x27')](respondWithResult(_0x45cee9,0xc9))[_0x3549('0x4a')](handleError(_0x45cee9,null));};exports[_0x3549('0x26')]=function(_0x19696c,_0x48ca4f){if(_0x19696c[_0x3549('0x4c')]['id']){delete _0x19696c['body']['id'];}return db[_0x3549('0x43')][_0x3549('0x49')]({'where':{'id':_0x19696c[_0x3549('0x47')]['id']}})[_0x3549('0x27')](handleEntityNotFound(_0x48ca4f,null))[_0x3549('0x27')](saveUpdates(_0x19696c[_0x3549('0x4c')],null))['then'](respondWithResult(_0x48ca4f,null))['catch'](handleError(_0x48ca4f,null));};exports[_0x3549('0x28')]=function(_0x4e1f78,_0x588db6){return db[_0x3549('0x43')][_0x3549('0x49')]({'where':{'id':_0x4e1f78['params']['id']}})[_0x3549('0x27')](handleEntityNotFound(_0x588db6,null))[_0x3549('0x27')](removeEntity(_0x588db6,null))['catch'](handleError(_0x588db6,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index e43ac95..d0beb0d 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 _0xf29c=['bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0xfbdff6,_0x2af690){var _0x4cb9be=function(_0x4022d8){while(--_0x4022d8){_0xfbdff6['push'](_0xfbdff6['shift']());}};_0x4cb9be(++_0x2af690);}(_0xf29c,0xd3));var _0xcf29=function(_0x1244e5,_0x10e949){_0x1244e5=_0x1244e5-0x0;var _0x8f6db5=_0xf29c[_0x1244e5];return _0x8f6db5;};'use strict';var _=require(_0xcf29('0x0'));var util=require(_0xcf29('0x1'));var logger=require(_0xcf29('0x2'))(_0xcf29('0x3'));var moment=require(_0xcf29('0x4'));var BPromise=require(_0xcf29('0x5'));var rp=require(_0xcf29('0x6'));var fs=require('fs');var path=require(_0xcf29('0x7'));var rimraf=require(_0xcf29('0x8'));var config=require(_0xcf29('0x9'));var attributes=require(_0xcf29('0xa'));module[_0xcf29('0xb')]=function(_0xdeb7b,_0x3e6b9d){return _0xdeb7b[_0xcf29('0xc')](_0xcf29('0xd'),attributes,{'tableName':_0xcf29('0xe'),'paranoid':![],'indexes':[{'name':_0xcf29('0xf'),'fields':[_0xcf29('0x10'),_0xcf29('0x11')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x936a=['request-promise','path','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x287ccd,_0x5e35d2){var _0x2be637=function(_0x4aea5c){while(--_0x4aea5c){_0x287ccd['push'](_0x287ccd['shift']());}};_0x2be637(++_0x5e35d2);}(_0x936a,0x19a));var _0xa936=function(_0x5fa488,_0x21a582){_0x5fa488=_0x5fa488-0x0;var _0x1aa239=_0x936a[_0x5fa488];return _0x1aa239;};'use strict';var _=require(_0xa936('0x0'));var util=require(_0xa936('0x1'));var logger=require(_0xa936('0x2'))(_0xa936('0x3'));var moment=require(_0xa936('0x4'));var BPromise=require(_0xa936('0x5'));var rp=require(_0xa936('0x6'));var fs=require('fs');var path=require(_0xa936('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa936('0x8'));module[_0xa936('0x9')]=function(_0x3ca11b,_0x973b88){return _0x3ca11b[_0xa936('0xa')](_0xa936('0xb'),attributes,{'tableName':_0xa936('0xc'),'paranoid':![],'indexes':[{'name':_0xa936('0xd'),'fields':[_0xa936('0xe'),_0xa936('0xf')],'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 a56cb49..07c3d07 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 _0x9909=['http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2d9878,_0x5ae702){var _0x28e150=function(_0xf5cd13){while(--_0xf5cd13){_0x2d9878['push'](_0x2d9878['shift']());}};_0x28e150(++_0x5ae702);}(_0x9909,0x81));var _0x9990=function(_0x983dc2,_0x5cca11){_0x983dc2=_0x983dc2-0x0;var _0x4b0315=_0x9909[_0x983dc2];return _0x4b0315;};'use strict';var _=require(_0x9990('0x0'));var util=require(_0x9990('0x1'));var moment=require(_0x9990('0x2'));var BPromise=require(_0x9990('0x3'));var rs=require(_0x9990('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9990('0x5'))['db'];var utils=require(_0x9990('0x6'));var logger=require(_0x9990('0x7'))(_0x9990('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x9990('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2035da,_0x58f4a4,_0xe164d4){return new BPromise(function(_0x46de43,_0x1aad93){return client[_0x9990('0xa')](_0x2035da,_0xe164d4)[_0x9990('0xb')](function(_0x59ffc9){logger[_0x9990('0xc')](_0x9990('0xd'),_0x58f4a4,_0x9990('0xe'));logger[_0x9990('0xf')](_0x9990('0x10'),_0x58f4a4,_0x9990('0xe'),JSON[_0x9990('0x11')](_0x59ffc9));if(_0x59ffc9[_0x9990('0x12')]){if(_0x59ffc9['error'][_0x9990('0x13')]===0x1f4){logger[_0x9990('0x12')](_0x9990('0xd'),_0x58f4a4,_0x59ffc9[_0x9990('0x12')][_0x9990('0x14')]);return _0x1aad93(_0x59ffc9[_0x9990('0x12')]['message']);}logger[_0x9990('0x12')]('ZendeskField,\x20%s,\x20%s',_0x58f4a4,_0x59ffc9[_0x9990('0x12')][_0x9990('0x14')]);return _0x46de43(_0x59ffc9[_0x9990('0x12')]['message']);}else{logger['info'](_0x9990('0xd'),_0x58f4a4,_0x9990('0xe'));_0x46de43(_0x59ffc9[_0x9990('0x15')]['message']);}})[_0x9990('0x16')](function(_0xb0437){logger[_0x9990('0x12')]('ZendeskField,\x20%s,\x20%s',_0x58f4a4,_0xb0437);_0x1aad93(_0xb0437);});});} \ No newline at end of file +var _0xc19e=['util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xc19e,0xef));var _0xec19=function(_0x316b12,_0x12a04f){_0x316b12=_0x316b12-0x0;var _0x29769f=_0xc19e[_0x316b12];return _0x29769f;};'use strict';var _=require(_0xec19('0x0'));var util=require(_0xec19('0x1'));var moment=require(_0xec19('0x2'));var BPromise=require(_0xec19('0x3'));var rs=require(_0xec19('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xec19('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xec19('0x6'))('rpc');var config=require(_0xec19('0x7'));var jayson=require(_0xec19('0x8'));var client=jayson[_0xec19('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x264d8b,_0x224534,_0x3187a2){return new BPromise(function(_0x16dba3,_0x2bd23a){return client[_0xec19('0xa')](_0x264d8b,_0x3187a2)[_0xec19('0xb')](function(_0x37cc0e){logger[_0xec19('0xc')](_0xec19('0xd'),_0x224534,_0xec19('0xe'));logger['debug'](_0xec19('0xf'),_0x224534,'request\x20sent',JSON['stringify'](_0x37cc0e));if(_0x37cc0e[_0xec19('0x10')]){if(_0x37cc0e[_0xec19('0x10')][_0xec19('0x11')]===0x1f4){logger[_0xec19('0x10')](_0xec19('0xd'),_0x224534,_0x37cc0e['error'][_0xec19('0x12')]);return _0x2bd23a(_0x37cc0e['error']['message']);}logger[_0xec19('0x10')](_0xec19('0xd'),_0x224534,_0x37cc0e[_0xec19('0x10')][_0xec19('0x12')]);return _0x16dba3(_0x37cc0e[_0xec19('0x10')][_0xec19('0x12')]);}else{logger[_0xec19('0xc')](_0xec19('0xd'),_0x224534,_0xec19('0xe'));_0x16dba3(_0x37cc0e[_0xec19('0x13')][_0xec19('0x12')]);}})['catch'](function(_0x3e6184){logger[_0xec19('0x10')]('ZendeskField,\x20%s,\x20%s',_0x224534,_0x3e6184);_0x2bd23a(_0x3e6184);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 6590d35..b99e19b 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 _0x2c17=['../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','/:id/configurations','/:id/fields','post','create','put','update','multer','util','path','Router','fs-extra','../../components/auth/service'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0x2c17,0x174));var _0x72c1=function(_0x34a8f4,_0x5dd635){_0x34a8f4=_0x34a8f4-0x0;var _0x347ba6=_0x2c17[_0x34a8f4];return _0x347ba6;};'use strict';var multer=require(_0x72c1('0x0'));var util=require(_0x72c1('0x1'));var path=require(_0x72c1('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x72c1('0x3')]();var fs_extra=require(_0x72c1('0x4'));var auth=require(_0x72c1('0x5'));var interaction=require(_0x72c1('0x6'));var config=require(_0x72c1('0x7'));var controller=require('./intZohoAccount.controller');router['get']('/',auth[_0x72c1('0x8')](),controller['index']);router[_0x72c1('0x9')](_0x72c1('0xa'),auth[_0x72c1('0x8')](),controller[_0x72c1('0xb')]);router['get'](_0x72c1('0xc'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x72c1('0x9')](_0x72c1('0xd'),auth[_0x72c1('0x8')](),controller['getFields']);router[_0x72c1('0xe')]('/',auth[_0x72c1('0x8')](),controller[_0x72c1('0xf')]);router[_0x72c1('0xe')](_0x72c1('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x72c1('0x10')]('/:id',auth[_0x72c1('0x8')](),controller[_0x72c1('0x11')]);router['delete'](_0x72c1('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb828=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','delete'];(function(_0x307086,_0x3bfe4e){var _0x699043=function(_0x1a7677){while(--_0x1a7677){_0x307086['push'](_0x307086['shift']());}};_0x699043(++_0x3bfe4e);}(_0xb828,0x9e));var _0x8b82=function(_0x295583,_0x4756aa){_0x295583=_0x295583-0x0;var _0x4c2ae6=_0xb828[_0x295583];return _0x4c2ae6;};'use strict';var multer=require(_0x8b82('0x0'));var util=require('util');var path=require(_0x8b82('0x1'));var timeout=require(_0x8b82('0x2'));var express=require(_0x8b82('0x3'));var router=express[_0x8b82('0x4')]();var fs_extra=require(_0x8b82('0x5'));var auth=require(_0x8b82('0x6'));var interaction=require(_0x8b82('0x7'));var config=require(_0x8b82('0x8'));var controller=require(_0x8b82('0x9'));router[_0x8b82('0xa')]('/',auth[_0x8b82('0xb')](),controller[_0x8b82('0xc')]);router['get'](_0x8b82('0xd'),auth[_0x8b82('0xb')](),controller[_0x8b82('0xe')]);router['get'](_0x8b82('0xf'),auth[_0x8b82('0xb')](),controller[_0x8b82('0x10')]);router['get'](_0x8b82('0x11'),auth[_0x8b82('0xb')](),controller[_0x8b82('0x12')]);router[_0x8b82('0x13')]('/',auth[_0x8b82('0xb')](),controller[_0x8b82('0x14')]);router[_0x8b82('0x13')]('/:id/configurations',auth[_0x8b82('0xb')](),controller[_0x8b82('0x15')]);router['put']('/:id',auth[_0x8b82('0xb')](),controller[_0x8b82('0x16')]);router[_0x8b82('0x17')](_0x8b82('0xd'),auth[_0x8b82('0xb')](),controller[_0x8b82('0x18')]);module[_0x8b82('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 2d17cd2..026bd90 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 _0xf4eb=['sequelize','STRING'];(function(_0x4655cb,_0x571d6a){var _0x1764f4=function(_0x221d20){while(--_0x221d20){_0x4655cb['push'](_0x4655cb['shift']());}};_0x1764f4(++_0x571d6a);}(_0xf4eb,0xec));var _0xbf4e=function(_0x5068e1,_0x16a01e){_0x5068e1=_0x5068e1-0x0;var _0x4e09f5=_0xf4eb[_0x5068e1];return _0x4e09f5;};'use strict';var Sequelize=require(_0xbf4e('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0xbf4e('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xbf4e('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0xbf4e('0x1')]},'refreshToken':{'type':Sequelize[_0xbf4e('0x1')]}}; \ No newline at end of file +var _0xb4e6=['sequelize','STRING'];(function(_0x16869e,_0x50e3b7){var _0x4b4af3=function(_0x353d58){while(--_0x353d58){_0x16869e['push'](_0x16869e['shift']());}};_0x4b4af3(++_0x50e3b7);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x1a595a,_0x263824){_0x1a595a=_0x1a595a-0x0;var _0x33f008=_0xb4e6[_0x1a595a];return _0x33f008;};'use strict';var Sequelize=require(_0x6b4e('0x0'));module['exports']={'name':{'type':Sequelize[_0x6b4e('0x1')]},'description':{'type':Sequelize[_0x6b4e('0x1')]},'host':{'type':Sequelize[_0x6b4e('0x1')]},'zone':{'type':Sequelize[_0x6b4e('0x1')]},'clientId':{'type':Sequelize[_0x6b4e('0x1')]},'clientSecret':{'type':Sequelize[_0x6b4e('0x1')]},'serverUrl':{'type':Sequelize[_0x6b4e('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x6b4e('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index f4e67af..def2448 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 _0x3ad1=['api_name','system_mandatory','push','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','map','ZohoAccount','rawAttributes','fieldName','model','query','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','getConfigurations','hasOwnProperty','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','getDescriptions','channel','ZohoConfiguration','ZohoField','Descriptions','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','zone','code','refreshToken','zoho.eu','com','serverUrl','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','error','message','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','remove','includes'];(function(_0x5b58d5,_0x4c2852){var _0x41089c=function(_0x48e0b5){while(--_0x48e0b5){_0x5b58d5['push'](_0x5b58d5['shift']());}};_0x41089c(++_0x4c2852);}(_0x3ad1,0x11e));var _0x13ad=function(_0x36468d,_0x47cbd0){_0x36468d=_0x36468d-0x0;var _0x94dece=_0x3ad1[_0x36468d];return _0x94dece;};'use strict';var emlformat=require(_0x13ad('0x0'));var rimraf=require(_0x13ad('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x13ad('0x2'));var rp=require(_0x13ad('0x3'));var moment=require(_0x13ad('0x4'));var BPromise=require(_0x13ad('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x13ad('0x6'));var sox=require(_0x13ad('0x7'));var csv=require(_0x13ad('0x8'));var ejs=require(_0x13ad('0x9'));var fs=require('fs');var fs_extra=require(_0x13ad('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x13ad('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x13ad('0xc'));var toCsv=require(_0x13ad('0x8'));var querystring=require('querystring');var Papa=require(_0x13ad('0xd'));var Redis=require(_0x13ad('0xe'));var authService=require(_0x13ad('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x13ad('0x10'));var logger=require(_0x13ad('0x11'))(_0x13ad('0x12'));var utils=require('../../config/utils');var config=require(_0x13ad('0x13'));var licenseUtil=require(_0x13ad('0x14'));var db=require(_0x13ad('0x15'))['db'];var integrations=require(_0x13ad('0x16'));function respondWithStatusCode(_0xd7ee1e,_0x1d6fa4){_0x1d6fa4=_0x1d6fa4||0xcc;return function(_0x365852){if(_0x365852){return _0xd7ee1e[_0x13ad('0x17')](_0x1d6fa4);}return _0xd7ee1e[_0x13ad('0x18')](_0x1d6fa4)[_0x13ad('0x19')]();};}function respondWithResult(_0x5c9549,_0x13be9b){_0x13be9b=_0x13be9b||0xc8;return function(_0x395ce4){if(_0x395ce4){return _0x5c9549[_0x13ad('0x18')](_0x13be9b)['json'](_0x395ce4);}};}function respondWithFilteredResult(_0x1e19a8,_0x4d8878){return function(_0x4b61f8){if(_0x4b61f8){var _0x16e131=typeof _0x4d8878[_0x13ad('0x1a')]===_0x13ad('0x1b')&&typeof _0x4d8878[_0x13ad('0x1c')]===_0x13ad('0x1b');var _0x14773=_0x4b61f8[_0x13ad('0x1d')];var _0x39a714=_0x16e131?0x0:_0x4d8878['offset'];var _0x52ddfa=_0x16e131?_0x4b61f8['count']:_0x4d8878[_0x13ad('0x1a')]+_0x4d8878[_0x13ad('0x1c')];var _0x55ad47;if(_0x52ddfa>=_0x14773){_0x52ddfa=_0x14773;_0x55ad47=0xc8;}else{_0x55ad47=0xce;}_0x1e19a8[_0x13ad('0x18')](_0x55ad47);return _0x1e19a8[_0x13ad('0x1e')](_0x13ad('0x1f'),_0x39a714+'-'+_0x52ddfa+'/'+_0x14773)[_0x13ad('0x20')](_0x4b61f8);}return null;};}function patchUpdates(_0x563403){return function(_0x3d634c){try{jsonpatch[_0x13ad('0x21')](_0x3d634c,_0x563403,!![]);}catch(_0x391899){return BPromise[_0x13ad('0x22')](_0x391899);}return _0x3d634c[_0x13ad('0x23')]();};}function saveUpdates(_0x2082a3,_0x389a0f){return function(_0x41fcd7){if(_0x41fcd7){return _0x41fcd7[_0x13ad('0x24')](_0x2082a3)[_0x13ad('0x25')](function(_0x1b061d){return _0x1b061d;});}return null;};}function removeEntity(_0x3f2586,_0x26dd97){return function(_0x450717){if(_0x450717){return _0x450717[_0x13ad('0x26')]()['then'](function(){_0x3f2586[_0x13ad('0x18')](0xcc)[_0x13ad('0x19')]();});}};}function handleEntityNotFound(_0x39ab3b,_0x13e494){return function(_0xbfde1){if(!_0xbfde1){_0x39ab3b[_0x13ad('0x17')](0x194);}return _0xbfde1;};}function handleError(_0x507703,_0x4e5c85){_0x4e5c85=_0x4e5c85||0x1f4;return function(_0x3f67e1){logger['error'](_0x3f67e1[_0x13ad('0x27')]);if(_0x3f67e1[_0x13ad('0x28')]){delete _0x3f67e1[_0x13ad('0x28')];}_0x507703['status'](_0x4e5c85)[_0x13ad('0x29')](_0x3f67e1);};}exports[_0x13ad('0x2a')]=function(_0x2876c5,_0x2c3d4a){var _0xce22b6={},_0x9ee129={},_0xf61a4={'count':0x0,'rows':[]};var _0x398776=_[_0x13ad('0x2b')](db[_0x13ad('0x2c')][_0x13ad('0x2d')],function(_0x4cf956){return{'name':_0x4cf956[_0x13ad('0x2e')],'type':_0x4cf956['type']['key']};});_0x9ee129[_0x13ad('0x2f')]=_['map'](_0x398776,'name');_0x9ee129[_0x13ad('0x30')]=_['keys'](_0x2876c5[_0x13ad('0x30')]);_0x9ee129[_0x13ad('0x31')]=_['intersection'](_0x9ee129[_0x13ad('0x2f')],_0x9ee129[_0x13ad('0x30')]);_0xce22b6[_0x13ad('0x32')]=_[_0x13ad('0x33')](_0x9ee129[_0x13ad('0x2f')],qs[_0x13ad('0x34')](_0x2876c5['query']['fields']));_0xce22b6[_0x13ad('0x32')]=_0xce22b6[_0x13ad('0x32')][_0x13ad('0x35')]?_0xce22b6[_0x13ad('0x32')]:_0x9ee129['model'];if(!_0x2876c5['query']['hasOwnProperty']('nolimit')){_0xce22b6[_0x13ad('0x1c')]=qs['limit'](_0x2876c5[_0x13ad('0x30')][_0x13ad('0x1c')]);_0xce22b6[_0x13ad('0x1a')]=qs[_0x13ad('0x1a')](_0x2876c5[_0x13ad('0x30')]['offset']);}_0xce22b6[_0x13ad('0x36')]=qs[_0x13ad('0x37')](_0x2876c5[_0x13ad('0x30')][_0x13ad('0x37')]);_0xce22b6[_0x13ad('0x38')]=qs[_0x13ad('0x31')](_[_0x13ad('0x39')](_0x2876c5[_0x13ad('0x30')],_0x9ee129[_0x13ad('0x31')]),_0x398776);if(_0x2876c5[_0x13ad('0x30')][_0x13ad('0x3a')]){_0xce22b6['where']=_[_0x13ad('0x3b')](_0xce22b6[_0x13ad('0x38')],{'$or':_[_0x13ad('0x2b')](_0x398776,function(_0x19d650){if(_0x19d650[_0x13ad('0x3c')]!=='VIRTUAL'){var _0x1ac6f4={};_0x1ac6f4[_0x19d650['name']]={'$like':'%'+_0x2876c5['query'][_0x13ad('0x3a')]+'%'};return _0x1ac6f4;}})});}_0xce22b6=_['merge']({},_0xce22b6,_0x2876c5[_0x13ad('0x3d')]);var _0x1ae8f9={'where':_0xce22b6[_0x13ad('0x38')]};return db['ZohoAccount'][_0x13ad('0x1d')](_0x1ae8f9)[_0x13ad('0x25')](function(_0x277f16){_0xf61a4[_0x13ad('0x1d')]=_0x277f16;if(_0x2876c5[_0x13ad('0x30')][_0x13ad('0x3e')]){_0xce22b6[_0x13ad('0x3f')]=[{'all':!![]}];}return db[_0x13ad('0x2c')][_0x13ad('0x40')](_0xce22b6);})['then'](function(_0x42d008){_0xf61a4[_0x13ad('0x41')]=_0x42d008;return _0xf61a4;})[_0x13ad('0x25')](respondWithFilteredResult(_0x2c3d4a,_0xce22b6))['catch'](handleError(_0x2c3d4a,null));};exports[_0x13ad('0x42')]=function(_0x19c323,_0x50dcb9){var _0x2c7239={'raw':![],'where':{'id':_0x19c323[_0x13ad('0x43')]['id']}},_0x19d50e={};_0x19d50e[_0x13ad('0x2f')]=_[_0x13ad('0x44')](db[_0x13ad('0x2c')]['rawAttributes']);_0x19d50e['query']=_[_0x13ad('0x44')](_0x19c323[_0x13ad('0x30')]);_0x19d50e['filters']=_['intersection'](_0x19d50e['model'],_0x19d50e[_0x13ad('0x30')]);_0x2c7239['attributes']=_[_0x13ad('0x33')](_0x19d50e[_0x13ad('0x2f')],qs[_0x13ad('0x34')](_0x19c323['query'][_0x13ad('0x34')]));_0x2c7239[_0x13ad('0x32')]=_0x2c7239[_0x13ad('0x32')][_0x13ad('0x35')]?_0x2c7239[_0x13ad('0x32')]:_0x19d50e[_0x13ad('0x2f')];if(_0x19c323['query'][_0x13ad('0x3e')]){_0x2c7239[_0x13ad('0x3f')]=[{'all':!![]}];}_0x2c7239=_[_0x13ad('0x3b')]({},_0x2c7239,_0x19c323[_0x13ad('0x3d')]);return db[_0x13ad('0x2c')][_0x13ad('0x45')](_0x2c7239)[_0x13ad('0x25')](handleEntityNotFound(_0x50dcb9,null))[_0x13ad('0x25')](respondWithResult(_0x50dcb9,null))[_0x13ad('0x46')](handleError(_0x50dcb9,null));};exports[_0x13ad('0x47')]=function(_0x1fe56d,_0x1ed23d){return db[_0x13ad('0x2c')][_0x13ad('0x47')](_0x1fe56d['body'],{})[_0x13ad('0x25')](respondWithResult(_0x1ed23d,0xc9))[_0x13ad('0x46')](handleError(_0x1ed23d,null));};exports[_0x13ad('0x24')]=function(_0x2d5cd6,_0x2160e6){if(_0x2d5cd6[_0x13ad('0x48')]['id']){delete _0x2d5cd6[_0x13ad('0x48')]['id'];}return db[_0x13ad('0x2c')]['find']({'where':{'id':_0x2d5cd6[_0x13ad('0x43')]['id']}})[_0x13ad('0x25')](handleEntityNotFound(_0x2160e6,null))[_0x13ad('0x25')](saveUpdates(_0x2d5cd6[_0x13ad('0x48')],null))[_0x13ad('0x25')](respondWithResult(_0x2160e6,null))[_0x13ad('0x46')](handleError(_0x2160e6,null));};exports[_0x13ad('0x26')]=function(_0x572a02,_0x34ae25){return db[_0x13ad('0x2c')][_0x13ad('0x45')]({'where':{'id':_0x572a02[_0x13ad('0x43')]['id']}})[_0x13ad('0x25')](handleEntityNotFound(_0x34ae25,null))[_0x13ad('0x25')](removeEntity(_0x34ae25,null))[_0x13ad('0x46')](handleError(_0x34ae25,null));};exports[_0x13ad('0x49')]=function(_0x5ae6c1,_0x246730,_0x24932f){var _0x4037f2={};var _0x5723f8={};var _0x1f2a8b;var _0x4bcdc7;return db[_0x13ad('0x2c')]['findOne']({'where':{'id':_0x5ae6c1[_0x13ad('0x43')]['id']}})[_0x13ad('0x25')](handleEntityNotFound(_0x246730,null))[_0x13ad('0x25')](function(_0x5151cf){if(_0x5151cf){_0x1f2a8b=_0x5151cf;_0x5723f8[_0x13ad('0x2f')]=_[_0x13ad('0x44')](db['ZohoConfiguration'][_0x13ad('0x2d')]);_0x5723f8[_0x13ad('0x30')]=_[_0x13ad('0x44')](_0x5ae6c1[_0x13ad('0x30')]);_0x5723f8[_0x13ad('0x31')]=_['intersection'](_0x5723f8[_0x13ad('0x2f')],_0x5723f8[_0x13ad('0x30')]);_0x4037f2[_0x13ad('0x32')]=_[_0x13ad('0x33')](_0x5723f8['model'],qs[_0x13ad('0x34')](_0x5ae6c1['query'][_0x13ad('0x34')]));_0x4037f2[_0x13ad('0x32')]=_0x4037f2[_0x13ad('0x32')]['length']?_0x4037f2['attributes']:_0x5723f8[_0x13ad('0x2f')];_0x4037f2['order']=qs[_0x13ad('0x37')](_0x5ae6c1[_0x13ad('0x30')]['sort']);_0x4037f2['where']=qs['filters'](_[_0x13ad('0x39')](_0x5ae6c1[_0x13ad('0x30')],_0x5723f8[_0x13ad('0x31')]));if(_0x5ae6c1['query'][_0x13ad('0x3a')]){_0x4037f2[_0x13ad('0x38')]=_[_0x13ad('0x3b')](_0x4037f2[_0x13ad('0x38')],{'$or':_[_0x13ad('0x2b')](_0x4037f2[_0x13ad('0x32')],function(_0x1f0d8e){var _0x5cfd21={};_0x5cfd21[_0x1f0d8e]={'$like':'%'+_0x5ae6c1[_0x13ad('0x30')][_0x13ad('0x3a')]+'%'};return _0x5cfd21;})});}_0x4037f2=_['merge']({},_0x4037f2,_0x5ae6c1[_0x13ad('0x3d')]);return _0x1f2a8b[_0x13ad('0x49')](_0x4037f2);}})[_0x13ad('0x25')](function(_0x3e7236){if(_0x3e7236){_0x4bcdc7=_0x3e7236['length'];if(!_0x5ae6c1[_0x13ad('0x30')][_0x13ad('0x4a')](_0x13ad('0x4b'))){_0x4037f2[_0x13ad('0x1c')]=qs['limit'](_0x5ae6c1[_0x13ad('0x30')][_0x13ad('0x1c')]);_0x4037f2['offset']=qs[_0x13ad('0x1a')](_0x5ae6c1[_0x13ad('0x30')]['offset']);}return _0x1f2a8b[_0x13ad('0x49')](_0x4037f2);}})['then'](function(_0x51feda){if(_0x51feda){return _0x51feda?{'count':_0x4bcdc7,'rows':_0x51feda}:null;}})[_0x13ad('0x25')](respondWithResult(_0x246730,null))[_0x13ad('0x46')](handleError(_0x246730,null));};exports[_0x13ad('0x4c')]=function(_0x20813f,_0x50429f,_0x39210d){if(_0x20813f[_0x13ad('0x48')]['id']){delete _0x20813f[_0x13ad('0x48')]['id'];}return db[_0x13ad('0x2c')][_0x13ad('0x4d')]({'where':{'id':_0x20813f['params']['id']}})[_0x13ad('0x25')](handleEntityNotFound(_0x50429f,null))[_0x13ad('0x25')](function(_0xaff59){if(_0xaff59){_0x20813f[_0x13ad('0x48')][_0x13ad('0x4e')]=_0xaff59['id'];_0x20813f[_0x13ad('0x48')][_0x13ad('0x4f')]=integrations[_0x13ad('0x50')](_0x20813f[_0x13ad('0x48')]['channel'],_0x20813f['body']['type']);_0x20813f[_0x13ad('0x48')]['Descriptions']=integrations[_0x13ad('0x51')](_0x20813f['body'][_0x13ad('0x52')],_0x20813f[_0x13ad('0x48')][_0x13ad('0x3c')]);return db[_0x13ad('0x53')]['create'](_0x20813f['body'],{'include':[{'model':db[_0x13ad('0x54')],'as':_0x13ad('0x4f')},{'model':db[_0x13ad('0x54')],'as':_0x13ad('0x55')}]});}return null;})[_0x13ad('0x25')](respondWithResult(_0x50429f,null))[_0x13ad('0x46')](handleError(_0x50429f,null));};function getAccessToken(_0x19f486){return new Promise(function(_0x3e873e,_0x59a24f){var _0x57138d;switch(_0x19f486['zone']){case'US':_0x57138d='https://accounts.zoho.com';break;case'AU':_0x57138d=_0x13ad('0x56');break;case'EU':_0x57138d=_0x13ad('0x57');break;case'IN':_0x57138d=_0x13ad('0x58');break;case'CN':_0x57138d=_0x13ad('0x59');break;default:_0x57138d='https://accounts.zoho.eu';break;}var _0x13d60a={'method':_0x13ad('0x5a'),'uri':_0x57138d+_0x13ad('0x5b'),'qs':{'refresh_token':_0x19f486['refreshToken'],'client_id':_0x19f486[_0x13ad('0x5c')],'client_secret':_0x19f486[_0x13ad('0x5d')],'grant_type':_0x13ad('0x5e')},'json':!![]};return rp(_0x13d60a)[_0x13ad('0x25')](function(_0x3741c5){if(_0x3741c5[_0x13ad('0x5f')]){_0x3e873e(_0x3741c5['access_token']);}else{_0x59a24f(_0x13ad('0x60'));}})['catch'](function(_0x571cf9){_0x59a24f(_0x571cf9);});});}exports[_0x13ad('0x61')]=function(_0x1d18c4,_0x3e712c,_0x31652d){var _0x557eb0,_0x4d7b6c,_0x397217,_0x2e7404,_0x38830c;return db[_0x13ad('0x2c')][_0x13ad('0x4d')]({'where':{'id':_0x1d18c4[_0x13ad('0x43')]['id']},'attributes':['id',_0x13ad('0x62'),_0x13ad('0x63'),'clientId',_0x13ad('0x5d'),'serverUrl',_0x13ad('0x64'),_0x13ad('0x65')]})[_0x13ad('0x25')](handleEntityNotFound(_0x3e712c,null))[_0x13ad('0x25')](function(_0x2c9d4f){_0x38830c=_0x2c9d4f;_0x557eb0=_0x38830c[_0x13ad('0x62')];_0x4d7b6c=_0x557eb0===_0x13ad('0x66')?'eu':_0x13ad('0x67');_0x397217=_0x38830c[_0x13ad('0x68')];var _0x5e58ad=_0x397217[_0x13ad('0x69')](-0x1);if(_0x5e58ad==='/'||_0x5e58ad==='\x5c'||_0x5e58ad===':'){_0x397217=_0x397217[_0x13ad('0x6a')](0x0,_0x397217[_0x13ad('0x6b')](_0x5e58ad));}if(!_0x38830c['refreshToken']){throw new Error(_0x13ad('0x6c'));}return getAccessToken(_0x38830c);})[_0x13ad('0x25')](function(_0x5a5644){if(_0x5a5644){return rp({'method':_0x13ad('0x6d'),'uri':util[_0x13ad('0x6e')](_0x13ad('0x6f'),_0x4d7b6c),'qs':{'module':_0x13ad('0x70')},'headers':{'Authorization':_0x13ad('0x71')+_0x5a5644},'json':!![]});}})[_0x13ad('0x25')](function(_0x24c996){if(_0x24c996){if(_0x24c996[_0x13ad('0x72')]&&_0x24c996[_0x13ad('0x72')][_0x13ad('0x73')]){throw new Error(_0x24c996[_0x13ad('0x72')][_0x13ad('0x73')][_0x13ad('0x74')]);}var _0x1607fe=[];var _0x477c61=[];var _0x136dc3=['Owner',_0x13ad('0x75'),_0x13ad('0x76'),_0x13ad('0x77'),_0x13ad('0x78'),_0x13ad('0x79'),_0x13ad('0x7a'),'Call_Type'];_0x477c61=_[_0x13ad('0x7b')](_0x24c996[_0x13ad('0x34')],function(_0x21e775){return _0x136dc3[_0x13ad('0x7c')](_0x21e775[_0x13ad('0x7d')]);});for(var _0x5d2ffa=0x0;_0x5d2ffa<_0x477c61[_0x13ad('0x35')];_0x5d2ffa++){if(_0x477c61[_0x5d2ffa][_0x13ad('0x7e')]===![]){_0x1607fe[_0x13ad('0x7f')]({'id':_0x477c61[_0x5d2ffa]['id'],'name':_0x477c61[_0x5d2ffa]['display_label'],'custom':_0x477c61[_0x5d2ffa][_0x13ad('0x80')],'options':_0x477c61[_0x5d2ffa][_0x13ad('0x81')]===_0x13ad('0x82')&&_0x477c61[_0x5d2ffa][_0x13ad('0x83')][_0x13ad('0x35')]>-0x1?_['map'](_0x477c61[_0x5d2ffa]['pick_list_values'],function(_0x1c05af){return{'name':_0x1c05af,'value':_0x1c05af};}):[]});}}return{'count':_0x1607fe['length'],'rows':_0x1607fe};}else{return{'count':0x0,'rows':[]};}})[_0x13ad('0x25')](respondWithResult(_0x3e712c,null))[_0x13ad('0x46')](function(_0x4f428f){var _0x45179f=_0x1d18c4['query'][_0x13ad('0x84')]?0x1f4:_0x4f428f[_0x13ad('0x85')]||0x1f4;logger[_0x13ad('0x73')](_0x13ad('0x86'),_0x13ad('0x61'),_0x45179f,JSON[_0x13ad('0x87')](_0x4f428f));delete _0x4f428f[_0x13ad('0x28')];if(_0x45179f===0x191){_0x45179f=0x190;}_0x3e712c[_0x13ad('0x18')](_0x45179f)[_0x13ad('0x29')](_0x1d18c4[_0x13ad('0x30')][_0x13ad('0x84')]?{'message':_0x13ad('0x88'),'statusCode':_0x4f428f[_0x13ad('0x85')]}:_0x4f428f);});}; \ No newline at end of file +var _0x6e6a=['https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','Owner','Subject','WhoId','Call_Duration','Call_Start_Time','remove','push','display_label','custom_field','data_type','picklist','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','limit','undefined','count','set','apply','save','update','then','destroy','error','stack','name','map','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options','ZohoAccount','rows','catch','params','fields','length','includeAll','find','create','body','getConfigurations','findOne','ZohoConfiguration','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','getFields','host','code','com','serverUrl','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format'];(function(_0x5df033,_0x29458b){var _0x445829=function(_0x2c795b){while(--_0x2c795b){_0x5df033['push'](_0x5df033['shift']());}};_0x445829(++_0x29458b);}(_0x6e6a,0x10e));var _0xa6e6=function(_0x86f227,_0x437176){_0x86f227=_0x86f227-0x0;var _0x17cbce=_0x6e6a[_0x86f227];return _0x17cbce;};'use strict';var emlformat=require(_0xa6e6('0x0'));var rimraf=require(_0xa6e6('0x1'));var zipdir=require(_0xa6e6('0x2'));var jsonpatch=require(_0xa6e6('0x3'));var rp=require('request-promise');var moment=require(_0xa6e6('0x4'));var BPromise=require(_0xa6e6('0x5'));var Mustache=require('mustache');var util=require(_0xa6e6('0x6'));var path=require('path');var sox=require(_0xa6e6('0x7'));var csv=require(_0xa6e6('0x8'));var ejs=require(_0xa6e6('0x9'));var fs=require('fs');var fs_extra=require(_0xa6e6('0xa'));var _=require(_0xa6e6('0xb'));var squel=require(_0xa6e6('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa6e6('0x8'));var querystring=require(_0xa6e6('0xd'));var Papa=require(_0xa6e6('0xe'));var Redis=require(_0xa6e6('0xf'));var authService=require(_0xa6e6('0x10'));var qs=require(_0xa6e6('0x11'));var as=require(_0xa6e6('0x12'));var hardwareService=require(_0xa6e6('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xa6e6('0x14'));var config=require(_0xa6e6('0x15'));var licenseUtil=require(_0xa6e6('0x16'));var db=require(_0xa6e6('0x17'))['db'];var integrations=require(_0xa6e6('0x18'));function respondWithStatusCode(_0xacd2bf,_0x78271d){_0x78271d=_0x78271d||0xcc;return function(_0x186793){if(_0x186793){return _0xacd2bf[_0xa6e6('0x19')](_0x78271d);}return _0xacd2bf['status'](_0x78271d)[_0xa6e6('0x1a')]();};}function respondWithResult(_0x412cbb,_0x4ff431){_0x4ff431=_0x4ff431||0xc8;return function(_0x4a7bdc){if(_0x4a7bdc){return _0x412cbb[_0xa6e6('0x1b')](_0x4ff431)[_0xa6e6('0x1c')](_0x4a7bdc);}};}function respondWithFilteredResult(_0x1e8376,_0x4d2990){return function(_0x4c97da){if(_0x4c97da){var _0x1b8006=typeof _0x4d2990[_0xa6e6('0x1d')]==='undefined'&&typeof _0x4d2990[_0xa6e6('0x1e')]===_0xa6e6('0x1f');var _0x381622=_0x4c97da['count'];var _0xc620dc=_0x1b8006?0x0:_0x4d2990[_0xa6e6('0x1d')];var _0x289161=_0x1b8006?_0x4c97da[_0xa6e6('0x20')]:_0x4d2990['offset']+_0x4d2990[_0xa6e6('0x1e')];var _0x483f93;if(_0x289161>=_0x381622){_0x289161=_0x381622;_0x483f93=0xc8;}else{_0x483f93=0xce;}_0x1e8376[_0xa6e6('0x1b')](_0x483f93);return _0x1e8376[_0xa6e6('0x21')]('Content-Range',_0xc620dc+'-'+_0x289161+'/'+_0x381622)[_0xa6e6('0x1c')](_0x4c97da);}return null;};}function patchUpdates(_0x3fa358){return function(_0x1c92f4){try{jsonpatch[_0xa6e6('0x22')](_0x1c92f4,_0x3fa358,!![]);}catch(_0x20f2d1){return BPromise['reject'](_0x20f2d1);}return _0x1c92f4[_0xa6e6('0x23')]();};}function saveUpdates(_0x1f08f9,_0x29ab1d){return function(_0x15adfd){if(_0x15adfd){return _0x15adfd[_0xa6e6('0x24')](_0x1f08f9)[_0xa6e6('0x25')](function(_0xba012d){return _0xba012d;});}return null;};}function removeEntity(_0x44cde9,_0x4c451b){return function(_0x539745){if(_0x539745){return _0x539745[_0xa6e6('0x26')]()[_0xa6e6('0x25')](function(){_0x44cde9['status'](0xcc)[_0xa6e6('0x1a')]();});}};}function handleEntityNotFound(_0x4221c4,_0x2bec9d){return function(_0x2df476){if(!_0x2df476){_0x4221c4[_0xa6e6('0x19')](0x194);}return _0x2df476;};}function handleError(_0x130330,_0xa488f1){_0xa488f1=_0xa488f1||0x1f4;return function(_0x50ea54){logger[_0xa6e6('0x27')](_0x50ea54[_0xa6e6('0x28')]);if(_0x50ea54[_0xa6e6('0x29')]){delete _0x50ea54[_0xa6e6('0x29')];}_0x130330[_0xa6e6('0x1b')](_0xa488f1)['send'](_0x50ea54);};}exports['index']=function(_0x2c6d76,_0x5ded55){var _0x32f8a9={},_0x23a2db={},_0xd8408e={'count':0x0,'rows':[]};var _0x5273d2=_[_0xa6e6('0x2a')](db['ZohoAccount'][_0xa6e6('0x2b')],function(_0x2115e8){return{'name':_0x2115e8[_0xa6e6('0x2c')],'type':_0x2115e8[_0xa6e6('0x2d')][_0xa6e6('0x2e')]};});_0x23a2db[_0xa6e6('0x2f')]=_[_0xa6e6('0x2a')](_0x5273d2,'name');_0x23a2db['query']=_[_0xa6e6('0x30')](_0x2c6d76['query']);_0x23a2db['filters']=_[_0xa6e6('0x31')](_0x23a2db[_0xa6e6('0x2f')],_0x23a2db[_0xa6e6('0x32')]);_0x32f8a9[_0xa6e6('0x33')]=_[_0xa6e6('0x31')](_0x23a2db['model'],qs['fields'](_0x2c6d76[_0xa6e6('0x32')]['fields']));_0x32f8a9['attributes']=_0x32f8a9[_0xa6e6('0x33')]['length']?_0x32f8a9[_0xa6e6('0x33')]:_0x23a2db[_0xa6e6('0x2f')];if(!_0x2c6d76[_0xa6e6('0x32')][_0xa6e6('0x34')](_0xa6e6('0x35'))){_0x32f8a9[_0xa6e6('0x1e')]=qs['limit'](_0x2c6d76[_0xa6e6('0x32')][_0xa6e6('0x1e')]);_0x32f8a9['offset']=qs['offset'](_0x2c6d76['query'][_0xa6e6('0x1d')]);}_0x32f8a9['order']=qs['sort'](_0x2c6d76[_0xa6e6('0x32')][_0xa6e6('0x36')]);_0x32f8a9[_0xa6e6('0x37')]=qs[_0xa6e6('0x38')](_[_0xa6e6('0x39')](_0x2c6d76['query'],_0x23a2db[_0xa6e6('0x38')]),_0x5273d2);if(_0x2c6d76[_0xa6e6('0x32')]['filter']){_0x32f8a9[_0xa6e6('0x37')]=_[_0xa6e6('0x3a')](_0x32f8a9[_0xa6e6('0x37')],{'$or':_[_0xa6e6('0x2a')](_0x5273d2,function(_0x3d80f){if(_0x3d80f[_0xa6e6('0x2d')]!==_0xa6e6('0x3b')){var _0x5efc45={};_0x5efc45[_0x3d80f[_0xa6e6('0x29')]]={'$like':'%'+_0x2c6d76[_0xa6e6('0x32')][_0xa6e6('0x3c')]+'%'};return _0x5efc45;}})});}_0x32f8a9=_[_0xa6e6('0x3a')]({},_0x32f8a9,_0x2c6d76[_0xa6e6('0x3d')]);var _0x528729={'where':_0x32f8a9[_0xa6e6('0x37')]};return db[_0xa6e6('0x3e')][_0xa6e6('0x20')](_0x528729)[_0xa6e6('0x25')](function(_0x38805a){_0xd8408e['count']=_0x38805a;if(_0x2c6d76[_0xa6e6('0x32')]['includeAll']){_0x32f8a9['include']=[{'all':!![]}];}return db['ZohoAccount']['findAll'](_0x32f8a9);})['then'](function(_0x2d4724){_0xd8408e[_0xa6e6('0x3f')]=_0x2d4724;return _0xd8408e;})[_0xa6e6('0x25')](respondWithFilteredResult(_0x5ded55,_0x32f8a9))[_0xa6e6('0x40')](handleError(_0x5ded55,null));};exports['show']=function(_0x1d5b33,_0x32cc80){var _0x14dd64={'raw':![],'where':{'id':_0x1d5b33[_0xa6e6('0x41')]['id']}},_0x237638={};_0x237638[_0xa6e6('0x2f')]=_[_0xa6e6('0x30')](db[_0xa6e6('0x3e')][_0xa6e6('0x2b')]);_0x237638[_0xa6e6('0x32')]=_['keys'](_0x1d5b33[_0xa6e6('0x32')]);_0x237638['filters']=_['intersection'](_0x237638[_0xa6e6('0x2f')],_0x237638['query']);_0x14dd64['attributes']=_[_0xa6e6('0x31')](_0x237638[_0xa6e6('0x2f')],qs[_0xa6e6('0x42')](_0x1d5b33[_0xa6e6('0x32')][_0xa6e6('0x42')]));_0x14dd64[_0xa6e6('0x33')]=_0x14dd64[_0xa6e6('0x33')][_0xa6e6('0x43')]?_0x14dd64['attributes']:_0x237638[_0xa6e6('0x2f')];if(_0x1d5b33[_0xa6e6('0x32')][_0xa6e6('0x44')]){_0x14dd64['include']=[{'all':!![]}];}_0x14dd64=_[_0xa6e6('0x3a')]({},_0x14dd64,_0x1d5b33['options']);return db[_0xa6e6('0x3e')][_0xa6e6('0x45')](_0x14dd64)[_0xa6e6('0x25')](handleEntityNotFound(_0x32cc80,null))['then'](respondWithResult(_0x32cc80,null))[_0xa6e6('0x40')](handleError(_0x32cc80,null));};exports[_0xa6e6('0x46')]=function(_0x3a415b,_0x54b4a4){return db['ZohoAccount'][_0xa6e6('0x46')](_0x3a415b[_0xa6e6('0x47')],{})[_0xa6e6('0x25')](respondWithResult(_0x54b4a4,0xc9))['catch'](handleError(_0x54b4a4,null));};exports['update']=function(_0x2c6e6b,_0x9395d3){if(_0x2c6e6b[_0xa6e6('0x47')]['id']){delete _0x2c6e6b[_0xa6e6('0x47')]['id'];}return db['ZohoAccount']['find']({'where':{'id':_0x2c6e6b['params']['id']}})['then'](handleEntityNotFound(_0x9395d3,null))[_0xa6e6('0x25')](saveUpdates(_0x2c6e6b[_0xa6e6('0x47')],null))['then'](respondWithResult(_0x9395d3,null))['catch'](handleError(_0x9395d3,null));};exports[_0xa6e6('0x26')]=function(_0x5540e1,_0x1a0f61){return db[_0xa6e6('0x3e')][_0xa6e6('0x45')]({'where':{'id':_0x5540e1[_0xa6e6('0x41')]['id']}})['then'](handleEntityNotFound(_0x1a0f61,null))[_0xa6e6('0x25')](removeEntity(_0x1a0f61,null))[_0xa6e6('0x40')](handleError(_0x1a0f61,null));};exports[_0xa6e6('0x48')]=function(_0xca8f30,_0x2e7933,_0x40c7cd){var _0x47afb8={};var _0x3931b4={};var _0x3651aa;var _0x52fad4;return db[_0xa6e6('0x3e')][_0xa6e6('0x49')]({'where':{'id':_0xca8f30['params']['id']}})[_0xa6e6('0x25')](handleEntityNotFound(_0x2e7933,null))[_0xa6e6('0x25')](function(_0x1060ee){if(_0x1060ee){_0x3651aa=_0x1060ee;_0x3931b4[_0xa6e6('0x2f')]=_[_0xa6e6('0x30')](db[_0xa6e6('0x4a')][_0xa6e6('0x2b')]);_0x3931b4[_0xa6e6('0x32')]=_[_0xa6e6('0x30')](_0xca8f30[_0xa6e6('0x32')]);_0x3931b4[_0xa6e6('0x38')]=_[_0xa6e6('0x31')](_0x3931b4[_0xa6e6('0x2f')],_0x3931b4[_0xa6e6('0x32')]);_0x47afb8['attributes']=_[_0xa6e6('0x31')](_0x3931b4['model'],qs[_0xa6e6('0x42')](_0xca8f30[_0xa6e6('0x32')][_0xa6e6('0x42')]));_0x47afb8[_0xa6e6('0x33')]=_0x47afb8[_0xa6e6('0x33')][_0xa6e6('0x43')]?_0x47afb8[_0xa6e6('0x33')]:_0x3931b4[_0xa6e6('0x2f')];_0x47afb8['order']=qs[_0xa6e6('0x36')](_0xca8f30['query'][_0xa6e6('0x36')]);_0x47afb8['where']=qs['filters'](_[_0xa6e6('0x39')](_0xca8f30[_0xa6e6('0x32')],_0x3931b4[_0xa6e6('0x38')]));if(_0xca8f30['query']['filter']){_0x47afb8[_0xa6e6('0x37')]=_[_0xa6e6('0x3a')](_0x47afb8['where'],{'$or':_[_0xa6e6('0x2a')](_0x47afb8[_0xa6e6('0x33')],function(_0x5748b4){var _0x533ae6={};_0x533ae6[_0x5748b4]={'$like':'%'+_0xca8f30[_0xa6e6('0x32')][_0xa6e6('0x3c')]+'%'};return _0x533ae6;})});}_0x47afb8=_[_0xa6e6('0x3a')]({},_0x47afb8,_0xca8f30[_0xa6e6('0x3d')]);return _0x3651aa['getConfigurations'](_0x47afb8);}})[_0xa6e6('0x25')](function(_0x564bd0){if(_0x564bd0){_0x52fad4=_0x564bd0[_0xa6e6('0x43')];if(!_0xca8f30[_0xa6e6('0x32')]['hasOwnProperty'](_0xa6e6('0x35'))){_0x47afb8['limit']=qs['limit'](_0xca8f30[_0xa6e6('0x32')][_0xa6e6('0x1e')]);_0x47afb8[_0xa6e6('0x1d')]=qs[_0xa6e6('0x1d')](_0xca8f30[_0xa6e6('0x32')]['offset']);}return _0x3651aa[_0xa6e6('0x48')](_0x47afb8);}})[_0xa6e6('0x25')](function(_0x370bd0){if(_0x370bd0){return _0x370bd0?{'count':_0x52fad4,'rows':_0x370bd0}:null;}})['then'](respondWithResult(_0x2e7933,null))['catch'](handleError(_0x2e7933,null));};exports[_0xa6e6('0x4b')]=function(_0x44476d,_0x69640c,_0xf50e59){if(_0x44476d[_0xa6e6('0x47')]['id']){delete _0x44476d[_0xa6e6('0x47')]['id'];}return db[_0xa6e6('0x3e')][_0xa6e6('0x49')]({'where':{'id':_0x44476d['params']['id']}})[_0xa6e6('0x25')](handleEntityNotFound(_0x69640c,null))[_0xa6e6('0x25')](function(_0x1b7500){if(_0x1b7500){_0x44476d['body']['AccountId']=_0x1b7500['id'];_0x44476d[_0xa6e6('0x47')][_0xa6e6('0x4c')]=integrations[_0xa6e6('0x4d')](_0x44476d['body']['channel'],_0x44476d[_0xa6e6('0x47')][_0xa6e6('0x2d')]);_0x44476d['body'][_0xa6e6('0x4e')]=integrations[_0xa6e6('0x4f')](_0x44476d[_0xa6e6('0x47')][_0xa6e6('0x50')],_0x44476d['body'][_0xa6e6('0x2d')]);return db[_0xa6e6('0x4a')][_0xa6e6('0x46')](_0x44476d['body'],{'include':[{'model':db[_0xa6e6('0x51')],'as':_0xa6e6('0x4c')},{'model':db[_0xa6e6('0x51')],'as':_0xa6e6('0x4e')}]});}return null;})[_0xa6e6('0x25')](respondWithResult(_0x69640c,null))[_0xa6e6('0x40')](handleError(_0x69640c,null));};function getAccessToken(_0x52aa27){return new Promise(function(_0x17f058,_0x3a50ff){var _0x539a86;switch(_0x52aa27[_0xa6e6('0x52')]){case'US':_0x539a86=_0xa6e6('0x53');break;case'AU':_0x539a86=_0xa6e6('0x54');break;case'EU':_0x539a86=_0xa6e6('0x55');break;case'IN':_0x539a86='https://accounts.zoho.in';break;case'CN':_0x539a86=_0xa6e6('0x56');break;default:_0x539a86=_0xa6e6('0x55');break;}var _0x332d14={'method':_0xa6e6('0x57'),'uri':_0x539a86+_0xa6e6('0x58'),'qs':{'refresh_token':_0x52aa27[_0xa6e6('0x59')],'client_id':_0x52aa27[_0xa6e6('0x5a')],'client_secret':_0x52aa27[_0xa6e6('0x5b')],'grant_type':_0xa6e6('0x5c')},'json':!![]};return rp(_0x332d14)[_0xa6e6('0x25')](function(_0x5f4bee){if(_0x5f4bee[_0xa6e6('0x5d')]){_0x17f058(_0x5f4bee[_0xa6e6('0x5d')]);}else{_0x3a50ff('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xa6e6('0x40')](function(_0x1e69c3){_0x3a50ff(_0x1e69c3);});});}exports[_0xa6e6('0x5e')]=function(_0x3e3acd,_0x50d50e,_0x3aad0a){var _0x20fd1d,_0x5a16e0,_0x32ff6b,_0x4adb62,_0x4f9164;return db[_0xa6e6('0x3e')][_0xa6e6('0x49')]({'where':{'id':_0x3e3acd[_0xa6e6('0x41')]['id']},'attributes':['id',_0xa6e6('0x5f'),_0xa6e6('0x52'),_0xa6e6('0x5a'),_0xa6e6('0x5b'),'serverUrl',_0xa6e6('0x60'),_0xa6e6('0x59')]})['then'](handleEntityNotFound(_0x50d50e,null))[_0xa6e6('0x25')](function(_0x88d88a){_0x4f9164=_0x88d88a;_0x20fd1d=_0x4f9164[_0xa6e6('0x5f')];_0x5a16e0=_0x20fd1d==='zoho.eu'?'eu':_0xa6e6('0x61');_0x32ff6b=_0x4f9164[_0xa6e6('0x62')];var _0x4ffa96=_0x32ff6b[_0xa6e6('0x63')](-0x1);if(_0x4ffa96==='/'||_0x4ffa96==='\x5c'||_0x4ffa96===':'){_0x32ff6b=_0x32ff6b[_0xa6e6('0x64')](0x0,_0x32ff6b[_0xa6e6('0x65')](_0x4ffa96));}if(!_0x4f9164[_0xa6e6('0x59')]){throw new Error(_0xa6e6('0x66'));}return getAccessToken(_0x4f9164);})[_0xa6e6('0x25')](function(_0x2bccc2){if(_0x2bccc2){return rp({'method':_0xa6e6('0x67'),'uri':util[_0xa6e6('0x68')](_0xa6e6('0x69'),_0x5a16e0),'qs':{'module':'Calls'},'headers':{'Authorization':_0xa6e6('0x6a')+_0x2bccc2},'json':!![]});}})[_0xa6e6('0x25')](function(_0x1a3791){if(_0x1a3791){if(_0x1a3791['response']&&_0x1a3791[_0xa6e6('0x6b')]['error']){throw new Error(_0x1a3791[_0xa6e6('0x6b')][_0xa6e6('0x27')]['message']);}var _0x2bce4f=[];var _0x1c3db8=[];var _0x49ba50=[_0xa6e6('0x6c'),_0xa6e6('0x6d'),'Description',_0xa6e6('0x6e'),_0xa6e6('0x6f'),'Call_Result',_0xa6e6('0x70'),'Call_Type'];_0x1c3db8=_[_0xa6e6('0x71')](_0x1a3791[_0xa6e6('0x42')],function(_0x5ccc61){return _0x49ba50['includes'](_0x5ccc61['api_name']);});for(var _0x45683b=0x0;_0x45683b<_0x1c3db8[_0xa6e6('0x43')];_0x45683b++){if(_0x1c3db8[_0x45683b]['system_mandatory']===![]){_0x2bce4f[_0xa6e6('0x72')]({'id':_0x1c3db8[_0x45683b]['id'],'name':_0x1c3db8[_0x45683b][_0xa6e6('0x73')],'custom':_0x1c3db8[_0x45683b][_0xa6e6('0x74')],'options':_0x1c3db8[_0x45683b][_0xa6e6('0x75')]===_0xa6e6('0x76')&&_0x1c3db8[_0x45683b]['pick_list_values'][_0xa6e6('0x43')]>-0x1?_[_0xa6e6('0x2a')](_0x1c3db8[_0x45683b]['pick_list_values'],function(_0xe08ed4){return{'name':_0xe08ed4,'value':_0xe08ed4};}):[]});}}return{'count':_0x2bce4f['length'],'rows':_0x2bce4f};}else{return{'count':0x0,'rows':[]};}})[_0xa6e6('0x25')](respondWithResult(_0x50d50e,null))['catch'](function(_0x18839f){var _0x27b172=_0x3e3acd[_0xa6e6('0x32')][_0xa6e6('0x77')]?0x1f4:_0x18839f[_0xa6e6('0x78')]||0x1f4;logger['error'](_0xa6e6('0x79'),_0xa6e6('0x5e'),_0x27b172,JSON[_0xa6e6('0x7a')](_0x18839f));delete _0x18839f[_0xa6e6('0x29')];if(_0x27b172===0x191){_0x27b172=0x190;}_0x50d50e[_0xa6e6('0x1b')](_0x27b172)[_0xa6e6('0x7b')](_0x3e3acd['query'][_0xa6e6('0x77')]?{'message':_0xa6e6('0x7c'),'statusCode':_0x18839f['statusCode']}:_0x18839f);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index eb0851b..e80710a 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 _0xf908=['clientId','code','slice','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','parse','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','clientSecret','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.eu','then','refresh_token','lodash','util','api','moment','bluebird','request-promise','path','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','zone','changed','serverUrl'];(function(_0xb8d45e,_0x263077){var _0x414d83=function(_0x3a9fec){while(--_0x3a9fec){_0xb8d45e['push'](_0xb8d45e['shift']());}};_0x414d83(++_0x263077);}(_0xf908,0x138));var _0x8f90=function(_0x3aba07,_0xff3060){_0x3aba07=_0x3aba07-0x0;var _0x2b2dd1=_0xf908[_0x3aba07];return _0x2b2dd1;};'use strict';var _=require(_0x8f90('0x0'));var util=require(_0x8f90('0x1'));var logger=require('../../config/logger')(_0x8f90('0x2'));var moment=require(_0x8f90('0x3'));var BPromise=require(_0x8f90('0x4'));var rp=require(_0x8f90('0x5'));var fs=require('fs');var path=require(_0x8f90('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8f90('0x7'));var integrations=require(_0x8f90('0x8'));module[_0x8f90('0x9')]=function(_0x31be71,_0x131c43){return _0x31be71[_0x8f90('0xa')](_0x8f90('0xb'),attributes,{'tableName':_0x8f90('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x335efc,_0x57d3c6,_0x1c4d66){if(_0x335efc['changed'](_0x8f90('0xd'))||_0x335efc[_0x8f90('0xe')](_0x8f90('0xf'))||_0x335efc[_0x8f90('0xe')](_0x8f90('0x10'))||_0x335efc[_0x8f90('0xe')]('clientSecret')||_0x335efc['changed'](_0x8f90('0x11'))||_0x335efc['changed']('host')){var _0x4d599a,_0x44c7b5;_0x4d599a=_0x335efc[_0x8f90('0xf')];var _0x3faf46=_0x4d599a[_0x8f90('0x12')](-0x1);if(_0x3faf46==='/'||_0x3faf46==='\x5c'||_0x3faf46===':'){_0x4d599a=_0x4d599a['substring'](0x0,_0x4d599a['lastIndexOf'](_0x3faf46));}switch(_0x335efc[_0x8f90('0xd')]){case'US':_0x44c7b5=_0x8f90('0x13');break;case'AU':_0x44c7b5='https://accounts.zoho.com.au';break;case'IN':_0x44c7b5=_0x8f90('0x14');break;case'CN':_0x44c7b5=_0x8f90('0x15');break;default:_0x44c7b5='https://accounts.zoho.eu';break;}var _0x198c86={'method':_0x8f90('0x16'),'uri':_0x44c7b5+_0x8f90('0x17'),'form':{'grant_type':_0x8f90('0x18'),'client_id':_0x335efc[_0x8f90('0x10')],'client_secret':_0x335efc['clientSecret'],'redirect_uri':_0x335efc[_0x8f90('0xf')],'code':_0x335efc[_0x8f90('0x11')]},'headers':{'Content-Type':_0x8f90('0x19')}};return rp(_0x198c86)['then'](function(_0xf9145c){var _0x3e3602=JSON[_0x8f90('0x1a')](_0xf9145c);if(_0x3e3602['refresh_token']){_0x335efc['refreshToken']=_0x3e3602['refresh_token'];logger[_0x8f90('0x1b')](util[_0x8f90('0x1c')](_0x8f90('0x1d'),_0x335efc[_0x8f90('0x1e')],_0x335efc['id']));}else{logger[_0x8f90('0x1f')](util[_0x8f90('0x1c')](_0x8f90('0x20'),_0x335efc[_0x8f90('0x1e')],_0x335efc['id']),util[_0x8f90('0x21')](_0x3e3602,{'showHidden':![],'depth':null}));}return _0x1c4d66(null,_0x57d3c6);})[_0x8f90('0x22')](function(_0xbce4c8){logger[_0x8f90('0x1f')](util['format'](_0x8f90('0x20'),_0x335efc['name'],_0x335efc['id']),util[_0x8f90('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x1c4d66(_0xbce4c8);});}else{return _0x1c4d66(null,_0x57d3c6);}},'beforeUpdate':function(_0x2f9f15,_0x5c68d1,_0x4daeae){if(_0x2f9f15['changed'](_0x8f90('0xd'))||_0x2f9f15[_0x8f90('0xe')](_0x8f90('0xf'))||_0x2f9f15['changed'](_0x8f90('0x10'))||_0x2f9f15[_0x8f90('0xe')](_0x8f90('0x23'))||_0x2f9f15[_0x8f90('0xe')]('code')||_0x2f9f15[_0x8f90('0xe')]('host')){var _0x27ae9b,_0x368d55;_0x27ae9b=_0x2f9f15[_0x8f90('0xf')];var _0x970a32=_0x27ae9b[_0x8f90('0x12')](-0x1);if(_0x970a32==='/'||_0x970a32==='\x5c'||_0x970a32===':'){_0x27ae9b=_0x27ae9b['substring'](0x0,_0x27ae9b[_0x8f90('0x24')](_0x970a32));}switch(_0x2f9f15['zone']){case'US':_0x368d55=_0x8f90('0x13');break;case'AU':_0x368d55=_0x8f90('0x25');break;case'IN':_0x368d55='https://accounts.zoho.in';break;case'CN':_0x368d55='https://accounts.zoho.com.cn';break;default:_0x368d55=_0x8f90('0x26');break;}var _0xb91b47={'method':_0x8f90('0x16'),'uri':_0x368d55+_0x8f90('0x17'),'form':{'grant_type':_0x8f90('0x18'),'client_id':_0x2f9f15[_0x8f90('0x10')],'client_secret':_0x2f9f15['clientSecret'],'redirect_uri':_0x2f9f15[_0x8f90('0xf')],'code':_0x2f9f15['code']},'headers':{'Content-Type':_0x8f90('0x19')}};return rp(_0xb91b47)[_0x8f90('0x27')](function(_0x50353a){var _0x169923=JSON[_0x8f90('0x1a')](_0x50353a);if(_0x169923[_0x8f90('0x28')]){_0x2f9f15['refreshToken']=_0x169923[_0x8f90('0x28')];logger[_0x8f90('0x1b')](util[_0x8f90('0x1c')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x2f9f15[_0x8f90('0x1e')],_0x2f9f15['id']));}else{logger[_0x8f90('0x1f')](util[_0x8f90('0x1c')](_0x8f90('0x20'),_0x2f9f15[_0x8f90('0x1e')],_0x2f9f15['id']),util[_0x8f90('0x21')](_0x169923,{'showHidden':![],'depth':null}));}return _0x4daeae(null,_0x5c68d1);})[_0x8f90('0x22')](function(_0x556a01){logger[_0x8f90('0x1f')](util[_0x8f90('0x1c')](_0x8f90('0x20'),_0x2f9f15[_0x8f90('0x1e')],_0x2f9f15['id']),util[_0x8f90('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x4daeae(_0x556a01);});}else{return _0x4daeae(null,_0x5c68d1);}}}});}; \ No newline at end of file +var _0x1fce=['./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','format','catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','slice','substring','https://accounts.zoho.com.au','/oauth/v2/token','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x43d16c,_0x2b5447){var _0x208cce=function(_0x371720){while(--_0x371720){_0x43d16c['push'](_0x43d16c['shift']());}};_0x208cce(++_0x2b5447);}(_0x1fce,0x1a6));var _0xe1fc=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x1fce[_0x1beef3];return _0x5af964;};'use strict';var _=require('lodash');var util=require(_0xe1fc('0x0'));var logger=require(_0xe1fc('0x1'))(_0xe1fc('0x2'));var moment=require(_0xe1fc('0x3'));var BPromise=require(_0xe1fc('0x4'));var rp=require(_0xe1fc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe1fc('0x6'));var config=require(_0xe1fc('0x7'));var attributes=require(_0xe1fc('0x8'));var integrations=require(_0xe1fc('0x9'));module[_0xe1fc('0xa')]=function(_0x5b4794,_0x299dd0){return _0x5b4794[_0xe1fc('0xb')]('ZohoAccount',attributes,{'tableName':_0xe1fc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1b5b53,_0x3a92ae,_0x32dfa2){if(_0x1b5b53[_0xe1fc('0xd')](_0xe1fc('0xe'))||_0x1b5b53[_0xe1fc('0xd')](_0xe1fc('0xf'))||_0x1b5b53[_0xe1fc('0xd')](_0xe1fc('0x10'))||_0x1b5b53[_0xe1fc('0xd')](_0xe1fc('0x11'))||_0x1b5b53[_0xe1fc('0xd')](_0xe1fc('0x12'))||_0x1b5b53[_0xe1fc('0xd')](_0xe1fc('0x13'))){var _0x558238,_0x1c54f2;_0x558238=_0x1b5b53[_0xe1fc('0xf')];var _0x2bf671=_0x558238['slice'](-0x1);if(_0x2bf671==='/'||_0x2bf671==='\x5c'||_0x2bf671===':'){_0x558238=_0x558238['substring'](0x0,_0x558238[_0xe1fc('0x14')](_0x2bf671));}switch(_0x1b5b53[_0xe1fc('0xe')]){case'US':_0x1c54f2=_0xe1fc('0x15');break;case'AU':_0x1c54f2='https://accounts.zoho.com.au';break;case'IN':_0x1c54f2=_0xe1fc('0x16');break;case'CN':_0x1c54f2=_0xe1fc('0x17');break;default:_0x1c54f2=_0xe1fc('0x18');break;}var _0x16699b={'method':_0xe1fc('0x19'),'uri':_0x1c54f2+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x1b5b53[_0xe1fc('0x10')],'client_secret':_0x1b5b53['clientSecret'],'redirect_uri':_0x1b5b53[_0xe1fc('0xf')],'code':_0x1b5b53[_0xe1fc('0x12')]},'headers':{'Content-Type':_0xe1fc('0x1a')}};return rp(_0x16699b)[_0xe1fc('0x1b')](function(_0xdd5d4){var _0x315195=JSON[_0xe1fc('0x1c')](_0xdd5d4);if(_0x315195[_0xe1fc('0x1d')]){_0x1b5b53[_0xe1fc('0x1e')]=_0x315195[_0xe1fc('0x1d')];logger['info'](util[_0xe1fc('0x1f')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1b5b53['name'],_0x1b5b53['id']));}else{logger['error'](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1b5b53['name'],_0x1b5b53['id']),util['inspect'](_0x315195,{'showHidden':![],'depth':null}));}return _0x32dfa2(null,_0x3a92ae);})[_0xe1fc('0x20')](function(_0x446f94){logger['error'](util[_0xe1fc('0x1f')](_0xe1fc('0x21'),_0x1b5b53['name'],_0x1b5b53['id']),util[_0xe1fc('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x32dfa2(_0x446f94);});}else{return _0x32dfa2(null,_0x3a92ae);}},'beforeUpdate':function(_0xc5cec8,_0x383faa,_0x39efa4){if(_0xc5cec8[_0xe1fc('0xd')](_0xe1fc('0xe'))||_0xc5cec8['changed']('serverUrl')||_0xc5cec8[_0xe1fc('0xd')]('clientId')||_0xc5cec8[_0xe1fc('0xd')](_0xe1fc('0x11'))||_0xc5cec8[_0xe1fc('0xd')](_0xe1fc('0x12'))||_0xc5cec8[_0xe1fc('0xd')]('host')){var _0x4bc3e6,_0x467fca;_0x4bc3e6=_0xc5cec8['serverUrl'];var _0x537483=_0x4bc3e6[_0xe1fc('0x23')](-0x1);if(_0x537483==='/'||_0x537483==='\x5c'||_0x537483===':'){_0x4bc3e6=_0x4bc3e6[_0xe1fc('0x24')](0x0,_0x4bc3e6['lastIndexOf'](_0x537483));}switch(_0xc5cec8[_0xe1fc('0xe')]){case'US':_0x467fca='https://accounts.zoho.com';break;case'AU':_0x467fca=_0xe1fc('0x25');break;case'IN':_0x467fca=_0xe1fc('0x16');break;case'CN':_0x467fca=_0xe1fc('0x17');break;default:_0x467fca=_0xe1fc('0x18');break;}var _0x466f8a={'method':_0xe1fc('0x19'),'uri':_0x467fca+_0xe1fc('0x26'),'form':{'grant_type':'authorization_code','client_id':_0xc5cec8[_0xe1fc('0x10')],'client_secret':_0xc5cec8[_0xe1fc('0x11')],'redirect_uri':_0xc5cec8[_0xe1fc('0xf')],'code':_0xc5cec8[_0xe1fc('0x12')]},'headers':{'Content-Type':_0xe1fc('0x1a')}};return rp(_0x466f8a)[_0xe1fc('0x1b')](function(_0x319f6e){var _0x444a57=JSON[_0xe1fc('0x1c')](_0x319f6e);if(_0x444a57['refresh_token']){_0xc5cec8[_0xe1fc('0x1e')]=_0x444a57[_0xe1fc('0x1d')];logger[_0xe1fc('0x27')](util[_0xe1fc('0x1f')](_0xe1fc('0x28'),_0xc5cec8[_0xe1fc('0x29')],_0xc5cec8['id']));}else{logger['error'](util[_0xe1fc('0x1f')](_0xe1fc('0x21'),_0xc5cec8['name'],_0xc5cec8['id']),util[_0xe1fc('0x22')](_0x444a57,{'showHidden':![],'depth':null}));}return _0x39efa4(null,_0x383faa);})[_0xe1fc('0x20')](function(_0x5294a2){logger[_0xe1fc('0x2a')](util[_0xe1fc('0x1f')](_0xe1fc('0x21'),_0xc5cec8[_0xe1fc('0x29')],_0xc5cec8['id']),util[_0xe1fc('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x39efa4(_0x5294a2);});}else{return _0x39efa4(null,_0x383faa);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index fc1b0d4..b334863 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 _0x5a13=['findAll','options','raw','include','map','model','attributes','debug','find','ShowZohoAccount','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','stringify','code','message','error','info','result','catch','GetZohoAccount','ZohoAccount'];(function(_0x262ff0,_0x1874f4){var _0x128141=function(_0x2d8344){while(--_0x2d8344){_0x262ff0['push'](_0x262ff0['shift']());}};_0x128141(++_0x1874f4);}(_0x5a13,0x145));var _0x35a1=function(_0x1630cd,_0x28f976){_0x1630cd=_0x1630cd-0x0;var _0x49b480=_0x5a13[_0x1630cd];return _0x49b480;};'use strict';var _=require(_0x35a1('0x0'));var util=require(_0x35a1('0x1'));var moment=require('moment');var BPromise=require(_0x35a1('0x2'));var rs=require(_0x35a1('0x3'));var fs=require('fs');var Redis=require(_0x35a1('0x4'));var db=require(_0x35a1('0x5'))['db'];var utils=require(_0x35a1('0x6'));var logger=require(_0x35a1('0x7'))(_0x35a1('0x8'));var config=require(_0x35a1('0x9'));var jayson=require(_0x35a1('0xa'));var client=jayson[_0x35a1('0xb')][_0x35a1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x407b26,_0x10a34f,_0x3aa00e){return new BPromise(function(_0x58afca,_0x57d9fd){return client['request'](_0x407b26,_0x3aa00e)[_0x35a1('0xd')](function(_0x103ec8){logger['info'](_0x35a1('0xe'),_0x10a34f,_0x35a1('0xf'));logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x10a34f,_0x35a1('0xf'),JSON[_0x35a1('0x10')](_0x103ec8));if(_0x103ec8['error']){if(_0x103ec8['error'][_0x35a1('0x11')]===0x1f4){logger['error'](_0x35a1('0xe'),_0x10a34f,_0x103ec8['error'][_0x35a1('0x12')]);return _0x57d9fd(_0x103ec8[_0x35a1('0x13')][_0x35a1('0x12')]);}logger[_0x35a1('0x13')](_0x35a1('0xe'),_0x10a34f,_0x103ec8[_0x35a1('0x13')][_0x35a1('0x12')]);return _0x58afca(_0x103ec8[_0x35a1('0x13')][_0x35a1('0x12')]);}else{logger[_0x35a1('0x14')](_0x35a1('0xe'),_0x10a34f,_0x35a1('0xf'));_0x58afca(_0x103ec8[_0x35a1('0x15')][_0x35a1('0x12')]);}})[_0x35a1('0x16')](function(_0x251d32){logger[_0x35a1('0x13')](_0x35a1('0xe'),_0x10a34f,_0x251d32);_0x57d9fd(_0x251d32);});});}exports[_0x35a1('0x17')]=function(_0x1de373){var _0x5e4317=this;return new Promise(function(_0x3b17dc,_0xbeb751){return db[_0x35a1('0x18')][_0x35a1('0x19')]({'raw':_0x1de373[_0x35a1('0x1a')]?_0x1de373[_0x35a1('0x1a')][_0x35a1('0x1b')]===undefined?!![]:![]:!![],'where':_0x1de373[_0x35a1('0x1a')]?_0x1de373[_0x35a1('0x1a')]['where']||null:null,'attributes':_0x1de373[_0x35a1('0x1a')]?_0x1de373[_0x35a1('0x1a')]['attributes']||null:null,'limit':_0x1de373[_0x35a1('0x1a')]?_0x1de373[_0x35a1('0x1a')]['limit']||null:null,'include':_0x1de373[_0x35a1('0x1a')]?_0x1de373['options'][_0x35a1('0x1c')]?_[_0x35a1('0x1d')](_0x1de373[_0x35a1('0x1a')]['include'],function(_0x1ced16){return{'model':db[_0x1ced16[_0x35a1('0x1e')]],'as':_0x1ced16['as'],'attributes':_0x1ced16['attributes'],'include':_0x1ced16['include']?_['map'](_0x1ced16[_0x35a1('0x1c')],function(_0x51f5bd){return{'model':db[_0x51f5bd['model']],'as':_0x51f5bd['as'],'attributes':_0x51f5bd['attributes'],'include':_0x51f5bd[_0x35a1('0x1c')]?_[_0x35a1('0x1d')](_0x51f5bd[_0x35a1('0x1c')],function(_0x3f1563){return{'model':db[_0x3f1563['model']],'as':_0x3f1563['as'],'attributes':_0x3f1563[_0x35a1('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x35a1('0xd')](function(_0x3c552c){logger[_0x35a1('0x14')](_0x35a1('0x17'),_0x1de373);logger[_0x35a1('0x20')](_0x35a1('0x17'),_0x1de373,JSON[_0x35a1('0x10')](_0x3c552c));_0x3b17dc(_0x3c552c);})[_0x35a1('0x16')](function(_0x381bcc){logger[_0x35a1('0x13')](_0x35a1('0x17'),_0x381bcc[_0x35a1('0x12')],_0x1de373);_0xbeb751(_0x5e4317[_0x35a1('0x13')](0x1f4,_0x381bcc[_0x35a1('0x12')]));});});};exports['ShowZohoAccount']=function(_0x9720a4){var _0x379819=this;return new Promise(function(_0x10b65e,_0xd79e92){return db[_0x35a1('0x18')][_0x35a1('0x21')]({'raw':_0x9720a4[_0x35a1('0x1a')]?_0x9720a4[_0x35a1('0x1a')][_0x35a1('0x1b')]===undefined?!![]:![]:!![],'where':_0x9720a4[_0x35a1('0x1a')]?_0x9720a4[_0x35a1('0x1a')]['where']||null:null,'attributes':_0x9720a4['options']?_0x9720a4[_0x35a1('0x1a')]['attributes']||null:null,'include':_0x9720a4[_0x35a1('0x1a')]?_0x9720a4['options'][_0x35a1('0x1c')]?_[_0x35a1('0x1d')](_0x9720a4[_0x35a1('0x1a')][_0x35a1('0x1c')],function(_0x7b0d18){return{'model':db[_0x7b0d18[_0x35a1('0x1e')]],'as':_0x7b0d18['as'],'attributes':_0x7b0d18[_0x35a1('0x1f')],'include':_0x7b0d18[_0x35a1('0x1c')]?_[_0x35a1('0x1d')](_0x7b0d18[_0x35a1('0x1c')],function(_0x25d757){return{'model':db[_0x25d757['model']],'as':_0x25d757['as'],'attributes':_0x25d757[_0x35a1('0x1f')],'include':_0x25d757[_0x35a1('0x1c')]?_[_0x35a1('0x1d')](_0x25d757['include'],function(_0x5a416d){return{'model':db[_0x5a416d['model']],'as':_0x5a416d['as'],'attributes':_0x5a416d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x52e748){logger[_0x35a1('0x14')](_0x35a1('0x22'),_0x9720a4);logger[_0x35a1('0x20')](_0x35a1('0x22'),_0x9720a4,JSON[_0x35a1('0x10')](_0x52e748));_0x10b65e(_0x52e748);})[_0x35a1('0x16')](function(_0x2e102b){logger[_0x35a1('0x13')]('ShowZohoAccount',_0x2e102b[_0x35a1('0x12')],_0x9720a4);_0xd79e92(_0x379819['error'](0x1f4,_0x2e102b[_0x35a1('0x12')]));});});}; \ No newline at end of file +var _0x0b7f=['then','info','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','ZohoAccount,\x20%s,\x20%s','message','request\x20sent','result','GetZohoAccount','ZohoAccount','findAll','options','where','attributes','limit','include','map','model','debug','catch','ShowZohoAccount','find','raw','stringify','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request'];(function(_0x5bf4fc,_0x1bda13){var _0x265565=function(_0xdd0932){while(--_0xdd0932){_0x5bf4fc['push'](_0x5bf4fc['shift']());}};_0x265565(++_0x1bda13);}(_0x0b7f,0x115));var _0xf0b7=function(_0x489b02,_0x3c3896){_0x489b02=_0x489b02-0x0;var _0xe0a94b=_0x0b7f[_0x489b02];return _0xe0a94b;};'use strict';var _=require(_0xf0b7('0x0'));var util=require(_0xf0b7('0x1'));var moment=require('moment');var BPromise=require(_0xf0b7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf0b7('0x3'));var db=require(_0xf0b7('0x4'))['db'];var utils=require(_0xf0b7('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf0b7('0x6'));var jayson=require(_0xf0b7('0x7'));var client=jayson[_0xf0b7('0x8')][_0xf0b7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b2de8,_0x5e449a,_0x1408ee){return new BPromise(function(_0x276f09,_0x275a13){return client[_0xf0b7('0xa')](_0x2b2de8,_0x1408ee)[_0xf0b7('0xb')](function(_0x588b46){logger[_0xf0b7('0xc')]('ZohoAccount,\x20%s,\x20%s',_0x5e449a,'request\x20sent');logger['debug'](_0xf0b7('0xd'),_0x5e449a,'request\x20sent',JSON['stringify'](_0x588b46));if(_0x588b46[_0xf0b7('0xe')]){if(_0x588b46[_0xf0b7('0xe')][_0xf0b7('0xf')]===0x1f4){logger[_0xf0b7('0xe')](_0xf0b7('0x10'),_0x5e449a,_0x588b46[_0xf0b7('0xe')][_0xf0b7('0x11')]);return _0x275a13(_0x588b46[_0xf0b7('0xe')]['message']);}logger['error'](_0xf0b7('0x10'),_0x5e449a,_0x588b46[_0xf0b7('0xe')][_0xf0b7('0x11')]);return _0x276f09(_0x588b46[_0xf0b7('0xe')][_0xf0b7('0x11')]);}else{logger['info'](_0xf0b7('0x10'),_0x5e449a,_0xf0b7('0x12'));_0x276f09(_0x588b46[_0xf0b7('0x13')][_0xf0b7('0x11')]);}})['catch'](function(_0x303db6){logger[_0xf0b7('0xe')](_0xf0b7('0x10'),_0x5e449a,_0x303db6);_0x275a13(_0x303db6);});});}exports[_0xf0b7('0x14')]=function(_0x52b27e){var _0x1e5fc9=this;return new Promise(function(_0x153d23,_0x28fd36){return db[_0xf0b7('0x15')][_0xf0b7('0x16')]({'raw':_0x52b27e['options']?_0x52b27e[_0xf0b7('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x52b27e[_0xf0b7('0x17')]?_0x52b27e[_0xf0b7('0x17')][_0xf0b7('0x18')]||null:null,'attributes':_0x52b27e['options']?_0x52b27e['options'][_0xf0b7('0x19')]||null:null,'limit':_0x52b27e[_0xf0b7('0x17')]?_0x52b27e[_0xf0b7('0x17')][_0xf0b7('0x1a')]||null:null,'include':_0x52b27e[_0xf0b7('0x17')]?_0x52b27e[_0xf0b7('0x17')][_0xf0b7('0x1b')]?_[_0xf0b7('0x1c')](_0x52b27e[_0xf0b7('0x17')]['include'],function(_0x1b8e95){return{'model':db[_0x1b8e95[_0xf0b7('0x1d')]],'as':_0x1b8e95['as'],'attributes':_0x1b8e95[_0xf0b7('0x19')],'include':_0x1b8e95[_0xf0b7('0x1b')]?_[_0xf0b7('0x1c')](_0x1b8e95[_0xf0b7('0x1b')],function(_0x4724f1){return{'model':db[_0x4724f1[_0xf0b7('0x1d')]],'as':_0x4724f1['as'],'attributes':_0x4724f1[_0xf0b7('0x19')],'include':_0x4724f1[_0xf0b7('0x1b')]?_['map'](_0x4724f1[_0xf0b7('0x1b')],function(_0x4d0c61){return{'model':db[_0x4d0c61['model']],'as':_0x4d0c61['as'],'attributes':_0x4d0c61[_0xf0b7('0x19')]};}):[]};}):[]};}):[]:[]})[_0xf0b7('0xb')](function(_0x3709a5){logger['info'](_0xf0b7('0x14'),_0x52b27e);logger[_0xf0b7('0x1e')](_0xf0b7('0x14'),_0x52b27e,JSON['stringify'](_0x3709a5));_0x153d23(_0x3709a5);})[_0xf0b7('0x1f')](function(_0x2773ce){logger[_0xf0b7('0xe')](_0xf0b7('0x14'),_0x2773ce[_0xf0b7('0x11')],_0x52b27e);_0x28fd36(_0x1e5fc9[_0xf0b7('0xe')](0x1f4,_0x2773ce[_0xf0b7('0x11')]));});});};exports[_0xf0b7('0x20')]=function(_0x3cb0ef){var _0x976a8b=this;return new Promise(function(_0x559510,_0xd89848){return db[_0xf0b7('0x15')][_0xf0b7('0x21')]({'raw':_0x3cb0ef['options']?_0x3cb0ef[_0xf0b7('0x17')][_0xf0b7('0x22')]===undefined?!![]:![]:!![],'where':_0x3cb0ef[_0xf0b7('0x17')]?_0x3cb0ef[_0xf0b7('0x17')][_0xf0b7('0x18')]||null:null,'attributes':_0x3cb0ef[_0xf0b7('0x17')]?_0x3cb0ef[_0xf0b7('0x17')][_0xf0b7('0x19')]||null:null,'include':_0x3cb0ef[_0xf0b7('0x17')]?_0x3cb0ef['options'][_0xf0b7('0x1b')]?_['map'](_0x3cb0ef['options'][_0xf0b7('0x1b')],function(_0x4f14dd){return{'model':db[_0x4f14dd[_0xf0b7('0x1d')]],'as':_0x4f14dd['as'],'attributes':_0x4f14dd[_0xf0b7('0x19')],'include':_0x4f14dd[_0xf0b7('0x1b')]?_[_0xf0b7('0x1c')](_0x4f14dd['include'],function(_0x4142c9){return{'model':db[_0x4142c9[_0xf0b7('0x1d')]],'as':_0x4142c9['as'],'attributes':_0x4142c9[_0xf0b7('0x19')],'include':_0x4142c9[_0xf0b7('0x1b')]?_['map'](_0x4142c9[_0xf0b7('0x1b')],function(_0x4d47b6){return{'model':db[_0x4d47b6['model']],'as':_0x4d47b6['as'],'attributes':_0x4d47b6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a90f6){logger[_0xf0b7('0xc')](_0xf0b7('0x20'),_0x3cb0ef);logger[_0xf0b7('0x1e')](_0xf0b7('0x20'),_0x3cb0ef,JSON[_0xf0b7('0x23')](_0x4a90f6));_0x559510(_0x4a90f6);})[_0xf0b7('0x1f')](function(_0x3b105c){logger[_0xf0b7('0xe')](_0xf0b7('0x20'),_0x3b105c['message'],_0x3cb0ef);_0xd89848(_0x976a8b[_0xf0b7('0xe')](0x1f4,_0x3b105c['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 50221b7..9629496 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 _0xff31=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','/:id','show','/:id/fields','isAuthenticated'];(function(_0x2f2c6c,_0x5b39ec){var _0x37ae10=function(_0x42d115){while(--_0x42d115){_0x2f2c6c['push'](_0x2f2c6c['shift']());}};_0x37ae10(++_0x5b39ec);}(_0xff31,0x1d2));var _0x1ff3=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xff31[_0x618414];return _0x21c19a;};'use strict';var multer=require(_0x1ff3('0x0'));var util=require(_0x1ff3('0x1'));var path=require(_0x1ff3('0x2'));var timeout=require(_0x1ff3('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1ff3('0x4'));var auth=require(_0x1ff3('0x5'));var interaction=require(_0x1ff3('0x6'));var config=require(_0x1ff3('0x7'));var controller=require(_0x1ff3('0x8'));router[_0x1ff3('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1ff3('0x9')](_0x1ff3('0xa'),auth['isAuthenticated'](),controller[_0x1ff3('0xb')]);router[_0x1ff3('0x9')](_0x1ff3('0xc'),auth[_0x1ff3('0xd')](),controller['getFields']);router[_0x1ff3('0x9')](_0x1ff3('0xe'),auth['isAuthenticated'](),controller[_0x1ff3('0xf')]);router[_0x1ff3('0x9')](_0x1ff3('0x10'),auth[_0x1ff3('0xd')](),controller[_0x1ff3('0x11')]);router[_0x1ff3('0x12')]('/',auth[_0x1ff3('0xd')](),controller[_0x1ff3('0x13')]);router[_0x1ff3('0x14')]('/:id',auth[_0x1ff3('0xd')](),controller[_0x1ff3('0x15')]);router[_0x1ff3('0x16')]('/:id',auth[_0x1ff3('0xd')](),controller[_0x1ff3('0x17')]);module['exports']=router; \ No newline at end of file +var _0x565a=['isAuthenticated','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x565a,0xbc));var _0xa565=function(_0x4df6c6,_0x4cddf8){_0x4df6c6=_0x4df6c6-0x0;var _0x2fb6bb=_0x565a[_0x4df6c6];return _0x2fb6bb;};'use strict';var multer=require(_0xa565('0x0'));var util=require(_0xa565('0x1'));var path=require(_0xa565('0x2'));var timeout=require(_0xa565('0x3'));var express=require(_0xa565('0x4'));var router=express[_0xa565('0x5')]();var fs_extra=require(_0xa565('0x6'));var auth=require(_0xa565('0x7'));var interaction=require(_0xa565('0x8'));var config=require(_0xa565('0x9'));var controller=require(_0xa565('0xa'));router[_0xa565('0xb')]('/',auth[_0xa565('0xc')](),controller['index']);router[_0xa565('0xb')]('/:id',auth[_0xa565('0xc')](),controller[_0xa565('0xd')]);router['get'](_0xa565('0xe'),auth['isAuthenticated'](),controller['getFields']);router[_0xa565('0xb')]('/:id/subjects',auth[_0xa565('0xc')](),controller[_0xa565('0xf')]);router[_0xa565('0xb')](_0xa565('0x10'),auth[_0xa565('0xc')](),controller[_0xa565('0x11')]);router[_0xa565('0x12')]('/',auth['isAuthenticated'](),controller[_0xa565('0x13')]);router[_0xa565('0x14')](_0xa565('0x15'),auth[_0xa565('0xc')](),controller['update']);router[_0xa565('0x16')](_0xa565('0x15'),auth['isAuthenticated'](),controller[_0xa565('0x17')]);module[_0xa565('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index e912c0b..06aa457 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 _0xe826=['STRING','lead','contact','nothing','ENUM','contact_lead','sequelize','exports'];(function(_0x119705,_0xba9427){var _0x2affc2=function(_0x16f7e2){while(--_0x16f7e2){_0x119705['push'](_0x119705['shift']());}};_0x2affc2(++_0xba9427);}(_0xe826,0x14e));var _0x6e82=function(_0x314bb5,_0x476e6a){_0x314bb5=_0x314bb5-0x0;var _0x32c85e=_0xe826[_0x314bb5];return _0x32c85e;};'use strict';var Sequelize=require(_0x6e82('0x0'));module[_0x6e82('0x1')]={'name':{'type':Sequelize[_0x6e82('0x2')]},'moduleCreate':{'type':Sequelize['ENUM'](_0x6e82('0x3'),_0x6e82('0x4'),_0x6e82('0x5')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0x6e82('0x6')](_0x6e82('0x7'),_0x6e82('0x4'),_0x6e82('0x3')),'defaultValue':_0x6e82('0x7')},'description':{'type':Sequelize[_0x6e82('0x2')]}}; \ No newline at end of file +var _0x4d29=['STRING','sequelize','ENUM','nothing','lead','contact_lead','contact'];(function(_0x47d6dc,_0xc036cc){var _0x1a1c93=function(_0x18ec96){while(--_0x18ec96){_0x47d6dc['push'](_0x47d6dc['shift']());}};_0x1a1c93(++_0xc036cc);}(_0x4d29,0x13c));var _0x94d2=function(_0x2a082f,_0x54f442){_0x2a082f=_0x2a082f-0x0;var _0x298453=_0x4d29[_0x2a082f];return _0x298453;};'use strict';var Sequelize=require(_0x94d2('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x94d2('0x1')]('lead','contact',_0x94d2('0x2')),'defaultValue':_0x94d2('0x3')},'moduleSearch':{'type':Sequelize[_0x94d2('0x1')](_0x94d2('0x4'),_0x94d2('0x5'),'lead'),'defaultValue':_0x94d2('0x4')},'description':{'type':Sequelize[_0x94d2('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 4fa119f..2fed6d4 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 _0xfe88=['path','sox','ejs','fs-extra','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','destroy','then','error','stack','send','map','rawAttributes','fieldName','type','name','keys','query','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','ZohoConfiguration','findAll','rows','catch','show','params','find','create','body','getFields','hasOwnProperty','findOne','ZohoField','getSubjects','getDescriptions','eml-format','zip-dir','moment','bluebird','mustache','util'];(function(_0x435c33,_0x48c69b){var _0x3f61c3=function(_0x49f0a0){while(--_0x49f0a0){_0x435c33['push'](_0x435c33['shift']());}};_0x3f61c3(++_0x48c69b);}(_0xfe88,0x176));var _0x8fe8=function(_0x358bf3,_0x40ec1f){_0x358bf3=_0x358bf3-0x0;var _0x248106=_0xfe88[_0x358bf3];return _0x248106;};'use strict';var emlformat=require(_0x8fe8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8fe8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8fe8('0x2'));var BPromise=require(_0x8fe8('0x3'));var Mustache=require(_0x8fe8('0x4'));var util=require(_0x8fe8('0x5'));var path=require(_0x8fe8('0x6'));var sox=require(_0x8fe8('0x7'));var csv=require('to-csv');var ejs=require(_0x8fe8('0x8'));var fs=require('fs');var fs_extra=require(_0x8fe8('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8fe8('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x8fe8('0xb'));var toCsv=require(_0x8fe8('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8fe8('0xd'));var authService=require(_0x8fe8('0xe'));var qs=require(_0x8fe8('0xf'));var as=require(_0x8fe8('0x10'));var hardwareService=require(_0x8fe8('0x11'));var logger=require(_0x8fe8('0x12'))('api');var utils=require(_0x8fe8('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x8fe8('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x16c7fa,_0x1dc42a){_0x1dc42a=_0x1dc42a||0xcc;return function(_0x306177){if(_0x306177){return _0x16c7fa['sendStatus'](_0x1dc42a);}return _0x16c7fa['status'](_0x1dc42a)['end']();};}function respondWithResult(_0x16ffff,_0x4ad501){_0x4ad501=_0x4ad501||0xc8;return function(_0x2bd747){if(_0x2bd747){return _0x16ffff[_0x8fe8('0x15')](_0x4ad501)[_0x8fe8('0x16')](_0x2bd747);}};}function respondWithFilteredResult(_0x2042dd,_0x44b9ca){return function(_0x4e800f){if(_0x4e800f){var _0x3590a1=typeof _0x44b9ca[_0x8fe8('0x17')]===_0x8fe8('0x18')&&typeof _0x44b9ca['limit']===_0x8fe8('0x18');var _0x5348ca=_0x4e800f[_0x8fe8('0x19')];var _0xf0841f=_0x3590a1?0x0:_0x44b9ca[_0x8fe8('0x17')];var _0x319491=_0x3590a1?_0x4e800f[_0x8fe8('0x19')]:_0x44b9ca[_0x8fe8('0x17')]+_0x44b9ca[_0x8fe8('0x1a')];var _0x5867a1;if(_0x319491>=_0x5348ca){_0x319491=_0x5348ca;_0x5867a1=0xc8;}else{_0x5867a1=0xce;}_0x2042dd[_0x8fe8('0x15')](_0x5867a1);return _0x2042dd[_0x8fe8('0x1b')](_0x8fe8('0x1c'),_0xf0841f+'-'+_0x319491+'/'+_0x5348ca)[_0x8fe8('0x16')](_0x4e800f);}return null;};}function patchUpdates(_0x2c53d1){return function(_0x19fde2){try{jsonpatch[_0x8fe8('0x1d')](_0x19fde2,_0x2c53d1,!![]);}catch(_0x2560d6){return BPromise[_0x8fe8('0x1e')](_0x2560d6);}return _0x19fde2['save']();};}function saveUpdates(_0x470a27,_0x70c754){return function(_0x52f542){if(_0x52f542){return _0x52f542[_0x8fe8('0x1f')](_0x470a27)['then'](function(_0x161cd8){return _0x161cd8;});}return null;};}function removeEntity(_0x5c3e7b,_0x440812){return function(_0x49831d){if(_0x49831d){return _0x49831d[_0x8fe8('0x20')]()[_0x8fe8('0x21')](function(){_0x5c3e7b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x54ba32,_0x350287){return function(_0x5b0a9f){if(!_0x5b0a9f){_0x54ba32['sendStatus'](0x194);}return _0x5b0a9f;};}function handleError(_0x155f97,_0x6f5f85){_0x6f5f85=_0x6f5f85||0x1f4;return function(_0x54b56f){logger[_0x8fe8('0x22')](_0x54b56f[_0x8fe8('0x23')]);if(_0x54b56f['name']){delete _0x54b56f['name'];}_0x155f97[_0x8fe8('0x15')](_0x6f5f85)[_0x8fe8('0x24')](_0x54b56f);};}exports['index']=function(_0x273afb,_0x27f0d9){var _0x3b9871={},_0x776c32={},_0x424e37={'count':0x0,'rows':[]};var _0x5b39ef=_[_0x8fe8('0x25')](db['ZohoConfiguration'][_0x8fe8('0x26')],function(_0x633b35){return{'name':_0x633b35[_0x8fe8('0x27')],'type':_0x633b35[_0x8fe8('0x28')]['key']};});_0x776c32['model']=_[_0x8fe8('0x25')](_0x5b39ef,_0x8fe8('0x29'));_0x776c32['query']=_[_0x8fe8('0x2a')](_0x273afb[_0x8fe8('0x2b')]);_0x776c32['filters']=_[_0x8fe8('0x2c')](_0x776c32[_0x8fe8('0x2d')],_0x776c32['query']);_0x3b9871[_0x8fe8('0x2e')]=_[_0x8fe8('0x2c')](_0x776c32[_0x8fe8('0x2d')],qs[_0x8fe8('0x2f')](_0x273afb[_0x8fe8('0x2b')][_0x8fe8('0x2f')]));_0x3b9871[_0x8fe8('0x2e')]=_0x3b9871[_0x8fe8('0x2e')][_0x8fe8('0x30')]?_0x3b9871['attributes']:_0x776c32[_0x8fe8('0x2d')];if(!_0x273afb[_0x8fe8('0x2b')]['hasOwnProperty'](_0x8fe8('0x31'))){_0x3b9871[_0x8fe8('0x1a')]=qs['limit'](_0x273afb[_0x8fe8('0x2b')][_0x8fe8('0x1a')]);_0x3b9871[_0x8fe8('0x17')]=qs[_0x8fe8('0x17')](_0x273afb[_0x8fe8('0x2b')][_0x8fe8('0x17')]);}_0x3b9871[_0x8fe8('0x32')]=qs[_0x8fe8('0x33')](_0x273afb[_0x8fe8('0x2b')][_0x8fe8('0x33')]);_0x3b9871[_0x8fe8('0x34')]=qs['filters'](_[_0x8fe8('0x35')](_0x273afb['query'],_0x776c32[_0x8fe8('0x36')]),_0x5b39ef);if(_0x273afb[_0x8fe8('0x2b')][_0x8fe8('0x37')]){_0x3b9871[_0x8fe8('0x34')]=_['merge'](_0x3b9871['where'],{'$or':_[_0x8fe8('0x25')](_0x5b39ef,function(_0x527cec){if(_0x527cec[_0x8fe8('0x28')]!==_0x8fe8('0x38')){var _0x58dba1={};_0x58dba1[_0x527cec[_0x8fe8('0x29')]]={'$like':'%'+_0x273afb['query'][_0x8fe8('0x37')]+'%'};return _0x58dba1;}})});}_0x3b9871=_[_0x8fe8('0x39')]({},_0x3b9871,_0x273afb[_0x8fe8('0x3a')]);var _0x1f6fbe={'where':_0x3b9871[_0x8fe8('0x34')]};return db['ZohoConfiguration'][_0x8fe8('0x19')](_0x1f6fbe)['then'](function(_0x174f92){_0x424e37['count']=_0x174f92;if(_0x273afb[_0x8fe8('0x2b')][_0x8fe8('0x3b')]){_0x3b9871[_0x8fe8('0x3c')]=[{'all':!![]}];}return db[_0x8fe8('0x3d')][_0x8fe8('0x3e')](_0x3b9871);})['then'](function(_0x129bb0){_0x424e37[_0x8fe8('0x3f')]=_0x129bb0;return _0x424e37;})[_0x8fe8('0x21')](respondWithFilteredResult(_0x27f0d9,_0x3b9871))[_0x8fe8('0x40')](handleError(_0x27f0d9,null));};exports[_0x8fe8('0x41')]=function(_0x48039a,_0x115741){var _0x6cb189={'raw':![],'where':{'id':_0x48039a[_0x8fe8('0x42')]['id']}},_0x42a2e0={};_0x42a2e0[_0x8fe8('0x2d')]=_[_0x8fe8('0x2a')](db[_0x8fe8('0x3d')][_0x8fe8('0x26')]);_0x42a2e0[_0x8fe8('0x2b')]=_[_0x8fe8('0x2a')](_0x48039a[_0x8fe8('0x2b')]);_0x42a2e0[_0x8fe8('0x36')]=_[_0x8fe8('0x2c')](_0x42a2e0[_0x8fe8('0x2d')],_0x42a2e0[_0x8fe8('0x2b')]);_0x6cb189[_0x8fe8('0x2e')]=_[_0x8fe8('0x2c')](_0x42a2e0[_0x8fe8('0x2d')],qs['fields'](_0x48039a[_0x8fe8('0x2b')][_0x8fe8('0x2f')]));_0x6cb189[_0x8fe8('0x2e')]=_0x6cb189['attributes'][_0x8fe8('0x30')]?_0x6cb189[_0x8fe8('0x2e')]:_0x42a2e0[_0x8fe8('0x2d')];if(_0x48039a[_0x8fe8('0x2b')][_0x8fe8('0x3b')]){_0x6cb189[_0x8fe8('0x3c')]=[{'all':!![]}];}_0x6cb189=_[_0x8fe8('0x39')]({},_0x6cb189,_0x48039a['options']);return db[_0x8fe8('0x3d')][_0x8fe8('0x43')](_0x6cb189)[_0x8fe8('0x21')](handleEntityNotFound(_0x115741,null))[_0x8fe8('0x21')](respondWithResult(_0x115741,null))['catch'](handleError(_0x115741,null));};exports[_0x8fe8('0x44')]=function(_0x7f9dc6,_0x1d6c4b){return db[_0x8fe8('0x3d')][_0x8fe8('0x44')](_0x7f9dc6[_0x8fe8('0x45')],{})[_0x8fe8('0x21')](respondWithResult(_0x1d6c4b,0xc9))[_0x8fe8('0x40')](handleError(_0x1d6c4b,null));};exports[_0x8fe8('0x1f')]=function(_0x4d0bca,_0x389123){if(_0x4d0bca[_0x8fe8('0x45')]['id']){delete _0x4d0bca[_0x8fe8('0x45')]['id'];}return db['ZohoConfiguration'][_0x8fe8('0x43')]({'where':{'id':_0x4d0bca[_0x8fe8('0x42')]['id']}})[_0x8fe8('0x21')](handleEntityNotFound(_0x389123,null))[_0x8fe8('0x21')](saveUpdates(_0x4d0bca[_0x8fe8('0x45')],null))[_0x8fe8('0x21')](respondWithResult(_0x389123,null))[_0x8fe8('0x40')](handleError(_0x389123,null));};exports[_0x8fe8('0x20')]=function(_0x74ad76,_0x37c1e9){return db[_0x8fe8('0x3d')][_0x8fe8('0x43')]({'where':{'id':_0x74ad76['params']['id']}})[_0x8fe8('0x21')](handleEntityNotFound(_0x37c1e9,null))[_0x8fe8('0x21')](removeEntity(_0x37c1e9,null))[_0x8fe8('0x40')](handleError(_0x37c1e9,null));};exports[_0x8fe8('0x46')]=function(_0x5749bf,_0x10feb3,_0x31d0e1){var _0x45de18={};var _0xab651c={};var _0x2379f0;var _0x43b3b7;return db[_0x8fe8('0x3d')]['findOne']({'where':{'id':_0x5749bf[_0x8fe8('0x42')]['id']}})[_0x8fe8('0x21')](handleEntityNotFound(_0x10feb3,null))[_0x8fe8('0x21')](function(_0x704fcd){if(_0x704fcd){_0x2379f0=_0x704fcd;_0xab651c['model']=_[_0x8fe8('0x2a')](db['ZohoField']['rawAttributes']);_0xab651c['query']=_[_0x8fe8('0x2a')](_0x5749bf['query']);_0xab651c[_0x8fe8('0x36')]=_[_0x8fe8('0x2c')](_0xab651c[_0x8fe8('0x2d')],_0xab651c[_0x8fe8('0x2b')]);_0x45de18[_0x8fe8('0x2e')]=_[_0x8fe8('0x2c')](_0xab651c[_0x8fe8('0x2d')],qs[_0x8fe8('0x2f')](_0x5749bf[_0x8fe8('0x2b')][_0x8fe8('0x2f')]));_0x45de18[_0x8fe8('0x2e')]=_0x45de18[_0x8fe8('0x2e')]['length']?_0x45de18[_0x8fe8('0x2e')]:_0xab651c[_0x8fe8('0x2d')];_0x45de18[_0x8fe8('0x32')]=qs[_0x8fe8('0x33')](_0x5749bf['query']['sort']);_0x45de18[_0x8fe8('0x34')]=qs[_0x8fe8('0x36')](_[_0x8fe8('0x35')](_0x5749bf[_0x8fe8('0x2b')],_0xab651c[_0x8fe8('0x36')]));if(_0x5749bf[_0x8fe8('0x2b')][_0x8fe8('0x37')]){_0x45de18[_0x8fe8('0x34')]=_['merge'](_0x45de18['where'],{'$or':_[_0x8fe8('0x25')](_0x45de18[_0x8fe8('0x2e')],function(_0x3be0e3){var _0x1e1a76={};_0x1e1a76[_0x3be0e3]={'$like':'%'+_0x5749bf['query'][_0x8fe8('0x37')]+'%'};return _0x1e1a76;})});}_0x45de18=_[_0x8fe8('0x39')]({},_0x45de18,_0x5749bf[_0x8fe8('0x3a')]);return _0x2379f0[_0x8fe8('0x46')](_0x45de18);}})['then'](function(_0x73ab01){if(_0x73ab01){_0x43b3b7=_0x73ab01[_0x8fe8('0x30')];if(!_0x5749bf[_0x8fe8('0x2b')][_0x8fe8('0x47')](_0x8fe8('0x31'))){_0x45de18['limit']=qs[_0x8fe8('0x1a')](_0x5749bf['query'][_0x8fe8('0x1a')]);_0x45de18['offset']=qs[_0x8fe8('0x17')](_0x5749bf[_0x8fe8('0x2b')][_0x8fe8('0x17')]);}return _0x2379f0['getFields'](_0x45de18);}})[_0x8fe8('0x21')](function(_0x158dc7){if(_0x158dc7){return _0x158dc7?{'count':_0x43b3b7,'rows':_0x158dc7}:null;}})[_0x8fe8('0x21')](respondWithResult(_0x10feb3,null))[_0x8fe8('0x40')](handleError(_0x10feb3,null));};exports['getSubjects']=function(_0x443cac,_0x21996d,_0x35b6a8){var _0x1393a9={};var _0x4d6398={};var _0x3f0b67;var _0x5bcc7f;return db[_0x8fe8('0x3d')][_0x8fe8('0x48')]({'where':{'id':_0x443cac[_0x8fe8('0x42')]['id']}})[_0x8fe8('0x21')](handleEntityNotFound(_0x21996d,null))[_0x8fe8('0x21')](function(_0x442832){if(_0x442832){_0x3f0b67=_0x442832;_0x4d6398[_0x8fe8('0x2d')]=_[_0x8fe8('0x2a')](db[_0x8fe8('0x49')][_0x8fe8('0x26')]);_0x4d6398[_0x8fe8('0x2b')]=_[_0x8fe8('0x2a')](_0x443cac[_0x8fe8('0x2b')]);_0x4d6398[_0x8fe8('0x36')]=_['intersection'](_0x4d6398[_0x8fe8('0x2d')],_0x4d6398[_0x8fe8('0x2b')]);_0x1393a9[_0x8fe8('0x2e')]=_[_0x8fe8('0x2c')](_0x4d6398[_0x8fe8('0x2d')],qs['fields'](_0x443cac[_0x8fe8('0x2b')][_0x8fe8('0x2f')]));_0x1393a9[_0x8fe8('0x2e')]=_0x1393a9['attributes']['length']?_0x1393a9[_0x8fe8('0x2e')]:_0x4d6398[_0x8fe8('0x2d')];_0x1393a9[_0x8fe8('0x32')]=qs['sort'](_0x443cac['query'][_0x8fe8('0x33')]);_0x1393a9[_0x8fe8('0x34')]=qs['filters'](_[_0x8fe8('0x35')](_0x443cac[_0x8fe8('0x2b')],_0x4d6398[_0x8fe8('0x36')]));if(_0x443cac[_0x8fe8('0x2b')]['filter']){_0x1393a9[_0x8fe8('0x34')]=_['merge'](_0x1393a9['where'],{'$or':_[_0x8fe8('0x25')](_0x1393a9['attributes'],function(_0x36ad7c){var _0x5e71a3={};_0x5e71a3[_0x36ad7c]={'$like':'%'+_0x443cac[_0x8fe8('0x2b')][_0x8fe8('0x37')]+'%'};return _0x5e71a3;})});}_0x1393a9=_[_0x8fe8('0x39')]({},_0x1393a9,_0x443cac['options']);return _0x3f0b67[_0x8fe8('0x4a')](_0x1393a9);}})[_0x8fe8('0x21')](function(_0x4a6c9a){if(_0x4a6c9a){_0x5bcc7f=_0x4a6c9a['length'];if(!_0x443cac[_0x8fe8('0x2b')]['hasOwnProperty'](_0x8fe8('0x31'))){_0x1393a9[_0x8fe8('0x1a')]=qs['limit'](_0x443cac['query'][_0x8fe8('0x1a')]);_0x1393a9[_0x8fe8('0x17')]=qs['offset'](_0x443cac[_0x8fe8('0x2b')]['offset']);}return _0x3f0b67[_0x8fe8('0x4a')](_0x1393a9);}})[_0x8fe8('0x21')](function(_0x4fdf64){if(_0x4fdf64){return _0x4fdf64?{'count':_0x5bcc7f,'rows':_0x4fdf64}:null;}})['then'](respondWithResult(_0x21996d,null))[_0x8fe8('0x40')](handleError(_0x21996d,null));};exports[_0x8fe8('0x4b')]=function(_0x2d9dc2,_0xb10939,_0x1569ed){var _0x45f5bc={};var _0x3242fe={};var _0x237185;var _0x852ae8;return db[_0x8fe8('0x3d')][_0x8fe8('0x48')]({'where':{'id':_0x2d9dc2['params']['id']}})['then'](handleEntityNotFound(_0xb10939,null))['then'](function(_0x1abe0d){if(_0x1abe0d){_0x237185=_0x1abe0d;_0x3242fe[_0x8fe8('0x2d')]=_['keys'](db[_0x8fe8('0x49')][_0x8fe8('0x26')]);_0x3242fe[_0x8fe8('0x2b')]=_[_0x8fe8('0x2a')](_0x2d9dc2[_0x8fe8('0x2b')]);_0x3242fe[_0x8fe8('0x36')]=_[_0x8fe8('0x2c')](_0x3242fe[_0x8fe8('0x2d')],_0x3242fe['query']);_0x45f5bc['attributes']=_[_0x8fe8('0x2c')](_0x3242fe[_0x8fe8('0x2d')],qs[_0x8fe8('0x2f')](_0x2d9dc2[_0x8fe8('0x2b')][_0x8fe8('0x2f')]));_0x45f5bc[_0x8fe8('0x2e')]=_0x45f5bc[_0x8fe8('0x2e')][_0x8fe8('0x30')]?_0x45f5bc[_0x8fe8('0x2e')]:_0x3242fe[_0x8fe8('0x2d')];_0x45f5bc[_0x8fe8('0x32')]=qs[_0x8fe8('0x33')](_0x2d9dc2['query']['sort']);_0x45f5bc[_0x8fe8('0x34')]=qs[_0x8fe8('0x36')](_[_0x8fe8('0x35')](_0x2d9dc2[_0x8fe8('0x2b')],_0x3242fe[_0x8fe8('0x36')]));if(_0x2d9dc2['query'][_0x8fe8('0x37')]){_0x45f5bc[_0x8fe8('0x34')]=_[_0x8fe8('0x39')](_0x45f5bc[_0x8fe8('0x34')],{'$or':_[_0x8fe8('0x25')](_0x45f5bc[_0x8fe8('0x2e')],function(_0x40f575){var _0x530af1={};_0x530af1[_0x40f575]={'$like':'%'+_0x2d9dc2[_0x8fe8('0x2b')][_0x8fe8('0x37')]+'%'};return _0x530af1;})});}_0x45f5bc=_['merge']({},_0x45f5bc,_0x2d9dc2['options']);return _0x237185[_0x8fe8('0x4b')](_0x45f5bc);}})[_0x8fe8('0x21')](function(_0x3ad3e9){if(_0x3ad3e9){_0x852ae8=_0x3ad3e9['length'];if(!_0x2d9dc2[_0x8fe8('0x2b')][_0x8fe8('0x47')](_0x8fe8('0x31'))){_0x45f5bc[_0x8fe8('0x1a')]=qs['limit'](_0x2d9dc2[_0x8fe8('0x2b')][_0x8fe8('0x1a')]);_0x45f5bc[_0x8fe8('0x17')]=qs[_0x8fe8('0x17')](_0x2d9dc2['query'][_0x8fe8('0x17')]);}return _0x237185[_0x8fe8('0x4b')](_0x45f5bc);}})[_0x8fe8('0x21')](function(_0x56e1ff){if(_0x56e1ff){return _0x56e1ff?{'count':_0x852ae8,'rows':_0x56e1ff}:null;}})[_0x8fe8('0x21')](respondWithResult(_0xb10939,null))['catch'](handleError(_0xb10939,null));}; \ No newline at end of file +var _0xb0da=['query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','params','length','include','find','catch','create','body','getFields','findOne','ZohoField','getSubjects','getDescriptions','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ZohoConfiguration','rawAttributes','fieldName','key','model','map'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xb0da,0xc6));var _0xab0d=function(_0x555d8f,_0xc02e67){_0x555d8f=_0x555d8f-0x0;var _0x214bd2=_0xb0da[_0x555d8f];return _0x214bd2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xab0d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xab0d('0x1'));var rp=require(_0xab0d('0x2'));var moment=require('moment');var BPromise=require(_0xab0d('0x3'));var Mustache=require(_0xab0d('0x4'));var util=require(_0xab0d('0x5'));var path=require('path');var sox=require(_0xab0d('0x6'));var csv=require(_0xab0d('0x7'));var ejs=require(_0xab0d('0x8'));var fs=require('fs');var fs_extra=require(_0xab0d('0x9'));var _=require(_0xab0d('0xa'));var squel=require(_0xab0d('0xb'));var crypto=require(_0xab0d('0xc'));var jsforce=require(_0xab0d('0xd'));var deskjs=require(_0xab0d('0xe'));var toCsv=require(_0xab0d('0x7'));var querystring=require(_0xab0d('0xf'));var Papa=require('papaparse');var Redis=require(_0xab0d('0x10'));var authService=require(_0xab0d('0x11'));var qs=require(_0xab0d('0x12'));var as=require(_0xab0d('0x13'));var hardwareService=require(_0xab0d('0x14'));var logger=require(_0xab0d('0x15'))(_0xab0d('0x16'));var utils=require(_0xab0d('0x17'));var config=require(_0xab0d('0x18'));var licenseUtil=require(_0xab0d('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4422a3,_0x1bdadc){_0x1bdadc=_0x1bdadc||0xcc;return function(_0x49e72c){if(_0x49e72c){return _0x4422a3['sendStatus'](_0x1bdadc);}return _0x4422a3[_0xab0d('0x1a')](_0x1bdadc)[_0xab0d('0x1b')]();};}function respondWithResult(_0x2b7bff,_0x92eb33){_0x92eb33=_0x92eb33||0xc8;return function(_0x104899){if(_0x104899){return _0x2b7bff[_0xab0d('0x1a')](_0x92eb33)[_0xab0d('0x1c')](_0x104899);}};}function respondWithFilteredResult(_0x3adc8e,_0x3cae3d){return function(_0x26ff88){if(_0x26ff88){var _0x4b937b=typeof _0x3cae3d[_0xab0d('0x1d')]===_0xab0d('0x1e')&&typeof _0x3cae3d[_0xab0d('0x1f')]===_0xab0d('0x1e');var _0x150435=_0x26ff88['count'];var _0x203512=_0x4b937b?0x0:_0x3cae3d[_0xab0d('0x1d')];var _0x4e2eff=_0x4b937b?_0x26ff88[_0xab0d('0x20')]:_0x3cae3d['offset']+_0x3cae3d['limit'];var _0x3da4d9;if(_0x4e2eff>=_0x150435){_0x4e2eff=_0x150435;_0x3da4d9=0xc8;}else{_0x3da4d9=0xce;}_0x3adc8e[_0xab0d('0x1a')](_0x3da4d9);return _0x3adc8e[_0xab0d('0x21')](_0xab0d('0x22'),_0x203512+'-'+_0x4e2eff+'/'+_0x150435)[_0xab0d('0x1c')](_0x26ff88);}return null;};}function patchUpdates(_0x3252ab){return function(_0x4b2557){try{jsonpatch['apply'](_0x4b2557,_0x3252ab,!![]);}catch(_0x12c8b6){return BPromise[_0xab0d('0x23')](_0x12c8b6);}return _0x4b2557[_0xab0d('0x24')]();};}function saveUpdates(_0x2bb7a0,_0x2aab40){return function(_0x599c34){if(_0x599c34){return _0x599c34[_0xab0d('0x25')](_0x2bb7a0)[_0xab0d('0x26')](function(_0x5bd314){return _0x5bd314;});}return null;};}function removeEntity(_0x18de88,_0x420e70){return function(_0x4f8358){if(_0x4f8358){return _0x4f8358[_0xab0d('0x27')]()[_0xab0d('0x26')](function(){_0x18de88[_0xab0d('0x1a')](0xcc)[_0xab0d('0x1b')]();});}};}function handleEntityNotFound(_0x308e93,_0x2129a6){return function(_0x4a16b8){if(!_0x4a16b8){_0x308e93['sendStatus'](0x194);}return _0x4a16b8;};}function handleError(_0x1f492d,_0x886ebd){_0x886ebd=_0x886ebd||0x1f4;return function(_0x2439cc){logger[_0xab0d('0x28')](_0x2439cc[_0xab0d('0x29')]);if(_0x2439cc[_0xab0d('0x2a')]){delete _0x2439cc['name'];}_0x1f492d[_0xab0d('0x1a')](_0x886ebd)[_0xab0d('0x2b')](_0x2439cc);};}exports[_0xab0d('0x2c')]=function(_0x155b47,_0xb4e590){var _0x4a5235={},_0x20de49={},_0x202233={'count':0x0,'rows':[]};var _0xbc75b1=_['map'](db[_0xab0d('0x2d')][_0xab0d('0x2e')],function(_0x4cbed9){return{'name':_0x4cbed9[_0xab0d('0x2f')],'type':_0x4cbed9['type'][_0xab0d('0x30')]};});_0x20de49[_0xab0d('0x31')]=_[_0xab0d('0x32')](_0xbc75b1,_0xab0d('0x2a'));_0x20de49[_0xab0d('0x33')]=_[_0xab0d('0x34')](_0x155b47[_0xab0d('0x33')]);_0x20de49['filters']=_[_0xab0d('0x35')](_0x20de49['model'],_0x20de49[_0xab0d('0x33')]);_0x4a5235[_0xab0d('0x36')]=_[_0xab0d('0x35')](_0x20de49['model'],qs[_0xab0d('0x37')](_0x155b47['query'][_0xab0d('0x37')]));_0x4a5235[_0xab0d('0x36')]=_0x4a5235[_0xab0d('0x36')]['length']?_0x4a5235[_0xab0d('0x36')]:_0x20de49[_0xab0d('0x31')];if(!_0x155b47[_0xab0d('0x33')][_0xab0d('0x38')](_0xab0d('0x39'))){_0x4a5235[_0xab0d('0x1f')]=qs[_0xab0d('0x1f')](_0x155b47[_0xab0d('0x33')][_0xab0d('0x1f')]);_0x4a5235['offset']=qs[_0xab0d('0x1d')](_0x155b47[_0xab0d('0x33')][_0xab0d('0x1d')]);}_0x4a5235[_0xab0d('0x3a')]=qs[_0xab0d('0x3b')](_0x155b47['query'][_0xab0d('0x3b')]);_0x4a5235[_0xab0d('0x3c')]=qs[_0xab0d('0x3d')](_[_0xab0d('0x3e')](_0x155b47[_0xab0d('0x33')],_0x20de49[_0xab0d('0x3d')]),_0xbc75b1);if(_0x155b47[_0xab0d('0x33')][_0xab0d('0x3f')]){_0x4a5235[_0xab0d('0x3c')]=_[_0xab0d('0x40')](_0x4a5235[_0xab0d('0x3c')],{'$or':_[_0xab0d('0x32')](_0xbc75b1,function(_0x197618){if(_0x197618[_0xab0d('0x41')]!==_0xab0d('0x42')){var _0x4fbfc6={};_0x4fbfc6[_0x197618[_0xab0d('0x2a')]]={'$like':'%'+_0x155b47[_0xab0d('0x33')]['filter']+'%'};return _0x4fbfc6;}})});}_0x4a5235=_['merge']({},_0x4a5235,_0x155b47[_0xab0d('0x43')]);var _0x2418e8={'where':_0x4a5235[_0xab0d('0x3c')]};return db['ZohoConfiguration'][_0xab0d('0x20')](_0x2418e8)[_0xab0d('0x26')](function(_0x2c2fa0){_0x202233[_0xab0d('0x20')]=_0x2c2fa0;if(_0x155b47[_0xab0d('0x33')][_0xab0d('0x44')]){_0x4a5235['include']=[{'all':!![]}];}return db[_0xab0d('0x2d')][_0xab0d('0x45')](_0x4a5235);})[_0xab0d('0x26')](function(_0x18fea8){_0x202233[_0xab0d('0x46')]=_0x18fea8;return _0x202233;})[_0xab0d('0x26')](respondWithFilteredResult(_0xb4e590,_0x4a5235))['catch'](handleError(_0xb4e590,null));};exports['show']=function(_0x41a798,_0x209b69){var _0x32a616={'raw':![],'where':{'id':_0x41a798[_0xab0d('0x47')]['id']}},_0x4d4d4b={};_0x4d4d4b[_0xab0d('0x31')]=_[_0xab0d('0x34')](db[_0xab0d('0x2d')][_0xab0d('0x2e')]);_0x4d4d4b[_0xab0d('0x33')]=_[_0xab0d('0x34')](_0x41a798[_0xab0d('0x33')]);_0x4d4d4b['filters']=_[_0xab0d('0x35')](_0x4d4d4b[_0xab0d('0x31')],_0x4d4d4b['query']);_0x32a616[_0xab0d('0x36')]=_[_0xab0d('0x35')](_0x4d4d4b['model'],qs[_0xab0d('0x37')](_0x41a798['query'][_0xab0d('0x37')]));_0x32a616[_0xab0d('0x36')]=_0x32a616[_0xab0d('0x36')][_0xab0d('0x48')]?_0x32a616['attributes']:_0x4d4d4b[_0xab0d('0x31')];if(_0x41a798[_0xab0d('0x33')][_0xab0d('0x44')]){_0x32a616[_0xab0d('0x49')]=[{'all':!![]}];}_0x32a616=_[_0xab0d('0x40')]({},_0x32a616,_0x41a798[_0xab0d('0x43')]);return db['ZohoConfiguration'][_0xab0d('0x4a')](_0x32a616)[_0xab0d('0x26')](handleEntityNotFound(_0x209b69,null))[_0xab0d('0x26')](respondWithResult(_0x209b69,null))[_0xab0d('0x4b')](handleError(_0x209b69,null));};exports[_0xab0d('0x4c')]=function(_0x22874f,_0x2945d8){return db[_0xab0d('0x2d')][_0xab0d('0x4c')](_0x22874f[_0xab0d('0x4d')],{})[_0xab0d('0x26')](respondWithResult(_0x2945d8,0xc9))[_0xab0d('0x4b')](handleError(_0x2945d8,null));};exports[_0xab0d('0x25')]=function(_0x38f34d,_0x21e824){if(_0x38f34d['body']['id']){delete _0x38f34d[_0xab0d('0x4d')]['id'];}return db[_0xab0d('0x2d')][_0xab0d('0x4a')]({'where':{'id':_0x38f34d[_0xab0d('0x47')]['id']}})[_0xab0d('0x26')](handleEntityNotFound(_0x21e824,null))[_0xab0d('0x26')](saveUpdates(_0x38f34d['body'],null))[_0xab0d('0x26')](respondWithResult(_0x21e824,null))['catch'](handleError(_0x21e824,null));};exports[_0xab0d('0x27')]=function(_0x57d050,_0x1d22b1){return db['ZohoConfiguration'][_0xab0d('0x4a')]({'where':{'id':_0x57d050[_0xab0d('0x47')]['id']}})['then'](handleEntityNotFound(_0x1d22b1,null))['then'](removeEntity(_0x1d22b1,null))[_0xab0d('0x4b')](handleError(_0x1d22b1,null));};exports[_0xab0d('0x4e')]=function(_0x72c070,_0x13446b,_0x373dcf){var _0xa104fa={};var _0x125e2c={};var _0x1c5541;var _0x3e617b;return db[_0xab0d('0x2d')][_0xab0d('0x4f')]({'where':{'id':_0x72c070[_0xab0d('0x47')]['id']}})['then'](handleEntityNotFound(_0x13446b,null))[_0xab0d('0x26')](function(_0x12287c){if(_0x12287c){_0x1c5541=_0x12287c;_0x125e2c['model']=_['keys'](db[_0xab0d('0x50')][_0xab0d('0x2e')]);_0x125e2c[_0xab0d('0x33')]=_[_0xab0d('0x34')](_0x72c070[_0xab0d('0x33')]);_0x125e2c[_0xab0d('0x3d')]=_['intersection'](_0x125e2c[_0xab0d('0x31')],_0x125e2c[_0xab0d('0x33')]);_0xa104fa[_0xab0d('0x36')]=_['intersection'](_0x125e2c[_0xab0d('0x31')],qs[_0xab0d('0x37')](_0x72c070[_0xab0d('0x33')][_0xab0d('0x37')]));_0xa104fa[_0xab0d('0x36')]=_0xa104fa[_0xab0d('0x36')][_0xab0d('0x48')]?_0xa104fa['attributes']:_0x125e2c[_0xab0d('0x31')];_0xa104fa[_0xab0d('0x3a')]=qs['sort'](_0x72c070[_0xab0d('0x33')][_0xab0d('0x3b')]);_0xa104fa[_0xab0d('0x3c')]=qs[_0xab0d('0x3d')](_[_0xab0d('0x3e')](_0x72c070[_0xab0d('0x33')],_0x125e2c[_0xab0d('0x3d')]));if(_0x72c070[_0xab0d('0x33')][_0xab0d('0x3f')]){_0xa104fa[_0xab0d('0x3c')]=_[_0xab0d('0x40')](_0xa104fa[_0xab0d('0x3c')],{'$or':_[_0xab0d('0x32')](_0xa104fa[_0xab0d('0x36')],function(_0x2b39ab){var _0x45b58e={};_0x45b58e[_0x2b39ab]={'$like':'%'+_0x72c070[_0xab0d('0x33')][_0xab0d('0x3f')]+'%'};return _0x45b58e;})});}_0xa104fa=_[_0xab0d('0x40')]({},_0xa104fa,_0x72c070[_0xab0d('0x43')]);return _0x1c5541[_0xab0d('0x4e')](_0xa104fa);}})['then'](function(_0x5de9dc){if(_0x5de9dc){_0x3e617b=_0x5de9dc[_0xab0d('0x48')];if(!_0x72c070[_0xab0d('0x33')]['hasOwnProperty']('nolimit')){_0xa104fa[_0xab0d('0x1f')]=qs[_0xab0d('0x1f')](_0x72c070[_0xab0d('0x33')]['limit']);_0xa104fa[_0xab0d('0x1d')]=qs[_0xab0d('0x1d')](_0x72c070[_0xab0d('0x33')][_0xab0d('0x1d')]);}return _0x1c5541[_0xab0d('0x4e')](_0xa104fa);}})[_0xab0d('0x26')](function(_0x556df0){if(_0x556df0){return _0x556df0?{'count':_0x3e617b,'rows':_0x556df0}:null;}})[_0xab0d('0x26')](respondWithResult(_0x13446b,null))[_0xab0d('0x4b')](handleError(_0x13446b,null));};exports[_0xab0d('0x51')]=function(_0xda7de0,_0x2fcbd2,_0x20c0eb){var _0x46952={};var _0x54f114={};var _0x56803d;var _0x2eac98;return db['ZohoConfiguration'][_0xab0d('0x4f')]({'where':{'id':_0xda7de0[_0xab0d('0x47')]['id']}})[_0xab0d('0x26')](handleEntityNotFound(_0x2fcbd2,null))[_0xab0d('0x26')](function(_0x2efc66){if(_0x2efc66){_0x56803d=_0x2efc66;_0x54f114[_0xab0d('0x31')]=_[_0xab0d('0x34')](db[_0xab0d('0x50')][_0xab0d('0x2e')]);_0x54f114['query']=_[_0xab0d('0x34')](_0xda7de0[_0xab0d('0x33')]);_0x54f114['filters']=_['intersection'](_0x54f114[_0xab0d('0x31')],_0x54f114['query']);_0x46952['attributes']=_[_0xab0d('0x35')](_0x54f114[_0xab0d('0x31')],qs[_0xab0d('0x37')](_0xda7de0['query'][_0xab0d('0x37')]));_0x46952[_0xab0d('0x36')]=_0x46952[_0xab0d('0x36')][_0xab0d('0x48')]?_0x46952[_0xab0d('0x36')]:_0x54f114[_0xab0d('0x31')];_0x46952[_0xab0d('0x3a')]=qs[_0xab0d('0x3b')](_0xda7de0[_0xab0d('0x33')][_0xab0d('0x3b')]);_0x46952[_0xab0d('0x3c')]=qs[_0xab0d('0x3d')](_['pick'](_0xda7de0[_0xab0d('0x33')],_0x54f114['filters']));if(_0xda7de0[_0xab0d('0x33')][_0xab0d('0x3f')]){_0x46952[_0xab0d('0x3c')]=_[_0xab0d('0x40')](_0x46952['where'],{'$or':_[_0xab0d('0x32')](_0x46952[_0xab0d('0x36')],function(_0x53d762){var _0x34aafb={};_0x34aafb[_0x53d762]={'$like':'%'+_0xda7de0['query'][_0xab0d('0x3f')]+'%'};return _0x34aafb;})});}_0x46952=_[_0xab0d('0x40')]({},_0x46952,_0xda7de0['options']);return _0x56803d[_0xab0d('0x51')](_0x46952);}})[_0xab0d('0x26')](function(_0x240605){if(_0x240605){_0x2eac98=_0x240605[_0xab0d('0x48')];if(!_0xda7de0[_0xab0d('0x33')][_0xab0d('0x38')]('nolimit')){_0x46952[_0xab0d('0x1f')]=qs[_0xab0d('0x1f')](_0xda7de0['query'][_0xab0d('0x1f')]);_0x46952[_0xab0d('0x1d')]=qs[_0xab0d('0x1d')](_0xda7de0[_0xab0d('0x33')][_0xab0d('0x1d')]);}return _0x56803d[_0xab0d('0x51')](_0x46952);}})['then'](function(_0x5c8b8c){if(_0x5c8b8c){return _0x5c8b8c?{'count':_0x2eac98,'rows':_0x5c8b8c}:null;}})[_0xab0d('0x26')](respondWithResult(_0x2fcbd2,null))[_0xab0d('0x4b')](handleError(_0x2fcbd2,null));};exports[_0xab0d('0x52')]=function(_0x23ee6c,_0x548b03,_0x5d1d12){var _0x3bc0ff={};var _0x25d5a5={};var _0x59ec8c;var _0xb36aee;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x23ee6c[_0xab0d('0x47')]['id']}})[_0xab0d('0x26')](handleEntityNotFound(_0x548b03,null))[_0xab0d('0x26')](function(_0x297e23){if(_0x297e23){_0x59ec8c=_0x297e23;_0x25d5a5[_0xab0d('0x31')]=_[_0xab0d('0x34')](db['ZohoField'][_0xab0d('0x2e')]);_0x25d5a5['query']=_[_0xab0d('0x34')](_0x23ee6c['query']);_0x25d5a5[_0xab0d('0x3d')]=_[_0xab0d('0x35')](_0x25d5a5['model'],_0x25d5a5[_0xab0d('0x33')]);_0x3bc0ff[_0xab0d('0x36')]=_['intersection'](_0x25d5a5[_0xab0d('0x31')],qs['fields'](_0x23ee6c['query'][_0xab0d('0x37')]));_0x3bc0ff[_0xab0d('0x36')]=_0x3bc0ff[_0xab0d('0x36')][_0xab0d('0x48')]?_0x3bc0ff[_0xab0d('0x36')]:_0x25d5a5[_0xab0d('0x31')];_0x3bc0ff[_0xab0d('0x3a')]=qs['sort'](_0x23ee6c[_0xab0d('0x33')][_0xab0d('0x3b')]);_0x3bc0ff[_0xab0d('0x3c')]=qs['filters'](_[_0xab0d('0x3e')](_0x23ee6c[_0xab0d('0x33')],_0x25d5a5[_0xab0d('0x3d')]));if(_0x23ee6c[_0xab0d('0x33')]['filter']){_0x3bc0ff[_0xab0d('0x3c')]=_['merge'](_0x3bc0ff[_0xab0d('0x3c')],{'$or':_[_0xab0d('0x32')](_0x3bc0ff[_0xab0d('0x36')],function(_0x2c7686){var _0x1749c1={};_0x1749c1[_0x2c7686]={'$like':'%'+_0x23ee6c[_0xab0d('0x33')][_0xab0d('0x3f')]+'%'};return _0x1749c1;})});}_0x3bc0ff=_['merge']({},_0x3bc0ff,_0x23ee6c[_0xab0d('0x43')]);return _0x59ec8c[_0xab0d('0x52')](_0x3bc0ff);}})['then'](function(_0x22f090){if(_0x22f090){_0xb36aee=_0x22f090[_0xab0d('0x48')];if(!_0x23ee6c['query'][_0xab0d('0x38')]('nolimit')){_0x3bc0ff[_0xab0d('0x1f')]=qs[_0xab0d('0x1f')](_0x23ee6c[_0xab0d('0x33')][_0xab0d('0x1f')]);_0x3bc0ff[_0xab0d('0x1d')]=qs[_0xab0d('0x1d')](_0x23ee6c[_0xab0d('0x33')][_0xab0d('0x1d')]);}return _0x59ec8c[_0xab0d('0x52')](_0x3bc0ff);}})[_0xab0d('0x26')](function(_0x4f6ea0){if(_0x4f6ea0){return _0x4f6ea0?{'count':_0xb36aee,'rows':_0x4f6ea0}:null;}})[_0xab0d('0x26')](respondWithResult(_0x548b03,null))[_0xab0d('0x4b')](handleError(_0x548b03,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index eb1c5e4..582b09c 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 _0xa16a=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZohoConfiguration.attributes','exports','lodash'];(function(_0x7608eb,_0xd205dc){var _0x11aa40=function(_0x50850e){while(--_0x50850e){_0x7608eb['push'](_0x7608eb['shift']());}};_0x11aa40(++_0xd205dc);}(_0xa16a,0x1cd));var _0xaa16=function(_0x2cc569,_0x4e9568){_0x2cc569=_0x2cc569-0x0;var _0x1bfc2e=_0xa16a[_0x2cc569];return _0x1bfc2e;};'use strict';var _=require(_0xaa16('0x0'));var util=require(_0xaa16('0x1'));var logger=require(_0xaa16('0x2'))(_0xaa16('0x3'));var moment=require(_0xaa16('0x4'));var BPromise=require(_0xaa16('0x5'));var rp=require(_0xaa16('0x6'));var fs=require('fs');var path=require(_0xaa16('0x7'));var rimraf=require(_0xaa16('0x8'));var config=require('../../config/environment');var attributes=require(_0xaa16('0x9'));module[_0xaa16('0xa')]=function(_0x6132e3,_0x9d0e74){return _0x6132e3['define']('ZohoConfiguration',attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8bfe=['request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','int_zoho_configurations','lodash','util','../../config/logger','moment','bluebird'];(function(_0x3b0e76,_0x239221){var _0x1e4af4=function(_0x4c1daa){while(--_0x4c1daa){_0x3b0e76['push'](_0x3b0e76['shift']());}};_0x1e4af4(++_0x239221);}(_0x8bfe,0x73));var _0xe8bf=function(_0x4350c2,_0x112f3c){_0x4350c2=_0x4350c2-0x0;var _0x8b6406=_0x8bfe[_0x4350c2];return _0x8b6406;};'use strict';var _=require(_0xe8bf('0x0'));var util=require(_0xe8bf('0x1'));var logger=require(_0xe8bf('0x2'))('api');var moment=require(_0xe8bf('0x3'));var BPromise=require(_0xe8bf('0x4'));var rp=require(_0xe8bf('0x5'));var fs=require('fs');var path=require(_0xe8bf('0x6'));var rimraf=require(_0xe8bf('0x7'));var config=require(_0xe8bf('0x8'));var attributes=require(_0xe8bf('0x9'));module[_0xe8bf('0xa')]=function(_0x54cdc2,_0x4d6ca0){return _0x54cdc2['define']('ZohoConfiguration',attributes,{'tableName':_0xe8bf('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 fcd2ebe..d6bf52d 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 _0x7017=['ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x357ce8,_0x1c9e15){var _0x2e6c3f=function(_0x4d29d8){while(--_0x4d29d8){_0x357ce8['push'](_0x357ce8['shift']());}};_0x2e6c3f(++_0x1c9e15);}(_0x7017,0xef));var _0x7701=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x7017[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x7701('0x0'));var util=require(_0x7701('0x1'));var moment=require(_0x7701('0x2'));var BPromise=require('bluebird');var rs=require(_0x7701('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7701('0x4'))['db'];var utils=require(_0x7701('0x5'));var logger=require('../../config/logger')(_0x7701('0x6'));var config=require(_0x7701('0x7'));var jayson=require(_0x7701('0x8'));var client=jayson[_0x7701('0x9')][_0x7701('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37b118,_0xb0cbe3,_0x5b7fb9){return new BPromise(function(_0x62630c,_0x4780bb){return client[_0x7701('0xb')](_0x37b118,_0x5b7fb9)[_0x7701('0xc')](function(_0x144534){logger[_0x7701('0xd')](_0x7701('0xe'),_0xb0cbe3,_0x7701('0xf'));logger[_0x7701('0x10')](_0x7701('0x11'),_0xb0cbe3,_0x7701('0xf'),JSON[_0x7701('0x12')](_0x144534));if(_0x144534[_0x7701('0x13')]){if(_0x144534[_0x7701('0x13')][_0x7701('0x14')]===0x1f4){logger['error'](_0x7701('0xe'),_0xb0cbe3,_0x144534[_0x7701('0x13')][_0x7701('0x15')]);return _0x4780bb(_0x144534['error'][_0x7701('0x15')]);}logger[_0x7701('0x13')](_0x7701('0xe'),_0xb0cbe3,_0x144534[_0x7701('0x13')]['message']);return _0x62630c(_0x144534['error'][_0x7701('0x15')]);}else{logger[_0x7701('0xd')]('ZohoConfiguration,\x20%s,\x20%s',_0xb0cbe3,_0x7701('0xf'));_0x62630c(_0x144534['result'][_0x7701('0x15')]);}})[_0x7701('0x16')](function(_0x10e34c){logger[_0x7701('0x13')](_0x7701('0xe'),_0xb0cbe3,_0x10e34c);_0x4780bb(_0x10e34c);});});} \ No newline at end of file +var _0x36ae=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x24bc4c,_0x2bc7ee){var _0x3a6bf1=function(_0x50149e){while(--_0x50149e){_0x24bc4c['push'](_0x24bc4c['shift']());}};_0x3a6bf1(++_0x2bc7ee);}(_0x36ae,0x161));var _0xe36a=function(_0x1ff2ec,_0x386e86){_0x1ff2ec=_0x1ff2ec-0x0;var _0x405683=_0x36ae[_0x1ff2ec];return _0x405683;};'use strict';var _=require(_0xe36a('0x0'));var util=require(_0xe36a('0x1'));var moment=require(_0xe36a('0x2'));var BPromise=require(_0xe36a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe36a('0x4'));var db=require(_0xe36a('0x5'))['db'];var utils=require(_0xe36a('0x6'));var logger=require(_0xe36a('0x7'))(_0xe36a('0x8'));var config=require(_0xe36a('0x9'));var jayson=require(_0xe36a('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2d1150,_0x83ea88,_0x1bfbbb){return new BPromise(function(_0x90e797,_0x519c8c){return client['request'](_0x2d1150,_0x1bfbbb)[_0xe36a('0xb')](function(_0x1c9cb4){logger[_0xe36a('0xc')](_0xe36a('0xd'),_0x83ea88,_0xe36a('0xe'));logger[_0xe36a('0xf')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x83ea88,_0xe36a('0xe'),JSON[_0xe36a('0x10')](_0x1c9cb4));if(_0x1c9cb4[_0xe36a('0x11')]){if(_0x1c9cb4[_0xe36a('0x11')][_0xe36a('0x12')]===0x1f4){logger['error'](_0xe36a('0xd'),_0x83ea88,_0x1c9cb4[_0xe36a('0x11')][_0xe36a('0x13')]);return _0x519c8c(_0x1c9cb4['error']['message']);}logger[_0xe36a('0x11')](_0xe36a('0xd'),_0x83ea88,_0x1c9cb4['error'][_0xe36a('0x13')]);return _0x90e797(_0x1c9cb4[_0xe36a('0x11')][_0xe36a('0x13')]);}else{logger[_0xe36a('0xc')](_0xe36a('0xd'),_0x83ea88,_0xe36a('0xe'));_0x90e797(_0x1c9cb4[_0xe36a('0x14')][_0xe36a('0x13')]);}})[_0xe36a('0x15')](function(_0x1d65e1){logger[_0xe36a('0x11')](_0xe36a('0xd'),_0x83ea88,_0x1d65e1);_0x519c8c(_0x1d65e1);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index b393d06..922f495 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 _0xfe34=['put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x3693bf,_0x203506){var _0x5aa529=function(_0x357486){while(--_0x357486){_0x3693bf['push'](_0x3693bf['shift']());}};_0x5aa529(++_0x203506);}(_0xfe34,0x193));var _0x4fe3=function(_0x2bb4e8,_0x7d1ff1){_0x2bb4e8=_0x2bb4e8-0x0;var _0x58d00e=_0xfe34[_0x2bb4e8];return _0x58d00e;};'use strict';var multer=require(_0x4fe3('0x0'));var util=require(_0x4fe3('0x1'));var path=require(_0x4fe3('0x2'));var timeout=require(_0x4fe3('0x3'));var express=require(_0x4fe3('0x4'));var router=express['Router']();var fs_extra=require(_0x4fe3('0x5'));var auth=require(_0x4fe3('0x6'));var interaction=require(_0x4fe3('0x7'));var config=require(_0x4fe3('0x8'));var controller=require(_0x4fe3('0x9'));router[_0x4fe3('0xa')]('/',auth[_0x4fe3('0xb')](),controller[_0x4fe3('0xc')]);router['get'](_0x4fe3('0xd'),auth[_0x4fe3('0xb')](),controller[_0x4fe3('0xe')]);router[_0x4fe3('0xf')]('/',auth['isAuthenticated'](),controller[_0x4fe3('0x10')]);router[_0x4fe3('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x4fe3('0x12')]);router[_0x4fe3('0x13')]('/:id',auth[_0x4fe3('0xb')](),controller[_0x4fe3('0x14')]);module['exports']=router; \ No newline at end of file +var _0xd4f4=['isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd4f4,0x1ae));var _0x4d4f=function(_0x1a8a68,_0x5bbc54){_0x1a8a68=_0x1a8a68-0x0;var _0x4e06c1=_0xd4f4[_0x1a8a68];return _0x4e06c1;};'use strict';var multer=require(_0x4d4f('0x0'));var util=require(_0x4d4f('0x1'));var path=require(_0x4d4f('0x2'));var timeout=require(_0x4d4f('0x3'));var express=require(_0x4d4f('0x4'));var router=express[_0x4d4f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4d4f('0x6'));var interaction=require(_0x4d4f('0x7'));var config=require(_0x4d4f('0x8'));var controller=require('./intZohoField.controller');router[_0x4d4f('0x9')]('/',auth[_0x4d4f('0xa')](),controller[_0x4d4f('0xb')]);router[_0x4d4f('0x9')](_0x4d4f('0xc'),auth[_0x4d4f('0xa')](),controller[_0x4d4f('0xd')]);router[_0x4d4f('0xe')]('/',auth['isAuthenticated'](),controller[_0x4d4f('0xf')]);router[_0x4d4f('0x10')](_0x4d4f('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x4d4f('0x11')]('/:id',auth[_0x4d4f('0xa')](),controller[_0x4d4f('0x12')]);module[_0x4d4f('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index c687762..e68f684 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 _0x040f=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize'];(function(_0x79b649,_0x2115b3){var _0x1af9b1=function(_0x153c9f){while(--_0x153c9f){_0x79b649['push'](_0x79b649['shift']());}};_0x1af9b1(++_0x2115b3);}(_0x040f,0x95));var _0xf040=function(_0x1a58ba,_0x3a8026){_0x1a58ba=_0x1a58ba-0x0;var _0x36ed9d=_0x040f[_0x1a58ba];return _0x36ed9d;};'use strict';var Sequelize=require(_0xf040('0x0'));module[_0xf040('0x1')]={'type':{'type':Sequelize[_0xf040('0x2')](_0xf040('0x3'),_0xf040('0x4'),_0xf040('0x5'),_0xf040('0x6'),_0xf040('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0xf040('0x8')]},'key':{'type':Sequelize[_0xf040('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0xf040('0x3'),_0xf040('0x4'),_0xf040('0x5'))},'keyContent':{'type':Sequelize[_0xf040('0x8')]},'idField':{'type':Sequelize[_0xf040('0x8')]},'nameField':{'type':Sequelize[_0xf040('0x8')]},'customField':{'type':Sequelize[_0xf040('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf040('0x8')]}}; \ No newline at end of file +var _0x3092=['sequelize','exports','ENUM','string','keyValue','picklist','STRING','variable','BOOLEAN'];(function(_0x3d00db,_0x3692b3){var _0x41f115=function(_0x3c94fd){while(--_0x3c94fd){_0x3d00db['push'](_0x3d00db['shift']());}};_0x41f115(++_0x3692b3);}(_0x3092,0x10e));var _0x2309=function(_0x12b8ec,_0x1655be){_0x12b8ec=_0x12b8ec-0x0;var _0x21af77=_0x3092[_0x12b8ec];return _0x21af77;};'use strict';var Sequelize=require(_0x2309('0x0'));module[_0x2309('0x1')]={'type':{'type':Sequelize[_0x2309('0x2')](_0x2309('0x3'),'variable','customVariable',_0x2309('0x4'),_0x2309('0x5')),'defaultValue':_0x2309('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x2309('0x6')]},'keyType':{'type':Sequelize[_0x2309('0x2')](_0x2309('0x3'),_0x2309('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0x2309('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x2309('0x6')]},'customField':{'type':Sequelize[_0x2309('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2309('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 7332171..ae7ed3d 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 _0xc13c=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','undefined','count','limit','status','set','Content-Range','reject','update','then','destroy','error','name','index','map','ZohoField','rawAttributes','key','model','query','intersection','attributes','fields','nolimit','sort','where','filters','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x55f2fa,_0x334417){var _0x3bf4ed=function(_0x3b80ba){while(--_0x3b80ba){_0x55f2fa['push'](_0x55f2fa['shift']());}};_0x3bf4ed(++_0x334417);}(_0xc13c,0x155));var _0xcc13=function(_0x1a5501,_0x37781e){_0x1a5501=_0x1a5501-0x0;var _0x16da06=_0xc13c[_0x1a5501];return _0x16da06;};'use strict';var emlformat=require(_0xcc13('0x0'));var rimraf=require(_0xcc13('0x1'));var zipdir=require(_0xcc13('0x2'));var jsonpatch=require(_0xcc13('0x3'));var rp=require(_0xcc13('0x4'));var moment=require('moment');var BPromise=require(_0xcc13('0x5'));var Mustache=require('mustache');var util=require(_0xcc13('0x6'));var path=require(_0xcc13('0x7'));var sox=require(_0xcc13('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcc13('0x9'));var _=require('lodash');var squel=require(_0xcc13('0xa'));var crypto=require(_0xcc13('0xb'));var jsforce=require(_0xcc13('0xc'));var deskjs=require(_0xcc13('0xd'));var toCsv=require(_0xcc13('0xe'));var querystring=require(_0xcc13('0xf'));var Papa=require(_0xcc13('0x10'));var Redis=require(_0xcc13('0x11'));var authService=require(_0xcc13('0x12'));var qs=require(_0xcc13('0x13'));var as=require(_0xcc13('0x14'));var hardwareService=require(_0xcc13('0x15'));var logger=require('../../config/logger')(_0xcc13('0x16'));var utils=require(_0xcc13('0x17'));var config=require(_0xcc13('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xcc13('0x19'))['db'];function respondWithStatusCode(_0x7f1c61,_0x5eada5){_0x5eada5=_0x5eada5||0xcc;return function(_0x1c534a){if(_0x1c534a){return _0x7f1c61[_0xcc13('0x1a')](_0x5eada5);}return _0x7f1c61['status'](_0x5eada5)['end']();};}function respondWithResult(_0x158df4,_0x2536be){_0x2536be=_0x2536be||0xc8;return function(_0x469dc4){if(_0x469dc4){return _0x158df4['status'](_0x2536be)[_0xcc13('0x1b')](_0x469dc4);}};}function respondWithFilteredResult(_0x3bc039,_0x2beaaa){return function(_0x2ea14a){if(_0x2ea14a){var _0x4d5370=typeof _0x2beaaa[_0xcc13('0x1c')]===_0xcc13('0x1d')&&typeof _0x2beaaa['limit']==='undefined';var _0xcfa81c=_0x2ea14a[_0xcc13('0x1e')];var _0x4681cd=_0x4d5370?0x0:_0x2beaaa['offset'];var _0x2cfa38=_0x4d5370?_0x2ea14a[_0xcc13('0x1e')]:_0x2beaaa['offset']+_0x2beaaa[_0xcc13('0x1f')];var _0x912ba2;if(_0x2cfa38>=_0xcfa81c){_0x2cfa38=_0xcfa81c;_0x912ba2=0xc8;}else{_0x912ba2=0xce;}_0x3bc039[_0xcc13('0x20')](_0x912ba2);return _0x3bc039[_0xcc13('0x21')](_0xcc13('0x22'),_0x4681cd+'-'+_0x2cfa38+'/'+_0xcfa81c)['json'](_0x2ea14a);}return null;};}function patchUpdates(_0x1fea91){return function(_0x35984c){try{jsonpatch['apply'](_0x35984c,_0x1fea91,!![]);}catch(_0x1ee85d){return BPromise[_0xcc13('0x23')](_0x1ee85d);}return _0x35984c['save']();};}function saveUpdates(_0x13535d,_0x73a3b5){return function(_0x2c8749){if(_0x2c8749){return _0x2c8749[_0xcc13('0x24')](_0x13535d)[_0xcc13('0x25')](function(_0x21020e){return _0x21020e;});}return null;};}function removeEntity(_0x28776c,_0x4d858c){return function(_0x5eeb7f){if(_0x5eeb7f){return _0x5eeb7f[_0xcc13('0x26')]()[_0xcc13('0x25')](function(){_0x28776c[_0xcc13('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52b296,_0x4ca458){return function(_0x2b6dc1){if(!_0x2b6dc1){_0x52b296[_0xcc13('0x1a')](0x194);}return _0x2b6dc1;};}function handleError(_0x5c1e13,_0x5d9eac){_0x5d9eac=_0x5d9eac||0x1f4;return function(_0x2bc82b){logger[_0xcc13('0x27')](_0x2bc82b['stack']);if(_0x2bc82b[_0xcc13('0x28')]){delete _0x2bc82b['name'];}_0x5c1e13[_0xcc13('0x20')](_0x5d9eac)['send'](_0x2bc82b);};}exports[_0xcc13('0x29')]=function(_0x354d0a,_0x525b32){var _0xb65055={},_0x15877b={},_0x503082={'count':0x0,'rows':[]};var _0x4d614b=_[_0xcc13('0x2a')](db[_0xcc13('0x2b')][_0xcc13('0x2c')],function(_0x10a896){return{'name':_0x10a896['fieldName'],'type':_0x10a896['type'][_0xcc13('0x2d')]};});_0x15877b[_0xcc13('0x2e')]=_['map'](_0x4d614b,_0xcc13('0x28'));_0x15877b[_0xcc13('0x2f')]=_['keys'](_0x354d0a[_0xcc13('0x2f')]);_0x15877b['filters']=_[_0xcc13('0x30')](_0x15877b['model'],_0x15877b['query']);_0xb65055[_0xcc13('0x31')]=_[_0xcc13('0x30')](_0x15877b['model'],qs['fields'](_0x354d0a[_0xcc13('0x2f')][_0xcc13('0x32')]));_0xb65055[_0xcc13('0x31')]=_0xb65055[_0xcc13('0x31')]['length']?_0xb65055[_0xcc13('0x31')]:_0x15877b['model'];if(!_0x354d0a['query']['hasOwnProperty'](_0xcc13('0x33'))){_0xb65055['limit']=qs[_0xcc13('0x1f')](_0x354d0a[_0xcc13('0x2f')][_0xcc13('0x1f')]);_0xb65055[_0xcc13('0x1c')]=qs[_0xcc13('0x1c')](_0x354d0a[_0xcc13('0x2f')][_0xcc13('0x1c')]);}_0xb65055['order']=qs[_0xcc13('0x34')](_0x354d0a['query'][_0xcc13('0x34')]);_0xb65055[_0xcc13('0x35')]=qs[_0xcc13('0x36')](_['pick'](_0x354d0a[_0xcc13('0x2f')],_0x15877b[_0xcc13('0x36')]),_0x4d614b);if(_0x354d0a[_0xcc13('0x2f')]['filter']){_0xb65055['where']=_['merge'](_0xb65055[_0xcc13('0x35')],{'$or':_[_0xcc13('0x2a')](_0x4d614b,function(_0x581159){if(_0x581159[_0xcc13('0x37')]!==_0xcc13('0x38')){var _0x470e84={};_0x470e84[_0x581159[_0xcc13('0x28')]]={'$like':'%'+_0x354d0a[_0xcc13('0x2f')][_0xcc13('0x39')]+'%'};return _0x470e84;}})});}_0xb65055=_[_0xcc13('0x3a')]({},_0xb65055,_0x354d0a[_0xcc13('0x3b')]);var _0x137e21={'where':_0xb65055[_0xcc13('0x35')]};return db[_0xcc13('0x2b')][_0xcc13('0x1e')](_0x137e21)[_0xcc13('0x25')](function(_0x40f5dc){_0x503082[_0xcc13('0x1e')]=_0x40f5dc;if(_0x354d0a[_0xcc13('0x2f')][_0xcc13('0x3c')]){_0xb65055[_0xcc13('0x3d')]=[{'all':!![]}];}return db['ZohoField'][_0xcc13('0x3e')](_0xb65055);})[_0xcc13('0x25')](function(_0x292953){_0x503082[_0xcc13('0x3f')]=_0x292953;return _0x503082;})[_0xcc13('0x25')](respondWithFilteredResult(_0x525b32,_0xb65055))[_0xcc13('0x40')](handleError(_0x525b32,null));};exports[_0xcc13('0x41')]=function(_0x378463,_0xd84f49){var _0x167abc={'raw':!![],'where':{'id':_0x378463[_0xcc13('0x42')]['id']}},_0x57fadd={};_0x57fadd[_0xcc13('0x2e')]=_[_0xcc13('0x43')](db[_0xcc13('0x2b')]['rawAttributes']);_0x57fadd[_0xcc13('0x2f')]=_[_0xcc13('0x43')](_0x378463[_0xcc13('0x2f')]);_0x57fadd['filters']=_[_0xcc13('0x30')](_0x57fadd[_0xcc13('0x2e')],_0x57fadd[_0xcc13('0x2f')]);_0x167abc['attributes']=_['intersection'](_0x57fadd[_0xcc13('0x2e')],qs['fields'](_0x378463[_0xcc13('0x2f')]['fields']));_0x167abc[_0xcc13('0x31')]=_0x167abc['attributes'][_0xcc13('0x44')]?_0x167abc[_0xcc13('0x31')]:_0x57fadd[_0xcc13('0x2e')];if(_0x378463[_0xcc13('0x2f')][_0xcc13('0x3c')]){_0x167abc['include']=[{'all':!![]}];}_0x167abc=_['merge']({},_0x167abc,_0x378463['options']);return db[_0xcc13('0x2b')][_0xcc13('0x45')](_0x167abc)[_0xcc13('0x25')](handleEntityNotFound(_0xd84f49,null))[_0xcc13('0x25')](respondWithResult(_0xd84f49,null))['catch'](handleError(_0xd84f49,null));};exports['create']=function(_0x388a76,_0x5d0ea9){return db[_0xcc13('0x2b')][_0xcc13('0x46')](_0x388a76[_0xcc13('0x47')],{})[_0xcc13('0x25')](respondWithResult(_0x5d0ea9,0xc9))['catch'](handleError(_0x5d0ea9,null));};exports[_0xcc13('0x24')]=function(_0x4746f6,_0x2bfeee){if(_0x4746f6[_0xcc13('0x47')]['id']){delete _0x4746f6[_0xcc13('0x47')]['id'];}return db[_0xcc13('0x2b')][_0xcc13('0x45')]({'where':{'id':_0x4746f6[_0xcc13('0x42')]['id']}})[_0xcc13('0x25')](handleEntityNotFound(_0x2bfeee,null))[_0xcc13('0x25')](saveUpdates(_0x4746f6['body'],null))[_0xcc13('0x25')](respondWithResult(_0x2bfeee,null))[_0xcc13('0x40')](handleError(_0x2bfeee,null));};exports[_0xcc13('0x26')]=function(_0x260ccc,_0x5154c9){return db[_0xcc13('0x2b')][_0xcc13('0x45')]({'where':{'id':_0x260ccc[_0xcc13('0x42')]['id']}})[_0xcc13('0x25')](handleEntityNotFound(_0x5154c9,null))[_0xcc13('0x25')](removeEntity(_0x5154c9,null))[_0xcc13('0x40')](handleError(_0x5154c9,null));}; \ No newline at end of file +var _0x3cf3=['rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','end','error','stack','name','send','index','map','ZohoField','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','params','rawAttributes','find','create','body','catch'];(function(_0x22d88f,_0x38f325){var _0x996d53=function(_0x9c175){while(--_0x9c175){_0x22d88f['push'](_0x22d88f['shift']());}};_0x996d53(++_0x38f325);}(_0x3cf3,0x128));var _0x33cf=function(_0x516770,_0xb9ffc8){_0x516770=_0x516770-0x0;var _0x5008f8=_0x3cf3[_0x516770];return _0x5008f8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x33cf('0x0'));var zipdir=require(_0x33cf('0x1'));var jsonpatch=require(_0x33cf('0x2'));var rp=require(_0x33cf('0x3'));var moment=require('moment');var BPromise=require(_0x33cf('0x4'));var Mustache=require(_0x33cf('0x5'));var util=require('util');var path=require(_0x33cf('0x6'));var sox=require(_0x33cf('0x7'));var csv=require(_0x33cf('0x8'));var ejs=require(_0x33cf('0x9'));var fs=require('fs');var fs_extra=require(_0x33cf('0xa'));var _=require(_0x33cf('0xb'));var squel=require(_0x33cf('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x33cf('0xd'));var toCsv=require(_0x33cf('0x8'));var querystring=require(_0x33cf('0xe'));var Papa=require(_0x33cf('0xf'));var Redis=require(_0x33cf('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x33cf('0x11'));var as=require(_0x33cf('0x12'));var hardwareService=require(_0x33cf('0x13'));var logger=require(_0x33cf('0x14'))(_0x33cf('0x15'));var utils=require(_0x33cf('0x16'));var config=require(_0x33cf('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x33cf('0x18'))['db'];function respondWithStatusCode(_0x33383b,_0x2fa6e8){_0x2fa6e8=_0x2fa6e8||0xcc;return function(_0x52418b){if(_0x52418b){return _0x33383b[_0x33cf('0x19')](_0x2fa6e8);}return _0x33383b[_0x33cf('0x1a')](_0x2fa6e8)['end']();};}function respondWithResult(_0x25f967,_0x21c32e){_0x21c32e=_0x21c32e||0xc8;return function(_0x3c0017){if(_0x3c0017){return _0x25f967[_0x33cf('0x1a')](_0x21c32e)[_0x33cf('0x1b')](_0x3c0017);}};}function respondWithFilteredResult(_0x2bf0ba,_0xdcbdee){return function(_0x4f52a2){if(_0x4f52a2){var _0x1f8494=typeof _0xdcbdee[_0x33cf('0x1c')]===_0x33cf('0x1d')&&typeof _0xdcbdee[_0x33cf('0x1e')]===_0x33cf('0x1d');var _0x32c4e0=_0x4f52a2['count'];var _0xede4b7=_0x1f8494?0x0:_0xdcbdee['offset'];var _0x9526a4=_0x1f8494?_0x4f52a2[_0x33cf('0x1f')]:_0xdcbdee['offset']+_0xdcbdee[_0x33cf('0x1e')];var _0x29054c;if(_0x9526a4>=_0x32c4e0){_0x9526a4=_0x32c4e0;_0x29054c=0xc8;}else{_0x29054c=0xce;}_0x2bf0ba[_0x33cf('0x1a')](_0x29054c);return _0x2bf0ba[_0x33cf('0x20')](_0x33cf('0x21'),_0xede4b7+'-'+_0x9526a4+'/'+_0x32c4e0)[_0x33cf('0x1b')](_0x4f52a2);}return null;};}function patchUpdates(_0x19c2a9){return function(_0x3c0efb){try{jsonpatch[_0x33cf('0x22')](_0x3c0efb,_0x19c2a9,!![]);}catch(_0x160542){return BPromise['reject'](_0x160542);}return _0x3c0efb[_0x33cf('0x23')]();};}function saveUpdates(_0x8382d0,_0x3e7880){return function(_0x195e67){if(_0x195e67){return _0x195e67[_0x33cf('0x24')](_0x8382d0)['then'](function(_0x9b21f3){return _0x9b21f3;});}return null;};}function removeEntity(_0x4a9f3c,_0x277150){return function(_0x16624f){if(_0x16624f){return _0x16624f[_0x33cf('0x25')]()[_0x33cf('0x26')](function(){_0x4a9f3c[_0x33cf('0x1a')](0xcc)[_0x33cf('0x27')]();});}};}function handleEntityNotFound(_0x1f570f,_0x5af06e){return function(_0x1ba988){if(!_0x1ba988){_0x1f570f['sendStatus'](0x194);}return _0x1ba988;};}function handleError(_0x4463af,_0x5f3b2f){_0x5f3b2f=_0x5f3b2f||0x1f4;return function(_0x352cf8){logger[_0x33cf('0x28')](_0x352cf8[_0x33cf('0x29')]);if(_0x352cf8[_0x33cf('0x2a')]){delete _0x352cf8[_0x33cf('0x2a')];}_0x4463af[_0x33cf('0x1a')](_0x5f3b2f)[_0x33cf('0x2b')](_0x352cf8);};}exports[_0x33cf('0x2c')]=function(_0x214263,_0x1ff9bc){var _0x3a1766={},_0x1b07b9={},_0x2a5a56={'count':0x0,'rows':[]};var _0x597672=_[_0x33cf('0x2d')](db[_0x33cf('0x2e')]['rawAttributes'],function(_0x57bb68){return{'name':_0x57bb68[_0x33cf('0x2f')],'type':_0x57bb68[_0x33cf('0x30')]['key']};});_0x1b07b9[_0x33cf('0x31')]=_[_0x33cf('0x2d')](_0x597672,_0x33cf('0x2a'));_0x1b07b9[_0x33cf('0x32')]=_[_0x33cf('0x33')](_0x214263[_0x33cf('0x32')]);_0x1b07b9['filters']=_[_0x33cf('0x34')](_0x1b07b9['model'],_0x1b07b9[_0x33cf('0x32')]);_0x3a1766[_0x33cf('0x35')]=_['intersection'](_0x1b07b9[_0x33cf('0x31')],qs[_0x33cf('0x36')](_0x214263[_0x33cf('0x32')][_0x33cf('0x36')]));_0x3a1766[_0x33cf('0x35')]=_0x3a1766['attributes'][_0x33cf('0x37')]?_0x3a1766[_0x33cf('0x35')]:_0x1b07b9[_0x33cf('0x31')];if(!_0x214263[_0x33cf('0x32')][_0x33cf('0x38')]('nolimit')){_0x3a1766[_0x33cf('0x1e')]=qs[_0x33cf('0x1e')](_0x214263[_0x33cf('0x32')][_0x33cf('0x1e')]);_0x3a1766[_0x33cf('0x1c')]=qs[_0x33cf('0x1c')](_0x214263[_0x33cf('0x32')][_0x33cf('0x1c')]);}_0x3a1766[_0x33cf('0x39')]=qs[_0x33cf('0x3a')](_0x214263['query']['sort']);_0x3a1766[_0x33cf('0x3b')]=qs[_0x33cf('0x3c')](_['pick'](_0x214263[_0x33cf('0x32')],_0x1b07b9[_0x33cf('0x3c')]),_0x597672);if(_0x214263[_0x33cf('0x32')][_0x33cf('0x3d')]){_0x3a1766[_0x33cf('0x3b')]=_[_0x33cf('0x3e')](_0x3a1766[_0x33cf('0x3b')],{'$or':_[_0x33cf('0x2d')](_0x597672,function(_0x3a06ba){if(_0x3a06ba[_0x33cf('0x30')]!==_0x33cf('0x3f')){var _0x210f01={};_0x210f01[_0x3a06ba['name']]={'$like':'%'+_0x214263[_0x33cf('0x32')][_0x33cf('0x3d')]+'%'};return _0x210f01;}})});}_0x3a1766=_[_0x33cf('0x3e')]({},_0x3a1766,_0x214263[_0x33cf('0x40')]);var _0x2971da={'where':_0x3a1766[_0x33cf('0x3b')]};return db[_0x33cf('0x2e')][_0x33cf('0x1f')](_0x2971da)[_0x33cf('0x26')](function(_0x19a70e){_0x2a5a56[_0x33cf('0x1f')]=_0x19a70e;if(_0x214263[_0x33cf('0x32')][_0x33cf('0x41')]){_0x3a1766[_0x33cf('0x42')]=[{'all':!![]}];}return db[_0x33cf('0x2e')]['findAll'](_0x3a1766);})[_0x33cf('0x26')](function(_0x51740a){_0x2a5a56[_0x33cf('0x43')]=_0x51740a;return _0x2a5a56;})[_0x33cf('0x26')](respondWithFilteredResult(_0x1ff9bc,_0x3a1766))['catch'](handleError(_0x1ff9bc,null));};exports['show']=function(_0x434a24,_0x381634){var _0xc216f9={'raw':!![],'where':{'id':_0x434a24[_0x33cf('0x44')]['id']}},_0x3a580d={};_0x3a580d[_0x33cf('0x31')]=_[_0x33cf('0x33')](db[_0x33cf('0x2e')][_0x33cf('0x45')]);_0x3a580d[_0x33cf('0x32')]=_[_0x33cf('0x33')](_0x434a24[_0x33cf('0x32')]);_0x3a580d[_0x33cf('0x3c')]=_[_0x33cf('0x34')](_0x3a580d[_0x33cf('0x31')],_0x3a580d[_0x33cf('0x32')]);_0xc216f9[_0x33cf('0x35')]=_[_0x33cf('0x34')](_0x3a580d[_0x33cf('0x31')],qs[_0x33cf('0x36')](_0x434a24[_0x33cf('0x32')]['fields']));_0xc216f9[_0x33cf('0x35')]=_0xc216f9[_0x33cf('0x35')][_0x33cf('0x37')]?_0xc216f9[_0x33cf('0x35')]:_0x3a580d[_0x33cf('0x31')];if(_0x434a24['query']['includeAll']){_0xc216f9[_0x33cf('0x42')]=[{'all':!![]}];}_0xc216f9=_[_0x33cf('0x3e')]({},_0xc216f9,_0x434a24[_0x33cf('0x40')]);return db[_0x33cf('0x2e')][_0x33cf('0x46')](_0xc216f9)[_0x33cf('0x26')](handleEntityNotFound(_0x381634,null))[_0x33cf('0x26')](respondWithResult(_0x381634,null))['catch'](handleError(_0x381634,null));};exports[_0x33cf('0x47')]=function(_0x185465,_0x19e142){return db[_0x33cf('0x2e')][_0x33cf('0x47')](_0x185465[_0x33cf('0x48')],{})['then'](respondWithResult(_0x19e142,0xc9))[_0x33cf('0x49')](handleError(_0x19e142,null));};exports[_0x33cf('0x24')]=function(_0x13c093,_0x25a82e){if(_0x13c093[_0x33cf('0x48')]['id']){delete _0x13c093[_0x33cf('0x48')]['id'];}return db[_0x33cf('0x2e')]['find']({'where':{'id':_0x13c093['params']['id']}})[_0x33cf('0x26')](handleEntityNotFound(_0x25a82e,null))[_0x33cf('0x26')](saveUpdates(_0x13c093[_0x33cf('0x48')],null))[_0x33cf('0x26')](respondWithResult(_0x25a82e,null))[_0x33cf('0x49')](handleError(_0x25a82e,null));};exports[_0x33cf('0x25')]=function(_0x47f598,_0x34d072){return db[_0x33cf('0x2e')][_0x33cf('0x46')]({'where':{'id':_0x47f598[_0x33cf('0x44')]['id']}})[_0x33cf('0x26')](handleEntityNotFound(_0x34d072,null))[_0x33cf('0x26')](removeEntity(_0x34d072,null))[_0x33cf('0x49')](handleError(_0x34d072,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index d554c63..12e46ee 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 _0x1a85=['rimraf','../../config/environment','exports','ZohoField','int_zoho_fields','idField','../../config/logger','api','moment','path'];(function(_0x4e941a,_0x24b49b){var _0x41f894=function(_0xa6de05){while(--_0xa6de05){_0x4e941a['push'](_0x4e941a['shift']());}};_0x41f894(++_0x24b49b);}(_0x1a85,0x178));var _0x51a8=function(_0xb31b62,_0x309405){_0xb31b62=_0xb31b62-0x0;var _0x3928ed=_0x1a85[_0xb31b62];return _0x3928ed;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x51a8('0x0'))(_0x51a8('0x1'));var moment=require(_0x51a8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x51a8('0x3'));var rimraf=require(_0x51a8('0x4'));var config=require(_0x51a8('0x5'));var attributes=require('./intZohoField.attributes');module[_0x51a8('0x6')]=function(_0x4b76a8,_0x2c1180){return _0x4b76a8['define'](_0x51a8('0x7'),attributes,{'tableName':_0x51a8('0x8'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x51a8('0x9'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x430c=['api','moment','bluebird','./intZohoField.attributes','exports','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash'];(function(_0x1c5e72,_0x267eca){var _0x549f2a=function(_0x24f41d){while(--_0x24f41d){_0x1c5e72['push'](_0x1c5e72['shift']());}};_0x549f2a(++_0x267eca);}(_0x430c,0x1a1));var _0xc430=function(_0x1fd675,_0x165dfe){_0x1fd675=_0x1fd675-0x0;var _0x16b554=_0x430c[_0x1fd675];return _0x16b554;};'use strict';var _=require(_0xc430('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc430('0x1'));var moment=require(_0xc430('0x2'));var BPromise=require(_0xc430('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(_0xc430('0x4'));module[_0xc430('0x5')]=function(_0x50b256,_0x42aa9c){return _0x50b256['define'](_0xc430('0x6'),attributes,{'tableName':_0xc430('0x7'),'paranoid':![],'indexes':[{'name':_0xc430('0x8'),'fields':[_0xc430('0x9'),_0xc430('0xa')],'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 499a739..39cd465 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 _0x4c82=['http','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4ffdda,_0xbc076f){var _0x5dcb1f=function(_0x4d11d0){while(--_0x4d11d0){_0x4ffdda['push'](_0x4ffdda['shift']());}};_0x5dcb1f(++_0xbc076f);}(_0x4c82,0x1ef));var _0x24c8=function(_0x340380,_0x4bd2a8){_0x340380=_0x340380-0x0;var _0x49ce1c=_0x4c82[_0x340380];return _0x49ce1c;};'use strict';var _=require('lodash');var util=require(_0x24c8('0x0'));var moment=require('moment');var BPromise=require(_0x24c8('0x1'));var rs=require(_0x24c8('0x2'));var fs=require('fs');var Redis=require(_0x24c8('0x3'));var db=require(_0x24c8('0x4'))['db'];var utils=require(_0x24c8('0x5'));var logger=require(_0x24c8('0x6'))(_0x24c8('0x7'));var config=require(_0x24c8('0x8'));var jayson=require(_0x24c8('0x9'));var client=jayson[_0x24c8('0xa')][_0x24c8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a7c2f,_0x369633,_0x4fd8d5){return new BPromise(function(_0x5202a7,_0x487f48){return client['request'](_0x4a7c2f,_0x4fd8d5)[_0x24c8('0xc')](function(_0x16c92e){logger[_0x24c8('0xd')](_0x24c8('0xe'),_0x369633,_0x24c8('0xf'));logger[_0x24c8('0x10')](_0x24c8('0x11'),_0x369633,_0x24c8('0xf'),JSON[_0x24c8('0x12')](_0x16c92e));if(_0x16c92e[_0x24c8('0x13')]){if(_0x16c92e[_0x24c8('0x13')][_0x24c8('0x14')]===0x1f4){logger[_0x24c8('0x13')](_0x24c8('0xe'),_0x369633,_0x16c92e['error']['message']);return _0x487f48(_0x16c92e[_0x24c8('0x13')][_0x24c8('0x15')]);}logger[_0x24c8('0x13')](_0x24c8('0xe'),_0x369633,_0x16c92e[_0x24c8('0x13')][_0x24c8('0x15')]);return _0x5202a7(_0x16c92e['error'][_0x24c8('0x15')]);}else{logger['info'](_0x24c8('0xe'),_0x369633,_0x24c8('0xf'));_0x5202a7(_0x16c92e['result']['message']);}})['catch'](function(_0x42a796){logger[_0x24c8('0x13')](_0x24c8('0xe'),_0x369633,_0x42a796);_0x487f48(_0x42a796);});});} \ No newline at end of file +var _0xcb48=['then','info','ZohoField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0xc9c3f5,_0x310f57){var _0x2d135a=function(_0x24c2ff){while(--_0x24c2ff){_0xc9c3f5['push'](_0xc9c3f5['shift']());}};_0x2d135a(++_0x310f57);}(_0xcb48,0x129));var _0x8cb4=function(_0x109316,_0x38a7c7){_0x109316=_0x109316-0x0;var _0x26f2ff=_0xcb48[_0x109316];return _0x26f2ff;};'use strict';var _=require(_0x8cb4('0x0'));var util=require(_0x8cb4('0x1'));var moment=require(_0x8cb4('0x2'));var BPromise=require(_0x8cb4('0x3'));var rs=require(_0x8cb4('0x4'));var fs=require('fs');var Redis=require(_0x8cb4('0x5'));var db=require(_0x8cb4('0x6'))['db'];var utils=require(_0x8cb4('0x7'));var logger=require(_0x8cb4('0x8'))(_0x8cb4('0x9'));var config=require(_0x8cb4('0xa'));var jayson=require(_0x8cb4('0xb'));var client=jayson[_0x8cb4('0xc')][_0x8cb4('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4ec336,_0x5f3c84,_0x2c155d){return new BPromise(function(_0x349a6f,_0x10dce8){return client[_0x8cb4('0xe')](_0x4ec336,_0x2c155d)[_0x8cb4('0xf')](function(_0x1cf3e1){logger[_0x8cb4('0x10')](_0x8cb4('0x11'),_0x5f3c84,'request\x20sent');logger[_0x8cb4('0x12')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x5f3c84,_0x8cb4('0x13'),JSON[_0x8cb4('0x14')](_0x1cf3e1));if(_0x1cf3e1['error']){if(_0x1cf3e1[_0x8cb4('0x15')]['code']===0x1f4){logger[_0x8cb4('0x15')](_0x8cb4('0x11'),_0x5f3c84,_0x1cf3e1[_0x8cb4('0x15')]['message']);return _0x10dce8(_0x1cf3e1[_0x8cb4('0x15')][_0x8cb4('0x16')]);}logger[_0x8cb4('0x15')](_0x8cb4('0x11'),_0x5f3c84,_0x1cf3e1[_0x8cb4('0x15')]['message']);return _0x349a6f(_0x1cf3e1[_0x8cb4('0x15')][_0x8cb4('0x16')]);}else{logger['info'](_0x8cb4('0x11'),_0x5f3c84,_0x8cb4('0x13'));_0x349a6f(_0x1cf3e1[_0x8cb4('0x17')][_0x8cb4('0x16')]);}})['catch'](function(_0x5376ad){logger['error'](_0x8cb4('0x11'),_0x5f3c84,_0x5376ad);_0x10dce8(_0x5376ad);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index a2c9b37..afb73ce 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x4514e2,_0x4f032a){var _0x3a3f28=function(_0x4b42da){while(--_0x4b42da){_0x4514e2['push'](_0x4514e2['shift']());}};_0x3a3f28(++_0x4f032a);}(_0xe706,0xa3));var _0x6e70=function(_0xfcfc35,_0x41125e){_0xfcfc35=_0xfcfc35-0x0;var _0x13a3c7=_0xe706[_0xfcfc35];return _0x13a3c7;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x295a4b,_0x4ce67b){var _0x348927=function(_0x20c8f9){while(--_0x20c8f9){_0x295a4b['push'](_0x295a4b['shift']());}};_0x348927(++_0x4ce67b);}(_0xedd9,0xfc));var _0x9edd=function(_0x43bf69,_0x64a838){_0x43bf69=_0x43bf69-0x0;var _0x1511a1=_0xedd9[_0x43bf69];return _0x1511a1;};'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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index c24dac8..344dc59 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 _0x697e=['app.js','INTEGER','BOOLEAN','state','exports','STRING','unique_name_and_version'];(function(_0x116d62,_0xbb661f){var _0x14e537=function(_0x3e69bf){while(--_0x3e69bf){_0x116d62['push'](_0x116d62['shift']());}};_0x14e537(++_0xbb661f);}(_0x697e,0xe4));var _0xe697=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x697e[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0xe697('0x0')]={'name':{'type':Sequelize[_0xe697('0x1')],'allowNull':![],'unique':_0xe697('0x2')},'version':{'type':Sequelize[_0xe697('0x1')],'allowNull':![],'unique':_0xe697('0x2')},'main':{'type':Sequelize[_0xe697('0x1')],'defaultValue':_0xe697('0x3')},'filename':{'type':Sequelize[_0xe697('0x1')]},'path':{'type':Sequelize[_0xe697('0x1')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0xe697('0x4')]},'active':{'type':Sequelize[_0xe697('0x5')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0xe697('0x1')]},'state':{'type':Sequelize['STRING'],'unique':_0xe697('0x6')},'description':{'type':Sequelize[_0xe697('0x1')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xe697('0x1')]},'link':{'type':Sequelize[_0xe697('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0xab7f=['STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN','state','sequelize','exports'];(function(_0x1c5711,_0x44c32d){var _0xd0bfc0=function(_0x14105a){while(--_0x14105a){_0x1c5711['push'](_0x1c5711['shift']());}};_0xd0bfc0(++_0x44c32d);}(_0xab7f,0xa6));var _0xfab7=function(_0x34666b,_0x1e0246){_0x34666b=_0x34666b-0x0;var _0x391828=_0xab7f[_0x34666b];return _0x391828;};'use strict';var Sequelize=require(_0xfab7('0x0'));module[_0xfab7('0x1')]={'name':{'type':Sequelize[_0xfab7('0x2')],'allowNull':![],'unique':_0xfab7('0x3')},'version':{'type':Sequelize[_0xfab7('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0xfab7('0x2')],'defaultValue':_0xfab7('0x4')},'filename':{'type':Sequelize[_0xfab7('0x2')]},'path':{'type':Sequelize[_0xfab7('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0xfab7('0x5')]},'active':{'type':Sequelize[_0xfab7('0x6')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0xfab7('0x2')]},'state':{'type':Sequelize[_0xfab7('0x2')],'unique':_0xfab7('0x7')},'description':{'type':Sequelize[_0xfab7('0x2')]},'title':{'type':Sequelize[_0xfab7('0x2')]},'remoteUri':{'type':Sequelize[_0xfab7('0x2')]},'link':{'type':Sequelize[_0xfab7('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 a353cba..dcb9e45 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 _0x4888=['lodash','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','limit','undefined','count','set','apply','reject','save','then','sendStatus','error','name','send','index','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','Integration','includeAll','include','rows','catch','params','options','create','body','update','find','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra'];(function(_0x3a0f3e,_0x52601f){var _0x300e5a=function(_0x333e1f){while(--_0x333e1f){_0x3a0f3e['push'](_0x3a0f3e['shift']());}};_0x300e5a(++_0x52601f);}(_0x4888,0x198));var _0x8488=function(_0x292423,_0x1759b7){_0x292423=_0x292423-0x0;var _0x2801cb=_0x4888[_0x292423];return _0x2801cb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8488('0x0'));var zipdir=require(_0x8488('0x1'));var jsonpatch=require(_0x8488('0x2'));var rp=require(_0x8488('0x3'));var moment=require(_0x8488('0x4'));var BPromise=require(_0x8488('0x5'));var Mustache=require(_0x8488('0x6'));var util=require('util');var path=require(_0x8488('0x7'));var sox=require(_0x8488('0x8'));var csv=require(_0x8488('0x9'));var ejs=require(_0x8488('0xa'));var fs=require('fs');var fs_extra=require(_0x8488('0xb'));var _=require(_0x8488('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8488('0x9'));var querystring=require(_0x8488('0xd'));var Papa=require('papaparse');var Redis=require(_0x8488('0xe'));var authService=require(_0x8488('0xf'));var qs=require(_0x8488('0x10'));var as=require(_0x8488('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8488('0x12'))(_0x8488('0x13'));var utils=require(_0x8488('0x14'));var config=require(_0x8488('0x15'));var licenseUtil=require(_0x8488('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14462e,_0x3d1f7a){_0x3d1f7a=_0x3d1f7a||0xcc;return function(_0x58f83d){if(_0x58f83d){return _0x14462e['sendStatus'](_0x3d1f7a);}return _0x14462e[_0x8488('0x17')](_0x3d1f7a)['end']();};}function respondWithResult(_0x214083,_0x4e94fc){_0x4e94fc=_0x4e94fc||0xc8;return function(_0x5161a3){if(_0x5161a3){return _0x214083[_0x8488('0x17')](_0x4e94fc)[_0x8488('0x18')](_0x5161a3);}};}function respondWithFilteredResult(_0x5700b,_0x2bcb7c){return function(_0x3b3cfa){if(_0x3b3cfa){var _0x8d3b3d=typeof _0x2bcb7c[_0x8488('0x19')]==='undefined'&&typeof _0x2bcb7c[_0x8488('0x1a')]===_0x8488('0x1b');var _0x3edfe4=_0x3b3cfa[_0x8488('0x1c')];var _0x60ae2f=_0x8d3b3d?0x0:_0x2bcb7c[_0x8488('0x19')];var _0x1aedb1=_0x8d3b3d?_0x3b3cfa[_0x8488('0x1c')]:_0x2bcb7c[_0x8488('0x19')]+_0x2bcb7c[_0x8488('0x1a')];var _0x10bfd6;if(_0x1aedb1>=_0x3edfe4){_0x1aedb1=_0x3edfe4;_0x10bfd6=0xc8;}else{_0x10bfd6=0xce;}_0x5700b[_0x8488('0x17')](_0x10bfd6);return _0x5700b[_0x8488('0x1d')]('Content-Range',_0x60ae2f+'-'+_0x1aedb1+'/'+_0x3edfe4)['json'](_0x3b3cfa);}return null;};}function patchUpdates(_0x340d6b){return function(_0x12d40f){try{jsonpatch[_0x8488('0x1e')](_0x12d40f,_0x340d6b,!![]);}catch(_0x3c9fc2){return BPromise[_0x8488('0x1f')](_0x3c9fc2);}return _0x12d40f[_0x8488('0x20')]();};}function saveUpdates(_0x43b672,_0x3c078c){return function(_0x39dd43){if(_0x39dd43){return _0x39dd43['update'](_0x43b672)[_0x8488('0x21')](function(_0x4e07e1){return _0x4e07e1;});}return null;};}function removeEntity(_0x140b0b,_0x1361a6){return function(_0x290b33){if(_0x290b33){return _0x290b33['destroy']()['then'](function(){_0x140b0b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x472624,_0x51fe30){return function(_0x58057a){if(!_0x58057a){_0x472624[_0x8488('0x22')](0x194);}return _0x58057a;};}function handleError(_0x2f350a,_0x2b3c97){_0x2b3c97=_0x2b3c97||0x1f4;return function(_0x6ebee0){logger[_0x8488('0x23')](_0x6ebee0['stack']);if(_0x6ebee0[_0x8488('0x24')]){delete _0x6ebee0[_0x8488('0x24')];}_0x2f350a[_0x8488('0x17')](_0x2b3c97)[_0x8488('0x25')](_0x6ebee0);};}exports[_0x8488('0x26')]=function(_0x27f5cf,_0x2c15ff){var _0x296b6c={},_0x368f9c={},_0x1d9317={'count':0x0,'rows':[]};var _0x888b24=_['map'](db['Integration']['rawAttributes'],function(_0x292fe8){return{'name':_0x292fe8[_0x8488('0x27')],'type':_0x292fe8[_0x8488('0x28')][_0x8488('0x29')]};});_0x368f9c[_0x8488('0x2a')]=_[_0x8488('0x2b')](_0x888b24,'name');_0x368f9c[_0x8488('0x2c')]=_[_0x8488('0x2d')](_0x27f5cf[_0x8488('0x2c')]);_0x368f9c[_0x8488('0x2e')]=_[_0x8488('0x2f')](_0x368f9c['model'],_0x368f9c[_0x8488('0x2c')]);_0x296b6c[_0x8488('0x30')]=_['intersection'](_0x368f9c[_0x8488('0x2a')],qs[_0x8488('0x31')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x31')]));_0x296b6c[_0x8488('0x30')]=_0x296b6c['attributes'][_0x8488('0x32')]?_0x296b6c[_0x8488('0x30')]:_0x368f9c[_0x8488('0x2a')];if(!_0x27f5cf['query'][_0x8488('0x33')]('nolimit')){_0x296b6c[_0x8488('0x1a')]=qs[_0x8488('0x1a')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x1a')]);_0x296b6c['offset']=qs[_0x8488('0x19')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x19')]);}_0x296b6c['order']=qs[_0x8488('0x34')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x34')]);_0x296b6c[_0x8488('0x35')]=qs[_0x8488('0x2e')](_[_0x8488('0x36')](_0x27f5cf[_0x8488('0x2c')],_0x368f9c[_0x8488('0x2e')]),_0x888b24);if(_0x27f5cf[_0x8488('0x2c')][_0x8488('0x37')]){_0x296b6c[_0x8488('0x35')]=_['merge'](_0x296b6c['where'],{'$or':_[_0x8488('0x2b')](_0x888b24,function(_0x36c17a){if(_0x36c17a[_0x8488('0x28')]!==_0x8488('0x38')){var _0x2d9fa1={};_0x2d9fa1[_0x36c17a[_0x8488('0x24')]]={'$like':'%'+_0x27f5cf[_0x8488('0x2c')][_0x8488('0x37')]+'%'};return _0x2d9fa1;}})});}_0x296b6c=_[_0x8488('0x39')]({},_0x296b6c,_0x27f5cf['options']);var _0xf5a0a0={'where':_0x296b6c[_0x8488('0x35')]};return db[_0x8488('0x3a')]['count'](_0xf5a0a0)[_0x8488('0x21')](function(_0xa50c4b){_0x1d9317[_0x8488('0x1c')]=_0xa50c4b;if(_0x27f5cf[_0x8488('0x2c')][_0x8488('0x3b')]){_0x296b6c[_0x8488('0x3c')]=[{'all':!![]}];}return db[_0x8488('0x3a')]['findAll'](_0x296b6c);})[_0x8488('0x21')](function(_0x1c33a1){_0x1d9317[_0x8488('0x3d')]=_0x1c33a1;return _0x1d9317;})['then'](respondWithFilteredResult(_0x2c15ff,_0x296b6c))[_0x8488('0x3e')](handleError(_0x2c15ff,null));};exports['show']=function(_0x40ee7e,_0x34b11b){var _0x5cbd11={'raw':![],'where':{'id':_0x40ee7e[_0x8488('0x3f')]['id']}},_0x22a3f3={};_0x22a3f3[_0x8488('0x2a')]=_[_0x8488('0x2d')](db[_0x8488('0x3a')]['rawAttributes']);_0x22a3f3[_0x8488('0x2c')]=_['keys'](_0x40ee7e[_0x8488('0x2c')]);_0x22a3f3[_0x8488('0x2e')]=_[_0x8488('0x2f')](_0x22a3f3[_0x8488('0x2a')],_0x22a3f3[_0x8488('0x2c')]);_0x5cbd11[_0x8488('0x30')]=_[_0x8488('0x2f')](_0x22a3f3[_0x8488('0x2a')],qs[_0x8488('0x31')](_0x40ee7e[_0x8488('0x2c')][_0x8488('0x31')]));_0x5cbd11[_0x8488('0x30')]=_0x5cbd11[_0x8488('0x30')][_0x8488('0x32')]?_0x5cbd11[_0x8488('0x30')]:_0x22a3f3[_0x8488('0x2a')];if(_0x40ee7e[_0x8488('0x2c')]['includeAll']){_0x5cbd11[_0x8488('0x3c')]=[{'all':!![]}];}_0x5cbd11=_[_0x8488('0x39')]({},_0x5cbd11,_0x40ee7e[_0x8488('0x40')]);return db[_0x8488('0x3a')]['find'](_0x5cbd11)[_0x8488('0x21')](handleEntityNotFound(_0x34b11b,null))[_0x8488('0x21')](respondWithResult(_0x34b11b,null))[_0x8488('0x3e')](handleError(_0x34b11b,null));};exports[_0x8488('0x41')]=function(_0x52042c,_0x1f0516){return db[_0x8488('0x3a')][_0x8488('0x41')](_0x52042c[_0x8488('0x42')],{})[_0x8488('0x21')](respondWithResult(_0x1f0516,0xc9))[_0x8488('0x3e')](handleError(_0x1f0516,null));};exports[_0x8488('0x43')]=function(_0x299d8e,_0x1bc2e1){if(_0x299d8e[_0x8488('0x42')]['id']){delete _0x299d8e[_0x8488('0x42')]['id'];}return db[_0x8488('0x3a')][_0x8488('0x44')]({'where':{'id':_0x299d8e['params']['id']}})['then'](handleEntityNotFound(_0x1bc2e1,null))[_0x8488('0x21')](saveUpdates(_0x299d8e[_0x8488('0x42')],null))[_0x8488('0x21')](respondWithResult(_0x1bc2e1,null))[_0x8488('0x3e')](handleError(_0x1bc2e1,null));};exports[_0x8488('0x45')]=function(_0x22d22c,_0x25f2dc){return db[_0x8488('0x3a')][_0x8488('0x44')]({'where':{'id':_0x22d22c['params']['id']}})[_0x8488('0x21')](handleEntityNotFound(_0x25f2dc,null))[_0x8488('0x21')](removeEntity(_0x25f2dc,null))['catch'](handleError(_0x25f2dc,null));}; \ No newline at end of file +var _0x2ef3=['update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','Integration','then','includeAll','include','findAll','catch','show','params','keys','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x3bba4c,_0x1554b5){var _0xb90a9a=function(_0x271abe){while(--_0x271abe){_0x3bba4c['push'](_0x3bba4c['shift']());}};_0xb90a9a(++_0x1554b5);}(_0x2ef3,0xba));var _0x32ef=function(_0x4c1929,_0x8beedb){_0x4c1929=_0x4c1929-0x0;var _0x439cbf=_0x2ef3[_0x4c1929];return _0x439cbf;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['Integration'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'all':!![]}];}return db[_0x32ef('0x3d')][_0x32ef('0x41')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x3c0e44){_0x3c569d['rows']=_0x3c0e44;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x42')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x43')]=function(_0x2a33dd,_0x765c63){var _0x5dca14={'raw':![],'where':{'id':_0x2a33dd[_0x32ef('0x44')]['id']}},_0x2901a1={};_0x2901a1['model']=_[_0x32ef('0x45')](db['Integration'][_0x32ef('0x2a')]);_0x2901a1[_0x32ef('0x2f')]=_[_0x32ef('0x45')](_0x2a33dd[_0x32ef('0x2f')]);_0x2901a1[_0x32ef('0x30')]=_[_0x32ef('0x32')](_0x2901a1[_0x32ef('0x2e')],_0x2901a1[_0x32ef('0x2f')]);_0x5dca14[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x2901a1['model'],qs[_0x32ef('0x33')](_0x2a33dd['query'][_0x32ef('0x33')]));_0x5dca14[_0x32ef('0x31')]=_0x5dca14[_0x32ef('0x31')]['length']?_0x5dca14[_0x32ef('0x31')]:_0x2901a1[_0x32ef('0x2e')];if(_0x2a33dd[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5dca14[_0x32ef('0x40')]=[{'all':!![]}];}_0x5dca14=_[_0x32ef('0x3b')]({},_0x5dca14,_0x2a33dd[_0x32ef('0x3c')]);return db['Integration']['find'](_0x5dca14)[_0x32ef('0x3e')](handleEntityNotFound(_0x765c63,null))[_0x32ef('0x3e')](respondWithResult(_0x765c63,null))[_0x32ef('0x42')](handleError(_0x765c63,null));};exports[_0x32ef('0x46')]=function(_0x209361,_0xd67dc9){return db[_0x32ef('0x3d')][_0x32ef('0x46')](_0x209361[_0x32ef('0x47')],{})[_0x32ef('0x3e')](respondWithResult(_0xd67dc9,0xc9))[_0x32ef('0x42')](handleError(_0xd67dc9,null));};exports[_0x32ef('0x24')]=function(_0x36a65c,_0x4c2534){if(_0x36a65c[_0x32ef('0x47')]['id']){delete _0x36a65c[_0x32ef('0x47')]['id'];}return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x36a65c[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x4c2534,null))[_0x32ef('0x3e')](saveUpdates(_0x36a65c[_0x32ef('0x47')],null))[_0x32ef('0x3e')](respondWithResult(_0x4c2534,null))[_0x32ef('0x42')](handleError(_0x4c2534,null));};exports[_0x32ef('0x49')]=function(_0x29d456,_0x272377){return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x29d456[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x272377,null))[_0x32ef('0x3e')](removeEntity(_0x272377,null))['catch'](handleError(_0x272377,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index ea9f705..f08091c 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 _0xe5cd=['bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','define','Integration','integrations','lodash','util','../../config/logger','api','moment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe5cd,0xdb));var _0xde5c=function(_0x2f5102,_0x30e8e0){_0x2f5102=_0x2f5102-0x0;var _0x19cf7a=_0xe5cd[_0x2f5102];return _0x19cf7a;};'use strict';var _=require(_0xde5c('0x0'));var util=require(_0xde5c('0x1'));var logger=require(_0xde5c('0x2'))(_0xde5c('0x3'));var moment=require(_0xde5c('0x4'));var BPromise=require(_0xde5c('0x5'));var rp=require(_0xde5c('0x6'));var fs=require('fs');var path=require(_0xde5c('0x7'));var rimraf=require(_0xde5c('0x8'));var config=require(_0xde5c('0x9'));var attributes=require(_0xde5c('0xa'));module['exports']=function(_0x5530da,_0x4dc0fa){return _0x5530da[_0xde5c('0xb')](_0xde5c('0xc'),attributes,{'tableName':_0xde5c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe0e5=['exports','define','integrations','lodash','util','../../config/logger','api','moment','request-promise','rimraf','./integration.attributes'];(function(_0x268988,_0x11b770){var _0x1579e5=function(_0x292dd0){while(--_0x292dd0){_0x268988['push'](_0x268988['shift']());}};_0x1579e5(++_0x11b770);}(_0xe0e5,0xdf));var _0x5e0e=function(_0x33554b,_0x48162b){_0x33554b=_0x33554b-0x0;var _0x256954=_0xe0e5[_0x33554b];return _0x256954;};'use strict';var _=require(_0x5e0e('0x0'));var util=require(_0x5e0e('0x1'));var logger=require(_0x5e0e('0x2'))(_0x5e0e('0x3'));var moment=require(_0x5e0e('0x4'));var BPromise=require('bluebird');var rp=require(_0x5e0e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5e0e('0x6'));var config=require('../../config/environment');var attributes=require(_0x5e0e('0x7'));module[_0x5e0e('0x8')]=function(_0x3f9b27,_0x408c86){return _0x3f9b27[_0x5e0e('0x9')]('Integration',attributes,{'tableName':_0x5e0e('0xa'),'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 383374a..63cb7b7 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 _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(_0x297b5a,_0x5b36bb){var _0x3c7ebd=function(_0x541fab){while(--_0x541fab){_0x297b5a['push'](_0x297b5a['shift']());}};_0x3c7ebd(++_0x5b36bb);}(_0x896e,0x1e9));var _0xe896=function(_0x5efcd9,_0x1ef488){_0x5efcd9=_0x5efcd9-0x0;var _0x45c54a=_0x896e[_0x5efcd9];return _0x45c54a;};'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 +var _0x57ca=['client','http','request','info','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','error','code','Integration,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x361d97,_0x4d5411){var _0x2c77bd=function(_0x4fa100){while(--_0x4fa100){_0x361d97['push'](_0x361d97['shift']());}};_0x2c77bd(++_0x4d5411);}(_0x57ca,0x108));var _0xa57c=function(_0x34e806,_0x568f5b){_0x34e806=_0x34e806-0x0;var _0x41044e=_0x57ca[_0x34e806];return _0x41044e;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('Integration,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('Integration,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 232f386..123e6d5 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 _0x9f0e=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','multer','util'];(function(_0xfcddad,_0x58b6f6){var _0x3317d1=function(_0xe99a55){while(--_0xe99a55){_0xfcddad['push'](_0xfcddad['shift']());}};_0x3317d1(++_0x58b6f6);}(_0x9f0e,0x116));var _0xe9f0=function(_0x12a31b,_0x1aec79){_0x12a31b=_0x12a31b-0x0;var _0x143629=_0x9f0e[_0x12a31b];return _0x143629;};'use strict';var multer=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var path=require(_0xe9f0('0x2'));var timeout=require(_0xe9f0('0x3'));var express=require(_0xe9f0('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe9f0('0x5'));var interaction=require(_0xe9f0('0x6'));var config=require(_0xe9f0('0x7'));var controller=require(_0xe9f0('0x8'));router[_0xe9f0('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe9f0('0x9')](_0xe9f0('0xa'),auth[_0xe9f0('0xb')](),controller['describe']);router[_0xe9f0('0x9')](_0xe9f0('0xc'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xd')]);router[_0xe9f0('0xe')]('/',auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xf')]);router[_0xe9f0('0x10')](_0xe9f0('0xc'),auth['isAuthenticated'](),controller[_0xe9f0('0x11')]);router[_0xe9f0('0x12')](_0xe9f0('0xc'),auth['isAuthenticated'](),controller[_0xe9f0('0x13')]);module['exports']=router; \ No newline at end of file +var _0xc2c7=['/:id','show','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe'];(function(_0x4c0d01,_0x25cb48){var _0x3e475a=function(_0x3a87cb){while(--_0x3a87cb){_0x4c0d01['push'](_0x4c0d01['shift']());}};_0x3e475a(++_0x25cb48);}(_0xc2c7,0x134));var _0x7c2c=function(_0x49a853,_0x2b3c6a){_0x49a853=_0x49a853-0x0;var _0x533b60=_0xc2c7[_0x49a853];return _0x533b60;};'use strict';var multer=require('multer');var util=require(_0x7c2c('0x0'));var path=require(_0x7c2c('0x1'));var timeout=require(_0x7c2c('0x2'));var express=require(_0x7c2c('0x3'));var router=express[_0x7c2c('0x4')]();var fs_extra=require(_0x7c2c('0x5'));var auth=require(_0x7c2c('0x6'));var interaction=require(_0x7c2c('0x7'));var config=require('../../config/environment');var controller=require('./integrationReport.controller');router[_0x7c2c('0x8')]('/',auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x7c2c('0xb')]);router[_0x7c2c('0x8')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xd')]);router['post']('/',auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xe')]);router[_0x7c2c('0xf')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x10')]);router[_0x7c2c('0x11')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x12')]);module[_0x7c2c('0x13')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 32bee00..792b279 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 _0xcbce=['INTEGER','DATE','BOOLEAN','TEXT','SENDING','RECEIVED','sequelize','exports','STRING'];(function(_0x38944e,_0x9353bf){var _0x2d34d4=function(_0x52e3a7){while(--_0x52e3a7){_0x38944e['push'](_0x38944e['shift']());}};_0x2d34d4(++_0x9353bf);}(_0xcbce,0x126));var _0xecbc=function(_0x1531e8,_0x371d46){_0x1531e8=_0x1531e8-0x0;var _0x5b1112=_0xcbce[_0x1531e8];return _0x5b1112;};'use strict';var Sequelize=require(_0xecbc('0x0'));module[_0xecbc('0x1')]={'integration':{'type':Sequelize[_0xecbc('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0xecbc('0x2')]},'ticketId':{'type':Sequelize[_0xecbc('0x2')]},'integrationId':{'type':Sequelize[_0xecbc('0x3')]},'contacts':{'type':Sequelize[_0xecbc('0x2')]},'uniqueid':{'type':Sequelize[_0xecbc('0x2')]},'calleridnum':{'type':Sequelize[_0xecbc('0x2')]},'calleridname':{'type':Sequelize[_0xecbc('0x2')]},'queue':{'type':Sequelize[_0xecbc('0x2')]},'interface':{'type':Sequelize[_0xecbc('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xecbc('0x4')]},'agentconnectAt':{'type':Sequelize[_0xecbc('0x4')]},'holdtime':{'type':Sequelize[_0xecbc('0x3')]},'agentcomplete':{'type':Sequelize[_0xecbc('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xecbc('0x4')]},'talktime':{'type':Sequelize[_0xecbc('0x3')]},'agentacw':{'type':Sequelize[_0xecbc('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xecbc('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0xecbc('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0xecbc('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xecbc('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xecbc('0x2')]},'channelstate':{'type':Sequelize[_0xecbc('0x3')]},'channelstatedesc':{'type':Sequelize[_0xecbc('0x2')]},'connectedlinenum':{'type':Sequelize[_0xecbc('0x2')]},'connectedlinename':{'type':Sequelize[_0xecbc('0x2')]},'language':{'type':Sequelize[_0xecbc('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xecbc('0x2')]},'destchannel':{'type':Sequelize[_0xecbc('0x2')]},'destchannelstate':{'type':Sequelize[_0xecbc('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xecbc('0x2')]},'destcalleridname':{'type':Sequelize[_0xecbc('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xecbc('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xecbc('0x2')]},'destlanguage':{'type':Sequelize[_0xecbc('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xecbc('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xecbc('0x2')]},'destuniqueid':{'type':Sequelize[_0xecbc('0x2')]},'messageId':{'type':Sequelize[_0xecbc('0x2')]},'inReplyTo':{'type':Sequelize[_0xecbc('0x2')]},'subject':{'type':Sequelize[_0xecbc('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xecbc('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0xecbc('0x6')]},'html':{'type':Sequelize[_0xecbc('0x6')]},'text':{'type':Sequelize[_0xecbc('0x6')]},'status':{'type':Sequelize['ENUM']('SENT',_0xecbc('0x7'),_0xecbc('0x8'),'FAILED')},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0xecbc('0x3')]}}; \ No newline at end of file +var _0x89a5=['STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','FAILED','sequelize','exports'];(function(_0x43e9ed,_0xe5a03d){var _0x523323=function(_0x3a6bc1){while(--_0x3a6bc1){_0x43e9ed['push'](_0x43e9ed['shift']());}};_0x523323(++_0xe5a03d);}(_0x89a5,0x13e));var _0x589a=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0x89a5[_0xb24a3e];return _0x4038d7;};'use strict';var Sequelize=require(_0x589a('0x0'));module[_0x589a('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x589a('0x2')]},'exitStatus':{'type':Sequelize[_0x589a('0x2')]},'ticketId':{'type':Sequelize[_0x589a('0x2')]},'integrationId':{'type':Sequelize[_0x589a('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x589a('0x2')]},'calleridnum':{'type':Sequelize[_0x589a('0x2')]},'calleridname':{'type':Sequelize[_0x589a('0x2')]},'queue':{'type':Sequelize[_0x589a('0x2')]},'interface':{'type':Sequelize[_0x589a('0x2')]},'membername':{'type':Sequelize[_0x589a('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x589a('0x4')]},'holdtime':{'type':Sequelize[_0x589a('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x589a('0x3')]},'agentacw':{'type':Sequelize[_0x589a('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x589a('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x589a('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x589a('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x589a('0x2')]},'channel':{'type':Sequelize[_0x589a('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x589a('0x2')]},'connectedlinenum':{'type':Sequelize[_0x589a('0x2')]},'connectedlinename':{'type':Sequelize[_0x589a('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x589a('0x2')]},'exten':{'type':Sequelize[_0x589a('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x589a('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x589a('0x2')]},'destcalleridnum':{'type':Sequelize[_0x589a('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x589a('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x589a('0x2')]},'destlanguage':{'type':Sequelize[_0x589a('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x589a('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x589a('0x2')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x589a('0x2')]},'from':{'type':Sequelize[_0x589a('0x2')]},'to':{'type':Sequelize[_0x589a('0x2')]},'cc':{'type':Sequelize[_0x589a('0x2')]},'attachment':{'type':Sequelize[_0x589a('0x6')]},'html':{'type':Sequelize[_0x589a('0x6')]},'text':{'type':Sequelize[_0x589a('0x6')]},'status':{'type':Sequelize[_0x589a('0x7')](_0x589a('0x8'),'SENDING','RECEIVED',_0x589a('0x9'))},'url':{'type':Sequelize[_0x589a('0x2')]},'app':{'type':Sequelize[_0x589a('0x2')]},'appdata':{'type':Sequelize[_0x589a('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index f0c7d39..f94a50b 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 _0x28ab=['json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','includeAll','find','create','body','params','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x11d7c8,_0x5e314d){var _0x13f99b=function(_0x4fe765){while(--_0x4fe765){_0x11d7c8['push'](_0x11d7c8['shift']());}};_0x13f99b(++_0x5e314d);}(_0x28ab,0x1f3));var _0xb28a=function(_0x3ee341,_0x36455d){_0x3ee341=_0x3ee341-0x0;var _0x24d686=_0x28ab[_0x3ee341];return _0x24d686;};'use strict';var emlformat=require(_0xb28a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb28a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb28a('0x2'));var moment=require(_0xb28a('0x3'));var BPromise=require(_0xb28a('0x4'));var Mustache=require(_0xb28a('0x5'));var util=require('util');var path=require(_0xb28a('0x6'));var sox=require('sox');var csv=require(_0xb28a('0x7'));var ejs=require(_0xb28a('0x8'));var fs=require('fs');var fs_extra=require(_0xb28a('0x9'));var _=require(_0xb28a('0xa'));var squel=require(_0xb28a('0xb'));var crypto=require(_0xb28a('0xc'));var jsforce=require(_0xb28a('0xd'));var deskjs=require(_0xb28a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb28a('0xf'));var Papa=require(_0xb28a('0x10'));var Redis=require(_0xb28a('0x11'));var authService=require(_0xb28a('0x12'));var qs=require(_0xb28a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xb28a('0x14'));var licenseUtil=require(_0xb28a('0x15'));var db=require(_0xb28a('0x16'))['db'];function respondWithStatusCode(_0x226688,_0x4e633b){_0x4e633b=_0x4e633b||0xcc;return function(_0x53549a){if(_0x53549a){return _0x226688[_0xb28a('0x17')](_0x4e633b);}return _0x226688[_0xb28a('0x18')](_0x4e633b)[_0xb28a('0x19')]();};}function respondWithResult(_0x53eb2d,_0x3435a8){_0x3435a8=_0x3435a8||0xc8;return function(_0x161e04){if(_0x161e04){return _0x53eb2d['status'](_0x3435a8)[_0xb28a('0x1a')](_0x161e04);}};}function respondWithFilteredResult(_0x1cbb9b,_0x348862){return function(_0x51e331){if(_0x51e331){var _0x577e40=typeof _0x348862['offset']===_0xb28a('0x1b')&&typeof _0x348862[_0xb28a('0x1c')]===_0xb28a('0x1b');var _0x57053b=_0x51e331[_0xb28a('0x1d')];var _0x316d65=_0x577e40?0x0:_0x348862[_0xb28a('0x1e')];var _0x1f08cf=_0x577e40?_0x51e331[_0xb28a('0x1d')]:_0x348862[_0xb28a('0x1e')]+_0x348862[_0xb28a('0x1c')];var _0x3854d4;if(_0x1f08cf>=_0x57053b){_0x1f08cf=_0x57053b;_0x3854d4=0xc8;}else{_0x3854d4=0xce;}_0x1cbb9b[_0xb28a('0x18')](_0x3854d4);return _0x1cbb9b[_0xb28a('0x1f')](_0xb28a('0x20'),_0x316d65+'-'+_0x1f08cf+'/'+_0x57053b)[_0xb28a('0x1a')](_0x51e331);}return null;};}function patchUpdates(_0x3d7819){return function(_0x46512e){try{jsonpatch[_0xb28a('0x21')](_0x46512e,_0x3d7819,!![]);}catch(_0x13212d){return BPromise['reject'](_0x13212d);}return _0x46512e['save']();};}function saveUpdates(_0x4f417d,_0x5cef18){return function(_0x570e7d){if(_0x570e7d){return _0x570e7d[_0xb28a('0x22')](_0x4f417d)[_0xb28a('0x23')](function(_0x345a15){return _0x345a15;});}return null;};}function removeEntity(_0x175256,_0x3ae708){return function(_0x65b795){if(_0x65b795){return _0x65b795[_0xb28a('0x24')]()['then'](function(){_0x175256[_0xb28a('0x18')](0xcc)[_0xb28a('0x19')]();});}};}function handleEntityNotFound(_0x56bc5a,_0x36e8e2){return function(_0x1291fd){if(!_0x1291fd){_0x56bc5a[_0xb28a('0x17')](0x194);}return _0x1291fd;};}function handleError(_0x3b1de4,_0x9fa13f){_0x9fa13f=_0x9fa13f||0x1f4;return function(_0x55d078){logger[_0xb28a('0x25')](_0x55d078[_0xb28a('0x26')]);if(_0x55d078['name']){delete _0x55d078[_0xb28a('0x27')];}_0x3b1de4[_0xb28a('0x18')](_0x9fa13f)[_0xb28a('0x28')](_0x55d078);};}exports[_0xb28a('0x29')]=function(_0x4fb8f8,_0x29e934){var _0x1c8452={},_0x1f15e9={},_0x21dc3e={'count':0x0,'rows':[]};var _0x41daf2=_[_0xb28a('0x2a')](db[_0xb28a('0x2b')][_0xb28a('0x2c')],function(_0x451bb2){return{'name':_0x451bb2[_0xb28a('0x2d')],'type':_0x451bb2[_0xb28a('0x2e')]['key']};});_0x1f15e9[_0xb28a('0x2f')]=_[_0xb28a('0x2a')](_0x41daf2,_0xb28a('0x27'));_0x1f15e9[_0xb28a('0x30')]=_[_0xb28a('0x31')](_0x4fb8f8['query']);_0x1f15e9[_0xb28a('0x32')]=_[_0xb28a('0x33')](_0x1f15e9[_0xb28a('0x2f')],_0x1f15e9[_0xb28a('0x30')]);_0x1c8452[_0xb28a('0x34')]=_[_0xb28a('0x33')](_0x1f15e9[_0xb28a('0x2f')],qs[_0xb28a('0x35')](_0x4fb8f8['query'][_0xb28a('0x35')]));_0x1c8452[_0xb28a('0x34')]=_0x1c8452[_0xb28a('0x34')][_0xb28a('0x36')]?_0x1c8452[_0xb28a('0x34')]:_0x1f15e9[_0xb28a('0x2f')];if(!_0x4fb8f8[_0xb28a('0x30')][_0xb28a('0x37')](_0xb28a('0x38'))){_0x1c8452[_0xb28a('0x1c')]=qs[_0xb28a('0x1c')](_0x4fb8f8[_0xb28a('0x30')][_0xb28a('0x1c')]);_0x1c8452[_0xb28a('0x1e')]=qs['offset'](_0x4fb8f8[_0xb28a('0x30')][_0xb28a('0x1e')]);}_0x1c8452['order']=qs[_0xb28a('0x39')](_0x4fb8f8[_0xb28a('0x30')][_0xb28a('0x39')]);_0x1c8452['where']=qs[_0xb28a('0x32')](_[_0xb28a('0x3a')](_0x4fb8f8['query'],_0x1f15e9['filters']),_0x41daf2);if(_0x4fb8f8[_0xb28a('0x30')][_0xb28a('0x3b')]){_0x1c8452[_0xb28a('0x3c')]=_[_0xb28a('0x3d')](_0x1c8452[_0xb28a('0x3c')],{'$or':_[_0xb28a('0x2a')](_0x41daf2,function(_0x3cb30c){if(_0x3cb30c['type']!==_0xb28a('0x3e')){var _0xb5901c={};_0xb5901c[_0x3cb30c[_0xb28a('0x27')]]={'$like':'%'+_0x4fb8f8['query']['filter']+'%'};return _0xb5901c;}})});}_0x1c8452=_[_0xb28a('0x3d')]({},_0x1c8452,_0x4fb8f8[_0xb28a('0x3f')]);var _0x34fd48={'where':_0x1c8452['where']};return db[_0xb28a('0x2b')][_0xb28a('0x1d')](_0x34fd48)['then'](function(_0x3eb418){_0x21dc3e[_0xb28a('0x1d')]=_0x3eb418;if(_0x4fb8f8[_0xb28a('0x30')]['includeAll']){_0x1c8452[_0xb28a('0x40')]=[{'all':!![]}];}return db['IntegrationReport'][_0xb28a('0x41')](_0x1c8452);})[_0xb28a('0x23')](function(_0x1720ed){_0x21dc3e[_0xb28a('0x42')]=_0x1720ed;return _0x21dc3e;})[_0xb28a('0x23')](respondWithFilteredResult(_0x29e934,_0x1c8452))[_0xb28a('0x43')](handleError(_0x29e934,null));};exports[_0xb28a('0x44')]=function(_0x27a84b,_0xa91d58){var _0x395459={'raw':![],'where':{'id':_0x27a84b['params']['id']}},_0x1b561c={};_0x1b561c[_0xb28a('0x2f')]=_[_0xb28a('0x31')](db['IntegrationReport']['rawAttributes']);_0x1b561c[_0xb28a('0x30')]=_[_0xb28a('0x31')](_0x27a84b[_0xb28a('0x30')]);_0x1b561c[_0xb28a('0x32')]=_[_0xb28a('0x33')](_0x1b561c[_0xb28a('0x2f')],_0x1b561c[_0xb28a('0x30')]);_0x395459[_0xb28a('0x34')]=_[_0xb28a('0x33')](_0x1b561c[_0xb28a('0x2f')],qs[_0xb28a('0x35')](_0x27a84b['query'][_0xb28a('0x35')]));_0x395459[_0xb28a('0x34')]=_0x395459[_0xb28a('0x34')][_0xb28a('0x36')]?_0x395459['attributes']:_0x1b561c[_0xb28a('0x2f')];if(_0x27a84b[_0xb28a('0x30')][_0xb28a('0x45')]){_0x395459[_0xb28a('0x40')]=[{'all':!![]}];}_0x395459=_[_0xb28a('0x3d')]({},_0x395459,_0x27a84b['options']);return db[_0xb28a('0x2b')][_0xb28a('0x46')](_0x395459)[_0xb28a('0x23')](handleEntityNotFound(_0xa91d58,null))[_0xb28a('0x23')](respondWithResult(_0xa91d58,null))[_0xb28a('0x43')](handleError(_0xa91d58,null));};exports[_0xb28a('0x47')]=function(_0x12c5b5,_0x28f88d){return db['IntegrationReport']['create'](_0x12c5b5[_0xb28a('0x48')],{})['then'](respondWithResult(_0x28f88d,0xc9))[_0xb28a('0x43')](handleError(_0x28f88d,null));};exports[_0xb28a('0x22')]=function(_0x4ce978,_0x165121){if(_0x4ce978['body']['id']){delete _0x4ce978[_0xb28a('0x48')]['id'];}return db[_0xb28a('0x2b')][_0xb28a('0x46')]({'where':{'id':_0x4ce978[_0xb28a('0x49')]['id']}})[_0xb28a('0x23')](handleEntityNotFound(_0x165121,null))[_0xb28a('0x23')](saveUpdates(_0x4ce978['body'],null))[_0xb28a('0x23')](respondWithResult(_0x165121,null))['catch'](handleError(_0x165121,null));};exports[_0xb28a('0x24')]=function(_0x24e7f8,_0x2032f0){return db['IntegrationReport']['find']({'where':{'id':_0x24e7f8[_0xb28a('0x49')]['id']}})['then'](handleEntityNotFound(_0x2032f0,null))['then'](removeEntity(_0x2032f0,null))[_0xb28a('0x43')](handleError(_0x2032f0,null));};exports[_0xb28a('0x4a')]=function(_0x435e3c,_0x402041){return db[_0xb28a('0x2b')][_0xb28a('0x4a')]()[_0xb28a('0x23')](respondWithResult(_0x402041,null))['catch'](handleError(_0x402041,null));}; \ No newline at end of file +var _0x311b=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','send','map','IntegrationReport','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','merge','options','find','create','body','destroy','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x35022e,_0xf1b1a8){var _0x18c1c9=function(_0x3b29da){while(--_0x3b29da){_0x35022e['push'](_0x35022e['shift']());}};_0x18c1c9(++_0xf1b1a8);}(_0x311b,0x138));var _0xb311=function(_0x3b58e2,_0x4fbf5f){_0x3b58e2=_0x3b58e2-0x0;var _0x5a6677=_0x311b[_0x3b58e2];return _0x5a6677;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb311('0x0'));var zipdir=require(_0xb311('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb311('0x2'));var moment=require(_0xb311('0x3'));var BPromise=require(_0xb311('0x4'));var Mustache=require(_0xb311('0x5'));var util=require(_0xb311('0x6'));var path=require(_0xb311('0x7'));var sox=require(_0xb311('0x8'));var csv=require(_0xb311('0x9'));var ejs=require(_0xb311('0xa'));var fs=require('fs');var fs_extra=require(_0xb311('0xb'));var _=require(_0xb311('0xc'));var squel=require(_0xb311('0xd'));var crypto=require('crypto');var jsforce=require(_0xb311('0xe'));var deskjs=require(_0xb311('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb311('0x10'));var Papa=require(_0xb311('0x11'));var Redis=require(_0xb311('0x12'));var authService=require(_0xb311('0x13'));var qs=require(_0xb311('0x14'));var as=require(_0xb311('0x15'));var hardwareService=require(_0xb311('0x16'));var logger=require(_0xb311('0x17'))(_0xb311('0x18'));var utils=require(_0xb311('0x19'));var config=require(_0xb311('0x1a'));var licenseUtil=require(_0xb311('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28e1a3,_0x3c6893){_0x3c6893=_0x3c6893||0xcc;return function(_0x16e7ad){if(_0x16e7ad){return _0x28e1a3[_0xb311('0x1c')](_0x3c6893);}return _0x28e1a3['status'](_0x3c6893)[_0xb311('0x1d')]();};}function respondWithResult(_0x5208c1,_0x1d9ec0){_0x1d9ec0=_0x1d9ec0||0xc8;return function(_0x32ff20){if(_0x32ff20){return _0x5208c1[_0xb311('0x1e')](_0x1d9ec0)[_0xb311('0x1f')](_0x32ff20);}};}function respondWithFilteredResult(_0x5ed5c4,_0x2fee6a){return function(_0x58aad8){if(_0x58aad8){var _0x42a0fb=typeof _0x2fee6a['offset']===_0xb311('0x20')&&typeof _0x2fee6a['limit']===_0xb311('0x20');var _0x128066=_0x58aad8[_0xb311('0x21')];var _0x40dcc0=_0x42a0fb?0x0:_0x2fee6a[_0xb311('0x22')];var _0x2e886e=_0x42a0fb?_0x58aad8[_0xb311('0x21')]:_0x2fee6a[_0xb311('0x22')]+_0x2fee6a['limit'];var _0x1e667b;if(_0x2e886e>=_0x128066){_0x2e886e=_0x128066;_0x1e667b=0xc8;}else{_0x1e667b=0xce;}_0x5ed5c4['status'](_0x1e667b);return _0x5ed5c4[_0xb311('0x23')](_0xb311('0x24'),_0x40dcc0+'-'+_0x2e886e+'/'+_0x128066)[_0xb311('0x1f')](_0x58aad8);}return null;};}function patchUpdates(_0x485f06){return function(_0x41e5b6){try{jsonpatch[_0xb311('0x25')](_0x41e5b6,_0x485f06,!![]);}catch(_0x1967d6){return BPromise[_0xb311('0x26')](_0x1967d6);}return _0x41e5b6[_0xb311('0x27')]();};}function saveUpdates(_0x5ac4cc,_0x1fb84f){return function(_0x3b0bfe){if(_0x3b0bfe){return _0x3b0bfe[_0xb311('0x28')](_0x5ac4cc)[_0xb311('0x29')](function(_0x3172c9){return _0x3172c9;});}return null;};}function removeEntity(_0x1b0267,_0x477c30){return function(_0x12c42d){if(_0x12c42d){return _0x12c42d['destroy']()[_0xb311('0x29')](function(){_0x1b0267[_0xb311('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d8e35,_0x34cd32){return function(_0x4ba3b7){if(!_0x4ba3b7){_0x4d8e35['sendStatus'](0x194);}return _0x4ba3b7;};}function handleError(_0x26d049,_0x3dde16){_0x3dde16=_0x3dde16||0x1f4;return function(_0x413b60){logger[_0xb311('0x2a')](_0x413b60[_0xb311('0x2b')]);if(_0x413b60['name']){delete _0x413b60['name'];}_0x26d049[_0xb311('0x1e')](_0x3dde16)[_0xb311('0x2c')](_0x413b60);};}exports['index']=function(_0x5bfb5f,_0x226ed8){var _0x2c1996={},_0x47e83e={},_0x196f19={'count':0x0,'rows':[]};var _0x1d6cd2=_[_0xb311('0x2d')](db[_0xb311('0x2e')][_0xb311('0x2f')],function(_0x13135f){return{'name':_0x13135f[_0xb311('0x30')],'type':_0x13135f[_0xb311('0x31')][_0xb311('0x32')]};});_0x47e83e[_0xb311('0x33')]=_[_0xb311('0x2d')](_0x1d6cd2,_0xb311('0x34'));_0x47e83e[_0xb311('0x35')]=_['keys'](_0x5bfb5f['query']);_0x47e83e[_0xb311('0x36')]=_[_0xb311('0x37')](_0x47e83e[_0xb311('0x33')],_0x47e83e[_0xb311('0x35')]);_0x2c1996[_0xb311('0x38')]=_[_0xb311('0x37')](_0x47e83e[_0xb311('0x33')],qs[_0xb311('0x39')](_0x5bfb5f[_0xb311('0x35')][_0xb311('0x39')]));_0x2c1996[_0xb311('0x38')]=_0x2c1996[_0xb311('0x38')][_0xb311('0x3a')]?_0x2c1996[_0xb311('0x38')]:_0x47e83e[_0xb311('0x33')];if(!_0x5bfb5f[_0xb311('0x35')][_0xb311('0x3b')](_0xb311('0x3c'))){_0x2c1996[_0xb311('0x3d')]=qs['limit'](_0x5bfb5f[_0xb311('0x35')][_0xb311('0x3d')]);_0x2c1996[_0xb311('0x22')]=qs[_0xb311('0x22')](_0x5bfb5f['query'][_0xb311('0x22')]);}_0x2c1996[_0xb311('0x3e')]=qs[_0xb311('0x3f')](_0x5bfb5f[_0xb311('0x35')]['sort']);_0x2c1996['where']=qs['filters'](_[_0xb311('0x40')](_0x5bfb5f[_0xb311('0x35')],_0x47e83e[_0xb311('0x36')]),_0x1d6cd2);if(_0x5bfb5f[_0xb311('0x35')][_0xb311('0x41')]){_0x2c1996[_0xb311('0x42')]=_['merge'](_0x2c1996[_0xb311('0x42')],{'$or':_[_0xb311('0x2d')](_0x1d6cd2,function(_0x36101e){if(_0x36101e['type']!==_0xb311('0x43')){var _0x40f52f={};_0x40f52f[_0x36101e[_0xb311('0x34')]]={'$like':'%'+_0x5bfb5f[_0xb311('0x35')]['filter']+'%'};return _0x40f52f;}})});}_0x2c1996=_['merge']({},_0x2c1996,_0x5bfb5f['options']);var _0x61d12={'where':_0x2c1996['where']};return db[_0xb311('0x2e')]['count'](_0x61d12)[_0xb311('0x29')](function(_0x16c5da){_0x196f19['count']=_0x16c5da;if(_0x5bfb5f['query'][_0xb311('0x44')]){_0x2c1996[_0xb311('0x45')]=[{'all':!![]}];}return db[_0xb311('0x2e')][_0xb311('0x46')](_0x2c1996);})['then'](function(_0x519938){_0x196f19[_0xb311('0x47')]=_0x519938;return _0x196f19;})[_0xb311('0x29')](respondWithFilteredResult(_0x226ed8,_0x2c1996))[_0xb311('0x48')](handleError(_0x226ed8,null));};exports[_0xb311('0x49')]=function(_0x30e587,_0x58b3cc){var _0x3c9420={'raw':![],'where':{'id':_0x30e587[_0xb311('0x4a')]['id']}},_0x5d0cbb={};_0x5d0cbb[_0xb311('0x33')]=_['keys'](db[_0xb311('0x2e')][_0xb311('0x2f')]);_0x5d0cbb[_0xb311('0x35')]=_[_0xb311('0x4b')](_0x30e587[_0xb311('0x35')]);_0x5d0cbb[_0xb311('0x36')]=_[_0xb311('0x37')](_0x5d0cbb[_0xb311('0x33')],_0x5d0cbb[_0xb311('0x35')]);_0x3c9420[_0xb311('0x38')]=_[_0xb311('0x37')](_0x5d0cbb['model'],qs[_0xb311('0x39')](_0x30e587['query'][_0xb311('0x39')]));_0x3c9420['attributes']=_0x3c9420[_0xb311('0x38')][_0xb311('0x3a')]?_0x3c9420[_0xb311('0x38')]:_0x5d0cbb['model'];if(_0x30e587['query']['includeAll']){_0x3c9420[_0xb311('0x45')]=[{'all':!![]}];}_0x3c9420=_[_0xb311('0x4c')]({},_0x3c9420,_0x30e587[_0xb311('0x4d')]);return db[_0xb311('0x2e')][_0xb311('0x4e')](_0x3c9420)['then'](handleEntityNotFound(_0x58b3cc,null))[_0xb311('0x29')](respondWithResult(_0x58b3cc,null))[_0xb311('0x48')](handleError(_0x58b3cc,null));};exports[_0xb311('0x4f')]=function(_0x4a7849,_0xd1585b){return db[_0xb311('0x2e')]['create'](_0x4a7849['body'],{})[_0xb311('0x29')](respondWithResult(_0xd1585b,0xc9))[_0xb311('0x48')](handleError(_0xd1585b,null));};exports[_0xb311('0x28')]=function(_0x54fd48,_0x540848){if(_0x54fd48['body']['id']){delete _0x54fd48[_0xb311('0x50')]['id'];}return db[_0xb311('0x2e')][_0xb311('0x4e')]({'where':{'id':_0x54fd48['params']['id']}})[_0xb311('0x29')](handleEntityNotFound(_0x540848,null))[_0xb311('0x29')](saveUpdates(_0x54fd48['body'],null))[_0xb311('0x29')](respondWithResult(_0x540848,null))['catch'](handleError(_0x540848,null));};exports[_0xb311('0x51')]=function(_0x1fa9c0,_0x3f3095){return db[_0xb311('0x2e')]['find']({'where':{'id':_0x1fa9c0[_0xb311('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3f3095,null))[_0xb311('0x29')](removeEntity(_0x3f3095,null))[_0xb311('0x48')](handleError(_0x3f3095,null));};exports[_0xb311('0x52')]=function(_0x58ccb4,_0x440e21){return db[_0xb311('0x2e')]['describe']()[_0xb311('0x29')](respondWithResult(_0x440e21,null))[_0xb311('0x48')](handleError(_0x440e21,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index f40ad47..21c1436 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 _0x8043=['IntegrationReport','report_integration','lodash','util','api','bluebird','path','../../config/environment','./integrationReport.attributes','exports'];(function(_0x190965,_0x4a2cb7){var _0x150da3=function(_0x45835b){while(--_0x45835b){_0x190965['push'](_0x190965['shift']());}};_0x150da3(++_0x4a2cb7);}(_0x8043,0x7a));var _0x3804=function(_0x264b9b,_0xa1181e){_0x264b9b=_0x264b9b-0x0;var _0x4c7a0e=_0x8043[_0x264b9b];return _0x4c7a0e;};'use strict';var _=require(_0x3804('0x0'));var util=require(_0x3804('0x1'));var logger=require('../../config/logger')(_0x3804('0x2'));var moment=require('moment');var BPromise=require(_0x3804('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3804('0x4'));var rimraf=require('rimraf');var config=require(_0x3804('0x5'));var attributes=require(_0x3804('0x6'));module[_0x3804('0x7')]=function(_0x2a6799,_0x3a8bac){return _0x2a6799['define'](_0x3804('0x8'),attributes,{'tableName':_0x3804('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd7fa=['bluebird','request-promise','rimraf','./integrationReport.attributes','exports','IntegrationReport','report_integration','lodash','../../config/logger','api','moment'];(function(_0x2d07f1,_0x112dc6){var _0x38701e=function(_0x43e0f2){while(--_0x43e0f2){_0x2d07f1['push'](_0x2d07f1['shift']());}};_0x38701e(++_0x112dc6);}(_0xd7fa,0xa1));var _0xad7f=function(_0x4c321c,_0x3e9da0){_0x4c321c=_0x4c321c-0x0;var _0x25accb=_0xd7fa[_0x4c321c];return _0x25accb;};'use strict';var _=require(_0xad7f('0x0'));var util=require('util');var logger=require(_0xad7f('0x1'))(_0xad7f('0x2'));var moment=require(_0xad7f('0x3'));var BPromise=require(_0xad7f('0x4'));var rp=require(_0xad7f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xad7f('0x6'));var config=require('../../config/environment');var attributes=require(_0xad7f('0x7'));module[_0xad7f('0x8')]=function(_0x4f6d34,_0x2bdf6b){return _0x4f6d34['define'](_0xad7f('0x9'),attributes,{'tableName':_0xad7f('0xa'),'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 3ab918f..3dd2a64 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 _0x4975=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x4975,0x86));var _0x5497=function(_0x41e353,_0x4c91c6){_0x41e353=_0x41e353-0x0;var _0x2dc3a1=_0x4975[_0x41e353];return _0x2dc3a1;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});} \ No newline at end of file +var _0x4819=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','IntegrationReport,\x20%s,\x20%s','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','moment'];(function(_0x8e78f3,_0x2adccc){var _0x3b55c6=function(_0x47ab24){while(--_0x47ab24){_0x8e78f3['push'](_0x8e78f3['shift']());}};_0x3b55c6(++_0x2adccc);}(_0x4819,0xcd));var _0x9481=function(_0x44913c,_0x754aad){_0x44913c=_0x44913c-0x0;var _0x4b7ca2=_0x4819[_0x44913c];return _0x4b7ca2;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var moment=require(_0x9481('0x1'));var BPromise=require(_0x9481('0x2'));var rs=require(_0x9481('0x3'));var fs=require('fs');var Redis=require(_0x9481('0x4'));var db=require(_0x9481('0x5'))['db'];var utils=require(_0x9481('0x6'));var logger=require(_0x9481('0x7'))(_0x9481('0x8'));var config=require(_0x9481('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9481('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54cc78,_0x14e05a,_0x6c6a08){return new BPromise(function(_0x27c033,_0x3278ff){return client[_0x9481('0xb')](_0x54cc78,_0x6c6a08)['then'](function(_0x1818cf){logger['info'](_0x9481('0xc'),_0x14e05a,'request\x20sent');logger[_0x9481('0xd')](_0x9481('0xe'),_0x14e05a,_0x9481('0xf'),JSON[_0x9481('0x10')](_0x1818cf));if(_0x1818cf[_0x9481('0x11')]){if(_0x1818cf[_0x9481('0x11')][_0x9481('0x12')]===0x1f4){logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x1818cf['error']['message']);return _0x3278ff(_0x1818cf[_0x9481('0x11')][_0x9481('0x13')]);}logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x1818cf[_0x9481('0x11')][_0x9481('0x13')]);return _0x27c033(_0x1818cf[_0x9481('0x11')]['message']);}else{logger[_0x9481('0x14')](_0x9481('0xc'),_0x14e05a,'request\x20sent');_0x27c033(_0x1818cf[_0x9481('0x15')]['message']);}})[_0x9481('0x16')](function(_0x7a2ac8){logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x7a2ac8);_0x3278ff(_0x7a2ac8);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index bdc6c5a..6a07c14 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 _0xf1c6=['/:id/sub_intervals','getIntervals','create','addIntervals','destroy','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x475691,_0x122a69){var _0x190bb2=function(_0x264751){while(--_0x264751){_0x475691['push'](_0x475691['shift']());}};_0x190bb2(++_0x122a69);}(_0xf1c6,0x145));var _0x6f1c=function(_0x139a13,_0x2819d9){_0x139a13=_0x139a13-0x0;var _0xbbccd0=_0xf1c6[_0x139a13];return _0xbbccd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6f1c('0x0'));var timeout=require(_0x6f1c('0x1'));var express=require(_0x6f1c('0x2'));var router=express[_0x6f1c('0x3')]();var fs_extra=require(_0x6f1c('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6f1c('0x5'));var controller=require('./interval.controller');router[_0x6f1c('0x6')]('/',auth[_0x6f1c('0x7')](),controller[_0x6f1c('0x8')]);router['get'](_0x6f1c('0x9'),auth['isAuthenticated'](),controller[_0x6f1c('0xa')]);router[_0x6f1c('0x6')](_0x6f1c('0xb'),auth['isAuthenticated'](),controller[_0x6f1c('0xc')]);router['post']('/',auth[_0x6f1c('0x7')](),controller[_0x6f1c('0xd')]);router['post'](_0x6f1c('0xb'),auth[_0x6f1c('0x7')](),controller['addInterval']);router['post']('/:id/sub_intervals/create_many',auth['isAuthenticated'](),controller[_0x6f1c('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x6f1c('0x9'),auth[_0x6f1c('0x7')](),controller[_0x6f1c('0xf')]);module['exports']=router; \ No newline at end of file +var _0x27fa=['./interval.controller','get','isAuthenticated','/:id','show','getIntervals','post','create','/:id/sub_intervals/create_many','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x102881,_0x58d723){var _0x5c63d0=function(_0x955c59){while(--_0x955c59){_0x102881['push'](_0x102881['shift']());}};_0x5c63d0(++_0x58d723);}(_0x27fa,0x1c3));var _0xa27f=function(_0x455852,_0x720ea1){_0x455852=_0x455852-0x0;var _0x2cfed8=_0x27fa[_0x455852];return _0x2cfed8;};'use strict';var multer=require(_0xa27f('0x0'));var util=require(_0xa27f('0x1'));var path=require(_0xa27f('0x2'));var timeout=require(_0xa27f('0x3'));var express=require(_0xa27f('0x4'));var router=express[_0xa27f('0x5')]();var fs_extra=require(_0xa27f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xa27f('0x7'));var config=require(_0xa27f('0x8'));var controller=require(_0xa27f('0x9'));router[_0xa27f('0xa')]('/',auth[_0xa27f('0xb')](),controller['index']);router[_0xa27f('0xa')](_0xa27f('0xc'),auth[_0xa27f('0xb')](),controller[_0xa27f('0xd')]);router[_0xa27f('0xa')]('/:id/sub_intervals',auth[_0xa27f('0xb')](),controller[_0xa27f('0xe')]);router[_0xa27f('0xf')]('/',auth['isAuthenticated'](),controller[_0xa27f('0x10')]);router[_0xa27f('0xf')]('/:id/sub_intervals',auth[_0xa27f('0xb')](),controller['addInterval']);router[_0xa27f('0xf')](_0xa27f('0x11'),auth[_0xa27f('0xb')](),controller['addIntervals']);router[_0xa27f('0x12')](_0xa27f('0xc'),auth[_0xa27f('0xb')](),controller[_0xa27f('0x13')]);router[_0xa27f('0x14')](_0xa27f('0xc'),auth['isAuthenticated'](),controller[_0xa27f('0x15')]);module[_0xa27f('0x16')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index cfd88fa..5aad355 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 _0xe1bc=['exports','STRING'];(function(_0xdd2eb7,_0xcee48a){var _0x30e998=function(_0x4fe6aa){while(--_0x4fe6aa){_0xdd2eb7['push'](_0xdd2eb7['shift']());}};_0x30e998(++_0xcee48a);}(_0xe1bc,0x13e));var _0xce1b=function(_0x31c0c3,_0x5a423c){_0x31c0c3=_0x31c0c3-0x0;var _0xa7658b=_0xe1bc[_0x31c0c3];return _0xa7658b;};'use strict';var Sequelize=require('sequelize');module[_0xce1b('0x0')]={'name':{'type':Sequelize[_0xce1b('0x1')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xce1b('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x5fae=['exports','STRING','sequelize'];(function(_0x10d670,_0x178996){var _0x20d6f8=function(_0x4a4b87){while(--_0x4a4b87){_0x10d670['push'](_0x10d670['shift']());}};_0x20d6f8(++_0x178996);}(_0x5fae,0x152));var _0xe5fa=function(_0x471d25,_0x3e415e){_0x471d25=_0x471d25-0x0;var _0x15dadf=_0x5fae[_0x471d25];return _0x15dadf;};'use strict';var Sequelize=require(_0xe5fa('0x0'));module[_0xe5fa('0x1')]={'name':{'type':Sequelize[_0xe5fa('0x2')]},'description':{'type':Sequelize[_0xe5fa('0x2')]},'interval':{'type':Sequelize[_0xe5fa('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 76f66d4..5bf1f68 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 _0xcdcb=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','save','update','then','Intervals','UserProfileResource','destroy','error','stack','name','send','map','Interval','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','params','keys','includeAll','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getIntervals','findOne','order','addIntervals','sequelize','transaction','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0xc3c71a,_0x2f1376){var _0x316c2c=function(_0x317917){while(--_0x317917){_0xc3c71a['push'](_0xc3c71a['shift']());}};_0x316c2c(++_0x2f1376);}(_0xcdcb,0x1a7));var _0xbcdc=function(_0x4d0d0c,_0x4907c2){_0x4d0d0c=_0x4d0d0c-0x0;var _0x11455e=_0xcdcb[_0x4d0d0c];return _0x11455e;};'use strict';var emlformat=require(_0xbcdc('0x0'));var rimraf=require(_0xbcdc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbcdc('0x2'));var rp=require(_0xbcdc('0x3'));var moment=require(_0xbcdc('0x4'));var BPromise=require(_0xbcdc('0x5'));var Mustache=require(_0xbcdc('0x6'));var util=require(_0xbcdc('0x7'));var path=require(_0xbcdc('0x8'));var sox=require(_0xbcdc('0x9'));var csv=require(_0xbcdc('0xa'));var ejs=require(_0xbcdc('0xb'));var fs=require('fs');var fs_extra=require(_0xbcdc('0xc'));var _=require(_0xbcdc('0xd'));var squel=require('squel');var crypto=require(_0xbcdc('0xe'));var jsforce=require(_0xbcdc('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xbcdc('0xa'));var querystring=require(_0xbcdc('0x10'));var Papa=require('papaparse');var Redis=require(_0xbcdc('0x11'));var authService=require(_0xbcdc('0x12'));var qs=require(_0xbcdc('0x13'));var as=require(_0xbcdc('0x14'));var hardwareService=require(_0xbcdc('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xbcdc('0x16'));var config=require(_0xbcdc('0x17'));var licenseUtil=require(_0xbcdc('0x18'));var db=require(_0xbcdc('0x19'))['db'];var extensions=require(_0xbcdc('0x1a'));function respondWithStatusCode(_0x5f1b67,_0x49dd3d){_0x49dd3d=_0x49dd3d||0xcc;return function(_0x22f231){if(_0x22f231){return _0x5f1b67[_0xbcdc('0x1b')](_0x49dd3d);}return _0x5f1b67['status'](_0x49dd3d)[_0xbcdc('0x1c')]();};}function respondWithResult(_0x29aaff,_0x123f0d){_0x123f0d=_0x123f0d||0xc8;return function(_0xf06be6){if(_0xf06be6){return _0x29aaff[_0xbcdc('0x1d')](_0x123f0d)[_0xbcdc('0x1e')](_0xf06be6);}};}function respondWithFilteredResult(_0x3e4fe0,_0x4a0886){return function(_0x427c12){if(_0x427c12){var _0x4fb90d=typeof _0x4a0886[_0xbcdc('0x1f')]===_0xbcdc('0x20')&&typeof _0x4a0886[_0xbcdc('0x21')]===_0xbcdc('0x20');var _0x1f7df5=_0x427c12[_0xbcdc('0x22')];var _0x1f8932=_0x4fb90d?0x0:_0x4a0886[_0xbcdc('0x1f')];var _0x1e96e7=_0x4fb90d?_0x427c12['count']:_0x4a0886[_0xbcdc('0x1f')]+_0x4a0886[_0xbcdc('0x21')];var _0x3c757f;if(_0x1e96e7>=_0x1f7df5){_0x1e96e7=_0x1f7df5;_0x3c757f=0xc8;}else{_0x3c757f=0xce;}_0x3e4fe0[_0xbcdc('0x1d')](_0x3c757f);return _0x3e4fe0['set'](_0xbcdc('0x23'),_0x1f8932+'-'+_0x1e96e7+'/'+_0x1f7df5)['json'](_0x427c12);}return null;};}function patchUpdates(_0x388c9f){return function(_0x108e71){try{jsonpatch['apply'](_0x108e71,_0x388c9f,!![]);}catch(_0x2ea9d3){return BPromise['reject'](_0x2ea9d3);}return _0x108e71[_0xbcdc('0x24')]();};}function saveUpdates(_0x691b40,_0x3de707){return function(_0x2ad14a){if(_0x2ad14a){return _0x2ad14a[_0xbcdc('0x25')](_0x691b40)[_0xbcdc('0x26')](function(_0x4d0893){return _0x4d0893;});}return null;};}function removeEntity(_0x54a50a,_0x124e96){return function(_0x57874e){if(_0x57874e){return _0x57874e['destroy']()[_0xbcdc('0x26')](function(){var _0x31d62e=_0x57874e['get']({'plain':!![]});var _0x4306ba=_0xbcdc('0x27');return db[_0xbcdc('0x28')][_0xbcdc('0x29')]({'where':{'type':_0x4306ba,'resourceId':_0x31d62e['id']}})[_0xbcdc('0x26')](function(){return _0x57874e;});})[_0xbcdc('0x26')](function(){_0x54a50a['status'](0xcc)[_0xbcdc('0x1c')]();});}};}function handleEntityNotFound(_0x439d7b,_0x3f9849){return function(_0x4e2059){if(!_0x4e2059){_0x439d7b[_0xbcdc('0x1b')](0x194);}return _0x4e2059;};}function handleError(_0x3b605b,_0x50c5f4){_0x50c5f4=_0x50c5f4||0x1f4;return function(_0x522aa2){logger[_0xbcdc('0x2a')](_0x522aa2[_0xbcdc('0x2b')]);if(_0x522aa2[_0xbcdc('0x2c')]){delete _0x522aa2[_0xbcdc('0x2c')];}_0x3b605b[_0xbcdc('0x1d')](_0x50c5f4)[_0xbcdc('0x2d')](_0x522aa2);};}exports['index']=function(_0x161cfb,_0x30bee2){var _0xeab10e={},_0x5bb6d6={},_0x4f6d25={'count':0x0,'rows':[]};var _0x584b31=_[_0xbcdc('0x2e')](db[_0xbcdc('0x2f')][_0xbcdc('0x30')],function(_0x198c70){return{'name':_0x198c70[_0xbcdc('0x31')],'type':_0x198c70['type'][_0xbcdc('0x32')]};});_0x5bb6d6[_0xbcdc('0x33')]=_['map'](_0x584b31,'name');_0x5bb6d6['query']=_['keys'](_0x161cfb[_0xbcdc('0x34')]);_0x5bb6d6[_0xbcdc('0x35')]=_[_0xbcdc('0x36')](_0x5bb6d6[_0xbcdc('0x33')],_0x5bb6d6[_0xbcdc('0x34')]);_0xeab10e[_0xbcdc('0x37')]=_[_0xbcdc('0x36')](_0x5bb6d6['model'],qs[_0xbcdc('0x38')](_0x161cfb[_0xbcdc('0x34')][_0xbcdc('0x38')]));_0xeab10e[_0xbcdc('0x37')]=_0xeab10e[_0xbcdc('0x37')][_0xbcdc('0x39')]?_0xeab10e['attributes']:_0x5bb6d6[_0xbcdc('0x33')];if(!_0x161cfb[_0xbcdc('0x34')][_0xbcdc('0x3a')](_0xbcdc('0x3b'))){_0xeab10e['limit']=qs['limit'](_0x161cfb[_0xbcdc('0x34')][_0xbcdc('0x21')]);_0xeab10e[_0xbcdc('0x1f')]=qs[_0xbcdc('0x1f')](_0x161cfb['query']['offset']);}_0xeab10e['order']=qs[_0xbcdc('0x3c')](_0x161cfb[_0xbcdc('0x34')][_0xbcdc('0x3c')]);_0xeab10e[_0xbcdc('0x3d')]=qs[_0xbcdc('0x35')](_[_0xbcdc('0x3e')](_0x161cfb['query'],_0x5bb6d6['filters']),_0x584b31);if(_0x161cfb[_0xbcdc('0x34')][_0xbcdc('0x3f')]){_0xeab10e[_0xbcdc('0x3d')]=_[_0xbcdc('0x40')](_0xeab10e['where'],{'$or':_[_0xbcdc('0x2e')](_0x584b31,function(_0x28eeb9){if(_0x28eeb9[_0xbcdc('0x41')]!==_0xbcdc('0x42')){var _0x1c51eb={};_0x1c51eb[_0x28eeb9['name']]={'$like':'%'+_0x161cfb[_0xbcdc('0x34')][_0xbcdc('0x3f')]+'%'};return _0x1c51eb;}})});}_0xeab10e=_[_0xbcdc('0x40')]({},_0xeab10e,_0x161cfb[_0xbcdc('0x43')]);var _0x297cf2={'where':_0xeab10e[_0xbcdc('0x3d')]};return db[_0xbcdc('0x2f')][_0xbcdc('0x22')](_0x297cf2)[_0xbcdc('0x26')](function(_0x35cb19){_0x4f6d25['count']=_0x35cb19;if(_0x161cfb['query']['includeAll']){_0xeab10e[_0xbcdc('0x44')]=[{'all':!![]}];}return db[_0xbcdc('0x2f')][_0xbcdc('0x45')](_0xeab10e);})[_0xbcdc('0x26')](function(_0x16ad25){_0x4f6d25['rows']=_0x16ad25;return _0x4f6d25;})[_0xbcdc('0x26')](respondWithFilteredResult(_0x30bee2,_0xeab10e))['catch'](handleError(_0x30bee2,null));};exports['show']=function(_0x232e13,_0x75e0af){var _0x49e237={'raw':!![],'where':{'id':_0x232e13[_0xbcdc('0x46')]['id']}},_0xe4f6ad={};_0xe4f6ad['model']=_[_0xbcdc('0x47')](db[_0xbcdc('0x2f')][_0xbcdc('0x30')]);_0xe4f6ad[_0xbcdc('0x34')]=_[_0xbcdc('0x47')](_0x232e13[_0xbcdc('0x34')]);_0xe4f6ad['filters']=_['intersection'](_0xe4f6ad[_0xbcdc('0x33')],_0xe4f6ad['query']);_0x49e237[_0xbcdc('0x37')]=_[_0xbcdc('0x36')](_0xe4f6ad[_0xbcdc('0x33')],qs[_0xbcdc('0x38')](_0x232e13[_0xbcdc('0x34')][_0xbcdc('0x38')]));_0x49e237['attributes']=_0x49e237['attributes']['length']?_0x49e237[_0xbcdc('0x37')]:_0xe4f6ad[_0xbcdc('0x33')];if(_0x232e13[_0xbcdc('0x34')][_0xbcdc('0x48')]){_0x49e237[_0xbcdc('0x44')]=[{'all':!![]}];}_0x49e237=_['merge']({},_0x49e237,_0x232e13[_0xbcdc('0x43')]);return db[_0xbcdc('0x2f')]['find'](_0x49e237)[_0xbcdc('0x26')](handleEntityNotFound(_0x75e0af,null))['then'](respondWithResult(_0x75e0af,null))[_0xbcdc('0x49')](handleError(_0x75e0af,null));};exports[_0xbcdc('0x4a')]=function(_0x385ee8,_0x20d8cf){return db['Interval'][_0xbcdc('0x4a')](_0x385ee8[_0xbcdc('0x4b')],{})[_0xbcdc('0x26')](function(_0x491490){var _0x425ddc=_0x385ee8['user'][_0xbcdc('0x4c')]({'plain':!![]});if(!_0x425ddc)throw new Error(_0xbcdc('0x4d'));if(_0x425ddc['role']===_0xbcdc('0x4e')){var _0x4026d1=_0x491490[_0xbcdc('0x4c')]({'plain':!![]});var _0x186682=_0xbcdc('0x27');return db[_0xbcdc('0x4f')][_0xbcdc('0x50')]({'where':{'name':_0x186682,'userProfileId':_0x425ddc[_0xbcdc('0x51')]},'raw':!![]})[_0xbcdc('0x26')](function(_0x26fe26){if(_0x26fe26&&_0x26fe26['autoAssociation']===0x0){return db[_0xbcdc('0x28')]['create']({'name':_0x4026d1[_0xbcdc('0x2c')],'resourceId':_0x4026d1['id'],'type':_0x26fe26[_0xbcdc('0x2c')],'sectionId':_0x26fe26['id']},{})['then'](function(){return _0x491490;});}else{return _0x491490;}})[_0xbcdc('0x49')](function(_0xaed3eb){logger[_0xbcdc('0x2a')](_0xbcdc('0x52'),_0xaed3eb);throw _0xaed3eb;});}return _0x491490;})[_0xbcdc('0x26')](respondWithResult(_0x20d8cf,0xc9))['catch'](handleError(_0x20d8cf,null));};exports['update']=function(_0x4ffcf4,_0x18687d){if(_0x4ffcf4[_0xbcdc('0x4b')]['id']){delete _0x4ffcf4[_0xbcdc('0x4b')]['id'];}return db[_0xbcdc('0x2f')]['find']({'where':{'id':_0x4ffcf4[_0xbcdc('0x46')]['id']}})[_0xbcdc('0x26')](handleEntityNotFound(_0x18687d,null))['then'](saveUpdates(_0x4ffcf4[_0xbcdc('0x4b')],null))[_0xbcdc('0x26')](respondWithResult(_0x18687d,null))['catch'](handleError(_0x18687d,null));};exports[_0xbcdc('0x29')]=function(_0x44ef31,_0x4d7e9c){return db[_0xbcdc('0x2f')][_0xbcdc('0x50')]({'where':{'id':_0x44ef31[_0xbcdc('0x46')]['id']}})[_0xbcdc('0x26')](handleEntityNotFound(_0x4d7e9c,null))[_0xbcdc('0x26')](removeEntity(_0x4d7e9c,null))[_0xbcdc('0x49')](handleError(_0x4d7e9c,null));};exports['addInterval']=function(_0x2cc5ff,_0x4df35b,_0x1a79f6){if(_0x2cc5ff[_0xbcdc('0x4b')]['id']){delete _0x2cc5ff['body']['id'];}return db['Interval'][_0xbcdc('0x50')]({'where':{'id':_0x2cc5ff[_0xbcdc('0x46')]['id']}})[_0xbcdc('0x26')](handleEntityNotFound(_0x4df35b,null))[_0xbcdc('0x26')](function(_0x259647){if(_0x259647){_0x2cc5ff['body']['IntervalId']=_0x259647['id'];return db['Interval'][_0xbcdc('0x4a')](_0x2cc5ff[_0xbcdc('0x4b')]);}})[_0xbcdc('0x26')](respondWithResult(_0x4df35b,null))[_0xbcdc('0x49')](handleError(_0x4df35b,null));};exports[_0xbcdc('0x53')]=function(_0x87b16b,_0x152334,_0x150652){var _0x43205c={};var _0x10c635={};var _0xfd2617;var _0x5b1d65;return db[_0xbcdc('0x2f')][_0xbcdc('0x54')]({'where':{'id':_0x87b16b['params']['id']}})['then'](handleEntityNotFound(_0x152334,null))[_0xbcdc('0x26')](function(_0x27ef2a){if(_0x27ef2a){_0xfd2617=_0x27ef2a;_0x10c635['model']=_[_0xbcdc('0x47')](db[_0xbcdc('0x2f')][_0xbcdc('0x30')]);_0x10c635[_0xbcdc('0x34')]=_[_0xbcdc('0x47')](_0x87b16b[_0xbcdc('0x34')]);_0x10c635['filters']=_[_0xbcdc('0x36')](_0x10c635[_0xbcdc('0x33')],_0x10c635['query']);_0x43205c['attributes']=_[_0xbcdc('0x36')](_0x10c635['model'],qs[_0xbcdc('0x38')](_0x87b16b[_0xbcdc('0x34')][_0xbcdc('0x38')]));_0x43205c['attributes']=_0x43205c[_0xbcdc('0x37')]['length']?_0x43205c[_0xbcdc('0x37')]:_0x10c635[_0xbcdc('0x33')];_0x43205c[_0xbcdc('0x55')]=qs[_0xbcdc('0x3c')](_0x87b16b[_0xbcdc('0x34')][_0xbcdc('0x3c')]);_0x43205c[_0xbcdc('0x3d')]=qs[_0xbcdc('0x35')](_['pick'](_0x87b16b[_0xbcdc('0x34')],_0x10c635[_0xbcdc('0x35')]));if(_0x87b16b['query'][_0xbcdc('0x3f')]){_0x43205c[_0xbcdc('0x3d')]=_[_0xbcdc('0x40')](_0x43205c[_0xbcdc('0x3d')],{'$or':_['map'](_0x43205c[_0xbcdc('0x37')],function(_0x51629f){var _0x51a3b4={};_0x51a3b4[_0x51629f]={'$like':'%'+_0x87b16b[_0xbcdc('0x34')][_0xbcdc('0x3f')]+'%'};return _0x51a3b4;})});}_0x43205c=_[_0xbcdc('0x40')]({},_0x43205c,_0x87b16b[_0xbcdc('0x43')]);return _0xfd2617[_0xbcdc('0x53')](_0x43205c);}})[_0xbcdc('0x26')](function(_0x2c4443){if(_0x2c4443){_0x5b1d65=_0x2c4443['length'];if(!_0x87b16b['query'][_0xbcdc('0x3a')](_0xbcdc('0x3b'))){_0x43205c[_0xbcdc('0x21')]=qs[_0xbcdc('0x21')](_0x87b16b[_0xbcdc('0x34')][_0xbcdc('0x21')]);_0x43205c[_0xbcdc('0x1f')]=qs[_0xbcdc('0x1f')](_0x87b16b[_0xbcdc('0x34')]['offset']);}return _0xfd2617[_0xbcdc('0x53')](_0x43205c);}})[_0xbcdc('0x26')](function(_0x397d45){if(_0x397d45){return _0x397d45?{'count':_0x5b1d65,'rows':_0x397d45}:null;}})[_0xbcdc('0x26')](respondWithResult(_0x152334,null))['catch'](handleError(_0x152334,null));};exports[_0xbcdc('0x56')]=function(_0x3b1bb5,_0x4d7ded,_0x4bc301){return db[_0xbcdc('0x2f')]['findOne']({'where':{'id':_0x3b1bb5[_0xbcdc('0x46')]['id']}})[_0xbcdc('0x26')](handleEntityNotFound(_0x4d7ded,null))[_0xbcdc('0x26')](function(_0x56e1e7){if(_0x56e1e7){return db[_0xbcdc('0x57')][_0xbcdc('0x58')](function(_0x376dd4){return db[_0xbcdc('0x2f')][_0xbcdc('0x29')]({'where':{'IntervalId':_0x3b1bb5[_0xbcdc('0x46')]['id']},'transaction':_0x376dd4})[_0xbcdc('0x26')](function(_0xf058f1){var _0x1aaaf9=_[_0xbcdc('0x2e')](_0x3b1bb5[_0xbcdc('0x4b')],function(_0x362625){delete _0x362625['id'];_0x362625['IntervalId']=_0x3b1bb5[_0xbcdc('0x46')]['id'];return _0x362625;});return db['Interval']['bulkCreate'](_0x1aaaf9,{'transaction':_0x376dd4});});})['then'](function(){return db[_0xbcdc('0x2f')]['findAll']({'where':{'IntervalId':_0x3b1bb5[_0xbcdc('0x46')]['id']}});});}})[_0xbcdc('0x26')](respondWithResult(_0x4d7ded,null))[_0xbcdc('0x49')](handleError(_0x4d7ded,null));}; \ No newline at end of file +var _0xbc22=['error','stack','name','index','Interval','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','show','keys','rawAttributes','includeAll','catch','create','body','user','role','UserProfileSection','find','userProfileId','update','params','addInterval','IntervalId','getIntervals','findOne','map','hasOwnProperty','sequelize','transaction','bulkCreate','eml-format','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/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','json','undefined','limit','offset','count','set','reject','save','destroy','then','get','UserProfileResource','end'];(function(_0x5f27dc,_0x1d18f3){var _0xa5eee8=function(_0x5d85e7){while(--_0x5d85e7){_0x5f27dc['push'](_0x5f27dc['shift']());}};_0xa5eee8(++_0x1d18f3);}(_0xbc22,0x144));var _0x2bc2=function(_0x589aee,_0x140a03){_0x589aee=_0x589aee-0x0;var _0x2f5ed4=_0xbc22[_0x589aee];return _0x2f5ed4;};'use strict';var emlformat=require(_0x2bc2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2bc2('0x1'));var rp=require(_0x2bc2('0x2'));var moment=require(_0x2bc2('0x3'));var BPromise=require(_0x2bc2('0x4'));var Mustache=require(_0x2bc2('0x5'));var util=require(_0x2bc2('0x6'));var path=require(_0x2bc2('0x7'));var sox=require(_0x2bc2('0x8'));var csv=require(_0x2bc2('0x9'));var ejs=require(_0x2bc2('0xa'));var fs=require('fs');var fs_extra=require(_0x2bc2('0xb'));var _=require(_0x2bc2('0xc'));var squel=require(_0x2bc2('0xd'));var crypto=require(_0x2bc2('0xe'));var jsforce=require(_0x2bc2('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x2bc2('0x9'));var querystring=require(_0x2bc2('0x10'));var Papa=require('papaparse');var Redis=require(_0x2bc2('0x11'));var authService=require(_0x2bc2('0x12'));var qs=require(_0x2bc2('0x13'));var as=require(_0x2bc2('0x14'));var hardwareService=require(_0x2bc2('0x15'));var logger=require(_0x2bc2('0x16'))(_0x2bc2('0x17'));var utils=require(_0x2bc2('0x18'));var config=require(_0x2bc2('0x19'));var licenseUtil=require(_0x2bc2('0x1a'));var db=require(_0x2bc2('0x1b'))['db'];var extensions=require(_0x2bc2('0x1c'));function respondWithStatusCode(_0x3124c9,_0x5f5605){_0x5f5605=_0x5f5605||0xcc;return function(_0x1de076){if(_0x1de076){return _0x3124c9[_0x2bc2('0x1d')](_0x5f5605);}return _0x3124c9[_0x2bc2('0x1e')](_0x5f5605)['end']();};}function respondWithResult(_0x56381b,_0x287ae3){_0x287ae3=_0x287ae3||0xc8;return function(_0x3c6b3b){if(_0x3c6b3b){return _0x56381b['status'](_0x287ae3)[_0x2bc2('0x1f')](_0x3c6b3b);}};}function respondWithFilteredResult(_0x1da973,_0x2589f7){return function(_0x7290e3){if(_0x7290e3){var _0x1cbf4e=typeof _0x2589f7['offset']===_0x2bc2('0x20')&&typeof _0x2589f7[_0x2bc2('0x21')]==='undefined';var _0x17ec8d=_0x7290e3['count'];var _0x58f72c=_0x1cbf4e?0x0:_0x2589f7[_0x2bc2('0x22')];var _0x5b1940=_0x1cbf4e?_0x7290e3[_0x2bc2('0x23')]:_0x2589f7['offset']+_0x2589f7[_0x2bc2('0x21')];var _0x2f2ab1;if(_0x5b1940>=_0x17ec8d){_0x5b1940=_0x17ec8d;_0x2f2ab1=0xc8;}else{_0x2f2ab1=0xce;}_0x1da973[_0x2bc2('0x1e')](_0x2f2ab1);return _0x1da973[_0x2bc2('0x24')]('Content-Range',_0x58f72c+'-'+_0x5b1940+'/'+_0x17ec8d)['json'](_0x7290e3);}return null;};}function patchUpdates(_0x52d290){return function(_0x2dee45){try{jsonpatch['apply'](_0x2dee45,_0x52d290,!![]);}catch(_0xd2ad5d){return BPromise[_0x2bc2('0x25')](_0xd2ad5d);}return _0x2dee45[_0x2bc2('0x26')]();};}function saveUpdates(_0x327dc3,_0xd6abe7){return function(_0x3342d7){if(_0x3342d7){return _0x3342d7['update'](_0x327dc3)['then'](function(_0x3867ce){return _0x3867ce;});}return null;};}function removeEntity(_0x6c6675,_0x5a78ee){return function(_0xe764f7){if(_0xe764f7){return _0xe764f7[_0x2bc2('0x27')]()[_0x2bc2('0x28')](function(){var _0x481f00=_0xe764f7[_0x2bc2('0x29')]({'plain':!![]});var _0x2bd74a='Intervals';return db[_0x2bc2('0x2a')][_0x2bc2('0x27')]({'where':{'type':_0x2bd74a,'resourceId':_0x481f00['id']}})['then'](function(){return _0xe764f7;});})[_0x2bc2('0x28')](function(){_0x6c6675[_0x2bc2('0x1e')](0xcc)[_0x2bc2('0x2b')]();});}};}function handleEntityNotFound(_0x5d6cd0,_0x2422ff){return function(_0x4ed876){if(!_0x4ed876){_0x5d6cd0['sendStatus'](0x194);}return _0x4ed876;};}function handleError(_0x1e9e1c,_0x1ada5b){_0x1ada5b=_0x1ada5b||0x1f4;return function(_0x223607){logger[_0x2bc2('0x2c')](_0x223607[_0x2bc2('0x2d')]);if(_0x223607[_0x2bc2('0x2e')]){delete _0x223607[_0x2bc2('0x2e')];}_0x1e9e1c[_0x2bc2('0x1e')](_0x1ada5b)['send'](_0x223607);};}exports[_0x2bc2('0x2f')]=function(_0x54ccc6,_0x311a49){var _0x52ec5b={},_0x4cfd32={},_0x3d42a9={'count':0x0,'rows':[]};var _0x1817c1=_['map'](db[_0x2bc2('0x30')]['rawAttributes'],function(_0x18ed4c){return{'name':_0x18ed4c[_0x2bc2('0x31')],'type':_0x18ed4c[_0x2bc2('0x32')]['key']};});_0x4cfd32[_0x2bc2('0x33')]=_['map'](_0x1817c1,'name');_0x4cfd32[_0x2bc2('0x34')]=_['keys'](_0x54ccc6['query']);_0x4cfd32[_0x2bc2('0x35')]=_[_0x2bc2('0x36')](_0x4cfd32[_0x2bc2('0x33')],_0x4cfd32[_0x2bc2('0x34')]);_0x52ec5b[_0x2bc2('0x37')]=_[_0x2bc2('0x36')](_0x4cfd32['model'],qs[_0x2bc2('0x38')](_0x54ccc6[_0x2bc2('0x34')][_0x2bc2('0x38')]));_0x52ec5b['attributes']=_0x52ec5b['attributes'][_0x2bc2('0x39')]?_0x52ec5b[_0x2bc2('0x37')]:_0x4cfd32['model'];if(!_0x54ccc6[_0x2bc2('0x34')]['hasOwnProperty'](_0x2bc2('0x3a'))){_0x52ec5b[_0x2bc2('0x21')]=qs['limit'](_0x54ccc6[_0x2bc2('0x34')][_0x2bc2('0x21')]);_0x52ec5b['offset']=qs['offset'](_0x54ccc6['query']['offset']);}_0x52ec5b[_0x2bc2('0x3b')]=qs[_0x2bc2('0x3c')](_0x54ccc6['query'][_0x2bc2('0x3c')]);_0x52ec5b[_0x2bc2('0x3d')]=qs['filters'](_['pick'](_0x54ccc6[_0x2bc2('0x34')],_0x4cfd32['filters']),_0x1817c1);if(_0x54ccc6['query'][_0x2bc2('0x3e')]){_0x52ec5b['where']=_[_0x2bc2('0x3f')](_0x52ec5b[_0x2bc2('0x3d')],{'$or':_['map'](_0x1817c1,function(_0x39ef63){if(_0x39ef63[_0x2bc2('0x32')]!==_0x2bc2('0x40')){var _0x2b6218={};_0x2b6218[_0x39ef63['name']]={'$like':'%'+_0x54ccc6[_0x2bc2('0x34')]['filter']+'%'};return _0x2b6218;}})});}_0x52ec5b=_[_0x2bc2('0x3f')]({},_0x52ec5b,_0x54ccc6[_0x2bc2('0x41')]);var _0x5c8fdb={'where':_0x52ec5b['where']};return db['Interval'][_0x2bc2('0x23')](_0x5c8fdb)[_0x2bc2('0x28')](function(_0x54c3c3){_0x3d42a9[_0x2bc2('0x23')]=_0x54c3c3;if(_0x54ccc6[_0x2bc2('0x34')]['includeAll']){_0x52ec5b[_0x2bc2('0x42')]=[{'all':!![]}];}return db[_0x2bc2('0x30')][_0x2bc2('0x43')](_0x52ec5b);})['then'](function(_0x25f8f3){_0x3d42a9[_0x2bc2('0x44')]=_0x25f8f3;return _0x3d42a9;})[_0x2bc2('0x28')](respondWithFilteredResult(_0x311a49,_0x52ec5b))['catch'](handleError(_0x311a49,null));};exports[_0x2bc2('0x45')]=function(_0x3389aa,_0x277df5){var _0x5e2c84={'raw':!![],'where':{'id':_0x3389aa['params']['id']}},_0x48e4b3={};_0x48e4b3[_0x2bc2('0x33')]=_[_0x2bc2('0x46')](db[_0x2bc2('0x30')][_0x2bc2('0x47')]);_0x48e4b3['query']=_[_0x2bc2('0x46')](_0x3389aa[_0x2bc2('0x34')]);_0x48e4b3[_0x2bc2('0x35')]=_[_0x2bc2('0x36')](_0x48e4b3[_0x2bc2('0x33')],_0x48e4b3[_0x2bc2('0x34')]);_0x5e2c84[_0x2bc2('0x37')]=_['intersection'](_0x48e4b3[_0x2bc2('0x33')],qs[_0x2bc2('0x38')](_0x3389aa['query']['fields']));_0x5e2c84[_0x2bc2('0x37')]=_0x5e2c84['attributes']['length']?_0x5e2c84[_0x2bc2('0x37')]:_0x48e4b3['model'];if(_0x3389aa[_0x2bc2('0x34')][_0x2bc2('0x48')]){_0x5e2c84['include']=[{'all':!![]}];}_0x5e2c84=_[_0x2bc2('0x3f')]({},_0x5e2c84,_0x3389aa['options']);return db[_0x2bc2('0x30')]['find'](_0x5e2c84)['then'](handleEntityNotFound(_0x277df5,null))[_0x2bc2('0x28')](respondWithResult(_0x277df5,null))[_0x2bc2('0x49')](handleError(_0x277df5,null));};exports[_0x2bc2('0x4a')]=function(_0x49fe40,_0x9a1ab4){return db['Interval']['create'](_0x49fe40[_0x2bc2('0x4b')],{})[_0x2bc2('0x28')](function(_0xf61c4b){var _0x2ec842=_0x49fe40[_0x2bc2('0x4c')][_0x2bc2('0x29')]({'plain':!![]});if(!_0x2ec842)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2ec842[_0x2bc2('0x4d')]===_0x2bc2('0x4c')){var _0x34b593=_0xf61c4b[_0x2bc2('0x29')]({'plain':!![]});var _0x378152='Intervals';return db[_0x2bc2('0x4e')][_0x2bc2('0x4f')]({'where':{'name':_0x378152,'userProfileId':_0x2ec842[_0x2bc2('0x50')]},'raw':!![]})[_0x2bc2('0x28')](function(_0x2f58c3){if(_0x2f58c3&&_0x2f58c3['autoAssociation']===0x0){return db['UserProfileResource'][_0x2bc2('0x4a')]({'name':_0x34b593[_0x2bc2('0x2e')],'resourceId':_0x34b593['id'],'type':_0x2f58c3[_0x2bc2('0x2e')],'sectionId':_0x2f58c3['id']},{})[_0x2bc2('0x28')](function(){return _0xf61c4b;});}else{return _0xf61c4b;}})[_0x2bc2('0x49')](function(_0x40d3dc){logger[_0x2bc2('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x40d3dc);throw _0x40d3dc;});}return _0xf61c4b;})[_0x2bc2('0x28')](respondWithResult(_0x9a1ab4,0xc9))[_0x2bc2('0x49')](handleError(_0x9a1ab4,null));};exports[_0x2bc2('0x51')]=function(_0x4b3128,_0xf8bfef){if(_0x4b3128[_0x2bc2('0x4b')]['id']){delete _0x4b3128[_0x2bc2('0x4b')]['id'];}return db[_0x2bc2('0x30')]['find']({'where':{'id':_0x4b3128[_0x2bc2('0x52')]['id']}})[_0x2bc2('0x28')](handleEntityNotFound(_0xf8bfef,null))[_0x2bc2('0x28')](saveUpdates(_0x4b3128[_0x2bc2('0x4b')],null))[_0x2bc2('0x28')](respondWithResult(_0xf8bfef,null))[_0x2bc2('0x49')](handleError(_0xf8bfef,null));};exports[_0x2bc2('0x27')]=function(_0x3d2fa5,_0x4b1337){return db[_0x2bc2('0x30')]['find']({'where':{'id':_0x3d2fa5[_0x2bc2('0x52')]['id']}})['then'](handleEntityNotFound(_0x4b1337,null))[_0x2bc2('0x28')](removeEntity(_0x4b1337,null))[_0x2bc2('0x49')](handleError(_0x4b1337,null));};exports[_0x2bc2('0x53')]=function(_0x15e46a,_0x341b4f,_0x6f286e){if(_0x15e46a[_0x2bc2('0x4b')]['id']){delete _0x15e46a[_0x2bc2('0x4b')]['id'];}return db[_0x2bc2('0x30')]['find']({'where':{'id':_0x15e46a[_0x2bc2('0x52')]['id']}})[_0x2bc2('0x28')](handleEntityNotFound(_0x341b4f,null))['then'](function(_0x5067e5){if(_0x5067e5){_0x15e46a[_0x2bc2('0x4b')][_0x2bc2('0x54')]=_0x5067e5['id'];return db[_0x2bc2('0x30')]['create'](_0x15e46a['body']);}})['then'](respondWithResult(_0x341b4f,null))[_0x2bc2('0x49')](handleError(_0x341b4f,null));};exports[_0x2bc2('0x55')]=function(_0x95ebf7,_0x411f83,_0x2834fb){var _0x4e9055={};var _0x311666={};var _0x318bf0;var _0x17f9be;return db[_0x2bc2('0x30')][_0x2bc2('0x56')]({'where':{'id':_0x95ebf7[_0x2bc2('0x52')]['id']}})[_0x2bc2('0x28')](handleEntityNotFound(_0x411f83,null))[_0x2bc2('0x28')](function(_0x16570b){if(_0x16570b){_0x318bf0=_0x16570b;_0x311666[_0x2bc2('0x33')]=_[_0x2bc2('0x46')](db[_0x2bc2('0x30')][_0x2bc2('0x47')]);_0x311666[_0x2bc2('0x34')]=_[_0x2bc2('0x46')](_0x95ebf7[_0x2bc2('0x34')]);_0x311666[_0x2bc2('0x35')]=_['intersection'](_0x311666[_0x2bc2('0x33')],_0x311666[_0x2bc2('0x34')]);_0x4e9055[_0x2bc2('0x37')]=_[_0x2bc2('0x36')](_0x311666[_0x2bc2('0x33')],qs[_0x2bc2('0x38')](_0x95ebf7['query'][_0x2bc2('0x38')]));_0x4e9055[_0x2bc2('0x37')]=_0x4e9055[_0x2bc2('0x37')]['length']?_0x4e9055['attributes']:_0x311666['model'];_0x4e9055[_0x2bc2('0x3b')]=qs[_0x2bc2('0x3c')](_0x95ebf7[_0x2bc2('0x34')][_0x2bc2('0x3c')]);_0x4e9055[_0x2bc2('0x3d')]=qs[_0x2bc2('0x35')](_['pick'](_0x95ebf7[_0x2bc2('0x34')],_0x311666[_0x2bc2('0x35')]));if(_0x95ebf7[_0x2bc2('0x34')]['filter']){_0x4e9055['where']=_[_0x2bc2('0x3f')](_0x4e9055[_0x2bc2('0x3d')],{'$or':_[_0x2bc2('0x57')](_0x4e9055[_0x2bc2('0x37')],function(_0xf87dfb){var _0x5e3b7d={};_0x5e3b7d[_0xf87dfb]={'$like':'%'+_0x95ebf7[_0x2bc2('0x34')][_0x2bc2('0x3e')]+'%'};return _0x5e3b7d;})});}_0x4e9055=_[_0x2bc2('0x3f')]({},_0x4e9055,_0x95ebf7[_0x2bc2('0x41')]);return _0x318bf0[_0x2bc2('0x55')](_0x4e9055);}})['then'](function(_0x1b60e1){if(_0x1b60e1){_0x17f9be=_0x1b60e1[_0x2bc2('0x39')];if(!_0x95ebf7[_0x2bc2('0x34')][_0x2bc2('0x58')]('nolimit')){_0x4e9055[_0x2bc2('0x21')]=qs[_0x2bc2('0x21')](_0x95ebf7[_0x2bc2('0x34')][_0x2bc2('0x21')]);_0x4e9055['offset']=qs['offset'](_0x95ebf7[_0x2bc2('0x34')][_0x2bc2('0x22')]);}return _0x318bf0[_0x2bc2('0x55')](_0x4e9055);}})[_0x2bc2('0x28')](function(_0x1e3a4c){if(_0x1e3a4c){return _0x1e3a4c?{'count':_0x17f9be,'rows':_0x1e3a4c}:null;}})['then'](respondWithResult(_0x411f83,null))[_0x2bc2('0x49')](handleError(_0x411f83,null));};exports['addIntervals']=function(_0x5aca6c,_0x1b892b,_0x18fd4b){return db[_0x2bc2('0x30')]['findOne']({'where':{'id':_0x5aca6c[_0x2bc2('0x52')]['id']}})[_0x2bc2('0x28')](handleEntityNotFound(_0x1b892b,null))[_0x2bc2('0x28')](function(_0x22b141){if(_0x22b141){return db[_0x2bc2('0x59')][_0x2bc2('0x5a')](function(_0x3624ea){return db[_0x2bc2('0x30')]['destroy']({'where':{'IntervalId':_0x5aca6c[_0x2bc2('0x52')]['id']},'transaction':_0x3624ea})[_0x2bc2('0x28')](function(_0x4bb729){var _0x1e65ce=_['map'](_0x5aca6c[_0x2bc2('0x4b')],function(_0xc4d04f){delete _0xc4d04f['id'];_0xc4d04f[_0x2bc2('0x54')]=_0x5aca6c[_0x2bc2('0x52')]['id'];return _0xc4d04f;});return db[_0x2bc2('0x30')][_0x2bc2('0x5b')](_0x1e65ce,{'transaction':_0x3624ea});});})[_0x2bc2('0x28')](function(){return db['Interval'][_0x2bc2('0x43')]({'where':{'IntervalId':_0x5aca6c['params']['id']}});});}})[_0x2bc2('0x28')](respondWithResult(_0x1b892b,null))[_0x2bc2('0x49')](handleError(_0x1b892b,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 14ab60f..bc34846 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 _0x9d45=['reduce','../../components/extensions/rewrite','../../utils/iftime','iftime','define','Interval','tools_intervals','rewrite','interval','string','getIntervals','then','all','map','ifTime'];(function(_0x2bedda,_0x15280a){var _0x232503=function(_0x22aad4){while(--_0x22aad4){_0x2bedda['push'](_0x2bedda['shift']());}};_0x232503(++_0x15280a);}(_0x9d45,0x178));var _0x59d4=function(_0x3c5b45,_0x5ec647){_0x3c5b45=_0x3c5b45-0x0;var _0x320b6c=_0x9d45[_0x3c5b45];return _0x320b6c;};'use strict';var attributes=require('./interval.attributes');var extensions=require(_0x59d4('0x0'));var iftime=require(_0x59d4('0x1'))[_0x59d4('0x2')];module['exports']=function(_0x79aba){return _0x79aba[_0x59d4('0x3')](_0x59d4('0x4'),attributes,{'tableName':_0x59d4('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x242274){extensions[_0x59d4('0x6')](_0x79aba,_0x242274);},'afterBulkCreate':function(_0x37f027,_0x320edf,_0x69d050){_0x69d050();extensions[_0x59d4('0x6')](_0x79aba,_0x37f027[0x0]);},'afterUpdate':function(_0x439d56){extensions[_0x59d4('0x6')](_0x79aba,_0x439d56);},'afterDestroy':function(_0x19383d){extensions['rewrite'](_0x79aba,_0x19383d);}},'instanceMethods':{'ifTime':function(_0x4b6197=undefined,_0x5662c2=new Date()){if(typeof this[_0x59d4('0x7')]===_0x59d4('0x8')){return iftime(this['interval'],_0x4b6197,_0x5662c2);}else{return this[_0x59d4('0x9')]()[_0x59d4('0xa')](function(_0x439726){return Promise[_0x59d4('0xb')](_0x439726[_0x59d4('0xc')](function(_0x3ae0c2){return _0x3ae0c2[_0x59d4('0xd')](_0x4b6197,_0x5662c2);}));})['then'](function(_0x23346b){return _0x23346b[_0x59d4('0xe')](function(_0x3e50e1,_0x348b6a){return _0x3e50e1||_0x348b6a;},![]);});}}}});}; \ No newline at end of file +var _0xf473=['./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','iftime','exports','define','Interval','tools_intervals','rewrite','interval','string','getIntervals','then','all','map'];(function(_0x3c2da4,_0x4ec94d){var _0x1ff561=function(_0x2494b3){while(--_0x2494b3){_0x3c2da4['push'](_0x3c2da4['shift']());}};_0x1ff561(++_0x4ec94d);}(_0xf473,0x14a));var _0x3f47=function(_0x301bb2,_0xc4169c){_0x301bb2=_0x301bb2-0x0;var _0x51b5ec=_0xf473[_0x301bb2];return _0x51b5ec;};'use strict';var attributes=require(_0x3f47('0x0'));var extensions=require(_0x3f47('0x1'));var iftime=require(_0x3f47('0x2'))[_0x3f47('0x3')];module[_0x3f47('0x4')]=function(_0x23f4ab){return _0x23f4ab[_0x3f47('0x5')](_0x3f47('0x6'),attributes,{'tableName':_0x3f47('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x9217a0){extensions[_0x3f47('0x8')](_0x23f4ab,_0x9217a0);},'afterBulkCreate':function(_0x5380ef,_0x5472c2,_0x3c2686){_0x3c2686();extensions[_0x3f47('0x8')](_0x23f4ab,_0x5380ef[0x0]);},'afterUpdate':function(_0x4d190f){extensions['rewrite'](_0x23f4ab,_0x4d190f);},'afterDestroy':function(_0x26b42f){extensions['rewrite'](_0x23f4ab,_0x26b42f);}},'instanceMethods':{'ifTime':function(_0x3d86d2=undefined,_0x592856=new Date()){if(typeof this[_0x3f47('0x9')]===_0x3f47('0xa')){return iftime(this[_0x3f47('0x9')],_0x3d86d2,_0x592856);}else{return this[_0x3f47('0xb')]()[_0x3f47('0xc')](function(_0x5ac91c){return Promise[_0x3f47('0xd')](_0x5ac91c[_0x3f47('0xe')](function(_0x46a2bf){return _0x46a2bf['ifTime'](_0x3d86d2,_0x592856);}));})[_0x3f47('0xc')](function(_0x43b845){return _0x43b845['reduce'](function(_0xfdd175,_0x435690){return _0xfdd175||_0x435690;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 2cf6955..350bc41 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 _0xeb02=['model','then','info','GetInterval','debug','catch','error','message','Interval','find','ShowInterval','stringify','ifTime','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','intervalIds','isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','resolve','reduce','lodash','util','../../mysqldb','../../utils/iftime','rpc','findAll','raw','options','where','attributes','limit','include','map'];(function(_0x3da826,_0x2eb0f2){var _0xc4299d=function(_0xae6acb){while(--_0xae6acb){_0x3da826['push'](_0x3da826['shift']());}};_0xc4299d(++_0x2eb0f2);}(_0xeb02,0x77));var _0x2eb0=function(_0x32da5a,_0x90f714){_0x32da5a=_0x32da5a-0x0;var _0x2a980c=_0xeb02[_0x32da5a];return _0x2a980c;};'use strict';var _=require(_0x2eb0('0x0'));var util=require(_0x2eb0('0x1'));var db=require(_0x2eb0('0x2'))['db'];var iftime=require(_0x2eb0('0x3'))['iftime'];var logger=require('../../config/logger')(_0x2eb0('0x4'));exports['GetInterval']=function(_0x50639c){var _0x5a9a4e=this;return new Promise(function(_0x3cd084,_0x267bf0){return db['Interval'][_0x2eb0('0x5')]({'raw':_0x50639c['options']?_0x50639c['options'][_0x2eb0('0x6')]===undefined?!![]:![]:!![],'where':_0x50639c['options']?_0x50639c[_0x2eb0('0x7')][_0x2eb0('0x8')]||null:null,'attributes':_0x50639c[_0x2eb0('0x7')]?_0x50639c[_0x2eb0('0x7')][_0x2eb0('0x9')]||null:null,'limit':_0x50639c[_0x2eb0('0x7')]?_0x50639c['options'][_0x2eb0('0xa')]||null:null,'include':_0x50639c[_0x2eb0('0x7')]?_0x50639c[_0x2eb0('0x7')][_0x2eb0('0xb')]?_[_0x2eb0('0xc')](_0x50639c['options'][_0x2eb0('0xb')],function(_0x2272e0){return{'model':db[_0x2272e0['model']],'as':_0x2272e0['as'],'attributes':_0x2272e0[_0x2eb0('0x9')],'include':_0x2272e0[_0x2eb0('0xb')]?_['map'](_0x2272e0[_0x2eb0('0xb')],function(_0x50b906){return{'model':db[_0x50b906[_0x2eb0('0xd')]],'as':_0x50b906['as'],'attributes':_0x50b906[_0x2eb0('0x9')],'include':_0x50b906[_0x2eb0('0xb')]?_[_0x2eb0('0xc')](_0x50b906[_0x2eb0('0xb')],function(_0x44fa26){return{'model':db[_0x44fa26[_0x2eb0('0xd')]],'as':_0x44fa26['as'],'attributes':_0x44fa26['attributes']};}):[]};}):[]};}):[]:[]})[_0x2eb0('0xe')](function(_0x175445){logger[_0x2eb0('0xf')](_0x2eb0('0x10'),_0x50639c);logger[_0x2eb0('0x11')](_0x2eb0('0x10'),_0x50639c,JSON['stringify'](_0x175445));_0x3cd084(_0x175445);})[_0x2eb0('0x12')](function(_0x48e19f){logger[_0x2eb0('0x13')](_0x2eb0('0x10'),_0x48e19f[_0x2eb0('0x14')],_0x50639c);_0x267bf0(_0x5a9a4e[_0x2eb0('0x13')](0x1f4,_0x48e19f[_0x2eb0('0x14')]));});});};exports['ShowInterval']=function(_0x86a74f){var _0x1ea999=this;return new Promise(function(_0x57d58e,_0x3025c7){return db[_0x2eb0('0x15')][_0x2eb0('0x16')]({'raw':_0x86a74f['options']?_0x86a74f[_0x2eb0('0x7')][_0x2eb0('0x6')]===undefined?!![]:![]:!![],'where':_0x86a74f[_0x2eb0('0x7')]?_0x86a74f[_0x2eb0('0x7')][_0x2eb0('0x8')]||null:null,'attributes':_0x86a74f[_0x2eb0('0x7')]?_0x86a74f[_0x2eb0('0x7')][_0x2eb0('0x9')]||null:null,'include':_0x86a74f[_0x2eb0('0x7')]?_0x86a74f[_0x2eb0('0x7')][_0x2eb0('0xb')]?_[_0x2eb0('0xc')](_0x86a74f['options'][_0x2eb0('0xb')],function(_0x1fe30c){return{'model':db[_0x1fe30c['model']],'as':_0x1fe30c['as'],'attributes':_0x1fe30c[_0x2eb0('0x9')],'include':_0x1fe30c[_0x2eb0('0xb')]?_['map'](_0x1fe30c[_0x2eb0('0xb')],function(_0x5f1cc4){return{'model':db[_0x5f1cc4[_0x2eb0('0xd')]],'as':_0x5f1cc4['as'],'attributes':_0x5f1cc4['attributes'],'include':_0x5f1cc4['include']?_[_0x2eb0('0xc')](_0x5f1cc4[_0x2eb0('0xb')],function(_0x40476a){return{'model':db[_0x40476a[_0x2eb0('0xd')]],'as':_0x40476a['as'],'attributes':_0x40476a['attributes']};}):[]};}):[]};}):[]:[]})[_0x2eb0('0xe')](function(_0x5bc254){logger[_0x2eb0('0xf')](_0x2eb0('0x17'),_0x86a74f);logger[_0x2eb0('0x11')](_0x2eb0('0x17'),_0x86a74f,JSON[_0x2eb0('0x18')](_0x5bc254));_0x57d58e(_0x5bc254);})[_0x2eb0('0x12')](function(_0xcc4898){logger[_0x2eb0('0x13')](_0x2eb0('0x17'),_0xcc4898[_0x2eb0('0x14')],_0x86a74f);_0x3025c7(_0x1ea999['error'](0x1f4,_0xcc4898[_0x2eb0('0x14')]));});});};function checkArrayOfIntervals(_0xf12658,_0x3230cb){var _0x1a5e2b=[];return db[_0x2eb0('0x15')]['findAll']({'where':{'id':_0xf12658}})[_0x2eb0('0xe')](function(_0x44027c){_0x1a5e2b=_0x44027c;return Promise['all'](_0x1a5e2b[_0x2eb0('0xc')](function(_0x446556){return _0x446556[_0x2eb0('0x19')](_0x3230cb);}));})[_0x2eb0('0xe')](function(_0x5ae9d5){var _0x175592=_0x5ae9d5['reduce'](function(_0x436cb0,_0x52c323){return _0x436cb0||_0x52c323;},![]);logger[_0x2eb0('0xf')](util[_0x2eb0('0x1a')](_0x2eb0('0x1b'),_0x1a5e2b[_0x2eb0('0xc')](function(_0x4b054d){return _0x4b054d[_0x2eb0('0x1c')];})[_0x2eb0('0x1d')](',\x20'),_0x1a5e2b[_0x2eb0('0xc')](function(_0x116eae){return _0x116eae['id'];})[_0x2eb0('0x1d')](',\x20')));return _0x175592;});}function checkSingleInterval(_0x59b8a2,_0x155ab8){return db['Interval']['findById'](_0x59b8a2)[_0x2eb0('0xe')](function(_0x2ead1f){if(_0x2ead1f){logger[_0x2eb0('0xf')](util['format'](_0x2eb0('0x1e'),_0x2ead1f[_0x2eb0('0x1c')],_0x2ead1f['id']));return _0x2ead1f[_0x2eb0('0x19')](_0x155ab8);}});}exports[_0x2eb0('0x1f')]=function(_0x4adc90){var _0x24e6f1=_0x4adc90[_0x2eb0('0x20')];var _0x24415b=Array[_0x2eb0('0x21')](_0x4adc90[_0x2eb0('0x22')])?_0x4adc90[_0x2eb0('0x22')]:typeof _0x4adc90[_0x2eb0('0x22')]===_0x2eb0('0x23')?[_0x4adc90['intervals']]:[];var _0x2a7cb8=_0x4adc90[_0x2eb0('0x24')]||undefined;var _0x4e75ed=![];if(_0x24415b[_0x2eb0('0x25')]){logger[_0x2eb0('0xf')](util['format'](_0x2eb0('0x26'),_0x24415b[_0x2eb0('0x1d')](';\x20')));}if(_0x2a7cb8){logger[_0x2eb0('0xf')](util['format'](_0x2eb0('0x27'),_0x2a7cb8));}logger['debug'](_0x2eb0('0x28'),_0x4e75ed);logger[_0x2eb0('0x29')](_0x2eb0('0x1f'),_0x4adc90);return Promise[_0x2eb0('0x2a')]()[_0x2eb0('0xe')](function(){if(Array['isArray'](_0x24e6f1)){return checkArrayOfIntervals(_0x24e6f1,_0x2a7cb8);}else if(_0x24e6f1){return checkSingleInterval(_0x24e6f1,_0x2a7cb8);}})[_0x2eb0('0xe')](function(_0x30e0d5){var _0x4ac62b=_0x24415b[_0x2eb0('0x2b')](function(_0x19a7c9,_0x343b4f){return _0x19a7c9||iftime(_0x343b4f,_0x2a7cb8);},![]);_0x4e75ed=_0x30e0d5||_0x4ac62b;return _0x4e75ed;})[_0x2eb0('0x12')](function(_0xc60b87){logger[_0x2eb0('0x13')](_0x2eb0('0x1f'),_0x4adc90,_0xc60b87);throw this[_0x2eb0('0x13')](0x1f4,_0xc60b87['message']);});}; \ No newline at end of file +var _0xe352=['find','attributes','info','debug','all','ifTime','reduce','name','join','format','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','intervalIds','intervals','IntervalIftime:\x20interval\x20strings\x20=\x20%s','silly','resolve','lodash','util','../../mysqldb','iftime','../../config/logger','rpc','findAll','options','raw','where','limit','include','map','model','then','GetInterval','stringify','catch','error','message','ShowInterval','Interval'];(function(_0x3c2c14,_0x9c61a4){var _0x10c214=function(_0x581a89){while(--_0x581a89){_0x3c2c14['push'](_0x3c2c14['shift']());}};_0x10c214(++_0x9c61a4);}(_0xe352,0x86));var _0x2e35=function(_0x30f635,_0x3027e0){_0x30f635=_0x30f635-0x0;var _0x4a3be0=_0xe352[_0x30f635];return _0x4a3be0;};'use strict';var _=require(_0x2e35('0x0'));var util=require(_0x2e35('0x1'));var db=require(_0x2e35('0x2'))['db'];var iftime=require('../../utils/iftime')[_0x2e35('0x3')];var logger=require(_0x2e35('0x4'))(_0x2e35('0x5'));exports['GetInterval']=function(_0x43d049){var _0x310b4e=this;return new Promise(function(_0x3a15a9,_0x5146b3){return db['Interval'][_0x2e35('0x6')]({'raw':_0x43d049[_0x2e35('0x7')]?_0x43d049[_0x2e35('0x7')][_0x2e35('0x8')]===undefined?!![]:![]:!![],'where':_0x43d049[_0x2e35('0x7')]?_0x43d049[_0x2e35('0x7')][_0x2e35('0x9')]||null:null,'attributes':_0x43d049[_0x2e35('0x7')]?_0x43d049[_0x2e35('0x7')]['attributes']||null:null,'limit':_0x43d049[_0x2e35('0x7')]?_0x43d049[_0x2e35('0x7')][_0x2e35('0xa')]||null:null,'include':_0x43d049[_0x2e35('0x7')]?_0x43d049[_0x2e35('0x7')][_0x2e35('0xb')]?_[_0x2e35('0xc')](_0x43d049[_0x2e35('0x7')][_0x2e35('0xb')],function(_0x473643){return{'model':db[_0x473643[_0x2e35('0xd')]],'as':_0x473643['as'],'attributes':_0x473643['attributes'],'include':_0x473643['include']?_[_0x2e35('0xc')](_0x473643['include'],function(_0x1f0f88){return{'model':db[_0x1f0f88[_0x2e35('0xd')]],'as':_0x1f0f88['as'],'attributes':_0x1f0f88['attributes'],'include':_0x1f0f88[_0x2e35('0xb')]?_[_0x2e35('0xc')](_0x1f0f88[_0x2e35('0xb')],function(_0x2d7564){return{'model':db[_0x2d7564[_0x2e35('0xd')]],'as':_0x2d7564['as'],'attributes':_0x2d7564['attributes']};}):[]};}):[]};}):[]:[]})[_0x2e35('0xe')](function(_0x2de4b0){logger['info'](_0x2e35('0xf'),_0x43d049);logger['debug'](_0x2e35('0xf'),_0x43d049,JSON[_0x2e35('0x10')](_0x2de4b0));_0x3a15a9(_0x2de4b0);})[_0x2e35('0x11')](function(_0x3f564f){logger[_0x2e35('0x12')]('GetInterval',_0x3f564f['message'],_0x43d049);_0x5146b3(_0x310b4e[_0x2e35('0x12')](0x1f4,_0x3f564f[_0x2e35('0x13')]));});});};exports[_0x2e35('0x14')]=function(_0xd81cda){var _0x3ff4cd=this;return new Promise(function(_0xb46423,_0x359597){return db[_0x2e35('0x15')][_0x2e35('0x16')]({'raw':_0xd81cda[_0x2e35('0x7')]?_0xd81cda['options']['raw']===undefined?!![]:![]:!![],'where':_0xd81cda[_0x2e35('0x7')]?_0xd81cda[_0x2e35('0x7')][_0x2e35('0x9')]||null:null,'attributes':_0xd81cda['options']?_0xd81cda[_0x2e35('0x7')][_0x2e35('0x17')]||null:null,'include':_0xd81cda[_0x2e35('0x7')]?_0xd81cda['options']['include']?_[_0x2e35('0xc')](_0xd81cda[_0x2e35('0x7')][_0x2e35('0xb')],function(_0x19694d){return{'model':db[_0x19694d[_0x2e35('0xd')]],'as':_0x19694d['as'],'attributes':_0x19694d[_0x2e35('0x17')],'include':_0x19694d[_0x2e35('0xb')]?_[_0x2e35('0xc')](_0x19694d[_0x2e35('0xb')],function(_0x293077){return{'model':db[_0x293077[_0x2e35('0xd')]],'as':_0x293077['as'],'attributes':_0x293077['attributes'],'include':_0x293077['include']?_[_0x2e35('0xc')](_0x293077[_0x2e35('0xb')],function(_0x4378ae){return{'model':db[_0x4378ae['model']],'as':_0x4378ae['as'],'attributes':_0x4378ae[_0x2e35('0x17')]};}):[]};}):[]};}):[]:[]})[_0x2e35('0xe')](function(_0x3dba66){logger[_0x2e35('0x18')](_0x2e35('0x14'),_0xd81cda);logger[_0x2e35('0x19')](_0x2e35('0x14'),_0xd81cda,JSON['stringify'](_0x3dba66));_0xb46423(_0x3dba66);})[_0x2e35('0x11')](function(_0x4fdc63){logger[_0x2e35('0x12')]('ShowInterval',_0x4fdc63[_0x2e35('0x13')],_0xd81cda);_0x359597(_0x3ff4cd[_0x2e35('0x12')](0x1f4,_0x4fdc63[_0x2e35('0x13')]));});});};function checkArrayOfIntervals(_0x4096d8,_0xe5dd7a){var _0xd7d0b8=[];return db[_0x2e35('0x15')]['findAll']({'where':{'id':_0x4096d8}})[_0x2e35('0xe')](function(_0x2e4398){_0xd7d0b8=_0x2e4398;return Promise[_0x2e35('0x1a')](_0xd7d0b8[_0x2e35('0xc')](function(_0x217121){return _0x217121[_0x2e35('0x1b')](_0xe5dd7a);}));})[_0x2e35('0xe')](function(_0x2e7b25){var _0x42b605=_0x2e7b25[_0x2e35('0x1c')](function(_0x5adee3,_0x467820){return _0x5adee3||_0x467820;},![]);logger[_0x2e35('0x18')](util['format']('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0xd7d0b8[_0x2e35('0xc')](function(_0x220c7e){return _0x220c7e[_0x2e35('0x1d')];})[_0x2e35('0x1e')](',\x20'),_0xd7d0b8[_0x2e35('0xc')](function(_0x11102c){return _0x11102c['id'];})[_0x2e35('0x1e')](',\x20')));return _0x42b605;});}function checkSingleInterval(_0x504201,_0x50e838){return db[_0x2e35('0x15')]['findById'](_0x504201)[_0x2e35('0xe')](function(_0x243006){if(_0x243006){logger['info'](util[_0x2e35('0x1f')](_0x2e35('0x20'),_0x243006[_0x2e35('0x1d')],_0x243006['id']));return _0x243006['ifTime'](_0x50e838);}});}exports[_0x2e35('0x21')]=function(_0x2e0c3a){var _0xb5abbd=_0x2e0c3a[_0x2e35('0x22')];var _0x39ec72=Array['isArray'](_0x2e0c3a['intervals'])?_0x2e0c3a['intervals']:typeof _0x2e0c3a[_0x2e35('0x23')]==='string'?[_0x2e0c3a[_0x2e35('0x23')]]:[];var _0x435300=_0x2e0c3a['timezone']||undefined;var _0x1d6364=![];if(_0x39ec72['length']){logger[_0x2e35('0x18')](util[_0x2e35('0x1f')](_0x2e35('0x24'),_0x39ec72[_0x2e35('0x1e')](';\x20')));}if(_0x435300){logger[_0x2e35('0x18')](util[_0x2e35('0x1f')]('IntervalIftime:\x20timezone\x20=\x20%s',_0x435300));}logger[_0x2e35('0x19')]('Iftime',_0x1d6364);logger[_0x2e35('0x25')](_0x2e35('0x21'),_0x2e0c3a);return Promise[_0x2e35('0x26')]()['then'](function(){if(Array['isArray'](_0xb5abbd)){return checkArrayOfIntervals(_0xb5abbd,_0x435300);}else if(_0xb5abbd){return checkSingleInterval(_0xb5abbd,_0x435300);}})['then'](function(_0x417818){var _0x311a8e=_0x39ec72['reduce'](function(_0x34d235,_0x246f7c){return _0x34d235||iftime(_0x246f7c,_0x435300);},![]);_0x1d6364=_0x417818||_0x311a8e;return _0x1d6364;})[_0x2e35('0x11')](function(_0x4085e2){logger[_0x2e35('0x12')](_0x2e35('0x21'),_0x2e0c3a,_0x4085e2);throw this[_0x2e35('0x12')](0x1f4,_0x4085e2[_0x2e35('0x13')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index f92eb7f..57658c6 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(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1f38c6,_0x428650){_0x1f38c6=_0x1f38c6-0x0;var _0x259367=_0x0b0e[_0x1f38c6];return _0x259367;};'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 _0xdb28=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller'];(function(_0x36f6de,_0x380843){var _0x2fed42=function(_0x4d1da7){while(--_0x4d1da7){_0x36f6de['push'](_0x36f6de['shift']());}};_0x2fed42(++_0x380843);}(_0xdb28,0x106));var _0x8db2=function(_0x389b28,_0x40b8d3){_0x389b28=_0x389b28-0x0;var _0x2764ec=_0xdb28[_0x389b28];return _0x2764ec;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['post']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);module[_0x8db2('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 0c38bc0..5480c09 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 _0x04fe=['key','MOTGUI','summary','Report','\x20from\x20','description','issuetype','fields','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','customfield_11504','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','toString','base64','request','utf8','data','end','status','statusCode','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','body','headers','x-forwarded-for','connection','remoteAddress','socket','../../config/logger','support','3eAmWpBVP0'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x04fe,0x10e));var _0xe04f=function(_0x1658e1,_0x48b373){_0x1658e1=_0x1658e1-0x0;var _0x3f9e5e=_0x04fe[_0x1658e1];return _0x3f9e5e;};'use strict';var BPromise=require('bluebird');var https=require('https');var logger=require(_0xe04f('0x0'))('api');var USERNAME=_0xe04f('0x1');var PASSWORD=_0xe04f('0x2');function openIssue(_0x155af2,_0x4694b3){var _0x3a2fdc={'fields':{'project':{'key':_0x155af2[_0xe04f('0x3')]||_0xe04f('0x4')},'summary':(_0x155af2[_0xe04f('0x5')]||_0xe04f('0x6'))+_0xe04f('0x7')+_0x155af2['ip'],'description':_0x155af2[_0xe04f('0x8')]||JSON['stringify'](_0x155af2),'issuetype':{'name':_0x155af2[_0xe04f('0x9')]||'Bug'}}};_0x3a2fdc[_0xe04f('0xa')]['customfield_11500']=_0x155af2['email'];_0x3a2fdc[_0xe04f('0xa')][_0xe04f('0xb')]=_0x155af2[_0xe04f('0xc')];_0x3a2fdc['fields'][_0xe04f('0xd')]=_0x155af2[_0xe04f('0xe')];_0x3a2fdc[_0xe04f('0xa')][_0xe04f('0xf')]=_0x155af2['name'];_0x3a2fdc[_0xe04f('0xa')][_0xe04f('0x10')]=_0x155af2['reason'];_0x3a2fdc[_0xe04f('0xa')][_0xe04f('0x11')]=_0x155af2['ip'];var _0x363980={'host':_0xe04f('0x12'),'port':0x1bb,'path':_0xe04f('0x13'),'method':_0xe04f('0x14'),'timeout':0x4e20,'headers':{'Content-Type':_0xe04f('0x15'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0xe04f('0x16')](_0xe04f('0x17'))}};var _0x2ff911=JSON['stringify'](_0x3a2fdc);var _0x1a114=https[_0xe04f('0x18')](_0x363980,function(_0x3cf968){_0x3cf968['setEncoding'](_0xe04f('0x19'));var _0x53407e='';_0x3cf968['on'](_0xe04f('0x1a'),function(_0x68d295){_0x53407e+=_0x68d295;});_0x3cf968['on'](_0xe04f('0x1b'),function(){if(_0x4694b3){return _0x4694b3[_0xe04f('0x1c')](_0x3cf968[_0xe04f('0x1d')])[_0xe04f('0x1e')](JSON['parse'](_0x53407e));}});});_0x1a114['on']('error',function(_0x2291cb){if(_0x4694b3){return _0x4694b3[_0xe04f('0x1c')](0x1f4)[_0xe04f('0x1e')]({'errors':[{'message':_0xe04f('0x1f'),'type':'api.jira'}]});}});_0x1a114[_0xe04f('0x20')](_0x2ff911);_0x1a114[_0xe04f('0x1b')]();}exports['openIssue']=openIssue;exports['send']=function(_0x109d36,_0x4071b5){_0x109d36[_0xe04f('0x21')]['ip']=_0x109d36[_0xe04f('0x22')][_0xe04f('0x23')]||_0x109d36[_0xe04f('0x24')][_0xe04f('0x25')]||_0x109d36[_0xe04f('0x26')]['remoteAddress']||_0x109d36['connection'][_0xe04f('0x26')]['remoteAddress'];return openIssue(_0x109d36[_0xe04f('0x21')],_0x4071b5);}; \ No newline at end of file +var _0x0257=['socket','bluebird','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','\x20from\x20','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','base64','request','setEncoding','utf8','end','status','statusCode','json','parse','error','api.jira','write','openIssue','body','headers','x-forwarded-for','connection','remoteAddress'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x0257,0x14a));var _0x7025=function(_0x223bbd,_0x2f8c30){_0x223bbd=_0x223bbd-0x0;var _0x11e852=_0x0257[_0x223bbd];return _0x11e852;};'use strict';var BPromise=require(_0x7025('0x0'));var https=require('https');var logger=require(_0x7025('0x1'))(_0x7025('0x2'));var USERNAME=_0x7025('0x3');var PASSWORD=_0x7025('0x4');function openIssue(_0xe9270f,_0x3afd84){var _0x5a2fa4={'fields':{'project':{'key':_0xe9270f[_0x7025('0x5')]||_0x7025('0x6')},'summary':(_0xe9270f[_0x7025('0x7')]||'Report')+_0x7025('0x8')+_0xe9270f['ip'],'description':_0xe9270f['description']||JSON[_0x7025('0x9')](_0xe9270f),'issuetype':{'name':_0xe9270f[_0x7025('0xa')]||_0x7025('0xb')}}};_0x5a2fa4[_0x7025('0xc')][_0x7025('0xd')]=_0xe9270f[_0x7025('0xe')];_0x5a2fa4[_0x7025('0xc')][_0x7025('0xf')]=_0xe9270f[_0x7025('0x10')];_0x5a2fa4['fields'][_0x7025('0x11')]=_0xe9270f[_0x7025('0x12')];_0x5a2fa4[_0x7025('0xc')][_0x7025('0x13')]=_0xe9270f[_0x7025('0x14')];_0x5a2fa4['fields'][_0x7025('0x15')]=_0xe9270f[_0x7025('0x16')];_0x5a2fa4[_0x7025('0xc')]['customfield_10102']=_0xe9270f['ip'];var _0x244c83={'host':_0x7025('0x17'),'port':0x1bb,'path':_0x7025('0x18'),'method':_0x7025('0x19'),'timeout':0x4e20,'headers':{'Content-Type':_0x7025('0x1a'),'Authorization':_0x7025('0x1b')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x7025('0x1c'))}};var _0x1d4e52=JSON[_0x7025('0x9')](_0x5a2fa4);var _0x357d16=https[_0x7025('0x1d')](_0x244c83,function(_0x56af26){_0x56af26[_0x7025('0x1e')](_0x7025('0x1f'));var _0x381250='';_0x56af26['on']('data',function(_0x44031f){_0x381250+=_0x44031f;});_0x56af26['on'](_0x7025('0x20'),function(){if(_0x3afd84){return _0x3afd84[_0x7025('0x21')](_0x56af26[_0x7025('0x22')])[_0x7025('0x23')](JSON[_0x7025('0x24')](_0x381250));}});});_0x357d16['on'](_0x7025('0x25'),function(_0x2c90c9){if(_0x3afd84){return _0x3afd84[_0x7025('0x21')](0x1f4)[_0x7025('0x23')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x7025('0x26')}]});}});_0x357d16[_0x7025('0x27')](_0x1d4e52);_0x357d16[_0x7025('0x20')]();}exports[_0x7025('0x28')]=openIssue;exports['send']=function(_0x30a800,_0x56bb85){_0x30a800[_0x7025('0x29')]['ip']=_0x30a800[_0x7025('0x2a')][_0x7025('0x2b')]||_0x30a800[_0x7025('0x2c')][_0x7025('0x2d')]||_0x30a800[_0x7025('0x2e')][_0x7025('0x2d')]||_0x30a800[_0x7025('0x2c')]['socket'][_0x7025('0x2d')];return openIssue(_0x30a800[_0x7025('0x29')],_0x56bb85);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 8558624..dbfa146 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 _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index'];(function(_0x3cf640,_0x4c32cb){var _0x4e89a3=function(_0x4fc1f7){while(--_0x4fc1f7){_0x3cf640['push'](_0x3cf640['shift']());}};_0x4e89a3(++_0x4c32cb);}(_0xe706,0xa3));var _0x6e70=function(_0x27c248,_0x384dff){_0x27c248=_0x27c248-0x0;var _0x1b2fc2=_0xe706[_0x27c248];return _0x1b2fc2;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file +var _0xee5b=['fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','post','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','Router'];(function(_0xe2280b,_0x491bd6){var _0x295d4b=function(_0x221790){while(--_0x221790){_0xe2280b['push'](_0xe2280b['shift']());}};_0x295d4b(++_0x491bd6);}(_0xee5b,0x1f4));var _0xbee5=function(_0x27eeac,_0x41f91c){_0x27eeac=_0x27eeac-0x0;var _0x31ca39=_0xee5b[_0x27eeac];return _0x31ca39;};'use strict';var multer=require(_0xbee5('0x0'));var util=require('util');var path=require(_0xbee5('0x1'));var timeout=require(_0xbee5('0x2'));var express=require('express');var router=express[_0xbee5('0x3')]();var fs_extra=require(_0xbee5('0x4'));var auth=require(_0xbee5('0x5'));var interaction=require(_0xbee5('0x6'));var config=require('../../config/environment');var controller=require('./jscriptyAnswerReport.controller');router[_0xbee5('0x7')]('/',auth[_0xbee5('0x8')](),controller[_0xbee5('0x9')]);router[_0xbee5('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0xbee5('0x8')](),controller[_0xbee5('0xa')]);router[_0xbee5('0xb')]('/',auth[_0xbee5('0x8')](),controller['create']);router[_0xbee5('0xc')](_0xbee5('0xd'),auth[_0xbee5('0x8')](),controller[_0xbee5('0xe')]);router[_0xbee5('0xf')](_0xbee5('0xd'),auth[_0xbee5('0x8')](),controller[_0xbee5('0x10')]);module[_0xbee5('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 8297752..49e59bf 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(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x7a54,0x106));var _0x47a5=function(_0x47668c,_0x41b6e6){_0x47668c=_0x47668c-0x0;var _0x524054=_0x7a54[_0x47668c];return _0x524054;};'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(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x7a54,0x106));var _0x47a5=function(_0x4935ce,_0x45e493){_0x4935ce=_0x4935ce-0x0;var _0x497941=_0x7a54[_0x4935ce];return _0x497941;};'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 830c7ef..f85eead 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 _0x9009=['stack','name','index','JscriptyAnswerReport','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','length','nolimit','order','sort','filters','pick','filter','merge','where','map','VIRTUAL','catch','show','params','includeAll','include','options','find','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','error'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x9009,0x1d4));var _0x9900=function(_0x252b7a,_0x7ddf6f){_0x252b7a=_0x252b7a-0x0;var _0x53ad4c=_0x9009[_0x252b7a];return _0x53ad4c;};'use strict';var emlformat=require(_0x9900('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9900('0x1'));var jsonpatch=require(_0x9900('0x2'));var rp=require('request-promise');var moment=require(_0x9900('0x3'));var BPromise=require(_0x9900('0x4'));var Mustache=require(_0x9900('0x5'));var util=require(_0x9900('0x6'));var path=require('path');var sox=require(_0x9900('0x7'));var csv=require(_0x9900('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9900('0x9'));var squel=require(_0x9900('0xa'));var crypto=require('crypto');var jsforce=require(_0x9900('0xb'));var deskjs=require(_0x9900('0xc'));var toCsv=require(_0x9900('0x8'));var querystring=require(_0x9900('0xd'));var Papa=require('papaparse');var Redis=require(_0x9900('0xe'));var authService=require(_0x9900('0xf'));var qs=require(_0x9900('0x10'));var as=require(_0x9900('0x11'));var hardwareService=require(_0x9900('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x9900('0x13'));var config=require(_0x9900('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17070a,_0x4e8312){_0x4e8312=_0x4e8312||0xcc;return function(_0x6bd4da){if(_0x6bd4da){return _0x17070a[_0x9900('0x15')](_0x4e8312);}return _0x17070a[_0x9900('0x16')](_0x4e8312)[_0x9900('0x17')]();};}function respondWithResult(_0x318fa5,_0x1014e8){_0x1014e8=_0x1014e8||0xc8;return function(_0x2eaf32){if(_0x2eaf32){return _0x318fa5[_0x9900('0x16')](_0x1014e8)[_0x9900('0x18')](_0x2eaf32);}};}function respondWithFilteredResult(_0x209b4d,_0x375ee0){return function(_0xce2dd6){if(_0xce2dd6){var _0x154e22=typeof _0x375ee0[_0x9900('0x19')]===_0x9900('0x1a')&&typeof _0x375ee0[_0x9900('0x1b')]===_0x9900('0x1a');var _0x5d9ec9=_0xce2dd6['count'];var _0x1017a5=_0x154e22?0x0:_0x375ee0[_0x9900('0x19')];var _0x1bd7a3=_0x154e22?_0xce2dd6[_0x9900('0x1c')]:_0x375ee0['offset']+_0x375ee0[_0x9900('0x1b')];var _0x57ae85;if(_0x1bd7a3>=_0x5d9ec9){_0x1bd7a3=_0x5d9ec9;_0x57ae85=0xc8;}else{_0x57ae85=0xce;}_0x209b4d['status'](_0x57ae85);return _0x209b4d[_0x9900('0x1d')]('Content-Range',_0x1017a5+'-'+_0x1bd7a3+'/'+_0x5d9ec9)[_0x9900('0x18')](_0xce2dd6);}return null;};}function patchUpdates(_0x596eff){return function(_0x48d6df){try{jsonpatch[_0x9900('0x1e')](_0x48d6df,_0x596eff,!![]);}catch(_0x2892ce){return BPromise[_0x9900('0x1f')](_0x2892ce);}return _0x48d6df[_0x9900('0x20')]();};}function saveUpdates(_0x5ee4ad,_0x215bd4){return function(_0x3e4cee){if(_0x3e4cee){return _0x3e4cee[_0x9900('0x21')](_0x5ee4ad)[_0x9900('0x22')](function(_0x45c0d0){return _0x45c0d0;});}return null;};}function removeEntity(_0x5368bf,_0x37842b){return function(_0x218d7e){if(_0x218d7e){return _0x218d7e['destroy']()[_0x9900('0x22')](function(){_0x5368bf[_0x9900('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54a015,_0x43ed24){return function(_0x2ac147){if(!_0x2ac147){_0x54a015['sendStatus'](0x194);}return _0x2ac147;};}function handleError(_0x285d51,_0x4507a9){_0x4507a9=_0x4507a9||0x1f4;return function(_0x5e3e21){logger[_0x9900('0x23')](_0x5e3e21[_0x9900('0x24')]);if(_0x5e3e21[_0x9900('0x25')]){delete _0x5e3e21[_0x9900('0x25')];}_0x285d51[_0x9900('0x16')](_0x4507a9)['send'](_0x5e3e21);};}exports[_0x9900('0x26')]=function(_0x44d775,_0x10fbae){var _0x32e343={},_0x3b1b94={},_0x50f16a={'count':0x0,'rows':[]};var _0x4cef1f=_['map'](db[_0x9900('0x27')][_0x9900('0x28')],function(_0x4ef405){return{'name':_0x4ef405[_0x9900('0x29')],'type':_0x4ef405[_0x9900('0x2a')][_0x9900('0x2b')]};});_0x3b1b94['model']=_['map'](_0x4cef1f,_0x9900('0x25'));_0x3b1b94[_0x9900('0x2c')]=_[_0x9900('0x2d')](_0x44d775[_0x9900('0x2c')]);_0x3b1b94['filters']=_['intersection'](_0x3b1b94[_0x9900('0x2e')],_0x3b1b94[_0x9900('0x2c')]);_0x32e343[_0x9900('0x2f')]=_[_0x9900('0x30')](_0x3b1b94[_0x9900('0x2e')],qs[_0x9900('0x31')](_0x44d775[_0x9900('0x2c')][_0x9900('0x31')]));_0x32e343[_0x9900('0x2f')]=_0x32e343[_0x9900('0x2f')][_0x9900('0x32')]?_0x32e343[_0x9900('0x2f')]:_0x3b1b94[_0x9900('0x2e')];if(!_0x44d775['query']['hasOwnProperty'](_0x9900('0x33'))){_0x32e343['limit']=qs[_0x9900('0x1b')](_0x44d775[_0x9900('0x2c')][_0x9900('0x1b')]);_0x32e343[_0x9900('0x19')]=qs[_0x9900('0x19')](_0x44d775[_0x9900('0x2c')][_0x9900('0x19')]);}_0x32e343[_0x9900('0x34')]=qs[_0x9900('0x35')](_0x44d775['query']['sort']);_0x32e343['where']=qs[_0x9900('0x36')](_[_0x9900('0x37')](_0x44d775['query'],_0x3b1b94[_0x9900('0x36')]),_0x4cef1f);if(_0x44d775[_0x9900('0x2c')][_0x9900('0x38')]){_0x32e343['where']=_[_0x9900('0x39')](_0x32e343[_0x9900('0x3a')],{'$or':_[_0x9900('0x3b')](_0x4cef1f,function(_0x141131){if(_0x141131[_0x9900('0x2a')]!==_0x9900('0x3c')){var _0x510d6a={};_0x510d6a[_0x141131[_0x9900('0x25')]]={'$like':'%'+_0x44d775[_0x9900('0x2c')]['filter']+'%'};return _0x510d6a;}})});}_0x32e343=_[_0x9900('0x39')]({},_0x32e343,_0x44d775['options']);var _0x2cee90={'where':_0x32e343[_0x9900('0x3a')]};return db['JscriptyAnswerReport'][_0x9900('0x1c')](_0x2cee90)[_0x9900('0x22')](function(_0x2595cc){_0x50f16a[_0x9900('0x1c')]=_0x2595cc;if(_0x44d775[_0x9900('0x2c')]['includeAll']){_0x32e343['include']=[{'all':!![]}];}return db[_0x9900('0x27')]['findAll'](_0x32e343);})['then'](function(_0x5e2765){_0x50f16a['rows']=_0x5e2765;return _0x50f16a;})['then'](respondWithFilteredResult(_0x10fbae,_0x32e343))[_0x9900('0x3d')](handleError(_0x10fbae,null));};exports[_0x9900('0x3e')]=function(_0x3c8f30,_0x42849a){var _0x31c003={'raw':!![],'where':{'id':_0x3c8f30[_0x9900('0x3f')]['id']}},_0xb94a40={};_0xb94a40[_0x9900('0x2e')]=_['keys'](db[_0x9900('0x27')][_0x9900('0x28')]);_0xb94a40['query']=_['keys'](_0x3c8f30[_0x9900('0x2c')]);_0xb94a40[_0x9900('0x36')]=_[_0x9900('0x30')](_0xb94a40[_0x9900('0x2e')],_0xb94a40[_0x9900('0x2c')]);_0x31c003[_0x9900('0x2f')]=_[_0x9900('0x30')](_0xb94a40[_0x9900('0x2e')],qs['fields'](_0x3c8f30[_0x9900('0x2c')][_0x9900('0x31')]));_0x31c003['attributes']=_0x31c003[_0x9900('0x2f')][_0x9900('0x32')]?_0x31c003[_0x9900('0x2f')]:_0xb94a40[_0x9900('0x2e')];if(_0x3c8f30['query'][_0x9900('0x40')]){_0x31c003[_0x9900('0x41')]=[{'all':!![]}];}_0x31c003=_['merge']({},_0x31c003,_0x3c8f30[_0x9900('0x42')]);return db[_0x9900('0x27')][_0x9900('0x43')](_0x31c003)['then'](handleEntityNotFound(_0x42849a,null))[_0x9900('0x22')](respondWithResult(_0x42849a,null))['catch'](handleError(_0x42849a,null));};exports[_0x9900('0x44')]=function(_0x5ea06a,_0x1409a0){return db[_0x9900('0x27')][_0x9900('0x44')](_0x5ea06a['body'],{})[_0x9900('0x22')](respondWithResult(_0x1409a0,0xc9))['catch'](handleError(_0x1409a0,null));};exports[_0x9900('0x21')]=function(_0x11be07,_0x5ac239){if(_0x11be07[_0x9900('0x45')]['id']){delete _0x11be07[_0x9900('0x45')]['id'];}return db['JscriptyAnswerReport'][_0x9900('0x43')]({'where':{'id':_0x11be07[_0x9900('0x3f')]['id']}})[_0x9900('0x22')](handleEntityNotFound(_0x5ac239,null))[_0x9900('0x22')](saveUpdates(_0x11be07[_0x9900('0x45')],null))['then'](respondWithResult(_0x5ac239,null))['catch'](handleError(_0x5ac239,null));};exports[_0x9900('0x46')]=function(_0x43cf2c,_0x2aa081){return db[_0x9900('0x27')][_0x9900('0x43')]({'where':{'id':_0x43cf2c['params']['id']}})[_0x9900('0x22')](handleEntityNotFound(_0x2aa081,null))[_0x9900('0x22')](removeEntity(_0x2aa081,null))[_0x9900('0x3d')](handleError(_0x2aa081,null));};exports[_0x9900('0x47')]=function(_0x2f7f74,_0xb5512f){return db[_0x9900('0x27')]['describe']()[_0x9900('0x22')](respondWithResult(_0xb5512f,null))['catch'](handleError(_0xb5512f,null));}; \ No newline at end of file +var _0xa786=['stack','name','send','index','JscriptyAnswerReport','rawAttributes','type','key','map','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','mustache','util','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','apply','update','then','destroy','end'];(function(_0x2bd7c7,_0x4e3ea3){var _0x27e326=function(_0x512531){while(--_0x512531){_0x2bd7c7['push'](_0x2bd7c7['shift']());}};_0x27e326(++_0x4e3ea3);}(_0xa786,0x71));var _0x6a78=function(_0x209db9,_0x4f159c){_0x209db9=_0x209db9-0x0;var _0x1d0d3a=_0xa786[_0x209db9];return _0x1d0d3a;};'use strict';var emlformat=require(_0x6a78('0x0'));var rimraf=require(_0x6a78('0x1'));var zipdir=require(_0x6a78('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a78('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6a78('0x4'));var util=require(_0x6a78('0x5'));var path=require(_0x6a78('0x6'));var sox=require(_0x6a78('0x7'));var csv=require(_0x6a78('0x8'));var ejs=require(_0x6a78('0x9'));var fs=require('fs');var fs_extra=require(_0x6a78('0xa'));var _=require('lodash');var squel=require(_0x6a78('0xb'));var crypto=require(_0x6a78('0xc'));var jsforce=require(_0x6a78('0xd'));var deskjs=require(_0x6a78('0xe'));var toCsv=require(_0x6a78('0x8'));var querystring=require(_0x6a78('0xf'));var Papa=require(_0x6a78('0x10'));var Redis=require(_0x6a78('0x11'));var authService=require(_0x6a78('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6a78('0x13'));var hardwareService=require(_0x6a78('0x14'));var logger=require(_0x6a78('0x15'))('api');var utils=require(_0x6a78('0x16'));var config=require(_0x6a78('0x17'));var licenseUtil=require(_0x6a78('0x18'));var db=require(_0x6a78('0x19'))['db'];function respondWithStatusCode(_0x1fd1be,_0x5b633c){_0x5b633c=_0x5b633c||0xcc;return function(_0x24a60a){if(_0x24a60a){return _0x1fd1be[_0x6a78('0x1a')](_0x5b633c);}return _0x1fd1be[_0x6a78('0x1b')](_0x5b633c)['end']();};}function respondWithResult(_0x44c863,_0xecf980){_0xecf980=_0xecf980||0xc8;return function(_0x4c5351){if(_0x4c5351){return _0x44c863[_0x6a78('0x1b')](_0xecf980)[_0x6a78('0x1c')](_0x4c5351);}};}function respondWithFilteredResult(_0xe27467,_0x40ef48){return function(_0x3deede){if(_0x3deede){var _0x36e824=typeof _0x40ef48['offset']===_0x6a78('0x1d')&&typeof _0x40ef48[_0x6a78('0x1e')]===_0x6a78('0x1d');var _0x265f90=_0x3deede['count'];var _0x5e3616=_0x36e824?0x0:_0x40ef48[_0x6a78('0x1f')];var _0x585917=_0x36e824?_0x3deede['count']:_0x40ef48['offset']+_0x40ef48[_0x6a78('0x1e')];var _0xed3863;if(_0x585917>=_0x265f90){_0x585917=_0x265f90;_0xed3863=0xc8;}else{_0xed3863=0xce;}_0xe27467[_0x6a78('0x1b')](_0xed3863);return _0xe27467['set']('Content-Range',_0x5e3616+'-'+_0x585917+'/'+_0x265f90)[_0x6a78('0x1c')](_0x3deede);}return null;};}function patchUpdates(_0x29dec5){return function(_0x356b93){try{jsonpatch[_0x6a78('0x20')](_0x356b93,_0x29dec5,!![]);}catch(_0x5dc3fa){return BPromise['reject'](_0x5dc3fa);}return _0x356b93['save']();};}function saveUpdates(_0xd57884,_0x5869fd){return function(_0xd938cd){if(_0xd938cd){return _0xd938cd[_0x6a78('0x21')](_0xd57884)[_0x6a78('0x22')](function(_0x4b47b6){return _0x4b47b6;});}return null;};}function removeEntity(_0x49f711,_0xa5f42f){return function(_0x89fd2b){if(_0x89fd2b){return _0x89fd2b[_0x6a78('0x23')]()[_0x6a78('0x22')](function(){_0x49f711[_0x6a78('0x1b')](0xcc)[_0x6a78('0x24')]();});}};}function handleEntityNotFound(_0xefaa55,_0x4ea33e){return function(_0x28cbbf){if(!_0x28cbbf){_0xefaa55[_0x6a78('0x1a')](0x194);}return _0x28cbbf;};}function handleError(_0x1e91ad,_0x57a859){_0x57a859=_0x57a859||0x1f4;return function(_0x19860c){logger['error'](_0x19860c[_0x6a78('0x25')]);if(_0x19860c[_0x6a78('0x26')]){delete _0x19860c['name'];}_0x1e91ad[_0x6a78('0x1b')](_0x57a859)[_0x6a78('0x27')](_0x19860c);};}exports[_0x6a78('0x28')]=function(_0x149105,_0x5942c0){var _0x8bc302={},_0x125ca2={},_0x273a73={'count':0x0,'rows':[]};var _0x12e0c5=_['map'](db[_0x6a78('0x29')][_0x6a78('0x2a')],function(_0x3299c2){return{'name':_0x3299c2['fieldName'],'type':_0x3299c2[_0x6a78('0x2b')][_0x6a78('0x2c')]};});_0x125ca2['model']=_[_0x6a78('0x2d')](_0x12e0c5,_0x6a78('0x26'));_0x125ca2[_0x6a78('0x2e')]=_[_0x6a78('0x2f')](_0x149105[_0x6a78('0x2e')]);_0x125ca2['filters']=_[_0x6a78('0x30')](_0x125ca2[_0x6a78('0x31')],_0x125ca2['query']);_0x8bc302[_0x6a78('0x32')]=_[_0x6a78('0x30')](_0x125ca2[_0x6a78('0x31')],qs[_0x6a78('0x33')](_0x149105[_0x6a78('0x2e')][_0x6a78('0x33')]));_0x8bc302['attributes']=_0x8bc302[_0x6a78('0x32')]['length']?_0x8bc302[_0x6a78('0x32')]:_0x125ca2[_0x6a78('0x31')];if(!_0x149105[_0x6a78('0x2e')][_0x6a78('0x34')](_0x6a78('0x35'))){_0x8bc302[_0x6a78('0x1e')]=qs[_0x6a78('0x1e')](_0x149105[_0x6a78('0x2e')][_0x6a78('0x1e')]);_0x8bc302['offset']=qs['offset'](_0x149105[_0x6a78('0x2e')]['offset']);}_0x8bc302[_0x6a78('0x36')]=qs[_0x6a78('0x37')](_0x149105[_0x6a78('0x2e')][_0x6a78('0x37')]);_0x8bc302[_0x6a78('0x38')]=qs[_0x6a78('0x39')](_[_0x6a78('0x3a')](_0x149105[_0x6a78('0x2e')],_0x125ca2['filters']),_0x12e0c5);if(_0x149105[_0x6a78('0x2e')][_0x6a78('0x3b')]){_0x8bc302[_0x6a78('0x38')]=_['merge'](_0x8bc302[_0x6a78('0x38')],{'$or':_['map'](_0x12e0c5,function(_0x310ab2){if(_0x310ab2[_0x6a78('0x2b')]!==_0x6a78('0x3c')){var _0xe180fb={};_0xe180fb[_0x310ab2['name']]={'$like':'%'+_0x149105['query']['filter']+'%'};return _0xe180fb;}})});}_0x8bc302=_[_0x6a78('0x3d')]({},_0x8bc302,_0x149105[_0x6a78('0x3e')]);var _0x48eafa={'where':_0x8bc302[_0x6a78('0x38')]};return db[_0x6a78('0x29')][_0x6a78('0x3f')](_0x48eafa)[_0x6a78('0x22')](function(_0x44d5f7){_0x273a73[_0x6a78('0x3f')]=_0x44d5f7;if(_0x149105['query'][_0x6a78('0x40')]){_0x8bc302[_0x6a78('0x41')]=[{'all':!![]}];}return db[_0x6a78('0x29')][_0x6a78('0x42')](_0x8bc302);})[_0x6a78('0x22')](function(_0x23dcce){_0x273a73[_0x6a78('0x43')]=_0x23dcce;return _0x273a73;})['then'](respondWithFilteredResult(_0x5942c0,_0x8bc302))[_0x6a78('0x44')](handleError(_0x5942c0,null));};exports['show']=function(_0xeddf03,_0x4d3aec){var _0x526f09={'raw':!![],'where':{'id':_0xeddf03[_0x6a78('0x45')]['id']}},_0xc8f3e8={};_0xc8f3e8['model']=_[_0x6a78('0x2f')](db[_0x6a78('0x29')][_0x6a78('0x2a')]);_0xc8f3e8[_0x6a78('0x2e')]=_[_0x6a78('0x2f')](_0xeddf03['query']);_0xc8f3e8['filters']=_[_0x6a78('0x30')](_0xc8f3e8[_0x6a78('0x31')],_0xc8f3e8[_0x6a78('0x2e')]);_0x526f09[_0x6a78('0x32')]=_[_0x6a78('0x30')](_0xc8f3e8[_0x6a78('0x31')],qs[_0x6a78('0x33')](_0xeddf03['query'][_0x6a78('0x33')]));_0x526f09[_0x6a78('0x32')]=_0x526f09['attributes'][_0x6a78('0x46')]?_0x526f09[_0x6a78('0x32')]:_0xc8f3e8[_0x6a78('0x31')];if(_0xeddf03[_0x6a78('0x2e')][_0x6a78('0x40')]){_0x526f09[_0x6a78('0x41')]=[{'all':!![]}];}_0x526f09=_['merge']({},_0x526f09,_0xeddf03[_0x6a78('0x3e')]);return db[_0x6a78('0x29')][_0x6a78('0x47')](_0x526f09)[_0x6a78('0x22')](handleEntityNotFound(_0x4d3aec,null))[_0x6a78('0x22')](respondWithResult(_0x4d3aec,null))['catch'](handleError(_0x4d3aec,null));};exports[_0x6a78('0x48')]=function(_0x59a4c1,_0x1bdd6b){return db[_0x6a78('0x29')]['create'](_0x59a4c1[_0x6a78('0x49')],{})['then'](respondWithResult(_0x1bdd6b,0xc9))[_0x6a78('0x44')](handleError(_0x1bdd6b,null));};exports[_0x6a78('0x21')]=function(_0xe40d18,_0x46c94e){if(_0xe40d18[_0x6a78('0x49')]['id']){delete _0xe40d18['body']['id'];}return db['JscriptyAnswerReport'][_0x6a78('0x47')]({'where':{'id':_0xe40d18[_0x6a78('0x45')]['id']}})[_0x6a78('0x22')](handleEntityNotFound(_0x46c94e,null))[_0x6a78('0x22')](saveUpdates(_0xe40d18['body'],null))[_0x6a78('0x22')](respondWithResult(_0x46c94e,null))[_0x6a78('0x44')](handleError(_0x46c94e,null));};exports[_0x6a78('0x23')]=function(_0x57c0c4,_0x57bd8a){return db[_0x6a78('0x29')]['find']({'where':{'id':_0x57c0c4['params']['id']}})[_0x6a78('0x22')](handleEntityNotFound(_0x57bd8a,null))[_0x6a78('0x22')](removeEntity(_0x57bd8a,null))[_0x6a78('0x44')](handleError(_0x57bd8a,null));};exports[_0x6a78('0x4a')]=function(_0x15ca1a,_0x5a4d6e){return db['JscriptyAnswerReport']['describe']()[_0x6a78('0x22')](respondWithResult(_0x5a4d6e,null))[_0x6a78('0x44')](handleError(_0x5a4d6e,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 6a31bed..689b450 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 _0xdec5=['JscriptyAnswerReport','report_jscripty_answers','lodash','util','api','moment','request-promise','path','./jscriptyAnswerReport.attributes','exports'];(function(_0x114be0,_0x3f126c){var _0x52867c=function(_0x113e44){while(--_0x113e44){_0x114be0['push'](_0x114be0['shift']());}};_0x52867c(++_0x3f126c);}(_0xdec5,0x192));var _0x5dec=function(_0x4aff4a,_0x5163d5){_0x4aff4a=_0x4aff4a-0x0;var _0x452741=_0xdec5[_0x4aff4a];return _0x452741;};'use strict';var _=require(_0x5dec('0x0'));var util=require(_0x5dec('0x1'));var logger=require('../../config/logger')(_0x5dec('0x2'));var moment=require(_0x5dec('0x3'));var BPromise=require('bluebird');var rp=require(_0x5dec('0x4'));var fs=require('fs');var path=require(_0x5dec('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5dec('0x6'));module[_0x5dec('0x7')]=function(_0xd8be37,_0x50ad4e){return _0xd8be37['define'](_0x5dec('0x8'),attributes,{'tableName':_0x5dec('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x888d=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util'];(function(_0x4369a8,_0x25ba80){var _0x434b45=function(_0x1db786){while(--_0x1db786){_0x4369a8['push'](_0x4369a8['shift']());}};_0x434b45(++_0x25ba80);}(_0x888d,0x12a));var _0xd888=function(_0x504956,_0x365621){_0x504956=_0x504956-0x0;var _0x3750ea=_0x888d[_0x504956];return _0x3750ea;};'use strict';var _=require(_0xd888('0x0'));var util=require(_0xd888('0x1'));var logger=require(_0xd888('0x2'))(_0xd888('0x3'));var moment=require(_0xd888('0x4'));var BPromise=require(_0xd888('0x5'));var rp=require(_0xd888('0x6'));var fs=require('fs');var path=require(_0xd888('0x7'));var rimraf=require(_0xd888('0x8'));var config=require(_0xd888('0x9'));var attributes=require(_0xd888('0xa'));module[_0xd888('0xb')]=function(_0x2ea876,_0x1de87f){return _0x2ea876[_0xd888('0xc')](_0xd888('0xd'),attributes,{'tableName':_0xd888('0xe'),'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 e56a367..34fa169 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 _0xaa45=['JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x23b191,_0x433be8){var _0x19783b=function(_0x2f0da6){while(--_0x2f0da6){_0x23b191['push'](_0x23b191['shift']());}};_0x19783b(++_0x433be8);}(_0xaa45,0x1bc));var _0x5aa4=function(_0xdeac17,_0x19ad66){_0xdeac17=_0xdeac17-0x0;var _0x33aabd=_0xaa45[_0xdeac17];return _0x33aabd;};'use strict';var _=require(_0x5aa4('0x0'));var util=require(_0x5aa4('0x1'));var moment=require('moment');var BPromise=require(_0x5aa4('0x2'));var rs=require(_0x5aa4('0x3'));var fs=require('fs');var Redis=require(_0x5aa4('0x4'));var db=require(_0x5aa4('0x5'))['db'];var utils=require(_0x5aa4('0x6'));var logger=require(_0x5aa4('0x7'))(_0x5aa4('0x8'));var config=require(_0x5aa4('0x9'));var jayson=require(_0x5aa4('0xa'));var client=jayson[_0x5aa4('0xb')][_0x5aa4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x567649,_0x1bcc83,_0x5adc28){return new BPromise(function(_0x1e84a9,_0x36e4a8){return client[_0x5aa4('0xd')](_0x567649,_0x5adc28)[_0x5aa4('0xe')](function(_0x22d24f){logger[_0x5aa4('0xf')](_0x5aa4('0x10'),_0x1bcc83,_0x5aa4('0x11'));logger['debug']('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x1bcc83,_0x5aa4('0x11'),JSON[_0x5aa4('0x12')](_0x22d24f));if(_0x22d24f[_0x5aa4('0x13')]){if(_0x22d24f[_0x5aa4('0x13')][_0x5aa4('0x14')]===0x1f4){logger[_0x5aa4('0x13')](_0x5aa4('0x10'),_0x1bcc83,_0x22d24f[_0x5aa4('0x13')][_0x5aa4('0x15')]);return _0x36e4a8(_0x22d24f[_0x5aa4('0x13')][_0x5aa4('0x15')]);}logger[_0x5aa4('0x13')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x1bcc83,_0x22d24f[_0x5aa4('0x13')]['message']);return _0x1e84a9(_0x22d24f[_0x5aa4('0x13')][_0x5aa4('0x15')]);}else{logger[_0x5aa4('0xf')](_0x5aa4('0x10'),_0x1bcc83,_0x5aa4('0x11'));_0x1e84a9(_0x22d24f['result']['message']);}})[_0x5aa4('0x16')](function(_0x143f20){logger[_0x5aa4('0x13')](_0x5aa4('0x10'),_0x1bcc83,_0x143f20);_0x36e4a8(_0x143f20);});});} \ No newline at end of file +var _0x7ffe=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','JscriptyAnswerReport,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x33f750,_0x3a0638){var _0xd2186a=function(_0x20b011){while(--_0x20b011){_0x33f750['push'](_0x33f750['shift']());}};_0xd2186a(++_0x3a0638);}(_0x7ffe,0x96));var _0xe7ff=function(_0x4d8368,_0xb86126){_0x4d8368=_0x4d8368-0x0;var _0xbf0a1c=_0x7ffe[_0x4d8368];return _0xbf0a1c;};'use strict';var _=require(_0xe7ff('0x0'));var util=require(_0xe7ff('0x1'));var moment=require(_0xe7ff('0x2'));var BPromise=require(_0xe7ff('0x3'));var rs=require(_0xe7ff('0x4'));var fs=require('fs');var Redis=require(_0xe7ff('0x5'));var db=require(_0xe7ff('0x6'))['db'];var utils=require(_0xe7ff('0x7'));var logger=require(_0xe7ff('0x8'))(_0xe7ff('0x9'));var config=require(_0xe7ff('0xa'));var jayson=require(_0xe7ff('0xb'));var client=jayson[_0xe7ff('0xc')][_0xe7ff('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3679b7,_0x3b0827,_0x50ffa3){return new BPromise(function(_0x553d19,_0x5c1bea){return client[_0xe7ff('0xe')](_0x3679b7,_0x50ffa3)[_0xe7ff('0xf')](function(_0x53182b){logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x3b0827,'request\x20sent');logger['debug'](_0xe7ff('0x10'),_0x3b0827,_0xe7ff('0x11'),JSON[_0xe7ff('0x12')](_0x53182b));if(_0x53182b[_0xe7ff('0x13')]){if(_0x53182b[_0xe7ff('0x13')][_0xe7ff('0x14')]===0x1f4){logger[_0xe7ff('0x13')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x3b0827,_0x53182b[_0xe7ff('0x13')][_0xe7ff('0x15')]);return _0x5c1bea(_0x53182b[_0xe7ff('0x13')][_0xe7ff('0x15')]);}logger[_0xe7ff('0x13')](_0xe7ff('0x16'),_0x3b0827,_0x53182b['error'][_0xe7ff('0x15')]);return _0x553d19(_0x53182b['error']['message']);}else{logger[_0xe7ff('0x17')](_0xe7ff('0x16'),_0x3b0827,_0xe7ff('0x11'));_0x553d19(_0x53182b[_0xe7ff('0x18')][_0xe7ff('0x15')]);}})[_0xe7ff('0x19')](function(_0x4e8ef3){logger[_0xe7ff('0x13')](_0xe7ff('0x16'),_0x3b0827,_0x4e8ef3);_0x5c1bea(_0x4e8ef3);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 78047f8..f4ed98c 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 _0xf85b=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','isAuthenticated','index','get','/:id','show','getAnswers','30s','getSummary','create','post','/:id/clone','clone','put','delete','destroy','exports'];(function(_0x3e2714,_0x499c46){var _0x47725a=function(_0xec4fb9){while(--_0xec4fb9){_0x3e2714['push'](_0x3e2714['shift']());}};_0x47725a(++_0x499c46);}(_0xf85b,0x16c));var _0xbf85=function(_0x2b7c33,_0x46f6c9){_0x2b7c33=_0x2b7c33-0x0;var _0x581cef=_0xf85b[_0x2b7c33];return _0x581cef;};'use strict';var multer=require('multer');var util=require(_0xbf85('0x0'));var path=require(_0xbf85('0x1'));var timeout=require(_0xbf85('0x2'));var express=require(_0xbf85('0x3'));var router=express[_0xbf85('0x4')]();var fs_extra=require(_0xbf85('0x5'));var auth=require(_0xbf85('0x6'));var interaction=require(_0xbf85('0x7'));var config=require(_0xbf85('0x8'));var controller=require(_0xbf85('0x9'));router['get']('/',auth[_0xbf85('0xa')](),controller[_0xbf85('0xb')]);router[_0xbf85('0xc')](_0xbf85('0xd'),auth['isAuthenticated'](),controller[_0xbf85('0xe')]);router['get']('/:id/sessions',auth[_0xbf85('0xa')](),controller['getSessions']);router['get']('/:id/answers',auth[_0xbf85('0xa')](),controller[_0xbf85('0xf')]);router[_0xbf85('0xc')]('/:id/summary',auth['isAuthenticated'](),timeout(_0xbf85('0x10')),controller[_0xbf85('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbf85('0x12')]);router[_0xbf85('0x13')](_0xbf85('0x14'),auth['isAuthenticated'](),controller[_0xbf85('0x15')]);router[_0xbf85('0x16')]('/:id',auth[_0xbf85('0xa')](),controller['update']);router[_0xbf85('0x17')]('/:id',auth[_0xbf85('0xa')](),controller[_0xbf85('0x18')]);module[_0xbf85('0x19')]=router; \ No newline at end of file +var _0x2464=['getSummary','post','create','put','update','delete','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','/:id/sessions','getAnswers','/:id/summary','30s'];(function(_0x545b89,_0x1e44d5){var _0x95928d=function(_0xf398af){while(--_0xf398af){_0x545b89['push'](_0x545b89['shift']());}};_0x95928d(++_0x1e44d5);}(_0x2464,0x76));var _0x4246=function(_0x135b33,_0x2b0d32){_0x135b33=_0x135b33-0x0;var _0x4cccca=_0x2464[_0x135b33];return _0x4cccca;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4246('0x0'));var timeout=require('connect-timeout');var express=require(_0x4246('0x1'));var router=express[_0x4246('0x2')]();var fs_extra=require(_0x4246('0x3'));var auth=require(_0x4246('0x4'));var interaction=require(_0x4246('0x5'));var config=require(_0x4246('0x6'));var controller=require('./jscriptyProject.controller');router[_0x4246('0x7')]('/',auth[_0x4246('0x8')](),controller['index']);router[_0x4246('0x7')](_0x4246('0x9'),auth['isAuthenticated'](),controller['show']);router['get'](_0x4246('0xa'),auth[_0x4246('0x8')](),controller['getSessions']);router['get']('/:id/answers',auth['isAuthenticated'](),controller[_0x4246('0xb')]);router['get'](_0x4246('0xc'),auth[_0x4246('0x8')](),timeout(_0x4246('0xd')),controller[_0x4246('0xe')]);router[_0x4246('0xf')]('/',auth['isAuthenticated'](),controller[_0x4246('0x10')]);router[_0x4246('0xf')]('/:id/clone',auth[_0x4246('0x8')](),controller['clone']);router[_0x4246('0x11')]('/:id',auth[_0x4246('0x8')](),controller[_0x4246('0x12')]);router[_0x4246('0x13')](_0x4246('0x9'),auth[_0x4246('0x8')](),controller[_0x4246('0x14')]);module[_0x4246('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 6e4c912..47c9d35 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 _0xcc4f=['name','getDataValue','description','BOOLEAN','sequelize','lodash','exports','STRING','TEXT','isObjectLike','stringify','isString','setDataValue','formData','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}'];(function(_0x3baaa2,_0x238b35){var _0x21a72d=function(_0x3d1ebe){while(--_0x3d1ebe){_0x3baaa2['push'](_0x3baaa2['shift']());}};_0x21a72d(++_0x238b35);}(_0xcc4f,0xd6));var _0xfcc4=function(_0x532073,_0x17fa9d){_0x532073=_0x532073-0x0;var _0x336c21=_0xcc4f[_0x532073];return _0x336c21;};'use strict';var Sequelize=require(_0xfcc4('0x0'));var _=require(_0xfcc4('0x1'));var util=require('util');module[_0xfcc4('0x2')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0xfcc4('0x3')]},'formData':{'type':Sequelize[_0xfcc4('0x4')]('long'),'set':function(_0x3bca55){if(_[_0xfcc4('0x5')](_0x3bca55)){this['setDataValue']('formData',JSON[_0xfcc4('0x6')](_0x3bca55));}else if(_[_0xfcc4('0x7')](_0x3bca55)){this[_0xfcc4('0x8')](_0xfcc4('0x9'),_0x3bca55);}else{this[_0xfcc4('0x8')](_0xfcc4('0x9'),util['format'](_0xfcc4('0xa'),this['getDataValue'](_0xfcc4('0xb'))||'',this[_0xfcc4('0xc')](_0xfcc4('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xfcc4('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x5a0e=['formData','stringify','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','description','BOOLEAN','sequelize','lodash','exports','STRING','name','TEXT','long','isObjectLike','setDataValue'];(function(_0x39b9dc,_0x4e8ebb){var _0x316cd4=function(_0x455a06){while(--_0x455a06){_0x39b9dc['push'](_0x39b9dc['shift']());}};_0x316cd4(++_0x4e8ebb);}(_0x5a0e,0x9c));var _0xe5a0=function(_0x261b1f,_0x594b1f){_0x261b1f=_0x261b1f-0x0;var _0x56529a=_0x5a0e[_0x261b1f];return _0x56529a;};'use strict';var Sequelize=require(_0xe5a0('0x0'));var _=require(_0xe5a0('0x1'));var util=require('util');module[_0xe5a0('0x2')]={'name':{'type':Sequelize[_0xe5a0('0x3')],'unique':_0xe5a0('0x4')},'description':{'type':Sequelize[_0xe5a0('0x3')]},'formData':{'type':Sequelize[_0xe5a0('0x5')](_0xe5a0('0x6')),'set':function(_0x325557){if(_[_0xe5a0('0x7')](_0x325557)){this[_0xe5a0('0x8')](_0xe5a0('0x9'),JSON[_0xe5a0('0xa')](_0x325557));}else if(_['isString'](_0x325557)){this['setDataValue']('formData',_0x325557);}else{this[_0xe5a0('0x8')](_0xe5a0('0x9'),util[_0xe5a0('0xb')](_0xe5a0('0xc'),this['getDataValue'](_0xe5a0('0x4'))||'',this['getDataValue'](_0xe5a0('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xe5a0('0xe')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 87f22ce..9cee8e1 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 _0xd5a2=['JscriptyQuestionReport','-createdAt','questionId','question','SessionId','answer','push','isEmpty','now','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','setHeader','text/csv','download','sendStatus','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','get','Projects','UserProfileResource','error','stack','name','send','index','map','JscriptyProject','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','intersection','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','omit','updatedAt','create','destroy','getSessions','rawAttributes','pick','ProjectId','JscriptySessionReport','JscriptyAnswerReport','fromCharCode','toString','indexOf','getSummary','startTime','starttime'];(function(_0x32d182,_0x46dcb4){var _0x41d2ad=function(_0x1e40b3){while(--_0x1e40b3){_0x32d182['push'](_0x32d182['shift']());}};_0x41d2ad(++_0x46dcb4);}(_0xd5a2,0x1eb));var _0x2d5a=function(_0x32dcc8,_0x5ddcfa){_0x32dcc8=_0x32dcc8-0x0;var _0x4e2b48=_0xd5a2[_0x32dcc8];return _0x4e2b48;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2d5a('0x0'));var zipdir=require(_0x2d5a('0x1'));var jsonpatch=require(_0x2d5a('0x2'));var rp=require(_0x2d5a('0x3'));var moment=require(_0x2d5a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2d5a('0x5'));var util=require(_0x2d5a('0x6'));var path=require(_0x2d5a('0x7'));var sox=require(_0x2d5a('0x8'));var csv=require(_0x2d5a('0x9'));var ejs=require(_0x2d5a('0xa'));var fs=require('fs');var fs_extra=require(_0x2d5a('0xb'));var _=require(_0x2d5a('0xc'));var squel=require(_0x2d5a('0xd'));var crypto=require(_0x2d5a('0xe'));var jsforce=require(_0x2d5a('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2d5a('0x10'));var Papa=require('papaparse');var Redis=require(_0x2d5a('0x11'));var authService=require(_0x2d5a('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2d5a('0x13'));var hardwareService=require(_0x2d5a('0x14'));var logger=require(_0x2d5a('0x15'))(_0x2d5a('0x16'));var utils=require(_0x2d5a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2d5a('0x18'));var db=require(_0x2d5a('0x19'))['db'];function respondWithStatusCode(_0x21b294,_0x3a563d){_0x3a563d=_0x3a563d||0xcc;return function(_0x583be2){if(_0x583be2){return _0x21b294['sendStatus'](_0x3a563d);}return _0x21b294[_0x2d5a('0x1a')](_0x3a563d)[_0x2d5a('0x1b')]();};}function respondWithResult(_0x2fb947,_0x865c80){_0x865c80=_0x865c80||0xc8;return function(_0x5c1416){if(_0x5c1416){return _0x2fb947[_0x2d5a('0x1a')](_0x865c80)[_0x2d5a('0x1c')](_0x5c1416);}};}function respondWithFilteredResult(_0x117b4e,_0x26fef1){return function(_0x281af3){if(_0x281af3){var _0x4e4e9c=typeof _0x26fef1[_0x2d5a('0x1d')]===_0x2d5a('0x1e')&&typeof _0x26fef1[_0x2d5a('0x1f')]===_0x2d5a('0x1e');var _0x46fb2d=_0x281af3['count'];var _0x454c53=_0x4e4e9c?0x0:_0x26fef1['offset'];var _0x34ae77=_0x4e4e9c?_0x281af3[_0x2d5a('0x20')]:_0x26fef1[_0x2d5a('0x1d')]+_0x26fef1[_0x2d5a('0x1f')];var _0x47cd79;if(_0x34ae77>=_0x46fb2d){_0x34ae77=_0x46fb2d;_0x47cd79=0xc8;}else{_0x47cd79=0xce;}_0x117b4e['status'](_0x47cd79);return _0x117b4e['set']('Content-Range',_0x454c53+'-'+_0x34ae77+'/'+_0x46fb2d)[_0x2d5a('0x1c')](_0x281af3);}return null;};}function patchUpdates(_0x1830fd){return function(_0x4c19d4){try{jsonpatch[_0x2d5a('0x21')](_0x4c19d4,_0x1830fd,!![]);}catch(_0x197e7f){return BPromise[_0x2d5a('0x22')](_0x197e7f);}return _0x4c19d4[_0x2d5a('0x23')]();};}function saveUpdates(_0x49d731,_0x4ab096){return function(_0x523b7f){if(_0x523b7f){return _0x523b7f[_0x2d5a('0x24')](_0x49d731)[_0x2d5a('0x25')](function(_0x1ad71c){return _0x1ad71c;});}return null;};}function removeEntity(_0x3efd2b,_0x5f1c75){return function(_0x4f716f){if(_0x4f716f){return _0x4f716f['destroy']()[_0x2d5a('0x25')](function(){var _0x1beb0e=_0x4f716f[_0x2d5a('0x26')]({'plain':!![]});var _0x304b9a=_0x2d5a('0x27');return db[_0x2d5a('0x28')]['destroy']({'where':{'type':_0x304b9a,'resourceId':_0x1beb0e['id']}})[_0x2d5a('0x25')](function(){return _0x4f716f;});})[_0x2d5a('0x25')](function(){_0x3efd2b[_0x2d5a('0x1a')](0xcc)[_0x2d5a('0x1b')]();});}};}function handleEntityNotFound(_0x1ebd4d,_0x3a2d9e){return function(_0x4fb606){if(!_0x4fb606){_0x1ebd4d['sendStatus'](0x194);}return _0x4fb606;};}function handleError(_0x300d2c,_0x38b83d){_0x38b83d=_0x38b83d||0x1f4;return function(_0x513859){logger[_0x2d5a('0x29')](_0x513859[_0x2d5a('0x2a')]);if(_0x513859[_0x2d5a('0x2b')]){delete _0x513859[_0x2d5a('0x2b')];}_0x300d2c[_0x2d5a('0x1a')](_0x38b83d)[_0x2d5a('0x2c')](_0x513859);};}exports[_0x2d5a('0x2d')]=function(_0x2b2a51,_0x7814e){var _0x3e8fda={},_0xf62d6e={},_0x3a55ff={'count':0x0,'rows':[]};var _0x598b61=_[_0x2d5a('0x2e')](db[_0x2d5a('0x2f')]['rawAttributes'],function(_0x2a4866){return{'name':_0x2a4866['fieldName'],'type':_0x2a4866['type']['key']};});_0xf62d6e['model']=_[_0x2d5a('0x2e')](_0x598b61,'name');_0xf62d6e[_0x2d5a('0x30')]=_[_0x2d5a('0x31')](_0x2b2a51['query']);_0xf62d6e[_0x2d5a('0x32')]=_['intersection'](_0xf62d6e[_0x2d5a('0x33')],_0xf62d6e[_0x2d5a('0x30')]);_0x3e8fda[_0x2d5a('0x34')]=_['intersection'](_0xf62d6e[_0x2d5a('0x33')],qs[_0x2d5a('0x35')](_0x2b2a51['query'][_0x2d5a('0x35')]));_0x3e8fda['attributes']=_0x3e8fda[_0x2d5a('0x34')][_0x2d5a('0x36')]?_0x3e8fda[_0x2d5a('0x34')]:_0xf62d6e[_0x2d5a('0x33')];if(!_0x2b2a51[_0x2d5a('0x30')][_0x2d5a('0x37')](_0x2d5a('0x38'))){_0x3e8fda[_0x2d5a('0x1f')]=qs[_0x2d5a('0x1f')](_0x2b2a51[_0x2d5a('0x30')][_0x2d5a('0x1f')]);_0x3e8fda['offset']=qs[_0x2d5a('0x1d')](_0x2b2a51['query']['offset']);}_0x3e8fda[_0x2d5a('0x39')]=qs[_0x2d5a('0x3a')](_0x2b2a51[_0x2d5a('0x30')][_0x2d5a('0x3a')]);_0x3e8fda[_0x2d5a('0x3b')]=qs[_0x2d5a('0x32')](_['pick'](_0x2b2a51[_0x2d5a('0x30')],_0xf62d6e['filters']),_0x598b61);if(_0x2b2a51[_0x2d5a('0x30')][_0x2d5a('0x3c')]){_0x3e8fda[_0x2d5a('0x3b')]=_[_0x2d5a('0x3d')](_0x3e8fda[_0x2d5a('0x3b')],{'$or':_[_0x2d5a('0x2e')](_0x598b61,function(_0x4c5543){if(_0x4c5543['type']!==_0x2d5a('0x3e')){var _0x4d5464={};_0x4d5464[_0x4c5543[_0x2d5a('0x2b')]]={'$like':'%'+_0x2b2a51['query'][_0x2d5a('0x3c')]+'%'};return _0x4d5464;}})});}_0x3e8fda=_['merge']({},_0x3e8fda,_0x2b2a51[_0x2d5a('0x3f')]);var _0x3de6e8={'where':_0x3e8fda['where']};return db[_0x2d5a('0x2f')][_0x2d5a('0x20')](_0x3de6e8)['then'](function(_0x390e50){_0x3a55ff['count']=_0x390e50;if(_0x2b2a51['query'][_0x2d5a('0x40')]){_0x3e8fda[_0x2d5a('0x41')]=[{'all':!![]}];}return db[_0x2d5a('0x2f')][_0x2d5a('0x42')](_0x3e8fda);})[_0x2d5a('0x25')](function(_0x3d869e){_0x3a55ff[_0x2d5a('0x43')]=_0x3d869e;return _0x3a55ff;})[_0x2d5a('0x25')](respondWithFilteredResult(_0x7814e,_0x3e8fda))['catch'](handleError(_0x7814e,null));};exports[_0x2d5a('0x44')]=function(_0x58444b,_0x36455d){var _0x370d75={'raw':![],'where':{'id':_0x58444b[_0x2d5a('0x45')]['id']}},_0x37695e={};_0x37695e[_0x2d5a('0x33')]=_[_0x2d5a('0x31')](db[_0x2d5a('0x2f')]['rawAttributes']);_0x37695e[_0x2d5a('0x30')]=_[_0x2d5a('0x31')](_0x58444b[_0x2d5a('0x30')]);_0x37695e[_0x2d5a('0x32')]=_[_0x2d5a('0x46')](_0x37695e['model'],_0x37695e['query']);_0x370d75[_0x2d5a('0x34')]=_[_0x2d5a('0x46')](_0x37695e['model'],qs[_0x2d5a('0x35')](_0x58444b[_0x2d5a('0x30')][_0x2d5a('0x35')]));_0x370d75[_0x2d5a('0x34')]=_0x370d75['attributes']['length']?_0x370d75['attributes']:_0x37695e['model'];if(_0x58444b[_0x2d5a('0x30')][_0x2d5a('0x40')]){_0x370d75[_0x2d5a('0x41')]=[{'all':!![]}];}_0x370d75=_['merge']({},_0x370d75,_0x58444b['options']);return db[_0x2d5a('0x2f')][_0x2d5a('0x47')](_0x370d75)[_0x2d5a('0x25')](handleEntityNotFound(_0x36455d,null))[_0x2d5a('0x25')](respondWithResult(_0x36455d,null))[_0x2d5a('0x48')](handleError(_0x36455d,null));};exports['create']=function(_0x2b5325,_0x47e57f){return db[_0x2d5a('0x2f')]['create'](_0x2b5325[_0x2d5a('0x49')],{})['then'](function(_0x9156e5){var _0x3ab997=_0x2b5325[_0x2d5a('0x4a')][_0x2d5a('0x26')]({'plain':!![]});if(!_0x3ab997)throw new Error(_0x2d5a('0x4b'));if(_0x3ab997[_0x2d5a('0x4c')]===_0x2d5a('0x4a')){var _0x10039a=_0x9156e5[_0x2d5a('0x26')]({'plain':!![]});var _0x1e0afc=_0x2d5a('0x27');return db[_0x2d5a('0x4d')][_0x2d5a('0x47')]({'where':{'name':_0x1e0afc,'userProfileId':_0x3ab997[_0x2d5a('0x4e')]},'raw':!![]})['then'](function(_0x25c71b){if(_0x25c71b&&_0x25c71b[_0x2d5a('0x4f')]===0x0){return db[_0x2d5a('0x28')]['create']({'name':_0x10039a['name'],'resourceId':_0x10039a['id'],'type':_0x25c71b['name'],'sectionId':_0x25c71b['id']},{})[_0x2d5a('0x25')](function(){return _0x9156e5;});}else{return _0x9156e5;}})['catch'](function(_0x4c91d0){logger[_0x2d5a('0x29')](_0x2d5a('0x50'),_0x4c91d0);throw _0x4c91d0;});}return _0x9156e5;})['then'](respondWithResult(_0x47e57f,0xc9))[_0x2d5a('0x48')](handleError(_0x47e57f,null));};exports[_0x2d5a('0x51')]=function(_0x39df1e,_0x52f5ec){var _0x36961e={'where':{'id':_0x39df1e[_0x2d5a('0x45')]['id']}},_0x41be8b={};_0x41be8b[_0x2d5a('0x33')]=_[_0x2d5a('0x31')](db['JscriptyProject']['rawAttributes']);_0x36961e['attributes']=_[_0x2d5a('0x46')](_0x41be8b[_0x2d5a('0x33')],qs[_0x2d5a('0x35')](_0x39df1e[_0x2d5a('0x30')][_0x2d5a('0x35')]));_0x36961e[_0x2d5a('0x34')]=_0x36961e[_0x2d5a('0x34')][_0x2d5a('0x36')]?_0x36961e[_0x2d5a('0x34')]:_0x41be8b[_0x2d5a('0x33')];if(_0x39df1e[_0x2d5a('0x30')][_0x2d5a('0x40')]){_0x36961e[_0x2d5a('0x41')]=[{'all':!![]}];}_0x36961e=_[_0x2d5a('0x3d')]({},_0x36961e,_0x39df1e[_0x2d5a('0x3f')]);return db['JscriptyProject'][_0x2d5a('0x47')](_0x36961e)[_0x2d5a('0x25')](handleEntityNotFound(_0x52f5ec,null))['then'](function(_0x2f45bc){if(_0x2f45bc){var _0x385753=_0x2f45bc[_0x2d5a('0x26')]({'plain':!![]});_0x385753=qs['omit'](_0x385753,['id',_0x2d5a('0x52'),'updatedAt']);_0x39df1e[_0x2d5a('0x49')]=_[_0x2d5a('0x53')](_0x39df1e[_0x2d5a('0x49')],['id',_0x2d5a('0x52'),_0x2d5a('0x54')]);return db[_0x2d5a('0x2f')][_0x2d5a('0x55')](_[_0x2d5a('0x3d')](_0x385753,_0x39df1e['body']),{'include':_0x39df1e['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x1a4cc4){var _0xa57ffb=_0x39df1e[_0x2d5a('0x4a')][_0x2d5a('0x26')]({'plain':!![]});if(!_0xa57ffb)throw new Error(_0x2d5a('0x4b'));if(_0xa57ffb[_0x2d5a('0x4c')]===_0x2d5a('0x4a')){var _0x8d0357=_0x1a4cc4[_0x2d5a('0x26')]({'plain':!![]});var _0x52ce7f=_0x2d5a('0x27');return db[_0x2d5a('0x4d')]['find']({'where':{'name':_0x52ce7f,'userProfileId':_0xa57ffb[_0x2d5a('0x4e')]},'raw':!![]})['then'](function(_0x40ff72){if(_0x40ff72&&_0x40ff72[_0x2d5a('0x4f')]===0x0){return db[_0x2d5a('0x28')][_0x2d5a('0x55')]({'name':_0x8d0357[_0x2d5a('0x2b')],'resourceId':_0x8d0357['id'],'type':_0x40ff72[_0x2d5a('0x2b')],'sectionId':_0x40ff72['id']},{})[_0x2d5a('0x25')](function(){return _0x1a4cc4;});}else{return _0x1a4cc4;}})[_0x2d5a('0x48')](function(_0x46a7c3){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x46a7c3);throw _0x46a7c3;});}return _0x1a4cc4;});}})[_0x2d5a('0x25')](respondWithResult(_0x52f5ec,0xc9))[_0x2d5a('0x48')](handleError(_0x52f5ec,null));};exports[_0x2d5a('0x24')]=function(_0x2b5da9,_0x25e0b6){if(_0x2b5da9['body']['id']){delete _0x2b5da9[_0x2d5a('0x49')]['id'];}return db[_0x2d5a('0x2f')]['find']({'where':{'id':_0x2b5da9[_0x2d5a('0x45')]['id']}})['then'](handleEntityNotFound(_0x25e0b6,null))['then'](saveUpdates(_0x2b5da9[_0x2d5a('0x49')],null))[_0x2d5a('0x25')](respondWithResult(_0x25e0b6,null))['catch'](handleError(_0x25e0b6,null));};exports[_0x2d5a('0x56')]=function(_0x384b08,_0x2c19ae){return db['JscriptyProject'][_0x2d5a('0x47')]({'where':{'id':_0x384b08[_0x2d5a('0x45')]['id']}})[_0x2d5a('0x25')](handleEntityNotFound(_0x2c19ae,null))[_0x2d5a('0x25')](removeEntity(_0x2c19ae,null))['catch'](handleError(_0x2c19ae,null));};exports[_0x2d5a('0x57')]=function(_0x1a78c0,_0x351a7a,_0x270c8e){var _0x457305={'raw':!![],'where':{}};var _0x21a4a2={};var _0x20f0af={'count':0x0,'rows':[]};return db[_0x2d5a('0x2f')]['findOne']({'where':{'id':_0x1a78c0['params']['id']}})[_0x2d5a('0x25')](handleEntityNotFound(_0x351a7a,null))[_0x2d5a('0x25')](function(_0x1ec0c5){if(_0x1ec0c5){_0x21a4a2[_0x2d5a('0x33')]=_[_0x2d5a('0x31')](db['JscriptySessionReport'][_0x2d5a('0x58')]);_0x21a4a2[_0x2d5a('0x30')]=_[_0x2d5a('0x31')](_0x1a78c0[_0x2d5a('0x30')]);_0x21a4a2[_0x2d5a('0x32')]=_[_0x2d5a('0x46')](_0x21a4a2['model'],_0x21a4a2['query']);_0x457305[_0x2d5a('0x34')]=_[_0x2d5a('0x46')](_0x21a4a2[_0x2d5a('0x33')],qs[_0x2d5a('0x35')](_0x1a78c0['query'][_0x2d5a('0x35')]));_0x457305[_0x2d5a('0x34')]=_0x457305[_0x2d5a('0x34')]['length']?_0x457305[_0x2d5a('0x34')]:_0x21a4a2[_0x2d5a('0x33')];if(!_0x1a78c0[_0x2d5a('0x30')][_0x2d5a('0x37')](_0x2d5a('0x38'))){_0x457305['limit']=qs['limit'](_0x1a78c0[_0x2d5a('0x30')]['limit']);_0x457305['offset']=qs[_0x2d5a('0x1d')](_0x1a78c0[_0x2d5a('0x30')]['offset']);}_0x457305[_0x2d5a('0x39')]=qs[_0x2d5a('0x3a')](_0x1a78c0[_0x2d5a('0x30')][_0x2d5a('0x3a')]);_0x457305[_0x2d5a('0x3b')]=qs[_0x2d5a('0x32')](_[_0x2d5a('0x59')](_0x1a78c0['query'],_0x21a4a2[_0x2d5a('0x32')]));_0x457305[_0x2d5a('0x3b')][_0x2d5a('0x5a')]=_0x1ec0c5['id'];if(_0x1a78c0['query'][_0x2d5a('0x3c')]){_0x457305[_0x2d5a('0x3b')]=_[_0x2d5a('0x3d')](_0x457305['where'],{'$or':_[_0x2d5a('0x2e')](_0x457305[_0x2d5a('0x34')],function(_0x1a9ad6){var _0x22ff38={};_0x22ff38[_0x1a9ad6]={'$like':'%'+_0x1a78c0[_0x2d5a('0x30')][_0x2d5a('0x3c')]+'%'};return _0x22ff38;})});}_0x457305=_[_0x2d5a('0x3d')]({},_0x457305,_0x1a78c0[_0x2d5a('0x3f')]);return db[_0x2d5a('0x5b')][_0x2d5a('0x20')]({'where':_0x457305[_0x2d5a('0x3b')]})[_0x2d5a('0x25')](function(_0x5a28d9){_0x20f0af[_0x2d5a('0x20')]=_0x5a28d9;if(_0x1a78c0[_0x2d5a('0x30')][_0x2d5a('0x40')]){_0x457305[_0x2d5a('0x41')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x2d5a('0x42')](_0x457305);})[_0x2d5a('0x25')](function(_0x3ce75b){_0x20f0af['rows']=_0x3ce75b;return _0x20f0af;});}})[_0x2d5a('0x25')](respondWithFilteredResult(_0x351a7a,_0x457305))[_0x2d5a('0x48')](handleError(_0x351a7a,null));};exports['getAnswers']=function(_0x512c26,_0x13f6ef,_0x29519a){var _0x5f3923={'raw':!![],'where':{}};var _0x6b1745={};var _0x208139={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x512c26[_0x2d5a('0x45')]['id']}})[_0x2d5a('0x25')](handleEntityNotFound(_0x13f6ef,null))[_0x2d5a('0x25')](function(_0x3d741c){if(_0x3d741c){_0x6b1745[_0x2d5a('0x33')]=_[_0x2d5a('0x31')](db[_0x2d5a('0x5c')][_0x2d5a('0x58')]);_0x6b1745[_0x2d5a('0x30')]=_[_0x2d5a('0x31')](_0x512c26[_0x2d5a('0x30')]);_0x6b1745[_0x2d5a('0x32')]=_[_0x2d5a('0x46')](_0x6b1745[_0x2d5a('0x33')],_0x6b1745[_0x2d5a('0x30')]);_0x5f3923[_0x2d5a('0x34')]=_[_0x2d5a('0x46')](_0x6b1745[_0x2d5a('0x33')],qs[_0x2d5a('0x35')](_0x512c26[_0x2d5a('0x30')]['fields']));_0x5f3923[_0x2d5a('0x34')]=_0x5f3923['attributes']['length']?_0x5f3923[_0x2d5a('0x34')]:_0x6b1745[_0x2d5a('0x33')];if(!_0x512c26[_0x2d5a('0x30')][_0x2d5a('0x37')](_0x2d5a('0x38'))){_0x5f3923[_0x2d5a('0x1f')]=qs[_0x2d5a('0x1f')](_0x512c26[_0x2d5a('0x30')][_0x2d5a('0x1f')]);_0x5f3923[_0x2d5a('0x1d')]=qs[_0x2d5a('0x1d')](_0x512c26[_0x2d5a('0x30')][_0x2d5a('0x1d')]);}_0x5f3923[_0x2d5a('0x39')]=qs[_0x2d5a('0x3a')](_0x512c26[_0x2d5a('0x30')][_0x2d5a('0x3a')]);_0x5f3923[_0x2d5a('0x3b')]=qs[_0x2d5a('0x32')](_[_0x2d5a('0x59')](_0x512c26[_0x2d5a('0x30')],_0x6b1745[_0x2d5a('0x32')]));_0x5f3923[_0x2d5a('0x3b')][_0x2d5a('0x5a')]=_0x3d741c['id'];if(_0x512c26[_0x2d5a('0x30')][_0x2d5a('0x3c')]){_0x5f3923['where']=_[_0x2d5a('0x3d')](_0x5f3923[_0x2d5a('0x3b')],{'$or':_['map'](_0x5f3923['attributes'],function(_0x1fc5db){var _0x11e2e5={};_0x11e2e5[_0x1fc5db]={'$like':'%'+_0x512c26[_0x2d5a('0x30')][_0x2d5a('0x3c')]+'%'};return _0x11e2e5;})});}_0x5f3923=_[_0x2d5a('0x3d')]({},_0x5f3923,_0x512c26[_0x2d5a('0x3f')]);return db['JscriptyAnswerReport'][_0x2d5a('0x20')]({'where':_0x5f3923[_0x2d5a('0x3b')]})[_0x2d5a('0x25')](function(_0x25d00d){_0x208139[_0x2d5a('0x20')]=_0x25d00d;if(_0x512c26[_0x2d5a('0x30')][_0x2d5a('0x40')]){_0x5f3923[_0x2d5a('0x41')]=[{'all':!![]}];}return db[_0x2d5a('0x5c')][_0x2d5a('0x42')](_0x5f3923);})[_0x2d5a('0x25')](function(_0xb8637d){_0x208139[_0x2d5a('0x43')]=_0xb8637d;return _0x208139;});}})[_0x2d5a('0x25')](respondWithFilteredResult(_0x13f6ef,_0x5f3923))[_0x2d5a('0x48')](handleError(_0x13f6ef,null));};function char(_0x21fde6){return'number'===typeof _0x21fde6?String[_0x2d5a('0x5d')][_0x2d5a('0x21')](null,arguments):_0x21fde6;}function needsEncapsulation(_0x83a76c){return!!_0x83a76c&&(_0x83a76c[_0x2d5a('0x5e')]()[_0x2d5a('0x5f')](char(0xd))>=0x0||_0x83a76c['toString']()['indexOf'](char(0xa))>=0x0||_0x83a76c[_0x2d5a('0x5e')]()[_0x2d5a('0x5f')](char(0x2c))>=0x0||_0x83a76c['toString']()[_0x2d5a('0x5f')](char(0x22))>=0x0);}function encapsulate(_0x2c232d){var _0x489374=char(0x22),_0x1bbf5e='\x5c'+char(0x22),_0x4fe28e=_0x2c232d['toString']()['replace'](new RegExp(_0x489374,'g'),_0x1bbf5e);return _0x489374+_0x4fe28e+_0x489374;}exports[_0x2d5a('0x60')]=function(_0x3b5ddc,_0x581af2,_0x4b01c5){var _0xc31cb0,_0x336726;var _0x366274={'where':{'ProjectId':_0x3b5ddc['params']['id']}};if(_0x3b5ddc[_0x2d5a('0x30')][_0x2d5a('0x61')]){_0x366274[_0x2d5a('0x3b')][_0x2d5a('0x62')]=JSON['parse'](_0x3b5ddc['query'][_0x2d5a('0x61')]);}return db[_0x2d5a('0x5b')]['findAll'](_0x366274)[_0x2d5a('0x25')](handleEntityNotFound(_0x581af2,null))['then'](function(_0x4d62f1){if(_0x4d62f1){_0xc31cb0=_0x4d62f1;return db[_0x2d5a('0x63')][_0x2d5a('0x42')]({'where':{'SessionId':{'$in':_[_0x2d5a('0x2e')](_0xc31cb0,'id')},'ProjectId':_0x3b5ddc[_0x2d5a('0x45')]['id']},'order':_0x2d5a('0x64')});}})[_0x2d5a('0x25')](handleEntityNotFound(_0x581af2,null))[_0x2d5a('0x25')](function(_0x1952c8){if(_0x1952c8){_0x336726=_0x1952c8;var _0x489d5e={};for(var _0xb01f3=0x0,_0x137a8a=_0x336726[_0x2d5a('0x36')];_0xb01f3<_0x137a8a;_0xb01f3++){if(!_0x489d5e['hasOwnProperty'](_0x336726[_0xb01f3]['questionId'])){_0x489d5e[_0x336726[_0xb01f3][_0x2d5a('0x65')]]=needsEncapsulation(_0x336726[_0xb01f3][_0x2d5a('0x66')])?encapsulate(_0x336726[_0xb01f3][_0x2d5a('0x66')]):_0x336726[_0xb01f3][_0x2d5a('0x66')];}}var _0x3c6f8a=[],_0x2ead74={};for(var _0x5d2aa6=0x0,_0x5744d5=_0xc31cb0['length'];_0x5d2aa6<_0x5744d5;_0x5d2aa6++){_0x2ead74={'ProjectId':_0x3b5ddc[_0x2d5a('0x45')]['id'],'SessionId':_0xc31cb0[_0x5d2aa6]['id'],'StartTime':moment(_0xc31cb0[_0x5d2aa6][_0x2d5a('0x62')])['format']('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x4c9c3a=0x0,_0x166651=_0x336726[_0x2d5a('0x36')];_0x4c9c3a<_0x166651;_0x4c9c3a++){if(_0x336726[_0x4c9c3a][_0x2d5a('0x67')]==_0xc31cb0[_0x5d2aa6]['id']&&_0x489d5e[_0x2d5a('0x37')](_0x336726[_0x4c9c3a]['questionId'])){_0x2ead74[_0x489d5e[_0x336726[_0x4c9c3a][_0x2d5a('0x65')]]]=_0x336726[_0x4c9c3a][_0x2d5a('0x68')];}}for(var _0x36a20d in _0x489d5e){if(!_0x2ead74['hasOwnProperty'](_0x489d5e[_0x36a20d])){_0x2ead74[_0x489d5e[_0x36a20d]]=null;}}_0x3c6f8a[_0x2d5a('0x69')](_0x2ead74);}return _0x3c6f8a;}})['then'](function(_0x1503ef){if(!_[_0x2d5a('0x6a')](_0x1503ef)){var _0xa5878d=toCsv(_0x1503ef);var _0x195c09=Date[_0x2d5a('0x6b')]();fs[_0x2d5a('0x6c')](util[_0x2d5a('0x6d')](_0x2d5a('0x6e'),_0x3b5ddc[_0x2d5a('0x45')]['id'],_0x195c09),_0xa5878d);_0x581af2['setHeader'](_0x2d5a('0x6f'),_0x2d5a('0x70')+util[_0x2d5a('0x6d')](_0x2d5a('0x71'),_0x3b5ddc['params']['id'],_0x195c09));_0x581af2[_0x2d5a('0x72')]('Content-type',_0x2d5a('0x73'));return _0x581af2[_0x2d5a('0x74')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x3b5ddc[_0x2d5a('0x45')]['id'],_0x195c09));}else{return _0x581af2[_0x2d5a('0x75')](0xcc);}})[_0x2d5a('0x48')](handleError(_0x581af2,null));}; \ No newline at end of file +var _0x17a7=['apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','stack','name','index','map','rawAttributes','fieldName','type','keys','query','filters','intersection','attributes','fields','length','model','nolimit','sort','filter','where','merge','JscriptyProject','includeAll','include','findAll','rows','catch','show','params','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Projects','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','updatedAt','body','createdAt','UserProfileSection','error','getSessions','findOne','JscriptySessionReport','hasOwnProperty','order','pick','ProjectId','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','parse','startTime','-createdAt','questionId','question','starttime','YYYY-MM-DD\x20HH:mm:ss','answer','push','now','writeFileSync','format','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','/tmp/Jscripty_Project_%d_Summary_%s.csv','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','offset','limit','count','json'];(function(_0x4b2cc6,_0x29ef43){var _0x3e0b08=function(_0x3b4131){while(--_0x3b4131){_0x4b2cc6['push'](_0x4b2cc6['shift']());}};_0x3e0b08(++_0x29ef43);}(_0x17a7,0xc2));var _0x717a=function(_0x1a708c,_0x3de647){_0x1a708c=_0x1a708c-0x0;var _0x2b6c76=_0x17a7[_0x1a708c];return _0x2b6c76;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x717a('0x0'));var rp=require(_0x717a('0x1'));var moment=require(_0x717a('0x2'));var BPromise=require(_0x717a('0x3'));var Mustache=require('mustache');var util=require(_0x717a('0x4'));var path=require('path');var sox=require(_0x717a('0x5'));var csv=require(_0x717a('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x717a('0x7'));var _=require(_0x717a('0x8'));var squel=require(_0x717a('0x9'));var crypto=require(_0x717a('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x717a('0xb'));var toCsv=require('to-csv');var querystring=require(_0x717a('0xc'));var Papa=require('papaparse');var Redis=require(_0x717a('0xd'));var authService=require(_0x717a('0xe'));var qs=require(_0x717a('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x717a('0x10'))(_0x717a('0x11'));var utils=require(_0x717a('0x12'));var config=require(_0x717a('0x13'));var licenseUtil=require(_0x717a('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45eb68,_0x588baf){_0x588baf=_0x588baf||0xcc;return function(_0x2e2e95){if(_0x2e2e95){return _0x45eb68['sendStatus'](_0x588baf);}return _0x45eb68['status'](_0x588baf)['end']();};}function respondWithResult(_0x4a11bb,_0x295862){_0x295862=_0x295862||0xc8;return function(_0x546495){if(_0x546495){return _0x4a11bb[_0x717a('0x15')](_0x295862)['json'](_0x546495);}};}function respondWithFilteredResult(_0x1eca09,_0x58e33a){return function(_0xb85066){if(_0xb85066){var _0x6ae1be=typeof _0x58e33a[_0x717a('0x16')]==='undefined'&&typeof _0x58e33a[_0x717a('0x17')]==='undefined';var _0x130cb2=_0xb85066[_0x717a('0x18')];var _0x152e10=_0x6ae1be?0x0:_0x58e33a[_0x717a('0x16')];var _0x45dc38=_0x6ae1be?_0xb85066[_0x717a('0x18')]:_0x58e33a[_0x717a('0x16')]+_0x58e33a[_0x717a('0x17')];var _0x1e798f;if(_0x45dc38>=_0x130cb2){_0x45dc38=_0x130cb2;_0x1e798f=0xc8;}else{_0x1e798f=0xce;}_0x1eca09[_0x717a('0x15')](_0x1e798f);return _0x1eca09['set']('Content-Range',_0x152e10+'-'+_0x45dc38+'/'+_0x130cb2)[_0x717a('0x19')](_0xb85066);}return null;};}function patchUpdates(_0x1d7ebd){return function(_0x3ac808){try{jsonpatch[_0x717a('0x1a')](_0x3ac808,_0x1d7ebd,!![]);}catch(_0x2ef0e9){return BPromise[_0x717a('0x1b')](_0x2ef0e9);}return _0x3ac808[_0x717a('0x1c')]();};}function saveUpdates(_0x50847f,_0x4e95dc){return function(_0x3fc2be){if(_0x3fc2be){return _0x3fc2be[_0x717a('0x1d')](_0x50847f)[_0x717a('0x1e')](function(_0x33947c){return _0x33947c;});}return null;};}function removeEntity(_0x29a64c,_0x594e9c){return function(_0x345d54){if(_0x345d54){return _0x345d54[_0x717a('0x1f')]()[_0x717a('0x1e')](function(){var _0x5e578e=_0x345d54[_0x717a('0x20')]({'plain':!![]});var _0x36a145='Projects';return db[_0x717a('0x21')][_0x717a('0x1f')]({'where':{'type':_0x36a145,'resourceId':_0x5e578e['id']}})[_0x717a('0x1e')](function(){return _0x345d54;});})[_0x717a('0x1e')](function(){_0x29a64c[_0x717a('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1654dd,_0x25bc5e){return function(_0x2d628c){if(!_0x2d628c){_0x1654dd[_0x717a('0x22')](0x194);}return _0x2d628c;};}function handleError(_0x315d64,_0x42ac79){_0x42ac79=_0x42ac79||0x1f4;return function(_0x40f3ac){logger['error'](_0x40f3ac[_0x717a('0x23')]);if(_0x40f3ac[_0x717a('0x24')]){delete _0x40f3ac[_0x717a('0x24')];}_0x315d64['status'](_0x42ac79)['send'](_0x40f3ac);};}exports[_0x717a('0x25')]=function(_0x45847a,_0x97d7a1){var _0x5007e3={},_0x2719ab={},_0x24f51d={'count':0x0,'rows':[]};var _0x4c63d8=_[_0x717a('0x26')](db['JscriptyProject'][_0x717a('0x27')],function(_0x13481e){return{'name':_0x13481e[_0x717a('0x28')],'type':_0x13481e[_0x717a('0x29')]['key']};});_0x2719ab['model']=_['map'](_0x4c63d8,_0x717a('0x24'));_0x2719ab['query']=_[_0x717a('0x2a')](_0x45847a[_0x717a('0x2b')]);_0x2719ab[_0x717a('0x2c')]=_[_0x717a('0x2d')](_0x2719ab['model'],_0x2719ab['query']);_0x5007e3[_0x717a('0x2e')]=_[_0x717a('0x2d')](_0x2719ab['model'],qs[_0x717a('0x2f')](_0x45847a[_0x717a('0x2b')][_0x717a('0x2f')]));_0x5007e3[_0x717a('0x2e')]=_0x5007e3['attributes'][_0x717a('0x30')]?_0x5007e3[_0x717a('0x2e')]:_0x2719ab[_0x717a('0x31')];if(!_0x45847a[_0x717a('0x2b')]['hasOwnProperty'](_0x717a('0x32'))){_0x5007e3['limit']=qs['limit'](_0x45847a['query']['limit']);_0x5007e3[_0x717a('0x16')]=qs[_0x717a('0x16')](_0x45847a['query']['offset']);}_0x5007e3['order']=qs[_0x717a('0x33')](_0x45847a[_0x717a('0x2b')][_0x717a('0x33')]);_0x5007e3['where']=qs[_0x717a('0x2c')](_['pick'](_0x45847a['query'],_0x2719ab[_0x717a('0x2c')]),_0x4c63d8);if(_0x45847a[_0x717a('0x2b')][_0x717a('0x34')]){_0x5007e3[_0x717a('0x35')]=_[_0x717a('0x36')](_0x5007e3[_0x717a('0x35')],{'$or':_[_0x717a('0x26')](_0x4c63d8,function(_0x2b545b){if(_0x2b545b[_0x717a('0x29')]!=='VIRTUAL'){var _0x7dfb98={};_0x7dfb98[_0x2b545b[_0x717a('0x24')]]={'$like':'%'+_0x45847a[_0x717a('0x2b')][_0x717a('0x34')]+'%'};return _0x7dfb98;}})});}_0x5007e3=_['merge']({},_0x5007e3,_0x45847a['options']);var _0x154f74={'where':_0x5007e3[_0x717a('0x35')]};return db[_0x717a('0x37')][_0x717a('0x18')](_0x154f74)[_0x717a('0x1e')](function(_0x52b944){_0x24f51d[_0x717a('0x18')]=_0x52b944;if(_0x45847a['query'][_0x717a('0x38')]){_0x5007e3[_0x717a('0x39')]=[{'all':!![]}];}return db['JscriptyProject'][_0x717a('0x3a')](_0x5007e3);})[_0x717a('0x1e')](function(_0x684c41){_0x24f51d[_0x717a('0x3b')]=_0x684c41;return _0x24f51d;})[_0x717a('0x1e')](respondWithFilteredResult(_0x97d7a1,_0x5007e3))[_0x717a('0x3c')](handleError(_0x97d7a1,null));};exports[_0x717a('0x3d')]=function(_0x3970c7,_0x437107){var _0x5c430f={'raw':![],'where':{'id':_0x3970c7[_0x717a('0x3e')]['id']}},_0x44cf53={};_0x44cf53[_0x717a('0x31')]=_['keys'](db['JscriptyProject'][_0x717a('0x27')]);_0x44cf53[_0x717a('0x2b')]=_[_0x717a('0x2a')](_0x3970c7[_0x717a('0x2b')]);_0x44cf53[_0x717a('0x2c')]=_[_0x717a('0x2d')](_0x44cf53[_0x717a('0x31')],_0x44cf53[_0x717a('0x2b')]);_0x5c430f[_0x717a('0x2e')]=_[_0x717a('0x2d')](_0x44cf53[_0x717a('0x31')],qs[_0x717a('0x2f')](_0x3970c7[_0x717a('0x2b')][_0x717a('0x2f')]));_0x5c430f[_0x717a('0x2e')]=_0x5c430f['attributes'][_0x717a('0x30')]?_0x5c430f['attributes']:_0x44cf53[_0x717a('0x31')];if(_0x3970c7['query'][_0x717a('0x38')]){_0x5c430f[_0x717a('0x39')]=[{'all':!![]}];}_0x5c430f=_[_0x717a('0x36')]({},_0x5c430f,_0x3970c7[_0x717a('0x3f')]);return db[_0x717a('0x37')][_0x717a('0x40')](_0x5c430f)[_0x717a('0x1e')](handleEntityNotFound(_0x437107,null))[_0x717a('0x1e')](respondWithResult(_0x437107,null))[_0x717a('0x3c')](handleError(_0x437107,null));};exports[_0x717a('0x41')]=function(_0x3914f4,_0x20c865){return db[_0x717a('0x37')][_0x717a('0x41')](_0x3914f4['body'],{})[_0x717a('0x1e')](function(_0x4cb6f2){var _0x425142=_0x3914f4[_0x717a('0x42')][_0x717a('0x20')]({'plain':!![]});if(!_0x425142)throw new Error(_0x717a('0x43'));if(_0x425142[_0x717a('0x44')]===_0x717a('0x42')){var _0x2e07eb=_0x4cb6f2[_0x717a('0x20')]({'plain':!![]});var _0x2c8751=_0x717a('0x45');return db['UserProfileSection'][_0x717a('0x40')]({'where':{'name':_0x2c8751,'userProfileId':_0x425142[_0x717a('0x46')]},'raw':!![]})[_0x717a('0x1e')](function(_0x4ba556){if(_0x4ba556&&_0x4ba556['autoAssociation']===0x0){return db[_0x717a('0x21')][_0x717a('0x41')]({'name':_0x2e07eb[_0x717a('0x24')],'resourceId':_0x2e07eb['id'],'type':_0x4ba556[_0x717a('0x24')],'sectionId':_0x4ba556['id']},{})['then'](function(){return _0x4cb6f2;});}else{return _0x4cb6f2;}})[_0x717a('0x3c')](function(_0x43a320){logger['error'](_0x717a('0x47'),_0x43a320);throw _0x43a320;});}return _0x4cb6f2;})[_0x717a('0x1e')](respondWithResult(_0x20c865,0xc9))[_0x717a('0x3c')](handleError(_0x20c865,null));};exports[_0x717a('0x48')]=function(_0xa1ab6d,_0x3d4663){var _0x430084={'where':{'id':_0xa1ab6d['params']['id']}},_0x498077={};_0x498077[_0x717a('0x31')]=_[_0x717a('0x2a')](db[_0x717a('0x37')]['rawAttributes']);_0x430084['attributes']=_[_0x717a('0x2d')](_0x498077[_0x717a('0x31')],qs[_0x717a('0x2f')](_0xa1ab6d[_0x717a('0x2b')][_0x717a('0x2f')]));_0x430084[_0x717a('0x2e')]=_0x430084[_0x717a('0x2e')][_0x717a('0x30')]?_0x430084[_0x717a('0x2e')]:_0x498077[_0x717a('0x31')];if(_0xa1ab6d[_0x717a('0x2b')][_0x717a('0x38')]){_0x430084[_0x717a('0x39')]=[{'all':!![]}];}_0x430084=_['merge']({},_0x430084,_0xa1ab6d[_0x717a('0x3f')]);return db['JscriptyProject']['find'](_0x430084)[_0x717a('0x1e')](handleEntityNotFound(_0x3d4663,null))[_0x717a('0x1e')](function(_0x5f0884){if(_0x5f0884){var _0x5887d1=_0x5f0884[_0x717a('0x20')]({'plain':!![]});_0x5887d1=qs['omit'](_0x5887d1,['id','createdAt',_0x717a('0x49')]);_0xa1ab6d['body']=_['omit'](_0xa1ab6d[_0x717a('0x4a')],['id',_0x717a('0x4b'),_0x717a('0x49')]);return db['JscriptyProject'][_0x717a('0x41')](_['merge'](_0x5887d1,_0xa1ab6d[_0x717a('0x4a')]),{'include':_0xa1ab6d[_0x717a('0x2b')]['includeAll']?[{'all':!![]}]:undefined})[_0x717a('0x1e')](function(_0x3501e6){var _0x2d85a2=_0xa1ab6d[_0x717a('0x42')]['get']({'plain':!![]});if(!_0x2d85a2)throw new Error(_0x717a('0x43'));if(_0x2d85a2[_0x717a('0x44')]==='user'){var _0xdd262e=_0x3501e6[_0x717a('0x20')]({'plain':!![]});var _0x7943e5=_0x717a('0x45');return db[_0x717a('0x4c')][_0x717a('0x40')]({'where':{'name':_0x7943e5,'userProfileId':_0x2d85a2[_0x717a('0x46')]},'raw':!![]})[_0x717a('0x1e')](function(_0x39a0c5){if(_0x39a0c5&&_0x39a0c5['autoAssociation']===0x0){return db[_0x717a('0x21')][_0x717a('0x41')]({'name':_0xdd262e[_0x717a('0x24')],'resourceId':_0xdd262e['id'],'type':_0x39a0c5[_0x717a('0x24')],'sectionId':_0x39a0c5['id']},{})[_0x717a('0x1e')](function(){return _0x3501e6;});}else{return _0x3501e6;}})['catch'](function(_0x4e5941){logger[_0x717a('0x4d')](_0x717a('0x47'),_0x4e5941);throw _0x4e5941;});}return _0x3501e6;});}})[_0x717a('0x1e')](respondWithResult(_0x3d4663,0xc9))[_0x717a('0x3c')](handleError(_0x3d4663,null));};exports[_0x717a('0x1d')]=function(_0x58d6b8,_0x4688db){if(_0x58d6b8[_0x717a('0x4a')]['id']){delete _0x58d6b8[_0x717a('0x4a')]['id'];}return db[_0x717a('0x37')][_0x717a('0x40')]({'where':{'id':_0x58d6b8['params']['id']}})[_0x717a('0x1e')](handleEntityNotFound(_0x4688db,null))[_0x717a('0x1e')](saveUpdates(_0x58d6b8[_0x717a('0x4a')],null))[_0x717a('0x1e')](respondWithResult(_0x4688db,null))[_0x717a('0x3c')](handleError(_0x4688db,null));};exports[_0x717a('0x1f')]=function(_0x395bcc,_0x3e156e){return db['JscriptyProject'][_0x717a('0x40')]({'where':{'id':_0x395bcc['params']['id']}})[_0x717a('0x1e')](handleEntityNotFound(_0x3e156e,null))[_0x717a('0x1e')](removeEntity(_0x3e156e,null))[_0x717a('0x3c')](handleError(_0x3e156e,null));};exports[_0x717a('0x4e')]=function(_0x2ab0b3,_0x395f27,_0x1be55c){var _0x420afa={'raw':!![],'where':{}};var _0x5ad8d6={};var _0x77887c={'count':0x0,'rows':[]};return db[_0x717a('0x37')][_0x717a('0x4f')]({'where':{'id':_0x2ab0b3[_0x717a('0x3e')]['id']}})['then'](handleEntityNotFound(_0x395f27,null))[_0x717a('0x1e')](function(_0x45cc58){if(_0x45cc58){_0x5ad8d6[_0x717a('0x31')]=_['keys'](db[_0x717a('0x50')][_0x717a('0x27')]);_0x5ad8d6[_0x717a('0x2b')]=_[_0x717a('0x2a')](_0x2ab0b3['query']);_0x5ad8d6[_0x717a('0x2c')]=_[_0x717a('0x2d')](_0x5ad8d6[_0x717a('0x31')],_0x5ad8d6['query']);_0x420afa[_0x717a('0x2e')]=_[_0x717a('0x2d')](_0x5ad8d6['model'],qs[_0x717a('0x2f')](_0x2ab0b3['query'][_0x717a('0x2f')]));_0x420afa['attributes']=_0x420afa['attributes'][_0x717a('0x30')]?_0x420afa[_0x717a('0x2e')]:_0x5ad8d6[_0x717a('0x31')];if(!_0x2ab0b3[_0x717a('0x2b')][_0x717a('0x51')](_0x717a('0x32'))){_0x420afa[_0x717a('0x17')]=qs[_0x717a('0x17')](_0x2ab0b3[_0x717a('0x2b')][_0x717a('0x17')]);_0x420afa[_0x717a('0x16')]=qs[_0x717a('0x16')](_0x2ab0b3['query'][_0x717a('0x16')]);}_0x420afa[_0x717a('0x52')]=qs[_0x717a('0x33')](_0x2ab0b3['query']['sort']);_0x420afa[_0x717a('0x35')]=qs[_0x717a('0x2c')](_[_0x717a('0x53')](_0x2ab0b3['query'],_0x5ad8d6[_0x717a('0x2c')]));_0x420afa['where'][_0x717a('0x54')]=_0x45cc58['id'];if(_0x2ab0b3[_0x717a('0x2b')][_0x717a('0x34')]){_0x420afa[_0x717a('0x35')]=_['merge'](_0x420afa[_0x717a('0x35')],{'$or':_[_0x717a('0x26')](_0x420afa[_0x717a('0x2e')],function(_0x5a291b){var _0x2acfb5={};_0x2acfb5[_0x5a291b]={'$like':'%'+_0x2ab0b3[_0x717a('0x2b')]['filter']+'%'};return _0x2acfb5;})});}_0x420afa=_[_0x717a('0x36')]({},_0x420afa,_0x2ab0b3[_0x717a('0x3f')]);return db[_0x717a('0x50')][_0x717a('0x18')]({'where':_0x420afa['where']})[_0x717a('0x1e')](function(_0x284151){_0x77887c[_0x717a('0x18')]=_0x284151;if(_0x2ab0b3[_0x717a('0x2b')][_0x717a('0x38')]){_0x420afa[_0x717a('0x39')]=[{'all':!![]}];}return db[_0x717a('0x50')][_0x717a('0x3a')](_0x420afa);})[_0x717a('0x1e')](function(_0x4a4f12){_0x77887c[_0x717a('0x3b')]=_0x4a4f12;return _0x77887c;});}})[_0x717a('0x1e')](respondWithFilteredResult(_0x395f27,_0x420afa))[_0x717a('0x3c')](handleError(_0x395f27,null));};exports['getAnswers']=function(_0x41fd62,_0x3d09e5,_0x3fefb8){var _0x3230d5={'raw':!![],'where':{}};var _0x4913db={};var _0x40b95e={'count':0x0,'rows':[]};return db[_0x717a('0x37')]['findOne']({'where':{'id':_0x41fd62[_0x717a('0x3e')]['id']}})[_0x717a('0x1e')](handleEntityNotFound(_0x3d09e5,null))['then'](function(_0xbc9021){if(_0xbc9021){_0x4913db[_0x717a('0x31')]=_[_0x717a('0x2a')](db[_0x717a('0x55')][_0x717a('0x27')]);_0x4913db[_0x717a('0x2b')]=_[_0x717a('0x2a')](_0x41fd62[_0x717a('0x2b')]);_0x4913db['filters']=_[_0x717a('0x2d')](_0x4913db['model'],_0x4913db[_0x717a('0x2b')]);_0x3230d5[_0x717a('0x2e')]=_['intersection'](_0x4913db[_0x717a('0x31')],qs[_0x717a('0x2f')](_0x41fd62[_0x717a('0x2b')][_0x717a('0x2f')]));_0x3230d5[_0x717a('0x2e')]=_0x3230d5['attributes'][_0x717a('0x30')]?_0x3230d5[_0x717a('0x2e')]:_0x4913db['model'];if(!_0x41fd62[_0x717a('0x2b')][_0x717a('0x51')](_0x717a('0x32'))){_0x3230d5['limit']=qs[_0x717a('0x17')](_0x41fd62[_0x717a('0x2b')]['limit']);_0x3230d5[_0x717a('0x16')]=qs[_0x717a('0x16')](_0x41fd62[_0x717a('0x2b')]['offset']);}_0x3230d5[_0x717a('0x52')]=qs[_0x717a('0x33')](_0x41fd62[_0x717a('0x2b')][_0x717a('0x33')]);_0x3230d5[_0x717a('0x35')]=qs[_0x717a('0x2c')](_[_0x717a('0x53')](_0x41fd62[_0x717a('0x2b')],_0x4913db[_0x717a('0x2c')]));_0x3230d5[_0x717a('0x35')][_0x717a('0x54')]=_0xbc9021['id'];if(_0x41fd62[_0x717a('0x2b')][_0x717a('0x34')]){_0x3230d5[_0x717a('0x35')]=_[_0x717a('0x36')](_0x3230d5[_0x717a('0x35')],{'$or':_[_0x717a('0x26')](_0x3230d5[_0x717a('0x2e')],function(_0x5eb315){var _0x149e2f={};_0x149e2f[_0x5eb315]={'$like':'%'+_0x41fd62[_0x717a('0x2b')][_0x717a('0x34')]+'%'};return _0x149e2f;})});}_0x3230d5=_['merge']({},_0x3230d5,_0x41fd62[_0x717a('0x3f')]);return db[_0x717a('0x55')][_0x717a('0x18')]({'where':_0x3230d5[_0x717a('0x35')]})[_0x717a('0x1e')](function(_0x381e01){_0x40b95e[_0x717a('0x18')]=_0x381e01;if(_0x41fd62[_0x717a('0x2b')][_0x717a('0x38')]){_0x3230d5[_0x717a('0x39')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x717a('0x3a')](_0x3230d5);})['then'](function(_0x951dac){_0x40b95e[_0x717a('0x3b')]=_0x951dac;return _0x40b95e;});}})[_0x717a('0x1e')](respondWithFilteredResult(_0x3d09e5,_0x3230d5))[_0x717a('0x3c')](handleError(_0x3d09e5,null));};function char(_0x2162d8){return _0x717a('0x56')===typeof _0x2162d8?String[_0x717a('0x57')][_0x717a('0x1a')](null,arguments):_0x2162d8;}function needsEncapsulation(_0x5a7743){return!!_0x5a7743&&(_0x5a7743[_0x717a('0x58')]()[_0x717a('0x59')](char(0xd))>=0x0||_0x5a7743[_0x717a('0x58')]()[_0x717a('0x59')](char(0xa))>=0x0||_0x5a7743[_0x717a('0x58')]()['indexOf'](char(0x2c))>=0x0||_0x5a7743[_0x717a('0x58')]()[_0x717a('0x59')](char(0x22))>=0x0);}function encapsulate(_0x5d5e1e){var _0x17f574=char(0x22),_0x569d4e='\x5c'+char(0x22),_0x10bea3=_0x5d5e1e[_0x717a('0x58')]()[_0x717a('0x5a')](new RegExp(_0x17f574,'g'),_0x569d4e);return _0x17f574+_0x10bea3+_0x17f574;}exports[_0x717a('0x5b')]=function(_0xa3697d,_0x48c8b9,_0x44816a){var _0x2821cb,_0x381409;var _0x211fa2={'where':{'ProjectId':_0xa3697d['params']['id']}};if(_0xa3697d[_0x717a('0x2b')]['startTime']){_0x211fa2['where']['starttime']=JSON[_0x717a('0x5c')](_0xa3697d['query'][_0x717a('0x5d')]);}return db['JscriptySessionReport'][_0x717a('0x3a')](_0x211fa2)[_0x717a('0x1e')](handleEntityNotFound(_0x48c8b9,null))[_0x717a('0x1e')](function(_0x47660b){if(_0x47660b){_0x2821cb=_0x47660b;return db['JscriptyQuestionReport']['findAll']({'where':{'SessionId':{'$in':_[_0x717a('0x26')](_0x2821cb,'id')},'ProjectId':_0xa3697d[_0x717a('0x3e')]['id']},'order':_0x717a('0x5e')});}})[_0x717a('0x1e')](handleEntityNotFound(_0x48c8b9,null))['then'](function(_0x5229f7){if(_0x5229f7){_0x381409=_0x5229f7;var _0x6bbda6={};for(var _0xd21805=0x0,_0x892af9=_0x381409[_0x717a('0x30')];_0xd21805<_0x892af9;_0xd21805++){if(!_0x6bbda6[_0x717a('0x51')](_0x381409[_0xd21805][_0x717a('0x5f')])){_0x6bbda6[_0x381409[_0xd21805][_0x717a('0x5f')]]=needsEncapsulation(_0x381409[_0xd21805]['question'])?encapsulate(_0x381409[_0xd21805][_0x717a('0x60')]):_0x381409[_0xd21805][_0x717a('0x60')];}}var _0xa7076e=[],_0x53fc09={};for(var _0x33b670=0x0,_0x1c2959=_0x2821cb[_0x717a('0x30')];_0x33b670<_0x1c2959;_0x33b670++){_0x53fc09={'ProjectId':_0xa3697d[_0x717a('0x3e')]['id'],'SessionId':_0x2821cb[_0x33b670]['id'],'StartTime':moment(_0x2821cb[_0x33b670][_0x717a('0x61')])['format'](_0x717a('0x62'))};for(var _0x2e8366=0x0,_0x20bab6=_0x381409[_0x717a('0x30')];_0x2e8366<_0x20bab6;_0x2e8366++){if(_0x381409[_0x2e8366]['SessionId']==_0x2821cb[_0x33b670]['id']&&_0x6bbda6[_0x717a('0x51')](_0x381409[_0x2e8366][_0x717a('0x5f')])){_0x53fc09[_0x6bbda6[_0x381409[_0x2e8366][_0x717a('0x5f')]]]=_0x381409[_0x2e8366][_0x717a('0x63')];}}for(var _0x272c45 in _0x6bbda6){if(!_0x53fc09[_0x717a('0x51')](_0x6bbda6[_0x272c45])){_0x53fc09[_0x6bbda6[_0x272c45]]=null;}}_0xa7076e[_0x717a('0x64')](_0x53fc09);}return _0xa7076e;}})[_0x717a('0x1e')](function(_0x468877){if(!_['isEmpty'](_0x468877)){var _0xd55e70=toCsv(_0x468877);var _0x3d15f5=Date[_0x717a('0x65')]();fs[_0x717a('0x66')](util[_0x717a('0x67')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0xa3697d[_0x717a('0x3e')]['id'],_0x3d15f5),_0xd55e70);_0x48c8b9[_0x717a('0x68')](_0x717a('0x69'),_0x717a('0x6a')+util[_0x717a('0x67')]('Jscripty_Project_%d_Summary_%s.csv',_0xa3697d['params']['id'],_0x3d15f5));_0x48c8b9[_0x717a('0x68')](_0x717a('0x6b'),_0x717a('0x6c'));return _0x48c8b9['download'](util['format'](_0x717a('0x6d'),_0xa3697d[_0x717a('0x3e')]['id'],_0x3d15f5));}else{return _0x48c8b9[_0x717a('0x22')](0xcc);}})['catch'](handleError(_0x48c8b9,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index b3132ad..8fce948 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 _0x79d3=['JscriptyProject','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports'];(function(_0x2dda36,_0x9e119f){var _0x7ea2ee=function(_0x532bc9){while(--_0x532bc9){_0x2dda36['push'](_0x2dda36['shift']());}};_0x7ea2ee(++_0x9e119f);}(_0x79d3,0x15f));var _0x379d=function(_0x3b562e,_0x3c47de){_0x3b562e=_0x3b562e-0x0;var _0x43664d=_0x79d3[_0x3b562e];return _0x43664d;};'use strict';var _=require(_0x379d('0x0'));var util=require('util');var logger=require(_0x379d('0x1'))('api');var moment=require(_0x379d('0x2'));var BPromise=require(_0x379d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x379d('0x4'));var rimraf=require(_0x379d('0x5'));var config=require(_0x379d('0x6'));var attributes=require(_0x379d('0x7'));module[_0x379d('0x8')]=function(_0x2078a6,_0x2a1b43){return _0x2078a6['define'](_0x379d('0x9'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa992=['rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','jscripty_projects','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x4520b8,_0x12d8da){var _0x562bfb=function(_0x102227){while(--_0x102227){_0x4520b8['push'](_0x4520b8['shift']());}};_0x562bfb(++_0x12d8da);}(_0xa992,0x18c));var _0x2a99=function(_0x294f67,_0x1d346e){_0x294f67=_0x294f67-0x0;var _0x21f3bc=_0xa992[_0x294f67];return _0x21f3bc;};'use strict';var _=require(_0x2a99('0x0'));var util=require(_0x2a99('0x1'));var logger=require(_0x2a99('0x2'))(_0x2a99('0x3'));var moment=require('moment');var BPromise=require(_0x2a99('0x4'));var rp=require(_0x2a99('0x5'));var fs=require('fs');var path=require(_0x2a99('0x6'));var rimraf=require(_0x2a99('0x7'));var config=require(_0x2a99('0x8'));var attributes=require(_0x2a99('0x9'));module[_0x2a99('0xa')]=function(_0x90fbc9,_0x11c36a){return _0x90fbc9[_0x2a99('0xb')]('JscriptyProject',attributes,{'tableName':_0x2a99('0xc'),'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 5c451f0..de61915 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 _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x4bc4ed,_0x1104e2){var _0x29d570=function(_0xa709d){while(--_0xa709d){_0x4bc4ed['push'](_0x4bc4ed['shift']());}};_0x29d570(++_0x1104e2);}(_0xaa88,0x137));var _0x8aa8=function(_0x3f465d,_0xbd2037){_0x3f465d=_0x3f465d-0x0;var _0x121ad1=_0xaa88[_0x3f465d];return _0x121ad1;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file +var _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','JscriptyProject,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x177526,_0x44be73){var _0xfce16c=function(_0x54c843){while(--_0x54c843){_0x177526['push'](_0x177526['shift']());}};_0xfce16c(++_0x44be73);}(_0x9c44,0x178));var _0x49c4=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x9c44[_0x565c49];return _0x20ca34;};'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']('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('JscriptyProject,\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')]('JscriptyProject,\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')]('JscriptyProject,\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 diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 0c8d2f9..b8794c3 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 _0xb7bb=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','index','isAuthenticated','describe','/:id','create','put'];(function(_0x5d7eec,_0xd7e2d){var _0x307d85=function(_0x5cc484){while(--_0x5cc484){_0x5d7eec['push'](_0x5d7eec['shift']());}};_0x307d85(++_0xd7e2d);}(_0xb7bb,0x1bc));var _0xbb7b=function(_0x17911b,_0x5b782a){_0x17911b=_0x17911b-0x0;var _0xa05e78=_0xb7bb[_0x17911b];return _0xa05e78;};'use strict';var multer=require(_0xbb7b('0x0'));var util=require(_0xbb7b('0x1'));var path=require(_0xbb7b('0x2'));var timeout=require(_0xbb7b('0x3'));var express=require(_0xbb7b('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbb7b('0x5'));var interaction=require(_0xbb7b('0x6'));var config=require(_0xbb7b('0x7'));var controller=require(_0xbb7b('0x8'));router[_0xbb7b('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb7b('0xa')]);router[_0xbb7b('0x9')]('/describe',auth[_0xbb7b('0xb')](),controller[_0xbb7b('0xc')]);router['get'](_0xbb7b('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xbb7b('0xe')]);router[_0xbb7b('0xf')](_0xbb7b('0xd'),auth[_0xbb7b('0xb')](),controller[_0xbb7b('0x10')]);router[_0xbb7b('0x11')](_0xbb7b('0xd'),auth[_0xbb7b('0xb')](),controller[_0xbb7b('0x12')]);module[_0xbb7b('0x13')]=router; \ No newline at end of file +var _0xb4e9=['show','post','update','delete','destroy','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','describe','/:id'];(function(_0x526c3d,_0xaad2e){var _0x17f2ea=function(_0x44988d){while(--_0x44988d){_0x526c3d['push'](_0x526c3d['shift']());}};_0x17f2ea(++_0xaad2e);}(_0xb4e9,0x1d5));var _0x9b4e=function(_0x1635fe,_0x5f1d9f){_0x1635fe=_0x1635fe-0x0;var _0x3c512a=_0xb4e9[_0x1635fe];return _0x3c512a;};'use strict';var multer=require('multer');var util=require(_0x9b4e('0x0'));var path=require('path');var timeout=require(_0x9b4e('0x1'));var express=require('express');var router=express[_0x9b4e('0x2')]();var fs_extra=require(_0x9b4e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x9b4e('0x4'));var config=require(_0x9b4e('0x5'));var controller=require(_0x9b4e('0x6'));router[_0x9b4e('0x7')]('/',auth[_0x9b4e('0x8')](),controller['index']);router['get']('/describe',auth[_0x9b4e('0x8')](),controller[_0x9b4e('0x9')]);router['get'](_0x9b4e('0xa'),auth[_0x9b4e('0x8')](),controller[_0x9b4e('0xb')]);router[_0x9b4e('0xc')]('/',auth[_0x9b4e('0x8')](),controller['create']);router['put'](_0x9b4e('0xa'),auth[_0x9b4e('0x8')](),controller[_0x9b4e('0xd')]);router[_0x9b4e('0xe')]('/:id',auth[_0x9b4e('0x8')](),controller[_0x9b4e('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index d3dc5b5..dd5dc51 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(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x7a54,0x106));var _0x47a5=function(_0x420ec7,_0xec9dd4){_0x420ec7=_0x420ec7-0x0;var _0x2426ba=_0x7a54[_0x420ec7];return _0x2426ba;};'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(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x7a54,0x106));var _0x47a5=function(_0x2054fc,_0x2bc22c){_0x2054fc=_0x2054fc-0x0;var _0x33d52f=_0x7a54[_0x2054fc];return _0x33d52f;};'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 41c999d..78e6c49 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 _0xb00d=['options','includeAll','include','findAll','rows','show','params','keys','length','find','create','body','catch','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge'];(function(_0x416ad,_0x3797e5){var _0x160983=function(_0x1aa782){while(--_0x1aa782){_0x416ad['push'](_0x416ad['shift']());}};_0x160983(++_0x3797e5);}(_0xb00d,0x1d0));var _0xdb00=function(_0x903228,_0x42c429){_0x903228=_0x903228-0x0;var _0xcec81d=_0xb00d[_0x903228];return _0xcec81d;};'use strict';var emlformat=require(_0xdb00('0x0'));var rimraf=require(_0xdb00('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xdb00('0x2'));var moment=require(_0xdb00('0x3'));var BPromise=require(_0xdb00('0x4'));var Mustache=require(_0xdb00('0x5'));var util=require(_0xdb00('0x6'));var path=require('path');var sox=require(_0xdb00('0x7'));var csv=require(_0xdb00('0x8'));var ejs=require(_0xdb00('0x9'));var fs=require('fs');var fs_extra=require(_0xdb00('0xa'));var _=require(_0xdb00('0xb'));var squel=require(_0xdb00('0xc'));var crypto=require('crypto');var jsforce=require(_0xdb00('0xd'));var deskjs=require(_0xdb00('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xdb00('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdb00('0x10'));var logger=require(_0xdb00('0x11'))('api');var utils=require(_0xdb00('0x12'));var config=require(_0xdb00('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xdb00('0x14'))['db'];function respondWithStatusCode(_0x21d2f4,_0x4917c8){_0x4917c8=_0x4917c8||0xcc;return function(_0x17972b){if(_0x17972b){return _0x21d2f4[_0xdb00('0x15')](_0x4917c8);}return _0x21d2f4[_0xdb00('0x16')](_0x4917c8)[_0xdb00('0x17')]();};}function respondWithResult(_0xd7e154,_0x5df3b5){_0x5df3b5=_0x5df3b5||0xc8;return function(_0x36a845){if(_0x36a845){return _0xd7e154[_0xdb00('0x16')](_0x5df3b5)[_0xdb00('0x18')](_0x36a845);}};}function respondWithFilteredResult(_0x4a93ed,_0x297aa5){return function(_0x11ff0b){if(_0x11ff0b){var _0xd825f5=typeof _0x297aa5[_0xdb00('0x19')]===_0xdb00('0x1a')&&typeof _0x297aa5[_0xdb00('0x1b')]===_0xdb00('0x1a');var _0xb1c21c=_0x11ff0b[_0xdb00('0x1c')];var _0x2671e5=_0xd825f5?0x0:_0x297aa5['offset'];var _0x44a0d0=_0xd825f5?_0x11ff0b[_0xdb00('0x1c')]:_0x297aa5['offset']+_0x297aa5[_0xdb00('0x1b')];var _0x9eb8f1;if(_0x44a0d0>=_0xb1c21c){_0x44a0d0=_0xb1c21c;_0x9eb8f1=0xc8;}else{_0x9eb8f1=0xce;}_0x4a93ed[_0xdb00('0x16')](_0x9eb8f1);return _0x4a93ed['set'](_0xdb00('0x1d'),_0x2671e5+'-'+_0x44a0d0+'/'+_0xb1c21c)[_0xdb00('0x18')](_0x11ff0b);}return null;};}function patchUpdates(_0x35b578){return function(_0x5a4475){try{jsonpatch[_0xdb00('0x1e')](_0x5a4475,_0x35b578,!![]);}catch(_0x21769e){return BPromise[_0xdb00('0x1f')](_0x21769e);}return _0x5a4475[_0xdb00('0x20')]();};}function saveUpdates(_0x2a9569,_0x22070a){return function(_0x1ec9d2){if(_0x1ec9d2){return _0x1ec9d2[_0xdb00('0x21')](_0x2a9569)[_0xdb00('0x22')](function(_0x583369){return _0x583369;});}return null;};}function removeEntity(_0x29f5ce,_0x3807ae){return function(_0x328729){if(_0x328729){return _0x328729[_0xdb00('0x23')]()[_0xdb00('0x22')](function(){_0x29f5ce[_0xdb00('0x16')](0xcc)[_0xdb00('0x17')]();});}};}function handleEntityNotFound(_0x5e8040,_0x251980){return function(_0x34f4ec){if(!_0x34f4ec){_0x5e8040[_0xdb00('0x15')](0x194);}return _0x34f4ec;};}function handleError(_0x543550,_0x5ea341){_0x5ea341=_0x5ea341||0x1f4;return function(_0x1655b6){logger[_0xdb00('0x24')](_0x1655b6['stack']);if(_0x1655b6[_0xdb00('0x25')]){delete _0x1655b6[_0xdb00('0x25')];}_0x543550['status'](_0x5ea341)[_0xdb00('0x26')](_0x1655b6);};}exports[_0xdb00('0x27')]=function(_0x305275,_0x582b85){var _0x545a19={},_0x31b3a2={},_0x102982={'count':0x0,'rows':[]};var _0x34a041=_[_0xdb00('0x28')](db[_0xdb00('0x29')][_0xdb00('0x2a')],function(_0x5125ef){return{'name':_0x5125ef[_0xdb00('0x2b')],'type':_0x5125ef[_0xdb00('0x2c')][_0xdb00('0x2d')]};});_0x31b3a2[_0xdb00('0x2e')]=_[_0xdb00('0x28')](_0x34a041,_0xdb00('0x25'));_0x31b3a2[_0xdb00('0x2f')]=_['keys'](_0x305275[_0xdb00('0x2f')]);_0x31b3a2[_0xdb00('0x30')]=_[_0xdb00('0x31')](_0x31b3a2['model'],_0x31b3a2[_0xdb00('0x2f')]);_0x545a19['attributes']=_[_0xdb00('0x31')](_0x31b3a2[_0xdb00('0x2e')],qs[_0xdb00('0x32')](_0x305275[_0xdb00('0x2f')][_0xdb00('0x32')]));_0x545a19[_0xdb00('0x33')]=_0x545a19[_0xdb00('0x33')]['length']?_0x545a19[_0xdb00('0x33')]:_0x31b3a2['model'];if(!_0x305275['query'][_0xdb00('0x34')](_0xdb00('0x35'))){_0x545a19[_0xdb00('0x1b')]=qs[_0xdb00('0x1b')](_0x305275[_0xdb00('0x2f')][_0xdb00('0x1b')]);_0x545a19[_0xdb00('0x19')]=qs['offset'](_0x305275['query'][_0xdb00('0x19')]);}_0x545a19[_0xdb00('0x36')]=qs['sort'](_0x305275[_0xdb00('0x2f')][_0xdb00('0x37')]);_0x545a19[_0xdb00('0x38')]=qs[_0xdb00('0x30')](_[_0xdb00('0x39')](_0x305275['query'],_0x31b3a2[_0xdb00('0x30')]),_0x34a041);if(_0x305275[_0xdb00('0x2f')][_0xdb00('0x3a')]){_0x545a19[_0xdb00('0x38')]=_['merge'](_0x545a19['where'],{'$or':_[_0xdb00('0x28')](_0x34a041,function(_0x264e0c){if(_0x264e0c['type']!==_0xdb00('0x3b')){var _0x44d6ca={};_0x44d6ca[_0x264e0c['name']]={'$like':'%'+_0x305275[_0xdb00('0x2f')][_0xdb00('0x3a')]+'%'};return _0x44d6ca;}})});}_0x545a19=_[_0xdb00('0x3c')]({},_0x545a19,_0x305275[_0xdb00('0x3d')]);var _0x56bcce={'where':_0x545a19[_0xdb00('0x38')]};return db[_0xdb00('0x29')]['count'](_0x56bcce)[_0xdb00('0x22')](function(_0x46b49a){_0x102982[_0xdb00('0x1c')]=_0x46b49a;if(_0x305275['query'][_0xdb00('0x3e')]){_0x545a19[_0xdb00('0x3f')]=[{'all':!![]}];}return db[_0xdb00('0x29')][_0xdb00('0x40')](_0x545a19);})[_0xdb00('0x22')](function(_0x44512f){_0x102982[_0xdb00('0x41')]=_0x44512f;return _0x102982;})[_0xdb00('0x22')](respondWithFilteredResult(_0x582b85,_0x545a19))['catch'](handleError(_0x582b85,null));};exports[_0xdb00('0x42')]=function(_0x53b87c,_0x34996a){var _0x48fc1a={'raw':!![],'where':{'id':_0x53b87c[_0xdb00('0x43')]['id']}},_0x2b7134={};_0x2b7134['model']=_[_0xdb00('0x44')](db[_0xdb00('0x29')]['rawAttributes']);_0x2b7134[_0xdb00('0x2f')]=_['keys'](_0x53b87c['query']);_0x2b7134[_0xdb00('0x30')]=_['intersection'](_0x2b7134['model'],_0x2b7134['query']);_0x48fc1a['attributes']=_[_0xdb00('0x31')](_0x2b7134[_0xdb00('0x2e')],qs[_0xdb00('0x32')](_0x53b87c[_0xdb00('0x2f')][_0xdb00('0x32')]));_0x48fc1a[_0xdb00('0x33')]=_0x48fc1a[_0xdb00('0x33')][_0xdb00('0x45')]?_0x48fc1a[_0xdb00('0x33')]:_0x2b7134[_0xdb00('0x2e')];if(_0x53b87c[_0xdb00('0x2f')][_0xdb00('0x3e')]){_0x48fc1a['include']=[{'all':!![]}];}_0x48fc1a=_[_0xdb00('0x3c')]({},_0x48fc1a,_0x53b87c['options']);return db['JscriptyQuestionReport'][_0xdb00('0x46')](_0x48fc1a)[_0xdb00('0x22')](handleEntityNotFound(_0x34996a,null))['then'](respondWithResult(_0x34996a,null))['catch'](handleError(_0x34996a,null));};exports['create']=function(_0x178f0d,_0x9a3dea){return db[_0xdb00('0x29')][_0xdb00('0x47')](_0x178f0d[_0xdb00('0x48')],{})[_0xdb00('0x22')](respondWithResult(_0x9a3dea,0xc9))['catch'](handleError(_0x9a3dea,null));};exports[_0xdb00('0x21')]=function(_0x5834e4,_0x4e0786){if(_0x5834e4[_0xdb00('0x48')]['id']){delete _0x5834e4[_0xdb00('0x48')]['id'];}return db[_0xdb00('0x29')][_0xdb00('0x46')]({'where':{'id':_0x5834e4[_0xdb00('0x43')]['id']}})[_0xdb00('0x22')](handleEntityNotFound(_0x4e0786,null))['then'](saveUpdates(_0x5834e4[_0xdb00('0x48')],null))[_0xdb00('0x22')](respondWithResult(_0x4e0786,null))[_0xdb00('0x49')](handleError(_0x4e0786,null));};exports[_0xdb00('0x23')]=function(_0x39a4c4,_0x520f8b){return db[_0xdb00('0x29')][_0xdb00('0x46')]({'where':{'id':_0x39a4c4[_0xdb00('0x43')]['id']}})[_0xdb00('0x22')](handleEntityNotFound(_0x520f8b,null))['then'](removeEntity(_0x520f8b,null))[_0xdb00('0x49')](handleError(_0x520f8b,null));};exports[_0xdb00('0x4a')]=function(_0x2ee37e,_0x311faa){return db['JscriptyQuestionReport'][_0xdb00('0x4a')]()[_0xdb00('0x22')](respondWithResult(_0x311faa,null))[_0xdb00('0x49')](handleError(_0x311faa,null));}; \ No newline at end of file +var _0x1c5c=['to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','error','name','send','map','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','include','findAll','rows','show','params','JscriptyQuestionReport','rawAttributes','includeAll','options','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0x1c5c,0x1ae));var _0xc1c5=function(_0x3aaf56,_0x5744a8){_0x3aaf56=_0x3aaf56-0x0;var _0x58fcad=_0x1c5c[_0x3aaf56];return _0x58fcad;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc1c5('0x0'));var zipdir=require(_0xc1c5('0x1'));var jsonpatch=require(_0xc1c5('0x2'));var rp=require(_0xc1c5('0x3'));var moment=require(_0xc1c5('0x4'));var BPromise=require(_0xc1c5('0x5'));var Mustache=require(_0xc1c5('0x6'));var util=require('util');var path=require(_0xc1c5('0x7'));var sox=require('sox');var csv=require(_0xc1c5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc1c5('0x9'));var _=require(_0xc1c5('0xa'));var squel=require('squel');var crypto=require(_0xc1c5('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc1c5('0xc'));var toCsv=require(_0xc1c5('0x8'));var querystring=require(_0xc1c5('0xd'));var Papa=require(_0xc1c5('0xe'));var Redis=require('ioredis');var authService=require(_0xc1c5('0xf'));var qs=require(_0xc1c5('0x10'));var as=require(_0xc1c5('0x11'));var hardwareService=require(_0xc1c5('0x12'));var logger=require(_0xc1c5('0x13'))(_0xc1c5('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc1c5('0x15'));var db=require(_0xc1c5('0x16'))['db'];function respondWithStatusCode(_0x254915,_0xed820a){_0xed820a=_0xed820a||0xcc;return function(_0x5dca8b){if(_0x5dca8b){return _0x254915[_0xc1c5('0x17')](_0xed820a);}return _0x254915[_0xc1c5('0x18')](_0xed820a)[_0xc1c5('0x19')]();};}function respondWithResult(_0x259e06,_0x21c134){_0x21c134=_0x21c134||0xc8;return function(_0x3d7045){if(_0x3d7045){return _0x259e06[_0xc1c5('0x18')](_0x21c134)[_0xc1c5('0x1a')](_0x3d7045);}};}function respondWithFilteredResult(_0x472157,_0x1e44d3){return function(_0x4ac152){if(_0x4ac152){var _0x3e9f88=typeof _0x1e44d3['offset']===_0xc1c5('0x1b')&&typeof _0x1e44d3[_0xc1c5('0x1c')]==='undefined';var _0x1441dd=_0x4ac152['count'];var _0x2b44f8=_0x3e9f88?0x0:_0x1e44d3['offset'];var _0x4f2431=_0x3e9f88?_0x4ac152[_0xc1c5('0x1d')]:_0x1e44d3[_0xc1c5('0x1e')]+_0x1e44d3['limit'];var _0x395f86;if(_0x4f2431>=_0x1441dd){_0x4f2431=_0x1441dd;_0x395f86=0xc8;}else{_0x395f86=0xce;}_0x472157[_0xc1c5('0x18')](_0x395f86);return _0x472157[_0xc1c5('0x1f')](_0xc1c5('0x20'),_0x2b44f8+'-'+_0x4f2431+'/'+_0x1441dd)[_0xc1c5('0x1a')](_0x4ac152);}return null;};}function patchUpdates(_0x17fb96){return function(_0x4d0d4c){try{jsonpatch['apply'](_0x4d0d4c,_0x17fb96,!![]);}catch(_0x581b7c){return BPromise['reject'](_0x581b7c);}return _0x4d0d4c['save']();};}function saveUpdates(_0x4b8571,_0x1b3e93){return function(_0x164c51){if(_0x164c51){return _0x164c51[_0xc1c5('0x21')](_0x4b8571)[_0xc1c5('0x22')](function(_0x25f688){return _0x25f688;});}return null;};}function removeEntity(_0x3cb43f,_0x472096){return function(_0x278eec){if(_0x278eec){return _0x278eec[_0xc1c5('0x23')]()['then'](function(){_0x3cb43f[_0xc1c5('0x18')](0xcc)[_0xc1c5('0x19')]();});}};}function handleEntityNotFound(_0x506b3b,_0x52df7b){return function(_0x47a2b4){if(!_0x47a2b4){_0x506b3b[_0xc1c5('0x17')](0x194);}return _0x47a2b4;};}function handleError(_0x4d730e,_0x2bab13){_0x2bab13=_0x2bab13||0x1f4;return function(_0x1576e7){logger[_0xc1c5('0x24')](_0x1576e7['stack']);if(_0x1576e7['name']){delete _0x1576e7[_0xc1c5('0x25')];}_0x4d730e[_0xc1c5('0x18')](_0x2bab13)[_0xc1c5('0x26')](_0x1576e7);};}exports['index']=function(_0x2fd624,_0x418ba9){var _0x4f8580={},_0x2ca105={},_0x252512={'count':0x0,'rows':[]};var _0x4bfb17=_[_0xc1c5('0x27')](db['JscriptyQuestionReport']['rawAttributes'],function(_0x41d638){return{'name':_0x41d638[_0xc1c5('0x28')],'type':_0x41d638[_0xc1c5('0x29')][_0xc1c5('0x2a')]};});_0x2ca105[_0xc1c5('0x2b')]=_['map'](_0x4bfb17,'name');_0x2ca105['query']=_[_0xc1c5('0x2c')](_0x2fd624[_0xc1c5('0x2d')]);_0x2ca105['filters']=_[_0xc1c5('0x2e')](_0x2ca105[_0xc1c5('0x2b')],_0x2ca105[_0xc1c5('0x2d')]);_0x4f8580['attributes']=_[_0xc1c5('0x2e')](_0x2ca105[_0xc1c5('0x2b')],qs[_0xc1c5('0x2f')](_0x2fd624[_0xc1c5('0x2d')][_0xc1c5('0x2f')]));_0x4f8580['attributes']=_0x4f8580[_0xc1c5('0x30')][_0xc1c5('0x31')]?_0x4f8580[_0xc1c5('0x30')]:_0x2ca105[_0xc1c5('0x2b')];if(!_0x2fd624[_0xc1c5('0x2d')][_0xc1c5('0x32')](_0xc1c5('0x33'))){_0x4f8580[_0xc1c5('0x1c')]=qs[_0xc1c5('0x1c')](_0x2fd624[_0xc1c5('0x2d')][_0xc1c5('0x1c')]);_0x4f8580[_0xc1c5('0x1e')]=qs[_0xc1c5('0x1e')](_0x2fd624[_0xc1c5('0x2d')]['offset']);}_0x4f8580['order']=qs[_0xc1c5('0x34')](_0x2fd624[_0xc1c5('0x2d')][_0xc1c5('0x34')]);_0x4f8580[_0xc1c5('0x35')]=qs['filters'](_[_0xc1c5('0x36')](_0x2fd624['query'],_0x2ca105[_0xc1c5('0x37')]),_0x4bfb17);if(_0x2fd624[_0xc1c5('0x2d')][_0xc1c5('0x38')]){_0x4f8580[_0xc1c5('0x35')]=_[_0xc1c5('0x39')](_0x4f8580[_0xc1c5('0x35')],{'$or':_[_0xc1c5('0x27')](_0x4bfb17,function(_0x51f29c){if(_0x51f29c['type']!==_0xc1c5('0x3a')){var _0x344c67={};_0x344c67[_0x51f29c[_0xc1c5('0x25')]]={'$like':'%'+_0x2fd624[_0xc1c5('0x2d')][_0xc1c5('0x38')]+'%'};return _0x344c67;}})});}_0x4f8580=_['merge']({},_0x4f8580,_0x2fd624['options']);var _0x27e988={'where':_0x4f8580[_0xc1c5('0x35')]};return db['JscriptyQuestionReport']['count'](_0x27e988)[_0xc1c5('0x22')](function(_0x3e9a5e){_0x252512[_0xc1c5('0x1d')]=_0x3e9a5e;if(_0x2fd624['query']['includeAll']){_0x4f8580[_0xc1c5('0x3b')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xc1c5('0x3c')](_0x4f8580);})[_0xc1c5('0x22')](function(_0x15dcfd){_0x252512[_0xc1c5('0x3d')]=_0x15dcfd;return _0x252512;})['then'](respondWithFilteredResult(_0x418ba9,_0x4f8580))['catch'](handleError(_0x418ba9,null));};exports[_0xc1c5('0x3e')]=function(_0x44d8f2,_0x3724cb){var _0x3fb814={'raw':!![],'where':{'id':_0x44d8f2[_0xc1c5('0x3f')]['id']}},_0x476964={};_0x476964[_0xc1c5('0x2b')]=_[_0xc1c5('0x2c')](db[_0xc1c5('0x40')][_0xc1c5('0x41')]);_0x476964['query']=_[_0xc1c5('0x2c')](_0x44d8f2[_0xc1c5('0x2d')]);_0x476964[_0xc1c5('0x37')]=_[_0xc1c5('0x2e')](_0x476964[_0xc1c5('0x2b')],_0x476964[_0xc1c5('0x2d')]);_0x3fb814[_0xc1c5('0x30')]=_['intersection'](_0x476964['model'],qs[_0xc1c5('0x2f')](_0x44d8f2[_0xc1c5('0x2d')]['fields']));_0x3fb814['attributes']=_0x3fb814[_0xc1c5('0x30')][_0xc1c5('0x31')]?_0x3fb814['attributes']:_0x476964[_0xc1c5('0x2b')];if(_0x44d8f2[_0xc1c5('0x2d')][_0xc1c5('0x42')]){_0x3fb814[_0xc1c5('0x3b')]=[{'all':!![]}];}_0x3fb814=_[_0xc1c5('0x39')]({},_0x3fb814,_0x44d8f2[_0xc1c5('0x43')]);return db[_0xc1c5('0x40')][_0xc1c5('0x44')](_0x3fb814)[_0xc1c5('0x22')](handleEntityNotFound(_0x3724cb,null))[_0xc1c5('0x22')](respondWithResult(_0x3724cb,null))[_0xc1c5('0x45')](handleError(_0x3724cb,null));};exports[_0xc1c5('0x46')]=function(_0x544d51,_0x9d85e9){return db[_0xc1c5('0x40')]['create'](_0x544d51[_0xc1c5('0x47')],{})[_0xc1c5('0x22')](respondWithResult(_0x9d85e9,0xc9))[_0xc1c5('0x45')](handleError(_0x9d85e9,null));};exports[_0xc1c5('0x21')]=function(_0x214bc4,_0x35dd2e){if(_0x214bc4['body']['id']){delete _0x214bc4[_0xc1c5('0x47')]['id'];}return db[_0xc1c5('0x40')][_0xc1c5('0x44')]({'where':{'id':_0x214bc4[_0xc1c5('0x3f')]['id']}})['then'](handleEntityNotFound(_0x35dd2e,null))['then'](saveUpdates(_0x214bc4[_0xc1c5('0x47')],null))[_0xc1c5('0x22')](respondWithResult(_0x35dd2e,null))[_0xc1c5('0x45')](handleError(_0x35dd2e,null));};exports[_0xc1c5('0x23')]=function(_0xff4c8,_0xf4dfbb){return db[_0xc1c5('0x40')][_0xc1c5('0x44')]({'where':{'id':_0xff4c8[_0xc1c5('0x3f')]['id']}})[_0xc1c5('0x22')](handleEntityNotFound(_0xf4dfbb,null))[_0xc1c5('0x22')](removeEntity(_0xf4dfbb,null))[_0xc1c5('0x45')](handleError(_0xf4dfbb,null));};exports[_0xc1c5('0x48')]=function(_0x168e34,_0x13a117){return db[_0xc1c5('0x40')]['describe']()[_0xc1c5('0x22')](respondWithResult(_0x13a117,null))[_0xc1c5('0x45')](handleError(_0x13a117,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 26aa02c..874a1d6 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 _0xf351=['bluebird','request-promise','path','rimraf','./jscriptyQuestionReport.attributes','exports','JscriptyQuestionReport','report_jscripty_questions','lodash','../../config/logger','api'];(function(_0x5369a6,_0x421dcf){var _0x2cb6e2=function(_0x1d8991){while(--_0x1d8991){_0x5369a6['push'](_0x5369a6['shift']());}};_0x2cb6e2(++_0x421dcf);}(_0xf351,0xfa));var _0x1f35=function(_0x4521e3,_0x10a8a4){_0x4521e3=_0x4521e3-0x0;var _0x46a272=_0xf351[_0x4521e3];return _0x46a272;};'use strict';var _=require(_0x1f35('0x0'));var util=require('util');var logger=require(_0x1f35('0x1'))(_0x1f35('0x2'));var moment=require('moment');var BPromise=require(_0x1f35('0x3'));var rp=require(_0x1f35('0x4'));var fs=require('fs');var path=require(_0x1f35('0x5'));var rimraf=require(_0x1f35('0x6'));var config=require('../../config/environment');var attributes=require(_0x1f35('0x7'));module[_0x1f35('0x8')]=function(_0x21631e,_0x1f10d8){return _0x21631e['define'](_0x1f35('0x9'),attributes,{'tableName':_0x1f35('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeaa4=['bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api'];(function(_0x502b0c,_0x3b6b38){var _0x32b28a=function(_0x5dcc97){while(--_0x5dcc97){_0x502b0c['push'](_0x502b0c['shift']());}};_0x32b28a(++_0x3b6b38);}(_0xeaa4,0x141));var _0x4eaa=function(_0x149390,_0x5ad9ab){_0x149390=_0x149390-0x0;var _0x4e3597=_0xeaa4[_0x149390];return _0x4e3597;};'use strict';var _=require(_0x4eaa('0x0'));var util=require(_0x4eaa('0x1'));var logger=require(_0x4eaa('0x2'))(_0x4eaa('0x3'));var moment=require('moment');var BPromise=require(_0x4eaa('0x4'));var rp=require(_0x4eaa('0x5'));var fs=require('fs');var path=require(_0x4eaa('0x6'));var rimraf=require(_0x4eaa('0x7'));var config=require(_0x4eaa('0x8'));var attributes=require(_0x4eaa('0x9'));module['exports']=function(_0x557909,_0x36a16f){return _0x557909[_0x4eaa('0xa')](_0x4eaa('0xb'),attributes,{'tableName':_0x4eaa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index b1f3a37..33f498b 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 _0x704e=['jayson/promise','http','request','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3235a7,_0x24cb3b){var _0x56d0b5=function(_0x3c4e91){while(--_0x3c4e91){_0x3235a7['push'](_0x3235a7['shift']());}};_0x56d0b5(++_0x24cb3b);}(_0x704e,0x153));var _0xe704=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x704e[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xe704('0x0'));var util=require(_0xe704('0x1'));var moment=require(_0xe704('0x2'));var BPromise=require(_0xe704('0x3'));var rs=require(_0xe704('0x4'));var fs=require('fs');var Redis=require(_0xe704('0x5'));var db=require(_0xe704('0x6'))['db'];var utils=require(_0xe704('0x7'));var logger=require(_0xe704('0x8'))(_0xe704('0x9'));var config=require(_0xe704('0xa'));var jayson=require(_0xe704('0xb'));var client=jayson['client'][_0xe704('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5dbb74,_0x2a9c26,_0x4231a4){return new BPromise(function(_0x5cb29d,_0x53314e){return client[_0xe704('0xd')](_0x5dbb74,_0x4231a4)[_0xe704('0xe')](function(_0x15fbeb){logger['info'](_0xe704('0xf'),_0x2a9c26,_0xe704('0x10'));logger[_0xe704('0x11')](_0xe704('0x12'),_0x2a9c26,_0xe704('0x10'),JSON[_0xe704('0x13')](_0x15fbeb));if(_0x15fbeb['error']){if(_0x15fbeb[_0xe704('0x14')][_0xe704('0x15')]===0x1f4){logger[_0xe704('0x14')](_0xe704('0xf'),_0x2a9c26,_0x15fbeb['error'][_0xe704('0x16')]);return _0x53314e(_0x15fbeb[_0xe704('0x14')]['message']);}logger[_0xe704('0x14')](_0xe704('0xf'),_0x2a9c26,_0x15fbeb[_0xe704('0x14')][_0xe704('0x16')]);return _0x5cb29d(_0x15fbeb[_0xe704('0x14')]['message']);}else{logger['info'](_0xe704('0xf'),_0x2a9c26,'request\x20sent');_0x5cb29d(_0x15fbeb[_0xe704('0x17')][_0xe704('0x16')]);}})[_0xe704('0x18')](function(_0x573367){logger[_0xe704('0x14')](_0xe704('0xf'),_0x2a9c26,_0x573367);_0x53314e(_0x573367);});});} \ No newline at end of file +var _0x87ae=['debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','JscriptyQuestionReport,\x20%s,\x20%s','info','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x87ae,0x179));var _0xe87a=function(_0x355ce8,_0x5f1d0a){_0x355ce8=_0x355ce8-0x0;var _0x1db8b8=_0x87ae[_0x355ce8];return _0x1db8b8;};'use strict';var _=require(_0xe87a('0x0'));var util=require(_0xe87a('0x1'));var moment=require('moment');var BPromise=require(_0xe87a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe87a('0x3'));var db=require(_0xe87a('0x4'))['db'];var utils=require(_0xe87a('0x5'));var logger=require('../../config/logger')(_0xe87a('0x6'));var config=require(_0xe87a('0x7'));var jayson=require(_0xe87a('0x8'));var client=jayson[_0xe87a('0x9')][_0xe87a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d0647,_0x5d8de8,_0x56edd0){return new BPromise(function(_0x2a82e0,_0x39b04e){return client[_0xe87a('0xb')](_0x5d0647,_0x56edd0)[_0xe87a('0xc')](function(_0x333300){logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x5d8de8,_0xe87a('0xd'));logger[_0xe87a('0xe')](_0xe87a('0xf'),_0x5d8de8,_0xe87a('0xd'),JSON[_0xe87a('0x10')](_0x333300));if(_0x333300['error']){if(_0x333300['error']['code']===0x1f4){logger[_0xe87a('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x5d8de8,_0x333300[_0xe87a('0x11')]['message']);return _0x39b04e(_0x333300[_0xe87a('0x11')][_0xe87a('0x12')]);}logger[_0xe87a('0x11')](_0xe87a('0x13'),_0x5d8de8,_0x333300[_0xe87a('0x11')][_0xe87a('0x12')]);return _0x2a82e0(_0x333300[_0xe87a('0x11')][_0xe87a('0x12')]);}else{logger[_0xe87a('0x14')](_0xe87a('0x13'),_0x5d8de8,_0xe87a('0xd'));_0x2a82e0(_0x333300[_0xe87a('0x15')][_0xe87a('0x12')]);}})[_0xe87a('0x16')](function(_0x55fd06){logger['error'](_0xe87a('0x13'),_0x5d8de8,_0x55fd06);_0x39b04e(_0x55fd06);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 2201b3e..8ae47e9 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 _0xc480=['exports','multer','util','express','Router','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','get','/describe','describe','/:id','isAuthenticated','/:id/questions','getQuestions','post','create','update','delete'];(function(_0x2abae9,_0x3f0aa5){var _0x4cf95d=function(_0x44ad17){while(--_0x44ad17){_0x2abae9['push'](_0x2abae9['shift']());}};_0x4cf95d(++_0x3f0aa5);}(_0xc480,0xf8));var _0x0c48=function(_0x297cbc,_0x47a15c){_0x297cbc=_0x297cbc-0x0;var _0x285d81=_0xc480[_0x297cbc];return _0x285d81;};'use strict';var multer=require(_0x0c48('0x0'));var util=require(_0x0c48('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0c48('0x2'));var router=express[_0x0c48('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0c48('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0c48('0x5'));var controller=require(_0x0c48('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x0c48('0x7')](_0x0c48('0x8'),auth['isAuthenticated'](),controller[_0x0c48('0x9')]);router['get'](_0x0c48('0xa'),auth[_0x0c48('0xb')](),controller['show']);router[_0x0c48('0x7')](_0x0c48('0xc'),auth[_0x0c48('0xb')](),controller[_0x0c48('0xd')]);router[_0x0c48('0xe')]('/',auth[_0x0c48('0xb')](),controller[_0x0c48('0xf')]);router['put']('/:id',auth[_0x0c48('0xb')](),controller[_0x0c48('0x10')]);router[_0x0c48('0x11')](_0x0c48('0xa'),auth[_0x0c48('0xb')](),controller['destroy']);module[_0x0c48('0x12')]=router; \ No newline at end of file +var _0x41c2=['get','isAuthenticated','index','describe','/:id','show','/:id/questions','getQuestions','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0x41c2,0x168));var _0x241c=function(_0x315f83,_0x4d1c97){_0x315f83=_0x315f83-0x0;var _0x32c01f=_0x41c2[_0x315f83];return _0x32c01f;};'use strict';var multer=require('multer');var util=require(_0x241c('0x0'));var path=require(_0x241c('0x1'));var timeout=require(_0x241c('0x2'));var express=require('express');var router=express[_0x241c('0x3')]();var fs_extra=require(_0x241c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x241c('0x5'));var config=require(_0x241c('0x6'));var controller=require(_0x241c('0x7'));router[_0x241c('0x8')]('/',auth[_0x241c('0x9')](),controller[_0x241c('0xa')]);router[_0x241c('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x241c('0xb')]);router['get'](_0x241c('0xc'),auth[_0x241c('0x9')](),controller[_0x241c('0xd')]);router[_0x241c('0x8')](_0x241c('0xe'),auth[_0x241c('0x9')](),controller[_0x241c('0xf')]);router[_0x241c('0x10')]('/',auth[_0x241c('0x9')](),controller[_0x241c('0x11')]);router[_0x241c('0x12')](_0x241c('0xc'),auth[_0x241c('0x9')](),controller[_0x241c('0x13')]);router[_0x241c('0x14')](_0x241c('0xc'),auth[_0x241c('0x9')](),controller[_0x241c('0x15')]);module[_0x241c('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index f6ff671..4468320 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 _0x7510=['BOOLEAN','sequelize','DATE','setDataValue','endtime','format','STRING'];(function(_0x559528,_0x455857){var _0x567e33=function(_0xbc0b9f){while(--_0xbc0b9f){_0x559528['push'](_0x559528['shift']());}};_0x567e33(++_0x455857);}(_0x7510,0xa9));var _0x0751=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x7510[_0x432682];return _0x463d05;};'use strict';var moment=require('moment');var Sequelize=require(_0x0751('0x0'));module['exports']={'starttime':{'type':Sequelize[_0x0751('0x1')],'set':function(_0x396647){this[_0x0751('0x2')]('starttime',_0x396647);this[_0x0751('0x2')](_0x0751('0x3'),moment()[_0x0751('0x4')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x0751('0x5')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0751('0x5')]},'calleridnum':{'type':Sequelize[_0x0751('0x5')]},'completed':{'type':Sequelize[_0x0751('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x4134=['BOOLEAN','moment','sequelize','exports','DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING'];(function(_0xe03f16,_0x1a210b){var _0x4d76b5=function(_0x47dec3){while(--_0x47dec3){_0xe03f16['push'](_0xe03f16['shift']());}};_0x4d76b5(++_0x1a210b);}(_0x4134,0x114));var _0x4413=function(_0x43f20a,_0x404ef4){_0x43f20a=_0x43f20a-0x0;var _0x416ea5=_0x4134[_0x43f20a];return _0x416ea5;};'use strict';var moment=require(_0x4413('0x0'));var Sequelize=require(_0x4413('0x1'));module[_0x4413('0x2')]={'starttime':{'type':Sequelize[_0x4413('0x3')],'set':function(_0x23f7a9){this[_0x4413('0x4')](_0x4413('0x5'),_0x23f7a9);this[_0x4413('0x4')](_0x4413('0x6'),moment()[_0x4413('0x7')](_0x4413('0x8')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0x4413('0x9')]},'projectname':{'type':Sequelize[_0x4413('0x9')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x4413('0x9')]},'calleridname':{'type':Sequelize[_0x4413('0x9')]},'calleridnum':{'type':Sequelize[_0x4413('0x9')]},'completed':{'type':Sequelize[_0x4413('0xa')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 7d6b7be..b84ac7d 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 _0xdd70=['ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','sendStatus','error','stack','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','model','name','query','keys','filters','attributes','intersection','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','length','find','body','describe','findOne','hasOwnProperty','order','SessionId','JscriptyQuestionReport','rows','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv'];(function(_0x5117c7,_0x2e3b65){var _0x249e8f=function(_0x89f6cc){while(--_0x89f6cc){_0x5117c7['push'](_0x5117c7['shift']());}};_0x249e8f(++_0x2e3b65);}(_0xdd70,0x1d0));var _0x0dd7=function(_0x13dd39,_0x3d1a69){_0x13dd39=_0x13dd39-0x0;var _0x3bac4d=_0xdd70[_0x13dd39];return _0x3bac4d;};'use strict';var emlformat=require(_0x0dd7('0x0'));var rimraf=require(_0x0dd7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0dd7('0x2'));var rp=require(_0x0dd7('0x3'));var moment=require(_0x0dd7('0x4'));var BPromise=require(_0x0dd7('0x5'));var Mustache=require(_0x0dd7('0x6'));var util=require(_0x0dd7('0x7'));var path=require(_0x0dd7('0x8'));var sox=require('sox');var csv=require(_0x0dd7('0x9'));var ejs=require(_0x0dd7('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0dd7('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0dd7('0xc'));var deskjs=require(_0x0dd7('0xd'));var toCsv=require(_0x0dd7('0x9'));var querystring=require(_0x0dd7('0xe'));var Papa=require('papaparse');var Redis=require(_0x0dd7('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0dd7('0x10'));var as=require(_0x0dd7('0x11'));var hardwareService=require(_0x0dd7('0x12'));var logger=require('../../config/logger')(_0x0dd7('0x13'));var utils=require(_0x0dd7('0x14'));var config=require(_0x0dd7('0x15'));var licenseUtil=require(_0x0dd7('0x16'));var db=require(_0x0dd7('0x17'))['db'];function respondWithStatusCode(_0x5dbf14,_0x3692bd){_0x3692bd=_0x3692bd||0xcc;return function(_0x26a3d0){if(_0x26a3d0){return _0x5dbf14['sendStatus'](_0x3692bd);}return _0x5dbf14[_0x0dd7('0x18')](_0x3692bd)[_0x0dd7('0x19')]();};}function respondWithResult(_0x3e4d14,_0x554042){_0x554042=_0x554042||0xc8;return function(_0x23574c){if(_0x23574c){return _0x3e4d14[_0x0dd7('0x18')](_0x554042)[_0x0dd7('0x1a')](_0x23574c);}};}function respondWithFilteredResult(_0x57568e,_0x3b166b){return function(_0x5af10d){if(_0x5af10d){var _0x573de3=typeof _0x3b166b[_0x0dd7('0x1b')]===_0x0dd7('0x1c')&&typeof _0x3b166b[_0x0dd7('0x1d')]==='undefined';var _0xe8fa89=_0x5af10d[_0x0dd7('0x1e')];var _0x27520b=_0x573de3?0x0:_0x3b166b[_0x0dd7('0x1b')];var _0x19a02d=_0x573de3?_0x5af10d[_0x0dd7('0x1e')]:_0x3b166b['offset']+_0x3b166b[_0x0dd7('0x1d')];var _0x224245;if(_0x19a02d>=_0xe8fa89){_0x19a02d=_0xe8fa89;_0x224245=0xc8;}else{_0x224245=0xce;}_0x57568e[_0x0dd7('0x18')](_0x224245);return _0x57568e['set']('Content-Range',_0x27520b+'-'+_0x19a02d+'/'+_0xe8fa89)[_0x0dd7('0x1a')](_0x5af10d);}return null;};}function patchUpdates(_0x2bd45f){return function(_0x1f4664){try{jsonpatch[_0x0dd7('0x1f')](_0x1f4664,_0x2bd45f,!![]);}catch(_0x3c3dab){return BPromise[_0x0dd7('0x20')](_0x3c3dab);}return _0x1f4664[_0x0dd7('0x21')]();};}function saveUpdates(_0x5b822c,_0x4fbaed){return function(_0x958f78){if(_0x958f78){return _0x958f78[_0x0dd7('0x22')](_0x5b822c)[_0x0dd7('0x23')](function(_0x16d0e6){return _0x16d0e6;});}return null;};}function removeEntity(_0x3bc79d,_0x221c3b){return function(_0x15103b){if(_0x15103b){return _0x15103b[_0x0dd7('0x24')]()[_0x0dd7('0x23')](function(){_0x3bc79d[_0x0dd7('0x18')](0xcc)[_0x0dd7('0x19')]();});}};}function handleEntityNotFound(_0xc74239,_0x38e92e){return function(_0x568b03){if(!_0x568b03){_0xc74239[_0x0dd7('0x25')](0x194);}return _0x568b03;};}function handleError(_0x456989,_0x3bd24e){_0x3bd24e=_0x3bd24e||0x1f4;return function(_0x547bd2){logger[_0x0dd7('0x26')](_0x547bd2[_0x0dd7('0x27')]);if(_0x547bd2['name']){delete _0x547bd2['name'];}_0x456989[_0x0dd7('0x18')](_0x3bd24e)[_0x0dd7('0x28')](_0x547bd2);};}exports[_0x0dd7('0x29')]=function(_0x4e1c03,_0x3205ab){var _0x51267a={},_0x5d7b9c={},_0x51ebee={'count':0x0,'rows':[]};var _0x5dc8cc=_[_0x0dd7('0x2a')](db[_0x0dd7('0x2b')][_0x0dd7('0x2c')],function(_0x3f2458){return{'name':_0x3f2458[_0x0dd7('0x2d')],'type':_0x3f2458[_0x0dd7('0x2e')]['key']};});_0x5d7b9c[_0x0dd7('0x2f')]=_[_0x0dd7('0x2a')](_0x5dc8cc,_0x0dd7('0x30'));_0x5d7b9c[_0x0dd7('0x31')]=_[_0x0dd7('0x32')](_0x4e1c03[_0x0dd7('0x31')]);_0x5d7b9c[_0x0dd7('0x33')]=_['intersection'](_0x5d7b9c[_0x0dd7('0x2f')],_0x5d7b9c['query']);_0x51267a[_0x0dd7('0x34')]=_[_0x0dd7('0x35')](_0x5d7b9c[_0x0dd7('0x2f')],qs[_0x0dd7('0x36')](_0x4e1c03['query'][_0x0dd7('0x36')]));_0x51267a['attributes']=_0x51267a[_0x0dd7('0x34')]['length']?_0x51267a[_0x0dd7('0x34')]:_0x5d7b9c[_0x0dd7('0x2f')];if(!_0x4e1c03['query']['hasOwnProperty'](_0x0dd7('0x37'))){_0x51267a[_0x0dd7('0x1d')]=qs[_0x0dd7('0x1d')](_0x4e1c03[_0x0dd7('0x31')][_0x0dd7('0x1d')]);_0x51267a[_0x0dd7('0x1b')]=qs[_0x0dd7('0x1b')](_0x4e1c03[_0x0dd7('0x31')][_0x0dd7('0x1b')]);}_0x51267a['order']=qs[_0x0dd7('0x38')](_0x4e1c03['query'][_0x0dd7('0x38')]);_0x51267a[_0x0dd7('0x39')]=qs[_0x0dd7('0x33')](_[_0x0dd7('0x3a')](_0x4e1c03['query'],_0x5d7b9c[_0x0dd7('0x33')]),_0x5dc8cc);if(_0x4e1c03[_0x0dd7('0x31')][_0x0dd7('0x3b')]){_0x51267a['where']=_[_0x0dd7('0x3c')](_0x51267a[_0x0dd7('0x39')],{'$or':_[_0x0dd7('0x2a')](_0x5dc8cc,function(_0x1770a9){if(_0x1770a9[_0x0dd7('0x2e')]!==_0x0dd7('0x3d')){var _0x92ff11={};_0x92ff11[_0x1770a9[_0x0dd7('0x30')]]={'$like':'%'+_0x4e1c03[_0x0dd7('0x31')]['filter']+'%'};return _0x92ff11;}})});}_0x51267a=_[_0x0dd7('0x3c')]({},_0x51267a,_0x4e1c03[_0x0dd7('0x3e')]);var _0x441523={'where':_0x51267a[_0x0dd7('0x39')]};return db[_0x0dd7('0x2b')][_0x0dd7('0x1e')](_0x441523)[_0x0dd7('0x23')](function(_0x28a8f2){_0x51ebee[_0x0dd7('0x1e')]=_0x28a8f2;if(_0x4e1c03[_0x0dd7('0x31')][_0x0dd7('0x3f')]){_0x51267a[_0x0dd7('0x40')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0dd7('0x41')](_0x51267a);})[_0x0dd7('0x23')](function(_0x3cab25){_0x51ebee['rows']=_0x3cab25;return _0x51ebee;})[_0x0dd7('0x23')](respondWithFilteredResult(_0x3205ab,_0x51267a))[_0x0dd7('0x42')](handleError(_0x3205ab,null));};exports[_0x0dd7('0x43')]=function(_0x1f8144,_0x4a4224){var _0x2a51a8={'raw':!![],'where':{'id':_0x1f8144[_0x0dd7('0x44')]['id']}},_0x18f0ed={};_0x18f0ed[_0x0dd7('0x2f')]=_['keys'](db[_0x0dd7('0x2b')]['rawAttributes']);_0x18f0ed[_0x0dd7('0x31')]=_[_0x0dd7('0x32')](_0x1f8144[_0x0dd7('0x31')]);_0x18f0ed[_0x0dd7('0x33')]=_[_0x0dd7('0x35')](_0x18f0ed[_0x0dd7('0x2f')],_0x18f0ed[_0x0dd7('0x31')]);_0x2a51a8[_0x0dd7('0x34')]=_['intersection'](_0x18f0ed['model'],qs['fields'](_0x1f8144[_0x0dd7('0x31')][_0x0dd7('0x36')]));_0x2a51a8['attributes']=_0x2a51a8[_0x0dd7('0x34')][_0x0dd7('0x45')]?_0x2a51a8['attributes']:_0x18f0ed[_0x0dd7('0x2f')];if(_0x1f8144[_0x0dd7('0x31')][_0x0dd7('0x3f')]){_0x2a51a8[_0x0dd7('0x40')]=[{'all':!![]}];}_0x2a51a8=_['merge']({},_0x2a51a8,_0x1f8144['options']);return db[_0x0dd7('0x2b')][_0x0dd7('0x46')](_0x2a51a8)[_0x0dd7('0x23')](handleEntityNotFound(_0x4a4224,null))['then'](respondWithResult(_0x4a4224,null))[_0x0dd7('0x42')](handleError(_0x4a4224,null));};exports['create']=function(_0x3f21cb,_0x551b36){return db['JscriptySessionReport']['create'](_0x3f21cb['body'],{})[_0x0dd7('0x23')](respondWithResult(_0x551b36,0xc9))[_0x0dd7('0x42')](handleError(_0x551b36,null));};exports[_0x0dd7('0x22')]=function(_0x484371,_0x7fc6ae){if(_0x484371[_0x0dd7('0x47')]['id']){delete _0x484371[_0x0dd7('0x47')]['id'];}return db[_0x0dd7('0x2b')]['find']({'where':{'id':_0x484371[_0x0dd7('0x44')]['id']}})[_0x0dd7('0x23')](handleEntityNotFound(_0x7fc6ae,null))[_0x0dd7('0x23')](saveUpdates(_0x484371[_0x0dd7('0x47')],null))[_0x0dd7('0x23')](respondWithResult(_0x7fc6ae,null))[_0x0dd7('0x42')](handleError(_0x7fc6ae,null));};exports[_0x0dd7('0x24')]=function(_0x495c2b,_0x597046){return db[_0x0dd7('0x2b')]['find']({'where':{'id':_0x495c2b[_0x0dd7('0x44')]['id']}})[_0x0dd7('0x23')](handleEntityNotFound(_0x597046,null))['then'](removeEntity(_0x597046,null))[_0x0dd7('0x42')](handleError(_0x597046,null));};exports[_0x0dd7('0x48')]=function(_0x544e75,_0x4a4768){return db[_0x0dd7('0x2b')][_0x0dd7('0x48')]()[_0x0dd7('0x23')](respondWithResult(_0x4a4768,null))[_0x0dd7('0x42')](handleError(_0x4a4768,null));};exports['getQuestions']=function(_0x4fb28c,_0x1fa6fc,_0x3916c2){var _0x5d58b7={'raw':!![],'where':{}};var _0x35f568={};var _0x2b7962={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x0dd7('0x49')]({'where':{'id':_0x4fb28c['params']['id']}})[_0x0dd7('0x23')](handleEntityNotFound(_0x1fa6fc,null))['then'](function(_0x37e870){if(_0x37e870){_0x35f568[_0x0dd7('0x2f')]=_[_0x0dd7('0x32')](db['JscriptyQuestionReport']['rawAttributes']);_0x35f568[_0x0dd7('0x31')]=_[_0x0dd7('0x32')](_0x4fb28c[_0x0dd7('0x31')]);_0x35f568['filters']=_[_0x0dd7('0x35')](_0x35f568['model'],_0x35f568[_0x0dd7('0x31')]);_0x5d58b7[_0x0dd7('0x34')]=_[_0x0dd7('0x35')](_0x35f568[_0x0dd7('0x2f')],qs[_0x0dd7('0x36')](_0x4fb28c[_0x0dd7('0x31')][_0x0dd7('0x36')]));_0x5d58b7[_0x0dd7('0x34')]=_0x5d58b7[_0x0dd7('0x34')]['length']?_0x5d58b7[_0x0dd7('0x34')]:_0x35f568[_0x0dd7('0x2f')];if(!_0x4fb28c['query'][_0x0dd7('0x4a')]('nolimit')){_0x5d58b7[_0x0dd7('0x1d')]=qs['limit'](_0x4fb28c[_0x0dd7('0x31')]['limit']);_0x5d58b7[_0x0dd7('0x1b')]=qs[_0x0dd7('0x1b')](_0x4fb28c[_0x0dd7('0x31')][_0x0dd7('0x1b')]);}_0x5d58b7[_0x0dd7('0x4b')]=qs['sort'](_0x4fb28c[_0x0dd7('0x31')][_0x0dd7('0x38')]);_0x5d58b7[_0x0dd7('0x39')]=qs[_0x0dd7('0x33')](_['pick'](_0x4fb28c['query'],_0x35f568[_0x0dd7('0x33')]));_0x5d58b7[_0x0dd7('0x39')][_0x0dd7('0x4c')]=_0x37e870['id'];if(_0x4fb28c['query'][_0x0dd7('0x3b')]){_0x5d58b7[_0x0dd7('0x39')]=_[_0x0dd7('0x3c')](_0x5d58b7['where'],{'$or':_[_0x0dd7('0x2a')](_0x5d58b7[_0x0dd7('0x34')],function(_0x40fd70){var _0xb4a294={};_0xb4a294[_0x40fd70]={'$like':'%'+_0x4fb28c[_0x0dd7('0x31')][_0x0dd7('0x3b')]+'%'};return _0xb4a294;})});}_0x5d58b7=_[_0x0dd7('0x3c')]({},_0x5d58b7,_0x4fb28c[_0x0dd7('0x3e')]);return db[_0x0dd7('0x4d')]['count']({'where':_0x5d58b7[_0x0dd7('0x39')]})[_0x0dd7('0x23')](function(_0x175df6){_0x2b7962['count']=_0x175df6;if(_0x4fb28c['query']['includeAll']){_0x5d58b7[_0x0dd7('0x40')]=[{'all':!![]}];}return db[_0x0dd7('0x4d')][_0x0dd7('0x41')](_0x5d58b7);})['then'](function(_0x588e47){_0x2b7962[_0x0dd7('0x4e')]=_0x588e47;return _0x2b7962;});}})[_0x0dd7('0x23')](respondWithFilteredResult(_0x1fa6fc,_0x5d58b7))['catch'](handleError(_0x1fa6fc,null));}; \ No newline at end of file +var _0x10e6=['nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','getQuestions','findOne','order','SessionId','JscriptyQuestionReport','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','update','destroy','then','error','stack','name','send','index','JscriptySessionReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0x10e6,0x1ac));var _0x610e=function(_0x2dc343,_0xf015a2){_0x2dc343=_0x2dc343-0x0;var _0x51eac5=_0x10e6[_0x2dc343];return _0x51eac5;};'use strict';var emlformat=require(_0x610e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x610e('0x1'));var jsonpatch=require(_0x610e('0x2'));var rp=require(_0x610e('0x3'));var moment=require(_0x610e('0x4'));var BPromise=require(_0x610e('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x610e('0x6'));var sox=require(_0x610e('0x7'));var csv=require(_0x610e('0x8'));var ejs=require(_0x610e('0x9'));var fs=require('fs');var fs_extra=require(_0x610e('0xa'));var _=require('lodash');var squel=require(_0x610e('0xb'));var crypto=require(_0x610e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x610e('0xd'));var toCsv=require(_0x610e('0x8'));var querystring=require(_0x610e('0xe'));var Papa=require(_0x610e('0xf'));var Redis=require(_0x610e('0x10'));var authService=require(_0x610e('0x11'));var qs=require(_0x610e('0x12'));var as=require(_0x610e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x610e('0x14'))(_0x610e('0x15'));var utils=require('../../config/utils');var config=require(_0x610e('0x16'));var licenseUtil=require(_0x610e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2fefa7,_0x2ee1c7){_0x2ee1c7=_0x2ee1c7||0xcc;return function(_0x170538){if(_0x170538){return _0x2fefa7[_0x610e('0x18')](_0x2ee1c7);}return _0x2fefa7[_0x610e('0x19')](_0x2ee1c7)[_0x610e('0x1a')]();};}function respondWithResult(_0xe13d0d,_0x9fe312){_0x9fe312=_0x9fe312||0xc8;return function(_0x3c6748){if(_0x3c6748){return _0xe13d0d[_0x610e('0x19')](_0x9fe312)[_0x610e('0x1b')](_0x3c6748);}};}function respondWithFilteredResult(_0x440704,_0x35fe24){return function(_0x20864d){if(_0x20864d){var _0x186bd1=typeof _0x35fe24[_0x610e('0x1c')]==='undefined'&&typeof _0x35fe24[_0x610e('0x1d')]===_0x610e('0x1e');var _0x58f6ac=_0x20864d[_0x610e('0x1f')];var _0x3618db=_0x186bd1?0x0:_0x35fe24[_0x610e('0x1c')];var _0x1f4dc1=_0x186bd1?_0x20864d['count']:_0x35fe24[_0x610e('0x1c')]+_0x35fe24[_0x610e('0x1d')];var _0x1dac8f;if(_0x1f4dc1>=_0x58f6ac){_0x1f4dc1=_0x58f6ac;_0x1dac8f=0xc8;}else{_0x1dac8f=0xce;}_0x440704[_0x610e('0x19')](_0x1dac8f);return _0x440704[_0x610e('0x20')](_0x610e('0x21'),_0x3618db+'-'+_0x1f4dc1+'/'+_0x58f6ac)[_0x610e('0x1b')](_0x20864d);}return null;};}function patchUpdates(_0x283520){return function(_0x1270d9){try{jsonpatch['apply'](_0x1270d9,_0x283520,!![]);}catch(_0x1dc79e){return BPromise[_0x610e('0x22')](_0x1dc79e);}return _0x1270d9['save']();};}function saveUpdates(_0x5c3565,_0x46194c){return function(_0x653350){if(_0x653350){return _0x653350[_0x610e('0x23')](_0x5c3565)['then'](function(_0x3c733c){return _0x3c733c;});}return null;};}function removeEntity(_0x3fc778,_0x54c39b){return function(_0x2df6b5){if(_0x2df6b5){return _0x2df6b5[_0x610e('0x24')]()[_0x610e('0x25')](function(){_0x3fc778[_0x610e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23fe97,_0x296df8){return function(_0x59e60c){if(!_0x59e60c){_0x23fe97[_0x610e('0x18')](0x194);}return _0x59e60c;};}function handleError(_0x3aa37c,_0x94acdb){_0x94acdb=_0x94acdb||0x1f4;return function(_0x95632f){logger[_0x610e('0x26')](_0x95632f[_0x610e('0x27')]);if(_0x95632f[_0x610e('0x28')]){delete _0x95632f[_0x610e('0x28')];}_0x3aa37c[_0x610e('0x19')](_0x94acdb)[_0x610e('0x29')](_0x95632f);};}exports[_0x610e('0x2a')]=function(_0x16aafe,_0x2391b8){var _0x1baa18={},_0x5c0a0e={},_0x15ccbf={'count':0x0,'rows':[]};var _0x1413aa=_['map'](db[_0x610e('0x2b')][_0x610e('0x2c')],function(_0x5f44c2){return{'name':_0x5f44c2[_0x610e('0x2d')],'type':_0x5f44c2[_0x610e('0x2e')][_0x610e('0x2f')]};});_0x5c0a0e[_0x610e('0x30')]=_[_0x610e('0x31')](_0x1413aa,_0x610e('0x28'));_0x5c0a0e[_0x610e('0x32')]=_[_0x610e('0x33')](_0x16aafe[_0x610e('0x32')]);_0x5c0a0e[_0x610e('0x34')]=_['intersection'](_0x5c0a0e[_0x610e('0x30')],_0x5c0a0e[_0x610e('0x32')]);_0x1baa18[_0x610e('0x35')]=_[_0x610e('0x36')](_0x5c0a0e[_0x610e('0x30')],qs['fields'](_0x16aafe['query'][_0x610e('0x37')]));_0x1baa18['attributes']=_0x1baa18['attributes'][_0x610e('0x38')]?_0x1baa18[_0x610e('0x35')]:_0x5c0a0e[_0x610e('0x30')];if(!_0x16aafe[_0x610e('0x32')][_0x610e('0x39')](_0x610e('0x3a'))){_0x1baa18['limit']=qs[_0x610e('0x1d')](_0x16aafe['query']['limit']);_0x1baa18[_0x610e('0x1c')]=qs[_0x610e('0x1c')](_0x16aafe[_0x610e('0x32')][_0x610e('0x1c')]);}_0x1baa18['order']=qs[_0x610e('0x3b')](_0x16aafe[_0x610e('0x32')][_0x610e('0x3b')]);_0x1baa18[_0x610e('0x3c')]=qs['filters'](_[_0x610e('0x3d')](_0x16aafe[_0x610e('0x32')],_0x5c0a0e[_0x610e('0x34')]),_0x1413aa);if(_0x16aafe[_0x610e('0x32')][_0x610e('0x3e')]){_0x1baa18[_0x610e('0x3c')]=_[_0x610e('0x3f')](_0x1baa18[_0x610e('0x3c')],{'$or':_[_0x610e('0x31')](_0x1413aa,function(_0x354775){if(_0x354775['type']!=='VIRTUAL'){var _0x52a18e={};_0x52a18e[_0x354775[_0x610e('0x28')]]={'$like':'%'+_0x16aafe[_0x610e('0x32')][_0x610e('0x3e')]+'%'};return _0x52a18e;}})});}_0x1baa18=_[_0x610e('0x3f')]({},_0x1baa18,_0x16aafe[_0x610e('0x40')]);var _0x13138e={'where':_0x1baa18[_0x610e('0x3c')]};return db[_0x610e('0x2b')]['count'](_0x13138e)[_0x610e('0x25')](function(_0x1c0f75){_0x15ccbf[_0x610e('0x1f')]=_0x1c0f75;if(_0x16aafe[_0x610e('0x32')][_0x610e('0x41')]){_0x1baa18[_0x610e('0x42')]=[{'all':!![]}];}return db[_0x610e('0x2b')][_0x610e('0x43')](_0x1baa18);})[_0x610e('0x25')](function(_0x2a3db0){_0x15ccbf[_0x610e('0x44')]=_0x2a3db0;return _0x15ccbf;})['then'](respondWithFilteredResult(_0x2391b8,_0x1baa18))['catch'](handleError(_0x2391b8,null));};exports[_0x610e('0x45')]=function(_0x69aa3e,_0x5d58b1){var _0x5956d9={'raw':!![],'where':{'id':_0x69aa3e[_0x610e('0x46')]['id']}},_0x38d61c={};_0x38d61c[_0x610e('0x30')]=_['keys'](db[_0x610e('0x2b')][_0x610e('0x2c')]);_0x38d61c[_0x610e('0x32')]=_[_0x610e('0x33')](_0x69aa3e[_0x610e('0x32')]);_0x38d61c[_0x610e('0x34')]=_[_0x610e('0x36')](_0x38d61c['model'],_0x38d61c[_0x610e('0x32')]);_0x5956d9['attributes']=_[_0x610e('0x36')](_0x38d61c[_0x610e('0x30')],qs[_0x610e('0x37')](_0x69aa3e[_0x610e('0x32')][_0x610e('0x37')]));_0x5956d9[_0x610e('0x35')]=_0x5956d9[_0x610e('0x35')][_0x610e('0x38')]?_0x5956d9[_0x610e('0x35')]:_0x38d61c[_0x610e('0x30')];if(_0x69aa3e[_0x610e('0x32')][_0x610e('0x41')]){_0x5956d9[_0x610e('0x42')]=[{'all':!![]}];}_0x5956d9=_[_0x610e('0x3f')]({},_0x5956d9,_0x69aa3e[_0x610e('0x40')]);return db[_0x610e('0x2b')][_0x610e('0x47')](_0x5956d9)['then'](handleEntityNotFound(_0x5d58b1,null))['then'](respondWithResult(_0x5d58b1,null))[_0x610e('0x48')](handleError(_0x5d58b1,null));};exports[_0x610e('0x49')]=function(_0x247f08,_0x144ef1){return db[_0x610e('0x2b')][_0x610e('0x49')](_0x247f08[_0x610e('0x4a')],{})['then'](respondWithResult(_0x144ef1,0xc9))[_0x610e('0x48')](handleError(_0x144ef1,null));};exports['update']=function(_0xbbbd7c,_0x5ec41a){if(_0xbbbd7c[_0x610e('0x4a')]['id']){delete _0xbbbd7c[_0x610e('0x4a')]['id'];}return db[_0x610e('0x2b')][_0x610e('0x47')]({'where':{'id':_0xbbbd7c['params']['id']}})[_0x610e('0x25')](handleEntityNotFound(_0x5ec41a,null))[_0x610e('0x25')](saveUpdates(_0xbbbd7c[_0x610e('0x4a')],null))[_0x610e('0x25')](respondWithResult(_0x5ec41a,null))[_0x610e('0x48')](handleError(_0x5ec41a,null));};exports[_0x610e('0x24')]=function(_0x554215,_0x49343d){return db[_0x610e('0x2b')]['find']({'where':{'id':_0x554215['params']['id']}})[_0x610e('0x25')](handleEntityNotFound(_0x49343d,null))['then'](removeEntity(_0x49343d,null))[_0x610e('0x48')](handleError(_0x49343d,null));};exports[_0x610e('0x4b')]=function(_0x36e050,_0x4a0526){return db[_0x610e('0x2b')][_0x610e('0x4b')]()[_0x610e('0x25')](respondWithResult(_0x4a0526,null))[_0x610e('0x48')](handleError(_0x4a0526,null));};exports[_0x610e('0x4c')]=function(_0x11a657,_0x320b7d,_0x4083ae){var _0x340d03={'raw':!![],'where':{}};var _0xe5b21a={};var _0x59e7d8={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x610e('0x4d')]({'where':{'id':_0x11a657['params']['id']}})[_0x610e('0x25')](handleEntityNotFound(_0x320b7d,null))[_0x610e('0x25')](function(_0x4e732c){if(_0x4e732c){_0xe5b21a['model']=_[_0x610e('0x33')](db['JscriptyQuestionReport'][_0x610e('0x2c')]);_0xe5b21a[_0x610e('0x32')]=_['keys'](_0x11a657[_0x610e('0x32')]);_0xe5b21a[_0x610e('0x34')]=_[_0x610e('0x36')](_0xe5b21a['model'],_0xe5b21a[_0x610e('0x32')]);_0x340d03['attributes']=_['intersection'](_0xe5b21a[_0x610e('0x30')],qs[_0x610e('0x37')](_0x11a657['query']['fields']));_0x340d03['attributes']=_0x340d03[_0x610e('0x35')][_0x610e('0x38')]?_0x340d03[_0x610e('0x35')]:_0xe5b21a[_0x610e('0x30')];if(!_0x11a657['query'][_0x610e('0x39')](_0x610e('0x3a'))){_0x340d03[_0x610e('0x1d')]=qs[_0x610e('0x1d')](_0x11a657['query'][_0x610e('0x1d')]);_0x340d03[_0x610e('0x1c')]=qs['offset'](_0x11a657[_0x610e('0x32')][_0x610e('0x1c')]);}_0x340d03[_0x610e('0x4e')]=qs[_0x610e('0x3b')](_0x11a657[_0x610e('0x32')][_0x610e('0x3b')]);_0x340d03[_0x610e('0x3c')]=qs[_0x610e('0x34')](_['pick'](_0x11a657[_0x610e('0x32')],_0xe5b21a[_0x610e('0x34')]));_0x340d03[_0x610e('0x3c')][_0x610e('0x4f')]=_0x4e732c['id'];if(_0x11a657[_0x610e('0x32')][_0x610e('0x3e')]){_0x340d03[_0x610e('0x3c')]=_[_0x610e('0x3f')](_0x340d03[_0x610e('0x3c')],{'$or':_['map'](_0x340d03[_0x610e('0x35')],function(_0x41c737){var _0x36ec40={};_0x36ec40[_0x41c737]={'$like':'%'+_0x11a657['query'][_0x610e('0x3e')]+'%'};return _0x36ec40;})});}_0x340d03=_['merge']({},_0x340d03,_0x11a657[_0x610e('0x40')]);return db[_0x610e('0x50')][_0x610e('0x1f')]({'where':_0x340d03[_0x610e('0x3c')]})[_0x610e('0x25')](function(_0x106dae){_0x59e7d8[_0x610e('0x1f')]=_0x106dae;if(_0x11a657['query'][_0x610e('0x41')]){_0x340d03[_0x610e('0x42')]=[{'all':!![]}];}return db[_0x610e('0x50')]['findAll'](_0x340d03);})[_0x610e('0x25')](function(_0x54f772){_0x59e7d8[_0x610e('0x44')]=_0x54f772;return _0x59e7d8;});}})[_0x610e('0x25')](respondWithFilteredResult(_0x320b7d,_0x340d03))[_0x610e('0x48')](handleError(_0x320b7d,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index ad460c0..13ad3f5 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 _0x25fa=['path','./jscriptySessionReport.attributes','define','JscriptySessionReport','report_jscripty_sessions','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x2a5089,_0x481eaa){var _0x5be3a8=function(_0x10153){while(--_0x10153){_0x2a5089['push'](_0x2a5089['shift']());}};_0x5be3a8(++_0x481eaa);}(_0x25fa,0x109));var _0xa25f=function(_0x5e8f5c,_0x2d73cb){_0x5e8f5c=_0x5e8f5c-0x0;var _0x7f35b0=_0x25fa[_0x5e8f5c];return _0x7f35b0;};'use strict';var _=require(_0xa25f('0x0'));var util=require('util');var logger=require(_0xa25f('0x1'))(_0xa25f('0x2'));var moment=require('moment');var BPromise=require(_0xa25f('0x3'));var rp=require(_0xa25f('0x4'));var fs=require('fs');var path=require(_0xa25f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa25f('0x6'));module['exports']=function(_0x2ea9ea,_0x3ab530){return _0x2ea9ea[_0xa25f('0x7')](_0xa25f('0x8'),attributes,{'tableName':_0xa25f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x57ebed,_0xfac0ac){_0x57ebed=_0x57ebed-0x0;var _0x3a0874=_0x7fbe[_0x57ebed];return _0x3a0874;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'report_jscripty_sessions','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 e470e78..01591de 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 _0x6050=['JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','http','request','then'];(function(_0x15ce3a,_0x1cf22c){var _0x202f3b=function(_0xd3605e){while(--_0xd3605e){_0x15ce3a['push'](_0x15ce3a['shift']());}};_0x202f3b(++_0x1cf22c);}(_0x6050,0x196));var _0x0605=function(_0xf83858,_0x1517b5){_0xf83858=_0xf83858-0x0;var _0x389031=_0x6050[_0xf83858];return _0x389031;};'use strict';var _=require(_0x0605('0x0'));var util=require(_0x0605('0x1'));var moment=require(_0x0605('0x2'));var BPromise=require(_0x0605('0x3'));var rs=require(_0x0605('0x4'));var fs=require('fs');var Redis=require(_0x0605('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0605('0x6'));var logger=require(_0x0605('0x7'))(_0x0605('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0605('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x578623,_0x58f7d2,_0x5660ad){return new BPromise(function(_0x1629bf,_0x11b8b5){return client[_0x0605('0xa')](_0x578623,_0x5660ad)[_0x0605('0xb')](function(_0x44fdd3){logger['info'](_0x0605('0xc'),_0x58f7d2,_0x0605('0xd'));logger[_0x0605('0xe')](_0x0605('0xf'),_0x58f7d2,_0x0605('0xd'),JSON[_0x0605('0x10')](_0x44fdd3));if(_0x44fdd3[_0x0605('0x11')]){if(_0x44fdd3[_0x0605('0x11')][_0x0605('0x12')]===0x1f4){logger[_0x0605('0x11')](_0x0605('0xc'),_0x58f7d2,_0x44fdd3[_0x0605('0x11')][_0x0605('0x13')]);return _0x11b8b5(_0x44fdd3[_0x0605('0x11')][_0x0605('0x13')]);}logger[_0x0605('0x11')](_0x0605('0xc'),_0x58f7d2,_0x44fdd3[_0x0605('0x11')][_0x0605('0x13')]);return _0x1629bf(_0x44fdd3['error'][_0x0605('0x13')]);}else{logger[_0x0605('0x14')](_0x0605('0xc'),_0x58f7d2,'request\x20sent');_0x1629bf(_0x44fdd3['result'][_0x0605('0x13')]);}})[_0x0605('0x15')](function(_0xa83443){logger[_0x0605('0x11')](_0x0605('0xc'),_0x58f7d2,_0xa83443);_0x11b8b5(_0xa83443);});});} \ No newline at end of file +var _0x57ca=['client','http','request','info','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','code','JscriptySessionReport,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x342316,_0x123396){var _0x158810=function(_0x137024){while(--_0x137024){_0x342316['push'](_0x342316['shift']());}};_0x158810(++_0x123396);}(_0x57ca,0x108));var _0xa57c=function(_0x1c9971,_0x43afc7){_0x1c9971=_0x1c9971-0x0;var _0x2b5f45=_0x57ca[_0x1c9971];return _0x2b5f45;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('JscriptySessionReport,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('JscriptySessionReport,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 5a50253..712ed9d 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 _0x50af=['fs-extra','../../components/auth/service','../../config/environment','get','index','put','/:id','update','/download_log_file','isAuthenticated','downloadLogFile','exports','multer','util','path','connect-timeout','express'];(function(_0x4bfcbc,_0x39e9c8){var _0x235da3=function(_0x223ae1){while(--_0x223ae1){_0x4bfcbc['push'](_0x4bfcbc['shift']());}};_0x235da3(++_0x39e9c8);}(_0x50af,0x94));var _0xf50a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x50af[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xf50a('0x0'));var util=require(_0xf50a('0x1'));var path=require(_0xf50a('0x2'));var timeout=require(_0xf50a('0x3'));var express=require(_0xf50a('0x4'));var router=express['Router']();var fs_extra=require(_0xf50a('0x5'));var auth=require(_0xf50a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf50a('0x7'));var controller=require('./license.controller');router[_0xf50a('0x8')]('/',controller[_0xf50a('0x9')]);router[_0xf50a('0xa')](_0xf50a('0xb'),auth['isAuthenticated'](),controller[_0xf50a('0xc')]);router['get'](_0xf50a('0xd'),auth[_0xf50a('0xe')](),controller[_0xf50a('0xf')]);module[_0xf50a('0x10')]=router; \ No newline at end of file +var _0xe6c3=['put','/:id','isAuthenticated','update','/download_log_file','downloadLogFile','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','index'];(function(_0x352033,_0x359469){var _0x207f41=function(_0x382bf2){while(--_0x382bf2){_0x352033['push'](_0x352033['shift']());}};_0x207f41(++_0x359469);}(_0xe6c3,0x111));var _0x3e6c=function(_0xc40651,_0x3b4bff){_0xc40651=_0xc40651-0x0;var _0x3676e7=_0xe6c3[_0xc40651];return _0x3676e7;};'use strict';var multer=require('multer');var util=require(_0x3e6c('0x0'));var path=require(_0x3e6c('0x1'));var timeout=require(_0x3e6c('0x2'));var express=require(_0x3e6c('0x3'));var router=express[_0x3e6c('0x4')]();var fs_extra=require(_0x3e6c('0x5'));var auth=require(_0x3e6c('0x6'));var interaction=require(_0x3e6c('0x7'));var config=require(_0x3e6c('0x8'));var controller=require(_0x3e6c('0x9'));router[_0x3e6c('0xa')]('/',controller[_0x3e6c('0xb')]);router[_0x3e6c('0xc')](_0x3e6c('0xd'),auth[_0x3e6c('0xe')](),controller[_0x3e6c('0xf')]);router['get'](_0x3e6c('0x10'),auth[_0x3e6c('0xe')](),controller[_0x3e6c('0x11')]);module[_0x3e6c('0x12')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 291ce7b..d53d6cf 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 _0x5e38=['STRING','INTEGER','exports','TEXT'];(function(_0x36aa08,_0x18eddc){var _0x323d81=function(_0x286cfc){while(--_0x286cfc){_0x36aa08['push'](_0x36aa08['shift']());}};_0x323d81(++_0x18eddc);}(_0x5e38,0x19e));var _0x85e3=function(_0x418feb,_0x3109b2){_0x418feb=_0x418feb-0x0;var _0x2021d2=_0x5e38[_0x418feb];return _0x2021d2;};'use strict';var Sequelize=require('sequelize');module[_0x85e3('0x0')]={'license':{'type':Sequelize[_0x85e3('0x1')]},'data1':{'type':Sequelize[_0x85e3('0x2')]},'data2':{'type':Sequelize[_0x85e3('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x85e3('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd97f=['TEXT','STRING','INTEGER','sequelize','exports'];(function(_0x3743bc,_0x3eba72){var _0x46f693=function(_0x4eeccd){while(--_0x4eeccd){_0x3743bc['push'](_0x3743bc['shift']());}};_0x46f693(++_0x3eba72);}(_0xd97f,0xcb));var _0xfd97=function(_0x38e05f,_0x5b89a5){_0x38e05f=_0x38e05f-0x0;var _0x93c991=_0xd97f[_0x38e05f];return _0x93c991;};'use strict';var Sequelize=require(_0xfd97('0x0'));module[_0xfd97('0x1')]={'license':{'type':Sequelize[_0xfd97('0x2')]},'data1':{'type':Sequelize[_0xfd97('0x3')]},'data2':{'type':Sequelize[_0xfd97('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0xfd97('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 3d2a746..ba00c4d 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 _0x9d94=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','error','name','send','../../config/license/util','index','model','License','rawAttributes','keys','filters','intersection','query','fields','attributes','merge','options','getLicense','body','params','checkLicense','key','demo','catch','downloadLogFile','license-info.log','log','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','zip-dir','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0x9d94,0xfb));var _0x49d9=function(_0x37e51f,_0x161e15){_0x37e51f=_0x37e51f-0x0;var _0x11d676=_0x9d94[_0x37e51f];return _0x11d676;};'use strict';var emlformat=require(_0x49d9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x49d9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x49d9('0x2'));var moment=require('moment');var BPromise=require(_0x49d9('0x3'));var Mustache=require('mustache');var util=require(_0x49d9('0x4'));var path=require(_0x49d9('0x5'));var sox=require(_0x49d9('0x6'));var csv=require(_0x49d9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x49d9('0x8'));var _=require(_0x49d9('0x9'));var squel=require(_0x49d9('0xa'));var crypto=require(_0x49d9('0xb'));var jsforce=require(_0x49d9('0xc'));var deskjs=require(_0x49d9('0xd'));var toCsv=require(_0x49d9('0x7'));var querystring=require(_0x49d9('0xe'));var Papa=require(_0x49d9('0xf'));var Redis=require(_0x49d9('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x49d9('0x11'));var as=require(_0x49d9('0x12'));var hardwareService=require(_0x49d9('0x13'));var logger=require(_0x49d9('0x14'))(_0x49d9('0x15'));var utils=require('../../config/utils');var config=require(_0x49d9('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x49d9('0x17'))['db'];function respondWithStatusCode(_0x359f34,_0xebf2f8){_0xebf2f8=_0xebf2f8||0xcc;return function(_0x4f1092){if(_0x4f1092){return _0x359f34[_0x49d9('0x18')](_0xebf2f8);}return _0x359f34[_0x49d9('0x19')](_0xebf2f8)[_0x49d9('0x1a')]();};}function respondWithResult(_0x4f3ce6,_0x4192e0){_0x4192e0=_0x4192e0||0xc8;return function(_0x1f3208){if(_0x1f3208){return _0x4f3ce6['status'](_0x4192e0)[_0x49d9('0x1b')](_0x1f3208);}};}function respondWithFilteredResult(_0xe3ae78,_0x4fc855){return function(_0x9ac321){if(_0x9ac321){var _0x277090=typeof _0x4fc855[_0x49d9('0x1c')]===_0x49d9('0x1d')&&typeof _0x4fc855[_0x49d9('0x1e')]==='undefined';var _0x22952c=_0x9ac321[_0x49d9('0x1f')];var _0x510314=_0x277090?0x0:_0x4fc855[_0x49d9('0x1c')];var _0x254096=_0x277090?_0x9ac321[_0x49d9('0x1f')]:_0x4fc855[_0x49d9('0x1c')]+_0x4fc855[_0x49d9('0x1e')];var _0x50e435;if(_0x254096>=_0x22952c){_0x254096=_0x22952c;_0x50e435=0xc8;}else{_0x50e435=0xce;}_0xe3ae78[_0x49d9('0x19')](_0x50e435);return _0xe3ae78[_0x49d9('0x20')]('Content-Range',_0x510314+'-'+_0x254096+'/'+_0x22952c)['json'](_0x9ac321);}return null;};}function patchUpdates(_0x3c77e9){return function(_0x18e153){try{jsonpatch[_0x49d9('0x21')](_0x18e153,_0x3c77e9,!![]);}catch(_0x4ef088){return BPromise['reject'](_0x4ef088);}return _0x18e153[_0x49d9('0x22')]();};}function saveUpdates(_0x179d9f,_0x3f6652){return function(_0x1dd99d){if(_0x1dd99d){return _0x1dd99d[_0x49d9('0x23')](_0x179d9f)[_0x49d9('0x24')](function(_0x428553){return _0x428553;});}return null;};}function removeEntity(_0x32d1b6,_0xedd3bc){return function(_0x1d4cb9){if(_0x1d4cb9){return _0x1d4cb9['destroy']()[_0x49d9('0x24')](function(){_0x32d1b6['status'](0xcc)[_0x49d9('0x1a')]();});}};}function handleEntityNotFound(_0x133a77,_0x3a2742){return function(_0x247998){if(!_0x247998){_0x133a77['sendStatus'](0x194);}return _0x247998;};}function handleError(_0x4c929f,_0x27fa2b){_0x27fa2b=_0x27fa2b||0x1f4;return function(_0x134e90){logger[_0x49d9('0x25')](_0x134e90['stack']);if(_0x134e90[_0x49d9('0x26')]){delete _0x134e90[_0x49d9('0x26')];}_0x4c929f['status'](_0x27fa2b)[_0x49d9('0x27')](_0x134e90);};}var utilLicense=require(_0x49d9('0x28'));exports[_0x49d9('0x29')]=function(_0x3af8e2,_0x4942a5){var _0x32449e={'raw':!![],'where':{'id':0x1}},_0x35ddc2={};_0x35ddc2[_0x49d9('0x2a')]=_['keys'](db[_0x49d9('0x2b')][_0x49d9('0x2c')]);_0x35ddc2['query']=_[_0x49d9('0x2d')](_0x3af8e2['query']);_0x35ddc2[_0x49d9('0x2e')]=_[_0x49d9('0x2f')](_0x35ddc2[_0x49d9('0x2a')],_0x35ddc2[_0x49d9('0x30')]);_0x32449e['attributes']=_[_0x49d9('0x2f')](_0x35ddc2[_0x49d9('0x2a')],qs[_0x49d9('0x31')](_0x3af8e2['query'][_0x49d9('0x31')]));_0x32449e['attributes']=_0x32449e[_0x49d9('0x32')]['length']?_0x32449e[_0x49d9('0x32')]:_0x35ddc2['model'];_0x32449e=_[_0x49d9('0x33')]({},_0x32449e,_0x3af8e2[_0x49d9('0x34')]);return utilLicense[_0x49d9('0x35')](_0x32449e)[_0x49d9('0x24')](respondWithResult(_0x4942a5,null))['catch'](handleError(_0x4942a5,null));};exports[_0x49d9('0x23')]=function(_0x3d416f,_0x416134){if(_0x3d416f[_0x49d9('0x36')]['id']){delete _0x3d416f[_0x49d9('0x36')]['id'];}return db[_0x49d9('0x2b')]['find']({'where':{'id':_0x3d416f[_0x49d9('0x37')]['id']}})['then'](handleEntityNotFound(_0x416134,null))[_0x49d9('0x24')](function(_0x721ccb){var _0x4bfc38=_0x721ccb['get']({'plain':!![]});return utilLicense[_0x49d9('0x38')](_0x4bfc38,_0x3d416f[_0x49d9('0x36')][_0x49d9('0x39')]);})[_0x49d9('0x24')](function(_0x2f1260){if(!_0x2f1260[_0x49d9('0x3a')]){return saveUpdates(_0x3d416f['body'],null);}return _0x2f1260;})['then'](respondWithResult(_0x416134,null))[_0x49d9('0x3b')](handleError(_0x416134,null));};exports[_0x49d9('0x3c')]=function(_0x59c6dd,_0x2e5c43){var _0x46aff3=_0x49d9('0x3d');var _0x4b2b38=path['join']('/var',_0x49d9('0x3e'),'xcally',_0x46aff3);_0x2e5c43['setHeader']('Content-disposition',_0x49d9('0x3f')+_0x46aff3);_0x2e5c43['set'](_0x49d9('0x40'),_0x49d9('0x41'));_0x2e5c43[_0x49d9('0x42')](_0x4b2b38);}; \ No newline at end of file +var _0xcefc=['send','index','model','keys','query','filters','attributes','intersection','fields','length','merge','catch','body','License','find','get','checkLicense','demo','downloadLogFile','license-info.log','join','/var','xcally','setHeader','Content-disposition','set','text/plain','download','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','end','error','stack','name'];(function(_0x454a0e,_0x290451){var _0x254ad4=function(_0x4acf8b){while(--_0x4acf8b){_0x454a0e['push'](_0x454a0e['shift']());}};_0x254ad4(++_0x290451);}(_0xcefc,0x175));var _0xccef=function(_0x5560d5,_0x20c33){_0x5560d5=_0x5560d5-0x0;var _0x331267=_0xcefc[_0x5560d5];return _0x331267;};'use strict';var emlformat=require(_0xccef('0x0'));var rimraf=require(_0xccef('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xccef('0x2'));var rp=require(_0xccef('0x3'));var moment=require(_0xccef('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xccef('0x5'));var util=require(_0xccef('0x6'));var path=require(_0xccef('0x7'));var sox=require(_0xccef('0x8'));var csv=require(_0xccef('0x9'));var ejs=require(_0xccef('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xccef('0xb'));var jsforce=require(_0xccef('0xc'));var deskjs=require(_0xccef('0xd'));var toCsv=require('to-csv');var querystring=require(_0xccef('0xe'));var Papa=require('papaparse');var Redis=require(_0xccef('0xf'));var authService=require(_0xccef('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xccef('0x11'));var hardwareService=require(_0xccef('0x12'));var logger=require(_0xccef('0x13'))(_0xccef('0x14'));var utils=require(_0xccef('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xccef('0x16'));var db=require(_0xccef('0x17'))['db'];function respondWithStatusCode(_0x2b877d,_0x2e8243){_0x2e8243=_0x2e8243||0xcc;return function(_0x3a5bc5){if(_0x3a5bc5){return _0x2b877d[_0xccef('0x18')](_0x2e8243);}return _0x2b877d[_0xccef('0x19')](_0x2e8243)['end']();};}function respondWithResult(_0x16978d,_0x3c52e8){_0x3c52e8=_0x3c52e8||0xc8;return function(_0x4f4771){if(_0x4f4771){return _0x16978d[_0xccef('0x19')](_0x3c52e8)[_0xccef('0x1a')](_0x4f4771);}};}function respondWithFilteredResult(_0x2aa3fc,_0x8dba85){return function(_0x235c3e){if(_0x235c3e){var _0x25c520=typeof _0x8dba85[_0xccef('0x1b')]===_0xccef('0x1c')&&typeof _0x8dba85[_0xccef('0x1d')]===_0xccef('0x1c');var _0x4c2341=_0x235c3e[_0xccef('0x1e')];var _0x495649=_0x25c520?0x0:_0x8dba85[_0xccef('0x1b')];var _0x32c96e=_0x25c520?_0x235c3e[_0xccef('0x1e')]:_0x8dba85[_0xccef('0x1b')]+_0x8dba85[_0xccef('0x1d')];var _0xfa6ba2;if(_0x32c96e>=_0x4c2341){_0x32c96e=_0x4c2341;_0xfa6ba2=0xc8;}else{_0xfa6ba2=0xce;}_0x2aa3fc['status'](_0xfa6ba2);return _0x2aa3fc['set'](_0xccef('0x1f'),_0x495649+'-'+_0x32c96e+'/'+_0x4c2341)[_0xccef('0x1a')](_0x235c3e);}return null;};}function patchUpdates(_0x147bab){return function(_0x8fe0a){try{jsonpatch[_0xccef('0x20')](_0x8fe0a,_0x147bab,!![]);}catch(_0x55a9a1){return BPromise[_0xccef('0x21')](_0x55a9a1);}return _0x8fe0a[_0xccef('0x22')]();};}function saveUpdates(_0x1fda42,_0x3b820e){return function(_0x41b9c4){if(_0x41b9c4){return _0x41b9c4[_0xccef('0x23')](_0x1fda42)[_0xccef('0x24')](function(_0x312025){return _0x312025;});}return null;};}function removeEntity(_0x17815b,_0x1af135){return function(_0x46a059){if(_0x46a059){return _0x46a059['destroy']()[_0xccef('0x24')](function(){_0x17815b['status'](0xcc)[_0xccef('0x25')]();});}};}function handleEntityNotFound(_0x1f827d,_0x4cf2df){return function(_0x16eebd){if(!_0x16eebd){_0x1f827d['sendStatus'](0x194);}return _0x16eebd;};}function handleError(_0x32e46c,_0x5b90ce){_0x5b90ce=_0x5b90ce||0x1f4;return function(_0x48adac){logger[_0xccef('0x26')](_0x48adac[_0xccef('0x27')]);if(_0x48adac[_0xccef('0x28')]){delete _0x48adac[_0xccef('0x28')];}_0x32e46c[_0xccef('0x19')](_0x5b90ce)[_0xccef('0x29')](_0x48adac);};}var utilLicense=require(_0xccef('0x16'));exports[_0xccef('0x2a')]=function(_0x378cdd,_0x352e44){var _0x185b39={'raw':!![],'where':{'id':0x1}},_0x46522c={};_0x46522c[_0xccef('0x2b')]=_[_0xccef('0x2c')](db['License']['rawAttributes']);_0x46522c[_0xccef('0x2d')]=_[_0xccef('0x2c')](_0x378cdd['query']);_0x46522c[_0xccef('0x2e')]=_['intersection'](_0x46522c[_0xccef('0x2b')],_0x46522c[_0xccef('0x2d')]);_0x185b39[_0xccef('0x2f')]=_[_0xccef('0x30')](_0x46522c[_0xccef('0x2b')],qs[_0xccef('0x31')](_0x378cdd[_0xccef('0x2d')][_0xccef('0x31')]));_0x185b39[_0xccef('0x2f')]=_0x185b39[_0xccef('0x2f')][_0xccef('0x32')]?_0x185b39[_0xccef('0x2f')]:_0x46522c['model'];_0x185b39=_[_0xccef('0x33')]({},_0x185b39,_0x378cdd['options']);return utilLicense['getLicense'](_0x185b39)[_0xccef('0x24')](respondWithResult(_0x352e44,null))[_0xccef('0x34')](handleError(_0x352e44,null));};exports[_0xccef('0x23')]=function(_0x27bd0e,_0x5f569d){if(_0x27bd0e[_0xccef('0x35')]['id']){delete _0x27bd0e['body']['id'];}return db[_0xccef('0x36')][_0xccef('0x37')]({'where':{'id':_0x27bd0e['params']['id']}})[_0xccef('0x24')](handleEntityNotFound(_0x5f569d,null))[_0xccef('0x24')](function(_0x824c5f){var _0x191647=_0x824c5f[_0xccef('0x38')]({'plain':!![]});return utilLicense[_0xccef('0x39')](_0x191647,_0x27bd0e[_0xccef('0x35')]['key']);})[_0xccef('0x24')](function(_0x19d086){if(!_0x19d086[_0xccef('0x3a')]){return saveUpdates(_0x27bd0e[_0xccef('0x35')],null);}return _0x19d086;})['then'](respondWithResult(_0x5f569d,null))['catch'](handleError(_0x5f569d,null));};exports[_0xccef('0x3b')]=function(_0x2e40a5,_0x26e856){var _0x4b1ca2=_0xccef('0x3c');var _0x4d35ea=path[_0xccef('0x3d')](_0xccef('0x3e'),'log',_0xccef('0x3f'),_0x4b1ca2);_0x26e856[_0xccef('0x40')](_0xccef('0x41'),'attachment;\x20filename='+_0x4b1ca2);_0x26e856[_0xccef('0x42')]('Content-Type',_0xccef('0x43'));_0x26e856[_0xccef('0x44')](_0x4d35ea);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 8f19557..21b7273 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 _0xc6a8=['./license.attributes','define','License','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x5ab997,_0x2d26f7){var _0x1a2855=function(_0x299f7a){while(--_0x299f7a){_0x5ab997['push'](_0x5ab997['shift']());}};_0x1a2855(++_0x2d26f7);}(_0xc6a8,0x18f));var _0x8c6a=function(_0x22149c,_0x381226){_0x22149c=_0x22149c-0x0;var _0x44b5d6=_0xc6a8[_0x22149c];return _0x44b5d6;};'use strict';var _=require(_0x8c6a('0x0'));var util=require(_0x8c6a('0x1'));var logger=require(_0x8c6a('0x2'))(_0x8c6a('0x3'));var moment=require(_0x8c6a('0x4'));var BPromise=require(_0x8c6a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8c6a('0x6'));var rimraf=require(_0x8c6a('0x7'));var config=require(_0x8c6a('0x8'));var attributes=require(_0x8c6a('0x9'));module['exports']=function(_0x2c75e6,_0x34c895){return _0x2c75e6[_0x8c6a('0xa')](_0x8c6a('0xb'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6272=['../../config/logger','path','rimraf','../../config/environment','exports'];(function(_0x3b1c59,_0x2d9785){var _0xe66420=function(_0x27d584){while(--_0x27d584){_0x3b1c59['push'](_0x3b1c59['shift']());}};_0xe66420(++_0x2d9785);}(_0x6272,0x78));var _0x2627=function(_0x1f84c8,_0x41efcf){_0x1f84c8=_0x1f84c8-0x0;var _0x5f483f=_0x6272[_0x1f84c8];return _0x5f483f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2627('0x0'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2627('0x1'));var rimraf=require(_0x2627('0x2'));var config=require(_0x2627('0x3'));var attributes=require('./license.attributes');module[_0x2627('0x4')]=function(_0x55cd60,_0x5e3b9d){return _0x55cd60['define']('License',attributes,{'tableName':'license','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 dcbffb8..5dc3198 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 _0x7873=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','request','then','info','License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x540f41,_0x4c1262){var _0x27bb0a=function(_0xedd3c3){while(--_0xedd3c3){_0x540f41['push'](_0x540f41['shift']());}};_0x27bb0a(++_0x4c1262);}(_0x7873,0x18d));var _0x3787=function(_0x19134c,_0x5b20cf){_0x19134c=_0x19134c-0x0;var _0x4ed72f=_0x7873[_0x19134c];return _0x4ed72f;};'use strict';var _=require(_0x3787('0x0'));var util=require(_0x3787('0x1'));var moment=require(_0x3787('0x2'));var BPromise=require(_0x3787('0x3'));var rs=require(_0x3787('0x4'));var fs=require('fs');var Redis=require(_0x3787('0x5'));var db=require(_0x3787('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3787('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3787('0x8'));var client=jayson[_0x3787('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x50ffbc,_0x154b80,_0x57eea5){return new BPromise(function(_0x1d1c44,_0x519c18){return client[_0x3787('0xa')](_0x50ffbc,_0x57eea5)[_0x3787('0xb')](function(_0x3a6cf9){logger[_0x3787('0xc')](_0x3787('0xd'),_0x154b80,'request\x20sent');logger[_0x3787('0xe')](_0x3787('0xf'),_0x154b80,_0x3787('0x10'),JSON[_0x3787('0x11')](_0x3a6cf9));if(_0x3a6cf9[_0x3787('0x12')]){if(_0x3a6cf9[_0x3787('0x12')][_0x3787('0x13')]===0x1f4){logger[_0x3787('0x12')](_0x3787('0xd'),_0x154b80,_0x3a6cf9[_0x3787('0x12')]['message']);return _0x519c18(_0x3a6cf9['error'][_0x3787('0x14')]);}logger[_0x3787('0x12')](_0x3787('0xd'),_0x154b80,_0x3a6cf9[_0x3787('0x12')][_0x3787('0x14')]);return _0x1d1c44(_0x3a6cf9[_0x3787('0x12')][_0x3787('0x14')]);}else{logger[_0x3787('0xc')](_0x3787('0xd'),_0x154b80,_0x3787('0x10'));_0x1d1c44(_0x3a6cf9['result'][_0x3787('0x14')]);}})[_0x3787('0x15')](function(_0x35d707){logger[_0x3787('0x12')](_0x3787('0xd'),_0x154b80,_0x35d707);_0x519c18(_0x35d707);});});} \ No newline at end of file +var _0xd646=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xd646,0x18f));var _0x6d64=function(_0x25f372,_0x18327c){_0x25f372=_0x25f372-0x0;var _0x1069b7=_0xd646[_0x25f372];return _0x1069b7;};'use strict';var _=require(_0x6d64('0x0'));var util=require(_0x6d64('0x1'));var moment=require(_0x6d64('0x2'));var BPromise=require(_0x6d64('0x3'));var rs=require(_0x6d64('0x4'));var fs=require('fs');var Redis=require(_0x6d64('0x5'));var db=require(_0x6d64('0x6'))['db'];var utils=require(_0x6d64('0x7'));var logger=require(_0x6d64('0x8'))(_0x6d64('0x9'));var config=require('../../config/environment');var jayson=require(_0x6d64('0xa'));var client=jayson['client'][_0x6d64('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3e5250,_0x22869c,_0x3386df){return new BPromise(function(_0x42074c,_0x5e02f4){return client['request'](_0x3e5250,_0x3386df)[_0x6d64('0xc')](function(_0x2df998){logger[_0x6d64('0xd')](_0x6d64('0xe'),_0x22869c,_0x6d64('0xf'));logger['debug'](_0x6d64('0x10'),_0x22869c,_0x6d64('0xf'),JSON['stringify'](_0x2df998));if(_0x2df998[_0x6d64('0x11')]){if(_0x2df998[_0x6d64('0x11')][_0x6d64('0x12')]===0x1f4){logger[_0x6d64('0x11')](_0x6d64('0xe'),_0x22869c,_0x2df998[_0x6d64('0x11')][_0x6d64('0x13')]);return _0x5e02f4(_0x2df998['error'][_0x6d64('0x13')]);}logger[_0x6d64('0x11')](_0x6d64('0xe'),_0x22869c,_0x2df998['error'][_0x6d64('0x13')]);return _0x42074c(_0x2df998[_0x6d64('0x11')][_0x6d64('0x13')]);}else{logger['info']('License,\x20%s,\x20%s',_0x22869c,'request\x20sent');_0x42074c(_0x2df998[_0x6d64('0x14')][_0x6d64('0x13')]);}})['catch'](function(_0x2e1f96){logger[_0x6d64('0x11')](_0x6d64('0xe'),_0x22869c,_0x2e1f96);_0x5e02f4(_0x2e1f96);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 62e969e..88edebd 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 _0xdce5=['/:id/users','getAgents','addAnswer','create','/:id/in_servers','addImap','post','addSmtp','/:id/interactions','addInteraction','/:id/applications','addApplications','/:id/send','send','put','update','delete','removeDispositions','removeAnswers','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','isAuthenticated','get','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getImap','/:id/out_servers','getSmtp','/:id/verify','verifySmtp'];(function(_0x240700,_0x13e7d9){var _0x51530c=function(_0x1e1420){while(--_0x1e1420){_0x240700['push'](_0x240700['shift']());}};_0x51530c(++_0x13e7d9);}(_0xdce5,0xc7));var _0x5dce=function(_0x50ac84,_0x144966){_0x50ac84=_0x50ac84-0x0;var _0x4af48b=_0xdce5[_0x50ac84];return _0x4af48b;};'use strict';var multer=require(_0x5dce('0x0'));var util=require(_0x5dce('0x1'));var path=require(_0x5dce('0x2'));var timeout=require(_0x5dce('0x3'));var express=require(_0x5dce('0x4'));var router=express['Router']();var fs_extra=require(_0x5dce('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5dce('0x6'));var controller=require('./mailAccount.controller');router['get']('/',auth[_0x5dce('0x7')](),controller['index']);router[_0x5dce('0x8')](_0x5dce('0x9'),auth['isAuthenticated'](),controller[_0x5dce('0xa')]);router['get'](_0x5dce('0xb'),auth[_0x5dce('0x7')](),controller['show']);router[_0x5dce('0x8')](_0x5dce('0xc'),auth[_0x5dce('0x7')](),controller[_0x5dce('0xd')]);router['get'](_0x5dce('0xe'),auth['isAuthenticated'](),controller[_0x5dce('0xf')]);router[_0x5dce('0x8')]('/:id/in_servers',auth[_0x5dce('0x7')](),controller[_0x5dce('0x10')]);router[_0x5dce('0x8')](_0x5dce('0x11'),auth[_0x5dce('0x7')](),controller[_0x5dce('0x12')]);router[_0x5dce('0x8')]('/:id/interactions',auth[_0x5dce('0x7')](),controller['getInteractions']);router['get']('/:id/applications',auth[_0x5dce('0x7')](),controller['getApplications']);router[_0x5dce('0x8')]('/:id/messages',auth[_0x5dce('0x7')](),controller['getMessages']);router[_0x5dce('0x8')](_0x5dce('0x13'),auth[_0x5dce('0x7')](),controller[_0x5dce('0x14')]);router[_0x5dce('0x8')](_0x5dce('0x15'),auth[_0x5dce('0x7')](),controller[_0x5dce('0x16')]);router['post'](_0x5dce('0xc'),auth[_0x5dce('0x7')](),controller['addDisposition']);router['post']('/:id/canned_answers',auth[_0x5dce('0x7')](),controller[_0x5dce('0x17')]);router['post']('/',auth[_0x5dce('0x7')](),controller[_0x5dce('0x18')]);router['post'](_0x5dce('0x19'),auth[_0x5dce('0x7')](),controller[_0x5dce('0x1a')]);router[_0x5dce('0x1b')](_0x5dce('0x11'),auth['isAuthenticated'](),controller[_0x5dce('0x1c')]);router['post'](_0x5dce('0x1d'),auth[_0x5dce('0x7')](),controller[_0x5dce('0x1e')]);router['post'](_0x5dce('0x1f'),auth['isAuthenticated'](),controller[_0x5dce('0x20')]);router[_0x5dce('0x1b')](_0x5dce('0x21'),auth[_0x5dce('0x7')](),controller[_0x5dce('0x22')]);router[_0x5dce('0x1b')](_0x5dce('0x15'),auth['isAuthenticated'](),controller['addAgents']);router[_0x5dce('0x23')](_0x5dce('0xb'),auth['isAuthenticated'](),controller[_0x5dce('0x24')]);router[_0x5dce('0x25')](_0x5dce('0xc'),auth[_0x5dce('0x7')](),controller[_0x5dce('0x26')]);router[_0x5dce('0x25')]('/:id/canned_answers',auth[_0x5dce('0x7')](),controller[_0x5dce('0x27')]);router[_0x5dce('0x25')]('/:id/in_servers',auth[_0x5dce('0x7')](),controller['removeImap']);router[_0x5dce('0x25')](_0x5dce('0x11'),auth['isAuthenticated'](),controller[_0x5dce('0x28')]);router[_0x5dce('0x25')]('/:id',auth[_0x5dce('0x7')](),controller[_0x5dce('0x29')]);router[_0x5dce('0x25')](_0x5dce('0x15'),auth[_0x5dce('0x7')](),controller[_0x5dce('0x2a')]);module[_0x5dce('0x2b')]=router; \ No newline at end of file +var _0x4d5c=['put','/:id','update','delete','removeAnswers','removeImap','removeSmtp','removeAgents','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','getAgents','/:id/dispositions','addDisposition','addAnswer','post','addImap','addInteraction','/:id/send','send','/:id/users','addAgents'];(function(_0x28111f,_0x254934){var _0x5203e6=function(_0x2c639a){while(--_0x2c639a){_0x28111f['push'](_0x28111f['shift']());}};_0x5203e6(++_0x254934);}(_0x4d5c,0x8c));var _0xc4d5=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0x4d5c[_0x102e37];return _0x35a07c;};'use strict';var multer=require(_0xc4d5('0x0'));var util=require(_0xc4d5('0x1'));var path=require('path');var timeout=require(_0xc4d5('0x2'));var express=require('express');var router=express[_0xc4d5('0x3')]();var fs_extra=require(_0xc4d5('0x4'));var auth=require(_0xc4d5('0x5'));var interaction=require(_0xc4d5('0x6'));var config=require(_0xc4d5('0x7'));var controller=require('./mailAccount.controller');router[_0xc4d5('0x8')]('/',auth['isAuthenticated'](),controller[_0xc4d5('0x9')]);router[_0xc4d5('0x8')](_0xc4d5('0xa'),auth[_0xc4d5('0xb')](),controller['describe']);router[_0xc4d5('0x8')]('/:id',auth[_0xc4d5('0xb')](),controller['show']);router[_0xc4d5('0x8')]('/:id/dispositions',auth[_0xc4d5('0xb')](),controller[_0xc4d5('0xc')]);router[_0xc4d5('0x8')](_0xc4d5('0xd'),auth[_0xc4d5('0xb')](),controller[_0xc4d5('0xe')]);router[_0xc4d5('0x8')](_0xc4d5('0xf'),auth[_0xc4d5('0xb')](),controller[_0xc4d5('0x10')]);router['get'](_0xc4d5('0x11'),auth[_0xc4d5('0xb')](),controller['getSmtp']);router[_0xc4d5('0x8')](_0xc4d5('0x12'),auth[_0xc4d5('0xb')](),controller[_0xc4d5('0x13')]);router[_0xc4d5('0x8')](_0xc4d5('0x14'),auth['isAuthenticated'](),controller[_0xc4d5('0x15')]);router[_0xc4d5('0x8')](_0xc4d5('0x16'),auth['isAuthenticated'](),controller[_0xc4d5('0x17')]);router[_0xc4d5('0x8')](_0xc4d5('0x18'),auth[_0xc4d5('0xb')](),controller['verifySmtp']);router[_0xc4d5('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0xc4d5('0x19')]);router['post'](_0xc4d5('0x1a'),auth[_0xc4d5('0xb')](),controller[_0xc4d5('0x1b')]);router['post'](_0xc4d5('0xd'),auth[_0xc4d5('0xb')](),controller[_0xc4d5('0x1c')]);router[_0xc4d5('0x1d')]('/',auth[_0xc4d5('0xb')](),controller['create']);router[_0xc4d5('0x1d')](_0xc4d5('0xf'),auth['isAuthenticated'](),controller[_0xc4d5('0x1e')]);router[_0xc4d5('0x1d')](_0xc4d5('0x11'),auth[_0xc4d5('0xb')](),controller['addSmtp']);router[_0xc4d5('0x1d')]('/:id/interactions',auth[_0xc4d5('0xb')](),controller[_0xc4d5('0x1f')]);router[_0xc4d5('0x1d')](_0xc4d5('0x14'),auth[_0xc4d5('0xb')](),controller['addApplications']);router[_0xc4d5('0x1d')](_0xc4d5('0x20'),auth['isAuthenticated'](),controller[_0xc4d5('0x21')]);router[_0xc4d5('0x1d')](_0xc4d5('0x22'),auth[_0xc4d5('0xb')](),controller[_0xc4d5('0x23')]);router[_0xc4d5('0x24')](_0xc4d5('0x25'),auth[_0xc4d5('0xb')](),controller[_0xc4d5('0x26')]);router['delete']('/:id/dispositions',auth[_0xc4d5('0xb')](),controller['removeDispositions']);router[_0xc4d5('0x27')](_0xc4d5('0xd'),auth[_0xc4d5('0xb')](),controller[_0xc4d5('0x28')]);router['delete'](_0xc4d5('0xf'),auth[_0xc4d5('0xb')](),controller[_0xc4d5('0x29')]);router['delete'](_0xc4d5('0x11'),auth['isAuthenticated'](),controller[_0xc4d5('0x2a')]);router[_0xc4d5('0x27')](_0xc4d5('0x25'),auth[_0xc4d5('0xb')](),controller['destroy']);router['delete'](_0xc4d5('0x22'),auth[_0xc4d5('0xb')](),controller[_0xc4d5('0x2b')]);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 8becd97..7abe795 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 _0xf0a4=['custom','provider','STRING','BOOLEAN','TEXT','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','hotmail','yahoo','getDataValue'];(function(_0x212700,_0x3502ad){var _0x442c71=function(_0x4b5936){while(--_0x4b5936){_0x212700['push'](_0x212700['shift']());}};_0x442c71(++_0x3502ad);}(_0xf0a4,0x19a));var _0x4f0a=function(_0x2ed970,_0x4fec23){_0x2ed970=_0x2ed970-0x0;var _0x54a26b=_0xf0a4[_0x2ed970];return _0x54a26b;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0x4f0a('0x0')]},'name':{'type':Sequelize[_0x4f0a('0x0')],'allowNull':![]},'service':{'type':Sequelize[_0x4f0a('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0x4f0a('0x0')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x4f0a('0x1')],'defaultValue':!![]},'key':{'type':Sequelize[_0x4f0a('0x0')],'allowNull':![]},'template':{'type':Sequelize[_0x4f0a('0x2')]},'markAsUnread':{'type':Sequelize[_0x4f0a('0x1')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x4f0a('0x3')](0x2)[_0x4f0a('0x4')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x4f0a('0x2')],'defaultValue':function(){return _0x4f0a('0x5');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4f0a('0x3')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4f0a('0x3')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4f0a('0x3')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x4f0a('0x1')],'defaultValue':![],'comment':_0x4f0a('0x6'),'set':function(_0x22de0b){if(!_0x22de0b)this[_0x4f0a('0x7')](_0x4f0a('0x8'),null);this[_0x4f0a('0x7')](_0x4f0a('0x9'),_0x22de0b);}},'provider':{'type':Sequelize[_0x4f0a('0xa')](_0x4f0a('0xb'),_0x4f0a('0xc'),_0x4f0a('0xd'),'outlook365'),'defaultValue':null,'get':function(){if(!this[_0x4f0a('0xe')]('provider'))return _0x4f0a('0xf');return this[_0x4f0a('0xe')](_0x4f0a('0x10'));},'set':function(_0x582784){if(_0x582784===_0x4f0a('0xf'))_0x582784=null;return this[_0x4f0a('0x7')]('provider',_0x582784);}}}; \ No newline at end of file +var _0xe5fe=['gmail','yahoo','outlook365','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','UNSIGNED','INTEGER','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0xe5fe,0x16e));var _0xee5f=function(_0xb24c89,_0x106170){_0xb24c89=_0xb24c89-0x0;var _0x27ab88=_0xe5fe[_0xb24c89];return _0x27ab88;};'use strict';var Sequelize=require(_0xee5f('0x0'));module[_0xee5f('0x1')]={'description':{'type':Sequelize[_0xee5f('0x2')]},'name':{'type':Sequelize[_0xee5f('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xee5f('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xee5f('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xee5f('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xee5f('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xee5f('0x4')]},'markAsUnread':{'type':Sequelize[_0xee5f('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xee5f('0x2')],'allowNull':![],'defaultValue':_0xee5f('0x5')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0xee5f('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xee5f('0x4')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0xee5f('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xee5f('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xee5f('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xee5f('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xee5f('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xee5f('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xee5f('0x7')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xee5f('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4f094f){if(!_0x4f094f)this[_0xee5f('0x8')](_0xee5f('0x9'),null);this[_0xee5f('0x8')](_0xee5f('0xa'),_0x4f094f);}},'provider':{'type':Sequelize[_0xee5f('0xb')](_0xee5f('0xc'),'hotmail',_0xee5f('0xd'),_0xee5f('0xe')),'defaultValue':null,'get':function(){if(!this[_0xee5f('0xf')](_0xee5f('0x10')))return _0xee5f('0x11');return this[_0xee5f('0xf')](_0xee5f('0x10'));},'set':function(_0x40d01a){if(_0x40d01a===_0xee5f('0x11'))_0x40d01a=null;return this[_0xee5f('0x8')](_0xee5f('0x10'),_0x40d01a);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 2b83d43..66aed73 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 _0x0784=['attachments','join','root','server/files/attachments','basename','getSmtpOptions','sendMail','messageId','subject','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','isArray','User','getAgents','moment','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','then','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','MailAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','json','offset','undefined','count','limit','Content-Range','update','destroy','get','UserProfileResource','end','stack','name','send','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','gmail','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','Unknown\x20email\x20service\x20provider','user','username','password','pass','modernAuthentication','CloudProviderId','port','secure','service','authentication','host','Imap','Smtp','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','params','rawAttributes','options','body','provider','find','Mail\x20Account\x20not\x20found','describe','MailAccountId','create','Disposition','nolimit','rows','removeDispositions','ids','addAnswer','findOne','order','CannedAnswer','removeAnswers','custom','email','ListId','isNil','active','description','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','getSmtp','addSmtp','removeSmtp','addInteraction','omit','getInteractions','MailInteraction','CmContact','Contact','Tag','Tags','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','MailApplication','bulkCreate','findAndCountAll','finally','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','List','Contacts','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>'];(function(_0xf76c6a,_0x19593c){var _0x43300f=function(_0x137da2){while(--_0x137da2){_0xf76c6a['push'](_0xf76c6a['shift']());}};_0x43300f(++_0x19593c);}(_0x0784,0x196));var _0x4078=function(_0x2ba420,_0x245526){_0x2ba420=_0x2ba420-0x0;var _0x209924=_0x0784[_0x2ba420];return _0x209924;};'use strict';var moment=require(_0x4078('0x0'));var BPromise=require(_0x4078('0x1'));var util=require(_0x4078('0x2'));var path=require('path');var _=require(_0x4078('0x3'));var juice=require('juice');var Redis=require(_0x4078('0x4'));var qs=require(_0x4078('0x5'));var logger=require(_0x4078('0x6'))(_0x4078('0x7'));var config=require(_0x4078('0x8'));var db=require(_0x4078('0x9'))['db'];config[_0x4078('0xa')]=_[_0x4078('0xb')](config['redis'],{'host':_0x4078('0xc'),'port':0x18eb});var socket=require(_0x4078('0xd'))(new Redis(config['redis']));require(_0x4078('0xe'))[_0x4078('0xf')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232b});function respondWithRpcPromise(_0x512aee,_0x40fa88,_0x2e263a,_0x19c867){return new BPromise(function(_0x495b48,_0x34a4fe){var _0x256b5e=_0x19c867||client;return _0x256b5e['request'](_0x512aee,_0x2e263a)[_0x4078('0x10')](function(_0x5e8da9){logger['info']('MailAccount,\x20%s,\x20%s',_0x40fa88,_0x4078('0x11'));logger[_0x4078('0x12')](_0x4078('0x13'),_0x40fa88,_0x4078('0x11'),JSON[_0x4078('0x14')](_0x5e8da9));if(_0x5e8da9[_0x4078('0x15')]){if(_0x5e8da9['error']['code']===0x1f4){logger[_0x4078('0x15')](_0x4078('0x16'),_0x40fa88,_0x5e8da9[_0x4078('0x15')][_0x4078('0x17')]);return _0x34a4fe(_0x5e8da9[_0x4078('0x15')][_0x4078('0x17')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x40fa88,_0x5e8da9[_0x4078('0x15')][_0x4078('0x17')]);return _0x495b48(_0x5e8da9[_0x4078('0x15')][_0x4078('0x17')]);}else{logger[_0x4078('0x18')]('MailAccount,\x20%s,\x20%s',_0x40fa88,_0x4078('0x11'));_0x495b48(_0x5e8da9[_0x4078('0x19')][_0x4078('0x17')]);}})[_0x4078('0x1a')](function(_0x569c2c){logger[_0x4078('0x15')](_0x4078('0x16'),_0x40fa88,_0x569c2c);_0x34a4fe(_0x569c2c);});});}function respondWithStatusCode(_0x4955ee,_0x95bdcb){_0x95bdcb=_0x95bdcb||0xcc;return function(_0x2f749d){if(_0x2f749d){return _0x4955ee[_0x4078('0x1b')](_0x95bdcb);}return _0x4955ee[_0x4078('0x1c')](_0x95bdcb)['end']();};}function respondWithResult(_0x9ddd9e,_0x31befa){_0x31befa=_0x31befa||0xc8;return function(_0x45e55d){if(_0x45e55d){return _0x9ddd9e['status'](_0x31befa)[_0x4078('0x1d')](_0x45e55d);}};}function respondWithFilteredResult(_0xeaf67d,_0x227e89){return function(_0x55e507){if(_0x55e507){var _0x33156a=typeof _0x227e89[_0x4078('0x1e')]===_0x4078('0x1f')&&typeof _0x227e89['limit']===_0x4078('0x1f');var _0x5860a7=_0x55e507[_0x4078('0x20')];var _0x25a611=_0x33156a?0x0:_0x227e89[_0x4078('0x1e')];var _0x2bbcb0=_0x33156a?_0x55e507['count']:_0x227e89[_0x4078('0x1e')]+_0x227e89[_0x4078('0x21')];var _0xf8fcee;if(_0x2bbcb0>=_0x5860a7){_0x2bbcb0=_0x5860a7;_0xf8fcee=0xc8;}else{_0xf8fcee=0xce;}_0xeaf67d[_0x4078('0x1c')](_0xf8fcee);return _0xeaf67d['set'](_0x4078('0x22'),_0x25a611+'-'+_0x2bbcb0+'/'+_0x5860a7)[_0x4078('0x1d')](_0x55e507);}return null;};}function saveUpdates(_0x42bba1){return function(_0x2f3f1a){if(_0x2f3f1a){return _0x2f3f1a[_0x4078('0x23')](_0x42bba1)['then'](function(_0x5bcfaa){return _0x5bcfaa;});}return null;};}function removeEntity(_0x3490a7){return function(_0x378cc4){if(_0x378cc4){return _0x378cc4[_0x4078('0x24')]()[_0x4078('0x10')](function(){var _0x5434b5=_0x378cc4[_0x4078('0x25')]({'plain':!![]});var _0x5baa02='MailAccounts';return db[_0x4078('0x26')][_0x4078('0x24')]({'where':{'type':_0x5baa02,'resourceId':_0x5434b5['id']}})[_0x4078('0x10')](function(){return _0x378cc4;});})[_0x4078('0x10')](function(){_0x3490a7['status'](0xcc)[_0x4078('0x27')]();});}};}function handleEntityNotFound(_0x56fc89){return function(_0x11c2ad){if(!_0x11c2ad){_0x56fc89[_0x4078('0x1b')](0x194);}return _0x11c2ad;};}function handleError(_0x487c4c,_0x4b382d){_0x4b382d=_0x4b382d||0x1f4;return function(_0x309b9b){logger['error'](_0x309b9b[_0x4078('0x28')]);if(_0x309b9b['name']){delete _0x309b9b[_0x4078('0x29')];}_0x487c4c[_0x4078('0x1c')](_0x4b382d)[_0x4078('0x2a')](_0x309b9b);};}function getImapHost(_0x14c5d7){switch(_0x14c5d7){case'gmail':return _0x4078('0x2b');case _0x4078('0x2c'):return _0x4078('0x2d');case _0x4078('0x2e'):return _0x4078('0x2f');case _0x4078('0x30'):return _0x4078('0x31');}throw new Error('Unknown\x20email\x20service\x20provider',_0x14c5d7);}function getSmtpHost(_0x2771be){switch(_0x2771be){case _0x4078('0x32'):return _0x4078('0x33');case'yahoo':return _0x4078('0x34');case _0x4078('0x2e'):return _0x4078('0x35');case'outlook365':return _0x4078('0x36');}throw new Error(_0x4078('0x37'),_0x2771be);}function getAuthenticationOptions(_0x17fe20,_0x488460){var _0x3a3de6={};var _0x9052af={};if(_0x17fe20){_0x3a3de6[_0x4078('0x38')]=_0x9052af[_0x4078('0x38')]=_0x488460[_0x4078('0x39')];_0x3a3de6[_0x4078('0x3a')]=_0x9052af[_0x4078('0x3b')]=_0x488460[_0x4078('0x3a')];if(_0x488460[_0x4078('0x3c')]){_0x3a3de6['modernAuthentication']=_0x9052af[_0x4078('0x3c')]=!![];_0x3a3de6['CloudProviderId']=_0x9052af[_0x4078('0x3d')]=_0x488460[_0x4078('0x3d')];_0x3a3de6['password']=_0x9052af[_0x4078('0x3b')]=null;}else{_0x3a3de6[_0x4078('0x3d')]=_0x9052af['CloudProviderId']=null;}_0x3a3de6['host']=getImapHost(_0x17fe20);_0x3a3de6[_0x4078('0x3e')]=0x3e1;_0x9052af['host']=getSmtpHost(_0x17fe20);_0x9052af[_0x4078('0x3e')]=0x24b;_0x9052af[_0x4078('0x3f')]=![];_0x3a3de6[_0x4078('0x40')]=_0x9052af[_0x4078('0x40')]=null;}else{if(_0x488460[_0x4078('0x41')]){_0x3a3de6['user']=_0x9052af[_0x4078('0x38')]=_0x488460[_0x4078('0x39')];_0x3a3de6[_0x4078('0x3a')]=_0x9052af[_0x4078('0x3b')]=_0x488460[_0x4078('0x3a')];}else{_0x3a3de6[_0x4078('0x41')]=_0x9052af[_0x4078('0x41')]=![];_0x3a3de6[_0x4078('0x38')]=_0x9052af['user']=null;_0x3a3de6[_0x4078('0x3a')]=_0x9052af[_0x4078('0x3b')]=null;}_0x3a3de6[_0x4078('0x42')]=_0x488460[_0x4078('0x43')]['host'];_0x3a3de6[_0x4078('0x3e')]=_0x488460['Imap']['port'];_0x9052af['host']=_0x488460['Smtp'][_0x4078('0x42')];_0x9052af[_0x4078('0x3e')]=_0x488460[_0x4078('0x44')][_0x4078('0x3e')];}return{'Imap':_0x3a3de6,'Smtp':_0x9052af};}exports['index']=function(_0x4559b8,_0x531b99){var _0x75763c={'include':[{'model':db[_0x4078('0x45')],'as':_0x4078('0x43')},{'model':db[_0x4078('0x46')],'as':_0x4078('0x44')},{'model':db[_0x4078('0x47')],'as':_0x4078('0x48')}]},_0x582a21={},_0x779dee={'count':0x0,'rows':[]};var _0x598ece=_[_0x4078('0x49')](db[_0x4078('0x4a')]['rawAttributes'],function(_0x5cc303){return{'name':_0x5cc303[_0x4078('0x4b')],'type':_0x5cc303[_0x4078('0x4c')][_0x4078('0x4d')]};});_0x582a21['model']=_[_0x4078('0x49')](_0x598ece,_0x4078('0x29'));_0x582a21['query']=_[_0x4078('0x4e')](_0x4559b8[_0x4078('0x4f')]);_0x582a21[_0x4078('0x50')]=_[_0x4078('0x51')](_0x582a21['model'],_0x582a21[_0x4078('0x4f')]);_0x75763c['attributes']=_[_0x4078('0x51')](_0x582a21[_0x4078('0x52')],qs[_0x4078('0x53')](_0x4559b8[_0x4078('0x4f')][_0x4078('0x53')]));_0x75763c[_0x4078('0x54')]=_0x75763c[_0x4078('0x54')][_0x4078('0x55')]?_0x75763c[_0x4078('0x54')]:_0x582a21[_0x4078('0x52')];if(!_0x4559b8[_0x4078('0x4f')][_0x4078('0x56')]('nolimit')){_0x75763c['limit']=qs[_0x4078('0x21')](_0x4559b8[_0x4078('0x4f')][_0x4078('0x21')]);_0x75763c[_0x4078('0x1e')]=qs[_0x4078('0x1e')](_0x4559b8[_0x4078('0x4f')][_0x4078('0x1e')]);}_0x75763c['order']=qs[_0x4078('0x57')](_0x4559b8[_0x4078('0x4f')][_0x4078('0x57')]);_0x75763c[_0x4078('0x58')]=qs[_0x4078('0x50')](_[_0x4078('0x59')](_0x4559b8[_0x4078('0x4f')],_0x582a21['filters']),_0x598ece);if(_0x4559b8['query'][_0x4078('0x5a')]){_0x75763c[_0x4078('0x58')]=_[_0x4078('0x5b')](_0x75763c['where'],{'$or':_['map'](_0x598ece,function(_0x2209df){if(_0x2209df[_0x4078('0x4c')]!==_0x4078('0x5c')){var _0x4a589a={};_0x4a589a[_0x2209df['name']]={'$like':'%'+_0x4559b8[_0x4078('0x4f')][_0x4078('0x5a')]+'%'};return _0x4a589a;}})});}_0x75763c=_[_0x4078('0x5b')]({},_0x75763c,_0x4559b8['options']);var _0x25039e={'where':_0x75763c[_0x4078('0x58')]};return db[_0x4078('0x4a')][_0x4078('0x20')](_0x25039e)[_0x4078('0x10')](function(_0x3c4118){_0x779dee[_0x4078('0x20')]=_0x3c4118;if(_0x4559b8['query'][_0x4078('0x5d')]){_0x75763c[_0x4078('0x5e')]=[{'all':!![]}];}return db[_0x4078('0x4a')][_0x4078('0x5f')](_0x75763c);})[_0x4078('0x10')](function(_0x5a85a8){_0x779dee['rows']=_0x5a85a8;return _0x779dee;})[_0x4078('0x10')](respondWithFilteredResult(_0x531b99,_0x75763c))[_0x4078('0x1a')](handleError(_0x531b99,null));};exports['show']=function(_0x4093e8,_0x2673f7){var _0x2a0467={'raw':![],'where':{'id':_0x4093e8[_0x4078('0x60')]['id']},'include':[{'model':db[_0x4078('0x45')],'as':_0x4078('0x43')},{'model':db[_0x4078('0x46')],'as':'Smtp'},{'model':db[_0x4078('0x47')],'as':_0x4078('0x48')}]},_0x11ab67={};_0x11ab67[_0x4078('0x52')]=_[_0x4078('0x4e')](db[_0x4078('0x4a')][_0x4078('0x61')]);_0x11ab67[_0x4078('0x4f')]=_[_0x4078('0x4e')](_0x4093e8[_0x4078('0x4f')]);_0x11ab67[_0x4078('0x50')]=_[_0x4078('0x51')](_0x11ab67[_0x4078('0x52')],_0x11ab67[_0x4078('0x4f')]);_0x2a0467[_0x4078('0x54')]=_[_0x4078('0x51')](_0x11ab67[_0x4078('0x52')],qs[_0x4078('0x53')](_0x4093e8[_0x4078('0x4f')][_0x4078('0x53')]));_0x2a0467[_0x4078('0x54')]=_0x2a0467[_0x4078('0x54')]['length']?_0x2a0467[_0x4078('0x54')]:_0x11ab67[_0x4078('0x52')];if(_0x4093e8[_0x4078('0x4f')][_0x4078('0x5d')]){_0x2a0467[_0x4078('0x5e')]=[{'all':!![]}];}_0x2a0467=_[_0x4078('0x5b')]({},_0x2a0467,_0x4093e8[_0x4078('0x62')]);return db[_0x4078('0x4a')]['find'](_0x2a0467)[_0x4078('0x10')](handleEntityNotFound(_0x2673f7,null))[_0x4078('0x10')](respondWithResult(_0x2673f7,null))[_0x4078('0x1a')](handleError(_0x2673f7,null));};exports[_0x4078('0x23')]=function(_0x58eafc,_0x35134f){if(_0x58eafc[_0x4078('0x63')]['id']){delete _0x58eafc['body']['id'];}var _0x2a314a=_0x58eafc['body'][_0x4078('0x64')]==='custom'?null:_0x58eafc[_0x4078('0x63')]['provider'];var _0x22b43c=_0x58eafc[_0x4078('0x63')][_0x4078('0x43')]||{};var _0x2f30ed=_0x58eafc[_0x4078('0x63')][_0x4078('0x44')]||{};if(_0x2a314a){_0x22b43c[_0x4078('0x42')]=getImapHost(_0x2a314a);_0x22b43c[_0x4078('0x3e')]=0x3e1;_0x2f30ed[_0x4078('0x42')]=getSmtpHost(_0x2a314a);_0x2f30ed[_0x4078('0x3e')]=0x24b;_0x2f30ed[_0x4078('0x3f')]=![];}if(_0x2f30ed[_0x4078('0x3c')]){_0x2f30ed[_0x4078('0x3f')]=![];}else{_0x2f30ed[_0x4078('0x3d')]=null;}if(!_0x22b43c[_0x4078('0x3c')])_0x22b43c[_0x4078('0x3d')]=null;_0x58eafc[_0x4078('0x63')][_0x4078('0x43')]=_0x22b43c;_0x58eafc[_0x4078('0x63')][_0x4078('0x44')]=_0x2f30ed;return db[_0x4078('0x4a')][_0x4078('0x65')]({'where':{'id':_0x58eafc[_0x4078('0x60')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x4078('0x43')},{'model':db[_0x4078('0x46')],'as':'Smtp'},{'model':db['Pause'],'as':_0x4078('0x48')}]})[_0x4078('0x10')](handleEntityNotFound(_0x35134f,null))[_0x4078('0x10')](function(_0x4c4107){if(!_0x4c4107)throw new Error(_0x4078('0x66'));if(_0x4c4107['service'])delete _0x58eafc[_0x4078('0x63')]['Imap'];return _0x4c4107;})[_0x4078('0x10')](saveUpdates(_0x58eafc['body'],null))[_0x4078('0x10')](function(_0x54a718){if(!_0x58eafc[_0x4078('0x63')][_0x4078('0x43')])return _0x54a718;return db[_0x4078('0x45')][_0x4078('0x23')](_0x58eafc[_0x4078('0x63')]['Imap'],{'where':{'MailAccountId':_0x54a718['id']}})[_0x4078('0x10')](function(){return _0x54a718;});})['then'](function(_0x9a1922){if(!_0x58eafc[_0x4078('0x63')][_0x4078('0x44')])return _0x9a1922;return db[_0x4078('0x46')][_0x4078('0x23')](_0x58eafc[_0x4078('0x63')]['Smtp'],{'where':{'MailAccountId':_0x9a1922['id']}})[_0x4078('0x10')](function(){return _0x9a1922;});})[_0x4078('0x10')](respondWithResult(_0x35134f,null))[_0x4078('0x1a')](handleError(_0x35134f,null));};exports[_0x4078('0x67')]=function(_0x1b9de7,_0x22b63b){return db['MailAccount'][_0x4078('0x67')]()['then'](respondWithResult(_0x22b63b,null))[_0x4078('0x1a')](handleError(_0x22b63b,null));};exports['addDisposition']=function(_0x468598,_0x58ce56){if(_0x468598['body']['id']){delete _0x468598[_0x4078('0x63')]['id'];}return db[_0x4078('0x4a')][_0x4078('0x65')]({'where':{'id':_0x468598[_0x4078('0x60')]['id']}})[_0x4078('0x10')](handleEntityNotFound(_0x58ce56,null))[_0x4078('0x10')](function(_0x4912cf){if(_0x4912cf){_0x468598[_0x4078('0x63')][_0x4078('0x68')]=_0x4912cf['id'];return db['Disposition'][_0x4078('0x69')](_0x468598[_0x4078('0x63')]);}})[_0x4078('0x10')](respondWithResult(_0x58ce56,null))['catch'](handleError(_0x58ce56,null));};exports['getDispositions']=function(_0x1f9f03,_0x1af96d){var _0x2717d0={'raw':![],'where':{}};var _0x584e2d={};var _0x1e4899={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x1f9f03[_0x4078('0x60')]['id']}})[_0x4078('0x10')](handleEntityNotFound(_0x1af96d,null))[_0x4078('0x10')](function(_0x18abb6){if(_0x18abb6){_0x584e2d[_0x4078('0x52')]=_[_0x4078('0x4e')](db[_0x4078('0x6a')][_0x4078('0x61')]);_0x584e2d[_0x4078('0x4f')]=_['keys'](_0x1f9f03['query']);_0x584e2d[_0x4078('0x50')]=_[_0x4078('0x51')](_0x584e2d[_0x4078('0x52')],_0x584e2d[_0x4078('0x4f')]);_0x2717d0[_0x4078('0x54')]=_[_0x4078('0x51')](_0x584e2d[_0x4078('0x52')],qs[_0x4078('0x53')](_0x1f9f03['query'][_0x4078('0x53')]));_0x2717d0[_0x4078('0x54')]=_0x2717d0[_0x4078('0x54')][_0x4078('0x55')]?_0x2717d0[_0x4078('0x54')]:_0x584e2d['model'];if(!_0x1f9f03['query'][_0x4078('0x56')](_0x4078('0x6b'))){_0x2717d0[_0x4078('0x21')]=qs[_0x4078('0x21')](_0x1f9f03[_0x4078('0x4f')][_0x4078('0x21')]);_0x2717d0[_0x4078('0x1e')]=qs[_0x4078('0x1e')](_0x1f9f03[_0x4078('0x4f')]['offset']);}_0x2717d0['order']=qs[_0x4078('0x57')](_0x1f9f03[_0x4078('0x4f')][_0x4078('0x57')]);_0x2717d0[_0x4078('0x58')]=qs[_0x4078('0x50')](_[_0x4078('0x59')](_0x1f9f03[_0x4078('0x4f')],_0x584e2d[_0x4078('0x50')]));_0x2717d0[_0x4078('0x58')][_0x4078('0x68')]=_0x18abb6['id'];if(_0x1f9f03[_0x4078('0x4f')][_0x4078('0x5a')]){_0x2717d0['where']=_[_0x4078('0x5b')](_0x2717d0[_0x4078('0x58')],{'$or':_[_0x4078('0x49')](_0x2717d0[_0x4078('0x54')],function(_0x12b13d){var _0x22a7c3={};_0x22a7c3[_0x12b13d]={'$like':'%'+_0x1f9f03[_0x4078('0x4f')][_0x4078('0x5a')]+'%'};return _0x22a7c3;})});}_0x2717d0=_['merge']({},_0x2717d0,_0x1f9f03[_0x4078('0x62')]);return db[_0x4078('0x6a')]['count']({'where':_0x2717d0[_0x4078('0x58')]})[_0x4078('0x10')](function(_0x2039ac){_0x1e4899[_0x4078('0x20')]=_0x2039ac;if(_0x1f9f03[_0x4078('0x4f')][_0x4078('0x5d')]){_0x2717d0[_0x4078('0x5e')]=[{'all':!![]}];}return db[_0x4078('0x6a')]['findAll'](_0x2717d0);})['then'](function(_0x3ddf24){_0x1e4899[_0x4078('0x6c')]=_0x3ddf24;return _0x1e4899;});}})[_0x4078('0x10')](respondWithFilteredResult(_0x1af96d,_0x2717d0))[_0x4078('0x1a')](handleError(_0x1af96d,null));};exports[_0x4078('0x6d')]=function(_0x30d46f,_0x1b029){return db[_0x4078('0x4a')][_0x4078('0x65')]({'where':{'id':_0x30d46f[_0x4078('0x60')]['id']}})[_0x4078('0x10')](handleEntityNotFound(_0x1b029,null))['then'](function(_0x86ece6){if(_0x86ece6){return _0x86ece6[_0x4078('0x6d')](_0x30d46f[_0x4078('0x4f')][_0x4078('0x6e')]);}})[_0x4078('0x10')](respondWithStatusCode(_0x1b029,null))[_0x4078('0x1a')](handleError(_0x1b029,null));};exports[_0x4078('0x6f')]=function(_0x41f4cb,_0x24e10d){if(_0x41f4cb['body']['id']){delete _0x41f4cb[_0x4078('0x63')]['id'];}return db[_0x4078('0x4a')][_0x4078('0x65')]({'where':{'id':_0x41f4cb[_0x4078('0x60')]['id']}})[_0x4078('0x10')](handleEntityNotFound(_0x24e10d,null))['then'](function(_0x166fa6){if(_0x166fa6){_0x41f4cb[_0x4078('0x63')]['MailAccountId']=_0x166fa6['id'];return db['CannedAnswer'][_0x4078('0x69')](_0x41f4cb[_0x4078('0x63')]);}})['then'](respondWithResult(_0x24e10d,null))['catch'](handleError(_0x24e10d,null));};exports['getAnswers']=function(_0x56223d,_0x405f58){var _0x4e4c72={'raw':![],'where':{}};var _0x384dbb={};var _0x13dfea={'count':0x0,'rows':[]};return db[_0x4078('0x4a')][_0x4078('0x70')]({'where':{'id':_0x56223d[_0x4078('0x60')]['id']}})['then'](handleEntityNotFound(_0x405f58,null))[_0x4078('0x10')](function(_0x5705b2){if(_0x5705b2){_0x384dbb[_0x4078('0x52')]=_[_0x4078('0x4e')](db['CannedAnswer'][_0x4078('0x61')]);_0x384dbb[_0x4078('0x4f')]=_[_0x4078('0x4e')](_0x56223d[_0x4078('0x4f')]);_0x384dbb['filters']=_[_0x4078('0x51')](_0x384dbb['model'],_0x384dbb[_0x4078('0x4f')]);_0x4e4c72['attributes']=_[_0x4078('0x51')](_0x384dbb['model'],qs[_0x4078('0x53')](_0x56223d[_0x4078('0x4f')][_0x4078('0x53')]));_0x4e4c72['attributes']=_0x4e4c72[_0x4078('0x54')]['length']?_0x4e4c72[_0x4078('0x54')]:_0x384dbb['model'];if(!_0x56223d[_0x4078('0x4f')][_0x4078('0x56')](_0x4078('0x6b'))){_0x4e4c72[_0x4078('0x21')]=qs['limit'](_0x56223d['query']['limit']);_0x4e4c72[_0x4078('0x1e')]=qs[_0x4078('0x1e')](_0x56223d[_0x4078('0x4f')][_0x4078('0x1e')]);}_0x4e4c72[_0x4078('0x71')]=qs[_0x4078('0x57')](_0x56223d[_0x4078('0x4f')][_0x4078('0x57')]);_0x4e4c72[_0x4078('0x58')]=qs['filters'](_[_0x4078('0x59')](_0x56223d[_0x4078('0x4f')],_0x384dbb[_0x4078('0x50')]));_0x4e4c72[_0x4078('0x58')][_0x4078('0x68')]=_0x5705b2['id'];if(_0x56223d[_0x4078('0x4f')][_0x4078('0x5a')]){_0x4e4c72[_0x4078('0x58')]=_[_0x4078('0x5b')](_0x4e4c72[_0x4078('0x58')],{'$or':_[_0x4078('0x49')](_0x4e4c72[_0x4078('0x54')],function(_0xea94a6){var _0x52b0f8={};_0x52b0f8[_0xea94a6]={'$like':'%'+_0x56223d['query']['filter']+'%'};return _0x52b0f8;})});}_0x4e4c72=_[_0x4078('0x5b')]({},_0x4e4c72,_0x56223d[_0x4078('0x62')]);return db[_0x4078('0x72')][_0x4078('0x20')]({'where':_0x4e4c72[_0x4078('0x58')]})[_0x4078('0x10')](function(_0x3ad713){_0x13dfea[_0x4078('0x20')]=_0x3ad713;if(_0x56223d['query'][_0x4078('0x5d')]){_0x4e4c72[_0x4078('0x5e')]=[{'all':!![]}];}return db[_0x4078('0x72')]['findAll'](_0x4e4c72);})[_0x4078('0x10')](function(_0x4e988e){_0x13dfea[_0x4078('0x6c')]=_0x4e988e;return _0x13dfea;});}})[_0x4078('0x10')](respondWithFilteredResult(_0x405f58,_0x4e4c72))[_0x4078('0x1a')](handleError(_0x405f58,null));};exports[_0x4078('0x73')]=function(_0x3ab1a1,_0x42ae2e){return db[_0x4078('0x4a')][_0x4078('0x65')]({'where':{'id':_0x3ab1a1[_0x4078('0x60')]['id']}})[_0x4078('0x10')](handleEntityNotFound(_0x42ae2e,null))[_0x4078('0x10')](function(_0x234957){if(_0x234957){return _0x234957[_0x4078('0x73')](_0x3ab1a1[_0x4078('0x4f')][_0x4078('0x6e')]);}})[_0x4078('0x10')](respondWithStatusCode(_0x42ae2e,null))[_0x4078('0x1a')](handleError(_0x42ae2e,null));};exports[_0x4078('0x69')]=function(_0x4d1dca,_0x5d083d){var _0xd27f22={'name':_0x4d1dca[_0x4078('0x63')][_0x4078('0x29')],'key':_0x4d1dca['body'][_0x4078('0x4d')],'provider':_0x4d1dca['body']['provider']===_0x4078('0x74')?null:_0x4d1dca['body'][_0x4078('0x64')],'email':_0x4d1dca[_0x4078('0x63')][_0x4078('0x75')],'ListId':_0x4d1dca[_0x4078('0x63')][_0x4078('0x76')],'active':!_[_0x4078('0x77')](_0x4d1dca[_0x4078('0x63')][_0x4078('0x78')])?_0x4d1dca[_0x4078('0x63')][_0x4078('0x78')]:!![],'description':_0x4d1dca[_0x4078('0x63')][_0x4078('0x79')]||null};var _0x508aa5=getAuthenticationOptions(_0xd27f22[_0x4078('0x64')],_0x4d1dca[_0x4078('0x63')]);_0xd27f22[_0x4078('0x43')]=_0x508aa5[_0x4078('0x43')];_0xd27f22[_0x4078('0x44')]=_0x508aa5['Smtp'];return db[_0x4078('0x4a')][_0x4078('0x69')](_0xd27f22,{'include':[{'model':db[_0x4078('0x46')],'as':_0x4078('0x44')},{'model':db[_0x4078('0x45')],'as':_0x4078('0x43')}]})[_0x4078('0x10')](function(_0x4a3339){var _0x39da9c=_0x4d1dca[_0x4078('0x38')][_0x4078('0x25')]({'plain':!![]});if(!_0x39da9c)throw new Error(_0x4078('0x7a'));if(_0x39da9c[_0x4078('0x7b')]===_0x4078('0x38')){var _0xc4c3d3=_0x4a3339[_0x4078('0x25')]({'plain':!![]});return db[_0x4078('0x7c')][_0x4078('0x65')]({'where':{'name':_0x4078('0x7d'),'userProfileId':_0x39da9c[_0x4078('0x7e')]},'raw':!![]})[_0x4078('0x10')](function(_0x27e3db){if(_0x27e3db&&_0x27e3db[_0x4078('0x7f')]===0x0){return db[_0x4078('0x26')][_0x4078('0x69')]({'name':_0xc4c3d3[_0x4078('0x29')],'resourceId':_0xc4c3d3['id'],'type':_0x27e3db['name'],'sectionId':_0x27e3db['id']},{})['then'](function(){return _0x4a3339;});}else{return _0x4a3339;}})[_0x4078('0x1a')](function(_0x43cae6){logger[_0x4078('0x15')](_0x4078('0x80'),_0x43cae6);throw _0x43cae6;});}return _0x4a3339;})[_0x4078('0x10')](respondWithResult(_0x5d083d,0xc9))['catch'](handleError(_0x5d083d,null));};exports['getImap']=function(_0x11d323,_0x473e82){return db['MailAccount'][_0x4078('0x70')]({'where':{'id':_0x11d323[_0x4078('0x60')]['id']}})[_0x4078('0x10')](handleEntityNotFound(_0x473e82,null))[_0x4078('0x10')](function(_0x5d04c4){if(_0x5d04c4){return _0x5d04c4[_0x4078('0x81')]();}return null;})[_0x4078('0x10')](respondWithResult(_0x473e82,null))[_0x4078('0x1a')](handleError(_0x473e82,null));};exports[_0x4078('0x82')]=function(_0x43fde3,_0x467dcb){if(_0x43fde3[_0x4078('0x63')]['id']){delete _0x43fde3[_0x4078('0x63')]['id'];}return db[_0x4078('0x4a')]['find']({'where':{'id':_0x43fde3['params']['id']}})[_0x4078('0x10')](handleEntityNotFound(_0x467dcb,null))['then'](function(_0x413ded){if(_0x413ded){_0x43fde3['body'][_0x4078('0x68')]=_0x413ded['id'];return db[_0x4078('0x45')][_0x4078('0x69')](_0x43fde3['body']);}})['then'](respondWithResult(_0x467dcb,null))[_0x4078('0x1a')](handleError(_0x467dcb,null));};exports[_0x4078('0x83')]=function(_0x215aaa,_0x311853){return db['MailAccount'][_0x4078('0x70')]({'where':{'id':_0x215aaa[_0x4078('0x60')]['id']}})[_0x4078('0x10')](handleEntityNotFound(_0x311853,null))['then'](function(_0x2f6db3){if(_0x2f6db3){return _0x2f6db3['setImap'](null);}return null;})[_0x4078('0x10')](respondWithStatusCode(_0x311853,null))['catch'](handleError(_0x311853,null));};exports[_0x4078('0x84')]=function(_0x368255,_0x4fabd6){return db[_0x4078('0x4a')][_0x4078('0x70')]({'where':{'id':_0x368255[_0x4078('0x60')]['id']}})['then'](handleEntityNotFound(_0x4fabd6,null))[_0x4078('0x10')](function(_0x26a753){if(_0x26a753){return _0x26a753['getSmtp']();}return null;})[_0x4078('0x10')](respondWithResult(_0x4fabd6,null))[_0x4078('0x1a')](handleError(_0x4fabd6,null));};exports[_0x4078('0x85')]=function(_0x490c7f,_0x17bc7b){if(_0x490c7f[_0x4078('0x63')]['id']){delete _0x490c7f['body']['id'];}return db['MailAccount'][_0x4078('0x65')]({'where':{'id':_0x490c7f[_0x4078('0x60')]['id']}})['then'](handleEntityNotFound(_0x17bc7b,null))[_0x4078('0x10')](function(_0x309839){if(_0x309839){_0x490c7f[_0x4078('0x63')][_0x4078('0x68')]=_0x309839['id'];return db[_0x4078('0x46')][_0x4078('0x69')](_0x490c7f[_0x4078('0x63')]);}})['then'](respondWithResult(_0x17bc7b,null))[_0x4078('0x1a')](handleError(_0x17bc7b,null));};exports[_0x4078('0x86')]=function(_0x3ca4fa,_0x3f4dd5){return db[_0x4078('0x4a')][_0x4078('0x70')]({'where':{'id':_0x3ca4fa[_0x4078('0x60')]['id']}})[_0x4078('0x10')](handleEntityNotFound(_0x3f4dd5,null))[_0x4078('0x10')](function(_0x2492ca){if(_0x2492ca){return _0x2492ca['setSmtp'](null);}return null;})[_0x4078('0x10')](respondWithStatusCode(_0x3f4dd5,null))[_0x4078('0x1a')](handleError(_0x3f4dd5,null));};exports[_0x4078('0x87')]=function(_0x30f04c,_0x4d62a9){return db['MailInteraction']['find']({'where':{'id':_0x30f04c[_0x4078('0x60')]['id']}})[_0x4078('0x10')](handleEntityNotFound(_0x4d62a9,null))[_0x4078('0x10')](function(_0x331ed0){if(_0x331ed0){return _0x331ed0['addInteraction'](_0x30f04c[_0x4078('0x63')][_0x4078('0x6e')],_[_0x4078('0x88')](_0x30f04c[_0x4078('0x63')],[_0x4078('0x6e'),'id'])||{});}})[_0x4078('0x10')](respondWithResult(_0x4d62a9,null))[_0x4078('0x1a')](handleError(_0x4d62a9,null));};exports[_0x4078('0x89')]=function(_0x2ea821,_0x23fce5){var _0x2fab64={'raw':![],'where':{}};var _0x570cd1={};var _0x1dee69={'count':0x0,'rows':[]};return db[_0x4078('0x4a')][_0x4078('0x70')]({'where':{'id':_0x2ea821['params']['id']}})['then'](handleEntityNotFound(_0x23fce5,null))['then'](function(_0x578b39){if(_0x578b39){_0x570cd1[_0x4078('0x52')]=_[_0x4078('0x4e')](db[_0x4078('0x8a')]['rawAttributes']);_0x570cd1[_0x4078('0x4f')]=_['keys'](_0x2ea821[_0x4078('0x4f')]);_0x570cd1['filters']=_[_0x4078('0x51')](_0x570cd1['model'],_0x570cd1[_0x4078('0x4f')]);_0x2fab64[_0x4078('0x54')]=_[_0x4078('0x51')](_0x570cd1['model'],qs[_0x4078('0x53')](_0x2ea821[_0x4078('0x4f')][_0x4078('0x53')]));_0x2fab64['attributes']=_0x2fab64['attributes'][_0x4078('0x55')]?_0x2fab64[_0x4078('0x54')]:_0x570cd1[_0x4078('0x52')];if(!_0x2ea821['query'][_0x4078('0x56')](_0x4078('0x6b'))){_0x2fab64['limit']=qs[_0x4078('0x21')](_0x2ea821['query'][_0x4078('0x21')]);_0x2fab64[_0x4078('0x1e')]=qs[_0x4078('0x1e')](_0x2ea821[_0x4078('0x4f')][_0x4078('0x1e')]);}_0x2fab64['order']=qs[_0x4078('0x57')](_0x2ea821[_0x4078('0x4f')][_0x4078('0x57')]);_0x2fab64[_0x4078('0x58')]=qs['filters'](_['pick'](_0x2ea821[_0x4078('0x4f')],_0x570cd1[_0x4078('0x50')]));_0x2fab64['where']['MailAccountId']=_0x578b39['id'];if(_0x2ea821[_0x4078('0x4f')][_0x4078('0x5a')]){_0x2fab64[_0x4078('0x58')]=_[_0x4078('0x5b')](_0x2fab64[_0x4078('0x58')],{'$or':_[_0x4078('0x49')](_0x2fab64['attributes'],function(_0x96defd){var _0x10a19c={};_0x10a19c[_0x96defd]={'$like':'%'+_0x2ea821[_0x4078('0x4f')][_0x4078('0x5a')]+'%'};return _0x10a19c;})});}_0x2fab64=_[_0x4078('0x5b')]({},_0x2fab64,_0x2ea821[_0x4078('0x62')]);return db[_0x4078('0x8a')][_0x4078('0x20')]({'where':_0x2fab64['where']})[_0x4078('0x10')](function(_0x2a0949){_0x1dee69[_0x4078('0x20')]=_0x2a0949;if(_0x2ea821[_0x4078('0x4f')]['includeAll']){_0x2fab64[_0x4078('0x5e')]=[{'model':db[_0x4078('0x8b')],'as':_0x4078('0x8c'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x4078('0x29'),'fullname','internal'],'required':![]},{'model':db[_0x4078('0x8d')],'as':_0x4078('0x8e'),'attributes':['id',_0x4078('0x29'),'color'],'where':_0x2ea821[_0x4078('0x4f')][_0x4078('0x8f')]?{'id':_0x2ea821[_0x4078('0x4f')]['tag']}:undefined,'required':_0x2ea821[_0x4078('0x4f')][_0x4078('0x8f')]?!![]:![]}];}return db[_0x4078('0x8a')][_0x4078('0x5f')](_0x2fab64);})[_0x4078('0x10')](function(_0x2ae127){_0x1dee69[_0x4078('0x6c')]=_0x2ae127;return _0x1dee69;});}})[_0x4078('0x10')](respondWithFilteredResult(_0x23fce5,_0x2fab64))[_0x4078('0x1a')](handleError(_0x23fce5,null));};exports[_0x4078('0x90')]=function addApplications(_0x327563,_0x5122a5){var _0x55e40c=_0x327563[_0x4078('0x60')]['id'];var _0x3c9c01=_0x327563['body'];var _0x32d854=0xc8;var _0x5df682=null;return db[_0x4078('0x91')][_0x4078('0x92')]({'isolationLevel':db[_0x4078('0x91')][_0x4078('0x93')][_0x4078('0x94')]['READ_COMMITTED']},function(_0x2f9207){return db[_0x4078('0x4a')][_0x4078('0x70')]({'where':{'id':_0x55e40c},'transaction':_0x2f9207})['then'](function(_0x4bc7cc){if(_0x4bc7cc){return db['MailApplication'][_0x4078('0x24')]({'where':{'MailAccountId':_0x55e40c},'transaction':_0x2f9207})[_0x4078('0x10')](function(){var _0x28d9f2=_['map'](_0x3c9c01,function(_0x35e1e7){_0x35e1e7['MailAccountId']=_0x55e40c;return _0x35e1e7;});return db[_0x4078('0x95')][_0x4078('0x96')](_0x28d9f2,{'transaction':_0x2f9207});});}else{_0x32d854=0x194;_0x5df682=[];}});})[_0x4078('0x10')](function(){if(_0x32d854!==0x194){return db[_0x4078('0x95')][_0x4078('0x97')]({'where':{'MailAccountId':_0x55e40c},'order':'priority'})['then'](function(_0x22da9f){_0x5df682=_0x22da9f;});}})['catch'](function(_0x30385e){_0x32d854=0x1f4;logger[_0x4078('0x15')](_0x30385e[_0x4078('0x28')]);if(_0x30385e['name']){delete _0x30385e[_0x4078('0x29')];}_0x5df682=_0x30385e;})[_0x4078('0x98')](function(){if(_0x5df682===null){_0x5122a5['sendStatus'](_0x32d854);}else{if(_0x32d854===0x1f4){_0x5122a5['status'](_0x32d854)[_0x4078('0x2a')](_0x5df682);}else{_0x5122a5['status'](_0x32d854)[_0x4078('0x1d')](_0x5df682);}}});};exports['getApplications']=function(_0x314a2c,_0x1ca406){var _0x177330={};var _0x2d9baf={};var _0x221b83;var _0x1bd138;return db[_0x4078('0x4a')][_0x4078('0x70')]({'where':{'id':_0x314a2c[_0x4078('0x60')]['id']}})['then'](handleEntityNotFound(_0x1ca406,null))[_0x4078('0x10')](function(_0x4468a7){if(_0x4468a7){_0x221b83=_0x4468a7;_0x2d9baf[_0x4078('0x52')]=_[_0x4078('0x4e')](db['MailApplication']['rawAttributes']);_0x2d9baf[_0x4078('0x4f')]=_['keys'](_0x314a2c[_0x4078('0x4f')]);_0x2d9baf[_0x4078('0x50')]=_[_0x4078('0x51')](_0x2d9baf[_0x4078('0x52')],_0x2d9baf[_0x4078('0x4f')]);_0x177330['attributes']=_[_0x4078('0x51')](_0x2d9baf['model'],qs[_0x4078('0x53')](_0x314a2c[_0x4078('0x4f')][_0x4078('0x53')]));_0x177330[_0x4078('0x54')]=_0x177330[_0x4078('0x54')]['length']?_0x177330[_0x4078('0x54')]:_0x2d9baf[_0x4078('0x52')];_0x177330[_0x4078('0x71')]=qs[_0x4078('0x57')](_0x314a2c[_0x4078('0x4f')][_0x4078('0x57')]);_0x177330[_0x4078('0x58')]=qs[_0x4078('0x50')](_[_0x4078('0x59')](_0x314a2c['query'],_0x2d9baf[_0x4078('0x50')]));if(_0x314a2c['query'][_0x4078('0x5a')]){_0x177330['where']=_[_0x4078('0x5b')](_0x177330[_0x4078('0x58')],{'$or':_[_0x4078('0x49')](_0x177330['attributes'],function(_0x5e370d){var _0x5bb713={};_0x5bb713[_0x5e370d]={'$like':'%'+_0x314a2c['query'][_0x4078('0x5a')]+'%'};return _0x5bb713;})});}_0x177330=_[_0x4078('0x5b')]({},_0x177330,_0x314a2c['options']);return _0x221b83['getApplications'](_0x177330);}})[_0x4078('0x10')](function(_0x238e1a){if(_0x238e1a){_0x1bd138=_0x238e1a[_0x4078('0x55')];if(!_0x314a2c[_0x4078('0x4f')][_0x4078('0x56')]('nolimit')){_0x177330[_0x4078('0x21')]=qs[_0x4078('0x21')](_0x314a2c['query'][_0x4078('0x21')]);_0x177330[_0x4078('0x1e')]=qs['offset'](_0x314a2c[_0x4078('0x4f')]['offset']);}return _0x221b83['getApplications'](_0x177330);}})[_0x4078('0x10')](function(_0x5f378a){if(_0x5f378a){return _0x5f378a?{'count':_0x1bd138,'rows':_0x5f378a}:null;}})[_0x4078('0x10')](respondWithResult(_0x1ca406,null))[_0x4078('0x1a')](handleError(_0x1ca406,null));};exports[_0x4078('0x99')]=function(_0x3aaf6a,_0x5e7edb){var _0x449650={'raw':!![],'where':{}};var _0x144afa={};var _0x1e52c4={'count':0x0,'rows':[]};return db['MailAccount'][_0x4078('0x70')]({'where':{'id':_0x3aaf6a[_0x4078('0x60')]['id']}})[_0x4078('0x10')](handleEntityNotFound(_0x5e7edb,null))[_0x4078('0x10')](function(_0x3ce9a7){if(_0x3ce9a7){_0x144afa[_0x4078('0x52')]=_[_0x4078('0x4e')](db[_0x4078('0x9a')]['rawAttributes']);_0x144afa[_0x4078('0x4f')]=_[_0x4078('0x4e')](_0x3aaf6a[_0x4078('0x4f')]);_0x144afa[_0x4078('0x50')]=_[_0x4078('0x51')](_0x144afa[_0x4078('0x52')],_0x144afa[_0x4078('0x4f')]);_0x449650[_0x4078('0x54')]=_[_0x4078('0x51')](_0x144afa['model'],qs[_0x4078('0x53')](_0x3aaf6a[_0x4078('0x4f')][_0x4078('0x53')]));_0x449650[_0x4078('0x54')]=_0x449650[_0x4078('0x54')][_0x4078('0x55')]?_0x449650[_0x4078('0x54')]:_0x144afa[_0x4078('0x52')];if(!_0x3aaf6a[_0x4078('0x4f')]['hasOwnProperty'](_0x4078('0x6b'))){_0x449650['limit']=qs[_0x4078('0x21')](_0x3aaf6a[_0x4078('0x4f')][_0x4078('0x21')]);_0x449650['offset']=qs[_0x4078('0x1e')](_0x3aaf6a['query'][_0x4078('0x1e')]);}_0x449650[_0x4078('0x71')]=qs[_0x4078('0x57')](_0x3aaf6a[_0x4078('0x4f')][_0x4078('0x57')]);_0x449650[_0x4078('0x58')]=qs[_0x4078('0x50')](_['pick'](_0x3aaf6a['query'],_0x144afa[_0x4078('0x50')]));_0x449650[_0x4078('0x58')][_0x4078('0x68')]=_0x3ce9a7['id'];if(_0x3aaf6a[_0x4078('0x4f')][_0x4078('0x5a')]){_0x449650[_0x4078('0x58')]=_[_0x4078('0x5b')](_0x449650['where'],{'$or':_[_0x4078('0x49')](_0x449650[_0x4078('0x54')],function(_0x51e8dc){var _0x1f1aed={};_0x1f1aed[_0x51e8dc]={'$like':'%'+_0x3aaf6a['query']['filter']+'%'};return _0x1f1aed;})});}if(_0x3aaf6a[_0x4078('0x4f')][_0x4078('0x9b')]){var _0x27c0fe=_0x3aaf6a[_0x4078('0x4f')]['$gte'][_0x4078('0x9c')](',');var _0x4ea781={};_0x4ea781[_0x27c0fe[0x0]]={'$gte':moment(_0x27c0fe[0x1])[_0x4078('0x9d')](_0x4078('0x9e'))};_0x449650[_0x4078('0x58')]=_['merge'](_0x449650[_0x4078('0x58')],_0x4ea781);}_0x449650=_[_0x4078('0x5b')]({},_0x449650,_0x3aaf6a['options']);return db[_0x4078('0x9a')][_0x4078('0x20')]({'where':_0x449650[_0x4078('0x58')]})[_0x4078('0x10')](function(_0x8773d9){_0x1e52c4[_0x4078('0x20')]=_0x8773d9;if(_0x3aaf6a[_0x4078('0x4f')][_0x4078('0x5d')]){_0x449650[_0x4078('0x5e')]=[{'all':!![]}];}return db[_0x4078('0x9a')][_0x4078('0x5f')](_0x449650);})[_0x4078('0x10')](function(_0x60e185){if(_0x3aaf6a[_0x4078('0x4f')][_0x4078('0x9f')]==='true'){for(var _0x54cf8f=0x0;_0x54cf8f<_0x60e185[_0x4078('0x55')];_0x54cf8f++){_0x60e185[_0x54cf8f]['body']=juice(_0x60e185[_0x54cf8f][_0x4078('0x63')]);}}_0x1e52c4['rows']=_0x60e185;return _0x1e52c4;});}})[_0x4078('0x10')](respondWithFilteredResult(_0x5e7edb,_0x449650))['catch'](handleError(_0x5e7edb,null));};exports['send']=function(_0x743d38,_0x366b26){var _0x33534d,_0x5e0c47={},_0x3b225d;if(_0x743d38[_0x4078('0x63')]['to']){_0x3b225d=_0x743d38[_0x4078('0x63')]['to'][_0x4078('0x9c')](',')[0x0];}return db[_0x4078('0x4a')]['find']({'where':{'id':_0x743d38[_0x4078('0x60')]['id']},'include':[{'model':db['CmList'],'as':_0x4078('0xa0'),'include':[{'model':db['CmContact'],'as':_0x4078('0xa1'),'where':{'email':_0x3b225d},'limit':0x1,'order':[['updatedAt',_0x4078('0xa2')]]}]},{'model':db['MailServerOut'],'as':_0x4078('0x44'),'raw':!![],'include':[{'model':db[_0x4078('0xa3')],'as':_0x4078('0xa3'),'raw':!![]}]}]})[_0x4078('0x10')](handleEntityNotFound(_0x366b26,null))[_0x4078('0x10')](function(_0x18247a){if(!_0x18247a)return;_0x33534d=_0x18247a;if(!_0x18247a[_0x4078('0x44')])throw new Error(_0x4078('0xa4'));if(_['isNil'](_0x743d38['body'][_0x4078('0xa5')])){_0x743d38[_0x4078('0x63')][_0x4078('0xa5')]=util['format'](_0x4078('0xa6'),_0x18247a[_0x4078('0x29')],_0x18247a[_0x4078('0x75')]||_0x18247a[_0x4078('0x44')][_0x4078('0x38')]);}if(_0x743d38[_0x4078('0x63')][_0x4078('0xa7')]&&_0x743d38[_0x4078('0x63')][_0x4078('0xa7')][_0x4078('0x55')]){for(var _0x1aa1f9=0x0;_0x1aa1f9<_0x743d38[_0x4078('0x63')][_0x4078('0xa7')][_0x4078('0x55')];_0x1aa1f9+=0x1){_0x743d38[_0x4078('0x63')][_0x4078('0xa7')][_0x1aa1f9]={'filename':_0x743d38[_0x4078('0x63')][_0x4078('0xa7')][_0x1aa1f9]['name'],'path':path[_0x4078('0xa8')](config[_0x4078('0xa9')],_0x4078('0xaa'),_0x743d38[_0x4078('0x63')][_0x4078('0xa7')][_0x1aa1f9][_0x4078('0xab')])};}}var _0x141e02=_0x18247a[_0x4078('0xac')]();return respondWithRpcPromise('SendMail',_0x4078('0xad'),{'account':_0x141e02,'message':_0x743d38[_0x4078('0x63')]});})[_0x4078('0x10')](function(_0x1e633f){if(!_0x1e633f)return;_0x5e0c47=_0x1e633f;if(!_0x33534d[_0x4078('0xa0')])throw new Error('List\x20not\x20found');if(_0x33534d[_0x4078('0xa0')]['Contacts'][_0x4078('0x55')])return _0x33534d[_0x4078('0xa0')][_0x4078('0xa1')][0x0];return db[_0x4078('0x8b')][_0x4078('0x69')](_['defaults'](_0x743d38[_0x4078('0x63')],{'firstName':_0x743d38[_0x4078('0x63')]['to'],'email':_0x743d38['body']['to'],'phone':_0x743d38[_0x4078('0x63')]['to'],'ListId':_0x33534d[_0x4078('0x76')]}));})[_0x4078('0x10')](function(_0x368840){if(!_0x368840)return;var _0x85c019={'UserId':_0x743d38[_0x4078('0x38')]['id'],'ContactId':_0x368840['id'],'MailAccountId':_0x33534d['id'],'inReplyTo':_0x5e0c47[_0x4078('0xae')],'to':_0x743d38['body']['from'],'cc':_0x743d38[_0x4078('0x63')]['cc'],'subject':_0x743d38[_0x4078('0x63')][_0x4078('0xaf')],'attach':_0x743d38[_0x4078('0x63')][_0x4078('0xb0')],'firstMsgDirection':_0x4078('0xb1'),'lastMsgAt':moment()[_0x4078('0x9d')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x4078('0xb1'),'Messages':[_[_0x4078('0x5b')](_0x743d38[_0x4078('0x63')],{'messageId':_0x5e0c47[_0x4078('0xae')],'sentAt':moment()[_0x4078('0x9d')](_0x4078('0x9e')),'read':!![],'MailAccountId':_0x33534d['id'],'UserId':_0x743d38[_0x4078('0x38')]['id'],'ContactId':_0x368840['id']})]};if(_0x743d38[_0x4078('0x63')][_0x4078('0xb2')]){_0x85c019=_[_0x4078('0x5b')](_0x85c019,_0x743d38[_0x4078('0x63')][_0x4078('0xb2')]);}return db['MailInteraction'][_0x4078('0x69')](_0x85c019,{'include':[{'model':db[_0x4078('0x9a')],'as':_0x4078('0xb3')}]});})[_0x4078('0x10')](respondWithResult(_0x366b26,null))[_0x4078('0x1a')](handleError(_0x366b26,null));};exports[_0x4078('0xb4')]=function(_0x166661,_0x50b601){return db[_0x4078('0x4a')][_0x4078('0x65')]({'where':{'id':_0x166661[_0x4078('0x60')]['id']},'include':[{'model':db[_0x4078('0x46')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x4078('0xa3')],'as':'CloudProvider','raw':!![]}]}]})[_0x4078('0x10')](handleEntityNotFound(_0x50b601,null))[_0x4078('0x10')](function(_0x5c9ab6){if(!_0x5c9ab6[_0x4078('0x44')])return;var _0xeafa9b=_0x5c9ab6[_0x4078('0xac')]();return respondWithRpcPromise(_0x4078('0xb5'),_0x4078('0xb4'),{'account':_0xeafa9b});})[_0x4078('0x10')](respondWithResult(_0x50b601,null))[_0x4078('0x1a')](handleError(_0x50b601,null));};exports['destroy']=function(_0xe0eb10,_0x20103d){return db['MailAccount'][_0x4078('0x65')]({'where':{'id':_0xe0eb10['params']['id']}})['then'](handleEntityNotFound(_0x20103d,null))[_0x4078('0x10')](function(_0x1fce71){if(_0x1fce71&&_0x1fce71[_0x4078('0x40')]){throw new db[(_0x4078('0xb6'))][(_0x4078('0xb7'))](_0x4078('0xb8'));}return _0x1fce71;})['then'](removeEntity(_0x20103d,null))[_0x4078('0x1a')](handleError(_0x20103d,null));};exports[_0x4078('0xb9')]=function(_0x2e5599,_0x158cea){return db[_0x4078('0x4a')]['find']({'where':{'id':_0x2e5599[_0x4078('0x60')]['id']}})[_0x4078('0x10')](handleEntityNotFound(_0x158cea,null))[_0x4078('0x10')](function(_0x552453){if(_0x552453){return _0x552453['addAgents'](_0x2e5599[_0x4078('0x63')][_0x4078('0x6e')],_[_0x4078('0x88')](_0x2e5599['body'],['ids','id'])||{})[_0x4078('0xba')](function(_0x302eff){for(var _0xa526dc=0x0;_0xa526dc<_0x2e5599[_0x4078('0x63')]['ids'][_0x4078('0x55')];_0xa526dc+=0x1){socket[_0x4078('0xbb')]('userMailAccount:save',{'UserId':Number(_0x2e5599['body'][_0x4078('0x6e')][_0xa526dc]),'MailAccountId':Number(_0x2e5599['params']['id'])});}return _0x302eff;});}})[_0x4078('0x10')](respondWithResult(_0x158cea,null))[_0x4078('0x1a')](handleError(_0x158cea,null));};exports['removeAgents']=function(_0x2de60b,_0x5f024b){return db[_0x4078('0x4a')][_0x4078('0x65')]({'where':{'id':_0x2de60b['params']['id']}})[_0x4078('0x10')](handleEntityNotFound(_0x5f024b,null))[_0x4078('0x10')](function(_0x5594b7){if(_0x5594b7){return _0x5594b7['removeAgents'](_0x2de60b[_0x4078('0x4f')]['ids'])[_0x4078('0x10')](function(){if(_[_0x4078('0xbc')](_0x2de60b[_0x4078('0x4f')][_0x4078('0x6e')])){for(var _0x426285=0x0;_0x426285<_0x2de60b[_0x4078('0x4f')][_0x4078('0x6e')][_0x4078('0x55')];_0x426285+=0x1){socket[_0x4078('0xbb')]('userMailAccount:remove',{'UserId':Number(_0x2de60b[_0x4078('0x4f')][_0x4078('0x6e')][_0x426285]),'MailAccountId':Number(_0x2de60b['params']['id'])});}}else{socket[_0x4078('0xbb')]('userMailAccount:remove',{'UserId':Number(_0x2de60b[_0x4078('0x4f')][_0x4078('0x6e')]),'MailAccountId':Number(_0x2de60b[_0x4078('0x60')]['id'])});}});}})[_0x4078('0x10')](respondWithStatusCode(_0x5f024b,null))[_0x4078('0x1a')](handleError(_0x5f024b,null));};exports['getAgents']=function(_0x4bd3f9,_0x135afd){var _0x563351={};var _0x4cfbe3={};var _0x176830;var _0x46d011;return db[_0x4078('0x4a')][_0x4078('0x70')]({'where':{'id':_0x4bd3f9[_0x4078('0x60')]['id']}})[_0x4078('0x10')](handleEntityNotFound(_0x135afd,null))[_0x4078('0x10')](function(_0x3cb33d){if(_0x3cb33d){_0x176830=_0x3cb33d;_0x4cfbe3[_0x4078('0x52')]=_['keys'](db[_0x4078('0xbd')][_0x4078('0x61')]);_0x4cfbe3[_0x4078('0x4f')]=_['keys'](_0x4bd3f9[_0x4078('0x4f')]);_0x4cfbe3[_0x4078('0x50')]=_[_0x4078('0x51')](_0x4cfbe3['model'],_0x4cfbe3['query']);_0x563351[_0x4078('0x54')]=_[_0x4078('0x51')](_0x4cfbe3['model'],qs['fields'](_0x4bd3f9['query'][_0x4078('0x53')]));_0x563351[_0x4078('0x54')]=_0x563351['attributes'][_0x4078('0x55')]?_0x563351['attributes']:_0x4cfbe3[_0x4078('0x52')];_0x563351[_0x4078('0x71')]=qs['sort'](_0x4bd3f9[_0x4078('0x4f')][_0x4078('0x57')]);_0x563351[_0x4078('0x58')]=qs[_0x4078('0x50')](_['pick'](_0x4bd3f9[_0x4078('0x4f')],_0x4cfbe3[_0x4078('0x50')]));if(_0x4bd3f9['query'][_0x4078('0x5a')]){_0x563351[_0x4078('0x58')]=_['merge'](_0x563351[_0x4078('0x58')],{'$or':_[_0x4078('0x49')](_0x563351[_0x4078('0x54')],function(_0x4df52c){var _0x59cf2c={};_0x59cf2c[_0x4df52c]={'$like':'%'+_0x4bd3f9[_0x4078('0x4f')]['filter']+'%'};return _0x59cf2c;})});}_0x563351=_[_0x4078('0x5b')]({},_0x563351,_0x4bd3f9['options']);return _0x176830['getAgents'](_0x563351);}})[_0x4078('0x10')](function(_0x2dab03){if(_0x2dab03){_0x46d011=_0x2dab03[_0x4078('0x55')];if(!_0x4bd3f9[_0x4078('0x4f')][_0x4078('0x56')](_0x4078('0x6b'))){_0x563351[_0x4078('0x21')]=qs[_0x4078('0x21')](_0x4bd3f9[_0x4078('0x4f')][_0x4078('0x21')]);_0x563351[_0x4078('0x1e')]=qs[_0x4078('0x1e')](_0x4bd3f9[_0x4078('0x4f')][_0x4078('0x1e')]);}return _0x176830[_0x4078('0xbe')](_0x563351);}})[_0x4078('0x10')](function(_0x3eb339){if(_0x3eb339){return _0x3eb339?{'count':_0x46d011,'rows':_0x3eb339}:null;}})[_0x4078('0x10')](respondWithResult(_0x135afd,null))[_0x4078('0x1a')](handleError(_0x135afd,null));}; \ No newline at end of file +var _0x68e5=['rawAttributes','type','key','model','filters','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','count','findAll','rows','catch','show','includeAll','include','find','body','provider','custom','Mail\x20Account\x20not\x20found','describe','addDisposition','params','Disposition','create','getDispositions','keys','sort','MailAccountId','removeDispositions','addAnswer','findOne','CannedAnswer','removeAnswers','ids','ListId','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addImap','setImap','getSmtp','addSmtp','setSmtp','addInteraction','MailInteraction','omit','CmContact','Contact','User','fullname','internal','Tag','color','tag','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','stack','finally','getApplications','MailMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','true','CmList','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','isNil','from','format','%s\x20<%s>','attachments','root','basename','SendMail','sendMail','List','List\x20not\x20found','subject','attach','messageId','Interaction','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','isArray','userMailAccount:remove','getAgents','bluebird','util','path','lodash','juice','ioredis','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','jayson/promise','client','http','info','request\x20sent','stringify','error','code','message','MailAccount,\x20%s,\x20%s','result','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','update','then','destroy','get','MailAccounts','UserProfileResource','name','send','gmail','yahoo','imap.mail.yahoo.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.mail.yahoo.com','hotmail','smtp-mail.outlook.com','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','port','host','secure','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount'];(function(_0x538d7e,_0x1f7944){var _0x5debc4=function(_0x1018fd){while(--_0x1018fd){_0x538d7e['push'](_0x538d7e['shift']());}};_0x5debc4(++_0x1f7944);}(_0x68e5,0x79));var _0x568e=function(_0x401169,_0x3e0dff){_0x401169=_0x401169-0x0;var _0x4d8f81=_0x68e5[_0x401169];return _0x4d8f81;};'use strict';var moment=require('moment');var BPromise=require(_0x568e('0x0'));var util=require(_0x568e('0x1'));var path=require(_0x568e('0x2'));var _=require(_0x568e('0x3'));var juice=require(_0x568e('0x4'));var Redis=require(_0x568e('0x5'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x568e('0x6'));var config=require(_0x568e('0x7'));var db=require(_0x568e('0x8'))['db'];config[_0x568e('0x9')]=_[_0x568e('0xa')](config[_0x568e('0x9')],{'host':_0x568e('0xb'),'port':0x18eb});var socket=require(_0x568e('0xc'))(new Redis(config['redis']));require(_0x568e('0xd'))['register'](socket);var jayson=require(_0x568e('0xe'));var client=jayson[_0x568e('0xf')][_0x568e('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x351914,_0x3202a6,_0x1ae008,_0x3f50ec){return new BPromise(function(_0x640fb1,_0x112327){var _0x1ab700=_0x3f50ec||client;return _0x1ab700['request'](_0x351914,_0x1ae008)['then'](function(_0x3f9549){logger[_0x568e('0x11')]('MailAccount,\x20%s,\x20%s',_0x3202a6,_0x568e('0x12'));logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x3202a6,_0x568e('0x12'),JSON[_0x568e('0x13')](_0x3f9549));if(_0x3f9549[_0x568e('0x14')]){if(_0x3f9549[_0x568e('0x14')][_0x568e('0x15')]===0x1f4){logger[_0x568e('0x14')]('MailAccount,\x20%s,\x20%s',_0x3202a6,_0x3f9549[_0x568e('0x14')][_0x568e('0x16')]);return _0x112327(_0x3f9549[_0x568e('0x14')][_0x568e('0x16')]);}logger[_0x568e('0x14')](_0x568e('0x17'),_0x3202a6,_0x3f9549['error'][_0x568e('0x16')]);return _0x640fb1(_0x3f9549[_0x568e('0x14')]['message']);}else{logger[_0x568e('0x11')](_0x568e('0x17'),_0x3202a6,_0x568e('0x12'));_0x640fb1(_0x3f9549[_0x568e('0x18')]['message']);}})['catch'](function(_0x583372){logger[_0x568e('0x14')]('MailAccount,\x20%s,\x20%s',_0x3202a6,_0x583372);_0x112327(_0x583372);});});}function respondWithStatusCode(_0xb01143,_0x309370){_0x309370=_0x309370||0xcc;return function(_0x4e3d27){if(_0x4e3d27){return _0xb01143[_0x568e('0x19')](_0x309370);}return _0xb01143[_0x568e('0x1a')](_0x309370)[_0x568e('0x1b')]();};}function respondWithResult(_0x3f77d7,_0x4ba455){_0x4ba455=_0x4ba455||0xc8;return function(_0x574164){if(_0x574164){return _0x3f77d7[_0x568e('0x1a')](_0x4ba455)[_0x568e('0x1c')](_0x574164);}};}function respondWithFilteredResult(_0x1b8af5,_0x56f455){return function(_0x32021a){if(_0x32021a){var _0x5df385=typeof _0x56f455[_0x568e('0x1d')]===_0x568e('0x1e')&&typeof _0x56f455[_0x568e('0x1f')]===_0x568e('0x1e');var _0x380ed3=_0x32021a['count'];var _0x4c689c=_0x5df385?0x0:_0x56f455[_0x568e('0x1d')];var _0xad9937=_0x5df385?_0x32021a['count']:_0x56f455['offset']+_0x56f455['limit'];var _0x595c1a;if(_0xad9937>=_0x380ed3){_0xad9937=_0x380ed3;_0x595c1a=0xc8;}else{_0x595c1a=0xce;}_0x1b8af5[_0x568e('0x1a')](_0x595c1a);return _0x1b8af5[_0x568e('0x20')](_0x568e('0x21'),_0x4c689c+'-'+_0xad9937+'/'+_0x380ed3)[_0x568e('0x1c')](_0x32021a);}return null;};}function saveUpdates(_0x51c7de){return function(_0x4fa544){if(_0x4fa544){return _0x4fa544[_0x568e('0x22')](_0x51c7de)[_0x568e('0x23')](function(_0x492481){return _0x492481;});}return null;};}function removeEntity(_0x371a26){return function(_0x42ee7d){if(_0x42ee7d){return _0x42ee7d[_0x568e('0x24')]()[_0x568e('0x23')](function(){var _0x5dcea2=_0x42ee7d[_0x568e('0x25')]({'plain':!![]});var _0x2310bf=_0x568e('0x26');return db[_0x568e('0x27')]['destroy']({'where':{'type':_0x2310bf,'resourceId':_0x5dcea2['id']}})[_0x568e('0x23')](function(){return _0x42ee7d;});})[_0x568e('0x23')](function(){_0x371a26['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x23f189){return function(_0x99e42e){if(!_0x99e42e){_0x23f189[_0x568e('0x19')](0x194);}return _0x99e42e;};}function handleError(_0x5d214d,_0x4123dd){_0x4123dd=_0x4123dd||0x1f4;return function(_0x3c7e51){logger['error'](_0x3c7e51['stack']);if(_0x3c7e51[_0x568e('0x28')]){delete _0x3c7e51[_0x568e('0x28')];}_0x5d214d['status'](_0x4123dd)[_0x568e('0x29')](_0x3c7e51);};}function getImapHost(_0x171774){switch(_0x171774){case _0x568e('0x2a'):return'imap.gmail.com';case _0x568e('0x2b'):return _0x568e('0x2c');case'hotmail':return'imap-mail.outlook.com';case _0x568e('0x2d'):return _0x568e('0x2e');}throw new Error(_0x568e('0x2f'),_0x171774);}function getSmtpHost(_0x2f41c3){switch(_0x2f41c3){case'gmail':return'smtp.gmail.com';case'yahoo':return _0x568e('0x30');case _0x568e('0x31'):return _0x568e('0x32');case _0x568e('0x2d'):return _0x568e('0x33');}throw new Error(_0x568e('0x2f'),_0x2f41c3);}function getAuthenticationOptions(_0x271f86,_0x4e5243){var _0x14191={};var _0x2cdaca={};if(_0x271f86){_0x14191[_0x568e('0x34')]=_0x2cdaca[_0x568e('0x34')]=_0x4e5243[_0x568e('0x35')];_0x14191[_0x568e('0x36')]=_0x2cdaca[_0x568e('0x37')]=_0x4e5243[_0x568e('0x36')];if(_0x4e5243[_0x568e('0x38')]){_0x14191['modernAuthentication']=_0x2cdaca[_0x568e('0x38')]=!![];_0x14191[_0x568e('0x39')]=_0x2cdaca['CloudProviderId']=_0x4e5243[_0x568e('0x39')];_0x14191[_0x568e('0x36')]=_0x2cdaca[_0x568e('0x37')]=null;}else{_0x14191[_0x568e('0x39')]=_0x2cdaca[_0x568e('0x39')]=null;}_0x14191['host']=getImapHost(_0x271f86);_0x14191[_0x568e('0x3a')]=0x3e1;_0x2cdaca[_0x568e('0x3b')]=getSmtpHost(_0x271f86);_0x2cdaca[_0x568e('0x3a')]=0x24b;_0x2cdaca[_0x568e('0x3c')]=![];_0x14191[_0x568e('0x3d')]=_0x2cdaca['service']=null;}else{if(_0x4e5243['authentication']){_0x14191['user']=_0x2cdaca[_0x568e('0x34')]=_0x4e5243[_0x568e('0x35')];_0x14191['password']=_0x2cdaca[_0x568e('0x37')]=_0x4e5243[_0x568e('0x36')];}else{_0x14191[_0x568e('0x3e')]=_0x2cdaca[_0x568e('0x3e')]=![];_0x14191[_0x568e('0x34')]=_0x2cdaca['user']=null;_0x14191[_0x568e('0x36')]=_0x2cdaca[_0x568e('0x37')]=null;}_0x14191[_0x568e('0x3b')]=_0x4e5243[_0x568e('0x3f')]['host'];_0x14191[_0x568e('0x3a')]=_0x4e5243[_0x568e('0x3f')]['port'];_0x2cdaca[_0x568e('0x3b')]=_0x4e5243['Smtp'][_0x568e('0x3b')];_0x2cdaca['port']=_0x4e5243[_0x568e('0x40')][_0x568e('0x3a')];}return{'Imap':_0x14191,'Smtp':_0x2cdaca};}exports[_0x568e('0x41')]=function(_0x293740,_0x244a6d){var _0x45559f={'include':[{'model':db[_0x568e('0x42')],'as':'Imap'},{'model':db[_0x568e('0x43')],'as':_0x568e('0x40')},{'model':db[_0x568e('0x44')],'as':_0x568e('0x45')}]},_0x46efa0={},_0x4d6ff5={'count':0x0,'rows':[]};var _0x18370d=_[_0x568e('0x46')](db[_0x568e('0x47')][_0x568e('0x48')],function(_0x41bead){return{'name':_0x41bead['fieldName'],'type':_0x41bead[_0x568e('0x49')][_0x568e('0x4a')]};});_0x46efa0[_0x568e('0x4b')]=_['map'](_0x18370d,_0x568e('0x28'));_0x46efa0['query']=_['keys'](_0x293740['query']);_0x46efa0[_0x568e('0x4c')]=_['intersection'](_0x46efa0[_0x568e('0x4b')],_0x46efa0[_0x568e('0x4d')]);_0x45559f['attributes']=_[_0x568e('0x4e')](_0x46efa0[_0x568e('0x4b')],qs[_0x568e('0x4f')](_0x293740[_0x568e('0x4d')][_0x568e('0x4f')]));_0x45559f[_0x568e('0x50')]=_0x45559f[_0x568e('0x50')][_0x568e('0x51')]?_0x45559f['attributes']:_0x46efa0[_0x568e('0x4b')];if(!_0x293740[_0x568e('0x4d')][_0x568e('0x52')](_0x568e('0x53'))){_0x45559f[_0x568e('0x1f')]=qs['limit'](_0x293740['query'][_0x568e('0x1f')]);_0x45559f[_0x568e('0x1d')]=qs[_0x568e('0x1d')](_0x293740['query']['offset']);}_0x45559f[_0x568e('0x54')]=qs['sort'](_0x293740[_0x568e('0x4d')]['sort']);_0x45559f[_0x568e('0x55')]=qs[_0x568e('0x4c')](_[_0x568e('0x56')](_0x293740[_0x568e('0x4d')],_0x46efa0[_0x568e('0x4c')]),_0x18370d);if(_0x293740[_0x568e('0x4d')][_0x568e('0x57')]){_0x45559f[_0x568e('0x55')]=_[_0x568e('0x58')](_0x45559f[_0x568e('0x55')],{'$or':_[_0x568e('0x46')](_0x18370d,function(_0x6631ae){if(_0x6631ae[_0x568e('0x49')]!==_0x568e('0x59')){var _0x368aec={};_0x368aec[_0x6631ae[_0x568e('0x28')]]={'$like':'%'+_0x293740[_0x568e('0x4d')][_0x568e('0x57')]+'%'};return _0x368aec;}})});}_0x45559f=_[_0x568e('0x58')]({},_0x45559f,_0x293740[_0x568e('0x5a')]);var _0x2ecb43={'where':_0x45559f[_0x568e('0x55')]};return db[_0x568e('0x47')][_0x568e('0x5b')](_0x2ecb43)['then'](function(_0x3ab53f){_0x4d6ff5[_0x568e('0x5b')]=_0x3ab53f;if(_0x293740['query']['includeAll']){_0x45559f['include']=[{'all':!![]}];}return db[_0x568e('0x47')][_0x568e('0x5c')](_0x45559f);})[_0x568e('0x23')](function(_0x5b3d74){_0x4d6ff5[_0x568e('0x5d')]=_0x5b3d74;return _0x4d6ff5;})['then'](respondWithFilteredResult(_0x244a6d,_0x45559f))[_0x568e('0x5e')](handleError(_0x244a6d,null));};exports[_0x568e('0x5f')]=function(_0x39bdca,_0x1c6e89){var _0x3fe06e={'raw':![],'where':{'id':_0x39bdca['params']['id']},'include':[{'model':db[_0x568e('0x42')],'as':_0x568e('0x3f')},{'model':db[_0x568e('0x43')],'as':_0x568e('0x40')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0xbedc09={};_0xbedc09[_0x568e('0x4b')]=_['keys'](db[_0x568e('0x47')][_0x568e('0x48')]);_0xbedc09[_0x568e('0x4d')]=_['keys'](_0x39bdca[_0x568e('0x4d')]);_0xbedc09[_0x568e('0x4c')]=_['intersection'](_0xbedc09['model'],_0xbedc09['query']);_0x3fe06e[_0x568e('0x50')]=_['intersection'](_0xbedc09[_0x568e('0x4b')],qs[_0x568e('0x4f')](_0x39bdca[_0x568e('0x4d')][_0x568e('0x4f')]));_0x3fe06e[_0x568e('0x50')]=_0x3fe06e['attributes'][_0x568e('0x51')]?_0x3fe06e[_0x568e('0x50')]:_0xbedc09[_0x568e('0x4b')];if(_0x39bdca['query'][_0x568e('0x60')]){_0x3fe06e[_0x568e('0x61')]=[{'all':!![]}];}_0x3fe06e=_[_0x568e('0x58')]({},_0x3fe06e,_0x39bdca[_0x568e('0x5a')]);return db['MailAccount'][_0x568e('0x62')](_0x3fe06e)[_0x568e('0x23')](handleEntityNotFound(_0x1c6e89,null))[_0x568e('0x23')](respondWithResult(_0x1c6e89,null))[_0x568e('0x5e')](handleError(_0x1c6e89,null));};exports['update']=function(_0x3f696b,_0x336e22){if(_0x3f696b[_0x568e('0x63')]['id']){delete _0x3f696b[_0x568e('0x63')]['id'];}var _0x5f60df=_0x3f696b[_0x568e('0x63')][_0x568e('0x64')]===_0x568e('0x65')?null:_0x3f696b[_0x568e('0x63')][_0x568e('0x64')];var _0x46f360=_0x3f696b[_0x568e('0x63')][_0x568e('0x3f')]||{};var _0x4d8ecc=_0x3f696b[_0x568e('0x63')][_0x568e('0x40')]||{};if(_0x5f60df){_0x46f360[_0x568e('0x3b')]=getImapHost(_0x5f60df);_0x46f360[_0x568e('0x3a')]=0x3e1;_0x4d8ecc[_0x568e('0x3b')]=getSmtpHost(_0x5f60df);_0x4d8ecc[_0x568e('0x3a')]=0x24b;_0x4d8ecc[_0x568e('0x3c')]=![];}if(_0x4d8ecc[_0x568e('0x38')]){_0x4d8ecc[_0x568e('0x3c')]=![];}else{_0x4d8ecc['CloudProviderId']=null;}if(!_0x46f360[_0x568e('0x38')])_0x46f360['CloudProviderId']=null;_0x3f696b[_0x568e('0x63')][_0x568e('0x3f')]=_0x46f360;_0x3f696b[_0x568e('0x63')][_0x568e('0x40')]=_0x4d8ecc;return db['MailAccount'][_0x568e('0x62')]({'where':{'id':_0x3f696b['params']['id']},'include':[{'model':db[_0x568e('0x42')],'as':'Imap'},{'model':db[_0x568e('0x43')],'as':_0x568e('0x40')},{'model':db[_0x568e('0x44')],'as':_0x568e('0x45')}]})['then'](handleEntityNotFound(_0x336e22,null))[_0x568e('0x23')](function(_0x395841){if(!_0x395841)throw new Error(_0x568e('0x66'));if(_0x395841[_0x568e('0x3d')])delete _0x3f696b[_0x568e('0x63')][_0x568e('0x3f')];return _0x395841;})['then'](saveUpdates(_0x3f696b[_0x568e('0x63')],null))[_0x568e('0x23')](function(_0x152cad){if(!_0x3f696b['body']['Imap'])return _0x152cad;return db[_0x568e('0x42')][_0x568e('0x22')](_0x3f696b[_0x568e('0x63')][_0x568e('0x3f')],{'where':{'MailAccountId':_0x152cad['id']}})[_0x568e('0x23')](function(){return _0x152cad;});})[_0x568e('0x23')](function(_0x135119){if(!_0x3f696b[_0x568e('0x63')][_0x568e('0x40')])return _0x135119;return db[_0x568e('0x43')][_0x568e('0x22')](_0x3f696b[_0x568e('0x63')]['Smtp'],{'where':{'MailAccountId':_0x135119['id']}})[_0x568e('0x23')](function(){return _0x135119;});})[_0x568e('0x23')](respondWithResult(_0x336e22,null))[_0x568e('0x5e')](handleError(_0x336e22,null));};exports[_0x568e('0x67')]=function(_0x596d83,_0x10bb53){return db[_0x568e('0x47')][_0x568e('0x67')]()[_0x568e('0x23')](respondWithResult(_0x10bb53,null))['catch'](handleError(_0x10bb53,null));};exports[_0x568e('0x68')]=function(_0x3fc1f6,_0x2fb319){if(_0x3fc1f6['body']['id']){delete _0x3fc1f6['body']['id'];}return db[_0x568e('0x47')][_0x568e('0x62')]({'where':{'id':_0x3fc1f6[_0x568e('0x69')]['id']}})[_0x568e('0x23')](handleEntityNotFound(_0x2fb319,null))[_0x568e('0x23')](function(_0x36c10e){if(_0x36c10e){_0x3fc1f6[_0x568e('0x63')]['MailAccountId']=_0x36c10e['id'];return db[_0x568e('0x6a')][_0x568e('0x6b')](_0x3fc1f6['body']);}})['then'](respondWithResult(_0x2fb319,null))['catch'](handleError(_0x2fb319,null));};exports[_0x568e('0x6c')]=function(_0x1c34e0,_0x1efc54){var _0x257692={'raw':![],'where':{}};var _0x51b96d={};var _0x1c54f5={'count':0x0,'rows':[]};return db[_0x568e('0x47')]['findOne']({'where':{'id':_0x1c34e0['params']['id']}})['then'](handleEntityNotFound(_0x1efc54,null))[_0x568e('0x23')](function(_0x4a6bdb){if(_0x4a6bdb){_0x51b96d[_0x568e('0x4b')]=_[_0x568e('0x6d')](db[_0x568e('0x6a')][_0x568e('0x48')]);_0x51b96d['query']=_[_0x568e('0x6d')](_0x1c34e0[_0x568e('0x4d')]);_0x51b96d[_0x568e('0x4c')]=_[_0x568e('0x4e')](_0x51b96d[_0x568e('0x4b')],_0x51b96d['query']);_0x257692['attributes']=_[_0x568e('0x4e')](_0x51b96d[_0x568e('0x4b')],qs[_0x568e('0x4f')](_0x1c34e0[_0x568e('0x4d')][_0x568e('0x4f')]));_0x257692[_0x568e('0x50')]=_0x257692['attributes']['length']?_0x257692[_0x568e('0x50')]:_0x51b96d[_0x568e('0x4b')];if(!_0x1c34e0[_0x568e('0x4d')][_0x568e('0x52')](_0x568e('0x53'))){_0x257692['limit']=qs[_0x568e('0x1f')](_0x1c34e0['query'][_0x568e('0x1f')]);_0x257692[_0x568e('0x1d')]=qs[_0x568e('0x1d')](_0x1c34e0['query'][_0x568e('0x1d')]);}_0x257692[_0x568e('0x54')]=qs[_0x568e('0x6e')](_0x1c34e0[_0x568e('0x4d')]['sort']);_0x257692[_0x568e('0x55')]=qs[_0x568e('0x4c')](_[_0x568e('0x56')](_0x1c34e0['query'],_0x51b96d[_0x568e('0x4c')]));_0x257692[_0x568e('0x55')][_0x568e('0x6f')]=_0x4a6bdb['id'];if(_0x1c34e0[_0x568e('0x4d')]['filter']){_0x257692[_0x568e('0x55')]=_[_0x568e('0x58')](_0x257692[_0x568e('0x55')],{'$or':_[_0x568e('0x46')](_0x257692[_0x568e('0x50')],function(_0x40dc5e){var _0x220c06={};_0x220c06[_0x40dc5e]={'$like':'%'+_0x1c34e0['query'][_0x568e('0x57')]+'%'};return _0x220c06;})});}_0x257692=_[_0x568e('0x58')]({},_0x257692,_0x1c34e0[_0x568e('0x5a')]);return db['Disposition'][_0x568e('0x5b')]({'where':_0x257692[_0x568e('0x55')]})['then'](function(_0x6a7f2){_0x1c54f5[_0x568e('0x5b')]=_0x6a7f2;if(_0x1c34e0[_0x568e('0x4d')][_0x568e('0x60')]){_0x257692[_0x568e('0x61')]=[{'all':!![]}];}return db[_0x568e('0x6a')]['findAll'](_0x257692);})['then'](function(_0x38531a){_0x1c54f5[_0x568e('0x5d')]=_0x38531a;return _0x1c54f5;});}})[_0x568e('0x23')](respondWithFilteredResult(_0x1efc54,_0x257692))['catch'](handleError(_0x1efc54,null));};exports[_0x568e('0x70')]=function(_0x5d01ec,_0xbe191b){return db[_0x568e('0x47')][_0x568e('0x62')]({'where':{'id':_0x5d01ec[_0x568e('0x69')]['id']}})['then'](handleEntityNotFound(_0xbe191b,null))[_0x568e('0x23')](function(_0x208b2c){if(_0x208b2c){return _0x208b2c[_0x568e('0x70')](_0x5d01ec[_0x568e('0x4d')]['ids']);}})[_0x568e('0x23')](respondWithStatusCode(_0xbe191b,null))[_0x568e('0x5e')](handleError(_0xbe191b,null));};exports[_0x568e('0x71')]=function(_0x642eb6,_0x58a31f){if(_0x642eb6['body']['id']){delete _0x642eb6[_0x568e('0x63')]['id'];}return db['MailAccount'][_0x568e('0x62')]({'where':{'id':_0x642eb6[_0x568e('0x69')]['id']}})[_0x568e('0x23')](handleEntityNotFound(_0x58a31f,null))[_0x568e('0x23')](function(_0x18a8f9){if(_0x18a8f9){_0x642eb6['body']['MailAccountId']=_0x18a8f9['id'];return db['CannedAnswer'][_0x568e('0x6b')](_0x642eb6['body']);}})[_0x568e('0x23')](respondWithResult(_0x58a31f,null))[_0x568e('0x5e')](handleError(_0x58a31f,null));};exports['getAnswers']=function(_0x575e2f,_0x2f69d9){var _0x3c79b2={'raw':![],'where':{}};var _0x33f4b7={};var _0x318234={'count':0x0,'rows':[]};return db[_0x568e('0x47')][_0x568e('0x72')]({'where':{'id':_0x575e2f[_0x568e('0x69')]['id']}})[_0x568e('0x23')](handleEntityNotFound(_0x2f69d9,null))[_0x568e('0x23')](function(_0x510f1b){if(_0x510f1b){_0x33f4b7['model']=_['keys'](db[_0x568e('0x73')][_0x568e('0x48')]);_0x33f4b7['query']=_[_0x568e('0x6d')](_0x575e2f['query']);_0x33f4b7[_0x568e('0x4c')]=_[_0x568e('0x4e')](_0x33f4b7[_0x568e('0x4b')],_0x33f4b7['query']);_0x3c79b2['attributes']=_[_0x568e('0x4e')](_0x33f4b7[_0x568e('0x4b')],qs[_0x568e('0x4f')](_0x575e2f[_0x568e('0x4d')]['fields']));_0x3c79b2[_0x568e('0x50')]=_0x3c79b2['attributes'][_0x568e('0x51')]?_0x3c79b2[_0x568e('0x50')]:_0x33f4b7[_0x568e('0x4b')];if(!_0x575e2f['query'][_0x568e('0x52')]('nolimit')){_0x3c79b2[_0x568e('0x1f')]=qs[_0x568e('0x1f')](_0x575e2f['query'][_0x568e('0x1f')]);_0x3c79b2[_0x568e('0x1d')]=qs[_0x568e('0x1d')](_0x575e2f[_0x568e('0x4d')][_0x568e('0x1d')]);}_0x3c79b2[_0x568e('0x54')]=qs[_0x568e('0x6e')](_0x575e2f[_0x568e('0x4d')][_0x568e('0x6e')]);_0x3c79b2[_0x568e('0x55')]=qs[_0x568e('0x4c')](_['pick'](_0x575e2f[_0x568e('0x4d')],_0x33f4b7[_0x568e('0x4c')]));_0x3c79b2[_0x568e('0x55')][_0x568e('0x6f')]=_0x510f1b['id'];if(_0x575e2f['query'][_0x568e('0x57')]){_0x3c79b2[_0x568e('0x55')]=_[_0x568e('0x58')](_0x3c79b2[_0x568e('0x55')],{'$or':_[_0x568e('0x46')](_0x3c79b2[_0x568e('0x50')],function(_0x1393e4){var _0x388fcc={};_0x388fcc[_0x1393e4]={'$like':'%'+_0x575e2f[_0x568e('0x4d')][_0x568e('0x57')]+'%'};return _0x388fcc;})});}_0x3c79b2=_[_0x568e('0x58')]({},_0x3c79b2,_0x575e2f[_0x568e('0x5a')]);return db['CannedAnswer'][_0x568e('0x5b')]({'where':_0x3c79b2['where']})[_0x568e('0x23')](function(_0x2f303f){_0x318234[_0x568e('0x5b')]=_0x2f303f;if(_0x575e2f['query'][_0x568e('0x60')]){_0x3c79b2[_0x568e('0x61')]=[{'all':!![]}];}return db['CannedAnswer'][_0x568e('0x5c')](_0x3c79b2);})[_0x568e('0x23')](function(_0x2fce0f){_0x318234[_0x568e('0x5d')]=_0x2fce0f;return _0x318234;});}})[_0x568e('0x23')](respondWithFilteredResult(_0x2f69d9,_0x3c79b2))['catch'](handleError(_0x2f69d9,null));};exports[_0x568e('0x74')]=function(_0xc5c253,_0x4d0dc6){return db[_0x568e('0x47')][_0x568e('0x62')]({'where':{'id':_0xc5c253[_0x568e('0x69')]['id']}})['then'](handleEntityNotFound(_0x4d0dc6,null))[_0x568e('0x23')](function(_0x5c58f2){if(_0x5c58f2){return _0x5c58f2[_0x568e('0x74')](_0xc5c253[_0x568e('0x4d')][_0x568e('0x75')]);}})[_0x568e('0x23')](respondWithStatusCode(_0x4d0dc6,null))[_0x568e('0x5e')](handleError(_0x4d0dc6,null));};exports[_0x568e('0x6b')]=function(_0x527b16,_0x24ce4b){var _0x102357={'name':_0x527b16[_0x568e('0x63')]['name'],'key':_0x527b16['body'][_0x568e('0x4a')],'provider':_0x527b16['body'][_0x568e('0x64')]===_0x568e('0x65')?null:_0x527b16[_0x568e('0x63')][_0x568e('0x64')],'email':_0x527b16[_0x568e('0x63')]['email'],'ListId':_0x527b16[_0x568e('0x63')][_0x568e('0x76')],'active':!_['isNil'](_0x527b16[_0x568e('0x63')][_0x568e('0x77')])?_0x527b16[_0x568e('0x63')][_0x568e('0x77')]:!![],'description':_0x527b16['body'][_0x568e('0x78')]||null};var _0x256276=getAuthenticationOptions(_0x102357[_0x568e('0x64')],_0x527b16[_0x568e('0x63')]);_0x102357[_0x568e('0x3f')]=_0x256276['Imap'];_0x102357[_0x568e('0x40')]=_0x256276[_0x568e('0x40')];return db[_0x568e('0x47')][_0x568e('0x6b')](_0x102357,{'include':[{'model':db[_0x568e('0x43')],'as':'Smtp'},{'model':db[_0x568e('0x42')],'as':_0x568e('0x3f')}]})[_0x568e('0x23')](function(_0x952d4){var _0x39e193=_0x527b16['user'][_0x568e('0x25')]({'plain':!![]});if(!_0x39e193)throw new Error(_0x568e('0x79'));if(_0x39e193[_0x568e('0x7a')]===_0x568e('0x34')){var _0x1e2c28=_0x952d4[_0x568e('0x25')]({'plain':!![]});return db[_0x568e('0x7b')][_0x568e('0x62')]({'where':{'name':'MailAccounts','userProfileId':_0x39e193[_0x568e('0x7c')]},'raw':!![]})[_0x568e('0x23')](function(_0x106b54){if(_0x106b54&&_0x106b54[_0x568e('0x7d')]===0x0){return db[_0x568e('0x27')][_0x568e('0x6b')]({'name':_0x1e2c28[_0x568e('0x28')],'resourceId':_0x1e2c28['id'],'type':_0x106b54[_0x568e('0x28')],'sectionId':_0x106b54['id']},{})[_0x568e('0x23')](function(){return _0x952d4;});}else{return _0x952d4;}})[_0x568e('0x5e')](function(_0x3d9b50){logger['error'](_0x568e('0x7e'),_0x3d9b50);throw _0x3d9b50;});}return _0x952d4;})[_0x568e('0x23')](respondWithResult(_0x24ce4b,0xc9))[_0x568e('0x5e')](handleError(_0x24ce4b,null));};exports['getImap']=function(_0x4c7346,_0x248ac9){return db[_0x568e('0x47')][_0x568e('0x72')]({'where':{'id':_0x4c7346['params']['id']}})['then'](handleEntityNotFound(_0x248ac9,null))[_0x568e('0x23')](function(_0x1fce12){if(_0x1fce12){return _0x1fce12['getImap']();}return null;})['then'](respondWithResult(_0x248ac9,null))[_0x568e('0x5e')](handleError(_0x248ac9,null));};exports[_0x568e('0x7f')]=function(_0x2f923b,_0x54d6b7){if(_0x2f923b[_0x568e('0x63')]['id']){delete _0x2f923b[_0x568e('0x63')]['id'];}return db[_0x568e('0x47')][_0x568e('0x62')]({'where':{'id':_0x2f923b[_0x568e('0x69')]['id']}})[_0x568e('0x23')](handleEntityNotFound(_0x54d6b7,null))[_0x568e('0x23')](function(_0x3cb77a){if(_0x3cb77a){_0x2f923b[_0x568e('0x63')][_0x568e('0x6f')]=_0x3cb77a['id'];return db[_0x568e('0x42')][_0x568e('0x6b')](_0x2f923b[_0x568e('0x63')]);}})[_0x568e('0x23')](respondWithResult(_0x54d6b7,null))[_0x568e('0x5e')](handleError(_0x54d6b7,null));};exports['removeImap']=function(_0x3d33cd,_0x4d0e02){return db[_0x568e('0x47')][_0x568e('0x72')]({'where':{'id':_0x3d33cd['params']['id']}})[_0x568e('0x23')](handleEntityNotFound(_0x4d0e02,null))[_0x568e('0x23')](function(_0x497f98){if(_0x497f98){return _0x497f98[_0x568e('0x80')](null);}return null;})[_0x568e('0x23')](respondWithStatusCode(_0x4d0e02,null))[_0x568e('0x5e')](handleError(_0x4d0e02,null));};exports[_0x568e('0x81')]=function(_0x5bd3a3,_0x4d31a8){return db[_0x568e('0x47')][_0x568e('0x72')]({'where':{'id':_0x5bd3a3[_0x568e('0x69')]['id']}})[_0x568e('0x23')](handleEntityNotFound(_0x4d31a8,null))[_0x568e('0x23')](function(_0xb3d39f){if(_0xb3d39f){return _0xb3d39f['getSmtp']();}return null;})[_0x568e('0x23')](respondWithResult(_0x4d31a8,null))[_0x568e('0x5e')](handleError(_0x4d31a8,null));};exports[_0x568e('0x82')]=function(_0x3f7c36,_0x1ca1bd){if(_0x3f7c36[_0x568e('0x63')]['id']){delete _0x3f7c36['body']['id'];}return db[_0x568e('0x47')][_0x568e('0x62')]({'where':{'id':_0x3f7c36['params']['id']}})[_0x568e('0x23')](handleEntityNotFound(_0x1ca1bd,null))[_0x568e('0x23')](function(_0x503910){if(_0x503910){_0x3f7c36[_0x568e('0x63')][_0x568e('0x6f')]=_0x503910['id'];return db['MailServerOut'][_0x568e('0x6b')](_0x3f7c36[_0x568e('0x63')]);}})[_0x568e('0x23')](respondWithResult(_0x1ca1bd,null))['catch'](handleError(_0x1ca1bd,null));};exports['removeSmtp']=function(_0x235afb,_0x42d679){return db[_0x568e('0x47')]['findOne']({'where':{'id':_0x235afb[_0x568e('0x69')]['id']}})[_0x568e('0x23')](handleEntityNotFound(_0x42d679,null))[_0x568e('0x23')](function(_0x22cd0c){if(_0x22cd0c){return _0x22cd0c[_0x568e('0x83')](null);}return null;})[_0x568e('0x23')](respondWithStatusCode(_0x42d679,null))[_0x568e('0x5e')](handleError(_0x42d679,null));};exports[_0x568e('0x84')]=function(_0x53a53,_0x23f808){return db[_0x568e('0x85')]['find']({'where':{'id':_0x53a53[_0x568e('0x69')]['id']}})[_0x568e('0x23')](handleEntityNotFound(_0x23f808,null))[_0x568e('0x23')](function(_0xd3d1b1){if(_0xd3d1b1){return _0xd3d1b1[_0x568e('0x84')](_0x53a53[_0x568e('0x63')][_0x568e('0x75')],_[_0x568e('0x86')](_0x53a53[_0x568e('0x63')],[_0x568e('0x75'),'id'])||{});}})[_0x568e('0x23')](respondWithResult(_0x23f808,null))[_0x568e('0x5e')](handleError(_0x23f808,null));};exports['getInteractions']=function(_0x18cde0,_0x21b30f){var _0x5f55cf={'raw':![],'where':{}};var _0x3dc2d9={};var _0x4e6764={'count':0x0,'rows':[]};return db[_0x568e('0x47')][_0x568e('0x72')]({'where':{'id':_0x18cde0[_0x568e('0x69')]['id']}})[_0x568e('0x23')](handleEntityNotFound(_0x21b30f,null))[_0x568e('0x23')](function(_0x30b951){if(_0x30b951){_0x3dc2d9[_0x568e('0x4b')]=_[_0x568e('0x6d')](db[_0x568e('0x85')][_0x568e('0x48')]);_0x3dc2d9[_0x568e('0x4d')]=_[_0x568e('0x6d')](_0x18cde0['query']);_0x3dc2d9[_0x568e('0x4c')]=_[_0x568e('0x4e')](_0x3dc2d9[_0x568e('0x4b')],_0x3dc2d9[_0x568e('0x4d')]);_0x5f55cf[_0x568e('0x50')]=_[_0x568e('0x4e')](_0x3dc2d9[_0x568e('0x4b')],qs[_0x568e('0x4f')](_0x18cde0[_0x568e('0x4d')][_0x568e('0x4f')]));_0x5f55cf[_0x568e('0x50')]=_0x5f55cf[_0x568e('0x50')][_0x568e('0x51')]?_0x5f55cf[_0x568e('0x50')]:_0x3dc2d9[_0x568e('0x4b')];if(!_0x18cde0[_0x568e('0x4d')][_0x568e('0x52')](_0x568e('0x53'))){_0x5f55cf['limit']=qs['limit'](_0x18cde0[_0x568e('0x4d')][_0x568e('0x1f')]);_0x5f55cf[_0x568e('0x1d')]=qs[_0x568e('0x1d')](_0x18cde0['query'][_0x568e('0x1d')]);}_0x5f55cf['order']=qs[_0x568e('0x6e')](_0x18cde0[_0x568e('0x4d')]['sort']);_0x5f55cf['where']=qs[_0x568e('0x4c')](_['pick'](_0x18cde0[_0x568e('0x4d')],_0x3dc2d9[_0x568e('0x4c')]));_0x5f55cf[_0x568e('0x55')][_0x568e('0x6f')]=_0x30b951['id'];if(_0x18cde0[_0x568e('0x4d')]['filter']){_0x5f55cf[_0x568e('0x55')]=_[_0x568e('0x58')](_0x5f55cf[_0x568e('0x55')],{'$or':_['map'](_0x5f55cf[_0x568e('0x50')],function(_0x23509a){var _0xee7f1a={};_0xee7f1a[_0x23509a]={'$like':'%'+_0x18cde0[_0x568e('0x4d')][_0x568e('0x57')]+'%'};return _0xee7f1a;})});}_0x5f55cf=_[_0x568e('0x58')]({},_0x5f55cf,_0x18cde0[_0x568e('0x5a')]);return db['MailInteraction'][_0x568e('0x5b')]({'where':_0x5f55cf[_0x568e('0x55')]})[_0x568e('0x23')](function(_0x4b4a3b){_0x4e6764[_0x568e('0x5b')]=_0x4b4a3b;if(_0x18cde0['query'][_0x568e('0x60')]){_0x5f55cf[_0x568e('0x61')]=[{'model':db[_0x568e('0x87')],'as':_0x568e('0x88'),'required':![]},{'model':db[_0x568e('0x89')],'as':'Owner','attributes':[_0x568e('0x28'),_0x568e('0x8a'),_0x568e('0x8b')],'required':![]},{'model':db[_0x568e('0x8c')],'as':'Tags','attributes':['id','name',_0x568e('0x8d')],'where':_0x18cde0[_0x568e('0x4d')]['tag']?{'id':_0x18cde0[_0x568e('0x4d')][_0x568e('0x8e')]}:undefined,'required':_0x18cde0[_0x568e('0x4d')]['tag']?!![]:![]}];}return db[_0x568e('0x85')]['findAll'](_0x5f55cf);})[_0x568e('0x23')](function(_0x1cc327){_0x4e6764[_0x568e('0x5d')]=_0x1cc327;return _0x4e6764;});}})[_0x568e('0x23')](respondWithFilteredResult(_0x21b30f,_0x5f55cf))[_0x568e('0x5e')](handleError(_0x21b30f,null));};exports[_0x568e('0x8f')]=function addApplications(_0x117b70,_0xa589a2){var _0x4c904b=_0x117b70[_0x568e('0x69')]['id'];var _0x2770a1=_0x117b70[_0x568e('0x63')];var _0x5cbbc0=0xc8;var _0x547879=null;return db[_0x568e('0x90')][_0x568e('0x91')]({'isolationLevel':db['sequelize'][_0x568e('0x92')]['ISOLATION_LEVELS'][_0x568e('0x93')]},function(_0x1574dd){return db[_0x568e('0x47')][_0x568e('0x72')]({'where':{'id':_0x4c904b},'transaction':_0x1574dd})[_0x568e('0x23')](function(_0x52377a){if(_0x52377a){return db[_0x568e('0x94')]['destroy']({'where':{'MailAccountId':_0x4c904b},'transaction':_0x1574dd})[_0x568e('0x23')](function(){var _0x3e47b7=_[_0x568e('0x46')](_0x2770a1,function(_0x3b0d85){_0x3b0d85[_0x568e('0x6f')]=_0x4c904b;return _0x3b0d85;});return db[_0x568e('0x94')][_0x568e('0x95')](_0x3e47b7,{'transaction':_0x1574dd});});}else{_0x5cbbc0=0x194;_0x547879=[];}});})['then'](function(){if(_0x5cbbc0!==0x194){return db['MailApplication'][_0x568e('0x96')]({'where':{'MailAccountId':_0x4c904b},'order':_0x568e('0x97')})['then'](function(_0x247d16){_0x547879=_0x247d16;});}})[_0x568e('0x5e')](function(_0x2be27a){_0x5cbbc0=0x1f4;logger[_0x568e('0x14')](_0x2be27a[_0x568e('0x98')]);if(_0x2be27a[_0x568e('0x28')]){delete _0x2be27a[_0x568e('0x28')];}_0x547879=_0x2be27a;})[_0x568e('0x99')](function(){if(_0x547879===null){_0xa589a2[_0x568e('0x19')](_0x5cbbc0);}else{if(_0x5cbbc0===0x1f4){_0xa589a2[_0x568e('0x1a')](_0x5cbbc0)[_0x568e('0x29')](_0x547879);}else{_0xa589a2[_0x568e('0x1a')](_0x5cbbc0)[_0x568e('0x1c')](_0x547879);}}});};exports[_0x568e('0x9a')]=function(_0x2890b1,_0x196dab){var _0x5549e9={};var _0x325fa7={};var _0x3b0e40;var _0x33e6d0;return db[_0x568e('0x47')][_0x568e('0x72')]({'where':{'id':_0x2890b1[_0x568e('0x69')]['id']}})[_0x568e('0x23')](handleEntityNotFound(_0x196dab,null))['then'](function(_0x47e0f0){if(_0x47e0f0){_0x3b0e40=_0x47e0f0;_0x325fa7[_0x568e('0x4b')]=_['keys'](db[_0x568e('0x94')]['rawAttributes']);_0x325fa7[_0x568e('0x4d')]=_[_0x568e('0x6d')](_0x2890b1[_0x568e('0x4d')]);_0x325fa7[_0x568e('0x4c')]=_[_0x568e('0x4e')](_0x325fa7[_0x568e('0x4b')],_0x325fa7[_0x568e('0x4d')]);_0x5549e9[_0x568e('0x50')]=_[_0x568e('0x4e')](_0x325fa7[_0x568e('0x4b')],qs[_0x568e('0x4f')](_0x2890b1[_0x568e('0x4d')]['fields']));_0x5549e9[_0x568e('0x50')]=_0x5549e9[_0x568e('0x50')][_0x568e('0x51')]?_0x5549e9['attributes']:_0x325fa7[_0x568e('0x4b')];_0x5549e9['order']=qs[_0x568e('0x6e')](_0x2890b1[_0x568e('0x4d')][_0x568e('0x6e')]);_0x5549e9[_0x568e('0x55')]=qs['filters'](_[_0x568e('0x56')](_0x2890b1[_0x568e('0x4d')],_0x325fa7[_0x568e('0x4c')]));if(_0x2890b1[_0x568e('0x4d')][_0x568e('0x57')]){_0x5549e9['where']=_[_0x568e('0x58')](_0x5549e9[_0x568e('0x55')],{'$or':_[_0x568e('0x46')](_0x5549e9[_0x568e('0x50')],function(_0x33f10b){var _0x569fdb={};_0x569fdb[_0x33f10b]={'$like':'%'+_0x2890b1['query'][_0x568e('0x57')]+'%'};return _0x569fdb;})});}_0x5549e9=_[_0x568e('0x58')]({},_0x5549e9,_0x2890b1[_0x568e('0x5a')]);return _0x3b0e40[_0x568e('0x9a')](_0x5549e9);}})[_0x568e('0x23')](function(_0x1f7728){if(_0x1f7728){_0x33e6d0=_0x1f7728['length'];if(!_0x2890b1[_0x568e('0x4d')][_0x568e('0x52')]('nolimit')){_0x5549e9[_0x568e('0x1f')]=qs[_0x568e('0x1f')](_0x2890b1['query'][_0x568e('0x1f')]);_0x5549e9[_0x568e('0x1d')]=qs[_0x568e('0x1d')](_0x2890b1[_0x568e('0x4d')][_0x568e('0x1d')]);}return _0x3b0e40['getApplications'](_0x5549e9);}})[_0x568e('0x23')](function(_0x3d4e36){if(_0x3d4e36){return _0x3d4e36?{'count':_0x33e6d0,'rows':_0x3d4e36}:null;}})['then'](respondWithResult(_0x196dab,null))[_0x568e('0x5e')](handleError(_0x196dab,null));};exports['getMessages']=function(_0x48ea7f,_0x88c750){var _0x4933ed={'raw':!![],'where':{}};var _0x548ae2={};var _0x518b9b={'count':0x0,'rows':[]};return db[_0x568e('0x47')][_0x568e('0x72')]({'where':{'id':_0x48ea7f[_0x568e('0x69')]['id']}})['then'](handleEntityNotFound(_0x88c750,null))[_0x568e('0x23')](function(_0x208d97){if(_0x208d97){_0x548ae2[_0x568e('0x4b')]=_['keys'](db[_0x568e('0x9b')]['rawAttributes']);_0x548ae2['query']=_[_0x568e('0x6d')](_0x48ea7f[_0x568e('0x4d')]);_0x548ae2[_0x568e('0x4c')]=_[_0x568e('0x4e')](_0x548ae2[_0x568e('0x4b')],_0x548ae2[_0x568e('0x4d')]);_0x4933ed[_0x568e('0x50')]=_[_0x568e('0x4e')](_0x548ae2[_0x568e('0x4b')],qs['fields'](_0x48ea7f[_0x568e('0x4d')][_0x568e('0x4f')]));_0x4933ed[_0x568e('0x50')]=_0x4933ed[_0x568e('0x50')]['length']?_0x4933ed[_0x568e('0x50')]:_0x548ae2[_0x568e('0x4b')];if(!_0x48ea7f[_0x568e('0x4d')]['hasOwnProperty'](_0x568e('0x53'))){_0x4933ed[_0x568e('0x1f')]=qs['limit'](_0x48ea7f[_0x568e('0x4d')][_0x568e('0x1f')]);_0x4933ed[_0x568e('0x1d')]=qs[_0x568e('0x1d')](_0x48ea7f[_0x568e('0x4d')][_0x568e('0x1d')]);}_0x4933ed[_0x568e('0x54')]=qs[_0x568e('0x6e')](_0x48ea7f['query'][_0x568e('0x6e')]);_0x4933ed[_0x568e('0x55')]=qs[_0x568e('0x4c')](_[_0x568e('0x56')](_0x48ea7f[_0x568e('0x4d')],_0x548ae2[_0x568e('0x4c')]));_0x4933ed[_0x568e('0x55')]['MailAccountId']=_0x208d97['id'];if(_0x48ea7f[_0x568e('0x4d')][_0x568e('0x57')]){_0x4933ed[_0x568e('0x55')]=_[_0x568e('0x58')](_0x4933ed[_0x568e('0x55')],{'$or':_[_0x568e('0x46')](_0x4933ed[_0x568e('0x50')],function(_0x3dd179){var _0x3c61a7={};_0x3c61a7[_0x3dd179]={'$like':'%'+_0x48ea7f[_0x568e('0x4d')][_0x568e('0x57')]+'%'};return _0x3c61a7;})});}if(_0x48ea7f[_0x568e('0x4d')][_0x568e('0x9c')]){var _0x2c1215=_0x48ea7f[_0x568e('0x4d')][_0x568e('0x9c')][_0x568e('0x9d')](',');var _0x32b7fd={};_0x32b7fd[_0x2c1215[0x0]]={'$gte':moment(_0x2c1215[0x1])['format'](_0x568e('0x9e'))};_0x4933ed[_0x568e('0x55')]=_[_0x568e('0x58')](_0x4933ed['where'],_0x32b7fd);}_0x4933ed=_['merge']({},_0x4933ed,_0x48ea7f[_0x568e('0x5a')]);return db['MailMessage'][_0x568e('0x5b')]({'where':_0x4933ed[_0x568e('0x55')]})[_0x568e('0x23')](function(_0x3da4df){_0x518b9b[_0x568e('0x5b')]=_0x3da4df;if(_0x48ea7f['query'][_0x568e('0x60')]){_0x4933ed[_0x568e('0x61')]=[{'all':!![]}];}return db[_0x568e('0x9b')][_0x568e('0x5c')](_0x4933ed);})[_0x568e('0x23')](function(_0x59e459){if(_0x48ea7f[_0x568e('0x4d')]['inlineCss']===_0x568e('0x9f')){for(var _0x41ab74=0x0;_0x41ab74<_0x59e459[_0x568e('0x51')];_0x41ab74++){_0x59e459[_0x41ab74][_0x568e('0x63')]=juice(_0x59e459[_0x41ab74][_0x568e('0x63')]);}}_0x518b9b[_0x568e('0x5d')]=_0x59e459;return _0x518b9b;});}})['then'](respondWithFilteredResult(_0x88c750,_0x4933ed))['catch'](handleError(_0x88c750,null));};exports['send']=function(_0xf3acac,_0x1ea593){var _0x7a4a24,_0x584b0f={},_0xdc584f;if(_0xf3acac[_0x568e('0x63')]['to']){_0xdc584f=_0xf3acac['body']['to'][_0x568e('0x9d')](',')[0x0];}return db[_0x568e('0x47')][_0x568e('0x62')]({'where':{'id':_0xf3acac[_0x568e('0x69')]['id']},'include':[{'model':db[_0x568e('0xa0')],'as':'List','include':[{'model':db[_0x568e('0x87')],'as':_0x568e('0xa1'),'where':{'email':_0xdc584f},'limit':0x1,'order':[[_0x568e('0xa2'),_0x568e('0xa3')]]}]},{'model':db[_0x568e('0x43')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x568e('0xa4')],'as':'CloudProvider','raw':!![]}]}]})[_0x568e('0x23')](handleEntityNotFound(_0x1ea593,null))['then'](function(_0x2b23af){if(!_0x2b23af)return;_0x7a4a24=_0x2b23af;if(!_0x2b23af[_0x568e('0x40')])throw new Error(_0x568e('0xa5'));if(_[_0x568e('0xa6')](_0xf3acac[_0x568e('0x63')]['from'])){_0xf3acac[_0x568e('0x63')][_0x568e('0xa7')]=util[_0x568e('0xa8')](_0x568e('0xa9'),_0x2b23af['name'],_0x2b23af['email']||_0x2b23af[_0x568e('0x40')][_0x568e('0x34')]);}if(_0xf3acac['body'][_0x568e('0xaa')]&&_0xf3acac[_0x568e('0x63')][_0x568e('0xaa')]['length']){for(var _0x2397a3=0x0;_0x2397a3<_0xf3acac[_0x568e('0x63')][_0x568e('0xaa')]['length'];_0x2397a3+=0x1){_0xf3acac['body']['attachments'][_0x2397a3]={'filename':_0xf3acac['body'][_0x568e('0xaa')][_0x2397a3][_0x568e('0x28')],'path':path['join'](config[_0x568e('0xab')],'server/files/attachments',_0xf3acac[_0x568e('0x63')]['attachments'][_0x2397a3][_0x568e('0xac')])};}}var _0x46f32b=_0x2b23af['getSmtpOptions']();return respondWithRpcPromise(_0x568e('0xad'),_0x568e('0xae'),{'account':_0x46f32b,'message':_0xf3acac[_0x568e('0x63')]});})[_0x568e('0x23')](function(_0x274481){if(!_0x274481)return;_0x584b0f=_0x274481;if(!_0x7a4a24[_0x568e('0xaf')])throw new Error(_0x568e('0xb0'));if(_0x7a4a24[_0x568e('0xaf')][_0x568e('0xa1')][_0x568e('0x51')])return _0x7a4a24['List'][_0x568e('0xa1')][0x0];return db[_0x568e('0x87')]['create'](_[_0x568e('0xa')](_0xf3acac[_0x568e('0x63')],{'firstName':_0xf3acac[_0x568e('0x63')]['to'],'email':_0xf3acac[_0x568e('0x63')]['to'],'phone':_0xf3acac[_0x568e('0x63')]['to'],'ListId':_0x7a4a24[_0x568e('0x76')]}));})[_0x568e('0x23')](function(_0x89a46a){if(!_0x89a46a)return;var _0x4842a1={'UserId':_0xf3acac[_0x568e('0x34')]['id'],'ContactId':_0x89a46a['id'],'MailAccountId':_0x7a4a24['id'],'inReplyTo':_0x584b0f['messageId'],'to':_0xf3acac[_0x568e('0x63')][_0x568e('0xa7')],'cc':_0xf3acac[_0x568e('0x63')]['cc'],'subject':_0xf3acac[_0x568e('0x63')][_0x568e('0xb1')],'attach':_0xf3acac['body'][_0x568e('0xb2')],'firstMsgDirection':'out','lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'out','Messages':[_[_0x568e('0x58')](_0xf3acac['body'],{'messageId':_0x584b0f[_0x568e('0xb3')],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x7a4a24['id'],'UserId':_0xf3acac['user']['id'],'ContactId':_0x89a46a['id']})]};if(_0xf3acac[_0x568e('0x63')][_0x568e('0xb4')]){_0x4842a1=_['merge'](_0x4842a1,_0xf3acac[_0x568e('0x63')][_0x568e('0xb4')]);}return db[_0x568e('0x85')]['create'](_0x4842a1,{'include':[{'model':db[_0x568e('0x9b')],'as':'Messages'}]});})[_0x568e('0x23')](respondWithResult(_0x1ea593,null))[_0x568e('0x5e')](handleError(_0x1ea593,null));};exports[_0x568e('0xb5')]=function(_0x3b7f29,_0x418713){return db[_0x568e('0x47')][_0x568e('0x62')]({'where':{'id':_0x3b7f29[_0x568e('0x69')]['id']},'include':[{'model':db['MailServerOut'],'as':_0x568e('0x40'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x568e('0xa4'),'raw':!![]}]}]})[_0x568e('0x23')](handleEntityNotFound(_0x418713,null))[_0x568e('0x23')](function(_0x2ff8e6){if(!_0x2ff8e6[_0x568e('0x40')])return;var _0x13522e=_0x2ff8e6['getSmtpOptions']();return respondWithRpcPromise(_0x568e('0xb6'),_0x568e('0xb5'),{'account':_0x13522e});})[_0x568e('0x23')](respondWithResult(_0x418713,null))['catch'](handleError(_0x418713,null));};exports[_0x568e('0x24')]=function(_0x1637dd,_0x340725){return db[_0x568e('0x47')][_0x568e('0x62')]({'where':{'id':_0x1637dd[_0x568e('0x69')]['id']}})['then'](handleEntityNotFound(_0x340725,null))['then'](function(_0x20a6ae){if(_0x20a6ae&&_0x20a6ae[_0x568e('0x3d')]){throw new db[(_0x568e('0xb7'))][(_0x568e('0xb8'))](_0x568e('0xb9'));}return _0x20a6ae;})[_0x568e('0x23')](removeEntity(_0x340725,null))['catch'](handleError(_0x340725,null));};exports[_0x568e('0xba')]=function(_0x590218,_0x19857d){return db['MailAccount'][_0x568e('0x62')]({'where':{'id':_0x590218[_0x568e('0x69')]['id']}})[_0x568e('0x23')](handleEntityNotFound(_0x19857d,null))[_0x568e('0x23')](function(_0x5c3aaf){if(_0x5c3aaf){return _0x5c3aaf[_0x568e('0xba')](_0x590218[_0x568e('0x63')][_0x568e('0x75')],_[_0x568e('0x86')](_0x590218[_0x568e('0x63')],[_0x568e('0x75'),'id'])||{})[_0x568e('0xbb')](function(_0x5ebf9f){for(var _0xef0f66=0x0;_0xef0f66<_0x590218[_0x568e('0x63')][_0x568e('0x75')][_0x568e('0x51')];_0xef0f66+=0x1){socket[_0x568e('0xbc')](_0x568e('0xbd'),{'UserId':Number(_0x590218['body'][_0x568e('0x75')][_0xef0f66]),'MailAccountId':Number(_0x590218[_0x568e('0x69')]['id'])});}return _0x5ebf9f;});}})[_0x568e('0x23')](respondWithResult(_0x19857d,null))['catch'](handleError(_0x19857d,null));};exports['removeAgents']=function(_0x15f260,_0x5b907e){return db['MailAccount']['find']({'where':{'id':_0x15f260['params']['id']}})[_0x568e('0x23')](handleEntityNotFound(_0x5b907e,null))['then'](function(_0x337343){if(_0x337343){return _0x337343['removeAgents'](_0x15f260[_0x568e('0x4d')][_0x568e('0x75')])[_0x568e('0x23')](function(){if(_[_0x568e('0xbe')](_0x15f260[_0x568e('0x4d')][_0x568e('0x75')])){for(var _0x5e3e27=0x0;_0x5e3e27<_0x15f260[_0x568e('0x4d')]['ids'][_0x568e('0x51')];_0x5e3e27+=0x1){socket[_0x568e('0xbc')](_0x568e('0xbf'),{'UserId':Number(_0x15f260[_0x568e('0x4d')][_0x568e('0x75')][_0x5e3e27]),'MailAccountId':Number(_0x15f260[_0x568e('0x69')]['id'])});}}else{socket[_0x568e('0xbc')]('userMailAccount:remove',{'UserId':Number(_0x15f260['query'][_0x568e('0x75')]),'MailAccountId':Number(_0x15f260[_0x568e('0x69')]['id'])});}});}})[_0x568e('0x23')](respondWithStatusCode(_0x5b907e,null))[_0x568e('0x5e')](handleError(_0x5b907e,null));};exports[_0x568e('0xc0')]=function(_0x6ebc3c,_0x10746d){var _0x31c335={};var _0x520f0c={};var _0x425b76;var _0x5d6365;return db[_0x568e('0x47')][_0x568e('0x72')]({'where':{'id':_0x6ebc3c[_0x568e('0x69')]['id']}})['then'](handleEntityNotFound(_0x10746d,null))['then'](function(_0x57bc45){if(_0x57bc45){_0x425b76=_0x57bc45;_0x520f0c['model']=_[_0x568e('0x6d')](db[_0x568e('0x89')][_0x568e('0x48')]);_0x520f0c[_0x568e('0x4d')]=_[_0x568e('0x6d')](_0x6ebc3c[_0x568e('0x4d')]);_0x520f0c[_0x568e('0x4c')]=_['intersection'](_0x520f0c[_0x568e('0x4b')],_0x520f0c[_0x568e('0x4d')]);_0x31c335[_0x568e('0x50')]=_[_0x568e('0x4e')](_0x520f0c['model'],qs[_0x568e('0x4f')](_0x6ebc3c[_0x568e('0x4d')][_0x568e('0x4f')]));_0x31c335[_0x568e('0x50')]=_0x31c335[_0x568e('0x50')][_0x568e('0x51')]?_0x31c335['attributes']:_0x520f0c[_0x568e('0x4b')];_0x31c335['order']=qs[_0x568e('0x6e')](_0x6ebc3c[_0x568e('0x4d')]['sort']);_0x31c335['where']=qs[_0x568e('0x4c')](_[_0x568e('0x56')](_0x6ebc3c[_0x568e('0x4d')],_0x520f0c['filters']));if(_0x6ebc3c[_0x568e('0x4d')][_0x568e('0x57')]){_0x31c335[_0x568e('0x55')]=_['merge'](_0x31c335[_0x568e('0x55')],{'$or':_[_0x568e('0x46')](_0x31c335[_0x568e('0x50')],function(_0x194f61){var _0x4809e8={};_0x4809e8[_0x194f61]={'$like':'%'+_0x6ebc3c[_0x568e('0x4d')][_0x568e('0x57')]+'%'};return _0x4809e8;})});}_0x31c335=_[_0x568e('0x58')]({},_0x31c335,_0x6ebc3c['options']);return _0x425b76[_0x568e('0xc0')](_0x31c335);}})[_0x568e('0x23')](function(_0x156eb0){if(_0x156eb0){_0x5d6365=_0x156eb0['length'];if(!_0x6ebc3c[_0x568e('0x4d')][_0x568e('0x52')](_0x568e('0x53'))){_0x31c335[_0x568e('0x1f')]=qs[_0x568e('0x1f')](_0x6ebc3c['query']['limit']);_0x31c335['offset']=qs[_0x568e('0x1d')](_0x6ebc3c[_0x568e('0x4d')]['offset']);}return _0x425b76[_0x568e('0xc0')](_0x31c335);}})[_0x568e('0x23')](function(_0x55725e){if(_0x55725e){return _0x55725e?{'count':_0x5d6365,'rows':_0x55725e}:null;}})[_0x568e('0x23')](respondWithResult(_0x10746d,null))[_0x568e('0x5e')](handleError(_0x10746d,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 76ed42a..8b7b2a8 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 _0xc373=['../../mysqldb','MailAccount','setMaxListeners','remove','emit','hook','exports'];(function(_0x126245,_0x10b99c){var _0x5dde0a=function(_0x3536f7){while(--_0x3536f7){_0x126245['push'](_0x126245['shift']());}};_0x5dde0a(++_0x10b99c);}(_0xc373,0x1c7));var _0x3c37=function(_0x565fed,_0xb85768){_0x565fed=_0x565fed-0x0;var _0x3e018f=_0xc373[_0x565fed];return _0x3e018f;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0x3c37('0x0'))['db'][_0x3c37('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x3c37('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x3c37('0x3')};function emitEvent(_0x138f81){return function(_0x38d2d3,_0x2ca426,_0x1417ac){MailAccountEvents[_0x3c37('0x4')](_0x138f81+':'+_0x38d2d3['id'],_0x38d2d3);MailAccountEvents['emit'](_0x138f81,_0x38d2d3);_0x1417ac(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x3c37('0x5')](e,emitEvent(event));}}module[_0x3c37('0x6')]=MailAccountEvents; \ No newline at end of file +var _0xaf1b=['hasOwnProperty','exports','events','../../mysqldb','MailAccount','setMaxListeners','save','update','remove','emit'];(function(_0x1a21db,_0x9489fb){var _0x13ea9b=function(_0xb91444){while(--_0xb91444){_0x1a21db['push'](_0x1a21db['shift']());}};_0x13ea9b(++_0x9489fb);}(_0xaf1b,0x11a));var _0xbaf1=function(_0x4b7b9f,_0x1ea2a1){_0x4b7b9f=_0x4b7b9f-0x0;var _0x580c0d=_0xaf1b[_0x4b7b9f];return _0x580c0d;};'use strict';var EventEmitter=require(_0xbaf1('0x0'));var MailAccount=require(_0xbaf1('0x1'))['db'][_0xbaf1('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xbaf1('0x3')](0x0);var events={'afterCreate':_0xbaf1('0x4'),'afterUpdate':_0xbaf1('0x5'),'afterDestroy':_0xbaf1('0x6')};function emitEvent(_0xdf4a1b){return function(_0x461ffb,_0x3fe8f0,_0x156a67){MailAccountEvents[_0xbaf1('0x7')](_0xdf4a1b+':'+_0x461ffb['id'],_0x461ffb);MailAccountEvents[_0xbaf1('0x7')](_0xdf4a1b,_0x461ffb);_0x156a67(null);};}for(var e in events){if(events[_0xbaf1('0x8')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0xbaf1('0x9')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 1613d71..e6f15e7 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 _0xcd11=['MailAccount','mail_accounts','provider','service','host','Smtp','port','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','data5','pass','./mailAccount.attributes','exports','define'];(function(_0x1ed3be,_0x38a1df){var _0x367a56=function(_0x3dfad5){while(--_0x3dfad5){_0x1ed3be['push'](_0x1ed3be['shift']());}};_0x367a56(++_0x38a1df);}(_0xcd11,0x18d));var _0x1cd1=function(_0x159592,_0x85dbf8){_0x159592=_0x159592-0x0;var _0x360fc8=_0xcd11[_0x159592];return _0x360fc8;};'use strict';var attributes=require(_0x1cd1('0x0'));module[_0x1cd1('0x1')]=function(_0x145b68){return _0x145b68[_0x1cd1('0x2')](_0x1cd1('0x3'),attributes,{'tableName':_0x1cd1('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x1bf95f=this;var _0xf7c5bb={'id':_0x1bf95f['id'],'tls':{'rejectUnauthorized':![]}};if(_0x1bf95f[_0x1cd1('0x5')]!=='custom'){_0xf7c5bb[_0x1cd1('0x6')]=_0x1bf95f[_0x1cd1('0x5')];}else{_0xf7c5bb[_0x1cd1('0x7')]=_0x1bf95f[_0x1cd1('0x8')]['host'];_0xf7c5bb[_0x1cd1('0x9')]=_0x1bf95f[_0x1cd1('0x8')][_0x1cd1('0x9')];_0xf7c5bb[_0x1cd1('0xa')]=_0x1bf95f[_0x1cd1('0x8')][_0x1cd1('0xa')];}if(_0x1bf95f[_0x1cd1('0x8')][_0x1cd1('0xb')]){if(_0x1bf95f[_0x1cd1('0x8')][_0x1cd1('0xc')]){if(!_0x1bf95f[_0x1cd1('0x8')][_0x1cd1('0xd')])throw new Error(_0x1cd1('0xe'));_0xf7c5bb[_0x1cd1('0xf')]={'type':_0x1cd1('0x10'),'user':_0x1bf95f['Smtp'][_0x1cd1('0x11')],'accessToken':_0x1bf95f[_0x1cd1('0x8')][_0x1cd1('0xd')][_0x1cd1('0x12')]};}else{_0xf7c5bb['auth']={'user':_0x1bf95f[_0x1cd1('0x8')][_0x1cd1('0x11')],'pass':_0x1bf95f[_0x1cd1('0x8')][_0x1cd1('0x13')]};}}return _0xf7c5bb;}}});}; \ No newline at end of file +var _0xaf1a=['Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2','CloudProvider','data5','auth','pass','./mailAccount.attributes','define','MailAccount','mail_accounts','provider','service','host','Smtp','port','secure','modernAuthentication'];(function(_0x25b17d,_0x21b2ca){var _0x5c1e3b=function(_0x490c90){while(--_0x490c90){_0x25b17d['push'](_0x25b17d['shift']());}};_0x5c1e3b(++_0x21b2ca);}(_0xaf1a,0x127));var _0xaaf1=function(_0x2e4d57,_0x20d07d){_0x2e4d57=_0x2e4d57-0x0;var _0x6c02b1=_0xaf1a[_0x2e4d57];return _0x6c02b1;};'use strict';var attributes=require(_0xaaf1('0x0'));module['exports']=function(_0x2b60fe){return _0x2b60fe[_0xaaf1('0x1')](_0xaaf1('0x2'),attributes,{'tableName':_0xaaf1('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x442692=this;var _0xc2bd1a={'id':_0x442692['id'],'tls':{'rejectUnauthorized':![]}};if(_0x442692[_0xaaf1('0x4')]!=='custom'){_0xc2bd1a[_0xaaf1('0x5')]=_0x442692[_0xaaf1('0x4')];}else{_0xc2bd1a[_0xaaf1('0x6')]=_0x442692[_0xaaf1('0x7')][_0xaaf1('0x6')];_0xc2bd1a[_0xaaf1('0x8')]=_0x442692[_0xaaf1('0x7')]['port'];_0xc2bd1a[_0xaaf1('0x9')]=_0x442692[_0xaaf1('0x7')][_0xaaf1('0x9')];}if(_0x442692[_0xaaf1('0x7')]['authentication']){if(_0x442692[_0xaaf1('0x7')][_0xaaf1('0xa')]){if(!_0x442692[_0xaaf1('0x7')]['CloudProvider'])throw new Error(_0xaaf1('0xb'));_0xc2bd1a['auth']={'type':_0xaaf1('0xc'),'user':_0x442692[_0xaaf1('0x7')]['user'],'accessToken':_0x442692[_0xaaf1('0x7')][_0xaaf1('0xd')][_0xaaf1('0xe')]};}else{_0xc2bd1a[_0xaaf1('0xf')]={'user':_0x442692['Smtp']['user'],'pass':_0x442692[_0xaaf1('0x7')][_0xaaf1('0x10')]};}}return _0xc2bd1a;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index a46d6d3..92383f8 100644 --- a/server/api/mailAccount/mailAccount.rpc.js +++ b/server/api/mailAccount/mailAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['result','catch','MailAccount','findAll','options','attributes','limit','model','include','map','GetMailAccount','find','raw','smtp','setDataValue','smtpOptions','ShowMailAccount','stringify','NotifyMailAccount','body','mail','difference','keys','CmContact','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','get','account','omit','getSmtpOptions','applications','list','orderBy','priority','autoclose','push','length','close','*,*,*,*','defaults','create','List\x20not\x20found','messageId','generate','attach','MailInteraction','update','subject','format','YYYY-MM-DD\x20HH:mm:ss','interaction','created','attachments','originTo','ChatWebsiteId','Email','ChatOfflineMessageId','UserId','User','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./mailAccount.socket','register','then','info','MailAccount,\x20%s,\x20%s','debug','request\x20sent','error','message'];(function(_0x1b7369,_0x5b34c0){var _0xf8a95e=function(_0x37578e){while(--_0x37578e){_0x1b7369['push'](_0x1b7369['shift']());}};_0xf8a95e(++_0x5b34c0);}(_0x2ef3,0xba));var _0x32ef=function(_0x3990bb,_0x31ab67){_0x3990bb=_0x3990bb-0x0;var _0x3b50f8=_0x2ef3[_0x3990bb];return _0x3b50f8;};'use strict';var _=require(_0x32ef('0x0'));var moment=require(_0x32ef('0x1'));var BPromise=require(_0x32ef('0x2'));var rs=require(_0x32ef('0x3'));var Redis=require(_0x32ef('0x4'));var db=require(_0x32ef('0x5'))['db'];var logger=require('../../config/logger')(_0x32ef('0x6'));var config=require(_0x32ef('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x32ef('0x8')][_0x32ef('0x9')]({'port':0x232c});config['redis']=_['defaults'](config[_0x32ef('0xa')],{'host':_0x32ef('0xb'),'port':0x18eb});var socket=require(_0x32ef('0xc'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xd'))[_0x32ef('0xe')](socket);function respondWithRpcPromise(_0x2484a0,_0x2bbb50,_0x28275c){return new BPromise(function(_0x77df79,_0x56eb42){return client['request'](_0x2484a0,_0x28275c)[_0x32ef('0xf')](function(_0x33281d){logger[_0x32ef('0x10')](_0x32ef('0x11'),_0x2bbb50,'request\x20sent');logger[_0x32ef('0x12')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x2bbb50,_0x32ef('0x13'),JSON['stringify'](_0x33281d));if(_0x33281d[_0x32ef('0x14')]){if(_0x33281d[_0x32ef('0x14')]['code']===0x1f4){logger['error'](_0x32ef('0x11'),_0x2bbb50,_0x33281d['error'][_0x32ef('0x15')]);return _0x56eb42(_0x33281d[_0x32ef('0x14')][_0x32ef('0x15')]);}logger[_0x32ef('0x14')]('MailAccount,\x20%s,\x20%s',_0x2bbb50,_0x33281d['error']['message']);return _0x77df79(_0x33281d[_0x32ef('0x14')][_0x32ef('0x15')]);}else{logger[_0x32ef('0x10')]('MailAccount,\x20%s,\x20%s',_0x2bbb50,'request\x20sent');_0x77df79(_0x33281d[_0x32ef('0x16')][_0x32ef('0x15')]);}})[_0x32ef('0x17')](function(_0x57863c){logger[_0x32ef('0x14')](_0x32ef('0x11'),_0x2bbb50,_0x57863c);_0x56eb42(_0x57863c);});});}exports['GetMailAccount']=function(_0x304505){var _0x314ef1=this;return new Promise(function(_0x26aff3,_0x251084){return db[_0x32ef('0x18')][_0x32ef('0x19')]({'raw':_0x304505['options']?_0x304505[_0x32ef('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x304505[_0x32ef('0x1a')]?_0x304505[_0x32ef('0x1a')]['where']||null:null,'attributes':_0x304505[_0x32ef('0x1a')]?_0x304505[_0x32ef('0x1a')][_0x32ef('0x1b')]||null:null,'limit':_0x304505['options']?_0x304505['options'][_0x32ef('0x1c')]||null:null,'include':_0x304505[_0x32ef('0x1a')]?_0x304505[_0x32ef('0x1a')]['include']?_['map'](_0x304505[_0x32ef('0x1a')]['include'],function(_0x51a412){return{'model':db[_0x51a412[_0x32ef('0x1d')]],'as':_0x51a412['as'],'attributes':_0x51a412[_0x32ef('0x1b')],'include':_0x51a412[_0x32ef('0x1e')]?_[_0x32ef('0x1f')](_0x51a412[_0x32ef('0x1e')],function(_0x234175){return{'model':db[_0x234175[_0x32ef('0x1d')]],'as':_0x234175['as'],'attributes':_0x234175[_0x32ef('0x1b')],'include':_0x234175[_0x32ef('0x1e')]?_[_0x32ef('0x1f')](_0x234175[_0x32ef('0x1e')],function(_0xba4b3f){return{'model':db[_0xba4b3f['model']],'as':_0xba4b3f['as'],'attributes':_0xba4b3f[_0x32ef('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x32ef('0xf')](function(_0x5a04cd){logger[_0x32ef('0x10')](_0x32ef('0x20'),_0x304505);logger[_0x32ef('0x12')](_0x32ef('0x20'),_0x304505,JSON['stringify'](_0x5a04cd));_0x26aff3(_0x5a04cd);})[_0x32ef('0x17')](function(_0x22bf86){logger[_0x32ef('0x14')](_0x32ef('0x20'),_0x22bf86[_0x32ef('0x15')],_0x304505);_0x251084(_0x314ef1[_0x32ef('0x14')](0x1f4,_0x22bf86[_0x32ef('0x15')]));});});};exports['ShowMailAccount']=function(_0x36ac37){var _0x537214=this;return new Promise(function(_0x38bf73,_0x2b6c6a){return db['MailAccount'][_0x32ef('0x21')]({'raw':_0x36ac37[_0x32ef('0x1a')]?_0x36ac37[_0x32ef('0x1a')][_0x32ef('0x22')]===undefined?!![]:![]:!![],'where':_0x36ac37[_0x32ef('0x1a')]?_0x36ac37['options']['where']||null:null,'attributes':_0x36ac37[_0x32ef('0x1a')]?_0x36ac37['options'][_0x32ef('0x1b')]||null:null,'include':_0x36ac37[_0x32ef('0x1a')]?_0x36ac37[_0x32ef('0x1a')][_0x32ef('0x1e')]?_[_0x32ef('0x1f')](_0x36ac37[_0x32ef('0x1a')]['include'],function(_0x482d3a){return{'model':db[_0x482d3a['model']],'as':_0x482d3a['as'],'attributes':_0x482d3a[_0x32ef('0x1b')],'include':_0x482d3a[_0x32ef('0x1e')]?_[_0x32ef('0x1f')](_0x482d3a['include'],function(_0x4fb402){return{'model':db[_0x4fb402[_0x32ef('0x1d')]],'as':_0x4fb402['as'],'attributes':_0x4fb402[_0x32ef('0x1b')],'include':_0x4fb402[_0x32ef('0x1e')]?_['map'](_0x4fb402['include'],function(_0xcbdec8){return{'model':db[_0xcbdec8[_0x32ef('0x1d')]],'as':_0xcbdec8['as'],'attributes':_0xcbdec8[_0x32ef('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x32ef('0xf')](function(_0x3a7c49){if(_0x36ac37[_0x32ef('0x1a')][_0x32ef('0x23')]===!![])_0x3a7c49[_0x32ef('0x24')](_0x32ef('0x25'),_0x3a7c49['getSmtpOptions']());logger[_0x32ef('0x10')](_0x32ef('0x26'),_0x36ac37);logger[_0x32ef('0x12')]('ShowMailAccount',_0x36ac37,JSON[_0x32ef('0x27')](_0x3a7c49));_0x38bf73(_0x3a7c49);})[_0x32ef('0x17')](function(_0x879e33){logger[_0x32ef('0x14')](_0x32ef('0x26'),_0x879e33[_0x32ef('0x15')],_0x36ac37);_0x2b6c6a(_0x537214[_0x32ef('0x14')](0x1f4,_0x879e33[_0x32ef('0x15')]));});});};exports[_0x32ef('0x28')]=function(_0x57a3c0){var _0xb4db74=this;return new Promise(function(_0x4615b4,_0x48e071){var _0x3cac2e={'body':_0x57a3c0[_0x32ef('0x29')],'channel':_0x32ef('0x2a')};var _0x1733e3=_[_0x32ef('0x2b')](_[_0x32ef('0x2c')](db[_0x32ef('0x2d')]['rawAttributes']),['createdAt',_0x32ef('0x2e'),_0x32ef('0x2f'),_0x32ef('0x30')]);var _0x765c63=![];if(_0x57a3c0['body']['id']){delete _0x57a3c0[_0x32ef('0x29')]['id'];}if(_[_0x32ef('0x31')](_0x57a3c0['body'][_0x32ef('0x32')])){return _0x48e071(_0xb4db74['error'](0x1f4,_0x32ef('0x33')));}if(_[_0x32ef('0x31')](_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x29')])||_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x29')]===''){return _0x48e071(_0xb4db74[_0x32ef('0x14')](0x1f4,_0x32ef('0x34')));}if(_[_0x32ef('0x31')](_0x57a3c0[_0x32ef('0x29')]['mapKey'])){return _0x48e071(_0xb4db74[_0x32ef('0x14')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1733e3));}if(!_[_0x32ef('0x35')](_0x1733e3,_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x36')])){return _0x48e071(_0xb4db74['error'](0x1f4,_0x32ef('0x37')+_0x1733e3));}var _0x230ac9={};_0x230ac9[_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x36')]]=_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x32')];return db[_0x32ef('0x18')]['find']({'where':{'id':_0x57a3c0['account']['id']},'include':[{'model':db[_0x32ef('0x38')],'as':_0x32ef('0x39'),'include':[{'model':db[_0x32ef('0x2d')],'as':_0x32ef('0x3a'),'where':_0x230ac9,'limit':0x1,'order':[[_0x32ef('0x2e'),_0x32ef('0x3b')]]}]},{'model':db[_0x32ef('0x3c')],'as':_0x32ef('0x3d')},{'model':db[_0x32ef('0x3e')],'as':_0x32ef('0x3f'),'include':[{'model':db[_0x32ef('0x40')],'as':_0x32ef('0x40')}]}]})[_0x32ef('0xf')](function(_0x4c2534){if(_0x4c2534&&_0x4c2534[_0x32ef('0x39')]){var _0x12fbd7=_0x4c2534[_0x32ef('0x41')]({'plain':!![]});_0x3cac2e[_0x32ef('0x42')]=_[_0x32ef('0x43')](_0x12fbd7,[_0x32ef('0x3d'),_0x32ef('0x39')]);_0x3cac2e[_0x32ef('0x42')][_0x32ef('0x25')]=_0x4c2534[_0x32ef('0x44')]();_0x3cac2e[_0x32ef('0x45')]=_0x12fbd7[_0x32ef('0x3d')];_0x3cac2e[_0x32ef('0x46')]=_0x12fbd7[_0x32ef('0x39')];_0x3cac2e[_0x32ef('0x45')]=_[_0x32ef('0x47')](_0x3cac2e[_0x32ef('0x45')],[_0x32ef('0x48')],['asc']);if(_0x3cac2e['account']&&_0x3cac2e[_0x32ef('0x42')][_0x32ef('0x49')]){_0x3cac2e[_0x32ef('0x45')][_0x32ef('0x4a')]({'id':0x0,'priority':_0x3cac2e[_0x32ef('0x45')][_0x32ef('0x4b')]+0x1,'app':_0x32ef('0x4c'),'appdata':_0x32ef('0x49'),'interval':_0x32ef('0x4d')});}if(_0x3cac2e[_0x32ef('0x42')][_0x32ef('0x3d')]){delete _0x3cac2e['account'][_0x32ef('0x3d')];}if(_0x3cac2e[_0x32ef('0x42')][_0x32ef('0x39')]){delete _0x3cac2e[_0x32ef('0x42')][_0x32ef('0x39')];}if(_0x12fbd7[_0x32ef('0x39')]['Contacts'][_0x32ef('0x4b')]){return _0x12fbd7[_0x32ef('0x39')][_0x32ef('0x3a')][0x0];}var _0x56b7ce=_[_0x32ef('0x4e')](_0x57a3c0['body'],{'firstName':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x32')],'ListId':_0x12fbd7['ListId']});_0x56b7ce[_0x57a3c0[_0x32ef('0x29')]['mapKey']]=_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x32')];return db[_0x32ef('0x2d')][_0x32ef('0x4f')](_0x56b7ce);}else{throw new Error(_0x32ef('0x50'));}})[_0x32ef('0xf')](function(_0x42c7f4){_0x3cac2e['contact']=_0x42c7f4;if(_0x42c7f4){if(!_0x57a3c0['body'][_0x32ef('0x15')]['messageId']){_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x51')]=rs[_0x32ef('0x52')]()+'\x20'+_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x32')];}var _0x316547={'ContactId':_0x42c7f4['id'],'MailAccountId':_0x57a3c0[_0x32ef('0x42')]['id'],'inReplyTo':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['messageId'],'to':_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x32')],'cc':_0x57a3c0['body'][_0x32ef('0x15')]['cc'],'subject':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['subject'],'attach':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x53')],'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x32ef('0x54')]['find']({'where':{'closed':![],'MailAccountId':_0x57a3c0[_0x32ef('0x42')]['id']},'include':[{'model':db['MailMessage'],'as':'Messages','attributes':[_0x32ef('0x51')],'where':{'messageId':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['inReplyTo']}}]})[_0x32ef('0xf')](function(_0x222b24){if(_0x222b24){return[_0x222b24,![]];}return db[_0x32ef('0x54')]['create'](_0x316547)[_0x32ef('0xf')](function(_0x12b7f8){return[_0x12b7f8,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x2e20dc,_0x3a6697){if(_0x2e20dc){_0x765c63=_0x3a6697;if(!_0x3a6697){return _0x2e20dc[_0x32ef('0x55')]({'inReplyTo':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x51')],'to':_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x32')],'cc':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['cc'],'subject':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x56')],'attach':_0x2e20dc[_0x32ef('0x53')]?_0x2e20dc[_0x32ef('0x53')]:_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x53')],'substatus':null,'substatusAt':moment()[_0x32ef('0x57')](_0x32ef('0x58')),'lastMsgAt':moment()[_0x32ef('0x57')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x2e20dc;}}})['then'](function(_0x2125de){_0x3cac2e[_0x32ef('0x59')]=_0x2125de[_0x32ef('0x41')]({'plain':!![]});_0x3cac2e[_0x32ef('0x59')][_0x32ef('0x5a')]=_0x765c63;return db['MailMessage'][_0x32ef('0x4f')]({'body':_0x57a3c0['body'][_0x32ef('0x29')],'MailAccountId':_0x57a3c0[_0x32ef('0x42')]['id'],'MailInteractionId':_0x2125de['id'],'direction':'in','ContactId':_0x3cac2e['contact']['id'],'messageId':_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x51')],'from':_0x57a3c0[_0x32ef('0x29')]['message']['from'],'to':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['to'],'cc':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['cc'],'subject':_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x56')],'attach':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x53')],'Attachments':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x5b')],'originTo':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x5c')],'originCc':_0x57a3c0[_0x32ef('0x29')]['message']['originCc'],'bcc':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['bcc'],'ChatWebsiteId':_0x57a3c0[_0x32ef('0x29')]['message'][_0x32ef('0x5d')]||null,'originChannel':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['originChannel']||_0x32ef('0x5e'),'ChatOfflineMessageId':_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x5f')]||null},{'include':[{'model':db['Attachment'],'as':'Attachments'}]});})[_0x32ef('0xf')](function(_0x5970db){_0x3cac2e[_0x32ef('0x15')]=_0x5970db;if(_0x3cac2e['interaction'][_0x32ef('0x60')]){return db[_0x32ef('0x61')][_0x32ef('0x21')]({'attributes':['id','name'],'where':{'id':_0x3cac2e['interaction']['UserId']}})[_0x32ef('0xf')](function(_0x5e5766){if(_0x5e5766){_0x3cac2e[_0x32ef('0x45')][_0x32ef('0x62')]({'id':0x0,'priority':0x0,'app':_0x32ef('0x63'),'appdata':_0x5e5766[_0x32ef('0x64')]+','+(_0x3cac2e[_0x32ef('0x42')][_0x32ef('0x65')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x32ef('0x66'),'startRouting',_0x3cac2e);});}return respondWithRpcPromise('Start',_0x32ef('0x67'),_0x3cac2e);})['then'](function(_0x145e27){_0x4615b4(_0x145e27);})[_0x32ef('0x17')](function(_0x4d64ec){_0x48e071(_0xb4db74[_0x32ef('0x14')](0x1f4,_0x4d64ec[_0x32ef('0x15')]));});});}; \ No newline at end of file +var _0x896e=['createdAt','updatedAt','ListId','from','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','List','list','orderBy','asc','autoclose','applications','length','close','*,*,*,*','Contacts','create','List\x20not\x20found','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inReplyTo','MailInteraction','Contact\x20not\x20found','spread','update','interaction','get','attachments','originTo','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','UserId','User','name','unshift','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetMailAccount','MailAccount','options','where','attributes','limit','include','map','model','then','ShowMailAccount','find','setDataValue','smtpOptions','getSmtpOptions','stringify','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes'];(function(_0xb0e018,_0x499065){var _0x2aaef0=function(_0x1bbe17){while(--_0x1bbe17){_0xb0e018['push'](_0xb0e018['shift']());}};_0x2aaef0(++_0x499065);}(_0x896e,0x1e9));var _0xe896=function(_0x3edf7c,_0x60fdce){_0x3edf7c=_0x3edf7c-0x0;var _0xab84e3=_0x896e[_0x3edf7c];return _0xab84e3;};'use strict';var _=require(_0xe896('0x0'));var moment=require(_0xe896('0x1'));var BPromise=require(_0xe896('0x2'));var rs=require(_0xe896('0x3'));var Redis=require(_0xe896('0x4'));var db=require(_0xe896('0x5'))['db'];var logger=require(_0xe896('0x6'))(_0xe896('0x7'));var config=require(_0xe896('0x8'));var jayson=require(_0xe896('0x9'));var client=jayson[_0xe896('0xa')][_0xe896('0xb')]({'port':0x232c});config['redis']=_[_0xe896('0xc')](config[_0xe896('0xd')],{'host':_0xe896('0xe'),'port':0x18eb});var socket=require(_0xe896('0xf'))(new Redis(config[_0xe896('0xd')]));require('./mailAccount.socket')[_0xe896('0x10')](socket);function respondWithRpcPromise(_0x14b7e4,_0x37a90d,_0x4afd3f){return new BPromise(function(_0x305616,_0x48251e){return client[_0xe896('0x11')](_0x14b7e4,_0x4afd3f)['then'](function(_0x409eaf){logger[_0xe896('0x12')](_0xe896('0x13'),_0x37a90d,'request\x20sent');logger[_0xe896('0x14')](_0xe896('0x15'),_0x37a90d,_0xe896('0x16'),JSON['stringify'](_0x409eaf));if(_0x409eaf[_0xe896('0x17')]){if(_0x409eaf[_0xe896('0x17')][_0xe896('0x18')]===0x1f4){logger['error'](_0xe896('0x13'),_0x37a90d,_0x409eaf[_0xe896('0x17')][_0xe896('0x19')]);return _0x48251e(_0x409eaf['error']['message']);}logger[_0xe896('0x17')](_0xe896('0x13'),_0x37a90d,_0x409eaf['error']['message']);return _0x305616(_0x409eaf[_0xe896('0x17')][_0xe896('0x19')]);}else{logger['info'](_0xe896('0x13'),_0x37a90d,'request\x20sent');_0x305616(_0x409eaf[_0xe896('0x1a')][_0xe896('0x19')]);}})[_0xe896('0x1b')](function(_0x5dc89d){logger[_0xe896('0x17')](_0xe896('0x13'),_0x37a90d,_0x5dc89d);_0x48251e(_0x5dc89d);});});}exports[_0xe896('0x1c')]=function(_0xbebbe1){var _0x2693d6=this;return new Promise(function(_0x3ac8b8,_0x388c2e){return db[_0xe896('0x1d')]['findAll']({'raw':_0xbebbe1[_0xe896('0x1e')]?_0xbebbe1['options']['raw']===undefined?!![]:![]:!![],'where':_0xbebbe1[_0xe896('0x1e')]?_0xbebbe1[_0xe896('0x1e')][_0xe896('0x1f')]||null:null,'attributes':_0xbebbe1[_0xe896('0x1e')]?_0xbebbe1['options'][_0xe896('0x20')]||null:null,'limit':_0xbebbe1['options']?_0xbebbe1['options'][_0xe896('0x21')]||null:null,'include':_0xbebbe1[_0xe896('0x1e')]?_0xbebbe1[_0xe896('0x1e')][_0xe896('0x22')]?_[_0xe896('0x23')](_0xbebbe1[_0xe896('0x1e')][_0xe896('0x22')],function(_0x4b71cc){return{'model':db[_0x4b71cc[_0xe896('0x24')]],'as':_0x4b71cc['as'],'attributes':_0x4b71cc[_0xe896('0x20')],'include':_0x4b71cc[_0xe896('0x22')]?_['map'](_0x4b71cc[_0xe896('0x22')],function(_0xd50fe2){return{'model':db[_0xd50fe2[_0xe896('0x24')]],'as':_0xd50fe2['as'],'attributes':_0xd50fe2[_0xe896('0x20')],'include':_0xd50fe2[_0xe896('0x22')]?_[_0xe896('0x23')](_0xd50fe2['include'],function(_0x10adad){return{'model':db[_0x10adad[_0xe896('0x24')]],'as':_0x10adad['as'],'attributes':_0x10adad[_0xe896('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe896('0x25')](function(_0xace03f){logger['info']('GetMailAccount',_0xbebbe1);logger['debug']('GetMailAccount',_0xbebbe1,JSON['stringify'](_0xace03f));_0x3ac8b8(_0xace03f);})[_0xe896('0x1b')](function(_0x29a18e){logger[_0xe896('0x17')](_0xe896('0x1c'),_0x29a18e[_0xe896('0x19')],_0xbebbe1);_0x388c2e(_0x2693d6[_0xe896('0x17')](0x1f4,_0x29a18e[_0xe896('0x19')]));});});};exports[_0xe896('0x26')]=function(_0x4ab96b){var _0x4ce052=this;return new Promise(function(_0x142d29,_0x255dd1){return db[_0xe896('0x1d')][_0xe896('0x27')]({'raw':_0x4ab96b['options']?_0x4ab96b[_0xe896('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x4ab96b['options']?_0x4ab96b[_0xe896('0x1e')][_0xe896('0x1f')]||null:null,'attributes':_0x4ab96b[_0xe896('0x1e')]?_0x4ab96b['options']['attributes']||null:null,'include':_0x4ab96b['options']?_0x4ab96b[_0xe896('0x1e')][_0xe896('0x22')]?_[_0xe896('0x23')](_0x4ab96b[_0xe896('0x1e')][_0xe896('0x22')],function(_0x486eb5){return{'model':db[_0x486eb5[_0xe896('0x24')]],'as':_0x486eb5['as'],'attributes':_0x486eb5[_0xe896('0x20')],'include':_0x486eb5[_0xe896('0x22')]?_[_0xe896('0x23')](_0x486eb5[_0xe896('0x22')],function(_0x2cce09){return{'model':db[_0x2cce09[_0xe896('0x24')]],'as':_0x2cce09['as'],'attributes':_0x2cce09[_0xe896('0x20')],'include':_0x2cce09['include']?_[_0xe896('0x23')](_0x2cce09[_0xe896('0x22')],function(_0x5a2dd2){return{'model':db[_0x5a2dd2[_0xe896('0x24')]],'as':_0x5a2dd2['as'],'attributes':_0x5a2dd2['attributes']};}):[]};}):[]};}):[]:[]})[_0xe896('0x25')](function(_0x4f164f){if(_0x4ab96b[_0xe896('0x1e')]['smtp']===!![])_0x4f164f[_0xe896('0x28')](_0xe896('0x29'),_0x4f164f[_0xe896('0x2a')]());logger[_0xe896('0x12')](_0xe896('0x26'),_0x4ab96b);logger['debug']('ShowMailAccount',_0x4ab96b,JSON[_0xe896('0x2b')](_0x4f164f));_0x142d29(_0x4f164f);})[_0xe896('0x1b')](function(_0x387cc6){logger[_0xe896('0x17')](_0xe896('0x26'),_0x387cc6['message'],_0x4ab96b);_0x255dd1(_0x4ce052['error'](0x1f4,_0x387cc6[_0xe896('0x19')]));});});};exports[_0xe896('0x2c')]=function(_0x5890b1){var _0x57e194=this;return new Promise(function(_0x19d2fd,_0x3b1de8){var _0x911adb={'body':_0x5890b1[_0xe896('0x2d')],'channel':_0xe896('0x2e')};var _0x41fa6f=_[_0xe896('0x2f')](_[_0xe896('0x30')](db[_0xe896('0x31')][_0xe896('0x32')]),[_0xe896('0x33'),_0xe896('0x34'),'CompanyId',_0xe896('0x35')]);var _0x143ad4=![];if(_0x5890b1['body']['id']){delete _0x5890b1['body']['id'];}if(_['isNil'](_0x5890b1[_0xe896('0x2d')][_0xe896('0x36')])){return _0x3b1de8(_0x57e194[_0xe896('0x17')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0xe896('0x37')](_0x5890b1[_0xe896('0x2d')]['body'])||_0x5890b1['body']['body']===''){return _0x3b1de8(_0x57e194[_0xe896('0x17')](0x1f4,_0xe896('0x38')));}if(_[_0xe896('0x37')](_0x5890b1[_0xe896('0x2d')][_0xe896('0x39')])){return _0x3b1de8(_0x57e194[_0xe896('0x17')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x41fa6f));}if(!_[_0xe896('0x3a')](_0x41fa6f,_0x5890b1[_0xe896('0x2d')]['mapKey'])){return _0x3b1de8(_0x57e194[_0xe896('0x17')](0x1f4,_0xe896('0x3b')+_0x41fa6f));}var _0x179fc2={};_0x179fc2[_0x5890b1[_0xe896('0x2d')]['mapKey']]=_0x5890b1[_0xe896('0x2d')][_0xe896('0x36')];return db[_0xe896('0x1d')][_0xe896('0x27')]({'where':{'id':_0x5890b1[_0xe896('0x3c')]['id']},'include':[{'model':db[_0xe896('0x3d')],'as':'List','include':[{'model':db[_0xe896('0x31')],'as':'Contacts','where':_0x179fc2,'limit':0x1,'order':[[_0xe896('0x34'),_0xe896('0x3e')]]}]},{'model':db[_0xe896('0x3f')],'as':_0xe896('0x40')},{'model':db[_0xe896('0x41')],'as':_0xe896('0x42'),'include':[{'model':db['CloudProvider'],'as':_0xe896('0x43')}]}]})[_0xe896('0x25')](function(_0x4818cd){if(_0x4818cd&&_0x4818cd[_0xe896('0x44')]){var _0x355443=_0x4818cd['get']({'plain':!![]});_0x911adb[_0xe896('0x3c')]=_['omit'](_0x355443,[_0xe896('0x40'),_0xe896('0x44')]);_0x911adb[_0xe896('0x3c')][_0xe896('0x29')]=_0x4818cd[_0xe896('0x2a')]();_0x911adb['applications']=_0x355443[_0xe896('0x40')];_0x911adb[_0xe896('0x45')]=_0x355443[_0xe896('0x44')];_0x911adb['applications']=_[_0xe896('0x46')](_0x911adb['applications'],['priority'],[_0xe896('0x47')]);if(_0x911adb[_0xe896('0x3c')]&&_0x911adb['account'][_0xe896('0x48')]){_0x911adb[_0xe896('0x49')]['push']({'id':0x0,'priority':_0x911adb['applications'][_0xe896('0x4a')]+0x1,'app':_0xe896('0x4b'),'appdata':'autoclose','interval':_0xe896('0x4c')});}if(_0x911adb[_0xe896('0x3c')][_0xe896('0x40')]){delete _0x911adb[_0xe896('0x3c')][_0xe896('0x40')];}if(_0x911adb[_0xe896('0x3c')][_0xe896('0x44')]){delete _0x911adb[_0xe896('0x3c')][_0xe896('0x44')];}if(_0x355443[_0xe896('0x44')][_0xe896('0x4d')]['length']){return _0x355443[_0xe896('0x44')][_0xe896('0x4d')][0x0];}var _0x131c1c=_[_0xe896('0xc')](_0x5890b1[_0xe896('0x2d')],{'firstName':_0x5890b1[_0xe896('0x2d')][_0xe896('0x36')],'ListId':_0x355443[_0xe896('0x35')]});_0x131c1c[_0x5890b1[_0xe896('0x2d')][_0xe896('0x39')]]=_0x5890b1[_0xe896('0x2d')][_0xe896('0x36')];return db['CmContact'][_0xe896('0x4e')](_0x131c1c);}else{throw new Error(_0xe896('0x4f'));}})[_0xe896('0x25')](function(_0x5180b6){_0x911adb['contact']=_0x5180b6;if(_0x5180b6){if(!_0x5890b1['body'][_0xe896('0x19')][_0xe896('0x50')]){_0x5890b1[_0xe896('0x2d')][_0xe896('0x19')]['messageId']=rs[_0xe896('0x51')]()+'\x20'+_0x5890b1[_0xe896('0x2d')][_0xe896('0x19')][_0xe896('0x36')];}var _0x5d6c1c={'ContactId':_0x5180b6['id'],'MailAccountId':_0x5890b1[_0xe896('0x3c')]['id'],'inReplyTo':_0x5890b1[_0xe896('0x2d')]['message'][_0xe896('0x50')],'to':_0x5890b1[_0xe896('0x2d')]['message']['from'],'cc':_0x5890b1[_0xe896('0x2d')][_0xe896('0x19')]['cc'],'subject':_0x5890b1[_0xe896('0x2d')][_0xe896('0x19')][_0xe896('0x52')],'attach':_0x5890b1['body'][_0xe896('0x19')][_0xe896('0x53')],'lastMsgAt':moment()[_0xe896('0x54')](_0xe896('0x55')),'lastMsgDirection':'in'};return db['MailInteraction']['find']({'where':{'closed':![],'MailAccountId':_0x5890b1[_0xe896('0x3c')]['id']},'include':[{'model':db[_0xe896('0x56')],'as':'Messages','attributes':[_0xe896('0x50')],'where':{'messageId':_0x5890b1['body'][_0xe896('0x19')][_0xe896('0x57')]}}]})[_0xe896('0x25')](function(_0x3cc348){if(_0x3cc348){return[_0x3cc348,![]];}return db[_0xe896('0x58')][_0xe896('0x4e')](_0x5d6c1c)[_0xe896('0x25')](function(_0x117e92){return[_0x117e92,!![]];});});}else{throw new Error(_0xe896('0x59'));}})[_0xe896('0x5a')](function(_0xcb329a,_0x3248e6){if(_0xcb329a){_0x143ad4=_0x3248e6;if(!_0x3248e6){return _0xcb329a[_0xe896('0x5b')]({'inReplyTo':_0x5890b1[_0xe896('0x2d')][_0xe896('0x19')][_0xe896('0x50')],'to':_0x5890b1[_0xe896('0x2d')][_0xe896('0x19')][_0xe896('0x36')],'cc':_0x5890b1[_0xe896('0x2d')][_0xe896('0x19')]['cc'],'subject':_0x5890b1[_0xe896('0x2d')]['message']['subject'],'attach':_0xcb329a[_0xe896('0x53')]?_0xcb329a[_0xe896('0x53')]:_0x5890b1['body'][_0xe896('0x19')][_0xe896('0x53')],'substatus':null,'substatusAt':moment()[_0xe896('0x54')](_0xe896('0x55')),'lastMsgAt':moment()[_0xe896('0x54')](_0xe896('0x55')),'lastMsgDirection':'in'});}else{return _0xcb329a;}}})[_0xe896('0x25')](function(_0x40e91d){_0x911adb[_0xe896('0x5c')]=_0x40e91d[_0xe896('0x5d')]({'plain':!![]});_0x911adb[_0xe896('0x5c')]['created']=_0x143ad4;return db[_0xe896('0x56')][_0xe896('0x4e')]({'body':_0x5890b1['body'][_0xe896('0x2d')],'MailAccountId':_0x5890b1['account']['id'],'MailInteractionId':_0x40e91d['id'],'direction':'in','ContactId':_0x911adb['contact']['id'],'messageId':_0x5890b1[_0xe896('0x2d')][_0xe896('0x19')]['messageId'],'from':_0x5890b1['body'][_0xe896('0x19')]['from'],'to':_0x5890b1['body'][_0xe896('0x19')]['to'],'cc':_0x5890b1[_0xe896('0x2d')][_0xe896('0x19')]['cc'],'subject':_0x5890b1['body'][_0xe896('0x19')][_0xe896('0x52')],'attach':_0x5890b1[_0xe896('0x2d')]['message'][_0xe896('0x53')],'Attachments':_0x5890b1[_0xe896('0x2d')][_0xe896('0x19')][_0xe896('0x5e')],'originTo':_0x5890b1['body'][_0xe896('0x19')][_0xe896('0x5f')],'originCc':_0x5890b1[_0xe896('0x2d')][_0xe896('0x19')]['originCc'],'bcc':_0x5890b1[_0xe896('0x2d')][_0xe896('0x19')]['bcc'],'ChatWebsiteId':_0x5890b1[_0xe896('0x2d')][_0xe896('0x19')][_0xe896('0x60')]||null,'originChannel':_0x5890b1[_0xe896('0x2d')]['message'][_0xe896('0x61')]||_0xe896('0x62'),'ChatOfflineMessageId':_0x5890b1[_0xe896('0x2d')][_0xe896('0x19')][_0xe896('0x63')]||null},{'include':[{'model':db[_0xe896('0x64')],'as':'Attachments'}]});})['then'](function(_0x48b523){_0x911adb[_0xe896('0x19')]=_0x48b523;if(_0x911adb[_0xe896('0x5c')][_0xe896('0x65')]){return db[_0xe896('0x66')][_0xe896('0x27')]({'attributes':['id',_0xe896('0x67')],'where':{'id':_0x911adb[_0xe896('0x5c')]['UserId']}})['then'](function(_0x4674ba){if(_0x4674ba){_0x911adb['applications'][_0xe896('0x68')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4674ba[_0xe896('0x67')]+','+(_0x911adb['account'][_0xe896('0x69')]||0xa),'interval':_0xe896('0x4c')});}return respondWithRpcPromise(_0xe896('0x6a'),_0xe896('0x6b'),_0x911adb);});}return respondWithRpcPromise(_0xe896('0x6a'),'startRouting',_0x911adb);})[_0xe896('0x25')](function(_0x35306d){_0x19d2fd(_0x35306d);})[_0xe896('0x1b')](function(_0x1bcfda){_0x3b1de8(_0x57e194[_0xe896('0x17')](0x1f4,_0x1bcfda[_0xe896('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index ed21213..a7f0f0c 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 _0x15f7=['update','emit','removeListener','mailAccount:','./mailAccount.events','save','remove'];(function(_0x13512f,_0xa1f7ab){var _0x550a19=function(_0x3d28a0){while(--_0x3d28a0){_0x13512f['push'](_0x13512f['shift']());}};_0x550a19(++_0xa1f7ab);}(_0x15f7,0xe4));var _0x715f=function(_0x2ed1a0,_0x36acd9){_0x2ed1a0=_0x2ed1a0-0x0;var _0x3d272e=_0x15f7[_0x2ed1a0];return _0x3d272e;};'use strict';var MailAccountEvents=require(_0x715f('0x0'));var events=[_0x715f('0x1'),_0x715f('0x2'),_0x715f('0x3')];function createListener(_0x1eabfd,_0x295140){return function(_0x485a62){_0x295140[_0x715f('0x4')](_0x1eabfd,_0x485a62);};}function removeListener(_0x1fe925,_0x1e1348){return function(){MailAccountEvents[_0x715f('0x5')](_0x1fe925,_0x1e1348);};}exports['register']=function(_0xd396ca){for(var _0x463f81=0x0,_0x567e81=events['length'];_0x463f81<_0x567e81;_0x463f81++){var _0x2c4a2d=events[_0x463f81];var _0x46569f=createListener(_0x715f('0x6')+_0x2c4a2d,_0xd396ca);MailAccountEvents['on'](_0x2c4a2d,_0x46569f);}}; \ No newline at end of file +var _0x3743=['mailAccount:','./mailAccount.events','remove','register'];(function(_0x4bb8d2,_0x230aef){var _0x56a60c=function(_0x3236a2){while(--_0x3236a2){_0x4bb8d2['push'](_0x4bb8d2['shift']());}};_0x56a60c(++_0x230aef);}(_0x3743,0xd1));var _0x3374=function(_0x322522,_0x4db288){_0x322522=_0x322522-0x0;var _0x293bcf=_0x3743[_0x322522];return _0x293bcf;};'use strict';var MailAccountEvents=require(_0x3374('0x0'));var events=['save',_0x3374('0x1'),'update'];function createListener(_0x277e80,_0x4a6d3d){return function(_0x3cea88){_0x4a6d3d['emit'](_0x277e80,_0x3cea88);};}function removeListener(_0x5c0aeb,_0x528f18){return function(){MailAccountEvents['removeListener'](_0x5c0aeb,_0x528f18);};}exports[_0x3374('0x2')]=function(_0x45c93a){for(var _0x56998f=0x0,_0x230a13=events['length'];_0x56998f<_0x230a13;_0x56998f++){var _0xb537e6=events[_0x56998f];var _0x2f6287=createListener(_0x3374('0x3')+_0xb537e6,_0x45c93a);MailAccountEvents['on'](_0xb537e6,_0x2f6287);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index dbcd224..df56e9e 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 _0x7995=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','show','put','isAuthenticated'];(function(_0x54ea12,_0x501c73){var _0x5d0555=function(_0x218380){while(--_0x218380){_0x54ea12['push'](_0x54ea12['shift']());}};_0x5d0555(++_0x501c73);}(_0x7995,0x159));var _0x5799=function(_0x5ee916,_0x59b132){_0x5ee916=_0x5ee916-0x0;var _0x4e31f8=_0x7995[_0x5ee916];return _0x4e31f8;};'use strict';var multer=require(_0x5799('0x0'));var util=require(_0x5799('0x1'));var path=require(_0x5799('0x2'));var timeout=require(_0x5799('0x3'));var express=require(_0x5799('0x4'));var router=express[_0x5799('0x5')]();var fs_extra=require(_0x5799('0x6'));var auth=require(_0x5799('0x7'));var interaction=require(_0x5799('0x8'));var config=require(_0x5799('0x9'));var controller=require('./mailApplication.controller');router[_0x5799('0xa')](_0x5799('0xb'),auth['isAuthenticated'](),controller[_0x5799('0xc')]);router[_0x5799('0xd')](_0x5799('0xb'),auth[_0x5799('0xe')](),controller[_0x5799('0xf')]);router['delete']('/:id',auth[_0x5799('0xe')](),controller[_0x5799('0x10')]);module[_0x5799('0x11')]=router; \ No newline at end of file +var _0xae23=['show','/:id','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','isAuthenticated'];(function(_0xc829c2,_0x174efd){var _0x1bdd2a=function(_0x33a147){while(--_0x33a147){_0xc829c2['push'](_0xc829c2['shift']());}};_0x1bdd2a(++_0x174efd);}(_0xae23,0x138));var _0x3ae2=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xae23[_0x521929];return _0x632436;};'use strict';var multer=require(_0x3ae2('0x0'));var util=require(_0x3ae2('0x1'));var path=require(_0x3ae2('0x2'));var timeout=require('connect-timeout');var express=require(_0x3ae2('0x3'));var router=express[_0x3ae2('0x4')]();var fs_extra=require(_0x3ae2('0x5'));var auth=require(_0x3ae2('0x6'));var interaction=require(_0x3ae2('0x7'));var config=require(_0x3ae2('0x8'));var controller=require(_0x3ae2('0x9'));router[_0x3ae2('0xa')]('/:id',auth[_0x3ae2('0xb')](),controller[_0x3ae2('0xc')]);router['put'](_0x3ae2('0xd'),auth[_0x3ae2('0xb')](),controller[_0x3ae2('0xe')]);router[_0x3ae2('0xf')](_0x3ae2('0xd'),auth['isAuthenticated'](),controller[_0x3ae2('0x10')]);module[_0x3ae2('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 7c4510c..fd1d407 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 _0xb5f2=['sequelize','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x4de8f9,_0xde3981){var _0x472379=function(_0x4f40ee){while(--_0x4f40ee){_0x4de8f9['push'](_0x4de8f9['shift']());}};_0x472379(++_0xde3981);}(_0xb5f2,0x1ec));var _0x2b5f=function(_0x80e749,_0x3b2c7d){_0x80e749=_0x80e749-0x0;var _0x4ec793=_0xb5f2[_0x80e749];return _0x4ec793;};'use strict';var Sequelize=require(_0x2b5f('0x0'));module['exports']={'priority':{'type':Sequelize[_0x2b5f('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x2b5f('0x2')],'allowNull':![],'defaultValue':_0x2b5f('0x3')},'appdata':{'type':Sequelize[_0x2b5f('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x2b5f('0x2')],'defaultValue':_0x2b5f('0x5')}}; \ No newline at end of file +var _0x4f3a=['*,*,*,*','exports','INTEGER','STRING','TEXT'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x4f3a,0x92));var _0xa4f3=function(_0x22b39b,_0x2b7d63){_0x22b39b=_0x22b39b-0x0;var _0x280e1d=_0x4f3a[_0x22b39b];return _0x280e1d;};'use strict';var Sequelize=require('sequelize');module[_0xa4f3('0x0')]={'priority':{'type':Sequelize[_0xa4f3('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xa4f3('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xa4f3('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xa4f3('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 5ec5666..61a8f78 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 _0x0713=['catch','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','show','params','MailApplication','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','includeAll','include','merge','options','find','body'];(function(_0x38e33c,_0x598768){var _0x50a9f6=function(_0x22086a){while(--_0x22086a){_0x38e33c['push'](_0x38e33c['shift']());}};_0x50a9f6(++_0x598768);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3071('0x0'));var jsonpatch=require(_0x3071('0x1'));var rp=require(_0x3071('0x2'));var moment=require(_0x3071('0x3'));var BPromise=require(_0x3071('0x4'));var Mustache=require('mustache');var util=require(_0x3071('0x5'));var path=require(_0x3071('0x6'));var sox=require(_0x3071('0x7'));var csv=require(_0x3071('0x8'));var ejs=require(_0x3071('0x9'));var fs=require('fs');var fs_extra=require(_0x3071('0xa'));var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x8'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var licenseUtil=require(_0x3071('0x19'));var db=require(_0x3071('0x1a'))['db'];function respondWithStatusCode(_0x4a8cc7,_0x5330a8){_0x5330a8=_0x5330a8||0xcc;return function(_0x1826ca){if(_0x1826ca){return _0x4a8cc7['sendStatus'](_0x5330a8);}return _0x4a8cc7[_0x3071('0x1b')](_0x5330a8)[_0x3071('0x1c')]();};}function respondWithResult(_0x5d4883,_0x104e73){_0x104e73=_0x104e73||0xc8;return function(_0x4e1219){if(_0x4e1219){return _0x5d4883[_0x3071('0x1b')](_0x104e73)[_0x3071('0x1d')](_0x4e1219);}};}function respondWithFilteredResult(_0x1271d0,_0x1f14e1){return function(_0x1caa5d){if(_0x1caa5d){var _0x2a6a4b=typeof _0x1f14e1[_0x3071('0x1e')]===_0x3071('0x1f')&&typeof _0x1f14e1[_0x3071('0x20')]===_0x3071('0x1f');var _0x5f3c22=_0x1caa5d[_0x3071('0x21')];var _0x17dbda=_0x2a6a4b?0x0:_0x1f14e1[_0x3071('0x1e')];var _0x108a83=_0x2a6a4b?_0x1caa5d[_0x3071('0x21')]:_0x1f14e1[_0x3071('0x1e')]+_0x1f14e1[_0x3071('0x20')];var _0x26f113;if(_0x108a83>=_0x5f3c22){_0x108a83=_0x5f3c22;_0x26f113=0xc8;}else{_0x26f113=0xce;}_0x1271d0['status'](_0x26f113);return _0x1271d0[_0x3071('0x22')](_0x3071('0x23'),_0x17dbda+'-'+_0x108a83+'/'+_0x5f3c22)[_0x3071('0x1d')](_0x1caa5d);}return null;};}function patchUpdates(_0x56c267){return function(_0xb8f4e3){try{jsonpatch['apply'](_0xb8f4e3,_0x56c267,!![]);}catch(_0x833074){return BPromise[_0x3071('0x24')](_0x833074);}return _0xb8f4e3[_0x3071('0x25')]();};}function saveUpdates(_0x457b57,_0x33090c){return function(_0x34c50e){if(_0x34c50e){return _0x34c50e[_0x3071('0x26')](_0x457b57)[_0x3071('0x27')](function(_0x542646){return _0x542646;});}return null;};}function removeEntity(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(_0xb05b1d){return _0xb05b1d[_0x3071('0x28')]()[_0x3071('0x27')](function(){_0x481a51[_0x3071('0x1b')](0xcc)[_0x3071('0x1c')]();});}};}function handleEntityNotFound(_0x7a4cb4,_0x1fe727){return function(_0x1de5fb){if(!_0x1de5fb){_0x7a4cb4['sendStatus'](0x194);}return _0x1de5fb;};}function handleError(_0x2e5f93,_0x3f1e6e){_0x3f1e6e=_0x3f1e6e||0x1f4;return function(_0x177138){logger['error'](_0x177138[_0x3071('0x29')]);if(_0x177138[_0x3071('0x2a')]){delete _0x177138[_0x3071('0x2a')];}_0x2e5f93[_0x3071('0x1b')](_0x3f1e6e)[_0x3071('0x2b')](_0x177138);};}exports[_0x3071('0x2c')]=function(_0x177b5f,_0x3921a1){var _0x32f1b4={'raw':!![],'where':{'id':_0x177b5f[_0x3071('0x2d')]['id']}},_0x292205={};_0x292205['model']=_['keys'](db[_0x3071('0x2e')][_0x3071('0x2f')]);_0x292205[_0x3071('0x30')]=_[_0x3071('0x31')](_0x177b5f[_0x3071('0x30')]);_0x292205[_0x3071('0x32')]=_[_0x3071('0x33')](_0x292205[_0x3071('0x34')],_0x292205['query']);_0x32f1b4['attributes']=_['intersection'](_0x292205[_0x3071('0x34')],qs[_0x3071('0x35')](_0x177b5f['query'][_0x3071('0x35')]));_0x32f1b4[_0x3071('0x36')]=_0x32f1b4[_0x3071('0x36')][_0x3071('0x37')]?_0x32f1b4['attributes']:_0x292205[_0x3071('0x34')];if(_0x177b5f[_0x3071('0x30')][_0x3071('0x38')]){_0x32f1b4[_0x3071('0x39')]=[{'all':!![]}];}_0x32f1b4=_[_0x3071('0x3a')]({},_0x32f1b4,_0x177b5f[_0x3071('0x3b')]);return db[_0x3071('0x2e')][_0x3071('0x3c')](_0x32f1b4)['then'](handleEntityNotFound(_0x3921a1,null))[_0x3071('0x27')](respondWithResult(_0x3921a1,null))['catch'](handleError(_0x3921a1,null));};exports['update']=function(_0x1a1a64,_0xa3a7ae){if(_0x1a1a64['body']['id']){delete _0x1a1a64[_0x3071('0x3d')]['id'];}return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x1a1a64[_0x3071('0x2d')]['id']}})[_0x3071('0x27')](handleEntityNotFound(_0xa3a7ae,null))[_0x3071('0x27')](saveUpdates(_0x1a1a64['body'],null))[_0x3071('0x27')](respondWithResult(_0xa3a7ae,null))[_0x3071('0x3e')](handleError(_0xa3a7ae,null));};exports['destroy']=function(_0x44ad05,_0x5b1392){return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x44ad05['params']['id']}})['then'](handleEntityNotFound(_0x5b1392,null))[_0x3071('0x27')](removeEntity(_0x5b1392,null))[_0x3071('0x3e')](handleError(_0x5b1392,null));}; \ No newline at end of file +var _0xaa88=['limit','count','set','apply','reject','then','stack','name','send','params','model','keys','MailApplication','query','filters','intersection','attributes','fields','length','include','merge','options','find','update','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','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','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaa88,0x137));var _0x8aa8=function(_0x5d7227,_0x12aebe){_0x5d7227=_0x5d7227-0x0;var _0x15ac55=_0xaa88[_0x5d7227];return _0x15ac55;};'use strict';var emlformat=require(_0x8aa8('0x0'));var rimraf=require(_0x8aa8('0x1'));var zipdir=require(_0x8aa8('0x2'));var jsonpatch=require(_0x8aa8('0x3'));var rp=require('request-promise');var moment=require(_0x8aa8('0x4'));var BPromise=require(_0x8aa8('0x5'));var Mustache=require(_0x8aa8('0x6'));var util=require(_0x8aa8('0x7'));var path=require(_0x8aa8('0x8'));var sox=require(_0x8aa8('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8aa8('0xa'));var _=require('lodash');var squel=require(_0x8aa8('0xb'));var crypto=require(_0x8aa8('0xc'));var jsforce=require(_0x8aa8('0xd'));var deskjs=require(_0x8aa8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8aa8('0xf'));var Papa=require(_0x8aa8('0x10'));var Redis=require(_0x8aa8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8aa8('0x12'));var as=require(_0x8aa8('0x13'));var hardwareService=require(_0x8aa8('0x14'));var logger=require(_0x8aa8('0x15'))('api');var utils=require(_0x8aa8('0x16'));var config=require(_0x8aa8('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8aa8('0x18'))['db'];function respondWithStatusCode(_0xa691d6,_0x28132f){_0x28132f=_0x28132f||0xcc;return function(_0x535aa0){if(_0x535aa0){return _0xa691d6[_0x8aa8('0x19')](_0x28132f);}return _0xa691d6[_0x8aa8('0x1a')](_0x28132f)[_0x8aa8('0x1b')]();};}function respondWithResult(_0x4b686e,_0x391642){_0x391642=_0x391642||0xc8;return function(_0x4af534){if(_0x4af534){return _0x4b686e['status'](_0x391642)[_0x8aa8('0x1c')](_0x4af534);}};}function respondWithFilteredResult(_0x200662,_0xae81a0){return function(_0xa6c2af){if(_0xa6c2af){var _0x42a6a4=typeof _0xae81a0[_0x8aa8('0x1d')]===_0x8aa8('0x1e')&&typeof _0xae81a0[_0x8aa8('0x1f')]===_0x8aa8('0x1e');var _0x4e8ce3=_0xa6c2af['count'];var _0x2c1b9a=_0x42a6a4?0x0:_0xae81a0['offset'];var _0x557adc=_0x42a6a4?_0xa6c2af[_0x8aa8('0x20')]:_0xae81a0['offset']+_0xae81a0[_0x8aa8('0x1f')];var _0x41092b;if(_0x557adc>=_0x4e8ce3){_0x557adc=_0x4e8ce3;_0x41092b=0xc8;}else{_0x41092b=0xce;}_0x200662[_0x8aa8('0x1a')](_0x41092b);return _0x200662[_0x8aa8('0x21')]('Content-Range',_0x2c1b9a+'-'+_0x557adc+'/'+_0x4e8ce3)[_0x8aa8('0x1c')](_0xa6c2af);}return null;};}function patchUpdates(_0x36c445){return function(_0x2825fd){try{jsonpatch[_0x8aa8('0x22')](_0x2825fd,_0x36c445,!![]);}catch(_0x4c754e){return BPromise[_0x8aa8('0x23')](_0x4c754e);}return _0x2825fd['save']();};}function saveUpdates(_0x26cf63,_0x4cc455){return function(_0x1fdadd){if(_0x1fdadd){return _0x1fdadd['update'](_0x26cf63)[_0x8aa8('0x24')](function(_0x557e4e){return _0x557e4e;});}return null;};}function removeEntity(_0x65945b,_0x40adb5){return function(_0x3ca7dc){if(_0x3ca7dc){return _0x3ca7dc['destroy']()[_0x8aa8('0x24')](function(){_0x65945b[_0x8aa8('0x1a')](0xcc)[_0x8aa8('0x1b')]();});}};}function handleEntityNotFound(_0x547a7b,_0x57acd2){return function(_0x2d1508){if(!_0x2d1508){_0x547a7b[_0x8aa8('0x19')](0x194);}return _0x2d1508;};}function handleError(_0x2f91f3,_0x3a3c7a){_0x3a3c7a=_0x3a3c7a||0x1f4;return function(_0x24143e){logger['error'](_0x24143e[_0x8aa8('0x25')]);if(_0x24143e['name']){delete _0x24143e[_0x8aa8('0x26')];}_0x2f91f3[_0x8aa8('0x1a')](_0x3a3c7a)[_0x8aa8('0x27')](_0x24143e);};}exports['show']=function(_0x4c5c5c,_0x10810d){var _0x5e96c9={'raw':!![],'where':{'id':_0x4c5c5c[_0x8aa8('0x28')]['id']}},_0x385208={};_0x385208[_0x8aa8('0x29')]=_[_0x8aa8('0x2a')](db[_0x8aa8('0x2b')]['rawAttributes']);_0x385208[_0x8aa8('0x2c')]=_[_0x8aa8('0x2a')](_0x4c5c5c['query']);_0x385208[_0x8aa8('0x2d')]=_[_0x8aa8('0x2e')](_0x385208[_0x8aa8('0x29')],_0x385208['query']);_0x5e96c9[_0x8aa8('0x2f')]=_[_0x8aa8('0x2e')](_0x385208[_0x8aa8('0x29')],qs[_0x8aa8('0x30')](_0x4c5c5c[_0x8aa8('0x2c')][_0x8aa8('0x30')]));_0x5e96c9[_0x8aa8('0x2f')]=_0x5e96c9[_0x8aa8('0x2f')][_0x8aa8('0x31')]?_0x5e96c9[_0x8aa8('0x2f')]:_0x385208[_0x8aa8('0x29')];if(_0x4c5c5c['query']['includeAll']){_0x5e96c9[_0x8aa8('0x32')]=[{'all':!![]}];}_0x5e96c9=_[_0x8aa8('0x33')]({},_0x5e96c9,_0x4c5c5c[_0x8aa8('0x34')]);return db[_0x8aa8('0x2b')][_0x8aa8('0x35')](_0x5e96c9)[_0x8aa8('0x24')](handleEntityNotFound(_0x10810d,null))['then'](respondWithResult(_0x10810d,null))['catch'](handleError(_0x10810d,null));};exports[_0x8aa8('0x36')]=function(_0x5755b5,_0x24997c){if(_0x5755b5[_0x8aa8('0x37')]['id']){delete _0x5755b5[_0x8aa8('0x37')]['id'];}return db['MailApplication'][_0x8aa8('0x35')]({'where':{'id':_0x5755b5[_0x8aa8('0x28')]['id']}})[_0x8aa8('0x24')](handleEntityNotFound(_0x24997c,null))['then'](saveUpdates(_0x5755b5['body'],null))[_0x8aa8('0x24')](respondWithResult(_0x24997c,null))[_0x8aa8('0x38')](handleError(_0x24997c,null));};exports['destroy']=function(_0x24eb18,_0x2e1f52){return db['MailApplication'][_0x8aa8('0x35')]({'where':{'id':_0x24eb18['params']['id']}})['then'](handleEntityNotFound(_0x2e1f52,null))[_0x8aa8('0x24')](removeEntity(_0x2e1f52,null))['catch'](handleError(_0x2e1f52,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index ea9073e..ce109dc 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 _0xcaf9=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','define','utf8mb4_unicode_ci','lodash'];(function(_0x5192de,_0x4e91cd){var _0x4e287e=function(_0x3639bc){while(--_0x3639bc){_0x5192de['push'](_0x5192de['shift']());}};_0x4e287e(++_0x4e91cd);}(_0xcaf9,0x1d8));var _0x9caf=function(_0x280add,_0x5d5706){_0x280add=_0x280add-0x0;var _0x7d6321=_0xcaf9[_0x280add];return _0x7d6321;};'use strict';var _=require(_0x9caf('0x0'));var util=require(_0x9caf('0x1'));var logger=require(_0x9caf('0x2'))(_0x9caf('0x3'));var moment=require(_0x9caf('0x4'));var BPromise=require(_0x9caf('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9caf('0x6'));var config=require(_0x9caf('0x7'));var attributes=require('./mailApplication.attributes');module[_0x9caf('0x8')]=function(_0x515788,_0x3bf692){return _0x515788[_0x9caf('0x9')]('MailApplication',attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x9caf('0xa')});}; \ No newline at end of file +var _0x9cfd=['lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./mailApplication.attributes','exports','define','mail_applications','utf8mb4_unicode_ci'];(function(_0x467de4,_0x4d14ca){var _0x10ddcb=function(_0x550483){while(--_0x550483){_0x467de4['push'](_0x467de4['shift']());}};_0x10ddcb(++_0x4d14ca);}(_0x9cfd,0x9c));var _0xd9cf=function(_0x1ded9b,_0x2940f0){_0x1ded9b=_0x1ded9b-0x0;var _0x299ba7=_0x9cfd[_0x1ded9b];return _0x299ba7;};'use strict';var _=require(_0xd9cf('0x0'));var util=require('util');var logger=require(_0xd9cf('0x1'))(_0xd9cf('0x2'));var moment=require(_0xd9cf('0x3'));var BPromise=require(_0xd9cf('0x4'));var rp=require(_0xd9cf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd9cf('0x6'));var attributes=require(_0xd9cf('0x7'));module[_0xd9cf('0x8')]=function(_0x3a67fb,_0x434fdf){return _0x3a67fb[_0xd9cf('0x9')]('MailApplication',attributes,{'tableName':_0xd9cf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd9cf('0xb')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 4007585..5b4fadd 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 _0xdfc5=['request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateMailApplication','MailApplication','update','body','options','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','then','info','MailApplication,\x20%s,\x20%s'];(function(_0x277107,_0x3420dc){var _0x1da046=function(_0x47122d){while(--_0x47122d){_0x277107['push'](_0x277107['shift']());}};_0x1da046(++_0x3420dc);}(_0xdfc5,0x14f));var _0x5dfc=function(_0x1ffb61,_0x6fe751){_0x1ffb61=_0x1ffb61-0x0;var _0x107914=_0xdfc5[_0x1ffb61];return _0x107914;};'use strict';var _=require(_0x5dfc('0x0'));var util=require(_0x5dfc('0x1'));var moment=require(_0x5dfc('0x2'));var BPromise=require(_0x5dfc('0x3'));var rs=require(_0x5dfc('0x4'));var fs=require('fs');var Redis=require(_0x5dfc('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5dfc('0x6'));var config=require(_0x5dfc('0x7'));var jayson=require(_0x5dfc('0x8'));var client=jayson['client'][_0x5dfc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b8412,_0x13ed05,_0x53769d){return new BPromise(function(_0x5cbb10,_0x24e829){return client['request'](_0x5b8412,_0x53769d)[_0x5dfc('0xa')](function(_0x575877){logger[_0x5dfc('0xb')](_0x5dfc('0xc'),_0x13ed05,_0x5dfc('0xd'));logger['debug'](_0x5dfc('0xe'),_0x13ed05,_0x5dfc('0xd'),JSON[_0x5dfc('0xf')](_0x575877));if(_0x575877[_0x5dfc('0x10')]){if(_0x575877[_0x5dfc('0x10')]['code']===0x1f4){logger[_0x5dfc('0x10')](_0x5dfc('0xc'),_0x13ed05,_0x575877[_0x5dfc('0x10')][_0x5dfc('0x11')]);return _0x24e829(_0x575877[_0x5dfc('0x10')]['message']);}logger[_0x5dfc('0x10')](_0x5dfc('0xc'),_0x13ed05,_0x575877[_0x5dfc('0x10')][_0x5dfc('0x11')]);return _0x5cbb10(_0x575877[_0x5dfc('0x10')][_0x5dfc('0x11')]);}else{logger[_0x5dfc('0xb')]('MailApplication,\x20%s,\x20%s',_0x13ed05,_0x5dfc('0xd'));_0x5cbb10(_0x575877[_0x5dfc('0x12')][_0x5dfc('0x11')]);}})[_0x5dfc('0x13')](function(_0x1dac4f){logger['error']('MailApplication,\x20%s,\x20%s',_0x13ed05,_0x1dac4f);_0x24e829(_0x1dac4f);});});}exports[_0x5dfc('0x14')]=function(_0x5544b3){var _0x5e72a3=this;return new Promise(function(_0x35306b,_0x3b9668){return db[_0x5dfc('0x15')][_0x5dfc('0x16')](_0x5544b3[_0x5dfc('0x17')],{'raw':_0x5544b3[_0x5dfc('0x18')]?_0x5544b3[_0x5dfc('0x18')][_0x5dfc('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5544b3['options']?_0x5544b3[_0x5dfc('0x18')][_0x5dfc('0x1a')]||null:null,'attributes':_0x5544b3['options']?_0x5544b3['options'][_0x5dfc('0x1b')]||null:null,'limit':_0x5544b3[_0x5dfc('0x18')]?_0x5544b3['options'][_0x5dfc('0x1c')]||null:null})[_0x5dfc('0xa')](function(_0x106964){logger[_0x5dfc('0xb')](_0x5dfc('0x14'),_0x5544b3);logger['debug']('UpdateMailApplication',_0x5544b3,JSON[_0x5dfc('0xf')](_0x106964));_0x35306b(_0x106964);})[_0x5dfc('0x13')](function(_0x15445d){logger[_0x5dfc('0x10')](_0x5dfc('0x14'),_0x15445d[_0x5dfc('0x11')],_0x5544b3);_0x3b9668(_0x5e72a3['error'](0x1f4,_0x15445d['message']));});});}; \ No newline at end of file +var _0xf948=['error','code','message','catch','UpdateMailApplication','MailApplication','update','body','options','raw','attributes','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','MailApplication,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x58563f,_0x196ea2){var _0xe50dc7=function(_0x36ca5b){while(--_0x36ca5b){_0x58563f['push'](_0x58563f['shift']());}};_0xe50dc7(++_0x196ea2);}(_0xf948,0xc0));var _0x8f94=function(_0x37a63c,_0x33588b){_0x37a63c=_0x37a63c-0x0;var _0x2f737e=_0xf948[_0x37a63c];return _0x2f737e;};'use strict';var _=require(_0x8f94('0x0'));var util=require(_0x8f94('0x1'));var moment=require(_0x8f94('0x2'));var BPromise=require(_0x8f94('0x3'));var rs=require(_0x8f94('0x4'));var fs=require('fs');var Redis=require(_0x8f94('0x5'));var db=require(_0x8f94('0x6'))['db'];var utils=require(_0x8f94('0x7'));var logger=require(_0x8f94('0x8'))(_0x8f94('0x9'));var config=require('../../config/environment');var jayson=require(_0x8f94('0xa'));var client=jayson['client'][_0x8f94('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50bd5f,_0x263002,_0x207d1d){return new BPromise(function(_0x308411,_0x2d2806){return client[_0x8f94('0xc')](_0x50bd5f,_0x207d1d)[_0x8f94('0xd')](function(_0x28a02b){logger['info'](_0x8f94('0xe'),_0x263002,'request\x20sent');logger[_0x8f94('0xf')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x263002,_0x8f94('0x10'),JSON[_0x8f94('0x11')](_0x28a02b));if(_0x28a02b[_0x8f94('0x12')]){if(_0x28a02b['error'][_0x8f94('0x13')]===0x1f4){logger[_0x8f94('0x12')](_0x8f94('0xe'),_0x263002,_0x28a02b[_0x8f94('0x12')][_0x8f94('0x14')]);return _0x2d2806(_0x28a02b[_0x8f94('0x12')][_0x8f94('0x14')]);}logger[_0x8f94('0x12')]('MailApplication,\x20%s,\x20%s',_0x263002,_0x28a02b[_0x8f94('0x12')][_0x8f94('0x14')]);return _0x308411(_0x28a02b[_0x8f94('0x12')][_0x8f94('0x14')]);}else{logger['info']('MailApplication,\x20%s,\x20%s',_0x263002,_0x8f94('0x10'));_0x308411(_0x28a02b['result'][_0x8f94('0x14')]);}})[_0x8f94('0x15')](function(_0x7b22d5){logger[_0x8f94('0x12')]('MailApplication,\x20%s,\x20%s',_0x263002,_0x7b22d5);_0x2d2806(_0x7b22d5);});});}exports[_0x8f94('0x16')]=function(_0x3a9481){var _0x4bc30c=this;return new Promise(function(_0x56fc42,_0x2de33a){return db[_0x8f94('0x17')][_0x8f94('0x18')](_0x3a9481[_0x8f94('0x19')],{'raw':_0x3a9481[_0x8f94('0x1a')]?_0x3a9481[_0x8f94('0x1a')][_0x8f94('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a9481['options']?_0x3a9481[_0x8f94('0x1a')]['where']||null:null,'attributes':_0x3a9481['options']?_0x3a9481[_0x8f94('0x1a')][_0x8f94('0x1c')]||null:null,'limit':_0x3a9481[_0x8f94('0x1a')]?_0x3a9481[_0x8f94('0x1a')]['limit']||null:null})['then'](function(_0x5b4acc){logger[_0x8f94('0x1d')](_0x8f94('0x16'),_0x3a9481);logger[_0x8f94('0xf')](_0x8f94('0x16'),_0x3a9481,JSON['stringify'](_0x5b4acc));_0x56fc42(_0x5b4acc);})['catch'](function(_0x4160c0){logger[_0x8f94('0x12')](_0x8f94('0x16'),_0x4160c0['message'],_0x3a9481);_0x2de33a(_0x4bc30c[_0x8f94('0x12')](0x1f4,_0x4160c0[_0x8f94('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index fbd500e..af82321 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 _0xdbca=['/:id/download','create','post','/:id/messages','/:id/tags','mail','mailinteraction:addtags','addTags','put','/:id','tracked','update','delete','mailinteraction:destroy','exports','express','Router','../../components/auth/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','show','getMessages'];(function(_0x35c169,_0x27fc3b){var _0x4fdc99=function(_0x1a15b5){while(--_0x1a15b5){_0x35c169['push'](_0x35c169['shift']());}};_0x4fdc99(++_0x27fc3b);}(_0xdbca,0x1c9));var _0xadbc=function(_0xf1402a,_0x187f5c){_0xf1402a=_0xf1402a-0x0;var _0x4f7ead=_0xdbca[_0xf1402a];return _0x4f7ead;};'use strict';var express=require(_0xadbc('0x0'));var router=express[_0xadbc('0x1')]();var auth=require(_0xadbc('0x2'));var interaction=require('../../components/interaction/service');var controller=require(_0xadbc('0x3'));router[_0xadbc('0x4')]('/',auth[_0xadbc('0x5')](),controller[_0xadbc('0x6')]);router['get'](_0xadbc('0x7'),auth[_0xadbc('0x5')](),controller[_0xadbc('0x8')]);router[_0xadbc('0x4')]('/:id',auth[_0xadbc('0x5')](),controller[_0xadbc('0x9')]);router[_0xadbc('0x4')]('/:id/messages',auth[_0xadbc('0x5')](),controller[_0xadbc('0xa')]);router['get'](_0xadbc('0xb'),auth[_0xadbc('0x5')](),controller['download']);router['post']('/',auth[_0xadbc('0x5')](),controller[_0xadbc('0xc')]);router[_0xadbc('0xd')](_0xadbc('0xe'),auth['isAuthenticated'](),controller['addMessage']);router[_0xadbc('0xd')](_0xadbc('0xf'),auth[_0xadbc('0x5')](),interaction['tracked'](_0xadbc('0x10'),_0xadbc('0x11')),controller[_0xadbc('0x12')]);router[_0xadbc('0x13')](_0xadbc('0x14'),auth['isAuthenticated'](),interaction[_0xadbc('0x15')](_0xadbc('0x10'),'mailinteraction:update'),controller[_0xadbc('0x16')]);router[_0xadbc('0x17')]('/:id',auth[_0xadbc('0x5')](),interaction[_0xadbc('0x15')](_0xadbc('0x10'),_0xadbc('0x18')),controller['destroy']);router[_0xadbc('0x17')]('/:id/tags',auth[_0xadbc('0x5')](),controller['removeTags']);module[_0xadbc('0x19')]=router; \ No newline at end of file +var _0xf9b6=['download','post','create','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','put','/:id','mailinteraction:update','update','delete','mailinteraction:destroy','removeTags','exports','Router','../../components/auth/service','./mailInteraction.controller','isAuthenticated','index','get','/describe','show','/:id/messages','getMessages'];(function(_0x1fabb8,_0xeb471f){var _0x495e1f=function(_0x150209){while(--_0x150209){_0x1fabb8['push'](_0x1fabb8['shift']());}};_0x495e1f(++_0xeb471f);}(_0xf9b6,0x114));var _0x6f9b=function(_0x5e0bfe,_0x747312){_0x5e0bfe=_0x5e0bfe-0x0;var _0x6468b8=_0xf9b6[_0x5e0bfe];return _0x6468b8;};'use strict';var express=require('express');var router=express[_0x6f9b('0x0')]();var auth=require(_0x6f9b('0x1'));var interaction=require('../../components/interaction/service');var controller=require(_0x6f9b('0x2'));router['get']('/',auth[_0x6f9b('0x3')](),controller[_0x6f9b('0x4')]);router[_0x6f9b('0x5')](_0x6f9b('0x6'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x6f9b('0x7')]);router['get'](_0x6f9b('0x8'),auth[_0x6f9b('0x3')](),controller[_0x6f9b('0x9')]);router[_0x6f9b('0x5')]('/:id/download',auth['isAuthenticated'](),controller[_0x6f9b('0xa')]);router[_0x6f9b('0xb')]('/',auth[_0x6f9b('0x3')](),controller[_0x6f9b('0xc')]);router['post'](_0x6f9b('0x8'),auth[_0x6f9b('0x3')](),controller[_0x6f9b('0xd')]);router['post'](_0x6f9b('0xe'),auth[_0x6f9b('0x3')](),interaction[_0x6f9b('0xf')](_0x6f9b('0x10'),_0x6f9b('0x11')),controller['addTags']);router[_0x6f9b('0x12')](_0x6f9b('0x13'),auth[_0x6f9b('0x3')](),interaction[_0x6f9b('0xf')]('mail',_0x6f9b('0x14')),controller[_0x6f9b('0x15')]);router[_0x6f9b('0x16')](_0x6f9b('0x13'),auth[_0x6f9b('0x3')](),interaction[_0x6f9b('0xf')](_0x6f9b('0x10'),_0x6f9b('0x17')),controller['destroy']);router[_0x6f9b('0x16')]('/:id/tags',auth[_0x6f9b('0x3')](),controller[_0x6f9b('0x18')]);module[_0x6f9b('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index dd7f646..1a7ef74 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 _0x5294=['STRING','TEXT','ENUM','out','iconv','exports','BOOLEAN','DATE'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5294,0x1e4));var _0x4529=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x5294[_0xbb091];return _0x467a04;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x4529('0x0'));module[_0x4529('0x1')]={'closed':{'type':Sequelize[_0x4529('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4529('0x3')]},'disposition':{'type':Sequelize[_0x4529('0x4')]},'secondDisposition':{'type':Sequelize[_0x4529('0x4')]},'thirdDisposition':{'type':Sequelize[_0x4529('0x4')]},'note':{'type':Sequelize[_0x4529('0x4')]},'inReplyTo':{'type':Sequelize[_0x4529('0x4')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x4529('0x5')]('long')},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x4529('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x4529('0x3')]},'substatus':{'type':Sequelize[_0x4529('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x4529('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x4529('0x6')]('in',_0x4529('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4529('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x4529('0x6')]('in',_0x4529('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xcae2=['ENUM','out','sequelize','iconv','BOOLEAN','DATE','STRING','TEXT','long'];(function(_0x195577,_0x5de53a){var _0x13c367=function(_0x583022){while(--_0x583022){_0x195577['push'](_0x195577['shift']());}};_0x13c367(++_0x5de53a);}(_0xcae2,0x107));var _0x2cae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcae2[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2cae('0x0'));var iconv=require(_0x2cae('0x1'));module['exports']={'closed':{'type':Sequelize[_0x2cae('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2cae('0x3')]},'disposition':{'type':Sequelize[_0x2cae('0x4')]},'secondDisposition':{'type':Sequelize[_0x2cae('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x2cae('0x4')]},'inReplyTo':{'type':Sequelize[_0x2cae('0x4')](0x1fe)},'to':{'type':Sequelize[_0x2cae('0x4')]},'cc':{'type':Sequelize[_0x2cae('0x5')](_0x2cae('0x6'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x2cae('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x2cae('0x3')]},'substatus':{'type':Sequelize[_0x2cae('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x2cae('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2cae('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x2cae('0x7')]('in',_0x2cae('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x2cae('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 c17d018..660262f 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 _0xc6e9=['set','Content-Range','destroy','then','stack','name','send','index','map','MailInteraction','fieldName','type','key','getOptions','findAll','user','catch','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','update','body','describe','addMessage','MailMessage','ids','omit','getMessages','hasOwnProperty','order','sort','where','MailInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','spread','Tag','color','emit','removeTags','download','toString','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','push','Attachment','Attachments','from','bcc','Messages','get','mkdirSync','each','missing.recipient@your.company.com','decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','readFileSync','writeFileSync','unlinkSync','sendStatus','rimraf','moment','bluebird','util','path','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','register','status','end','json','undefined','limit','count','offset'];(function(_0x563666,_0x50acc2){var _0x3ac868=function(_0xe62ce9){while(--_0xe62ce9){_0x563666['push'](_0x563666['shift']());}};_0x3ac868(++_0x50acc2);}(_0xc6e9,0x1ad));var _0x9c6e=function(_0x297a87,_0xb30c77){_0x297a87=_0x297a87-0x0;var _0x172716=_0xc6e9[_0x297a87];return _0x172716;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9c6e('0x0'));var zipdir=require('zip-dir');var moment=require(_0x9c6e('0x1'));var BPromise=require(_0x9c6e('0x2'));var util=require(_0x9c6e('0x3'));var path=require(_0x9c6e('0x4'));var fs=require('fs');var _=require(_0x9c6e('0x5'));var juice=require(_0x9c6e('0x6'));var Redis=require(_0x9c6e('0x7'));var interaction=require(_0x9c6e('0x8'));var qs=require(_0x9c6e('0x9'));var logger=require(_0x9c6e('0xa'))(_0x9c6e('0xb'));var config=require(_0x9c6e('0xc'));var db=require(_0x9c6e('0xd'))['db'];var htmlEntities=require(_0x9c6e('0xe'));config[_0x9c6e('0xf')]=_[_0x9c6e('0x10')](config['redis'],{'host':_0x9c6e('0x11'),'port':0x18eb});var socket=require(_0x9c6e('0x12'))(new Redis(config[_0x9c6e('0xf')]));require('./mailInteraction.socket')[_0x9c6e('0x13')](socket);function respondWithStatusCode(_0xed7f7e,_0x33fdeb){_0x33fdeb=_0x33fdeb||0xcc;return function(_0x50715c){if(_0x50715c){return _0xed7f7e['sendStatus'](_0x33fdeb);}return _0xed7f7e[_0x9c6e('0x14')](_0x33fdeb)[_0x9c6e('0x15')]();};}function respondWithResult(_0x2a4e88,_0x4f630a){_0x4f630a=_0x4f630a||0xc8;return function(_0x3a1a7a){if(_0x3a1a7a){return _0x2a4e88[_0x9c6e('0x14')](_0x4f630a)[_0x9c6e('0x16')](_0x3a1a7a);}};}function respondWithFilteredResult(_0x2302e7,_0x117235){return function(_0x4a2b05){if(_0x4a2b05){var _0x164763=typeof _0x117235['offset']===_0x9c6e('0x17')&&typeof _0x117235[_0x9c6e('0x18')]===_0x9c6e('0x17');var _0x4c19b3=_0x4a2b05[_0x9c6e('0x19')];var _0x367179=_0x164763?0x0:_0x117235[_0x9c6e('0x1a')];var _0x5885c4=_0x164763?_0x4a2b05[_0x9c6e('0x19')]:_0x117235[_0x9c6e('0x1a')]+_0x117235['limit'];var _0x812389;if(_0x5885c4>=_0x4c19b3){_0x5885c4=_0x4c19b3;_0x812389=0xc8;}else{_0x812389=0xce;}_0x2302e7[_0x9c6e('0x14')](_0x812389);return _0x2302e7[_0x9c6e('0x1b')](_0x9c6e('0x1c'),_0x367179+'-'+_0x5885c4+'/'+_0x4c19b3)[_0x9c6e('0x16')](_0x4a2b05);}return null;};}function saveUpdates(_0x49b788){return function(_0x45bc79){if(_0x45bc79){return _0x45bc79['update'](_0x49b788)['then'](function(_0x52ca75){return _0x52ca75;});}return null;};}function removeEntity(_0x556829){return function(_0x4979fd){if(_0x4979fd){return _0x4979fd[_0x9c6e('0x1d')]()[_0x9c6e('0x1e')](function(){_0x556829[_0x9c6e('0x14')](0xcc)[_0x9c6e('0x15')]();});}};}function handleEntityNotFound(_0x55a15c){return function(_0x35d176){if(!_0x35d176){_0x55a15c['sendStatus'](0x194);}return _0x35d176;};}function handleError(_0x243d0d,_0x61301d){_0x61301d=_0x61301d||0x1f4;return function(_0x2b1ce6){logger['error'](_0x2b1ce6[_0x9c6e('0x1f')]);if(_0x2b1ce6['name']){delete _0x2b1ce6[_0x9c6e('0x20')];}_0x243d0d[_0x9c6e('0x14')](_0x61301d)[_0x9c6e('0x21')](_0x2b1ce6);};}exports[_0x9c6e('0x22')]=function(_0x271766,_0x536b02){var _0x2ada85={};var _0x2163e8=_[_0x9c6e('0x23')](db[_0x9c6e('0x24')]['rawAttributes'],function(_0x405ad9){return{'name':_0x405ad9[_0x9c6e('0x25')],'type':_0x405ad9[_0x9c6e('0x26')][_0x9c6e('0x27')]};});_0x2ada85=qs[_0x9c6e('0x28')](_0x2163e8,_0x271766);return interaction[_0x9c6e('0x29')]('mail',_0x271766['query'],_0x271766[_0x9c6e('0x2a')],_0x2ada85,_0x2163e8)[_0x9c6e('0x1e')](respondWithFilteredResult(_0x536b02,_0x2ada85))[_0x9c6e('0x2b')](handleError(_0x536b02,null));};exports['show']=function(_0xe214cb,_0x151e57){var _0x2cf04a={'raw':![],'where':{'id':_0xe214cb[_0x9c6e('0x2c')]['id']}},_0x566366={};_0x566366[_0x9c6e('0x2d')]=_[_0x9c6e('0x2e')](db[_0x9c6e('0x24')][_0x9c6e('0x2f')]);_0x566366['query']=_[_0x9c6e('0x2e')](_0xe214cb[_0x9c6e('0x30')]);_0x566366[_0x9c6e('0x31')]=_[_0x9c6e('0x32')](_0x566366['model'],_0x566366[_0x9c6e('0x30')]);_0x2cf04a[_0x9c6e('0x33')]=_['intersection'](_0x566366[_0x9c6e('0x2d')],qs['fields'](_0xe214cb[_0x9c6e('0x30')][_0x9c6e('0x34')]));_0x2cf04a['attributes']=_0x2cf04a[_0x9c6e('0x33')][_0x9c6e('0x35')]?_0x2cf04a[_0x9c6e('0x33')]:_0x566366[_0x9c6e('0x2d')];if(_0xe214cb[_0x9c6e('0x30')][_0x9c6e('0x36')]){_0x2cf04a[_0x9c6e('0x37')]=[{'all':!![]}];}_0x2cf04a=_[_0x9c6e('0x38')]({},_0x2cf04a,_0xe214cb[_0x9c6e('0x39')]);return db[_0x9c6e('0x24')][_0x9c6e('0x3a')](_0x2cf04a)['then'](handleEntityNotFound(_0x151e57,null))[_0x9c6e('0x1e')](respondWithResult(_0x151e57,null))[_0x9c6e('0x2b')](handleError(_0x151e57,null));};exports[_0x9c6e('0x3b')]=function(_0x5be598,_0x3fc609){return db[_0x9c6e('0x24')][_0x9c6e('0x3b')](_0x5be598['body'],{})[_0x9c6e('0x1e')](respondWithResult(_0x3fc609,0xc9))[_0x9c6e('0x2b')](handleError(_0x3fc609,null));};exports[_0x9c6e('0x3c')]=function(_0xb54044,_0x1b1a91){if(_0xb54044[_0x9c6e('0x3d')]['id']){delete _0xb54044[_0x9c6e('0x3d')]['id'];}return db['MailInteraction'][_0x9c6e('0x3a')]({'where':{'id':_0xb54044['params']['id']}})[_0x9c6e('0x1e')](handleEntityNotFound(_0x1b1a91,null))[_0x9c6e('0x1e')](saveUpdates(_0xb54044[_0x9c6e('0x3d')],null))[_0x9c6e('0x1e')](respondWithResult(_0x1b1a91,null))['catch'](handleError(_0x1b1a91,null));};exports['destroy']=function(_0x24a157,_0x4291e5){return db[_0x9c6e('0x24')][_0x9c6e('0x3a')]({'where':{'id':_0x24a157[_0x9c6e('0x2c')]['id']}})['then'](handleEntityNotFound(_0x4291e5,null))[_0x9c6e('0x1e')](removeEntity(_0x4291e5,null))[_0x9c6e('0x2b')](handleError(_0x4291e5,null));};exports[_0x9c6e('0x3e')]=function(_0x35d065,_0x3a71cd){return db['MailInteraction'][_0x9c6e('0x3e')]()['then'](respondWithResult(_0x3a71cd,null))[_0x9c6e('0x2b')](handleError(_0x3a71cd,null));};exports[_0x9c6e('0x3f')]=function(_0x15bc6c,_0x5e2dd7){return db[_0x9c6e('0x40')][_0x9c6e('0x3a')]({'where':{'id':_0x15bc6c[_0x9c6e('0x2c')]['id']}})[_0x9c6e('0x1e')](handleEntityNotFound(_0x5e2dd7,null))[_0x9c6e('0x1e')](function(_0x155d3c){if(_0x155d3c){return _0x155d3c[_0x9c6e('0x3f')](_0x15bc6c[_0x9c6e('0x3d')][_0x9c6e('0x41')],_[_0x9c6e('0x42')](_0x15bc6c['body'],[_0x9c6e('0x41'),'id'])||{});}})[_0x9c6e('0x1e')](respondWithResult(_0x5e2dd7,null))[_0x9c6e('0x2b')](handleError(_0x5e2dd7,null));};exports[_0x9c6e('0x43')]=function(_0x1a5e10,_0x124bbd){var _0x4546a0={'raw':![],'where':{}};var _0x58f636={};var _0x364dc1={'count':0x0,'rows':[]};return db[_0x9c6e('0x24')]['findOne']({'where':{'id':_0x1a5e10[_0x9c6e('0x2c')]['id']}})[_0x9c6e('0x1e')](handleEntityNotFound(_0x124bbd,null))[_0x9c6e('0x1e')](function(_0x542403){if(_0x542403){_0x58f636['model']=_[_0x9c6e('0x2e')](db['MailMessage'][_0x9c6e('0x2f')]);_0x58f636[_0x9c6e('0x30')]=_['keys'](_0x1a5e10['query']);_0x58f636['filters']=_[_0x9c6e('0x32')](_0x58f636[_0x9c6e('0x2d')],_0x58f636[_0x9c6e('0x30')]);_0x4546a0[_0x9c6e('0x33')]=_[_0x9c6e('0x32')](_0x58f636[_0x9c6e('0x2d')],qs['fields'](_0x1a5e10['query'][_0x9c6e('0x34')]));_0x4546a0[_0x9c6e('0x33')]=_0x4546a0['attributes'][_0x9c6e('0x35')]?_0x4546a0[_0x9c6e('0x33')]:_0x58f636['model'];if(!_0x1a5e10[_0x9c6e('0x30')][_0x9c6e('0x44')]('nolimit')){_0x4546a0['limit']=qs[_0x9c6e('0x18')](_0x1a5e10[_0x9c6e('0x30')][_0x9c6e('0x18')]);_0x4546a0[_0x9c6e('0x1a')]=qs[_0x9c6e('0x1a')](_0x1a5e10[_0x9c6e('0x30')][_0x9c6e('0x1a')]);}_0x4546a0[_0x9c6e('0x45')]=qs['sort'](_0x1a5e10[_0x9c6e('0x30')][_0x9c6e('0x46')]);_0x4546a0['where']=qs['filters'](_['pick'](_0x1a5e10['query'],_0x58f636[_0x9c6e('0x31')]));_0x4546a0[_0x9c6e('0x47')][_0x9c6e('0x48')]=_0x542403['id'];if(_0x1a5e10[_0x9c6e('0x30')][_0x9c6e('0x49')]){_0x4546a0[_0x9c6e('0x47')]=_['merge'](_0x4546a0[_0x9c6e('0x47')],{'$or':_['map'](_0x4546a0[_0x9c6e('0x33')],function(_0x40b7e2){var _0xf20732={};_0xf20732[_0x40b7e2]={'$like':'%'+_0x1a5e10[_0x9c6e('0x30')][_0x9c6e('0x49')]+'%'};return _0xf20732;})});}if(_0x1a5e10[_0x9c6e('0x30')][_0x9c6e('0x4a')]){var _0x31838a=_0x1a5e10[_0x9c6e('0x30')][_0x9c6e('0x4a')][_0x9c6e('0x4b')](',');var _0x14e4b4={};_0x14e4b4[_0x31838a[0x0]]={'$gte':moment(_0x31838a[0x1])[_0x9c6e('0x4c')](_0x9c6e('0x4d'))};_0x4546a0[_0x9c6e('0x47')]=_[_0x9c6e('0x38')](_0x4546a0[_0x9c6e('0x47')],_0x14e4b4);}_0x4546a0=_[_0x9c6e('0x38')]({},_0x4546a0,_0x1a5e10['options']);return db[_0x9c6e('0x40')][_0x9c6e('0x19')]({'where':_0x4546a0['where']})[_0x9c6e('0x1e')](function(_0x4cdeed){_0x364dc1[_0x9c6e('0x19')]=_0x4cdeed;if(_0x1a5e10[_0x9c6e('0x30')][_0x9c6e('0x36')]){_0x4546a0[_0x9c6e('0x37')]=[{'all':!![]}];}return db[_0x9c6e('0x40')]['findAll'](_0x4546a0);})[_0x9c6e('0x1e')](function(_0x3a0674){if(_0x1a5e10['query'][_0x9c6e('0x4e')]===_0x9c6e('0x4f')){for(var _0x1bd674=0x0;_0x1bd674<_0x3a0674[_0x9c6e('0x35')];_0x1bd674++){_0x3a0674[_0x1bd674][_0x9c6e('0x3d')]=juice(_0x3a0674[_0x1bd674][_0x9c6e('0x3d')]);}}_0x364dc1['rows']=_0x3a0674;return _0x364dc1;});}})['then'](respondWithFilteredResult(_0x124bbd,_0x4546a0))['catch'](handleError(_0x124bbd,null));};exports['addTags']=function(_0x29df21,_0x1ecd14){return db[_0x9c6e('0x24')][_0x9c6e('0x3a')]({'where':{'id':_0x29df21[_0x9c6e('0x2c')]['id']}})['then'](handleEntityNotFound(_0x1ecd14,null))[_0x9c6e('0x1e')](function(_0x3db90c){if(_0x3db90c){return _0x3db90c['setTags'](_0x29df21[_0x9c6e('0x3d')][_0x9c6e('0x41')],_[_0x9c6e('0x42')](_0x29df21[_0x9c6e('0x3d')],[_0x9c6e('0x41'),'id'])||{})[_0x9c6e('0x50')](function(){return db[_0x9c6e('0x51')][_0x9c6e('0x29')]({'attributes':['id',_0x9c6e('0x20'),_0x9c6e('0x52')],'where':{'id':_0x29df21[_0x9c6e('0x3d')][_0x9c6e('0x41')]}});})['then'](function(_0x4df692){socket[_0x9c6e('0x53')]('mailInteractionTags:save',{'id':Number(_0x29df21[_0x9c6e('0x2c')]['id']),'tags':_0x4df692||[]});return{'id':Number(_0x29df21[_0x9c6e('0x2c')]['id']),'tags':_0x4df692||[]};});}})[_0x9c6e('0x1e')](respondWithResult(_0x1ecd14,null))[_0x9c6e('0x2b')](handleError(_0x1ecd14,null));};exports['removeTags']=function(_0x439664,_0x2df9e9){return db[_0x9c6e('0x24')][_0x9c6e('0x3a')]({'where':{'id':_0x439664['params']['id']}})[_0x9c6e('0x1e')](handleEntityNotFound(_0x2df9e9,null))[_0x9c6e('0x1e')](function(_0x2119d3){if(_0x2119d3){return _0x2119d3[_0x9c6e('0x54')](_0x439664[_0x9c6e('0x30')][_0x9c6e('0x41')]);}})[_0x9c6e('0x1e')](respondWithStatusCode(_0x2df9e9,null))['catch'](handleError(_0x2df9e9,null));};exports[_0x9c6e('0x55')]=function(_0x3a1ecc,_0x6baa01){var _0x351f73=moment()['unix']()[_0x9c6e('0x56')]();var _0x1a6f63=path[_0x9c6e('0x57')](config[_0x9c6e('0x58')],'server',_0x9c6e('0x59'),_0x9c6e('0x5a'));var _0x24567d=path[_0x9c6e('0x57')](config[_0x9c6e('0x58')],_0x9c6e('0x5b'),_0x9c6e('0x59'),_0x9c6e('0x5c'));var _0x210eec=path[_0x9c6e('0x57')](_0x1a6f63,_0x351f73);var _0x143bcb=util['format'](_0x9c6e('0x5d'),_0x3a1ecc[_0x9c6e('0x2c')]['id'],_0x351f73);var _0x2ce224=path[_0x9c6e('0x57')](_0x1a6f63,_0x143bcb);var _0x539971=[];if(_0x3a1ecc[_0x9c6e('0x30')][_0x9c6e('0x5c')]){_0x539971[_0x9c6e('0x5e')]({'model':db[_0x9c6e('0x5f')],'as':_0x9c6e('0x60'),'raw':!![]});}var _0x5b569b=[{'model':db['MailMessage'],'as':'Messages','attributes':['id','body',_0x9c6e('0x61'),'to','cc',_0x9c6e('0x62'),'subject','createdAt'],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x539971}];return db[_0x9c6e('0x24')][_0x9c6e('0x3a')]({'where':{'id':_0x3a1ecc[_0x9c6e('0x2c')]['id']},'include':_0x5b569b})['then'](handleEntityNotFound(_0x6baa01,null))[_0x9c6e('0x1e')](function(_0x313cd2){if(_0x313cd2&&_0x313cd2[_0x9c6e('0x63')]){var _0x5e36f6=_0x313cd2[_0x9c6e('0x64')]({'plain':!![]});fs[_0x9c6e('0x65')](_0x210eec);return BPromise[_0x9c6e('0x66')](_0x5e36f6['Messages'],function(_0x2177a4,_0x5f46c6){var _0x181218={'from':_0x2177a4[_0x9c6e('0x61')],'to':_0x2177a4['to']||_0x9c6e('0x67'),'subject':_0x2177a4['subject'],'html':htmlEntities[_0x9c6e('0x68')](_0x2177a4[_0x9c6e('0x3d')]),'headers':{'Date':moment(_0x2177a4[_0x9c6e('0x69')])['format'](_0x9c6e('0x6a'))},'attachments':[]};if(_0x2177a4['cc']){_0x181218['headers']['Cc']=_0x2177a4['cc'];}if(_0x2177a4[_0x9c6e('0x62')]){_0x181218[_0x9c6e('0x6b')][_0x9c6e('0x6c')]=_0x2177a4[_0x9c6e('0x62')];}return new BPromise(function(_0xf51ac3,_0x1b74fc){if(_0x2177a4[_0x9c6e('0x60')]){for(var _0x1baf7a=0x0;_0x1baf7a<_0x2177a4['Attachments'][_0x9c6e('0x35')];_0x1baf7a++){var _0x2d013c=_0x2177a4['Attachments'][_0x1baf7a];var _0xa5716b=path[_0x9c6e('0x57')](_0x24567d,_0x2d013c[_0x9c6e('0x6d')]);if(fs['existsSync'](_0xa5716b)){_0x181218[_0x9c6e('0x5c')][_0x9c6e('0x5e')]({'name':_0x2d013c['name'],'contentType':_0x2d013c[_0x9c6e('0x26')],'data':fs[_0x9c6e('0x6e')](_0xa5716b)});}}}emlformat['build'](_0x181218,function(_0x32659d,_0x1cf0d8){if(_0x32659d)return _0x1b74fc(_0x32659d);fs[_0x9c6e('0x6f')](path[_0x9c6e('0x57')](_0x210eec,util[_0x9c6e('0x4c')]('message%d.eml',_0x5f46c6)),_0x1cf0d8);return _0xf51ac3(_0x1cf0d8);});});})[_0x9c6e('0x1e')](function(){return new BPromise(function(_0x35f365,_0x2a5445){zipdir(_0x210eec,{'saveTo':_0x2ce224},function(_0x3036d2,_0x3b04a2){if(_0x3036d2)return _0x2a5445(_0x3036d2);return _0x35f365(_0x3b04a2);});})[_0x9c6e('0x1e')](function(){return new BPromise(function(_0x41b775,_0x1f755e){rimraf(_0x210eec,function(_0x35b933){if(_0x35b933)_0x1f755e(_0x35b933);return _0x41b775();});});})[_0x9c6e('0x1e')](function(){return _0x6baa01[_0x9c6e('0x55')](_0x2ce224,_0x143bcb,function(_0x1e693e){if(!_0x1e693e)fs[_0x9c6e('0x70')](_0x2ce224);});});});}else{return _0x6baa01[_0x9c6e('0x71')](0xc8);}})[_0x9c6e('0x2b')](handleError(_0x6baa01,null));}; \ No newline at end of file +var _0xdbd0=['filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','inlineCss','rows','addTags','Tag','emit','removeTags','unix','toString','join','files','root','server','attachments','transcript-%d-%s.zip','Attachment','from','subject','createdAt','Messages','get','each','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','Bcc','bcc','Attachments','existsSync','push','type','readFileSync','format','message%d.eml','unlinkSync','eml-format','zip-dir','bluebird','util','path','lodash','juice','../../components/interaction/service','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./mailInteraction.socket','sendStatus','status','offset','undefined','count','limit','Content-Range','end','error','name','send','map','MailInteraction','rawAttributes','fieldName','key','getOptions','findAll','mail','query','user','then','catch','show','params','model','keys','filters','intersection','fields','attributes','length','includeAll','include','merge','options','find','create','body','destroy','describe','addMessage','MailMessage','ids','omit','getMessages','findOne','hasOwnProperty','sort','where','MailInteractionId'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xdbd0,0xf6));var _0x0dbd=function(_0x9e3352,_0x3b54d7){_0x9e3352=_0x9e3352-0x0;var _0x5ae6f9=_0xdbd0[_0x9e3352];return _0x5ae6f9;};'use strict';var emlformat=require(_0x0dbd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0dbd('0x1'));var moment=require('moment');var BPromise=require(_0x0dbd('0x2'));var util=require(_0x0dbd('0x3'));var path=require(_0x0dbd('0x4'));var fs=require('fs');var _=require(_0x0dbd('0x5'));var juice=require(_0x0dbd('0x6'));var Redis=require('ioredis');var interaction=require(_0x0dbd('0x7'));var qs=require('../../components/parsers/qs');var logger=require(_0x0dbd('0x8'))('api');var config=require(_0x0dbd('0x9'));var db=require(_0x0dbd('0xa'))['db'];var htmlEntities=require('html-entities');config[_0x0dbd('0xb')]=_[_0x0dbd('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0dbd('0xd'))(new Redis(config[_0x0dbd('0xb')]));require(_0x0dbd('0xe'))['register'](socket);function respondWithStatusCode(_0x3bf6f5,_0x29da7e){_0x29da7e=_0x29da7e||0xcc;return function(_0x3dae62){if(_0x3dae62){return _0x3bf6f5[_0x0dbd('0xf')](_0x29da7e);}return _0x3bf6f5['status'](_0x29da7e)['end']();};}function respondWithResult(_0x2bafa0,_0x5bd7da){_0x5bd7da=_0x5bd7da||0xc8;return function(_0x402b38){if(_0x402b38){return _0x2bafa0[_0x0dbd('0x10')](_0x5bd7da)['json'](_0x402b38);}};}function respondWithFilteredResult(_0x17e730,_0x22f24c){return function(_0x45b3a2){if(_0x45b3a2){var _0xc20fad=typeof _0x22f24c[_0x0dbd('0x11')]===_0x0dbd('0x12')&&typeof _0x22f24c['limit']===_0x0dbd('0x12');var _0x21c08f=_0x45b3a2[_0x0dbd('0x13')];var _0x4ec650=_0xc20fad?0x0:_0x22f24c[_0x0dbd('0x11')];var _0x3cd09c=_0xc20fad?_0x45b3a2[_0x0dbd('0x13')]:_0x22f24c[_0x0dbd('0x11')]+_0x22f24c[_0x0dbd('0x14')];var _0x54a7e9;if(_0x3cd09c>=_0x21c08f){_0x3cd09c=_0x21c08f;_0x54a7e9=0xc8;}else{_0x54a7e9=0xce;}_0x17e730[_0x0dbd('0x10')](_0x54a7e9);return _0x17e730['set'](_0x0dbd('0x15'),_0x4ec650+'-'+_0x3cd09c+'/'+_0x21c08f)['json'](_0x45b3a2);}return null;};}function saveUpdates(_0x4e3385){return function(_0xde4ecb){if(_0xde4ecb){return _0xde4ecb['update'](_0x4e3385)['then'](function(_0x1044f3){return _0x1044f3;});}return null;};}function removeEntity(_0x49f0f0){return function(_0x23f27f){if(_0x23f27f){return _0x23f27f['destroy']()['then'](function(){_0x49f0f0[_0x0dbd('0x10')](0xcc)[_0x0dbd('0x16')]();});}};}function handleEntityNotFound(_0x1b0207){return function(_0x3fba3e){if(!_0x3fba3e){_0x1b0207[_0x0dbd('0xf')](0x194);}return _0x3fba3e;};}function handleError(_0x1cee71,_0x51162c){_0x51162c=_0x51162c||0x1f4;return function(_0x41b2f2){logger[_0x0dbd('0x17')](_0x41b2f2['stack']);if(_0x41b2f2[_0x0dbd('0x18')]){delete _0x41b2f2['name'];}_0x1cee71[_0x0dbd('0x10')](_0x51162c)[_0x0dbd('0x19')](_0x41b2f2);};}exports['index']=function(_0x3c30a8,_0x4ec5c4){var _0x2e97c2={};var _0x371b74=_[_0x0dbd('0x1a')](db[_0x0dbd('0x1b')][_0x0dbd('0x1c')],function(_0xee31c8){return{'name':_0xee31c8[_0x0dbd('0x1d')],'type':_0xee31c8['type'][_0x0dbd('0x1e')]};});_0x2e97c2=qs[_0x0dbd('0x1f')](_0x371b74,_0x3c30a8);return interaction[_0x0dbd('0x20')](_0x0dbd('0x21'),_0x3c30a8[_0x0dbd('0x22')],_0x3c30a8[_0x0dbd('0x23')],_0x2e97c2,_0x371b74)[_0x0dbd('0x24')](respondWithFilteredResult(_0x4ec5c4,_0x2e97c2))[_0x0dbd('0x25')](handleError(_0x4ec5c4,null));};exports[_0x0dbd('0x26')]=function(_0x4d7161,_0x95db8){var _0x118678={'raw':![],'where':{'id':_0x4d7161[_0x0dbd('0x27')]['id']}},_0x3611cd={};_0x3611cd[_0x0dbd('0x28')]=_[_0x0dbd('0x29')](db[_0x0dbd('0x1b')]['rawAttributes']);_0x3611cd[_0x0dbd('0x22')]=_[_0x0dbd('0x29')](_0x4d7161[_0x0dbd('0x22')]);_0x3611cd[_0x0dbd('0x2a')]=_[_0x0dbd('0x2b')](_0x3611cd[_0x0dbd('0x28')],_0x3611cd[_0x0dbd('0x22')]);_0x118678['attributes']=_[_0x0dbd('0x2b')](_0x3611cd[_0x0dbd('0x28')],qs[_0x0dbd('0x2c')](_0x4d7161[_0x0dbd('0x22')][_0x0dbd('0x2c')]));_0x118678[_0x0dbd('0x2d')]=_0x118678[_0x0dbd('0x2d')][_0x0dbd('0x2e')]?_0x118678['attributes']:_0x3611cd[_0x0dbd('0x28')];if(_0x4d7161[_0x0dbd('0x22')][_0x0dbd('0x2f')]){_0x118678[_0x0dbd('0x30')]=[{'all':!![]}];}_0x118678=_[_0x0dbd('0x31')]({},_0x118678,_0x4d7161[_0x0dbd('0x32')]);return db[_0x0dbd('0x1b')][_0x0dbd('0x33')](_0x118678)['then'](handleEntityNotFound(_0x95db8,null))[_0x0dbd('0x24')](respondWithResult(_0x95db8,null))[_0x0dbd('0x25')](handleError(_0x95db8,null));};exports[_0x0dbd('0x34')]=function(_0x55a611,_0x2376ef){return db[_0x0dbd('0x1b')][_0x0dbd('0x34')](_0x55a611[_0x0dbd('0x35')],{})['then'](respondWithResult(_0x2376ef,0xc9))[_0x0dbd('0x25')](handleError(_0x2376ef,null));};exports['update']=function(_0xcdb4eb,_0xceb093){if(_0xcdb4eb[_0x0dbd('0x35')]['id']){delete _0xcdb4eb[_0x0dbd('0x35')]['id'];}return db[_0x0dbd('0x1b')][_0x0dbd('0x33')]({'where':{'id':_0xcdb4eb['params']['id']}})[_0x0dbd('0x24')](handleEntityNotFound(_0xceb093,null))['then'](saveUpdates(_0xcdb4eb['body'],null))['then'](respondWithResult(_0xceb093,null))['catch'](handleError(_0xceb093,null));};exports[_0x0dbd('0x36')]=function(_0x559a70,_0x26fdd6){return db[_0x0dbd('0x1b')]['find']({'where':{'id':_0x559a70['params']['id']}})[_0x0dbd('0x24')](handleEntityNotFound(_0x26fdd6,null))[_0x0dbd('0x24')](removeEntity(_0x26fdd6,null))[_0x0dbd('0x25')](handleError(_0x26fdd6,null));};exports['describe']=function(_0x14321f,_0x4e56ad){return db[_0x0dbd('0x1b')][_0x0dbd('0x37')]()[_0x0dbd('0x24')](respondWithResult(_0x4e56ad,null))[_0x0dbd('0x25')](handleError(_0x4e56ad,null));};exports[_0x0dbd('0x38')]=function(_0x4db32b,_0x39d3dc){return db[_0x0dbd('0x39')][_0x0dbd('0x33')]({'where':{'id':_0x4db32b['params']['id']}})[_0x0dbd('0x24')](handleEntityNotFound(_0x39d3dc,null))[_0x0dbd('0x24')](function(_0xe383e8){if(_0xe383e8){return _0xe383e8['addMessage'](_0x4db32b[_0x0dbd('0x35')][_0x0dbd('0x3a')],_[_0x0dbd('0x3b')](_0x4db32b['body'],[_0x0dbd('0x3a'),'id'])||{});}})[_0x0dbd('0x24')](respondWithResult(_0x39d3dc,null))[_0x0dbd('0x25')](handleError(_0x39d3dc,null));};exports[_0x0dbd('0x3c')]=function(_0x1e3af5,_0x248962){var _0x420bb0={'raw':![],'where':{}};var _0xb968c3={};var _0x58e7b2={'count':0x0,'rows':[]};return db[_0x0dbd('0x1b')][_0x0dbd('0x3d')]({'where':{'id':_0x1e3af5[_0x0dbd('0x27')]['id']}})[_0x0dbd('0x24')](handleEntityNotFound(_0x248962,null))[_0x0dbd('0x24')](function(_0x5ba59e){if(_0x5ba59e){_0xb968c3[_0x0dbd('0x28')]=_[_0x0dbd('0x29')](db[_0x0dbd('0x39')][_0x0dbd('0x1c')]);_0xb968c3[_0x0dbd('0x22')]=_[_0x0dbd('0x29')](_0x1e3af5['query']);_0xb968c3[_0x0dbd('0x2a')]=_['intersection'](_0xb968c3[_0x0dbd('0x28')],_0xb968c3[_0x0dbd('0x22')]);_0x420bb0[_0x0dbd('0x2d')]=_['intersection'](_0xb968c3[_0x0dbd('0x28')],qs[_0x0dbd('0x2c')](_0x1e3af5['query'][_0x0dbd('0x2c')]));_0x420bb0['attributes']=_0x420bb0[_0x0dbd('0x2d')][_0x0dbd('0x2e')]?_0x420bb0[_0x0dbd('0x2d')]:_0xb968c3[_0x0dbd('0x28')];if(!_0x1e3af5[_0x0dbd('0x22')][_0x0dbd('0x3e')]('nolimit')){_0x420bb0[_0x0dbd('0x14')]=qs[_0x0dbd('0x14')](_0x1e3af5[_0x0dbd('0x22')][_0x0dbd('0x14')]);_0x420bb0[_0x0dbd('0x11')]=qs[_0x0dbd('0x11')](_0x1e3af5[_0x0dbd('0x22')][_0x0dbd('0x11')]);}_0x420bb0['order']=qs[_0x0dbd('0x3f')](_0x1e3af5[_0x0dbd('0x22')]['sort']);_0x420bb0['where']=qs[_0x0dbd('0x2a')](_['pick'](_0x1e3af5[_0x0dbd('0x22')],_0xb968c3[_0x0dbd('0x2a')]));_0x420bb0[_0x0dbd('0x40')][_0x0dbd('0x41')]=_0x5ba59e['id'];if(_0x1e3af5[_0x0dbd('0x22')]['filter']){_0x420bb0[_0x0dbd('0x40')]=_['merge'](_0x420bb0[_0x0dbd('0x40')],{'$or':_['map'](_0x420bb0[_0x0dbd('0x2d')],function(_0x528cf8){var _0x19ebb0={};_0x19ebb0[_0x528cf8]={'$like':'%'+_0x1e3af5[_0x0dbd('0x22')][_0x0dbd('0x42')]+'%'};return _0x19ebb0;})});}if(_0x1e3af5[_0x0dbd('0x22')][_0x0dbd('0x43')]){var _0x31b402=_0x1e3af5[_0x0dbd('0x22')]['$gte'][_0x0dbd('0x44')](',');var _0x4788f4={};_0x4788f4[_0x31b402[0x0]]={'$gte':moment(_0x31b402[0x1])['format'](_0x0dbd('0x45'))};_0x420bb0[_0x0dbd('0x40')]=_[_0x0dbd('0x31')](_0x420bb0['where'],_0x4788f4);}_0x420bb0=_[_0x0dbd('0x31')]({},_0x420bb0,_0x1e3af5[_0x0dbd('0x32')]);return db[_0x0dbd('0x39')][_0x0dbd('0x13')]({'where':_0x420bb0[_0x0dbd('0x40')]})[_0x0dbd('0x24')](function(_0xb7f0f9){_0x58e7b2[_0x0dbd('0x13')]=_0xb7f0f9;if(_0x1e3af5[_0x0dbd('0x22')][_0x0dbd('0x2f')]){_0x420bb0[_0x0dbd('0x30')]=[{'all':!![]}];}return db[_0x0dbd('0x39')]['findAll'](_0x420bb0);})[_0x0dbd('0x24')](function(_0x5a2e8f){if(_0x1e3af5[_0x0dbd('0x22')][_0x0dbd('0x46')]==='true'){for(var _0xa39b02=0x0;_0xa39b02<_0x5a2e8f['length'];_0xa39b02++){_0x5a2e8f[_0xa39b02][_0x0dbd('0x35')]=juice(_0x5a2e8f[_0xa39b02][_0x0dbd('0x35')]);}}_0x58e7b2[_0x0dbd('0x47')]=_0x5a2e8f;return _0x58e7b2;});}})[_0x0dbd('0x24')](respondWithFilteredResult(_0x248962,_0x420bb0))['catch'](handleError(_0x248962,null));};exports[_0x0dbd('0x48')]=function(_0x2530e7,_0x5157ff){return db[_0x0dbd('0x1b')][_0x0dbd('0x33')]({'where':{'id':_0x2530e7[_0x0dbd('0x27')]['id']}})[_0x0dbd('0x24')](handleEntityNotFound(_0x5157ff,null))[_0x0dbd('0x24')](function(_0x51ab8b){if(_0x51ab8b){return _0x51ab8b['setTags'](_0x2530e7[_0x0dbd('0x35')]['ids'],_[_0x0dbd('0x3b')](_0x2530e7[_0x0dbd('0x35')],[_0x0dbd('0x3a'),'id'])||{})['spread'](function(){return db[_0x0dbd('0x49')][_0x0dbd('0x20')]({'attributes':['id','name','color'],'where':{'id':_0x2530e7['body']['ids']}});})[_0x0dbd('0x24')](function(_0x402df5){socket[_0x0dbd('0x4a')]('mailInteractionTags:save',{'id':Number(_0x2530e7[_0x0dbd('0x27')]['id']),'tags':_0x402df5||[]});return{'id':Number(_0x2530e7['params']['id']),'tags':_0x402df5||[]};});}})['then'](respondWithResult(_0x5157ff,null))[_0x0dbd('0x25')](handleError(_0x5157ff,null));};exports[_0x0dbd('0x4b')]=function(_0x4f7711,_0x5de636){return db[_0x0dbd('0x1b')]['find']({'where':{'id':_0x4f7711[_0x0dbd('0x27')]['id']}})[_0x0dbd('0x24')](handleEntityNotFound(_0x5de636,null))[_0x0dbd('0x24')](function(_0x144d02){if(_0x144d02){return _0x144d02[_0x0dbd('0x4b')](_0x4f7711[_0x0dbd('0x22')][_0x0dbd('0x3a')]);}})[_0x0dbd('0x24')](respondWithStatusCode(_0x5de636,null))[_0x0dbd('0x25')](handleError(_0x5de636,null));};exports['download']=function(_0x49d395,_0x279821){var _0x4213b5=moment()[_0x0dbd('0x4c')]()[_0x0dbd('0x4d')]();var _0x5021de=path[_0x0dbd('0x4e')](config['root'],'server',_0x0dbd('0x4f'),'tmp');var _0x22fa54=path[_0x0dbd('0x4e')](config[_0x0dbd('0x50')],_0x0dbd('0x51'),_0x0dbd('0x4f'),_0x0dbd('0x52'));var _0x4da85e=path[_0x0dbd('0x4e')](_0x5021de,_0x4213b5);var _0x1e4c27=util['format'](_0x0dbd('0x53'),_0x49d395[_0x0dbd('0x27')]['id'],_0x4213b5);var _0x261024=path['join'](_0x5021de,_0x1e4c27);var _0x39d2bd=[];if(_0x49d395['query'][_0x0dbd('0x52')]){_0x39d2bd['push']({'model':db[_0x0dbd('0x54')],'as':'Attachments','raw':!![]});}var _0x2b159b=[{'model':db[_0x0dbd('0x39')],'as':'Messages','attributes':['id','body',_0x0dbd('0x55'),'to','cc','bcc',_0x0dbd('0x56'),_0x0dbd('0x57')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x39d2bd}];return db[_0x0dbd('0x1b')][_0x0dbd('0x33')]({'where':{'id':_0x49d395[_0x0dbd('0x27')]['id']},'include':_0x2b159b})[_0x0dbd('0x24')](handleEntityNotFound(_0x279821,null))[_0x0dbd('0x24')](function(_0x210cdb){if(_0x210cdb&&_0x210cdb[_0x0dbd('0x58')]){var _0x568121=_0x210cdb[_0x0dbd('0x59')]({'plain':!![]});fs['mkdirSync'](_0x4da85e);return BPromise[_0x0dbd('0x5a')](_0x568121[_0x0dbd('0x58')],function(_0x18877d,_0x3f3846){var _0xfd35d3={'from':_0x18877d[_0x0dbd('0x55')],'to':_0x18877d['to']||_0x0dbd('0x5b'),'subject':_0x18877d[_0x0dbd('0x56')],'html':htmlEntities[_0x0dbd('0x5c')](_0x18877d['body']),'headers':{'Date':moment(_0x18877d[_0x0dbd('0x57')])['format'](_0x0dbd('0x5d'))},'attachments':[]};if(_0x18877d['cc']){_0xfd35d3['headers']['Cc']=_0x18877d['cc'];}if(_0x18877d['bcc']){_0xfd35d3['headers'][_0x0dbd('0x5e')]=_0x18877d[_0x0dbd('0x5f')];}return new BPromise(function(_0x57f8f1,_0x99a526){if(_0x18877d['Attachments']){for(var _0x57a206=0x0;_0x57a206<_0x18877d[_0x0dbd('0x60')]['length'];_0x57a206++){var _0x24c66e=_0x18877d[_0x0dbd('0x60')][_0x57a206];var _0x3d0276=path['join'](_0x22fa54,_0x24c66e['basename']);if(fs[_0x0dbd('0x61')](_0x3d0276)){_0xfd35d3[_0x0dbd('0x52')][_0x0dbd('0x62')]({'name':_0x24c66e['name'],'contentType':_0x24c66e[_0x0dbd('0x63')],'data':fs[_0x0dbd('0x64')](_0x3d0276)});}}}emlformat['build'](_0xfd35d3,function(_0x1bf853,_0x366d2b){if(_0x1bf853)return _0x99a526(_0x1bf853);fs['writeFileSync'](path[_0x0dbd('0x4e')](_0x4da85e,util[_0x0dbd('0x65')](_0x0dbd('0x66'),_0x3f3846)),_0x366d2b);return _0x57f8f1(_0x366d2b);});});})[_0x0dbd('0x24')](function(){return new BPromise(function(_0x4fd56c,_0xf2988a){zipdir(_0x4da85e,{'saveTo':_0x261024},function(_0x534b3d,_0x29cd04){if(_0x534b3d)return _0xf2988a(_0x534b3d);return _0x4fd56c(_0x29cd04);});})['then'](function(){return new BPromise(function(_0x14b5b5,_0x638b65){rimraf(_0x4da85e,function(_0x32e01b){if(_0x32e01b)_0x638b65(_0x32e01b);return _0x14b5b5();});});})[_0x0dbd('0x24')](function(){return _0x279821['download'](_0x261024,_0x1e4c27,function(_0x2397a3){if(!_0x2397a3)fs[_0x0dbd('0x67')](_0x261024);});});});}else{return _0x279821[_0x0dbd('0xf')](0xc8);}})[_0x0dbd('0x25')](handleError(_0x279821,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 7f94d87..6ca0283 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 _0xb2e6=['catch','hasOwnProperty','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xb2e6,0x81));var _0x6b2e=function(_0x18f25e,_0x194514){_0x18f25e=_0x18f25e-0x0;var _0x4b085e=_0xb2e6[_0x18f25e];return _0x4b085e;};'use strict';var EventEmitter=require(_0x6b2e('0x0'));var MailInteraction=require(_0x6b2e('0x1'))['db'][_0x6b2e('0x2')];var MailMessage=require(_0x6b2e('0x1'))['db'][_0x6b2e('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x6b2e('0x4')](0x0);var events={'afterCreate':_0x6b2e('0x5'),'afterUpdate':'update','afterDestroy':_0x6b2e('0x6')};function emitEvent(_0x59938e){return function(_0xad6b9c,_0x2560f8,_0x10ca3e){_0xad6b9c[_0x6b2e('0x7')]({'attributes':['id'],'raw':!![]})[_0x6b2e('0x8')](function(_0x53437d){_0xad6b9c[_0x6b2e('0x9')](_0x6b2e('0xa'),_0x53437d[_0x6b2e('0xb')](function(_0x543914){return{'id':_0x543914['id']};}));return MailMessage[_0x6b2e('0xc')]({'where':{'MailInteractionId':_0xad6b9c['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6b2e('0x8')](function(_0x478a05){_0xad6b9c[_0x6b2e('0x9')](_0x6b2e('0xd'),_0x478a05['length']);MailInteractionEvents['emit'](_0x59938e+':'+_0xad6b9c['id'],_0xad6b9c);MailInteractionEvents[_0x6b2e('0xe')](_0x59938e,_0xad6b9c);_0x10ca3e(null);})[_0x6b2e('0xf')](_0x10ca3e(null));};}for(var e in events){if(events[_0x6b2e('0x10')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x6b2e('0x11')]=MailInteractionEvents; \ No newline at end of file +var _0xd9f0=['then','Users','setDataValue','length','catch','hook','exports','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','update','remove'];(function(_0xea8171,_0x49ea98){var _0x5a7ce5=function(_0x55d6d9){while(--_0x55d6d9){_0xea8171['push'](_0xea8171['shift']());}};_0x5a7ce5(++_0x49ea98);}(_0xd9f0,0xe4));var _0x0d9f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd9f0[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x0d9f('0x0'))['db'][_0x0d9f('0x1')];var MailMessage=require(_0x0d9f('0x0'))['db'][_0x0d9f('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x0d9f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0d9f('0x4'),'afterDestroy':_0x0d9f('0x5')};function emitEvent(_0x28dd6a){return function(_0x5286fe,_0x231054,_0x10d8f3){_0x5286fe['getUsers']({'attributes':['id'],'raw':!![]})[_0x0d9f('0x6')](function(_0x27da69){_0x5286fe['setDataValue'](_0x0d9f('0x7'),_0x27da69['map'](function(_0x47a76e){return{'id':_0x47a76e['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x5286fe['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0d9f('0x6')](function(_0x4255fd){_0x5286fe[_0x0d9f('0x8')]('unreadMessages',_0x4255fd[_0x0d9f('0x9')]);MailInteractionEvents['emit'](_0x28dd6a+':'+_0x5286fe['id'],_0x5286fe);MailInteractionEvents['emit'](_0x28dd6a,_0x5286fe);_0x10d8f3(null);})[_0x0d9f('0xa')](_0x10d8f3(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x0d9f('0xb')](e,emitEvent(event));}}module[_0x0d9f('0xc')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 6139151..fac119a 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 _0x21e2=['MailMessage','update','catch','utf8mb4','utf8mb4_unicode_ci','moment','bluebird','request-promise','rimraf','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get'];(function(_0x2a5ce9,_0x41bb78){var _0x23d6b5=function(_0x1ef0c1){while(--_0x1ef0c1){_0x2a5ce9['push'](_0x2a5ce9['shift']());}};_0x23d6b5(++_0x41bb78);}(_0x21e2,0xb4));var _0x221e=function(_0x10fcd7,_0x50c8b1){_0x10fcd7=_0x10fcd7-0x0;var _0x167c8a=_0x21e2[_0x10fcd7];return _0x167c8a;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x221e('0x0'));var BPromise=require(_0x221e('0x1'));var rp=require(_0x221e('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x221e('0x3'));var config=require('../../config/environment');var attributes=require('./mailInteraction.attributes');module[_0x221e('0x4')]=function(_0x2bd4c4,_0x25bdf8){return _0x2bd4c4[_0x221e('0x5')](_0x221e('0x6'),attributes,{'tableName':_0x221e('0x7'),'paranoid':![],'indexes':[{'name':_0x221e('0x8'),'fields':[_0x221e('0x9'),'to'],'type':_0x221e('0xa')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1a6d96,_0x569eb4,_0x483c40){if(_0x1a6d96[_0x221e('0xb')]){_0x1a6d96[_0x221e('0xc')]=moment()[_0x221e('0xd')](_0x221e('0xe'));}if(_0x1a6d96[_0x221e('0xf')]){_0x1a6d96[_0x221e('0x10')]=moment()[_0x221e('0xd')](_0x221e('0xe'));}_0x483c40(null,_0x569eb4);},'beforeUpdate':function(_0x5d63fa,_0x15a516,_0x1ca0f6){if(_0x5d63fa['changed'](_0x221e('0xb'))){_0x5d63fa[_0x221e('0xc')]=_0x5d63fa[_0x221e('0xb')]?moment()['format'](_0x221e('0xe')):null;}if(_0x5d63fa[_0x221e('0x11')](_0x221e('0xf'))){_0x5d63fa[_0x221e('0x10')]=moment()[_0x221e('0xd')](_0x221e('0xe'));_0x5d63fa['substatus']=null;_0x5d63fa[_0x221e('0xc')]=null;}_0x1ca0f6(null,_0x5d63fa);},'afterUpdate':function(_0x1c312f,_0x1c42d0,_0x167b45){var _0x455dda=_0x2bd4c4[_0x221e('0x12')];var _0x200171=_0x1c312f[_0x221e('0x13')]({'plain':!![]});if(_0x200171[_0x221e('0xf')]){return _0x455dda[_0x221e('0x14')][_0x221e('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x200171['id']}})['then'](function(){_0x167b45();})[_0x221e('0x16')](function(_0x59a26e){_0x167b45(_0x59a26e);});}else{_0x167b45();}}},'charset':_0x221e('0x17'),'collate':_0x221e('0x18')});}; \ No newline at end of file +var _0x1911=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','format','changed','models','get','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x4a8007,_0x110b76){var _0x3bc6ff=function(_0x576a5a){while(--_0x576a5a){_0x4a8007['push'](_0x4a8007['shift']());}};_0x3bc6ff(++_0x110b76);}(_0x1911,0x192));var _0x1191=function(_0x47eb8e,_0x36eb0d){_0x47eb8e=_0x47eb8e-0x0;var _0x28ec77=_0x1911[_0x47eb8e];return _0x28ec77;};'use strict';var _=require(_0x1191('0x0'));var util=require(_0x1191('0x1'));var logger=require(_0x1191('0x2'))(_0x1191('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1191('0x4'));var fs=require('fs');var path=require(_0x1191('0x5'));var rimraf=require(_0x1191('0x6'));var config=require(_0x1191('0x7'));var attributes=require(_0x1191('0x8'));module[_0x1191('0x9')]=function(_0x1f4768,_0x5b8b60){return _0x1f4768[_0x1191('0xa')](_0x1191('0xb'),attributes,{'tableName':_0x1191('0xc'),'paranoid':![],'indexes':[{'name':_0x1191('0xd'),'fields':[_0x1191('0xe'),'to'],'type':_0x1191('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x37d5f7,_0x1efa8e,_0xb72563){if(_0x37d5f7[_0x1191('0x10')]){_0x37d5f7[_0x1191('0x11')]=moment()['format'](_0x1191('0x12'));}if(_0x37d5f7[_0x1191('0x13')]){_0x37d5f7[_0x1191('0x14')]=moment()[_0x1191('0x15')](_0x1191('0x12'));}_0xb72563(null,_0x1efa8e);},'beforeUpdate':function(_0x29b8db,_0x48d692,_0x5312ec){if(_0x29b8db[_0x1191('0x16')](_0x1191('0x10'))){_0x29b8db['substatusAt']=_0x29b8db[_0x1191('0x10')]?moment()[_0x1191('0x15')](_0x1191('0x12')):null;}if(_0x29b8db[_0x1191('0x16')](_0x1191('0x13'))){_0x29b8db[_0x1191('0x14')]=moment()[_0x1191('0x15')](_0x1191('0x12'));_0x29b8db[_0x1191('0x10')]=null;_0x29b8db[_0x1191('0x11')]=null;}_0x5312ec(null,_0x29b8db);},'afterUpdate':function(_0x1f4c56,_0x6303da,_0x188bb1){var _0xee56a1=_0x1f4768[_0x1191('0x17')];var _0x3b03c3=_0x1f4c56[_0x1191('0x18')]({'plain':!![]});if(_0x3b03c3['closed']){return _0xee56a1[_0x1191('0x19')][_0x1191('0x1a')]({'read':!![]},{'where':{'MailInteractionId':_0x3b03c3['id']}})[_0x1191('0x1b')](function(){_0x188bb1();})[_0x1191('0x1c')](function(_0x45be0f){_0x188bb1(_0x45be0f);});}else{_0x188bb1();}}},'charset':_0x1191('0x1d'),'collate':_0x1191('0x1e')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index cfee037..fa93fb0 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 _0xe585=['http','redis','defaults','socket.io-emitter','./mailInteraction.socket','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','update','body','options','raw','where','attributes','limit','UpdateMailInteraction','catch','AddTagsToMailInteraction','MailInteraction','find','then','addTags','ids','omit','AddTags','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x1b50df,_0x17bcd5){var _0x3b1cf1=function(_0x34bdba){while(--_0x34bdba){_0x1b50df['push'](_0x1b50df['shift']());}};_0x3b1cf1(++_0x17bcd5);}(_0xe585,0x9a));var _0x5e58=function(_0x493752,_0x469726){_0x493752=_0x493752-0x0;var _0x4324b0=_0xe585[_0x493752];return _0x4324b0;};'use strict';var _=require(_0x5e58('0x0'));var util=require('util');var moment=require(_0x5e58('0x1'));var BPromise=require('bluebird');var rs=require(_0x5e58('0x2'));var fs=require('fs');var Redis=require(_0x5e58('0x3'));var db=require(_0x5e58('0x4'))['db'];var utils=require(_0x5e58('0x5'));var logger=require(_0x5e58('0x6'))(_0x5e58('0x7'));var config=require(_0x5e58('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5e58('0x9')][_0x5e58('0xa')]({'port':0x232a});config[_0x5e58('0xb')]=_[_0x5e58('0xc')](config[_0x5e58('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x5e58('0xd'))(new Redis(config[_0x5e58('0xb')]));require(_0x5e58('0xe'))['register'](socket);function respondWithRpcPromise(_0x5d44a1,_0x202b7d,_0x3da523){return new BPromise(function(_0x9bb524,_0x40b668){return client['request'](_0x5d44a1,_0x3da523)['then'](function(_0x276d16){logger['info'](_0x5e58('0xf'),_0x202b7d,_0x5e58('0x10'));logger[_0x5e58('0x11')](_0x5e58('0x12'),_0x202b7d,_0x5e58('0x10'),JSON[_0x5e58('0x13')](_0x276d16));if(_0x276d16[_0x5e58('0x14')]){if(_0x276d16['error'][_0x5e58('0x15')]===0x1f4){logger[_0x5e58('0x14')](_0x5e58('0xf'),_0x202b7d,_0x276d16[_0x5e58('0x14')]['message']);return _0x40b668(_0x276d16[_0x5e58('0x14')][_0x5e58('0x16')]);}logger['error'](_0x5e58('0xf'),_0x202b7d,_0x276d16['error'][_0x5e58('0x16')]);return _0x9bb524(_0x276d16[_0x5e58('0x14')]['message']);}else{logger[_0x5e58('0x17')]('MailInteraction,\x20%s,\x20%s',_0x202b7d,_0x5e58('0x10'));_0x9bb524(_0x276d16['result'][_0x5e58('0x16')]);}})['catch'](function(_0x738151){logger['error'](_0x5e58('0xf'),_0x202b7d,_0x738151);_0x40b668(_0x738151);});});}exports['UpdateMailInteraction']=function(_0x2c3dd0){var _0x1c5e59=this;return new Promise(function(_0x3e6863,_0x61f0c6){return db['MailInteraction'][_0x5e58('0x18')](_0x2c3dd0[_0x5e58('0x19')],{'raw':_0x2c3dd0['options']?_0x2c3dd0[_0x5e58('0x1a')][_0x5e58('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c3dd0[_0x5e58('0x1a')]?_0x2c3dd0['options'][_0x5e58('0x1c')]||null:null,'attributes':_0x2c3dd0[_0x5e58('0x1a')]?_0x2c3dd0['options'][_0x5e58('0x1d')]||null:null,'limit':_0x2c3dd0[_0x5e58('0x1a')]?_0x2c3dd0['options'][_0x5e58('0x1e')]||null:null})['then'](function(_0x336259){logger[_0x5e58('0x17')](_0x5e58('0x1f'),_0x2c3dd0);logger[_0x5e58('0x11')]('UpdateMailInteraction',_0x2c3dd0,JSON[_0x5e58('0x13')](_0x336259));_0x3e6863(_0x336259);})[_0x5e58('0x20')](function(_0x5eb446){logger[_0x5e58('0x14')](_0x5e58('0x1f'),_0x5eb446[_0x5e58('0x16')],_0x2c3dd0);_0x61f0c6(_0x1c5e59[_0x5e58('0x14')](0x1f4,_0x5eb446[_0x5e58('0x16')]));});});};exports[_0x5e58('0x21')]=function(_0x37f86c){return new Promise(function(_0x32b57b,_0x219178){return db[_0x5e58('0x22')][_0x5e58('0x23')]({'where':_0x37f86c[_0x5e58('0x1a')]?_0x37f86c[_0x5e58('0x1a')]['where']||null:null})[_0x5e58('0x24')](function(_0x3b41eb){if(_0x3b41eb){return _0x3b41eb[_0x5e58('0x25')](_0x37f86c[_0x5e58('0x19')][_0x5e58('0x26')],_[_0x5e58('0x27')](_0x37f86c[_0x5e58('0x19')],[_0x5e58('0x26'),'id'])||{});}})['spread'](function(_0x28b533){logger[_0x5e58('0x17')](_0x5e58('0x28'),_0x37f86c);logger[_0x5e58('0x11')]('AddTags',_0x37f86c,JSON[_0x5e58('0x13')](_0x28b533));_0x32b57b(_0x28b533);})[_0x5e58('0x20')](function(_0x405d32){logger[_0x5e58('0x14')](_0x5e58('0x28'),_0x405d32['message'],_0x37f86c);_0x219178(_this[_0x5e58('0x14')](0x1f4,_0x405d32[_0x5e58('0x16')]));});});}; \ No newline at end of file +var _0x095b=['request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailInteraction,\x20%s,\x20%s','result','UpdateMailInteraction','MailInteraction','update','body','options','where','attributes','debug','catch','AddTagsToMailInteraction','then','addTags','omit','ids','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','request','info'];(function(_0x593a4a,_0x172bf4){var _0x30dfb5=function(_0x213c0e){while(--_0x213c0e){_0x593a4a['push'](_0x593a4a['shift']());}};_0x30dfb5(++_0x172bf4);}(_0x095b,0x6e));var _0xb095=function(_0x50b934,_0x3f966e){_0x50b934=_0x50b934-0x0;var _0x4db226=_0x095b[_0x50b934];return _0x4db226;};'use strict';var _=require(_0xb095('0x0'));var util=require('util');var moment=require(_0xb095('0x1'));var BPromise=require(_0xb095('0x2'));var rs=require(_0xb095('0x3'));var fs=require('fs');var Redis=require(_0xb095('0x4'));var db=require(_0xb095('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb095('0x6'))(_0xb095('0x7'));var config=require(_0xb095('0x8'));var jayson=require(_0xb095('0x9'));var client=jayson[_0xb095('0xa')][_0xb095('0xb')]({'port':0x232a});config[_0xb095('0xc')]=_[_0xb095('0xd')](config[_0xb095('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xb095('0xe'))(new Redis(config[_0xb095('0xc')]));require(_0xb095('0xf'))[_0xb095('0x10')](socket);function respondWithRpcPromise(_0x10efbe,_0x311c57,_0x5c3522){return new BPromise(function(_0x47f74d,_0x2e510a){return client[_0xb095('0x11')](_0x10efbe,_0x5c3522)['then'](function(_0x192d2){logger[_0xb095('0x12')]('MailInteraction,\x20%s,\x20%s',_0x311c57,_0xb095('0x13'));logger['debug'](_0xb095('0x14'),_0x311c57,_0xb095('0x13'),JSON[_0xb095('0x15')](_0x192d2));if(_0x192d2[_0xb095('0x16')]){if(_0x192d2[_0xb095('0x16')][_0xb095('0x17')]===0x1f4){logger[_0xb095('0x16')]('MailInteraction,\x20%s,\x20%s',_0x311c57,_0x192d2[_0xb095('0x16')][_0xb095('0x18')]);return _0x2e510a(_0x192d2[_0xb095('0x16')][_0xb095('0x18')]);}logger[_0xb095('0x16')](_0xb095('0x19'),_0x311c57,_0x192d2['error']['message']);return _0x47f74d(_0x192d2['error'][_0xb095('0x18')]);}else{logger[_0xb095('0x12')](_0xb095('0x19'),_0x311c57,_0xb095('0x13'));_0x47f74d(_0x192d2[_0xb095('0x1a')][_0xb095('0x18')]);}})['catch'](function(_0x7f9045){logger[_0xb095('0x16')](_0xb095('0x19'),_0x311c57,_0x7f9045);_0x2e510a(_0x7f9045);});});}exports[_0xb095('0x1b')]=function(_0x5c2674){var _0x172b3e=this;return new Promise(function(_0x212c53,_0x2273f8){return db[_0xb095('0x1c')][_0xb095('0x1d')](_0x5c2674[_0xb095('0x1e')],{'raw':_0x5c2674['options']?_0x5c2674[_0xb095('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c2674['options']?_0x5c2674['options'][_0xb095('0x20')]||null:null,'attributes':_0x5c2674['options']?_0x5c2674[_0xb095('0x1f')][_0xb095('0x21')]||null:null,'limit':_0x5c2674[_0xb095('0x1f')]?_0x5c2674[_0xb095('0x1f')]['limit']||null:null})['then'](function(_0x371365){logger['info'](_0xb095('0x1b'),_0x5c2674);logger[_0xb095('0x22')](_0xb095('0x1b'),_0x5c2674,JSON['stringify'](_0x371365));_0x212c53(_0x371365);})[_0xb095('0x23')](function(_0x608591){logger[_0xb095('0x16')](_0xb095('0x1b'),_0x608591[_0xb095('0x18')],_0x5c2674);_0x2273f8(_0x172b3e[_0xb095('0x16')](0x1f4,_0x608591[_0xb095('0x18')]));});});};exports[_0xb095('0x24')]=function(_0x5ed6f7){return new Promise(function(_0x55233e,_0xd6426c){return db[_0xb095('0x1c')]['find']({'where':_0x5ed6f7[_0xb095('0x1f')]?_0x5ed6f7[_0xb095('0x1f')][_0xb095('0x20')]||null:null})[_0xb095('0x25')](function(_0xe3bc42){if(_0xe3bc42){return _0xe3bc42[_0xb095('0x26')](_0x5ed6f7[_0xb095('0x1e')]['ids'],_[_0xb095('0x27')](_0x5ed6f7[_0xb095('0x1e')],[_0xb095('0x28'),'id'])||{});}})[_0xb095('0x29')](function(_0x3ec688){logger[_0xb095('0x12')](_0xb095('0x2a'),_0x5ed6f7);logger['debug']('AddTags',_0x5ed6f7,JSON['stringify'](_0x3ec688));_0x55233e(_0x3ec688);})['catch'](function(_0x4c390e){logger[_0xb095('0x16')](_0xb095('0x2a'),_0x4c390e[_0xb095('0x18')],_0x5ed6f7);_0xd6426c(_this[_0xb095('0x16')](0x1f4,_0x4c390e[_0xb095('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 5677d7d..a5542a4 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 _0x5696=['save','remove','update','emit','removeListener','register','length','mailInteraction:','./mailInteraction.events'];(function(_0x36ca1a,_0x5eb95b){var _0x468cd2=function(_0x1a659c){while(--_0x1a659c){_0x36ca1a['push'](_0x36ca1a['shift']());}};_0x468cd2(++_0x5eb95b);}(_0x5696,0x6b));var _0x6569=function(_0x567cdc,_0x2b36d5){_0x567cdc=_0x567cdc-0x0;var _0x243f69=_0x5696[_0x567cdc];return _0x243f69;};'use strict';var MailInteractionEvents=require(_0x6569('0x0'));var events=[_0x6569('0x1'),_0x6569('0x2'),_0x6569('0x3')];function createListener(_0x198c2b,_0x5d7f06){return function(_0x3db43f){_0x5d7f06[_0x6569('0x4')](_0x198c2b,_0x3db43f);};}function removeListener(_0x1b099c,_0x5d69f2){return function(){MailInteractionEvents[_0x6569('0x5')](_0x1b099c,_0x5d69f2);};}exports[_0x6569('0x6')]=function(_0x584bd8){for(var _0x48fad3=0x0,_0x182237=events[_0x6569('0x7')];_0x48fad3<_0x182237;_0x48fad3++){var _0x63ccb0=events[_0x48fad3];var _0x411adb=createListener(_0x6569('0x8')+_0x63ccb0,_0x584bd8);MailInteractionEvents['on'](_0x63ccb0,_0x411adb);}}; \ No newline at end of file +var _0xff4a=['remove','update','emit','register','length','./mailInteraction.events','save'];(function(_0x534be1,_0x525502){var _0x2905e4=function(_0x3978c4){while(--_0x3978c4){_0x534be1['push'](_0x534be1['shift']());}};_0x2905e4(++_0x525502);}(_0xff4a,0x1cc));var _0xaff4=function(_0x226a72,_0xa15351){_0x226a72=_0x226a72-0x0;var _0x51dc3f=_0xff4a[_0x226a72];return _0x51dc3f;};'use strict';var MailInteractionEvents=require(_0xaff4('0x0'));var events=[_0xaff4('0x1'),_0xaff4('0x2'),_0xaff4('0x3')];function createListener(_0x9cf83b,_0x17edb1){return function(_0x15f8bb){_0x17edb1[_0xaff4('0x4')](_0x9cf83b,_0x15f8bb);};}function removeListener(_0x52a51f,_0x3814f5){return function(){MailInteractionEvents['removeListener'](_0x52a51f,_0x3814f5);};}exports[_0xaff4('0x5')]=function(_0x28655e){for(var _0x1a75bd=0x0,_0x1b3027=events[_0xaff4('0x6')];_0x1a75bd<_0x1b3027;_0x1a75bd++){var _0x1f3678=events[_0x1a75bd];var _0x37a217=createListener('mailInteraction:'+_0x1f3678,_0x28655e);MailInteractionEvents['on'](_0x1f3678,_0x37a217);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index f299c03..72bd687 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 _0x7d13=['util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','download','post','tracked','mail','mailmessage:create','create','put','update','/:id/accept','/:id/reject','reject','delete','destroy','exports'];(function(_0x2440d8,_0x4aeaf4){var _0x1a1dfa=function(_0x260a6a){while(--_0x260a6a){_0x2440d8['push'](_0x2440d8['shift']());}};_0x1a1dfa(++_0x4aeaf4);}(_0x7d13,0x6c));var _0x37d1=function(_0x3bf96b,_0x241008){_0x3bf96b=_0x3bf96b-0x0;var _0x431ced=_0x7d13[_0x3bf96b];return _0x431ced;};'use strict';var multer=require('multer');var util=require(_0x37d1('0x0'));var path=require('path');var timeout=require(_0x37d1('0x1'));var express=require('express');var router=express[_0x37d1('0x2')]();var fs_extra=require(_0x37d1('0x3'));var auth=require(_0x37d1('0x4'));var interaction=require(_0x37d1('0x5'));var config=require(_0x37d1('0x6'));var controller=require('./mailMessage.controller');router[_0x37d1('0x7')]('/',auth[_0x37d1('0x8')](),controller[_0x37d1('0x9')]);router[_0x37d1('0x7')]('/describe',auth[_0x37d1('0x8')](),controller[_0x37d1('0xa')]);router[_0x37d1('0x7')](_0x37d1('0xb'),auth[_0x37d1('0x8')](),controller[_0x37d1('0xc')]);router[_0x37d1('0x7')]('/:id/download',auth['isAuthenticated'](),controller[_0x37d1('0xd')]);router[_0x37d1('0xe')]('/',auth['isAuthenticated'](),interaction[_0x37d1('0xf')](_0x37d1('0x10'),_0x37d1('0x11')),controller[_0x37d1('0x12')]);router[_0x37d1('0x13')](_0x37d1('0xb'),auth[_0x37d1('0x8')](),controller[_0x37d1('0x14')]);router['put'](_0x37d1('0x15'),auth[_0x37d1('0x8')](),controller['accept']);router[_0x37d1('0x13')](_0x37d1('0x16'),auth['isAuthenticated'](),controller[_0x37d1('0x17')]);router[_0x37d1('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x37d1('0x19')]);module[_0x37d1('0x1a')]=router; \ No newline at end of file +var _0x86a8=['mail','mailmessage:create','create','update','put','/:id/accept','accept','/:id/reject','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailMessage.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/download','download','post','tracked'];(function(_0x467df4,_0x24b22f){var _0x38f096=function(_0x4c9502){while(--_0x4c9502){_0x467df4['push'](_0x467df4['shift']());}};_0x38f096(++_0x24b22f);}(_0x86a8,0x1ae));var _0x886a=function(_0x1ad411,_0x3f76c1){_0x1ad411=_0x1ad411-0x0;var _0x3dd70f=_0x86a8[_0x1ad411];return _0x3dd70f;};'use strict';var multer=require(_0x886a('0x0'));var util=require(_0x886a('0x1'));var path=require(_0x886a('0x2'));var timeout=require(_0x886a('0x3'));var express=require(_0x886a('0x4'));var router=express[_0x886a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x886a('0x6'));var interaction=require(_0x886a('0x7'));var config=require('../../config/environment');var controller=require(_0x886a('0x8'));router[_0x886a('0x9')]('/',auth['isAuthenticated'](),controller[_0x886a('0xa')]);router['get'](_0x886a('0xb'),auth['isAuthenticated'](),controller[_0x886a('0xc')]);router[_0x886a('0x9')](_0x886a('0xd'),auth[_0x886a('0xe')](),controller[_0x886a('0xf')]);router[_0x886a('0x9')](_0x886a('0x10'),auth[_0x886a('0xe')](),controller[_0x886a('0x11')]);router[_0x886a('0x12')]('/',auth['isAuthenticated'](),interaction[_0x886a('0x13')](_0x886a('0x14'),_0x886a('0x15')),controller[_0x886a('0x16')]);router['put'](_0x886a('0xd'),auth[_0x886a('0xe')](),controller[_0x886a('0x17')]);router[_0x886a('0x18')](_0x886a('0x19'),auth[_0x886a('0xe')](),controller[_0x886a('0x1a')]);router[_0x886a('0x18')](_0x886a('0x1b'),auth[_0x886a('0xe')](),controller['reject']);router[_0x886a('0x1c')](_0x886a('0xd'),auth[_0x886a('0xe')](),controller[_0x886a('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index ecfd1c8..f710baa 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 _0x4cfa=['DATE','Chat','Email','sequelize','lodash','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','long'];(function(_0x7ba178,_0x172e10){var _0x5b1d1b=function(_0x364844){while(--_0x364844){_0x7ba178['push'](_0x7ba178['shift']());}};_0x5b1d1b(++_0x172e10);}(_0x4cfa,0xb9));var _0xa4cf=function(_0x34c86f,_0x3a5a41){_0x34c86f=_0x34c86f-0x0;var _0x35e9a7=_0x4cfa[_0x34c86f];return _0x35e9a7;};'use strict';var Sequelize=require(_0xa4cf('0x0'));var _=require(_0xa4cf('0x1'));module[_0xa4cf('0x2')]={'body':{'type':Sequelize[_0xa4cf('0x3')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xa4cf('0x3')](_0xa4cf('0x4'))},'read':{'type':Sequelize[_0xa4cf('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa4cf('0x6')]('in',_0xa4cf('0x7')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0xa4cf('0x8')]},'to':{'type':Sequelize[_0xa4cf('0x3')](_0xa4cf('0x9'))},'cc':{'type':Sequelize[_0xa4cf('0x3')]('long')},'bcc':{'type':Sequelize[_0xa4cf('0x3')](_0xa4cf('0x9'))},'subject':{'type':Sequelize[_0xa4cf('0x3')]},'sentAt':{'type':Sequelize[_0xa4cf('0xa')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0xa4cf('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xa4cf('0xa')]},'originTo':{'type':Sequelize['TEXT'](_0xa4cf('0x9'))},'originCc':{'type':Sequelize[_0xa4cf('0x3')]('long')},'originChannel':{'type':Sequelize[_0xa4cf('0x6')]('Email',_0xa4cf('0xb')),'defaultValue':_0xa4cf('0xc'),'allowNull':![]}}; \ No newline at end of file +var _0xe317=['ENUM','out','STRING','DATE','INTEGER','Email','lodash','exports','TEXT','long','medium','BOOLEAN'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xe317,0x8a));var _0x7e31=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xe317[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require('sequelize');var _=require(_0x7e31('0x0'));module[_0x7e31('0x1')]={'body':{'type':Sequelize[_0x7e31('0x2')](_0x7e31('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x7e31('0x2')](_0x7e31('0x4'))},'read':{'type':Sequelize[_0x7e31('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7e31('0x6')]('in',_0x7e31('0x7')),'defaultValue':_0x7e31('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x7e31('0x8')](0x1fe)},'from':{'type':Sequelize[_0x7e31('0x8')]},'to':{'type':Sequelize[_0x7e31('0x2')]('long')},'cc':{'type':Sequelize['TEXT']('long')},'bcc':{'type':Sequelize[_0x7e31('0x2')](_0x7e31('0x3'))},'subject':{'type':Sequelize[_0x7e31('0x2')]},'sentAt':{'type':Sequelize[_0x7e31('0x9')]},'attach':{'type':Sequelize[_0x7e31('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x7e31('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x7e31('0x9')]},'originTo':{'type':Sequelize[_0x7e31('0x2')](_0x7e31('0x3'))},'originCc':{'type':Sequelize[_0x7e31('0x2')](_0x7e31('0x3'))},'originChannel':{'type':Sequelize[_0x7e31('0x6')](_0x7e31('0xb'),'Chat'),'defaultValue':_0x7e31('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 cf89675..a0a4c7c 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 _0x654f=['merge','VIRTUAL','options','includeAll','include','MailMessage','keys','catch','body','params','find','describe','create','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','server/files/attachments','basename','defaults','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','readAt','UserId','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','interface','channel','motionChannel','event','EventManager','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','User','SIP/%s','fromString','rejectmessage','download','unix','root','files','tmp','server','message-%s.eml','from','bcc','createdAt','Attachment','subject','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','push','readFileSync','writeFileSync','unlinkSync','moment','bluebird','util','path','lodash','ioredis','html-to-text','api','../../config/logger','mail-interactions','../../config/environment','redis','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','then','info','MailMessage,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','status','json','offset','undefined','limit','count','set','update','destroy','end','sendStatus','stack','send','index','map','rawAttributes','fieldName','type','key','model','name','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter'];(function(_0xc6b82a,_0x5d019f){var _0x5d51c3=function(_0x29de09){while(--_0x29de09){_0xc6b82a['push'](_0xc6b82a['shift']());}};_0x5d51c3(++_0x5d019f);}(_0x654f,0x65));var _0xf654=function(_0x37e763,_0x590e9c){_0x37e763=_0x37e763-0x0;var _0x38a12c=_0x654f[_0x37e763];return _0x38a12c;};'use strict';var emlformat=require('eml-format');var moment=require(_0xf654('0x0'));var BPromise=require(_0xf654('0x1'));var util=require(_0xf654('0x2'));var path=require(_0xf654('0x3'));var fs=require('fs');var _=require(_0xf654('0x4'));var Redis=require(_0xf654('0x5'));var htmlToText=require(_0xf654('0x6'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xf654('0x7'));var interaction_log=require(_0xf654('0x8'))(_0xf654('0x9'));var config=require(_0xf654('0xa'));var db=require('../../mysqldb')['db'];config[_0xf654('0xb')]=_['defaults'](config[_0xf654('0xb')],{'host':_0xf654('0xc'),'port':0x18eb});var socket=require(_0xf654('0xd'))(new Redis(config['redis']));var htmlEntities=require(_0xf654('0xe'));require(_0xf654('0xf'))[_0xf654('0x10')](socket);var jayson=require(_0xf654('0x11'));var client=jayson[_0xf654('0x12')][_0xf654('0x13')]({'port':0x232c});var client9003=jayson[_0xf654('0x12')]['http']({'port':0x232b});var client9002=jayson['client'][_0xf654('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x41410c,_0x57451,_0x1ae4db,_0xdd0552){return new BPromise(function(_0x5e79e2,_0x598950){var _0x513b1b=_0xdd0552||client;return _0x513b1b['request'](_0x41410c,_0x1ae4db)[_0xf654('0x14')](function(_0x522fe7){logger[_0xf654('0x15')](_0xf654('0x16'),_0x57451,'request\x20sent');logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x57451,'request\x20sent',JSON[_0xf654('0x17')](_0x522fe7));if(_0x522fe7[_0xf654('0x18')]){if(_0x522fe7[_0xf654('0x18')][_0xf654('0x19')]===0x1f4){logger[_0xf654('0x18')]('MailMessage,\x20%s,\x20%s',_0x57451,_0x522fe7[_0xf654('0x18')][_0xf654('0x1a')]);return _0x598950(_0x522fe7['error'][_0xf654('0x1a')]);}logger[_0xf654('0x18')](_0xf654('0x16'),_0x57451,_0x522fe7[_0xf654('0x18')][_0xf654('0x1a')]);return _0x5e79e2(_0x522fe7[_0xf654('0x18')]['message']);}else{logger[_0xf654('0x15')](_0xf654('0x16'),_0x57451,_0xf654('0x1b'));_0x5e79e2(_0x522fe7[_0xf654('0x1c')]['message']);}})['catch'](function(_0x4a7cd0){logger[_0xf654('0x18')](_0xf654('0x16'),_0x57451,_0x4a7cd0);_0x598950(_0x4a7cd0);});});}function respondWithResult(_0x28cf9a,_0x12f434){_0x12f434=_0x12f434||0xc8;return function(_0xd3ad80){if(_0xd3ad80){return _0x28cf9a[_0xf654('0x1d')](_0x12f434)[_0xf654('0x1e')](_0xd3ad80);}};}function respondWithFilteredResult(_0x1103d6,_0x21ba00){return function(_0x368acb){if(_0x368acb){var _0x38a5a5=typeof _0x21ba00[_0xf654('0x1f')]===_0xf654('0x20')&&typeof _0x21ba00[_0xf654('0x21')]==='undefined';var _0x483a04=_0x368acb[_0xf654('0x22')];var _0x33abda=_0x38a5a5?0x0:_0x21ba00[_0xf654('0x1f')];var _0x349ec7=_0x38a5a5?_0x368acb[_0xf654('0x22')]:_0x21ba00['offset']+_0x21ba00[_0xf654('0x21')];var _0x17d404;if(_0x349ec7>=_0x483a04){_0x349ec7=_0x483a04;_0x17d404=0xc8;}else{_0x17d404=0xce;}_0x1103d6[_0xf654('0x1d')](_0x17d404);return _0x1103d6[_0xf654('0x23')]('Content-Range',_0x33abda+'-'+_0x349ec7+'/'+_0x483a04)[_0xf654('0x1e')](_0x368acb);}return null;};}function saveUpdates(_0x535621){return function(_0x1ba86a){if(_0x1ba86a){return _0x1ba86a[_0xf654('0x24')](_0x535621)[_0xf654('0x14')](function(_0x31c03c){return _0x31c03c;});}return null;};}function removeEntity(_0x2ddbbd){return function(_0x3567e2){if(_0x3567e2){return _0x3567e2[_0xf654('0x25')]()[_0xf654('0x14')](function(){_0x2ddbbd[_0xf654('0x1d')](0xcc)[_0xf654('0x26')]();});}};}function handleEntityNotFound(_0x556c15){return function(_0x39f0ed){if(!_0x39f0ed){_0x556c15[_0xf654('0x27')](0x194);}return _0x39f0ed;};}function handleError(_0x315224,_0xd5c91b){_0xd5c91b=_0xd5c91b||0x1f4;return function(_0x42032a){logger[_0xf654('0x18')](_0x42032a[_0xf654('0x28')]);if(_0x42032a['name']){delete _0x42032a['name'];}_0x315224[_0xf654('0x1d')](_0xd5c91b)[_0xf654('0x29')](_0x42032a);};}exports[_0xf654('0x2a')]=function(_0x414068,_0x57d8a3){var _0x185500={},_0xae11b7={},_0x1c9324={'count':0x0,'rows':[]};var _0x3b2918=_[_0xf654('0x2b')](db['MailMessage'][_0xf654('0x2c')],function(_0x4aa2b5){return{'name':_0x4aa2b5[_0xf654('0x2d')],'type':_0x4aa2b5[_0xf654('0x2e')][_0xf654('0x2f')]};});_0xae11b7[_0xf654('0x30')]=_[_0xf654('0x2b')](_0x3b2918,_0xf654('0x31'));_0xae11b7['query']=_['keys'](_0x414068['query']);_0xae11b7[_0xf654('0x32')]=_[_0xf654('0x33')](_0xae11b7[_0xf654('0x30')],_0xae11b7[_0xf654('0x34')]);_0x185500['attributes']=_[_0xf654('0x33')](_0xae11b7[_0xf654('0x30')],qs[_0xf654('0x35')](_0x414068[_0xf654('0x34')][_0xf654('0x35')]));_0x185500[_0xf654('0x36')]=_0x185500[_0xf654('0x36')][_0xf654('0x37')]?_0x185500[_0xf654('0x36')]:_0xae11b7['model'];if(!_0x414068[_0xf654('0x34')][_0xf654('0x38')](_0xf654('0x39'))){_0x185500[_0xf654('0x21')]=qs[_0xf654('0x21')](_0x414068[_0xf654('0x34')][_0xf654('0x21')]);_0x185500[_0xf654('0x1f')]=qs[_0xf654('0x1f')](_0x414068[_0xf654('0x34')][_0xf654('0x1f')]);}_0x185500['order']=qs['sort'](_0x414068[_0xf654('0x34')][_0xf654('0x3a')]);_0x185500[_0xf654('0x3b')]=qs['filters'](_[_0xf654('0x3c')](_0x414068['query'],_0xae11b7['filters']),_0x3b2918);if(_0x414068[_0xf654('0x34')][_0xf654('0x3d')]){_0x185500[_0xf654('0x3b')]=_[_0xf654('0x3e')](_0x185500[_0xf654('0x3b')],{'$or':_[_0xf654('0x2b')](_0x3b2918,function(_0x1119a2){if(_0x1119a2['type']!==_0xf654('0x3f')){var _0x168a9c={};_0x168a9c[_0x1119a2['name']]={'$like':'%'+_0x414068[_0xf654('0x34')][_0xf654('0x3d')]+'%'};return _0x168a9c;}})});}_0x185500=_['merge']({},_0x185500,_0x414068[_0xf654('0x40')]);var _0x1e6550={'where':_0x185500[_0xf654('0x3b')]};return db['MailMessage']['count'](_0x1e6550)[_0xf654('0x14')](function(_0x53b0fb){_0x1c9324[_0xf654('0x22')]=_0x53b0fb;if(_0x414068[_0xf654('0x34')][_0xf654('0x41')]){_0x185500[_0xf654('0x42')]=[{'all':!![]}];}return db[_0xf654('0x43')]['findAll'](_0x185500);})[_0xf654('0x14')](function(_0x48d80a){_0x1c9324['rows']=_0x48d80a;return _0x1c9324;})[_0xf654('0x14')](respondWithFilteredResult(_0x57d8a3,_0x185500))['catch'](handleError(_0x57d8a3,null));};exports['show']=function(_0x28f562,_0x4ab27d){var _0x73e97a={'raw':!![],'where':{'id':_0x28f562['params']['id']}},_0x445160={};_0x445160['model']=_[_0xf654('0x44')](db[_0xf654('0x43')][_0xf654('0x2c')]);_0x445160['query']=_[_0xf654('0x44')](_0x28f562[_0xf654('0x34')]);_0x445160[_0xf654('0x32')]=_['intersection'](_0x445160[_0xf654('0x30')],_0x445160['query']);_0x73e97a[_0xf654('0x36')]=_[_0xf654('0x33')](_0x445160['model'],qs[_0xf654('0x35')](_0x28f562[_0xf654('0x34')]['fields']));_0x73e97a['attributes']=_0x73e97a['attributes']['length']?_0x73e97a[_0xf654('0x36')]:_0x445160['model'];if(_0x28f562[_0xf654('0x34')][_0xf654('0x41')]){_0x73e97a[_0xf654('0x42')]=[{'all':!![]}];}_0x73e97a=_[_0xf654('0x3e')]({},_0x73e97a,_0x28f562[_0xf654('0x40')]);return db[_0xf654('0x43')]['find'](_0x73e97a)[_0xf654('0x14')](handleEntityNotFound(_0x4ab27d,null))[_0xf654('0x14')](respondWithResult(_0x4ab27d,null))[_0xf654('0x45')](handleError(_0x4ab27d,null));};exports[_0xf654('0x24')]=function(_0x3c9e96,_0x23f1e9){if(_0x3c9e96[_0xf654('0x46')]['id']){delete _0x3c9e96['body']['id'];}return db[_0xf654('0x43')]['find']({'where':{'id':_0x3c9e96[_0xf654('0x47')]['id']}})[_0xf654('0x14')](handleEntityNotFound(_0x23f1e9,null))[_0xf654('0x14')](saveUpdates(_0x3c9e96[_0xf654('0x46')],null))[_0xf654('0x14')](respondWithResult(_0x23f1e9,null))[_0xf654('0x45')](handleError(_0x23f1e9,null));};exports[_0xf654('0x25')]=function(_0x5f2232,_0x32e424){return db[_0xf654('0x43')][_0xf654('0x48')]({'where':{'id':_0x5f2232['params']['id']}})[_0xf654('0x14')](handleEntityNotFound(_0x32e424,null))[_0xf654('0x14')](removeEntity(_0x32e424,null))['catch'](handleError(_0x32e424,null));};exports[_0xf654('0x49')]=function(_0x8dd4c5,_0x548e70){return db[_0xf654('0x43')][_0xf654('0x49')]()[_0xf654('0x14')](respondWithResult(_0x548e70,null))['catch'](handleError(_0x548e70,null));};exports[_0xf654('0x4a')]=function(_0xa658fe,_0x18ce34){return db[_0xf654('0x43')][_0xf654('0x4a')](_0xa658fe[_0xf654('0x46')])[_0xf654('0x14')](function(_0x577df5){if(_0x577df5){if(_0x577df5['direction']===_0xf654('0x4b')&&!_0x577df5[_0xf654('0x4c')]){var _0x4a70bc,_0x38e1ac,_0x129b45;if(_0xa658fe[_0xf654('0x46')]['to']){_0x38e1ac=_0xa658fe[_0xf654('0x46')]['to'][_0xf654('0x4d')](',')[0x0];}return db[_0xf654('0x4e')][_0xf654('0x4f')]({'where':{'id':_0x577df5[_0xf654('0x50')]},'include':[{'model':db[_0xf654('0x51')],'as':_0xf654('0x52'),'include':[{'model':db[_0xf654('0x53')],'as':_0xf654('0x54'),'where':{'email':_0x38e1ac},'limit':0x1,'order':[[_0xf654('0x55'),_0xf654('0x56')]]}]},{'model':db[_0xf654('0x57')],'as':_0xf654('0x58'),'raw':!![],'include':[{'model':db[_0xf654('0x59')],'as':_0xf654('0x59'),'raw':!![]}]}]})[_0xf654('0x14')](function(_0x48945c){_0x4a70bc=_0x48945c;if(!_0x4a70bc||!_0x4a70bc[_0xf654('0x58')])return;var _0x227cab=_0x4a70bc[_0xf654('0x5a')]();if(_0xa658fe[_0xf654('0x46')][_0xf654('0x5b')]&&_0xa658fe[_0xf654('0x46')][_0xf654('0x5b')][_0xf654('0x37')]){for(var _0x29e0c1=0x0;_0x29e0c1<_0xa658fe[_0xf654('0x46')][_0xf654('0x5b')]['length'];_0x29e0c1+=0x1){_0xa658fe[_0xf654('0x46')]['attachments'][_0x29e0c1]={'filename':_0xa658fe[_0xf654('0x46')][_0xf654('0x5b')][_0x29e0c1][_0xf654('0x31')],'path':path[_0xf654('0x5c')](config['root'],_0xf654('0x5d'),_0xa658fe[_0xf654('0x46')][_0xf654('0x5b')][_0x29e0c1][_0xf654('0x5e')])};}}_0x129b45={'account':_0x227cab,'message':_0xa658fe['body']};return;})[_0xf654('0x14')](function(){if(_0x4a70bc[_0xf654('0x52')]){if(_0x4a70bc[_0xf654('0x52')][_0xf654('0x54')][_0xf654('0x37')]){return _0x4a70bc[_0xf654('0x52')][_0xf654('0x54')][0x0];}else{return db[_0xf654('0x53')][_0xf654('0x4a')](_[_0xf654('0x5f')](_0xa658fe['body'],{'firstName':_0xa658fe[_0xf654('0x46')]['to'],'email':_0xa658fe[_0xf654('0x46')]['to'],'phone':_0xa658fe[_0xf654('0x46')]['to'],'ListId':_0x4a70bc[_0xf654('0x60')]}));}}else{throw new Error(_0xf654('0x61'));}})[_0xf654('0x14')](function(){if(_0x129b45){return respondWithRpcPromise(_0xf654('0x62'),_0xf654('0x63'),_0x129b45,client9003)[_0xf654('0x14')](function(_0x66ec3b){return _0x577df5[_0xf654('0x24')]({'read':!![],'messageId':_0x66ec3b[_0xf654('0x64')],'sentAt':moment()[_0xf654('0x65')](_0xf654('0x66'))});})[_0xf654('0x45')](function(_0x299bc3){logger[_0xf654('0x18')]('%s',JSON['stringify'](_0x299bc3));return _0x577df5;});}return _0x577df5;});}return _0x577df5;}})[_0xf654('0x14')](respondWithResult(_0x18ce34,0xc9))[_0xf654('0x45')](handleError(_0x18ce34,null));};exports[_0xf654('0x67')]=function(_0x27cc29,_0x1c4dab){var _0x4c8563={'agent':{},'channel':_0xf654('0x68')};if(_0x27cc29[_0xf654('0x46')]['id']){delete _0x27cc29[_0xf654('0x46')]['id'];}_0x27cc29['body']['read']=!![];_0x27cc29[_0xf654('0x46')][_0xf654('0x69')]=moment()['format'](_0xf654('0x66'));_0x27cc29[_0xf654('0x46')][_0xf654('0x6a')]=_0x27cc29[_0xf654('0x46')][_0xf654('0x6a')]||_0x27cc29['user']['id'];_0x4c8563[_0xf654('0x6b')]['id']=_0x27cc29[_0xf654('0x46')][_0xf654('0x6a')];return db[_0xf654('0x43')][_0xf654('0x48')]({'where':{'id':_0x27cc29[_0xf654('0x47')]['id'],'UserId':null}})[_0xf654('0x14')](handleEntityNotFound(_0x1c4dab,null))[_0xf654('0x14')](saveUpdates(_0x27cc29[_0xf654('0x46')],null))[_0xf654('0x14')](function(_0x5ca982){if(_0x5ca982){_0x4c8563[_0xf654('0x1a')]=_0x5ca982[_0xf654('0x6c')]({'plain':!![]});return db[_0xf654('0x6d')][_0xf654('0x48')]({'where':{'id':_0x5ca982[_0xf654('0x6e')]}});}return null;})['then'](handleEntityNotFound(_0x1c4dab,null))[_0xf654('0x14')](function(_0x4fe66e){if(_0x4fe66e){return _0x4fe66e[_0xf654('0x24')]({'UserId':_0x27cc29[_0xf654('0x46')]['UserId'],'read1stAt':_[_0xf654('0x6f')](_0x4fe66e[_0xf654('0x70')])?moment()[_0xf654('0x65')](_0xf654('0x66')):undefined});}return null;})['then'](function(_0x4af71f){if(_0x4af71f){_0x4c8563[_0xf654('0x71')]=_0x4af71f['get']({'plain':!![]});interaction_log[_0xf654('0x15')](_0xf654('0x72'),_0x27cc29[_0xf654('0x73')]['id'],_0x27cc29[_0xf654('0x73')][_0xf654('0x31')],_0x27cc29[_0xf654('0x73')]['role'],_0x4c8563[_0xf654('0x71')]['id'],_0x27cc29[_0xf654('0x46')]?JSON[_0xf654('0x17')](_0x27cc29[_0xf654('0x46')]):_0xf654('0x74'));return respondWithRpcPromise(_0xf654('0x75'),_0xf654('0x76'),_0x4c8563);}return null;})['then'](function(_0x137d4e){var _0x4a5382=_0xf654('0x77')+_0x137d4e[_0xf654('0x1a')][_0xf654('0x78')];return db['sequelize'][_0xf654('0x34')](_0x4a5382,{'type':db[_0xf654('0x79')][_0xf654('0x7a')][_0xf654('0x7b')],'raw':!![]})[_0xf654('0x14')](function(_0x2d3fe4){return _0x2d3fe4;});})['then'](function(_0x581953){if(_0x581953){_0x4c8563[_0xf654('0x1a')][_0xf654('0x7c')]=_0x581953[0x0];if(!_0x27cc29[_0xf654('0x46')][_0xf654('0x6a')])return;return db['User'][_0xf654('0x48')]({'where':{'id':_0x27cc29[_0xf654('0x46')][_0xf654('0x6a')],'role':_0xf654('0x6b')},'attributes':['id',_0xf654('0x31'),_0xf654('0x7d'),_0xf654('0x7e'),_0xf654('0x7f')],'raw':!![]});}return null;})[_0xf654('0x14')](function(_0x460977){if(!_0x460977)return null;_0x4c8563[_0xf654('0x1a')][_0xf654('0x6b')]=_0x460977;return _0x4c8563;})[_0xf654('0x14')](function(_0x154216){if(_0x154216){if(_0x27cc29[_0xf654('0x46')][_0xf654('0x80')]){_0x4c8563[_0xf654('0x1a')][_0xf654('0x81')]=util[_0xf654('0x65')]('SIP/%s',_0x27cc29[_0xf654('0x73')][_0xf654('0x31')]);_0x4c8563[_0xf654('0x1a')][_0xf654('0x82')]=_0x4c8563[_0xf654('0x82')];_0x4c8563[_0xf654('0x1a')][_0xf654('0x83')]=_0x4c8563[_0xf654('0x82')];_0x4c8563[_0xf654('0x1a')][_0xf654('0x84')]=_0xf654('0x67');_0x4c8563[_0xf654('0x1a')]['body']=htmlToText['fromString'](_0x4c8563[_0xf654('0x1a')][_0xf654('0x46')]);return respondWithRpcPromise(_0xf654('0x85'),'EventManager',{'event':'acceptmessage','message':_0x4c8563[_0xf654('0x1a')]},client9002)['then'](function(){return _0x4c8563;});}return _0x4c8563;}return null;})[_0xf654('0x14')](respondWithResult(_0x1c4dab,null))[_0xf654('0x45')](handleError(_0x1c4dab,null));};exports[_0xf654('0x86')]=function(_0x31fe74,_0x38a1d0){var _0x1b705a={'agent':{},'channel':_0xf654('0x68')};if(_0x31fe74[_0xf654('0x46')]['id']){delete _0x31fe74['body']['id'];}_0x31fe74[_0xf654('0x46')][_0xf654('0x6a')]=_0x31fe74[_0xf654('0x46')][_0xf654('0x6a')]||_0x31fe74[_0xf654('0x73')]['id'];_0x1b705a[_0xf654('0x6b')]['id']=_0x31fe74[_0xf654('0x46')][_0xf654('0x6a')];return db['MailMessage']['find']({'where':{'id':_0x31fe74['params']['id'],'UserId':null}})[_0xf654('0x14')](handleEntityNotFound(_0x38a1d0,null))[_0xf654('0x14')](function(_0x1d3c73){if(_0x1d3c73){_0x1b705a['message']=_0x1d3c73[_0xf654('0x6c')]({'plain':!![]});return db[_0xf654('0x6d')][_0xf654('0x48')]({'where':{'id':_0x1d3c73[_0xf654('0x6e')]}});}return null;})[_0xf654('0x14')](handleEntityNotFound(_0x38a1d0,null))[_0xf654('0x14')](function(_0x465c9a){if(_0x465c9a){_0x1b705a[_0xf654('0x71')]=_0x465c9a[_0xf654('0x6c')]({'plain':!![]});interaction_log['info'](_0xf654('0x87'),_0x31fe74[_0xf654('0x73')]['id'],_0x31fe74[_0xf654('0x73')][_0xf654('0x31')],_0x31fe74['user'][_0xf654('0x88')],_0x1b705a[_0xf654('0x71')]['id'],_0x31fe74['body']?JSON[_0xf654('0x17')](_0x31fe74[_0xf654('0x46')]):_0xf654('0x74'));return respondWithRpcPromise(_0xf654('0x89'),'rejectMessage',_0x1b705a);}return null;})[_0xf654('0x14')](function(_0x3e3a4b){var _0x8a2a64='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3e3a4b[_0xf654('0x1a')][_0xf654('0x78')];return db['sequelize'][_0xf654('0x34')](_0x8a2a64,{'type':db[_0xf654('0x79')]['QueryTypes'][_0xf654('0x7b')],'raw':!![]})['then'](function(_0x290624){return _0x290624;});})['then'](function(_0x2eaf99){if(_0x2eaf99){_0x1b705a[_0xf654('0x1a')]['contact']=_0x2eaf99[0x0];if(!_0x31fe74[_0xf654('0x46')]['UserId'])return;return db[_0xf654('0x8a')][_0xf654('0x48')]({'where':{'id':_0x31fe74[_0xf654('0x46')][_0xf654('0x6a')],'role':'agent'},'attributes':['id',_0xf654('0x31'),_0xf654('0x7d'),_0xf654('0x7e'),'internal'],'raw':!![]});}return null;})[_0xf654('0x14')](function(_0x2279be){if(!_0x2279be)return null;_0x1b705a[_0xf654('0x1a')][_0xf654('0x6b')]=_0x2279be;return _0x1b705a;})[_0xf654('0x14')](function(_0x43c811){if(_0x43c811){_0x43c811['message']['interface']=util[_0xf654('0x65')](_0xf654('0x8b'),_0x31fe74[_0xf654('0x73')][_0xf654('0x31')]);_0x43c811[_0xf654('0x1a')]['channel']=_0x1b705a[_0xf654('0x82')];_0x43c811['message'][_0xf654('0x83')]=_0x1b705a['channel'];_0x43c811[_0xf654('0x1a')]['event']=_0xf654('0x86');_0x43c811[_0xf654('0x1a')]['body']=htmlToText[_0xf654('0x8c')](_0x1b705a[_0xf654('0x1a')][_0xf654('0x46')]);respondWithRpcPromise(_0xf654('0x85'),_0xf654('0x85'),{'event':_0xf654('0x8d'),'message':_0x43c811['message']},client9002);return _0x1b705a;}return null;})['then'](respondWithResult(_0x38a1d0,null))[_0xf654('0x45')](handleError(_0x38a1d0,null));};exports[_0xf654('0x8e')]=function(_0x22d531,_0x138d27){var _0x3f92be=moment()[_0xf654('0x8f')]()['toString']();var _0x30c212=path[_0xf654('0x5c')](config[_0xf654('0x90')],'server',_0xf654('0x91'),_0xf654('0x92'));var _0x5a8cfe=path[_0xf654('0x5c')](config[_0xf654('0x90')],_0xf654('0x93'),'files',_0xf654('0x5b'));var _0x30af68=util[_0xf654('0x65')](_0xf654('0x94'),_0x3f92be);return db[_0xf654('0x43')]['find']({'where':{'id':_0x22d531[_0xf654('0x47')]['id']},'attributes':['id',_0xf654('0x46'),_0xf654('0x95'),'to','cc',_0xf654('0x96'),'subject',_0xf654('0x97')],'include':_0x22d531[_0xf654('0x34')][_0xf654('0x5b')]?[{'model':db[_0xf654('0x98')],'as':'Attachments'}]:undefined})['then'](handleEntityNotFound(_0x138d27,null))[_0xf654('0x14')](function(_0x5783f2){if(_0x5783f2){var _0x145455=_0x5783f2;var _0x472aaa={'from':_0x145455[_0xf654('0x95')],'to':_0x145455['to'],'subject':_0x145455[_0xf654('0x99')],'html':htmlEntities[_0xf654('0x9a')](_0x145455[_0xf654('0x46')]),'headers':{'Date':moment(_0x145455[_0xf654('0x97')])[_0xf654('0x65')](_0xf654('0x9b'))},'attachments':[]};if(_0x5783f2['cc']){_0x472aaa['headers']['Cc']=_0x5783f2['cc'];}if(_0x5783f2['bcc']){_0x472aaa[_0xf654('0x9c')][_0xf654('0x9d')]=_0x5783f2[_0xf654('0x96')];}return new BPromise(function(_0x45b853,_0x1fa93c){if(_0x5783f2['Attachments']){for(var _0x3e7423=0x0;_0x3e7423<_0x5783f2[_0xf654('0x9e')]['length'];_0x3e7423++){var _0x30e6eb=_0x5783f2[_0xf654('0x9e')][_0x3e7423];var _0x5952da=path[_0xf654('0x5c')](_0x5a8cfe,_0x30e6eb[_0xf654('0x5e')]);if(fs['existsSync'](_0x5952da)){_0x472aaa['attachments'][_0xf654('0x9f')]({'name':_0x30e6eb[_0xf654('0x31')],'contentType':_0x30e6eb[_0xf654('0x2e')],'data':fs[_0xf654('0xa0')](_0x5952da)});}}}emlformat['build'](_0x472aaa,function(_0x242d0b,_0x423e00){if(_0x242d0b)return _0x1fa93c(_0x242d0b);fs[_0xf654('0xa1')](path[_0xf654('0x5c')](_0x30c212,_0x30af68),_0x423e00);return _0x45b853(_0x423e00);});});}})[_0xf654('0x14')](function(_0x1953fb){if(_0x1953fb){return _0x138d27[_0xf654('0x8e')](path[_0xf654('0x5c')](_0x30c212,_0x30af68),_0x30af68,function(_0x3c1274){if(!_0x3c1274)fs[_0xf654('0xa2')](path[_0xf654('0x5c')](_0x30c212,_0x30af68));});}})[_0xf654('0x45')](handleError(_0x138d27,null));}; \ No newline at end of file +var _0x44f8=['include','findAll','rows','show','keys','includeAll','find','body','params','create','direction','out','secret','MailAccount','MailAccountId','CmList','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','attachments','join','root','server/files/attachments','List','ListId','List\x20not\x20found','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','user','agent','MailInteraction','isNil','read1stAt','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','interface','channel','motionChannel','fromString','EventManager','acceptmessage','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','User','SIP/%s','rejectmessage','download','toString','server','files','message-%s.eml','bcc','subject','Attachment','Attachments','from','decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','util','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','html-entities','register','client','http','request','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','status','json','limit','count','set','Content-Range','update','then','destroy','sendStatus','stack','name','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','where','filter','merge','options','MailMessage'];(function(_0x39c5e5,_0x2198a9){var _0x30c44c=function(_0xc956db){while(--_0xc956db){_0x39c5e5['push'](_0x39c5e5['shift']());}};_0x30c44c(++_0x2198a9);}(_0x44f8,0x193));var _0x844f=function(_0x53236b,_0x45443b){_0x53236b=_0x53236b-0x0;var _0x2c8631=_0x44f8[_0x53236b];return _0x2c8631;};'use strict';var emlformat=require(_0x844f('0x0'));var moment=require(_0x844f('0x1'));var BPromise=require('bluebird');var util=require(_0x844f('0x2'));var path=require(_0x844f('0x3'));var fs=require('fs');var _=require(_0x844f('0x4'));var Redis=require(_0x844f('0x5'));var htmlToText=require('html-to-text');var qs=require(_0x844f('0x6'));var logger=require(_0x844f('0x7'))(_0x844f('0x8'));var interaction_log=require('../../config/logger')('mail-interactions');var config=require(_0x844f('0x9'));var db=require(_0x844f('0xa'))['db'];config[_0x844f('0xb')]=_[_0x844f('0xc')](config['redis'],{'host':_0x844f('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x844f('0xb')]));var htmlEntities=require(_0x844f('0xe'));require('./mailMessage.socket')[_0x844f('0xf')](socket);var jayson=require('jayson/promise');var client=jayson[_0x844f('0x10')][_0x844f('0x11')]({'port':0x232c});var client9003=jayson[_0x844f('0x10')][_0x844f('0x11')]({'port':0x232b});var client9002=jayson[_0x844f('0x10')][_0x844f('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x381212,_0xd31c8b,_0x2cea33,_0x3546fd){return new BPromise(function(_0x4f0771,_0x32ba5a){var _0x576fe8=_0x3546fd||client;return _0x576fe8[_0x844f('0x12')](_0x381212,_0x2cea33)['then'](function(_0x1ec733){logger['info'](_0x844f('0x13'),_0xd31c8b,_0x844f('0x14'));logger[_0x844f('0x15')](_0x844f('0x16'),_0xd31c8b,'request\x20sent',JSON[_0x844f('0x17')](_0x1ec733));if(_0x1ec733[_0x844f('0x18')]){if(_0x1ec733['error'][_0x844f('0x19')]===0x1f4){logger[_0x844f('0x18')]('MailMessage,\x20%s,\x20%s',_0xd31c8b,_0x1ec733[_0x844f('0x18')]['message']);return _0x32ba5a(_0x1ec733['error'][_0x844f('0x1a')]);}logger[_0x844f('0x18')](_0x844f('0x13'),_0xd31c8b,_0x1ec733[_0x844f('0x18')]['message']);return _0x4f0771(_0x1ec733['error']['message']);}else{logger[_0x844f('0x1b')](_0x844f('0x13'),_0xd31c8b,_0x844f('0x14'));_0x4f0771(_0x1ec733['result']['message']);}})[_0x844f('0x1c')](function(_0x1ed0fa){logger[_0x844f('0x18')](_0x844f('0x13'),_0xd31c8b,_0x1ed0fa);_0x32ba5a(_0x1ed0fa);});});}function respondWithResult(_0x449b39,_0x2b54eb){_0x2b54eb=_0x2b54eb||0xc8;return function(_0x2aa2a9){if(_0x2aa2a9){return _0x449b39[_0x844f('0x1d')](_0x2b54eb)[_0x844f('0x1e')](_0x2aa2a9);}};}function respondWithFilteredResult(_0x1cfd26,_0xaeb104){return function(_0x59efe9){if(_0x59efe9){var _0x3d39ca=typeof _0xaeb104['offset']==='undefined'&&typeof _0xaeb104[_0x844f('0x1f')]==='undefined';var _0x5a2d1b=_0x59efe9[_0x844f('0x20')];var _0x15207b=_0x3d39ca?0x0:_0xaeb104['offset'];var _0x51dea2=_0x3d39ca?_0x59efe9[_0x844f('0x20')]:_0xaeb104['offset']+_0xaeb104[_0x844f('0x1f')];var _0x40e762;if(_0x51dea2>=_0x5a2d1b){_0x51dea2=_0x5a2d1b;_0x40e762=0xc8;}else{_0x40e762=0xce;}_0x1cfd26[_0x844f('0x1d')](_0x40e762);return _0x1cfd26[_0x844f('0x21')](_0x844f('0x22'),_0x15207b+'-'+_0x51dea2+'/'+_0x5a2d1b)[_0x844f('0x1e')](_0x59efe9);}return null;};}function saveUpdates(_0x35958d){return function(_0xa34d58){if(_0xa34d58){return _0xa34d58[_0x844f('0x23')](_0x35958d)[_0x844f('0x24')](function(_0x5701b8){return _0x5701b8;});}return null;};}function removeEntity(_0x3a5970){return function(_0x11118e){if(_0x11118e){return _0x11118e[_0x844f('0x25')]()[_0x844f('0x24')](function(){_0x3a5970[_0x844f('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x222a22){return function(_0x3b42f2){if(!_0x3b42f2){_0x222a22[_0x844f('0x26')](0x194);}return _0x3b42f2;};}function handleError(_0x1e0bd9,_0x471905){_0x471905=_0x471905||0x1f4;return function(_0x49502e){logger[_0x844f('0x18')](_0x49502e[_0x844f('0x27')]);if(_0x49502e[_0x844f('0x28')]){delete _0x49502e[_0x844f('0x28')];}_0x1e0bd9['status'](_0x471905)['send'](_0x49502e);};}exports['index']=function(_0x24c2cf,_0x17abfd){var _0x251b24={},_0x5eb5ee={},_0x1aa6c7={'count':0x0,'rows':[]};var _0xeaa75e=_[_0x844f('0x29')](db['MailMessage'][_0x844f('0x2a')],function(_0x40a194){return{'name':_0x40a194[_0x844f('0x2b')],'type':_0x40a194[_0x844f('0x2c')][_0x844f('0x2d')]};});_0x5eb5ee[_0x844f('0x2e')]=_[_0x844f('0x29')](_0xeaa75e,_0x844f('0x28'));_0x5eb5ee[_0x844f('0x2f')]=_['keys'](_0x24c2cf[_0x844f('0x2f')]);_0x5eb5ee[_0x844f('0x30')]=_[_0x844f('0x31')](_0x5eb5ee['model'],_0x5eb5ee[_0x844f('0x2f')]);_0x251b24[_0x844f('0x32')]=_['intersection'](_0x5eb5ee['model'],qs['fields'](_0x24c2cf[_0x844f('0x2f')][_0x844f('0x33')]));_0x251b24['attributes']=_0x251b24['attributes'][_0x844f('0x34')]?_0x251b24[_0x844f('0x32')]:_0x5eb5ee[_0x844f('0x2e')];if(!_0x24c2cf[_0x844f('0x2f')][_0x844f('0x35')]('nolimit')){_0x251b24['limit']=qs[_0x844f('0x1f')](_0x24c2cf['query'][_0x844f('0x1f')]);_0x251b24['offset']=qs[_0x844f('0x36')](_0x24c2cf[_0x844f('0x2f')][_0x844f('0x36')]);}_0x251b24[_0x844f('0x37')]=qs[_0x844f('0x38')](_0x24c2cf[_0x844f('0x2f')]['sort']);_0x251b24[_0x844f('0x39')]=qs[_0x844f('0x30')](_['pick'](_0x24c2cf[_0x844f('0x2f')],_0x5eb5ee[_0x844f('0x30')]),_0xeaa75e);if(_0x24c2cf[_0x844f('0x2f')][_0x844f('0x3a')]){_0x251b24[_0x844f('0x39')]=_[_0x844f('0x3b')](_0x251b24[_0x844f('0x39')],{'$or':_['map'](_0xeaa75e,function(_0x282c6f){if(_0x282c6f[_0x844f('0x2c')]!=='VIRTUAL'){var _0x1645e0={};_0x1645e0[_0x282c6f[_0x844f('0x28')]]={'$like':'%'+_0x24c2cf[_0x844f('0x2f')][_0x844f('0x3a')]+'%'};return _0x1645e0;}})});}_0x251b24=_['merge']({},_0x251b24,_0x24c2cf[_0x844f('0x3c')]);var _0x305216={'where':_0x251b24[_0x844f('0x39')]};return db[_0x844f('0x3d')][_0x844f('0x20')](_0x305216)[_0x844f('0x24')](function(_0x3cb8a2){_0x1aa6c7[_0x844f('0x20')]=_0x3cb8a2;if(_0x24c2cf[_0x844f('0x2f')]['includeAll']){_0x251b24[_0x844f('0x3e')]=[{'all':!![]}];}return db[_0x844f('0x3d')][_0x844f('0x3f')](_0x251b24);})[_0x844f('0x24')](function(_0x18a84b){_0x1aa6c7[_0x844f('0x40')]=_0x18a84b;return _0x1aa6c7;})[_0x844f('0x24')](respondWithFilteredResult(_0x17abfd,_0x251b24))[_0x844f('0x1c')](handleError(_0x17abfd,null));};exports[_0x844f('0x41')]=function(_0x13a031,_0x56cd1d){var _0x47b684={'raw':!![],'where':{'id':_0x13a031['params']['id']}},_0x5a864c={};_0x5a864c[_0x844f('0x2e')]=_[_0x844f('0x42')](db[_0x844f('0x3d')][_0x844f('0x2a')]);_0x5a864c[_0x844f('0x2f')]=_[_0x844f('0x42')](_0x13a031[_0x844f('0x2f')]);_0x5a864c[_0x844f('0x30')]=_[_0x844f('0x31')](_0x5a864c[_0x844f('0x2e')],_0x5a864c[_0x844f('0x2f')]);_0x47b684[_0x844f('0x32')]=_['intersection'](_0x5a864c[_0x844f('0x2e')],qs['fields'](_0x13a031['query'][_0x844f('0x33')]));_0x47b684[_0x844f('0x32')]=_0x47b684[_0x844f('0x32')]['length']?_0x47b684[_0x844f('0x32')]:_0x5a864c[_0x844f('0x2e')];if(_0x13a031[_0x844f('0x2f')][_0x844f('0x43')]){_0x47b684['include']=[{'all':!![]}];}_0x47b684=_[_0x844f('0x3b')]({},_0x47b684,_0x13a031[_0x844f('0x3c')]);return db[_0x844f('0x3d')][_0x844f('0x44')](_0x47b684)[_0x844f('0x24')](handleEntityNotFound(_0x56cd1d,null))[_0x844f('0x24')](respondWithResult(_0x56cd1d,null))[_0x844f('0x1c')](handleError(_0x56cd1d,null));};exports['update']=function(_0x4ddc6b,_0x469a08){if(_0x4ddc6b['body']['id']){delete _0x4ddc6b[_0x844f('0x45')]['id'];}return db[_0x844f('0x3d')]['find']({'where':{'id':_0x4ddc6b[_0x844f('0x46')]['id']}})[_0x844f('0x24')](handleEntityNotFound(_0x469a08,null))['then'](saveUpdates(_0x4ddc6b[_0x844f('0x45')],null))[_0x844f('0x24')](respondWithResult(_0x469a08,null))['catch'](handleError(_0x469a08,null));};exports['destroy']=function(_0x4fa3ea,_0x599599){return db[_0x844f('0x3d')]['find']({'where':{'id':_0x4fa3ea[_0x844f('0x46')]['id']}})[_0x844f('0x24')](handleEntityNotFound(_0x599599,null))[_0x844f('0x24')](removeEntity(_0x599599,null))[_0x844f('0x1c')](handleError(_0x599599,null));};exports['describe']=function(_0x415f0f,_0x1a4d82){return db[_0x844f('0x3d')]['describe']()[_0x844f('0x24')](respondWithResult(_0x1a4d82,null))[_0x844f('0x1c')](handleError(_0x1a4d82,null));};exports[_0x844f('0x47')]=function(_0x1a6597,_0x46d60a){return db[_0x844f('0x3d')]['create'](_0x1a6597[_0x844f('0x45')])[_0x844f('0x24')](function(_0x13a206){if(_0x13a206){if(_0x13a206[_0x844f('0x48')]===_0x844f('0x49')&&!_0x13a206[_0x844f('0x4a')]){var _0x22b7c3,_0x562d2b,_0x15e54c;if(_0x1a6597[_0x844f('0x45')]['to']){_0x562d2b=_0x1a6597[_0x844f('0x45')]['to']['split'](',')[0x0];}return db[_0x844f('0x4b')]['findOne']({'where':{'id':_0x13a206[_0x844f('0x4c')]},'include':[{'model':db[_0x844f('0x4d')],'as':'List','include':[{'model':db[_0x844f('0x4e')],'as':_0x844f('0x4f'),'where':{'email':_0x562d2b},'limit':0x1,'order':[[_0x844f('0x50'),_0x844f('0x51')]]}]},{'model':db[_0x844f('0x52')],'as':_0x844f('0x53'),'raw':!![],'include':[{'model':db[_0x844f('0x54')],'as':'CloudProvider','raw':!![]}]}]})[_0x844f('0x24')](function(_0x4a3ebe){_0x22b7c3=_0x4a3ebe;if(!_0x22b7c3||!_0x22b7c3['Smtp'])return;var _0x414bb3=_0x22b7c3['getSmtpOptions']();if(_0x1a6597['body'][_0x844f('0x55')]&&_0x1a6597[_0x844f('0x45')][_0x844f('0x55')][_0x844f('0x34')]){for(var _0x572ee3=0x0;_0x572ee3<_0x1a6597[_0x844f('0x45')]['attachments'][_0x844f('0x34')];_0x572ee3+=0x1){_0x1a6597[_0x844f('0x45')]['attachments'][_0x572ee3]={'filename':_0x1a6597[_0x844f('0x45')][_0x844f('0x55')][_0x572ee3][_0x844f('0x28')],'path':path[_0x844f('0x56')](config[_0x844f('0x57')],_0x844f('0x58'),_0x1a6597[_0x844f('0x45')]['attachments'][_0x572ee3]['basename'])};}}_0x15e54c={'account':_0x414bb3,'message':_0x1a6597[_0x844f('0x45')]};return;})[_0x844f('0x24')](function(){if(_0x22b7c3[_0x844f('0x59')]){if(_0x22b7c3[_0x844f('0x59')][_0x844f('0x4f')][_0x844f('0x34')]){return _0x22b7c3[_0x844f('0x59')][_0x844f('0x4f')][0x0];}else{return db[_0x844f('0x4e')][_0x844f('0x47')](_['defaults'](_0x1a6597[_0x844f('0x45')],{'firstName':_0x1a6597[_0x844f('0x45')]['to'],'email':_0x1a6597[_0x844f('0x45')]['to'],'phone':_0x1a6597[_0x844f('0x45')]['to'],'ListId':_0x22b7c3[_0x844f('0x5a')]}));}}else{throw new Error(_0x844f('0x5b'));}})[_0x844f('0x24')](function(){if(_0x15e54c){return respondWithRpcPromise('SendMail',_0x844f('0x5c'),_0x15e54c,client9003)[_0x844f('0x24')](function(_0x212ce7){return _0x13a206[_0x844f('0x23')]({'read':!![],'messageId':_0x212ce7[_0x844f('0x5d')],'sentAt':moment()[_0x844f('0x5e')](_0x844f('0x5f'))});})[_0x844f('0x1c')](function(_0xf8e4b1){logger['error']('%s',JSON['stringify'](_0xf8e4b1));return _0x13a206;});}return _0x13a206;});}return _0x13a206;}})[_0x844f('0x24')](respondWithResult(_0x46d60a,0xc9))['catch'](handleError(_0x46d60a,null));};exports[_0x844f('0x60')]=function(_0xfda090,_0x12b7f0){var _0x30be77={'agent':{},'channel':_0x844f('0x61')};if(_0xfda090[_0x844f('0x45')]['id']){delete _0xfda090[_0x844f('0x45')]['id'];}_0xfda090['body'][_0x844f('0x62')]=!![];_0xfda090[_0x844f('0x45')][_0x844f('0x63')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0xfda090[_0x844f('0x45')][_0x844f('0x64')]=_0xfda090[_0x844f('0x45')]['UserId']||_0xfda090[_0x844f('0x65')]['id'];_0x30be77[_0x844f('0x66')]['id']=_0xfda090['body'][_0x844f('0x64')];return db[_0x844f('0x3d')][_0x844f('0x44')]({'where':{'id':_0xfda090['params']['id'],'UserId':null}})[_0x844f('0x24')](handleEntityNotFound(_0x12b7f0,null))['then'](saveUpdates(_0xfda090[_0x844f('0x45')],null))['then'](function(_0x63b0c3){if(_0x63b0c3){_0x30be77[_0x844f('0x1a')]=_0x63b0c3['get']({'plain':!![]});return db[_0x844f('0x67')][_0x844f('0x44')]({'where':{'id':_0x63b0c3['MailInteractionId']}});}return null;})[_0x844f('0x24')](handleEntityNotFound(_0x12b7f0,null))['then'](function(_0x227029){if(_0x227029){return _0x227029[_0x844f('0x23')]({'UserId':_0xfda090[_0x844f('0x45')][_0x844f('0x64')],'read1stAt':_[_0x844f('0x68')](_0x227029[_0x844f('0x69')])?moment()[_0x844f('0x5e')](_0x844f('0x5f')):undefined});}return null;})[_0x844f('0x24')](function(_0x358bef){if(_0x358bef){_0x30be77['interaction']=_0x358bef[_0x844f('0x6a')]({'plain':!![]});interaction_log[_0x844f('0x1b')](_0x844f('0x6b'),_0xfda090[_0x844f('0x65')]['id'],_0xfda090[_0x844f('0x65')]['name'],_0xfda090[_0x844f('0x65')]['role'],_0x30be77[_0x844f('0x6c')]['id'],_0xfda090[_0x844f('0x45')]?JSON[_0x844f('0x17')](_0xfda090[_0x844f('0x45')]):'null');return respondWithRpcPromise(_0x844f('0x6d'),_0x844f('0x6e'),_0x30be77);}return null;})[_0x844f('0x24')](function(_0x29667a){var _0x85c32c='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x29667a[_0x844f('0x1a')][_0x844f('0x6f')];return db[_0x844f('0x70')]['query'](_0x85c32c,{'type':db[_0x844f('0x71')][_0x844f('0x72')][_0x844f('0x73')],'raw':!![]})['then'](function(_0x88afbb){return _0x88afbb;});})[_0x844f('0x24')](function(_0x167f73){if(_0x167f73){_0x30be77[_0x844f('0x1a')][_0x844f('0x74')]=_0x167f73[0x0];if(!_0xfda090[_0x844f('0x45')]['UserId'])return;return db['User'][_0x844f('0x44')]({'where':{'id':_0xfda090[_0x844f('0x45')][_0x844f('0x64')],'role':_0x844f('0x66')},'attributes':['id',_0x844f('0x28'),_0x844f('0x75'),_0x844f('0x76'),_0x844f('0x77')],'raw':!![]});}return null;})[_0x844f('0x24')](function(_0x36fa6c){if(!_0x36fa6c)return null;_0x30be77[_0x844f('0x1a')][_0x844f('0x66')]=_0x36fa6c;return _0x30be77;})[_0x844f('0x24')](function(_0x5d5d53){if(_0x5d5d53){if(_0xfda090[_0x844f('0x45')][_0x844f('0x78')]){_0x30be77[_0x844f('0x1a')][_0x844f('0x79')]=util['format']('SIP/%s',_0xfda090[_0x844f('0x65')][_0x844f('0x28')]);_0x30be77[_0x844f('0x1a')][_0x844f('0x7a')]=_0x30be77[_0x844f('0x7a')];_0x30be77[_0x844f('0x1a')][_0x844f('0x7b')]=_0x30be77[_0x844f('0x7a')];_0x30be77[_0x844f('0x1a')]['event']=_0x844f('0x60');_0x30be77[_0x844f('0x1a')][_0x844f('0x45')]=htmlToText[_0x844f('0x7c')](_0x30be77[_0x844f('0x1a')][_0x844f('0x45')]);return respondWithRpcPromise(_0x844f('0x7d'),_0x844f('0x7d'),{'event':_0x844f('0x7e'),'message':_0x30be77['message']},client9002)[_0x844f('0x24')](function(){return _0x30be77;});}return _0x30be77;}return null;})[_0x844f('0x24')](respondWithResult(_0x12b7f0,null))[_0x844f('0x1c')](handleError(_0x12b7f0,null));};exports['reject']=function(_0x2d6379,_0xe33c40){var _0x29ebda={'agent':{},'channel':'mail'};if(_0x2d6379[_0x844f('0x45')]['id']){delete _0x2d6379[_0x844f('0x45')]['id'];}_0x2d6379[_0x844f('0x45')]['UserId']=_0x2d6379[_0x844f('0x45')][_0x844f('0x64')]||_0x2d6379['user']['id'];_0x29ebda[_0x844f('0x66')]['id']=_0x2d6379[_0x844f('0x45')][_0x844f('0x64')];return db[_0x844f('0x3d')]['find']({'where':{'id':_0x2d6379[_0x844f('0x46')]['id'],'UserId':null}})[_0x844f('0x24')](handleEntityNotFound(_0xe33c40,null))[_0x844f('0x24')](function(_0x50950f){if(_0x50950f){_0x29ebda[_0x844f('0x1a')]=_0x50950f[_0x844f('0x6a')]({'plain':!![]});return db[_0x844f('0x67')][_0x844f('0x44')]({'where':{'id':_0x50950f[_0x844f('0x7f')]}});}return null;})[_0x844f('0x24')](handleEntityNotFound(_0xe33c40,null))[_0x844f('0x24')](function(_0x15036c){if(_0x15036c){_0x29ebda['interaction']=_0x15036c[_0x844f('0x6a')]({'plain':!![]});interaction_log[_0x844f('0x1b')](_0x844f('0x80'),_0x2d6379[_0x844f('0x65')]['id'],_0x2d6379[_0x844f('0x65')][_0x844f('0x28')],_0x2d6379[_0x844f('0x65')][_0x844f('0x81')],_0x29ebda[_0x844f('0x6c')]['id'],_0x2d6379[_0x844f('0x45')]?JSON[_0x844f('0x17')](_0x2d6379[_0x844f('0x45')]):_0x844f('0x82'));return respondWithRpcPromise(_0x844f('0x83'),_0x844f('0x84'),_0x29ebda);}return null;})['then'](function(_0x17a4dd){var _0x589717='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x17a4dd['message'][_0x844f('0x6f')];return db['sequelize'][_0x844f('0x2f')](_0x589717,{'type':db['Sequelize']['QueryTypes'][_0x844f('0x73')],'raw':!![]})[_0x844f('0x24')](function(_0x4177b7){return _0x4177b7;});})['then'](function(_0x512c89){if(_0x512c89){_0x29ebda[_0x844f('0x1a')]['contact']=_0x512c89[0x0];if(!_0x2d6379[_0x844f('0x45')][_0x844f('0x64')])return;return db[_0x844f('0x85')]['find']({'where':{'id':_0x2d6379['body'][_0x844f('0x64')],'role':'agent'},'attributes':['id',_0x844f('0x28'),_0x844f('0x75'),_0x844f('0x76'),_0x844f('0x77')],'raw':!![]});}return null;})['then'](function(_0xce89ba){if(!_0xce89ba)return null;_0x29ebda[_0x844f('0x1a')][_0x844f('0x66')]=_0xce89ba;return _0x29ebda;})[_0x844f('0x24')](function(_0xbecbdf){if(_0xbecbdf){_0xbecbdf['message'][_0x844f('0x79')]=util[_0x844f('0x5e')](_0x844f('0x86'),_0x2d6379['user']['name']);_0xbecbdf[_0x844f('0x1a')][_0x844f('0x7a')]=_0x29ebda[_0x844f('0x7a')];_0xbecbdf['message']['motionChannel']=_0x29ebda[_0x844f('0x7a')];_0xbecbdf[_0x844f('0x1a')]['event']='reject';_0xbecbdf['message'][_0x844f('0x45')]=htmlToText[_0x844f('0x7c')](_0x29ebda[_0x844f('0x1a')][_0x844f('0x45')]);respondWithRpcPromise(_0x844f('0x7d'),'EventManager',{'event':_0x844f('0x87'),'message':_0xbecbdf['message']},client9002);return _0x29ebda;}return null;})['then'](respondWithResult(_0xe33c40,null))['catch'](handleError(_0xe33c40,null));};exports[_0x844f('0x88')]=function(_0x5d8341,_0x3a8bc2){var _0x5d6188=moment()['unix']()[_0x844f('0x89')]();var _0x1a7943=path['join'](config['root'],_0x844f('0x8a'),_0x844f('0x8b'),'tmp');var _0x17bd40=path[_0x844f('0x56')](config[_0x844f('0x57')],_0x844f('0x8a'),'files',_0x844f('0x55'));var _0x543a8c=util[_0x844f('0x5e')](_0x844f('0x8c'),_0x5d6188);return db[_0x844f('0x3d')][_0x844f('0x44')]({'where':{'id':_0x5d8341[_0x844f('0x46')]['id']},'attributes':['id',_0x844f('0x45'),'from','to','cc',_0x844f('0x8d'),_0x844f('0x8e'),'createdAt'],'include':_0x5d8341[_0x844f('0x2f')]['attachments']?[{'model':db[_0x844f('0x8f')],'as':_0x844f('0x90')}]:undefined})['then'](handleEntityNotFound(_0x3a8bc2,null))[_0x844f('0x24')](function(_0x380d29){if(_0x380d29){var _0x1392c1=_0x380d29;var _0x343dd3={'from':_0x1392c1[_0x844f('0x91')],'to':_0x1392c1['to'],'subject':_0x1392c1[_0x844f('0x8e')],'html':htmlEntities[_0x844f('0x92')](_0x1392c1[_0x844f('0x45')]),'headers':{'Date':moment(_0x1392c1[_0x844f('0x93')])[_0x844f('0x5e')](_0x844f('0x94'))},'attachments':[]};if(_0x380d29['cc']){_0x343dd3[_0x844f('0x95')]['Cc']=_0x380d29['cc'];}if(_0x380d29['bcc']){_0x343dd3['headers'][_0x844f('0x96')]=_0x380d29['bcc'];}return new BPromise(function(_0x336ac5,_0x35ebfc){if(_0x380d29['Attachments']){for(var _0x5b8771=0x0;_0x5b8771<_0x380d29[_0x844f('0x90')]['length'];_0x5b8771++){var _0x191c6f=_0x380d29[_0x844f('0x90')][_0x5b8771];var _0x3c6ecc=path['join'](_0x17bd40,_0x191c6f['basename']);if(fs['existsSync'](_0x3c6ecc)){_0x343dd3[_0x844f('0x55')]['push']({'name':_0x191c6f['name'],'contentType':_0x191c6f['type'],'data':fs[_0x844f('0x97')](_0x3c6ecc)});}}}emlformat[_0x844f('0x98')](_0x343dd3,function(_0x2a6dce,_0x153c28){if(_0x2a6dce)return _0x35ebfc(_0x2a6dce);fs[_0x844f('0x99')](path['join'](_0x1a7943,_0x543a8c),_0x153c28);return _0x336ac5(_0x153c28);});});}})['then'](function(_0x2251c5){if(_0x2251c5){return _0x3a8bc2[_0x844f('0x88')](path[_0x844f('0x56')](_0x1a7943,_0x543a8c),_0x543a8c,function(_0x5d18a0){if(!_0x5d18a0)fs[_0x844f('0x9a')](path[_0x844f('0x56')](_0x1a7943,_0x543a8c));});}})[_0x844f('0x1c')](handleError(_0x3a8bc2,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 683d878..5ea3e83 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 _0xa5d4=['save','update','remove','emit','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa5d4,0xf0));var _0x4a5d=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xa5d4[_0x1969a7];return _0x3d665f;};'use strict';var EventEmitter=require(_0x4a5d('0x0'));var MailMessage=require(_0x4a5d('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x4a5d('0x2')](0x0);var events={'afterCreate':_0x4a5d('0x3'),'afterUpdate':_0x4a5d('0x4'),'afterDestroy':_0x4a5d('0x5')};function emitEvent(_0x59f81a){return function(_0x2976d8,_0xbfc0f1,_0x957cca){MailMessageEvents[_0x4a5d('0x6')](_0x59f81a+':'+_0x2976d8['id'],_0x2976d8);MailMessageEvents['emit'](_0x59f81a,_0x2976d8);_0x957cca(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x4a5d('0x7')](e,emitEvent(event));}}module[_0x4a5d('0x8')]=MailMessageEvents; \ No newline at end of file +var _0x0cdf=['update','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','save'];(function(_0x4fdd95,_0x54fb7e){var _0x178524=function(_0x9f6fa9){while(--_0x9f6fa9){_0x4fdd95['push'](_0x4fdd95['shift']());}};_0x178524(++_0x54fb7e);}(_0x0cdf,0x93));var _0xf0cd=function(_0x5d2507,_0x556fac){_0x5d2507=_0x5d2507-0x0;var _0x198c07=_0x0cdf[_0x5d2507];return _0x198c07;};'use strict';var EventEmitter=require(_0xf0cd('0x0'));var MailMessage=require(_0xf0cd('0x1'))['db'][_0xf0cd('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xf0cd('0x3')](0x0);var events={'afterCreate':_0xf0cd('0x4'),'afterUpdate':_0xf0cd('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3e41e7){return function(_0x2ae652,_0x4819f2,_0x5e522b){MailMessageEvents['emit'](_0x3e41e7+':'+_0x2ae652['id'],_0x2ae652);MailMessageEvents['emit'](_0x3e41e7,_0x2ae652);_0x5e522b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0xf0cd('0x6')](e,emitEvent(event));}}module[_0xf0cd('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 39cb401..4a57cf4 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 _0xe1f0=['out','secret','MailInteraction','findOne','MailInteractionId','then','update','createdAt','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','FULLTEXT','body','models','get','toLowerCase','direction'];(function(_0x112db5,_0x38a06d){var _0x1d7d06=function(_0x44571e){while(--_0x44571e){_0x112db5['push'](_0x112db5['shift']());}};_0x1d7d06(++_0x38a06d);}(_0xe1f0,0x140));var _0x0e1f=function(_0x49c53f,_0x4fe57b){_0x49c53f=_0x49c53f-0x0;var _0x4d5d13=_0xe1f0[_0x49c53f];return _0x4d5d13;};'use strict';var _=require(_0x0e1f('0x0'));var util=require('util');var logger=require(_0x0e1f('0x1'))(_0x0e1f('0x2'));var moment=require(_0x0e1f('0x3'));var BPromise=require(_0x0e1f('0x4'));var rp=require(_0x0e1f('0x5'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x0e1f('0x6'));var rimraf=require(_0x0e1f('0x7'));var config=require(_0x0e1f('0x8'));var attributes=require(_0x0e1f('0x9'));module[_0x0e1f('0xa')]=function(_0x11cdb0,_0x49a8f7){return _0x11cdb0[_0x0e1f('0xb')](_0x0e1f('0xc'),attributes,{'tableName':_0x0e1f('0xd'),'paranoid':![],'indexes':[{'name':_0x0e1f('0xe'),'fields':[_0x0e1f('0xe')]},{'name':'fti_mail_messages','fields':['plainBody','subject'],'type':_0x0e1f('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x27a23b,_0xde3e86,_0x13c014){if(_0x27a23b['body']){_0x27a23b['plainBody']=htmlToText['fromString'](_0x27a23b[_0x0e1f('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x13c014(null,_0xde3e86);},'afterCreate':function(_0x46e72a,_0x33be04,_0x4b8bb6){var _0x52dcaf=_0x11cdb0[_0x0e1f('0x11')];var _0x1d3a1c=_0x46e72a[_0x0e1f('0x12')]({'plain':!![]});if(_0x1d3a1c['direction'][_0x0e1f('0x13')]()==='in'||_0x1d3a1c[_0x0e1f('0x14')][_0x0e1f('0x13')]()===_0x0e1f('0x15')&&!_0x1d3a1c[_0x0e1f('0x16')]&&!_['isNil'](_0x1d3a1c['UserId'])){_0x52dcaf[_0x0e1f('0x17')][_0x0e1f('0x18')]({'where':{'id':_0x1d3a1c[_0x0e1f('0x19')]}})[_0x0e1f('0x1a')](function(_0x2bd625){if(_0x2bd625){_0x2bd625[_0x0e1f('0x1b')]({'lastMsgAt':_0x1d3a1c[_0x0e1f('0x1c')],'lastMsgDirection':_0x1d3a1c['direction'][_0x0e1f('0x13')]()});}})['catch'](function(_0x29c05e){console['error'](_0x29c05e);});}_0x4b8bb6();}},'charset':_0x0e1f('0x1d'),'collate':_0x0e1f('0x1e')});}; \ No newline at end of file +var _0xc6b5=['out','secret','isNil','MailInteraction','then','update','createdAt','catch','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','get','direction','toLowerCase'];(function(_0x1785c4,_0x9cfa67){var _0x4734c7=function(_0x45f542){while(--_0x45f542){_0x1785c4['push'](_0x1785c4['shift']());}};_0x4734c7(++_0x9cfa67);}(_0xc6b5,0x149));var _0x5c6b=function(_0x538553,_0x34456a){_0x538553=_0x538553-0x0;var _0x4ae1bd=_0xc6b5[_0x538553];return _0x4ae1bd;};'use strict';var _=require(_0x5c6b('0x0'));var util=require('util');var logger=require(_0x5c6b('0x1'))(_0x5c6b('0x2'));var moment=require(_0x5c6b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var htmlToText=require(_0x5c6b('0x4'));var fs=require('fs');var path=require(_0x5c6b('0x5'));var rimraf=require(_0x5c6b('0x6'));var config=require(_0x5c6b('0x7'));var attributes=require(_0x5c6b('0x8'));module[_0x5c6b('0x9')]=function(_0x16f7d2,_0x40ebb4){return _0x16f7d2[_0x5c6b('0xa')](_0x5c6b('0xb'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x5c6b('0xc'),'fields':[_0x5c6b('0xc')]},{'name':_0x5c6b('0xd'),'fields':[_0x5c6b('0xe'),_0x5c6b('0xf')],'type':_0x5c6b('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x551c46,_0xd63b39,_0x547153){if(_0x551c46[_0x5c6b('0x11')]){_0x551c46['plainBody']=htmlToText[_0x5c6b('0x12')](_0x551c46[_0x5c6b('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x547153(null,_0xd63b39);},'afterCreate':function(_0x1e1bb8,_0x2a87ea,_0x35b028){var _0x10100e=_0x16f7d2[_0x5c6b('0x13')];var _0x2c0152=_0x1e1bb8[_0x5c6b('0x14')]({'plain':!![]});if(_0x2c0152[_0x5c6b('0x15')]['toLowerCase']()==='in'||_0x2c0152[_0x5c6b('0x15')][_0x5c6b('0x16')]()===_0x5c6b('0x17')&&!_0x2c0152[_0x5c6b('0x18')]&&!_[_0x5c6b('0x19')](_0x2c0152['UserId'])){_0x10100e[_0x5c6b('0x1a')]['findOne']({'where':{'id':_0x2c0152['MailInteractionId']}})[_0x5c6b('0x1b')](function(_0x14e0c1){if(_0x14e0c1){_0x14e0c1[_0x5c6b('0x1c')]({'lastMsgAt':_0x2c0152[_0x5c6b('0x1d')],'lastMsgDirection':_0x2c0152[_0x5c6b('0x15')][_0x5c6b('0x16')]()});}})[_0x5c6b('0x1e')](function(_0x3c4530){console['error'](_0x3c4530);});}_0x35b028();}},'charset':'utf8mb4','collate':_0x5c6b('0x1f')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 5b62642..2045557 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 _0xdd4f=['request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateMailMessage','MailMessage','create','body','options','raw','lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s'];(function(_0x19d350,_0x3c843f){var _0x3bfc8d=function(_0xd89003){while(--_0xd89003){_0x19d350['push'](_0x19d350['shift']());}};_0x3bfc8d(++_0x3c843f);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x18a1d5,_0x30d026){_0x18a1d5=_0x18a1d5-0x0;var _0x151e11=_0xdd4f[_0x18a1d5];return _0x151e11;};'use strict';var _=require(_0xfdd4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfdd4('0x1'));var fs=require('fs');var Redis=require(_0xfdd4('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xfdd4('0x3'));var logger=require(_0xfdd4('0x4'))(_0xfdd4('0x5'));var config=require('../../config/environment');var jayson=require(_0xfdd4('0x6'));var client=jayson[_0xfdd4('0x7')][_0xfdd4('0x8')]({'port':0x232a});config[_0xfdd4('0x9')]=_[_0xfdd4('0xa')](config['redis'],{'host':_0xfdd4('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfdd4('0x9')]));require(_0xfdd4('0xc'))[_0xfdd4('0xd')](socket);function respondWithRpcPromise(_0x4ee02f,_0x3d06c9,_0x4b4f1d){return new BPromise(function(_0x27a9f3,_0x3ce77a){return client[_0xfdd4('0xe')](_0x4ee02f,_0x4b4f1d)[_0xfdd4('0xf')](function(_0x35e22d){logger[_0xfdd4('0x10')](_0xfdd4('0x11'),_0x3d06c9,_0xfdd4('0x12'));logger[_0xfdd4('0x13')](_0xfdd4('0x14'),_0x3d06c9,_0xfdd4('0x12'),JSON['stringify'](_0x35e22d));if(_0x35e22d[_0xfdd4('0x15')]){if(_0x35e22d[_0xfdd4('0x15')][_0xfdd4('0x16')]===0x1f4){logger['error'](_0xfdd4('0x11'),_0x3d06c9,_0x35e22d['error'][_0xfdd4('0x17')]);return _0x3ce77a(_0x35e22d[_0xfdd4('0x15')][_0xfdd4('0x17')]);}logger[_0xfdd4('0x15')](_0xfdd4('0x11'),_0x3d06c9,_0x35e22d['error']['message']);return _0x27a9f3(_0x35e22d['error'][_0xfdd4('0x17')]);}else{logger[_0xfdd4('0x10')](_0xfdd4('0x11'),_0x3d06c9,_0xfdd4('0x12'));_0x27a9f3(_0x35e22d[_0xfdd4('0x18')][_0xfdd4('0x17')]);}})[_0xfdd4('0x19')](function(_0x2ffd5f){logger[_0xfdd4('0x15')]('MailMessage,\x20%s,\x20%s',_0x3d06c9,_0x2ffd5f);_0x3ce77a(_0x2ffd5f);});});}exports[_0xfdd4('0x1a')]=function(_0x3e8eac){var _0x2dc51c=this;return new Promise(function(_0x36e611,_0x1454f1){return db[_0xfdd4('0x1b')][_0xfdd4('0x1c')](_0x3e8eac[_0xfdd4('0x1d')],{'raw':_0x3e8eac['options']?_0x3e8eac[_0xfdd4('0x1e')][_0xfdd4('0x1f')]===undefined?!![]:![]:!![]})[_0xfdd4('0xf')](function(_0x16e81b){logger[_0xfdd4('0x10')](_0xfdd4('0x1a'),_0x3e8eac);logger[_0xfdd4('0x13')](_0xfdd4('0x1a'),_0x3e8eac,JSON['stringify'](_0x16e81b));_0x36e611(_0x16e81b);})[_0xfdd4('0x19')](function(_0x1112e8){logger[_0xfdd4('0x15')]('CreateMailMessage',_0x1112e8[_0xfdd4('0x17')],_0x3e8eac);_0x1454f1(_0x2dc51c[_0xfdd4('0x15')](0x1f4,_0x1112e8[_0xfdd4('0x17')]));});});}; \ No newline at end of file +var _0xd943=['CreateMailMessage','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','localhost','./mailMessage.socket','register','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','MailMessage','options','raw'];(function(_0x17fa38,_0x4ac40d){var _0x140aa2=function(_0x151362){while(--_0x151362){_0x17fa38['push'](_0x17fa38['shift']());}};_0x140aa2(++_0x4ac40d);}(_0xd943,0x15d));var _0x3d94=function(_0x205dfe,_0x48d5d7){_0x205dfe=_0x205dfe-0x0;var _0x585b99=_0xd943[_0x205dfe];return _0x585b99;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));var BPromise=require(_0x3d94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d94('0x4'));var db=require(_0x3d94('0x5'))['db'];var utils=require(_0x3d94('0x6'));var logger=require(_0x3d94('0x7'))(_0x3d94('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d94('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x3d94('0xa')],{'host':_0x3d94('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3d94('0xc'))[_0x3d94('0xd')](socket);function respondWithRpcPromise(_0x1cc58c,_0x5908a7,_0x182066){return new BPromise(function(_0x4ac968,_0x39e2fa){return client[_0x3d94('0xe')](_0x1cc58c,_0x182066)['then'](function(_0x1897de){logger[_0x3d94('0xf')](_0x3d94('0x10'),_0x5908a7,_0x3d94('0x11'));logger[_0x3d94('0x12')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x5908a7,_0x3d94('0x11'),JSON[_0x3d94('0x13')](_0x1897de));if(_0x1897de[_0x3d94('0x14')]){if(_0x1897de['error'][_0x3d94('0x15')]===0x1f4){logger[_0x3d94('0x14')](_0x3d94('0x10'),_0x5908a7,_0x1897de['error'][_0x3d94('0x16')]);return _0x39e2fa(_0x1897de[_0x3d94('0x14')][_0x3d94('0x16')]);}logger[_0x3d94('0x14')](_0x3d94('0x10'),_0x5908a7,_0x1897de[_0x3d94('0x14')][_0x3d94('0x16')]);return _0x4ac968(_0x1897de[_0x3d94('0x14')]['message']);}else{logger[_0x3d94('0xf')](_0x3d94('0x10'),_0x5908a7,_0x3d94('0x11'));_0x4ac968(_0x1897de[_0x3d94('0x17')][_0x3d94('0x16')]);}})[_0x3d94('0x18')](function(_0xef8b3){logger['error'](_0x3d94('0x10'),_0x5908a7,_0xef8b3);_0x39e2fa(_0xef8b3);});});}exports['CreateMailMessage']=function(_0x28bead){var _0x193934=this;return new Promise(function(_0x16a6d0,_0x1e9ec2){return db[_0x3d94('0x19')]['create'](_0x28bead['body'],{'raw':_0x28bead[_0x3d94('0x1a')]?_0x28bead[_0x3d94('0x1a')][_0x3d94('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x30af25){logger[_0x3d94('0xf')](_0x3d94('0x1c'),_0x28bead);logger[_0x3d94('0x12')](_0x3d94('0x1c'),_0x28bead,JSON[_0x3d94('0x13')](_0x30af25));_0x16a6d0(_0x30af25);})[_0x3d94('0x18')](function(_0x27f978){logger[_0x3d94('0x14')](_0x3d94('0x1c'),_0x27f978[_0x3d94('0x16')],_0x28bead);_0x1e9ec2(_0x193934[_0x3d94('0x14')](0x1f4,_0x27f978[_0x3d94('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 9870332..260ec08 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 _0x00bb=['removeListener','length','mailMessage:','./mailMessage.events','save','remove','emit'];(function(_0x187499,_0x5e416a){var _0x2965fe=function(_0xc6645e){while(--_0xc6645e){_0x187499['push'](_0x187499['shift']());}};_0x2965fe(++_0x5e416a);}(_0x00bb,0x1d8));var _0xb00b=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x00bb[_0x550d12];return _0x12103d;};'use strict';var MailMessageEvents=require(_0xb00b('0x0'));var events=[_0xb00b('0x1'),_0xb00b('0x2'),'update'];function createListener(_0x170f94,_0x47a3bf){return function(_0x278c5e){_0x47a3bf[_0xb00b('0x3')](_0x170f94,_0x278c5e);};}function removeListener(_0x582ef9,_0x14b5d0){return function(){MailMessageEvents[_0xb00b('0x4')](_0x582ef9,_0x14b5d0);};}exports['register']=function(_0x574cf8){for(var _0x532ffb=0x0,_0x36e363=events[_0xb00b('0x5')];_0x532ffb<_0x36e363;_0x532ffb++){var _0x41dfc9=events[_0x532ffb];var _0x37f07d=createListener(_0xb00b('0x6')+_0x41dfc9,_0x574cf8);MailMessageEvents['on'](_0x41dfc9,_0x37f07d);}}; \ No newline at end of file +var _0xca04=['remove','removeListener','length','mailMessage:','./mailMessage.events'];(function(_0xc01434,_0x455766){var _0x138542=function(_0x4fcfca){while(--_0x4fcfca){_0xc01434['push'](_0xc01434['shift']());}};_0x138542(++_0x455766);}(_0xca04,0xa4));var _0x4ca0=function(_0x241656,_0x3a7475){_0x241656=_0x241656-0x0;var _0x4cf2ff=_0xca04[_0x241656];return _0x4cf2ff;};'use strict';var MailMessageEvents=require(_0x4ca0('0x0'));var events=['save',_0x4ca0('0x1'),'update'];function createListener(_0x55ddae,_0x2645cf){return function(_0x7fa3e1){_0x2645cf['emit'](_0x55ddae,_0x7fa3e1);};}function removeListener(_0x55c792,_0xfedfad){return function(){MailMessageEvents[_0x4ca0('0x2')](_0x55c792,_0xfedfad);};}exports['register']=function(_0x5c8a12){for(var _0x2f98c1=0x0,_0x4c6d3d=events[_0x4ca0('0x3')];_0x2f98c1<_0x4c6d3d;_0x2f98c1++){var _0x51cc84=events[_0x2f98c1];var _0x3e19e3=createListener(_0x4ca0('0x4')+_0x51cc84,_0x5c8a12);MailMessageEvents['on'](_0x51cc84,_0x3e19e3);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index ea4f3ee..f966989 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 _0x3f59=['../../components/auth/service','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','destroy','delete','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x48dbe0,_0x382761){var _0x412c2c=function(_0xed449a){while(--_0xed449a){_0x48dbe0['push'](_0x48dbe0['shift']());}};_0x412c2c(++_0x382761);}(_0x3f59,0xd9));var _0x93f5=function(_0x4c6c7f,_0x5d4f71){_0x4c6c7f=_0x4c6c7f-0x0;var _0xbfb573=_0x3f59[_0x4c6c7f];return _0xbfb573;};'use strict';var multer=require(_0x93f5('0x0'));var util=require(_0x93f5('0x1'));var path=require(_0x93f5('0x2'));var timeout=require(_0x93f5('0x3'));var express=require(_0x93f5('0x4'));var router=express[_0x93f5('0x5')]();var fs_extra=require(_0x93f5('0x6'));var auth=require(_0x93f5('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x93f5('0x8'));router[_0x93f5('0x9')]('/',auth[_0x93f5('0xa')](),controller[_0x93f5('0xb')]);router[_0x93f5('0x9')](_0x93f5('0xc'),auth[_0x93f5('0xa')](),controller[_0x93f5('0xd')]);router[_0x93f5('0x9')](_0x93f5('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x93f5('0x9')](_0x93f5('0xf'),auth[_0x93f5('0xa')](),controller['getMembers']);router[_0x93f5('0x9')](_0x93f5('0x10'),auth[_0x93f5('0xa')](),controller[_0x93f5('0x11')]);router[_0x93f5('0x9')](_0x93f5('0x12'),auth[_0x93f5('0xa')](),controller[_0x93f5('0x13')]);router[_0x93f5('0x14')]('/',auth[_0x93f5('0xa')](),controller['create']);router[_0x93f5('0x14')](_0x93f5('0x10'),auth[_0x93f5('0xa')](),controller[_0x93f5('0x15')]);router['post'](_0x93f5('0x12'),auth[_0x93f5('0xa')](),controller[_0x93f5('0x16')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x93f5('0x17')]);router['delete'](_0x93f5('0xe'),auth[_0x93f5('0xa')](),controller[_0x93f5('0x18')]);router[_0x93f5('0x19')]('/:id/teams',auth[_0x93f5('0xa')](),controller['removeTeams']);router[_0x93f5('0x19')]('/:id/users',auth[_0x93f5('0xa')](),controller[_0x93f5('0x1a')]);module[_0x93f5('0x1b')]=router; \ No newline at end of file +var _0x7793=['destroy','delete','exports','multer','path','express','Router','../../components/interaction/service','../../config/environment','/describe','get','isAuthenticated','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','create','post','addAgents','put','/:id','update'];(function(_0x150cea,_0x4581ed){var _0xceda08=function(_0x23da51){while(--_0x23da51){_0x150cea['push'](_0x150cea['shift']());}};_0xceda08(++_0x4581ed);}(_0x7793,0x13b));var _0x3779=function(_0x481046,_0x10d606){_0x481046=_0x481046-0x0;var _0x999d0b=_0x7793[_0x481046];return _0x999d0b;};'use strict';var multer=require(_0x3779('0x0'));var util=require('util');var path=require(_0x3779('0x1'));var timeout=require('connect-timeout');var express=require(_0x3779('0x2'));var router=express[_0x3779('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3779('0x4'));var config=require(_0x3779('0x5'));var controller=require('./mailQueue.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x3779('0x6'),auth['isAuthenticated'](),controller['describe']);router[_0x3779('0x7')]('/:id',auth[_0x3779('0x8')](),controller[_0x3779('0x9')]);router[_0x3779('0x7')](_0x3779('0xa'),auth['isAuthenticated'](),controller[_0x3779('0xb')]);router['get'](_0x3779('0xc'),auth['isAuthenticated'](),controller['getTeams']);router[_0x3779('0x7')](_0x3779('0xd'),auth[_0x3779('0x8')](),controller[_0x3779('0xe')]);router['post']('/',auth[_0x3779('0x8')](),controller[_0x3779('0xf')]);router['post'](_0x3779('0xc'),auth[_0x3779('0x8')](),controller['addTeams']);router[_0x3779('0x10')]('/:id/users',auth[_0x3779('0x8')](),controller[_0x3779('0x11')]);router[_0x3779('0x12')](_0x3779('0x13'),auth[_0x3779('0x8')](),controller[_0x3779('0x14')]);router['delete']('/:id',auth[_0x3779('0x8')](),controller[_0x3779('0x15')]);router['delete'](_0x3779('0xc'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x3779('0x16')](_0x3779('0xd'),auth[_0x3779('0x8')](),controller['removeAgents']);module[_0x3779('0x17')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 0c7c1b7..a288bab 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 _0xa092=['STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x5ad07c,_0x324dcd){var _0x204bae=function(_0x1245bc){while(--_0x1245bc){_0x5ad07c['push'](_0x5ad07c['shift']());}};_0x204bae(++_0x324dcd);}(_0xa092,0x7c));var _0x2a09=function(_0x31fb16,_0x3a4f55){_0x31fb16=_0x31fb16-0x0;var _0x50f4b7=_0xa092[_0x31fb16];return _0x50f4b7;};'use strict';var Sequelize=require(_0x2a09('0x0'));module[_0x2a09('0x1')]={'name':{'type':Sequelize[_0x2a09('0x2')],'unique':_0x2a09('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2a09('0x2')]},'timeout':{'type':Sequelize[_0x2a09('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2a09('0x5')](_0x2a09('0x6'),_0x2a09('0x7'),_0x2a09('0x8'))}}; \ No newline at end of file +var _0x0e39=['name','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x3a9d2b,_0x4a754d){var _0x50dff9=function(_0x300429){while(--_0x300429){_0x3a9d2b['push'](_0x3a9d2b['shift']());}};_0x50dff9(++_0x4a754d);}(_0x0e39,0x13f));var _0x90e3=function(_0x5c6f37,_0x53bc84){_0x5c6f37=_0x5c6f37-0x0;var _0x4ae388=_0x0e39[_0x5c6f37];return _0x4ae388;};'use strict';var Sequelize=require(_0x90e3('0x0'));module[_0x90e3('0x1')]={'name':{'type':Sequelize[_0x90e3('0x2')],'unique':_0x90e3('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x90e3('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x90e3('0x4'),_0x90e3('0x5'),_0x90e3('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index db2dfdf..7a91d3f 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 _0x5c7c=['length','nolimit','order','where','pick','filter','merge','VIRTUAL','MailQueue','includeAll','include','findAll','rows','catch','show','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','UserMailQueue','hasOwnProperty','sort','MailQueueId','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','online','flatMap','Agents','sequelize','transaction','each','forEach','emit','userMailQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','isEmpty','removeAgents','addAgents','omit','spread','isArray','userMailQueue:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','update','then','destroy','get','MailQueues','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','attributes','model','fields'];(function(_0x2e8050,_0x2cdac7){var _0x28196d=function(_0x376e79){while(--_0x376e79){_0x2e8050['push'](_0x2e8050['shift']());}};_0x28196d(++_0x2cdac7);}(_0x5c7c,0xe2));var _0xc5c7=function(_0x444199,_0x1acd8f){_0x444199=_0x444199-0x0;var _0x56cfc8=_0x5c7c[_0x444199];return _0x56cfc8;};'use strict';var emlformat=require(_0xc5c7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc5c7('0x1'));var jsonpatch=require(_0xc5c7('0x2'));var rp=require(_0xc5c7('0x3'));var moment=require(_0xc5c7('0x4'));var BPromise=require(_0xc5c7('0x5'));var Mustache=require('mustache');var util=require(_0xc5c7('0x6'));var path=require(_0xc5c7('0x7'));var sox=require(_0xc5c7('0x8'));var csv=require('to-csv');var ejs=require(_0xc5c7('0x9'));var fs=require('fs');var fs_extra=require(_0xc5c7('0xa'));var _=require(_0xc5c7('0xb'));var squel=require(_0xc5c7('0xc'));var crypto=require(_0xc5c7('0xd'));var jsforce=require(_0xc5c7('0xe'));var deskjs=require(_0xc5c7('0xf'));var toCsv=require(_0xc5c7('0x10'));var querystring=require(_0xc5c7('0x11'));var Papa=require(_0xc5c7('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc5c7('0x13'));var as=require(_0xc5c7('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xc5c7('0x15'));var config=require(_0xc5c7('0x16'));var licenseUtil=require(_0xc5c7('0x17'));var db=require(_0xc5c7('0x18'))['db'];config[_0xc5c7('0x19')]=_[_0xc5c7('0x1a')](config[_0xc5c7('0x19')],{'host':_0xc5c7('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc5c7('0x19')]));require('./mailQueue.socket')[_0xc5c7('0x1c')](socket);function respondWithStatusCode(_0x236e08,_0x387b84){_0x387b84=_0x387b84||0xcc;return function(_0x41c0a9){if(_0x41c0a9){return _0x236e08[_0xc5c7('0x1d')](_0x387b84);}return _0x236e08[_0xc5c7('0x1e')](_0x387b84)[_0xc5c7('0x1f')]();};}function respondWithResult(_0x137eaf,_0x4cb1fc){_0x4cb1fc=_0x4cb1fc||0xc8;return function(_0x8229c2){if(_0x8229c2){return _0x137eaf[_0xc5c7('0x1e')](_0x4cb1fc)[_0xc5c7('0x20')](_0x8229c2);}};}function respondWithFilteredResult(_0x51cb6a,_0x5ab50b){return function(_0x1db6b3){if(_0x1db6b3){var _0x22b6f0=typeof _0x5ab50b[_0xc5c7('0x21')]==='undefined'&&typeof _0x5ab50b[_0xc5c7('0x22')]===_0xc5c7('0x23');var _0x1edcde=_0x1db6b3['count'];var _0xb28d48=_0x22b6f0?0x0:_0x5ab50b[_0xc5c7('0x21')];var _0x4745a6=_0x22b6f0?_0x1db6b3[_0xc5c7('0x24')]:_0x5ab50b[_0xc5c7('0x21')]+_0x5ab50b[_0xc5c7('0x22')];var _0x2118ae;if(_0x4745a6>=_0x1edcde){_0x4745a6=_0x1edcde;_0x2118ae=0xc8;}else{_0x2118ae=0xce;}_0x51cb6a[_0xc5c7('0x1e')](_0x2118ae);return _0x51cb6a['set'](_0xc5c7('0x25'),_0xb28d48+'-'+_0x4745a6+'/'+_0x1edcde)['json'](_0x1db6b3);}return null;};}function patchUpdates(_0x26e6cf){return function(_0x98cdd){try{jsonpatch[_0xc5c7('0x26')](_0x98cdd,_0x26e6cf,!![]);}catch(_0x3d1c01){return BPromise['reject'](_0x3d1c01);}return _0x98cdd[_0xc5c7('0x27')]();};}function saveUpdates(_0x1d18a7,_0x5f5ec7){return function(_0x27ddd5){if(_0x27ddd5){return _0x27ddd5[_0xc5c7('0x28')](_0x1d18a7)[_0xc5c7('0x29')](function(_0x48a623){return _0x48a623;});}return null;};}function removeEntity(_0x5279e4,_0x532ec4){return function(_0x3cbe3b){if(_0x3cbe3b){return _0x3cbe3b[_0xc5c7('0x2a')]()[_0xc5c7('0x29')](function(){var _0x4a509e=_0x3cbe3b[_0xc5c7('0x2b')]({'plain':!![]});var _0x15c259=_0xc5c7('0x2c');return db['UserProfileResource'][_0xc5c7('0x2a')]({'where':{'type':_0x15c259,'resourceId':_0x4a509e['id']}})[_0xc5c7('0x29')](function(){return _0x3cbe3b;});})[_0xc5c7('0x29')](function(){_0x5279e4[_0xc5c7('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x483e0f,_0x13ff18){return function(_0x2b36ee){if(!_0x2b36ee){_0x483e0f[_0xc5c7('0x1d')](0x194);}return _0x2b36ee;};}function handleError(_0x57ac20,_0x42dc2d){_0x42dc2d=_0x42dc2d||0x1f4;return function(_0x190855){logger[_0xc5c7('0x2d')](_0x190855[_0xc5c7('0x2e')]);if(_0x190855[_0xc5c7('0x2f')]){delete _0x190855[_0xc5c7('0x2f')];}_0x57ac20[_0xc5c7('0x1e')](_0x42dc2d)[_0xc5c7('0x30')](_0x190855);};}exports[_0xc5c7('0x31')]=function(_0x197e07,_0x55ddd7){var _0xb5ded1={},_0x454fb8={},_0x475187={'count':0x0,'rows':[]};var _0xd8f0d9=_[_0xc5c7('0x32')](db['MailQueue'][_0xc5c7('0x33')],function(_0x5d1181){return{'name':_0x5d1181[_0xc5c7('0x34')],'type':_0x5d1181[_0xc5c7('0x35')][_0xc5c7('0x36')]};});_0x454fb8['model']=_[_0xc5c7('0x32')](_0xd8f0d9,_0xc5c7('0x2f'));_0x454fb8['query']=_[_0xc5c7('0x37')](_0x197e07[_0xc5c7('0x38')]);_0x454fb8[_0xc5c7('0x39')]=_[_0xc5c7('0x3a')](_0x454fb8['model'],_0x454fb8[_0xc5c7('0x38')]);_0xb5ded1[_0xc5c7('0x3b')]=_['intersection'](_0x454fb8[_0xc5c7('0x3c')],qs[_0xc5c7('0x3d')](_0x197e07[_0xc5c7('0x38')][_0xc5c7('0x3d')]));_0xb5ded1[_0xc5c7('0x3b')]=_0xb5ded1[_0xc5c7('0x3b')][_0xc5c7('0x3e')]?_0xb5ded1[_0xc5c7('0x3b')]:_0x454fb8[_0xc5c7('0x3c')];if(!_0x197e07['query']['hasOwnProperty'](_0xc5c7('0x3f'))){_0xb5ded1[_0xc5c7('0x22')]=qs['limit'](_0x197e07[_0xc5c7('0x38')][_0xc5c7('0x22')]);_0xb5ded1[_0xc5c7('0x21')]=qs['offset'](_0x197e07['query'][_0xc5c7('0x21')]);}_0xb5ded1[_0xc5c7('0x40')]=qs['sort'](_0x197e07[_0xc5c7('0x38')]['sort']);_0xb5ded1[_0xc5c7('0x41')]=qs[_0xc5c7('0x39')](_[_0xc5c7('0x42')](_0x197e07[_0xc5c7('0x38')],_0x454fb8[_0xc5c7('0x39')]),_0xd8f0d9);if(_0x197e07[_0xc5c7('0x38')][_0xc5c7('0x43')]){_0xb5ded1[_0xc5c7('0x41')]=_[_0xc5c7('0x44')](_0xb5ded1[_0xc5c7('0x41')],{'$or':_[_0xc5c7('0x32')](_0xd8f0d9,function(_0x19ac99){if(_0x19ac99[_0xc5c7('0x35')]!==_0xc5c7('0x45')){var _0x216a52={};_0x216a52[_0x19ac99['name']]={'$like':'%'+_0x197e07[_0xc5c7('0x38')][_0xc5c7('0x43')]+'%'};return _0x216a52;}})});}_0xb5ded1=_[_0xc5c7('0x44')]({},_0xb5ded1,_0x197e07['options']);var _0x7bf271={'where':_0xb5ded1['where']};return db[_0xc5c7('0x46')]['count'](_0x7bf271)[_0xc5c7('0x29')](function(_0x514a5b){_0x475187[_0xc5c7('0x24')]=_0x514a5b;if(_0x197e07[_0xc5c7('0x38')][_0xc5c7('0x47')]){_0xb5ded1[_0xc5c7('0x48')]=[{'all':!![]}];}return db[_0xc5c7('0x46')][_0xc5c7('0x49')](_0xb5ded1);})['then'](function(_0x3afe97){_0x475187[_0xc5c7('0x4a')]=_0x3afe97;return _0x475187;})['then'](respondWithFilteredResult(_0x55ddd7,_0xb5ded1))[_0xc5c7('0x4b')](handleError(_0x55ddd7,null));};exports[_0xc5c7('0x4c')]=function(_0x5a8b31,_0x2337a8){var _0x3758b9={'raw':!![],'where':{'id':_0x5a8b31['params']['id']}},_0x1e5fc1={};_0x1e5fc1[_0xc5c7('0x3c')]=_[_0xc5c7('0x37')](db[_0xc5c7('0x46')]['rawAttributes']);_0x1e5fc1[_0xc5c7('0x38')]=_[_0xc5c7('0x37')](_0x5a8b31['query']);_0x1e5fc1[_0xc5c7('0x39')]=_['intersection'](_0x1e5fc1['model'],_0x1e5fc1[_0xc5c7('0x38')]);_0x3758b9['attributes']=_[_0xc5c7('0x3a')](_0x1e5fc1[_0xc5c7('0x3c')],qs[_0xc5c7('0x3d')](_0x5a8b31[_0xc5c7('0x38')][_0xc5c7('0x3d')]));_0x3758b9['attributes']=_0x3758b9['attributes'][_0xc5c7('0x3e')]?_0x3758b9[_0xc5c7('0x3b')]:_0x1e5fc1[_0xc5c7('0x3c')];if(_0x5a8b31['query'][_0xc5c7('0x47')]){_0x3758b9[_0xc5c7('0x48')]=[{'all':!![]}];}_0x3758b9=_[_0xc5c7('0x44')]({},_0x3758b9,_0x5a8b31[_0xc5c7('0x4d')]);return db['MailQueue'][_0xc5c7('0x4e')](_0x3758b9)[_0xc5c7('0x29')](handleEntityNotFound(_0x2337a8,null))[_0xc5c7('0x29')](respondWithResult(_0x2337a8,null))[_0xc5c7('0x4b')](handleError(_0x2337a8,null));};exports['create']=function(_0x521ba2,_0x5efc0c){return db[_0xc5c7('0x46')][_0xc5c7('0x4f')](_0x521ba2[_0xc5c7('0x50')],{})[_0xc5c7('0x29')](function(_0x4db92a){var _0x6582dc=_0x521ba2[_0xc5c7('0x51')]['get']({'plain':!![]});if(!_0x6582dc)throw new Error(_0xc5c7('0x52'));if(_0x6582dc['role']===_0xc5c7('0x51')){var _0xe1cdcd=_0x4db92a['get']({'plain':!![]});var _0x5185b0='MailQueues';return db['UserProfileSection'][_0xc5c7('0x4e')]({'where':{'name':_0x5185b0,'userProfileId':_0x6582dc[_0xc5c7('0x53')]},'raw':!![]})['then'](function(_0x3cc161){if(_0x3cc161&&_0x3cc161[_0xc5c7('0x54')]===0x0){return db[_0xc5c7('0x55')]['create']({'name':_0xe1cdcd[_0xc5c7('0x2f')],'resourceId':_0xe1cdcd['id'],'type':_0x3cc161[_0xc5c7('0x2f')],'sectionId':_0x3cc161['id']},{})[_0xc5c7('0x29')](function(){return _0x4db92a;});}else{return _0x4db92a;}})[_0xc5c7('0x4b')](function(_0x5b541d){logger[_0xc5c7('0x2d')](_0xc5c7('0x56'),_0x5b541d);throw _0x5b541d;});}return _0x4db92a;})[_0xc5c7('0x29')](respondWithResult(_0x5efc0c,0xc9))[_0xc5c7('0x4b')](handleError(_0x5efc0c,null));};exports[_0xc5c7('0x28')]=function(_0x220438,_0x1e5e66){if(_0x220438[_0xc5c7('0x50')]['id']){delete _0x220438[_0xc5c7('0x50')]['id'];}return db[_0xc5c7('0x46')]['find']({'where':{'id':_0x220438[_0xc5c7('0x57')]['id']}})[_0xc5c7('0x29')](handleEntityNotFound(_0x1e5e66,null))['then'](saveUpdates(_0x220438[_0xc5c7('0x50')],null))[_0xc5c7('0x29')](respondWithResult(_0x1e5e66,null))['catch'](handleError(_0x1e5e66,null));};exports[_0xc5c7('0x2a')]=function(_0x1fb0d1,_0x4415d4){return db['MailQueue'][_0xc5c7('0x4e')]({'where':{'id':_0x1fb0d1[_0xc5c7('0x57')]['id']}})[_0xc5c7('0x29')](handleEntityNotFound(_0x4415d4,null))[_0xc5c7('0x29')](removeEntity(_0x4415d4,null))[_0xc5c7('0x4b')](handleError(_0x4415d4,null));};exports[_0xc5c7('0x58')]=function(_0x3c4726,_0x46e097){return db[_0xc5c7('0x46')]['describe']()[_0xc5c7('0x29')](respondWithResult(_0x46e097,null))['catch'](handleError(_0x46e097,null));};exports['getMembers']=function(_0x4bb39a,_0x4c2810,_0x5d840b){var _0x69263a={'raw':!![],'where':{}},_0x469816={},_0x285364;return db[_0xc5c7('0x46')][_0xc5c7('0x59')]({'where':{'id':_0x4bb39a[_0xc5c7('0x57')]['id']}})[_0xc5c7('0x29')](handleEntityNotFound(_0x4c2810,null))[_0xc5c7('0x29')](function(_0x339b42){if(_0x339b42){_0x285364=_0x339b42['get']({'plain':!![]});_0x469816[_0xc5c7('0x3c')]=_['keys'](db[_0xc5c7('0x5a')][_0xc5c7('0x33')]);_0x469816[_0xc5c7('0x38')]=_[_0xc5c7('0x37')](_0x4bb39a[_0xc5c7('0x38')]);_0x469816['filters']=_[_0xc5c7('0x3a')](_0x469816['model'],_0x469816[_0xc5c7('0x38')]);_0x69263a[_0xc5c7('0x3b')]=_[_0xc5c7('0x3a')](_0x469816[_0xc5c7('0x3c')],qs[_0xc5c7('0x3d')](_0x4bb39a[_0xc5c7('0x38')][_0xc5c7('0x3d')]));_0x69263a[_0xc5c7('0x3b')]=_0x69263a['attributes'][_0xc5c7('0x3e')]?_0x69263a[_0xc5c7('0x3b')]:_0x469816[_0xc5c7('0x3c')];if(!_0x4bb39a[_0xc5c7('0x38')][_0xc5c7('0x5b')](_0xc5c7('0x3f'))){_0x69263a['limit']=qs['limit'](_0x4bb39a[_0xc5c7('0x38')][_0xc5c7('0x22')]);_0x69263a[_0xc5c7('0x21')]=qs['offset'](_0x4bb39a[_0xc5c7('0x38')][_0xc5c7('0x21')]);}_0x69263a[_0xc5c7('0x40')]=qs['sort'](_0x4bb39a[_0xc5c7('0x38')][_0xc5c7('0x5c')]);_0x69263a[_0xc5c7('0x41')]=qs[_0xc5c7('0x39')](_['pick'](_0x4bb39a['query'],_0x469816[_0xc5c7('0x39')]));_0x69263a[_0xc5c7('0x41')][_0xc5c7('0x5d')]=_0x339b42['id'];if(_0x4bb39a[_0xc5c7('0x38')][_0xc5c7('0x43')]){_0x69263a['where']=_[_0xc5c7('0x44')](_0x69263a['where'],{'$or':_[_0xc5c7('0x32')](_0x69263a[_0xc5c7('0x3b')],function(_0x2bc66a){var _0x16ce13={};_0x16ce13[_0x2bc66a]={'$like':'%'+_0x4bb39a[_0xc5c7('0x38')][_0xc5c7('0x43')]+'%'};return _0x16ce13;})});}_0x69263a=_[_0xc5c7('0x44')]({},_0x69263a,_0x4bb39a[_0xc5c7('0x4d')]);return db['UserMailQueue']['findAll'](_0x69263a);}})[_0xc5c7('0x29')](function(_0x572e09){if(_0x572e09){return db[_0xc5c7('0x5e')][_0xc5c7('0x5f')]({'where':{'id':_['map'](_0x572e09,_0xc5c7('0x60')),'role':_0xc5c7('0x61')},'attributes':['id',_0xc5c7('0x2f'),'mailPause',_0xc5c7('0x62'),_0xc5c7('0x63')]});}})[_0xc5c7('0x29')](function(_0x3576b5){if(_0x3576b5){return{'count':_0x3576b5[_0xc5c7('0x24')],'rows':_['map'](_0x3576b5['rows'],function(_0x3518f7){return{'membername':_0x3518f7[_0xc5c7('0x2f')],'UserId':_0x3518f7['id'],'queue_name':_0x285364[_0xc5c7('0x2f')],'MailQueueId':_0x285364['id'],'interface':util[_0xc5c7('0x64')](_0xc5c7('0x65'),_0xc5c7('0x66'),_0x3518f7['name']),'penalty':0x0,'paused':_0x3518f7['mailPause'],'createdAt':_0x3518f7['createdAt'],'updatedAt':_0x3518f7[_0xc5c7('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc5c7('0x29')](respondWithFilteredResult(_0x4c2810,_0x69263a))[_0xc5c7('0x4b')](handleError(_0x4c2810,null));};exports[_0xc5c7('0x67')]=function(_0x521817,_0x432799,_0x113dbb){var _0x5110a2={};var _0x5b7c70={};var _0x17e95d;var _0x120136;return db[_0xc5c7('0x46')][_0xc5c7('0x59')]({'where':{'id':_0x521817[_0xc5c7('0x57')]['id']}})[_0xc5c7('0x29')](handleEntityNotFound(_0x432799,null))[_0xc5c7('0x29')](function(_0x5d4e41){if(_0x5d4e41){_0x17e95d=_0x5d4e41;_0x5b7c70[_0xc5c7('0x3c')]=_[_0xc5c7('0x37')](db[_0xc5c7('0x68')][_0xc5c7('0x33')]);_0x5b7c70[_0xc5c7('0x38')]=_[_0xc5c7('0x37')](_0x521817[_0xc5c7('0x38')]);_0x5b7c70['filters']=_[_0xc5c7('0x3a')](_0x5b7c70['model'],_0x5b7c70[_0xc5c7('0x38')]);_0x5110a2[_0xc5c7('0x3b')]=_[_0xc5c7('0x3a')](_0x5b7c70[_0xc5c7('0x3c')],qs[_0xc5c7('0x3d')](_0x521817['query'][_0xc5c7('0x3d')]));_0x5110a2[_0xc5c7('0x3b')]=_0x5110a2['attributes'][_0xc5c7('0x3e')]?_0x5110a2['attributes']:_0x5b7c70[_0xc5c7('0x3c')];_0x5110a2['order']=qs['sort'](_0x521817[_0xc5c7('0x38')]['sort']);_0x5110a2[_0xc5c7('0x41')]=qs[_0xc5c7('0x39')](_[_0xc5c7('0x42')](_0x521817[_0xc5c7('0x38')],_0x5b7c70['filters']));if(_0x521817[_0xc5c7('0x38')][_0xc5c7('0x43')]){_0x5110a2['where']=_['merge'](_0x5110a2[_0xc5c7('0x41')],{'$or':_[_0xc5c7('0x32')](_0x5110a2[_0xc5c7('0x3b')],function(_0x266dd6){var _0x168afd={};_0x168afd[_0x266dd6]={'$like':'%'+_0x521817[_0xc5c7('0x38')]['filter']+'%'};return _0x168afd;})});}_0x5110a2=_[_0xc5c7('0x44')]({},_0x5110a2,_0x521817[_0xc5c7('0x4d')]);return _0x17e95d[_0xc5c7('0x67')](_0x5110a2);}})['then'](function(_0x7e8042){if(_0x7e8042){_0x120136=_0x7e8042[_0xc5c7('0x3e')];if(!_0x521817[_0xc5c7('0x38')][_0xc5c7('0x5b')]('nolimit')){_0x5110a2['limit']=qs[_0xc5c7('0x22')](_0x521817[_0xc5c7('0x38')]['limit']);_0x5110a2[_0xc5c7('0x21')]=qs[_0xc5c7('0x21')](_0x521817[_0xc5c7('0x38')][_0xc5c7('0x21')]);}return _0x17e95d[_0xc5c7('0x67')](_0x5110a2);}})[_0xc5c7('0x29')](function(_0xe8651a){if(_0xe8651a){return _0xe8651a?{'count':_0x120136,'rows':_0xe8651a}:null;}})['then'](respondWithResult(_0x432799,null))[_0xc5c7('0x4b')](handleError(_0x432799,null));};exports[_0xc5c7('0x69')]=function(_0x20cf79,_0xb4d27,_0x45c8e2){var _0x53c33d=_0x20cf79[_0xc5c7('0x50')][_0xc5c7('0x6a')];return db[_0xc5c7('0x68')][_0xc5c7('0x49')]({'where':{'id':_0x53c33d},'attributes':['id'],'include':[{'model':db[_0xc5c7('0x5e')],'as':'Agents','attributes':['id',_0xc5c7('0x2f'),_0xc5c7('0x6b'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x5e3bf4){if(_0x5e3bf4){var _0x146554=_[_0xc5c7('0x6c')](_0x5e3bf4,function(_0x3b674b){var _0x35c00c=_0x3b674b[_0xc5c7('0x2b')]({'plain':!![]});return _0x35c00c[_0xc5c7('0x6d')];});return db[_0xc5c7('0x46')][_0xc5c7('0x4e')]({'where':{'id':_0x20cf79[_0xc5c7('0x57')]['id']}})[_0xc5c7('0x29')](function(_0x5b5c6b){return db[_0xc5c7('0x6e')][_0xc5c7('0x6f')](function(_0x8e0f42){return _0x5b5c6b[_0xc5c7('0x69')](_0x53c33d,{'transaction':_0x8e0f42})[_0xc5c7('0x29')](function(){return BPromise[_0xc5c7('0x70')](_0x146554,function(_0x9ee80e){return db[_0xc5c7('0x5a')]['findOrCreate']({'where':{'UserId':_0x9ee80e['id'],'MailQueueId':_0x20cf79[_0xc5c7('0x57')]['id']},'transaction':_0x8e0f42});});})['then'](function(){_0x146554[_0xc5c7('0x71')](function(_0x4c1fbe){socket[_0xc5c7('0x72')](_0xc5c7('0x73'),{'UserId':_0x4c1fbe['id'],'MailQueueId':_0x5b5c6b['id']});});});});});}})[_0xc5c7('0x29')](respondWithStatusCode(_0xb4d27,null))[_0xc5c7('0x4b')](handleError(_0xb4d27,null));};exports[_0xc5c7('0x74')]=function(_0x303357,_0x2ab400,_0x4feda0){return db['Team']['findAll']({'where':{'id':_0x303357['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xc5c7('0x5e')],'as':_0xc5c7('0x6d'),'attributes':['id'],'raw':!![]}]})[_0xc5c7('0x29')](handleEntityNotFound(_0x2ab400,null))[_0xc5c7('0x29')](function(_0x44a647){var _0x7c3605=_[_0xc5c7('0x32')](_0x44a647,'id');var _0x23489b=[];var _0x2355ec=[];var _0x540f7f=squel[_0xc5c7('0x75')]();_0x540f7f[_0xc5c7('0x76')](_0xc5c7('0x77'))[_0xc5c7('0x78')](_0xc5c7('0x79'),'tq')[_0xc5c7('0x7a')](_0xc5c7('0x7b'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xc5c7('0x7c'),_0x303357['params']['id']);for(var _0x4488f5=0x0;_0x4488f5<_0x44a647['length'];_0x4488f5+=0x1){let _0x5e98ec=_0x44a647[_0x4488f5];for(var _0x23f2ae=0x0;_0x23f2ae<_0x5e98ec[_0xc5c7('0x6d')][_0xc5c7('0x3e')];_0x23f2ae+=0x1){let _0x553b73=_0x5e98ec[_0xc5c7('0x6d')][_0x23f2ae];var _0x243e3b=_0x540f7f[_0xc5c7('0x7d')]();_0x243e3b[_0xc5c7('0x41')](_0xc5c7('0x7e'),_0x553b73['id']);_0x2355ec['push'](db[_0xc5c7('0x6e')]['query'](_0x243e3b[_0xc5c7('0x7f')](),{'type':db['sequelize'][_0xc5c7('0x80')][_0xc5c7('0x81')]})[_0xc5c7('0x29')](function(_0x1f27c0){if(_0x1f27c0[_0xc5c7('0x3e')]===0x1){return _0x553b73['id'];}else{var _0x585695=_[_0xc5c7('0x82')](_[_0xc5c7('0x32')](_0x1f27c0,_0xc5c7('0x83')),function(_0x8728e4){return _[_0xc5c7('0x84')](_0x7c3605,_0x8728e4);});if(_0x585695){return _0x553b73['id'];}}}));}}return BPromise[_0xc5c7('0x85')](_0x2355ec)[_0xc5c7('0x29')](function(_0x25a892){_0x23489b=_(_0x23489b)[_0xc5c7('0x86')](_0x25a892)[_0xc5c7('0x87')]()['value']();return db['MailQueue'][_0xc5c7('0x4e')]({'where':{'id':_0x303357[_0xc5c7('0x57')]['id']}})['then'](function(_0x331604){return db[_0xc5c7('0x6e')][_0xc5c7('0x6f')](function(_0x432ee0){return _0x331604['removeTeams'](_0x303357[_0xc5c7('0x38')]['ids'],{'transaction':_0x432ee0})[_0xc5c7('0x29')](function(){if(!_[_0xc5c7('0x88')](_0x23489b)){return _0x331604[_0xc5c7('0x89')](_0x23489b,{'transaction':_0x432ee0});}})['then'](function(){_0x23489b[_0xc5c7('0x71')](function(_0x35b498){socket[_0xc5c7('0x72')]('userMailQueue:remove',{'UserId':_0x35b498,'MailQueueId':_0x331604['id']});});});});});});})[_0xc5c7('0x29')](respondWithStatusCode(_0x2ab400,null))[_0xc5c7('0x4b')](handleError(_0x2ab400,null));};exports[_0xc5c7('0x8a')]=function(_0x368487,_0x313d3a,_0x3feac7){return db[_0xc5c7('0x46')][_0xc5c7('0x4e')]({'where':{'id':_0x368487['params']['id']}})[_0xc5c7('0x29')](handleEntityNotFound(_0x313d3a,null))[_0xc5c7('0x29')](function(_0x2c8644){if(_0x2c8644){return _0x2c8644[_0xc5c7('0x8a')](_0x368487['body']['ids'],_[_0xc5c7('0x8b')](_0x368487['body'],[_0xc5c7('0x6a'),'id'])||{})[_0xc5c7('0x8c')](function(_0x62bc97){for(var _0x2d8a20=0x0;_0x2d8a20<_0x368487[_0xc5c7('0x50')][_0xc5c7('0x6a')]['length'];_0x2d8a20+=0x1){socket['emit'](_0xc5c7('0x73'),{'UserId':Number(_0x368487[_0xc5c7('0x50')][_0xc5c7('0x6a')][_0x2d8a20]),'MailQueueId':Number(_0x368487['params']['id'])});}return _0x62bc97;});}})[_0xc5c7('0x29')](respondWithResult(_0x313d3a,null))[_0xc5c7('0x4b')](handleError(_0x313d3a,null));};exports[_0xc5c7('0x89')]=function(_0x460d60,_0x1de73b,_0x31fd75){return db[_0xc5c7('0x46')][_0xc5c7('0x4e')]({'where':{'id':_0x460d60['params']['id']}})[_0xc5c7('0x29')](handleEntityNotFound(_0x1de73b,null))[_0xc5c7('0x29')](function(_0x19b1d0){if(_0x19b1d0){return _0x19b1d0[_0xc5c7('0x89')](_0x460d60[_0xc5c7('0x38')]['ids'])['then'](function(){if(_[_0xc5c7('0x8d')](_0x460d60['query'][_0xc5c7('0x6a')])){for(var _0x44c3d6=0x0;_0x44c3d6<_0x460d60[_0xc5c7('0x38')]['ids'][_0xc5c7('0x3e')];_0x44c3d6+=0x1){socket[_0xc5c7('0x72')]('userMailQueue:remove',{'UserId':Number(_0x460d60[_0xc5c7('0x38')][_0xc5c7('0x6a')][_0x44c3d6]),'MailQueueId':Number(_0x460d60[_0xc5c7('0x57')]['id'])});}}else{socket[_0xc5c7('0x72')](_0xc5c7('0x8e'),{'UserId':Number(_0x460d60[_0xc5c7('0x38')]['ids']),'MailQueueId':Number(_0x460d60[_0xc5c7('0x57')]['id'])});}});}})[_0xc5c7('0x29')](respondWithStatusCode(_0x1de73b,null))['catch'](handleError(_0x1de73b,null));};exports[_0xc5c7('0x8f')]=function(_0x5c417d,_0x42a604,_0x495ca3){var _0x256ebb={};var _0x589085={};var _0x2f29c2;var _0x5f1b14;return db[_0xc5c7('0x46')][_0xc5c7('0x59')]({'where':{'id':_0x5c417d['params']['id']}})[_0xc5c7('0x29')](handleEntityNotFound(_0x42a604,null))[_0xc5c7('0x29')](function(_0x3c7cdc){if(_0x3c7cdc){_0x2f29c2=_0x3c7cdc;_0x589085[_0xc5c7('0x3c')]=_['keys'](db[_0xc5c7('0x5e')][_0xc5c7('0x33')]);_0x589085[_0xc5c7('0x38')]=_[_0xc5c7('0x37')](_0x5c417d[_0xc5c7('0x38')]);_0x589085[_0xc5c7('0x39')]=_[_0xc5c7('0x3a')](_0x589085[_0xc5c7('0x3c')],_0x589085['query']);_0x256ebb[_0xc5c7('0x3b')]=_[_0xc5c7('0x3a')](_0x589085['model'],qs[_0xc5c7('0x3d')](_0x5c417d['query'][_0xc5c7('0x3d')]));_0x256ebb[_0xc5c7('0x3b')]=_0x256ebb['attributes'][_0xc5c7('0x3e')]?_0x256ebb[_0xc5c7('0x3b')]:_0x589085[_0xc5c7('0x3c')];_0x256ebb[_0xc5c7('0x40')]=qs[_0xc5c7('0x5c')](_0x5c417d[_0xc5c7('0x38')][_0xc5c7('0x5c')]);_0x256ebb[_0xc5c7('0x41')]=qs[_0xc5c7('0x39')](_[_0xc5c7('0x42')](_0x5c417d[_0xc5c7('0x38')],_0x589085['filters']));if(_0x5c417d['query'][_0xc5c7('0x43')]){_0x256ebb[_0xc5c7('0x41')]=_['merge'](_0x256ebb[_0xc5c7('0x41')],{'$or':_[_0xc5c7('0x32')](_0x256ebb['attributes'],function(_0x1840ae){var _0x10571f={};_0x10571f[_0x1840ae]={'$like':'%'+_0x5c417d[_0xc5c7('0x38')][_0xc5c7('0x43')]+'%'};return _0x10571f;})});}_0x256ebb=_['merge']({},_0x256ebb,_0x5c417d[_0xc5c7('0x4d')]);return _0x2f29c2['getAgents'](_0x256ebb);}})[_0xc5c7('0x29')](function(_0x3492c8){if(_0x3492c8){_0x5f1b14=_0x3492c8[_0xc5c7('0x3e')];if(!_0x5c417d['query']['hasOwnProperty'](_0xc5c7('0x3f'))){_0x256ebb[_0xc5c7('0x22')]=qs[_0xc5c7('0x22')](_0x5c417d[_0xc5c7('0x38')][_0xc5c7('0x22')]);_0x256ebb[_0xc5c7('0x21')]=qs['offset'](_0x5c417d['query'][_0xc5c7('0x21')]);}return _0x2f29c2['getAgents'](_0x256ebb);}})[_0xc5c7('0x29')](function(_0x443bdb){if(_0x443bdb){return _0x443bdb?{'count':_0x5f1b14,'rows':_0x443bdb}:null;}})[_0xc5c7('0x29')](respondWithResult(_0x42a604,null))[_0xc5c7('0x4b')](handleError(_0x42a604,null));}; \ No newline at end of file +var _0x984b=['stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','MailQueue','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','getMembers','findOne','UserMailQueue','nolimit','MailQueueId','User','findAndCountAll','UserId','agent','createdAt','format','mailPause','updatedAt','Team','getTeams','addTeams','ids','online','voicePause','interface','flatMap','each','findOrCreate','emit','removeTeams','Agents','select','field','tq.TeamId','from','join','clone','ut.UserId\x20=\x20?','push','sequelize','SELECT','every','TeamId','all','union','compact','value','transaction','isEmpty','removeAgents','forEach','userMailQueue:remove','addAgents','omit','spread','userMailQueue:save','isArray','getAgents','fast-json-patch','request-promise','moment','util','path','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','./mailQueue.socket','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','MailQueues','UserProfileResource','end'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x984b,0xee));var _0xb984=function(_0x2abfe7,_0x2466df){_0x2abfe7=_0x2abfe7-0x0;var _0x2bef5c=_0x984b[_0x2abfe7];return _0x2bef5c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb984('0x0'));var rp=require(_0xb984('0x1'));var moment=require(_0xb984('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb984('0x3'));var path=require(_0xb984('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb984('0x5'));var fs=require('fs');var fs_extra=require(_0xb984('0x6'));var _=require('lodash');var squel=require(_0xb984('0x7'));var crypto=require(_0xb984('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xb984('0x9'));var toCsv=require('to-csv');var querystring=require(_0xb984('0xa'));var Papa=require(_0xb984('0xb'));var Redis=require(_0xb984('0xc'));var authService=require(_0xb984('0xd'));var qs=require(_0xb984('0xe'));var as=require(_0xb984('0xf'));var hardwareService=require(_0xb984('0x10'));var logger=require(_0xb984('0x11'))(_0xb984('0x12'));var utils=require(_0xb984('0x13'));var config=require(_0xb984('0x14'));var licenseUtil=require(_0xb984('0x15'));var db=require('../../mysqldb')['db'];config[_0xb984('0x16')]=_['defaults'](config[_0xb984('0x16')],{'host':_0xb984('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb984('0x16')]));require(_0xb984('0x18'))['register'](socket);function respondWithStatusCode(_0x203dba,_0x7a1b60){_0x7a1b60=_0x7a1b60||0xcc;return function(_0x549791){if(_0x549791){return _0x203dba[_0xb984('0x19')](_0x7a1b60);}return _0x203dba[_0xb984('0x1a')](_0x7a1b60)['end']();};}function respondWithResult(_0x6fae41,_0x5cd1aa){_0x5cd1aa=_0x5cd1aa||0xc8;return function(_0x3b8241){if(_0x3b8241){return _0x6fae41[_0xb984('0x1a')](_0x5cd1aa)[_0xb984('0x1b')](_0x3b8241);}};}function respondWithFilteredResult(_0x3f7cff,_0x59dcb7){return function(_0x396c36){if(_0x396c36){var _0x35bd75=typeof _0x59dcb7[_0xb984('0x1c')]===_0xb984('0x1d')&&typeof _0x59dcb7[_0xb984('0x1e')]===_0xb984('0x1d');var _0x5c2e25=_0x396c36[_0xb984('0x1f')];var _0x2f6d70=_0x35bd75?0x0:_0x59dcb7[_0xb984('0x1c')];var _0x3870ba=_0x35bd75?_0x396c36[_0xb984('0x1f')]:_0x59dcb7[_0xb984('0x1c')]+_0x59dcb7['limit'];var _0x39d16f;if(_0x3870ba>=_0x5c2e25){_0x3870ba=_0x5c2e25;_0x39d16f=0xc8;}else{_0x39d16f=0xce;}_0x3f7cff[_0xb984('0x1a')](_0x39d16f);return _0x3f7cff['set'](_0xb984('0x20'),_0x2f6d70+'-'+_0x3870ba+'/'+_0x5c2e25)[_0xb984('0x1b')](_0x396c36);}return null;};}function patchUpdates(_0x14734a){return function(_0x932579){try{jsonpatch[_0xb984('0x21')](_0x932579,_0x14734a,!![]);}catch(_0x286033){return BPromise[_0xb984('0x22')](_0x286033);}return _0x932579['save']();};}function saveUpdates(_0x391a1e,_0x25de23){return function(_0x1b6be3){if(_0x1b6be3){return _0x1b6be3['update'](_0x391a1e)[_0xb984('0x23')](function(_0x2e806e){return _0x2e806e;});}return null;};}function removeEntity(_0x1cb2c2,_0x2d0450){return function(_0x1f7b62){if(_0x1f7b62){return _0x1f7b62[_0xb984('0x24')]()[_0xb984('0x23')](function(){var _0x4b3da0=_0x1f7b62['get']({'plain':!![]});var _0x249d47=_0xb984('0x25');return db[_0xb984('0x26')][_0xb984('0x24')]({'where':{'type':_0x249d47,'resourceId':_0x4b3da0['id']}})['then'](function(){return _0x1f7b62;});})[_0xb984('0x23')](function(){_0x1cb2c2[_0xb984('0x1a')](0xcc)[_0xb984('0x27')]();});}};}function handleEntityNotFound(_0x482a9f,_0x363e33){return function(_0x311e22){if(!_0x311e22){_0x482a9f[_0xb984('0x19')](0x194);}return _0x311e22;};}function handleError(_0x3d2757,_0x4d00a8){_0x4d00a8=_0x4d00a8||0x1f4;return function(_0x5b8da1){logger['error'](_0x5b8da1[_0xb984('0x28')]);if(_0x5b8da1[_0xb984('0x29')]){delete _0x5b8da1['name'];}_0x3d2757[_0xb984('0x1a')](_0x4d00a8)[_0xb984('0x2a')](_0x5b8da1);};}exports[_0xb984('0x2b')]=function(_0x2c5a99,_0x518bef){var _0x4bb6da={},_0x315f70={},_0x2daa31={'count':0x0,'rows':[]};var _0x2c0562=_[_0xb984('0x2c')](db['MailQueue'][_0xb984('0x2d')],function(_0x35b37f){return{'name':_0x35b37f[_0xb984('0x2e')],'type':_0x35b37f[_0xb984('0x2f')][_0xb984('0x30')]};});_0x315f70[_0xb984('0x31')]=_['map'](_0x2c0562,_0xb984('0x29'));_0x315f70[_0xb984('0x32')]=_[_0xb984('0x33')](_0x2c5a99[_0xb984('0x32')]);_0x315f70[_0xb984('0x34')]=_[_0xb984('0x35')](_0x315f70['model'],_0x315f70[_0xb984('0x32')]);_0x4bb6da[_0xb984('0x36')]=_['intersection'](_0x315f70['model'],qs[_0xb984('0x37')](_0x2c5a99['query'][_0xb984('0x37')]));_0x4bb6da[_0xb984('0x36')]=_0x4bb6da['attributes'][_0xb984('0x38')]?_0x4bb6da['attributes']:_0x315f70[_0xb984('0x31')];if(!_0x2c5a99['query'][_0xb984('0x39')]('nolimit')){_0x4bb6da['limit']=qs[_0xb984('0x1e')](_0x2c5a99[_0xb984('0x32')]['limit']);_0x4bb6da[_0xb984('0x1c')]=qs[_0xb984('0x1c')](_0x2c5a99['query'][_0xb984('0x1c')]);}_0x4bb6da[_0xb984('0x3a')]=qs[_0xb984('0x3b')](_0x2c5a99[_0xb984('0x32')]['sort']);_0x4bb6da[_0xb984('0x3c')]=qs[_0xb984('0x34')](_[_0xb984('0x3d')](_0x2c5a99[_0xb984('0x32')],_0x315f70[_0xb984('0x34')]),_0x2c0562);if(_0x2c5a99[_0xb984('0x32')][_0xb984('0x3e')]){_0x4bb6da[_0xb984('0x3c')]=_[_0xb984('0x3f')](_0x4bb6da[_0xb984('0x3c')],{'$or':_['map'](_0x2c0562,function(_0x134ba5){if(_0x134ba5[_0xb984('0x2f')]!==_0xb984('0x40')){var _0x192037={};_0x192037[_0x134ba5[_0xb984('0x29')]]={'$like':'%'+_0x2c5a99[_0xb984('0x32')][_0xb984('0x3e')]+'%'};return _0x192037;}})});}_0x4bb6da=_[_0xb984('0x3f')]({},_0x4bb6da,_0x2c5a99['options']);var _0x5d4be9={'where':_0x4bb6da[_0xb984('0x3c')]};return db['MailQueue'][_0xb984('0x1f')](_0x5d4be9)[_0xb984('0x23')](function(_0x216df6){_0x2daa31[_0xb984('0x1f')]=_0x216df6;if(_0x2c5a99['query'][_0xb984('0x41')]){_0x4bb6da[_0xb984('0x42')]=[{'all':!![]}];}return db['MailQueue'][_0xb984('0x43')](_0x4bb6da);})[_0xb984('0x23')](function(_0x38a025){_0x2daa31[_0xb984('0x44')]=_0x38a025;return _0x2daa31;})[_0xb984('0x23')](respondWithFilteredResult(_0x518bef,_0x4bb6da))[_0xb984('0x45')](handleError(_0x518bef,null));};exports[_0xb984('0x46')]=function(_0x587c19,_0xbca7cd){var _0x234178={'raw':!![],'where':{'id':_0x587c19['params']['id']}},_0x4f6f2b={};_0x4f6f2b[_0xb984('0x31')]=_[_0xb984('0x33')](db[_0xb984('0x47')][_0xb984('0x2d')]);_0x4f6f2b[_0xb984('0x32')]=_['keys'](_0x587c19[_0xb984('0x32')]);_0x4f6f2b[_0xb984('0x34')]=_[_0xb984('0x35')](_0x4f6f2b[_0xb984('0x31')],_0x4f6f2b[_0xb984('0x32')]);_0x234178[_0xb984('0x36')]=_[_0xb984('0x35')](_0x4f6f2b[_0xb984('0x31')],qs[_0xb984('0x37')](_0x587c19[_0xb984('0x32')]['fields']));_0x234178[_0xb984('0x36')]=_0x234178[_0xb984('0x36')]['length']?_0x234178[_0xb984('0x36')]:_0x4f6f2b[_0xb984('0x31')];if(_0x587c19[_0xb984('0x32')][_0xb984('0x41')]){_0x234178[_0xb984('0x42')]=[{'all':!![]}];}_0x234178=_[_0xb984('0x3f')]({},_0x234178,_0x587c19[_0xb984('0x48')]);return db[_0xb984('0x47')][_0xb984('0x49')](_0x234178)[_0xb984('0x23')](handleEntityNotFound(_0xbca7cd,null))['then'](respondWithResult(_0xbca7cd,null))[_0xb984('0x45')](handleError(_0xbca7cd,null));};exports[_0xb984('0x4a')]=function(_0x262898,_0x2ae0d8){return db[_0xb984('0x47')][_0xb984('0x4a')](_0x262898[_0xb984('0x4b')],{})[_0xb984('0x23')](function(_0xc6389d){var _0x5c3d82=_0x262898[_0xb984('0x4c')][_0xb984('0x4d')]({'plain':!![]});if(!_0x5c3d82)throw new Error(_0xb984('0x4e'));if(_0x5c3d82['role']===_0xb984('0x4c')){var _0x42a9f8=_0xc6389d['get']({'plain':!![]});var _0xdb477='MailQueues';return db[_0xb984('0x4f')][_0xb984('0x49')]({'where':{'name':_0xdb477,'userProfileId':_0x5c3d82['userProfileId']},'raw':!![]})[_0xb984('0x23')](function(_0x38b1cb){if(_0x38b1cb&&_0x38b1cb[_0xb984('0x50')]===0x0){return db[_0xb984('0x26')][_0xb984('0x4a')]({'name':_0x42a9f8[_0xb984('0x29')],'resourceId':_0x42a9f8['id'],'type':_0x38b1cb['name'],'sectionId':_0x38b1cb['id']},{})[_0xb984('0x23')](function(){return _0xc6389d;});}else{return _0xc6389d;}})['catch'](function(_0x4553d1){logger[_0xb984('0x51')](_0xb984('0x52'),_0x4553d1);throw _0x4553d1;});}return _0xc6389d;})['then'](respondWithResult(_0x2ae0d8,0xc9))['catch'](handleError(_0x2ae0d8,null));};exports[_0xb984('0x53')]=function(_0x2dfaf8,_0x56ad15){if(_0x2dfaf8['body']['id']){delete _0x2dfaf8[_0xb984('0x4b')]['id'];}return db[_0xb984('0x47')][_0xb984('0x49')]({'where':{'id':_0x2dfaf8[_0xb984('0x54')]['id']}})[_0xb984('0x23')](handleEntityNotFound(_0x56ad15,null))[_0xb984('0x23')](saveUpdates(_0x2dfaf8['body'],null))['then'](respondWithResult(_0x56ad15,null))[_0xb984('0x45')](handleError(_0x56ad15,null));};exports[_0xb984('0x24')]=function(_0x59ed42,_0x727af2){return db[_0xb984('0x47')][_0xb984('0x49')]({'where':{'id':_0x59ed42[_0xb984('0x54')]['id']}})['then'](handleEntityNotFound(_0x727af2,null))['then'](removeEntity(_0x727af2,null))[_0xb984('0x45')](handleError(_0x727af2,null));};exports[_0xb984('0x55')]=function(_0x2fc1f7,_0x29c79d){return db[_0xb984('0x47')][_0xb984('0x55')]()['then'](respondWithResult(_0x29c79d,null))[_0xb984('0x45')](handleError(_0x29c79d,null));};exports[_0xb984('0x56')]=function(_0x7c47aa,_0x345e1d,_0x2d77dd){var _0xdb7a50={'raw':!![],'where':{}},_0x575503={},_0x55852d;return db['MailQueue'][_0xb984('0x57')]({'where':{'id':_0x7c47aa[_0xb984('0x54')]['id']}})[_0xb984('0x23')](handleEntityNotFound(_0x345e1d,null))[_0xb984('0x23')](function(_0x19c6e7){if(_0x19c6e7){_0x55852d=_0x19c6e7['get']({'plain':!![]});_0x575503[_0xb984('0x31')]=_[_0xb984('0x33')](db[_0xb984('0x58')]['rawAttributes']);_0x575503[_0xb984('0x32')]=_[_0xb984('0x33')](_0x7c47aa['query']);_0x575503['filters']=_[_0xb984('0x35')](_0x575503['model'],_0x575503['query']);_0xdb7a50[_0xb984('0x36')]=_['intersection'](_0x575503[_0xb984('0x31')],qs[_0xb984('0x37')](_0x7c47aa[_0xb984('0x32')][_0xb984('0x37')]));_0xdb7a50[_0xb984('0x36')]=_0xdb7a50[_0xb984('0x36')][_0xb984('0x38')]?_0xdb7a50[_0xb984('0x36')]:_0x575503[_0xb984('0x31')];if(!_0x7c47aa[_0xb984('0x32')][_0xb984('0x39')](_0xb984('0x59'))){_0xdb7a50['limit']=qs[_0xb984('0x1e')](_0x7c47aa[_0xb984('0x32')][_0xb984('0x1e')]);_0xdb7a50['offset']=qs['offset'](_0x7c47aa[_0xb984('0x32')][_0xb984('0x1c')]);}_0xdb7a50[_0xb984('0x3a')]=qs['sort'](_0x7c47aa[_0xb984('0x32')][_0xb984('0x3b')]);_0xdb7a50[_0xb984('0x3c')]=qs[_0xb984('0x34')](_[_0xb984('0x3d')](_0x7c47aa[_0xb984('0x32')],_0x575503[_0xb984('0x34')]));_0xdb7a50[_0xb984('0x3c')][_0xb984('0x5a')]=_0x19c6e7['id'];if(_0x7c47aa[_0xb984('0x32')][_0xb984('0x3e')]){_0xdb7a50[_0xb984('0x3c')]=_[_0xb984('0x3f')](_0xdb7a50[_0xb984('0x3c')],{'$or':_['map'](_0xdb7a50[_0xb984('0x36')],function(_0x51399c){var _0x2acfc1={};_0x2acfc1[_0x51399c]={'$like':'%'+_0x7c47aa['query'][_0xb984('0x3e')]+'%'};return _0x2acfc1;})});}_0xdb7a50=_[_0xb984('0x3f')]({},_0xdb7a50,_0x7c47aa[_0xb984('0x48')]);return db[_0xb984('0x58')][_0xb984('0x43')](_0xdb7a50);}})[_0xb984('0x23')](function(_0x2eb8bf){if(_0x2eb8bf){return db[_0xb984('0x5b')][_0xb984('0x5c')]({'where':{'id':_[_0xb984('0x2c')](_0x2eb8bf,_0xb984('0x5d')),'role':_0xb984('0x5e')},'attributes':['id',_0xb984('0x29'),'mailPause','updatedAt',_0xb984('0x5f')]});}})[_0xb984('0x23')](function(_0x1e90ae){if(_0x1e90ae){return{'count':_0x1e90ae['count'],'rows':_[_0xb984('0x2c')](_0x1e90ae[_0xb984('0x44')],function(_0x50544b){return{'membername':_0x50544b['name'],'UserId':_0x50544b['id'],'queue_name':_0x55852d['name'],'MailQueueId':_0x55852d['id'],'interface':util[_0xb984('0x60')]('%s/%s','SIP',_0x50544b['name']),'penalty':0x0,'paused':_0x50544b[_0xb984('0x61')],'createdAt':_0x50544b[_0xb984('0x5f')],'updatedAt':_0x50544b[_0xb984('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb984('0x23')](respondWithFilteredResult(_0x345e1d,_0xdb7a50))['catch'](handleError(_0x345e1d,null));};exports['getTeams']=function(_0xa47568,_0x2a0f8f,_0x3c6050){var _0xe4e069={};var _0x307263={};var _0x5ce513;var _0x2063cd;return db[_0xb984('0x47')][_0xb984('0x57')]({'where':{'id':_0xa47568[_0xb984('0x54')]['id']}})[_0xb984('0x23')](handleEntityNotFound(_0x2a0f8f,null))[_0xb984('0x23')](function(_0x4f51a0){if(_0x4f51a0){_0x5ce513=_0x4f51a0;_0x307263[_0xb984('0x31')]=_['keys'](db[_0xb984('0x63')][_0xb984('0x2d')]);_0x307263[_0xb984('0x32')]=_[_0xb984('0x33')](_0xa47568[_0xb984('0x32')]);_0x307263['filters']=_[_0xb984('0x35')](_0x307263[_0xb984('0x31')],_0x307263[_0xb984('0x32')]);_0xe4e069['attributes']=_[_0xb984('0x35')](_0x307263[_0xb984('0x31')],qs[_0xb984('0x37')](_0xa47568[_0xb984('0x32')][_0xb984('0x37')]));_0xe4e069['attributes']=_0xe4e069['attributes'][_0xb984('0x38')]?_0xe4e069[_0xb984('0x36')]:_0x307263[_0xb984('0x31')];_0xe4e069[_0xb984('0x3a')]=qs['sort'](_0xa47568[_0xb984('0x32')][_0xb984('0x3b')]);_0xe4e069[_0xb984('0x3c')]=qs[_0xb984('0x34')](_['pick'](_0xa47568[_0xb984('0x32')],_0x307263[_0xb984('0x34')]));if(_0xa47568[_0xb984('0x32')][_0xb984('0x3e')]){_0xe4e069['where']=_[_0xb984('0x3f')](_0xe4e069[_0xb984('0x3c')],{'$or':_[_0xb984('0x2c')](_0xe4e069[_0xb984('0x36')],function(_0x46e5c7){var _0x37c2b0={};_0x37c2b0[_0x46e5c7]={'$like':'%'+_0xa47568[_0xb984('0x32')][_0xb984('0x3e')]+'%'};return _0x37c2b0;})});}_0xe4e069=_[_0xb984('0x3f')]({},_0xe4e069,_0xa47568[_0xb984('0x48')]);return _0x5ce513[_0xb984('0x64')](_0xe4e069);}})['then'](function(_0x19b7d0){if(_0x19b7d0){_0x2063cd=_0x19b7d0[_0xb984('0x38')];if(!_0xa47568[_0xb984('0x32')][_0xb984('0x39')](_0xb984('0x59'))){_0xe4e069[_0xb984('0x1e')]=qs['limit'](_0xa47568[_0xb984('0x32')][_0xb984('0x1e')]);_0xe4e069[_0xb984('0x1c')]=qs[_0xb984('0x1c')](_0xa47568['query'][_0xb984('0x1c')]);}return _0x5ce513[_0xb984('0x64')](_0xe4e069);}})['then'](function(_0x18d79c){if(_0x18d79c){return _0x18d79c?{'count':_0x2063cd,'rows':_0x18d79c}:null;}})['then'](respondWithResult(_0x2a0f8f,null))['catch'](handleError(_0x2a0f8f,null));};exports[_0xb984('0x65')]=function(_0x187a29,_0x1015fd,_0xc27f82){var _0x168d6c=_0x187a29[_0xb984('0x4b')][_0xb984('0x66')];return db[_0xb984('0x63')][_0xb984('0x43')]({'where':{'id':_0x168d6c},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xb984('0x29'),_0xb984('0x67'),_0xb984('0x68'),_0xb984('0x69')],'raw':!![]}]})['then'](function(_0x40ce51){if(_0x40ce51){var _0x3f34f0=_[_0xb984('0x6a')](_0x40ce51,function(_0xc9a1a9){var _0x199c2=_0xc9a1a9[_0xb984('0x4d')]({'plain':!![]});return _0x199c2['Agents'];});return db[_0xb984('0x47')]['find']({'where':{'id':_0x187a29[_0xb984('0x54')]['id']}})['then'](function(_0x3dd59c){return db['sequelize']['transaction'](function(_0x28b95d){return _0x3dd59c[_0xb984('0x65')](_0x168d6c,{'transaction':_0x28b95d})['then'](function(){return BPromise[_0xb984('0x6b')](_0x3f34f0,function(_0x1b3155){return db[_0xb984('0x58')][_0xb984('0x6c')]({'where':{'UserId':_0x1b3155['id'],'MailQueueId':_0x187a29[_0xb984('0x54')]['id']},'transaction':_0x28b95d});});})['then'](function(){_0x3f34f0['forEach'](function(_0x1d21c5){socket[_0xb984('0x6d')]('userMailQueue:save',{'UserId':_0x1d21c5['id'],'MailQueueId':_0x3dd59c['id']});});});});});}})[_0xb984('0x23')](respondWithStatusCode(_0x1015fd,null))[_0xb984('0x45')](handleError(_0x1015fd,null));};exports[_0xb984('0x6e')]=function(_0x5db11c,_0x52f937,_0x52c145){return db[_0xb984('0x63')][_0xb984('0x43')]({'where':{'id':_0x5db11c['query'][_0xb984('0x66')]},'attributes':['id'],'include':[{'model':db[_0xb984('0x5b')],'as':_0xb984('0x6f'),'attributes':['id'],'raw':!![]}]})[_0xb984('0x23')](handleEntityNotFound(_0x52f937,null))['then'](function(_0x53880c){var _0x4f55da=_['map'](_0x53880c,'id');var _0x4d5773=[];var _0x3b47b0=[];var _0x431b44=squel[_0xb984('0x70')]();_0x431b44[_0xb984('0x71')](_0xb984('0x72'))[_0xb984('0x73')]('team_has_mail_queues','tq')[_0xb984('0x74')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xb984('0x3c')]('MailQueueId\x20=\x20?',_0x5db11c[_0xb984('0x54')]['id']);for(var _0x2917f6=0x0;_0x2917f6<_0x53880c['length'];_0x2917f6+=0x1){let _0x3f99e5=_0x53880c[_0x2917f6];for(var _0x3e90cb=0x0;_0x3e90cb<_0x3f99e5[_0xb984('0x6f')][_0xb984('0x38')];_0x3e90cb+=0x1){let _0x1e48c5=_0x3f99e5[_0xb984('0x6f')][_0x3e90cb];var _0x175683=_0x431b44[_0xb984('0x75')]();_0x175683[_0xb984('0x3c')](_0xb984('0x76'),_0x1e48c5['id']);_0x3b47b0[_0xb984('0x77')](db[_0xb984('0x78')][_0xb984('0x32')](_0x175683['toString'](),{'type':db[_0xb984('0x78')]['QueryTypes'][_0xb984('0x79')]})['then'](function(_0x2f5ebd){if(_0x2f5ebd[_0xb984('0x38')]===0x1){return _0x1e48c5['id'];}else{var _0xf8f84e=_[_0xb984('0x7a')](_[_0xb984('0x2c')](_0x2f5ebd,_0xb984('0x7b')),function(_0x24c858){return _['includes'](_0x4f55da,_0x24c858);});if(_0xf8f84e){return _0x1e48c5['id'];}}}));}}return BPromise[_0xb984('0x7c')](_0x3b47b0)[_0xb984('0x23')](function(_0x41171e){_0x4d5773=_(_0x4d5773)[_0xb984('0x7d')](_0x41171e)[_0xb984('0x7e')]()[_0xb984('0x7f')]();return db[_0xb984('0x47')][_0xb984('0x49')]({'where':{'id':_0x5db11c[_0xb984('0x54')]['id']}})['then'](function(_0xd6cfe0){return db[_0xb984('0x78')][_0xb984('0x80')](function(_0x14337a){return _0xd6cfe0[_0xb984('0x6e')](_0x5db11c[_0xb984('0x32')][_0xb984('0x66')],{'transaction':_0x14337a})[_0xb984('0x23')](function(){if(!_[_0xb984('0x81')](_0x4d5773)){return _0xd6cfe0[_0xb984('0x82')](_0x4d5773,{'transaction':_0x14337a});}})['then'](function(){_0x4d5773[_0xb984('0x83')](function(_0x508d85){socket[_0xb984('0x6d')](_0xb984('0x84'),{'UserId':_0x508d85,'MailQueueId':_0xd6cfe0['id']});});});});});});})[_0xb984('0x23')](respondWithStatusCode(_0x52f937,null))[_0xb984('0x45')](handleError(_0x52f937,null));};exports[_0xb984('0x85')]=function(_0x55394b,_0xca9497,_0x2e5a9a){return db['MailQueue'][_0xb984('0x49')]({'where':{'id':_0x55394b[_0xb984('0x54')]['id']}})[_0xb984('0x23')](handleEntityNotFound(_0xca9497,null))['then'](function(_0x100a15){if(_0x100a15){return _0x100a15[_0xb984('0x85')](_0x55394b[_0xb984('0x4b')][_0xb984('0x66')],_[_0xb984('0x86')](_0x55394b[_0xb984('0x4b')],[_0xb984('0x66'),'id'])||{})[_0xb984('0x87')](function(_0x2a61b5){for(var _0x220323=0x0;_0x220323<_0x55394b['body']['ids']['length'];_0x220323+=0x1){socket[_0xb984('0x6d')](_0xb984('0x88'),{'UserId':Number(_0x55394b[_0xb984('0x4b')][_0xb984('0x66')][_0x220323]),'MailQueueId':Number(_0x55394b['params']['id'])});}return _0x2a61b5;});}})['then'](respondWithResult(_0xca9497,null))['catch'](handleError(_0xca9497,null));};exports[_0xb984('0x82')]=function(_0x1c8731,_0x5e9fa1,_0x278a22){return db['MailQueue'][_0xb984('0x49')]({'where':{'id':_0x1c8731['params']['id']}})[_0xb984('0x23')](handleEntityNotFound(_0x5e9fa1,null))['then'](function(_0xc526a9){if(_0xc526a9){return _0xc526a9[_0xb984('0x82')](_0x1c8731['query'][_0xb984('0x66')])['then'](function(){if(_[_0xb984('0x89')](_0x1c8731[_0xb984('0x32')][_0xb984('0x66')])){for(var _0x515c3c=0x0;_0x515c3c<_0x1c8731['query'][_0xb984('0x66')]['length'];_0x515c3c+=0x1){socket[_0xb984('0x6d')](_0xb984('0x84'),{'UserId':Number(_0x1c8731[_0xb984('0x32')][_0xb984('0x66')][_0x515c3c]),'MailQueueId':Number(_0x1c8731[_0xb984('0x54')]['id'])});}}else{socket[_0xb984('0x6d')]('userMailQueue:remove',{'UserId':Number(_0x1c8731[_0xb984('0x32')][_0xb984('0x66')]),'MailQueueId':Number(_0x1c8731[_0xb984('0x54')]['id'])});}});}})['then'](respondWithStatusCode(_0x5e9fa1,null))[_0xb984('0x45')](handleError(_0x5e9fa1,null));};exports[_0xb984('0x8a')]=function(_0x314572,_0x5e5999,_0x26b0bf){var _0x3138df={};var _0x3c7a23={};var _0x883044;var _0x2060c6;return db[_0xb984('0x47')][_0xb984('0x57')]({'where':{'id':_0x314572[_0xb984('0x54')]['id']}})[_0xb984('0x23')](handleEntityNotFound(_0x5e5999,null))['then'](function(_0x3323c4){if(_0x3323c4){_0x883044=_0x3323c4;_0x3c7a23[_0xb984('0x31')]=_[_0xb984('0x33')](db[_0xb984('0x5b')][_0xb984('0x2d')]);_0x3c7a23[_0xb984('0x32')]=_['keys'](_0x314572['query']);_0x3c7a23['filters']=_['intersection'](_0x3c7a23['model'],_0x3c7a23[_0xb984('0x32')]);_0x3138df[_0xb984('0x36')]=_[_0xb984('0x35')](_0x3c7a23[_0xb984('0x31')],qs[_0xb984('0x37')](_0x314572[_0xb984('0x32')][_0xb984('0x37')]));_0x3138df[_0xb984('0x36')]=_0x3138df[_0xb984('0x36')][_0xb984('0x38')]?_0x3138df[_0xb984('0x36')]:_0x3c7a23[_0xb984('0x31')];_0x3138df[_0xb984('0x3a')]=qs[_0xb984('0x3b')](_0x314572[_0xb984('0x32')][_0xb984('0x3b')]);_0x3138df[_0xb984('0x3c')]=qs[_0xb984('0x34')](_[_0xb984('0x3d')](_0x314572[_0xb984('0x32')],_0x3c7a23['filters']));if(_0x314572[_0xb984('0x32')][_0xb984('0x3e')]){_0x3138df['where']=_[_0xb984('0x3f')](_0x3138df[_0xb984('0x3c')],{'$or':_[_0xb984('0x2c')](_0x3138df[_0xb984('0x36')],function(_0x2f395c){var _0x319945={};_0x319945[_0x2f395c]={'$like':'%'+_0x314572[_0xb984('0x32')][_0xb984('0x3e')]+'%'};return _0x319945;})});}_0x3138df=_[_0xb984('0x3f')]({},_0x3138df,_0x314572[_0xb984('0x48')]);return _0x883044[_0xb984('0x8a')](_0x3138df);}})[_0xb984('0x23')](function(_0x1145e1){if(_0x1145e1){_0x2060c6=_0x1145e1[_0xb984('0x38')];if(!_0x314572[_0xb984('0x32')][_0xb984('0x39')](_0xb984('0x59'))){_0x3138df[_0xb984('0x1e')]=qs[_0xb984('0x1e')](_0x314572[_0xb984('0x32')][_0xb984('0x1e')]);_0x3138df['offset']=qs[_0xb984('0x1c')](_0x314572['query']['offset']);}return _0x883044[_0xb984('0x8a')](_0x3138df);}})[_0xb984('0x23')](function(_0x2ecd8a){if(_0x2ecd8a){return _0x2ecd8a?{'count':_0x2060c6,'rows':_0x2ecd8a}:null;}})['then'](respondWithResult(_0x5e5999,null))[_0xb984('0x45')](handleError(_0x5e5999,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 7c76168..7d539c1 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 _0x08c2=['events','MailQueue','setMaxListeners','save','update','hook','exports'];(function(_0x156f13,_0x154e2a){var _0x378dea=function(_0x5047dc){while(--_0x5047dc){_0x156f13['push'](_0x156f13['shift']());}};_0x378dea(++_0x154e2a);}(_0x08c2,0x17a));var _0x208c=function(_0x38622b,_0x3cfdf7){_0x38622b=_0x38622b-0x0;var _0x2c1a7a=_0x08c2[_0x38622b];return _0x2c1a7a;};'use strict';var EventEmitter=require(_0x208c('0x0'));var MailQueue=require('../../mysqldb')['db'][_0x208c('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x208c('0x2')](0x0);var events={'afterCreate':_0x208c('0x3'),'afterUpdate':_0x208c('0x4'),'afterDestroy':'remove'};function emitEvent(_0xbad19){return function(_0x48a681,_0x17fe6c,_0x4dedac){MailQueueEvents['emit'](_0xbad19+':'+_0x48a681['id'],_0x48a681);MailQueueEvents['emit'](_0xbad19,_0x48a681);_0x4dedac(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x208c('0x5')](e,emitEvent(event));}}module[_0x208c('0x6')]=MailQueueEvents; \ No newline at end of file +var _0x9c2b=['events','../../mysqldb','MailQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0xa38e6f,_0x581d52){var _0xa4e745=function(_0x1df56c){while(--_0x1df56c){_0xa38e6f['push'](_0xa38e6f['shift']());}};_0xa4e745(++_0x581d52);}(_0x9c2b,0x9a));var _0xb9c2=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x9c2b[_0x47aa64];return _0x549c7a;};'use strict';var EventEmitter=require(_0xb9c2('0x0'));var MailQueue=require(_0xb9c2('0x1'))['db'][_0xb9c2('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xb9c2('0x3')](0x0);var events={'afterCreate':_0xb9c2('0x4'),'afterUpdate':_0xb9c2('0x5'),'afterDestroy':_0xb9c2('0x6')};function emitEvent(_0x167dda){return function(_0x40e61e,_0x2d08cb,_0x557f4a){MailQueueEvents['emit'](_0x167dda+':'+_0x40e61e['id'],_0x40e61e);MailQueueEvents[_0xb9c2('0x7')](_0x167dda,_0x40e61e);_0x557f4a(null);};}for(var e in events){if(events[_0xb9c2('0x8')](e)){var event=events[e];MailQueue[_0xb9c2('0x9')](e,emitEvent(event));}}module[_0xb9c2('0xa')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 06ed959..20268ea 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 _0x9a27=['exports','MailQueue','mail_queues','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes'];(function(_0x2b6bb8,_0x5f353c){var _0x4e8688=function(_0x53b891){while(--_0x53b891){_0x2b6bb8['push'](_0x2b6bb8['shift']());}};_0x4e8688(++_0x5f353c);}(_0x9a27,0x1ef));var _0x79a2=function(_0x41e8e8,_0x1a8f06){_0x41e8e8=_0x41e8e8-0x0;var _0x18a259=_0x9a27[_0x41e8e8];return _0x18a259;};'use strict';var _=require(_0x79a2('0x0'));var util=require('util');var logger=require(_0x79a2('0x1'))(_0x79a2('0x2'));var moment=require('moment');var BPromise=require(_0x79a2('0x3'));var rp=require(_0x79a2('0x4'));var fs=require('fs');var path=require(_0x79a2('0x5'));var rimraf=require(_0x79a2('0x6'));var config=require(_0x79a2('0x7'));var attributes=require(_0x79a2('0x8'));module[_0x79a2('0x9')]=function(_0x33dab2,_0x19c407){return _0x33dab2['define'](_0x79a2('0xa'),attributes,{'tableName':_0x79a2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd14f=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailQueue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd14f,0xb4));var _0xfd14=function(_0x5433e7,_0x509d14){_0x5433e7=_0x5433e7-0x0;var _0x3b1e25=_0xd14f[_0x5433e7];return _0x3b1e25;};'use strict';var _=require('lodash');var util=require(_0xfd14('0x0'));var logger=require(_0xfd14('0x1'))(_0xfd14('0x2'));var moment=require(_0xfd14('0x3'));var BPromise=require(_0xfd14('0x4'));var rp=require(_0xfd14('0x5'));var fs=require('fs');var path=require(_0xfd14('0x6'));var rimraf=require(_0xfd14('0x7'));var config=require(_0xfd14('0x8'));var attributes=require('./mailQueue.attributes');module[_0xfd14('0x9')]=function(_0x45e68c,_0xd0ac88){return _0x45e68c[_0xfd14('0xa')](_0xfd14('0xb'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 3837758..68fc844 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 _0xec53=['MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailQueue','MailQueue','findAll','options','limit','include','map','model','attributes','ShowMailQueue','raw','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','localhost','socket.io-emitter','redis','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x48d6a3,_0x37c848){var _0x38bfa0=function(_0x3fba2e){while(--_0x3fba2e){_0x48d6a3['push'](_0x48d6a3['shift']());}};_0x38bfa0(++_0x37c848);}(_0xec53,0x1e6));var _0x3ec5=function(_0x2feca7,_0x3e2f90){_0x2feca7=_0x2feca7-0x0;var _0x5b71ea=_0xec53[_0x2feca7];return _0x5b71ea;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3ec5('0x0'));var BPromise=require('bluebird');var rs=require(_0x3ec5('0x1'));var fs=require('fs');var Redis=require(_0x3ec5('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3ec5('0x3'));var logger=require(_0x3ec5('0x4'))('rpc');var config=require(_0x3ec5('0x5'));var jayson=require(_0x3ec5('0x6'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x3ec5('0x7'),'port':0x18eb});var socket=require(_0x3ec5('0x8'))(new Redis(config[_0x3ec5('0x9')]));require(_0x3ec5('0xa'))[_0x3ec5('0xb')](socket);function respondWithRpcPromise(_0x10a7ca,_0x5a44ae,_0x3bff76){return new BPromise(function(_0x20f964,_0x5847f4){return client[_0x3ec5('0xc')](_0x10a7ca,_0x3bff76)[_0x3ec5('0xd')](function(_0x15938b){logger[_0x3ec5('0xe')](_0x3ec5('0xf'),_0x5a44ae,_0x3ec5('0x10'));logger[_0x3ec5('0x11')](_0x3ec5('0x12'),_0x5a44ae,_0x3ec5('0x10'),JSON[_0x3ec5('0x13')](_0x15938b));if(_0x15938b[_0x3ec5('0x14')]){if(_0x15938b['error'][_0x3ec5('0x15')]===0x1f4){logger[_0x3ec5('0x14')](_0x3ec5('0xf'),_0x5a44ae,_0x15938b['error']['message']);return _0x5847f4(_0x15938b['error'][_0x3ec5('0x16')]);}logger['error'](_0x3ec5('0xf'),_0x5a44ae,_0x15938b[_0x3ec5('0x14')][_0x3ec5('0x16')]);return _0x20f964(_0x15938b[_0x3ec5('0x14')]['message']);}else{logger[_0x3ec5('0xe')](_0x3ec5('0xf'),_0x5a44ae,_0x3ec5('0x10'));_0x20f964(_0x15938b[_0x3ec5('0x17')][_0x3ec5('0x16')]);}})[_0x3ec5('0x18')](function(_0x4f39c5){logger[_0x3ec5('0x14')]('MailQueue,\x20%s,\x20%s',_0x5a44ae,_0x4f39c5);_0x5847f4(_0x4f39c5);});});}exports[_0x3ec5('0x19')]=function(_0xd3c582){var _0x1a4644=this;return new Promise(function(_0x461802,_0x136b86){return db[_0x3ec5('0x1a')][_0x3ec5('0x1b')]({'raw':_0xd3c582['options']?_0xd3c582[_0x3ec5('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0xd3c582[_0x3ec5('0x1c')]?_0xd3c582[_0x3ec5('0x1c')]['where']||null:null,'attributes':_0xd3c582['options']?_0xd3c582[_0x3ec5('0x1c')]['attributes']||null:null,'limit':_0xd3c582[_0x3ec5('0x1c')]?_0xd3c582[_0x3ec5('0x1c')][_0x3ec5('0x1d')]||null:null,'include':_0xd3c582['options']?_0xd3c582[_0x3ec5('0x1c')][_0x3ec5('0x1e')]?_['map'](_0xd3c582['options'][_0x3ec5('0x1e')],function(_0x321c62){return{'model':db[_0x321c62['model']],'as':_0x321c62['as'],'attributes':_0x321c62['attributes'],'include':_0x321c62['include']?_[_0x3ec5('0x1f')](_0x321c62[_0x3ec5('0x1e')],function(_0x5d0d1e){return{'model':db[_0x5d0d1e[_0x3ec5('0x20')]],'as':_0x5d0d1e['as'],'attributes':_0x5d0d1e[_0x3ec5('0x21')],'include':_0x5d0d1e['include']?_[_0x3ec5('0x1f')](_0x5d0d1e[_0x3ec5('0x1e')],function(_0x2a1eb6){return{'model':db[_0x2a1eb6[_0x3ec5('0x20')]],'as':_0x2a1eb6['as'],'attributes':_0x2a1eb6[_0x3ec5('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x59d7b7){logger['info'](_0x3ec5('0x19'),_0xd3c582);logger[_0x3ec5('0x11')]('GetMailQueue',_0xd3c582,JSON['stringify'](_0x59d7b7));_0x461802(_0x59d7b7);})[_0x3ec5('0x18')](function(_0x3d2bc1){logger[_0x3ec5('0x14')](_0x3ec5('0x19'),_0x3d2bc1[_0x3ec5('0x16')],_0xd3c582);_0x136b86(_0x1a4644[_0x3ec5('0x14')](0x1f4,_0x3d2bc1[_0x3ec5('0x16')]));});});};exports[_0x3ec5('0x22')]=function(_0x51dcf9){var _0x5cb75a=this;return new Promise(function(_0x4d9395,_0x241cd1){return db[_0x3ec5('0x1a')]['find']({'raw':_0x51dcf9['options']?_0x51dcf9[_0x3ec5('0x1c')][_0x3ec5('0x23')]===undefined?!![]:![]:!![],'where':_0x51dcf9[_0x3ec5('0x1c')]?_0x51dcf9[_0x3ec5('0x1c')]['where']||null:null,'attributes':_0x51dcf9[_0x3ec5('0x1c')]?_0x51dcf9[_0x3ec5('0x1c')][_0x3ec5('0x21')]||null:null,'include':_0x51dcf9['options']?_0x51dcf9[_0x3ec5('0x1c')][_0x3ec5('0x1e')]?_[_0x3ec5('0x1f')](_0x51dcf9[_0x3ec5('0x1c')]['include'],function(_0x19fff4){return{'model':db[_0x19fff4[_0x3ec5('0x20')]],'as':_0x19fff4['as'],'attributes':_0x19fff4[_0x3ec5('0x21')],'include':_0x19fff4[_0x3ec5('0x1e')]?_[_0x3ec5('0x1f')](_0x19fff4[_0x3ec5('0x1e')],function(_0x47bcf7){return{'model':db[_0x47bcf7[_0x3ec5('0x20')]],'as':_0x47bcf7['as'],'attributes':_0x47bcf7[_0x3ec5('0x21')],'include':_0x47bcf7['include']?_[_0x3ec5('0x1f')](_0x47bcf7['include'],function(_0x401f32){return{'model':db[_0x401f32[_0x3ec5('0x20')]],'as':_0x401f32['as'],'attributes':_0x401f32[_0x3ec5('0x21')]};}):[]};}):[]};}):[]:[]})[_0x3ec5('0xd')](function(_0x2a2c0a){logger[_0x3ec5('0xe')](_0x3ec5('0x22'),_0x51dcf9);logger['debug'](_0x3ec5('0x22'),_0x51dcf9,JSON[_0x3ec5('0x13')](_0x2a2c0a));_0x4d9395(_0x2a2c0a);})[_0x3ec5('0x18')](function(_0x1fdf60){logger[_0x3ec5('0x14')]('ShowMailQueue',_0x1fdf60[_0x3ec5('0x16')],_0x51dcf9);_0x241cd1(_0x5cb75a[_0x3ec5('0x14')](0x1f4,_0x1fdf60['message']));});});}; \ No newline at end of file +var _0x5ae6=['find','raw','lodash','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','MailQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','result','GetMailQueue','findAll','options','where','attributes','limit','include','map','model','catch','ShowMailQueue','MailQueue'];(function(_0x56ab11,_0x14cba4){var _0x5f3bba=function(_0x35041b){while(--_0x35041b){_0x56ab11['push'](_0x56ab11['shift']());}};_0x5f3bba(++_0x14cba4);}(_0x5ae6,0x105));var _0x65ae=function(_0xba1760,_0x191969){_0xba1760=_0xba1760-0x0;var _0x1f3143=_0x5ae6[_0xba1760];return _0x1f3143;};'use strict';var _=require(_0x65ae('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x65ae('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x65ae('0x2'))['db'];var utils=require(_0x65ae('0x3'));var logger=require('../../config/logger')(_0x65ae('0x4'));var config=require('../../config/environment');var jayson=require(_0x65ae('0x5'));var client=jayson[_0x65ae('0x6')][_0x65ae('0x7')]({'port':0x232a});config[_0x65ae('0x8')]=_[_0x65ae('0x9')](config['redis'],{'host':_0x65ae('0xa'),'port':0x18eb});var socket=require(_0x65ae('0xb'))(new Redis(config[_0x65ae('0x8')]));require('./mailQueue.socket')[_0x65ae('0xc')](socket);function respondWithRpcPromise(_0x23b9a8,_0x7e4068,_0x2c350c){return new BPromise(function(_0x1779ce,_0x3255fe){return client[_0x65ae('0xd')](_0x23b9a8,_0x2c350c)[_0x65ae('0xe')](function(_0x181d6b){logger['info'](_0x65ae('0xf'),_0x7e4068,'request\x20sent');logger[_0x65ae('0x10')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x7e4068,_0x65ae('0x11'),JSON[_0x65ae('0x12')](_0x181d6b));if(_0x181d6b[_0x65ae('0x13')]){if(_0x181d6b[_0x65ae('0x13')]['code']===0x1f4){logger[_0x65ae('0x13')](_0x65ae('0xf'),_0x7e4068,_0x181d6b[_0x65ae('0x13')][_0x65ae('0x14')]);return _0x3255fe(_0x181d6b[_0x65ae('0x13')][_0x65ae('0x14')]);}logger[_0x65ae('0x13')](_0x65ae('0xf'),_0x7e4068,_0x181d6b[_0x65ae('0x13')][_0x65ae('0x14')]);return _0x1779ce(_0x181d6b[_0x65ae('0x13')][_0x65ae('0x14')]);}else{logger[_0x65ae('0x15')]('MailQueue,\x20%s,\x20%s',_0x7e4068,_0x65ae('0x11'));_0x1779ce(_0x181d6b[_0x65ae('0x16')][_0x65ae('0x14')]);}})['catch'](function(_0x59ff17){logger[_0x65ae('0x13')](_0x65ae('0xf'),_0x7e4068,_0x59ff17);_0x3255fe(_0x59ff17);});});}exports[_0x65ae('0x17')]=function(_0x315b0c){var _0x376ebc=this;return new Promise(function(_0x550c63,_0x5aa293){return db['MailQueue'][_0x65ae('0x18')]({'raw':_0x315b0c['options']?_0x315b0c[_0x65ae('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x315b0c[_0x65ae('0x19')]?_0x315b0c[_0x65ae('0x19')][_0x65ae('0x1a')]||null:null,'attributes':_0x315b0c[_0x65ae('0x19')]?_0x315b0c['options'][_0x65ae('0x1b')]||null:null,'limit':_0x315b0c[_0x65ae('0x19')]?_0x315b0c[_0x65ae('0x19')][_0x65ae('0x1c')]||null:null,'include':_0x315b0c[_0x65ae('0x19')]?_0x315b0c[_0x65ae('0x19')][_0x65ae('0x1d')]?_[_0x65ae('0x1e')](_0x315b0c['options'][_0x65ae('0x1d')],function(_0x451908){return{'model':db[_0x451908[_0x65ae('0x1f')]],'as':_0x451908['as'],'attributes':_0x451908[_0x65ae('0x1b')],'include':_0x451908[_0x65ae('0x1d')]?_[_0x65ae('0x1e')](_0x451908[_0x65ae('0x1d')],function(_0x11a4bd){return{'model':db[_0x11a4bd[_0x65ae('0x1f')]],'as':_0x11a4bd['as'],'attributes':_0x11a4bd['attributes'],'include':_0x11a4bd[_0x65ae('0x1d')]?_[_0x65ae('0x1e')](_0x11a4bd[_0x65ae('0x1d')],function(_0x19fec7){return{'model':db[_0x19fec7[_0x65ae('0x1f')]],'as':_0x19fec7['as'],'attributes':_0x19fec7[_0x65ae('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x14c622){logger['info'](_0x65ae('0x17'),_0x315b0c);logger[_0x65ae('0x10')](_0x65ae('0x17'),_0x315b0c,JSON[_0x65ae('0x12')](_0x14c622));_0x550c63(_0x14c622);})[_0x65ae('0x20')](function(_0xb24017){logger[_0x65ae('0x13')](_0x65ae('0x17'),_0xb24017[_0x65ae('0x14')],_0x315b0c);_0x5aa293(_0x376ebc[_0x65ae('0x13')](0x1f4,_0xb24017['message']));});});};exports[_0x65ae('0x21')]=function(_0x32f475){var _0x136655=this;return new Promise(function(_0x163021,_0xb028fc){return db[_0x65ae('0x22')][_0x65ae('0x23')]({'raw':_0x32f475['options']?_0x32f475['options'][_0x65ae('0x24')]===undefined?!![]:![]:!![],'where':_0x32f475[_0x65ae('0x19')]?_0x32f475[_0x65ae('0x19')]['where']||null:null,'attributes':_0x32f475['options']?_0x32f475[_0x65ae('0x19')][_0x65ae('0x1b')]||null:null,'include':_0x32f475[_0x65ae('0x19')]?_0x32f475[_0x65ae('0x19')][_0x65ae('0x1d')]?_[_0x65ae('0x1e')](_0x32f475[_0x65ae('0x19')][_0x65ae('0x1d')],function(_0x24aec9){return{'model':db[_0x24aec9[_0x65ae('0x1f')]],'as':_0x24aec9['as'],'attributes':_0x24aec9[_0x65ae('0x1b')],'include':_0x24aec9[_0x65ae('0x1d')]?_[_0x65ae('0x1e')](_0x24aec9[_0x65ae('0x1d')],function(_0x36e04c){return{'model':db[_0x36e04c[_0x65ae('0x1f')]],'as':_0x36e04c['as'],'attributes':_0x36e04c[_0x65ae('0x1b')],'include':_0x36e04c[_0x65ae('0x1d')]?_[_0x65ae('0x1e')](_0x36e04c[_0x65ae('0x1d')],function(_0x1ccc34){return{'model':db[_0x1ccc34[_0x65ae('0x1f')]],'as':_0x1ccc34['as'],'attributes':_0x1ccc34[_0x65ae('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x65ae('0xe')](function(_0x42a2e){logger[_0x65ae('0x15')]('ShowMailQueue',_0x32f475);logger[_0x65ae('0x10')](_0x65ae('0x21'),_0x32f475,JSON['stringify'](_0x42a2e));_0x163021(_0x42a2e);})['catch'](function(_0x58557e){logger[_0x65ae('0x13')](_0x65ae('0x21'),_0x58557e[_0x65ae('0x14')],_0x32f475);_0xb028fc(_0x136655[_0x65ae('0x13')](0x1f4,_0x58557e[_0x65ae('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index e6503a1..4ce08ef 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 _0x867a=['remove','update','emit','removeListener','register','length','mailQueue:','./mailQueue.events','save'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x867a,0x15d));var _0xa867=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x867a[_0x3dd15e];return _0x231fd0;};'use strict';var MailQueueEvents=require(_0xa867('0x0'));var events=[_0xa867('0x1'),_0xa867('0x2'),_0xa867('0x3')];function createListener(_0x41741a,_0x5cb82e){return function(_0x321444){_0x5cb82e[_0xa867('0x4')](_0x41741a,_0x321444);};}function removeListener(_0x17a786,_0x3ca820){return function(){MailQueueEvents[_0xa867('0x5')](_0x17a786,_0x3ca820);};}exports[_0xa867('0x6')]=function(_0x354314){for(var _0x9c6bb4=0x0,_0x1904a4=events[_0xa867('0x7')];_0x9c6bb4<_0x1904a4;_0x9c6bb4++){var _0x2bea9b=events[_0x9c6bb4];var _0x4a157f=createListener(_0xa867('0x8')+_0x2bea9b,_0x354314);MailQueueEvents['on'](_0x2bea9b,_0x4a157f);}}; \ No newline at end of file +var _0xf7a3=['emit','register','length','mailQueue:','remove','update'];(function(_0x23f40a,_0x556ffc){var _0x14e216=function(_0x4fab71){while(--_0x4fab71){_0x23f40a['push'](_0x23f40a['shift']());}};_0x14e216(++_0x556ffc);}(_0xf7a3,0xac));var _0x3f7a=function(_0x13b7fd,_0x4eaf7f){_0x13b7fd=_0x13b7fd-0x0;var _0x32a74a=_0xf7a3[_0x13b7fd];return _0x32a74a;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=['save',_0x3f7a('0x0'),_0x3f7a('0x1')];function createListener(_0x5cec67,_0x99b502){return function(_0x5148b3){_0x99b502[_0x3f7a('0x2')](_0x5cec67,_0x5148b3);};}function removeListener(_0x449f54,_0xf61a3){return function(){MailQueueEvents['removeListener'](_0x449f54,_0xf61a3);};}exports[_0x3f7a('0x3')]=function(_0x72a19d){for(var _0x58d8e7=0x0,_0x1bb3e1=events[_0x3f7a('0x4')];_0x58d8e7<_0x1bb3e1;_0x58d8e7++){var _0x6148f0=events[_0x58d8e7];var _0x4e3edb=createListener(_0x3f7a('0x5')+_0x6148f0,_0x72a19d);MailQueueEvents['on'](_0x6148f0,_0x4e3edb);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 08e3dc2..48a9565 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 _0x82e7=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','isAuthenticated','index','get','/describe','describe','show','post','create','put','/:id','update'];(function(_0xc48aa1,_0xfdb375){var _0x56e331=function(_0x4cb9ea){while(--_0x4cb9ea){_0xc48aa1['push'](_0xc48aa1['shift']());}};_0x56e331(++_0xfdb375);}(_0x82e7,0x116));var _0x782e=function(_0x5e3230,_0xe10858){_0x5e3230=_0x5e3230-0x0;var _0x62ecfe=_0x82e7[_0x5e3230];return _0x62ecfe;};'use strict';var multer=require(_0x782e('0x0'));var util=require(_0x782e('0x1'));var path=require('path');var timeout=require(_0x782e('0x2'));var express=require(_0x782e('0x3'));var router=express[_0x782e('0x4')]();var fs_extra=require(_0x782e('0x5'));var auth=require(_0x782e('0x6'));var interaction=require(_0x782e('0x7'));var config=require(_0x782e('0x8'));var controller=require(_0x782e('0x9'));router['get']('/',auth[_0x782e('0xa')](),controller[_0x782e('0xb')]);router[_0x782e('0xc')](_0x782e('0xd'),auth['isAuthenticated'](),controller[_0x782e('0xe')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x782e('0xf')]);router[_0x782e('0x10')]('/',auth[_0x782e('0xa')](),controller[_0x782e('0x11')]);router[_0x782e('0x12')](_0x782e('0x13'),auth['isAuthenticated'](),controller[_0x782e('0x14')]);router['delete'](_0x782e('0x13'),auth['isAuthenticated'](),controller[_0x782e('0x15')]);module[_0x782e('0x16')]=router; \ No newline at end of file +var _0x2fab=['exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','index','get','isAuthenticated','describe','create','update','delete','/:id'];(function(_0x220fa6,_0x1a965a){var _0x321a8e=function(_0x17a7c7){while(--_0x17a7c7){_0x220fa6['push'](_0x220fa6['shift']());}};_0x321a8e(++_0x1a965a);}(_0x2fab,0x1a1));var _0xb2fa=function(_0x38c0eb,_0x17c7ce){_0x38c0eb=_0x38c0eb-0x0;var _0x2dbd1e=_0x2fab[_0x38c0eb];return _0x2dbd1e;};'use strict';var multer=require(_0xb2fa('0x0'));var util=require('util');var path=require(_0xb2fa('0x1'));var timeout=require(_0xb2fa('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb2fa('0x3'));var auth=require(_0xb2fa('0x4'));var interaction=require(_0xb2fa('0x5'));var config=require('../../config/environment');var controller=require(_0xb2fa('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xb2fa('0x7')]);router[_0xb2fa('0x8')]('/describe',auth[_0xb2fa('0x9')](),controller[_0xb2fa('0xa')]);router['get']('/:id',auth[_0xb2fa('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xb2fa('0xb')]);router['put']('/:id',auth[_0xb2fa('0x9')](),controller[_0xb2fa('0xc')]);router[_0xb2fa('0xd')](_0xb2fa('0xe'),auth[_0xb2fa('0x9')](),controller['destroy']);module[_0xb2fa('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 599f6f4..7120fe2 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 _0x3835=['moment','sequelize','exports','STRING','DATE'];(function(_0x20181c,_0x46061){var _0x50ae86=function(_0xd8b624){while(--_0xd8b624){_0x20181c['push'](_0x20181c['shift']());}};_0x50ae86(++_0x46061);}(_0x3835,0x1db));var _0x5383=function(_0x6de9f6,_0x42178a){_0x6de9f6=_0x6de9f6-0x0;var _0x156549=_0x3835[_0x6de9f6];return _0x156549;};'use strict';var moment=require(_0x5383('0x0'));var Sequelize=require(_0x5383('0x1'));module[_0x5383('0x2')]={'uniqueid':{'type':Sequelize[_0x5383('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x5383('0x3')]},'joinAt':{'type':Sequelize[_0x5383('0x4')]},'leaveAt':{'type':Sequelize[_0x5383('0x4')]},'acceptAt':{'type':Sequelize[_0x5383('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x5383('0x3')]}}; \ No newline at end of file +var _0xc11f=['DATE','moment','exports','STRING'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xc11f,0x1b5));var _0xfc11=function(_0x18af59,_0x2dad50){_0x18af59=_0x18af59-0x0;var _0x4366da=_0xc11f[_0x18af59];return _0x4366da;};'use strict';var moment=require(_0xfc11('0x0'));var Sequelize=require('sequelize');module[_0xfc11('0x1')]={'uniqueid':{'type':Sequelize[_0xfc11('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xfc11('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xfc11('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xfc11('0x3')]},'reason':{'type':Sequelize[_0xfc11('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 44f619d..64c64bc 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 _0x01d9=['rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','name','send','index','map','MailQueueReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x901d('0x0'));var rimraf=require(_0x901d('0x1'));var zipdir=require(_0x901d('0x2'));var jsonpatch=require(_0x901d('0x3'));var rp=require('request-promise');var moment=require(_0x901d('0x4'));var BPromise=require(_0x901d('0x5'));var Mustache=require(_0x901d('0x6'));var util=require(_0x901d('0x7'));var path=require(_0x901d('0x8'));var sox=require(_0x901d('0x9'));var csv=require(_0x901d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x901d('0xb'));var _=require(_0x901d('0xc'));var squel=require(_0x901d('0xd'));var crypto=require(_0x901d('0xe'));var jsforce=require(_0x901d('0xf'));var deskjs=require(_0x901d('0x10'));var toCsv=require(_0x901d('0xa'));var querystring=require(_0x901d('0x11'));var Papa=require(_0x901d('0x12'));var Redis=require(_0x901d('0x13'));var authService=require(_0x901d('0x14'));var qs=require(_0x901d('0x15'));var as=require(_0x901d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x901d('0x17'))('api');var utils=require(_0x901d('0x18'));var config=require(_0x901d('0x19'));var licenseUtil=require(_0x901d('0x1a'));var db=require(_0x901d('0x1b'))['db'];function respondWithStatusCode(_0x15ebaf,_0x5d2345){_0x5d2345=_0x5d2345||0xcc;return function(_0x1d8117){if(_0x1d8117){return _0x15ebaf[_0x901d('0x1c')](_0x5d2345);}return _0x15ebaf[_0x901d('0x1d')](_0x5d2345)[_0x901d('0x1e')]();};}function respondWithResult(_0xb8869a,_0x14d99b){_0x14d99b=_0x14d99b||0xc8;return function(_0x530a2b){if(_0x530a2b){return _0xb8869a[_0x901d('0x1d')](_0x14d99b)[_0x901d('0x1f')](_0x530a2b);}};}function respondWithFilteredResult(_0x11b0cc,_0x17d451){return function(_0x1aba97){if(_0x1aba97){var _0x7dd5f4=typeof _0x17d451[_0x901d('0x20')]===_0x901d('0x21')&&typeof _0x17d451[_0x901d('0x22')]===_0x901d('0x21');var _0x28caae=_0x1aba97[_0x901d('0x23')];var _0x285353=_0x7dd5f4?0x0:_0x17d451[_0x901d('0x20')];var _0x38f42b=_0x7dd5f4?_0x1aba97[_0x901d('0x23')]:_0x17d451[_0x901d('0x20')]+_0x17d451[_0x901d('0x22')];var _0x57d518;if(_0x38f42b>=_0x28caae){_0x38f42b=_0x28caae;_0x57d518=0xc8;}else{_0x57d518=0xce;}_0x11b0cc[_0x901d('0x1d')](_0x57d518);return _0x11b0cc[_0x901d('0x24')]('Content-Range',_0x285353+'-'+_0x38f42b+'/'+_0x28caae)['json'](_0x1aba97);}return null;};}function patchUpdates(_0x496a06){return function(_0x53f8ae){try{jsonpatch[_0x901d('0x25')](_0x53f8ae,_0x496a06,!![]);}catch(_0x44ea6f){return BPromise['reject'](_0x44ea6f);}return _0x53f8ae[_0x901d('0x26')]();};}function saveUpdates(_0x3ea3f6,_0x488e24){return function(_0x20778b){if(_0x20778b){return _0x20778b[_0x901d('0x27')](_0x3ea3f6)[_0x901d('0x28')](function(_0x3f80b9){return _0x3f80b9;});}return null;};}function removeEntity(_0x1e7d36,_0x1818d3){return function(_0x46e5c6){if(_0x46e5c6){return _0x46e5c6[_0x901d('0x29')]()['then'](function(){_0x1e7d36[_0x901d('0x1d')](0xcc)[_0x901d('0x1e')]();});}};}function handleEntityNotFound(_0xbc89a5,_0x1f0ee5){return function(_0x557809){if(!_0x557809){_0xbc89a5[_0x901d('0x1c')](0x194);}return _0x557809;};}function handleError(_0x23fd43,_0x27f4ca){_0x27f4ca=_0x27f4ca||0x1f4;return function(_0x3cbe43){logger[_0x901d('0x2a')](_0x3cbe43['stack']);if(_0x3cbe43[_0x901d('0x2b')]){delete _0x3cbe43[_0x901d('0x2b')];}_0x23fd43[_0x901d('0x1d')](_0x27f4ca)[_0x901d('0x2c')](_0x3cbe43);};}exports[_0x901d('0x2d')]=function(_0x3de9b9,_0x48e86e){var _0xae6dfe={},_0x533038={},_0x128830={'count':0x0,'rows':[]};var _0x389fd9=_[_0x901d('0x2e')](db[_0x901d('0x2f')][_0x901d('0x30')],function(_0x20df02){return{'name':_0x20df02[_0x901d('0x31')],'type':_0x20df02[_0x901d('0x32')][_0x901d('0x33')]};});_0x533038[_0x901d('0x34')]=_[_0x901d('0x2e')](_0x389fd9,_0x901d('0x2b'));_0x533038[_0x901d('0x35')]=_[_0x901d('0x36')](_0x3de9b9[_0x901d('0x35')]);_0x533038['filters']=_[_0x901d('0x37')](_0x533038[_0x901d('0x34')],_0x533038[_0x901d('0x35')]);_0xae6dfe['attributes']=_[_0x901d('0x37')](_0x533038[_0x901d('0x34')],qs[_0x901d('0x38')](_0x3de9b9[_0x901d('0x35')][_0x901d('0x38')]));_0xae6dfe[_0x901d('0x39')]=_0xae6dfe[_0x901d('0x39')][_0x901d('0x3a')]?_0xae6dfe[_0x901d('0x39')]:_0x533038[_0x901d('0x34')];if(!_0x3de9b9['query']['hasOwnProperty'](_0x901d('0x3b'))){_0xae6dfe['limit']=qs[_0x901d('0x22')](_0x3de9b9[_0x901d('0x35')]['limit']);_0xae6dfe[_0x901d('0x20')]=qs[_0x901d('0x20')](_0x3de9b9[_0x901d('0x35')]['offset']);}_0xae6dfe[_0x901d('0x3c')]=qs[_0x901d('0x3d')](_0x3de9b9[_0x901d('0x35')][_0x901d('0x3d')]);_0xae6dfe[_0x901d('0x3e')]=qs[_0x901d('0x3f')](_[_0x901d('0x40')](_0x3de9b9[_0x901d('0x35')],_0x533038[_0x901d('0x3f')]),_0x389fd9);if(_0x3de9b9[_0x901d('0x35')][_0x901d('0x41')]){_0xae6dfe[_0x901d('0x3e')]=_[_0x901d('0x42')](_0xae6dfe[_0x901d('0x3e')],{'$or':_[_0x901d('0x2e')](_0x389fd9,function(_0x1644d8){if(_0x1644d8['type']!==_0x901d('0x43')){var _0x423cab={};_0x423cab[_0x1644d8['name']]={'$like':'%'+_0x3de9b9['query'][_0x901d('0x41')]+'%'};return _0x423cab;}})});}_0xae6dfe=_['merge']({},_0xae6dfe,_0x3de9b9[_0x901d('0x44')]);var _0x3d0556={'where':_0xae6dfe[_0x901d('0x3e')]};return db[_0x901d('0x2f')][_0x901d('0x23')](_0x3d0556)[_0x901d('0x28')](function(_0x5df4cb){_0x128830['count']=_0x5df4cb;if(_0x3de9b9['query']['includeAll']){_0xae6dfe[_0x901d('0x45')]=[{'all':!![]}];}return db[_0x901d('0x2f')]['findAll'](_0xae6dfe);})[_0x901d('0x28')](function(_0x22fc44){_0x128830['rows']=_0x22fc44;return _0x128830;})[_0x901d('0x28')](respondWithFilteredResult(_0x48e86e,_0xae6dfe))[_0x901d('0x46')](handleError(_0x48e86e,null));};exports[_0x901d('0x47')]=function(_0x2c1895,_0x53663d){var _0x5aeb41={'raw':!![],'where':{'id':_0x2c1895[_0x901d('0x48')]['id']}},_0xa9c008={};_0xa9c008[_0x901d('0x34')]=_[_0x901d('0x36')](db[_0x901d('0x2f')][_0x901d('0x30')]);_0xa9c008[_0x901d('0x35')]=_[_0x901d('0x36')](_0x2c1895[_0x901d('0x35')]);_0xa9c008[_0x901d('0x3f')]=_[_0x901d('0x37')](_0xa9c008['model'],_0xa9c008[_0x901d('0x35')]);_0x5aeb41['attributes']=_[_0x901d('0x37')](_0xa9c008['model'],qs[_0x901d('0x38')](_0x2c1895['query'][_0x901d('0x38')]));_0x5aeb41[_0x901d('0x39')]=_0x5aeb41[_0x901d('0x39')][_0x901d('0x3a')]?_0x5aeb41[_0x901d('0x39')]:_0xa9c008[_0x901d('0x34')];if(_0x2c1895[_0x901d('0x35')][_0x901d('0x49')]){_0x5aeb41[_0x901d('0x45')]=[{'all':!![]}];}_0x5aeb41=_[_0x901d('0x42')]({},_0x5aeb41,_0x2c1895[_0x901d('0x44')]);return db['MailQueueReport'][_0x901d('0x4a')](_0x5aeb41)[_0x901d('0x28')](handleEntityNotFound(_0x53663d,null))[_0x901d('0x28')](respondWithResult(_0x53663d,null))[_0x901d('0x46')](handleError(_0x53663d,null));};exports[_0x901d('0x4b')]=function(_0x24b6fa,_0x27459b){return db[_0x901d('0x2f')][_0x901d('0x4b')](_0x24b6fa[_0x901d('0x4c')],{})[_0x901d('0x28')](respondWithResult(_0x27459b,0xc9))[_0x901d('0x46')](handleError(_0x27459b,null));};exports[_0x901d('0x27')]=function(_0x23f2a9,_0x4888e8){if(_0x23f2a9['body']['id']){delete _0x23f2a9[_0x901d('0x4c')]['id'];}return db[_0x901d('0x2f')][_0x901d('0x4a')]({'where':{'id':_0x23f2a9[_0x901d('0x48')]['id']}})[_0x901d('0x28')](handleEntityNotFound(_0x4888e8,null))['then'](saveUpdates(_0x23f2a9['body'],null))[_0x901d('0x28')](respondWithResult(_0x4888e8,null))[_0x901d('0x46')](handleError(_0x4888e8,null));};exports['destroy']=function(_0x23673d,_0x165207){return db['MailQueueReport'][_0x901d('0x4a')]({'where':{'id':_0x23673d['params']['id']}})[_0x901d('0x28')](handleEntityNotFound(_0x165207,null))[_0x901d('0x28')](removeEntity(_0x165207,null))[_0x901d('0x46')](handleError(_0x165207,null));};exports[_0x901d('0x4d')]=function(_0x52aa2d,_0x3a3ea6){return db[_0x901d('0x2f')][_0x901d('0x4d')]()[_0x901d('0x28')](respondWithResult(_0x3a3ea6,null))[_0x901d('0x46')](handleError(_0x3a3ea6,null));}; \ No newline at end of file +var _0xacf4=['findAll','rows','catch','show','params','intersection','length','includeAll','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','MailQueueReport','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','hasOwnProperty','sort','where','pick','filter','type','VIRTUAL','merge','options','include'];(function(_0x15ea09,_0x2f30ab){var _0x3e9c78=function(_0x15f8ba){while(--_0x15f8ba){_0x15ea09['push'](_0x15ea09['shift']());}};_0x3e9c78(++_0x2f30ab);}(_0xacf4,0xe7));var _0x4acf=function(_0x2d6df9,_0x45da50){_0x2d6df9=_0x2d6df9-0x0;var _0x429b18=_0xacf4[_0x2d6df9];return _0x429b18;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4acf('0x0'));var jsonpatch=require(_0x4acf('0x1'));var rp=require(_0x4acf('0x2'));var moment=require(_0x4acf('0x3'));var BPromise=require(_0x4acf('0x4'));var Mustache=require(_0x4acf('0x5'));var util=require(_0x4acf('0x6'));var path=require('path');var sox=require(_0x4acf('0x7'));var csv=require(_0x4acf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4acf('0x9'));var _=require(_0x4acf('0xa'));var squel=require(_0x4acf('0xb'));var crypto=require(_0x4acf('0xc'));var jsforce=require(_0x4acf('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4acf('0xe'));var Papa=require('papaparse');var Redis=require(_0x4acf('0xf'));var authService=require(_0x4acf('0x10'));var qs=require(_0x4acf('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4acf('0x12'));var logger=require(_0x4acf('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x4acf('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1783d2,_0x979f49){_0x979f49=_0x979f49||0xcc;return function(_0x3734e1){if(_0x3734e1){return _0x1783d2[_0x4acf('0x15')](_0x979f49);}return _0x1783d2[_0x4acf('0x16')](_0x979f49)[_0x4acf('0x17')]();};}function respondWithResult(_0x7ab3ea,_0x15386a){_0x15386a=_0x15386a||0xc8;return function(_0x2025ca){if(_0x2025ca){return _0x7ab3ea[_0x4acf('0x16')](_0x15386a)[_0x4acf('0x18')](_0x2025ca);}};}function respondWithFilteredResult(_0x5f0260,_0x1b584a){return function(_0x57d8e0){if(_0x57d8e0){var _0x34cec1=typeof _0x1b584a[_0x4acf('0x19')]===_0x4acf('0x1a')&&typeof _0x1b584a['limit']==='undefined';var _0x13d10e=_0x57d8e0[_0x4acf('0x1b')];var _0x240c00=_0x34cec1?0x0:_0x1b584a['offset'];var _0x2a678b=_0x34cec1?_0x57d8e0[_0x4acf('0x1b')]:_0x1b584a[_0x4acf('0x19')]+_0x1b584a[_0x4acf('0x1c')];var _0x2f0cec;if(_0x2a678b>=_0x13d10e){_0x2a678b=_0x13d10e;_0x2f0cec=0xc8;}else{_0x2f0cec=0xce;}_0x5f0260[_0x4acf('0x16')](_0x2f0cec);return _0x5f0260[_0x4acf('0x1d')](_0x4acf('0x1e'),_0x240c00+'-'+_0x2a678b+'/'+_0x13d10e)[_0x4acf('0x18')](_0x57d8e0);}return null;};}function patchUpdates(_0x2feb89){return function(_0x1a3118){try{jsonpatch['apply'](_0x1a3118,_0x2feb89,!![]);}catch(_0x28d698){return BPromise[_0x4acf('0x1f')](_0x28d698);}return _0x1a3118['save']();};}function saveUpdates(_0x41e5d2,_0x17775f){return function(_0x569d9e){if(_0x569d9e){return _0x569d9e[_0x4acf('0x20')](_0x41e5d2)[_0x4acf('0x21')](function(_0x433b7a){return _0x433b7a;});}return null;};}function removeEntity(_0x454555,_0x53885f){return function(_0x1a2286){if(_0x1a2286){return _0x1a2286[_0x4acf('0x22')]()['then'](function(){_0x454555[_0x4acf('0x16')](0xcc)[_0x4acf('0x17')]();});}};}function handleEntityNotFound(_0x52a84a,_0x126522){return function(_0x7ebb){if(!_0x7ebb){_0x52a84a[_0x4acf('0x15')](0x194);}return _0x7ebb;};}function handleError(_0x16458f,_0x571a30){_0x571a30=_0x571a30||0x1f4;return function(_0x50236d){logger[_0x4acf('0x23')](_0x50236d[_0x4acf('0x24')]);if(_0x50236d[_0x4acf('0x25')]){delete _0x50236d[_0x4acf('0x25')];}_0x16458f[_0x4acf('0x16')](_0x571a30)[_0x4acf('0x26')](_0x50236d);};}exports[_0x4acf('0x27')]=function(_0x7a1e79,_0x382c41){var _0x2a3830={},_0x57989e={},_0x3521c2={'count':0x0,'rows':[]};var _0x3f5614=_[_0x4acf('0x28')](db[_0x4acf('0x29')][_0x4acf('0x2a')],function(_0x28570f){return{'name':_0x28570f[_0x4acf('0x2b')],'type':_0x28570f['type'][_0x4acf('0x2c')]};});_0x57989e[_0x4acf('0x2d')]=_[_0x4acf('0x28')](_0x3f5614,'name');_0x57989e[_0x4acf('0x2e')]=_[_0x4acf('0x2f')](_0x7a1e79[_0x4acf('0x2e')]);_0x57989e[_0x4acf('0x30')]=_['intersection'](_0x57989e[_0x4acf('0x2d')],_0x57989e[_0x4acf('0x2e')]);_0x2a3830[_0x4acf('0x31')]=_['intersection'](_0x57989e[_0x4acf('0x2d')],qs[_0x4acf('0x32')](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x32')]));_0x2a3830[_0x4acf('0x31')]=_0x2a3830[_0x4acf('0x31')]['length']?_0x2a3830[_0x4acf('0x31')]:_0x57989e[_0x4acf('0x2d')];if(!_0x7a1e79['query'][_0x4acf('0x33')]('nolimit')){_0x2a3830['limit']=qs['limit'](_0x7a1e79['query']['limit']);_0x2a3830['offset']=qs['offset'](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x19')]);}_0x2a3830['order']=qs[_0x4acf('0x34')](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x34')]);_0x2a3830[_0x4acf('0x35')]=qs[_0x4acf('0x30')](_[_0x4acf('0x36')](_0x7a1e79[_0x4acf('0x2e')],_0x57989e[_0x4acf('0x30')]),_0x3f5614);if(_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x37')]){_0x2a3830['where']=_['merge'](_0x2a3830[_0x4acf('0x35')],{'$or':_[_0x4acf('0x28')](_0x3f5614,function(_0x4859b6){if(_0x4859b6[_0x4acf('0x38')]!==_0x4acf('0x39')){var _0x43a2ea={};_0x43a2ea[_0x4859b6[_0x4acf('0x25')]]={'$like':'%'+_0x7a1e79['query']['filter']+'%'};return _0x43a2ea;}})});}_0x2a3830=_[_0x4acf('0x3a')]({},_0x2a3830,_0x7a1e79[_0x4acf('0x3b')]);var _0x3d5529={'where':_0x2a3830[_0x4acf('0x35')]};return db['MailQueueReport'][_0x4acf('0x1b')](_0x3d5529)[_0x4acf('0x21')](function(_0x4e9370){_0x3521c2['count']=_0x4e9370;if(_0x7a1e79['query']['includeAll']){_0x2a3830[_0x4acf('0x3c')]=[{'all':!![]}];}return db[_0x4acf('0x29')][_0x4acf('0x3d')](_0x2a3830);})['then'](function(_0x1015e3){_0x3521c2[_0x4acf('0x3e')]=_0x1015e3;return _0x3521c2;})[_0x4acf('0x21')](respondWithFilteredResult(_0x382c41,_0x2a3830))[_0x4acf('0x3f')](handleError(_0x382c41,null));};exports[_0x4acf('0x40')]=function(_0xea75e4,_0x7cf2a){var _0x17d5e9={'raw':!![],'where':{'id':_0xea75e4[_0x4acf('0x41')]['id']}},_0x461547={};_0x461547[_0x4acf('0x2d')]=_['keys'](db[_0x4acf('0x29')][_0x4acf('0x2a')]);_0x461547[_0x4acf('0x2e')]=_[_0x4acf('0x2f')](_0xea75e4[_0x4acf('0x2e')]);_0x461547['filters']=_['intersection'](_0x461547[_0x4acf('0x2d')],_0x461547[_0x4acf('0x2e')]);_0x17d5e9[_0x4acf('0x31')]=_[_0x4acf('0x42')](_0x461547[_0x4acf('0x2d')],qs[_0x4acf('0x32')](_0xea75e4['query'][_0x4acf('0x32')]));_0x17d5e9['attributes']=_0x17d5e9[_0x4acf('0x31')][_0x4acf('0x43')]?_0x17d5e9['attributes']:_0x461547['model'];if(_0xea75e4[_0x4acf('0x2e')][_0x4acf('0x44')]){_0x17d5e9[_0x4acf('0x3c')]=[{'all':!![]}];}_0x17d5e9=_[_0x4acf('0x3a')]({},_0x17d5e9,_0xea75e4['options']);return db[_0x4acf('0x29')][_0x4acf('0x45')](_0x17d5e9)[_0x4acf('0x21')](handleEntityNotFound(_0x7cf2a,null))[_0x4acf('0x21')](respondWithResult(_0x7cf2a,null))[_0x4acf('0x3f')](handleError(_0x7cf2a,null));};exports[_0x4acf('0x46')]=function(_0x1bd7d0,_0x2d946c){return db['MailQueueReport']['create'](_0x1bd7d0[_0x4acf('0x47')],{})[_0x4acf('0x21')](respondWithResult(_0x2d946c,0xc9))[_0x4acf('0x3f')](handleError(_0x2d946c,null));};exports[_0x4acf('0x20')]=function(_0x287406,_0x859247){if(_0x287406[_0x4acf('0x47')]['id']){delete _0x287406[_0x4acf('0x47')]['id'];}return db[_0x4acf('0x29')][_0x4acf('0x45')]({'where':{'id':_0x287406[_0x4acf('0x41')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x859247,null))['then'](saveUpdates(_0x287406[_0x4acf('0x47')],null))[_0x4acf('0x21')](respondWithResult(_0x859247,null))[_0x4acf('0x3f')](handleError(_0x859247,null));};exports[_0x4acf('0x22')]=function(_0x392dac,_0x3cf54a){return db[_0x4acf('0x29')][_0x4acf('0x45')]({'where':{'id':_0x392dac[_0x4acf('0x41')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x3cf54a,null))[_0x4acf('0x21')](removeEntity(_0x3cf54a,null))[_0x4acf('0x3f')](handleError(_0x3cf54a,null));};exports[_0x4acf('0x48')]=function(_0x2b62bc,_0x113425){return db[_0x4acf('0x29')]['describe']()[_0x4acf('0x21')](respondWithResult(_0x113425,null))[_0x4acf('0x3f')](handleError(_0x113425,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 4007947..95e7e69 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 _0xbe52=['path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','report_mail_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xbe52,0x133));var _0x2be5=function(_0x2e7051,_0x4ac3a8){_0x2e7051=_0x2e7051-0x0;var _0x52db1c=_0xbe52[_0x2e7051];return _0x52db1c;};'use strict';var _=require(_0x2be5('0x0'));var util=require('util');var logger=require(_0x2be5('0x1'))(_0x2be5('0x2'));var moment=require(_0x2be5('0x3'));var BPromise=require(_0x2be5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2be5('0x5'));var rimraf=require(_0x2be5('0x6'));var config=require(_0x2be5('0x7'));var attributes=require(_0x2be5('0x8'));module[_0x2be5('0x9')]=function(_0x5df3d4,_0x582a00){return _0x5df3d4['define']('MailQueueReport',attributes,{'tableName':_0x2be5('0xa'),'paranoid':![],'indexes':[{'name':_0x2be5('0xb'),'fields':[_0x2be5('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd6e5=['uniqueid','lodash','../../config/logger','bluebird','path','./mailQueueReport.attributes','define','MailQueueReport','report_mail_queue'];(function(_0x2d7116,_0xbf7571){var _0x3a82c6=function(_0x3b8a17){while(--_0x3b8a17){_0x2d7116['push'](_0x2d7116['shift']());}};_0x3a82c6(++_0xbf7571);}(_0xd6e5,0x184));var _0x5d6e=function(_0x41cb2e,_0x24088c){_0x41cb2e=_0x41cb2e-0x0;var _0x555a54=_0xd6e5[_0x41cb2e];return _0x555a54;};'use strict';var _=require(_0x5d6e('0x0'));var util=require('util');var logger=require(_0x5d6e('0x1'))('api');var moment=require('moment');var BPromise=require(_0x5d6e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5d6e('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5d6e('0x4'));module['exports']=function(_0x582ab4,_0x169fc7){return _0x582ab4[_0x5d6e('0x5')](_0x5d6e('0x6'),attributes,{'tableName':_0x5d6e('0x7'),'paranoid':![],'indexes':[{'name':_0x5d6e('0x8'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 7314fce..8fc8166 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 _0x5f2f=['error','code','message','request\x20sent','result','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','UpdateMailQueueReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailQueueReport,\x20%s,\x20%s','debug','stringify'];(function(_0x10bd12,_0x41957b){var _0x2c8342=function(_0x4069c3){while(--_0x4069c3){_0x10bd12['push'](_0x10bd12['shift']());}};_0x2c8342(++_0x41957b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1734cf,_0x198405){_0x1734cf=_0x1734cf-0x0;var _0x524290=_0x5f2f[_0x1734cf];return _0x524290;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x47acfc){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger['debug'](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x47acfc));_0x4ff59b(_0x47acfc);})[_0xf5f2('0x16')](function(_0x39c024){logger[_0xf5f2('0x11')]('CreateMailQueueReport',_0x39c024[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x39c024[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x1d')]=function(_0x287ad5){var _0x5bdf4a=this;return new Promise(function(_0x529f07,_0x5f1124){return db[_0xf5f2('0x18')][_0xf5f2('0x1e')](_0x287ad5[_0xf5f2('0x1a')],{'raw':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')]['where']||null:null,'attributes':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null,'limit':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x20')]||null:null})['then'](function(_0x53cb96){logger[_0xf5f2('0xd')](_0xf5f2('0x1d'),_0x287ad5);logger[_0xf5f2('0xf')]('UpdateMailQueueReport',_0x287ad5,JSON['stringify'](_0x53cb96));_0x529f07(_0x53cb96);})[_0xf5f2('0x16')](function(_0x50b8a2){logger[_0xf5f2('0x11')](_0xf5f2('0x1d'),_0x50b8a2[_0xf5f2('0x13')],_0x287ad5);_0x5f1124(_0x5bdf4a['error'](0x1f4,_0x50b8a2['message']));});});}; \ No newline at end of file +var _0xadb5=['MailQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailQueueReport','create','options','raw','debug','MailQueueReport','body','attributes','limit','UpdateMailQueueReport','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x5263ac,_0x7e13da){var _0x49df66=function(_0x511cf7){while(--_0x511cf7){_0x5263ac['push'](_0x5263ac['shift']());}};_0x49df66(++_0x7e13da);}(_0xadb5,0xad));var _0x5adb=function(_0x57cf36,_0x4b6e17){_0x57cf36=_0x57cf36-0x0;var _0x3ec0a5=_0xadb5[_0x57cf36];return _0x3ec0a5;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailQueueReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});}exports[_0x5adb('0x15')]=function(_0x529b65){var _0x3fff62=this;return new Promise(function(_0x5de028,_0x1d9e86){return db['MailQueueReport'][_0x5adb('0x16')](_0x529b65['body'],{'raw':_0x529b65['options']?_0x529b65[_0x5adb('0x17')][_0x5adb('0x18')]===undefined?!![]:![]:!![]})[_0x5adb('0xb')](function(_0x1fd4a7){logger[_0x5adb('0xc')]('CreateMailQueueReport',_0x529b65);logger[_0x5adb('0x19')]('CreateMailQueueReport',_0x529b65,JSON['stringify'](_0x1fd4a7));_0x5de028(_0x1fd4a7);})[_0x5adb('0x14')](function(_0x379b33){logger[_0x5adb('0x10')](_0x5adb('0x15'),_0x379b33[_0x5adb('0x12')],_0x529b65);_0x1d9e86(_0x3fff62[_0x5adb('0x10')](0x1f4,_0x379b33[_0x5adb('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x4b1957){var _0x373cc3=this;return new Promise(function(_0x3220cd,_0x3839fb){return db[_0x5adb('0x1a')]['update'](_0x4b1957[_0x5adb('0x1b')],{'raw':_0x4b1957[_0x5adb('0x17')]?_0x4b1957['options'][_0x5adb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')]['where']||null:null,'attributes':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1c')]||null:null,'limit':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1d')]||null:null})['then'](function(_0x49992e){logger['info'](_0x5adb('0x1e'),_0x4b1957);logger[_0x5adb('0x19')](_0x5adb('0x1e'),_0x4b1957,JSON[_0x5adb('0xf')](_0x49992e));_0x3220cd(_0x49992e);})[_0x5adb('0x14')](function(_0x4de310){logger[_0x5adb('0x10')](_0x5adb('0x1e'),_0x4de310[_0x5adb('0x12')],_0x4b1957);_0x3839fb(_0x373cc3[_0x5adb('0x10')](0x1f4,_0x4de310[_0x5adb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 35ab39e..a66c458 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x34a52b,_0x3ffd04){var _0x1f0fa3=function(_0x542244){while(--_0x542244){_0x34a52b['push'](_0x34a52b['shift']());}};_0x1f0fa3(++_0x3ffd04);}(_0x70e0,0x17b));var _0x070e=function(_0x1b16a5,_0x423765){_0x1b16a5=_0x1b16a5-0x0;var _0x479765=_0x70e0[_0x1b16a5];return _0x479765;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3fc017,_0x288faf){var _0x542e8c=function(_0x42438c){while(--_0x42438c){_0x3fc017['push'](_0x3fc017['shift']());}};_0x542e8c(++_0x288faf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index a771521..47c0b52 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 _0xfca8=['exports','STRING','BOOLEAN','INTEGER','INBOX','sequelize'];(function(_0x1805a5,_0x42be91){var _0x5b9776=function(_0x4319ec){while(--_0x4319ec){_0x1805a5['push'](_0x1805a5['shift']());}};_0x5b9776(++_0x42be91);}(_0xfca8,0x1c1));var _0x8fca=function(_0xfe4398,_0x17c19a){_0xfe4398=_0xfe4398-0x0;var _0x557fa0=_0xfca8[_0xfe4398];return _0x557fa0;};'use strict';var Sequelize=require(_0x8fca('0x0'));module[_0x8fca('0x1')]={'description':{'type':Sequelize[_0x8fca('0x2')]},'host':{'type':Sequelize[_0x8fca('0x2')]},'authentication':{'type':Sequelize[_0x8fca('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x8fca('0x2')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x8fca('0x4')]},'tls':{'type':Sequelize[_0x8fca('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x8fca('0x2')],'defaultValue':_0x8fca('0x5')},'connTimeout':{'type':Sequelize[_0x8fca('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x8fca('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x8fca('0x2')]},'modernAuthentication':{'type':Sequelize[_0x8fca('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x9956=['INTEGER','sequelize','exports','STRING','BOOLEAN','INBOX'];(function(_0x5a45aa,_0x3e065e){var _0xdcadaf=function(_0xd8e093){while(--_0xd8e093){_0x5a45aa['push'](_0x5a45aa['shift']());}};_0xdcadaf(++_0x3e065e);}(_0x9956,0x1b1));var _0x6995=function(_0xcc2917,_0x4ea96c){_0xcc2917=_0xcc2917-0x0;var _0x40c7d4=_0x9956[_0xcc2917];return _0x40c7d4;};'use strict';var Sequelize=require(_0x6995('0x0'));module[_0x6995('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x6995('0x2')]},'authentication':{'type':Sequelize[_0x6995('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x6995('0x2')]},'password':{'type':Sequelize[_0x6995('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x6995('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x6995('0x2')],'defaultValue':_0x6995('0x4')},'connTimeout':{'type':Sequelize[_0x6995('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x6995('0x5')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 4321d7b..7db112c 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 _0x5c89=['api','moment','bluebird','path','rimraf','../../config/environment','define','MailServerIn','lodash','util','../../config/logger'];(function(_0x2b1938,_0x20c675){var _0x5e4805=function(_0x2b629b){while(--_0x2b629b){_0x2b1938['push'](_0x2b1938['shift']());}};_0x5e4805(++_0x20c675);}(_0x5c89,0xd9));var _0x95c8=function(_0x295469,_0x16afe4){_0x295469=_0x295469-0x0;var _0x584b02=_0x5c89[_0x295469];return _0x584b02;};'use strict';var _=require(_0x95c8('0x0'));var util=require(_0x95c8('0x1'));var logger=require(_0x95c8('0x2'))(_0x95c8('0x3'));var moment=require(_0x95c8('0x4'));var BPromise=require(_0x95c8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x95c8('0x6'));var rimraf=require(_0x95c8('0x7'));var config=require(_0x95c8('0x8'));var attributes=require('./mailServerIn.attributes');module['exports']=function(_0x105d5c,_0x3f3a1c){return _0x105d5c[_0x95c8('0x9')](_0x95c8('0xa'),attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf6fa=['path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','lodash','api','moment','request-promise'];(function(_0x172266,_0x34c4de){var _0x4678b5=function(_0x18fc8e){while(--_0x18fc8e){_0x172266['push'](_0x172266['shift']());}};_0x4678b5(++_0x34c4de);}(_0xf6fa,0x8b));var _0xaf6f=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xf6fa[_0x465028];return _0xb783d4;};'use strict';var _=require(_0xaf6f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaf6f('0x1'));var moment=require(_0xaf6f('0x2'));var BPromise=require('bluebird');var rp=require(_0xaf6f('0x3'));var fs=require('fs');var path=require(_0xaf6f('0x4'));var rimraf=require(_0xaf6f('0x5'));var config=require(_0xaf6f('0x6'));var attributes=require(_0xaf6f('0x7'));module[_0xaf6f('0x8')]=function(_0x41cf8a,_0x313e50){return _0x41cf8a[_0xaf6f('0x9')](_0xaf6f('0xa'),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 e78a00a..496b2c0 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 _0x87f8=['attributes','info','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','include','map','model'];(function(_0x4a8b72,_0xb54e90){var _0x217237=function(_0x1d8f76){while(--_0x1d8f76){_0x4a8b72['push'](_0x4a8b72['shift']());}};_0x217237(++_0xb54e90);}(_0x87f8,0x152));var _0x887f=function(_0x240583,_0x2b719c){_0x240583=_0x240583-0x0;var _0x352702=_0x87f8[_0x240583];return _0x352702;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x887f('0x0'));var rs=require(_0x887f('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x887f('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x887f('0x3'))(_0x887f('0x4'));var config=require(_0x887f('0x5'));var jayson=require(_0x887f('0x6'));var client=jayson['client'][_0x887f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x330116,_0x200eb8,_0x40c7aa){return new BPromise(function(_0x3d0d5e,_0xc2c38){return client[_0x887f('0x8')](_0x330116,_0x40c7aa)['then'](function(_0x261382){logger['info'](_0x887f('0x9'),_0x200eb8,_0x887f('0xa'));logger[_0x887f('0xb')](_0x887f('0xc'),_0x200eb8,'request\x20sent',JSON[_0x887f('0xd')](_0x261382));if(_0x261382[_0x887f('0xe')]){if(_0x261382['error']['code']===0x1f4){logger[_0x887f('0xe')](_0x887f('0x9'),_0x200eb8,_0x261382[_0x887f('0xe')]['message']);return _0xc2c38(_0x261382[_0x887f('0xe')][_0x887f('0xf')]);}logger['error'](_0x887f('0x9'),_0x200eb8,_0x261382[_0x887f('0xe')]['message']);return _0x3d0d5e(_0x261382[_0x887f('0xe')][_0x887f('0xf')]);}else{logger['info'](_0x887f('0x9'),_0x200eb8,_0x887f('0xa'));_0x3d0d5e(_0x261382[_0x887f('0x10')]['message']);}})[_0x887f('0x11')](function(_0x2f3d36){logger['error'](_0x887f('0x9'),_0x200eb8,_0x2f3d36);_0xc2c38(_0x2f3d36);});});}exports[_0x887f('0x12')]=function(_0x3ab397){var _0x3d3b0c=this;return new Promise(function(_0x2399a5,_0x19a134){return db[_0x887f('0x13')][_0x887f('0x14')]({'raw':_0x3ab397[_0x887f('0x15')]?_0x3ab397[_0x887f('0x15')][_0x887f('0x16')]===undefined?!![]:![]:!![],'where':_0x3ab397[_0x887f('0x15')]?_0x3ab397[_0x887f('0x15')]['where']||null:null,'attributes':_0x3ab397[_0x887f('0x15')]?_0x3ab397[_0x887f('0x15')]['attributes']||null:null,'limit':_0x3ab397[_0x887f('0x15')]?_0x3ab397[_0x887f('0x15')]['limit']||null:null,'include':_0x3ab397[_0x887f('0x15')]?_0x3ab397['options'][_0x887f('0x17')]?_[_0x887f('0x18')](_0x3ab397['options'][_0x887f('0x17')],function(_0x3af68e){return{'model':db[_0x3af68e[_0x887f('0x19')]],'as':_0x3af68e['as'],'attributes':_0x3af68e[_0x887f('0x1a')],'include':_0x3af68e['include']?_[_0x887f('0x18')](_0x3af68e[_0x887f('0x17')],function(_0x5c7f41){return{'model':db[_0x5c7f41[_0x887f('0x19')]],'as':_0x5c7f41['as'],'attributes':_0x5c7f41[_0x887f('0x1a')],'include':_0x5c7f41['include']?_[_0x887f('0x18')](_0x5c7f41[_0x887f('0x17')],function(_0x108890){return{'model':db[_0x108890['model']],'as':_0x108890['as'],'attributes':_0x108890[_0x887f('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x49b715){logger[_0x887f('0x1b')](_0x887f('0x12'),_0x3ab397);logger[_0x887f('0xb')](_0x887f('0x12'),_0x3ab397,JSON[_0x887f('0xd')](_0x49b715));_0x2399a5(_0x49b715);})['catch'](function(_0x59d489){logger[_0x887f('0xe')](_0x887f('0x12'),_0x59d489[_0x887f('0xf')],_0x3ab397);_0x19a134(_0x3d3b0c[_0x887f('0xe')](0x1f4,_0x59d489['message']));});});}; \ No newline at end of file +var _0x12ae=['../../config/logger','rpc','../../config/environment','client','http','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','findAll','options','raw','where','include','map','model','attributes','then','GetMailServerIn','catch','util','moment','../../mysqldb','../../config/utils'];(function(_0x30e949,_0x199032){var _0x848fb6=function(_0x5a0cc9){while(--_0x5a0cc9){_0x30e949['push'](_0x30e949['shift']());}};_0x848fb6(++_0x199032);}(_0x12ae,0x175));var _0xe12a=function(_0x5ea101,_0x3f034a){_0x5ea101=_0x5ea101-0x0;var _0x39d51f=_0x12ae[_0x5ea101];return _0x39d51f;};'use strict';var _=require('lodash');var util=require(_0xe12a('0x0'));var moment=require(_0xe12a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe12a('0x2'))['db'];var utils=require(_0xe12a('0x3'));var logger=require(_0xe12a('0x4'))(_0xe12a('0x5'));var config=require(_0xe12a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xe12a('0x7')][_0xe12a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x296caf,_0x39a0d3,_0x234fa5){return new BPromise(function(_0x23503e,_0x15750a){return client['request'](_0x296caf,_0x234fa5)['then'](function(_0x457162){logger[_0xe12a('0x9')](_0xe12a('0xa'),_0x39a0d3,_0xe12a('0xb'));logger[_0xe12a('0xc')](_0xe12a('0xd'),_0x39a0d3,_0xe12a('0xb'),JSON[_0xe12a('0xe')](_0x457162));if(_0x457162[_0xe12a('0xf')]){if(_0x457162['error'][_0xe12a('0x10')]===0x1f4){logger[_0xe12a('0xf')]('MailServerIn,\x20%s,\x20%s',_0x39a0d3,_0x457162[_0xe12a('0xf')][_0xe12a('0x11')]);return _0x15750a(_0x457162['error'][_0xe12a('0x11')]);}logger[_0xe12a('0xf')]('MailServerIn,\x20%s,\x20%s',_0x39a0d3,_0x457162[_0xe12a('0xf')][_0xe12a('0x11')]);return _0x23503e(_0x457162[_0xe12a('0xf')][_0xe12a('0x11')]);}else{logger[_0xe12a('0x9')]('MailServerIn,\x20%s,\x20%s',_0x39a0d3,_0xe12a('0xb'));_0x23503e(_0x457162['result'][_0xe12a('0x11')]);}})['catch'](function(_0x3264b3){logger[_0xe12a('0xf')](_0xe12a('0xa'),_0x39a0d3,_0x3264b3);_0x15750a(_0x3264b3);});});}exports['GetMailServerIn']=function(_0x14b1e2){var _0x471bdd=this;return new Promise(function(_0xf6f1a6,_0x58ed7b){return db['MailServerIn'][_0xe12a('0x12')]({'raw':_0x14b1e2['options']?_0x14b1e2[_0xe12a('0x13')][_0xe12a('0x14')]===undefined?!![]:![]:!![],'where':_0x14b1e2[_0xe12a('0x13')]?_0x14b1e2[_0xe12a('0x13')][_0xe12a('0x15')]||null:null,'attributes':_0x14b1e2['options']?_0x14b1e2['options']['attributes']||null:null,'limit':_0x14b1e2[_0xe12a('0x13')]?_0x14b1e2[_0xe12a('0x13')]['limit']||null:null,'include':_0x14b1e2['options']?_0x14b1e2[_0xe12a('0x13')][_0xe12a('0x16')]?_[_0xe12a('0x17')](_0x14b1e2[_0xe12a('0x13')][_0xe12a('0x16')],function(_0x1f90b){return{'model':db[_0x1f90b[_0xe12a('0x18')]],'as':_0x1f90b['as'],'attributes':_0x1f90b[_0xe12a('0x19')],'include':_0x1f90b[_0xe12a('0x16')]?_[_0xe12a('0x17')](_0x1f90b[_0xe12a('0x16')],function(_0x2dcadd){return{'model':db[_0x2dcadd[_0xe12a('0x18')]],'as':_0x2dcadd['as'],'attributes':_0x2dcadd[_0xe12a('0x19')],'include':_0x2dcadd[_0xe12a('0x16')]?_[_0xe12a('0x17')](_0x2dcadd['include'],function(_0x261c2d){return{'model':db[_0x261c2d[_0xe12a('0x18')]],'as':_0x261c2d['as'],'attributes':_0x261c2d[_0xe12a('0x19')]};}):[]};}):[]};}):[]:[]})[_0xe12a('0x1a')](function(_0x48c62e){logger[_0xe12a('0x9')]('GetMailServerIn',_0x14b1e2);logger['debug'](_0xe12a('0x1b'),_0x14b1e2,JSON['stringify'](_0x48c62e));_0xf6f1a6(_0x48c62e);})[_0xe12a('0x1c')](function(_0x2ad4d6){logger[_0xe12a('0xf')]('GetMailServerIn',_0x2ad4d6[_0xe12a('0x11')],_0x14b1e2);_0x58ed7b(_0x471bdd[_0xe12a('0xf')](0x1f4,_0x2ad4d6[_0xe12a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 611ee05..355a527 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 _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(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('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 +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(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x7a54,0x106));var _0x47a5=function(_0x2dcaa7,_0x1d41e5){_0x2dcaa7=_0x2dcaa7-0x0;var _0x3925fe=_0x7a54[_0x2dcaa7];return _0x3925fe;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 7c6dac6..60d7763 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 _0x9354=['INTEGER','BOOLEAN','exports','STRING'];(function(_0x167242,_0x1af1c9){var _0x294268=function(_0x29e430){while(--_0x29e430){_0x167242['push'](_0x167242['shift']());}};_0x294268(++_0x1af1c9);}(_0x9354,0x96));var _0x4935=function(_0x4105a8,_0x198324){_0x4105a8=_0x4105a8-0x0;var _0x553f0c=_0x9354[_0x4105a8];return _0x553f0c;};'use strict';var Sequelize=require('sequelize');module[_0x4935('0x0')]={'description':{'type':Sequelize[_0x4935('0x1')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x4935('0x1')]},'pass':{'type':Sequelize[_0x4935('0x1')]},'port':{'type':Sequelize[_0x4935('0x2')]},'secure':{'type':Sequelize[_0x4935('0x3')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x4935('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x4935('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xb9be=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x5ad59d,_0xc93a6){var _0x3486c2=function(_0x15e565){while(--_0x15e565){_0x5ad59d['push'](_0x5ad59d['shift']());}};_0x3486c2(++_0xc93a6);}(_0xb9be,0xc5));var _0xeb9b=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0xb9be[_0x485b5a];return _0xd2b34d;};'use strict';var Sequelize=require(_0xeb9b('0x0'));module[_0xeb9b('0x1')]={'description':{'type':Sequelize[_0xeb9b('0x2')]},'host':{'type':Sequelize[_0xeb9b('0x2')]},'user':{'type':Sequelize[_0xeb9b('0x2')]},'pass':{'type':Sequelize[_0xeb9b('0x2')]},'port':{'type':Sequelize[_0xeb9b('0x3')]},'secure':{'type':Sequelize[_0xeb9b('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0xeb9b('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index ab8b1c6..b50c000 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 _0x4895=['rawAttributes','fieldName','type','name','query','keys','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','destroy','error','stack','send','index','map','MailServerOut'];(function(_0x1d9ee2,_0x435f93){var _0x59196c=function(_0x362412){while(--_0x362412){_0x1d9ee2['push'](_0x1d9ee2['shift']());}};_0x59196c(++_0x435f93);}(_0x4895,0x105));var _0x5489=function(_0x22dcff,_0x3c7020){_0x22dcff=_0x22dcff-0x0;var _0x37a552=_0x4895[_0x22dcff];return _0x37a552;};'use strict';var emlformat=require(_0x5489('0x0'));var rimraf=require(_0x5489('0x1'));var zipdir=require(_0x5489('0x2'));var jsonpatch=require(_0x5489('0x3'));var rp=require(_0x5489('0x4'));var moment=require(_0x5489('0x5'));var BPromise=require(_0x5489('0x6'));var Mustache=require('mustache');var util=require(_0x5489('0x7'));var path=require(_0x5489('0x8'));var sox=require(_0x5489('0x9'));var csv=require(_0x5489('0xa'));var ejs=require(_0x5489('0xb'));var fs=require('fs');var fs_extra=require(_0x5489('0xc'));var _=require(_0x5489('0xd'));var squel=require(_0x5489('0xe'));var crypto=require(_0x5489('0xf'));var jsforce=require(_0x5489('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5489('0x11'));var Papa=require('papaparse');var Redis=require(_0x5489('0x12'));var authService=require(_0x5489('0x13'));var qs=require(_0x5489('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5489('0x15'));var logger=require(_0x5489('0x16'))(_0x5489('0x17'));var utils=require(_0x5489('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x5489('0x19'));var db=require(_0x5489('0x1a'))['db'];function respondWithStatusCode(_0x1a2109,_0x3d46b){_0x3d46b=_0x3d46b||0xcc;return function(_0x490927){if(_0x490927){return _0x1a2109[_0x5489('0x1b')](_0x3d46b);}return _0x1a2109[_0x5489('0x1c')](_0x3d46b)[_0x5489('0x1d')]();};}function respondWithResult(_0x3635bc,_0x2ebfb6){_0x2ebfb6=_0x2ebfb6||0xc8;return function(_0x2ca6be){if(_0x2ca6be){return _0x3635bc[_0x5489('0x1c')](_0x2ebfb6)['json'](_0x2ca6be);}};}function respondWithFilteredResult(_0x43025c,_0xbd4885){return function(_0x5ebd76){if(_0x5ebd76){var _0x14d12c=typeof _0xbd4885[_0x5489('0x1e')]===_0x5489('0x1f')&&typeof _0xbd4885[_0x5489('0x20')]===_0x5489('0x1f');var _0x5aa3f0=_0x5ebd76['count'];var _0x785317=_0x14d12c?0x0:_0xbd4885[_0x5489('0x1e')];var _0x59468f=_0x14d12c?_0x5ebd76[_0x5489('0x21')]:_0xbd4885[_0x5489('0x1e')]+_0xbd4885[_0x5489('0x20')];var _0x3e2a0b;if(_0x59468f>=_0x5aa3f0){_0x59468f=_0x5aa3f0;_0x3e2a0b=0xc8;}else{_0x3e2a0b=0xce;}_0x43025c['status'](_0x3e2a0b);return _0x43025c['set'](_0x5489('0x22'),_0x785317+'-'+_0x59468f+'/'+_0x5aa3f0)[_0x5489('0x23')](_0x5ebd76);}return null;};}function patchUpdates(_0x51229a){return function(_0x5dfb89){try{jsonpatch['apply'](_0x5dfb89,_0x51229a,!![]);}catch(_0x1bf518){return BPromise[_0x5489('0x24')](_0x1bf518);}return _0x5dfb89[_0x5489('0x25')]();};}function saveUpdates(_0x21b4c4,_0x945ef1){return function(_0x2613e9){if(_0x2613e9){return _0x2613e9[_0x5489('0x26')](_0x21b4c4)[_0x5489('0x27')](function(_0x4c8bdc){return _0x4c8bdc;});}return null;};}function removeEntity(_0x36b480,_0x1c272f){return function(_0x1475f6){if(_0x1475f6){return _0x1475f6[_0x5489('0x28')]()[_0x5489('0x27')](function(){_0x36b480['status'](0xcc)[_0x5489('0x1d')]();});}};}function handleEntityNotFound(_0x5e7ebd,_0x2b6ed5){return function(_0x4cba9e){if(!_0x4cba9e){_0x5e7ebd['sendStatus'](0x194);}return _0x4cba9e;};}function handleError(_0x1342c9,_0x4172f5){_0x4172f5=_0x4172f5||0x1f4;return function(_0x10e199){logger[_0x5489('0x29')](_0x10e199[_0x5489('0x2a')]);if(_0x10e199['name']){delete _0x10e199['name'];}_0x1342c9['status'](_0x4172f5)[_0x5489('0x2b')](_0x10e199);};}exports[_0x5489('0x2c')]=function(_0x57da0b,_0x6c1d74){var _0x150210={},_0x4c4b5d={},_0x2c3a61={'count':0x0,'rows':[]};var _0x37df34=_[_0x5489('0x2d')](db[_0x5489('0x2e')][_0x5489('0x2f')],function(_0x512eef){return{'name':_0x512eef[_0x5489('0x30')],'type':_0x512eef[_0x5489('0x31')]['key']};});_0x4c4b5d['model']=_['map'](_0x37df34,_0x5489('0x32'));_0x4c4b5d[_0x5489('0x33')]=_[_0x5489('0x34')](_0x57da0b['query']);_0x4c4b5d['filters']=_['intersection'](_0x4c4b5d['model'],_0x4c4b5d[_0x5489('0x33')]);_0x150210[_0x5489('0x35')]=_[_0x5489('0x36')](_0x4c4b5d[_0x5489('0x37')],qs[_0x5489('0x38')](_0x57da0b[_0x5489('0x33')][_0x5489('0x38')]));_0x150210['attributes']=_0x150210[_0x5489('0x35')][_0x5489('0x39')]?_0x150210[_0x5489('0x35')]:_0x4c4b5d[_0x5489('0x37')];if(!_0x57da0b[_0x5489('0x33')][_0x5489('0x3a')](_0x5489('0x3b'))){_0x150210[_0x5489('0x20')]=qs[_0x5489('0x20')](_0x57da0b[_0x5489('0x33')]['limit']);_0x150210[_0x5489('0x1e')]=qs[_0x5489('0x1e')](_0x57da0b[_0x5489('0x33')][_0x5489('0x1e')]);}_0x150210['order']=qs[_0x5489('0x3c')](_0x57da0b['query']['sort']);_0x150210[_0x5489('0x3d')]=qs[_0x5489('0x3e')](_[_0x5489('0x3f')](_0x57da0b[_0x5489('0x33')],_0x4c4b5d[_0x5489('0x3e')]),_0x37df34);if(_0x57da0b['query'][_0x5489('0x40')]){_0x150210[_0x5489('0x3d')]=_[_0x5489('0x41')](_0x150210[_0x5489('0x3d')],{'$or':_['map'](_0x37df34,function(_0x4a7cc2){if(_0x4a7cc2[_0x5489('0x31')]!=='VIRTUAL'){var _0x27616c={};_0x27616c[_0x4a7cc2['name']]={'$like':'%'+_0x57da0b[_0x5489('0x33')][_0x5489('0x40')]+'%'};return _0x27616c;}})});}_0x150210=_['merge']({},_0x150210,_0x57da0b[_0x5489('0x42')]);var _0x9e4a3d={'where':_0x150210[_0x5489('0x3d')]};return db[_0x5489('0x2e')][_0x5489('0x21')](_0x9e4a3d)['then'](function(_0x5a9bc0){_0x2c3a61[_0x5489('0x21')]=_0x5a9bc0;if(_0x57da0b[_0x5489('0x33')][_0x5489('0x43')]){_0x150210[_0x5489('0x44')]=[{'all':!![]}];}return db[_0x5489('0x2e')][_0x5489('0x45')](_0x150210);})['then'](function(_0x2fef31){_0x2c3a61[_0x5489('0x46')]=_0x2fef31;return _0x2c3a61;})[_0x5489('0x27')](respondWithFilteredResult(_0x6c1d74,_0x150210))[_0x5489('0x47')](handleError(_0x6c1d74,null));};exports[_0x5489('0x48')]=function(_0x4c075a,_0x31d562){var _0x1d8cd5={'raw':!![],'where':{'id':_0x4c075a['params']['id']}},_0x443d05={};_0x443d05['model']=_[_0x5489('0x34')](db[_0x5489('0x2e')]['rawAttributes']);_0x443d05[_0x5489('0x33')]=_[_0x5489('0x34')](_0x4c075a[_0x5489('0x33')]);_0x443d05[_0x5489('0x3e')]=_[_0x5489('0x36')](_0x443d05[_0x5489('0x37')],_0x443d05[_0x5489('0x33')]);_0x1d8cd5['attributes']=_[_0x5489('0x36')](_0x443d05[_0x5489('0x37')],qs[_0x5489('0x38')](_0x4c075a[_0x5489('0x33')][_0x5489('0x38')]));_0x1d8cd5[_0x5489('0x35')]=_0x1d8cd5[_0x5489('0x35')][_0x5489('0x39')]?_0x1d8cd5[_0x5489('0x35')]:_0x443d05[_0x5489('0x37')];if(_0x4c075a[_0x5489('0x33')][_0x5489('0x43')]){_0x1d8cd5['include']=[{'all':!![]}];}_0x1d8cd5=_[_0x5489('0x41')]({},_0x1d8cd5,_0x4c075a[_0x5489('0x42')]);return db[_0x5489('0x2e')][_0x5489('0x49')](_0x1d8cd5)[_0x5489('0x27')](handleEntityNotFound(_0x31d562,null))[_0x5489('0x27')](respondWithResult(_0x31d562,null))[_0x5489('0x47')](handleError(_0x31d562,null));};exports[_0x5489('0x4a')]=function(_0x2d210b,_0x21d7aa){return db[_0x5489('0x2e')]['create'](_0x2d210b[_0x5489('0x4b')],{})[_0x5489('0x27')](respondWithResult(_0x21d7aa,0xc9))[_0x5489('0x47')](handleError(_0x21d7aa,null));};exports[_0x5489('0x26')]=function(_0x5f1404,_0x50ca67){if(_0x5f1404[_0x5489('0x4b')]['id']){delete _0x5f1404[_0x5489('0x4b')]['id'];}return db[_0x5489('0x2e')][_0x5489('0x49')]({'where':{'id':_0x5f1404['params']['id']}})['then'](handleEntityNotFound(_0x50ca67,null))['then'](saveUpdates(_0x5f1404[_0x5489('0x4b')],null))['then'](respondWithResult(_0x50ca67,null))[_0x5489('0x47')](handleError(_0x50ca67,null));};exports['destroy']=function(_0x2d6deb,_0x17b981){return db[_0x5489('0x2e')]['find']({'where':{'id':_0x2d6deb[_0x5489('0x4c')]['id']}})[_0x5489('0x27')](handleEntityNotFound(_0x17b981,null))['then'](removeEntity(_0x17b981,null))['catch'](handleError(_0x17b981,null));}; \ No newline at end of file +var _0x4c07=['rows','catch','show','keys','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','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','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','MailServerOut','rawAttributes','type','key','model','query','intersection','attributes','fields','length','nolimit','limit','order','sort','filters','filter','merge','where','includeAll','include','findAll'];(function(_0x5673c4,_0x5b672d){var _0x32b859=function(_0x4aa620){while(--_0x4aa620){_0x5673c4['push'](_0x5673c4['shift']());}};_0x32b859(++_0x5b672d);}(_0x4c07,0x9f));var _0x74c0=function(_0x1deb72,_0x3f6338){_0x1deb72=_0x1deb72-0x0;var _0x18bbdf=_0x4c07[_0x1deb72];return _0x18bbdf;};'use strict';var emlformat=require(_0x74c0('0x0'));var rimraf=require(_0x74c0('0x1'));var zipdir=require(_0x74c0('0x2'));var jsonpatch=require(_0x74c0('0x3'));var rp=require(_0x74c0('0x4'));var moment=require(_0x74c0('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x74c0('0x6'));var util=require(_0x74c0('0x7'));var path=require(_0x74c0('0x8'));var sox=require(_0x74c0('0x9'));var csv=require(_0x74c0('0xa'));var ejs=require(_0x74c0('0xb'));var fs=require('fs');var fs_extra=require(_0x74c0('0xc'));var _=require(_0x74c0('0xd'));var squel=require(_0x74c0('0xe'));var crypto=require(_0x74c0('0xf'));var jsforce=require(_0x74c0('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x74c0('0x11'));var Papa=require(_0x74c0('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x74c0('0x13'));var as=require(_0x74c0('0x14'));var hardwareService=require(_0x74c0('0x15'));var logger=require(_0x74c0('0x16'))(_0x74c0('0x17'));var utils=require(_0x74c0('0x18'));var config=require(_0x74c0('0x19'));var licenseUtil=require(_0x74c0('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ea341,_0x1585f3){_0x1585f3=_0x1585f3||0xcc;return function(_0x908ce6){if(_0x908ce6){return _0x2ea341[_0x74c0('0x1b')](_0x1585f3);}return _0x2ea341[_0x74c0('0x1c')](_0x1585f3)[_0x74c0('0x1d')]();};}function respondWithResult(_0x3a5899,_0xc293ee){_0xc293ee=_0xc293ee||0xc8;return function(_0x2579d2){if(_0x2579d2){return _0x3a5899[_0x74c0('0x1c')](_0xc293ee)[_0x74c0('0x1e')](_0x2579d2);}};}function respondWithFilteredResult(_0x2c3e27,_0x6ad583){return function(_0x1e537b){if(_0x1e537b){var _0x25bc65=typeof _0x6ad583[_0x74c0('0x1f')]==='undefined'&&typeof _0x6ad583['limit']==='undefined';var _0x25f4d9=_0x1e537b[_0x74c0('0x20')];var _0x3b4b06=_0x25bc65?0x0:_0x6ad583[_0x74c0('0x1f')];var _0x2ab78f=_0x25bc65?_0x1e537b[_0x74c0('0x20')]:_0x6ad583[_0x74c0('0x1f')]+_0x6ad583['limit'];var _0x3061cc;if(_0x2ab78f>=_0x25f4d9){_0x2ab78f=_0x25f4d9;_0x3061cc=0xc8;}else{_0x3061cc=0xce;}_0x2c3e27['status'](_0x3061cc);return _0x2c3e27['set'](_0x74c0('0x21'),_0x3b4b06+'-'+_0x2ab78f+'/'+_0x25f4d9)['json'](_0x1e537b);}return null;};}function patchUpdates(_0x1568cf){return function(_0x1e8d45){try{jsonpatch[_0x74c0('0x22')](_0x1e8d45,_0x1568cf,!![]);}catch(_0x529eac){return BPromise[_0x74c0('0x23')](_0x529eac);}return _0x1e8d45[_0x74c0('0x24')]();};}function saveUpdates(_0x438bd8,_0x364782){return function(_0x18a245){if(_0x18a245){return _0x18a245[_0x74c0('0x25')](_0x438bd8)[_0x74c0('0x26')](function(_0x24f149){return _0x24f149;});}return null;};}function removeEntity(_0x3de127,_0x293468){return function(_0x2b9b8f){if(_0x2b9b8f){return _0x2b9b8f[_0x74c0('0x27')]()['then'](function(){_0x3de127[_0x74c0('0x1c')](0xcc)[_0x74c0('0x1d')]();});}};}function handleEntityNotFound(_0x38e1dd,_0x514be5){return function(_0x493b5a){if(!_0x493b5a){_0x38e1dd[_0x74c0('0x1b')](0x194);}return _0x493b5a;};}function handleError(_0x2d7de5,_0x460d86){_0x460d86=_0x460d86||0x1f4;return function(_0x4c88fc){logger[_0x74c0('0x28')](_0x4c88fc[_0x74c0('0x29')]);if(_0x4c88fc['name']){delete _0x4c88fc[_0x74c0('0x2a')];}_0x2d7de5[_0x74c0('0x1c')](_0x460d86)[_0x74c0('0x2b')](_0x4c88fc);};}exports['index']=function(_0x3eef80,_0x6ef903){var _0x32cd5c={},_0x12d6a8={},_0x3fc8c7={'count':0x0,'rows':[]};var _0x1170c6=_[_0x74c0('0x2c')](db[_0x74c0('0x2d')][_0x74c0('0x2e')],function(_0xc76ed4){return{'name':_0xc76ed4['fieldName'],'type':_0xc76ed4[_0x74c0('0x2f')][_0x74c0('0x30')]};});_0x12d6a8[_0x74c0('0x31')]=_[_0x74c0('0x2c')](_0x1170c6,_0x74c0('0x2a'));_0x12d6a8[_0x74c0('0x32')]=_['keys'](_0x3eef80[_0x74c0('0x32')]);_0x12d6a8['filters']=_[_0x74c0('0x33')](_0x12d6a8['model'],_0x12d6a8[_0x74c0('0x32')]);_0x32cd5c[_0x74c0('0x34')]=_[_0x74c0('0x33')](_0x12d6a8[_0x74c0('0x31')],qs[_0x74c0('0x35')](_0x3eef80[_0x74c0('0x32')][_0x74c0('0x35')]));_0x32cd5c[_0x74c0('0x34')]=_0x32cd5c['attributes'][_0x74c0('0x36')]?_0x32cd5c['attributes']:_0x12d6a8[_0x74c0('0x31')];if(!_0x3eef80['query']['hasOwnProperty'](_0x74c0('0x37'))){_0x32cd5c[_0x74c0('0x38')]=qs[_0x74c0('0x38')](_0x3eef80['query'][_0x74c0('0x38')]);_0x32cd5c[_0x74c0('0x1f')]=qs[_0x74c0('0x1f')](_0x3eef80[_0x74c0('0x32')][_0x74c0('0x1f')]);}_0x32cd5c[_0x74c0('0x39')]=qs[_0x74c0('0x3a')](_0x3eef80[_0x74c0('0x32')][_0x74c0('0x3a')]);_0x32cd5c['where']=qs[_0x74c0('0x3b')](_['pick'](_0x3eef80[_0x74c0('0x32')],_0x12d6a8[_0x74c0('0x3b')]),_0x1170c6);if(_0x3eef80['query'][_0x74c0('0x3c')]){_0x32cd5c['where']=_[_0x74c0('0x3d')](_0x32cd5c[_0x74c0('0x3e')],{'$or':_[_0x74c0('0x2c')](_0x1170c6,function(_0x3c664f){if(_0x3c664f[_0x74c0('0x2f')]!=='VIRTUAL'){var _0x353eac={};_0x353eac[_0x3c664f[_0x74c0('0x2a')]]={'$like':'%'+_0x3eef80[_0x74c0('0x32')][_0x74c0('0x3c')]+'%'};return _0x353eac;}})});}_0x32cd5c=_['merge']({},_0x32cd5c,_0x3eef80['options']);var _0x1edf47={'where':_0x32cd5c[_0x74c0('0x3e')]};return db[_0x74c0('0x2d')][_0x74c0('0x20')](_0x1edf47)[_0x74c0('0x26')](function(_0x2b80d0){_0x3fc8c7[_0x74c0('0x20')]=_0x2b80d0;if(_0x3eef80['query'][_0x74c0('0x3f')]){_0x32cd5c[_0x74c0('0x40')]=[{'all':!![]}];}return db[_0x74c0('0x2d')][_0x74c0('0x41')](_0x32cd5c);})[_0x74c0('0x26')](function(_0x53ef9a){_0x3fc8c7[_0x74c0('0x42')]=_0x53ef9a;return _0x3fc8c7;})[_0x74c0('0x26')](respondWithFilteredResult(_0x6ef903,_0x32cd5c))[_0x74c0('0x43')](handleError(_0x6ef903,null));};exports[_0x74c0('0x44')]=function(_0x4a3400,_0x1e3d57){var _0x31adfc={'raw':!![],'where':{'id':_0x4a3400['params']['id']}},_0x5aecbf={};_0x5aecbf[_0x74c0('0x31')]=_[_0x74c0('0x45')](db[_0x74c0('0x2d')]['rawAttributes']);_0x5aecbf['query']=_[_0x74c0('0x45')](_0x4a3400[_0x74c0('0x32')]);_0x5aecbf[_0x74c0('0x3b')]=_['intersection'](_0x5aecbf[_0x74c0('0x31')],_0x5aecbf[_0x74c0('0x32')]);_0x31adfc['attributes']=_[_0x74c0('0x33')](_0x5aecbf['model'],qs[_0x74c0('0x35')](_0x4a3400['query'][_0x74c0('0x35')]));_0x31adfc[_0x74c0('0x34')]=_0x31adfc['attributes'][_0x74c0('0x36')]?_0x31adfc[_0x74c0('0x34')]:_0x5aecbf[_0x74c0('0x31')];if(_0x4a3400[_0x74c0('0x32')][_0x74c0('0x3f')]){_0x31adfc[_0x74c0('0x40')]=[{'all':!![]}];}_0x31adfc=_['merge']({},_0x31adfc,_0x4a3400[_0x74c0('0x46')]);return db['MailServerOut'][_0x74c0('0x47')](_0x31adfc)[_0x74c0('0x26')](handleEntityNotFound(_0x1e3d57,null))[_0x74c0('0x26')](respondWithResult(_0x1e3d57,null))[_0x74c0('0x43')](handleError(_0x1e3d57,null));};exports[_0x74c0('0x48')]=function(_0x205c46,_0x3826b9){return db[_0x74c0('0x2d')]['create'](_0x205c46[_0x74c0('0x49')],{})[_0x74c0('0x26')](respondWithResult(_0x3826b9,0xc9))['catch'](handleError(_0x3826b9,null));};exports[_0x74c0('0x25')]=function(_0xb233ac,_0x4de9d2){if(_0xb233ac[_0x74c0('0x49')]['id']){delete _0xb233ac[_0x74c0('0x49')]['id'];}return db[_0x74c0('0x2d')][_0x74c0('0x47')]({'where':{'id':_0xb233ac[_0x74c0('0x4a')]['id']}})[_0x74c0('0x26')](handleEntityNotFound(_0x4de9d2,null))[_0x74c0('0x26')](saveUpdates(_0xb233ac['body'],null))['then'](respondWithResult(_0x4de9d2,null))[_0x74c0('0x43')](handleError(_0x4de9d2,null));};exports[_0x74c0('0x27')]=function(_0x28d022,_0x2a73bd){return db['MailServerOut'][_0x74c0('0x47')]({'where':{'id':_0x28d022[_0x74c0('0x4a')]['id']}})[_0x74c0('0x26')](handleEntityNotFound(_0x2a73bd,null))[_0x74c0('0x26')](removeEntity(_0x2a73bd,null))[_0x74c0('0x43')](handleError(_0x2a73bd,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 9c6c307..d081155 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 _0x1238=['mail_servers_out','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailServerOut'];(function(_0x4f75ca,_0x2f2e8f){var _0x54bb5f=function(_0x48ddbf){while(--_0x48ddbf){_0x4f75ca['push'](_0x4f75ca['shift']());}};_0x54bb5f(++_0x2f2e8f);}(_0x1238,0x1e2));var _0x8123=function(_0x4ed786,_0x74f270){_0x4ed786=_0x4ed786-0x0;var _0x2f0243=_0x1238[_0x4ed786];return _0x2f0243;};'use strict';var _=require(_0x8123('0x0'));var util=require(_0x8123('0x1'));var logger=require('../../config/logger')(_0x8123('0x2'));var moment=require(_0x8123('0x3'));var BPromise=require(_0x8123('0x4'));var rp=require(_0x8123('0x5'));var fs=require('fs');var path=require(_0x8123('0x6'));var rimraf=require(_0x8123('0x7'));var config=require(_0x8123('0x8'));var attributes=require('./mailServerOut.attributes');module[_0x8123('0x9')]=function(_0xfed2c6,_0x3d3e42){return _0xfed2c6[_0x8123('0xa')](_0x8123('0xb'),attributes,{'tableName':_0x8123('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed6b=['mail_servers_out','lodash','../../config/logger','api','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut'];(function(_0x1ca6f4,_0x4c7904){var _0x4acc04=function(_0x4ebbbf){while(--_0x4ebbbf){_0x1ca6f4['push'](_0x1ca6f4['shift']());}};_0x4acc04(++_0x4c7904);}(_0xed6b,0x90));var _0xbed6=function(_0x399ed2,_0x29b5e8){_0x399ed2=_0x399ed2-0x0;var _0x266fd9=_0xed6b[_0x399ed2];return _0x266fd9;};'use strict';var _=require(_0xbed6('0x0'));var util=require('util');var logger=require(_0xbed6('0x1'))(_0xbed6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbed6('0x3'));var rimraf=require(_0xbed6('0x4'));var config=require(_0xbed6('0x5'));var attributes=require(_0xbed6('0x6'));module[_0xbed6('0x7')]=function(_0x28feb8,_0x4badf3){return _0x28feb8[_0xbed6('0x8')](_0xbed6('0x9'),attributes,{'tableName':_0xbed6('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 cdcfd4e..278d3fa 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 _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(_0x46bfdd,_0x342b59){var _0x5e42c5=function(_0x4fe725){while(--_0x4fe725){_0x46bfdd['push'](_0x46bfdd['shift']());}};_0x5e42c5(++_0x342b59);}(_0x2ef3,0xba));var _0x32ef=function(_0x4eb915,_0x3e2379){_0x4eb915=_0x4eb915-0x0;var _0x1927a3=_0x2ef3[_0x4eb915];return _0x1927a3;};'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 +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x5a7188,_0x2ec5ad){var _0x805ef=function(_0x2dfeba){while(--_0x2dfeba){_0x5a7188['push'](_0x5a7188['shift']());}};_0x805ef(++_0x2ec5ad);}(_0xadb5,0xad));var _0x5adb=function(_0x191ca1,_0x2f48a9){_0x191ca1=_0x191ca1-0x0;var _0x4682ea=_0xadb5[_0x191ca1];return _0x4682ea;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index fad201c..ea61a79 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 _0xbb86=['isAuthenticated','describe','/:id','show','post','put','update','delete','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','get','index','/describe'];(function(_0x102440,_0x7c931a){var _0x5d2f4f=function(_0x1d6b78){while(--_0x1d6b78){_0x102440['push'](_0x102440['shift']());}};_0x5d2f4f(++_0x7c931a);}(_0xbb86,0x198));var _0x6bb8=function(_0x5be2a6,_0x4dd539){_0x5be2a6=_0x5be2a6-0x0;var _0x525fa5=_0xbb86[_0x5be2a6];return _0x525fa5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6bb8('0x0'));var timeout=require('connect-timeout');var express=require(_0x6bb8('0x1'));var router=express[_0x6bb8('0x2')]();var fs_extra=require(_0x6bb8('0x3'));var auth=require(_0x6bb8('0x4'));var interaction=require(_0x6bb8('0x5'));var config=require('../../config/environment');var controller=require(_0x6bb8('0x6'));router[_0x6bb8('0x7')]('/',auth['isAuthenticated'](),controller[_0x6bb8('0x8')]);router[_0x6bb8('0x7')](_0x6bb8('0x9'),auth[_0x6bb8('0xa')](),controller[_0x6bb8('0xb')]);router[_0x6bb8('0x7')](_0x6bb8('0xc'),auth['isAuthenticated'](),controller[_0x6bb8('0xd')]);router[_0x6bb8('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6bb8('0xf')]('/:id',auth[_0x6bb8('0xa')](),controller[_0x6bb8('0x10')]);router[_0x6bb8('0x11')]('/:id',auth[_0x6bb8('0xa')](),controller['destroy']);module[_0x6bb8('0x12')]=router; \ No newline at end of file +var _0xf1a4=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','index','isAuthenticated','describe','/:id','show','post'];(function(_0x504c5d,_0x27a75a){var _0x4d1821=function(_0x558ffe){while(--_0x558ffe){_0x504c5d['push'](_0x504c5d['shift']());}};_0x4d1821(++_0x27a75a);}(_0xf1a4,0x109));var _0x4f1a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf1a4[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x4f1a('0x0'));var util=require(_0x4f1a('0x1'));var path=require(_0x4f1a('0x2'));var timeout=require(_0x4f1a('0x3'));var express=require(_0x4f1a('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4f1a('0x5'));var config=require(_0x4f1a('0x6'));var controller=require(_0x4f1a('0x7'));router[_0x4f1a('0x8')]('/',auth['isAuthenticated'](),controller[_0x4f1a('0x9')]);router[_0x4f1a('0x8')]('/describe',auth[_0x4f1a('0xa')](),controller[_0x4f1a('0xb')]);router[_0x4f1a('0x8')](_0x4f1a('0xc'),auth[_0x4f1a('0xa')](),controller[_0x4f1a('0xd')]);router[_0x4f1a('0xe')]('/',auth[_0x4f1a('0xa')](),controller['create']);router[_0x4f1a('0xf')](_0x4f1a('0xc'),auth[_0x4f1a('0xa')](),controller[_0x4f1a('0x10')]);router[_0x4f1a('0x11')](_0x4f1a('0xc'),auth[_0x4f1a('0xa')](),controller[_0x4f1a('0x12')]);module[_0x4f1a('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index acfa9f6..4184ca5 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 _0x687b=['STRING','name','sequelize','exports'];(function(_0x485154,_0x27d5cb){var _0x27cdb3=function(_0x24c6d9){while(--_0x24c6d9){_0x485154['push'](_0x485154['shift']());}};_0x27cdb3(++_0x27d5cb);}(_0x687b,0x14a));var _0xb687=function(_0x3b6f58,_0x5870de){_0x3b6f58=_0x3b6f58-0x0;var _0x987c61=_0x687b[_0x3b6f58];return _0x987c61;};'use strict';var Sequelize=require(_0xb687('0x0'));module[_0xb687('0x1')]={'name':{'type':Sequelize[_0xb687('0x2')],'unique':_0xb687('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5496=['name','sequelize','exports','STRING'];(function(_0x3f8392,_0x4e9d02){var _0x1086af=function(_0x54574e){while(--_0x54574e){_0x3f8392['push'](_0x3f8392['shift']());}};_0x1086af(++_0x4e9d02);}(_0x5496,0x175));var _0x6549=function(_0x58d5d4,_0x218511){_0x58d5d4=_0x58d5d4-0x0;var _0x20d06a=_0x5496[_0x58d5d4];return _0x20d06a;};'use strict';var Sequelize=require(_0x6549('0x0'));module[_0x6549('0x1')]={'name':{'type':Sequelize[_0x6549('0x2')],'unique':_0x6549('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6549('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 90aebfb..eed65ad 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 _0x4f02=['undefined','count','limit','Content-Range','json','reject','save','update','then','destroy','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','sendStatus','status','end','offset'];(function(_0x1ce2e5,_0xe4a3b1){var _0x5ddfa5=function(_0x1771f3){while(--_0x1771f3){_0x1ce2e5['push'](_0x1ce2e5['shift']());}};_0x5ddfa5(++_0xe4a3b1);}(_0x4f02,0x73));var _0x24f0=function(_0x43919d,_0x5980df){_0x43919d=_0x43919d-0x0;var _0x5b28f7=_0x4f02[_0x43919d];return _0x5b28f7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x24f0('0x0'));var jsonpatch=require(_0x24f0('0x1'));var rp=require(_0x24f0('0x2'));var moment=require(_0x24f0('0x3'));var BPromise=require(_0x24f0('0x4'));var Mustache=require(_0x24f0('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x24f0('0x6'));var ejs=require(_0x24f0('0x7'));var fs=require('fs');var fs_extra=require(_0x24f0('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x24f0('0x9'));var deskjs=require(_0x24f0('0xa'));var toCsv=require(_0x24f0('0x6'));var querystring=require(_0x24f0('0xb'));var Papa=require(_0x24f0('0xc'));var Redis=require(_0x24f0('0xd'));var authService=require(_0x24f0('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x24f0('0xf'));var hardwareService=require(_0x24f0('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x24f0('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x24f0('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37f28f,_0x467479){_0x467479=_0x467479||0xcc;return function(_0x1ef88e){if(_0x1ef88e){return _0x37f28f[_0x24f0('0x13')](_0x467479);}return _0x37f28f[_0x24f0('0x14')](_0x467479)[_0x24f0('0x15')]();};}function respondWithResult(_0x3d4b5a,_0x2ddfae){_0x2ddfae=_0x2ddfae||0xc8;return function(_0x3a7325){if(_0x3a7325){return _0x3d4b5a[_0x24f0('0x14')](_0x2ddfae)['json'](_0x3a7325);}};}function respondWithFilteredResult(_0x4ea8b9,_0x10b4ee){return function(_0x565a7){if(_0x565a7){var _0x31d035=typeof _0x10b4ee[_0x24f0('0x16')]==='undefined'&&typeof _0x10b4ee['limit']===_0x24f0('0x17');var _0x52b919=_0x565a7[_0x24f0('0x18')];var _0x220c49=_0x31d035?0x0:_0x10b4ee[_0x24f0('0x16')];var _0x320f60=_0x31d035?_0x565a7[_0x24f0('0x18')]:_0x10b4ee['offset']+_0x10b4ee[_0x24f0('0x19')];var _0x227142;if(_0x320f60>=_0x52b919){_0x320f60=_0x52b919;_0x227142=0xc8;}else{_0x227142=0xce;}_0x4ea8b9[_0x24f0('0x14')](_0x227142);return _0x4ea8b9['set'](_0x24f0('0x1a'),_0x220c49+'-'+_0x320f60+'/'+_0x52b919)[_0x24f0('0x1b')](_0x565a7);}return null;};}function patchUpdates(_0x221b09){return function(_0x461a55){try{jsonpatch['apply'](_0x461a55,_0x221b09,!![]);}catch(_0x2260db){return BPromise[_0x24f0('0x1c')](_0x2260db);}return _0x461a55[_0x24f0('0x1d')]();};}function saveUpdates(_0x30842a,_0x4f5734){return function(_0x3cce06){if(_0x3cce06){return _0x3cce06[_0x24f0('0x1e')](_0x30842a)[_0x24f0('0x1f')](function(_0x35fad2){return _0x35fad2;});}return null;};}function removeEntity(_0x544c61,_0x309207){return function(_0x234289){if(_0x234289){return _0x234289[_0x24f0('0x20')]()[_0x24f0('0x1f')](function(){_0x544c61[_0x24f0('0x14')](0xcc)[_0x24f0('0x15')]();});}};}function handleEntityNotFound(_0x470c13,_0x33c517){return function(_0x331e34){if(!_0x331e34){_0x470c13[_0x24f0('0x13')](0x194);}return _0x331e34;};}function handleError(_0x5001f9,_0x2d7328){_0x2d7328=_0x2d7328||0x1f4;return function(_0x182233){logger['error'](_0x182233[_0x24f0('0x21')]);if(_0x182233[_0x24f0('0x22')]){delete _0x182233[_0x24f0('0x22')];}_0x5001f9[_0x24f0('0x14')](_0x2d7328)[_0x24f0('0x23')](_0x182233);};}exports[_0x24f0('0x24')]=function(_0x4c95ed,_0x61e776){var _0x353777={},_0x1b712c={},_0x5858e6={'count':0x0,'rows':[]};var _0x2793fc=_[_0x24f0('0x25')](db[_0x24f0('0x26')][_0x24f0('0x27')],function(_0x2dc2f1){return{'name':_0x2dc2f1[_0x24f0('0x28')],'type':_0x2dc2f1['type']['key']};});_0x1b712c[_0x24f0('0x29')]=_['map'](_0x2793fc,'name');_0x1b712c[_0x24f0('0x2a')]=_[_0x24f0('0x2b')](_0x4c95ed[_0x24f0('0x2a')]);_0x1b712c[_0x24f0('0x2c')]=_[_0x24f0('0x2d')](_0x1b712c[_0x24f0('0x29')],_0x1b712c[_0x24f0('0x2a')]);_0x353777[_0x24f0('0x2e')]=_[_0x24f0('0x2d')](_0x1b712c[_0x24f0('0x29')],qs[_0x24f0('0x2f')](_0x4c95ed[_0x24f0('0x2a')][_0x24f0('0x2f')]));_0x353777[_0x24f0('0x2e')]=_0x353777['attributes'][_0x24f0('0x30')]?_0x353777[_0x24f0('0x2e')]:_0x1b712c[_0x24f0('0x29')];if(!_0x4c95ed[_0x24f0('0x2a')][_0x24f0('0x31')]('nolimit')){_0x353777[_0x24f0('0x19')]=qs['limit'](_0x4c95ed[_0x24f0('0x2a')][_0x24f0('0x19')]);_0x353777['offset']=qs[_0x24f0('0x16')](_0x4c95ed[_0x24f0('0x2a')][_0x24f0('0x16')]);}_0x353777[_0x24f0('0x32')]=qs[_0x24f0('0x33')](_0x4c95ed[_0x24f0('0x2a')][_0x24f0('0x33')]);_0x353777[_0x24f0('0x34')]=qs[_0x24f0('0x2c')](_[_0x24f0('0x35')](_0x4c95ed[_0x24f0('0x2a')],_0x1b712c[_0x24f0('0x2c')]),_0x2793fc);if(_0x4c95ed[_0x24f0('0x2a')][_0x24f0('0x36')]){_0x353777[_0x24f0('0x34')]=_[_0x24f0('0x37')](_0x353777[_0x24f0('0x34')],{'$or':_[_0x24f0('0x25')](_0x2793fc,function(_0x18c9ae){if(_0x18c9ae[_0x24f0('0x38')]!=='VIRTUAL'){var _0x569969={};_0x569969[_0x18c9ae[_0x24f0('0x22')]]={'$like':'%'+_0x4c95ed[_0x24f0('0x2a')][_0x24f0('0x36')]+'%'};return _0x569969;}})});}_0x353777=_['merge']({},_0x353777,_0x4c95ed[_0x24f0('0x39')]);var _0x47c974={'where':_0x353777[_0x24f0('0x34')]};return db[_0x24f0('0x26')][_0x24f0('0x18')](_0x47c974)[_0x24f0('0x1f')](function(_0x4d968a){_0x5858e6[_0x24f0('0x18')]=_0x4d968a;if(_0x4c95ed[_0x24f0('0x2a')][_0x24f0('0x3a')]){_0x353777[_0x24f0('0x3b')]=[{'all':!![]}];}return db[_0x24f0('0x26')][_0x24f0('0x3c')](_0x353777);})[_0x24f0('0x1f')](function(_0xe6294c){_0x5858e6[_0x24f0('0x3d')]=_0xe6294c;return _0x5858e6;})['then'](respondWithFilteredResult(_0x61e776,_0x353777))[_0x24f0('0x3e')](handleError(_0x61e776,null));};exports[_0x24f0('0x3f')]=function(_0x4c087b,_0x480526){var _0x500e9e={'raw':!![],'where':{'id':_0x4c087b[_0x24f0('0x40')]['id']}},_0x3c8e64={};_0x3c8e64[_0x24f0('0x29')]=_[_0x24f0('0x2b')](db[_0x24f0('0x26')][_0x24f0('0x27')]);_0x3c8e64[_0x24f0('0x2a')]=_[_0x24f0('0x2b')](_0x4c087b[_0x24f0('0x2a')]);_0x3c8e64[_0x24f0('0x2c')]=_[_0x24f0('0x2d')](_0x3c8e64[_0x24f0('0x29')],_0x3c8e64[_0x24f0('0x2a')]);_0x500e9e['attributes']=_[_0x24f0('0x2d')](_0x3c8e64[_0x24f0('0x29')],qs['fields'](_0x4c087b['query']['fields']));_0x500e9e[_0x24f0('0x2e')]=_0x500e9e[_0x24f0('0x2e')][_0x24f0('0x30')]?_0x500e9e[_0x24f0('0x2e')]:_0x3c8e64[_0x24f0('0x29')];if(_0x4c087b[_0x24f0('0x2a')]['includeAll']){_0x500e9e[_0x24f0('0x3b')]=[{'all':!![]}];}_0x500e9e=_[_0x24f0('0x37')]({},_0x500e9e,_0x4c087b[_0x24f0('0x39')]);return db[_0x24f0('0x26')][_0x24f0('0x41')](_0x500e9e)[_0x24f0('0x1f')](handleEntityNotFound(_0x480526,null))[_0x24f0('0x1f')](respondWithResult(_0x480526,null))[_0x24f0('0x3e')](handleError(_0x480526,null));};exports[_0x24f0('0x42')]=function(_0x34407a,_0x313839){return db[_0x24f0('0x26')][_0x24f0('0x42')](_0x34407a[_0x24f0('0x43')],{})[_0x24f0('0x1f')](respondWithResult(_0x313839,0xc9))[_0x24f0('0x3e')](handleError(_0x313839,null));};exports[_0x24f0('0x1e')]=function(_0x10ac2d,_0x339ab){if(_0x10ac2d['body']['id']){delete _0x10ac2d[_0x24f0('0x43')]['id'];}return db[_0x24f0('0x26')][_0x24f0('0x41')]({'where':{'id':_0x10ac2d[_0x24f0('0x40')]['id']}})[_0x24f0('0x1f')](handleEntityNotFound(_0x339ab,null))[_0x24f0('0x1f')](saveUpdates(_0x10ac2d[_0x24f0('0x43')],null))['then'](respondWithResult(_0x339ab,null))[_0x24f0('0x3e')](handleError(_0x339ab,null));};exports['destroy']=function(_0x34085c,_0xf1051e){return db[_0x24f0('0x26')][_0x24f0('0x41')]({'where':{'id':_0x34085c[_0x24f0('0x40')]['id']}})[_0x24f0('0x1f')](handleEntityNotFound(_0xf1051e,null))[_0x24f0('0x1f')](removeEntity(_0xf1051e,null))[_0x24f0('0x3e')](handleError(_0xf1051e,null));};exports[_0x24f0('0x44')]=function(_0xba70ed,_0x348826){return db[_0x24f0('0x26')][_0x24f0('0x44')]()[_0x24f0('0x1f')](respondWithResult(_0x348826,null))[_0x24f0('0x3e')](handleError(_0x348826,null));}; \ No newline at end of file +var _0xc3f9=['crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','intersection','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash'];(function(_0x14fcf5,_0x507d9d){var _0x335eb9=function(_0x1ebd4c){while(--_0x1ebd4c){_0x14fcf5['push'](_0x14fcf5['shift']());}};_0x335eb9(++_0x507d9d);}(_0xc3f9,0x1f1));var _0x9c3f=function(_0x51c141,_0x361d7d){_0x51c141=_0x51c141-0x0;var _0x420a0f=_0xc3f9[_0x51c141];return _0x420a0f;};'use strict';var emlformat=require(_0x9c3f('0x0'));var rimraf=require(_0x9c3f('0x1'));var zipdir=require(_0x9c3f('0x2'));var jsonpatch=require(_0x9c3f('0x3'));var rp=require(_0x9c3f('0x4'));var moment=require(_0x9c3f('0x5'));var BPromise=require(_0x9c3f('0x6'));var Mustache=require(_0x9c3f('0x7'));var util=require(_0x9c3f('0x8'));var path=require(_0x9c3f('0x9'));var sox=require(_0x9c3f('0xa'));var csv=require(_0x9c3f('0xb'));var ejs=require(_0x9c3f('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9c3f('0xd'));var squel=require('squel');var crypto=require(_0x9c3f('0xe'));var jsforce=require(_0x9c3f('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9c3f('0x10'));var Redis=require('ioredis');var authService=require(_0x9c3f('0x11'));var qs=require(_0x9c3f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9c3f('0x13'));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(_0x9c3f('0x14'))['db'];function respondWithStatusCode(_0xf97655,_0x307773){_0x307773=_0x307773||0xcc;return function(_0x24486c){if(_0x24486c){return _0xf97655[_0x9c3f('0x15')](_0x307773);}return _0xf97655['status'](_0x307773)[_0x9c3f('0x16')]();};}function respondWithResult(_0x2c65a8,_0x112f9f){_0x112f9f=_0x112f9f||0xc8;return function(_0x31fab9){if(_0x31fab9){return _0x2c65a8[_0x9c3f('0x17')](_0x112f9f)[_0x9c3f('0x18')](_0x31fab9);}};}function respondWithFilteredResult(_0x3f1b69,_0x2dfb79){return function(_0x286469){if(_0x286469){var _0x32d5fd=typeof _0x2dfb79[_0x9c3f('0x19')]===_0x9c3f('0x1a')&&typeof _0x2dfb79['limit']===_0x9c3f('0x1a');var _0x16ecdc=_0x286469[_0x9c3f('0x1b')];var _0x3186f1=_0x32d5fd?0x0:_0x2dfb79[_0x9c3f('0x19')];var _0x44f6c7=_0x32d5fd?_0x286469['count']:_0x2dfb79[_0x9c3f('0x19')]+_0x2dfb79[_0x9c3f('0x1c')];var _0x577e12;if(_0x44f6c7>=_0x16ecdc){_0x44f6c7=_0x16ecdc;_0x577e12=0xc8;}else{_0x577e12=0xce;}_0x3f1b69['status'](_0x577e12);return _0x3f1b69[_0x9c3f('0x1d')](_0x9c3f('0x1e'),_0x3186f1+'-'+_0x44f6c7+'/'+_0x16ecdc)[_0x9c3f('0x18')](_0x286469);}return null;};}function patchUpdates(_0x24a05e){return function(_0x176620){try{jsonpatch[_0x9c3f('0x1f')](_0x176620,_0x24a05e,!![]);}catch(_0x4b1598){return BPromise[_0x9c3f('0x20')](_0x4b1598);}return _0x176620[_0x9c3f('0x21')]();};}function saveUpdates(_0x535c3b,_0x544234){return function(_0x38ee77){if(_0x38ee77){return _0x38ee77[_0x9c3f('0x22')](_0x535c3b)['then'](function(_0x570587){return _0x570587;});}return null;};}function removeEntity(_0x33b04c,_0x3fc0bd){return function(_0x4e4ddb){if(_0x4e4ddb){return _0x4e4ddb['destroy']()[_0x9c3f('0x23')](function(){_0x33b04c[_0x9c3f('0x17')](0xcc)[_0x9c3f('0x16')]();});}};}function handleEntityNotFound(_0x9876b2,_0xc9463a){return function(_0x137a2c){if(!_0x137a2c){_0x9876b2['sendStatus'](0x194);}return _0x137a2c;};}function handleError(_0x13b76f,_0x16b9cf){_0x16b9cf=_0x16b9cf||0x1f4;return function(_0x50d044){logger['error'](_0x50d044[_0x9c3f('0x24')]);if(_0x50d044[_0x9c3f('0x25')]){delete _0x50d044[_0x9c3f('0x25')];}_0x13b76f[_0x9c3f('0x17')](_0x16b9cf)[_0x9c3f('0x26')](_0x50d044);};}exports[_0x9c3f('0x27')]=function(_0x563b7e,_0x29387a){var _0x15096b={},_0x1835e0={},_0x2285e5={'count':0x0,'rows':[]};var _0x497f5e=_[_0x9c3f('0x28')](db[_0x9c3f('0x29')][_0x9c3f('0x2a')],function(_0x52b9ad){return{'name':_0x52b9ad[_0x9c3f('0x2b')],'type':_0x52b9ad[_0x9c3f('0x2c')][_0x9c3f('0x2d')]};});_0x1835e0[_0x9c3f('0x2e')]=_['map'](_0x497f5e,_0x9c3f('0x25'));_0x1835e0[_0x9c3f('0x2f')]=_[_0x9c3f('0x30')](_0x563b7e[_0x9c3f('0x2f')]);_0x1835e0[_0x9c3f('0x31')]=_['intersection'](_0x1835e0[_0x9c3f('0x2e')],_0x1835e0[_0x9c3f('0x2f')]);_0x15096b[_0x9c3f('0x32')]=_['intersection'](_0x1835e0[_0x9c3f('0x2e')],qs[_0x9c3f('0x33')](_0x563b7e[_0x9c3f('0x2f')]['fields']));_0x15096b[_0x9c3f('0x32')]=_0x15096b[_0x9c3f('0x32')][_0x9c3f('0x34')]?_0x15096b[_0x9c3f('0x32')]:_0x1835e0[_0x9c3f('0x2e')];if(!_0x563b7e[_0x9c3f('0x2f')]['hasOwnProperty']('nolimit')){_0x15096b['limit']=qs[_0x9c3f('0x1c')](_0x563b7e['query']['limit']);_0x15096b[_0x9c3f('0x19')]=qs[_0x9c3f('0x19')](_0x563b7e[_0x9c3f('0x2f')][_0x9c3f('0x19')]);}_0x15096b[_0x9c3f('0x35')]=qs[_0x9c3f('0x36')](_0x563b7e[_0x9c3f('0x2f')]['sort']);_0x15096b[_0x9c3f('0x37')]=qs[_0x9c3f('0x31')](_[_0x9c3f('0x38')](_0x563b7e[_0x9c3f('0x2f')],_0x1835e0[_0x9c3f('0x31')]),_0x497f5e);if(_0x563b7e[_0x9c3f('0x2f')][_0x9c3f('0x39')]){_0x15096b[_0x9c3f('0x37')]=_[_0x9c3f('0x3a')](_0x15096b[_0x9c3f('0x37')],{'$or':_[_0x9c3f('0x28')](_0x497f5e,function(_0x375046){if(_0x375046[_0x9c3f('0x2c')]!==_0x9c3f('0x3b')){var _0x49acc6={};_0x49acc6[_0x375046[_0x9c3f('0x25')]]={'$like':'%'+_0x563b7e[_0x9c3f('0x2f')]['filter']+'%'};return _0x49acc6;}})});}_0x15096b=_[_0x9c3f('0x3a')]({},_0x15096b,_0x563b7e[_0x9c3f('0x3c')]);var _0x5b33b6={'where':_0x15096b[_0x9c3f('0x37')]};return db[_0x9c3f('0x29')][_0x9c3f('0x1b')](_0x5b33b6)['then'](function(_0x437972){_0x2285e5[_0x9c3f('0x1b')]=_0x437972;if(_0x563b7e[_0x9c3f('0x2f')][_0x9c3f('0x3d')]){_0x15096b[_0x9c3f('0x3e')]=[{'all':!![]}];}return db['MailSubstatus']['findAll'](_0x15096b);})['then'](function(_0x35b56a){_0x2285e5[_0x9c3f('0x3f')]=_0x35b56a;return _0x2285e5;})[_0x9c3f('0x23')](respondWithFilteredResult(_0x29387a,_0x15096b))[_0x9c3f('0x40')](handleError(_0x29387a,null));};exports[_0x9c3f('0x41')]=function(_0x163fc7,_0x49aca6){var _0x4d0266={'raw':!![],'where':{'id':_0x163fc7[_0x9c3f('0x42')]['id']}},_0x563abf={};_0x563abf[_0x9c3f('0x2e')]=_[_0x9c3f('0x30')](db[_0x9c3f('0x29')][_0x9c3f('0x2a')]);_0x563abf[_0x9c3f('0x2f')]=_['keys'](_0x163fc7[_0x9c3f('0x2f')]);_0x563abf[_0x9c3f('0x31')]=_[_0x9c3f('0x43')](_0x563abf['model'],_0x563abf['query']);_0x4d0266[_0x9c3f('0x32')]=_[_0x9c3f('0x43')](_0x563abf['model'],qs[_0x9c3f('0x33')](_0x163fc7['query'][_0x9c3f('0x33')]));_0x4d0266[_0x9c3f('0x32')]=_0x4d0266[_0x9c3f('0x32')][_0x9c3f('0x34')]?_0x4d0266['attributes']:_0x563abf[_0x9c3f('0x2e')];if(_0x163fc7[_0x9c3f('0x2f')][_0x9c3f('0x3d')]){_0x4d0266[_0x9c3f('0x3e')]=[{'all':!![]}];}_0x4d0266=_[_0x9c3f('0x3a')]({},_0x4d0266,_0x163fc7[_0x9c3f('0x3c')]);return db['MailSubstatus'][_0x9c3f('0x44')](_0x4d0266)[_0x9c3f('0x23')](handleEntityNotFound(_0x49aca6,null))[_0x9c3f('0x23')](respondWithResult(_0x49aca6,null))[_0x9c3f('0x40')](handleError(_0x49aca6,null));};exports[_0x9c3f('0x45')]=function(_0x427498,_0x16badb){return db['MailSubstatus'][_0x9c3f('0x45')](_0x427498[_0x9c3f('0x46')],{})['then'](respondWithResult(_0x16badb,0xc9))[_0x9c3f('0x40')](handleError(_0x16badb,null));};exports['update']=function(_0xfebde2,_0x3ccc65){if(_0xfebde2[_0x9c3f('0x46')]['id']){delete _0xfebde2[_0x9c3f('0x46')]['id'];}return db[_0x9c3f('0x29')]['find']({'where':{'id':_0xfebde2[_0x9c3f('0x42')]['id']}})[_0x9c3f('0x23')](handleEntityNotFound(_0x3ccc65,null))[_0x9c3f('0x23')](saveUpdates(_0xfebde2[_0x9c3f('0x46')],null))[_0x9c3f('0x23')](respondWithResult(_0x3ccc65,null))[_0x9c3f('0x40')](handleError(_0x3ccc65,null));};exports[_0x9c3f('0x47')]=function(_0x1f312d,_0xd8fbd7){return db[_0x9c3f('0x29')][_0x9c3f('0x44')]({'where':{'id':_0x1f312d[_0x9c3f('0x42')]['id']}})[_0x9c3f('0x23')](handleEntityNotFound(_0xd8fbd7,null))['then'](removeEntity(_0xd8fbd7,null))['catch'](handleError(_0xd8fbd7,null));};exports[_0x9c3f('0x48')]=function(_0x4c2275,_0x5424cd){return db[_0x9c3f('0x29')][_0x9c3f('0x48')]()['then'](respondWithResult(_0x5424cd,null))[_0x9c3f('0x40')](handleError(_0x5424cd,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index ac96b7f..58bfd4a 100644 --- a/server/api/mailSubstatus/mailSubstatus.events.js +++ b/server/api/mailSubstatus/mailSubstatus.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9fef=['emit','exports','events','../../mysqldb','MailSubstatus','update'];(function(_0x5c6244,_0x112ab8){var _0x5800ce=function(_0x304e3d){while(--_0x304e3d){_0x5c6244['push'](_0x5c6244['shift']());}};_0x5800ce(++_0x112ab8);}(_0x9fef,0x7a));var _0xf9fe=function(_0x3adf4e,_0x26d25f){_0x3adf4e=_0x3adf4e-0x0;var _0x4dc28b=_0x9fef[_0x3adf4e];return _0x4dc28b;};'use strict';var EventEmitter=require(_0xf9fe('0x0'));var MailSubstatus=require(_0xf9fe('0x1'))['db'][_0xf9fe('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0xf9fe('0x3')};function emitEvent(_0x535ddf){return function(_0x2f0ec6,_0x499bfa,_0x2f89b5){MailSubstatusEvents['emit'](_0x535ddf+':'+_0x2f0ec6['id'],_0x2f0ec6);MailSubstatusEvents[_0xf9fe('0x4')](_0x535ddf,_0x2f0ec6);_0x2f89b5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0xf9fe('0x5')]=MailSubstatusEvents; \ No newline at end of file +var _0x3550=['../../mysqldb','MailSubstatus','setMaxListeners','emit'];(function(_0x505509,_0x537f0c){var _0x1aab66=function(_0x395280){while(--_0x395280){_0x505509['push'](_0x505509['shift']());}};_0x1aab66(++_0x537f0c);}(_0x3550,0x124));var _0x0355=function(_0x159c09,_0x2f5974){_0x159c09=_0x159c09-0x0;var _0x21810d=_0x3550[_0x159c09];return _0x21810d;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0x0355('0x0'))['db'][_0x0355('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x0355('0x2')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x53eeba){return function(_0x602e4b,_0x2c6102,_0xb0eb84){MailSubstatusEvents['emit'](_0x53eeba+':'+_0x602e4b['id'],_0x602e4b);MailSubstatusEvents[_0x0355('0x3')](_0x53eeba,_0x602e4b);_0xb0eb84(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 5e9eea8..98435ed 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 _0x1650=['./mailSubstatus.attributes','exports','models','define','mail_substatuses','Condition','name','mailSubstatus','_previousDataValues','then','catch'];(function(_0x30eb04,_0xf80430){var _0x4c6ee3=function(_0x1050f6){while(--_0x1050f6){_0x30eb04['push'](_0x30eb04['shift']());}};_0x4c6ee3(++_0xf80430);}(_0x1650,0xe7));var _0x0165=function(_0x187826,_0x357251){_0x187826=_0x187826-0x0;var _0x2c22f5=_0x1650[_0x187826];return _0x2c22f5;};'use strict';var attributes=require(_0x0165('0x0'));module[_0x0165('0x1')]=function(_0x48e049){var _0x18ffd0=_0x48e049[_0x0165('0x2')];return _0x48e049[_0x0165('0x3')]('MailSubstatus',attributes,{'tableName':_0x0165('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0xbad943,_0x2a29f8,_0x5d099c){return _0x18ffd0[_0x0165('0x5')]['update']({'value':_0xbad943[_0x0165('0x6')]},{'where':{'field':_0x0165('0x7'),'value':_0xbad943[_0x0165('0x8')]['name']}})[_0x0165('0x9')](function(){_0x5d099c();})[_0x0165('0xa')](function(_0x546e8a){_0x5d099c(_0x546e8a);});}}});}; \ No newline at end of file +var _0x23f0=['then','exports','define','MailSubstatus','Condition','update','mailSubstatus','_previousDataValues','name'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x23f0,0x121));var _0x023f=function(_0x1a6015,_0x1e215d){_0x1a6015=_0x1a6015-0x0;var _0x17ea7e=_0x23f0[_0x1a6015];return _0x17ea7e;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0x023f('0x0')]=function(_0x3a31b9){var _0x312637=_0x3a31b9['models'];return _0x3a31b9[_0x023f('0x1')](_0x023f('0x2'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x3ec6cb,_0x42f03f,_0xb3a72c){return _0x312637[_0x023f('0x3')][_0x023f('0x4')]({'value':_0x3ec6cb['name']},{'where':{'field':_0x023f('0x5'),'value':_0x3ec6cb[_0x023f('0x6')][_0x023f('0x7')]}})[_0x023f('0x8')](function(){_0xb3a72c();})['catch'](function(_0xcfebc4){_0xb3a72c(_0xcfebc4);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 1322410..ddbc460 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 _0xc6a3=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','stringify','error','message','lodash','util'];(function(_0x524ce0,_0x3670b2){var _0x38299f=function(_0x513ef4){while(--_0x513ef4){_0x524ce0['push'](_0x524ce0['shift']());}};_0x38299f(++_0x3670b2);}(_0xc6a3,0x1cc));var _0x3c6a=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xc6a3[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x3c6a('0x0'));var util=require(_0x3c6a('0x1'));var moment=require(_0x3c6a('0x2'));var BPromise=require(_0x3c6a('0x3'));var rs=require(_0x3c6a('0x4'));var fs=require('fs');var Redis=require(_0x3c6a('0x5'));var db=require(_0x3c6a('0x6'))['db'];var utils=require(_0x3c6a('0x7'));var logger=require(_0x3c6a('0x8'))(_0x3c6a('0x9'));var config=require(_0x3c6a('0xa'));var jayson=require(_0x3c6a('0xb'));var client=jayson[_0x3c6a('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32d7e6,_0x5e550a,_0x499fa1){return new BPromise(function(_0x365f16,_0x2078c3){return client[_0x3c6a('0xd')](_0x32d7e6,_0x499fa1)[_0x3c6a('0xe')](function(_0x177b00){logger[_0x3c6a('0xf')](_0x3c6a('0x10'),_0x5e550a,_0x3c6a('0x11'));logger['debug']('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x5e550a,'request\x20sent',JSON[_0x3c6a('0x12')](_0x177b00));if(_0x177b00['error']){if(_0x177b00[_0x3c6a('0x13')]['code']===0x1f4){logger['error'](_0x3c6a('0x10'),_0x5e550a,_0x177b00['error'][_0x3c6a('0x14')]);return _0x2078c3(_0x177b00[_0x3c6a('0x13')]['message']);}logger[_0x3c6a('0x13')](_0x3c6a('0x10'),_0x5e550a,_0x177b00[_0x3c6a('0x13')][_0x3c6a('0x14')]);return _0x365f16(_0x177b00[_0x3c6a('0x13')][_0x3c6a('0x14')]);}else{logger[_0x3c6a('0xf')](_0x3c6a('0x10'),_0x5e550a,_0x3c6a('0x11'));_0x365f16(_0x177b00['result'][_0x3c6a('0x14')]);}})['catch'](function(_0x348c85){logger[_0x3c6a('0x13')]('MailSubstatus,\x20%s,\x20%s',_0x5e550a,_0x348c85);_0x2078c3(_0x348c85);});});} \ No newline at end of file +var _0xca69=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment'];(function(_0x307049,_0x1e9968){var _0x2d3015=function(_0x285429){while(--_0x285429){_0x307049['push'](_0x307049['shift']());}};_0x2d3015(++_0x1e9968);}(_0xca69,0xb1));var _0x9ca6=function(_0x26ce74,_0x573948){_0x26ce74=_0x26ce74-0x0;var _0xe5fbaf=_0xca69[_0x26ce74];return _0xe5fbaf;};'use strict';var _=require(_0x9ca6('0x0'));var util=require(_0x9ca6('0x1'));var moment=require(_0x9ca6('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9ca6('0x3'));var logger=require(_0x9ca6('0x4'))(_0x9ca6('0x5'));var config=require(_0x9ca6('0x6'));var jayson=require(_0x9ca6('0x7'));var client=jayson[_0x9ca6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x326340,_0x31bf5d,_0x898bdb){return new BPromise(function(_0x5c832d,_0x3fedfd){return client[_0x9ca6('0x9')](_0x326340,_0x898bdb)[_0x9ca6('0xa')](function(_0x327860){logger[_0x9ca6('0xb')](_0x9ca6('0xc'),_0x31bf5d,_0x9ca6('0xd'));logger[_0x9ca6('0xe')](_0x9ca6('0xf'),_0x31bf5d,'request\x20sent',JSON['stringify'](_0x327860));if(_0x327860['error']){if(_0x327860[_0x9ca6('0x10')]['code']===0x1f4){logger[_0x9ca6('0x10')](_0x9ca6('0xc'),_0x31bf5d,_0x327860[_0x9ca6('0x10')][_0x9ca6('0x11')]);return _0x3fedfd(_0x327860[_0x9ca6('0x10')][_0x9ca6('0x11')]);}logger[_0x9ca6('0x10')](_0x9ca6('0xc'),_0x31bf5d,_0x327860[_0x9ca6('0x10')]['message']);return _0x5c832d(_0x327860[_0x9ca6('0x10')][_0x9ca6('0x11')]);}else{logger['info'](_0x9ca6('0xc'),_0x31bf5d,_0x9ca6('0xd'));_0x5c832d(_0x327860[_0x9ca6('0x12')]['message']);}})[_0x9ca6('0x13')](function(_0x155074){logger[_0x9ca6('0x10')](_0x9ca6('0xc'),_0x31bf5d,_0x155074);_0x3fedfd(_0x155074);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 26056ce..64623ab 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 _0xb05e=['../../components/auth/service','../../config/environment','index','get','/describe','isAuthenticated','/:id','post','create','delete','destroy','exports','util','connect-timeout','Router','fs-extra'];(function(_0x12de60,_0x3fe1a6){var _0x173631=function(_0x5d7be8){while(--_0x5d7be8){_0x12de60['push'](_0x12de60['shift']());}};_0x173631(++_0x3fe1a6);}(_0xb05e,0x8c));var _0xeb05=function(_0x43663d,_0xf1bd2f){_0x43663d=_0x43663d-0x0;var _0x242f56=_0xb05e[_0x43663d];return _0x242f56;};'use strict';var multer=require('multer');var util=require(_0xeb05('0x0'));var path=require('path');var timeout=require(_0xeb05('0x1'));var express=require('express');var router=express[_0xeb05('0x2')]();var fs_extra=require(_0xeb05('0x3'));var auth=require(_0xeb05('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xeb05('0x5'));var controller=require('./mailTransferReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xeb05('0x6')]);router[_0xeb05('0x7')](_0xeb05('0x8'),auth[_0xeb05('0x9')](),controller['describe']);router[_0xeb05('0x7')](_0xeb05('0xa'),auth[_0xeb05('0x9')](),controller['show']);router[_0xeb05('0xb')]('/',auth['isAuthenticated'](),controller[_0xeb05('0xc')]);router['put'](_0xeb05('0xa'),auth[_0xeb05('0x9')](),controller['update']);router[_0xeb05('0xd')](_0xeb05('0xa'),auth[_0xeb05('0x9')](),controller[_0xeb05('0xe')]);module[_0xeb05('0xf')]=router; \ No newline at end of file +var _0x14ad=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x5be16f,_0x557554){var _0x57cb4e=function(_0x57b476){while(--_0x57b476){_0x5be16f['push'](_0x5be16f['shift']());}};_0x57cb4e(++_0x557554);}(_0x14ad,0xa3));var _0xd14a=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x14ad[_0x50a0c2];return _0x5ebadd;};'use strict';var multer=require(_0xd14a('0x0'));var util=require(_0xd14a('0x1'));var path=require(_0xd14a('0x2'));var timeout=require('connect-timeout');var express=require(_0xd14a('0x3'));var router=express[_0xd14a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd14a('0x5'));var interaction=require(_0xd14a('0x6'));var config=require(_0xd14a('0x7'));var controller=require(_0xd14a('0x8'));router[_0xd14a('0x9')]('/',auth[_0xd14a('0xa')](),controller[_0xd14a('0xb')]);router[_0xd14a('0x9')](_0xd14a('0xc'),auth[_0xd14a('0xa')](),controller[_0xd14a('0xd')]);router[_0xd14a('0x9')](_0xd14a('0xe'),auth[_0xd14a('0xa')](),controller['show']);router[_0xd14a('0xf')]('/',auth['isAuthenticated'](),controller[_0xd14a('0x10')]);router['put'](_0xd14a('0xe'),auth['isAuthenticated'](),controller[_0xd14a('0x11')]);router[_0xd14a('0x12')](_0xd14a('0xe'),auth[_0xd14a('0xa')](),controller[_0xd14a('0x13')]);module[_0xd14a('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 77dc55a..60caef1 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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x3474ac,_0x22d0f7){var _0x5345ec=function(_0x45056e){while(--_0x45056e){_0x3474ac['push'](_0x3474ac['shift']());}};_0x5345ec(++_0x22d0f7);}(_0xb43b,0x1b2));var _0xbb43=function(_0x3b90d7,_0x29573d){_0x3b90d7=_0x3b90d7-0x0;var _0x432e9d=_0xb43b[_0x3b90d7];return _0x432e9d;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x371862,_0x5de996){var _0x199464=function(_0x3b811e){while(--_0x3b811e){_0x371862['push'](_0x371862['shift']());}};_0x199464(++_0x5de996);}(_0x00bb,0x1d8));var _0xb00b=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x00bb[_0xbb091];return _0x467a04;};'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 diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 8eb5b3c..f445ee1 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 _0xab57=['rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','apply','update','then','destroy','stack','name','index','map','MailTransferReport','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','catch','params','find','create','body','describe','eml-format'];(function(_0x2b823d,_0x45340c){var _0x5dd2ae=function(_0x108241){while(--_0x108241){_0x2b823d['push'](_0x2b823d['shift']());}};_0x5dd2ae(++_0x45340c);}(_0xab57,0x11b));var _0x7ab5=function(_0x3ead22,_0x5cf892){_0x3ead22=_0x3ead22-0x0;var _0x4f88cb=_0xab57[_0x3ead22];return _0x4f88cb;};'use strict';var emlformat=require(_0x7ab5('0x0'));var rimraf=require(_0x7ab5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7ab5('0x2'));var rp=require(_0x7ab5('0x3'));var moment=require('moment');var BPromise=require(_0x7ab5('0x4'));var Mustache=require(_0x7ab5('0x5'));var util=require(_0x7ab5('0x6'));var path=require(_0x7ab5('0x7'));var sox=require(_0x7ab5('0x8'));var csv=require(_0x7ab5('0x9'));var ejs=require(_0x7ab5('0xa'));var fs=require('fs');var fs_extra=require(_0x7ab5('0xb'));var _=require(_0x7ab5('0xc'));var squel=require(_0x7ab5('0xd'));var crypto=require(_0x7ab5('0xe'));var jsforce=require(_0x7ab5('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7ab5('0x9'));var querystring=require(_0x7ab5('0x10'));var Papa=require(_0x7ab5('0x11'));var Redis=require('ioredis');var authService=require(_0x7ab5('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7ab5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7ab5('0x14'))(_0x7ab5('0x15'));var utils=require(_0x7ab5('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x7ab5('0x17'));var db=require(_0x7ab5('0x18'))['db'];function respondWithStatusCode(_0x38779a,_0x720e9e){_0x720e9e=_0x720e9e||0xcc;return function(_0x29c632){if(_0x29c632){return _0x38779a[_0x7ab5('0x19')](_0x720e9e);}return _0x38779a['status'](_0x720e9e)[_0x7ab5('0x1a')]();};}function respondWithResult(_0x5737d1,_0x519e7d){_0x519e7d=_0x519e7d||0xc8;return function(_0x5e2942){if(_0x5e2942){return _0x5737d1[_0x7ab5('0x1b')](_0x519e7d)[_0x7ab5('0x1c')](_0x5e2942);}};}function respondWithFilteredResult(_0x4704f2,_0x768b80){return function(_0x4c6ce8){if(_0x4c6ce8){var _0x30c2eb=typeof _0x768b80['offset']==='undefined'&&typeof _0x768b80[_0x7ab5('0x1d')]===_0x7ab5('0x1e');var _0x22a45e=_0x4c6ce8[_0x7ab5('0x1f')];var _0x51bf87=_0x30c2eb?0x0:_0x768b80[_0x7ab5('0x20')];var _0x4b1ad9=_0x30c2eb?_0x4c6ce8[_0x7ab5('0x1f')]:_0x768b80['offset']+_0x768b80['limit'];var _0x1ee393;if(_0x4b1ad9>=_0x22a45e){_0x4b1ad9=_0x22a45e;_0x1ee393=0xc8;}else{_0x1ee393=0xce;}_0x4704f2['status'](_0x1ee393);return _0x4704f2[_0x7ab5('0x21')](_0x7ab5('0x22'),_0x51bf87+'-'+_0x4b1ad9+'/'+_0x22a45e)[_0x7ab5('0x1c')](_0x4c6ce8);}return null;};}function patchUpdates(_0x22eecd){return function(_0x2ec53a){try{jsonpatch[_0x7ab5('0x23')](_0x2ec53a,_0x22eecd,!![]);}catch(_0x51afc9){return BPromise['reject'](_0x51afc9);}return _0x2ec53a['save']();};}function saveUpdates(_0x4481d1,_0x3400a7){return function(_0x363ba7){if(_0x363ba7){return _0x363ba7[_0x7ab5('0x24')](_0x4481d1)[_0x7ab5('0x25')](function(_0x5d5357){return _0x5d5357;});}return null;};}function removeEntity(_0x2b26d9,_0x270f06){return function(_0x28894c){if(_0x28894c){return _0x28894c[_0x7ab5('0x26')]()[_0x7ab5('0x25')](function(){_0x2b26d9[_0x7ab5('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xce0dce,_0x59d849){return function(_0x90c2bb){if(!_0x90c2bb){_0xce0dce['sendStatus'](0x194);}return _0x90c2bb;};}function handleError(_0x2a0ce1,_0x5a0437){_0x5a0437=_0x5a0437||0x1f4;return function(_0x3e12bb){logger['error'](_0x3e12bb[_0x7ab5('0x27')]);if(_0x3e12bb[_0x7ab5('0x28')]){delete _0x3e12bb[_0x7ab5('0x28')];}_0x2a0ce1[_0x7ab5('0x1b')](_0x5a0437)['send'](_0x3e12bb);};}exports[_0x7ab5('0x29')]=function(_0x30ff12,_0x546066){var _0x3344cd={},_0x14cfd3={},_0x1f1d33={'count':0x0,'rows':[]};var _0x54c44b=_[_0x7ab5('0x2a')](db[_0x7ab5('0x2b')][_0x7ab5('0x2c')],function(_0x228d97){return{'name':_0x228d97[_0x7ab5('0x2d')],'type':_0x228d97['type']['key']};});_0x14cfd3[_0x7ab5('0x2e')]=_[_0x7ab5('0x2a')](_0x54c44b,_0x7ab5('0x28'));_0x14cfd3[_0x7ab5('0x2f')]=_[_0x7ab5('0x30')](_0x30ff12[_0x7ab5('0x2f')]);_0x14cfd3[_0x7ab5('0x31')]=_[_0x7ab5('0x32')](_0x14cfd3[_0x7ab5('0x2e')],_0x14cfd3['query']);_0x3344cd['attributes']=_[_0x7ab5('0x32')](_0x14cfd3[_0x7ab5('0x2e')],qs[_0x7ab5('0x33')](_0x30ff12[_0x7ab5('0x2f')][_0x7ab5('0x33')]));_0x3344cd[_0x7ab5('0x34')]=_0x3344cd[_0x7ab5('0x34')][_0x7ab5('0x35')]?_0x3344cd[_0x7ab5('0x34')]:_0x14cfd3[_0x7ab5('0x2e')];if(!_0x30ff12[_0x7ab5('0x2f')]['hasOwnProperty']('nolimit')){_0x3344cd[_0x7ab5('0x1d')]=qs[_0x7ab5('0x1d')](_0x30ff12[_0x7ab5('0x2f')][_0x7ab5('0x1d')]);_0x3344cd[_0x7ab5('0x20')]=qs[_0x7ab5('0x20')](_0x30ff12[_0x7ab5('0x2f')]['offset']);}_0x3344cd[_0x7ab5('0x36')]=qs['sort'](_0x30ff12[_0x7ab5('0x2f')][_0x7ab5('0x37')]);_0x3344cd[_0x7ab5('0x38')]=qs[_0x7ab5('0x31')](_[_0x7ab5('0x39')](_0x30ff12[_0x7ab5('0x2f')],_0x14cfd3[_0x7ab5('0x31')]),_0x54c44b);if(_0x30ff12['query'][_0x7ab5('0x3a')]){_0x3344cd[_0x7ab5('0x38')]=_[_0x7ab5('0x3b')](_0x3344cd[_0x7ab5('0x38')],{'$or':_[_0x7ab5('0x2a')](_0x54c44b,function(_0x3a8a99){if(_0x3a8a99[_0x7ab5('0x3c')]!==_0x7ab5('0x3d')){var _0xd7da3={};_0xd7da3[_0x3a8a99[_0x7ab5('0x28')]]={'$like':'%'+_0x30ff12[_0x7ab5('0x2f')][_0x7ab5('0x3a')]+'%'};return _0xd7da3;}})});}_0x3344cd=_[_0x7ab5('0x3b')]({},_0x3344cd,_0x30ff12[_0x7ab5('0x3e')]);var _0x354174={'where':_0x3344cd[_0x7ab5('0x38')]};return db[_0x7ab5('0x2b')][_0x7ab5('0x1f')](_0x354174)[_0x7ab5('0x25')](function(_0x6a404c){_0x1f1d33['count']=_0x6a404c;if(_0x30ff12[_0x7ab5('0x2f')][_0x7ab5('0x3f')]){_0x3344cd[_0x7ab5('0x40')]=[{'all':!![]}];}return db['MailTransferReport']['findAll'](_0x3344cd);})[_0x7ab5('0x25')](function(_0x1fedc6){_0x1f1d33['rows']=_0x1fedc6;return _0x1f1d33;})['then'](respondWithFilteredResult(_0x546066,_0x3344cd))[_0x7ab5('0x41')](handleError(_0x546066,null));};exports['show']=function(_0x48b4f0,_0xa9574d){var _0x8084b3={'raw':!![],'where':{'id':_0x48b4f0[_0x7ab5('0x42')]['id']}},_0x141cda={};_0x141cda[_0x7ab5('0x2e')]=_['keys'](db[_0x7ab5('0x2b')][_0x7ab5('0x2c')]);_0x141cda[_0x7ab5('0x2f')]=_[_0x7ab5('0x30')](_0x48b4f0[_0x7ab5('0x2f')]);_0x141cda[_0x7ab5('0x31')]=_[_0x7ab5('0x32')](_0x141cda[_0x7ab5('0x2e')],_0x141cda['query']);_0x8084b3[_0x7ab5('0x34')]=_[_0x7ab5('0x32')](_0x141cda[_0x7ab5('0x2e')],qs[_0x7ab5('0x33')](_0x48b4f0[_0x7ab5('0x2f')][_0x7ab5('0x33')]));_0x8084b3[_0x7ab5('0x34')]=_0x8084b3[_0x7ab5('0x34')][_0x7ab5('0x35')]?_0x8084b3[_0x7ab5('0x34')]:_0x141cda['model'];if(_0x48b4f0[_0x7ab5('0x2f')][_0x7ab5('0x3f')]){_0x8084b3[_0x7ab5('0x40')]=[{'all':!![]}];}_0x8084b3=_[_0x7ab5('0x3b')]({},_0x8084b3,_0x48b4f0[_0x7ab5('0x3e')]);return db[_0x7ab5('0x2b')][_0x7ab5('0x43')](_0x8084b3)[_0x7ab5('0x25')](handleEntityNotFound(_0xa9574d,null))[_0x7ab5('0x25')](respondWithResult(_0xa9574d,null))[_0x7ab5('0x41')](handleError(_0xa9574d,null));};exports[_0x7ab5('0x44')]=function(_0x4aabc2,_0x13b505){return db[_0x7ab5('0x2b')][_0x7ab5('0x44')](_0x4aabc2[_0x7ab5('0x45')],{})['then'](respondWithResult(_0x13b505,0xc9))[_0x7ab5('0x41')](handleError(_0x13b505,null));};exports[_0x7ab5('0x24')]=function(_0x249d47,_0x253571){if(_0x249d47[_0x7ab5('0x45')]['id']){delete _0x249d47[_0x7ab5('0x45')]['id'];}return db[_0x7ab5('0x2b')][_0x7ab5('0x43')]({'where':{'id':_0x249d47[_0x7ab5('0x42')]['id']}})['then'](handleEntityNotFound(_0x253571,null))[_0x7ab5('0x25')](saveUpdates(_0x249d47[_0x7ab5('0x45')],null))[_0x7ab5('0x25')](respondWithResult(_0x253571,null))['catch'](handleError(_0x253571,null));};exports[_0x7ab5('0x26')]=function(_0x2a4b35,_0x52c3ce){return db['MailTransferReport'][_0x7ab5('0x43')]({'where':{'id':_0x2a4b35[_0x7ab5('0x42')]['id']}})[_0x7ab5('0x25')](handleEntityNotFound(_0x52c3ce,null))['then'](removeEntity(_0x52c3ce,null))[_0x7ab5('0x41')](handleError(_0x52c3ce,null));};exports['describe']=function(_0x3cb789,_0x52f906){return db[_0x7ab5('0x2b')][_0x7ab5('0x46')]()[_0x7ab5('0x25')](respondWithResult(_0x52f906,null))[_0x7ab5('0x41')](handleError(_0x52f906,null));}; \ No newline at end of file +var _0xa951=['crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','merge','where','options','MailTransferReport','include','rows','catch','show','params','includeAll','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel'];(function(_0x1b828a,_0x10edaf){var _0x35c70b=function(_0x2fb097){while(--_0x2fb097){_0x1b828a['push'](_0x1b828a['shift']());}};_0x35c70b(++_0x10edaf);}(_0xa951,0x1ba));var _0x1a95=function(_0x69034e,_0x4b9513){_0x69034e=_0x69034e-0x0;var _0x10976a=_0xa951[_0x69034e];return _0x10976a;};'use strict';var emlformat=require(_0x1a95('0x0'));var rimraf=require(_0x1a95('0x1'));var zipdir=require(_0x1a95('0x2'));var jsonpatch=require(_0x1a95('0x3'));var rp=require(_0x1a95('0x4'));var moment=require(_0x1a95('0x5'));var BPromise=require(_0x1a95('0x6'));var Mustache=require(_0x1a95('0x7'));var util=require(_0x1a95('0x8'));var path=require(_0x1a95('0x9'));var sox=require(_0x1a95('0xa'));var csv=require(_0x1a95('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1a95('0xc'));var _=require('lodash');var squel=require(_0x1a95('0xd'));var crypto=require(_0x1a95('0xe'));var jsforce=require(_0x1a95('0xf'));var deskjs=require(_0x1a95('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1a95('0x11'));var Redis=require(_0x1a95('0x12'));var authService=require(_0x1a95('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1a95('0x14'));var hardwareService=require(_0x1a95('0x15'));var logger=require(_0x1a95('0x16'))('api');var utils=require(_0x1a95('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1a95('0x18'))['db'];function respondWithStatusCode(_0x11a812,_0x52a741){_0x52a741=_0x52a741||0xcc;return function(_0x27958e){if(_0x27958e){return _0x11a812[_0x1a95('0x19')](_0x52a741);}return _0x11a812[_0x1a95('0x1a')](_0x52a741)['end']();};}function respondWithResult(_0x26fa31,_0x578edc){_0x578edc=_0x578edc||0xc8;return function(_0x2372cf){if(_0x2372cf){return _0x26fa31[_0x1a95('0x1a')](_0x578edc)['json'](_0x2372cf);}};}function respondWithFilteredResult(_0x2ad731,_0x4fe7db){return function(_0x28334b){if(_0x28334b){var _0x2c70a5=typeof _0x4fe7db[_0x1a95('0x1b')]==='undefined'&&typeof _0x4fe7db[_0x1a95('0x1c')]===_0x1a95('0x1d');var _0x26b9af=_0x28334b[_0x1a95('0x1e')];var _0x3a1c95=_0x2c70a5?0x0:_0x4fe7db['offset'];var _0xfb6893=_0x2c70a5?_0x28334b[_0x1a95('0x1e')]:_0x4fe7db[_0x1a95('0x1b')]+_0x4fe7db['limit'];var _0x3c4679;if(_0xfb6893>=_0x26b9af){_0xfb6893=_0x26b9af;_0x3c4679=0xc8;}else{_0x3c4679=0xce;}_0x2ad731[_0x1a95('0x1a')](_0x3c4679);return _0x2ad731[_0x1a95('0x1f')](_0x1a95('0x20'),_0x3a1c95+'-'+_0xfb6893+'/'+_0x26b9af)['json'](_0x28334b);}return null;};}function patchUpdates(_0x2f5153){return function(_0x40622a){try{jsonpatch[_0x1a95('0x21')](_0x40622a,_0x2f5153,!![]);}catch(_0x226b6d){return BPromise[_0x1a95('0x22')](_0x226b6d);}return _0x40622a[_0x1a95('0x23')]();};}function saveUpdates(_0x1391ee,_0x4e9a92){return function(_0x47031d){if(_0x47031d){return _0x47031d[_0x1a95('0x24')](_0x1391ee)[_0x1a95('0x25')](function(_0x3db9d1){return _0x3db9d1;});}return null;};}function removeEntity(_0xb988ba,_0x31d1fe){return function(_0x3d103e){if(_0x3d103e){return _0x3d103e[_0x1a95('0x26')]()[_0x1a95('0x25')](function(){_0xb988ba[_0x1a95('0x1a')](0xcc)[_0x1a95('0x27')]();});}};}function handleEntityNotFound(_0x26885d,_0xb3704f){return function(_0x7bc35c){if(!_0x7bc35c){_0x26885d[_0x1a95('0x19')](0x194);}return _0x7bc35c;};}function handleError(_0x331cb8,_0x374c69){_0x374c69=_0x374c69||0x1f4;return function(_0x6270f9){logger[_0x1a95('0x28')](_0x6270f9['stack']);if(_0x6270f9[_0x1a95('0x29')]){delete _0x6270f9[_0x1a95('0x29')];}_0x331cb8['status'](_0x374c69)[_0x1a95('0x2a')](_0x6270f9);};}exports[_0x1a95('0x2b')]=function(_0x652f0f,_0x4e38fb){var _0x26ba3c={},_0xc7ac0f={},_0x3c5bc4={'count':0x0,'rows':[]};var _0x2ce87d=_[_0x1a95('0x2c')](db['MailTransferReport'][_0x1a95('0x2d')],function(_0x502fff){return{'name':_0x502fff[_0x1a95('0x2e')],'type':_0x502fff[_0x1a95('0x2f')][_0x1a95('0x30')]};});_0xc7ac0f[_0x1a95('0x31')]=_[_0x1a95('0x2c')](_0x2ce87d,_0x1a95('0x29'));_0xc7ac0f[_0x1a95('0x32')]=_[_0x1a95('0x33')](_0x652f0f['query']);_0xc7ac0f[_0x1a95('0x34')]=_[_0x1a95('0x35')](_0xc7ac0f[_0x1a95('0x31')],_0xc7ac0f[_0x1a95('0x32')]);_0x26ba3c[_0x1a95('0x36')]=_[_0x1a95('0x35')](_0xc7ac0f[_0x1a95('0x31')],qs[_0x1a95('0x37')](_0x652f0f[_0x1a95('0x32')][_0x1a95('0x37')]));_0x26ba3c[_0x1a95('0x36')]=_0x26ba3c['attributes'][_0x1a95('0x38')]?_0x26ba3c[_0x1a95('0x36')]:_0xc7ac0f[_0x1a95('0x31')];if(!_0x652f0f[_0x1a95('0x32')]['hasOwnProperty'](_0x1a95('0x39'))){_0x26ba3c[_0x1a95('0x1c')]=qs[_0x1a95('0x1c')](_0x652f0f['query'][_0x1a95('0x1c')]);_0x26ba3c[_0x1a95('0x1b')]=qs[_0x1a95('0x1b')](_0x652f0f[_0x1a95('0x32')][_0x1a95('0x1b')]);}_0x26ba3c[_0x1a95('0x3a')]=qs[_0x1a95('0x3b')](_0x652f0f['query']['sort']);_0x26ba3c['where']=qs['filters'](_[_0x1a95('0x3c')](_0x652f0f['query'],_0xc7ac0f[_0x1a95('0x34')]),_0x2ce87d);if(_0x652f0f[_0x1a95('0x32')][_0x1a95('0x3d')]){_0x26ba3c['where']=_[_0x1a95('0x3e')](_0x26ba3c[_0x1a95('0x3f')],{'$or':_[_0x1a95('0x2c')](_0x2ce87d,function(_0x36cf8a){if(_0x36cf8a['type']!=='VIRTUAL'){var _0x53d11a={};_0x53d11a[_0x36cf8a[_0x1a95('0x29')]]={'$like':'%'+_0x652f0f[_0x1a95('0x32')][_0x1a95('0x3d')]+'%'};return _0x53d11a;}})});}_0x26ba3c=_[_0x1a95('0x3e')]({},_0x26ba3c,_0x652f0f[_0x1a95('0x40')]);var _0x3038e5={'where':_0x26ba3c['where']};return db[_0x1a95('0x41')][_0x1a95('0x1e')](_0x3038e5)['then'](function(_0x2c5d3b){_0x3c5bc4[_0x1a95('0x1e')]=_0x2c5d3b;if(_0x652f0f[_0x1a95('0x32')]['includeAll']){_0x26ba3c[_0x1a95('0x42')]=[{'all':!![]}];}return db[_0x1a95('0x41')]['findAll'](_0x26ba3c);})[_0x1a95('0x25')](function(_0x46f83e){_0x3c5bc4[_0x1a95('0x43')]=_0x46f83e;return _0x3c5bc4;})[_0x1a95('0x25')](respondWithFilteredResult(_0x4e38fb,_0x26ba3c))[_0x1a95('0x44')](handleError(_0x4e38fb,null));};exports[_0x1a95('0x45')]=function(_0x49588b,_0x46fa69){var _0x1b5932={'raw':!![],'where':{'id':_0x49588b[_0x1a95('0x46')]['id']}},_0xbb177d={};_0xbb177d[_0x1a95('0x31')]=_[_0x1a95('0x33')](db[_0x1a95('0x41')][_0x1a95('0x2d')]);_0xbb177d[_0x1a95('0x32')]=_[_0x1a95('0x33')](_0x49588b[_0x1a95('0x32')]);_0xbb177d[_0x1a95('0x34')]=_['intersection'](_0xbb177d['model'],_0xbb177d[_0x1a95('0x32')]);_0x1b5932[_0x1a95('0x36')]=_[_0x1a95('0x35')](_0xbb177d[_0x1a95('0x31')],qs[_0x1a95('0x37')](_0x49588b[_0x1a95('0x32')][_0x1a95('0x37')]));_0x1b5932[_0x1a95('0x36')]=_0x1b5932[_0x1a95('0x36')]['length']?_0x1b5932[_0x1a95('0x36')]:_0xbb177d[_0x1a95('0x31')];if(_0x49588b[_0x1a95('0x32')][_0x1a95('0x47')]){_0x1b5932[_0x1a95('0x42')]=[{'all':!![]}];}_0x1b5932=_[_0x1a95('0x3e')]({},_0x1b5932,_0x49588b['options']);return db[_0x1a95('0x41')]['find'](_0x1b5932)[_0x1a95('0x25')](handleEntityNotFound(_0x46fa69,null))['then'](respondWithResult(_0x46fa69,null))['catch'](handleError(_0x46fa69,null));};exports[_0x1a95('0x48')]=function(_0x5b18b3,_0x478790){return db[_0x1a95('0x41')][_0x1a95('0x48')](_0x5b18b3[_0x1a95('0x49')],{})['then'](respondWithResult(_0x478790,0xc9))[_0x1a95('0x44')](handleError(_0x478790,null));};exports[_0x1a95('0x24')]=function(_0xe9050f,_0x20893c){if(_0xe9050f[_0x1a95('0x49')]['id']){delete _0xe9050f[_0x1a95('0x49')]['id'];}return db[_0x1a95('0x41')][_0x1a95('0x4a')]({'where':{'id':_0xe9050f['params']['id']}})[_0x1a95('0x25')](handleEntityNotFound(_0x20893c,null))[_0x1a95('0x25')](saveUpdates(_0xe9050f[_0x1a95('0x49')],null))[_0x1a95('0x25')](respondWithResult(_0x20893c,null))[_0x1a95('0x44')](handleError(_0x20893c,null));};exports[_0x1a95('0x26')]=function(_0x33df0f,_0xbeff0d){return db[_0x1a95('0x41')][_0x1a95('0x4a')]({'where':{'id':_0x33df0f[_0x1a95('0x46')]['id']}})['then'](handleEntityNotFound(_0xbeff0d,null))[_0x1a95('0x25')](removeEntity(_0xbeff0d,null))[_0x1a95('0x44')](handleError(_0xbeff0d,null));};exports[_0x1a95('0x4b')]=function(_0x2aec36,_0x2f0d57){return db[_0x1a95('0x41')][_0x1a95('0x4b')]()[_0x1a95('0x25')](respondWithResult(_0x2f0d57,null))[_0x1a95('0x44')](handleError(_0x2f0d57,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index fed86dd..9098a4c 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 _0x1f63=['uniqueid','lodash','util','api','moment','bluebird','path','rimraf','exports','MailTransferReport','report_mail_transfer'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x1f63,0x7a));var _0x31f6=function(_0x2de33d,_0x38bbbb){_0x2de33d=_0x2de33d-0x0;var _0x5c4dc8=_0x1f63[_0x2de33d];return _0x5c4dc8;};'use strict';var _=require(_0x31f6('0x0'));var util=require(_0x31f6('0x1'));var logger=require('../../config/logger')(_0x31f6('0x2'));var moment=require(_0x31f6('0x3'));var BPromise=require(_0x31f6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x31f6('0x5'));var rimraf=require(_0x31f6('0x6'));var config=require('../../config/environment');var attributes=require('./mailTransferReport.attributes');module[_0x31f6('0x7')]=function(_0x11250b,_0xe8437e){return _0x11250b['define'](_0x31f6('0x8'),attributes,{'tableName':_0x31f6('0x9'),'paranoid':![],'indexes':[{'name':_0x31f6('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x28a2=['moment','bluebird','request-promise','rimraf','./mailTransferReport.attributes','exports','define','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x4c2f30,_0xa91340){var _0xb8854d=function(_0x5ddf3d){while(--_0x5ddf3d){_0x4c2f30['push'](_0x4c2f30['shift']());}};_0xb8854d(++_0xa91340);}(_0x28a2,0x141));var _0x228a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28a2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x228a('0x0'));var util=require(_0x228a('0x1'));var logger=require(_0x228a('0x2'))(_0x228a('0x3'));var moment=require(_0x228a('0x4'));var BPromise=require(_0x228a('0x5'));var rp=require(_0x228a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x228a('0x7'));var config=require('../../config/environment');var attributes=require(_0x228a('0x8'));module[_0x228a('0x9')]=function(_0x17727b,_0xf86d1d){return _0x17727b[_0x228a('0xa')]('MailTransferReport',attributes,{'tableName':_0x228a('0xb'),'paranoid':![],'indexes':[{'name':_0x228a('0xc'),'fields':[_0x228a('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 de17378..68c85d6 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 _0x622b=['then','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0x622b,0x1d1));var _0xb622=function(_0x4dbcd6,_0x34326c){_0x4dbcd6=_0x4dbcd6-0x0;var _0x541e55=_0x622b[_0x4dbcd6];return _0x541e55;};'use strict';var _=require(_0xb622('0x0'));var util=require(_0xb622('0x1'));var moment=require(_0xb622('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb622('0x3'));var db=require(_0xb622('0x4'))['db'];var utils=require(_0xb622('0x5'));var logger=require('../../config/logger')(_0xb622('0x6'));var config=require(_0xb622('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb622('0x8')][_0xb622('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x17226e,_0x14f907,_0x57f819){return new BPromise(function(_0xc12abe,_0x32e035){return client['request'](_0x17226e,_0x57f819)[_0xb622('0xa')](function(_0x2222aa){logger['info'](_0xb622('0xb'),_0x14f907,_0xb622('0xc'));logger['debug'](_0xb622('0xd'),_0x14f907,_0xb622('0xc'),JSON['stringify'](_0x2222aa));if(_0x2222aa['error']){if(_0x2222aa[_0xb622('0xe')][_0xb622('0xf')]===0x1f4){logger['error'](_0xb622('0xb'),_0x14f907,_0x2222aa[_0xb622('0xe')][_0xb622('0x10')]);return _0x32e035(_0x2222aa[_0xb622('0xe')][_0xb622('0x10')]);}logger['error'](_0xb622('0xb'),_0x14f907,_0x2222aa[_0xb622('0xe')][_0xb622('0x10')]);return _0xc12abe(_0x2222aa[_0xb622('0xe')][_0xb622('0x10')]);}else{logger['info']('MailTransferReport,\x20%s,\x20%s',_0x14f907,'request\x20sent');_0xc12abe(_0x2222aa[_0xb622('0x11')]['message']);}})[_0xb622('0x12')](function(_0x17f0b8){logger[_0xb622('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x14f907,_0x17f0b8);_0x32e035(_0x17f0b8);});});} \ No newline at end of file +var _0x5280=['result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0x5280,0xbf));var _0x0528=function(_0x2df1f2,_0x58d388){_0x2df1f2=_0x2df1f2-0x0;var _0x38652b=_0x5280[_0x2df1f2];return _0x38652b;};'use strict';var _=require(_0x0528('0x0'));var util=require('util');var moment=require(_0x0528('0x1'));var BPromise=require(_0x0528('0x2'));var rs=require(_0x0528('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0528('0x4'))['db'];var utils=require(_0x0528('0x5'));var logger=require(_0x0528('0x6'))(_0x0528('0x7'));var config=require(_0x0528('0x8'));var jayson=require(_0x0528('0x9'));var client=jayson['client'][_0x0528('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x42b13f,_0x3c265c,_0x44f362){return new BPromise(function(_0x2480a2,_0x1a5123){return client['request'](_0x42b13f,_0x44f362)['then'](function(_0x410d41){logger[_0x0528('0xb')](_0x0528('0xc'),_0x3c265c,'request\x20sent');logger[_0x0528('0xd')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x3c265c,_0x0528('0xe'),JSON[_0x0528('0xf')](_0x410d41));if(_0x410d41[_0x0528('0x10')]){if(_0x410d41[_0x0528('0x10')][_0x0528('0x11')]===0x1f4){logger[_0x0528('0x10')](_0x0528('0xc'),_0x3c265c,_0x410d41[_0x0528('0x10')][_0x0528('0x12')]);return _0x1a5123(_0x410d41[_0x0528('0x10')][_0x0528('0x12')]);}logger[_0x0528('0x10')](_0x0528('0xc'),_0x3c265c,_0x410d41[_0x0528('0x10')][_0x0528('0x12')]);return _0x2480a2(_0x410d41[_0x0528('0x10')][_0x0528('0x12')]);}else{logger[_0x0528('0xb')](_0x0528('0xc'),_0x3c265c,_0x0528('0xe'));_0x2480a2(_0x410d41[_0x0528('0x13')]['message']);}})[_0x0528('0x14')](function(_0x1e8b9f){logger[_0x0528('0x10')](_0x0528('0xc'),_0x3c265c,_0x1e8b9f);_0x1a5123(_0x1e8b9f);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index c234f65..3898a57 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 _0x9356=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout'];(function(_0x20118a,_0x3dbdf3){var _0x538b5f=function(_0x31c5b4){while(--_0x31c5b4){_0x20118a['push'](_0x20118a['shift']());}};_0x538b5f(++_0x3dbdf3);}(_0x9356,0x147));var _0x6935=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9356[_0x6131cd];return _0x47e916;};'use strict';var multer=require('multer');var util=require(_0x6935('0x0'));var path=require(_0x6935('0x1'));var timeout=require(_0x6935('0x2'));var express=require(_0x6935('0x3'));var router=express[_0x6935('0x4')]();var fs_extra=require(_0x6935('0x5'));var auth=require(_0x6935('0x6'));var interaction=require(_0x6935('0x7'));var config=require(_0x6935('0x8'));var controller=require(_0x6935('0x9'));router[_0x6935('0xa')]('/',auth[_0x6935('0xb')](),controller[_0x6935('0xc')]);router[_0x6935('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x6935('0xd')]);router[_0x6935('0xa')](_0x6935('0xe'),auth[_0x6935('0xb')](),controller[_0x6935('0xf')]);router[_0x6935('0x10')]('/',auth['isAuthenticated'](),controller[_0x6935('0x11')]);router[_0x6935('0x12')]('/:id',auth[_0x6935('0xb')](),controller['update']);router[_0x6935('0x13')](_0x6935('0xe'),auth['isAuthenticated'](),controller[_0x6935('0x14')]);module[_0x6935('0x15')]=router; \ No newline at end of file +var _0x8d18=['index','/describe','describe','/:id','show','create','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./memberReport.controller','get','isAuthenticated'];(function(_0x54de5d,_0x1f8b26){var _0x1b349e=function(_0xe199cc){while(--_0xe199cc){_0x54de5d['push'](_0x54de5d['shift']());}};_0x1b349e(++_0x1f8b26);}(_0x8d18,0xda));var _0x88d1=function(_0x4e5552,_0x19ec4e){_0x4e5552=_0x4e5552-0x0;var _0x60a338=_0x8d18[_0x4e5552];return _0x60a338;};'use strict';var multer=require(_0x88d1('0x0'));var util=require(_0x88d1('0x1'));var path=require(_0x88d1('0x2'));var timeout=require(_0x88d1('0x3'));var express=require('express');var router=express[_0x88d1('0x4')]();var fs_extra=require(_0x88d1('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x88d1('0x6'));var controller=require(_0x88d1('0x7'));router[_0x88d1('0x8')]('/',auth[_0x88d1('0x9')](),controller[_0x88d1('0xa')]);router['get'](_0x88d1('0xb'),auth[_0x88d1('0x9')](),controller[_0x88d1('0xc')]);router[_0x88d1('0x8')](_0x88d1('0xd'),auth[_0x88d1('0x9')](),controller[_0x88d1('0xe')]);router['post']('/',auth[_0x88d1('0x9')](),controller[_0x88d1('0xf')]);router['put'](_0x88d1('0xd'),auth[_0x88d1('0x9')](),controller[_0x88d1('0x10')]);router[_0x88d1('0x11')](_0x88d1('0xd'),auth[_0x88d1('0x9')](),controller[_0x88d1('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index f78dd10..8195469 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 _0x095f=['talk:[start]','talk:[destination]','talk:[dial\x20string]','sequelize','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]'];(function(_0x467ef6,_0x932cef){var _0x3e4aa2=function(_0xb56bb5){while(--_0xb56bb5){_0x467ef6['push'](_0x467ef6['shift']());}};_0x3e4aa2(++_0x932cef);}(_0x095f,0x102));var _0xf095=function(_0x60ba03,_0x16d62b){_0x60ba03=_0x60ba03-0x0;var _0x268a9c=_0x095f[_0x60ba03];return _0x268a9c;};'use strict';var Sequelize=require(_0xf095('0x0'));var moment=require('moment');module['exports']={'channel':{'type':Sequelize[_0xf095('0x1')]},'membername':{'type':Sequelize[_0xf095('0x1')]},'interface':{'type':Sequelize[_0xf095('0x1')]},'type':{'type':Sequelize[_0xf095('0x1')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0xf095('0x2')},'duration':{'type':Sequelize[_0xf095('0x3')]},'enterAt':{'type':Sequelize[_0xf095('0x4')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x36296c){var _0x26e2e6=moment(_0x36296c);var _0x281ea4=moment(this[_0xf095('0x5')](_0xf095('0x6')));var _0x5a7756=_0x26e2e6[_0xf095('0x7')](_0x281ea4,_0xf095('0x8'));this[_0xf095('0x9')]('exitAt',_0x36296c);this['setDataValue'](_0xf095('0xa'),_0x5a7756>=0x0?_0x5a7756:null);}},'data1':{'type':Sequelize[_0xf095('0x1')],'comment':_0xf095('0xb')},'data2':{'type':Sequelize[_0xf095('0x1')],'comment':_0xf095('0xc')},'data3':{'type':Sequelize['STRING'],'comment':_0xf095('0xd')},'data4':{'type':Sequelize[_0xf095('0x1')],'comment':_0xf095('0xe')},'data5':{'type':Sequelize[_0xf095('0x1')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0xf095('0x1')]},'internal':{'type':Sequelize[_0xf095('0x3')]},'uniqueid':{'type':Sequelize[_0xf095('0x1')]}}; \ No newline at end of file +var _0x0739=['setDataValue','talk:[start]','talk:[destination]','talk:[dial\x20string]','sequelize','moment','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','diff','seconds'];(function(_0x3ca6aa,_0x163df9){var _0x1c34d5=function(_0x119bda){while(--_0x119bda){_0x3ca6aa['push'](_0x3ca6aa['shift']());}};_0x1c34d5(++_0x163df9);}(_0x0739,0xba));var _0x9073=function(_0x14076c,_0x2da3e4){_0x14076c=_0x14076c-0x0;var _0x338630=_0x0739[_0x14076c];return _0x338630;};'use strict';var Sequelize=require(_0x9073('0x0'));var moment=require(_0x9073('0x1'));module[_0x9073('0x2')]={'channel':{'type':Sequelize[_0x9073('0x3')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x9073('0x3')]},'type':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x9073('0x4')},'duration':{'type':Sequelize[_0x9073('0x5')]},'enterAt':{'type':Sequelize[_0x9073('0x6')]},'exitAt':{'type':Sequelize[_0x9073('0x6')],'set':function(_0x5511e2){var _0x17adc2=moment(_0x5511e2);var _0xdc1bc8=moment(this[_0x9073('0x7')]('enterAt'));var _0x136e15=_0x17adc2[_0x9073('0x8')](_0xdc1bc8,_0x9073('0x9'));this[_0x9073('0xa')]('exitAt',_0x5511e2);this[_0x9073('0xa')]('duration',_0x136e15>=0x0?_0x136e15:null);}},'data1':{'type':Sequelize['STRING'],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x9073('0x3')],'comment':_0x9073('0xb')},'data3':{'type':Sequelize[_0x9073('0x3')],'comment':_0x9073('0xc')},'data4':{'type':Sequelize[_0x9073('0x3')],'comment':_0x9073('0xd')},'data5':{'type':Sequelize[_0x9073('0x3')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x9073('0x3')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x9073('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index e59cd88..93c96d9 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(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x55ca[_0x4c12ec];return _0x3ae42c;};'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(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x34e8,0x12c));var _0x834e=function(_0x5121df,_0x5f41f7){_0x5121df=_0x5121df-0x0;var _0x5ac69e=_0x34e8[_0x5121df];return _0x5ac69e;};'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 a969381..bebbcde 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 _0x9cd2=['interface','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./memberReport.attributes','exports','define','membername_interface'];(function(_0x5108fb,_0x53b8d2){var _0x35fee7=function(_0x15499f){while(--_0x15499f){_0x5108fb['push'](_0x5108fb['shift']());}};_0x35fee7(++_0x53b8d2);}(_0x9cd2,0x85));var _0x29cd=function(_0x383627,_0x5be16e){_0x383627=_0x383627-0x0;var _0x2c16a0=_0x9cd2[_0x383627];return _0x2c16a0;};'use strict';var _=require(_0x29cd('0x0'));var util=require('util');var logger=require(_0x29cd('0x1'))(_0x29cd('0x2'));var moment=require(_0x29cd('0x3'));var BPromise=require(_0x29cd('0x4'));var rp=require(_0x29cd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x29cd('0x6'));var attributes=require(_0x29cd('0x7'));module[_0x29cd('0x8')]=function(_0x3e4a25,_0x376643){return _0x3e4a25[_0x29cd('0x9')]('MemberReport',attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x29cd('0xa'),'fields':['membername',_0x29cd('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9c94=['bluebird','request-promise','rimraf','../../config/environment','./memberReport.attributes','define','report_member','membername_interface','membername','interface','lodash','util','api'];(function(_0xc64242,_0x1dca2c){var _0x5b197c=function(_0x14b616){while(--_0x14b616){_0xc64242['push'](_0xc64242['shift']());}};_0x5b197c(++_0x1dca2c);}(_0x9c94,0x99));var _0x49c9=function(_0x489b87,_0xd51c93){_0x489b87=_0x489b87-0x0;var _0x1823b6=_0x9c94[_0x489b87];return _0x1823b6;};'use strict';var _=require(_0x49c9('0x0'));var util=require(_0x49c9('0x1'));var logger=require('../../config/logger')(_0x49c9('0x2'));var moment=require('moment');var BPromise=require(_0x49c9('0x3'));var rp=require(_0x49c9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x49c9('0x5'));var config=require(_0x49c9('0x6'));var attributes=require(_0x49c9('0x7'));module['exports']=function(_0x16bfb0,_0x492954){return _0x16bfb0[_0x49c9('0x8')]('MemberReport',attributes,{'tableName':_0x49c9('0x9'),'paranoid':![],'indexes':[{'name':_0x49c9('0xa'),'fields':[_0x49c9('0xb'),_0x49c9('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 7246cd9..8c24607 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 _0x89b8=['map','model','GetMemberReport','CreateMemberReport','stringify','UpdateMemberReport','body','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','MemberReport','options','raw','where','attributes','include'];(function(_0x257987,_0x5a5315){var _0x6878c3=function(_0xe81fb0){while(--_0xe81fb0){_0x257987['push'](_0x257987['shift']());}};_0x6878c3(++_0x5a5315);}(_0x89b8,0x19f));var _0x889b=function(_0x17117c,_0xdd0495){_0x17117c=_0x17117c-0x0;var _0x3491cc=_0x89b8[_0x17117c];return _0x3491cc;};'use strict';var _=require(_0x889b('0x0'));var util=require(_0x889b('0x1'));var moment=require(_0x889b('0x2'));var BPromise=require(_0x889b('0x3'));var rs=require(_0x889b('0x4'));var fs=require('fs');var Redis=require(_0x889b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x889b('0x6'));var logger=require(_0x889b('0x7'))(_0x889b('0x8'));var config=require('../../config/environment');var jayson=require(_0x889b('0x9'));var client=jayson[_0x889b('0xa')][_0x889b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49313d,_0x3ea048,_0x403af7){return new BPromise(function(_0x310a10,_0xaf7cdd){return client[_0x889b('0xc')](_0x49313d,_0x403af7)[_0x889b('0xd')](function(_0x430615){logger[_0x889b('0xe')](_0x889b('0xf'),_0x3ea048,_0x889b('0x10'));logger[_0x889b('0x11')](_0x889b('0x12'),_0x3ea048,'request\x20sent',JSON['stringify'](_0x430615));if(_0x430615[_0x889b('0x13')]){if(_0x430615[_0x889b('0x13')]['code']===0x1f4){logger[_0x889b('0x13')](_0x889b('0xf'),_0x3ea048,_0x430615['error'][_0x889b('0x14')]);return _0xaf7cdd(_0x430615['error'][_0x889b('0x14')]);}logger[_0x889b('0x13')]('MemberReport,\x20%s,\x20%s',_0x3ea048,_0x430615[_0x889b('0x13')][_0x889b('0x14')]);return _0x310a10(_0x430615['error']['message']);}else{logger['info'](_0x889b('0xf'),_0x3ea048,_0x889b('0x10'));_0x310a10(_0x430615[_0x889b('0x15')][_0x889b('0x14')]);}})[_0x889b('0x16')](function(_0x339556){logger['error'](_0x889b('0xf'),_0x3ea048,_0x339556);_0xaf7cdd(_0x339556);});});}exports['GetMemberReport']=function(_0x1221ae){var _0x358ccf=this;return new Promise(function(_0x22b059,_0x3b2381){return db[_0x889b('0x17')]['findAll']({'raw':_0x1221ae[_0x889b('0x18')]?_0x1221ae[_0x889b('0x18')][_0x889b('0x19')]===undefined?!![]:![]:!![],'where':_0x1221ae[_0x889b('0x18')]?_0x1221ae[_0x889b('0x18')][_0x889b('0x1a')]||null:null,'attributes':_0x1221ae[_0x889b('0x18')]?_0x1221ae[_0x889b('0x18')][_0x889b('0x1b')]||null:null,'limit':_0x1221ae[_0x889b('0x18')]?_0x1221ae[_0x889b('0x18')]['limit']||null:null,'include':_0x1221ae['options']?_0x1221ae['options'][_0x889b('0x1c')]?_['map'](_0x1221ae['options'][_0x889b('0x1c')],function(_0x3ebaad){return{'model':db[_0x3ebaad['model']],'as':_0x3ebaad['as'],'attributes':_0x3ebaad[_0x889b('0x1b')],'include':_0x3ebaad['include']?_[_0x889b('0x1d')](_0x3ebaad[_0x889b('0x1c')],function(_0x2f9b13){return{'model':db[_0x2f9b13[_0x889b('0x1e')]],'as':_0x2f9b13['as'],'attributes':_0x2f9b13['attributes'],'include':_0x2f9b13['include']?_[_0x889b('0x1d')](_0x2f9b13['include'],function(_0x3962d8){return{'model':db[_0x3962d8['model']],'as':_0x3962d8['as'],'attributes':_0x3962d8[_0x889b('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c7c92){logger[_0x889b('0xe')](_0x889b('0x1f'),_0x1221ae);logger[_0x889b('0x11')](_0x889b('0x1f'),_0x1221ae,JSON['stringify'](_0x3c7c92));_0x22b059(_0x3c7c92);})['catch'](function(_0x395aab){logger[_0x889b('0x13')]('GetMemberReport',_0x395aab['message'],_0x1221ae);_0x3b2381(_0x358ccf[_0x889b('0x13')](0x1f4,_0x395aab[_0x889b('0x14')]));});});};exports[_0x889b('0x20')]=function(_0x17408e){var _0x1321c9=this;return new Promise(function(_0xb6748b,_0x41c417){return db[_0x889b('0x17')]['create'](_0x17408e['body'],{'raw':_0x17408e['options']?_0x17408e[_0x889b('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x889b('0xd')](function(_0x5bbe74){logger[_0x889b('0xe')](_0x889b('0x20'),_0x17408e);logger[_0x889b('0x11')](_0x889b('0x20'),_0x17408e,JSON[_0x889b('0x21')](_0x5bbe74));_0xb6748b(_0x5bbe74);})['catch'](function(_0x364611){logger['error'](_0x889b('0x20'),_0x364611[_0x889b('0x14')],_0x17408e);_0x41c417(_0x1321c9[_0x889b('0x13')](0x1f4,_0x364611['message']));});});};exports[_0x889b('0x22')]=function(_0x43b923){var _0x3cf51b=this;return new Promise(function(_0x3bde7b,_0x55c4ed){return db['MemberReport']['update'](_0x43b923[_0x889b('0x23')],{'raw':_0x43b923['options']?_0x43b923[_0x889b('0x18')][_0x889b('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43b923[_0x889b('0x18')]?_0x43b923['options'][_0x889b('0x1a')]||null:null,'attributes':_0x43b923[_0x889b('0x18')]?_0x43b923[_0x889b('0x18')]['attributes']||null:null,'limit':_0x43b923[_0x889b('0x18')]?_0x43b923[_0x889b('0x18')][_0x889b('0x24')]||null:null})[_0x889b('0xd')](function(_0x14d27c){logger[_0x889b('0xe')](_0x889b('0x22'),_0x43b923);logger[_0x889b('0x11')](_0x889b('0x22'),_0x43b923,JSON[_0x889b('0x21')](_0x14d27c));_0x3bde7b(_0x14d27c);})[_0x889b('0x16')](function(_0x106358){logger['error']('UpdateMemberReport',_0x106358[_0x889b('0x14')],_0x43b923);_0x55c4ed(_0x3cf51b[_0x889b('0x13')](0x1f4,_0x106358['message']));});});}; \ No newline at end of file +var _0x4553=['body','UpdateMemberReport','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MemberReport,\x20%s,\x20%s','message','result','GetMemberReport','findAll','options','raw','where','limit','include','model','attributes','map','catch','CreateMemberReport','MemberReport'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4553,0x1be));var _0x3455=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x4553[_0x25bea7];return _0x175952;};'use strict';var _=require('lodash');var util=require(_0x3455('0x0'));var moment=require(_0x3455('0x1'));var BPromise=require(_0x3455('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3455('0x3'))['db'];var utils=require(_0x3455('0x4'));var logger=require(_0x3455('0x5'))(_0x3455('0x6'));var config=require(_0x3455('0x7'));var jayson=require(_0x3455('0x8'));var client=jayson[_0x3455('0x9')][_0x3455('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e1e1f,_0x5b61bb,_0x362d07){return new BPromise(function(_0x4c0c61,_0x2ced4a){return client['request'](_0x3e1e1f,_0x362d07)[_0x3455('0xb')](function(_0xe8aa2e){logger[_0x3455('0xc')]('MemberReport,\x20%s,\x20%s',_0x5b61bb,'request\x20sent');logger[_0x3455('0xd')](_0x3455('0xe'),_0x5b61bb,_0x3455('0xf'),JSON[_0x3455('0x10')](_0xe8aa2e));if(_0xe8aa2e[_0x3455('0x11')]){if(_0xe8aa2e[_0x3455('0x11')][_0x3455('0x12')]===0x1f4){logger[_0x3455('0x11')](_0x3455('0x13'),_0x5b61bb,_0xe8aa2e[_0x3455('0x11')][_0x3455('0x14')]);return _0x2ced4a(_0xe8aa2e[_0x3455('0x11')][_0x3455('0x14')]);}logger[_0x3455('0x11')](_0x3455('0x13'),_0x5b61bb,_0xe8aa2e[_0x3455('0x11')][_0x3455('0x14')]);return _0x4c0c61(_0xe8aa2e['error'][_0x3455('0x14')]);}else{logger[_0x3455('0xc')](_0x3455('0x13'),_0x5b61bb,_0x3455('0xf'));_0x4c0c61(_0xe8aa2e[_0x3455('0x15')][_0x3455('0x14')]);}})['catch'](function(_0x383b55){logger[_0x3455('0x11')](_0x3455('0x13'),_0x5b61bb,_0x383b55);_0x2ced4a(_0x383b55);});});}exports[_0x3455('0x16')]=function(_0x4d3915){var _0x178518=this;return new Promise(function(_0x59d493,_0x157310){return db['MemberReport'][_0x3455('0x17')]({'raw':_0x4d3915[_0x3455('0x18')]?_0x4d3915[_0x3455('0x18')][_0x3455('0x19')]===undefined?!![]:![]:!![],'where':_0x4d3915[_0x3455('0x18')]?_0x4d3915[_0x3455('0x18')][_0x3455('0x1a')]||null:null,'attributes':_0x4d3915[_0x3455('0x18')]?_0x4d3915[_0x3455('0x18')]['attributes']||null:null,'limit':_0x4d3915[_0x3455('0x18')]?_0x4d3915[_0x3455('0x18')][_0x3455('0x1b')]||null:null,'include':_0x4d3915['options']?_0x4d3915[_0x3455('0x18')][_0x3455('0x1c')]?_['map'](_0x4d3915['options'][_0x3455('0x1c')],function(_0x13b9af){return{'model':db[_0x13b9af[_0x3455('0x1d')]],'as':_0x13b9af['as'],'attributes':_0x13b9af[_0x3455('0x1e')],'include':_0x13b9af['include']?_[_0x3455('0x1f')](_0x13b9af['include'],function(_0x252f87){return{'model':db[_0x252f87['model']],'as':_0x252f87['as'],'attributes':_0x252f87[_0x3455('0x1e')],'include':_0x252f87[_0x3455('0x1c')]?_[_0x3455('0x1f')](_0x252f87['include'],function(_0x3658a4){return{'model':db[_0x3658a4[_0x3455('0x1d')]],'as':_0x3658a4['as'],'attributes':_0x3658a4[_0x3455('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x3455('0xb')](function(_0x594780){logger['info'](_0x3455('0x16'),_0x4d3915);logger[_0x3455('0xd')](_0x3455('0x16'),_0x4d3915,JSON['stringify'](_0x594780));_0x59d493(_0x594780);})[_0x3455('0x20')](function(_0x25e280){logger[_0x3455('0x11')](_0x3455('0x16'),_0x25e280['message'],_0x4d3915);_0x157310(_0x178518[_0x3455('0x11')](0x1f4,_0x25e280[_0x3455('0x14')]));});});};exports[_0x3455('0x21')]=function(_0x178bec){var _0x3ff829=this;return new Promise(function(_0x57c8ab,_0x13c62f){return db[_0x3455('0x22')]['create'](_0x178bec[_0x3455('0x23')],{'raw':_0x178bec['options']?_0x178bec[_0x3455('0x18')][_0x3455('0x19')]===undefined?!![]:![]:!![]})[_0x3455('0xb')](function(_0x1b71c0){logger['info'](_0x3455('0x21'),_0x178bec);logger['debug'](_0x3455('0x21'),_0x178bec,JSON[_0x3455('0x10')](_0x1b71c0));_0x57c8ab(_0x1b71c0);})[_0x3455('0x20')](function(_0x57d61b){logger[_0x3455('0x11')](_0x3455('0x21'),_0x57d61b['message'],_0x178bec);_0x13c62f(_0x3ff829['error'](0x1f4,_0x57d61b[_0x3455('0x14')]));});});};exports[_0x3455('0x24')]=function(_0x2b0a6e){var _0x537f47=this;return new Promise(function(_0x8c34db,_0x32534e){return db[_0x3455('0x22')]['update'](_0x2b0a6e[_0x3455('0x23')],{'raw':_0x2b0a6e[_0x3455('0x18')]?_0x2b0a6e['options'][_0x3455('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b0a6e[_0x3455('0x18')]?_0x2b0a6e['options'][_0x3455('0x1a')]||null:null,'attributes':_0x2b0a6e[_0x3455('0x18')]?_0x2b0a6e['options'][_0x3455('0x1e')]||null:null,'limit':_0x2b0a6e[_0x3455('0x18')]?_0x2b0a6e['options'][_0x3455('0x1b')]||null:null})[_0x3455('0xb')](function(_0x189090){logger['info'](_0x3455('0x24'),_0x2b0a6e);logger['debug'](_0x3455('0x24'),_0x2b0a6e,JSON[_0x3455('0x10')](_0x189090));_0x8c34db(_0x189090);})['catch'](function(_0x478d93){logger[_0x3455('0x11')](_0x3455('0x24'),_0x478d93['message'],_0x2b0a6e);_0x32534e(_0x537f47[_0x3455('0x11')](0x1f4,_0x478d93[_0x3455('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index a6390c5..269a9d0 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 _0x8436=['util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./migration.controller','exports','multer'];(function(_0x11998c,_0x317bae){var _0x5beabc=function(_0x43fa81){while(--_0x43fa81){_0x11998c['push'](_0x11998c['shift']());}};_0x5beabc(++_0x317bae);}(_0x8436,0xd7));var _0x6843=function(_0x50a281,_0x82f05f){_0x50a281=_0x50a281-0x0;var _0x11060a=_0x8436[_0x50a281];return _0x11060a;};'use strict';var multer=require(_0x6843('0x0'));var util=require(_0x6843('0x1'));var path=require('path');var timeout=require(_0x6843('0x2'));var express=require(_0x6843('0x3'));var router=express[_0x6843('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6843('0x5'));var config=require(_0x6843('0x6'));var controller=require(_0x6843('0x7'));router['get']('/',controller['index']);module[_0x6843('0x8')]=router; \ No newline at end of file +var _0xaa96=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xaa96,0x145));var _0x6aa9=function(_0x335647,_0x13f7a0){_0x335647=_0x335647-0x0;var _0x5dbf94=_0xaa96[_0x335647];return _0x5dbf94;};'use strict';var multer=require('multer');var util=require(_0x6aa9('0x0'));var path=require(_0x6aa9('0x1'));var timeout=require(_0x6aa9('0x2'));var express=require(_0x6aa9('0x3'));var router=express[_0x6aa9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6aa9('0x5'));var interaction=require(_0x6aa9('0x6'));var config=require(_0x6aa9('0x7'));var controller=require(_0x6aa9('0x8'));router[_0x6aa9('0x9')]('/',controller[_0x6aa9('0xa')]);module[_0x6aa9('0xb')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 96b41b5..16cb6b0 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 _0x7fb1=['sequelize','exports','version'];(function(_0xaa2193,_0x1865d3){var _0x20b364=function(_0x41b09e){while(--_0x41b09e){_0xaa2193['push'](_0xaa2193['shift']());}};_0x20b364(++_0x1865d3);}(_0x7fb1,0xae));var _0x17fb=function(_0x3b5d0a,_0x35b8cb){_0x3b5d0a=_0x3b5d0a-0x0;var _0x5c9765=_0x7fb1[_0x3b5d0a];return _0x5c9765;};'use strict';var Sequelize=require(_0x17fb('0x0'));module[_0x17fb('0x1')]={'version':{'type':Sequelize['STRING'],'unique':_0x17fb('0x2')}}; \ No newline at end of file +var _0x5947=['sequelize','exports','STRING','version'];(function(_0x1d0c95,_0x1e2a16){var _0x16caf4=function(_0x2fb7e9){while(--_0x2fb7e9){_0x1d0c95['push'](_0x1d0c95['shift']());}};_0x16caf4(++_0x1e2a16);}(_0x5947,0x78));var _0x7594=function(_0x1e5b73,_0x3d7907){_0x1e5b73=_0x1e5b73-0x0;var _0x5b7503=_0x5947[_0x1e5b73];return _0x5b7503;};'use strict';var Sequelize=require(_0x7594('0x0'));module[_0x7594('0x1')]={'version':{'type':Sequelize[_0x7594('0x2')],'unique':_0x7594('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 15785cf..53c00b3 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 _0x973b=['sox','ejs','fs-extra','squel','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','then','name','index','Migration','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','where','merge','includeAll','include','findAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x1faa2c,_0xe8257b){var _0x1d55db=function(_0x4e1557){while(--_0x4e1557){_0x1faa2c['push'](_0x1faa2c['shift']());}};_0x1d55db(++_0xe8257b);}(_0x973b,0x6e));var _0xb973=function(_0x3382c9,_0x5242a0){_0x3382c9=_0x3382c9-0x0;var _0x3b8d9d=_0x973b[_0x3382c9];return _0x3b8d9d;};'use strict';var emlformat=require(_0xb973('0x0'));var rimraf=require(_0xb973('0x1'));var zipdir=require(_0xb973('0x2'));var jsonpatch=require(_0xb973('0x3'));var rp=require(_0xb973('0x4'));var moment=require(_0xb973('0x5'));var BPromise=require(_0xb973('0x6'));var Mustache=require(_0xb973('0x7'));var util=require(_0xb973('0x8'));var path=require(_0xb973('0x9'));var sox=require(_0xb973('0xa'));var csv=require('to-csv');var ejs=require(_0xb973('0xb'));var fs=require('fs');var fs_extra=require(_0xb973('0xc'));var _=require('lodash');var squel=require(_0xb973('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb973('0xe'));var toCsv=require(_0xb973('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb973('0x10'));var authService=require(_0xb973('0x11'));var qs=require(_0xb973('0x12'));var as=require(_0xb973('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb973('0x14'));var utils=require(_0xb973('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb973('0x16'))['db'];function respondWithStatusCode(_0x291807,_0x160977){_0x160977=_0x160977||0xcc;return function(_0x524df0){if(_0x524df0){return _0x291807[_0xb973('0x17')](_0x160977);}return _0x291807[_0xb973('0x18')](_0x160977)[_0xb973('0x19')]();};}function respondWithResult(_0x1b02f0,_0x4baa50){_0x4baa50=_0x4baa50||0xc8;return function(_0x3e3861){if(_0x3e3861){return _0x1b02f0['status'](_0x4baa50)[_0xb973('0x1a')](_0x3e3861);}};}function respondWithFilteredResult(_0x137dc2,_0x1cd4ac){return function(_0x3de1b1){if(_0x3de1b1){var _0x2479c3=typeof _0x1cd4ac[_0xb973('0x1b')]===_0xb973('0x1c')&&typeof _0x1cd4ac[_0xb973('0x1d')]===_0xb973('0x1c');var _0x302834=_0x3de1b1[_0xb973('0x1e')];var _0x232ec8=_0x2479c3?0x0:_0x1cd4ac[_0xb973('0x1b')];var _0x398db0=_0x2479c3?_0x3de1b1[_0xb973('0x1e')]:_0x1cd4ac['offset']+_0x1cd4ac[_0xb973('0x1d')];var _0x5089c8;if(_0x398db0>=_0x302834){_0x398db0=_0x302834;_0x5089c8=0xc8;}else{_0x5089c8=0xce;}_0x137dc2[_0xb973('0x18')](_0x5089c8);return _0x137dc2[_0xb973('0x1f')]('Content-Range',_0x232ec8+'-'+_0x398db0+'/'+_0x302834)[_0xb973('0x1a')](_0x3de1b1);}return null;};}function patchUpdates(_0x44437f){return function(_0x42546a){try{jsonpatch[_0xb973('0x20')](_0x42546a,_0x44437f,!![]);}catch(_0x3fb8c8){return BPromise['reject'](_0x3fb8c8);}return _0x42546a[_0xb973('0x21')]();};}function saveUpdates(_0x2af6d9,_0x1eebd2){return function(_0x51ab30){if(_0x51ab30){return _0x51ab30['update'](_0x2af6d9)[_0xb973('0x22')](function(_0x531876){return _0x531876;});}return null;};}function removeEntity(_0xa6229a,_0x562126){return function(_0xc0ce1a){if(_0xc0ce1a){return _0xc0ce1a['destroy']()[_0xb973('0x22')](function(){_0xa6229a[_0xb973('0x18')](0xcc)[_0xb973('0x19')]();});}};}function handleEntityNotFound(_0x2cd036,_0x5c419b){return function(_0x161591){if(!_0x161591){_0x2cd036[_0xb973('0x17')](0x194);}return _0x161591;};}function handleError(_0x55152c,_0x3c9667){_0x3c9667=_0x3c9667||0x1f4;return function(_0xbdeb98){logger['error'](_0xbdeb98['stack']);if(_0xbdeb98[_0xb973('0x23')]){delete _0xbdeb98[_0xb973('0x23')];}_0x55152c[_0xb973('0x18')](_0x3c9667)['send'](_0xbdeb98);};}exports[_0xb973('0x24')]=function(_0x5f5a0a,_0x40b1a9){var _0x2561f4={},_0x5a7164={},_0x34adf6={'count':0x0,'rows':[]};var _0x24e942=_['map'](db[_0xb973('0x25')]['rawAttributes'],function(_0x40e1bc){return{'name':_0x40e1bc[_0xb973('0x26')],'type':_0x40e1bc[_0xb973('0x27')][_0xb973('0x28')]};});_0x5a7164[_0xb973('0x29')]=_[_0xb973('0x2a')](_0x24e942,_0xb973('0x23'));_0x5a7164[_0xb973('0x2b')]=_['keys'](_0x5f5a0a[_0xb973('0x2b')]);_0x5a7164[_0xb973('0x2c')]=_[_0xb973('0x2d')](_0x5a7164[_0xb973('0x29')],_0x5a7164[_0xb973('0x2b')]);_0x2561f4[_0xb973('0x2e')]=_[_0xb973('0x2d')](_0x5a7164[_0xb973('0x29')],qs[_0xb973('0x2f')](_0x5f5a0a[_0xb973('0x2b')]['fields']));_0x2561f4[_0xb973('0x2e')]=_0x2561f4[_0xb973('0x2e')][_0xb973('0x30')]?_0x2561f4[_0xb973('0x2e')]:_0x5a7164[_0xb973('0x29')];if(!_0x5f5a0a[_0xb973('0x2b')]['hasOwnProperty'](_0xb973('0x31'))){_0x2561f4[_0xb973('0x1d')]=qs[_0xb973('0x1d')](_0x5f5a0a[_0xb973('0x2b')][_0xb973('0x1d')]);_0x2561f4['offset']=qs[_0xb973('0x1b')](_0x5f5a0a[_0xb973('0x2b')][_0xb973('0x1b')]);}_0x2561f4['order']=qs[_0xb973('0x32')](_0x5f5a0a['query'][_0xb973('0x32')]);_0x2561f4['where']=qs[_0xb973('0x2c')](_[_0xb973('0x33')](_0x5f5a0a[_0xb973('0x2b')],_0x5a7164[_0xb973('0x2c')]),_0x24e942);if(_0x5f5a0a['query'][_0xb973('0x34')]){_0x2561f4[_0xb973('0x35')]=_[_0xb973('0x36')](_0x2561f4[_0xb973('0x35')],{'$or':_[_0xb973('0x2a')](_0x24e942,function(_0x190ea0){if(_0x190ea0[_0xb973('0x27')]!=='VIRTUAL'){var _0x383225={};_0x383225[_0x190ea0[_0xb973('0x23')]]={'$like':'%'+_0x5f5a0a[_0xb973('0x2b')][_0xb973('0x34')]+'%'};return _0x383225;}})});}_0x2561f4=_['merge']({},_0x2561f4,_0x5f5a0a['options']);var _0x2bdda8={'where':_0x2561f4[_0xb973('0x35')]};return db[_0xb973('0x25')][_0xb973('0x1e')](_0x2bdda8)['then'](function(_0x3bd82f){_0x34adf6[_0xb973('0x1e')]=_0x3bd82f;if(_0x5f5a0a[_0xb973('0x2b')][_0xb973('0x37')]){_0x2561f4[_0xb973('0x38')]=[{'all':!![]}];}return db[_0xb973('0x25')][_0xb973('0x39')](_0x2561f4);})[_0xb973('0x22')](function(_0x57038c){_0x34adf6[_0xb973('0x3a')]=_0x57038c;return _0x34adf6;})[_0xb973('0x22')](respondWithFilteredResult(_0x40b1a9,_0x2561f4))[_0xb973('0x3b')](handleError(_0x40b1a9,null));}; \ No newline at end of file +var _0x8ec9=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','sendStatus','error','stack','name','send','index','map','Migration','rawAttributes','fieldName','key','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x8ec9,0x8d));var _0x98ec=function(_0x3090d3,_0x1994b2){_0x3090d3=_0x3090d3-0x0;var _0x4251c1=_0x8ec9[_0x3090d3];return _0x4251c1;};'use strict';var emlformat=require(_0x98ec('0x0'));var rimraf=require(_0x98ec('0x1'));var zipdir=require(_0x98ec('0x2'));var jsonpatch=require(_0x98ec('0x3'));var rp=require('request-promise');var moment=require(_0x98ec('0x4'));var BPromise=require(_0x98ec('0x5'));var Mustache=require(_0x98ec('0x6'));var util=require(_0x98ec('0x7'));var path=require(_0x98ec('0x8'));var sox=require(_0x98ec('0x9'));var csv=require(_0x98ec('0xa'));var ejs=require(_0x98ec('0xb'));var fs=require('fs');var fs_extra=require(_0x98ec('0xc'));var _=require(_0x98ec('0xd'));var squel=require(_0x98ec('0xe'));var crypto=require('crypto');var jsforce=require(_0x98ec('0xf'));var deskjs=require(_0x98ec('0x10'));var toCsv=require('to-csv');var querystring=require(_0x98ec('0x11'));var Papa=require('papaparse');var Redis=require(_0x98ec('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x98ec('0x13'));var as=require(_0x98ec('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x98ec('0x15'));var utils=require(_0x98ec('0x16'));var config=require(_0x98ec('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x98ec('0x18'))['db'];function respondWithStatusCode(_0x3e42bc,_0x3de5cb){_0x3de5cb=_0x3de5cb||0xcc;return function(_0x25b432){if(_0x25b432){return _0x3e42bc['sendStatus'](_0x3de5cb);}return _0x3e42bc[_0x98ec('0x19')](_0x3de5cb)[_0x98ec('0x1a')]();};}function respondWithResult(_0x5a5fa0,_0x5e41eb){_0x5e41eb=_0x5e41eb||0xc8;return function(_0x347ed3){if(_0x347ed3){return _0x5a5fa0[_0x98ec('0x19')](_0x5e41eb)[_0x98ec('0x1b')](_0x347ed3);}};}function respondWithFilteredResult(_0x5a6fcd,_0x2f68fb){return function(_0x20e85d){if(_0x20e85d){var _0x69df1b=typeof _0x2f68fb[_0x98ec('0x1c')]===_0x98ec('0x1d')&&typeof _0x2f68fb[_0x98ec('0x1e')]===_0x98ec('0x1d');var _0x27b867=_0x20e85d['count'];var _0x454fd1=_0x69df1b?0x0:_0x2f68fb[_0x98ec('0x1c')];var _0x22f588=_0x69df1b?_0x20e85d[_0x98ec('0x1f')]:_0x2f68fb[_0x98ec('0x1c')]+_0x2f68fb[_0x98ec('0x1e')];var _0xe7d1e0;if(_0x22f588>=_0x27b867){_0x22f588=_0x27b867;_0xe7d1e0=0xc8;}else{_0xe7d1e0=0xce;}_0x5a6fcd[_0x98ec('0x19')](_0xe7d1e0);return _0x5a6fcd[_0x98ec('0x20')](_0x98ec('0x21'),_0x454fd1+'-'+_0x22f588+'/'+_0x27b867)['json'](_0x20e85d);}return null;};}function patchUpdates(_0x456994){return function(_0x279a12){try{jsonpatch[_0x98ec('0x22')](_0x279a12,_0x456994,!![]);}catch(_0x19d1a7){return BPromise[_0x98ec('0x23')](_0x19d1a7);}return _0x279a12['save']();};}function saveUpdates(_0x1e716b,_0x1454bb){return function(_0x4c56be){if(_0x4c56be){return _0x4c56be[_0x98ec('0x24')](_0x1e716b)['then'](function(_0x76c820){return _0x76c820;});}return null;};}function removeEntity(_0x945dea,_0x146565){return function(_0x5f2355){if(_0x5f2355){return _0x5f2355[_0x98ec('0x25')]()[_0x98ec('0x26')](function(){_0x945dea[_0x98ec('0x19')](0xcc)[_0x98ec('0x1a')]();});}};}function handleEntityNotFound(_0x48b53f,_0x3e5edd){return function(_0x81c7d8){if(!_0x81c7d8){_0x48b53f[_0x98ec('0x27')](0x194);}return _0x81c7d8;};}function handleError(_0x422a05,_0x37cb1e){_0x37cb1e=_0x37cb1e||0x1f4;return function(_0x132748){logger[_0x98ec('0x28')](_0x132748[_0x98ec('0x29')]);if(_0x132748[_0x98ec('0x2a')]){delete _0x132748['name'];}_0x422a05[_0x98ec('0x19')](_0x37cb1e)[_0x98ec('0x2b')](_0x132748);};}exports[_0x98ec('0x2c')]=function(_0x271a1c,_0x2640ac){var _0x22ca13={},_0x4ddb56={},_0x1f37c1={'count':0x0,'rows':[]};var _0x20b50e=_[_0x98ec('0x2d')](db[_0x98ec('0x2e')][_0x98ec('0x2f')],function(_0xc5beab){return{'name':_0xc5beab[_0x98ec('0x30')],'type':_0xc5beab['type'][_0x98ec('0x31')]};});_0x4ddb56['model']=_['map'](_0x20b50e,_0x98ec('0x2a'));_0x4ddb56['query']=_['keys'](_0x271a1c[_0x98ec('0x32')]);_0x4ddb56[_0x98ec('0x33')]=_['intersection'](_0x4ddb56[_0x98ec('0x34')],_0x4ddb56[_0x98ec('0x32')]);_0x22ca13['attributes']=_[_0x98ec('0x35')](_0x4ddb56[_0x98ec('0x34')],qs[_0x98ec('0x36')](_0x271a1c[_0x98ec('0x32')]['fields']));_0x22ca13['attributes']=_0x22ca13[_0x98ec('0x37')][_0x98ec('0x38')]?_0x22ca13['attributes']:_0x4ddb56[_0x98ec('0x34')];if(!_0x271a1c[_0x98ec('0x32')][_0x98ec('0x39')](_0x98ec('0x3a'))){_0x22ca13['limit']=qs[_0x98ec('0x1e')](_0x271a1c[_0x98ec('0x32')][_0x98ec('0x1e')]);_0x22ca13[_0x98ec('0x1c')]=qs[_0x98ec('0x1c')](_0x271a1c[_0x98ec('0x32')][_0x98ec('0x1c')]);}_0x22ca13[_0x98ec('0x3b')]=qs[_0x98ec('0x3c')](_0x271a1c[_0x98ec('0x32')][_0x98ec('0x3c')]);_0x22ca13[_0x98ec('0x3d')]=qs[_0x98ec('0x33')](_[_0x98ec('0x3e')](_0x271a1c[_0x98ec('0x32')],_0x4ddb56[_0x98ec('0x33')]),_0x20b50e);if(_0x271a1c[_0x98ec('0x32')][_0x98ec('0x3f')]){_0x22ca13[_0x98ec('0x3d')]=_['merge'](_0x22ca13[_0x98ec('0x3d')],{'$or':_[_0x98ec('0x2d')](_0x20b50e,function(_0x82a25c){if(_0x82a25c[_0x98ec('0x40')]!==_0x98ec('0x41')){var _0x3629c2={};_0x3629c2[_0x82a25c[_0x98ec('0x2a')]]={'$like':'%'+_0x271a1c['query']['filter']+'%'};return _0x3629c2;}})});}_0x22ca13=_[_0x98ec('0x42')]({},_0x22ca13,_0x271a1c[_0x98ec('0x43')]);var _0x4db245={'where':_0x22ca13['where']};return db['Migration']['count'](_0x4db245)[_0x98ec('0x26')](function(_0x20c249){_0x1f37c1['count']=_0x20c249;if(_0x271a1c[_0x98ec('0x32')][_0x98ec('0x44')]){_0x22ca13[_0x98ec('0x45')]=[{'all':!![]}];}return db[_0x98ec('0x2e')][_0x98ec('0x46')](_0x22ca13);})[_0x98ec('0x26')](function(_0x50e0ff){_0x1f37c1[_0x98ec('0x47')]=_0x50e0ff;return _0x1f37c1;})[_0x98ec('0x26')](respondWithFilteredResult(_0x2640ac,_0x22ca13))[_0x98ec('0x48')](handleError(_0x2640ac,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 71a5b96..b8c90d4 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 _0x182f=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./migration.attributes','Migration','migrations','lodash','util'];(function(_0xfae143,_0x1cb3f8){var _0x1432af=function(_0x1a1e78){while(--_0x1a1e78){_0xfae143['push'](_0xfae143['shift']());}};_0x1432af(++_0x1cb3f8);}(_0x182f,0x153));var _0xf182=function(_0x19e740,_0x542772){_0x19e740=_0x19e740-0x0;var _0x594375=_0x182f[_0x19e740];return _0x594375;};'use strict';var _=require(_0xf182('0x0'));var util=require(_0xf182('0x1'));var logger=require('../../config/logger')(_0xf182('0x2'));var moment=require(_0xf182('0x3'));var BPromise=require(_0xf182('0x4'));var rp=require(_0xf182('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf182('0x6'));var config=require(_0xf182('0x7'));var attributes=require(_0xf182('0x8'));module['exports']=function(_0x5f1936,_0x465d29){return _0x5f1936['define'](_0xf182('0x9'),attributes,{'tableName':_0xf182('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8c0f=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','define','Migration','migrations'];(function(_0x204b6d,_0x227d95){var _0x3003f5=function(_0x128eda){while(--_0x128eda){_0x204b6d['push'](_0x204b6d['shift']());}};_0x3003f5(++_0x227d95);}(_0x8c0f,0xdc));var _0xf8c0=function(_0x34f8b4,_0x53e364){_0x34f8b4=_0x34f8b4-0x0;var _0x2c41bb=_0x8c0f[_0x34f8b4];return _0x2c41bb;};'use strict';var _=require('lodash');var util=require(_0xf8c0('0x0'));var logger=require(_0xf8c0('0x1'))(_0xf8c0('0x2'));var moment=require(_0xf8c0('0x3'));var BPromise=require('bluebird');var rp=require(_0xf8c0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf8c0('0x5'));var config=require(_0xf8c0('0x6'));var attributes=require('./migration.attributes');module[_0xf8c0('0x7')]=function(_0x2806b4,_0x597220){return _0x2806b4[_0xf8c0('0x8')](_0xf8c0('0x9'),attributes,{'tableName':_0xf8c0('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 8df6e99..b3f9654 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 _0x63bb=['randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','info','Migration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x557d49,_0x23efc7){var _0x492f1e=function(_0x54b35a){while(--_0x54b35a){_0x557d49['push'](_0x557d49['shift']());}};_0x492f1e(++_0x23efc7);}(_0x63bb,0xf8));var _0xb63b=function(_0x1f9862,_0x1047d7){_0x1f9862=_0x1f9862-0x0;var _0x5c41b0=_0x63bb[_0x1f9862];return _0x5c41b0;};'use strict';var _=require(_0xb63b('0x0'));var util=require(_0xb63b('0x1'));var moment=require(_0xb63b('0x2'));var BPromise=require(_0xb63b('0x3'));var rs=require(_0xb63b('0x4'));var fs=require('fs');var Redis=require(_0xb63b('0x5'));var db=require(_0xb63b('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb63b('0x7'));var config=require(_0xb63b('0x8'));var jayson=require(_0xb63b('0x9'));var client=jayson[_0xb63b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3eb1be,_0x2a27f9,_0x2aa873){return new BPromise(function(_0x544988,_0x366bda){return client[_0xb63b('0xb')](_0x3eb1be,_0x2aa873)['then'](function(_0x2d5002){logger[_0xb63b('0xc')](_0xb63b('0xd'),_0x2a27f9,_0xb63b('0xe'));logger[_0xb63b('0xf')]('Migration,\x20%s,\x20%s,\x20%s',_0x2a27f9,_0xb63b('0xe'),JSON[_0xb63b('0x10')](_0x2d5002));if(_0x2d5002[_0xb63b('0x11')]){if(_0x2d5002['error']['code']===0x1f4){logger[_0xb63b('0x11')](_0xb63b('0xd'),_0x2a27f9,_0x2d5002[_0xb63b('0x11')][_0xb63b('0x12')]);return _0x366bda(_0x2d5002['error'][_0xb63b('0x12')]);}logger[_0xb63b('0x11')](_0xb63b('0xd'),_0x2a27f9,_0x2d5002[_0xb63b('0x11')][_0xb63b('0x12')]);return _0x544988(_0x2d5002[_0xb63b('0x11')][_0xb63b('0x12')]);}else{logger['info'](_0xb63b('0xd'),_0x2a27f9,'request\x20sent');_0x544988(_0x2d5002[_0xb63b('0x13')][_0xb63b('0x12')]);}})[_0xb63b('0x14')](function(_0x41bfc4){logger[_0xb63b('0x11')]('Migration,\x20%s,\x20%s',_0x2a27f9,_0x41bfc4);_0x366bda(_0x41bfc4);});});} \ No newline at end of file +var _0x44f8=['moment','bluebird','randomstring','ioredis','../../config/logger','client','http','request\x20sent','error','Migration,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x44f8,0x1de));var _0x844f=function(_0x1a97df,_0x3b39cf){_0x1a97df=_0x1a97df-0x0;var _0x26a053=_0x44f8[_0x1a97df];return _0x26a053;};'use strict';var _=require(_0x844f('0x0'));var util=require(_0x844f('0x1'));var moment=require(_0x844f('0x2'));var BPromise=require(_0x844f('0x3'));var rs=require(_0x844f('0x4'));var fs=require('fs');var Redis=require(_0x844f('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x844f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x844f('0x7')][_0x844f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x46eb2c,_0x38a334,_0x37b697){return new BPromise(function(_0x1987a9,_0x188f88){return client['request'](_0x46eb2c,_0x37b697)['then'](function(_0x39416d){logger['info']('Migration,\x20%s,\x20%s',_0x38a334,_0x844f('0x9'));logger['debug']('Migration,\x20%s,\x20%s,\x20%s',_0x38a334,'request\x20sent',JSON['stringify'](_0x39416d));if(_0x39416d[_0x844f('0xa')]){if(_0x39416d[_0x844f('0xa')]['code']===0x1f4){logger[_0x844f('0xa')](_0x844f('0xb'),_0x38a334,_0x39416d[_0x844f('0xa')]['message']);return _0x188f88(_0x39416d['error'][_0x844f('0xc')]);}logger['error'](_0x844f('0xb'),_0x38a334,_0x39416d[_0x844f('0xa')][_0x844f('0xc')]);return _0x1987a9(_0x39416d[_0x844f('0xa')][_0x844f('0xc')]);}else{logger['info']('Migration,\x20%s,\x20%s',_0x38a334,_0x844f('0x9'));_0x1987a9(_0x39416d[_0x844f('0xd')][_0x844f('0xc')]);}})[_0x844f('0xe')](function(_0x4f7ce4){logger[_0x844f('0xa')]('Migration,\x20%s,\x20%s',_0x38a334,_0x4f7ce4);_0x188f88(_0x4f7ce4);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index a8472d4..add06c6 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 _0xe0ad=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy'];(function(_0x4b1032,_0x36952e){var _0x5a1d55=function(_0x282e9b){while(--_0x282e9b){_0x4b1032['push'](_0x4b1032['shift']());}};_0x5a1d55(++_0x36952e);}(_0xe0ad,0x1a5));var _0xde0a=function(_0x4aac1c,_0x5f1095){_0x4aac1c=_0x4aac1c-0x0;var _0x1988d0=_0xe0ad[_0x4aac1c];return _0x1988d0;};'use strict';var multer=require(_0xde0a('0x0'));var util=require('util');var path=require(_0xde0a('0x1'));var timeout=require(_0xde0a('0x2'));var express=require(_0xde0a('0x3'));var router=express[_0xde0a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xde0a('0x5'));var interaction=require(_0xde0a('0x6'));var config=require(_0xde0a('0x7'));var controller=require(_0xde0a('0x8'));router[_0xde0a('0x9')]('/',auth[_0xde0a('0xa')](),controller[_0xde0a('0xb')]);router[_0xde0a('0x9')](_0xde0a('0xc'),auth[_0xde0a('0xa')](),controller[_0xde0a('0xd')]);router[_0xde0a('0xe')]('/',auth[_0xde0a('0xa')](),controller[_0xde0a('0xf')]);router[_0xde0a('0x10')](_0xde0a('0xc'),auth[_0xde0a('0xa')](),controller['update']);router[_0xde0a('0x11')](_0xde0a('0xc'),auth['isAuthenticated'](),controller[_0xde0a('0x12')]);module[_0xde0a('0x13')]=router; \ No newline at end of file +var _0x0b78=['show','post','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','./network.controller','get','isAuthenticated','index','/:id'];(function(_0xad78ed,_0x94b25){var _0x34e0b5=function(_0x4f9c13){while(--_0x4f9c13){_0xad78ed['push'](_0xad78ed['shift']());}};_0x34e0b5(++_0x94b25);}(_0x0b78,0x1d6));var _0x80b7=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x0b78[_0x57b54c];return _0x59cc19;};'use strict';var multer=require('multer');var util=require(_0x80b7('0x0'));var path=require(_0x80b7('0x1'));var timeout=require(_0x80b7('0x2'));var express=require('express');var router=express[_0x80b7('0x3')]();var fs_extra=require(_0x80b7('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x80b7('0x5'));router[_0x80b7('0x6')]('/',auth[_0x80b7('0x7')](),controller[_0x80b7('0x8')]);router[_0x80b7('0x6')](_0x80b7('0x9'),auth['isAuthenticated'](),controller[_0x80b7('0xa')]);router[_0x80b7('0xb')]('/',auth[_0x80b7('0x7')](),controller['create']);router['put'](_0x80b7('0x9'),auth['isAuthenticated'](),controller[_0x80b7('0xc')]);router[_0x80b7('0xd')]('/:id',auth[_0x80b7('0x7')](),controller[_0x80b7('0xe')]);module[_0x80b7('0xf')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index fe26b2c..f9066ca 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 _0x9acb=['ENUM','externip','turn','STRING','sequelize','exports'];(function(_0x125e2e,_0x29faa3){var _0x302688=function(_0x1d1fff){while(--_0x1d1fff){_0x125e2e['push'](_0x125e2e['shift']());}};_0x302688(++_0x29faa3);}(_0x9acb,0xac));var _0xb9ac=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x9acb[_0x110c3d];return _0x226d67;};'use strict';var Sequelize=require(_0xb9ac('0x0'));module[_0xb9ac('0x1')]={'type':{'type':Sequelize[_0xb9ac('0x2')]('localnet',_0xb9ac('0x3'),'stun',_0xb9ac('0x4'))},'value':{'type':Sequelize[_0xb9ac('0x5')]},'username':{'type':Sequelize[_0xb9ac('0x5')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd657=['externip','turn','STRING','ENUM','localnet'];(function(_0x37d72d,_0x27d166){var _0x830cdd=function(_0x1d694a){while(--_0x1d694a){_0x37d72d['push'](_0x37d72d['shift']());}};_0x830cdd(++_0x27d166);}(_0xd657,0x111));var _0x7d65=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd657[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x7d65('0x0')](_0x7d65('0x1'),_0x7d65('0x2'),'stun',_0x7d65('0x3'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x7d65('0x4')]},'password':{'type':Sequelize[_0x7d65('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 69fb113..980c7f4 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 _0xf346=['message','result','catch','status','json','offset','undefined','limit','count','Content-Range','update','destroy','sendStatus','stack','name','send','index','map','Network','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','rows','params','create','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','server/files/templates/turn_multiple.ejs','writeFileSync','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','findAll','TURN','toLowerCase','find','path','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','http','request','then','info','Network,\x20%s,\x20%s','Network,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x24a571,_0x3319d0){var _0x5b991c=function(_0x231534){while(--_0x231534){_0x24a571['push'](_0x24a571['shift']());}};_0x5b991c(++_0x3319d0);}(_0xf346,0x99));var _0x6f34=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xf346[_0x82129b];return _0x2ae5dc;};'use strict';var util=require('util');var path=require(_0x6f34('0x0'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6f34('0x1'));var qs=require(_0x6f34('0x2'));var logger=require(_0x6f34('0x3'))(_0x6f34('0x4'));var config=require(_0x6f34('0x5'));var db=require(_0x6f34('0x6'))['db'];var jayson=require(_0x6f34('0x7'));var client=jayson['client'][_0x6f34('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1a0d94,_0x12275f,_0x3a04c7,_0x7802d0){return new Promise(function(_0x2f649b,_0x41c37b){var _0x12a169=_0x7802d0||client;return _0x12a169[_0x6f34('0x9')](_0x1a0d94,_0x3a04c7)[_0x6f34('0xa')](function(_0x5ee92b){logger[_0x6f34('0xb')](_0x6f34('0xc'),_0x12275f,'request\x20sent');logger['debug'](_0x6f34('0xd'),_0x12275f,_0x6f34('0xe'),JSON['stringify'](_0x5ee92b));if(_0x5ee92b['error']){if(_0x5ee92b[_0x6f34('0xf')][_0x6f34('0x10')]===0x1f4){logger[_0x6f34('0xf')](_0x6f34('0xc'),_0x12275f,_0x5ee92b[_0x6f34('0xf')][_0x6f34('0x11')]);return _0x41c37b(_0x5ee92b[_0x6f34('0xf')][_0x6f34('0x11')]);}logger[_0x6f34('0xf')](_0x6f34('0xc'),_0x12275f,_0x5ee92b[_0x6f34('0xf')][_0x6f34('0x11')]);return _0x2f649b(_0x5ee92b['error'][_0x6f34('0x11')]);}else{logger[_0x6f34('0xb')](_0x6f34('0xc'),_0x12275f,_0x6f34('0xe'));_0x2f649b(_0x5ee92b[_0x6f34('0x12')]['message']);}})[_0x6f34('0x13')](function(_0x5f5a09){logger[_0x6f34('0xf')]('Network,\x20%s,\x20%s',_0x12275f,_0x5f5a09);_0x41c37b(_0x5f5a09);});});}function respondWithResult(_0x48501a,_0x34a216){_0x34a216=_0x34a216||0xc8;return function(_0x5ccec5){if(_0x5ccec5){return _0x48501a[_0x6f34('0x14')](_0x34a216)[_0x6f34('0x15')](_0x5ccec5);}};}function respondWithFilteredResult(_0x41a9a1,_0x40892a){return function(_0x3bb62d){if(_0x3bb62d){var _0x27fbc7=typeof _0x40892a[_0x6f34('0x16')]===_0x6f34('0x17')&&typeof _0x40892a[_0x6f34('0x18')]===_0x6f34('0x17');var _0x46e6af=_0x3bb62d[_0x6f34('0x19')];var _0x5a5810=_0x27fbc7?0x0:_0x40892a[_0x6f34('0x16')];var _0x9b32f6=_0x27fbc7?_0x3bb62d[_0x6f34('0x19')]:_0x40892a[_0x6f34('0x16')]+_0x40892a[_0x6f34('0x18')];var _0x46250a;if(_0x9b32f6>=_0x46e6af){_0x9b32f6=_0x46e6af;_0x46250a=0xc8;}else{_0x46250a=0xce;}_0x41a9a1[_0x6f34('0x14')](_0x46250a);return _0x41a9a1['set'](_0x6f34('0x1a'),_0x5a5810+'-'+_0x9b32f6+'/'+_0x46e6af)[_0x6f34('0x15')](_0x3bb62d);}return null;};}function saveUpdates(_0xcd3304){return function(_0x7d1e6e){if(_0x7d1e6e){return _0x7d1e6e[_0x6f34('0x1b')](_0xcd3304)[_0x6f34('0xa')](function(_0x47d81d){return _0x47d81d;});}return null;};}function removeEntity(_0x1d40e6){return function(_0x447d6c){if(_0x447d6c){return _0x447d6c[_0x6f34('0x1c')]()['then'](function(){_0x1d40e6[_0x6f34('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56ad1c){return function(_0x32e101){if(!_0x32e101){_0x56ad1c[_0x6f34('0x1d')](0x194);}return _0x32e101;};}function handleError(_0x8b095b,_0x47d59a){_0x47d59a=_0x47d59a||0x1f4;return function(_0x258345){logger[_0x6f34('0xf')](_0x258345[_0x6f34('0x1e')]);if(_0x258345[_0x6f34('0x1f')]){delete _0x258345[_0x6f34('0x1f')];}_0x8b095b['status'](_0x47d59a)[_0x6f34('0x20')](_0x258345);};}exports[_0x6f34('0x21')]=function(_0x2b1d48,_0x862018){var _0x1c7083={},_0x42769a={},_0x5a9b87={'count':0x0,'rows':[]};var _0x4154b5=_[_0x6f34('0x22')](db[_0x6f34('0x23')][_0x6f34('0x24')],function(_0x13c349){return{'name':_0x13c349[_0x6f34('0x25')],'type':_0x13c349[_0x6f34('0x26')][_0x6f34('0x27')]};});_0x42769a[_0x6f34('0x28')]=_['map'](_0x4154b5,_0x6f34('0x1f'));_0x42769a[_0x6f34('0x29')]=_[_0x6f34('0x2a')](_0x2b1d48[_0x6f34('0x29')]);_0x42769a[_0x6f34('0x2b')]=_[_0x6f34('0x2c')](_0x42769a[_0x6f34('0x28')],_0x42769a[_0x6f34('0x29')]);_0x1c7083[_0x6f34('0x2d')]=_[_0x6f34('0x2c')](_0x42769a[_0x6f34('0x28')],qs[_0x6f34('0x2e')](_0x2b1d48[_0x6f34('0x29')][_0x6f34('0x2e')]));_0x1c7083[_0x6f34('0x2d')]=_0x1c7083[_0x6f34('0x2d')][_0x6f34('0x2f')]?_0x1c7083['attributes']:_0x42769a[_0x6f34('0x28')];if(!_0x2b1d48[_0x6f34('0x29')][_0x6f34('0x30')](_0x6f34('0x31'))){_0x1c7083[_0x6f34('0x18')]=qs['limit'](_0x2b1d48[_0x6f34('0x29')][_0x6f34('0x18')]);_0x1c7083[_0x6f34('0x16')]=qs['offset'](_0x2b1d48[_0x6f34('0x29')][_0x6f34('0x16')]);}_0x1c7083[_0x6f34('0x32')]=qs[_0x6f34('0x33')](_0x2b1d48['query']['sort']);_0x1c7083['where']=qs[_0x6f34('0x2b')](_[_0x6f34('0x34')](_0x2b1d48['query'],_0x42769a[_0x6f34('0x2b')]),_0x4154b5);if(_0x2b1d48[_0x6f34('0x29')][_0x6f34('0x35')]){_0x1c7083[_0x6f34('0x36')]=_[_0x6f34('0x37')](_0x1c7083[_0x6f34('0x36')],{'$or':_[_0x6f34('0x22')](_0x4154b5,function(_0x30c527){if(_0x30c527['type']!=='VIRTUAL'){var _0x40f470={};_0x40f470[_0x30c527[_0x6f34('0x1f')]]={'$like':'%'+_0x2b1d48['query'][_0x6f34('0x35')]+'%'};return _0x40f470;}})});}_0x1c7083=_[_0x6f34('0x37')]({},_0x1c7083,_0x2b1d48[_0x6f34('0x38')]);var _0x1bb09b={'where':_0x1c7083['where']};return db[_0x6f34('0x23')][_0x6f34('0x19')](_0x1bb09b)[_0x6f34('0xa')](function(_0x2293eb){_0x5a9b87[_0x6f34('0x19')]=_0x2293eb;if(_0x2b1d48['query'][_0x6f34('0x39')]){_0x1c7083[_0x6f34('0x3a')]=[{'all':!![]}];}return db['Network']['findAll'](_0x1c7083);})['then'](function(_0x3aed76){_0x5a9b87[_0x6f34('0x3b')]=_0x3aed76;return _0x5a9b87;})['then'](respondWithFilteredResult(_0x862018,_0x1c7083))[_0x6f34('0x13')](handleError(_0x862018,null));};exports['show']=function(_0x373605,_0xbd1c1f){var _0x510cbf={'raw':!![],'where':{'id':_0x373605[_0x6f34('0x3c')]['id']}},_0x2a00f9={};_0x2a00f9[_0x6f34('0x28')]=_[_0x6f34('0x2a')](db[_0x6f34('0x23')][_0x6f34('0x24')]);_0x2a00f9['query']=_[_0x6f34('0x2a')](_0x373605[_0x6f34('0x29')]);_0x2a00f9[_0x6f34('0x2b')]=_['intersection'](_0x2a00f9[_0x6f34('0x28')],_0x2a00f9[_0x6f34('0x29')]);_0x510cbf[_0x6f34('0x2d')]=_[_0x6f34('0x2c')](_0x2a00f9[_0x6f34('0x28')],qs[_0x6f34('0x2e')](_0x373605[_0x6f34('0x29')][_0x6f34('0x2e')]));_0x510cbf[_0x6f34('0x2d')]=_0x510cbf[_0x6f34('0x2d')][_0x6f34('0x2f')]?_0x510cbf[_0x6f34('0x2d')]:_0x2a00f9[_0x6f34('0x28')];if(_0x373605[_0x6f34('0x29')][_0x6f34('0x39')]){_0x510cbf['include']=[{'all':!![]}];}_0x510cbf=_['merge']({},_0x510cbf,_0x373605['options']);return db['Network']['find'](_0x510cbf)[_0x6f34('0xa')](handleEntityNotFound(_0xbd1c1f,null))['then'](respondWithResult(_0xbd1c1f,null))[_0x6f34('0x13')](handleError(_0xbd1c1f,null));};exports[_0x6f34('0x3d')]=function(_0x521425,_0x250daf){var _0x1636d0;return db['Network'][_0x6f34('0x3d')](_0x521425[_0x6f34('0x3e')],{'raw':!![]})[_0x6f34('0xa')](function(_0x373126){_0x1636d0=_0x373126;return db[_0x6f34('0x23')]['findAll']({'where':{'type':_0x521425[_0x6f34('0x3e')]['type']},'raw':!![]});})[_0x6f34('0xa')](function(_0xca81ba){if(_0x1636d0[_0x6f34('0x26')][_0x6f34('0x3f')]()==_0x6f34('0x40')){var _0x4a3b4c=fs[_0x6f34('0x41')](path[_0x6f34('0x42')](config[_0x6f34('0x43')],_0x6f34('0x44')),_0x6f34('0x45'));var _0x387d01=ejs[_0x6f34('0x46')](_0x4a3b4c,{'networks':_0xca81ba||[]});fs['writeFileSync'](_0x6f34('0x47'),_0x387d01);return respondWithRpcPromise(_0x6f34('0x48'),_0x6f34('0x3d'),{'module':_0x6f34('0x49')});}else if(_0x1636d0[_0x6f34('0x26')][_0x6f34('0x3f')]()=='TURN'){var _0x3c59d2=fs[_0x6f34('0x41')](path[_0x6f34('0x42')](config[_0x6f34('0x43')],_0x6f34('0x4a')),_0x6f34('0x45'));var _0x5df6ba=ejs[_0x6f34('0x46')](_0x3c59d2,{'networks':_0xca81ba||[]});fs[_0x6f34('0x4b')](_0x6f34('0x4c'),_0x5df6ba);return respondWithRpcPromise('Reload',_0x6f34('0x3d'),{'module':_0x6f34('0x49')});}else{var _0x2dae99=fs[_0x6f34('0x41')](path[_0x6f34('0x42')](config[_0x6f34('0x43')],_0x6f34('0x4d')),_0x6f34('0x45'));var _0x5d3ce3=ejs[_0x6f34('0x46')](_0x2dae99,{'networks':_0xca81ba||[]});fs['writeFileSync'](util[_0x6f34('0x4e')](_0x6f34('0x4f'),_0x521425[_0x6f34('0x3e')][_0x6f34('0x26')]['toLowerCase']()),_0x5d3ce3);return respondWithRpcPromise(_0x6f34('0x48'),_0x6f34('0x3d'),{'module':_0x6f34('0x50')});}})[_0x6f34('0xa')](function(){return _0x1636d0;})[_0x6f34('0xa')](respondWithResult(_0x250daf,0xc9))['catch'](handleError(_0x250daf,null));};exports[_0x6f34('0x1b')]=function(_0x32d991,_0x334a07){var _0x43a85f;return db[_0x6f34('0x23')]['find']({'where':{'id':_0x32d991[_0x6f34('0x3c')]['id']}})['then'](handleEntityNotFound(_0x334a07,null))['then'](saveUpdates(_0x32d991[_0x6f34('0x3e')],null))[_0x6f34('0xa')](function(_0x209008){if(_0x209008){_0x43a85f=_0x209008;return db[_0x6f34('0x23')][_0x6f34('0x51')]({'where':{'type':_0x43a85f[_0x6f34('0x26')]},'raw':!![]});}return null;})['then'](function(_0x18748d){if(_0x43a85f[_0x6f34('0x26')]['toUpperCase']()==_0x6f34('0x40')){var _0x165fe2=fs[_0x6f34('0x41')](path[_0x6f34('0x42')](config[_0x6f34('0x43')],_0x6f34('0x44')),_0x6f34('0x45'));var _0x3da5f5=ejs['render'](_0x165fe2,{'networks':_0x18748d||[]});fs[_0x6f34('0x4b')](_0x6f34('0x47'),_0x3da5f5);return respondWithRpcPromise(_0x6f34('0x48'),_0x6f34('0x1b'),{'module':_0x6f34('0x49')});}else if(_0x43a85f[_0x6f34('0x26')][_0x6f34('0x3f')]()==_0x6f34('0x52')){var _0x1d1916=fs['readFileSync'](path[_0x6f34('0x42')](config[_0x6f34('0x43')],_0x6f34('0x4a')),_0x6f34('0x45'));var _0x424a03=ejs['render'](_0x1d1916,{'networks':_0x18748d||[]});fs[_0x6f34('0x4b')](_0x6f34('0x4c'),_0x424a03);return respondWithRpcPromise(_0x6f34('0x48'),'update',{'module':_0x6f34('0x49')});}else{var _0x4a5d39=fs[_0x6f34('0x41')](path[_0x6f34('0x42')](config[_0x6f34('0x43')],_0x6f34('0x4d')),'utf8');var _0x42d366=ejs[_0x6f34('0x46')](_0x4a5d39,{'networks':_0x18748d||[]});fs[_0x6f34('0x4b')](util[_0x6f34('0x4e')](_0x6f34('0x4f'),_0x32d991[_0x6f34('0x3e')][_0x6f34('0x26')][_0x6f34('0x53')]()),_0x42d366);return respondWithRpcPromise('Reload','update',{'module':'chan_sip.so'});}})[_0x6f34('0xa')](function(_0x402f60){if(_0x402f60){return _0x43a85f;}return null;})[_0x6f34('0xa')](respondWithResult(_0x334a07,null))['catch'](handleError(_0x334a07,null));};exports['destroy']=function(_0x21a5f2,_0x5bb6e3){var _0x1114f9;return db[_0x6f34('0x23')][_0x6f34('0x54')]({'where':{'id':_0x21a5f2[_0x6f34('0x3c')]['id']}})['then'](function(_0x4b670c){_0x1114f9=_0x4b670c;return _0x4b670c;})[_0x6f34('0xa')](handleEntityNotFound(_0x5bb6e3,null))['then'](removeEntity(_0x5bb6e3,null))[_0x6f34('0xa')](function(){if(_0x1114f9){return db[_0x6f34('0x23')][_0x6f34('0x51')]({'where':{'type':_0x1114f9[_0x6f34('0x26')]},'raw':!![]});}})[_0x6f34('0xa')](function(_0x40741b){if(_0x1114f9[_0x6f34('0x26')][_0x6f34('0x3f')]()==_0x6f34('0x40')){var _0xe3698f=fs['readFileSync'](path['join'](config['root'],_0x6f34('0x44')),_0x6f34('0x45'));var _0x2a0338=ejs[_0x6f34('0x46')](_0xe3698f,{'networks':_0x40741b||[]});fs['writeFileSync'](_0x6f34('0x47'),_0x2a0338);return respondWithRpcPromise('Reload',_0x6f34('0x1c'),{'module':'res_stun_monitor.so'});}else if(_0x1114f9[_0x6f34('0x26')]['toUpperCase']()=='TURN'){var _0x55dd44=fs[_0x6f34('0x41')](path['join'](config[_0x6f34('0x43')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x12a72f=ejs['render'](_0x55dd44,{'networks':_0x40741b||[]});fs[_0x6f34('0x4b')](_0x6f34('0x4c'),_0x12a72f);return respondWithRpcPromise(_0x6f34('0x48'),_0x6f34('0x1c'),{'module':_0x6f34('0x49')});}else{var _0x2f51a8=fs[_0x6f34('0x41')](path[_0x6f34('0x42')](config['root'],'server/files/templates/network.ejs'),_0x6f34('0x45'));var _0x192382=ejs[_0x6f34('0x46')](_0x2f51a8,{'networks':_0x40741b||[]});fs[_0x6f34('0x4b')](util[_0x6f34('0x4e')](_0x6f34('0x4f'),_0x1114f9[_0x6f34('0x26')][_0x6f34('0x53')]()),_0x192382);return respondWithRpcPromise(_0x6f34('0x48'),'destroy',{'module':'chan_sip.so'});}})[_0x6f34('0x13')](handleError(_0x5bb6e3,null));}; \ No newline at end of file +var _0x6d4f=['destroy','end','sendStatus','stack','name','index','map','Network','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','params','keys','rawAttributes','find','create','body','type','STUN','root','utf8','render','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','toUpperCase','TURN','readFileSync','join','server/files/templates/turn_multiple.ejs','writeFileSync','format','chan_sip.so','server/files/templates/stun_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','path','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','jayson/promise','client','http','request','info','Network,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','json','undefined','limit','count','offset','set','Content-Range','update','then'];(function(_0xc831c6,_0x542b00){var _0x5063a7=function(_0x4600ee){while(--_0x4600ee){_0xc831c6['push'](_0xc831c6['shift']());}};_0x5063a7(++_0x542b00);}(_0x6d4f,0x90));var _0xf6d4=function(_0x190ff6,_0x515cfd){_0x190ff6=_0x190ff6-0x0;var _0x5356d2=_0x6d4f[_0x190ff6];return _0x5356d2;};'use strict';var util=require('util');var path=require(_0xf6d4('0x0'));var ejs=require(_0xf6d4('0x1'));var fs=require('fs');var _=require(_0xf6d4('0x2'));var qs=require(_0xf6d4('0x3'));var logger=require(_0xf6d4('0x4'))(_0xf6d4('0x5'));var config=require('../../config/environment');var db=require(_0xf6d4('0x6'))['db'];var jayson=require(_0xf6d4('0x7'));var client=jayson[_0xf6d4('0x8')][_0xf6d4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3a97df,_0x57b399,_0x19ae4f,_0x3925d5){return new Promise(function(_0x2dae14,_0x46de76){var _0x62ed38=_0x3925d5||client;return _0x62ed38[_0xf6d4('0xa')](_0x3a97df,_0x19ae4f)['then'](function(_0x147279){logger[_0xf6d4('0xb')](_0xf6d4('0xc'),_0x57b399,_0xf6d4('0xd'));logger['debug']('Network,\x20%s,\x20%s,\x20%s',_0x57b399,_0xf6d4('0xd'),JSON[_0xf6d4('0xe')](_0x147279));if(_0x147279[_0xf6d4('0xf')]){if(_0x147279[_0xf6d4('0xf')][_0xf6d4('0x10')]===0x1f4){logger['error'](_0xf6d4('0xc'),_0x57b399,_0x147279[_0xf6d4('0xf')][_0xf6d4('0x11')]);return _0x46de76(_0x147279[_0xf6d4('0xf')][_0xf6d4('0x11')]);}logger[_0xf6d4('0xf')]('Network,\x20%s,\x20%s',_0x57b399,_0x147279['error'][_0xf6d4('0x11')]);return _0x2dae14(_0x147279[_0xf6d4('0xf')][_0xf6d4('0x11')]);}else{logger['info']('Network,\x20%s,\x20%s',_0x57b399,_0xf6d4('0xd'));_0x2dae14(_0x147279[_0xf6d4('0x12')][_0xf6d4('0x11')]);}})[_0xf6d4('0x13')](function(_0x48644d){logger['error'](_0xf6d4('0xc'),_0x57b399,_0x48644d);_0x46de76(_0x48644d);});});}function respondWithResult(_0x53c8e0,_0x252889){_0x252889=_0x252889||0xc8;return function(_0x4d02a5){if(_0x4d02a5){return _0x53c8e0[_0xf6d4('0x14')](_0x252889)[_0xf6d4('0x15')](_0x4d02a5);}};}function respondWithFilteredResult(_0x1360d9,_0x4eea51){return function(_0x4bfda5){if(_0x4bfda5){var _0x31c83f=typeof _0x4eea51['offset']===_0xf6d4('0x16')&&typeof _0x4eea51[_0xf6d4('0x17')]==='undefined';var _0x4dff5a=_0x4bfda5[_0xf6d4('0x18')];var _0x5c9b33=_0x31c83f?0x0:_0x4eea51[_0xf6d4('0x19')];var _0x28a991=_0x31c83f?_0x4bfda5['count']:_0x4eea51[_0xf6d4('0x19')]+_0x4eea51['limit'];var _0x22401c;if(_0x28a991>=_0x4dff5a){_0x28a991=_0x4dff5a;_0x22401c=0xc8;}else{_0x22401c=0xce;}_0x1360d9['status'](_0x22401c);return _0x1360d9[_0xf6d4('0x1a')](_0xf6d4('0x1b'),_0x5c9b33+'-'+_0x28a991+'/'+_0x4dff5a)[_0xf6d4('0x15')](_0x4bfda5);}return null;};}function saveUpdates(_0x2ee3da){return function(_0x1b2c06){if(_0x1b2c06){return _0x1b2c06[_0xf6d4('0x1c')](_0x2ee3da)[_0xf6d4('0x1d')](function(_0x2ac380){return _0x2ac380;});}return null;};}function removeEntity(_0x5866c2){return function(_0x5567eb){if(_0x5567eb){return _0x5567eb[_0xf6d4('0x1e')]()['then'](function(){_0x5866c2[_0xf6d4('0x14')](0xcc)[_0xf6d4('0x1f')]();});}};}function handleEntityNotFound(_0x11285a){return function(_0x1f4c8d){if(!_0x1f4c8d){_0x11285a[_0xf6d4('0x20')](0x194);}return _0x1f4c8d;};}function handleError(_0x28db3f,_0x5a4463){_0x5a4463=_0x5a4463||0x1f4;return function(_0x1bef92){logger[_0xf6d4('0xf')](_0x1bef92[_0xf6d4('0x21')]);if(_0x1bef92['name']){delete _0x1bef92[_0xf6d4('0x22')];}_0x28db3f[_0xf6d4('0x14')](_0x5a4463)['send'](_0x1bef92);};}exports[_0xf6d4('0x23')]=function(_0x92dc0,_0x9c33df){var _0x4cc53f={},_0x5968f8={},_0x568cdb={'count':0x0,'rows':[]};var _0x1c9297=_[_0xf6d4('0x24')](db[_0xf6d4('0x25')]['rawAttributes'],function(_0x423232){return{'name':_0x423232[_0xf6d4('0x26')],'type':_0x423232['type'][_0xf6d4('0x27')]};});_0x5968f8[_0xf6d4('0x28')]=_[_0xf6d4('0x24')](_0x1c9297,_0xf6d4('0x22'));_0x5968f8[_0xf6d4('0x29')]=_['keys'](_0x92dc0[_0xf6d4('0x29')]);_0x5968f8[_0xf6d4('0x2a')]=_[_0xf6d4('0x2b')](_0x5968f8[_0xf6d4('0x28')],_0x5968f8['query']);_0x4cc53f[_0xf6d4('0x2c')]=_['intersection'](_0x5968f8[_0xf6d4('0x28')],qs['fields'](_0x92dc0[_0xf6d4('0x29')][_0xf6d4('0x2d')]));_0x4cc53f[_0xf6d4('0x2c')]=_0x4cc53f[_0xf6d4('0x2c')][_0xf6d4('0x2e')]?_0x4cc53f['attributes']:_0x5968f8[_0xf6d4('0x28')];if(!_0x92dc0[_0xf6d4('0x29')][_0xf6d4('0x2f')](_0xf6d4('0x30'))){_0x4cc53f[_0xf6d4('0x17')]=qs[_0xf6d4('0x17')](_0x92dc0[_0xf6d4('0x29')][_0xf6d4('0x17')]);_0x4cc53f[_0xf6d4('0x19')]=qs[_0xf6d4('0x19')](_0x92dc0[_0xf6d4('0x29')][_0xf6d4('0x19')]);}_0x4cc53f[_0xf6d4('0x31')]=qs[_0xf6d4('0x32')](_0x92dc0[_0xf6d4('0x29')][_0xf6d4('0x32')]);_0x4cc53f[_0xf6d4('0x33')]=qs['filters'](_[_0xf6d4('0x34')](_0x92dc0[_0xf6d4('0x29')],_0x5968f8[_0xf6d4('0x2a')]),_0x1c9297);if(_0x92dc0[_0xf6d4('0x29')][_0xf6d4('0x35')]){_0x4cc53f[_0xf6d4('0x33')]=_[_0xf6d4('0x36')](_0x4cc53f[_0xf6d4('0x33')],{'$or':_['map'](_0x1c9297,function(_0x4e6a6e){if(_0x4e6a6e['type']!=='VIRTUAL'){var _0x2dee7f={};_0x2dee7f[_0x4e6a6e[_0xf6d4('0x22')]]={'$like':'%'+_0x92dc0[_0xf6d4('0x29')]['filter']+'%'};return _0x2dee7f;}})});}_0x4cc53f=_[_0xf6d4('0x36')]({},_0x4cc53f,_0x92dc0[_0xf6d4('0x37')]);var _0x250fa0={'where':_0x4cc53f[_0xf6d4('0x33')]};return db[_0xf6d4('0x25')][_0xf6d4('0x18')](_0x250fa0)['then'](function(_0x2384fe){_0x568cdb['count']=_0x2384fe;if(_0x92dc0[_0xf6d4('0x29')][_0xf6d4('0x38')]){_0x4cc53f[_0xf6d4('0x39')]=[{'all':!![]}];}return db[_0xf6d4('0x25')][_0xf6d4('0x3a')](_0x4cc53f);})['then'](function(_0x1a5a9a){_0x568cdb[_0xf6d4('0x3b')]=_0x1a5a9a;return _0x568cdb;})[_0xf6d4('0x1d')](respondWithFilteredResult(_0x9c33df,_0x4cc53f))[_0xf6d4('0x13')](handleError(_0x9c33df,null));};exports['show']=function(_0x1cd10d,_0x17e1b2){var _0x56c050={'raw':!![],'where':{'id':_0x1cd10d[_0xf6d4('0x3c')]['id']}},_0x2aafa0={};_0x2aafa0[_0xf6d4('0x28')]=_[_0xf6d4('0x3d')](db[_0xf6d4('0x25')][_0xf6d4('0x3e')]);_0x2aafa0['query']=_['keys'](_0x1cd10d[_0xf6d4('0x29')]);_0x2aafa0['filters']=_[_0xf6d4('0x2b')](_0x2aafa0[_0xf6d4('0x28')],_0x2aafa0[_0xf6d4('0x29')]);_0x56c050['attributes']=_['intersection'](_0x2aafa0['model'],qs['fields'](_0x1cd10d[_0xf6d4('0x29')]['fields']));_0x56c050[_0xf6d4('0x2c')]=_0x56c050[_0xf6d4('0x2c')][_0xf6d4('0x2e')]?_0x56c050['attributes']:_0x2aafa0[_0xf6d4('0x28')];if(_0x1cd10d[_0xf6d4('0x29')]['includeAll']){_0x56c050[_0xf6d4('0x39')]=[{'all':!![]}];}_0x56c050=_['merge']({},_0x56c050,_0x1cd10d['options']);return db['Network'][_0xf6d4('0x3f')](_0x56c050)[_0xf6d4('0x1d')](handleEntityNotFound(_0x17e1b2,null))[_0xf6d4('0x1d')](respondWithResult(_0x17e1b2,null))[_0xf6d4('0x13')](handleError(_0x17e1b2,null));};exports[_0xf6d4('0x40')]=function(_0x568c7b,_0x2bf7ff){var _0x6baf89;return db[_0xf6d4('0x25')][_0xf6d4('0x40')](_0x568c7b[_0xf6d4('0x41')],{'raw':!![]})[_0xf6d4('0x1d')](function(_0x24b702){_0x6baf89=_0x24b702;return db[_0xf6d4('0x25')][_0xf6d4('0x3a')]({'where':{'type':_0x568c7b[_0xf6d4('0x41')]['type']},'raw':!![]});})[_0xf6d4('0x1d')](function(_0x555a70){if(_0x6baf89[_0xf6d4('0x42')]['toUpperCase']()==_0xf6d4('0x43')){var _0x37d89d=fs['readFileSync'](path['join'](config[_0xf6d4('0x44')],'server/files/templates/stun_multiple.ejs'),_0xf6d4('0x45'));var _0x2e3fb1=ejs[_0xf6d4('0x46')](_0x37d89d,{'networks':_0x555a70||[]});fs['writeFileSync'](_0xf6d4('0x47'),_0x2e3fb1);return respondWithRpcPromise(_0xf6d4('0x48'),'create',{'module':_0xf6d4('0x49')});}else if(_0x6baf89[_0xf6d4('0x42')][_0xf6d4('0x4a')]()==_0xf6d4('0x4b')){var _0x55a70d=fs[_0xf6d4('0x4c')](path[_0xf6d4('0x4d')](config[_0xf6d4('0x44')],_0xf6d4('0x4e')),_0xf6d4('0x45'));var _0x1ec354=ejs[_0xf6d4('0x46')](_0x55a70d,{'networks':_0x555a70||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x1ec354);return respondWithRpcPromise('Reload','create',{'module':_0xf6d4('0x49')});}else{var _0x48d2f1=fs[_0xf6d4('0x4c')](path[_0xf6d4('0x4d')](config['root'],'server/files/templates/network.ejs'),'utf8');var _0x322625=ejs[_0xf6d4('0x46')](_0x48d2f1,{'networks':_0x555a70||[]});fs[_0xf6d4('0x4f')](util[_0xf6d4('0x50')]('/etc/asterisk/sip_xcally_%s.conf',_0x568c7b['body'][_0xf6d4('0x42')]['toLowerCase']()),_0x322625);return respondWithRpcPromise(_0xf6d4('0x48'),_0xf6d4('0x40'),{'module':_0xf6d4('0x51')});}})[_0xf6d4('0x1d')](function(){return _0x6baf89;})['then'](respondWithResult(_0x2bf7ff,0xc9))['catch'](handleError(_0x2bf7ff,null));};exports[_0xf6d4('0x1c')]=function(_0x4f4a66,_0x3b6b87){var _0x21442e;return db['Network'][_0xf6d4('0x3f')]({'where':{'id':_0x4f4a66[_0xf6d4('0x3c')]['id']}})[_0xf6d4('0x1d')](handleEntityNotFound(_0x3b6b87,null))[_0xf6d4('0x1d')](saveUpdates(_0x4f4a66[_0xf6d4('0x41')],null))['then'](function(_0x1b9414){if(_0x1b9414){_0x21442e=_0x1b9414;return db[_0xf6d4('0x25')]['findAll']({'where':{'type':_0x21442e['type']},'raw':!![]});}return null;})[_0xf6d4('0x1d')](function(_0x576120){if(_0x21442e['type'][_0xf6d4('0x4a')]()==_0xf6d4('0x43')){var _0x9d1435=fs['readFileSync'](path[_0xf6d4('0x4d')](config[_0xf6d4('0x44')],_0xf6d4('0x52')),_0xf6d4('0x45'));var _0x470981=ejs[_0xf6d4('0x46')](_0x9d1435,{'networks':_0x576120||[]});fs[_0xf6d4('0x4f')](_0xf6d4('0x47'),_0x470981);return respondWithRpcPromise(_0xf6d4('0x48'),_0xf6d4('0x1c'),{'module':'res_stun_monitor.so'});}else if(_0x21442e['type'][_0xf6d4('0x4a')]()==_0xf6d4('0x4b')){var _0x460f1f=fs[_0xf6d4('0x4c')](path[_0xf6d4('0x4d')](config[_0xf6d4('0x44')],'server/files/templates/turn_multiple.ejs'),_0xf6d4('0x45'));var _0x544489=ejs[_0xf6d4('0x46')](_0x460f1f,{'networks':_0x576120||[]});fs[_0xf6d4('0x4f')](_0xf6d4('0x53'),_0x544489);return respondWithRpcPromise('Reload',_0xf6d4('0x1c'),{'module':'res_stun_monitor.so'});}else{var _0x3b741b=fs[_0xf6d4('0x4c')](path[_0xf6d4('0x4d')](config['root'],_0xf6d4('0x54')),_0xf6d4('0x45'));var _0x10da05=ejs[_0xf6d4('0x46')](_0x3b741b,{'networks':_0x576120||[]});fs[_0xf6d4('0x4f')](util[_0xf6d4('0x50')](_0xf6d4('0x55'),_0x4f4a66[_0xf6d4('0x41')][_0xf6d4('0x42')][_0xf6d4('0x56')]()),_0x10da05);return respondWithRpcPromise(_0xf6d4('0x48'),_0xf6d4('0x1c'),{'module':_0xf6d4('0x51')});}})[_0xf6d4('0x1d')](function(_0x216486){if(_0x216486){return _0x21442e;}return null;})[_0xf6d4('0x1d')](respondWithResult(_0x3b6b87,null))['catch'](handleError(_0x3b6b87,null));};exports[_0xf6d4('0x1e')]=function(_0x5520a2,_0x6bff88){var _0x5cf9a0;return db[_0xf6d4('0x25')][_0xf6d4('0x3f')]({'where':{'id':_0x5520a2[_0xf6d4('0x3c')]['id']}})['then'](function(_0x22b1e3){_0x5cf9a0=_0x22b1e3;return _0x22b1e3;})['then'](handleEntityNotFound(_0x6bff88,null))['then'](removeEntity(_0x6bff88,null))['then'](function(){if(_0x5cf9a0){return db[_0xf6d4('0x25')][_0xf6d4('0x3a')]({'where':{'type':_0x5cf9a0['type']},'raw':!![]});}})['then'](function(_0x2fbabf){if(_0x5cf9a0[_0xf6d4('0x42')][_0xf6d4('0x4a')]()==_0xf6d4('0x43')){var _0x56d7bf=fs[_0xf6d4('0x4c')](path['join'](config['root'],_0xf6d4('0x52')),'utf8');var _0xd9d6e8=ejs[_0xf6d4('0x46')](_0x56d7bf,{'networks':_0x2fbabf||[]});fs[_0xf6d4('0x4f')](_0xf6d4('0x47'),_0xd9d6e8);return respondWithRpcPromise(_0xf6d4('0x48'),_0xf6d4('0x1e'),{'module':'res_stun_monitor.so'});}else if(_0x5cf9a0[_0xf6d4('0x42')][_0xf6d4('0x4a')]()==_0xf6d4('0x4b')){var _0x5a687d=fs['readFileSync'](path['join'](config[_0xf6d4('0x44')],_0xf6d4('0x4e')),_0xf6d4('0x45'));var _0x5255a2=ejs[_0xf6d4('0x46')](_0x5a687d,{'networks':_0x2fbabf||[]});fs[_0xf6d4('0x4f')](_0xf6d4('0x53'),_0x5255a2);return respondWithRpcPromise(_0xf6d4('0x48'),_0xf6d4('0x1e'),{'module':_0xf6d4('0x49')});}else{var _0x394c3e=fs[_0xf6d4('0x4c')](path[_0xf6d4('0x4d')](config[_0xf6d4('0x44')],_0xf6d4('0x54')),'utf8');var _0xc0f17b=ejs[_0xf6d4('0x46')](_0x394c3e,{'networks':_0x2fbabf||[]});fs['writeFileSync'](util[_0xf6d4('0x50')](_0xf6d4('0x55'),_0x5cf9a0[_0xf6d4('0x42')][_0xf6d4('0x56')]()),_0xc0f17b);return respondWithRpcPromise(_0xf6d4('0x48'),_0xf6d4('0x1e'),{'module':_0xf6d4('0x51')});}})['catch'](handleError(_0x6bff88,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 83a6844..0908e19 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 _0xb469=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','lodash','util','../../config/logger','api'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xb469,0x13b));var _0x9b46=function(_0x41871d,_0x5dad99){_0x41871d=_0x41871d-0x0;var _0x4f999e=_0xb469[_0x41871d];return _0x4f999e;};'use strict';var _=require(_0x9b46('0x0'));var util=require(_0x9b46('0x1'));var logger=require(_0x9b46('0x2'))(_0x9b46('0x3'));var moment=require(_0x9b46('0x4'));var BPromise=require(_0x9b46('0x5'));var rp=require(_0x9b46('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9b46('0x7'));var config=require(_0x9b46('0x8'));var attributes=require('./network.attributes');module[_0x9b46('0x9')]=function(_0x405d1c,_0x50b49e){return _0x405d1c[_0x9b46('0xa')]('Network',attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb903=['rimraf','../../config/environment','./network.attributes','exports','network','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x1e928b,_0x7cb412){var _0x3e26c3=function(_0x1c41f8){while(--_0x1c41f8){_0x1e928b['push'](_0x1e928b['shift']());}};_0x3e26c3(++_0x7cb412);}(_0xb903,0x185));var _0x3b90=function(_0x2099a1,_0x52482d){_0x2099a1=_0x2099a1-0x0;var _0x428684=_0xb903[_0x2099a1];return _0x428684;};'use strict';var _=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var logger=require(_0x3b90('0x2'))(_0x3b90('0x3'));var moment=require('moment');var BPromise=require(_0x3b90('0x4'));var rp=require(_0x3b90('0x5'));var fs=require('fs');var path=require(_0x3b90('0x6'));var rimraf=require(_0x3b90('0x7'));var config=require(_0x3b90('0x8'));var attributes=require(_0x3b90('0x9'));module[_0x3b90('0xa')]=function(_0x5acd76,_0x15b68f){return _0x5acd76['define']('Network',attributes,{'tableName':_0x3b90('0xb'),'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 3672b97..585569a 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x8999cc,_0x3566db){var _0x580467=function(_0x45a619){while(--_0x45a619){_0x8999cc['push'](_0x8999cc['shift']());}};_0x580467(++_0x3566db);}(_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 +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(_0x57d6b4,_0x102e93){_0x57d6b4=_0x57d6b4-0x0;var _0x53030b=_0x7a54[_0x57d6b4];return _0x53030b;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 9eac854..f98fcbd 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 _0x3078=['delete','destroy','removeAnswers','removeAgents','multer','util','path','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/users','getAgents','post','/:id/dispositions','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','send','put'];(function(_0x26e37c,_0x542a73){var _0x22f000=function(_0x1905f9){while(--_0x1905f9){_0x26e37c['push'](_0x26e37c['shift']());}};_0x22f000(++_0x542a73);}(_0x3078,0xb8));var _0x8307=function(_0x370284,_0x3348d5){_0x370284=_0x370284-0x0;var _0x1445c8=_0x3078[_0x370284];return _0x1445c8;};'use strict';var multer=require(_0x8307('0x0'));var util=require(_0x8307('0x1'));var path=require(_0x8307('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8307('0x3'));var interaction=require(_0x8307('0x4'));var config=require('../../config/environment');var controller=require('./openchannelAccount.controller');router[_0x8307('0x5')]('/',auth[_0x8307('0x6')](),controller['index']);router[_0x8307('0x5')]('/describe',auth[_0x8307('0x6')](),controller['describe']);router['get'](_0x8307('0x7'),auth[_0x8307('0x6')](),controller['show']);router[_0x8307('0x5')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x8307('0x8')]);router[_0x8307('0x5')](_0x8307('0x9'),auth[_0x8307('0x6')](),controller[_0x8307('0xa')]);router[_0x8307('0x5')](_0x8307('0xb'),auth['isAuthenticated'](),controller['getApplications']);router[_0x8307('0x5')](_0x8307('0xc'),auth['isAuthenticated'](),controller[_0x8307('0xd')]);router['get'](_0x8307('0xe'),auth[_0x8307('0x6')](),controller[_0x8307('0xf')]);router[_0x8307('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8307('0x10')](_0x8307('0x11'),auth[_0x8307('0x6')](),controller[_0x8307('0x12')]);router['post'](_0x8307('0x9'),auth['isAuthenticated'](),controller[_0x8307('0x13')]);router[_0x8307('0x10')](_0x8307('0x14'),controller[_0x8307('0x15')]);router[_0x8307('0x10')]('/:id/applications',auth[_0x8307('0x6')](),controller[_0x8307('0x16')]);router[_0x8307('0x10')](_0x8307('0xe'),auth[_0x8307('0x6')](),controller['addAgents']);router[_0x8307('0x10')](_0x8307('0x17'),auth[_0x8307('0x6')](),controller[_0x8307('0x18')]);router[_0x8307('0x19')](_0x8307('0x7'),auth['isAuthenticated'](),controller['update']);router[_0x8307('0x1a')](_0x8307('0x7'),auth['isAuthenticated'](),controller[_0x8307('0x1b')]);router[_0x8307('0x1a')](_0x8307('0x11'),auth[_0x8307('0x6')](),controller['removeDispositions']);router[_0x8307('0x1a')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x8307('0x1c')]);router[_0x8307('0x1a')](_0x8307('0xe'),auth[_0x8307('0x6')](),controller[_0x8307('0x1d')]);module['exports']=router; \ No newline at end of file +var _0x6977=['notify','addApplications','addAgents','/:id/send','put','delete','destroy','removeDispositions','removeAnswers','exports','multer','util','express','fs-extra','../../components/auth/service','../../config/environment','./openchannelAccount.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','/:id/notify'];(function(_0x5e966a,_0x47c9a3){var _0x3b31a7=function(_0x7ed7e6){while(--_0x7ed7e6){_0x5e966a['push'](_0x5e966a['shift']());}};_0x3b31a7(++_0x47c9a3);}(_0x6977,0x10d));var _0x7697=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0x6977[_0x34843e];return _0x598f7f;};'use strict';var multer=require(_0x7697('0x0'));var util=require(_0x7697('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7697('0x2'));var router=express['Router']();var fs_extra=require(_0x7697('0x3'));var auth=require(_0x7697('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7697('0x5'));var controller=require(_0x7697('0x6'));router[_0x7697('0x7')]('/',auth['isAuthenticated'](),controller[_0x7697('0x8')]);router['get'](_0x7697('0x9'),auth['isAuthenticated'](),controller[_0x7697('0xa')]);router['get'](_0x7697('0xb'),auth[_0x7697('0xc')](),controller[_0x7697('0xd')]);router['get'](_0x7697('0xe'),auth[_0x7697('0xc')](),controller[_0x7697('0xf')]);router[_0x7697('0x7')]('/:id/canned_answers',auth[_0x7697('0xc')](),controller[_0x7697('0x10')]);router[_0x7697('0x7')](_0x7697('0x11'),auth[_0x7697('0xc')](),controller[_0x7697('0x12')]);router[_0x7697('0x7')](_0x7697('0x13'),auth['isAuthenticated'](),controller[_0x7697('0x14')]);router['get'](_0x7697('0x15'),auth[_0x7697('0xc')](),controller[_0x7697('0x16')]);router[_0x7697('0x17')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7697('0x17')](_0x7697('0xe'),auth[_0x7697('0xc')](),controller[_0x7697('0x18')]);router['post'](_0x7697('0x19'),auth[_0x7697('0xc')](),controller['addAnswer']);router['post'](_0x7697('0x1a'),controller[_0x7697('0x1b')]);router[_0x7697('0x17')]('/:id/applications',auth[_0x7697('0xc')](),controller[_0x7697('0x1c')]);router[_0x7697('0x17')](_0x7697('0x15'),auth['isAuthenticated'](),controller[_0x7697('0x1d')]);router['post'](_0x7697('0x1e'),auth[_0x7697('0xc')](),controller['send']);router[_0x7697('0x1f')](_0x7697('0xb'),auth[_0x7697('0xc')](),controller['update']);router[_0x7697('0x20')]('/:id',auth[_0x7697('0xc')](),controller[_0x7697('0x21')]);router[_0x7697('0x20')](_0x7697('0xe'),auth[_0x7697('0xc')](),controller[_0x7697('0x22')]);router[_0x7697('0x20')]('/:id/canned_answers',auth[_0x7697('0xc')](),controller[_0x7697('0x23')]);router['delete'](_0x7697('0x15'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x7697('0x24')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 7a28950..5d54d07 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 _0xf606=['INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','BOOLEAN'];(function(_0x493560,_0x1b9d24){var _0x314a41=function(_0x410567){while(--_0x410567){_0x493560['push'](_0x493560['shift']());}};_0x314a41(++_0x1b9d24);}(_0xf606,0x1d9));var _0x6f60=function(_0x34de5e,_0x193620){_0x34de5e=_0x34de5e-0x0;var _0x38fc6d=_0xf606[_0x34de5e];return _0x38fc6d;};'use strict';var Sequelize=require(_0x6f60('0x0'));var rs=require(_0x6f60('0x1'));module[_0x6f60('0x2')]={'name':{'type':Sequelize[_0x6f60('0x3')],'unique':_0x6f60('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x6f60('0x3')]},'token':{'type':Sequelize[_0x6f60('0x3')],'defaultValue':function(){return rs[_0x6f60('0x5')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x6f60('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x6f60('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6f60('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x6f60('0x3')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6f60('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6f60('0x7')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x6f60('0x8'),'set':function(_0x3c7fa6){if(!_0x3c7fa6)this[_0x6f60('0x9')](_0x6f60('0xa'),null);this[_0x6f60('0x9')](_0x6f60('0xb'),_0x3c7fa6);}}}; \ No newline at end of file +var _0x629e=['mandatoryDisposition','sequelize','randomstring','STRING','name','generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x629e,0x1b1));var _0xe629=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x629e[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0xe629('0x0'));var rs=require(_0xe629('0x1'));module['exports']={'name':{'type':Sequelize[_0xe629('0x2')],'unique':_0xe629('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xe629('0x2')]},'token':{'type':Sequelize[_0xe629('0x2')],'defaultValue':function(){return rs[_0xe629('0x4')]();}},'replyUri':{'type':Sequelize[_0xe629('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xe629('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xe629('0x5');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe629('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xe629('0x2')]},'queueTransfer':{'type':Sequelize[_0xe629('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe629('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xe629('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xe629('0x7')],'defaultValue':![],'comment':_0xe629('0x9'),'set':function(_0x5934d0){if(!_0x5934d0)this['setDataValue'](_0xe629('0xa'),null);this['setDataValue'](_0xe629('0xb'),_0x5934d0);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 4c84851..8d70d3d 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 _0x7f42=['include','rows','show','length','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','findOne','Disposition','pick','includeAll','findAll','removeDispositions','ids','addAnswer','OpenchannelAccountId','getAnswers','CannedAnswer','removeAnswers','openchannel','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','contact','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','messageId','interaction','created','autoclose','unmanaged','OpenchannelMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','notify','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','user','out','Messages','dataValues','push','eml-format','zip-dir','fast-json-patch','moment','mustache','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','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','http','client','request','then','info','OpenchannelAccount,\x20%s,\x20%s','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update','get','OpenchannelAccounts','UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','model','keys','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','OpenchannelAccount'];(function(_0x1305e3,_0x43a724){var _0x1068e9=function(_0x1bc555){while(--_0x1bc555){_0x1305e3['push'](_0x1305e3['shift']());}};_0x1068e9(++_0x43a724);}(_0x7f42,0x1dd));var _0x27f4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7f42[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x27f4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x27f4('0x1'));var jsonpatch=require(_0x27f4('0x2'));var rp=require('request-promise');var moment=require(_0x27f4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x27f4('0x4'));var util=require('util');var path=require(_0x27f4('0x5'));var sox=require('sox');var csv=require(_0x27f4('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x27f4('0x7'));var _=require(_0x27f4('0x8'));var squel=require(_0x27f4('0x9'));var crypto=require(_0x27f4('0xa'));var jsforce=require(_0x27f4('0xb'));var deskjs=require(_0x27f4('0xc'));var toCsv=require(_0x27f4('0x6'));var querystring=require(_0x27f4('0xd'));var Papa=require(_0x27f4('0xe'));var Redis=require(_0x27f4('0xf'));var authService=require(_0x27f4('0x10'));var qs=require(_0x27f4('0x11'));var as=require(_0x27f4('0x12'));var hardwareService=require(_0x27f4('0x13'));var logger=require(_0x27f4('0x14'))(_0x27f4('0x15'));var utils=require(_0x27f4('0x16'));var config=require(_0x27f4('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x27f4('0x18')]=_[_0x27f4('0x19')](config[_0x27f4('0x18')],{'host':_0x27f4('0x1a'),'port':0x18eb});var socket=require(_0x27f4('0x1b'))(new Redis(config[_0x27f4('0x18')]));require(_0x27f4('0x1c'))[_0x27f4('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x27f4('0x1e')]({'port':0x232c});var client9002=jayson[_0x27f4('0x1f')][_0x27f4('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x2e8264,_0x4e0e5b,_0x185ed6,_0x1ecb85){return new BPromise(function(_0x321821,_0x585277){var _0x3203af=_0x1ecb85||client;return _0x3203af[_0x27f4('0x20')](_0x2e8264,_0x185ed6)[_0x27f4('0x21')](function(_0x49e6c0){logger[_0x27f4('0x22')](_0x27f4('0x23'),_0x4e0e5b,'request\x20sent');logger['debug'](_0x27f4('0x24'),_0x4e0e5b,_0x27f4('0x25'),JSON[_0x27f4('0x26')](_0x49e6c0));if(_0x49e6c0[_0x27f4('0x27')]){if(_0x49e6c0[_0x27f4('0x27')][_0x27f4('0x28')]===0x1f4){logger[_0x27f4('0x27')](_0x27f4('0x23'),_0x4e0e5b,_0x49e6c0[_0x27f4('0x27')][_0x27f4('0x29')]);return _0x585277(_0x49e6c0[_0x27f4('0x27')][_0x27f4('0x29')]);}logger[_0x27f4('0x27')](_0x27f4('0x23'),_0x4e0e5b,_0x49e6c0[_0x27f4('0x27')]['message']);return _0x321821(_0x49e6c0[_0x27f4('0x27')][_0x27f4('0x29')]);}else{logger[_0x27f4('0x22')](_0x27f4('0x23'),_0x4e0e5b,_0x27f4('0x25'));_0x321821(_0x49e6c0[_0x27f4('0x2a')][_0x27f4('0x29')]);}})[_0x27f4('0x2b')](function(_0x328123){logger[_0x27f4('0x27')](_0x27f4('0x23'),_0x4e0e5b,_0x328123);_0x585277(_0x328123);});});}function respondWithStatusCode(_0x1e24c3,_0x167574){_0x167574=_0x167574||0xcc;return function(_0x400d8d){if(_0x400d8d){return _0x1e24c3[_0x27f4('0x2c')](_0x167574);}return _0x1e24c3[_0x27f4('0x2d')](_0x167574)[_0x27f4('0x2e')]();};}function respondWithResult(_0x56b2c6,_0xf9a11d){_0xf9a11d=_0xf9a11d||0xc8;return function(_0x566d28){if(_0x566d28){return _0x56b2c6[_0x27f4('0x2d')](_0xf9a11d)[_0x27f4('0x2f')](_0x566d28);}};}function respondWithFilteredResult(_0x9c39b9,_0x48beb5){return function(_0x38eb1c){if(_0x38eb1c){var _0x351dba=typeof _0x48beb5['offset']===_0x27f4('0x30')&&typeof _0x48beb5[_0x27f4('0x31')]==='undefined';var _0x3654f2=_0x38eb1c[_0x27f4('0x32')];var _0x5a241e=_0x351dba?0x0:_0x48beb5[_0x27f4('0x33')];var _0x11b1c2=_0x351dba?_0x38eb1c['count']:_0x48beb5[_0x27f4('0x33')]+_0x48beb5[_0x27f4('0x31')];var _0x1f2f16;if(_0x11b1c2>=_0x3654f2){_0x11b1c2=_0x3654f2;_0x1f2f16=0xc8;}else{_0x1f2f16=0xce;}_0x9c39b9['status'](_0x1f2f16);return _0x9c39b9['set']('Content-Range',_0x5a241e+'-'+_0x11b1c2+'/'+_0x3654f2)['json'](_0x38eb1c);}return null;};}function patchUpdates(_0x1e9a84){return function(_0x8fcf57){try{jsonpatch[_0x27f4('0x34')](_0x8fcf57,_0x1e9a84,!![]);}catch(_0x28f319){return BPromise[_0x27f4('0x35')](_0x28f319);}return _0x8fcf57[_0x27f4('0x36')]();};}function saveUpdates(_0x237f44,_0x1b3beb){return function(_0x34b875){if(_0x34b875){return _0x34b875[_0x27f4('0x37')](_0x237f44)[_0x27f4('0x21')](function(_0x4b32fa){return _0x4b32fa;});}return null;};}function removeEntity(_0x68674b,_0x51bf92){return function(_0x316e89){if(_0x316e89){return _0x316e89['destroy']()[_0x27f4('0x21')](function(){var _0x20d448=_0x316e89[_0x27f4('0x38')]({'plain':!![]});var _0x97455c=_0x27f4('0x39');return db[_0x27f4('0x3a')][_0x27f4('0x3b')]({'where':{'type':_0x97455c,'resourceId':_0x20d448['id']}})[_0x27f4('0x21')](function(){return _0x316e89;});})[_0x27f4('0x21')](function(){_0x68674b[_0x27f4('0x2d')](0xcc)[_0x27f4('0x2e')]();});}};}function handleEntityNotFound(_0x7f86dd,_0x63c4f2){return function(_0x1a4cf7){if(!_0x1a4cf7){_0x7f86dd[_0x27f4('0x2c')](0x194);}return _0x1a4cf7;};}function handleError(_0x24fdfc,_0x47b5e2){_0x47b5e2=_0x47b5e2||0x1f4;return function(_0x5211ae){logger[_0x27f4('0x27')](_0x5211ae[_0x27f4('0x3c')]);if(_0x5211ae[_0x27f4('0x3d')]){delete _0x5211ae['name'];}_0x24fdfc[_0x27f4('0x2d')](_0x47b5e2)[_0x27f4('0x3e')](_0x5211ae);};}exports[_0x27f4('0x3f')]=function(_0x4e4946,_0x3c7bef){var _0x187ab8={'include':[{'model':db[_0x27f4('0x40')],'as':_0x27f4('0x41')}]},_0x48b3eb={},_0x2b4914={'count':0x0,'rows':[]};var _0x1dbe8b=_[_0x27f4('0x42')](db['OpenchannelAccount'][_0x27f4('0x43')],function(_0x573140){return{'name':_0x573140[_0x27f4('0x44')],'type':_0x573140[_0x27f4('0x45')]['key']};});_0x48b3eb[_0x27f4('0x46')]=_[_0x27f4('0x42')](_0x1dbe8b,_0x27f4('0x3d'));_0x48b3eb['query']=_[_0x27f4('0x47')](_0x4e4946['query']);_0x48b3eb[_0x27f4('0x48')]=_[_0x27f4('0x49')](_0x48b3eb[_0x27f4('0x46')],_0x48b3eb[_0x27f4('0x4a')]);_0x187ab8['attributes']=_[_0x27f4('0x49')](_0x48b3eb[_0x27f4('0x46')],qs[_0x27f4('0x4b')](_0x4e4946[_0x27f4('0x4a')][_0x27f4('0x4b')]));_0x187ab8['attributes']=_0x187ab8[_0x27f4('0x4c')]['length']?_0x187ab8['attributes']:_0x48b3eb['model'];if(!_0x4e4946[_0x27f4('0x4a')][_0x27f4('0x4d')](_0x27f4('0x4e'))){_0x187ab8[_0x27f4('0x31')]=qs['limit'](_0x4e4946[_0x27f4('0x4a')][_0x27f4('0x31')]);_0x187ab8[_0x27f4('0x33')]=qs[_0x27f4('0x33')](_0x4e4946['query']['offset']);}_0x187ab8[_0x27f4('0x4f')]=qs[_0x27f4('0x50')](_0x4e4946[_0x27f4('0x4a')][_0x27f4('0x50')]);_0x187ab8['where']=qs[_0x27f4('0x48')](_['pick'](_0x4e4946['query'],_0x48b3eb['filters']),_0x1dbe8b);if(_0x4e4946[_0x27f4('0x4a')]['filter']){_0x187ab8[_0x27f4('0x51')]=_[_0x27f4('0x52')](_0x187ab8['where'],{'$or':_[_0x27f4('0x42')](_0x1dbe8b,function(_0x351d1f){if(_0x351d1f['type']!==_0x27f4('0x53')){var _0x9b2015={};_0x9b2015[_0x351d1f[_0x27f4('0x3d')]]={'$like':'%'+_0x4e4946[_0x27f4('0x4a')][_0x27f4('0x54')]+'%'};return _0x9b2015;}})});}_0x187ab8=_[_0x27f4('0x52')]({},_0x187ab8,_0x4e4946[_0x27f4('0x55')]);var _0x3d4973={'where':_0x187ab8['where']};return db[_0x27f4('0x56')]['count'](_0x3d4973)[_0x27f4('0x21')](function(_0x23151e){_0x2b4914[_0x27f4('0x32')]=_0x23151e;if(_0x4e4946['query']['includeAll']){_0x187ab8[_0x27f4('0x57')]=[{'all':!![]}];}return db[_0x27f4('0x56')]['findAll'](_0x187ab8);})[_0x27f4('0x21')](function(_0x4a0801){_0x2b4914[_0x27f4('0x58')]=_0x4a0801;return _0x2b4914;})[_0x27f4('0x21')](respondWithFilteredResult(_0x3c7bef,_0x187ab8))[_0x27f4('0x2b')](handleError(_0x3c7bef,null));};exports[_0x27f4('0x59')]=function(_0x3f3fc5,_0x14dba4){var _0x430371={'raw':![],'where':{'id':_0x3f3fc5['params']['id']},'include':[{'model':db[_0x27f4('0x40')],'as':'mandatoryDispositionPause'}]},_0x5614d8={};_0x5614d8[_0x27f4('0x46')]=_[_0x27f4('0x47')](db['OpenchannelAccount'][_0x27f4('0x43')]);_0x5614d8[_0x27f4('0x4a')]=_[_0x27f4('0x47')](_0x3f3fc5[_0x27f4('0x4a')]);_0x5614d8[_0x27f4('0x48')]=_[_0x27f4('0x49')](_0x5614d8[_0x27f4('0x46')],_0x5614d8[_0x27f4('0x4a')]);_0x430371[_0x27f4('0x4c')]=_[_0x27f4('0x49')](_0x5614d8[_0x27f4('0x46')],qs[_0x27f4('0x4b')](_0x3f3fc5[_0x27f4('0x4a')][_0x27f4('0x4b')]));_0x430371[_0x27f4('0x4c')]=_0x430371['attributes'][_0x27f4('0x5a')]?_0x430371[_0x27f4('0x4c')]:_0x5614d8['model'];if(_0x3f3fc5[_0x27f4('0x4a')]['includeAll']){_0x430371['include']=[{'all':!![]}];}_0x430371=_[_0x27f4('0x52')]({},_0x430371,_0x3f3fc5['options']);return db['OpenchannelAccount']['find'](_0x430371)['then'](handleEntityNotFound(_0x14dba4,null))[_0x27f4('0x21')](respondWithResult(_0x14dba4,null))['catch'](handleError(_0x14dba4,null));};exports[_0x27f4('0x5b')]=function(_0x5d239a,_0x24c56e){return db[_0x27f4('0x56')][_0x27f4('0x5b')](_0x5d239a[_0x27f4('0x5c')],{})['then'](function(_0xcf003d){var _0x22ae68=_0x5d239a['user'][_0x27f4('0x38')]({'plain':!![]});if(!_0x22ae68)throw new Error(_0x27f4('0x5d'));if(_0x22ae68['role']==='user'){var _0x3580c4=_0xcf003d[_0x27f4('0x38')]({'plain':!![]});var _0x5009f5=_0x27f4('0x39');return db['UserProfileSection'][_0x27f4('0x5e')]({'where':{'name':_0x5009f5,'userProfileId':_0x22ae68[_0x27f4('0x5f')]},'raw':!![]})[_0x27f4('0x21')](function(_0x232ad3){if(_0x232ad3&&_0x232ad3[_0x27f4('0x60')]===0x0){return db['UserProfileResource'][_0x27f4('0x5b')]({'name':_0x3580c4['name'],'resourceId':_0x3580c4['id'],'type':_0x232ad3[_0x27f4('0x3d')],'sectionId':_0x232ad3['id']},{})[_0x27f4('0x21')](function(){return _0xcf003d;});}else{return _0xcf003d;}})[_0x27f4('0x2b')](function(_0x5a9201){logger[_0x27f4('0x27')](_0x27f4('0x61'),_0x5a9201);throw _0x5a9201;});}return _0xcf003d;})['then'](respondWithResult(_0x24c56e,0xc9))[_0x27f4('0x2b')](handleError(_0x24c56e,null));};exports[_0x27f4('0x37')]=function(_0x27dad6,_0xd23e90){if(_0x27dad6[_0x27f4('0x5c')]['id']){delete _0x27dad6[_0x27f4('0x5c')]['id'];}return db[_0x27f4('0x56')][_0x27f4('0x5e')]({'where':{'id':_0x27dad6[_0x27f4('0x62')]['id']},'include':[{'model':db[_0x27f4('0x40')],'as':_0x27f4('0x41')}]})['then'](handleEntityNotFound(_0xd23e90,null))[_0x27f4('0x21')](saveUpdates(_0x27dad6[_0x27f4('0x5c')],null))[_0x27f4('0x21')](respondWithResult(_0xd23e90,null))[_0x27f4('0x2b')](handleError(_0xd23e90,null));};exports[_0x27f4('0x3b')]=function(_0x2051a9,_0x3e683b){return db['OpenchannelAccount'][_0x27f4('0x5e')]({'where':{'id':_0x2051a9['params']['id']}})[_0x27f4('0x21')](handleEntityNotFound(_0x3e683b,null))[_0x27f4('0x21')](removeEntity(_0x3e683b,null))[_0x27f4('0x2b')](handleError(_0x3e683b,null));};exports['describe']=function(_0x37e4f1,_0x352765){return db[_0x27f4('0x56')][_0x27f4('0x63')]()[_0x27f4('0x21')](respondWithResult(_0x352765,null))['catch'](handleError(_0x352765,null));};exports[_0x27f4('0x64')]=function(_0x1b9cc8,_0x38382e,_0x4e189d){if(_0x1b9cc8[_0x27f4('0x5c')]['id']){delete _0x1b9cc8[_0x27f4('0x5c')]['id'];}return db[_0x27f4('0x56')][_0x27f4('0x5e')]({'where':{'id':_0x1b9cc8[_0x27f4('0x62')]['id']}})['then'](handleEntityNotFound(_0x38382e,null))[_0x27f4('0x21')](function(_0x2e10f3){if(_0x2e10f3){_0x1b9cc8[_0x27f4('0x5c')]['OpenchannelAccountId']=_0x2e10f3['id'];return db['Disposition'][_0x27f4('0x5b')](_0x1b9cc8[_0x27f4('0x5c')]);}})[_0x27f4('0x21')](respondWithResult(_0x38382e,null))[_0x27f4('0x2b')](handleError(_0x38382e,null));};exports['getDispositions']=function(_0x476bc0,_0x574a1b,_0xbeb892){var _0x3a1b0a={'raw':![],'where':{}};var _0x591697={};var _0x4fdcf6={'count':0x0,'rows':[]};return db[_0x27f4('0x56')][_0x27f4('0x65')]({'where':{'id':_0x476bc0['params']['id']}})[_0x27f4('0x21')](handleEntityNotFound(_0x574a1b,null))[_0x27f4('0x21')](function(_0x2d9e3b){if(_0x2d9e3b){_0x591697[_0x27f4('0x46')]=_[_0x27f4('0x47')](db[_0x27f4('0x66')][_0x27f4('0x43')]);_0x591697['query']=_[_0x27f4('0x47')](_0x476bc0[_0x27f4('0x4a')]);_0x591697[_0x27f4('0x48')]=_[_0x27f4('0x49')](_0x591697[_0x27f4('0x46')],_0x591697['query']);_0x3a1b0a['attributes']=_[_0x27f4('0x49')](_0x591697['model'],qs[_0x27f4('0x4b')](_0x476bc0[_0x27f4('0x4a')][_0x27f4('0x4b')]));_0x3a1b0a['attributes']=_0x3a1b0a[_0x27f4('0x4c')][_0x27f4('0x5a')]?_0x3a1b0a['attributes']:_0x591697['model'];if(!_0x476bc0[_0x27f4('0x4a')][_0x27f4('0x4d')](_0x27f4('0x4e'))){_0x3a1b0a[_0x27f4('0x31')]=qs[_0x27f4('0x31')](_0x476bc0[_0x27f4('0x4a')]['limit']);_0x3a1b0a[_0x27f4('0x33')]=qs[_0x27f4('0x33')](_0x476bc0[_0x27f4('0x4a')]['offset']);}_0x3a1b0a[_0x27f4('0x4f')]=qs[_0x27f4('0x50')](_0x476bc0['query']['sort']);_0x3a1b0a[_0x27f4('0x51')]=qs[_0x27f4('0x48')](_[_0x27f4('0x67')](_0x476bc0[_0x27f4('0x4a')],_0x591697[_0x27f4('0x48')]));_0x3a1b0a[_0x27f4('0x51')]['OpenchannelAccountId']=_0x2d9e3b['id'];if(_0x476bc0[_0x27f4('0x4a')][_0x27f4('0x54')]){_0x3a1b0a[_0x27f4('0x51')]=_[_0x27f4('0x52')](_0x3a1b0a['where'],{'$or':_[_0x27f4('0x42')](_0x3a1b0a[_0x27f4('0x4c')],function(_0xf05816){var _0x13c095={};_0x13c095[_0xf05816]={'$like':'%'+_0x476bc0[_0x27f4('0x4a')][_0x27f4('0x54')]+'%'};return _0x13c095;})});}_0x3a1b0a=_[_0x27f4('0x52')]({},_0x3a1b0a,_0x476bc0[_0x27f4('0x55')]);return db['Disposition'][_0x27f4('0x32')]({'where':_0x3a1b0a['where']})[_0x27f4('0x21')](function(_0x5a19f5){_0x4fdcf6[_0x27f4('0x32')]=_0x5a19f5;if(_0x476bc0[_0x27f4('0x4a')][_0x27f4('0x68')]){_0x3a1b0a['include']=[{'all':!![]}];}return db['Disposition'][_0x27f4('0x69')](_0x3a1b0a);})[_0x27f4('0x21')](function(_0x410a14){_0x4fdcf6['rows']=_0x410a14;return _0x4fdcf6;});}})['then'](respondWithFilteredResult(_0x574a1b,_0x3a1b0a))['catch'](handleError(_0x574a1b,null));};exports['removeDispositions']=function(_0x565511,_0x503ab8,_0x6c8cb){return db[_0x27f4('0x56')][_0x27f4('0x5e')]({'where':{'id':_0x565511[_0x27f4('0x62')]['id']}})[_0x27f4('0x21')](handleEntityNotFound(_0x503ab8,null))[_0x27f4('0x21')](function(_0x47f5b7){if(_0x47f5b7){return _0x47f5b7[_0x27f4('0x6a')](_0x565511['query'][_0x27f4('0x6b')]);}})[_0x27f4('0x21')](respondWithStatusCode(_0x503ab8,null))[_0x27f4('0x2b')](handleError(_0x503ab8,null));};exports[_0x27f4('0x6c')]=function(_0x301a2b,_0x47277f,_0x2fc7ed){if(_0x301a2b['body']['id']){delete _0x301a2b[_0x27f4('0x5c')]['id'];}return db['OpenchannelAccount'][_0x27f4('0x5e')]({'where':{'id':_0x301a2b['params']['id']}})[_0x27f4('0x21')](handleEntityNotFound(_0x47277f,null))[_0x27f4('0x21')](function(_0x32c9ec){if(_0x32c9ec){_0x301a2b[_0x27f4('0x5c')][_0x27f4('0x6d')]=_0x32c9ec['id'];return db['CannedAnswer'][_0x27f4('0x5b')](_0x301a2b[_0x27f4('0x5c')]);}})[_0x27f4('0x21')](respondWithResult(_0x47277f,null))['catch'](handleError(_0x47277f,null));};exports[_0x27f4('0x6e')]=function(_0x20bea9,_0x15871b,_0x456798){var _0x420427={'raw':![],'where':{}};var _0x33c68e={};var _0x104f6a={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x27f4('0x65')]({'where':{'id':_0x20bea9[_0x27f4('0x62')]['id']}})['then'](handleEntityNotFound(_0x15871b,null))['then'](function(_0x598ddf){if(_0x598ddf){_0x33c68e[_0x27f4('0x46')]=_[_0x27f4('0x47')](db[_0x27f4('0x6f')][_0x27f4('0x43')]);_0x33c68e[_0x27f4('0x4a')]=_[_0x27f4('0x47')](_0x20bea9[_0x27f4('0x4a')]);_0x33c68e[_0x27f4('0x48')]=_[_0x27f4('0x49')](_0x33c68e[_0x27f4('0x46')],_0x33c68e[_0x27f4('0x4a')]);_0x420427[_0x27f4('0x4c')]=_[_0x27f4('0x49')](_0x33c68e['model'],qs[_0x27f4('0x4b')](_0x20bea9[_0x27f4('0x4a')][_0x27f4('0x4b')]));_0x420427['attributes']=_0x420427[_0x27f4('0x4c')][_0x27f4('0x5a')]?_0x420427[_0x27f4('0x4c')]:_0x33c68e[_0x27f4('0x46')];if(!_0x20bea9[_0x27f4('0x4a')][_0x27f4('0x4d')](_0x27f4('0x4e'))){_0x420427[_0x27f4('0x31')]=qs['limit'](_0x20bea9[_0x27f4('0x4a')]['limit']);_0x420427[_0x27f4('0x33')]=qs[_0x27f4('0x33')](_0x20bea9['query'][_0x27f4('0x33')]);}_0x420427['order']=qs[_0x27f4('0x50')](_0x20bea9[_0x27f4('0x4a')][_0x27f4('0x50')]);_0x420427[_0x27f4('0x51')]=qs[_0x27f4('0x48')](_[_0x27f4('0x67')](_0x20bea9[_0x27f4('0x4a')],_0x33c68e['filters']));_0x420427[_0x27f4('0x51')]['OpenchannelAccountId']=_0x598ddf['id'];if(_0x20bea9[_0x27f4('0x4a')]['filter']){_0x420427[_0x27f4('0x51')]=_[_0x27f4('0x52')](_0x420427[_0x27f4('0x51')],{'$or':_['map'](_0x420427[_0x27f4('0x4c')],function(_0x6da061){var _0xbf34b9={};_0xbf34b9[_0x6da061]={'$like':'%'+_0x20bea9[_0x27f4('0x4a')]['filter']+'%'};return _0xbf34b9;})});}_0x420427=_[_0x27f4('0x52')]({},_0x420427,_0x20bea9[_0x27f4('0x55')]);return db[_0x27f4('0x6f')]['count']({'where':_0x420427[_0x27f4('0x51')]})[_0x27f4('0x21')](function(_0x33605d){_0x104f6a[_0x27f4('0x32')]=_0x33605d;if(_0x20bea9[_0x27f4('0x4a')][_0x27f4('0x68')]){_0x420427[_0x27f4('0x57')]=[{'all':!![]}];}return db[_0x27f4('0x6f')]['findAll'](_0x420427);})[_0x27f4('0x21')](function(_0x4fdc95){_0x104f6a[_0x27f4('0x58')]=_0x4fdc95;return _0x104f6a;});}})[_0x27f4('0x21')](respondWithFilteredResult(_0x15871b,_0x420427))[_0x27f4('0x2b')](handleError(_0x15871b,null));};exports[_0x27f4('0x70')]=function(_0x2c7fda,_0x171699,_0x23b5fa){return db['OpenchannelAccount'][_0x27f4('0x5e')]({'where':{'id':_0x2c7fda[_0x27f4('0x62')]['id']}})[_0x27f4('0x21')](handleEntityNotFound(_0x171699,null))[_0x27f4('0x21')](function(_0x400d81){if(_0x400d81){return _0x400d81[_0x27f4('0x70')](_0x2c7fda['query'][_0x27f4('0x6b')]);}})['then'](respondWithStatusCode(_0x171699,null))[_0x27f4('0x2b')](handleError(_0x171699,null));};exports['notify']=function(_0x2a6a90,_0x4bb880,_0x5d7a99){var _0x6680d6={'body':_0x2a6a90['body'],'channel':_0x27f4('0x71')};var _0x27480f=[];var _0x4d9ce6=[];var _0x120480={};var _0x52e638=![];return db[_0x27f4('0x72')][_0x27f4('0x63')]()[_0x27f4('0x21')](function(_0x2fa829){if(!_0x2fa829){throw new db[(_0x27f4('0x73'))][(_0x27f4('0x74'))]('no\x20available\x20attributes');}_0x27480f=_[_0x27f4('0x75')](_[_0x27f4('0x47')](_0x2fa829),[_0x27f4('0x76'),_0x27f4('0x77')]);_0x4d9ce6=_[_0x27f4('0x75')](_[_0x27f4('0x47')](_0x2fa829),[_0x27f4('0x76'),_0x27f4('0x77'),'CompanyId',_0x27f4('0x78')]);if(_0x2a6a90[_0x27f4('0x5c')]['id']){delete _0x2a6a90[_0x27f4('0x5c')]['id'];}if(_[_0x27f4('0x79')](_0x2a6a90[_0x27f4('0x5c')][_0x27f4('0x7a')])){throw new db[(_0x27f4('0x73'))][(_0x27f4('0x74'))](_0x27f4('0x7b'));}if(_[_0x27f4('0x79')](_0x2a6a90['body'][_0x27f4('0x5c')])||_0x2a6a90[_0x27f4('0x5c')][_0x27f4('0x5c')]===''){throw new db[(_0x27f4('0x73'))]['ValidationError'](_0x27f4('0x7c'));}if(_[_0x27f4('0x79')](_0x2a6a90[_0x27f4('0x5c')][_0x27f4('0x7d')])){throw new db[(_0x27f4('0x73'))][(_0x27f4('0x74'))](_0x27f4('0x7e')+_0x4d9ce6);}if(!_['includes'](_0x4d9ce6,_0x2a6a90[_0x27f4('0x5c')][_0x27f4('0x7d')])){throw new db['Sequelize']['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4d9ce6);}_0x120480[_0x2a6a90[_0x27f4('0x5c')]['mapKey']]=_0x2a6a90[_0x27f4('0x5c')][_0x27f4('0x7a')];})[_0x27f4('0x21')](function(){return db['OpenchannelAccount']['find']({'where':{'id':_0x2a6a90[_0x27f4('0x62')]['id']},'include':[{'model':db[_0x27f4('0x7f')],'as':_0x27f4('0x80'),'include':[{'model':db['CmContact'],'as':_0x27f4('0x81'),'where':_0x120480,'limit':0x1,'order':[[_0x27f4('0x77'),_0x27f4('0x82')]]}]},{'model':db[_0x27f4('0x83')],'as':_0x27f4('0x84')}]});})['then'](handleEntityNotFound(_0x4bb880,null))[_0x27f4('0x21')](function(_0x173ea4){if(_0x173ea4&&_0x173ea4['List']){_0x6680d6[_0x27f4('0x85')]=_0x173ea4;_0x6680d6[_0x27f4('0x86')]=_0x173ea4[_0x27f4('0x84')];_0x6680d6[_0x27f4('0x87')]=_0x173ea4['List'];_0x6680d6[_0x27f4('0x86')]=_[_0x27f4('0x88')](_0x6680d6[_0x27f4('0x86')],[_0x27f4('0x89')],['asc']);if(_0x6680d6['account'][_0x27f4('0x84')]){delete _0x6680d6[_0x27f4('0x85')]['Applications'];}if(_0x6680d6[_0x27f4('0x85')][_0x27f4('0x80')]&&_0x6680d6[_0x27f4('0x85')][_0x27f4('0x80')]['Contacts'][_0x27f4('0x5a')]){return _0x6680d6[_0x27f4('0x85')][_0x27f4('0x80')]['Contacts'][0x0];}var _0x23300e=_['defaults'](_0x2a6a90[_0x27f4('0x5c')],{'firstName':_0x2a6a90[_0x27f4('0x5c')][_0x27f4('0x7a')],'ListId':_0x173ea4[_0x27f4('0x78')]});_0x23300e[_0x2a6a90[_0x27f4('0x5c')]['mapKey']]=_0x2a6a90[_0x27f4('0x5c')][_0x27f4('0x7a')];return db[_0x27f4('0x72')][_0x27f4('0x5b')](_0x23300e,{'fields':_0x27480f,'raw':!![]});}})[_0x27f4('0x21')](handleEntityNotFound(_0x4bb880,null))[_0x27f4('0x21')](function(_0x205ca5){_0x6680d6[_0x27f4('0x8a')]=_0x205ca5;if(_0x205ca5){var _0x1fbcdc={'ContactId':_0x205ca5['id'],'OpenchannelAccountId':_0x2a6a90[_0x27f4('0x62')]['id'],'from':(_0x205ca5['firstName']||'')+'\x20'+(_0x205ca5['lastName']||'')};var _0x133e70={'OpenchannelAccountId':_0x2a6a90[_0x27f4('0x62')]['id'],'closed':![]};if(_0x2a6a90[_0x27f4('0x5c')][_0x27f4('0x8b')]){_0x133e70[_0x27f4('0x8b')]=_0x2a6a90[_0x27f4('0x5c')]['threadId'];return db['OpenchannelInteraction'][_0x27f4('0x5e')]({'where':_0x133e70})[_0x27f4('0x21')](function(_0x159d6f){if(_0x159d6f){return[_0x159d6f,![]];}_0x1fbcdc[_0x27f4('0x8b')]=_0x2a6a90['body'][_0x27f4('0x8b')];_0x1fbcdc[_0x27f4('0x8c')]=_0x2a6a90[_0x27f4('0x5c')][_0x27f4('0x8c')];return db[_0x27f4('0x8d')]['create'](_0x1fbcdc)['then'](function(_0x3ac491){return[_0x3ac491,!![]];});});}else{_0x133e70[_0x27f4('0x8b')]=null;}_0x133e70[_0x27f4('0x8e')]=_0x205ca5['id'];return db[_0x27f4('0x8d')]['find']({'where':_0x133e70})[_0x27f4('0x21')](function(_0x4616ef){if(_0x4616ef){return[_0x4616ef,![]];}return db['OpenchannelInteraction'][_0x27f4('0x5b')](_0x1fbcdc)[_0x27f4('0x21')](function(_0x1ac576){return[_0x1ac576,!![]];});});}})[_0x27f4('0x8f')](function(_0x57277d,_0x37c697){if(_0x57277d){_0x52e638=_0x37c697;if(!_0x37c697){var _0x447cde={'from':(_0x6680d6[_0x27f4('0x8a')]['firstName']||'')+'\x20'+(_0x6680d6['contact']['lastName']||'')};if(_0x2a6a90[_0x27f4('0x5c')][_0x27f4('0x8b')]&&_0x2a6a90[_0x27f4('0x5c')][_0x27f4('0x90')]&&_0x2a6a90['body']['threadId']!=_0x2a6a90['body']['messageId']){_0x447cde['threadId']=_0x2a6a90[_0x27f4('0x5c')][_0x27f4('0x90')];}return _0x57277d['update'](_0x447cde);}else{return _0x57277d;}}})['then'](function(_0x2058a2){_0x6680d6[_0x27f4('0x91')]=_0x2058a2['get']({'plain':!![]});_0x6680d6[_0x27f4('0x91')]['created']=_0x52e638;if(_0x6680d6[_0x27f4('0x91')][_0x27f4('0x92')]){if(_0x6680d6[_0x27f4('0x85')][_0x27f4('0x93')]){_0x6680d6[_0x27f4('0x86')]['push']({'id':0x0,'priority':_0x6680d6[_0x27f4('0x86')][_0x27f4('0x5a')]+0x1,'app':'close','appdata':_0x27f4('0x94'),'interval':'*,*,*,*'});}}return db[_0x27f4('0x95')][_0x27f4('0x5b')]({'body':_0x2a6a90['body'][_0x27f4('0x5c')],'OpenchannelAccountId':_0x2a6a90['params']['id'],'OpenchannelInteractionId':_0x2058a2['id'],'direction':'in','ContactId':_0x6680d6[_0x27f4('0x8a')]['id'],'AttachmentId':_0x2a6a90[_0x27f4('0x5c')][_0x27f4('0x96')]});})['then'](function(_0x67b2a2){_0x6680d6['message']=_0x67b2a2;if(_0x6680d6['interaction'][_0x27f4('0x97')]){return db[_0x27f4('0x98')][_0x27f4('0x5e')]({'attributes':['id',_0x27f4('0x3d')],'where':{'id':_0x6680d6[_0x27f4('0x91')][_0x27f4('0x97')]}})[_0x27f4('0x21')](function(_0x36dc35){if(_0x36dc35){_0x6680d6['applications'][_0x27f4('0x99')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x36dc35[_0x27f4('0x3d')]+','+(_0x6680d6[_0x27f4('0x85')][_0x27f4('0x9a')]||0xa),'interval':'*,*,*,*'});_0x6680d6[_0x27f4('0x9b')]=![];}return respondWithRpcPromise(_0x27f4('0x9c'),_0x27f4('0x9d'),_0x6680d6);});}return respondWithRpcPromise(_0x27f4('0x9c'),'startRouting',_0x6680d6);})['then'](function(_0x107bf4){respondWithRpcPromise(_0x27f4('0x9e'),_0x27f4('0x9e'),{'event':_0x27f4('0x9f'),'message':_0x107bf4},client9002);return _0x107bf4;})[_0x27f4('0x21')](respondWithResult(_0x4bb880,null))[_0x27f4('0x2b')](handleError(_0x4bb880,null));};exports['addApplications']=function(_0x1abeb7,_0x563a3a){var _0x1c9c6c=_0x1abeb7[_0x27f4('0x62')]['id'];var _0x80f96=_0x1abeb7['body'];var _0x163132=0xc8;var _0x19a6b4=null;return db['sequelize'][_0x27f4('0xa0')]({'isolationLevel':db['sequelize'][_0x27f4('0xa1')][_0x27f4('0xa2')][_0x27f4('0xa3')]},function(_0x2fbeff){return db['OpenchannelAccount'][_0x27f4('0x65')]({'where':{'id':_0x1c9c6c},'transaction':_0x2fbeff})[_0x27f4('0x21')](function(_0x42458b){if(_0x42458b){return db['OpenchannelApplication']['destroy']({'where':{'OpenchannelAccountId':_0x1c9c6c},'transaction':_0x2fbeff})[_0x27f4('0x21')](function(){var _0x3f7898=_[_0x27f4('0x42')](_0x80f96,function(_0x49fde0){_0x49fde0[_0x27f4('0x6d')]=_0x1c9c6c;return _0x49fde0;});return db[_0x27f4('0x83')][_0x27f4('0xa4')](_0x3f7898,{'transaction':_0x2fbeff});});}else{_0x163132=0x194;_0x19a6b4=[];}});})[_0x27f4('0x21')](function(){if(_0x163132!==0x194){return db['OpenchannelApplication']['findAndCountAll']({'where':{'OpenchannelAccountId':_0x1c9c6c},'order':_0x27f4('0x89')})[_0x27f4('0x21')](function(_0x3c1cc3){_0x19a6b4=_0x3c1cc3;});}})[_0x27f4('0x2b')](function(_0x3598ff){_0x163132=0x1f4;logger[_0x27f4('0x27')](_0x3598ff[_0x27f4('0x3c')]);if(_0x3598ff['name']){delete _0x3598ff[_0x27f4('0x3d')];}_0x19a6b4=_0x3598ff;})[_0x27f4('0xa5')](function(){if(_0x19a6b4===null){_0x563a3a[_0x27f4('0x2c')](_0x163132);}else{if(_0x163132===0x1f4){_0x563a3a[_0x27f4('0x2d')](_0x163132)[_0x27f4('0x3e')](_0x19a6b4);}else{_0x563a3a['status'](_0x163132)[_0x27f4('0x2f')](_0x19a6b4);}}});};exports[_0x27f4('0xa6')]=function(_0x259364,_0x3b3058,_0x167546){var _0x1fa420={};var _0x5c8bd7={};var _0x51963f;var _0x2bb613;return db[_0x27f4('0x56')]['findOne']({'where':{'id':_0x259364[_0x27f4('0x62')]['id']}})[_0x27f4('0x21')](handleEntityNotFound(_0x3b3058,null))[_0x27f4('0x21')](function(_0x20b83c){if(_0x20b83c){_0x51963f=_0x20b83c;_0x5c8bd7[_0x27f4('0x46')]=_[_0x27f4('0x47')](db[_0x27f4('0x83')][_0x27f4('0x43')]);_0x5c8bd7['query']=_[_0x27f4('0x47')](_0x259364[_0x27f4('0x4a')]);_0x5c8bd7[_0x27f4('0x48')]=_[_0x27f4('0x49')](_0x5c8bd7[_0x27f4('0x46')],_0x5c8bd7[_0x27f4('0x4a')]);_0x1fa420[_0x27f4('0x4c')]=_['intersection'](_0x5c8bd7[_0x27f4('0x46')],qs[_0x27f4('0x4b')](_0x259364[_0x27f4('0x4a')][_0x27f4('0x4b')]));_0x1fa420[_0x27f4('0x4c')]=_0x1fa420[_0x27f4('0x4c')][_0x27f4('0x5a')]?_0x1fa420[_0x27f4('0x4c')]:_0x5c8bd7['model'];_0x1fa420[_0x27f4('0x4f')]=qs[_0x27f4('0x50')](_0x259364[_0x27f4('0x4a')][_0x27f4('0x50')]);_0x1fa420[_0x27f4('0x51')]=qs[_0x27f4('0x48')](_['pick'](_0x259364['query'],_0x5c8bd7[_0x27f4('0x48')]));if(_0x259364['query'][_0x27f4('0x54')]){_0x1fa420[_0x27f4('0x51')]=_[_0x27f4('0x52')](_0x1fa420[_0x27f4('0x51')],{'$or':_['map'](_0x1fa420['attributes'],function(_0x11dd37){var _0x407b6e={};_0x407b6e[_0x11dd37]={'$like':'%'+_0x259364[_0x27f4('0x4a')][_0x27f4('0x54')]+'%'};return _0x407b6e;})});}_0x1fa420=_[_0x27f4('0x52')]({},_0x1fa420,_0x259364[_0x27f4('0x55')]);return _0x51963f[_0x27f4('0xa6')](_0x1fa420);}})['then'](function(_0x114dbe){if(_0x114dbe){_0x2bb613=_0x114dbe[_0x27f4('0x5a')];if(!_0x259364[_0x27f4('0x4a')]['hasOwnProperty'](_0x27f4('0x4e'))){_0x1fa420['limit']=qs[_0x27f4('0x31')](_0x259364[_0x27f4('0x4a')][_0x27f4('0x31')]);_0x1fa420[_0x27f4('0x33')]=qs['offset'](_0x259364[_0x27f4('0x4a')][_0x27f4('0x33')]);}return _0x51963f[_0x27f4('0xa6')](_0x1fa420);}})[_0x27f4('0x21')](function(_0x33d528){if(_0x33d528){return _0x33d528?{'count':_0x2bb613,'rows':_0x33d528}:null;}})['then'](respondWithResult(_0x3b3058,null))[_0x27f4('0x2b')](handleError(_0x3b3058,null));};exports[_0x27f4('0xa7')]=function(_0x58bef3,_0x1333de,_0x736f5e){var _0x12ea23={'raw':![],'where':{}};var _0x4df6b2={};var _0x4b1d20={'count':0x0,'rows':[]};return db[_0x27f4('0x56')][_0x27f4('0x65')]({'where':{'id':_0x58bef3[_0x27f4('0x62')]['id']}})[_0x27f4('0x21')](handleEntityNotFound(_0x1333de,null))[_0x27f4('0x21')](function(_0x13852c){if(_0x13852c){_0x4df6b2[_0x27f4('0x46')]=_[_0x27f4('0x47')](db[_0x27f4('0x8d')][_0x27f4('0x43')]);_0x4df6b2[_0x27f4('0x4a')]=_[_0x27f4('0x47')](_0x58bef3[_0x27f4('0x4a')]);_0x4df6b2[_0x27f4('0x48')]=_[_0x27f4('0x49')](_0x4df6b2[_0x27f4('0x46')],_0x4df6b2['query']);_0x12ea23['attributes']=_[_0x27f4('0x49')](_0x4df6b2[_0x27f4('0x46')],qs[_0x27f4('0x4b')](_0x58bef3[_0x27f4('0x4a')][_0x27f4('0x4b')]));_0x12ea23[_0x27f4('0x4c')]=_0x12ea23[_0x27f4('0x4c')][_0x27f4('0x5a')]?_0x12ea23['attributes']:_0x4df6b2[_0x27f4('0x46')];if(!_0x58bef3[_0x27f4('0x4a')][_0x27f4('0x4d')](_0x27f4('0x4e'))){_0x12ea23[_0x27f4('0x31')]=qs['limit'](_0x58bef3[_0x27f4('0x4a')][_0x27f4('0x31')]);_0x12ea23[_0x27f4('0x33')]=qs[_0x27f4('0x33')](_0x58bef3[_0x27f4('0x4a')]['offset']);}_0x12ea23['order']=qs[_0x27f4('0x50')](_0x58bef3[_0x27f4('0x4a')][_0x27f4('0x50')]);_0x12ea23[_0x27f4('0x51')]=qs[_0x27f4('0x48')](_['pick'](_0x58bef3[_0x27f4('0x4a')],_0x4df6b2[_0x27f4('0x48')]));_0x12ea23['where']['OpenchannelAccountId']=_0x13852c['id'];if(_0x58bef3[_0x27f4('0x4a')][_0x27f4('0x54')]){_0x12ea23[_0x27f4('0x51')]=_['merge'](_0x12ea23[_0x27f4('0x51')],{'$or':_['map'](_0x12ea23[_0x27f4('0x4c')],function(_0x4eea82){var _0x53c07c={};_0x53c07c[_0x4eea82]={'$like':'%'+_0x58bef3['query'][_0x27f4('0x54')]+'%'};return _0x53c07c;})});}_0x12ea23=_[_0x27f4('0x52')]({},_0x12ea23,_0x58bef3['options']);return db[_0x27f4('0x8d')]['count']({'where':_0x12ea23[_0x27f4('0x51')]})[_0x27f4('0x21')](function(_0x455d19){_0x4b1d20[_0x27f4('0x32')]=_0x455d19;if(_0x58bef3['query'][_0x27f4('0x68')]){_0x12ea23['include']=[{'model':db[_0x27f4('0x72')],'as':_0x27f4('0xa8'),'required':![]},{'model':db[_0x27f4('0x98')],'as':_0x27f4('0xa9'),'attributes':['name',_0x27f4('0xaa'),_0x27f4('0xab')],'required':![]},{'model':db[_0x27f4('0xac')],'as':_0x27f4('0xad'),'attributes':['id',_0x27f4('0x3d'),_0x27f4('0xae')],'where':_0x58bef3[_0x27f4('0x4a')]['tag']?{'id':_0x58bef3[_0x27f4('0x4a')][_0x27f4('0xaf')]}:undefined,'required':_0x58bef3[_0x27f4('0x4a')][_0x27f4('0xaf')]?!![]:![]}];}return db[_0x27f4('0x8d')]['findAll'](_0x12ea23);})[_0x27f4('0x21')](function(_0x3d0719){_0x4b1d20[_0x27f4('0x58')]=_0x3d0719;return _0x4b1d20;});}})[_0x27f4('0x21')](respondWithFilteredResult(_0x1333de,_0x12ea23))[_0x27f4('0x2b')](handleError(_0x1333de,null));};exports[_0x27f4('0xb0')]=function(_0xe6cb3f,_0x3b0215,_0x529144){return db[_0x27f4('0x56')][_0x27f4('0x5e')]({'where':{'id':_0xe6cb3f[_0x27f4('0x62')]['id']}})[_0x27f4('0x21')](handleEntityNotFound(_0x3b0215,null))[_0x27f4('0x21')](function(_0x37fb13){if(_0x37fb13){return _0x37fb13[_0x27f4('0xb0')](_0xe6cb3f[_0x27f4('0x5c')][_0x27f4('0x6b')],_[_0x27f4('0xb1')](_0xe6cb3f[_0x27f4('0x5c')],[_0x27f4('0x6b'),'id'])||{})['spread'](function(_0x610893){for(var _0x3b750c=0x0;_0x3b750c<_0xe6cb3f[_0x27f4('0x5c')][_0x27f4('0x6b')]['length'];_0x3b750c+=0x1){socket[_0x27f4('0xb2')]('userOpenchannelAccount:save',{'UserId':Number(_0xe6cb3f[_0x27f4('0x5c')][_0x27f4('0x6b')][_0x3b750c]),'OpenchannelAccountId':Number(_0xe6cb3f[_0x27f4('0x62')]['id'])});}return _0x610893;});}})[_0x27f4('0x21')](respondWithResult(_0x3b0215,null))[_0x27f4('0x2b')](handleError(_0x3b0215,null));};exports[_0x27f4('0xb3')]=function(_0x318cd1,_0x26871f,_0x3db33b){return db[_0x27f4('0x56')][_0x27f4('0x5e')]({'where':{'id':_0x318cd1[_0x27f4('0x62')]['id']}})['then'](handleEntityNotFound(_0x26871f,null))[_0x27f4('0x21')](function(_0x25bac9){if(_0x25bac9){return _0x25bac9[_0x27f4('0xb3')](_0x318cd1[_0x27f4('0x4a')][_0x27f4('0x6b')])[_0x27f4('0x21')](function(){if(_[_0x27f4('0xb4')](_0x318cd1['query'][_0x27f4('0x6b')])){for(var _0x5970da=0x0;_0x5970da<_0x318cd1[_0x27f4('0x4a')][_0x27f4('0x6b')][_0x27f4('0x5a')];_0x5970da+=0x1){socket[_0x27f4('0xb2')](_0x27f4('0xb5'),{'UserId':Number(_0x318cd1[_0x27f4('0x4a')][_0x27f4('0x6b')][_0x5970da]),'OpenchannelAccountId':Number(_0x318cd1[_0x27f4('0x62')]['id'])});}}else{socket[_0x27f4('0xb2')](_0x27f4('0xb5'),{'UserId':Number(_0x318cd1[_0x27f4('0x4a')]['ids']),'OpenchannelAccountId':Number(_0x318cd1[_0x27f4('0x62')]['id'])});}});}})['then'](respondWithStatusCode(_0x26871f,null))['catch'](handleError(_0x26871f,null));};exports['getAgents']=function(_0x4431cd,_0x35bb3b,_0x1a571d){var _0x3d4e45={};var _0x38ce14={};var _0x34cec6;var _0xdbf11b;return db[_0x27f4('0x56')][_0x27f4('0x65')]({'where':{'id':_0x4431cd['params']['id']}})['then'](handleEntityNotFound(_0x35bb3b,null))[_0x27f4('0x21')](function(_0x1f5ba4){if(_0x1f5ba4){_0x34cec6=_0x1f5ba4;_0x38ce14[_0x27f4('0x46')]=_['keys'](db['User']['rawAttributes']);_0x38ce14[_0x27f4('0x4a')]=_[_0x27f4('0x47')](_0x4431cd['query']);_0x38ce14['filters']=_['intersection'](_0x38ce14[_0x27f4('0x46')],_0x38ce14['query']);_0x3d4e45['attributes']=_[_0x27f4('0x49')](_0x38ce14['model'],qs[_0x27f4('0x4b')](_0x4431cd[_0x27f4('0x4a')][_0x27f4('0x4b')]));_0x3d4e45[_0x27f4('0x4c')]=_0x3d4e45[_0x27f4('0x4c')][_0x27f4('0x5a')]?_0x3d4e45[_0x27f4('0x4c')]:_0x38ce14[_0x27f4('0x46')];_0x3d4e45[_0x27f4('0x4f')]=qs[_0x27f4('0x50')](_0x4431cd[_0x27f4('0x4a')][_0x27f4('0x50')]);_0x3d4e45['where']=qs[_0x27f4('0x48')](_[_0x27f4('0x67')](_0x4431cd['query'],_0x38ce14[_0x27f4('0x48')]));if(_0x4431cd[_0x27f4('0x4a')][_0x27f4('0x54')]){_0x3d4e45['where']=_[_0x27f4('0x52')](_0x3d4e45[_0x27f4('0x51')],{'$or':_['map'](_0x3d4e45[_0x27f4('0x4c')],function(_0x52eedc){var _0x86c18d={};_0x86c18d[_0x52eedc]={'$like':'%'+_0x4431cd['query']['filter']+'%'};return _0x86c18d;})});}_0x3d4e45=_[_0x27f4('0x52')]({},_0x3d4e45,_0x4431cd[_0x27f4('0x55')]);return _0x34cec6[_0x27f4('0xb6')](_0x3d4e45);}})['then'](function(_0x4b603a){if(_0x4b603a){_0xdbf11b=_0x4b603a[_0x27f4('0x5a')];if(!_0x4431cd[_0x27f4('0x4a')][_0x27f4('0x4d')](_0x27f4('0x4e'))){_0x3d4e45[_0x27f4('0x31')]=qs[_0x27f4('0x31')](_0x4431cd[_0x27f4('0x4a')][_0x27f4('0x31')]);_0x3d4e45[_0x27f4('0x33')]=qs[_0x27f4('0x33')](_0x4431cd[_0x27f4('0x4a')][_0x27f4('0x33')]);}return _0x34cec6[_0x27f4('0xb6')](_0x3d4e45);}})[_0x27f4('0x21')](function(_0x37bd87){if(_0x37bd87){return _0x37bd87?{'count':_0xdbf11b,'rows':_0x37bd87}:null;}})[_0x27f4('0x21')](respondWithResult(_0x35bb3b,null))[_0x27f4('0x2b')](handleError(_0x35bb3b,null));};exports[_0x27f4('0x3e')]=function(_0x3ca1aa,_0x180284,_0xe1309c){var _0x29af38,_0x21f582,_0x456230;if(_['isNil'](_0x3ca1aa[_0x27f4('0x5c')]['body'])||_0x3ca1aa[_0x27f4('0x5c')][_0x27f4('0x5c')]===''){throw new db[(_0x27f4('0x73'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x27f4('0x79')](_0x3ca1aa[_0x27f4('0x5c')]['to'])){}_0x29af38=_0x3ca1aa[_0x27f4('0x5c')]['to'];return db[_0x27f4('0x56')]['findOne']({'where':{'id':_0x3ca1aa['params']['id']}})[_0x27f4('0x21')](handleEntityNotFound(_0x180284,null))['then'](function(_0x5a2476){if(_0x5a2476){return db[_0x27f4('0x56')][_0x27f4('0x5e')]({'where':{'id':_0x5a2476['id']},'include':[{'model':db[_0x27f4('0x7f')],'as':_0x27f4('0x80'),'include':[{'model':db[_0x27f4('0x72')],'as':_0x27f4('0x81'),'where':{[_0x5a2476[_0x27f4('0x7d')]]:_0x29af38},'limit':0x1,'order':[[_0x27f4('0x77'),'DESC']]}]}]})[_0x27f4('0x21')](handleEntityNotFound(_0x180284,null))['then'](function(_0x889f4e){if(_0x889f4e&&_0x889f4e[_0x27f4('0x80')]){_0x21f582=_0x889f4e[_0x27f4('0x38')]({'plain':!![]});if(_0x21f582[_0x27f4('0x80')]&&_0x21f582['List']['Contacts'][_0x27f4('0x5a')]){return _0x21f582[_0x27f4('0x80')][_0x27f4('0x81')][0x0];}return db['CmContact'][_0x27f4('0x5b')](_[_0x27f4('0x19')](_0x3ca1aa[_0x27f4('0x5c')],{'firstName':_0x29af38,[_0x889f4e['mapKey']]:_0x29af38,'phone':_0x29af38,'ListId':_0x21f582[_0x27f4('0x78')]}));}})[_0x27f4('0x21')](handleEntityNotFound(_0x180284,null))[_0x27f4('0x21')](function(_0x2a0061){if(_0x2a0061){_0x456230=_0x2a0061;return db['OpenchannelInteraction'][_0x27f4('0x5e')]({'where':{'ContactId':_0x456230['id'],'closed':![],'OpenchannelAccountId':_0x21f582['id']}})[_0x27f4('0x21')](function(_0x2e97fa){if(_0x2e97fa){return[_0x2e97fa,![]];}return db['OpenchannelInteraction'][_0x27f4('0x5b')]({'UserId':_0x3ca1aa[_0x27f4('0xb7')]['id'],'ContactId':_0x456230['id'],'OpenchannelAccountId':_0x21f582['id'],'lastMsgDirection':_0x27f4('0xb8'),'firstMsgDirection':_0x27f4('0xb8'),'Messages':[_[_0x27f4('0x52')](_0x3ca1aa['body'],{'read':![],'body':_0x3ca1aa['body']['body'],'OpenchannelAccountId':_0x21f582['id'],'UserId':_0x3ca1aa[_0x27f4('0xb7')]['id'],'ContactId':_0x456230['id']})]},{'include':[{'model':db[_0x27f4('0x95')],'as':_0x27f4('0xb9')}]})['then'](function(_0x39db29){return[_0x39db29,!![]];});});}})[_0x27f4('0x8f')](function(_0x4e5847,_0x1c259d){if(_0x1c259d){return _0x4e5847;}return db[_0x27f4('0x95')][_0x27f4('0x5b')](_[_0x27f4('0x52')](_0x3ca1aa[_0x27f4('0x5c')],{'read':![],'body':_0x3ca1aa[_0x27f4('0x5c')]['body'],'OpenchannelAccountId':_0x21f582['id'],'OpenchannelInteractionId':_0x4e5847['id'],'UserId':_0x3ca1aa['user']['id'],'ContactId':_0x456230['id']}))[_0x27f4('0x21')](function(_0x4c9db9){_0x4e5847[_0x27f4('0xba')][_0x27f4('0xb9')]=[];_0x4e5847[_0x27f4('0xba')][_0x27f4('0xb9')][_0x27f4('0xbb')](_0x4c9db9[_0x27f4('0xba')]);return _0x4e5847;});});}})[_0x27f4('0x21')](respondWithResult(_0x180284,null))['catch'](handleError(_0x180284,null));}; \ No newline at end of file +var _0xc831=['OpenchannelApplication','Applications','account','applications','list','orderBy','priority','asc','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','User','UserId','unshift','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','internal','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','DESC','out','Messages','dataValues','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','end','sendStatus','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','nolimit','findAll','removeDispositions','ids','addAnswer','CannedAnswer','order','removeAnswers','notify','openchannel','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','isNil','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','List','CmContact','Contacts'];(function(_0x52a6e3,_0x4a73b4){var _0x8910d0=function(_0x57e5ef){while(--_0x57e5ef){_0x52a6e3['push'](_0x52a6e3['shift']());}};_0x8910d0(++_0x4a73b4);}(_0xc831,0x103));var _0x1c83=function(_0x2a4b89,_0xc626dc){_0x2a4b89=_0x2a4b89-0x0;var _0x5a62e4=_0xc831[_0x2a4b89];return _0x5a62e4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1c83('0x0'));var zipdir=require(_0x1c83('0x1'));var jsonpatch=require(_0x1c83('0x2'));var rp=require(_0x1c83('0x3'));var moment=require(_0x1c83('0x4'));var BPromise=require(_0x1c83('0x5'));var Mustache=require(_0x1c83('0x6'));var util=require(_0x1c83('0x7'));var path=require(_0x1c83('0x8'));var sox=require(_0x1c83('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1c83('0xa'));var _=require('lodash');var squel=require(_0x1c83('0xb'));var crypto=require(_0x1c83('0xc'));var jsforce=require(_0x1c83('0xd'));var deskjs=require(_0x1c83('0xe'));var toCsv=require(_0x1c83('0xf'));var querystring=require('querystring');var Papa=require(_0x1c83('0x10'));var Redis=require(_0x1c83('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1c83('0x12'));var hardwareService=require(_0x1c83('0x13'));var logger=require(_0x1c83('0x14'))('api');var utils=require(_0x1c83('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1c83('0x16'))['db'];config[_0x1c83('0x17')]=_[_0x1c83('0x18')](config[_0x1c83('0x17')],{'host':_0x1c83('0x19'),'port':0x18eb});var socket=require(_0x1c83('0x1a'))(new Redis(config[_0x1c83('0x17')]));require('./openchannelAccount.socket')[_0x1c83('0x1b')](socket);var jayson=require(_0x1c83('0x1c'));var client=jayson[_0x1c83('0x1d')][_0x1c83('0x1e')]({'port':0x232c});var client9002=jayson[_0x1c83('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11acf1,_0x18a06d,_0x179906,_0x441a5e){return new BPromise(function(_0x596a69,_0x21b04c){var _0x4a5025=_0x441a5e||client;return _0x4a5025['request'](_0x11acf1,_0x179906)[_0x1c83('0x1f')](function(_0x1d6027){logger[_0x1c83('0x20')](_0x1c83('0x21'),_0x18a06d,'request\x20sent');logger[_0x1c83('0x22')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x18a06d,_0x1c83('0x23'),JSON[_0x1c83('0x24')](_0x1d6027));if(_0x1d6027['error']){if(_0x1d6027[_0x1c83('0x25')][_0x1c83('0x26')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x18a06d,_0x1d6027[_0x1c83('0x25')]['message']);return _0x21b04c(_0x1d6027['error'][_0x1c83('0x27')]);}logger[_0x1c83('0x25')](_0x1c83('0x21'),_0x18a06d,_0x1d6027['error'][_0x1c83('0x27')]);return _0x596a69(_0x1d6027[_0x1c83('0x25')][_0x1c83('0x27')]);}else{logger['info'](_0x1c83('0x21'),_0x18a06d,'request\x20sent');_0x596a69(_0x1d6027[_0x1c83('0x28')][_0x1c83('0x27')]);}})[_0x1c83('0x29')](function(_0x1096ed){logger[_0x1c83('0x25')](_0x1c83('0x21'),_0x18a06d,_0x1096ed);_0x21b04c(_0x1096ed);});});}function respondWithStatusCode(_0x11baa6,_0x2beb2b){_0x2beb2b=_0x2beb2b||0xcc;return function(_0x2ed4a3){if(_0x2ed4a3){return _0x11baa6['sendStatus'](_0x2beb2b);}return _0x11baa6[_0x1c83('0x2a')](_0x2beb2b)['end']();};}function respondWithResult(_0x354cdf,_0x4ef78a){_0x4ef78a=_0x4ef78a||0xc8;return function(_0x2ac671){if(_0x2ac671){return _0x354cdf[_0x1c83('0x2a')](_0x4ef78a)[_0x1c83('0x2b')](_0x2ac671);}};}function respondWithFilteredResult(_0x341d8d,_0x3c027b){return function(_0x282df2){if(_0x282df2){var _0x2671a9=typeof _0x3c027b[_0x1c83('0x2c')]===_0x1c83('0x2d')&&typeof _0x3c027b['limit']===_0x1c83('0x2d');var _0x56cd77=_0x282df2['count'];var _0x3e9814=_0x2671a9?0x0:_0x3c027b[_0x1c83('0x2c')];var _0x39f492=_0x2671a9?_0x282df2[_0x1c83('0x2e')]:_0x3c027b[_0x1c83('0x2c')]+_0x3c027b[_0x1c83('0x2f')];var _0x1e96fb;if(_0x39f492>=_0x56cd77){_0x39f492=_0x56cd77;_0x1e96fb=0xc8;}else{_0x1e96fb=0xce;}_0x341d8d[_0x1c83('0x2a')](_0x1e96fb);return _0x341d8d['set'](_0x1c83('0x30'),_0x3e9814+'-'+_0x39f492+'/'+_0x56cd77)[_0x1c83('0x2b')](_0x282df2);}return null;};}function patchUpdates(_0x206e6d){return function(_0x152b17){try{jsonpatch[_0x1c83('0x31')](_0x152b17,_0x206e6d,!![]);}catch(_0x5735b6){return BPromise[_0x1c83('0x32')](_0x5735b6);}return _0x152b17[_0x1c83('0x33')]();};}function saveUpdates(_0x31b14d,_0x4cbe0c){return function(_0x3dd2de){if(_0x3dd2de){return _0x3dd2de[_0x1c83('0x34')](_0x31b14d)[_0x1c83('0x1f')](function(_0x1f00ab){return _0x1f00ab;});}return null;};}function removeEntity(_0x31f9fd,_0x9d9670){return function(_0x21a75d){if(_0x21a75d){return _0x21a75d[_0x1c83('0x35')]()[_0x1c83('0x1f')](function(){var _0x579105=_0x21a75d[_0x1c83('0x36')]({'plain':!![]});var _0x77da35=_0x1c83('0x37');return db[_0x1c83('0x38')][_0x1c83('0x35')]({'where':{'type':_0x77da35,'resourceId':_0x579105['id']}})['then'](function(){return _0x21a75d;});})['then'](function(){_0x31f9fd['status'](0xcc)[_0x1c83('0x39')]();});}};}function handleEntityNotFound(_0x498dc5,_0x67bfdd){return function(_0x3a52c6){if(!_0x3a52c6){_0x498dc5[_0x1c83('0x3a')](0x194);}return _0x3a52c6;};}function handleError(_0x1b372f,_0x2e7916){_0x2e7916=_0x2e7916||0x1f4;return function(_0x4ed578){logger['error'](_0x4ed578['stack']);if(_0x4ed578[_0x1c83('0x3b')]){delete _0x4ed578[_0x1c83('0x3b')];}_0x1b372f[_0x1c83('0x2a')](_0x2e7916)[_0x1c83('0x3c')](_0x4ed578);};}exports[_0x1c83('0x3d')]=function(_0x1c8283,_0x24d8c5){var _0x590d6a={'include':[{'model':db[_0x1c83('0x3e')],'as':_0x1c83('0x3f')}]},_0x5a4584={},_0x2d80bc={'count':0x0,'rows':[]};var _0x267988=_[_0x1c83('0x40')](db[_0x1c83('0x41')][_0x1c83('0x42')],function(_0x4c1144){return{'name':_0x4c1144[_0x1c83('0x43')],'type':_0x4c1144[_0x1c83('0x44')][_0x1c83('0x45')]};});_0x5a4584[_0x1c83('0x46')]=_[_0x1c83('0x40')](_0x267988,_0x1c83('0x3b'));_0x5a4584[_0x1c83('0x47')]=_[_0x1c83('0x48')](_0x1c8283[_0x1c83('0x47')]);_0x5a4584[_0x1c83('0x49')]=_[_0x1c83('0x4a')](_0x5a4584[_0x1c83('0x46')],_0x5a4584[_0x1c83('0x47')]);_0x590d6a[_0x1c83('0x4b')]=_['intersection'](_0x5a4584[_0x1c83('0x46')],qs[_0x1c83('0x4c')](_0x1c8283['query'][_0x1c83('0x4c')]));_0x590d6a[_0x1c83('0x4b')]=_0x590d6a[_0x1c83('0x4b')][_0x1c83('0x4d')]?_0x590d6a[_0x1c83('0x4b')]:_0x5a4584[_0x1c83('0x46')];if(!_0x1c8283[_0x1c83('0x47')][_0x1c83('0x4e')]('nolimit')){_0x590d6a[_0x1c83('0x2f')]=qs[_0x1c83('0x2f')](_0x1c8283[_0x1c83('0x47')][_0x1c83('0x2f')]);_0x590d6a[_0x1c83('0x2c')]=qs[_0x1c83('0x2c')](_0x1c8283[_0x1c83('0x47')][_0x1c83('0x2c')]);}_0x590d6a['order']=qs['sort'](_0x1c8283[_0x1c83('0x47')][_0x1c83('0x4f')]);_0x590d6a[_0x1c83('0x50')]=qs[_0x1c83('0x49')](_[_0x1c83('0x51')](_0x1c8283['query'],_0x5a4584[_0x1c83('0x49')]),_0x267988);if(_0x1c8283['query']['filter']){_0x590d6a['where']=_[_0x1c83('0x52')](_0x590d6a['where'],{'$or':_[_0x1c83('0x40')](_0x267988,function(_0x1a9034){if(_0x1a9034[_0x1c83('0x44')]!==_0x1c83('0x53')){var _0x274ee1={};_0x274ee1[_0x1a9034[_0x1c83('0x3b')]]={'$like':'%'+_0x1c8283[_0x1c83('0x47')][_0x1c83('0x54')]+'%'};return _0x274ee1;}})});}_0x590d6a=_['merge']({},_0x590d6a,_0x1c8283[_0x1c83('0x55')]);var _0x2421d3={'where':_0x590d6a[_0x1c83('0x50')]};return db[_0x1c83('0x41')][_0x1c83('0x2e')](_0x2421d3)['then'](function(_0x56f853){_0x2d80bc[_0x1c83('0x2e')]=_0x56f853;if(_0x1c8283[_0x1c83('0x47')][_0x1c83('0x56')]){_0x590d6a[_0x1c83('0x57')]=[{'all':!![]}];}return db[_0x1c83('0x41')]['findAll'](_0x590d6a);})[_0x1c83('0x1f')](function(_0x901dc5){_0x2d80bc[_0x1c83('0x58')]=_0x901dc5;return _0x2d80bc;})['then'](respondWithFilteredResult(_0x24d8c5,_0x590d6a))[_0x1c83('0x29')](handleError(_0x24d8c5,null));};exports[_0x1c83('0x59')]=function(_0x2aa850,_0x1500dd){var _0x409e85={'raw':![],'where':{'id':_0x2aa850[_0x1c83('0x5a')]['id']},'include':[{'model':db[_0x1c83('0x3e')],'as':'mandatoryDispositionPause'}]},_0xca58e6={};_0xca58e6[_0x1c83('0x46')]=_[_0x1c83('0x48')](db[_0x1c83('0x41')]['rawAttributes']);_0xca58e6['query']=_['keys'](_0x2aa850[_0x1c83('0x47')]);_0xca58e6[_0x1c83('0x49')]=_['intersection'](_0xca58e6[_0x1c83('0x46')],_0xca58e6[_0x1c83('0x47')]);_0x409e85[_0x1c83('0x4b')]=_[_0x1c83('0x4a')](_0xca58e6[_0x1c83('0x46')],qs[_0x1c83('0x4c')](_0x2aa850[_0x1c83('0x47')][_0x1c83('0x4c')]));_0x409e85[_0x1c83('0x4b')]=_0x409e85[_0x1c83('0x4b')]['length']?_0x409e85['attributes']:_0xca58e6[_0x1c83('0x46')];if(_0x2aa850['query']['includeAll']){_0x409e85[_0x1c83('0x57')]=[{'all':!![]}];}_0x409e85=_[_0x1c83('0x52')]({},_0x409e85,_0x2aa850['options']);return db[_0x1c83('0x41')][_0x1c83('0x5b')](_0x409e85)[_0x1c83('0x1f')](handleEntityNotFound(_0x1500dd,null))['then'](respondWithResult(_0x1500dd,null))[_0x1c83('0x29')](handleError(_0x1500dd,null));};exports[_0x1c83('0x5c')]=function(_0x12305f,_0x3e0a94){return db['OpenchannelAccount']['create'](_0x12305f[_0x1c83('0x5d')],{})[_0x1c83('0x1f')](function(_0x156983){var _0x1fd85f=_0x12305f['user']['get']({'plain':!![]});if(!_0x1fd85f)throw new Error(_0x1c83('0x5e'));if(_0x1fd85f['role']===_0x1c83('0x5f')){var _0x4992d2=_0x156983[_0x1c83('0x36')]({'plain':!![]});var _0x3ca02d='OpenchannelAccounts';return db['UserProfileSection'][_0x1c83('0x5b')]({'where':{'name':_0x3ca02d,'userProfileId':_0x1fd85f[_0x1c83('0x60')]},'raw':!![]})[_0x1c83('0x1f')](function(_0x71d64e){if(_0x71d64e&&_0x71d64e[_0x1c83('0x61')]===0x0){return db['UserProfileResource'][_0x1c83('0x5c')]({'name':_0x4992d2[_0x1c83('0x3b')],'resourceId':_0x4992d2['id'],'type':_0x71d64e[_0x1c83('0x3b')],'sectionId':_0x71d64e['id']},{})[_0x1c83('0x1f')](function(){return _0x156983;});}else{return _0x156983;}})[_0x1c83('0x29')](function(_0x489e2e){logger[_0x1c83('0x25')](_0x1c83('0x62'),_0x489e2e);throw _0x489e2e;});}return _0x156983;})[_0x1c83('0x1f')](respondWithResult(_0x3e0a94,0xc9))[_0x1c83('0x29')](handleError(_0x3e0a94,null));};exports['update']=function(_0x409313,_0x3428cd){if(_0x409313[_0x1c83('0x5d')]['id']){delete _0x409313[_0x1c83('0x5d')]['id'];}return db[_0x1c83('0x41')]['find']({'where':{'id':_0x409313[_0x1c83('0x5a')]['id']},'include':[{'model':db[_0x1c83('0x3e')],'as':_0x1c83('0x3f')}]})[_0x1c83('0x1f')](handleEntityNotFound(_0x3428cd,null))[_0x1c83('0x1f')](saveUpdates(_0x409313[_0x1c83('0x5d')],null))[_0x1c83('0x1f')](respondWithResult(_0x3428cd,null))['catch'](handleError(_0x3428cd,null));};exports[_0x1c83('0x35')]=function(_0x5c126f,_0x44b8a6){return db['OpenchannelAccount']['find']({'where':{'id':_0x5c126f[_0x1c83('0x5a')]['id']}})['then'](handleEntityNotFound(_0x44b8a6,null))[_0x1c83('0x1f')](removeEntity(_0x44b8a6,null))[_0x1c83('0x29')](handleError(_0x44b8a6,null));};exports[_0x1c83('0x63')]=function(_0x26b11e,_0x511043){return db[_0x1c83('0x41')][_0x1c83('0x63')]()[_0x1c83('0x1f')](respondWithResult(_0x511043,null))[_0x1c83('0x29')](handleError(_0x511043,null));};exports['addDisposition']=function(_0x5f91b1,_0x41424b,_0x2b0bcb){if(_0x5f91b1[_0x1c83('0x5d')]['id']){delete _0x5f91b1[_0x1c83('0x5d')]['id'];}return db[_0x1c83('0x41')][_0x1c83('0x5b')]({'where':{'id':_0x5f91b1['params']['id']}})[_0x1c83('0x1f')](handleEntityNotFound(_0x41424b,null))[_0x1c83('0x1f')](function(_0x14c225){if(_0x14c225){_0x5f91b1[_0x1c83('0x5d')][_0x1c83('0x64')]=_0x14c225['id'];return db[_0x1c83('0x65')][_0x1c83('0x5c')](_0x5f91b1[_0x1c83('0x5d')]);}})[_0x1c83('0x1f')](respondWithResult(_0x41424b,null))['catch'](handleError(_0x41424b,null));};exports[_0x1c83('0x66')]=function(_0x468fc1,_0x165f30,_0x53e331){var _0x526e3c={'raw':![],'where':{}};var _0x9a08f7={};var _0x44f2b3={'count':0x0,'rows':[]};return db[_0x1c83('0x41')][_0x1c83('0x67')]({'where':{'id':_0x468fc1['params']['id']}})['then'](handleEntityNotFound(_0x165f30,null))['then'](function(_0x8ddae2){if(_0x8ddae2){_0x9a08f7[_0x1c83('0x46')]=_[_0x1c83('0x48')](db[_0x1c83('0x65')]['rawAttributes']);_0x9a08f7[_0x1c83('0x47')]=_[_0x1c83('0x48')](_0x468fc1[_0x1c83('0x47')]);_0x9a08f7[_0x1c83('0x49')]=_['intersection'](_0x9a08f7[_0x1c83('0x46')],_0x9a08f7[_0x1c83('0x47')]);_0x526e3c[_0x1c83('0x4b')]=_[_0x1c83('0x4a')](_0x9a08f7[_0x1c83('0x46')],qs[_0x1c83('0x4c')](_0x468fc1['query'][_0x1c83('0x4c')]));_0x526e3c[_0x1c83('0x4b')]=_0x526e3c[_0x1c83('0x4b')]['length']?_0x526e3c[_0x1c83('0x4b')]:_0x9a08f7[_0x1c83('0x46')];if(!_0x468fc1[_0x1c83('0x47')][_0x1c83('0x4e')](_0x1c83('0x68'))){_0x526e3c[_0x1c83('0x2f')]=qs['limit'](_0x468fc1[_0x1c83('0x47')][_0x1c83('0x2f')]);_0x526e3c['offset']=qs[_0x1c83('0x2c')](_0x468fc1[_0x1c83('0x47')][_0x1c83('0x2c')]);}_0x526e3c['order']=qs['sort'](_0x468fc1['query']['sort']);_0x526e3c['where']=qs[_0x1c83('0x49')](_['pick'](_0x468fc1[_0x1c83('0x47')],_0x9a08f7[_0x1c83('0x49')]));_0x526e3c[_0x1c83('0x50')][_0x1c83('0x64')]=_0x8ddae2['id'];if(_0x468fc1['query']['filter']){_0x526e3c[_0x1c83('0x50')]=_['merge'](_0x526e3c['where'],{'$or':_['map'](_0x526e3c[_0x1c83('0x4b')],function(_0x2fa45e){var _0x1d3593={};_0x1d3593[_0x2fa45e]={'$like':'%'+_0x468fc1[_0x1c83('0x47')][_0x1c83('0x54')]+'%'};return _0x1d3593;})});}_0x526e3c=_[_0x1c83('0x52')]({},_0x526e3c,_0x468fc1[_0x1c83('0x55')]);return db[_0x1c83('0x65')][_0x1c83('0x2e')]({'where':_0x526e3c['where']})['then'](function(_0x1321b0){_0x44f2b3[_0x1c83('0x2e')]=_0x1321b0;if(_0x468fc1[_0x1c83('0x47')][_0x1c83('0x56')]){_0x526e3c[_0x1c83('0x57')]=[{'all':!![]}];}return db[_0x1c83('0x65')][_0x1c83('0x69')](_0x526e3c);})[_0x1c83('0x1f')](function(_0x3dcc6a){_0x44f2b3[_0x1c83('0x58')]=_0x3dcc6a;return _0x44f2b3;});}})[_0x1c83('0x1f')](respondWithFilteredResult(_0x165f30,_0x526e3c))[_0x1c83('0x29')](handleError(_0x165f30,null));};exports[_0x1c83('0x6a')]=function(_0x25549a,_0x34c790,_0x41e177){return db[_0x1c83('0x41')]['find']({'where':{'id':_0x25549a[_0x1c83('0x5a')]['id']}})[_0x1c83('0x1f')](handleEntityNotFound(_0x34c790,null))[_0x1c83('0x1f')](function(_0xcbbaf4){if(_0xcbbaf4){return _0xcbbaf4[_0x1c83('0x6a')](_0x25549a[_0x1c83('0x47')][_0x1c83('0x6b')]);}})[_0x1c83('0x1f')](respondWithStatusCode(_0x34c790,null))[_0x1c83('0x29')](handleError(_0x34c790,null));};exports[_0x1c83('0x6c')]=function(_0x564559,_0x2d0db0,_0x427345){if(_0x564559[_0x1c83('0x5d')]['id']){delete _0x564559[_0x1c83('0x5d')]['id'];}return db['OpenchannelAccount'][_0x1c83('0x5b')]({'where':{'id':_0x564559[_0x1c83('0x5a')]['id']}})[_0x1c83('0x1f')](handleEntityNotFound(_0x2d0db0,null))[_0x1c83('0x1f')](function(_0x4b2400){if(_0x4b2400){_0x564559[_0x1c83('0x5d')][_0x1c83('0x64')]=_0x4b2400['id'];return db[_0x1c83('0x6d')][_0x1c83('0x5c')](_0x564559[_0x1c83('0x5d')]);}})[_0x1c83('0x1f')](respondWithResult(_0x2d0db0,null))[_0x1c83('0x29')](handleError(_0x2d0db0,null));};exports['getAnswers']=function(_0x2c6abd,_0x547e82,_0x485908){var _0x30a9c3={'raw':![],'where':{}};var _0x4ac907={};var _0x138287={'count':0x0,'rows':[]};return db[_0x1c83('0x41')]['findOne']({'where':{'id':_0x2c6abd['params']['id']}})[_0x1c83('0x1f')](handleEntityNotFound(_0x547e82,null))[_0x1c83('0x1f')](function(_0x2b6c18){if(_0x2b6c18){_0x4ac907[_0x1c83('0x46')]=_[_0x1c83('0x48')](db[_0x1c83('0x6d')][_0x1c83('0x42')]);_0x4ac907[_0x1c83('0x47')]=_['keys'](_0x2c6abd[_0x1c83('0x47')]);_0x4ac907[_0x1c83('0x49')]=_[_0x1c83('0x4a')](_0x4ac907[_0x1c83('0x46')],_0x4ac907[_0x1c83('0x47')]);_0x30a9c3[_0x1c83('0x4b')]=_[_0x1c83('0x4a')](_0x4ac907[_0x1c83('0x46')],qs[_0x1c83('0x4c')](_0x2c6abd[_0x1c83('0x47')][_0x1c83('0x4c')]));_0x30a9c3['attributes']=_0x30a9c3[_0x1c83('0x4b')][_0x1c83('0x4d')]?_0x30a9c3[_0x1c83('0x4b')]:_0x4ac907['model'];if(!_0x2c6abd['query'][_0x1c83('0x4e')](_0x1c83('0x68'))){_0x30a9c3[_0x1c83('0x2f')]=qs[_0x1c83('0x2f')](_0x2c6abd[_0x1c83('0x47')]['limit']);_0x30a9c3[_0x1c83('0x2c')]=qs[_0x1c83('0x2c')](_0x2c6abd[_0x1c83('0x47')][_0x1c83('0x2c')]);}_0x30a9c3[_0x1c83('0x6e')]=qs[_0x1c83('0x4f')](_0x2c6abd[_0x1c83('0x47')][_0x1c83('0x4f')]);_0x30a9c3[_0x1c83('0x50')]=qs['filters'](_[_0x1c83('0x51')](_0x2c6abd[_0x1c83('0x47')],_0x4ac907['filters']));_0x30a9c3[_0x1c83('0x50')][_0x1c83('0x64')]=_0x2b6c18['id'];if(_0x2c6abd[_0x1c83('0x47')]['filter']){_0x30a9c3[_0x1c83('0x50')]=_[_0x1c83('0x52')](_0x30a9c3['where'],{'$or':_[_0x1c83('0x40')](_0x30a9c3[_0x1c83('0x4b')],function(_0x1cf313){var _0x401b0e={};_0x401b0e[_0x1cf313]={'$like':'%'+_0x2c6abd[_0x1c83('0x47')][_0x1c83('0x54')]+'%'};return _0x401b0e;})});}_0x30a9c3=_[_0x1c83('0x52')]({},_0x30a9c3,_0x2c6abd['options']);return db[_0x1c83('0x6d')][_0x1c83('0x2e')]({'where':_0x30a9c3['where']})[_0x1c83('0x1f')](function(_0x4eb7df){_0x138287[_0x1c83('0x2e')]=_0x4eb7df;if(_0x2c6abd[_0x1c83('0x47')]['includeAll']){_0x30a9c3[_0x1c83('0x57')]=[{'all':!![]}];}return db[_0x1c83('0x6d')][_0x1c83('0x69')](_0x30a9c3);})[_0x1c83('0x1f')](function(_0x31f64f){_0x138287[_0x1c83('0x58')]=_0x31f64f;return _0x138287;});}})[_0x1c83('0x1f')](respondWithFilteredResult(_0x547e82,_0x30a9c3))[_0x1c83('0x29')](handleError(_0x547e82,null));};exports[_0x1c83('0x6f')]=function(_0x1d058c,_0x11a0e9,_0xf0d96e){return db[_0x1c83('0x41')][_0x1c83('0x5b')]({'where':{'id':_0x1d058c[_0x1c83('0x5a')]['id']}})[_0x1c83('0x1f')](handleEntityNotFound(_0x11a0e9,null))[_0x1c83('0x1f')](function(_0x5d7e8c){if(_0x5d7e8c){return _0x5d7e8c[_0x1c83('0x6f')](_0x1d058c[_0x1c83('0x47')]['ids']);}})['then'](respondWithStatusCode(_0x11a0e9,null))[_0x1c83('0x29')](handleError(_0x11a0e9,null));};exports[_0x1c83('0x70')]=function(_0xb409f,_0x6278e7,_0x1d5e4d){var _0x15c14e={'body':_0xb409f['body'],'channel':_0x1c83('0x71')};var _0x21f041=[];var _0x4acbd4=[];var _0x46e5d3={};var _0xc7ce36=![];return db['CmContact'][_0x1c83('0x63')]()[_0x1c83('0x1f')](function(_0x2d803a){if(!_0x2d803a){throw new db[(_0x1c83('0x72'))][(_0x1c83('0x73'))](_0x1c83('0x74'));}_0x21f041=_[_0x1c83('0x75')](_['keys'](_0x2d803a),[_0x1c83('0x76'),'updatedAt']);_0x4acbd4=_[_0x1c83('0x75')](_[_0x1c83('0x48')](_0x2d803a),['createdAt',_0x1c83('0x77'),_0x1c83('0x78'),_0x1c83('0x79')]);if(_0xb409f[_0x1c83('0x5d')]['id']){delete _0xb409f[_0x1c83('0x5d')]['id'];}if(_['isNil'](_0xb409f[_0x1c83('0x5d')][_0x1c83('0x7a')])){throw new db[(_0x1c83('0x72'))]['ValidationError'](_0x1c83('0x7b'));}if(_[_0x1c83('0x7c')](_0xb409f[_0x1c83('0x5d')]['body'])||_0xb409f[_0x1c83('0x5d')][_0x1c83('0x5d')]===''){throw new db[(_0x1c83('0x72'))][(_0x1c83('0x73'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x1c83('0x7c')](_0xb409f[_0x1c83('0x5d')]['mapKey'])){throw new db[(_0x1c83('0x72'))][(_0x1c83('0x73'))](_0x1c83('0x7d')+_0x4acbd4);}if(!_[_0x1c83('0x7e')](_0x4acbd4,_0xb409f[_0x1c83('0x5d')]['mapKey'])){throw new db[(_0x1c83('0x72'))][(_0x1c83('0x73'))](_0x1c83('0x7f')+_0x4acbd4);}_0x46e5d3[_0xb409f['body'][_0x1c83('0x80')]]=_0xb409f[_0x1c83('0x5d')][_0x1c83('0x7a')];})[_0x1c83('0x1f')](function(){return db[_0x1c83('0x41')][_0x1c83('0x5b')]({'where':{'id':_0xb409f[_0x1c83('0x5a')]['id']},'include':[{'model':db[_0x1c83('0x81')],'as':_0x1c83('0x82'),'include':[{'model':db[_0x1c83('0x83')],'as':_0x1c83('0x84'),'where':_0x46e5d3,'limit':0x1,'order':[[_0x1c83('0x77'),'DESC']]}]},{'model':db[_0x1c83('0x85')],'as':_0x1c83('0x86')}]});})['then'](handleEntityNotFound(_0x6278e7,null))[_0x1c83('0x1f')](function(_0x50b942){if(_0x50b942&&_0x50b942[_0x1c83('0x82')]){_0x15c14e[_0x1c83('0x87')]=_0x50b942;_0x15c14e[_0x1c83('0x88')]=_0x50b942[_0x1c83('0x86')];_0x15c14e[_0x1c83('0x89')]=_0x50b942['List'];_0x15c14e[_0x1c83('0x88')]=_[_0x1c83('0x8a')](_0x15c14e['applications'],[_0x1c83('0x8b')],[_0x1c83('0x8c')]);if(_0x15c14e[_0x1c83('0x87')]['Applications']){delete _0x15c14e[_0x1c83('0x87')][_0x1c83('0x86')];}if(_0x15c14e[_0x1c83('0x87')][_0x1c83('0x82')]&&_0x15c14e[_0x1c83('0x87')][_0x1c83('0x82')][_0x1c83('0x84')][_0x1c83('0x4d')]){return _0x15c14e['account'][_0x1c83('0x82')][_0x1c83('0x84')][0x0];}var _0x45cd35=_[_0x1c83('0x18')](_0xb409f['body'],{'firstName':_0xb409f[_0x1c83('0x5d')][_0x1c83('0x7a')],'ListId':_0x50b942[_0x1c83('0x79')]});_0x45cd35[_0xb409f['body']['mapKey']]=_0xb409f[_0x1c83('0x5d')][_0x1c83('0x7a')];return db[_0x1c83('0x83')][_0x1c83('0x5c')](_0x45cd35,{'fields':_0x21f041,'raw':!![]});}})[_0x1c83('0x1f')](handleEntityNotFound(_0x6278e7,null))[_0x1c83('0x1f')](function(_0x2be478){_0x15c14e[_0x1c83('0x8d')]=_0x2be478;if(_0x2be478){var _0x4bb096={'ContactId':_0x2be478['id'],'OpenchannelAccountId':_0xb409f['params']['id'],'from':(_0x2be478[_0x1c83('0x8e')]||'')+'\x20'+(_0x2be478[_0x1c83('0x8f')]||'')};var _0x5ba1be={'OpenchannelAccountId':_0xb409f[_0x1c83('0x5a')]['id'],'closed':![]};if(_0xb409f['body']['threadId']){_0x5ba1be[_0x1c83('0x90')]=_0xb409f[_0x1c83('0x5d')]['threadId'];return db[_0x1c83('0x91')]['find']({'where':_0x5ba1be})['then'](function(_0x5c06c2){if(_0x5c06c2){return[_0x5c06c2,![]];}_0x4bb096[_0x1c83('0x90')]=_0xb409f['body'][_0x1c83('0x90')];_0x4bb096['externalUrl']=_0xb409f[_0x1c83('0x5d')][_0x1c83('0x92')];return db[_0x1c83('0x91')][_0x1c83('0x5c')](_0x4bb096)['then'](function(_0x11c780){return[_0x11c780,!![]];});});}else{_0x5ba1be['threadId']=null;}_0x5ba1be[_0x1c83('0x93')]=_0x2be478['id'];return db[_0x1c83('0x91')][_0x1c83('0x5b')]({'where':_0x5ba1be})['then'](function(_0xefe789){if(_0xefe789){return[_0xefe789,![]];}return db[_0x1c83('0x91')][_0x1c83('0x5c')](_0x4bb096)[_0x1c83('0x1f')](function(_0x482893){return[_0x482893,!![]];});});}})[_0x1c83('0x94')](function(_0x119659,_0x23252c){if(_0x119659){_0xc7ce36=_0x23252c;if(!_0x23252c){var _0x23062b={'from':(_0x15c14e[_0x1c83('0x8d')][_0x1c83('0x8e')]||'')+'\x20'+(_0x15c14e[_0x1c83('0x8d')][_0x1c83('0x8f')]||'')};if(_0xb409f['body']['threadId']&&_0xb409f[_0x1c83('0x5d')][_0x1c83('0x95')]&&_0xb409f[_0x1c83('0x5d')]['threadId']!=_0xb409f[_0x1c83('0x5d')][_0x1c83('0x95')]){_0x23062b[_0x1c83('0x90')]=_0xb409f[_0x1c83('0x5d')][_0x1c83('0x95')];}return _0x119659[_0x1c83('0x34')](_0x23062b);}else{return _0x119659;}}})[_0x1c83('0x1f')](function(_0x2dfe27){_0x15c14e['interaction']=_0x2dfe27[_0x1c83('0x36')]({'plain':!![]});_0x15c14e['interaction']['created']=_0xc7ce36;if(_0x15c14e[_0x1c83('0x96')][_0x1c83('0x97')]){if(_0x15c14e[_0x1c83('0x87')][_0x1c83('0x98')]){_0x15c14e['applications'][_0x1c83('0x99')]({'id':0x0,'priority':_0x15c14e[_0x1c83('0x88')]['length']+0x1,'app':_0x1c83('0x9a'),'appdata':_0x1c83('0x9b'),'interval':_0x1c83('0x9c')});}}return db[_0x1c83('0x9d')][_0x1c83('0x5c')]({'body':_0xb409f[_0x1c83('0x5d')]['body'],'OpenchannelAccountId':_0xb409f[_0x1c83('0x5a')]['id'],'OpenchannelInteractionId':_0x2dfe27['id'],'direction':'in','ContactId':_0x15c14e['contact']['id'],'AttachmentId':_0xb409f[_0x1c83('0x5d')][_0x1c83('0x9e')]});})[_0x1c83('0x1f')](function(_0x4a5c8e){_0x15c14e[_0x1c83('0x27')]=_0x4a5c8e;if(_0x15c14e[_0x1c83('0x96')]['UserId']){return db[_0x1c83('0x9f')][_0x1c83('0x5b')]({'attributes':['id',_0x1c83('0x3b')],'where':{'id':_0x15c14e[_0x1c83('0x96')][_0x1c83('0xa0')]}})[_0x1c83('0x1f')](function(_0x23227d){if(_0x23227d){_0x15c14e[_0x1c83('0x88')][_0x1c83('0xa1')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x23227d['name']+','+(_0x15c14e[_0x1c83('0x87')][_0x1c83('0xa2')]||0xa),'interval':_0x1c83('0x9c')});_0x15c14e[_0x1c83('0xa3')]=![];}return respondWithRpcPromise(_0x1c83('0xa4'),_0x1c83('0xa5'),_0x15c14e);});}return respondWithRpcPromise('Start','startRouting',_0x15c14e);})['then'](function(_0x3924ec){respondWithRpcPromise(_0x1c83('0xa6'),'EventManager',{'event':_0x1c83('0x70'),'message':_0x3924ec},client9002);return _0x3924ec;})[_0x1c83('0x1f')](respondWithResult(_0x6278e7,null))[_0x1c83('0x29')](handleError(_0x6278e7,null));};exports[_0x1c83('0xa7')]=function(_0x42202a,_0x23ae2e){var _0xfb57bc=_0x42202a[_0x1c83('0x5a')]['id'];var _0x623f68=_0x42202a[_0x1c83('0x5d')];var _0x5524eb=0xc8;var _0x5c8e18=null;return db[_0x1c83('0xa8')][_0x1c83('0xa9')]({'isolationLevel':db[_0x1c83('0xa8')][_0x1c83('0xaa')][_0x1c83('0xab')][_0x1c83('0xac')]},function(_0x5171d7){return db[_0x1c83('0x41')][_0x1c83('0x67')]({'where':{'id':_0xfb57bc},'transaction':_0x5171d7})[_0x1c83('0x1f')](function(_0x5d5801){if(_0x5d5801){return db[_0x1c83('0x85')][_0x1c83('0x35')]({'where':{'OpenchannelAccountId':_0xfb57bc},'transaction':_0x5171d7})[_0x1c83('0x1f')](function(){var _0x113f68=_[_0x1c83('0x40')](_0x623f68,function(_0x2c73dd){_0x2c73dd['OpenchannelAccountId']=_0xfb57bc;return _0x2c73dd;});return db[_0x1c83('0x85')][_0x1c83('0xad')](_0x113f68,{'transaction':_0x5171d7});});}else{_0x5524eb=0x194;_0x5c8e18=[];}});})[_0x1c83('0x1f')](function(){if(_0x5524eb!==0x194){return db[_0x1c83('0x85')][_0x1c83('0xae')]({'where':{'OpenchannelAccountId':_0xfb57bc},'order':_0x1c83('0x8b')})['then'](function(_0x5d161b){_0x5c8e18=_0x5d161b;});}})['catch'](function(_0x5b854d){_0x5524eb=0x1f4;logger[_0x1c83('0x25')](_0x5b854d['stack']);if(_0x5b854d[_0x1c83('0x3b')]){delete _0x5b854d[_0x1c83('0x3b')];}_0x5c8e18=_0x5b854d;})['finally'](function(){if(_0x5c8e18===null){_0x23ae2e[_0x1c83('0x3a')](_0x5524eb);}else{if(_0x5524eb===0x1f4){_0x23ae2e[_0x1c83('0x2a')](_0x5524eb)[_0x1c83('0x3c')](_0x5c8e18);}else{_0x23ae2e[_0x1c83('0x2a')](_0x5524eb)['json'](_0x5c8e18);}}});};exports[_0x1c83('0xaf')]=function(_0x30a6a1,_0x25bedb,_0x4a51f2){var _0x15a166={};var _0x963a30={};var _0x53641c;var _0x2ad10b;return db[_0x1c83('0x41')]['findOne']({'where':{'id':_0x30a6a1[_0x1c83('0x5a')]['id']}})['then'](handleEntityNotFound(_0x25bedb,null))[_0x1c83('0x1f')](function(_0xacd22f){if(_0xacd22f){_0x53641c=_0xacd22f;_0x963a30['model']=_[_0x1c83('0x48')](db[_0x1c83('0x85')][_0x1c83('0x42')]);_0x963a30[_0x1c83('0x47')]=_[_0x1c83('0x48')](_0x30a6a1[_0x1c83('0x47')]);_0x963a30['filters']=_[_0x1c83('0x4a')](_0x963a30[_0x1c83('0x46')],_0x963a30[_0x1c83('0x47')]);_0x15a166['attributes']=_['intersection'](_0x963a30[_0x1c83('0x46')],qs[_0x1c83('0x4c')](_0x30a6a1[_0x1c83('0x47')]['fields']));_0x15a166[_0x1c83('0x4b')]=_0x15a166[_0x1c83('0x4b')]['length']?_0x15a166['attributes']:_0x963a30['model'];_0x15a166['order']=qs['sort'](_0x30a6a1[_0x1c83('0x47')][_0x1c83('0x4f')]);_0x15a166['where']=qs['filters'](_[_0x1c83('0x51')](_0x30a6a1[_0x1c83('0x47')],_0x963a30[_0x1c83('0x49')]));if(_0x30a6a1['query']['filter']){_0x15a166[_0x1c83('0x50')]=_[_0x1c83('0x52')](_0x15a166[_0x1c83('0x50')],{'$or':_[_0x1c83('0x40')](_0x15a166[_0x1c83('0x4b')],function(_0x10ff74){var _0x26b658={};_0x26b658[_0x10ff74]={'$like':'%'+_0x30a6a1[_0x1c83('0x47')][_0x1c83('0x54')]+'%'};return _0x26b658;})});}_0x15a166=_[_0x1c83('0x52')]({},_0x15a166,_0x30a6a1['options']);return _0x53641c[_0x1c83('0xaf')](_0x15a166);}})[_0x1c83('0x1f')](function(_0x2c7e42){if(_0x2c7e42){_0x2ad10b=_0x2c7e42['length'];if(!_0x30a6a1[_0x1c83('0x47')][_0x1c83('0x4e')](_0x1c83('0x68'))){_0x15a166[_0x1c83('0x2f')]=qs[_0x1c83('0x2f')](_0x30a6a1[_0x1c83('0x47')][_0x1c83('0x2f')]);_0x15a166['offset']=qs[_0x1c83('0x2c')](_0x30a6a1[_0x1c83('0x47')][_0x1c83('0x2c')]);}return _0x53641c[_0x1c83('0xaf')](_0x15a166);}})[_0x1c83('0x1f')](function(_0x50be7d){if(_0x50be7d){return _0x50be7d?{'count':_0x2ad10b,'rows':_0x50be7d}:null;}})[_0x1c83('0x1f')](respondWithResult(_0x25bedb,null))[_0x1c83('0x29')](handleError(_0x25bedb,null));};exports[_0x1c83('0xb0')]=function(_0x1a3ad3,_0x477ff8,_0x2ab498){var _0x4affec={'raw':![],'where':{}};var _0x4f0710={};var _0x3d12cc={'count':0x0,'rows':[]};return db[_0x1c83('0x41')]['findOne']({'where':{'id':_0x1a3ad3[_0x1c83('0x5a')]['id']}})['then'](handleEntityNotFound(_0x477ff8,null))['then'](function(_0x2858ba){if(_0x2858ba){_0x4f0710[_0x1c83('0x46')]=_['keys'](db[_0x1c83('0x91')][_0x1c83('0x42')]);_0x4f0710[_0x1c83('0x47')]=_[_0x1c83('0x48')](_0x1a3ad3[_0x1c83('0x47')]);_0x4f0710[_0x1c83('0x49')]=_[_0x1c83('0x4a')](_0x4f0710[_0x1c83('0x46')],_0x4f0710[_0x1c83('0x47')]);_0x4affec[_0x1c83('0x4b')]=_[_0x1c83('0x4a')](_0x4f0710[_0x1c83('0x46')],qs[_0x1c83('0x4c')](_0x1a3ad3[_0x1c83('0x47')][_0x1c83('0x4c')]));_0x4affec[_0x1c83('0x4b')]=_0x4affec['attributes'][_0x1c83('0x4d')]?_0x4affec[_0x1c83('0x4b')]:_0x4f0710[_0x1c83('0x46')];if(!_0x1a3ad3[_0x1c83('0x47')][_0x1c83('0x4e')](_0x1c83('0x68'))){_0x4affec[_0x1c83('0x2f')]=qs[_0x1c83('0x2f')](_0x1a3ad3['query'][_0x1c83('0x2f')]);_0x4affec[_0x1c83('0x2c')]=qs['offset'](_0x1a3ad3[_0x1c83('0x47')]['offset']);}_0x4affec[_0x1c83('0x6e')]=qs['sort'](_0x1a3ad3[_0x1c83('0x47')]['sort']);_0x4affec['where']=qs['filters'](_[_0x1c83('0x51')](_0x1a3ad3[_0x1c83('0x47')],_0x4f0710['filters']));_0x4affec['where']['OpenchannelAccountId']=_0x2858ba['id'];if(_0x1a3ad3[_0x1c83('0x47')]['filter']){_0x4affec[_0x1c83('0x50')]=_[_0x1c83('0x52')](_0x4affec['where'],{'$or':_[_0x1c83('0x40')](_0x4affec[_0x1c83('0x4b')],function(_0x4a8897){var _0x3609ea={};_0x3609ea[_0x4a8897]={'$like':'%'+_0x1a3ad3[_0x1c83('0x47')][_0x1c83('0x54')]+'%'};return _0x3609ea;})});}_0x4affec=_[_0x1c83('0x52')]({},_0x4affec,_0x1a3ad3['options']);return db['OpenchannelInteraction']['count']({'where':_0x4affec[_0x1c83('0x50')]})['then'](function(_0x1bfc02){_0x3d12cc['count']=_0x1bfc02;if(_0x1a3ad3[_0x1c83('0x47')]['includeAll']){_0x4affec[_0x1c83('0x57')]=[{'model':db['CmContact'],'as':_0x1c83('0xb1'),'required':![]},{'model':db[_0x1c83('0x9f')],'as':_0x1c83('0xb2'),'attributes':['name',_0x1c83('0xb3'),_0x1c83('0xb4')],'required':![]},{'model':db['Tag'],'as':_0x1c83('0xb5'),'attributes':['id','name',_0x1c83('0xb6')],'where':_0x1a3ad3[_0x1c83('0x47')][_0x1c83('0xb7')]?{'id':_0x1a3ad3[_0x1c83('0x47')][_0x1c83('0xb7')]}:undefined,'required':_0x1a3ad3['query'][_0x1c83('0xb7')]?!![]:![]}];}return db[_0x1c83('0x91')][_0x1c83('0x69')](_0x4affec);})[_0x1c83('0x1f')](function(_0x229c20){_0x3d12cc[_0x1c83('0x58')]=_0x229c20;return _0x3d12cc;});}})[_0x1c83('0x1f')](respondWithFilteredResult(_0x477ff8,_0x4affec))[_0x1c83('0x29')](handleError(_0x477ff8,null));};exports[_0x1c83('0xb8')]=function(_0x57a259,_0x6a6e94,_0x1e7de4){return db[_0x1c83('0x41')][_0x1c83('0x5b')]({'where':{'id':_0x57a259[_0x1c83('0x5a')]['id']}})[_0x1c83('0x1f')](handleEntityNotFound(_0x6a6e94,null))[_0x1c83('0x1f')](function(_0x4ec817){if(_0x4ec817){return _0x4ec817[_0x1c83('0xb8')](_0x57a259[_0x1c83('0x5d')][_0x1c83('0x6b')],_[_0x1c83('0xb9')](_0x57a259[_0x1c83('0x5d')],[_0x1c83('0x6b'),'id'])||{})['spread'](function(_0x6301c3){for(var _0xb80b2b=0x0;_0xb80b2b<_0x57a259[_0x1c83('0x5d')][_0x1c83('0x6b')][_0x1c83('0x4d')];_0xb80b2b+=0x1){socket[_0x1c83('0xba')](_0x1c83('0xbb'),{'UserId':Number(_0x57a259[_0x1c83('0x5d')][_0x1c83('0x6b')][_0xb80b2b]),'OpenchannelAccountId':Number(_0x57a259[_0x1c83('0x5a')]['id'])});}return _0x6301c3;});}})['then'](respondWithResult(_0x6a6e94,null))[_0x1c83('0x29')](handleError(_0x6a6e94,null));};exports[_0x1c83('0xbc')]=function(_0x59800b,_0x41568b,_0x5a224a){return db[_0x1c83('0x41')][_0x1c83('0x5b')]({'where':{'id':_0x59800b[_0x1c83('0x5a')]['id']}})[_0x1c83('0x1f')](handleEntityNotFound(_0x41568b,null))[_0x1c83('0x1f')](function(_0x2c1956){if(_0x2c1956){return _0x2c1956[_0x1c83('0xbc')](_0x59800b[_0x1c83('0x47')][_0x1c83('0x6b')])[_0x1c83('0x1f')](function(){if(_[_0x1c83('0xbd')](_0x59800b[_0x1c83('0x47')][_0x1c83('0x6b')])){for(var _0xaa970c=0x0;_0xaa970c<_0x59800b[_0x1c83('0x47')]['ids']['length'];_0xaa970c+=0x1){socket[_0x1c83('0xba')](_0x1c83('0xbe'),{'UserId':Number(_0x59800b[_0x1c83('0x47')][_0x1c83('0x6b')][_0xaa970c]),'OpenchannelAccountId':Number(_0x59800b[_0x1c83('0x5a')]['id'])});}}else{socket[_0x1c83('0xba')](_0x1c83('0xbe'),{'UserId':Number(_0x59800b[_0x1c83('0x47')][_0x1c83('0x6b')]),'OpenchannelAccountId':Number(_0x59800b[_0x1c83('0x5a')]['id'])});}});}})['then'](respondWithStatusCode(_0x41568b,null))[_0x1c83('0x29')](handleError(_0x41568b,null));};exports[_0x1c83('0xbf')]=function(_0xbc51e2,_0x2eece2,_0x195633){var _0x11edab={};var _0x5411ad={};var _0x3f8096;var _0x2ddd18;return db[_0x1c83('0x41')][_0x1c83('0x67')]({'where':{'id':_0xbc51e2[_0x1c83('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2eece2,null))[_0x1c83('0x1f')](function(_0x5cec4d){if(_0x5cec4d){_0x3f8096=_0x5cec4d;_0x5411ad[_0x1c83('0x46')]=_['keys'](db[_0x1c83('0x9f')][_0x1c83('0x42')]);_0x5411ad[_0x1c83('0x47')]=_['keys'](_0xbc51e2[_0x1c83('0x47')]);_0x5411ad[_0x1c83('0x49')]=_[_0x1c83('0x4a')](_0x5411ad[_0x1c83('0x46')],_0x5411ad['query']);_0x11edab['attributes']=_[_0x1c83('0x4a')](_0x5411ad['model'],qs['fields'](_0xbc51e2[_0x1c83('0x47')]['fields']));_0x11edab[_0x1c83('0x4b')]=_0x11edab[_0x1c83('0x4b')]['length']?_0x11edab['attributes']:_0x5411ad['model'];_0x11edab['order']=qs[_0x1c83('0x4f')](_0xbc51e2[_0x1c83('0x47')]['sort']);_0x11edab[_0x1c83('0x50')]=qs['filters'](_[_0x1c83('0x51')](_0xbc51e2['query'],_0x5411ad[_0x1c83('0x49')]));if(_0xbc51e2[_0x1c83('0x47')]['filter']){_0x11edab[_0x1c83('0x50')]=_[_0x1c83('0x52')](_0x11edab[_0x1c83('0x50')],{'$or':_[_0x1c83('0x40')](_0x11edab[_0x1c83('0x4b')],function(_0x360f8f){var _0x5ccfad={};_0x5ccfad[_0x360f8f]={'$like':'%'+_0xbc51e2[_0x1c83('0x47')][_0x1c83('0x54')]+'%'};return _0x5ccfad;})});}_0x11edab=_[_0x1c83('0x52')]({},_0x11edab,_0xbc51e2[_0x1c83('0x55')]);return _0x3f8096['getAgents'](_0x11edab);}})['then'](function(_0x4f4780){if(_0x4f4780){_0x2ddd18=_0x4f4780[_0x1c83('0x4d')];if(!_0xbc51e2[_0x1c83('0x47')][_0x1c83('0x4e')]('nolimit')){_0x11edab[_0x1c83('0x2f')]=qs[_0x1c83('0x2f')](_0xbc51e2[_0x1c83('0x47')][_0x1c83('0x2f')]);_0x11edab['offset']=qs[_0x1c83('0x2c')](_0xbc51e2[_0x1c83('0x47')]['offset']);}return _0x3f8096[_0x1c83('0xbf')](_0x11edab);}})[_0x1c83('0x1f')](function(_0x4fbb67){if(_0x4fbb67){return _0x4fbb67?{'count':_0x2ddd18,'rows':_0x4fbb67}:null;}})[_0x1c83('0x1f')](respondWithResult(_0x2eece2,null))[_0x1c83('0x29')](handleError(_0x2eece2,null));};exports[_0x1c83('0x3c')]=function(_0x400dd6,_0x40794a,_0x29e647){var _0x4b71f0,_0xa4a4af,_0x5db197;if(_['isNil'](_0x400dd6['body'][_0x1c83('0x5d')])||_0x400dd6[_0x1c83('0x5d')]['body']===''){throw new db['Sequelize'][(_0x1c83('0x73'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x400dd6['body']['to'])){}_0x4b71f0=_0x400dd6['body']['to'];return db['OpenchannelAccount'][_0x1c83('0x67')]({'where':{'id':_0x400dd6[_0x1c83('0x5a')]['id']}})[_0x1c83('0x1f')](handleEntityNotFound(_0x40794a,null))[_0x1c83('0x1f')](function(_0x7ace62){if(_0x7ace62){return db[_0x1c83('0x41')][_0x1c83('0x5b')]({'where':{'id':_0x7ace62['id']},'include':[{'model':db[_0x1c83('0x81')],'as':_0x1c83('0x82'),'include':[{'model':db[_0x1c83('0x83')],'as':_0x1c83('0x84'),'where':{[_0x7ace62[_0x1c83('0x80')]]:_0x4b71f0},'limit':0x1,'order':[[_0x1c83('0x77'),_0x1c83('0xc0')]]}]}]})[_0x1c83('0x1f')](handleEntityNotFound(_0x40794a,null))[_0x1c83('0x1f')](function(_0x3e1c9c){if(_0x3e1c9c&&_0x3e1c9c[_0x1c83('0x82')]){_0xa4a4af=_0x3e1c9c[_0x1c83('0x36')]({'plain':!![]});if(_0xa4a4af['List']&&_0xa4a4af['List'][_0x1c83('0x84')][_0x1c83('0x4d')]){return _0xa4a4af[_0x1c83('0x82')]['Contacts'][0x0];}return db[_0x1c83('0x83')][_0x1c83('0x5c')](_[_0x1c83('0x18')](_0x400dd6[_0x1c83('0x5d')],{'firstName':_0x4b71f0,[_0x3e1c9c['mapKey']]:_0x4b71f0,'phone':_0x4b71f0,'ListId':_0xa4a4af[_0x1c83('0x79')]}));}})['then'](handleEntityNotFound(_0x40794a,null))[_0x1c83('0x1f')](function(_0x5df6ea){if(_0x5df6ea){_0x5db197=_0x5df6ea;return db[_0x1c83('0x91')][_0x1c83('0x5b')]({'where':{'ContactId':_0x5db197['id'],'closed':![],'OpenchannelAccountId':_0xa4a4af['id']}})['then'](function(_0x10e042){if(_0x10e042){return[_0x10e042,![]];}return db[_0x1c83('0x91')][_0x1c83('0x5c')]({'UserId':_0x400dd6[_0x1c83('0x5f')]['id'],'ContactId':_0x5db197['id'],'OpenchannelAccountId':_0xa4a4af['id'],'lastMsgDirection':'out','firstMsgDirection':_0x1c83('0xc1'),'Messages':[_['merge'](_0x400dd6[_0x1c83('0x5d')],{'read':![],'body':_0x400dd6[_0x1c83('0x5d')][_0x1c83('0x5d')],'OpenchannelAccountId':_0xa4a4af['id'],'UserId':_0x400dd6[_0x1c83('0x5f')]['id'],'ContactId':_0x5db197['id']})]},{'include':[{'model':db[_0x1c83('0x9d')],'as':'Messages'}]})[_0x1c83('0x1f')](function(_0x4f04ed){return[_0x4f04ed,!![]];});});}})[_0x1c83('0x94')](function(_0x2933a5,_0x9711f5){if(_0x9711f5){return _0x2933a5;}return db[_0x1c83('0x9d')][_0x1c83('0x5c')](_[_0x1c83('0x52')](_0x400dd6[_0x1c83('0x5d')],{'read':![],'body':_0x400dd6[_0x1c83('0x5d')][_0x1c83('0x5d')],'OpenchannelAccountId':_0xa4a4af['id'],'OpenchannelInteractionId':_0x2933a5['id'],'UserId':_0x400dd6['user']['id'],'ContactId':_0x5db197['id']}))['then'](function(_0x25de6f){_0x2933a5['dataValues'][_0x1c83('0xc2')]=[];_0x2933a5[_0x1c83('0xc3')][_0x1c83('0xc2')][_0x1c83('0x99')](_0x25de6f['dataValues']);return _0x2933a5;});});}})[_0x1c83('0x1f')](respondWithResult(_0x40794a,null))[_0x1c83('0x29')](handleError(_0x40794a,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 27f6516..d629c0b 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 _0xf4eb=['hook','events','update','emit','hasOwnProperty'];(function(_0x34eb37,_0x20e313){var _0x83b97f=function(_0x547537){while(--_0x547537){_0x34eb37['push'](_0x34eb37['shift']());}};_0x83b97f(++_0x20e313);}(_0xf4eb,0xec));var _0xbf4e=function(_0x21c1ee,_0xd88c9){_0x21c1ee=_0x21c1ee-0x0;var _0x142815=_0xf4eb[_0x21c1ee];return _0x142815;};'use strict';var EventEmitter=require(_0xbf4e('0x0'));var OpenchannelAccount=require('../../mysqldb')['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xbf4e('0x1'),'afterDestroy':'remove'};function emitEvent(_0x4e7fa7){return function(_0x2e3070,_0x1c7606,_0x32d1d7){OpenchannelAccountEvents[_0xbf4e('0x2')](_0x4e7fa7+':'+_0x2e3070['id'],_0x2e3070);OpenchannelAccountEvents[_0xbf4e('0x2')](_0x4e7fa7,_0x2e3070);_0x32d1d7(null);};}for(var e in events){if(events[_0xbf4e('0x3')](e)){var event=events[e];OpenchannelAccount[_0xbf4e('0x4')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0x702d=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount'];(function(_0x596930,_0x5d7764){var _0x322698=function(_0x39c3bb){while(--_0x39c3bb){_0x596930['push'](_0x596930['shift']());}};_0x322698(++_0x5d7764);}(_0x702d,0x147));var _0xd702=function(_0x706dec,_0x43e6fc){_0x706dec=_0x706dec-0x0;var _0x232271=_0x702d[_0x706dec];return _0x232271;};'use strict';var EventEmitter=require(_0xd702('0x0'));var OpenchannelAccount=require(_0xd702('0x1'))['db'][_0xd702('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xd702('0x3')](0x0);var events={'afterCreate':_0xd702('0x4'),'afterUpdate':'update','afterDestroy':_0xd702('0x5')};function emitEvent(_0xebbd7c){return function(_0x27b260,_0x1c5a32,_0x481ee0){OpenchannelAccountEvents[_0xd702('0x6')](_0xebbd7c+':'+_0x27b260['id'],_0x27b260);OpenchannelAccountEvents['emit'](_0xebbd7c,_0x27b260);_0x481ee0(null);};}for(var e in events){if(events[_0xd702('0x7')](e)){var event=events[e];OpenchannelAccount[_0xd702('0x8')](e,emitEvent(event));}}module[_0xd702('0x9')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 72686c9..b37d9f5 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(_0x3ef5f4,_0x3c6997){var _0x120708=function(_0x3e1919){while(--_0x3e1919){_0x3ef5f4['push'](_0x3ef5f4['shift']());}};_0x120708(++_0x3c6997);}(_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 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(_0x3ebf85,_0x1f71a8){var _0x4e98e0=function(_0x526d74){while(--_0x526d74){_0x3ebf85['push'](_0x3ebf85['shift']());}};_0x4e98e0(++_0x1f71a8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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 df0b828..e579d4a 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 _0xe493=['client','http','redis','defaults','./openchannelAccount.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0xe493,0x7e));var _0x3e49=function(_0x5be484,_0x3180c6){_0x5be484=_0x5be484-0x0;var _0x45eade=_0xe493[_0x5be484];return _0x45eade;};'use strict';var _=require(_0x3e49('0x0'));var util=require(_0x3e49('0x1'));var moment=require(_0x3e49('0x2'));var BPromise=require(_0x3e49('0x3'));var rs=require(_0x3e49('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e49('0x5'))['db'];var utils=require(_0x3e49('0x6'));var logger=require('../../config/logger')(_0x3e49('0x7'));var config=require('../../config/environment');var jayson=require(_0x3e49('0x8'));var client=jayson[_0x3e49('0x9')][_0x3e49('0xa')]({'port':0x232a});config[_0x3e49('0xb')]=_[_0x3e49('0xc')](config[_0x3e49('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3e49('0xd'))[_0x3e49('0xe')](socket);function respondWithRpcPromise(_0x155727,_0x723d28,_0xb3f9f0){return new BPromise(function(_0x293965,_0xef8167){return client[_0x3e49('0xf')](_0x155727,_0xb3f9f0)[_0x3e49('0x10')](function(_0xf5e45f){logger[_0x3e49('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x723d28,_0x3e49('0x12'));logger[_0x3e49('0x13')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x723d28,_0x3e49('0x12'),JSON[_0x3e49('0x14')](_0xf5e45f));if(_0xf5e45f['error']){if(_0xf5e45f[_0x3e49('0x15')][_0x3e49('0x16')]===0x1f4){logger['error'](_0x3e49('0x17'),_0x723d28,_0xf5e45f[_0x3e49('0x15')][_0x3e49('0x18')]);return _0xef8167(_0xf5e45f[_0x3e49('0x15')][_0x3e49('0x18')]);}logger[_0x3e49('0x15')](_0x3e49('0x17'),_0x723d28,_0xf5e45f[_0x3e49('0x15')][_0x3e49('0x18')]);return _0x293965(_0xf5e45f[_0x3e49('0x15')][_0x3e49('0x18')]);}else{logger[_0x3e49('0x11')](_0x3e49('0x17'),_0x723d28,_0x3e49('0x12'));_0x293965(_0xf5e45f[_0x3e49('0x19')]['message']);}})[_0x3e49('0x1a')](function(_0x59bde3){logger[_0x3e49('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x723d28,_0x59bde3);_0xef8167(_0x59bde3);});});} \ No newline at end of file +var _0xb58b=['ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','util','moment','bluebird'];(function(_0x58efce,_0x41316e){var _0x378870=function(_0x20c8a6){while(--_0x20c8a6){_0x58efce['push'](_0x58efce['shift']());}};_0x378870(++_0x41316e);}(_0xb58b,0x1f1));var _0xbb58=function(_0x386e19,_0x2b6189){_0x386e19=_0x386e19-0x0;var _0x529947=_0xb58b[_0x386e19];return _0x529947;};'use strict';var _=require('lodash');var util=require(_0xbb58('0x0'));var moment=require(_0xbb58('0x1'));var BPromise=require(_0xbb58('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbb58('0x3'));var db=require(_0xbb58('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbb58('0x5'))('rpc');var config=require(_0xbb58('0x6'));var jayson=require(_0xbb58('0x7'));var client=jayson[_0xbb58('0x8')]['http']({'port':0x232a});config[_0xbb58('0x9')]=_[_0xbb58('0xa')](config[_0xbb58('0x9')],{'host':_0xbb58('0xb'),'port':0x18eb});var socket=require(_0xbb58('0xc'))(new Redis(config[_0xbb58('0x9')]));require(_0xbb58('0xd'))[_0xbb58('0xe')](socket);function respondWithRpcPromise(_0x429e75,_0x261d00,_0x27f77f){return new BPromise(function(_0x4bb8c5,_0x80ab3a){return client['request'](_0x429e75,_0x27f77f)[_0xbb58('0xf')](function(_0x440392){logger[_0xbb58('0x10')](_0xbb58('0x11'),_0x261d00,'request\x20sent');logger[_0xbb58('0x12')](_0xbb58('0x13'),_0x261d00,'request\x20sent',JSON[_0xbb58('0x14')](_0x440392));if(_0x440392[_0xbb58('0x15')]){if(_0x440392[_0xbb58('0x15')][_0xbb58('0x16')]===0x1f4){logger[_0xbb58('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x261d00,_0x440392[_0xbb58('0x15')][_0xbb58('0x17')]);return _0x80ab3a(_0x440392['error']['message']);}logger[_0xbb58('0x15')](_0xbb58('0x11'),_0x261d00,_0x440392[_0xbb58('0x15')]['message']);return _0x4bb8c5(_0x440392['error']['message']);}else{logger['info'](_0xbb58('0x11'),_0x261d00,_0xbb58('0x18'));_0x4bb8c5(_0x440392['result'][_0xbb58('0x17')]);}})['catch'](function(_0x2cf892){logger[_0xbb58('0x15')](_0xbb58('0x11'),_0x261d00,_0x2cf892);_0x80ab3a(_0x2cf892);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 53580ed..ebc065c 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 _0x35a9=['register','length','openchannelAccount:','save','remove','update','emit','removeListener'];(function(_0x45ce08,_0x59dcc7){var _0x23dff2=function(_0x1ad0e5){while(--_0x1ad0e5){_0x45ce08['push'](_0x45ce08['shift']());}};_0x23dff2(++_0x59dcc7);}(_0x35a9,0x73));var _0x935a=function(_0x477da2,_0x424f79){_0x477da2=_0x477da2-0x0;var _0x4efa0e=_0x35a9[_0x477da2];return _0x4efa0e;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x935a('0x0'),_0x935a('0x1'),_0x935a('0x2')];function createListener(_0x27befc,_0x50d208){return function(_0x495439){_0x50d208[_0x935a('0x3')](_0x27befc,_0x495439);};}function removeListener(_0x5f5170,_0x33ac0a){return function(){OpenchannelAccountEvents[_0x935a('0x4')](_0x5f5170,_0x33ac0a);};}exports[_0x935a('0x5')]=function(_0x45994c){for(var _0x28970b=0x0,_0xca82cf=events[_0x935a('0x6')];_0x28970b<_0xca82cf;_0x28970b++){var _0x16a5c2=events[_0x28970b];var _0x534830=createListener(_0x935a('0x7')+_0x16a5c2,_0x45994c);OpenchannelAccountEvents['on'](_0x16a5c2,_0x534830);}}; \ No newline at end of file +var _0x1b73=['openchannelAccount:','save','remove','update','register','length'];(function(_0x1c2f32,_0x48e6b3){var _0x3b6ba7=function(_0x4d0273){while(--_0x4d0273){_0x1c2f32['push'](_0x1c2f32['shift']());}};_0x3b6ba7(++_0x48e6b3);}(_0x1b73,0x1d5));var _0x31b7=function(_0x3991b3,_0x35b97c){_0x3991b3=_0x3991b3-0x0;var _0x9402dd=_0x1b73[_0x3991b3];return _0x9402dd;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x31b7('0x0'),_0x31b7('0x1'),_0x31b7('0x2')];function createListener(_0x5c767e,_0x4bf5ae){return function(_0x17c0ef){_0x4bf5ae['emit'](_0x5c767e,_0x17c0ef);};}function removeListener(_0x40fef2,_0x3682cc){return function(){OpenchannelAccountEvents['removeListener'](_0x40fef2,_0x3682cc);};}exports[_0x31b7('0x3')]=function(_0x3d058f){for(var _0x15c31e=0x0,_0x502838=events[_0x31b7('0x4')];_0x15c31e<_0x502838;_0x15c31e++){var _0x1a730f=events[_0x15c31e];var _0x86ef8e=createListener(_0x31b7('0x5')+_0x1a730f,_0x3d058f);OpenchannelAccountEvents['on'](_0x1a730f,_0x86ef8e);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index d1b6c72..3096fb4 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 _0x2de6=['../../config/environment','./openchannelApplication.controller','isAuthenticated','get','/:id','post','create','put','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0x2de6,0x11a));var _0x62de=function(_0x2e71ab,_0x42a581){_0x2e71ab=_0x2e71ab-0x0;var _0x388d94=_0x2de6[_0x2e71ab];return _0x388d94;};'use strict';var multer=require(_0x62de('0x0'));var util=require(_0x62de('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x62de('0x2'));var router=express[_0x62de('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x62de('0x4'));var interaction=require(_0x62de('0x5'));var config=require(_0x62de('0x6'));var controller=require(_0x62de('0x7'));router['get']('/',auth[_0x62de('0x8')](),controller['index']);router[_0x62de('0x9')](_0x62de('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x62de('0xb')]('/',auth[_0x62de('0x8')](),controller[_0x62de('0xc')]);router[_0x62de('0xd')](_0x62de('0xa'),auth[_0x62de('0x8')](),controller[_0x62de('0xe')]);router[_0x62de('0xf')](_0x62de('0xa'),auth[_0x62de('0x8')](),controller[_0x62de('0x10')]);module[_0x62de('0x11')]=router; \ No newline at end of file +var _0xde84=['Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','util','connect-timeout'];(function(_0x378886,_0xd6e40a){var _0x3563fc=function(_0x2251c6){while(--_0x2251c6){_0x378886['push'](_0x378886['shift']());}};_0x3563fc(++_0xd6e40a);}(_0xde84,0x178));var _0x4de8=function(_0x4b1552,_0x43b0f5){_0x4b1552=_0x4b1552-0x0;var _0x2fc6f1=_0xde84[_0x4b1552];return _0x2fc6f1;};'use strict';var multer=require('multer');var util=require(_0x4de8('0x0'));var path=require('path');var timeout=require(_0x4de8('0x1'));var express=require('express');var router=express[_0x4de8('0x2')]();var fs_extra=require(_0x4de8('0x3'));var auth=require(_0x4de8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4de8('0x5'));var controller=require('./openchannelApplication.controller');router[_0x4de8('0x6')]('/',auth[_0x4de8('0x7')](),controller[_0x4de8('0x8')]);router[_0x4de8('0x6')](_0x4de8('0x9'),auth[_0x4de8('0x7')](),controller[_0x4de8('0xa')]);router[_0x4de8('0xb')]('/',auth[_0x4de8('0x7')](),controller['create']);router[_0x4de8('0xc')](_0x4de8('0x9'),auth[_0x4de8('0x7')](),controller[_0x4de8('0xd')]);router['delete'](_0x4de8('0x9'),auth[_0x4de8('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index fed966a..73f7d8e 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 _0x674a=['STRING','sequelize','exports','noop','TEXT'];(function(_0x1ba576,_0x397070){var _0x48b26c=function(_0x13799c){while(--_0x13799c){_0x1ba576['push'](_0x1ba576['shift']());}};_0x48b26c(++_0x397070);}(_0x674a,0x15f));var _0xa674=function(_0x1b1f49,_0x1c0b8c){_0x1b1f49=_0x1b1f49-0x0;var _0x1993c3=_0x674a[_0x1b1f49];return _0x1993c3;};'use strict';var Sequelize=require(_0xa674('0x0'));module[_0xa674('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa674('0x2')},'appdata':{'type':Sequelize[_0xa674('0x3')]()},'description':{'type':Sequelize[_0xa674('0x4')]},'interval':{'type':Sequelize[_0xa674('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xaa5b=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x58b277,_0x55ceea){var _0x242c62=function(_0x142809){while(--_0x142809){_0x58b277['push'](_0x58b277['shift']());}};_0x242c62(++_0x55ceea);}(_0xaa5b,0x1a7));var _0xbaa5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xaa5b[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xbaa5('0x0'));module[_0xbaa5('0x1')]={'priority':{'type':Sequelize[_0xbaa5('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xbaa5('0x3')],'allowNull':![],'defaultValue':_0xbaa5('0x4')},'appdata':{'type':Sequelize[_0xbaa5('0x5')]()},'description':{'type':Sequelize[_0xbaa5('0x3')]},'interval':{'type':Sequelize[_0xbaa5('0x3')],'defaultValue':_0xbaa5('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index f854d16..2ec7809 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 _0x988e=['../../config/license/util','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','end','sendStatus','error','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','OpenchannelApplication','includeAll','findAll','show','include','merge','options','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment'];(function(_0x48fa3f,_0x700760){var _0x16037d=function(_0x23fe27){while(--_0x23fe27){_0x48fa3f['push'](_0x48fa3f['shift']());}};_0x16037d(++_0x700760);}(_0x988e,0x114));var _0xe988=function(_0x23c527,_0x5851a2){_0x23c527=_0x23c527-0x0;var _0xe4f39b=_0x988e[_0x23c527];return _0xe4f39b;};'use strict';var emlformat=require(_0xe988('0x0'));var rimraf=require(_0xe988('0x1'));var zipdir=require(_0xe988('0x2'));var jsonpatch=require(_0xe988('0x3'));var rp=require('request-promise');var moment=require(_0xe988('0x4'));var BPromise=require(_0xe988('0x5'));var Mustache=require(_0xe988('0x6'));var util=require(_0xe988('0x7'));var path=require(_0xe988('0x8'));var sox=require('sox');var csv=require(_0xe988('0x9'));var ejs=require(_0xe988('0xa'));var fs=require('fs');var fs_extra=require(_0xe988('0xb'));var _=require(_0xe988('0xc'));var squel=require('squel');var crypto=require(_0xe988('0xd'));var jsforce=require(_0xe988('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe988('0x9'));var querystring=require(_0xe988('0xf'));var Papa=require(_0xe988('0x10'));var Redis=require(_0xe988('0x11'));var authService=require(_0xe988('0x12'));var qs=require(_0xe988('0x13'));var as=require(_0xe988('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe988('0x15'));var utils=require(_0xe988('0x16'));var config=require(_0xe988('0x17'));var licenseUtil=require(_0xe988('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7c8ee6,_0x348ad7){_0x348ad7=_0x348ad7||0xcc;return function(_0x22ad53){if(_0x22ad53){return _0x7c8ee6['sendStatus'](_0x348ad7);}return _0x7c8ee6[_0xe988('0x19')](_0x348ad7)['end']();};}function respondWithResult(_0x3b7b04,_0x4f25fc){_0x4f25fc=_0x4f25fc||0xc8;return function(_0x3d2391){if(_0x3d2391){return _0x3b7b04['status'](_0x4f25fc)[_0xe988('0x1a')](_0x3d2391);}};}function respondWithFilteredResult(_0x167e94,_0x36d4b8){return function(_0x262690){if(_0x262690){var _0x454ead=typeof _0x36d4b8[_0xe988('0x1b')]===_0xe988('0x1c')&&typeof _0x36d4b8[_0xe988('0x1d')]===_0xe988('0x1c');var _0x32aad6=_0x262690[_0xe988('0x1e')];var _0xfff616=_0x454ead?0x0:_0x36d4b8[_0xe988('0x1b')];var _0x75add9=_0x454ead?_0x262690[_0xe988('0x1e')]:_0x36d4b8['offset']+_0x36d4b8[_0xe988('0x1d')];var _0x17c878;if(_0x75add9>=_0x32aad6){_0x75add9=_0x32aad6;_0x17c878=0xc8;}else{_0x17c878=0xce;}_0x167e94[_0xe988('0x19')](_0x17c878);return _0x167e94[_0xe988('0x1f')](_0xe988('0x20'),_0xfff616+'-'+_0x75add9+'/'+_0x32aad6)['json'](_0x262690);}return null;};}function patchUpdates(_0x4a757){return function(_0x1620ce){try{jsonpatch[_0xe988('0x21')](_0x1620ce,_0x4a757,!![]);}catch(_0x274bb8){return BPromise[_0xe988('0x22')](_0x274bb8);}return _0x1620ce['save']();};}function saveUpdates(_0x3a40bf,_0x2caca4){return function(_0x449cf0){if(_0x449cf0){return _0x449cf0[_0xe988('0x23')](_0x3a40bf)['then'](function(_0xe907d5){return _0xe907d5;});}return null;};}function removeEntity(_0x4b1dc0,_0x196378){return function(_0x4a5809){if(_0x4a5809){return _0x4a5809[_0xe988('0x24')]()[_0xe988('0x25')](function(){_0x4b1dc0[_0xe988('0x19')](0xcc)[_0xe988('0x26')]();});}};}function handleEntityNotFound(_0x4c7e06,_0x2adfb8){return function(_0x31af33){if(!_0x31af33){_0x4c7e06[_0xe988('0x27')](0x194);}return _0x31af33;};}function handleError(_0x3c2a35,_0x2e39b9){_0x2e39b9=_0x2e39b9||0x1f4;return function(_0x355b61){logger[_0xe988('0x28')](_0x355b61['stack']);if(_0x355b61[_0xe988('0x29')]){delete _0x355b61[_0xe988('0x29')];}_0x3c2a35[_0xe988('0x19')](_0x2e39b9)[_0xe988('0x2a')](_0x355b61);};}exports[_0xe988('0x2b')]=function(_0x2e09ea,_0x282752){var _0xf059b3={},_0x38a592={},_0x2e6766={'count':0x0,'rows':[]};var _0x10961b=_[_0xe988('0x2c')](db['OpenchannelApplication'][_0xe988('0x2d')],function(_0x27ceb9){return{'name':_0x27ceb9['fieldName'],'type':_0x27ceb9[_0xe988('0x2e')][_0xe988('0x2f')]};});_0x38a592[_0xe988('0x30')]=_[_0xe988('0x2c')](_0x10961b,_0xe988('0x29'));_0x38a592[_0xe988('0x31')]=_[_0xe988('0x32')](_0x2e09ea[_0xe988('0x31')]);_0x38a592[_0xe988('0x33')]=_[_0xe988('0x34')](_0x38a592[_0xe988('0x30')],_0x38a592[_0xe988('0x31')]);_0xf059b3[_0xe988('0x35')]=_[_0xe988('0x34')](_0x38a592[_0xe988('0x30')],qs[_0xe988('0x36')](_0x2e09ea['query'][_0xe988('0x36')]));_0xf059b3[_0xe988('0x35')]=_0xf059b3[_0xe988('0x35')][_0xe988('0x37')]?_0xf059b3[_0xe988('0x35')]:_0x38a592['model'];if(!_0x2e09ea[_0xe988('0x31')][_0xe988('0x38')]('nolimit')){_0xf059b3[_0xe988('0x1d')]=qs[_0xe988('0x1d')](_0x2e09ea[_0xe988('0x31')][_0xe988('0x1d')]);_0xf059b3['offset']=qs[_0xe988('0x1b')](_0x2e09ea[_0xe988('0x31')][_0xe988('0x1b')]);}_0xf059b3[_0xe988('0x39')]=qs[_0xe988('0x3a')](_0x2e09ea[_0xe988('0x31')]['sort']);_0xf059b3[_0xe988('0x3b')]=qs['filters'](_[_0xe988('0x3c')](_0x2e09ea['query'],_0x38a592[_0xe988('0x33')]),_0x10961b);if(_0x2e09ea[_0xe988('0x31')][_0xe988('0x3d')]){_0xf059b3[_0xe988('0x3b')]=_['merge'](_0xf059b3[_0xe988('0x3b')],{'$or':_['map'](_0x10961b,function(_0x455617){if(_0x455617['type']!==_0xe988('0x3e')){var _0x40347a={};_0x40347a[_0x455617['name']]={'$like':'%'+_0x2e09ea[_0xe988('0x31')][_0xe988('0x3d')]+'%'};return _0x40347a;}})});}_0xf059b3=_['merge']({},_0xf059b3,_0x2e09ea['options']);var _0x3366de={'where':_0xf059b3[_0xe988('0x3b')]};return db[_0xe988('0x3f')][_0xe988('0x1e')](_0x3366de)[_0xe988('0x25')](function(_0x2574f3){_0x2e6766[_0xe988('0x1e')]=_0x2574f3;if(_0x2e09ea['query'][_0xe988('0x40')]){_0xf059b3['include']=[{'all':!![]}];}return db[_0xe988('0x3f')][_0xe988('0x41')](_0xf059b3);})[_0xe988('0x25')](function(_0x14be2f){_0x2e6766['rows']=_0x14be2f;return _0x2e6766;})[_0xe988('0x25')](respondWithFilteredResult(_0x282752,_0xf059b3))['catch'](handleError(_0x282752,null));};exports[_0xe988('0x42')]=function(_0x4268dc,_0x321ace){var _0x554db8={'raw':!![],'where':{'id':_0x4268dc['params']['id']}},_0xef5bb2={};_0xef5bb2[_0xe988('0x30')]=_[_0xe988('0x32')](db[_0xe988('0x3f')]['rawAttributes']);_0xef5bb2['query']=_[_0xe988('0x32')](_0x4268dc[_0xe988('0x31')]);_0xef5bb2[_0xe988('0x33')]=_[_0xe988('0x34')](_0xef5bb2['model'],_0xef5bb2['query']);_0x554db8[_0xe988('0x35')]=_[_0xe988('0x34')](_0xef5bb2['model'],qs[_0xe988('0x36')](_0x4268dc[_0xe988('0x31')][_0xe988('0x36')]));_0x554db8[_0xe988('0x35')]=_0x554db8['attributes'][_0xe988('0x37')]?_0x554db8['attributes']:_0xef5bb2[_0xe988('0x30')];if(_0x4268dc[_0xe988('0x31')][_0xe988('0x40')]){_0x554db8[_0xe988('0x43')]=[{'all':!![]}];}_0x554db8=_[_0xe988('0x44')]({},_0x554db8,_0x4268dc[_0xe988('0x45')]);return db[_0xe988('0x3f')][_0xe988('0x46')](_0x554db8)[_0xe988('0x25')](handleEntityNotFound(_0x321ace,null))[_0xe988('0x25')](respondWithResult(_0x321ace,null))[_0xe988('0x47')](handleError(_0x321ace,null));};exports[_0xe988('0x48')]=function(_0x3d8fe8,_0x28d67b){return db[_0xe988('0x3f')][_0xe988('0x48')](_0x3d8fe8['body'],{})[_0xe988('0x25')](respondWithResult(_0x28d67b,0xc9))[_0xe988('0x47')](handleError(_0x28d67b,null));};exports[_0xe988('0x23')]=function(_0xd87295,_0x2e8589){if(_0xd87295['body']['id']){delete _0xd87295[_0xe988('0x49')]['id'];}return db[_0xe988('0x3f')][_0xe988('0x46')]({'where':{'id':_0xd87295[_0xe988('0x4a')]['id']}})[_0xe988('0x25')](handleEntityNotFound(_0x2e8589,null))['then'](saveUpdates(_0xd87295['body'],null))[_0xe988('0x25')](respondWithResult(_0x2e8589,null))[_0xe988('0x47')](handleError(_0x2e8589,null));};exports[_0xe988('0x24')]=function(_0x2ae19a,_0x21669b){return db['OpenchannelApplication'][_0xe988('0x46')]({'where':{'id':_0x2ae19a[_0xe988('0x4a')]['id']}})[_0xe988('0x25')](handleEntityNotFound(_0x21669b,null))[_0xe988('0x25')](removeEntity(_0x21669b,null))[_0xe988('0x47')](handleError(_0x21669b,null));}; \ No newline at end of file +var _0x4215=['fields','length','hasOwnProperty','order','sort','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','merge','create','body','find','eml-format','fast-json-patch','moment','bluebird','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','offset','undefined','limit','count','status','Content-Range','json','apply','save','update','then','destroy','end','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes'];(function(_0x2ddb96,_0x5e6282){var _0x5123a8=function(_0x41b084){while(--_0x41b084){_0x2ddb96['push'](_0x2ddb96['shift']());}};_0x5123a8(++_0x5e6282);}(_0x4215,0x177));var _0x5421=function(_0x55b351,_0x1bb062){_0x55b351=_0x55b351-0x0;var _0x3f684f=_0x4215[_0x55b351];return _0x3f684f;};'use strict';var emlformat=require(_0x5421('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5421('0x1'));var rp=require('request-promise');var moment=require(_0x5421('0x2'));var BPromise=require(_0x5421('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5421('0x4'));var sox=require('sox');var csv=require(_0x5421('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5421('0x6'));var _=require('lodash');var squel=require(_0x5421('0x7'));var crypto=require(_0x5421('0x8'));var jsforce=require(_0x5421('0x9'));var deskjs=require(_0x5421('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5421('0xb'));var Redis=require('ioredis');var authService=require(_0x5421('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x5421('0xd'));var hardwareService=require(_0x5421('0xe'));var logger=require(_0x5421('0xf'))(_0x5421('0x10'));var utils=require('../../config/utils');var config=require(_0x5421('0x11'));var licenseUtil=require(_0x5421('0x12'));var db=require(_0x5421('0x13'))['db'];function respondWithStatusCode(_0x276791,_0x4cc7a2){_0x4cc7a2=_0x4cc7a2||0xcc;return function(_0x59acd4){if(_0x59acd4){return _0x276791[_0x5421('0x14')](_0x4cc7a2);}return _0x276791['status'](_0x4cc7a2)['end']();};}function respondWithResult(_0x414eae,_0x4927e9){_0x4927e9=_0x4927e9||0xc8;return function(_0x21aae0){if(_0x21aae0){return _0x414eae['status'](_0x4927e9)['json'](_0x21aae0);}};}function respondWithFilteredResult(_0x26a339,_0x5a93d7){return function(_0x24b0d6){if(_0x24b0d6){var _0x1817bd=typeof _0x5a93d7[_0x5421('0x15')]===_0x5421('0x16')&&typeof _0x5a93d7[_0x5421('0x17')]===_0x5421('0x16');var _0x1677e6=_0x24b0d6[_0x5421('0x18')];var _0x4b6363=_0x1817bd?0x0:_0x5a93d7[_0x5421('0x15')];var _0x1374f7=_0x1817bd?_0x24b0d6[_0x5421('0x18')]:_0x5a93d7['offset']+_0x5a93d7[_0x5421('0x17')];var _0x4fa14f;if(_0x1374f7>=_0x1677e6){_0x1374f7=_0x1677e6;_0x4fa14f=0xc8;}else{_0x4fa14f=0xce;}_0x26a339[_0x5421('0x19')](_0x4fa14f);return _0x26a339['set'](_0x5421('0x1a'),_0x4b6363+'-'+_0x1374f7+'/'+_0x1677e6)[_0x5421('0x1b')](_0x24b0d6);}return null;};}function patchUpdates(_0x32f712){return function(_0x4ae481){try{jsonpatch[_0x5421('0x1c')](_0x4ae481,_0x32f712,!![]);}catch(_0x5d36a5){return BPromise['reject'](_0x5d36a5);}return _0x4ae481[_0x5421('0x1d')]();};}function saveUpdates(_0x5155c2,_0x5f1a2a){return function(_0xa0525f){if(_0xa0525f){return _0xa0525f[_0x5421('0x1e')](_0x5155c2)[_0x5421('0x1f')](function(_0x1f2ac2){return _0x1f2ac2;});}return null;};}function removeEntity(_0x4a7f78,_0x39f83c){return function(_0x3a9a7c){if(_0x3a9a7c){return _0x3a9a7c[_0x5421('0x20')]()['then'](function(){_0x4a7f78['status'](0xcc)[_0x5421('0x21')]();});}};}function handleEntityNotFound(_0x357bc6,_0x5d1bf7){return function(_0x51420c){if(!_0x51420c){_0x357bc6[_0x5421('0x14')](0x194);}return _0x51420c;};}function handleError(_0x3fc242,_0x31108a){_0x31108a=_0x31108a||0x1f4;return function(_0x465b78){logger[_0x5421('0x22')](_0x465b78[_0x5421('0x23')]);if(_0x465b78['name']){delete _0x465b78[_0x5421('0x24')];}_0x3fc242[_0x5421('0x19')](_0x31108a)[_0x5421('0x25')](_0x465b78);};}exports[_0x5421('0x26')]=function(_0x3821f4,_0x108517){var _0x1bf01d={},_0x2a9928={},_0x3ac3d7={'count':0x0,'rows':[]};var _0x2ca360=_[_0x5421('0x27')](db[_0x5421('0x28')][_0x5421('0x29')],function(_0x2b889d){return{'name':_0x2b889d[_0x5421('0x2a')],'type':_0x2b889d[_0x5421('0x2b')][_0x5421('0x2c')]};});_0x2a9928['model']=_[_0x5421('0x27')](_0x2ca360,_0x5421('0x24'));_0x2a9928[_0x5421('0x2d')]=_[_0x5421('0x2e')](_0x3821f4[_0x5421('0x2d')]);_0x2a9928[_0x5421('0x2f')]=_[_0x5421('0x30')](_0x2a9928[_0x5421('0x31')],_0x2a9928[_0x5421('0x2d')]);_0x1bf01d[_0x5421('0x32')]=_[_0x5421('0x30')](_0x2a9928['model'],qs['fields'](_0x3821f4[_0x5421('0x2d')][_0x5421('0x33')]));_0x1bf01d['attributes']=_0x1bf01d[_0x5421('0x32')][_0x5421('0x34')]?_0x1bf01d[_0x5421('0x32')]:_0x2a9928['model'];if(!_0x3821f4[_0x5421('0x2d')][_0x5421('0x35')]('nolimit')){_0x1bf01d['limit']=qs[_0x5421('0x17')](_0x3821f4[_0x5421('0x2d')][_0x5421('0x17')]);_0x1bf01d['offset']=qs['offset'](_0x3821f4['query'][_0x5421('0x15')]);}_0x1bf01d[_0x5421('0x36')]=qs[_0x5421('0x37')](_0x3821f4[_0x5421('0x2d')][_0x5421('0x37')]);_0x1bf01d[_0x5421('0x38')]=qs[_0x5421('0x2f')](_['pick'](_0x3821f4['query'],_0x2a9928[_0x5421('0x2f')]),_0x2ca360);if(_0x3821f4[_0x5421('0x2d')]['filter']){_0x1bf01d[_0x5421('0x38')]=_['merge'](_0x1bf01d[_0x5421('0x38')],{'$or':_['map'](_0x2ca360,function(_0x36f2a2){if(_0x36f2a2[_0x5421('0x2b')]!==_0x5421('0x39')){var _0x333fca={};_0x333fca[_0x36f2a2[_0x5421('0x24')]]={'$like':'%'+_0x3821f4[_0x5421('0x2d')][_0x5421('0x3a')]+'%'};return _0x333fca;}})});}_0x1bf01d=_['merge']({},_0x1bf01d,_0x3821f4[_0x5421('0x3b')]);var _0x17fd9d={'where':_0x1bf01d[_0x5421('0x38')]};return db[_0x5421('0x28')][_0x5421('0x18')](_0x17fd9d)[_0x5421('0x1f')](function(_0x154814){_0x3ac3d7['count']=_0x154814;if(_0x3821f4[_0x5421('0x2d')][_0x5421('0x3c')]){_0x1bf01d[_0x5421('0x3d')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0x5421('0x3e')](_0x1bf01d);})[_0x5421('0x1f')](function(_0x544df8){_0x3ac3d7[_0x5421('0x3f')]=_0x544df8;return _0x3ac3d7;})[_0x5421('0x1f')](respondWithFilteredResult(_0x108517,_0x1bf01d))[_0x5421('0x40')](handleError(_0x108517,null));};exports[_0x5421('0x41')]=function(_0x12bd5c,_0x1b8358){var _0x23bb04={'raw':!![],'where':{'id':_0x12bd5c[_0x5421('0x42')]['id']}},_0x2bbbe8={};_0x2bbbe8['model']=_[_0x5421('0x2e')](db[_0x5421('0x28')][_0x5421('0x29')]);_0x2bbbe8[_0x5421('0x2d')]=_[_0x5421('0x2e')](_0x12bd5c[_0x5421('0x2d')]);_0x2bbbe8[_0x5421('0x2f')]=_[_0x5421('0x30')](_0x2bbbe8[_0x5421('0x31')],_0x2bbbe8['query']);_0x23bb04[_0x5421('0x32')]=_[_0x5421('0x30')](_0x2bbbe8[_0x5421('0x31')],qs[_0x5421('0x33')](_0x12bd5c[_0x5421('0x2d')][_0x5421('0x33')]));_0x23bb04[_0x5421('0x32')]=_0x23bb04['attributes'][_0x5421('0x34')]?_0x23bb04[_0x5421('0x32')]:_0x2bbbe8[_0x5421('0x31')];if(_0x12bd5c[_0x5421('0x2d')]['includeAll']){_0x23bb04[_0x5421('0x3d')]=[{'all':!![]}];}_0x23bb04=_[_0x5421('0x43')]({},_0x23bb04,_0x12bd5c[_0x5421('0x3b')]);return db[_0x5421('0x28')]['find'](_0x23bb04)[_0x5421('0x1f')](handleEntityNotFound(_0x1b8358,null))[_0x5421('0x1f')](respondWithResult(_0x1b8358,null))[_0x5421('0x40')](handleError(_0x1b8358,null));};exports[_0x5421('0x44')]=function(_0x382b93,_0x34fbb9){return db[_0x5421('0x28')][_0x5421('0x44')](_0x382b93[_0x5421('0x45')],{})[_0x5421('0x1f')](respondWithResult(_0x34fbb9,0xc9))['catch'](handleError(_0x34fbb9,null));};exports['update']=function(_0x4d9ac5,_0x92ea9e){if(_0x4d9ac5[_0x5421('0x45')]['id']){delete _0x4d9ac5[_0x5421('0x45')]['id'];}return db['OpenchannelApplication'][_0x5421('0x46')]({'where':{'id':_0x4d9ac5['params']['id']}})[_0x5421('0x1f')](handleEntityNotFound(_0x92ea9e,null))[_0x5421('0x1f')](saveUpdates(_0x4d9ac5[_0x5421('0x45')],null))['then'](respondWithResult(_0x92ea9e,null))[_0x5421('0x40')](handleError(_0x92ea9e,null));};exports[_0x5421('0x20')]=function(_0x3340ac,_0x4b4059){return db[_0x5421('0x28')]['find']({'where':{'id':_0x3340ac[_0x5421('0x42')]['id']}})[_0x5421('0x1f')](handleEntityNotFound(_0x4b4059,null))[_0x5421('0x1f')](removeEntity(_0x4b4059,null))[_0x5421('0x40')](handleError(_0x4b4059,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index d219b0a..bdd4372 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 _0xfb8f=['./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x5289e0,_0x52f6f8){var _0x2e9b84=function(_0x908dda){while(--_0x908dda){_0x5289e0['push'](_0x5289e0['shift']());}};_0x2e9b84(++_0x52f6f8);}(_0xfb8f,0xf1));var _0xffb8=function(_0x1dc8f8,_0x1d5fb8){_0x1dc8f8=_0x1dc8f8-0x0;var _0x271cd0=_0xfb8f[_0x1dc8f8];return _0x271cd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xffb8('0x0'))(_0xffb8('0x1'));var moment=require(_0xffb8('0x2'));var BPromise=require(_0xffb8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xffb8('0x4'));var rimraf=require(_0xffb8('0x5'));var config=require('../../config/environment');var attributes=require(_0xffb8('0x6'));module[_0xffb8('0x7')]=function(_0x5b8f72,_0x5b27ae){return _0x5b8f72[_0xffb8('0x8')](_0xffb8('0x9'),attributes,{'tableName':_0xffb8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xffb8('0xb'),'collate':_0xffb8('0xc')});}; \ No newline at end of file +var _0x64e2=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelApplication.attributes','exports','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0xab3033,_0x4e9a4c){var _0x34fd8c=function(_0x2fd63d){while(--_0x2fd63d){_0xab3033['push'](_0xab3033['shift']());}};_0x34fd8c(++_0x4e9a4c);}(_0x64e2,0x177));var _0x264e=function(_0xbc847d,_0x2779bc){_0xbc847d=_0xbc847d-0x0;var _0x85712=_0x64e2[_0xbc847d];return _0x85712;};'use strict';var _=require('lodash');var util=require(_0x264e('0x0'));var logger=require(_0x264e('0x1'))(_0x264e('0x2'));var moment=require(_0x264e('0x3'));var BPromise=require(_0x264e('0x4'));var rp=require(_0x264e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x264e('0x6'));var config=require(_0x264e('0x7'));var attributes=require(_0x264e('0x8'));module[_0x264e('0x9')]=function(_0x3dfca6,_0x1a5200){return _0x3dfca6['define']('OpenchannelApplication',attributes,{'tableName':_0x264e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x264e('0xb'),'collate':_0x264e('0xc')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 5c3ead5..09e40d6 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 _0x4c3f=['stringify','error','code','message','catch','update','body','options','raw','attributes','limit','UpdateOpenchannelApplication','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x4c3f,0x1ce));var _0xf4c3=function(_0x320ac2,_0x2ac963){_0x320ac2=_0x320ac2-0x0;var _0x1c0885=_0x4c3f[_0x320ac2];return _0x1c0885;};'use strict';var _=require('lodash');var util=require(_0xf4c3('0x0'));var moment=require(_0xf4c3('0x1'));var BPromise=require(_0xf4c3('0x2'));var rs=require(_0xf4c3('0x3'));var fs=require('fs');var Redis=require(_0xf4c3('0x4'));var db=require(_0xf4c3('0x5'))['db'];var utils=require(_0xf4c3('0x6'));var logger=require(_0xf4c3('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf4c3('0x8'));var client=jayson[_0xf4c3('0x9')][_0xf4c3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4931ae,_0x32ccc8,_0x4e1e33){return new BPromise(function(_0x56b70d,_0x5d5308){return client[_0xf4c3('0xb')](_0x4931ae,_0x4e1e33)[_0xf4c3('0xc')](function(_0x56edfb){logger[_0xf4c3('0xd')](_0xf4c3('0xe'),_0x32ccc8,'request\x20sent');logger[_0xf4c3('0xf')](_0xf4c3('0x10'),_0x32ccc8,_0xf4c3('0x11'),JSON[_0xf4c3('0x12')](_0x56edfb));if(_0x56edfb[_0xf4c3('0x13')]){if(_0x56edfb[_0xf4c3('0x13')][_0xf4c3('0x14')]===0x1f4){logger['error'](_0xf4c3('0xe'),_0x32ccc8,_0x56edfb[_0xf4c3('0x13')]['message']);return _0x5d5308(_0x56edfb[_0xf4c3('0x13')][_0xf4c3('0x15')]);}logger[_0xf4c3('0x13')](_0xf4c3('0xe'),_0x32ccc8,_0x56edfb['error'][_0xf4c3('0x15')]);return _0x56b70d(_0x56edfb[_0xf4c3('0x13')][_0xf4c3('0x15')]);}else{logger['info'](_0xf4c3('0xe'),_0x32ccc8,_0xf4c3('0x11'));_0x56b70d(_0x56edfb['result']['message']);}})[_0xf4c3('0x16')](function(_0x219b90){logger[_0xf4c3('0x13')](_0xf4c3('0xe'),_0x32ccc8,_0x219b90);_0x5d5308(_0x219b90);});});}exports['UpdateOpenchannelApplication']=function(_0x29929c){var _0x2553cd=this;return new Promise(function(_0x50a9b8,_0x1340b8){return db['OpenchannelApplication'][_0xf4c3('0x17')](_0x29929c[_0xf4c3('0x18')],{'raw':_0x29929c[_0xf4c3('0x19')]?_0x29929c[_0xf4c3('0x19')][_0xf4c3('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x29929c['options']?_0x29929c[_0xf4c3('0x19')]['where']||null:null,'attributes':_0x29929c['options']?_0x29929c[_0xf4c3('0x19')][_0xf4c3('0x1b')]||null:null,'limit':_0x29929c[_0xf4c3('0x19')]?_0x29929c[_0xf4c3('0x19')][_0xf4c3('0x1c')]||null:null})[_0xf4c3('0xc')](function(_0x31bed8){logger[_0xf4c3('0xd')]('UpdateOpenchannelApplication',_0x29929c);logger['debug'](_0xf4c3('0x1d'),_0x29929c,JSON[_0xf4c3('0x12')](_0x31bed8));_0x50a9b8(_0x31bed8);})['catch'](function(_0x3bdc85){logger[_0xf4c3('0x13')](_0xf4c3('0x1d'),_0x3bdc85['message'],_0x29929c);_0x1340b8(_0x2553cd['error'](0x1f4,_0x3bdc85['message']));});});}; \ No newline at end of file +var _0x8990=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x4334af,_0x21e066){var _0xec5be0=function(_0x1ee788){while(--_0x1ee788){_0x4334af['push'](_0x4334af['shift']());}};_0xec5be0(++_0x21e066);}(_0x8990,0x143));var _0x0899=function(_0x3ff4a3,_0xa5bfa6){_0x3ff4a3=_0x3ff4a3-0x0;var _0x38676f=_0x8990[_0x3ff4a3];return _0x38676f;};'use strict';var _=require(_0x0899('0x0'));var util=require(_0x0899('0x1'));var moment=require(_0x0899('0x2'));var BPromise=require(_0x0899('0x3'));var rs=require(_0x0899('0x4'));var fs=require('fs');var Redis=require(_0x0899('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0899('0x6'));var logger=require(_0x0899('0x7'))('rpc');var config=require(_0x0899('0x8'));var jayson=require(_0x0899('0x9'));var client=jayson[_0x0899('0xa')][_0x0899('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58a502,_0x3e01d2,_0x4f13bb){return new BPromise(function(_0x8fb9a1,_0xf153db){return client[_0x0899('0xc')](_0x58a502,_0x4f13bb)[_0x0899('0xd')](function(_0x120b4d){logger[_0x0899('0xe')](_0x0899('0xf'),_0x3e01d2,_0x0899('0x10'));logger[_0x0899('0x11')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x3e01d2,_0x0899('0x10'),JSON['stringify'](_0x120b4d));if(_0x120b4d[_0x0899('0x12')]){if(_0x120b4d[_0x0899('0x12')][_0x0899('0x13')]===0x1f4){logger[_0x0899('0x12')](_0x0899('0xf'),_0x3e01d2,_0x120b4d[_0x0899('0x12')][_0x0899('0x14')]);return _0xf153db(_0x120b4d[_0x0899('0x12')][_0x0899('0x14')]);}logger[_0x0899('0x12')](_0x0899('0xf'),_0x3e01d2,_0x120b4d[_0x0899('0x12')][_0x0899('0x14')]);return _0x8fb9a1(_0x120b4d[_0x0899('0x12')][_0x0899('0x14')]);}else{logger[_0x0899('0xe')](_0x0899('0xf'),_0x3e01d2,_0x0899('0x10'));_0x8fb9a1(_0x120b4d[_0x0899('0x15')][_0x0899('0x14')]);}})[_0x0899('0x16')](function(_0x23b6f2){logger[_0x0899('0x12')](_0x0899('0xf'),_0x3e01d2,_0x23b6f2);_0xf153db(_0x23b6f2);});});}exports[_0x0899('0x17')]=function(_0x2a4f93){var _0x198934=this;return new Promise(function(_0x3c8ea4,_0x11f4c9){return db[_0x0899('0x18')][_0x0899('0x19')](_0x2a4f93[_0x0899('0x1a')],{'raw':_0x2a4f93[_0x0899('0x1b')]?_0x2a4f93['options'][_0x0899('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a4f93[_0x0899('0x1b')]?_0x2a4f93['options']['where']||null:null,'attributes':_0x2a4f93[_0x0899('0x1b')]?_0x2a4f93[_0x0899('0x1b')][_0x0899('0x1d')]||null:null,'limit':_0x2a4f93['options']?_0x2a4f93['options']['limit']||null:null})['then'](function(_0x2630a2){logger['info'](_0x0899('0x17'),_0x2a4f93);logger[_0x0899('0x11')](_0x0899('0x17'),_0x2a4f93,JSON['stringify'](_0x2630a2));_0x3c8ea4(_0x2630a2);})['catch'](function(_0x18d562){logger[_0x0899('0x12')]('UpdateOpenchannelApplication',_0x18d562[_0x0899('0x14')],_0x2a4f93);_0x11f4c9(_0x198934['error'](0x1f4,_0x18d562['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index b203b4c..7eaf0b7 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 _0x71e0=['openchannelinteraction:destroy','destroy','removeTags','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','/describe','isAuthenticated','describe','/:id','show','getMessages','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','delete'];(function(_0x29ba90,_0x3e0e02){var _0x56fba6=function(_0x247ab7){while(--_0x247ab7){_0x29ba90['push'](_0x29ba90['shift']());}};_0x56fba6(++_0x3e0e02);}(_0x71e0,0x19c));var _0x071e=function(_0x33a648,_0x330835){_0x33a648=_0x33a648-0x0;var _0x275a05=_0x71e0[_0x33a648];return _0x275a05;};'use strict';var multer=require(_0x071e('0x0'));var util=require('util');var path=require(_0x071e('0x1'));var timeout=require(_0x071e('0x2'));var express=require(_0x071e('0x3'));var router=express[_0x071e('0x4')]();var fs_extra=require(_0x071e('0x5'));var auth=require(_0x071e('0x6'));var interaction=require(_0x071e('0x7'));var config=require(_0x071e('0x8'));var controller=require(_0x071e('0x9'));router[_0x071e('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x071e('0xa')](_0x071e('0xb'),auth[_0x071e('0xc')](),controller[_0x071e('0xd')]);router[_0x071e('0xa')](_0x071e('0xe'),auth[_0x071e('0xc')](),controller[_0x071e('0xf')]);router[_0x071e('0xa')]('/:id/messages',auth['isAuthenticated'](),controller[_0x071e('0x10')]);router['get']('/:id/download',auth[_0x071e('0xc')](),controller[_0x071e('0x11')]);router[_0x071e('0x12')]('/',auth['isAuthenticated'](),controller[_0x071e('0x13')]);router[_0x071e('0x12')](_0x071e('0x14'),auth[_0x071e('0xc')](),controller[_0x071e('0x15')]);router['post'](_0x071e('0x16'),auth[_0x071e('0xc')](),interaction[_0x071e('0x17')](_0x071e('0x18'),_0x071e('0x19')),controller[_0x071e('0x1a')]);router[_0x071e('0x1b')](_0x071e('0xe'),auth['isAuthenticated'](),interaction['tracked'](_0x071e('0x18'),_0x071e('0x1c')),controller['update']);router[_0x071e('0x1d')]('/:id',auth['isAuthenticated'](),interaction[_0x071e('0x17')]('openchannel',_0x071e('0x1e')),controller[_0x071e('0x1f')]);router[_0x071e('0x1d')](_0x071e('0x16'),auth[_0x071e('0xc')](),controller[_0x071e('0x20')]);module[_0x071e('0x21')]=router; \ No newline at end of file +var _0xa671=['update','delete','openchannelinteraction:destroy','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/messages','/:id/download','download','create','addMessage','post','/:id/tags','tracked','openchannelinteraction:addtags','addTags','put','openchannel'];(function(_0x49c493,_0x46f3e0){var _0x3fa0b4=function(_0x42b445){while(--_0x42b445){_0x49c493['push'](_0x49c493['shift']());}};_0x3fa0b4(++_0x46f3e0);}(_0xa671,0x1a5));var _0x1a67=function(_0x2fcf16,_0x344dcb){_0x2fcf16=_0x2fcf16-0x0;var _0x54013e=_0xa671[_0x2fcf16];return _0x54013e;};'use strict';var multer=require(_0x1a67('0x0'));var util=require(_0x1a67('0x1'));var path=require(_0x1a67('0x2'));var timeout=require(_0x1a67('0x3'));var express=require(_0x1a67('0x4'));var router=express['Router']();var fs_extra=require(_0x1a67('0x5'));var auth=require(_0x1a67('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1a67('0x7'));var controller=require(_0x1a67('0x8'));router[_0x1a67('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1a67('0x9')](_0x1a67('0xa'),auth[_0x1a67('0xb')](),controller[_0x1a67('0xc')]);router[_0x1a67('0x9')](_0x1a67('0xd'),auth[_0x1a67('0xb')](),controller[_0x1a67('0xe')]);router[_0x1a67('0x9')](_0x1a67('0xf'),auth[_0x1a67('0xb')](),controller['getMessages']);router['get'](_0x1a67('0x10'),auth[_0x1a67('0xb')](),controller[_0x1a67('0x11')]);router['post']('/',auth[_0x1a67('0xb')](),controller[_0x1a67('0x12')]);router['post'](_0x1a67('0xf'),auth[_0x1a67('0xb')](),controller[_0x1a67('0x13')]);router[_0x1a67('0x14')](_0x1a67('0x15'),auth[_0x1a67('0xb')](),interaction[_0x1a67('0x16')]('openchannel',_0x1a67('0x17')),controller[_0x1a67('0x18')]);router[_0x1a67('0x19')](_0x1a67('0xd'),auth[_0x1a67('0xb')](),interaction['tracked'](_0x1a67('0x1a'),'openchannelinteraction:update'),controller[_0x1a67('0x1b')]);router[_0x1a67('0x1c')]('/:id',auth[_0x1a67('0xb')](),interaction[_0x1a67('0x16')](_0x1a67('0x1a'),_0x1a67('0x1d')),controller[_0x1a67('0x1e')]);router[_0x1a67('0x1c')](_0x1a67('0x15'),auth[_0x1a67('0xb')](),controller['removeTags']);module[_0x1a67('0x1f')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index d18604d..c191da7 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 _0xca8d=['exports','BOOLEAN','DATE','STRING','out','ENUM','sequelize'];(function(_0x5c2c7c,_0xa7d3b1){var _0xea7ffe=function(_0x471f17){while(--_0x471f17){_0x5c2c7c['push'](_0x5c2c7c['shift']());}};_0xea7ffe(++_0xa7d3b1);}(_0xca8d,0x172));var _0xdca8=function(_0x4456a2,_0x376ff2){_0x4456a2=_0x4456a2-0x0;var _0xf36b56=_0xca8d[_0x4456a2];return _0xf36b56;};'use strict';var Sequelize=require(_0xdca8('0x0'));module[_0xdca8('0x1')]={'closed':{'type':Sequelize[_0xdca8('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xdca8('0x3')]},'disposition':{'type':Sequelize[_0xdca8('0x4')]},'secondDisposition':{'type':Sequelize[_0xdca8('0x4')]},'thirdDisposition':{'type':Sequelize[_0xdca8('0x4')]},'note':{'type':Sequelize[_0xdca8('0x4')]},'read1stAt':{'type':Sequelize[_0xdca8('0x3')]},'threadId':{'type':Sequelize[_0xdca8('0x4')]},'externalUrl':{'type':Sequelize[_0xdca8('0x4')]},'lastMsgAt':{'type':Sequelize[_0xdca8('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xdca8('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xdca8('0x6')]('in',_0xdca8('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xdca8('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0xdca8('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x447b=['STRING','ENUM','out','BOOLEAN','sequelize','exports','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x447b,0xe4));var _0xb447=function(_0xd366e0,_0x327ac5){_0xd366e0=_0xd366e0-0x0;var _0x3b64b1=_0x447b[_0xd366e0];return _0x3b64b1;};'use strict';var Sequelize=require(_0xb447('0x0'));module[_0xb447('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb447('0x2')]},'disposition':{'type':Sequelize[_0xb447('0x3')]},'secondDisposition':{'type':Sequelize[_0xb447('0x3')]},'thirdDisposition':{'type':Sequelize[_0xb447('0x3')]},'note':{'type':Sequelize[_0xb447('0x3')]},'read1stAt':{'type':Sequelize[_0xb447('0x2')]},'threadId':{'type':Sequelize[_0xb447('0x3')]},'externalUrl':{'type':Sequelize[_0xb447('0x3')]},'lastMsgAt':{'type':Sequelize[_0xb447('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xb447('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xb447('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0xb447('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index a75f920..a15f36e 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 _0xaaa5=['transcript-%d-%s.zip','User','fullname','push','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','get','mkdirSync','Openchannel','Account','Owner','N.A.','closed','Public','createReadStream','pipe','createWriteStream','basename','out','System','value','renderFile','downloadInteraction.ejs','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','zip-dir','moment','util','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','update','destroy','then','error','name','send','map','OpenchannelInteraction','rawAttributes','fieldName','type','getOptions','openchannel','query','user','catch','show','from','params','keys','filters','intersection','model','attributes','fields','include','merge','find','create','body','describe','OpenchannelMessage','addMessage','ids','omit','getMessages','findOne','nolimit','order','sort','where','pick','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','findAll','rows','addTags','spread','Tag','color','emit','removeTags','download','unix','toString','root','server','files','tmp','attachments','join'];(function(_0xd81bf1,_0x58675a){var _0xa9d5c5=function(_0x4fb6e6){while(--_0x4fb6e6){_0xd81bf1['push'](_0xd81bf1['shift']());}};_0xa9d5c5(++_0x58675a);}(_0xaaa5,0x124));var _0x5aaa=function(_0x2c9fd9,_0x1fd6fd){_0x2c9fd9=_0x2c9fd9-0x0;var _0x16a39b=_0xaaa5[_0x2c9fd9];return _0x16a39b;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x5aaa('0x0'));var moment=require(_0x5aaa('0x1'));var util=require(_0x5aaa('0x2'));var path=require('path');var ejs=require(_0x5aaa('0x3'));var fs=require('fs');var _=require(_0x5aaa('0x4'));var Redis=require('ioredis');var interaction=require(_0x5aaa('0x5'));var qs=require(_0x5aaa('0x6'));var pdf=require(_0x5aaa('0x7'));var logger=require(_0x5aaa('0x8'))(_0x5aaa('0x9'));var config=require(_0x5aaa('0xa'));var db=require(_0x5aaa('0xb'))['db'];config[_0x5aaa('0xc')]=_[_0x5aaa('0xd')](config['redis'],{'host':_0x5aaa('0xe'),'port':0x18eb});var socket=require(_0x5aaa('0xf'))(new Redis(config[_0x5aaa('0xc')]));require(_0x5aaa('0x10'))[_0x5aaa('0x11')](socket);function respondWithStatusCode(_0x2b0d64,_0x33d630){_0x33d630=_0x33d630||0xcc;return function(_0x558a88){if(_0x558a88){return _0x2b0d64[_0x5aaa('0x12')](_0x33d630);}return _0x2b0d64[_0x5aaa('0x13')](_0x33d630)[_0x5aaa('0x14')]();};}function respondWithResult(_0x2a9604,_0xcd044c){_0xcd044c=_0xcd044c||0xc8;return function(_0x1ac7fe){if(_0x1ac7fe){return _0x2a9604[_0x5aaa('0x13')](_0xcd044c)[_0x5aaa('0x15')](_0x1ac7fe);}};}function respondWithFilteredResult(_0x41bed7,_0x462510){return function(_0x2e98b1){if(_0x2e98b1){var _0x516764=typeof _0x462510[_0x5aaa('0x16')]===_0x5aaa('0x17')&&typeof _0x462510[_0x5aaa('0x18')]===_0x5aaa('0x17');var _0x5eea41=_0x2e98b1[_0x5aaa('0x19')];var _0x14aa83=_0x516764?0x0:_0x462510[_0x5aaa('0x16')];var _0x1e084e=_0x516764?_0x2e98b1[_0x5aaa('0x19')]:_0x462510['offset']+_0x462510[_0x5aaa('0x18')];var _0x69ac28;if(_0x1e084e>=_0x5eea41){_0x1e084e=_0x5eea41;_0x69ac28=0xc8;}else{_0x69ac28=0xce;}_0x41bed7[_0x5aaa('0x13')](_0x69ac28);return _0x41bed7[_0x5aaa('0x1a')]('Content-Range',_0x14aa83+'-'+_0x1e084e+'/'+_0x5eea41)[_0x5aaa('0x15')](_0x2e98b1);}return null;};}function saveUpdates(_0x13069f){return function(_0x1bba7e){if(_0x1bba7e){return _0x1bba7e[_0x5aaa('0x1b')](_0x13069f)['then'](function(_0x138c33){return _0x138c33;});}return null;};}function removeEntity(_0x404e5a){return function(_0x140809){if(_0x140809){return _0x140809[_0x5aaa('0x1c')]()[_0x5aaa('0x1d')](function(){_0x404e5a[_0x5aaa('0x13')](0xcc)[_0x5aaa('0x14')]();});}};}function handleEntityNotFound(_0x2d8069){return function(_0x3462b7){if(!_0x3462b7){_0x2d8069[_0x5aaa('0x12')](0x194);}return _0x3462b7;};}function handleError(_0x5790c5,_0x57e580){_0x57e580=_0x57e580||0x1f4;return function(_0x63218e){logger[_0x5aaa('0x1e')](_0x63218e['stack']);if(_0x63218e[_0x5aaa('0x1f')]){delete _0x63218e[_0x5aaa('0x1f')];}_0x5790c5[_0x5aaa('0x13')](_0x57e580)[_0x5aaa('0x20')](_0x63218e);};}exports['index']=function(_0x492ea3,_0x13d17b){var _0x40dc9c={};var _0x5b3ddb=_[_0x5aaa('0x21')](db[_0x5aaa('0x22')][_0x5aaa('0x23')],function(_0x40e2a8){return{'name':_0x40e2a8[_0x5aaa('0x24')],'type':_0x40e2a8[_0x5aaa('0x25')]['key']};});_0x40dc9c=qs[_0x5aaa('0x26')](_0x5b3ddb,_0x492ea3);return interaction['findAll'](_0x5aaa('0x27'),_0x492ea3[_0x5aaa('0x28')],_0x492ea3[_0x5aaa('0x29')],_0x40dc9c,_0x5b3ddb)[_0x5aaa('0x1d')](respondWithFilteredResult(_0x13d17b,_0x40dc9c))[_0x5aaa('0x2a')](handleError(_0x13d17b,null));};exports[_0x5aaa('0x2b')]=function(_0x24e419,_0x376bfd){var _0x1c02a5={};if(_0x24e419[_0x5aaa('0x28')][_0x5aaa('0x25')]&&_0x24e419['query'][_0x5aaa('0x25')]==='from'){_0x1c02a5[_0x5aaa('0x2c')]=_0x24e419[_0x5aaa('0x2d')]['id'];}else{_0x1c02a5['id']=_0x24e419[_0x5aaa('0x2d')]['id'];}var _0x114510={'raw':![],'where':_0x1c02a5},_0x3ab770={};_0x3ab770['model']=_[_0x5aaa('0x2e')](db['OpenchannelInteraction'][_0x5aaa('0x23')]);_0x3ab770[_0x5aaa('0x28')]=_[_0x5aaa('0x2e')](_0x24e419[_0x5aaa('0x28')]);_0x3ab770[_0x5aaa('0x2f')]=_[_0x5aaa('0x30')](_0x3ab770[_0x5aaa('0x31')],_0x3ab770[_0x5aaa('0x28')]);_0x114510[_0x5aaa('0x32')]=_[_0x5aaa('0x30')](_0x3ab770['model'],qs['fields'](_0x24e419[_0x5aaa('0x28')][_0x5aaa('0x33')]));_0x114510[_0x5aaa('0x32')]=_0x114510[_0x5aaa('0x32')]['length']?_0x114510[_0x5aaa('0x32')]:_0x3ab770['model'];if(_0x24e419[_0x5aaa('0x28')]['includeAll']){_0x114510[_0x5aaa('0x34')]=[{'all':!![]}];}_0x114510=_[_0x5aaa('0x35')]({},_0x114510,_0x24e419['options']);return db[_0x5aaa('0x22')][_0x5aaa('0x36')](_0x114510)['then'](handleEntityNotFound(_0x376bfd,null))[_0x5aaa('0x1d')](respondWithResult(_0x376bfd,null))[_0x5aaa('0x2a')](handleError(_0x376bfd,null));};exports[_0x5aaa('0x37')]=function(_0x59d414,_0x5b3424){return db['OpenchannelInteraction'][_0x5aaa('0x37')](_0x59d414[_0x5aaa('0x38')],{})[_0x5aaa('0x1d')](respondWithResult(_0x5b3424,0xc9))['catch'](handleError(_0x5b3424,null));};exports[_0x5aaa('0x1b')]=function(_0x3c1893,_0x474926){if(_0x3c1893[_0x5aaa('0x38')]['id']){delete _0x3c1893[_0x5aaa('0x38')]['id'];}return db[_0x5aaa('0x22')][_0x5aaa('0x36')]({'where':{'id':_0x3c1893[_0x5aaa('0x2d')]['id']}})[_0x5aaa('0x1d')](handleEntityNotFound(_0x474926,null))[_0x5aaa('0x1d')](saveUpdates(_0x3c1893[_0x5aaa('0x38')],null))[_0x5aaa('0x1d')](respondWithResult(_0x474926,null))['catch'](handleError(_0x474926,null));};exports[_0x5aaa('0x1c')]=function(_0x470973,_0x25924f){return db[_0x5aaa('0x22')]['find']({'where':{'id':_0x470973[_0x5aaa('0x2d')]['id']}})[_0x5aaa('0x1d')](handleEntityNotFound(_0x25924f,null))['then'](removeEntity(_0x25924f,null))[_0x5aaa('0x2a')](handleError(_0x25924f,null));};exports[_0x5aaa('0x39')]=function(_0x1e4a48,_0x2b99b0){return db[_0x5aaa('0x22')][_0x5aaa('0x39')]()[_0x5aaa('0x1d')](respondWithResult(_0x2b99b0,null))[_0x5aaa('0x2a')](handleError(_0x2b99b0,null));};exports['addMessage']=function(_0x28eb13,_0x2a910b){return db[_0x5aaa('0x3a')]['find']({'where':{'id':_0x28eb13[_0x5aaa('0x2d')]['id']}})['then'](handleEntityNotFound(_0x2a910b,null))[_0x5aaa('0x1d')](function(_0x574651){if(_0x574651){return _0x574651[_0x5aaa('0x3b')](_0x28eb13['body'][_0x5aaa('0x3c')],_[_0x5aaa('0x3d')](_0x28eb13[_0x5aaa('0x38')],['ids','id'])||{});}})[_0x5aaa('0x1d')](respondWithResult(_0x2a910b,null))[_0x5aaa('0x2a')](handleError(_0x2a910b,null));};exports[_0x5aaa('0x3e')]=function(_0x523f33,_0x5553ef){var _0x2b19eb={'raw':![],'where':{}};var _0x438c4c={};var _0x4544b9={'count':0x0,'rows':[]};return db[_0x5aaa('0x22')][_0x5aaa('0x3f')]({'where':{'id':_0x523f33['params']['id']}})[_0x5aaa('0x1d')](handleEntityNotFound(_0x5553ef,null))[_0x5aaa('0x1d')](function(_0x59e98d){if(_0x59e98d){_0x438c4c['model']=_[_0x5aaa('0x2e')](db['OpenchannelMessage'][_0x5aaa('0x23')]);_0x438c4c[_0x5aaa('0x28')]=_[_0x5aaa('0x2e')](_0x523f33['query']);_0x438c4c['filters']=_[_0x5aaa('0x30')](_0x438c4c[_0x5aaa('0x31')],_0x438c4c[_0x5aaa('0x28')]);_0x2b19eb[_0x5aaa('0x32')]=_[_0x5aaa('0x30')](_0x438c4c[_0x5aaa('0x31')],qs[_0x5aaa('0x33')](_0x523f33[_0x5aaa('0x28')][_0x5aaa('0x33')]));_0x2b19eb['attributes']=_0x2b19eb[_0x5aaa('0x32')]['length']?_0x2b19eb[_0x5aaa('0x32')]:_0x438c4c[_0x5aaa('0x31')];if(!_0x523f33[_0x5aaa('0x28')]['hasOwnProperty'](_0x5aaa('0x40'))){_0x2b19eb[_0x5aaa('0x18')]=qs[_0x5aaa('0x18')](_0x523f33['query'][_0x5aaa('0x18')]);_0x2b19eb[_0x5aaa('0x16')]=qs['offset'](_0x523f33[_0x5aaa('0x28')][_0x5aaa('0x16')]);}_0x2b19eb[_0x5aaa('0x41')]=qs[_0x5aaa('0x42')](_0x523f33['query'][_0x5aaa('0x42')]);_0x2b19eb[_0x5aaa('0x43')]=qs[_0x5aaa('0x2f')](_[_0x5aaa('0x44')](_0x523f33[_0x5aaa('0x28')],_0x438c4c['filters']));_0x2b19eb[_0x5aaa('0x43')]['OpenchannelInteractionId']=_0x59e98d['id'];if(_0x523f33['query'][_0x5aaa('0x45')]){_0x2b19eb[_0x5aaa('0x43')]=_[_0x5aaa('0x35')](_0x2b19eb[_0x5aaa('0x43')],{'$or':_[_0x5aaa('0x21')](_0x2b19eb[_0x5aaa('0x32')],function(_0x3fa2f9){var _0x3e7b94={};_0x3e7b94[_0x3fa2f9]={'$like':'%'+_0x523f33[_0x5aaa('0x28')][_0x5aaa('0x45')]+'%'};return _0x3e7b94;})});}if(_0x523f33['query']['$gte']){var _0x366014=_0x523f33[_0x5aaa('0x28')][_0x5aaa('0x46')]['split'](',');var _0x2d0227={};_0x2d0227[_0x366014[0x0]]={'$gte':moment(_0x366014[0x1])[_0x5aaa('0x47')](_0x5aaa('0x48'))};_0x2b19eb['where']=_['merge'](_0x2b19eb[_0x5aaa('0x43')],_0x2d0227);}_0x2b19eb=_[_0x5aaa('0x35')]({},_0x2b19eb,_0x523f33[_0x5aaa('0x49')]);return db[_0x5aaa('0x3a')]['count']({'where':_0x2b19eb[_0x5aaa('0x43')]})[_0x5aaa('0x1d')](function(_0x29ae9d){_0x4544b9[_0x5aaa('0x19')]=_0x29ae9d;if(_0x523f33['query'][_0x5aaa('0x4a')]){_0x2b19eb[_0x5aaa('0x34')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x5aaa('0x4b')](_0x2b19eb);})[_0x5aaa('0x1d')](function(_0x46a053){_0x4544b9[_0x5aaa('0x4c')]=_0x46a053;return _0x4544b9;});}})[_0x5aaa('0x1d')](respondWithFilteredResult(_0x5553ef,_0x2b19eb))[_0x5aaa('0x2a')](handleError(_0x5553ef,null));};exports[_0x5aaa('0x4d')]=function(_0x4c930e,_0x431f93){return db[_0x5aaa('0x22')][_0x5aaa('0x36')]({'where':{'id':_0x4c930e[_0x5aaa('0x2d')]['id']}})[_0x5aaa('0x1d')](handleEntityNotFound(_0x431f93,null))[_0x5aaa('0x1d')](function(_0x4b5ba9){if(_0x4b5ba9){return _0x4b5ba9['setTags'](_0x4c930e[_0x5aaa('0x38')][_0x5aaa('0x3c')],_[_0x5aaa('0x3d')](_0x4c930e[_0x5aaa('0x38')],['ids','id'])||{})[_0x5aaa('0x4e')](function(){return db[_0x5aaa('0x4f')][_0x5aaa('0x4b')]({'attributes':['id',_0x5aaa('0x1f'),_0x5aaa('0x50')],'where':{'id':_0x4c930e['body'][_0x5aaa('0x3c')]}});})['then'](function(_0x26224c){socket[_0x5aaa('0x51')]('openchannelInteractionTags:save',{'id':Number(_0x4c930e['params']['id']),'tags':_0x26224c||[]});return{'id':Number(_0x4c930e['params']['id']),'tags':_0x26224c||[]};});}})[_0x5aaa('0x1d')](respondWithResult(_0x431f93,null))['catch'](handleError(_0x431f93,null));};exports[_0x5aaa('0x52')]=function(_0x3f34cb,_0x52fe1e){return db[_0x5aaa('0x22')]['find']({'where':{'id':_0x3f34cb[_0x5aaa('0x2d')]['id']}})[_0x5aaa('0x1d')](handleEntityNotFound(_0x52fe1e,null))[_0x5aaa('0x1d')](function(_0x6938cb){if(_0x6938cb){return _0x6938cb['removeTags'](_0x3f34cb['query'][_0x5aaa('0x3c')]);}})[_0x5aaa('0x1d')](respondWithStatusCode(_0x52fe1e,null))[_0x5aaa('0x2a')](handleError(_0x52fe1e,null));};exports[_0x5aaa('0x53')]=function(_0x460c5b,_0x2feb5f){var _0x120942=moment()[_0x5aaa('0x54')]()[_0x5aaa('0x55')]();var _0x5b1192=path['join'](config[_0x5aaa('0x56')],_0x5aaa('0x57'),_0x5aaa('0x58'),_0x5aaa('0x59'));var _0x3a8c80=path['join'](config['root'],_0x5aaa('0x57'),_0x5aaa('0x58'),_0x5aaa('0x5a'));var _0x1143e6=path[_0x5aaa('0x5b')](_0x5b1192,_0x120942);var _0x3a5d25=util[_0x5aaa('0x47')](_0x5aaa('0x5c'),_0x460c5b['params']['id'],_0x120942);var _0x9a0ea2=path[_0x5aaa('0x5b')](_0x5b1192,_0x3a5d25);var _0x327548=[];_0x327548['push']({'model':db[_0x5aaa('0x5d')],'as':'User','attributes':['id',_0x5aaa('0x5e')],'raw':!![]});_0x327548[_0x5aaa('0x5f')]({'model':db[_0x5aaa('0x60')],'as':_0x5aaa('0x61'),'attributes':['id',_0x5aaa('0x62'),_0x5aaa('0x63')],'raw':!![]});if(_0x460c5b[_0x5aaa('0x28')][_0x5aaa('0x5a')]){_0x327548['push']({'model':db['Attachment'],'as':_0x5aaa('0x64'),'raw':!![]});}var _0xb59109=[{'model':db[_0x5aaa('0x3a')],'as':_0x5aaa('0x65'),'attributes':['id',_0x5aaa('0x38'),_0x5aaa('0x66'),_0x5aaa('0x67'),_0x5aaa('0x68'),_0x5aaa('0x69')],'include':_0x327548}];_0xb59109[_0x5aaa('0x5f')]({'model':db[_0x5aaa('0x6a')],'as':'Account','attributes':['id',_0x5aaa('0x1f')]});_0xb59109[_0x5aaa('0x5f')]({'model':db[_0x5aaa('0x5d')],'as':'Owner','attributes':['id',_0x5aaa('0x5e')]});return db[_0x5aaa('0x22')][_0x5aaa('0x36')]({'where':{'id':_0x460c5b[_0x5aaa('0x2d')]['id']},'include':_0xb59109})[_0x5aaa('0x1d')](handleEntityNotFound(_0x2feb5f,null))[_0x5aaa('0x1d')](function(_0x4f7d5a){if(_0x4f7d5a){var _0x1baaf6=_0x4f7d5a[_0x5aaa('0x6b')]({'plain':!![]});fs[_0x5aaa('0x6c')](_0x1143e6);var _0x59d6b9={'channel':_0x5aaa('0x6d'),'account':_0x1baaf6[_0x5aaa('0x6e')][_0x5aaa('0x1f')],'agent':_0x1baaf6[_0x5aaa('0x6f')]?_0x1baaf6[_0x5aaa('0x6f')][_0x5aaa('0x5e')]:_0x5aaa('0x70'),'createdAt':moment(_0x1baaf6[_0x5aaa('0x66')])['format'](_0x5aaa('0x48'))[_0x5aaa('0x55')](),'closedAt':_0x1baaf6[_0x5aaa('0x71')]?moment(_0x1baaf6['closedAt'])[_0x5aaa('0x47')]('YYYY-MM-DD\x20HH:mm:ss')[_0x5aaa('0x55')]():'','disposition':_0x1baaf6['disposition'],'visibility':_0x1baaf6['threadId']?_0x5aaa('0x72'):'Private','messages':_(_0x1baaf6['Messages'])['filter']({'secret':![]})[_0x5aaa('0x21')](function(_0x9a0ca){if(_0x9a0ca['Attachment']){var _0x2e25fe=path[_0x5aaa('0x5b')](_0x3a8c80,_0x9a0ca[_0x5aaa('0x64')]['basename']);if(fs['existsSync'](_0x2e25fe)){fs[_0x5aaa('0x73')](_0x2e25fe)[_0x5aaa('0x74')](fs[_0x5aaa('0x75')](path[_0x5aaa('0x5b')](_0x1143e6,_0x9a0ca[_0x5aaa('0x64')][_0x5aaa('0x76')])));}}return{'date':moment(_0x9a0ca['createdAt'])[_0x5aaa('0x47')](_0x5aaa('0x48'))[_0x5aaa('0x55')](),'sender':_0x9a0ca[_0x5aaa('0x67')]===_0x5aaa('0x77')?_0x9a0ca[_0x5aaa('0x5d')]?_0x9a0ca['User'][_0x5aaa('0x5e')]:_0x5aaa('0x78'):_0x9a0ca[_0x5aaa('0x61')][_0x5aaa('0x62')]+(_0x9a0ca[_0x5aaa('0x61')]['lastName']?'\x20'+_0x9a0ca[_0x5aaa('0x61')][_0x5aaa('0x63')]:''),'body':_0x9a0ca[_0x5aaa('0x64')]?_0x9a0ca['Attachment'][_0x5aaa('0x76')]:_0x9a0ca['body'],'direction':_0x9a0ca[_0x5aaa('0x67')]===_0x5aaa('0x77')?'A':'C','secret':_0x9a0ca[_0x5aaa('0x68')],'read':_0x9a0ca[_0x5aaa('0x69')],'attachment':_0x9a0ca[_0x5aaa('0x64')]};})[_0x5aaa('0x79')]()};return ejs[_0x5aaa('0x7a')](path[_0x5aaa('0x5b')](config['root'],_0x5aaa('0x57'),'views',_0x5aaa('0x7b')),{'interaction':_0x59d6b9})[_0x5aaa('0x1d')](function(_0x4048ec){var _0x431817=path[_0x5aaa('0x5b')](_0x1143e6,'transcript-'+_0x1baaf6['id']+'-'+_0x120942+_0x5aaa('0x7c'));var _0x30c959={'path':_0x431817,'channel':_0x5aaa('0x6d'),'interactionId':_0x1baaf6['id']};return pdf[_0x5aaa('0x7d')](_0x4048ec,_0x30c959);})[_0x5aaa('0x1d')](function(){return new Promise(function(_0x243cff,_0x5cafd4){zipdir(_0x1143e6,{'saveTo':_0x9a0ea2},function(_0x1fcd23,_0xeb88b5){if(_0x1fcd23)return _0x5cafd4(_0x1fcd23);return _0x243cff(_0xeb88b5);});})[_0x5aaa('0x1d')](function(){return new Promise(function(_0x3838a1,_0x20369b){rimraf(_0x1143e6,function(_0x11b6e7){if(_0x11b6e7)_0x20369b(_0x11b6e7);return _0x3838a1();});});})['then'](function(){return _0x2feb5f[_0x5aaa('0x53')](_0x9a0ea2,_0x3a5d25,function(_0x3ff913){if(_0x3ff913){logger[_0x5aaa('0x1e')](_0x5aaa('0x7e'),_0x3ff913);}else{fs[_0x5aaa('0x7f')](_0x9a0ea2);}});});});}else{return _0x2feb5f[_0x5aaa('0x12')](0xc8);}})[_0x5aaa('0x2a')](handleError(_0x2feb5f,null));}; \ No newline at end of file +var _0xa998=['removeTags','download','join','root','files','tmp','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','secret','read','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','createdAt','toString','closed','closedAt','disposition','threadId','Public','Attachment','basename','pipe','createWriteStream','direction','out','System','value','server','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','zip-dir','moment','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','update','then','destroy','error','stack','index','map','OpenchannelInteraction','rawAttributes','fieldName','type','key','findAll','openchannel','query','user','catch','show','from','params','model','keys','filters','attributes','intersection','fields','length','options','create','body','find','describe','ids','omit','getMessages','findOne','order','sort','where','pick','OpenchannelInteractionId','merge','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','OpenchannelMessage','includeAll','rows','addTags','setTags','name','color','emit'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0xa998,0xa1));var _0x8a99=function(_0x5834be,_0x15935c){_0x5834be=_0x5834be-0x0;var _0x4a89a1=_0xa998[_0x5834be];return _0x4a89a1;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x8a99('0x0'));var moment=require(_0x8a99('0x1'));var util=require('util');var path=require('path');var ejs=require(_0x8a99('0x2'));var fs=require('fs');var _=require(_0x8a99('0x3'));var Redis=require(_0x8a99('0x4'));var interaction=require(_0x8a99('0x5'));var qs=require(_0x8a99('0x6'));var pdf=require(_0x8a99('0x7'));var logger=require(_0x8a99('0x8'))('api');var config=require(_0x8a99('0x9'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x8a99('0xa')](config['redis'],{'host':_0x8a99('0xb'),'port':0x18eb});var socket=require(_0x8a99('0xc'))(new Redis(config['redis']));require(_0x8a99('0xd'))[_0x8a99('0xe')](socket);function respondWithStatusCode(_0x2d53a7,_0x3c6080){_0x3c6080=_0x3c6080||0xcc;return function(_0x56bced){if(_0x56bced){return _0x2d53a7[_0x8a99('0xf')](_0x3c6080);}return _0x2d53a7[_0x8a99('0x10')](_0x3c6080)[_0x8a99('0x11')]();};}function respondWithResult(_0x4d322a,_0x30d28d){_0x30d28d=_0x30d28d||0xc8;return function(_0x1b3fe3){if(_0x1b3fe3){return _0x4d322a[_0x8a99('0x10')](_0x30d28d)['json'](_0x1b3fe3);}};}function respondWithFilteredResult(_0x1334fd,_0x15e620){return function(_0x2d3973){if(_0x2d3973){var _0x5ab62a=typeof _0x15e620[_0x8a99('0x12')]==='undefined'&&typeof _0x15e620[_0x8a99('0x13')]===_0x8a99('0x14');var _0x559844=_0x2d3973[_0x8a99('0x15')];var _0x556ed=_0x5ab62a?0x0:_0x15e620[_0x8a99('0x12')];var _0x1e38f7=_0x5ab62a?_0x2d3973['count']:_0x15e620[_0x8a99('0x12')]+_0x15e620[_0x8a99('0x13')];var _0x520e54;if(_0x1e38f7>=_0x559844){_0x1e38f7=_0x559844;_0x520e54=0xc8;}else{_0x520e54=0xce;}_0x1334fd[_0x8a99('0x10')](_0x520e54);return _0x1334fd[_0x8a99('0x16')](_0x8a99('0x17'),_0x556ed+'-'+_0x1e38f7+'/'+_0x559844)['json'](_0x2d3973);}return null;};}function saveUpdates(_0x230de2){return function(_0x856875){if(_0x856875){return _0x856875[_0x8a99('0x18')](_0x230de2)[_0x8a99('0x19')](function(_0x3fe271){return _0x3fe271;});}return null;};}function removeEntity(_0x23eeab){return function(_0x17fa63){if(_0x17fa63){return _0x17fa63[_0x8a99('0x1a')]()[_0x8a99('0x19')](function(){_0x23eeab[_0x8a99('0x10')](0xcc)[_0x8a99('0x11')]();});}};}function handleEntityNotFound(_0x165d12){return function(_0x19a39f){if(!_0x19a39f){_0x165d12[_0x8a99('0xf')](0x194);}return _0x19a39f;};}function handleError(_0x58f70a,_0x753f80){_0x753f80=_0x753f80||0x1f4;return function(_0x5efc08){logger[_0x8a99('0x1b')](_0x5efc08[_0x8a99('0x1c')]);if(_0x5efc08['name']){delete _0x5efc08['name'];}_0x58f70a[_0x8a99('0x10')](_0x753f80)['send'](_0x5efc08);};}exports[_0x8a99('0x1d')]=function(_0x5b9962,_0x253e84){var _0x29aff8={};var _0x43a369=_[_0x8a99('0x1e')](db[_0x8a99('0x1f')][_0x8a99('0x20')],function(_0xe97a28){return{'name':_0xe97a28[_0x8a99('0x21')],'type':_0xe97a28[_0x8a99('0x22')][_0x8a99('0x23')]};});_0x29aff8=qs['getOptions'](_0x43a369,_0x5b9962);return interaction[_0x8a99('0x24')](_0x8a99('0x25'),_0x5b9962[_0x8a99('0x26')],_0x5b9962[_0x8a99('0x27')],_0x29aff8,_0x43a369)['then'](respondWithFilteredResult(_0x253e84,_0x29aff8))[_0x8a99('0x28')](handleError(_0x253e84,null));};exports[_0x8a99('0x29')]=function(_0x589ee4,_0x1d9106){var _0x114721={};if(_0x589ee4[_0x8a99('0x26')]['type']&&_0x589ee4[_0x8a99('0x26')][_0x8a99('0x22')]==='from'){_0x114721[_0x8a99('0x2a')]=_0x589ee4[_0x8a99('0x2b')]['id'];}else{_0x114721['id']=_0x589ee4['params']['id'];}var _0x89ed51={'raw':![],'where':_0x114721},_0x6f402d={};_0x6f402d[_0x8a99('0x2c')]=_['keys'](db[_0x8a99('0x1f')][_0x8a99('0x20')]);_0x6f402d['query']=_[_0x8a99('0x2d')](_0x589ee4[_0x8a99('0x26')]);_0x6f402d[_0x8a99('0x2e')]=_['intersection'](_0x6f402d[_0x8a99('0x2c')],_0x6f402d['query']);_0x89ed51[_0x8a99('0x2f')]=_[_0x8a99('0x30')](_0x6f402d['model'],qs[_0x8a99('0x31')](_0x589ee4[_0x8a99('0x26')][_0x8a99('0x31')]));_0x89ed51[_0x8a99('0x2f')]=_0x89ed51[_0x8a99('0x2f')][_0x8a99('0x32')]?_0x89ed51[_0x8a99('0x2f')]:_0x6f402d[_0x8a99('0x2c')];if(_0x589ee4[_0x8a99('0x26')]['includeAll']){_0x89ed51['include']=[{'all':!![]}];}_0x89ed51=_['merge']({},_0x89ed51,_0x589ee4[_0x8a99('0x33')]);return db[_0x8a99('0x1f')]['find'](_0x89ed51)[_0x8a99('0x19')](handleEntityNotFound(_0x1d9106,null))['then'](respondWithResult(_0x1d9106,null))['catch'](handleError(_0x1d9106,null));};exports['create']=function(_0x45e0ee,_0x250374){return db['OpenchannelInteraction'][_0x8a99('0x34')](_0x45e0ee[_0x8a99('0x35')],{})[_0x8a99('0x19')](respondWithResult(_0x250374,0xc9))[_0x8a99('0x28')](handleError(_0x250374,null));};exports[_0x8a99('0x18')]=function(_0x4d3915,_0x22af14){if(_0x4d3915[_0x8a99('0x35')]['id']){delete _0x4d3915[_0x8a99('0x35')]['id'];}return db['OpenchannelInteraction'][_0x8a99('0x36')]({'where':{'id':_0x4d3915[_0x8a99('0x2b')]['id']}})[_0x8a99('0x19')](handleEntityNotFound(_0x22af14,null))[_0x8a99('0x19')](saveUpdates(_0x4d3915[_0x8a99('0x35')],null))[_0x8a99('0x19')](respondWithResult(_0x22af14,null))[_0x8a99('0x28')](handleError(_0x22af14,null));};exports[_0x8a99('0x1a')]=function(_0x5988f3,_0x34cf4b){return db[_0x8a99('0x1f')]['find']({'where':{'id':_0x5988f3[_0x8a99('0x2b')]['id']}})[_0x8a99('0x19')](handleEntityNotFound(_0x34cf4b,null))[_0x8a99('0x19')](removeEntity(_0x34cf4b,null))[_0x8a99('0x28')](handleError(_0x34cf4b,null));};exports[_0x8a99('0x37')]=function(_0x204a77,_0x3ea9ee){return db['OpenchannelInteraction']['describe']()[_0x8a99('0x19')](respondWithResult(_0x3ea9ee,null))['catch'](handleError(_0x3ea9ee,null));};exports['addMessage']=function(_0x9ea990,_0x2c4b9f){return db['OpenchannelMessage'][_0x8a99('0x36')]({'where':{'id':_0x9ea990[_0x8a99('0x2b')]['id']}})[_0x8a99('0x19')](handleEntityNotFound(_0x2c4b9f,null))['then'](function(_0x221bb0){if(_0x221bb0){return _0x221bb0['addMessage'](_0x9ea990[_0x8a99('0x35')][_0x8a99('0x38')],_[_0x8a99('0x39')](_0x9ea990[_0x8a99('0x35')],[_0x8a99('0x38'),'id'])||{});}})['then'](respondWithResult(_0x2c4b9f,null))[_0x8a99('0x28')](handleError(_0x2c4b9f,null));};exports[_0x8a99('0x3a')]=function(_0x1156c9,_0x23e978){var _0x175f2e={'raw':![],'where':{}};var _0x2bf788={};var _0x5ea3ff={'count':0x0,'rows':[]};return db[_0x8a99('0x1f')][_0x8a99('0x3b')]({'where':{'id':_0x1156c9[_0x8a99('0x2b')]['id']}})[_0x8a99('0x19')](handleEntityNotFound(_0x23e978,null))['then'](function(_0x53d4ad){if(_0x53d4ad){_0x2bf788['model']=_[_0x8a99('0x2d')](db['OpenchannelMessage']['rawAttributes']);_0x2bf788['query']=_[_0x8a99('0x2d')](_0x1156c9[_0x8a99('0x26')]);_0x2bf788[_0x8a99('0x2e')]=_[_0x8a99('0x30')](_0x2bf788[_0x8a99('0x2c')],_0x2bf788[_0x8a99('0x26')]);_0x175f2e['attributes']=_[_0x8a99('0x30')](_0x2bf788[_0x8a99('0x2c')],qs['fields'](_0x1156c9[_0x8a99('0x26')][_0x8a99('0x31')]));_0x175f2e[_0x8a99('0x2f')]=_0x175f2e[_0x8a99('0x2f')][_0x8a99('0x32')]?_0x175f2e[_0x8a99('0x2f')]:_0x2bf788[_0x8a99('0x2c')];if(!_0x1156c9[_0x8a99('0x26')]['hasOwnProperty']('nolimit')){_0x175f2e[_0x8a99('0x13')]=qs[_0x8a99('0x13')](_0x1156c9[_0x8a99('0x26')][_0x8a99('0x13')]);_0x175f2e['offset']=qs['offset'](_0x1156c9[_0x8a99('0x26')][_0x8a99('0x12')]);}_0x175f2e[_0x8a99('0x3c')]=qs[_0x8a99('0x3d')](_0x1156c9[_0x8a99('0x26')][_0x8a99('0x3d')]);_0x175f2e[_0x8a99('0x3e')]=qs[_0x8a99('0x2e')](_[_0x8a99('0x3f')](_0x1156c9[_0x8a99('0x26')],_0x2bf788['filters']));_0x175f2e[_0x8a99('0x3e')][_0x8a99('0x40')]=_0x53d4ad['id'];if(_0x1156c9['query']['filter']){_0x175f2e[_0x8a99('0x3e')]=_[_0x8a99('0x41')](_0x175f2e[_0x8a99('0x3e')],{'$or':_['map'](_0x175f2e[_0x8a99('0x2f')],function(_0x4e56dc){var _0x542499={};_0x542499[_0x4e56dc]={'$like':'%'+_0x1156c9[_0x8a99('0x26')][_0x8a99('0x42')]+'%'};return _0x542499;})});}if(_0x1156c9[_0x8a99('0x26')][_0x8a99('0x43')]){var _0x3f0cb0=_0x1156c9['query'][_0x8a99('0x43')][_0x8a99('0x44')](',');var _0x114040={};_0x114040[_0x3f0cb0[0x0]]={'$gte':moment(_0x3f0cb0[0x1])[_0x8a99('0x45')](_0x8a99('0x46'))};_0x175f2e['where']=_['merge'](_0x175f2e[_0x8a99('0x3e')],_0x114040);}_0x175f2e=_[_0x8a99('0x41')]({},_0x175f2e,_0x1156c9[_0x8a99('0x33')]);return db[_0x8a99('0x47')][_0x8a99('0x15')]({'where':_0x175f2e[_0x8a99('0x3e')]})[_0x8a99('0x19')](function(_0x105d43){_0x5ea3ff['count']=_0x105d43;if(_0x1156c9[_0x8a99('0x26')][_0x8a99('0x48')]){_0x175f2e['include']=[{'all':!![]}];}return db[_0x8a99('0x47')][_0x8a99('0x24')](_0x175f2e);})['then'](function(_0x506d39){_0x5ea3ff[_0x8a99('0x49')]=_0x506d39;return _0x5ea3ff;});}})[_0x8a99('0x19')](respondWithFilteredResult(_0x23e978,_0x175f2e))[_0x8a99('0x28')](handleError(_0x23e978,null));};exports[_0x8a99('0x4a')]=function(_0x3c277b,_0x2ddfa6){return db[_0x8a99('0x1f')]['find']({'where':{'id':_0x3c277b[_0x8a99('0x2b')]['id']}})[_0x8a99('0x19')](handleEntityNotFound(_0x2ddfa6,null))[_0x8a99('0x19')](function(_0x25ca43){if(_0x25ca43){return _0x25ca43[_0x8a99('0x4b')](_0x3c277b['body'][_0x8a99('0x38')],_['omit'](_0x3c277b[_0x8a99('0x35')],[_0x8a99('0x38'),'id'])||{})['spread'](function(){return db['Tag'][_0x8a99('0x24')]({'attributes':['id',_0x8a99('0x4c'),_0x8a99('0x4d')],'where':{'id':_0x3c277b['body'][_0x8a99('0x38')]}});})[_0x8a99('0x19')](function(_0x932342){socket[_0x8a99('0x4e')]('openchannelInteractionTags:save',{'id':Number(_0x3c277b['params']['id']),'tags':_0x932342||[]});return{'id':Number(_0x3c277b[_0x8a99('0x2b')]['id']),'tags':_0x932342||[]};});}})[_0x8a99('0x19')](respondWithResult(_0x2ddfa6,null))['catch'](handleError(_0x2ddfa6,null));};exports['removeTags']=function(_0x365471,_0xe03545){return db[_0x8a99('0x1f')]['find']({'where':{'id':_0x365471[_0x8a99('0x2b')]['id']}})[_0x8a99('0x19')](handleEntityNotFound(_0xe03545,null))[_0x8a99('0x19')](function(_0x3fa7fb){if(_0x3fa7fb){return _0x3fa7fb[_0x8a99('0x4f')](_0x365471['query'][_0x8a99('0x38')]);}})[_0x8a99('0x19')](respondWithStatusCode(_0xe03545,null))[_0x8a99('0x28')](handleError(_0xe03545,null));};exports[_0x8a99('0x50')]=function(_0x178c9b,_0xec9548){var _0xc6e15e=moment()['unix']()['toString']();var _0x45fabf=path[_0x8a99('0x51')](config[_0x8a99('0x52')],'server',_0x8a99('0x53'),_0x8a99('0x54'));var _0x68cd5=path[_0x8a99('0x51')](config[_0x8a99('0x52')],'server','files','attachments');var _0x569d09=path[_0x8a99('0x51')](_0x45fabf,_0xc6e15e);var _0x2e5e45=util[_0x8a99('0x45')](_0x8a99('0x55'),_0x178c9b[_0x8a99('0x2b')]['id'],_0xc6e15e);var _0x1ad8dd=path['join'](_0x45fabf,_0x2e5e45);var _0x3847be=[];_0x3847be[_0x8a99('0x56')]({'model':db[_0x8a99('0x57')],'as':_0x8a99('0x57'),'attributes':['id',_0x8a99('0x58')],'raw':!![]});_0x3847be['push']({'model':db[_0x8a99('0x59')],'as':_0x8a99('0x5a'),'attributes':['id',_0x8a99('0x5b'),_0x8a99('0x5c')],'raw':!![]});if(_0x178c9b[_0x8a99('0x26')]['attachments']){_0x3847be['push']({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x159635=[{'model':db[_0x8a99('0x47')],'as':'Messages','attributes':['id',_0x8a99('0x35'),'createdAt','direction',_0x8a99('0x5d'),_0x8a99('0x5e')],'include':_0x3847be}];_0x159635['push']({'model':db[_0x8a99('0x5f')],'as':_0x8a99('0x60'),'attributes':['id',_0x8a99('0x4c')]});_0x159635['push']({'model':db[_0x8a99('0x57')],'as':_0x8a99('0x61'),'attributes':['id',_0x8a99('0x58')]});return db[_0x8a99('0x1f')]['find']({'where':{'id':_0x178c9b[_0x8a99('0x2b')]['id']},'include':_0x159635})[_0x8a99('0x19')](handleEntityNotFound(_0xec9548,null))[_0x8a99('0x19')](function(_0x4f1ce3){if(_0x4f1ce3){var _0x46e9b6=_0x4f1ce3[_0x8a99('0x62')]({'plain':!![]});fs[_0x8a99('0x63')](_0x569d09);var _0x43c038={'channel':_0x8a99('0x64'),'account':_0x46e9b6[_0x8a99('0x60')][_0x8a99('0x4c')],'agent':_0x46e9b6[_0x8a99('0x61')]?_0x46e9b6[_0x8a99('0x61')][_0x8a99('0x58')]:_0x8a99('0x65'),'createdAt':moment(_0x46e9b6[_0x8a99('0x66')])[_0x8a99('0x45')](_0x8a99('0x46'))[_0x8a99('0x67')](),'closedAt':_0x46e9b6[_0x8a99('0x68')]?moment(_0x46e9b6[_0x8a99('0x69')])[_0x8a99('0x45')](_0x8a99('0x46'))['toString']():'','disposition':_0x46e9b6[_0x8a99('0x6a')],'visibility':_0x46e9b6[_0x8a99('0x6b')]?_0x8a99('0x6c'):'Private','messages':_(_0x46e9b6['Messages'])[_0x8a99('0x42')]({'secret':![]})['map'](function(_0x5220fa){if(_0x5220fa[_0x8a99('0x6d')]){var _0x99dc55=path['join'](_0x68cd5,_0x5220fa['Attachment'][_0x8a99('0x6e')]);if(fs['existsSync'](_0x99dc55)){fs['createReadStream'](_0x99dc55)[_0x8a99('0x6f')](fs[_0x8a99('0x70')](path[_0x8a99('0x51')](_0x569d09,_0x5220fa[_0x8a99('0x6d')][_0x8a99('0x6e')])));}}return{'date':moment(_0x5220fa['createdAt'])[_0x8a99('0x45')](_0x8a99('0x46'))['toString'](),'sender':_0x5220fa[_0x8a99('0x71')]===_0x8a99('0x72')?_0x5220fa[_0x8a99('0x57')]?_0x5220fa[_0x8a99('0x57')][_0x8a99('0x58')]:_0x8a99('0x73'):_0x5220fa['Contact'][_0x8a99('0x5b')]+(_0x5220fa[_0x8a99('0x5a')][_0x8a99('0x5c')]?'\x20'+_0x5220fa['Contact'][_0x8a99('0x5c')]:''),'body':_0x5220fa['Attachment']?_0x5220fa[_0x8a99('0x6d')][_0x8a99('0x6e')]:_0x5220fa[_0x8a99('0x35')],'direction':_0x5220fa[_0x8a99('0x71')]===_0x8a99('0x72')?'A':'C','secret':_0x5220fa[_0x8a99('0x5d')],'read':_0x5220fa[_0x8a99('0x5e')],'attachment':_0x5220fa[_0x8a99('0x6d')]};})[_0x8a99('0x74')]()};return ejs['renderFile'](path[_0x8a99('0x51')](config[_0x8a99('0x52')],_0x8a99('0x75'),'views','downloadInteraction.ejs'),{'interaction':_0x43c038})[_0x8a99('0x19')](function(_0x3ad09f){var _0x138adc=path[_0x8a99('0x51')](_0x569d09,'transcript-'+_0x46e9b6['id']+'-'+_0xc6e15e+'.pdf');var _0x3a93cd={'path':_0x138adc,'channel':_0x8a99('0x64'),'interactionId':_0x46e9b6['id']};return pdf['createPdfFromHTML'](_0x3ad09f,_0x3a93cd);})['then'](function(){return new Promise(function(_0x5f0f9f,_0x14f853){zipdir(_0x569d09,{'saveTo':_0x1ad8dd},function(_0x57eaf5,_0x5939d3){if(_0x57eaf5)return _0x14f853(_0x57eaf5);return _0x5f0f9f(_0x5939d3);});})[_0x8a99('0x19')](function(){return new Promise(function(_0x131967,_0x31e351){rimraf(_0x569d09,function(_0x55efe0){if(_0x55efe0)_0x31e351(_0x55efe0);return _0x131967();});});})[_0x8a99('0x19')](function(){return _0xec9548[_0x8a99('0x50')](_0x1ad8dd,_0x2e5e45,function(_0x3ac5e7){if(_0x3ac5e7){logger[_0x8a99('0x1b')](_0x8a99('0x76'),_0x3ac5e7);}else{fs[_0x8a99('0x77')](_0x1ad8dd);}});});});}else{return _0xec9548['sendStatus'](0xc8);}})['catch'](handleError(_0xec9548,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index a73b827..b660632 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 _0x625d=['findAll','setDataValue','unreadMessages','length','emit','hook','events','../../mysqldb','setMaxListeners','save','update','remove','then','Users'];(function(_0x55f721,_0x199542){var _0x9322c1=function(_0x39d6f0){while(--_0x39d6f0){_0x55f721['push'](_0x55f721['shift']());}};_0x9322c1(++_0x199542);}(_0x625d,0xf4));var _0xd625=function(_0x177385,_0x323024){_0x177385=_0x177385-0x0;var _0x1d4376=_0x625d[_0x177385];return _0x1d4376;};'use strict';var EventEmitter=require(_0xd625('0x0'));var OpenchannelInteraction=require(_0xd625('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0xd625('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xd625('0x2')](0x0);var events={'afterCreate':_0xd625('0x3'),'afterUpdate':_0xd625('0x4'),'afterDestroy':_0xd625('0x5')};function emitEvent(_0x178d23){return function(_0x5466f1,_0x11ab7c,_0x3de24f){_0x5466f1['getUsers']({'attributes':['id'],'raw':!![]})[_0xd625('0x6')](function(_0x264db2){_0x5466f1['setDataValue'](_0xd625('0x7'),_0x264db2['map'](function(_0x2bbca4){return{'id':_0x2bbca4['id']};}));return OpenchannelMessage[_0xd625('0x8')]({'where':{'OpenchannelInteractionId':_0x5466f1['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd625('0x6')](function(_0x32f1e4){_0x5466f1[_0xd625('0x9')](_0xd625('0xa'),_0x32f1e4[_0xd625('0xb')]);OpenchannelInteractionEvents[_0xd625('0xc')](_0x178d23+':'+_0x5466f1['id'],_0x5466f1);OpenchannelInteractionEvents['emit'](_0x178d23,_0x5466f1);_0x3de24f(null);})['catch'](_0x3de24f(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0xd625('0xd')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0xc03d=['Users','map','findAll','length','emit','catch','hasOwnProperty','hook','exports','OpenchannelInteraction','setMaxListeners','save','update','then','setDataValue'];(function(_0x3c4bfa,_0x31d957){var _0x401e2d=function(_0x4e0d42){while(--_0x4e0d42){_0x3c4bfa['push'](_0x3c4bfa['shift']());}};_0x401e2d(++_0x31d957);}(_0xc03d,0x1bc));var _0xdc03=function(_0x219b9b,_0x2ac230){_0x219b9b=_0x219b9b-0x0;var _0x3a13ec=_0xc03d[_0x219b9b];return _0x3a13ec;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require('../../mysqldb')['db'][_0xdc03('0x0')];var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xdc03('0x1')](0x0);var events={'afterCreate':_0xdc03('0x2'),'afterUpdate':_0xdc03('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5737c4){return function(_0x2f4892,_0x3d1045,_0x9c633){_0x2f4892['getUsers']({'attributes':['id'],'raw':!![]})[_0xdc03('0x4')](function(_0x5793f1){_0x2f4892[_0xdc03('0x5')](_0xdc03('0x6'),_0x5793f1[_0xdc03('0x7')](function(_0x55bd33){return{'id':_0x55bd33['id']};}));return OpenchannelMessage[_0xdc03('0x8')]({'where':{'OpenchannelInteractionId':_0x2f4892['id'],'direction':'in','read':![]},'raw':!![]});})[_0xdc03('0x4')](function(_0x3bb292){_0x2f4892[_0xdc03('0x5')]('unreadMessages',_0x3bb292[_0xdc03('0x9')]);OpenchannelInteractionEvents[_0xdc03('0xa')](_0x5737c4+':'+_0x2f4892['id'],_0x2f4892);OpenchannelInteractionEvents[_0xdc03('0xa')](_0x5737c4,_0x2f4892);_0x9c633(null);})[_0xdc03('0xb')](_0x9c633(null));};}for(var e in events){if(events[_0xdc03('0xc')](e)){var event=events[e];OpenchannelInteraction[_0xdc03('0xd')](e,emitEvent(event));}}module[_0xdc03('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 46e67f2..87e4509 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 _0x0d8e=['exports','define','utf8mb4_unicode_ci','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./openchannelInteraction.attributes'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0d8e,0x1e6));var _0xe0d8=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x0d8e[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xe0d8('0x0'));var util=require(_0xe0d8('0x1'));var logger=require(_0xe0d8('0x2'))(_0xe0d8('0x3'));var moment=require(_0xe0d8('0x4'));var BPromise=require(_0xe0d8('0x5'));var rp=require(_0xe0d8('0x6'));var fs=require('fs');var path=require(_0xe0d8('0x7'));var rimraf=require(_0xe0d8('0x8'));var config=require('../../config/environment');var attributes=require(_0xe0d8('0x9'));module[_0xe0d8('0xa')]=function(_0x1bec84,_0x3c52a1){return _0x1bec84[_0xe0d8('0xb')]('OpenchannelInteraction',attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xe0d8('0xc'),'hooks':{'beforeUpdate':function(_0x1ed815,_0x1a415d,_0x14c525){if(_0x1ed815['changed'](_0xe0d8('0xd'))){_0x1ed815['closedAt']=moment()[_0xe0d8('0xe')](_0xe0d8('0xf'));}_0x14c525(null,_0x1ed815);}}});}; \ No newline at end of file +var _0x5bc1=['../../config/environment','./openchannelInteraction.attributes','exports','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x50f392,_0x1d8441){var _0x5926f2=function(_0x17df32){while(--_0x17df32){_0x50f392['push'](_0x50f392['shift']());}};_0x5926f2(++_0x1d8441);}(_0x5bc1,0xb5));var _0x15bc=function(_0x505241,_0x54a73d){_0x505241=_0x505241-0x0;var _0x1a1fcb=_0x5bc1[_0x505241];return _0x1a1fcb;};'use strict';var _=require('lodash');var util=require(_0x15bc('0x0'));var logger=require(_0x15bc('0x1'))(_0x15bc('0x2'));var moment=require(_0x15bc('0x3'));var BPromise=require(_0x15bc('0x4'));var rp=require(_0x15bc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x15bc('0x6'));var attributes=require(_0x15bc('0x7'));module[_0x15bc('0x8')]=function(_0x52766f,_0x109031){return _0x52766f['define'](_0x15bc('0x9'),attributes,{'tableName':_0x15bc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x15bc('0xb'),'collate':_0x15bc('0xc'),'hooks':{'beforeUpdate':function(_0xb14f9d,_0x246d00,_0x2bc60a){if(_0xb14f9d[_0x15bc('0xd')](_0x15bc('0xe'))){_0xb14f9d[_0x15bc('0xf')]=moment()['format'](_0x15bc('0x10'));}_0x2bc60a(null,_0xb14f9d);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index d7de12d..ab4be3d 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 _0xc228=['stringify','error','code','message','OpenchannelInteraction,\x20%s,\x20%s','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','options','raw','attributes','limit','debug','AddTagsToOpenchannelInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','then','info','request\x20sent'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xc228,0xdf));var _0x8c22=function(_0x518cad,_0x2d051b){_0x518cad=_0x518cad-0x0;var _0x1c27f4=_0xc228[_0x518cad];return _0x1c27f4;};'use strict';var _=require(_0x8c22('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8c22('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8c22('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x8c22('0x3'));var logger=require(_0x8c22('0x4'))(_0x8c22('0x5'));var config=require('../../config/environment');var jayson=require(_0x8c22('0x6'));var client=jayson[_0x8c22('0x7')][_0x8c22('0x8')]({'port':0x232a});config[_0x8c22('0x9')]=_['defaults'](config[_0x8c22('0x9')],{'host':_0x8c22('0xa'),'port':0x18eb});var socket=require(_0x8c22('0xb'))(new Redis(config[_0x8c22('0x9')]));require(_0x8c22('0xc'))[_0x8c22('0xd')](socket);function respondWithRpcPromise(_0x665e82,_0x4a0c90,_0x5825b4){return new BPromise(function(_0x57ff4e,_0x1478d7){return client['request'](_0x665e82,_0x5825b4)[_0x8c22('0xe')](function(_0x386c32){logger[_0x8c22('0xf')]('OpenchannelInteraction,\x20%s,\x20%s',_0x4a0c90,_0x8c22('0x10'));logger['debug']('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x4a0c90,'request\x20sent',JSON[_0x8c22('0x11')](_0x386c32));if(_0x386c32[_0x8c22('0x12')]){if(_0x386c32[_0x8c22('0x12')][_0x8c22('0x13')]===0x1f4){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x4a0c90,_0x386c32[_0x8c22('0x12')][_0x8c22('0x14')]);return _0x1478d7(_0x386c32['error'][_0x8c22('0x14')]);}logger[_0x8c22('0x12')](_0x8c22('0x15'),_0x4a0c90,_0x386c32[_0x8c22('0x12')]['message']);return _0x57ff4e(_0x386c32[_0x8c22('0x12')][_0x8c22('0x14')]);}else{logger[_0x8c22('0xf')](_0x8c22('0x15'),_0x4a0c90,_0x8c22('0x10'));_0x57ff4e(_0x386c32[_0x8c22('0x16')][_0x8c22('0x14')]);}})[_0x8c22('0x17')](function(_0xa49e68){logger[_0x8c22('0x12')]('OpenchannelInteraction,\x20%s,\x20%s',_0x4a0c90,_0xa49e68);_0x1478d7(_0xa49e68);});});}exports[_0x8c22('0x18')]=function(_0x6be2da){var _0x41a40b=this;return new Promise(function(_0xc27036,_0xb84e7b){return db[_0x8c22('0x19')][_0x8c22('0x1a')](_0x6be2da['body'],{'raw':_0x6be2da[_0x8c22('0x1b')]?_0x6be2da['options'][_0x8c22('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6be2da[_0x8c22('0x1b')]?_0x6be2da['options']['where']||null:null,'attributes':_0x6be2da[_0x8c22('0x1b')]?_0x6be2da[_0x8c22('0x1b')][_0x8c22('0x1d')]||null:null,'limit':_0x6be2da['options']?_0x6be2da['options'][_0x8c22('0x1e')]||null:null})[_0x8c22('0xe')](function(_0xf501e2){logger[_0x8c22('0xf')](_0x8c22('0x18'),_0x6be2da);logger[_0x8c22('0x1f')](_0x8c22('0x18'),_0x6be2da,JSON['stringify'](_0xf501e2));_0xc27036(_0xf501e2);})[_0x8c22('0x17')](function(_0x261cca){logger[_0x8c22('0x12')](_0x8c22('0x18'),_0x261cca[_0x8c22('0x14')],_0x6be2da);_0xb84e7b(_0x41a40b[_0x8c22('0x12')](0x1f4,_0x261cca[_0x8c22('0x14')]));});});};exports[_0x8c22('0x20')]=function(_0x47ad17){return new Promise(function(_0x16839a,_0x1e4607){return db['OpenchannelInteraction'][_0x8c22('0x21')]({'where':_0x47ad17[_0x8c22('0x1b')]?_0x47ad17[_0x8c22('0x1b')]['where']||null:null})[_0x8c22('0xe')](function(_0x3f7adf){if(_0x3f7adf){return _0x3f7adf[_0x8c22('0x22')](_0x47ad17[_0x8c22('0x23')][_0x8c22('0x24')],_[_0x8c22('0x25')](_0x47ad17[_0x8c22('0x23')],['ids','id'])||{});}})[_0x8c22('0x26')](function(_0x4f75f1){logger[_0x8c22('0xf')](_0x8c22('0x27'),_0x47ad17);logger[_0x8c22('0x1f')](_0x8c22('0x27'),_0x47ad17,JSON[_0x8c22('0x11')](_0x4f75f1));_0x16839a(_0x4f75f1);})['catch'](function(_0x395d24){logger[_0x8c22('0x12')](_0x8c22('0x27'),_0x395d24[_0x8c22('0x14')],_0x47ad17);_0x1e4607(_this[_0x8c22('0x12')](0x1f4,_0x395d24['message']));});});}; \ No newline at end of file +var _0x6713=['redis','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','where','attributes','AddTagsToOpenchannelInteraction','find','addTags','omit','ids','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter'];(function(_0xc3fabf,_0xe58a97){var _0x319fed=function(_0x174aa0){while(--_0x174aa0){_0xc3fabf['push'](_0xc3fabf['shift']());}};_0x319fed(++_0xe58a97);}(_0x6713,0x143));var _0x3671=function(_0x47e7dd,_0x51b041){_0x47e7dd=_0x47e7dd-0x0;var _0x38501f=_0x6713[_0x47e7dd];return _0x38501f;};'use strict';var _=require(_0x3671('0x0'));var util=require('util');var moment=require(_0x3671('0x1'));var BPromise=require(_0x3671('0x2'));var rs=require(_0x3671('0x3'));var fs=require('fs');var Redis=require(_0x3671('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3671('0x5'));var logger=require('../../config/logger')(_0x3671('0x6'));var config=require(_0x3671('0x7'));var jayson=require(_0x3671('0x8'));var client=jayson['client'][_0x3671('0x9')]({'port':0x232a});config['redis']=_[_0x3671('0xa')](config['redis'],{'host':_0x3671('0xb'),'port':0x18eb});var socket=require(_0x3671('0xc'))(new Redis(config[_0x3671('0xd')]));require(_0x3671('0xe'))[_0x3671('0xf')](socket);function respondWithRpcPromise(_0x3711de,_0x23d8ca,_0x264ff0){return new BPromise(function(_0x2959de,_0x5bab2a){return client[_0x3671('0x10')](_0x3711de,_0x264ff0)[_0x3671('0x11')](function(_0x2633e1){logger[_0x3671('0x12')](_0x3671('0x13'),_0x23d8ca,'request\x20sent');logger[_0x3671('0x14')](_0x3671('0x15'),_0x23d8ca,_0x3671('0x16'),JSON[_0x3671('0x17')](_0x2633e1));if(_0x2633e1[_0x3671('0x18')]){if(_0x2633e1[_0x3671('0x18')][_0x3671('0x19')]===0x1f4){logger[_0x3671('0x18')](_0x3671('0x13'),_0x23d8ca,_0x2633e1[_0x3671('0x18')][_0x3671('0x1a')]);return _0x5bab2a(_0x2633e1[_0x3671('0x18')][_0x3671('0x1a')]);}logger[_0x3671('0x18')](_0x3671('0x13'),_0x23d8ca,_0x2633e1[_0x3671('0x18')][_0x3671('0x1a')]);return _0x2959de(_0x2633e1['error'][_0x3671('0x1a')]);}else{logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x23d8ca,_0x3671('0x16'));_0x2959de(_0x2633e1['result']['message']);}})[_0x3671('0x1b')](function(_0x22c1f0){logger[_0x3671('0x18')](_0x3671('0x13'),_0x23d8ca,_0x22c1f0);_0x5bab2a(_0x22c1f0);});});}exports[_0x3671('0x1c')]=function(_0x25d28d){var _0x6274c=this;return new Promise(function(_0x586ae2,_0x2fb9f3){return db[_0x3671('0x1d')][_0x3671('0x1e')](_0x25d28d[_0x3671('0x1f')],{'raw':_0x25d28d['options']?_0x25d28d[_0x3671('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25d28d[_0x3671('0x20')]?_0x25d28d[_0x3671('0x20')][_0x3671('0x21')]||null:null,'attributes':_0x25d28d[_0x3671('0x20')]?_0x25d28d[_0x3671('0x20')][_0x3671('0x22')]||null:null,'limit':_0x25d28d[_0x3671('0x20')]?_0x25d28d[_0x3671('0x20')]['limit']||null:null})[_0x3671('0x11')](function(_0x36c523){logger[_0x3671('0x12')](_0x3671('0x1c'),_0x25d28d);logger[_0x3671('0x14')](_0x3671('0x1c'),_0x25d28d,JSON[_0x3671('0x17')](_0x36c523));_0x586ae2(_0x36c523);})[_0x3671('0x1b')](function(_0x46af50){logger['error'](_0x3671('0x1c'),_0x46af50[_0x3671('0x1a')],_0x25d28d);_0x2fb9f3(_0x6274c['error'](0x1f4,_0x46af50[_0x3671('0x1a')]));});});};exports[_0x3671('0x23')]=function(_0x30e175){return new Promise(function(_0x3e7348,_0x15d457){return db['OpenchannelInteraction'][_0x3671('0x24')]({'where':_0x30e175[_0x3671('0x20')]?_0x30e175[_0x3671('0x20')][_0x3671('0x21')]||null:null})[_0x3671('0x11')](function(_0x49dc75){if(_0x49dc75){return _0x49dc75[_0x3671('0x25')](_0x30e175[_0x3671('0x1f')]['ids'],_[_0x3671('0x26')](_0x30e175['body'],[_0x3671('0x27'),'id'])||{});}})[_0x3671('0x28')](function(_0x45b9d0){logger[_0x3671('0x12')](_0x3671('0x29'),_0x30e175);logger[_0x3671('0x14')](_0x3671('0x29'),_0x30e175,JSON[_0x3671('0x17')](_0x45b9d0));_0x3e7348(_0x45b9d0);})['catch'](function(_0x3b768c){logger[_0x3671('0x18')](_0x3671('0x29'),_0x3b768c[_0x3671('0x1a')],_0x30e175);_0x15d457(_this[_0x3671('0x18')](0x1f4,_0x3b768c['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 63d2237..80eb468 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 _0x327d=['update','emit','register','length','save','remove'];(function(_0x342700,_0x569f75){var _0x53406f=function(_0x3b3c32){while(--_0x3b3c32){_0x342700['push'](_0x342700['shift']());}};_0x53406f(++_0x569f75);}(_0x327d,0x9a));var _0xd327=function(_0x2a73be,_0x5d2820){_0x2a73be=_0x2a73be-0x0;var _0x509eb3=_0x327d[_0x2a73be];return _0x509eb3;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0xd327('0x0'),_0xd327('0x1'),_0xd327('0x2')];function createListener(_0x44347b,_0x103ed6){return function(_0x2078ec){_0x103ed6[_0xd327('0x3')](_0x44347b,_0x2078ec);};}function removeListener(_0x2896c3,_0x439391){return function(){OpenchannelInteractionEvents['removeListener'](_0x2896c3,_0x439391);};}exports[_0xd327('0x4')]=function(_0x2bd85e){for(var _0x295bf3=0x0,_0x595a56=events[_0xd327('0x5')];_0x295bf3<_0x595a56;_0x295bf3++){var _0x11a45e=events[_0x295bf3];var _0x4b93dc=createListener('openchannelInteraction:'+_0x11a45e,_0x2bd85e);OpenchannelInteractionEvents['on'](_0x11a45e,_0x4b93dc);}}; \ No newline at end of file +var _0xc58a=['./openchannelInteraction.events','save','remove','update','emit','removeListener','register','openchannelInteraction:'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc58a,0x1b0));var _0xac58=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xc58a[_0x5f3f88];return _0xd08119;};'use strict';var OpenchannelInteractionEvents=require(_0xac58('0x0'));var events=[_0xac58('0x1'),_0xac58('0x2'),_0xac58('0x3')];function createListener(_0x3cb6d1,_0x1ecac5){return function(_0x345185){_0x1ecac5[_0xac58('0x4')](_0x3cb6d1,_0x345185);};}function removeListener(_0x428035,_0x19b792){return function(){OpenchannelInteractionEvents[_0xac58('0x5')](_0x428035,_0x19b792);};}exports[_0xac58('0x6')]=function(_0x428c15){for(var _0x293992=0x0,_0x15cff0=events['length'];_0x293992<_0x15cff0;_0x293992++){var _0x3cc498=events[_0x293992];var _0x598bb9=createListener(_0xac58('0x7')+_0x3cc498,_0x428c15);OpenchannelInteractionEvents['on'](_0x3cc498,_0x598bb9);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 861bf23..5c9a537 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 _0xa9e0=['index','/describe','show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','update','put','/:id/accept','accept','reject','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get'];(function(_0x5a34eb,_0x3805d0){var _0x1b9515=function(_0x45fe5b){while(--_0x45fe5b){_0x5a34eb['push'](_0x5a34eb['shift']());}};_0x1b9515(++_0x3805d0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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('0xc')]('/',auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0xe')](_0x0a9e('0xf'),_0x0a9e('0x10')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0x12')](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x12')]('/:id/reject',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x18')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['index','/describe','show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','update','put','/:id/accept','accept','reject','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get'];(function(_0x44f193,_0x1974b2){var _0x40eeb3=function(_0x1c0da8){while(--_0x1c0da8){_0x44f193['push'](_0x44f193['shift']());}};_0x40eeb3(++_0x1974b2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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('0xc')]('/',auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0xe')](_0x0a9e('0xf'),_0x0a9e('0x10')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0x12')](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x12')]('/:id/reject',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index e14fb4e..b5bc709 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 _0xefda=['BOOLEAN','ENUM','out','DATE','STRING','TEXT','sequelize','medium'];(function(_0x1ab0e6,_0x17ba8d){var _0x248815=function(_0x5d2b40){while(--_0x5d2b40){_0x1ab0e6['push'](_0x1ab0e6['shift']());}};_0x248815(++_0x17ba8d);}(_0xefda,0x96));var _0xaefd=function(_0x4b9474,_0x248fd4){_0x4b9474=_0x4b9474-0x0;var _0x263d35=_0xefda[_0x4b9474];return _0x263d35;};'use strict';var Sequelize=require(_0xaefd('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0xaefd('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xaefd('0x2')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xaefd('0x3')]('in',_0xaefd('0x4')),'defaultValue':_0xaefd('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xaefd('0x5')]},'providerName':{'type':Sequelize[_0xaefd('0x6')]},'providerResponse':{'type':Sequelize[_0xaefd('0x7')]}}; \ No newline at end of file +var _0x7497=['TEXT','ENUM','out','DATE','STRING','sequelize','exports'];(function(_0x59b930,_0x39aa63){var _0x1e88dd=function(_0x12260a){while(--_0x12260a){_0x59b930['push'](_0x59b930['shift']());}};_0x1e88dd(++_0x39aa63);}(_0x7497,0xd0));var _0x7749=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7497[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7749('0x0'));module[_0x7749('0x1')]={'body':{'type':Sequelize[_0x7749('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x7749('0x3')]('in',_0x7749('0x4')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x7749('0x5')]},'providerName':{'type':Sequelize[_0x7749('0x6')]},'providerResponse':{'type':Sequelize[_0x7749('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index c624191..4348500 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 _0x0af5=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./openchannelMessage.socket','jayson/promise','client','http','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','json','offset','limit','count','status','set','Content-Range','reject','save','update','destroy','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','key','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','includeAll','rows','show','params','include','find','create','body','describe','accept','openchannel','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','OpenchannelInteraction','OpenchannelInteractionId','interaction','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','User','email','internal','manual','interface','SIP/%s','motionChannel','channel','event','EventManager','acceptmessage','openchannel-interactions','fullname','rejectmessage','eml-format','zip-dir','fast-json-patch'];(function(_0x3ceea9,_0x405d87){var _0x107353=function(_0x347f1f){while(--_0x347f1f){_0x3ceea9['push'](_0x3ceea9['shift']());}};_0x107353(++_0x405d87);}(_0x0af5,0x180));var _0x50af=function(_0x2bdf9f,_0x470194){_0x2bdf9f=_0x2bdf9f-0x0;var _0x4d8214=_0x0af5[_0x2bdf9f];return _0x4d8214;};'use strict';var emlformat=require(_0x50af('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x50af('0x1'));var jsonpatch=require(_0x50af('0x2'));var rp=require(_0x50af('0x3'));var moment=require(_0x50af('0x4'));var BPromise=require(_0x50af('0x5'));var Mustache=require(_0x50af('0x6'));var util=require(_0x50af('0x7'));var path=require(_0x50af('0x8'));var sox=require(_0x50af('0x9'));var csv=require(_0x50af('0xa'));var ejs=require(_0x50af('0xb'));var fs=require('fs');var fs_extra=require(_0x50af('0xc'));var _=require(_0x50af('0xd'));var squel=require(_0x50af('0xe'));var crypto=require(_0x50af('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x50af('0x10'));var toCsv=require(_0x50af('0xa'));var querystring=require(_0x50af('0x11'));var Papa=require(_0x50af('0x12'));var Redis=require(_0x50af('0x13'));var authService=require(_0x50af('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x50af('0x15'));var logger=require(_0x50af('0x16'))(_0x50af('0x17'));var utils=require(_0x50af('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x50af('0x19'));var db=require(_0x50af('0x1a'))['db'];config['redis']=_[_0x50af('0x1b')](config[_0x50af('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x50af('0x1d'))(new Redis(config[_0x50af('0x1c')]));require(_0x50af('0x1e'))['register'](socket);var jayson=require(_0x50af('0x1f'));var client=jayson[_0x50af('0x20')][_0x50af('0x21')]({'port':0x232c});var client9002=jayson[_0x50af('0x20')][_0x50af('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x104315,_0x48e5a4,_0x434c07,_0x215426){return new BPromise(function(_0x59c413,_0x260327){var _0x4491c8=_0x215426||client;return _0x4491c8['request'](_0x104315,_0x434c07)[_0x50af('0x22')](function(_0x4b963c){logger[_0x50af('0x23')](_0x50af('0x24'),_0x48e5a4,_0x50af('0x25'));logger[_0x50af('0x26')](_0x50af('0x27'),_0x48e5a4,'request\x20sent',JSON[_0x50af('0x28')](_0x4b963c));if(_0x4b963c['error']){if(_0x4b963c[_0x50af('0x29')][_0x50af('0x2a')]===0x1f4){logger[_0x50af('0x29')]('OpenchannelMessage,\x20%s,\x20%s',_0x48e5a4,_0x4b963c['error'][_0x50af('0x2b')]);return _0x260327(_0x4b963c[_0x50af('0x29')][_0x50af('0x2b')]);}logger[_0x50af('0x29')]('OpenchannelMessage,\x20%s,\x20%s',_0x48e5a4,_0x4b963c['error'][_0x50af('0x2b')]);return _0x59c413(_0x4b963c['error'][_0x50af('0x2b')]);}else{logger[_0x50af('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x48e5a4,_0x50af('0x25'));_0x59c413(_0x4b963c[_0x50af('0x2c')]['message']);}})[_0x50af('0x2d')](function(_0x5a215b){logger[_0x50af('0x29')](_0x50af('0x24'),_0x48e5a4,_0x5a215b);_0x260327(_0x5a215b);});});}function respondWithStatusCode(_0x403a6d,_0x588eb2){_0x588eb2=_0x588eb2||0xcc;return function(_0xda1397){if(_0xda1397){return _0x403a6d['sendStatus'](_0x588eb2);}return _0x403a6d['status'](_0x588eb2)[_0x50af('0x2e')]();};}function respondWithResult(_0xf97e3f,_0x5995d4){_0x5995d4=_0x5995d4||0xc8;return function(_0x56882f){if(_0x56882f){return _0xf97e3f['status'](_0x5995d4)[_0x50af('0x2f')](_0x56882f);}};}function respondWithFilteredResult(_0x1ad89c,_0x3974da){return function(_0x32dd58){if(_0x32dd58){var _0x1d659d=typeof _0x3974da[_0x50af('0x30')]==='undefined'&&typeof _0x3974da[_0x50af('0x31')]==='undefined';var _0x35c508=_0x32dd58[_0x50af('0x32')];var _0x5b2934=_0x1d659d?0x0:_0x3974da[_0x50af('0x30')];var _0x3d9061=_0x1d659d?_0x32dd58[_0x50af('0x32')]:_0x3974da[_0x50af('0x30')]+_0x3974da['limit'];var _0x4def6d;if(_0x3d9061>=_0x35c508){_0x3d9061=_0x35c508;_0x4def6d=0xc8;}else{_0x4def6d=0xce;}_0x1ad89c[_0x50af('0x33')](_0x4def6d);return _0x1ad89c[_0x50af('0x34')](_0x50af('0x35'),_0x5b2934+'-'+_0x3d9061+'/'+_0x35c508)['json'](_0x32dd58);}return null;};}function patchUpdates(_0x3d686e){return function(_0x4b1779){try{jsonpatch['apply'](_0x4b1779,_0x3d686e,!![]);}catch(_0x138f20){return BPromise[_0x50af('0x36')](_0x138f20);}return _0x4b1779[_0x50af('0x37')]();};}function saveUpdates(_0x2cc48f,_0x240b5f){return function(_0x55a3df){if(_0x55a3df){return _0x55a3df[_0x50af('0x38')](_0x2cc48f)[_0x50af('0x22')](function(_0x47ea92){return _0x47ea92;});}return null;};}function removeEntity(_0x590578,_0xd2b7c2){return function(_0x23955a){if(_0x23955a){return _0x23955a[_0x50af('0x39')]()['then'](function(){_0x590578[_0x50af('0x33')](0xcc)[_0x50af('0x2e')]();});}};}function handleEntityNotFound(_0x1eb3e1,_0x5c48be){return function(_0x38b202){if(!_0x38b202){_0x1eb3e1['sendStatus'](0x194);}return _0x38b202;};}function handleError(_0x365866,_0x1a901c){_0x1a901c=_0x1a901c||0x1f4;return function(_0x5f3bbc){logger[_0x50af('0x29')](_0x5f3bbc[_0x50af('0x3a')]);if(_0x5f3bbc[_0x50af('0x3b')]){delete _0x5f3bbc[_0x50af('0x3b')];}_0x365866[_0x50af('0x33')](_0x1a901c)[_0x50af('0x3c')](_0x5f3bbc);};}exports[_0x50af('0x3d')]=function(_0x51f937,_0x4e3420){var _0x415880={},_0x39f821={},_0x4f5288={'count':0x0,'rows':[]};var _0x4e035f=_[_0x50af('0x3e')](db[_0x50af('0x3f')][_0x50af('0x40')],function(_0xcf62a6){return{'name':_0xcf62a6[_0x50af('0x41')],'type':_0xcf62a6['type'][_0x50af('0x42')]};});_0x39f821['model']=_[_0x50af('0x3e')](_0x4e035f,_0x50af('0x3b'));_0x39f821[_0x50af('0x43')]=_[_0x50af('0x44')](_0x51f937[_0x50af('0x43')]);_0x39f821[_0x50af('0x45')]=_['intersection'](_0x39f821[_0x50af('0x46')],_0x39f821['query']);_0x415880['attributes']=_[_0x50af('0x47')](_0x39f821[_0x50af('0x46')],qs[_0x50af('0x48')](_0x51f937[_0x50af('0x43')][_0x50af('0x48')]));_0x415880[_0x50af('0x49')]=_0x415880[_0x50af('0x49')][_0x50af('0x4a')]?_0x415880[_0x50af('0x49')]:_0x39f821[_0x50af('0x46')];if(!_0x51f937[_0x50af('0x43')][_0x50af('0x4b')]('nolimit')){_0x415880['limit']=qs[_0x50af('0x31')](_0x51f937[_0x50af('0x43')][_0x50af('0x31')]);_0x415880[_0x50af('0x30')]=qs[_0x50af('0x30')](_0x51f937[_0x50af('0x43')]['offset']);}_0x415880[_0x50af('0x4c')]=qs[_0x50af('0x4d')](_0x51f937[_0x50af('0x43')]['sort']);_0x415880[_0x50af('0x4e')]=qs[_0x50af('0x45')](_[_0x50af('0x4f')](_0x51f937['query'],_0x39f821[_0x50af('0x45')]),_0x4e035f);if(_0x51f937[_0x50af('0x43')][_0x50af('0x50')]){_0x415880[_0x50af('0x4e')]=_[_0x50af('0x51')](_0x415880[_0x50af('0x4e')],{'$or':_['map'](_0x4e035f,function(_0x2f32dc){if(_0x2f32dc[_0x50af('0x52')]!=='VIRTUAL'){var _0xcf69fc={};_0xcf69fc[_0x2f32dc[_0x50af('0x3b')]]={'$like':'%'+_0x51f937['query'][_0x50af('0x50')]+'%'};return _0xcf69fc;}})});}_0x415880=_[_0x50af('0x51')]({},_0x415880,_0x51f937[_0x50af('0x53')]);var _0x150f44={'where':_0x415880['where']};return db[_0x50af('0x3f')][_0x50af('0x32')](_0x150f44)[_0x50af('0x22')](function(_0x314bb9){_0x4f5288[_0x50af('0x32')]=_0x314bb9;if(_0x51f937[_0x50af('0x43')][_0x50af('0x54')]){_0x415880['include']=[{'all':!![]}];}return db[_0x50af('0x3f')]['findAll'](_0x415880);})[_0x50af('0x22')](function(_0x19fe96){_0x4f5288[_0x50af('0x55')]=_0x19fe96;return _0x4f5288;})[_0x50af('0x22')](respondWithFilteredResult(_0x4e3420,_0x415880))['catch'](handleError(_0x4e3420,null));};exports[_0x50af('0x56')]=function(_0x52c921,_0x367e43){var _0xc3b20d={'raw':!![],'where':{'id':_0x52c921[_0x50af('0x57')]['id']}},_0x418eb7={};_0x418eb7[_0x50af('0x46')]=_['keys'](db[_0x50af('0x3f')][_0x50af('0x40')]);_0x418eb7['query']=_[_0x50af('0x44')](_0x52c921[_0x50af('0x43')]);_0x418eb7[_0x50af('0x45')]=_[_0x50af('0x47')](_0x418eb7[_0x50af('0x46')],_0x418eb7['query']);_0xc3b20d[_0x50af('0x49')]=_[_0x50af('0x47')](_0x418eb7[_0x50af('0x46')],qs[_0x50af('0x48')](_0x52c921[_0x50af('0x43')]['fields']));_0xc3b20d[_0x50af('0x49')]=_0xc3b20d['attributes'][_0x50af('0x4a')]?_0xc3b20d[_0x50af('0x49')]:_0x418eb7[_0x50af('0x46')];if(_0x52c921[_0x50af('0x43')][_0x50af('0x54')]){_0xc3b20d[_0x50af('0x58')]=[{'all':!![]}];}_0xc3b20d=_[_0x50af('0x51')]({},_0xc3b20d,_0x52c921[_0x50af('0x53')]);return db[_0x50af('0x3f')][_0x50af('0x59')](_0xc3b20d)[_0x50af('0x22')](handleEntityNotFound(_0x367e43,null))[_0x50af('0x22')](respondWithResult(_0x367e43,null))['catch'](handleError(_0x367e43,null));};exports[_0x50af('0x5a')]=function(_0xbc7f4d,_0x5528e9){return db[_0x50af('0x3f')][_0x50af('0x5a')](_0xbc7f4d['body'],{})[_0x50af('0x22')](respondWithResult(_0x5528e9,0xc9))[_0x50af('0x2d')](handleError(_0x5528e9,null));};exports['update']=function(_0x450c95,_0x251f7f){if(_0x450c95[_0x50af('0x5b')]['id']){delete _0x450c95[_0x50af('0x5b')]['id'];}return db[_0x50af('0x3f')]['find']({'where':{'id':_0x450c95[_0x50af('0x57')]['id']}})['then'](handleEntityNotFound(_0x251f7f,null))['then'](saveUpdates(_0x450c95['body'],null))['then'](respondWithResult(_0x251f7f,null))[_0x50af('0x2d')](handleError(_0x251f7f,null));};exports[_0x50af('0x39')]=function(_0x2cedcb,_0x48d490){return db['OpenchannelMessage'][_0x50af('0x59')]({'where':{'id':_0x2cedcb[_0x50af('0x57')]['id']}})[_0x50af('0x22')](handleEntityNotFound(_0x48d490,null))[_0x50af('0x22')](removeEntity(_0x48d490,null))[_0x50af('0x2d')](handleError(_0x48d490,null));};exports['describe']=function(_0x223258,_0x483c0a){return db[_0x50af('0x3f')][_0x50af('0x5c')]()[_0x50af('0x22')](respondWithResult(_0x483c0a,null))[_0x50af('0x2d')](handleError(_0x483c0a,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports[_0x50af('0x5d')]=function(_0x11d0da,_0x196b5c,_0x22fefa){var _0x4b891f={'agent':{},'channel':_0x50af('0x5e')};if(_0x11d0da[_0x50af('0x5b')]['id']){delete _0x11d0da[_0x50af('0x5b')]['id'];}_0x11d0da[_0x50af('0x5b')]['read']=!![];_0x11d0da[_0x50af('0x5b')][_0x50af('0x5f')]=moment()[_0x50af('0x60')](_0x50af('0x61'));_0x11d0da[_0x50af('0x5b')][_0x50af('0x62')]=_0x11d0da['body'][_0x50af('0x62')]||_0x11d0da[_0x50af('0x63')]['id'];_0x4b891f[_0x50af('0x64')]['id']=_0x11d0da[_0x50af('0x5b')][_0x50af('0x62')];return db[_0x50af('0x3f')]['find']({'where':{'id':_0x11d0da[_0x50af('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x196b5c,null))[_0x50af('0x22')](saveUpdates(_0x11d0da['body'],null))[_0x50af('0x22')](function(_0x633f9b){if(_0x633f9b){_0x4b891f[_0x50af('0x2b')]=_0x633f9b['get']({'plain':!![]});return db[_0x50af('0x65')][_0x50af('0x59')]({'where':{'id':_0x633f9b[_0x50af('0x66')]}});}return null;})[_0x50af('0x22')](handleEntityNotFound(_0x196b5c,null))[_0x50af('0x22')](function(_0x267fde){if(_0x267fde){return _0x267fde['update']({'UserId':_0x11d0da[_0x50af('0x5b')][_0x50af('0x62')],'read1stAt':_['isNil'](_0x267fde['read1stAt'])?moment()['format'](_0x50af('0x61')):undefined});}return null;})[_0x50af('0x22')](function(_0x31f9c5){if(_0x31f9c5){_0x4b891f[_0x50af('0x67')]=_0x31f9c5[_0x50af('0x68')]({'plain':!![]});interaction_log[_0x50af('0x23')](_0x50af('0x69'),_0x11d0da[_0x50af('0x63')]['id'],_0x11d0da[_0x50af('0x63')]['name'],_0x11d0da[_0x50af('0x63')][_0x50af('0x6a')],_0x4b891f['interaction']['id'],_0x11d0da[_0x50af('0x5b')]?JSON['stringify'](_0x11d0da[_0x50af('0x5b')]):_0x50af('0x6b'));return respondWithRpcPromise(_0x50af('0x6c'),_0x50af('0x6d'),_0x4b891f);}return null;})[_0x50af('0x22')](function(_0x2696ea){var _0x5ed1f9=_0x50af('0x6e')+_0x2696ea[_0x50af('0x2b')][_0x50af('0x6f')];return db[_0x50af('0x70')][_0x50af('0x43')](_0x5ed1f9,{'type':db[_0x50af('0x71')]['QueryTypes'][_0x50af('0x72')],'raw':!![]})[_0x50af('0x22')](function(_0x3274bc){return _0x3274bc;});})[_0x50af('0x22')](function(_0x1deb61){if(_0x1deb61){_0x4b891f[_0x50af('0x2b')]['contact']=_0x1deb61[0x0];if(!_0x11d0da['body'][_0x50af('0x62')])return;return db[_0x50af('0x73')][_0x50af('0x59')]({'where':{'id':_0x11d0da[_0x50af('0x5b')][_0x50af('0x62')],'role':_0x50af('0x64')},'attributes':['id',_0x50af('0x3b'),'fullname',_0x50af('0x74'),_0x50af('0x75')],'raw':!![]});}return null;})[_0x50af('0x22')](function(_0x57b83e){if(!_0x57b83e)return null;_0x4b891f[_0x50af('0x2b')][_0x50af('0x64')]=_0x57b83e;return _0x4b891f;})[_0x50af('0x22')](function(_0x41c740){if(_0x41c740){if(_0x11d0da[_0x50af('0x5b')][_0x50af('0x76')]){_0x4b891f['message'][_0x50af('0x77')]=util[_0x50af('0x60')](_0x50af('0x78'),_0x11d0da['user'][_0x50af('0x3b')]);_0x4b891f[_0x50af('0x2b')]['channel']=_0x4b891f['channel'];_0x4b891f[_0x50af('0x2b')][_0x50af('0x79')]=_0x4b891f[_0x50af('0x7a')];_0x4b891f[_0x50af('0x2b')][_0x50af('0x7b')]='accept';return respondWithRpcPromise(_0x50af('0x7c'),_0x50af('0x7c'),{'event':_0x50af('0x7d'),'message':_0x4b891f[_0x50af('0x2b')]},client9002)['then'](function(){return _0x4b891f;});}return _0x4b891f;}return null;})[_0x50af('0x22')](respondWithResult(_0x196b5c,null))[_0x50af('0x2d')](handleError(_0x196b5c,null));};var interaction_log=require(_0x50af('0x16'))(_0x50af('0x7e'));exports[_0x50af('0x36')]=function(_0x5cdc5a,_0xffeaac,_0x13ea8b){var _0x3283d6={'agent':{},'channel':_0x50af('0x5e')};if(_0x5cdc5a[_0x50af('0x5b')]['id']){delete _0x5cdc5a[_0x50af('0x5b')]['id'];}_0x5cdc5a[_0x50af('0x5b')][_0x50af('0x62')]=_0x5cdc5a[_0x50af('0x5b')]['UserId']||_0x5cdc5a[_0x50af('0x63')]['id'];_0x3283d6[_0x50af('0x64')]['id']=_0x5cdc5a[_0x50af('0x5b')][_0x50af('0x62')];return db[_0x50af('0x3f')]['find']({'where':{'id':_0x5cdc5a[_0x50af('0x57')]['id'],'UserId':null}})[_0x50af('0x22')](handleEntityNotFound(_0xffeaac,null))[_0x50af('0x22')](function(_0x53d005){if(_0x53d005){_0x3283d6['message']=_0x53d005[_0x50af('0x68')]({'plain':!![]});return db['OpenchannelInteraction'][_0x50af('0x59')]({'where':{'id':_0x53d005[_0x50af('0x66')]}});}return null;})[_0x50af('0x22')](handleEntityNotFound(_0xffeaac,null))[_0x50af('0x22')](function(_0x4cea10){if(_0x4cea10){_0x3283d6[_0x50af('0x67')]=_0x4cea10[_0x50af('0x68')]({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5cdc5a[_0x50af('0x63')]['id'],_0x5cdc5a[_0x50af('0x63')][_0x50af('0x3b')],_0x5cdc5a[_0x50af('0x63')][_0x50af('0x6a')],_0x3283d6['interaction']['id'],_0x5cdc5a['body']?JSON['stringify'](_0x5cdc5a[_0x50af('0x5b')]):'null');return respondWithRpcPromise('RejectMessage','rejectMessage',_0x3283d6);}return null;})[_0x50af('0x22')](function(_0x560851){var _0x13ff95='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x560851['message'][_0x50af('0x6f')];return db['sequelize'][_0x50af('0x43')](_0x13ff95,{'type':db[_0x50af('0x71')]['QueryTypes'][_0x50af('0x72')],'raw':!![]})[_0x50af('0x22')](function(_0x1cab79){return _0x1cab79;});})[_0x50af('0x22')](function(_0x278050){if(_0x278050){_0x3283d6['message']['contact']=_0x278050[0x0];if(!_0x5cdc5a[_0x50af('0x5b')]['UserId'])return;return db['User'][_0x50af('0x59')]({'where':{'id':_0x5cdc5a[_0x50af('0x5b')][_0x50af('0x62')],'role':_0x50af('0x64')},'attributes':['id',_0x50af('0x3b'),_0x50af('0x7f'),'email',_0x50af('0x75')],'raw':!![]});}return null;})[_0x50af('0x22')](function(_0x26b9dc){if(!_0x26b9dc)return null;_0x3283d6[_0x50af('0x2b')]['agent']=_0x26b9dc;return _0x3283d6;})[_0x50af('0x22')](function(_0x22f23d){if(_0x22f23d){_0x22f23d['message'][_0x50af('0x77')]=util['format'](_0x50af('0x78'),_0x5cdc5a[_0x50af('0x63')][_0x50af('0x3b')]);_0x22f23d['message'][_0x50af('0x7a')]=_0x3283d6[_0x50af('0x7a')];_0x22f23d[_0x50af('0x2b')][_0x50af('0x79')]=_0x3283d6[_0x50af('0x7a')];_0x22f23d['message']['event']='reject';respondWithRpcPromise(_0x50af('0x7c'),_0x50af('0x7c'),{'event':_0x50af('0x80'),'message':_0x22f23d['message']},client9002);return _0x3283d6;}return null;})['then'](respondWithResult(_0xffeaac,null))[_0x50af('0x2d')](handleError(_0xffeaac,null));}; \ No newline at end of file +var _0x157e=['sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','map','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','type','options','includeAll','include','OpenchannelMessage','findAll','rows','show','rawAttributes','merge','find','body','params','describe','../../config/logger','accept','openchannel','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','interface','SIP/%s','channel','EventManager','openchannel-interactions','rejectMessage','ContactId','motionChannel','event','rejectmessage','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','fs-extra','lodash','squel','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','OpenchannelMessage,\x20%s,\x20%s','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','catch'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0x157e,0x1d4));var _0xe157=function(_0x254076,_0x5e7b8d){_0x254076=_0x254076-0x0;var _0x21a93e=_0x157e[_0x254076];return _0x21a93e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe157('0x0'));var zipdir=require(_0xe157('0x1'));var jsonpatch=require(_0xe157('0x2'));var rp=require(_0xe157('0x3'));var moment=require('moment');var BPromise=require(_0xe157('0x4'));var Mustache=require(_0xe157('0x5'));var util=require(_0xe157('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe157('0x7'));var _=require(_0xe157('0x8'));var squel=require(_0xe157('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe157('0xa'));var toCsv=require(_0xe157('0xb'));var querystring=require(_0xe157('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe157('0xd'));var qs=require(_0xe157('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xe157('0xf'));var licenseUtil=require(_0xe157('0x10'));var db=require(_0xe157('0x11'))['db'];config[_0xe157('0x12')]=_[_0xe157('0x13')](config[_0xe157('0x12')],{'host':_0xe157('0x14'),'port':0x18eb});var socket=require(_0xe157('0x15'))(new Redis(config['redis']));require('./openchannelMessage.socket')[_0xe157('0x16')](socket);var jayson=require(_0xe157('0x17'));var client=jayson[_0xe157('0x18')][_0xe157('0x19')]({'port':0x232c});var client9002=jayson[_0xe157('0x18')][_0xe157('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x4a6a7a,_0x4c3e66,_0x449b44,_0x559d9c){return new BPromise(function(_0x369ad5,_0x4b81a7){var _0x1f1012=_0x559d9c||client;return _0x1f1012[_0xe157('0x1a')](_0x4a6a7a,_0x449b44)[_0xe157('0x1b')](function(_0x583b2b){logger['info'](_0xe157('0x1c'),_0x4c3e66,'request\x20sent');logger['debug'](_0xe157('0x1d'),_0x4c3e66,'request\x20sent',JSON['stringify'](_0x583b2b));if(_0x583b2b['error']){if(_0x583b2b[_0xe157('0x1e')][_0xe157('0x1f')]===0x1f4){logger[_0xe157('0x1e')](_0xe157('0x1c'),_0x4c3e66,_0x583b2b[_0xe157('0x1e')][_0xe157('0x20')]);return _0x4b81a7(_0x583b2b['error'][_0xe157('0x20')]);}logger[_0xe157('0x1e')]('OpenchannelMessage,\x20%s,\x20%s',_0x4c3e66,_0x583b2b[_0xe157('0x1e')][_0xe157('0x20')]);return _0x369ad5(_0x583b2b[_0xe157('0x1e')][_0xe157('0x20')]);}else{logger[_0xe157('0x21')](_0xe157('0x1c'),_0x4c3e66,_0xe157('0x22'));_0x369ad5(_0x583b2b['result']['message']);}})[_0xe157('0x23')](function(_0x132ac6){logger['error'](_0xe157('0x1c'),_0x4c3e66,_0x132ac6);_0x4b81a7(_0x132ac6);});});}function respondWithStatusCode(_0x47d2b8,_0x4ac673){_0x4ac673=_0x4ac673||0xcc;return function(_0x45c2f2){if(_0x45c2f2){return _0x47d2b8[_0xe157('0x24')](_0x4ac673);}return _0x47d2b8[_0xe157('0x25')](_0x4ac673)[_0xe157('0x26')]();};}function respondWithResult(_0x6b87b3,_0x5579e4){_0x5579e4=_0x5579e4||0xc8;return function(_0x545c03){if(_0x545c03){return _0x6b87b3[_0xe157('0x25')](_0x5579e4)[_0xe157('0x27')](_0x545c03);}};}function respondWithFilteredResult(_0x2b239a,_0x5ec897){return function(_0x19b520){if(_0x19b520){var _0x2abe50=typeof _0x5ec897[_0xe157('0x28')]===_0xe157('0x29')&&typeof _0x5ec897['limit']===_0xe157('0x29');var _0x6a068b=_0x19b520[_0xe157('0x2a')];var _0x23cd98=_0x2abe50?0x0:_0x5ec897[_0xe157('0x28')];var _0x4ab756=_0x2abe50?_0x19b520[_0xe157('0x2a')]:_0x5ec897[_0xe157('0x28')]+_0x5ec897[_0xe157('0x2b')];var _0x409649;if(_0x4ab756>=_0x6a068b){_0x4ab756=_0x6a068b;_0x409649=0xc8;}else{_0x409649=0xce;}_0x2b239a['status'](_0x409649);return _0x2b239a[_0xe157('0x2c')](_0xe157('0x2d'),_0x23cd98+'-'+_0x4ab756+'/'+_0x6a068b)[_0xe157('0x27')](_0x19b520);}return null;};}function patchUpdates(_0x103787){return function(_0x32c9fc){try{jsonpatch[_0xe157('0x2e')](_0x32c9fc,_0x103787,!![]);}catch(_0xb3748c){return BPromise[_0xe157('0x2f')](_0xb3748c);}return _0x32c9fc['save']();};}function saveUpdates(_0x59de84,_0x47a781){return function(_0x58fac0){if(_0x58fac0){return _0x58fac0[_0xe157('0x30')](_0x59de84)['then'](function(_0x582bc6){return _0x582bc6;});}return null;};}function removeEntity(_0x114b3f,_0x3c7997){return function(_0x1ab7b1){if(_0x1ab7b1){return _0x1ab7b1[_0xe157('0x31')]()[_0xe157('0x1b')](function(){_0x114b3f[_0xe157('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc612b8,_0x33f802){return function(_0x38dd10){if(!_0x38dd10){_0xc612b8['sendStatus'](0x194);}return _0x38dd10;};}function handleError(_0x5900e3,_0x4bcd3b){_0x4bcd3b=_0x4bcd3b||0x1f4;return function(_0x5c8367){logger[_0xe157('0x1e')](_0x5c8367[_0xe157('0x32')]);if(_0x5c8367[_0xe157('0x33')]){delete _0x5c8367[_0xe157('0x33')];}_0x5900e3[_0xe157('0x25')](_0x4bcd3b)[_0xe157('0x34')](_0x5c8367);};}exports[_0xe157('0x35')]=function(_0xcc4f5b,_0x30af7a){var _0x44d1b1={},_0x19f1f5={},_0x16449f={'count':0x0,'rows':[]};var _0x253252=_[_0xe157('0x36')](db['OpenchannelMessage']['rawAttributes'],function(_0x252d3a){return{'name':_0x252d3a[_0xe157('0x37')],'type':_0x252d3a['type'][_0xe157('0x38')]};});_0x19f1f5[_0xe157('0x39')]=_['map'](_0x253252,_0xe157('0x33'));_0x19f1f5['query']=_[_0xe157('0x3a')](_0xcc4f5b[_0xe157('0x3b')]);_0x19f1f5[_0xe157('0x3c')]=_[_0xe157('0x3d')](_0x19f1f5['model'],_0x19f1f5[_0xe157('0x3b')]);_0x44d1b1[_0xe157('0x3e')]=_['intersection'](_0x19f1f5['model'],qs[_0xe157('0x3f')](_0xcc4f5b[_0xe157('0x3b')]['fields']));_0x44d1b1[_0xe157('0x3e')]=_0x44d1b1['attributes'][_0xe157('0x40')]?_0x44d1b1[_0xe157('0x3e')]:_0x19f1f5['model'];if(!_0xcc4f5b['query'][_0xe157('0x41')]('nolimit')){_0x44d1b1[_0xe157('0x2b')]=qs[_0xe157('0x2b')](_0xcc4f5b[_0xe157('0x3b')][_0xe157('0x2b')]);_0x44d1b1[_0xe157('0x28')]=qs[_0xe157('0x28')](_0xcc4f5b['query']['offset']);}_0x44d1b1[_0xe157('0x42')]=qs[_0xe157('0x43')](_0xcc4f5b[_0xe157('0x3b')][_0xe157('0x43')]);_0x44d1b1[_0xe157('0x44')]=qs[_0xe157('0x3c')](_[_0xe157('0x45')](_0xcc4f5b[_0xe157('0x3b')],_0x19f1f5[_0xe157('0x3c')]),_0x253252);if(_0xcc4f5b[_0xe157('0x3b')][_0xe157('0x46')]){_0x44d1b1[_0xe157('0x44')]=_['merge'](_0x44d1b1[_0xe157('0x44')],{'$or':_[_0xe157('0x36')](_0x253252,function(_0x2ffef4){if(_0x2ffef4[_0xe157('0x47')]!=='VIRTUAL'){var _0x5da59e={};_0x5da59e[_0x2ffef4[_0xe157('0x33')]]={'$like':'%'+_0xcc4f5b[_0xe157('0x3b')][_0xe157('0x46')]+'%'};return _0x5da59e;}})});}_0x44d1b1=_['merge']({},_0x44d1b1,_0xcc4f5b[_0xe157('0x48')]);var _0x46e744={'where':_0x44d1b1[_0xe157('0x44')]};return db['OpenchannelMessage'][_0xe157('0x2a')](_0x46e744)[_0xe157('0x1b')](function(_0x24afb9){_0x16449f[_0xe157('0x2a')]=_0x24afb9;if(_0xcc4f5b[_0xe157('0x3b')][_0xe157('0x49')]){_0x44d1b1[_0xe157('0x4a')]=[{'all':!![]}];}return db[_0xe157('0x4b')][_0xe157('0x4c')](_0x44d1b1);})['then'](function(_0x25d1d5){_0x16449f[_0xe157('0x4d')]=_0x25d1d5;return _0x16449f;})['then'](respondWithFilteredResult(_0x30af7a,_0x44d1b1))[_0xe157('0x23')](handleError(_0x30af7a,null));};exports[_0xe157('0x4e')]=function(_0x214aa7,_0xf15899){var _0x595434={'raw':!![],'where':{'id':_0x214aa7['params']['id']}},_0x44043c={};_0x44043c[_0xe157('0x39')]=_[_0xe157('0x3a')](db[_0xe157('0x4b')][_0xe157('0x4f')]);_0x44043c[_0xe157('0x3b')]=_[_0xe157('0x3a')](_0x214aa7[_0xe157('0x3b')]);_0x44043c['filters']=_[_0xe157('0x3d')](_0x44043c[_0xe157('0x39')],_0x44043c[_0xe157('0x3b')]);_0x595434[_0xe157('0x3e')]=_[_0xe157('0x3d')](_0x44043c[_0xe157('0x39')],qs[_0xe157('0x3f')](_0x214aa7[_0xe157('0x3b')][_0xe157('0x3f')]));_0x595434[_0xe157('0x3e')]=_0x595434[_0xe157('0x3e')][_0xe157('0x40')]?_0x595434[_0xe157('0x3e')]:_0x44043c[_0xe157('0x39')];if(_0x214aa7[_0xe157('0x3b')][_0xe157('0x49')]){_0x595434['include']=[{'all':!![]}];}_0x595434=_[_0xe157('0x50')]({},_0x595434,_0x214aa7[_0xe157('0x48')]);return db[_0xe157('0x4b')][_0xe157('0x51')](_0x595434)[_0xe157('0x1b')](handleEntityNotFound(_0xf15899,null))[_0xe157('0x1b')](respondWithResult(_0xf15899,null))[_0xe157('0x23')](handleError(_0xf15899,null));};exports['create']=function(_0x48fc50,_0x36e6eb){return db['OpenchannelMessage']['create'](_0x48fc50[_0xe157('0x52')],{})[_0xe157('0x1b')](respondWithResult(_0x36e6eb,0xc9))[_0xe157('0x23')](handleError(_0x36e6eb,null));};exports[_0xe157('0x30')]=function(_0x3d14cd,_0x26945c){if(_0x3d14cd[_0xe157('0x52')]['id']){delete _0x3d14cd['body']['id'];}return db['OpenchannelMessage'][_0xe157('0x51')]({'where':{'id':_0x3d14cd[_0xe157('0x53')]['id']}})[_0xe157('0x1b')](handleEntityNotFound(_0x26945c,null))[_0xe157('0x1b')](saveUpdates(_0x3d14cd[_0xe157('0x52')],null))[_0xe157('0x1b')](respondWithResult(_0x26945c,null))[_0xe157('0x23')](handleError(_0x26945c,null));};exports[_0xe157('0x31')]=function(_0x3d7a8b,_0x591a74){return db['OpenchannelMessage'][_0xe157('0x51')]({'where':{'id':_0x3d7a8b['params']['id']}})[_0xe157('0x1b')](handleEntityNotFound(_0x591a74,null))['then'](removeEntity(_0x591a74,null))[_0xe157('0x23')](handleError(_0x591a74,null));};exports[_0xe157('0x54')]=function(_0x13eda8,_0x522c48){return db[_0xe157('0x4b')][_0xe157('0x54')]()['then'](respondWithResult(_0x522c48,null))[_0xe157('0x23')](handleError(_0x522c48,null));};var interaction_log=require(_0xe157('0x55'))('openchannel-interactions');exports[_0xe157('0x56')]=function(_0x1cf0ac,_0x2a3a53,_0x19905a){var _0x18516d={'agent':{},'channel':_0xe157('0x57')};if(_0x1cf0ac[_0xe157('0x52')]['id']){delete _0x1cf0ac[_0xe157('0x52')]['id'];}_0x1cf0ac[_0xe157('0x52')][_0xe157('0x58')]=!![];_0x1cf0ac[_0xe157('0x52')]['readAt']=moment()[_0xe157('0x59')](_0xe157('0x5a'));_0x1cf0ac['body'][_0xe157('0x5b')]=_0x1cf0ac[_0xe157('0x52')]['UserId']||_0x1cf0ac['user']['id'];_0x18516d[_0xe157('0x5c')]['id']=_0x1cf0ac[_0xe157('0x52')][_0xe157('0x5b')];return db[_0xe157('0x4b')][_0xe157('0x51')]({'where':{'id':_0x1cf0ac[_0xe157('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2a3a53,null))[_0xe157('0x1b')](saveUpdates(_0x1cf0ac[_0xe157('0x52')],null))[_0xe157('0x1b')](function(_0x4a026a){if(_0x4a026a){_0x18516d['message']=_0x4a026a['get']({'plain':!![]});return db[_0xe157('0x5d')][_0xe157('0x51')]({'where':{'id':_0x4a026a[_0xe157('0x5e')]}});}return null;})[_0xe157('0x1b')](handleEntityNotFound(_0x2a3a53,null))[_0xe157('0x1b')](function(_0x15b80c){if(_0x15b80c){return _0x15b80c[_0xe157('0x30')]({'UserId':_0x1cf0ac[_0xe157('0x52')][_0xe157('0x5b')],'read1stAt':_[_0xe157('0x5f')](_0x15b80c[_0xe157('0x60')])?moment()[_0xe157('0x59')](_0xe157('0x5a')):undefined});}return null;})['then'](function(_0x18ae4b){if(_0x18ae4b){_0x18516d[_0xe157('0x61')]=_0x18ae4b[_0xe157('0x62')]({'plain':!![]});interaction_log['info'](_0xe157('0x63'),_0x1cf0ac[_0xe157('0x64')]['id'],_0x1cf0ac[_0xe157('0x64')]['name'],_0x1cf0ac[_0xe157('0x64')][_0xe157('0x65')],_0x18516d[_0xe157('0x61')]['id'],_0x1cf0ac[_0xe157('0x52')]?JSON[_0xe157('0x66')](_0x1cf0ac['body']):_0xe157('0x67'));return respondWithRpcPromise(_0xe157('0x68'),_0xe157('0x69'),_0x18516d);}return null;})[_0xe157('0x1b')](function(_0x3c756f){var _0x48a71d=_0xe157('0x6a')+_0x3c756f[_0xe157('0x20')]['ContactId'];return db[_0xe157('0x6b')][_0xe157('0x3b')](_0x48a71d,{'type':db[_0xe157('0x6c')][_0xe157('0x6d')][_0xe157('0x6e')],'raw':!![]})[_0xe157('0x1b')](function(_0x430f48){return _0x430f48;});})[_0xe157('0x1b')](function(_0x6fe816){if(_0x6fe816){_0x18516d['message'][_0xe157('0x6f')]=_0x6fe816[0x0];if(!_0x1cf0ac[_0xe157('0x52')][_0xe157('0x5b')])return;return db['User'][_0xe157('0x51')]({'where':{'id':_0x1cf0ac['body'][_0xe157('0x5b')],'role':_0xe157('0x5c')},'attributes':['id',_0xe157('0x33'),_0xe157('0x70'),_0xe157('0x71'),_0xe157('0x72')],'raw':!![]});}return null;})[_0xe157('0x1b')](function(_0x1c536a){if(!_0x1c536a)return null;_0x18516d['message'][_0xe157('0x5c')]=_0x1c536a;return _0x18516d;})[_0xe157('0x1b')](function(_0x11eedc){if(_0x11eedc){if(_0x1cf0ac[_0xe157('0x52')][_0xe157('0x73')]){_0x18516d[_0xe157('0x20')][_0xe157('0x74')]=util[_0xe157('0x59')](_0xe157('0x75'),_0x1cf0ac['user']['name']);_0x18516d['message'][_0xe157('0x76')]=_0x18516d[_0xe157('0x76')];_0x18516d[_0xe157('0x20')]['motionChannel']=_0x18516d['channel'];_0x18516d[_0xe157('0x20')]['event']='accept';return respondWithRpcPromise(_0xe157('0x77'),_0xe157('0x77'),{'event':'acceptmessage','message':_0x18516d[_0xe157('0x20')]},client9002)[_0xe157('0x1b')](function(){return _0x18516d;});}return _0x18516d;}return null;})[_0xe157('0x1b')](respondWithResult(_0x2a3a53,null))[_0xe157('0x23')](handleError(_0x2a3a53,null));};var interaction_log=require('../../config/logger')(_0xe157('0x78'));exports['reject']=function(_0x176064,_0x13f283,_0x5aa21c){var _0x4cd4ce={'agent':{},'channel':_0xe157('0x57')};if(_0x176064[_0xe157('0x52')]['id']){delete _0x176064[_0xe157('0x52')]['id'];}_0x176064['body']['UserId']=_0x176064[_0xe157('0x52')][_0xe157('0x5b')]||_0x176064[_0xe157('0x64')]['id'];_0x4cd4ce['agent']['id']=_0x176064[_0xe157('0x52')][_0xe157('0x5b')];return db['OpenchannelMessage'][_0xe157('0x51')]({'where':{'id':_0x176064[_0xe157('0x53')]['id'],'UserId':null}})[_0xe157('0x1b')](handleEntityNotFound(_0x13f283,null))[_0xe157('0x1b')](function(_0x491b53){if(_0x491b53){_0x4cd4ce[_0xe157('0x20')]=_0x491b53[_0xe157('0x62')]({'plain':!![]});return db[_0xe157('0x5d')][_0xe157('0x51')]({'where':{'id':_0x491b53[_0xe157('0x5e')]}});}return null;})[_0xe157('0x1b')](handleEntityNotFound(_0x13f283,null))['then'](function(_0x42b586){if(_0x42b586){_0x4cd4ce['interaction']=_0x42b586[_0xe157('0x62')]({'plain':!![]});interaction_log[_0xe157('0x21')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x176064[_0xe157('0x64')]['id'],_0x176064[_0xe157('0x64')][_0xe157('0x33')],_0x176064[_0xe157('0x64')][_0xe157('0x65')],_0x4cd4ce[_0xe157('0x61')]['id'],_0x176064[_0xe157('0x52')]?JSON[_0xe157('0x66')](_0x176064[_0xe157('0x52')]):_0xe157('0x67'));return respondWithRpcPromise('RejectMessage',_0xe157('0x79'),_0x4cd4ce);}return null;})[_0xe157('0x1b')](function(_0x142261){var _0x41f9c1=_0xe157('0x6a')+_0x142261[_0xe157('0x20')][_0xe157('0x7a')];return db[_0xe157('0x6b')][_0xe157('0x3b')](_0x41f9c1,{'type':db[_0xe157('0x6c')][_0xe157('0x6d')][_0xe157('0x6e')],'raw':!![]})['then'](function(_0x4ec497){return _0x4ec497;});})[_0xe157('0x1b')](function(_0x3e850e){if(_0x3e850e){_0x4cd4ce[_0xe157('0x20')][_0xe157('0x6f')]=_0x3e850e[0x0];if(!_0x176064['body'][_0xe157('0x5b')])return;return db['User'][_0xe157('0x51')]({'where':{'id':_0x176064[_0xe157('0x52')][_0xe157('0x5b')],'role':'agent'},'attributes':['id',_0xe157('0x33'),_0xe157('0x70'),'email',_0xe157('0x72')],'raw':!![]});}return null;})[_0xe157('0x1b')](function(_0x16422d){if(!_0x16422d)return null;_0x4cd4ce['message']['agent']=_0x16422d;return _0x4cd4ce;})[_0xe157('0x1b')](function(_0x54f1ef){if(_0x54f1ef){_0x54f1ef[_0xe157('0x20')][_0xe157('0x74')]=util[_0xe157('0x59')](_0xe157('0x75'),_0x176064[_0xe157('0x64')][_0xe157('0x33')]);_0x54f1ef[_0xe157('0x20')][_0xe157('0x76')]=_0x4cd4ce['channel'];_0x54f1ef[_0xe157('0x20')][_0xe157('0x7b')]=_0x4cd4ce[_0xe157('0x76')];_0x54f1ef[_0xe157('0x20')][_0xe157('0x7c')]=_0xe157('0x2f');respondWithRpcPromise(_0xe157('0x77'),'EventManager',{'event':_0xe157('0x7d'),'message':_0x54f1ef['message']},client9002);return _0x4cd4ce;}return null;})[_0xe157('0x1b')](respondWithResult(_0x13f283,null))[_0xe157('0x23')](handleError(_0x13f283,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 8d5db87..24b13f1 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 _0xd309=['exports','events','OpenchannelMessage','setMaxListeners','update','emit'];(function(_0x496020,_0x9c3225){var _0x3506e8=function(_0x2e7c97){while(--_0x2e7c97){_0x496020['push'](_0x496020['shift']());}};_0x3506e8(++_0x9c3225);}(_0xd309,0xf7));var _0x9d30=function(_0x452c15,_0x574e17){_0x452c15=_0x452c15-0x0;var _0x20b321=_0xd309[_0x452c15];return _0x20b321;};'use strict';var EventEmitter=require(_0x9d30('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x9d30('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x9d30('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9d30('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5084f1){return function(_0x405290,_0x58b037,_0x2a695d){OpenchannelMessageEvents[_0x9d30('0x4')](_0x5084f1+':'+_0x405290['id'],_0x405290);OpenchannelMessageEvents[_0x9d30('0x4')](_0x5084f1,_0x405290);_0x2a695d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x9d30('0x5')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x22a7=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelMessage'];(function(_0x4c1e32,_0x5764f4){var _0x5cab86=function(_0x42e0c9){while(--_0x42e0c9){_0x4c1e32['push'](_0x4c1e32['shift']());}};_0x5cab86(++_0x5764f4);}(_0x22a7,0x1b7));var _0x722a=function(_0x59e9f5,_0x430097){_0x59e9f5=_0x59e9f5-0x0;var _0x3fa278=_0x22a7[_0x59e9f5];return _0x3fa278;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x722a('0x0'))['db'][_0x722a('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x722a('0x2')](0x0);var events={'afterCreate':_0x722a('0x3'),'afterUpdate':'update','afterDestroy':_0x722a('0x4')};function emitEvent(_0x2ae9fe){return function(_0x134099,_0x2e090a,_0x322cbc){OpenchannelMessageEvents['emit'](_0x2ae9fe+':'+_0x134099['id'],_0x134099);OpenchannelMessageEvents[_0x722a('0x5')](_0x2ae9fe,_0x134099);_0x322cbc(null);};}for(var e in events){if(events[_0x722a('0x6')](e)){var event=events[e];OpenchannelMessage[_0x722a('0x7')](e,emitEvent(event));}}module[_0x722a('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 8485c0d..6c28c3e 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 _0x972c=['OpenchannelAccountId','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','Interaction','method','POST','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','error','finally','utf8mb4','utf8mb4_unicode_ci','util','moment','bluebird','request-promise','path','../../config/environment','./openchannelMessage.attributes','define','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','direction','toLowerCase','out','secret','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','catch','CmContact','describe','OpenchannelAccount','find'];(function(_0xb18c5a,_0x4ecdf1){var _0x226530=function(_0x33c559){while(--_0x33c559){_0xb18c5a['push'](_0xb18c5a['shift']());}};_0x226530(++_0x4ecdf1);}(_0x972c,0x1ea));var _0xc972=function(_0x4e4fd7,_0x162746){_0x4e4fd7=_0x4e4fd7-0x0;var _0x4a9559=_0x972c[_0x4e4fd7];return _0x4a9559;};'use strict';var _=require('lodash');var util=require(_0xc972('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xc972('0x1'));var BPromise=require(_0xc972('0x2'));var rp=require(_0xc972('0x3'));var fs=require('fs');var path=require(_0xc972('0x4'));var rimraf=require('rimraf');var config=require(_0xc972('0x5'));var attributes=require(_0xc972('0x6'));module['exports']=function(_0x465b13,_0x1fb086){return _0x465b13[_0xc972('0x7')]('OpenchannelMessage',attributes,{'tableName':_0xc972('0x8'),'paranoid':![],'indexes':[{'name':_0xc972('0x9'),'fields':[_0xc972('0xa')],'type':_0xc972('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x48217e,_0x3a6d39,_0x1a747d){var _0x5a9945=_0x465b13['models'];var _0x38ebda=_0x48217e['get']({'plain':!![]});if(_0x38ebda[_0xc972('0xc')][_0xc972('0xd')]()==='in'||_0x38ebda['direction']['toLowerCase']()===_0xc972('0xe')&&!_0x38ebda[_0xc972('0xf')]&&!_['isNil'](_0x38ebda[_0xc972('0x10')])){_0x5a9945[_0xc972('0x11')][_0xc972('0x12')]({'where':{'id':_0x38ebda[_0xc972('0x13')]}})[_0xc972('0x14')](function(_0x202f4e){if(_0x202f4e){_0x202f4e[_0xc972('0x15')]({'lastMsgAt':_0x38ebda['createdAt'],'lastMsgDirection':_0x38ebda[_0xc972('0xc')][_0xc972('0xd')]()});}})[_0xc972('0x16')](function(_0x1808e6){console['error'](_0x1808e6);});}if(_0x38ebda['direction']===_0xc972('0xe')&&!_0x38ebda['secret']){var _0x3a5289;_0x5a9945[_0xc972('0x17')][_0xc972('0x18')]()[_0xc972('0x14')](function(_0x124a53){return _0x5a9945[_0xc972('0x19')][_0xc972('0x1a')]({'where':{'id':_0x38ebda[_0xc972('0x1b')]},'include':[{'model':_0x5a9945[_0xc972('0x11')],'as':'Interactions','where':{'id':_0x38ebda[_0xc972('0x13')]},'limit':0x1,'include':[{'model':_0x5a9945[_0xc972('0x17')],'as':_0xc972('0x1c'),'attributes':_[_0xc972('0x1d')](_0x124a53)}]}]});})[_0xc972('0x14')](function(_0x3dc02d){_0x3a5289=_0x3dc02d['get']({'plain':!![]});if(_0x3a5289&&_0x3a5289[_0xc972('0x1e')]){logger[_0xc972('0x1f')](_0xc972('0x20'),_0xc972('0x21'),util['format'](_0xc972('0x22'),_0x38ebda['id'],_0x3a5289[_0xc972('0x1e')]));if(_0x3a5289['Interactions']&&_0x3a5289[_0xc972('0x23')][_0xc972('0x24')]){_0x38ebda[_0xc972('0x25')]=_['omit'](_0x3a5289[_0xc972('0x23')][0x0],'Contact');_0x38ebda[_0xc972('0x1c')]=_0x3a5289['Interactions'][0x0][_0xc972('0x1c')];}var _0x3a6d39={'method':'POST','uri':encodeURI(_0x3a5289['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x3a6d39[_0xc972('0x26')]){case'GET':_0x3a6d39['qs']=_0x38ebda;break;case _0xc972('0x27'):_0x3a6d39[_0xc972('0xa')]=_0x38ebda;break;}return rp(_0x3a6d39)['then'](function(_0x3b8d4a){logger['info'](_0xc972('0x20'),_0xc972('0x21'),util[_0xc972('0x28')](_0xc972('0x29'),_0x38ebda['id'],_0x3a5289[_0xc972('0x1e')]));if(_0x3b8d4a[_0xc972('0xa')]['threadId']&&_0x3b8d4a['body'][_0xc972('0x2a')]!=_0x38ebda[_0xc972('0x25')]['threadId']){return _0x5a9945[_0xc972('0x11')][_0xc972('0x15')]({'threadId':_0x3b8d4a[_0xc972('0xa')]['threadId']},{'where':{'id':_0x38ebda['Interaction']['id']}});}else{return;}})[_0xc972('0x14')](function(){return _0x48217e[_0xc972('0x15')]({'read':!![]});})[_0xc972('0x16')](function(_0x2b036e){logger[_0xc972('0x2b')](_0xc972('0x20'),_0xc972('0x21'),util['inspect'](_0x2b036e,{'showHidden':![],'depth':null}));_0x1a747d();});}else{_0x1a747d();}})[_0xc972('0x2c')](function(){_0x1a747d();});}else{_0x1a747d();}}},'charset':_0xc972('0x2d'),'collate':_0xc972('0x2e')});}; \ No newline at end of file +var _0x8201=['OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteraction','Interactions','Contact','keys','info','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','Interaction','omit','POST','method','Message\x20%d\x20forwarded\x20to\x20%s','threadId','update','catch','afterCreate','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','OpenchannelMessage','openchannel_messages','body','FULLTEXT','models','toLowerCase','direction','out','isNil','UserId','findOne','OpenchannelInteractionId','then','createdAt','error','secret','CmContact','describe'];(function(_0x2da1f9,_0x5e4269){var _0x22ef92=function(_0x1a152a){while(--_0x1a152a){_0x2da1f9['push'](_0x2da1f9['shift']());}};_0x22ef92(++_0x5e4269);}(_0x8201,0x1c1));var _0x1820=function(_0x306eb3,_0x3b1d96){_0x306eb3=_0x306eb3-0x0;var _0x352367=_0x8201[_0x306eb3];return _0x352367;};'use strict';var _=require(_0x1820('0x0'));var util=require('util');var logger=require(_0x1820('0x1'))(_0x1820('0x2'));var moment=require(_0x1820('0x3'));var BPromise=require(_0x1820('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1820('0x5'));var rimraf=require(_0x1820('0x6'));var config=require(_0x1820('0x7'));var attributes=require(_0x1820('0x8'));module[_0x1820('0x9')]=function(_0x14d492,_0x11ba8b){return _0x14d492['define'](_0x1820('0xa'),attributes,{'tableName':_0x1820('0xb'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x1820('0xc')],'type':_0x1820('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2306a3,_0x201ba0,_0x439d54){var _0x52fb03=_0x14d492[_0x1820('0xe')];var _0x4b98cc=_0x2306a3['get']({'plain':!![]});if(_0x4b98cc['direction'][_0x1820('0xf')]()==='in'||_0x4b98cc[_0x1820('0x10')][_0x1820('0xf')]()===_0x1820('0x11')&&!_0x4b98cc['secret']&&!_[_0x1820('0x12')](_0x4b98cc[_0x1820('0x13')])){_0x52fb03['OpenchannelInteraction'][_0x1820('0x14')]({'where':{'id':_0x4b98cc[_0x1820('0x15')]}})[_0x1820('0x16')](function(_0x39c089){if(_0x39c089){_0x39c089['update']({'lastMsgAt':_0x4b98cc[_0x1820('0x17')],'lastMsgDirection':_0x4b98cc[_0x1820('0x10')][_0x1820('0xf')]()});}})['catch'](function(_0x1b0b90){console[_0x1820('0x18')](_0x1b0b90);});}if(_0x4b98cc[_0x1820('0x10')]===_0x1820('0x11')&&!_0x4b98cc[_0x1820('0x19')]){var _0x3e49d5;_0x52fb03[_0x1820('0x1a')][_0x1820('0x1b')]()[_0x1820('0x16')](function(_0x39b6da){return _0x52fb03[_0x1820('0x1c')][_0x1820('0x1d')]({'where':{'id':_0x4b98cc[_0x1820('0x1e')]},'include':[{'model':_0x52fb03[_0x1820('0x1f')],'as':_0x1820('0x20'),'where':{'id':_0x4b98cc[_0x1820('0x15')]},'limit':0x1,'include':[{'model':_0x52fb03[_0x1820('0x1a')],'as':_0x1820('0x21'),'attributes':_[_0x1820('0x22')](_0x39b6da)}]}]});})['then'](function(_0x35750f){_0x3e49d5=_0x35750f['get']({'plain':!![]});if(_0x3e49d5&&_0x3e49d5['replyUri']){logger[_0x1820('0x23')](_0x1820('0x24'),'afterCreate',util[_0x1820('0x25')](_0x1820('0x26'),_0x4b98cc['id'],_0x3e49d5[_0x1820('0x27')]));if(_0x3e49d5['Interactions']&&_0x3e49d5[_0x1820('0x20')][_0x1820('0x28')]){_0x4b98cc[_0x1820('0x29')]=_[_0x1820('0x2a')](_0x3e49d5[_0x1820('0x20')][0x0],_0x1820('0x21'));_0x4b98cc[_0x1820('0x21')]=_0x3e49d5['Interactions'][0x0][_0x1820('0x21')];}var _0x201ba0={'method':_0x1820('0x2b'),'uri':encodeURI(_0x3e49d5['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x201ba0[_0x1820('0x2c')]){case'GET':_0x201ba0['qs']=_0x4b98cc;break;case _0x1820('0x2b'):_0x201ba0[_0x1820('0xc')]=_0x4b98cc;break;}return rp(_0x201ba0)['then'](function(_0x24ae3b){logger[_0x1820('0x23')](_0x1820('0x24'),'afterCreate',util[_0x1820('0x25')](_0x1820('0x2d'),_0x4b98cc['id'],_0x3e49d5['replyUri']));if(_0x24ae3b['body'][_0x1820('0x2e')]&&_0x24ae3b[_0x1820('0xc')]['threadId']!=_0x4b98cc[_0x1820('0x29')][_0x1820('0x2e')]){return _0x52fb03[_0x1820('0x1f')][_0x1820('0x2f')]({'threadId':_0x24ae3b[_0x1820('0xc')][_0x1820('0x2e')]},{'where':{'id':_0x4b98cc[_0x1820('0x29')]['id']}});}else{return;}})[_0x1820('0x16')](function(){return _0x2306a3[_0x1820('0x2f')]({'read':!![]});})[_0x1820('0x30')](function(_0x1bb9ac){logger[_0x1820('0x18')]('OpenchannelMessage,\x20%s,\x20%s',_0x1820('0x31'),util['inspect'](_0x1bb9ac,{'showHidden':![],'depth':null}));_0x439d54();});}else{_0x439d54();}})[_0x1820('0x32')](function(){_0x439d54();});}else{_0x439d54();}}},'charset':_0x1820('0x33'),'collate':_0x1820('0x34')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 1514320..8759195 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 _0xadb5=['debug','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelMessage','body','raw','CreateOpenchannelMessage','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x2aed4e,_0x272d91){var _0x4d2ea0=function(_0x1532a2){while(--_0x1532a2){_0x2aed4e['push'](_0x2aed4e['shift']());}};_0x4d2ea0(++_0x272d91);}(_0xadb5,0xad));var _0x5adb=function(_0x3d62dd,_0x12cb9b){_0x3d62dd=_0x3d62dd-0x0;var _0x3122ff=_0xadb5[_0x3d62dd];return _0x3122ff;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});}exports['CreateOpenchannelMessage']=function(_0x1fbaa5){var _0x1bed20=this;return new Promise(function(_0x438671,_0x1fd4a7){return db[_0x5adb('0x1c')]['create'](_0x1fbaa5[_0x5adb('0x1d')],{'raw':_0x1fbaa5['options']?_0x1fbaa5['options'][_0x5adb('0x1e')]===undefined?!![]:![]:!![]})[_0x5adb('0x11')](function(_0x1a38d3){logger[_0x5adb('0x19')](_0x5adb('0x1f'),_0x1fbaa5);logger[_0x5adb('0x13')](_0x5adb('0x1f'),_0x1fbaa5,JSON['stringify'](_0x1a38d3));_0x438671(_0x1a38d3);})[_0x5adb('0x1b')](function(_0x373cc3){logger[_0x5adb('0x16')](_0x5adb('0x1f'),_0x373cc3[_0x5adb('0x18')],_0x1fbaa5);_0x1fd4a7(_0x1bed20['error'](0x1f4,_0x373cc3[_0x5adb('0x18')]));});});}; \ No newline at end of file +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(_0x105f9f,_0x34b44b){var _0x36256c=function(_0x33e81c){while(--_0x33e81c){_0x105f9f['push'](_0x105f9f['shift']());}};_0x36256c(++_0x34b44b);}(_0x5f66,0x1a0));var _0x65f6=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5f66[_0xa464c9];return _0x3d73c4;};'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 diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 60a0e6c..f3d3366 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 _0x1d7b=['removeListener','register','openchannelMessage:','./openchannelMessage.events','save','remove','update'];(function(_0x50cd28,_0x5f1b08){var _0x23f750=function(_0x2367fc){while(--_0x2367fc){_0x50cd28['push'](_0x50cd28['shift']());}};_0x23f750(++_0x5f1b08);}(_0x1d7b,0xb9));var _0xb1d7=function(_0x81bad7,_0x4aaec0){_0x81bad7=_0x81bad7-0x0;var _0x430b55=_0x1d7b[_0x81bad7];return _0x430b55;};'use strict';var OpenchannelMessageEvents=require(_0xb1d7('0x0'));var events=[_0xb1d7('0x1'),_0xb1d7('0x2'),_0xb1d7('0x3')];function createListener(_0x17dc27,_0x2e8a0e){return function(_0x1ac3bf){_0x2e8a0e['emit'](_0x17dc27,_0x1ac3bf);};}function removeListener(_0x4bb18f,_0x2e8ca0){return function(){OpenchannelMessageEvents[_0xb1d7('0x4')](_0x4bb18f,_0x2e8ca0);};}exports[_0xb1d7('0x5')]=function(_0x5b6f10){for(var _0x4f8e70=0x0,_0x1c8bf5=events['length'];_0x4f8e70<_0x1c8bf5;_0x4f8e70++){var _0x4d421d=events[_0x4f8e70];var _0x5eed59=createListener(_0xb1d7('0x6')+_0x4d421d,_0x5b6f10);OpenchannelMessageEvents['on'](_0x4d421d,_0x5eed59);}}; \ No newline at end of file +var _0x242e=['emit','removeListener','openchannelMessage:','./openchannelMessage.events','remove','update'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x242e,0x12f));var _0xe242=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x242e[_0x3e5086];return _0xfeb102;};'use strict';var OpenchannelMessageEvents=require(_0xe242('0x0'));var events=['save',_0xe242('0x1'),_0xe242('0x2')];function createListener(_0x5a24a7,_0x579440){return function(_0xf85009){_0x579440[_0xe242('0x3')](_0x5a24a7,_0xf85009);};}function removeListener(_0x35be65,_0x1da0f6){return function(){OpenchannelMessageEvents[_0xe242('0x4')](_0x35be65,_0x1da0f6);};}exports['register']=function(_0x53fdde){for(var _0x362bb0=0x0,_0x44a5a7=events['length'];_0x362bb0<_0x44a5a7;_0x362bb0++){var _0x28385b=events[_0x362bb0];var _0x1a4c05=createListener(_0xe242('0x5')+_0x28385b,_0x53fdde);OpenchannelMessageEvents['on'](_0x28385b,_0x1a4c05);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 0ac718f..62064d4 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 _0x88b1=['show','getMembers','/:id/teams','getTeams','post','create','/:id/users','update','delete','destroy','removeTeams','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelQueue.controller','get','isAuthenticated','/describe','describe','/:id'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x88b1,0x110));var _0x188b=function(_0x36a4ab,_0x18aea6){_0x36a4ab=_0x36a4ab-0x0;var _0x1f4386=_0x88b1[_0x36a4ab];return _0x1f4386;};'use strict';var multer=require(_0x188b('0x0'));var util=require(_0x188b('0x1'));var path=require(_0x188b('0x2'));var timeout=require(_0x188b('0x3'));var express=require(_0x188b('0x4'));var router=express[_0x188b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x188b('0x6'));var interaction=require(_0x188b('0x7'));var config=require('../../config/environment');var controller=require(_0x188b('0x8'));router[_0x188b('0x9')]('/',auth[_0x188b('0xa')](),controller['index']);router[_0x188b('0x9')](_0x188b('0xb'),auth[_0x188b('0xa')](),controller[_0x188b('0xc')]);router[_0x188b('0x9')](_0x188b('0xd'),auth[_0x188b('0xa')](),controller[_0x188b('0xe')]);router[_0x188b('0x9')]('/:id/members',auth[_0x188b('0xa')](),controller[_0x188b('0xf')]);router[_0x188b('0x9')](_0x188b('0x10'),auth[_0x188b('0xa')](),controller[_0x188b('0x11')]);router[_0x188b('0x9')]('/:id/users',auth[_0x188b('0xa')](),controller['getAgents']);router[_0x188b('0x12')]('/',auth[_0x188b('0xa')](),controller[_0x188b('0x13')]);router['post'](_0x188b('0x10'),auth[_0x188b('0xa')](),controller['addTeams']);router[_0x188b('0x12')](_0x188b('0x14'),auth[_0x188b('0xa')](),controller['addAgents']);router['put'](_0x188b('0xd'),auth[_0x188b('0xa')](),controller[_0x188b('0x15')]);router[_0x188b('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x188b('0x17')]);router[_0x188b('0x16')]('/:id/teams',auth['isAuthenticated'](),controller[_0x188b('0x18')]);router[_0x188b('0x16')](_0x188b('0x14'),auth[_0x188b('0xa')](),controller['removeAgents']);module[_0x188b('0x19')]=router; \ No newline at end of file +var _0x168e=['put','update','delete','destroy','removeTeams','removeAgents','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams'];(function(_0x3cd023,_0x545d9e){var _0x1a0163=function(_0xe7f852){while(--_0xe7f852){_0x3cd023['push'](_0x3cd023['shift']());}};_0x1a0163(++_0x545d9e);}(_0x168e,0x76));var _0xe168=function(_0x8a73d2,_0x78877b){_0x8a73d2=_0x8a73d2-0x0;var _0x506064=_0x168e[_0x8a73d2];return _0x506064;};'use strict';var multer=require(_0xe168('0x0'));var util=require(_0xe168('0x1'));var path=require(_0xe168('0x2'));var timeout=require(_0xe168('0x3'));var express=require(_0xe168('0x4'));var router=express['Router']();var fs_extra=require(_0xe168('0x5'));var auth=require(_0xe168('0x6'));var interaction=require(_0xe168('0x7'));var config=require(_0xe168('0x8'));var controller=require('./openchannelQueue.controller');router[_0xe168('0x9')]('/',auth[_0xe168('0xa')](),controller[_0xe168('0xb')]);router['get'](_0xe168('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xe168('0x9')](_0xe168('0xd'),auth['isAuthenticated'](),controller[_0xe168('0xe')]);router[_0xe168('0x9')]('/:id/members',auth[_0xe168('0xa')](),controller[_0xe168('0xf')]);router[_0xe168('0x9')]('/:id/teams',auth[_0xe168('0xa')](),controller[_0xe168('0x10')]);router[_0xe168('0x9')](_0xe168('0x11'),auth[_0xe168('0xa')](),controller[_0xe168('0x12')]);router[_0xe168('0x13')]('/',auth['isAuthenticated'](),controller[_0xe168('0x14')]);router[_0xe168('0x13')](_0xe168('0x15'),auth[_0xe168('0xa')](),controller['addTeams']);router[_0xe168('0x13')](_0xe168('0x11'),auth[_0xe168('0xa')](),controller['addAgents']);router[_0xe168('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xe168('0x17')]);router[_0xe168('0x18')](_0xe168('0xd'),auth[_0xe168('0xa')](),controller[_0xe168('0x19')]);router[_0xe168('0x18')]('/:id/teams',auth[_0xe168('0xa')](),controller[_0xe168('0x1a')]);router[_0xe168('0x18')](_0xe168('0x11'),auth[_0xe168('0xa')](),controller[_0xe168('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 3513354..30cb890 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 _0x06e3=['name','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x4e93a9,_0x413f30){var _0x43013c=function(_0x3a0cf3){while(--_0x3a0cf3){_0x4e93a9['push'](_0x4e93a9['shift']());}};_0x43013c(++_0x413f30);}(_0x06e3,0xd6));var _0x306e=function(_0x241b6a,_0x3257b9){_0x241b6a=_0x241b6a-0x0;var _0x13757a=_0x06e3[_0x241b6a];return _0x13757a;};'use strict';var Sequelize=require(_0x306e('0x0'));module[_0x306e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x306e('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x306e('0x3')]},'timeout':{'type':Sequelize[_0x306e('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x306e('0x5')](_0x306e('0x6'),_0x306e('0x7'),_0x306e('0x8'))}}; \ No newline at end of file +var _0xb1f9=['INTEGER','ENUM','rrmemory','beepall','name','STRING'];(function(_0x7ad8f8,_0x145cba){var _0x2d23c6=function(_0x2e4135){while(--_0x2e4135){_0x7ad8f8['push'](_0x7ad8f8['shift']());}};_0x2d23c6(++_0x145cba);}(_0xb1f9,0xa6));var _0x9b1f=function(_0x26075b,_0x1b7450){_0x26075b=_0x26075b-0x0;var _0xdbc322=_0xb1f9[_0x26075b];return _0xdbc322;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x9b1f('0x0'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9b1f('0x1')]},'timeout':{'type':Sequelize[_0x9b1f('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9b1f('0x3')](_0x9b1f('0x4'),_0x9b1f('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 8820b31..532bc17 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 _0x86b1=['every','TeamId','includes','all','union','value','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./openchannelQueue.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','OpenchannelQueues','stack','name','map','OpenchannelQueue','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','show','params','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserOpenchannelQueue','rawAttributes','hasOwnProperty','nolimit','OpenchannelQueueId','findAll','User','findAndCountAll','UserId','agent','SIP','createdAt','updatedAt','getTeams','findOne','Team','addTeams','ids','online','voicePause','interface','flatMap','Agents','sequelize','transaction','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','push','QueryTypes','SELECT'];(function(_0x1144ba,_0x4e7057){var _0x13575b=function(_0x2de9c8){while(--_0x2de9c8){_0x1144ba['push'](_0x1144ba['shift']());}};_0x13575b(++_0x4e7057);}(_0x86b1,0x126));var _0x186b=function(_0x308e1c,_0x160018){_0x308e1c=_0x308e1c-0x0;var _0x487001=_0x86b1[_0x308e1c];return _0x487001;};'use strict';var emlformat=require(_0x186b('0x0'));var rimraf=require(_0x186b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x186b('0x2'));var rp=require(_0x186b('0x3'));var moment=require(_0x186b('0x4'));var BPromise=require(_0x186b('0x5'));var Mustache=require(_0x186b('0x6'));var util=require(_0x186b('0x7'));var path=require(_0x186b('0x8'));var sox=require(_0x186b('0x9'));var csv=require(_0x186b('0xa'));var ejs=require(_0x186b('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x186b('0xc'));var squel=require(_0x186b('0xd'));var crypto=require(_0x186b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x186b('0xf'));var toCsv=require(_0x186b('0xa'));var querystring=require(_0x186b('0x10'));var Papa=require(_0x186b('0x11'));var Redis=require('ioredis');var authService=require(_0x186b('0x12'));var qs=require(_0x186b('0x13'));var as=require(_0x186b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x186b('0x15'))(_0x186b('0x16'));var utils=require('../../config/utils');var config=require(_0x186b('0x17'));var licenseUtil=require(_0x186b('0x18'));var db=require(_0x186b('0x19'))['db'];config[_0x186b('0x1a')]=_[_0x186b('0x1b')](config[_0x186b('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x186b('0x1a')]));require(_0x186b('0x1c'))['register'](socket);function respondWithStatusCode(_0x4f7569,_0x16a49a){_0x16a49a=_0x16a49a||0xcc;return function(_0x1c75c8){if(_0x1c75c8){return _0x4f7569[_0x186b('0x1d')](_0x16a49a);}return _0x4f7569['status'](_0x16a49a)[_0x186b('0x1e')]();};}function respondWithResult(_0xf2c165,_0x590fa3){_0x590fa3=_0x590fa3||0xc8;return function(_0xf3bbb2){if(_0xf3bbb2){return _0xf2c165[_0x186b('0x1f')](_0x590fa3)[_0x186b('0x20')](_0xf3bbb2);}};}function respondWithFilteredResult(_0x25d5ae,_0x384243){return function(_0x30f333){if(_0x30f333){var _0x2148ad=typeof _0x384243[_0x186b('0x21')]===_0x186b('0x22')&&typeof _0x384243[_0x186b('0x23')]===_0x186b('0x22');var _0x5a2a05=_0x30f333[_0x186b('0x24')];var _0x244b5c=_0x2148ad?0x0:_0x384243[_0x186b('0x21')];var _0x496bae=_0x2148ad?_0x30f333[_0x186b('0x24')]:_0x384243[_0x186b('0x21')]+_0x384243['limit'];var _0xcd11ec;if(_0x496bae>=_0x5a2a05){_0x496bae=_0x5a2a05;_0xcd11ec=0xc8;}else{_0xcd11ec=0xce;}_0x25d5ae[_0x186b('0x1f')](_0xcd11ec);return _0x25d5ae[_0x186b('0x25')]('Content-Range',_0x244b5c+'-'+_0x496bae+'/'+_0x5a2a05)['json'](_0x30f333);}return null;};}function patchUpdates(_0x141973){return function(_0x173727){try{jsonpatch[_0x186b('0x26')](_0x173727,_0x141973,!![]);}catch(_0x690b1e){return BPromise[_0x186b('0x27')](_0x690b1e);}return _0x173727[_0x186b('0x28')]();};}function saveUpdates(_0x5ab080,_0x3f3183){return function(_0x473ae9){if(_0x473ae9){return _0x473ae9[_0x186b('0x29')](_0x5ab080)[_0x186b('0x2a')](function(_0x115231){return _0x115231;});}return null;};}function removeEntity(_0x5dae67,_0x503a1b){return function(_0x48df4d){if(_0x48df4d){return _0x48df4d[_0x186b('0x2b')]()['then'](function(){var _0x3140fd=_0x48df4d[_0x186b('0x2c')]({'plain':!![]});var _0x4b0e14=_0x186b('0x2d');return db['UserProfileResource'][_0x186b('0x2b')]({'where':{'type':_0x4b0e14,'resourceId':_0x3140fd['id']}})[_0x186b('0x2a')](function(){return _0x48df4d;});})[_0x186b('0x2a')](function(){_0x5dae67[_0x186b('0x1f')](0xcc)[_0x186b('0x1e')]();});}};}function handleEntityNotFound(_0xe8f890,_0x24f42c){return function(_0x41b402){if(!_0x41b402){_0xe8f890[_0x186b('0x1d')](0x194);}return _0x41b402;};}function handleError(_0x34a766,_0x1753d2){_0x1753d2=_0x1753d2||0x1f4;return function(_0x30936c){logger['error'](_0x30936c[_0x186b('0x2e')]);if(_0x30936c[_0x186b('0x2f')]){delete _0x30936c[_0x186b('0x2f')];}_0x34a766[_0x186b('0x1f')](_0x1753d2)['send'](_0x30936c);};}exports['index']=function(_0x529eba,_0x1e5dc5){var _0x882c61={},_0x45308={},_0x2218f4={'count':0x0,'rows':[]};var _0x2fd935=_[_0x186b('0x30')](db[_0x186b('0x31')]['rawAttributes'],function(_0x51d3d8){return{'name':_0x51d3d8[_0x186b('0x32')],'type':_0x51d3d8[_0x186b('0x33')]['key']};});_0x45308[_0x186b('0x34')]=_[_0x186b('0x30')](_0x2fd935,_0x186b('0x2f'));_0x45308[_0x186b('0x35')]=_[_0x186b('0x36')](_0x529eba[_0x186b('0x35')]);_0x45308[_0x186b('0x37')]=_[_0x186b('0x38')](_0x45308[_0x186b('0x34')],_0x45308[_0x186b('0x35')]);_0x882c61[_0x186b('0x39')]=_[_0x186b('0x38')](_0x45308[_0x186b('0x34')],qs[_0x186b('0x3a')](_0x529eba['query'][_0x186b('0x3a')]));_0x882c61[_0x186b('0x39')]=_0x882c61[_0x186b('0x39')][_0x186b('0x3b')]?_0x882c61[_0x186b('0x39')]:_0x45308['model'];if(!_0x529eba[_0x186b('0x35')]['hasOwnProperty']('nolimit')){_0x882c61[_0x186b('0x23')]=qs['limit'](_0x529eba['query'][_0x186b('0x23')]);_0x882c61[_0x186b('0x21')]=qs['offset'](_0x529eba[_0x186b('0x35')]['offset']);}_0x882c61[_0x186b('0x3c')]=qs[_0x186b('0x3d')](_0x529eba[_0x186b('0x35')]['sort']);_0x882c61[_0x186b('0x3e')]=qs['filters'](_[_0x186b('0x3f')](_0x529eba['query'],_0x45308[_0x186b('0x37')]),_0x2fd935);if(_0x529eba['query'][_0x186b('0x40')]){_0x882c61[_0x186b('0x3e')]=_[_0x186b('0x41')](_0x882c61[_0x186b('0x3e')],{'$or':_[_0x186b('0x30')](_0x2fd935,function(_0x5035fa){if(_0x5035fa[_0x186b('0x33')]!==_0x186b('0x42')){var _0x34e9a7={};_0x34e9a7[_0x5035fa['name']]={'$like':'%'+_0x529eba['query'][_0x186b('0x40')]+'%'};return _0x34e9a7;}})});}_0x882c61=_[_0x186b('0x41')]({},_0x882c61,_0x529eba['options']);var _0x48567d={'where':_0x882c61[_0x186b('0x3e')]};return db['OpenchannelQueue'][_0x186b('0x24')](_0x48567d)[_0x186b('0x2a')](function(_0x10e9ad){_0x2218f4[_0x186b('0x24')]=_0x10e9ad;if(_0x529eba[_0x186b('0x35')][_0x186b('0x43')]){_0x882c61[_0x186b('0x44')]=[{'all':!![]}];}return db['OpenchannelQueue']['findAll'](_0x882c61);})['then'](function(_0x47d3e1){_0x2218f4[_0x186b('0x45')]=_0x47d3e1;return _0x2218f4;})[_0x186b('0x2a')](respondWithFilteredResult(_0x1e5dc5,_0x882c61))['catch'](handleError(_0x1e5dc5,null));};exports[_0x186b('0x46')]=function(_0x3357ed,_0x1ef859){var _0x5d27a1={'raw':!![],'where':{'id':_0x3357ed[_0x186b('0x47')]['id']}},_0xb7f3de={};_0xb7f3de['model']=_[_0x186b('0x36')](db[_0x186b('0x31')]['rawAttributes']);_0xb7f3de['query']=_[_0x186b('0x36')](_0x3357ed[_0x186b('0x35')]);_0xb7f3de[_0x186b('0x37')]=_[_0x186b('0x38')](_0xb7f3de[_0x186b('0x34')],_0xb7f3de['query']);_0x5d27a1[_0x186b('0x39')]=_[_0x186b('0x38')](_0xb7f3de[_0x186b('0x34')],qs['fields'](_0x3357ed['query'][_0x186b('0x3a')]));_0x5d27a1[_0x186b('0x39')]=_0x5d27a1[_0x186b('0x39')][_0x186b('0x3b')]?_0x5d27a1[_0x186b('0x39')]:_0xb7f3de[_0x186b('0x34')];if(_0x3357ed[_0x186b('0x35')][_0x186b('0x43')]){_0x5d27a1[_0x186b('0x44')]=[{'all':!![]}];}_0x5d27a1=_[_0x186b('0x41')]({},_0x5d27a1,_0x3357ed[_0x186b('0x48')]);return db['OpenchannelQueue'][_0x186b('0x49')](_0x5d27a1)[_0x186b('0x2a')](handleEntityNotFound(_0x1ef859,null))[_0x186b('0x2a')](respondWithResult(_0x1ef859,null))[_0x186b('0x4a')](handleError(_0x1ef859,null));};exports[_0x186b('0x4b')]=function(_0x33ad70,_0x106a86){return db['OpenchannelQueue']['create'](_0x33ad70[_0x186b('0x4c')],{})['then'](function(_0x3fc41f){var _0x1443d7=_0x33ad70[_0x186b('0x4d')]['get']({'plain':!![]});if(!_0x1443d7)throw new Error(_0x186b('0x4e'));if(_0x1443d7[_0x186b('0x4f')]===_0x186b('0x4d')){var _0x4c2f7a=_0x3fc41f[_0x186b('0x2c')]({'plain':!![]});var _0x30d76b=_0x186b('0x2d');return db[_0x186b('0x50')]['find']({'where':{'name':_0x30d76b,'userProfileId':_0x1443d7[_0x186b('0x51')]},'raw':!![]})[_0x186b('0x2a')](function(_0x207f4a){if(_0x207f4a&&_0x207f4a[_0x186b('0x52')]===0x0){return db[_0x186b('0x53')][_0x186b('0x4b')]({'name':_0x4c2f7a[_0x186b('0x2f')],'resourceId':_0x4c2f7a['id'],'type':_0x207f4a[_0x186b('0x2f')],'sectionId':_0x207f4a['id']},{})['then'](function(){return _0x3fc41f;});}else{return _0x3fc41f;}})[_0x186b('0x4a')](function(_0x57d5f3){logger[_0x186b('0x54')](_0x186b('0x55'),_0x57d5f3);throw _0x57d5f3;});}return _0x3fc41f;})['then'](respondWithResult(_0x106a86,0xc9))[_0x186b('0x4a')](handleError(_0x106a86,null));};exports['update']=function(_0x37d48c,_0x5d81f2){if(_0x37d48c[_0x186b('0x4c')]['id']){delete _0x37d48c[_0x186b('0x4c')]['id'];}return db[_0x186b('0x31')][_0x186b('0x49')]({'where':{'id':_0x37d48c[_0x186b('0x47')]['id']}})[_0x186b('0x2a')](handleEntityNotFound(_0x5d81f2,null))['then'](saveUpdates(_0x37d48c[_0x186b('0x4c')],null))[_0x186b('0x2a')](respondWithResult(_0x5d81f2,null))[_0x186b('0x4a')](handleError(_0x5d81f2,null));};exports['destroy']=function(_0x219762,_0xd1b162){return db[_0x186b('0x31')][_0x186b('0x49')]({'where':{'id':_0x219762[_0x186b('0x47')]['id']}})[_0x186b('0x2a')](handleEntityNotFound(_0xd1b162,null))[_0x186b('0x2a')](removeEntity(_0xd1b162,null))[_0x186b('0x4a')](handleError(_0xd1b162,null));};exports[_0x186b('0x56')]=function(_0x560727,_0x433e0a){return db[_0x186b('0x31')][_0x186b('0x56')]()[_0x186b('0x2a')](respondWithResult(_0x433e0a,null))[_0x186b('0x4a')](handleError(_0x433e0a,null));};exports[_0x186b('0x57')]=function(_0x16ae57,_0x362d93,_0x4a8d04){var _0x389049={'raw':!![],'where':{}},_0x27c8d1={},_0x443799;return db[_0x186b('0x31')]['findOne']({'where':{'id':_0x16ae57['params']['id']}})[_0x186b('0x2a')](handleEntityNotFound(_0x362d93,null))[_0x186b('0x2a')](function(_0x2a7f74){if(_0x2a7f74){_0x443799=_0x2a7f74[_0x186b('0x2c')]({'plain':!![]});_0x27c8d1['model']=_['keys'](db[_0x186b('0x58')][_0x186b('0x59')]);_0x27c8d1[_0x186b('0x35')]=_['keys'](_0x16ae57['query']);_0x27c8d1['filters']=_[_0x186b('0x38')](_0x27c8d1[_0x186b('0x34')],_0x27c8d1[_0x186b('0x35')]);_0x389049[_0x186b('0x39')]=_[_0x186b('0x38')](_0x27c8d1[_0x186b('0x34')],qs[_0x186b('0x3a')](_0x16ae57[_0x186b('0x35')]['fields']));_0x389049[_0x186b('0x39')]=_0x389049[_0x186b('0x39')][_0x186b('0x3b')]?_0x389049[_0x186b('0x39')]:_0x27c8d1['model'];if(!_0x16ae57[_0x186b('0x35')][_0x186b('0x5a')](_0x186b('0x5b'))){_0x389049[_0x186b('0x23')]=qs[_0x186b('0x23')](_0x16ae57[_0x186b('0x35')][_0x186b('0x23')]);_0x389049[_0x186b('0x21')]=qs[_0x186b('0x21')](_0x16ae57[_0x186b('0x35')][_0x186b('0x21')]);}_0x389049[_0x186b('0x3c')]=qs['sort'](_0x16ae57[_0x186b('0x35')][_0x186b('0x3d')]);_0x389049[_0x186b('0x3e')]=qs[_0x186b('0x37')](_[_0x186b('0x3f')](_0x16ae57[_0x186b('0x35')],_0x27c8d1[_0x186b('0x37')]));_0x389049[_0x186b('0x3e')][_0x186b('0x5c')]=_0x2a7f74['id'];if(_0x16ae57[_0x186b('0x35')][_0x186b('0x40')]){_0x389049[_0x186b('0x3e')]=_['merge'](_0x389049[_0x186b('0x3e')],{'$or':_['map'](_0x389049[_0x186b('0x39')],function(_0x20d47a){var _0x13a8ce={};_0x13a8ce[_0x20d47a]={'$like':'%'+_0x16ae57[_0x186b('0x35')][_0x186b('0x40')]+'%'};return _0x13a8ce;})});}_0x389049=_[_0x186b('0x41')]({},_0x389049,_0x16ae57[_0x186b('0x48')]);return db['UserOpenchannelQueue'][_0x186b('0x5d')](_0x389049);}})[_0x186b('0x2a')](function(_0x2c03b1){if(_0x2c03b1){return db[_0x186b('0x5e')][_0x186b('0x5f')]({'where':{'id':_[_0x186b('0x30')](_0x2c03b1,_0x186b('0x60')),'role':_0x186b('0x61')},'attributes':['id',_0x186b('0x2f'),'openchannelPause','updatedAt','createdAt']});}})['then'](function(_0x13ae64){if(_0x13ae64){return{'count':_0x13ae64[_0x186b('0x24')],'rows':_[_0x186b('0x30')](_0x13ae64['rows'],function(_0x15d682){return{'membername':_0x15d682[_0x186b('0x2f')],'UserId':_0x15d682['id'],'queue_name':_0x443799[_0x186b('0x2f')],'OpenchannelQueueId':_0x443799['id'],'interface':util['format']('%s/%s',_0x186b('0x62'),_0x15d682[_0x186b('0x2f')]),'penalty':0x0,'paused':_0x15d682['openchannelPause'],'createdAt':_0x15d682[_0x186b('0x63')],'updatedAt':_0x15d682[_0x186b('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x186b('0x2a')](respondWithFilteredResult(_0x362d93,_0x389049))[_0x186b('0x4a')](handleError(_0x362d93,null));};exports[_0x186b('0x65')]=function(_0x484fe0,_0x9b5322,_0x1e422a){var _0x5456d8={};var _0x470dcc={};var _0x201a78;var _0x52005c;return db[_0x186b('0x31')][_0x186b('0x66')]({'where':{'id':_0x484fe0[_0x186b('0x47')]['id']}})[_0x186b('0x2a')](handleEntityNotFound(_0x9b5322,null))[_0x186b('0x2a')](function(_0x5a2b6a){if(_0x5a2b6a){_0x201a78=_0x5a2b6a;_0x470dcc[_0x186b('0x34')]=_[_0x186b('0x36')](db[_0x186b('0x67')]['rawAttributes']);_0x470dcc[_0x186b('0x35')]=_[_0x186b('0x36')](_0x484fe0[_0x186b('0x35')]);_0x470dcc[_0x186b('0x37')]=_[_0x186b('0x38')](_0x470dcc[_0x186b('0x34')],_0x470dcc[_0x186b('0x35')]);_0x5456d8[_0x186b('0x39')]=_['intersection'](_0x470dcc[_0x186b('0x34')],qs[_0x186b('0x3a')](_0x484fe0[_0x186b('0x35')][_0x186b('0x3a')]));_0x5456d8[_0x186b('0x39')]=_0x5456d8[_0x186b('0x39')][_0x186b('0x3b')]?_0x5456d8[_0x186b('0x39')]:_0x470dcc[_0x186b('0x34')];_0x5456d8[_0x186b('0x3c')]=qs[_0x186b('0x3d')](_0x484fe0[_0x186b('0x35')][_0x186b('0x3d')]);_0x5456d8[_0x186b('0x3e')]=qs['filters'](_['pick'](_0x484fe0[_0x186b('0x35')],_0x470dcc[_0x186b('0x37')]));if(_0x484fe0[_0x186b('0x35')][_0x186b('0x40')]){_0x5456d8['where']=_['merge'](_0x5456d8[_0x186b('0x3e')],{'$or':_['map'](_0x5456d8[_0x186b('0x39')],function(_0xbb5f3){var _0xc3c52={};_0xc3c52[_0xbb5f3]={'$like':'%'+_0x484fe0[_0x186b('0x35')][_0x186b('0x40')]+'%'};return _0xc3c52;})});}_0x5456d8=_[_0x186b('0x41')]({},_0x5456d8,_0x484fe0['options']);return _0x201a78[_0x186b('0x65')](_0x5456d8);}})[_0x186b('0x2a')](function(_0xe0d9d4){if(_0xe0d9d4){_0x52005c=_0xe0d9d4[_0x186b('0x3b')];if(!_0x484fe0['query']['hasOwnProperty'](_0x186b('0x5b'))){_0x5456d8[_0x186b('0x23')]=qs[_0x186b('0x23')](_0x484fe0[_0x186b('0x35')][_0x186b('0x23')]);_0x5456d8['offset']=qs[_0x186b('0x21')](_0x484fe0['query'][_0x186b('0x21')]);}return _0x201a78['getTeams'](_0x5456d8);}})[_0x186b('0x2a')](function(_0x59b01f){if(_0x59b01f){return _0x59b01f?{'count':_0x52005c,'rows':_0x59b01f}:null;}})['then'](respondWithResult(_0x9b5322,null))[_0x186b('0x4a')](handleError(_0x9b5322,null));};exports[_0x186b('0x68')]=function(_0x40f1d0,_0x42a703,_0xfdbd5f){var _0x3adff8=_0x40f1d0[_0x186b('0x4c')][_0x186b('0x69')];return db[_0x186b('0x67')]['findAll']({'where':{'id':_0x3adff8},'attributes':['id'],'include':[{'model':db[_0x186b('0x5e')],'as':'Agents','attributes':['id','name',_0x186b('0x6a'),_0x186b('0x6b'),_0x186b('0x6c')],'raw':!![]}]})['then'](function(_0x5eee56){if(_0x5eee56){var _0x30cfb2=_[_0x186b('0x6d')](_0x5eee56,function(_0x193434){var _0x55b60d=_0x193434['get']({'plain':!![]});return _0x55b60d[_0x186b('0x6e')];});return db[_0x186b('0x31')][_0x186b('0x49')]({'where':{'id':_0x40f1d0[_0x186b('0x47')]['id']}})[_0x186b('0x2a')](function(_0x12296a){return db[_0x186b('0x6f')][_0x186b('0x70')](function(_0x3a861f){return _0x12296a[_0x186b('0x68')](_0x3adff8,{'transaction':_0x3a861f})['then'](function(){return BPromise['each'](_0x30cfb2,function(_0x4ed156){return db[_0x186b('0x58')]['findOrCreate']({'where':{'UserId':_0x4ed156['id'],'OpenchannelQueueId':_0x40f1d0[_0x186b('0x47')]['id']},'transaction':_0x3a861f});});})[_0x186b('0x2a')](function(){_0x30cfb2[_0x186b('0x71')](function(_0x280549){socket[_0x186b('0x72')](_0x186b('0x73'),{'UserId':_0x280549['id'],'OpenchannelQueueId':_0x12296a['id']});});});});});}})[_0x186b('0x2a')](respondWithStatusCode(_0x42a703,null))['catch'](handleError(_0x42a703,null));};exports[_0x186b('0x74')]=function(_0x32b790,_0x3fc75a,_0x256dfb){return db[_0x186b('0x67')]['findAll']({'where':{'id':_0x32b790[_0x186b('0x35')][_0x186b('0x69')]},'attributes':['id'],'include':[{'model':db[_0x186b('0x5e')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x186b('0x2a')](handleEntityNotFound(_0x3fc75a,null))[_0x186b('0x2a')](function(_0x41574b){var _0x417be9=_[_0x186b('0x30')](_0x41574b,'id');var _0x5bd7d2=[];var _0x5c9332=[];var _0x223f80=squel[_0x186b('0x75')]();_0x223f80[_0x186b('0x76')]('tq.TeamId')[_0x186b('0x77')](_0x186b('0x78'),'tq')[_0x186b('0x79')](_0x186b('0x7a'),'ut',_0x186b('0x7b'))[_0x186b('0x3e')](_0x186b('0x7c'),_0x32b790[_0x186b('0x47')]['id']);for(var _0x78bf67=0x0;_0x78bf67<_0x41574b['length'];_0x78bf67+=0x1){let _0x4b03a5=_0x41574b[_0x78bf67];for(var _0x18b018=0x0;_0x18b018<_0x4b03a5[_0x186b('0x6e')][_0x186b('0x3b')];_0x18b018+=0x1){let _0x3f47f6=_0x4b03a5['Agents'][_0x18b018];var _0x177f8f=_0x223f80[_0x186b('0x7d')]();_0x177f8f['where']('ut.UserId\x20=\x20?',_0x3f47f6['id']);_0x5c9332[_0x186b('0x7e')](db[_0x186b('0x6f')]['query'](_0x177f8f['toString'](),{'type':db[_0x186b('0x6f')][_0x186b('0x7f')][_0x186b('0x80')]})[_0x186b('0x2a')](function(_0x379b95){if(_0x379b95[_0x186b('0x3b')]===0x1){return _0x3f47f6['id'];}else{var _0x1e77ff=_[_0x186b('0x81')](_['map'](_0x379b95,_0x186b('0x82')),function(_0x41ee38){return _[_0x186b('0x83')](_0x417be9,_0x41ee38);});if(_0x1e77ff){return _0x3f47f6['id'];}}}));}}return BPromise[_0x186b('0x84')](_0x5c9332)[_0x186b('0x2a')](function(_0x1c6df5){_0x5bd7d2=_(_0x5bd7d2)[_0x186b('0x85')](_0x1c6df5)['compact']()[_0x186b('0x86')]();return db[_0x186b('0x31')][_0x186b('0x49')]({'where':{'id':_0x32b790['params']['id']}})[_0x186b('0x2a')](function(_0xe32988){return db['sequelize'][_0x186b('0x70')](function(_0x26346f){return _0xe32988[_0x186b('0x74')](_0x32b790[_0x186b('0x35')][_0x186b('0x69')],{'transaction':_0x26346f})[_0x186b('0x2a')](function(){if(!_['isEmpty'](_0x5bd7d2)){return _0xe32988[_0x186b('0x87')](_0x5bd7d2,{'transaction':_0x26346f});}})['then'](function(){_0x5bd7d2[_0x186b('0x71')](function(_0x307fa6){socket[_0x186b('0x72')](_0x186b('0x88'),{'UserId':_0x307fa6,'OpenchannelQueueId':_0xe32988['id']});});});});});});})['then'](respondWithStatusCode(_0x3fc75a,null))[_0x186b('0x4a')](handleError(_0x3fc75a,null));};exports[_0x186b('0x89')]=function(_0x550bcc,_0x3e0314,_0x2ee653){return db['OpenchannelQueue'][_0x186b('0x49')]({'where':{'id':_0x550bcc[_0x186b('0x47')]['id']}})[_0x186b('0x2a')](handleEntityNotFound(_0x3e0314,null))[_0x186b('0x2a')](function(_0x980cce){if(_0x980cce){return _0x980cce['addAgents'](_0x550bcc[_0x186b('0x4c')][_0x186b('0x69')],_[_0x186b('0x8a')](_0x550bcc[_0x186b('0x4c')],[_0x186b('0x69'),'id'])||{})[_0x186b('0x8b')](function(_0x5ae77c){for(var _0x493f3c=0x0;_0x493f3c<_0x550bcc[_0x186b('0x4c')][_0x186b('0x69')][_0x186b('0x3b')];_0x493f3c+=0x1){socket[_0x186b('0x72')](_0x186b('0x73'),{'UserId':Number(_0x550bcc['body']['ids'][_0x493f3c]),'OpenchannelQueueId':Number(_0x550bcc[_0x186b('0x47')]['id'])});}return _0x5ae77c;});}})[_0x186b('0x2a')](respondWithResult(_0x3e0314,null))[_0x186b('0x4a')](handleError(_0x3e0314,null));};exports[_0x186b('0x87')]=function(_0x15e7b8,_0x20da44,_0x18994e){return db[_0x186b('0x31')]['find']({'where':{'id':_0x15e7b8[_0x186b('0x47')]['id']}})[_0x186b('0x2a')](handleEntityNotFound(_0x20da44,null))[_0x186b('0x2a')](function(_0x3b24ac){if(_0x3b24ac){return _0x3b24ac[_0x186b('0x87')](_0x15e7b8['query']['ids'])[_0x186b('0x2a')](function(){if(_['isArray'](_0x15e7b8[_0x186b('0x35')]['ids'])){for(var _0x33e213=0x0;_0x33e213<_0x15e7b8[_0x186b('0x35')][_0x186b('0x69')][_0x186b('0x3b')];_0x33e213+=0x1){socket[_0x186b('0x72')](_0x186b('0x88'),{'UserId':Number(_0x15e7b8['query'][_0x186b('0x69')][_0x33e213]),'OpenchannelQueueId':Number(_0x15e7b8['params']['id'])});}}else{socket['emit'](_0x186b('0x88'),{'UserId':Number(_0x15e7b8[_0x186b('0x35')][_0x186b('0x69')]),'OpenchannelQueueId':Number(_0x15e7b8['params']['id'])});}});}})[_0x186b('0x2a')](respondWithStatusCode(_0x20da44,null))[_0x186b('0x4a')](handleError(_0x20da44,null));};exports['getAgents']=function(_0x2be592,_0x457ea3,_0xe36ccb){var _0x568a5f={};var _0x5e2754={};var _0x38a88c;var _0x2bca8a;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x2be592['params']['id']}})[_0x186b('0x2a')](handleEntityNotFound(_0x457ea3,null))[_0x186b('0x2a')](function(_0x347071){if(_0x347071){_0x38a88c=_0x347071;_0x5e2754[_0x186b('0x34')]=_[_0x186b('0x36')](db[_0x186b('0x5e')][_0x186b('0x59')]);_0x5e2754['query']=_[_0x186b('0x36')](_0x2be592['query']);_0x5e2754[_0x186b('0x37')]=_[_0x186b('0x38')](_0x5e2754[_0x186b('0x34')],_0x5e2754[_0x186b('0x35')]);_0x568a5f['attributes']=_['intersection'](_0x5e2754[_0x186b('0x34')],qs['fields'](_0x2be592['query']['fields']));_0x568a5f[_0x186b('0x39')]=_0x568a5f[_0x186b('0x39')][_0x186b('0x3b')]?_0x568a5f['attributes']:_0x5e2754[_0x186b('0x34')];_0x568a5f['order']=qs['sort'](_0x2be592['query']['sort']);_0x568a5f[_0x186b('0x3e')]=qs[_0x186b('0x37')](_[_0x186b('0x3f')](_0x2be592[_0x186b('0x35')],_0x5e2754[_0x186b('0x37')]));if(_0x2be592[_0x186b('0x35')][_0x186b('0x40')]){_0x568a5f['where']=_['merge'](_0x568a5f['where'],{'$or':_['map'](_0x568a5f[_0x186b('0x39')],function(_0x225438){var _0x3f250c={};_0x3f250c[_0x225438]={'$like':'%'+_0x2be592[_0x186b('0x35')][_0x186b('0x40')]+'%'};return _0x3f250c;})});}_0x568a5f=_['merge']({},_0x568a5f,_0x2be592[_0x186b('0x48')]);return _0x38a88c[_0x186b('0x8c')](_0x568a5f);}})[_0x186b('0x2a')](function(_0x2fd916){if(_0x2fd916){_0x2bca8a=_0x2fd916['length'];if(!_0x2be592[_0x186b('0x35')][_0x186b('0x5a')](_0x186b('0x5b'))){_0x568a5f['limit']=qs[_0x186b('0x23')](_0x2be592[_0x186b('0x35')][_0x186b('0x23')]);_0x568a5f['offset']=qs[_0x186b('0x21')](_0x2be592[_0x186b('0x35')]['offset']);}return _0x38a88c[_0x186b('0x8c')](_0x568a5f);}})[_0x186b('0x2a')](function(_0xf48299){if(_0xf48299){return _0xf48299?{'count':_0x2bca8a,'rows':_0xf48299}:null;}})['then'](respondWithResult(_0x457ea3,null))[_0x186b('0x4a')](handleError(_0x457ea3,null));}; \ No newline at end of file +var _0x737f=['addAgents','omit','spread','removeAgents','getAgents','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/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','offset','undefined','limit','count','set','json','reject','update','then','destroy','get','OpenchannelQueues','UserProfileResource','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','VIRTUAL','merge','options','includeAll','include','rows','catch','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','describe','getMembers','findOne','UserOpenchannelQueue','pick','OpenchannelQueueId','filter','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','order','ids','Agents','online','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','findAll','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','union','compact','value','isEmpty','userOpenchannelQueue:remove'];(function(_0x18e564,_0x1cd5e2){var _0x214a7f=function(_0x4932c9){while(--_0x4932c9){_0x18e564['push'](_0x18e564['shift']());}};_0x214a7f(++_0x1cd5e2);}(_0x737f,0x1b8));var _0xf737=function(_0x1da881,_0x224365){_0x1da881=_0x1da881-0x0;var _0x5bc895=_0x737f[_0x1da881];return _0x5bc895;};'use strict';var emlformat=require(_0xf737('0x0'));var rimraf=require(_0xf737('0x1'));var zipdir=require(_0xf737('0x2'));var jsonpatch=require(_0xf737('0x3'));var rp=require(_0xf737('0x4'));var moment=require(_0xf737('0x5'));var BPromise=require(_0xf737('0x6'));var Mustache=require('mustache');var util=require(_0xf737('0x7'));var path=require(_0xf737('0x8'));var sox=require(_0xf737('0x9'));var csv=require(_0xf737('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf737('0xb'));var _=require(_0xf737('0xc'));var squel=require(_0xf737('0xd'));var crypto=require(_0xf737('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xf737('0xf'));var toCsv=require(_0xf737('0xa'));var querystring=require(_0xf737('0x10'));var Papa=require('papaparse');var Redis=require(_0xf737('0x11'));var authService=require(_0xf737('0x12'));var qs=require(_0xf737('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf737('0x14'));var logger=require(_0xf737('0x15'))(_0xf737('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf737('0x17'));var db=require(_0xf737('0x18'))['db'];config[_0xf737('0x19')]=_[_0xf737('0x1a')](config[_0xf737('0x19')],{'host':_0xf737('0x1b'),'port':0x18eb});var socket=require(_0xf737('0x1c'))(new Redis(config[_0xf737('0x19')]));require(_0xf737('0x1d'))[_0xf737('0x1e')](socket);function respondWithStatusCode(_0x4093b4,_0x1dac0d){_0x1dac0d=_0x1dac0d||0xcc;return function(_0x299aaf){if(_0x299aaf){return _0x4093b4[_0xf737('0x1f')](_0x1dac0d);}return _0x4093b4[_0xf737('0x20')](_0x1dac0d)['end']();};}function respondWithResult(_0x55f70f,_0x199d6f){_0x199d6f=_0x199d6f||0xc8;return function(_0x492f59){if(_0x492f59){return _0x55f70f[_0xf737('0x20')](_0x199d6f)['json'](_0x492f59);}};}function respondWithFilteredResult(_0x2637fd,_0x3a17c6){return function(_0x262929){if(_0x262929){var _0x378bc6=typeof _0x3a17c6[_0xf737('0x21')]===_0xf737('0x22')&&typeof _0x3a17c6[_0xf737('0x23')]===_0xf737('0x22');var _0x129e30=_0x262929[_0xf737('0x24')];var _0x509621=_0x378bc6?0x0:_0x3a17c6['offset'];var _0x157941=_0x378bc6?_0x262929[_0xf737('0x24')]:_0x3a17c6[_0xf737('0x21')]+_0x3a17c6[_0xf737('0x23')];var _0x55d170;if(_0x157941>=_0x129e30){_0x157941=_0x129e30;_0x55d170=0xc8;}else{_0x55d170=0xce;}_0x2637fd[_0xf737('0x20')](_0x55d170);return _0x2637fd[_0xf737('0x25')]('Content-Range',_0x509621+'-'+_0x157941+'/'+_0x129e30)[_0xf737('0x26')](_0x262929);}return null;};}function patchUpdates(_0x7b524a){return function(_0x200a89){try{jsonpatch['apply'](_0x200a89,_0x7b524a,!![]);}catch(_0x32eb43){return BPromise[_0xf737('0x27')](_0x32eb43);}return _0x200a89['save']();};}function saveUpdates(_0x11470e,_0xfc736e){return function(_0x28fe69){if(_0x28fe69){return _0x28fe69[_0xf737('0x28')](_0x11470e)[_0xf737('0x29')](function(_0x98b164){return _0x98b164;});}return null;};}function removeEntity(_0x5c29e3,_0x5adade){return function(_0x3c2e25){if(_0x3c2e25){return _0x3c2e25[_0xf737('0x2a')]()[_0xf737('0x29')](function(){var _0x493500=_0x3c2e25[_0xf737('0x2b')]({'plain':!![]});var _0x55bf81=_0xf737('0x2c');return db[_0xf737('0x2d')][_0xf737('0x2a')]({'where':{'type':_0x55bf81,'resourceId':_0x493500['id']}})[_0xf737('0x29')](function(){return _0x3c2e25;});})['then'](function(){_0x5c29e3[_0xf737('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e62ea,_0x184455){return function(_0x4e89cb){if(!_0x4e89cb){_0x2e62ea[_0xf737('0x1f')](0x194);}return _0x4e89cb;};}function handleError(_0x30828a,_0x5c6d06){_0x5c6d06=_0x5c6d06||0x1f4;return function(_0x2b0140){logger[_0xf737('0x2e')](_0x2b0140[_0xf737('0x2f')]);if(_0x2b0140[_0xf737('0x30')]){delete _0x2b0140[_0xf737('0x30')];}_0x30828a['status'](_0x5c6d06)[_0xf737('0x31')](_0x2b0140);};}exports[_0xf737('0x32')]=function(_0x46b0f6,_0x1efd6c){var _0x1a17b7={},_0x4b8e7c={},_0x3fc2ed={'count':0x0,'rows':[]};var _0x14e9e9=_[_0xf737('0x33')](db[_0xf737('0x34')][_0xf737('0x35')],function(_0x50972f){return{'name':_0x50972f[_0xf737('0x36')],'type':_0x50972f[_0xf737('0x37')]['key']};});_0x4b8e7c[_0xf737('0x38')]=_[_0xf737('0x33')](_0x14e9e9,_0xf737('0x30'));_0x4b8e7c['query']=_[_0xf737('0x39')](_0x46b0f6['query']);_0x4b8e7c[_0xf737('0x3a')]=_['intersection'](_0x4b8e7c['model'],_0x4b8e7c[_0xf737('0x3b')]);_0x1a17b7[_0xf737('0x3c')]=_[_0xf737('0x3d')](_0x4b8e7c[_0xf737('0x38')],qs[_0xf737('0x3e')](_0x46b0f6[_0xf737('0x3b')][_0xf737('0x3e')]));_0x1a17b7[_0xf737('0x3c')]=_0x1a17b7['attributes'][_0xf737('0x3f')]?_0x1a17b7[_0xf737('0x3c')]:_0x4b8e7c[_0xf737('0x38')];if(!_0x46b0f6[_0xf737('0x3b')][_0xf737('0x40')](_0xf737('0x41'))){_0x1a17b7['limit']=qs['limit'](_0x46b0f6[_0xf737('0x3b')]['limit']);_0x1a17b7[_0xf737('0x21')]=qs['offset'](_0x46b0f6[_0xf737('0x3b')][_0xf737('0x21')]);}_0x1a17b7['order']=qs['sort'](_0x46b0f6[_0xf737('0x3b')][_0xf737('0x42')]);_0x1a17b7['where']=qs[_0xf737('0x3a')](_['pick'](_0x46b0f6['query'],_0x4b8e7c['filters']),_0x14e9e9);if(_0x46b0f6['query']['filter']){_0x1a17b7[_0xf737('0x43')]=_['merge'](_0x1a17b7[_0xf737('0x43')],{'$or':_['map'](_0x14e9e9,function(_0x4188e3){if(_0x4188e3[_0xf737('0x37')]!==_0xf737('0x44')){var _0xef7c71={};_0xef7c71[_0x4188e3[_0xf737('0x30')]]={'$like':'%'+_0x46b0f6[_0xf737('0x3b')]['filter']+'%'};return _0xef7c71;}})});}_0x1a17b7=_[_0xf737('0x45')]({},_0x1a17b7,_0x46b0f6[_0xf737('0x46')]);var _0xfce7b7={'where':_0x1a17b7[_0xf737('0x43')]};return db['OpenchannelQueue'][_0xf737('0x24')](_0xfce7b7)[_0xf737('0x29')](function(_0x4a2d97){_0x3fc2ed[_0xf737('0x24')]=_0x4a2d97;if(_0x46b0f6[_0xf737('0x3b')][_0xf737('0x47')]){_0x1a17b7[_0xf737('0x48')]=[{'all':!![]}];}return db[_0xf737('0x34')]['findAll'](_0x1a17b7);})[_0xf737('0x29')](function(_0x220a03){_0x3fc2ed[_0xf737('0x49')]=_0x220a03;return _0x3fc2ed;})[_0xf737('0x29')](respondWithFilteredResult(_0x1efd6c,_0x1a17b7))[_0xf737('0x4a')](handleError(_0x1efd6c,null));};exports['show']=function(_0x291569,_0x8854a0){var _0x1da28c={'raw':!![],'where':{'id':_0x291569[_0xf737('0x4b')]['id']}},_0x44bd2d={};_0x44bd2d[_0xf737('0x38')]=_[_0xf737('0x39')](db[_0xf737('0x34')][_0xf737('0x35')]);_0x44bd2d[_0xf737('0x3b')]=_[_0xf737('0x39')](_0x291569[_0xf737('0x3b')]);_0x44bd2d[_0xf737('0x3a')]=_['intersection'](_0x44bd2d[_0xf737('0x38')],_0x44bd2d['query']);_0x1da28c[_0xf737('0x3c')]=_[_0xf737('0x3d')](_0x44bd2d['model'],qs[_0xf737('0x3e')](_0x291569[_0xf737('0x3b')][_0xf737('0x3e')]));_0x1da28c[_0xf737('0x3c')]=_0x1da28c[_0xf737('0x3c')][_0xf737('0x3f')]?_0x1da28c[_0xf737('0x3c')]:_0x44bd2d[_0xf737('0x38')];if(_0x291569['query'][_0xf737('0x47')]){_0x1da28c[_0xf737('0x48')]=[{'all':!![]}];}_0x1da28c=_[_0xf737('0x45')]({},_0x1da28c,_0x291569['options']);return db[_0xf737('0x34')][_0xf737('0x4c')](_0x1da28c)[_0xf737('0x29')](handleEntityNotFound(_0x8854a0,null))['then'](respondWithResult(_0x8854a0,null))[_0xf737('0x4a')](handleError(_0x8854a0,null));};exports[_0xf737('0x4d')]=function(_0x108ae5,_0x307e0a){return db[_0xf737('0x34')][_0xf737('0x4d')](_0x108ae5[_0xf737('0x4e')],{})[_0xf737('0x29')](function(_0x1d4bf1){var _0x2d82e7=_0x108ae5['user']['get']({'plain':!![]});if(!_0x2d82e7)throw new Error(_0xf737('0x4f'));if(_0x2d82e7[_0xf737('0x50')]===_0xf737('0x51')){var _0x1fc03c=_0x1d4bf1[_0xf737('0x2b')]({'plain':!![]});var _0x510ea9=_0xf737('0x2c');return db[_0xf737('0x52')]['find']({'where':{'name':_0x510ea9,'userProfileId':_0x2d82e7['userProfileId']},'raw':!![]})['then'](function(_0x20f1ee){if(_0x20f1ee&&_0x20f1ee[_0xf737('0x53')]===0x0){return db[_0xf737('0x2d')][_0xf737('0x4d')]({'name':_0x1fc03c[_0xf737('0x30')],'resourceId':_0x1fc03c['id'],'type':_0x20f1ee[_0xf737('0x30')],'sectionId':_0x20f1ee['id']},{})[_0xf737('0x29')](function(){return _0x1d4bf1;});}else{return _0x1d4bf1;}})[_0xf737('0x4a')](function(_0x254e05){logger['error'](_0xf737('0x54'),_0x254e05);throw _0x254e05;});}return _0x1d4bf1;})[_0xf737('0x29')](respondWithResult(_0x307e0a,0xc9))[_0xf737('0x4a')](handleError(_0x307e0a,null));};exports['update']=function(_0x2edc64,_0x4d117b){if(_0x2edc64[_0xf737('0x4e')]['id']){delete _0x2edc64[_0xf737('0x4e')]['id'];}return db['OpenchannelQueue'][_0xf737('0x4c')]({'where':{'id':_0x2edc64[_0xf737('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4d117b,null))[_0xf737('0x29')](saveUpdates(_0x2edc64['body'],null))['then'](respondWithResult(_0x4d117b,null))['catch'](handleError(_0x4d117b,null));};exports['destroy']=function(_0x341acd,_0x2e025d){return db['OpenchannelQueue'][_0xf737('0x4c')]({'where':{'id':_0x341acd['params']['id']}})[_0xf737('0x29')](handleEntityNotFound(_0x2e025d,null))[_0xf737('0x29')](removeEntity(_0x2e025d,null))[_0xf737('0x4a')](handleError(_0x2e025d,null));};exports[_0xf737('0x55')]=function(_0x53def2,_0x46eb7b){return db[_0xf737('0x34')][_0xf737('0x55')]()[_0xf737('0x29')](respondWithResult(_0x46eb7b,null))['catch'](handleError(_0x46eb7b,null));};exports[_0xf737('0x56')]=function(_0xfda803,_0x483590,_0x412def){var _0x5d5e5a={'raw':!![],'where':{}},_0x349449={},_0x551aa1;return db[_0xf737('0x34')][_0xf737('0x57')]({'where':{'id':_0xfda803['params']['id']}})[_0xf737('0x29')](handleEntityNotFound(_0x483590,null))[_0xf737('0x29')](function(_0x27f35b){if(_0x27f35b){_0x551aa1=_0x27f35b['get']({'plain':!![]});_0x349449[_0xf737('0x38')]=_['keys'](db[_0xf737('0x58')][_0xf737('0x35')]);_0x349449[_0xf737('0x3b')]=_[_0xf737('0x39')](_0xfda803['query']);_0x349449[_0xf737('0x3a')]=_['intersection'](_0x349449[_0xf737('0x38')],_0x349449[_0xf737('0x3b')]);_0x5d5e5a['attributes']=_[_0xf737('0x3d')](_0x349449[_0xf737('0x38')],qs[_0xf737('0x3e')](_0xfda803[_0xf737('0x3b')][_0xf737('0x3e')]));_0x5d5e5a['attributes']=_0x5d5e5a['attributes']['length']?_0x5d5e5a['attributes']:_0x349449['model'];if(!_0xfda803[_0xf737('0x3b')][_0xf737('0x40')](_0xf737('0x41'))){_0x5d5e5a['limit']=qs[_0xf737('0x23')](_0xfda803[_0xf737('0x3b')][_0xf737('0x23')]);_0x5d5e5a[_0xf737('0x21')]=qs['offset'](_0xfda803[_0xf737('0x3b')][_0xf737('0x21')]);}_0x5d5e5a['order']=qs['sort'](_0xfda803[_0xf737('0x3b')][_0xf737('0x42')]);_0x5d5e5a[_0xf737('0x43')]=qs['filters'](_[_0xf737('0x59')](_0xfda803['query'],_0x349449['filters']));_0x5d5e5a[_0xf737('0x43')][_0xf737('0x5a')]=_0x27f35b['id'];if(_0xfda803[_0xf737('0x3b')][_0xf737('0x5b')]){_0x5d5e5a[_0xf737('0x43')]=_[_0xf737('0x45')](_0x5d5e5a[_0xf737('0x43')],{'$or':_['map'](_0x5d5e5a[_0xf737('0x3c')],function(_0x43e587){var _0x513c70={};_0x513c70[_0x43e587]={'$like':'%'+_0xfda803[_0xf737('0x3b')]['filter']+'%'};return _0x513c70;})});}_0x5d5e5a=_['merge']({},_0x5d5e5a,_0xfda803['options']);return db[_0xf737('0x58')]['findAll'](_0x5d5e5a);}})[_0xf737('0x29')](function(_0x24b390){if(_0x24b390){return db[_0xf737('0x5c')][_0xf737('0x5d')]({'where':{'id':_[_0xf737('0x33')](_0x24b390,_0xf737('0x5e')),'role':_0xf737('0x5f')},'attributes':['id',_0xf737('0x30'),_0xf737('0x60'),_0xf737('0x61'),_0xf737('0x62')]});}})[_0xf737('0x29')](function(_0x3614b2){if(_0x3614b2){return{'count':_0x3614b2[_0xf737('0x24')],'rows':_[_0xf737('0x33')](_0x3614b2[_0xf737('0x49')],function(_0x505f40){return{'membername':_0x505f40[_0xf737('0x30')],'UserId':_0x505f40['id'],'queue_name':_0x551aa1['name'],'OpenchannelQueueId':_0x551aa1['id'],'interface':util[_0xf737('0x63')](_0xf737('0x64'),_0xf737('0x65'),_0x505f40[_0xf737('0x30')]),'penalty':0x0,'paused':_0x505f40['openchannelPause'],'createdAt':_0x505f40[_0xf737('0x62')],'updatedAt':_0x505f40[_0xf737('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x483590,_0x5d5e5a))['catch'](handleError(_0x483590,null));};exports[_0xf737('0x66')]=function(_0x23c7bc,_0x415647,_0x30af54){var _0x1a8d29={};var _0x33d827={};var _0x5ba5c0;var _0x371243;return db[_0xf737('0x34')][_0xf737('0x57')]({'where':{'id':_0x23c7bc[_0xf737('0x4b')]['id']}})[_0xf737('0x29')](handleEntityNotFound(_0x415647,null))[_0xf737('0x29')](function(_0x15db12){if(_0x15db12){_0x5ba5c0=_0x15db12;_0x33d827['model']=_['keys'](db[_0xf737('0x67')]['rawAttributes']);_0x33d827[_0xf737('0x3b')]=_[_0xf737('0x39')](_0x23c7bc[_0xf737('0x3b')]);_0x33d827[_0xf737('0x3a')]=_[_0xf737('0x3d')](_0x33d827[_0xf737('0x38')],_0x33d827[_0xf737('0x3b')]);_0x1a8d29['attributes']=_[_0xf737('0x3d')](_0x33d827[_0xf737('0x38')],qs[_0xf737('0x3e')](_0x23c7bc[_0xf737('0x3b')][_0xf737('0x3e')]));_0x1a8d29[_0xf737('0x3c')]=_0x1a8d29['attributes'][_0xf737('0x3f')]?_0x1a8d29['attributes']:_0x33d827[_0xf737('0x38')];_0x1a8d29[_0xf737('0x68')]=qs[_0xf737('0x42')](_0x23c7bc[_0xf737('0x3b')][_0xf737('0x42')]);_0x1a8d29['where']=qs[_0xf737('0x3a')](_[_0xf737('0x59')](_0x23c7bc[_0xf737('0x3b')],_0x33d827[_0xf737('0x3a')]));if(_0x23c7bc[_0xf737('0x3b')][_0xf737('0x5b')]){_0x1a8d29['where']=_[_0xf737('0x45')](_0x1a8d29[_0xf737('0x43')],{'$or':_['map'](_0x1a8d29['attributes'],function(_0x40d245){var _0x54ff06={};_0x54ff06[_0x40d245]={'$like':'%'+_0x23c7bc[_0xf737('0x3b')][_0xf737('0x5b')]+'%'};return _0x54ff06;})});}_0x1a8d29=_[_0xf737('0x45')]({},_0x1a8d29,_0x23c7bc[_0xf737('0x46')]);return _0x5ba5c0[_0xf737('0x66')](_0x1a8d29);}})[_0xf737('0x29')](function(_0x5a80ed){if(_0x5a80ed){_0x371243=_0x5a80ed[_0xf737('0x3f')];if(!_0x23c7bc[_0xf737('0x3b')][_0xf737('0x40')](_0xf737('0x41'))){_0x1a8d29['limit']=qs[_0xf737('0x23')](_0x23c7bc[_0xf737('0x3b')][_0xf737('0x23')]);_0x1a8d29[_0xf737('0x21')]=qs[_0xf737('0x21')](_0x23c7bc[_0xf737('0x3b')][_0xf737('0x21')]);}return _0x5ba5c0[_0xf737('0x66')](_0x1a8d29);}})[_0xf737('0x29')](function(_0x1efc3e){if(_0x1efc3e){return _0x1efc3e?{'count':_0x371243,'rows':_0x1efc3e}:null;}})[_0xf737('0x29')](respondWithResult(_0x415647,null))['catch'](handleError(_0x415647,null));};exports['addTeams']=function(_0x20cbaa,_0x13a5b0,_0x5651b4){var _0x90a248=_0x20cbaa[_0xf737('0x4e')][_0xf737('0x69')];return db[_0xf737('0x67')]['findAll']({'where':{'id':_0x90a248},'attributes':['id'],'include':[{'model':db[_0xf737('0x5c')],'as':_0xf737('0x6a'),'attributes':['id','name',_0xf737('0x6b'),'voicePause',_0xf737('0x6c')],'raw':!![]}]})[_0xf737('0x29')](function(_0x5788ff){if(_0x5788ff){var _0x2f9a68=_[_0xf737('0x6d')](_0x5788ff,function(_0x1a67ec){var _0x4a38f0=_0x1a67ec[_0xf737('0x2b')]({'plain':!![]});return _0x4a38f0[_0xf737('0x6a')];});return db['OpenchannelQueue']['find']({'where':{'id':_0x20cbaa[_0xf737('0x4b')]['id']}})[_0xf737('0x29')](function(_0x362ec5){return db[_0xf737('0x6e')][_0xf737('0x6f')](function(_0x32cdc7){return _0x362ec5[_0xf737('0x70')](_0x90a248,{'transaction':_0x32cdc7})[_0xf737('0x29')](function(){return BPromise[_0xf737('0x71')](_0x2f9a68,function(_0x231dca){return db['UserOpenchannelQueue'][_0xf737('0x72')]({'where':{'UserId':_0x231dca['id'],'OpenchannelQueueId':_0x20cbaa[_0xf737('0x4b')]['id']},'transaction':_0x32cdc7});});})[_0xf737('0x29')](function(){_0x2f9a68[_0xf737('0x73')](function(_0x3c64c3){socket[_0xf737('0x74')](_0xf737('0x75'),{'UserId':_0x3c64c3['id'],'OpenchannelQueueId':_0x362ec5['id']});});});});});}})[_0xf737('0x29')](respondWithStatusCode(_0x13a5b0,null))[_0xf737('0x4a')](handleError(_0x13a5b0,null));};exports[_0xf737('0x76')]=function(_0x1a847b,_0x127320,_0x5c7988){return db[_0xf737('0x67')][_0xf737('0x77')]({'where':{'id':_0x1a847b['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xf737('0x5c')],'as':_0xf737('0x6a'),'attributes':['id'],'raw':!![]}]})[_0xf737('0x29')](handleEntityNotFound(_0x127320,null))[_0xf737('0x29')](function(_0x5cd2ca){var _0x20b7ec=_[_0xf737('0x33')](_0x5cd2ca,'id');var _0x5299d9=[];var _0x4c59db=[];var _0x25809c=squel[_0xf737('0x78')]();_0x25809c[_0xf737('0x79')](_0xf737('0x7a'))[_0xf737('0x7b')](_0xf737('0x7c'),'tq')[_0xf737('0x7d')](_0xf737('0x7e'),'ut',_0xf737('0x7f'))[_0xf737('0x43')](_0xf737('0x80'),_0x1a847b[_0xf737('0x4b')]['id']);for(var _0x3d7b55=0x0;_0x3d7b55<_0x5cd2ca[_0xf737('0x3f')];_0x3d7b55+=0x1){let _0x3e06ae=_0x5cd2ca[_0x3d7b55];for(var _0x5cb698=0x0;_0x5cb698<_0x3e06ae[_0xf737('0x6a')][_0xf737('0x3f')];_0x5cb698+=0x1){let _0x1e3216=_0x3e06ae[_0xf737('0x6a')][_0x5cb698];var _0x5f44ae=_0x25809c['clone']();_0x5f44ae[_0xf737('0x43')](_0xf737('0x81'),_0x1e3216['id']);_0x4c59db['push'](db[_0xf737('0x6e')][_0xf737('0x3b')](_0x5f44ae[_0xf737('0x82')](),{'type':db[_0xf737('0x6e')][_0xf737('0x83')][_0xf737('0x84')]})[_0xf737('0x29')](function(_0x559d80){if(_0x559d80[_0xf737('0x3f')]===0x1){return _0x1e3216['id'];}else{var _0x382f30=_[_0xf737('0x85')](_[_0xf737('0x33')](_0x559d80,_0xf737('0x86')),function(_0x18a941){return _['includes'](_0x20b7ec,_0x18a941);});if(_0x382f30){return _0x1e3216['id'];}}}));}}return BPromise['all'](_0x4c59db)[_0xf737('0x29')](function(_0x46da80){_0x5299d9=_(_0x5299d9)[_0xf737('0x87')](_0x46da80)[_0xf737('0x88')]()[_0xf737('0x89')]();return db['OpenchannelQueue'][_0xf737('0x4c')]({'where':{'id':_0x1a847b[_0xf737('0x4b')]['id']}})[_0xf737('0x29')](function(_0x9fa5fb){return db[_0xf737('0x6e')][_0xf737('0x6f')](function(_0x23354b){return _0x9fa5fb[_0xf737('0x76')](_0x1a847b[_0xf737('0x3b')][_0xf737('0x69')],{'transaction':_0x23354b})[_0xf737('0x29')](function(){if(!_[_0xf737('0x8a')](_0x5299d9)){return _0x9fa5fb['removeAgents'](_0x5299d9,{'transaction':_0x23354b});}})['then'](function(){_0x5299d9[_0xf737('0x73')](function(_0x3c995d){socket[_0xf737('0x74')](_0xf737('0x8b'),{'UserId':_0x3c995d,'OpenchannelQueueId':_0x9fa5fb['id']});});});});});});})[_0xf737('0x29')](respondWithStatusCode(_0x127320,null))[_0xf737('0x4a')](handleError(_0x127320,null));};exports[_0xf737('0x8c')]=function(_0x41ec83,_0x108af8,_0x5c4cfb){return db[_0xf737('0x34')][_0xf737('0x4c')]({'where':{'id':_0x41ec83[_0xf737('0x4b')]['id']}})[_0xf737('0x29')](handleEntityNotFound(_0x108af8,null))[_0xf737('0x29')](function(_0x3047c3){if(_0x3047c3){return _0x3047c3[_0xf737('0x8c')](_0x41ec83[_0xf737('0x4e')][_0xf737('0x69')],_[_0xf737('0x8d')](_0x41ec83[_0xf737('0x4e')],['ids','id'])||{})[_0xf737('0x8e')](function(_0x326c91){for(var _0x4e0004=0x0;_0x4e0004<_0x41ec83['body'][_0xf737('0x69')][_0xf737('0x3f')];_0x4e0004+=0x1){socket[_0xf737('0x74')](_0xf737('0x75'),{'UserId':Number(_0x41ec83[_0xf737('0x4e')][_0xf737('0x69')][_0x4e0004]),'OpenchannelQueueId':Number(_0x41ec83[_0xf737('0x4b')]['id'])});}return _0x326c91;});}})[_0xf737('0x29')](respondWithResult(_0x108af8,null))[_0xf737('0x4a')](handleError(_0x108af8,null));};exports[_0xf737('0x8f')]=function(_0x91467d,_0xf27eb0,_0x1014bb){return db[_0xf737('0x34')][_0xf737('0x4c')]({'where':{'id':_0x91467d[_0xf737('0x4b')]['id']}})['then'](handleEntityNotFound(_0xf27eb0,null))['then'](function(_0x29b13f){if(_0x29b13f){return _0x29b13f[_0xf737('0x8f')](_0x91467d['query']['ids'])[_0xf737('0x29')](function(){if(_['isArray'](_0x91467d[_0xf737('0x3b')][_0xf737('0x69')])){for(var _0x5506a9=0x0;_0x5506a9<_0x91467d[_0xf737('0x3b')][_0xf737('0x69')][_0xf737('0x3f')];_0x5506a9+=0x1){socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x91467d['query'][_0xf737('0x69')][_0x5506a9]),'OpenchannelQueueId':Number(_0x91467d[_0xf737('0x4b')]['id'])});}}else{socket[_0xf737('0x74')](_0xf737('0x8b'),{'UserId':Number(_0x91467d['query'][_0xf737('0x69')]),'OpenchannelQueueId':Number(_0x91467d[_0xf737('0x4b')]['id'])});}});}})[_0xf737('0x29')](respondWithStatusCode(_0xf27eb0,null))['catch'](handleError(_0xf27eb0,null));};exports[_0xf737('0x90')]=function(_0x39e78d,_0x3a9d84,_0x1d3985){var _0x17ec93={};var _0x82d2={};var _0x3d7e01;var _0x309b42;return db[_0xf737('0x34')][_0xf737('0x57')]({'where':{'id':_0x39e78d[_0xf737('0x4b')]['id']}})[_0xf737('0x29')](handleEntityNotFound(_0x3a9d84,null))[_0xf737('0x29')](function(_0xce1fd1){if(_0xce1fd1){_0x3d7e01=_0xce1fd1;_0x82d2[_0xf737('0x38')]=_[_0xf737('0x39')](db[_0xf737('0x5c')]['rawAttributes']);_0x82d2[_0xf737('0x3b')]=_[_0xf737('0x39')](_0x39e78d[_0xf737('0x3b')]);_0x82d2['filters']=_[_0xf737('0x3d')](_0x82d2['model'],_0x82d2['query']);_0x17ec93['attributes']=_['intersection'](_0x82d2['model'],qs[_0xf737('0x3e')](_0x39e78d['query'][_0xf737('0x3e')]));_0x17ec93[_0xf737('0x3c')]=_0x17ec93[_0xf737('0x3c')][_0xf737('0x3f')]?_0x17ec93[_0xf737('0x3c')]:_0x82d2[_0xf737('0x38')];_0x17ec93['order']=qs[_0xf737('0x42')](_0x39e78d[_0xf737('0x3b')][_0xf737('0x42')]);_0x17ec93[_0xf737('0x43')]=qs['filters'](_['pick'](_0x39e78d['query'],_0x82d2[_0xf737('0x3a')]));if(_0x39e78d[_0xf737('0x3b')]['filter']){_0x17ec93['where']=_[_0xf737('0x45')](_0x17ec93[_0xf737('0x43')],{'$or':_[_0xf737('0x33')](_0x17ec93['attributes'],function(_0xb9cb9f){var _0x1b9c42={};_0x1b9c42[_0xb9cb9f]={'$like':'%'+_0x39e78d[_0xf737('0x3b')]['filter']+'%'};return _0x1b9c42;})});}_0x17ec93=_['merge']({},_0x17ec93,_0x39e78d[_0xf737('0x46')]);return _0x3d7e01[_0xf737('0x90')](_0x17ec93);}})[_0xf737('0x29')](function(_0x85c597){if(_0x85c597){_0x309b42=_0x85c597['length'];if(!_0x39e78d[_0xf737('0x3b')]['hasOwnProperty'](_0xf737('0x41'))){_0x17ec93[_0xf737('0x23')]=qs[_0xf737('0x23')](_0x39e78d[_0xf737('0x3b')]['limit']);_0x17ec93[_0xf737('0x21')]=qs['offset'](_0x39e78d[_0xf737('0x3b')][_0xf737('0x21')]);}return _0x3d7e01[_0xf737('0x90')](_0x17ec93);}})[_0xf737('0x29')](function(_0x2b3f0e){if(_0x2b3f0e){return _0x2b3f0e?{'count':_0x309b42,'rows':_0x2b3f0e}:null;}})[_0xf737('0x29')](respondWithResult(_0x3a9d84,null))[_0xf737('0x4a')](handleError(_0x3a9d84,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index efd0f08..67b5f6a 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 _0x4b63=['update','remove','emit','hasOwnProperty','hook','exports','events','OpenchannelQueue','setMaxListeners'];(function(_0x34daed,_0x4c5e8a){var _0xaa7dee=function(_0x25ed7c){while(--_0x25ed7c){_0x34daed['push'](_0x34daed['shift']());}};_0xaa7dee(++_0x4c5e8a);}(_0x4b63,0x138));var _0x34b6=function(_0x1d7fca,_0x14576a){_0x1d7fca=_0x1d7fca-0x0;var _0x1a223f=_0x4b63[_0x1d7fca];return _0x1a223f;};'use strict';var EventEmitter=require(_0x34b6('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0x34b6('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x34b6('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x34b6('0x3'),'afterDestroy':_0x34b6('0x4')};function emitEvent(_0x2a2be4){return function(_0x2082cd,_0xf389f0,_0x46ec7a){OpenchannelQueueEvents[_0x34b6('0x5')](_0x2a2be4+':'+_0x2082cd['id'],_0x2082cd);OpenchannelQueueEvents['emit'](_0x2a2be4,_0x2082cd);_0x46ec7a(null);};}for(var e in events){if(events[_0x34b6('0x6')](e)){var event=events[e];OpenchannelQueue[_0x34b6('0x7')](e,emitEvent(event));}}module[_0x34b6('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xa8ca=['hook','exports','events','OpenchannelQueue','setMaxListeners','save','remove','emit'];(function(_0x1ba3a8,_0xc9b19f){var _0x3d17e6=function(_0x1b3cbc){while(--_0x1b3cbc){_0x1ba3a8['push'](_0x1ba3a8['shift']());}};_0x3d17e6(++_0xc9b19f);}(_0xa8ca,0x17a));var _0xaa8c=function(_0xedc108,_0x394f65){_0xedc108=_0xedc108-0x0;var _0x3b09eb=_0xa8ca[_0xedc108];return _0x3b09eb;};'use strict';var EventEmitter=require(_0xaa8c('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0xaa8c('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xaa8c('0x2')](0x0);var events={'afterCreate':_0xaa8c('0x3'),'afterUpdate':'update','afterDestroy':_0xaa8c('0x4')};function emitEvent(_0xbb5f4b){return function(_0x3e857a,_0x4c4e8c,_0x206914){OpenchannelQueueEvents[_0xaa8c('0x5')](_0xbb5f4b+':'+_0x3e857a['id'],_0x3e857a);OpenchannelQueueEvents['emit'](_0xbb5f4b,_0x3e857a);_0x206914(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0xaa8c('0x6')](e,emitEvent(event));}}module[_0xaa8c('0x7')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 120051b..3f113f3 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 _0xae5a=['bluebird','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','../../config/logger','api','moment'];(function(_0x240261,_0x4fe66c){var _0x45c332=function(_0x4f367a){while(--_0x4f367a){_0x240261['push'](_0x240261['shift']());}};_0x45c332(++_0x4fe66c);}(_0xae5a,0x10d));var _0xaae5=function(_0x1475e3,_0x144bd4){_0x1475e3=_0x1475e3-0x0;var _0x392a65=_0xae5a[_0x1475e3];return _0x392a65;};'use strict';var _=require(_0xaae5('0x0'));var util=require('util');var logger=require(_0xaae5('0x1'))(_0xaae5('0x2'));var moment=require(_0xaae5('0x3'));var BPromise=require(_0xaae5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaae5('0x5'));var rimraf=require(_0xaae5('0x6'));var config=require(_0xaae5('0x7'));var attributes=require(_0xaae5('0x8'));module[_0xaae5('0x9')]=function(_0x5bb8c0,_0x3718dd){return _0x5bb8c0[_0xaae5('0xa')](_0xaae5('0xb'),attributes,{'tableName':_0xaae5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf0a6=['../../config/logger','bluebird','path','exports','define','OpenchannelQueue','lodash'];(function(_0x52090d,_0x42b4a7){var _0x1878f0=function(_0x506bc4){while(--_0x506bc4){_0x52090d['push'](_0x52090d['shift']());}};_0x1878f0(++_0x42b4a7);}(_0xf0a6,0x1d4));var _0x6f0a=function(_0x3e15f4,_0x2d29a1){_0x3e15f4=_0x3e15f4-0x0;var _0x3bb93d=_0xf0a6[_0x3e15f4];return _0x3bb93d;};'use strict';var _=require(_0x6f0a('0x0'));var util=require('util');var logger=require(_0x6f0a('0x1'))('api');var moment=require('moment');var BPromise=require(_0x6f0a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f0a('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./openchannelQueue.attributes');module[_0x6f0a('0x4')]=function(_0x39ad6a,_0x112dd1){return _0x39ad6a[_0x6f0a('0x5')](_0x6f0a('0x6'),attributes,{'tableName':'openchannel_queues','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 079ae23..4b86889 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 _0x7478=['./openchannelQueue.socket','register','request','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','attributes','include','map','model','then','ShowOpenchannelQueue','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter'];(function(_0x585221,_0xb7e318){var _0x17111b=function(_0x5c9de0){while(--_0x5c9de0){_0x585221['push'](_0x585221['shift']());}};_0x17111b(++_0xb7e318);}(_0x7478,0x9b));var _0x8747=function(_0x59fa0d,_0x5a6e50){_0x59fa0d=_0x59fa0d-0x0;var _0x192681=_0x7478[_0x59fa0d];return _0x192681;};'use strict';var _=require(_0x8747('0x0'));var util=require(_0x8747('0x1'));var moment=require(_0x8747('0x2'));var BPromise=require(_0x8747('0x3'));var rs=require(_0x8747('0x4'));var fs=require('fs');var Redis=require(_0x8747('0x5'));var db=require(_0x8747('0x6'))['db'];var utils=require(_0x8747('0x7'));var logger=require(_0x8747('0x8'))(_0x8747('0x9'));var config=require(_0x8747('0xa'));var jayson=require(_0x8747('0xb'));var client=jayson[_0x8747('0xc')][_0x8747('0xd')]({'port':0x232a});config['redis']=_['defaults'](config[_0x8747('0xe')],{'host':_0x8747('0xf'),'port':0x18eb});var socket=require(_0x8747('0x10'))(new Redis(config['redis']));require(_0x8747('0x11'))[_0x8747('0x12')](socket);function respondWithRpcPromise(_0x5758a5,_0x476f1d,_0x4bbe38){return new BPromise(function(_0x51d7de,_0x278936){return client[_0x8747('0x13')](_0x5758a5,_0x4bbe38)['then'](function(_0x1ce41e){logger['info'](_0x8747('0x14'),_0x476f1d,_0x8747('0x15'));logger[_0x8747('0x16')](_0x8747('0x17'),_0x476f1d,'request\x20sent',JSON[_0x8747('0x18')](_0x1ce41e));if(_0x1ce41e['error']){if(_0x1ce41e[_0x8747('0x19')][_0x8747('0x1a')]===0x1f4){logger[_0x8747('0x19')](_0x8747('0x14'),_0x476f1d,_0x1ce41e[_0x8747('0x19')]['message']);return _0x278936(_0x1ce41e[_0x8747('0x19')][_0x8747('0x1b')]);}logger[_0x8747('0x19')](_0x8747('0x14'),_0x476f1d,_0x1ce41e[_0x8747('0x19')][_0x8747('0x1b')]);return _0x51d7de(_0x1ce41e[_0x8747('0x19')][_0x8747('0x1b')]);}else{logger[_0x8747('0x1c')]('OpenchannelQueue,\x20%s,\x20%s',_0x476f1d,_0x8747('0x15'));_0x51d7de(_0x1ce41e['result'][_0x8747('0x1b')]);}})[_0x8747('0x1d')](function(_0x17e737){logger[_0x8747('0x19')]('OpenchannelQueue,\x20%s,\x20%s',_0x476f1d,_0x17e737);_0x278936(_0x17e737);});});}exports[_0x8747('0x1e')]=function(_0x5bbc2b){var _0x297213=this;return new Promise(function(_0x1c7286,_0x215632){return db[_0x8747('0x1f')][_0x8747('0x20')]({'raw':_0x5bbc2b[_0x8747('0x21')]?_0x5bbc2b[_0x8747('0x21')][_0x8747('0x22')]===undefined?!![]:![]:!![],'where':_0x5bbc2b['options']?_0x5bbc2b[_0x8747('0x21')]['where']||null:null,'attributes':_0x5bbc2b['options']?_0x5bbc2b[_0x8747('0x21')][_0x8747('0x23')]||null:null,'limit':_0x5bbc2b[_0x8747('0x21')]?_0x5bbc2b[_0x8747('0x21')]['limit']||null:null,'include':_0x5bbc2b[_0x8747('0x21')]?_0x5bbc2b[_0x8747('0x21')][_0x8747('0x24')]?_[_0x8747('0x25')](_0x5bbc2b['options'][_0x8747('0x24')],function(_0x337194){return{'model':db[_0x337194[_0x8747('0x26')]],'as':_0x337194['as'],'attributes':_0x337194[_0x8747('0x23')],'include':_0x337194[_0x8747('0x24')]?_[_0x8747('0x25')](_0x337194[_0x8747('0x24')],function(_0x72382e){return{'model':db[_0x72382e[_0x8747('0x26')]],'as':_0x72382e['as'],'attributes':_0x72382e[_0x8747('0x23')],'include':_0x72382e['include']?_[_0x8747('0x25')](_0x72382e[_0x8747('0x24')],function(_0x122db9){return{'model':db[_0x122db9[_0x8747('0x26')]],'as':_0x122db9['as'],'attributes':_0x122db9[_0x8747('0x23')]};}):[]};}):[]};}):[]:[]})[_0x8747('0x27')](function(_0x5487c1){logger[_0x8747('0x1c')]('GetOpenchannelQueue',_0x5bbc2b);logger[_0x8747('0x16')]('GetOpenchannelQueue',_0x5bbc2b,JSON['stringify'](_0x5487c1));_0x1c7286(_0x5487c1);})['catch'](function(_0x4758ef){logger['error'](_0x8747('0x1e'),_0x4758ef[_0x8747('0x1b')],_0x5bbc2b);_0x215632(_0x297213[_0x8747('0x19')](0x1f4,_0x4758ef[_0x8747('0x1b')]));});});};exports[_0x8747('0x28')]=function(_0x45105d){var _0x137e4f=this;return new Promise(function(_0x236c5d,_0x513c07){return db['OpenchannelQueue'][_0x8747('0x29')]({'raw':_0x45105d[_0x8747('0x21')]?_0x45105d[_0x8747('0x21')][_0x8747('0x22')]===undefined?!![]:![]:!![],'where':_0x45105d['options']?_0x45105d[_0x8747('0x21')][_0x8747('0x2a')]||null:null,'attributes':_0x45105d[_0x8747('0x21')]?_0x45105d[_0x8747('0x21')][_0x8747('0x23')]||null:null,'include':_0x45105d[_0x8747('0x21')]?_0x45105d[_0x8747('0x21')][_0x8747('0x24')]?_[_0x8747('0x25')](_0x45105d[_0x8747('0x21')]['include'],function(_0x437f40){return{'model':db[_0x437f40[_0x8747('0x26')]],'as':_0x437f40['as'],'attributes':_0x437f40[_0x8747('0x23')],'include':_0x437f40[_0x8747('0x24')]?_[_0x8747('0x25')](_0x437f40['include'],function(_0x4aa1c4){return{'model':db[_0x4aa1c4[_0x8747('0x26')]],'as':_0x4aa1c4['as'],'attributes':_0x4aa1c4['attributes'],'include':_0x4aa1c4['include']?_['map'](_0x4aa1c4[_0x8747('0x24')],function(_0x52f711){return{'model':db[_0x52f711['model']],'as':_0x52f711['as'],'attributes':_0x52f711[_0x8747('0x23')]};}):[]};}):[]};}):[]:[]})[_0x8747('0x27')](function(_0x25bc34){logger['info'](_0x8747('0x28'),_0x45105d);logger[_0x8747('0x16')](_0x8747('0x28'),_0x45105d,JSON[_0x8747('0x18')](_0x25bc34));_0x236c5d(_0x25bc34);})[_0x8747('0x1d')](function(_0x107046){logger[_0x8747('0x19')](_0x8747('0x28'),_0x107046[_0x8747('0x1b')],_0x45105d);_0x513c07(_0x137e4f['error'](0x1f4,_0x107046[_0x8747('0x1b')]));});});}; \ No newline at end of file +var _0xee9d=['OpenchannelQueue','find','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','then','info','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetOpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowOpenchannelQueue'];(function(_0x116b68,_0x110ad3){var _0x1ed2ab=function(_0x2291da){while(--_0x2291da){_0x116b68['push'](_0x116b68['shift']());}};_0x1ed2ab(++_0x110ad3);}(_0xee9d,0x11a));var _0xdee9=function(_0x1068e1,_0x510176){_0x1068e1=_0x1068e1-0x0;var _0x4c741a=_0xee9d[_0x1068e1];return _0x4c741a;};'use strict';var _=require('lodash');var util=require(_0xdee9('0x0'));var moment=require(_0xdee9('0x1'));var BPromise=require('bluebird');var rs=require(_0xdee9('0x2'));var fs=require('fs');var Redis=require(_0xdee9('0x3'));var db=require(_0xdee9('0x4'))['db'];var utils=require(_0xdee9('0x5'));var logger=require(_0xdee9('0x6'))(_0xdee9('0x7'));var config=require(_0xdee9('0x8'));var jayson=require(_0xdee9('0x9'));var client=jayson[_0xdee9('0xa')][_0xdee9('0xb')]({'port':0x232a});config[_0xdee9('0xc')]=_[_0xdee9('0xd')](config[_0xdee9('0xc')],{'host':_0xdee9('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdee9('0xc')]));require('./openchannelQueue.socket')[_0xdee9('0xf')](socket);function respondWithRpcPromise(_0x31eec6,_0x23c350,_0x556094){return new BPromise(function(_0x46e99c,_0x432cce){return client['request'](_0x31eec6,_0x556094)[_0xdee9('0x10')](function(_0x29d933){logger[_0xdee9('0x11')](_0xdee9('0x12'),_0x23c350,'request\x20sent');logger[_0xdee9('0x13')](_0xdee9('0x14'),_0x23c350,_0xdee9('0x15'),JSON[_0xdee9('0x16')](_0x29d933));if(_0x29d933['error']){if(_0x29d933[_0xdee9('0x17')][_0xdee9('0x18')]===0x1f4){logger[_0xdee9('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x23c350,_0x29d933[_0xdee9('0x17')]['message']);return _0x432cce(_0x29d933[_0xdee9('0x17')][_0xdee9('0x19')]);}logger[_0xdee9('0x17')](_0xdee9('0x12'),_0x23c350,_0x29d933[_0xdee9('0x17')][_0xdee9('0x19')]);return _0x46e99c(_0x29d933[_0xdee9('0x17')][_0xdee9('0x19')]);}else{logger[_0xdee9('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x23c350,'request\x20sent');_0x46e99c(_0x29d933[_0xdee9('0x1a')][_0xdee9('0x19')]);}})['catch'](function(_0x40c96d){logger[_0xdee9('0x17')](_0xdee9('0x12'),_0x23c350,_0x40c96d);_0x432cce(_0x40c96d);});});}exports[_0xdee9('0x1b')]=function(_0xb5f9a5){var _0x53427d=this;return new Promise(function(_0x17e151,_0x3ed07e){return db['OpenchannelQueue'][_0xdee9('0x1c')]({'raw':_0xb5f9a5[_0xdee9('0x1d')]?_0xb5f9a5[_0xdee9('0x1d')][_0xdee9('0x1e')]===undefined?!![]:![]:!![],'where':_0xb5f9a5[_0xdee9('0x1d')]?_0xb5f9a5[_0xdee9('0x1d')][_0xdee9('0x1f')]||null:null,'attributes':_0xb5f9a5[_0xdee9('0x1d')]?_0xb5f9a5[_0xdee9('0x1d')][_0xdee9('0x20')]||null:null,'limit':_0xb5f9a5['options']?_0xb5f9a5['options'][_0xdee9('0x21')]||null:null,'include':_0xb5f9a5['options']?_0xb5f9a5[_0xdee9('0x1d')][_0xdee9('0x22')]?_[_0xdee9('0x23')](_0xb5f9a5[_0xdee9('0x1d')][_0xdee9('0x22')],function(_0x2c163d){return{'model':db[_0x2c163d[_0xdee9('0x24')]],'as':_0x2c163d['as'],'attributes':_0x2c163d[_0xdee9('0x20')],'include':_0x2c163d[_0xdee9('0x22')]?_[_0xdee9('0x23')](_0x2c163d[_0xdee9('0x22')],function(_0x9e06ca){return{'model':db[_0x9e06ca['model']],'as':_0x9e06ca['as'],'attributes':_0x9e06ca['attributes'],'include':_0x9e06ca[_0xdee9('0x22')]?_[_0xdee9('0x23')](_0x9e06ca[_0xdee9('0x22')],function(_0x4d0ec0){return{'model':db[_0x4d0ec0['model']],'as':_0x4d0ec0['as'],'attributes':_0x4d0ec0['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2c75f1){logger[_0xdee9('0x11')](_0xdee9('0x1b'),_0xb5f9a5);logger[_0xdee9('0x13')]('GetOpenchannelQueue',_0xb5f9a5,JSON[_0xdee9('0x16')](_0x2c75f1));_0x17e151(_0x2c75f1);})['catch'](function(_0xa942d3){logger['error'](_0xdee9('0x1b'),_0xa942d3[_0xdee9('0x19')],_0xb5f9a5);_0x3ed07e(_0x53427d[_0xdee9('0x17')](0x1f4,_0xa942d3[_0xdee9('0x19')]));});});};exports[_0xdee9('0x25')]=function(_0x1ec5b6){var _0x3f6fff=this;return new Promise(function(_0x4c42b9,_0x5935e6){return db[_0xdee9('0x26')][_0xdee9('0x27')]({'raw':_0x1ec5b6[_0xdee9('0x1d')]?_0x1ec5b6[_0xdee9('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x1ec5b6[_0xdee9('0x1d')]?_0x1ec5b6['options'][_0xdee9('0x1f')]||null:null,'attributes':_0x1ec5b6[_0xdee9('0x1d')]?_0x1ec5b6['options'][_0xdee9('0x20')]||null:null,'include':_0x1ec5b6['options']?_0x1ec5b6[_0xdee9('0x1d')][_0xdee9('0x22')]?_[_0xdee9('0x23')](_0x1ec5b6[_0xdee9('0x1d')][_0xdee9('0x22')],function(_0x302446){return{'model':db[_0x302446[_0xdee9('0x24')]],'as':_0x302446['as'],'attributes':_0x302446[_0xdee9('0x20')],'include':_0x302446[_0xdee9('0x22')]?_[_0xdee9('0x23')](_0x302446[_0xdee9('0x22')],function(_0x2c7948){return{'model':db[_0x2c7948[_0xdee9('0x24')]],'as':_0x2c7948['as'],'attributes':_0x2c7948[_0xdee9('0x20')],'include':_0x2c7948['include']?_['map'](_0x2c7948[_0xdee9('0x22')],function(_0xcf923){return{'model':db[_0xcf923[_0xdee9('0x24')]],'as':_0xcf923['as'],'attributes':_0xcf923[_0xdee9('0x20')]};}):[]};}):[]};}):[]:[]})[_0xdee9('0x10')](function(_0x483276){logger[_0xdee9('0x11')](_0xdee9('0x25'),_0x1ec5b6);logger['debug'](_0xdee9('0x25'),_0x1ec5b6,JSON[_0xdee9('0x16')](_0x483276));_0x4c42b9(_0x483276);})['catch'](function(_0x3e21f0){logger[_0xdee9('0x17')](_0xdee9('0x25'),_0x3e21f0['message'],_0x1ec5b6);_0x5935e6(_0x3f6fff['error'](0x1f4,_0x3e21f0[_0xdee9('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 3880d02..9831f37 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 _0xeaa9=['emit','register','length','./openchannelQueue.events','save','update'];(function(_0x343a81,_0x4a7abc){var _0xdc7d29=function(_0x354f11){while(--_0x354f11){_0x343a81['push'](_0x343a81['shift']());}};_0xdc7d29(++_0x4a7abc);}(_0xeaa9,0x8d));var _0x9eaa=function(_0x4cacbf,_0x2a0b9f){_0x4cacbf=_0x4cacbf-0x0;var _0x316afa=_0xeaa9[_0x4cacbf];return _0x316afa;};'use strict';var OpenchannelQueueEvents=require(_0x9eaa('0x0'));var events=[_0x9eaa('0x1'),'remove',_0x9eaa('0x2')];function createListener(_0x59f10c,_0xc1ec6a){return function(_0x18c045){_0xc1ec6a[_0x9eaa('0x3')](_0x59f10c,_0x18c045);};}function removeListener(_0x4827e5,_0x4f9003){return function(){OpenchannelQueueEvents['removeListener'](_0x4827e5,_0x4f9003);};}exports[_0x9eaa('0x4')]=function(_0xe1efbe){for(var _0x5476aa=0x0,_0x31fd29=events[_0x9eaa('0x5')];_0x5476aa<_0x31fd29;_0x5476aa++){var _0x3e7ce9=events[_0x5476aa];var _0x139e43=createListener('openchannelQueue:'+_0x3e7ce9,_0xe1efbe);OpenchannelQueueEvents['on'](_0x3e7ce9,_0x139e43);}}; \ No newline at end of file +var _0xe203=['./openchannelQueue.events','remove','update','emit','removeListener','register','length','openchannelQueue:'];(function(_0x5c96eb,_0x5404da){var _0x4ddbad=function(_0x5a1225){while(--_0x5a1225){_0x5c96eb['push'](_0x5c96eb['shift']());}};_0x4ddbad(++_0x5404da);}(_0xe203,0x1b8));var _0x3e20=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe203[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelQueueEvents=require(_0x3e20('0x0'));var events=['save',_0x3e20('0x1'),_0x3e20('0x2')];function createListener(_0x131864,_0x5a80af){return function(_0x5f0245){_0x5a80af[_0x3e20('0x3')](_0x131864,_0x5f0245);};}function removeListener(_0x50ecd1,_0x394ba2){return function(){OpenchannelQueueEvents[_0x3e20('0x4')](_0x50ecd1,_0x394ba2);};}exports[_0x3e20('0x5')]=function(_0x36d42e){for(var _0x27faee=0x0,_0x347f10=events[_0x3e20('0x6')];_0x27faee<_0x347f10;_0x27faee++){var _0x1c3a2e=events[_0x27faee];var _0x34718f=createListener(_0x3e20('0x7')+_0x1c3a2e,_0x36d42e);OpenchannelQueueEvents['on'](_0x1c3a2e,_0x34718f);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 33f043a..97ee494 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 _0x581d=['post','create','put','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/:id','show'];(function(_0x5788c0,_0x39634d){var _0x4980df=function(_0x400cf5){while(--_0x400cf5){_0x5788c0['push'](_0x5788c0['shift']());}};_0x4980df(++_0x39634d);}(_0x581d,0xa6));var _0xd581=function(_0x108b1e,_0x5e5c3c){_0x108b1e=_0x108b1e-0x0;var _0x565ba3=_0x581d[_0x108b1e];return _0x565ba3;};'use strict';var multer=require('multer');var util=require(_0xd581('0x0'));var path=require('path');var timeout=require(_0xd581('0x1'));var express=require(_0xd581('0x2'));var router=express[_0xd581('0x3')]();var fs_extra=require(_0xd581('0x4'));var auth=require(_0xd581('0x5'));var interaction=require(_0xd581('0x6'));var config=require(_0xd581('0x7'));var controller=require(_0xd581('0x8'));router[_0xd581('0x9')]('/',auth[_0xd581('0xa')](),controller[_0xd581('0xb')]);router[_0xd581('0x9')]('/describe',auth[_0xd581('0xa')](),controller['describe']);router[_0xd581('0x9')](_0xd581('0xc'),auth['isAuthenticated'](),controller[_0xd581('0xd')]);router[_0xd581('0xe')]('/',auth[_0xd581('0xa')](),controller[_0xd581('0xf')]);router[_0xd581('0x10')](_0xd581('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xd581('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xd581('0x11')]=router; \ No newline at end of file +var _0x4477=['../../components/interaction/service','./openchannelQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0x4477,0x7e));var _0x7447=function(_0x410e3d,_0x1f3c75){_0x410e3d=_0x410e3d-0x0;var _0x50826a=_0x4477[_0x410e3d];return _0x50826a;};'use strict';var multer=require(_0x7447('0x0'));var util=require('util');var path=require(_0x7447('0x1'));var timeout=require(_0x7447('0x2'));var express=require(_0x7447('0x3'));var router=express[_0x7447('0x4')]();var fs_extra=require(_0x7447('0x5'));var auth=require(_0x7447('0x6'));var interaction=require(_0x7447('0x7'));var config=require('../../config/environment');var controller=require(_0x7447('0x8'));router[_0x7447('0x9')]('/',auth[_0x7447('0xa')](),controller[_0x7447('0xb')]);router[_0x7447('0x9')]('/describe',auth[_0x7447('0xa')](),controller[_0x7447('0xc')]);router['get'](_0x7447('0xd'),auth[_0x7447('0xa')](),controller[_0x7447('0xe')]);router[_0x7447('0xf')]('/',auth[_0x7447('0xa')](),controller['create']);router['put']('/:id',auth[_0x7447('0xa')](),controller[_0x7447('0x10')]);router[_0x7447('0x11')](_0x7447('0xd'),auth[_0x7447('0xa')](),controller['destroy']);module[_0x7447('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 6822d37..f4a4bae 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 _0x1b73=['exports','STRING','DATE','moment'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x1b73,0x67));var _0x31b7=function(_0x5024aa,_0x31d8d9){_0x5024aa=_0x5024aa-0x0;var _0x5dec34=_0x1b73[_0x5024aa];return _0x5dec34;};'use strict';var moment=require(_0x31b7('0x0'));var Sequelize=require('sequelize');module[_0x31b7('0x1')]={'uniqueid':{'type':Sequelize[_0x31b7('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x31b7('0x2')]},'joinAt':{'type':Sequelize[_0x31b7('0x3')]},'leaveAt':{'type':Sequelize[_0x31b7('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x31b7('0x2')]}}; \ No newline at end of file +var _0x5381=['STRING','DATE','sequelize','exports'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x5381,0x1ea));var _0x1538=function(_0x1ebf9c,_0x4033ed){_0x1ebf9c=_0x1ebf9c-0x0;var _0x4a6ed6=_0x5381[_0x1ebf9c];return _0x4a6ed6;};'use strict';var moment=require('moment');var Sequelize=require(_0x1538('0x0'));module[_0x1538('0x1')]={'uniqueid':{'type':Sequelize[_0x1538('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x1538('0x2')]},'joinAt':{'type':Sequelize[_0x1538('0x3')]},'leaveAt':{'type':Sequelize[_0x1538('0x3')]},'acceptAt':{'type':Sequelize[_0x1538('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x1538('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index f55ea87..888b698 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 _0x3f8b=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','offset','count','set','Content-Range','reject','update','then','destroy','error','stack','name','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js'];(function(_0x4b850b,_0x3e69a5){var _0x2f24a3=function(_0x42d661){while(--_0x42d661){_0x4b850b['push'](_0x4b850b['shift']());}};_0x2f24a3(++_0x3e69a5);}(_0x3f8b,0x8c));var _0xb3f8=function(_0x320f33,_0x1db212){_0x320f33=_0x320f33-0x0;var _0x217d1e=_0x3f8b[_0x320f33];return _0x217d1e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb3f8('0x0'));var zipdir=require(_0xb3f8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb3f8('0x2'));var moment=require(_0xb3f8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb3f8('0x4'));var util=require(_0xb3f8('0x5'));var path=require(_0xb3f8('0x6'));var sox=require(_0xb3f8('0x7'));var csv=require(_0xb3f8('0x8'));var ejs=require(_0xb3f8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb3f8('0xa'));var squel=require('squel');var crypto=require(_0xb3f8('0xb'));var jsforce=require(_0xb3f8('0xc'));var deskjs=require(_0xb3f8('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb3f8('0xe'));var Papa=require(_0xb3f8('0xf'));var Redis=require(_0xb3f8('0x10'));var authService=require(_0xb3f8('0x11'));var qs=require(_0xb3f8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb3f8('0x13'));var logger=require(_0xb3f8('0x14'))(_0xb3f8('0x15'));var utils=require(_0xb3f8('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xb3f8('0x17'));var db=require(_0xb3f8('0x18'))['db'];function respondWithStatusCode(_0x566f3b,_0x448ba1){_0x448ba1=_0x448ba1||0xcc;return function(_0x550460){if(_0x550460){return _0x566f3b['sendStatus'](_0x448ba1);}return _0x566f3b['status'](_0x448ba1)[_0xb3f8('0x19')]();};}function respondWithResult(_0x307dbe,_0x2f6b19){_0x2f6b19=_0x2f6b19||0xc8;return function(_0x4b2f6b){if(_0x4b2f6b){return _0x307dbe[_0xb3f8('0x1a')](_0x2f6b19)[_0xb3f8('0x1b')](_0x4b2f6b);}};}function respondWithFilteredResult(_0x4af1cc,_0x26b989){return function(_0x488d00){if(_0x488d00){var _0x2014b3=typeof _0x26b989['offset']===_0xb3f8('0x1c')&&typeof _0x26b989[_0xb3f8('0x1d')]==='undefined';var _0x4ed9da=_0x488d00['count'];var _0x372c60=_0x2014b3?0x0:_0x26b989[_0xb3f8('0x1e')];var _0x1237cf=_0x2014b3?_0x488d00[_0xb3f8('0x1f')]:_0x26b989[_0xb3f8('0x1e')]+_0x26b989[_0xb3f8('0x1d')];var _0x1f5b80;if(_0x1237cf>=_0x4ed9da){_0x1237cf=_0x4ed9da;_0x1f5b80=0xc8;}else{_0x1f5b80=0xce;}_0x4af1cc[_0xb3f8('0x1a')](_0x1f5b80);return _0x4af1cc[_0xb3f8('0x20')](_0xb3f8('0x21'),_0x372c60+'-'+_0x1237cf+'/'+_0x4ed9da)[_0xb3f8('0x1b')](_0x488d00);}return null;};}function patchUpdates(_0x79e01b){return function(_0x355fe4){try{jsonpatch['apply'](_0x355fe4,_0x79e01b,!![]);}catch(_0x8f6082){return BPromise[_0xb3f8('0x22')](_0x8f6082);}return _0x355fe4['save']();};}function saveUpdates(_0x27d74d,_0x9745ba){return function(_0xdcf0d5){if(_0xdcf0d5){return _0xdcf0d5[_0xb3f8('0x23')](_0x27d74d)[_0xb3f8('0x24')](function(_0x4b2ac0){return _0x4b2ac0;});}return null;};}function removeEntity(_0x426748,_0x1401fe){return function(_0x449172){if(_0x449172){return _0x449172[_0xb3f8('0x25')]()[_0xb3f8('0x24')](function(){_0x426748['status'](0xcc)[_0xb3f8('0x19')]();});}};}function handleEntityNotFound(_0x29e2ed,_0x4d8a85){return function(_0x55a9db){if(!_0x55a9db){_0x29e2ed['sendStatus'](0x194);}return _0x55a9db;};}function handleError(_0x1c753d,_0x162804){_0x162804=_0x162804||0x1f4;return function(_0x1b1aea){logger[_0xb3f8('0x26')](_0x1b1aea[_0xb3f8('0x27')]);if(_0x1b1aea[_0xb3f8('0x28')]){delete _0x1b1aea[_0xb3f8('0x28')];}_0x1c753d[_0xb3f8('0x1a')](_0x162804)['send'](_0x1b1aea);};}exports[_0xb3f8('0x29')]=function(_0x29b1bd,_0x5af11d){var _0x33f825={},_0x1238e9={},_0x26045f={'count':0x0,'rows':[]};var _0x1cd3aa=_[_0xb3f8('0x2a')](db[_0xb3f8('0x2b')][_0xb3f8('0x2c')],function(_0x3fd408){return{'name':_0x3fd408[_0xb3f8('0x2d')],'type':_0x3fd408[_0xb3f8('0x2e')][_0xb3f8('0x2f')]};});_0x1238e9[_0xb3f8('0x30')]=_['map'](_0x1cd3aa,'name');_0x1238e9[_0xb3f8('0x31')]=_[_0xb3f8('0x32')](_0x29b1bd['query']);_0x1238e9[_0xb3f8('0x33')]=_[_0xb3f8('0x34')](_0x1238e9['model'],_0x1238e9[_0xb3f8('0x31')]);_0x33f825[_0xb3f8('0x35')]=_[_0xb3f8('0x34')](_0x1238e9[_0xb3f8('0x30')],qs[_0xb3f8('0x36')](_0x29b1bd['query'][_0xb3f8('0x36')]));_0x33f825[_0xb3f8('0x35')]=_0x33f825[_0xb3f8('0x35')][_0xb3f8('0x37')]?_0x33f825[_0xb3f8('0x35')]:_0x1238e9[_0xb3f8('0x30')];if(!_0x29b1bd[_0xb3f8('0x31')][_0xb3f8('0x38')](_0xb3f8('0x39'))){_0x33f825['limit']=qs[_0xb3f8('0x1d')](_0x29b1bd['query'][_0xb3f8('0x1d')]);_0x33f825['offset']=qs['offset'](_0x29b1bd[_0xb3f8('0x31')]['offset']);}_0x33f825[_0xb3f8('0x3a')]=qs[_0xb3f8('0x3b')](_0x29b1bd[_0xb3f8('0x31')]['sort']);_0x33f825['where']=qs['filters'](_[_0xb3f8('0x3c')](_0x29b1bd[_0xb3f8('0x31')],_0x1238e9[_0xb3f8('0x33')]),_0x1cd3aa);if(_0x29b1bd[_0xb3f8('0x31')][_0xb3f8('0x3d')]){_0x33f825[_0xb3f8('0x3e')]=_[_0xb3f8('0x3f')](_0x33f825[_0xb3f8('0x3e')],{'$or':_[_0xb3f8('0x2a')](_0x1cd3aa,function(_0x43f6f6){if(_0x43f6f6['type']!==_0xb3f8('0x40')){var _0x37924b={};_0x37924b[_0x43f6f6[_0xb3f8('0x28')]]={'$like':'%'+_0x29b1bd['query'][_0xb3f8('0x3d')]+'%'};return _0x37924b;}})});}_0x33f825=_[_0xb3f8('0x3f')]({},_0x33f825,_0x29b1bd[_0xb3f8('0x41')]);var _0x226ed={'where':_0x33f825[_0xb3f8('0x3e')]};return db[_0xb3f8('0x2b')]['count'](_0x226ed)[_0xb3f8('0x24')](function(_0x2a96d7){_0x26045f[_0xb3f8('0x1f')]=_0x2a96d7;if(_0x29b1bd[_0xb3f8('0x31')][_0xb3f8('0x42')]){_0x33f825[_0xb3f8('0x43')]=[{'all':!![]}];}return db[_0xb3f8('0x2b')][_0xb3f8('0x44')](_0x33f825);})[_0xb3f8('0x24')](function(_0x600854){_0x26045f[_0xb3f8('0x45')]=_0x600854;return _0x26045f;})[_0xb3f8('0x24')](respondWithFilteredResult(_0x5af11d,_0x33f825))[_0xb3f8('0x46')](handleError(_0x5af11d,null));};exports[_0xb3f8('0x47')]=function(_0x22b34a,_0x34b858){var _0x26f413={'raw':!![],'where':{'id':_0x22b34a[_0xb3f8('0x48')]['id']}},_0x4f7a79={};_0x4f7a79[_0xb3f8('0x30')]=_[_0xb3f8('0x32')](db['OpenchannelQueueReport']['rawAttributes']);_0x4f7a79['query']=_['keys'](_0x22b34a['query']);_0x4f7a79['filters']=_['intersection'](_0x4f7a79[_0xb3f8('0x30')],_0x4f7a79[_0xb3f8('0x31')]);_0x26f413[_0xb3f8('0x35')]=_['intersection'](_0x4f7a79[_0xb3f8('0x30')],qs[_0xb3f8('0x36')](_0x22b34a[_0xb3f8('0x31')][_0xb3f8('0x36')]));_0x26f413[_0xb3f8('0x35')]=_0x26f413[_0xb3f8('0x35')]['length']?_0x26f413[_0xb3f8('0x35')]:_0x4f7a79[_0xb3f8('0x30')];if(_0x22b34a[_0xb3f8('0x31')][_0xb3f8('0x42')]){_0x26f413['include']=[{'all':!![]}];}_0x26f413=_[_0xb3f8('0x3f')]({},_0x26f413,_0x22b34a['options']);return db[_0xb3f8('0x2b')]['find'](_0x26f413)[_0xb3f8('0x24')](handleEntityNotFound(_0x34b858,null))['then'](respondWithResult(_0x34b858,null))[_0xb3f8('0x46')](handleError(_0x34b858,null));};exports[_0xb3f8('0x49')]=function(_0x3308e2,_0x41db78){return db[_0xb3f8('0x2b')][_0xb3f8('0x49')](_0x3308e2[_0xb3f8('0x4a')],{})[_0xb3f8('0x24')](respondWithResult(_0x41db78,0xc9))[_0xb3f8('0x46')](handleError(_0x41db78,null));};exports[_0xb3f8('0x23')]=function(_0x3a9120,_0x343850){if(_0x3a9120[_0xb3f8('0x4a')]['id']){delete _0x3a9120['body']['id'];}return db['OpenchannelQueueReport'][_0xb3f8('0x4b')]({'where':{'id':_0x3a9120['params']['id']}})[_0xb3f8('0x24')](handleEntityNotFound(_0x343850,null))[_0xb3f8('0x24')](saveUpdates(_0x3a9120[_0xb3f8('0x4a')],null))[_0xb3f8('0x24')](respondWithResult(_0x343850,null))[_0xb3f8('0x46')](handleError(_0x343850,null));};exports[_0xb3f8('0x25')]=function(_0x25f58b,_0x5da6c3){return db[_0xb3f8('0x2b')][_0xb3f8('0x4b')]({'where':{'id':_0x25f58b[_0xb3f8('0x48')]['id']}})[_0xb3f8('0x24')](handleEntityNotFound(_0x5da6c3,null))['then'](removeEntity(_0x5da6c3,null))[_0xb3f8('0x46')](handleError(_0x5da6c3,null));};exports['describe']=function(_0x74cb06,_0x49a32d){return db['OpenchannelQueueReport'][_0xb3f8('0x4c')]()['then'](respondWithResult(_0x49a32d,null))['catch'](handleError(_0x49a32d,null));}; \ No newline at end of file +var _0xfb00=['destroy','error','stack','name','send','index','map','OpenchannelQueueReport','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','filter','VIRTUAL','merge','includeAll','include','catch','show','params','rawAttributes','options','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then'];(function(_0x334f9a,_0x542f01){var _0x2b219d=function(_0x25bb3e){while(--_0x25bb3e){_0x334f9a['push'](_0x334f9a['shift']());}};_0x2b219d(++_0x542f01);}(_0xfb00,0x158));var _0x0fb0=function(_0x307c66,_0x4beee3){_0x307c66=_0x307c66-0x0;var _0x1d9cc2=_0xfb00[_0x307c66];return _0x1d9cc2;};'use strict';var emlformat=require(_0x0fb0('0x0'));var rimraf=require(_0x0fb0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0fb0('0x2'));var rp=require(_0x0fb0('0x3'));var moment=require(_0x0fb0('0x4'));var BPromise=require(_0x0fb0('0x5'));var Mustache=require(_0x0fb0('0x6'));var util=require(_0x0fb0('0x7'));var path=require(_0x0fb0('0x8'));var sox=require(_0x0fb0('0x9'));var csv=require('to-csv');var ejs=require(_0x0fb0('0xa'));var fs=require('fs');var fs_extra=require(_0x0fb0('0xb'));var _=require(_0x0fb0('0xc'));var squel=require(_0x0fb0('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0fb0('0xe'));var toCsv=require(_0x0fb0('0xf'));var querystring=require(_0x0fb0('0x10'));var Papa=require(_0x0fb0('0x11'));var Redis=require(_0x0fb0('0x12'));var authService=require(_0x0fb0('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0fb0('0x14'));var hardwareService=require(_0x0fb0('0x15'));var logger=require(_0x0fb0('0x16'))('api');var utils=require(_0x0fb0('0x17'));var config=require(_0x0fb0('0x18'));var licenseUtil=require(_0x0fb0('0x19'));var db=require(_0x0fb0('0x1a'))['db'];function respondWithStatusCode(_0x21ff29,_0x122a31){_0x122a31=_0x122a31||0xcc;return function(_0x4ae066){if(_0x4ae066){return _0x21ff29[_0x0fb0('0x1b')](_0x122a31);}return _0x21ff29['status'](_0x122a31)[_0x0fb0('0x1c')]();};}function respondWithResult(_0x470f11,_0x5e35f8){_0x5e35f8=_0x5e35f8||0xc8;return function(_0x116466){if(_0x116466){return _0x470f11[_0x0fb0('0x1d')](_0x5e35f8)[_0x0fb0('0x1e')](_0x116466);}};}function respondWithFilteredResult(_0x2f3d2e,_0x3a6edc){return function(_0x272101){if(_0x272101){var _0x1f4348=typeof _0x3a6edc[_0x0fb0('0x1f')]===_0x0fb0('0x20')&&typeof _0x3a6edc[_0x0fb0('0x21')]===_0x0fb0('0x20');var _0x2e8adf=_0x272101[_0x0fb0('0x22')];var _0x16f555=_0x1f4348?0x0:_0x3a6edc['offset'];var _0x2915c5=_0x1f4348?_0x272101['count']:_0x3a6edc[_0x0fb0('0x1f')]+_0x3a6edc['limit'];var _0x5e38b1;if(_0x2915c5>=_0x2e8adf){_0x2915c5=_0x2e8adf;_0x5e38b1=0xc8;}else{_0x5e38b1=0xce;}_0x2f3d2e['status'](_0x5e38b1);return _0x2f3d2e[_0x0fb0('0x23')]('Content-Range',_0x16f555+'-'+_0x2915c5+'/'+_0x2e8adf)[_0x0fb0('0x1e')](_0x272101);}return null;};}function patchUpdates(_0x3f813b){return function(_0x5cfb48){try{jsonpatch[_0x0fb0('0x24')](_0x5cfb48,_0x3f813b,!![]);}catch(_0x54c365){return BPromise[_0x0fb0('0x25')](_0x54c365);}return _0x5cfb48[_0x0fb0('0x26')]();};}function saveUpdates(_0x16268e,_0x411b81){return function(_0x486009){if(_0x486009){return _0x486009[_0x0fb0('0x27')](_0x16268e)[_0x0fb0('0x28')](function(_0x3388aa){return _0x3388aa;});}return null;};}function removeEntity(_0x4f55af,_0x10fa6b){return function(_0x1c5782){if(_0x1c5782){return _0x1c5782[_0x0fb0('0x29')]()['then'](function(){_0x4f55af['status'](0xcc)[_0x0fb0('0x1c')]();});}};}function handleEntityNotFound(_0x4bc6ad,_0x5d0ac5){return function(_0x30e49b){if(!_0x30e49b){_0x4bc6ad[_0x0fb0('0x1b')](0x194);}return _0x30e49b;};}function handleError(_0x306e81,_0x117d55){_0x117d55=_0x117d55||0x1f4;return function(_0x3b6b65){logger[_0x0fb0('0x2a')](_0x3b6b65[_0x0fb0('0x2b')]);if(_0x3b6b65[_0x0fb0('0x2c')]){delete _0x3b6b65[_0x0fb0('0x2c')];}_0x306e81[_0x0fb0('0x1d')](_0x117d55)[_0x0fb0('0x2d')](_0x3b6b65);};}exports[_0x0fb0('0x2e')]=function(_0x46c1d7,_0x2e5c6c){var _0x370a20={},_0x500407={},_0x3d5474={'count':0x0,'rows':[]};var _0x3cb59f=_[_0x0fb0('0x2f')](db[_0x0fb0('0x30')]['rawAttributes'],function(_0xd8b2a1){return{'name':_0xd8b2a1[_0x0fb0('0x31')],'type':_0xd8b2a1[_0x0fb0('0x32')][_0x0fb0('0x33')]};});_0x500407[_0x0fb0('0x34')]=_[_0x0fb0('0x2f')](_0x3cb59f,_0x0fb0('0x2c'));_0x500407[_0x0fb0('0x35')]=_[_0x0fb0('0x36')](_0x46c1d7[_0x0fb0('0x35')]);_0x500407[_0x0fb0('0x37')]=_['intersection'](_0x500407[_0x0fb0('0x34')],_0x500407[_0x0fb0('0x35')]);_0x370a20[_0x0fb0('0x38')]=_[_0x0fb0('0x39')](_0x500407[_0x0fb0('0x34')],qs[_0x0fb0('0x3a')](_0x46c1d7[_0x0fb0('0x35')][_0x0fb0('0x3a')]));_0x370a20[_0x0fb0('0x38')]=_0x370a20['attributes'][_0x0fb0('0x3b')]?_0x370a20[_0x0fb0('0x38')]:_0x500407[_0x0fb0('0x34')];if(!_0x46c1d7[_0x0fb0('0x35')][_0x0fb0('0x3c')]('nolimit')){_0x370a20['limit']=qs[_0x0fb0('0x21')](_0x46c1d7['query'][_0x0fb0('0x21')]);_0x370a20[_0x0fb0('0x1f')]=qs[_0x0fb0('0x1f')](_0x46c1d7[_0x0fb0('0x35')][_0x0fb0('0x1f')]);}_0x370a20['order']=qs[_0x0fb0('0x3d')](_0x46c1d7[_0x0fb0('0x35')]['sort']);_0x370a20[_0x0fb0('0x3e')]=qs[_0x0fb0('0x37')](_['pick'](_0x46c1d7[_0x0fb0('0x35')],_0x500407['filters']),_0x3cb59f);if(_0x46c1d7[_0x0fb0('0x35')][_0x0fb0('0x3f')]){_0x370a20[_0x0fb0('0x3e')]=_['merge'](_0x370a20[_0x0fb0('0x3e')],{'$or':_[_0x0fb0('0x2f')](_0x3cb59f,function(_0x4a8083){if(_0x4a8083[_0x0fb0('0x32')]!==_0x0fb0('0x40')){var _0xe06aa7={};_0xe06aa7[_0x4a8083['name']]={'$like':'%'+_0x46c1d7[_0x0fb0('0x35')][_0x0fb0('0x3f')]+'%'};return _0xe06aa7;}})});}_0x370a20=_[_0x0fb0('0x41')]({},_0x370a20,_0x46c1d7['options']);var _0x2d39bb={'where':_0x370a20[_0x0fb0('0x3e')]};return db[_0x0fb0('0x30')][_0x0fb0('0x22')](_0x2d39bb)[_0x0fb0('0x28')](function(_0x3c997a){_0x3d5474[_0x0fb0('0x22')]=_0x3c997a;if(_0x46c1d7[_0x0fb0('0x35')][_0x0fb0('0x42')]){_0x370a20[_0x0fb0('0x43')]=[{'all':!![]}];}return db[_0x0fb0('0x30')]['findAll'](_0x370a20);})[_0x0fb0('0x28')](function(_0x4f430){_0x3d5474['rows']=_0x4f430;return _0x3d5474;})['then'](respondWithFilteredResult(_0x2e5c6c,_0x370a20))[_0x0fb0('0x44')](handleError(_0x2e5c6c,null));};exports[_0x0fb0('0x45')]=function(_0x504e48,_0x46ac6f){var _0x3ac0c2={'raw':!![],'where':{'id':_0x504e48[_0x0fb0('0x46')]['id']}},_0x51273d={};_0x51273d[_0x0fb0('0x34')]=_[_0x0fb0('0x36')](db[_0x0fb0('0x30')][_0x0fb0('0x47')]);_0x51273d[_0x0fb0('0x35')]=_[_0x0fb0('0x36')](_0x504e48[_0x0fb0('0x35')]);_0x51273d[_0x0fb0('0x37')]=_['intersection'](_0x51273d[_0x0fb0('0x34')],_0x51273d[_0x0fb0('0x35')]);_0x3ac0c2[_0x0fb0('0x38')]=_[_0x0fb0('0x39')](_0x51273d[_0x0fb0('0x34')],qs[_0x0fb0('0x3a')](_0x504e48[_0x0fb0('0x35')][_0x0fb0('0x3a')]));_0x3ac0c2[_0x0fb0('0x38')]=_0x3ac0c2[_0x0fb0('0x38')][_0x0fb0('0x3b')]?_0x3ac0c2[_0x0fb0('0x38')]:_0x51273d[_0x0fb0('0x34')];if(_0x504e48[_0x0fb0('0x35')][_0x0fb0('0x42')]){_0x3ac0c2['include']=[{'all':!![]}];}_0x3ac0c2=_[_0x0fb0('0x41')]({},_0x3ac0c2,_0x504e48[_0x0fb0('0x48')]);return db[_0x0fb0('0x30')][_0x0fb0('0x49')](_0x3ac0c2)[_0x0fb0('0x28')](handleEntityNotFound(_0x46ac6f,null))['then'](respondWithResult(_0x46ac6f,null))[_0x0fb0('0x44')](handleError(_0x46ac6f,null));};exports[_0x0fb0('0x4a')]=function(_0x2f44fa,_0x42a3d2){return db[_0x0fb0('0x30')]['create'](_0x2f44fa[_0x0fb0('0x4b')],{})['then'](respondWithResult(_0x42a3d2,0xc9))[_0x0fb0('0x44')](handleError(_0x42a3d2,null));};exports[_0x0fb0('0x27')]=function(_0x4e6afa,_0x36b149){if(_0x4e6afa[_0x0fb0('0x4b')]['id']){delete _0x4e6afa['body']['id'];}return db['OpenchannelQueueReport'][_0x0fb0('0x49')]({'where':{'id':_0x4e6afa[_0x0fb0('0x46')]['id']}})[_0x0fb0('0x28')](handleEntityNotFound(_0x36b149,null))[_0x0fb0('0x28')](saveUpdates(_0x4e6afa[_0x0fb0('0x4b')],null))[_0x0fb0('0x28')](respondWithResult(_0x36b149,null))[_0x0fb0('0x44')](handleError(_0x36b149,null));};exports[_0x0fb0('0x29')]=function(_0x48f533,_0x23030){return db['OpenchannelQueueReport'][_0x0fb0('0x49')]({'where':{'id':_0x48f533[_0x0fb0('0x46')]['id']}})[_0x0fb0('0x28')](handleEntityNotFound(_0x23030,null))[_0x0fb0('0x28')](removeEntity(_0x23030,null))['catch'](handleError(_0x23030,null));};exports[_0x0fb0('0x4c')]=function(_0x1c91b6,_0x1c8f90){return db['OpenchannelQueueReport'][_0x0fb0('0x4c')]()[_0x0fb0('0x28')](respondWithResult(_0x1c8f90,null))[_0x0fb0('0x44')](handleError(_0x1c8f90,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index cdcf2cd..1be608f 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 _0xe14b=['bluebird','path','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','moment'];(function(_0x46efd7,_0x43f84d){var _0x5637e4=function(_0x54e078){while(--_0x54e078){_0x46efd7['push'](_0x46efd7['shift']());}};_0x5637e4(++_0x43f84d);}(_0xe14b,0x93));var _0xbe14=function(_0x1a8eb6,_0x536860){_0x1a8eb6=_0x1a8eb6-0x0;var _0x32803c=_0xe14b[_0x1a8eb6];return _0x32803c;};'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 +var _0xc4aa=['bluebird','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','../../config/logger','api','moment'];(function(_0x1aea5c,_0x111b3f){var _0x5099ea=function(_0x3732d){while(--_0x3732d){_0x1aea5c['push'](_0x1aea5c['shift']());}};_0x5099ea(++_0x111b3f);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xc4aa[_0x1d1779];return _0x2377e9;};'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':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 9beba09..ea769b8 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 _0xd824=['message','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','then','debug','UpdateOpenchannelQueueReport','update','where','limit','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x46f7c4,_0x25a239){var _0x3f7a66=function(_0xc66568){while(--_0xc66568){_0x46f7c4['push'](_0x46f7c4['shift']());}};_0x3f7a66(++_0x25a239);}(_0xd824,0xc2));var _0x4d82=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xd824[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x4d82('0x0'));var util=require(_0x4d82('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4d82('0x2'));var fs=require('fs');var Redis=require(_0x4d82('0x3'));var db=require(_0x4d82('0x4'))['db'];var utils=require(_0x4d82('0x5'));var logger=require(_0x4d82('0x6'))(_0x4d82('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4d82('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b842f,_0x464caf,_0xb54db2){return new BPromise(function(_0x13d624,_0x5cccb6){return client[_0x4d82('0x9')](_0x4b842f,_0xb54db2)['then'](function(_0x5356cd){logger[_0x4d82('0xa')](_0x4d82('0xb'),_0x464caf,_0x4d82('0xc'));logger['debug'](_0x4d82('0xd'),_0x464caf,'request\x20sent',JSON[_0x4d82('0xe')](_0x5356cd));if(_0x5356cd[_0x4d82('0xf')]){if(_0x5356cd[_0x4d82('0xf')]['code']===0x1f4){logger['error'](_0x4d82('0xb'),_0x464caf,_0x5356cd[_0x4d82('0xf')][_0x4d82('0x10')]);return _0x5cccb6(_0x5356cd[_0x4d82('0xf')]['message']);}logger[_0x4d82('0xf')](_0x4d82('0xb'),_0x464caf,_0x5356cd[_0x4d82('0xf')]['message']);return _0x13d624(_0x5356cd[_0x4d82('0xf')]['message']);}else{logger[_0x4d82('0xa')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x464caf,_0x4d82('0xc'));_0x13d624(_0x5356cd['result'][_0x4d82('0x10')]);}})[_0x4d82('0x11')](function(_0x461476){logger[_0x4d82('0xf')](_0x4d82('0xb'),_0x464caf,_0x461476);_0x5cccb6(_0x461476);});});}exports[_0x4d82('0x12')]=function(_0x258c59){var _0x217b72=this;return new Promise(function(_0x2f2127,_0x5ef783){return db[_0x4d82('0x13')][_0x4d82('0x14')](_0x258c59[_0x4d82('0x15')],{'raw':_0x258c59[_0x4d82('0x16')]?_0x258c59[_0x4d82('0x16')][_0x4d82('0x17')]===undefined?!![]:![]:!![]})[_0x4d82('0x18')](function(_0x64669c){logger[_0x4d82('0xa')](_0x4d82('0x12'),_0x258c59);logger[_0x4d82('0x19')]('CreateOpenchannelQueueReport',_0x258c59,JSON[_0x4d82('0xe')](_0x64669c));_0x2f2127(_0x64669c);})[_0x4d82('0x11')](function(_0x5e5bdf){logger[_0x4d82('0xf')](_0x4d82('0x12'),_0x5e5bdf[_0x4d82('0x10')],_0x258c59);_0x5ef783(_0x217b72[_0x4d82('0xf')](0x1f4,_0x5e5bdf[_0x4d82('0x10')]));});});};exports[_0x4d82('0x1a')]=function(_0x11c043){var _0x462258=this;return new Promise(function(_0x12feab,_0x2df104){return db[_0x4d82('0x13')][_0x4d82('0x1b')](_0x11c043[_0x4d82('0x15')],{'raw':_0x11c043[_0x4d82('0x16')]?_0x11c043[_0x4d82('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11c043['options']?_0x11c043[_0x4d82('0x16')][_0x4d82('0x1c')]||null:null,'attributes':_0x11c043[_0x4d82('0x16')]?_0x11c043[_0x4d82('0x16')]['attributes']||null:null,'limit':_0x11c043[_0x4d82('0x16')]?_0x11c043[_0x4d82('0x16')][_0x4d82('0x1d')]||null:null})[_0x4d82('0x18')](function(_0x5ce98b){logger[_0x4d82('0xa')]('UpdateOpenchannelQueueReport',_0x11c043);logger['debug']('UpdateOpenchannelQueueReport',_0x11c043,JSON['stringify'](_0x5ce98b));_0x12feab(_0x5ce98b);})[_0x4d82('0x11')](function(_0x8cfbf1){logger[_0x4d82('0xf')]('UpdateOpenchannelQueueReport',_0x8cfbf1[_0x4d82('0x10')],_0x11c043);_0x2df104(_0x462258[_0x4d82('0xf')](0x1f4,_0x8cfbf1['message']));});});}; \ No newline at end of file +var _0x6cb4=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','info','request\x20sent','debug','stringify','error','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','OpenchannelQueueReport','create','body','options','raw','then','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','update','attributes','limit','lodash'];(function(_0x3adcf3,_0x3646df){var _0x20513a=function(_0xbac72d){while(--_0xbac72d){_0x3adcf3['push'](_0x3adcf3['shift']());}};_0x20513a(++_0x3646df);}(_0x6cb4,0xff));var _0x46cb=function(_0x46e6db,_0x5a39e2){_0x46e6db=_0x46e6db-0x0;var _0x258059=_0x6cb4[_0x46e6db];return _0x258059;};'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});function respondWithRpcPromise(_0x11262d,_0x148d0f,_0x31b35b){return new BPromise(function(_0x2d6c29,_0x24b4f5){return client[_0x46cb('0xb')](_0x11262d,_0x31b35b)['then'](function(_0x3d7663){logger[_0x46cb('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x148d0f,_0x46cb('0xd'));logger[_0x46cb('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x148d0f,_0x46cb('0xd'),JSON[_0x46cb('0xf')](_0x3d7663));if(_0x3d7663['error']){if(_0x3d7663['error']['code']===0x1f4){logger[_0x46cb('0x10')](_0x46cb('0x11'),_0x148d0f,_0x3d7663[_0x46cb('0x10')][_0x46cb('0x12')]);return _0x24b4f5(_0x3d7663['error'][_0x46cb('0x12')]);}logger[_0x46cb('0x10')](_0x46cb('0x11'),_0x148d0f,_0x3d7663[_0x46cb('0x10')][_0x46cb('0x12')]);return _0x2d6c29(_0x3d7663[_0x46cb('0x10')][_0x46cb('0x12')]);}else{logger[_0x46cb('0xc')](_0x46cb('0x11'),_0x148d0f,_0x46cb('0xd'));_0x2d6c29(_0x3d7663[_0x46cb('0x13')]['message']);}})[_0x46cb('0x14')](function(_0x5796d2){logger[_0x46cb('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x148d0f,_0x5796d2);_0x24b4f5(_0x5796d2);});});}exports['CreateOpenchannelQueueReport']=function(_0x4e3454){var _0x1b6646=this;return new Promise(function(_0x1f2891,_0x4df1f0){return db[_0x46cb('0x15')][_0x46cb('0x16')](_0x4e3454[_0x46cb('0x17')],{'raw':_0x4e3454[_0x46cb('0x18')]?_0x4e3454[_0x46cb('0x18')][_0x46cb('0x19')]===undefined?!![]:![]:!![]})[_0x46cb('0x1a')](function(_0x149483){logger[_0x46cb('0xc')](_0x46cb('0x1b'),_0x4e3454);logger[_0x46cb('0xe')](_0x46cb('0x1b'),_0x4e3454,JSON[_0x46cb('0xf')](_0x149483));_0x1f2891(_0x149483);})[_0x46cb('0x14')](function(_0x1fb467){logger[_0x46cb('0x10')](_0x46cb('0x1b'),_0x1fb467[_0x46cb('0x12')],_0x4e3454);_0x4df1f0(_0x1b6646[_0x46cb('0x10')](0x1f4,_0x1fb467[_0x46cb('0x12')]));});});};exports[_0x46cb('0x1c')]=function(_0x40e0e5){var _0x5a1338=this;return new Promise(function(_0x4d663e,_0x6588f3){return db[_0x46cb('0x15')][_0x46cb('0x1d')](_0x40e0e5[_0x46cb('0x17')],{'raw':_0x40e0e5[_0x46cb('0x18')]?_0x40e0e5['options'][_0x46cb('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40e0e5['options']?_0x40e0e5['options']['where']||null:null,'attributes':_0x40e0e5[_0x46cb('0x18')]?_0x40e0e5[_0x46cb('0x18')][_0x46cb('0x1e')]||null:null,'limit':_0x40e0e5[_0x46cb('0x18')]?_0x40e0e5[_0x46cb('0x18')][_0x46cb('0x1f')]||null:null})[_0x46cb('0x1a')](function(_0x8c65b2){logger[_0x46cb('0xc')](_0x46cb('0x1c'),_0x40e0e5);logger[_0x46cb('0xe')]('UpdateOpenchannelQueueReport',_0x40e0e5,JSON[_0x46cb('0xf')](_0x8c65b2));_0x4d663e(_0x8c65b2);})[_0x46cb('0x14')](function(_0x4c73bd){logger['error'](_0x46cb('0x1c'),_0x4c73bd['message'],_0x40e0e5);_0x6588f3(_0x5a1338[_0x46cb('0x10')](0x1f4,_0x4c73bd[_0x46cb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 666a262..0608a45 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 _0x16ca=['update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','post','create','put'];(function(_0x1bc12e,_0x4ba285){var _0x1e7332=function(_0x202c76){while(--_0x202c76){_0x1bc12e['push'](_0x1bc12e['shift']());}};_0x1e7332(++_0x4ba285);}(_0x16ca,0x193));var _0xa16c=function(_0x1d7827,_0x42b0db){_0x1d7827=_0x1d7827-0x0;var _0xb449f1=_0x16ca[_0x1d7827];return _0xb449f1;};'use strict';var multer=require(_0xa16c('0x0'));var util=require(_0xa16c('0x1'));var path=require('path');var timeout=require(_0xa16c('0x2'));var express=require(_0xa16c('0x3'));var router=express[_0xa16c('0x4')]();var fs_extra=require(_0xa16c('0x5'));var auth=require(_0xa16c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa16c('0x7'));var controller=require(_0xa16c('0x8'));router[_0xa16c('0x9')]('/',auth[_0xa16c('0xa')](),controller['index']);router[_0xa16c('0x9')](_0xa16c('0xb'),auth[_0xa16c('0xa')](),controller[_0xa16c('0xc')]);router[_0xa16c('0x9')](_0xa16c('0xd'),auth[_0xa16c('0xa')](),controller['show']);router[_0xa16c('0xe')]('/',auth['isAuthenticated'](),controller[_0xa16c('0xf')]);router[_0xa16c('0x10')]('/:id',auth[_0xa16c('0xa')](),controller[_0xa16c('0x11')]);router['delete'](_0xa16c('0xd'),auth['isAuthenticated'](),controller[_0xa16c('0x12')]);module[_0xa16c('0x13')]=router; \ No newline at end of file +var _0x3785=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelTransferReport.controller','isAuthenticated','index','get','/describe','describe','show','post','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x3785,0x6a));var _0x5378=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x3785[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x5378('0x0'));var util=require(_0x5378('0x1'));var path=require(_0x5378('0x2'));var timeout=require(_0x5378('0x3'));var express=require(_0x5378('0x4'));var router=express[_0x5378('0x5')]();var fs_extra=require(_0x5378('0x6'));var auth=require(_0x5378('0x7'));var interaction=require(_0x5378('0x8'));var config=require('../../config/environment');var controller=require(_0x5378('0x9'));router['get']('/',auth[_0x5378('0xa')](),controller[_0x5378('0xb')]);router[_0x5378('0xc')](_0x5378('0xd'),auth[_0x5378('0xa')](),controller[_0x5378('0xe')]);router[_0x5378('0xc')]('/:id',auth[_0x5378('0xa')](),controller[_0x5378('0xf')]);router[_0x5378('0x10')]('/',auth[_0x5378('0xa')](),controller['create']);router['put']('/:id',auth[_0x5378('0xa')](),controller[_0x5378('0x11')]);router[_0x5378('0x12')](_0x5378('0x13'),auth[_0x5378('0xa')](),controller[_0x5378('0x14')]);module[_0x5378('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 46a1de6..94b2309 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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x5dc9bb,_0x49557d){var _0x3611e8=function(_0x549eba){while(--_0x549eba){_0x5dc9bb['push'](_0x5dc9bb['shift']());}};_0x3611e8(++_0x49557d);}(_0xf4eb,0xec));var _0xbf4e=function(_0x1856f2,_0x13c29b){_0x1856f2=_0x1856f2-0x0;var _0xb878da=_0xf4eb[_0x1856f2];return _0xb878da;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x3c043d,_0x259cb1){var _0x14ccaa=function(_0x5e0f22){while(--_0x5e0f22){_0x3c043d['push'](_0x3c043d['shift']());}};_0x14ccaa(++_0x259cb1);}(_0xf4eb,0xec));var _0xbf4e=function(_0x397b07,_0xae18ab){_0x397b07=_0x397b07-0x0;var _0x508757=_0xf4eb[_0x397b07];return _0x508757;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 7664d89..cc6579e 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 _0x670e=['count','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','OpenchannelTransferReport','rawAttributes','type','map','query','keys','intersection','model','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','includeAll','options','create','body','params','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined'];(function(_0x4ae60b,_0x3d6ecf){var _0x38fbdd=function(_0x4227bb){while(--_0x4227bb){_0x4ae60b['push'](_0x4ae60b['shift']());}};_0x38fbdd(++_0x3d6ecf);}(_0x670e,0x118));var _0xe670=function(_0x5a71a1,_0x1fea73){_0x5a71a1=_0x5a71a1-0x0;var _0x3446d9=_0x670e[_0x5a71a1];return _0x3446d9;};'use strict';var emlformat=require(_0xe670('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe670('0x1'));var jsonpatch=require(_0xe670('0x2'));var rp=require(_0xe670('0x3'));var moment=require(_0xe670('0x4'));var BPromise=require(_0xe670('0x5'));var Mustache=require(_0xe670('0x6'));var util=require(_0xe670('0x7'));var path=require(_0xe670('0x8'));var sox=require(_0xe670('0x9'));var csv=require(_0xe670('0xa'));var ejs=require(_0xe670('0xb'));var fs=require('fs');var fs_extra=require(_0xe670('0xc'));var _=require(_0xe670('0xd'));var squel=require(_0xe670('0xe'));var crypto=require(_0xe670('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xe670('0x10'));var toCsv=require(_0xe670('0xa'));var querystring=require('querystring');var Papa=require(_0xe670('0x11'));var Redis=require('ioredis');var authService=require(_0xe670('0x12'));var qs=require(_0xe670('0x13'));var as=require(_0xe670('0x14'));var hardwareService=require(_0xe670('0x15'));var logger=require(_0xe670('0x16'))(_0xe670('0x17'));var utils=require(_0xe670('0x18'));var config=require(_0xe670('0x19'));var licenseUtil=require(_0xe670('0x1a'));var db=require(_0xe670('0x1b'))['db'];function respondWithStatusCode(_0xe4c6db,_0x286dbd){_0x286dbd=_0x286dbd||0xcc;return function(_0x546651){if(_0x546651){return _0xe4c6db[_0xe670('0x1c')](_0x286dbd);}return _0xe4c6db[_0xe670('0x1d')](_0x286dbd)['end']();};}function respondWithResult(_0xb230e0,_0x1e2549){_0x1e2549=_0x1e2549||0xc8;return function(_0x493bcc){if(_0x493bcc){return _0xb230e0['status'](_0x1e2549)['json'](_0x493bcc);}};}function respondWithFilteredResult(_0x28b47c,_0x256235){return function(_0x172239){if(_0x172239){var _0x3d3623=typeof _0x256235[_0xe670('0x1e')]===_0xe670('0x1f')&&typeof _0x256235['limit']===_0xe670('0x1f');var _0x280015=_0x172239[_0xe670('0x20')];var _0x1d55f6=_0x3d3623?0x0:_0x256235[_0xe670('0x1e')];var _0x16530d=_0x3d3623?_0x172239['count']:_0x256235[_0xe670('0x1e')]+_0x256235[_0xe670('0x21')];var _0x3993d3;if(_0x16530d>=_0x280015){_0x16530d=_0x280015;_0x3993d3=0xc8;}else{_0x3993d3=0xce;}_0x28b47c[_0xe670('0x1d')](_0x3993d3);return _0x28b47c[_0xe670('0x22')](_0xe670('0x23'),_0x1d55f6+'-'+_0x16530d+'/'+_0x280015)['json'](_0x172239);}return null;};}function patchUpdates(_0x36bf97){return function(_0x55e70b){try{jsonpatch[_0xe670('0x24')](_0x55e70b,_0x36bf97,!![]);}catch(_0x4efc3e){return BPromise[_0xe670('0x25')](_0x4efc3e);}return _0x55e70b[_0xe670('0x26')]();};}function saveUpdates(_0x11f594,_0x373203){return function(_0x35d89f){if(_0x35d89f){return _0x35d89f['update'](_0x11f594)[_0xe670('0x27')](function(_0x24b2b4){return _0x24b2b4;});}return null;};}function removeEntity(_0x29be4a,_0x43582e){return function(_0x35bbf6){if(_0x35bbf6){return _0x35bbf6[_0xe670('0x28')]()[_0xe670('0x27')](function(){_0x29be4a[_0xe670('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39e8dd,_0x8074e8){return function(_0x289468){if(!_0x289468){_0x39e8dd['sendStatus'](0x194);}return _0x289468;};}function handleError(_0x5e94b8,_0x43c556){_0x43c556=_0x43c556||0x1f4;return function(_0x448f3f){logger[_0xe670('0x29')](_0x448f3f[_0xe670('0x2a')]);if(_0x448f3f[_0xe670('0x2b')]){delete _0x448f3f[_0xe670('0x2b')];}_0x5e94b8['status'](_0x43c556)[_0xe670('0x2c')](_0x448f3f);};}exports[_0xe670('0x2d')]=function(_0x4365be,_0x117ec7){var _0x2c380a={},_0xebcfec={},_0x471f5b={'count':0x0,'rows':[]};var _0x5d2e24=_['map'](db[_0xe670('0x2e')][_0xe670('0x2f')],function(_0x5aebf7){return{'name':_0x5aebf7['fieldName'],'type':_0x5aebf7[_0xe670('0x30')]['key']};});_0xebcfec['model']=_[_0xe670('0x31')](_0x5d2e24,_0xe670('0x2b'));_0xebcfec[_0xe670('0x32')]=_[_0xe670('0x33')](_0x4365be[_0xe670('0x32')]);_0xebcfec['filters']=_[_0xe670('0x34')](_0xebcfec[_0xe670('0x35')],_0xebcfec[_0xe670('0x32')]);_0x2c380a['attributes']=_[_0xe670('0x34')](_0xebcfec['model'],qs[_0xe670('0x36')](_0x4365be['query'][_0xe670('0x36')]));_0x2c380a[_0xe670('0x37')]=_0x2c380a[_0xe670('0x37')][_0xe670('0x38')]?_0x2c380a['attributes']:_0xebcfec[_0xe670('0x35')];if(!_0x4365be[_0xe670('0x32')]['hasOwnProperty'](_0xe670('0x39'))){_0x2c380a[_0xe670('0x21')]=qs['limit'](_0x4365be[_0xe670('0x32')][_0xe670('0x21')]);_0x2c380a[_0xe670('0x1e')]=qs[_0xe670('0x1e')](_0x4365be['query'][_0xe670('0x1e')]);}_0x2c380a[_0xe670('0x3a')]=qs[_0xe670('0x3b')](_0x4365be['query'][_0xe670('0x3b')]);_0x2c380a[_0xe670('0x3c')]=qs[_0xe670('0x3d')](_[_0xe670('0x3e')](_0x4365be[_0xe670('0x32')],_0xebcfec[_0xe670('0x3d')]),_0x5d2e24);if(_0x4365be[_0xe670('0x32')][_0xe670('0x3f')]){_0x2c380a[_0xe670('0x3c')]=_[_0xe670('0x40')](_0x2c380a[_0xe670('0x3c')],{'$or':_[_0xe670('0x31')](_0x5d2e24,function(_0x4317fe){if(_0x4317fe[_0xe670('0x30')]!==_0xe670('0x41')){var _0x10640d={};_0x10640d[_0x4317fe['name']]={'$like':'%'+_0x4365be[_0xe670('0x32')][_0xe670('0x3f')]+'%'};return _0x10640d;}})});}_0x2c380a=_[_0xe670('0x40')]({},_0x2c380a,_0x4365be['options']);var _0x5d478f={'where':_0x2c380a['where']};return db['OpenchannelTransferReport'][_0xe670('0x20')](_0x5d478f)[_0xe670('0x27')](function(_0x82dba4){_0x471f5b[_0xe670('0x20')]=_0x82dba4;if(_0x4365be[_0xe670('0x32')]['includeAll']){_0x2c380a[_0xe670('0x42')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0xe670('0x43')](_0x2c380a);})['then'](function(_0x362ddf){_0x471f5b[_0xe670('0x44')]=_0x362ddf;return _0x471f5b;})[_0xe670('0x27')](respondWithFilteredResult(_0x117ec7,_0x2c380a))[_0xe670('0x45')](handleError(_0x117ec7,null));};exports[_0xe670('0x46')]=function(_0x4a61f6,_0xb2c6cc){var _0x306b49={'raw':!![],'where':{'id':_0x4a61f6['params']['id']}},_0x437f2d={};_0x437f2d[_0xe670('0x35')]=_[_0xe670('0x33')](db['OpenchannelTransferReport'][_0xe670('0x2f')]);_0x437f2d[_0xe670('0x32')]=_[_0xe670('0x33')](_0x4a61f6[_0xe670('0x32')]);_0x437f2d[_0xe670('0x3d')]=_[_0xe670('0x34')](_0x437f2d['model'],_0x437f2d[_0xe670('0x32')]);_0x306b49[_0xe670('0x37')]=_['intersection'](_0x437f2d[_0xe670('0x35')],qs[_0xe670('0x36')](_0x4a61f6['query']['fields']));_0x306b49['attributes']=_0x306b49[_0xe670('0x37')][_0xe670('0x38')]?_0x306b49[_0xe670('0x37')]:_0x437f2d[_0xe670('0x35')];if(_0x4a61f6['query'][_0xe670('0x47')]){_0x306b49[_0xe670('0x42')]=[{'all':!![]}];}_0x306b49=_['merge']({},_0x306b49,_0x4a61f6[_0xe670('0x48')]);return db[_0xe670('0x2e')]['find'](_0x306b49)[_0xe670('0x27')](handleEntityNotFound(_0xb2c6cc,null))[_0xe670('0x27')](respondWithResult(_0xb2c6cc,null))[_0xe670('0x45')](handleError(_0xb2c6cc,null));};exports[_0xe670('0x49')]=function(_0x5dbfb6,_0x5a0b88){return db[_0xe670('0x2e')][_0xe670('0x49')](_0x5dbfb6[_0xe670('0x4a')],{})[_0xe670('0x27')](respondWithResult(_0x5a0b88,0xc9))[_0xe670('0x45')](handleError(_0x5a0b88,null));};exports['update']=function(_0x4c6da1,_0x48142e){if(_0x4c6da1[_0xe670('0x4a')]['id']){delete _0x4c6da1[_0xe670('0x4a')]['id'];}return db[_0xe670('0x2e')]['find']({'where':{'id':_0x4c6da1[_0xe670('0x4b')]['id']}})[_0xe670('0x27')](handleEntityNotFound(_0x48142e,null))['then'](saveUpdates(_0x4c6da1['body'],null))[_0xe670('0x27')](respondWithResult(_0x48142e,null))[_0xe670('0x45')](handleError(_0x48142e,null));};exports[_0xe670('0x28')]=function(_0x3a535c,_0x2effec){return db[_0xe670('0x2e')][_0xe670('0x4c')]({'where':{'id':_0x3a535c['params']['id']}})[_0xe670('0x27')](handleEntityNotFound(_0x2effec,null))[_0xe670('0x27')](removeEntity(_0x2effec,null))[_0xe670('0x45')](handleError(_0x2effec,null));};exports['describe']=function(_0x1a21bf,_0x4e94a7){return db['OpenchannelTransferReport'][_0xe670('0x4d')]()[_0xe670('0x27')](respondWithResult(_0x4e94a7,null))[_0xe670('0x45')](handleError(_0x4e94a7,null));}; \ No newline at end of file +var _0x3710=['then','sendStatus','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','where','pick','merge','VIRTUAL','options','include','catch','show','find','create','body','params','destroy','describe','eml-format','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/license/hardware','api','../../config/utils','../../mysqldb','end','status','json','offset','undefined','limit','set','reject','save','update'];(function(_0x1b4ecb,_0x568d7a){var _0x48812f=function(_0x53d1e9){while(--_0x53d1e9){_0x1b4ecb['push'](_0x1b4ecb['shift']());}};_0x48812f(++_0x568d7a);}(_0x3710,0x17e));var _0x0371=function(_0x510e07,_0x30a6be){_0x510e07=_0x510e07-0x0;var _0x4ef0e7=_0x3710[_0x510e07];return _0x4ef0e7;};'use strict';var emlformat=require(_0x0371('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0371('0x1'));var rp=require(_0x0371('0x2'));var moment=require('moment');var BPromise=require(_0x0371('0x3'));var Mustache=require(_0x0371('0x4'));var util=require(_0x0371('0x5'));var path=require(_0x0371('0x6'));var sox=require(_0x0371('0x7'));var csv=require('to-csv');var ejs=require(_0x0371('0x8'));var fs=require('fs');var fs_extra=require(_0x0371('0x9'));var _=require(_0x0371('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0371('0xb'));var toCsv=require(_0x0371('0xc'));var querystring=require(_0x0371('0xd'));var Papa=require(_0x0371('0xe'));var Redis=require(_0x0371('0xf'));var authService=require(_0x0371('0x10'));var qs=require(_0x0371('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0371('0x12'));var logger=require('../../config/logger')(_0x0371('0x13'));var utils=require(_0x0371('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0371('0x15'))['db'];function respondWithStatusCode(_0x439cf8,_0x23a4c2){_0x23a4c2=_0x23a4c2||0xcc;return function(_0x2f3d11){if(_0x2f3d11){return _0x439cf8['sendStatus'](_0x23a4c2);}return _0x439cf8['status'](_0x23a4c2)[_0x0371('0x16')]();};}function respondWithResult(_0x11db23,_0x197e77){_0x197e77=_0x197e77||0xc8;return function(_0x384cb2){if(_0x384cb2){return _0x11db23[_0x0371('0x17')](_0x197e77)[_0x0371('0x18')](_0x384cb2);}};}function respondWithFilteredResult(_0x527b8f,_0x27a009){return function(_0x157fc1){if(_0x157fc1){var _0x2646b6=typeof _0x27a009[_0x0371('0x19')]===_0x0371('0x1a')&&typeof _0x27a009[_0x0371('0x1b')]==='undefined';var _0x27ad7f=_0x157fc1['count'];var _0x45881e=_0x2646b6?0x0:_0x27a009['offset'];var _0xa95f69=_0x2646b6?_0x157fc1['count']:_0x27a009[_0x0371('0x19')]+_0x27a009['limit'];var _0x4a9883;if(_0xa95f69>=_0x27ad7f){_0xa95f69=_0x27ad7f;_0x4a9883=0xc8;}else{_0x4a9883=0xce;}_0x527b8f[_0x0371('0x17')](_0x4a9883);return _0x527b8f[_0x0371('0x1c')]('Content-Range',_0x45881e+'-'+_0xa95f69+'/'+_0x27ad7f)[_0x0371('0x18')](_0x157fc1);}return null;};}function patchUpdates(_0x213939){return function(_0x3ec28b){try{jsonpatch['apply'](_0x3ec28b,_0x213939,!![]);}catch(_0x245204){return BPromise[_0x0371('0x1d')](_0x245204);}return _0x3ec28b[_0x0371('0x1e')]();};}function saveUpdates(_0x497cf2,_0x21bf4e){return function(_0xc41a7c){if(_0xc41a7c){return _0xc41a7c[_0x0371('0x1f')](_0x497cf2)[_0x0371('0x20')](function(_0x531c88){return _0x531c88;});}return null;};}function removeEntity(_0x472d27,_0x41b2a8){return function(_0x121486){if(_0x121486){return _0x121486['destroy']()[_0x0371('0x20')](function(){_0x472d27[_0x0371('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7ebe9d,_0x57e21b){return function(_0x5913e9){if(!_0x5913e9){_0x7ebe9d[_0x0371('0x21')](0x194);}return _0x5913e9;};}function handleError(_0x277369,_0x1cae63){_0x1cae63=_0x1cae63||0x1f4;return function(_0x335c3b){logger[_0x0371('0x22')](_0x335c3b[_0x0371('0x23')]);if(_0x335c3b['name']){delete _0x335c3b[_0x0371('0x24')];}_0x277369[_0x0371('0x17')](_0x1cae63)[_0x0371('0x25')](_0x335c3b);};}exports[_0x0371('0x26')]=function(_0x5388c6,_0x1ea87c){var _0x503804={},_0x1db35d={},_0x46c92f={'count':0x0,'rows':[]};var _0x1f96ef=_[_0x0371('0x27')](db[_0x0371('0x28')][_0x0371('0x29')],function(_0x56ee66){return{'name':_0x56ee66[_0x0371('0x2a')],'type':_0x56ee66[_0x0371('0x2b')][_0x0371('0x2c')]};});_0x1db35d[_0x0371('0x2d')]=_[_0x0371('0x27')](_0x1f96ef,'name');_0x1db35d[_0x0371('0x2e')]=_[_0x0371('0x2f')](_0x5388c6[_0x0371('0x2e')]);_0x1db35d[_0x0371('0x30')]=_[_0x0371('0x31')](_0x1db35d[_0x0371('0x2d')],_0x1db35d[_0x0371('0x2e')]);_0x503804[_0x0371('0x32')]=_[_0x0371('0x31')](_0x1db35d[_0x0371('0x2d')],qs[_0x0371('0x33')](_0x5388c6[_0x0371('0x2e')][_0x0371('0x33')]));_0x503804[_0x0371('0x32')]=_0x503804[_0x0371('0x32')][_0x0371('0x34')]?_0x503804[_0x0371('0x32')]:_0x1db35d[_0x0371('0x2d')];if(!_0x5388c6[_0x0371('0x2e')]['hasOwnProperty'](_0x0371('0x35'))){_0x503804['limit']=qs[_0x0371('0x1b')](_0x5388c6[_0x0371('0x2e')][_0x0371('0x1b')]);_0x503804[_0x0371('0x19')]=qs[_0x0371('0x19')](_0x5388c6[_0x0371('0x2e')][_0x0371('0x19')]);}_0x503804[_0x0371('0x36')]=qs['sort'](_0x5388c6['query']['sort']);_0x503804[_0x0371('0x37')]=qs[_0x0371('0x30')](_[_0x0371('0x38')](_0x5388c6[_0x0371('0x2e')],_0x1db35d[_0x0371('0x30')]),_0x1f96ef);if(_0x5388c6['query']['filter']){_0x503804[_0x0371('0x37')]=_[_0x0371('0x39')](_0x503804[_0x0371('0x37')],{'$or':_[_0x0371('0x27')](_0x1f96ef,function(_0x3f5379){if(_0x3f5379[_0x0371('0x2b')]!==_0x0371('0x3a')){var _0x234104={};_0x234104[_0x3f5379['name']]={'$like':'%'+_0x5388c6[_0x0371('0x2e')]['filter']+'%'};return _0x234104;}})});}_0x503804=_[_0x0371('0x39')]({},_0x503804,_0x5388c6[_0x0371('0x3b')]);var _0x41284f={'where':_0x503804[_0x0371('0x37')]};return db[_0x0371('0x28')]['count'](_0x41284f)[_0x0371('0x20')](function(_0x4a1690){_0x46c92f['count']=_0x4a1690;if(_0x5388c6['query']['includeAll']){_0x503804[_0x0371('0x3c')]=[{'all':!![]}];}return db[_0x0371('0x28')]['findAll'](_0x503804);})['then'](function(_0x39dbac){_0x46c92f['rows']=_0x39dbac;return _0x46c92f;})['then'](respondWithFilteredResult(_0x1ea87c,_0x503804))[_0x0371('0x3d')](handleError(_0x1ea87c,null));};exports[_0x0371('0x3e')]=function(_0xc4ff9f,_0xc1b4c4){var _0x2db034={'raw':!![],'where':{'id':_0xc4ff9f['params']['id']}},_0x3d0b42={};_0x3d0b42[_0x0371('0x2d')]=_['keys'](db[_0x0371('0x28')][_0x0371('0x29')]);_0x3d0b42[_0x0371('0x2e')]=_[_0x0371('0x2f')](_0xc4ff9f[_0x0371('0x2e')]);_0x3d0b42[_0x0371('0x30')]=_['intersection'](_0x3d0b42[_0x0371('0x2d')],_0x3d0b42[_0x0371('0x2e')]);_0x2db034[_0x0371('0x32')]=_['intersection'](_0x3d0b42[_0x0371('0x2d')],qs[_0x0371('0x33')](_0xc4ff9f[_0x0371('0x2e')][_0x0371('0x33')]));_0x2db034[_0x0371('0x32')]=_0x2db034[_0x0371('0x32')][_0x0371('0x34')]?_0x2db034[_0x0371('0x32')]:_0x3d0b42[_0x0371('0x2d')];if(_0xc4ff9f[_0x0371('0x2e')]['includeAll']){_0x2db034['include']=[{'all':!![]}];}_0x2db034=_[_0x0371('0x39')]({},_0x2db034,_0xc4ff9f[_0x0371('0x3b')]);return db[_0x0371('0x28')][_0x0371('0x3f')](_0x2db034)[_0x0371('0x20')](handleEntityNotFound(_0xc1b4c4,null))['then'](respondWithResult(_0xc1b4c4,null))['catch'](handleError(_0xc1b4c4,null));};exports[_0x0371('0x40')]=function(_0x2f6541,_0x49412b){return db[_0x0371('0x28')][_0x0371('0x40')](_0x2f6541[_0x0371('0x41')],{})['then'](respondWithResult(_0x49412b,0xc9))[_0x0371('0x3d')](handleError(_0x49412b,null));};exports[_0x0371('0x1f')]=function(_0x17dbea,_0x18be05){if(_0x17dbea[_0x0371('0x41')]['id']){delete _0x17dbea['body']['id'];}return db[_0x0371('0x28')][_0x0371('0x3f')]({'where':{'id':_0x17dbea[_0x0371('0x42')]['id']}})[_0x0371('0x20')](handleEntityNotFound(_0x18be05,null))[_0x0371('0x20')](saveUpdates(_0x17dbea[_0x0371('0x41')],null))[_0x0371('0x20')](respondWithResult(_0x18be05,null))[_0x0371('0x3d')](handleError(_0x18be05,null));};exports[_0x0371('0x43')]=function(_0x5afb0e,_0x5b304c){return db[_0x0371('0x28')][_0x0371('0x3f')]({'where':{'id':_0x5afb0e[_0x0371('0x42')]['id']}})[_0x0371('0x20')](handleEntityNotFound(_0x5b304c,null))['then'](removeEntity(_0x5b304c,null))[_0x0371('0x3d')](handleError(_0x5b304c,null));};exports[_0x0371('0x44')]=function(_0x10010d,_0x3b7872){return db[_0x0371('0x28')]['describe']()[_0x0371('0x20')](respondWithResult(_0x3b7872,null))[_0x0371('0x3d')](handleError(_0x3b7872,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 8029ca0..1a5f927 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 _0x5732=['report_openchannel_transfer','uniqueid','lodash','api','moment','path','OpenchannelTransferReport'];(function(_0x4324f2,_0x189b33){var _0x27c399=function(_0xc230f8){while(--_0xc230f8){_0x4324f2['push'](_0x4324f2['shift']());}};_0x27c399(++_0x189b33);}(_0x5732,0xf7));var _0x2573=function(_0x3c0091,_0x2eba89){_0x3c0091=_0x3c0091-0x0;var _0x4c0fe9=_0x5732[_0x3c0091];return _0x4c0fe9;};'use strict';var _=require(_0x2573('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2573('0x1'));var moment=require(_0x2573('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2573('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./openchannelTransferReport.attributes');module['exports']=function(_0x935816,_0x2e565b){return _0x935816['define'](_0x2573('0x4'),attributes,{'tableName':_0x2573('0x5'),'paranoid':![],'indexes':[{'name':_0x2573('0x6'),'fields':[_0x2573('0x6')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7051=['util','../../config/logger','api','moment','request-promise','path','rimraf','uniqueid','lodash'];(function(_0x172660,_0x260d9b){var _0x83204f=function(_0x4d6c80){while(--_0x4d6c80){_0x172660['push'](_0x172660['shift']());}};_0x83204f(++_0x260d9b);}(_0x7051,0x1c1));var _0x1705=function(_0x183b97,_0x2d297c){_0x183b97=_0x183b97-0x0;var _0x629cf7=_0x7051[_0x183b97];return _0x629cf7;};'use strict';var _=require(_0x1705('0x0'));var util=require(_0x1705('0x1'));var logger=require(_0x1705('0x2'))(_0x1705('0x3'));var moment=require(_0x1705('0x4'));var BPromise=require('bluebird');var rp=require(_0x1705('0x5'));var fs=require('fs');var path=require(_0x1705('0x6'));var rimraf=require(_0x1705('0x7'));var config=require('../../config/environment');var attributes=require('./openchannelTransferReport.attributes');module['exports']=function(_0x22d70e,_0x597acf){return _0x22d70e['define']('OpenchannelTransferReport',attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x1705('0x8'),'fields':[_0x1705('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 4148245..102dedf 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 _0xdb2a=['jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x4c7a6f,_0x200684){var _0x3d578f=function(_0x2f8664){while(--_0x2f8664){_0x4c7a6f['push'](_0x4c7a6f['shift']());}};_0x3d578f(++_0x200684);}(_0xdb2a,0x16f));var _0xadb2=function(_0xd7f843,_0x19a6e7){_0xd7f843=_0xd7f843-0x0;var _0x1744a7=_0xdb2a[_0xd7f843];return _0x1744a7;};'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')]('OpenchannelTransferReport,\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);});});} \ No newline at end of file +var _0xc818=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4a782b,_0x55584a){var _0x5cb5a0=function(_0x3010ed){while(--_0x3010ed){_0x4a782b['push'](_0x4a782b['shift']());}};_0x5cb5a0(++_0x55584a);}(_0xc818,0x1e3));var _0x8c81=function(_0x3397bb,_0x44e1e4){_0x3397bb=_0x3397bb-0x0;var _0x1982d5=_0xc818[_0x3397bb];return _0x1982d5;};'use strict';var _=require(_0x8c81('0x0'));var util=require(_0x8c81('0x1'));var moment=require(_0x8c81('0x2'));var BPromise=require(_0x8c81('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8c81('0x4'));var db=require(_0x8c81('0x5'))['db'];var utils=require(_0x8c81('0x6'));var logger=require(_0x8c81('0x7'))(_0x8c81('0x8'));var config=require(_0x8c81('0x9'));var jayson=require(_0x8c81('0xa'));var client=jayson['client'][_0x8c81('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3d663e,_0x32cf31,_0x43d142){return new BPromise(function(_0x501240,_0x1173cf){return client[_0x8c81('0xc')](_0x3d663e,_0x43d142)[_0x8c81('0xd')](function(_0x15ebff){logger[_0x8c81('0xe')](_0x8c81('0xf'),_0x32cf31,_0x8c81('0x10'));logger['debug'](_0x8c81('0x11'),_0x32cf31,_0x8c81('0x10'),JSON[_0x8c81('0x12')](_0x15ebff));if(_0x15ebff[_0x8c81('0x13')]){if(_0x15ebff['error'][_0x8c81('0x14')]===0x1f4){logger[_0x8c81('0x13')](_0x8c81('0xf'),_0x32cf31,_0x15ebff[_0x8c81('0x13')][_0x8c81('0x15')]);return _0x1173cf(_0x15ebff[_0x8c81('0x13')][_0x8c81('0x15')]);}logger[_0x8c81('0x13')](_0x8c81('0xf'),_0x32cf31,_0x15ebff['error']['message']);return _0x501240(_0x15ebff[_0x8c81('0x13')][_0x8c81('0x15')]);}else{logger[_0x8c81('0xe')](_0x8c81('0xf'),_0x32cf31,_0x8c81('0x10'));_0x501240(_0x15ebff[_0x8c81('0x16')]['message']);}})[_0x8c81('0x17')](function(_0x29ccb0){logger[_0x8c81('0x13')](_0x8c81('0xf'),_0x32cf31,_0x29ccb0);_0x1173cf(_0x29ccb0);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index e7fd58b..a74f636 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 _0xeb5f=['delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','post','put','/:id','update'];(function(_0x3d0113,_0x1c3a5f){var _0x40d13b=function(_0x26cf73){while(--_0x26cf73){_0x3d0113['push'](_0x3d0113['shift']());}};_0x40d13b(++_0x1c3a5f);}(_0xeb5f,0x146));var _0xfeb5=function(_0x3590ac,_0x1eedad){_0x3590ac=_0x3590ac-0x0;var _0x5eb1f3=_0xeb5f[_0x3590ac];return _0x5eb1f3;};'use strict';var multer=require(_0xfeb5('0x0'));var util=require(_0xfeb5('0x1'));var path=require('path');var timeout=require(_0xfeb5('0x2'));var express=require('express');var router=express[_0xfeb5('0x3')]();var fs_extra=require(_0xfeb5('0x4'));var auth=require(_0xfeb5('0x5'));var interaction=require(_0xfeb5('0x6'));var config=require(_0xfeb5('0x7'));var controller=require(_0xfeb5('0x8'));router[_0xfeb5('0x9')]('/',auth[_0xfeb5('0xa')](),controller[_0xfeb5('0xb')]);router[_0xfeb5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xfeb5('0xc')]('/',auth[_0xfeb5('0xa')](),controller['create']);router[_0xfeb5('0xd')](_0xfeb5('0xe'),auth[_0xfeb5('0xa')](),controller[_0xfeb5('0xf')]);router[_0xfeb5('0x10')]('/:id',auth[_0xfeb5('0xa')](),controller[_0xfeb5('0x11')]);module[_0xfeb5('0x12')]=router; \ No newline at end of file +var _0x7143=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./pause.controller','get','isAuthenticated','index','/:id','show','create','update','destroy','exports','multer','util','path'];(function(_0x1e393b,_0x355f6b){var _0x3d0bfe=function(_0x320830){while(--_0x320830){_0x1e393b['push'](_0x1e393b['shift']());}};_0x3d0bfe(++_0x355f6b);}(_0x7143,0x12f));var _0x3714=function(_0x2b6f6a,_0x13e70a){_0x2b6f6a=_0x2b6f6a-0x0;var _0x457a1d=_0x7143[_0x2b6f6a];return _0x457a1d;};'use strict';var multer=require(_0x3714('0x0'));var util=require(_0x3714('0x1'));var path=require(_0x3714('0x2'));var timeout=require(_0x3714('0x3'));var express=require(_0x3714('0x4'));var router=express[_0x3714('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3714('0x6'));var interaction=require(_0x3714('0x7'));var config=require('../../config/environment');var controller=require(_0x3714('0x8'));router[_0x3714('0x9')]('/',auth[_0x3714('0xa')](),controller[_0x3714('0xb')]);router[_0x3714('0x9')](_0x3714('0xc'),auth[_0x3714('0xa')](),controller[_0x3714('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3714('0xe')]);router['put'](_0x3714('0xc'),auth['isAuthenticated'](),controller[_0x3714('0xf')]);router['delete']('/:id',auth[_0x3714('0xa')](),controller[_0x3714('0x10')]);module[_0x3714('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 b8aae1a..ff0666d 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 _0x8cf2=['sequelize','exports','STRING','name'];(function(_0x4f18b1,_0x32e015){var _0xe9cec2=function(_0x22888a){while(--_0x22888a){_0x4f18b1['push'](_0x4f18b1['shift']());}};_0xe9cec2(++_0x32e015);}(_0x8cf2,0x128));var _0x28cf=function(_0x28d6ed,_0x549656){_0x28d6ed=_0x28d6ed-0x0;var _0x5cdeb1=_0x8cf2[_0x28d6ed];return _0x5cdeb1;};'use strict';var Sequelize=require(_0x28cf('0x0'));module[_0x28cf('0x1')]={'name':{'type':Sequelize[_0x28cf('0x2')],'unique':_0x28cf('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x28cf('0x2')]}}; \ No newline at end of file +var _0xcd5b=['sequelize','exports','STRING','name'];(function(_0x20bdee,_0x444dda){var _0x300fd5=function(_0x3afe82){while(--_0x3afe82){_0x20bdee['push'](_0x20bdee['shift']());}};_0x300fd5(++_0x444dda);}(_0xcd5b,0xcc));var _0xbcd5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcd5b[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xbcd5('0x0'));module[_0xbcd5('0x1')]={'name':{'type':Sequelize[_0xbcd5('0x2')],'unique':_0xbcd5('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xbcd5('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index c4669b1..320b25d 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 _0x7f4e=['rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','end','offset','count','limit','status','set','Content-Range','json','apply','reject','then','destroy','get','Pauses','UserProfileResource','sendStatus','error','name','send','map','Pause','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','type','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format'];(function(_0x1c510a,_0x1413a9){var _0x23cedd=function(_0x3f3e43){while(--_0x3f3e43){_0x1c510a['push'](_0x1c510a['shift']());}};_0x23cedd(++_0x1413a9);}(_0x7f4e,0x1d9));var _0xe7f4=function(_0x2e0bd2,_0x1f69b7){_0x2e0bd2=_0x2e0bd2-0x0;var _0x16c533=_0x7f4e[_0x2e0bd2];return _0x16c533;};'use strict';var emlformat=require(_0xe7f4('0x0'));var rimraf=require(_0xe7f4('0x1'));var zipdir=require(_0xe7f4('0x2'));var jsonpatch=require(_0xe7f4('0x3'));var rp=require(_0xe7f4('0x4'));var moment=require(_0xe7f4('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe7f4('0x6'));var path=require(_0xe7f4('0x7'));var sox=require(_0xe7f4('0x8'));var csv=require(_0xe7f4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe7f4('0xa'));var _=require(_0xe7f4('0xb'));var squel=require(_0xe7f4('0xc'));var crypto=require(_0xe7f4('0xd'));var jsforce=require(_0xe7f4('0xe'));var deskjs=require(_0xe7f4('0xf'));var toCsv=require(_0xe7f4('0x9'));var querystring=require(_0xe7f4('0x10'));var Papa=require(_0xe7f4('0x11'));var Redis=require(_0xe7f4('0x12'));var authService=require(_0xe7f4('0x13'));var qs=require(_0xe7f4('0x14'));var as=require(_0xe7f4('0x15'));var hardwareService=require(_0xe7f4('0x16'));var logger=require('../../config/logger')(_0xe7f4('0x17'));var utils=require(_0xe7f4('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xe7f4('0x19'));var db=require(_0xe7f4('0x1a'))['db'];function respondWithStatusCode(_0x4015d4,_0x39b62d){_0x39b62d=_0x39b62d||0xcc;return function(_0x54b7ab){if(_0x54b7ab){return _0x4015d4['sendStatus'](_0x39b62d);}return _0x4015d4['status'](_0x39b62d)[_0xe7f4('0x1b')]();};}function respondWithResult(_0x345b55,_0x4cc594){_0x4cc594=_0x4cc594||0xc8;return function(_0x42990b){if(_0x42990b){return _0x345b55['status'](_0x4cc594)['json'](_0x42990b);}};}function respondWithFilteredResult(_0x2b7e3d,_0x1b2408){return function(_0x5d1699){if(_0x5d1699){var _0x2decf9=typeof _0x1b2408[_0xe7f4('0x1c')]==='undefined'&&typeof _0x1b2408['limit']==='undefined';var _0x5bb079=_0x5d1699[_0xe7f4('0x1d')];var _0x29d0cd=_0x2decf9?0x0:_0x1b2408[_0xe7f4('0x1c')];var _0x1cd5ae=_0x2decf9?_0x5d1699[_0xe7f4('0x1d')]:_0x1b2408['offset']+_0x1b2408[_0xe7f4('0x1e')];var _0x3b4497;if(_0x1cd5ae>=_0x5bb079){_0x1cd5ae=_0x5bb079;_0x3b4497=0xc8;}else{_0x3b4497=0xce;}_0x2b7e3d[_0xe7f4('0x1f')](_0x3b4497);return _0x2b7e3d[_0xe7f4('0x20')](_0xe7f4('0x21'),_0x29d0cd+'-'+_0x1cd5ae+'/'+_0x5bb079)[_0xe7f4('0x22')](_0x5d1699);}return null;};}function patchUpdates(_0x32da32){return function(_0x169a33){try{jsonpatch[_0xe7f4('0x23')](_0x169a33,_0x32da32,!![]);}catch(_0x34c936){return BPromise[_0xe7f4('0x24')](_0x34c936);}return _0x169a33['save']();};}function saveUpdates(_0x10094c,_0x354b59){return function(_0x750826){if(_0x750826){return _0x750826['update'](_0x10094c)[_0xe7f4('0x25')](function(_0x428992){return _0x428992;});}return null;};}function removeEntity(_0x48fe49,_0x26bd61){return function(_0x28bf39){if(_0x28bf39){return _0x28bf39[_0xe7f4('0x26')]()[_0xe7f4('0x25')](function(){var _0x33d2dd=_0x28bf39[_0xe7f4('0x27')]({'plain':!![]});var _0x42b04e=_0xe7f4('0x28');return db[_0xe7f4('0x29')][_0xe7f4('0x26')]({'where':{'type':_0x42b04e,'resourceId':_0x33d2dd['id']}})[_0xe7f4('0x25')](function(){return _0x28bf39;});})[_0xe7f4('0x25')](function(){_0x48fe49[_0xe7f4('0x1f')](0xcc)[_0xe7f4('0x1b')]();});}};}function handleEntityNotFound(_0x1e4ed8,_0x38819b){return function(_0x42758f){if(!_0x42758f){_0x1e4ed8[_0xe7f4('0x2a')](0x194);}return _0x42758f;};}function handleError(_0x49dfd7,_0x332ae3){_0x332ae3=_0x332ae3||0x1f4;return function(_0x1295e2){logger[_0xe7f4('0x2b')](_0x1295e2['stack']);if(_0x1295e2[_0xe7f4('0x2c')]){delete _0x1295e2[_0xe7f4('0x2c')];}_0x49dfd7[_0xe7f4('0x1f')](_0x332ae3)[_0xe7f4('0x2d')](_0x1295e2);};}exports['index']=function(_0x44c800,_0x3ca247){var _0x4a908e={},_0x2b83fb={},_0x179aaa={'count':0x0,'rows':[]};var _0x54f5ce=_[_0xe7f4('0x2e')](db[_0xe7f4('0x2f')][_0xe7f4('0x30')],function(_0x4463dd){return{'name':_0x4463dd[_0xe7f4('0x31')],'type':_0x4463dd['type']['key']};});_0x2b83fb[_0xe7f4('0x32')]=_['map'](_0x54f5ce,_0xe7f4('0x2c'));_0x2b83fb[_0xe7f4('0x33')]=_[_0xe7f4('0x34')](_0x44c800[_0xe7f4('0x33')]);_0x2b83fb[_0xe7f4('0x35')]=_[_0xe7f4('0x36')](_0x2b83fb[_0xe7f4('0x32')],_0x2b83fb[_0xe7f4('0x33')]);_0x4a908e[_0xe7f4('0x37')]=_[_0xe7f4('0x36')](_0x2b83fb[_0xe7f4('0x32')],qs[_0xe7f4('0x38')](_0x44c800['query'][_0xe7f4('0x38')]));_0x4a908e[_0xe7f4('0x37')]=_0x4a908e[_0xe7f4('0x37')][_0xe7f4('0x39')]?_0x4a908e[_0xe7f4('0x37')]:_0x2b83fb[_0xe7f4('0x32')];if(!_0x44c800[_0xe7f4('0x33')][_0xe7f4('0x3a')](_0xe7f4('0x3b'))){_0x4a908e['limit']=qs[_0xe7f4('0x1e')](_0x44c800[_0xe7f4('0x33')][_0xe7f4('0x1e')]);_0x4a908e['offset']=qs[_0xe7f4('0x1c')](_0x44c800['query'][_0xe7f4('0x1c')]);}_0x4a908e['order']=qs[_0xe7f4('0x3c')](_0x44c800[_0xe7f4('0x33')][_0xe7f4('0x3c')]);_0x4a908e[_0xe7f4('0x3d')]=qs['filters'](_['pick'](_0x44c800[_0xe7f4('0x33')],_0x2b83fb[_0xe7f4('0x35')]),_0x54f5ce);if(_0x44c800[_0xe7f4('0x33')][_0xe7f4('0x3e')]){_0x4a908e['where']=_['merge'](_0x4a908e[_0xe7f4('0x3d')],{'$or':_[_0xe7f4('0x2e')](_0x54f5ce,function(_0x358364){if(_0x358364[_0xe7f4('0x3f')]!=='VIRTUAL'){var _0x4ed1fa={};_0x4ed1fa[_0x358364[_0xe7f4('0x2c')]]={'$like':'%'+_0x44c800['query'][_0xe7f4('0x3e')]+'%'};return _0x4ed1fa;}})});}_0x4a908e=_[_0xe7f4('0x40')]({},_0x4a908e,_0x44c800[_0xe7f4('0x41')]);var _0xba8618={'where':_0x4a908e[_0xe7f4('0x3d')]};return db[_0xe7f4('0x2f')][_0xe7f4('0x1d')](_0xba8618)[_0xe7f4('0x25')](function(_0x3cdb6b){_0x179aaa[_0xe7f4('0x1d')]=_0x3cdb6b;if(_0x44c800['query'][_0xe7f4('0x42')]){_0x4a908e[_0xe7f4('0x43')]=[{'all':!![]}];}return db[_0xe7f4('0x2f')][_0xe7f4('0x44')](_0x4a908e);})[_0xe7f4('0x25')](function(_0x430536){_0x179aaa['rows']=_0x430536;return _0x179aaa;})['then'](respondWithFilteredResult(_0x3ca247,_0x4a908e))[_0xe7f4('0x45')](handleError(_0x3ca247,null));};exports[_0xe7f4('0x46')]=function(_0x42c070,_0x15948b){var _0xd07579={'raw':!![],'where':{'id':_0x42c070[_0xe7f4('0x47')]['id']}},_0x8acba7={};_0x8acba7[_0xe7f4('0x32')]=_[_0xe7f4('0x34')](db[_0xe7f4('0x2f')][_0xe7f4('0x30')]);_0x8acba7[_0xe7f4('0x33')]=_[_0xe7f4('0x34')](_0x42c070['query']);_0x8acba7[_0xe7f4('0x35')]=_['intersection'](_0x8acba7[_0xe7f4('0x32')],_0x8acba7[_0xe7f4('0x33')]);_0xd07579[_0xe7f4('0x37')]=_[_0xe7f4('0x36')](_0x8acba7[_0xe7f4('0x32')],qs[_0xe7f4('0x38')](_0x42c070[_0xe7f4('0x33')][_0xe7f4('0x38')]));_0xd07579[_0xe7f4('0x37')]=_0xd07579[_0xe7f4('0x37')][_0xe7f4('0x39')]?_0xd07579[_0xe7f4('0x37')]:_0x8acba7[_0xe7f4('0x32')];if(_0x42c070['query'][_0xe7f4('0x42')]){_0xd07579['include']=[{'all':!![]}];}_0xd07579=_[_0xe7f4('0x40')]({},_0xd07579,_0x42c070[_0xe7f4('0x41')]);return db['Pause'][_0xe7f4('0x48')](_0xd07579)['then'](handleEntityNotFound(_0x15948b,null))['then'](respondWithResult(_0x15948b,null))['catch'](handleError(_0x15948b,null));};exports[_0xe7f4('0x49')]=function(_0x1fdb05,_0x5aa354){return db[_0xe7f4('0x2f')]['create'](_0x1fdb05[_0xe7f4('0x4a')],{})[_0xe7f4('0x25')](function(_0xa1e465){var _0x226a6f=_0x1fdb05[_0xe7f4('0x4b')][_0xe7f4('0x27')]({'plain':!![]});if(!_0x226a6f)throw new Error(_0xe7f4('0x4c'));if(_0x226a6f['role']===_0xe7f4('0x4b')){var _0xee78f9=_0xa1e465[_0xe7f4('0x27')]({'plain':!![]});var _0x543149=_0xe7f4('0x28');return db[_0xe7f4('0x4d')][_0xe7f4('0x48')]({'where':{'name':_0x543149,'userProfileId':_0x226a6f['userProfileId']},'raw':!![]})[_0xe7f4('0x25')](function(_0x32c065){if(_0x32c065&&_0x32c065['autoAssociation']===0x0){return db[_0xe7f4('0x29')]['create']({'name':_0xee78f9[_0xe7f4('0x2c')],'resourceId':_0xee78f9['id'],'type':_0x32c065['name'],'sectionId':_0x32c065['id']},{})['then'](function(){return _0xa1e465;});}else{return _0xa1e465;}})['catch'](function(_0x48600a){logger[_0xe7f4('0x2b')](_0xe7f4('0x4e'),_0x48600a);throw _0x48600a;});}return _0xa1e465;})[_0xe7f4('0x25')](respondWithResult(_0x5aa354,0xc9))[_0xe7f4('0x45')](handleError(_0x5aa354,null));};exports['update']=function(_0x51137d,_0x518113){if(_0x51137d[_0xe7f4('0x4a')]['id']){delete _0x51137d[_0xe7f4('0x4a')]['id'];}return db[_0xe7f4('0x2f')][_0xe7f4('0x48')]({'where':{'id':_0x51137d['params']['id']}})[_0xe7f4('0x25')](handleEntityNotFound(_0x518113,null))[_0xe7f4('0x25')](saveUpdates(_0x51137d[_0xe7f4('0x4a')],null))[_0xe7f4('0x25')](respondWithResult(_0x518113,null))[_0xe7f4('0x45')](handleError(_0x518113,null));};exports['destroy']=function(_0x6e79ad,_0x2ea34f){return db[_0xe7f4('0x2f')]['find']({'where':{'id':_0x6e79ad[_0xe7f4('0x47')]['id']}})[_0xe7f4('0x25')](handleEntityNotFound(_0x2ea34f,null))['then'](removeEntity(_0x2ea34f,null))['catch'](handleError(_0x2ea34f,null));}; \ No newline at end of file +var _0xbde1=['attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','options','Pause','includeAll','findAll','catch','show','params','filters','include','merge','find','create','body','get','role','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','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/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','destroy','then','Pauses','end','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','key','model','map','keys','query','intersection'];(function(_0x949dfa,_0x43772b){var _0x5c2156=function(_0x33913d){while(--_0x33913d){_0x949dfa['push'](_0x949dfa['shift']());}};_0x5c2156(++_0x43772b);}(_0xbde1,0x156));var _0x1bde=function(_0x2d54ba,_0x3e6ed6){_0x2d54ba=_0x2d54ba-0x0;var _0x1a133e=_0xbde1[_0x2d54ba];return _0x1a133e;};'use strict';var emlformat=require(_0x1bde('0x0'));var rimraf=require(_0x1bde('0x1'));var zipdir=require(_0x1bde('0x2'));var jsonpatch=require(_0x1bde('0x3'));var rp=require('request-promise');var moment=require(_0x1bde('0x4'));var BPromise=require(_0x1bde('0x5'));var Mustache=require(_0x1bde('0x6'));var util=require(_0x1bde('0x7'));var path=require(_0x1bde('0x8'));var sox=require(_0x1bde('0x9'));var csv=require(_0x1bde('0xa'));var ejs=require(_0x1bde('0xb'));var fs=require('fs');var fs_extra=require(_0x1bde('0xc'));var _=require('lodash');var squel=require(_0x1bde('0xd'));var crypto=require(_0x1bde('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1bde('0xa'));var querystring=require(_0x1bde('0xf'));var Papa=require('papaparse');var Redis=require(_0x1bde('0x10'));var authService=require(_0x1bde('0x11'));var qs=require(_0x1bde('0x12'));var as=require(_0x1bde('0x13'));var hardwareService=require(_0x1bde('0x14'));var logger=require('../../config/logger')(_0x1bde('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1bde('0x16'));var db=require(_0x1bde('0x17'))['db'];function respondWithStatusCode(_0x99abc,_0x5068df){_0x5068df=_0x5068df||0xcc;return function(_0x402254){if(_0x402254){return _0x99abc['sendStatus'](_0x5068df);}return _0x99abc[_0x1bde('0x18')](_0x5068df)['end']();};}function respondWithResult(_0x567ed0,_0x2e1276){_0x2e1276=_0x2e1276||0xc8;return function(_0xf1b9cf){if(_0xf1b9cf){return _0x567ed0['status'](_0x2e1276)[_0x1bde('0x19')](_0xf1b9cf);}};}function respondWithFilteredResult(_0x3d519f,_0x1ae42e){return function(_0x25da73){if(_0x25da73){var _0xca1c80=typeof _0x1ae42e['offset']===_0x1bde('0x1a')&&typeof _0x1ae42e[_0x1bde('0x1b')]===_0x1bde('0x1a');var _0x1f7641=_0x25da73[_0x1bde('0x1c')];var _0x17a347=_0xca1c80?0x0:_0x1ae42e['offset'];var _0x50fde8=_0xca1c80?_0x25da73[_0x1bde('0x1c')]:_0x1ae42e[_0x1bde('0x1d')]+_0x1ae42e['limit'];var _0x1feb33;if(_0x50fde8>=_0x1f7641){_0x50fde8=_0x1f7641;_0x1feb33=0xc8;}else{_0x1feb33=0xce;}_0x3d519f[_0x1bde('0x18')](_0x1feb33);return _0x3d519f[_0x1bde('0x1e')](_0x1bde('0x1f'),_0x17a347+'-'+_0x50fde8+'/'+_0x1f7641)[_0x1bde('0x19')](_0x25da73);}return null;};}function patchUpdates(_0x14dc2d){return function(_0x21310b){try{jsonpatch[_0x1bde('0x20')](_0x21310b,_0x14dc2d,!![]);}catch(_0x2518e8){return BPromise[_0x1bde('0x21')](_0x2518e8);}return _0x21310b['save']();};}function saveUpdates(_0x28ccd5,_0x49bfea){return function(_0xeba69a){if(_0xeba69a){return _0xeba69a[_0x1bde('0x22')](_0x28ccd5)['then'](function(_0x45e4ff){return _0x45e4ff;});}return null;};}function removeEntity(_0x180875,_0x3ec07f){return function(_0x321436){if(_0x321436){return _0x321436[_0x1bde('0x23')]()[_0x1bde('0x24')](function(){var _0x325528=_0x321436['get']({'plain':!![]});var _0xa315b2=_0x1bde('0x25');return db['UserProfileResource'][_0x1bde('0x23')]({'where':{'type':_0xa315b2,'resourceId':_0x325528['id']}})[_0x1bde('0x24')](function(){return _0x321436;});})[_0x1bde('0x24')](function(){_0x180875[_0x1bde('0x18')](0xcc)[_0x1bde('0x26')]();});}};}function handleEntityNotFound(_0x4abecb,_0x14f3a1){return function(_0x25ea62){if(!_0x25ea62){_0x4abecb[_0x1bde('0x27')](0x194);}return _0x25ea62;};}function handleError(_0x3add97,_0x46782e){_0x46782e=_0x46782e||0x1f4;return function(_0x82fbd9){logger[_0x1bde('0x28')](_0x82fbd9[_0x1bde('0x29')]);if(_0x82fbd9['name']){delete _0x82fbd9[_0x1bde('0x2a')];}_0x3add97['status'](_0x46782e)[_0x1bde('0x2b')](_0x82fbd9);};}exports[_0x1bde('0x2c')]=function(_0x2e6b07,_0x34e73e){var _0x38d783={},_0x3e4738={},_0x29ad41={'count':0x0,'rows':[]};var _0x4a4b53=_['map'](db['Pause'][_0x1bde('0x2d')],function(_0x50e9d9){return{'name':_0x50e9d9[_0x1bde('0x2e')],'type':_0x50e9d9['type'][_0x1bde('0x2f')]};});_0x3e4738[_0x1bde('0x30')]=_[_0x1bde('0x31')](_0x4a4b53,_0x1bde('0x2a'));_0x3e4738['query']=_[_0x1bde('0x32')](_0x2e6b07[_0x1bde('0x33')]);_0x3e4738['filters']=_[_0x1bde('0x34')](_0x3e4738['model'],_0x3e4738[_0x1bde('0x33')]);_0x38d783[_0x1bde('0x35')]=_[_0x1bde('0x34')](_0x3e4738[_0x1bde('0x30')],qs[_0x1bde('0x36')](_0x2e6b07['query'][_0x1bde('0x36')]));_0x38d783[_0x1bde('0x35')]=_0x38d783[_0x1bde('0x35')][_0x1bde('0x37')]?_0x38d783[_0x1bde('0x35')]:_0x3e4738[_0x1bde('0x30')];if(!_0x2e6b07[_0x1bde('0x33')][_0x1bde('0x38')]('nolimit')){_0x38d783['limit']=qs[_0x1bde('0x1b')](_0x2e6b07[_0x1bde('0x33')][_0x1bde('0x1b')]);_0x38d783['offset']=qs[_0x1bde('0x1d')](_0x2e6b07[_0x1bde('0x33')][_0x1bde('0x1d')]);}_0x38d783[_0x1bde('0x39')]=qs[_0x1bde('0x3a')](_0x2e6b07['query'][_0x1bde('0x3a')]);_0x38d783[_0x1bde('0x3b')]=qs['filters'](_[_0x1bde('0x3c')](_0x2e6b07[_0x1bde('0x33')],_0x3e4738['filters']),_0x4a4b53);if(_0x2e6b07[_0x1bde('0x33')][_0x1bde('0x3d')]){_0x38d783[_0x1bde('0x3b')]=_['merge'](_0x38d783['where'],{'$or':_['map'](_0x4a4b53,function(_0x20bfe5){if(_0x20bfe5['type']!=='VIRTUAL'){var _0x51dec6={};_0x51dec6[_0x20bfe5[_0x1bde('0x2a')]]={'$like':'%'+_0x2e6b07['query']['filter']+'%'};return _0x51dec6;}})});}_0x38d783=_['merge']({},_0x38d783,_0x2e6b07[_0x1bde('0x3e')]);var _0x3df3f1={'where':_0x38d783[_0x1bde('0x3b')]};return db[_0x1bde('0x3f')][_0x1bde('0x1c')](_0x3df3f1)[_0x1bde('0x24')](function(_0x36d084){_0x29ad41[_0x1bde('0x1c')]=_0x36d084;if(_0x2e6b07['query'][_0x1bde('0x40')]){_0x38d783['include']=[{'all':!![]}];}return db[_0x1bde('0x3f')][_0x1bde('0x41')](_0x38d783);})['then'](function(_0x3514de){_0x29ad41['rows']=_0x3514de;return _0x29ad41;})[_0x1bde('0x24')](respondWithFilteredResult(_0x34e73e,_0x38d783))[_0x1bde('0x42')](handleError(_0x34e73e,null));};exports[_0x1bde('0x43')]=function(_0x35c67c,_0x4cc5ea){var _0x4529eb={'raw':!![],'where':{'id':_0x35c67c[_0x1bde('0x44')]['id']}},_0x1bb703={};_0x1bb703['model']=_[_0x1bde('0x32')](db[_0x1bde('0x3f')][_0x1bde('0x2d')]);_0x1bb703[_0x1bde('0x33')]=_[_0x1bde('0x32')](_0x35c67c[_0x1bde('0x33')]);_0x1bb703[_0x1bde('0x45')]=_[_0x1bde('0x34')](_0x1bb703['model'],_0x1bb703[_0x1bde('0x33')]);_0x4529eb[_0x1bde('0x35')]=_[_0x1bde('0x34')](_0x1bb703['model'],qs[_0x1bde('0x36')](_0x35c67c[_0x1bde('0x33')]['fields']));_0x4529eb['attributes']=_0x4529eb[_0x1bde('0x35')][_0x1bde('0x37')]?_0x4529eb['attributes']:_0x1bb703['model'];if(_0x35c67c['query'][_0x1bde('0x40')]){_0x4529eb[_0x1bde('0x46')]=[{'all':!![]}];}_0x4529eb=_[_0x1bde('0x47')]({},_0x4529eb,_0x35c67c[_0x1bde('0x3e')]);return db[_0x1bde('0x3f')][_0x1bde('0x48')](_0x4529eb)[_0x1bde('0x24')](handleEntityNotFound(_0x4cc5ea,null))[_0x1bde('0x24')](respondWithResult(_0x4cc5ea,null))['catch'](handleError(_0x4cc5ea,null));};exports[_0x1bde('0x49')]=function(_0x283eef,_0x5c1979){return db[_0x1bde('0x3f')][_0x1bde('0x49')](_0x283eef[_0x1bde('0x4a')],{})[_0x1bde('0x24')](function(_0x4801d5){var _0x5c1a97=_0x283eef['user'][_0x1bde('0x4b')]({'plain':!![]});if(!_0x5c1a97)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5c1a97[_0x1bde('0x4c')]==='user'){var _0x16d2ba=_0x4801d5[_0x1bde('0x4b')]({'plain':!![]});var _0x3d4621=_0x1bde('0x25');return db['UserProfileSection'][_0x1bde('0x48')]({'where':{'name':_0x3d4621,'userProfileId':_0x5c1a97['userProfileId']},'raw':!![]})['then'](function(_0x193703){if(_0x193703&&_0x193703['autoAssociation']===0x0){return db[_0x1bde('0x4d')][_0x1bde('0x49')]({'name':_0x16d2ba['name'],'resourceId':_0x16d2ba['id'],'type':_0x193703[_0x1bde('0x2a')],'sectionId':_0x193703['id']},{})[_0x1bde('0x24')](function(){return _0x4801d5;});}else{return _0x4801d5;}})[_0x1bde('0x42')](function(_0x445aae){logger[_0x1bde('0x28')](_0x1bde('0x4e'),_0x445aae);throw _0x445aae;});}return _0x4801d5;})['then'](respondWithResult(_0x5c1979,0xc9))[_0x1bde('0x42')](handleError(_0x5c1979,null));};exports['update']=function(_0x1bc801,_0x3aaa3f){if(_0x1bc801[_0x1bde('0x4a')]['id']){delete _0x1bc801[_0x1bde('0x4a')]['id'];}return db[_0x1bde('0x3f')][_0x1bde('0x48')]({'where':{'id':_0x1bc801[_0x1bde('0x44')]['id']}})['then'](handleEntityNotFound(_0x3aaa3f,null))[_0x1bde('0x24')](saveUpdates(_0x1bc801[_0x1bde('0x4a')],null))[_0x1bde('0x24')](respondWithResult(_0x3aaa3f,null))[_0x1bde('0x42')](handleError(_0x3aaa3f,null));};exports['destroy']=function(_0x2673d1,_0x503a3b){return db[_0x1bde('0x3f')][_0x1bde('0x48')]({'where':{'id':_0x2673d1[_0x1bde('0x44')]['id']}})['then'](handleEntityNotFound(_0x503a3b,null))[_0x1bde('0x24')](removeEntity(_0x503a3b,null))[_0x1bde('0x42')](handleError(_0x503a3b,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index b0c7b72..c0fb135 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 _0x6aa7=['Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6aa7,0x178));var _0x76aa=function(_0x48d2a2,_0x238e34){_0x48d2a2=_0x48d2a2-0x0;var _0x2c831e=_0x6aa7[_0x48d2a2];return _0x2c831e;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var logger=require(_0x76aa('0x1'))(_0x76aa('0x2'));var moment=require(_0x76aa('0x3'));var BPromise=require(_0x76aa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76aa('0x5'));var rimraf=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var attributes=require('./pause.attributes');module['exports']=function(_0x1aceaa,_0x4d53f6){return _0x1aceaa[_0x76aa('0x8')](_0x76aa('0x9'),attributes,{'tableName':_0x76aa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x55c72d,_0x5d7876){_0x55c72d=_0x55c72d-0x0;var _0x3b64b6=_0x7fbe[_0x55c72d];return _0x3b64b6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'tools_pauses','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 e62c4e6..fe80b25 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(_0x1adac2,_0x55962e){var _0x126a73=function(_0x84e474){while(--_0x84e474){_0x1adac2['push'](_0x1adac2['shift']());}};_0x126a73(++_0x55962e);}(_0xb10b,0x12a));var _0xbb10=function(_0x59e821,_0x86c723){_0x59e821=_0x59e821-0x0;var _0x5333f6=_0xb10b[_0x59e821];return _0x5333f6;};'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 _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(_0x2c577d,_0x208432){var _0x5c980e=function(_0x2da4a9){while(--_0x2da4a9){_0x2c577d['push'](_0x2c577d['shift']());}};_0x5c980e(++_0x208432);}(_0xb10b,0x12a));var _0xbb10=function(_0x515ae8,_0x2a964f){_0x515ae8=_0x515ae8-0x0;var _0x4cf66a=_0xb10b[_0x515ae8];return _0x4cf66a;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index f17ae27..019156b 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 _0xb7c8=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','/:id/download','download','diskStorage','join','originalname','replace','format','basename','extname','now','post','single','file','upload','webhookPost','put','update','delete'];(function(_0x3363c1,_0x395049){var _0x15920c=function(_0x37d3e3){while(--_0x37d3e3){_0x3363c1['push'](_0x3363c1['shift']());}};_0x15920c(++_0x395049);}(_0xb7c8,0x119));var _0x8b7c=function(_0x47de7a,_0x469e42){_0x47de7a=_0x47de7a-0x0;var _0x492788=_0xb7c8[_0x47de7a];return _0x492788;};'use strict';var multer=require('multer');var util=require(_0x8b7c('0x0'));var path=require(_0x8b7c('0x1'));var timeout=require(_0x8b7c('0x2'));var express=require(_0x8b7c('0x3'));var router=express[_0x8b7c('0x4')]();var fs_extra=require(_0x8b7c('0x5'));var auth=require(_0x8b7c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8b7c('0x7'));var controller=require(_0x8b7c('0x8'));router[_0x8b7c('0x9')]('/',auth[_0x8b7c('0xa')](),controller[_0x8b7c('0xb')]);router[_0x8b7c('0x9')](_0x8b7c('0xc'),controller[_0x8b7c('0xd')]);router[_0x8b7c('0x9')](_0x8b7c('0xe'),auth[_0x8b7c('0xa')](),controller[_0x8b7c('0xf')]);router['get'](_0x8b7c('0x10'),auth['isAuthenticated'](),controller[_0x8b7c('0x11')]);var upload=multer({'storage':multer[_0x8b7c('0x12')]({'destination':function(_0x5868ec,_0x189a25,_0x452e83){_0x452e83(null,path[_0x8b7c('0x13')](config['root'],'server/files/plugins'));},'filename':function(_0x1c7471,_0x33c5aa,_0x297c39){_0x33c5aa[_0x8b7c('0x14')]=_0x33c5aa[_0x8b7c('0x14')][_0x8b7c('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x297c39(null,util[_0x8b7c('0x16')]('%s-%s%s',path[_0x8b7c('0x17')](_0x33c5aa[_0x8b7c('0x14')],path[_0x8b7c('0x18')](_0x33c5aa['originalname'])),Date[_0x8b7c('0x19')](),path[_0x8b7c('0x18')](_0x33c5aa['originalname'])));}})});router[_0x8b7c('0x1a')]('/',upload[_0x8b7c('0x1b')](_0x8b7c('0x1c')),controller[_0x8b7c('0x1d')]);router[_0x8b7c('0x1a')]('/webhook',controller[_0x8b7c('0x1e')]);router[_0x8b7c('0x1f')](_0x8b7c('0xe'),auth[_0x8b7c('0xa')](),controller[_0x8b7c('0x20')]);router['delete'](_0x8b7c('0xe'),auth[_0x8b7c('0xa')](),controller[_0x8b7c('0x21')]);module[_0x8b7c('0x22')]=router; \ No newline at end of file +var _0x55e0=['webhookPost','update','delete','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','webhookGet','/:id','isAuthenticated','show','/:id/download','download','diskStorage','join','server/files/plugins','originalname','replace','%s-%s%s','basename','extname','post','file','upload','/webhook'];(function(_0x180664,_0x1639a6){var _0x4549b6=function(_0xcec3b2){while(--_0xcec3b2){_0x180664['push'](_0x180664['shift']());}};_0x4549b6(++_0x1639a6);}(_0x55e0,0xdc));var _0x055e=function(_0x297b8b,_0x10031d){_0x297b8b=_0x297b8b-0x0;var _0x4566e9=_0x55e0[_0x297b8b];return _0x4566e9;};'use strict';var multer=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var path=require(_0x055e('0x2'));var timeout=require(_0x055e('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x055e('0x4'));var auth=require(_0x055e('0x5'));var interaction=require(_0x055e('0x6'));var config=require(_0x055e('0x7'));var controller=require(_0x055e('0x8'));router[_0x055e('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x055e('0x9')]('/webhook',controller[_0x055e('0xa')]);router[_0x055e('0x9')](_0x055e('0xb'),auth[_0x055e('0xc')](),controller[_0x055e('0xd')]);router['get'](_0x055e('0xe'),auth[_0x055e('0xc')](),controller[_0x055e('0xf')]);var upload=multer({'storage':multer[_0x055e('0x10')]({'destination':function(_0x238068,_0x5237d9,_0x56c78a){_0x56c78a(null,path[_0x055e('0x11')](config['root'],_0x055e('0x12')));},'filename':function(_0x466da3,_0x72d424,_0x101bc3){_0x72d424[_0x055e('0x13')]=_0x72d424[_0x055e('0x13')][_0x055e('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x101bc3(null,util['format'](_0x055e('0x15'),path[_0x055e('0x16')](_0x72d424[_0x055e('0x13')],path[_0x055e('0x17')](_0x72d424[_0x055e('0x13')])),Date['now'](),path[_0x055e('0x17')](_0x72d424[_0x055e('0x13')])));}})});router[_0x055e('0x18')]('/',upload['single'](_0x055e('0x19')),controller[_0x055e('0x1a')]);router[_0x055e('0x18')](_0x055e('0x1b'),controller[_0x055e('0x1c')]);router['put'](_0x055e('0xb'),auth[_0x055e('0xc')](),controller[_0x055e('0x1d')]);router[_0x055e('0x1e')]('/:id',auth[_0x055e('0xc')](),controller[_0x055e('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 4372f59..9c23459 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 _0x148d=['exports','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'];(function(_0x4e0881,_0xba4002){var _0x3276a5=function(_0x5db98c){while(--_0x5db98c){_0x4e0881['push'](_0x4e0881['shift']());}};_0x3276a5(++_0xba4002);}(_0x148d,0x198));var _0xd148=function(_0x396da4,_0x32d196){_0x396da4=_0x396da4-0x0;var _0x567b07=_0x148d[_0x396da4];return _0x567b07;};'use strict';var Sequelize=require('sequelize');module[_0xd148('0x0')]={'name':{'type':Sequelize[_0xd148('0x1')]},'type':{'type':Sequelize[_0xd148('0x2')](_0xd148('0x3'),_0xd148('0x4'))},'description':{'type':Sequelize[_0xd148('0x5')]},'version':{'type':Sequelize[_0xd148('0x5')]},'path':{'type':Sequelize[_0xd148('0x1')],'comment':_0xd148('0x6')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0xd148('0x2')](_0xd148('0x7'),_0xd148('0x8'),_0xd148('0x9'),_0xd148('0xa')),'defaultValue':'always','comment':_0xd148('0xb')},'icon':{'type':Sequelize[_0xd148('0x1')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0xd148('0x1')]},'scriptName':{'type':Sequelize[_0xd148('0x1')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x62cb=['ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','adminOnly','agentOnly','never','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING'];(function(_0x2b12f7,_0x4033ac){var _0x8cb277=function(_0x713b37){while(--_0x713b37){_0x2b12f7['push'](_0x2b12f7['shift']());}};_0x8cb277(++_0x4033ac);}(_0x62cb,0x7f));var _0xb62c=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x62cb[_0x4ae6ef];return _0x3cbb4e;};'use strict';var Sequelize=require(_0xb62c('0x0'));module[_0xb62c('0x1')]={'name':{'type':Sequelize[_0xb62c('0x2')]},'type':{'type':Sequelize[_0xb62c('0x3')](_0xb62c('0x4'),_0xb62c('0x5'))},'description':{'type':Sequelize[_0xb62c('0x6')]},'version':{'type':Sequelize[_0xb62c('0x6')]},'path':{'type':Sequelize[_0xb62c('0x2')],'comment':_0xb62c('0x7')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0xb62c('0x3')](_0xb62c('0x8'),_0xb62c('0x9'),'always',_0xb62c('0xa')),'defaultValue':_0xb62c('0xb'),'comment':_0xb62c('0xc')},'icon':{'type':Sequelize[_0xb62c('0x2')]},'adminUrl':{'type':Sequelize[_0xb62c('0x2')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0xb62c('0x2')]},'scriptPath':{'type':Sequelize[_0xb62c('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 849de1e..d84ea01 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 _0xa64f=['end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','Plugins','sendStatus','error','stack','name','send','index','map','Plugin','type','keys','intersection','model','attributes','fields','length','query','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','download','join','root','%s.zip','zip','warning','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','pipe','**/*','server/files/plugins','dirname','basename','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','format','Error\x20while\x20downloading\x20the\x20plugin','Download\x20completed','info','filename','file','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','0777','Invalid\x20plugin\x20structure','isFile','isDirectory','readdirSync','manifest.json','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','html','views','Invalid\x20manifest:\x20views\x20missing','agent','script','parameters','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','icon','icon-apps','admin','test','Warning:\x20admin\x20view\x20not\x20specified','plugins','Warning:\x20agent\x20view\x20not\x20specified','scriptName','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Zip\x20archive\x20removed','update','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','resolve','http://localhost:','encoding','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register'];(function(_0x599c57,_0x1ba25c){var _0x34ce2f=function(_0x4e1e6b){while(--_0x4e1e6b){_0x599c57['push'](_0x599c57['shift']());}};_0x34ce2f(++_0x1ba25c);}(_0xa64f,0x133));var _0xfa64=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xa64f[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require(_0xfa64('0x0'));var rimraf=require(_0xfa64('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfa64('0x2'));var rp=require(_0xfa64('0x3'));var moment=require(_0xfa64('0x4'));var BPromise=require(_0xfa64('0x5'));var Mustache=require(_0xfa64('0x6'));var util=require('util');var path=require(_0xfa64('0x7'));var sox=require('sox');var csv=require(_0xfa64('0x8'));var ejs=require(_0xfa64('0x9'));var fs=require('fs');var fs_extra=require(_0xfa64('0xa'));var _=require(_0xfa64('0xb'));var squel=require(_0xfa64('0xc'));var crypto=require(_0xfa64('0xd'));var jsforce=require(_0xfa64('0xe'));var deskjs=require(_0xfa64('0xf'));var toCsv=require(_0xfa64('0x8'));var querystring=require(_0xfa64('0x10'));var Papa=require('papaparse');var extract=require(_0xfa64('0x11'));var rimraf=require(_0xfa64('0x1'));var archiver=require(_0xfa64('0x12'));var Redis=require(_0xfa64('0x13'));var authService=require(_0xfa64('0x14'));var qs=require(_0xfa64('0x15'));var as=require(_0xfa64('0x16'));var hardwareService=require(_0xfa64('0x17'));var logger=require(_0xfa64('0x18'))(_0xfa64('0x19'));var utils=require(_0xfa64('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0xfa64('0x1b'));var db=require(_0xfa64('0x1c'))['db'];config[_0xfa64('0x1d')]=_[_0xfa64('0x1e')](config[_0xfa64('0x1d')],{'host':'localhost','port':0x18eb});var socket=require(_0xfa64('0x1f'))(new Redis(config['redis']));require('./plugin.socket')[_0xfa64('0x20')](socket);function respondWithStatusCode(_0x3b8827,_0x22e29c){_0x22e29c=_0x22e29c||0xcc;return function(_0x18de4b){if(_0x18de4b){return _0x3b8827['sendStatus'](_0x22e29c);}return _0x3b8827['status'](_0x22e29c)[_0xfa64('0x21')]();};}function respondWithResult(_0x4907da,_0xd8ff71){_0xd8ff71=_0xd8ff71||0xc8;return function(_0x30fadd){if(_0x30fadd){return _0x4907da[_0xfa64('0x22')](_0xd8ff71)[_0xfa64('0x23')](_0x30fadd);}};}function respondWithFilteredResult(_0x1f8cf4,_0x34584c){return function(_0x54e96e){if(_0x54e96e){var _0x649b84=typeof _0x34584c[_0xfa64('0x24')]===_0xfa64('0x25')&&typeof _0x34584c[_0xfa64('0x26')]===_0xfa64('0x25');var _0x1e2bcf=_0x54e96e[_0xfa64('0x27')];var _0x4288dd=_0x649b84?0x0:_0x34584c[_0xfa64('0x24')];var _0x14fbd2=_0x649b84?_0x54e96e[_0xfa64('0x27')]:_0x34584c[_0xfa64('0x24')]+_0x34584c[_0xfa64('0x26')];var _0x30e21d;if(_0x14fbd2>=_0x1e2bcf){_0x14fbd2=_0x1e2bcf;_0x30e21d=0xc8;}else{_0x30e21d=0xce;}_0x1f8cf4['status'](_0x30e21d);return _0x1f8cf4[_0xfa64('0x28')](_0xfa64('0x29'),_0x4288dd+'-'+_0x14fbd2+'/'+_0x1e2bcf)['json'](_0x54e96e);}return null;};}function patchUpdates(_0x12f4c1){return function(_0x521a7d){try{jsonpatch[_0xfa64('0x2a')](_0x521a7d,_0x12f4c1,!![]);}catch(_0x12d4a7){return BPromise[_0xfa64('0x2b')](_0x12d4a7);}return _0x521a7d[_0xfa64('0x2c')]();};}function saveUpdates(_0x215368,_0x49617f){return function(_0x2e9786){if(_0x2e9786){return _0x2e9786['update'](_0x215368)[_0xfa64('0x2d')](function(_0x84d073){return _0x84d073;});}return null;};}function removeEntity(_0x3591be,_0x3b0433){return function(_0x172462){if(_0x172462){return _0x172462[_0xfa64('0x2e')]()[_0xfa64('0x2d')](function(){var _0x20fd96=_0x172462[_0xfa64('0x2f')]({'plain':!![]});var _0x4a5d9f=_0xfa64('0x30');return db['UserProfileResource']['destroy']({'where':{'type':_0x4a5d9f,'resourceId':_0x20fd96['id']}})[_0xfa64('0x2d')](function(){return _0x172462;});})[_0xfa64('0x2d')](function(){_0x3591be['status'](0xcc)[_0xfa64('0x21')]();});}};}function handleEntityNotFound(_0x4b8ca4,_0x53a4a0){return function(_0x53f3a5){if(!_0x53f3a5){_0x4b8ca4[_0xfa64('0x31')](0x194);}return _0x53f3a5;};}function handleError(_0x485164,_0x4f27f5){_0x4f27f5=_0x4f27f5||0x1f4;return function(_0x7b8fdb){logger[_0xfa64('0x32')](_0x7b8fdb[_0xfa64('0x33')]);if(_0x7b8fdb[_0xfa64('0x34')]){delete _0x7b8fdb[_0xfa64('0x34')];}_0x485164[_0xfa64('0x22')](_0x4f27f5)[_0xfa64('0x35')](_0x7b8fdb);};}exports[_0xfa64('0x36')]=function(_0x17f7ba,_0xde3d43){var _0x3e0259={},_0x5d7fd1={},_0x384347={'count':0x0,'rows':[]};var _0x348b05=_[_0xfa64('0x37')](db[_0xfa64('0x38')]['rawAttributes'],function(_0x2b0e81){return{'name':_0x2b0e81['fieldName'],'type':_0x2b0e81[_0xfa64('0x39')]['key']};});_0x5d7fd1['model']=_[_0xfa64('0x37')](_0x348b05,_0xfa64('0x34'));_0x5d7fd1['query']=_[_0xfa64('0x3a')](_0x17f7ba['query']);_0x5d7fd1['filters']=_[_0xfa64('0x3b')](_0x5d7fd1[_0xfa64('0x3c')],_0x5d7fd1['query']);_0x3e0259[_0xfa64('0x3d')]=_[_0xfa64('0x3b')](_0x5d7fd1[_0xfa64('0x3c')],qs['fields'](_0x17f7ba['query'][_0xfa64('0x3e')]));_0x3e0259[_0xfa64('0x3d')]=_0x3e0259['attributes'][_0xfa64('0x3f')]?_0x3e0259[_0xfa64('0x3d')]:_0x5d7fd1[_0xfa64('0x3c')];if(!_0x17f7ba[_0xfa64('0x40')][_0xfa64('0x41')](_0xfa64('0x42'))){_0x3e0259[_0xfa64('0x26')]=qs['limit'](_0x17f7ba[_0xfa64('0x40')][_0xfa64('0x26')]);_0x3e0259['offset']=qs[_0xfa64('0x24')](_0x17f7ba[_0xfa64('0x40')]['offset']);}_0x3e0259[_0xfa64('0x43')]=qs['sort'](_0x17f7ba[_0xfa64('0x40')][_0xfa64('0x44')]);_0x3e0259['where']=qs[_0xfa64('0x45')](_[_0xfa64('0x46')](_0x17f7ba['query'],_0x5d7fd1[_0xfa64('0x45')]),_0x348b05);if(_0x17f7ba[_0xfa64('0x40')][_0xfa64('0x47')]){_0x3e0259[_0xfa64('0x48')]=_[_0xfa64('0x49')](_0x3e0259[_0xfa64('0x48')],{'$or':_[_0xfa64('0x37')](_0x348b05,function(_0x1a6594){if(_0x1a6594[_0xfa64('0x39')]!==_0xfa64('0x4a')){var _0x46f049={};_0x46f049[_0x1a6594[_0xfa64('0x34')]]={'$like':'%'+_0x17f7ba[_0xfa64('0x40')][_0xfa64('0x47')]+'%'};return _0x46f049;}})});}_0x3e0259=_[_0xfa64('0x49')]({},_0x3e0259,_0x17f7ba[_0xfa64('0x4b')]);var _0x1a6000={'where':_0x3e0259[_0xfa64('0x48')]};return db[_0xfa64('0x38')][_0xfa64('0x27')](_0x1a6000)['then'](function(_0x4bbe2f){_0x384347[_0xfa64('0x27')]=_0x4bbe2f;if(_0x17f7ba['query'][_0xfa64('0x4c')]){_0x3e0259[_0xfa64('0x4d')]=[{'all':!![]}];}return db[_0xfa64('0x38')][_0xfa64('0x4e')](_0x3e0259);})[_0xfa64('0x2d')](function(_0x44a8e5){_0x384347[_0xfa64('0x4f')]=_0x44a8e5;return _0x384347;})[_0xfa64('0x2d')](respondWithFilteredResult(_0xde3d43,_0x3e0259))[_0xfa64('0x50')](handleError(_0xde3d43,null));};exports[_0xfa64('0x51')]=function(_0x503d07,_0x37f78c){var _0x71805d={'raw':!![],'where':{'id':_0x503d07[_0xfa64('0x52')]['id']}},_0x20130d={};_0x20130d[_0xfa64('0x3c')]=_[_0xfa64('0x3a')](db[_0xfa64('0x38')]['rawAttributes']);_0x20130d[_0xfa64('0x40')]=_[_0xfa64('0x3a')](_0x503d07['query']);_0x20130d[_0xfa64('0x45')]=_[_0xfa64('0x3b')](_0x20130d[_0xfa64('0x3c')],_0x20130d[_0xfa64('0x40')]);_0x71805d[_0xfa64('0x3d')]=_['intersection'](_0x20130d[_0xfa64('0x3c')],qs['fields'](_0x503d07[_0xfa64('0x40')][_0xfa64('0x3e')]));_0x71805d[_0xfa64('0x3d')]=_0x71805d[_0xfa64('0x3d')][_0xfa64('0x3f')]?_0x71805d[_0xfa64('0x3d')]:_0x20130d[_0xfa64('0x3c')];if(_0x503d07[_0xfa64('0x40')][_0xfa64('0x4c')]){_0x71805d[_0xfa64('0x4d')]=[{'all':!![]}];}_0x71805d=_[_0xfa64('0x49')]({},_0x71805d,_0x503d07[_0xfa64('0x4b')]);return db[_0xfa64('0x38')][_0xfa64('0x53')](_0x71805d)[_0xfa64('0x2d')](handleEntityNotFound(_0x37f78c,null))['then'](respondWithResult(_0x37f78c,null))[_0xfa64('0x50')](handleError(_0x37f78c,null));};exports[_0xfa64('0x54')]=function(_0x4c4ebf,_0x38d15e,_0xbd83a3){return db[_0xfa64('0x38')][_0xfa64('0x53')]({'where':{'id':_0x4c4ebf['params']['id']},'attributes':[_0xfa64('0x34'),_0xfa64('0x7')],'raw':!![]})[_0xfa64('0x2d')](handleEntityNotFound(_0x38d15e,null))[_0xfa64('0x2d')](function(_0x35d4f4){if(_0x35d4f4){var _0x5c9958=path[_0xfa64('0x55')](config[_0xfa64('0x56')],'server/files/plugins',util['format'](_0xfa64('0x57'),path['basename'](_0x35d4f4['path'])));var _0x3dcfe9=fs['createWriteStream'](_0x5c9958);var _0x5da14d=archiver(_0xfa64('0x58'),{'zlib':{'level':0x9}});_0x5da14d['on'](_0xfa64('0x59'),function(_0x2b1fc9){if(_0x2b1fc9['code']===_0xfa64('0x5a')){logger['error'](_0x2b1fc9);}else{throw new db[(_0xfa64('0x5b'))]['Error'](_0xfa64('0x5c'));}});_0x5da14d['on'](_0xfa64('0x32'),function(_0x255973){throw new db[(_0xfa64('0x5b'))][(_0xfa64('0x5d'))](_0xfa64('0x5c'));});_0x5da14d[_0xfa64('0x5e')](_0x3dcfe9);_0x5da14d['glob'](_0xfa64('0x5f'),{'cwd':path[_0xfa64('0x55')](config['root'],_0xfa64('0x60'),path[_0xfa64('0x61')](_0x35d4f4[_0xfa64('0x7')])),'ignore':[path[_0xfa64('0x55')](path[_0xfa64('0x62')](_0x35d4f4['path']),_0xfa64('0x63')),path[_0xfa64('0x55')](path[_0xfa64('0x62')](_0x35d4f4[_0xfa64('0x7')]),_0xfa64('0x64'))],'nodir':!![]})[_0xfa64('0x65')]();_0x3dcfe9['on'](_0xfa64('0x66'),function(){if(!fs[_0xfa64('0x67')](_0x5c9958)){throw new db[(_0xfa64('0x5b'))]['Error'](_0xfa64('0x68'));}return _0x38d15e[_0xfa64('0x54')](_0x5c9958,util[_0xfa64('0x69')](_0xfa64('0x57'),path[_0xfa64('0x62')](_0x35d4f4['path'])),function(_0x443664){if(_0x443664){throw new db['Sequelize'][(_0xfa64('0x5d'))](_0xfa64('0x6a'));}fs['unlinkSync'](_0x5c9958);logger['info'](_0xfa64('0x6b'));logger[_0xfa64('0x6c')]('Temporary\x20file\x20removed');});});}return null;})[_0xfa64('0x50')](handleError(_0x38d15e,null));};exports['upload']=function(_0x1547a5,_0x1fad93,_0x1d739a){var _0x4b5595=path['basename'](_0x1547a5['file'][_0xfa64('0x6d')],path['extname'](_0x1547a5[_0xfa64('0x6e')]['filename']));var _0x5b1e6c=path[_0xfa64('0x55')](config['root'],_0xfa64('0x60'),_0x1547a5[_0xfa64('0x6e')][_0xfa64('0x6d')]);var _0x52366d=path[_0xfa64('0x55')](config[_0xfa64('0x56')],_0xfa64('0x60'),_0x4b5595);logger[_0xfa64('0x6c')](_0xfa64('0x6f'),_0x5b1e6c);logger[_0xfa64('0x6c')](_0xfa64('0x70'),_0x52366d);try{fs['chmodSync'](_0x5b1e6c,parseInt(_0xfa64('0x71'),0x8));extract(_0x5b1e6c,{'dir':_0x52366d},function(_0x275cc4){if(_0x275cc4){logger[_0xfa64('0x32')](_0x275cc4);handleError(_0x275cc4,!![]);};var _0xce58a4=fs['readdirSync'](_0x52366d);if(_0xce58a4[_0xfa64('0x3f')]>0x1){removeReferences(_0x5b1e6c,_0x52366d);logger[_0xfa64('0x32')](_0xfa64('0x72'));return _0x1d739a(new Error(_0xfa64('0x72')));}var _0x52420b=fs['lstatSync'](path[_0xfa64('0x55')](_0x52366d,_0xce58a4[0x0]));if(_0x52420b[_0xfa64('0x73')]()){removeReferences(_0x5b1e6c,_0x52366d);logger['error']('Invalid\x20plugin\x20structure');return _0x1d739a(new Error(_0xfa64('0x72')));}if(_0x52420b[_0xfa64('0x74')]()){var _0x3bc30d=fs[_0xfa64('0x75')](path[_0xfa64('0x55')](_0x52366d,_0xce58a4[0x0]));if(_0x3bc30d[_0xfa64('0x3f')]===0x0){removeReferences(_0x5b1e6c,_0x52366d);logger[_0xfa64('0x32')](_0xfa64('0x72'));return _0x1d739a(new Error(_0xfa64('0x72')));}var _0x48535c=_0x3bc30d['some'](function(_0x54c1c5){return _0x54c1c5===_0xfa64('0x76');});if(!_0x48535c){return _0x1d739a(new Error('Plugin\x20manifest\x20missing'));}var _0x1a4a0b=fs[_0xfa64('0x77')](path['join'](_0x52366d,_0xce58a4[0x0],_0xfa64('0x76')));var _0x3c563c=JSON[_0xfa64('0x78')](_0x1a4a0b);if(_0xfa64('0x25')==typeof _0x3c563c[_0xfa64('0x34')]){return _0x1d739a(new Error(_0xfa64('0x79')));}if('undefined'==typeof _0x3c563c['type']){return _0x1d739a(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0xfa64('0x25')==typeof _0x3c563c[_0xfa64('0x7a')]){return _0x1d739a(new Error(_0xfa64('0x7b')));}if(_0xfa64('0x25')==typeof _0x3c563c['parameters']){return _0x1d739a(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x3c563c[_0xfa64('0x39')]===_0xfa64('0x7c')){if(_0xfa64('0x25')==typeof _0x3c563c['parameters'][_0xfa64('0x7d')]){return _0x1d739a(new Error(_0xfa64('0x7e')));}if(_0xfa64('0x25')==typeof _0x3c563c['parameters'][_0xfa64('0x7d')]['admin']&&_0xfa64('0x25')==typeof _0x3c563c['parameters']['views'][_0xfa64('0x7f')]){return _0x1d739a(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x3c563c['type']===_0xfa64('0x80')){if(_0xfa64('0x25')==typeof _0x3c563c[_0xfa64('0x81')]['scriptName']){return _0x1d739a(new Error(_0xfa64('0x82')));}if(_0xfa64('0x25')==typeof _0x3c563c['parameters'][_0xfa64('0x83')]){return _0x1d739a(new Error(_0xfa64('0x84')));}}else{return _0x1d739a(new Error(_0xfa64('0x85')));}var _0x35df96=_0x3c563c[_0xfa64('0x34')];var _0xc70ee3=_0x3c563c[_0xfa64('0x86')];var _0x4869f6=_0x3c563c[_0xfa64('0x39')];var _0x24945c=_0x3c563c['sidebar']?_0x3c563c['sidebar']:'always';var _0x5d60fb=_0x3c563c[_0xfa64('0x87')]?_0x3c563c[_0xfa64('0x87')]:_0xfa64('0x88');var _0x4f73db='';var _0x2c199e='';var _0x4db37a='';var _0x1262af='';var _0x512ff7=_0x3c563c[_0xfa64('0x7a')];if(_0x4869f6===_0xfa64('0x7c')){if(_0xfa64('0x25')!=typeof _0x3c563c[_0xfa64('0x81')][_0xfa64('0x7d')]['admin']){var _0x4bb4b5=_0x3c563c['parameters'][_0xfa64('0x7d')][_0xfa64('0x89')];if(!/^(f|ht)tps?:\/\//i[_0xfa64('0x8a')](_0x4bb4b5)){_0x4f73db=path['join']('plugins',_0x4b5595,_0xce58a4[0x0],_0x4bb4b5);}else{_0x4f73db=_0x4bb4b5;}}else{logger['info'](_0xfa64('0x8b'));}if(_0xfa64('0x25')!=typeof _0x3c563c['parameters'][_0xfa64('0x7d')][_0xfa64('0x7f')]){var _0x4167ae=_0x3c563c[_0xfa64('0x81')]['views']['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x4167ae)){_0x2c199e=path['join'](_0xfa64('0x8c'),_0x4b5595,_0xce58a4[0x0],_0x4167ae);}else{_0x2c199e=_0x4167ae;}}else{logger['info'](_0xfa64('0x8d'));}}else if(_0x4869f6===_0xfa64('0x80')){_0x4db37a=_0x3c563c[_0xfa64('0x81')][_0xfa64('0x8e')];_0x1262af=_0x3c563c['parameters'][_0xfa64('0x83')];if('undefined'!=typeof _0x3c563c['parameters']['views']){if(_0xfa64('0x25')!=typeof _0x3c563c[_0xfa64('0x81')][_0xfa64('0x7d')]['admin']){var _0x4bb4b5=_0x3c563c[_0xfa64('0x81')][_0xfa64('0x7d')][_0xfa64('0x89')];if(!/^(f|ht)tps?:\/\//i[_0xfa64('0x8a')](_0x4bb4b5)){_0x4f73db=path['join'](_0xfa64('0x8c'),_0x4b5595,_0xce58a4[0x0],_0x4bb4b5);}else{_0x4f73db=_0x4bb4b5;}}if(_0xfa64('0x25')!=typeof _0x3c563c['parameters'][_0xfa64('0x7d')][_0xfa64('0x7f')]){var _0x4167ae=_0x3c563c[_0xfa64('0x81')][_0xfa64('0x7d')][_0xfa64('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0xfa64('0x8a')](_0x4167ae)){_0x2c199e=path[_0xfa64('0x55')](_0xfa64('0x8c'),_0x4b5595,_0xce58a4[0x0],_0x4167ae);}else{_0x2c199e=_0x4167ae;}}}}var _0x477682={'name':_0x35df96,'description':_0xc70ee3,'path':path[_0xfa64('0x55')](_0x4b5595,_0xce58a4[0x0]),'type':_0x4869f6,'sidebar':_0x24945c,'icon':_0x5d60fb,'adminUrl':_0x4f73db,'agentUrl':_0x2c199e,'scriptName':_0x4db37a,'scriptPath':_0x1262af,'version':_0x512ff7};removeReferences(_0x5b1e6c,null);return db[_0xfa64('0x38')]['create'](_0x477682)[_0xfa64('0x2d')](function(_0x3f9912){var _0xac7dd7={'role':_0x1547a5['body'][_0xfa64('0x8f')],'userProfileId':_0x1547a5[_0xfa64('0x90')][_0xfa64('0x91')]};if(!_0xac7dd7)throw new Error(_0xfa64('0x92'));if(_0xac7dd7[_0xfa64('0x8f')]==='user'){var _0x44a53f=_0x3f9912[_0xfa64('0x2f')]({'plain':!![]});return db[_0xfa64('0x93')]['find']({'where':{'name':'Plugins','userProfileId':_0xac7dd7['userProfileId']},'raw':!![]})[_0xfa64('0x2d')](function(_0x4862dd){if(_0x4862dd&&_0x4862dd[_0xfa64('0x94')]===0x0){return db['UserProfileResource'][_0xfa64('0x95')]({'name':_0x44a53f[_0xfa64('0x34')],'resourceId':_0x44a53f['id'],'type':_0x4862dd['name'],'sectionId':_0x4862dd['id']},{})[_0xfa64('0x2d')](function(){return _0x3f9912;});}else{return _0x3f9912;}})[_0xfa64('0x50')](function(_0x3bc15d){logger[_0xfa64('0x32')](_0xfa64('0x96'),_0x3bc15d);throw _0x3bc15d;});}return _0x3f9912;})['then'](respondWithResult(_0x1fad93,null))[_0xfa64('0x50')](handleError(_0x1fad93,null));}});}catch(_0x2e2600){_0x1fad93[_0xfa64('0x22')](0x1f4)[_0xfa64('0x35')](_0x2e2600);}};function removeReferences(_0x5238a9,_0xf5b1c6){try{if(_0x5238a9){fs[_0xfa64('0x97')](_0x5238a9);logger[_0xfa64('0x6c')](_0xfa64('0x98'));}if(_0xf5b1c6){rimraf(_0xf5b1c6,function(){});logger[_0xfa64('0x6c')]('Extracted\x20folder\x20removed');}}catch(_0x45162b){logger[_0xfa64('0x32')](_0x45162b);}}exports[_0xfa64('0x99')]=function(_0xb3f98a,_0x1a0e19,_0x12186e){return db[_0xfa64('0x38')]['find']({'where':{'id':_0xb3f98a[_0xfa64('0x52')]['id']}})['then'](handleEntityNotFound(_0x1a0e19,null))[_0xfa64('0x2d')](saveUpdates(_0xb3f98a['body'],null))['then'](respondWithResult(_0x1a0e19,null))[_0xfa64('0x50')](handleError(_0x1a0e19,null));};exports[_0xfa64('0x9a')]=function(_0x5908e2,_0x3a1d9b,_0x596fc4){return db[_0xfa64('0x38')][_0xfa64('0x53')]({'where':{'id':_0x5908e2[_0xfa64('0x52')]['id']}})[_0xfa64('0x2d')](function(_0x21a7b6){if(_0x21a7b6){return _0x21a7b6['destroy']();}})[_0xfa64('0x2d')](function(_0x397e5b){rimraf(path[_0xfa64('0x55')](config[_0xfa64('0x56')],_0xfa64('0x60'),path[_0xfa64('0x61')](_0x397e5b[_0xfa64('0x7')])),function(){});return _0x397e5b;})[_0xfa64('0x2d')](handleEntityNotFound(_0x3a1d9b,null))['then'](respondWithStatusCode(_0x3a1d9b,null))['catch'](handleError(_0x3a1d9b,null));};exports[_0xfa64('0x9b')]=function(_0x47aff9,_0x73420d,_0x4ab1e3){return BPromise['resolve']()['then'](function(){if(!_0x47aff9[_0xfa64('0x40')][_0xfa64('0x7')]){throw new Error(_0xfa64('0x9c'));}if(!_0x47aff9[_0xfa64('0x40')]['port']){throw new Error(_0xfa64('0x9d'));}var _0x575686=_0x47aff9['query'][_0xfa64('0x9e')]?_0x47aff9[_0xfa64('0x40')]['hostname']+':'+_0x47aff9[_0xfa64('0x40')][_0xfa64('0x9f')]:'http://localhost:'+_0x47aff9[_0xfa64('0x40')][_0xfa64('0x9f')];var _0x29d2ca=_0x47aff9[_0xfa64('0x40')][_0xfa64('0x23')]?_0x47aff9[_0xfa64('0x40')][_0xfa64('0x23')]:!![];var _0x21a1df=_0x47aff9[_0xfa64('0x40')]['encoding']?_0x47aff9[_0xfa64('0x40')]['encoding']:null;var _0x594195={'method':_0x47aff9['method'],'uri':util[_0xfa64('0x69')](_0xfa64('0xa0'),_0x575686,_0x47aff9[_0xfa64('0x40')]['path']),'json':_0x29d2ca,'resolveWithFullResponse':!![],'encoding':_0x21a1df,'qs':_0x47aff9['query']};if(_0x47aff9[_0xfa64('0xa1')]){_0x594195[_0xfa64('0xa1')]=_0x47aff9[_0xfa64('0xa1')];if(_0x594195[_0xfa64('0xa1')][_0xfa64('0xa2')]){delete _0x594195['headers'][_0xfa64('0xa2')];}}if(_0x594195['headers'][_0xfa64('0xa3')]){delete _0x594195['headers'][_0xfa64('0xa3')];}return rp(_0x594195);})[_0xfa64('0x2d')](function(_0x29c4fe){if(_0x29c4fe){_0x73420d[_0xfa64('0x28')](_0x29c4fe['headers']);logger[_0xfa64('0x6c')](_0x29c4fe[_0xfa64('0x90')]);if(_[_0xfa64('0xa4')](_0x47aff9[_0xfa64('0x40')][_0xfa64('0x7')],_0xfa64('0x54'))&&_0x29c4fe[_0xfa64('0xa5')]==0x1f4){return _0x73420d[_0xfa64('0x31')](_0x29c4fe[_0xfa64('0xa5')]);}else{return _0x73420d[_0xfa64('0x22')](_0x29c4fe[_0xfa64('0xa5')])[_0xfa64('0x35')](_0x29c4fe[_0xfa64('0x90')]);}}else{return _0x73420d[_0xfa64('0x31')](0xc8);}})[_0xfa64('0x50')](handleError(_0x73420d,null));};exports[_0xfa64('0xa6')]=function(_0x3f23,_0x847192,_0x337ef3){return BPromise[_0xfa64('0xa7')]()[_0xfa64('0x2d')](function(){if(!_0x3f23['query']['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x3f23['query'][_0xfa64('0x9f')]){throw new Error(_0xfa64('0x9d'));}var _0x200ded=_0x3f23[_0xfa64('0x40')][_0xfa64('0x9e')]?_0x3f23['query'][_0xfa64('0x9e')]+':'+_0x3f23['query'][_0xfa64('0x9f')]:_0xfa64('0xa8')+_0x3f23[_0xfa64('0x40')][_0xfa64('0x9f')];var _0x50156f=_0x3f23[_0xfa64('0x40')][_0xfa64('0x23')]?_0x3f23[_0xfa64('0x40')][_0xfa64('0x23')]:!![];var _0x1fb92c=_0x3f23['query'][_0xfa64('0xa9')]?_0x3f23[_0xfa64('0x40')][_0xfa64('0xa9')]:null;var _0x14ba73={'method':_0x3f23['method'],'uri':util['format']('%s%s',_0x200ded,_0x3f23[_0xfa64('0x40')][_0xfa64('0x7')]),'json':_0x50156f,'resolveWithFullResponse':!![],'encoding':_0x1fb92c,'body':_0x3f23[_0xfa64('0x90')]};if(_0x3f23[_0xfa64('0xa1')]){_0x14ba73[_0xfa64('0xa1')]=_0x3f23[_0xfa64('0xa1')];if(_0x14ba73[_0xfa64('0xa1')][_0xfa64('0xa2')]){delete _0x14ba73[_0xfa64('0xa1')][_0xfa64('0xa2')];}}if(_0x14ba73[_0xfa64('0xa1')][_0xfa64('0xa3')]){delete _0x14ba73['headers'][_0xfa64('0xa3')];}return rp(_0x14ba73);})[_0xfa64('0x2d')](function(_0x25757f){if(_0x25757f){_0x847192[_0xfa64('0x28')](_0x25757f[_0xfa64('0xa1')]);logger[_0xfa64('0x6c')](_0x25757f[_0xfa64('0x90')]);return _0x847192['status'](_0x25757f[_0xfa64('0xa5')])[_0xfa64('0x35')](_0x25757f[_0xfa64('0x90')]);}else{return _0x847192[_0xfa64('0x31')](0xc8);}})[_0xfa64('0x50')](handleError(_0x847192,null));}; \ No newline at end of file +var _0x1b3a=['close','Plugin\x20not\x20found','info','Temporary\x20file\x20removed','file','filename','extname','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','parameters','Invalid\x20manifest:\x20views\x20missing','admin','views','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','sidebar','always','icon','html','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','Plugins','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','json','encoding','%s%s','headers','content-length','content-type','statusCode','webhookPost','resolve','method','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','extract-zip','archiver','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','./plugin.socket','register','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','UserProfileResource','error','name','send','index','map','Plugin','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','download','root','server/files/plugins','format','%s.zip','warning','code','Sequelize','Error','**/*','join','dirname','basename','attachments/**/*','finalize'];(function(_0x5550b3,_0x2d0ee0){var _0x4b8fc4=function(_0x22393a){while(--_0x22393a){_0x5550b3['push'](_0x5550b3['shift']());}};_0x4b8fc4(++_0x2d0ee0);}(_0x1b3a,0x19b));var _0xa1b3=function(_0x18ca27,_0x251b56){_0x18ca27=_0x18ca27-0x0;var _0x2b0d36=_0x1b3a[_0x18ca27];return _0x2b0d36;};'use strict';var emlformat=require(_0xa1b3('0x0'));var rimraf=require(_0xa1b3('0x1'));var zipdir=require(_0xa1b3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa1b3('0x3'));var BPromise=require(_0xa1b3('0x4'));var Mustache=require(_0xa1b3('0x5'));var util=require(_0xa1b3('0x6'));var path=require(_0xa1b3('0x7'));var sox=require(_0xa1b3('0x8'));var csv=require(_0xa1b3('0x9'));var ejs=require(_0xa1b3('0xa'));var fs=require('fs');var fs_extra=require(_0xa1b3('0xb'));var _=require('lodash');var squel=require(_0xa1b3('0xc'));var crypto=require(_0xa1b3('0xd'));var jsforce=require(_0xa1b3('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa1b3('0x9'));var querystring=require(_0xa1b3('0xf'));var Papa=require('papaparse');var extract=require(_0xa1b3('0x10'));var rimraf=require('rimraf');var archiver=require(_0xa1b3('0x11'));var Redis=require(_0xa1b3('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa1b3('0x13'));var as=require(_0xa1b3('0x14'));var hardwareService=require(_0xa1b3('0x15'));var logger=require(_0xa1b3('0x16'))(_0xa1b3('0x17'));var utils=require('../../config/utils');var config=require(_0xa1b3('0x18'));var licenseUtil=require(_0xa1b3('0x19'));var db=require(_0xa1b3('0x1a'))['db'];config[_0xa1b3('0x1b')]=_[_0xa1b3('0x1c')](config[_0xa1b3('0x1b')],{'host':_0xa1b3('0x1d'),'port':0x18eb});var socket=require(_0xa1b3('0x1e'))(new Redis(config[_0xa1b3('0x1b')]));require(_0xa1b3('0x1f'))[_0xa1b3('0x20')](socket);function respondWithStatusCode(_0x1b64d5,_0x52849b){_0x52849b=_0x52849b||0xcc;return function(_0x5ac19e){if(_0x5ac19e){return _0x1b64d5[_0xa1b3('0x21')](_0x52849b);}return _0x1b64d5['status'](_0x52849b)[_0xa1b3('0x22')]();};}function respondWithResult(_0x456502,_0x35acc7){_0x35acc7=_0x35acc7||0xc8;return function(_0x3ef200){if(_0x3ef200){return _0x456502[_0xa1b3('0x23')](_0x35acc7)['json'](_0x3ef200);}};}function respondWithFilteredResult(_0x113f17,_0x354a8e){return function(_0xc7b996){if(_0xc7b996){var _0x11a8f7=typeof _0x354a8e[_0xa1b3('0x24')]==='undefined'&&typeof _0x354a8e['limit']===_0xa1b3('0x25');var _0x270e57=_0xc7b996['count'];var _0x1fb22b=_0x11a8f7?0x0:_0x354a8e[_0xa1b3('0x24')];var _0x239f88=_0x11a8f7?_0xc7b996[_0xa1b3('0x26')]:_0x354a8e['offset']+_0x354a8e[_0xa1b3('0x27')];var _0x3b3fe5;if(_0x239f88>=_0x270e57){_0x239f88=_0x270e57;_0x3b3fe5=0xc8;}else{_0x3b3fe5=0xce;}_0x113f17[_0xa1b3('0x23')](_0x3b3fe5);return _0x113f17[_0xa1b3('0x28')](_0xa1b3('0x29'),_0x1fb22b+'-'+_0x239f88+'/'+_0x270e57)['json'](_0xc7b996);}return null;};}function patchUpdates(_0x331e23){return function(_0x286bfa){try{jsonpatch[_0xa1b3('0x2a')](_0x286bfa,_0x331e23,!![]);}catch(_0x1144f4){return BPromise['reject'](_0x1144f4);}return _0x286bfa[_0xa1b3('0x2b')]();};}function saveUpdates(_0x40164e,_0x188ba7){return function(_0x5f212c){if(_0x5f212c){return _0x5f212c[_0xa1b3('0x2c')](_0x40164e)[_0xa1b3('0x2d')](function(_0x1f7d3e){return _0x1f7d3e;});}return null;};}function removeEntity(_0x529d35,_0x50c77d){return function(_0x32b4fd){if(_0x32b4fd){return _0x32b4fd[_0xa1b3('0x2e')]()['then'](function(){var _0x5ba697=_0x32b4fd['get']({'plain':!![]});var _0x287a6d='Plugins';return db[_0xa1b3('0x2f')]['destroy']({'where':{'type':_0x287a6d,'resourceId':_0x5ba697['id']}})['then'](function(){return _0x32b4fd;});})['then'](function(){_0x529d35[_0xa1b3('0x23')](0xcc)[_0xa1b3('0x22')]();});}};}function handleEntityNotFound(_0x522d2f,_0x24deff){return function(_0x5d0604){if(!_0x5d0604){_0x522d2f['sendStatus'](0x194);}return _0x5d0604;};}function handleError(_0x38ea0b,_0x3b31f6){_0x3b31f6=_0x3b31f6||0x1f4;return function(_0x517514){logger[_0xa1b3('0x30')](_0x517514['stack']);if(_0x517514['name']){delete _0x517514[_0xa1b3('0x31')];}_0x38ea0b[_0xa1b3('0x23')](_0x3b31f6)[_0xa1b3('0x32')](_0x517514);};}exports[_0xa1b3('0x33')]=function(_0x2f2639,_0xcecca1){var _0x9f9bee={},_0x10fb81={},_0x1642bf={'count':0x0,'rows':[]};var _0x4e0b75=_[_0xa1b3('0x34')](db[_0xa1b3('0x35')]['rawAttributes'],function(_0x484789){return{'name':_0x484789[_0xa1b3('0x36')],'type':_0x484789[_0xa1b3('0x37')][_0xa1b3('0x38')]};});_0x10fb81[_0xa1b3('0x39')]=_[_0xa1b3('0x34')](_0x4e0b75,_0xa1b3('0x31'));_0x10fb81[_0xa1b3('0x3a')]=_[_0xa1b3('0x3b')](_0x2f2639['query']);_0x10fb81[_0xa1b3('0x3c')]=_[_0xa1b3('0x3d')](_0x10fb81['model'],_0x10fb81[_0xa1b3('0x3a')]);_0x9f9bee['attributes']=_['intersection'](_0x10fb81[_0xa1b3('0x39')],qs[_0xa1b3('0x3e')](_0x2f2639[_0xa1b3('0x3a')][_0xa1b3('0x3e')]));_0x9f9bee[_0xa1b3('0x3f')]=_0x9f9bee[_0xa1b3('0x3f')][_0xa1b3('0x40')]?_0x9f9bee[_0xa1b3('0x3f')]:_0x10fb81['model'];if(!_0x2f2639['query'][_0xa1b3('0x41')](_0xa1b3('0x42'))){_0x9f9bee['limit']=qs[_0xa1b3('0x27')](_0x2f2639[_0xa1b3('0x3a')][_0xa1b3('0x27')]);_0x9f9bee[_0xa1b3('0x24')]=qs[_0xa1b3('0x24')](_0x2f2639[_0xa1b3('0x3a')]['offset']);}_0x9f9bee[_0xa1b3('0x43')]=qs['sort'](_0x2f2639[_0xa1b3('0x3a')][_0xa1b3('0x44')]);_0x9f9bee[_0xa1b3('0x45')]=qs[_0xa1b3('0x3c')](_[_0xa1b3('0x46')](_0x2f2639['query'],_0x10fb81[_0xa1b3('0x3c')]),_0x4e0b75);if(_0x2f2639[_0xa1b3('0x3a')][_0xa1b3('0x47')]){_0x9f9bee[_0xa1b3('0x45')]=_[_0xa1b3('0x48')](_0x9f9bee[_0xa1b3('0x45')],{'$or':_[_0xa1b3('0x34')](_0x4e0b75,function(_0x510b2c){if(_0x510b2c[_0xa1b3('0x37')]!==_0xa1b3('0x49')){var _0x48d552={};_0x48d552[_0x510b2c['name']]={'$like':'%'+_0x2f2639[_0xa1b3('0x3a')]['filter']+'%'};return _0x48d552;}})});}_0x9f9bee=_[_0xa1b3('0x48')]({},_0x9f9bee,_0x2f2639[_0xa1b3('0x4a')]);var _0x1c8c25={'where':_0x9f9bee[_0xa1b3('0x45')]};return db['Plugin']['count'](_0x1c8c25)[_0xa1b3('0x2d')](function(_0x19b06b){_0x1642bf[_0xa1b3('0x26')]=_0x19b06b;if(_0x2f2639[_0xa1b3('0x3a')][_0xa1b3('0x4b')]){_0x9f9bee[_0xa1b3('0x4c')]=[{'all':!![]}];}return db[_0xa1b3('0x35')][_0xa1b3('0x4d')](_0x9f9bee);})[_0xa1b3('0x2d')](function(_0x30a4a6){_0x1642bf[_0xa1b3('0x4e')]=_0x30a4a6;return _0x1642bf;})[_0xa1b3('0x2d')](respondWithFilteredResult(_0xcecca1,_0x9f9bee))[_0xa1b3('0x4f')](handleError(_0xcecca1,null));};exports[_0xa1b3('0x50')]=function(_0x72c896,_0x3a5596){var _0xa98814={'raw':!![],'where':{'id':_0x72c896[_0xa1b3('0x51')]['id']}},_0x213344={};_0x213344[_0xa1b3('0x39')]=_[_0xa1b3('0x3b')](db[_0xa1b3('0x35')][_0xa1b3('0x52')]);_0x213344[_0xa1b3('0x3a')]=_[_0xa1b3('0x3b')](_0x72c896[_0xa1b3('0x3a')]);_0x213344[_0xa1b3('0x3c')]=_[_0xa1b3('0x3d')](_0x213344[_0xa1b3('0x39')],_0x213344[_0xa1b3('0x3a')]);_0xa98814[_0xa1b3('0x3f')]=_[_0xa1b3('0x3d')](_0x213344[_0xa1b3('0x39')],qs[_0xa1b3('0x3e')](_0x72c896['query'][_0xa1b3('0x3e')]));_0xa98814[_0xa1b3('0x3f')]=_0xa98814[_0xa1b3('0x3f')]['length']?_0xa98814[_0xa1b3('0x3f')]:_0x213344[_0xa1b3('0x39')];if(_0x72c896[_0xa1b3('0x3a')][_0xa1b3('0x4b')]){_0xa98814['include']=[{'all':!![]}];}_0xa98814=_[_0xa1b3('0x48')]({},_0xa98814,_0x72c896['options']);return db['Plugin'][_0xa1b3('0x53')](_0xa98814)[_0xa1b3('0x2d')](handleEntityNotFound(_0x3a5596,null))[_0xa1b3('0x2d')](respondWithResult(_0x3a5596,null))['catch'](handleError(_0x3a5596,null));};exports[_0xa1b3('0x54')]=function(_0x5142c9,_0x53aeff,_0x19d3f5){return db[_0xa1b3('0x35')][_0xa1b3('0x53')]({'where':{'id':_0x5142c9[_0xa1b3('0x51')]['id']},'attributes':[_0xa1b3('0x31'),_0xa1b3('0x7')],'raw':!![]})[_0xa1b3('0x2d')](handleEntityNotFound(_0x53aeff,null))[_0xa1b3('0x2d')](function(_0xe13a84){if(_0xe13a84){var _0x5ab71d=path['join'](config[_0xa1b3('0x55')],_0xa1b3('0x56'),util[_0xa1b3('0x57')](_0xa1b3('0x58'),path['basename'](_0xe13a84[_0xa1b3('0x7')])));var _0x294996=fs['createWriteStream'](_0x5ab71d);var _0x58a96d=archiver('zip',{'zlib':{'level':0x9}});_0x58a96d['on'](_0xa1b3('0x59'),function(_0x3da66e){if(_0x3da66e[_0xa1b3('0x5a')]==='ENOENT'){logger[_0xa1b3('0x30')](_0x3da66e);}else{throw new db[(_0xa1b3('0x5b'))]['Error']('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x58a96d['on'](_0xa1b3('0x30'),function(_0x403133){throw new db['Sequelize'][(_0xa1b3('0x5c'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x58a96d['pipe'](_0x294996);_0x58a96d['glob'](_0xa1b3('0x5d'),{'cwd':path[_0xa1b3('0x5e')](config[_0xa1b3('0x55')],_0xa1b3('0x56'),path[_0xa1b3('0x5f')](_0xe13a84[_0xa1b3('0x7')])),'ignore':[path[_0xa1b3('0x5e')](path[_0xa1b3('0x60')](_0xe13a84[_0xa1b3('0x7')]),'node_modules/**/*'),path[_0xa1b3('0x5e')](path[_0xa1b3('0x60')](_0xe13a84['path']),_0xa1b3('0x61'))],'nodir':!![]})[_0xa1b3('0x62')]();_0x294996['on'](_0xa1b3('0x63'),function(){if(!fs['existsSync'](_0x5ab71d)){throw new db[(_0xa1b3('0x5b'))]['Error'](_0xa1b3('0x64'));}return _0x53aeff[_0xa1b3('0x54')](_0x5ab71d,util['format'](_0xa1b3('0x58'),path[_0xa1b3('0x60')](_0xe13a84[_0xa1b3('0x7')])),function(_0x19113e){if(_0x19113e){throw new db[(_0xa1b3('0x5b'))][(_0xa1b3('0x5c'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs['unlinkSync'](_0x5ab71d);logger[_0xa1b3('0x65')]('Download\x20completed');logger[_0xa1b3('0x65')](_0xa1b3('0x66'));});});}return null;})['catch'](handleError(_0x53aeff,null));};exports['upload']=function(_0x3025af,_0x1aa6ef,_0x20467d){var _0xfcade0=path[_0xa1b3('0x60')](_0x3025af[_0xa1b3('0x67')][_0xa1b3('0x68')],path[_0xa1b3('0x69')](_0x3025af[_0xa1b3('0x67')][_0xa1b3('0x68')]));var _0x3a3a4b=path[_0xa1b3('0x5e')](config[_0xa1b3('0x55')],_0xa1b3('0x56'),_0x3025af['file'][_0xa1b3('0x68')]);var _0x10d99b=path[_0xa1b3('0x5e')](config[_0xa1b3('0x55')],'server/files/plugins',_0xfcade0);logger[_0xa1b3('0x65')]('Plugin\x20upload\x20filepath:\x20%s',_0x3a3a4b);logger['info'](_0xa1b3('0x6a'),_0x10d99b);try{fs[_0xa1b3('0x6b')](_0x3a3a4b,parseInt(_0xa1b3('0x6c'),0x8));extract(_0x3a3a4b,{'dir':_0x10d99b},function(_0x624249){if(_0x624249){logger[_0xa1b3('0x30')](_0x624249);handleError(_0x624249,!![]);};var _0x3a7e3d=fs[_0xa1b3('0x6d')](_0x10d99b);if(_0x3a7e3d[_0xa1b3('0x40')]>0x1){removeReferences(_0x3a3a4b,_0x10d99b);logger[_0xa1b3('0x30')](_0xa1b3('0x6e'));return _0x20467d(new Error(_0xa1b3('0x6e')));}var _0x1d725e=fs[_0xa1b3('0x6f')](path[_0xa1b3('0x5e')](_0x10d99b,_0x3a7e3d[0x0]));if(_0x1d725e[_0xa1b3('0x70')]()){removeReferences(_0x3a3a4b,_0x10d99b);logger['error']('Invalid\x20plugin\x20structure');return _0x20467d(new Error(_0xa1b3('0x6e')));}if(_0x1d725e[_0xa1b3('0x71')]()){var _0x2925cf=fs['readdirSync'](path['join'](_0x10d99b,_0x3a7e3d[0x0]));if(_0x2925cf[_0xa1b3('0x40')]===0x0){removeReferences(_0x3a3a4b,_0x10d99b);logger[_0xa1b3('0x30')]('Invalid\x20plugin\x20structure');return _0x20467d(new Error(_0xa1b3('0x6e')));}var _0x2baee2=_0x2925cf['some'](function(_0x140cf6){return _0x140cf6===_0xa1b3('0x72');});if(!_0x2baee2){return _0x20467d(new Error(_0xa1b3('0x73')));}var _0x470565=fs[_0xa1b3('0x74')](path[_0xa1b3('0x5e')](_0x10d99b,_0x3a7e3d[0x0],_0xa1b3('0x72')));var _0x49ab3f=JSON['parse'](_0x470565);if(_0xa1b3('0x25')==typeof _0x49ab3f[_0xa1b3('0x31')]){return _0x20467d(new Error(_0xa1b3('0x75')));}if('undefined'==typeof _0x49ab3f[_0xa1b3('0x37')]){return _0x20467d(new Error(_0xa1b3('0x76')));}if(_0xa1b3('0x25')==typeof _0x49ab3f[_0xa1b3('0x77')]){return _0x20467d(new Error(_0xa1b3('0x78')));}if('undefined'==typeof _0x49ab3f['parameters']){return _0x20467d(new Error(_0xa1b3('0x79')));}if(_0x49ab3f[_0xa1b3('0x37')]==='html'){if(_0xa1b3('0x25')==typeof _0x49ab3f[_0xa1b3('0x7a')]['views']){return _0x20467d(new Error(_0xa1b3('0x7b')));}if(_0xa1b3('0x25')==typeof _0x49ab3f['parameters']['views'][_0xa1b3('0x7c')]&&'undefined'==typeof _0x49ab3f[_0xa1b3('0x7a')][_0xa1b3('0x7d')][_0xa1b3('0x7e')]){return _0x20467d(new Error(_0xa1b3('0x7f')));}}else if(_0x49ab3f[_0xa1b3('0x37')]===_0xa1b3('0x80')){if(_0xa1b3('0x25')==typeof _0x49ab3f[_0xa1b3('0x7a')][_0xa1b3('0x81')]){return _0x20467d(new Error(_0xa1b3('0x82')));}if('undefined'==typeof _0x49ab3f['parameters'][_0xa1b3('0x83')]){return _0x20467d(new Error(_0xa1b3('0x84')));}}else{return _0x20467d(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0xe50c53=_0x49ab3f['name'];var _0xc31d1c=_0x49ab3f['description'];var _0x284d40=_0x49ab3f[_0xa1b3('0x37')];var _0x47185b=_0x49ab3f[_0xa1b3('0x85')]?_0x49ab3f['sidebar']:_0xa1b3('0x86');var _0xf99090=_0x49ab3f['icon']?_0x49ab3f[_0xa1b3('0x87')]:'icon-apps';var _0x3b05fd='';var _0x128a7c='';var _0x30b0b4='';var _0x2d54e1='';var _0x49fd65=_0x49ab3f['version'];if(_0x284d40===_0xa1b3('0x88')){if(_0xa1b3('0x25')!=typeof _0x49ab3f[_0xa1b3('0x7a')][_0xa1b3('0x7d')][_0xa1b3('0x7c')]){var _0x447465=_0x49ab3f['parameters']['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0xa1b3('0x89')](_0x447465)){_0x3b05fd=path['join'](_0xa1b3('0x8a'),_0xfcade0,_0x3a7e3d[0x0],_0x447465);}else{_0x3b05fd=_0x447465;}}else{logger[_0xa1b3('0x65')](_0xa1b3('0x8b'));}if('undefined'!=typeof _0x49ab3f['parameters'][_0xa1b3('0x7d')]['agent']){var _0x4f0227=_0x49ab3f['parameters']['views'][_0xa1b3('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0xa1b3('0x89')](_0x4f0227)){_0x128a7c=path[_0xa1b3('0x5e')](_0xa1b3('0x8a'),_0xfcade0,_0x3a7e3d[0x0],_0x4f0227);}else{_0x128a7c=_0x4f0227;}}else{logger[_0xa1b3('0x65')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x284d40===_0xa1b3('0x80')){_0x30b0b4=_0x49ab3f[_0xa1b3('0x7a')][_0xa1b3('0x81')];_0x2d54e1=_0x49ab3f['parameters']['scriptPath'];if(_0xa1b3('0x25')!=typeof _0x49ab3f[_0xa1b3('0x7a')][_0xa1b3('0x7d')]){if(_0xa1b3('0x25')!=typeof _0x49ab3f[_0xa1b3('0x7a')][_0xa1b3('0x7d')]['admin']){var _0x447465=_0x49ab3f[_0xa1b3('0x7a')][_0xa1b3('0x7d')][_0xa1b3('0x7c')];if(!/^(f|ht)tps?:\/\//i['test'](_0x447465)){_0x3b05fd=path[_0xa1b3('0x5e')](_0xa1b3('0x8a'),_0xfcade0,_0x3a7e3d[0x0],_0x447465);}else{_0x3b05fd=_0x447465;}}if('undefined'!=typeof _0x49ab3f['parameters'][_0xa1b3('0x7d')]['agent']){var _0x4f0227=_0x49ab3f['parameters'][_0xa1b3('0x7d')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x4f0227)){_0x128a7c=path[_0xa1b3('0x5e')]('plugins',_0xfcade0,_0x3a7e3d[0x0],_0x4f0227);}else{_0x128a7c=_0x4f0227;}}}}var _0x12e99d={'name':_0xe50c53,'description':_0xc31d1c,'path':path[_0xa1b3('0x5e')](_0xfcade0,_0x3a7e3d[0x0]),'type':_0x284d40,'sidebar':_0x47185b,'icon':_0xf99090,'adminUrl':_0x3b05fd,'agentUrl':_0x128a7c,'scriptName':_0x30b0b4,'scriptPath':_0x2d54e1,'version':_0x49fd65};removeReferences(_0x3a3a4b,null);return db[_0xa1b3('0x35')][_0xa1b3('0x8c')](_0x12e99d)[_0xa1b3('0x2d')](function(_0x5b8cdb){var _0x435e67={'role':_0x3025af[_0xa1b3('0x8d')][_0xa1b3('0x8e')],'userProfileId':_0x3025af['body'][_0xa1b3('0x8f')]};if(!_0x435e67)throw new Error(_0xa1b3('0x90'));if(_0x435e67[_0xa1b3('0x8e')]===_0xa1b3('0x91')){var _0x1d864b=_0x5b8cdb[_0xa1b3('0x92')]({'plain':!![]});return db[_0xa1b3('0x93')]['find']({'where':{'name':_0xa1b3('0x94'),'userProfileId':_0x435e67['userProfileId']},'raw':!![]})[_0xa1b3('0x2d')](function(_0x4ea703){if(_0x4ea703&&_0x4ea703[_0xa1b3('0x95')]===0x0){return db[_0xa1b3('0x2f')][_0xa1b3('0x8c')]({'name':_0x1d864b['name'],'resourceId':_0x1d864b['id'],'type':_0x4ea703[_0xa1b3('0x31')],'sectionId':_0x4ea703['id']},{})['then'](function(){return _0x5b8cdb;});}else{return _0x5b8cdb;}})[_0xa1b3('0x4f')](function(_0x1bda43){logger[_0xa1b3('0x30')](_0xa1b3('0x96'),_0x1bda43);throw _0x1bda43;});}return _0x5b8cdb;})[_0xa1b3('0x2d')](respondWithResult(_0x1aa6ef,null))[_0xa1b3('0x4f')](handleError(_0x1aa6ef,null));}});}catch(_0x18d983){_0x1aa6ef[_0xa1b3('0x23')](0x1f4)['send'](_0x18d983);}};function removeReferences(_0x2c0c46,_0x43bbe9){try{if(_0x2c0c46){fs['unlinkSync'](_0x2c0c46);logger[_0xa1b3('0x65')](_0xa1b3('0x97'));}if(_0x43bbe9){rimraf(_0x43bbe9,function(){});logger['info'](_0xa1b3('0x98'));}}catch(_0x1bf55e){logger[_0xa1b3('0x30')](_0x1bf55e);}}exports['update']=function(_0x4fd475,_0x378da8,_0x3d2cd5){return db['Plugin'][_0xa1b3('0x53')]({'where':{'id':_0x4fd475['params']['id']}})[_0xa1b3('0x2d')](handleEntityNotFound(_0x378da8,null))[_0xa1b3('0x2d')](saveUpdates(_0x4fd475['body'],null))[_0xa1b3('0x2d')](respondWithResult(_0x378da8,null))['catch'](handleError(_0x378da8,null));};exports[_0xa1b3('0x99')]=function(_0xbd950f,_0x1a3679,_0x48ab2a){return db['Plugin'][_0xa1b3('0x53')]({'where':{'id':_0xbd950f[_0xa1b3('0x51')]['id']}})[_0xa1b3('0x2d')](function(_0x422ee4){if(_0x422ee4){return _0x422ee4['destroy']();}})[_0xa1b3('0x2d')](function(_0x439bb1){rimraf(path[_0xa1b3('0x5e')](config[_0xa1b3('0x55')],_0xa1b3('0x56'),path[_0xa1b3('0x5f')](_0x439bb1[_0xa1b3('0x7')])),function(){});return _0x439bb1;})[_0xa1b3('0x2d')](handleEntityNotFound(_0x1a3679,null))[_0xa1b3('0x2d')](respondWithStatusCode(_0x1a3679,null))[_0xa1b3('0x4f')](handleError(_0x1a3679,null));};exports[_0xa1b3('0x9a')]=function(_0x49fb34,_0x2433d2,_0x172750){return BPromise['resolve']()[_0xa1b3('0x2d')](function(){if(!_0x49fb34['query'][_0xa1b3('0x7')]){throw new Error(_0xa1b3('0x9b'));}if(!_0x49fb34[_0xa1b3('0x3a')][_0xa1b3('0x9c')]){throw new Error(_0xa1b3('0x9d'));}var _0x456a33=_0x49fb34[_0xa1b3('0x3a')]['hostname']?_0x49fb34[_0xa1b3('0x3a')][_0xa1b3('0x9e')]+':'+_0x49fb34[_0xa1b3('0x3a')][_0xa1b3('0x9c')]:_0xa1b3('0x9f')+_0x49fb34[_0xa1b3('0x3a')][_0xa1b3('0x9c')];var _0x253dbe=_0x49fb34['query'][_0xa1b3('0xa0')]?_0x49fb34['query']['json']:!![];var _0x369f4a=_0x49fb34['query'][_0xa1b3('0xa1')]?_0x49fb34[_0xa1b3('0x3a')][_0xa1b3('0xa1')]:null;var _0x17e725={'method':_0x49fb34['method'],'uri':util[_0xa1b3('0x57')](_0xa1b3('0xa2'),_0x456a33,_0x49fb34['query'][_0xa1b3('0x7')]),'json':_0x253dbe,'resolveWithFullResponse':!![],'encoding':_0x369f4a,'qs':_0x49fb34[_0xa1b3('0x3a')]};if(_0x49fb34[_0xa1b3('0xa3')]){_0x17e725['headers']=_0x49fb34[_0xa1b3('0xa3')];if(_0x17e725[_0xa1b3('0xa3')][_0xa1b3('0xa4')]){delete _0x17e725[_0xa1b3('0xa3')][_0xa1b3('0xa4')];}}if(_0x17e725['headers'][_0xa1b3('0xa5')]){delete _0x17e725[_0xa1b3('0xa3')][_0xa1b3('0xa5')];}return rp(_0x17e725);})['then'](function(_0x3e0454){if(_0x3e0454){_0x2433d2[_0xa1b3('0x28')](_0x3e0454[_0xa1b3('0xa3')]);logger['info'](_0x3e0454['body']);if(_['endsWith'](_0x49fb34[_0xa1b3('0x3a')][_0xa1b3('0x7')],_0xa1b3('0x54'))&&_0x3e0454['statusCode']==0x1f4){return _0x2433d2[_0xa1b3('0x21')](_0x3e0454[_0xa1b3('0xa6')]);}else{return _0x2433d2[_0xa1b3('0x23')](_0x3e0454[_0xa1b3('0xa6')])[_0xa1b3('0x32')](_0x3e0454['body']);}}else{return _0x2433d2[_0xa1b3('0x21')](0xc8);}})[_0xa1b3('0x4f')](handleError(_0x2433d2,null));};exports[_0xa1b3('0xa7')]=function(_0x1de526,_0x1b448b,_0x38da4a){return BPromise[_0xa1b3('0xa8')]()['then'](function(){if(!_0x1de526[_0xa1b3('0x3a')][_0xa1b3('0x7')]){throw new Error(_0xa1b3('0x9b'));}if(!_0x1de526[_0xa1b3('0x3a')][_0xa1b3('0x9c')]){throw new Error(_0xa1b3('0x9d'));}var _0x1d5900=_0x1de526[_0xa1b3('0x3a')][_0xa1b3('0x9e')]?_0x1de526['query'][_0xa1b3('0x9e')]+':'+_0x1de526[_0xa1b3('0x3a')]['port']:'http://localhost:'+_0x1de526['query']['port'];var _0x4cff3b=_0x1de526['query'][_0xa1b3('0xa0')]?_0x1de526['query'][_0xa1b3('0xa0')]:!![];var _0x179f05=_0x1de526[_0xa1b3('0x3a')][_0xa1b3('0xa1')]?_0x1de526[_0xa1b3('0x3a')][_0xa1b3('0xa1')]:null;var _0x5229d7={'method':_0x1de526[_0xa1b3('0xa9')],'uri':util['format']('%s%s',_0x1d5900,_0x1de526[_0xa1b3('0x3a')][_0xa1b3('0x7')]),'json':_0x4cff3b,'resolveWithFullResponse':!![],'encoding':_0x179f05,'body':_0x1de526['body']};if(_0x1de526[_0xa1b3('0xa3')]){_0x5229d7['headers']=_0x1de526[_0xa1b3('0xa3')];if(_0x5229d7[_0xa1b3('0xa3')]['content-length']){delete _0x5229d7[_0xa1b3('0xa3')][_0xa1b3('0xa4')];}}if(_0x5229d7[_0xa1b3('0xa3')][_0xa1b3('0xa5')]){delete _0x5229d7['headers'][_0xa1b3('0xa5')];}return rp(_0x5229d7);})[_0xa1b3('0x2d')](function(_0x31cf2a){if(_0x31cf2a){_0x1b448b[_0xa1b3('0x28')](_0x31cf2a[_0xa1b3('0xa3')]);logger[_0xa1b3('0x65')](_0x31cf2a[_0xa1b3('0x8d')]);return _0x1b448b[_0xa1b3('0x23')](_0x31cf2a['statusCode'])[_0xa1b3('0x32')](_0x31cf2a['body']);}else{return _0x1b448b[_0xa1b3('0x21')](0xc8);}})[_0xa1b3('0x4f')](handleError(_0x1b448b,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index f6cd3e9..a52a5ab 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 _0x5785=['exports','events','../../mysqldb','Plugin','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x305bbf,_0x5647b3){var _0x4ed772=function(_0x3315ed){while(--_0x3315ed){_0x305bbf['push'](_0x305bbf['shift']());}};_0x4ed772(++_0x5647b3);}(_0x5785,0x119));var _0x5578=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x5785[_0x3e5086];return _0xfeb102;};'use strict';var EventEmitter=require(_0x5578('0x0'));var Plugin=require(_0x5578('0x1'))['db'][_0x5578('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x5578('0x3')](0x0);var events={'afterCreate':_0x5578('0x4'),'afterUpdate':'update','afterDestroy':_0x5578('0x5')};function emitEvent(_0x2a3b8a){return function(_0x1af5f6,_0x8c7841,_0x3112c5){PluginEvents[_0x5578('0x6')](_0x2a3b8a+':'+_0x1af5f6['id'],_0x1af5f6);PluginEvents[_0x5578('0x6')](_0x2a3b8a,_0x1af5f6);_0x3112c5(null);};}for(var e in events){if(events[_0x5578('0x7')](e)){var event=events[e];Plugin[_0x5578('0x8')](e,emitEvent(event));}}module[_0x5578('0x9')]=PluginEvents; \ No newline at end of file +var _0x8819=['remove','emit','hasOwnProperty','exports','Plugin','setMaxListeners','save','update'];(function(_0x229a03,_0x36fefc){var _0x2d6e11=function(_0x592d00){while(--_0x592d00){_0x229a03['push'](_0x229a03['shift']());}};_0x2d6e11(++_0x36fefc);}(_0x8819,0x94));var _0x9881=function(_0x3e3e03,_0x1107cc){_0x3e3e03=_0x3e3e03-0x0;var _0x2f9c36=_0x8819[_0x3e3e03];return _0x2f9c36;};'use strict';var EventEmitter=require('events');var Plugin=require('../../mysqldb')['db'][_0x9881('0x0')];var PluginEvents=new EventEmitter();PluginEvents[_0x9881('0x1')](0x0);var events={'afterCreate':_0x9881('0x2'),'afterUpdate':_0x9881('0x3'),'afterDestroy':_0x9881('0x4')};function emitEvent(_0x5e52c5){return function(_0x333d6f,_0x446deb,_0xf41442){PluginEvents[_0x9881('0x5')](_0x5e52c5+':'+_0x333d6f['id'],_0x333d6f);PluginEvents[_0x9881('0x5')](_0x5e52c5,_0x333d6f);_0xf41442(null);};}for(var e in events){if(events[_0x9881('0x6')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x9881('0x7')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 6c083df..826657c 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 _0x07fb=['api','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin','plugins','../../config/logger'];(function(_0x5b8b97,_0x6b4dfa){var _0x1fdf84=function(_0x2ced4c){while(--_0x2ced4c){_0x5b8b97['push'](_0x5b8b97['shift']());}};_0x1fdf84(++_0x6b4dfa);}(_0x07fb,0x113));var _0xb07f=function(_0x111bd2,_0x13841a){_0x111bd2=_0x111bd2-0x0;var _0x1e25fc=_0x07fb[_0x111bd2];return _0x1e25fc;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb07f('0x0'))(_0xb07f('0x1'));var moment=require('moment');var BPromise=require(_0xb07f('0x2'));var rp=require(_0xb07f('0x3'));var fs=require('fs');var path=require(_0xb07f('0x4'));var rimraf=require(_0xb07f('0x5'));var config=require(_0xb07f('0x6'));var attributes=require(_0xb07f('0x7'));module[_0xb07f('0x8')]=function(_0x3c3b17,_0x438e12){return _0x3c3b17[_0xb07f('0x9')](_0xb07f('0xa'),attributes,{'tableName':_0xb07f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x352d=['api','bluebird','rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin','plugins','lodash','util','../../config/logger'];(function(_0x44bb11,_0x406338){var _0x8be7d7=function(_0x3335fb){while(--_0x3335fb){_0x44bb11['push'](_0x44bb11['shift']());}};_0x8be7d7(++_0x406338);}(_0x352d,0xe1));var _0xd352=function(_0xd41b14,_0x2ac375){_0xd41b14=_0xd41b14-0x0;var _0x574c30=_0x352d[_0xd41b14];return _0x574c30;};'use strict';var _=require(_0xd352('0x0'));var util=require(_0xd352('0x1'));var logger=require(_0xd352('0x2'))(_0xd352('0x3'));var moment=require('moment');var BPromise=require(_0xd352('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd352('0x5'));var config=require(_0xd352('0x6'));var attributes=require(_0xd352('0x7'));module[_0xd352('0x8')]=function(_0x1f1e80,_0x5aa5b7){return _0x1f1e80[_0xd352('0x9')](_0xd352('0xa'),attributes,{'tableName':_0xd352('0xb'),'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 5ad2091..849ac6c 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 _0x02d8=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','localhost','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Plugin','create','options','raw','lodash'];(function(_0x11fbd9,_0x1959a7){var _0x503674=function(_0x3a5857){while(--_0x3a5857){_0x11fbd9['push'](_0x11fbd9['shift']());}};_0x503674(++_0x1959a7);}(_0x02d8,0x7f));var _0x802d=function(_0x299bcf,_0x5023d9){_0x299bcf=_0x299bcf-0x0;var _0x53f39b=_0x02d8[_0x299bcf];return _0x53f39b;};'use strict';var _=require(_0x802d('0x0'));var util=require(_0x802d('0x1'));var moment=require('moment');var BPromise=require(_0x802d('0x2'));var rs=require(_0x802d('0x3'));var fs=require('fs');var Redis=require(_0x802d('0x4'));var db=require(_0x802d('0x5'))['db'];var utils=require(_0x802d('0x6'));var logger=require(_0x802d('0x7'))('rpc');var config=require(_0x802d('0x8'));var jayson=require(_0x802d('0x9'));var client=jayson[_0x802d('0xa')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x802d('0xb'),'port':0x18eb});var socket=require(_0x802d('0xc'))(new Redis(config['redis']));require(_0x802d('0xd'))[_0x802d('0xe')](socket);function respondWithRpcPromise(_0x25453d,_0x58b414,_0x338348){return new BPromise(function(_0x13e98a,_0x2076d2){return client[_0x802d('0xf')](_0x25453d,_0x338348)[_0x802d('0x10')](function(_0x585860){logger[_0x802d('0x11')](_0x802d('0x12'),_0x58b414,_0x802d('0x13'));logger[_0x802d('0x14')](_0x802d('0x15'),_0x58b414,_0x802d('0x13'),JSON[_0x802d('0x16')](_0x585860));if(_0x585860['error']){if(_0x585860[_0x802d('0x17')][_0x802d('0x18')]===0x1f4){logger[_0x802d('0x17')](_0x802d('0x12'),_0x58b414,_0x585860[_0x802d('0x17')][_0x802d('0x19')]);return _0x2076d2(_0x585860['error'][_0x802d('0x19')]);}logger['error'](_0x802d('0x12'),_0x58b414,_0x585860[_0x802d('0x17')][_0x802d('0x19')]);return _0x13e98a(_0x585860[_0x802d('0x17')][_0x802d('0x19')]);}else{logger[_0x802d('0x11')](_0x802d('0x12'),_0x58b414,_0x802d('0x13'));_0x13e98a(_0x585860[_0x802d('0x1a')][_0x802d('0x19')]);}})[_0x802d('0x1b')](function(_0x5bbf77){logger[_0x802d('0x17')](_0x802d('0x12'),_0x58b414,_0x5bbf77);_0x2076d2(_0x5bbf77);});});}exports['CreatePlugin']=function(_0x2ceebf){var _0xf6c44a=this;return new Promise(function(_0x1e72f4,_0x319d25){return db[_0x802d('0x1c')][_0x802d('0x1d')](_0x2ceebf['body'],{'raw':_0x2ceebf['options']?_0x2ceebf[_0x802d('0x1e')][_0x802d('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x5ead65){logger[_0x802d('0x11')]('CreatePlugin',_0x2ceebf);logger[_0x802d('0x14')]('CreatePlugin',_0x2ceebf,JSON[_0x802d('0x16')](_0x5ead65));_0x1e72f4(_0x5ead65);})[_0x802d('0x1b')](function(_0x306659){logger[_0x802d('0x17')]('CreatePlugin',_0x306659[_0x802d('0x19')],_0x2ceebf);_0x319d25(_0xf6c44a['error'](0x1f4,_0x306659[_0x802d('0x19')]));});});}; \ No newline at end of file +var _0x477a=['then','stringify','lodash','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','info','Plugin,\x20%s,\x20%s','debug','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreatePlugin','Plugin','create','body'];(function(_0x3b29b9,_0x561ed5){var _0xaced28=function(_0x4a6f5a){while(--_0x4a6f5a){_0x3b29b9['push'](_0x3b29b9['shift']());}};_0xaced28(++_0x561ed5);}(_0x477a,0x1e2));var _0xa477=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x477a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa477('0x0'));var util=require('util');var moment=require(_0xa477('0x1'));var BPromise=require(_0xa477('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa477('0x3'));var db=require(_0xa477('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa477('0x5'));var config=require(_0xa477('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa477('0x7')][_0xa477('0x8')]({'port':0x232a});config[_0xa477('0x9')]=_[_0xa477('0xa')](config[_0xa477('0x9')],{'host':_0xa477('0xb'),'port':0x18eb});var socket=require(_0xa477('0xc'))(new Redis(config[_0xa477('0x9')]));require(_0xa477('0xd'))['register'](socket);function respondWithRpcPromise(_0x210383,_0x3d46eb,_0x599eb7){return new BPromise(function(_0x4ce130,_0x559cb9){return client['request'](_0x210383,_0x599eb7)['then'](function(_0x3450d1){logger[_0xa477('0xe')](_0xa477('0xf'),_0x3d46eb,'request\x20sent');logger[_0xa477('0x10')](_0xa477('0x11'),_0x3d46eb,_0xa477('0x12'),JSON['stringify'](_0x3450d1));if(_0x3450d1[_0xa477('0x13')]){if(_0x3450d1[_0xa477('0x13')][_0xa477('0x14')]===0x1f4){logger[_0xa477('0x13')](_0xa477('0xf'),_0x3d46eb,_0x3450d1['error'][_0xa477('0x15')]);return _0x559cb9(_0x3450d1[_0xa477('0x13')][_0xa477('0x15')]);}logger[_0xa477('0x13')](_0xa477('0xf'),_0x3d46eb,_0x3450d1[_0xa477('0x13')][_0xa477('0x15')]);return _0x4ce130(_0x3450d1[_0xa477('0x13')][_0xa477('0x15')]);}else{logger[_0xa477('0xe')](_0xa477('0xf'),_0x3d46eb,_0xa477('0x12'));_0x4ce130(_0x3450d1[_0xa477('0x16')]['message']);}})[_0xa477('0x17')](function(_0x16c31d){logger[_0xa477('0x13')](_0xa477('0xf'),_0x3d46eb,_0x16c31d);_0x559cb9(_0x16c31d);});});}exports[_0xa477('0x18')]=function(_0x265169){var _0x2a3f54=this;return new Promise(function(_0x2c245b,_0x5af670){return db[_0xa477('0x19')][_0xa477('0x1a')](_0x265169[_0xa477('0x1b')],{'raw':_0x265169['options']?_0x265169['options']['raw']===undefined?!![]:![]:!![]})[_0xa477('0x1c')](function(_0x2debae){logger['info'](_0xa477('0x18'),_0x265169);logger['debug']('CreatePlugin',_0x265169,JSON[_0xa477('0x1d')](_0x2debae));_0x2c245b(_0x2debae);})[_0xa477('0x17')](function(_0x1bb568){logger[_0xa477('0x13')](_0xa477('0x18'),_0x1bb568[_0xa477('0x15')],_0x265169);_0x5af670(_0x2a3f54[_0xa477('0x13')](0x1f4,_0x1bb568['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index c75b4e3..b56b986 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 _0xfb8e=['save','remove','update','emit','register','length'];(function(_0x292b9b,_0x324698){var _0x3478a0=function(_0x3c4382){while(--_0x3c4382){_0x292b9b['push'](_0x292b9b['shift']());}};_0x3478a0(++_0x324698);}(_0xfb8e,0xc6));var _0xefb8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfb8e[_0x3dd15e];return _0x231fd0;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0xefb8('0x0'),_0xefb8('0x1'),_0xefb8('0x2')];function createListener(_0x58e61d,_0x9f7e32){return function(_0x4dd490){_0x9f7e32[_0xefb8('0x3')](_0x58e61d,_0x4dd490);};}function removeListener(_0x9fed2a,_0x428f8f){return function(){PluginEvents['removeListener'](_0x9fed2a,_0x428f8f);};}exports[_0xefb8('0x4')]=function(_0x179da9){for(var _0x477e4a=0x0,_0x1d0b13=events[_0xefb8('0x5')];_0x477e4a<_0x1d0b13;_0x477e4a++){var _0x19b8d3=events[_0x477e4a];var _0x5226cd=createListener('plugin:'+_0x19b8d3,_0x179da9);PluginEvents['on'](_0x19b8d3,_0x5226cd);}}; \ No newline at end of file +var _0x5095=['update','emit','plugin:','save'];(function(_0x56f632,_0x3f7f44){var _0x47fd94=function(_0x5032fc){while(--_0x5032fc){_0x56f632['push'](_0x56f632['shift']());}};_0x47fd94(++_0x3f7f44);}(_0x5095,0x177));var _0x5509=function(_0xa570e,_0x5cc29e){_0xa570e=_0xa570e-0x0;var _0x88ecc0=_0x5095[_0xa570e];return _0x88ecc0;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x5509('0x0'),'remove',_0x5509('0x1')];function createListener(_0x141bec,_0x4804fb){return function(_0x5c336f){_0x4804fb[_0x5509('0x2')](_0x141bec,_0x5c336f);};}function removeListener(_0xbad753,_0x1c2e7c){return function(){PluginEvents['removeListener'](_0xbad753,_0x1c2e7c);};}exports['register']=function(_0x5f347a){for(var _0x54f86f=0x0,_0x18eb28=events['length'];_0x54f86f<_0x18eb28;_0x54f86f++){var _0x451ce6=events[_0x54f86f];var _0x39e304=createListener(_0x5509('0x3')+_0x451ce6,_0x5f347a);PluginEvents['on'](_0x451ce6,_0x39e304);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 22a7dd3..3fab7d0 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(_0x395a88,_0x2aa8ad){var _0x3b76ad=function(_0x12e83b){while(--_0x12e83b){_0x395a88['push'](_0x395a88['shift']());}};_0x3b76ad(++_0x2aa8ad);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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(_0x203032,_0x62538e){var _0x231f9b=function(_0x2490a){while(--_0x2490a){_0x203032['push'](_0x203032['shift']());}};_0x231f9b(++_0x62538e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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 87ab35c..ff8c44b 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 _0x1d2d=['reject','express','motion2','length','catch','show','describe','create','body','script','join','../../files/plugins','cwd','chdir','start','dump','Missing\x20name\x20and/or\x20path','update','stop','hasOwnProperty','params','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','exec','sendStatus','json','error','stack','name','status','send','npm\x20install','info','index','list','then'];(function(_0x329448,_0x263ee4){var _0x23d3fa=function(_0x1586ad){while(--_0x1586ad){_0x329448['push'](_0x329448['shift']());}};_0x23d3fa(++_0x263ee4);}(_0x1d2d,0xf0));var _0xd1d2=function(_0xb76d26,_0xf7e5be){_0xb76d26=_0xb76d26-0x0;var _0x4c3a49=_0x1d2d[_0xb76d26];return _0x4c3a49;};'use strict';var _=require(_0xd1d2('0x0'));var pm2=require(_0xd1d2('0x1'));var logger=require(_0xd1d2('0x2'))(_0xd1d2('0x3'));var path=require(_0xd1d2('0x4'));var exec=require('child_process')[_0xd1d2('0x5')];var BPromise=require('bluebird');function handleEntityNotFound(_0x5d3fac,_0x3caa72){return function(_0x2bfabc){if(!_0x2bfabc){_0x5d3fac[_0xd1d2('0x6')](0x194);;}return _0x2bfabc;};}function respondWithResult(_0x269613,_0x2f930d){_0x2f930d=_0x2f930d||0xc8;return function(_0x353dbd){if(_0x353dbd){return _0x269613['status'](_0x2f930d)[_0xd1d2('0x7')](_0x353dbd);}return null;};}function handleError(_0x21bc28,_0x35735f){_0x35735f=_0x35735f||0x1f4;return function(_0x37ff2a){logger[_0xd1d2('0x8')](_0x37ff2a[_0xd1d2('0x9')]);if(_0x37ff2a[_0xd1d2('0xa')]){delete _0x37ff2a[_0xd1d2('0xa')];}_0x21bc28[_0xd1d2('0xb')](_0x35735f)[_0xd1d2('0xc')](_0x37ff2a);};}function execChildProcess(){return new BPromise(function(_0x900ec,_0x227d7f){exec(_0xd1d2('0xd'),function(_0x5b21f4,_0x41fcb5,_0x1f49ed){logger[_0xd1d2('0xe')](_0x41fcb5);logger[_0xd1d2('0xe')](_0x1f49ed);if(_0x5b21f4){logger[_0xd1d2('0x8')](_0x5b21f4);return _0x227d7f(_0x5b21f4);}return _0x900ec(_0x41fcb5);});});}exports[_0xd1d2('0xf')]=function(_0x2df8a5,_0x31dc84){return pm2[_0xd1d2('0x10')]()[_0xd1d2('0x11')](function(_0x4cf702){if(_0x4cf702){var _0x2e7fec=_[_0xd1d2('0x12')](_0x4cf702,function(_0x3476f8){return _0x3476f8['name']===_0xd1d2('0x13')||_0x3476f8[_0xd1d2('0xa')]===_0xd1d2('0x14');});return{'rows':_0x2e7fec,'count':_0x2e7fec[_0xd1d2('0x15')]};}return null;})[_0xd1d2('0x11')](respondWithResult(_0x31dc84,null))[_0xd1d2('0x16')](handleError(_0x31dc84,null));};exports[_0xd1d2('0x17')]=function(_0x57f2f9,_0x539d5a){return pm2[_0xd1d2('0x18')](_0x57f2f9['params']['id'])[_0xd1d2('0x11')](respondWithResult(_0x539d5a,null))[_0xd1d2('0x11')](handleEntityNotFound(_0x539d5a,null))[_0xd1d2('0x16')](handleError(_0x539d5a,null));};exports[_0xd1d2('0x19')]=function(_0x4ab386,_0x4f1201){if(_0x4ab386[_0xd1d2('0x1a')]['name']&&_0x4ab386['body'][_0xd1d2('0x1b')]){var _0x27e26b=path[_0xd1d2('0x1c')](__dirname,_0xd1d2('0x1d'),_0x4ab386['body'][_0xd1d2('0x1b')]);var _0xbb4d27=process[_0xd1d2('0x1e')]();process['chdir'](path['dirname'](_0x27e26b));return execChildProcess()[_0xd1d2('0x11')](function(_0x3a1078){process[_0xd1d2('0x1f')](_0xbb4d27);return pm2[_0xd1d2('0x20')]({'name':_0x4ab386[_0xd1d2('0x1a')][_0xd1d2('0xa')],'script':_0x27e26b});})[_0xd1d2('0x11')](function(_0x5df4af){pm2[_0xd1d2('0x21')]();return _0x5df4af[0x0];})[_0xd1d2('0x11')](respondWithResult(_0x4f1201,0xc9))[_0xd1d2('0x16')](handleError(_0x4f1201,null));}else{return _0x4f1201[_0xd1d2('0xb')](0x1f4)[_0xd1d2('0xc')]({'message':_0xd1d2('0x22')});}};exports[_0xd1d2('0x23')]=function(_0x34faf7,_0xe6ef3c){if(_0x34faf7[_0xd1d2('0x1a')]['id']){delete _0x34faf7[_0xd1d2('0x1a')]['id'];}var _0x4e1bc2={'online':'restart','stopped':_0xd1d2('0x24')};if(_0x4e1bc2[_0xd1d2('0x25')](_0x34faf7[_0xd1d2('0x1a')][_0xd1d2('0xb')])){return pm2[_0x4e1bc2[_0x34faf7[_0xd1d2('0x1a')]['status']]](_0x34faf7[_0xd1d2('0x26')]['id'])[_0xd1d2('0x11')](respondWithResult(_0xe6ef3c,0xc8))[_0xd1d2('0x16')](handleError(_0xe6ef3c,null));}else{return _0xe6ef3c['status'](0x1f4)[_0xd1d2('0xc')]({'message':_0xd1d2('0x27')});}};exports[_0xd1d2('0x28')]=function(_0x56557d,_0x419db7){if(_0x56557d[_0xd1d2('0x1a')]['id']){delete _0x56557d[_0xd1d2('0x1a')]['id'];}if(_0x56557d[_0xd1d2('0x26')]['id']){return pm2[_0xd1d2('0x29')](_0x56557d[_0xd1d2('0x26')]['id'])[_0xd1d2('0x11')](function(_0x322f50){pm2[_0xd1d2('0x21')]();return _0x322f50[0x0];})[_0xd1d2('0x11')](respondWithResult(_0x419db7,null))[_0xd1d2('0x16')](handleError(_0x419db7,null));}else{return _0x419db7[_0xd1d2('0xb')](0x1f4)[_0xd1d2('0xc')]({'message':_0xd1d2('0x2a')});}}; \ No newline at end of file +var _0x4e81=['npm\x20install','info','index','then','express','length','catch','show','describe','params','create','body','script','join','cwd','chdir','start','dump','Missing\x20name\x20and/or\x20path','update','stop','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','exec','bluebird','sendStatus','status','json','error','stack','name','send'];(function(_0x3bddb1,_0x1306c7){var _0x977506=function(_0x77d9c1){while(--_0x77d9c1){_0x3bddb1['push'](_0x3bddb1['shift']());}};_0x977506(++_0x1306c7);}(_0x4e81,0x1bc));var _0x14e8=function(_0x1fdb40,_0x51351c){_0x1fdb40=_0x1fdb40-0x0;var _0x281f93=_0x4e81[_0x1fdb40];return _0x281f93;};'use strict';var _=require(_0x14e8('0x0'));var pm2=require(_0x14e8('0x1'));var logger=require(_0x14e8('0x2'))('api');var path=require('path');var exec=require('child_process')[_0x14e8('0x3')];var BPromise=require(_0x14e8('0x4'));function handleEntityNotFound(_0x224121,_0x436444){return function(_0x325325){if(!_0x325325){_0x224121[_0x14e8('0x5')](0x194);;}return _0x325325;};}function respondWithResult(_0x56a266,_0x57c79b){_0x57c79b=_0x57c79b||0xc8;return function(_0x3e73d2){if(_0x3e73d2){return _0x56a266[_0x14e8('0x6')](_0x57c79b)[_0x14e8('0x7')](_0x3e73d2);}return null;};}function handleError(_0x3c1b93,_0x11ec3b){_0x11ec3b=_0x11ec3b||0x1f4;return function(_0x20f053){logger[_0x14e8('0x8')](_0x20f053[_0x14e8('0x9')]);if(_0x20f053[_0x14e8('0xa')]){delete _0x20f053['name'];}_0x3c1b93[_0x14e8('0x6')](_0x11ec3b)[_0x14e8('0xb')](_0x20f053);};}function execChildProcess(){return new BPromise(function(_0x43bfcd,_0x2906b3){exec(_0x14e8('0xc'),function(_0x3ce648,_0x3bed91,_0x30df66){logger['info'](_0x3bed91);logger[_0x14e8('0xd')](_0x30df66);if(_0x3ce648){logger['error'](_0x3ce648);return _0x2906b3(_0x3ce648);}return _0x43bfcd(_0x3bed91);});});}exports[_0x14e8('0xe')]=function(_0x341d40,_0x32a01d){return pm2['list']()[_0x14e8('0xf')](function(_0x4e1064){if(_0x4e1064){var _0x458e4a=_['reject'](_0x4e1064,function(_0x347216){return _0x347216[_0x14e8('0xa')]===_0x14e8('0x10')||_0x347216[_0x14e8('0xa')]==='motion2';});return{'rows':_0x458e4a,'count':_0x458e4a[_0x14e8('0x11')]};}return null;})[_0x14e8('0xf')](respondWithResult(_0x32a01d,null))[_0x14e8('0x12')](handleError(_0x32a01d,null));};exports[_0x14e8('0x13')]=function(_0xd4d6b2,_0x1f1a0d){return pm2[_0x14e8('0x14')](_0xd4d6b2[_0x14e8('0x15')]['id'])['then'](respondWithResult(_0x1f1a0d,null))[_0x14e8('0xf')](handleEntityNotFound(_0x1f1a0d,null))[_0x14e8('0x12')](handleError(_0x1f1a0d,null));};exports[_0x14e8('0x16')]=function(_0x7b10f2,_0x246c5d){if(_0x7b10f2['body'][_0x14e8('0xa')]&&_0x7b10f2[_0x14e8('0x17')][_0x14e8('0x18')]){var _0x48e30a=path[_0x14e8('0x19')](__dirname,'../../files/plugins',_0x7b10f2[_0x14e8('0x17')][_0x14e8('0x18')]);var _0x3e8d5c=process[_0x14e8('0x1a')]();process[_0x14e8('0x1b')](path['dirname'](_0x48e30a));return execChildProcess()[_0x14e8('0xf')](function(_0x5b11f9){process[_0x14e8('0x1b')](_0x3e8d5c);return pm2[_0x14e8('0x1c')]({'name':_0x7b10f2['body']['name'],'script':_0x48e30a});})['then'](function(_0x4a758c){pm2[_0x14e8('0x1d')]();return _0x4a758c[0x0];})[_0x14e8('0xf')](respondWithResult(_0x246c5d,0xc9))[_0x14e8('0x12')](handleError(_0x246c5d,null));}else{return _0x246c5d[_0x14e8('0x6')](0x1f4)['send']({'message':_0x14e8('0x1e')});}};exports[_0x14e8('0x1f')]=function(_0x3c09cb,_0x2f5818){if(_0x3c09cb[_0x14e8('0x17')]['id']){delete _0x3c09cb[_0x14e8('0x17')]['id'];}var _0x2813ae={'online':'restart','stopped':_0x14e8('0x20')};if(_0x2813ae[_0x14e8('0x21')](_0x3c09cb[_0x14e8('0x17')]['status'])){return pm2[_0x2813ae[_0x3c09cb['body']['status']]](_0x3c09cb[_0x14e8('0x15')]['id'])[_0x14e8('0xf')](respondWithResult(_0x2f5818,0xc8))['catch'](handleError(_0x2f5818,null));}else{return _0x2f5818[_0x14e8('0x6')](0x1f4)[_0x14e8('0xb')]({'message':_0x14e8('0x22')});}};exports[_0x14e8('0x23')]=function(_0x5c2635,_0x1f1259){if(_0x5c2635[_0x14e8('0x17')]['id']){delete _0x5c2635[_0x14e8('0x17')]['id'];}if(_0x5c2635[_0x14e8('0x15')]['id']){return pm2[_0x14e8('0x24')](_0x5c2635['params']['id'])[_0x14e8('0xf')](function(_0x29ee7a){pm2[_0x14e8('0x1d')]();return _0x29ee7a[0x0];})[_0x14e8('0xf')](respondWithResult(_0x1f1259,null))['catch'](handleError(_0x1f1259,null));}else{return _0x1f1259[_0x14e8('0x6')](0x1f4)['send']({'message':_0x14e8('0x25')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index a44265c..d49a9bf 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 _0x1a55=['./realtime.controller','get','isAuthenticated','getAgents','/queues','getQueues','exports','Router','../../components/auth/service'];(function(_0x1d9bc1,_0x52f0a6){var _0x540128=function(_0x2e35ff){while(--_0x2e35ff){_0x1d9bc1['push'](_0x1d9bc1['shift']());}};_0x540128(++_0x52f0a6);}(_0x1a55,0x10c));var _0x51a5=function(_0x1333af,_0x424dbd){_0x1333af=_0x1333af-0x0;var _0x4d0e26=_0x1a55[_0x1333af];return _0x4d0e26;};'use strict';var express=require('express');var router=express[_0x51a5('0x0')]();var auth=require(_0x51a5('0x1'));var controller=require(_0x51a5('0x2'));router[_0x51a5('0x3')]('/agents',auth[_0x51a5('0x4')](),controller[_0x51a5('0x5')]);router['get'](_0x51a5('0x6'),auth['isAuthenticated'](),controller[_0x51a5('0x7')]);module[_0x51a5('0x8')]=router; \ No newline at end of file +var _0xaff9=['express','Router','./realtime.controller','get','/agents','isAuthenticated','/queues','getQueues'];(function(_0x1b6aa3,_0x98f05c){var _0x2322f2=function(_0x239a7c){while(--_0x239a7c){_0x1b6aa3['push'](_0x1b6aa3['shift']());}};_0x2322f2(++_0x98f05c);}(_0xaff9,0x70));var _0x9aff=function(_0x15b50e,_0x398bda){_0x15b50e=_0x15b50e-0x0;var _0x9e8ffe=_0xaff9[_0x15b50e];return _0x9e8ffe;};'use strict';var express=require(_0x9aff('0x0'));var router=express[_0x9aff('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x9aff('0x2'));router[_0x9aff('0x3')](_0x9aff('0x4'),auth[_0x9aff('0x5')](),controller['getAgents']);router[_0x9aff('0x3')](_0x9aff('0x6'),auth[_0x9aff('0x5')](),controller[_0x9aff('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 72633b8..34e56b1 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 _0xa9e8=['Status','sortAgentsByStatus','pick','resolve','isValidChannel','startCase','Queue','type','key','name','voice','outbound','dialActive','dialMethod','getOptions','QueueCampaigns','Queues','filter','findAndCountAll','initializeQueues','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','undefined','limit','count','offset','set','Content-Range','getChannels','globalQueueFilter','query','globalStatusFilter','pauseTypeFilter','pause','*pause','then','channel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','validateSortParameter','getUpdatedSortOptions','fields','order','getAgentIdsByQueues','getRealtimeAgents','rows','getAgentIdsByStatus','length','map','User','rawAttributes','role','agent','online','literal','forEach','push','Pause','user','userProfileId','Agents','extraQueryConditions','UserProfile','getResources','find','filterAgentAttributes','globalStatus','getAgentStatus'];(function(_0x59c85a,_0x4e28ba){var _0x5c1bac=function(_0x15416f){while(--_0x15416f){_0x59c85a['push'](_0x59c85a['shift']());}};_0x5c1bac(++_0x4e28ba);}(_0xa9e8,0xfe));var _0x8a9e=function(_0x4079e1,_0xeba708){_0x4079e1=_0x4079e1-0x0;var _0x14c475=_0xa9e8[_0x4079e1];return _0x14c475;};'use strict';var _=require(_0x8a9e('0x0'));var util=require(_0x8a9e('0x1'));var rta=require(_0x8a9e('0x2'));var rtq=require(_0x8a9e('0x3'));var qs=require(_0x8a9e('0x4'));var utils=require(_0x8a9e('0x5'));var db=require(_0x8a9e('0x6'))['db'];var APIBadRequestError=require(_0x8a9e('0x7'))[_0x8a9e('0x8')];var APIHandleError=require(_0x8a9e('0x7'))['handleError'];function respondWithFilteredResult(_0x298fd4,_0x4a2d89){return function(_0x412741){if(_0x412741){var _0x3627eb=typeof _0x4a2d89['offset']===_0x8a9e('0x9')&&typeof _0x4a2d89[_0x8a9e('0xa')]===_0x8a9e('0x9');var _0x1f6636=_0x412741[_0x8a9e('0xb')];var _0x1c8ae9=_0x3627eb?0x0:_0x4a2d89[_0x8a9e('0xc')];var _0x359e2b=_0x3627eb?_0x412741[_0x8a9e('0xb')]:_0x4a2d89['offset']+_0x4a2d89[_0x8a9e('0xa')];var _0x2d845b;if(_0x359e2b>=_0x1f6636){_0x359e2b=_0x1f6636;_0x2d845b=0xc8;}else{_0x2d845b=0xce;}_0x298fd4['status'](_0x2d845b);return _0x298fd4[_0x8a9e('0xd')](_0x8a9e('0xe'),_0x1c8ae9+'-'+_0x359e2b+'/'+_0x1f6636)['json'](_0x412741);}return null;};}exports['getAgents']=function(_0x5586f8,_0x93cbc4){var _0x16ebc2={'count':0x0,'rows':[]};var _0x15c513={};var _0x4f2386;var _0x4cf371=utils[_0x8a9e('0xf')]();var _0x12b7eb;var _0x284ccf;var _0x2aad4d=_0x5586f8['query'][_0x8a9e('0x10')];var _0x40211b=_0x5586f8[_0x8a9e('0x11')][_0x8a9e('0x12')];var _0x2c86ab=_0x5586f8['query'][_0x8a9e('0x13')];var _0xe3a0c5=_0x40211b===_0x8a9e('0x14')||_0x40211b===_0x8a9e('0x15')?!![]:![];var _0x20e67c=[];var _0x113f5c;var _0x34ded5;Promise['resolve']()[_0x8a9e('0x16')](function(){if(_0x5586f8[_0x8a9e('0x11')][_0x8a9e('0x17')]){if(!utils['isValidChannel'](_0x5586f8[_0x8a9e('0x11')][_0x8a9e('0x17')])){throw new APIBadRequestError(util[_0x8a9e('0x18')](_0x8a9e('0x19'),_0x5586f8[_0x8a9e('0x11')][_0x8a9e('0x17')]));}_0x4f2386=_0x5586f8[_0x8a9e('0x11')][_0x8a9e('0x17')][_0x8a9e('0x1a')]();}if(!_0x5586f8[_0x8a9e('0x11')][_0x8a9e('0x1b')]||!_0x5586f8[_0x8a9e('0x11')]['sort'][_0x8a9e('0x1c')]('globalStatus')){_0x5586f8[_0x8a9e('0x11')]['sort']=rta[_0x8a9e('0x1d')](_0x5586f8['query'][_0x8a9e('0x1b')]);return;}var _0xfade61=rta[_0x8a9e('0x1e')](_0x5586f8[_0x8a9e('0x11')]['sort']);_0x5586f8['query'][_0x8a9e('0x1b')]=_0xfade61[_0x8a9e('0x1f')]['join'](',');_0x113f5c=_0xfade61[_0x8a9e('0x20')];})['then'](function(){if(!_0x2aad4d){return[];}return rta[_0x8a9e('0x21')](_0x2aad4d,_0x4f2386);})['then'](function(_0x2db998){_0x20e67c=_0x2db998;return rta[_0x8a9e('0x22')]();})[_0x8a9e('0x16')](function(_0x1d3071){_0x284ccf=_0x1d3071[_0x8a9e('0x23')];if((!_0x40211b||_0xe3a0c5)&&!_0x113f5c){return _0x20e67c;}if(_0x113f5c&&!_0x40211b){return rta['getSortedAgentsIdsByStatus'](_0x284ccf,_0x20e67c,_0x113f5c);}else{return rta[_0x8a9e('0x24')](_0x284ccf,_0x20e67c,_0x40211b);}})['then'](function(_0x3dfa32){_0x20e67c=_0x3dfa32;var _0x2a55ab=![];if(_0x20e67c[_0x8a9e('0x25')]===0x0){if(_0x2aad4d||_0x40211b){_0x2a55ab=!![];}if(_0xe3a0c5){_0x2a55ab=![];}}if(_0x2a55ab){return _0x16ebc2;}var _0x49a526=_[_0x8a9e('0x26')](db[_0x8a9e('0x27')][_0x8a9e('0x28')],function(_0x4ece22){return{'name':_0x4ece22['fieldName'],'type':_0x4ece22['type']['key']};});_0x5586f8['query'][_0x8a9e('0x29')]=_0x8a9e('0x2a');_0x5586f8[_0x8a9e('0x11')][_0x8a9e('0x2b')]=!![];_0x15c513=qs['getOptions'](_0x49a526,_0x5586f8);_0x15c513['raw']=!![];var _0x217f90=[];if(_0x20e67c[_0x8a9e('0x25')]>0x0){_0x217f90['push']({'id':{'$in':_0x20e67c}});if(_0x113f5c&&!_0x40211b){_0x34ded5=[db['sequelize'][_0x8a9e('0x2c')]('FIELD(id,'+_0x20e67c+')')];_0x15c513[_0x8a9e('0x20')]=_0x34ded5;}}if(_0xe3a0c5){_0x4cf371[_0x8a9e('0x2d')](function(_0x5ec6fc){var _0xa20ae4=!![];if(_0x40211b==='*pause'&&_0x4f2386!==_0x5ec6fc){_0xa20ae4=![];}_0x217f90[_0x8a9e('0x2e')]({[_0x5ec6fc+_0x8a9e('0x2f')]:_0xa20ae4});});if(_0x2c86ab){_0x217f90['push']({'pauseType':_0x2c86ab});}}else if(_0x40211b){_0x4cf371[_0x8a9e('0x2d')](function(_0x3f6dda){_0x217f90['push']({[_0x3f6dda+_0x8a9e('0x2f')]:![]});});}_0x15c513['where']=_['merge'](_0x15c513['where'],{'$and':_0x217f90});if(_0x5586f8[_0x8a9e('0x30')][_0x8a9e('0x29')]===_0x8a9e('0x30')){var _0x4c764c={'params':{'id':_0x5586f8[_0x8a9e('0x30')][_0x8a9e('0x31')]},'query':{'section':_0x8a9e('0x32'),'role':'agent','online':!![],'raw':!![],'ids':_0x20e67c,'customSorting':_0x34ded5}};if(_0xe3a0c5){_0x4c764c['query'][_0x8a9e('0x33')]=_0x217f90;}_0x4c764c[_0x8a9e('0x11')]=Object['assign'](_0x4c764c[_0x8a9e('0x11')],_0x5586f8['query']);delete _0x4c764c['query']['id'];return db[_0x8a9e('0x34')][_0x8a9e('0x35')](_0x4c764c);}return db[_0x8a9e('0x27')]['findAndCountAll'](_0x15c513);})[_0x8a9e('0x16')](function(_0x4fc1dc){_0x16ebc2[_0x8a9e('0xb')]=_0x4fc1dc[_0x8a9e('0xb')];_0x12b7eb=_0x4fc1dc[_0x8a9e('0x23')];return _0x12b7eb[_0x8a9e('0x26')](function(_0x29bdc8){var _0x1762a6=_[_0x8a9e('0x36')](_0x284ccf,['id',_0x29bdc8['id']]);if(_0x1762a6){var _0x508426=rta[_0x8a9e('0x37')](_0x1762a6);_['merge'](_0x29bdc8,_0x508426);}_0x29bdc8[_0x8a9e('0x38')]=rta[_0x8a9e('0x39')](_0x29bdc8);if(_0x29bdc8['globalStatus'][_0x8a9e('0x1c')]('pause')){_0x4cf371[_0x8a9e('0x2d')](function(_0x25247){if(_0x29bdc8[_0x25247+_0x8a9e('0x2f')]){_0x29bdc8[_0x25247+_0x8a9e('0x3a')]=_0x8a9e('0x14');}});}return _0x29bdc8;});})[_0x8a9e('0x16')](function(_0x3abf81){if(!_0x113f5c||_0x34ded5){return _0x3abf81;}return rta[_0x8a9e('0x3b')](_0x3abf81,_0x113f5c);})[_0x8a9e('0x16')](function(_0x254049){var _0x5c1364=null;if(_0x5586f8['query'][_0x8a9e('0x1f')]){var _0x6da6f1=_0x5586f8[_0x8a9e('0x11')]['fields']['split'](',');_0x5c1364=_0x254049[_0x8a9e('0x26')](function(_0x2fad7f){return _[_0x8a9e('0x3c')](_0x2fad7f,_0x6da6f1);});}_0x16ebc2[_0x8a9e('0x23')]=_0x5c1364||_0x254049;return _0x16ebc2;})['then'](respondWithFilteredResult(_0x93cbc4,_0x15c513))['catch'](APIHandleError(_0x93cbc4));};exports['getQueues']=function(_0xb30e87,_0x2ddc0d){var _0xbe701f={'count':0x0,'rows':[]};var _0x56f0ee={};var _0x4e5186;var _0x4eb044;var _0x494f2e;Promise[_0x8a9e('0x3d')]()[_0x8a9e('0x16')](function(){if(_0xb30e87[_0x8a9e('0x11')][_0x8a9e('0x17')]){if(!utils[_0x8a9e('0x3e')](_0xb30e87[_0x8a9e('0x11')][_0x8a9e('0x17')])){throw new APIBadRequestError(util[_0x8a9e('0x18')](_0x8a9e('0x19'),_0xb30e87[_0x8a9e('0x11')]['channel']));}_0x4e5186=_0xb30e87['query'][_0x8a9e('0x17')][_0x8a9e('0x1a')]();}var _0x3d36b2=_[_0x8a9e('0x3f')](_0x4e5186)+_0x8a9e('0x40');var _0x1e4fb5=_[_0x8a9e('0x26')](db[_0x3d36b2][_0x8a9e('0x28')],function(_0xd36619){return{'name':_0xd36619['fieldName'],'type':_0xd36619[_0x8a9e('0x41')][_0x8a9e('0x42')]};});if(!_0xb30e87[_0x8a9e('0x11')]['fields']){var _0x1c80f8=['id',_0x8a9e('0x43')];if(_0x4e5186===_0x8a9e('0x44')){_0x1c80f8['push'](_0x8a9e('0x41'));if(_0xb30e87[_0x8a9e('0x11')]['type']===_0x8a9e('0x45')){_0x1c80f8[_0x8a9e('0x2e')]([_0x8a9e('0x46'),_0x8a9e('0x47')]);}}_0xb30e87['query'][_0x8a9e('0x1f')]=_0x1c80f8['join'](',');}_0x56f0ee=qs[_0x8a9e('0x48')](_0x1e4fb5,_0xb30e87);if(_0xb30e87[_0x8a9e('0x30')][_0x8a9e('0x29')]===_0x8a9e('0x30')){var _0x2eab0e={'params':{'id':_0xb30e87[_0x8a9e('0x30')][_0x8a9e('0x31')]},'query':{'section':_0x4e5186===_0x8a9e('0x44')&&_0xb30e87[_0x8a9e('0x11')][_0x8a9e('0x41')]===_0x8a9e('0x45')?_0x8a9e('0x49'):_[_0x8a9e('0x3f')](_0x4e5186)+_0x8a9e('0x4a'),'type':_0xb30e87['query'][_0x8a9e('0x41')],'nolimit':!![],'sort':_0x8a9e('0x43'),'filter':_0xb30e87[_0x8a9e('0x11')][_0x8a9e('0x4b')]}};return db[_0x8a9e('0x34')]['getResources'](_0x2eab0e);}return db[_0x3d36b2][_0x8a9e('0x4c')](_0x56f0ee);})[_0x8a9e('0x16')](function(_0x4bd27d){_0xbe701f[_0x8a9e('0xb')]=_0x4bd27d[_0x8a9e('0xb')];_0x4eb044=_0x4bd27d[_0x8a9e('0x23')];return rtq['getRealtimeQueues'](_0xb30e87,_0x4e5186);})['then'](function(_0x1890e6){_0x494f2e=_0x1890e6[_0x8a9e('0x23')];return rtq[_0x8a9e('0x4d')](_0x4eb044,_0x494f2e,_0x4e5186,_0xb30e87[_0x8a9e('0x11')][_0x8a9e('0x41')]);})[_0x8a9e('0x16')](function(_0x3c5aaa){_0xbe701f[_0x8a9e('0x23')]=_0x3c5aaa;return _0xbe701f;})[_0x8a9e('0x16')](respondWithFilteredResult(_0x2ddc0d,_0x56f0ee))['catch'](APIHandleError(_0x2ddc0d));}; \ No newline at end of file +var _0x15f3=['pause','*pause','resolve','then','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','validateSortParameter','fields','join','order','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','length','User','rawAttributes','type','key','role','agent','getOptions','raw','push','sequelize','literal','FIELD(id,','forEach','Pause','where','merge','user','Agents','assign','UserProfile','getResources','findAndCountAll','map','filterAgentAttributes','globalStatus','getAgentStatus','Status','sortAgentsByStatus','split','pick','getQueues','startCase','Queue','fieldName','voice','dialActive','dialMethod','userProfileId','outbound','Queues','name','filter','getRealtimeQueues','initializeQueues','catch','lodash','util','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','handleError','offset','undefined','count','status','set','json','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter'];(function(_0x12ce7b,_0x2daaee){var _0x4ee1b1=function(_0x398ac9){while(--_0x398ac9){_0x12ce7b['push'](_0x12ce7b['shift']());}};_0x4ee1b1(++_0x2daaee);}(_0x15f3,0x194));var _0x315f=function(_0xe47e10,_0x573228){_0xe47e10=_0xe47e10-0x0;var _0x683939=_0x15f3[_0xe47e10];return _0x683939;};'use strict';var _=require(_0x315f('0x0'));var util=require(_0x315f('0x1'));var rta=require('../../components/realtime/agents');var rtq=require(_0x315f('0x2'));var qs=require(_0x315f('0x3'));var utils=require(_0x315f('0x4'));var db=require(_0x315f('0x5'))['db'];var APIBadRequestError=require(_0x315f('0x6'))[_0x315f('0x7')];var APIHandleError=require('../../errors/api')[_0x315f('0x8')];function respondWithFilteredResult(_0x231dee,_0x3e4d8a){return function(_0xcd088a){if(_0xcd088a){var _0x445dd3=typeof _0x3e4d8a[_0x315f('0x9')]==='undefined'&&typeof _0x3e4d8a['limit']===_0x315f('0xa');var _0xf503ae=_0xcd088a[_0x315f('0xb')];var _0x3ce5b0=_0x445dd3?0x0:_0x3e4d8a[_0x315f('0x9')];var _0x1e37b0=_0x445dd3?_0xcd088a[_0x315f('0xb')]:_0x3e4d8a['offset']+_0x3e4d8a['limit'];var _0x1a8c65;if(_0x1e37b0>=_0xf503ae){_0x1e37b0=_0xf503ae;_0x1a8c65=0xc8;}else{_0x1a8c65=0xce;}_0x231dee[_0x315f('0xc')](_0x1a8c65);return _0x231dee[_0x315f('0xd')]('Content-Range',_0x3ce5b0+'-'+_0x1e37b0+'/'+_0xf503ae)[_0x315f('0xe')](_0xcd088a);}return null;};}exports[_0x315f('0xf')]=function(_0x58d3d7,_0x1c3f61){var _0x150bd7={'count':0x0,'rows':[]};var _0x4c1093={};var _0x58b2e9;var _0x39fb58=utils[_0x315f('0x10')]();var _0x480e27;var _0x51ae51;var _0x4502bd=_0x58d3d7[_0x315f('0x11')][_0x315f('0x12')];var _0x3a344e=_0x58d3d7[_0x315f('0x11')][_0x315f('0x13')];var _0x1b9d5a=_0x58d3d7[_0x315f('0x11')][_0x315f('0x14')];var _0x3a4317=_0x3a344e===_0x315f('0x15')||_0x3a344e===_0x315f('0x16')?!![]:![];var _0x515d5f=[];var _0x5c5edd;var _0x56cdb5;Promise[_0x315f('0x17')]()[_0x315f('0x18')](function(){if(_0x58d3d7[_0x315f('0x11')][_0x315f('0x19')]){if(!utils[_0x315f('0x1a')](_0x58d3d7['query'][_0x315f('0x19')])){throw new APIBadRequestError(util['format'](_0x315f('0x1b'),_0x58d3d7[_0x315f('0x11')][_0x315f('0x19')]));}_0x58b2e9=_0x58d3d7[_0x315f('0x11')][_0x315f('0x19')][_0x315f('0x1c')]();}if(!_0x58d3d7[_0x315f('0x11')][_0x315f('0x1d')]||!_0x58d3d7[_0x315f('0x11')]['sort'][_0x315f('0x1e')]('globalStatus')){_0x58d3d7['query'][_0x315f('0x1d')]=rta[_0x315f('0x1f')](_0x58d3d7['query'][_0x315f('0x1d')]);return;}var _0x36ea9a=rta['getUpdatedSortOptions'](_0x58d3d7['query']['sort']);_0x58d3d7[_0x315f('0x11')]['sort']=_0x36ea9a[_0x315f('0x20')][_0x315f('0x21')](',');_0x5c5edd=_0x36ea9a[_0x315f('0x22')];})[_0x315f('0x18')](function(){if(!_0x4502bd){return[];}return rta[_0x315f('0x23')](_0x4502bd,_0x58b2e9);})['then'](function(_0x2a8c54){_0x515d5f=_0x2a8c54;return rta[_0x315f('0x24')]();})[_0x315f('0x18')](function(_0x3ebcf4){_0x51ae51=_0x3ebcf4[_0x315f('0x25')];if((!_0x3a344e||_0x3a4317)&&!_0x5c5edd){return _0x515d5f;}if(_0x5c5edd&&!_0x3a344e){return rta[_0x315f('0x26')](_0x51ae51,_0x515d5f,_0x5c5edd);}else{return rta['getAgentIdsByStatus'](_0x51ae51,_0x515d5f,_0x3a344e);}})['then'](function(_0x15ec0f){_0x515d5f=_0x15ec0f;var _0x3f7755=![];if(_0x515d5f[_0x315f('0x27')]===0x0){if(_0x4502bd||_0x3a344e){_0x3f7755=!![];}if(_0x3a4317){_0x3f7755=![];}}if(_0x3f7755){return _0x150bd7;}var _0x4a13ff=_['map'](db[_0x315f('0x28')][_0x315f('0x29')],function(_0x529b0b){return{'name':_0x529b0b['fieldName'],'type':_0x529b0b[_0x315f('0x2a')][_0x315f('0x2b')]};});_0x58d3d7[_0x315f('0x11')][_0x315f('0x2c')]=_0x315f('0x2d');_0x58d3d7['query']['online']=!![];_0x4c1093=qs[_0x315f('0x2e')](_0x4a13ff,_0x58d3d7);_0x4c1093[_0x315f('0x2f')]=!![];var _0x2763b1=[];if(_0x515d5f[_0x315f('0x27')]>0x0){_0x2763b1[_0x315f('0x30')]({'id':{'$in':_0x515d5f}});if(_0x5c5edd&&!_0x3a344e){_0x56cdb5=[db[_0x315f('0x31')][_0x315f('0x32')](_0x315f('0x33')+_0x515d5f+')')];_0x4c1093[_0x315f('0x22')]=_0x56cdb5;}}if(_0x3a4317){_0x39fb58['forEach'](function(_0x2274ad){var _0x592f2c=!![];if(_0x3a344e==='*pause'&&_0x58b2e9!==_0x2274ad){_0x592f2c=![];}_0x2763b1[_0x315f('0x30')]({[_0x2274ad+'Pause']:_0x592f2c});});if(_0x1b9d5a){_0x2763b1[_0x315f('0x30')]({'pauseType':_0x1b9d5a});}}else if(_0x3a344e){_0x39fb58[_0x315f('0x34')](function(_0x4d3970){_0x2763b1[_0x315f('0x30')]({[_0x4d3970+_0x315f('0x35')]:![]});});}_0x4c1093[_0x315f('0x36')]=_[_0x315f('0x37')](_0x4c1093[_0x315f('0x36')],{'$and':_0x2763b1});if(_0x58d3d7[_0x315f('0x38')][_0x315f('0x2c')]===_0x315f('0x38')){var _0x822cd5={'params':{'id':_0x58d3d7[_0x315f('0x38')]['userProfileId']},'query':{'section':_0x315f('0x39'),'role':_0x315f('0x2d'),'online':!![],'raw':!![],'ids':_0x515d5f,'customSorting':_0x56cdb5}};if(_0x3a4317){_0x822cd5[_0x315f('0x11')]['extraQueryConditions']=_0x2763b1;}_0x822cd5[_0x315f('0x11')]=Object[_0x315f('0x3a')](_0x822cd5[_0x315f('0x11')],_0x58d3d7[_0x315f('0x11')]);delete _0x822cd5[_0x315f('0x11')]['id'];return db[_0x315f('0x3b')][_0x315f('0x3c')](_0x822cd5);}return db['User'][_0x315f('0x3d')](_0x4c1093);})[_0x315f('0x18')](function(_0x44303a){_0x150bd7['count']=_0x44303a[_0x315f('0xb')];_0x480e27=_0x44303a[_0x315f('0x25')];return _0x480e27[_0x315f('0x3e')](function(_0x556756){var _0x59fa78=_['find'](_0x51ae51,['id',_0x556756['id']]);if(_0x59fa78){var _0x354411=rta[_0x315f('0x3f')](_0x59fa78);_[_0x315f('0x37')](_0x556756,_0x354411);}_0x556756[_0x315f('0x40')]=rta[_0x315f('0x41')](_0x556756);if(_0x556756['globalStatus'][_0x315f('0x1e')](_0x315f('0x15'))){_0x39fb58['forEach'](function(_0x3ae9a1){if(_0x556756[_0x3ae9a1+'Pause']){_0x556756[_0x3ae9a1+_0x315f('0x42')]='pause';}});}return _0x556756;});})[_0x315f('0x18')](function(_0x26c52b){if(!_0x5c5edd||_0x56cdb5){return _0x26c52b;}return rta[_0x315f('0x43')](_0x26c52b,_0x5c5edd);})[_0x315f('0x18')](function(_0x538a0d){var _0x447854=null;if(_0x58d3d7[_0x315f('0x11')][_0x315f('0x20')]){var _0x2aa59e=_0x58d3d7['query'][_0x315f('0x20')][_0x315f('0x44')](',');_0x447854=_0x538a0d[_0x315f('0x3e')](function(_0x51b1f1){return _[_0x315f('0x45')](_0x51b1f1,_0x2aa59e);});}_0x150bd7[_0x315f('0x25')]=_0x447854||_0x538a0d;return _0x150bd7;})['then'](respondWithFilteredResult(_0x1c3f61,_0x4c1093))['catch'](APIHandleError(_0x1c3f61));};exports[_0x315f('0x46')]=function(_0x39a29c,_0x1572c9){var _0x12101b={'count':0x0,'rows':[]};var _0x2201ec={};var _0x502f41;var _0x5a9da5;var _0x530414;Promise[_0x315f('0x17')]()[_0x315f('0x18')](function(){if(_0x39a29c['query'][_0x315f('0x19')]){if(!utils[_0x315f('0x1a')](_0x39a29c[_0x315f('0x11')][_0x315f('0x19')])){throw new APIBadRequestError(util['format']('Channel\x20parameter\x20%s\x20is\x20invalid',_0x39a29c[_0x315f('0x11')]['channel']));}_0x502f41=_0x39a29c[_0x315f('0x11')][_0x315f('0x19')][_0x315f('0x1c')]();}var _0x475289=_[_0x315f('0x47')](_0x502f41)+_0x315f('0x48');var _0x3676eb=_['map'](db[_0x475289]['rawAttributes'],function(_0x1a5a97){return{'name':_0x1a5a97[_0x315f('0x49')],'type':_0x1a5a97['type'][_0x315f('0x2b')]};});if(!_0x39a29c[_0x315f('0x11')][_0x315f('0x20')]){var _0x88a4c6=['id','name'];if(_0x502f41===_0x315f('0x4a')){_0x88a4c6['push'](_0x315f('0x2a'));if(_0x39a29c[_0x315f('0x11')][_0x315f('0x2a')]==='outbound'){_0x88a4c6[_0x315f('0x30')]([_0x315f('0x4b'),_0x315f('0x4c')]);}}_0x39a29c[_0x315f('0x11')][_0x315f('0x20')]=_0x88a4c6[_0x315f('0x21')](',');}_0x2201ec=qs[_0x315f('0x2e')](_0x3676eb,_0x39a29c);if(_0x39a29c[_0x315f('0x38')][_0x315f('0x2c')]==='user'){var _0x481b4a={'params':{'id':_0x39a29c[_0x315f('0x38')][_0x315f('0x4d')]},'query':{'section':_0x502f41===_0x315f('0x4a')&&_0x39a29c[_0x315f('0x11')][_0x315f('0x2a')]===_0x315f('0x4e')?'QueueCampaigns':_[_0x315f('0x47')](_0x502f41)+_0x315f('0x4f'),'type':_0x39a29c[_0x315f('0x11')][_0x315f('0x2a')],'nolimit':!![],'sort':_0x315f('0x50'),'filter':_0x39a29c[_0x315f('0x11')][_0x315f('0x51')]}};return db['UserProfile']['getResources'](_0x481b4a);}return db[_0x475289][_0x315f('0x3d')](_0x2201ec);})['then'](function(_0xac33c9){_0x12101b[_0x315f('0xb')]=_0xac33c9[_0x315f('0xb')];_0x5a9da5=_0xac33c9[_0x315f('0x25')];return rtq[_0x315f('0x52')](_0x39a29c,_0x502f41);})[_0x315f('0x18')](function(_0x310ef6){_0x530414=_0x310ef6[_0x315f('0x25')];return rtq[_0x315f('0x53')](_0x5a9da5,_0x530414,_0x502f41,_0x39a29c[_0x315f('0x11')][_0x315f('0x2a')]);})[_0x315f('0x18')](function(_0x593a70){_0x12101b[_0x315f('0x25')]=_0x593a70;return _0x12101b;})[_0x315f('0x18')](respondWithFilteredResult(_0x1572c9,_0x2201ec))[_0x315f('0x54')](APIHandleError(_0x1572c9));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 9c48d22..77552c5 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(_0x24eab8,_0x2f471c){var _0x41d883=function(_0x542122){while(--_0x542122){_0x24eab8['push'](_0x24eab8['shift']());}};_0x41d883(++_0x2f471c);}(_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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x73265d,_0xb7bad2){var _0x1b1879=function(_0x5e9975){while(--_0x5e9975){_0x73265d['push'](_0x73265d['shift']());}};_0x1b1879(++_0xb7bad2);}(_0xedd9,0xfc));var _0x9edd=function(_0x1eb775,_0x2df8c9){_0x1eb775=_0x1eb775-0x0;var _0x5e0dd8=_0xedd9[_0x1eb775];return _0x5e0dd8;};'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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 60bb3e3..93709c5 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 _0x277c=['INTEGER','STRING','DATE','sequelize'];(function(_0x50f6e5,_0x151ccb){var _0x5988c5=function(_0x490a93){while(--_0x490a93){_0x50f6e5['push'](_0x50f6e5['shift']());}};_0x5988c5(++_0x151ccb);}(_0x277c,0x153));var _0xc277=function(_0x1ab08b,_0xa8f367){_0x1ab08b=_0x1ab08b-0x0;var _0x1b12df=_0x277c[_0x1ab08b];return _0x1b12df;};'use strict';var Sequelize=require(_0xc277('0x0'));module['exports']={'state':{'type':Sequelize[_0xc277('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xc277('0x2')]},'scheduledat':{'type':Sequelize[_0xc277('0x3')]},'uniqueid':{'type':Sequelize[_0xc277('0x2')]},'starttime':{'type':Sequelize[_0xc277('0x3')]},'responsetime':{'type':Sequelize[_0xc277('0x3')]},'ringtime':{'type':Sequelize[_0xc277('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xc277('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xee4a=['STRING','DATE','sequelize','INTEGER'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xee4a,0x9e));var _0xaee4=function(_0x49544f,_0x591c82){_0x49544f=_0x49544f-0x0;var _0x35448f=_0xee4a[_0x49544f];return _0x35448f;};'use strict';var Sequelize=require(_0xaee4('0x0'));module['exports']={'state':{'type':Sequelize[_0xaee4('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xaee4('0x2')]},'scheduledat':{'type':Sequelize[_0xaee4('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xaee4('0x3')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xaee4('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xaee4('0x2')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 661d0cc..88f01f5 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 _0xf799=['define','ReportAgentPreview','report_agent_preview','../../config/logger','api','bluebird','request-promise','../../config/environment','./reportAgentPreview.attributes','exports'];(function(_0x4b8596,_0x265231){var _0xe41f07=function(_0x2161eb){while(--_0x2161eb){_0x4b8596['push'](_0x4b8596['shift']());}};_0xe41f07(++_0x265231);}(_0xf799,0x19d));var _0x9f79=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xf799[_0x5a776b];return _0xbbef59;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9f79('0x0'))(_0x9f79('0x1'));var moment=require('moment');var BPromise=require(_0x9f79('0x2'));var rp=require(_0x9f79('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9f79('0x4'));var attributes=require(_0x9f79('0x5'));module[_0x9f79('0x6')]=function(_0x1a6669,_0x2acd80){return _0x1a6669[_0x9f79('0x7')](_0x9f79('0x8'),attributes,{'tableName':_0x9f79('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xccac=['rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','api','path'];(function(_0x3da612,_0x332456){var _0x1a9d1d=function(_0x5ca0d0){while(--_0x5ca0d0){_0x3da612['push'](_0x3da612['shift']());}};_0x1a9d1d(++_0x332456);}(_0xccac,0x75));var _0xccca=function(_0x5bd4f6,_0xf4e45c){_0x5bd4f6=_0x5bd4f6-0x0;var _0x33a165=_0xccac[_0x5bd4f6];return _0x33a165;};'use strict';var _=require(_0xccca('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xccca('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xccca('0x2'));var rimraf=require(_0xccca('0x3'));var config=require(_0xccca('0x4'));var attributes=require(_0xccca('0x5'));module[_0xccca('0x6')]=function(_0x2c4f4f,_0x4e9baf){return _0x2c4f4f[_0xccca('0x7')](_0xccca('0x8'),attributes,{'tableName':_0xccca('0x9'),'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 cf12780..4349cdc 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 _0x71a9=['randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','http','request','info','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','create','body','options','raw','then','CreateReportAgentPreview','catch','lodash','moment','bluebird'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x71a9,0x192));var _0x971a=function(_0x69657f,_0x27a78e){_0x69657f=_0x69657f-0x0;var _0x376a79=_0x71a9[_0x69657f];return _0x376a79;};'use strict';var _=require(_0x971a('0x0'));var util=require('util');var moment=require(_0x971a('0x1'));var BPromise=require(_0x971a('0x2'));var rs=require(_0x971a('0x3'));var fs=require('fs');var Redis=require(_0x971a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x971a('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x971a('0x6'));var jayson=require(_0x971a('0x7'));var client=jayson['client'][_0x971a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x36285a,_0x4f9136,_0xcbd510){return new BPromise(function(_0x3dc52d,_0x371b00){return client[_0x971a('0x9')](_0x36285a,_0xcbd510)['then'](function(_0x12edc7){logger[_0x971a('0xa')](_0x971a('0xb'),_0x4f9136,'request\x20sent');logger[_0x971a('0xc')](_0x971a('0xd'),_0x4f9136,_0x971a('0xe'),JSON[_0x971a('0xf')](_0x12edc7));if(_0x12edc7[_0x971a('0x10')]){if(_0x12edc7[_0x971a('0x10')][_0x971a('0x11')]===0x1f4){logger[_0x971a('0x10')](_0x971a('0xb'),_0x4f9136,_0x12edc7['error'][_0x971a('0x12')]);return _0x371b00(_0x12edc7[_0x971a('0x10')][_0x971a('0x12')]);}logger['error'](_0x971a('0xb'),_0x4f9136,_0x12edc7[_0x971a('0x10')]['message']);return _0x3dc52d(_0x12edc7['error'][_0x971a('0x12')]);}else{logger[_0x971a('0xa')](_0x971a('0xb'),_0x4f9136,'request\x20sent');_0x3dc52d(_0x12edc7[_0x971a('0x13')][_0x971a('0x12')]);}})['catch'](function(_0x5cfdea){logger[_0x971a('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x4f9136,_0x5cfdea);_0x371b00(_0x5cfdea);});});}exports['CreateReportAgentPreview']=function(_0x453342){var _0x4f0ae2=this;return new Promise(function(_0x3a7c40,_0x43108b){return db['ReportAgentPreview'][_0x971a('0x14')](_0x453342[_0x971a('0x15')],{'raw':_0x453342[_0x971a('0x16')]?_0x453342[_0x971a('0x16')][_0x971a('0x17')]===undefined?!![]:![]:!![]})[_0x971a('0x18')](function(_0x46c868){logger['info'](_0x971a('0x19'),_0x453342);logger[_0x971a('0xc')](_0x971a('0x19'),_0x453342,JSON['stringify'](_0x46c868));_0x3a7c40(_0x46c868);})[_0x971a('0x1a')](function(_0xa60f54){logger[_0x971a('0x10')](_0x971a('0x19'),_0xa60f54[_0x971a('0x12')],_0x453342);_0x43108b(_0x4f0ae2[_0x971a('0x10')](0x1f4,_0xa60f54[_0x971a('0x12')]));});});}; \ No newline at end of file +var _0xe48f=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateReportAgentPreview','ReportAgentPreview','body','options','moment'];(function(_0x3848da,_0x32f1a3){var _0x3573ce=function(_0x15ecd9){while(--_0x15ecd9){_0x3848da['push'](_0x3848da['shift']());}};_0x3573ce(++_0x32f1a3);}(_0xe48f,0x1ca));var _0xfe48=function(_0x15e17c,_0x39f6c8){_0x15e17c=_0x15e17c-0x0;var _0x55d8c7=_0xe48f[_0x15e17c];return _0x55d8c7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfe48('0x0'));var BPromise=require(_0xfe48('0x1'));var rs=require(_0xfe48('0x2'));var fs=require('fs');var Redis=require(_0xfe48('0x3'));var db=require(_0xfe48('0x4'))['db'];var utils=require(_0xfe48('0x5'));var logger=require(_0xfe48('0x6'))(_0xfe48('0x7'));var config=require(_0xfe48('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xfe48('0x9')][_0xfe48('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x129447,_0x2928e0,_0x88c426){return new BPromise(function(_0x1d717b,_0x227e60){return client[_0xfe48('0xb')](_0x129447,_0x88c426)[_0xfe48('0xc')](function(_0x58a784){logger['info'](_0xfe48('0xd'),_0x2928e0,_0xfe48('0xe'));logger[_0xfe48('0xf')](_0xfe48('0x10'),_0x2928e0,_0xfe48('0xe'),JSON[_0xfe48('0x11')](_0x58a784));if(_0x58a784[_0xfe48('0x12')]){if(_0x58a784[_0xfe48('0x12')][_0xfe48('0x13')]===0x1f4){logger[_0xfe48('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0x2928e0,_0x58a784['error']['message']);return _0x227e60(_0x58a784['error'][_0xfe48('0x14')]);}logger[_0xfe48('0x12')](_0xfe48('0xd'),_0x2928e0,_0x58a784[_0xfe48('0x12')][_0xfe48('0x14')]);return _0x1d717b(_0x58a784[_0xfe48('0x12')][_0xfe48('0x14')]);}else{logger[_0xfe48('0x15')](_0xfe48('0xd'),_0x2928e0,'request\x20sent');_0x1d717b(_0x58a784['result'][_0xfe48('0x14')]);}})[_0xfe48('0x16')](function(_0x174fb2){logger[_0xfe48('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0x2928e0,_0x174fb2);_0x227e60(_0x174fb2);});});}exports[_0xfe48('0x17')]=function(_0x204a4e){var _0x196f3e=this;return new Promise(function(_0x4fab29,_0x508fce){return db[_0xfe48('0x18')]['create'](_0x204a4e[_0xfe48('0x19')],{'raw':_0x204a4e[_0xfe48('0x1a')]?_0x204a4e[_0xfe48('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x560302){logger[_0xfe48('0x15')](_0xfe48('0x17'),_0x204a4e);logger[_0xfe48('0xf')](_0xfe48('0x17'),_0x204a4e,JSON[_0xfe48('0x11')](_0x560302));_0x4fab29(_0x560302);})[_0xfe48('0x16')](function(_0x2b1a21){logger[_0xfe48('0x12')]('CreateReportAgentPreview',_0x2b1a21[_0xfe48('0x14')],_0x204a4e);_0x508fce(_0x196f3e[_0xfe48('0x12')](0x1f4,_0x2b1a21[_0xfe48('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index d702b8e..c41e865 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 _0x576d=['/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','agentCapacity','/telephones','telephones','/trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','queueNotify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/whatsapp/queues/:id/notify','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','express','Router','./rpc.controller','get','/voice/channels','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues'];(function(_0x53f531,_0x202e60){var _0x312f00=function(_0x2a9014){while(--_0x2a9014){_0x53f531['push'](_0x53f531['shift']());}};_0x312f00(++_0x202e60);}(_0x576d,0xdb));var _0xd576=function(_0x427bb6,_0x2283b8){_0x427bb6=_0x427bb6-0x0;var _0x331897=_0x576d[_0x427bb6];return _0x331897;};'use strict';var multer=require(_0xd576('0x0'));var util=require(_0xd576('0x1'));var path=require('path');var express=require(_0xd576('0x2'));var router=express[_0xd576('0x3')]();var auth=require('../../components/auth/service');var controller=require(_0xd576('0x4'));router[_0xd576('0x5')](_0xd576('0x6'),auth[_0xd576('0x7')](),controller['voiceChannels']);router[_0xd576('0x5')](_0xd576('0x8'),auth[_0xd576('0x7')](),controller[_0xd576('0x9')]);router[_0xd576('0x5')](_0xd576('0xa'),auth[_0xd576('0x7')](),controller['voiceChannelStopMixMonitor']);router[_0xd576('0x5')](_0xd576('0xb'),auth[_0xd576('0x7')](),controller[_0xd576('0xc')]);router[_0xd576('0x5')](_0xd576('0xd'),auth[_0xd576('0x7')](),controller[_0xd576('0xe')]);router[_0xd576('0x5')](_0xd576('0xf'),auth[_0xd576('0x7')](),controller[_0xd576('0x10')]);router[_0xd576('0x5')](_0xd576('0x11'),auth['isAuthenticated'](),controller[_0xd576('0x12')]);router[_0xd576('0x5')](_0xd576('0x13'),auth[_0xd576('0x7')](),controller['openchannelQueues']);router[_0xd576('0x5')](_0xd576('0x14'),auth[_0xd576('0x7')](),controller[_0xd576('0x15')]);router[_0xd576('0x5')](_0xd576('0x16'),auth['isAuthenticated'](),controller[_0xd576('0x17')]);router[_0xd576('0x5')](_0xd576('0x18'),auth[_0xd576('0x7')](),controller[_0xd576('0x19')]);router['get'](_0xd576('0x1a'),auth[_0xd576('0x7')](),controller[_0xd576('0x1b')]);router[_0xd576('0x5')]('/voice/queues/channels',auth[_0xd576('0x7')](),controller[_0xd576('0x1c')]);router[_0xd576('0x5')]('/voice/queues/channels/:uniqueid',auth['isAuthenticated'](),controller[_0xd576('0x1d')]);router[_0xd576('0x5')]('/voice/queues/channels/:uniqueid/hangup',auth[_0xd576('0x7')](),controller[_0xd576('0x1e')]);router[_0xd576('0x5')](_0xd576('0x1f'),auth['isAuthenticated'](),controller[_0xd576('0x20')]);router[_0xd576('0x5')](_0xd576('0x21'),auth[_0xd576('0x7')](),controller['showVoiceQueues']);router[_0xd576('0x22')]('/voice/queues/:id',auth['isAuthenticated'](),controller[_0xd576('0x23')]);router[_0xd576('0x5')](_0xd576('0x24'),auth['isAuthenticated'](),controller[_0xd576('0x25')]);router['get'](_0xd576('0x26'),auth[_0xd576('0x7')](),controller[_0xd576('0x27')]);router[_0xd576('0x5')](_0xd576('0x28'),auth[_0xd576('0x7')](),controller[_0xd576('0x29')]);router[_0xd576('0x22')]('/agents/:id/capacity',auth['isAuthenticated'](),controller[_0xd576('0x2a')]);router[_0xd576('0x5')](_0xd576('0x2b'),auth[_0xd576('0x7')](),controller[_0xd576('0x2c')]);router['get'](_0xd576('0x2d'),auth['isAuthenticated'](),controller['trunks']);router[_0xd576('0x5')](_0xd576('0x2e'),auth[_0xd576('0x7')](),controller[_0xd576('0x2f')]);router[_0xd576('0x5')](_0xd576('0x30'),auth['isAuthenticated'](),controller[_0xd576('0x31')]);router[_0xd576('0x5')](_0xd576('0x32'),auth[_0xd576('0x7')](),controller['chatQueuesWaitingInteractions']);router[_0xd576('0x5')]('/mail/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xd576('0x33')]);router[_0xd576('0x5')](_0xd576('0x34'),auth[_0xd576('0x7')](),controller[_0xd576('0x35')]);router[_0xd576('0x5')](_0xd576('0x36'),auth[_0xd576('0x7')](),controller[_0xd576('0x37')]);router['get'](_0xd576('0x38'),auth[_0xd576('0x7')](),controller['smsQueuesWaitingInteractions']);router[_0xd576('0x5')](_0xd576('0x39'),auth[_0xd576('0x7')](),controller[_0xd576('0x3a')]);router['get'](_0xd576('0x3b'),auth['isAuthenticated'](),controller['faxQueuesWaitingInteractions']);router[_0xd576('0x3c')](_0xd576('0x3d'),auth['isAuthenticated'](),controller[_0xd576('0x3e')]('mail'));router[_0xd576('0x5')]('/mail/queues/:id',auth['isAuthenticated'](),controller['showMailQueues']);router[_0xd576('0x3c')]('/chat/queues/:id/notify',auth[_0xd576('0x7')](),controller[_0xd576('0x3e')](_0xd576('0x3f')));router[_0xd576('0x5')](_0xd576('0x40'),auth[_0xd576('0x7')](),controller[_0xd576('0x41')]);router[_0xd576('0x3c')](_0xd576('0x42'),auth[_0xd576('0x7')](),controller[_0xd576('0x3e')]('fax'));router[_0xd576('0x5')](_0xd576('0x43'),auth[_0xd576('0x7')](),controller['showFaxQueues']);router[_0xd576('0x3c')](_0xd576('0x44'),auth['isAuthenticated'](),controller[_0xd576('0x3e')](_0xd576('0x45')));router['get'](_0xd576('0x46'),auth[_0xd576('0x7')](),controller[_0xd576('0x47')]);router[_0xd576('0x3c')]('/sms/queues/:id/notify',auth[_0xd576('0x7')](),controller[_0xd576('0x3e')]('sms'));router['post'](_0xd576('0x48'),auth[_0xd576('0x7')](),controller['queueNotify']('whatsapp'));router[_0xd576('0x5')]('/sms/queues/:id',auth[_0xd576('0x7')](),controller['showSmsQueues']);router[_0xd576('0x5')](_0xd576('0x49'),auth[_0xd576('0x7')](),controller[_0xd576('0x4a')]);router[_0xd576('0x3c')](_0xd576('0x4b'),auth[_0xd576('0x7')](),controller[_0xd576('0x4c')]);module[_0xd576('0x4d')]=router; \ No newline at end of file +var _0xfff5=['/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','updateVoiceQueue','/outbound','outboundChannels','/agents','agents','put','/agents/:id/capacity','telephones','/trunks','/campaigns','campaigns','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','queueNotify','/mail/queues/:id','showMailQueues','chat','/chat/queues/:id','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','showWhatsappQueues','/agents/:id/notify','exports','multer','util','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','voiceQueues','chatQueues','/mail/queues','mailQueues','mailAccounts','/openchannel/queues','openchannelQueues'];(function(_0x3c6108,_0x393228){var _0x2fcdc5=function(_0x1a5c02){while(--_0x1a5c02){_0x3c6108['push'](_0x3c6108['shift']());}};_0x2fcdc5(++_0x393228);}(_0xfff5,0xd5));var _0x5fff=function(_0x5a4dd4,_0x463991){_0x5a4dd4=_0x5a4dd4-0x0;var _0x2c9c2d=_0xfff5[_0x5a4dd4];return _0x2c9c2d;};'use strict';var multer=require(_0x5fff('0x0'));var util=require(_0x5fff('0x1'));var path=require('path');var express=require(_0x5fff('0x2'));var router=express[_0x5fff('0x3')]();var auth=require(_0x5fff('0x4'));var controller=require(_0x5fff('0x5'));router[_0x5fff('0x6')](_0x5fff('0x7'),auth[_0x5fff('0x8')](),controller[_0x5fff('0x9')]);router['get'](_0x5fff('0xa'),auth[_0x5fff('0x8')](),controller[_0x5fff('0xb')]);router[_0x5fff('0x6')](_0x5fff('0xc'),auth[_0x5fff('0x8')](),controller[_0x5fff('0xd')]);router[_0x5fff('0x6')]('/voice/queues',auth[_0x5fff('0x8')](),controller[_0x5fff('0xe')]);router[_0x5fff('0x6')]('/chat/queues',auth[_0x5fff('0x8')](),controller[_0x5fff('0xf')]);router[_0x5fff('0x6')](_0x5fff('0x10'),auth[_0x5fff('0x8')](),controller[_0x5fff('0x11')]);router[_0x5fff('0x6')]('/mail/accounts',auth[_0x5fff('0x8')](),controller[_0x5fff('0x12')]);router['get'](_0x5fff('0x13'),auth['isAuthenticated'](),controller[_0x5fff('0x14')]);router[_0x5fff('0x6')](_0x5fff('0x15'),auth[_0x5fff('0x8')](),controller[_0x5fff('0x16')]);router['get'](_0x5fff('0x17'),auth[_0x5fff('0x8')](),controller[_0x5fff('0x18')]);router[_0x5fff('0x6')](_0x5fff('0x19'),auth['isAuthenticated'](),controller[_0x5fff('0x1a')]);router[_0x5fff('0x6')](_0x5fff('0x1b'),auth[_0x5fff('0x8')](),controller[_0x5fff('0x1c')]);router[_0x5fff('0x6')]('/voice/queues/channels',auth[_0x5fff('0x8')](),controller[_0x5fff('0x1d')]);router[_0x5fff('0x6')]('/voice/queues/channels/:uniqueid',auth[_0x5fff('0x8')](),controller['voiceQueuesChannel']);router[_0x5fff('0x6')]('/voice/queues/channels/:uniqueid/hangup',auth['isAuthenticated'](),controller[_0x5fff('0x1e')]);router[_0x5fff('0x6')](_0x5fff('0x1f'),auth[_0x5fff('0x8')](),controller[_0x5fff('0x20')]);router[_0x5fff('0x6')](_0x5fff('0x21'),auth['isAuthenticated'](),controller[_0x5fff('0x22')]);router['put'](_0x5fff('0x21'),auth[_0x5fff('0x8')](),controller[_0x5fff('0x23')]);router[_0x5fff('0x6')](_0x5fff('0x24'),auth[_0x5fff('0x8')](),controller['outbound']);router['get']('/outbound/channels',auth['isAuthenticated'](),controller[_0x5fff('0x25')]);router['get'](_0x5fff('0x26'),auth[_0x5fff('0x8')](),controller[_0x5fff('0x27')]);router[_0x5fff('0x28')](_0x5fff('0x29'),auth['isAuthenticated'](),controller['agentCapacity']);router['get']('/telephones',auth[_0x5fff('0x8')](),controller[_0x5fff('0x2a')]);router['get'](_0x5fff('0x2b'),auth[_0x5fff('0x8')](),controller['trunks']);router[_0x5fff('0x6')](_0x5fff('0x2c'),auth[_0x5fff('0x8')](),controller[_0x5fff('0x2d')]);router['get']('/fax/accounts',auth['isAuthenticated'](),controller[_0x5fff('0x2e')]);router['get'](_0x5fff('0x2f'),auth[_0x5fff('0x8')](),controller[_0x5fff('0x30')]);router['get'](_0x5fff('0x31'),auth[_0x5fff('0x8')](),controller['mailQueuesWaitingInteractions']);router[_0x5fff('0x6')](_0x5fff('0x32'),auth['isAuthenticated'](),controller['openchannelQueuesWaitingInteractions']);router['get']('/openchannel/queues/:id/waitinginteractions',auth[_0x5fff('0x8')](),controller[_0x5fff('0x33')]);router[_0x5fff('0x6')](_0x5fff('0x34'),auth['isAuthenticated'](),controller[_0x5fff('0x35')]);router[_0x5fff('0x6')](_0x5fff('0x36'),auth['isAuthenticated'](),controller[_0x5fff('0x37')]);router[_0x5fff('0x6')](_0x5fff('0x38'),auth[_0x5fff('0x8')](),controller['faxQueuesWaitingInteractions']);router[_0x5fff('0x39')]('/mail/queues/:id/notify',auth['isAuthenticated'](),controller[_0x5fff('0x3a')]('mail'));router[_0x5fff('0x6')](_0x5fff('0x3b'),auth[_0x5fff('0x8')](),controller[_0x5fff('0x3c')]);router[_0x5fff('0x39')]('/chat/queues/:id/notify',auth[_0x5fff('0x8')](),controller[_0x5fff('0x3a')](_0x5fff('0x3d')));router[_0x5fff('0x6')](_0x5fff('0x3e'),auth[_0x5fff('0x8')](),controller['showChatQueues']);router[_0x5fff('0x39')](_0x5fff('0x3f'),auth[_0x5fff('0x8')](),controller[_0x5fff('0x3a')](_0x5fff('0x40')));router[_0x5fff('0x6')](_0x5fff('0x41'),auth[_0x5fff('0x8')](),controller[_0x5fff('0x42')]);router[_0x5fff('0x39')](_0x5fff('0x43'),auth['isAuthenticated'](),controller[_0x5fff('0x3a')](_0x5fff('0x44')));router['get']('/openchannel/queues/:id',auth[_0x5fff('0x8')](),controller[_0x5fff('0x45')]);router[_0x5fff('0x39')](_0x5fff('0x46'),auth[_0x5fff('0x8')](),controller['queueNotify'](_0x5fff('0x47')));router[_0x5fff('0x39')](_0x5fff('0x48'),auth['isAuthenticated'](),controller[_0x5fff('0x3a')]('whatsapp'));router['get'](_0x5fff('0x49'),auth[_0x5fff('0x8')](),controller[_0x5fff('0x4a')]);router[_0x5fff('0x6')]('/whatsapp/queues/:id',auth[_0x5fff('0x8')](),controller[_0x5fff('0x4b')]);router[_0x5fff('0x39')](_0x5fff('0x4c'),auth[_0x5fff('0x8')](),controller['agentNotify']);module[_0x5fff('0x4d')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 8acb9d9..7ce3ad1 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 _0x5075=['api','client','http','then','error','message','result','status','json','name','send','isNil','rows','find','VoiceChannels','query','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','updateVoiceQueue','UpdateVoiceQueue','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','outbound','Outbound','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','INTERACTION','SIP/%s','interface','agent','internal','capacity','telephones','Telephones','trunks','campaigns','Campaigns','chatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','FaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','Interaction','\x20Message\x20not\x20found','queue','InteractionId','From','QueueId','TransferReport','create','Start','agentNotify','Channel\x20field\x20is\x20mandatory','channel','chat','Agent\x20not\x20found','MessageId','agentTransferTimeout','*,*,*,*','bluebird','moment','lodash','util','../../mysqldb','../../config/logger'];(function(_0x4fe566,_0x93c45f){var _0x5e38e0=function(_0x419f46){while(--_0x419f46){_0x4fe566['push'](_0x4fe566['shift']());}};_0x5e38e0(++_0x93c45f);}(_0x5075,0x73));var _0x5507=function(_0x592cbc,_0x5ec030){_0x592cbc=_0x592cbc-0x0;var _0x39b8d9=_0x5075[_0x592cbc];return _0x39b8d9;};'use strict';var BPromise=require(_0x5507('0x0'));var moment=require(_0x5507('0x1'));var _=require(_0x5507('0x2'));var util=require(_0x5507('0x3'));var db=require(_0x5507('0x4'))['db'];var logger=require(_0x5507('0x5'))(_0x5507('0x6'));var jayson=require('jayson/promise');var amiClient=jayson[_0x5507('0x7')][_0x5507('0x8')]({'port':0x232a});var mailClient=jayson[_0x5507('0x7')]['http']({'port':0x232b});var routingClient=jayson['client'][_0x5507('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x773559,_0x4c2d6d,_0x42c232){return new BPromise(function(_0x7cc84c,_0xbf4b50){var _0x504e05=_0x42c232?_0x42c232:amiClient;return _0x504e05['request'](_0x773559,_0x4c2d6d)[_0x5507('0x9')](function(_0x441bdc){if(_0x441bdc[_0x5507('0xa')]){if(_0x441bdc[_0x5507('0xa')]['code']===0x1f4){return _0xbf4b50(_0x441bdc[_0x5507('0xa')][_0x5507('0xb')]);}return _0x7cc84c(_0x441bdc['error'][_0x5507('0xb')]);}else{_0x7cc84c(_0x441bdc[_0x5507('0xc')]);}})['catch'](function(_0x37a1de){_0xbf4b50(_0x37a1de);});});}function respondWithResult(_0x2a2ea0,_0x32c872){_0x32c872=_0x32c872||0xc8;return function(_0x267f27){if(_0x267f27){return _0x2a2ea0[_0x5507('0xd')](_0x32c872)[_0x5507('0xe')](_0x267f27);}return _0x2a2ea0['sendStatus'](0x194);};}function handleError(_0x9cc3f9,_0x2b7c43){_0x2b7c43=_0x2b7c43||0x1f4;return function(_0xc828e5){logger[_0x5507('0xa')](_0xc828e5['stack']);if(_0xc828e5[_0x5507('0xf')]){delete _0xc828e5[_0x5507('0xf')];}_0x9cc3f9[_0x5507('0xd')](_0x2b7c43)[_0x5507('0x10')](_0xc828e5);};}function findById(_0xa6e4b3){return function(_0x2ede34){if(!_[_0x5507('0x11')](_0xa6e4b3)&&!_[_0x5507('0x11')](_0x2ede34)&&!_[_0x5507('0x11')](_0x2ede34[_0x5507('0x12')])){return _[_0x5507('0x13')](_0x2ede34[_0x5507('0x12')],function(_0x3822dd){return _0x3822dd['id']==_0xa6e4b3;});}return null;};}exports['voiceChannels']=function(_0x14dab0,_0x276a81){return respondWithRpcPromise(_0x5507('0x14'),_0x14dab0[_0x5507('0x15')])['then'](respondWithResult(_0x276a81,null))[_0x5507('0x16')](handleError(_0x276a81,null));};exports[_0x5507('0x17')]=function(_0x1a54b0,_0x3ca1f7){return respondWithRpcPromise(_0x5507('0x18'),_[_0x5507('0x19')](_0x1a54b0['query'],_0x1a54b0[_0x5507('0x1a')]))[_0x5507('0x9')](respondWithResult(_0x3ca1f7,null))[_0x5507('0x16')](handleError(_0x3ca1f7,null));};exports[_0x5507('0x1b')]=function(_0x141d22,_0x2de482){return respondWithRpcPromise(_0x5507('0x1c'),_[_0x5507('0x19')](_0x141d22[_0x5507('0x15')],_0x141d22[_0x5507('0x1a')]))[_0x5507('0x9')](respondWithResult(_0x2de482,null))[_0x5507('0x16')](handleError(_0x2de482,null));};exports[_0x5507('0x1d')]=function(_0x2ee6ed,_0x1a2203){return respondWithRpcPromise('VoiceQueues',_0x2ee6ed[_0x5507('0x15')])['then'](respondWithResult(_0x1a2203,null))[_0x5507('0x16')](handleError(_0x1a2203,null));};exports['showVoiceQueues']=function(_0xa66a01,_0x24668b){return respondWithRpcPromise('VoiceQueues',_0xa66a01['query'])[_0x5507('0x9')](findById(_0xa66a01[_0x5507('0x1a')]['id']))['then'](respondWithResult(_0x24668b,null))[_0x5507('0x16')](handleError(_0x24668b,null));};exports[_0x5507('0x1e')]=function(_0x85d383,_0x38f4d9){return respondWithRpcPromise(_0x5507('0x1f'),_[_0x5507('0x19')](_0x85d383['body'],_0x85d383[_0x5507('0x1a')]))[_0x5507('0x9')](respondWithResult(_0x38f4d9,null))[_0x5507('0x16')](handleError(_0x38f4d9,null));};exports[_0x5507('0x20')]=function(_0x29dd58,_0x495bbe){return respondWithRpcPromise('VoiceQueuesPreview',_[_0x5507('0x19')](_0x29dd58[_0x5507('0x15')],_0x29dd58[_0x5507('0x1a')]))[_0x5507('0x9')](respondWithResult(_0x495bbe,null))['catch'](handleError(_0x495bbe,null));};exports[_0x5507('0x21')]=function(_0x13b6e5,_0xab91bc){return respondWithRpcPromise(_0x5507('0x22'),_0x13b6e5[_0x5507('0x15')])[_0x5507('0x9')](respondWithResult(_0xab91bc,null))[_0x5507('0x16')](handleError(_0xab91bc,null));};exports[_0x5507('0x23')]=function(_0x5ede36,_0xf61ba7){return respondWithRpcPromise(_0x5507('0x24'),_[_0x5507('0x19')](_0x5ede36['query'],_0x5ede36['params']))[_0x5507('0x9')](respondWithResult(_0xf61ba7,null))[_0x5507('0x16')](handleError(_0xf61ba7,null));};exports[_0x5507('0x25')]=function(_0x17d01c,_0x143d97){return respondWithRpcPromise('VoiceQueuesChannelHangup',_['merge'](_0x17d01c[_0x5507('0x15')],_0x17d01c[_0x5507('0x1a')]))[_0x5507('0x9')](respondWithResult(_0x143d97,null))[_0x5507('0x16')](handleError(_0x143d97,null));};exports['voiceQueuesChannelRedirect']=function(_0x54e4bd,_0x23ea7c){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x5507('0x19')](_0x54e4bd[_0x5507('0x15')],_0x54e4bd[_0x5507('0x1a')]))[_0x5507('0x9')](respondWithResult(_0x23ea7c,null))[_0x5507('0x16')](handleError(_0x23ea7c,null));};exports[_0x5507('0x26')]=function(_0x1c8506,_0x2b962d){return respondWithRpcPromise(_0x5507('0x27'),_0x1c8506[_0x5507('0x15')])['then'](respondWithResult(_0x2b962d,null))['catch'](handleError(_0x2b962d,null));};exports['outboundChannels']=function(_0x570eee,_0x526022){return respondWithRpcPromise(_0x5507('0x28'),_0x570eee[_0x5507('0x15')])[_0x5507('0x9')](respondWithResult(_0x526022,null))[_0x5507('0x16')](handleError(_0x526022,null));};exports[_0x5507('0x29')]=function(_0xbef058,_0x101de3){var _0xbc9f93;return respondWithRpcPromise(_0x5507('0x2a'),_0xbef058[_0x5507('0x15')])[_0x5507('0x9')](function(_0x2db0b2){_0xbc9f93=_0x2db0b2;return respondWithRpcPromise(_0x5507('0x2a'),_0xbef058['query'],routingClient);})['then'](function(_0x50eb32){return _[_0x5507('0x19')]({},_0x50eb32,_0xbc9f93);})[_0x5507('0x9')](respondWithResult(_0x101de3,null))[_0x5507('0x16')](handleError(_0x101de3,null));};exports[_0x5507('0x2b')]=function(_0xcd4df5,_0x17d7db){if(_0xcd4df5[_0x5507('0x2c')]&&_0xcd4df5[_0x5507('0x2c')][_0x5507('0x2d')]&&_0xcd4df5[_0x5507('0x2e')]&&_0xcd4df5[_0x5507('0x2e')][_0x5507('0xf')]){for(var _0x24d7b5 in _0xcd4df5[_0x5507('0x2c')][_0x5507('0x2d')]){if(_0xcd4df5[_0x5507('0x2c')][_0x5507('0x2d')][_0x5507('0x2f')](_0x24d7b5)){db[_0x5507('0x30')]['findAll']({'where':{'channel':_0x24d7b5,'membername':_0xcd4df5[_0x5507('0x2e')][_0x5507('0xf')],'type':'INTERACTION','exitAt':null,'uniqueid':_0xcd4df5['body'][_0x5507('0x2d')][_0x24d7b5]&&_0xcd4df5[_0x5507('0x2c')][_0x5507('0x2d')][_0x24d7b5][_0x5507('0x31')]?{'$notIn':_0xcd4df5[_0x5507('0x2c')]['interaction'][_0x24d7b5]}:{'$ne':null}}})[_0x5507('0x9')](function(_0x39ac17){var _0x1dfc9c=moment()['format'](_0x5507('0x32'));for(var _0x33022e=0x0,_0xadea4c=_0x39ac17[_0x5507('0x31')];_0x33022e<_0xadea4c;_0x33022e+=0x1){_0x39ac17[_0x33022e][_0x5507('0x33')]({'exitAt':_0x1dfc9c});}});for(var _0x48d72b=0x0;_0x48d72b<_0xcd4df5[_0x5507('0x2c')]['interaction'][_0x24d7b5][_0x5507('0x31')];_0x48d72b+=0x1){db[_0x5507('0x30')][_0x5507('0x34')]({'where':{'channel':_0x24d7b5,'membername':_0xcd4df5[_0x5507('0x2e')][_0x5507('0xf')],'type':_0x5507('0x35'),'uniqueid':_0xcd4df5[_0x5507('0x2c')][_0x5507('0x2d')][_0x24d7b5][_0x48d72b],'exitAt':null},'defaults':{'channel':_0x24d7b5,'membername':_0xcd4df5['user'][_0x5507('0xf')],'interface':_[_0x5507('0x11')](_0xcd4df5['user']['interface'])?util['format'](_0x5507('0x36'),_0xcd4df5['user'][_0x5507('0xf')]):_0xcd4df5['user'][_0x5507('0x37')],'type':'INTERACTION','enterAt':moment()['format'](_0x5507('0x32')),'role':_0x5507('0x38'),'internal':_0xcd4df5[_0x5507('0x2e')][_0x5507('0x39')],'uniqueid':_0xcd4df5[_0x5507('0x2c')][_0x5507('0x2d')][_0x24d7b5][_0x48d72b]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0xcd4df5[_0x5507('0x1a')]['id'],'capacity':_0xcd4df5[_0x5507('0x2c')][_0x5507('0x3a')]},routingClient)['then'](respondWithResult(_0x17d7db,null))[_0x5507('0x16')](handleError(_0x17d7db,null));};exports[_0x5507('0x3b')]=function(_0x505e71,_0x2e0cfc){return respondWithRpcPromise(_0x5507('0x3c'),_0x505e71[_0x5507('0x15')])[_0x5507('0x9')](respondWithResult(_0x2e0cfc,null))[_0x5507('0x16')](handleError(_0x2e0cfc,null));};exports[_0x5507('0x3d')]=function(_0x245456,_0x1bb575){return respondWithRpcPromise('Trunks',_0x245456['query'])[_0x5507('0x9')](respondWithResult(_0x1bb575,null))[_0x5507('0x16')](handleError(_0x1bb575,null));};exports[_0x5507('0x3e')]=function(_0x1b34c8,_0xce851d){return respondWithRpcPromise(_0x5507('0x3f'),_0x1b34c8[_0x5507('0x15')])[_0x5507('0x9')](respondWithResult(_0xce851d,null))[_0x5507('0x16')](handleError(_0xce851d,null));};exports[_0x5507('0x40')]=function(_0x40cda2,_0x13dc8b){return respondWithRpcPromise(_0x5507('0x41'),_0x40cda2[_0x5507('0x15')],routingClient)[_0x5507('0x9')](respondWithResult(_0x13dc8b,null))[_0x5507('0x16')](handleError(_0x13dc8b,null));};exports['showChatQueues']=function(_0x3f47af,_0x56e0cd){return respondWithRpcPromise('ChatQueues',_0x3f47af[_0x5507('0x15')],routingClient)[_0x5507('0x9')](findById(_0x3f47af[_0x5507('0x1a')]['id']))[_0x5507('0x9')](respondWithResult(_0x56e0cd,null))['catch'](handleError(_0x56e0cd,null));};exports[_0x5507('0x42')]=function(_0x2f41a9,_0x314d4e){return respondWithRpcPromise(_0x5507('0x43'),_0x2f41a9[_0x5507('0x15')],routingClient)[_0x5507('0x9')](respondWithResult(_0x314d4e,null))['catch'](handleError(_0x314d4e,null));};exports[_0x5507('0x44')]=function(_0x46e589,_0x3a2f9f){return respondWithRpcPromise('MailQueues',_0x46e589['query'],routingClient)[_0x5507('0x9')](findById(_0x46e589['params']['id']))[_0x5507('0x9')](respondWithResult(_0x3a2f9f,null))[_0x5507('0x16')](handleError(_0x3a2f9f,null));};exports['mailAccounts']=function(_0x3e796d,_0x1b622f){return respondWithRpcPromise(_0x5507('0x45'),_0x3e796d[_0x5507('0x15')],mailClient)[_0x5507('0x9')](respondWithResult(_0x1b622f,null))[_0x5507('0x16')](handleError(_0x1b622f,null));};exports[_0x5507('0x46')]=function(_0x2928f2,_0x737d39){return respondWithRpcPromise(_0x5507('0x47'),_0x2928f2[_0x5507('0x15')],routingClient)[_0x5507('0x9')](respondWithResult(_0x737d39,null))['catch'](handleError(_0x737d39,null));};exports[_0x5507('0x48')]=function(_0x2e904b,_0x219e34){return respondWithRpcPromise(_0x5507('0x47'),_0x2e904b[_0x5507('0x15')],routingClient)['then'](findById(_0x2e904b[_0x5507('0x1a')]['id']))['then'](respondWithResult(_0x219e34,null))[_0x5507('0x16')](handleError(_0x219e34,null));};exports[_0x5507('0x49')]=function(_0x241733,_0x54c009){return respondWithRpcPromise(_0x5507('0x4a'),_0x241733[_0x5507('0x15')],routingClient)[_0x5507('0x9')](respondWithResult(_0x54c009,null))['catch'](handleError(_0x54c009,null));};exports[_0x5507('0x4b')]=function(_0x5cfdb0,_0x3dca7d){return respondWithRpcPromise('SmsQueues',_0x5cfdb0['query'],routingClient)[_0x5507('0x9')](findById(_0x5cfdb0[_0x5507('0x1a')]['id']))[_0x5507('0x9')](respondWithResult(_0x3dca7d,null))[_0x5507('0x16')](handleError(_0x3dca7d,null));};exports[_0x5507('0x4c')]=function(_0x31cc0d,_0x4bf567){return respondWithRpcPromise('WhatsappQueues',_0x31cc0d[_0x5507('0x15')],routingClient)[_0x5507('0x9')](respondWithResult(_0x4bf567,null))[_0x5507('0x16')](handleError(_0x4bf567,null));};exports[_0x5507('0x4d')]=function(_0x5e3e73,_0x388faa){return respondWithRpcPromise(_0x5507('0x4e'),_0x5e3e73[_0x5507('0x15')],routingClient)[_0x5507('0x9')](findById(_0x5e3e73[_0x5507('0x1a')]['id']))[_0x5507('0x9')](respondWithResult(_0x388faa,null))[_0x5507('0x16')](handleError(_0x388faa,null));};exports['faxQueues']=function(_0x3802dd,_0xfdbbe5){return respondWithRpcPromise(_0x5507('0x4f'),_0x3802dd['query'],routingClient)[_0x5507('0x9')](respondWithResult(_0xfdbbe5,null))['catch'](handleError(_0xfdbbe5,null));};exports['showFaxQueues']=function(_0x55c257,_0x1fef49){return respondWithRpcPromise(_0x5507('0x4f'),_0x55c257[_0x5507('0x15')],routingClient)[_0x5507('0x9')](findById(_0x55c257[_0x5507('0x1a')]['id']))[_0x5507('0x9')](respondWithResult(_0x1fef49,null))[_0x5507('0x16')](handleError(_0x1fef49,null));};exports['faxAccounts']=function(_0x1812d7,_0x48ed80){return respondWithRpcPromise(_0x5507('0x50'),_0x1812d7[_0x5507('0x15')])[_0x5507('0x9')](respondWithResult(_0x48ed80,null))[_0x5507('0x16')](handleError(_0x48ed80,null));};exports[_0x5507('0x51')]=function(_0x120108,_0x4423a8){return respondWithRpcPromise(_0x5507('0x52'),_0x120108[_0x5507('0x15')],routingClient)[_0x5507('0x9')](respondWithResult(_0x4423a8,null))[_0x5507('0x16')](handleError(_0x4423a8,null));};exports['mailQueuesWaitingInteractions']=function(_0x94b11c,_0xbb0a62){return respondWithRpcPromise(_0x5507('0x53'),_0x94b11c['query'],routingClient)[_0x5507('0x9')](respondWithResult(_0xbb0a62,null))[_0x5507('0x16')](handleError(_0xbb0a62,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x26e777,_0x5815fb){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x26e777[_0x5507('0x15')],routingClient)['then'](respondWithResult(_0x5815fb,null))[_0x5507('0x16')](handleError(_0x5815fb,null));};exports[_0x5507('0x54')]=function(_0xfb59be,_0xda51d5){return respondWithRpcPromise(_0x5507('0x55'),_0xfb59be[_0x5507('0x15')],routingClient)['then'](function(_0x43fccf){if(_0xfb59be[_0x5507('0x15')][_0x5507('0x56')]!==undefined){var _0x75aa3c=_(_0x43fccf[_0x5507('0x12')])[_0x5507('0x57')]([_0xfb59be[_0x5507('0x15')][_0x5507('0x56')],_0xfb59be[_0x5507('0x1a')]['id']])[_0x5507('0x58')](_0x5507('0x59'))[_0x5507('0x5a')]()['value']();return _0x43fccf[_0x5507('0x12')][_0x5507('0x57')](function(_0x10f066){return _0x75aa3c[_0x5507('0x5b')](_0x10f066[_0x5507('0x59')])>-0x1;});}else{return _0x43fccf[_0x5507('0x12')]['filter'](function(_0x1dad83){return _0x1dad83['queue_id']===parseInt(_0xfb59be[_0x5507('0x1a')]['id']);});}})['then'](respondWithResult(_0xda51d5,null))['catch'](handleError(_0xda51d5,null));};exports[_0x5507('0x5c')]=function(_0x20274e,_0x2979b1){return respondWithRpcPromise(_0x5507('0x5d'),_0x20274e[_0x5507('0x15')],routingClient)['then'](respondWithResult(_0x2979b1,null))[_0x5507('0x16')](handleError(_0x2979b1,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x410c16,_0x471142){return respondWithRpcPromise(_0x5507('0x5e'),_0x410c16[_0x5507('0x15')],routingClient)['then'](respondWithResult(_0x471142,null))[_0x5507('0x16')](handleError(_0x471142,null));};exports[_0x5507('0x5f')]=function(_0x42bef4,_0x5a8a1b){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x42bef4[_0x5507('0x15')],routingClient)[_0x5507('0x9')](respondWithResult(_0x5a8a1b,null))[_0x5507('0x16')](handleError(_0x5a8a1b,null));};exports[_0x5507('0x60')]=function(_0x77a772){return function(_0x26f796,_0x3d7e21){var _0x10b62e,_0x18bed6;var _0x27265e=_[_0x5507('0x61')](_0x77a772);var _0x160e54=_0x77a772==='chat'?_0x5507('0x62'):_0x5507('0x63');return db[_0x27265e+_0x5507('0x64')][_0x5507('0x65')]({'raw':!![],'where':{'id':_0x26f796[_0x5507('0x1a')]['id']}})[_0x5507('0x9')](function(_0x33717e){if(_['isNil'](_0x33717e)){throw new Error(_0x27265e+_0x5507('0x66'));}_0x10b62e=_0x33717e;return db[_0x27265e+_0x5507('0x67')][_0x5507('0x65')]({'where':{'id':_0x26f796[_0x5507('0x2c')]['messageId']},'include':[{'model':db[_0x27265e+_0x5507('0x68')],'as':_0x5507('0x68')},{'model':db[_0x27265e+_0x160e54],'as':_0x5507('0x63')}]});})[_0x5507('0x9')](function(_0x1a5d2e){if(_[_0x5507('0x11')](_0x1a5d2e)){throw new Error(_0x27265e+_0x5507('0x69'));}_0x18bed6=_0x1a5d2e;return _0x1a5d2e['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x5507('0x9')](function(){var _0x38144b={'uniqueid':_0x77a772+'.'+_0x18bed6['id']+'.'+_0x18bed6[_0x5507('0x68')]['id'],'FromUserId':_0x26f796[_0x5507('0x2e')]['id'],'type':_0x5507('0x6a')};_0x38144b[_0x27265e+'MessageId']=_0x18bed6['id'];_0x38144b[_0x27265e+_0x5507('0x6b')]=_0x18bed6[_0x5507('0x68')]['id'];_0x38144b[_0x5507('0x6c')+_0x27265e+_0x160e54+'Id']=_0x18bed6[_0x5507('0x63')]['id'];_0x38144b['To'+_0x27265e+_0x5507('0x6d')]=_0x10b62e['id'];return db[_0x27265e+_0x5507('0x6e')][_0x5507('0x6f')](_0x38144b);})[_0x5507('0x9')](function(){return respondWithRpcPromise(_0x5507('0x70'),{'channel':_0x77a772,'interaction':_0x18bed6[_0x5507('0x68')],'message':_0x18bed6,'account':_0x18bed6[_0x5507('0x63')],'applications':[{'id':0x0,'priority':0x1,'app':_0x5507('0x6a'),'appdata':_0x10b62e[_0x5507('0xf')]+','+(_0x18bed6['Account']['queueTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x5507('0x9')](respondWithResult(_0x3d7e21,null))[_0x5507('0x16')](handleError(_0x3d7e21,null));};};exports[_0x5507('0x71')]=function(_0x3b04a7,_0x1e913a){var _0x4e1578,_0x2339c7;if(_[_0x5507('0x11')](_0x3b04a7[_0x5507('0x2c')]['channel'])){throw new Error(_0x5507('0x72'));}var _0x5808d9=_0x3b04a7['body'][_0x5507('0x73')];var _0x58b56c=_[_0x5507('0x61')](_0x5808d9);var _0x5c6043=_0x5808d9===_0x5507('0x74')?_0x5507('0x62'):_0x5507('0x63');return db['User']['findOne']({'raw':!![],'where':{'id':_0x3b04a7[_0x5507('0x1a')]['id'],'role':_0x5507('0x38')}})[_0x5507('0x9')](function(_0x51bec0){if(_[_0x5507('0x11')](_0x51bec0)){throw new Error(_0x5507('0x75'));}_0x4e1578=_0x51bec0;return db[_0x58b56c+_0x5507('0x67')][_0x5507('0x65')]({'where':{'id':_0x3b04a7['body']['messageId']},'include':[{'model':db[_0x58b56c+_0x5507('0x68')],'as':_0x5507('0x68')},{'model':db[_0x58b56c+_0x5c6043],'as':'Account'}]});})[_0x5507('0x9')](function(_0x13c0f5){if(_[_0x5507('0x11')](_0x13c0f5)){throw new Error(_0x58b56c+_0x5507('0x69'));}_0x2339c7=_0x13c0f5;return _0x13c0f5['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x5507('0x9')](function(){var _0x3a2b0f={'uniqueid':_0x5808d9+'.'+_0x2339c7['id']+'.'+_0x2339c7['Interaction']['id'],'FromUserId':_0x3b04a7[_0x5507('0x2e')]['id'],'type':_0x5507('0x6a'),'ToUserId':_0x4e1578['id']};_0x3a2b0f[_0x58b56c+_0x5507('0x76')]=_0x2339c7['id'];_0x3a2b0f[_0x58b56c+'InteractionId']=_0x2339c7[_0x5507('0x68')]['id'];_0x3a2b0f[_0x5507('0x6c')+_0x58b56c+_0x5c6043+'Id']=_0x2339c7['Account']['id'];return db[_0x58b56c+_0x5507('0x6e')][_0x5507('0x6f')](_0x3a2b0f);})['then'](function(){return respondWithRpcPromise(_0x5507('0x70'),{'channel':_0x5808d9,'interaction':_0x2339c7[_0x5507('0x68')],'message':_0x2339c7,'account':_0x2339c7[_0x5507('0x63')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x4e1578[_0x5507('0xf')]+','+(_0x2339c7[_0x5507('0x63')][_0x5507('0x77')]||0x12c),'interval':_0x5507('0x78')}]},routingClient);})[_0x5507('0x9')](respondWithResult(_0x1e913a,null))[_0x5507('0x16')](handleError(_0x1e913a,null));}; \ No newline at end of file +var _0x24ca=['telephones','Telephones','trunks','chatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Interaction','update','queue','MessageId','InteractionId','From','QueueId','Start','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User','Agent\x20not\x20found','messageId','\x20Message\x20not\x20found','TransferReport','create','agentTransferTimeout','bluebird','lodash','util','../../mysqldb','api','jayson/promise','client','http','request','error','code','message','result','json','sendStatus','stack','status','send','isNil','rows','voiceChannels','VoiceChannels','query','then','VoiceChannelMixMonitor','merge','params','catch','VoiceQueues','showVoiceQueues','updateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','name','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity'];(function(_0x44e81b,_0x5251f6){var _0x2d5f8e=function(_0x584f8b){while(--_0x584f8b){_0x44e81b['push'](_0x44e81b['shift']());}};_0x2d5f8e(++_0x5251f6);}(_0x24ca,0x1bc));var _0xa24c=function(_0x398294,_0x5ceb9d){_0x398294=_0x398294-0x0;var _0x2a872d=_0x24ca[_0x398294];return _0x2a872d;};'use strict';var BPromise=require(_0xa24c('0x0'));var moment=require('moment');var _=require(_0xa24c('0x1'));var util=require(_0xa24c('0x2'));var db=require(_0xa24c('0x3'))['db'];var logger=require('../../config/logger')(_0xa24c('0x4'));var jayson=require(_0xa24c('0x5'));var amiClient=jayson[_0xa24c('0x6')][_0xa24c('0x7')]({'port':0x232a});var mailClient=jayson[_0xa24c('0x6')][_0xa24c('0x7')]({'port':0x232b});var routingClient=jayson[_0xa24c('0x6')][_0xa24c('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x2dd348,_0x257264,_0x9a5013){return new BPromise(function(_0x481196,_0x42d89c){var _0x3a5727=_0x9a5013?_0x9a5013:amiClient;return _0x3a5727[_0xa24c('0x8')](_0x2dd348,_0x257264)['then'](function(_0x399f32){if(_0x399f32[_0xa24c('0x9')]){if(_0x399f32[_0xa24c('0x9')][_0xa24c('0xa')]===0x1f4){return _0x42d89c(_0x399f32[_0xa24c('0x9')][_0xa24c('0xb')]);}return _0x481196(_0x399f32[_0xa24c('0x9')][_0xa24c('0xb')]);}else{_0x481196(_0x399f32[_0xa24c('0xc')]);}})['catch'](function(_0x43bcd3){_0x42d89c(_0x43bcd3);});});}function respondWithResult(_0x11090c,_0xcee4fe){_0xcee4fe=_0xcee4fe||0xc8;return function(_0x2c2af8){if(_0x2c2af8){return _0x11090c['status'](_0xcee4fe)[_0xa24c('0xd')](_0x2c2af8);}return _0x11090c[_0xa24c('0xe')](0x194);};}function handleError(_0x26ff28,_0x2fcd8b){_0x2fcd8b=_0x2fcd8b||0x1f4;return function(_0x1cb08e){logger[_0xa24c('0x9')](_0x1cb08e[_0xa24c('0xf')]);if(_0x1cb08e['name']){delete _0x1cb08e['name'];}_0x26ff28[_0xa24c('0x10')](_0x2fcd8b)[_0xa24c('0x11')](_0x1cb08e);};}function findById(_0x49ce53){return function(_0x5babb5){if(!_[_0xa24c('0x12')](_0x49ce53)&&!_[_0xa24c('0x12')](_0x5babb5)&&!_['isNil'](_0x5babb5[_0xa24c('0x13')])){return _['find'](_0x5babb5[_0xa24c('0x13')],function(_0x2a610a){return _0x2a610a['id']==_0x49ce53;});}return null;};}exports[_0xa24c('0x14')]=function(_0xefdbd9,_0x4ff97c){return respondWithRpcPromise(_0xa24c('0x15'),_0xefdbd9[_0xa24c('0x16')])[_0xa24c('0x17')](respondWithResult(_0x4ff97c,null))['catch'](handleError(_0x4ff97c,null));};exports['voiceChannelMixMonitor']=function(_0x506424,_0x4cd77e){return respondWithRpcPromise(_0xa24c('0x18'),_[_0xa24c('0x19')](_0x506424[_0xa24c('0x16')],_0x506424[_0xa24c('0x1a')]))['then'](respondWithResult(_0x4cd77e,null))[_0xa24c('0x1b')](handleError(_0x4cd77e,null));};exports['voiceChannelStopMixMonitor']=function(_0x224bca,_0xb81d97){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0xa24c('0x19')](_0x224bca[_0xa24c('0x16')],_0x224bca[_0xa24c('0x1a')]))[_0xa24c('0x17')](respondWithResult(_0xb81d97,null))[_0xa24c('0x1b')](handleError(_0xb81d97,null));};exports['voiceQueues']=function(_0xec9167,_0x5cc9cb){return respondWithRpcPromise(_0xa24c('0x1c'),_0xec9167[_0xa24c('0x16')])[_0xa24c('0x17')](respondWithResult(_0x5cc9cb,null))['catch'](handleError(_0x5cc9cb,null));};exports[_0xa24c('0x1d')]=function(_0x31c4d9,_0x14fd5a){return respondWithRpcPromise(_0xa24c('0x1c'),_0x31c4d9[_0xa24c('0x16')])[_0xa24c('0x17')](findById(_0x31c4d9[_0xa24c('0x1a')]['id']))['then'](respondWithResult(_0x14fd5a,null))[_0xa24c('0x1b')](handleError(_0x14fd5a,null));};exports[_0xa24c('0x1e')]=function(_0x152120,_0x12dbdc){return respondWithRpcPromise('UpdateVoiceQueue',_[_0xa24c('0x19')](_0x152120[_0xa24c('0x1f')],_0x152120[_0xa24c('0x1a')]))['then'](respondWithResult(_0x12dbdc,null))[_0xa24c('0x1b')](handleError(_0x12dbdc,null));};exports[_0xa24c('0x20')]=function(_0x253d83,_0x4ae35c){return respondWithRpcPromise(_0xa24c('0x21'),_['merge'](_0x253d83[_0xa24c('0x16')],_0x253d83[_0xa24c('0x1a')]))[_0xa24c('0x17')](respondWithResult(_0x4ae35c,null))['catch'](handleError(_0x4ae35c,null));};exports[_0xa24c('0x22')]=function(_0x53f90,_0x1d0379){return respondWithRpcPromise('VoiceQueuesChannels',_0x53f90[_0xa24c('0x16')])['then'](respondWithResult(_0x1d0379,null))[_0xa24c('0x1b')](handleError(_0x1d0379,null));};exports[_0xa24c('0x23')]=function(_0x592198,_0x5680f5){return respondWithRpcPromise(_0xa24c('0x24'),_[_0xa24c('0x19')](_0x592198[_0xa24c('0x16')],_0x592198[_0xa24c('0x1a')]))[_0xa24c('0x17')](respondWithResult(_0x5680f5,null))[_0xa24c('0x1b')](handleError(_0x5680f5,null));};exports[_0xa24c('0x25')]=function(_0x4b4dc2,_0x39f146){return respondWithRpcPromise(_0xa24c('0x26'),_[_0xa24c('0x19')](_0x4b4dc2[_0xa24c('0x16')],_0x4b4dc2[_0xa24c('0x1a')]))[_0xa24c('0x17')](respondWithResult(_0x39f146,null))[_0xa24c('0x1b')](handleError(_0x39f146,null));};exports[_0xa24c('0x27')]=function(_0x1ea166,_0x129bb9){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0xa24c('0x19')](_0x1ea166[_0xa24c('0x16')],_0x1ea166[_0xa24c('0x1a')]))[_0xa24c('0x17')](respondWithResult(_0x129bb9,null))['catch'](handleError(_0x129bb9,null));};exports['outbound']=function(_0x19a65f,_0x56ef4d){return respondWithRpcPromise(_0xa24c('0x28'),_0x19a65f[_0xa24c('0x16')])[_0xa24c('0x17')](respondWithResult(_0x56ef4d,null))[_0xa24c('0x1b')](handleError(_0x56ef4d,null));};exports[_0xa24c('0x29')]=function(_0x4c0fb9,_0x532875){return respondWithRpcPromise(_0xa24c('0x2a'),_0x4c0fb9[_0xa24c('0x16')])[_0xa24c('0x17')](respondWithResult(_0x532875,null))[_0xa24c('0x1b')](handleError(_0x532875,null));};exports[_0xa24c('0x2b')]=function(_0x472912,_0x5080d0){var _0x56f392;return respondWithRpcPromise(_0xa24c('0x2c'),_0x472912[_0xa24c('0x16')])[_0xa24c('0x17')](function(_0x2101f8){_0x56f392=_0x2101f8;return respondWithRpcPromise(_0xa24c('0x2c'),_0x472912['query'],routingClient);})[_0xa24c('0x17')](function(_0x7895e){return _['merge']({},_0x7895e,_0x56f392);})['then'](respondWithResult(_0x5080d0,null))[_0xa24c('0x1b')](handleError(_0x5080d0,null));};exports[_0xa24c('0x2d')]=function(_0x231eea,_0x537849){if(_0x231eea['body']&&_0x231eea[_0xa24c('0x1f')][_0xa24c('0x2e')]&&_0x231eea[_0xa24c('0x2f')]&&_0x231eea[_0xa24c('0x2f')][_0xa24c('0x30')]){for(var _0x1b7faf in _0x231eea[_0xa24c('0x1f')][_0xa24c('0x2e')]){if(_0x231eea['body']['interaction'][_0xa24c('0x31')](_0x1b7faf)){db[_0xa24c('0x32')][_0xa24c('0x33')]({'where':{'channel':_0x1b7faf,'membername':_0x231eea['user'][_0xa24c('0x30')],'type':_0xa24c('0x34'),'exitAt':null,'uniqueid':_0x231eea[_0xa24c('0x1f')][_0xa24c('0x2e')][_0x1b7faf]&&_0x231eea[_0xa24c('0x1f')][_0xa24c('0x2e')][_0x1b7faf][_0xa24c('0x35')]?{'$notIn':_0x231eea[_0xa24c('0x1f')][_0xa24c('0x2e')][_0x1b7faf]}:{'$ne':null}}})[_0xa24c('0x17')](function(_0x4bbf93){var _0xb8c7a5=moment()[_0xa24c('0x36')](_0xa24c('0x37'));for(var _0x5aa2b2=0x0,_0x3a85cb=_0x4bbf93[_0xa24c('0x35')];_0x5aa2b2<_0x3a85cb;_0x5aa2b2+=0x1){_0x4bbf93[_0x5aa2b2][_0xa24c('0x38')]({'exitAt':_0xb8c7a5});}});for(var _0x31f05b=0x0;_0x31f05b<_0x231eea[_0xa24c('0x1f')][_0xa24c('0x2e')][_0x1b7faf][_0xa24c('0x35')];_0x31f05b+=0x1){db[_0xa24c('0x32')][_0xa24c('0x39')]({'where':{'channel':_0x1b7faf,'membername':_0x231eea[_0xa24c('0x2f')][_0xa24c('0x30')],'type':'INTERACTION','uniqueid':_0x231eea[_0xa24c('0x1f')][_0xa24c('0x2e')][_0x1b7faf][_0x31f05b],'exitAt':null},'defaults':{'channel':_0x1b7faf,'membername':_0x231eea[_0xa24c('0x2f')][_0xa24c('0x30')],'interface':_[_0xa24c('0x12')](_0x231eea[_0xa24c('0x2f')][_0xa24c('0x3a')])?util[_0xa24c('0x36')](_0xa24c('0x3b'),_0x231eea['user']['name']):_0x231eea[_0xa24c('0x2f')]['interface'],'type':_0xa24c('0x34'),'enterAt':moment()[_0xa24c('0x36')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xa24c('0x3c'),'internal':_0x231eea[_0xa24c('0x2f')][_0xa24c('0x3d')],'uniqueid':_0x231eea['body']['interaction'][_0x1b7faf][_0x31f05b]}});}}}}return respondWithRpcPromise(_0xa24c('0x3e'),{'id':_0x231eea['params']['id'],'capacity':_0x231eea[_0xa24c('0x1f')][_0xa24c('0x3f')]},routingClient)[_0xa24c('0x17')](respondWithResult(_0x537849,null))[_0xa24c('0x1b')](handleError(_0x537849,null));};exports[_0xa24c('0x40')]=function(_0x1fa739,_0x3f3ce6){return respondWithRpcPromise(_0xa24c('0x41'),_0x1fa739[_0xa24c('0x16')])[_0xa24c('0x17')](respondWithResult(_0x3f3ce6,null))['catch'](handleError(_0x3f3ce6,null));};exports[_0xa24c('0x42')]=function(_0x2759c1,_0x233f8e){return respondWithRpcPromise('Trunks',_0x2759c1['query'])['then'](respondWithResult(_0x233f8e,null))[_0xa24c('0x1b')](handleError(_0x233f8e,null));};exports['campaigns']=function(_0x4757ff,_0x21d0fc){return respondWithRpcPromise('Campaigns',_0x4757ff[_0xa24c('0x16')])[_0xa24c('0x17')](respondWithResult(_0x21d0fc,null))[_0xa24c('0x1b')](handleError(_0x21d0fc,null));};exports[_0xa24c('0x43')]=function(_0x162a11,_0x3a72e3){return respondWithRpcPromise(_0xa24c('0x44'),_0x162a11[_0xa24c('0x16')],routingClient)['then'](respondWithResult(_0x3a72e3,null))[_0xa24c('0x1b')](handleError(_0x3a72e3,null));};exports['showChatQueues']=function(_0x5abd45,_0x565f0a){return respondWithRpcPromise('ChatQueues',_0x5abd45['query'],routingClient)[_0xa24c('0x17')](findById(_0x5abd45['params']['id']))[_0xa24c('0x17')](respondWithResult(_0x565f0a,null))[_0xa24c('0x1b')](handleError(_0x565f0a,null));};exports[_0xa24c('0x45')]=function(_0x1a5f17,_0xa371d2){return respondWithRpcPromise(_0xa24c('0x46'),_0x1a5f17[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](respondWithResult(_0xa371d2,null))[_0xa24c('0x1b')](handleError(_0xa371d2,null));};exports[_0xa24c('0x47')]=function(_0x303b7d,_0x37dbbd){return respondWithRpcPromise(_0xa24c('0x46'),_0x303b7d[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](findById(_0x303b7d['params']['id']))[_0xa24c('0x17')](respondWithResult(_0x37dbbd,null))[_0xa24c('0x1b')](handleError(_0x37dbbd,null));};exports['mailAccounts']=function(_0x1e08bb,_0x179ae1){return respondWithRpcPromise(_0xa24c('0x48'),_0x1e08bb[_0xa24c('0x16')],mailClient)['then'](respondWithResult(_0x179ae1,null))['catch'](handleError(_0x179ae1,null));};exports[_0xa24c('0x49')]=function(_0x5e9631,_0x486040){return respondWithRpcPromise(_0xa24c('0x4a'),_0x5e9631[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](respondWithResult(_0x486040,null))[_0xa24c('0x1b')](handleError(_0x486040,null));};exports['showOpenchannelQueues']=function(_0x48a7b2,_0x29b836){return respondWithRpcPromise('OpenchannelQueues',_0x48a7b2['query'],routingClient)[_0xa24c('0x17')](findById(_0x48a7b2[_0xa24c('0x1a')]['id']))[_0xa24c('0x17')](respondWithResult(_0x29b836,null))['catch'](handleError(_0x29b836,null));};exports[_0xa24c('0x4b')]=function(_0x128e5b,_0x5c3285){return respondWithRpcPromise(_0xa24c('0x4c'),_0x128e5b[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](respondWithResult(_0x5c3285,null))['catch'](handleError(_0x5c3285,null));};exports[_0xa24c('0x4d')]=function(_0x34e261,_0x21439a){return respondWithRpcPromise(_0xa24c('0x4c'),_0x34e261[_0xa24c('0x16')],routingClient)['then'](findById(_0x34e261[_0xa24c('0x1a')]['id']))[_0xa24c('0x17')](respondWithResult(_0x21439a,null))[_0xa24c('0x1b')](handleError(_0x21439a,null));};exports[_0xa24c('0x4e')]=function(_0xab5260,_0x2ca3fa){return respondWithRpcPromise(_0xa24c('0x4f'),_0xab5260['query'],routingClient)[_0xa24c('0x17')](respondWithResult(_0x2ca3fa,null))[_0xa24c('0x1b')](handleError(_0x2ca3fa,null));};exports['showWhatsappQueues']=function(_0xb1048a,_0x3e455b){return respondWithRpcPromise(_0xa24c('0x4f'),_0xb1048a[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](findById(_0xb1048a[_0xa24c('0x1a')]['id']))[_0xa24c('0x17')](respondWithResult(_0x3e455b,null))[_0xa24c('0x1b')](handleError(_0x3e455b,null));};exports[_0xa24c('0x50')]=function(_0x32ddc3,_0x50141e){return respondWithRpcPromise(_0xa24c('0x51'),_0x32ddc3[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](respondWithResult(_0x50141e,null))['catch'](handleError(_0x50141e,null));};exports[_0xa24c('0x52')]=function(_0xfd57fb,_0x2cc592){return respondWithRpcPromise('FaxQueues',_0xfd57fb[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](findById(_0xfd57fb[_0xa24c('0x1a')]['id']))[_0xa24c('0x17')](respondWithResult(_0x2cc592,null))[_0xa24c('0x1b')](handleError(_0x2cc592,null));};exports[_0xa24c('0x53')]=function(_0x4f9b56,_0x4c374d){return respondWithRpcPromise(_0xa24c('0x54'),_0x4f9b56['query'])[_0xa24c('0x17')](respondWithResult(_0x4c374d,null))[_0xa24c('0x1b')](handleError(_0x4c374d,null));};exports[_0xa24c('0x55')]=function(_0x4073c5,_0x12d715){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x4073c5[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](respondWithResult(_0x12d715,null))[_0xa24c('0x1b')](handleError(_0x12d715,null));};exports[_0xa24c('0x56')]=function(_0x987aca,_0x389c08){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x987aca[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](respondWithResult(_0x389c08,null))[_0xa24c('0x1b')](handleError(_0x389c08,null));};exports[_0xa24c('0x57')]=function(_0x5ebdd1,_0x403bf1){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x5ebdd1[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](respondWithResult(_0x403bf1,null))[_0xa24c('0x1b')](handleError(_0x403bf1,null));};exports[_0xa24c('0x58')]=function(_0x5726e1,_0x2e612d){return respondWithRpcPromise(_0xa24c('0x59'),_0x5726e1['query'],routingClient)[_0xa24c('0x17')](function(_0x168a8b){if(_0x5726e1[_0xa24c('0x16')][_0xa24c('0x5a')]!==undefined){var _0x8bd3fb=_(_0x168a8b[_0xa24c('0x13')])[_0xa24c('0x5b')]([_0x5726e1[_0xa24c('0x16')]['type'],_0x5726e1[_0xa24c('0x1a')]['id']])[_0xa24c('0x5c')](_0xa24c('0x5d'))[_0xa24c('0x5e')]()[_0xa24c('0x5f')]();return _0x168a8b[_0xa24c('0x13')][_0xa24c('0x5b')](function(_0x13dbef){return _0x8bd3fb[_0xa24c('0x60')](_0x13dbef[_0xa24c('0x5d')])>-0x1;});}else{return _0x168a8b[_0xa24c('0x13')]['filter'](function(_0x283c5b){return _0x283c5b[_0xa24c('0x5d')]===parseInt(_0x5726e1['params']['id']);});}})[_0xa24c('0x17')](respondWithResult(_0x2e612d,null))[_0xa24c('0x1b')](handleError(_0x2e612d,null));};exports[_0xa24c('0x61')]=function(_0x4f0f11,_0x5b4468){return respondWithRpcPromise(_0xa24c('0x62'),_0x4f0f11[_0xa24c('0x16')],routingClient)['then'](respondWithResult(_0x5b4468,null))[_0xa24c('0x1b')](handleError(_0x5b4468,null));};exports[_0xa24c('0x63')]=function(_0x106178,_0x27a666){return respondWithRpcPromise(_0xa24c('0x64'),_0x106178[_0xa24c('0x16')],routingClient)['then'](respondWithResult(_0x27a666,null))['catch'](handleError(_0x27a666,null));};exports['faxQueuesWaitingInteractions']=function(_0x263dab,_0x521894){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x263dab[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](respondWithResult(_0x521894,null))[_0xa24c('0x1b')](handleError(_0x521894,null));};exports[_0xa24c('0x65')]=function(_0x84ddcc){return function(_0x45b2fe,_0x16f93a){var _0x170b65,_0x2544fc;var _0x4ee10d=_[_0xa24c('0x66')](_0x84ddcc);var _0xa077c8=_0x84ddcc===_0xa24c('0x67')?_0xa24c('0x68'):_0xa24c('0x69');return db[_0x4ee10d+_0xa24c('0x6a')][_0xa24c('0x6b')]({'raw':!![],'where':{'id':_0x45b2fe[_0xa24c('0x1a')]['id']}})[_0xa24c('0x17')](function(_0x3c5495){if(_[_0xa24c('0x12')](_0x3c5495)){throw new Error(_0x4ee10d+_0xa24c('0x6c'));}_0x170b65=_0x3c5495;return db[_0x4ee10d+'Message'][_0xa24c('0x6b')]({'where':{'id':_0x45b2fe[_0xa24c('0x1f')]['messageId']},'include':[{'model':db[_0x4ee10d+_0xa24c('0x6d')],'as':_0xa24c('0x6d')},{'model':db[_0x4ee10d+_0xa077c8],'as':_0xa24c('0x69')}]});})['then'](function(_0x549e07){if(_[_0xa24c('0x12')](_0x549e07)){throw new Error(_0x4ee10d+'\x20Message\x20not\x20found');}_0x2544fc=_0x549e07;return _0x549e07[_0xa24c('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0xa24c('0x17')](function(){var _0x4c108f={'uniqueid':_0x84ddcc+'.'+_0x2544fc['id']+'.'+_0x2544fc['Interaction']['id'],'FromUserId':_0x45b2fe[_0xa24c('0x2f')]['id'],'type':_0xa24c('0x6f')};_0x4c108f[_0x4ee10d+_0xa24c('0x70')]=_0x2544fc['id'];_0x4c108f[_0x4ee10d+_0xa24c('0x71')]=_0x2544fc['Interaction']['id'];_0x4c108f[_0xa24c('0x72')+_0x4ee10d+_0xa077c8+'Id']=_0x2544fc[_0xa24c('0x69')]['id'];_0x4c108f['To'+_0x4ee10d+_0xa24c('0x73')]=_0x170b65['id'];return db[_0x4ee10d+'TransferReport']['create'](_0x4c108f);})[_0xa24c('0x17')](function(){return respondWithRpcPromise(_0xa24c('0x74'),{'channel':_0x84ddcc,'interaction':_0x2544fc[_0xa24c('0x6d')],'message':_0x2544fc,'account':_0x2544fc['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x170b65[_0xa24c('0x30')]+','+(_0x2544fc['Account']['queueTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xa24c('0x17')](respondWithResult(_0x16f93a,null))[_0xa24c('0x1b')](handleError(_0x16f93a,null));};};exports[_0xa24c('0x75')]=function(_0xd23eb3,_0x890e15){var _0x12836d,_0x280fa2;if(_[_0xa24c('0x12')](_0xd23eb3[_0xa24c('0x1f')][_0xa24c('0x76')])){throw new Error(_0xa24c('0x77'));}var _0x24b28c=_0xd23eb3['body'][_0xa24c('0x76')];var _0x292c22=_['capitalize'](_0x24b28c);var _0x2fd4a2=_0x24b28c==='chat'?'Website':'Account';return db[_0xa24c('0x78')]['findOne']({'raw':!![],'where':{'id':_0xd23eb3[_0xa24c('0x1a')]['id'],'role':'agent'}})[_0xa24c('0x17')](function(_0x144c3b){if(_['isNil'](_0x144c3b)){throw new Error(_0xa24c('0x79'));}_0x12836d=_0x144c3b;return db[_0x292c22+'Message'][_0xa24c('0x6b')]({'where':{'id':_0xd23eb3[_0xa24c('0x1f')][_0xa24c('0x7a')]},'include':[{'model':db[_0x292c22+_0xa24c('0x6d')],'as':_0xa24c('0x6d')},{'model':db[_0x292c22+_0x2fd4a2],'as':'Account'}]});})[_0xa24c('0x17')](function(_0x5774d2){if(_[_0xa24c('0x12')](_0x5774d2)){throw new Error(_0x292c22+_0xa24c('0x7b'));}_0x280fa2=_0x5774d2;return _0x5774d2[_0xa24c('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0xa24c('0x17')](function(){var _0x4b848d={'uniqueid':_0x24b28c+'.'+_0x280fa2['id']+'.'+_0x280fa2[_0xa24c('0x6d')]['id'],'FromUserId':_0xd23eb3[_0xa24c('0x2f')]['id'],'type':_0xa24c('0x6f'),'ToUserId':_0x12836d['id']};_0x4b848d[_0x292c22+_0xa24c('0x70')]=_0x280fa2['id'];_0x4b848d[_0x292c22+'InteractionId']=_0x280fa2[_0xa24c('0x6d')]['id'];_0x4b848d[_0xa24c('0x72')+_0x292c22+_0x2fd4a2+'Id']=_0x280fa2[_0xa24c('0x69')]['id'];return db[_0x292c22+_0xa24c('0x7c')][_0xa24c('0x7d')](_0x4b848d);})[_0xa24c('0x17')](function(){return respondWithRpcPromise(_0xa24c('0x74'),{'channel':_0x24b28c,'interaction':_0x280fa2[_0xa24c('0x6d')],'message':_0x280fa2,'account':_0x280fa2[_0xa24c('0x69')],'applications':[{'id':0x0,'priority':0x1,'app':_0xa24c('0x3c'),'appdata':_0x12836d[_0xa24c('0x30')]+','+(_0x280fa2[_0xa24c('0x69')][_0xa24c('0x7e')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xa24c('0x17')](respondWithResult(_0x890e15,null))[_0xa24c('0x1b')](handleError(_0x890e15,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index eda382e..1d2dd86 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 _0x5b34=['isAuthenticated','/:id','show','/:id/run','run','post','create','update','delete','destroy','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get'];(function(_0x4450b1,_0x214ace){var _0x399b0b=function(_0x2197df){while(--_0x2197df){_0x4450b1['push'](_0x4450b1['shift']());}};_0x399b0b(++_0x214ace);}(_0x5b34,0x1c2));var _0x45b3=function(_0x5216b4,_0x2f11f0){_0x5216b4=_0x5216b4-0x0;var _0x2a0215=_0x5b34[_0x5216b4];return _0x2a0215;};'use strict';var multer=require(_0x45b3('0x0'));var util=require(_0x45b3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x45b3('0x2'));var router=express[_0x45b3('0x3')]();var fs_extra=require(_0x45b3('0x4'));var auth=require(_0x45b3('0x5'));var interaction=require(_0x45b3('0x6'));var config=require(_0x45b3('0x7'));var controller=require(_0x45b3('0x8'));router[_0x45b3('0x9')]('/',auth[_0x45b3('0xa')](),controller['index']);router[_0x45b3('0x9')](_0x45b3('0xb'),auth[_0x45b3('0xa')](),controller[_0x45b3('0xc')]);router[_0x45b3('0x9')](_0x45b3('0xd'),auth['isAuthenticated'](),controller[_0x45b3('0xe')]);router[_0x45b3('0xf')]('/',auth['isAuthenticated'](),controller[_0x45b3('0x10')]);router['put'](_0x45b3('0xb'),auth['isAuthenticated'](),controller[_0x45b3('0x11')]);router[_0x45b3('0x12')](_0x45b3('0xb'),auth[_0x45b3('0xa')](),controller[_0x45b3('0x13')]);module['exports']=router; \ No newline at end of file +var _0xb2ff=['show','run','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','isAuthenticated','index','get','/:id'];(function(_0x3f44b3,_0x6317e6){var _0x3a7ed1=function(_0x32ae91){while(--_0x32ae91){_0x3f44b3['push'](_0x3f44b3['shift']());}};_0x3a7ed1(++_0x6317e6);}(_0xb2ff,0xb0));var _0xfb2f=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xb2ff[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0xfb2f('0x0'));var util=require(_0xfb2f('0x1'));var path=require('path');var timeout=require(_0xfb2f('0x2'));var express=require(_0xfb2f('0x3'));var router=express['Router']();var fs_extra=require(_0xfb2f('0x4'));var auth=require(_0xfb2f('0x5'));var interaction=require(_0xfb2f('0x6'));var config=require(_0xfb2f('0x7'));var controller=require(_0xfb2f('0x8'));router['get']('/',auth[_0xfb2f('0x9')](),controller[_0xfb2f('0xa')]);router[_0xfb2f('0xb')](_0xfb2f('0xc'),auth[_0xfb2f('0x9')](),controller[_0xfb2f('0xd')]);router[_0xfb2f('0xb')]('/:id/run',auth[_0xfb2f('0x9')](),controller[_0xfb2f('0xe')]);router[_0xfb2f('0xf')]('/',auth['isAuthenticated'](),controller[_0xfb2f('0x10')]);router[_0xfb2f('0x11')](_0xfb2f('0xc'),auth['isAuthenticated'](),controller[_0xfb2f('0x12')]);router[_0xfb2f('0x13')](_0xfb2f('0xc'),auth[_0xfb2f('0x9')](),controller[_0xfb2f('0x14')]);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 0bae8d7..352cb09 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 _0x6709=['csv','custom','default','TEXT','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','ENUM','years','months','weeks','hours','minutes','days','pdf','xlsx'];(function(_0x1bd511,_0x1af18b){var _0x164c3a=function(_0x2a682b){while(--_0x2a682b){_0x1bd511['push'](_0x1bd511['shift']());}};_0x164c3a(++_0x1af18b);}(_0x6709,0xa6));var _0x9670=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0x6709[_0x3c8e9a];return _0x2d4c57;};'use strict';var Sequelize=require('sequelize');module[_0x9670('0x0')]={'name':{'type':Sequelize[_0x9670('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x9670('0x1')]},'active':{'type':Sequelize[_0x9670('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x9670('0x1')],'allowNull':![],'defaultValue':_0x9670('0x3')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x9670('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x9670('0x5')](_0x9670('0x6'),'quarters',_0x9670('0x7'),_0x9670('0x8'),'days',_0x9670('0x9'),_0x9670('0xa')),'allowNull':![],'defaultValue':_0x9670('0xb')},'output':{'type':Sequelize[_0x9670('0x5')]('csv',_0x9670('0xc'),_0x9670('0xd')),'allowNull':![],'defaultValue':_0x9670('0xe')},'type':{'type':Sequelize['ENUM'](_0x9670('0xf'),_0x9670('0x10')),'allowNull':![],'defaultValue':_0x9670('0xf')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x9670('0x1')]},'cc':{'type':Sequelize[_0x9670('0x11')]},'bcc':{'type':Sequelize[_0x9670('0x11')]},'sendIfEmpty':{'type':Sequelize[_0x9670('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x44ea=['INTEGER','ENUM','years','quarters','months','days','hours','minutes','csv','pdf','xlsx','custom','TEXT','exports','STRING','BOOLEAN','DATE'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x44ea,0x12e));var _0xa44e=function(_0x4b6c4b,_0x3eefa4){_0x4b6c4b=_0x4b6c4b-0x0;var _0x2a2052=_0x44ea[_0x4b6c4b];return _0x2a2052;};'use strict';var Sequelize=require('sequelize');module[_0xa44e('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xa44e('0x1')]},'active':{'type':Sequelize[_0xa44e('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xa44e('0x1')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0xa44e('0x3')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xa44e('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xa44e('0x5')](_0xa44e('0x6'),_0xa44e('0x7'),_0xa44e('0x8'),'weeks',_0xa44e('0x9'),_0xa44e('0xa'),_0xa44e('0xb')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0xa44e('0x5')](_0xa44e('0xc'),_0xa44e('0xd'),_0xa44e('0xe')),'allowNull':![],'defaultValue':_0xa44e('0xc')},'type':{'type':Sequelize[_0xa44e('0x5')](_0xa44e('0xf'),'default'),'allowNull':![],'defaultValue':_0xa44e('0xf')},'sendMail':{'type':Sequelize[_0xa44e('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xa44e('0x1')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0xa44e('0x10')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 2d3b5e5..cccb27f 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 _0xf4ea=['../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','set','apply','reject','save','update','then','destroy','UserProfileResource','end','error','name','index','Schedule','fieldName','type','key','map','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','sort','where','pick','filters','filter','merge','VIRTUAL','options','count','includeAll','findAll','catch','show','params','include','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Scheduler','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','run','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment'];(function(_0x18b232,_0x3cd1e9){var _0x303efe=function(_0xac931d){while(--_0xac931d){_0x18b232['push'](_0x18b232['shift']());}};_0x303efe(++_0x3cd1e9);}(_0xf4ea,0x13f));var _0xaf4e=function(_0x4513e8,_0x16f480){_0x4513e8=_0x4513e8-0x0;var _0x1e8758=_0xf4ea[_0x4513e8];return _0x1e8758;};'use strict';var emlformat=require(_0xaf4e('0x0'));var rimraf=require(_0xaf4e('0x1'));var zipdir=require(_0xaf4e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf4e('0x3'));var moment=require(_0xaf4e('0x4'));var BPromise=require(_0xaf4e('0x5'));var Mustache=require(_0xaf4e('0x6'));var util=require('util');var path=require(_0xaf4e('0x7'));var sox=require(_0xaf4e('0x8'));var csv=require(_0xaf4e('0x9'));var ejs=require(_0xaf4e('0xa'));var fs=require('fs');var fs_extra=require(_0xaf4e('0xb'));var _=require(_0xaf4e('0xc'));var squel=require(_0xaf4e('0xd'));var crypto=require(_0xaf4e('0xe'));var jsforce=require(_0xaf4e('0xf'));var deskjs=require(_0xaf4e('0x10'));var toCsv=require(_0xaf4e('0x9'));var querystring=require(_0xaf4e('0x11'));var Papa=require(_0xaf4e('0x12'));var Redis=require(_0xaf4e('0x13'));var authService=require(_0xaf4e('0x14'));var qs=require(_0xaf4e('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xaf4e('0x16'))('api');var utils=require(_0xaf4e('0x17'));var config=require(_0xaf4e('0x18'));var licenseUtil=require(_0xaf4e('0x19'));var db=require(_0xaf4e('0x1a'))['db'];function respondWithStatusCode(_0x409a88,_0x167e07){_0x167e07=_0x167e07||0xcc;return function(_0x1c62f8){if(_0x1c62f8){return _0x409a88[_0xaf4e('0x1b')](_0x167e07);}return _0x409a88[_0xaf4e('0x1c')](_0x167e07)['end']();};}function respondWithResult(_0x2f9f03,_0x498f1e){_0x498f1e=_0x498f1e||0xc8;return function(_0x4f7990){if(_0x4f7990){return _0x2f9f03[_0xaf4e('0x1c')](_0x498f1e)[_0xaf4e('0x1d')](_0x4f7990);}};}function respondWithFilteredResult(_0x56d424,_0x10f0e1){return function(_0x160f9d){if(_0x160f9d){var _0x1ce533=typeof _0x10f0e1['offset']===_0xaf4e('0x1e')&&typeof _0x10f0e1[_0xaf4e('0x1f')]===_0xaf4e('0x1e');var _0x46e523=_0x160f9d['count'];var _0x2ae6ba=_0x1ce533?0x0:_0x10f0e1[_0xaf4e('0x20')];var _0x443b77=_0x1ce533?_0x160f9d['count']:_0x10f0e1[_0xaf4e('0x20')]+_0x10f0e1[_0xaf4e('0x1f')];var _0x2426c4;if(_0x443b77>=_0x46e523){_0x443b77=_0x46e523;_0x2426c4=0xc8;}else{_0x2426c4=0xce;}_0x56d424[_0xaf4e('0x1c')](_0x2426c4);return _0x56d424[_0xaf4e('0x21')]('Content-Range',_0x2ae6ba+'-'+_0x443b77+'/'+_0x46e523)[_0xaf4e('0x1d')](_0x160f9d);}return null;};}function patchUpdates(_0x4f1689){return function(_0x58bd1c){try{jsonpatch[_0xaf4e('0x22')](_0x58bd1c,_0x4f1689,!![]);}catch(_0x2fe59f){return BPromise[_0xaf4e('0x23')](_0x2fe59f);}return _0x58bd1c[_0xaf4e('0x24')]();};}function saveUpdates(_0x148634,_0x33c4a8){return function(_0x373123){if(_0x373123){return _0x373123[_0xaf4e('0x25')](_0x148634)[_0xaf4e('0x26')](function(_0x2bfb2c){return _0x2bfb2c;});}return null;};}function removeEntity(_0x3bc8af,_0x50f71a){return function(_0x39edbb){if(_0x39edbb){return _0x39edbb[_0xaf4e('0x27')]()[_0xaf4e('0x26')](function(){var _0x13288b=_0x39edbb['get']({'plain':!![]});var _0x1f7fb9='Scheduler';return db[_0xaf4e('0x28')][_0xaf4e('0x27')]({'where':{'type':_0x1f7fb9,'resourceId':_0x13288b['id']}})[_0xaf4e('0x26')](function(){return _0x39edbb;});})[_0xaf4e('0x26')](function(){_0x3bc8af[_0xaf4e('0x1c')](0xcc)[_0xaf4e('0x29')]();});}};}function handleEntityNotFound(_0xe31f2a,_0x2db1c7){return function(_0x46ddf9){if(!_0x46ddf9){_0xe31f2a[_0xaf4e('0x1b')](0x194);}return _0x46ddf9;};}function handleError(_0x451bf9,_0x194456){_0x194456=_0x194456||0x1f4;return function(_0x2ec924){logger[_0xaf4e('0x2a')](_0x2ec924['stack']);if(_0x2ec924[_0xaf4e('0x2b')]){delete _0x2ec924[_0xaf4e('0x2b')];}_0x451bf9[_0xaf4e('0x1c')](_0x194456)['send'](_0x2ec924);};}exports[_0xaf4e('0x2c')]=function(_0x11c055,_0x25701b){var _0x3d05aa={},_0x107b95={},_0x44f4cd={'count':0x0,'rows':[]};var _0x476c73=_['map'](db[_0xaf4e('0x2d')]['rawAttributes'],function(_0x4d00e5){return{'name':_0x4d00e5[_0xaf4e('0x2e')],'type':_0x4d00e5[_0xaf4e('0x2f')][_0xaf4e('0x30')]};});_0x107b95['model']=_[_0xaf4e('0x31')](_0x476c73,_0xaf4e('0x2b'));_0x107b95[_0xaf4e('0x32')]=_[_0xaf4e('0x33')](_0x11c055['query']);_0x107b95['filters']=_[_0xaf4e('0x34')](_0x107b95['model'],_0x107b95['query']);_0x3d05aa[_0xaf4e('0x35')]=_['intersection'](_0x107b95[_0xaf4e('0x36')],qs[_0xaf4e('0x37')](_0x11c055[_0xaf4e('0x32')][_0xaf4e('0x37')]));_0x3d05aa[_0xaf4e('0x35')]=_0x3d05aa[_0xaf4e('0x35')][_0xaf4e('0x38')]?_0x3d05aa[_0xaf4e('0x35')]:_0x107b95[_0xaf4e('0x36')];if(!_0x11c055['query'][_0xaf4e('0x39')]('nolimit')){_0x3d05aa[_0xaf4e('0x1f')]=qs[_0xaf4e('0x1f')](_0x11c055[_0xaf4e('0x32')][_0xaf4e('0x1f')]);_0x3d05aa[_0xaf4e('0x20')]=qs[_0xaf4e('0x20')](_0x11c055[_0xaf4e('0x32')][_0xaf4e('0x20')]);}_0x3d05aa['order']=qs['sort'](_0x11c055[_0xaf4e('0x32')][_0xaf4e('0x3a')]);_0x3d05aa[_0xaf4e('0x3b')]=qs['filters'](_[_0xaf4e('0x3c')](_0x11c055[_0xaf4e('0x32')],_0x107b95[_0xaf4e('0x3d')]),_0x476c73);if(_0x11c055[_0xaf4e('0x32')][_0xaf4e('0x3e')]){_0x3d05aa[_0xaf4e('0x3b')]=_[_0xaf4e('0x3f')](_0x3d05aa[_0xaf4e('0x3b')],{'$or':_[_0xaf4e('0x31')](_0x476c73,function(_0x31ee71){if(_0x31ee71['type']!==_0xaf4e('0x40')){var _0x11bb49={};_0x11bb49[_0x31ee71['name']]={'$like':'%'+_0x11c055[_0xaf4e('0x32')]['filter']+'%'};return _0x11bb49;}})});}_0x3d05aa=_[_0xaf4e('0x3f')]({},_0x3d05aa,_0x11c055[_0xaf4e('0x41')]);var _0x5c410f={'where':_0x3d05aa[_0xaf4e('0x3b')]};return db[_0xaf4e('0x2d')][_0xaf4e('0x42')](_0x5c410f)['then'](function(_0x4341f2){_0x44f4cd[_0xaf4e('0x42')]=_0x4341f2;if(_0x11c055[_0xaf4e('0x32')][_0xaf4e('0x43')]){_0x3d05aa['include']=[{'all':!![]}];}return db['Schedule'][_0xaf4e('0x44')](_0x3d05aa);})[_0xaf4e('0x26')](function(_0x5481d7){_0x44f4cd['rows']=_0x5481d7;return _0x44f4cd;})[_0xaf4e('0x26')](respondWithFilteredResult(_0x25701b,_0x3d05aa))[_0xaf4e('0x45')](handleError(_0x25701b,null));};exports[_0xaf4e('0x46')]=function(_0x4c1b49,_0x2fc7dd){var _0x30a459={'raw':![],'where':{'id':_0x4c1b49[_0xaf4e('0x47')]['id']}},_0x565f9e={};_0x565f9e['model']=_[_0xaf4e('0x33')](db['Schedule']['rawAttributes']);_0x565f9e[_0xaf4e('0x32')]=_[_0xaf4e('0x33')](_0x4c1b49[_0xaf4e('0x32')]);_0x565f9e['filters']=_[_0xaf4e('0x34')](_0x565f9e[_0xaf4e('0x36')],_0x565f9e['query']);_0x30a459[_0xaf4e('0x35')]=_['intersection'](_0x565f9e[_0xaf4e('0x36')],qs['fields'](_0x4c1b49['query']['fields']));_0x30a459[_0xaf4e('0x35')]=_0x30a459[_0xaf4e('0x35')][_0xaf4e('0x38')]?_0x30a459[_0xaf4e('0x35')]:_0x565f9e[_0xaf4e('0x36')];if(_0x4c1b49[_0xaf4e('0x32')][_0xaf4e('0x43')]){_0x30a459[_0xaf4e('0x48')]=[{'all':!![]}];}_0x30a459=_['merge']({},_0x30a459,_0x4c1b49[_0xaf4e('0x41')]);return db[_0xaf4e('0x2d')][_0xaf4e('0x49')](_0x30a459)[_0xaf4e('0x26')](handleEntityNotFound(_0x2fc7dd,null))[_0xaf4e('0x26')](respondWithResult(_0x2fc7dd,null))[_0xaf4e('0x45')](handleError(_0x2fc7dd,null));};exports[_0xaf4e('0x4a')]=function(_0x1e5369,_0x5825ed){return db[_0xaf4e('0x2d')][_0xaf4e('0x4a')](_0x1e5369['body'],{})[_0xaf4e('0x26')](function(_0x478f88){var _0x91a821=_0x1e5369['user'][_0xaf4e('0x4b')]({'plain':!![]});if(!_0x91a821)throw new Error(_0xaf4e('0x4c'));if(_0x91a821[_0xaf4e('0x4d')]===_0xaf4e('0x4e')){var _0x1aaff0=_0x478f88[_0xaf4e('0x4b')]({'plain':!![]});var _0x1f4957=_0xaf4e('0x4f');return db[_0xaf4e('0x50')][_0xaf4e('0x49')]({'where':{'name':_0x1f4957,'userProfileId':_0x91a821[_0xaf4e('0x51')]},'raw':!![]})[_0xaf4e('0x26')](function(_0x35ecc0){if(_0x35ecc0&&_0x35ecc0[_0xaf4e('0x52')]===0x0){return db[_0xaf4e('0x28')][_0xaf4e('0x4a')]({'name':_0x1aaff0[_0xaf4e('0x2b')],'resourceId':_0x1aaff0['id'],'type':_0x35ecc0[_0xaf4e('0x2b')],'sectionId':_0x35ecc0['id']},{})[_0xaf4e('0x26')](function(){return _0x478f88;});}else{return _0x478f88;}})[_0xaf4e('0x45')](function(_0x32d6a6){logger['error'](_0xaf4e('0x53'),_0x32d6a6);throw _0x32d6a6;});}return _0x478f88;})[_0xaf4e('0x26')](respondWithResult(_0x5825ed,0xc9))[_0xaf4e('0x45')](handleError(_0x5825ed,null));};exports[_0xaf4e('0x25')]=function(_0x230189,_0x10d418){if(_0x230189[_0xaf4e('0x54')]['id']){delete _0x230189[_0xaf4e('0x54')]['id'];}return db['Schedule']['find']({'where':{'id':_0x230189[_0xaf4e('0x47')]['id']}})[_0xaf4e('0x26')](handleEntityNotFound(_0x10d418,null))[_0xaf4e('0x26')](saveUpdates(_0x230189[_0xaf4e('0x54')],null))[_0xaf4e('0x26')](respondWithResult(_0x10d418,null))[_0xaf4e('0x45')](handleError(_0x10d418,null));};exports[_0xaf4e('0x27')]=function(_0x2327c1,_0x49b54a){return db[_0xaf4e('0x2d')]['find']({'where':{'id':_0x2327c1['params']['id']}})[_0xaf4e('0x26')](handleEntityNotFound(_0x49b54a,null))[_0xaf4e('0x26')](removeEntity(_0x49b54a,null))[_0xaf4e('0x45')](handleError(_0x49b54a,null));};exports[_0xaf4e('0x55')]=function(_0x59791f,_0x732a78,_0x4fc138){var _0x3b5448=require('../../config/schedule');return db[_0xaf4e('0x2d')]['find']({'where':{'id':_0x59791f[_0xaf4e('0x47')]['id']},'raw':!![]})[_0xaf4e('0x26')](handleEntityNotFound(_0x732a78,null))[_0xaf4e('0x26')](function(){_0x3b5448['run'](_0x59791f[_0xaf4e('0x47')]['id']);})[_0xaf4e('0x26')](respondWithStatusCode(_0x732a78,null))[_0xaf4e('0x45')](handleError(_0x732a78,null));}; \ No newline at end of file +var _0x0435=['keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','params','../../config/schedule','run','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','set','reject','save','update','destroy','then','get','Scheduler','UserProfileResource','end','stack','name','send','index','Schedule','rawAttributes','fieldName','type','key','model','map'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x0435,0x11c));var _0x5043=function(_0x1d3da4,_0x410e79){_0x1d3da4=_0x1d3da4-0x0;var _0x146c32=_0x0435[_0x1d3da4];return _0x146c32;};'use strict';var emlformat=require(_0x5043('0x0'));var rimraf=require(_0x5043('0x1'));var zipdir=require(_0x5043('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5043('0x3'));var moment=require('moment');var BPromise=require(_0x5043('0x4'));var Mustache=require(_0x5043('0x5'));var util=require(_0x5043('0x6'));var path=require(_0x5043('0x7'));var sox=require(_0x5043('0x8'));var csv=require(_0x5043('0x9'));var ejs=require(_0x5043('0xa'));var fs=require('fs');var fs_extra=require(_0x5043('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5043('0xc'));var jsforce=require(_0x5043('0xd'));var deskjs=require(_0x5043('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5043('0xf'));var Papa=require(_0x5043('0x10'));var Redis=require(_0x5043('0x11'));var authService=require(_0x5043('0x12'));var qs=require(_0x5043('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5043('0x14'));var logger=require(_0x5043('0x15'))(_0x5043('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5043('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e9531,_0x5094a4){_0x5094a4=_0x5094a4||0xcc;return function(_0x5a2719){if(_0x5a2719){return _0x2e9531[_0x5043('0x18')](_0x5094a4);}return _0x2e9531[_0x5043('0x19')](_0x5094a4)['end']();};}function respondWithResult(_0x5981a1,_0x5cd6fc){_0x5cd6fc=_0x5cd6fc||0xc8;return function(_0x5e1ae9){if(_0x5e1ae9){return _0x5981a1[_0x5043('0x19')](_0x5cd6fc)[_0x5043('0x1a')](_0x5e1ae9);}};}function respondWithFilteredResult(_0x5541d6,_0x765fbb){return function(_0x5d5e76){if(_0x5d5e76){var _0x477e9c=typeof _0x765fbb[_0x5043('0x1b')]==='undefined'&&typeof _0x765fbb[_0x5043('0x1c')]===_0x5043('0x1d');var _0x16ef33=_0x5d5e76['count'];var _0x4371c8=_0x477e9c?0x0:_0x765fbb[_0x5043('0x1b')];var _0x49f48a=_0x477e9c?_0x5d5e76[_0x5043('0x1e')]:_0x765fbb[_0x5043('0x1b')]+_0x765fbb[_0x5043('0x1c')];var _0x18d004;if(_0x49f48a>=_0x16ef33){_0x49f48a=_0x16ef33;_0x18d004=0xc8;}else{_0x18d004=0xce;}_0x5541d6[_0x5043('0x19')](_0x18d004);return _0x5541d6[_0x5043('0x1f')]('Content-Range',_0x4371c8+'-'+_0x49f48a+'/'+_0x16ef33)['json'](_0x5d5e76);}return null;};}function patchUpdates(_0x38e659){return function(_0x5781ed){try{jsonpatch['apply'](_0x5781ed,_0x38e659,!![]);}catch(_0x5ba261){return BPromise[_0x5043('0x20')](_0x5ba261);}return _0x5781ed[_0x5043('0x21')]();};}function saveUpdates(_0x4b7fb9,_0x28efda){return function(_0x4ab05e){if(_0x4ab05e){return _0x4ab05e[_0x5043('0x22')](_0x4b7fb9)['then'](function(_0x3f4564){return _0x3f4564;});}return null;};}function removeEntity(_0x2e141d,_0x53e55a){return function(_0xa11f3a){if(_0xa11f3a){return _0xa11f3a[_0x5043('0x23')]()[_0x5043('0x24')](function(){var _0x215a8c=_0xa11f3a[_0x5043('0x25')]({'plain':!![]});var _0x30810b=_0x5043('0x26');return db[_0x5043('0x27')][_0x5043('0x23')]({'where':{'type':_0x30810b,'resourceId':_0x215a8c['id']}})['then'](function(){return _0xa11f3a;});})[_0x5043('0x24')](function(){_0x2e141d['status'](0xcc)[_0x5043('0x28')]();});}};}function handleEntityNotFound(_0x1832c7,_0x39fc0d){return function(_0x16bfdf){if(!_0x16bfdf){_0x1832c7[_0x5043('0x18')](0x194);}return _0x16bfdf;};}function handleError(_0x229cec,_0xe1ec4c){_0xe1ec4c=_0xe1ec4c||0x1f4;return function(_0x5290da){logger['error'](_0x5290da[_0x5043('0x29')]);if(_0x5290da[_0x5043('0x2a')]){delete _0x5290da[_0x5043('0x2a')];}_0x229cec[_0x5043('0x19')](_0xe1ec4c)[_0x5043('0x2b')](_0x5290da);};}exports[_0x5043('0x2c')]=function(_0xd8f00b,_0x4f597a){var _0x50eece={},_0x54bca5={},_0x510bfb={'count':0x0,'rows':[]};var _0x4b63e5=_['map'](db[_0x5043('0x2d')][_0x5043('0x2e')],function(_0x180e27){return{'name':_0x180e27[_0x5043('0x2f')],'type':_0x180e27[_0x5043('0x30')][_0x5043('0x31')]};});_0x54bca5[_0x5043('0x32')]=_[_0x5043('0x33')](_0x4b63e5,'name');_0x54bca5['query']=_[_0x5043('0x34')](_0xd8f00b[_0x5043('0x35')]);_0x54bca5[_0x5043('0x36')]=_[_0x5043('0x37')](_0x54bca5[_0x5043('0x32')],_0x54bca5[_0x5043('0x35')]);_0x50eece[_0x5043('0x38')]=_['intersection'](_0x54bca5[_0x5043('0x32')],qs[_0x5043('0x39')](_0xd8f00b[_0x5043('0x35')][_0x5043('0x39')]));_0x50eece[_0x5043('0x38')]=_0x50eece[_0x5043('0x38')][_0x5043('0x3a')]?_0x50eece[_0x5043('0x38')]:_0x54bca5[_0x5043('0x32')];if(!_0xd8f00b[_0x5043('0x35')][_0x5043('0x3b')](_0x5043('0x3c'))){_0x50eece[_0x5043('0x1c')]=qs['limit'](_0xd8f00b[_0x5043('0x35')][_0x5043('0x1c')]);_0x50eece['offset']=qs['offset'](_0xd8f00b[_0x5043('0x35')]['offset']);}_0x50eece['order']=qs[_0x5043('0x3d')](_0xd8f00b[_0x5043('0x35')][_0x5043('0x3d')]);_0x50eece[_0x5043('0x3e')]=qs[_0x5043('0x36')](_[_0x5043('0x3f')](_0xd8f00b[_0x5043('0x35')],_0x54bca5[_0x5043('0x36')]),_0x4b63e5);if(_0xd8f00b[_0x5043('0x35')][_0x5043('0x40')]){_0x50eece[_0x5043('0x3e')]=_[_0x5043('0x41')](_0x50eece[_0x5043('0x3e')],{'$or':_[_0x5043('0x33')](_0x4b63e5,function(_0x1eb3ba){if(_0x1eb3ba[_0x5043('0x30')]!==_0x5043('0x42')){var _0x8130ab={};_0x8130ab[_0x1eb3ba['name']]={'$like':'%'+_0xd8f00b[_0x5043('0x35')][_0x5043('0x40')]+'%'};return _0x8130ab;}})});}_0x50eece=_[_0x5043('0x41')]({},_0x50eece,_0xd8f00b['options']);var _0x374e2f={'where':_0x50eece[_0x5043('0x3e')]};return db['Schedule'][_0x5043('0x1e')](_0x374e2f)[_0x5043('0x24')](function(_0x474fa5){_0x510bfb[_0x5043('0x1e')]=_0x474fa5;if(_0xd8f00b[_0x5043('0x35')][_0x5043('0x43')]){_0x50eece[_0x5043('0x44')]=[{'all':!![]}];}return db[_0x5043('0x2d')][_0x5043('0x45')](_0x50eece);})[_0x5043('0x24')](function(_0x1dc122){_0x510bfb[_0x5043('0x46')]=_0x1dc122;return _0x510bfb;})['then'](respondWithFilteredResult(_0x4f597a,_0x50eece))[_0x5043('0x47')](handleError(_0x4f597a,null));};exports[_0x5043('0x48')]=function(_0x72c84c,_0x4ce729){var _0x232438={'raw':![],'where':{'id':_0x72c84c['params']['id']}},_0x33a4c5={};_0x33a4c5[_0x5043('0x32')]=_[_0x5043('0x34')](db[_0x5043('0x2d')][_0x5043('0x2e')]);_0x33a4c5[_0x5043('0x35')]=_[_0x5043('0x34')](_0x72c84c['query']);_0x33a4c5[_0x5043('0x36')]=_[_0x5043('0x37')](_0x33a4c5[_0x5043('0x32')],_0x33a4c5[_0x5043('0x35')]);_0x232438['attributes']=_['intersection'](_0x33a4c5[_0x5043('0x32')],qs[_0x5043('0x39')](_0x72c84c[_0x5043('0x35')][_0x5043('0x39')]));_0x232438['attributes']=_0x232438[_0x5043('0x38')][_0x5043('0x3a')]?_0x232438[_0x5043('0x38')]:_0x33a4c5[_0x5043('0x32')];if(_0x72c84c[_0x5043('0x35')][_0x5043('0x43')]){_0x232438[_0x5043('0x44')]=[{'all':!![]}];}_0x232438=_[_0x5043('0x41')]({},_0x232438,_0x72c84c[_0x5043('0x49')]);return db['Schedule'][_0x5043('0x4a')](_0x232438)[_0x5043('0x24')](handleEntityNotFound(_0x4ce729,null))['then'](respondWithResult(_0x4ce729,null))[_0x5043('0x47')](handleError(_0x4ce729,null));};exports[_0x5043('0x4b')]=function(_0x31a737,_0x1d87cb){return db[_0x5043('0x2d')][_0x5043('0x4b')](_0x31a737[_0x5043('0x4c')],{})[_0x5043('0x24')](function(_0x26b468){var _0x86a210=_0x31a737['user'][_0x5043('0x25')]({'plain':!![]});if(!_0x86a210)throw new Error(_0x5043('0x4d'));if(_0x86a210[_0x5043('0x4e')]==='user'){var _0x1b0873=_0x26b468[_0x5043('0x25')]({'plain':!![]});var _0xe21fa3='Scheduler';return db[_0x5043('0x4f')][_0x5043('0x4a')]({'where':{'name':_0xe21fa3,'userProfileId':_0x86a210['userProfileId']},'raw':!![]})[_0x5043('0x24')](function(_0x328522){if(_0x328522&&_0x328522[_0x5043('0x50')]===0x0){return db[_0x5043('0x27')]['create']({'name':_0x1b0873[_0x5043('0x2a')],'resourceId':_0x1b0873['id'],'type':_0x328522[_0x5043('0x2a')],'sectionId':_0x328522['id']},{})['then'](function(){return _0x26b468;});}else{return _0x26b468;}})['catch'](function(_0x2be55b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2be55b);throw _0x2be55b;});}return _0x26b468;})[_0x5043('0x24')](respondWithResult(_0x1d87cb,0xc9))[_0x5043('0x47')](handleError(_0x1d87cb,null));};exports['update']=function(_0x3b5dc0,_0x16ffde){if(_0x3b5dc0['body']['id']){delete _0x3b5dc0[_0x5043('0x4c')]['id'];}return db[_0x5043('0x2d')][_0x5043('0x4a')]({'where':{'id':_0x3b5dc0[_0x5043('0x51')]['id']}})['then'](handleEntityNotFound(_0x16ffde,null))[_0x5043('0x24')](saveUpdates(_0x3b5dc0[_0x5043('0x4c')],null))[_0x5043('0x24')](respondWithResult(_0x16ffde,null))[_0x5043('0x47')](handleError(_0x16ffde,null));};exports['destroy']=function(_0x138c71,_0x56d068){return db[_0x5043('0x2d')][_0x5043('0x4a')]({'where':{'id':_0x138c71[_0x5043('0x51')]['id']}})['then'](handleEntityNotFound(_0x56d068,null))[_0x5043('0x24')](removeEntity(_0x56d068,null))['catch'](handleError(_0x56d068,null));};exports['run']=function(_0x919ac7,_0x4a793b,_0x14444d){var _0x1185c1=require(_0x5043('0x52'));return db[_0x5043('0x2d')][_0x5043('0x4a')]({'where':{'id':_0x919ac7[_0x5043('0x51')]['id']},'raw':!![]})[_0x5043('0x24')](handleEntityNotFound(_0x4a793b,null))[_0x5043('0x24')](function(){_0x1185c1[_0x5043('0x53')](_0x919ac7[_0x5043('0x51')]['id']);})[_0x5043('0x24')](respondWithStatusCode(_0x4a793b,null))[_0x5043('0x47')](handleError(_0x4a793b,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 0294c42..39b7a87 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 _0xdaee=['exports','Schedule','tools_schedules','lodash','util','../../config/logger','path','rimraf','../../config/environment','./schedule.attributes'];(function(_0x2ae52b,_0x1dcd1b){var _0x3bc791=function(_0x268c5e){while(--_0x268c5e){_0x2ae52b['push'](_0x2ae52b['shift']());}};_0x3bc791(++_0x1dcd1b);}(_0xdaee,0x16b));var _0xedae=function(_0x3c3a16,_0xcd4f40){_0x3c3a16=_0x3c3a16-0x0;var _0x52d802=_0xdaee[_0x3c3a16];return _0x52d802;};'use strict';var _=require(_0xedae('0x0'));var util=require(_0xedae('0x1'));var logger=require(_0xedae('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xedae('0x3'));var rimraf=require(_0xedae('0x4'));var config=require(_0xedae('0x5'));var attributes=require(_0xedae('0x6'));module[_0xedae('0x7')]=function(_0x2fc184,_0x2dd457){return _0x2fc184['define'](_0xedae('0x8'),attributes,{'tableName':_0xedae('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1032=['api','bluebird','request-promise','path','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','../../config/logger'];(function(_0x1d4507,_0xfe68b4){var _0x2f230e=function(_0x4148a6){while(--_0x4148a6){_0x1d4507['push'](_0x1d4507['shift']());}};_0x2f230e(++_0xfe68b4);}(_0x1032,0xf1));var _0x2103=function(_0x1168ff,_0x6c619){_0x1168ff=_0x1168ff-0x0;var _0x2e7408=_0x1032[_0x1168ff];return _0x2e7408;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2103('0x0'))(_0x2103('0x1'));var moment=require('moment');var BPromise=require(_0x2103('0x2'));var rp=require(_0x2103('0x3'));var fs=require('fs');var path=require(_0x2103('0x4'));var rimraf=require('rimraf');var config=require(_0x2103('0x5'));var attributes=require(_0x2103('0x6'));module[_0x2103('0x7')]=function(_0x45c6a7,_0x26f359){return _0x45c6a7[_0x2103('0x8')](_0x2103('0x9'),attributes,{'tableName':_0x2103('0xa'),'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 cdc8fdb..2b5094e 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 _0x8ced=['util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash'];(function(_0x5b1b21,_0x26c3e8){var _0x4e0d1a=function(_0x5f227b){while(--_0x5f227b){_0x5b1b21['push'](_0x5b1b21['shift']());}};_0x4e0d1a(++_0x26c3e8);}(_0x8ced,0xbc));var _0xd8ce=function(_0x42322d,_0x5567b8){_0x42322d=_0x42322d-0x0;var _0x409906=_0x8ced[_0x42322d];return _0x409906;};'use strict';var _=require(_0xd8ce('0x0'));var util=require(_0xd8ce('0x1'));var moment=require(_0xd8ce('0x2'));var BPromise=require(_0xd8ce('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd8ce('0x4'));var db=require(_0xd8ce('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd8ce('0x6'))(_0xd8ce('0x7'));var config=require(_0xd8ce('0x8'));var jayson=require(_0xd8ce('0x9'));var client=jayson['client'][_0xd8ce('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x42dfd9,_0x4d2255,_0x3b44ea){return new BPromise(function(_0x4b2cb3,_0x2c0dd5){return client['request'](_0x42dfd9,_0x3b44ea)[_0xd8ce('0xb')](function(_0x1e2481){logger['info'](_0xd8ce('0xc'),_0x4d2255,_0xd8ce('0xd'));logger['debug'](_0xd8ce('0xe'),_0x4d2255,_0xd8ce('0xd'),JSON[_0xd8ce('0xf')](_0x1e2481));if(_0x1e2481[_0xd8ce('0x10')]){if(_0x1e2481[_0xd8ce('0x10')]['code']===0x1f4){logger[_0xd8ce('0x10')](_0xd8ce('0xc'),_0x4d2255,_0x1e2481[_0xd8ce('0x10')][_0xd8ce('0x11')]);return _0x2c0dd5(_0x1e2481['error'][_0xd8ce('0x11')]);}logger['error'](_0xd8ce('0xc'),_0x4d2255,_0x1e2481['error'][_0xd8ce('0x11')]);return _0x4b2cb3(_0x1e2481['error'][_0xd8ce('0x11')]);}else{logger[_0xd8ce('0x12')](_0xd8ce('0xc'),_0x4d2255,_0xd8ce('0xd'));_0x4b2cb3(_0x1e2481[_0xd8ce('0x13')][_0xd8ce('0x11')]);}})[_0xd8ce('0x14')](function(_0x17038e){logger['error'](_0xd8ce('0xc'),_0x4d2255,_0x17038e);_0x2c0dd5(_0x17038e);});});} \ No newline at end of file +var _0x9237=['info','Schedule,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x9237,0xe1));var _0x7923=function(_0x2fb87c,_0x2dee49){_0x2fb87c=_0x2fb87c-0x0;var _0x43038b=_0x9237[_0x2fb87c];return _0x43038b;};'use strict';var _=require('lodash');var util=require(_0x7923('0x0'));var moment=require(_0x7923('0x1'));var BPromise=require(_0x7923('0x2'));var rs=require(_0x7923('0x3'));var fs=require('fs');var Redis=require(_0x7923('0x4'));var db=require(_0x7923('0x5'))['db'];var utils=require(_0x7923('0x6'));var logger=require(_0x7923('0x7'))(_0x7923('0x8'));var config=require(_0x7923('0x9'));var jayson=require(_0x7923('0xa'));var client=jayson[_0x7923('0xb')][_0x7923('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x500566,_0x1a65dd,_0x14a08a){return new BPromise(function(_0x71595c,_0x5ae496){return client[_0x7923('0xd')](_0x500566,_0x14a08a)[_0x7923('0xe')](function(_0x10a992){logger[_0x7923('0xf')](_0x7923('0x10'),_0x1a65dd,'request\x20sent');logger[_0x7923('0x11')]('Schedule,\x20%s,\x20%s,\x20%s',_0x1a65dd,_0x7923('0x12'),JSON[_0x7923('0x13')](_0x10a992));if(_0x10a992[_0x7923('0x14')]){if(_0x10a992[_0x7923('0x14')]['code']===0x1f4){logger[_0x7923('0x14')](_0x7923('0x10'),_0x1a65dd,_0x10a992[_0x7923('0x14')][_0x7923('0x15')]);return _0x5ae496(_0x10a992['error']['message']);}logger[_0x7923('0x14')](_0x7923('0x10'),_0x1a65dd,_0x10a992[_0x7923('0x14')][_0x7923('0x15')]);return _0x71595c(_0x10a992[_0x7923('0x14')][_0x7923('0x15')]);}else{logger[_0x7923('0xf')](_0x7923('0x10'),_0x1a65dd,_0x7923('0x12'));_0x71595c(_0x10a992[_0x7923('0x16')][_0x7923('0x15')]);}})[_0x7923('0x17')](function(_0x3a70bf){logger[_0x7923('0x14')]('Schedule,\x20%s,\x20%s',_0x1a65dd,_0x3a70bf);_0x5ae496(_0x3a70bf);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 49a0f87..f56b238 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 _0x0ab9=['/describe','describe','/:id','download','post','create','put','update','delete','destroy','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x52b83b,_0x95626e){var _0x2caf52=function(_0x1f8cb4){while(--_0x1f8cb4){_0x52b83b['push'](_0x52b83b['shift']());}};_0x2caf52(++_0x95626e);}(_0x0ab9,0x101));var _0x90ab=function(_0x39ce06,_0x18ec7d){_0x39ce06=_0x39ce06-0x0;var _0xba2c68=_0x0ab9[_0x39ce06];return _0xba2c68;};'use strict';var multer=require('multer');var util=require(_0x90ab('0x0'));var path=require(_0x90ab('0x1'));var timeout=require(_0x90ab('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x90ab('0x3'));var interaction=require(_0x90ab('0x4'));var config=require(_0x90ab('0x5'));var controller=require('./screenRecording.controller');router[_0x90ab('0x6')]('/',auth[_0x90ab('0x7')](),controller[_0x90ab('0x8')]);router[_0x90ab('0x6')](_0x90ab('0x9'),auth[_0x90ab('0x7')](),controller[_0x90ab('0xa')]);router[_0x90ab('0x6')](_0x90ab('0xb'),auth[_0x90ab('0x7')](),controller['show']);router[_0x90ab('0x6')]('/:id/download',auth[_0x90ab('0x7')](),controller[_0x90ab('0xc')]);router[_0x90ab('0xd')]('/',auth[_0x90ab('0x7')](),controller[_0x90ab('0xe')]);router[_0x90ab('0xf')](_0x90ab('0xb'),auth[_0x90ab('0x7')](),controller[_0x90ab('0x10')]);router[_0x90ab('0x11')](_0x90ab('0xb'),auth[_0x90ab('0x7')](),controller[_0x90ab('0x12')]);module['exports']=router; \ No newline at end of file +var _0xabbe=['../../components/interaction/service','../../config/environment','./screenRecording.controller','isAuthenticated','index','get','/describe','/:id','show','download','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0xc7d00e,_0x53faef){var _0x39bf39=function(_0x19cbec){while(--_0x19cbec){_0xc7d00e['push'](_0xc7d00e['shift']());}};_0x39bf39(++_0x53faef);}(_0xabbe,0x1f4));var _0xeabb=function(_0x1f177c,_0x2c0d3a){_0x1f177c=_0x1f177c-0x0;var _0x17f3f2=_0xabbe[_0x1f177c];return _0x17f3f2;};'use strict';var multer=require(_0xeabb('0x0'));var util=require('util');var path=require(_0xeabb('0x1'));var timeout=require(_0xeabb('0x2'));var express=require(_0xeabb('0x3'));var router=express['Router']();var fs_extra=require(_0xeabb('0x4'));var auth=require(_0xeabb('0x5'));var interaction=require(_0xeabb('0x6'));var config=require(_0xeabb('0x7'));var controller=require(_0xeabb('0x8'));router['get']('/',auth[_0xeabb('0x9')](),controller[_0xeabb('0xa')]);router[_0xeabb('0xb')](_0xeabb('0xc'),auth[_0xeabb('0x9')](),controller['describe']);router[_0xeabb('0xb')](_0xeabb('0xd'),auth[_0xeabb('0x9')](),controller[_0xeabb('0xe')]);router[_0xeabb('0xb')]('/:id/download',auth[_0xeabb('0x9')](),controller[_0xeabb('0xf')]);router[_0xeabb('0x10')]('/',auth[_0xeabb('0x9')](),controller[_0xeabb('0x11')]);router[_0xeabb('0x12')](_0xeabb('0xd'),auth[_0xeabb('0x9')](),controller[_0xeabb('0x13')]);router[_0xeabb('0x14')](_0xeabb('0xd'),auth[_0xeabb('0x9')](),controller[_0xeabb('0x15')]);module[_0xeabb('0x16')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 7ebb529..bf0201a 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 _0x6ca3=['DATE','format','toString','MM-DD-YYYY\x20HH:mm','createdAt','updatedAt','path','../../config/environment','VIRTUAL','getDataValue','extname','STRING','setDataValue','value','startedAt','subtract','closedAt','duration'];(function(_0x4d8666,_0x2ff19d){var _0x37175b=function(_0x1b8de6){while(--_0x1b8de6){_0x4d8666['push'](_0x4d8666['shift']());}};_0x37175b(++_0x2ff19d);}(_0x6ca3,0xba));var _0x36ca=function(_0x3044e3,_0x255336){_0x3044e3=_0x3044e3-0x0;var _0x389181=_0x6ca3[_0x3044e3];return _0x389181;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var path=require(_0x36ca('0x0'));var config=require(_0x36ca('0x1'));module['exports']={'format':{'type':Sequelize[_0x36ca('0x2')],'get':function(){return this[_0x36ca('0x3')]('value')?path[_0x36ca('0x4')](this['getDataValue']('value')):undefined;}},'interactionid':{'type':Sequelize[_0x36ca('0x5')]},'channel':{'type':Sequelize[_0x36ca('0x5')]},'value':{'type':Sequelize[_0x36ca('0x5')],'set':function(_0x4453c2){var _0x5996df=_0x4453c2['replace'](/\\/g,'/');this[_0x36ca('0x6')](_0x36ca('0x7'),_0x5996df);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x14e486){this[_0x36ca('0x6')](_0x36ca('0x8'),moment()[_0x36ca('0x9')](_0x14e486,'ms'));this['setDataValue'](_0x36ca('0xa'),moment());this['setDataValue'](_0x36ca('0xb'),_0x14e486);}},'startedAt':{'type':Sequelize[_0x36ca('0xc')],'get':function(){return moment(this[_0x36ca('0x3')](_0x36ca('0x8')))[_0x36ca('0xd')]('MM-DD-YYYY\x20HH:mm')[_0x36ca('0xe')]();}},'closedAt':{'type':Sequelize[_0x36ca('0xc')],'get':function(){return moment(this[_0x36ca('0x3')]('closedAt'))[_0x36ca('0xd')](_0x36ca('0xf'))[_0x36ca('0xe')]();}},'createdAt':{'type':Sequelize[_0x36ca('0xc')],'get':function(){return moment(this[_0x36ca('0x3')](_0x36ca('0x10')))[_0x36ca('0xd')](_0x36ca('0xf'))[_0x36ca('0xe')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x36ca('0x3')](_0x36ca('0x11')))[_0x36ca('0xd')](_0x36ca('0xf'))[_0x36ca('0xe')]();}}}; \ No newline at end of file +var _0x81b7=['DATE','createdAt','MM-DD-YYYY\x20HH:mm','updatedAt','moment','path','../../config/environment','exports','getDataValue','extname','value','STRING','setDataValue','INTEGER','startedAt','closedAt','duration','format','toString'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x81b7,0x1f2));var _0x781b=function(_0x3c4b35,_0xc2d5af){_0x3c4b35=_0x3c4b35-0x0;var _0x41cf2f=_0x81b7[_0x3c4b35];return _0x41cf2f;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x781b('0x0'));var path=require(_0x781b('0x1'));var config=require(_0x781b('0x2'));module[_0x781b('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x781b('0x4')]('value')?path[_0x781b('0x5')](this[_0x781b('0x4')](_0x781b('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x781b('0x7')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x781b('0x7')],'set':function(_0xd9d633){var _0x482803=_0xd9d633['replace'](/\\/g,'/');this[_0x781b('0x8')](_0x781b('0x6'),_0x482803);}},'rating':{'type':Sequelize[_0x781b('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x781b('0x9')],'set':function(_0x5591d9){this[_0x781b('0x8')](_0x781b('0xa'),moment()['subtract'](_0x5591d9,'ms'));this['setDataValue'](_0x781b('0xb'),moment());this['setDataValue'](_0x781b('0xc'),_0x5591d9);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x781b('0x4')]('startedAt'))[_0x781b('0xd')]('MM-DD-YYYY\x20HH:mm')[_0x781b('0xe')]();}},'closedAt':{'type':Sequelize[_0x781b('0xf')],'get':function(){return moment(this[_0x781b('0x4')](_0x781b('0xb')))[_0x781b('0xd')]('MM-DD-YYYY\x20HH:mm')[_0x781b('0xe')]();}},'createdAt':{'type':Sequelize[_0x781b('0xf')],'get':function(){return moment(this[_0x781b('0x4')](_0x781b('0x10')))['format'](_0x781b('0x11'))['toString']();}},'updatedAt':{'type':Sequelize[_0x781b('0xf')],'get':function(){return moment(this[_0x781b('0x4')](_0x781b('0x12')))['format'](_0x781b('0x11'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 63c6ab0..e6c71d6 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 _0xdc97=['join','root','%s.cypher','existsSync','decryptFile','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','destroy','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','update','then','sendStatus','error','name','send','index','map','format','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','options','ScreenRecording','includeAll','rows','catch','show','params','include','find','create','body','duration','createdAt','closedAt','value','describe','download','../../components/encryptor','uniqueid'];(function(_0x918cdf,_0x4bff1c){var _0x231320=function(_0x136809){while(--_0x136809){_0x918cdf['push'](_0x918cdf['shift']());}};_0x231320(++_0x4bff1c);}(_0xdc97,0x13b));var _0x7dc9=function(_0x1c8bdd,_0x4bca0f){_0x1c8bdd=_0x1c8bdd-0x0;var _0x13ac43=_0xdc97[_0x1c8bdd];return _0x13ac43;};'use strict';var emlformat=require(_0x7dc9('0x0'));var rimraf=require(_0x7dc9('0x1'));var zipdir=require(_0x7dc9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7dc9('0x3'));var moment=require('moment');var BPromise=require(_0x7dc9('0x4'));var Mustache=require(_0x7dc9('0x5'));var util=require('util');var path=require(_0x7dc9('0x6'));var sox=require(_0x7dc9('0x7'));var csv=require(_0x7dc9('0x8'));var ejs=require(_0x7dc9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7dc9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7dc9('0xb'));var deskjs=require(_0x7dc9('0xc'));var toCsv=require(_0x7dc9('0x8'));var querystring=require(_0x7dc9('0xd'));var Papa=require(_0x7dc9('0xe'));var Redis=require('ioredis');var authService=require(_0x7dc9('0xf'));var qs=require(_0x7dc9('0x10'));var as=require(_0x7dc9('0x11'));var hardwareService=require(_0x7dc9('0x12'));var logger=require(_0x7dc9('0x13'))(_0x7dc9('0x14'));var utils=require(_0x7dc9('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x599ef1,_0x94c75a){_0x94c75a=_0x94c75a||0xcc;return function(_0x14e5db){if(_0x14e5db){return _0x599ef1['sendStatus'](_0x94c75a);}return _0x599ef1[_0x7dc9('0x16')](_0x94c75a)[_0x7dc9('0x17')]();};}function respondWithResult(_0xaadf2,_0xf37bc7){_0xf37bc7=_0xf37bc7||0xc8;return function(_0x31d43d){if(_0x31d43d){return _0xaadf2[_0x7dc9('0x16')](_0xf37bc7)['json'](_0x31d43d);}};}function respondWithFilteredResult(_0x3a54f2,_0x278191){return function(_0x1b0aa1){if(_0x1b0aa1){var _0x442819=typeof _0x278191[_0x7dc9('0x18')]===_0x7dc9('0x19')&&typeof _0x278191[_0x7dc9('0x1a')]===_0x7dc9('0x19');var _0x4778d5=_0x1b0aa1['count'];var _0x22577e=_0x442819?0x0:_0x278191['offset'];var _0x1f5906=_0x442819?_0x1b0aa1[_0x7dc9('0x1b')]:_0x278191['offset']+_0x278191[_0x7dc9('0x1a')];var _0x3b738a;if(_0x1f5906>=_0x4778d5){_0x1f5906=_0x4778d5;_0x3b738a=0xc8;}else{_0x3b738a=0xce;}_0x3a54f2[_0x7dc9('0x16')](_0x3b738a);return _0x3a54f2[_0x7dc9('0x1c')](_0x7dc9('0x1d'),_0x22577e+'-'+_0x1f5906+'/'+_0x4778d5)[_0x7dc9('0x1e')](_0x1b0aa1);}return null;};}function patchUpdates(_0x2dad65){return function(_0x2895f5){try{jsonpatch[_0x7dc9('0x1f')](_0x2895f5,_0x2dad65,!![]);}catch(_0x2b38d6){return BPromise['reject'](_0x2b38d6);}return _0x2895f5['save']();};}function saveUpdates(_0x12954f,_0x5981e2){return function(_0x596e0f){if(_0x596e0f){return _0x596e0f[_0x7dc9('0x20')](_0x12954f)[_0x7dc9('0x21')](function(_0x5e9525){return _0x5e9525;});}return null;};}function removeEntity(_0xffc080,_0x43d31f){return function(_0x41110a){if(_0x41110a){return _0x41110a['destroy']()[_0x7dc9('0x21')](function(){_0xffc080[_0x7dc9('0x16')](0xcc)[_0x7dc9('0x17')]();});}};}function handleEntityNotFound(_0x55a482,_0x48c6bc){return function(_0x4b9ba6){if(!_0x4b9ba6){_0x55a482[_0x7dc9('0x22')](0x194);}return _0x4b9ba6;};}function handleError(_0x32d032,_0x5843bf){_0x5843bf=_0x5843bf||0x1f4;return function(_0x585eef){logger[_0x7dc9('0x23')](_0x585eef['stack']);if(_0x585eef[_0x7dc9('0x24')]){delete _0x585eef[_0x7dc9('0x24')];}_0x32d032[_0x7dc9('0x16')](_0x5843bf)[_0x7dc9('0x25')](_0x585eef);};}exports[_0x7dc9('0x26')]=function(_0x450124,_0x236d42){var _0x229f8e={},_0x1fcf0e={},_0x3c4379={'count':0x0,'rows':[]};var _0x14083d=_[_0x7dc9('0x27')](db['ScreenRecording']['rawAttributes'],function(_0x513dd6){return{'name':_0x513dd6['fieldName'],'type':_0x513dd6['type']['key']};});_0x1fcf0e['model']=_['differenceBy'](_[_0x7dc9('0x27')](_0x14083d,_0x7dc9('0x24')),[_0x7dc9('0x28')]);_0x1fcf0e[_0x7dc9('0x29')]=_[_0x7dc9('0x2a')](_0x450124[_0x7dc9('0x29')]);_0x1fcf0e['filters']=_['intersection'](_0x1fcf0e['model'],_0x1fcf0e[_0x7dc9('0x29')]);_0x229f8e['attributes']=_[_0x7dc9('0x2b')](_0x1fcf0e[_0x7dc9('0x2c')],qs[_0x7dc9('0x2d')](_0x450124[_0x7dc9('0x29')][_0x7dc9('0x2d')]));_0x229f8e[_0x7dc9('0x2e')]=_0x229f8e[_0x7dc9('0x2e')][_0x7dc9('0x2f')]?_0x229f8e['attributes']:_0x1fcf0e[_0x7dc9('0x2c')];if(!_0x450124['query'][_0x7dc9('0x30')](_0x7dc9('0x31'))){_0x229f8e[_0x7dc9('0x1a')]=qs[_0x7dc9('0x1a')](_0x450124['query'][_0x7dc9('0x1a')]);_0x229f8e['offset']=qs[_0x7dc9('0x18')](_0x450124['query']['offset']);}_0x229f8e[_0x7dc9('0x32')]=qs[_0x7dc9('0x33')](_0x450124[_0x7dc9('0x29')][_0x7dc9('0x33')]);_0x229f8e['where']=qs[_0x7dc9('0x34')](_[_0x7dc9('0x35')](_0x450124[_0x7dc9('0x29')],_0x1fcf0e[_0x7dc9('0x34')]),_0x14083d);if(_0x450124[_0x7dc9('0x29')][_0x7dc9('0x36')]){_0x229f8e[_0x7dc9('0x37')]=_[_0x7dc9('0x38')](_0x229f8e[_0x7dc9('0x37')],{'$or':_[_0x7dc9('0x27')](_0x14083d,function(_0x452aed){if(_0x452aed[_0x7dc9('0x39')]!=='VIRTUAL'){var _0x34b5c9={};_0x34b5c9[_0x452aed[_0x7dc9('0x24')]]={'$like':'%'+_0x450124[_0x7dc9('0x29')][_0x7dc9('0x36')]+'%'};return _0x34b5c9;}})});}_0x229f8e=_['merge']({},_0x229f8e,_0x450124[_0x7dc9('0x3a')]);var _0x89db0e={'where':_0x229f8e[_0x7dc9('0x37')]};return db[_0x7dc9('0x3b')][_0x7dc9('0x1b')](_0x89db0e)[_0x7dc9('0x21')](function(_0x5a1201){_0x3c4379['count']=_0x5a1201;if(_0x450124[_0x7dc9('0x29')][_0x7dc9('0x3c')]){_0x229f8e['include']=[{'all':!![]}];}return db[_0x7dc9('0x3b')]['findAll'](_0x229f8e);})[_0x7dc9('0x21')](function(_0x2a91fe){_0x3c4379[_0x7dc9('0x3d')]=_0x2a91fe;return _0x3c4379;})['then'](respondWithFilteredResult(_0x236d42,_0x229f8e))[_0x7dc9('0x3e')](handleError(_0x236d42,null));};exports[_0x7dc9('0x3f')]=function(_0x1929b6,_0x95513c){var _0x28ffc0={'raw':![],'where':{'id':_0x1929b6[_0x7dc9('0x40')]['id']}},_0x23499a={};_0x23499a['model']=_[_0x7dc9('0x2a')](db['ScreenRecording']['rawAttributes']);_0x23499a[_0x7dc9('0x29')]=_[_0x7dc9('0x2a')](_0x1929b6[_0x7dc9('0x29')]);_0x23499a[_0x7dc9('0x34')]=_[_0x7dc9('0x2b')](_0x23499a[_0x7dc9('0x2c')],_0x23499a[_0x7dc9('0x29')]);_0x28ffc0[_0x7dc9('0x2e')]=_[_0x7dc9('0x2b')](_0x23499a['model'],qs[_0x7dc9('0x2d')](_0x1929b6[_0x7dc9('0x29')][_0x7dc9('0x2d')]));_0x28ffc0[_0x7dc9('0x2e')]=_0x28ffc0[_0x7dc9('0x2e')][_0x7dc9('0x2f')]?_0x28ffc0['attributes']:_0x23499a[_0x7dc9('0x2c')];if(_0x1929b6[_0x7dc9('0x29')]['includeAll']){_0x28ffc0[_0x7dc9('0x41')]=[{'all':!![]}];}_0x28ffc0=_[_0x7dc9('0x38')]({},_0x28ffc0,_0x1929b6[_0x7dc9('0x3a')]);return db['ScreenRecording'][_0x7dc9('0x42')](_0x28ffc0)['then'](handleEntityNotFound(_0x95513c,null))['then'](respondWithResult(_0x95513c,null))[_0x7dc9('0x3e')](handleError(_0x95513c,null));};exports[_0x7dc9('0x43')]=function(_0x36d591,_0x5e0dc5){return db['ScreenRecording'][_0x7dc9('0x43')](_0x36d591['body'],{})[_0x7dc9('0x21')](respondWithResult(_0x5e0dc5,0xc9))[_0x7dc9('0x3e')](handleError(_0x5e0dc5,null));};exports['update']=function(_0x24ccce,_0x1d6c0a){if(_0x24ccce[_0x7dc9('0x44')]['id']){delete _0x24ccce[_0x7dc9('0x44')]['id'];}delete _0x24ccce[_0x7dc9('0x44')][_0x7dc9('0x45')];delete _0x24ccce[_0x7dc9('0x44')][_0x7dc9('0x46')];delete _0x24ccce[_0x7dc9('0x44')][_0x7dc9('0x47')];delete _0x24ccce[_0x7dc9('0x44')][_0x7dc9('0x48')];return db[_0x7dc9('0x3b')]['find']({'where':{'id':_0x24ccce[_0x7dc9('0x40')]['id']}})['then'](handleEntityNotFound(_0x1d6c0a,null))['then'](saveUpdates(_0x24ccce[_0x7dc9('0x44')],null))[_0x7dc9('0x21')](respondWithResult(_0x1d6c0a,null))[_0x7dc9('0x3e')](handleError(_0x1d6c0a,null));};exports[_0x7dc9('0x49')]=function(_0x346d27,_0x510e2a){return db[_0x7dc9('0x3b')][_0x7dc9('0x49')]()[_0x7dc9('0x21')](respondWithResult(_0x510e2a,null))['catch'](handleError(_0x510e2a,null));};exports[_0x7dc9('0x4a')]=function(_0x3fc164,_0x2cf133,_0x32bc31){var _0xf41b8c=require(_0x7dc9('0x4b'));var _0x593132=![];var _0x366b8b={};if(_0x3fc164[_0x7dc9('0x29')][_0x7dc9('0x39')]&&_0x3fc164[_0x7dc9('0x29')][_0x7dc9('0x39')]===_0x7dc9('0x4c')){_0x366b8b[_0x7dc9('0x4c')]=_0x3fc164[_0x7dc9('0x40')]['id'];}else{_0x366b8b['id']=_0x3fc164[_0x7dc9('0x40')]['id'];}return db[_0x7dc9('0x3b')][_0x7dc9('0x42')]({'where':_0x366b8b,'attributes':['id',_0x7dc9('0x48')],'raw':!![]})['then'](handleEntityNotFound(_0x2cf133,null))[_0x7dc9('0x21')](function(_0x39be46){if(_0x39be46){var _0x38df9a=path[_0x7dc9('0x4d')](config[_0x7dc9('0x4e')],'server/files/screen_recordings',_0x39be46[_0x7dc9('0x48')]);var _0xd8d327=util[_0x7dc9('0x28')](_0x7dc9('0x4f'),_0x38df9a);if(fs[_0x7dc9('0x50')](_0xd8d327)){_0x593132=!![];return _0xf41b8c[_0x7dc9('0x51')](_0xd8d327,_0x38df9a,config['secrets']['recording'])['then'](function(){return _0x39be46;});}return _0x39be46;}})[_0x7dc9('0x21')](function(_0x3daf33){if(_0x3daf33){var _0x32a64f=path[_0x7dc9('0x4d')](config['root'],'server/files/screen_recordings',_0x3daf33[_0x7dc9('0x48')]);if(!fs[_0x7dc9('0x50')](_0x32a64f)){throw new db[(_0x7dc9('0x52'))][(_0x7dc9('0x53'))](_0x7dc9('0x54'));}if(_0x3daf33[_0x7dc9('0x55')]){return _0x2cf133[_0x7dc9('0x4a')](_0x32a64f,_0x3daf33['filename']+path[_0x7dc9('0x56')](_0x32a64f),function(){if(_0x593132){fs[_0x7dc9('0x57')](_0x32a64f);}});}else{return _0x2cf133[_0x7dc9('0x4a')](_0x32a64f,function(_0x1dad95){if(_0x593132){fs[_0x7dc9('0x57')](_0x32a64f);}});}}})['catch'](function(_0x175858){if(_0x175858[_0x7dc9('0x58')]===_0x7dc9('0x54')){_0x2cf133[_0x7dc9('0x16')](0x194)[_0x7dc9('0x25')](_0x7dc9('0x59'));}else{return handleError(_0x2cf133,null);}});};exports[_0x7dc9('0x5a')]=function(_0x2a02ed,_0x3463e4){return db[_0x7dc9('0x3b')][_0x7dc9('0x42')]({'where':{'id':_0x2a02ed[_0x7dc9('0x40')]['id']}})[_0x7dc9('0x21')](function(_0x5eee27){if(_[_0x7dc9('0x5b')](_0x5eee27)){throw new ReferenceError('Entity\x20not\x20found');}return _0x5eee27;})[_0x7dc9('0x21')](function(_0x15cf19){var _0x48ea37=path[_0x7dc9('0x4d')](config[_0x7dc9('0x4e')],'server/files/screen_recordings',_0x15cf19[_0x7dc9('0x48')]);logger[_0x7dc9('0x5c')](_0x7dc9('0x5d'),_0x48ea37);if(!_['isNil'](_0x15cf19['value'])&&fs[_0x7dc9('0x50')](_0x48ea37)){logger[_0x7dc9('0x5c')](_0x7dc9('0x5e')+_0x48ea37+_0x7dc9('0x5f'));fs[_0x7dc9('0x60')](_0x48ea37);}_0x48ea37=_0x48ea37+_0x7dc9('0x61');if(!_[_0x7dc9('0x5b')](_0x15cf19[_0x7dc9('0x48')])&&fs[_0x7dc9('0x50')](_0x48ea37)){logger['info'](_0x7dc9('0x5e')+_0x48ea37+_0x7dc9('0x5f'));fs[_0x7dc9('0x60')](_0x48ea37);}return _0x15cf19;})['then'](function(_0x4f80bd){if(!_0x4f80bd)throw new InternalError();return _0x4f80bd[_0x7dc9('0x5a')]();})[_0x7dc9('0x21')](function(){_0x3463e4[_0x7dc9('0x16')](0xcc)[_0x7dc9('0x17')]();})['catch'](handleError(_0x3463e4,null));}; \ No newline at end of file +var _0x5c12=['undefined','count','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','error','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','differenceBy','format','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','merge','filter','include','rows','catch','keys','includeAll','options','find','create','body','createdAt','closedAt','value','params','describe','download','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','limit'];(function(_0x2c3361,_0x1d4a37){var _0x3f4b67=function(_0x319cf1){while(--_0x319cf1){_0x2c3361['push'](_0x2c3361['shift']());}};_0x3f4b67(++_0x1d4a37);}(_0x5c12,0x188));var _0x25c1=function(_0x29c261,_0x3af39a){_0x29c261=_0x29c261-0x0;var _0x1a9335=_0x5c12[_0x29c261];return _0x1a9335;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x25c1('0x0'));var zipdir=require(_0x25c1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x25c1('0x2'));var moment=require(_0x25c1('0x3'));var BPromise=require(_0x25c1('0x4'));var Mustache=require(_0x25c1('0x5'));var util=require(_0x25c1('0x6'));var path=require(_0x25c1('0x7'));var sox=require(_0x25c1('0x8'));var csv=require('to-csv');var ejs=require(_0x25c1('0x9'));var fs=require('fs');var fs_extra=require(_0x25c1('0xa'));var _=require(_0x25c1('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x25c1('0xc'));var deskjs=require(_0x25c1('0xd'));var toCsv=require(_0x25c1('0xe'));var querystring=require(_0x25c1('0xf'));var Papa=require(_0x25c1('0x10'));var Redis=require('ioredis');var authService=require(_0x25c1('0x11'));var qs=require(_0x25c1('0x12'));var as=require(_0x25c1('0x13'));var hardwareService=require(_0x25c1('0x14'));var logger=require(_0x25c1('0x15'))('api');var utils=require(_0x25c1('0x16'));var config=require(_0x25c1('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x25c1('0x18'))['db'];function respondWithStatusCode(_0x209af5,_0x323d3c){_0x323d3c=_0x323d3c||0xcc;return function(_0x329ba9){if(_0x329ba9){return _0x209af5['sendStatus'](_0x323d3c);}return _0x209af5['status'](_0x323d3c)['end']();};}function respondWithResult(_0x54f6f4,_0x3ef429){_0x3ef429=_0x3ef429||0xc8;return function(_0x1412ed){if(_0x1412ed){return _0x54f6f4[_0x25c1('0x19')](_0x3ef429)[_0x25c1('0x1a')](_0x1412ed);}};}function respondWithFilteredResult(_0x17a032,_0x4ea926){return function(_0x4638f0){if(_0x4638f0){var _0x55b62d=typeof _0x4ea926['offset']==='undefined'&&typeof _0x4ea926[_0x25c1('0x1b')]===_0x25c1('0x1c');var _0x4dc64b=_0x4638f0['count'];var _0x61a29f=_0x55b62d?0x0:_0x4ea926['offset'];var _0x7175d4=_0x55b62d?_0x4638f0[_0x25c1('0x1d')]:_0x4ea926['offset']+_0x4ea926['limit'];var _0x542768;if(_0x7175d4>=_0x4dc64b){_0x7175d4=_0x4dc64b;_0x542768=0xc8;}else{_0x542768=0xce;}_0x17a032[_0x25c1('0x19')](_0x542768);return _0x17a032[_0x25c1('0x1e')](_0x25c1('0x1f'),_0x61a29f+'-'+_0x7175d4+'/'+_0x4dc64b)[_0x25c1('0x1a')](_0x4638f0);}return null;};}function patchUpdates(_0x481c12){return function(_0x119639){try{jsonpatch[_0x25c1('0x20')](_0x119639,_0x481c12,!![]);}catch(_0x34454a){return BPromise[_0x25c1('0x21')](_0x34454a);}return _0x119639['save']();};}function saveUpdates(_0x4c3259,_0x2a8a84){return function(_0xac3335){if(_0xac3335){return _0xac3335[_0x25c1('0x22')](_0x4c3259)[_0x25c1('0x23')](function(_0x15cf2f){return _0x15cf2f;});}return null;};}function removeEntity(_0x1a4b89,_0x2ba595){return function(_0x324ea9){if(_0x324ea9){return _0x324ea9[_0x25c1('0x24')]()[_0x25c1('0x23')](function(){_0x1a4b89[_0x25c1('0x19')](0xcc)[_0x25c1('0x25')]();});}};}function handleEntityNotFound(_0x399d72,_0x4915cc){return function(_0x2dadae){if(!_0x2dadae){_0x399d72[_0x25c1('0x26')](0x194);}return _0x2dadae;};}function handleError(_0x1b1c96,_0x1fb59f){_0x1fb59f=_0x1fb59f||0x1f4;return function(_0x21fdb8){logger[_0x25c1('0x27')](_0x21fdb8['stack']);if(_0x21fdb8[_0x25c1('0x28')]){delete _0x21fdb8[_0x25c1('0x28')];}_0x1b1c96[_0x25c1('0x19')](_0x1fb59f)[_0x25c1('0x29')](_0x21fdb8);};}exports[_0x25c1('0x2a')]=function(_0x193a68,_0x5c56ab){var _0x1e498={},_0x478f1e={},_0x76b360={'count':0x0,'rows':[]};var _0x31c153=_[_0x25c1('0x2b')](db[_0x25c1('0x2c')][_0x25c1('0x2d')],function(_0x21069c){return{'name':_0x21069c[_0x25c1('0x2e')],'type':_0x21069c[_0x25c1('0x2f')][_0x25c1('0x30')]};});_0x478f1e['model']=_[_0x25c1('0x31')](_['map'](_0x31c153,'name'),[_0x25c1('0x32')]);_0x478f1e[_0x25c1('0x33')]=_['keys'](_0x193a68[_0x25c1('0x33')]);_0x478f1e['filters']=_[_0x25c1('0x34')](_0x478f1e['model'],_0x478f1e[_0x25c1('0x33')]);_0x1e498[_0x25c1('0x35')]=_[_0x25c1('0x34')](_0x478f1e[_0x25c1('0x36')],qs[_0x25c1('0x37')](_0x193a68[_0x25c1('0x33')][_0x25c1('0x37')]));_0x1e498[_0x25c1('0x35')]=_0x1e498['attributes'][_0x25c1('0x38')]?_0x1e498['attributes']:_0x478f1e[_0x25c1('0x36')];if(!_0x193a68['query'][_0x25c1('0x39')](_0x25c1('0x3a'))){_0x1e498[_0x25c1('0x1b')]=qs[_0x25c1('0x1b')](_0x193a68[_0x25c1('0x33')][_0x25c1('0x1b')]);_0x1e498[_0x25c1('0x3b')]=qs[_0x25c1('0x3b')](_0x193a68[_0x25c1('0x33')][_0x25c1('0x3b')]);}_0x1e498[_0x25c1('0x3c')]=qs[_0x25c1('0x3d')](_0x193a68[_0x25c1('0x33')][_0x25c1('0x3d')]);_0x1e498[_0x25c1('0x3e')]=qs[_0x25c1('0x3f')](_[_0x25c1('0x40')](_0x193a68[_0x25c1('0x33')],_0x478f1e[_0x25c1('0x3f')]),_0x31c153);if(_0x193a68[_0x25c1('0x33')]['filter']){_0x1e498[_0x25c1('0x3e')]=_[_0x25c1('0x41')](_0x1e498['where'],{'$or':_[_0x25c1('0x2b')](_0x31c153,function(_0x5eca99){if(_0x5eca99[_0x25c1('0x2f')]!=='VIRTUAL'){var _0x4326fb={};_0x4326fb[_0x5eca99[_0x25c1('0x28')]]={'$like':'%'+_0x193a68[_0x25c1('0x33')][_0x25c1('0x42')]+'%'};return _0x4326fb;}})});}_0x1e498=_[_0x25c1('0x41')]({},_0x1e498,_0x193a68['options']);var _0x1fe6d7={'where':_0x1e498['where']};return db[_0x25c1('0x2c')][_0x25c1('0x1d')](_0x1fe6d7)[_0x25c1('0x23')](function(_0x17fc23){_0x76b360['count']=_0x17fc23;if(_0x193a68['query']['includeAll']){_0x1e498[_0x25c1('0x43')]=[{'all':!![]}];}return db[_0x25c1('0x2c')]['findAll'](_0x1e498);})[_0x25c1('0x23')](function(_0x58792d){_0x76b360[_0x25c1('0x44')]=_0x58792d;return _0x76b360;})[_0x25c1('0x23')](respondWithFilteredResult(_0x5c56ab,_0x1e498))[_0x25c1('0x45')](handleError(_0x5c56ab,null));};exports['show']=function(_0x5502c1,_0x53f87b){var _0x1b1d17={'raw':![],'where':{'id':_0x5502c1['params']['id']}},_0x3cf9c0={};_0x3cf9c0[_0x25c1('0x36')]=_[_0x25c1('0x46')](db[_0x25c1('0x2c')]['rawAttributes']);_0x3cf9c0['query']=_['keys'](_0x5502c1['query']);_0x3cf9c0[_0x25c1('0x3f')]=_[_0x25c1('0x34')](_0x3cf9c0['model'],_0x3cf9c0[_0x25c1('0x33')]);_0x1b1d17[_0x25c1('0x35')]=_[_0x25c1('0x34')](_0x3cf9c0[_0x25c1('0x36')],qs[_0x25c1('0x37')](_0x5502c1[_0x25c1('0x33')][_0x25c1('0x37')]));_0x1b1d17['attributes']=_0x1b1d17['attributes'][_0x25c1('0x38')]?_0x1b1d17[_0x25c1('0x35')]:_0x3cf9c0[_0x25c1('0x36')];if(_0x5502c1['query'][_0x25c1('0x47')]){_0x1b1d17[_0x25c1('0x43')]=[{'all':!![]}];}_0x1b1d17=_[_0x25c1('0x41')]({},_0x1b1d17,_0x5502c1[_0x25c1('0x48')]);return db['ScreenRecording'][_0x25c1('0x49')](_0x1b1d17)[_0x25c1('0x23')](handleEntityNotFound(_0x53f87b,null))[_0x25c1('0x23')](respondWithResult(_0x53f87b,null))[_0x25c1('0x45')](handleError(_0x53f87b,null));};exports['create']=function(_0x59e96b,_0x13ac06){return db[_0x25c1('0x2c')][_0x25c1('0x4a')](_0x59e96b[_0x25c1('0x4b')],{})['then'](respondWithResult(_0x13ac06,0xc9))[_0x25c1('0x45')](handleError(_0x13ac06,null));};exports[_0x25c1('0x22')]=function(_0x5770dd,_0x102f5){if(_0x5770dd[_0x25c1('0x4b')]['id']){delete _0x5770dd[_0x25c1('0x4b')]['id'];}delete _0x5770dd[_0x25c1('0x4b')]['duration'];delete _0x5770dd['body'][_0x25c1('0x4c')];delete _0x5770dd[_0x25c1('0x4b')][_0x25c1('0x4d')];delete _0x5770dd['body'][_0x25c1('0x4e')];return db[_0x25c1('0x2c')]['find']({'where':{'id':_0x5770dd[_0x25c1('0x4f')]['id']}})[_0x25c1('0x23')](handleEntityNotFound(_0x102f5,null))[_0x25c1('0x23')](saveUpdates(_0x5770dd[_0x25c1('0x4b')],null))[_0x25c1('0x23')](respondWithResult(_0x102f5,null))[_0x25c1('0x45')](handleError(_0x102f5,null));};exports[_0x25c1('0x50')]=function(_0x5102a0,_0x5344da){return db['ScreenRecording'][_0x25c1('0x50')]()['then'](respondWithResult(_0x5344da,null))[_0x25c1('0x45')](handleError(_0x5344da,null));};exports[_0x25c1('0x51')]=function(_0x42fd6e,_0x153603,_0x40fe57){var _0x1b72e5=require('../../components/encryptor');var _0x4a876b=![];var _0x68e295={};if(_0x42fd6e[_0x25c1('0x33')][_0x25c1('0x2f')]&&_0x42fd6e[_0x25c1('0x33')][_0x25c1('0x2f')]==='uniqueid'){_0x68e295[_0x25c1('0x52')]=_0x42fd6e[_0x25c1('0x4f')]['id'];}else{_0x68e295['id']=_0x42fd6e[_0x25c1('0x4f')]['id'];}return db[_0x25c1('0x2c')][_0x25c1('0x49')]({'where':_0x68e295,'attributes':['id','value'],'raw':!![]})[_0x25c1('0x23')](handleEntityNotFound(_0x153603,null))[_0x25c1('0x23')](function(_0x49b192){if(_0x49b192){var _0x1341d2=path[_0x25c1('0x53')](config[_0x25c1('0x54')],_0x25c1('0x55'),_0x49b192[_0x25c1('0x4e')]);var _0x3d051a=util['format'](_0x25c1('0x56'),_0x1341d2);if(fs[_0x25c1('0x57')](_0x3d051a)){_0x4a876b=!![];return _0x1b72e5[_0x25c1('0x58')](_0x3d051a,_0x1341d2,config[_0x25c1('0x59')][_0x25c1('0x5a')])[_0x25c1('0x23')](function(){return _0x49b192;});}return _0x49b192;}})[_0x25c1('0x23')](function(_0x5d54cd){if(_0x5d54cd){var _0x321833=path[_0x25c1('0x53')](config[_0x25c1('0x54')],_0x25c1('0x55'),_0x5d54cd[_0x25c1('0x4e')]);if(!fs[_0x25c1('0x57')](_0x321833)){throw new db['Sequelize'][(_0x25c1('0x5b'))](_0x25c1('0x5c'));}if(_0x5d54cd[_0x25c1('0x5d')]){return _0x153603[_0x25c1('0x51')](_0x321833,_0x5d54cd[_0x25c1('0x5d')]+path[_0x25c1('0x5e')](_0x321833),function(){if(_0x4a876b){fs[_0x25c1('0x5f')](_0x321833);}});}else{return _0x153603['download'](_0x321833,function(_0x44efc9){if(_0x4a876b){fs['unlink'](_0x321833);}});}}})[_0x25c1('0x45')](function(_0x24568c){if(_0x24568c[_0x25c1('0x60')]===_0x25c1('0x5c')){_0x153603[_0x25c1('0x19')](0x194)[_0x25c1('0x29')](_0x25c1('0x61'));}else{return handleError(_0x153603,null);}});};exports[_0x25c1('0x24')]=function(_0x4c435c,_0x7dbbe1){return db[_0x25c1('0x2c')][_0x25c1('0x49')]({'where':{'id':_0x4c435c[_0x25c1('0x4f')]['id']}})[_0x25c1('0x23')](function(_0x338f70){if(_[_0x25c1('0x62')](_0x338f70)){throw new ReferenceError('Entity\x20not\x20found');}return _0x338f70;})[_0x25c1('0x23')](function(_0x51e747){var _0x5e1517=path['join'](config[_0x25c1('0x54')],_0x25c1('0x55'),_0x51e747[_0x25c1('0x4e')]);logger[_0x25c1('0x63')](_0x25c1('0x64'),_0x5e1517);if(!_['isNil'](_0x51e747[_0x25c1('0x4e')])&&fs['existsSync'](_0x5e1517)){logger[_0x25c1('0x63')](_0x25c1('0x65')+_0x5e1517+_0x25c1('0x66'));fs[_0x25c1('0x67')](_0x5e1517);}_0x5e1517=_0x5e1517+_0x25c1('0x68');if(!_[_0x25c1('0x62')](_0x51e747[_0x25c1('0x4e')])&&fs['existsSync'](_0x5e1517)){logger[_0x25c1('0x63')](_0x25c1('0x65')+_0x5e1517+_0x25c1('0x66'));fs[_0x25c1('0x67')](_0x5e1517);}return _0x51e747;})[_0x25c1('0x23')](function(_0x425f3e){if(!_0x425f3e)throw new InternalError();return _0x425f3e['destroy']();})[_0x25c1('0x23')](function(){_0x7dbbe1['status'](0xcc)[_0x25c1('0x25')]();})['catch'](handleError(_0x7dbbe1,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index f73b416..75422fa 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 _0x9ac7=['util','../../config/logger','api','bluebird','request-promise','path','./screenRecording.attributes','exports','ScreenRecording','screen_recordings','interactionid','lodash'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x9ac7,0x12b));var _0x79ac=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x9ac7[_0x160c73];return _0xd9302;};'use strict';var _=require(_0x79ac('0x0'));var util=require(_0x79ac('0x1'));var logger=require(_0x79ac('0x2'))(_0x79ac('0x3'));var moment=require('moment');var BPromise=require(_0x79ac('0x4'));var rp=require(_0x79ac('0x5'));var fs=require('fs');var path=require(_0x79ac('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x79ac('0x7'));module[_0x79ac('0x8')]=function(_0x137b46,_0x4c1f22){return _0x137b46['define'](_0x79ac('0x9'),attributes,{'tableName':_0x79ac('0xa'),'paranoid':![],'indexes':[{'name':_0x79ac('0xb'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc994=['rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc994,0x8f));var _0x4c99=function(_0xb4d697,_0x272c87){_0xb4d697=_0xb4d697-0x0;var _0x723a7a=_0xc994[_0xb4d697];return _0x723a7a;};'use strict';var _=require(_0x4c99('0x0'));var util=require('util');var logger=require(_0x4c99('0x1'))(_0x4c99('0x2'));var moment=require(_0x4c99('0x3'));var BPromise=require(_0x4c99('0x4'));var rp=require(_0x4c99('0x5'));var fs=require('fs');var path=require(_0x4c99('0x6'));var rimraf=require(_0x4c99('0x7'));var config=require(_0x4c99('0x8'));var attributes=require(_0x4c99('0x9'));module[_0x4c99('0xa')]=function(_0x3a563c,_0x2f8fbf){return _0x3a563c[_0x4c99('0xb')](_0x4c99('0xc'),attributes,{'tableName':_0x4c99('0xd'),'paranoid':![],'indexes':[{'name':_0x4c99('0xe'),'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 6c3bf40..8d89f5c 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 _0x347e=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','code','error','message','ScreenRecording,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils'];(function(_0x5f21b3,_0x4961b1){var _0x289982=function(_0x1d91f6){while(--_0x1d91f6){_0x5f21b3['push'](_0x5f21b3['shift']());}};_0x289982(++_0x4961b1);}(_0x347e,0xdb));var _0xe347=function(_0x2e0854,_0x52544a){_0x2e0854=_0x2e0854-0x0;var _0x4d0ff9=_0x347e[_0x2e0854];return _0x4d0ff9;};'use strict';var _=require(_0xe347('0x0'));var util=require(_0xe347('0x1'));var moment=require(_0xe347('0x2'));var BPromise=require('bluebird');var rs=require(_0xe347('0x3'));var fs=require('fs');var Redis=require(_0xe347('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe347('0x5'));var logger=require(_0xe347('0x6'))(_0xe347('0x7'));var config=require(_0xe347('0x8'));var jayson=require(_0xe347('0x9'));var client=jayson[_0xe347('0xa')][_0xe347('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4cebe0,_0xabeb23,_0x383886){return new BPromise(function(_0x192999,_0x11994c){return client[_0xe347('0xc')](_0x4cebe0,_0x383886)[_0xe347('0xd')](function(_0x10e55d){logger[_0xe347('0xe')]('ScreenRecording,\x20%s,\x20%s',_0xabeb23,_0xe347('0xf'));logger[_0xe347('0x10')](_0xe347('0x11'),_0xabeb23,_0xe347('0xf'),JSON[_0xe347('0x12')](_0x10e55d));if(_0x10e55d['error']){if(_0x10e55d['error'][_0xe347('0x13')]===0x1f4){logger[_0xe347('0x14')]('ScreenRecording,\x20%s,\x20%s',_0xabeb23,_0x10e55d[_0xe347('0x14')][_0xe347('0x15')]);return _0x11994c(_0x10e55d[_0xe347('0x14')]['message']);}logger[_0xe347('0x14')](_0xe347('0x16'),_0xabeb23,_0x10e55d[_0xe347('0x14')]['message']);return _0x192999(_0x10e55d[_0xe347('0x14')][_0xe347('0x15')]);}else{logger[_0xe347('0xe')](_0xe347('0x16'),_0xabeb23,_0xe347('0xf'));_0x192999(_0x10e55d[_0xe347('0x17')][_0xe347('0x15')]);}})[_0xe347('0x18')](function(_0x1b3d37){logger['error']('ScreenRecording,\x20%s,\x20%s',_0xabeb23,_0x1b3d37);_0x11994c(_0x1b3d37);});});} \ No newline at end of file +var _0xa36d=['debug','stringify','error','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','ScreenRecording,\x20%s,\x20%s','request\x20sent'];(function(_0x13843f,_0x50422d){var _0x1063ae=function(_0x12fd6b){while(--_0x12fd6b){_0x13843f['push'](_0x13843f['shift']());}};_0x1063ae(++_0x50422d);}(_0xa36d,0x118));var _0xda36=function(_0x168cdd,_0x342cc9){_0x168cdd=_0x168cdd-0x0;var _0x2dfc0c=_0xa36d[_0x168cdd];return _0x2dfc0c;};'use strict';var _=require(_0xda36('0x0'));var util=require(_0xda36('0x1'));var moment=require(_0xda36('0x2'));var BPromise=require('bluebird');var rs=require(_0xda36('0x3'));var fs=require('fs');var Redis=require(_0xda36('0x4'));var db=require(_0xda36('0x5'))['db'];var utils=require(_0xda36('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xda36('0x7'));var jayson=require(_0xda36('0x8'));var client=jayson[_0xda36('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f68fb,_0x7097f4,_0x57984b){return new BPromise(function(_0x47289b,_0x3ed323){return client[_0xda36('0xa')](_0x1f68fb,_0x57984b)[_0xda36('0xb')](function(_0x14ad9f){logger['info'](_0xda36('0xc'),_0x7097f4,_0xda36('0xd'));logger[_0xda36('0xe')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x7097f4,_0xda36('0xd'),JSON[_0xda36('0xf')](_0x14ad9f));if(_0x14ad9f[_0xda36('0x10')]){if(_0x14ad9f[_0xda36('0x10')]['code']===0x1f4){logger[_0xda36('0x10')](_0xda36('0xc'),_0x7097f4,_0x14ad9f['error']['message']);return _0x3ed323(_0x14ad9f[_0xda36('0x10')][_0xda36('0x11')]);}logger[_0xda36('0x10')](_0xda36('0xc'),_0x7097f4,_0x14ad9f[_0xda36('0x10')][_0xda36('0x11')]);return _0x47289b(_0x14ad9f[_0xda36('0x10')][_0xda36('0x11')]);}else{logger[_0xda36('0x12')](_0xda36('0xc'),_0x7097f4,'request\x20sent');_0x47289b(_0x14ad9f[_0xda36('0x13')][_0xda36('0x11')]);}})[_0xda36('0x14')](function(_0x2016b4){logger[_0xda36('0x10')](_0xda36('0xc'),_0x7097f4,_0x2016b4);_0x3ed323(_0x2016b4);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index d512e3b..81abecf 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 _0x3c99=['single','addLogo','logologin','file','preferred','/:id/preferred','addPreferred','favicon','addFavicon','put','isAuthenticated','update','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./setting.controller','get','getDate','/:id','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','getPreferred','/:id/favicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','/:id/logo'];(function(_0x398294,_0x5ceb9d){var _0x2a872d=function(_0x390883){while(--_0x390883){_0x398294['push'](_0x398294['shift']());}};_0x2a872d(++_0x5ceb9d);}(_0x3c99,0x12c));var _0x93c9=function(_0x28588a,_0xe1fb36){_0x28588a=_0x28588a-0x0;var _0x480167=_0x3c99[_0x28588a];return _0x480167;};'use strict';var multer=require(_0x93c9('0x0'));var util=require(_0x93c9('0x1'));var path=require(_0x93c9('0x2'));var timeout=require(_0x93c9('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x93c9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x93c9('0x5'));var config=require(_0x93c9('0x6'));var controller=require(_0x93c9('0x7'));router[_0x93c9('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/now',controller[_0x93c9('0x9')]);router['get'](_0x93c9('0xa'),controller['show']);router['get']('/:id/logo',controller[_0x93c9('0xb')]);router[_0x93c9('0x8')](_0x93c9('0xc'),controller[_0x93c9('0xd')]);router[_0x93c9('0x8')](_0x93c9('0xe'),controller['gdpr']);router[_0x93c9('0x8')]('/:id/preferred',controller[_0x93c9('0xf')]);router[_0x93c9('0x8')](_0x93c9('0x10'),controller['getFavicon']);var upload=multer({'storage':multer[_0x93c9('0x11')]({'destination':function(_0x91bfe2,_0x26b375,_0xc4d1e0){_0xc4d1e0(null,path[_0x93c9('0x12')](config[_0x93c9('0x13')],_0x93c9('0x14')));},'filename':function(_0x223aa3,_0x1f6b80,_0x5414aa){_0x5414aa(null,util[_0x93c9('0x15')](_0x93c9('0x16'),_0x93c9('0x17'),path[_0x93c9('0x18')](_0x1f6b80[_0x93c9('0x19')])));}})});router[_0x93c9('0x1a')](_0x93c9('0x1b'),upload[_0x93c9('0x1c')]('file'),controller[_0x93c9('0x1d')]);var upload=multer({'storage':multer[_0x93c9('0x11')]({'destination':function(_0x556b2c,_0x14f185,_0x4c14c6){_0x4c14c6(null,path[_0x93c9('0x12')](config[_0x93c9('0x13')],_0x93c9('0x14')));},'filename':function(_0x5332ec,_0xb9d8ee,_0x3c2359){_0x3c2359(null,util[_0x93c9('0x15')](_0x93c9('0x16'),_0x93c9('0x1e'),path[_0x93c9('0x18')](_0xb9d8ee[_0x93c9('0x19')])));}})});router[_0x93c9('0x1a')](_0x93c9('0xc'),upload['single'](_0x93c9('0x1f')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x93c9('0x11')]({'destination':function(_0x593ca0,_0x559d69,_0x446c32){_0x446c32(null,path[_0x93c9('0x12')](config[_0x93c9('0x13')],_0x93c9('0x14')));},'filename':function(_0x1e90be,_0xb434ac,_0x486ff7){_0x486ff7(null,util['format'](_0x93c9('0x16'),_0x93c9('0x20'),path['extname'](_0xb434ac['originalname'])));}})});router['post'](_0x93c9('0x21'),upload[_0x93c9('0x1c')](_0x93c9('0x1f')),controller[_0x93c9('0x22')]);var upload=multer({'storage':multer[_0x93c9('0x11')]({'destination':function(_0x3342df,_0x33e646,_0x4f3df8){_0x4f3df8(null,path[_0x93c9('0x12')](config[_0x93c9('0x13')],_0x93c9('0x14')));},'filename':function(_0x5f57e6,_0x1f30ff,_0x5ecb95){_0x5ecb95(null,util[_0x93c9('0x15')](_0x93c9('0x16'),_0x93c9('0x23'),path[_0x93c9('0x18')](_0x1f30ff[_0x93c9('0x19')])));}})});router[_0x93c9('0x1a')](_0x93c9('0x10'),upload[_0x93c9('0x1c')](_0x93c9('0x1f')),controller[_0x93c9('0x24')]);router[_0x93c9('0x25')]('/:id',auth[_0x93c9('0x26')](),controller[_0x93c9('0x27')]);module[_0x93c9('0x28')]=router; \ No newline at end of file +var _0x2e89=['post','single','file','addLogo','diskStorage','root','%s%s','logologin','originalname','addLogoLogin','join','server/files/images/logos/','preferred','addPreferred','favicon','addFavicon','put','update','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./setting.controller','isAuthenticated','index','/now','getDate','get','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','getPreferred','/:id/favicon','format','logo','extname'];(function(_0x5098d3,_0x245091){var _0x285389=function(_0x2a32c9){while(--_0x2a32c9){_0x5098d3['push'](_0x5098d3['shift']());}};_0x285389(++_0x245091);}(_0x2e89,0x11b));var _0x92e8=function(_0xfba164,_0x2e0f4f){_0xfba164=_0xfba164-0x0;var _0x1681dc=_0x2e89[_0xfba164];return _0x1681dc;};'use strict';var multer=require(_0x92e8('0x0'));var util=require('util');var path=require(_0x92e8('0x1'));var timeout=require(_0x92e8('0x2'));var express=require('express');var router=express[_0x92e8('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x92e8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x92e8('0x5'));var controller=require(_0x92e8('0x6'));router['get']('/',auth[_0x92e8('0x7')](),controller[_0x92e8('0x8')]);router['get'](_0x92e8('0x9'),controller[_0x92e8('0xa')]);router[_0x92e8('0xb')](_0x92e8('0xc'),controller[_0x92e8('0xd')]);router[_0x92e8('0xb')](_0x92e8('0xe'),controller[_0x92e8('0xf')]);router[_0x92e8('0xb')](_0x92e8('0x10'),controller[_0x92e8('0x11')]);router[_0x92e8('0xb')](_0x92e8('0x12'),controller['gdpr']);router[_0x92e8('0xb')](_0x92e8('0x13'),controller[_0x92e8('0x14')]);router['get'](_0x92e8('0x15'),controller['getFavicon']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x15e0a5,_0xb1b6a4,_0x5950f0){_0x5950f0(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0x35268d,_0x1698d6,_0x298ef2){_0x298ef2(null,util[_0x92e8('0x16')]('%s%s',_0x92e8('0x17'),path[_0x92e8('0x18')](_0x1698d6['originalname'])));}})});router[_0x92e8('0x19')](_0x92e8('0xe'),upload[_0x92e8('0x1a')](_0x92e8('0x1b')),controller[_0x92e8('0x1c')]);var upload=multer({'storage':multer[_0x92e8('0x1d')]({'destination':function(_0xffd218,_0x382ff0,_0x2fa672){_0x2fa672(null,path['join'](config[_0x92e8('0x1e')],'server/files/images/logos/'));},'filename':function(_0x3fe7ce,_0x26f99d,_0xf606a1){_0xf606a1(null,util[_0x92e8('0x16')](_0x92e8('0x1f'),_0x92e8('0x20'),path['extname'](_0x26f99d[_0x92e8('0x21')])));}})});router['post'](_0x92e8('0x10'),upload[_0x92e8('0x1a')]('file'),controller[_0x92e8('0x22')]);var upload=multer({'storage':multer[_0x92e8('0x1d')]({'destination':function(_0x46d7df,_0x2751a7,_0x4ff126){_0x4ff126(null,path[_0x92e8('0x23')](config[_0x92e8('0x1e')],_0x92e8('0x24')));},'filename':function(_0x5cf85e,_0x3c7d39,_0x482142){_0x482142(null,util['format'](_0x92e8('0x1f'),_0x92e8('0x25'),path[_0x92e8('0x18')](_0x3c7d39[_0x92e8('0x21')])));}})});router['post'](_0x92e8('0x13'),upload['single'](_0x92e8('0x1b')),controller[_0x92e8('0x26')]);var upload=multer({'storage':multer[_0x92e8('0x1d')]({'destination':function(_0x4934b4,_0x43d84d,_0x4e4495){_0x4e4495(null,path[_0x92e8('0x23')](config[_0x92e8('0x1e')],'server/files/images/logos/'));},'filename':function(_0x58b013,_0x295ba0,_0x5e9034){_0x5e9034(null,util['format'](_0x92e8('0x1f'),_0x92e8('0x27'),path['extname'](_0x295ba0[_0x92e8('0x21')])));}})});router[_0x92e8('0x19')](_0x92e8('0x15'),upload[_0x92e8('0x1a')](_0x92e8('0x1b')),controller[_0x92e8('0x28')]);router[_0x92e8('0x29')](_0x92e8('0xc'),auth[_0x92e8('0x7')](),controller[_0x92e8('0x2a')]);module[_0x92e8('0x2b')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 5873a94..1c6826e 100644 --- a/server/api/setting/setting.attributes.js +++ b/server/api/setting/setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x27f8cd,_0x26f9f6){var _0x3950ae=function(_0xf99dfc){while(--_0xf99dfc){_0x27f8cd['push'](_0x27f8cd['shift']());}};_0x3950ae(++_0x26f9f6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x3d9591,_0x582e1d){var _0x190caf=function(_0x16a294){while(--_0x16a294){_0x3d9591['push'](_0x3d9591['shift']());}};_0x190caf(++_0x582e1d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index e4edda8..cc53bbf 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 _0x4ce6=['getDate','utcOffset','now','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','request','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','then','name','send','map','Setting','rawAttributes','fieldName','type','key','keys','query','filters','intersection','attributes','fields','length','model','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','show','find','update','body','addLogo','file','filename','logo','params','addLogoLogin','server/files/images/logos','preferred','favicon','defaultLogo','defaultPreferred','defaultFavicon','existsSync','root','toLower','join','default','custom','Sequelize','ValidationError','getLogoLogin','getLicense','loginLogo','defaultLoginLogo','upperFirst','default_loginLogo.svg','\x20not\x20found','gdpr','default_preferred.png','download','addFavicon','getFavicon'];(function(_0x5e9083,_0x234c88){var _0x2da193=function(_0x3bd6b0){while(--_0x3bd6b0){_0x5e9083['push'](_0x5e9083['shift']());}};_0x2da193(++_0x234c88);}(_0x4ce6,0x15a));var _0x64ce=function(_0x5090d4,_0x1950a7){_0x5090d4=_0x5090d4-0x0;var _0x56c310=_0x4ce6[_0x5090d4];return _0x56c310;};'use strict';var emlformat=require(_0x64ce('0x0'));var rimraf=require(_0x64ce('0x1'));var zipdir=require(_0x64ce('0x2'));var jsonpatch=require(_0x64ce('0x3'));var rp=require(_0x64ce('0x4'));var moment=require('moment');var BPromise=require(_0x64ce('0x5'));var Mustache=require('mustache');var util=require(_0x64ce('0x6'));var path=require(_0x64ce('0x7'));var sox=require(_0x64ce('0x8'));var csv=require(_0x64ce('0x9'));var ejs=require(_0x64ce('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x64ce('0xb'));var squel=require('squel');var crypto=require(_0x64ce('0xc'));var jsforce=require(_0x64ce('0xd'));var deskjs=require(_0x64ce('0xe'));var toCsv=require(_0x64ce('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x64ce('0xf'));var authService=require(_0x64ce('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x64ce('0x11'));var hardwareService=require(_0x64ce('0x12'));var logger=require('../../config/logger')(_0x64ce('0x13'));var utils=require(_0x64ce('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x64ce('0x15'));var db=require(_0x64ce('0x16'))['db'];var jayson=require(_0x64ce('0x17'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1c4176,_0x14046,_0x3b7a2e,_0x46baf6){return new BPromise(function(_0x1be0f3,_0x3d692b){var _0x490cc3=_0x46baf6||client;return _0x490cc3[_0x64ce('0x18')](_0x1c4176,_0x3b7a2e)['then'](function(_0x3f7aa7){logger['info'](_0x64ce('0x19'),_0x14046,_0x64ce('0x1a'));logger[_0x64ce('0x1b')](_0x64ce('0x1c'),_0x14046,_0x64ce('0x1a'),JSON[_0x64ce('0x1d')](_0x3f7aa7));if(_0x3f7aa7['error']){if(_0x3f7aa7[_0x64ce('0x1e')][_0x64ce('0x1f')]===0x1f4){logger[_0x64ce('0x1e')](_0x64ce('0x19'),_0x14046,_0x3f7aa7[_0x64ce('0x1e')][_0x64ce('0x20')]);return _0x3d692b(_0x3f7aa7[_0x64ce('0x1e')][_0x64ce('0x20')]);}logger[_0x64ce('0x1e')](_0x64ce('0x19'),_0x14046,_0x3f7aa7[_0x64ce('0x1e')]['message']);return _0x1be0f3(_0x3f7aa7['error'][_0x64ce('0x20')]);}else{logger[_0x64ce('0x21')]('Setting,\x20%s,\x20%s',_0x14046,'request\x20sent');_0x1be0f3(_0x3f7aa7[_0x64ce('0x22')]['message']);}})[_0x64ce('0x23')](function(_0x3d801a){logger[_0x64ce('0x1e')](_0x64ce('0x19'),_0x14046,_0x3d801a);_0x3d692b(_0x3d801a);});});}function respondWithStatusCode(_0xf13f0a,_0x1db89f){_0x1db89f=_0x1db89f||0xcc;return function(_0x23e591){if(_0x23e591){return _0xf13f0a[_0x64ce('0x24')](_0x1db89f);}return _0xf13f0a[_0x64ce('0x25')](_0x1db89f)[_0x64ce('0x26')]();};}function respondWithResult(_0x54968a,_0x37e610){_0x37e610=_0x37e610||0xc8;return function(_0x4d626a){if(_0x4d626a){return _0x54968a[_0x64ce('0x25')](_0x37e610)[_0x64ce('0x27')](_0x4d626a);}};}function respondWithFilteredResult(_0x223081,_0x3728a3){return function(_0x51cecb){if(_0x51cecb){var _0x39c6c9=typeof _0x3728a3['offset']===_0x64ce('0x28')&&typeof _0x3728a3[_0x64ce('0x29')]===_0x64ce('0x28');var _0x485a48=_0x51cecb[_0x64ce('0x2a')];var _0x7d3376=_0x39c6c9?0x0:_0x3728a3[_0x64ce('0x2b')];var _0x36d2db=_0x39c6c9?_0x51cecb[_0x64ce('0x2a')]:_0x3728a3[_0x64ce('0x2b')]+_0x3728a3[_0x64ce('0x29')];var _0x1ffbf6;if(_0x36d2db>=_0x485a48){_0x36d2db=_0x485a48;_0x1ffbf6=0xc8;}else{_0x1ffbf6=0xce;}_0x223081[_0x64ce('0x25')](_0x1ffbf6);return _0x223081[_0x64ce('0x2c')](_0x64ce('0x2d'),_0x7d3376+'-'+_0x36d2db+'/'+_0x485a48)[_0x64ce('0x27')](_0x51cecb);}return null;};}function patchUpdates(_0x433897){return function(_0x2a7945){try{jsonpatch[_0x64ce('0x2e')](_0x2a7945,_0x433897,!![]);}catch(_0x427464){return BPromise['reject'](_0x427464);}return _0x2a7945['save']();};}function saveUpdates(_0x2fc362,_0x40f532){return function(_0x429e5c){if(_0x429e5c){return _0x429e5c['update'](_0x2fc362)[_0x64ce('0x2f')](function(_0x2783b2){return _0x2783b2;});}return null;};}function removeEntity(_0x1c1b06,_0x599232){return function(_0x36cd0b){if(_0x36cd0b){return _0x36cd0b['destroy']()[_0x64ce('0x2f')](function(){_0x1c1b06['status'](0xcc)[_0x64ce('0x26')]();});}};}function handleEntityNotFound(_0x3c6ec4,_0x1d3a73){return function(_0x483e82){if(!_0x483e82){_0x3c6ec4[_0x64ce('0x24')](0x194);}return _0x483e82;};}function handleError(_0x16eb18,_0xc54635){_0xc54635=_0xc54635||0x1f4;return function(_0x5bca7f){logger['error'](_0x5bca7f['stack']);if(_0x5bca7f[_0x64ce('0x30')]){delete _0x5bca7f[_0x64ce('0x30')];}_0x16eb18['status'](_0xc54635)[_0x64ce('0x31')](_0x5bca7f);};}exports['index']=function(_0x26e721,_0x468afb){var _0x51b6c3={},_0x376672={},_0x317b54={'count':0x0,'rows':[]};var _0x472767=_[_0x64ce('0x32')](db[_0x64ce('0x33')][_0x64ce('0x34')],function(_0x349a61){return{'name':_0x349a61[_0x64ce('0x35')],'type':_0x349a61[_0x64ce('0x36')][_0x64ce('0x37')]};});_0x376672['model']=_[_0x64ce('0x32')](_0x472767,_0x64ce('0x30'));_0x376672['query']=_[_0x64ce('0x38')](_0x26e721[_0x64ce('0x39')]);_0x376672[_0x64ce('0x3a')]=_[_0x64ce('0x3b')](_0x376672['model'],_0x376672[_0x64ce('0x39')]);_0x51b6c3[_0x64ce('0x3c')]=_[_0x64ce('0x3b')](_0x376672['model'],qs[_0x64ce('0x3d')](_0x26e721[_0x64ce('0x39')][_0x64ce('0x3d')]));_0x51b6c3[_0x64ce('0x3c')]=_0x51b6c3[_0x64ce('0x3c')][_0x64ce('0x3e')]?_0x51b6c3[_0x64ce('0x3c')]:_0x376672[_0x64ce('0x3f')];if(!_0x26e721[_0x64ce('0x39')]['hasOwnProperty']('nolimit')){_0x51b6c3[_0x64ce('0x29')]=qs[_0x64ce('0x29')](_0x26e721['query'][_0x64ce('0x29')]);_0x51b6c3[_0x64ce('0x2b')]=qs[_0x64ce('0x2b')](_0x26e721[_0x64ce('0x39')][_0x64ce('0x2b')]);}_0x51b6c3['order']=qs[_0x64ce('0x40')](_0x26e721['query'][_0x64ce('0x40')]);_0x51b6c3['where']=qs['filters'](_[_0x64ce('0x41')](_0x26e721['query'],_0x376672[_0x64ce('0x3a')]),_0x472767);if(_0x26e721[_0x64ce('0x39')][_0x64ce('0x42')]){_0x51b6c3['where']=_['merge'](_0x51b6c3[_0x64ce('0x43')],{'$or':_[_0x64ce('0x32')](_0x472767,function(_0xbdaf8e){if(_0xbdaf8e[_0x64ce('0x36')]!=='VIRTUAL'){var _0x3a4af8={};_0x3a4af8[_0xbdaf8e[_0x64ce('0x30')]]={'$like':'%'+_0x26e721['query']['filter']+'%'};return _0x3a4af8;}})});}_0x51b6c3=_[_0x64ce('0x44')]({},_0x51b6c3,_0x26e721[_0x64ce('0x45')]);var _0x5ac0cf={'where':_0x51b6c3['where']};return db[_0x64ce('0x33')]['count'](_0x5ac0cf)['then'](function(_0x343e76){_0x317b54['count']=_0x343e76;if(_0x26e721[_0x64ce('0x39')][_0x64ce('0x46')]){_0x51b6c3[_0x64ce('0x47')]=[{'all':!![]}];}return db[_0x64ce('0x33')][_0x64ce('0x48')](_0x51b6c3);})[_0x64ce('0x2f')](function(_0x1af512){_0x317b54[_0x64ce('0x49')]=_0x1af512;return _0x317b54;})['then'](respondWithFilteredResult(_0x468afb,_0x51b6c3))[_0x64ce('0x23')](handleError(_0x468afb,null));};exports[_0x64ce('0x4a')]=function(_0xf5ad6e,_0x28533a){var _0x269baf={'raw':![],'where':{'id':_0xf5ad6e['params']['id']}},_0x3f94e0={};_0x3f94e0[_0x64ce('0x3f')]=_[_0x64ce('0x38')](db[_0x64ce('0x33')][_0x64ce('0x34')]);_0x3f94e0[_0x64ce('0x39')]=_['keys'](_0xf5ad6e[_0x64ce('0x39')]);_0x3f94e0[_0x64ce('0x3a')]=_[_0x64ce('0x3b')](_0x3f94e0['model'],_0x3f94e0['query']);_0x269baf[_0x64ce('0x3c')]=_['intersection'](_0x3f94e0[_0x64ce('0x3f')],qs[_0x64ce('0x3d')](_0xf5ad6e[_0x64ce('0x39')][_0x64ce('0x3d')]));_0x269baf[_0x64ce('0x3c')]=_0x269baf['attributes']['length']?_0x269baf[_0x64ce('0x3c')]:_0x3f94e0[_0x64ce('0x3f')];if(_0xf5ad6e[_0x64ce('0x39')][_0x64ce('0x46')]){_0x269baf[_0x64ce('0x47')]=[{'all':!![]}];}_0x269baf=_[_0x64ce('0x44')]({},_0x269baf,_0xf5ad6e[_0x64ce('0x45')]);return db[_0x64ce('0x33')][_0x64ce('0x4b')](_0x269baf)[_0x64ce('0x2f')](handleEntityNotFound(_0x28533a,null))['then'](respondWithResult(_0x28533a,null))['catch'](handleError(_0x28533a,null));};exports[_0x64ce('0x4c')]=function(_0x2163fa,_0x4a5cc5){if(_0x2163fa['body']['id']){delete _0x2163fa[_0x64ce('0x4d')]['id'];}return db[_0x64ce('0x33')][_0x64ce('0x4b')]({'where':{'id':_0x2163fa['params']['id']}})[_0x64ce('0x2f')](handleEntityNotFound(_0x4a5cc5,null))[_0x64ce('0x2f')](saveUpdates(_0x2163fa[_0x64ce('0x4d')],null))[_0x64ce('0x2f')](respondWithResult(_0x4a5cc5,null))[_0x64ce('0x23')](handleError(_0x4a5cc5,null));};exports[_0x64ce('0x4e')]=function(_0x427e7d,_0x5e9e71,_0x23327e){if(_0x427e7d[_0x64ce('0x4f')]&&_0x427e7d[_0x64ce('0x4f')][_0x64ce('0x50')]){_0x427e7d[_0x64ce('0x4d')][_0x64ce('0x51')]=_0x427e7d[_0x64ce('0x4f')]['filename'];}return db[_0x64ce('0x33')][_0x64ce('0x4b')]({'where':{'id':_0x427e7d[_0x64ce('0x52')]['id']}})['then'](handleEntityNotFound(_0x5e9e71,null))[_0x64ce('0x2f')](saveUpdates(_0x427e7d[_0x64ce('0x4d')],null))[_0x64ce('0x2f')](respondWithResult(_0x5e9e71,null))[_0x64ce('0x23')](handleError(_0x5e9e71,null));};exports[_0x64ce('0x53')]=function(_0x4e8ee3,_0x24574d,_0x80ab89){if(_0x4e8ee3[_0x64ce('0x4f')]&&_0x4e8ee3[_0x64ce('0x4f')]['filename']){_0x4e8ee3[_0x64ce('0x4d')]['loginLogo']=_0x4e8ee3[_0x64ce('0x4f')][_0x64ce('0x50')];}return db['Setting'][_0x64ce('0x4b')]({'where':{'id':_0x4e8ee3[_0x64ce('0x52')]['id']}})[_0x64ce('0x2f')](handleEntityNotFound(_0x24574d,null))[_0x64ce('0x2f')](saveUpdates(_0x4e8ee3[_0x64ce('0x4d')],null))['then'](respondWithResult(_0x24574d,null))[_0x64ce('0x23')](handleError(_0x24574d,null));};var utilLicense=require(_0x64ce('0x15'));exports['getLogo']=function(_0x5a7d58,_0x521d3f,_0x8a268){var _0x351929=_0x64ce('0x54');var _0x55752a={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x21b58f){if(_0x21b58f){_0x55752a=_0x21b58f;}return db[_0x64ce('0x33')][_0x64ce('0x4b')]({'where':{'id':_0x5a7d58[_0x64ce('0x52')]['id']},'attributes':[_0x64ce('0x51'),'loginLogo',_0x64ce('0x55'),_0x64ce('0x56'),_0x64ce('0x57'),'defaultLoginLogo',_0x64ce('0x58'),_0x64ce('0x59')],'raw':!![]});})[_0x64ce('0x2f')](handleEntityNotFound(_0x521d3f,null))['then'](function(_0x380039){if(_0x380039){var _0x4b71b3=_0x380039[_0x64ce('0x51')]&&fs[_0x64ce('0x5a')](path['join'](config[_0x64ce('0x5b')],_0x351929,_[_0x64ce('0x5c')](_0x380039[_0x64ce('0x51')])))?path[_0x64ce('0x5d')](config[_0x64ce('0x5b')],_0x351929,_[_0x64ce('0x5c')](_0x380039[_0x64ce('0x51')])):path[_0x64ce('0x5d')](config[_0x64ce('0x5b')],_0x351929,_[_0x64ce('0x5c')]('default_logo.svg'));var _0x4fd321=_0x64ce('0x5e')+_['upperFirst'](_0x64ce('0x51'));if(_0x380039[_0x4fd321]||!_0x55752a[_0x64ce('0x5f')]){_0x4b71b3=path[_0x64ce('0x5d')](config[_0x64ce('0x5b')],_0x351929,_['toLower']('default_logo.svg'));}if(!fs[_0x64ce('0x5a')](_0x4b71b3)){throw new db[(_0x64ce('0x60'))][(_0x64ce('0x61'))](_['upperFirst'](_0x64ce('0x51'))+'\x20not\x20found');}return _0x521d3f['download'](_0x4b71b3);}})[_0x64ce('0x23')](handleError(_0x521d3f,null));};var utilLicense=require(_0x64ce('0x15'));exports[_0x64ce('0x62')]=function(_0x85b077,_0x19bc77,_0x1b7f3f){var _0x976973=_0x64ce('0x54');var _0x2b70a8={'custom':![]};return utilLicense[_0x64ce('0x63')]()[_0x64ce('0x2f')](function(_0x84ad8b){if(_0x84ad8b){_0x2b70a8=_0x84ad8b;}return db['Setting']['find']({'where':{'id':_0x85b077[_0x64ce('0x52')]['id']},'attributes':[_0x64ce('0x51'),_0x64ce('0x64'),_0x64ce('0x55'),_0x64ce('0x56'),'defaultLogo',_0x64ce('0x65'),_0x64ce('0x58'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x19bc77,null))[_0x64ce('0x2f')](function(_0x340fce){if(_0x340fce){var _0x4e40db=_0x340fce[_0x64ce('0x64')]&&fs['existsSync'](path['join'](config['root'],_0x976973,_[_0x64ce('0x5c')](_0x340fce['loginLogo'])))?path[_0x64ce('0x5d')](config['root'],_0x976973,_[_0x64ce('0x5c')](_0x340fce[_0x64ce('0x64')])):path['join'](config['root'],_0x976973,_[_0x64ce('0x5c')]('default_loginLogo.svg'));var _0x24cf9c=_0x64ce('0x5e')+_[_0x64ce('0x66')]('loginLogo');if(_0x340fce[_0x24cf9c]||!_0x2b70a8[_0x64ce('0x5f')]){_0x4e40db=path[_0x64ce('0x5d')](config[_0x64ce('0x5b')],_0x976973,_[_0x64ce('0x5c')](_0x64ce('0x67')));}if(!fs['existsSync'](_0x4e40db)){throw new db[(_0x64ce('0x60'))][(_0x64ce('0x61'))](_['upperFirst'](_0x64ce('0x64'))+_0x64ce('0x68'));}return _0x19bc77['download'](_0x4e40db);}})['catch'](handleError(_0x19bc77,null));};exports[_0x64ce('0x69')]=function(_0xbc3165,_0x131ff6){return db[_0x64ce('0x33')][_0x64ce('0x4b')]({'where':{'id':_0xbc3165['params']['id']},'attributes':['securePassword']})['then'](respondWithResult(_0x131ff6,null))[_0x64ce('0x23')](handleError(_0x131ff6,null));};exports['addPreferred']=function(_0x5a56fc,_0x2f7ccf,_0x9bdc19){if(_0x5a56fc[_0x64ce('0x4f')]&&_0x5a56fc[_0x64ce('0x4f')]['filename']){_0x5a56fc['body']['preferred']=_0x5a56fc[_0x64ce('0x4f')][_0x64ce('0x50')];}return db[_0x64ce('0x33')][_0x64ce('0x4b')]({'where':{'id':_0x5a56fc[_0x64ce('0x52')]['id']}})['then'](handleEntityNotFound(_0x2f7ccf,null))[_0x64ce('0x2f')](saveUpdates(_0x5a56fc[_0x64ce('0x4d')],null))['then'](respondWithResult(_0x2f7ccf,null))[_0x64ce('0x23')](handleError(_0x2f7ccf,null));};var utilLicense=require(_0x64ce('0x15'));exports['getPreferred']=function(_0x1a84ea,_0xda092,_0x51afc4){var _0x1bac87=_0x64ce('0x54');var _0x4da863={'custom':![]};return utilLicense[_0x64ce('0x63')]()['then'](function(_0x13279a){if(_0x13279a){_0x4da863=_0x13279a;}return db[_0x64ce('0x33')][_0x64ce('0x4b')]({'where':{'id':_0x1a84ea['params']['id']},'attributes':[_0x64ce('0x51'),_0x64ce('0x64'),_0x64ce('0x55'),_0x64ce('0x56'),'defaultLogo',_0x64ce('0x65'),_0x64ce('0x58'),_0x64ce('0x59')],'raw':!![]});})['then'](handleEntityNotFound(_0xda092,null))[_0x64ce('0x2f')](function(_0x188bfe){if(_0x188bfe){var _0x4bdc92=_0x188bfe[_0x64ce('0x55')]&&fs['existsSync'](path['join'](config['root'],_0x1bac87,_[_0x64ce('0x5c')](_0x188bfe[_0x64ce('0x55')])))?path[_0x64ce('0x5d')](config[_0x64ce('0x5b')],_0x1bac87,_[_0x64ce('0x5c')](_0x188bfe[_0x64ce('0x55')])):path[_0x64ce('0x5d')](config['root'],_0x1bac87,_[_0x64ce('0x5c')](_0x64ce('0x6a')));var _0x233080='default'+_[_0x64ce('0x66')](_0x64ce('0x55'));if(_0x188bfe[_0x233080]||!_0x4da863[_0x64ce('0x5f')]||!_0x4da863[_0x64ce('0x55')]){_0x4bdc92=path[_0x64ce('0x5d')](config[_0x64ce('0x5b')],_0x1bac87,_[_0x64ce('0x5c')](_0x64ce('0x6a')));}if(!fs[_0x64ce('0x5a')](_0x4bdc92)){throw new db[(_0x64ce('0x60'))][(_0x64ce('0x61'))](_[_0x64ce('0x66')]('preferred')+_0x64ce('0x68'));}return _0xda092[_0x64ce('0x6b')](_0x4bdc92);}})[_0x64ce('0x23')](handleError(_0xda092,null));};exports[_0x64ce('0x6c')]=function(_0x4c31b5,_0x228984,_0x39b5bd){if(_0x4c31b5[_0x64ce('0x4f')]&&_0x4c31b5[_0x64ce('0x4f')][_0x64ce('0x50')]){_0x4c31b5[_0x64ce('0x4d')][_0x64ce('0x56')]=_0x4c31b5['file'][_0x64ce('0x50')];}return db[_0x64ce('0x33')][_0x64ce('0x4b')]({'where':{'id':_0x4c31b5['params']['id']}})[_0x64ce('0x2f')](handleEntityNotFound(_0x228984,null))[_0x64ce('0x2f')](saveUpdates(_0x4c31b5[_0x64ce('0x4d')],null))[_0x64ce('0x2f')](respondWithResult(_0x228984,null))[_0x64ce('0x23')](handleError(_0x228984,null));};var utilLicense=require(_0x64ce('0x15'));exports[_0x64ce('0x6d')]=function(_0x55d8cb,_0x5959f8,_0x35f144){var _0x28039d=_0x64ce('0x54');var _0x1a2823={'custom':![]};return utilLicense[_0x64ce('0x63')]()['then'](function(_0x3c1740){if(_0x3c1740){_0x1a2823=_0x3c1740;}return db['Setting'][_0x64ce('0x4b')]({'where':{'id':_0x55d8cb[_0x64ce('0x52')]['id']},'attributes':[_0x64ce('0x51'),'loginLogo',_0x64ce('0x55'),_0x64ce('0x56'),_0x64ce('0x57'),'defaultLoginLogo',_0x64ce('0x58'),_0x64ce('0x59')],'raw':!![]});})[_0x64ce('0x2f')](handleEntityNotFound(_0x5959f8,null))[_0x64ce('0x2f')](function(_0x2b655f){if(_0x2b655f){var _0x25edce=_0x2b655f['favicon']&&fs['existsSync'](path['join'](config[_0x64ce('0x5b')],_0x28039d,_['toLower'](_0x2b655f[_0x64ce('0x56')])))?path['join'](config[_0x64ce('0x5b')],_0x28039d,_['toLower'](_0x2b655f[_0x64ce('0x56')])):path[_0x64ce('0x5d')](config['root'],_0x28039d,_[_0x64ce('0x5c')]('default_favicon.ico'));var _0x106e3=_0x64ce('0x5e')+_['upperFirst'](_0x64ce('0x56'));if(_0x2b655f[_0x106e3]||!_0x1a2823[_0x64ce('0x5f')]){_0x25edce=path[_0x64ce('0x5d')](config['root'],_0x28039d,_[_0x64ce('0x5c')]('default_favicon.ico'));}if(!fs['existsSync'](_0x25edce)){throw new db[(_0x64ce('0x60'))]['ValidationError'](_['upperFirst'](_0x64ce('0x56'))+_0x64ce('0x68'));}return _0x5959f8[_0x64ce('0x6b')](_0x25edce);}})['catch'](handleError(_0x5959f8,null));};exports[_0x64ce('0x6e')]=function(_0x13e18b,_0x3b01fa){var _0x2c2f79={'offset':moment()[_0x64ce('0x6f')]()};_0x2c2f79[_0x64ce('0x70')]=moment()[_0x64ce('0x6f')](_0x2c2f79[_0x64ce('0x2b')])['format'](_0x64ce('0x71'));return _0x3b01fa[_0x64ce('0x25')](0xc8)[_0x64ce('0x31')](_0x2c2f79);}; \ No newline at end of file +var _0x0911=['pick','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','length','merge','find','body','addLogo','file','filename','loginLogo','../../config/license/util','getLogo','getLicense','logo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','upperFirst','custom','Sequelize','\x20not\x20found','download','getLogoLogin','server/files/images/logos','default_loginLogo.svg','default','ValidationError','gdpr','addPreferred','getPreferred','addFavicon','getFavicon','default_favicon.ico','getDate','now','utcOffset','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','client','http','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','offset','limit','undefined','count','Content-Range','reject','update','then','destroy','stack','name','send','index','map','Setting','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters'];(function(_0x4fd89e,_0x22f444){var _0x2b1c6e=function(_0x2c0ee1){while(--_0x2c0ee1){_0x4fd89e['push'](_0x4fd89e['shift']());}};_0x2b1c6e(++_0x22f444);}(_0x0911,0x1a9));var _0x1091=function(_0x2336ea,_0x46e872){_0x2336ea=_0x2336ea-0x0;var _0x216bf9=_0x0911[_0x2336ea];return _0x216bf9;};'use strict';var emlformat=require(_0x1091('0x0'));var rimraf=require(_0x1091('0x1'));var zipdir=require(_0x1091('0x2'));var jsonpatch=require(_0x1091('0x3'));var rp=require(_0x1091('0x4'));var moment=require('moment');var BPromise=require(_0x1091('0x5'));var Mustache=require('mustache');var util=require(_0x1091('0x6'));var path=require(_0x1091('0x7'));var sox=require(_0x1091('0x8'));var csv=require(_0x1091('0x9'));var ejs=require(_0x1091('0xa'));var fs=require('fs');var fs_extra=require(_0x1091('0xb'));var _=require(_0x1091('0xc'));var squel=require(_0x1091('0xd'));var crypto=require(_0x1091('0xe'));var jsforce=require(_0x1091('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x1091('0x9'));var querystring=require(_0x1091('0x10'));var Papa=require(_0x1091('0x11'));var Redis=require(_0x1091('0x12'));var authService=require(_0x1091('0x13'));var qs=require(_0x1091('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1091('0x15'));var logger=require(_0x1091('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x1091('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x1091('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x1091('0x19')][_0x1091('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x390560,_0x3edbba,_0x5c3f22,_0x36aff0){return new BPromise(function(_0x11c894,_0x5d34e7){var _0x5815db=_0x36aff0||client;return _0x5815db['request'](_0x390560,_0x5c3f22)['then'](function(_0x4483c4){logger[_0x1091('0x1b')](_0x1091('0x1c'),_0x3edbba,'request\x20sent');logger[_0x1091('0x1d')](_0x1091('0x1e'),_0x3edbba,_0x1091('0x1f'),JSON[_0x1091('0x20')](_0x4483c4));if(_0x4483c4[_0x1091('0x21')]){if(_0x4483c4['error'][_0x1091('0x22')]===0x1f4){logger[_0x1091('0x21')](_0x1091('0x1c'),_0x3edbba,_0x4483c4[_0x1091('0x21')][_0x1091('0x23')]);return _0x5d34e7(_0x4483c4['error'][_0x1091('0x23')]);}logger[_0x1091('0x21')]('Setting,\x20%s,\x20%s',_0x3edbba,_0x4483c4['error']['message']);return _0x11c894(_0x4483c4[_0x1091('0x21')][_0x1091('0x23')]);}else{logger[_0x1091('0x1b')](_0x1091('0x1c'),_0x3edbba,_0x1091('0x1f'));_0x11c894(_0x4483c4[_0x1091('0x24')][_0x1091('0x23')]);}})[_0x1091('0x25')](function(_0x3daff2){logger[_0x1091('0x21')](_0x1091('0x1c'),_0x3edbba,_0x3daff2);_0x5d34e7(_0x3daff2);});});}function respondWithStatusCode(_0x197355,_0x1925fc){_0x1925fc=_0x1925fc||0xcc;return function(_0x142597){if(_0x142597){return _0x197355[_0x1091('0x26')](_0x1925fc);}return _0x197355[_0x1091('0x27')](_0x1925fc)['end']();};}function respondWithResult(_0xc14e93,_0x3667a7){_0x3667a7=_0x3667a7||0xc8;return function(_0x266d34){if(_0x266d34){return _0xc14e93['status'](_0x3667a7)[_0x1091('0x28')](_0x266d34);}};}function respondWithFilteredResult(_0x598216,_0x26c91b){return function(_0x306165){if(_0x306165){var _0x15eb8d=typeof _0x26c91b[_0x1091('0x29')]==='undefined'&&typeof _0x26c91b[_0x1091('0x2a')]===_0x1091('0x2b');var _0x35ecdc=_0x306165[_0x1091('0x2c')];var _0x17e118=_0x15eb8d?0x0:_0x26c91b[_0x1091('0x29')];var _0x56dc27=_0x15eb8d?_0x306165[_0x1091('0x2c')]:_0x26c91b[_0x1091('0x29')]+_0x26c91b[_0x1091('0x2a')];var _0x39326e;if(_0x56dc27>=_0x35ecdc){_0x56dc27=_0x35ecdc;_0x39326e=0xc8;}else{_0x39326e=0xce;}_0x598216['status'](_0x39326e);return _0x598216['set'](_0x1091('0x2d'),_0x17e118+'-'+_0x56dc27+'/'+_0x35ecdc)[_0x1091('0x28')](_0x306165);}return null;};}function patchUpdates(_0xa8d68e){return function(_0x4592d2){try{jsonpatch['apply'](_0x4592d2,_0xa8d68e,!![]);}catch(_0x5995ec){return BPromise[_0x1091('0x2e')](_0x5995ec);}return _0x4592d2['save']();};}function saveUpdates(_0x55e2d3,_0x109602){return function(_0xc5af40){if(_0xc5af40){return _0xc5af40[_0x1091('0x2f')](_0x55e2d3)[_0x1091('0x30')](function(_0x2a5f0a){return _0x2a5f0a;});}return null;};}function removeEntity(_0x1354d1,_0x5a6a15){return function(_0x3b739a){if(_0x3b739a){return _0x3b739a[_0x1091('0x31')]()[_0x1091('0x30')](function(){_0x1354d1[_0x1091('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x105204,_0x60eaa){return function(_0x4a4d88){if(!_0x4a4d88){_0x105204[_0x1091('0x26')](0x194);}return _0x4a4d88;};}function handleError(_0x3a2372,_0x3b552e){_0x3b552e=_0x3b552e||0x1f4;return function(_0x5bc0ba){logger[_0x1091('0x21')](_0x5bc0ba[_0x1091('0x32')]);if(_0x5bc0ba['name']){delete _0x5bc0ba[_0x1091('0x33')];}_0x3a2372[_0x1091('0x27')](_0x3b552e)[_0x1091('0x34')](_0x5bc0ba);};}exports[_0x1091('0x35')]=function(_0x59287c,_0x5abc3e){var _0x4759b7={},_0x8ff924={},_0x4bb745={'count':0x0,'rows':[]};var _0x1e09db=_[_0x1091('0x36')](db[_0x1091('0x37')]['rawAttributes'],function(_0x21a724){return{'name':_0x21a724[_0x1091('0x38')],'type':_0x21a724[_0x1091('0x39')][_0x1091('0x3a')]};});_0x8ff924[_0x1091('0x3b')]=_[_0x1091('0x36')](_0x1e09db,'name');_0x8ff924[_0x1091('0x3c')]=_[_0x1091('0x3d')](_0x59287c[_0x1091('0x3c')]);_0x8ff924['filters']=_[_0x1091('0x3e')](_0x8ff924[_0x1091('0x3b')],_0x8ff924[_0x1091('0x3c')]);_0x4759b7[_0x1091('0x3f')]=_[_0x1091('0x3e')](_0x8ff924[_0x1091('0x3b')],qs[_0x1091('0x40')](_0x59287c['query'][_0x1091('0x40')]));_0x4759b7[_0x1091('0x3f')]=_0x4759b7[_0x1091('0x3f')]['length']?_0x4759b7[_0x1091('0x3f')]:_0x8ff924['model'];if(!_0x59287c[_0x1091('0x3c')][_0x1091('0x41')](_0x1091('0x42'))){_0x4759b7[_0x1091('0x2a')]=qs[_0x1091('0x2a')](_0x59287c[_0x1091('0x3c')][_0x1091('0x2a')]);_0x4759b7['offset']=qs[_0x1091('0x29')](_0x59287c[_0x1091('0x3c')]['offset']);}_0x4759b7[_0x1091('0x43')]=qs[_0x1091('0x44')](_0x59287c[_0x1091('0x3c')]['sort']);_0x4759b7[_0x1091('0x45')]=qs[_0x1091('0x46')](_[_0x1091('0x47')](_0x59287c[_0x1091('0x3c')],_0x8ff924[_0x1091('0x46')]),_0x1e09db);if(_0x59287c['query']['filter']){_0x4759b7['where']=_['merge'](_0x4759b7[_0x1091('0x45')],{'$or':_[_0x1091('0x36')](_0x1e09db,function(_0x3074f3){if(_0x3074f3[_0x1091('0x39')]!==_0x1091('0x48')){var _0x316ffa={};_0x316ffa[_0x3074f3[_0x1091('0x33')]]={'$like':'%'+_0x59287c[_0x1091('0x3c')]['filter']+'%'};return _0x316ffa;}})});}_0x4759b7=_['merge']({},_0x4759b7,_0x59287c[_0x1091('0x49')]);var _0x2b90e5={'where':_0x4759b7[_0x1091('0x45')]};return db[_0x1091('0x37')][_0x1091('0x2c')](_0x2b90e5)['then'](function(_0x2e58aa){_0x4bb745['count']=_0x2e58aa;if(_0x59287c[_0x1091('0x3c')][_0x1091('0x4a')]){_0x4759b7[_0x1091('0x4b')]=[{'all':!![]}];}return db[_0x1091('0x37')][_0x1091('0x4c')](_0x4759b7);})[_0x1091('0x30')](function(_0x4fc761){_0x4bb745[_0x1091('0x4d')]=_0x4fc761;return _0x4bb745;})[_0x1091('0x30')](respondWithFilteredResult(_0x5abc3e,_0x4759b7))[_0x1091('0x25')](handleError(_0x5abc3e,null));};exports[_0x1091('0x4e')]=function(_0x120884,_0xd3e976){var _0x4bc74f={'raw':![],'where':{'id':_0x120884[_0x1091('0x4f')]['id']}},_0x36f93a={};_0x36f93a[_0x1091('0x3b')]=_[_0x1091('0x3d')](db[_0x1091('0x37')][_0x1091('0x50')]);_0x36f93a[_0x1091('0x3c')]=_[_0x1091('0x3d')](_0x120884[_0x1091('0x3c')]);_0x36f93a[_0x1091('0x46')]=_[_0x1091('0x3e')](_0x36f93a[_0x1091('0x3b')],_0x36f93a[_0x1091('0x3c')]);_0x4bc74f[_0x1091('0x3f')]=_[_0x1091('0x3e')](_0x36f93a[_0x1091('0x3b')],qs[_0x1091('0x40')](_0x120884[_0x1091('0x3c')][_0x1091('0x40')]));_0x4bc74f['attributes']=_0x4bc74f['attributes'][_0x1091('0x51')]?_0x4bc74f[_0x1091('0x3f')]:_0x36f93a[_0x1091('0x3b')];if(_0x120884[_0x1091('0x3c')][_0x1091('0x4a')]){_0x4bc74f['include']=[{'all':!![]}];}_0x4bc74f=_[_0x1091('0x52')]({},_0x4bc74f,_0x120884[_0x1091('0x49')]);return db[_0x1091('0x37')][_0x1091('0x53')](_0x4bc74f)[_0x1091('0x30')](handleEntityNotFound(_0xd3e976,null))['then'](respondWithResult(_0xd3e976,null))[_0x1091('0x25')](handleError(_0xd3e976,null));};exports[_0x1091('0x2f')]=function(_0x4aad78,_0x1bd8c0){if(_0x4aad78['body']['id']){delete _0x4aad78['body']['id'];}return db[_0x1091('0x37')]['find']({'where':{'id':_0x4aad78[_0x1091('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1bd8c0,null))[_0x1091('0x30')](saveUpdates(_0x4aad78[_0x1091('0x54')],null))[_0x1091('0x30')](respondWithResult(_0x1bd8c0,null))[_0x1091('0x25')](handleError(_0x1bd8c0,null));};exports[_0x1091('0x55')]=function(_0x34f2ae,_0x367cdf,_0x582111){if(_0x34f2ae[_0x1091('0x56')]&&_0x34f2ae[_0x1091('0x56')][_0x1091('0x57')]){_0x34f2ae[_0x1091('0x54')]['logo']=_0x34f2ae[_0x1091('0x56')][_0x1091('0x57')];}return db['Setting'][_0x1091('0x53')]({'where':{'id':_0x34f2ae['params']['id']}})[_0x1091('0x30')](handleEntityNotFound(_0x367cdf,null))[_0x1091('0x30')](saveUpdates(_0x34f2ae[_0x1091('0x54')],null))[_0x1091('0x30')](respondWithResult(_0x367cdf,null))[_0x1091('0x25')](handleError(_0x367cdf,null));};exports['addLogoLogin']=function(_0x1b6219,_0x165ca4,_0x4cafb2){if(_0x1b6219['file']&&_0x1b6219[_0x1091('0x56')]['filename']){_0x1b6219[_0x1091('0x54')][_0x1091('0x58')]=_0x1b6219[_0x1091('0x56')][_0x1091('0x57')];}return db[_0x1091('0x37')]['find']({'where':{'id':_0x1b6219['params']['id']}})[_0x1091('0x30')](handleEntityNotFound(_0x165ca4,null))[_0x1091('0x30')](saveUpdates(_0x1b6219[_0x1091('0x54')],null))['then'](respondWithResult(_0x165ca4,null))['catch'](handleError(_0x165ca4,null));};var utilLicense=require(_0x1091('0x59'));exports[_0x1091('0x5a')]=function(_0x201647,_0x27fd58,_0x109aa4){var _0x40fc12='server/files/images/logos';var _0x3fbf11={'custom':![]};return utilLicense[_0x1091('0x5b')]()['then'](function(_0x43d361){if(_0x43d361){_0x3fbf11=_0x43d361;}return db[_0x1091('0x37')][_0x1091('0x53')]({'where':{'id':_0x201647['params']['id']},'attributes':[_0x1091('0x5c'),_0x1091('0x58'),_0x1091('0x5d'),_0x1091('0x5e'),_0x1091('0x5f'),_0x1091('0x60'),_0x1091('0x61'),_0x1091('0x62')],'raw':!![]});})['then'](handleEntityNotFound(_0x27fd58,null))['then'](function(_0x491e19){if(_0x491e19){var _0x2ea4cd=_0x491e19[_0x1091('0x5c')]&&fs[_0x1091('0x63')](path[_0x1091('0x64')](config[_0x1091('0x65')],_0x40fc12,_[_0x1091('0x66')](_0x491e19[_0x1091('0x5c')])))?path[_0x1091('0x64')](config[_0x1091('0x65')],_0x40fc12,_[_0x1091('0x66')](_0x491e19['logo'])):path[_0x1091('0x64')](config[_0x1091('0x65')],_0x40fc12,_[_0x1091('0x66')](_0x1091('0x67')));var _0x1e691b='default'+_[_0x1091('0x68')](_0x1091('0x5c'));if(_0x491e19[_0x1e691b]||!_0x3fbf11[_0x1091('0x69')]){_0x2ea4cd=path[_0x1091('0x64')](config[_0x1091('0x65')],_0x40fc12,_['toLower']('default_logo.svg'));}if(!fs[_0x1091('0x63')](_0x2ea4cd)){throw new db[(_0x1091('0x6a'))]['ValidationError'](_[_0x1091('0x68')]('logo')+_0x1091('0x6b'));}return _0x27fd58[_0x1091('0x6c')](_0x2ea4cd);}})['catch'](handleError(_0x27fd58,null));};var utilLicense=require(_0x1091('0x59'));exports[_0x1091('0x6d')]=function(_0x3770a1,_0x33c4db,_0x2b24a0){var _0x2f905f=_0x1091('0x6e');var _0x3c5714={'custom':![]};return utilLicense[_0x1091('0x5b')]()[_0x1091('0x30')](function(_0x2df47a){if(_0x2df47a){_0x3c5714=_0x2df47a;}return db['Setting'][_0x1091('0x53')]({'where':{'id':_0x3770a1[_0x1091('0x4f')]['id']},'attributes':[_0x1091('0x5c'),_0x1091('0x58'),_0x1091('0x5d'),_0x1091('0x5e'),_0x1091('0x5f'),_0x1091('0x60'),_0x1091('0x61'),_0x1091('0x62')],'raw':!![]});})[_0x1091('0x30')](handleEntityNotFound(_0x33c4db,null))[_0x1091('0x30')](function(_0x405674){if(_0x405674){var _0x408713=_0x405674[_0x1091('0x58')]&&fs[_0x1091('0x63')](path['join'](config[_0x1091('0x65')],_0x2f905f,_[_0x1091('0x66')](_0x405674['loginLogo'])))?path[_0x1091('0x64')](config['root'],_0x2f905f,_['toLower'](_0x405674[_0x1091('0x58')])):path[_0x1091('0x64')](config[_0x1091('0x65')],_0x2f905f,_[_0x1091('0x66')](_0x1091('0x6f')));var _0x39b3b2=_0x1091('0x70')+_[_0x1091('0x68')](_0x1091('0x58'));if(_0x405674[_0x39b3b2]||!_0x3c5714['custom']){_0x408713=path['join'](config[_0x1091('0x65')],_0x2f905f,_['toLower'](_0x1091('0x6f')));}if(!fs['existsSync'](_0x408713)){throw new db['Sequelize'][(_0x1091('0x71'))](_['upperFirst'](_0x1091('0x58'))+_0x1091('0x6b'));}return _0x33c4db[_0x1091('0x6c')](_0x408713);}})[_0x1091('0x25')](handleError(_0x33c4db,null));};exports[_0x1091('0x72')]=function(_0x2c320b,_0x305f8e){return db[_0x1091('0x37')][_0x1091('0x53')]({'where':{'id':_0x2c320b[_0x1091('0x4f')]['id']},'attributes':['securePassword']})[_0x1091('0x30')](respondWithResult(_0x305f8e,null))[_0x1091('0x25')](handleError(_0x305f8e,null));};exports[_0x1091('0x73')]=function(_0x30d952,_0x3db063,_0x47353c){if(_0x30d952['file']&&_0x30d952['file'][_0x1091('0x57')]){_0x30d952[_0x1091('0x54')][_0x1091('0x5d')]=_0x30d952[_0x1091('0x56')][_0x1091('0x57')];}return db[_0x1091('0x37')][_0x1091('0x53')]({'where':{'id':_0x30d952[_0x1091('0x4f')]['id']}})[_0x1091('0x30')](handleEntityNotFound(_0x3db063,null))[_0x1091('0x30')](saveUpdates(_0x30d952[_0x1091('0x54')],null))[_0x1091('0x30')](respondWithResult(_0x3db063,null))[_0x1091('0x25')](handleError(_0x3db063,null));};var utilLicense=require(_0x1091('0x59'));exports[_0x1091('0x74')]=function(_0x8779fd,_0x260461,_0x54dbed){var _0x4d9ca9=_0x1091('0x6e');var _0x2dcbae={'custom':![]};return utilLicense[_0x1091('0x5b')]()['then'](function(_0x511132){if(_0x511132){_0x2dcbae=_0x511132;}return db[_0x1091('0x37')][_0x1091('0x53')]({'where':{'id':_0x8779fd[_0x1091('0x4f')]['id']},'attributes':[_0x1091('0x5c'),_0x1091('0x58'),_0x1091('0x5d'),'favicon',_0x1091('0x5f'),'defaultLoginLogo',_0x1091('0x61'),_0x1091('0x62')],'raw':!![]});})[_0x1091('0x30')](handleEntityNotFound(_0x260461,null))[_0x1091('0x30')](function(_0x37c282){if(_0x37c282){var _0x313b37=_0x37c282[_0x1091('0x5d')]&&fs['existsSync'](path[_0x1091('0x64')](config['root'],_0x4d9ca9,_[_0x1091('0x66')](_0x37c282[_0x1091('0x5d')])))?path[_0x1091('0x64')](config[_0x1091('0x65')],_0x4d9ca9,_[_0x1091('0x66')](_0x37c282[_0x1091('0x5d')])):path[_0x1091('0x64')](config[_0x1091('0x65')],_0x4d9ca9,_[_0x1091('0x66')]('default_preferred.png'));var _0x449d94=_0x1091('0x70')+_['upperFirst']('preferred');if(_0x37c282[_0x449d94]||!_0x2dcbae[_0x1091('0x69')]||!_0x2dcbae[_0x1091('0x5d')]){_0x313b37=path[_0x1091('0x64')](config[_0x1091('0x65')],_0x4d9ca9,_['toLower']('default_preferred.png'));}if(!fs['existsSync'](_0x313b37)){throw new db[(_0x1091('0x6a'))]['ValidationError'](_[_0x1091('0x68')]('preferred')+_0x1091('0x6b'));}return _0x260461[_0x1091('0x6c')](_0x313b37);}})['catch'](handleError(_0x260461,null));};exports[_0x1091('0x75')]=function(_0x4fdd36,_0x4dcdab,_0x52a5c6){if(_0x4fdd36[_0x1091('0x56')]&&_0x4fdd36[_0x1091('0x56')][_0x1091('0x57')]){_0x4fdd36[_0x1091('0x54')][_0x1091('0x5e')]=_0x4fdd36['file'][_0x1091('0x57')];}return db[_0x1091('0x37')]['find']({'where':{'id':_0x4fdd36[_0x1091('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4dcdab,null))[_0x1091('0x30')](saveUpdates(_0x4fdd36['body'],null))[_0x1091('0x30')](respondWithResult(_0x4dcdab,null))[_0x1091('0x25')](handleError(_0x4dcdab,null));};var utilLicense=require('../../config/license/util');exports[_0x1091('0x76')]=function(_0x4e8286,_0x4f3dc3,_0x38db2f){var _0x5342ab=_0x1091('0x6e');var _0x27a482={'custom':![]};return utilLicense[_0x1091('0x5b')]()[_0x1091('0x30')](function(_0x554660){if(_0x554660){_0x27a482=_0x554660;}return db[_0x1091('0x37')][_0x1091('0x53')]({'where':{'id':_0x4e8286['params']['id']},'attributes':[_0x1091('0x5c'),_0x1091('0x58'),_0x1091('0x5d'),'favicon',_0x1091('0x5f'),_0x1091('0x60'),_0x1091('0x61'),_0x1091('0x62')],'raw':!![]});})['then'](handleEntityNotFound(_0x4f3dc3,null))['then'](function(_0xe3180c){if(_0xe3180c){var _0x33a6eb=_0xe3180c['favicon']&&fs[_0x1091('0x63')](path[_0x1091('0x64')](config[_0x1091('0x65')],_0x5342ab,_[_0x1091('0x66')](_0xe3180c[_0x1091('0x5e')])))?path[_0x1091('0x64')](config['root'],_0x5342ab,_[_0x1091('0x66')](_0xe3180c['favicon'])):path['join'](config[_0x1091('0x65')],_0x5342ab,_[_0x1091('0x66')](_0x1091('0x77')));var _0x5e1100=_0x1091('0x70')+_[_0x1091('0x68')](_0x1091('0x5e'));if(_0xe3180c[_0x5e1100]||!_0x27a482['custom']){_0x33a6eb=path[_0x1091('0x64')](config[_0x1091('0x65')],_0x5342ab,_[_0x1091('0x66')](_0x1091('0x77')));}if(!fs[_0x1091('0x63')](_0x33a6eb)){throw new db[(_0x1091('0x6a'))]['ValidationError'](_[_0x1091('0x68')](_0x1091('0x5e'))+_0x1091('0x6b'));}return _0x4f3dc3[_0x1091('0x6c')](_0x33a6eb);}})[_0x1091('0x25')](handleError(_0x4f3dc3,null));};exports[_0x1091('0x78')]=function(_0x42e50f,_0x2a1411){var _0x23828a={'offset':moment()['utcOffset']()};_0x23828a[_0x1091('0x79')]=moment()[_0x1091('0x7a')](_0x23828a[_0x1091('0x29')])[_0x1091('0x7b')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x2a1411[_0x1091('0x27')](0xc8)['send'](_0x23828a);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index ddd59c7..7d39b98 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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0xc79265,_0x436c5a){var _0x304803=function(_0x41a050){while(--_0x41a050){_0xc79265['push'](_0xc79265['shift']());}};_0x304803(++_0x436c5a);}(_0xedd9,0xfc));var _0x9edd=function(_0x32e6e9,_0x5f5802){_0x32e6e9=_0x32e6e9-0x0;var _0x478a1d=_0xedd9[_0x32e6e9];return _0x478a1d;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'settings','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(_0x4e198a,_0x5a6bad){var _0xb84bfe=function(_0x58d2b2){while(--_0x58d2b2){_0x4e198a['push'](_0x4e198a['shift']());}};_0xb84bfe(++_0x5a6bad);}(_0x55ca,0x126));var _0xa55c=function(_0x65cd03,_0x2913ee){_0x65cd03=_0x65cd03-0x0;var _0x21c579=_0x55ca[_0x65cd03];return _0x21c579;};'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 b2c7ad9..f6aa33d 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 _0x1697=['model','map','ShowSetting','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','Setting','options','raw','where','attributes','include'];(function(_0x4e8f19,_0x495141){var _0x584597=function(_0x42fee4){while(--_0x42fee4){_0x4e8f19['push'](_0x4e8f19['shift']());}};_0x584597(++_0x495141);}(_0x1697,0xff));var _0x7169=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0x1697[_0x373dee];return _0x46798f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7169('0x0'));var BPromise=require('bluebird');var rs=require(_0x7169('0x1'));var fs=require('fs');var Redis=require(_0x7169('0x2'));var db=require(_0x7169('0x3'))['db'];var utils=require(_0x7169('0x4'));var logger=require(_0x7169('0x5'))(_0x7169('0x6'));var config=require('../../config/environment');var jayson=require(_0x7169('0x7'));var client=jayson['client'][_0x7169('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x238fdf,_0x2f87b3,_0x1a0133){return new BPromise(function(_0x57f5e,_0x20d764){return client['request'](_0x238fdf,_0x1a0133)[_0x7169('0x9')](function(_0x4c2fa9){logger[_0x7169('0xa')](_0x7169('0xb'),_0x2f87b3,_0x7169('0xc'));logger[_0x7169('0xd')]('Setting,\x20%s,\x20%s,\x20%s',_0x2f87b3,_0x7169('0xc'),JSON[_0x7169('0xe')](_0x4c2fa9));if(_0x4c2fa9[_0x7169('0xf')]){if(_0x4c2fa9[_0x7169('0xf')][_0x7169('0x10')]===0x1f4){logger[_0x7169('0xf')]('Setting,\x20%s,\x20%s',_0x2f87b3,_0x4c2fa9[_0x7169('0xf')]['message']);return _0x20d764(_0x4c2fa9[_0x7169('0xf')][_0x7169('0x11')]);}logger[_0x7169('0xf')](_0x7169('0xb'),_0x2f87b3,_0x4c2fa9[_0x7169('0xf')][_0x7169('0x11')]);return _0x57f5e(_0x4c2fa9['error']['message']);}else{logger[_0x7169('0xa')]('Setting,\x20%s,\x20%s',_0x2f87b3,_0x7169('0xc'));_0x57f5e(_0x4c2fa9['result'][_0x7169('0x11')]);}})[_0x7169('0x12')](function(_0x3f940){logger['error'](_0x7169('0xb'),_0x2f87b3,_0x3f940);_0x20d764(_0x3f940);});});}exports['ShowSetting']=function(_0x2103b4){var _0x42368b=this;return new Promise(function(_0xd58fcb,_0x49d043){return db[_0x7169('0x13')]['find']({'raw':_0x2103b4[_0x7169('0x14')]?_0x2103b4['options'][_0x7169('0x15')]===undefined?!![]:![]:!![],'where':_0x2103b4[_0x7169('0x14')]?_0x2103b4[_0x7169('0x14')][_0x7169('0x16')]||null:null,'attributes':_0x2103b4[_0x7169('0x14')]?_0x2103b4[_0x7169('0x14')][_0x7169('0x17')]||null:null,'include':_0x2103b4['options']?_0x2103b4[_0x7169('0x14')][_0x7169('0x18')]?_['map'](_0x2103b4[_0x7169('0x14')]['include'],function(_0x559b33){return{'model':db[_0x559b33[_0x7169('0x19')]],'as':_0x559b33['as'],'attributes':_0x559b33['attributes'],'include':_0x559b33[_0x7169('0x18')]?_[_0x7169('0x1a')](_0x559b33[_0x7169('0x18')],function(_0x5a9a93){return{'model':db[_0x5a9a93[_0x7169('0x19')]],'as':_0x5a9a93['as'],'attributes':_0x5a9a93[_0x7169('0x17')],'include':_0x5a9a93[_0x7169('0x18')]?_[_0x7169('0x1a')](_0x5a9a93[_0x7169('0x18')],function(_0x574f7a){return{'model':db[_0x574f7a[_0x7169('0x19')]],'as':_0x574f7a['as'],'attributes':_0x574f7a[_0x7169('0x17')]};}):[]};}):[]};}):[]:[]})[_0x7169('0x9')](function(_0x5ee212){logger[_0x7169('0xa')](_0x7169('0x1b'),_0x2103b4);logger[_0x7169('0xd')](_0x7169('0x1b'),_0x2103b4,JSON['stringify'](_0x5ee212));_0xd58fcb(_0x5ee212);})[_0x7169('0x12')](function(_0x22ac71){logger['error'](_0x7169('0x1b'),_0x22ac71[_0x7169('0x11')],_0x2103b4);_0x49d043(_0x42368b[_0x7169('0xf')](0x1f4,_0x22ac71[_0x7169('0x11')]));});});}; \ No newline at end of file +var _0xd587=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','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','ShowSetting','Setting','find','options','raw','where','attributes','include','map','model','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x16e57d,_0x2cb7ba){var _0x40239c=function(_0x3cc8f0){while(--_0x3cc8f0){_0x16e57d['push'](_0x16e57d['shift']());}};_0x40239c(++_0x2cb7ba);}(_0xd587,0x171));var _0x7d58=function(_0x39ffad,_0x57c4a4){_0x39ffad=_0x39ffad-0x0;var _0x343224=_0xd587[_0x39ffad];return _0x343224;};'use strict';var _=require(_0x7d58('0x0'));var util=require('util');var moment=require(_0x7d58('0x1'));var BPromise=require(_0x7d58('0x2'));var rs=require(_0x7d58('0x3'));var fs=require('fs');var Redis=require(_0x7d58('0x4'));var db=require(_0x7d58('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7d58('0x6'))('rpc');var config=require(_0x7d58('0x7'));var jayson=require(_0x7d58('0x8'));var client=jayson[_0x7d58('0x9')][_0x7d58('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4eeead,_0x564dd1,_0xa6507a){return new BPromise(function(_0x3e0323,_0x23edd1){return client[_0x7d58('0xb')](_0x4eeead,_0xa6507a)[_0x7d58('0xc')](function(_0x2d061c){logger[_0x7d58('0xd')](_0x7d58('0xe'),_0x564dd1,_0x7d58('0xf'));logger[_0x7d58('0x10')](_0x7d58('0x11'),_0x564dd1,_0x7d58('0xf'),JSON[_0x7d58('0x12')](_0x2d061c));if(_0x2d061c[_0x7d58('0x13')]){if(_0x2d061c[_0x7d58('0x13')][_0x7d58('0x14')]===0x1f4){logger[_0x7d58('0x13')]('Setting,\x20%s,\x20%s',_0x564dd1,_0x2d061c[_0x7d58('0x13')][_0x7d58('0x15')]);return _0x23edd1(_0x2d061c[_0x7d58('0x13')][_0x7d58('0x15')]);}logger[_0x7d58('0x13')](_0x7d58('0xe'),_0x564dd1,_0x2d061c[_0x7d58('0x13')][_0x7d58('0x15')]);return _0x3e0323(_0x2d061c[_0x7d58('0x13')]['message']);}else{logger['info'](_0x7d58('0xe'),_0x564dd1,'request\x20sent');_0x3e0323(_0x2d061c[_0x7d58('0x16')][_0x7d58('0x15')]);}})[_0x7d58('0x17')](function(_0x457bf3){logger[_0x7d58('0x13')](_0x7d58('0xe'),_0x564dd1,_0x457bf3);_0x23edd1(_0x457bf3);});});}exports[_0x7d58('0x18')]=function(_0x5b634d){var _0x208b38=this;return new Promise(function(_0x4064dc,_0x374b65){return db[_0x7d58('0x19')][_0x7d58('0x1a')]({'raw':_0x5b634d[_0x7d58('0x1b')]?_0x5b634d[_0x7d58('0x1b')][_0x7d58('0x1c')]===undefined?!![]:![]:!![],'where':_0x5b634d['options']?_0x5b634d[_0x7d58('0x1b')][_0x7d58('0x1d')]||null:null,'attributes':_0x5b634d[_0x7d58('0x1b')]?_0x5b634d[_0x7d58('0x1b')][_0x7d58('0x1e')]||null:null,'include':_0x5b634d[_0x7d58('0x1b')]?_0x5b634d[_0x7d58('0x1b')][_0x7d58('0x1f')]?_[_0x7d58('0x20')](_0x5b634d['options'][_0x7d58('0x1f')],function(_0x1c4c40){return{'model':db[_0x1c4c40['model']],'as':_0x1c4c40['as'],'attributes':_0x1c4c40[_0x7d58('0x1e')],'include':_0x1c4c40[_0x7d58('0x1f')]?_[_0x7d58('0x20')](_0x1c4c40[_0x7d58('0x1f')],function(_0x4fe5a0){return{'model':db[_0x4fe5a0['model']],'as':_0x4fe5a0['as'],'attributes':_0x4fe5a0[_0x7d58('0x1e')],'include':_0x4fe5a0[_0x7d58('0x1f')]?_[_0x7d58('0x20')](_0x4fe5a0['include'],function(_0x1942c6){return{'model':db[_0x1942c6[_0x7d58('0x21')]],'as':_0x1942c6['as'],'attributes':_0x1942c6[_0x7d58('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7d58('0xc')](function(_0x5790b2){logger[_0x7d58('0xd')](_0x7d58('0x18'),_0x5b634d);logger['debug'](_0x7d58('0x18'),_0x5b634d,JSON[_0x7d58('0x12')](_0x5790b2));_0x4064dc(_0x5790b2);})[_0x7d58('0x17')](function(_0x27efbd){logger[_0x7d58('0x13')](_0x7d58('0x18'),_0x27efbd['message'],_0x5b634d);_0x374b65(_0x208b38[_0x7d58('0x13')](0x1f4,_0x27efbd[_0x7d58('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index f67cf91..dc6efd9 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 _0xe14b=['./smsAccount.controller','get','isAuthenticated','index','/describe','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','send','put','update','/:id','destroy','removeDispositions','delete','/:id/users','removeAgents','multer','util','express','Router','../../components/auth/service'];(function(_0x55a26f,_0x16f9bd){var _0x32590e=function(_0x52c912){while(--_0x52c912){_0x55a26f['push'](_0x55a26f['shift']());}};_0x32590e(++_0x16f9bd);}(_0xe14b,0x93));var _0xbe14=function(_0x380fcc,_0x450140){_0x380fcc=_0x380fcc-0x0;var _0x40688a=_0xe14b[_0x380fcc];return _0x40688a;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getDispositions']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x6')](_0xbe14('0x10'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x6')](_0xbe14('0x12'),controller[_0xbe14('0x13')]);router[_0xbe14('0x6')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x14')]);router[_0xbe14('0x15')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x16')]);router['post'](_0xbe14('0xb'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x15')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);router['post'](_0xbe14('0x19'),controller[_0xbe14('0x1a')]);router[_0xbe14('0x15')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x1b')]);router['post'](_0xbe14('0x1c'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x1d')]);router[_0xbe14('0x15')](_0xbe14('0x12'),controller['status']);router[_0xbe14('0x15')]('/:id/users',auth[_0xbe14('0x7')](),controller['addAgents']);router[_0xbe14('0x1e')]('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0x1f')]);router['delete'](_0xbe14('0x20'),auth['isAuthenticated'](),controller[_0xbe14('0x21')]);router['delete'](_0xbe14('0xb'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x22')]);router[_0xbe14('0x23')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeAnswers']);router[_0xbe14('0x23')](_0xbe14('0x24'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x25')]);module['exports']=router; \ No newline at end of file +var _0x6aa7=['create','addDisposition','addAnswer','addApplications','/:id/send','send','status','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','/:id/users','getAgents','post'];(function(_0x44a8d6,_0x325a4a){var _0x4858fa=function(_0x447e50){while(--_0x447e50){_0x44a8d6['push'](_0x44a8d6['shift']());}};_0x4858fa(++_0x325a4a);}(_0x6aa7,0x178));var _0x76aa=function(_0x1ed0cd,_0x4e5354){_0x1ed0cd=_0x1ed0cd-0x0;var _0x4ecbc5=_0x6aa7[_0x1ed0cd];return _0x4ecbc5;};'use strict';var multer=require(_0x76aa('0x0'));var util=require('util');var path=require(_0x76aa('0x1'));var timeout=require(_0x76aa('0x2'));var express=require(_0x76aa('0x3'));var router=express[_0x76aa('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x76aa('0x5'));var interaction=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var controller=require('./smsAccount.controller');router['get']('/',auth[_0x76aa('0x8')](),controller['index']);router[_0x76aa('0x9')](_0x76aa('0xa'),auth[_0x76aa('0x8')](),controller['describe']);router[_0x76aa('0x9')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller['show']);router[_0x76aa('0x9')](_0x76aa('0xc'),auth[_0x76aa('0x8')](),controller[_0x76aa('0xd')]);router[_0x76aa('0x9')](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0xf')]);router[_0x76aa('0x9')](_0x76aa('0x10'),auth['isAuthenticated'](),controller[_0x76aa('0x11')]);router['get'](_0x76aa('0x12'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x13')]);router[_0x76aa('0x9')](_0x76aa('0x14'),controller['statusGet']);router['get'](_0x76aa('0x15'),auth['isAuthenticated'](),controller[_0x76aa('0x16')]);router[_0x76aa('0x17')]('/',auth['isAuthenticated'](),controller[_0x76aa('0x18')]);router['post'](_0x76aa('0xc'),auth['isAuthenticated'](),controller[_0x76aa('0x19')]);router[_0x76aa('0x17')](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1a')]);router[_0x76aa('0x17')]('/:id/notify',controller['notify']);router[_0x76aa('0x17')](_0x76aa('0x10'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1b')]);router[_0x76aa('0x17')](_0x76aa('0x1c'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1d')]);router[_0x76aa('0x17')]('/:id/status',controller[_0x76aa('0x1e')]);router[_0x76aa('0x17')](_0x76aa('0x15'),auth['isAuthenticated'](),controller[_0x76aa('0x1f')]);router[_0x76aa('0x20')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x21')]);router[_0x76aa('0x22')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x23')]);router[_0x76aa('0x22')](_0x76aa('0xc'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x24')]);router['delete'](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x25')]);router[_0x76aa('0x22')](_0x76aa('0x15'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x26')]);module[_0x76aa('0x27')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 481d7b5..9eaa92a 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 _0xadcb=['skebby','connectel','clicksend','plivo','bandwidth','infobip','ENUM','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','name','STRING','twilio'];(function(_0x24913b,_0x4fb6bd){var _0x3d8576=function(_0x35c369){while(--_0x35c369){_0x24913b['push'](_0x24913b['shift']());}};_0x3d8576(++_0x4fb6bd);}(_0xadcb,0xd6));var _0xbadc=function(_0x27948d,_0x4b6eca){_0x27948d=_0x27948d-0x0;var _0x1c6e5c=_0xadcb[_0x27948d];return _0x1c6e5c;};'use strict';var Sequelize=require(_0xbadc('0x0'));var rs=require(_0xbadc('0x1'));module[_0xbadc('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0xbadc('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xbadc('0x4')],'allowNull':![]},'remote':{'type':Sequelize[_0xbadc('0x4')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0xbadc('0x5'),_0xbadc('0x6'),_0xbadc('0x7'),_0xbadc('0x8'),_0xbadc('0x9'),'clickatell',_0xbadc('0xa'),'csc',_0xbadc('0xb'),'intelepeer')},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0xbadc('0x4')]},'authToken':{'type':Sequelize[_0xbadc('0x4')]},'smsMethod':{'type':Sequelize[_0xbadc('0xc')]('SI','TI','GP')},'username':{'type':Sequelize[_0xbadc('0x4')]},'password':{'type':Sequelize[_0xbadc('0x4')]},'apiKey':{'type':Sequelize[_0xbadc('0x4')]},'applicationId':{'type':Sequelize[_0xbadc('0x4')]},'accountId':{'type':Sequelize[_0xbadc('0x4')]},'senderString':{'type':Sequelize[_0xbadc('0x4')]},'deliveryReport':{'type':Sequelize[_0xbadc('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0xbadc('0x4')]},'notificationTemplate':{'type':Sequelize[_0xbadc('0xe')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xbadc('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xbadc('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xbadc('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbadc('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbadc('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xbadc('0x4')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xbadc('0x10')},'mandatoryDisposition':{'type':Sequelize[_0xbadc('0xd')],'defaultValue':![],'comment':_0xbadc('0x11'),'set':function(_0x5dbb2d){if(!_0x5dbb2d)this[_0xbadc('0x12')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0xbadc('0x13'),_0x5dbb2d);}}}; \ No newline at end of file +var _0x1cc3=['randomstring','STRING','name','generate','ENUM','twilio','skebby','clicksend','clickatell','bandwidth','csc','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize'];(function(_0x3292cf,_0x5e444a){var _0x116acc=function(_0xdf90e5){while(--_0xdf90e5){_0x3292cf['push'](_0x3292cf['shift']());}};_0x116acc(++_0x5e444a);}(_0x1cc3,0xe9));var _0x31cc=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x1cc3[_0x1cc8fe];return _0x230054;};'use strict';var Sequelize=require(_0x31cc('0x0'));var rs=require(_0x31cc('0x1'));module['exports']={'name':{'type':Sequelize[_0x31cc('0x2')],'unique':_0x31cc('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x31cc('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x31cc('0x2')],'defaultValue':function(){return rs[_0x31cc('0x4')]();}},'phone':{'type':Sequelize[_0x31cc('0x2')]},'type':{'type':Sequelize[_0x31cc('0x5')](_0x31cc('0x6'),_0x31cc('0x7'),'connectel',_0x31cc('0x8'),'plivo',_0x31cc('0x9'),_0x31cc('0xa'),_0x31cc('0xb'),'infobip','intelepeer')},'accountSid':{'type':Sequelize[_0x31cc('0x2')]},'authId':{'type':Sequelize[_0x31cc('0x2')]},'authToken':{'type':Sequelize[_0x31cc('0x2')]},'smsMethod':{'type':Sequelize[_0x31cc('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x31cc('0x2')]},'password':{'type':Sequelize[_0x31cc('0x2')]},'apiKey':{'type':Sequelize[_0x31cc('0x2')]},'applicationId':{'type':Sequelize[_0x31cc('0x2')]},'accountId':{'type':Sequelize[_0x31cc('0x2')]},'senderString':{'type':Sequelize[_0x31cc('0x2')]},'deliveryReport':{'type':Sequelize[_0x31cc('0xc')],'defaultValue':![]},'description':{'type':Sequelize[_0x31cc('0x2')]},'notificationTemplate':{'type':Sequelize[_0x31cc('0xd')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x31cc('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x31cc('0xc')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x31cc('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x31cc('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x31cc('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x31cc('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x31cc('0xe')],'comment':_0x31cc('0xf')},'mandatoryDisposition':{'type':Sequelize[_0x31cc('0xc')],'defaultValue':![],'comment':_0x31cc('0x10'),'set':function(_0x2ad2eb){if(!_0x2ad2eb)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue'](_0x31cc('0x11'),_0x2ad2eb);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 424602d..e1b6cfe 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 _0x8f73=['user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','Disposition','getDispositions','findOne','pick','SmsAccountId','findAll','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','sms','SmsApplication','account','orderBy','Applications','CmContact','Sequelize','ValidationError','createdAt','updatedAt','difference','ListId','mobile','type','twilio','from','From','Body','messageId','MessageSid','skebby','connectel','clicksend','message_id','plivo','Text','MessageUUID','infobip','results','text','originatingAddress','segmentedMessage','clickatell','fromNumber','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','DESC','list','Contacts','contact','spread','interaction','created','applications','push','unmanaged','*,*,*,*','SmsMessage','User','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','info','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','text/xml','send','\x0a','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','getApplications','getInteractions','SmsInteraction','Owner','fullname','Tag','Tags','tag','rows','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','DELIVERED','groupName','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','statusGet','csc','state','message-id','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','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','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','jayson/promise','client','http','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','SmsAccounts','UserProfileResource','destroy','then','stack','name','index','Pause','mandatoryDispositionPause','SmsAccount','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','filter','where','merge','map','options','includeAll','include','show','create','body'];(function(_0x1a8ff0,_0x20788d){var _0x3588bf=function(_0x3b5499){while(--_0x3b5499){_0x1a8ff0['push'](_0x1a8ff0['shift']());}};_0x3588bf(++_0x20788d);}(_0x8f73,0x8a));var _0x38f7=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x8f73[_0x4e9628];return _0x27bc8c;};'use strict';var emlformat=require(_0x38f7('0x0'));var rimraf=require(_0x38f7('0x1'));var zipdir=require(_0x38f7('0x2'));var jsonpatch=require(_0x38f7('0x3'));var rp=require(_0x38f7('0x4'));var moment=require('moment');var BPromise=require(_0x38f7('0x5'));var Mustache=require('mustache');var util=require(_0x38f7('0x6'));var path=require(_0x38f7('0x7'));var sox=require(_0x38f7('0x8'));var csv=require(_0x38f7('0x9'));var ejs=require(_0x38f7('0xa'));var fs=require('fs');var fs_extra=require(_0x38f7('0xb'));var _=require(_0x38f7('0xc'));var squel=require('squel');var crypto=require(_0x38f7('0xd'));var jsforce=require(_0x38f7('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x38f7('0x9'));var querystring=require(_0x38f7('0xf'));var Papa=require('papaparse');var Redis=require(_0x38f7('0x10'));var authService=require(_0x38f7('0x11'));var qs=require(_0x38f7('0x12'));var as=require(_0x38f7('0x13'));var hardwareService=require(_0x38f7('0x14'));var logger=require(_0x38f7('0x15'))(_0x38f7('0x16'));var utils=require(_0x38f7('0x17'));var config=require(_0x38f7('0x18'));var licenseUtil=require(_0x38f7('0x19'));var db=require(_0x38f7('0x1a'))['db'];config[_0x38f7('0x1b')]=_[_0x38f7('0x1c')](config[_0x38f7('0x1b')],{'host':_0x38f7('0x1d'),'port':0x18eb});var socket=require(_0x38f7('0x1e'))(new Redis(config[_0x38f7('0x1b')]));require(_0x38f7('0x1f'))['register'](socket);var jayson=require(_0x38f7('0x20'));var client=jayson[_0x38f7('0x21')][_0x38f7('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x22fe89,_0x20e39b,_0x2d923c,_0x1db117){return new BPromise(function(_0x3ea195,_0x2acc85){var _0x2640d2=_0x1db117||client;return _0x2640d2['request'](_0x22fe89,_0x2d923c)['then'](function(_0x8f4ae){logger['info'](_0x38f7('0x23'),_0x20e39b,_0x38f7('0x24'));logger[_0x38f7('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x20e39b,_0x38f7('0x24'),JSON['stringify'](_0x8f4ae));if(_0x8f4ae['error']){if(_0x8f4ae[_0x38f7('0x26')][_0x38f7('0x27')]===0x1f4){logger[_0x38f7('0x26')](_0x38f7('0x23'),_0x20e39b,_0x8f4ae[_0x38f7('0x26')]['message']);return _0x2acc85(_0x8f4ae['error'][_0x38f7('0x28')]);}logger['error'](_0x38f7('0x23'),_0x20e39b,_0x8f4ae['error']['message']);return _0x3ea195(_0x8f4ae[_0x38f7('0x26')][_0x38f7('0x28')]);}else{logger['info'](_0x38f7('0x23'),_0x20e39b,_0x38f7('0x24'));_0x3ea195(_0x8f4ae[_0x38f7('0x29')][_0x38f7('0x28')]);}})[_0x38f7('0x2a')](function(_0x22ebbe){logger[_0x38f7('0x26')](_0x38f7('0x23'),_0x20e39b,_0x22ebbe);_0x2acc85(_0x22ebbe);});});}function respondWithStatusCode(_0x1f5ee0,_0x2895cb){_0x2895cb=_0x2895cb||0xcc;return function(_0x3b2909){if(_0x3b2909){return _0x1f5ee0[_0x38f7('0x2b')](_0x2895cb);}return _0x1f5ee0[_0x38f7('0x2c')](_0x2895cb)[_0x38f7('0x2d')]();};}function respondWithResult(_0x5c0cbd,_0x12cf19){_0x12cf19=_0x12cf19||0xc8;return function(_0x4f6335){if(_0x4f6335){return _0x5c0cbd[_0x38f7('0x2c')](_0x12cf19)[_0x38f7('0x2e')](_0x4f6335);}};}function respondWithFilteredResult(_0x2acc4f,_0xe8f575){return function(_0x3e87c7){if(_0x3e87c7){var _0xb7702a=typeof _0xe8f575['offset']===_0x38f7('0x2f')&&typeof _0xe8f575[_0x38f7('0x30')]===_0x38f7('0x2f');var _0x4dff5b=_0x3e87c7[_0x38f7('0x31')];var _0x19465a=_0xb7702a?0x0:_0xe8f575['offset'];var _0x452fde=_0xb7702a?_0x3e87c7[_0x38f7('0x31')]:_0xe8f575['offset']+_0xe8f575[_0x38f7('0x30')];var _0x41de96;if(_0x452fde>=_0x4dff5b){_0x452fde=_0x4dff5b;_0x41de96=0xc8;}else{_0x41de96=0xce;}_0x2acc4f[_0x38f7('0x2c')](_0x41de96);return _0x2acc4f[_0x38f7('0x32')](_0x38f7('0x33'),_0x19465a+'-'+_0x452fde+'/'+_0x4dff5b)[_0x38f7('0x2e')](_0x3e87c7);}return null;};}function patchUpdates(_0x5bf03f){return function(_0x1f025b){try{jsonpatch[_0x38f7('0x34')](_0x1f025b,_0x5bf03f,!![]);}catch(_0x545257){return BPromise[_0x38f7('0x35')](_0x545257);}return _0x1f025b[_0x38f7('0x36')]();};}function saveUpdates(_0x455b17,_0x204d26){return function(_0x2c31d5){if(_0x2c31d5){return _0x2c31d5[_0x38f7('0x37')](_0x455b17)['then'](function(_0x5b8b27){return _0x5b8b27;});}return null;};}function removeEntity(_0x2cd5c7,_0x568714){return function(_0x29664d){if(_0x29664d){return _0x29664d['destroy']()['then'](function(){var _0x1d95a6=_0x29664d['get']({'plain':!![]});var _0x2f1bc0=_0x38f7('0x38');return db[_0x38f7('0x39')][_0x38f7('0x3a')]({'where':{'type':_0x2f1bc0,'resourceId':_0x1d95a6['id']}})['then'](function(){return _0x29664d;});})[_0x38f7('0x3b')](function(){_0x2cd5c7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x150bae,_0x4a975f){return function(_0x40a0d0){if(!_0x40a0d0){_0x150bae['sendStatus'](0x194);}return _0x40a0d0;};}function handleError(_0xe58f0a,_0x30165d){_0x30165d=_0x30165d||0x1f4;return function(_0x496ef5){logger[_0x38f7('0x26')](_0x496ef5[_0x38f7('0x3c')]);if(_0x496ef5[_0x38f7('0x3d')]){delete _0x496ef5['name'];}_0xe58f0a[_0x38f7('0x2c')](_0x30165d)['send'](_0x496ef5);};}exports[_0x38f7('0x3e')]=function(_0x313334,_0x30f2c0){var _0x5a9ba6={'include':[{'model':db[_0x38f7('0x3f')],'as':_0x38f7('0x40')}]},_0xbc3b4d={},_0xa17b6b={'count':0x0,'rows':[]};var _0x209841=_['map'](db[_0x38f7('0x41')][_0x38f7('0x42')],function(_0x5a4db3){return{'name':_0x5a4db3[_0x38f7('0x43')],'type':_0x5a4db3['type']['key']};});_0xbc3b4d[_0x38f7('0x44')]=_['map'](_0x209841,_0x38f7('0x3d'));_0xbc3b4d[_0x38f7('0x45')]=_[_0x38f7('0x46')](_0x313334['query']);_0xbc3b4d[_0x38f7('0x47')]=_[_0x38f7('0x48')](_0xbc3b4d[_0x38f7('0x44')],_0xbc3b4d[_0x38f7('0x45')]);_0x5a9ba6[_0x38f7('0x49')]=_[_0x38f7('0x48')](_0xbc3b4d[_0x38f7('0x44')],qs[_0x38f7('0x4a')](_0x313334[_0x38f7('0x45')][_0x38f7('0x4a')]));_0x5a9ba6[_0x38f7('0x49')]=_0x5a9ba6[_0x38f7('0x49')][_0x38f7('0x4b')]?_0x5a9ba6['attributes']:_0xbc3b4d[_0x38f7('0x44')];if(!_0x313334[_0x38f7('0x45')][_0x38f7('0x4c')](_0x38f7('0x4d'))){_0x5a9ba6[_0x38f7('0x30')]=qs[_0x38f7('0x30')](_0x313334[_0x38f7('0x45')][_0x38f7('0x30')]);_0x5a9ba6[_0x38f7('0x4e')]=qs['offset'](_0x313334[_0x38f7('0x45')][_0x38f7('0x4e')]);}_0x5a9ba6[_0x38f7('0x4f')]=qs['sort'](_0x313334['query'][_0x38f7('0x50')]);_0x5a9ba6['where']=qs[_0x38f7('0x47')](_['pick'](_0x313334['query'],_0xbc3b4d['filters']),_0x209841);if(_0x313334[_0x38f7('0x45')][_0x38f7('0x51')]){_0x5a9ba6[_0x38f7('0x52')]=_[_0x38f7('0x53')](_0x5a9ba6[_0x38f7('0x52')],{'$or':_[_0x38f7('0x54')](_0x209841,function(_0x558173){if(_0x558173['type']!=='VIRTUAL'){var _0x5a3e4a={};_0x5a3e4a[_0x558173['name']]={'$like':'%'+_0x313334[_0x38f7('0x45')][_0x38f7('0x51')]+'%'};return _0x5a3e4a;}})});}_0x5a9ba6=_[_0x38f7('0x53')]({},_0x5a9ba6,_0x313334[_0x38f7('0x55')]);var _0x46de6c={'where':_0x5a9ba6[_0x38f7('0x52')]};return db[_0x38f7('0x41')]['count'](_0x46de6c)[_0x38f7('0x3b')](function(_0x5a13fe){_0xa17b6b[_0x38f7('0x31')]=_0x5a13fe;if(_0x313334[_0x38f7('0x45')][_0x38f7('0x56')]){_0x5a9ba6[_0x38f7('0x57')]=[{'all':!![]}];}return db[_0x38f7('0x41')]['findAll'](_0x5a9ba6);})['then'](function(_0x233040){_0xa17b6b['rows']=_0x233040;return _0xa17b6b;})[_0x38f7('0x3b')](respondWithFilteredResult(_0x30f2c0,_0x5a9ba6))[_0x38f7('0x2a')](handleError(_0x30f2c0,null));};exports[_0x38f7('0x58')]=function(_0x3c503d,_0x2f7852){var _0x2710fe={'raw':![],'where':{'id':_0x3c503d['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x13d11b={};_0x13d11b[_0x38f7('0x44')]=_[_0x38f7('0x46')](db[_0x38f7('0x41')][_0x38f7('0x42')]);_0x13d11b[_0x38f7('0x45')]=_[_0x38f7('0x46')](_0x3c503d['query']);_0x13d11b['filters']=_[_0x38f7('0x48')](_0x13d11b['model'],_0x13d11b['query']);_0x2710fe[_0x38f7('0x49')]=_[_0x38f7('0x48')](_0x13d11b['model'],qs[_0x38f7('0x4a')](_0x3c503d['query'][_0x38f7('0x4a')]));_0x2710fe['attributes']=_0x2710fe['attributes']['length']?_0x2710fe[_0x38f7('0x49')]:_0x13d11b['model'];if(_0x3c503d[_0x38f7('0x45')]['includeAll']){_0x2710fe[_0x38f7('0x57')]=[{'all':!![]}];}_0x2710fe=_[_0x38f7('0x53')]({},_0x2710fe,_0x3c503d[_0x38f7('0x55')]);return db['SmsAccount']['find'](_0x2710fe)[_0x38f7('0x3b')](handleEntityNotFound(_0x2f7852,null))[_0x38f7('0x3b')](respondWithResult(_0x2f7852,null))[_0x38f7('0x2a')](handleError(_0x2f7852,null));};exports[_0x38f7('0x59')]=function(_0x37930c,_0x2b929e){return db[_0x38f7('0x41')]['create'](_0x37930c[_0x38f7('0x5a')],{})['then'](function(_0xc8faa3){var _0x5c8ec6=_0x37930c[_0x38f7('0x5b')][_0x38f7('0x5c')]({'plain':!![]});if(!_0x5c8ec6)throw new Error(_0x38f7('0x5d'));if(_0x5c8ec6[_0x38f7('0x5e')]==='user'){var _0x559964=_0xc8faa3[_0x38f7('0x5c')]({'plain':!![]});var _0x19dece=_0x38f7('0x38');return db[_0x38f7('0x5f')][_0x38f7('0x60')]({'where':{'name':_0x19dece,'userProfileId':_0x5c8ec6[_0x38f7('0x61')]},'raw':!![]})[_0x38f7('0x3b')](function(_0x468c06){if(_0x468c06&&_0x468c06[_0x38f7('0x62')]===0x0){return db[_0x38f7('0x39')][_0x38f7('0x59')]({'name':_0x559964[_0x38f7('0x3d')],'resourceId':_0x559964['id'],'type':_0x468c06[_0x38f7('0x3d')],'sectionId':_0x468c06['id']},{})['then'](function(){return _0xc8faa3;});}else{return _0xc8faa3;}})['catch'](function(_0x1ed738){logger['error'](_0x38f7('0x63'),_0x1ed738);throw _0x1ed738;});}return _0xc8faa3;})[_0x38f7('0x3b')](respondWithResult(_0x2b929e,0xc9))['catch'](handleError(_0x2b929e,null));};exports[_0x38f7('0x37')]=function(_0x226f11,_0x12d83c){if(_0x226f11[_0x38f7('0x5a')]['id']){delete _0x226f11['body']['id'];}return db[_0x38f7('0x41')][_0x38f7('0x60')]({'where':{'id':_0x226f11[_0x38f7('0x64')]['id']},'include':[{'model':db[_0x38f7('0x3f')],'as':_0x38f7('0x40')}]})['then'](handleEntityNotFound(_0x12d83c,null))['then'](saveUpdates(_0x226f11[_0x38f7('0x5a')],null))[_0x38f7('0x3b')](respondWithResult(_0x12d83c,null))['catch'](handleError(_0x12d83c,null));};exports[_0x38f7('0x3a')]=function(_0x408b8d,_0x4ef531){return db[_0x38f7('0x41')]['find']({'where':{'id':_0x408b8d[_0x38f7('0x64')]['id']}})[_0x38f7('0x3b')](handleEntityNotFound(_0x4ef531,null))[_0x38f7('0x3b')](removeEntity(_0x4ef531,null))[_0x38f7('0x2a')](handleError(_0x4ef531,null));};exports[_0x38f7('0x65')]=function(_0x4b3f3c,_0x1f4c2f){return db[_0x38f7('0x41')][_0x38f7('0x65')]()[_0x38f7('0x3b')](respondWithResult(_0x1f4c2f,null))[_0x38f7('0x2a')](handleError(_0x1f4c2f,null));};exports[_0x38f7('0x66')]=function(_0x356500,_0x5ac52a,_0xe8e936){if(_0x356500[_0x38f7('0x5a')]['id']){delete _0x356500['body']['id'];}return db[_0x38f7('0x41')][_0x38f7('0x60')]({'where':{'id':_0x356500['params']['id']}})['then'](handleEntityNotFound(_0x5ac52a,null))['then'](function(_0x5a0bc1){if(_0x5a0bc1){_0x356500['body']['SmsAccountId']=_0x5a0bc1['id'];return db[_0x38f7('0x67')][_0x38f7('0x59')](_0x356500[_0x38f7('0x5a')]);}})[_0x38f7('0x3b')](respondWithResult(_0x5ac52a,null))[_0x38f7('0x2a')](handleError(_0x5ac52a,null));};exports[_0x38f7('0x68')]=function(_0x136a12,_0x10f1c8,_0x54c435){var _0x45b663={'raw':![],'where':{}};var _0xd402f6={};var _0x27658d={'count':0x0,'rows':[]};return db['SmsAccount'][_0x38f7('0x69')]({'where':{'id':_0x136a12['params']['id']}})['then'](handleEntityNotFound(_0x10f1c8,null))[_0x38f7('0x3b')](function(_0x131ecb){if(_0x131ecb){_0xd402f6['model']=_[_0x38f7('0x46')](db[_0x38f7('0x67')][_0x38f7('0x42')]);_0xd402f6['query']=_[_0x38f7('0x46')](_0x136a12[_0x38f7('0x45')]);_0xd402f6['filters']=_[_0x38f7('0x48')](_0xd402f6[_0x38f7('0x44')],_0xd402f6[_0x38f7('0x45')]);_0x45b663[_0x38f7('0x49')]=_[_0x38f7('0x48')](_0xd402f6[_0x38f7('0x44')],qs[_0x38f7('0x4a')](_0x136a12[_0x38f7('0x45')][_0x38f7('0x4a')]));_0x45b663[_0x38f7('0x49')]=_0x45b663[_0x38f7('0x49')][_0x38f7('0x4b')]?_0x45b663['attributes']:_0xd402f6[_0x38f7('0x44')];if(!_0x136a12[_0x38f7('0x45')][_0x38f7('0x4c')](_0x38f7('0x4d'))){_0x45b663[_0x38f7('0x30')]=qs[_0x38f7('0x30')](_0x136a12[_0x38f7('0x45')][_0x38f7('0x30')]);_0x45b663[_0x38f7('0x4e')]=qs[_0x38f7('0x4e')](_0x136a12['query']['offset']);}_0x45b663[_0x38f7('0x4f')]=qs[_0x38f7('0x50')](_0x136a12['query']['sort']);_0x45b663[_0x38f7('0x52')]=qs[_0x38f7('0x47')](_[_0x38f7('0x6a')](_0x136a12[_0x38f7('0x45')],_0xd402f6[_0x38f7('0x47')]));_0x45b663['where'][_0x38f7('0x6b')]=_0x131ecb['id'];if(_0x136a12[_0x38f7('0x45')][_0x38f7('0x51')]){_0x45b663[_0x38f7('0x52')]=_[_0x38f7('0x53')](_0x45b663[_0x38f7('0x52')],{'$or':_[_0x38f7('0x54')](_0x45b663[_0x38f7('0x49')],function(_0x14c34a){var _0x125091={};_0x125091[_0x14c34a]={'$like':'%'+_0x136a12['query'][_0x38f7('0x51')]+'%'};return _0x125091;})});}_0x45b663=_[_0x38f7('0x53')]({},_0x45b663,_0x136a12[_0x38f7('0x55')]);return db['Disposition'][_0x38f7('0x31')]({'where':_0x45b663[_0x38f7('0x52')]})['then'](function(_0x2827a8){_0x27658d[_0x38f7('0x31')]=_0x2827a8;if(_0x136a12[_0x38f7('0x45')]['includeAll']){_0x45b663['include']=[{'all':!![]}];}return db[_0x38f7('0x67')][_0x38f7('0x6c')](_0x45b663);})[_0x38f7('0x3b')](function(_0x35c670){_0x27658d['rows']=_0x35c670;return _0x27658d;});}})['then'](respondWithFilteredResult(_0x10f1c8,_0x45b663))['catch'](handleError(_0x10f1c8,null));};exports[_0x38f7('0x6d')]=function(_0x567670,_0x4a4058,_0xd2530c){return db[_0x38f7('0x41')]['find']({'where':{'id':_0x567670[_0x38f7('0x64')]['id']}})['then'](handleEntityNotFound(_0x4a4058,null))['then'](function(_0x44f389){if(_0x44f389){return _0x44f389[_0x38f7('0x6d')](_0x567670['query'][_0x38f7('0x6e')]);}})['then'](respondWithStatusCode(_0x4a4058,null))['catch'](handleError(_0x4a4058,null));};exports[_0x38f7('0x6f')]=function(_0x57bc87,_0x2adf71,_0x23901b){if(_0x57bc87[_0x38f7('0x5a')]['id']){delete _0x57bc87['body']['id'];}return db['SmsAccount'][_0x38f7('0x60')]({'where':{'id':_0x57bc87[_0x38f7('0x64')]['id']}})[_0x38f7('0x3b')](handleEntityNotFound(_0x2adf71,null))['then'](function(_0x1bdea2){if(_0x1bdea2){_0x57bc87[_0x38f7('0x5a')][_0x38f7('0x6b')]=_0x1bdea2['id'];return db[_0x38f7('0x70')]['create'](_0x57bc87[_0x38f7('0x5a')]);}})['then'](respondWithResult(_0x2adf71,null))[_0x38f7('0x2a')](handleError(_0x2adf71,null));};exports['getAnswers']=function(_0x2f6000,_0x213b3f,_0x1968db){var _0x335b05={'raw':![],'where':{}};var _0x51b3d3={};var _0x3705a8={'count':0x0,'rows':[]};return db['SmsAccount'][_0x38f7('0x69')]({'where':{'id':_0x2f6000[_0x38f7('0x64')]['id']}})[_0x38f7('0x3b')](handleEntityNotFound(_0x213b3f,null))['then'](function(_0x3c3aec){if(_0x3c3aec){_0x51b3d3[_0x38f7('0x44')]=_[_0x38f7('0x46')](db[_0x38f7('0x70')][_0x38f7('0x42')]);_0x51b3d3[_0x38f7('0x45')]=_[_0x38f7('0x46')](_0x2f6000['query']);_0x51b3d3[_0x38f7('0x47')]=_[_0x38f7('0x48')](_0x51b3d3[_0x38f7('0x44')],_0x51b3d3[_0x38f7('0x45')]);_0x335b05['attributes']=_[_0x38f7('0x48')](_0x51b3d3[_0x38f7('0x44')],qs[_0x38f7('0x4a')](_0x2f6000['query'][_0x38f7('0x4a')]));_0x335b05[_0x38f7('0x49')]=_0x335b05[_0x38f7('0x49')][_0x38f7('0x4b')]?_0x335b05[_0x38f7('0x49')]:_0x51b3d3[_0x38f7('0x44')];if(!_0x2f6000['query'][_0x38f7('0x4c')]('nolimit')){_0x335b05['limit']=qs[_0x38f7('0x30')](_0x2f6000[_0x38f7('0x45')][_0x38f7('0x30')]);_0x335b05[_0x38f7('0x4e')]=qs[_0x38f7('0x4e')](_0x2f6000['query']['offset']);}_0x335b05['order']=qs[_0x38f7('0x50')](_0x2f6000[_0x38f7('0x45')]['sort']);_0x335b05[_0x38f7('0x52')]=qs[_0x38f7('0x47')](_[_0x38f7('0x6a')](_0x2f6000[_0x38f7('0x45')],_0x51b3d3[_0x38f7('0x47')]));_0x335b05['where'][_0x38f7('0x6b')]=_0x3c3aec['id'];if(_0x2f6000[_0x38f7('0x45')]['filter']){_0x335b05['where']=_[_0x38f7('0x53')](_0x335b05[_0x38f7('0x52')],{'$or':_[_0x38f7('0x54')](_0x335b05['attributes'],function(_0x5cf7ac){var _0x475aa3={};_0x475aa3[_0x5cf7ac]={'$like':'%'+_0x2f6000[_0x38f7('0x45')][_0x38f7('0x51')]+'%'};return _0x475aa3;})});}_0x335b05=_[_0x38f7('0x53')]({},_0x335b05,_0x2f6000['options']);return db[_0x38f7('0x70')]['count']({'where':_0x335b05['where']})[_0x38f7('0x3b')](function(_0x1f6624){_0x3705a8[_0x38f7('0x31')]=_0x1f6624;if(_0x2f6000[_0x38f7('0x45')][_0x38f7('0x56')]){_0x335b05[_0x38f7('0x57')]=[{'all':!![]}];}return db[_0x38f7('0x70')][_0x38f7('0x6c')](_0x335b05);})[_0x38f7('0x3b')](function(_0x1541a0){_0x3705a8['rows']=_0x1541a0;return _0x3705a8;});}})[_0x38f7('0x3b')](respondWithFilteredResult(_0x213b3f,_0x335b05))[_0x38f7('0x2a')](handleError(_0x213b3f,null));};exports[_0x38f7('0x71')]=function(_0xabe323,_0x102ea3,_0x4fd1a3){return db['SmsAccount'][_0x38f7('0x60')]({'where':{'id':_0xabe323[_0x38f7('0x64')]['id']}})[_0x38f7('0x3b')](handleEntityNotFound(_0x102ea3,null))[_0x38f7('0x3b')](function(_0x5e240c){if(_0x5e240c){return _0x5e240c[_0x38f7('0x71')](_0xabe323[_0x38f7('0x45')][_0x38f7('0x6e')]);}})[_0x38f7('0x3b')](respondWithStatusCode(_0x102ea3,null))[_0x38f7('0x2a')](handleError(_0x102ea3,null));};exports['notify']=function(_0x48a748,_0x366747,_0x5b0d7d){var _0x3cef40={'channel':_0x38f7('0x72')};var _0x5356ad=[];var _0x291bac=[];var _0x519f47={};return db['SmsAccount'][_0x38f7('0x60')]({'where':{'id':_0x48a748[_0x38f7('0x64')]['id']},'include':[{'model':db[_0x38f7('0x73')],'as':'Applications'}]})[_0x38f7('0x3b')](handleEntityNotFound(_0x366747,null))['then'](function(_0x591721){_0x3cef40[_0x38f7('0x74')]=_0x591721;_0x3cef40['applications']=_[_0x38f7('0x75')](_0x591721[_0x38f7('0x76')],['priority'],['asc']);if(_0x3cef40[_0x38f7('0x74')][_0x38f7('0x76')]){delete _0x3cef40[_0x38f7('0x74')][_0x38f7('0x76')];}return db[_0x38f7('0x77')][_0x38f7('0x65')]();})['then'](function(_0x119b5f){if(!_0x119b5f){throw new db[(_0x38f7('0x78'))][(_0x38f7('0x79'))]('no\x20available\x20attributes');}_0x5356ad=_['difference'](_[_0x38f7('0x46')](_0x119b5f),[_0x38f7('0x7a'),_0x38f7('0x7b')]);_0x291bac=_[_0x38f7('0x7c')](_[_0x38f7('0x46')](_0x119b5f),['createdAt',_0x38f7('0x7b'),'CompanyId',_0x38f7('0x7d')]);_0x3cef40[_0x38f7('0x5a')]={'mapKey':_0x38f7('0x7e')};if(_0x3cef40[_0x38f7('0x74')][_0x38f7('0x7f')]){switch(_0x3cef40[_0x38f7('0x74')]['type']){case _0x38f7('0x80'):_0x3cef40[_0x38f7('0x5a')][_0x38f7('0x81')]=_0x48a748[_0x38f7('0x5a')][_0x38f7('0x82')];_0x3cef40[_0x38f7('0x5a')][_0x38f7('0x5a')]=_0x48a748[_0x38f7('0x5a')][_0x38f7('0x83')];_0x3cef40['body'][_0x38f7('0x84')]=_0x48a748[_0x38f7('0x5a')][_0x38f7('0x85')];break;case _0x38f7('0x86'):_0x3cef40[_0x38f7('0x5a')][_0x38f7('0x81')]='+'+_0x48a748[_0x38f7('0x5a')]['sender'];_0x3cef40[_0x38f7('0x5a')]['body']=_0x48a748[_0x38f7('0x5a')]['text'];break;case _0x38f7('0x87'):_0x3cef40['body'][_0x38f7('0x81')]=_0x48a748[_0x38f7('0x5a')][_0x38f7('0x81')];_0x3cef40[_0x38f7('0x5a')]['body']=_0x48a748[_0x38f7('0x5a')][_0x38f7('0x28')];break;case _0x38f7('0x88'):_0x3cef40[_0x38f7('0x5a')][_0x38f7('0x81')]=_0x48a748[_0x38f7('0x5a')][_0x38f7('0x81')];_0x3cef40[_0x38f7('0x5a')][_0x38f7('0x5a')]=_0x48a748[_0x38f7('0x5a')][_0x38f7('0x5a')];_0x3cef40['body'][_0x38f7('0x84')]=_0x48a748[_0x38f7('0x5a')][_0x38f7('0x89')];break;case _0x38f7('0x8a'):_0x3cef40['body'][_0x38f7('0x81')]=_0x48a748[_0x38f7('0x5a')][_0x38f7('0x82')];_0x3cef40['body'][_0x38f7('0x5a')]=_0x48a748[_0x38f7('0x5a')][_0x38f7('0x8b')];_0x3cef40[_0x38f7('0x5a')][_0x38f7('0x84')]=_0x48a748['body'][_0x38f7('0x8c')];break;case _0x38f7('0x8d'):_0x3cef40[_0x38f7('0x5a')]['from']='+'+_0x48a748[_0x38f7('0x5a')][_0x38f7('0x8e')][0x0]['from'];_0x3cef40[_0x38f7('0x5a')]['body']=_0x48a748[_0x38f7('0x5a')]['results'][0x0][_0x38f7('0x8f')];_0x3cef40['body'][_0x38f7('0x84')]=_0x48a748['body'][_0x38f7('0x8e')][0x0]['messageId'];break;case'csc':_0x3cef40[_0x38f7('0x5a')]['from']=_0x48a748['body'][_0x38f7('0x90')];_0x3cef40[_0x38f7('0x5a')]['body']=_0x48a748[_0x38f7('0x5a')][_0x38f7('0x91')]['message'];break;case _0x38f7('0x92'):_0x3cef40[_0x38f7('0x5a')][_0x38f7('0x81')]=_0x48a748[_0x38f7('0x5a')][_0x38f7('0x93')];_0x3cef40[_0x38f7('0x5a')][_0x38f7('0x5a')]=_0x48a748[_0x38f7('0x5a')][_0x38f7('0x8f')];_0x3cef40[_0x38f7('0x5a')]['messageId']=_0x48a748['body']['replyMessageId'];break;case _0x38f7('0x94'):_0x3cef40[_0x38f7('0x5a')]['messageId']=_0x48a748[_0x38f7('0x5a')][0x0]['message']['id'];_0x3cef40['body'][_0x38f7('0x81')]=_0x48a748[_0x38f7('0x5a')][0x0]['message'][_0x38f7('0x81')];_0x3cef40[_0x38f7('0x5a')][_0x38f7('0x5a')]=_0x48a748[_0x38f7('0x5a')][0x0][_0x38f7('0x28')][_0x38f7('0x8f')];break;case _0x38f7('0x95'):_0x3cef40[_0x38f7('0x5a')][_0x38f7('0x81')]=_0x48a748[_0x38f7('0x5a')][_0x38f7('0x81')];_0x3cef40[_0x38f7('0x5a')][_0x38f7('0x5a')]=_0x48a748[_0x38f7('0x5a')][_0x38f7('0x28')];_0x3cef40[_0x38f7('0x5a')]['messageId']=_0x48a748['body'][_0x38f7('0x96')];break;}}if(_0x3cef40[_0x38f7('0x5a')]['id']){delete _0x3cef40[_0x38f7('0x5a')]['id'];}if(_[_0x38f7('0x97')](_0x3cef40[_0x38f7('0x5a')][_0x38f7('0x81')])){throw new db['Sequelize'][(_0x38f7('0x79'))](_0x38f7('0x98'));}if(_[_0x38f7('0x97')](_0x3cef40[_0x38f7('0x5a')][_0x38f7('0x5a')])||_0x3cef40[_0x38f7('0x5a')][_0x38f7('0x5a')]===''){throw new db[(_0x38f7('0x78'))][(_0x38f7('0x79'))](_0x38f7('0x99'));}if(_[_0x38f7('0x97')](_0x3cef40[_0x38f7('0x5a')]['mapKey'])){throw new db[(_0x38f7('0x78'))][(_0x38f7('0x79'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x291bac);}if(!_[_0x38f7('0x9a')](_0x291bac,_0x3cef40['body']['mapKey'])){throw new db[(_0x38f7('0x78'))][(_0x38f7('0x79'))](_0x38f7('0x9b')+_0x291bac);}_0x519f47[_0x3cef40[_0x38f7('0x5a')][_0x38f7('0x9c')]]=_0x3cef40['body'][_0x38f7('0x81')];return db[_0x38f7('0x9d')][_0x38f7('0x60')]({'where':{'id':_0x3cef40[_0x38f7('0x74')]['ListId']},'include':[{'model':db[_0x38f7('0x77')],'as':'Contacts','where':_0x519f47,'limit':0x1,'order':[['updatedAt',_0x38f7('0x9e')]]}]});})['then'](handleEntityNotFound(_0x366747,null))[_0x38f7('0x3b')](function(_0x5d6128){if(_0x5d6128){_0x3cef40[_0x38f7('0x9f')]=_['omit'](_0x5d6128,[_0x38f7('0xa0')]);if(_0x5d6128[_0x38f7('0xa0')][_0x38f7('0x4b')]){return _0x5d6128[_0x38f7('0xa0')][0x0];}var _0x43ec7f=_[_0x38f7('0x1c')](_0x3cef40[_0x38f7('0x5a')],{'firstName':_0x3cef40['body'][_0x38f7('0x81')],'ListId':_0x5d6128['id']});_0x43ec7f[_0x3cef40[_0x38f7('0x5a')]['mapKey']]=_0x3cef40['body'][_0x38f7('0x81')];return db['CmContact'][_0x38f7('0x59')](_0x43ec7f,{'fields':_0x5356ad,'raw':!![]});}})[_0x38f7('0x3b')](handleEntityNotFound(_0x366747,null))[_0x38f7('0x3b')](function(_0x4e9504){if(_0x4e9504){_0x3cef40[_0x38f7('0xa1')]=_0x4e9504;var _0x4b73d8={'ContactId':_0x4e9504['id'],'phone':_0x3cef40['body'][_0x38f7('0x81')],'SmsAccountId':_0x48a748[_0x38f7('0x64')]['id']};var _0x547aeb={'ContactId':_0x4e9504['id'],'SmsAccountId':_0x48a748[_0x38f7('0x64')]['id'],'closed':![]};return db['SmsInteraction'][_0x38f7('0x60')]({'where':_0x547aeb})[_0x38f7('0x3b')](function(_0x4b272a){if(_0x4b272a){return[_0x4b272a,![]];}return db['SmsInteraction'][_0x38f7('0x59')](_0x4b73d8)[_0x38f7('0x3b')](function(_0x36ee12){return[_0x36ee12,!![]];});});}})[_0x38f7('0xa2')](function(_0x54047e,_0x574d7f){_0x3cef40['interaction']=_0x54047e[_0x38f7('0x5c')]({'plain':!![]});_0x3cef40[_0x38f7('0xa3')][_0x38f7('0xa4')]=![];if(_0x574d7f){if(_0x3cef40['account']['autoclose']){_0x3cef40[_0x38f7('0xa5')][_0x38f7('0xa6')]({'id':0x0,'priority':_0x3cef40[_0x38f7('0xa5')][_0x38f7('0x4b')]+0x1,'app':'close','appdata':_0x38f7('0xa7'),'interval':_0x38f7('0xa8')});}_0x3cef40[_0x38f7('0xa3')]['created']=!![];}return db[_0x38f7('0xa9')][_0x38f7('0x59')]({'phone':_0x3cef40[_0x38f7('0x5a')][_0x38f7('0x81')],'messageId':_0x3cef40['body']['messageId'],'body':_0x3cef40[_0x38f7('0x5a')][_0x38f7('0x5a')],'SmsAccountId':_0x48a748['params']['id'],'SmsInteractionId':_0x54047e['id'],'direction':'in','ContactId':_0x54047e['ContactId'],'AttachmentId':_0x3cef40[_0x38f7('0x5a')]['AttachmentId']});})[_0x38f7('0x3b')](function(_0x2848c9){_0x3cef40[_0x38f7('0x28')]=_0x2848c9;if(_0x3cef40[_0x38f7('0xa3')]['UserId']){return db[_0x38f7('0xaa')]['find']({'attributes':['id','name'],'where':{'id':_0x3cef40['interaction'][_0x38f7('0xab')]}})['then'](function(_0x10feaa){if(_0x10feaa){_0x3cef40[_0x38f7('0xa5')][_0x38f7('0xac')]({'id':0x0,'priority':0x0,'app':_0x38f7('0xad'),'appdata':_0x10feaa['name']+','+(_0x3cef40['account'][_0x38f7('0xae')]||0xa),'interval':_0x38f7('0xa8')});}return respondWithRpcPromise(_0x38f7('0xaf'),_0x38f7('0xb0'),_0x3cef40);});}return respondWithRpcPromise('Start','startRouting',_0x3cef40);})[_0x38f7('0x3b')](function(_0xb8efed){if(_0xb8efed){var _0x32625d=0xc8;var _0x46f7c0='receiveMessage';logger[_0x38f7('0xb1')](_0x38f7('0xb2'),_0x46f7c0,_0x32625d,_0x38f7('0xb3'));logger[_0x38f7('0x25')](_0x38f7('0xb4'),_0x46f7c0,_0x32625d,'entity\x20found',JSON[_0x38f7('0xb5')](_0xb8efed));if(_0x3cef40[_0x38f7('0x74')][_0x38f7('0x7f')]===_0x38f7('0x80')){return _0x366747[_0x38f7('0x2c')](_0x32625d)[_0x38f7('0x32')](_0x38f7('0xb6'),_0x38f7('0xb7'))[_0x38f7('0xb8')](_0x38f7('0xb9'));}else{return _0x366747[_0x38f7('0x2c')](_0x32625d)['json'](_0xb8efed);}}})[_0x38f7('0x2a')](handleError(_0x366747,null));};exports['addApplications']=function(_0x1adcd9,_0x3549fe){var _0x3f795e=_0x1adcd9[_0x38f7('0x64')]['id'];var _0x549d31=_0x1adcd9[_0x38f7('0x5a')];var _0x4fd580=0xc8;var _0xf3699a=null;return db['sequelize'][_0x38f7('0xba')]({'isolationLevel':db[_0x38f7('0xbb')][_0x38f7('0xbc')][_0x38f7('0xbd')][_0x38f7('0xbe')]},function(_0x3595ad){return db[_0x38f7('0x41')]['findOne']({'where':{'id':_0x3f795e},'transaction':_0x3595ad})[_0x38f7('0x3b')](function(_0x2b081f){if(_0x2b081f){return db[_0x38f7('0x73')][_0x38f7('0x3a')]({'where':{'SmsAccountId':_0x3f795e},'transaction':_0x3595ad})[_0x38f7('0x3b')](function(){var _0x331d4f=_[_0x38f7('0x54')](_0x549d31,function(_0x590428){_0x590428['SmsAccountId']=_0x3f795e;return _0x590428;});return db[_0x38f7('0x73')][_0x38f7('0xbf')](_0x331d4f,{'transaction':_0x3595ad});});}else{_0x4fd580=0x194;_0xf3699a=[];}});})[_0x38f7('0x3b')](function(){if(_0x4fd580!==0x194){return db[_0x38f7('0x73')][_0x38f7('0xc0')]({'where':{'SmsAccountId':_0x3f795e},'order':'priority'})[_0x38f7('0x3b')](function(_0x14dd9c){_0xf3699a=_0x14dd9c;});}})[_0x38f7('0x2a')](function(_0x3a600d){_0x4fd580=0x1f4;logger[_0x38f7('0x26')](_0x3a600d[_0x38f7('0x3c')]);if(_0x3a600d[_0x38f7('0x3d')]){delete _0x3a600d['name'];}_0xf3699a=_0x3a600d;})['finally'](function(){if(_0xf3699a===null){_0x3549fe[_0x38f7('0x2b')](_0x4fd580);}else{if(_0x4fd580===0x1f4){_0x3549fe[_0x38f7('0x2c')](_0x4fd580)[_0x38f7('0xb8')](_0xf3699a);}else{_0x3549fe[_0x38f7('0x2c')](_0x4fd580)['json'](_0xf3699a);}}});};exports[_0x38f7('0xc1')]=function(_0x42317c,_0x5d0be,_0x4aae35){var _0x38cac0={};var _0x321aa1={};var _0x30baaa;var _0x22027e;return db[_0x38f7('0x41')][_0x38f7('0x69')]({'where':{'id':_0x42317c['params']['id']}})[_0x38f7('0x3b')](handleEntityNotFound(_0x5d0be,null))[_0x38f7('0x3b')](function(_0x23dfa8){if(_0x23dfa8){_0x30baaa=_0x23dfa8;_0x321aa1[_0x38f7('0x44')]=_['keys'](db['SmsApplication'][_0x38f7('0x42')]);_0x321aa1[_0x38f7('0x45')]=_[_0x38f7('0x46')](_0x42317c[_0x38f7('0x45')]);_0x321aa1[_0x38f7('0x47')]=_[_0x38f7('0x48')](_0x321aa1[_0x38f7('0x44')],_0x321aa1[_0x38f7('0x45')]);_0x38cac0['attributes']=_['intersection'](_0x321aa1[_0x38f7('0x44')],qs[_0x38f7('0x4a')](_0x42317c[_0x38f7('0x45')][_0x38f7('0x4a')]));_0x38cac0[_0x38f7('0x49')]=_0x38cac0[_0x38f7('0x49')][_0x38f7('0x4b')]?_0x38cac0['attributes']:_0x321aa1['model'];_0x38cac0['order']=qs[_0x38f7('0x50')](_0x42317c[_0x38f7('0x45')][_0x38f7('0x50')]);_0x38cac0['where']=qs[_0x38f7('0x47')](_[_0x38f7('0x6a')](_0x42317c[_0x38f7('0x45')],_0x321aa1[_0x38f7('0x47')]));if(_0x42317c[_0x38f7('0x45')][_0x38f7('0x51')]){_0x38cac0[_0x38f7('0x52')]=_[_0x38f7('0x53')](_0x38cac0[_0x38f7('0x52')],{'$or':_[_0x38f7('0x54')](_0x38cac0[_0x38f7('0x49')],function(_0x93845e){var _0x1fc028={};_0x1fc028[_0x93845e]={'$like':'%'+_0x42317c[_0x38f7('0x45')][_0x38f7('0x51')]+'%'};return _0x1fc028;})});}_0x38cac0=_['merge']({},_0x38cac0,_0x42317c[_0x38f7('0x55')]);return _0x30baaa[_0x38f7('0xc1')](_0x38cac0);}})[_0x38f7('0x3b')](function(_0x4a124b){if(_0x4a124b){_0x22027e=_0x4a124b['length'];if(!_0x42317c[_0x38f7('0x45')]['hasOwnProperty'](_0x38f7('0x4d'))){_0x38cac0[_0x38f7('0x30')]=qs['limit'](_0x42317c[_0x38f7('0x45')][_0x38f7('0x30')]);_0x38cac0[_0x38f7('0x4e')]=qs[_0x38f7('0x4e')](_0x42317c[_0x38f7('0x45')][_0x38f7('0x4e')]);}return _0x30baaa['getApplications'](_0x38cac0);}})[_0x38f7('0x3b')](function(_0xcb8498){if(_0xcb8498){return _0xcb8498?{'count':_0x22027e,'rows':_0xcb8498}:null;}})['then'](respondWithResult(_0x5d0be,null))[_0x38f7('0x2a')](handleError(_0x5d0be,null));};exports[_0x38f7('0xc2')]=function(_0x13defa,_0x46b8b6,_0x20b107){var _0x595b94={'raw':![],'where':{}};var _0x202009={};var _0x4cc2bc={'count':0x0,'rows':[]};return db['SmsAccount'][_0x38f7('0x69')]({'where':{'id':_0x13defa[_0x38f7('0x64')]['id']}})[_0x38f7('0x3b')](handleEntityNotFound(_0x46b8b6,null))[_0x38f7('0x3b')](function(_0x4a24c6){if(_0x4a24c6){_0x202009['model']=_[_0x38f7('0x46')](db[_0x38f7('0xc3')][_0x38f7('0x42')]);_0x202009[_0x38f7('0x45')]=_[_0x38f7('0x46')](_0x13defa[_0x38f7('0x45')]);_0x202009[_0x38f7('0x47')]=_[_0x38f7('0x48')](_0x202009[_0x38f7('0x44')],_0x202009[_0x38f7('0x45')]);_0x595b94[_0x38f7('0x49')]=_[_0x38f7('0x48')](_0x202009[_0x38f7('0x44')],qs[_0x38f7('0x4a')](_0x13defa[_0x38f7('0x45')][_0x38f7('0x4a')]));_0x595b94[_0x38f7('0x49')]=_0x595b94[_0x38f7('0x49')][_0x38f7('0x4b')]?_0x595b94[_0x38f7('0x49')]:_0x202009[_0x38f7('0x44')];if(!_0x13defa[_0x38f7('0x45')][_0x38f7('0x4c')](_0x38f7('0x4d'))){_0x595b94[_0x38f7('0x30')]=qs[_0x38f7('0x30')](_0x13defa['query'][_0x38f7('0x30')]);_0x595b94['offset']=qs[_0x38f7('0x4e')](_0x13defa[_0x38f7('0x45')][_0x38f7('0x4e')]);}_0x595b94['order']=qs[_0x38f7('0x50')](_0x13defa['query']['sort']);_0x595b94[_0x38f7('0x52')]=qs[_0x38f7('0x47')](_[_0x38f7('0x6a')](_0x13defa[_0x38f7('0x45')],_0x202009[_0x38f7('0x47')]));_0x595b94[_0x38f7('0x52')]['SmsAccountId']=_0x4a24c6['id'];if(_0x13defa[_0x38f7('0x45')]['filter']){_0x595b94[_0x38f7('0x52')]=_[_0x38f7('0x53')](_0x595b94[_0x38f7('0x52')],{'$or':_[_0x38f7('0x54')](_0x595b94[_0x38f7('0x49')],function(_0x5c2e12){var _0x570202={};_0x570202[_0x5c2e12]={'$like':'%'+_0x13defa[_0x38f7('0x45')][_0x38f7('0x51')]+'%'};return _0x570202;})});}_0x595b94=_[_0x38f7('0x53')]({},_0x595b94,_0x13defa[_0x38f7('0x55')]);return db[_0x38f7('0xc3')][_0x38f7('0x31')]({'where':_0x595b94['where']})[_0x38f7('0x3b')](function(_0x490ac9){_0x4cc2bc[_0x38f7('0x31')]=_0x490ac9;if(_0x13defa[_0x38f7('0x45')][_0x38f7('0x56')]){_0x595b94[_0x38f7('0x57')]=[{'model':db[_0x38f7('0x77')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x38f7('0xc4'),'attributes':['name',_0x38f7('0xc5'),'internal'],'required':![]},{'model':db[_0x38f7('0xc6')],'as':_0x38f7('0xc7'),'attributes':['id',_0x38f7('0x3d'),'color'],'where':_0x13defa[_0x38f7('0x45')]['tag']?{'id':_0x13defa[_0x38f7('0x45')][_0x38f7('0xc8')]}:undefined,'required':_0x13defa[_0x38f7('0x45')][_0x38f7('0xc8')]?!![]:![]}];}return db[_0x38f7('0xc3')][_0x38f7('0x6c')](_0x595b94);})[_0x38f7('0x3b')](function(_0x4f8ed9){_0x4cc2bc[_0x38f7('0xc9')]=_0x4f8ed9;return _0x4cc2bc;});}})[_0x38f7('0x3b')](respondWithFilteredResult(_0x46b8b6,_0x595b94))['catch'](handleError(_0x46b8b6,null));};exports['send']=function(_0x4cdd01,_0x1227c4,_0x2e8864){var _0x25065d,_0x28d0f,_0x24e4b2;if(_[_0x38f7('0x97')](_0x4cdd01[_0x38f7('0x5a')][_0x38f7('0x5a')])||_0x4cdd01[_0x38f7('0x5a')][_0x38f7('0x5a')]===''){throw new db[(_0x38f7('0x78'))][(_0x38f7('0x79'))](_0x38f7('0x99'));}if(_[_0x38f7('0x97')](_0x4cdd01[_0x38f7('0x5a')]['to'])){throw new db['Sequelize']['ValidationError']('to\x20is\x20mandatory');}_0x25065d=_0x4cdd01['body']['to'];return db[_0x38f7('0x41')]['find']({'where':{'id':_0x4cdd01[_0x38f7('0x64')]['id']},'include':[{'model':db['CmList'],'as':_0x38f7('0xca'),'include':[{'model':db['CmContact'],'as':_0x38f7('0xa0'),'where':{'mobile':_0x25065d},'limit':0x1,'order':[['updatedAt',_0x38f7('0x9e')]]}]}]})[_0x38f7('0x3b')](handleEntityNotFound(_0x1227c4,null))[_0x38f7('0x3b')](function(_0x319d9f){if(_0x319d9f&&_0x319d9f['List']){_0x28d0f=_0x319d9f['get']({'plain':!![]});if(_0x28d0f['List']&&_0x28d0f['List'][_0x38f7('0xa0')]['length']){return _0x28d0f[_0x38f7('0xca')][_0x38f7('0xa0')][0x0];}return db[_0x38f7('0x77')][_0x38f7('0x59')](_[_0x38f7('0x1c')](_0x4cdd01[_0x38f7('0x5a')],{'firstName':_0x25065d,'mobile':_0x25065d,'phone':_0x25065d,'ListId':_0x28d0f[_0x38f7('0x7d')]}));}})[_0x38f7('0x3b')](handleEntityNotFound(_0x1227c4,null))[_0x38f7('0x3b')](function(_0x4b02b1){if(_0x4b02b1){_0x24e4b2=_0x4b02b1;return db['SmsInteraction'][_0x38f7('0x60')]({'where':{'ContactId':_0x24e4b2['id'],'closed':![],'SmsAccountId':_0x28d0f['id']}})[_0x38f7('0x3b')](function(_0x1504c1){if(_0x1504c1){return[_0x1504c1,![]];}return db[_0x38f7('0xc3')][_0x38f7('0x59')]({'UserId':_0x4cdd01[_0x38f7('0x5b')]['id'],'ContactId':_0x24e4b2['id'],'SmsAccountId':_0x28d0f['id'],'phone':_0x25065d,'firstMsgDirection':_0x38f7('0xcb'),'Messages':[_[_0x38f7('0x53')](_0x4cdd01[_0x38f7('0x5a')],{'read':![],'body':_0x4cdd01[_0x38f7('0x5a')][_0x38f7('0x5a')],'phone':_0x25065d,'SmsAccountId':_0x28d0f['id'],'UserId':_0x4cdd01[_0x38f7('0x5b')]['id'],'ContactId':_0x24e4b2['id']})]},{'include':[{'model':db[_0x38f7('0xa9')],'as':_0x38f7('0xcc')}]})[_0x38f7('0x3b')](function(_0x3e165e){return[_0x3e165e,!![]];});});}})['spread'](function(_0x559b48,_0x1fc38b){if(_0x1fc38b){return _0x559b48;}return db['SmsMessage'][_0x38f7('0x59')](_['merge'](_0x4cdd01[_0x38f7('0x5a')],{'read':![],'body':_0x4cdd01[_0x38f7('0x5a')][_0x38f7('0x5a')],'phone':_0x25065d,'SmsAccountId':_0x28d0f['id'],'SmsInteractionId':_0x559b48['id'],'UserId':_0x4cdd01[_0x38f7('0x5b')]['id'],'ContactId':_0x24e4b2['id']}))[_0x38f7('0x3b')](function(_0x3d61ea){_0x559b48[_0x38f7('0xcd')]['Messages']=[];_0x559b48[_0x38f7('0xcd')][_0x38f7('0xcc')][_0x38f7('0xa6')](_0x3d61ea[_0x38f7('0xcd')]);return _0x559b48;});})['then'](respondWithResult(_0x1227c4,null))[_0x38f7('0x2a')](handleError(_0x1227c4,null));};exports[_0x38f7('0x2c')]=function(_0x58ad2c,_0x4e5a0f,_0x43627f){if(_0x58ad2c['body']['id']){delete _0x58ad2c[_0x38f7('0x5a')]['id'];}var _0x467cc1,_0x43da36,_0x3bf266;return db[_0x38f7('0x41')][_0x38f7('0x60')]({'where':{'id':_0x58ad2c['params']['id']}})[_0x38f7('0x3b')](handleEntityNotFound(_0x4e5a0f,null))[_0x38f7('0x3b')](function(_0x261981){if(_0x261981){_0x3bf266=_0x261981;logger[_0x38f7('0x25')](_0x38f7('0xb2'),_0x38f7('0x2c'),_0x38f7('0xce'),_0x261981['type'],util[_0x38f7('0xcf')](_0x58ad2c['body'],{'showHidden':![],'depth':null}));switch(_0x261981[_0x38f7('0x7f')]){case _0x38f7('0x86'):if(_0x58ad2c[_0x38f7('0x5a')][_0x38f7('0xd0')]&&_0x58ad2c['body'][_0x38f7('0x2c')]){_0x43da36=_0x58ad2c[_0x38f7('0x5a')][_0x38f7('0x2c')];return db['SmsMessage']['find']({'where':{'messageId':_0x58ad2c[_0x38f7('0x5a')][_0x38f7('0xd0')]}});}break;case _0x38f7('0x87'):if(_0x58ad2c['body'][_0x38f7('0xd1')]&&_0x58ad2c['body'][_0x38f7('0xd2')]){_0x43da36=_0x58ad2c[_0x38f7('0x5a')][_0x38f7('0xd2')];return db[_0x38f7('0xa9')][_0x38f7('0x60')]({'where':{'messageId':_0x58ad2c[_0x38f7('0x5a')]['requestid']}});}break;case _0x38f7('0x88'):if(_0x58ad2c['body']['message_id']&&_0x58ad2c[_0x38f7('0x5a')]['status_code']){_0x43da36=_0x58ad2c[_0x38f7('0x5a')]['status_code'];return db['SmsMessage'][_0x38f7('0x60')]({'where':{'messageId':_0x58ad2c['body'][_0x38f7('0x89')]}});}break;case _0x38f7('0x8d'):var _0x3b531c=_0x58ad2c[_0x38f7('0x5a')][_0x38f7('0x8e')][0x0];if(_0x3b531c['messageId']&&_0x3b531c[_0x38f7('0x2c')]['groupName']===_0x38f7('0xd3')){_0x43da36=_0x3b531c[_0x38f7('0x2c')][_0x38f7('0xd4')];return db[_0x38f7('0xa9')][_0x38f7('0x60')]({'where':{'messageId':_0x3b531c[_0x38f7('0x84')]}});}break;case _0x38f7('0x92'):if(_0x58ad2c[_0x38f7('0x5a')][_0x38f7('0x84')]&&_0x58ad2c[_0x38f7('0x5a')]['status']){_0x43da36=_0x58ad2c['body'][_0x38f7('0x2c')];return db[_0x38f7('0xa9')][_0x38f7('0x60')]({'where':{'messageId':_0x58ad2c[_0x38f7('0x5a')][_0x38f7('0x84')]}});}break;case'bandwidth':if(_0x58ad2c[_0x38f7('0x5a')][0x0][_0x38f7('0x28')]['id']){_0x43da36=_0x58ad2c[_0x38f7('0x5a')][0x0][_0x38f7('0x7f')];return db[_0x38f7('0xa9')]['find']({'where':{'messageId':_0x58ad2c[_0x38f7('0x5a')][0x0][_0x38f7('0x28')]['id']}});}break;case _0x38f7('0x95'):if(_0x58ad2c[_0x38f7('0x5a')][_0x38f7('0xd5')]&&_0x58ad2c[_0x38f7('0x5a')]['status']){_0x43da36=_0x58ad2c['body'][_0x38f7('0x2c')];return db[_0x38f7('0xa9')][_0x38f7('0x60')]({'where':{'messageId':_0x58ad2c[_0x38f7('0x5a')][_0x38f7('0xd5')]}});}break;}}})['then'](handleEntityNotFound(_0x4e5a0f,null))[_0x38f7('0x3b')](function(_0x44263b){if(_0x44263b){_0x467cc1=_0x44263b;switch(_0x3bf266[_0x38f7('0x7f')]){case _0x38f7('0x86'):if(_0x43da36===_0x38f7('0xd3')){return _0x467cc1[_0x38f7('0x37')]({'read':!![]});}else{logger[_0x38f7('0x26')](_0x38f7('0xb2'),_0x38f7('0x2c'),'skebby',util[_0x38f7('0xcf')](_0x58ad2c[_0x38f7('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x38f7('0x87'):if(_0x43da36==='1'){return _0x467cc1['update']({'read':!![]});}else{logger[_0x38f7('0x26')](_0x38f7('0xb2'),_0x38f7('0x2c'),_0x38f7('0x86'),util[_0x38f7('0xcf')](_0x58ad2c[_0x38f7('0x5a')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x58ad2c[_0x38f7('0x5a')][_0x38f7('0xd6')]&&_0x43da36>=0xc8&&_0x43da36<=0xce){return _0x467cc1['update']({'read':!![]});}else{logger[_0x38f7('0x26')](_0x38f7('0xb2'),'status',_0x38f7('0x88'),util[_0x38f7('0xcf')](_0x58ad2c[_0x38f7('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x38f7('0x8d'):var _0x432693=_0x58ad2c[_0x38f7('0x5a')][_0x38f7('0x8e')][0x0];if(_0x432693[_0x38f7('0x2c')][_0x38f7('0xd4')]===_0x38f7('0xd3')){return _0x467cc1[_0x38f7('0x37')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x38f7('0x2c'),_0x38f7('0x8d'),util[_0x38f7('0xcf')](_0x58ad2c[_0x38f7('0x5a')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x43da36==_0x38f7('0xd7')||_0x43da36==_0x38f7('0xd8')){return _0x467cc1[_0x38f7('0x37')]({'read':!![]});}else{logger[_0x38f7('0x26')](_0x38f7('0xb2'),_0x38f7('0x2c'),_0x38f7('0x92'),util['inspect'](_0x58ad2c[_0x38f7('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x38f7('0x94'):if(_0x43da36==_0x38f7('0xd9')){return _0x467cc1[_0x38f7('0x37')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x38f7('0x2c'),'bandwidth',util[_0x38f7('0xcf')](_0x58ad2c[_0x38f7('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x38f7('0x95'):if(_0x43da36===_0x38f7('0xda')||_0x43da36==='ACCEPTD'){return _0x467cc1['update']({'read':!![]});}else{logger[_0x38f7('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x38f7('0x2c'),_0x38f7('0x95'),util[_0x38f7('0xcf')](_0x58ad2c['body'],{'showHidden':![],'depth':null}));}break;}return _0x467cc1;}})[_0x38f7('0x3b')](respondWithResult(_0x4e5a0f,null))[_0x38f7('0x2a')](handleError(_0x4e5a0f,null));};exports[_0x38f7('0xdb')]=function(_0x1e6104,_0x20db23,_0x5c5366){var _0x8ff1c3,_0x354e32,_0x50beb7;return db[_0x38f7('0x41')]['find']({'where':{'id':_0x1e6104[_0x38f7('0x64')]['id']}})[_0x38f7('0x3b')](handleEntityNotFound(_0x20db23,null))['then'](function(_0xe42eb3){if(_0xe42eb3){_0x50beb7=_0xe42eb3;logger[_0x38f7('0x25')](_0x38f7('0xb2'),'status',_0x38f7('0xce'),_0xe42eb3[_0x38f7('0x7f')],util[_0x38f7('0xcf')](_0x1e6104[_0x38f7('0x45')],{'showHidden':![],'depth':null}));switch(_0xe42eb3[_0x38f7('0x7f')]){case _0x38f7('0xdc'):if(_0x1e6104[_0x38f7('0x45')]['message-id']&&_0x1e6104[_0x38f7('0x45')][_0x38f7('0xdd')]){_0x354e32=_0x1e6104[_0x38f7('0x45')][_0x38f7('0xdd')];return db[_0x38f7('0xa9')][_0x38f7('0x60')]({'where':{'messageId':_0x1e6104[_0x38f7('0x45')][_0x38f7('0xde')]}});}break;}}})['then'](handleEntityNotFound(_0x20db23,null))[_0x38f7('0x3b')](function(_0x499f4d){if(_0x499f4d){_0x8ff1c3=_0x499f4d;switch(_0x50beb7[_0x38f7('0x7f')]){case _0x38f7('0xdc'):if(_0x354e32==='2'||_0x354e32==='6'){return _0x8ff1c3[_0x38f7('0x37')]({'read':!![]});}else{logger['error'](_0x38f7('0xb2'),'status',_0x38f7('0xdc'),util[_0x38f7('0xcf')](_0x1e6104[_0x38f7('0x45')],{'showHidden':![],'depth':null}));};break;}return _0x8ff1c3;}})[_0x38f7('0x3b')](respondWithResult(_0x20db23,null))[_0x38f7('0x2a')](handleError(_0x20db23,null));};exports['addAgents']=function(_0x3237b7,_0x528b5f,_0x4c295d){return db[_0x38f7('0x41')][_0x38f7('0x60')]({'where':{'id':_0x3237b7[_0x38f7('0x64')]['id']}})[_0x38f7('0x3b')](handleEntityNotFound(_0x528b5f,null))[_0x38f7('0x3b')](function(_0x13442){if(_0x13442){return _0x13442['addAgents'](_0x3237b7[_0x38f7('0x5a')]['ids'],_['omit'](_0x3237b7[_0x38f7('0x5a')],['ids','id'])||{})['spread'](function(_0x2674c5){for(var _0x1ee6dd=0x0;_0x1ee6dd<_0x3237b7[_0x38f7('0x5a')][_0x38f7('0x6e')][_0x38f7('0x4b')];_0x1ee6dd+=0x1){socket[_0x38f7('0xdf')](_0x38f7('0xe0'),{'UserId':Number(_0x3237b7[_0x38f7('0x5a')][_0x38f7('0x6e')][_0x1ee6dd]),'SmsAccountId':Number(_0x3237b7[_0x38f7('0x64')]['id'])});}return _0x2674c5;});}})[_0x38f7('0x3b')](respondWithResult(_0x528b5f,null))[_0x38f7('0x2a')](handleError(_0x528b5f,null));};exports[_0x38f7('0xe1')]=function(_0xe0fd95,_0x526af7,_0x564cfb){return db[_0x38f7('0x41')][_0x38f7('0x60')]({'where':{'id':_0xe0fd95['params']['id']}})[_0x38f7('0x3b')](handleEntityNotFound(_0x526af7,null))[_0x38f7('0x3b')](function(_0x34aa78){if(_0x34aa78){return _0x34aa78[_0x38f7('0xe1')](_0xe0fd95[_0x38f7('0x45')][_0x38f7('0x6e')])[_0x38f7('0x3b')](function(){if(_[_0x38f7('0xe2')](_0xe0fd95[_0x38f7('0x45')][_0x38f7('0x6e')])){for(var _0x51e5c5=0x0;_0x51e5c5<_0xe0fd95['query'][_0x38f7('0x6e')][_0x38f7('0x4b')];_0x51e5c5+=0x1){socket[_0x38f7('0xdf')](_0x38f7('0xe3'),{'UserId':Number(_0xe0fd95[_0x38f7('0x45')][_0x38f7('0x6e')][_0x51e5c5]),'SmsAccountId':Number(_0xe0fd95['params']['id'])});}}else{socket[_0x38f7('0xdf')]('userSmsAccount:remove',{'UserId':Number(_0xe0fd95['query'][_0x38f7('0x6e')]),'SmsAccountId':Number(_0xe0fd95[_0x38f7('0x64')]['id'])});}});}})[_0x38f7('0x3b')](respondWithStatusCode(_0x526af7,null))[_0x38f7('0x2a')](handleError(_0x526af7,null));};exports[_0x38f7('0xe4')]=function(_0x54f14d,_0x2a93f2,_0x46707d){var _0x5dd1cd={};var _0x1a70e8={};var _0x399c8b;var _0x10b169;return db[_0x38f7('0x41')][_0x38f7('0x69')]({'where':{'id':_0x54f14d['params']['id']}})[_0x38f7('0x3b')](handleEntityNotFound(_0x2a93f2,null))['then'](function(_0xbe22ad){if(_0xbe22ad){_0x399c8b=_0xbe22ad;_0x1a70e8[_0x38f7('0x44')]=_['keys'](db[_0x38f7('0xaa')]['rawAttributes']);_0x1a70e8[_0x38f7('0x45')]=_[_0x38f7('0x46')](_0x54f14d[_0x38f7('0x45')]);_0x1a70e8['filters']=_['intersection'](_0x1a70e8[_0x38f7('0x44')],_0x1a70e8[_0x38f7('0x45')]);_0x5dd1cd[_0x38f7('0x49')]=_[_0x38f7('0x48')](_0x1a70e8[_0x38f7('0x44')],qs[_0x38f7('0x4a')](_0x54f14d['query'][_0x38f7('0x4a')]));_0x5dd1cd[_0x38f7('0x49')]=_0x5dd1cd[_0x38f7('0x49')][_0x38f7('0x4b')]?_0x5dd1cd[_0x38f7('0x49')]:_0x1a70e8[_0x38f7('0x44')];_0x5dd1cd[_0x38f7('0x4f')]=qs[_0x38f7('0x50')](_0x54f14d[_0x38f7('0x45')][_0x38f7('0x50')]);_0x5dd1cd[_0x38f7('0x52')]=qs[_0x38f7('0x47')](_[_0x38f7('0x6a')](_0x54f14d[_0x38f7('0x45')],_0x1a70e8[_0x38f7('0x47')]));if(_0x54f14d['query'][_0x38f7('0x51')]){_0x5dd1cd[_0x38f7('0x52')]=_[_0x38f7('0x53')](_0x5dd1cd['where'],{'$or':_['map'](_0x5dd1cd[_0x38f7('0x49')],function(_0x129309){var _0x1ef3c2={};_0x1ef3c2[_0x129309]={'$like':'%'+_0x54f14d[_0x38f7('0x45')]['filter']+'%'};return _0x1ef3c2;})});}_0x5dd1cd=_[_0x38f7('0x53')]({},_0x5dd1cd,_0x54f14d['options']);return _0x399c8b[_0x38f7('0xe4')](_0x5dd1cd);}})['then'](function(_0x64ab8d){if(_0x64ab8d){_0x10b169=_0x64ab8d[_0x38f7('0x4b')];if(!_0x54f14d[_0x38f7('0x45')][_0x38f7('0x4c')](_0x38f7('0x4d'))){_0x5dd1cd['limit']=qs['limit'](_0x54f14d[_0x38f7('0x45')][_0x38f7('0x30')]);_0x5dd1cd['offset']=qs[_0x38f7('0x4e')](_0x54f14d['query'][_0x38f7('0x4e')]);}return _0x399c8b['getAgents'](_0x5dd1cd);}})[_0x38f7('0x3b')](function(_0x80debe){if(_0x80debe){return _0x80debe?{'count':_0x10b169,'rows':_0x80debe}:null;}})[_0x38f7('0x3b')](respondWithResult(_0x2a93f2,null))[_0x38f7('0x2a')](handleError(_0x2a93f2,null));}; \ No newline at end of file +var _0xbdf1=['message-id','state','addAgents','emit','removeAgents','isArray','userSmsAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','jayson/promise','client','http','request','then','SmsAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','name','send','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','keys','find','create','body','role','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','SmsAccountId','getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','orderBy','CmContact','Sequelize','createdAt','updatedAt','difference','CompanyId','ListId','mobile','type','from','From','messageId','MessageSid','skebby','sender','text','clicksend','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','refid','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','CmList','Contacts','list','omit','contact','SmsInteraction','spread','interaction','created','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','twilio','set','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','READ_COMMITTED','bulkCreate','priority','stack','finally','sendStatus','getApplications','getInteractions','Contact','Tag','Tags','color','tag','List','DESC','dataValues','Messages','push','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','connectel','requestid','statusInt','message_id','status_code','groupName','DELIVERED','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','intelepeer','DELIVRD','statusGet'];(function(_0x56ba92,_0xb3c986){var _0x8fe94d=function(_0x23b21c){while(--_0x23b21c){_0x56ba92['push'](_0x56ba92['shift']());}};_0x8fe94d(++_0xb3c986);}(_0xbdf1,0x1d4));var _0x1bdf=function(_0x893c38,_0x3d6e5d){_0x893c38=_0x893c38-0x0;var _0x4401b6=_0xbdf1[_0x893c38];return _0x4401b6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1bdf('0x0'));var zipdir=require(_0x1bdf('0x1'));var jsonpatch=require(_0x1bdf('0x2'));var rp=require(_0x1bdf('0x3'));var moment=require(_0x1bdf('0x4'));var BPromise=require(_0x1bdf('0x5'));var Mustache=require('mustache');var util=require(_0x1bdf('0x6'));var path=require(_0x1bdf('0x7'));var sox=require(_0x1bdf('0x8'));var csv=require(_0x1bdf('0x9'));var ejs=require(_0x1bdf('0xa'));var fs=require('fs');var fs_extra=require(_0x1bdf('0xb'));var _=require(_0x1bdf('0xc'));var squel=require(_0x1bdf('0xd'));var crypto=require(_0x1bdf('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x1bdf('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1bdf('0x10'));var Papa=require('papaparse');var Redis=require(_0x1bdf('0x11'));var authService=require(_0x1bdf('0x12'));var qs=require(_0x1bdf('0x13'));var as=require(_0x1bdf('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1bdf('0x15'))(_0x1bdf('0x16'));var utils=require(_0x1bdf('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x1bdf('0x18'));var db=require(_0x1bdf('0x19'))['db'];config[_0x1bdf('0x1a')]=_[_0x1bdf('0x1b')](config[_0x1bdf('0x1a')],{'host':_0x1bdf('0x1c'),'port':0x18eb});var socket=require(_0x1bdf('0x1d'))(new Redis(config[_0x1bdf('0x1a')]));require(_0x1bdf('0x1e'))['register'](socket);var jayson=require(_0x1bdf('0x1f'));var client=jayson[_0x1bdf('0x20')][_0x1bdf('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x407d9b,_0x3c1f49,_0x174751,_0x4024d7){return new BPromise(function(_0x2715f5,_0x12a702){var _0x50c2af=_0x4024d7||client;return _0x50c2af[_0x1bdf('0x22')](_0x407d9b,_0x174751)[_0x1bdf('0x23')](function(_0x415939){logger['info'](_0x1bdf('0x24'),_0x3c1f49,'request\x20sent');logger[_0x1bdf('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3c1f49,_0x1bdf('0x26'),JSON[_0x1bdf('0x27')](_0x415939));if(_0x415939['error']){if(_0x415939[_0x1bdf('0x28')][_0x1bdf('0x29')]===0x1f4){logger[_0x1bdf('0x28')]('SmsAccount,\x20%s,\x20%s',_0x3c1f49,_0x415939['error']['message']);return _0x12a702(_0x415939[_0x1bdf('0x28')][_0x1bdf('0x2a')]);}logger[_0x1bdf('0x28')](_0x1bdf('0x24'),_0x3c1f49,_0x415939[_0x1bdf('0x28')][_0x1bdf('0x2a')]);return _0x2715f5(_0x415939['error']['message']);}else{logger[_0x1bdf('0x2b')](_0x1bdf('0x24'),_0x3c1f49,'request\x20sent');_0x2715f5(_0x415939[_0x1bdf('0x2c')][_0x1bdf('0x2a')]);}})[_0x1bdf('0x2d')](function(_0x555f94){logger[_0x1bdf('0x28')](_0x1bdf('0x24'),_0x3c1f49,_0x555f94);_0x12a702(_0x555f94);});});}function respondWithStatusCode(_0xf8b861,_0x58c0f7){_0x58c0f7=_0x58c0f7||0xcc;return function(_0x2abd2a){if(_0x2abd2a){return _0xf8b861['sendStatus'](_0x58c0f7);}return _0xf8b861[_0x1bdf('0x2e')](_0x58c0f7)[_0x1bdf('0x2f')]();};}function respondWithResult(_0x5067dc,_0x4de270){_0x4de270=_0x4de270||0xc8;return function(_0x4adc8d){if(_0x4adc8d){return _0x5067dc[_0x1bdf('0x2e')](_0x4de270)[_0x1bdf('0x30')](_0x4adc8d);}};}function respondWithFilteredResult(_0x330d92,_0x1e6839){return function(_0x9690bd){if(_0x9690bd){var _0x4b5120=typeof _0x1e6839[_0x1bdf('0x31')]===_0x1bdf('0x32')&&typeof _0x1e6839[_0x1bdf('0x33')]===_0x1bdf('0x32');var _0x231747=_0x9690bd[_0x1bdf('0x34')];var _0x5d0654=_0x4b5120?0x0:_0x1e6839['offset'];var _0x3a1728=_0x4b5120?_0x9690bd[_0x1bdf('0x34')]:_0x1e6839[_0x1bdf('0x31')]+_0x1e6839[_0x1bdf('0x33')];var _0x3e7c2a;if(_0x3a1728>=_0x231747){_0x3a1728=_0x231747;_0x3e7c2a=0xc8;}else{_0x3e7c2a=0xce;}_0x330d92[_0x1bdf('0x2e')](_0x3e7c2a);return _0x330d92['set'](_0x1bdf('0x35'),_0x5d0654+'-'+_0x3a1728+'/'+_0x231747)[_0x1bdf('0x30')](_0x9690bd);}return null;};}function patchUpdates(_0x177948){return function(_0x51b645){try{jsonpatch[_0x1bdf('0x36')](_0x51b645,_0x177948,!![]);}catch(_0x4a5ab7){return BPromise[_0x1bdf('0x37')](_0x4a5ab7);}return _0x51b645[_0x1bdf('0x38')]();};}function saveUpdates(_0x551c91,_0x3d4a67){return function(_0x3b6dff){if(_0x3b6dff){return _0x3b6dff[_0x1bdf('0x39')](_0x551c91)[_0x1bdf('0x23')](function(_0x5e0994){return _0x5e0994;});}return null;};}function removeEntity(_0x585db7,_0x3fe0c9){return function(_0xa6edfb){if(_0xa6edfb){return _0xa6edfb[_0x1bdf('0x3a')]()[_0x1bdf('0x23')](function(){var _0x590654=_0xa6edfb[_0x1bdf('0x3b')]({'plain':!![]});var _0x30a24f='SmsAccounts';return db[_0x1bdf('0x3c')]['destroy']({'where':{'type':_0x30a24f,'resourceId':_0x590654['id']}})[_0x1bdf('0x23')](function(){return _0xa6edfb;});})[_0x1bdf('0x23')](function(){_0x585db7[_0x1bdf('0x2e')](0xcc)[_0x1bdf('0x2f')]();});}};}function handleEntityNotFound(_0xcf2491,_0x133345){return function(_0x4c7f8e){if(!_0x4c7f8e){_0xcf2491['sendStatus'](0x194);}return _0x4c7f8e;};}function handleError(_0x510c65,_0x35664a){_0x35664a=_0x35664a||0x1f4;return function(_0xfb3c51){logger[_0x1bdf('0x28')](_0xfb3c51['stack']);if(_0xfb3c51[_0x1bdf('0x3d')]){delete _0xfb3c51[_0x1bdf('0x3d')];}_0x510c65[_0x1bdf('0x2e')](_0x35664a)[_0x1bdf('0x3e')](_0xfb3c51);};}exports['index']=function(_0x2a9f0c,_0x43a477){var _0x2f91c7={'include':[{'model':db[_0x1bdf('0x3f')],'as':_0x1bdf('0x40')}]},_0x829336={},_0x54cb6e={'count':0x0,'rows':[]};var _0x42b47e=_[_0x1bdf('0x41')](db[_0x1bdf('0x42')][_0x1bdf('0x43')],function(_0x5e3ad0){return{'name':_0x5e3ad0[_0x1bdf('0x44')],'type':_0x5e3ad0['type'][_0x1bdf('0x45')]};});_0x829336[_0x1bdf('0x46')]=_[_0x1bdf('0x41')](_0x42b47e,_0x1bdf('0x3d'));_0x829336[_0x1bdf('0x47')]=_['keys'](_0x2a9f0c['query']);_0x829336[_0x1bdf('0x48')]=_[_0x1bdf('0x49')](_0x829336[_0x1bdf('0x46')],_0x829336[_0x1bdf('0x47')]);_0x2f91c7[_0x1bdf('0x4a')]=_['intersection'](_0x829336[_0x1bdf('0x46')],qs[_0x1bdf('0x4b')](_0x2a9f0c[_0x1bdf('0x47')][_0x1bdf('0x4b')]));_0x2f91c7[_0x1bdf('0x4a')]=_0x2f91c7['attributes'][_0x1bdf('0x4c')]?_0x2f91c7[_0x1bdf('0x4a')]:_0x829336[_0x1bdf('0x46')];if(!_0x2a9f0c['query'][_0x1bdf('0x4d')](_0x1bdf('0x4e'))){_0x2f91c7[_0x1bdf('0x33')]=qs[_0x1bdf('0x33')](_0x2a9f0c['query'][_0x1bdf('0x33')]);_0x2f91c7[_0x1bdf('0x31')]=qs[_0x1bdf('0x31')](_0x2a9f0c[_0x1bdf('0x47')][_0x1bdf('0x31')]);}_0x2f91c7[_0x1bdf('0x4f')]=qs[_0x1bdf('0x50')](_0x2a9f0c[_0x1bdf('0x47')]['sort']);_0x2f91c7[_0x1bdf('0x51')]=qs[_0x1bdf('0x48')](_[_0x1bdf('0x52')](_0x2a9f0c[_0x1bdf('0x47')],_0x829336[_0x1bdf('0x48')]),_0x42b47e);if(_0x2a9f0c[_0x1bdf('0x47')]['filter']){_0x2f91c7[_0x1bdf('0x51')]=_[_0x1bdf('0x53')](_0x2f91c7[_0x1bdf('0x51')],{'$or':_['map'](_0x42b47e,function(_0x15378d){if(_0x15378d['type']!==_0x1bdf('0x54')){var _0x317b9c={};_0x317b9c[_0x15378d[_0x1bdf('0x3d')]]={'$like':'%'+_0x2a9f0c[_0x1bdf('0x47')][_0x1bdf('0x55')]+'%'};return _0x317b9c;}})});}_0x2f91c7=_[_0x1bdf('0x53')]({},_0x2f91c7,_0x2a9f0c[_0x1bdf('0x56')]);var _0x1b99d9={'where':_0x2f91c7['where']};return db[_0x1bdf('0x42')][_0x1bdf('0x34')](_0x1b99d9)[_0x1bdf('0x23')](function(_0xd74db){_0x54cb6e[_0x1bdf('0x34')]=_0xd74db;if(_0x2a9f0c['query'][_0x1bdf('0x57')]){_0x2f91c7[_0x1bdf('0x58')]=[{'all':!![]}];}return db[_0x1bdf('0x42')][_0x1bdf('0x59')](_0x2f91c7);})[_0x1bdf('0x23')](function(_0x420eda){_0x54cb6e[_0x1bdf('0x5a')]=_0x420eda;return _0x54cb6e;})[_0x1bdf('0x23')](respondWithFilteredResult(_0x43a477,_0x2f91c7))[_0x1bdf('0x2d')](handleError(_0x43a477,null));};exports[_0x1bdf('0x5b')]=function(_0x4dad6e,_0x4a9ed7){var _0x54ceba={'raw':![],'where':{'id':_0x4dad6e['params']['id']},'include':[{'model':db[_0x1bdf('0x3f')],'as':'mandatoryDispositionPause'}]},_0x1fe095={};_0x1fe095[_0x1bdf('0x46')]=_[_0x1bdf('0x5c')](db[_0x1bdf('0x42')]['rawAttributes']);_0x1fe095[_0x1bdf('0x47')]=_[_0x1bdf('0x5c')](_0x4dad6e[_0x1bdf('0x47')]);_0x1fe095[_0x1bdf('0x48')]=_[_0x1bdf('0x49')](_0x1fe095[_0x1bdf('0x46')],_0x1fe095[_0x1bdf('0x47')]);_0x54ceba[_0x1bdf('0x4a')]=_[_0x1bdf('0x49')](_0x1fe095['model'],qs[_0x1bdf('0x4b')](_0x4dad6e[_0x1bdf('0x47')][_0x1bdf('0x4b')]));_0x54ceba['attributes']=_0x54ceba[_0x1bdf('0x4a')][_0x1bdf('0x4c')]?_0x54ceba['attributes']:_0x1fe095[_0x1bdf('0x46')];if(_0x4dad6e[_0x1bdf('0x47')][_0x1bdf('0x57')]){_0x54ceba[_0x1bdf('0x58')]=[{'all':!![]}];}_0x54ceba=_['merge']({},_0x54ceba,_0x4dad6e[_0x1bdf('0x56')]);return db[_0x1bdf('0x42')][_0x1bdf('0x5d')](_0x54ceba)[_0x1bdf('0x23')](handleEntityNotFound(_0x4a9ed7,null))[_0x1bdf('0x23')](respondWithResult(_0x4a9ed7,null))[_0x1bdf('0x2d')](handleError(_0x4a9ed7,null));};exports[_0x1bdf('0x5e')]=function(_0x2e61ff,_0x3e6b41){return db[_0x1bdf('0x42')][_0x1bdf('0x5e')](_0x2e61ff[_0x1bdf('0x5f')],{})[_0x1bdf('0x23')](function(_0xbc028f){var _0xba68fe=_0x2e61ff['user'][_0x1bdf('0x3b')]({'plain':!![]});if(!_0xba68fe)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xba68fe[_0x1bdf('0x60')]===_0x1bdf('0x61')){var _0x415b93=_0xbc028f[_0x1bdf('0x3b')]({'plain':!![]});var _0x2bab20='SmsAccounts';return db['UserProfileSection']['find']({'where':{'name':_0x2bab20,'userProfileId':_0xba68fe[_0x1bdf('0x62')]},'raw':!![]})[_0x1bdf('0x23')](function(_0x401a57){if(_0x401a57&&_0x401a57['autoAssociation']===0x0){return db[_0x1bdf('0x3c')][_0x1bdf('0x5e')]({'name':_0x415b93[_0x1bdf('0x3d')],'resourceId':_0x415b93['id'],'type':_0x401a57['name'],'sectionId':_0x401a57['id']},{})[_0x1bdf('0x23')](function(){return _0xbc028f;});}else{return _0xbc028f;}})['catch'](function(_0x559582){logger[_0x1bdf('0x28')](_0x1bdf('0x63'),_0x559582);throw _0x559582;});}return _0xbc028f;})[_0x1bdf('0x23')](respondWithResult(_0x3e6b41,0xc9))[_0x1bdf('0x2d')](handleError(_0x3e6b41,null));};exports[_0x1bdf('0x39')]=function(_0x27c222,_0x2b4fe7){if(_0x27c222[_0x1bdf('0x5f')]['id']){delete _0x27c222[_0x1bdf('0x5f')]['id'];}return db[_0x1bdf('0x42')][_0x1bdf('0x5d')]({'where':{'id':_0x27c222[_0x1bdf('0x64')]['id']},'include':[{'model':db[_0x1bdf('0x3f')],'as':_0x1bdf('0x40')}]})[_0x1bdf('0x23')](handleEntityNotFound(_0x2b4fe7,null))[_0x1bdf('0x23')](saveUpdates(_0x27c222[_0x1bdf('0x5f')],null))['then'](respondWithResult(_0x2b4fe7,null))[_0x1bdf('0x2d')](handleError(_0x2b4fe7,null));};exports[_0x1bdf('0x3a')]=function(_0x451b08,_0x3f9945){return db['SmsAccount']['find']({'where':{'id':_0x451b08[_0x1bdf('0x64')]['id']}})['then'](handleEntityNotFound(_0x3f9945,null))[_0x1bdf('0x23')](removeEntity(_0x3f9945,null))[_0x1bdf('0x2d')](handleError(_0x3f9945,null));};exports['describe']=function(_0x45b7da,_0x64d030){return db[_0x1bdf('0x42')][_0x1bdf('0x65')]()[_0x1bdf('0x23')](respondWithResult(_0x64d030,null))[_0x1bdf('0x2d')](handleError(_0x64d030,null));};exports[_0x1bdf('0x66')]=function(_0x18bb0f,_0x186c47,_0x224e15){if(_0x18bb0f[_0x1bdf('0x5f')]['id']){delete _0x18bb0f['body']['id'];}return db[_0x1bdf('0x42')][_0x1bdf('0x5d')]({'where':{'id':_0x18bb0f[_0x1bdf('0x64')]['id']}})[_0x1bdf('0x23')](handleEntityNotFound(_0x186c47,null))[_0x1bdf('0x23')](function(_0x131590){if(_0x131590){_0x18bb0f[_0x1bdf('0x5f')][_0x1bdf('0x67')]=_0x131590['id'];return db['Disposition'][_0x1bdf('0x5e')](_0x18bb0f[_0x1bdf('0x5f')]);}})[_0x1bdf('0x23')](respondWithResult(_0x186c47,null))[_0x1bdf('0x2d')](handleError(_0x186c47,null));};exports[_0x1bdf('0x68')]=function(_0x209767,_0x179352,_0x7167ba){var _0x37ee2b={'raw':![],'where':{}};var _0x6522e7={};var _0x262e50={'count':0x0,'rows':[]};return db[_0x1bdf('0x42')][_0x1bdf('0x69')]({'where':{'id':_0x209767[_0x1bdf('0x64')]['id']}})[_0x1bdf('0x23')](handleEntityNotFound(_0x179352,null))[_0x1bdf('0x23')](function(_0x4a2935){if(_0x4a2935){_0x6522e7[_0x1bdf('0x46')]=_[_0x1bdf('0x5c')](db[_0x1bdf('0x6a')][_0x1bdf('0x43')]);_0x6522e7[_0x1bdf('0x47')]=_[_0x1bdf('0x5c')](_0x209767['query']);_0x6522e7[_0x1bdf('0x48')]=_[_0x1bdf('0x49')](_0x6522e7[_0x1bdf('0x46')],_0x6522e7['query']);_0x37ee2b['attributes']=_[_0x1bdf('0x49')](_0x6522e7[_0x1bdf('0x46')],qs['fields'](_0x209767[_0x1bdf('0x47')][_0x1bdf('0x4b')]));_0x37ee2b['attributes']=_0x37ee2b[_0x1bdf('0x4a')]['length']?_0x37ee2b[_0x1bdf('0x4a')]:_0x6522e7[_0x1bdf('0x46')];if(!_0x209767[_0x1bdf('0x47')][_0x1bdf('0x4d')]('nolimit')){_0x37ee2b['limit']=qs['limit'](_0x209767['query']['limit']);_0x37ee2b['offset']=qs['offset'](_0x209767[_0x1bdf('0x47')]['offset']);}_0x37ee2b['order']=qs['sort'](_0x209767[_0x1bdf('0x47')][_0x1bdf('0x50')]);_0x37ee2b[_0x1bdf('0x51')]=qs['filters'](_[_0x1bdf('0x52')](_0x209767[_0x1bdf('0x47')],_0x6522e7[_0x1bdf('0x48')]));_0x37ee2b[_0x1bdf('0x51')]['SmsAccountId']=_0x4a2935['id'];if(_0x209767['query'][_0x1bdf('0x55')]){_0x37ee2b[_0x1bdf('0x51')]=_[_0x1bdf('0x53')](_0x37ee2b['where'],{'$or':_[_0x1bdf('0x41')](_0x37ee2b[_0x1bdf('0x4a')],function(_0x46ae4d){var _0x4d3686={};_0x4d3686[_0x46ae4d]={'$like':'%'+_0x209767['query']['filter']+'%'};return _0x4d3686;})});}_0x37ee2b=_[_0x1bdf('0x53')]({},_0x37ee2b,_0x209767[_0x1bdf('0x56')]);return db['Disposition'][_0x1bdf('0x34')]({'where':_0x37ee2b[_0x1bdf('0x51')]})[_0x1bdf('0x23')](function(_0x446abc){_0x262e50[_0x1bdf('0x34')]=_0x446abc;if(_0x209767[_0x1bdf('0x47')][_0x1bdf('0x57')]){_0x37ee2b[_0x1bdf('0x58')]=[{'all':!![]}];}return db[_0x1bdf('0x6a')][_0x1bdf('0x59')](_0x37ee2b);})['then'](function(_0x58baab){_0x262e50[_0x1bdf('0x5a')]=_0x58baab;return _0x262e50;});}})['then'](respondWithFilteredResult(_0x179352,_0x37ee2b))['catch'](handleError(_0x179352,null));};exports[_0x1bdf('0x6b')]=function(_0x2a223c,_0x2ddc2d,_0x49cf18){return db['SmsAccount'][_0x1bdf('0x5d')]({'where':{'id':_0x2a223c[_0x1bdf('0x64')]['id']}})[_0x1bdf('0x23')](handleEntityNotFound(_0x2ddc2d,null))[_0x1bdf('0x23')](function(_0x115d07){if(_0x115d07){return _0x115d07[_0x1bdf('0x6b')](_0x2a223c[_0x1bdf('0x47')][_0x1bdf('0x6c')]);}})['then'](respondWithStatusCode(_0x2ddc2d,null))['catch'](handleError(_0x2ddc2d,null));};exports[_0x1bdf('0x6d')]=function(_0x155ba1,_0x43b93c,_0x21bc81){if(_0x155ba1[_0x1bdf('0x5f')]['id']){delete _0x155ba1[_0x1bdf('0x5f')]['id'];}return db[_0x1bdf('0x42')][_0x1bdf('0x5d')]({'where':{'id':_0x155ba1['params']['id']}})['then'](handleEntityNotFound(_0x43b93c,null))[_0x1bdf('0x23')](function(_0x533fef){if(_0x533fef){_0x155ba1['body'][_0x1bdf('0x67')]=_0x533fef['id'];return db['CannedAnswer'][_0x1bdf('0x5e')](_0x155ba1[_0x1bdf('0x5f')]);}})[_0x1bdf('0x23')](respondWithResult(_0x43b93c,null))[_0x1bdf('0x2d')](handleError(_0x43b93c,null));};exports[_0x1bdf('0x6e')]=function(_0x3be617,_0x10b6a5,_0x183428){var _0x30ed15={'raw':![],'where':{}};var _0x71b8f7={};var _0x94481d={'count':0x0,'rows':[]};return db[_0x1bdf('0x42')][_0x1bdf('0x69')]({'where':{'id':_0x3be617['params']['id']}})['then'](handleEntityNotFound(_0x10b6a5,null))[_0x1bdf('0x23')](function(_0x5c379c){if(_0x5c379c){_0x71b8f7['model']=_['keys'](db['CannedAnswer'][_0x1bdf('0x43')]);_0x71b8f7[_0x1bdf('0x47')]=_[_0x1bdf('0x5c')](_0x3be617['query']);_0x71b8f7[_0x1bdf('0x48')]=_[_0x1bdf('0x49')](_0x71b8f7[_0x1bdf('0x46')],_0x71b8f7['query']);_0x30ed15[_0x1bdf('0x4a')]=_[_0x1bdf('0x49')](_0x71b8f7[_0x1bdf('0x46')],qs['fields'](_0x3be617[_0x1bdf('0x47')][_0x1bdf('0x4b')]));_0x30ed15[_0x1bdf('0x4a')]=_0x30ed15[_0x1bdf('0x4a')]['length']?_0x30ed15[_0x1bdf('0x4a')]:_0x71b8f7[_0x1bdf('0x46')];if(!_0x3be617['query'][_0x1bdf('0x4d')](_0x1bdf('0x4e'))){_0x30ed15[_0x1bdf('0x33')]=qs[_0x1bdf('0x33')](_0x3be617[_0x1bdf('0x47')][_0x1bdf('0x33')]);_0x30ed15['offset']=qs[_0x1bdf('0x31')](_0x3be617[_0x1bdf('0x47')][_0x1bdf('0x31')]);}_0x30ed15[_0x1bdf('0x4f')]=qs[_0x1bdf('0x50')](_0x3be617['query'][_0x1bdf('0x50')]);_0x30ed15[_0x1bdf('0x51')]=qs[_0x1bdf('0x48')](_[_0x1bdf('0x52')](_0x3be617[_0x1bdf('0x47')],_0x71b8f7[_0x1bdf('0x48')]));_0x30ed15['where'][_0x1bdf('0x67')]=_0x5c379c['id'];if(_0x3be617[_0x1bdf('0x47')][_0x1bdf('0x55')]){_0x30ed15[_0x1bdf('0x51')]=_[_0x1bdf('0x53')](_0x30ed15[_0x1bdf('0x51')],{'$or':_[_0x1bdf('0x41')](_0x30ed15[_0x1bdf('0x4a')],function(_0x15e90d){var _0x5ca39c={};_0x5ca39c[_0x15e90d]={'$like':'%'+_0x3be617['query'][_0x1bdf('0x55')]+'%'};return _0x5ca39c;})});}_0x30ed15=_['merge']({},_0x30ed15,_0x3be617['options']);return db[_0x1bdf('0x6f')][_0x1bdf('0x34')]({'where':_0x30ed15[_0x1bdf('0x51')]})['then'](function(_0x70a9d6){_0x94481d[_0x1bdf('0x34')]=_0x70a9d6;if(_0x3be617[_0x1bdf('0x47')]['includeAll']){_0x30ed15['include']=[{'all':!![]}];}return db[_0x1bdf('0x6f')][_0x1bdf('0x59')](_0x30ed15);})[_0x1bdf('0x23')](function(_0x360586){_0x94481d[_0x1bdf('0x5a')]=_0x360586;return _0x94481d;});}})[_0x1bdf('0x23')](respondWithFilteredResult(_0x10b6a5,_0x30ed15))['catch'](handleError(_0x10b6a5,null));};exports['removeAnswers']=function(_0xfff106,_0x2c32ba,_0x3cdbb5){return db[_0x1bdf('0x42')][_0x1bdf('0x5d')]({'where':{'id':_0xfff106[_0x1bdf('0x64')]['id']}})[_0x1bdf('0x23')](handleEntityNotFound(_0x2c32ba,null))[_0x1bdf('0x23')](function(_0x365b87){if(_0x365b87){return _0x365b87[_0x1bdf('0x70')](_0xfff106['query'][_0x1bdf('0x6c')]);}})[_0x1bdf('0x23')](respondWithStatusCode(_0x2c32ba,null))['catch'](handleError(_0x2c32ba,null));};exports[_0x1bdf('0x71')]=function(_0x50021e,_0xc57eb1,_0x5f0323){var _0x5a8fc1={'channel':_0x1bdf('0x72')};var _0x5766f4=[];var _0x34359d=[];var _0x28ce93={};return db[_0x1bdf('0x42')][_0x1bdf('0x5d')]({'where':{'id':_0x50021e[_0x1bdf('0x64')]['id']},'include':[{'model':db[_0x1bdf('0x73')],'as':_0x1bdf('0x74')}]})['then'](handleEntityNotFound(_0xc57eb1,null))['then'](function(_0x101158){_0x5a8fc1[_0x1bdf('0x75')]=_0x101158;_0x5a8fc1[_0x1bdf('0x76')]=_[_0x1bdf('0x77')](_0x101158[_0x1bdf('0x74')],['priority'],['asc']);if(_0x5a8fc1[_0x1bdf('0x75')][_0x1bdf('0x74')]){delete _0x5a8fc1[_0x1bdf('0x75')][_0x1bdf('0x74')];}return db[_0x1bdf('0x78')][_0x1bdf('0x65')]();})[_0x1bdf('0x23')](function(_0x486b11){if(!_0x486b11){throw new db[(_0x1bdf('0x79'))]['ValidationError']('no\x20available\x20attributes');}_0x5766f4=_['difference'](_[_0x1bdf('0x5c')](_0x486b11),[_0x1bdf('0x7a'),_0x1bdf('0x7b')]);_0x34359d=_[_0x1bdf('0x7c')](_[_0x1bdf('0x5c')](_0x486b11),[_0x1bdf('0x7a'),'updatedAt',_0x1bdf('0x7d'),_0x1bdf('0x7e')]);_0x5a8fc1[_0x1bdf('0x5f')]={'mapKey':_0x1bdf('0x7f')};if(_0x5a8fc1['account']['type']){switch(_0x5a8fc1[_0x1bdf('0x75')][_0x1bdf('0x80')]){case'twilio':_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x81')]=_0x50021e[_0x1bdf('0x5f')][_0x1bdf('0x82')];_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x5f')]=_0x50021e['body']['Body'];_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x83')]=_0x50021e[_0x1bdf('0x5f')][_0x1bdf('0x84')];break;case _0x1bdf('0x85'):_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x81')]='+'+_0x50021e[_0x1bdf('0x5f')][_0x1bdf('0x86')];_0x5a8fc1[_0x1bdf('0x5f')]['body']=_0x50021e[_0x1bdf('0x5f')][_0x1bdf('0x87')];break;case'connectel':_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x81')]=_0x50021e['body'][_0x1bdf('0x81')];_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x5f')]=_0x50021e[_0x1bdf('0x5f')]['message'];break;case _0x1bdf('0x88'):_0x5a8fc1['body'][_0x1bdf('0x81')]=_0x50021e['body']['from'];_0x5a8fc1['body'][_0x1bdf('0x5f')]=_0x50021e[_0x1bdf('0x5f')]['body'];_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x83')]=_0x50021e[_0x1bdf('0x5f')]['message_id'];break;case'plivo':_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x81')]=_0x50021e['body'][_0x1bdf('0x82')];_0x5a8fc1[_0x1bdf('0x5f')]['body']=_0x50021e[_0x1bdf('0x5f')]['Text'];_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x83')]=_0x50021e[_0x1bdf('0x5f')][_0x1bdf('0x89')];break;case _0x1bdf('0x8a'):_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x81')]='+'+_0x50021e[_0x1bdf('0x5f')]['results'][0x0][_0x1bdf('0x81')];_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x5f')]=_0x50021e[_0x1bdf('0x5f')]['results'][0x0]['text'];_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x83')]=_0x50021e[_0x1bdf('0x5f')][_0x1bdf('0x8b')][0x0][_0x1bdf('0x83')];break;case _0x1bdf('0x8c'):_0x5a8fc1['body'][_0x1bdf('0x81')]=_0x50021e[_0x1bdf('0x5f')][_0x1bdf('0x8d')];_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x5f')]=_0x50021e[_0x1bdf('0x5f')][_0x1bdf('0x8e')][_0x1bdf('0x2a')];break;case _0x1bdf('0x8f'):_0x5a8fc1['body'][_0x1bdf('0x81')]=_0x50021e['body'][_0x1bdf('0x90')];_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x5f')]=_0x50021e[_0x1bdf('0x5f')][_0x1bdf('0x87')];_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x83')]=_0x50021e['body'][_0x1bdf('0x91')];break;case _0x1bdf('0x92'):_0x5a8fc1[_0x1bdf('0x5f')]['messageId']=_0x50021e[_0x1bdf('0x5f')][0x0]['message']['id'];_0x5a8fc1['body'][_0x1bdf('0x81')]=_0x50021e[_0x1bdf('0x5f')][0x0][_0x1bdf('0x2a')][_0x1bdf('0x81')];_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x5f')]=_0x50021e[_0x1bdf('0x5f')][0x0]['message']['text'];break;case'intelepeer':_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x81')]=_0x50021e[_0x1bdf('0x5f')][_0x1bdf('0x81')];_0x5a8fc1['body'][_0x1bdf('0x5f')]=_0x50021e[_0x1bdf('0x5f')][_0x1bdf('0x2a')];_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x83')]=_0x50021e[_0x1bdf('0x5f')][_0x1bdf('0x93')];break;}}if(_0x5a8fc1['body']['id']){delete _0x5a8fc1[_0x1bdf('0x5f')]['id'];}if(_[_0x1bdf('0x94')](_0x5a8fc1['body'][_0x1bdf('0x81')])){throw new db[(_0x1bdf('0x79'))][(_0x1bdf('0x95'))](_0x1bdf('0x96'));}if(_[_0x1bdf('0x94')](_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x5f')])||_0x5a8fc1[_0x1bdf('0x5f')]['body']===''){throw new db[(_0x1bdf('0x79'))][(_0x1bdf('0x95'))](_0x1bdf('0x97'));}if(_[_0x1bdf('0x94')](_0x5a8fc1[_0x1bdf('0x5f')]['mapKey'])){throw new db['Sequelize'][(_0x1bdf('0x95'))](_0x1bdf('0x98')+_0x34359d);}if(!_[_0x1bdf('0x99')](_0x34359d,_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x9a')])){throw new db['Sequelize'][(_0x1bdf('0x95'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x34359d);}_0x28ce93[_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x9a')]]=_0x5a8fc1['body']['from'];return db[_0x1bdf('0x9b')][_0x1bdf('0x5d')]({'where':{'id':_0x5a8fc1[_0x1bdf('0x75')]['ListId']},'include':[{'model':db['CmContact'],'as':_0x1bdf('0x9c'),'where':_0x28ce93,'limit':0x1,'order':[['updatedAt','DESC']]}]});})['then'](handleEntityNotFound(_0xc57eb1,null))['then'](function(_0x492ba8){if(_0x492ba8){_0x5a8fc1[_0x1bdf('0x9d')]=_[_0x1bdf('0x9e')](_0x492ba8,[_0x1bdf('0x9c')]);if(_0x492ba8[_0x1bdf('0x9c')][_0x1bdf('0x4c')]){return _0x492ba8[_0x1bdf('0x9c')][0x0];}var _0x198993=_['defaults'](_0x5a8fc1['body'],{'firstName':_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x81')],'ListId':_0x492ba8['id']});_0x198993[_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x9a')]]=_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x81')];return db[_0x1bdf('0x78')][_0x1bdf('0x5e')](_0x198993,{'fields':_0x5766f4,'raw':!![]});}})['then'](handleEntityNotFound(_0xc57eb1,null))[_0x1bdf('0x23')](function(_0x22efcb){if(_0x22efcb){_0x5a8fc1[_0x1bdf('0x9f')]=_0x22efcb;var _0x458989={'ContactId':_0x22efcb['id'],'phone':_0x5a8fc1[_0x1bdf('0x5f')]['from'],'SmsAccountId':_0x50021e[_0x1bdf('0x64')]['id']};var _0x368410={'ContactId':_0x22efcb['id'],'SmsAccountId':_0x50021e['params']['id'],'closed':![]};return db[_0x1bdf('0xa0')][_0x1bdf('0x5d')]({'where':_0x368410})['then'](function(_0x3989c3){if(_0x3989c3){return[_0x3989c3,![]];}return db[_0x1bdf('0xa0')]['create'](_0x458989)['then'](function(_0x1441d7){return[_0x1441d7,!![]];});});}})[_0x1bdf('0xa1')](function(_0x3c099f,_0xf19944){_0x5a8fc1[_0x1bdf('0xa2')]=_0x3c099f['get']({'plain':!![]});_0x5a8fc1[_0x1bdf('0xa2')][_0x1bdf('0xa3')]=![];if(_0xf19944){if(_0x5a8fc1[_0x1bdf('0x75')]['autoclose']){_0x5a8fc1[_0x1bdf('0x76')]['push']({'id':0x0,'priority':_0x5a8fc1[_0x1bdf('0x76')][_0x1bdf('0x4c')]+0x1,'app':'close','appdata':_0x1bdf('0xa4'),'interval':_0x1bdf('0xa5')});}_0x5a8fc1[_0x1bdf('0xa2')]['created']=!![];}return db[_0x1bdf('0xa6')][_0x1bdf('0x5e')]({'phone':_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x81')],'messageId':_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x83')],'body':_0x5a8fc1[_0x1bdf('0x5f')]['body'],'SmsAccountId':_0x50021e['params']['id'],'SmsInteractionId':_0x3c099f['id'],'direction':'in','ContactId':_0x3c099f[_0x1bdf('0xa7')],'AttachmentId':_0x5a8fc1['body'][_0x1bdf('0xa8')]});})[_0x1bdf('0x23')](function(_0x168f20){_0x5a8fc1[_0x1bdf('0x2a')]=_0x168f20;if(_0x5a8fc1[_0x1bdf('0xa2')][_0x1bdf('0xa9')]){return db[_0x1bdf('0xaa')][_0x1bdf('0x5d')]({'attributes':['id','name'],'where':{'id':_0x5a8fc1[_0x1bdf('0xa2')][_0x1bdf('0xa9')]}})[_0x1bdf('0x23')](function(_0x1eda5b){if(_0x1eda5b){_0x5a8fc1[_0x1bdf('0x76')]['unshift']({'id':0x0,'priority':0x0,'app':_0x1bdf('0xab'),'appdata':_0x1eda5b[_0x1bdf('0x3d')]+','+(_0x5a8fc1[_0x1bdf('0x75')][_0x1bdf('0xac')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x1bdf('0xad'),'startRouting',_0x5a8fc1);});}return respondWithRpcPromise(_0x1bdf('0xad'),_0x1bdf('0xae'),_0x5a8fc1);})[_0x1bdf('0x23')](function(_0x238c2c){if(_0x238c2c){var _0x1fc76b=0xc8;var _0x5f19b3=_0x1bdf('0xaf');logger['info'](_0x1bdf('0xb0'),_0x5f19b3,_0x1fc76b,_0x1bdf('0xb1'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x5f19b3,_0x1fc76b,_0x1bdf('0xb1'),JSON[_0x1bdf('0x27')](_0x238c2c));if(_0x5a8fc1[_0x1bdf('0x75')][_0x1bdf('0x80')]===_0x1bdf('0xb2')){return _0xc57eb1[_0x1bdf('0x2e')](_0x1fc76b)[_0x1bdf('0xb3')](_0x1bdf('0xb4'),_0x1bdf('0xb5'))['send'](_0x1bdf('0xb6'));}else{return _0xc57eb1['status'](_0x1fc76b)[_0x1bdf('0x30')](_0x238c2c);}}})[_0x1bdf('0x2d')](handleError(_0xc57eb1,null));};exports[_0x1bdf('0xb7')]=function(_0x18ef53,_0x1c36b4){var _0x51889c=_0x18ef53[_0x1bdf('0x64')]['id'];var _0x2172e3=_0x18ef53[_0x1bdf('0x5f')];var _0x124ad3=0xc8;var _0x1ba35c=null;return db[_0x1bdf('0xb8')][_0x1bdf('0xb9')]({'isolationLevel':db[_0x1bdf('0xb8')]['Transaction']['ISOLATION_LEVELS'][_0x1bdf('0xba')]},function(_0x4cb17a){return db[_0x1bdf('0x42')]['findOne']({'where':{'id':_0x51889c},'transaction':_0x4cb17a})['then'](function(_0x492a63){if(_0x492a63){return db[_0x1bdf('0x73')][_0x1bdf('0x3a')]({'where':{'SmsAccountId':_0x51889c},'transaction':_0x4cb17a})['then'](function(){var _0x28df08=_[_0x1bdf('0x41')](_0x2172e3,function(_0x2ba1ba){_0x2ba1ba[_0x1bdf('0x67')]=_0x51889c;return _0x2ba1ba;});return db[_0x1bdf('0x73')][_0x1bdf('0xbb')](_0x28df08,{'transaction':_0x4cb17a});});}else{_0x124ad3=0x194;_0x1ba35c=[];}});})[_0x1bdf('0x23')](function(){if(_0x124ad3!==0x194){return db['SmsApplication']['findAndCountAll']({'where':{'SmsAccountId':_0x51889c},'order':_0x1bdf('0xbc')})[_0x1bdf('0x23')](function(_0x3bdf86){_0x1ba35c=_0x3bdf86;});}})[_0x1bdf('0x2d')](function(_0x505f66){_0x124ad3=0x1f4;logger[_0x1bdf('0x28')](_0x505f66[_0x1bdf('0xbd')]);if(_0x505f66[_0x1bdf('0x3d')]){delete _0x505f66[_0x1bdf('0x3d')];}_0x1ba35c=_0x505f66;})[_0x1bdf('0xbe')](function(){if(_0x1ba35c===null){_0x1c36b4[_0x1bdf('0xbf')](_0x124ad3);}else{if(_0x124ad3===0x1f4){_0x1c36b4[_0x1bdf('0x2e')](_0x124ad3)[_0x1bdf('0x3e')](_0x1ba35c);}else{_0x1c36b4[_0x1bdf('0x2e')](_0x124ad3)[_0x1bdf('0x30')](_0x1ba35c);}}});};exports['getApplications']=function(_0x490f37,_0x55a4cd,_0x70fcb6){var _0x395a7c={};var _0x281211={};var _0x1d1691;var _0x5670d9;return db[_0x1bdf('0x42')]['findOne']({'where':{'id':_0x490f37[_0x1bdf('0x64')]['id']}})[_0x1bdf('0x23')](handleEntityNotFound(_0x55a4cd,null))['then'](function(_0x5206d3){if(_0x5206d3){_0x1d1691=_0x5206d3;_0x281211['model']=_[_0x1bdf('0x5c')](db[_0x1bdf('0x73')]['rawAttributes']);_0x281211[_0x1bdf('0x47')]=_[_0x1bdf('0x5c')](_0x490f37[_0x1bdf('0x47')]);_0x281211[_0x1bdf('0x48')]=_['intersection'](_0x281211[_0x1bdf('0x46')],_0x281211[_0x1bdf('0x47')]);_0x395a7c[_0x1bdf('0x4a')]=_[_0x1bdf('0x49')](_0x281211[_0x1bdf('0x46')],qs[_0x1bdf('0x4b')](_0x490f37['query']['fields']));_0x395a7c[_0x1bdf('0x4a')]=_0x395a7c[_0x1bdf('0x4a')][_0x1bdf('0x4c')]?_0x395a7c[_0x1bdf('0x4a')]:_0x281211[_0x1bdf('0x46')];_0x395a7c[_0x1bdf('0x4f')]=qs[_0x1bdf('0x50')](_0x490f37[_0x1bdf('0x47')][_0x1bdf('0x50')]);_0x395a7c[_0x1bdf('0x51')]=qs[_0x1bdf('0x48')](_[_0x1bdf('0x52')](_0x490f37[_0x1bdf('0x47')],_0x281211[_0x1bdf('0x48')]));if(_0x490f37[_0x1bdf('0x47')][_0x1bdf('0x55')]){_0x395a7c[_0x1bdf('0x51')]=_['merge'](_0x395a7c[_0x1bdf('0x51')],{'$or':_[_0x1bdf('0x41')](_0x395a7c[_0x1bdf('0x4a')],function(_0x47bd4b){var _0x1413ee={};_0x1413ee[_0x47bd4b]={'$like':'%'+_0x490f37[_0x1bdf('0x47')][_0x1bdf('0x55')]+'%'};return _0x1413ee;})});}_0x395a7c=_[_0x1bdf('0x53')]({},_0x395a7c,_0x490f37[_0x1bdf('0x56')]);return _0x1d1691[_0x1bdf('0xc0')](_0x395a7c);}})[_0x1bdf('0x23')](function(_0x40f8f8){if(_0x40f8f8){_0x5670d9=_0x40f8f8[_0x1bdf('0x4c')];if(!_0x490f37[_0x1bdf('0x47')][_0x1bdf('0x4d')](_0x1bdf('0x4e'))){_0x395a7c[_0x1bdf('0x33')]=qs[_0x1bdf('0x33')](_0x490f37[_0x1bdf('0x47')][_0x1bdf('0x33')]);_0x395a7c[_0x1bdf('0x31')]=qs[_0x1bdf('0x31')](_0x490f37[_0x1bdf('0x47')][_0x1bdf('0x31')]);}return _0x1d1691[_0x1bdf('0xc0')](_0x395a7c);}})['then'](function(_0xccd69e){if(_0xccd69e){return _0xccd69e?{'count':_0x5670d9,'rows':_0xccd69e}:null;}})[_0x1bdf('0x23')](respondWithResult(_0x55a4cd,null))['catch'](handleError(_0x55a4cd,null));};exports[_0x1bdf('0xc1')]=function(_0x37e893,_0x48ca4d,_0x167c0f){var _0x3c47ad={'raw':![],'where':{}};var _0x1e0b00={};var _0x2af25b={'count':0x0,'rows':[]};return db[_0x1bdf('0x42')][_0x1bdf('0x69')]({'where':{'id':_0x37e893[_0x1bdf('0x64')]['id']}})[_0x1bdf('0x23')](handleEntityNotFound(_0x48ca4d,null))[_0x1bdf('0x23')](function(_0x57b960){if(_0x57b960){_0x1e0b00[_0x1bdf('0x46')]=_[_0x1bdf('0x5c')](db['SmsInteraction'][_0x1bdf('0x43')]);_0x1e0b00[_0x1bdf('0x47')]=_['keys'](_0x37e893['query']);_0x1e0b00['filters']=_[_0x1bdf('0x49')](_0x1e0b00[_0x1bdf('0x46')],_0x1e0b00[_0x1bdf('0x47')]);_0x3c47ad[_0x1bdf('0x4a')]=_[_0x1bdf('0x49')](_0x1e0b00[_0x1bdf('0x46')],qs[_0x1bdf('0x4b')](_0x37e893['query'][_0x1bdf('0x4b')]));_0x3c47ad['attributes']=_0x3c47ad[_0x1bdf('0x4a')][_0x1bdf('0x4c')]?_0x3c47ad[_0x1bdf('0x4a')]:_0x1e0b00[_0x1bdf('0x46')];if(!_0x37e893['query'][_0x1bdf('0x4d')](_0x1bdf('0x4e'))){_0x3c47ad['limit']=qs['limit'](_0x37e893['query'][_0x1bdf('0x33')]);_0x3c47ad['offset']=qs[_0x1bdf('0x31')](_0x37e893[_0x1bdf('0x47')][_0x1bdf('0x31')]);}_0x3c47ad[_0x1bdf('0x4f')]=qs[_0x1bdf('0x50')](_0x37e893[_0x1bdf('0x47')][_0x1bdf('0x50')]);_0x3c47ad[_0x1bdf('0x51')]=qs['filters'](_['pick'](_0x37e893[_0x1bdf('0x47')],_0x1e0b00[_0x1bdf('0x48')]));_0x3c47ad[_0x1bdf('0x51')]['SmsAccountId']=_0x57b960['id'];if(_0x37e893[_0x1bdf('0x47')][_0x1bdf('0x55')]){_0x3c47ad[_0x1bdf('0x51')]=_['merge'](_0x3c47ad['where'],{'$or':_[_0x1bdf('0x41')](_0x3c47ad['attributes'],function(_0x58cad1){var _0x56c69c={};_0x56c69c[_0x58cad1]={'$like':'%'+_0x37e893[_0x1bdf('0x47')][_0x1bdf('0x55')]+'%'};return _0x56c69c;})});}_0x3c47ad=_['merge']({},_0x3c47ad,_0x37e893[_0x1bdf('0x56')]);return db['SmsInteraction'][_0x1bdf('0x34')]({'where':_0x3c47ad[_0x1bdf('0x51')]})[_0x1bdf('0x23')](function(_0x1f2444){_0x2af25b[_0x1bdf('0x34')]=_0x1f2444;if(_0x37e893[_0x1bdf('0x47')][_0x1bdf('0x57')]){_0x3c47ad['include']=[{'model':db['CmContact'],'as':_0x1bdf('0xc2'),'required':![]},{'model':db[_0x1bdf('0xaa')],'as':'Owner','attributes':[_0x1bdf('0x3d'),'fullname','internal'],'required':![]},{'model':db[_0x1bdf('0xc3')],'as':_0x1bdf('0xc4'),'attributes':['id',_0x1bdf('0x3d'),_0x1bdf('0xc5')],'where':_0x37e893[_0x1bdf('0x47')][_0x1bdf('0xc6')]?{'id':_0x37e893['query'][_0x1bdf('0xc6')]}:undefined,'required':_0x37e893[_0x1bdf('0x47')]['tag']?!![]:![]}];}return db[_0x1bdf('0xa0')][_0x1bdf('0x59')](_0x3c47ad);})['then'](function(_0x405785){_0x2af25b[_0x1bdf('0x5a')]=_0x405785;return _0x2af25b;});}})['then'](respondWithFilteredResult(_0x48ca4d,_0x3c47ad))['catch'](handleError(_0x48ca4d,null));};exports[_0x1bdf('0x3e')]=function(_0x3c9fc1,_0x32f8f0,_0x215d9c){var _0x9b9088,_0x1d7358,_0x15075a;if(_['isNil'](_0x3c9fc1[_0x1bdf('0x5f')]['body'])||_0x3c9fc1[_0x1bdf('0x5f')][_0x1bdf('0x5f')]===''){throw new db[(_0x1bdf('0x79'))][(_0x1bdf('0x95'))](_0x1bdf('0x97'));}if(_[_0x1bdf('0x94')](_0x3c9fc1[_0x1bdf('0x5f')]['to'])){throw new db[(_0x1bdf('0x79'))]['ValidationError']('to\x20is\x20mandatory');}_0x9b9088=_0x3c9fc1[_0x1bdf('0x5f')]['to'];return db[_0x1bdf('0x42')][_0x1bdf('0x5d')]({'where':{'id':_0x3c9fc1[_0x1bdf('0x64')]['id']},'include':[{'model':db[_0x1bdf('0x9b')],'as':_0x1bdf('0xc7'),'include':[{'model':db[_0x1bdf('0x78')],'as':_0x1bdf('0x9c'),'where':{'mobile':_0x9b9088},'limit':0x1,'order':[[_0x1bdf('0x7b'),_0x1bdf('0xc8')]]}]}]})['then'](handleEntityNotFound(_0x32f8f0,null))[_0x1bdf('0x23')](function(_0x516b56){if(_0x516b56&&_0x516b56[_0x1bdf('0xc7')]){_0x1d7358=_0x516b56[_0x1bdf('0x3b')]({'plain':!![]});if(_0x1d7358[_0x1bdf('0xc7')]&&_0x1d7358[_0x1bdf('0xc7')][_0x1bdf('0x9c')]['length']){return _0x1d7358['List'][_0x1bdf('0x9c')][0x0];}return db[_0x1bdf('0x78')][_0x1bdf('0x5e')](_['defaults'](_0x3c9fc1[_0x1bdf('0x5f')],{'firstName':_0x9b9088,'mobile':_0x9b9088,'phone':_0x9b9088,'ListId':_0x1d7358[_0x1bdf('0x7e')]}));}})['then'](handleEntityNotFound(_0x32f8f0,null))[_0x1bdf('0x23')](function(_0x5251f6){if(_0x5251f6){_0x15075a=_0x5251f6;return db[_0x1bdf('0xa0')]['find']({'where':{'ContactId':_0x15075a['id'],'closed':![],'SmsAccountId':_0x1d7358['id']}})[_0x1bdf('0x23')](function(_0x3e9a4a){if(_0x3e9a4a){return[_0x3e9a4a,![]];}return db[_0x1bdf('0xa0')]['create']({'UserId':_0x3c9fc1[_0x1bdf('0x61')]['id'],'ContactId':_0x15075a['id'],'SmsAccountId':_0x1d7358['id'],'phone':_0x9b9088,'firstMsgDirection':'out','Messages':[_[_0x1bdf('0x53')](_0x3c9fc1['body'],{'read':![],'body':_0x3c9fc1[_0x1bdf('0x5f')]['body'],'phone':_0x9b9088,'SmsAccountId':_0x1d7358['id'],'UserId':_0x3c9fc1[_0x1bdf('0x61')]['id'],'ContactId':_0x15075a['id']})]},{'include':[{'model':db['SmsMessage'],'as':'Messages'}]})['then'](function(_0x11a8a4){return[_0x11a8a4,!![]];});});}})['spread'](function(_0x269fac,_0x44dbf4){if(_0x44dbf4){return _0x269fac;}return db[_0x1bdf('0xa6')]['create'](_[_0x1bdf('0x53')](_0x3c9fc1[_0x1bdf('0x5f')],{'read':![],'body':_0x3c9fc1[_0x1bdf('0x5f')]['body'],'phone':_0x9b9088,'SmsAccountId':_0x1d7358['id'],'SmsInteractionId':_0x269fac['id'],'UserId':_0x3c9fc1['user']['id'],'ContactId':_0x15075a['id']}))[_0x1bdf('0x23')](function(_0xbf4c21){_0x269fac[_0x1bdf('0xc9')][_0x1bdf('0xca')]=[];_0x269fac[_0x1bdf('0xc9')]['Messages'][_0x1bdf('0xcb')](_0xbf4c21[_0x1bdf('0xc9')]);return _0x269fac;});})['then'](respondWithResult(_0x32f8f0,null))[_0x1bdf('0x2d')](handleError(_0x32f8f0,null));};exports[_0x1bdf('0x2e')]=function(_0xdc17f4,_0xb00a86,_0xbddecd){if(_0xdc17f4[_0x1bdf('0x5f')]['id']){delete _0xdc17f4[_0x1bdf('0x5f')]['id'];}var _0x134951,_0x2042fc,_0x5c4299;return db[_0x1bdf('0x42')][_0x1bdf('0x5d')]({'where':{'id':_0xdc17f4['params']['id']}})[_0x1bdf('0x23')](handleEntityNotFound(_0xb00a86,null))[_0x1bdf('0x23')](function(_0x145054){if(_0x145054){_0x5c4299=_0x145054;logger[_0x1bdf('0x25')](_0x1bdf('0xb0'),_0x1bdf('0x2e'),_0x1bdf('0xcc'),_0x145054[_0x1bdf('0x80')],util[_0x1bdf('0xcd')](_0xdc17f4['body'],{'showHidden':![],'depth':null}));switch(_0x145054[_0x1bdf('0x80')]){case _0x1bdf('0x85'):if(_0xdc17f4[_0x1bdf('0x5f')][_0x1bdf('0xce')]&&_0xdc17f4[_0x1bdf('0x5f')][_0x1bdf('0x2e')]){_0x2042fc=_0xdc17f4[_0x1bdf('0x5f')][_0x1bdf('0x2e')];return db[_0x1bdf('0xa6')][_0x1bdf('0x5d')]({'where':{'messageId':_0xdc17f4[_0x1bdf('0x5f')][_0x1bdf('0xce')]}});}break;case _0x1bdf('0xcf'):if(_0xdc17f4[_0x1bdf('0x5f')][_0x1bdf('0xd0')]&&_0xdc17f4['body'][_0x1bdf('0xd1')]){_0x2042fc=_0xdc17f4[_0x1bdf('0x5f')][_0x1bdf('0xd1')];return db[_0x1bdf('0xa6')][_0x1bdf('0x5d')]({'where':{'messageId':_0xdc17f4[_0x1bdf('0x5f')][_0x1bdf('0xd0')]}});}break;case _0x1bdf('0x88'):if(_0xdc17f4[_0x1bdf('0x5f')][_0x1bdf('0xd2')]&&_0xdc17f4[_0x1bdf('0x5f')][_0x1bdf('0xd3')]){_0x2042fc=_0xdc17f4[_0x1bdf('0x5f')]['status_code'];return db[_0x1bdf('0xa6')][_0x1bdf('0x5d')]({'where':{'messageId':_0xdc17f4['body']['message_id']}});}break;case _0x1bdf('0x8a'):var _0x2c2b91=_0xdc17f4[_0x1bdf('0x5f')][_0x1bdf('0x8b')][0x0];if(_0x2c2b91[_0x1bdf('0x83')]&&_0x2c2b91[_0x1bdf('0x2e')][_0x1bdf('0xd4')]===_0x1bdf('0xd5')){_0x2042fc=_0x2c2b91[_0x1bdf('0x2e')][_0x1bdf('0xd4')];return db['SmsMessage']['find']({'where':{'messageId':_0x2c2b91[_0x1bdf('0x83')]}});}break;case _0x1bdf('0x8f'):if(_0xdc17f4[_0x1bdf('0x5f')][_0x1bdf('0x83')]&&_0xdc17f4[_0x1bdf('0x5f')][_0x1bdf('0x2e')]){_0x2042fc=_0xdc17f4[_0x1bdf('0x5f')][_0x1bdf('0x2e')];return db['SmsMessage'][_0x1bdf('0x5d')]({'where':{'messageId':_0xdc17f4['body']['messageId']}});}break;case _0x1bdf('0x92'):if(_0xdc17f4[_0x1bdf('0x5f')][0x0][_0x1bdf('0x2a')]['id']){_0x2042fc=_0xdc17f4['body'][0x0][_0x1bdf('0x80')];return db[_0x1bdf('0xa6')]['find']({'where':{'messageId':_0xdc17f4[_0x1bdf('0x5f')][0x0][_0x1bdf('0x2a')]['id']}});}break;case'intelepeer':if(_0xdc17f4[_0x1bdf('0x5f')][_0x1bdf('0xd6')]&&_0xdc17f4[_0x1bdf('0x5f')]['status']){_0x2042fc=_0xdc17f4['body']['status'];return db[_0x1bdf('0xa6')][_0x1bdf('0x5d')]({'where':{'messageId':_0xdc17f4[_0x1bdf('0x5f')][_0x1bdf('0xd6')]}});}break;}}})[_0x1bdf('0x23')](handleEntityNotFound(_0xb00a86,null))['then'](function(_0x142703){if(_0x142703){_0x134951=_0x142703;switch(_0x5c4299['type']){case _0x1bdf('0x85'):if(_0x2042fc===_0x1bdf('0xd5')){return _0x134951[_0x1bdf('0x39')]({'read':!![]});}else{logger[_0x1bdf('0x28')](_0x1bdf('0xb0'),_0x1bdf('0x2e'),_0x1bdf('0x85'),util[_0x1bdf('0xcd')](_0xdc17f4[_0x1bdf('0x5f')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x2042fc==='1'){return _0x134951[_0x1bdf('0x39')]({'read':!![]});}else{logger[_0x1bdf('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x1bdf('0x85'),util['inspect'](_0xdc17f4[_0x1bdf('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x1bdf('0x88'):if(!_0xdc17f4['body'][_0x1bdf('0xd7')]&&_0x2042fc>=0xc8&&_0x2042fc<=0xce){return _0x134951[_0x1bdf('0x39')]({'read':!![]});}else{logger[_0x1bdf('0x28')](_0x1bdf('0xb0'),'status','clicksend',util[_0x1bdf('0xcd')](_0xdc17f4[_0x1bdf('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x1bdf('0x8a'):var _0x578b83=_0xdc17f4[_0x1bdf('0x5f')][_0x1bdf('0x8b')][0x0];if(_0x578b83[_0x1bdf('0x2e')][_0x1bdf('0xd4')]===_0x1bdf('0xd5')){return _0x134951[_0x1bdf('0x39')]({'read':!![]});}else{logger[_0x1bdf('0x28')](_0x1bdf('0xb0'),_0x1bdf('0x2e'),_0x1bdf('0x8a'),util[_0x1bdf('0xcd')](_0xdc17f4[_0x1bdf('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x1bdf('0x8f'):if(_0x2042fc==_0x1bdf('0xd8')||_0x2042fc==_0x1bdf('0xd9')){return _0x134951[_0x1bdf('0x39')]({'read':!![]});}else{logger[_0x1bdf('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1bdf('0x2e'),_0x1bdf('0x8f'),util[_0x1bdf('0xcd')](_0xdc17f4[_0x1bdf('0x5f')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x2042fc==_0x1bdf('0xda')){return _0x134951[_0x1bdf('0x39')]({'read':!![]});}else{logger[_0x1bdf('0x28')](_0x1bdf('0xb0'),_0x1bdf('0x2e'),'bandwidth',util['inspect'](_0xdc17f4[_0x1bdf('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x1bdf('0xdb'):if(_0x2042fc===_0x1bdf('0xdc')||_0x2042fc==='ACCEPTD'){return _0x134951[_0x1bdf('0x39')]({'read':!![]});}else{logger[_0x1bdf('0x28')](_0x1bdf('0xb0'),_0x1bdf('0x2e'),_0x1bdf('0xdb'),util[_0x1bdf('0xcd')](_0xdc17f4[_0x1bdf('0x5f')],{'showHidden':![],'depth':null}));}break;}return _0x134951;}})['then'](respondWithResult(_0xb00a86,null))['catch'](handleError(_0xb00a86,null));};exports[_0x1bdf('0xdd')]=function(_0x3abcb8,_0x1ae5de,_0x213216){var _0x45eada,_0x20fe3f,_0x37e76f;return db[_0x1bdf('0x42')][_0x1bdf('0x5d')]({'where':{'id':_0x3abcb8['params']['id']}})[_0x1bdf('0x23')](handleEntityNotFound(_0x1ae5de,null))[_0x1bdf('0x23')](function(_0x5dc385){if(_0x5dc385){_0x37e76f=_0x5dc385;logger[_0x1bdf('0x25')](_0x1bdf('0xb0'),'status',_0x1bdf('0xcc'),_0x5dc385[_0x1bdf('0x80')],util['inspect'](_0x3abcb8[_0x1bdf('0x47')],{'showHidden':![],'depth':null}));switch(_0x5dc385[_0x1bdf('0x80')]){case _0x1bdf('0x8c'):if(_0x3abcb8['query'][_0x1bdf('0xde')]&&_0x3abcb8[_0x1bdf('0x47')][_0x1bdf('0xdf')]){_0x20fe3f=_0x3abcb8['query'][_0x1bdf('0xdf')];return db[_0x1bdf('0xa6')][_0x1bdf('0x5d')]({'where':{'messageId':_0x3abcb8[_0x1bdf('0x47')][_0x1bdf('0xde')]}});}break;}}})[_0x1bdf('0x23')](handleEntityNotFound(_0x1ae5de,null))[_0x1bdf('0x23')](function(_0x20939f){if(_0x20939f){_0x45eada=_0x20939f;switch(_0x37e76f[_0x1bdf('0x80')]){case _0x1bdf('0x8c'):if(_0x20fe3f==='2'||_0x20fe3f==='6'){return _0x45eada[_0x1bdf('0x39')]({'read':!![]});}else{logger[_0x1bdf('0x28')](_0x1bdf('0xb0'),_0x1bdf('0x2e'),_0x1bdf('0x8c'),util[_0x1bdf('0xcd')](_0x3abcb8['query'],{'showHidden':![],'depth':null}));};break;}return _0x45eada;}})[_0x1bdf('0x23')](respondWithResult(_0x1ae5de,null))[_0x1bdf('0x2d')](handleError(_0x1ae5de,null));};exports[_0x1bdf('0xe0')]=function(_0x4206a6,_0x247765,_0x55789f){return db[_0x1bdf('0x42')]['find']({'where':{'id':_0x4206a6['params']['id']}})['then'](handleEntityNotFound(_0x247765,null))[_0x1bdf('0x23')](function(_0x1cb7bc){if(_0x1cb7bc){return _0x1cb7bc[_0x1bdf('0xe0')](_0x4206a6[_0x1bdf('0x5f')][_0x1bdf('0x6c')],_[_0x1bdf('0x9e')](_0x4206a6[_0x1bdf('0x5f')],[_0x1bdf('0x6c'),'id'])||{})[_0x1bdf('0xa1')](function(_0x2ffd2b){for(var _0x24d9c9=0x0;_0x24d9c9<_0x4206a6[_0x1bdf('0x5f')][_0x1bdf('0x6c')][_0x1bdf('0x4c')];_0x24d9c9+=0x1){socket[_0x1bdf('0xe1')]('userSmsAccount:save',{'UserId':Number(_0x4206a6[_0x1bdf('0x5f')][_0x1bdf('0x6c')][_0x24d9c9]),'SmsAccountId':Number(_0x4206a6[_0x1bdf('0x64')]['id'])});}return _0x2ffd2b;});}})[_0x1bdf('0x23')](respondWithResult(_0x247765,null))[_0x1bdf('0x2d')](handleError(_0x247765,null));};exports[_0x1bdf('0xe2')]=function(_0x3e6756,_0x32978b,_0x25aa5d){return db[_0x1bdf('0x42')][_0x1bdf('0x5d')]({'where':{'id':_0x3e6756['params']['id']}})[_0x1bdf('0x23')](handleEntityNotFound(_0x32978b,null))[_0x1bdf('0x23')](function(_0x48beb9){if(_0x48beb9){return _0x48beb9[_0x1bdf('0xe2')](_0x3e6756[_0x1bdf('0x47')]['ids'])[_0x1bdf('0x23')](function(){if(_[_0x1bdf('0xe3')](_0x3e6756['query'][_0x1bdf('0x6c')])){for(var _0x28f580=0x0;_0x28f580<_0x3e6756[_0x1bdf('0x47')][_0x1bdf('0x6c')][_0x1bdf('0x4c')];_0x28f580+=0x1){socket[_0x1bdf('0xe1')](_0x1bdf('0xe4'),{'UserId':Number(_0x3e6756[_0x1bdf('0x47')][_0x1bdf('0x6c')][_0x28f580]),'SmsAccountId':Number(_0x3e6756[_0x1bdf('0x64')]['id'])});}}else{socket[_0x1bdf('0xe1')](_0x1bdf('0xe4'),{'UserId':Number(_0x3e6756[_0x1bdf('0x47')][_0x1bdf('0x6c')]),'SmsAccountId':Number(_0x3e6756[_0x1bdf('0x64')]['id'])});}});}})[_0x1bdf('0x23')](respondWithStatusCode(_0x32978b,null))[_0x1bdf('0x2d')](handleError(_0x32978b,null));};exports[_0x1bdf('0xe5')]=function(_0x30abc2,_0x2cfcce,_0x1716a8){var _0x24392b={};var _0x5941be={};var _0x1f2a99;var _0x4f47a0;return db[_0x1bdf('0x42')][_0x1bdf('0x69')]({'where':{'id':_0x30abc2[_0x1bdf('0x64')]['id']}})[_0x1bdf('0x23')](handleEntityNotFound(_0x2cfcce,null))[_0x1bdf('0x23')](function(_0x3cad28){if(_0x3cad28){_0x1f2a99=_0x3cad28;_0x5941be[_0x1bdf('0x46')]=_[_0x1bdf('0x5c')](db[_0x1bdf('0xaa')]['rawAttributes']);_0x5941be['query']=_['keys'](_0x30abc2[_0x1bdf('0x47')]);_0x5941be[_0x1bdf('0x48')]=_['intersection'](_0x5941be[_0x1bdf('0x46')],_0x5941be[_0x1bdf('0x47')]);_0x24392b[_0x1bdf('0x4a')]=_[_0x1bdf('0x49')](_0x5941be[_0x1bdf('0x46')],qs['fields'](_0x30abc2[_0x1bdf('0x47')]['fields']));_0x24392b[_0x1bdf('0x4a')]=_0x24392b[_0x1bdf('0x4a')]['length']?_0x24392b[_0x1bdf('0x4a')]:_0x5941be[_0x1bdf('0x46')];_0x24392b['order']=qs['sort'](_0x30abc2['query']['sort']);_0x24392b['where']=qs[_0x1bdf('0x48')](_[_0x1bdf('0x52')](_0x30abc2[_0x1bdf('0x47')],_0x5941be['filters']));if(_0x30abc2[_0x1bdf('0x47')][_0x1bdf('0x55')]){_0x24392b[_0x1bdf('0x51')]=_[_0x1bdf('0x53')](_0x24392b[_0x1bdf('0x51')],{'$or':_[_0x1bdf('0x41')](_0x24392b['attributes'],function(_0x4c16c5){var _0x2565fd={};_0x2565fd[_0x4c16c5]={'$like':'%'+_0x30abc2[_0x1bdf('0x47')][_0x1bdf('0x55')]+'%'};return _0x2565fd;})});}_0x24392b=_['merge']({},_0x24392b,_0x30abc2[_0x1bdf('0x56')]);return _0x1f2a99[_0x1bdf('0xe5')](_0x24392b);}})[_0x1bdf('0x23')](function(_0x576302){if(_0x576302){_0x4f47a0=_0x576302[_0x1bdf('0x4c')];if(!_0x30abc2[_0x1bdf('0x47')]['hasOwnProperty'](_0x1bdf('0x4e'))){_0x24392b['limit']=qs[_0x1bdf('0x33')](_0x30abc2[_0x1bdf('0x47')][_0x1bdf('0x33')]);_0x24392b[_0x1bdf('0x31')]=qs[_0x1bdf('0x31')](_0x30abc2[_0x1bdf('0x47')][_0x1bdf('0x31')]);}return _0x1f2a99[_0x1bdf('0xe5')](_0x24392b);}})[_0x1bdf('0x23')](function(_0x303110){if(_0x303110){return _0x303110?{'count':_0x4f47a0,'rows':_0x303110}:null;}})[_0x1bdf('0x23')](respondWithResult(_0x2cfcce,null))[_0x1bdf('0x2d')](handleError(_0x2cfcce,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 1c451a9..fdc9923 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 _0x5284=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0xfdfe03,_0x2aaa1e){var _0x58f88a=function(_0x560bff){while(--_0x560bff){_0xfdfe03['push'](_0xfdfe03['shift']());}};_0x58f88a(++_0x2aaa1e);}(_0x5284,0xf0));var _0x4528=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x5284[_0xefd519];return _0x4bb882;};'use strict';var EventEmitter=require(_0x4528('0x0'));var SmsAccount=require(_0x4528('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x4528('0x2')](0x0);var events={'afterCreate':_0x4528('0x3'),'afterUpdate':'update','afterDestroy':_0x4528('0x4')};function emitEvent(_0x5651f8){return function(_0x1f382e,_0x3286bf,_0x364b72){SmsAccountEvents[_0x4528('0x5')](_0x5651f8+':'+_0x1f382e['id'],_0x1f382e);SmsAccountEvents[_0x4528('0x5')](_0x5651f8,_0x1f382e);_0x364b72(null);};}for(var e in events){if(events[_0x4528('0x6')](e)){var event=events[e];SmsAccount[_0x4528('0x7')](e,emitEvent(event));}}module[_0x4528('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0x045b=['hook','exports','events','../../mysqldb','SmsAccount','setMaxListeners','save','update','remove','emit'];(function(_0x26a792,_0x94d0f){var _0x4471b6=function(_0xfadd8d){while(--_0xfadd8d){_0x26a792['push'](_0x26a792['shift']());}};_0x4471b6(++_0x94d0f);}(_0x045b,0x17e));var _0xb045=function(_0x43e4b3,_0x1444de){_0x43e4b3=_0x43e4b3-0x0;var _0x10c655=_0x045b[_0x43e4b3];return _0x10c655;};'use strict';var EventEmitter=require(_0xb045('0x0'));var SmsAccount=require(_0xb045('0x1'))['db'][_0xb045('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xb045('0x3')](0x0);var events={'afterCreate':_0xb045('0x4'),'afterUpdate':_0xb045('0x5'),'afterDestroy':_0xb045('0x6')};function emitEvent(_0x43cf33){return function(_0x160de6,_0x1403a6,_0x206579){SmsAccountEvents[_0xb045('0x7')](_0x43cf33+':'+_0x160de6['id'],_0x160de6);SmsAccountEvents[_0xb045('0x7')](_0x43cf33,_0x160de6);_0x206579(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0xb045('0x8')](e,emitEvent(event));}}module[_0xb045('0x9')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 95850ea..1606f5b 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 _0xd48d=['exports','define','SmsAccount','sms_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes'];(function(_0xa1c4e3,_0x1040ad){var _0xefb131=function(_0x5b432c){while(--_0x5b432c){_0xa1c4e3['push'](_0xa1c4e3['shift']());}};_0xefb131(++_0x1040ad);}(_0xd48d,0x17b));var _0xdd48=function(_0x5197d0,_0x319251){_0x5197d0=_0x5197d0-0x0;var _0x2a4513=_0xd48d[_0x5197d0];return _0x2a4513;};'use strict';var _=require(_0xdd48('0x0'));var util=require(_0xdd48('0x1'));var logger=require(_0xdd48('0x2'))(_0xdd48('0x3'));var moment=require(_0xdd48('0x4'));var BPromise=require(_0xdd48('0x5'));var rp=require(_0xdd48('0x6'));var fs=require('fs');var path=require(_0xdd48('0x7'));var rimraf=require(_0xdd48('0x8'));var config=require(_0xdd48('0x9'));var attributes=require(_0xdd48('0xa'));module[_0xdd48('0xb')]=function(_0x1d3083,_0x13df31){return _0x1d3083[_0xdd48('0xc')](_0xdd48('0xd'),attributes,{'tableName':_0xdd48('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8a6b=['rimraf','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x230d1c,_0x3a56df){var _0x2128e3=function(_0x1a8f86){while(--_0x1a8f86){_0x230d1c['push'](_0x230d1c['shift']());}};_0x2128e3(++_0x3a56df);}(_0x8a6b,0x180));var _0xb8a6=function(_0x3bc029,_0x50dddd){_0x3bc029=_0x3bc029-0x0;var _0x59e3fd=_0x8a6b[_0x3bc029];return _0x59e3fd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb8a6('0x0'))(_0xb8a6('0x1'));var moment=require(_0xb8a6('0x2'));var BPromise=require(_0xb8a6('0x3'));var rp=require(_0xb8a6('0x4'));var fs=require('fs');var path=require(_0xb8a6('0x5'));var rimraf=require(_0xb8a6('0x6'));var config=require(_0xb8a6('0x7'));var attributes=require(_0xb8a6('0x8'));module[_0xb8a6('0x9')]=function(_0x6e4cda,_0x5abdd5){return _0x6e4cda[_0xb8a6('0xa')](_0xb8a6('0xb'),attributes,{'tableName':_0xb8a6('0xc'),'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 25a8919..64deeb7 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 _0xb437=['info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','SmsAccount','options','raw','where','attributes','map','include','model','ShowSmsAccount','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','defaults','localhost','socket.io-emitter','redis','./smsAccount.socket','request','then'];(function(_0x3152cc,_0x49a1b2){var _0x563e8c=function(_0x452fcf){while(--_0x452fcf){_0x3152cc['push'](_0x3152cc['shift']());}};_0x563e8c(++_0x49a1b2);}(_0xb437,0x145));var _0x7b43=function(_0x208dd9,_0x2140b0){_0x208dd9=_0x208dd9-0x0;var _0x1295ab=_0xb437[_0x208dd9];return _0x1295ab;};'use strict';var _=require('lodash');var util=require(_0x7b43('0x0'));var moment=require(_0x7b43('0x1'));var BPromise=require(_0x7b43('0x2'));var rs=require(_0x7b43('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7b43('0x4'));var logger=require(_0x7b43('0x5'))(_0x7b43('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7b43('0x7')]['http']({'port':0x232a});config['redis']=_[_0x7b43('0x8')](config['redis'],{'host':_0x7b43('0x9'),'port':0x18eb});var socket=require(_0x7b43('0xa'))(new Redis(config[_0x7b43('0xb')]));require(_0x7b43('0xc'))['register'](socket);function respondWithRpcPromise(_0x298c77,_0x529be5,_0x28dc59){return new BPromise(function(_0x2b1b60,_0xa60880){return client[_0x7b43('0xd')](_0x298c77,_0x28dc59)[_0x7b43('0xe')](function(_0x28d742){logger[_0x7b43('0xf')](_0x7b43('0x10'),_0x529be5,_0x7b43('0x11'));logger[_0x7b43('0x12')](_0x7b43('0x13'),_0x529be5,_0x7b43('0x11'),JSON[_0x7b43('0x14')](_0x28d742));if(_0x28d742[_0x7b43('0x15')]){if(_0x28d742[_0x7b43('0x15')][_0x7b43('0x16')]===0x1f4){logger[_0x7b43('0x15')]('SmsAccount,\x20%s,\x20%s',_0x529be5,_0x28d742[_0x7b43('0x15')][_0x7b43('0x17')]);return _0xa60880(_0x28d742[_0x7b43('0x15')][_0x7b43('0x17')]);}logger[_0x7b43('0x15')](_0x7b43('0x10'),_0x529be5,_0x28d742[_0x7b43('0x15')][_0x7b43('0x17')]);return _0x2b1b60(_0x28d742[_0x7b43('0x15')][_0x7b43('0x17')]);}else{logger['info'](_0x7b43('0x10'),_0x529be5,_0x7b43('0x11'));_0x2b1b60(_0x28d742['result'][_0x7b43('0x17')]);}})[_0x7b43('0x18')](function(_0x291e77){logger[_0x7b43('0x15')]('SmsAccount,\x20%s,\x20%s',_0x529be5,_0x291e77);_0xa60880(_0x291e77);});});}exports['ShowSmsAccount']=function(_0xeb8560){var _0x2cfb8a=this;return new Promise(function(_0x409ae5,_0x1878fc){return db[_0x7b43('0x19')]['find']({'raw':_0xeb8560['options']?_0xeb8560[_0x7b43('0x1a')][_0x7b43('0x1b')]===undefined?!![]:![]:!![],'where':_0xeb8560[_0x7b43('0x1a')]?_0xeb8560['options'][_0x7b43('0x1c')]||null:null,'attributes':_0xeb8560[_0x7b43('0x1a')]?_0xeb8560[_0x7b43('0x1a')][_0x7b43('0x1d')]||null:null,'include':_0xeb8560['options']?_0xeb8560[_0x7b43('0x1a')]['include']?_[_0x7b43('0x1e')](_0xeb8560[_0x7b43('0x1a')]['include'],function(_0x48bfbb){return{'model':db[_0x48bfbb['model']],'as':_0x48bfbb['as'],'attributes':_0x48bfbb[_0x7b43('0x1d')],'include':_0x48bfbb['include']?_[_0x7b43('0x1e')](_0x48bfbb['include'],function(_0x28405a){return{'model':db[_0x28405a['model']],'as':_0x28405a['as'],'attributes':_0x28405a[_0x7b43('0x1d')],'include':_0x28405a[_0x7b43('0x1f')]?_['map'](_0x28405a[_0x7b43('0x1f')],function(_0x4b75e1){return{'model':db[_0x4b75e1[_0x7b43('0x20')]],'as':_0x4b75e1['as'],'attributes':_0x4b75e1[_0x7b43('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x44caa1){logger[_0x7b43('0xf')](_0x7b43('0x21'),_0xeb8560);logger[_0x7b43('0x12')]('ShowSmsAccount',_0xeb8560,JSON[_0x7b43('0x14')](_0x44caa1));_0x409ae5(_0x44caa1);})['catch'](function(_0x13e68d){logger[_0x7b43('0x15')](_0x7b43('0x21'),_0x13e68d[_0x7b43('0x17')],_0xeb8560);_0x1878fc(_0x2cfb8a[_0x7b43('0x15')](0x1f4,_0x13e68d[_0x7b43('0x17')]));});});}; \ No newline at end of file +var _0x5961=['include','map','ShowSmsAccount','debug','lodash','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','SmsAccount','find','options','where','attributes','model'];(function(_0x35c5a8,_0x8ecb48){var _0x34782c=function(_0x1b23ec){while(--_0x1b23ec){_0x35c5a8['push'](_0x35c5a8['shift']());}};_0x34782c(++_0x8ecb48);}(_0x5961,0x64));var _0x1596=function(_0x4d79bc,_0x32c905){_0x4d79bc=_0x4d79bc-0x0;var _0x4b4760=_0x5961[_0x4d79bc];return _0x4b4760;};'use strict';var _=require(_0x1596('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1596('0x1'));var rs=require(_0x1596('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1596('0x3'))('rpc');var config=require(_0x1596('0x4'));var jayson=require(_0x1596('0x5'));var client=jayson['client'][_0x1596('0x6')]({'port':0x232a});config[_0x1596('0x7')]=_[_0x1596('0x8')](config['redis'],{'host':_0x1596('0x9'),'port':0x18eb});var socket=require(_0x1596('0xa'))(new Redis(config['redis']));require('./smsAccount.socket')[_0x1596('0xb')](socket);function respondWithRpcPromise(_0x98edd9,_0x511916,_0x5d5e32){return new BPromise(function(_0x22e159,_0x50ee9b){return client[_0x1596('0xc')](_0x98edd9,_0x5d5e32)[_0x1596('0xd')](function(_0x581671){logger[_0x1596('0xe')](_0x1596('0xf'),_0x511916,_0x1596('0x10'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x511916,'request\x20sent',JSON[_0x1596('0x11')](_0x581671));if(_0x581671['error']){if(_0x581671[_0x1596('0x12')]['code']===0x1f4){logger['error'](_0x1596('0xf'),_0x511916,_0x581671[_0x1596('0x12')][_0x1596('0x13')]);return _0x50ee9b(_0x581671[_0x1596('0x12')][_0x1596('0x13')]);}logger[_0x1596('0x12')](_0x1596('0xf'),_0x511916,_0x581671['error'][_0x1596('0x13')]);return _0x22e159(_0x581671[_0x1596('0x12')][_0x1596('0x13')]);}else{logger['info'](_0x1596('0xf'),_0x511916,_0x1596('0x10'));_0x22e159(_0x581671[_0x1596('0x14')][_0x1596('0x13')]);}})[_0x1596('0x15')](function(_0x2e4072){logger[_0x1596('0x12')](_0x1596('0xf'),_0x511916,_0x2e4072);_0x50ee9b(_0x2e4072);});});}exports['ShowSmsAccount']=function(_0x499092){var _0x3e4c02=this;return new Promise(function(_0x3593c6,_0x550dac){return db[_0x1596('0x16')][_0x1596('0x17')]({'raw':_0x499092[_0x1596('0x18')]?_0x499092[_0x1596('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x499092[_0x1596('0x18')]?_0x499092[_0x1596('0x18')][_0x1596('0x19')]||null:null,'attributes':_0x499092[_0x1596('0x18')]?_0x499092[_0x1596('0x18')][_0x1596('0x1a')]||null:null,'include':_0x499092[_0x1596('0x18')]?_0x499092['options']['include']?_['map'](_0x499092[_0x1596('0x18')]['include'],function(_0x2fbb56){return{'model':db[_0x2fbb56[_0x1596('0x1b')]],'as':_0x2fbb56['as'],'attributes':_0x2fbb56[_0x1596('0x1a')],'include':_0x2fbb56[_0x1596('0x1c')]?_[_0x1596('0x1d')](_0x2fbb56['include'],function(_0x3d57c3){return{'model':db[_0x3d57c3[_0x1596('0x1b')]],'as':_0x3d57c3['as'],'attributes':_0x3d57c3[_0x1596('0x1a')],'include':_0x3d57c3[_0x1596('0x1c')]?_[_0x1596('0x1d')](_0x3d57c3['include'],function(_0x986910){return{'model':db[_0x986910[_0x1596('0x1b')]],'as':_0x986910['as'],'attributes':_0x986910['attributes']};}):[]};}):[]};}):[]:[]})[_0x1596('0xd')](function(_0x2e0449){logger['info'](_0x1596('0x1e'),_0x499092);logger[_0x1596('0x1f')](_0x1596('0x1e'),_0x499092,JSON['stringify'](_0x2e0449));_0x3593c6(_0x2e0449);})[_0x1596('0x15')](function(_0x13d69f){logger[_0x1596('0x12')](_0x1596('0x1e'),_0x13d69f[_0x1596('0x13')],_0x499092);_0x550dac(_0x3e4c02[_0x1596('0x12')](0x1f4,_0x13d69f['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index c0bfa08..fa492b3 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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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 6e561f2..65ef040 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 _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'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 +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(_0x1683db,_0x8d3cb9){var _0x46f5f1=function(_0x1f59b8){while(--_0x1f59b8){_0x1683db['push'](_0x1683db['shift']());}};_0x46f5f1(++_0x8d3cb9);}(_0xedd9,0xfc));var _0x9edd=function(_0x5426af,_0x50755c){_0x5426af=_0x5426af-0x0;var _0x290f15=_0xedd9[_0x5426af];return _0x290f15;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0xe')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['put'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 529baa2..caf2d22 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 _0xee13=['STRING','noop','TEXT','*,*,*,*','INTEGER'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xee13,0x1f3));var _0x3ee1=function(_0x3becab,_0x48b640){_0x3becab=_0x3becab-0x0;var _0x436789=_0xee13[_0x3becab];return _0x436789;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x3ee1('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x3ee1('0x1')],'allowNull':![],'defaultValue':_0x3ee1('0x2')},'appdata':{'type':Sequelize[_0x3ee1('0x3')]()},'description':{'type':Sequelize[_0x3ee1('0x1')]},'interval':{'type':Sequelize[_0x3ee1('0x1')],'defaultValue':_0x3ee1('0x4')}}; \ No newline at end of file +var _0x2b86=['sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x5508db,_0x22ecbe){var _0x54ce94=function(_0x389047){while(--_0x389047){_0x5508db['push'](_0x5508db['shift']());}};_0x54ce94(++_0x22ecbe);}(_0x2b86,0x9c));var _0x62b8=function(_0x4a355b,_0x7ec0a5){_0x4a355b=_0x4a355b-0x0;var _0xd6c766=_0x2b86[_0x4a355b];return _0xd6c766;};'use strict';var Sequelize=require(_0x62b8('0x0'));module[_0x62b8('0x1')]={'priority':{'type':Sequelize[_0x62b8('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x62b8('0x3')],'allowNull':![],'defaultValue':_0x62b8('0x4')},'appdata':{'type':Sequelize[_0x62b8('0x5')]()},'description':{'type':Sequelize[_0x62b8('0x3')]},'interval':{'type':Sequelize[_0x62b8('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index af334f6..1c2ae52 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 _0xefa5=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','save','update','then','destroy','error','stack','name','index','map','SmsApplication','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','keys','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','sox','to-csv','ejs','fs-extra','crypto','desk.js'];(function(_0x5b474c,_0x53a6e5){var _0x6f3112=function(_0x245c03){while(--_0x245c03){_0x5b474c['push'](_0x5b474c['shift']());}};_0x6f3112(++_0x53a6e5);}(_0xefa5,0xc3));var _0x5efa=function(_0x2b55fa,_0x4db49a){_0x2b55fa=_0x2b55fa-0x0;var _0xd0ceff=_0xefa5[_0x2b55fa];return _0xd0ceff;};'use strict';var emlformat=require(_0x5efa('0x0'));var rimraf=require(_0x5efa('0x1'));var zipdir=require(_0x5efa('0x2'));var jsonpatch=require(_0x5efa('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5efa('0x4'));var util=require(_0x5efa('0x5'));var path=require('path');var sox=require(_0x5efa('0x6'));var csv=require(_0x5efa('0x7'));var ejs=require(_0x5efa('0x8'));var fs=require('fs');var fs_extra=require(_0x5efa('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5efa('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x5efa('0xb'));var toCsv=require(_0x5efa('0x7'));var querystring=require(_0x5efa('0xc'));var Papa=require(_0x5efa('0xd'));var Redis=require('ioredis');var authService=require(_0x5efa('0xe'));var qs=require(_0x5efa('0xf'));var as=require(_0x5efa('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5efa('0x11'));var utils=require(_0x5efa('0x12'));var config=require(_0x5efa('0x13'));var licenseUtil=require(_0x5efa('0x14'));var db=require(_0x5efa('0x15'))['db'];function respondWithStatusCode(_0x1a8e62,_0x146e6e){_0x146e6e=_0x146e6e||0xcc;return function(_0x51a659){if(_0x51a659){return _0x1a8e62[_0x5efa('0x16')](_0x146e6e);}return _0x1a8e62[_0x5efa('0x17')](_0x146e6e)[_0x5efa('0x18')]();};}function respondWithResult(_0x171b06,_0x5a36e8){_0x5a36e8=_0x5a36e8||0xc8;return function(_0x259c02){if(_0x259c02){return _0x171b06[_0x5efa('0x17')](_0x5a36e8)['json'](_0x259c02);}};}function respondWithFilteredResult(_0x53bfe0,_0x3a0ad3){return function(_0xfbf2eb){if(_0xfbf2eb){var _0x2b37db=typeof _0x3a0ad3[_0x5efa('0x19')]===_0x5efa('0x1a')&&typeof _0x3a0ad3[_0x5efa('0x1b')]===_0x5efa('0x1a');var _0x6137b3=_0xfbf2eb['count'];var _0xec3bf7=_0x2b37db?0x0:_0x3a0ad3[_0x5efa('0x19')];var _0x1d6ea8=_0x2b37db?_0xfbf2eb['count']:_0x3a0ad3[_0x5efa('0x19')]+_0x3a0ad3[_0x5efa('0x1b')];var _0x1fc99e;if(_0x1d6ea8>=_0x6137b3){_0x1d6ea8=_0x6137b3;_0x1fc99e=0xc8;}else{_0x1fc99e=0xce;}_0x53bfe0['status'](_0x1fc99e);return _0x53bfe0[_0x5efa('0x1c')]('Content-Range',_0xec3bf7+'-'+_0x1d6ea8+'/'+_0x6137b3)['json'](_0xfbf2eb);}return null;};}function patchUpdates(_0x25760f){return function(_0x1a2246){try{jsonpatch['apply'](_0x1a2246,_0x25760f,!![]);}catch(_0x11e5d3){return BPromise['reject'](_0x11e5d3);}return _0x1a2246[_0x5efa('0x1d')]();};}function saveUpdates(_0x24038d,_0x5843a5){return function(_0x3a90a2){if(_0x3a90a2){return _0x3a90a2[_0x5efa('0x1e')](_0x24038d)[_0x5efa('0x1f')](function(_0x495e18){return _0x495e18;});}return null;};}function removeEntity(_0x376246,_0x2eb242){return function(_0x4b8074){if(_0x4b8074){return _0x4b8074[_0x5efa('0x20')]()[_0x5efa('0x1f')](function(){_0x376246['status'](0xcc)[_0x5efa('0x18')]();});}};}function handleEntityNotFound(_0x5a3a3a,_0x3fd38e){return function(_0x20ae5f){if(!_0x20ae5f){_0x5a3a3a['sendStatus'](0x194);}return _0x20ae5f;};}function handleError(_0x13d196,_0x3a24e1){_0x3a24e1=_0x3a24e1||0x1f4;return function(_0x33f487){logger[_0x5efa('0x21')](_0x33f487[_0x5efa('0x22')]);if(_0x33f487[_0x5efa('0x23')]){delete _0x33f487[_0x5efa('0x23')];}_0x13d196[_0x5efa('0x17')](_0x3a24e1)['send'](_0x33f487);};}exports[_0x5efa('0x24')]=function(_0x24eb5c,_0x438ef3){var _0x200413={},_0x3111d6={},_0x5b5693={'count':0x0,'rows':[]};var _0x2218ef=_[_0x5efa('0x25')](db[_0x5efa('0x26')][_0x5efa('0x27')],function(_0x7cc34f){return{'name':_0x7cc34f[_0x5efa('0x28')],'type':_0x7cc34f['type'][_0x5efa('0x29')]};});_0x3111d6[_0x5efa('0x2a')]=_[_0x5efa('0x25')](_0x2218ef,_0x5efa('0x23'));_0x3111d6[_0x5efa('0x2b')]=_['keys'](_0x24eb5c[_0x5efa('0x2b')]);_0x3111d6[_0x5efa('0x2c')]=_['intersection'](_0x3111d6[_0x5efa('0x2a')],_0x3111d6[_0x5efa('0x2b')]);_0x200413['attributes']=_[_0x5efa('0x2d')](_0x3111d6['model'],qs[_0x5efa('0x2e')](_0x24eb5c[_0x5efa('0x2b')]['fields']));_0x200413['attributes']=_0x200413[_0x5efa('0x2f')][_0x5efa('0x30')]?_0x200413[_0x5efa('0x2f')]:_0x3111d6[_0x5efa('0x2a')];if(!_0x24eb5c[_0x5efa('0x2b')][_0x5efa('0x31')](_0x5efa('0x32'))){_0x200413[_0x5efa('0x1b')]=qs['limit'](_0x24eb5c[_0x5efa('0x2b')][_0x5efa('0x1b')]);_0x200413[_0x5efa('0x19')]=qs[_0x5efa('0x19')](_0x24eb5c[_0x5efa('0x2b')][_0x5efa('0x19')]);}_0x200413['order']=qs[_0x5efa('0x33')](_0x24eb5c['query'][_0x5efa('0x33')]);_0x200413['where']=qs[_0x5efa('0x2c')](_[_0x5efa('0x34')](_0x24eb5c['query'],_0x3111d6[_0x5efa('0x2c')]),_0x2218ef);if(_0x24eb5c[_0x5efa('0x2b')][_0x5efa('0x35')]){_0x200413[_0x5efa('0x36')]=_[_0x5efa('0x37')](_0x200413[_0x5efa('0x36')],{'$or':_['map'](_0x2218ef,function(_0x2bcb9a){if(_0x2bcb9a['type']!==_0x5efa('0x38')){var _0x20f122={};_0x20f122[_0x2bcb9a['name']]={'$like':'%'+_0x24eb5c[_0x5efa('0x2b')][_0x5efa('0x35')]+'%'};return _0x20f122;}})});}_0x200413=_[_0x5efa('0x37')]({},_0x200413,_0x24eb5c[_0x5efa('0x39')]);var _0x5bef85={'where':_0x200413[_0x5efa('0x36')]};return db['SmsApplication'][_0x5efa('0x3a')](_0x5bef85)[_0x5efa('0x1f')](function(_0x2bfe2c){_0x5b5693[_0x5efa('0x3a')]=_0x2bfe2c;if(_0x24eb5c[_0x5efa('0x2b')][_0x5efa('0x3b')]){_0x200413[_0x5efa('0x3c')]=[{'all':!![]}];}return db['SmsApplication'][_0x5efa('0x3d')](_0x200413);})[_0x5efa('0x1f')](function(_0x4dec08){_0x5b5693['rows']=_0x4dec08;return _0x5b5693;})['then'](respondWithFilteredResult(_0x438ef3,_0x200413))[_0x5efa('0x3e')](handleError(_0x438ef3,null));};exports[_0x5efa('0x3f')]=function(_0x14b798,_0x286942){var _0x266278={'raw':!![],'where':{'id':_0x14b798[_0x5efa('0x40')]['id']}},_0x24455c={};_0x24455c['model']=_[_0x5efa('0x41')](db[_0x5efa('0x26')][_0x5efa('0x27')]);_0x24455c[_0x5efa('0x2b')]=_[_0x5efa('0x41')](_0x14b798[_0x5efa('0x2b')]);_0x24455c[_0x5efa('0x2c')]=_[_0x5efa('0x2d')](_0x24455c[_0x5efa('0x2a')],_0x24455c[_0x5efa('0x2b')]);_0x266278[_0x5efa('0x2f')]=_['intersection'](_0x24455c[_0x5efa('0x2a')],qs[_0x5efa('0x2e')](_0x14b798[_0x5efa('0x2b')][_0x5efa('0x2e')]));_0x266278['attributes']=_0x266278[_0x5efa('0x2f')][_0x5efa('0x30')]?_0x266278['attributes']:_0x24455c[_0x5efa('0x2a')];if(_0x14b798[_0x5efa('0x2b')][_0x5efa('0x3b')]){_0x266278[_0x5efa('0x3c')]=[{'all':!![]}];}_0x266278=_[_0x5efa('0x37')]({},_0x266278,_0x14b798[_0x5efa('0x39')]);return db[_0x5efa('0x26')][_0x5efa('0x42')](_0x266278)[_0x5efa('0x1f')](handleEntityNotFound(_0x286942,null))[_0x5efa('0x1f')](respondWithResult(_0x286942,null))['catch'](handleError(_0x286942,null));};exports[_0x5efa('0x43')]=function(_0x110c56,_0xea4fb){return db[_0x5efa('0x26')][_0x5efa('0x43')](_0x110c56[_0x5efa('0x44')],{})[_0x5efa('0x1f')](respondWithResult(_0xea4fb,0xc9))[_0x5efa('0x3e')](handleError(_0xea4fb,null));};exports[_0x5efa('0x1e')]=function(_0x3a8fcb,_0x3f51d6){if(_0x3a8fcb['body']['id']){delete _0x3a8fcb[_0x5efa('0x44')]['id'];}return db[_0x5efa('0x26')]['find']({'where':{'id':_0x3a8fcb[_0x5efa('0x40')]['id']}})[_0x5efa('0x1f')](handleEntityNotFound(_0x3f51d6,null))['then'](saveUpdates(_0x3a8fcb[_0x5efa('0x44')],null))[_0x5efa('0x1f')](respondWithResult(_0x3f51d6,null))['catch'](handleError(_0x3f51d6,null));};exports['destroy']=function(_0x110a1b,_0x543d80){return db['SmsApplication']['find']({'where':{'id':_0x110a1b[_0x5efa('0x40')]['id']}})[_0x5efa('0x1f')](handleEntityNotFound(_0x543d80,null))[_0x5efa('0x1f')](removeEntity(_0x543d80,null))[_0x5efa('0x3e')](handleError(_0x543d80,null));}; \ No newline at end of file +var _0x8f32=['update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','count','offset','limit','Content-Range','apply','reject','save','then','destroy','error','stack','name','map','SmsApplication','rawAttributes','fieldName','type','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','create','body'];(function(_0x234ef0,_0x54e309){var _0x35c801=function(_0x359e68){while(--_0x359e68){_0x234ef0['push'](_0x234ef0['shift']());}};_0x35c801(++_0x54e309);}(_0x8f32,0x16e));var _0x28f3=function(_0x21f0aa,_0x11401c){_0x21f0aa=_0x21f0aa-0x0;var _0x74a510=_0x8f32[_0x21f0aa];return _0x74a510;};'use strict';var emlformat=require(_0x28f3('0x0'));var rimraf=require(_0x28f3('0x1'));var zipdir=require(_0x28f3('0x2'));var jsonpatch=require(_0x28f3('0x3'));var rp=require(_0x28f3('0x4'));var moment=require(_0x28f3('0x5'));var BPromise=require(_0x28f3('0x6'));var Mustache=require(_0x28f3('0x7'));var util=require(_0x28f3('0x8'));var path=require(_0x28f3('0x9'));var sox=require(_0x28f3('0xa'));var csv=require(_0x28f3('0xb'));var ejs=require(_0x28f3('0xc'));var fs=require('fs');var fs_extra=require(_0x28f3('0xd'));var _=require('lodash');var squel=require(_0x28f3('0xe'));var crypto=require(_0x28f3('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x28f3('0x10'));var toCsv=require(_0x28f3('0xb'));var querystring=require('querystring');var Papa=require(_0x28f3('0x11'));var Redis=require('ioredis');var authService=require(_0x28f3('0x12'));var qs=require(_0x28f3('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x28f3('0x14'));var logger=require(_0x28f3('0x15'))(_0x28f3('0x16'));var utils=require('../../config/utils');var config=require(_0x28f3('0x17'));var licenseUtil=require(_0x28f3('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ca929,_0x528505){_0x528505=_0x528505||0xcc;return function(_0x5c75e5){if(_0x5c75e5){return _0x2ca929[_0x28f3('0x19')](_0x528505);}return _0x2ca929[_0x28f3('0x1a')](_0x528505)['end']();};}function respondWithResult(_0x149b2f,_0x502c27){_0x502c27=_0x502c27||0xc8;return function(_0xc02ae3){if(_0xc02ae3){return _0x149b2f[_0x28f3('0x1a')](_0x502c27)[_0x28f3('0x1b')](_0xc02ae3);}};}function respondWithFilteredResult(_0xc4c1e3,_0x1aaf51){return function(_0x3c58e4){if(_0x3c58e4){var _0x46ce97=typeof _0x1aaf51['offset']==='undefined'&&typeof _0x1aaf51['limit']===_0x28f3('0x1c');var _0x5d93d3=_0x3c58e4[_0x28f3('0x1d')];var _0x53f6a9=_0x46ce97?0x0:_0x1aaf51[_0x28f3('0x1e')];var _0x1eb5ab=_0x46ce97?_0x3c58e4[_0x28f3('0x1d')]:_0x1aaf51[_0x28f3('0x1e')]+_0x1aaf51[_0x28f3('0x1f')];var _0x11d586;if(_0x1eb5ab>=_0x5d93d3){_0x1eb5ab=_0x5d93d3;_0x11d586=0xc8;}else{_0x11d586=0xce;}_0xc4c1e3[_0x28f3('0x1a')](_0x11d586);return _0xc4c1e3['set'](_0x28f3('0x20'),_0x53f6a9+'-'+_0x1eb5ab+'/'+_0x5d93d3)[_0x28f3('0x1b')](_0x3c58e4);}return null;};}function patchUpdates(_0x5eb867){return function(_0x3a25b6){try{jsonpatch[_0x28f3('0x21')](_0x3a25b6,_0x5eb867,!![]);}catch(_0x2413a5){return BPromise[_0x28f3('0x22')](_0x2413a5);}return _0x3a25b6[_0x28f3('0x23')]();};}function saveUpdates(_0x47c1f2,_0x27c19b){return function(_0x54baaa){if(_0x54baaa){return _0x54baaa['update'](_0x47c1f2)[_0x28f3('0x24')](function(_0x2bde0a){return _0x2bde0a;});}return null;};}function removeEntity(_0x37f70e,_0x5556bd){return function(_0x2eb931){if(_0x2eb931){return _0x2eb931[_0x28f3('0x25')]()['then'](function(){_0x37f70e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x13783e,_0x14d79a){return function(_0x4a38bd){if(!_0x4a38bd){_0x13783e[_0x28f3('0x19')](0x194);}return _0x4a38bd;};}function handleError(_0x488978,_0x46af27){_0x46af27=_0x46af27||0x1f4;return function(_0x2eeea0){logger[_0x28f3('0x26')](_0x2eeea0[_0x28f3('0x27')]);if(_0x2eeea0[_0x28f3('0x28')]){delete _0x2eeea0['name'];}_0x488978['status'](_0x46af27)['send'](_0x2eeea0);};}exports['index']=function(_0x329db1,_0x9265e1){var _0x6c3b50={},_0x66a391={},_0x14cd9e={'count':0x0,'rows':[]};var _0x35c1b6=_[_0x28f3('0x29')](db[_0x28f3('0x2a')][_0x28f3('0x2b')],function(_0x213877){return{'name':_0x213877[_0x28f3('0x2c')],'type':_0x213877[_0x28f3('0x2d')]['key']};});_0x66a391['model']=_['map'](_0x35c1b6,'name');_0x66a391[_0x28f3('0x2e')]=_['keys'](_0x329db1[_0x28f3('0x2e')]);_0x66a391[_0x28f3('0x2f')]=_['intersection'](_0x66a391[_0x28f3('0x30')],_0x66a391['query']);_0x6c3b50[_0x28f3('0x31')]=_[_0x28f3('0x32')](_0x66a391[_0x28f3('0x30')],qs[_0x28f3('0x33')](_0x329db1[_0x28f3('0x2e')]['fields']));_0x6c3b50[_0x28f3('0x31')]=_0x6c3b50[_0x28f3('0x31')][_0x28f3('0x34')]?_0x6c3b50['attributes']:_0x66a391[_0x28f3('0x30')];if(!_0x329db1[_0x28f3('0x2e')][_0x28f3('0x35')]('nolimit')){_0x6c3b50[_0x28f3('0x1f')]=qs[_0x28f3('0x1f')](_0x329db1[_0x28f3('0x2e')][_0x28f3('0x1f')]);_0x6c3b50[_0x28f3('0x1e')]=qs[_0x28f3('0x1e')](_0x329db1[_0x28f3('0x2e')][_0x28f3('0x1e')]);}_0x6c3b50[_0x28f3('0x36')]=qs[_0x28f3('0x37')](_0x329db1[_0x28f3('0x2e')]['sort']);_0x6c3b50[_0x28f3('0x38')]=qs[_0x28f3('0x2f')](_[_0x28f3('0x39')](_0x329db1[_0x28f3('0x2e')],_0x66a391[_0x28f3('0x2f')]),_0x35c1b6);if(_0x329db1[_0x28f3('0x2e')][_0x28f3('0x3a')]){_0x6c3b50[_0x28f3('0x38')]=_[_0x28f3('0x3b')](_0x6c3b50[_0x28f3('0x38')],{'$or':_[_0x28f3('0x29')](_0x35c1b6,function(_0x16931e){if(_0x16931e[_0x28f3('0x2d')]!==_0x28f3('0x3c')){var _0x437017={};_0x437017[_0x16931e[_0x28f3('0x28')]]={'$like':'%'+_0x329db1[_0x28f3('0x2e')]['filter']+'%'};return _0x437017;}})});}_0x6c3b50=_[_0x28f3('0x3b')]({},_0x6c3b50,_0x329db1[_0x28f3('0x3d')]);var _0x519396={'where':_0x6c3b50[_0x28f3('0x38')]};return db[_0x28f3('0x2a')][_0x28f3('0x1d')](_0x519396)[_0x28f3('0x24')](function(_0x47b677){_0x14cd9e[_0x28f3('0x1d')]=_0x47b677;if(_0x329db1['query'][_0x28f3('0x3e')]){_0x6c3b50[_0x28f3('0x3f')]=[{'all':!![]}];}return db[_0x28f3('0x2a')][_0x28f3('0x40')](_0x6c3b50);})[_0x28f3('0x24')](function(_0x4d690c){_0x14cd9e['rows']=_0x4d690c;return _0x14cd9e;})[_0x28f3('0x24')](respondWithFilteredResult(_0x9265e1,_0x6c3b50))[_0x28f3('0x41')](handleError(_0x9265e1,null));};exports[_0x28f3('0x42')]=function(_0x422e8f,_0x344c43){var _0x3f2a8a={'raw':!![],'where':{'id':_0x422e8f[_0x28f3('0x43')]['id']}},_0x114afc={};_0x114afc[_0x28f3('0x30')]=_['keys'](db['SmsApplication'][_0x28f3('0x2b')]);_0x114afc[_0x28f3('0x2e')]=_[_0x28f3('0x44')](_0x422e8f[_0x28f3('0x2e')]);_0x114afc['filters']=_[_0x28f3('0x32')](_0x114afc[_0x28f3('0x30')],_0x114afc['query']);_0x3f2a8a[_0x28f3('0x31')]=_[_0x28f3('0x32')](_0x114afc[_0x28f3('0x30')],qs[_0x28f3('0x33')](_0x422e8f[_0x28f3('0x2e')]['fields']));_0x3f2a8a[_0x28f3('0x31')]=_0x3f2a8a['attributes'][_0x28f3('0x34')]?_0x3f2a8a[_0x28f3('0x31')]:_0x114afc[_0x28f3('0x30')];if(_0x422e8f[_0x28f3('0x2e')][_0x28f3('0x3e')]){_0x3f2a8a[_0x28f3('0x3f')]=[{'all':!![]}];}_0x3f2a8a=_['merge']({},_0x3f2a8a,_0x422e8f[_0x28f3('0x3d')]);return db['SmsApplication'][_0x28f3('0x45')](_0x3f2a8a)[_0x28f3('0x24')](handleEntityNotFound(_0x344c43,null))[_0x28f3('0x24')](respondWithResult(_0x344c43,null))[_0x28f3('0x41')](handleError(_0x344c43,null));};exports[_0x28f3('0x46')]=function(_0x75532b,_0x370170){return db[_0x28f3('0x2a')][_0x28f3('0x46')](_0x75532b[_0x28f3('0x47')],{})[_0x28f3('0x24')](respondWithResult(_0x370170,0xc9))[_0x28f3('0x41')](handleError(_0x370170,null));};exports[_0x28f3('0x48')]=function(_0x54494e,_0x2e72e4){if(_0x54494e[_0x28f3('0x47')]['id']){delete _0x54494e[_0x28f3('0x47')]['id'];}return db[_0x28f3('0x2a')]['find']({'where':{'id':_0x54494e[_0x28f3('0x43')]['id']}})[_0x28f3('0x24')](handleEntityNotFound(_0x2e72e4,null))[_0x28f3('0x24')](saveUpdates(_0x54494e[_0x28f3('0x47')],null))[_0x28f3('0x24')](respondWithResult(_0x2e72e4,null))[_0x28f3('0x41')](handleError(_0x2e72e4,null));};exports[_0x28f3('0x25')]=function(_0x1bf8cc,_0x1a986b){return db[_0x28f3('0x2a')]['find']({'where':{'id':_0x1bf8cc[_0x28f3('0x43')]['id']}})['then'](handleEntityNotFound(_0x1a986b,null))[_0x28f3('0x24')](removeEntity(_0x1a986b,null))[_0x28f3('0x41')](handleError(_0x1a986b,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index fb94c4e..d0dbed4 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 _0x06ca=['exports','define','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path','./smsApplication.attributes'];(function(_0x29803b,_0x5077da){var _0x41e6f3=function(_0xe57dc0){while(--_0xe57dc0){_0x29803b['push'](_0x29803b['shift']());}};_0x41e6f3(++_0x5077da);}(_0x06ca,0xad));var _0xa06c=function(_0x3784ca,_0x49d572){_0x3784ca=_0x3784ca-0x0;var _0x44ca51=_0x06ca[_0x3784ca];return _0x44ca51;};'use strict';var _=require(_0xa06c('0x0'));var util=require(_0xa06c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa06c('0x2'));var BPromise=require(_0xa06c('0x3'));var rp=require(_0xa06c('0x4'));var fs=require('fs');var path=require(_0xa06c('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa06c('0x6'));module[_0xa06c('0x7')]=function(_0x351d6a,_0x479954){return _0x351d6a[_0xa06c('0x8')]('SmsApplication',attributes,{'tableName':_0xa06c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa06c('0xa'),'collate':_0xa06c('0xb')});}; \ No newline at end of file +var _0x0c96=['../../config/logger','api','moment','request-promise','path','rimraf','./smsApplication.attributes','define','SmsApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x864207,_0x3439ef){var _0x7542cb=function(_0x53b7e5){while(--_0x53b7e5){_0x864207['push'](_0x864207['shift']());}};_0x7542cb(++_0x3439ef);}(_0x0c96,0x177));var _0x60c9=function(_0x19eeb5,_0x5c2a2c){_0x19eeb5=_0x19eeb5-0x0;var _0x5bc38d=_0x0c96[_0x19eeb5];return _0x5bc38d;};'use strict';var _=require(_0x60c9('0x0'));var util=require(_0x60c9('0x1'));var logger=require(_0x60c9('0x2'))(_0x60c9('0x3'));var moment=require(_0x60c9('0x4'));var BPromise=require('bluebird');var rp=require(_0x60c9('0x5'));var fs=require('fs');var path=require(_0x60c9('0x6'));var rimraf=require(_0x60c9('0x7'));var config=require('../../config/environment');var attributes=require(_0x60c9('0x8'));module['exports']=function(_0x3c6667,_0x14d56e){return _0x3c6667[_0x60c9('0x9')](_0x60c9('0xa'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x60c9('0xb'),'collate':_0x60c9('0xc')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 638d3c6..e64a955 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 _0xc5df=['message','result','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SmsApplication,\x20%s,\x20%s','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x51e254,_0x5c4f2e){var _0x3d3ea9=function(_0x4547dd){while(--_0x4547dd){_0x51e254['push'](_0x51e254['shift']());}};_0x3d3ea9(++_0x5c4f2e);}(_0xc5df,0x80));var _0xfc5d=function(_0x488782,_0x125f66){_0x488782=_0x488782-0x0;var _0x512531=_0xc5df[_0x488782];return _0x512531;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfc5d('0x0'));var BPromise=require(_0xfc5d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfc5d('0x2'))['db'];var utils=require(_0xfc5d('0x3'));var logger=require(_0xfc5d('0x4'))(_0xfc5d('0x5'));var config=require(_0xfc5d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xfc5d('0x7')][_0xfc5d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b8b10,_0x535aa7,_0x2a38ce){return new BPromise(function(_0x240ba0,_0x522712){return client[_0xfc5d('0x9')](_0x1b8b10,_0x2a38ce)[_0xfc5d('0xa')](function(_0x4f9a05){logger[_0xfc5d('0xb')](_0xfc5d('0xc'),_0x535aa7,'request\x20sent');logger[_0xfc5d('0xd')](_0xfc5d('0xe'),_0x535aa7,_0xfc5d('0xf'),JSON[_0xfc5d('0x10')](_0x4f9a05));if(_0x4f9a05['error']){if(_0x4f9a05[_0xfc5d('0x11')][_0xfc5d('0x12')]===0x1f4){logger[_0xfc5d('0x11')]('SmsApplication,\x20%s,\x20%s',_0x535aa7,_0x4f9a05[_0xfc5d('0x11')][_0xfc5d('0x13')]);return _0x522712(_0x4f9a05['error'][_0xfc5d('0x13')]);}logger['error'](_0xfc5d('0xc'),_0x535aa7,_0x4f9a05['error'][_0xfc5d('0x13')]);return _0x240ba0(_0x4f9a05[_0xfc5d('0x11')][_0xfc5d('0x13')]);}else{logger[_0xfc5d('0xb')](_0xfc5d('0xc'),_0x535aa7,'request\x20sent');_0x240ba0(_0x4f9a05[_0xfc5d('0x14')][_0xfc5d('0x13')]);}})['catch'](function(_0x26f84a){logger['error'](_0xfc5d('0xc'),_0x535aa7,_0x26f84a);_0x522712(_0x26f84a);});});} \ No newline at end of file +var _0x4f08=['SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsApplication,\x20%s,\x20%s','message','info','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','request\x20sent','debug'];(function(_0x3a22e7,_0x2b4396){var _0x3e90f9=function(_0x3af31c){while(--_0x3af31c){_0x3a22e7['push'](_0x3a22e7['shift']());}};_0x3e90f9(++_0x2b4396);}(_0x4f08,0x194));var _0x84f0=function(_0xa8baab,_0xe87974){_0xa8baab=_0xa8baab-0x0;var _0x37bee8=_0x4f08[_0xa8baab];return _0x37bee8;};'use strict';var _=require(_0x84f0('0x0'));var util=require(_0x84f0('0x1'));var moment=require('moment');var BPromise=require(_0x84f0('0x2'));var rs=require(_0x84f0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x84f0('0x4'))['db'];var utils=require(_0x84f0('0x5'));var logger=require(_0x84f0('0x6'))('rpc');var config=require(_0x84f0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x84f0('0x8')][_0x84f0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4548f3,_0x5a877f,_0x430993){return new BPromise(function(_0x42f42e,_0x15b01d){return client[_0x84f0('0xa')](_0x4548f3,_0x430993)[_0x84f0('0xb')](function(_0x1b256f){logger['info']('SmsApplication,\x20%s,\x20%s',_0x5a877f,_0x84f0('0xc'));logger[_0x84f0('0xd')](_0x84f0('0xe'),_0x5a877f,_0x84f0('0xc'),JSON[_0x84f0('0xf')](_0x1b256f));if(_0x1b256f[_0x84f0('0x10')]){if(_0x1b256f[_0x84f0('0x10')][_0x84f0('0x11')]===0x1f4){logger[_0x84f0('0x10')]('SmsApplication,\x20%s,\x20%s',_0x5a877f,_0x1b256f[_0x84f0('0x10')]['message']);return _0x15b01d(_0x1b256f[_0x84f0('0x10')]['message']);}logger[_0x84f0('0x10')](_0x84f0('0x12'),_0x5a877f,_0x1b256f[_0x84f0('0x10')][_0x84f0('0x13')]);return _0x42f42e(_0x1b256f[_0x84f0('0x10')][_0x84f0('0x13')]);}else{logger[_0x84f0('0x14')](_0x84f0('0x12'),_0x5a877f,_0x84f0('0xc'));_0x42f42e(_0x1b256f['result'][_0x84f0('0x13')]);}})[_0x84f0('0x15')](function(_0x9e40a8){logger['error']('SmsApplication,\x20%s,\x20%s',_0x5a877f,_0x9e40a8);_0x15b01d(_0x9e40a8);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 052b128..1668db7 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 _0xa571=['get','isAuthenticated','index','/describe','/:id','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','delete','tracked','destroy','/:id/tags','removeTags','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0xa571,0x107));var _0x1a57=function(_0x3aee5a,_0x525e62){_0x3aee5a=_0x3aee5a-0x0;var _0xa34b72=_0xa571[_0x3aee5a];return _0xa34b72;};'use strict';var multer=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var path=require(_0x1a57('0x2'));var timeout=require(_0x1a57('0x3'));var express=require('express');var router=express[_0x1a57('0x4')]();var fs_extra=require(_0x1a57('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1a57('0x6'));var controller=require('./smsInteraction.controller');router[_0x1a57('0x7')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0x9')]);router[_0x1a57('0x7')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller['describe']);router[_0x1a57('0x7')](_0x1a57('0xb'),auth[_0x1a57('0x8')](),controller['show']);router[_0x1a57('0x7')](_0x1a57('0xc'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xd')]);router[_0x1a57('0x7')](_0x1a57('0xe'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1a57('0x10')]);router[_0x1a57('0x11')](_0x1a57('0xc'),auth['isAuthenticated'](),controller[_0x1a57('0x12')]);router[_0x1a57('0x11')]('/:id/tags',auth[_0x1a57('0x8')](),interaction['tracked'](_0x1a57('0x13'),_0x1a57('0x14')),controller[_0x1a57('0x15')]);router[_0x1a57('0x16')]('/:id',auth[_0x1a57('0x8')](),interaction['tracked']('sms',_0x1a57('0x17')),controller[_0x1a57('0x18')]);router[_0x1a57('0x19')]('/:id',auth[_0x1a57('0x8')](),interaction[_0x1a57('0x1a')](_0x1a57('0x13'),'smsinteraction:destroy'),controller[_0x1a57('0x1b')]);router[_0x1a57('0x19')](_0x1a57('0x1c'),auth[_0x1a57('0x8')](),controller[_0x1a57('0x1d')]);module['exports']=router; \ No newline at end of file +var _0x2032=['./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','create','/:id/tags','sms','smsinteraction:addtags','addTags','put','/:id','tracked','smsinteraction:update','update','smsinteraction:destroy','delete','removeTags','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x2f421,_0x5144c4){var _0x27b4af=function(_0x119470){while(--_0x119470){_0x2f421['push'](_0x2f421['shift']());}};_0x27b4af(++_0x5144c4);}(_0x2032,0xd9));var _0x2203=function(_0x4c0952,_0x138fc3){_0x4c0952=_0x4c0952-0x0;var _0x17edf7=_0x2032[_0x4c0952];return _0x17edf7;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['get'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router['get'](_0x2203('0x10'),auth['isAuthenticated'](),controller[_0x2203('0x11')]);router['post']('/',auth[_0x2203('0x9')](),controller[_0x2203('0x12')]);router['post']('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router['post'](_0x2203('0x13'),auth['isAuthenticated'](),interaction['tracked'](_0x2203('0x14'),_0x2203('0x15')),controller[_0x2203('0x16')]);router[_0x2203('0x17')](_0x2203('0x18'),auth[_0x2203('0x9')](),interaction[_0x2203('0x19')](_0x2203('0x14'),_0x2203('0x1a')),controller[_0x2203('0x1b')]);router['delete'](_0x2203('0x18'),auth[_0x2203('0x9')](),interaction['tracked'](_0x2203('0x14'),_0x2203('0x1c')),controller['destroy']);router[_0x2203('0x1d')]('/:id/tags',auth[_0x2203('0x9')](),controller[_0x2203('0x1e')]);module[_0x2203('0x1f')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index dc0bd78..22ceda5 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 _0x5a52=['BOOLEAN','sequelize','DATE','STRING','ENUM','out'];(function(_0x2ddab4,_0x5919bf){var _0x3daf5c=function(_0x458239){while(--_0x458239){_0x2ddab4['push'](_0x2ddab4['shift']());}};_0x3daf5c(++_0x5919bf);}(_0x5a52,0x18d));var _0x25a5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5a52[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x25a5('0x0'));var moment=require('moment');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x25a5('0x1')]},'disposition':{'type':Sequelize[_0x25a5('0x2')]},'secondDisposition':{'type':Sequelize[_0x25a5('0x2')]},'thirdDisposition':{'type':Sequelize[_0x25a5('0x2')]},'note':{'type':Sequelize[_0x25a5('0x2')]},'phone':{'type':Sequelize[_0x25a5('0x2')]},'read1stAt':{'type':Sequelize[_0x25a5('0x1')]},'firstMsgDirection':{'type':Sequelize[_0x25a5('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x25a5('0x1')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x25a5('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x25a5('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0x9305=['ENUM','out','sequelize','moment','exports','BOOLEAN','STRING','DATE'];(function(_0x4933c7,_0x5ed34){var _0x399728=function(_0x2af139){while(--_0x2af139){_0x4933c7['push'](_0x4933c7['shift']());}};_0x399728(++_0x5ed34);}(_0x9305,0x1e2));var _0x5930=function(_0x49236c,_0x1aa642){_0x49236c=_0x49236c-0x0;var _0x52442=_0x9305[_0x49236c];return _0x52442;};'use strict';var Sequelize=require(_0x5930('0x0'));var moment=require(_0x5930('0x1'));module[_0x5930('0x2')]={'closed':{'type':Sequelize[_0x5930('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x5930('0x4')]},'secondDisposition':{'type':Sequelize[_0x5930('0x4')]},'thirdDisposition':{'type':Sequelize[_0x5930('0x4')]},'note':{'type':Sequelize[_0x5930('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x5930('0x5')]},'firstMsgDirection':{'type':Sequelize[_0x5930('0x6')]('in',_0x5930('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x5930('0x5')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x5930('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 1d81cd9..c050405 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 _0x0800=['format','YYYY-MM-DD\x20HH:mm:ss','merge','options','addTags','setTags','Tag','color','smsInteractionTags:save','removeTags','download','unix','toString','server','files','join','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Messages','direction','read','SmsAccount','Account','Owner','get','mkdirSync','Sms','N.A.','createdAt','closedAt','disposition','out','System','secret','value','renderFile','root','views','transcript-','.pdf','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','ejs','lodash','ioredis','../../components/interaction/service','api','../../config/environment','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','update','then','error','stack','name','send','map','SmsInteraction','rawAttributes','fieldName','getOptions','findAll','sms','query','user','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','find','create','body','destroy','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','sort','pick','where','SmsInteractionId','filter','$gte','split'];(function(_0x130d82,_0x25f49b){var _0x112070=function(_0x5795ee){while(--_0x5795ee){_0x130d82['push'](_0x130d82['shift']());}};_0x112070(++_0x25f49b);}(_0x0800,0xa9));var _0x0080=function(_0x5cfac9,_0x5a8cd5){_0x5cfac9=_0x5cfac9-0x0;var _0x1dd0de=_0x0800[_0x5cfac9];return _0x1dd0de;};'use strict';var rimraf=require(_0x0080('0x0'));var zipdir=require(_0x0080('0x1'));var moment=require(_0x0080('0x2'));var BPromise=require(_0x0080('0x3'));var util=require('util');var path=require('path');var ejs=require(_0x0080('0x4'));var fs=require('fs');var _=require(_0x0080('0x5'));var Redis=require(_0x0080('0x6'));var interaction=require(_0x0080('0x7'));var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0x0080('0x8'));var config=require(_0x0080('0x9'));var db=require('../../mysqldb')['db'];config[_0x0080('0xa')]=_['defaults'](config[_0x0080('0xa')],{'host':_0x0080('0xb'),'port':0x18eb});var socket=require(_0x0080('0xc'))(new Redis(config[_0x0080('0xa')]));require(_0x0080('0xd'))[_0x0080('0xe')](socket);function respondWithStatusCode(_0x4410d4,_0x34f01d){_0x34f01d=_0x34f01d||0xcc;return function(_0x498bee){if(_0x498bee){return _0x4410d4[_0x0080('0xf')](_0x34f01d);}return _0x4410d4[_0x0080('0x10')](_0x34f01d)[_0x0080('0x11')]();};}function respondWithResult(_0x36af3e,_0x4479dc){_0x4479dc=_0x4479dc||0xc8;return function(_0x279838){if(_0x279838){return _0x36af3e[_0x0080('0x10')](_0x4479dc)['json'](_0x279838);}};}function respondWithFilteredResult(_0x1ecde0,_0x1ca74e){return function(_0xc407b){if(_0xc407b){var _0x57623d=typeof _0x1ca74e['offset']===_0x0080('0x12')&&typeof _0x1ca74e[_0x0080('0x13')]==='undefined';var _0x54cc08=_0xc407b[_0x0080('0x14')];var _0x539919=_0x57623d?0x0:_0x1ca74e[_0x0080('0x15')];var _0x3b0f3e=_0x57623d?_0xc407b[_0x0080('0x14')]:_0x1ca74e[_0x0080('0x15')]+_0x1ca74e[_0x0080('0x13')];var _0x522d81;if(_0x3b0f3e>=_0x54cc08){_0x3b0f3e=_0x54cc08;_0x522d81=0xc8;}else{_0x522d81=0xce;}_0x1ecde0['status'](_0x522d81);return _0x1ecde0[_0x0080('0x16')](_0x0080('0x17'),_0x539919+'-'+_0x3b0f3e+'/'+_0x54cc08)['json'](_0xc407b);}return null;};}function saveUpdates(_0x177cc2){return function(_0x5d5c47){if(_0x5d5c47){return _0x5d5c47[_0x0080('0x18')](_0x177cc2)[_0x0080('0x19')](function(_0xd0e1){return _0xd0e1;});}return null;};}function removeEntity(_0x329c57){return function(_0x368c9d){if(_0x368c9d){return _0x368c9d['destroy']()[_0x0080('0x19')](function(){_0x329c57[_0x0080('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a529a){return function(_0x5167fa){if(!_0x5167fa){_0x1a529a['sendStatus'](0x194);}return _0x5167fa;};}function handleError(_0x55915c,_0x298e6b){_0x298e6b=_0x298e6b||0x1f4;return function(_0x285912){logger[_0x0080('0x1a')](_0x285912[_0x0080('0x1b')]);if(_0x285912[_0x0080('0x1c')]){delete _0x285912[_0x0080('0x1c')];}_0x55915c[_0x0080('0x10')](_0x298e6b)[_0x0080('0x1d')](_0x285912);};}exports['index']=function(_0x470997,_0x2cacaa){var _0x282d3a={};var _0x2c8c40=_[_0x0080('0x1e')](db[_0x0080('0x1f')][_0x0080('0x20')],function(_0x14c520){return{'name':_0x14c520[_0x0080('0x21')],'type':_0x14c520['type']['key']};});_0x282d3a=qs[_0x0080('0x22')](_0x2c8c40,_0x470997);return interaction[_0x0080('0x23')](_0x0080('0x24'),_0x470997[_0x0080('0x25')],_0x470997[_0x0080('0x26')],_0x282d3a,_0x2c8c40)['then'](respondWithFilteredResult(_0x2cacaa,_0x282d3a))[_0x0080('0x27')](handleError(_0x2cacaa,null));};exports[_0x0080('0x28')]=function(_0x2fd5ec,_0x56bb70){var _0x563a8a={'raw':![],'where':{'id':_0x2fd5ec[_0x0080('0x29')]['id']}},_0x288728={};_0x288728[_0x0080('0x2a')]=_[_0x0080('0x2b')](db[_0x0080('0x1f')][_0x0080('0x20')]);_0x288728[_0x0080('0x25')]=_[_0x0080('0x2b')](_0x2fd5ec[_0x0080('0x25')]);_0x288728[_0x0080('0x2c')]=_[_0x0080('0x2d')](_0x288728[_0x0080('0x2a')],_0x288728['query']);_0x563a8a[_0x0080('0x2e')]=_[_0x0080('0x2d')](_0x288728[_0x0080('0x2a')],qs[_0x0080('0x2f')](_0x2fd5ec[_0x0080('0x25')]['fields']));_0x563a8a['attributes']=_0x563a8a[_0x0080('0x2e')][_0x0080('0x30')]?_0x563a8a[_0x0080('0x2e')]:_0x288728[_0x0080('0x2a')];if(_0x2fd5ec[_0x0080('0x25')][_0x0080('0x31')]){_0x563a8a[_0x0080('0x32')]=[{'all':!![]}];}_0x563a8a=_['merge']({},_0x563a8a,_0x2fd5ec['options']);return db[_0x0080('0x1f')][_0x0080('0x33')](_0x563a8a)['then'](handleEntityNotFound(_0x56bb70,null))['then'](respondWithResult(_0x56bb70,null))[_0x0080('0x27')](handleError(_0x56bb70,null));};exports[_0x0080('0x34')]=function(_0x4da3c5,_0x1252eb){return db[_0x0080('0x1f')]['create'](_0x4da3c5[_0x0080('0x35')],{})[_0x0080('0x19')](respondWithResult(_0x1252eb,0xc9))[_0x0080('0x27')](handleError(_0x1252eb,null));};exports['update']=function(_0x4ed1cc,_0x448bc2){if(_0x4ed1cc[_0x0080('0x35')]['id']){delete _0x4ed1cc[_0x0080('0x35')]['id'];}return db['SmsInteraction'][_0x0080('0x33')]({'where':{'id':_0x4ed1cc[_0x0080('0x29')]['id']}})[_0x0080('0x19')](handleEntityNotFound(_0x448bc2,null))[_0x0080('0x19')](saveUpdates(_0x4ed1cc[_0x0080('0x35')],null))[_0x0080('0x19')](respondWithResult(_0x448bc2,null))[_0x0080('0x27')](handleError(_0x448bc2,null));};exports[_0x0080('0x36')]=function(_0x27d014,_0x4854b2){return db[_0x0080('0x1f')]['find']({'where':{'id':_0x27d014[_0x0080('0x29')]['id']}})[_0x0080('0x19')](handleEntityNotFound(_0x4854b2,null))[_0x0080('0x19')](removeEntity(_0x4854b2,null))[_0x0080('0x27')](handleError(_0x4854b2,null));};exports['describe']=function(_0x2e5c12,_0x5189a4){return db['SmsInteraction'][_0x0080('0x37')]()[_0x0080('0x19')](respondWithResult(_0x5189a4,null))[_0x0080('0x27')](handleError(_0x5189a4,null));};exports[_0x0080('0x38')]=function(_0x1651c4,_0x264e88){return db[_0x0080('0x39')]['find']({'where':{'id':_0x1651c4[_0x0080('0x29')]['id']}})[_0x0080('0x19')](handleEntityNotFound(_0x264e88,null))[_0x0080('0x19')](function(_0x5de141){if(_0x5de141){return _0x5de141[_0x0080('0x38')](_0x1651c4['body'][_0x0080('0x3a')],_[_0x0080('0x3b')](_0x1651c4[_0x0080('0x35')],['ids','id'])||{});}})['then'](respondWithResult(_0x264e88,null))[_0x0080('0x27')](handleError(_0x264e88,null));};exports[_0x0080('0x3c')]=function(_0x217f16,_0x180426){var _0x35ab91={'raw':![],'where':{}};var _0x4930ee={};var _0x4d8e36={'count':0x0,'rows':[]};return db['SmsInteraction'][_0x0080('0x3d')]({'where':{'id':_0x217f16[_0x0080('0x29')]['id']}})['then'](handleEntityNotFound(_0x180426,null))[_0x0080('0x19')](function(_0x5c6d90){if(_0x5c6d90){_0x4930ee['model']=_['keys'](db[_0x0080('0x39')][_0x0080('0x20')]);_0x4930ee[_0x0080('0x25')]=_['keys'](_0x217f16[_0x0080('0x25')]);_0x4930ee[_0x0080('0x2c')]=_[_0x0080('0x2d')](_0x4930ee[_0x0080('0x2a')],_0x4930ee[_0x0080('0x25')]);_0x35ab91[_0x0080('0x2e')]=_['intersection'](_0x4930ee[_0x0080('0x2a')],qs[_0x0080('0x2f')](_0x217f16[_0x0080('0x25')][_0x0080('0x2f')]));_0x35ab91[_0x0080('0x2e')]=_0x35ab91[_0x0080('0x2e')][_0x0080('0x30')]?_0x35ab91[_0x0080('0x2e')]:_0x4930ee['model'];if(!_0x217f16[_0x0080('0x25')][_0x0080('0x3e')](_0x0080('0x3f'))){_0x35ab91['limit']=qs[_0x0080('0x13')](_0x217f16[_0x0080('0x25')][_0x0080('0x13')]);_0x35ab91['offset']=qs[_0x0080('0x15')](_0x217f16[_0x0080('0x25')][_0x0080('0x15')]);}_0x35ab91['order']=qs[_0x0080('0x40')](_0x217f16[_0x0080('0x25')][_0x0080('0x40')]);_0x35ab91['where']=qs[_0x0080('0x2c')](_[_0x0080('0x41')](_0x217f16[_0x0080('0x25')],_0x4930ee[_0x0080('0x2c')]));_0x35ab91[_0x0080('0x42')][_0x0080('0x43')]=_0x5c6d90['id'];if(_0x217f16[_0x0080('0x25')]['filter']){_0x35ab91[_0x0080('0x42')]=_['merge'](_0x35ab91[_0x0080('0x42')],{'$or':_['map'](_0x35ab91['attributes'],function(_0x2b8e45){var _0x19682d={};_0x19682d[_0x2b8e45]={'$like':'%'+_0x217f16[_0x0080('0x25')][_0x0080('0x44')]+'%'};return _0x19682d;})});}if(_0x217f16['query'][_0x0080('0x45')]){var _0x23ec82=_0x217f16[_0x0080('0x25')][_0x0080('0x45')][_0x0080('0x46')](',');var _0x345bdb={};_0x345bdb[_0x23ec82[0x0]]={'$gte':moment(_0x23ec82[0x1])[_0x0080('0x47')](_0x0080('0x48'))};_0x35ab91[_0x0080('0x42')]=_['merge'](_0x35ab91['where'],_0x345bdb);}_0x35ab91=_[_0x0080('0x49')]({},_0x35ab91,_0x217f16[_0x0080('0x4a')]);return db[_0x0080('0x39')][_0x0080('0x14')]({'where':_0x35ab91['where']})[_0x0080('0x19')](function(_0x54ec39){_0x4d8e36[_0x0080('0x14')]=_0x54ec39;if(_0x217f16[_0x0080('0x25')][_0x0080('0x31')]){_0x35ab91[_0x0080('0x32')]=[{'all':!![]}];}return db[_0x0080('0x39')][_0x0080('0x23')](_0x35ab91);})['then'](function(_0x157857){_0x4d8e36['rows']=_0x157857;return _0x4d8e36;});}})[_0x0080('0x19')](respondWithFilteredResult(_0x180426,_0x35ab91))[_0x0080('0x27')](handleError(_0x180426,null));};exports[_0x0080('0x4b')]=function(_0x4c38b6,_0x10a695){return db[_0x0080('0x1f')][_0x0080('0x33')]({'where':{'id':_0x4c38b6[_0x0080('0x29')]['id']}})[_0x0080('0x19')](handleEntityNotFound(_0x10a695,null))[_0x0080('0x19')](function(_0x2fbedd){if(_0x2fbedd){return _0x2fbedd[_0x0080('0x4c')](_0x4c38b6[_0x0080('0x35')][_0x0080('0x3a')],_['omit'](_0x4c38b6[_0x0080('0x35')],[_0x0080('0x3a'),'id'])||{})['spread'](function(){return db[_0x0080('0x4d')][_0x0080('0x23')]({'attributes':['id',_0x0080('0x1c'),_0x0080('0x4e')],'where':{'id':_0x4c38b6['body'][_0x0080('0x3a')]}});})[_0x0080('0x19')](function(_0x20c274){socket['emit'](_0x0080('0x4f'),{'id':Number(_0x4c38b6['params']['id']),'tags':_0x20c274||[]});return{'id':Number(_0x4c38b6[_0x0080('0x29')]['id']),'tags':_0x20c274||[]};});}})[_0x0080('0x19')](respondWithResult(_0x10a695,null))[_0x0080('0x27')](handleError(_0x10a695,null));};exports[_0x0080('0x50')]=function(_0x45c67f,_0x40e5de){return db[_0x0080('0x1f')]['find']({'where':{'id':_0x45c67f['params']['id']}})['then'](handleEntityNotFound(_0x40e5de,null))[_0x0080('0x19')](function(_0x24c2fc){if(_0x24c2fc){return _0x24c2fc[_0x0080('0x50')](_0x45c67f[_0x0080('0x25')][_0x0080('0x3a')]);}})['then'](respondWithStatusCode(_0x40e5de,null))['catch'](handleError(_0x40e5de,null));};exports[_0x0080('0x51')]=function(_0x3e4fbf,_0x446dbc){var _0x4e9b86=moment()[_0x0080('0x52')]()[_0x0080('0x53')]();var _0x16b555=path['join'](config['root'],_0x0080('0x54'),_0x0080('0x55'),'tmp');var _0x3640f0=path[_0x0080('0x56')](_0x16b555,_0x4e9b86);var _0x58148f=util[_0x0080('0x47')](_0x0080('0x57'),_0x3e4fbf[_0x0080('0x29')]['id'],_0x4e9b86);var _0x4ace1f=path[_0x0080('0x56')](_0x16b555,_0x58148f);var _0x17b506=[];_0x17b506[_0x0080('0x58')]({'model':db[_0x0080('0x59')],'as':_0x0080('0x59'),'attributes':['id',_0x0080('0x5a')],'raw':!![]});_0x17b506[_0x0080('0x58')]({'model':db[_0x0080('0x5b')],'as':_0x0080('0x5c'),'attributes':['id',_0x0080('0x5d'),_0x0080('0x5e')],'raw':!![]});var _0x5e9635=[{'model':db[_0x0080('0x39')],'as':_0x0080('0x5f'),'attributes':['id',_0x0080('0x35'),'createdAt',_0x0080('0x60'),'secret',_0x0080('0x61')],'include':_0x17b506}];_0x5e9635[_0x0080('0x58')]({'model':db[_0x0080('0x62')],'as':_0x0080('0x63'),'attributes':['id',_0x0080('0x1c')]});_0x5e9635[_0x0080('0x58')]({'model':db[_0x0080('0x59')],'as':_0x0080('0x64'),'attributes':['id',_0x0080('0x5a')]});return db[_0x0080('0x1f')][_0x0080('0x33')]({'where':{'id':_0x3e4fbf[_0x0080('0x29')]['id']},'include':_0x5e9635})[_0x0080('0x19')](handleEntityNotFound(_0x446dbc,null))[_0x0080('0x19')](function(_0x1c5fea){if(_0x1c5fea){var _0x4dd2af=_0x1c5fea[_0x0080('0x65')]({'plain':!![]});fs[_0x0080('0x66')](_0x3640f0);var _0x574ece={'channel':_0x0080('0x67'),'account':_0x4dd2af[_0x0080('0x63')][_0x0080('0x1c')],'agent':_0x4dd2af[_0x0080('0x64')]?_0x4dd2af['Owner']['fullname']:_0x0080('0x68'),'createdAt':moment(_0x4dd2af[_0x0080('0x69')])[_0x0080('0x47')](_0x0080('0x48'))[_0x0080('0x53')](),'closedAt':_0x4dd2af['closed']?moment(_0x4dd2af[_0x0080('0x6a')])[_0x0080('0x47')](_0x0080('0x48'))[_0x0080('0x53')]():'','disposition':_0x4dd2af[_0x0080('0x6b')],'messages':_(_0x4dd2af[_0x0080('0x5f')])[_0x0080('0x44')]({'secret':![]})['map'](function(_0x2ef80d){return{'date':moment(_0x2ef80d['createdAt'])[_0x0080('0x47')](_0x0080('0x48'))[_0x0080('0x53')](),'sender':_0x2ef80d[_0x0080('0x60')]===_0x0080('0x6c')?_0x2ef80d[_0x0080('0x59')]?_0x2ef80d['User'][_0x0080('0x5a')]:_0x0080('0x6d'):_0x2ef80d[_0x0080('0x5c')]['firstName']+(_0x2ef80d['Contact'][_0x0080('0x5e')]?'\x20'+_0x2ef80d[_0x0080('0x5c')][_0x0080('0x5e')]:''),'body':_0x2ef80d[_0x0080('0x35')],'direction':_0x2ef80d[_0x0080('0x60')]===_0x0080('0x6c')?'A':'C','secret':_0x2ef80d[_0x0080('0x6e')],'read':_0x2ef80d[_0x0080('0x61')]};})[_0x0080('0x6f')]()};return ejs[_0x0080('0x70')](path[_0x0080('0x56')](config[_0x0080('0x71')],'server',_0x0080('0x72'),'downloadInteraction.ejs'),{'interaction':_0x574ece})[_0x0080('0x19')](function(_0x501c4b){var _0x23a506=path[_0x0080('0x56')](_0x3640f0,_0x0080('0x73')+_0x4dd2af['id']+'-'+_0x4e9b86+_0x0080('0x74'));var _0x4fe218={'path':_0x23a506,'channel':_0x0080('0x67'),'interactionId':_0x4dd2af['id']};return pdf['createPdfFromHTML'](_0x501c4b,_0x4fe218);})['then'](function(){return new BPromise(function(_0x20797b,_0x15240c){zipdir(_0x3640f0,{'saveTo':_0x4ace1f},function(_0x102881,_0x58bf5f){if(_0x102881)return _0x15240c(_0x102881);return _0x20797b(_0x58bf5f);});})[_0x0080('0x19')](function(){return new BPromise(function(_0x2587df,_0x367a72){rimraf(_0x3640f0,function(_0x5ee7be){if(_0x5ee7be)_0x367a72(_0x5ee7be);return _0x2587df();});});})[_0x0080('0x19')](function(){return _0x446dbc['download'](_0x4ace1f,_0x58148f,function(_0x5a1db4){if(_0x5a1db4){console[_0x0080('0x75')](_0x0080('0x76'),_0x5a1db4);}else{fs[_0x0080('0x77')](_0x4ace1f);}});});});}else{return _0x446dbc[_0x0080('0xf')](0xc8);}})['catch'](handleError(_0x446dbc,null));}; \ No newline at end of file +var _0x3645=['rawAttributes','fieldName','type','key','findAll','sms','query','user','show','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','create','body','update','params','describe','addMessage','SmsMessage','omit','ids','getMessages','hasOwnProperty','nolimit','order','sort','where','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','spread','color','emit','removeTags','download','toString','join','server','files','tmp','User','fullname','CmContact','Contact','lastName','Messages','createdAt','direction','secret','SmsAccount','push','Owner','get','Sms','Account','N.A.','closed','out','System','firstName','value','renderFile','root','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','ejs','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','error','name','send','index','map','SmsInteraction'];(function(_0xd15610,_0x57b20f){var _0x136a18=function(_0x57a51f){while(--_0x57a51f){_0xd15610['push'](_0xd15610['shift']());}};_0x136a18(++_0x57b20f);}(_0x3645,0xc8));var _0x5364=function(_0x502953,_0x28de83){_0x502953=_0x502953-0x0;var _0x2fa32d=_0x3645[_0x502953];return _0x2fa32d;};'use strict';var rimraf=require(_0x5364('0x0'));var zipdir=require(_0x5364('0x1'));var moment=require(_0x5364('0x2'));var BPromise=require(_0x5364('0x3'));var util=require(_0x5364('0x4'));var path=require('path');var ejs=require(_0x5364('0x5'));var fs=require('fs');var _=require(_0x5364('0x6'));var Redis=require(_0x5364('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0x5364('0x8'));var pdf=require('../../components/export/pdf');var logger=require(_0x5364('0x9'))(_0x5364('0xa'));var config=require(_0x5364('0xb'));var db=require('../../mysqldb')['db'];config[_0x5364('0xc')]=_[_0x5364('0xd')](config[_0x5364('0xc')],{'host':_0x5364('0xe'),'port':0x18eb});var socket=require(_0x5364('0xf'))(new Redis(config[_0x5364('0xc')]));require(_0x5364('0x10'))[_0x5364('0x11')](socket);function respondWithStatusCode(_0x4ea69c,_0x497cc6){_0x497cc6=_0x497cc6||0xcc;return function(_0x20b105){if(_0x20b105){return _0x4ea69c[_0x5364('0x12')](_0x497cc6);}return _0x4ea69c[_0x5364('0x13')](_0x497cc6)[_0x5364('0x14')]();};}function respondWithResult(_0x5249da,_0x3e2bce){_0x3e2bce=_0x3e2bce||0xc8;return function(_0x27f6bb){if(_0x27f6bb){return _0x5249da[_0x5364('0x13')](_0x3e2bce)[_0x5364('0x15')](_0x27f6bb);}};}function respondWithFilteredResult(_0x159e0f,_0x25bd2d){return function(_0x14a95e){if(_0x14a95e){var _0x3cff5d=typeof _0x25bd2d[_0x5364('0x16')]===_0x5364('0x17')&&typeof _0x25bd2d[_0x5364('0x18')]===_0x5364('0x17');var _0x246c2e=_0x14a95e[_0x5364('0x19')];var _0x5773b7=_0x3cff5d?0x0:_0x25bd2d['offset'];var _0x4006f2=_0x3cff5d?_0x14a95e['count']:_0x25bd2d[_0x5364('0x16')]+_0x25bd2d[_0x5364('0x18')];var _0x418cbf;if(_0x4006f2>=_0x246c2e){_0x4006f2=_0x246c2e;_0x418cbf=0xc8;}else{_0x418cbf=0xce;}_0x159e0f[_0x5364('0x13')](_0x418cbf);return _0x159e0f[_0x5364('0x1a')](_0x5364('0x1b'),_0x5773b7+'-'+_0x4006f2+'/'+_0x246c2e)[_0x5364('0x15')](_0x14a95e);}return null;};}function saveUpdates(_0x628cd1){return function(_0x155b78){if(_0x155b78){return _0x155b78['update'](_0x628cd1)[_0x5364('0x1c')](function(_0x2f2e72){return _0x2f2e72;});}return null;};}function removeEntity(_0x312c0c){return function(_0x34e092){if(_0x34e092){return _0x34e092[_0x5364('0x1d')]()[_0x5364('0x1c')](function(){_0x312c0c[_0x5364('0x13')](0xcc)[_0x5364('0x14')]();});}};}function handleEntityNotFound(_0x517a62){return function(_0x43b574){if(!_0x43b574){_0x517a62[_0x5364('0x12')](0x194);}return _0x43b574;};}function handleError(_0x28b7b1,_0x58eb09){_0x58eb09=_0x58eb09||0x1f4;return function(_0x18763d){logger[_0x5364('0x1e')](_0x18763d['stack']);if(_0x18763d[_0x5364('0x1f')]){delete _0x18763d[_0x5364('0x1f')];}_0x28b7b1['status'](_0x58eb09)[_0x5364('0x20')](_0x18763d);};}exports[_0x5364('0x21')]=function(_0x1dac7d,_0x233b1d){var _0x41ab64={};var _0x358f5b=_[_0x5364('0x22')](db[_0x5364('0x23')][_0x5364('0x24')],function(_0x2660b6){return{'name':_0x2660b6[_0x5364('0x25')],'type':_0x2660b6[_0x5364('0x26')][_0x5364('0x27')]};});_0x41ab64=qs['getOptions'](_0x358f5b,_0x1dac7d);return interaction[_0x5364('0x28')](_0x5364('0x29'),_0x1dac7d[_0x5364('0x2a')],_0x1dac7d[_0x5364('0x2b')],_0x41ab64,_0x358f5b)[_0x5364('0x1c')](respondWithFilteredResult(_0x233b1d,_0x41ab64))['catch'](handleError(_0x233b1d,null));};exports[_0x5364('0x2c')]=function(_0x50b083,_0x157581){var _0x31e21a={'raw':![],'where':{'id':_0x50b083['params']['id']}},_0x51fafb={};_0x51fafb[_0x5364('0x2d')]=_[_0x5364('0x2e')](db[_0x5364('0x23')][_0x5364('0x24')]);_0x51fafb[_0x5364('0x2a')]=_[_0x5364('0x2e')](_0x50b083['query']);_0x51fafb[_0x5364('0x2f')]=_[_0x5364('0x30')](_0x51fafb[_0x5364('0x2d')],_0x51fafb[_0x5364('0x2a')]);_0x31e21a[_0x5364('0x31')]=_['intersection'](_0x51fafb['model'],qs['fields'](_0x50b083[_0x5364('0x2a')][_0x5364('0x32')]));_0x31e21a['attributes']=_0x31e21a[_0x5364('0x31')][_0x5364('0x33')]?_0x31e21a['attributes']:_0x51fafb[_0x5364('0x2d')];if(_0x50b083[_0x5364('0x2a')][_0x5364('0x34')]){_0x31e21a[_0x5364('0x35')]=[{'all':!![]}];}_0x31e21a=_[_0x5364('0x36')]({},_0x31e21a,_0x50b083[_0x5364('0x37')]);return db[_0x5364('0x23')][_0x5364('0x38')](_0x31e21a)[_0x5364('0x1c')](handleEntityNotFound(_0x157581,null))[_0x5364('0x1c')](respondWithResult(_0x157581,null))[_0x5364('0x39')](handleError(_0x157581,null));};exports[_0x5364('0x3a')]=function(_0x5c71fb,_0x2f1f01){return db[_0x5364('0x23')][_0x5364('0x3a')](_0x5c71fb[_0x5364('0x3b')],{})['then'](respondWithResult(_0x2f1f01,0xc9))[_0x5364('0x39')](handleError(_0x2f1f01,null));};exports[_0x5364('0x3c')]=function(_0x1205e2,_0x4aae5a){if(_0x1205e2[_0x5364('0x3b')]['id']){delete _0x1205e2[_0x5364('0x3b')]['id'];}return db[_0x5364('0x23')][_0x5364('0x38')]({'where':{'id':_0x1205e2[_0x5364('0x3d')]['id']}})[_0x5364('0x1c')](handleEntityNotFound(_0x4aae5a,null))[_0x5364('0x1c')](saveUpdates(_0x1205e2[_0x5364('0x3b')],null))[_0x5364('0x1c')](respondWithResult(_0x4aae5a,null))[_0x5364('0x39')](handleError(_0x4aae5a,null));};exports[_0x5364('0x1d')]=function(_0x2bc915,_0x4c07e2){return db['SmsInteraction'][_0x5364('0x38')]({'where':{'id':_0x2bc915['params']['id']}})[_0x5364('0x1c')](handleEntityNotFound(_0x4c07e2,null))[_0x5364('0x1c')](removeEntity(_0x4c07e2,null))[_0x5364('0x39')](handleError(_0x4c07e2,null));};exports[_0x5364('0x3e')]=function(_0x3be4ef,_0x35d428){return db[_0x5364('0x23')][_0x5364('0x3e')]()['then'](respondWithResult(_0x35d428,null))['catch'](handleError(_0x35d428,null));};exports[_0x5364('0x3f')]=function(_0x52e8d3,_0x23df12){return db[_0x5364('0x40')][_0x5364('0x38')]({'where':{'id':_0x52e8d3['params']['id']}})[_0x5364('0x1c')](handleEntityNotFound(_0x23df12,null))[_0x5364('0x1c')](function(_0x22ed76){if(_0x22ed76){return _0x22ed76[_0x5364('0x3f')](_0x52e8d3[_0x5364('0x3b')]['ids'],_[_0x5364('0x41')](_0x52e8d3['body'],[_0x5364('0x42'),'id'])||{});}})[_0x5364('0x1c')](respondWithResult(_0x23df12,null))[_0x5364('0x39')](handleError(_0x23df12,null));};exports[_0x5364('0x43')]=function(_0x36c931,_0x4997b2){var _0x48b558={'raw':![],'where':{}};var _0x2278ad={};var _0x2491f7={'count':0x0,'rows':[]};return db[_0x5364('0x23')]['findOne']({'where':{'id':_0x36c931[_0x5364('0x3d')]['id']}})[_0x5364('0x1c')](handleEntityNotFound(_0x4997b2,null))[_0x5364('0x1c')](function(_0x3d99e1){if(_0x3d99e1){_0x2278ad[_0x5364('0x2d')]=_[_0x5364('0x2e')](db[_0x5364('0x40')]['rawAttributes']);_0x2278ad[_0x5364('0x2a')]=_[_0x5364('0x2e')](_0x36c931[_0x5364('0x2a')]);_0x2278ad[_0x5364('0x2f')]=_[_0x5364('0x30')](_0x2278ad[_0x5364('0x2d')],_0x2278ad[_0x5364('0x2a')]);_0x48b558[_0x5364('0x31')]=_['intersection'](_0x2278ad[_0x5364('0x2d')],qs['fields'](_0x36c931['query'][_0x5364('0x32')]));_0x48b558[_0x5364('0x31')]=_0x48b558[_0x5364('0x31')][_0x5364('0x33')]?_0x48b558[_0x5364('0x31')]:_0x2278ad['model'];if(!_0x36c931[_0x5364('0x2a')][_0x5364('0x44')](_0x5364('0x45'))){_0x48b558[_0x5364('0x18')]=qs[_0x5364('0x18')](_0x36c931[_0x5364('0x2a')]['limit']);_0x48b558['offset']=qs[_0x5364('0x16')](_0x36c931[_0x5364('0x2a')][_0x5364('0x16')]);}_0x48b558[_0x5364('0x46')]=qs[_0x5364('0x47')](_0x36c931[_0x5364('0x2a')][_0x5364('0x47')]);_0x48b558[_0x5364('0x48')]=qs[_0x5364('0x2f')](_['pick'](_0x36c931[_0x5364('0x2a')],_0x2278ad['filters']));_0x48b558[_0x5364('0x48')]['SmsInteractionId']=_0x3d99e1['id'];if(_0x36c931[_0x5364('0x2a')][_0x5364('0x49')]){_0x48b558[_0x5364('0x48')]=_[_0x5364('0x36')](_0x48b558[_0x5364('0x48')],{'$or':_[_0x5364('0x22')](_0x48b558[_0x5364('0x31')],function(_0x3db5ec){var _0x3b006f={};_0x3b006f[_0x3db5ec]={'$like':'%'+_0x36c931[_0x5364('0x2a')]['filter']+'%'};return _0x3b006f;})});}if(_0x36c931[_0x5364('0x2a')][_0x5364('0x4a')]){var _0x11d6ac=_0x36c931[_0x5364('0x2a')][_0x5364('0x4a')]['split'](',');var _0x307a9b={};_0x307a9b[_0x11d6ac[0x0]]={'$gte':moment(_0x11d6ac[0x1])[_0x5364('0x4b')](_0x5364('0x4c'))};_0x48b558[_0x5364('0x48')]=_['merge'](_0x48b558[_0x5364('0x48')],_0x307a9b);}_0x48b558=_['merge']({},_0x48b558,_0x36c931[_0x5364('0x37')]);return db['SmsMessage']['count']({'where':_0x48b558[_0x5364('0x48')]})[_0x5364('0x1c')](function(_0x4a44f4){_0x2491f7[_0x5364('0x19')]=_0x4a44f4;if(_0x36c931[_0x5364('0x2a')][_0x5364('0x34')]){_0x48b558[_0x5364('0x35')]=[{'all':!![]}];}return db[_0x5364('0x40')][_0x5364('0x28')](_0x48b558);})['then'](function(_0x347e85){_0x2491f7[_0x5364('0x4d')]=_0x347e85;return _0x2491f7;});}})[_0x5364('0x1c')](respondWithFilteredResult(_0x4997b2,_0x48b558))[_0x5364('0x39')](handleError(_0x4997b2,null));};exports[_0x5364('0x4e')]=function(_0x2035d9,_0x18e364){return db[_0x5364('0x23')]['find']({'where':{'id':_0x2035d9[_0x5364('0x3d')]['id']}})[_0x5364('0x1c')](handleEntityNotFound(_0x18e364,null))['then'](function(_0x17d642){if(_0x17d642){return _0x17d642['setTags'](_0x2035d9['body'][_0x5364('0x42')],_[_0x5364('0x41')](_0x2035d9['body'],[_0x5364('0x42'),'id'])||{})[_0x5364('0x4f')](function(){return db['Tag'][_0x5364('0x28')]({'attributes':['id',_0x5364('0x1f'),_0x5364('0x50')],'where':{'id':_0x2035d9['body'][_0x5364('0x42')]}});})[_0x5364('0x1c')](function(_0x182d6c){socket[_0x5364('0x51')]('smsInteractionTags:save',{'id':Number(_0x2035d9['params']['id']),'tags':_0x182d6c||[]});return{'id':Number(_0x2035d9[_0x5364('0x3d')]['id']),'tags':_0x182d6c||[]};});}})[_0x5364('0x1c')](respondWithResult(_0x18e364,null))[_0x5364('0x39')](handleError(_0x18e364,null));};exports[_0x5364('0x52')]=function(_0x4cd452,_0x3fab54){return db[_0x5364('0x23')][_0x5364('0x38')]({'where':{'id':_0x4cd452[_0x5364('0x3d')]['id']}})[_0x5364('0x1c')](handleEntityNotFound(_0x3fab54,null))[_0x5364('0x1c')](function(_0xd0030b){if(_0xd0030b){return _0xd0030b[_0x5364('0x52')](_0x4cd452[_0x5364('0x2a')][_0x5364('0x42')]);}})[_0x5364('0x1c')](respondWithStatusCode(_0x3fab54,null))[_0x5364('0x39')](handleError(_0x3fab54,null));};exports[_0x5364('0x53')]=function(_0x413e6,_0x5f50e9){var _0x30b0b6=moment()['unix']()[_0x5364('0x54')]();var _0x1da171=path[_0x5364('0x55')](config['root'],_0x5364('0x56'),_0x5364('0x57'),_0x5364('0x58'));var _0x594f14=path['join'](_0x1da171,_0x30b0b6);var _0x4dc17b=util['format']('transcript-%d-%s.zip',_0x413e6[_0x5364('0x3d')]['id'],_0x30b0b6);var _0x5a9d69=path[_0x5364('0x55')](_0x1da171,_0x4dc17b);var _0x2da983=[];_0x2da983['push']({'model':db[_0x5364('0x59')],'as':_0x5364('0x59'),'attributes':['id',_0x5364('0x5a')],'raw':!![]});_0x2da983['push']({'model':db[_0x5364('0x5b')],'as':_0x5364('0x5c'),'attributes':['id','firstName',_0x5364('0x5d')],'raw':!![]});var _0xf48de7=[{'model':db[_0x5364('0x40')],'as':_0x5364('0x5e'),'attributes':['id',_0x5364('0x3b'),_0x5364('0x5f'),_0x5364('0x60'),_0x5364('0x61'),'read'],'include':_0x2da983}];_0xf48de7['push']({'model':db[_0x5364('0x62')],'as':'Account','attributes':['id',_0x5364('0x1f')]});_0xf48de7[_0x5364('0x63')]({'model':db[_0x5364('0x59')],'as':_0x5364('0x64'),'attributes':['id',_0x5364('0x5a')]});return db['SmsInteraction'][_0x5364('0x38')]({'where':{'id':_0x413e6[_0x5364('0x3d')]['id']},'include':_0xf48de7})[_0x5364('0x1c')](handleEntityNotFound(_0x5f50e9,null))[_0x5364('0x1c')](function(_0x5485ec){if(_0x5485ec){var _0x5775b3=_0x5485ec[_0x5364('0x65')]({'plain':!![]});fs['mkdirSync'](_0x594f14);var _0x105bca={'channel':_0x5364('0x66'),'account':_0x5775b3[_0x5364('0x67')][_0x5364('0x1f')],'agent':_0x5775b3[_0x5364('0x64')]?_0x5775b3[_0x5364('0x64')][_0x5364('0x5a')]:_0x5364('0x68'),'createdAt':moment(_0x5775b3[_0x5364('0x5f')])[_0x5364('0x4b')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x5775b3[_0x5364('0x69')]?moment(_0x5775b3['closedAt'])[_0x5364('0x4b')](_0x5364('0x4c'))['toString']():'','disposition':_0x5775b3['disposition'],'messages':_(_0x5775b3['Messages'])[_0x5364('0x49')]({'secret':![]})[_0x5364('0x22')](function(_0x1ec379){return{'date':moment(_0x1ec379['createdAt'])['format'](_0x5364('0x4c'))[_0x5364('0x54')](),'sender':_0x1ec379[_0x5364('0x60')]===_0x5364('0x6a')?_0x1ec379['User']?_0x1ec379[_0x5364('0x59')][_0x5364('0x5a')]:_0x5364('0x6b'):_0x1ec379['Contact'][_0x5364('0x6c')]+(_0x1ec379['Contact'][_0x5364('0x5d')]?'\x20'+_0x1ec379['Contact'][_0x5364('0x5d')]:''),'body':_0x1ec379['body'],'direction':_0x1ec379[_0x5364('0x60')]===_0x5364('0x6a')?'A':'C','secret':_0x1ec379[_0x5364('0x61')],'read':_0x1ec379['read']};})[_0x5364('0x6d')]()};return ejs[_0x5364('0x6e')](path[_0x5364('0x55')](config[_0x5364('0x6f')],_0x5364('0x56'),_0x5364('0x70'),_0x5364('0x71')),{'interaction':_0x105bca})[_0x5364('0x1c')](function(_0x1ec8be){var _0x28719a=path[_0x5364('0x55')](_0x594f14,'transcript-'+_0x5775b3['id']+'-'+_0x30b0b6+_0x5364('0x72'));var _0xb09259={'path':_0x28719a,'channel':_0x5364('0x66'),'interactionId':_0x5775b3['id']};return pdf[_0x5364('0x73')](_0x1ec8be,_0xb09259);})[_0x5364('0x1c')](function(){return new BPromise(function(_0x22467c,_0x217aac){zipdir(_0x594f14,{'saveTo':_0x5a9d69},function(_0x5776f6,_0x10d1a7){if(_0x5776f6)return _0x217aac(_0x5776f6);return _0x22467c(_0x10d1a7);});})[_0x5364('0x1c')](function(){return new BPromise(function(_0x17c20b,_0x5ef43d){rimraf(_0x594f14,function(_0x48dfd8){if(_0x48dfd8)_0x5ef43d(_0x48dfd8);return _0x17c20b();});});})[_0x5364('0x1c')](function(){return _0x5f50e9[_0x5364('0x53')](_0x5a9d69,_0x4dc17b,function(_0x2773b5){if(_0x2773b5){console['log'](_0x5364('0x74'),_0x2773b5);}else{fs[_0x5364('0x75')](_0x5a9d69);}});});});}else{return _0x5f50e9[_0x5364('0x12')](0xc8);}})['catch'](handleError(_0x5f50e9,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index b2f8919..af8f419 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 _0x0120=['hasOwnProperty','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','setDataValue','Users','map','then','unreadMessages','emit','catch'];(function(_0x23c73d,_0x357b21){var _0x36ba47=function(_0x317b8e){while(--_0x317b8e){_0x23c73d['push'](_0x23c73d['shift']());}};_0x36ba47(++_0x357b21);}(_0x0120,0x6f));var _0x0012=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x0120[_0x46aff0];return _0x9d78cf;};'use strict';var EventEmitter=require(_0x0012('0x0'));var SmsInteraction=require(_0x0012('0x1'))['db'][_0x0012('0x2')];var SmsMessage=require(_0x0012('0x1'))['db'][_0x0012('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x0012('0x4')](0x0);var events={'afterCreate':_0x0012('0x5'),'afterUpdate':_0x0012('0x6'),'afterDestroy':_0x0012('0x7')};function emitEvent(_0x302029){return function(_0x3505ab,_0x3fcfbc,_0x4eaa5b){_0x3505ab['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x95d441){_0x3505ab[_0x0012('0x8')](_0x0012('0x9'),_0x95d441[_0x0012('0xa')](function(_0x33c82f){return{'id':_0x33c82f['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x3505ab['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0012('0xb')](function(_0x2d484c){_0x3505ab[_0x0012('0x8')](_0x0012('0xc'),_0x2d484c['length']);SmsInteractionEvents[_0x0012('0xd')](_0x302029+':'+_0x3505ab['id'],_0x3505ab);SmsInteractionEvents['emit'](_0x302029,_0x3505ab);_0x4eaa5b(null);})[_0x0012('0xe')](_0x4eaa5b(null));};}for(var e in events){if(events[_0x0012('0xf')](e)){var event=events[e];SmsInteraction[_0x0012('0x10')](e,emitEvent(event));}}module[_0x0012('0x11')]=SmsInteractionEvents; \ No newline at end of file +var _0x958a=['findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','getUsers','then','setDataValue','Users'];(function(_0x574a93,_0x59ded6){var _0x11046f=function(_0x3df923){while(--_0x3df923){_0x574a93['push'](_0x574a93['shift']());}};_0x11046f(++_0x59ded6);}(_0x958a,0x128));var _0xa958=function(_0xa1484e,_0x2a3562){_0xa1484e=_0xa1484e-0x0;var _0x404703=_0x958a[_0xa1484e];return _0x404703;};'use strict';var EventEmitter=require(_0xa958('0x0'));var SmsInteraction=require(_0xa958('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0xa958('0x1'))['db'][_0xa958('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xa958('0x3')](0x0);var events={'afterCreate':_0xa958('0x4'),'afterUpdate':_0xa958('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3424b0){return function(_0x578481,_0x2024b8,_0x9b7d9e){_0x578481[_0xa958('0x6')]({'attributes':['id'],'raw':!![]})[_0xa958('0x7')](function(_0x3ca01f){_0x578481[_0xa958('0x8')](_0xa958('0x9'),_0x3ca01f['map'](function(_0x514b4f){return{'id':_0x514b4f['id']};}));return SmsMessage[_0xa958('0xa')]({'where':{'SmsInteractionId':_0x578481['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa958('0x7')](function(_0x11f090){_0x578481[_0xa958('0x8')](_0xa958('0xb'),_0x11f090[_0xa958('0xc')]);SmsInteractionEvents[_0xa958('0xd')](_0x3424b0+':'+_0x578481['id'],_0x578481);SmsInteractionEvents[_0xa958('0xd')](_0x3424b0,_0x578481);_0x9b7d9e(null);})[_0xa958('0xe')](_0x9b7d9e(null));};}for(var e in events){if(events[_0xa958('0xf')](e)){var event=events[e];SmsInteraction[_0xa958('0x10')](e,emitEvent(event));}}module[_0xa958('0x11')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 6c9c671..27fafaa 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 _0x549f=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','exports','define','sms_interactions','changed','closed','closedAt','format'];(function(_0x47c910,_0x9db31c){var _0x55805f=function(_0x1ed46c){while(--_0x1ed46c){_0x47c910['push'](_0x47c910['shift']());}};_0x55805f(++_0x9db31c);}(_0x549f,0xc1));var _0xf549=function(_0x27bbf8,_0x137d54){_0x27bbf8=_0x27bbf8-0x0;var _0x49b87d=_0x549f[_0x27bbf8];return _0x49b87d;};'use strict';var _=require(_0xf549('0x0'));var util=require(_0xf549('0x1'));var logger=require(_0xf549('0x2'))(_0xf549('0x3'));var moment=require(_0xf549('0x4'));var BPromise=require('bluebird');var rp=require(_0xf549('0x5'));var fs=require('fs');var path=require(_0xf549('0x6'));var rimraf=require(_0xf549('0x7'));var config=require('../../config/environment');var attributes=require('./smsInteraction.attributes');module[_0xf549('0x8')]=function(_0x24e7a6,_0x675533){return _0x24e7a6[_0xf549('0x9')]('SmsInteraction',attributes,{'tableName':_0xf549('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5a9428,_0x1ccafe,_0x2155a6){if(_0x5a9428[_0xf549('0xb')](_0xf549('0xc'))){_0x5a9428[_0xf549('0xd')]=moment()[_0xf549('0xe')](_0xf549('0xf'));}_0x2155a6(null,_0x5a9428);}}});}; \ No newline at end of file +var _0x55b3=['../../config/environment','exports','define','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','rimraf'];(function(_0x22b396,_0x5a848d){var _0x5e78b2=function(_0x151832){while(--_0x151832){_0x22b396['push'](_0x22b396['shift']());}};_0x5e78b2(++_0x5a848d);}(_0x55b3,0x1bc));var _0x355b=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0x55b3[_0x476bf4];return _0x788ffe;};'use strict';var _=require(_0x355b('0x0'));var util=require(_0x355b('0x1'));var logger=require(_0x355b('0x2'))(_0x355b('0x3'));var moment=require(_0x355b('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x355b('0x5'));var config=require(_0x355b('0x6'));var attributes=require('./smsInteraction.attributes');module[_0x355b('0x7')]=function(_0x20002c,_0x4b714f){return _0x20002c[_0x355b('0x8')]('SmsInteraction',attributes,{'tableName':_0x355b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3b4539,_0x579794,_0x27242c){if(_0x3b4539[_0x355b('0xa')](_0x355b('0xb'))){_0x3b4539[_0x355b('0xc')]=moment()[_0x355b('0xd')](_0x355b('0xe'));}_0x27242c(null,_0x3b4539);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 8dffbdc..0ce3863 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 _0x5b11=['jayson/promise','client','http','redis','localhost','./smsInteraction.socket','register','request','then','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateSmsInteraction','body','options','where','attributes','catch','AddTagsToSmsInteraction','SmsInteraction','find','addTags','ids','omit','spread','info','AddTags','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1773f7,_0x54318f){var _0x1983fb=function(_0x50b543){while(--_0x50b543){_0x1773f7['push'](_0x1773f7['shift']());}};_0x1983fb(++_0x54318f);}(_0x5b11,0x19b));var _0x15b1=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5b11[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x15b1('0x0'));var util=require(_0x15b1('0x1'));var moment=require(_0x15b1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x15b1('0x3'));var db=require(_0x15b1('0x4'))['db'];var utils=require(_0x15b1('0x5'));var logger=require(_0x15b1('0x6'))(_0x15b1('0x7'));var config=require(_0x15b1('0x8'));var jayson=require(_0x15b1('0x9'));var client=jayson[_0x15b1('0xa')][_0x15b1('0xb')]({'port':0x232a});config[_0x15b1('0xc')]=_['defaults'](config[_0x15b1('0xc')],{'host':_0x15b1('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x15b1('0xc')]));require(_0x15b1('0xe'))[_0x15b1('0xf')](socket);function respondWithRpcPromise(_0x3fdc5d,_0x3d9dca,_0x9c0520){return new BPromise(function(_0x2926c9,_0x2b062b){return client[_0x15b1('0x10')](_0x3fdc5d,_0x9c0520)[_0x15b1('0x11')](function(_0x1a7afb){logger['info'](_0x15b1('0x12'),_0x3d9dca,_0x15b1('0x13'));logger[_0x15b1('0x14')](_0x15b1('0x15'),_0x3d9dca,_0x15b1('0x13'),JSON[_0x15b1('0x16')](_0x1a7afb));if(_0x1a7afb[_0x15b1('0x17')]){if(_0x1a7afb[_0x15b1('0x17')][_0x15b1('0x18')]===0x1f4){logger[_0x15b1('0x17')](_0x15b1('0x12'),_0x3d9dca,_0x1a7afb[_0x15b1('0x17')][_0x15b1('0x19')]);return _0x2b062b(_0x1a7afb[_0x15b1('0x17')][_0x15b1('0x19')]);}logger[_0x15b1('0x17')](_0x15b1('0x12'),_0x3d9dca,_0x1a7afb[_0x15b1('0x17')]['message']);return _0x2926c9(_0x1a7afb[_0x15b1('0x17')][_0x15b1('0x19')]);}else{logger['info'](_0x15b1('0x12'),_0x3d9dca,'request\x20sent');_0x2926c9(_0x1a7afb[_0x15b1('0x1a')][_0x15b1('0x19')]);}})['catch'](function(_0x59c446){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x3d9dca,_0x59c446);_0x2b062b(_0x59c446);});});}exports[_0x15b1('0x1b')]=function(_0x94e6b3){var _0x4ebe08=this;return new Promise(function(_0xc8ba6c,_0x310ee5){return db['SmsInteraction']['update'](_0x94e6b3[_0x15b1('0x1c')],{'raw':_0x94e6b3[_0x15b1('0x1d')]?_0x94e6b3[_0x15b1('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x94e6b3[_0x15b1('0x1d')]?_0x94e6b3['options'][_0x15b1('0x1e')]||null:null,'attributes':_0x94e6b3['options']?_0x94e6b3[_0x15b1('0x1d')][_0x15b1('0x1f')]||null:null,'limit':_0x94e6b3[_0x15b1('0x1d')]?_0x94e6b3[_0x15b1('0x1d')]['limit']||null:null})[_0x15b1('0x11')](function(_0x670adf){logger['info'](_0x15b1('0x1b'),_0x94e6b3);logger['debug'](_0x15b1('0x1b'),_0x94e6b3,JSON[_0x15b1('0x16')](_0x670adf));_0xc8ba6c(_0x670adf);})[_0x15b1('0x20')](function(_0x3d24e6){logger['error'](_0x15b1('0x1b'),_0x3d24e6[_0x15b1('0x19')],_0x94e6b3);_0x310ee5(_0x4ebe08['error'](0x1f4,_0x3d24e6[_0x15b1('0x19')]));});});};exports[_0x15b1('0x21')]=function(_0x265cd9){return new Promise(function(_0x2a3636,_0xa3db64){return db[_0x15b1('0x22')][_0x15b1('0x23')]({'where':_0x265cd9[_0x15b1('0x1d')]?_0x265cd9[_0x15b1('0x1d')][_0x15b1('0x1e')]||null:null})[_0x15b1('0x11')](function(_0x6c1c17){if(_0x6c1c17){return _0x6c1c17[_0x15b1('0x24')](_0x265cd9['body'][_0x15b1('0x25')],_[_0x15b1('0x26')](_0x265cd9['body'],[_0x15b1('0x25'),'id'])||{});}})[_0x15b1('0x27')](function(_0x5140d4){logger[_0x15b1('0x28')](_0x15b1('0x29'),_0x265cd9);logger[_0x15b1('0x14')](_0x15b1('0x29'),_0x265cd9,JSON[_0x15b1('0x16')](_0x5140d4));_0x2a3636(_0x5140d4);})[_0x15b1('0x20')](function(_0x3e4fcb){logger['error'](_0x15b1('0x29'),_0x3e4fcb['message'],_0x265cd9);_0xa3db64(_this['error'](0x1f4,_0x3e4fcb[_0x15b1('0x19')]));});});}; \ No newline at end of file +var _0xadd5=['AddTags','stringify','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','then','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','message','info','request\x20sent','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','limit','catch','AddTagsToSmsInteraction','find','addTags','ids','omit','spread'];(function(_0x4a4927,_0x2310c1){var _0x1fca8e=function(_0x17aec8){while(--_0x17aec8){_0x4a4927['push'](_0x4a4927['shift']());}};_0x1fca8e(++_0x2310c1);}(_0xadd5,0x7d));var _0x5add=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xadd5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5add('0x0'));var util=require('util');var moment=require(_0x5add('0x1'));var BPromise=require(_0x5add('0x2'));var rs=require(_0x5add('0x3'));var fs=require('fs');var Redis=require(_0x5add('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5add('0x5'));var logger=require(_0x5add('0x6'))('rpc');var config=require(_0x5add('0x7'));var jayson=require(_0x5add('0x8'));var client=jayson[_0x5add('0x9')]['http']({'port':0x232a});config[_0x5add('0xa')]=_[_0x5add('0xb')](config['redis'],{'host':_0x5add('0xc'),'port':0x18eb});var socket=require(_0x5add('0xd'))(new Redis(config[_0x5add('0xa')]));require(_0x5add('0xe'))[_0x5add('0xf')](socket);function respondWithRpcPromise(_0x3d4e54,_0x30797c,_0x2a4efa){return new BPromise(function(_0x1379b0,_0x402c27){return client['request'](_0x3d4e54,_0x2a4efa)[_0x5add('0x10')](function(_0x1a58d3){logger['info'](_0x5add('0x11'),_0x30797c,'request\x20sent');logger[_0x5add('0x12')](_0x5add('0x13'),_0x30797c,'request\x20sent',JSON['stringify'](_0x1a58d3));if(_0x1a58d3['error']){if(_0x1a58d3[_0x5add('0x14')]['code']===0x1f4){logger[_0x5add('0x14')](_0x5add('0x11'),_0x30797c,_0x1a58d3[_0x5add('0x14')][_0x5add('0x15')]);return _0x402c27(_0x1a58d3['error']['message']);}logger['error']('SmsInteraction,\x20%s,\x20%s',_0x30797c,_0x1a58d3['error']['message']);return _0x1379b0(_0x1a58d3[_0x5add('0x14')][_0x5add('0x15')]);}else{logger[_0x5add('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x30797c,_0x5add('0x17'));_0x1379b0(_0x1a58d3['result'][_0x5add('0x15')]);}})['catch'](function(_0x444148){logger[_0x5add('0x14')](_0x5add('0x11'),_0x30797c,_0x444148);_0x402c27(_0x444148);});});}exports[_0x5add('0x18')]=function(_0x17dd64){var _0x463ff4=this;return new Promise(function(_0x367727,_0x596e19){return db[_0x5add('0x19')][_0x5add('0x1a')](_0x17dd64[_0x5add('0x1b')],{'raw':_0x17dd64[_0x5add('0x1c')]?_0x17dd64[_0x5add('0x1c')][_0x5add('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17dd64['options']?_0x17dd64[_0x5add('0x1c')][_0x5add('0x1e')]||null:null,'attributes':_0x17dd64['options']?_0x17dd64[_0x5add('0x1c')]['attributes']||null:null,'limit':_0x17dd64[_0x5add('0x1c')]?_0x17dd64[_0x5add('0x1c')][_0x5add('0x1f')]||null:null})[_0x5add('0x10')](function(_0x9c606){logger[_0x5add('0x16')](_0x5add('0x18'),_0x17dd64);logger['debug'](_0x5add('0x18'),_0x17dd64,JSON['stringify'](_0x9c606));_0x367727(_0x9c606);})[_0x5add('0x20')](function(_0x5a797f){logger[_0x5add('0x14')](_0x5add('0x18'),_0x5a797f[_0x5add('0x15')],_0x17dd64);_0x596e19(_0x463ff4[_0x5add('0x14')](0x1f4,_0x5a797f['message']));});});};exports[_0x5add('0x21')]=function(_0x37b3af){return new Promise(function(_0x44c90c,_0x26921b){return db['SmsInteraction'][_0x5add('0x22')]({'where':_0x37b3af[_0x5add('0x1c')]?_0x37b3af[_0x5add('0x1c')][_0x5add('0x1e')]||null:null})[_0x5add('0x10')](function(_0x5c1a79){if(_0x5c1a79){return _0x5c1a79[_0x5add('0x23')](_0x37b3af[_0x5add('0x1b')][_0x5add('0x24')],_[_0x5add('0x25')](_0x37b3af[_0x5add('0x1b')],[_0x5add('0x24'),'id'])||{});}})[_0x5add('0x26')](function(_0xe4d68b){logger['info']('AddTags',_0x37b3af);logger[_0x5add('0x12')](_0x5add('0x27'),_0x37b3af,JSON[_0x5add('0x28')](_0xe4d68b));_0x44c90c(_0xe4d68b);})[_0x5add('0x20')](function(_0x47d309){logger['error'](_0x5add('0x27'),_0x47d309[_0x5add('0x15')],_0x37b3af);_0x26921b(_this[_0x5add('0x14')](0x1f4,_0x47d309[_0x5add('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 3f48de2..e963e87 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 _0xd885=['emit','register','./smsInteraction.events','save'];(function(_0x25e378,_0x2d638b){var _0x25dee1=function(_0x26f04b){while(--_0x26f04b){_0x25e378['push'](_0x25e378['shift']());}};_0x25dee1(++_0x2d638b);}(_0xd885,0x176));var _0x5d88=function(_0x280177,_0x3d1efb){_0x280177=_0x280177-0x0;var _0x2dd41f=_0xd885[_0x280177];return _0x2dd41f;};'use strict';var SmsInteractionEvents=require(_0x5d88('0x0'));var events=[_0x5d88('0x1'),'remove','update'];function createListener(_0x4106d3,_0x5206fb){return function(_0xcb65f3){_0x5206fb[_0x5d88('0x2')](_0x4106d3,_0xcb65f3);};}function removeListener(_0x2e45f2,_0x1d9aae){return function(){SmsInteractionEvents['removeListener'](_0x2e45f2,_0x1d9aae);};}exports[_0x5d88('0x3')]=function(_0x6a063c){for(var _0x59b2fb=0x0,_0x398adc=events['length'];_0x59b2fb<_0x398adc;_0x59b2fb++){var _0x589211=events[_0x59b2fb];var _0x307f99=createListener('smsInteraction:'+_0x589211,_0x6a063c);SmsInteractionEvents['on'](_0x589211,_0x307f99);}}; \ No newline at end of file +var _0x410d=['save','remove','update','removeListener','register','length','smsInteraction:','./smsInteraction.events'];(function(_0x465fc9,_0x15f960){var _0xd4b04f=function(_0x44fdc8){while(--_0x44fdc8){_0x465fc9['push'](_0x465fc9['shift']());}};_0xd4b04f(++_0x15f960);}(_0x410d,0x117));var _0xd410=function(_0x4bd950,_0x184ed5){_0x4bd950=_0x4bd950-0x0;var _0x5dc59a=_0x410d[_0x4bd950];return _0x5dc59a;};'use strict';var SmsInteractionEvents=require(_0xd410('0x0'));var events=[_0xd410('0x1'),_0xd410('0x2'),_0xd410('0x3')];function createListener(_0x104e1f,_0x4683ba){return function(_0x1be8c9){_0x4683ba['emit'](_0x104e1f,_0x1be8c9);};}function removeListener(_0x2c074b,_0x3f1b1e){return function(){SmsInteractionEvents[_0xd410('0x4')](_0x2c074b,_0x3f1b1e);};}exports[_0xd410('0x5')]=function(_0x1978fd){for(var _0x3ed3da=0x0,_0x1eeaf1=events[_0xd410('0x6')];_0x3ed3da<_0x1eeaf1;_0x3ed3da++){var _0x5a2750=events[_0x3ed3da];var _0x3d9815=createListener(_0xd410('0x7')+_0x5a2750,_0x1978fd);SmsInteractionEvents['on'](_0x5a2750,_0x3d9815);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index c76fe4d..e9564a5 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 _0xfb0d=['/describe','describe','/:id','show','post','tracked','create','status','put','update','/:id/accept','accept','reject','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsMessage.controller','isAuthenticated','get'];(function(_0x5e6c88,_0x1719c8){var _0x5bc20a=function(_0x24866e){while(--_0x24866e){_0x5e6c88['push'](_0x5e6c88['shift']());}};_0x5bc20a(++_0x1719c8);}(_0xfb0d,0xf0));var _0xdfb0=function(_0x573182,_0x5ebd7a){_0x573182=_0x573182-0x0;var _0xc6df87=_0xfb0d[_0x573182];return _0xc6df87;};'use strict';var multer=require(_0xdfb0('0x0'));var util=require(_0xdfb0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdfb0('0x2'));var router=express[_0xdfb0('0x3')]();var fs_extra=require(_0xdfb0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xdfb0('0x5'));var config=require(_0xdfb0('0x6'));var controller=require(_0xdfb0('0x7'));router['get']('/',auth[_0xdfb0('0x8')](),controller['index']);router[_0xdfb0('0x9')](_0xdfb0('0xa'),auth[_0xdfb0('0x8')](),controller[_0xdfb0('0xb')]);router[_0xdfb0('0x9')](_0xdfb0('0xc'),auth[_0xdfb0('0x8')](),controller[_0xdfb0('0xd')]);router[_0xdfb0('0xe')]('/',auth[_0xdfb0('0x8')](),interaction[_0xdfb0('0xf')]('sms','smsmessage:create'),controller[_0xdfb0('0x10')]);router[_0xdfb0('0xe')]('/:id/status',controller[_0xdfb0('0x11')]);router[_0xdfb0('0x12')](_0xdfb0('0xc'),auth['isAuthenticated'](),controller[_0xdfb0('0x13')]);router['put'](_0xdfb0('0x14'),auth[_0xdfb0('0x8')](),controller[_0xdfb0('0x15')]);router[_0xdfb0('0x12')]('/:id/reject',auth[_0xdfb0('0x8')](),controller[_0xdfb0('0x16')]);router['delete']('/:id',auth[_0xdfb0('0x8')](),controller[_0xdfb0('0x17')]);module[_0xdfb0('0x18')]=router; \ No newline at end of file +var _0x1a4d=['isAuthenticated','index','get','/describe','describe','/:id','show','sms','smsmessage:create','create','post','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller'];(function(_0x243189,_0x1e7b75){var _0x372755=function(_0x5e976b){while(--_0x5e976b){_0x243189['push'](_0x243189['shift']());}};_0x372755(++_0x1e7b75);}(_0x1a4d,0x189));var _0xd1a4=function(_0x2ea103,_0x54e454){_0x2ea103=_0x2ea103-0x0;var _0x1c5b5d=_0x1a4d[_0x2ea103];return _0x1c5b5d;};'use strict';var multer=require(_0xd1a4('0x0'));var util=require(_0xd1a4('0x1'));var path=require('path');var timeout=require(_0xd1a4('0x2'));var express=require(_0xd1a4('0x3'));var router=express[_0xd1a4('0x4')]();var fs_extra=require(_0xd1a4('0x5'));var auth=require(_0xd1a4('0x6'));var interaction=require(_0xd1a4('0x7'));var config=require(_0xd1a4('0x8'));var controller=require(_0xd1a4('0x9'));router['get']('/',auth[_0xd1a4('0xa')](),controller[_0xd1a4('0xb')]);router[_0xd1a4('0xc')](_0xd1a4('0xd'),auth[_0xd1a4('0xa')](),controller[_0xd1a4('0xe')]);router[_0xd1a4('0xc')](_0xd1a4('0xf'),auth[_0xd1a4('0xa')](),controller[_0xd1a4('0x10')]);router['post']('/',auth[_0xd1a4('0xa')](),interaction['tracked'](_0xd1a4('0x11'),_0xd1a4('0x12')),controller[_0xd1a4('0x13')]);router[_0xd1a4('0x14')](_0xd1a4('0x15'),controller[_0xd1a4('0x16')]);router[_0xd1a4('0x17')](_0xd1a4('0xf'),auth[_0xd1a4('0xa')](),controller[_0xd1a4('0x18')]);router['put'](_0xd1a4('0x19'),auth['isAuthenticated'](),controller[_0xd1a4('0x1a')]);router[_0xd1a4('0x17')](_0xd1a4('0x1b'),auth['isAuthenticated'](),controller[_0xd1a4('0x1c')]);router[_0xd1a4('0x1d')]('/:id',auth['isAuthenticated'](),controller[_0xd1a4('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 8b85df1..2390cf5 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 _0x2409=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize'];(function(_0x22a01d,_0x24340b){var _0x1d3c40=function(_0x45cb1e){while(--_0x45cb1e){_0x22a01d['push'](_0x22a01d['shift']());}};_0x1d3c40(++_0x24340b);}(_0x2409,0x128));var _0x9240=function(_0x282856,_0x5ec9e1){_0x282856=_0x282856-0x0;var _0x2741aa=_0x2409[_0x282856];return _0x2741aa;};'use strict';var Sequelize=require(_0x9240('0x0'));module[_0x9240('0x1')]={'body':{'type':Sequelize[_0x9240('0x2')](_0x9240('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x9240('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9240('0x5')]('in','out'),'defaultValue':_0x9240('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x9240('0x7')](0xbe)},'phone':{'type':Sequelize[_0x9240('0x7')]},'readAt':{'type':Sequelize[_0x9240('0x8')]},'secret':{'type':Sequelize[_0x9240('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x9240('0x2')]}}; \ No newline at end of file +var _0xcdc2=['sequelize','TEXT','BOOLEAN','out','STRING','DATE'];(function(_0x70fce,_0x59f234){var _0x4d69eb=function(_0x1ab5e1){while(--_0x1ab5e1){_0x70fce['push'](_0x70fce['shift']());}};_0x4d69eb(++_0x59f234);}(_0xcdc2,0xae));var _0x2cdc=function(_0x55689e,_0x54b22e){_0x55689e=_0x55689e-0x0;var _0x21ffde=_0xcdc2[_0x55689e];return _0x21ffde;};'use strict';var Sequelize=require(_0x2cdc('0x0'));module['exports']={'body':{'type':Sequelize[_0x2cdc('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x2cdc('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x2cdc('0x3')),'defaultValue':_0x2cdc('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0x2cdc('0x4')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x2cdc('0x5')]},'secret':{'type':Sequelize[_0x2cdc('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x2cdc('0x4')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index c3a2ab2..a21df04 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 _0xd7a4=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','stack','name','send','map','SmsMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','VIRTUAL','options','includeAll','findAll','rows','show','include','merge','find','create','body','params','describe','../../config/logger','sms-interactions','accept','sms','read','readAt','format','UserId','user','agent','get','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','contact','User','fullname','SIP/%s','motionChannel','event','EventManager','acceptmessage','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','Sequelize','SELECT','internal','channel','rejectmessage','SmsAccount','SmsAccountId','inspect','twilio','SmsAccount,\x20%s,\x20%s,\x20%s','MessageUUID','messageId','sent','plivio','infobip','groupName','DELIVERED','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x2fef4e,_0x5b9195){var _0x1a2643=function(_0x464990){while(--_0x464990){_0x2fef4e['push'](_0x2fef4e['shift']());}};_0x1a2643(++_0x5b9195);}(_0xd7a4,0x7e));var _0x4d7a=function(_0x4a3a56,_0x4d7a7f){_0x4a3a56=_0x4a3a56-0x0;var _0xf32477=_0xd7a4[_0x4a3a56];return _0xf32477;};'use strict';var emlformat=require(_0x4d7a('0x0'));var rimraf=require(_0x4d7a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4d7a('0x2'));var rp=require(_0x4d7a('0x3'));var moment=require(_0x4d7a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4d7a('0x5'));var util=require('util');var path=require(_0x4d7a('0x6'));var sox=require('sox');var csv=require(_0x4d7a('0x7'));var ejs=require(_0x4d7a('0x8'));var fs=require('fs');var fs_extra=require(_0x4d7a('0x9'));var _=require(_0x4d7a('0xa'));var squel=require(_0x4d7a('0xb'));var crypto=require(_0x4d7a('0xc'));var jsforce=require(_0x4d7a('0xd'));var deskjs=require(_0x4d7a('0xe'));var toCsv=require(_0x4d7a('0x7'));var querystring=require('querystring');var Papa=require(_0x4d7a('0xf'));var Redis=require('ioredis');var authService=require(_0x4d7a('0x10'));var qs=require(_0x4d7a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4d7a('0x12'));var utils=require(_0x4d7a('0x13'));var config=require(_0x4d7a('0x14'));var licenseUtil=require(_0x4d7a('0x15'));var db=require(_0x4d7a('0x16'))['db'];config[_0x4d7a('0x17')]=_[_0x4d7a('0x18')](config[_0x4d7a('0x17')],{'host':_0x4d7a('0x19'),'port':0x18eb});var socket=require(_0x4d7a('0x1a'))(new Redis(config[_0x4d7a('0x17')]));require(_0x4d7a('0x1b'))[_0x4d7a('0x1c')](socket);var jayson=require(_0x4d7a('0x1d'));var client=jayson[_0x4d7a('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0x4d7a('0x1e')][_0x4d7a('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x2a776c,_0x481fdf,_0x4216e9,_0x3cd559){return new BPromise(function(_0x24448d,_0x37fb31){var _0x1f6083=_0x3cd559||client;return _0x1f6083[_0x4d7a('0x20')](_0x2a776c,_0x4216e9)[_0x4d7a('0x21')](function(_0x34a72e){logger[_0x4d7a('0x22')]('SmsMessage,\x20%s,\x20%s',_0x481fdf,_0x4d7a('0x23'));logger['debug'](_0x4d7a('0x24'),_0x481fdf,_0x4d7a('0x23'),JSON[_0x4d7a('0x25')](_0x34a72e));if(_0x34a72e[_0x4d7a('0x26')]){if(_0x34a72e['error'][_0x4d7a('0x27')]===0x1f4){logger[_0x4d7a('0x26')](_0x4d7a('0x28'),_0x481fdf,_0x34a72e[_0x4d7a('0x26')][_0x4d7a('0x29')]);return _0x37fb31(_0x34a72e[_0x4d7a('0x26')][_0x4d7a('0x29')]);}logger[_0x4d7a('0x26')]('SmsMessage,\x20%s,\x20%s',_0x481fdf,_0x34a72e[_0x4d7a('0x26')]['message']);return _0x24448d(_0x34a72e['error'][_0x4d7a('0x29')]);}else{logger[_0x4d7a('0x22')](_0x4d7a('0x28'),_0x481fdf,_0x4d7a('0x23'));_0x24448d(_0x34a72e[_0x4d7a('0x2a')][_0x4d7a('0x29')]);}})[_0x4d7a('0x2b')](function(_0x467dcb){logger[_0x4d7a('0x26')]('SmsMessage,\x20%s,\x20%s',_0x481fdf,_0x467dcb);_0x37fb31(_0x467dcb);});});}function respondWithStatusCode(_0x3631b0,_0x7f1eb8){_0x7f1eb8=_0x7f1eb8||0xcc;return function(_0x1c2636){if(_0x1c2636){return _0x3631b0[_0x4d7a('0x2c')](_0x7f1eb8);}return _0x3631b0[_0x4d7a('0x2d')](_0x7f1eb8)[_0x4d7a('0x2e')]();};}function respondWithResult(_0x311bd9,_0x1cd9bf){_0x1cd9bf=_0x1cd9bf||0xc8;return function(_0x5b0fec){if(_0x5b0fec){return _0x311bd9[_0x4d7a('0x2d')](_0x1cd9bf)[_0x4d7a('0x2f')](_0x5b0fec);}};}function respondWithFilteredResult(_0x4cc274,_0x2840c7){return function(_0xfbb503){if(_0xfbb503){var _0x5bae65=typeof _0x2840c7[_0x4d7a('0x30')]===_0x4d7a('0x31')&&typeof _0x2840c7[_0x4d7a('0x32')]===_0x4d7a('0x31');var _0x580df1=_0xfbb503[_0x4d7a('0x33')];var _0x4bf26a=_0x5bae65?0x0:_0x2840c7['offset'];var _0x57e610=_0x5bae65?_0xfbb503[_0x4d7a('0x33')]:_0x2840c7[_0x4d7a('0x30')]+_0x2840c7['limit'];var _0xa0542e;if(_0x57e610>=_0x580df1){_0x57e610=_0x580df1;_0xa0542e=0xc8;}else{_0xa0542e=0xce;}_0x4cc274['status'](_0xa0542e);return _0x4cc274[_0x4d7a('0x34')](_0x4d7a('0x35'),_0x4bf26a+'-'+_0x57e610+'/'+_0x580df1)[_0x4d7a('0x2f')](_0xfbb503);}return null;};}function patchUpdates(_0x3e4f5f){return function(_0xbd62d2){try{jsonpatch['apply'](_0xbd62d2,_0x3e4f5f,!![]);}catch(_0x582ef1){return BPromise[_0x4d7a('0x36')](_0x582ef1);}return _0xbd62d2[_0x4d7a('0x37')]();};}function saveUpdates(_0x3a993f,_0x38b1d8){return function(_0x2a6744){if(_0x2a6744){return _0x2a6744[_0x4d7a('0x38')](_0x3a993f)[_0x4d7a('0x21')](function(_0x5ec5ad){return _0x5ec5ad;});}return null;};}function removeEntity(_0x2067e9,_0x5cace9){return function(_0x359178){if(_0x359178){return _0x359178[_0x4d7a('0x39')]()[_0x4d7a('0x21')](function(){_0x2067e9[_0x4d7a('0x2d')](0xcc)[_0x4d7a('0x2e')]();});}};}function handleEntityNotFound(_0x2b38dd,_0x5c1095){return function(_0x417715){if(!_0x417715){_0x2b38dd[_0x4d7a('0x2c')](0x194);}return _0x417715;};}function handleError(_0x1b441d,_0x54c64c){_0x54c64c=_0x54c64c||0x1f4;return function(_0x353078){logger[_0x4d7a('0x26')](_0x353078[_0x4d7a('0x3a')]);if(_0x353078[_0x4d7a('0x3b')]){delete _0x353078['name'];}_0x1b441d[_0x4d7a('0x2d')](_0x54c64c)[_0x4d7a('0x3c')](_0x353078);};}exports['index']=function(_0x3c8712,_0x46b3dd){var _0x88a3fa={},_0x40d23f={},_0x39f896={'count':0x0,'rows':[]};var _0x117367=_[_0x4d7a('0x3d')](db[_0x4d7a('0x3e')][_0x4d7a('0x3f')],function(_0x4ccb9a){return{'name':_0x4ccb9a[_0x4d7a('0x40')],'type':_0x4ccb9a[_0x4d7a('0x41')][_0x4d7a('0x42')]};});_0x40d23f[_0x4d7a('0x43')]=_[_0x4d7a('0x3d')](_0x117367,_0x4d7a('0x3b'));_0x40d23f[_0x4d7a('0x44')]=_[_0x4d7a('0x45')](_0x3c8712['query']);_0x40d23f[_0x4d7a('0x46')]=_[_0x4d7a('0x47')](_0x40d23f[_0x4d7a('0x43')],_0x40d23f[_0x4d7a('0x44')]);_0x88a3fa[_0x4d7a('0x48')]=_[_0x4d7a('0x47')](_0x40d23f[_0x4d7a('0x43')],qs[_0x4d7a('0x49')](_0x3c8712[_0x4d7a('0x44')][_0x4d7a('0x49')]));_0x88a3fa[_0x4d7a('0x48')]=_0x88a3fa['attributes'][_0x4d7a('0x4a')]?_0x88a3fa['attributes']:_0x40d23f[_0x4d7a('0x43')];if(!_0x3c8712[_0x4d7a('0x44')]['hasOwnProperty'](_0x4d7a('0x4b'))){_0x88a3fa['limit']=qs[_0x4d7a('0x32')](_0x3c8712[_0x4d7a('0x44')]['limit']);_0x88a3fa[_0x4d7a('0x30')]=qs[_0x4d7a('0x30')](_0x3c8712['query']['offset']);}_0x88a3fa[_0x4d7a('0x4c')]=qs['sort'](_0x3c8712[_0x4d7a('0x44')][_0x4d7a('0x4d')]);_0x88a3fa[_0x4d7a('0x4e')]=qs['filters'](_['pick'](_0x3c8712['query'],_0x40d23f[_0x4d7a('0x46')]),_0x117367);if(_0x3c8712[_0x4d7a('0x44')]['filter']){_0x88a3fa[_0x4d7a('0x4e')]=_['merge'](_0x88a3fa['where'],{'$or':_['map'](_0x117367,function(_0x1d0d3c){if(_0x1d0d3c[_0x4d7a('0x41')]!==_0x4d7a('0x4f')){var _0x3f481d={};_0x3f481d[_0x1d0d3c['name']]={'$like':'%'+_0x3c8712[_0x4d7a('0x44')]['filter']+'%'};return _0x3f481d;}})});}_0x88a3fa=_['merge']({},_0x88a3fa,_0x3c8712[_0x4d7a('0x50')]);var _0xbb8e8b={'where':_0x88a3fa['where']};return db[_0x4d7a('0x3e')]['count'](_0xbb8e8b)['then'](function(_0x423be5){_0x39f896[_0x4d7a('0x33')]=_0x423be5;if(_0x3c8712[_0x4d7a('0x44')][_0x4d7a('0x51')]){_0x88a3fa['include']=[{'all':!![]}];}return db['SmsMessage'][_0x4d7a('0x52')](_0x88a3fa);})['then'](function(_0x194661){_0x39f896[_0x4d7a('0x53')]=_0x194661;return _0x39f896;})[_0x4d7a('0x21')](respondWithFilteredResult(_0x46b3dd,_0x88a3fa))[_0x4d7a('0x2b')](handleError(_0x46b3dd,null));};exports[_0x4d7a('0x54')]=function(_0x3e0a4f,_0x2acd67){var _0x5bd390={'raw':!![],'where':{'id':_0x3e0a4f['params']['id']}},_0x470f9e={};_0x470f9e[_0x4d7a('0x43')]=_['keys'](db[_0x4d7a('0x3e')]['rawAttributes']);_0x470f9e['query']=_[_0x4d7a('0x45')](_0x3e0a4f[_0x4d7a('0x44')]);_0x470f9e['filters']=_[_0x4d7a('0x47')](_0x470f9e[_0x4d7a('0x43')],_0x470f9e['query']);_0x5bd390[_0x4d7a('0x48')]=_[_0x4d7a('0x47')](_0x470f9e[_0x4d7a('0x43')],qs[_0x4d7a('0x49')](_0x3e0a4f['query'][_0x4d7a('0x49')]));_0x5bd390['attributes']=_0x5bd390[_0x4d7a('0x48')][_0x4d7a('0x4a')]?_0x5bd390[_0x4d7a('0x48')]:_0x470f9e[_0x4d7a('0x43')];if(_0x3e0a4f[_0x4d7a('0x44')][_0x4d7a('0x51')]){_0x5bd390[_0x4d7a('0x55')]=[{'all':!![]}];}_0x5bd390=_[_0x4d7a('0x56')]({},_0x5bd390,_0x3e0a4f[_0x4d7a('0x50')]);return db[_0x4d7a('0x3e')][_0x4d7a('0x57')](_0x5bd390)[_0x4d7a('0x21')](handleEntityNotFound(_0x2acd67,null))['then'](respondWithResult(_0x2acd67,null))[_0x4d7a('0x2b')](handleError(_0x2acd67,null));};exports[_0x4d7a('0x58')]=function(_0x5ca9c4,_0x44c661){return db[_0x4d7a('0x3e')][_0x4d7a('0x58')](_0x5ca9c4[_0x4d7a('0x59')],{})[_0x4d7a('0x21')](respondWithResult(_0x44c661,0xc9))['catch'](handleError(_0x44c661,null));};exports['update']=function(_0x589f2f,_0x53c362){if(_0x589f2f[_0x4d7a('0x59')]['id']){delete _0x589f2f['body']['id'];}return db['SmsMessage']['find']({'where':{'id':_0x589f2f['params']['id']}})['then'](handleEntityNotFound(_0x53c362,null))[_0x4d7a('0x21')](saveUpdates(_0x589f2f[_0x4d7a('0x59')],null))[_0x4d7a('0x21')](respondWithResult(_0x53c362,null))[_0x4d7a('0x2b')](handleError(_0x53c362,null));};exports['destroy']=function(_0x59e707,_0x4a8913){return db[_0x4d7a('0x3e')][_0x4d7a('0x57')]({'where':{'id':_0x59e707[_0x4d7a('0x5a')]['id']}})[_0x4d7a('0x21')](handleEntityNotFound(_0x4a8913,null))[_0x4d7a('0x21')](removeEntity(_0x4a8913,null))[_0x4d7a('0x2b')](handleError(_0x4a8913,null));};exports['describe']=function(_0x212109,_0x2926bd){return db[_0x4d7a('0x3e')][_0x4d7a('0x5b')]()[_0x4d7a('0x21')](respondWithResult(_0x2926bd,null))[_0x4d7a('0x2b')](handleError(_0x2926bd,null));};var interaction_log=require(_0x4d7a('0x5c'))(_0x4d7a('0x5d'));exports[_0x4d7a('0x5e')]=function(_0x2b531c,_0x230fb4,_0x518826){var _0x29dc71={'agent':{},'channel':_0x4d7a('0x5f')};if(_0x2b531c[_0x4d7a('0x59')]['id']){delete _0x2b531c[_0x4d7a('0x59')]['id'];}_0x2b531c[_0x4d7a('0x59')][_0x4d7a('0x60')]=!![];_0x2b531c[_0x4d7a('0x59')][_0x4d7a('0x61')]=moment()[_0x4d7a('0x62')]('YYYY-MM-DD\x20HH:mm:ss');_0x2b531c[_0x4d7a('0x59')][_0x4d7a('0x63')]=_0x2b531c['body']['UserId']||_0x2b531c[_0x4d7a('0x64')]['id'];_0x29dc71[_0x4d7a('0x65')]['id']=_0x2b531c['body']['UserId'];return db[_0x4d7a('0x3e')][_0x4d7a('0x57')]({'where':{'id':_0x2b531c['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x230fb4,null))[_0x4d7a('0x21')](saveUpdates(_0x2b531c['body'],null))[_0x4d7a('0x21')](function(_0x42885f){if(_0x42885f){_0x29dc71[_0x4d7a('0x29')]=_0x42885f[_0x4d7a('0x66')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x42885f[_0x4d7a('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x230fb4,null))[_0x4d7a('0x21')](function(_0x180d96){if(_0x180d96){return _0x180d96[_0x4d7a('0x38')]({'UserId':_0x2b531c[_0x4d7a('0x59')][_0x4d7a('0x63')],'read1stAt':_[_0x4d7a('0x68')](_0x180d96[_0x4d7a('0x69')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x4d7a('0x21')](function(_0x1ea753){if(_0x1ea753){_0x29dc71[_0x4d7a('0x6a')]=_0x1ea753[_0x4d7a('0x66')]({'plain':!![]});interaction_log[_0x4d7a('0x22')](_0x4d7a('0x6b'),_0x2b531c['user']['id'],_0x2b531c['user'][_0x4d7a('0x3b')],_0x2b531c[_0x4d7a('0x64')]['role'],_0x29dc71[_0x4d7a('0x6a')]['id'],_0x2b531c[_0x4d7a('0x59')]?JSON[_0x4d7a('0x25')](_0x2b531c[_0x4d7a('0x59')]):_0x4d7a('0x6c'));return respondWithRpcPromise(_0x4d7a('0x6d'),_0x4d7a('0x6e'),_0x29dc71);}return null;})[_0x4d7a('0x21')](function(_0x4a908d){var _0x482e29=_0x4d7a('0x6f')+_0x4a908d[_0x4d7a('0x29')]['ContactId'];return db[_0x4d7a('0x70')][_0x4d7a('0x44')](_0x482e29,{'type':db['Sequelize'][_0x4d7a('0x71')]['SELECT'],'raw':!![]})[_0x4d7a('0x21')](function(_0x7065e4){return _0x7065e4;});})[_0x4d7a('0x21')](function(_0x4ada57){if(_0x4ada57){_0x29dc71[_0x4d7a('0x29')][_0x4d7a('0x72')]=_0x4ada57[0x0];if(!_0x2b531c[_0x4d7a('0x59')][_0x4d7a('0x63')])return;return db[_0x4d7a('0x73')][_0x4d7a('0x57')]({'where':{'id':_0x2b531c[_0x4d7a('0x59')][_0x4d7a('0x63')],'role':_0x4d7a('0x65')},'attributes':['id',_0x4d7a('0x3b'),_0x4d7a('0x74'),'email','internal'],'raw':!![]});}return null;})[_0x4d7a('0x21')](function(_0x30730f){if(!_0x30730f)return null;_0x29dc71['message'][_0x4d7a('0x65')]=_0x30730f;return _0x29dc71;})[_0x4d7a('0x21')](function(_0x10e97f){if(_0x10e97f){if(_0x2b531c[_0x4d7a('0x59')]['manual']){_0x29dc71[_0x4d7a('0x29')]['interface']=util['format'](_0x4d7a('0x75'),_0x2b531c[_0x4d7a('0x64')][_0x4d7a('0x3b')]);_0x29dc71['message']['channel']=_0x29dc71['channel'];_0x29dc71[_0x4d7a('0x29')][_0x4d7a('0x76')]=_0x29dc71['channel'];_0x29dc71[_0x4d7a('0x29')][_0x4d7a('0x77')]=_0x4d7a('0x5e');return respondWithRpcPromise(_0x4d7a('0x78'),'EventManager',{'event':_0x4d7a('0x79'),'message':_0x29dc71[_0x4d7a('0x29')]},client9002)['then'](function(){return _0x29dc71;});}return _0x29dc71;}return null;})[_0x4d7a('0x21')](respondWithResult(_0x230fb4,null))[_0x4d7a('0x2b')](handleError(_0x230fb4,null));};var interaction_log=require('../../config/logger')(_0x4d7a('0x5d'));exports[_0x4d7a('0x36')]=function(_0x18de69,_0x2b585b,_0x16dcf7){var _0x106437={'agent':{},'channel':'sms'};if(_0x18de69[_0x4d7a('0x59')]['id']){delete _0x18de69[_0x4d7a('0x59')]['id'];}_0x18de69['body']['UserId']=_0x18de69[_0x4d7a('0x59')][_0x4d7a('0x63')]||_0x18de69['user']['id'];_0x106437['agent']['id']=_0x18de69[_0x4d7a('0x59')]['UserId'];return db[_0x4d7a('0x3e')]['find']({'where':{'id':_0x18de69[_0x4d7a('0x5a')]['id'],'UserId':null}})[_0x4d7a('0x21')](handleEntityNotFound(_0x2b585b,null))[_0x4d7a('0x21')](function(_0xfb0098){if(_0xfb0098){_0x106437[_0x4d7a('0x29')]=_0xfb0098[_0x4d7a('0x66')]({'plain':!![]});return db[_0x4d7a('0x7a')][_0x4d7a('0x57')]({'where':{'id':_0xfb0098['SmsInteractionId']}});}return null;})[_0x4d7a('0x21')](handleEntityNotFound(_0x2b585b,null))['then'](function(_0x498829){if(_0x498829){_0x106437[_0x4d7a('0x6a')]=_0x498829['get']({'plain':!![]});interaction_log[_0x4d7a('0x22')](_0x4d7a('0x7b'),_0x18de69[_0x4d7a('0x64')]['id'],_0x18de69['user'][_0x4d7a('0x3b')],_0x18de69[_0x4d7a('0x64')]['role'],_0x106437['interaction']['id'],_0x18de69['body']?JSON[_0x4d7a('0x25')](_0x18de69[_0x4d7a('0x59')]):_0x4d7a('0x6c'));return respondWithRpcPromise(_0x4d7a('0x7c'),_0x4d7a('0x7d'),_0x106437);}return null;})[_0x4d7a('0x21')](function(_0x4f6f22){var _0x4cceca='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4f6f22['message'][_0x4d7a('0x7e')];return db[_0x4d7a('0x70')][_0x4d7a('0x44')](_0x4cceca,{'type':db[_0x4d7a('0x7f')][_0x4d7a('0x71')][_0x4d7a('0x80')],'raw':!![]})['then'](function(_0x4eabe6){return _0x4eabe6;});})['then'](function(_0x26ba51){if(_0x26ba51){_0x106437[_0x4d7a('0x29')][_0x4d7a('0x72')]=_0x26ba51[0x0];if(!_0x18de69[_0x4d7a('0x59')][_0x4d7a('0x63')])return;return db[_0x4d7a('0x73')]['find']({'where':{'id':_0x18de69[_0x4d7a('0x59')][_0x4d7a('0x63')],'role':_0x4d7a('0x65')},'attributes':['id',_0x4d7a('0x3b'),_0x4d7a('0x74'),'email',_0x4d7a('0x81')],'raw':!![]});}return null;})[_0x4d7a('0x21')](function(_0x5bd72d){if(!_0x5bd72d)return null;_0x106437[_0x4d7a('0x29')][_0x4d7a('0x65')]=_0x5bd72d;return _0x106437;})[_0x4d7a('0x21')](function(_0x22312e){if(_0x22312e){_0x22312e[_0x4d7a('0x29')]['interface']=util['format'](_0x4d7a('0x75'),_0x18de69[_0x4d7a('0x64')][_0x4d7a('0x3b')]);_0x22312e['message']['channel']=_0x106437['channel'];_0x22312e[_0x4d7a('0x29')][_0x4d7a('0x76')]=_0x106437[_0x4d7a('0x82')];_0x22312e['message'][_0x4d7a('0x77')]=_0x4d7a('0x36');respondWithRpcPromise('EventManager','EventManager',{'event':_0x4d7a('0x83'),'message':_0x22312e[_0x4d7a('0x29')]},client9002);return _0x106437;}return null;})[_0x4d7a('0x21')](respondWithResult(_0x2b585b,null))[_0x4d7a('0x2b')](handleError(_0x2b585b,null));};exports['status']=function(_0x1234f1,_0x51dc71,_0x47a145){if(_0x1234f1[_0x4d7a('0x59')]['id']){delete _0x1234f1[_0x4d7a('0x59')]['id'];}var _0x57bc57;return db[_0x4d7a('0x3e')][_0x4d7a('0x57')]({'where':{'id':_0x1234f1[_0x4d7a('0x5a')]['id']}})[_0x4d7a('0x21')](handleEntityNotFound(_0x51dc71,null))[_0x4d7a('0x21')](function(_0x23643e){if(_0x23643e){_0x57bc57=_0x23643e;return db[_0x4d7a('0x84')][_0x4d7a('0x57')]({'where':{'id':_0x23643e[_0x4d7a('0x85')]}});}})['then'](handleEntityNotFound(_0x51dc71,null))[_0x4d7a('0x21')](function(_0x5142db){if(_0x5142db){logger['debug'](_0x4d7a('0x24'),_0x4d7a('0x2d'),'received\x20delivery\x20report\x20from',_0x5142db[_0x4d7a('0x41')],util[_0x4d7a('0x86')](_0x1234f1['body'],{'showHidden':![],'depth':null}));switch(_0x5142db['type']){case _0x4d7a('0x87'):if(_0x1234f1[_0x4d7a('0x59')]['MessageSid']&&_0x1234f1['body']['MessageSid']===_0x57bc57['messageId']){return _0x57bc57[_0x4d7a('0x38')]({'read':!![]});}else{logger[_0x4d7a('0x26')](_0x4d7a('0x88'),_0x4d7a('0x2d'),'twilio',util[_0x4d7a('0x86')](_0x1234f1[_0x4d7a('0x59')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x1234f1[_0x4d7a('0x59')][_0x4d7a('0x89')]&&_0x1234f1['body'][_0x4d7a('0x89')]===_0x57bc57[_0x4d7a('0x8a')]&&_['indexOf']([_0x4d7a('0x8b'),'delivered'],_0x1234f1[_0x4d7a('0x59')]['Status'])>=0x0){return _0x57bc57['update']({'read':!![]});}else{logger[_0x4d7a('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4d7a('0x2d'),_0x4d7a('0x8c'),util[_0x4d7a('0x86')](_0x1234f1[_0x4d7a('0x59')],{'showHidden':![],'depth':null}));}break;case _0x4d7a('0x8d'):var _0x153422=_0x1234f1[_0x4d7a('0x59')]['results'][0x0];if(_0x153422['status'][_0x4d7a('0x8e')]===_0x4d7a('0x8f')){return _0x57bc57['update']({'read':!![]});}else{logger[_0x4d7a('0x26')](_0x4d7a('0x88'),_0x4d7a('0x2d'),'infobip',util['inspect'](_0x1234f1[_0x4d7a('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x57bc57;}})[_0x4d7a('0x21')](respondWithResult(_0x51dc71,null))[_0x4d7a('0x2b')](handleError(_0x51dc71,null));}; \ No newline at end of file +var _0xa282=['filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','merge','where','type','options','includeAll','include','findAll','show','params','find','create','body','describe','sms-interactions','accept','read','readAt','format','UserId','user','agent','get','SmsInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','info','interaction','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','sms','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','User','rejectmessage','SmsAccount','SmsMessage,\x20%s,\x20%s,\x20%s','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','MessageUUID','sent','delivered','inspect','infobip','eml-format','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','jayson/promise','client','http','then','SmsMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','update','destroy','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','key','model','query','keys'];(function(_0x241bd4,_0x5756e5){var _0x195f33=function(_0x3f4dee){while(--_0x3f4dee){_0x241bd4['push'](_0x241bd4['shift']());}};_0x195f33(++_0x5756e5);}(_0xa282,0x1f3));var _0x2a28=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0xa282[_0x2e4aa2];return _0x5e6092;};'use strict';var emlformat=require(_0x2a28('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2a28('0x1'));var rp=require('request-promise');var moment=require(_0x2a28('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x2a28('0x3'));var util=require(_0x2a28('0x4'));var path=require(_0x2a28('0x5'));var sox=require(_0x2a28('0x6'));var csv=require(_0x2a28('0x7'));var ejs=require(_0x2a28('0x8'));var fs=require('fs');var fs_extra=require(_0x2a28('0x9'));var _=require(_0x2a28('0xa'));var squel=require(_0x2a28('0xb'));var crypto=require(_0x2a28('0xc'));var jsforce=require(_0x2a28('0xd'));var deskjs=require(_0x2a28('0xe'));var toCsv=require(_0x2a28('0x7'));var querystring=require('querystring');var Papa=require(_0x2a28('0xf'));var Redis=require('ioredis');var authService=require(_0x2a28('0x10'));var qs=require(_0x2a28('0x11'));var as=require(_0x2a28('0x12'));var hardwareService=require(_0x2a28('0x13'));var logger=require(_0x2a28('0x14'))(_0x2a28('0x15'));var utils=require(_0x2a28('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2a28('0x17'))['db'];config['redis']=_[_0x2a28('0x18')](config[_0x2a28('0x19')],{'host':_0x2a28('0x1a'),'port':0x18eb});var socket=require(_0x2a28('0x1b'))(new Redis(config[_0x2a28('0x19')]));require('./smsMessage.socket')['register'](socket);var jayson=require(_0x2a28('0x1c'));var client=jayson[_0x2a28('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0x2a28('0x1d')][_0x2a28('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x4fd15c,_0x5e6257,_0x575294,_0x13751d){return new BPromise(function(_0x506493,_0x45b810){var _0x1ecad=_0x13751d||client;return _0x1ecad['request'](_0x4fd15c,_0x575294)[_0x2a28('0x1f')](function(_0xced0d4){logger['info'](_0x2a28('0x20'),_0x5e6257,'request\x20sent');logger[_0x2a28('0x21')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5e6257,_0x2a28('0x22'),JSON[_0x2a28('0x23')](_0xced0d4));if(_0xced0d4[_0x2a28('0x24')]){if(_0xced0d4[_0x2a28('0x24')][_0x2a28('0x25')]===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x5e6257,_0xced0d4[_0x2a28('0x24')]['message']);return _0x45b810(_0xced0d4['error'][_0x2a28('0x26')]);}logger['error'](_0x2a28('0x20'),_0x5e6257,_0xced0d4[_0x2a28('0x24')][_0x2a28('0x26')]);return _0x506493(_0xced0d4[_0x2a28('0x24')]['message']);}else{logger['info'](_0x2a28('0x20'),_0x5e6257,_0x2a28('0x22'));_0x506493(_0xced0d4[_0x2a28('0x27')]['message']);}})[_0x2a28('0x28')](function(_0x3f2255){logger[_0x2a28('0x24')](_0x2a28('0x20'),_0x5e6257,_0x3f2255);_0x45b810(_0x3f2255);});});}function respondWithStatusCode(_0x185d9c,_0x13d489){_0x13d489=_0x13d489||0xcc;return function(_0x263758){if(_0x263758){return _0x185d9c[_0x2a28('0x29')](_0x13d489);}return _0x185d9c[_0x2a28('0x2a')](_0x13d489)[_0x2a28('0x2b')]();};}function respondWithResult(_0xfe8d51,_0x59a857){_0x59a857=_0x59a857||0xc8;return function(_0x408539){if(_0x408539){return _0xfe8d51[_0x2a28('0x2a')](_0x59a857)['json'](_0x408539);}};}function respondWithFilteredResult(_0x146dfb,_0x52349d){return function(_0x452cd0){if(_0x452cd0){var _0x4124c0=typeof _0x52349d[_0x2a28('0x2c')]===_0x2a28('0x2d')&&typeof _0x52349d['limit']===_0x2a28('0x2d');var _0x4b0d15=_0x452cd0[_0x2a28('0x2e')];var _0x284e92=_0x4124c0?0x0:_0x52349d[_0x2a28('0x2c')];var _0x111ae1=_0x4124c0?_0x452cd0['count']:_0x52349d[_0x2a28('0x2c')]+_0x52349d[_0x2a28('0x2f')];var _0x43f8ba;if(_0x111ae1>=_0x4b0d15){_0x111ae1=_0x4b0d15;_0x43f8ba=0xc8;}else{_0x43f8ba=0xce;}_0x146dfb[_0x2a28('0x2a')](_0x43f8ba);return _0x146dfb[_0x2a28('0x30')](_0x2a28('0x31'),_0x284e92+'-'+_0x111ae1+'/'+_0x4b0d15)['json'](_0x452cd0);}return null;};}function patchUpdates(_0x2fd4ee){return function(_0x4f3321){try{jsonpatch[_0x2a28('0x32')](_0x4f3321,_0x2fd4ee,!![]);}catch(_0x15e3fb){return BPromise['reject'](_0x15e3fb);}return _0x4f3321['save']();};}function saveUpdates(_0x2aa9ba,_0x3924a9){return function(_0x2242cb){if(_0x2242cb){return _0x2242cb[_0x2a28('0x33')](_0x2aa9ba)[_0x2a28('0x1f')](function(_0x192112){return _0x192112;});}return null;};}function removeEntity(_0x1f5115,_0x2a3498){return function(_0x33e7f7){if(_0x33e7f7){return _0x33e7f7[_0x2a28('0x34')]()[_0x2a28('0x1f')](function(){_0x1f5115[_0x2a28('0x2a')](0xcc)[_0x2a28('0x2b')]();});}};}function handleEntityNotFound(_0x36ed95,_0x47a671){return function(_0x26c89f){if(!_0x26c89f){_0x36ed95[_0x2a28('0x29')](0x194);}return _0x26c89f;};}function handleError(_0x11be0a,_0x552bae){_0x552bae=_0x552bae||0x1f4;return function(_0x5c7809){logger['error'](_0x5c7809[_0x2a28('0x35')]);if(_0x5c7809[_0x2a28('0x36')]){delete _0x5c7809[_0x2a28('0x36')];}_0x11be0a['status'](_0x552bae)[_0x2a28('0x37')](_0x5c7809);};}exports[_0x2a28('0x38')]=function(_0x33cb23,_0x513ca0){var _0x29342d={},_0x1f5755={},_0x1ab7e3={'count':0x0,'rows':[]};var _0x1cd9a2=_[_0x2a28('0x39')](db[_0x2a28('0x3a')][_0x2a28('0x3b')],function(_0xd1dc4d){return{'name':_0xd1dc4d[_0x2a28('0x3c')],'type':_0xd1dc4d['type'][_0x2a28('0x3d')]};});_0x1f5755[_0x2a28('0x3e')]=_['map'](_0x1cd9a2,_0x2a28('0x36'));_0x1f5755[_0x2a28('0x3f')]=_[_0x2a28('0x40')](_0x33cb23['query']);_0x1f5755[_0x2a28('0x41')]=_[_0x2a28('0x42')](_0x1f5755['model'],_0x1f5755['query']);_0x29342d[_0x2a28('0x43')]=_[_0x2a28('0x42')](_0x1f5755[_0x2a28('0x3e')],qs[_0x2a28('0x44')](_0x33cb23[_0x2a28('0x3f')][_0x2a28('0x44')]));_0x29342d[_0x2a28('0x43')]=_0x29342d[_0x2a28('0x43')][_0x2a28('0x45')]?_0x29342d[_0x2a28('0x43')]:_0x1f5755[_0x2a28('0x3e')];if(!_0x33cb23[_0x2a28('0x3f')]['hasOwnProperty'](_0x2a28('0x46'))){_0x29342d[_0x2a28('0x2f')]=qs[_0x2a28('0x2f')](_0x33cb23['query'][_0x2a28('0x2f')]);_0x29342d[_0x2a28('0x2c')]=qs[_0x2a28('0x2c')](_0x33cb23['query'][_0x2a28('0x2c')]);}_0x29342d[_0x2a28('0x47')]=qs[_0x2a28('0x48')](_0x33cb23['query'][_0x2a28('0x48')]);_0x29342d['where']=qs[_0x2a28('0x41')](_[_0x2a28('0x49')](_0x33cb23[_0x2a28('0x3f')],_0x1f5755['filters']),_0x1cd9a2);if(_0x33cb23[_0x2a28('0x3f')][_0x2a28('0x4a')]){_0x29342d['where']=_[_0x2a28('0x4b')](_0x29342d[_0x2a28('0x4c')],{'$or':_[_0x2a28('0x39')](_0x1cd9a2,function(_0x18af34){if(_0x18af34[_0x2a28('0x4d')]!=='VIRTUAL'){var _0x314abe={};_0x314abe[_0x18af34[_0x2a28('0x36')]]={'$like':'%'+_0x33cb23['query'][_0x2a28('0x4a')]+'%'};return _0x314abe;}})});}_0x29342d=_['merge']({},_0x29342d,_0x33cb23[_0x2a28('0x4e')]);var _0x2fdcbf={'where':_0x29342d[_0x2a28('0x4c')]};return db[_0x2a28('0x3a')][_0x2a28('0x2e')](_0x2fdcbf)['then'](function(_0x235d00){_0x1ab7e3['count']=_0x235d00;if(_0x33cb23[_0x2a28('0x3f')][_0x2a28('0x4f')]){_0x29342d[_0x2a28('0x50')]=[{'all':!![]}];}return db[_0x2a28('0x3a')][_0x2a28('0x51')](_0x29342d);})[_0x2a28('0x1f')](function(_0x4e9571){_0x1ab7e3['rows']=_0x4e9571;return _0x1ab7e3;})[_0x2a28('0x1f')](respondWithFilteredResult(_0x513ca0,_0x29342d))[_0x2a28('0x28')](handleError(_0x513ca0,null));};exports[_0x2a28('0x52')]=function(_0xb3fa4f,_0xd0b472){var _0x314a40={'raw':!![],'where':{'id':_0xb3fa4f[_0x2a28('0x53')]['id']}},_0x1f7006={};_0x1f7006['model']=_['keys'](db[_0x2a28('0x3a')][_0x2a28('0x3b')]);_0x1f7006['query']=_['keys'](_0xb3fa4f[_0x2a28('0x3f')]);_0x1f7006[_0x2a28('0x41')]=_[_0x2a28('0x42')](_0x1f7006[_0x2a28('0x3e')],_0x1f7006[_0x2a28('0x3f')]);_0x314a40['attributes']=_[_0x2a28('0x42')](_0x1f7006[_0x2a28('0x3e')],qs['fields'](_0xb3fa4f['query'][_0x2a28('0x44')]));_0x314a40[_0x2a28('0x43')]=_0x314a40[_0x2a28('0x43')][_0x2a28('0x45')]?_0x314a40['attributes']:_0x1f7006[_0x2a28('0x3e')];if(_0xb3fa4f[_0x2a28('0x3f')][_0x2a28('0x4f')]){_0x314a40[_0x2a28('0x50')]=[{'all':!![]}];}_0x314a40=_['merge']({},_0x314a40,_0xb3fa4f[_0x2a28('0x4e')]);return db[_0x2a28('0x3a')][_0x2a28('0x54')](_0x314a40)['then'](handleEntityNotFound(_0xd0b472,null))[_0x2a28('0x1f')](respondWithResult(_0xd0b472,null))[_0x2a28('0x28')](handleError(_0xd0b472,null));};exports['create']=function(_0x20057,_0x48eb47){return db[_0x2a28('0x3a')][_0x2a28('0x55')](_0x20057[_0x2a28('0x56')],{})[_0x2a28('0x1f')](respondWithResult(_0x48eb47,0xc9))[_0x2a28('0x28')](handleError(_0x48eb47,null));};exports['update']=function(_0x24b2fc,_0x33edca){if(_0x24b2fc[_0x2a28('0x56')]['id']){delete _0x24b2fc[_0x2a28('0x56')]['id'];}return db['SmsMessage'][_0x2a28('0x54')]({'where':{'id':_0x24b2fc[_0x2a28('0x53')]['id']}})['then'](handleEntityNotFound(_0x33edca,null))[_0x2a28('0x1f')](saveUpdates(_0x24b2fc[_0x2a28('0x56')],null))[_0x2a28('0x1f')](respondWithResult(_0x33edca,null))['catch'](handleError(_0x33edca,null));};exports[_0x2a28('0x34')]=function(_0x52a4c6,_0x27ee55){return db['SmsMessage'][_0x2a28('0x54')]({'where':{'id':_0x52a4c6[_0x2a28('0x53')]['id']}})[_0x2a28('0x1f')](handleEntityNotFound(_0x27ee55,null))[_0x2a28('0x1f')](removeEntity(_0x27ee55,null))[_0x2a28('0x28')](handleError(_0x27ee55,null));};exports[_0x2a28('0x57')]=function(_0x158e3a,_0x388aa4){return db[_0x2a28('0x3a')][_0x2a28('0x57')]()['then'](respondWithResult(_0x388aa4,null))[_0x2a28('0x28')](handleError(_0x388aa4,null));};var interaction_log=require(_0x2a28('0x14'))(_0x2a28('0x58'));exports[_0x2a28('0x59')]=function(_0x3e1aad,_0x3c09ee,_0x487f60){var _0x24320b={'agent':{},'channel':'sms'};if(_0x3e1aad[_0x2a28('0x56')]['id']){delete _0x3e1aad[_0x2a28('0x56')]['id'];}_0x3e1aad[_0x2a28('0x56')][_0x2a28('0x5a')]=!![];_0x3e1aad[_0x2a28('0x56')][_0x2a28('0x5b')]=moment()[_0x2a28('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x3e1aad['body'][_0x2a28('0x5d')]=_0x3e1aad[_0x2a28('0x56')][_0x2a28('0x5d')]||_0x3e1aad[_0x2a28('0x5e')]['id'];_0x24320b[_0x2a28('0x5f')]['id']=_0x3e1aad[_0x2a28('0x56')]['UserId'];return db[_0x2a28('0x3a')][_0x2a28('0x54')]({'where':{'id':_0x3e1aad[_0x2a28('0x53')]['id'],'UserId':null}})[_0x2a28('0x1f')](handleEntityNotFound(_0x3c09ee,null))[_0x2a28('0x1f')](saveUpdates(_0x3e1aad[_0x2a28('0x56')],null))[_0x2a28('0x1f')](function(_0x6a87f0){if(_0x6a87f0){_0x24320b['message']=_0x6a87f0[_0x2a28('0x60')]({'plain':!![]});return db['SmsInteraction'][_0x2a28('0x54')]({'where':{'id':_0x6a87f0[_0x2a28('0x61')]}});}return null;})[_0x2a28('0x1f')](handleEntityNotFound(_0x3c09ee,null))['then'](function(_0x2df8b0){if(_0x2df8b0){return _0x2df8b0[_0x2a28('0x33')]({'UserId':_0x3e1aad[_0x2a28('0x56')][_0x2a28('0x5d')],'read1stAt':_[_0x2a28('0x62')](_0x2df8b0[_0x2a28('0x63')])?moment()['format'](_0x2a28('0x64')):undefined});}return null;})[_0x2a28('0x1f')](function(_0x2975a4){if(_0x2975a4){_0x24320b['interaction']=_0x2975a4[_0x2a28('0x60')]({'plain':!![]});interaction_log[_0x2a28('0x65')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3e1aad[_0x2a28('0x5e')]['id'],_0x3e1aad[_0x2a28('0x5e')]['name'],_0x3e1aad[_0x2a28('0x5e')]['role'],_0x24320b[_0x2a28('0x66')]['id'],_0x3e1aad['body']?JSON[_0x2a28('0x23')](_0x3e1aad[_0x2a28('0x56')]):_0x2a28('0x67'));return respondWithRpcPromise('AcceptMessage',_0x2a28('0x68'),_0x24320b);}return null;})[_0x2a28('0x1f')](function(_0x4fe440){var _0xc5797c=_0x2a28('0x69')+_0x4fe440['message'][_0x2a28('0x6a')];return db[_0x2a28('0x6b')][_0x2a28('0x3f')](_0xc5797c,{'type':db[_0x2a28('0x6c')]['QueryTypes'][_0x2a28('0x6d')],'raw':!![]})[_0x2a28('0x1f')](function(_0xe8c77f){return _0xe8c77f;});})[_0x2a28('0x1f')](function(_0x5dbb49){if(_0x5dbb49){_0x24320b[_0x2a28('0x26')][_0x2a28('0x6e')]=_0x5dbb49[0x0];if(!_0x3e1aad[_0x2a28('0x56')][_0x2a28('0x5d')])return;return db['User']['find']({'where':{'id':_0x3e1aad[_0x2a28('0x56')]['UserId'],'role':'agent'},'attributes':['id',_0x2a28('0x36'),_0x2a28('0x6f'),_0x2a28('0x70'),_0x2a28('0x71')],'raw':!![]});}return null;})[_0x2a28('0x1f')](function(_0x39e8f4){if(!_0x39e8f4)return null;_0x24320b[_0x2a28('0x26')]['agent']=_0x39e8f4;return _0x24320b;})['then'](function(_0xcc9717){if(_0xcc9717){if(_0x3e1aad['body'][_0x2a28('0x72')]){_0x24320b[_0x2a28('0x26')][_0x2a28('0x73')]=util[_0x2a28('0x5c')](_0x2a28('0x74'),_0x3e1aad[_0x2a28('0x5e')][_0x2a28('0x36')]);_0x24320b[_0x2a28('0x26')]['channel']=_0x24320b[_0x2a28('0x75')];_0x24320b[_0x2a28('0x26')][_0x2a28('0x76')]=_0x24320b[_0x2a28('0x75')];_0x24320b[_0x2a28('0x26')][_0x2a28('0x77')]=_0x2a28('0x59');return respondWithRpcPromise(_0x2a28('0x78'),'EventManager',{'event':_0x2a28('0x79'),'message':_0x24320b[_0x2a28('0x26')]},client9002)[_0x2a28('0x1f')](function(){return _0x24320b;});}return _0x24320b;}return null;})['then'](respondWithResult(_0x3c09ee,null))[_0x2a28('0x28')](handleError(_0x3c09ee,null));};var interaction_log=require(_0x2a28('0x14'))('sms-interactions');exports['reject']=function(_0x2d41db,_0x44dfc9,_0x405d87){var _0x15bbaf={'agent':{},'channel':_0x2a28('0x7a')};if(_0x2d41db['body']['id']){delete _0x2d41db[_0x2a28('0x56')]['id'];}_0x2d41db[_0x2a28('0x56')][_0x2a28('0x5d')]=_0x2d41db[_0x2a28('0x56')][_0x2a28('0x5d')]||_0x2d41db[_0x2a28('0x5e')]['id'];_0x15bbaf[_0x2a28('0x5f')]['id']=_0x2d41db['body'][_0x2a28('0x5d')];return db['SmsMessage'][_0x2a28('0x54')]({'where':{'id':_0x2d41db['params']['id'],'UserId':null}})[_0x2a28('0x1f')](handleEntityNotFound(_0x44dfc9,null))[_0x2a28('0x1f')](function(_0x3b2e2f){if(_0x3b2e2f){_0x15bbaf[_0x2a28('0x26')]=_0x3b2e2f['get']({'plain':!![]});return db[_0x2a28('0x7b')][_0x2a28('0x54')]({'where':{'id':_0x3b2e2f[_0x2a28('0x61')]}});}return null;})[_0x2a28('0x1f')](handleEntityNotFound(_0x44dfc9,null))[_0x2a28('0x1f')](function(_0x4e6d10){if(_0x4e6d10){_0x15bbaf[_0x2a28('0x66')]=_0x4e6d10[_0x2a28('0x60')]({'plain':!![]});interaction_log[_0x2a28('0x65')](_0x2a28('0x7c'),_0x2d41db[_0x2a28('0x5e')]['id'],_0x2d41db['user']['name'],_0x2d41db[_0x2a28('0x5e')][_0x2a28('0x7d')],_0x15bbaf[_0x2a28('0x66')]['id'],_0x2d41db['body']?JSON[_0x2a28('0x23')](_0x2d41db[_0x2a28('0x56')]):_0x2a28('0x67'));return respondWithRpcPromise(_0x2a28('0x7e'),_0x2a28('0x7f'),_0x15bbaf);}return null;})[_0x2a28('0x1f')](function(_0x39b91d){var _0x3c2a8f=_0x2a28('0x69')+_0x39b91d[_0x2a28('0x26')]['ContactId'];return db[_0x2a28('0x6b')][_0x2a28('0x3f')](_0x3c2a8f,{'type':db[_0x2a28('0x6c')]['QueryTypes'][_0x2a28('0x6d')],'raw':!![]})['then'](function(_0x579a26){return _0x579a26;});})[_0x2a28('0x1f')](function(_0x16f055){if(_0x16f055){_0x15bbaf[_0x2a28('0x26')][_0x2a28('0x6e')]=_0x16f055[0x0];if(!_0x2d41db['body']['UserId'])return;return db[_0x2a28('0x80')][_0x2a28('0x54')]({'where':{'id':_0x2d41db[_0x2a28('0x56')][_0x2a28('0x5d')],'role':'agent'},'attributes':['id',_0x2a28('0x36'),'fullname',_0x2a28('0x70'),_0x2a28('0x71')],'raw':!![]});}return null;})[_0x2a28('0x1f')](function(_0x1a1298){if(!_0x1a1298)return null;_0x15bbaf[_0x2a28('0x26')]['agent']=_0x1a1298;return _0x15bbaf;})[_0x2a28('0x1f')](function(_0x5f5461){if(_0x5f5461){_0x5f5461[_0x2a28('0x26')][_0x2a28('0x73')]=util['format'](_0x2a28('0x74'),_0x2d41db[_0x2a28('0x5e')][_0x2a28('0x36')]);_0x5f5461['message'][_0x2a28('0x75')]=_0x15bbaf['channel'];_0x5f5461[_0x2a28('0x26')][_0x2a28('0x76')]=_0x15bbaf[_0x2a28('0x75')];_0x5f5461['message'][_0x2a28('0x77')]='reject';respondWithRpcPromise(_0x2a28('0x78'),_0x2a28('0x78'),{'event':_0x2a28('0x81'),'message':_0x5f5461['message']},client9002);return _0x15bbaf;}return null;})[_0x2a28('0x1f')](respondWithResult(_0x44dfc9,null))[_0x2a28('0x28')](handleError(_0x44dfc9,null));};exports[_0x2a28('0x2a')]=function(_0x161841,_0x340385,_0x4888bf){if(_0x161841[_0x2a28('0x56')]['id']){delete _0x161841[_0x2a28('0x56')]['id'];}var _0x42cedc;return db[_0x2a28('0x3a')][_0x2a28('0x54')]({'where':{'id':_0x161841[_0x2a28('0x53')]['id']}})[_0x2a28('0x1f')](handleEntityNotFound(_0x340385,null))[_0x2a28('0x1f')](function(_0x787e26){if(_0x787e26){_0x42cedc=_0x787e26;return db[_0x2a28('0x82')][_0x2a28('0x54')]({'where':{'id':_0x787e26['SmsAccountId']}});}})[_0x2a28('0x1f')](handleEntityNotFound(_0x340385,null))['then'](function(_0x411b6a){if(_0x411b6a){logger[_0x2a28('0x21')](_0x2a28('0x83'),'status','received\x20delivery\x20report\x20from',_0x411b6a[_0x2a28('0x4d')],util['inspect'](_0x161841[_0x2a28('0x56')],{'showHidden':![],'depth':null}));switch(_0x411b6a[_0x2a28('0x4d')]){case _0x2a28('0x84'):if(_0x161841[_0x2a28('0x56')]['MessageSid']&&_0x161841[_0x2a28('0x56')][_0x2a28('0x85')]===_0x42cedc[_0x2a28('0x86')]){return _0x42cedc[_0x2a28('0x33')]({'read':!![]});}else{logger[_0x2a28('0x24')](_0x2a28('0x87'),_0x2a28('0x2a'),'twilio',util['inspect'](_0x161841[_0x2a28('0x56')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x161841[_0x2a28('0x56')][_0x2a28('0x88')]&&_0x161841[_0x2a28('0x56')][_0x2a28('0x88')]===_0x42cedc[_0x2a28('0x86')]&&_['indexOf']([_0x2a28('0x89'),_0x2a28('0x8a')],_0x161841[_0x2a28('0x56')]['Status'])>=0x0){return _0x42cedc[_0x2a28('0x33')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2a28('0x2a'),'plivio',util[_0x2a28('0x8b')](_0x161841[_0x2a28('0x56')],{'showHidden':![],'depth':null}));}break;case _0x2a28('0x8c'):var _0x979d70=_0x161841['body']['results'][0x0];if(_0x979d70[_0x2a28('0x2a')]['groupName']==='DELIVERED'){return _0x42cedc[_0x2a28('0x33')]({'read':!![]});}else{logger[_0x2a28('0x24')](_0x2a28('0x87'),_0x2a28('0x2a'),'infobip',util['inspect'](_0x161841[_0x2a28('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x42cedc;}})[_0x2a28('0x1f')](respondWithResult(_0x340385,null))['catch'](handleError(_0x340385,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 0c1834c..98cdd79 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 _0xc0fd=['remove','emit','hook','events','../../mysqldb','SmsMessage','save','update'];(function(_0xadc7a0,_0x175356){var _0x113f84=function(_0x3d5e76){while(--_0x3d5e76){_0xadc7a0['push'](_0xadc7a0['shift']());}};_0x113f84(++_0x175356);}(_0xc0fd,0x1db));var _0xdc0f=function(_0x4c9d34,_0x379222){_0x4c9d34=_0x4c9d34-0x0;var _0x54fa6e=_0xc0fd[_0x4c9d34];return _0x54fa6e;};'use strict';var EventEmitter=require(_0xdc0f('0x0'));var SmsMessage=require(_0xdc0f('0x1'))['db'][_0xdc0f('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdc0f('0x3'),'afterUpdate':_0xdc0f('0x4'),'afterDestroy':_0xdc0f('0x5')};function emitEvent(_0x21a95f){return function(_0x2bf08b,_0x56aa37,_0x13df87){SmsMessageEvents['emit'](_0x21a95f+':'+_0x2bf08b['id'],_0x2bf08b);SmsMessageEvents[_0xdc0f('0x6')](_0x21a95f,_0x2bf08b);_0x13df87(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0xdc0f('0x7')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0xadb6=['events','../../mysqldb','SmsMessage','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x4d6830,_0x417314){var _0x3e9a0a=function(_0x1274e1){while(--_0x1274e1){_0x4d6830['push'](_0x4d6830['shift']());}};_0x3e9a0a(++_0x417314);}(_0xadb6,0x195));var _0x6adb=function(_0xafc18a,_0x337135){_0xafc18a=_0xafc18a-0x0;var _0x54d2df=_0xadb6[_0xafc18a];return _0x54d2df;};'use strict';var EventEmitter=require(_0x6adb('0x0'));var SmsMessage=require(_0x6adb('0x1'))['db'][_0x6adb('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6adb('0x3'),'afterUpdate':'update','afterDestroy':_0x6adb('0x4')};function emitEvent(_0x2a4a85){return function(_0x2c27d2,_0x4f19b6,_0x352b0e){SmsMessageEvents[_0x6adb('0x5')](_0x2a4a85+':'+_0x2c27d2['id'],_0x2c27d2);SmsMessageEvents[_0x6adb('0x5')](_0x2a4a85,_0x2c27d2);_0x352b0e(null);};}for(var e in events){if(events[_0x6adb('0x6')](e)){var event=events[e];SmsMessage[_0x6adb('0x7')](e,emitEvent(event));}}module[_0x6adb('0x8')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index d9b98d0..d0145be 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 _0x886f=['then','update','createdAt','error','SmsAccount','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','token','sid','catch','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','username','password','smsMethod','sender','login?username=','&password=','GET','split','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','Missing\x20parameters:\x20authToken','clicksend','%s:%s','https://rest.clicksend.com/v3/sms/send','format','base64','http_code','data','queued_count','message_id','clickSend','plivo','/status?token=','authId','https://api.plivo.com/v1/Account/%s/Message/','toString','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','keys','sort','length','createHash','md5','digest','hex','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','uuid','UTF-8','apiMessageId','accountId','/messages','applicationId','Basic\x20%s','bandwidth','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','intelepeer','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','direction','toLowerCase','out','secret','UserId','isNil','SmsInteractionId','findOne'];(function(_0x40b45f,_0x5ba9e3){var _0x29a1d1=function(_0x2f5ffd){while(--_0x2f5ffd){_0x40b45f['push'](_0x40b45f['shift']());}};_0x29a1d1(++_0x5ba9e3);}(_0x886f,0xe2));var _0xf886=function(_0xe97a4b,_0x42d07e){_0xe97a4b=_0xe97a4b-0x0;var _0xd86141=_0x886f[_0xe97a4b];return _0xd86141;};'use strict';var _=require(_0xf886('0x0'));var util=require(_0xf886('0x1'));var logger=require(_0xf886('0x2'))(_0xf886('0x3'));var moment=require('moment');var BPromise=require(_0xf886('0x4'));var rp=require(_0xf886('0x5'));var fs=require('fs');var path=require(_0xf886('0x6'));var rimraf=require(_0xf886('0x7'));var config=require(_0xf886('0x8'));var attributes=require(_0xf886('0x9'));module[_0xf886('0xa')]=function(_0x1d2f9e,_0x56ea4f){return _0x1d2f9e[_0xf886('0xb')](_0xf886('0xc'),attributes,{'tableName':_0xf886('0xd'),'paranoid':![],'indexes':[{'name':_0xf886('0xe'),'fields':['messageId']},{'name':_0xf886('0xf'),'fields':[_0xf886('0x10')],'type':_0xf886('0x11')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x35eb2d,_0x474a8d,_0x4d38cd){var _0x456b84=_0x1d2f9e['models'];var _0x28e3f2=_0x35eb2d['get']({'plain':!![]});if(_0x28e3f2[_0xf886('0x12')][_0xf886('0x13')]()==='in'||_0x28e3f2[_0xf886('0x12')]['toLowerCase']()===_0xf886('0x14')&&!_0x28e3f2[_0xf886('0x15')]&&!_['isNil'](_0x28e3f2[_0xf886('0x16')])&&!_[_0xf886('0x17')](_0x28e3f2[_0xf886('0x18')])){_0x456b84['SmsInteraction'][_0xf886('0x19')]({'where':{'id':_0x28e3f2['SmsInteractionId']}})[_0xf886('0x1a')](function(_0x568abb){if(_0x568abb){_0x568abb[_0xf886('0x1b')]({'lastMsgAt':_0x28e3f2[_0xf886('0x1c')],'lastMsgDirection':_0x28e3f2['direction'][_0xf886('0x13')]()});}})['catch'](function(_0x31a5e4){console[_0xf886('0x1d')](_0x31a5e4);});}if(_0x28e3f2[_0xf886('0x12')]==='out'&&!_0x28e3f2[_0xf886('0x15')]){var _0xe1a17c;_0x456b84[_0xf886('0x1e')]['find']({'where':{'id':_0x28e3f2[_0xf886('0x1f')]},'raw':!![]})[_0xf886('0x1a')](function(_0x2d3156){_0xe1a17c=_0x2d3156;if(_0xe1a17c&&_0xe1a17c[_0xf886('0x20')]){switch(_0xe1a17c[_0xf886('0x20')]){case _0xf886('0x21'):var _0x514603=require(_0xf886('0x21'));if(_0xe1a17c[_0xf886('0x22')]&&_0xe1a17c[_0xf886('0x23')]&&_0xe1a17c[_0xf886('0x24')]){var _0x44e779=new _0x514603(_0xe1a17c[_0xf886('0x22')],_0xe1a17c['authToken']);_0x44e779[_0xf886('0x25')][_0xf886('0x26')]({'body':_0x28e3f2['body'],'to':_0x28e3f2['phone'],'from':_0xe1a17c['phone'],'statusCallback':_0xe1a17c[_0xf886('0x27')]+_0xf886('0x28')+_0x28e3f2['id']+'/status?token='+_0xe1a17c[_0xf886('0x29')]})['then'](function(_0xc702d3){if(_0xc702d3[_0xf886('0x2a')]){return _0x35eb2d['update']({'messageId':_0xc702d3['sid']});}})[_0xf886('0x2b')](function(_0x1ad94f){logger[_0xf886('0x1d')](_0xf886('0x2c'),_0xf886('0x2d'),'twilio',util['inspect'](_0x1ad94f,{'showHidden':![],'depth':null}));});}else{logger[_0xf886('0x1d')](_0xf886('0x2c'),_0xf886('0x2d'),_0xf886('0x21'),_0xf886('0x2e'));}break;case _0xf886('0x2f'):var _0x57b8cc='https://api.skebby.it/API/v1.0/REST/';if(_0xe1a17c[_0xf886('0x30')]&&_0xe1a17c[_0xf886('0x31')]){var _0xc0c71={'recipient':[_0x28e3f2['phone']],'message':_0x28e3f2[_0xf886('0x10')],'message_type':_0xe1a17c[_0xf886('0x32')]};if(_0xe1a17c[_0xf886('0x32')]&&_0xe1a17c[_0xf886('0x32')]!=='SI'){_0xc0c71[_0xf886('0x33')]=_0xe1a17c[_0xf886('0x24')];}var _0x5eb576={'url':_0x57b8cc+_0xf886('0x34')+_0xe1a17c['username']+_0xf886('0x35')+_0xe1a17c[_0xf886('0x31')],'method':_0xf886('0x36')};rp(_0x5eb576)[_0xf886('0x1a')](function(_0x577781){var _0x1aa48d=_0x577781[_0xf886('0x37')](';');var _0x6c1919={'user_key':_0x1aa48d[0x0],'session_key':_0x1aa48d[0x1]};_0x5eb576={'url':_0x57b8cc+'sms','method':_0xf886('0x38'),'headers':{'user_key':_0x6c1919[_0xf886('0x39')],'Session_key':_0x6c1919[_0xf886('0x3a')]},'json':!![],'body':_0xc0c71};return rp(_0x5eb576);})[_0xf886('0x1a')](function(_0x4910c9){if(_0x4910c9[_0xf886('0x3b')]>=0x1){var _0x5b7ebe={'messageId':_0x4910c9[_0xf886('0x3c')]};if(_0xe1a17c[_0xf886('0x32')]!=='GP'||!_0xe1a17c[_0xf886('0x3d')]){_0x5b7ebe[_0xf886('0x3e')]=!![];}return _0x35eb2d['update'](_0x5b7ebe);}else{return logger[_0xf886('0x1d')](_0xf886('0x2c'),'afterCreate',_0xf886('0x2f'),util[_0xf886('0x3f')](_0x4910c9,{'showHidden':![],'depth':null}));}})[_0xf886('0x2b')](function(_0x22ffdd){return logger[_0xf886('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf886('0x2d'),_0xf886('0x2f'),util[_0xf886('0x3f')](_0x22ffdd,{'showHidden':![],'depth':null}));});}else{logger[_0xf886('0x1d')](_0xf886('0x2c'),_0xf886('0x2d'),_0xf886('0x2f'),_0xf886('0x40'));}break;case _0xf886('0x41'):if(_0xe1a17c['authToken']){var _0x1fee96={'recipient':_0x28e3f2[_0xf886('0x24')],'message':_0x28e3f2[_0xf886('0x10')],'sender':_0xe1a17c[_0xf886('0x42')]||_0xe1a17c[_0xf886('0x24')],'authorization':_0xe1a17c['authToken']};var _0x474a8d={'method':_0xf886('0x38'),'uri':_0xf886('0x43'),'body':_0x1fee96,'json':!![]};rp(_0x474a8d)['then'](function(_0x24f8b1){var _0x1531ae={'messageId':_0x24f8b1['requestid']};if(!_0xe1a17c[_0xf886('0x3d')]){_0x1531ae[_0xf886('0x3e')]=!![];}return _0x35eb2d[_0xf886('0x1b')](_0x1531ae);})[_0xf886('0x2b')](function(_0x35da51){logger[_0xf886('0x1d')](_0xf886('0x2c'),'afterCreate',_0xf886('0x41'),util[_0xf886('0x3f')](_0x35da51,{'showHidden':![],'depth':null}));});}else{logger[_0xf886('0x1d')](_0xf886('0x2c'),_0xf886('0x2d'),_0xf886('0x41'),_0xf886('0x44'));}break;case _0xf886('0x45'):if(_0xe1a17c[_0xf886('0x30')]&&_0xe1a17c['password']){var _0x1fee96={'messages':[{'source':'xCALLY\x20Motion','to':_0x28e3f2[_0xf886('0x24')],'body':_0x28e3f2['body'],'from':_0xe1a17c['senderString']||_0xe1a17c[_0xf886('0x24')]}]};var _0x232bc4=util['format'](_0xf886('0x46'),_0xe1a17c['username'],_0xe1a17c[_0xf886('0x31')]);var _0x474a8d={'method':'POST','uri':_0xf886('0x47'),'body':_0x1fee96,'headers':{'Authorization':util[_0xf886('0x48')]('Basic\x20%s',new Buffer(_0x232bc4)['toString'](_0xf886('0x49')))},'json':!![]};rp(_0x474a8d)[_0xf886('0x1a')](function(_0x201933){if(_0x201933[_0xf886('0x4a')]>=0xc8&&_0x201933[_0xf886('0x4a')]<=0xce){if(_0x201933[_0xf886('0x4b')]&&_0x201933[_0xf886('0x4b')][_0xf886('0x4c')]>0x0){var _0x11a63c=_['head'](_0x201933[_0xf886('0x4b')]['messages']);var _0x3bcf05={'messageId':_0x11a63c[_0xf886('0x4d')]};if(!_0xe1a17c[_0xf886('0x3d')]){_0x3bcf05['read']=!![];}return _0x35eb2d[_0xf886('0x1b')](_0x3bcf05);}else{logger[_0xf886('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf886('0x2d'),_0xf886('0x4e'),util['inspect'](_0x201933,{'showHidden':![],'depth':null}));}}else{logger[_0xf886('0x1d')](_0xf886('0x2c'),_0xf886('0x2d'),_0xf886('0x4e'),util[_0xf886('0x3f')](_0x201933,{'showHidden':![],'depth':null}));}})[_0xf886('0x2b')](function(_0x18dc98){logger[_0xf886('0x1d')](_0xf886('0x2c'),_0xf886('0x2d'),_0xf886('0x4e'),util[_0xf886('0x3f')](_0x18dc98,{'showHidden':![],'depth':null}));});}else{logger[_0xf886('0x1d')](_0xf886('0x2c'),_0xf886('0x2d'),_0xf886('0x4e'),_0xf886('0x40'));}break;case _0xf886('0x4f'):if(_0xe1a17c['authId']&&_0xe1a17c[_0xf886('0x23')]){var _0x1fee96={'dst':_0x28e3f2[_0xf886('0x24')],'text':_0x28e3f2['body'],'src':_0xe1a17c['senderString']||_0xe1a17c[_0xf886('0x24')],'url':_0xe1a17c[_0xf886('0x27')]+_0xf886('0x28')+_0x28e3f2['id']+_0xf886('0x50')+_0xe1a17c[_0xf886('0x29')]};var _0x232bc4=util['format'](_0xf886('0x46'),_0xe1a17c[_0xf886('0x51')],_0xe1a17c[_0xf886('0x23')]);var _0x474a8d={'method':_0xf886('0x38'),'uri':util['format'](_0xf886('0x52'),_0xe1a17c['authId']),'body':_0x1fee96,'headers':{'Authorization':util[_0xf886('0x48')]('Basic\x20%s',new Buffer(_0x232bc4)[_0xf886('0x53')](_0xf886('0x49')))},'json':!![]};rp(_0x474a8d)['then'](function(_0x5406f7){var _0x4d548f={'messageId':_0x5406f7[_0xf886('0x54')][0x0]};return _0x35eb2d[_0xf886('0x1b')](_0x4d548f);})[_0xf886('0x2b')](function(_0x2d1563){logger[_0xf886('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf886('0x2d'),_0xf886('0x4f'),util[_0xf886('0x3f')](_0x2d1563,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf886('0x2c'),_0xf886('0x2d'),_0xf886('0x4f'),_0xf886('0x55'));}break;case'infobip':if(_0xe1a17c[_0xf886('0x30')]&&_0xe1a17c[_0xf886('0x31')]){if(_0xe1a17c[_0xf886('0x56')]){var _0x5e11b3={'method':_0xf886('0x38'),'uri':_0xe1a17c[_0xf886('0x56')]+'/auth/1/session','body':{'username':_0xe1a17c[_0xf886('0x30')],'password':_0xe1a17c[_0xf886('0x31')]},'json':!![]};return rp(_0x5e11b3)[_0xf886('0x1a')](function(_0xedc319){var _0x47ac72={'method':'POST','uri':_0xe1a17c[_0xf886('0x56')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0xe1a17c[_0xf886('0x24')],'destinations':[{'to':_0x28e3f2[_0xf886('0x24')]}],'text':_0x28e3f2[_0xf886('0x10')],'notifyUrl':_0xe1a17c[_0xf886('0x27')]+_0xf886('0x28')+_0x28e3f2['id']+_0xf886('0x50')+_0xe1a17c[_0xf886('0x29')],'notifyContentType':'application/json','callbackData':_0xe1a17c[_0xf886('0x24')]+';'+_0x28e3f2[_0xf886('0x10')]}]},'headers':{'Authorization':_0xf886('0x57')+_0xedc319[_0xf886('0x29')]},'json':!![]};return rp(_0x47ac72)[_0xf886('0x1a')](function(_0x40734e){if(_0x40734e[_0xf886('0x25')]){var _0x45007d={'messageId':_0x40734e[_0xf886('0x25')][0x0]['messageId']};if(!_0xe1a17c[_0xf886('0x3d')]){_0x45007d[_0xf886('0x3e')]=!![];}return _0x35eb2d[_0xf886('0x1b')](_0x45007d);}else{return logger[_0xf886('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xf886('0x58'),util['inspect'](_0x40734e,{'showHidden':![],'depth':null}));}});})[_0xf886('0x2b')](function(_0x19ab5a){return logger['error'](_0xf886('0x2c'),_0xf886('0x2d'),_0xf886('0x58'),util[_0xf886('0x3f')](_0x19ab5a,{'showHidden':![],'depth':null}));});}else{logger[_0xf886('0x1d')](_0xf886('0x2c'),_0xf886('0x2d'),_0xf886('0x58'),_0xf886('0x59'));}}else{logger[_0xf886('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf886('0x2d'),_0xf886('0x58'),_0xf886('0x40'));}break;case _0xf886('0x5a'):var _0x5a4f2a=require(_0xf886('0x5b'));if(_0xe1a17c[_0xf886('0x5c')]){var _0x169b7d={};_0x169b7d[_0xf886('0x5d')]=_0xe1a17c[_0xf886('0x30')];_0x169b7d[_0xf886('0x24')]=_0x28e3f2[_0xf886('0x24')];_0x169b7d[_0xf886('0x33')]=_0xe1a17c[_0xf886('0x24')];_0x169b7d[_0xf886('0x5e')]=_0x28e3f2[_0xf886('0x10')];_0x169b7d['timestamp']=+new Date();var _0x5edd06='';var _0x2cd033='';var _0x4aa4a4=Object[_0xf886('0x5f')](_0x169b7d);_0x4aa4a4[_0xf886('0x60')]();for(var _0x53d396=0x0;_0x53d396<_0x4aa4a4[_0xf886('0x61')];_0x53d396++){if(_0x5edd06!=''){_0x5edd06+='&';}_0x5edd06+=_0x4aa4a4[_0x53d396]+'='+encodeURIComponent(_0x169b7d[_0x4aa4a4[_0x53d396]]);_0x2cd033+=_0x169b7d[_0x4aa4a4[_0x53d396]];}_0x2cd033+=_0xe1a17c['apiKey'];_0x2cd033=_0x5a4f2a[_0xf886('0x62')](_0xf886('0x63'))['update'](_0x2cd033)[_0xf886('0x64')](_0xf886('0x65'));if(_0x5edd06!==''){_0x5edd06+='&';}_0x5edd06+='signature='+_0x2cd033;var _0x5eb576={'method':'GET','uri':_0xe1a17c['baseUrl']+_0xf886('0x66')+_0x5edd06,'json':!![]};return rp(_0x5eb576)['then'](function(_0x544dcb){var _0x3b9a39=Object[_0xf886('0x5f')](_0x544dcb);if(_0x544dcb[_0x3b9a39[0x0]][_0xf886('0x1d')]&&parseInt(_0x544dcb[_0x3b9a39[0x0]][_0xf886('0x1d')])===0x0){var _0x2774e5={'messageId':_0x544dcb[_0x3b9a39[0x0]][_0xf886('0x67')]};if(!_0xe1a17c[_0xf886('0x3d')]){_0x2774e5['read']=!![];}return _0x35eb2d[_0xf886('0x1b')](_0x2774e5);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xf886('0x5a'),util[_0xf886('0x3f')](_0x544dcb[_0xf886('0x1d')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x311f3c){return logger[_0xf886('0x1d')](_0xf886('0x2c'),_0xf886('0x2d'),_0xf886('0x5a'),util[_0xf886('0x3f')](_0x311f3c,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf886('0x2c'),_0xf886('0x2d'),_0xf886('0x5a'),_0xf886('0x68'));}break;case _0xf886('0x69'):if(_0xe1a17c[_0xf886('0x5c')]){var _0x2e6ac4={'method':_0xf886('0x38'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0xe1a17c[_0xf886('0x5c')]},'body':{'content':_0x28e3f2[_0xf886('0x10')],'to':[_0x28e3f2[_0xf886('0x24')]],'from':_0xe1a17c[_0xf886('0x24')],'binary':![],'clientMessageId':_0xf886('0x6a'),'charset':_0xf886('0x6b')},'json':!![]};rp(_0x2e6ac4)[_0xf886('0x1a')](function(_0x3403a2){if(!_0x3403a2[_0xf886('0x1d')]){var _0x1f630b={'messageId':_0x3403a2['messages'][0x0][_0xf886('0x6c')]};if(!_0xe1a17c[_0xf886('0x3d')]){_0x1f630b[_0xf886('0x3e')]=!![];}return _0x35eb2d[_0xf886('0x1b')](_0x1f630b);}else{return logger['error'](_0xf886('0x2c'),_0xf886('0x2d'),_0xf886('0x69'),util[_0xf886('0x3f')](_0x3403a2['error'],{'showHidden':![],'depth':null}));}})[_0xf886('0x2b')](function(_0x799132){return logger[_0xf886('0x1d')](_0xf886('0x2c'),_0xf886('0x2d'),_0xf886('0x69'),util['inspect'](_0x799132,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf886('0x2c'),_0xf886('0x2d'),'clickatell','Missing\x20parameters:\x20apiKey');}break;case'bandwidth':if(_0xe1a17c['username']&&_0xe1a17c['password']){var _0x232bc4=util[_0xf886('0x48')](_0xf886('0x46'),_0xe1a17c['username'],_0xe1a17c['password']);var _0x474a8d={'method':_0xf886('0x38'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0xe1a17c[_0xf886('0x6d')]+_0xf886('0x6e'),'body':{'to':[_0x28e3f2[_0xf886('0x24')]],'text':_0x28e3f2[_0xf886('0x10')],'from':_0xe1a17c['phone'],'applicationId':_0xe1a17c[_0xf886('0x6f')]},'headers':{'Authorization':util[_0xf886('0x48')](_0xf886('0x70'),new Buffer(_0x232bc4)['toString'](_0xf886('0x49')))},'json':!![]};rp(_0x474a8d)['then'](function(_0x56d842){if(_0x56d842['id']){var _0x12ebdd={'messageId':_0x56d842['id']};return _0x35eb2d[_0xf886('0x1b')](_0x12ebdd);}else{logger[_0xf886('0x1d')](_0xf886('0x2c'),_0xf886('0x2d'),'bandwidth',util['inspect'](_0x56d842,{'showHidden':![],'depth':null}));}})[_0xf886('0x2b')](function(_0x3cb6b2){logger['error'](_0xf886('0x2c'),_0xf886('0x2d'),_0xf886('0x71'),util[_0xf886('0x3f')](_0x3cb6b2,{'showHidden':![],'depth':null}));});}else{logger[_0xf886('0x1d')](_0xf886('0x2c'),'afterCreate',_0xf886('0x71'),'Missing\x20parameters:\x20username,\x20password');}break;case'intelepeer':if(_0xe1a17c[_0xf886('0x5c')]){var _0x4e40d5={};var _0x5eb576={'method':_0xf886('0x38'),'uri':_0xf886('0x72'),'headers':{'Authorization':_0xf886('0x73')+_0xe1a17c[_0xf886('0x5c')],'Content-Type':_0xf886('0x74')},'body':{'from':_0xe1a17c[_0xf886('0x24')],'to':_0x28e3f2[_0xf886('0x24')],'text':_0x28e3f2[_0xf886('0x10')]},'json':!![]};return rp(_0x5eb576)[_0xf886('0x1a')](function(_0x560d60){if(_0x560d60[_0xf886('0x75')]==0xca){_0x4e40d5[_0xf886('0x76')]=_0x560d60;var _0x111af7={'method':_0xf886('0x38'),'uri':_0xf886('0x77'),'headers':{'Authorization':_0xf886('0x73')+_0xe1a17c[_0xf886('0x5c')],'Content-Type':_0xf886('0x74')},'body':{'refid':_0x4e40d5['message'][_0xf886('0x78')]},'json':!![]};return rp(_0x111af7)['then'](function(_0x3b128b){_0x4e40d5['status']=_0x3b128b;var _0x55697e={'messageId':_0x4e40d5[_0xf886('0x76')][_0xf886('0x78')],'read':!![]};return _0x35eb2d[_0xf886('0x1b')](_0x55697e);});}else{return logger[_0xf886('0x1d')](_0xf886('0x2c'),_0xf886('0x2d'),_0xf886('0x79'),util[_0xf886('0x3f')](_0x560d60,{'showHidden':![],'depth':null}));}})[_0xf886('0x2b')](function(_0x45a8ee){return logger[_0xf886('0x1d')](_0xf886('0x2c'),'afterCreate',_0xf886('0x79'),util['inspect'](_0x45a8ee,{'showHidden':![],'depth':null}));});}else{return logger[_0xf886('0x1d')](_0xf886('0x2c'),_0xf886('0x2d'),_0xf886('0x79'),_0xf886('0x7a'));}break;}}})[_0xf886('0x7b')](function(){_0x4d38cd();});}else{_0x4d38cd();}}},'charset':_0xf886('0x7c'),'collate':_0xf886('0x7d')});}; \ No newline at end of file +var _0xc7e2=['lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','messageId','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','SmsInteractionId','findOne','then','update','createdAt','catch','error','out','find','SmsAccountId','type','twilio','accountSid','phone','authToken','create','remote','/api/sms/messages/','/status?token=','sid','afterCreate','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender','login?username=','&password=','password','GET','sms','POST','user_key','session_key','total_sent','deliveryReport','inspect','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','read','Missing\x20parameters:\x20authToken','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','messages','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','token','application/json','IBSSO\x20','apiKey','text','timestamp','keys','sort','createHash','md5','digest','hex','signature=','/external/get/send.php?','csc','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','refid','status','finally','utf8mb4','utf8mb4_unicode_ci'];(function(_0x386005,_0x42b8ae){var _0x5e9626=function(_0x792625){while(--_0x792625){_0x386005['push'](_0x386005['shift']());}};_0x5e9626(++_0x42b8ae);}(_0xc7e2,0xf4));var _0x2c7e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc7e2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2c7e('0x0'));var util=require('util');var logger=require(_0x2c7e('0x1'))(_0x2c7e('0x2'));var moment=require(_0x2c7e('0x3'));var BPromise=require('bluebird');var rp=require(_0x2c7e('0x4'));var fs=require('fs');var path=require(_0x2c7e('0x5'));var rimraf=require(_0x2c7e('0x6'));var config=require(_0x2c7e('0x7'));var attributes=require(_0x2c7e('0x8'));module[_0x2c7e('0x9')]=function(_0x4cdd62,_0x4ce1d4){return _0x4cdd62['define']('SmsMessage',attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x2c7e('0xa')]},{'name':'fti_sms_messages','fields':[_0x2c7e('0xb')],'type':_0x2c7e('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x425142,_0x541708,_0x55718f){var _0x473016=_0x4cdd62[_0x2c7e('0xd')];var _0x15abd8=_0x425142[_0x2c7e('0xe')]({'plain':!![]});if(_0x15abd8[_0x2c7e('0xf')][_0x2c7e('0x10')]()==='in'||_0x15abd8[_0x2c7e('0xf')][_0x2c7e('0x10')]()==='out'&&!_0x15abd8[_0x2c7e('0x11')]&&!_[_0x2c7e('0x12')](_0x15abd8[_0x2c7e('0x13')])&&!_[_0x2c7e('0x12')](_0x15abd8[_0x2c7e('0x14')])){_0x473016['SmsInteraction'][_0x2c7e('0x15')]({'where':{'id':_0x15abd8[_0x2c7e('0x14')]}})[_0x2c7e('0x16')](function(_0x446ada){if(_0x446ada){_0x446ada[_0x2c7e('0x17')]({'lastMsgAt':_0x15abd8[_0x2c7e('0x18')],'lastMsgDirection':_0x15abd8[_0x2c7e('0xf')][_0x2c7e('0x10')]()});}})[_0x2c7e('0x19')](function(_0xb1ad9){console[_0x2c7e('0x1a')](_0xb1ad9);});}if(_0x15abd8['direction']===_0x2c7e('0x1b')&&!_0x15abd8[_0x2c7e('0x11')]){var _0x3b3c46;_0x473016['SmsAccount'][_0x2c7e('0x1c')]({'where':{'id':_0x15abd8[_0x2c7e('0x1d')]},'raw':!![]})[_0x2c7e('0x16')](function(_0x4ea4b3){_0x3b3c46=_0x4ea4b3;if(_0x3b3c46&&_0x3b3c46[_0x2c7e('0x1e')]){switch(_0x3b3c46[_0x2c7e('0x1e')]){case _0x2c7e('0x1f'):var _0x13f9e5=require('twilio');if(_0x3b3c46[_0x2c7e('0x20')]&&_0x3b3c46['authToken']&&_0x3b3c46[_0x2c7e('0x21')]){var _0x25b97d=new _0x13f9e5(_0x3b3c46[_0x2c7e('0x20')],_0x3b3c46[_0x2c7e('0x22')]);_0x25b97d['messages'][_0x2c7e('0x23')]({'body':_0x15abd8['body'],'to':_0x15abd8[_0x2c7e('0x21')],'from':_0x3b3c46[_0x2c7e('0x21')],'statusCallback':_0x3b3c46[_0x2c7e('0x24')]+_0x2c7e('0x25')+_0x15abd8['id']+_0x2c7e('0x26')+_0x3b3c46['token']})[_0x2c7e('0x16')](function(_0x3ea068){if(_0x3ea068[_0x2c7e('0x27')]){return _0x425142[_0x2c7e('0x17')]({'messageId':_0x3ea068[_0x2c7e('0x27')]});}})['catch'](function(_0x20b3f3){logger[_0x2c7e('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2c7e('0x28'),_0x2c7e('0x1f'),util['inspect'](_0x20b3f3,{'showHidden':![],'depth':null}));});}else{logger[_0x2c7e('0x1a')](_0x2c7e('0x29'),_0x2c7e('0x28'),'twilio',_0x2c7e('0x2a'));}break;case _0x2c7e('0x2b'):var _0x1a2918=_0x2c7e('0x2c');if(_0x3b3c46[_0x2c7e('0x2d')]&&_0x3b3c46['password']){var _0x15c51c={'recipient':[_0x15abd8[_0x2c7e('0x21')]],'message':_0x15abd8[_0x2c7e('0xb')],'message_type':_0x3b3c46[_0x2c7e('0x2e')]};if(_0x3b3c46['smsMethod']&&_0x3b3c46[_0x2c7e('0x2e')]!=='SI'){_0x15c51c[_0x2c7e('0x2f')]=_0x3b3c46[_0x2c7e('0x21')];}var _0x1f7b78={'url':_0x1a2918+_0x2c7e('0x30')+_0x3b3c46[_0x2c7e('0x2d')]+_0x2c7e('0x31')+_0x3b3c46[_0x2c7e('0x32')],'method':_0x2c7e('0x33')};rp(_0x1f7b78)[_0x2c7e('0x16')](function(_0x1e6bc2){var _0x4ebde8=_0x1e6bc2['split'](';');var _0x5e742e={'user_key':_0x4ebde8[0x0],'session_key':_0x4ebde8[0x1]};_0x1f7b78={'url':_0x1a2918+_0x2c7e('0x34'),'method':_0x2c7e('0x35'),'headers':{'user_key':_0x5e742e[_0x2c7e('0x36')],'Session_key':_0x5e742e[_0x2c7e('0x37')]},'json':!![],'body':_0x15c51c};return rp(_0x1f7b78);})[_0x2c7e('0x16')](function(_0x5799c1){if(_0x5799c1[_0x2c7e('0x38')]>=0x1){var _0x5673bb={'messageId':_0x5799c1['internal_order_id']};if(_0x3b3c46[_0x2c7e('0x2e')]!=='GP'||!_0x3b3c46[_0x2c7e('0x39')]){_0x5673bb['read']=!![];}return _0x425142[_0x2c7e('0x17')](_0x5673bb);}else{return logger[_0x2c7e('0x1a')](_0x2c7e('0x29'),_0x2c7e('0x28'),'skebby',util[_0x2c7e('0x3a')](_0x5799c1,{'showHidden':![],'depth':null}));}})['catch'](function(_0x442268){return logger[_0x2c7e('0x1a')](_0x2c7e('0x29'),'afterCreate',_0x2c7e('0x2b'),util['inspect'](_0x442268,{'showHidden':![],'depth':null}));});}else{logger[_0x2c7e('0x1a')](_0x2c7e('0x29'),_0x2c7e('0x28'),_0x2c7e('0x2b'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x2c7e('0x3b'):if(_0x3b3c46[_0x2c7e('0x22')]){var _0xa9e34e={'recipient':_0x15abd8[_0x2c7e('0x21')],'message':_0x15abd8[_0x2c7e('0xb')],'sender':_0x3b3c46[_0x2c7e('0x3c')]||_0x3b3c46[_0x2c7e('0x21')],'authorization':_0x3b3c46[_0x2c7e('0x22')]};var _0x541708={'method':'POST','uri':_0x2c7e('0x3d'),'body':_0xa9e34e,'json':!![]};rp(_0x541708)[_0x2c7e('0x16')](function(_0xe9f108){var _0x6586e4={'messageId':_0xe9f108[_0x2c7e('0x3e')]};if(!_0x3b3c46[_0x2c7e('0x39')]){_0x6586e4[_0x2c7e('0x3f')]=!![];}return _0x425142['update'](_0x6586e4);})[_0x2c7e('0x19')](function(_0x1effd6){logger[_0x2c7e('0x1a')](_0x2c7e('0x29'),_0x2c7e('0x28'),'connectel',util[_0x2c7e('0x3a')](_0x1effd6,{'showHidden':![],'depth':null}));});}else{logger[_0x2c7e('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2c7e('0x28'),_0x2c7e('0x3b'),_0x2c7e('0x40'));}break;case'clicksend':if(_0x3b3c46[_0x2c7e('0x2d')]&&_0x3b3c46[_0x2c7e('0x32')]){var _0xa9e34e={'messages':[{'source':'xCALLY\x20Motion','to':_0x15abd8[_0x2c7e('0x21')],'body':_0x15abd8['body'],'from':_0x3b3c46[_0x2c7e('0x3c')]||_0x3b3c46[_0x2c7e('0x21')]}]};var _0x3a0f1e=util[_0x2c7e('0x41')](_0x2c7e('0x42'),_0x3b3c46[_0x2c7e('0x2d')],_0x3b3c46['password']);var _0x541708={'method':'POST','uri':_0x2c7e('0x43'),'body':_0xa9e34e,'headers':{'Authorization':util[_0x2c7e('0x41')](_0x2c7e('0x44'),new Buffer(_0x3a0f1e)[_0x2c7e('0x45')](_0x2c7e('0x46')))},'json':!![]};rp(_0x541708)[_0x2c7e('0x16')](function(_0x4493e7){if(_0x4493e7[_0x2c7e('0x47')]>=0xc8&&_0x4493e7[_0x2c7e('0x47')]<=0xce){if(_0x4493e7[_0x2c7e('0x48')]&&_0x4493e7[_0x2c7e('0x48')][_0x2c7e('0x49')]>0x0){var _0x5a4dbd=_[_0x2c7e('0x4a')](_0x4493e7[_0x2c7e('0x48')][_0x2c7e('0x4b')]);var _0x3abe58={'messageId':_0x5a4dbd[_0x2c7e('0x4c')]};if(!_0x3b3c46[_0x2c7e('0x39')]){_0x3abe58[_0x2c7e('0x3f')]=!![];}return _0x425142[_0x2c7e('0x17')](_0x3abe58);}else{logger['error'](_0x2c7e('0x29'),_0x2c7e('0x28'),_0x2c7e('0x4d'),util[_0x2c7e('0x3a')](_0x4493e7,{'showHidden':![],'depth':null}));}}else{logger[_0x2c7e('0x1a')](_0x2c7e('0x29'),_0x2c7e('0x28'),_0x2c7e('0x4d'),util[_0x2c7e('0x3a')](_0x4493e7,{'showHidden':![],'depth':null}));}})[_0x2c7e('0x19')](function(_0x5b1c90){logger[_0x2c7e('0x1a')](_0x2c7e('0x29'),_0x2c7e('0x28'),_0x2c7e('0x4d'),util[_0x2c7e('0x3a')](_0x5b1c90,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x2c7e('0x29'),_0x2c7e('0x28'),'clickSend',_0x2c7e('0x4e'));}break;case'plivo':if(_0x3b3c46[_0x2c7e('0x4f')]&&_0x3b3c46[_0x2c7e('0x22')]){var _0xa9e34e={'dst':_0x15abd8['phone'],'text':_0x15abd8[_0x2c7e('0xb')],'src':_0x3b3c46[_0x2c7e('0x3c')]||_0x3b3c46[_0x2c7e('0x21')],'url':_0x3b3c46[_0x2c7e('0x24')]+_0x2c7e('0x25')+_0x15abd8['id']+_0x2c7e('0x26')+_0x3b3c46['token']};var _0x3a0f1e=util['format'](_0x2c7e('0x42'),_0x3b3c46['authId'],_0x3b3c46[_0x2c7e('0x22')]);var _0x541708={'method':_0x2c7e('0x35'),'uri':util[_0x2c7e('0x41')](_0x2c7e('0x50'),_0x3b3c46['authId']),'body':_0xa9e34e,'headers':{'Authorization':util['format'](_0x2c7e('0x44'),new Buffer(_0x3a0f1e)[_0x2c7e('0x45')](_0x2c7e('0x46')))},'json':!![]};rp(_0x541708)[_0x2c7e('0x16')](function(_0x197a09){var _0xd563a7={'messageId':_0x197a09[_0x2c7e('0x51')][0x0]};return _0x425142[_0x2c7e('0x17')](_0xd563a7);})[_0x2c7e('0x19')](function(_0x5dc06d){logger['error'](_0x2c7e('0x29'),_0x2c7e('0x28'),_0x2c7e('0x52'),util['inspect'](_0x5dc06d,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x2c7e('0x29'),_0x2c7e('0x28'),_0x2c7e('0x52'),_0x2c7e('0x53'));}break;case _0x2c7e('0x54'):if(_0x3b3c46[_0x2c7e('0x2d')]&&_0x3b3c46[_0x2c7e('0x32')]){if(_0x3b3c46[_0x2c7e('0x55')]){var _0x2b8746={'method':_0x2c7e('0x35'),'uri':_0x3b3c46[_0x2c7e('0x55')]+_0x2c7e('0x56'),'body':{'username':_0x3b3c46['username'],'password':_0x3b3c46[_0x2c7e('0x32')]},'json':!![]};return rp(_0x2b8746)[_0x2c7e('0x16')](function(_0x3a9e5d){var _0x1fa157={'method':_0x2c7e('0x35'),'uri':_0x3b3c46[_0x2c7e('0x55')]+_0x2c7e('0x57'),'body':{'messages':[{'from':_0x3b3c46['phone'],'destinations':[{'to':_0x15abd8[_0x2c7e('0x21')]}],'text':_0x15abd8[_0x2c7e('0xb')],'notifyUrl':_0x3b3c46[_0x2c7e('0x24')]+_0x2c7e('0x25')+_0x15abd8['id']+_0x2c7e('0x26')+_0x3b3c46[_0x2c7e('0x58')],'notifyContentType':_0x2c7e('0x59'),'callbackData':_0x3b3c46['phone']+';'+_0x15abd8[_0x2c7e('0xb')]}]},'headers':{'Authorization':_0x2c7e('0x5a')+_0x3a9e5d[_0x2c7e('0x58')]},'json':!![]};return rp(_0x1fa157)[_0x2c7e('0x16')](function(_0x234a39){if(_0x234a39[_0x2c7e('0x4b')]){var _0x49bba9={'messageId':_0x234a39['messages'][0x0][_0x2c7e('0xa')]};if(!_0x3b3c46[_0x2c7e('0x39')]){_0x49bba9[_0x2c7e('0x3f')]=!![];}return _0x425142[_0x2c7e('0x17')](_0x49bba9);}else{return logger[_0x2c7e('0x1a')](_0x2c7e('0x29'),'afterCreate',_0x2c7e('0x54'),util[_0x2c7e('0x3a')](_0x234a39,{'showHidden':![],'depth':null}));}});})[_0x2c7e('0x19')](function(_0xd66b37){return logger[_0x2c7e('0x1a')](_0x2c7e('0x29'),'afterCreate',_0x2c7e('0x54'),util[_0x2c7e('0x3a')](_0xd66b37,{'showHidden':![],'depth':null}));});}else{logger[_0x2c7e('0x1a')](_0x2c7e('0x29'),_0x2c7e('0x28'),_0x2c7e('0x54'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x2c7e('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x2c7e('0x54'),_0x2c7e('0x4e'));}break;case'csc':var _0x5bc3ef=require('crypto');if(_0x3b3c46[_0x2c7e('0x5b')]){var _0x2b7ef0={};_0x2b7ef0['login']=_0x3b3c46[_0x2c7e('0x2d')];_0x2b7ef0[_0x2c7e('0x21')]=_0x15abd8[_0x2c7e('0x21')];_0x2b7ef0['sender']=_0x3b3c46[_0x2c7e('0x21')];_0x2b7ef0[_0x2c7e('0x5c')]=_0x15abd8[_0x2c7e('0xb')];_0x2b7ef0[_0x2c7e('0x5d')]=+new Date();var _0x7b07ef='';var _0x26ec1e='';var _0x1fd5ba=Object[_0x2c7e('0x5e')](_0x2b7ef0);_0x1fd5ba[_0x2c7e('0x5f')]();for(var _0x4c576b=0x0;_0x4c576b<_0x1fd5ba['length'];_0x4c576b++){if(_0x7b07ef!=''){_0x7b07ef+='&';}_0x7b07ef+=_0x1fd5ba[_0x4c576b]+'='+encodeURIComponent(_0x2b7ef0[_0x1fd5ba[_0x4c576b]]);_0x26ec1e+=_0x2b7ef0[_0x1fd5ba[_0x4c576b]];}_0x26ec1e+=_0x3b3c46['apiKey'];_0x26ec1e=_0x5bc3ef[_0x2c7e('0x60')](_0x2c7e('0x61'))[_0x2c7e('0x17')](_0x26ec1e)[_0x2c7e('0x62')](_0x2c7e('0x63'));if(_0x7b07ef!==''){_0x7b07ef+='&';}_0x7b07ef+=_0x2c7e('0x64')+_0x26ec1e;var _0x1f7b78={'method':_0x2c7e('0x33'),'uri':_0x3b3c46['baseUrl']+_0x2c7e('0x65')+_0x7b07ef,'json':!![]};return rp(_0x1f7b78)[_0x2c7e('0x16')](function(_0x1c6589){var _0x2ced4f=Object[_0x2c7e('0x5e')](_0x1c6589);if(_0x1c6589[_0x2ced4f[0x0]][_0x2c7e('0x1a')]&&parseInt(_0x1c6589[_0x2ced4f[0x0]][_0x2c7e('0x1a')])===0x0){var _0x1db1a9={'messageId':_0x1c6589[_0x2ced4f[0x0]]['id_sms']};if(!_0x3b3c46['deliveryReport']){_0x1db1a9[_0x2c7e('0x3f')]=!![];}return _0x425142[_0x2c7e('0x17')](_0x1db1a9);}else{return logger['error'](_0x2c7e('0x29'),_0x2c7e('0x28'),'csc',util['inspect'](_0x1c6589[_0x2c7e('0x1a')],{'showHidden':![],'depth':null}));}})[_0x2c7e('0x19')](function(_0x3bdc5e){return logger[_0x2c7e('0x1a')](_0x2c7e('0x29'),_0x2c7e('0x28'),_0x2c7e('0x66'),util[_0x2c7e('0x3a')](_0x3bdc5e,{'showHidden':![],'depth':null}));});}else{logger[_0x2c7e('0x1a')](_0x2c7e('0x29'),'afterCreate',_0x2c7e('0x66'),_0x2c7e('0x67'));}break;case _0x2c7e('0x68'):if(_0x3b3c46['apiKey']){var _0x53541c={'method':_0x2c7e('0x35'),'uri':_0x2c7e('0x69'),'headers':{'Authorization':_0x3b3c46['apiKey']},'body':{'content':_0x15abd8[_0x2c7e('0xb')],'to':[_0x15abd8['phone']],'from':_0x3b3c46['phone'],'binary':![],'clientMessageId':_0x2c7e('0x6a'),'charset':_0x2c7e('0x6b')},'json':!![]};rp(_0x53541c)[_0x2c7e('0x16')](function(_0xf1d3ec){if(!_0xf1d3ec[_0x2c7e('0x1a')]){var _0x44465c={'messageId':_0xf1d3ec[_0x2c7e('0x4b')][0x0][_0x2c7e('0x6c')]};if(!_0x3b3c46[_0x2c7e('0x39')]){_0x44465c['read']=!![];}return _0x425142[_0x2c7e('0x17')](_0x44465c);}else{return logger[_0x2c7e('0x1a')](_0x2c7e('0x29'),_0x2c7e('0x28'),_0x2c7e('0x68'),util[_0x2c7e('0x3a')](_0xf1d3ec[_0x2c7e('0x1a')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x565aa5){return logger['error'](_0x2c7e('0x29'),_0x2c7e('0x28'),_0x2c7e('0x68'),util[_0x2c7e('0x3a')](_0x565aa5,{'showHidden':![],'depth':null}));});}else{logger[_0x2c7e('0x1a')](_0x2c7e('0x29'),_0x2c7e('0x28'),_0x2c7e('0x68'),_0x2c7e('0x67'));}break;case _0x2c7e('0x6d'):if(_0x3b3c46[_0x2c7e('0x2d')]&&_0x3b3c46[_0x2c7e('0x32')]){var _0x3a0f1e=util[_0x2c7e('0x41')](_0x2c7e('0x42'),_0x3b3c46[_0x2c7e('0x2d')],_0x3b3c46[_0x2c7e('0x32')]);var _0x541708={'method':_0x2c7e('0x35'),'uri':_0x2c7e('0x6e')+_0x3b3c46['accountId']+_0x2c7e('0x6f'),'body':{'to':[_0x15abd8[_0x2c7e('0x21')]],'text':_0x15abd8[_0x2c7e('0xb')],'from':_0x3b3c46['phone'],'applicationId':_0x3b3c46[_0x2c7e('0x70')]},'headers':{'Authorization':util[_0x2c7e('0x41')](_0x2c7e('0x44'),new Buffer(_0x3a0f1e)[_0x2c7e('0x45')]('base64'))},'json':!![]};rp(_0x541708)[_0x2c7e('0x16')](function(_0x58574b){if(_0x58574b['id']){var _0x1d936f={'messageId':_0x58574b['id']};return _0x425142[_0x2c7e('0x17')](_0x1d936f);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2c7e('0x28'),_0x2c7e('0x6d'),util['inspect'](_0x58574b,{'showHidden':![],'depth':null}));}})[_0x2c7e('0x19')](function(_0x27a88f){logger[_0x2c7e('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2c7e('0x28'),_0x2c7e('0x6d'),util[_0x2c7e('0x3a')](_0x27a88f,{'showHidden':![],'depth':null}));});}else{logger[_0x2c7e('0x1a')](_0x2c7e('0x29'),_0x2c7e('0x28'),_0x2c7e('0x6d'),_0x2c7e('0x4e'));}break;case _0x2c7e('0x71'):if(_0x3b3c46['apiKey']){var _0x26c8e2={};var _0x1f7b78={'method':_0x2c7e('0x35'),'uri':_0x2c7e('0x72'),'headers':{'Authorization':_0x2c7e('0x73')+_0x3b3c46['apiKey'],'Content-Type':_0x2c7e('0x59')},'body':{'from':_0x3b3c46[_0x2c7e('0x21')],'to':_0x15abd8[_0x2c7e('0x21')],'text':_0x15abd8[_0x2c7e('0xb')]},'json':!![]};return rp(_0x1f7b78)[_0x2c7e('0x16')](function(_0x1ca251){if(_0x1ca251['code']==0xca){_0x26c8e2[_0x2c7e('0x74')]=_0x1ca251;var _0x533f0a={'method':_0x2c7e('0x35'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x2c7e('0x73')+_0x3b3c46[_0x2c7e('0x5b')],'Content-Type':_0x2c7e('0x59')},'body':{'refid':_0x26c8e2['message'][_0x2c7e('0x75')]},'json':!![]};return rp(_0x533f0a)[_0x2c7e('0x16')](function(_0x3fb8e3){_0x26c8e2[_0x2c7e('0x76')]=_0x3fb8e3;var _0x38fa90={'messageId':_0x26c8e2[_0x2c7e('0x74')][_0x2c7e('0x75')],'read':!![]};return _0x425142['update'](_0x38fa90);});}else{return logger[_0x2c7e('0x1a')](_0x2c7e('0x29'),'afterCreate','intelepeer',util['inspect'](_0x1ca251,{'showHidden':![],'depth':null}));}})[_0x2c7e('0x19')](function(_0x54eaef){return logger[_0x2c7e('0x1a')](_0x2c7e('0x29'),_0x2c7e('0x28'),'intelepeer',util[_0x2c7e('0x3a')](_0x54eaef,{'showHidden':![],'depth':null}));});}else{return logger[_0x2c7e('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x2c7e('0x71'),'Token\x20not\x20received');}break;}}})[_0x2c7e('0x77')](function(){_0x55718f();});}else{_0x55718f();}}},'charset':_0x2c7e('0x78'),'collate':_0x2c7e('0x79')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 369beaf..8568441 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 _0x353b=['http','redis','defaults','socket.io-emitter','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsMessage','SmsMessage','body','options','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4aa285,_0x1fe00d){var _0x2777ee=function(_0x181d0f){while(--_0x181d0f){_0x4aa285['push'](_0x4aa285['shift']());}};_0x2777ee(++_0x1fe00d);}(_0x353b,0x1a8));var _0xb353=function(_0x30207d,_0x9a4466){_0x30207d=_0x30207d-0x0;var _0x282210=_0x353b[_0x30207d];return _0x282210;};'use strict';var _=require('lodash');var util=require(_0xb353('0x0'));var moment=require('moment');var BPromise=require(_0xb353('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb353('0x2'));var db=require(_0xb353('0x3'))['db'];var utils=require(_0xb353('0x4'));var logger=require(_0xb353('0x5'))(_0xb353('0x6'));var config=require(_0xb353('0x7'));var jayson=require(_0xb353('0x8'));var client=jayson[_0xb353('0x9')][_0xb353('0xa')]({'port':0x232a});config[_0xb353('0xb')]=_[_0xb353('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb353('0xd'))(new Redis(config['redis']));require('./smsMessage.socket')['register'](socket);function respondWithRpcPromise(_0x487c13,_0x602917,_0x427238){return new BPromise(function(_0x1fb165,_0x59440f){return client[_0xb353('0xe')](_0x487c13,_0x427238)[_0xb353('0xf')](function(_0x502ec0){logger[_0xb353('0x10')](_0xb353('0x11'),_0x602917,_0xb353('0x12'));logger[_0xb353('0x13')](_0xb353('0x14'),_0x602917,_0xb353('0x12'),JSON[_0xb353('0x15')](_0x502ec0));if(_0x502ec0['error']){if(_0x502ec0[_0xb353('0x16')][_0xb353('0x17')]===0x1f4){logger[_0xb353('0x16')](_0xb353('0x11'),_0x602917,_0x502ec0['error']['message']);return _0x59440f(_0x502ec0[_0xb353('0x16')]['message']);}logger['error'](_0xb353('0x11'),_0x602917,_0x502ec0[_0xb353('0x16')][_0xb353('0x18')]);return _0x1fb165(_0x502ec0[_0xb353('0x16')][_0xb353('0x18')]);}else{logger[_0xb353('0x10')]('SmsMessage,\x20%s,\x20%s',_0x602917,'request\x20sent');_0x1fb165(_0x502ec0[_0xb353('0x19')]['message']);}})[_0xb353('0x1a')](function(_0x49b226){logger[_0xb353('0x16')](_0xb353('0x11'),_0x602917,_0x49b226);_0x59440f(_0x49b226);});});}exports[_0xb353('0x1b')]=function(_0x6757a){var _0x9821f1=this;return new Promise(function(_0x532354,_0xe59c27){return db[_0xb353('0x1c')]['create'](_0x6757a[_0xb353('0x1d')],{'raw':_0x6757a[_0xb353('0x1e')]?_0x6757a[_0xb353('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5c8416){logger[_0xb353('0x10')](_0xb353('0x1b'),_0x6757a);logger[_0xb353('0x13')](_0xb353('0x1b'),_0x6757a,JSON[_0xb353('0x15')](_0x5c8416));_0x532354(_0x5c8416);})[_0xb353('0x1a')](function(_0x4ce295){logger[_0xb353('0x16')]('CreateSmsMessage',_0x4ce295[_0xb353('0x18')],_0x6757a);_0xe59c27(_0x9821f1[_0xb353('0x16')](0x1f4,_0x4ce295[_0xb353('0x18')]));});});}; \ No newline at end of file +var _0xe6b3=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','debug'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe6b3,0x8c));var _0x3e6b=function(_0x5af5b2,_0xa9ea50){_0x5af5b2=_0x5af5b2-0x0;var _0x5dc8b9=_0xe6b3[_0x5af5b2];return _0x5dc8b9;};'use strict';var _=require(_0x3e6b('0x0'));var util=require(_0x3e6b('0x1'));var moment=require(_0x3e6b('0x2'));var BPromise=require(_0x3e6b('0x3'));var rs=require(_0x3e6b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e6b('0x5'))['db'];var utils=require(_0x3e6b('0x6'));var logger=require('../../config/logger')(_0x3e6b('0x7'));var config=require('../../config/environment');var jayson=require(_0x3e6b('0x8'));var client=jayson['client'][_0x3e6b('0x9')]({'port':0x232a});config[_0x3e6b('0xa')]=_[_0x3e6b('0xb')](config['redis'],{'host':_0x3e6b('0xc'),'port':0x18eb});var socket=require(_0x3e6b('0xd'))(new Redis(config[_0x3e6b('0xa')]));require(_0x3e6b('0xe'))[_0x3e6b('0xf')](socket);function respondWithRpcPromise(_0x26b238,_0xb28235,_0x27f693){return new BPromise(function(_0x3ef3a8,_0x1de3f6){return client[_0x3e6b('0x10')](_0x26b238,_0x27f693)[_0x3e6b('0x11')](function(_0x2e6012){logger[_0x3e6b('0x12')](_0x3e6b('0x13'),_0xb28235,'request\x20sent');logger['debug'](_0x3e6b('0x14'),_0xb28235,_0x3e6b('0x15'),JSON[_0x3e6b('0x16')](_0x2e6012));if(_0x2e6012['error']){if(_0x2e6012[_0x3e6b('0x17')][_0x3e6b('0x18')]===0x1f4){logger[_0x3e6b('0x17')](_0x3e6b('0x13'),_0xb28235,_0x2e6012[_0x3e6b('0x17')]['message']);return _0x1de3f6(_0x2e6012[_0x3e6b('0x17')][_0x3e6b('0x19')]);}logger[_0x3e6b('0x17')](_0x3e6b('0x13'),_0xb28235,_0x2e6012[_0x3e6b('0x17')][_0x3e6b('0x19')]);return _0x3ef3a8(_0x2e6012['error'][_0x3e6b('0x19')]);}else{logger[_0x3e6b('0x12')](_0x3e6b('0x13'),_0xb28235,_0x3e6b('0x15'));_0x3ef3a8(_0x2e6012[_0x3e6b('0x1a')][_0x3e6b('0x19')]);}})[_0x3e6b('0x1b')](function(_0x45f056){logger[_0x3e6b('0x17')](_0x3e6b('0x13'),_0xb28235,_0x45f056);_0x1de3f6(_0x45f056);});});}exports[_0x3e6b('0x1c')]=function(_0x23aa36){var _0x256d7a=this;return new Promise(function(_0x1f3f77,_0xd103d8){return db[_0x3e6b('0x1d')][_0x3e6b('0x1e')](_0x23aa36[_0x3e6b('0x1f')],{'raw':_0x23aa36[_0x3e6b('0x20')]?_0x23aa36[_0x3e6b('0x20')][_0x3e6b('0x21')]===undefined?!![]:![]:!![]})[_0x3e6b('0x11')](function(_0x304ef7){logger[_0x3e6b('0x12')](_0x3e6b('0x1c'),_0x23aa36);logger[_0x3e6b('0x22')](_0x3e6b('0x1c'),_0x23aa36,JSON['stringify'](_0x304ef7));_0x1f3f77(_0x304ef7);})[_0x3e6b('0x1b')](function(_0x384756){logger[_0x3e6b('0x17')]('CreateSmsMessage',_0x384756[_0x3e6b('0x19')],_0x23aa36);_0xd103d8(_0x256d7a[_0x3e6b('0x17')](0x1f4,_0x384756[_0x3e6b('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index f3f73d6..e74e683 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 _0xb206=['register','smsMessage:','./smsMessage.events','save','remove','update','emit','removeListener'];(function(_0x4f54e2,_0x5e7a7b){var _0x36ce6f=function(_0xbcdd37){while(--_0xbcdd37){_0x4f54e2['push'](_0x4f54e2['shift']());}};_0x36ce6f(++_0x5e7a7b);}(_0xb206,0x10a));var _0x6b20=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xb206[_0x4c7fb5];return _0x2e10ac;};'use strict';var SmsMessageEvents=require(_0x6b20('0x0'));var events=[_0x6b20('0x1'),_0x6b20('0x2'),_0x6b20('0x3')];function createListener(_0x3e8666,_0xf3c44b){return function(_0x5b1684){_0xf3c44b[_0x6b20('0x4')](_0x3e8666,_0x5b1684);};}function removeListener(_0xdc8065,_0x4fa2dc){return function(){SmsMessageEvents[_0x6b20('0x5')](_0xdc8065,_0x4fa2dc);};}exports[_0x6b20('0x6')]=function(_0x1365fa){for(var _0x14a6db=0x0,_0x3a8a1d=events['length'];_0x14a6db<_0x3a8a1d;_0x14a6db++){var _0x31b0f4=events[_0x14a6db];var _0x294482=createListener(_0x6b20('0x7')+_0x31b0f4,_0x1365fa);SmsMessageEvents['on'](_0x31b0f4,_0x294482);}}; \ No newline at end of file +var _0xaaa2=['remove','update','emit','register','length','./smsMessage.events','save'];(function(_0xbca96f,_0x266b8a){var _0x16807e=function(_0x3c4763){while(--_0x3c4763){_0xbca96f['push'](_0xbca96f['shift']());}};_0x16807e(++_0x266b8a);}(_0xaaa2,0x1cc));var _0x2aaa=function(_0x4778b1,_0x21bcf0){_0x4778b1=_0x4778b1-0x0;var _0x331a17=_0xaaa2[_0x4778b1];return _0x331a17;};'use strict';var SmsMessageEvents=require(_0x2aaa('0x0'));var events=[_0x2aaa('0x1'),_0x2aaa('0x2'),_0x2aaa('0x3')];function createListener(_0x450f4d,_0x32fa4e){return function(_0x23cead){_0x32fa4e[_0x2aaa('0x4')](_0x450f4d,_0x23cead);};}function removeListener(_0x3ea758,_0x129ed2){return function(){SmsMessageEvents['removeListener'](_0x3ea758,_0x129ed2);};}exports[_0x2aaa('0x5')]=function(_0x22146b){for(var _0x572020=0x0,_0x150032=events[_0x2aaa('0x6')];_0x572020<_0x150032;_0x572020++){var _0x55ee41=events[_0x572020];var _0x41cb5d=createListener('smsMessage:'+_0x55ee41,_0x22146b);SmsMessageEvents['on'](_0x55ee41,_0x41cb5d);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index bfb385b..2df92a6 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 _0xeaa9=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','delete','removeAgents','exports','connect-timeout'];(function(_0x10e1b4,_0x3a2b84){var _0x26a40d=function(_0x3fc80b){while(--_0x3fc80b){_0x10e1b4['push'](_0x10e1b4['shift']());}};_0x26a40d(++_0x3a2b84);}(_0xeaa9,0x141));var _0x9eaa=function(_0x379339,_0x25902e){_0x379339=_0x379339-0x0;var _0x1159b0=_0xeaa9[_0x379339];return _0x1159b0;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x9eaa('0x0'));var express=require(_0x9eaa('0x1'));var router=express[_0x9eaa('0x2')]();var fs_extra=require(_0x9eaa('0x3'));var auth=require(_0x9eaa('0x4'));var interaction=require(_0x9eaa('0x5'));var config=require('../../config/environment');var controller=require('./smsQueue.controller');router[_0x9eaa('0x6')]('/',auth[_0x9eaa('0x7')](),controller[_0x9eaa('0x8')]);router[_0x9eaa('0x6')](_0x9eaa('0x9'),auth[_0x9eaa('0x7')](),controller['describe']);router[_0x9eaa('0x6')](_0x9eaa('0xa'),auth[_0x9eaa('0x7')](),controller[_0x9eaa('0xb')]);router[_0x9eaa('0x6')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0x9eaa('0x6')](_0x9eaa('0xc'),auth['isAuthenticated'](),controller[_0x9eaa('0xd')]);router[_0x9eaa('0x6')](_0x9eaa('0xe'),auth[_0x9eaa('0x7')](),controller[_0x9eaa('0xf')]);router[_0x9eaa('0x10')]('/',auth['isAuthenticated'](),controller[_0x9eaa('0x11')]);router[_0x9eaa('0x10')](_0x9eaa('0xc'),auth[_0x9eaa('0x7')](),controller[_0x9eaa('0x12')]);router[_0x9eaa('0x10')](_0x9eaa('0xe'),auth[_0x9eaa('0x7')](),controller['addAgents']);router[_0x9eaa('0x13')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x9eaa('0x7')](),controller['destroy']);router[_0x9eaa('0x14')](_0x9eaa('0xc'),auth[_0x9eaa('0x7')](),controller['removeTeams']);router[_0x9eaa('0x14')]('/:id/users',auth[_0x9eaa('0x7')](),controller[_0x9eaa('0x15')]);module[_0x9eaa('0x16')]=router; \ No newline at end of file +var _0xac6c=['../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','/describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','put','destroy','removeTeams','delete','removeAgents','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x34bc94,_0x74f0fd){var _0xee41e7=function(_0x424111){while(--_0x424111){_0x34bc94['push'](_0x34bc94['shift']());}};_0xee41e7(++_0x74f0fd);}(_0xac6c,0xe4));var _0xcac6=function(_0x2238db,_0xe23c3a){_0x2238db=_0x2238db-0x0;var _0x203149=_0xac6c[_0x2238db];return _0x203149;};'use strict';var multer=require(_0xcac6('0x0'));var util=require(_0xcac6('0x1'));var path=require('path');var timeout=require(_0xcac6('0x2'));var express=require(_0xcac6('0x3'));var router=express[_0xcac6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xcac6('0x5'));var interaction=require(_0xcac6('0x6'));var config=require(_0xcac6('0x7'));var controller=require(_0xcac6('0x8'));router[_0xcac6('0x9')]('/',auth[_0xcac6('0xa')](),controller['index']);router[_0xcac6('0x9')](_0xcac6('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xcac6('0x9')](_0xcac6('0xc'),auth[_0xcac6('0xa')](),controller[_0xcac6('0xd')]);router[_0xcac6('0x9')](_0xcac6('0xe'),auth[_0xcac6('0xa')](),controller[_0xcac6('0xf')]);router[_0xcac6('0x9')](_0xcac6('0x10'),auth[_0xcac6('0xa')](),controller['getTeams']);router[_0xcac6('0x9')](_0xcac6('0x11'),auth[_0xcac6('0xa')](),controller[_0xcac6('0x12')]);router[_0xcac6('0x13')]('/',auth['isAuthenticated'](),controller[_0xcac6('0x14')]);router[_0xcac6('0x13')](_0xcac6('0x10'),auth['isAuthenticated'](),controller['addTeams']);router[_0xcac6('0x13')]('/:id/users',auth[_0xcac6('0xa')](),controller['addAgents']);router[_0xcac6('0x15')](_0xcac6('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xcac6('0xc'),auth[_0xcac6('0xa')](),controller[_0xcac6('0x16')]);router['delete']('/:id/teams',auth[_0xcac6('0xa')](),controller[_0xcac6('0x17')]);router[_0xcac6('0x18')](_0xcac6('0x11'),auth[_0xcac6('0xa')](),controller[_0xcac6('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 170329d..5075b96 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 _0xc633=['name','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0xc633,0x1e4));var _0x3c63=function(_0x5d83a4,_0x2a7f15){_0x5d83a4=_0x5d83a4-0x0;var _0x22b9a6=_0xc633[_0x5d83a4];return _0x22b9a6;};'use strict';var Sequelize=require(_0x3c63('0x0'));module[_0x3c63('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x3c63('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3c63('0x3')]},'timeout':{'type':Sequelize[_0x3c63('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3c63('0x5')](_0x3c63('0x6'),_0x3c63('0x7'),_0x3c63('0x8'))}}; \ No newline at end of file +var _0x329e=['STRING','INTEGER','exports'];(function(_0x558848,_0x14ab59){var _0x59b175=function(_0x371728){while(--_0x371728){_0x558848['push'](_0x558848['shift']());}};_0x59b175(++_0x14ab59);}(_0x329e,0x15e));var _0xe329=function(_0x1337db,_0x328318){_0x1337db=_0x1337db-0x0;var _0x38cf62=_0x329e[_0x1337db];return _0x38cf62;};'use strict';var Sequelize=require('sequelize');module[_0xe329('0x0')]={'name':{'type':Sequelize[_0xe329('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe329('0x1')]},'timeout':{'type':Sequelize[_0xe329('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory','beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index a043d84..0352664 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 _0xa9f6=['fields','find','create','body','user','get','role','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','pick','findAndCountAll','UserId','createdAt','rows','format','%s/%s','SIP','smsPause','updatedAt','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','emit','userSmsQueue:save','removeTeams','select','field','tq.TeamId','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','includes','all','union','isEmpty','removeAgents','forEach','userSmsQueue:remove','addAgents','omit','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','register','status','json','offset','undefined','limit','count','set','apply','update','then','destroy','SmsQueues','end','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','SmsQueue','include','findAll','catch','params'];(function(_0xbe2e56,_0x4ddb51){var _0x83b85e=function(_0x2f3e35){while(--_0x2f3e35){_0xbe2e56['push'](_0xbe2e56['shift']());}};_0x83b85e(++_0x4ddb51);}(_0xa9f6,0x14e));var _0x6a9f=function(_0x1d6e57,_0x300748){_0x1d6e57=_0x1d6e57-0x0;var _0x434e62=_0xa9f6[_0x1d6e57];return _0x434e62;};'use strict';var emlformat=require(_0x6a9f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6a9f('0x1'));var jsonpatch=require(_0x6a9f('0x2'));var rp=require(_0x6a9f('0x3'));var moment=require('moment');var BPromise=require(_0x6a9f('0x4'));var Mustache=require('mustache');var util=require(_0x6a9f('0x5'));var path=require(_0x6a9f('0x6'));var sox=require(_0x6a9f('0x7'));var csv=require(_0x6a9f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6a9f('0x9'));var _=require(_0x6a9f('0xa'));var squel=require(_0x6a9f('0xb'));var crypto=require(_0x6a9f('0xc'));var jsforce=require(_0x6a9f('0xd'));var deskjs=require(_0x6a9f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6a9f('0xf'));var Papa=require('papaparse');var Redis=require(_0x6a9f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6a9f('0x11'));var as=require(_0x6a9f('0x12'));var hardwareService=require(_0x6a9f('0x13'));var logger=require(_0x6a9f('0x14'))('api');var utils=require(_0x6a9f('0x15'));var config=require(_0x6a9f('0x16'));var licenseUtil=require(_0x6a9f('0x17'));var db=require(_0x6a9f('0x18'))['db'];config['redis']=_['defaults'](config[_0x6a9f('0x19')],{'host':_0x6a9f('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6a9f('0x19')]));require('./smsQueue.socket')[_0x6a9f('0x1b')](socket);function respondWithStatusCode(_0x1bf75e,_0x4f3eae){_0x4f3eae=_0x4f3eae||0xcc;return function(_0x4701c7){if(_0x4701c7){return _0x1bf75e['sendStatus'](_0x4f3eae);}return _0x1bf75e[_0x6a9f('0x1c')](_0x4f3eae)['end']();};}function respondWithResult(_0x34d0bc,_0x9b15c6){_0x9b15c6=_0x9b15c6||0xc8;return function(_0x3d5457){if(_0x3d5457){return _0x34d0bc[_0x6a9f('0x1c')](_0x9b15c6)[_0x6a9f('0x1d')](_0x3d5457);}};}function respondWithFilteredResult(_0x49ed1b,_0x4b0530){return function(_0x5e4d29){if(_0x5e4d29){var _0x5de2b0=typeof _0x4b0530[_0x6a9f('0x1e')]===_0x6a9f('0x1f')&&typeof _0x4b0530[_0x6a9f('0x20')]===_0x6a9f('0x1f');var _0x42369e=_0x5e4d29[_0x6a9f('0x21')];var _0x216d94=_0x5de2b0?0x0:_0x4b0530[_0x6a9f('0x1e')];var _0x15f8c7=_0x5de2b0?_0x5e4d29[_0x6a9f('0x21')]:_0x4b0530[_0x6a9f('0x1e')]+_0x4b0530[_0x6a9f('0x20')];var _0x31d2d0;if(_0x15f8c7>=_0x42369e){_0x15f8c7=_0x42369e;_0x31d2d0=0xc8;}else{_0x31d2d0=0xce;}_0x49ed1b[_0x6a9f('0x1c')](_0x31d2d0);return _0x49ed1b[_0x6a9f('0x22')]('Content-Range',_0x216d94+'-'+_0x15f8c7+'/'+_0x42369e)['json'](_0x5e4d29);}return null;};}function patchUpdates(_0x36cd73){return function(_0x41d709){try{jsonpatch[_0x6a9f('0x23')](_0x41d709,_0x36cd73,!![]);}catch(_0x358c16){return BPromise['reject'](_0x358c16);}return _0x41d709['save']();};}function saveUpdates(_0x5beb60,_0x40c98e){return function(_0x151322){if(_0x151322){return _0x151322[_0x6a9f('0x24')](_0x5beb60)[_0x6a9f('0x25')](function(_0x5b921f){return _0x5b921f;});}return null;};}function removeEntity(_0x6b12b7,_0x12bef0){return function(_0x5cd590){if(_0x5cd590){return _0x5cd590[_0x6a9f('0x26')]()[_0x6a9f('0x25')](function(){var _0x39cd0a=_0x5cd590['get']({'plain':!![]});var _0x1ea79b=_0x6a9f('0x27');return db['UserProfileResource'][_0x6a9f('0x26')]({'where':{'type':_0x1ea79b,'resourceId':_0x39cd0a['id']}})[_0x6a9f('0x25')](function(){return _0x5cd590;});})[_0x6a9f('0x25')](function(){_0x6b12b7['status'](0xcc)[_0x6a9f('0x28')]();});}};}function handleEntityNotFound(_0x2cf7e0,_0x23e6d7){return function(_0x2ec519){if(!_0x2ec519){_0x2cf7e0['sendStatus'](0x194);}return _0x2ec519;};}function handleError(_0x4487a8,_0x301b84){_0x301b84=_0x301b84||0x1f4;return function(_0x209cf6){logger['error'](_0x209cf6[_0x6a9f('0x29')]);if(_0x209cf6[_0x6a9f('0x2a')]){delete _0x209cf6[_0x6a9f('0x2a')];}_0x4487a8['status'](_0x301b84)[_0x6a9f('0x2b')](_0x209cf6);};}exports[_0x6a9f('0x2c')]=function(_0x21c558,_0x17d799){var _0x876269={},_0x32ec2a={},_0x4b7e11={'count':0x0,'rows':[]};var _0x40f2cd=_[_0x6a9f('0x2d')](db['SmsQueue'][_0x6a9f('0x2e')],function(_0x2039f6){return{'name':_0x2039f6[_0x6a9f('0x2f')],'type':_0x2039f6['type'][_0x6a9f('0x30')]};});_0x32ec2a[_0x6a9f('0x31')]=_[_0x6a9f('0x2d')](_0x40f2cd,_0x6a9f('0x2a'));_0x32ec2a[_0x6a9f('0x32')]=_[_0x6a9f('0x33')](_0x21c558['query']);_0x32ec2a['filters']=_[_0x6a9f('0x34')](_0x32ec2a[_0x6a9f('0x31')],_0x32ec2a['query']);_0x876269[_0x6a9f('0x35')]=_[_0x6a9f('0x34')](_0x32ec2a['model'],qs['fields'](_0x21c558[_0x6a9f('0x32')]['fields']));_0x876269['attributes']=_0x876269[_0x6a9f('0x35')][_0x6a9f('0x36')]?_0x876269['attributes']:_0x32ec2a[_0x6a9f('0x31')];if(!_0x21c558[_0x6a9f('0x32')][_0x6a9f('0x37')](_0x6a9f('0x38'))){_0x876269[_0x6a9f('0x20')]=qs[_0x6a9f('0x20')](_0x21c558[_0x6a9f('0x32')][_0x6a9f('0x20')]);_0x876269[_0x6a9f('0x1e')]=qs[_0x6a9f('0x1e')](_0x21c558[_0x6a9f('0x32')]['offset']);}_0x876269[_0x6a9f('0x39')]=qs[_0x6a9f('0x3a')](_0x21c558['query'][_0x6a9f('0x3a')]);_0x876269[_0x6a9f('0x3b')]=qs[_0x6a9f('0x3c')](_['pick'](_0x21c558[_0x6a9f('0x32')],_0x32ec2a[_0x6a9f('0x3c')]),_0x40f2cd);if(_0x21c558[_0x6a9f('0x32')][_0x6a9f('0x3d')]){_0x876269[_0x6a9f('0x3b')]=_[_0x6a9f('0x3e')](_0x876269['where'],{'$or':_['map'](_0x40f2cd,function(_0x42958c){if(_0x42958c[_0x6a9f('0x3f')]!==_0x6a9f('0x40')){var _0xf5f91a={};_0xf5f91a[_0x42958c[_0x6a9f('0x2a')]]={'$like':'%'+_0x21c558['query'][_0x6a9f('0x3d')]+'%'};return _0xf5f91a;}})});}_0x876269=_[_0x6a9f('0x3e')]({},_0x876269,_0x21c558[_0x6a9f('0x41')]);var _0x381216={'where':_0x876269[_0x6a9f('0x3b')]};return db[_0x6a9f('0x42')][_0x6a9f('0x21')](_0x381216)[_0x6a9f('0x25')](function(_0x1e7833){_0x4b7e11[_0x6a9f('0x21')]=_0x1e7833;if(_0x21c558[_0x6a9f('0x32')]['includeAll']){_0x876269[_0x6a9f('0x43')]=[{'all':!![]}];}return db[_0x6a9f('0x42')][_0x6a9f('0x44')](_0x876269);})[_0x6a9f('0x25')](function(_0x1649a6){_0x4b7e11['rows']=_0x1649a6;return _0x4b7e11;})[_0x6a9f('0x25')](respondWithFilteredResult(_0x17d799,_0x876269))[_0x6a9f('0x45')](handleError(_0x17d799,null));};exports['show']=function(_0x3aff36,_0x114f52){var _0x9216c9={'raw':!![],'where':{'id':_0x3aff36[_0x6a9f('0x46')]['id']}},_0x5c06dd={};_0x5c06dd[_0x6a9f('0x31')]=_[_0x6a9f('0x33')](db[_0x6a9f('0x42')][_0x6a9f('0x2e')]);_0x5c06dd['query']=_['keys'](_0x3aff36[_0x6a9f('0x32')]);_0x5c06dd[_0x6a9f('0x3c')]=_[_0x6a9f('0x34')](_0x5c06dd[_0x6a9f('0x31')],_0x5c06dd[_0x6a9f('0x32')]);_0x9216c9[_0x6a9f('0x35')]=_[_0x6a9f('0x34')](_0x5c06dd[_0x6a9f('0x31')],qs[_0x6a9f('0x47')](_0x3aff36['query'][_0x6a9f('0x47')]));_0x9216c9[_0x6a9f('0x35')]=_0x9216c9[_0x6a9f('0x35')][_0x6a9f('0x36')]?_0x9216c9[_0x6a9f('0x35')]:_0x5c06dd['model'];if(_0x3aff36[_0x6a9f('0x32')]['includeAll']){_0x9216c9[_0x6a9f('0x43')]=[{'all':!![]}];}_0x9216c9=_[_0x6a9f('0x3e')]({},_0x9216c9,_0x3aff36[_0x6a9f('0x41')]);return db['SmsQueue'][_0x6a9f('0x48')](_0x9216c9)[_0x6a9f('0x25')](handleEntityNotFound(_0x114f52,null))['then'](respondWithResult(_0x114f52,null))[_0x6a9f('0x45')](handleError(_0x114f52,null));};exports[_0x6a9f('0x49')]=function(_0x531d13,_0x20db0d){return db[_0x6a9f('0x42')][_0x6a9f('0x49')](_0x531d13[_0x6a9f('0x4a')],{})['then'](function(_0x5b041b){var _0x320517=_0x531d13[_0x6a9f('0x4b')][_0x6a9f('0x4c')]({'plain':!![]});if(!_0x320517)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x320517[_0x6a9f('0x4d')]===_0x6a9f('0x4b')){var _0x36f309=_0x5b041b['get']({'plain':!![]});var _0x2c6485=_0x6a9f('0x27');return db[_0x6a9f('0x4e')][_0x6a9f('0x48')]({'where':{'name':_0x2c6485,'userProfileId':_0x320517['userProfileId']},'raw':!![]})['then'](function(_0x72edd7){if(_0x72edd7&&_0x72edd7[_0x6a9f('0x4f')]===0x0){return db[_0x6a9f('0x50')]['create']({'name':_0x36f309['name'],'resourceId':_0x36f309['id'],'type':_0x72edd7[_0x6a9f('0x2a')],'sectionId':_0x72edd7['id']},{})[_0x6a9f('0x25')](function(){return _0x5b041b;});}else{return _0x5b041b;}})[_0x6a9f('0x45')](function(_0x178485){logger[_0x6a9f('0x51')](_0x6a9f('0x52'),_0x178485);throw _0x178485;});}return _0x5b041b;})[_0x6a9f('0x25')](respondWithResult(_0x20db0d,0xc9))[_0x6a9f('0x45')](handleError(_0x20db0d,null));};exports[_0x6a9f('0x24')]=function(_0x1bdd2d,_0x429bd){if(_0x1bdd2d['body']['id']){delete _0x1bdd2d[_0x6a9f('0x4a')]['id'];}return db[_0x6a9f('0x42')][_0x6a9f('0x48')]({'where':{'id':_0x1bdd2d[_0x6a9f('0x46')]['id']}})[_0x6a9f('0x25')](handleEntityNotFound(_0x429bd,null))['then'](saveUpdates(_0x1bdd2d[_0x6a9f('0x4a')],null))[_0x6a9f('0x25')](respondWithResult(_0x429bd,null))['catch'](handleError(_0x429bd,null));};exports[_0x6a9f('0x26')]=function(_0x1a3b1b,_0x675295){return db['SmsQueue'][_0x6a9f('0x48')]({'where':{'id':_0x1a3b1b[_0x6a9f('0x46')]['id']}})[_0x6a9f('0x25')](handleEntityNotFound(_0x675295,null))[_0x6a9f('0x25')](removeEntity(_0x675295,null))[_0x6a9f('0x45')](handleError(_0x675295,null));};exports['describe']=function(_0xe9f685,_0x253ab8){return db[_0x6a9f('0x42')][_0x6a9f('0x53')]()[_0x6a9f('0x25')](respondWithResult(_0x253ab8,null))[_0x6a9f('0x45')](handleError(_0x253ab8,null));};exports[_0x6a9f('0x54')]=function(_0x23e55a,_0x4dc293,_0x2eefb6){var _0x559797={'raw':!![],'where':{}},_0x21b6ca={},_0x45602f;return db['SmsQueue'][_0x6a9f('0x55')]({'where':{'id':_0x23e55a['params']['id']}})['then'](handleEntityNotFound(_0x4dc293,null))['then'](function(_0x540768){if(_0x540768){_0x45602f=_0x540768[_0x6a9f('0x4c')]({'plain':!![]});_0x21b6ca[_0x6a9f('0x31')]=_['keys'](db[_0x6a9f('0x56')]['rawAttributes']);_0x21b6ca[_0x6a9f('0x32')]=_[_0x6a9f('0x33')](_0x23e55a[_0x6a9f('0x32')]);_0x21b6ca[_0x6a9f('0x3c')]=_[_0x6a9f('0x34')](_0x21b6ca[_0x6a9f('0x31')],_0x21b6ca[_0x6a9f('0x32')]);_0x559797[_0x6a9f('0x35')]=_[_0x6a9f('0x34')](_0x21b6ca[_0x6a9f('0x31')],qs['fields'](_0x23e55a[_0x6a9f('0x32')][_0x6a9f('0x47')]));_0x559797['attributes']=_0x559797[_0x6a9f('0x35')][_0x6a9f('0x36')]?_0x559797[_0x6a9f('0x35')]:_0x21b6ca[_0x6a9f('0x31')];if(!_0x23e55a['query'][_0x6a9f('0x37')](_0x6a9f('0x38'))){_0x559797['limit']=qs['limit'](_0x23e55a[_0x6a9f('0x32')][_0x6a9f('0x20')]);_0x559797[_0x6a9f('0x1e')]=qs[_0x6a9f('0x1e')](_0x23e55a['query']['offset']);}_0x559797[_0x6a9f('0x39')]=qs[_0x6a9f('0x3a')](_0x23e55a[_0x6a9f('0x32')][_0x6a9f('0x3a')]);_0x559797[_0x6a9f('0x3b')]=qs[_0x6a9f('0x3c')](_[_0x6a9f('0x57')](_0x23e55a[_0x6a9f('0x32')],_0x21b6ca[_0x6a9f('0x3c')]));_0x559797[_0x6a9f('0x3b')]['SmsQueueId']=_0x540768['id'];if(_0x23e55a[_0x6a9f('0x32')]['filter']){_0x559797[_0x6a9f('0x3b')]=_['merge'](_0x559797[_0x6a9f('0x3b')],{'$or':_['map'](_0x559797[_0x6a9f('0x35')],function(_0x383cb0){var _0x5ec597={};_0x5ec597[_0x383cb0]={'$like':'%'+_0x23e55a['query']['filter']+'%'};return _0x5ec597;})});}_0x559797=_['merge']({},_0x559797,_0x23e55a[_0x6a9f('0x41')]);return db[_0x6a9f('0x56')]['findAll'](_0x559797);}})['then'](function(_0xe615f1){if(_0xe615f1){return db['User'][_0x6a9f('0x58')]({'where':{'id':_[_0x6a9f('0x2d')](_0xe615f1,_0x6a9f('0x59')),'role':'agent'},'attributes':['id',_0x6a9f('0x2a'),'smsPause','updatedAt',_0x6a9f('0x5a')]});}})[_0x6a9f('0x25')](function(_0x3b6f8a){if(_0x3b6f8a){return{'count':_0x3b6f8a[_0x6a9f('0x21')],'rows':_[_0x6a9f('0x2d')](_0x3b6f8a[_0x6a9f('0x5b')],function(_0x27f52f){return{'membername':_0x27f52f[_0x6a9f('0x2a')],'UserId':_0x27f52f['id'],'queue_name':_0x45602f['name'],'SmsQueueId':_0x45602f['id'],'interface':util[_0x6a9f('0x5c')](_0x6a9f('0x5d'),_0x6a9f('0x5e'),_0x27f52f[_0x6a9f('0x2a')]),'penalty':0x0,'paused':_0x27f52f[_0x6a9f('0x5f')],'createdAt':_0x27f52f[_0x6a9f('0x5a')],'updatedAt':_0x27f52f[_0x6a9f('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x6a9f('0x25')](respondWithFilteredResult(_0x4dc293,_0x559797))[_0x6a9f('0x45')](handleError(_0x4dc293,null));};exports[_0x6a9f('0x61')]=function(_0x123154,_0x53271f,_0x5301d0){var _0x39fd18={};var _0x10942d={};var _0x5c8c85;var _0x442952;return db[_0x6a9f('0x42')]['findOne']({'where':{'id':_0x123154[_0x6a9f('0x46')]['id']}})[_0x6a9f('0x25')](handleEntityNotFound(_0x53271f,null))[_0x6a9f('0x25')](function(_0x10e2cb){if(_0x10e2cb){_0x5c8c85=_0x10e2cb;_0x10942d[_0x6a9f('0x31')]=_['keys'](db[_0x6a9f('0x62')][_0x6a9f('0x2e')]);_0x10942d[_0x6a9f('0x32')]=_[_0x6a9f('0x33')](_0x123154[_0x6a9f('0x32')]);_0x10942d[_0x6a9f('0x3c')]=_['intersection'](_0x10942d['model'],_0x10942d['query']);_0x39fd18[_0x6a9f('0x35')]=_[_0x6a9f('0x34')](_0x10942d[_0x6a9f('0x31')],qs[_0x6a9f('0x47')](_0x123154['query']['fields']));_0x39fd18[_0x6a9f('0x35')]=_0x39fd18[_0x6a9f('0x35')][_0x6a9f('0x36')]?_0x39fd18['attributes']:_0x10942d['model'];_0x39fd18[_0x6a9f('0x39')]=qs[_0x6a9f('0x3a')](_0x123154[_0x6a9f('0x32')][_0x6a9f('0x3a')]);_0x39fd18[_0x6a9f('0x3b')]=qs[_0x6a9f('0x3c')](_[_0x6a9f('0x57')](_0x123154[_0x6a9f('0x32')],_0x10942d['filters']));if(_0x123154[_0x6a9f('0x32')]['filter']){_0x39fd18[_0x6a9f('0x3b')]=_['merge'](_0x39fd18[_0x6a9f('0x3b')],{'$or':_[_0x6a9f('0x2d')](_0x39fd18[_0x6a9f('0x35')],function(_0x3b033f){var _0x1640d0={};_0x1640d0[_0x3b033f]={'$like':'%'+_0x123154[_0x6a9f('0x32')][_0x6a9f('0x3d')]+'%'};return _0x1640d0;})});}_0x39fd18=_[_0x6a9f('0x3e')]({},_0x39fd18,_0x123154[_0x6a9f('0x41')]);return _0x5c8c85[_0x6a9f('0x61')](_0x39fd18);}})[_0x6a9f('0x25')](function(_0x1a9e50){if(_0x1a9e50){_0x442952=_0x1a9e50[_0x6a9f('0x36')];if(!_0x123154['query'][_0x6a9f('0x37')]('nolimit')){_0x39fd18[_0x6a9f('0x20')]=qs[_0x6a9f('0x20')](_0x123154[_0x6a9f('0x32')]['limit']);_0x39fd18[_0x6a9f('0x1e')]=qs[_0x6a9f('0x1e')](_0x123154[_0x6a9f('0x32')][_0x6a9f('0x1e')]);}return _0x5c8c85[_0x6a9f('0x61')](_0x39fd18);}})[_0x6a9f('0x25')](function(_0x3bf624){if(_0x3bf624){return _0x3bf624?{'count':_0x442952,'rows':_0x3bf624}:null;}})['then'](respondWithResult(_0x53271f,null))[_0x6a9f('0x45')](handleError(_0x53271f,null));};exports[_0x6a9f('0x63')]=function(_0x3bebd6,_0x3d6fa5,_0x55bb0d){var _0xeb2300=_0x3bebd6[_0x6a9f('0x4a')][_0x6a9f('0x64')];return db['Team']['findAll']({'where':{'id':_0xeb2300},'attributes':['id'],'include':[{'model':db[_0x6a9f('0x65')],'as':_0x6a9f('0x66'),'attributes':['id',_0x6a9f('0x2a'),_0x6a9f('0x67'),_0x6a9f('0x68'),_0x6a9f('0x69')],'raw':!![]}]})[_0x6a9f('0x25')](function(_0x69159c){if(_0x69159c){var _0x50051e=_[_0x6a9f('0x6a')](_0x69159c,function(_0x2316e4){var _0x5e6f97=_0x2316e4[_0x6a9f('0x4c')]({'plain':!![]});return _0x5e6f97[_0x6a9f('0x66')];});return db[_0x6a9f('0x42')][_0x6a9f('0x48')]({'where':{'id':_0x3bebd6[_0x6a9f('0x46')]['id']}})[_0x6a9f('0x25')](function(_0x56b63b){return db[_0x6a9f('0x6b')][_0x6a9f('0x6c')](function(_0x38d8fe){return _0x56b63b[_0x6a9f('0x63')](_0xeb2300,{'transaction':_0x38d8fe})[_0x6a9f('0x25')](function(){return BPromise[_0x6a9f('0x6d')](_0x50051e,function(_0x440d52){return db['UserSmsQueue']['findOrCreate']({'where':{'UserId':_0x440d52['id'],'SmsQueueId':_0x3bebd6[_0x6a9f('0x46')]['id']},'transaction':_0x38d8fe});});})[_0x6a9f('0x25')](function(){_0x50051e['forEach'](function(_0x4d3a89){socket[_0x6a9f('0x6e')](_0x6a9f('0x6f'),{'UserId':_0x4d3a89['id'],'SmsQueueId':_0x56b63b['id']});});});});});}})[_0x6a9f('0x25')](respondWithStatusCode(_0x3d6fa5,null))[_0x6a9f('0x45')](handleError(_0x3d6fa5,null));};exports[_0x6a9f('0x70')]=function(_0x26c281,_0x46719a,_0x26e496){return db[_0x6a9f('0x62')][_0x6a9f('0x44')]({'where':{'id':_0x26c281['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x6a9f('0x65')],'as':_0x6a9f('0x66'),'attributes':['id'],'raw':!![]}]})[_0x6a9f('0x25')](handleEntityNotFound(_0x46719a,null))[_0x6a9f('0x25')](function(_0x2827d9){var _0x523ab8=_['map'](_0x2827d9,'id');var _0x4e5ebd=[];var _0x5e6aa8=[];var _0x21c21b=squel[_0x6a9f('0x71')]();_0x21c21b[_0x6a9f('0x72')](_0x6a9f('0x73'))['from'](_0x6a9f('0x74'),'tq')[_0x6a9f('0x75')](_0x6a9f('0x76'),'ut',_0x6a9f('0x77'))['where'](_0x6a9f('0x78'),_0x26c281[_0x6a9f('0x46')]['id']);for(var _0x3a4ef0=0x0;_0x3a4ef0<_0x2827d9[_0x6a9f('0x36')];_0x3a4ef0+=0x1){let _0x4da624=_0x2827d9[_0x3a4ef0];for(var _0x3a4064=0x0;_0x3a4064<_0x4da624[_0x6a9f('0x66')][_0x6a9f('0x36')];_0x3a4064+=0x1){let _0x5f503f=_0x4da624['Agents'][_0x3a4064];var _0x1d2ec0=_0x21c21b[_0x6a9f('0x79')]();_0x1d2ec0[_0x6a9f('0x3b')](_0x6a9f('0x7a'),_0x5f503f['id']);_0x5e6aa8[_0x6a9f('0x7b')](db['sequelize'][_0x6a9f('0x32')](_0x1d2ec0['toString'](),{'type':db[_0x6a9f('0x6b')]['QueryTypes']['SELECT']})[_0x6a9f('0x25')](function(_0x542804){if(_0x542804['length']===0x1){return _0x5f503f['id'];}else{var _0x828b7d=_['every'](_[_0x6a9f('0x2d')](_0x542804,'TeamId'),function(_0x9a8807){return _[_0x6a9f('0x7c')](_0x523ab8,_0x9a8807);});if(_0x828b7d){return _0x5f503f['id'];}}}));}}return BPromise[_0x6a9f('0x7d')](_0x5e6aa8)[_0x6a9f('0x25')](function(_0x91243c){_0x4e5ebd=_(_0x4e5ebd)[_0x6a9f('0x7e')](_0x91243c)['compact']()['value']();return db['SmsQueue']['find']({'where':{'id':_0x26c281[_0x6a9f('0x46')]['id']}})[_0x6a9f('0x25')](function(_0x324bd4){return db['sequelize']['transaction'](function(_0x1f39f5){return _0x324bd4['removeTeams'](_0x26c281['query'][_0x6a9f('0x64')],{'transaction':_0x1f39f5})['then'](function(){if(!_[_0x6a9f('0x7f')](_0x4e5ebd)){return _0x324bd4[_0x6a9f('0x80')](_0x4e5ebd,{'transaction':_0x1f39f5});}})[_0x6a9f('0x25')](function(){_0x4e5ebd[_0x6a9f('0x81')](function(_0x22c011){socket['emit'](_0x6a9f('0x82'),{'UserId':_0x22c011,'SmsQueueId':_0x324bd4['id']});});});});});});})[_0x6a9f('0x25')](respondWithStatusCode(_0x46719a,null))[_0x6a9f('0x45')](handleError(_0x46719a,null));};exports[_0x6a9f('0x83')]=function(_0x340a7e,_0x5337a7,_0x354a72){return db[_0x6a9f('0x42')]['find']({'where':{'id':_0x340a7e[_0x6a9f('0x46')]['id']}})[_0x6a9f('0x25')](handleEntityNotFound(_0x5337a7,null))[_0x6a9f('0x25')](function(_0x309663){if(_0x309663){return _0x309663[_0x6a9f('0x83')](_0x340a7e['body'][_0x6a9f('0x64')],_[_0x6a9f('0x84')](_0x340a7e[_0x6a9f('0x4a')],[_0x6a9f('0x64'),'id'])||{})['spread'](function(_0x553e49){for(var _0x133083=0x0;_0x133083<_0x340a7e[_0x6a9f('0x4a')][_0x6a9f('0x64')]['length'];_0x133083+=0x1){socket[_0x6a9f('0x6e')](_0x6a9f('0x6f'),{'UserId':Number(_0x340a7e[_0x6a9f('0x4a')][_0x6a9f('0x64')][_0x133083]),'SmsQueueId':Number(_0x340a7e[_0x6a9f('0x46')]['id'])});}return _0x553e49;});}})[_0x6a9f('0x25')](respondWithResult(_0x5337a7,null))[_0x6a9f('0x45')](handleError(_0x5337a7,null));};exports[_0x6a9f('0x80')]=function(_0x379d47,_0x2736f9,_0x379c56){return db[_0x6a9f('0x42')][_0x6a9f('0x48')]({'where':{'id':_0x379d47[_0x6a9f('0x46')]['id']}})['then'](handleEntityNotFound(_0x2736f9,null))[_0x6a9f('0x25')](function(_0x462a8d){if(_0x462a8d){return _0x462a8d[_0x6a9f('0x80')](_0x379d47[_0x6a9f('0x32')][_0x6a9f('0x64')])[_0x6a9f('0x25')](function(){if(_[_0x6a9f('0x85')](_0x379d47['query'][_0x6a9f('0x64')])){for(var _0x96cad8=0x0;_0x96cad8<_0x379d47[_0x6a9f('0x32')][_0x6a9f('0x64')][_0x6a9f('0x36')];_0x96cad8+=0x1){socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x379d47[_0x6a9f('0x32')][_0x6a9f('0x64')][_0x96cad8]),'SmsQueueId':Number(_0x379d47[_0x6a9f('0x46')]['id'])});}}else{socket['emit'](_0x6a9f('0x82'),{'UserId':Number(_0x379d47['query'][_0x6a9f('0x64')]),'SmsQueueId':Number(_0x379d47[_0x6a9f('0x46')]['id'])});}});}})['then'](respondWithStatusCode(_0x2736f9,null))[_0x6a9f('0x45')](handleError(_0x2736f9,null));};exports[_0x6a9f('0x86')]=function(_0xb77f2e,_0xf27c8c,_0x5b1f21){var _0x23b4c1={};var _0x2b5b44={};var _0x577722;var _0x52dfad;return db[_0x6a9f('0x42')][_0x6a9f('0x55')]({'where':{'id':_0xb77f2e[_0x6a9f('0x46')]['id']}})[_0x6a9f('0x25')](handleEntityNotFound(_0xf27c8c,null))['then'](function(_0x2c4fe7){if(_0x2c4fe7){_0x577722=_0x2c4fe7;_0x2b5b44[_0x6a9f('0x31')]=_[_0x6a9f('0x33')](db[_0x6a9f('0x65')][_0x6a9f('0x2e')]);_0x2b5b44[_0x6a9f('0x32')]=_['keys'](_0xb77f2e['query']);_0x2b5b44[_0x6a9f('0x3c')]=_['intersection'](_0x2b5b44[_0x6a9f('0x31')],_0x2b5b44[_0x6a9f('0x32')]);_0x23b4c1[_0x6a9f('0x35')]=_['intersection'](_0x2b5b44['model'],qs['fields'](_0xb77f2e[_0x6a9f('0x32')][_0x6a9f('0x47')]));_0x23b4c1['attributes']=_0x23b4c1[_0x6a9f('0x35')][_0x6a9f('0x36')]?_0x23b4c1[_0x6a9f('0x35')]:_0x2b5b44[_0x6a9f('0x31')];_0x23b4c1[_0x6a9f('0x39')]=qs[_0x6a9f('0x3a')](_0xb77f2e[_0x6a9f('0x32')][_0x6a9f('0x3a')]);_0x23b4c1[_0x6a9f('0x3b')]=qs[_0x6a9f('0x3c')](_['pick'](_0xb77f2e[_0x6a9f('0x32')],_0x2b5b44[_0x6a9f('0x3c')]));if(_0xb77f2e['query'][_0x6a9f('0x3d')]){_0x23b4c1[_0x6a9f('0x3b')]=_[_0x6a9f('0x3e')](_0x23b4c1[_0x6a9f('0x3b')],{'$or':_['map'](_0x23b4c1['attributes'],function(_0x2aba1b){var _0x5c5d76={};_0x5c5d76[_0x2aba1b]={'$like':'%'+_0xb77f2e[_0x6a9f('0x32')][_0x6a9f('0x3d')]+'%'};return _0x5c5d76;})});}_0x23b4c1=_[_0x6a9f('0x3e')]({},_0x23b4c1,_0xb77f2e['options']);return _0x577722['getAgents'](_0x23b4c1);}})[_0x6a9f('0x25')](function(_0x5cbed2){if(_0x5cbed2){_0x52dfad=_0x5cbed2[_0x6a9f('0x36')];if(!_0xb77f2e[_0x6a9f('0x32')][_0x6a9f('0x37')](_0x6a9f('0x38'))){_0x23b4c1[_0x6a9f('0x20')]=qs['limit'](_0xb77f2e[_0x6a9f('0x32')][_0x6a9f('0x20')]);_0x23b4c1[_0x6a9f('0x1e')]=qs[_0x6a9f('0x1e')](_0xb77f2e[_0x6a9f('0x32')][_0x6a9f('0x1e')]);}return _0x577722['getAgents'](_0x23b4c1);}})[_0x6a9f('0x25')](function(_0x34752f){if(_0x34752f){return _0x34752f?{'count':_0x52dfad,'rows':_0x34752f}:null;}})[_0x6a9f('0x25')](respondWithResult(_0xf27c8c,null))[_0x6a9f('0x45')](handleError(_0xf27c8c,null));}; \ No newline at end of file +var _0xad04=['every','all','union','value','removeTeams','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','getAgents','eml-format','rimraf','bluebird','mustache','util','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/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','get','SmsQueues','UserProfileResource','destroy','error','stack','name','send','index','map','SmsQueue','rawAttributes','type','key','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','keys','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','UserSmsQueue','order','SmsQueueId','User','UserId','agent','smsPause','format','%s/%s','SIP','createdAt','updatedAt','getTeams','findOne','ids','Agents','interface','sequelize','transaction','addTeams','findOrCreate','forEach','emit','userSmsQueue:save','Team','select','from','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT'];(function(_0x3bd52b,_0xbbc735){var _0x1e5b89=function(_0x29ccc3){while(--_0x29ccc3){_0x3bd52b['push'](_0x3bd52b['shift']());}};_0x1e5b89(++_0xbbc735);}(_0xad04,0x96));var _0x4ad0=function(_0x1d4517,_0x4170e4){_0x1d4517=_0x1d4517-0x0;var _0x4b106d=_0xad04[_0x1d4517];return _0x4b106d;};'use strict';var emlformat=require(_0x4ad0('0x0'));var rimraf=require(_0x4ad0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4ad0('0x2'));var Mustache=require(_0x4ad0('0x3'));var util=require(_0x4ad0('0x4'));var path=require('path');var sox=require(_0x4ad0('0x5'));var csv=require(_0x4ad0('0x6'));var ejs=require(_0x4ad0('0x7'));var fs=require('fs');var fs_extra=require(_0x4ad0('0x8'));var _=require(_0x4ad0('0x9'));var squel=require(_0x4ad0('0xa'));var crypto=require(_0x4ad0('0xb'));var jsforce=require(_0x4ad0('0xc'));var deskjs=require(_0x4ad0('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4ad0('0xe'));var Redis=require(_0x4ad0('0xf'));var authService=require(_0x4ad0('0x10'));var qs=require(_0x4ad0('0x11'));var as=require(_0x4ad0('0x12'));var hardwareService=require(_0x4ad0('0x13'));var logger=require(_0x4ad0('0x14'))(_0x4ad0('0x15'));var utils=require('../../config/utils');var config=require(_0x4ad0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4ad0('0x17'))['db'];config[_0x4ad0('0x18')]=_[_0x4ad0('0x19')](config['redis'],{'host':_0x4ad0('0x1a'),'port':0x18eb});var socket=require(_0x4ad0('0x1b'))(new Redis(config['redis']));require(_0x4ad0('0x1c'))[_0x4ad0('0x1d')](socket);function respondWithStatusCode(_0x1ee87f,_0x1b18b1){_0x1b18b1=_0x1b18b1||0xcc;return function(_0x4d5272){if(_0x4d5272){return _0x1ee87f[_0x4ad0('0x1e')](_0x1b18b1);}return _0x1ee87f[_0x4ad0('0x1f')](_0x1b18b1)[_0x4ad0('0x20')]();};}function respondWithResult(_0x3b5001,_0x1c3065){_0x1c3065=_0x1c3065||0xc8;return function(_0x88383c){if(_0x88383c){return _0x3b5001['status'](_0x1c3065)[_0x4ad0('0x21')](_0x88383c);}};}function respondWithFilteredResult(_0x3a634c,_0x53c63b){return function(_0xcadde5){if(_0xcadde5){var _0x1a0a58=typeof _0x53c63b[_0x4ad0('0x22')]===_0x4ad0('0x23')&&typeof _0x53c63b['limit']===_0x4ad0('0x23');var _0x34317e=_0xcadde5['count'];var _0x5a5802=_0x1a0a58?0x0:_0x53c63b[_0x4ad0('0x22')];var _0x39e58b=_0x1a0a58?_0xcadde5[_0x4ad0('0x24')]:_0x53c63b[_0x4ad0('0x22')]+_0x53c63b[_0x4ad0('0x25')];var _0x2a45f6;if(_0x39e58b>=_0x34317e){_0x39e58b=_0x34317e;_0x2a45f6=0xc8;}else{_0x2a45f6=0xce;}_0x3a634c[_0x4ad0('0x1f')](_0x2a45f6);return _0x3a634c[_0x4ad0('0x26')](_0x4ad0('0x27'),_0x5a5802+'-'+_0x39e58b+'/'+_0x34317e)[_0x4ad0('0x21')](_0xcadde5);}return null;};}function patchUpdates(_0x5af5cf){return function(_0x106222){try{jsonpatch['apply'](_0x106222,_0x5af5cf,!![]);}catch(_0x1299ea){return BPromise[_0x4ad0('0x28')](_0x1299ea);}return _0x106222[_0x4ad0('0x29')]();};}function saveUpdates(_0x1f2398,_0x17274c){return function(_0x2f2e6b){if(_0x2f2e6b){return _0x2f2e6b[_0x4ad0('0x2a')](_0x1f2398)[_0x4ad0('0x2b')](function(_0x3b880c){return _0x3b880c;});}return null;};}function removeEntity(_0x56012d,_0x305cbc){return function(_0x263726){if(_0x263726){return _0x263726['destroy']()[_0x4ad0('0x2b')](function(){var _0x550f35=_0x263726[_0x4ad0('0x2c')]({'plain':!![]});var _0x3426a8=_0x4ad0('0x2d');return db[_0x4ad0('0x2e')][_0x4ad0('0x2f')]({'where':{'type':_0x3426a8,'resourceId':_0x550f35['id']}})[_0x4ad0('0x2b')](function(){return _0x263726;});})[_0x4ad0('0x2b')](function(){_0x56012d[_0x4ad0('0x1f')](0xcc)[_0x4ad0('0x20')]();});}};}function handleEntityNotFound(_0x692799,_0x4ec496){return function(_0x5df6c6){if(!_0x5df6c6){_0x692799[_0x4ad0('0x1e')](0x194);}return _0x5df6c6;};}function handleError(_0x5f1b23,_0x34cfc2){_0x34cfc2=_0x34cfc2||0x1f4;return function(_0x489d87){logger[_0x4ad0('0x30')](_0x489d87[_0x4ad0('0x31')]);if(_0x489d87[_0x4ad0('0x32')]){delete _0x489d87[_0x4ad0('0x32')];}_0x5f1b23[_0x4ad0('0x1f')](_0x34cfc2)[_0x4ad0('0x33')](_0x489d87);};}exports[_0x4ad0('0x34')]=function(_0xd4164b,_0x297712){var _0x1191d9={},_0x13e30c={},_0x1cbe18={'count':0x0,'rows':[]};var _0x5618d3=_[_0x4ad0('0x35')](db[_0x4ad0('0x36')][_0x4ad0('0x37')],function(_0x524d60){return{'name':_0x524d60['fieldName'],'type':_0x524d60[_0x4ad0('0x38')][_0x4ad0('0x39')]};});_0x13e30c['model']=_[_0x4ad0('0x35')](_0x5618d3,_0x4ad0('0x32'));_0x13e30c[_0x4ad0('0x3a')]=_['keys'](_0xd4164b[_0x4ad0('0x3a')]);_0x13e30c[_0x4ad0('0x3b')]=_['intersection'](_0x13e30c[_0x4ad0('0x3c')],_0x13e30c['query']);_0x1191d9['attributes']=_[_0x4ad0('0x3d')](_0x13e30c[_0x4ad0('0x3c')],qs[_0x4ad0('0x3e')](_0xd4164b[_0x4ad0('0x3a')][_0x4ad0('0x3e')]));_0x1191d9[_0x4ad0('0x3f')]=_0x1191d9[_0x4ad0('0x3f')][_0x4ad0('0x40')]?_0x1191d9[_0x4ad0('0x3f')]:_0x13e30c['model'];if(!_0xd4164b[_0x4ad0('0x3a')][_0x4ad0('0x41')](_0x4ad0('0x42'))){_0x1191d9['limit']=qs[_0x4ad0('0x25')](_0xd4164b['query'][_0x4ad0('0x25')]);_0x1191d9[_0x4ad0('0x22')]=qs[_0x4ad0('0x22')](_0xd4164b[_0x4ad0('0x3a')][_0x4ad0('0x22')]);}_0x1191d9['order']=qs[_0x4ad0('0x43')](_0xd4164b[_0x4ad0('0x3a')][_0x4ad0('0x43')]);_0x1191d9[_0x4ad0('0x44')]=qs[_0x4ad0('0x3b')](_[_0x4ad0('0x45')](_0xd4164b[_0x4ad0('0x3a')],_0x13e30c['filters']),_0x5618d3);if(_0xd4164b[_0x4ad0('0x3a')][_0x4ad0('0x46')]){_0x1191d9[_0x4ad0('0x44')]=_[_0x4ad0('0x47')](_0x1191d9[_0x4ad0('0x44')],{'$or':_['map'](_0x5618d3,function(_0x1203a4){if(_0x1203a4[_0x4ad0('0x38')]!=='VIRTUAL'){var _0xc9bc9e={};_0xc9bc9e[_0x1203a4[_0x4ad0('0x32')]]={'$like':'%'+_0xd4164b['query'][_0x4ad0('0x46')]+'%'};return _0xc9bc9e;}})});}_0x1191d9=_['merge']({},_0x1191d9,_0xd4164b[_0x4ad0('0x48')]);var _0xde843b={'where':_0x1191d9[_0x4ad0('0x44')]};return db[_0x4ad0('0x36')][_0x4ad0('0x24')](_0xde843b)[_0x4ad0('0x2b')](function(_0x417ef8){_0x1cbe18[_0x4ad0('0x24')]=_0x417ef8;if(_0xd4164b[_0x4ad0('0x3a')][_0x4ad0('0x49')]){_0x1191d9['include']=[{'all':!![]}];}return db[_0x4ad0('0x36')][_0x4ad0('0x4a')](_0x1191d9);})['then'](function(_0x56c2aa){_0x1cbe18[_0x4ad0('0x4b')]=_0x56c2aa;return _0x1cbe18;})[_0x4ad0('0x2b')](respondWithFilteredResult(_0x297712,_0x1191d9))[_0x4ad0('0x4c')](handleError(_0x297712,null));};exports[_0x4ad0('0x4d')]=function(_0x5470a1,_0x27ad09){var _0x35e0a4={'raw':!![],'where':{'id':_0x5470a1['params']['id']}},_0x1314f4={};_0x1314f4[_0x4ad0('0x3c')]=_[_0x4ad0('0x4e')](db[_0x4ad0('0x36')]['rawAttributes']);_0x1314f4[_0x4ad0('0x3a')]=_['keys'](_0x5470a1[_0x4ad0('0x3a')]);_0x1314f4['filters']=_[_0x4ad0('0x3d')](_0x1314f4[_0x4ad0('0x3c')],_0x1314f4[_0x4ad0('0x3a')]);_0x35e0a4[_0x4ad0('0x3f')]=_[_0x4ad0('0x3d')](_0x1314f4['model'],qs['fields'](_0x5470a1[_0x4ad0('0x3a')]['fields']));_0x35e0a4[_0x4ad0('0x3f')]=_0x35e0a4[_0x4ad0('0x3f')][_0x4ad0('0x40')]?_0x35e0a4['attributes']:_0x1314f4[_0x4ad0('0x3c')];if(_0x5470a1[_0x4ad0('0x3a')]['includeAll']){_0x35e0a4[_0x4ad0('0x4f')]=[{'all':!![]}];}_0x35e0a4=_['merge']({},_0x35e0a4,_0x5470a1[_0x4ad0('0x48')]);return db[_0x4ad0('0x36')]['find'](_0x35e0a4)[_0x4ad0('0x2b')](handleEntityNotFound(_0x27ad09,null))[_0x4ad0('0x2b')](respondWithResult(_0x27ad09,null))[_0x4ad0('0x4c')](handleError(_0x27ad09,null));};exports[_0x4ad0('0x50')]=function(_0x2dc8e0,_0x23cbf8){return db[_0x4ad0('0x36')][_0x4ad0('0x50')](_0x2dc8e0[_0x4ad0('0x51')],{})['then'](function(_0x37d816){var _0x4a38ab=_0x2dc8e0[_0x4ad0('0x52')]['get']({'plain':!![]});if(!_0x4a38ab)throw new Error(_0x4ad0('0x53'));if(_0x4a38ab[_0x4ad0('0x54')]===_0x4ad0('0x52')){var _0x5355ab=_0x37d816[_0x4ad0('0x2c')]({'plain':!![]});var _0x21a1ac=_0x4ad0('0x2d');return db[_0x4ad0('0x55')][_0x4ad0('0x56')]({'where':{'name':_0x21a1ac,'userProfileId':_0x4a38ab['userProfileId']},'raw':!![]})[_0x4ad0('0x2b')](function(_0x20db34){if(_0x20db34&&_0x20db34[_0x4ad0('0x57')]===0x0){return db[_0x4ad0('0x2e')][_0x4ad0('0x50')]({'name':_0x5355ab[_0x4ad0('0x32')],'resourceId':_0x5355ab['id'],'type':_0x20db34[_0x4ad0('0x32')],'sectionId':_0x20db34['id']},{})[_0x4ad0('0x2b')](function(){return _0x37d816;});}else{return _0x37d816;}})[_0x4ad0('0x4c')](function(_0x5a4bc2){logger[_0x4ad0('0x30')](_0x4ad0('0x58'),_0x5a4bc2);throw _0x5a4bc2;});}return _0x37d816;})[_0x4ad0('0x2b')](respondWithResult(_0x23cbf8,0xc9))['catch'](handleError(_0x23cbf8,null));};exports[_0x4ad0('0x2a')]=function(_0x37664e,_0x959612){if(_0x37664e[_0x4ad0('0x51')]['id']){delete _0x37664e[_0x4ad0('0x51')]['id'];}return db[_0x4ad0('0x36')][_0x4ad0('0x56')]({'where':{'id':_0x37664e[_0x4ad0('0x59')]['id']}})['then'](handleEntityNotFound(_0x959612,null))[_0x4ad0('0x2b')](saveUpdates(_0x37664e[_0x4ad0('0x51')],null))['then'](respondWithResult(_0x959612,null))[_0x4ad0('0x4c')](handleError(_0x959612,null));};exports[_0x4ad0('0x2f')]=function(_0x4aead4,_0x23030e){return db['SmsQueue'][_0x4ad0('0x56')]({'where':{'id':_0x4aead4[_0x4ad0('0x59')]['id']}})[_0x4ad0('0x2b')](handleEntityNotFound(_0x23030e,null))[_0x4ad0('0x2b')](removeEntity(_0x23030e,null))[_0x4ad0('0x4c')](handleError(_0x23030e,null));};exports[_0x4ad0('0x5a')]=function(_0x3cdd2b,_0x315abf){return db[_0x4ad0('0x36')][_0x4ad0('0x5a')]()[_0x4ad0('0x2b')](respondWithResult(_0x315abf,null))[_0x4ad0('0x4c')](handleError(_0x315abf,null));};exports[_0x4ad0('0x5b')]=function(_0x1e25a2,_0x179647,_0x50a18f){var _0x6f80e3={'raw':!![],'where':{}},_0x509fd0={},_0x24a233;return db['SmsQueue']['findOne']({'where':{'id':_0x1e25a2['params']['id']}})['then'](handleEntityNotFound(_0x179647,null))[_0x4ad0('0x2b')](function(_0x2e0540){if(_0x2e0540){_0x24a233=_0x2e0540[_0x4ad0('0x2c')]({'plain':!![]});_0x509fd0[_0x4ad0('0x3c')]=_[_0x4ad0('0x4e')](db[_0x4ad0('0x5c')][_0x4ad0('0x37')]);_0x509fd0[_0x4ad0('0x3a')]=_[_0x4ad0('0x4e')](_0x1e25a2[_0x4ad0('0x3a')]);_0x509fd0[_0x4ad0('0x3b')]=_[_0x4ad0('0x3d')](_0x509fd0[_0x4ad0('0x3c')],_0x509fd0[_0x4ad0('0x3a')]);_0x6f80e3[_0x4ad0('0x3f')]=_[_0x4ad0('0x3d')](_0x509fd0[_0x4ad0('0x3c')],qs['fields'](_0x1e25a2[_0x4ad0('0x3a')][_0x4ad0('0x3e')]));_0x6f80e3[_0x4ad0('0x3f')]=_0x6f80e3['attributes'][_0x4ad0('0x40')]?_0x6f80e3['attributes']:_0x509fd0[_0x4ad0('0x3c')];if(!_0x1e25a2[_0x4ad0('0x3a')]['hasOwnProperty']('nolimit')){_0x6f80e3[_0x4ad0('0x25')]=qs[_0x4ad0('0x25')](_0x1e25a2[_0x4ad0('0x3a')][_0x4ad0('0x25')]);_0x6f80e3[_0x4ad0('0x22')]=qs[_0x4ad0('0x22')](_0x1e25a2[_0x4ad0('0x3a')][_0x4ad0('0x22')]);}_0x6f80e3[_0x4ad0('0x5d')]=qs[_0x4ad0('0x43')](_0x1e25a2['query'][_0x4ad0('0x43')]);_0x6f80e3['where']=qs['filters'](_[_0x4ad0('0x45')](_0x1e25a2['query'],_0x509fd0[_0x4ad0('0x3b')]));_0x6f80e3[_0x4ad0('0x44')][_0x4ad0('0x5e')]=_0x2e0540['id'];if(_0x1e25a2[_0x4ad0('0x3a')][_0x4ad0('0x46')]){_0x6f80e3[_0x4ad0('0x44')]=_[_0x4ad0('0x47')](_0x6f80e3[_0x4ad0('0x44')],{'$or':_[_0x4ad0('0x35')](_0x6f80e3[_0x4ad0('0x3f')],function(_0x2afbc4){var _0xeab59={};_0xeab59[_0x2afbc4]={'$like':'%'+_0x1e25a2['query']['filter']+'%'};return _0xeab59;})});}_0x6f80e3=_[_0x4ad0('0x47')]({},_0x6f80e3,_0x1e25a2['options']);return db['UserSmsQueue'][_0x4ad0('0x4a')](_0x6f80e3);}})['then'](function(_0x379913){if(_0x379913){return db[_0x4ad0('0x5f')]['findAndCountAll']({'where':{'id':_['map'](_0x379913,_0x4ad0('0x60')),'role':_0x4ad0('0x61')},'attributes':['id',_0x4ad0('0x32'),_0x4ad0('0x62'),'updatedAt','createdAt']});}})['then'](function(_0x5ec857){if(_0x5ec857){return{'count':_0x5ec857['count'],'rows':_[_0x4ad0('0x35')](_0x5ec857[_0x4ad0('0x4b')],function(_0x246ac0){return{'membername':_0x246ac0['name'],'UserId':_0x246ac0['id'],'queue_name':_0x24a233[_0x4ad0('0x32')],'SmsQueueId':_0x24a233['id'],'interface':util[_0x4ad0('0x63')](_0x4ad0('0x64'),_0x4ad0('0x65'),_0x246ac0[_0x4ad0('0x32')]),'penalty':0x0,'paused':_0x246ac0[_0x4ad0('0x62')],'createdAt':_0x246ac0[_0x4ad0('0x66')],'updatedAt':_0x246ac0[_0x4ad0('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4ad0('0x2b')](respondWithFilteredResult(_0x179647,_0x6f80e3))['catch'](handleError(_0x179647,null));};exports[_0x4ad0('0x68')]=function(_0x5869eb,_0x445013,_0x55d603){var _0x5363a3={};var _0x28a731={};var _0x266138;var _0x44ede8;return db[_0x4ad0('0x36')][_0x4ad0('0x69')]({'where':{'id':_0x5869eb['params']['id']}})[_0x4ad0('0x2b')](handleEntityNotFound(_0x445013,null))['then'](function(_0x4e5b7d){if(_0x4e5b7d){_0x266138=_0x4e5b7d;_0x28a731[_0x4ad0('0x3c')]=_[_0x4ad0('0x4e')](db['Team'][_0x4ad0('0x37')]);_0x28a731[_0x4ad0('0x3a')]=_[_0x4ad0('0x4e')](_0x5869eb[_0x4ad0('0x3a')]);_0x28a731['filters']=_[_0x4ad0('0x3d')](_0x28a731[_0x4ad0('0x3c')],_0x28a731[_0x4ad0('0x3a')]);_0x5363a3['attributes']=_['intersection'](_0x28a731[_0x4ad0('0x3c')],qs[_0x4ad0('0x3e')](_0x5869eb[_0x4ad0('0x3a')][_0x4ad0('0x3e')]));_0x5363a3[_0x4ad0('0x3f')]=_0x5363a3[_0x4ad0('0x3f')]['length']?_0x5363a3[_0x4ad0('0x3f')]:_0x28a731[_0x4ad0('0x3c')];_0x5363a3['order']=qs[_0x4ad0('0x43')](_0x5869eb[_0x4ad0('0x3a')][_0x4ad0('0x43')]);_0x5363a3['where']=qs[_0x4ad0('0x3b')](_[_0x4ad0('0x45')](_0x5869eb[_0x4ad0('0x3a')],_0x28a731[_0x4ad0('0x3b')]));if(_0x5869eb[_0x4ad0('0x3a')]['filter']){_0x5363a3['where']=_[_0x4ad0('0x47')](_0x5363a3[_0x4ad0('0x44')],{'$or':_['map'](_0x5363a3[_0x4ad0('0x3f')],function(_0x33c17a){var _0x4ed51c={};_0x4ed51c[_0x33c17a]={'$like':'%'+_0x5869eb[_0x4ad0('0x3a')][_0x4ad0('0x46')]+'%'};return _0x4ed51c;})});}_0x5363a3=_[_0x4ad0('0x47')]({},_0x5363a3,_0x5869eb[_0x4ad0('0x48')]);return _0x266138[_0x4ad0('0x68')](_0x5363a3);}})[_0x4ad0('0x2b')](function(_0x11ede4){if(_0x11ede4){_0x44ede8=_0x11ede4[_0x4ad0('0x40')];if(!_0x5869eb[_0x4ad0('0x3a')][_0x4ad0('0x41')]('nolimit')){_0x5363a3[_0x4ad0('0x25')]=qs[_0x4ad0('0x25')](_0x5869eb[_0x4ad0('0x3a')]['limit']);_0x5363a3[_0x4ad0('0x22')]=qs[_0x4ad0('0x22')](_0x5869eb[_0x4ad0('0x3a')][_0x4ad0('0x22')]);}return _0x266138[_0x4ad0('0x68')](_0x5363a3);}})[_0x4ad0('0x2b')](function(_0x47f1ea){if(_0x47f1ea){return _0x47f1ea?{'count':_0x44ede8,'rows':_0x47f1ea}:null;}})[_0x4ad0('0x2b')](respondWithResult(_0x445013,null))['catch'](handleError(_0x445013,null));};exports['addTeams']=function(_0xf79e0b,_0x8d0787,_0x2ea500){var _0x411f95=_0xf79e0b[_0x4ad0('0x51')][_0x4ad0('0x6a')];return db['Team'][_0x4ad0('0x4a')]({'where':{'id':_0x411f95},'attributes':['id'],'include':[{'model':db[_0x4ad0('0x5f')],'as':_0x4ad0('0x6b'),'attributes':['id',_0x4ad0('0x32'),'online','voicePause',_0x4ad0('0x6c')],'raw':!![]}]})[_0x4ad0('0x2b')](function(_0x50b1dd){if(_0x50b1dd){var _0x3723fa=_['flatMap'](_0x50b1dd,function(_0x160c8d){var _0x240f7b=_0x160c8d['get']({'plain':!![]});return _0x240f7b[_0x4ad0('0x6b')];});return db['SmsQueue'][_0x4ad0('0x56')]({'where':{'id':_0xf79e0b[_0x4ad0('0x59')]['id']}})[_0x4ad0('0x2b')](function(_0x42f9eb){return db[_0x4ad0('0x6d')][_0x4ad0('0x6e')](function(_0x5a13e5){return _0x42f9eb[_0x4ad0('0x6f')](_0x411f95,{'transaction':_0x5a13e5})[_0x4ad0('0x2b')](function(){return BPromise['each'](_0x3723fa,function(_0x58da96){return db[_0x4ad0('0x5c')][_0x4ad0('0x70')]({'where':{'UserId':_0x58da96['id'],'SmsQueueId':_0xf79e0b[_0x4ad0('0x59')]['id']},'transaction':_0x5a13e5});});})['then'](function(){_0x3723fa[_0x4ad0('0x71')](function(_0x20c7d5){socket[_0x4ad0('0x72')](_0x4ad0('0x73'),{'UserId':_0x20c7d5['id'],'SmsQueueId':_0x42f9eb['id']});});});});});}})['then'](respondWithStatusCode(_0x8d0787,null))[_0x4ad0('0x4c')](handleError(_0x8d0787,null));};exports['removeTeams']=function(_0x2f0466,_0x3dae30,_0x4ae528){return db[_0x4ad0('0x74')][_0x4ad0('0x4a')]({'where':{'id':_0x2f0466[_0x4ad0('0x3a')]['ids']},'attributes':['id'],'include':[{'model':db[_0x4ad0('0x5f')],'as':_0x4ad0('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x4ad0('0x2b')](handleEntityNotFound(_0x3dae30,null))[_0x4ad0('0x2b')](function(_0x57ee56){var _0xea8717=_[_0x4ad0('0x35')](_0x57ee56,'id');var _0x4ff155=[];var _0x50420a=[];var _0x1c0d06=squel[_0x4ad0('0x75')]();_0x1c0d06['field']('tq.TeamId')[_0x4ad0('0x76')](_0x4ad0('0x77'),'tq')[_0x4ad0('0x78')]('user_has_teams','ut',_0x4ad0('0x79'))[_0x4ad0('0x44')](_0x4ad0('0x7a'),_0x2f0466[_0x4ad0('0x59')]['id']);for(var _0x1461ad=0x0;_0x1461ad<_0x57ee56[_0x4ad0('0x40')];_0x1461ad+=0x1){let _0x18ed03=_0x57ee56[_0x1461ad];for(var _0x1d884=0x0;_0x1d884<_0x18ed03['Agents'][_0x4ad0('0x40')];_0x1d884+=0x1){let _0x4b2262=_0x18ed03[_0x4ad0('0x6b')][_0x1d884];var _0x2b3c76=_0x1c0d06[_0x4ad0('0x7b')]();_0x2b3c76[_0x4ad0('0x44')](_0x4ad0('0x7c'),_0x4b2262['id']);_0x50420a[_0x4ad0('0x7d')](db['sequelize'][_0x4ad0('0x3a')](_0x2b3c76[_0x4ad0('0x7e')](),{'type':db[_0x4ad0('0x6d')]['QueryTypes'][_0x4ad0('0x7f')]})['then'](function(_0x26efc3){if(_0x26efc3[_0x4ad0('0x40')]===0x1){return _0x4b2262['id'];}else{var _0x559a69=_[_0x4ad0('0x80')](_[_0x4ad0('0x35')](_0x26efc3,'TeamId'),function(_0x422ea6){return _['includes'](_0xea8717,_0x422ea6);});if(_0x559a69){return _0x4b2262['id'];}}}));}}return BPromise[_0x4ad0('0x81')](_0x50420a)[_0x4ad0('0x2b')](function(_0x21b6d0){_0x4ff155=_(_0x4ff155)[_0x4ad0('0x82')](_0x21b6d0)['compact']()[_0x4ad0('0x83')]();return db['SmsQueue'][_0x4ad0('0x56')]({'where':{'id':_0x2f0466['params']['id']}})[_0x4ad0('0x2b')](function(_0x47e51f){return db[_0x4ad0('0x6d')][_0x4ad0('0x6e')](function(_0x20b5a){return _0x47e51f[_0x4ad0('0x84')](_0x2f0466[_0x4ad0('0x3a')][_0x4ad0('0x6a')],{'transaction':_0x20b5a})[_0x4ad0('0x2b')](function(){if(!_[_0x4ad0('0x85')](_0x4ff155)){return _0x47e51f[_0x4ad0('0x86')](_0x4ff155,{'transaction':_0x20b5a});}})[_0x4ad0('0x2b')](function(){_0x4ff155[_0x4ad0('0x71')](function(_0xa3e3dc){socket['emit'](_0x4ad0('0x87'),{'UserId':_0xa3e3dc,'SmsQueueId':_0x47e51f['id']});});});});});});})[_0x4ad0('0x2b')](respondWithStatusCode(_0x3dae30,null))['catch'](handleError(_0x3dae30,null));};exports[_0x4ad0('0x88')]=function(_0x131080,_0x324f4b,_0x3159e0){return db[_0x4ad0('0x36')][_0x4ad0('0x56')]({'where':{'id':_0x131080[_0x4ad0('0x59')]['id']}})[_0x4ad0('0x2b')](handleEntityNotFound(_0x324f4b,null))['then'](function(_0x3a5c63){if(_0x3a5c63){return _0x3a5c63[_0x4ad0('0x88')](_0x131080[_0x4ad0('0x51')][_0x4ad0('0x6a')],_[_0x4ad0('0x89')](_0x131080['body'],['ids','id'])||{})['spread'](function(_0x25cf29){for(var _0x1b317c=0x0;_0x1b317c<_0x131080['body'][_0x4ad0('0x6a')]['length'];_0x1b317c+=0x1){socket[_0x4ad0('0x72')](_0x4ad0('0x73'),{'UserId':Number(_0x131080['body'][_0x4ad0('0x6a')][_0x1b317c]),'SmsQueueId':Number(_0x131080[_0x4ad0('0x59')]['id'])});}return _0x25cf29;});}})[_0x4ad0('0x2b')](respondWithResult(_0x324f4b,null))['catch'](handleError(_0x324f4b,null));};exports[_0x4ad0('0x86')]=function(_0x6c4639,_0x248fb2,_0x45d169){return db['SmsQueue'][_0x4ad0('0x56')]({'where':{'id':_0x6c4639[_0x4ad0('0x59')]['id']}})[_0x4ad0('0x2b')](handleEntityNotFound(_0x248fb2,null))['then'](function(_0x4a221a){if(_0x4a221a){return _0x4a221a[_0x4ad0('0x86')](_0x6c4639[_0x4ad0('0x3a')]['ids'])[_0x4ad0('0x2b')](function(){if(_['isArray'](_0x6c4639[_0x4ad0('0x3a')]['ids'])){for(var _0x129e9a=0x0;_0x129e9a<_0x6c4639[_0x4ad0('0x3a')][_0x4ad0('0x6a')][_0x4ad0('0x40')];_0x129e9a+=0x1){socket[_0x4ad0('0x72')](_0x4ad0('0x87'),{'UserId':Number(_0x6c4639[_0x4ad0('0x3a')][_0x4ad0('0x6a')][_0x129e9a]),'SmsQueueId':Number(_0x6c4639[_0x4ad0('0x59')]['id'])});}}else{socket[_0x4ad0('0x72')](_0x4ad0('0x87'),{'UserId':Number(_0x6c4639['query'][_0x4ad0('0x6a')]),'SmsQueueId':Number(_0x6c4639[_0x4ad0('0x59')]['id'])});}});}})[_0x4ad0('0x2b')](respondWithStatusCode(_0x248fb2,null))['catch'](handleError(_0x248fb2,null));};exports['getAgents']=function(_0xb0b73d,_0x1ac763,_0x15a8fe){var _0x4ce3c8={};var _0x503ddb={};var _0x2e7940;var _0x3d86fa;return db[_0x4ad0('0x36')]['findOne']({'where':{'id':_0xb0b73d[_0x4ad0('0x59')]['id']}})['then'](handleEntityNotFound(_0x1ac763,null))[_0x4ad0('0x2b')](function(_0x2a915b){if(_0x2a915b){_0x2e7940=_0x2a915b;_0x503ddb['model']=_[_0x4ad0('0x4e')](db[_0x4ad0('0x5f')]['rawAttributes']);_0x503ddb[_0x4ad0('0x3a')]=_['keys'](_0xb0b73d[_0x4ad0('0x3a')]);_0x503ddb[_0x4ad0('0x3b')]=_[_0x4ad0('0x3d')](_0x503ddb[_0x4ad0('0x3c')],_0x503ddb['query']);_0x4ce3c8[_0x4ad0('0x3f')]=_[_0x4ad0('0x3d')](_0x503ddb[_0x4ad0('0x3c')],qs[_0x4ad0('0x3e')](_0xb0b73d[_0x4ad0('0x3a')][_0x4ad0('0x3e')]));_0x4ce3c8[_0x4ad0('0x3f')]=_0x4ce3c8[_0x4ad0('0x3f')][_0x4ad0('0x40')]?_0x4ce3c8['attributes']:_0x503ddb[_0x4ad0('0x3c')];_0x4ce3c8['order']=qs[_0x4ad0('0x43')](_0xb0b73d[_0x4ad0('0x3a')][_0x4ad0('0x43')]);_0x4ce3c8[_0x4ad0('0x44')]=qs[_0x4ad0('0x3b')](_[_0x4ad0('0x45')](_0xb0b73d[_0x4ad0('0x3a')],_0x503ddb[_0x4ad0('0x3b')]));if(_0xb0b73d[_0x4ad0('0x3a')][_0x4ad0('0x46')]){_0x4ce3c8[_0x4ad0('0x44')]=_[_0x4ad0('0x47')](_0x4ce3c8[_0x4ad0('0x44')],{'$or':_[_0x4ad0('0x35')](_0x4ce3c8[_0x4ad0('0x3f')],function(_0x438142){var _0x59b690={};_0x59b690[_0x438142]={'$like':'%'+_0xb0b73d['query'][_0x4ad0('0x46')]+'%'};return _0x59b690;})});}_0x4ce3c8=_[_0x4ad0('0x47')]({},_0x4ce3c8,_0xb0b73d[_0x4ad0('0x48')]);return _0x2e7940['getAgents'](_0x4ce3c8);}})['then'](function(_0x144a23){if(_0x144a23){_0x3d86fa=_0x144a23[_0x4ad0('0x40')];if(!_0xb0b73d[_0x4ad0('0x3a')]['hasOwnProperty'](_0x4ad0('0x42'))){_0x4ce3c8[_0x4ad0('0x25')]=qs[_0x4ad0('0x25')](_0xb0b73d['query'][_0x4ad0('0x25')]);_0x4ce3c8[_0x4ad0('0x22')]=qs[_0x4ad0('0x22')](_0xb0b73d[_0x4ad0('0x3a')][_0x4ad0('0x22')]);}return _0x2e7940[_0x4ad0('0x8a')](_0x4ce3c8);}})[_0x4ad0('0x2b')](function(_0x2915f2){if(_0x2915f2){return _0x2915f2?{'count':_0x3d86fa,'rows':_0x2915f2}:null;}})[_0x4ad0('0x2b')](respondWithResult(_0x1ac763,null))['catch'](handleError(_0x1ac763,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 13ab90b..c223e0c 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 _0x1313=['hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0x2b5513,_0x3fe5cd){var _0x578fd2=function(_0x7a9106){while(--_0x7a9106){_0x2b5513['push'](_0x2b5513['shift']());}};_0x578fd2(++_0x3fe5cd);}(_0x1313,0xd2));var _0x3131=function(_0x454b05,_0x3d5faa){_0x454b05=_0x454b05-0x0;var _0x1e0a94=_0x1313[_0x454b05];return _0x1e0a94;};'use strict';var EventEmitter=require(_0x3131('0x0'));var SmsQueue=require(_0x3131('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x3131('0x2')](0x0);var events={'afterCreate':_0x3131('0x3'),'afterUpdate':'update','afterDestroy':_0x3131('0x4')};function emitEvent(_0x38cae9){return function(_0x425c58,_0xf3fb50,_0x10a78f){SmsQueueEvents[_0x3131('0x5')](_0x38cae9+':'+_0x425c58['id'],_0x425c58);SmsQueueEvents[_0x3131('0x5')](_0x38cae9,_0x425c58);_0x10a78f(null);};}for(var e in events){if(events[_0x3131('0x6')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x3131('0x7')]=SmsQueueEvents; \ No newline at end of file +var _0x6ba3=['hook','exports','events','../../mysqldb','save','remove','emit','hasOwnProperty'];(function(_0x4e36f2,_0xac97f0){var _0x53a43=function(_0x30c337){while(--_0x30c337){_0x4e36f2['push'](_0x4e36f2['shift']());}};_0x53a43(++_0xac97f0);}(_0x6ba3,0x1d2));var _0x36ba=function(_0x2af235,_0x45f664){_0x2af235=_0x2af235-0x0;var _0x593c0e=_0x6ba3[_0x2af235];return _0x593c0e;};'use strict';var EventEmitter=require(_0x36ba('0x0'));var SmsQueue=require(_0x36ba('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x36ba('0x2'),'afterUpdate':'update','afterDestroy':_0x36ba('0x3')};function emitEvent(_0x2dc57e){return function(_0x56d763,_0x45ff1e,_0x15afa4){SmsQueueEvents[_0x36ba('0x4')](_0x2dc57e+':'+_0x56d763['id'],_0x56d763);SmsQueueEvents[_0x36ba('0x4')](_0x2dc57e,_0x56d763);_0x15afa4(null);};}for(var e in events){if(events[_0x36ba('0x5')](e)){var event=events[e];SmsQueue[_0x36ba('0x6')](e,emitEvent(event));}}module[_0x36ba('0x7')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 567536b..c1c169b 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 _0x1d83=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues'];(function(_0x89ac51,_0x5ecae1){var _0x166509=function(_0x11f862){while(--_0x11f862){_0x89ac51['push'](_0x89ac51['shift']());}};_0x166509(++_0x5ecae1);}(_0x1d83,0xc3));var _0x31d8=function(_0x515099,_0x46bdbd){_0x515099=_0x515099-0x0;var _0x26e0a7=_0x1d83[_0x515099];return _0x26e0a7;};'use strict';var _=require(_0x31d8('0x0'));var util=require(_0x31d8('0x1'));var logger=require('../../config/logger')(_0x31d8('0x2'));var moment=require(_0x31d8('0x3'));var BPromise=require(_0x31d8('0x4'));var rp=require(_0x31d8('0x5'));var fs=require('fs');var path=require(_0x31d8('0x6'));var rimraf=require('rimraf');var config=require(_0x31d8('0x7'));var attributes=require(_0x31d8('0x8'));module[_0x31d8('0x9')]=function(_0x2ad731,_0x146747){return _0x2ad731[_0x31d8('0xa')](_0x31d8('0xb'),attributes,{'tableName':_0x31d8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d5b=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue'];(function(_0x436da3,_0x4fa9da){var _0x40627c=function(_0x129285){while(--_0x129285){_0x436da3['push'](_0x436da3['shift']());}};_0x40627c(++_0x4fa9da);}(_0x9d5b,0x1d4));var _0xb9d5=function(_0x33cd54,_0x10f85d){_0x33cd54=_0x33cd54-0x0;var _0x48285a=_0x9d5b[_0x33cd54];return _0x48285a;};'use strict';var _=require(_0xb9d5('0x0'));var util=require('util');var logger=require(_0xb9d5('0x1'))('api');var moment=require(_0xb9d5('0x2'));var BPromise=require(_0xb9d5('0x3'));var rp=require(_0xb9d5('0x4'));var fs=require('fs');var path=require(_0xb9d5('0x5'));var rimraf=require(_0xb9d5('0x6'));var config=require(_0xb9d5('0x7'));var attributes=require(_0xb9d5('0x8'));module[_0xb9d5('0x9')]=function(_0x3ba55f,_0x12cd83){return _0x3ba55f[_0xb9d5('0xa')](_0xb9d5('0xb'),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 1e0a9dc..bb51a3c 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 _0xf3ac=['ioredis','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','options','raw','where','limit','include','map','model','attributes','GetSmsQueue','ShowSmsQueue','find','util','moment','randomstring'];(function(_0x2b2882,_0x3f89ad){var _0xf5bccc=function(_0x384847){while(--_0x384847){_0x2b2882['push'](_0x2b2882['shift']());}};_0xf5bccc(++_0x3f89ad);}(_0xf3ac,0x89));var _0xcf3a=function(_0x2516af,_0x444df7){_0x2516af=_0x2516af-0x0;var _0x48ac18=_0xf3ac[_0x2516af];return _0x48ac18;};'use strict';var _=require('lodash');var util=require(_0xcf3a('0x0'));var moment=require(_0xcf3a('0x1'));var BPromise=require('bluebird');var rs=require(_0xcf3a('0x2'));var fs=require('fs');var Redis=require(_0xcf3a('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcf3a('0x4'));var config=require(_0xcf3a('0x5'));var jayson=require(_0xcf3a('0x6'));var client=jayson[_0xcf3a('0x7')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xcf3a('0x8')],{'host':_0xcf3a('0x9'),'port':0x18eb});var socket=require(_0xcf3a('0xa'))(new Redis(config[_0xcf3a('0x8')]));require('./smsQueue.socket')[_0xcf3a('0xb')](socket);function respondWithRpcPromise(_0x1d93f4,_0x12b851,_0x35fb73){return new BPromise(function(_0x366cab,_0x8da3e3){return client[_0xcf3a('0xc')](_0x1d93f4,_0x35fb73)[_0xcf3a('0xd')](function(_0x20223e){logger[_0xcf3a('0xe')](_0xcf3a('0xf'),_0x12b851,_0xcf3a('0x10'));logger[_0xcf3a('0x11')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x12b851,_0xcf3a('0x10'),JSON[_0xcf3a('0x12')](_0x20223e));if(_0x20223e[_0xcf3a('0x13')]){if(_0x20223e[_0xcf3a('0x13')][_0xcf3a('0x14')]===0x1f4){logger[_0xcf3a('0x13')](_0xcf3a('0xf'),_0x12b851,_0x20223e[_0xcf3a('0x13')][_0xcf3a('0x15')]);return _0x8da3e3(_0x20223e['error'][_0xcf3a('0x15')]);}logger['error'](_0xcf3a('0xf'),_0x12b851,_0x20223e[_0xcf3a('0x13')]['message']);return _0x366cab(_0x20223e[_0xcf3a('0x13')]['message']);}else{logger['info'](_0xcf3a('0xf'),_0x12b851,_0xcf3a('0x10'));_0x366cab(_0x20223e[_0xcf3a('0x16')][_0xcf3a('0x15')]);}})[_0xcf3a('0x17')](function(_0x2276e3){logger[_0xcf3a('0x13')]('SmsQueue,\x20%s,\x20%s',_0x12b851,_0x2276e3);_0x8da3e3(_0x2276e3);});});}exports['GetSmsQueue']=function(_0x1da359){var _0x370235=this;return new Promise(function(_0x48e37d,_0x5149cc){return db['SmsQueue']['findAll']({'raw':_0x1da359[_0xcf3a('0x18')]?_0x1da359[_0xcf3a('0x18')][_0xcf3a('0x19')]===undefined?!![]:![]:!![],'where':_0x1da359[_0xcf3a('0x18')]?_0x1da359[_0xcf3a('0x18')][_0xcf3a('0x1a')]||null:null,'attributes':_0x1da359[_0xcf3a('0x18')]?_0x1da359[_0xcf3a('0x18')]['attributes']||null:null,'limit':_0x1da359[_0xcf3a('0x18')]?_0x1da359[_0xcf3a('0x18')][_0xcf3a('0x1b')]||null:null,'include':_0x1da359[_0xcf3a('0x18')]?_0x1da359[_0xcf3a('0x18')][_0xcf3a('0x1c')]?_[_0xcf3a('0x1d')](_0x1da359[_0xcf3a('0x18')]['include'],function(_0x16c57a){return{'model':db[_0x16c57a[_0xcf3a('0x1e')]],'as':_0x16c57a['as'],'attributes':_0x16c57a[_0xcf3a('0x1f')],'include':_0x16c57a[_0xcf3a('0x1c')]?_[_0xcf3a('0x1d')](_0x16c57a[_0xcf3a('0x1c')],function(_0x245775){return{'model':db[_0x245775['model']],'as':_0x245775['as'],'attributes':_0x245775[_0xcf3a('0x1f')],'include':_0x245775[_0xcf3a('0x1c')]?_[_0xcf3a('0x1d')](_0x245775[_0xcf3a('0x1c')],function(_0x3e8830){return{'model':db[_0x3e8830['model']],'as':_0x3e8830['as'],'attributes':_0x3e8830[_0xcf3a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xcf3a('0xd')](function(_0x308ca3){logger[_0xcf3a('0xe')](_0xcf3a('0x20'),_0x1da359);logger[_0xcf3a('0x11')](_0xcf3a('0x20'),_0x1da359,JSON['stringify'](_0x308ca3));_0x48e37d(_0x308ca3);})[_0xcf3a('0x17')](function(_0x4ecafa){logger[_0xcf3a('0x13')](_0xcf3a('0x20'),_0x4ecafa[_0xcf3a('0x15')],_0x1da359);_0x5149cc(_0x370235[_0xcf3a('0x13')](0x1f4,_0x4ecafa[_0xcf3a('0x15')]));});});};exports[_0xcf3a('0x21')]=function(_0x30ae38){var _0x272967=this;return new Promise(function(_0x1ffd3b,_0x41c608){return db['SmsQueue'][_0xcf3a('0x22')]({'raw':_0x30ae38[_0xcf3a('0x18')]?_0x30ae38[_0xcf3a('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x30ae38[_0xcf3a('0x18')]?_0x30ae38[_0xcf3a('0x18')][_0xcf3a('0x1a')]||null:null,'attributes':_0x30ae38[_0xcf3a('0x18')]?_0x30ae38['options'][_0xcf3a('0x1f')]||null:null,'include':_0x30ae38[_0xcf3a('0x18')]?_0x30ae38[_0xcf3a('0x18')]['include']?_[_0xcf3a('0x1d')](_0x30ae38[_0xcf3a('0x18')][_0xcf3a('0x1c')],function(_0x48f42d){return{'model':db[_0x48f42d[_0xcf3a('0x1e')]],'as':_0x48f42d['as'],'attributes':_0x48f42d[_0xcf3a('0x1f')],'include':_0x48f42d['include']?_[_0xcf3a('0x1d')](_0x48f42d[_0xcf3a('0x1c')],function(_0x24a3c7){return{'model':db[_0x24a3c7['model']],'as':_0x24a3c7['as'],'attributes':_0x24a3c7[_0xcf3a('0x1f')],'include':_0x24a3c7[_0xcf3a('0x1c')]?_['map'](_0x24a3c7['include'],function(_0x1162eb){return{'model':db[_0x1162eb[_0xcf3a('0x1e')]],'as':_0x1162eb['as'],'attributes':_0x1162eb[_0xcf3a('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x17565c){logger[_0xcf3a('0xe')](_0xcf3a('0x21'),_0x30ae38);logger[_0xcf3a('0x11')](_0xcf3a('0x21'),_0x30ae38,JSON[_0xcf3a('0x12')](_0x17565c));_0x1ffd3b(_0x17565c);})['catch'](function(_0x30c643){logger['error'](_0xcf3a('0x21'),_0x30c643['message'],_0x30ae38);_0x41c608(_0x272967[_0xcf3a('0x13')](0x1f4,_0x30c643[_0xcf3a('0x15')]));});});}; \ No newline at end of file +var _0xe330=['./smsQueue.socket','request','then','SmsQueue,\x20%s,\x20%s','debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','GetSmsQueue','findAll','options','attributes','limit','include','map','model','ShowSmsQueue','SmsQueue','find','raw','where','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','localhost','socket.io-emitter','redis'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0xe330,0x1d1));var _0x0e33=function(_0x1a1240,_0x1ce040){_0x1a1240=_0x1a1240-0x0;var _0x2f5d6b=_0xe330[_0x1a1240];return _0x2f5d6b;};'use strict';var _=require(_0x0e33('0x0'));var util=require(_0x0e33('0x1'));var moment=require(_0x0e33('0x2'));var BPromise=require(_0x0e33('0x3'));var rs=require(_0x0e33('0x4'));var fs=require('fs');var Redis=require(_0x0e33('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0e33('0x6'));var logger=require(_0x0e33('0x7'))('rpc');var config=require(_0x0e33('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0e33('0x9')][_0x0e33('0xa')]({'port':0x232a});config['redis']=_[_0x0e33('0xb')](config['redis'],{'host':_0x0e33('0xc'),'port':0x18eb});var socket=require(_0x0e33('0xd'))(new Redis(config[_0x0e33('0xe')]));require(_0x0e33('0xf'))['register'](socket);function respondWithRpcPromise(_0x5d1e30,_0x38fbec,_0x47714a){return new BPromise(function(_0x153f90,_0x30a618){return client[_0x0e33('0x10')](_0x5d1e30,_0x47714a)[_0x0e33('0x11')](function(_0x6a9860){logger['info'](_0x0e33('0x12'),_0x38fbec,'request\x20sent');logger[_0x0e33('0x13')](_0x0e33('0x14'),_0x38fbec,_0x0e33('0x15'),JSON[_0x0e33('0x16')](_0x6a9860));if(_0x6a9860[_0x0e33('0x17')]){if(_0x6a9860[_0x0e33('0x17')]['code']===0x1f4){logger[_0x0e33('0x17')](_0x0e33('0x12'),_0x38fbec,_0x6a9860[_0x0e33('0x17')][_0x0e33('0x18')]);return _0x30a618(_0x6a9860[_0x0e33('0x17')][_0x0e33('0x18')]);}logger[_0x0e33('0x17')](_0x0e33('0x12'),_0x38fbec,_0x6a9860[_0x0e33('0x17')][_0x0e33('0x18')]);return _0x153f90(_0x6a9860[_0x0e33('0x17')][_0x0e33('0x18')]);}else{logger[_0x0e33('0x19')](_0x0e33('0x12'),_0x38fbec,_0x0e33('0x15'));_0x153f90(_0x6a9860['result']['message']);}})[_0x0e33('0x1a')](function(_0x4d7237){logger[_0x0e33('0x17')](_0x0e33('0x12'),_0x38fbec,_0x4d7237);_0x30a618(_0x4d7237);});});}exports[_0x0e33('0x1b')]=function(_0x37bc5a){var _0x5eb435=this;return new Promise(function(_0x4c32d3,_0x46ab62){return db['SmsQueue'][_0x0e33('0x1c')]({'raw':_0x37bc5a[_0x0e33('0x1d')]?_0x37bc5a['options']['raw']===undefined?!![]:![]:!![],'where':_0x37bc5a[_0x0e33('0x1d')]?_0x37bc5a['options']['where']||null:null,'attributes':_0x37bc5a[_0x0e33('0x1d')]?_0x37bc5a[_0x0e33('0x1d')][_0x0e33('0x1e')]||null:null,'limit':_0x37bc5a['options']?_0x37bc5a[_0x0e33('0x1d')][_0x0e33('0x1f')]||null:null,'include':_0x37bc5a[_0x0e33('0x1d')]?_0x37bc5a[_0x0e33('0x1d')][_0x0e33('0x20')]?_[_0x0e33('0x21')](_0x37bc5a[_0x0e33('0x1d')][_0x0e33('0x20')],function(_0x319388){return{'model':db[_0x319388[_0x0e33('0x22')]],'as':_0x319388['as'],'attributes':_0x319388[_0x0e33('0x1e')],'include':_0x319388[_0x0e33('0x20')]?_[_0x0e33('0x21')](_0x319388['include'],function(_0xba1a7a){return{'model':db[_0xba1a7a[_0x0e33('0x22')]],'as':_0xba1a7a['as'],'attributes':_0xba1a7a['attributes'],'include':_0xba1a7a[_0x0e33('0x20')]?_[_0x0e33('0x21')](_0xba1a7a[_0x0e33('0x20')],function(_0x5874f1){return{'model':db[_0x5874f1['model']],'as':_0x5874f1['as'],'attributes':_0x5874f1[_0x0e33('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b5597){logger[_0x0e33('0x19')]('GetSmsQueue',_0x37bc5a);logger['debug'](_0x0e33('0x1b'),_0x37bc5a,JSON['stringify'](_0x4b5597));_0x4c32d3(_0x4b5597);})[_0x0e33('0x1a')](function(_0x2f2ce1){logger['error'](_0x0e33('0x1b'),_0x2f2ce1[_0x0e33('0x18')],_0x37bc5a);_0x46ab62(_0x5eb435[_0x0e33('0x17')](0x1f4,_0x2f2ce1[_0x0e33('0x18')]));});});};exports[_0x0e33('0x23')]=function(_0x430ba2){var _0x43dbfc=this;return new Promise(function(_0x5e445c,_0x392c29){return db[_0x0e33('0x24')][_0x0e33('0x25')]({'raw':_0x430ba2['options']?_0x430ba2[_0x0e33('0x1d')][_0x0e33('0x26')]===undefined?!![]:![]:!![],'where':_0x430ba2[_0x0e33('0x1d')]?_0x430ba2['options'][_0x0e33('0x27')]||null:null,'attributes':_0x430ba2['options']?_0x430ba2[_0x0e33('0x1d')][_0x0e33('0x1e')]||null:null,'include':_0x430ba2['options']?_0x430ba2['options'][_0x0e33('0x20')]?_['map'](_0x430ba2[_0x0e33('0x1d')][_0x0e33('0x20')],function(_0x502048){return{'model':db[_0x502048[_0x0e33('0x22')]],'as':_0x502048['as'],'attributes':_0x502048[_0x0e33('0x1e')],'include':_0x502048[_0x0e33('0x20')]?_[_0x0e33('0x21')](_0x502048[_0x0e33('0x20')],function(_0x22bb87){return{'model':db[_0x22bb87[_0x0e33('0x22')]],'as':_0x22bb87['as'],'attributes':_0x22bb87[_0x0e33('0x1e')],'include':_0x22bb87[_0x0e33('0x20')]?_[_0x0e33('0x21')](_0x22bb87[_0x0e33('0x20')],function(_0x320793){return{'model':db[_0x320793[_0x0e33('0x22')]],'as':_0x320793['as'],'attributes':_0x320793[_0x0e33('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0e33('0x11')](function(_0x54b7d2){logger[_0x0e33('0x19')](_0x0e33('0x23'),_0x430ba2);logger[_0x0e33('0x13')](_0x0e33('0x23'),_0x430ba2,JSON[_0x0e33('0x16')](_0x54b7d2));_0x5e445c(_0x54b7d2);})['catch'](function(_0x2954cb){logger[_0x0e33('0x17')](_0x0e33('0x23'),_0x2954cb[_0x0e33('0x18')],_0x430ba2);_0x392c29(_0x43dbfc[_0x0e33('0x17')](0x1f4,_0x2954cb[_0x0e33('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index ba8596f..32929b2 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 _0xc099=['update','emit','removeListener','register','smsQueue:','save'];(function(_0x775f64,_0x47cf5c){var _0x33b718=function(_0x38d10f){while(--_0x38d10f){_0x775f64['push'](_0x775f64['shift']());}};_0x33b718(++_0x47cf5c);}(_0xc099,0xdd));var _0x9c09=function(_0x320f39,_0x5462d0){_0x320f39=_0x320f39-0x0;var _0x21f0a2=_0xc099[_0x320f39];return _0x21f0a2;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x9c09('0x0'),'remove',_0x9c09('0x1')];function createListener(_0x35bf6e,_0x5962be){return function(_0x3c93e6){_0x5962be[_0x9c09('0x2')](_0x35bf6e,_0x3c93e6);};}function removeListener(_0x341b18,_0x190216){return function(){SmsQueueEvents[_0x9c09('0x3')](_0x341b18,_0x190216);};}exports[_0x9c09('0x4')]=function(_0x5a43b5){for(var _0xd25d7b=0x0,_0x4722ad=events['length'];_0xd25d7b<_0x4722ad;_0xd25d7b++){var _0x3239d6=events[_0xd25d7b];var _0x9618f4=createListener(_0x9c09('0x5')+_0x3239d6,_0x5a43b5);SmsQueueEvents['on'](_0x3239d6,_0x9618f4);}}; \ No newline at end of file +var _0xbb8c=['register','./smsQueue.events','save','remove','update','emit','removeListener'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbb8c,0x7f));var _0xcbb8=function(_0x25405b,_0x2da050){_0x25405b=_0x25405b-0x0;var _0x2c64cf=_0xbb8c[_0x25405b];return _0x2c64cf;};'use strict';var SmsQueueEvents=require(_0xcbb8('0x0'));var events=[_0xcbb8('0x1'),_0xcbb8('0x2'),_0xcbb8('0x3')];function createListener(_0x548c54,_0xdca7d2){return function(_0x4d8aa2){_0xdca7d2[_0xcbb8('0x4')](_0x548c54,_0x4d8aa2);};}function removeListener(_0x9bb5b,_0xa1a291){return function(){SmsQueueEvents[_0xcbb8('0x5')](_0x9bb5b,_0xa1a291);};}exports[_0xcbb8('0x6')]=function(_0x2703bc){for(var _0x1b81c0=0x0,_0xbaa04c=events['length'];_0x1b81c0<_0xbaa04c;_0x1b81c0++){var _0x59c3b3=events[_0x1b81c0];var _0x4f3a58=createListener('smsQueue:'+_0x59c3b3,_0x2703bc);SmsQueueEvents['on'](_0x59c3b3,_0x4f3a58);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index dd1d336..1222d88 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 _0xb8ba=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','index','/describe','describe','/:id','post','isAuthenticated','create','put','update','delete','destroy','multer'];(function(_0x37cdaa,_0x23b4bf){var _0x4bbd6f=function(_0x57abe9){while(--_0x57abe9){_0x37cdaa['push'](_0x37cdaa['shift']());}};_0x4bbd6f(++_0x23b4bf);}(_0xb8ba,0x6d));var _0xab8b=function(_0x23e76f,_0x58f8fd){_0x23e76f=_0x23e76f-0x0;var _0x10198d=_0xb8ba[_0x23e76f];return _0x10198d;};'use strict';var multer=require(_0xab8b('0x0'));var util=require(_0xab8b('0x1'));var path=require(_0xab8b('0x2'));var timeout=require('connect-timeout');var express=require(_0xab8b('0x3'));var router=express[_0xab8b('0x4')]();var fs_extra=require(_0xab8b('0x5'));var auth=require(_0xab8b('0x6'));var interaction=require(_0xab8b('0x7'));var config=require(_0xab8b('0x8'));var controller=require(_0xab8b('0x9'));router[_0xab8b('0xa')]('/',auth['isAuthenticated'](),controller[_0xab8b('0xb')]);router['get'](_0xab8b('0xc'),auth['isAuthenticated'](),controller[_0xab8b('0xd')]);router[_0xab8b('0xa')](_0xab8b('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xab8b('0xf')]('/',auth[_0xab8b('0x10')](),controller[_0xab8b('0x11')]);router[_0xab8b('0x12')](_0xab8b('0xe'),auth[_0xab8b('0x10')](),controller[_0xab8b('0x13')]);router[_0xab8b('0x14')](_0xab8b('0xe'),auth[_0xab8b('0x10')](),controller[_0xab8b('0x15')]);module['exports']=router; \ No newline at end of file +var _0x229e=['describe','/:id','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x3cedb6,_0x4f0538){var _0x451d5b=function(_0x97d0db){while(--_0x97d0db){_0x3cedb6['push'](_0x3cedb6['shift']());}};_0x451d5b(++_0x4f0538);}(_0x229e,0xbd));var _0xe229=function(_0x4a4384,_0x37ce4c){_0x4a4384=_0x4a4384-0x0;var _0x2d3903=_0x229e[_0x4a4384];return _0x2d3903;};'use strict';var multer=require('multer');var util=require(_0xe229('0x0'));var path=require(_0xe229('0x1'));var timeout=require(_0xe229('0x2'));var express=require(_0xe229('0x3'));var router=express[_0xe229('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe229('0x5'));var interaction=require(_0xe229('0x6'));var config=require(_0xe229('0x7'));var controller=require('./smsQueueReport.controller');router[_0xe229('0x8')]('/',auth[_0xe229('0x9')](),controller[_0xe229('0xa')]);router['get']('/describe',auth[_0xe229('0x9')](),controller[_0xe229('0xb')]);router[_0xe229('0x8')](_0xe229('0xc'),auth[_0xe229('0x9')](),controller['show']);router[_0xe229('0xd')]('/',auth['isAuthenticated'](),controller[_0xe229('0xe')]);router[_0xe229('0xf')]('/:id',auth[_0xe229('0x9')](),controller[_0xe229('0x10')]);router[_0xe229('0x11')](_0xe229('0xc'),auth[_0xe229('0x9')](),controller[_0xe229('0x12')]);module[_0xe229('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index eda2f70..adfd7c0 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 _0x78bd=['DATE','exports','STRING'];(function(_0x299964,_0x1c5211){var _0x11c929=function(_0x5d5fe7){while(--_0x5d5fe7){_0x299964['push'](_0x299964['shift']());}};_0x11c929(++_0x1c5211);}(_0x78bd,0x14b));var _0xd78b=function(_0x59befa,_0x4af99b){_0x59befa=_0x59befa-0x0;var _0x1dd63d=_0x78bd[_0x59befa];return _0x1dd63d;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xd78b('0x0')]={'uniqueid':{'type':Sequelize[_0xd78b('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xd78b('0x2')]},'leaveAt':{'type':Sequelize[_0xd78b('0x2')]},'acceptAt':{'type':Sequelize[_0xd78b('0x2')]},'exitAt':{'type':Sequelize[_0xd78b('0x2')]},'reason':{'type':Sequelize[_0xd78b('0x1')]}}; \ No newline at end of file +var _0x0af1=['exports','STRING','DATE'];(function(_0x101971,_0x371c09){var _0x107dcb=function(_0x2141bd){while(--_0x2141bd){_0x101971['push'](_0x101971['shift']());}};_0x107dcb(++_0x371c09);}(_0x0af1,0x135));var _0x10af=function(_0x5951d6,_0x384ad7){_0x5951d6=_0x5951d6-0x0;var _0x36ecde=_0x0af1[_0x5951d6];return _0x36ecde;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x10af('0x0')]={'uniqueid':{'type':Sequelize[_0x10af('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x10af('0x1')]},'joinAt':{'type':Sequelize[_0x10af('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x10af('0x2')]},'exitAt':{'type':Sequelize[_0x10af('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 2cdfced..b8b9f9b 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 _0xe914=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','save','then','error','stack','name','SmsQueueReport','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','map','VIRTUAL','options','count','include','findAll','rows','catch','show','includeAll','body','params','destroy','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0xaa30be,_0x426cb8){var _0x391cf1=function(_0x3f897f){while(--_0x3f897f){_0xaa30be['push'](_0xaa30be['shift']());}};_0x391cf1(++_0x426cb8);}(_0xe914,0x7f));var _0x4e91=function(_0x190197,_0x2147c9){_0x190197=_0x190197-0x0;var _0x56d9cf=_0xe914[_0x190197];return _0x56d9cf;};'use strict';var emlformat=require(_0x4e91('0x0'));var rimraf=require(_0x4e91('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4e91('0x2'));var rp=require(_0x4e91('0x3'));var moment=require(_0x4e91('0x4'));var BPromise=require(_0x4e91('0x5'));var Mustache=require(_0x4e91('0x6'));var util=require(_0x4e91('0x7'));var path=require('path');var sox=require(_0x4e91('0x8'));var csv=require(_0x4e91('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4e91('0xa'));var _=require(_0x4e91('0xb'));var squel=require(_0x4e91('0xc'));var crypto=require(_0x4e91('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4e91('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4e91('0xe'));var authService=require(_0x4e91('0xf'));var qs=require(_0x4e91('0x10'));var as=require(_0x4e91('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4e91('0x12'))(_0x4e91('0x13'));var utils=require(_0x4e91('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x4e91('0x15'));var db=require(_0x4e91('0x16'))['db'];function respondWithStatusCode(_0xe744b4,_0x32a107){_0x32a107=_0x32a107||0xcc;return function(_0x224fb5){if(_0x224fb5){return _0xe744b4[_0x4e91('0x17')](_0x32a107);}return _0xe744b4[_0x4e91('0x18')](_0x32a107)[_0x4e91('0x19')]();};}function respondWithResult(_0x3c7a15,_0x5cf980){_0x5cf980=_0x5cf980||0xc8;return function(_0x523594){if(_0x523594){return _0x3c7a15[_0x4e91('0x18')](_0x5cf980)[_0x4e91('0x1a')](_0x523594);}};}function respondWithFilteredResult(_0x5408ae,_0x327d64){return function(_0x83fe44){if(_0x83fe44){var _0x1ecd34=typeof _0x327d64[_0x4e91('0x1b')]===_0x4e91('0x1c')&&typeof _0x327d64[_0x4e91('0x1d')]===_0x4e91('0x1c');var _0x17b9dc=_0x83fe44['count'];var _0x169b6f=_0x1ecd34?0x0:_0x327d64[_0x4e91('0x1b')];var _0x7bdc49=_0x1ecd34?_0x83fe44['count']:_0x327d64[_0x4e91('0x1b')]+_0x327d64[_0x4e91('0x1d')];var _0x4a332b;if(_0x7bdc49>=_0x17b9dc){_0x7bdc49=_0x17b9dc;_0x4a332b=0xc8;}else{_0x4a332b=0xce;}_0x5408ae[_0x4e91('0x18')](_0x4a332b);return _0x5408ae[_0x4e91('0x1e')]('Content-Range',_0x169b6f+'-'+_0x7bdc49+'/'+_0x17b9dc)[_0x4e91('0x1a')](_0x83fe44);}return null;};}function patchUpdates(_0x7450){return function(_0x342c43){try{jsonpatch['apply'](_0x342c43,_0x7450,!![]);}catch(_0xd32169){return BPromise['reject'](_0xd32169);}return _0x342c43[_0x4e91('0x1f')]();};}function saveUpdates(_0x2a209f,_0x230308){return function(_0x540490){if(_0x540490){return _0x540490['update'](_0x2a209f)[_0x4e91('0x20')](function(_0x5eb85d){return _0x5eb85d;});}return null;};}function removeEntity(_0x3387f4,_0x4d1124){return function(_0x2550d8){if(_0x2550d8){return _0x2550d8['destroy']()[_0x4e91('0x20')](function(){_0x3387f4[_0x4e91('0x18')](0xcc)[_0x4e91('0x19')]();});}};}function handleEntityNotFound(_0x511a50,_0x37b3df){return function(_0x23dd58){if(!_0x23dd58){_0x511a50['sendStatus'](0x194);}return _0x23dd58;};}function handleError(_0xdfa12d,_0x9f3043){_0x9f3043=_0x9f3043||0x1f4;return function(_0x110315){logger[_0x4e91('0x21')](_0x110315[_0x4e91('0x22')]);if(_0x110315[_0x4e91('0x23')]){delete _0x110315[_0x4e91('0x23')];}_0xdfa12d[_0x4e91('0x18')](_0x9f3043)['send'](_0x110315);};}exports['index']=function(_0x4c44e1,_0x263dbe){var _0x3adb42={},_0x508565={},_0x35beb1={'count':0x0,'rows':[]};var _0x5e74c0=_['map'](db[_0x4e91('0x24')][_0x4e91('0x25')],function(_0x14dfa6){return{'name':_0x14dfa6[_0x4e91('0x26')],'type':_0x14dfa6[_0x4e91('0x27')][_0x4e91('0x28')]};});_0x508565['model']=_['map'](_0x5e74c0,'name');_0x508565[_0x4e91('0x29')]=_[_0x4e91('0x2a')](_0x4c44e1['query']);_0x508565['filters']=_['intersection'](_0x508565[_0x4e91('0x2b')],_0x508565[_0x4e91('0x29')]);_0x3adb42[_0x4e91('0x2c')]=_[_0x4e91('0x2d')](_0x508565['model'],qs['fields'](_0x4c44e1[_0x4e91('0x29')][_0x4e91('0x2e')]));_0x3adb42[_0x4e91('0x2c')]=_0x3adb42[_0x4e91('0x2c')][_0x4e91('0x2f')]?_0x3adb42[_0x4e91('0x2c')]:_0x508565[_0x4e91('0x2b')];if(!_0x4c44e1[_0x4e91('0x29')][_0x4e91('0x30')](_0x4e91('0x31'))){_0x3adb42[_0x4e91('0x1d')]=qs['limit'](_0x4c44e1['query'][_0x4e91('0x1d')]);_0x3adb42[_0x4e91('0x1b')]=qs[_0x4e91('0x1b')](_0x4c44e1[_0x4e91('0x29')][_0x4e91('0x1b')]);}_0x3adb42[_0x4e91('0x32')]=qs[_0x4e91('0x33')](_0x4c44e1['query'][_0x4e91('0x33')]);_0x3adb42['where']=qs['filters'](_[_0x4e91('0x34')](_0x4c44e1['query'],_0x508565[_0x4e91('0x35')]),_0x5e74c0);if(_0x4c44e1[_0x4e91('0x29')][_0x4e91('0x36')]){_0x3adb42[_0x4e91('0x37')]=_[_0x4e91('0x38')](_0x3adb42[_0x4e91('0x37')],{'$or':_[_0x4e91('0x39')](_0x5e74c0,function(_0x1a3dd8){if(_0x1a3dd8[_0x4e91('0x27')]!==_0x4e91('0x3a')){var _0x1c8347={};_0x1c8347[_0x1a3dd8[_0x4e91('0x23')]]={'$like':'%'+_0x4c44e1[_0x4e91('0x29')][_0x4e91('0x36')]+'%'};return _0x1c8347;}})});}_0x3adb42=_['merge']({},_0x3adb42,_0x4c44e1[_0x4e91('0x3b')]);var _0x2789ca={'where':_0x3adb42[_0x4e91('0x37')]};return db[_0x4e91('0x24')][_0x4e91('0x3c')](_0x2789ca)[_0x4e91('0x20')](function(_0x1546fb){_0x35beb1[_0x4e91('0x3c')]=_0x1546fb;if(_0x4c44e1[_0x4e91('0x29')]['includeAll']){_0x3adb42[_0x4e91('0x3d')]=[{'all':!![]}];}return db[_0x4e91('0x24')][_0x4e91('0x3e')](_0x3adb42);})['then'](function(_0x53801e){_0x35beb1[_0x4e91('0x3f')]=_0x53801e;return _0x35beb1;})['then'](respondWithFilteredResult(_0x263dbe,_0x3adb42))[_0x4e91('0x40')](handleError(_0x263dbe,null));};exports[_0x4e91('0x41')]=function(_0xc324b1,_0x1f5a66){var _0x10dd2c={'raw':!![],'where':{'id':_0xc324b1['params']['id']}},_0x4a5ea4={};_0x4a5ea4['model']=_[_0x4e91('0x2a')](db[_0x4e91('0x24')][_0x4e91('0x25')]);_0x4a5ea4[_0x4e91('0x29')]=_[_0x4e91('0x2a')](_0xc324b1['query']);_0x4a5ea4[_0x4e91('0x35')]=_[_0x4e91('0x2d')](_0x4a5ea4[_0x4e91('0x2b')],_0x4a5ea4[_0x4e91('0x29')]);_0x10dd2c[_0x4e91('0x2c')]=_[_0x4e91('0x2d')](_0x4a5ea4[_0x4e91('0x2b')],qs[_0x4e91('0x2e')](_0xc324b1[_0x4e91('0x29')][_0x4e91('0x2e')]));_0x10dd2c[_0x4e91('0x2c')]=_0x10dd2c['attributes'][_0x4e91('0x2f')]?_0x10dd2c[_0x4e91('0x2c')]:_0x4a5ea4['model'];if(_0xc324b1[_0x4e91('0x29')][_0x4e91('0x42')]){_0x10dd2c[_0x4e91('0x3d')]=[{'all':!![]}];}_0x10dd2c=_[_0x4e91('0x38')]({},_0x10dd2c,_0xc324b1['options']);return db['SmsQueueReport']['find'](_0x10dd2c)[_0x4e91('0x20')](handleEntityNotFound(_0x1f5a66,null))[_0x4e91('0x20')](respondWithResult(_0x1f5a66,null))[_0x4e91('0x40')](handleError(_0x1f5a66,null));};exports['create']=function(_0x23aabc,_0x388282){return db['SmsQueueReport']['create'](_0x23aabc[_0x4e91('0x43')],{})[_0x4e91('0x20')](respondWithResult(_0x388282,0xc9))[_0x4e91('0x40')](handleError(_0x388282,null));};exports['update']=function(_0x2ae142,_0x2c401d){if(_0x2ae142[_0x4e91('0x43')]['id']){delete _0x2ae142[_0x4e91('0x43')]['id'];}return db[_0x4e91('0x24')]['find']({'where':{'id':_0x2ae142[_0x4e91('0x44')]['id']}})[_0x4e91('0x20')](handleEntityNotFound(_0x2c401d,null))[_0x4e91('0x20')](saveUpdates(_0x2ae142['body'],null))['then'](respondWithResult(_0x2c401d,null))['catch'](handleError(_0x2c401d,null));};exports[_0x4e91('0x45')]=function(_0x531a45,_0x4f91a6){return db[_0x4e91('0x24')][_0x4e91('0x46')]({'where':{'id':_0x531a45[_0x4e91('0x44')]['id']}})[_0x4e91('0x20')](handleEntityNotFound(_0x4f91a6,null))[_0x4e91('0x20')](removeEntity(_0x4f91a6,null))[_0x4e91('0x40')](handleError(_0x4f91a6,null));};exports[_0x4e91('0x47')]=function(_0x30dba2,_0x1500d9){return db[_0x4e91('0x24')][_0x4e91('0x47')]()[_0x4e91('0x20')](respondWithResult(_0x1500d9,null))[_0x4e91('0x40')](handleError(_0x1500d9,null));}; \ No newline at end of file +var _0x272e=['jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','SmsQueueReport','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','crypto'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x272e,0x91));var _0xe272=function(_0x286ac9,_0x407bc1){_0x286ac9=_0x286ac9-0x0;var _0x3158b5=_0x272e[_0x286ac9];return _0x3158b5;};'use strict';var emlformat=require(_0xe272('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe272('0x1'));var rp=require(_0xe272('0x2'));var moment=require(_0xe272('0x3'));var BPromise=require(_0xe272('0x4'));var Mustache=require(_0xe272('0x5'));var util=require(_0xe272('0x6'));var path=require('path');var sox=require(_0xe272('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe272('0x8'));var _=require(_0xe272('0x9'));var squel=require('squel');var crypto=require(_0xe272('0xa'));var jsforce=require(_0xe272('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xe272('0xc'));var querystring=require(_0xe272('0xd'));var Papa=require(_0xe272('0xe'));var Redis=require('ioredis');var authService=require(_0xe272('0xf'));var qs=require(_0xe272('0x10'));var as=require(_0xe272('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe272('0x12'))(_0xe272('0x13'));var utils=require(_0xe272('0x14'));var config=require(_0xe272('0x15'));var licenseUtil=require(_0xe272('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a4af7,_0x43488e){_0x43488e=_0x43488e||0xcc;return function(_0x52d4b7){if(_0x52d4b7){return _0x2a4af7['sendStatus'](_0x43488e);}return _0x2a4af7[_0xe272('0x17')](_0x43488e)[_0xe272('0x18')]();};}function respondWithResult(_0x226029,_0x309a85){_0x309a85=_0x309a85||0xc8;return function(_0x583082){if(_0x583082){return _0x226029[_0xe272('0x17')](_0x309a85)[_0xe272('0x19')](_0x583082);}};}function respondWithFilteredResult(_0x1280b3,_0xab9039){return function(_0x3b71c4){if(_0x3b71c4){var _0x125222=typeof _0xab9039[_0xe272('0x1a')]==='undefined'&&typeof _0xab9039[_0xe272('0x1b')]===_0xe272('0x1c');var _0x150e8f=_0x3b71c4[_0xe272('0x1d')];var _0x3cee62=_0x125222?0x0:_0xab9039[_0xe272('0x1a')];var _0x2b1bcb=_0x125222?_0x3b71c4[_0xe272('0x1d')]:_0xab9039[_0xe272('0x1a')]+_0xab9039['limit'];var _0x23be05;if(_0x2b1bcb>=_0x150e8f){_0x2b1bcb=_0x150e8f;_0x23be05=0xc8;}else{_0x23be05=0xce;}_0x1280b3['status'](_0x23be05);return _0x1280b3[_0xe272('0x1e')](_0xe272('0x1f'),_0x3cee62+'-'+_0x2b1bcb+'/'+_0x150e8f)[_0xe272('0x19')](_0x3b71c4);}return null;};}function patchUpdates(_0x3cbcd7){return function(_0x495bb1){try{jsonpatch[_0xe272('0x20')](_0x495bb1,_0x3cbcd7,!![]);}catch(_0x46d307){return BPromise[_0xe272('0x21')](_0x46d307);}return _0x495bb1[_0xe272('0x22')]();};}function saveUpdates(_0x40538a,_0xf7128){return function(_0x594741){if(_0x594741){return _0x594741[_0xe272('0x23')](_0x40538a)[_0xe272('0x24')](function(_0x692940){return _0x692940;});}return null;};}function removeEntity(_0x58db1a,_0x29edfb){return function(_0x18abec){if(_0x18abec){return _0x18abec[_0xe272('0x25')]()[_0xe272('0x24')](function(){_0x58db1a[_0xe272('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x577a36,_0x4e5d9f){return function(_0x488603){if(!_0x488603){_0x577a36['sendStatus'](0x194);}return _0x488603;};}function handleError(_0x266e1d,_0x2dff4f){_0x2dff4f=_0x2dff4f||0x1f4;return function(_0x34ab90){logger[_0xe272('0x26')](_0x34ab90[_0xe272('0x27')]);if(_0x34ab90['name']){delete _0x34ab90[_0xe272('0x28')];}_0x266e1d[_0xe272('0x17')](_0x2dff4f)[_0xe272('0x29')](_0x34ab90);};}exports[_0xe272('0x2a')]=function(_0x29aba3,_0x1022d2){var _0xbec8ba={},_0x329486={},_0x3ed7e6={'count':0x0,'rows':[]};var _0x151f2a=_[_0xe272('0x2b')](db['SmsQueueReport'][_0xe272('0x2c')],function(_0x386a66){return{'name':_0x386a66[_0xe272('0x2d')],'type':_0x386a66['type'][_0xe272('0x2e')]};});_0x329486[_0xe272('0x2f')]=_[_0xe272('0x2b')](_0x151f2a,'name');_0x329486['query']=_[_0xe272('0x30')](_0x29aba3[_0xe272('0x31')]);_0x329486[_0xe272('0x32')]=_[_0xe272('0x33')](_0x329486[_0xe272('0x2f')],_0x329486[_0xe272('0x31')]);_0xbec8ba['attributes']=_[_0xe272('0x33')](_0x329486[_0xe272('0x2f')],qs['fields'](_0x29aba3['query'][_0xe272('0x34')]));_0xbec8ba[_0xe272('0x35')]=_0xbec8ba[_0xe272('0x35')][_0xe272('0x36')]?_0xbec8ba['attributes']:_0x329486['model'];if(!_0x29aba3[_0xe272('0x31')][_0xe272('0x37')](_0xe272('0x38'))){_0xbec8ba[_0xe272('0x1b')]=qs['limit'](_0x29aba3['query'][_0xe272('0x1b')]);_0xbec8ba[_0xe272('0x1a')]=qs[_0xe272('0x1a')](_0x29aba3[_0xe272('0x31')][_0xe272('0x1a')]);}_0xbec8ba[_0xe272('0x39')]=qs[_0xe272('0x3a')](_0x29aba3[_0xe272('0x31')][_0xe272('0x3a')]);_0xbec8ba[_0xe272('0x3b')]=qs['filters'](_[_0xe272('0x3c')](_0x29aba3[_0xe272('0x31')],_0x329486[_0xe272('0x32')]),_0x151f2a);if(_0x29aba3['query'][_0xe272('0x3d')]){_0xbec8ba[_0xe272('0x3b')]=_['merge'](_0xbec8ba[_0xe272('0x3b')],{'$or':_[_0xe272('0x2b')](_0x151f2a,function(_0x4e1ed1){if(_0x4e1ed1[_0xe272('0x3e')]!==_0xe272('0x3f')){var _0x577810={};_0x577810[_0x4e1ed1[_0xe272('0x28')]]={'$like':'%'+_0x29aba3[_0xe272('0x31')]['filter']+'%'};return _0x577810;}})});}_0xbec8ba=_[_0xe272('0x40')]({},_0xbec8ba,_0x29aba3['options']);var _0x217cb4={'where':_0xbec8ba[_0xe272('0x3b')]};return db[_0xe272('0x41')][_0xe272('0x1d')](_0x217cb4)['then'](function(_0x38d687){_0x3ed7e6[_0xe272('0x1d')]=_0x38d687;if(_0x29aba3['query']['includeAll']){_0xbec8ba[_0xe272('0x42')]=[{'all':!![]}];}return db[_0xe272('0x41')][_0xe272('0x43')](_0xbec8ba);})[_0xe272('0x24')](function(_0x782bef){_0x3ed7e6[_0xe272('0x44')]=_0x782bef;return _0x3ed7e6;})[_0xe272('0x24')](respondWithFilteredResult(_0x1022d2,_0xbec8ba))[_0xe272('0x45')](handleError(_0x1022d2,null));};exports[_0xe272('0x46')]=function(_0x4df05a,_0x4d8fdb){var _0x474b20={'raw':!![],'where':{'id':_0x4df05a[_0xe272('0x47')]['id']}},_0x45c049={};_0x45c049['model']=_['keys'](db['SmsQueueReport'][_0xe272('0x2c')]);_0x45c049[_0xe272('0x31')]=_[_0xe272('0x30')](_0x4df05a[_0xe272('0x31')]);_0x45c049[_0xe272('0x32')]=_[_0xe272('0x33')](_0x45c049['model'],_0x45c049[_0xe272('0x31')]);_0x474b20['attributes']=_[_0xe272('0x33')](_0x45c049[_0xe272('0x2f')],qs['fields'](_0x4df05a['query'][_0xe272('0x34')]));_0x474b20[_0xe272('0x35')]=_0x474b20[_0xe272('0x35')][_0xe272('0x36')]?_0x474b20['attributes']:_0x45c049['model'];if(_0x4df05a[_0xe272('0x31')][_0xe272('0x48')]){_0x474b20[_0xe272('0x42')]=[{'all':!![]}];}_0x474b20=_[_0xe272('0x40')]({},_0x474b20,_0x4df05a[_0xe272('0x49')]);return db[_0xe272('0x41')][_0xe272('0x4a')](_0x474b20)[_0xe272('0x24')](handleEntityNotFound(_0x4d8fdb,null))[_0xe272('0x24')](respondWithResult(_0x4d8fdb,null))[_0xe272('0x45')](handleError(_0x4d8fdb,null));};exports[_0xe272('0x4b')]=function(_0x249c06,_0x74bcb0){return db[_0xe272('0x41')][_0xe272('0x4b')](_0x249c06[_0xe272('0x4c')],{})[_0xe272('0x24')](respondWithResult(_0x74bcb0,0xc9))['catch'](handleError(_0x74bcb0,null));};exports[_0xe272('0x23')]=function(_0x218112,_0x17430d){if(_0x218112['body']['id']){delete _0x218112[_0xe272('0x4c')]['id'];}return db[_0xe272('0x41')][_0xe272('0x4a')]({'where':{'id':_0x218112['params']['id']}})[_0xe272('0x24')](handleEntityNotFound(_0x17430d,null))[_0xe272('0x24')](saveUpdates(_0x218112['body'],null))[_0xe272('0x24')](respondWithResult(_0x17430d,null))[_0xe272('0x45')](handleError(_0x17430d,null));};exports[_0xe272('0x25')]=function(_0x2646a8,_0x2de927){return db[_0xe272('0x41')][_0xe272('0x4a')]({'where':{'id':_0x2646a8[_0xe272('0x47')]['id']}})['then'](handleEntityNotFound(_0x2de927,null))['then'](removeEntity(_0x2de927,null))[_0xe272('0x45')](handleError(_0x2de927,null));};exports[_0xe272('0x4d')]=function(_0x39f7d4,_0x477d6c){return db['SmsQueueReport']['describe']()[_0xe272('0x24')](respondWithResult(_0x477d6c,null))['catch'](handleError(_0x477d6c,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 30d7899..5edf579 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['define','SmsQueueReport','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0a9e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x172298,_0x542449){var _0x44856d=function(_0xa648ba){while(--_0xa648ba){_0x172298['push'](_0x172298['shift']());}};_0x44856d(++_0x542449);}(_0xe706,0xa3));var _0x6e70=function(_0x4788ca,_0x5cda70){_0x4788ca=_0x4788ca-0x0;var _0x28a6f5=_0xe706[_0x4788ca];return _0x28a6f5;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index fdacdc0..f0e0f12 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 _0x642b=['options','info','CreateSmsQueueReport','catch','UpdateSmsQueueReport','raw','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SmsQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','SmsQueueReport','create'];(function(_0xb74c98,_0xa8b9c6){var _0x3d6525=function(_0x47a5fa){while(--_0x47a5fa){_0xb74c98['push'](_0xb74c98['shift']());}};_0x3d6525(++_0xa8b9c6);}(_0x642b,0xef));var _0xb642=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x642b[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0xb642('0x0'));var util=require(_0xb642('0x1'));var moment=require(_0xb642('0x2'));var BPromise=require(_0xb642('0x3'));var rs=require(_0xb642('0x4'));var fs=require('fs');var Redis=require(_0xb642('0x5'));var db=require(_0xb642('0x6'))['db'];var utils=require(_0xb642('0x7'));var logger=require(_0xb642('0x8'))(_0xb642('0x9'));var config=require(_0xb642('0xa'));var jayson=require(_0xb642('0xb'));var client=jayson[_0xb642('0xc')][_0xb642('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x406b26,_0x4ec2ff,_0x38aad1){return new BPromise(function(_0x2907d4,_0x575d8d){return client[_0xb642('0xe')](_0x406b26,_0x38aad1)[_0xb642('0xf')](function(_0x1ac0f2){logger['info'](_0xb642('0x10'),_0x4ec2ff,'request\x20sent');logger[_0xb642('0x11')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x4ec2ff,_0xb642('0x12'),JSON[_0xb642('0x13')](_0x1ac0f2));if(_0x1ac0f2[_0xb642('0x14')]){if(_0x1ac0f2['error'][_0xb642('0x15')]===0x1f4){logger['error'](_0xb642('0x10'),_0x4ec2ff,_0x1ac0f2[_0xb642('0x14')]['message']);return _0x575d8d(_0x1ac0f2[_0xb642('0x14')][_0xb642('0x16')]);}logger[_0xb642('0x14')](_0xb642('0x10'),_0x4ec2ff,_0x1ac0f2[_0xb642('0x14')][_0xb642('0x16')]);return _0x2907d4(_0x1ac0f2[_0xb642('0x14')][_0xb642('0x16')]);}else{logger['info'](_0xb642('0x10'),_0x4ec2ff,_0xb642('0x12'));_0x2907d4(_0x1ac0f2['result']['message']);}})['catch'](function(_0x34416c){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x4ec2ff,_0x34416c);_0x575d8d(_0x34416c);});});}exports['CreateSmsQueueReport']=function(_0xbe372e){var _0x25ab17=this;return new Promise(function(_0x2e8563,_0xcb9057){return db[_0xb642('0x17')][_0xb642('0x18')](_0xbe372e['body'],{'raw':_0xbe372e[_0xb642('0x19')]?_0xbe372e['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x544244){logger[_0xb642('0x1a')](_0xb642('0x1b'),_0xbe372e);logger[_0xb642('0x11')]('CreateSmsQueueReport',_0xbe372e,JSON[_0xb642('0x13')](_0x544244));_0x2e8563(_0x544244);})[_0xb642('0x1c')](function(_0x1080fe){logger[_0xb642('0x14')]('CreateSmsQueueReport',_0x1080fe['message'],_0xbe372e);_0xcb9057(_0x25ab17[_0xb642('0x14')](0x1f4,_0x1080fe['message']));});});};exports[_0xb642('0x1d')]=function(_0xb5f595){var _0x1d53f7=this;return new Promise(function(_0x35f704,_0xa79b31){return db[_0xb642('0x17')]['update'](_0xb5f595['body'],{'raw':_0xb5f595[_0xb642('0x19')]?_0xb5f595['options'][_0xb642('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb5f595['options']?_0xb5f595[_0xb642('0x19')][_0xb642('0x1f')]||null:null,'attributes':_0xb5f595['options']?_0xb5f595[_0xb642('0x19')]['attributes']||null:null,'limit':_0xb5f595[_0xb642('0x19')]?_0xb5f595['options'][_0xb642('0x20')]||null:null})[_0xb642('0xf')](function(_0x50fc45){logger[_0xb642('0x1a')]('UpdateSmsQueueReport',_0xb5f595);logger[_0xb642('0x11')](_0xb642('0x1d'),_0xb5f595,JSON[_0xb642('0x13')](_0x50fc45));_0x35f704(_0x50fc45);})[_0xb642('0x1c')](function(_0x41aabb){logger[_0xb642('0x14')]('UpdateSmsQueueReport',_0x41aabb[_0xb642('0x16')],_0xb5f595);_0xa79b31(_0x1d53f7[_0xb642('0x14')](0x1f4,_0x41aabb[_0xb642('0x16')]));});});}; \ No newline at end of file +var _0xee91=['info','SmsQueueReport','where','attributes','UpdateSmsQueueReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateSmsQueueReport','create','body','options','raw'];(function(_0x48ac5b,_0x35e340){var _0x557609=function(_0x53036f){while(--_0x53036f){_0x48ac5b['push'](_0x48ac5b['shift']());}};_0x557609(++_0x35e340);}(_0xee91,0x198));var _0x1ee9=function(_0x2eb034,_0x52f134){_0x2eb034=_0x2eb034-0x0;var _0x1a2d29=_0xee91[_0x2eb034];return _0x1a2d29;};'use strict';var _=require(_0x1ee9('0x0'));var util=require(_0x1ee9('0x1'));var moment=require(_0x1ee9('0x2'));var BPromise=require(_0x1ee9('0x3'));var rs=require(_0x1ee9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1ee9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1ee9('0x6'))(_0x1ee9('0x7'));var config=require(_0x1ee9('0x8'));var jayson=require(_0x1ee9('0x9'));var client=jayson[_0x1ee9('0xa')][_0x1ee9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x223da4,_0x2aee09,_0x2c8d7c){return new BPromise(function(_0x50f616,_0x42526c){return client['request'](_0x223da4,_0x2c8d7c)[_0x1ee9('0xc')](function(_0x35bb40){logger['info'](_0x1ee9('0xd'),_0x2aee09,_0x1ee9('0xe'));logger[_0x1ee9('0xf')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x2aee09,_0x1ee9('0xe'),JSON[_0x1ee9('0x10')](_0x35bb40));if(_0x35bb40[_0x1ee9('0x11')]){if(_0x35bb40[_0x1ee9('0x11')][_0x1ee9('0x12')]===0x1f4){logger[_0x1ee9('0x11')](_0x1ee9('0xd'),_0x2aee09,_0x35bb40[_0x1ee9('0x11')][_0x1ee9('0x13')]);return _0x42526c(_0x35bb40[_0x1ee9('0x11')][_0x1ee9('0x13')]);}logger[_0x1ee9('0x11')](_0x1ee9('0xd'),_0x2aee09,_0x35bb40[_0x1ee9('0x11')]['message']);return _0x50f616(_0x35bb40[_0x1ee9('0x11')][_0x1ee9('0x13')]);}else{logger['info'](_0x1ee9('0xd'),_0x2aee09,_0x1ee9('0xe'));_0x50f616(_0x35bb40['result'][_0x1ee9('0x13')]);}})[_0x1ee9('0x14')](function(_0x245295){logger[_0x1ee9('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x2aee09,_0x245295);_0x42526c(_0x245295);});});}exports[_0x1ee9('0x15')]=function(_0x115415){var _0x198539=this;return new Promise(function(_0x320468,_0xf57521){return db['SmsQueueReport'][_0x1ee9('0x16')](_0x115415[_0x1ee9('0x17')],{'raw':_0x115415[_0x1ee9('0x18')]?_0x115415[_0x1ee9('0x18')][_0x1ee9('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x50b448){logger[_0x1ee9('0x1a')](_0x1ee9('0x15'),_0x115415);logger[_0x1ee9('0xf')](_0x1ee9('0x15'),_0x115415,JSON['stringify'](_0x50b448));_0x320468(_0x50b448);})[_0x1ee9('0x14')](function(_0x2173d7){logger[_0x1ee9('0x11')]('CreateSmsQueueReport',_0x2173d7[_0x1ee9('0x13')],_0x115415);_0xf57521(_0x198539[_0x1ee9('0x11')](0x1f4,_0x2173d7[_0x1ee9('0x13')]));});});};exports['UpdateSmsQueueReport']=function(_0x4af197){var _0x2126ea=this;return new Promise(function(_0x1fd3c5,_0x44ea90){return db[_0x1ee9('0x1b')]['update'](_0x4af197[_0x1ee9('0x17')],{'raw':_0x4af197[_0x1ee9('0x18')]?_0x4af197[_0x1ee9('0x18')][_0x1ee9('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4af197[_0x1ee9('0x18')]?_0x4af197['options'][_0x1ee9('0x1c')]||null:null,'attributes':_0x4af197['options']?_0x4af197[_0x1ee9('0x18')][_0x1ee9('0x1d')]||null:null,'limit':_0x4af197[_0x1ee9('0x18')]?_0x4af197[_0x1ee9('0x18')]['limit']||null:null})['then'](function(_0x418be6){logger[_0x1ee9('0x1a')](_0x1ee9('0x1e'),_0x4af197);logger['debug']('UpdateSmsQueueReport',_0x4af197,JSON[_0x1ee9('0x10')](_0x418be6));_0x1fd3c5(_0x418be6);})[_0x1ee9('0x14')](function(_0x3099d5){logger[_0x1ee9('0x11')](_0x1ee9('0x1e'),_0x3099d5[_0x1ee9('0x13')],_0x4af197);_0x44ea90(_0x2126ea['error'](0x1f4,_0x3099d5[_0x1ee9('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index c2a2570..4986a22 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 _0xbd50=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','/:id','show','create','delete','exports','multer','util'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xbd50,0x196));var _0x0bd5=function(_0xb83a1e,_0x375442){_0xb83a1e=_0xb83a1e-0x0;var _0x582a5b=_0xbd50[_0xb83a1e];return _0x582a5b;};'use strict';var multer=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var path=require(_0x0bd5('0x2'));var timeout=require('connect-timeout');var express=require(_0x0bd5('0x3'));var router=express[_0x0bd5('0x4')]();var fs_extra=require(_0x0bd5('0x5'));var auth=require(_0x0bd5('0x6'));var interaction=require(_0x0bd5('0x7'));var config=require('../../config/environment');var controller=require('./smsTransferReport.controller');router['get']('/',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x9')]);router[_0x0bd5('0xa')](_0x0bd5('0xb'),auth[_0x0bd5('0x8')](),controller['describe']);router['get'](_0x0bd5('0xc'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0xd')]);router['post']('/',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0xe')]);router['put'](_0x0bd5('0xc'),auth[_0x0bd5('0x8')](),controller['update']);router[_0x0bd5('0xf')](_0x0bd5('0xc'),auth[_0x0bd5('0x8')](),controller['destroy']);module[_0x0bd5('0x10')]=router; \ No newline at end of file +var _0x2eb2=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','delete'];(function(_0x26b2db,_0x46dcb4){var _0x5eb8ed=function(_0x2a9ef8){while(--_0x2a9ef8){_0x26b2db['push'](_0x26b2db['shift']());}};_0x5eb8ed(++_0x46dcb4);}(_0x2eb2,0x19f));var _0x22eb=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0x2eb2[_0x1b349a];return _0x5d1f7c;};'use strict';var multer=require('multer');var util=require(_0x22eb('0x0'));var path=require(_0x22eb('0x1'));var timeout=require(_0x22eb('0x2'));var express=require(_0x22eb('0x3'));var router=express[_0x22eb('0x4')]();var fs_extra=require(_0x22eb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x22eb('0x6'));var config=require('../../config/environment');var controller=require('./smsTransferReport.controller');router[_0x22eb('0x7')]('/',auth[_0x22eb('0x8')](),controller[_0x22eb('0x9')]);router[_0x22eb('0x7')](_0x22eb('0xa'),auth[_0x22eb('0x8')](),controller[_0x22eb('0xb')]);router[_0x22eb('0x7')](_0x22eb('0xc'),auth[_0x22eb('0x8')](),controller[_0x22eb('0xd')]);router[_0x22eb('0xe')]('/',auth['isAuthenticated'](),controller[_0x22eb('0xf')]);router['put']('/:id',auth[_0x22eb('0x8')](),controller['update']);router[_0x22eb('0x10')](_0x22eb('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x22eb('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index e425af4..f2716c1 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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x1ae78d,_0xd76e1d){var _0x32cb73=function(_0x1e0fd9){while(--_0x1e0fd9){_0x1ae78d['push'](_0x1ae78d['shift']());}};_0x32cb73(++_0xd76e1d);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x34df4a,_0x209d10){_0x34df4a=_0x34df4a-0x0;var _0x145c69=_0xcb91[_0x34df4a];return _0x145c69;};'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 +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x6c59fc,_0x5fe88d){var _0x17c96f=function(_0x5a6c82){while(--_0x5a6c82){_0x6c59fc['push'](_0x6c59fc['shift']());}};_0x17c96f(++_0x5fe88d);}(_0x9c44,0x178));var _0x49c4=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x9c44[_0xb0f7c3];return _0x28ea68;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 317b139..61126df 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 _0xfb36=['Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','SmsTransferReport','fieldName','type','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','rawAttributes','keys','find','catch','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','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','status','end','json','offset','limit','undefined','count','set'];(function(_0x343a09,_0x4d70c0){var _0x41f2ec=function(_0x2fd31e){while(--_0x2fd31e){_0x343a09['push'](_0x343a09['shift']());}};_0x41f2ec(++_0x4d70c0);}(_0xfb36,0xc9));var _0x6fb3=function(_0x4a5749,_0x5ad806){_0x4a5749=_0x4a5749-0x0;var _0x1a7fdd=_0xfb36[_0x4a5749];return _0x1a7fdd;};'use strict';var emlformat=require(_0x6fb3('0x0'));var rimraf=require(_0x6fb3('0x1'));var zipdir=require(_0x6fb3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6fb3('0x3'));var moment=require(_0x6fb3('0x4'));var BPromise=require(_0x6fb3('0x5'));var Mustache=require(_0x6fb3('0x6'));var util=require(_0x6fb3('0x7'));var path=require('path');var sox=require(_0x6fb3('0x8'));var csv=require('to-csv');var ejs=require(_0x6fb3('0x9'));var fs=require('fs');var fs_extra=require(_0x6fb3('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6fb3('0xb'));var jsforce=require(_0x6fb3('0xc'));var deskjs=require(_0x6fb3('0xd'));var toCsv=require(_0x6fb3('0xe'));var querystring=require(_0x6fb3('0xf'));var Papa=require('papaparse');var Redis=require(_0x6fb3('0x10'));var authService=require(_0x6fb3('0x11'));var qs=require(_0x6fb3('0x12'));var as=require(_0x6fb3('0x13'));var hardwareService=require(_0x6fb3('0x14'));var logger=require(_0x6fb3('0x15'))(_0x6fb3('0x16'));var utils=require(_0x6fb3('0x17'));var config=require(_0x6fb3('0x18'));var licenseUtil=require(_0x6fb3('0x19'));var db=require(_0x6fb3('0x1a'))['db'];function respondWithStatusCode(_0x59ec54,_0x850a74){_0x850a74=_0x850a74||0xcc;return function(_0x5f9b2b){if(_0x5f9b2b){return _0x59ec54[_0x6fb3('0x1b')](_0x850a74);}return _0x59ec54[_0x6fb3('0x1c')](_0x850a74)[_0x6fb3('0x1d')]();};}function respondWithResult(_0x4d7f2b,_0x42d041){_0x42d041=_0x42d041||0xc8;return function(_0x4a7e9a){if(_0x4a7e9a){return _0x4d7f2b[_0x6fb3('0x1c')](_0x42d041)[_0x6fb3('0x1e')](_0x4a7e9a);}};}function respondWithFilteredResult(_0x17a3d1,_0x2f66e1){return function(_0x3ee684){if(_0x3ee684){var _0x591078=typeof _0x2f66e1[_0x6fb3('0x1f')]==='undefined'&&typeof _0x2f66e1[_0x6fb3('0x20')]===_0x6fb3('0x21');var _0x160797=_0x3ee684[_0x6fb3('0x22')];var _0x13f1b1=_0x591078?0x0:_0x2f66e1[_0x6fb3('0x1f')];var _0x358d27=_0x591078?_0x3ee684['count']:_0x2f66e1['offset']+_0x2f66e1['limit'];var _0x1fbb4d;if(_0x358d27>=_0x160797){_0x358d27=_0x160797;_0x1fbb4d=0xc8;}else{_0x1fbb4d=0xce;}_0x17a3d1[_0x6fb3('0x1c')](_0x1fbb4d);return _0x17a3d1[_0x6fb3('0x23')](_0x6fb3('0x24'),_0x13f1b1+'-'+_0x358d27+'/'+_0x160797)[_0x6fb3('0x1e')](_0x3ee684);}return null;};}function patchUpdates(_0x580e6c){return function(_0x9b77df){try{jsonpatch[_0x6fb3('0x25')](_0x9b77df,_0x580e6c,!![]);}catch(_0x54b17c){return BPromise[_0x6fb3('0x26')](_0x54b17c);}return _0x9b77df[_0x6fb3('0x27')]();};}function saveUpdates(_0x357955,_0x212cab){return function(_0x4a3001){if(_0x4a3001){return _0x4a3001[_0x6fb3('0x28')](_0x357955)[_0x6fb3('0x29')](function(_0x3e9013){return _0x3e9013;});}return null;};}function removeEntity(_0x5bbf2e,_0x6dc3f0){return function(_0xc66d69){if(_0xc66d69){return _0xc66d69[_0x6fb3('0x2a')]()[_0x6fb3('0x29')](function(){_0x5bbf2e['status'](0xcc)[_0x6fb3('0x1d')]();});}};}function handleEntityNotFound(_0x10088a,_0x31e2f9){return function(_0x467c6c){if(!_0x467c6c){_0x10088a['sendStatus'](0x194);}return _0x467c6c;};}function handleError(_0x253198,_0x42c74f){_0x42c74f=_0x42c74f||0x1f4;return function(_0x5ac133){logger[_0x6fb3('0x2b')](_0x5ac133[_0x6fb3('0x2c')]);if(_0x5ac133[_0x6fb3('0x2d')]){delete _0x5ac133[_0x6fb3('0x2d')];}_0x253198[_0x6fb3('0x1c')](_0x42c74f)[_0x6fb3('0x2e')](_0x5ac133);};}exports[_0x6fb3('0x2f')]=function(_0xfc94e9,_0x5cdbaa){var _0x522360={},_0x5e6b7e={},_0x36d764={'count':0x0,'rows':[]};var _0x2fc714=_['map'](db[_0x6fb3('0x30')]['rawAttributes'],function(_0x358cf0){return{'name':_0x358cf0[_0x6fb3('0x31')],'type':_0x358cf0[_0x6fb3('0x32')]['key']};});_0x5e6b7e[_0x6fb3('0x33')]=_['map'](_0x2fc714,_0x6fb3('0x2d'));_0x5e6b7e[_0x6fb3('0x34')]=_['keys'](_0xfc94e9[_0x6fb3('0x34')]);_0x5e6b7e[_0x6fb3('0x35')]=_['intersection'](_0x5e6b7e[_0x6fb3('0x33')],_0x5e6b7e[_0x6fb3('0x34')]);_0x522360[_0x6fb3('0x36')]=_[_0x6fb3('0x37')](_0x5e6b7e[_0x6fb3('0x33')],qs[_0x6fb3('0x38')](_0xfc94e9[_0x6fb3('0x34')][_0x6fb3('0x38')]));_0x522360[_0x6fb3('0x36')]=_0x522360['attributes'][_0x6fb3('0x39')]?_0x522360[_0x6fb3('0x36')]:_0x5e6b7e['model'];if(!_0xfc94e9['query']['hasOwnProperty'](_0x6fb3('0x3a'))){_0x522360[_0x6fb3('0x20')]=qs[_0x6fb3('0x20')](_0xfc94e9[_0x6fb3('0x34')][_0x6fb3('0x20')]);_0x522360['offset']=qs[_0x6fb3('0x1f')](_0xfc94e9[_0x6fb3('0x34')][_0x6fb3('0x1f')]);}_0x522360[_0x6fb3('0x3b')]=qs['sort'](_0xfc94e9[_0x6fb3('0x34')][_0x6fb3('0x3c')]);_0x522360[_0x6fb3('0x3d')]=qs[_0x6fb3('0x35')](_[_0x6fb3('0x3e')](_0xfc94e9[_0x6fb3('0x34')],_0x5e6b7e[_0x6fb3('0x35')]),_0x2fc714);if(_0xfc94e9[_0x6fb3('0x34')]['filter']){_0x522360[_0x6fb3('0x3d')]=_[_0x6fb3('0x3f')](_0x522360[_0x6fb3('0x3d')],{'$or':_[_0x6fb3('0x40')](_0x2fc714,function(_0x212461){if(_0x212461[_0x6fb3('0x32')]!==_0x6fb3('0x41')){var _0x535799={};_0x535799[_0x212461[_0x6fb3('0x2d')]]={'$like':'%'+_0xfc94e9[_0x6fb3('0x34')][_0x6fb3('0x42')]+'%'};return _0x535799;}})});}_0x522360=_[_0x6fb3('0x3f')]({},_0x522360,_0xfc94e9[_0x6fb3('0x43')]);var _0x40e63d={'where':_0x522360[_0x6fb3('0x3d')]};return db[_0x6fb3('0x30')][_0x6fb3('0x22')](_0x40e63d)[_0x6fb3('0x29')](function(_0x5c1602){_0x36d764[_0x6fb3('0x22')]=_0x5c1602;if(_0xfc94e9[_0x6fb3('0x34')][_0x6fb3('0x44')]){_0x522360[_0x6fb3('0x45')]=[{'all':!![]}];}return db['SmsTransferReport'][_0x6fb3('0x46')](_0x522360);})[_0x6fb3('0x29')](function(_0x19bfcf){_0x36d764[_0x6fb3('0x47')]=_0x19bfcf;return _0x36d764;})[_0x6fb3('0x29')](respondWithFilteredResult(_0x5cdbaa,_0x522360))['catch'](handleError(_0x5cdbaa,null));};exports['show']=function(_0x293ebd,_0x3b5db3){var _0x10e439={'raw':!![],'where':{'id':_0x293ebd[_0x6fb3('0x48')]['id']}},_0x34a153={};_0x34a153[_0x6fb3('0x33')]=_['keys'](db[_0x6fb3('0x30')][_0x6fb3('0x49')]);_0x34a153[_0x6fb3('0x34')]=_[_0x6fb3('0x4a')](_0x293ebd[_0x6fb3('0x34')]);_0x34a153[_0x6fb3('0x35')]=_[_0x6fb3('0x37')](_0x34a153[_0x6fb3('0x33')],_0x34a153[_0x6fb3('0x34')]);_0x10e439['attributes']=_['intersection'](_0x34a153[_0x6fb3('0x33')],qs[_0x6fb3('0x38')](_0x293ebd[_0x6fb3('0x34')][_0x6fb3('0x38')]));_0x10e439[_0x6fb3('0x36')]=_0x10e439[_0x6fb3('0x36')][_0x6fb3('0x39')]?_0x10e439[_0x6fb3('0x36')]:_0x34a153[_0x6fb3('0x33')];if(_0x293ebd[_0x6fb3('0x34')][_0x6fb3('0x44')]){_0x10e439[_0x6fb3('0x45')]=[{'all':!![]}];}_0x10e439=_[_0x6fb3('0x3f')]({},_0x10e439,_0x293ebd['options']);return db['SmsTransferReport'][_0x6fb3('0x4b')](_0x10e439)[_0x6fb3('0x29')](handleEntityNotFound(_0x3b5db3,null))[_0x6fb3('0x29')](respondWithResult(_0x3b5db3,null))[_0x6fb3('0x4c')](handleError(_0x3b5db3,null));};exports['create']=function(_0x4a778f,_0xe20785){return db[_0x6fb3('0x30')]['create'](_0x4a778f[_0x6fb3('0x4d')],{})['then'](respondWithResult(_0xe20785,0xc9))[_0x6fb3('0x4c')](handleError(_0xe20785,null));};exports[_0x6fb3('0x28')]=function(_0x411b4a,_0x409620){if(_0x411b4a[_0x6fb3('0x4d')]['id']){delete _0x411b4a['body']['id'];}return db[_0x6fb3('0x30')][_0x6fb3('0x4b')]({'where':{'id':_0x411b4a[_0x6fb3('0x48')]['id']}})[_0x6fb3('0x29')](handleEntityNotFound(_0x409620,null))[_0x6fb3('0x29')](saveUpdates(_0x411b4a[_0x6fb3('0x4d')],null))[_0x6fb3('0x29')](respondWithResult(_0x409620,null))['catch'](handleError(_0x409620,null));};exports[_0x6fb3('0x2a')]=function(_0x3a6012,_0x44fc88){return db[_0x6fb3('0x30')][_0x6fb3('0x4b')]({'where':{'id':_0x3a6012[_0x6fb3('0x48')]['id']}})['then'](handleEntityNotFound(_0x44fc88,null))[_0x6fb3('0x29')](removeEntity(_0x44fc88,null))['catch'](handleError(_0x44fc88,null));};exports[_0x6fb3('0x4e')]=function(_0x44f054,_0x478ffa){return db['SmsTransferReport']['describe']()[_0x6fb3('0x29')](respondWithResult(_0x478ffa,null))[_0x6fb3('0x4c')](handleError(_0x478ffa,null));}; \ No newline at end of file +var _0x1e68=['mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','SmsTransferReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','options','includeAll','findAll','catch','show','include','find','create','body','params','describe','rimraf','zip-dir','moment','bluebird'];(function(_0x8162aa,_0x184ded){var _0x51f45b=function(_0x3b1620){while(--_0x3b1620){_0x8162aa['push'](_0x8162aa['shift']());}};_0x51f45b(++_0x184ded);}(_0x1e68,0xd1));var _0x81e6=function(_0x2500e5,_0x5090b4){_0x2500e5=_0x2500e5-0x0;var _0x305619=_0x1e68[_0x2500e5];return _0x305619;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x81e6('0x0'));var zipdir=require(_0x81e6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x81e6('0x2'));var BPromise=require(_0x81e6('0x3'));var Mustache=require(_0x81e6('0x4'));var util=require(_0x81e6('0x5'));var path=require('path');var sox=require(_0x81e6('0x6'));var csv=require(_0x81e6('0x7'));var ejs=require(_0x81e6('0x8'));var fs=require('fs');var fs_extra=require(_0x81e6('0x9'));var _=require('lodash');var squel=require(_0x81e6('0xa'));var crypto=require(_0x81e6('0xb'));var jsforce=require(_0x81e6('0xc'));var deskjs=require(_0x81e6('0xd'));var toCsv=require('to-csv');var querystring=require(_0x81e6('0xe'));var Papa=require(_0x81e6('0xf'));var Redis=require(_0x81e6('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x81e6('0x11'));var as=require(_0x81e6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x81e6('0x13'));var utils=require(_0x81e6('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x81e6('0x15'))['db'];function respondWithStatusCode(_0x557fa0,_0x17dc2c){_0x17dc2c=_0x17dc2c||0xcc;return function(_0x3bd381){if(_0x3bd381){return _0x557fa0[_0x81e6('0x16')](_0x17dc2c);}return _0x557fa0[_0x81e6('0x17')](_0x17dc2c)[_0x81e6('0x18')]();};}function respondWithResult(_0x2a07f7,_0x5119a4){_0x5119a4=_0x5119a4||0xc8;return function(_0x52372f){if(_0x52372f){return _0x2a07f7[_0x81e6('0x17')](_0x5119a4)[_0x81e6('0x19')](_0x52372f);}};}function respondWithFilteredResult(_0x5d34ee,_0x1f9983){return function(_0x3dec5f){if(_0x3dec5f){var _0x7e8677=typeof _0x1f9983['offset']===_0x81e6('0x1a')&&typeof _0x1f9983[_0x81e6('0x1b')]==='undefined';var _0x48bc0b=_0x3dec5f[_0x81e6('0x1c')];var _0x5a6d69=_0x7e8677?0x0:_0x1f9983[_0x81e6('0x1d')];var _0xc61a92=_0x7e8677?_0x3dec5f[_0x81e6('0x1c')]:_0x1f9983['offset']+_0x1f9983['limit'];var _0x1281ac;if(_0xc61a92>=_0x48bc0b){_0xc61a92=_0x48bc0b;_0x1281ac=0xc8;}else{_0x1281ac=0xce;}_0x5d34ee['status'](_0x1281ac);return _0x5d34ee[_0x81e6('0x1e')](_0x81e6('0x1f'),_0x5a6d69+'-'+_0xc61a92+'/'+_0x48bc0b)[_0x81e6('0x19')](_0x3dec5f);}return null;};}function patchUpdates(_0x226e4f){return function(_0x49baa5){try{jsonpatch[_0x81e6('0x20')](_0x49baa5,_0x226e4f,!![]);}catch(_0x55d4fb){return BPromise[_0x81e6('0x21')](_0x55d4fb);}return _0x49baa5[_0x81e6('0x22')]();};}function saveUpdates(_0x140026,_0x2ecce5){return function(_0x30b0c7){if(_0x30b0c7){return _0x30b0c7['update'](_0x140026)[_0x81e6('0x23')](function(_0x409fa2){return _0x409fa2;});}return null;};}function removeEntity(_0x319660,_0x15882b){return function(_0x188648){if(_0x188648){return _0x188648[_0x81e6('0x24')]()[_0x81e6('0x23')](function(){_0x319660[_0x81e6('0x17')](0xcc)[_0x81e6('0x18')]();});}};}function handleEntityNotFound(_0x1af7fd,_0x412585){return function(_0x54b9e8){if(!_0x54b9e8){_0x1af7fd[_0x81e6('0x16')](0x194);}return _0x54b9e8;};}function handleError(_0x3773a8,_0x3db496){_0x3db496=_0x3db496||0x1f4;return function(_0x458fcd){logger[_0x81e6('0x25')](_0x458fcd[_0x81e6('0x26')]);if(_0x458fcd[_0x81e6('0x27')]){delete _0x458fcd[_0x81e6('0x27')];}_0x3773a8[_0x81e6('0x17')](_0x3db496)['send'](_0x458fcd);};}exports[_0x81e6('0x28')]=function(_0x17b0ae,_0x2f814f){var _0x502fed={},_0x414190={},_0x37e69c={'count':0x0,'rows':[]};var _0x4209a6=_[_0x81e6('0x29')](db[_0x81e6('0x2a')][_0x81e6('0x2b')],function(_0x40a124){return{'name':_0x40a124[_0x81e6('0x2c')],'type':_0x40a124['type'][_0x81e6('0x2d')]};});_0x414190['model']=_[_0x81e6('0x29')](_0x4209a6,_0x81e6('0x27'));_0x414190[_0x81e6('0x2e')]=_[_0x81e6('0x2f')](_0x17b0ae[_0x81e6('0x2e')]);_0x414190[_0x81e6('0x30')]=_[_0x81e6('0x31')](_0x414190[_0x81e6('0x32')],_0x414190['query']);_0x502fed[_0x81e6('0x33')]=_[_0x81e6('0x31')](_0x414190['model'],qs[_0x81e6('0x34')](_0x17b0ae['query'][_0x81e6('0x34')]));_0x502fed[_0x81e6('0x33')]=_0x502fed[_0x81e6('0x33')][_0x81e6('0x35')]?_0x502fed['attributes']:_0x414190[_0x81e6('0x32')];if(!_0x17b0ae[_0x81e6('0x2e')][_0x81e6('0x36')](_0x81e6('0x37'))){_0x502fed['limit']=qs['limit'](_0x17b0ae[_0x81e6('0x2e')][_0x81e6('0x1b')]);_0x502fed[_0x81e6('0x1d')]=qs['offset'](_0x17b0ae['query'][_0x81e6('0x1d')]);}_0x502fed[_0x81e6('0x38')]=qs['sort'](_0x17b0ae[_0x81e6('0x2e')]['sort']);_0x502fed[_0x81e6('0x39')]=qs[_0x81e6('0x30')](_[_0x81e6('0x3a')](_0x17b0ae[_0x81e6('0x2e')],_0x414190[_0x81e6('0x30')]),_0x4209a6);if(_0x17b0ae[_0x81e6('0x2e')]['filter']){_0x502fed['where']=_['merge'](_0x502fed[_0x81e6('0x39')],{'$or':_[_0x81e6('0x29')](_0x4209a6,function(_0x3b15ab){if(_0x3b15ab['type']!=='VIRTUAL'){var _0xd3bad7={};_0xd3bad7[_0x3b15ab[_0x81e6('0x27')]]={'$like':'%'+_0x17b0ae['query']['filter']+'%'};return _0xd3bad7;}})});}_0x502fed=_[_0x81e6('0x3b')]({},_0x502fed,_0x17b0ae[_0x81e6('0x3c')]);var _0x4a1bb1={'where':_0x502fed[_0x81e6('0x39')]};return db[_0x81e6('0x2a')][_0x81e6('0x1c')](_0x4a1bb1)['then'](function(_0x990f72){_0x37e69c[_0x81e6('0x1c')]=_0x990f72;if(_0x17b0ae['query'][_0x81e6('0x3d')]){_0x502fed['include']=[{'all':!![]}];}return db[_0x81e6('0x2a')][_0x81e6('0x3e')](_0x502fed);})[_0x81e6('0x23')](function(_0x1750e8){_0x37e69c['rows']=_0x1750e8;return _0x37e69c;})[_0x81e6('0x23')](respondWithFilteredResult(_0x2f814f,_0x502fed))[_0x81e6('0x3f')](handleError(_0x2f814f,null));};exports[_0x81e6('0x40')]=function(_0x3b5e71,_0x1088fd){var _0x5067ef={'raw':!![],'where':{'id':_0x3b5e71['params']['id']}},_0x35cfe4={};_0x35cfe4[_0x81e6('0x32')]=_[_0x81e6('0x2f')](db[_0x81e6('0x2a')][_0x81e6('0x2b')]);_0x35cfe4[_0x81e6('0x2e')]=_[_0x81e6('0x2f')](_0x3b5e71[_0x81e6('0x2e')]);_0x35cfe4[_0x81e6('0x30')]=_[_0x81e6('0x31')](_0x35cfe4[_0x81e6('0x32')],_0x35cfe4[_0x81e6('0x2e')]);_0x5067ef[_0x81e6('0x33')]=_[_0x81e6('0x31')](_0x35cfe4[_0x81e6('0x32')],qs[_0x81e6('0x34')](_0x3b5e71[_0x81e6('0x2e')][_0x81e6('0x34')]));_0x5067ef[_0x81e6('0x33')]=_0x5067ef[_0x81e6('0x33')]['length']?_0x5067ef[_0x81e6('0x33')]:_0x35cfe4[_0x81e6('0x32')];if(_0x3b5e71[_0x81e6('0x2e')][_0x81e6('0x3d')]){_0x5067ef[_0x81e6('0x41')]=[{'all':!![]}];}_0x5067ef=_[_0x81e6('0x3b')]({},_0x5067ef,_0x3b5e71[_0x81e6('0x3c')]);return db[_0x81e6('0x2a')][_0x81e6('0x42')](_0x5067ef)['then'](handleEntityNotFound(_0x1088fd,null))[_0x81e6('0x23')](respondWithResult(_0x1088fd,null))['catch'](handleError(_0x1088fd,null));};exports['create']=function(_0x5877a7,_0x4c4afa){return db[_0x81e6('0x2a')][_0x81e6('0x43')](_0x5877a7[_0x81e6('0x44')],{})[_0x81e6('0x23')](respondWithResult(_0x4c4afa,0xc9))[_0x81e6('0x3f')](handleError(_0x4c4afa,null));};exports['update']=function(_0x43c71c,_0x5b9e4f){if(_0x43c71c[_0x81e6('0x44')]['id']){delete _0x43c71c[_0x81e6('0x44')]['id'];}return db[_0x81e6('0x2a')]['find']({'where':{'id':_0x43c71c[_0x81e6('0x45')]['id']}})[_0x81e6('0x23')](handleEntityNotFound(_0x5b9e4f,null))[_0x81e6('0x23')](saveUpdates(_0x43c71c[_0x81e6('0x44')],null))['then'](respondWithResult(_0x5b9e4f,null))[_0x81e6('0x3f')](handleError(_0x5b9e4f,null));};exports[_0x81e6('0x24')]=function(_0x49afb5,_0x5af4bb){return db[_0x81e6('0x2a')]['find']({'where':{'id':_0x49afb5[_0x81e6('0x45')]['id']}})[_0x81e6('0x23')](handleEntityNotFound(_0x5af4bb,null))[_0x81e6('0x23')](removeEntity(_0x5af4bb,null))[_0x81e6('0x3f')](handleError(_0x5af4bb,null));};exports[_0x81e6('0x46')]=function(_0x4ee7bb,_0x2fe391){return db[_0x81e6('0x2a')][_0x81e6('0x46')]()[_0x81e6('0x23')](respondWithResult(_0x2fe391,null))[_0x81e6('0x3f')](handleError(_0x2fe391,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 3ff60de..958c856 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 _0xb7dc=['util','../../config/logger','api','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','lodash'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0xb7dc,0xf9));var _0xcb7d=function(_0x3c7ac2,_0x5c309f){_0x3c7ac2=_0x3c7ac2-0x0;var _0x4d5bb3=_0xb7dc[_0x3c7ac2];return _0x4d5bb3;};'use strict';var _=require(_0xcb7d('0x0'));var util=require(_0xcb7d('0x1'));var logger=require(_0xcb7d('0x2'))(_0xcb7d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcb7d('0x4'));var rimraf=require(_0xcb7d('0x5'));var config=require(_0xcb7d('0x6'));var attributes=require(_0xcb7d('0x7'));module[_0xcb7d('0x8')]=function(_0x31e472,_0xab9d84){return _0x31e472[_0xcb7d('0x9')]('SmsTransferReport',attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4d9e=['rimraf','./smsTransferReport.attributes','exports','define','SmsTransferReport','uniqueid','lodash','api','bluebird','path'];(function(_0x42265f,_0x3537f8){var _0x125660=function(_0xe24f8c){while(--_0xe24f8c){_0x42265f['push'](_0x42265f['shift']());}};_0x125660(++_0x3537f8);}(_0x4d9e,0x18c));var _0xe4d9=function(_0x463ff3,_0x3ccd7e){_0x463ff3=_0x463ff3-0x0;var _0x409d33=_0x4d9e[_0x463ff3];return _0x409d33;};'use strict';var _=require(_0xe4d9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe4d9('0x1'));var moment=require('moment');var BPromise=require(_0xe4d9('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe4d9('0x3'));var rimraf=require(_0xe4d9('0x4'));var config=require('../../config/environment');var attributes=require(_0xe4d9('0x5'));module[_0xe4d9('0x6')]=function(_0x278035,_0x34c2a2){return _0x278035[_0xe4d9('0x7')](_0xe4d9('0x8'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xe4d9('0x9'),'fields':[_0xe4d9('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index d851a09..7e40c8b 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 _0xb6f1=['debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x4cefc3,_0x23f291){var _0x1cc779=function(_0x7cb914){while(--_0x7cb914){_0x4cefc3['push'](_0x4cefc3['shift']());}};_0x1cc779(++_0x23f291);}(_0xb6f1,0x118));var _0x1b6f=function(_0xce9195,_0x1963e1){_0xce9195=_0xce9195-0x0;var _0x530fe6=_0xb6f1[_0xce9195];return _0x530fe6;};'use strict';var _=require(_0x1b6f('0x0'));var util=require('util');var moment=require(_0x1b6f('0x1'));var BPromise=require('bluebird');var rs=require(_0x1b6f('0x2'));var fs=require('fs');var Redis=require(_0x1b6f('0x3'));var db=require(_0x1b6f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1b6f('0x5'))('rpc');var config=require(_0x1b6f('0x6'));var jayson=require(_0x1b6f('0x7'));var client=jayson[_0x1b6f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x496b52,_0xe05935,_0x7b27f5){return new BPromise(function(_0x236908,_0x493908){return client[_0x1b6f('0x9')](_0x496b52,_0x7b27f5)[_0x1b6f('0xa')](function(_0x4c4cbf){logger[_0x1b6f('0xb')](_0x1b6f('0xc'),_0xe05935,_0x1b6f('0xd'));logger[_0x1b6f('0xe')](_0x1b6f('0xf'),_0xe05935,_0x1b6f('0xd'),JSON['stringify'](_0x4c4cbf));if(_0x4c4cbf['error']){if(_0x4c4cbf[_0x1b6f('0x10')][_0x1b6f('0x11')]===0x1f4){logger[_0x1b6f('0x10')](_0x1b6f('0xc'),_0xe05935,_0x4c4cbf[_0x1b6f('0x10')][_0x1b6f('0x12')]);return _0x493908(_0x4c4cbf[_0x1b6f('0x10')][_0x1b6f('0x12')]);}logger[_0x1b6f('0x10')](_0x1b6f('0xc'),_0xe05935,_0x4c4cbf[_0x1b6f('0x10')][_0x1b6f('0x12')]);return _0x236908(_0x4c4cbf[_0x1b6f('0x10')][_0x1b6f('0x12')]);}else{logger[_0x1b6f('0xb')](_0x1b6f('0xc'),_0xe05935,_0x1b6f('0xd'));_0x236908(_0x4c4cbf[_0x1b6f('0x13')][_0x1b6f('0x12')]);}})[_0x1b6f('0x14')](function(_0x54eec7){logger['error'](_0x1b6f('0xc'),_0xe05935,_0x54eec7);_0x493908(_0x54eec7);});});} \ No newline at end of file +var _0x9a22=['debug','stringify','error','code','message','SmsTransferReport,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent'];(function(_0x209360,_0x2cd574){var _0x5060cd=function(_0x4fa41c){while(--_0x4fa41c){_0x209360['push'](_0x209360['shift']());}};_0x5060cd(++_0x2cd574);}(_0x9a22,0x75));var _0x29a2=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x9a22[_0x92c450];return _0x2a9599;};'use strict';var _=require(_0x29a2('0x0'));var util=require(_0x29a2('0x1'));var moment=require(_0x29a2('0x2'));var BPromise=require(_0x29a2('0x3'));var rs=require(_0x29a2('0x4'));var fs=require('fs');var Redis=require(_0x29a2('0x5'));var db=require(_0x29a2('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x29a2('0x7'));var config=require(_0x29a2('0x8'));var jayson=require(_0x29a2('0x9'));var client=jayson[_0x29a2('0xa')][_0x29a2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xfb91e8,_0x41ea7c,_0x2887e1){return new BPromise(function(_0x4b55de,_0x2d7d97){return client[_0x29a2('0xc')](_0xfb91e8,_0x2887e1)['then'](function(_0x3d9a5c){logger[_0x29a2('0xd')]('SmsTransferReport,\x20%s,\x20%s',_0x41ea7c,_0x29a2('0xe'));logger[_0x29a2('0xf')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x41ea7c,_0x29a2('0xe'),JSON[_0x29a2('0x10')](_0x3d9a5c));if(_0x3d9a5c[_0x29a2('0x11')]){if(_0x3d9a5c[_0x29a2('0x11')][_0x29a2('0x12')]===0x1f4){logger[_0x29a2('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0x41ea7c,_0x3d9a5c[_0x29a2('0x11')][_0x29a2('0x13')]);return _0x2d7d97(_0x3d9a5c[_0x29a2('0x11')][_0x29a2('0x13')]);}logger[_0x29a2('0x11')](_0x29a2('0x14'),_0x41ea7c,_0x3d9a5c[_0x29a2('0x11')]['message']);return _0x4b55de(_0x3d9a5c[_0x29a2('0x11')][_0x29a2('0x13')]);}else{logger[_0x29a2('0xd')](_0x29a2('0x14'),_0x41ea7c,'request\x20sent');_0x4b55de(_0x3d9a5c['result'][_0x29a2('0x13')]);}})[_0x29a2('0x15')](function(_0x1b712c){logger[_0x29a2('0x11')](_0x29a2('0x14'),_0x41ea7c,_0x1b712c);_0x2d7d97(_0x1b712c);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index b6de2f8..0ea4fdb 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 _0x507a=['/:id','show','download','root','originalname','replace','format','%s-%s%s','extname','now','post','file','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./sound.controller','get','isAuthenticated','index'];(function(_0x2b4b90,_0x3979de){var _0x1c2338=function(_0x2d38a9){while(--_0x2d38a9){_0x2b4b90['push'](_0x2b4b90['shift']());}};_0x1c2338(++_0x3979de);}(_0x507a,0x132));var _0xa507=function(_0x378944,_0x570d38){_0x378944=_0x378944-0x0;var _0x3f46bd=_0x507a[_0x378944];return _0x3f46bd;};'use strict';var multer=require(_0xa507('0x0'));var util=require(_0xa507('0x1'));var path=require(_0xa507('0x2'));var timeout=require(_0xa507('0x3'));var express=require(_0xa507('0x4'));var router=express[_0xa507('0x5')]();var fs_extra=require(_0xa507('0x6'));var auth=require(_0xa507('0x7'));var interaction=require(_0xa507('0x8'));var config=require('../../config/environment');var controller=require(_0xa507('0x9'));router[_0xa507('0xa')]('/',auth[_0xa507('0xb')](),controller[_0xa507('0xc')]);router[_0xa507('0xa')](_0xa507('0xd'),auth[_0xa507('0xb')](),controller[_0xa507('0xe')]);router['get']('/:id/download',auth[_0xa507('0xb')](),controller[_0xa507('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5d999f,_0x1c519e,_0x2d97c){_0x2d97c(null,path['join'](config[_0xa507('0x10')],'server/files/sounds/original/'));},'filename':function(_0x4791b8,_0x2ec821,_0x2c3fcf){_0x2ec821[_0xa507('0x11')]=_0x2ec821[_0xa507('0x11')][_0xa507('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2c3fcf(null,util[_0xa507('0x13')](_0xa507('0x14'),path['basename'](_0x2ec821['originalname'],path[_0xa507('0x15')](_0x2ec821[_0xa507('0x11')])),Date[_0xa507('0x16')](),path[_0xa507('0x15')](_0x2ec821['originalname'])));}})});router[_0xa507('0x17')]('/',upload['single'](_0xa507('0x18')),controller[_0xa507('0x19')]);router[_0xa507('0x1a')](_0xa507('0xd'),auth[_0xa507('0xb')](),controller['update']);router[_0xa507('0x1b')](_0xa507('0xd'),auth[_0xa507('0xb')](),controller['delete']);module[_0xa507('0x1c')]=router; \ No newline at end of file +var _0xc9e0=['create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./sound.controller','isAuthenticated','index','get','/:id','/:id/download','download','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file'];(function(_0x169cb6,_0x4dc0e5){var _0x1bd03e=function(_0x144b19){while(--_0x144b19){_0x169cb6['push'](_0x169cb6['shift']());}};_0x1bd03e(++_0x4dc0e5);}(_0xc9e0,0x159));var _0x0c9e=function(_0x1a5f94,_0x19b888){_0x1a5f94=_0x1a5f94-0x0;var _0x352348=_0xc9e0[_0x1a5f94];return _0x352348;};'use strict';var multer=require(_0x0c9e('0x0'));var util=require(_0x0c9e('0x1'));var path=require(_0x0c9e('0x2'));var timeout=require(_0x0c9e('0x3'));var express=require(_0x0c9e('0x4'));var router=express[_0x0c9e('0x5')]();var fs_extra=require(_0x0c9e('0x6'));var auth=require(_0x0c9e('0x7'));var interaction=require(_0x0c9e('0x8'));var config=require('../../config/environment');var controller=require(_0x0c9e('0x9'));router['get']('/',auth[_0x0c9e('0xa')](),controller[_0x0c9e('0xb')]);router[_0x0c9e('0xc')](_0x0c9e('0xd'),auth[_0x0c9e('0xa')](),controller['show']);router[_0x0c9e('0xc')](_0x0c9e('0xe'),auth[_0x0c9e('0xa')](),controller[_0x0c9e('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x269d0f,_0x1a9698,_0x4261e6){_0x4261e6(null,path[_0x0c9e('0x10')](config[_0x0c9e('0x11')],_0x0c9e('0x12')));},'filename':function(_0x58ea6a,_0x27d218,_0x45fa39){_0x27d218[_0x0c9e('0x13')]=_0x27d218[_0x0c9e('0x13')][_0x0c9e('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x45fa39(null,util[_0x0c9e('0x15')](_0x0c9e('0x16'),path[_0x0c9e('0x17')](_0x27d218[_0x0c9e('0x13')],path[_0x0c9e('0x18')](_0x27d218[_0x0c9e('0x13')])),Date[_0x0c9e('0x19')](),path[_0x0c9e('0x18')](_0x27d218['originalname'])));}})});router[_0x0c9e('0x1a')]('/',upload[_0x0c9e('0x1b')](_0x0c9e('0x1c')),controller[_0x0c9e('0x1d')]);router[_0x0c9e('0x1e')](_0x0c9e('0xd'),auth[_0x0c9e('0xa')](),controller[_0x0c9e('0x1f')]);router[_0x0c9e('0x20')](_0x0c9e('0xd'),auth['isAuthenticated'](),controller[_0x0c9e('0x20')]);module[_0x0c9e('0x21')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 32a555e..f42df27 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 _0xba69=['FLOAT','sequelize','exports','STRING','BIGINT','INTEGER'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xba69,0x91));var _0x9ba6=function(_0x58cfdf,_0x2109de){_0x58cfdf=_0x58cfdf-0x0;var _0x478001=_0xba69[_0x58cfdf];return _0x478001;};'use strict';var Sequelize=require(_0x9ba6('0x0'));module[_0x9ba6('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x9ba6('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x9ba6('0x2')]},'original_format':{'type':Sequelize[_0x9ba6('0x2')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x9ba6('0x3')]},'original_channelCount':{'type':Sequelize[_0x9ba6('0x4')]},'original_bitRate':{'type':Sequelize[_0x9ba6('0x3')]},'original_sampleRate':{'type':Sequelize[_0x9ba6('0x4')]},'converted_format':{'type':Sequelize[_0x9ba6('0x2')]},'converted_duration':{'type':Sequelize[_0x9ba6('0x5')]},'converted_sampleCount':{'type':Sequelize[_0x9ba6('0x3')]},'converted_channelCount':{'type':Sequelize[_0x9ba6('0x4')]},'converted_bitRate':{'type':Sequelize[_0x9ba6('0x3')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xbde1=['INTEGER','exports','STRING','FLOAT','BIGINT'];(function(_0x6444ab,_0x3b0492){var _0x593c06=function(_0x3b4957){while(--_0x3b4957){_0x6444ab['push'](_0x6444ab['shift']());}};_0x593c06(++_0x3b0492);}(_0xbde1,0x6f));var _0x1bde=function(_0x36574b,_0x19a083){_0x36574b=_0x36574b-0x0;var _0x3c97aa=_0xbde1[_0x36574b];return _0x3c97aa;};'use strict';var Sequelize=require('sequelize');module[_0x1bde('0x0')]={'name':{'type':Sequelize[_0x1bde('0x1')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x1bde('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x1bde('0x1')]},'original_format':{'type':Sequelize[_0x1bde('0x1')]},'original_duration':{'type':Sequelize[_0x1bde('0x2')]},'original_sampleCount':{'type':Sequelize[_0x1bde('0x3')]},'original_channelCount':{'type':Sequelize[_0x1bde('0x4')]},'original_bitRate':{'type':Sequelize[_0x1bde('0x3')]},'original_sampleRate':{'type':Sequelize[_0x1bde('0x4')]},'converted_format':{'type':Sequelize[_0x1bde('0x1')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x1bde('0x3')]},'converted_sampleRate':{'type':Sequelize[_0x1bde('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index dc3abe2..d25e14f 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 _0x1ffe=['original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_sampleRate','body','user','get','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','original_format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','Sounds','end','sendStatus','error','name','send','index','map','Sound','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','catch','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','%s.%s','create','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','format','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate'];(function(_0x5b9941,_0x5b44cc){var _0x373c56=function(_0x355ad7){while(--_0x355ad7){_0x5b9941['push'](_0x5b9941['shift']());}};_0x373c56(++_0x5b44cc);}(_0x1ffe,0x17e));var _0xe1ff=function(_0x4c3db0,_0x37d943){_0x4c3db0=_0x4c3db0-0x0;var _0x4181a2=_0x1ffe[_0x4c3db0];return _0x4181a2;};'use strict';var emlformat=require(_0xe1ff('0x0'));var rimraf=require(_0xe1ff('0x1'));var zipdir=require(_0xe1ff('0x2'));var jsonpatch=require(_0xe1ff('0x3'));var rp=require(_0xe1ff('0x4'));var moment=require(_0xe1ff('0x5'));var BPromise=require(_0xe1ff('0x6'));var Mustache=require(_0xe1ff('0x7'));var util=require('util');var path=require(_0xe1ff('0x8'));var sox=require(_0xe1ff('0x9'));var csv=require(_0xe1ff('0xa'));var ejs=require(_0xe1ff('0xb'));var fs=require('fs');var fs_extra=require(_0xe1ff('0xc'));var _=require(_0xe1ff('0xd'));var squel=require('squel');var crypto=require(_0xe1ff('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe1ff('0xa'));var querystring=require(_0xe1ff('0xf'));var Papa=require(_0xe1ff('0x10'));var Redis=require(_0xe1ff('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe1ff('0x12'));var as=require(_0xe1ff('0x13'));var hardwareService=require(_0xe1ff('0x14'));var logger=require('../../config/logger')(_0xe1ff('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe1ff('0x16'))['db'];function respondWithStatusCode(_0x404621,_0x5e7bcf){_0x5e7bcf=_0x5e7bcf||0xcc;return function(_0x1b1fe4){if(_0x1b1fe4){return _0x404621['sendStatus'](_0x5e7bcf);}return _0x404621[_0xe1ff('0x17')](_0x5e7bcf)['end']();};}function respondWithResult(_0x4fe0fd,_0x222dfc){_0x222dfc=_0x222dfc||0xc8;return function(_0x31711b){if(_0x31711b){return _0x4fe0fd[_0xe1ff('0x17')](_0x222dfc)['json'](_0x31711b);}};}function respondWithFilteredResult(_0x1bce9e,_0x25dbd4){return function(_0x47c52e){if(_0x47c52e){var _0x38b7af=typeof _0x25dbd4[_0xe1ff('0x18')]===_0xe1ff('0x19')&&typeof _0x25dbd4[_0xe1ff('0x1a')]===_0xe1ff('0x19');var _0x48349c=_0x47c52e['count'];var _0xb81ec1=_0x38b7af?0x0:_0x25dbd4[_0xe1ff('0x18')];var _0x59f681=_0x38b7af?_0x47c52e[_0xe1ff('0x1b')]:_0x25dbd4[_0xe1ff('0x18')]+_0x25dbd4[_0xe1ff('0x1a')];var _0x5eae3f;if(_0x59f681>=_0x48349c){_0x59f681=_0x48349c;_0x5eae3f=0xc8;}else{_0x5eae3f=0xce;}_0x1bce9e['status'](_0x5eae3f);return _0x1bce9e[_0xe1ff('0x1c')](_0xe1ff('0x1d'),_0xb81ec1+'-'+_0x59f681+'/'+_0x48349c)['json'](_0x47c52e);}return null;};}function patchUpdates(_0x526783){return function(_0xf7e726){try{jsonpatch[_0xe1ff('0x1e')](_0xf7e726,_0x526783,!![]);}catch(_0x599dae){return BPromise[_0xe1ff('0x1f')](_0x599dae);}return _0xf7e726[_0xe1ff('0x20')]();};}function saveUpdates(_0x6e5d4d,_0x100e70){return function(_0x39ccec){if(_0x39ccec){return _0x39ccec[_0xe1ff('0x21')](_0x6e5d4d)[_0xe1ff('0x22')](function(_0x149ed3){return _0x149ed3;});}return null;};}function removeEntity(_0x472493,_0x418521){return function(_0x421012){if(_0x421012){return _0x421012[_0xe1ff('0x23')]()['then'](function(){var _0x1ca508=_0x421012['get']({'plain':!![]});var _0x554463=_0xe1ff('0x24');return db['UserProfileResource'][_0xe1ff('0x23')]({'where':{'type':_0x554463,'resourceId':_0x1ca508['id']}})[_0xe1ff('0x22')](function(){return _0x421012;});})[_0xe1ff('0x22')](function(){_0x472493[_0xe1ff('0x17')](0xcc)[_0xe1ff('0x25')]();});}};}function handleEntityNotFound(_0x1b7e0f,_0x16dfbb){return function(_0x62a6b2){if(!_0x62a6b2){_0x1b7e0f[_0xe1ff('0x26')](0x194);}return _0x62a6b2;};}function handleError(_0x4bee8f,_0x3ae068){_0x3ae068=_0x3ae068||0x1f4;return function(_0x455d14){logger[_0xe1ff('0x27')](_0x455d14['stack']);if(_0x455d14[_0xe1ff('0x28')]){delete _0x455d14[_0xe1ff('0x28')];}_0x4bee8f[_0xe1ff('0x17')](_0x3ae068)[_0xe1ff('0x29')](_0x455d14);};}exports[_0xe1ff('0x2a')]=function(_0x3ece9a,_0x283921){var _0x492bd2={},_0x3d760b={},_0x42aee1={'count':0x0,'rows':[]};var _0x5a5090=_[_0xe1ff('0x2b')](db[_0xe1ff('0x2c')]['rawAttributes'],function(_0x377c2e){return{'name':_0x377c2e[_0xe1ff('0x2d')],'type':_0x377c2e['type'][_0xe1ff('0x2e')]};});_0x3d760b['model']=_['map'](_0x5a5090,_0xe1ff('0x28'));_0x3d760b[_0xe1ff('0x2f')]=_[_0xe1ff('0x30')](_0x3ece9a[_0xe1ff('0x2f')]);_0x3d760b[_0xe1ff('0x31')]=_[_0xe1ff('0x32')](_0x3d760b[_0xe1ff('0x33')],_0x3d760b['query']);_0x492bd2[_0xe1ff('0x34')]=_['intersection'](_0x3d760b[_0xe1ff('0x33')],qs[_0xe1ff('0x35')](_0x3ece9a[_0xe1ff('0x2f')][_0xe1ff('0x35')]));_0x492bd2[_0xe1ff('0x34')]=_0x492bd2[_0xe1ff('0x34')][_0xe1ff('0x36')]?_0x492bd2[_0xe1ff('0x34')]:_0x3d760b['model'];if(!_0x3ece9a[_0xe1ff('0x2f')]['hasOwnProperty'](_0xe1ff('0x37'))){_0x492bd2[_0xe1ff('0x1a')]=qs[_0xe1ff('0x1a')](_0x3ece9a[_0xe1ff('0x2f')][_0xe1ff('0x1a')]);_0x492bd2[_0xe1ff('0x18')]=qs['offset'](_0x3ece9a['query'][_0xe1ff('0x18')]);}_0x492bd2[_0xe1ff('0x38')]=qs[_0xe1ff('0x39')](_0x3ece9a[_0xe1ff('0x2f')][_0xe1ff('0x39')]);_0x492bd2['where']=qs[_0xe1ff('0x31')](_['pick'](_0x3ece9a[_0xe1ff('0x2f')],_0x3d760b[_0xe1ff('0x31')]),_0x5a5090);if(_0x3ece9a[_0xe1ff('0x2f')][_0xe1ff('0x3a')]){_0x492bd2['where']=_['merge'](_0x492bd2[_0xe1ff('0x3b')],{'$or':_[_0xe1ff('0x2b')](_0x5a5090,function(_0x184448){if(_0x184448[_0xe1ff('0x3c')]!==_0xe1ff('0x3d')){var _0x4a7bcd={};_0x4a7bcd[_0x184448[_0xe1ff('0x28')]]={'$like':'%'+_0x3ece9a[_0xe1ff('0x2f')][_0xe1ff('0x3a')]+'%'};return _0x4a7bcd;}})});}_0x492bd2=_[_0xe1ff('0x3e')]({},_0x492bd2,_0x3ece9a[_0xe1ff('0x3f')]);var _0x1fee5f={'where':_0x492bd2['where']};return db[_0xe1ff('0x2c')]['count'](_0x1fee5f)['then'](function(_0x2758ec){_0x42aee1[_0xe1ff('0x1b')]=_0x2758ec;if(_0x3ece9a[_0xe1ff('0x2f')][_0xe1ff('0x40')]){_0x492bd2[_0xe1ff('0x41')]=[{'all':!![]}];}return db[_0xe1ff('0x2c')][_0xe1ff('0x42')](_0x492bd2);})[_0xe1ff('0x22')](function(_0x4215b1){_0x42aee1[_0xe1ff('0x43')]=_0x4215b1;return _0x42aee1;})[_0xe1ff('0x22')](respondWithFilteredResult(_0x283921,_0x492bd2))['catch'](handleError(_0x283921,null));};exports[_0xe1ff('0x44')]=function(_0x470cf8,_0x41d1ca){var _0x369aaf={'raw':!![],'where':{'id':_0x470cf8[_0xe1ff('0x45')]['id']}},_0x3beb22={};_0x3beb22[_0xe1ff('0x33')]=_[_0xe1ff('0x30')](db[_0xe1ff('0x2c')]['rawAttributes']);_0x3beb22[_0xe1ff('0x2f')]=_[_0xe1ff('0x30')](_0x470cf8[_0xe1ff('0x2f')]);_0x3beb22[_0xe1ff('0x31')]=_[_0xe1ff('0x32')](_0x3beb22[_0xe1ff('0x33')],_0x3beb22['query']);_0x369aaf['attributes']=_[_0xe1ff('0x32')](_0x3beb22['model'],qs[_0xe1ff('0x35')](_0x470cf8['query'][_0xe1ff('0x35')]));_0x369aaf[_0xe1ff('0x34')]=_0x369aaf[_0xe1ff('0x34')][_0xe1ff('0x36')]?_0x369aaf[_0xe1ff('0x34')]:_0x3beb22['model'];if(_0x470cf8[_0xe1ff('0x2f')][_0xe1ff('0x40')]){_0x369aaf[_0xe1ff('0x41')]=[{'all':!![]}];}_0x369aaf=_['merge']({},_0x369aaf,_0x470cf8[_0xe1ff('0x3f')]);return db[_0xe1ff('0x2c')][_0xe1ff('0x46')](_0x369aaf)[_0xe1ff('0x22')](handleEntityNotFound(_0x41d1ca,null))['then'](respondWithResult(_0x41d1ca,null))[_0xe1ff('0x47')](handleError(_0x41d1ca,null));};exports['download']=function(_0x156cad,_0x291df1,_0x203e77){return db[_0xe1ff('0x2c')][_0xe1ff('0x46')]({'where':{'id':_0x156cad[_0xe1ff('0x45')]['id']},'attributes':[_0xe1ff('0x28'),_0xe1ff('0x48'),_0xe1ff('0x49')],'raw':!![]})[_0xe1ff('0x22')](handleEntityNotFound(_0x291df1,null))[_0xe1ff('0x22')](function(_0x454a6c){if(_0x454a6c){if(!fs[_0xe1ff('0x4a')](path[_0xe1ff('0x4b')](config[_0xe1ff('0x4c')],_0xe1ff('0x4d'),_0x454a6c[_0xe1ff('0x48')]+'.'+_0x454a6c[_0xe1ff('0x49')]))){throw new db[(_0xe1ff('0x4e'))][(_0xe1ff('0x4f'))]('Sound\x20not\x20found');}return _0x291df1['download'](path['join'](config[_0xe1ff('0x4c')],_0xe1ff('0x4d'),util['format'](_0xe1ff('0x50'),_0x454a6c[_0xe1ff('0x48')],_0x454a6c['converted_format'])),util['format'](_0xe1ff('0x50'),_0x454a6c['name'],_0x454a6c[_0xe1ff('0x49')]));}return null;})[_0xe1ff('0x47')](handleError(_0x291df1,null));};exports[_0xe1ff('0x51')]=function(_0x181b2b,_0x51ee00,_0x5dadb4){var _0xc34367={'name':path[_0xe1ff('0x52')](_0x181b2b[_0xe1ff('0x53')][_0xe1ff('0x54')],path[_0xe1ff('0x55')](_0x181b2b[_0xe1ff('0x53')]['originalname'])),'save_name':path[_0xe1ff('0x52')](_0x181b2b[_0xe1ff('0x53')][_0xe1ff('0x56')],path[_0xe1ff('0x55')](_0x181b2b[_0xe1ff('0x53')]['filename'])),'original_format':path[_0xe1ff('0x55')](_0x181b2b[_0xe1ff('0x53')]['originalname'])[_0xe1ff('0x57')](0x1),'converted_format':_0xe1ff('0x58')};var _0x4d5507=path[_0xe1ff('0x4b')](config[_0xe1ff('0x4c')],_0xe1ff('0x59'),_0x181b2b['file']['filename']);var _0x4d2feb=path[_0xe1ff('0x4b')](config['root'],_0xe1ff('0x4d'),util[_0xe1ff('0x5a')]('%s.%s',path[_0xe1ff('0x52')](_0x181b2b['file']['filename'],path[_0xe1ff('0x55')](_0x181b2b[_0xe1ff('0x53')]['filename'])),_0xc34367['converted_format']));logger['info'](_0xe1ff('0x5b'),_0x4d5507);logger[_0xe1ff('0x5c')](_0xe1ff('0x5d'),_0x4d2feb);try{fs[_0xe1ff('0x5e')](_0x4d5507,parseInt(_0xe1ff('0x5f'),0x8));var _0xa363e2=sox[_0xe1ff('0x60')](_0x4d5507,_0x4d2feb,{'sampleRate':0x1f40,'format':_0xe1ff('0x58'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xa363e2['on'](_0xe1ff('0x27'),function(_0x4b3616){fs[_0xe1ff('0x61')](_0x4d5507);_0x51ee00[_0xe1ff('0x17')](0x1f4)[_0xe1ff('0x29')](_0x4b3616);});_0xa363e2['on'](_0xe1ff('0x62'),function(_0x5aadaf){_0xc34367[_0xe1ff('0x63')]=isNaN(_0x5aadaf[_0xe1ff('0x64')])?null:_0x5aadaf[_0xe1ff('0x64')]*0x3e8;_0xc34367[_0xe1ff('0x65')]=isNaN(_0x5aadaf[_0xe1ff('0x66')])?null:_0x5aadaf[_0xe1ff('0x66')];_0xc34367['original_channelCount']=isNaN(_0x5aadaf[_0xe1ff('0x67')])?null:_0x5aadaf['channelCount'];_0xc34367[_0xe1ff('0x68')]=isNaN(_0x5aadaf[_0xe1ff('0x69')])?null:_0x5aadaf['bitRate'];_0xc34367[_0xe1ff('0x6a')]=isNaN(_0x5aadaf[_0xe1ff('0x6b')])?null:_0x5aadaf[_0xe1ff('0x6b')];});_0xa363e2['on'](_0xe1ff('0x6c'),function(_0x4314cd){_0xc34367[_0xe1ff('0x6d')]=isNaN(_0x4314cd['duration'])?null:_0x4314cd[_0xe1ff('0x64')]*0x3e8;_0xc34367[_0xe1ff('0x6e')]=isNaN(_0x4314cd[_0xe1ff('0x66')])?null:_0x4314cd[_0xe1ff('0x66')];_0xc34367[_0xe1ff('0x6f')]=isNaN(_0x4314cd[_0xe1ff('0x67')])?null:_0x4314cd[_0xe1ff('0x67')];_0xc34367['converted_bitRate']=isNaN(_0x4314cd['bitRate'])?null:_0x4314cd[_0xe1ff('0x69')];_0xc34367[_0xe1ff('0x70')]=isNaN(_0x4314cd[_0xe1ff('0x6b')])?null:_0x4314cd[_0xe1ff('0x6b')];});_0xa363e2['on'](_0xe1ff('0x25'),function(){fs[_0xe1ff('0x5e')](_0x4d2feb,parseInt('0777',0x8));return db[_0xe1ff('0x2c')][_0xe1ff('0x51')](_0xc34367)[_0xe1ff('0x22')](function(_0x3310b2){var _0x3191c3={'role':_0x181b2b[_0xe1ff('0x71')]['role'],'userProfileId':_0x181b2b[_0xe1ff('0x71')]['userProfileId']};if(!_0x3191c3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3191c3['role']===_0xe1ff('0x72')){var _0xec0156=_0x3310b2[_0xe1ff('0x73')]({'plain':!![]});return db['UserProfileSection'][_0xe1ff('0x46')]({'where':{'name':_0xe1ff('0x24'),'userProfileId':_0x3191c3['userProfileId']},'raw':!![]})['then'](function(_0x5205a7){if(_0x5205a7&&_0x5205a7[_0xe1ff('0x74')]===0x0){return db['UserProfileResource']['create']({'name':_0xec0156['name'],'resourceId':_0xec0156['id'],'type':_0x5205a7[_0xe1ff('0x28')],'sectionId':_0x5205a7['id']},{})[_0xe1ff('0x22')](function(){return _0x3310b2;});}else{return _0x3310b2;}})['catch'](function(_0x5ba1a9){logger[_0xe1ff('0x27')](_0xe1ff('0x75'),_0x5ba1a9);throw _0x5ba1a9;});}return _0x3310b2;})[_0xe1ff('0x22')](respondWithResult(_0x51ee00,null))['catch'](handleError(_0x51ee00,null));});_0xa363e2[_0xe1ff('0x76')]();}catch(_0x57be7d){_0x51ee00['status'](0x1f4)[_0xe1ff('0x29')](_0x57be7d);}};exports[_0xe1ff('0x21')]=function(_0x43c3ac,_0xfb4090,_0x5083a4){return db['Sound'][_0xe1ff('0x46')]({'where':{'id':_0x43c3ac['params']['id']}})[_0xe1ff('0x22')](handleEntityNotFound(_0xfb4090,null))[_0xe1ff('0x22')](saveUpdates(_['pick'](_0x43c3ac[_0xe1ff('0x71')],[_0xe1ff('0x28'),_0xe1ff('0x77')]),null))[_0xe1ff('0x22')](respondWithResult(_0xfb4090,null))[_0xe1ff('0x47')](handleError(_0xfb4090,null));};exports[_0xe1ff('0x78')]=function(_0x566108,_0x5cd68d,_0x8f1a9a){return db[_0xe1ff('0x2c')][_0xe1ff('0x46')]({'where':{'id':_0x566108['params']['id']}})[_0xe1ff('0x22')](function(_0x5ef05d){if(_0x5ef05d){return _0x5ef05d[_0xe1ff('0x23')]();}})[_0xe1ff('0x22')](function(_0x313ca8){var _0x57ff26=path[_0xe1ff('0x4b')](config[_0xe1ff('0x4c')],_0xe1ff('0x59'),util[_0xe1ff('0x5a')](_0xe1ff('0x50'),_0x313ca8[_0xe1ff('0x48')],_0x313ca8[_0xe1ff('0x79')]));var _0x5097da=path['join'](config[_0xe1ff('0x4c')],'server/files/sounds/converted',util[_0xe1ff('0x5a')]('%s.%s',_0x313ca8['save_name'],_0x313ca8[_0xe1ff('0x49')]));fs[_0xe1ff('0x61')](_0x57ff26);fs[_0xe1ff('0x61')](_0x5097da);return _0x313ca8;})[_0xe1ff('0x22')](function(_0x24b1f9){if(_0x24b1f9){return _0x5cd68d[_0xe1ff('0x17')](0xcc)[_0xe1ff('0x25')]();}})['then'](handleEntityNotFound(_0x5cd68d,null))[_0xe1ff('0x47')](handleError(_0x5cd68d,null));}; \ No newline at end of file +var _0xd635=['keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','options','Sound','includeAll','include','findAll','rows','catch','params','download','find','save_name','converted_format','existsSync','root','Sequelize','ValidationError','Sound\x20not\x20found','server/files/sounds/converted','format','%s.%s','create','basename','file','originalname','extname','filename','substring','wav','join','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','0777','transcode','error','send','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_channelCount','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','update','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../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','save','destroy','then','get','Sounds','UserProfileResource','stack','name','map','key','query'];(function(_0x161ab6,_0x51ee5c){var _0x437d12=function(_0x38002d){while(--_0x38002d){_0x161ab6['push'](_0x161ab6['shift']());}};_0x437d12(++_0x51ee5c);}(_0xd635,0x147));var _0x5d63=function(_0xcfd89f,_0x106e8f){_0xcfd89f=_0xcfd89f-0x0;var _0x59acd4=_0xd635[_0xcfd89f];return _0x59acd4;};'use strict';var emlformat=require(_0x5d63('0x0'));var rimraf=require(_0x5d63('0x1'));var zipdir=require(_0x5d63('0x2'));var jsonpatch=require(_0x5d63('0x3'));var rp=require(_0x5d63('0x4'));var moment=require(_0x5d63('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5d63('0x6'));var util=require(_0x5d63('0x7'));var path=require(_0x5d63('0x8'));var sox=require(_0x5d63('0x9'));var csv=require(_0x5d63('0xa'));var ejs=require(_0x5d63('0xb'));var fs=require('fs');var fs_extra=require(_0x5d63('0xc'));var _=require(_0x5d63('0xd'));var squel=require(_0x5d63('0xe'));var crypto=require(_0x5d63('0xf'));var jsforce=require(_0x5d63('0x10'));var deskjs=require(_0x5d63('0x11'));var toCsv=require(_0x5d63('0xa'));var querystring=require(_0x5d63('0x12'));var Papa=require(_0x5d63('0x13'));var Redis=require(_0x5d63('0x14'));var authService=require(_0x5d63('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x5d63('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5d63('0x17'))(_0x5d63('0x18'));var utils=require(_0x5d63('0x19'));var config=require(_0x5d63('0x1a'));var licenseUtil=require(_0x5d63('0x1b'));var db=require(_0x5d63('0x1c'))['db'];function respondWithStatusCode(_0x1a4197,_0x43a37c){_0x43a37c=_0x43a37c||0xcc;return function(_0x112ee5){if(_0x112ee5){return _0x1a4197[_0x5d63('0x1d')](_0x43a37c);}return _0x1a4197[_0x5d63('0x1e')](_0x43a37c)[_0x5d63('0x1f')]();};}function respondWithResult(_0x167c39,_0x310e80){_0x310e80=_0x310e80||0xc8;return function(_0x376943){if(_0x376943){return _0x167c39[_0x5d63('0x1e')](_0x310e80)[_0x5d63('0x20')](_0x376943);}};}function respondWithFilteredResult(_0x4ea356,_0x184fb0){return function(_0x200d92){if(_0x200d92){var _0x4f92c8=typeof _0x184fb0[_0x5d63('0x21')]===_0x5d63('0x22')&&typeof _0x184fb0[_0x5d63('0x23')]==='undefined';var _0x7561c5=_0x200d92[_0x5d63('0x24')];var _0x4bf5a2=_0x4f92c8?0x0:_0x184fb0['offset'];var _0x379da7=_0x4f92c8?_0x200d92[_0x5d63('0x24')]:_0x184fb0['offset']+_0x184fb0[_0x5d63('0x23')];var _0x1ccd04;if(_0x379da7>=_0x7561c5){_0x379da7=_0x7561c5;_0x1ccd04=0xc8;}else{_0x1ccd04=0xce;}_0x4ea356[_0x5d63('0x1e')](_0x1ccd04);return _0x4ea356[_0x5d63('0x25')](_0x5d63('0x26'),_0x4bf5a2+'-'+_0x379da7+'/'+_0x7561c5)['json'](_0x200d92);}return null;};}function patchUpdates(_0x1cafeb){return function(_0x31b9e){try{jsonpatch[_0x5d63('0x27')](_0x31b9e,_0x1cafeb,!![]);}catch(_0x35baef){return BPromise['reject'](_0x35baef);}return _0x31b9e[_0x5d63('0x28')]();};}function saveUpdates(_0x5cf981,_0x52ba75){return function(_0x1b1660){if(_0x1b1660){return _0x1b1660['update'](_0x5cf981)['then'](function(_0x7dac17){return _0x7dac17;});}return null;};}function removeEntity(_0x142c1b,_0x391132){return function(_0x2637b2){if(_0x2637b2){return _0x2637b2[_0x5d63('0x29')]()[_0x5d63('0x2a')](function(){var _0x14c8f9=_0x2637b2[_0x5d63('0x2b')]({'plain':!![]});var _0x491b71=_0x5d63('0x2c');return db[_0x5d63('0x2d')]['destroy']({'where':{'type':_0x491b71,'resourceId':_0x14c8f9['id']}})[_0x5d63('0x2a')](function(){return _0x2637b2;});})[_0x5d63('0x2a')](function(){_0x142c1b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x11166a,_0x4e8f51){return function(_0x8ac6d2){if(!_0x8ac6d2){_0x11166a['sendStatus'](0x194);}return _0x8ac6d2;};}function handleError(_0x25bc5c,_0xa1933f){_0xa1933f=_0xa1933f||0x1f4;return function(_0x3493ff){logger['error'](_0x3493ff[_0x5d63('0x2e')]);if(_0x3493ff[_0x5d63('0x2f')]){delete _0x3493ff[_0x5d63('0x2f')];}_0x25bc5c[_0x5d63('0x1e')](_0xa1933f)['send'](_0x3493ff);};}exports['index']=function(_0x5967a4,_0x5c6ae1){var _0x19e107={},_0x26481e={},_0x3e9e19={'count':0x0,'rows':[]};var _0x5aae6a=_[_0x5d63('0x30')](db['Sound']['rawAttributes'],function(_0x5fbfb1){return{'name':_0x5fbfb1['fieldName'],'type':_0x5fbfb1['type'][_0x5d63('0x31')]};});_0x26481e['model']=_[_0x5d63('0x30')](_0x5aae6a,_0x5d63('0x2f'));_0x26481e[_0x5d63('0x32')]=_[_0x5d63('0x33')](_0x5967a4[_0x5d63('0x32')]);_0x26481e['filters']=_[_0x5d63('0x34')](_0x26481e[_0x5d63('0x35')],_0x26481e[_0x5d63('0x32')]);_0x19e107[_0x5d63('0x36')]=_[_0x5d63('0x34')](_0x26481e[_0x5d63('0x35')],qs[_0x5d63('0x37')](_0x5967a4['query'][_0x5d63('0x37')]));_0x19e107[_0x5d63('0x36')]=_0x19e107[_0x5d63('0x36')][_0x5d63('0x38')]?_0x19e107['attributes']:_0x26481e[_0x5d63('0x35')];if(!_0x5967a4[_0x5d63('0x32')][_0x5d63('0x39')](_0x5d63('0x3a'))){_0x19e107[_0x5d63('0x23')]=qs[_0x5d63('0x23')](_0x5967a4[_0x5d63('0x32')][_0x5d63('0x23')]);_0x19e107[_0x5d63('0x21')]=qs[_0x5d63('0x21')](_0x5967a4['query'][_0x5d63('0x21')]);}_0x19e107['order']=qs[_0x5d63('0x3b')](_0x5967a4['query'][_0x5d63('0x3b')]);_0x19e107[_0x5d63('0x3c')]=qs[_0x5d63('0x3d')](_[_0x5d63('0x3e')](_0x5967a4[_0x5d63('0x32')],_0x26481e[_0x5d63('0x3d')]),_0x5aae6a);if(_0x5967a4['query'][_0x5d63('0x3f')]){_0x19e107[_0x5d63('0x3c')]=_[_0x5d63('0x40')](_0x19e107[_0x5d63('0x3c')],{'$or':_[_0x5d63('0x30')](_0x5aae6a,function(_0x3062c9){if(_0x3062c9[_0x5d63('0x41')]!=='VIRTUAL'){var _0x17ad14={};_0x17ad14[_0x3062c9[_0x5d63('0x2f')]]={'$like':'%'+_0x5967a4['query'][_0x5d63('0x3f')]+'%'};return _0x17ad14;}})});}_0x19e107=_[_0x5d63('0x40')]({},_0x19e107,_0x5967a4[_0x5d63('0x42')]);var _0x5191c3={'where':_0x19e107[_0x5d63('0x3c')]};return db[_0x5d63('0x43')][_0x5d63('0x24')](_0x5191c3)['then'](function(_0x1f6434){_0x3e9e19[_0x5d63('0x24')]=_0x1f6434;if(_0x5967a4[_0x5d63('0x32')][_0x5d63('0x44')]){_0x19e107[_0x5d63('0x45')]=[{'all':!![]}];}return db[_0x5d63('0x43')][_0x5d63('0x46')](_0x19e107);})[_0x5d63('0x2a')](function(_0x8c7342){_0x3e9e19[_0x5d63('0x47')]=_0x8c7342;return _0x3e9e19;})[_0x5d63('0x2a')](respondWithFilteredResult(_0x5c6ae1,_0x19e107))[_0x5d63('0x48')](handleError(_0x5c6ae1,null));};exports['show']=function(_0x4738e1,_0x13c83e){var _0x186178={'raw':!![],'where':{'id':_0x4738e1[_0x5d63('0x49')]['id']}},_0x548ef0={};_0x548ef0[_0x5d63('0x35')]=_[_0x5d63('0x33')](db[_0x5d63('0x43')]['rawAttributes']);_0x548ef0[_0x5d63('0x32')]=_[_0x5d63('0x33')](_0x4738e1['query']);_0x548ef0[_0x5d63('0x3d')]=_['intersection'](_0x548ef0['model'],_0x548ef0[_0x5d63('0x32')]);_0x186178['attributes']=_['intersection'](_0x548ef0[_0x5d63('0x35')],qs[_0x5d63('0x37')](_0x4738e1[_0x5d63('0x32')][_0x5d63('0x37')]));_0x186178[_0x5d63('0x36')]=_0x186178[_0x5d63('0x36')]['length']?_0x186178[_0x5d63('0x36')]:_0x548ef0[_0x5d63('0x35')];if(_0x4738e1['query'][_0x5d63('0x44')]){_0x186178[_0x5d63('0x45')]=[{'all':!![]}];}_0x186178=_[_0x5d63('0x40')]({},_0x186178,_0x4738e1[_0x5d63('0x42')]);return db[_0x5d63('0x43')]['find'](_0x186178)[_0x5d63('0x2a')](handleEntityNotFound(_0x13c83e,null))['then'](respondWithResult(_0x13c83e,null))[_0x5d63('0x48')](handleError(_0x13c83e,null));};exports[_0x5d63('0x4a')]=function(_0x22fafb,_0x54523e,_0x3b4d9f){return db[_0x5d63('0x43')][_0x5d63('0x4b')]({'where':{'id':_0x22fafb[_0x5d63('0x49')]['id']},'attributes':[_0x5d63('0x2f'),_0x5d63('0x4c'),_0x5d63('0x4d')],'raw':!![]})[_0x5d63('0x2a')](handleEntityNotFound(_0x54523e,null))[_0x5d63('0x2a')](function(_0x1c70b7){if(_0x1c70b7){if(!fs[_0x5d63('0x4e')](path['join'](config[_0x5d63('0x4f')],'server/files/sounds/converted',_0x1c70b7[_0x5d63('0x4c')]+'.'+_0x1c70b7[_0x5d63('0x4d')]))){throw new db[(_0x5d63('0x50'))][(_0x5d63('0x51'))](_0x5d63('0x52'));}return _0x54523e[_0x5d63('0x4a')](path['join'](config[_0x5d63('0x4f')],_0x5d63('0x53'),util[_0x5d63('0x54')](_0x5d63('0x55'),_0x1c70b7[_0x5d63('0x4c')],_0x1c70b7[_0x5d63('0x4d')])),util[_0x5d63('0x54')](_0x5d63('0x55'),_0x1c70b7[_0x5d63('0x2f')],_0x1c70b7[_0x5d63('0x4d')]));}return null;})['catch'](handleError(_0x54523e,null));};exports[_0x5d63('0x56')]=function(_0x2577b4,_0x3e762d,_0x3d7e93){var _0x42381d={'name':path[_0x5d63('0x57')](_0x2577b4[_0x5d63('0x58')][_0x5d63('0x59')],path[_0x5d63('0x5a')](_0x2577b4[_0x5d63('0x58')]['originalname'])),'save_name':path[_0x5d63('0x57')](_0x2577b4[_0x5d63('0x58')][_0x5d63('0x5b')],path[_0x5d63('0x5a')](_0x2577b4[_0x5d63('0x58')][_0x5d63('0x5b')])),'original_format':path['extname'](_0x2577b4[_0x5d63('0x58')][_0x5d63('0x59')])[_0x5d63('0x5c')](0x1),'converted_format':_0x5d63('0x5d')};var _0x13f5af=path[_0x5d63('0x5e')](config[_0x5d63('0x4f')],_0x5d63('0x5f'),_0x2577b4[_0x5d63('0x58')][_0x5d63('0x5b')]);var _0x291747=path[_0x5d63('0x5e')](config[_0x5d63('0x4f')],'server/files/sounds/converted',util[_0x5d63('0x54')](_0x5d63('0x55'),path[_0x5d63('0x57')](_0x2577b4[_0x5d63('0x58')][_0x5d63('0x5b')],path[_0x5d63('0x5a')](_0x2577b4[_0x5d63('0x58')]['filename'])),_0x42381d[_0x5d63('0x4d')]));logger[_0x5d63('0x60')](_0x5d63('0x61'),_0x13f5af);logger[_0x5d63('0x60')]('Sound\x20upload\x20destination:\x20%s',_0x291747);try{fs[_0x5d63('0x62')](_0x13f5af,parseInt(_0x5d63('0x63'),0x8));var _0x48ef50=sox[_0x5d63('0x64')](_0x13f5af,_0x291747,{'sampleRate':0x1f40,'format':_0x5d63('0x5d'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x48ef50['on'](_0x5d63('0x65'),function(_0x32dbf6){fs['unlinkSync'](_0x13f5af);_0x3e762d['status'](0x1f4)[_0x5d63('0x66')](_0x32dbf6);});_0x48ef50['on']('src',function(_0x374a8f){_0x42381d[_0x5d63('0x67')]=isNaN(_0x374a8f['duration'])?null:_0x374a8f[_0x5d63('0x68')]*0x3e8;_0x42381d[_0x5d63('0x69')]=isNaN(_0x374a8f[_0x5d63('0x6a')])?null:_0x374a8f[_0x5d63('0x6a')];_0x42381d[_0x5d63('0x6b')]=isNaN(_0x374a8f[_0x5d63('0x6c')])?null:_0x374a8f['channelCount'];_0x42381d[_0x5d63('0x6d')]=isNaN(_0x374a8f[_0x5d63('0x6e')])?null:_0x374a8f[_0x5d63('0x6e')];_0x42381d[_0x5d63('0x6f')]=isNaN(_0x374a8f[_0x5d63('0x70')])?null:_0x374a8f[_0x5d63('0x70')];});_0x48ef50['on'](_0x5d63('0x71'),function(_0x30651c){_0x42381d['converted_duration']=isNaN(_0x30651c[_0x5d63('0x68')])?null:_0x30651c[_0x5d63('0x68')]*0x3e8;_0x42381d[_0x5d63('0x72')]=isNaN(_0x30651c[_0x5d63('0x6a')])?null:_0x30651c[_0x5d63('0x6a')];_0x42381d[_0x5d63('0x73')]=isNaN(_0x30651c[_0x5d63('0x6c')])?null:_0x30651c[_0x5d63('0x6c')];_0x42381d['converted_bitRate']=isNaN(_0x30651c[_0x5d63('0x6e')])?null:_0x30651c[_0x5d63('0x6e')];_0x42381d['converted_sampleRate']=isNaN(_0x30651c[_0x5d63('0x70')])?null:_0x30651c[_0x5d63('0x70')];});_0x48ef50['on'](_0x5d63('0x1f'),function(){fs[_0x5d63('0x62')](_0x291747,parseInt('0777',0x8));return db['Sound']['create'](_0x42381d)[_0x5d63('0x2a')](function(_0xdfa5b0){var _0x559a42={'role':_0x2577b4[_0x5d63('0x74')][_0x5d63('0x75')],'userProfileId':_0x2577b4['body']['userProfileId']};if(!_0x559a42)throw new Error(_0x5d63('0x76'));if(_0x559a42['role']===_0x5d63('0x77')){var _0x4aad8e=_0xdfa5b0[_0x5d63('0x2b')]({'plain':!![]});return db[_0x5d63('0x78')][_0x5d63('0x4b')]({'where':{'name':_0x5d63('0x2c'),'userProfileId':_0x559a42['userProfileId']},'raw':!![]})[_0x5d63('0x2a')](function(_0x5d2817){if(_0x5d2817&&_0x5d2817[_0x5d63('0x79')]===0x0){return db['UserProfileResource'][_0x5d63('0x56')]({'name':_0x4aad8e['name'],'resourceId':_0x4aad8e['id'],'type':_0x5d2817[_0x5d63('0x2f')],'sectionId':_0x5d2817['id']},{})['then'](function(){return _0xdfa5b0;});}else{return _0xdfa5b0;}})[_0x5d63('0x48')](function(_0x1ab87a){logger[_0x5d63('0x65')](_0x5d63('0x7a'),_0x1ab87a);throw _0x1ab87a;});}return _0xdfa5b0;})['then'](respondWithResult(_0x3e762d,null))['catch'](handleError(_0x3e762d,null));});_0x48ef50[_0x5d63('0x7b')]();}catch(_0x190593){_0x3e762d[_0x5d63('0x1e')](0x1f4)[_0x5d63('0x66')](_0x190593);}};exports[_0x5d63('0x7c')]=function(_0x1fe950,_0x39fd63,_0x874efe){return db[_0x5d63('0x43')][_0x5d63('0x4b')]({'where':{'id':_0x1fe950['params']['id']}})[_0x5d63('0x2a')](handleEntityNotFound(_0x39fd63,null))[_0x5d63('0x2a')](saveUpdates(_['pick'](_0x1fe950['body'],['name','description']),null))[_0x5d63('0x2a')](respondWithResult(_0x39fd63,null))[_0x5d63('0x48')](handleError(_0x39fd63,null));};exports['delete']=function(_0x2fd55b,_0x56ac4d,_0x3627b9){return db[_0x5d63('0x43')]['find']({'where':{'id':_0x2fd55b[_0x5d63('0x49')]['id']}})[_0x5d63('0x2a')](function(_0x3653f8){if(_0x3653f8){return _0x3653f8[_0x5d63('0x29')]();}})[_0x5d63('0x2a')](function(_0x2ba83a){var _0x1d0452=path[_0x5d63('0x5e')](config[_0x5d63('0x4f')],_0x5d63('0x5f'),util[_0x5d63('0x54')](_0x5d63('0x55'),_0x2ba83a[_0x5d63('0x4c')],_0x2ba83a['original_format']));var _0x4afe63=path[_0x5d63('0x5e')](config[_0x5d63('0x4f')],_0x5d63('0x53'),util['format'](_0x5d63('0x55'),_0x2ba83a[_0x5d63('0x4c')],_0x2ba83a[_0x5d63('0x4d')]));fs['unlinkSync'](_0x1d0452);fs[_0x5d63('0x7d')](_0x4afe63);return _0x2ba83a;})[_0x5d63('0x2a')](function(_0x3cdff6){if(_0x3cdff6){return _0x56ac4d[_0x5d63('0x1e')](0xcc)[_0x5d63('0x1f')]();}})[_0x5d63('0x2a')](handleEntityNotFound(_0x56ac4d,null))[_0x5d63('0x48')](handleError(_0x56ac4d,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index e6a4d70..507c4c5 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 _0xbb3a=['api','moment','request-promise','path','rimraf','./sound.attributes','exports','define','tools_sounds','lodash','util','../../config/logger'];(function(_0x2009b5,_0x19677c){var _0x457404=function(_0x505212){while(--_0x505212){_0x2009b5['push'](_0x2009b5['shift']());}};_0x457404(++_0x19677c);}(_0xbb3a,0x69));var _0xabb3=function(_0x130e11,_0x4c1260){_0x130e11=_0x130e11-0x0;var _0x1249fd=_0xbb3a[_0x130e11];return _0x1249fd;};'use strict';var _=require(_0xabb3('0x0'));var util=require(_0xabb3('0x1'));var logger=require(_0xabb3('0x2'))(_0xabb3('0x3'));var moment=require(_0xabb3('0x4'));var BPromise=require('bluebird');var rp=require(_0xabb3('0x5'));var fs=require('fs');var path=require(_0xabb3('0x6'));var rimraf=require(_0xabb3('0x7'));var config=require('../../config/environment');var attributes=require(_0xabb3('0x8'));module[_0xabb3('0x9')]=function(_0x247450,_0x440872){return _0x247450[_0xabb3('0xa')]('Sound',attributes,{'tableName':_0xabb3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e49=['request-promise','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','lodash','../../config/logger','moment','bluebird'];(function(_0x2799d9,_0x474c60){var _0xa614e6=function(_0x30612b){while(--_0x30612b){_0x2799d9['push'](_0x2799d9['shift']());}};_0xa614e6(++_0x474c60);}(_0x0e49,0x104));var _0x90e4=function(_0x385497,_0x120e2e){_0x385497=_0x385497-0x0;var _0x5b5317=_0x0e49[_0x385497];return _0x5b5317;};'use strict';var _=require(_0x90e4('0x0'));var util=require('util');var logger=require(_0x90e4('0x1'))('api');var moment=require(_0x90e4('0x2'));var BPromise=require(_0x90e4('0x3'));var rp=require(_0x90e4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x90e4('0x5'));var config=require(_0x90e4('0x6'));var attributes=require(_0x90e4('0x7'));module[_0x90e4('0x8')]=function(_0x4db523,_0x2aae7a){return _0x4db523[_0x90e4('0x9')](_0x90e4('0xa'),attributes,{'tableName':'tools_sounds','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 572d21a..8b97885 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 _0x6c95=['http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSound','Sound','find','options','raw','where','attributes','include','map','model','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','client'];(function(_0x46ccb4,_0x3c8d20){var _0x228095=function(_0xad0ad5){while(--_0xad0ad5){_0x46ccb4['push'](_0x46ccb4['shift']());}};_0x228095(++_0x3c8d20);}(_0x6c95,0x1d9));var _0x56c9=function(_0x1581eb,_0x2369f5){_0x1581eb=_0x1581eb-0x0;var _0xc8c984=_0x6c95[_0x1581eb];return _0xc8c984;};'use strict';var _=require(_0x56c9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x56c9('0x1'));var rs=require(_0x56c9('0x2'));var fs=require('fs');var Redis=require(_0x56c9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x56c9('0x4'));var logger=require(_0x56c9('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x56c9('0x6')][_0x56c9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b667,_0x1cd596,_0x243977){return new BPromise(function(_0x510114,_0x5e3902){return client[_0x56c9('0x8')](_0x15b667,_0x243977)[_0x56c9('0x9')](function(_0x4f6b22){logger[_0x56c9('0xa')](_0x56c9('0xb'),_0x1cd596,_0x56c9('0xc'));logger['debug'](_0x56c9('0xd'),_0x1cd596,'request\x20sent',JSON[_0x56c9('0xe')](_0x4f6b22));if(_0x4f6b22[_0x56c9('0xf')]){if(_0x4f6b22[_0x56c9('0xf')][_0x56c9('0x10')]===0x1f4){logger[_0x56c9('0xf')]('Sound,\x20%s,\x20%s',_0x1cd596,_0x4f6b22[_0x56c9('0xf')]['message']);return _0x5e3902(_0x4f6b22[_0x56c9('0xf')][_0x56c9('0x11')]);}logger[_0x56c9('0xf')](_0x56c9('0xb'),_0x1cd596,_0x4f6b22[_0x56c9('0xf')][_0x56c9('0x11')]);return _0x510114(_0x4f6b22[_0x56c9('0xf')][_0x56c9('0x11')]);}else{logger[_0x56c9('0xa')]('Sound,\x20%s,\x20%s',_0x1cd596,_0x56c9('0xc'));_0x510114(_0x4f6b22[_0x56c9('0x12')][_0x56c9('0x11')]);}})[_0x56c9('0x13')](function(_0x4cdb0f){logger[_0x56c9('0xf')](_0x56c9('0xb'),_0x1cd596,_0x4cdb0f);_0x5e3902(_0x4cdb0f);});});}exports[_0x56c9('0x14')]=function(_0x3197c1){var _0xcaf24f=this;return new Promise(function(_0x116a79,_0x14abc1){return db[_0x56c9('0x15')][_0x56c9('0x16')]({'raw':_0x3197c1[_0x56c9('0x17')]?_0x3197c1[_0x56c9('0x17')][_0x56c9('0x18')]===undefined?!![]:![]:!![],'where':_0x3197c1[_0x56c9('0x17')]?_0x3197c1[_0x56c9('0x17')][_0x56c9('0x19')]||null:null,'attributes':_0x3197c1[_0x56c9('0x17')]?_0x3197c1[_0x56c9('0x17')][_0x56c9('0x1a')]||null:null,'include':_0x3197c1[_0x56c9('0x17')]?_0x3197c1[_0x56c9('0x17')][_0x56c9('0x1b')]?_[_0x56c9('0x1c')](_0x3197c1['options'][_0x56c9('0x1b')],function(_0x530d11){return{'model':db[_0x530d11['model']],'as':_0x530d11['as'],'attributes':_0x530d11[_0x56c9('0x1a')],'include':_0x530d11[_0x56c9('0x1b')]?_[_0x56c9('0x1c')](_0x530d11[_0x56c9('0x1b')],function(_0x46ab14){return{'model':db[_0x46ab14[_0x56c9('0x1d')]],'as':_0x46ab14['as'],'attributes':_0x46ab14[_0x56c9('0x1a')],'include':_0x46ab14[_0x56c9('0x1b')]?_[_0x56c9('0x1c')](_0x46ab14[_0x56c9('0x1b')],function(_0x4e81ee){return{'model':db[_0x4e81ee[_0x56c9('0x1d')]],'as':_0x4e81ee['as'],'attributes':_0x4e81ee[_0x56c9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x56c9('0x9')](function(_0x4dcbe1){logger[_0x56c9('0xa')]('ShowSound',_0x3197c1);logger['debug']('ShowSound',_0x3197c1,JSON[_0x56c9('0xe')](_0x4dcbe1));_0x116a79(_0x4dcbe1);})[_0x56c9('0x13')](function(_0x32faa8){logger[_0x56c9('0xf')](_0x56c9('0x14'),_0x32faa8[_0x56c9('0x11')],_0x3197c1);_0x14abc1(_0xcaf24f[_0x56c9('0xf')](0x1f4,_0x32faa8[_0x56c9('0x11')]));});});}; \ No newline at end of file +var _0x4dcf=['stringify','error','code','message','result','ShowSound','Sound','options','raw','include','map','model','attributes','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','http','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x4dcf,0x1d9));var _0xf4dc=function(_0x4032d4,_0x4f09aa){_0x4032d4=_0x4032d4-0x0;var _0x40f143=_0x4dcf[_0x4032d4];return _0x40f143;};'use strict';var _=require(_0xf4dc('0x0'));var util=require('util');var moment=require(_0xf4dc('0x1'));var BPromise=require('bluebird');var rs=require(_0xf4dc('0x2'));var fs=require('fs');var Redis=require(_0xf4dc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf4dc('0x4'));var logger=require(_0xf4dc('0x5'))('rpc');var config=require(_0xf4dc('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf4dc('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x342869,_0x585c65,_0x212c46){return new BPromise(function(_0x4ba42e,_0x2d5d6d){return client['request'](_0x342869,_0x212c46)[_0xf4dc('0x8')](function(_0x4d1828){logger[_0xf4dc('0x9')](_0xf4dc('0xa'),_0x585c65,_0xf4dc('0xb'));logger[_0xf4dc('0xc')]('Sound,\x20%s,\x20%s,\x20%s',_0x585c65,_0xf4dc('0xb'),JSON[_0xf4dc('0xd')](_0x4d1828));if(_0x4d1828[_0xf4dc('0xe')]){if(_0x4d1828[_0xf4dc('0xe')][_0xf4dc('0xf')]===0x1f4){logger[_0xf4dc('0xe')](_0xf4dc('0xa'),_0x585c65,_0x4d1828['error'][_0xf4dc('0x10')]);return _0x2d5d6d(_0x4d1828[_0xf4dc('0xe')][_0xf4dc('0x10')]);}logger[_0xf4dc('0xe')]('Sound,\x20%s,\x20%s',_0x585c65,_0x4d1828[_0xf4dc('0xe')][_0xf4dc('0x10')]);return _0x4ba42e(_0x4d1828[_0xf4dc('0xe')][_0xf4dc('0x10')]);}else{logger[_0xf4dc('0x9')]('Sound,\x20%s,\x20%s',_0x585c65,_0xf4dc('0xb'));_0x4ba42e(_0x4d1828[_0xf4dc('0x11')][_0xf4dc('0x10')]);}})['catch'](function(_0x2669b6){logger['error'](_0xf4dc('0xa'),_0x585c65,_0x2669b6);_0x2d5d6d(_0x2669b6);});});}exports[_0xf4dc('0x12')]=function(_0xda0e10){var _0x5f1496=this;return new Promise(function(_0x3b086b,_0x1175bc){return db[_0xf4dc('0x13')]['find']({'raw':_0xda0e10[_0xf4dc('0x14')]?_0xda0e10['options'][_0xf4dc('0x15')]===undefined?!![]:![]:!![],'where':_0xda0e10[_0xf4dc('0x14')]?_0xda0e10[_0xf4dc('0x14')]['where']||null:null,'attributes':_0xda0e10[_0xf4dc('0x14')]?_0xda0e10['options']['attributes']||null:null,'include':_0xda0e10[_0xf4dc('0x14')]?_0xda0e10[_0xf4dc('0x14')][_0xf4dc('0x16')]?_[_0xf4dc('0x17')](_0xda0e10['options'][_0xf4dc('0x16')],function(_0x5ab02d){return{'model':db[_0x5ab02d[_0xf4dc('0x18')]],'as':_0x5ab02d['as'],'attributes':_0x5ab02d[_0xf4dc('0x19')],'include':_0x5ab02d['include']?_[_0xf4dc('0x17')](_0x5ab02d[_0xf4dc('0x16')],function(_0x4bc91f){return{'model':db[_0x4bc91f[_0xf4dc('0x18')]],'as':_0x4bc91f['as'],'attributes':_0x4bc91f['attributes'],'include':_0x4bc91f[_0xf4dc('0x16')]?_[_0xf4dc('0x17')](_0x4bc91f[_0xf4dc('0x16')],function(_0x1ade44){return{'model':db[_0x1ade44['model']],'as':_0x1ade44['as'],'attributes':_0x1ade44[_0xf4dc('0x19')]};}):[]};}):[]};}):[]:[]})[_0xf4dc('0x8')](function(_0xf3cced){logger[_0xf4dc('0x9')]('ShowSound',_0xda0e10);logger[_0xf4dc('0xc')](_0xf4dc('0x12'),_0xda0e10,JSON[_0xf4dc('0xd')](_0xf3cced));_0x3b086b(_0xf3cced);})[_0xf4dc('0x1a')](function(_0x54e534){logger[_0xf4dc('0xe')](_0xf4dc('0x12'),_0x54e534['message'],_0xda0e10);_0x1175bc(_0x5f1496[_0xf4dc('0xe')](0x1f4,_0x54e534[_0xf4dc('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 989840c..7ef03f1 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 _0xbaf0=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','util','path'];(function(_0x268277,_0x33ab3e){var _0x5991e2=function(_0x4c3152){while(--_0x4c3152){_0x268277['push'](_0x268277['shift']());}};_0x5991e2(++_0x33ab3e);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'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['show']);router[_0x0baf('0xd')]('/',auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0xf')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x11')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);module[_0x0baf('0x13')]=router; \ No newline at end of file +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(_0x8dd419,_0x58acff){var _0x4fadf8=function(_0x47a697){while(--_0x47a697){_0x8dd419['push'](_0x8dd419['shift']());}};_0x4fadf8(++_0x58acff);}(_0x0b0e,0x187));var _0xe0b0=function(_0x27ddf5,_0x5a3e18){_0x27ddf5=_0x27ddf5-0x0;var _0x26e74a=_0x0b0e[_0x27ddf5];return _0x26e74a;};'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 diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 0b4a3d5..eda572a 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 _0x2e43=['exports','TEXT','medium','ENUM','out'];(function(_0xea29a7,_0x4beb21){var _0x4737c2=function(_0x3db01c){while(--_0x3db01c){_0xea29a7['push'](_0xea29a7['shift']());}};_0x4737c2(++_0x4beb21);}(_0x2e43,0xaf));var _0x32e4=function(_0x53117f,_0x110cfb){_0x53117f=_0x53117f-0x0;var _0x44820e=_0x2e43[_0x53117f];return _0x44820e;};'use strict';var Sequelize=require('sequelize');module[_0x32e4('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x32e4('0x1')](_0x32e4('0x2')),'allowNull':![]},'direction':{'type':Sequelize[_0x32e4('0x3')]('in',_0x32e4('0x4')),'defaultValue':_0x32e4('0x4'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x32e4('0x1')]}}; \ No newline at end of file +var _0xa606=['TEXT','medium','out','sequelize','exports','STRING'];(function(_0x353340,_0x4ccba7){var _0x5439ec=function(_0x22a2b7){while(--_0x22a2b7){_0x353340['push'](_0x353340['shift']());}};_0x5439ec(++_0x4ccba7);}(_0xa606,0x10b));var _0x6a60=function(_0x5b7ee0,_0x3ae8d8){_0x5b7ee0=_0x5b7ee0-0x0;var _0x3c3548=_0xa606[_0x5b7ee0];return _0x3c3548;};'use strict';var Sequelize=require(_0x6a60('0x0'));module[_0x6a60('0x1')]={'uniqueid':{'type':Sequelize[_0x6a60('0x2')]},'body':{'type':Sequelize[_0x6a60('0x3')](_0x6a60('0x4')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0x6a60('0x5')),'defaultValue':_0x6a60('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x6a60('0x2')]},'providerResponse':{'type':Sequelize[_0x6a60('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 1d70cbe..0828e2a 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 _0x1baf=['count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','fieldName','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','merge','type','filter','options','SquareMessage','include','show','params','keys','rawAttributes','includeAll','create','body','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined'];(function(_0x18d50f,_0x124aff){var _0x8ce385=function(_0x321962){while(--_0x321962){_0x18d50f['push'](_0x18d50f['shift']());}};_0x8ce385(++_0x124aff);}(_0x1baf,0x14e));var _0xf1ba=function(_0x2e0bf0,_0x3a24f8){_0x2e0bf0=_0x2e0bf0-0x0;var _0x4aee15=_0x1baf[_0x2e0bf0];return _0x4aee15;};'use strict';var emlformat=require(_0xf1ba('0x0'));var rimraf=require(_0xf1ba('0x1'));var zipdir=require(_0xf1ba('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf1ba('0x3'));var moment=require(_0xf1ba('0x4'));var BPromise=require(_0xf1ba('0x5'));var Mustache=require(_0xf1ba('0x6'));var util=require(_0xf1ba('0x7'));var path=require(_0xf1ba('0x8'));var sox=require('sox');var csv=require(_0xf1ba('0x9'));var ejs=require(_0xf1ba('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf1ba('0xb'));var crypto=require(_0xf1ba('0xc'));var jsforce=require(_0xf1ba('0xd'));var deskjs=require(_0xf1ba('0xe'));var toCsv=require(_0xf1ba('0x9'));var querystring=require(_0xf1ba('0xf'));var Papa=require(_0xf1ba('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf1ba('0x11'));var hardwareService=require(_0xf1ba('0x12'));var logger=require('../../config/logger')(_0xf1ba('0x13'));var utils=require(_0xf1ba('0x14'));var config=require(_0xf1ba('0x15'));var licenseUtil=require(_0xf1ba('0x16'));var db=require(_0xf1ba('0x17'))['db'];function respondWithStatusCode(_0x298137,_0x4ce634){_0x4ce634=_0x4ce634||0xcc;return function(_0x4db67f){if(_0x4db67f){return _0x298137[_0xf1ba('0x18')](_0x4ce634);}return _0x298137[_0xf1ba('0x19')](_0x4ce634)[_0xf1ba('0x1a')]();};}function respondWithResult(_0x573144,_0x194347){_0x194347=_0x194347||0xc8;return function(_0x1c2616){if(_0x1c2616){return _0x573144[_0xf1ba('0x19')](_0x194347)[_0xf1ba('0x1b')](_0x1c2616);}};}function respondWithFilteredResult(_0x482a6e,_0x313f1b){return function(_0x4fbaf6){if(_0x4fbaf6){var _0x624a9c=typeof _0x313f1b[_0xf1ba('0x1c')]==='undefined'&&typeof _0x313f1b[_0xf1ba('0x1d')]===_0xf1ba('0x1e');var _0xf2847d=_0x4fbaf6['count'];var _0x2ce38c=_0x624a9c?0x0:_0x313f1b[_0xf1ba('0x1c')];var _0x3219df=_0x624a9c?_0x4fbaf6[_0xf1ba('0x1f')]:_0x313f1b[_0xf1ba('0x1c')]+_0x313f1b[_0xf1ba('0x1d')];var _0x13d1d3;if(_0x3219df>=_0xf2847d){_0x3219df=_0xf2847d;_0x13d1d3=0xc8;}else{_0x13d1d3=0xce;}_0x482a6e[_0xf1ba('0x19')](_0x13d1d3);return _0x482a6e[_0xf1ba('0x20')](_0xf1ba('0x21'),_0x2ce38c+'-'+_0x3219df+'/'+_0xf2847d)['json'](_0x4fbaf6);}return null;};}function patchUpdates(_0x11a5c3){return function(_0x3d6f6e){try{jsonpatch['apply'](_0x3d6f6e,_0x11a5c3,!![]);}catch(_0x2f3a44){return BPromise[_0xf1ba('0x22')](_0x2f3a44);}return _0x3d6f6e[_0xf1ba('0x23')]();};}function saveUpdates(_0x48e067,_0x2e9f1f){return function(_0x1e5e7f){if(_0x1e5e7f){return _0x1e5e7f[_0xf1ba('0x24')](_0x48e067)[_0xf1ba('0x25')](function(_0x309c66){return _0x309c66;});}return null;};}function removeEntity(_0x3b5fdd,_0xb94f5){return function(_0x3a2ff6){if(_0x3a2ff6){return _0x3a2ff6[_0xf1ba('0x26')]()[_0xf1ba('0x25')](function(){_0x3b5fdd[_0xf1ba('0x19')](0xcc)[_0xf1ba('0x1a')]();});}};}function handleEntityNotFound(_0x2493f8,_0x429096){return function(_0x5b0881){if(!_0x5b0881){_0x2493f8[_0xf1ba('0x18')](0x194);}return _0x5b0881;};}function handleError(_0x3106f9,_0x9f03ce){_0x9f03ce=_0x9f03ce||0x1f4;return function(_0x3f6c11){logger['error'](_0x3f6c11[_0xf1ba('0x27')]);if(_0x3f6c11[_0xf1ba('0x28')]){delete _0x3f6c11[_0xf1ba('0x28')];}_0x3106f9[_0xf1ba('0x19')](_0x9f03ce)[_0xf1ba('0x29')](_0x3f6c11);};}exports[_0xf1ba('0x2a')]=function(_0xc86008,_0xc755bd){var _0x2988cf={},_0x8971ef={},_0x1dbf7d={'count':0x0,'rows':[]};var _0x34823c=_[_0xf1ba('0x2b')](db['SquareMessage']['rawAttributes'],function(_0x1d8071){return{'name':_0x1d8071[_0xf1ba('0x2c')],'type':_0x1d8071['type'][_0xf1ba('0x2d')]};});_0x8971ef['model']=_['map'](_0x34823c,'name');_0x8971ef[_0xf1ba('0x2e')]=_['keys'](_0xc86008[_0xf1ba('0x2e')]);_0x8971ef[_0xf1ba('0x2f')]=_[_0xf1ba('0x30')](_0x8971ef['model'],_0x8971ef[_0xf1ba('0x2e')]);_0x2988cf[_0xf1ba('0x31')]=_[_0xf1ba('0x30')](_0x8971ef[_0xf1ba('0x32')],qs[_0xf1ba('0x33')](_0xc86008[_0xf1ba('0x2e')][_0xf1ba('0x33')]));_0x2988cf[_0xf1ba('0x31')]=_0x2988cf[_0xf1ba('0x31')][_0xf1ba('0x34')]?_0x2988cf['attributes']:_0x8971ef[_0xf1ba('0x32')];if(!_0xc86008[_0xf1ba('0x2e')][_0xf1ba('0x35')]('nolimit')){_0x2988cf['limit']=qs[_0xf1ba('0x1d')](_0xc86008['query'][_0xf1ba('0x1d')]);_0x2988cf['offset']=qs['offset'](_0xc86008['query']['offset']);}_0x2988cf[_0xf1ba('0x36')]=qs[_0xf1ba('0x37')](_0xc86008['query']['sort']);_0x2988cf[_0xf1ba('0x38')]=qs['filters'](_[_0xf1ba('0x39')](_0xc86008[_0xf1ba('0x2e')],_0x8971ef['filters']),_0x34823c);if(_0xc86008[_0xf1ba('0x2e')]['filter']){_0x2988cf[_0xf1ba('0x38')]=_[_0xf1ba('0x3a')](_0x2988cf[_0xf1ba('0x38')],{'$or':_[_0xf1ba('0x2b')](_0x34823c,function(_0x1b9cd4){if(_0x1b9cd4[_0xf1ba('0x3b')]!=='VIRTUAL'){var _0x750f68={};_0x750f68[_0x1b9cd4[_0xf1ba('0x28')]]={'$like':'%'+_0xc86008[_0xf1ba('0x2e')][_0xf1ba('0x3c')]+'%'};return _0x750f68;}})});}_0x2988cf=_[_0xf1ba('0x3a')]({},_0x2988cf,_0xc86008[_0xf1ba('0x3d')]);var _0x50fb10={'where':_0x2988cf[_0xf1ba('0x38')]};return db[_0xf1ba('0x3e')][_0xf1ba('0x1f')](_0x50fb10)['then'](function(_0x5745bc){_0x1dbf7d[_0xf1ba('0x1f')]=_0x5745bc;if(_0xc86008[_0xf1ba('0x2e')]['includeAll']){_0x2988cf[_0xf1ba('0x3f')]=[{'all':!![]}];}return db[_0xf1ba('0x3e')]['findAll'](_0x2988cf);})['then'](function(_0x16f87f){_0x1dbf7d['rows']=_0x16f87f;return _0x1dbf7d;})[_0xf1ba('0x25')](respondWithFilteredResult(_0xc755bd,_0x2988cf))['catch'](handleError(_0xc755bd,null));};exports[_0xf1ba('0x40')]=function(_0x4a365a,_0x3060c7){var _0x2d75d9={'raw':!![],'where':{'id':_0x4a365a[_0xf1ba('0x41')]['id']}},_0x2afbf4={};_0x2afbf4[_0xf1ba('0x32')]=_[_0xf1ba('0x42')](db[_0xf1ba('0x3e')][_0xf1ba('0x43')]);_0x2afbf4['query']=_['keys'](_0x4a365a[_0xf1ba('0x2e')]);_0x2afbf4['filters']=_['intersection'](_0x2afbf4[_0xf1ba('0x32')],_0x2afbf4[_0xf1ba('0x2e')]);_0x2d75d9[_0xf1ba('0x31')]=_[_0xf1ba('0x30')](_0x2afbf4[_0xf1ba('0x32')],qs[_0xf1ba('0x33')](_0x4a365a[_0xf1ba('0x2e')][_0xf1ba('0x33')]));_0x2d75d9[_0xf1ba('0x31')]=_0x2d75d9[_0xf1ba('0x31')]['length']?_0x2d75d9[_0xf1ba('0x31')]:_0x2afbf4['model'];if(_0x4a365a['query'][_0xf1ba('0x44')]){_0x2d75d9[_0xf1ba('0x3f')]=[{'all':!![]}];}_0x2d75d9=_[_0xf1ba('0x3a')]({},_0x2d75d9,_0x4a365a[_0xf1ba('0x3d')]);return db[_0xf1ba('0x3e')]['find'](_0x2d75d9)[_0xf1ba('0x25')](handleEntityNotFound(_0x3060c7,null))[_0xf1ba('0x25')](respondWithResult(_0x3060c7,null))['catch'](handleError(_0x3060c7,null));};exports[_0xf1ba('0x45')]=function(_0x30a01a,_0x4ca6de){return db[_0xf1ba('0x3e')][_0xf1ba('0x45')](_0x30a01a[_0xf1ba('0x46')],{})[_0xf1ba('0x25')](respondWithResult(_0x4ca6de,0xc9))['catch'](handleError(_0x4ca6de,null));};exports[_0xf1ba('0x24')]=function(_0x3bb1ea,_0xfc74bf){if(_0x3bb1ea[_0xf1ba('0x46')]['id']){delete _0x3bb1ea[_0xf1ba('0x46')]['id'];}return db['SquareMessage'][_0xf1ba('0x47')]({'where':{'id':_0x3bb1ea[_0xf1ba('0x41')]['id']}})[_0xf1ba('0x25')](handleEntityNotFound(_0xfc74bf,null))['then'](saveUpdates(_0x3bb1ea['body'],null))[_0xf1ba('0x25')](respondWithResult(_0xfc74bf,null))['catch'](handleError(_0xfc74bf,null));};exports['destroy']=function(_0x59f764,_0x195570){return db[_0xf1ba('0x3e')]['find']({'where':{'id':_0x59f764['params']['id']}})[_0xf1ba('0x25')](handleEntityNotFound(_0x195570,null))[_0xf1ba('0x25')](removeEntity(_0x195570,null))[_0xf1ba('0x48')](handleError(_0x195570,null));}; \ No newline at end of file +var _0xb694=['fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','end','error','stack','name','send','map','SquareMessage','rawAttributes','type','model','query','intersection','fields','attributes','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','keys','includeAll','find','create','body','destroy','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x260004,_0x5cb01c){var _0x51d2c7=function(_0x527918){while(--_0x527918){_0x260004['push'](_0x260004['shift']());}};_0x51d2c7(++_0x5cb01c);}(_0xb694,0x1ef));var _0x4b69=function(_0x390d77,_0x327b7f){_0x390d77=_0x390d77-0x0;var _0xb95abd=_0xb694[_0x390d77];return _0xb95abd;};'use strict';var emlformat=require(_0x4b69('0x0'));var rimraf=require(_0x4b69('0x1'));var zipdir=require(_0x4b69('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4b69('0x3'));var BPromise=require(_0x4b69('0x4'));var Mustache=require(_0x4b69('0x5'));var util=require('util');var path=require(_0x4b69('0x6'));var sox=require(_0x4b69('0x7'));var csv=require(_0x4b69('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4b69('0x9'));var _=require(_0x4b69('0xa'));var squel=require(_0x4b69('0xb'));var crypto=require(_0x4b69('0xc'));var jsforce=require(_0x4b69('0xd'));var deskjs=require(_0x4b69('0xe'));var toCsv=require(_0x4b69('0x8'));var querystring=require(_0x4b69('0xf'));var Papa=require('papaparse');var Redis=require(_0x4b69('0x10'));var authService=require(_0x4b69('0x11'));var qs=require(_0x4b69('0x12'));var as=require(_0x4b69('0x13'));var hardwareService=require(_0x4b69('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x4b69('0x15'));var config=require(_0x4b69('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a1e1a,_0x124ec9){_0x124ec9=_0x124ec9||0xcc;return function(_0x1682b5){if(_0x1682b5){return _0x2a1e1a[_0x4b69('0x17')](_0x124ec9);}return _0x2a1e1a[_0x4b69('0x18')](_0x124ec9)['end']();};}function respondWithResult(_0x3048c7,_0x2847d3){_0x2847d3=_0x2847d3||0xc8;return function(_0x2077d5){if(_0x2077d5){return _0x3048c7[_0x4b69('0x18')](_0x2847d3)['json'](_0x2077d5);}};}function respondWithFilteredResult(_0x39065e,_0x23c106){return function(_0x2a330f){if(_0x2a330f){var _0x123e7c=typeof _0x23c106[_0x4b69('0x19')]===_0x4b69('0x1a')&&typeof _0x23c106[_0x4b69('0x1b')]==='undefined';var _0x303049=_0x2a330f[_0x4b69('0x1c')];var _0x348181=_0x123e7c?0x0:_0x23c106[_0x4b69('0x19')];var _0x387a3e=_0x123e7c?_0x2a330f[_0x4b69('0x1c')]:_0x23c106[_0x4b69('0x19')]+_0x23c106['limit'];var _0x59467f;if(_0x387a3e>=_0x303049){_0x387a3e=_0x303049;_0x59467f=0xc8;}else{_0x59467f=0xce;}_0x39065e['status'](_0x59467f);return _0x39065e['set'](_0x4b69('0x1d'),_0x348181+'-'+_0x387a3e+'/'+_0x303049)[_0x4b69('0x1e')](_0x2a330f);}return null;};}function patchUpdates(_0x213899){return function(_0x34b7ee){try{jsonpatch[_0x4b69('0x1f')](_0x34b7ee,_0x213899,!![]);}catch(_0x877f64){return BPromise[_0x4b69('0x20')](_0x877f64);}return _0x34b7ee[_0x4b69('0x21')]();};}function saveUpdates(_0x43af06,_0x379da9){return function(_0x94fe73){if(_0x94fe73){return _0x94fe73[_0x4b69('0x22')](_0x43af06)['then'](function(_0x56889b){return _0x56889b;});}return null;};}function removeEntity(_0x4d34db,_0x190cfc){return function(_0x4129b3){if(_0x4129b3){return _0x4129b3['destroy']()[_0x4b69('0x23')](function(){_0x4d34db[_0x4b69('0x18')](0xcc)[_0x4b69('0x24')]();});}};}function handleEntityNotFound(_0x40e5d4,_0x54c7b3){return function(_0x3dfcc6){if(!_0x3dfcc6){_0x40e5d4[_0x4b69('0x17')](0x194);}return _0x3dfcc6;};}function handleError(_0x4b3e54,_0x4e0b82){_0x4e0b82=_0x4e0b82||0x1f4;return function(_0x67027e){logger[_0x4b69('0x25')](_0x67027e[_0x4b69('0x26')]);if(_0x67027e[_0x4b69('0x27')]){delete _0x67027e['name'];}_0x4b3e54[_0x4b69('0x18')](_0x4e0b82)[_0x4b69('0x28')](_0x67027e);};}exports['index']=function(_0x363f76,_0x2f2409){var _0x4c71ab={},_0x4893bf={},_0x351273={'count':0x0,'rows':[]};var _0x4cea32=_[_0x4b69('0x29')](db[_0x4b69('0x2a')][_0x4b69('0x2b')],function(_0x116821){return{'name':_0x116821['fieldName'],'type':_0x116821[_0x4b69('0x2c')]['key']};});_0x4893bf[_0x4b69('0x2d')]=_[_0x4b69('0x29')](_0x4cea32,_0x4b69('0x27'));_0x4893bf[_0x4b69('0x2e')]=_['keys'](_0x363f76[_0x4b69('0x2e')]);_0x4893bf['filters']=_[_0x4b69('0x2f')](_0x4893bf[_0x4b69('0x2d')],_0x4893bf[_0x4b69('0x2e')]);_0x4c71ab['attributes']=_['intersection'](_0x4893bf['model'],qs[_0x4b69('0x30')](_0x363f76['query'][_0x4b69('0x30')]));_0x4c71ab[_0x4b69('0x31')]=_0x4c71ab[_0x4b69('0x31')]['length']?_0x4c71ab[_0x4b69('0x31')]:_0x4893bf[_0x4b69('0x2d')];if(!_0x363f76['query']['hasOwnProperty'](_0x4b69('0x32'))){_0x4c71ab[_0x4b69('0x1b')]=qs[_0x4b69('0x1b')](_0x363f76[_0x4b69('0x2e')][_0x4b69('0x1b')]);_0x4c71ab['offset']=qs['offset'](_0x363f76[_0x4b69('0x2e')][_0x4b69('0x19')]);}_0x4c71ab[_0x4b69('0x33')]=qs[_0x4b69('0x34')](_0x363f76[_0x4b69('0x2e')][_0x4b69('0x34')]);_0x4c71ab[_0x4b69('0x35')]=qs['filters'](_[_0x4b69('0x36')](_0x363f76['query'],_0x4893bf[_0x4b69('0x37')]),_0x4cea32);if(_0x363f76[_0x4b69('0x2e')][_0x4b69('0x38')]){_0x4c71ab[_0x4b69('0x35')]=_[_0x4b69('0x39')](_0x4c71ab[_0x4b69('0x35')],{'$or':_[_0x4b69('0x29')](_0x4cea32,function(_0x3dd8d0){if(_0x3dd8d0[_0x4b69('0x2c')]!==_0x4b69('0x3a')){var _0x15db55={};_0x15db55[_0x3dd8d0[_0x4b69('0x27')]]={'$like':'%'+_0x363f76['query']['filter']+'%'};return _0x15db55;}})});}_0x4c71ab=_['merge']({},_0x4c71ab,_0x363f76[_0x4b69('0x3b')]);var _0x44a82a={'where':_0x4c71ab[_0x4b69('0x35')]};return db['SquareMessage'][_0x4b69('0x1c')](_0x44a82a)['then'](function(_0x413873){_0x351273[_0x4b69('0x1c')]=_0x413873;if(_0x363f76[_0x4b69('0x2e')]['includeAll']){_0x4c71ab[_0x4b69('0x3c')]=[{'all':!![]}];}return db[_0x4b69('0x2a')][_0x4b69('0x3d')](_0x4c71ab);})[_0x4b69('0x23')](function(_0x2a6fe9){_0x351273[_0x4b69('0x3e')]=_0x2a6fe9;return _0x351273;})[_0x4b69('0x23')](respondWithFilteredResult(_0x2f2409,_0x4c71ab))[_0x4b69('0x3f')](handleError(_0x2f2409,null));};exports[_0x4b69('0x40')]=function(_0x236af9,_0x2658c3){var _0x59f2e1={'raw':!![],'where':{'id':_0x236af9['params']['id']}},_0x1057f4={};_0x1057f4['model']=_[_0x4b69('0x41')](db[_0x4b69('0x2a')]['rawAttributes']);_0x1057f4[_0x4b69('0x2e')]=_[_0x4b69('0x41')](_0x236af9[_0x4b69('0x2e')]);_0x1057f4[_0x4b69('0x37')]=_[_0x4b69('0x2f')](_0x1057f4[_0x4b69('0x2d')],_0x1057f4[_0x4b69('0x2e')]);_0x59f2e1[_0x4b69('0x31')]=_[_0x4b69('0x2f')](_0x1057f4[_0x4b69('0x2d')],qs[_0x4b69('0x30')](_0x236af9['query']['fields']));_0x59f2e1[_0x4b69('0x31')]=_0x59f2e1[_0x4b69('0x31')]['length']?_0x59f2e1[_0x4b69('0x31')]:_0x1057f4['model'];if(_0x236af9[_0x4b69('0x2e')][_0x4b69('0x42')]){_0x59f2e1[_0x4b69('0x3c')]=[{'all':!![]}];}_0x59f2e1=_['merge']({},_0x59f2e1,_0x236af9[_0x4b69('0x3b')]);return db['SquareMessage'][_0x4b69('0x43')](_0x59f2e1)[_0x4b69('0x23')](handleEntityNotFound(_0x2658c3,null))[_0x4b69('0x23')](respondWithResult(_0x2658c3,null))[_0x4b69('0x3f')](handleError(_0x2658c3,null));};exports['create']=function(_0x19ac5,_0x493156){return db[_0x4b69('0x2a')][_0x4b69('0x44')](_0x19ac5[_0x4b69('0x45')],{})['then'](respondWithResult(_0x493156,0xc9))[_0x4b69('0x3f')](handleError(_0x493156,null));};exports['update']=function(_0x265a46,_0x5851d8){if(_0x265a46['body']['id']){delete _0x265a46[_0x4b69('0x45')]['id'];}return db[_0x4b69('0x2a')]['find']({'where':{'id':_0x265a46['params']['id']}})[_0x4b69('0x23')](handleEntityNotFound(_0x5851d8,null))[_0x4b69('0x23')](saveUpdates(_0x265a46[_0x4b69('0x45')],null))[_0x4b69('0x23')](respondWithResult(_0x5851d8,null))['catch'](handleError(_0x5851d8,null));};exports[_0x4b69('0x46')]=function(_0x489405,_0x3f44b1){return db[_0x4b69('0x2a')][_0x4b69('0x43')]({'where':{'id':_0x489405[_0x4b69('0x47')]['id']}})[_0x4b69('0x23')](handleEntityNotFound(_0x3f44b1,null))[_0x4b69('0x23')](removeEntity(_0x3f44b1,null))[_0x4b69('0x3f')](handleError(_0x3f44b1,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index d5b32dd..5c3e172 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 _0xd803=['moment','request-promise','path','rimraf','./squareMessage.attributes','exports','define','SquareMessage','lodash','util','../../config/logger'];(function(_0x40b7ec,_0x307707){var _0x72b976=function(_0x5bfcc3){while(--_0x5bfcc3){_0x40b7ec['push'](_0x40b7ec['shift']());}};_0x72b976(++_0x307707);}(_0xd803,0x1ec));var _0x3d80=function(_0x507bce,_0x70b497){_0x507bce=_0x507bce-0x0;var _0x391bee=_0xd803[_0x507bce];return _0x391bee;};'use strict';var _=require(_0x3d80('0x0'));var util=require(_0x3d80('0x1'));var logger=require(_0x3d80('0x2'))('api');var moment=require(_0x3d80('0x3'));var BPromise=require('bluebird');var rp=require(_0x3d80('0x4'));var fs=require('fs');var path=require(_0x3d80('0x5'));var rimraf=require(_0x3d80('0x6'));var config=require('../../config/environment');var attributes=require(_0x3d80('0x7'));module[_0x3d80('0x8')]=function(_0x385fb8,_0x3e08b7){return _0x385fb8[_0x3d80('0x9')](_0x3d80('0xa'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc85d=['rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','util','../../config/logger','api','request-promise','path'];(function(_0x58af8b,_0x31beb7){var _0x56bc0a=function(_0x36e40b){while(--_0x36e40b){_0x58af8b['push'](_0x58af8b['shift']());}};_0x56bc0a(++_0x31beb7);}(_0xc85d,0x192));var _0xdc85=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0xc85d[_0x5627e1];return _0x2f013f;};'use strict';var _=require('lodash');var util=require(_0xdc85('0x0'));var logger=require(_0xdc85('0x1'))(_0xdc85('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdc85('0x3'));var fs=require('fs');var path=require(_0xdc85('0x4'));var rimraf=require(_0xdc85('0x5'));var config=require(_0xdc85('0x6'));var attributes=require(_0xdc85('0x7'));module[_0xdc85('0x8')]=function(_0x3aef2c,_0xe494e9){return _0x3aef2c[_0xdc85('0x9')](_0xdc85('0xa'),attributes,{'tableName':'square_messages','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 8a58ffa..b775418 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 _0x4118=['error','message','result','catch','CreateSquareMessage','create','body','options','raw','then','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x469a3c,_0x5ebc10){var _0x968f4=function(_0x22403b){while(--_0x22403b){_0x469a3c['push'](_0x469a3c['shift']());}};_0x968f4(++_0x5ebc10);}(_0x4118,0x11d));var _0x8411=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x4118[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require('lodash');var util=require(_0x8411('0x0'));var moment=require(_0x8411('0x1'));var BPromise=require(_0x8411('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8411('0x3'));var db=require(_0x8411('0x4'))['db'];var utils=require(_0x8411('0x5'));var logger=require('../../config/logger')(_0x8411('0x6'));var config=require(_0x8411('0x7'));var jayson=require(_0x8411('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c25a0,_0x1f275d,_0xd30848){return new BPromise(function(_0x58cd35,_0x3b5d71){return client[_0x8411('0x9')](_0x2c25a0,_0xd30848)['then'](function(_0x380731){logger[_0x8411('0xa')](_0x8411('0xb'),_0x1f275d,_0x8411('0xc'));logger[_0x8411('0xd')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x1f275d,_0x8411('0xc'),JSON[_0x8411('0xe')](_0x380731));if(_0x380731[_0x8411('0xf')]){if(_0x380731[_0x8411('0xf')]['code']===0x1f4){logger[_0x8411('0xf')](_0x8411('0xb'),_0x1f275d,_0x380731[_0x8411('0xf')][_0x8411('0x10')]);return _0x3b5d71(_0x380731['error'][_0x8411('0x10')]);}logger[_0x8411('0xf')]('SquareMessage,\x20%s,\x20%s',_0x1f275d,_0x380731[_0x8411('0xf')][_0x8411('0x10')]);return _0x58cd35(_0x380731[_0x8411('0xf')][_0x8411('0x10')]);}else{logger[_0x8411('0xa')]('SquareMessage,\x20%s,\x20%s',_0x1f275d,_0x8411('0xc'));_0x58cd35(_0x380731[_0x8411('0x11')][_0x8411('0x10')]);}})[_0x8411('0x12')](function(_0x3f8210){logger['error'](_0x8411('0xb'),_0x1f275d,_0x3f8210);_0x3b5d71(_0x3f8210);});});}exports[_0x8411('0x13')]=function(_0x2e43ec){var _0x21c8a9=this;return new Promise(function(_0x557850,_0xa8420d){return db['SquareMessage'][_0x8411('0x14')](_0x2e43ec[_0x8411('0x15')],{'raw':_0x2e43ec[_0x8411('0x16')]?_0x2e43ec[_0x8411('0x16')][_0x8411('0x17')]===undefined?!![]:![]:!![]})[_0x8411('0x18')](function(_0x154b74){logger[_0x8411('0xa')]('CreateSquareMessage',_0x2e43ec);logger[_0x8411('0xd')]('CreateSquareMessage',_0x2e43ec,JSON[_0x8411('0xe')](_0x154b74));_0x557850(_0x154b74);})[_0x8411('0x12')](function(_0x4923ef){logger[_0x8411('0xf')](_0x8411('0x13'),_0x4923ef[_0x8411('0x10')],_0x2e43ec);_0xa8420d(_0x21c8a9[_0x8411('0xf')](0x1f4,_0x4923ef[_0x8411('0x10')]));});});}; \ No newline at end of file +var _0x1010=['catch','CreateSquareMessage','SquareMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x53f0db,_0x35c67c){var _0xae0a5c=function(_0x4bd6fb){while(--_0x4bd6fb){_0x53f0db['push'](_0x53f0db['shift']());}};_0xae0a5c(++_0x35c67c);}(_0x1010,0x9e));var _0x0101=function(_0x22b8a3,_0x2a79a7){_0x22b8a3=_0x22b8a3-0x0;var _0x199a0c=_0x1010[_0x22b8a3];return _0x199a0c;};'use strict';var _=require(_0x0101('0x0'));var util=require(_0x0101('0x1'));var moment=require(_0x0101('0x2'));var BPromise=require(_0x0101('0x3'));var rs=require(_0x0101('0x4'));var fs=require('fs');var Redis=require(_0x0101('0x5'));var db=require(_0x0101('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0101('0x7'))(_0x0101('0x8'));var config=require(_0x0101('0x9'));var jayson=require(_0x0101('0xa'));var client=jayson[_0x0101('0xb')][_0x0101('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x595a7e,_0x41dc6d,_0x1ef034){return new BPromise(function(_0x5c4eb8,_0x8c183e){return client['request'](_0x595a7e,_0x1ef034)[_0x0101('0xd')](function(_0x201166){logger['info'](_0x0101('0xe'),_0x41dc6d,_0x0101('0xf'));logger[_0x0101('0x10')](_0x0101('0x11'),_0x41dc6d,_0x0101('0xf'),JSON['stringify'](_0x201166));if(_0x201166[_0x0101('0x12')]){if(_0x201166['error'][_0x0101('0x13')]===0x1f4){logger[_0x0101('0x12')](_0x0101('0xe'),_0x41dc6d,_0x201166[_0x0101('0x12')][_0x0101('0x14')]);return _0x8c183e(_0x201166['error'][_0x0101('0x14')]);}logger[_0x0101('0x12')](_0x0101('0xe'),_0x41dc6d,_0x201166['error'][_0x0101('0x14')]);return _0x5c4eb8(_0x201166[_0x0101('0x12')][_0x0101('0x14')]);}else{logger[_0x0101('0x15')](_0x0101('0xe'),_0x41dc6d,_0x0101('0xf'));_0x5c4eb8(_0x201166['result'][_0x0101('0x14')]);}})[_0x0101('0x16')](function(_0xf2233c){logger[_0x0101('0x12')]('SquareMessage,\x20%s,\x20%s',_0x41dc6d,_0xf2233c);_0x8c183e(_0xf2233c);});});}exports[_0x0101('0x17')]=function(_0x599ca1){var _0x260978=this;return new Promise(function(_0x4a4513,_0x8e5d1e){return db[_0x0101('0x18')][_0x0101('0x19')](_0x599ca1[_0x0101('0x1a')],{'raw':_0x599ca1[_0x0101('0x1b')]?_0x599ca1[_0x0101('0x1b')][_0x0101('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x2ccc37){logger[_0x0101('0x15')](_0x0101('0x17'),_0x599ca1);logger[_0x0101('0x10')](_0x0101('0x17'),_0x599ca1,JSON[_0x0101('0x1d')](_0x2ccc37));_0x4a4513(_0x2ccc37);})[_0x0101('0x16')](function(_0x3fb029){logger[_0x0101('0x12')](_0x0101('0x17'),_0x3fb029['message'],_0x599ca1);_0x8e5d1e(_0x260978[_0x0101('0x12')](0x1f4,_0x3fb029['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 7d339ef..40dec9c 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 _0x7c86=['util','path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','/:id','show','/:id/test','15s','test','post','create','update','multer'];(function(_0x1c7be1,_0x207364){var _0x39f3b5=function(_0x4b88fa){while(--_0x4b88fa){_0x1c7be1['push'](_0x1c7be1['shift']());}};_0x39f3b5(++_0x207364);}(_0x7c86,0xfe));var _0x67c8=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x7c86[_0x1deb03];return _0x189fe7;};'use strict';var multer=require(_0x67c8('0x0'));var util=require(_0x67c8('0x1'));var path=require(_0x67c8('0x2'));var timeout=require(_0x67c8('0x3'));var express=require(_0x67c8('0x4'));var router=express['Router']();var fs_extra=require(_0x67c8('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x67c8('0x6'));var controller=require('./squareOdbc.controller');router[_0x67c8('0x7')]('/',auth[_0x67c8('0x8')](),controller['index']);router[_0x67c8('0x7')](_0x67c8('0x9'),auth[_0x67c8('0x8')](),controller[_0x67c8('0xa')]);router[_0x67c8('0x7')](_0x67c8('0xb'),auth['isAuthenticated'](),timeout(_0x67c8('0xc')),controller[_0x67c8('0xd')]);router[_0x67c8('0xe')]('/',auth[_0x67c8('0x8')](),controller[_0x67c8('0xf')]);router['put'](_0x67c8('0x9'),auth[_0x67c8('0x8')](),controller[_0x67c8('0x10')]);router['delete'](_0x67c8('0x9'),auth[_0x67c8('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xce35=['isAuthenticated','index','/:id','show','/:id/test','15s','post','create','put','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get'];(function(_0x52c57d,_0x5dfc48){var _0x396c26=function(_0x42c546){while(--_0x42c546){_0x52c57d['push'](_0x52c57d['shift']());}};_0x396c26(++_0x5dfc48);}(_0xce35,0x11b));var _0x5ce3=function(_0x2e1f5e,_0x52de01){_0x2e1f5e=_0x2e1f5e-0x0;var _0x3812b0=_0xce35[_0x2e1f5e];return _0x3812b0;};'use strict';var multer=require(_0x5ce3('0x0'));var util=require('util');var path=require(_0x5ce3('0x1'));var timeout=require(_0x5ce3('0x2'));var express=require(_0x5ce3('0x3'));var router=express[_0x5ce3('0x4')]();var fs_extra=require(_0x5ce3('0x5'));var auth=require(_0x5ce3('0x6'));var interaction=require(_0x5ce3('0x7'));var config=require(_0x5ce3('0x8'));var controller=require(_0x5ce3('0x9'));router[_0x5ce3('0xa')]('/',auth[_0x5ce3('0xb')](),controller[_0x5ce3('0xc')]);router['get'](_0x5ce3('0xd'),auth[_0x5ce3('0xb')](),controller[_0x5ce3('0xe')]);router[_0x5ce3('0xa')](_0x5ce3('0xf'),auth[_0x5ce3('0xb')](),timeout(_0x5ce3('0x10')),controller['test']);router[_0x5ce3('0x11')]('/',auth[_0x5ce3('0xb')](),controller[_0x5ce3('0x12')]);router[_0x5ce3('0x13')](_0x5ce3('0xd'),auth[_0x5ce3('0xb')](),controller['update']);router['delete'](_0x5ce3('0xd'),auth[_0x5ce3('0xb')](),controller['destroy']);module[_0x5ce3('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 6a3e0bf..907f723 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 _0x9915=['exports','name','STRING'];(function(_0xdbdf1f,_0x251367){var _0x2c1e81=function(_0x29db7d){while(--_0x29db7d){_0xdbdf1f['push'](_0xdbdf1f['shift']());}};_0x2c1e81(++_0x251367);}(_0x9915,0x195));var _0x5991=function(_0xc10cad,_0xb71e2d){_0xc10cad=_0xc10cad-0x0;var _0x2777a0=_0x9915[_0xc10cad];return _0x2777a0;};'use strict';var Sequelize=require('sequelize');module[_0x5991('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x5991('0x1'),'allowNull':![]},'dsn':{'type':Sequelize[_0x5991('0x2')]},'description':{'type':Sequelize[_0x5991('0x2')]}}; \ No newline at end of file +var _0x5594=['STRING','name','sequelize','exports'];(function(_0x3f3de4,_0x4cc947){var _0x34e5eb=function(_0x5e09a3){while(--_0x5e09a3){_0x3f3de4['push'](_0x3f3de4['shift']());}};_0x34e5eb(++_0x4cc947);}(_0x5594,0xea));var _0x4559=function(_0x2bbb49,_0x13bc74){_0x2bbb49=_0x2bbb49-0x0;var _0x276690=_0x5594[_0x2bbb49];return _0x276690;};'use strict';var Sequelize=require(_0x4559('0x0'));module[_0x4559('0x1')]={'name':{'type':Sequelize[_0x4559('0x2')],'unique':_0x4559('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x4559('0x2')]},'description':{'type':Sequelize[_0x4559('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index b5b2c4f..9fac769 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 _0x92b0=['lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','set','Content-Range','apply','update','then','destroy','ODBC','sendStatus','error','stack','name','send','SquareOdbc','rawAttributes','type','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','UserProfileResource','body','find','test','dsn','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x92b0,0x99));var _0x092b=function(_0x4802d9,_0x22d551){_0x4802d9=_0x4802d9-0x0;var _0x385c24=_0x92b0[_0x4802d9];return _0x385c24;};'use strict';var emlformat=require(_0x092b('0x0'));var rimraf=require(_0x092b('0x1'));var zipdir=require(_0x092b('0x2'));var jsonpatch=require(_0x092b('0x3'));var rp=require('request-promise');var moment=require(_0x092b('0x4'));var BPromise=require(_0x092b('0x5'));var Mustache=require(_0x092b('0x6'));var util=require('util');var path=require(_0x092b('0x7'));var sox=require(_0x092b('0x8'));var csv=require(_0x092b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x092b('0xa'));var _=require(_0x092b('0xb'));var squel=require(_0x092b('0xc'));var crypto=require(_0x092b('0xd'));var jsforce=require(_0x092b('0xe'));var deskjs=require(_0x092b('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x092b('0x10'));var Redis=require(_0x092b('0x11'));var authService=require(_0x092b('0x12'));var qs=require(_0x092b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x092b('0x14'))('api');var utils=require(_0x092b('0x15'));var config=require(_0x092b('0x16'));var licenseUtil=require(_0x092b('0x17'));var db=require(_0x092b('0x18'))['db'];function respondWithStatusCode(_0x473dd2,_0x17ba30){_0x17ba30=_0x17ba30||0xcc;return function(_0x288c96){if(_0x288c96){return _0x473dd2['sendStatus'](_0x17ba30);}return _0x473dd2[_0x092b('0x19')](_0x17ba30)[_0x092b('0x1a')]();};}function respondWithResult(_0x121a31,_0x51f285){_0x51f285=_0x51f285||0xc8;return function(_0x235d9f){if(_0x235d9f){return _0x121a31[_0x092b('0x19')](_0x51f285)[_0x092b('0x1b')](_0x235d9f);}};}function respondWithFilteredResult(_0x54b456,_0x1b228a){return function(_0x52a01a){if(_0x52a01a){var _0x387c79=typeof _0x1b228a['offset']===_0x092b('0x1c')&&typeof _0x1b228a[_0x092b('0x1d')]===_0x092b('0x1c');var _0x2ef082=_0x52a01a['count'];var _0x1e529e=_0x387c79?0x0:_0x1b228a[_0x092b('0x1e')];var _0x4415b9=_0x387c79?_0x52a01a['count']:_0x1b228a[_0x092b('0x1e')]+_0x1b228a[_0x092b('0x1d')];var _0x1dc80d;if(_0x4415b9>=_0x2ef082){_0x4415b9=_0x2ef082;_0x1dc80d=0xc8;}else{_0x1dc80d=0xce;}_0x54b456[_0x092b('0x19')](_0x1dc80d);return _0x54b456[_0x092b('0x1f')](_0x092b('0x20'),_0x1e529e+'-'+_0x4415b9+'/'+_0x2ef082)[_0x092b('0x1b')](_0x52a01a);}return null;};}function patchUpdates(_0x4fc2b6){return function(_0x2e0b30){try{jsonpatch[_0x092b('0x21')](_0x2e0b30,_0x4fc2b6,!![]);}catch(_0x2f33c2){return BPromise['reject'](_0x2f33c2);}return _0x2e0b30['save']();};}function saveUpdates(_0x2a0603,_0x200e1e){return function(_0x115cee){if(_0x115cee){return _0x115cee[_0x092b('0x22')](_0x2a0603)[_0x092b('0x23')](function(_0x4bdc7f){return _0x4bdc7f;});}return null;};}function removeEntity(_0x35ecb3,_0x2a0901){return function(_0x52ad6f){if(_0x52ad6f){return _0x52ad6f[_0x092b('0x24')]()['then'](function(){var _0x217d95=_0x52ad6f['get']({'plain':!![]});var _0x5cc3c1=_0x092b('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x5cc3c1,'resourceId':_0x217d95['id']}})['then'](function(){return _0x52ad6f;});})[_0x092b('0x23')](function(){_0x35ecb3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x47a8ae,_0x41b69f){return function(_0x46d656){if(!_0x46d656){_0x47a8ae[_0x092b('0x26')](0x194);}return _0x46d656;};}function handleError(_0x586a49,_0x106681){_0x106681=_0x106681||0x1f4;return function(_0x180157){logger[_0x092b('0x27')](_0x180157[_0x092b('0x28')]);if(_0x180157[_0x092b('0x29')]){delete _0x180157['name'];}_0x586a49[_0x092b('0x19')](_0x106681)[_0x092b('0x2a')](_0x180157);};}exports['index']=function(_0x12393f,_0x633521){var _0x58947d={},_0x13cc8a={},_0xd6d174={'count':0x0,'rows':[]};var _0xd42ed6=_['map'](db[_0x092b('0x2b')][_0x092b('0x2c')],function(_0x4fe4c2){return{'name':_0x4fe4c2['fieldName'],'type':_0x4fe4c2[_0x092b('0x2d')]['key']};});_0x13cc8a[_0x092b('0x2e')]=_[_0x092b('0x2f')](_0xd42ed6,_0x092b('0x29'));_0x13cc8a['query']=_[_0x092b('0x30')](_0x12393f[_0x092b('0x31')]);_0x13cc8a[_0x092b('0x32')]=_[_0x092b('0x33')](_0x13cc8a[_0x092b('0x2e')],_0x13cc8a[_0x092b('0x31')]);_0x58947d[_0x092b('0x34')]=_[_0x092b('0x33')](_0x13cc8a['model'],qs[_0x092b('0x35')](_0x12393f[_0x092b('0x31')][_0x092b('0x35')]));_0x58947d[_0x092b('0x34')]=_0x58947d[_0x092b('0x34')][_0x092b('0x36')]?_0x58947d[_0x092b('0x34')]:_0x13cc8a[_0x092b('0x2e')];if(!_0x12393f['query'][_0x092b('0x37')]('nolimit')){_0x58947d[_0x092b('0x1d')]=qs[_0x092b('0x1d')](_0x12393f[_0x092b('0x31')][_0x092b('0x1d')]);_0x58947d[_0x092b('0x1e')]=qs['offset'](_0x12393f[_0x092b('0x31')][_0x092b('0x1e')]);}_0x58947d['order']=qs['sort'](_0x12393f['query'][_0x092b('0x38')]);_0x58947d[_0x092b('0x39')]=qs[_0x092b('0x32')](_[_0x092b('0x3a')](_0x12393f[_0x092b('0x31')],_0x13cc8a[_0x092b('0x32')]),_0xd42ed6);if(_0x12393f[_0x092b('0x31')]['filter']){_0x58947d['where']=_[_0x092b('0x3b')](_0x58947d[_0x092b('0x39')],{'$or':_['map'](_0xd42ed6,function(_0x439bd9){if(_0x439bd9[_0x092b('0x2d')]!==_0x092b('0x3c')){var _0x331dcd={};_0x331dcd[_0x439bd9['name']]={'$like':'%'+_0x12393f['query']['filter']+'%'};return _0x331dcd;}})});}_0x58947d=_[_0x092b('0x3b')]({},_0x58947d,_0x12393f[_0x092b('0x3d')]);var _0x45723c={'where':_0x58947d[_0x092b('0x39')]};return db[_0x092b('0x2b')][_0x092b('0x3e')](_0x45723c)['then'](function(_0x2035c9){_0xd6d174[_0x092b('0x3e')]=_0x2035c9;if(_0x12393f['query'][_0x092b('0x3f')]){_0x58947d[_0x092b('0x40')]=[{'all':!![]}];}return db[_0x092b('0x2b')][_0x092b('0x41')](_0x58947d);})[_0x092b('0x23')](function(_0x3731bf){_0xd6d174[_0x092b('0x42')]=_0x3731bf;return _0xd6d174;})[_0x092b('0x23')](respondWithFilteredResult(_0x633521,_0x58947d))[_0x092b('0x43')](handleError(_0x633521,null));};exports['show']=function(_0x154d6a,_0x2a8484){var _0x256a70={'raw':!![],'where':{'id':_0x154d6a[_0x092b('0x44')]['id']}},_0x2a3e1d={};_0x2a3e1d['model']=_[_0x092b('0x30')](db['SquareOdbc'][_0x092b('0x2c')]);_0x2a3e1d[_0x092b('0x31')]=_[_0x092b('0x30')](_0x154d6a[_0x092b('0x31')]);_0x2a3e1d[_0x092b('0x32')]=_[_0x092b('0x33')](_0x2a3e1d[_0x092b('0x2e')],_0x2a3e1d['query']);_0x256a70[_0x092b('0x34')]=_[_0x092b('0x33')](_0x2a3e1d[_0x092b('0x2e')],qs[_0x092b('0x35')](_0x154d6a['query'][_0x092b('0x35')]));_0x256a70[_0x092b('0x34')]=_0x256a70[_0x092b('0x34')][_0x092b('0x36')]?_0x256a70[_0x092b('0x34')]:_0x2a3e1d[_0x092b('0x2e')];if(_0x154d6a[_0x092b('0x31')]['includeAll']){_0x256a70[_0x092b('0x40')]=[{'all':!![]}];}_0x256a70=_[_0x092b('0x3b')]({},_0x256a70,_0x154d6a[_0x092b('0x3d')]);return db['SquareOdbc']['find'](_0x256a70)['then'](handleEntityNotFound(_0x2a8484,null))[_0x092b('0x23')](respondWithResult(_0x2a8484,null))[_0x092b('0x43')](handleError(_0x2a8484,null));};exports[_0x092b('0x45')]=function(_0x37fb35,_0x5442c8){return db[_0x092b('0x2b')]['create'](_0x37fb35['body'],{})[_0x092b('0x23')](function(_0x3cb20c){var _0x1e836e=_0x37fb35[_0x092b('0x46')][_0x092b('0x47')]({'plain':!![]});if(!_0x1e836e)throw new Error(_0x092b('0x48'));if(_0x1e836e[_0x092b('0x49')]===_0x092b('0x46')){var _0x125f8a=_0x3cb20c[_0x092b('0x47')]({'plain':!![]});var _0x3f8702=_0x092b('0x25');return db[_0x092b('0x4a')]['find']({'where':{'name':_0x3f8702,'userProfileId':_0x1e836e['userProfileId']},'raw':!![]})[_0x092b('0x23')](function(_0x1a732e){if(_0x1a732e&&_0x1a732e['autoAssociation']===0x0){return db[_0x092b('0x4b')][_0x092b('0x45')]({'name':_0x125f8a[_0x092b('0x29')],'resourceId':_0x125f8a['id'],'type':_0x1a732e['name'],'sectionId':_0x1a732e['id']},{})[_0x092b('0x23')](function(){return _0x3cb20c;});}else{return _0x3cb20c;}})[_0x092b('0x43')](function(_0x5cdb90){logger[_0x092b('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5cdb90);throw _0x5cdb90;});}return _0x3cb20c;})[_0x092b('0x23')](respondWithResult(_0x5442c8,0xc9))['catch'](handleError(_0x5442c8,null));};exports['update']=function(_0x30610a,_0x2289f5){if(_0x30610a[_0x092b('0x4c')]['id']){delete _0x30610a[_0x092b('0x4c')]['id'];}return db[_0x092b('0x2b')][_0x092b('0x4d')]({'where':{'id':_0x30610a[_0x092b('0x44')]['id']}})[_0x092b('0x23')](handleEntityNotFound(_0x2289f5,null))['then'](saveUpdates(_0x30610a[_0x092b('0x4c')],null))[_0x092b('0x23')](respondWithResult(_0x2289f5,null))[_0x092b('0x43')](handleError(_0x2289f5,null));};exports[_0x092b('0x24')]=function(_0x112cd9,_0x171f6f){return db[_0x092b('0x2b')]['find']({'where':{'id':_0x112cd9[_0x092b('0x44')]['id']}})['then'](handleEntityNotFound(_0x171f6f,null))[_0x092b('0x23')](removeEntity(_0x171f6f,null))['catch'](handleError(_0x171f6f,null));};exports[_0x092b('0x4e')]=function(_0x4c35f8,_0x25247d,_0x5bb769){var _0x3e69b4;return db[_0x092b('0x2b')][_0x092b('0x4d')]({'where':{'id':_0x4c35f8[_0x092b('0x44')]['id']},'attributes':['id',_0x092b('0x4f')]})[_0x092b('0x23')](handleEntityNotFound(_0x25247d,null))[_0x092b('0x23')](function(_0x1a88fb){if(_0x1a88fb){var _0x481e5b=require('odbc')();_0x481e5b[_0x092b('0x50')](_0x1a88fb[_0x092b('0x4f')]);_0x481e5b[_0x092b('0x51')]();return _0x1a88fb;}})[_0x092b('0x23')](respondWithResult(_0x25247d,null))[_0x092b('0x43')](handleError(_0x25247d,null));}; \ No newline at end of file +var _0x681d=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','stack','name','send','map','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','SquareOdbc','includeAll','include','findAll','rows','catch','params','options','find','create','user','role','ODBC','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','test','openSync','dsn','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x365a79,_0x4533f6){var _0x11b49e=function(_0x218554){while(--_0x218554){_0x365a79['push'](_0x365a79['shift']());}};_0x11b49e(++_0x4533f6);}(_0x681d,0x1b7));var _0xd681=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0x681d[_0x455c6c];return _0x488242;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd681('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd681('0x1'));var rp=require(_0xd681('0x2'));var moment=require(_0xd681('0x3'));var BPromise=require(_0xd681('0x4'));var Mustache=require(_0xd681('0x5'));var util=require(_0xd681('0x6'));var path=require(_0xd681('0x7'));var sox=require(_0xd681('0x8'));var csv=require(_0xd681('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd681('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd681('0xb'));var jsforce=require(_0xd681('0xc'));var deskjs=require(_0xd681('0xd'));var toCsv=require(_0xd681('0x9'));var querystring=require(_0xd681('0xe'));var Papa=require(_0xd681('0xf'));var Redis=require(_0xd681('0x10'));var authService=require(_0xd681('0x11'));var qs=require(_0xd681('0x12'));var as=require(_0xd681('0x13'));var hardwareService=require(_0xd681('0x14'));var logger=require(_0xd681('0x15'))(_0xd681('0x16'));var utils=require(_0xd681('0x17'));var config=require(_0xd681('0x18'));var licenseUtil=require(_0xd681('0x19'));var db=require(_0xd681('0x1a'))['db'];function respondWithStatusCode(_0x2dc38d,_0x51c4b2){_0x51c4b2=_0x51c4b2||0xcc;return function(_0x416446){if(_0x416446){return _0x2dc38d[_0xd681('0x1b')](_0x51c4b2);}return _0x2dc38d[_0xd681('0x1c')](_0x51c4b2)[_0xd681('0x1d')]();};}function respondWithResult(_0x36da76,_0x259bdf){_0x259bdf=_0x259bdf||0xc8;return function(_0x30990a){if(_0x30990a){return _0x36da76[_0xd681('0x1c')](_0x259bdf)[_0xd681('0x1e')](_0x30990a);}};}function respondWithFilteredResult(_0x309292,_0x16eaec){return function(_0x27dde6){if(_0x27dde6){var _0x4ee0eb=typeof _0x16eaec[_0xd681('0x1f')]===_0xd681('0x20')&&typeof _0x16eaec[_0xd681('0x21')]===_0xd681('0x20');var _0x2e32c1=_0x27dde6['count'];var _0x334b0c=_0x4ee0eb?0x0:_0x16eaec[_0xd681('0x1f')];var _0x3a8116=_0x4ee0eb?_0x27dde6[_0xd681('0x22')]:_0x16eaec[_0xd681('0x1f')]+_0x16eaec['limit'];var _0x5dc04b;if(_0x3a8116>=_0x2e32c1){_0x3a8116=_0x2e32c1;_0x5dc04b=0xc8;}else{_0x5dc04b=0xce;}_0x309292[_0xd681('0x1c')](_0x5dc04b);return _0x309292[_0xd681('0x23')](_0xd681('0x24'),_0x334b0c+'-'+_0x3a8116+'/'+_0x2e32c1)[_0xd681('0x1e')](_0x27dde6);}return null;};}function patchUpdates(_0x268c17){return function(_0x4ea4a6){try{jsonpatch[_0xd681('0x25')](_0x4ea4a6,_0x268c17,!![]);}catch(_0x4efa3e){return BPromise[_0xd681('0x26')](_0x4efa3e);}return _0x4ea4a6[_0xd681('0x27')]();};}function saveUpdates(_0x132af2,_0x2fe8ee){return function(_0x34af03){if(_0x34af03){return _0x34af03['update'](_0x132af2)[_0xd681('0x28')](function(_0x2067cf){return _0x2067cf;});}return null;};}function removeEntity(_0x58c1a4,_0x18df2a){return function(_0x207c6f){if(_0x207c6f){return _0x207c6f[_0xd681('0x29')]()[_0xd681('0x28')](function(){var _0x53c361=_0x207c6f[_0xd681('0x2a')]({'plain':!![]});var _0x55aacf='ODBC';return db['UserProfileResource'][_0xd681('0x29')]({'where':{'type':_0x55aacf,'resourceId':_0x53c361['id']}})[_0xd681('0x28')](function(){return _0x207c6f;});})['then'](function(){_0x58c1a4['status'](0xcc)[_0xd681('0x1d')]();});}};}function handleEntityNotFound(_0x5d455f,_0x2cc22e){return function(_0xfce498){if(!_0xfce498){_0x5d455f['sendStatus'](0x194);}return _0xfce498;};}function handleError(_0x4e3d1c,_0x3cce2c){_0x3cce2c=_0x3cce2c||0x1f4;return function(_0x1ac41d){logger['error'](_0x1ac41d[_0xd681('0x2b')]);if(_0x1ac41d[_0xd681('0x2c')]){delete _0x1ac41d['name'];}_0x4e3d1c['status'](_0x3cce2c)[_0xd681('0x2d')](_0x1ac41d);};}exports['index']=function(_0x5fba82,_0x3ead2b){var _0x309dbb={},_0x41bf7b={},_0x1e8eec={'count':0x0,'rows':[]};var _0x561dea=_[_0xd681('0x2e')](db['SquareOdbc']['rawAttributes'],function(_0x5160d6){return{'name':_0x5160d6[_0xd681('0x2f')],'type':_0x5160d6[_0xd681('0x30')][_0xd681('0x31')]};});_0x41bf7b['model']=_['map'](_0x561dea,'name');_0x41bf7b[_0xd681('0x32')]=_[_0xd681('0x33')](_0x5fba82[_0xd681('0x32')]);_0x41bf7b[_0xd681('0x34')]=_[_0xd681('0x35')](_0x41bf7b[_0xd681('0x36')],_0x41bf7b[_0xd681('0x32')]);_0x309dbb['attributes']=_['intersection'](_0x41bf7b[_0xd681('0x36')],qs[_0xd681('0x37')](_0x5fba82[_0xd681('0x32')][_0xd681('0x37')]));_0x309dbb[_0xd681('0x38')]=_0x309dbb['attributes'][_0xd681('0x39')]?_0x309dbb[_0xd681('0x38')]:_0x41bf7b[_0xd681('0x36')];if(!_0x5fba82[_0xd681('0x32')][_0xd681('0x3a')](_0xd681('0x3b'))){_0x309dbb[_0xd681('0x21')]=qs[_0xd681('0x21')](_0x5fba82[_0xd681('0x32')][_0xd681('0x21')]);_0x309dbb[_0xd681('0x1f')]=qs[_0xd681('0x1f')](_0x5fba82[_0xd681('0x32')][_0xd681('0x1f')]);}_0x309dbb[_0xd681('0x3c')]=qs[_0xd681('0x3d')](_0x5fba82[_0xd681('0x32')][_0xd681('0x3d')]);_0x309dbb[_0xd681('0x3e')]=qs[_0xd681('0x34')](_[_0xd681('0x3f')](_0x5fba82[_0xd681('0x32')],_0x41bf7b[_0xd681('0x34')]),_0x561dea);if(_0x5fba82[_0xd681('0x32')][_0xd681('0x40')]){_0x309dbb[_0xd681('0x3e')]=_[_0xd681('0x41')](_0x309dbb[_0xd681('0x3e')],{'$or':_[_0xd681('0x2e')](_0x561dea,function(_0x197052){if(_0x197052[_0xd681('0x30')]!==_0xd681('0x42')){var _0x580540={};_0x580540[_0x197052['name']]={'$like':'%'+_0x5fba82[_0xd681('0x32')][_0xd681('0x40')]+'%'};return _0x580540;}})});}_0x309dbb=_['merge']({},_0x309dbb,_0x5fba82['options']);var _0x12299e={'where':_0x309dbb['where']};return db[_0xd681('0x43')][_0xd681('0x22')](_0x12299e)['then'](function(_0x27c90d){_0x1e8eec[_0xd681('0x22')]=_0x27c90d;if(_0x5fba82[_0xd681('0x32')][_0xd681('0x44')]){_0x309dbb[_0xd681('0x45')]=[{'all':!![]}];}return db[_0xd681('0x43')][_0xd681('0x46')](_0x309dbb);})[_0xd681('0x28')](function(_0x15ac4e){_0x1e8eec[_0xd681('0x47')]=_0x15ac4e;return _0x1e8eec;})[_0xd681('0x28')](respondWithFilteredResult(_0x3ead2b,_0x309dbb))[_0xd681('0x48')](handleError(_0x3ead2b,null));};exports['show']=function(_0x5e1559,_0x5b6e5a){var _0x5e3a62={'raw':!![],'where':{'id':_0x5e1559[_0xd681('0x49')]['id']}},_0x3cf740={};_0x3cf740[_0xd681('0x36')]=_['keys'](db[_0xd681('0x43')]['rawAttributes']);_0x3cf740[_0xd681('0x32')]=_['keys'](_0x5e1559[_0xd681('0x32')]);_0x3cf740[_0xd681('0x34')]=_['intersection'](_0x3cf740['model'],_0x3cf740[_0xd681('0x32')]);_0x5e3a62[_0xd681('0x38')]=_[_0xd681('0x35')](_0x3cf740[_0xd681('0x36')],qs[_0xd681('0x37')](_0x5e1559[_0xd681('0x32')][_0xd681('0x37')]));_0x5e3a62['attributes']=_0x5e3a62[_0xd681('0x38')][_0xd681('0x39')]?_0x5e3a62[_0xd681('0x38')]:_0x3cf740['model'];if(_0x5e1559['query'][_0xd681('0x44')]){_0x5e3a62[_0xd681('0x45')]=[{'all':!![]}];}_0x5e3a62=_[_0xd681('0x41')]({},_0x5e3a62,_0x5e1559[_0xd681('0x4a')]);return db[_0xd681('0x43')][_0xd681('0x4b')](_0x5e3a62)[_0xd681('0x28')](handleEntityNotFound(_0x5b6e5a,null))[_0xd681('0x28')](respondWithResult(_0x5b6e5a,null))['catch'](handleError(_0x5b6e5a,null));};exports[_0xd681('0x4c')]=function(_0x45bbb4,_0x3c48ba){return db['SquareOdbc'][_0xd681('0x4c')](_0x45bbb4['body'],{})[_0xd681('0x28')](function(_0xb28718){var _0x2537f5=_0x45bbb4[_0xd681('0x4d')][_0xd681('0x2a')]({'plain':!![]});if(!_0x2537f5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2537f5[_0xd681('0x4e')]===_0xd681('0x4d')){var _0x3c4f58=_0xb28718['get']({'plain':!![]});var _0x5b0c0e=_0xd681('0x4f');return db[_0xd681('0x50')][_0xd681('0x4b')]({'where':{'name':_0x5b0c0e,'userProfileId':_0x2537f5[_0xd681('0x51')]},'raw':!![]})['then'](function(_0x4777b2){if(_0x4777b2&&_0x4777b2[_0xd681('0x52')]===0x0){return db[_0xd681('0x53')]['create']({'name':_0x3c4f58[_0xd681('0x2c')],'resourceId':_0x3c4f58['id'],'type':_0x4777b2['name'],'sectionId':_0x4777b2['id']},{})[_0xd681('0x28')](function(){return _0xb28718;});}else{return _0xb28718;}})[_0xd681('0x48')](function(_0x30662b){logger[_0xd681('0x54')](_0xd681('0x55'),_0x30662b);throw _0x30662b;});}return _0xb28718;})['then'](respondWithResult(_0x3c48ba,0xc9))[_0xd681('0x48')](handleError(_0x3c48ba,null));};exports[_0xd681('0x56')]=function(_0x5a5156,_0x3a2d68){if(_0x5a5156[_0xd681('0x57')]['id']){delete _0x5a5156[_0xd681('0x57')]['id'];}return db['SquareOdbc']['find']({'where':{'id':_0x5a5156[_0xd681('0x49')]['id']}})[_0xd681('0x28')](handleEntityNotFound(_0x3a2d68,null))['then'](saveUpdates(_0x5a5156[_0xd681('0x57')],null))[_0xd681('0x28')](respondWithResult(_0x3a2d68,null))[_0xd681('0x48')](handleError(_0x3a2d68,null));};exports[_0xd681('0x29')]=function(_0x2e1a78,_0x486178){return db[_0xd681('0x43')]['find']({'where':{'id':_0x2e1a78[_0xd681('0x49')]['id']}})[_0xd681('0x28')](handleEntityNotFound(_0x486178,null))[_0xd681('0x28')](removeEntity(_0x486178,null))['catch'](handleError(_0x486178,null));};exports[_0xd681('0x58')]=function(_0x3514fa,_0x4c8cc6,_0x4024aa){var _0x3764d4;return db['SquareOdbc']['find']({'where':{'id':_0x3514fa['params']['id']},'attributes':['id','dsn']})[_0xd681('0x28')](handleEntityNotFound(_0x4c8cc6,null))['then'](function(_0x36e3bc){if(_0x36e3bc){var _0x36f04c=require('odbc')();_0x36f04c[_0xd681('0x59')](_0x36e3bc[_0xd681('0x5a')]);_0x36f04c['closeSync']();return _0x36e3bc;}})['then'](respondWithResult(_0x4c8cc6,null))[_0xd681('0x48')](handleError(_0x4c8cc6,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 930bea8..5f79ef1 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 _0x3d0d=['SquareOdbc','square_odbc','lodash','util','../../config/logger','request-promise','../../config/environment','./squareOdbc.attributes','define'];(function(_0x5c38cd,_0x5a6b4e){var _0xc985ef=function(_0x4aa1df){while(--_0x4aa1df){_0x5c38cd['push'](_0x5c38cd['shift']());}};_0xc985ef(++_0x5a6b4e);}(_0x3d0d,0x92));var _0xd3d0=function(_0x259c80,_0x308ffe){_0x259c80=_0x259c80-0x0;var _0x70ebd4=_0x3d0d[_0x259c80];return _0x70ebd4;};'use strict';var _=require(_0xd3d0('0x0'));var util=require(_0xd3d0('0x1'));var logger=require(_0xd3d0('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd3d0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd3d0('0x4'));var attributes=require(_0xd3d0('0x5'));module['exports']=function(_0x3ae8ef,_0x13d21c){return _0x3ae8ef[_0xd3d0('0x6')](_0xd3d0('0x7'),attributes,{'tableName':_0xd3d0('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x29b4=['moment','bluebird','rimraf','../../config/environment','./squareOdbc.attributes','exports','SquareOdbc','lodash','../../config/logger','api'];(function(_0x4828a8,_0x480b6c){var _0x482723=function(_0x5c059d){while(--_0x5c059d){_0x4828a8['push'](_0x4828a8['shift']());}};_0x482723(++_0x480b6c);}(_0x29b4,0xc5));var _0x429b=function(_0x495e00,_0x3bd8ad){_0x495e00=_0x495e00-0x0;var _0x2c8a49=_0x29b4[_0x495e00];return _0x2c8a49;};'use strict';var _=require(_0x429b('0x0'));var util=require('util');var logger=require(_0x429b('0x1'))(_0x429b('0x2'));var moment=require(_0x429b('0x3'));var BPromise=require(_0x429b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x429b('0x5'));var config=require(_0x429b('0x6'));var attributes=require(_0x429b('0x7'));module[_0x429b('0x8')]=function(_0x35fe37,_0x5a6b02){return _0x35fe37['define'](_0x429b('0x9'),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 3c0bc95..9b3c836 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 _0xe922=['client','http','request','then','info','debug','stringify','error','code','SquareOdbc,\x20%s,\x20%s','message','request\x20sent','result','catch','ShowSquareOdbc','SquareOdbc','options','where','attributes','include','model','map','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x296c8e,_0x3f9799){var _0x5f4808=function(_0x148da3){while(--_0x148da3){_0x296c8e['push'](_0x296c8e['shift']());}};_0x5f4808(++_0x3f9799);}(_0xe922,0xca));var _0x2e92=function(_0x49d7ca,_0x514fc4){_0x49d7ca=_0x49d7ca-0x0;var _0x12422f=_0xe922[_0x49d7ca];return _0x12422f;};'use strict';var _=require(_0x2e92('0x0'));var util=require(_0x2e92('0x1'));var moment=require(_0x2e92('0x2'));var BPromise=require(_0x2e92('0x3'));var rs=require(_0x2e92('0x4'));var fs=require('fs');var Redis=require(_0x2e92('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2e92('0x6'));var logger=require(_0x2e92('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2e92('0x8')][_0x2e92('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e5e92,_0x325dcd,_0x2ab2b7){return new BPromise(function(_0x2efa65,_0x2aee0){return client[_0x2e92('0xa')](_0x2e5e92,_0x2ab2b7)[_0x2e92('0xb')](function(_0x37fba4){logger[_0x2e92('0xc')]('SquareOdbc,\x20%s,\x20%s',_0x325dcd,'request\x20sent');logger[_0x2e92('0xd')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x325dcd,'request\x20sent',JSON[_0x2e92('0xe')](_0x37fba4));if(_0x37fba4[_0x2e92('0xf')]){if(_0x37fba4[_0x2e92('0xf')][_0x2e92('0x10')]===0x1f4){logger['error'](_0x2e92('0x11'),_0x325dcd,_0x37fba4[_0x2e92('0xf')]['message']);return _0x2aee0(_0x37fba4[_0x2e92('0xf')][_0x2e92('0x12')]);}logger[_0x2e92('0xf')]('SquareOdbc,\x20%s,\x20%s',_0x325dcd,_0x37fba4[_0x2e92('0xf')][_0x2e92('0x12')]);return _0x2efa65(_0x37fba4[_0x2e92('0xf')][_0x2e92('0x12')]);}else{logger['info'](_0x2e92('0x11'),_0x325dcd,_0x2e92('0x13'));_0x2efa65(_0x37fba4[_0x2e92('0x14')][_0x2e92('0x12')]);}})[_0x2e92('0x15')](function(_0x34cc4f){logger[_0x2e92('0xf')]('SquareOdbc,\x20%s,\x20%s',_0x325dcd,_0x34cc4f);_0x2aee0(_0x34cc4f);});});}exports[_0x2e92('0x16')]=function(_0x3d9c90){var _0x5b2539=this;return new Promise(function(_0x2ccb82,_0x45f7a9){return db[_0x2e92('0x17')]['find']({'raw':_0x3d9c90[_0x2e92('0x18')]?_0x3d9c90[_0x2e92('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3d9c90['options']?_0x3d9c90[_0x2e92('0x18')][_0x2e92('0x19')]||null:null,'attributes':_0x3d9c90[_0x2e92('0x18')]?_0x3d9c90[_0x2e92('0x18')][_0x2e92('0x1a')]||null:null,'include':_0x3d9c90[_0x2e92('0x18')]?_0x3d9c90['options'][_0x2e92('0x1b')]?_['map'](_0x3d9c90['options'][_0x2e92('0x1b')],function(_0x3b4ba2){return{'model':db[_0x3b4ba2[_0x2e92('0x1c')]],'as':_0x3b4ba2['as'],'attributes':_0x3b4ba2['attributes'],'include':_0x3b4ba2[_0x2e92('0x1b')]?_[_0x2e92('0x1d')](_0x3b4ba2[_0x2e92('0x1b')],function(_0x49b435){return{'model':db[_0x49b435[_0x2e92('0x1c')]],'as':_0x49b435['as'],'attributes':_0x49b435[_0x2e92('0x1a')],'include':_0x49b435[_0x2e92('0x1b')]?_['map'](_0x49b435[_0x2e92('0x1b')],function(_0x2ac1eb){return{'model':db[_0x2ac1eb[_0x2e92('0x1c')]],'as':_0x2ac1eb['as'],'attributes':_0x2ac1eb[_0x2e92('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2e92('0xb')](function(_0x584dd7){logger[_0x2e92('0xc')]('ShowSquareOdbc',_0x3d9c90);logger[_0x2e92('0xd')](_0x2e92('0x16'),_0x3d9c90,JSON['stringify'](_0x584dd7));_0x2ccb82(_0x584dd7);})[_0x2e92('0x15')](function(_0x3f354f){logger['error'](_0x2e92('0x16'),_0x3f354f[_0x2e92('0x12')],_0x3d9c90);_0x45f7a9(_0x5b2539[_0x2e92('0xf')](0x1f4,_0x3f354f[_0x2e92('0x12')]));});});}; \ No newline at end of file +var _0xa540=['options','raw','where','map','include','model','attributes','ShowSquareOdbc','lodash','moment','bluebird','randomstring','../../config/logger','rpc','jayson/promise','client','http','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','SquareOdbc','find'];(function(_0x4d8a97,_0x3d156a){var _0x1b8ddb=function(_0x1c5860){while(--_0x1c5860){_0x4d8a97['push'](_0x4d8a97['shift']());}};_0x1b8ddb(++_0x3d156a);}(_0xa540,0xd3));var _0x0a54=function(_0x56daff,_0xadca9a){_0x56daff=_0x56daff-0x0;var _0x132c82=_0xa540[_0x56daff];return _0x132c82;};'use strict';var _=require(_0x0a54('0x0'));var util=require('util');var moment=require(_0x0a54('0x1'));var BPromise=require(_0x0a54('0x2'));var rs=require(_0x0a54('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0a54('0x4'))(_0x0a54('0x5'));var config=require('../../config/environment');var jayson=require(_0x0a54('0x6'));var client=jayson[_0x0a54('0x7')][_0x0a54('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2972ae,_0x66598e,_0x5a25f2){return new BPromise(function(_0x363cba,_0x1dc825){return client['request'](_0x2972ae,_0x5a25f2)[_0x0a54('0x9')](function(_0x4c04ea){logger[_0x0a54('0xa')](_0x0a54('0xb'),_0x66598e,_0x0a54('0xc'));logger[_0x0a54('0xd')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x66598e,'request\x20sent',JSON[_0x0a54('0xe')](_0x4c04ea));if(_0x4c04ea[_0x0a54('0xf')]){if(_0x4c04ea[_0x0a54('0xf')]['code']===0x1f4){logger[_0x0a54('0xf')](_0x0a54('0xb'),_0x66598e,_0x4c04ea[_0x0a54('0xf')][_0x0a54('0x10')]);return _0x1dc825(_0x4c04ea['error'][_0x0a54('0x10')]);}logger['error'](_0x0a54('0xb'),_0x66598e,_0x4c04ea['error']['message']);return _0x363cba(_0x4c04ea[_0x0a54('0xf')][_0x0a54('0x10')]);}else{logger['info'](_0x0a54('0xb'),_0x66598e,_0x0a54('0xc'));_0x363cba(_0x4c04ea[_0x0a54('0x11')][_0x0a54('0x10')]);}})[_0x0a54('0x12')](function(_0x1210fb){logger[_0x0a54('0xf')](_0x0a54('0xb'),_0x66598e,_0x1210fb);_0x1dc825(_0x1210fb);});});}exports['ShowSquareOdbc']=function(_0x525cea){var _0x2fabc6=this;return new Promise(function(_0x5689c3,_0x50a201){return db[_0x0a54('0x13')][_0x0a54('0x14')]({'raw':_0x525cea[_0x0a54('0x15')]?_0x525cea[_0x0a54('0x15')][_0x0a54('0x16')]===undefined?!![]:![]:!![],'where':_0x525cea[_0x0a54('0x15')]?_0x525cea[_0x0a54('0x15')][_0x0a54('0x17')]||null:null,'attributes':_0x525cea['options']?_0x525cea[_0x0a54('0x15')]['attributes']||null:null,'include':_0x525cea['options']?_0x525cea[_0x0a54('0x15')]['include']?_[_0x0a54('0x18')](_0x525cea[_0x0a54('0x15')][_0x0a54('0x19')],function(_0x165609){return{'model':db[_0x165609[_0x0a54('0x1a')]],'as':_0x165609['as'],'attributes':_0x165609[_0x0a54('0x1b')],'include':_0x165609['include']?_[_0x0a54('0x18')](_0x165609[_0x0a54('0x19')],function(_0x2948e0){return{'model':db[_0x2948e0['model']],'as':_0x2948e0['as'],'attributes':_0x2948e0['attributes'],'include':_0x2948e0[_0x0a54('0x19')]?_['map'](_0x2948e0['include'],function(_0x3b0038){return{'model':db[_0x3b0038['model']],'as':_0x3b0038['as'],'attributes':_0x3b0038[_0x0a54('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0a54('0x9')](function(_0x49dbce){logger[_0x0a54('0xa')](_0x0a54('0x1c'),_0x525cea);logger[_0x0a54('0xd')](_0x0a54('0x1c'),_0x525cea,JSON[_0x0a54('0xe')](_0x49dbce));_0x5689c3(_0x49dbce);})['catch'](function(_0x10e6ee){logger[_0x0a54('0xf')](_0x0a54('0x1c'),_0x10e6ee[_0x0a54('0x10')],_0x525cea);_0x50a201(_0x2fabc6[_0x0a54('0xf')](0x1f4,_0x10e6ee[_0x0a54('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index d0986e3..b2f0f03 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 _0xe4bd=['get','isAuthenticated','index','/:id','show','post','create','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe4bd,0x145));var _0xde4b=function(_0x3c2cc1,_0x4379a0){_0x3c2cc1=_0x3c2cc1-0x0;var _0x4312de=_0xe4bd[_0x3c2cc1];return _0x4312de;};'use strict';var multer=require(_0xde4b('0x0'));var util=require(_0xde4b('0x1'));var path=require(_0xde4b('0x2'));var timeout=require(_0xde4b('0x3'));var express=require(_0xde4b('0x4'));var router=express[_0xde4b('0x5')]();var fs_extra=require(_0xde4b('0x6'));var auth=require(_0xde4b('0x7'));var interaction=require(_0xde4b('0x8'));var config=require(_0xde4b('0x9'));var controller=require(_0xde4b('0xa'));router[_0xde4b('0xb')]('/',auth[_0xde4b('0xc')](),controller[_0xde4b('0xd')]);router[_0xde4b('0xb')](_0xde4b('0xe'),auth[_0xde4b('0xc')](),controller[_0xde4b('0xf')]);router[_0xde4b('0x10')]('/',auth[_0xde4b('0xc')](),controller[_0xde4b('0x11')]);router['put'](_0xde4b('0xe'),auth[_0xde4b('0xc')](),controller[_0xde4b('0x12')]);router['delete'](_0xde4b('0xe'),auth['isAuthenticated'](),controller[_0xde4b('0x13')]);module[_0xde4b('0x14')]=router; \ No newline at end of file +var _0x0f92=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./squareProject.controller','get','isAuthenticated','show','post','create','put','/:id','destroy'];(function(_0x59eacf,_0x56ec4a){var _0x5d74f2=function(_0x5476ed){while(--_0x5476ed){_0x59eacf['push'](_0x59eacf['shift']());}};_0x5d74f2(++_0x56ec4a);}(_0x0f92,0xc7));var _0x20f9=function(_0x236e70,_0x2c9cdb){_0x236e70=_0x236e70-0x0;var _0x519d60=_0x0f92[_0x236e70];return _0x519d60;};'use strict';var multer=require(_0x20f9('0x0'));var util=require(_0x20f9('0x1'));var path=require(_0x20f9('0x2'));var timeout=require(_0x20f9('0x3'));var express=require(_0x20f9('0x4'));var router=express['Router']();var fs_extra=require(_0x20f9('0x5'));var auth=require(_0x20f9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x20f9('0x7'));var controller=require(_0x20f9('0x8'));router[_0x20f9('0x9')]('/',auth[_0x20f9('0xa')](),controller['index']);router[_0x20f9('0x9')]('/:id',auth[_0x20f9('0xa')](),controller[_0x20f9('0xb')]);router[_0x20f9('0xc')]('/',auth[_0x20f9('0xa')](),controller[_0x20f9('0xd')]);router[_0x20f9('0xe')]('/:id',auth[_0x20f9('0xa')](),controller['update']);router['delete'](_0x20f9('0xf'),auth[_0x20f9('0xa')](),controller[_0x20f9('0x10')]);module[_0x20f9('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 99f804a..2eec881 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 _0x187d=['utf8','production','DATE','sequelize','STRING','name','TEXT','BLOB','long','preproduction','getDataValue','toString'];(function(_0xc876ad,_0x120015){var _0x4d2223=function(_0x2bc88f){while(--_0x2bc88f){_0xc876ad['push'](_0xc876ad['shift']());}};_0x4d2223(++_0x120015);}(_0x187d,0x93));var _0xd187=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x187d[_0x2b10c6];return _0x3789d2;};'use strict';var Sequelize=require(_0xd187('0x0'));module['exports']={'name':{'type':Sequelize[_0xd187('0x1')],'unique':_0xd187('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xd187('0x1')]},'notes':{'type':Sequelize[_0xd187('0x3')]},'preproduction':{'type':Sequelize[_0xd187('0x4')](_0xd187('0x5')),'get':function(){if(this['getDataValue'](_0xd187('0x6'))){return this[_0xd187('0x7')]('preproduction')[_0xd187('0x8')](_0xd187('0x9'));}}},'production':{'type':Sequelize[_0xd187('0x4')](_0xd187('0x5')),'get':function(){if(this[_0xd187('0x7')](_0xd187('0xa'))){return this[_0xd187('0x7')](_0xd187('0xa'))['toString'](_0xd187('0x9'));}}},'savedAt':{'type':Sequelize[_0xd187('0xb')]},'publishedAt':{'type':Sequelize[_0xd187('0xb')]}}; \ No newline at end of file +var _0x1957=['long','getDataValue','preproduction','utf8','production','toString','DATE','sequelize','exports','STRING','name','TEXT'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x1957,0xeb));var _0x7195=function(_0xaff1bd,_0x5380c4){_0xaff1bd=_0xaff1bd-0x0;var _0x52ad89=_0x1957[_0xaff1bd];return _0x52ad89;};'use strict';var Sequelize=require(_0x7195('0x0'));module[_0x7195('0x1')]={'name':{'type':Sequelize[_0x7195('0x2')],'unique':_0x7195('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x7195('0x2')]},'notes':{'type':Sequelize[_0x7195('0x4')]},'preproduction':{'type':Sequelize['BLOB'](_0x7195('0x5')),'get':function(){if(this[_0x7195('0x6')](_0x7195('0x7'))){return this['getDataValue'](_0x7195('0x7'))['toString'](_0x7195('0x8'));}}},'production':{'type':Sequelize['BLOB'](_0x7195('0x5')),'get':function(){if(this['getDataValue'](_0x7195('0x9'))){return this['getDataValue'](_0x7195('0x9'))[_0x7195('0xa')]('utf8');}}},'savedAt':{'type':Sequelize[_0x7195('0xb')]},'publishedAt':{'type':Sequelize[_0x7195('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 776f933..5d552b2 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 _0x2bf5=['userProfileId','autoAssociation','error','production','ioredis','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./squareProject.socket','status','json','limit','undefined','count','set','Content-Range','update','then','get','SquareProjects','UserProfileResource','destroy','publish','agi','stringify','end','stack','name','send','map','SquareProject','rawAttributes','key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','offset','sort','where','filters','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection'];(function(_0x1c9cfb,_0x6c0fec){var _0x122abf=function(_0x4eaf4f){while(--_0x4eaf4f){_0x1c9cfb['push'](_0x1c9cfb['shift']());}};_0x122abf(++_0x6c0fec);}(_0x2bf5,0xcd));var _0x52bf=function(_0x35d9b3,_0x11efb4){_0x35d9b3=_0x35d9b3-0x0;var _0x4de56f=_0x2bf5[_0x35d9b3];return _0x4de56f;};'use strict';var _=require('lodash');var Redis=require(_0x52bf('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0x52bf('0x1'))('api');var config=require(_0x52bf('0x2'));var db=require(_0x52bf('0x3'))['db'];config['redis']=_[_0x52bf('0x4')](config[_0x52bf('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0x52bf('0x6'))(new Redis(config[_0x52bf('0x5')]));require(_0x52bf('0x7'))['register'](socket);function respondWithResult(_0x2a1f5b,_0x19fd33){_0x19fd33=_0x19fd33||0xc8;return function(_0x386bc7){if(_0x386bc7){return _0x2a1f5b[_0x52bf('0x8')](_0x19fd33)[_0x52bf('0x9')](_0x386bc7);}};}function respondWithFilteredResult(_0x4f986d,_0x119034){return function(_0x1d5cab){if(_0x1d5cab){var _0x4b5ae9=typeof _0x119034['offset']==='undefined'&&typeof _0x119034[_0x52bf('0xa')]===_0x52bf('0xb');var _0x517cd1=_0x1d5cab[_0x52bf('0xc')];var _0x19f316=_0x4b5ae9?0x0:_0x119034['offset'];var _0x40a636=_0x4b5ae9?_0x1d5cab[_0x52bf('0xc')]:_0x119034['offset']+_0x119034['limit'];var _0x5d9e03;if(_0x40a636>=_0x517cd1){_0x40a636=_0x517cd1;_0x5d9e03=0xc8;}else{_0x5d9e03=0xce;}_0x4f986d[_0x52bf('0x8')](_0x5d9e03);return _0x4f986d[_0x52bf('0xd')](_0x52bf('0xe'),_0x19f316+'-'+_0x40a636+'/'+_0x517cd1)[_0x52bf('0x9')](_0x1d5cab);}return null;};}function saveUpdates(_0x1bd124){return function(_0x45a81a){if(_0x45a81a){return _0x45a81a[_0x52bf('0xf')](_0x1bd124)[_0x52bf('0x10')](function(_0x4aa534){return _0x4aa534;});}return null;};}function removeEntity(_0x5e2a2d){return function(_0x5b2d82){if(_0x5b2d82){return _0x5b2d82['destroy']()[_0x52bf('0x10')](function(){var _0x19d28b=_0x5b2d82[_0x52bf('0x11')]({'plain':!![]});var _0xa4e85f=_0x52bf('0x12');return db[_0x52bf('0x13')][_0x52bf('0x14')]({'where':{'type':_0xa4e85f,'resourceId':_0x19d28b['id']}})['then'](function(){return _0x5b2d82;});})[_0x52bf('0x10')](function(){var _0x5e24f6=new Redis(config[_0x52bf('0x5')]);_0x5e24f6[_0x52bf('0x15')](_0x52bf('0x16'),JSON[_0x52bf('0x17')]({'id':_0x5b2d82['id'],'deleted':!![]}));})[_0x52bf('0x10')](function(){_0x5e2a2d[_0x52bf('0x8')](0xcc)[_0x52bf('0x18')]();});}};}function handleEntityNotFound(_0x2d57c3){return function(_0x53e51c){if(!_0x53e51c){_0x2d57c3['sendStatus'](0x194);}return _0x53e51c;};}function handleError(_0x5c34aa,_0xcd6e09){_0xcd6e09=_0xcd6e09||0x1f4;return function(_0xc12e21){logger['error'](_0xc12e21[_0x52bf('0x19')]);if(_0xc12e21[_0x52bf('0x1a')]){delete _0xc12e21[_0x52bf('0x1a')];}_0x5c34aa['status'](_0xcd6e09)[_0x52bf('0x1b')](_0xc12e21);};}exports['index']=function(_0x12c485,_0x3be2b1){var _0x2df1f8={},_0x56fc19={},_0x1226a6={'count':0x0,'rows':[]};var _0x467b9c=_[_0x52bf('0x1c')](db[_0x52bf('0x1d')][_0x52bf('0x1e')],function(_0x3806ba){return{'name':_0x3806ba['fieldName'],'type':_0x3806ba['type'][_0x52bf('0x1f')]};});_0x56fc19[_0x52bf('0x20')]=_[_0x52bf('0x1c')](_0x467b9c,_0x52bf('0x1a'));_0x56fc19['query']=_['keys'](_0x12c485['query']);_0x56fc19['filters']=_['intersection'](_0x56fc19[_0x52bf('0x20')],_0x56fc19[_0x52bf('0x21')]);_0x2df1f8['attributes']=_[_0x52bf('0x22')](_0x56fc19['model'],qs[_0x52bf('0x23')](_0x12c485['query'][_0x52bf('0x23')]));_0x2df1f8['attributes']=_0x2df1f8[_0x52bf('0x24')]['length']?_0x2df1f8[_0x52bf('0x24')]:_0x56fc19[_0x52bf('0x20')];if(!_0x12c485[_0x52bf('0x21')][_0x52bf('0x25')](_0x52bf('0x26'))){_0x2df1f8['limit']=qs[_0x52bf('0xa')](_0x12c485['query'][_0x52bf('0xa')]);_0x2df1f8[_0x52bf('0x27')]=qs[_0x52bf('0x27')](_0x12c485[_0x52bf('0x21')][_0x52bf('0x27')]);}_0x2df1f8['order']=qs[_0x52bf('0x28')](_0x12c485[_0x52bf('0x21')]['sort']);_0x2df1f8[_0x52bf('0x29')]=qs[_0x52bf('0x2a')](_[_0x52bf('0x2b')](_0x12c485['query'],_0x56fc19[_0x52bf('0x2a')]),_0x467b9c);if(_0x12c485[_0x52bf('0x21')]['filter']){_0x2df1f8['where']=_[_0x52bf('0x2c')](_0x2df1f8[_0x52bf('0x29')],{'$or':_['map'](_0x467b9c,function(_0x4ef442){if(_0x4ef442['type']!=='VIRTUAL'){var _0xcac48a={};_0xcac48a[_0x4ef442[_0x52bf('0x1a')]]={'$like':'%'+_0x12c485['query'][_0x52bf('0x2d')]+'%'};return _0xcac48a;}})});}_0x2df1f8=_[_0x52bf('0x2c')]({},_0x2df1f8,_0x12c485[_0x52bf('0x2e')]);var _0x4f1e9a={'where':_0x2df1f8['where']};return db[_0x52bf('0x1d')][_0x52bf('0xc')](_0x4f1e9a)[_0x52bf('0x10')](function(_0x2d33bd){_0x1226a6[_0x52bf('0xc')]=_0x2d33bd;if(_0x12c485['query'][_0x52bf('0x2f')]){_0x2df1f8[_0x52bf('0x30')]=[{'all':!![]}];}return db[_0x52bf('0x1d')][_0x52bf('0x31')](_0x2df1f8);})[_0x52bf('0x10')](function(_0x39f109){_0x1226a6[_0x52bf('0x32')]=_0x39f109;return _0x1226a6;})[_0x52bf('0x10')](respondWithFilteredResult(_0x3be2b1,_0x2df1f8))[_0x52bf('0x33')](handleError(_0x3be2b1,null));};exports[_0x52bf('0x34')]=function(_0x48e37e,_0x2abbad){var _0x1c45d={'raw':![],'where':{'id':_0x48e37e[_0x52bf('0x35')]['id']}},_0x760ea5={};_0x760ea5[_0x52bf('0x20')]=_[_0x52bf('0x36')](db[_0x52bf('0x1d')][_0x52bf('0x1e')]);_0x760ea5['query']=_[_0x52bf('0x36')](_0x48e37e[_0x52bf('0x21')]);_0x760ea5['filters']=_[_0x52bf('0x22')](_0x760ea5['model'],_0x760ea5[_0x52bf('0x21')]);_0x1c45d[_0x52bf('0x24')]=_[_0x52bf('0x22')](_0x760ea5['model'],qs['fields'](_0x48e37e[_0x52bf('0x21')]['fields']));_0x1c45d[_0x52bf('0x24')]=_0x1c45d[_0x52bf('0x24')][_0x52bf('0x37')]?_0x1c45d[_0x52bf('0x24')]:_0x760ea5['model'];if(_0x48e37e['query']['includeAll']){_0x1c45d[_0x52bf('0x30')]=[{'all':!![]}];}_0x1c45d=_[_0x52bf('0x2c')]({},_0x1c45d,_0x48e37e[_0x52bf('0x2e')]);return db[_0x52bf('0x1d')][_0x52bf('0x38')](_0x1c45d)[_0x52bf('0x10')](handleEntityNotFound(_0x2abbad,null))[_0x52bf('0x10')](respondWithResult(_0x2abbad,null))[_0x52bf('0x33')](handleError(_0x2abbad,null));};exports[_0x52bf('0x39')]=function(_0x1dd55e,_0x32b720){return db[_0x52bf('0x1d')][_0x52bf('0x39')](_0x1dd55e[_0x52bf('0x3a')],{})['then'](function(_0x4338d5){var _0x4d2cab=_0x1dd55e[_0x52bf('0x3b')]['get']({'plain':!![]});if(!_0x4d2cab)throw new Error(_0x52bf('0x3c'));if(_0x4d2cab[_0x52bf('0x3d')]==='user'){var _0x226088=_0x4338d5[_0x52bf('0x11')]({'plain':!![]});var _0x261608=_0x52bf('0x12');return db[_0x52bf('0x3e')][_0x52bf('0x38')]({'where':{'name':_0x261608,'userProfileId':_0x4d2cab[_0x52bf('0x3f')]},'raw':!![]})[_0x52bf('0x10')](function(_0x3a7f3c){if(_0x3a7f3c&&_0x3a7f3c[_0x52bf('0x40')]===0x0){return db['UserProfileResource'][_0x52bf('0x39')]({'name':_0x226088[_0x52bf('0x1a')],'resourceId':_0x226088['id'],'type':_0x3a7f3c[_0x52bf('0x1a')],'sectionId':_0x3a7f3c['id']},{})[_0x52bf('0x10')](function(){return _0x4338d5;});}else{return _0x4338d5;}})[_0x52bf('0x33')](function(_0x204210){logger[_0x52bf('0x41')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x204210);throw _0x204210;});}return _0x4338d5;})[_0x52bf('0x10')](respondWithResult(_0x32b720,0xc9))[_0x52bf('0x33')](handleError(_0x32b720,null));};exports[_0x52bf('0xf')]=function(_0xd29812,_0x490a34){if(_0xd29812['body']['id']){delete _0xd29812['body']['id'];}return db[_0x52bf('0x1d')][_0x52bf('0x38')]({'where':{'id':_0xd29812[_0x52bf('0x35')]['id']}})['then'](handleEntityNotFound(_0x490a34,null))[_0x52bf('0x10')](saveUpdates(_0xd29812['body'],null))['then'](function(_0x331fd7){if(!_0x331fd7)return;var _0x47750c=_0x331fd7['get']({'plain':!![]});return _0x47750c;})[_0x52bf('0x10')](function(_0x20a059){var _0x9892ad=new Redis(config[_0x52bf('0x5')]);_0x9892ad['publish']('agi',JSON[_0x52bf('0x17')](_[_0x52bf('0x2b')](_0x20a059,['id',_0x52bf('0x1a'),_0x52bf('0x42')])));return _0x20a059;})[_0x52bf('0x10')](respondWithResult(_0x490a34,null))[_0x52bf('0x33')](handleError(_0x490a34,null));};exports['destroy']=function(_0x22cebe,_0x3e670b){return db[_0x52bf('0x1d')][_0x52bf('0x38')]({'where':{'id':_0x22cebe[_0x52bf('0x35')]['id']}})[_0x52bf('0x10')](handleEntityNotFound(_0x3e670b,null))[_0x52bf('0x10')](removeEntity(_0x3e670b,null))[_0x52bf('0x33')](handleError(_0x3e670b,null));}; \ No newline at end of file +var _0x4f55=['key','model','query','filters','attributes','intersection','length','order','sort','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','fields','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SquareProjects','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./squareProject.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','get','UserProfileResource','publish','agi','stringify','end','sendStatus','error','stack','name','index','map','SquareProject','fieldName','type'];(function(_0x4f0a9d,_0x2f6c88){var _0x52efae=function(_0x1aae60){while(--_0x1aae60){_0x4f0a9d['push'](_0x4f0a9d['shift']());}};_0x52efae(++_0x2f6c88);}(_0x4f55,0xef));var _0x54f5=function(_0xaa273b,_0x70f52b){_0xaa273b=_0xaa273b-0x0;var _0x15c205=_0x4f55[_0xaa273b];return _0x15c205;};'use strict';var _=require(_0x54f5('0x0'));var Redis=require(_0x54f5('0x1'));var qs=require(_0x54f5('0x2'));var logger=require(_0x54f5('0x3'))('api');var config=require(_0x54f5('0x4'));var db=require(_0x54f5('0x5'))['db'];config['redis']=_[_0x54f5('0x6')](config[_0x54f5('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x54f5('0x8'))(new Redis(config[_0x54f5('0x7')]));require(_0x54f5('0x9'))[_0x54f5('0xa')](socket);function respondWithResult(_0x57ceb8,_0x3d4b77){_0x3d4b77=_0x3d4b77||0xc8;return function(_0x19a16d){if(_0x19a16d){return _0x57ceb8[_0x54f5('0xb')](_0x3d4b77)[_0x54f5('0xc')](_0x19a16d);}};}function respondWithFilteredResult(_0x32c54d,_0xc498c9){return function(_0x1198a5){if(_0x1198a5){var _0xdf843d=typeof _0xc498c9[_0x54f5('0xd')]===_0x54f5('0xe')&&typeof _0xc498c9[_0x54f5('0xf')]===_0x54f5('0xe');var _0x24b8d1=_0x1198a5[_0x54f5('0x10')];var _0x49d798=_0xdf843d?0x0:_0xc498c9['offset'];var _0x518d86=_0xdf843d?_0x1198a5[_0x54f5('0x10')]:_0xc498c9[_0x54f5('0xd')]+_0xc498c9[_0x54f5('0xf')];var _0x2380ad;if(_0x518d86>=_0x24b8d1){_0x518d86=_0x24b8d1;_0x2380ad=0xc8;}else{_0x2380ad=0xce;}_0x32c54d['status'](_0x2380ad);return _0x32c54d[_0x54f5('0x11')](_0x54f5('0x12'),_0x49d798+'-'+_0x518d86+'/'+_0x24b8d1)[_0x54f5('0xc')](_0x1198a5);}return null;};}function saveUpdates(_0x52e75d){return function(_0x378762){if(_0x378762){return _0x378762[_0x54f5('0x13')](_0x52e75d)['then'](function(_0x526f02){return _0x526f02;});}return null;};}function removeEntity(_0xb2131e){return function(_0x3ad05c){if(_0x3ad05c){return _0x3ad05c[_0x54f5('0x14')]()[_0x54f5('0x15')](function(){var _0x26366f=_0x3ad05c[_0x54f5('0x16')]({'plain':!![]});var _0x2e5500='SquareProjects';return db[_0x54f5('0x17')][_0x54f5('0x14')]({'where':{'type':_0x2e5500,'resourceId':_0x26366f['id']}})[_0x54f5('0x15')](function(){return _0x3ad05c;});})[_0x54f5('0x15')](function(){var _0x2bc8ff=new Redis(config[_0x54f5('0x7')]);_0x2bc8ff[_0x54f5('0x18')](_0x54f5('0x19'),JSON[_0x54f5('0x1a')]({'id':_0x3ad05c['id'],'deleted':!![]}));})[_0x54f5('0x15')](function(){_0xb2131e[_0x54f5('0xb')](0xcc)[_0x54f5('0x1b')]();});}};}function handleEntityNotFound(_0x33d4bb){return function(_0x15a073){if(!_0x15a073){_0x33d4bb[_0x54f5('0x1c')](0x194);}return _0x15a073;};}function handleError(_0x4b2fa0,_0x319d57){_0x319d57=_0x319d57||0x1f4;return function(_0x12fe98){logger[_0x54f5('0x1d')](_0x12fe98[_0x54f5('0x1e')]);if(_0x12fe98['name']){delete _0x12fe98[_0x54f5('0x1f')];}_0x4b2fa0[_0x54f5('0xb')](_0x319d57)['send'](_0x12fe98);};}exports[_0x54f5('0x20')]=function(_0x5e8815,_0x180bec){var _0x3be1cc={},_0x15676e={},_0x4dfceb={'count':0x0,'rows':[]};var _0x114242=_[_0x54f5('0x21')](db[_0x54f5('0x22')]['rawAttributes'],function(_0x30e915){return{'name':_0x30e915[_0x54f5('0x23')],'type':_0x30e915[_0x54f5('0x24')][_0x54f5('0x25')]};});_0x15676e[_0x54f5('0x26')]=_[_0x54f5('0x21')](_0x114242,_0x54f5('0x1f'));_0x15676e[_0x54f5('0x27')]=_['keys'](_0x5e8815['query']);_0x15676e[_0x54f5('0x28')]=_['intersection'](_0x15676e[_0x54f5('0x26')],_0x15676e['query']);_0x3be1cc[_0x54f5('0x29')]=_[_0x54f5('0x2a')](_0x15676e[_0x54f5('0x26')],qs['fields'](_0x5e8815['query']['fields']));_0x3be1cc[_0x54f5('0x29')]=_0x3be1cc[_0x54f5('0x29')][_0x54f5('0x2b')]?_0x3be1cc[_0x54f5('0x29')]:_0x15676e[_0x54f5('0x26')];if(!_0x5e8815[_0x54f5('0x27')]['hasOwnProperty']('nolimit')){_0x3be1cc[_0x54f5('0xf')]=qs[_0x54f5('0xf')](_0x5e8815[_0x54f5('0x27')]['limit']);_0x3be1cc[_0x54f5('0xd')]=qs['offset'](_0x5e8815[_0x54f5('0x27')][_0x54f5('0xd')]);}_0x3be1cc[_0x54f5('0x2c')]=qs[_0x54f5('0x2d')](_0x5e8815[_0x54f5('0x27')][_0x54f5('0x2d')]);_0x3be1cc['where']=qs[_0x54f5('0x28')](_[_0x54f5('0x2e')](_0x5e8815[_0x54f5('0x27')],_0x15676e['filters']),_0x114242);if(_0x5e8815[_0x54f5('0x27')]['filter']){_0x3be1cc['where']=_[_0x54f5('0x2f')](_0x3be1cc['where'],{'$or':_['map'](_0x114242,function(_0x4b0f48){if(_0x4b0f48[_0x54f5('0x24')]!==_0x54f5('0x30')){var _0x25b5af={};_0x25b5af[_0x4b0f48[_0x54f5('0x1f')]]={'$like':'%'+_0x5e8815['query']['filter']+'%'};return _0x25b5af;}})});}_0x3be1cc=_['merge']({},_0x3be1cc,_0x5e8815[_0x54f5('0x31')]);var _0x539763={'where':_0x3be1cc['where']};return db[_0x54f5('0x22')][_0x54f5('0x10')](_0x539763)[_0x54f5('0x15')](function(_0x95706b){_0x4dfceb[_0x54f5('0x10')]=_0x95706b;if(_0x5e8815[_0x54f5('0x27')][_0x54f5('0x32')]){_0x3be1cc[_0x54f5('0x33')]=[{'all':!![]}];}return db['SquareProject'][_0x54f5('0x34')](_0x3be1cc);})['then'](function(_0x1f4d57){_0x4dfceb[_0x54f5('0x35')]=_0x1f4d57;return _0x4dfceb;})['then'](respondWithFilteredResult(_0x180bec,_0x3be1cc))[_0x54f5('0x36')](handleError(_0x180bec,null));};exports['show']=function(_0x4ded92,_0x169b9e){var _0x13541d={'raw':![],'where':{'id':_0x4ded92['params']['id']}},_0x67e6df={};_0x67e6df[_0x54f5('0x26')]=_[_0x54f5('0x37')](db[_0x54f5('0x22')]['rawAttributes']);_0x67e6df[_0x54f5('0x27')]=_[_0x54f5('0x37')](_0x4ded92[_0x54f5('0x27')]);_0x67e6df['filters']=_[_0x54f5('0x2a')](_0x67e6df[_0x54f5('0x26')],_0x67e6df['query']);_0x13541d[_0x54f5('0x29')]=_['intersection'](_0x67e6df['model'],qs[_0x54f5('0x38')](_0x4ded92[_0x54f5('0x27')][_0x54f5('0x38')]));_0x13541d['attributes']=_0x13541d[_0x54f5('0x29')][_0x54f5('0x2b')]?_0x13541d['attributes']:_0x67e6df[_0x54f5('0x26')];if(_0x4ded92[_0x54f5('0x27')][_0x54f5('0x32')]){_0x13541d[_0x54f5('0x33')]=[{'all':!![]}];}_0x13541d=_[_0x54f5('0x2f')]({},_0x13541d,_0x4ded92['options']);return db[_0x54f5('0x22')]['find'](_0x13541d)[_0x54f5('0x15')](handleEntityNotFound(_0x169b9e,null))['then'](respondWithResult(_0x169b9e,null))[_0x54f5('0x36')](handleError(_0x169b9e,null));};exports[_0x54f5('0x39')]=function(_0x562f48,_0x2be8d0){return db[_0x54f5('0x22')][_0x54f5('0x39')](_0x562f48['body'],{})['then'](function(_0x2367f1){var _0x42b002=_0x562f48[_0x54f5('0x3a')][_0x54f5('0x16')]({'plain':!![]});if(!_0x42b002)throw new Error(_0x54f5('0x3b'));if(_0x42b002[_0x54f5('0x3c')]===_0x54f5('0x3a')){var _0xcc5d51=_0x2367f1[_0x54f5('0x16')]({'plain':!![]});var _0x55b36b=_0x54f5('0x3d');return db[_0x54f5('0x3e')][_0x54f5('0x3f')]({'where':{'name':_0x55b36b,'userProfileId':_0x42b002[_0x54f5('0x40')]},'raw':!![]})[_0x54f5('0x15')](function(_0x16fa40){if(_0x16fa40&&_0x16fa40[_0x54f5('0x41')]===0x0){return db['UserProfileResource']['create']({'name':_0xcc5d51[_0x54f5('0x1f')],'resourceId':_0xcc5d51['id'],'type':_0x16fa40[_0x54f5('0x1f')],'sectionId':_0x16fa40['id']},{})['then'](function(){return _0x2367f1;});}else{return _0x2367f1;}})[_0x54f5('0x36')](function(_0x2dd1d9){logger[_0x54f5('0x1d')](_0x54f5('0x42'),_0x2dd1d9);throw _0x2dd1d9;});}return _0x2367f1;})[_0x54f5('0x15')](respondWithResult(_0x2be8d0,0xc9))[_0x54f5('0x36')](handleError(_0x2be8d0,null));};exports[_0x54f5('0x13')]=function(_0x5d3d18,_0x2e4451){if(_0x5d3d18[_0x54f5('0x43')]['id']){delete _0x5d3d18[_0x54f5('0x43')]['id'];}return db[_0x54f5('0x22')]['find']({'where':{'id':_0x5d3d18[_0x54f5('0x44')]['id']}})[_0x54f5('0x15')](handleEntityNotFound(_0x2e4451,null))['then'](saveUpdates(_0x5d3d18[_0x54f5('0x43')],null))[_0x54f5('0x15')](function(_0x1fbe53){if(!_0x1fbe53)return;var _0x31d902=_0x1fbe53['get']({'plain':!![]});return _0x31d902;})[_0x54f5('0x15')](function(_0x517bda){var _0x55f7a4=new Redis(config[_0x54f5('0x7')]);_0x55f7a4[_0x54f5('0x18')](_0x54f5('0x19'),JSON[_0x54f5('0x1a')](_[_0x54f5('0x2e')](_0x517bda,['id',_0x54f5('0x1f'),'production'])));return _0x517bda;})[_0x54f5('0x15')](respondWithResult(_0x2e4451,null))[_0x54f5('0x36')](handleError(_0x2e4451,null));};exports[_0x54f5('0x14')]=function(_0x2afe7a,_0x30a253){return db[_0x54f5('0x22')][_0x54f5('0x3f')]({'where':{'id':_0x2afe7a[_0x54f5('0x44')]['id']}})[_0x54f5('0x15')](handleEntityNotFound(_0x30a253,null))[_0x54f5('0x15')](removeEntity(_0x30a253,null))[_0x54f5('0x36')](handleError(_0x30a253,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index fe5606f..eecbbf0 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 _0xa108=['../../mysqldb','setMaxListeners','save','update','remove','emit','exports','events'];(function(_0x2bbc07,_0x1e2168){var _0x6879e4=function(_0x290fa1){while(--_0x290fa1){_0x2bbc07['push'](_0x2bbc07['shift']());}};_0x6879e4(++_0x1e2168);}(_0xa108,0x177));var _0x8a10=function(_0x5e1d8f,_0x2e120b){_0x5e1d8f=_0x5e1d8f-0x0;var _0x475131=_0xa108[_0x5e1d8f];return _0x475131;};'use strict';var EventEmitter=require(_0x8a10('0x0'));var SquareProject=require(_0x8a10('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x8a10('0x2')](0x0);var events={'afterCreate':_0x8a10('0x3'),'afterUpdate':_0x8a10('0x4'),'afterDestroy':_0x8a10('0x5')};function emitEvent(_0x513dbd){return function(_0x448af7,_0x34d95c,_0x52205a){SquareProjectEvents[_0x8a10('0x6')](_0x513dbd+':'+_0x448af7['id'],_0x448af7);SquareProjectEvents[_0x8a10('0x6')](_0x513dbd,_0x448af7);_0x52205a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x8a10('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0x0f31=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','SquareProject','setMaxListeners'];(function(_0x3d16c7,_0xd9ff64){var _0x5e7214=function(_0x5aaffd){while(--_0x5aaffd){_0x3d16c7['push'](_0x3d16c7['shift']());}};_0x5e7214(++_0xd9ff64);}(_0x0f31,0x1bf));var _0x10f3=function(_0x195b14,_0x2f8fda){_0x195b14=_0x195b14-0x0;var _0x378f4b=_0x0f31[_0x195b14];return _0x378f4b;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x10f3('0x0'))['db'][_0x10f3('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x10f3('0x2')](0x0);var events={'afterCreate':_0x10f3('0x3'),'afterUpdate':_0x10f3('0x4'),'afterDestroy':_0x10f3('0x5')};function emitEvent(_0x4d4f7c){return function(_0x1af92a,_0x5c5d22,_0x1c3c45){SquareProjectEvents[_0x10f3('0x6')](_0x4d4f7c+':'+_0x1af92a['id'],_0x1af92a);SquareProjectEvents[_0x10f3('0x6')](_0x4d4f7c,_0x1af92a);_0x1c3c45(null);};}for(var e in events){if(events[_0x10f3('0x7')](e)){var event=events[e];SquareProject[_0x10f3('0x8')](e,emitEvent(event));}}module[_0x10f3('0x9')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 3980afb..fbff989 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 _0x8cac=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','SquareProject','square_projects','changed','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','util','../../config/logger','api'];(function(_0xcc03bf,_0x1b95e5){var _0x32be90=function(_0x15caad){while(--_0x15caad){_0xcc03bf['push'](_0xcc03bf['shift']());}};_0x32be90(++_0x1b95e5);}(_0x8cac,0xc4));var _0xc8ca=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x8cac[_0x18ab2a];return _0x16dcee;};'use strict';var _=require(_0xc8ca('0x0'));var util=require(_0xc8ca('0x1'));var logger=require(_0xc8ca('0x2'))(_0xc8ca('0x3'));var moment=require(_0xc8ca('0x4'));var BPromise=require(_0xc8ca('0x5'));var rp=require(_0xc8ca('0x6'));var fs=require('fs');var path=require(_0xc8ca('0x7'));var rimraf=require(_0xc8ca('0x8'));var config=require(_0xc8ca('0x9'));var attributes=require(_0xc8ca('0xa'));module[_0xc8ca('0xb')]=function(_0x2d690b,_0x544c2f){return _0x2d690b['define'](_0xc8ca('0xc'),attributes,{'tableName':_0xc8ca('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x399bc3,_0x823957,_0xf65247){if(_0x399bc3[_0xc8ca('0xe')]('preproduction')){_0x399bc3[_0xc8ca('0xf')]=moment()[_0xc8ca('0x10')](_0xc8ca('0x11'));}if(_0x399bc3[_0xc8ca('0xe')](_0xc8ca('0x12'))){_0x399bc3[_0xc8ca('0x13')]=moment()[_0xc8ca('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0xf65247(null,_0x399bc3);}}});}; \ No newline at end of file +var _0xc227=['../../config/logger','bluebird','request-promise','path','rimraf','exports','define','square_projects','changed','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt'];(function(_0x1c84d1,_0x59ae04){var _0x2ac1ca=function(_0x3be10b){while(--_0x3be10b){_0x1c84d1['push'](_0x1c84d1['shift']());}};_0x2ac1ca(++_0x59ae04);}(_0xc227,0x179));var _0x7c22=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xc227[_0x2bf141];return _0x48277b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7c22('0x0'))('api');var moment=require('moment');var BPromise=require(_0x7c22('0x1'));var rp=require(_0x7c22('0x2'));var fs=require('fs');var path=require(_0x7c22('0x3'));var rimraf=require(_0x7c22('0x4'));var config=require('../../config/environment');var attributes=require('./squareProject.attributes');module[_0x7c22('0x5')]=function(_0x550592,_0x2d5c91){return _0x550592[_0x7c22('0x6')]('SquareProject',attributes,{'tableName':_0x7c22('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x15ae31,_0x1361f8,_0x15b8d0){if(_0x15ae31[_0x7c22('0x8')]('preproduction')){_0x15ae31['savedAt']=moment()[_0x7c22('0x9')](_0x7c22('0xa'));}if(_0x15ae31[_0x7c22('0x8')](_0x7c22('0xb'))){_0x15ae31[_0x7c22('0xc')]=moment()[_0x7c22('0x9')](_0x7c22('0xa'));}_0x15b8d0(null,_0x15ae31);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 70ba1a3..dd2d6f8 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 _0x312f=['redis','defaults','localhost','./squareProject.socket','register','SquareProject','raw','options','where','attributes','include','map','model','then','info','GetSquareProjects','debug','catch','message','error','find','ShowSquareProject','lodash','ioredis','../../mysqldb','../../config/environment'];(function(_0x1cfc07,_0x525762){var _0xdb7af9=function(_0x1e3416){while(--_0x1e3416){_0x1cfc07['push'](_0x1cfc07['shift']());}};_0xdb7af9(++_0x525762);}(_0x312f,0x1ea));var _0xf312=function(_0x4f0b78,_0x46c193){_0x4f0b78=_0x4f0b78-0x0;var _0xd4a88c=_0x312f[_0x4f0b78];return _0xd4a88c;};'use strict';var _=require(_0xf312('0x0'));var Redis=require(_0xf312('0x1'));var db=require(_0xf312('0x2'))['db'];var logger=require('../../config/logger')('rpc');var config=require(_0xf312('0x3'));config[_0xf312('0x4')]=_[_0xf312('0x5')](config['redis'],{'host':_0xf312('0x6'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf312('0x4')]));require(_0xf312('0x7'))[_0xf312('0x8')](socket);exports['GetSquareProjects']=function(_0x57bb60){var _0x4be4ad=this;return new Promise(function(_0xc62607,_0x4d49e5){return db[_0xf312('0x9')]['findAll']({'raw':_0x57bb60['options']?_0x57bb60['options'][_0xf312('0xa')]===undefined?!![]:![]:!![],'where':_0x57bb60[_0xf312('0xb')]?_0x57bb60[_0xf312('0xb')][_0xf312('0xc')]||null:null,'attributes':_0x57bb60[_0xf312('0xb')]?_0x57bb60[_0xf312('0xb')][_0xf312('0xd')]||null:null,'limit':_0x57bb60[_0xf312('0xb')]?_0x57bb60['options']['limit']||null:null,'include':_0x57bb60[_0xf312('0xb')]?_0x57bb60[_0xf312('0xb')][_0xf312('0xe')]?_[_0xf312('0xf')](_0x57bb60[_0xf312('0xb')]['include'],function(_0xd9cbad){return{'model':db[_0xd9cbad[_0xf312('0x10')]],'as':_0xd9cbad['as'],'attributes':_0xd9cbad['attributes'],'include':_0xd9cbad[_0xf312('0xe')]?_[_0xf312('0xf')](_0xd9cbad['include'],function(_0x4e8ba5){return{'model':db[_0x4e8ba5[_0xf312('0x10')]],'as':_0x4e8ba5['as'],'attributes':_0x4e8ba5[_0xf312('0xd')],'include':_0x4e8ba5['include']?_[_0xf312('0xf')](_0x4e8ba5[_0xf312('0xe')],function(_0x53ce9a){return{'model':db[_0x53ce9a[_0xf312('0x10')]],'as':_0x53ce9a['as'],'attributes':_0x53ce9a[_0xf312('0xd')]};}):[]};}):[]};}):[]:[]})[_0xf312('0x11')](function(_0x22376b){logger[_0xf312('0x12')](_0xf312('0x13'),_0x57bb60);logger[_0xf312('0x14')](_0xf312('0x13'),_0x57bb60,JSON['stringify'](_0x22376b));_0xc62607(_0x22376b);})[_0xf312('0x15')](function(_0x2d121d){logger['error'](_0xf312('0x13'),_0x2d121d[_0xf312('0x16')],_0x57bb60);_0x4d49e5(_0x4be4ad[_0xf312('0x17')](0x1f4,_0x2d121d[_0xf312('0x16')]));});});};exports['ShowSquareProject']=function(_0x420907){var _0x367c2e=this;return new Promise(function(_0x1e1c8b,_0x3ea88a){return db[_0xf312('0x9')][_0xf312('0x18')]({'raw':_0x420907[_0xf312('0xb')]?_0x420907[_0xf312('0xb')][_0xf312('0xa')]===undefined?!![]:![]:!![],'where':_0x420907[_0xf312('0xb')]?_0x420907[_0xf312('0xb')][_0xf312('0xc')]||null:null,'attributes':_0x420907[_0xf312('0xb')]?_0x420907[_0xf312('0xb')][_0xf312('0xd')]||null:null,'include':_0x420907['options']?_0x420907[_0xf312('0xb')][_0xf312('0xe')]?_[_0xf312('0xf')](_0x420907['options'][_0xf312('0xe')],function(_0x19bcfc){return{'model':db[_0x19bcfc[_0xf312('0x10')]],'as':_0x19bcfc['as'],'attributes':_0x19bcfc[_0xf312('0xd')],'include':_0x19bcfc['include']?_[_0xf312('0xf')](_0x19bcfc['include'],function(_0x35f0ca){return{'model':db[_0x35f0ca[_0xf312('0x10')]],'as':_0x35f0ca['as'],'attributes':_0x35f0ca[_0xf312('0xd')],'include':_0x35f0ca[_0xf312('0xe')]?_[_0xf312('0xf')](_0x35f0ca[_0xf312('0xe')],function(_0x5ac1be){return{'model':db[_0x5ac1be[_0xf312('0x10')]],'as':_0x5ac1be['as'],'attributes':_0x5ac1be[_0xf312('0xd')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x352d12){logger[_0xf312('0x12')](_0xf312('0x19'),_0x420907);logger[_0xf312('0x14')](_0xf312('0x19'),_0x420907,JSON['stringify'](_0x352d12));_0x1e1c8b(_0x352d12);})[_0xf312('0x15')](function(_0x20c303){logger[_0xf312('0x17')](_0xf312('0x19'),_0x20c303[_0xf312('0x16')],_0x420907);_0x3ea88a(_0x367c2e[_0xf312('0x17')](0x1f4,_0x20c303['message']));});});}; \ No newline at end of file +var _0x029f=['model','then','info','GetSquareProjects','debug','stringify','catch','error','message','ShowSquareProject','find','lodash','rpc','../../config/environment','redis','defaults','localhost','./squareProject.socket','register','SquareProject','findAll','options','raw','where','limit','include','map','attributes'];(function(_0x1f2efd,_0x3d1d9e){var _0x19d2a8=function(_0x5b60aa){while(--_0x5b60aa){_0x1f2efd['push'](_0x1f2efd['shift']());}};_0x19d2a8(++_0x3d1d9e);}(_0x029f,0xcf));var _0xf029=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x029f[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xf029('0x0'));var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0xf029('0x1'));var config=require(_0xf029('0x2'));config[_0xf029('0x3')]=_[_0xf029('0x4')](config['redis'],{'host':_0xf029('0x5'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf029('0x3')]));require(_0xf029('0x6'))[_0xf029('0x7')](socket);exports['GetSquareProjects']=function(_0x479a37){var _0x1cb24f=this;return new Promise(function(_0x3c38f2,_0x316f94){return db[_0xf029('0x8')][_0xf029('0x9')]({'raw':_0x479a37[_0xf029('0xa')]?_0x479a37[_0xf029('0xa')][_0xf029('0xb')]===undefined?!![]:![]:!![],'where':_0x479a37[_0xf029('0xa')]?_0x479a37[_0xf029('0xa')][_0xf029('0xc')]||null:null,'attributes':_0x479a37['options']?_0x479a37[_0xf029('0xa')]['attributes']||null:null,'limit':_0x479a37[_0xf029('0xa')]?_0x479a37['options'][_0xf029('0xd')]||null:null,'include':_0x479a37['options']?_0x479a37['options'][_0xf029('0xe')]?_[_0xf029('0xf')](_0x479a37[_0xf029('0xa')][_0xf029('0xe')],function(_0xae3b0e){return{'model':db[_0xae3b0e['model']],'as':_0xae3b0e['as'],'attributes':_0xae3b0e[_0xf029('0x10')],'include':_0xae3b0e[_0xf029('0xe')]?_[_0xf029('0xf')](_0xae3b0e['include'],function(_0x1314a5){return{'model':db[_0x1314a5[_0xf029('0x11')]],'as':_0x1314a5['as'],'attributes':_0x1314a5[_0xf029('0x10')],'include':_0x1314a5[_0xf029('0xe')]?_[_0xf029('0xf')](_0x1314a5['include'],function(_0x5c848c){return{'model':db[_0x5c848c[_0xf029('0x11')]],'as':_0x5c848c['as'],'attributes':_0x5c848c[_0xf029('0x10')]};}):[]};}):[]};}):[]:[]})[_0xf029('0x12')](function(_0x258d5c){logger[_0xf029('0x13')](_0xf029('0x14'),_0x479a37);logger[_0xf029('0x15')](_0xf029('0x14'),_0x479a37,JSON[_0xf029('0x16')](_0x258d5c));_0x3c38f2(_0x258d5c);})[_0xf029('0x17')](function(_0x17d38e){logger[_0xf029('0x18')](_0xf029('0x14'),_0x17d38e[_0xf029('0x19')],_0x479a37);_0x316f94(_0x1cb24f[_0xf029('0x18')](0x1f4,_0x17d38e[_0xf029('0x19')]));});});};exports[_0xf029('0x1a')]=function(_0x4be501){var _0x136cf6=this;return new Promise(function(_0x135228,_0x83d1f9){return db['SquareProject'][_0xf029('0x1b')]({'raw':_0x4be501[_0xf029('0xa')]?_0x4be501[_0xf029('0xa')]['raw']===undefined?!![]:![]:!![],'where':_0x4be501[_0xf029('0xa')]?_0x4be501[_0xf029('0xa')][_0xf029('0xc')]||null:null,'attributes':_0x4be501[_0xf029('0xa')]?_0x4be501['options'][_0xf029('0x10')]||null:null,'include':_0x4be501[_0xf029('0xa')]?_0x4be501[_0xf029('0xa')][_0xf029('0xe')]?_[_0xf029('0xf')](_0x4be501[_0xf029('0xa')][_0xf029('0xe')],function(_0xbf1601){return{'model':db[_0xbf1601['model']],'as':_0xbf1601['as'],'attributes':_0xbf1601[_0xf029('0x10')],'include':_0xbf1601[_0xf029('0xe')]?_[_0xf029('0xf')](_0xbf1601[_0xf029('0xe')],function(_0x2559f0){return{'model':db[_0x2559f0[_0xf029('0x11')]],'as':_0x2559f0['as'],'attributes':_0x2559f0[_0xf029('0x10')],'include':_0x2559f0['include']?_[_0xf029('0xf')](_0x2559f0[_0xf029('0xe')],function(_0x3f90b0){return{'model':db[_0x3f90b0[_0xf029('0x11')]],'as':_0x3f90b0['as'],'attributes':_0x3f90b0[_0xf029('0x10')]};}):[]};}):[]};}):[]:[]})[_0xf029('0x12')](function(_0x49ce0b){logger['info'](_0xf029('0x1a'),_0x4be501);logger[_0xf029('0x15')](_0xf029('0x1a'),_0x4be501,JSON[_0xf029('0x16')](_0x49ce0b));_0x135228(_0x49ce0b);})['catch'](function(_0x3a8176){logger[_0xf029('0x18')](_0xf029('0x1a'),_0x3a8176[_0xf029('0x19')],_0x4be501);_0x83d1f9(_0x136cf6[_0xf029('0x18')](0x1f4,_0x3a8176[_0xf029('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 86b4473..938a0d0 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 _0xbfb1=['update','removeListener','register','squareProject:','./squareProject.events','save','remove'];(function(_0x3d2fe5,_0x2f9c71){var _0x48de9d=function(_0x229709){while(--_0x229709){_0x3d2fe5['push'](_0x3d2fe5['shift']());}};_0x48de9d(++_0x2f9c71);}(_0xbfb1,0x193));var _0x1bfb=function(_0x2cbc48,_0x316303){_0x2cbc48=_0x2cbc48-0x0;var _0x30f314=_0xbfb1[_0x2cbc48];return _0x30f314;};'use strict';var SquareProjectEvents=require(_0x1bfb('0x0'));var events=[_0x1bfb('0x1'),_0x1bfb('0x2'),_0x1bfb('0x3')];function createListener(_0xcc141,_0x79c69d){return function(_0x592424){_0x79c69d['emit'](_0xcc141,_0x592424);};}function removeListener(_0x97f448,_0x36a36a){return function(){SquareProjectEvents[_0x1bfb('0x4')](_0x97f448,_0x36a36a);};}exports[_0x1bfb('0x5')]=function(_0x414fc5){for(var _0x3d125c=0x0,_0x42a372=events['length'];_0x3d125c<_0x42a372;_0x3d125c++){var _0xcbd915=events[_0x3d125c];var _0x3daccf=createListener(_0x1bfb('0x6')+_0xcbd915,_0x414fc5);SquareProjectEvents['on'](_0xcbd915,_0x3daccf);}}; \ No newline at end of file +var _0x876e=['squareProject:','remove','emit','register','length'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x876e,0x17d));var _0xe876=function(_0x488884,_0x30f62f){_0x488884=_0x488884-0x0;var _0x5cccc7=_0x876e[_0x488884];return _0x5cccc7;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=['save',_0xe876('0x0'),'update'];function createListener(_0x235788,_0x1db281){return function(_0x308795){_0x1db281[_0xe876('0x1')](_0x235788,_0x308795);};}function removeListener(_0x17d094,_0x1ce745){return function(){SquareProjectEvents['removeListener'](_0x17d094,_0x1ce745);};}exports[_0xe876('0x2')]=function(_0x45ab9c){for(var _0x2182cc=0x0,_0x2f05eb=events[_0xe876('0x3')];_0x2182cc<_0x2f05eb;_0x2182cc++){var _0x14177f=events[_0x2182cc];var _0x2b114c=createListener(_0xe876('0x4')+_0x14177f,_0x45ab9c);SquareProjectEvents['on'](_0x14177f,_0x2b114c);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 6091c49..f05b5d4 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 _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(_0x4f907c,_0x518abb){var _0x1c7352=function(_0x5b0b06){while(--_0x5b0b06){_0x4f907c['push'](_0x4f907c['shift']());}};_0x1c7352(++_0x518abb);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x4c7410,_0x43bf77){_0x4c7410=_0x4c7410-0x0;var _0x2cf87d=_0x7fbe[_0x4c7410];return _0x2cf87d;};'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 +var _0x5fab=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','create','put','update','delete','destroy','multer','util','connect-timeout'];(function(_0x2245b8,_0x5284fc){var _0x407de6=function(_0x4b470e){while(--_0x4b470e){_0x2245b8['push'](_0x2245b8['shift']());}};_0x407de6(++_0x5284fc);}(_0x5fab,0x177));var _0xb5fa=function(_0x46827d,_0x1c6b7a){_0x46827d=_0x46827d-0x0;var _0x38d03e=_0x5fab[_0x46827d];return _0x38d03e;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var fs_extra=require(_0xb5fa('0x5'));var auth=require(_0xb5fa('0x6'));var interaction=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var controller=require(_0xb5fa('0x9'));router[_0xb5fa('0xa')]('/',auth[_0xb5fa('0xb')](),controller['index']);router['get'](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xd')]);router['get'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0x11')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x12')]);router[_0xb5fa('0x13')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 608b871..4e6a5c4 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 _0x5fc3=['sequelize','exports','STRING','VIRTUAL','getDataValue','savePath','substring','lastIndexOf'];(function(_0x424501,_0x42096d){var _0xb719af=function(_0x37adcf){while(--_0x37adcf){_0x424501['push'](_0x424501['shift']());}};_0xb719af(++_0x42096d);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4c3ffe,_0x457374){_0x4c3ffe=_0x4c3ffe-0x0;var _0x28d3eb=_0x5fc3[_0x4c3ffe];return _0x28d3eb;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x35fc('0x2')]},'calleridname':{'type':Sequelize[_0x35fc('0x2')]},'context':{'type':Sequelize[_0x35fc('0x2')]},'extension':{'type':Sequelize[_0x35fc('0x2')]},'priority':{'type':Sequelize[_0x35fc('0x2')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x35fc('0x2')]},'projectName':{'type':Sequelize[_0x35fc('0x2')]},'saveName':{'type':Sequelize[_0x35fc('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x35fc('0x3')],'get':function(){var _0x508b32='';var _0x16e153=this[_0x35fc('0x4')](_0x35fc('0x5'));if(_0x16e153){_0x508b32=_0x16e153[_0x35fc('0x6')](_0x16e153[_0x35fc('0x7')]('.'));}return _0x508b32;}}}; \ No newline at end of file +var _0x5fd1=['STRING','VIRTUAL','getDataValue','savePath','substring','sequelize'];(function(_0x1a6dd6,_0x3d2375){var _0xfb563f=function(_0x23e134){while(--_0x23e134){_0x1a6dd6['push'](_0x1a6dd6['shift']());}};_0xfb563f(++_0x3d2375);}(_0x5fd1,0x155));var _0x15fd=function(_0xc6c4a7,_0x28bc21){_0xc6c4a7=_0xc6c4a7-0x0;var _0x20591d=_0x5fd1[_0xc6c4a7];return _0x20591d;};'use strict';var Sequelize=require(_0x15fd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x15fd('0x1')]},'callerid':{'type':Sequelize[_0x15fd('0x1')]},'calleridname':{'type':Sequelize[_0x15fd('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x15fd('0x1')]},'accountcode':{'type':Sequelize[_0x15fd('0x1')]},'dnid':{'type':Sequelize[_0x15fd('0x1')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0x15fd('0x1')]},'filename':{'type':Sequelize[_0x15fd('0x1')]},'savePath':{'type':Sequelize[_0x15fd('0x1')]},'format':{'type':Sequelize[_0x15fd('0x2')],'get':function(){var _0x225728='';var _0x534e63=this[_0x15fd('0x3')](_0x15fd('0x4'));if(_0x534e63){_0x225728=_0x534e63[_0x15fd('0x5')](_0x534e63['lastIndexOf']('.'));}return _0x225728;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 2051f26..7d4cd2f 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 _0x3576=['SquareRecording','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','nolimit','order','where','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','download','../../components/encryptor','uniqueid','savePath','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','filename','extname','unlink','SquareRecording\x20not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','unlinkSync','.cypher','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','destroy','then','end','stack','name','send','index','map'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x3576,0x1b8));var _0x6357=function(_0x5440d3,_0x517582){_0x5440d3=_0x5440d3-0x0;var _0x7a1b09=_0x3576[_0x5440d3];return _0x7a1b09;};'use strict';var emlformat=require(_0x6357('0x0'));var rimraf=require(_0x6357('0x1'));var zipdir=require(_0x6357('0x2'));var jsonpatch=require(_0x6357('0x3'));var rp=require(_0x6357('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6357('0x5'));var path=require(_0x6357('0x6'));var sox=require(_0x6357('0x7'));var csv=require('to-csv');var ejs=require(_0x6357('0x8'));var fs=require('fs');var fs_extra=require(_0x6357('0x9'));var _=require('lodash');var squel=require(_0x6357('0xa'));var crypto=require(_0x6357('0xb'));var jsforce=require(_0x6357('0xc'));var deskjs=require(_0x6357('0xd'));var toCsv=require(_0x6357('0xe'));var querystring=require('querystring');var Papa=require(_0x6357('0xf'));var Redis=require(_0x6357('0x10'));var authService=require(_0x6357('0x11'));var qs=require(_0x6357('0x12'));var as=require(_0x6357('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6357('0x14'))(_0x6357('0x15'));var utils=require(_0x6357('0x16'));var config=require(_0x6357('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6357('0x18'))['db'];function respondWithStatusCode(_0x1ff0d7,_0x43364f){_0x43364f=_0x43364f||0xcc;return function(_0x5834cd){if(_0x5834cd){return _0x1ff0d7[_0x6357('0x19')](_0x43364f);}return _0x1ff0d7[_0x6357('0x1a')](_0x43364f)['end']();};}function respondWithResult(_0x15b0f8,_0x5989ba){_0x5989ba=_0x5989ba||0xc8;return function(_0x4c7b02){if(_0x4c7b02){return _0x15b0f8[_0x6357('0x1a')](_0x5989ba)[_0x6357('0x1b')](_0x4c7b02);}};}function respondWithFilteredResult(_0x281596,_0x617a55){return function(_0xb1998e){if(_0xb1998e){var _0x22d347=typeof _0x617a55[_0x6357('0x1c')]===_0x6357('0x1d')&&typeof _0x617a55['limit']===_0x6357('0x1d');var _0x23334a=_0xb1998e[_0x6357('0x1e')];var _0x52f3d5=_0x22d347?0x0:_0x617a55[_0x6357('0x1c')];var _0x6284ad=_0x22d347?_0xb1998e['count']:_0x617a55['offset']+_0x617a55[_0x6357('0x1f')];var _0x3374b8;if(_0x6284ad>=_0x23334a){_0x6284ad=_0x23334a;_0x3374b8=0xc8;}else{_0x3374b8=0xce;}_0x281596[_0x6357('0x1a')](_0x3374b8);return _0x281596[_0x6357('0x20')](_0x6357('0x21'),_0x52f3d5+'-'+_0x6284ad+'/'+_0x23334a)[_0x6357('0x1b')](_0xb1998e);}return null;};}function patchUpdates(_0x4ec667){return function(_0x57e52b){try{jsonpatch[_0x6357('0x22')](_0x57e52b,_0x4ec667,!![]);}catch(_0x273165){return BPromise[_0x6357('0x23')](_0x273165);}return _0x57e52b['save']();};}function saveUpdates(_0x22349e,_0x4567f8){return function(_0x2424ba){if(_0x2424ba){return _0x2424ba[_0x6357('0x24')](_0x22349e)['then'](function(_0x10e3e5){return _0x10e3e5;});}return null;};}function removeEntity(_0x147764,_0x104b4a){return function(_0x245919){if(_0x245919){return _0x245919[_0x6357('0x25')]()[_0x6357('0x26')](function(){_0x147764[_0x6357('0x1a')](0xcc)[_0x6357('0x27')]();});}};}function handleEntityNotFound(_0x36c586,_0x30ff37){return function(_0x432e59){if(!_0x432e59){_0x36c586[_0x6357('0x19')](0x194);}return _0x432e59;};}function handleError(_0x14be03,_0x43ecba){_0x43ecba=_0x43ecba||0x1f4;return function(_0x38a80c){logger['error'](_0x38a80c[_0x6357('0x28')]);if(_0x38a80c[_0x6357('0x29')]){delete _0x38a80c[_0x6357('0x29')];}_0x14be03[_0x6357('0x1a')](_0x43ecba)[_0x6357('0x2a')](_0x38a80c);};}exports[_0x6357('0x2b')]=function(_0x24fb53,_0x30fb02){var _0x11a74b={},_0x36896f={},_0xdf9299={'count':0x0,'rows':[]};var _0x4e7137=_[_0x6357('0x2c')](db[_0x6357('0x2d')]['rawAttributes'],function(_0x550d66){return{'name':_0x550d66[_0x6357('0x2e')],'type':_0x550d66[_0x6357('0x2f')][_0x6357('0x30')]};});_0x36896f['model']=_[_0x6357('0x2c')](_0x4e7137,_0x6357('0x29'));_0x36896f['query']=_[_0x6357('0x31')](_0x24fb53[_0x6357('0x32')]);_0x36896f[_0x6357('0x33')]=_[_0x6357('0x34')](_0x36896f[_0x6357('0x35')],_0x36896f[_0x6357('0x32')]);_0x11a74b[_0x6357('0x36')]=_['intersection'](_0x36896f[_0x6357('0x35')],qs['fields'](_0x24fb53[_0x6357('0x32')][_0x6357('0x37')]));_0x11a74b[_0x6357('0x36')]=_0x11a74b['attributes']['length']?_0x11a74b[_0x6357('0x36')]:_0x36896f[_0x6357('0x35')];if(!_0x24fb53[_0x6357('0x32')]['hasOwnProperty'](_0x6357('0x38'))){_0x11a74b[_0x6357('0x1f')]=qs[_0x6357('0x1f')](_0x24fb53['query'][_0x6357('0x1f')]);_0x11a74b[_0x6357('0x1c')]=qs[_0x6357('0x1c')](_0x24fb53['query'][_0x6357('0x1c')]);}_0x11a74b[_0x6357('0x39')]=qs['sort'](_0x24fb53['query']['sort']);_0x11a74b[_0x6357('0x3a')]=qs['filters'](_['pick'](_0x24fb53[_0x6357('0x32')],_0x36896f[_0x6357('0x33')]),_0x4e7137);if(_0x24fb53['query'][_0x6357('0x3b')]){_0x11a74b[_0x6357('0x3a')]=_['merge'](_0x11a74b[_0x6357('0x3a')],{'$or':_[_0x6357('0x2c')](_0x4e7137,function(_0x289060){if(_0x289060[_0x6357('0x2f')]!==_0x6357('0x3c')){var _0x16e55f={};_0x16e55f[_0x289060['name']]={'$like':'%'+_0x24fb53[_0x6357('0x32')][_0x6357('0x3b')]+'%'};return _0x16e55f;}})});}_0x11a74b=_[_0x6357('0x3d')]({},_0x11a74b,_0x24fb53['options']);var _0x514741={'where':_0x11a74b[_0x6357('0x3a')]};return db[_0x6357('0x2d')][_0x6357('0x1e')](_0x514741)[_0x6357('0x26')](function(_0x4d581c){_0xdf9299['count']=_0x4d581c;if(_0x24fb53[_0x6357('0x32')][_0x6357('0x3e')]){_0x11a74b[_0x6357('0x3f')]=[{'all':!![]}];}return db[_0x6357('0x2d')][_0x6357('0x40')](_0x11a74b);})[_0x6357('0x26')](function(_0x3ad5c0){_0xdf9299[_0x6357('0x41')]=_0x3ad5c0;return _0xdf9299;})[_0x6357('0x26')](respondWithFilteredResult(_0x30fb02,_0x11a74b))[_0x6357('0x42')](handleError(_0x30fb02,null));};exports[_0x6357('0x43')]=function(_0x1ce29f,_0x13056d){var _0x4f3456={'raw':!![],'where':{'id':_0x1ce29f[_0x6357('0x44')]['id']}},_0x2332b9={};_0x2332b9[_0x6357('0x35')]=_['keys'](db[_0x6357('0x2d')][_0x6357('0x45')]);_0x2332b9[_0x6357('0x32')]=_[_0x6357('0x31')](_0x1ce29f[_0x6357('0x32')]);_0x2332b9[_0x6357('0x33')]=_[_0x6357('0x34')](_0x2332b9['model'],_0x2332b9[_0x6357('0x32')]);_0x4f3456[_0x6357('0x36')]=_['intersection'](_0x2332b9['model'],qs[_0x6357('0x37')](_0x1ce29f[_0x6357('0x32')][_0x6357('0x37')]));_0x4f3456[_0x6357('0x36')]=_0x4f3456['attributes']['length']?_0x4f3456[_0x6357('0x36')]:_0x2332b9[_0x6357('0x35')];if(_0x1ce29f[_0x6357('0x32')][_0x6357('0x3e')]){_0x4f3456[_0x6357('0x3f')]=[{'all':!![]}];}_0x4f3456=_[_0x6357('0x3d')]({},_0x4f3456,_0x1ce29f['options']);return db['SquareRecording'][_0x6357('0x46')](_0x4f3456)[_0x6357('0x26')](handleEntityNotFound(_0x13056d,null))['then'](respondWithResult(_0x13056d,null))[_0x6357('0x42')](handleError(_0x13056d,null));};exports[_0x6357('0x47')]=function(_0x5898a6,_0x5715ee){return db[_0x6357('0x2d')][_0x6357('0x47')](_0x5898a6[_0x6357('0x48')],{})[_0x6357('0x26')](respondWithResult(_0x5715ee,0xc9))['catch'](handleError(_0x5715ee,null));};exports[_0x6357('0x24')]=function(_0xdd0b20,_0x12bc9a){if(_0xdd0b20['body']['id']){delete _0xdd0b20[_0x6357('0x48')]['id'];}return db[_0x6357('0x2d')][_0x6357('0x46')]({'where':{'id':_0xdd0b20[_0x6357('0x44')]['id']}})[_0x6357('0x26')](handleEntityNotFound(_0x12bc9a,null))[_0x6357('0x26')](saveUpdates(_0xdd0b20[_0x6357('0x48')],null))[_0x6357('0x26')](respondWithResult(_0x12bc9a,null))['catch'](handleError(_0x12bc9a,null));};exports[_0x6357('0x49')]=function(_0x23a0c3,_0x20bd97,_0x32c83c){var _0x144354=require(_0x6357('0x4a'));var _0x226dab=![];var _0x4f9f95={};if(_0x23a0c3[_0x6357('0x32')]['type']&&_0x23a0c3[_0x6357('0x32')][_0x6357('0x2f')]===_0x6357('0x4b')){_0x4f9f95[_0x6357('0x4b')]=_0x23a0c3[_0x6357('0x44')]['id'];}else{_0x4f9f95['id']=_0x23a0c3['params']['id'];}return db[_0x6357('0x2d')][_0x6357('0x46')]({'where':_0x4f9f95,'attributes':['id',_0x6357('0x4c'),'filename'],'raw':!![]})['then'](handleEntityNotFound(_0x20bd97,null))[_0x6357('0x26')](function(_0x5de739){if(_0x5de739){var _0x31b20f=_0x5de739['savePath'];var _0x50e75a=util[_0x6357('0x4d')](_0x6357('0x4e'),_0x31b20f);if(fs[_0x6357('0x4f')](_0x50e75a)){_0x226dab=!![];return _0x144354[_0x6357('0x50')](_0x50e75a,_0x31b20f,config[_0x6357('0x51')][_0x6357('0x52')])[_0x6357('0x26')](function(){return _0x5de739;});}return _0x5de739;}})[_0x6357('0x26')](function(_0x1e6449){if(_0x1e6449){var _0x5f069e=_0x1e6449[_0x6357('0x4c')];if(!fs['existsSync'](_0x5f069e)){throw new db[(_0x6357('0x53'))][(_0x6357('0x54'))]('SquareRecording\x20not\x20found');}if(_0x1e6449['filename']){return _0x20bd97[_0x6357('0x49')](_0x5f069e,_0x1e6449[_0x6357('0x55')]+path[_0x6357('0x56')](_0x5f069e),function(){if(_0x226dab){fs[_0x6357('0x57')](_0x5f069e);}});}else{return _0x20bd97['download'](_0x5f069e,function(_0x189610){if(_0x226dab){fs[_0x6357('0x57')](_0x5f069e);}});}}})[_0x6357('0x42')](function(_0x52e306){if(_0x52e306['message']===_0x6357('0x58')){_0x20bd97[_0x6357('0x1a')](0x194)[_0x6357('0x2a')]('Not\x20found');}else{return handleError(_0x20bd97,null);}});};exports[_0x6357('0x25')]=function(_0x108981,_0x2dd78b){return db[_0x6357('0x2d')][_0x6357('0x46')]({'where':{'id':_0x108981[_0x6357('0x44')]['id']}})[_0x6357('0x26')](function(_0x2e8493){if(_[_0x6357('0x59')](_0x2e8493)){throw new ReferenceError(_0x6357('0x5a'));}return _0x2e8493;})[_0x6357('0x26')](function(_0x3db8db){var _0x13c9a4=_0x3db8db[_0x6357('0x4c')];logger[_0x6357('0x5b')](_0x6357('0x5c'),_0x13c9a4);if(!_['isNil'](_0x3db8db[_0x6357('0x4c')])&&fs[_0x6357('0x4f')](_0x13c9a4)){logger[_0x6357('0x5b')]('File:\x20\x22'+_0x13c9a4+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x6357('0x5d')](_0x13c9a4);}_0x13c9a4=_0x13c9a4+_0x6357('0x5e');if(!_[_0x6357('0x59')](_0x3db8db['savePath'])&&fs['existsSync'](_0x13c9a4)){logger['info'](_0x6357('0x5f')+_0x13c9a4+_0x6357('0x60'));fs[_0x6357('0x5d')](_0x13c9a4);}return _0x3db8db;})[_0x6357('0x26')](function(_0x4564db){if(!_0x4564db)throw new InternalError();return _0x4564db[_0x6357('0x25')]();})['then'](function(){_0x2dd78b[_0x6357('0x1a')](0xcc)[_0x6357('0x27')]();})['catch'](handleError(_0x2dd78b,null));}; \ No newline at end of file +var _0x73e9=['uniqueid','filename','savePath','format','%s.cypher','existsSync','decryptFile','secrets','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','send','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','count','limit','set','apply','update','then','destroy','end','sendStatus','stack','name','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','catch','show','SquareRecording','find','create','body','params','download','../../components/encryptor'];(function(_0x3cc4fa,_0x29fff5){var _0x571e48=function(_0x2ac9a5){while(--_0x2ac9a5){_0x3cc4fa['push'](_0x3cc4fa['shift']());}};_0x571e48(++_0x29fff5);}(_0x73e9,0x186));var _0x973e=function(_0x1a2ac5,_0x431ac7){_0x1a2ac5=_0x1a2ac5-0x0;var _0x2cedd0=_0x73e9[_0x1a2ac5];return _0x2cedd0;};'use strict';var emlformat=require(_0x973e('0x0'));var rimraf=require(_0x973e('0x1'));var zipdir=require(_0x973e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x973e('0x3'));var moment=require(_0x973e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x973e('0x5'));var util=require('util');var path=require(_0x973e('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x973e('0x7'));var fs=require('fs');var fs_extra=require(_0x973e('0x8'));var _=require(_0x973e('0x9'));var squel=require(_0x973e('0xa'));var crypto=require(_0x973e('0xb'));var jsforce=require(_0x973e('0xc'));var deskjs=require(_0x973e('0xd'));var toCsv=require('to-csv');var querystring=require(_0x973e('0xe'));var Papa=require(_0x973e('0xf'));var Redis=require(_0x973e('0x10'));var authService=require(_0x973e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x973e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x973e('0x13'))(_0x973e('0x14'));var utils=require(_0x973e('0x15'));var config=require(_0x973e('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x973e('0x17'))['db'];function respondWithStatusCode(_0x395d2c,_0x18e3ee){_0x18e3ee=_0x18e3ee||0xcc;return function(_0x5ce717){if(_0x5ce717){return _0x395d2c['sendStatus'](_0x18e3ee);}return _0x395d2c['status'](_0x18e3ee)['end']();};}function respondWithResult(_0x5c1d5d,_0x5a34f4){_0x5a34f4=_0x5a34f4||0xc8;return function(_0x5e9229){if(_0x5e9229){return _0x5c1d5d[_0x973e('0x18')](_0x5a34f4)[_0x973e('0x19')](_0x5e9229);}};}function respondWithFilteredResult(_0xb352c,_0x34af8b){return function(_0x3be69c){if(_0x3be69c){var _0x57b200=typeof _0x34af8b[_0x973e('0x1a')]==='undefined'&&typeof _0x34af8b['limit']==='undefined';var _0x87b3a=_0x3be69c[_0x973e('0x1b')];var _0x5ca413=_0x57b200?0x0:_0x34af8b['offset'];var _0xdfe8eb=_0x57b200?_0x3be69c[_0x973e('0x1b')]:_0x34af8b[_0x973e('0x1a')]+_0x34af8b[_0x973e('0x1c')];var _0x242478;if(_0xdfe8eb>=_0x87b3a){_0xdfe8eb=_0x87b3a;_0x242478=0xc8;}else{_0x242478=0xce;}_0xb352c['status'](_0x242478);return _0xb352c[_0x973e('0x1d')]('Content-Range',_0x5ca413+'-'+_0xdfe8eb+'/'+_0x87b3a)[_0x973e('0x19')](_0x3be69c);}return null;};}function patchUpdates(_0x49d5cf){return function(_0x16a9ab){try{jsonpatch[_0x973e('0x1e')](_0x16a9ab,_0x49d5cf,!![]);}catch(_0x5e28bf){return BPromise['reject'](_0x5e28bf);}return _0x16a9ab['save']();};}function saveUpdates(_0x2fa6e9,_0x50d3a9){return function(_0x2e834d){if(_0x2e834d){return _0x2e834d[_0x973e('0x1f')](_0x2fa6e9)[_0x973e('0x20')](function(_0x3cbc98){return _0x3cbc98;});}return null;};}function removeEntity(_0x10324a,_0x5a3500){return function(_0x3b4472){if(_0x3b4472){return _0x3b4472[_0x973e('0x21')]()[_0x973e('0x20')](function(){_0x10324a[_0x973e('0x18')](0xcc)[_0x973e('0x22')]();});}};}function handleEntityNotFound(_0x3bffca,_0x27805b){return function(_0x191482){if(!_0x191482){_0x3bffca[_0x973e('0x23')](0x194);}return _0x191482;};}function handleError(_0x4058a1,_0x1df569){_0x1df569=_0x1df569||0x1f4;return function(_0x10d417){logger['error'](_0x10d417[_0x973e('0x24')]);if(_0x10d417['name']){delete _0x10d417[_0x973e('0x25')];}_0x4058a1[_0x973e('0x18')](_0x1df569)['send'](_0x10d417);};}exports[_0x973e('0x26')]=function(_0x2dfa80,_0x8d136){var _0xf0551e={},_0xc754fb={},_0x47fcb0={'count':0x0,'rows':[]};var _0x3616c3=_[_0x973e('0x27')](db['SquareRecording'][_0x973e('0x28')],function(_0x246348){return{'name':_0x246348[_0x973e('0x29')],'type':_0x246348[_0x973e('0x2a')]['key']};});_0xc754fb['model']=_[_0x973e('0x27')](_0x3616c3,'name');_0xc754fb[_0x973e('0x2b')]=_[_0x973e('0x2c')](_0x2dfa80[_0x973e('0x2b')]);_0xc754fb[_0x973e('0x2d')]=_[_0x973e('0x2e')](_0xc754fb[_0x973e('0x2f')],_0xc754fb[_0x973e('0x2b')]);_0xf0551e[_0x973e('0x30')]=_[_0x973e('0x2e')](_0xc754fb[_0x973e('0x2f')],qs[_0x973e('0x31')](_0x2dfa80[_0x973e('0x2b')][_0x973e('0x31')]));_0xf0551e[_0x973e('0x30')]=_0xf0551e[_0x973e('0x30')][_0x973e('0x32')]?_0xf0551e[_0x973e('0x30')]:_0xc754fb[_0x973e('0x2f')];if(!_0x2dfa80[_0x973e('0x2b')]['hasOwnProperty'](_0x973e('0x33'))){_0xf0551e[_0x973e('0x1c')]=qs[_0x973e('0x1c')](_0x2dfa80[_0x973e('0x2b')][_0x973e('0x1c')]);_0xf0551e[_0x973e('0x1a')]=qs[_0x973e('0x1a')](_0x2dfa80['query']['offset']);}_0xf0551e[_0x973e('0x34')]=qs[_0x973e('0x35')](_0x2dfa80['query'][_0x973e('0x35')]);_0xf0551e[_0x973e('0x36')]=qs['filters'](_[_0x973e('0x37')](_0x2dfa80[_0x973e('0x2b')],_0xc754fb[_0x973e('0x2d')]),_0x3616c3);if(_0x2dfa80[_0x973e('0x2b')][_0x973e('0x38')]){_0xf0551e[_0x973e('0x36')]=_[_0x973e('0x39')](_0xf0551e[_0x973e('0x36')],{'$or':_[_0x973e('0x27')](_0x3616c3,function(_0x3a726f){if(_0x3a726f[_0x973e('0x2a')]!=='VIRTUAL'){var _0x84a8d1={};_0x84a8d1[_0x3a726f[_0x973e('0x25')]]={'$like':'%'+_0x2dfa80[_0x973e('0x2b')]['filter']+'%'};return _0x84a8d1;}})});}_0xf0551e=_[_0x973e('0x39')]({},_0xf0551e,_0x2dfa80[_0x973e('0x3a')]);var _0x2b0318={'where':_0xf0551e[_0x973e('0x36')]};return db['SquareRecording'][_0x973e('0x1b')](_0x2b0318)[_0x973e('0x20')](function(_0x1a1a86){_0x47fcb0[_0x973e('0x1b')]=_0x1a1a86;if(_0x2dfa80[_0x973e('0x2b')]['includeAll']){_0xf0551e[_0x973e('0x3b')]=[{'all':!![]}];}return db['SquareRecording'][_0x973e('0x3c')](_0xf0551e);})[_0x973e('0x20')](function(_0x2a8b6a){_0x47fcb0['rows']=_0x2a8b6a;return _0x47fcb0;})['then'](respondWithFilteredResult(_0x8d136,_0xf0551e))[_0x973e('0x3d')](handleError(_0x8d136,null));};exports[_0x973e('0x3e')]=function(_0x3a23cb,_0x1c4b9b){var _0x5baa4f={'raw':!![],'where':{'id':_0x3a23cb['params']['id']}},_0x351ecd={};_0x351ecd[_0x973e('0x2f')]=_['keys'](db[_0x973e('0x3f')]['rawAttributes']);_0x351ecd[_0x973e('0x2b')]=_['keys'](_0x3a23cb[_0x973e('0x2b')]);_0x351ecd[_0x973e('0x2d')]=_[_0x973e('0x2e')](_0x351ecd[_0x973e('0x2f')],_0x351ecd['query']);_0x5baa4f[_0x973e('0x30')]=_[_0x973e('0x2e')](_0x351ecd['model'],qs['fields'](_0x3a23cb[_0x973e('0x2b')]['fields']));_0x5baa4f[_0x973e('0x30')]=_0x5baa4f[_0x973e('0x30')]['length']?_0x5baa4f[_0x973e('0x30')]:_0x351ecd[_0x973e('0x2f')];if(_0x3a23cb[_0x973e('0x2b')]['includeAll']){_0x5baa4f[_0x973e('0x3b')]=[{'all':!![]}];}_0x5baa4f=_[_0x973e('0x39')]({},_0x5baa4f,_0x3a23cb[_0x973e('0x3a')]);return db['SquareRecording'][_0x973e('0x40')](_0x5baa4f)[_0x973e('0x20')](handleEntityNotFound(_0x1c4b9b,null))[_0x973e('0x20')](respondWithResult(_0x1c4b9b,null))['catch'](handleError(_0x1c4b9b,null));};exports[_0x973e('0x41')]=function(_0x59d3d1,_0x196405){return db[_0x973e('0x3f')][_0x973e('0x41')](_0x59d3d1[_0x973e('0x42')],{})[_0x973e('0x20')](respondWithResult(_0x196405,0xc9))[_0x973e('0x3d')](handleError(_0x196405,null));};exports['update']=function(_0x4dc249,_0x382655){if(_0x4dc249[_0x973e('0x42')]['id']){delete _0x4dc249[_0x973e('0x42')]['id'];}return db[_0x973e('0x3f')][_0x973e('0x40')]({'where':{'id':_0x4dc249[_0x973e('0x43')]['id']}})[_0x973e('0x20')](handleEntityNotFound(_0x382655,null))['then'](saveUpdates(_0x4dc249[_0x973e('0x42')],null))[_0x973e('0x20')](respondWithResult(_0x382655,null))['catch'](handleError(_0x382655,null));};exports[_0x973e('0x44')]=function(_0x5254b4,_0x1656ce,_0x41f743){var _0x87fd5d=require(_0x973e('0x45'));var _0x45430b=![];var _0x49118d={};if(_0x5254b4[_0x973e('0x2b')]['type']&&_0x5254b4['query'][_0x973e('0x2a')]===_0x973e('0x46')){_0x49118d[_0x973e('0x46')]=_0x5254b4[_0x973e('0x43')]['id'];}else{_0x49118d['id']=_0x5254b4[_0x973e('0x43')]['id'];}return db[_0x973e('0x3f')][_0x973e('0x40')]({'where':_0x49118d,'attributes':['id','savePath',_0x973e('0x47')],'raw':!![]})['then'](handleEntityNotFound(_0x1656ce,null))['then'](function(_0x3ced29){if(_0x3ced29){var _0x5ac313=_0x3ced29[_0x973e('0x48')];var _0x31416b=util[_0x973e('0x49')](_0x973e('0x4a'),_0x5ac313);if(fs[_0x973e('0x4b')](_0x31416b)){_0x45430b=!![];return _0x87fd5d[_0x973e('0x4c')](_0x31416b,_0x5ac313,config[_0x973e('0x4d')]['recording'])[_0x973e('0x20')](function(){return _0x3ced29;});}return _0x3ced29;}})[_0x973e('0x20')](function(_0x561368){if(_0x561368){var _0x311edf=_0x561368[_0x973e('0x48')];if(!fs[_0x973e('0x4b')](_0x311edf)){throw new db['Sequelize'][(_0x973e('0x4e'))](_0x973e('0x4f'));}if(_0x561368['filename']){return _0x1656ce[_0x973e('0x44')](_0x311edf,_0x561368['filename']+path[_0x973e('0x50')](_0x311edf),function(){if(_0x45430b){fs[_0x973e('0x51')](_0x311edf);}});}else{return _0x1656ce[_0x973e('0x44')](_0x311edf,function(_0x5efe9a){if(_0x45430b){fs['unlink'](_0x311edf);}});}}})[_0x973e('0x3d')](function(_0x5920f1){if(_0x5920f1[_0x973e('0x52')]===_0x973e('0x4f')){_0x1656ce['status'](0x194)[_0x973e('0x53')](_0x973e('0x54'));}else{return handleError(_0x1656ce,null);}});};exports['destroy']=function(_0x1debe1,_0x13d2a4){return db[_0x973e('0x3f')]['find']({'where':{'id':_0x1debe1[_0x973e('0x43')]['id']}})[_0x973e('0x20')](function(_0x4dd149){if(_[_0x973e('0x55')](_0x4dd149)){throw new ReferenceError(_0x973e('0x56'));}return _0x4dd149;})[_0x973e('0x20')](function(_0x5d9ab3){var _0x6ee0d8=_0x5d9ab3[_0x973e('0x48')];logger[_0x973e('0x57')](_0x973e('0x58'),_0x6ee0d8);if(!_[_0x973e('0x55')](_0x5d9ab3[_0x973e('0x48')])&&fs[_0x973e('0x4b')](_0x6ee0d8)){logger[_0x973e('0x57')](_0x973e('0x59')+_0x6ee0d8+_0x973e('0x5a'));fs['unlinkSync'](_0x6ee0d8);}_0x6ee0d8=_0x6ee0d8+_0x973e('0x5b');if(!_['isNil'](_0x5d9ab3['savePath'])&&fs[_0x973e('0x4b')](_0x6ee0d8)){logger[_0x973e('0x57')]('File:\x20\x22'+_0x6ee0d8+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x6ee0d8);}return _0x5d9ab3;})[_0x973e('0x20')](function(_0x14e206){if(!_0x14e206)throw new InternalError();return _0x14e206[_0x973e('0x21')]();})[_0x973e('0x20')](function(){_0x13d2a4['status'](0xcc)[_0x973e('0x22')]();})[_0x973e('0x3d')](handleError(_0x13d2a4,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 7c0a3e5..d225cfe 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 _0xdbb1=['../../config/environment','./squareRecording.attributes','define','SquareRecording','square_recordings','lodash','moment','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdbb1,0x105));var _0x1dbb=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0xdbb1[_0x40bffc];return _0x3007e9;};'use strict';var _=require(_0x1dbb('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x1dbb('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1dbb('0x2'));var rimraf=require('rimraf');var config=require(_0x1dbb('0x3'));var attributes=require(_0x1dbb('0x4'));module['exports']=function(_0x55df0f,_0xd43ce8){return _0x55df0f[_0x1dbb('0x5')](_0x1dbb('0x6'),attributes,{'tableName':_0x1dbb('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeaab=['square_recordings','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0xeaab,0xd9));var _0xbeaa=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xeaab[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xbeaa('0x0'));var util=require('util');var logger=require(_0xbeaa('0x1'))(_0xbeaa('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbeaa('0x3'));var fs=require('fs');var path=require(_0xbeaa('0x4'));var rimraf=require(_0xbeaa('0x5'));var config=require(_0xbeaa('0x6'));var attributes=require(_0xbeaa('0x7'));module[_0xbeaa('0x8')]=function(_0x396b52,_0x25c66d){return _0x396b52[_0xbeaa('0x9')](_0xbeaa('0xa'),attributes,{'tableName':_0xbeaa('0xb'),'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 1c0d807..89df192 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 _0x94b8=['info','SquareRecording,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','create','body','options','debug','CreateSquareRecording','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x1f9503,_0x8e450b){var _0xaab94f=function(_0x5b0c4d){while(--_0x5b0c4d){_0x1f9503['push'](_0x1f9503['shift']());}};_0xaab94f(++_0x8e450b);}(_0x94b8,0x130));var _0x894b=function(_0x46720c,_0x1c3abc){_0x46720c=_0x46720c-0x0;var _0x20fbae=_0x94b8[_0x46720c];return _0x20fbae;};'use strict';var _=require('lodash');var util=require(_0x894b('0x0'));var moment=require(_0x894b('0x1'));var BPromise=require(_0x894b('0x2'));var rs=require(_0x894b('0x3'));var fs=require('fs');var Redis=require(_0x894b('0x4'));var db=require(_0x894b('0x5'))['db'];var utils=require(_0x894b('0x6'));var logger=require(_0x894b('0x7'))(_0x894b('0x8'));var config=require(_0x894b('0x9'));var jayson=require(_0x894b('0xa'));var client=jayson[_0x894b('0xb')][_0x894b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x21ca49,_0x1e1567,_0x206dba){return new BPromise(function(_0x56eddb,_0x49dfae){return client[_0x894b('0xd')](_0x21ca49,_0x206dba)[_0x894b('0xe')](function(_0x56f000){logger[_0x894b('0xf')](_0x894b('0x10'),_0x1e1567,_0x894b('0x11'));logger['debug']('SquareRecording,\x20%s,\x20%s,\x20%s',_0x1e1567,'request\x20sent',JSON[_0x894b('0x12')](_0x56f000));if(_0x56f000[_0x894b('0x13')]){if(_0x56f000[_0x894b('0x13')][_0x894b('0x14')]===0x1f4){logger[_0x894b('0x13')](_0x894b('0x10'),_0x1e1567,_0x56f000['error'][_0x894b('0x15')]);return _0x49dfae(_0x56f000['error'][_0x894b('0x15')]);}logger[_0x894b('0x13')](_0x894b('0x10'),_0x1e1567,_0x56f000[_0x894b('0x13')]['message']);return _0x56eddb(_0x56f000[_0x894b('0x13')][_0x894b('0x15')]);}else{logger[_0x894b('0xf')](_0x894b('0x10'),_0x1e1567,_0x894b('0x11'));_0x56eddb(_0x56f000[_0x894b('0x16')][_0x894b('0x15')]);}})['catch'](function(_0x560f83){logger['error'](_0x894b('0x10'),_0x1e1567,_0x560f83);_0x49dfae(_0x560f83);});});}exports['CreateSquareRecording']=function(_0x3f23ed){var _0x1afcb5=this;return new Promise(function(_0x38112d,_0x1789b4){return db['SquareRecording'][_0x894b('0x17')](_0x3f23ed[_0x894b('0x18')],{'raw':_0x3f23ed[_0x894b('0x19')]?_0x3f23ed[_0x894b('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4de0c2){logger[_0x894b('0xf')]('CreateSquareRecording',_0x3f23ed);logger[_0x894b('0x1a')](_0x894b('0x1b'),_0x3f23ed,JSON[_0x894b('0x12')](_0x4de0c2));_0x38112d(_0x4de0c2);})[_0x894b('0x1c')](function(_0x39bc16){logger['error'](_0x894b('0x1b'),_0x39bc16['message'],_0x3f23ed);_0x1789b4(_0x1afcb5[_0x894b('0x13')](0x1f4,_0x39bc16[_0x894b('0x15')]));});});}; \ No newline at end of file +var _0x5f3b=['rpc','../../config/environment','client','request','then','debug','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SquareRecording,\x20%s,\x20%s','info','result','catch','CreateSquareRecording','SquareRecording','body','options','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x21d36e,_0x5dc096){var _0x4cc307=function(_0x4ae995){while(--_0x4ae995){_0x21d36e['push'](_0x21d36e['shift']());}};_0x4cc307(++_0x5dc096);}(_0x5f3b,0x173));var _0xb5f3=function(_0x2475e0,_0x1d3405){_0x2475e0=_0x2475e0-0x0;var _0x3badc1=_0x5f3b[_0x2475e0];return _0x3badc1;};'use strict';var _=require(_0xb5f3('0x0'));var util=require(_0xb5f3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb5f3('0x2'));var fs=require('fs');var Redis=require(_0xb5f3('0x3'));var db=require(_0xb5f3('0x4'))['db'];var utils=require(_0xb5f3('0x5'));var logger=require(_0xb5f3('0x6'))(_0xb5f3('0x7'));var config=require(_0xb5f3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb5f3('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4dd631,_0x3ea0d4,_0x44356b){return new BPromise(function(_0x50f502,_0x1cb6a5){return client[_0xb5f3('0xa')](_0x4dd631,_0x44356b)[_0xb5f3('0xb')](function(_0x13eba8){logger['info']('SquareRecording,\x20%s,\x20%s',_0x3ea0d4,'request\x20sent');logger[_0xb5f3('0xc')](_0xb5f3('0xd'),_0x3ea0d4,_0xb5f3('0xe'),JSON[_0xb5f3('0xf')](_0x13eba8));if(_0x13eba8[_0xb5f3('0x10')]){if(_0x13eba8['error'][_0xb5f3('0x11')]===0x1f4){logger[_0xb5f3('0x10')]('SquareRecording,\x20%s,\x20%s',_0x3ea0d4,_0x13eba8[_0xb5f3('0x10')][_0xb5f3('0x12')]);return _0x1cb6a5(_0x13eba8['error']['message']);}logger['error'](_0xb5f3('0x13'),_0x3ea0d4,_0x13eba8[_0xb5f3('0x10')][_0xb5f3('0x12')]);return _0x50f502(_0x13eba8[_0xb5f3('0x10')][_0xb5f3('0x12')]);}else{logger[_0xb5f3('0x14')]('SquareRecording,\x20%s,\x20%s',_0x3ea0d4,_0xb5f3('0xe'));_0x50f502(_0x13eba8[_0xb5f3('0x15')][_0xb5f3('0x12')]);}})[_0xb5f3('0x16')](function(_0x2b65e7){logger['error'](_0xb5f3('0x13'),_0x3ea0d4,_0x2b65e7);_0x1cb6a5(_0x2b65e7);});});}exports[_0xb5f3('0x17')]=function(_0x1ddd4e){var _0x1d3cd3=this;return new Promise(function(_0x1106d6,_0x36c767){return db[_0xb5f3('0x18')]['create'](_0x1ddd4e[_0xb5f3('0x19')],{'raw':_0x1ddd4e[_0xb5f3('0x1a')]?_0x1ddd4e[_0xb5f3('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xb5f3('0xb')](function(_0x27eeed){logger['info']('CreateSquareRecording',_0x1ddd4e);logger[_0xb5f3('0xc')](_0xb5f3('0x17'),_0x1ddd4e,JSON['stringify'](_0x27eeed));_0x1106d6(_0x27eeed);})[_0xb5f3('0x16')](function(_0x52437b){logger['error'](_0xb5f3('0x17'),_0x52437b[_0xb5f3('0x12')],_0x1ddd4e);_0x36c767(_0x1d3cd3[_0xb5f3('0x10')](0x1f4,_0x52437b[_0xb5f3('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 4c5a92f..e2ca04a 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 _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','/describe','show','post'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','/describe','show','post'];(function(_0x4bcf38,_0x3c12be){var _0x4a89be=function(_0x3215a6){while(--_0x3215a6){_0x4bcf38['push'](_0x4bcf38['shift']());}};_0x4a89be(++_0x3c12be);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 14d7d3d..e2159f6 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 _0x8913=['STRING','DATE','BOOLEAN','sequelize'];(function(_0x2fad7d,_0x5ca501){var _0x5deb8c=function(_0x20483e){while(--_0x20483e){_0x2fad7d['push'](_0x2fad7d['shift']());}};_0x5deb8c(++_0x5ca501);}(_0x8913,0x123));var _0x3891=function(_0x220d4f,_0x201bb5){_0x220d4f=_0x220d4f-0x0;var _0x546b41=_0x8913[_0x220d4f];return _0x546b41;};'use strict';var Sequelize=require(_0x3891('0x0'));module['exports']={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x3891('0x1')]},'request':{'type':Sequelize[_0x3891('0x1')]},'channel':{'type':Sequelize[_0x3891('0x1')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x3891('0x1')]},'version':{'type':Sequelize[_0x3891('0x1')]},'callerid':{'type':Sequelize[_0x3891('0x1')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x3891('0x1')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x3891('0x1')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x3891('0x1')]},'context':{'type':Sequelize[_0x3891('0x1')]},'extension':{'type':Sequelize[_0x3891('0x1')]},'priority':{'type':Sequelize[_0x3891('0x1')]},'enhanced':{'type':Sequelize[_0x3891('0x1')]},'accountcode':{'type':Sequelize[_0x3891('0x1')]},'threadid':{'type':Sequelize[_0x3891('0x1')]},'project_name':{'type':Sequelize[_0x3891('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x3891('0x2')]},'bot':{'type':Sequelize[_0x3891('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x29ae=['DATE','exports','STRING'];(function(_0x39d39d,_0x5586bd){var _0x577ac3=function(_0x12f9f2){while(--_0x12f9f2){_0x39d39d['push'](_0x39d39d['shift']());}};_0x577ac3(++_0x5586bd);}(_0x29ae,0x17e));var _0xe29a=function(_0xe55cd3,_0xf82d5){_0xe55cd3=_0xe55cd3-0x0;var _0xc42998=_0x29ae[_0xe55cd3];return _0xc42998;};'use strict';var Sequelize=require('sequelize');module[_0xe29a('0x0')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xe29a('0x1')]},'language':{'type':Sequelize[_0xe29a('0x1')]},'type':{'type':Sequelize[_0xe29a('0x1')]},'uniqueid':{'type':Sequelize[_0xe29a('0x1')]},'version':{'type':Sequelize[_0xe29a('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0xe29a('0x1')]},'callingtns':{'type':Sequelize[_0xe29a('0x1')]},'dnid':{'type':Sequelize[_0xe29a('0x1')]},'rdnis':{'type':Sequelize[_0xe29a('0x1')]},'context':{'type':Sequelize[_0xe29a('0x1')]},'extension':{'type':Sequelize[_0xe29a('0x1')]},'priority':{'type':Sequelize[_0xe29a('0x1')]},'enhanced':{'type':Sequelize[_0xe29a('0x1')]},'accountcode':{'type':Sequelize[_0xe29a('0x1')]},'threadid':{'type':Sequelize[_0xe29a('0x1')]},'project_name':{'type':Sequelize[_0xe29a('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xe29a('0x2')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 873d4c8..214ac5c 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 _0x94d1=['SquareReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','rows','show','find','create','body','catch','update','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','error','stack','name','send','map'];(function(_0x4fbe3f,_0x12f06a){var _0x44aee5=function(_0x1766a7){while(--_0x1766a7){_0x4fbe3f['push'](_0x4fbe3f['shift']());}};_0x44aee5(++_0x12f06a);}(_0x94d1,0x6a));var _0x194d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x94d1[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x194d('0x0'));var rimraf=require(_0x194d('0x1'));var zipdir=require(_0x194d('0x2'));var jsonpatch=require(_0x194d('0x3'));var rp=require(_0x194d('0x4'));var moment=require(_0x194d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x194d('0x6'));var util=require(_0x194d('0x7'));var path=require(_0x194d('0x8'));var sox=require(_0x194d('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x194d('0xa'));var squel=require(_0x194d('0xb'));var crypto=require(_0x194d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x194d('0xd'));var toCsv=require(_0x194d('0xe'));var querystring=require(_0x194d('0xf'));var Papa=require(_0x194d('0x10'));var Redis=require(_0x194d('0x11'));var authService=require(_0x194d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x194d('0x13'));var hardwareService=require(_0x194d('0x14'));var logger=require(_0x194d('0x15'))('api');var utils=require(_0x194d('0x16'));var config=require(_0x194d('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4474df,_0x5a9c50){_0x5a9c50=_0x5a9c50||0xcc;return function(_0x34cf5b){if(_0x34cf5b){return _0x4474df[_0x194d('0x18')](_0x5a9c50);}return _0x4474df[_0x194d('0x19')](_0x5a9c50)[_0x194d('0x1a')]();};}function respondWithResult(_0x595117,_0x4c62e2){_0x4c62e2=_0x4c62e2||0xc8;return function(_0x45240e){if(_0x45240e){return _0x595117[_0x194d('0x19')](_0x4c62e2)[_0x194d('0x1b')](_0x45240e);}};}function respondWithFilteredResult(_0x403012,_0x56bd93){return function(_0x1ac3be){if(_0x1ac3be){var _0x5681c7=typeof _0x56bd93[_0x194d('0x1c')]===_0x194d('0x1d')&&typeof _0x56bd93[_0x194d('0x1e')]===_0x194d('0x1d');var _0x12460d=_0x1ac3be[_0x194d('0x1f')];var _0x449229=_0x5681c7?0x0:_0x56bd93[_0x194d('0x1c')];var _0x458323=_0x5681c7?_0x1ac3be[_0x194d('0x1f')]:_0x56bd93[_0x194d('0x1c')]+_0x56bd93[_0x194d('0x1e')];var _0x4ec52c;if(_0x458323>=_0x12460d){_0x458323=_0x12460d;_0x4ec52c=0xc8;}else{_0x4ec52c=0xce;}_0x403012[_0x194d('0x19')](_0x4ec52c);return _0x403012[_0x194d('0x20')](_0x194d('0x21'),_0x449229+'-'+_0x458323+'/'+_0x12460d)[_0x194d('0x1b')](_0x1ac3be);}return null;};}function patchUpdates(_0x24e320){return function(_0x47006e){try{jsonpatch['apply'](_0x47006e,_0x24e320,!![]);}catch(_0xf3cd76){return BPromise[_0x194d('0x22')](_0xf3cd76);}return _0x47006e[_0x194d('0x23')]();};}function saveUpdates(_0x318623,_0x267515){return function(_0x4156c8){if(_0x4156c8){return _0x4156c8['update'](_0x318623)['then'](function(_0x233e39){return _0x233e39;});}return null;};}function removeEntity(_0x7d8439,_0x508af0){return function(_0x4c57de){if(_0x4c57de){return _0x4c57de['destroy']()[_0x194d('0x24')](function(){_0x7d8439[_0x194d('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2afab1,_0xb8ed42){return function(_0x1a2fe2){if(!_0x1a2fe2){_0x2afab1['sendStatus'](0x194);}return _0x1a2fe2;};}function handleError(_0x34db9b,_0x589dde){_0x589dde=_0x589dde||0x1f4;return function(_0x358030){logger[_0x194d('0x25')](_0x358030[_0x194d('0x26')]);if(_0x358030[_0x194d('0x27')]){delete _0x358030[_0x194d('0x27')];}_0x34db9b[_0x194d('0x19')](_0x589dde)[_0x194d('0x28')](_0x358030);};}exports['index']=function(_0x3f8de6,_0x456f9d){var _0x3449b7={},_0x1018c2={},_0x2a2a49={'count':0x0,'rows':[]};var _0x38d285=_[_0x194d('0x29')](db[_0x194d('0x2a')][_0x194d('0x2b')],function(_0x4c74bb){return{'name':_0x4c74bb[_0x194d('0x2c')],'type':_0x4c74bb[_0x194d('0x2d')][_0x194d('0x2e')]};});_0x1018c2[_0x194d('0x2f')]=_[_0x194d('0x29')](_0x38d285,_0x194d('0x27'));_0x1018c2['query']=_[_0x194d('0x30')](_0x3f8de6[_0x194d('0x31')]);_0x1018c2[_0x194d('0x32')]=_[_0x194d('0x33')](_0x1018c2[_0x194d('0x2f')],_0x1018c2[_0x194d('0x31')]);_0x3449b7[_0x194d('0x34')]=_['intersection'](_0x1018c2[_0x194d('0x2f')],qs[_0x194d('0x35')](_0x3f8de6['query'][_0x194d('0x35')]));_0x3449b7[_0x194d('0x34')]=_0x3449b7[_0x194d('0x34')][_0x194d('0x36')]?_0x3449b7[_0x194d('0x34')]:_0x1018c2[_0x194d('0x2f')];if(!_0x3f8de6[_0x194d('0x31')][_0x194d('0x37')]('nolimit')){_0x3449b7[_0x194d('0x1e')]=qs[_0x194d('0x1e')](_0x3f8de6['query'][_0x194d('0x1e')]);_0x3449b7[_0x194d('0x1c')]=qs[_0x194d('0x1c')](_0x3f8de6[_0x194d('0x31')]['offset']);}_0x3449b7[_0x194d('0x38')]=qs['sort'](_0x3f8de6[_0x194d('0x31')][_0x194d('0x39')]);_0x3449b7[_0x194d('0x3a')]=qs[_0x194d('0x32')](_['pick'](_0x3f8de6['query'],_0x1018c2[_0x194d('0x32')]),_0x38d285);if(_0x3f8de6['query'][_0x194d('0x3b')]){_0x3449b7[_0x194d('0x3a')]=_[_0x194d('0x3c')](_0x3449b7[_0x194d('0x3a')],{'$or':_['map'](_0x38d285,function(_0x21c115){if(_0x21c115['type']!==_0x194d('0x3d')){var _0x2d63d5={};_0x2d63d5[_0x21c115[_0x194d('0x27')]]={'$like':'%'+_0x3f8de6['query'][_0x194d('0x3b')]+'%'};return _0x2d63d5;}})});}_0x3449b7=_['merge']({},_0x3449b7,_0x3f8de6[_0x194d('0x3e')]);var _0x50b343={'where':_0x3449b7[_0x194d('0x3a')]};return db[_0x194d('0x2a')][_0x194d('0x1f')](_0x50b343)[_0x194d('0x24')](function(_0x399df9){_0x2a2a49[_0x194d('0x1f')]=_0x399df9;if(_0x3f8de6['query']['includeAll']){_0x3449b7[_0x194d('0x3f')]=[{'all':!![]}];}return db[_0x194d('0x2a')]['findAll'](_0x3449b7);})['then'](function(_0x547dae){_0x2a2a49[_0x194d('0x40')]=_0x547dae;return _0x2a2a49;})['then'](respondWithFilteredResult(_0x456f9d,_0x3449b7))['catch'](handleError(_0x456f9d,null));};exports[_0x194d('0x41')]=function(_0x2561fb,_0x4c1320){var _0x3887cf={'raw':!![],'where':{'id':_0x2561fb['params']['id']}},_0x211c0c={};_0x211c0c['model']=_['keys'](db['SquareReport'][_0x194d('0x2b')]);_0x211c0c[_0x194d('0x31')]=_[_0x194d('0x30')](_0x2561fb['query']);_0x211c0c[_0x194d('0x32')]=_[_0x194d('0x33')](_0x211c0c[_0x194d('0x2f')],_0x211c0c[_0x194d('0x31')]);_0x3887cf[_0x194d('0x34')]=_[_0x194d('0x33')](_0x211c0c[_0x194d('0x2f')],qs[_0x194d('0x35')](_0x2561fb[_0x194d('0x31')][_0x194d('0x35')]));_0x3887cf[_0x194d('0x34')]=_0x3887cf[_0x194d('0x34')][_0x194d('0x36')]?_0x3887cf[_0x194d('0x34')]:_0x211c0c[_0x194d('0x2f')];if(_0x2561fb[_0x194d('0x31')]['includeAll']){_0x3887cf['include']=[{'all':!![]}];}_0x3887cf=_[_0x194d('0x3c')]({},_0x3887cf,_0x2561fb[_0x194d('0x3e')]);return db['SquareReport'][_0x194d('0x42')](_0x3887cf)['then'](handleEntityNotFound(_0x4c1320,null))['then'](respondWithResult(_0x4c1320,null))['catch'](handleError(_0x4c1320,null));};exports[_0x194d('0x43')]=function(_0x5c26c0,_0xfc91fc){return db[_0x194d('0x2a')][_0x194d('0x43')](_0x5c26c0[_0x194d('0x44')],{})[_0x194d('0x24')](respondWithResult(_0xfc91fc,0xc9))[_0x194d('0x45')](handleError(_0xfc91fc,null));};exports[_0x194d('0x46')]=function(_0x5c77a9,_0x4a35d8){if(_0x5c77a9[_0x194d('0x44')]['id']){delete _0x5c77a9[_0x194d('0x44')]['id'];}return db[_0x194d('0x2a')]['find']({'where':{'id':_0x5c77a9[_0x194d('0x47')]['id']}})['then'](handleEntityNotFound(_0x4a35d8,null))[_0x194d('0x24')](saveUpdates(_0x5c77a9[_0x194d('0x44')],null))[_0x194d('0x24')](respondWithResult(_0x4a35d8,null))['catch'](handleError(_0x4a35d8,null));};exports[_0x194d('0x48')]=function(_0x54425d,_0x566acd){return db['SquareReport']['find']({'where':{'id':_0x54425d[_0x194d('0x47')]['id']}})[_0x194d('0x24')](handleEntityNotFound(_0x566acd,null))['then'](removeEntity(_0x566acd,null))[_0x194d('0x45')](handleError(_0x566acd,null));};exports[_0x194d('0x49')]=function(_0x4fcee8,_0x5b744e){return db[_0x194d('0x2a')][_0x194d('0x49')]()[_0x194d('0x24')](respondWithResult(_0x5b744e,null))[_0x194d('0x45')](handleError(_0x5b744e,null));}; \ No newline at end of file +var _0x169a=['where','VIRTUAL','merge','then','include','rows','catch','show','params','length','includeAll','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','sendStatus','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','pick','filter'];(function(_0x2a3f4b,_0x1e1c30){var _0x527d44=function(_0x45c6ae){while(--_0x45c6ae){_0x2a3f4b['push'](_0x2a3f4b['shift']());}};_0x527d44(++_0x1e1c30);}(_0x169a,0x18c));var _0xa169=function(_0x543311,_0x217feb){_0x543311=_0x543311-0x0;var _0x2eaffd=_0x169a[_0x543311];return _0x2eaffd;};'use strict';var emlformat=require(_0xa169('0x0'));var rimraf=require(_0xa169('0x1'));var zipdir=require(_0xa169('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa169('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa169('0x4'));var path=require(_0xa169('0x5'));var sox=require(_0xa169('0x6'));var csv=require(_0xa169('0x7'));var ejs=require(_0xa169('0x8'));var fs=require('fs');var fs_extra=require(_0xa169('0x9'));var _=require(_0xa169('0xa'));var squel=require(_0xa169('0xb'));var crypto=require('crypto');var jsforce=require(_0xa169('0xc'));var deskjs=require(_0xa169('0xd'));var toCsv=require(_0xa169('0x7'));var querystring=require(_0xa169('0xe'));var Papa=require(_0xa169('0xf'));var Redis=require(_0xa169('0x10'));var authService=require(_0xa169('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa169('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa169('0x13'))(_0xa169('0x14'));var utils=require(_0xa169('0x15'));var config=require(_0xa169('0x16'));var licenseUtil=require(_0xa169('0x17'));var db=require(_0xa169('0x18'))['db'];function respondWithStatusCode(_0x4e662a,_0x1cf5b4){_0x1cf5b4=_0x1cf5b4||0xcc;return function(_0x3918eb){if(_0x3918eb){return _0x4e662a['sendStatus'](_0x1cf5b4);}return _0x4e662a[_0xa169('0x19')](_0x1cf5b4)[_0xa169('0x1a')]();};}function respondWithResult(_0x47d3a7,_0x4627f3){_0x4627f3=_0x4627f3||0xc8;return function(_0x3ba52d){if(_0x3ba52d){return _0x47d3a7['status'](_0x4627f3)[_0xa169('0x1b')](_0x3ba52d);}};}function respondWithFilteredResult(_0x2c1c16,_0x5cbccf){return function(_0x23327c){if(_0x23327c){var _0x13422c=typeof _0x5cbccf[_0xa169('0x1c')]==='undefined'&&typeof _0x5cbccf[_0xa169('0x1d')]===_0xa169('0x1e');var _0x369879=_0x23327c[_0xa169('0x1f')];var _0x419597=_0x13422c?0x0:_0x5cbccf[_0xa169('0x1c')];var _0x513e03=_0x13422c?_0x23327c[_0xa169('0x1f')]:_0x5cbccf[_0xa169('0x1c')]+_0x5cbccf[_0xa169('0x1d')];var _0x12a163;if(_0x513e03>=_0x369879){_0x513e03=_0x369879;_0x12a163=0xc8;}else{_0x12a163=0xce;}_0x2c1c16[_0xa169('0x19')](_0x12a163);return _0x2c1c16[_0xa169('0x20')](_0xa169('0x21'),_0x419597+'-'+_0x513e03+'/'+_0x369879)[_0xa169('0x1b')](_0x23327c);}return null;};}function patchUpdates(_0x106c76){return function(_0x1c0e42){try{jsonpatch['apply'](_0x1c0e42,_0x106c76,!![]);}catch(_0x393dfb){return BPromise[_0xa169('0x22')](_0x393dfb);}return _0x1c0e42[_0xa169('0x23')]();};}function saveUpdates(_0x2ce01f,_0x35a772){return function(_0x3eaf49){if(_0x3eaf49){return _0x3eaf49[_0xa169('0x24')](_0x2ce01f)['then'](function(_0x167015){return _0x167015;});}return null;};}function removeEntity(_0x308fb8,_0x26156e){return function(_0x5ca4bb){if(_0x5ca4bb){return _0x5ca4bb['destroy']()['then'](function(){_0x308fb8[_0xa169('0x19')](0xcc)[_0xa169('0x1a')]();});}};}function handleEntityNotFound(_0x5c1617,_0x1ed1b8){return function(_0x43bb02){if(!_0x43bb02){_0x5c1617[_0xa169('0x25')](0x194);}return _0x43bb02;};}function handleError(_0x33aa43,_0x3f2f62){_0x3f2f62=_0x3f2f62||0x1f4;return function(_0x43a371){logger['error'](_0x43a371[_0xa169('0x26')]);if(_0x43a371['name']){delete _0x43a371[_0xa169('0x27')];}_0x33aa43['status'](_0x3f2f62)[_0xa169('0x28')](_0x43a371);};}exports[_0xa169('0x29')]=function(_0x4a4468,_0x58d517){var _0x1c8fe9={},_0x29583c={},_0x56bea8={'count':0x0,'rows':[]};var _0x1978d0=_[_0xa169('0x2a')](db[_0xa169('0x2b')][_0xa169('0x2c')],function(_0x2249ae){return{'name':_0x2249ae[_0xa169('0x2d')],'type':_0x2249ae[_0xa169('0x2e')][_0xa169('0x2f')]};});_0x29583c[_0xa169('0x30')]=_[_0xa169('0x2a')](_0x1978d0,'name');_0x29583c['query']=_[_0xa169('0x31')](_0x4a4468[_0xa169('0x32')]);_0x29583c[_0xa169('0x33')]=_['intersection'](_0x29583c[_0xa169('0x30')],_0x29583c[_0xa169('0x32')]);_0x1c8fe9[_0xa169('0x34')]=_[_0xa169('0x35')](_0x29583c[_0xa169('0x30')],qs['fields'](_0x4a4468[_0xa169('0x32')][_0xa169('0x36')]));_0x1c8fe9[_0xa169('0x34')]=_0x1c8fe9[_0xa169('0x34')]['length']?_0x1c8fe9['attributes']:_0x29583c[_0xa169('0x30')];if(!_0x4a4468['query'][_0xa169('0x37')]('nolimit')){_0x1c8fe9[_0xa169('0x1d')]=qs[_0xa169('0x1d')](_0x4a4468[_0xa169('0x32')]['limit']);_0x1c8fe9[_0xa169('0x1c')]=qs['offset'](_0x4a4468['query'][_0xa169('0x1c')]);}_0x1c8fe9[_0xa169('0x38')]=qs[_0xa169('0x39')](_0x4a4468[_0xa169('0x32')][_0xa169('0x39')]);_0x1c8fe9['where']=qs[_0xa169('0x33')](_[_0xa169('0x3a')](_0x4a4468['query'],_0x29583c[_0xa169('0x33')]),_0x1978d0);if(_0x4a4468[_0xa169('0x32')][_0xa169('0x3b')]){_0x1c8fe9[_0xa169('0x3c')]=_['merge'](_0x1c8fe9[_0xa169('0x3c')],{'$or':_['map'](_0x1978d0,function(_0x48dc08){if(_0x48dc08[_0xa169('0x2e')]!==_0xa169('0x3d')){var _0x23bbf1={};_0x23bbf1[_0x48dc08[_0xa169('0x27')]]={'$like':'%'+_0x4a4468[_0xa169('0x32')]['filter']+'%'};return _0x23bbf1;}})});}_0x1c8fe9=_[_0xa169('0x3e')]({},_0x1c8fe9,_0x4a4468['options']);var _0x4eddbc={'where':_0x1c8fe9[_0xa169('0x3c')]};return db[_0xa169('0x2b')]['count'](_0x4eddbc)[_0xa169('0x3f')](function(_0x444b22){_0x56bea8[_0xa169('0x1f')]=_0x444b22;if(_0x4a4468[_0xa169('0x32')]['includeAll']){_0x1c8fe9[_0xa169('0x40')]=[{'all':!![]}];}return db['SquareReport']['findAll'](_0x1c8fe9);})[_0xa169('0x3f')](function(_0x172c2d){_0x56bea8[_0xa169('0x41')]=_0x172c2d;return _0x56bea8;})[_0xa169('0x3f')](respondWithFilteredResult(_0x58d517,_0x1c8fe9))[_0xa169('0x42')](handleError(_0x58d517,null));};exports[_0xa169('0x43')]=function(_0x3769fc,_0x572f23){var _0x15805e={'raw':!![],'where':{'id':_0x3769fc[_0xa169('0x44')]['id']}},_0x6b5afe={};_0x6b5afe[_0xa169('0x30')]=_[_0xa169('0x31')](db['SquareReport']['rawAttributes']);_0x6b5afe['query']=_[_0xa169('0x31')](_0x3769fc[_0xa169('0x32')]);_0x6b5afe[_0xa169('0x33')]=_[_0xa169('0x35')](_0x6b5afe[_0xa169('0x30')],_0x6b5afe[_0xa169('0x32')]);_0x15805e[_0xa169('0x34')]=_[_0xa169('0x35')](_0x6b5afe[_0xa169('0x30')],qs[_0xa169('0x36')](_0x3769fc[_0xa169('0x32')][_0xa169('0x36')]));_0x15805e[_0xa169('0x34')]=_0x15805e[_0xa169('0x34')][_0xa169('0x45')]?_0x15805e[_0xa169('0x34')]:_0x6b5afe[_0xa169('0x30')];if(_0x3769fc[_0xa169('0x32')][_0xa169('0x46')]){_0x15805e['include']=[{'all':!![]}];}_0x15805e=_[_0xa169('0x3e')]({},_0x15805e,_0x3769fc['options']);return db[_0xa169('0x2b')][_0xa169('0x47')](_0x15805e)[_0xa169('0x3f')](handleEntityNotFound(_0x572f23,null))[_0xa169('0x3f')](respondWithResult(_0x572f23,null))[_0xa169('0x42')](handleError(_0x572f23,null));};exports['create']=function(_0x1e16ab,_0x37ebe4){return db[_0xa169('0x2b')][_0xa169('0x48')](_0x1e16ab[_0xa169('0x49')],{})[_0xa169('0x3f')](respondWithResult(_0x37ebe4,0xc9))[_0xa169('0x42')](handleError(_0x37ebe4,null));};exports[_0xa169('0x24')]=function(_0xbb5faa,_0x59c8cb){if(_0xbb5faa[_0xa169('0x49')]['id']){delete _0xbb5faa[_0xa169('0x49')]['id'];}return db[_0xa169('0x2b')][_0xa169('0x47')]({'where':{'id':_0xbb5faa[_0xa169('0x44')]['id']}})[_0xa169('0x3f')](handleEntityNotFound(_0x59c8cb,null))[_0xa169('0x3f')](saveUpdates(_0xbb5faa[_0xa169('0x49')],null))[_0xa169('0x3f')](respondWithResult(_0x59c8cb,null))[_0xa169('0x42')](handleError(_0x59c8cb,null));};exports[_0xa169('0x4a')]=function(_0x184e54,_0x1f0450){return db['SquareReport'][_0xa169('0x47')]({'where':{'id':_0x184e54[_0xa169('0x44')]['id']}})['then'](handleEntityNotFound(_0x1f0450,null))[_0xa169('0x3f')](removeEntity(_0x1f0450,null))[_0xa169('0x42')](handleError(_0x1f0450,null));};exports['describe']=function(_0x1e0681,_0x3eea74){return db[_0xa169('0x2b')][_0xa169('0x4b')]()[_0xa169('0x3f')](respondWithResult(_0x3eea74,null))[_0xa169('0x42')](handleError(_0x3eea74,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index dee7483..d27dd69 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 _0x4dc8=['exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x25e723,_0x1d6c30){var _0xde8ebf=function(_0x34bd28){while(--_0x34bd28){_0x25e723['push'](_0x25e723['shift']());}};_0xde8ebf(++_0x1d6c30);}(_0x4dc8,0x161));var _0x84dc=function(_0x3748da,_0xb30124){_0x3748da=_0x3748da-0x0;var _0x45eee7=_0x4dc8[_0x3748da];return _0x45eee7;};'use strict';var _=require('lodash');var util=require(_0x84dc('0x0'));var logger=require('../../config/logger')(_0x84dc('0x1'));var moment=require(_0x84dc('0x2'));var BPromise=require(_0x84dc('0x3'));var rp=require(_0x84dc('0x4'));var fs=require('fs');var path=require(_0x84dc('0x5'));var rimraf=require(_0x84dc('0x6'));var config=require('../../config/environment');var attributes=require('./squareReport.attributes');module[_0x84dc('0x7')]=function(_0x203ca,_0x12987f){return _0x203ca[_0x84dc('0x8')](_0x84dc('0x9'),attributes,{'tableName':_0x84dc('0xa'),'paranoid':![],'indexes':[{'name':_0x84dc('0xb'),'fields':[_0x84dc('0xc'),_0x84dc('0xd')]},{'name':_0x84dc('0xe'),'fields':[_0x84dc('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb88b=['../../config/environment','exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0x217ff6,_0x36f75d){var _0x417c93=function(_0x4787d2){while(--_0x4787d2){_0x217ff6['push'](_0x217ff6['shift']());}};_0x417c93(++_0x36f75d);}(_0xb88b,0x89));var _0xbb88=function(_0x1c02e1,_0x89b77b){_0x1c02e1=_0x1c02e1-0x0;var _0x2542f5=_0xb88b[_0x1c02e1];return _0x2542f5;};'use strict';var _=require(_0xbb88('0x0'));var util=require(_0xbb88('0x1'));var logger=require('../../config/logger')(_0xbb88('0x2'));var moment=require(_0xbb88('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb88('0x4'));var fs=require('fs');var path=require(_0xbb88('0x5'));var rimraf=require(_0xbb88('0x6'));var config=require(_0xbb88('0x7'));var attributes=require('./squareReport.attributes');module[_0xbb88('0x8')]=function(_0x453070,_0x162584){return _0x453070[_0xbb88('0x9')](_0xbb88('0xa'),attributes,{'tableName':_0xbb88('0xb'),'paranoid':![],'indexes':[{'name':_0xbb88('0xc'),'fields':[_0xbb88('0xd'),_0xbb88('0xe')]},{'name':_0xbb88('0xf'),'fields':[_0xbb88('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 8f9ecc2..6bed106 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 _0xff31=['jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','create','options','raw','CreateSquareReport','SquareReport','where','UpdateSquareReport','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0x562dd8,_0x3dbcca){var _0x3eec6d=function(_0x4ad133){while(--_0x4ad133){_0x562dd8['push'](_0x562dd8['shift']());}};_0x3eec6d(++_0x3dbcca);}(_0xff31,0x1aa));var _0x1ff3=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xff31[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0x1ff3('0x0'));var util=require('util');var moment=require(_0x1ff3('0x1'));var BPromise=require(_0x1ff3('0x2'));var rs=require(_0x1ff3('0x3'));var fs=require('fs');var Redis=require(_0x1ff3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1ff3('0x5'));var logger=require('../../config/logger')(_0x1ff3('0x6'));var config=require(_0x1ff3('0x7'));var jayson=require(_0x1ff3('0x8'));var client=jayson[_0x1ff3('0x9')][_0x1ff3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x82f65c,_0x5755f7,_0x2bb7b0){return new BPromise(function(_0x8a4bc5,_0x550cd7){return client[_0x1ff3('0xb')](_0x82f65c,_0x2bb7b0)[_0x1ff3('0xc')](function(_0x262842){logger[_0x1ff3('0xd')](_0x1ff3('0xe'),_0x5755f7,'request\x20sent');logger[_0x1ff3('0xf')](_0x1ff3('0x10'),_0x5755f7,_0x1ff3('0x11'),JSON[_0x1ff3('0x12')](_0x262842));if(_0x262842[_0x1ff3('0x13')]){if(_0x262842[_0x1ff3('0x13')][_0x1ff3('0x14')]===0x1f4){logger['error'](_0x1ff3('0xe'),_0x5755f7,_0x262842['error'][_0x1ff3('0x15')]);return _0x550cd7(_0x262842['error'][_0x1ff3('0x15')]);}logger[_0x1ff3('0x13')](_0x1ff3('0xe'),_0x5755f7,_0x262842[_0x1ff3('0x13')][_0x1ff3('0x15')]);return _0x8a4bc5(_0x262842[_0x1ff3('0x13')][_0x1ff3('0x15')]);}else{logger[_0x1ff3('0xd')](_0x1ff3('0xe'),_0x5755f7,'request\x20sent');_0x8a4bc5(_0x262842[_0x1ff3('0x16')][_0x1ff3('0x15')]);}})[_0x1ff3('0x17')](function(_0x5d8931){logger['error']('SquareReport,\x20%s,\x20%s',_0x5755f7,_0x5d8931);_0x550cd7(_0x5d8931);});});}exports['CreateSquareReport']=function(_0x2ce9f1){var _0x28d42e=this;return new Promise(function(_0x5dffdd,_0x13e881){return db['SquareReport'][_0x1ff3('0x18')](_0x2ce9f1['body'],{'raw':_0x2ce9f1[_0x1ff3('0x19')]?_0x2ce9f1[_0x1ff3('0x19')][_0x1ff3('0x1a')]===undefined?!![]:![]:!![]})[_0x1ff3('0xc')](function(_0x2481f4){logger['info'](_0x1ff3('0x1b'),_0x2ce9f1);logger[_0x1ff3('0xf')]('CreateSquareReport',_0x2ce9f1,JSON[_0x1ff3('0x12')](_0x2481f4));_0x5dffdd(_0x2481f4);})[_0x1ff3('0x17')](function(_0x1f2537){logger[_0x1ff3('0x13')](_0x1ff3('0x1b'),_0x1f2537[_0x1ff3('0x15')],_0x2ce9f1);_0x13e881(_0x28d42e['error'](0x1f4,_0x1f2537[_0x1ff3('0x15')]));});});};exports['UpdateSquareReport']=function(_0x3c4348){var _0x92986d=this;return new Promise(function(_0xb5a0fe,_0x1cd0a9){return db[_0x1ff3('0x1c')]['update'](_0x3c4348['body'],{'raw':_0x3c4348[_0x1ff3('0x19')]?_0x3c4348[_0x1ff3('0x19')][_0x1ff3('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c4348['options']?_0x3c4348[_0x1ff3('0x19')][_0x1ff3('0x1d')]||null:null,'attributes':_0x3c4348['options']?_0x3c4348['options']['attributes']||null:null,'limit':_0x3c4348[_0x1ff3('0x19')]?_0x3c4348[_0x1ff3('0x19')]['limit']||null:null})[_0x1ff3('0xc')](function(_0x9181d5){logger[_0x1ff3('0xd')](_0x1ff3('0x1e'),_0x3c4348);logger[_0x1ff3('0xf')](_0x1ff3('0x1e'),_0x3c4348,JSON[_0x1ff3('0x12')](_0x9181d5));_0xb5a0fe(_0x9181d5);})[_0x1ff3('0x17')](function(_0x3e63a0){logger[_0x1ff3('0x13')](_0x1ff3('0x1e'),_0x3e63a0[_0x1ff3('0x15')],_0x3c4348);_0x1cd0a9(_0x92986d[_0x1ff3('0x13')](0x1f4,_0x3e63a0[_0x1ff3('0x15')]));});});}; \ No newline at end of file +var _0x09a7=['request\x20sent','stringify','error','message','catch','CreateSquareReport','SquareReport','create','options','UpdateSquareReport','raw','where','attributes','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','client','request','then','info','SquareReport,\x20%s,\x20%s','SquareReport,\x20%s,\x20%s,\x20%s'];(function(_0x156e31,_0x5684ed){var _0x40c4df=function(_0x15a98d){while(--_0x15a98d){_0x156e31['push'](_0x156e31['shift']());}};_0x40c4df(++_0x5684ed);}(_0x09a7,0x196));var _0x709a=function(_0x43a5e2,_0x1ce9d1){_0x43a5e2=_0x43a5e2-0x0;var _0x2252a9=_0x09a7[_0x43a5e2];return _0x2252a9;};'use strict';var _=require(_0x709a('0x0'));var util=require(_0x709a('0x1'));var moment=require(_0x709a('0x2'));var BPromise=require(_0x709a('0x3'));var rs=require(_0x709a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x709a('0x5'))['db'];var utils=require(_0x709a('0x6'));var logger=require('../../config/logger')(_0x709a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x709a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x545aa7,_0x4d4b5b,_0x37b26f){return new BPromise(function(_0x258b54,_0x2091e5){return client[_0x709a('0x9')](_0x545aa7,_0x37b26f)[_0x709a('0xa')](function(_0x3aaf80){logger[_0x709a('0xb')](_0x709a('0xc'),_0x4d4b5b,'request\x20sent');logger['debug'](_0x709a('0xd'),_0x4d4b5b,_0x709a('0xe'),JSON[_0x709a('0xf')](_0x3aaf80));if(_0x3aaf80[_0x709a('0x10')]){if(_0x3aaf80[_0x709a('0x10')]['code']===0x1f4){logger[_0x709a('0x10')](_0x709a('0xc'),_0x4d4b5b,_0x3aaf80[_0x709a('0x10')][_0x709a('0x11')]);return _0x2091e5(_0x3aaf80[_0x709a('0x10')]['message']);}logger[_0x709a('0x10')](_0x709a('0xc'),_0x4d4b5b,_0x3aaf80['error']['message']);return _0x258b54(_0x3aaf80[_0x709a('0x10')][_0x709a('0x11')]);}else{logger[_0x709a('0xb')]('SquareReport,\x20%s,\x20%s',_0x4d4b5b,'request\x20sent');_0x258b54(_0x3aaf80['result'][_0x709a('0x11')]);}})[_0x709a('0x12')](function(_0x38789d){logger['error'](_0x709a('0xc'),_0x4d4b5b,_0x38789d);_0x2091e5(_0x38789d);});});}exports[_0x709a('0x13')]=function(_0x5641cb){var _0x54e3da=this;return new Promise(function(_0xa0b929,_0x3a8678){return db[_0x709a('0x14')][_0x709a('0x15')](_0x5641cb['body'],{'raw':_0x5641cb[_0x709a('0x16')]?_0x5641cb[_0x709a('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x709a('0xa')](function(_0x4defd0){logger[_0x709a('0xb')]('CreateSquareReport',_0x5641cb);logger['debug'](_0x709a('0x13'),_0x5641cb,JSON['stringify'](_0x4defd0));_0xa0b929(_0x4defd0);})[_0x709a('0x12')](function(_0x132872){logger['error'](_0x709a('0x13'),_0x132872[_0x709a('0x11')],_0x5641cb);_0x3a8678(_0x54e3da[_0x709a('0x10')](0x1f4,_0x132872[_0x709a('0x11')]));});});};exports[_0x709a('0x17')]=function(_0x3aaf2f){var _0x10e789=this;return new Promise(function(_0x34ba98,_0x74ded1){return db['SquareReport']['update'](_0x3aaf2f['body'],{'raw':_0x3aaf2f[_0x709a('0x16')]?_0x3aaf2f['options'][_0x709a('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3aaf2f['options']?_0x3aaf2f['options'][_0x709a('0x19')]||null:null,'attributes':_0x3aaf2f[_0x709a('0x16')]?_0x3aaf2f[_0x709a('0x16')][_0x709a('0x1a')]||null:null,'limit':_0x3aaf2f[_0x709a('0x16')]?_0x3aaf2f['options']['limit']||null:null})[_0x709a('0xa')](function(_0xae2c3f){logger[_0x709a('0xb')](_0x709a('0x17'),_0x3aaf2f);logger[_0x709a('0x1b')](_0x709a('0x17'),_0x3aaf2f,JSON['stringify'](_0xae2c3f));_0x34ba98(_0xae2c3f);})['catch'](function(_0x535192){logger[_0x709a('0x10')]('UpdateSquareReport',_0x535192['message'],_0x3aaf2f);_0x74ded1(_0x10e789[_0x709a('0x10')](0x1f4,_0x535192[_0x709a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 40e637a..c80aacc 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 _0x9072=['update','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','describe','show','post','create','/:id'];(function(_0x382ab0,_0x3a759d){var _0x2fff4d=function(_0x2627cc){while(--_0x2627cc){_0x382ab0['push'](_0x382ab0['shift']());}};_0x2fff4d(++_0x3a759d);}(_0x9072,0x87));var _0x2907=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9072[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x2907('0x0'));var util=require('util');var path=require(_0x2907('0x1'));var timeout=require(_0x2907('0x2'));var express=require(_0x2907('0x3'));var router=express[_0x2907('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2907('0x5'));var interaction=require(_0x2907('0x6'));var config=require(_0x2907('0x7'));var controller=require('./squareReportDetail.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x2907('0x8')]);router[_0x2907('0x9')](_0x2907('0xa'),auth[_0x2907('0xb')](),controller[_0x2907('0xc')]);router[_0x2907('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x2907('0xd')]);router[_0x2907('0xe')]('/',auth[_0x2907('0xb')](),controller[_0x2907('0xf')]);router['put'](_0x2907('0x10'),auth[_0x2907('0xb')](),controller[_0x2907('0x11')]);router['delete'](_0x2907('0x10'),auth[_0x2907('0xb')](),controller['destroy']);module[_0x2907('0x12')]=router; \ No newline at end of file +var _0x8220=['express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','describe','get','/:id','show','create','put','update','delete','util'];(function(_0x12e908,_0x1094f4){var _0x27985b=function(_0x1b5ded){while(--_0x1b5ded){_0x12e908['push'](_0x12e908['shift']());}};_0x27985b(++_0x1094f4);}(_0x8220,0x1df));var _0x0822=function(_0x1b0c08,_0xd7531f){_0x1b0c08=_0x1b0c08-0x0;var _0x123dbf=_0x8220[_0x1b0c08];return _0x123dbf;};'use strict';var multer=require('multer');var util=require(_0x0822('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0822('0x1'));var router=express[_0x0822('0x2')]();var fs_extra=require(_0x0822('0x3'));var auth=require(_0x0822('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0822('0x5'));var controller=require('./squareReportDetail.controller');router['get']('/',auth[_0x0822('0x6')](),controller[_0x0822('0x7')]);router['get']('/describe',auth[_0x0822('0x6')](),controller[_0x0822('0x8')]);router[_0x0822('0x9')](_0x0822('0xa'),auth[_0x0822('0x6')](),controller[_0x0822('0xb')]);router['post']('/',auth[_0x0822('0x6')](),controller[_0x0822('0xc')]);router[_0x0822('0xd')](_0x0822('0xa'),auth[_0x0822('0x6')](),controller[_0x0822('0xe')]);router[_0x0822('0xf')](_0x0822('0xa'),auth[_0x0822('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 7e12c58..4f18a25 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 _0xc877=['sequelize','exports','STRING','TEXT'];(function(_0x5d7827,_0x22cc21){var _0x5700c6=function(_0x273d56){while(--_0x273d56){_0x5d7827['push'](_0x5d7827['shift']());}};_0x5700c6(++_0x22cc21);}(_0xc877,0x190));var _0x7c87=function(_0x47d270,_0x492505){_0x47d270=_0x47d270-0x0;var _0x382d4d=_0xc877[_0x47d270];return _0x382d4d;};'use strict';var Sequelize=require(_0x7c87('0x0'));module[_0x7c87('0x1')]={'uniqueid':{'type':Sequelize[_0x7c87('0x2')]},'node':{'type':Sequelize[_0x7c87('0x2')]},'application':{'type':Sequelize[_0x7c87('0x2')]},'data':{'type':Sequelize[_0x7c87('0x3')]},'project_name':{'type':Sequelize[_0x7c87('0x2')]},'callerid':{'type':Sequelize[_0x7c87('0x2')]}}; \ No newline at end of file +var _0xde8b=['TEXT','STRING'];(function(_0x102e5e,_0x2a74e0){var _0x43ecab=function(_0xb94a70){while(--_0xb94a70){_0x102e5e['push'](_0x102e5e['shift']());}};_0x43ecab(++_0x2a74e0);}(_0xde8b,0xa3));var _0xbde8=function(_0x506067,_0xda5c79){_0x506067=_0x506067-0x0;var _0x3a3ff1=_0xde8b[_0x506067];return _0x3a3ff1;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xbde8('0x0')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0xbde8('0x0')]},'data':{'type':Sequelize[_0xbde8('0x1')]},'project_name':{'type':Sequelize[_0xbde8('0x0')]},'callerid':{'type':Sequelize[_0xbde8('0x0')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index f6b4a82..eac1da1 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 _0x88f4=['moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SquareDetailsReport','includeAll','findAll','rows','catch','params','rawAttributes','include','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise'];(function(_0x2ebe90,_0x2825d9){var _0x184e90=function(_0x1115a7){while(--_0x1115a7){_0x2ebe90['push'](_0x2ebe90['shift']());}};_0x184e90(++_0x2825d9);}(_0x88f4,0x17d));var _0x488f=function(_0x19db95,_0x1b7d24){_0x19db95=_0x19db95-0x0;var _0x4a1cc3=_0x88f4[_0x19db95];return _0x4a1cc3;};'use strict';var emlformat=require(_0x488f('0x0'));var rimraf=require(_0x488f('0x1'));var zipdir=require(_0x488f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x488f('0x3'));var moment=require(_0x488f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x488f('0x5'));var util=require('util');var path=require(_0x488f('0x6'));var sox=require('sox');var csv=require(_0x488f('0x7'));var ejs=require(_0x488f('0x8'));var fs=require('fs');var fs_extra=require(_0x488f('0x9'));var _=require(_0x488f('0xa'));var squel=require(_0x488f('0xb'));var crypto=require(_0x488f('0xc'));var jsforce=require(_0x488f('0xd'));var deskjs=require(_0x488f('0xe'));var toCsv=require(_0x488f('0x7'));var querystring=require(_0x488f('0xf'));var Papa=require(_0x488f('0x10'));var Redis=require(_0x488f('0x11'));var authService=require(_0x488f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x488f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x488f('0x14'))('api');var utils=require(_0x488f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x488f('0x16'));var db=require(_0x488f('0x17'))['db'];function respondWithStatusCode(_0x5cdbac,_0x57302c){_0x57302c=_0x57302c||0xcc;return function(_0x2dd8ca){if(_0x2dd8ca){return _0x5cdbac[_0x488f('0x18')](_0x57302c);}return _0x5cdbac[_0x488f('0x19')](_0x57302c)[_0x488f('0x1a')]();};}function respondWithResult(_0x4d45c8,_0x3b0251){_0x3b0251=_0x3b0251||0xc8;return function(_0x26c5ef){if(_0x26c5ef){return _0x4d45c8[_0x488f('0x19')](_0x3b0251)[_0x488f('0x1b')](_0x26c5ef);}};}function respondWithFilteredResult(_0xdb9a78,_0x53927f){return function(_0x4bf947){if(_0x4bf947){var _0x4e1484=typeof _0x53927f['offset']===_0x488f('0x1c')&&typeof _0x53927f[_0x488f('0x1d')]===_0x488f('0x1c');var _0xc96718=_0x4bf947[_0x488f('0x1e')];var _0x4904b8=_0x4e1484?0x0:_0x53927f[_0x488f('0x1f')];var _0x514060=_0x4e1484?_0x4bf947[_0x488f('0x1e')]:_0x53927f[_0x488f('0x1f')]+_0x53927f[_0x488f('0x1d')];var _0x5d167c;if(_0x514060>=_0xc96718){_0x514060=_0xc96718;_0x5d167c=0xc8;}else{_0x5d167c=0xce;}_0xdb9a78[_0x488f('0x19')](_0x5d167c);return _0xdb9a78[_0x488f('0x20')](_0x488f('0x21'),_0x4904b8+'-'+_0x514060+'/'+_0xc96718)[_0x488f('0x1b')](_0x4bf947);}return null;};}function patchUpdates(_0x4ab567){return function(_0x3e55ac){try{jsonpatch[_0x488f('0x22')](_0x3e55ac,_0x4ab567,!![]);}catch(_0x4da27a){return BPromise['reject'](_0x4da27a);}return _0x3e55ac['save']();};}function saveUpdates(_0x365072,_0x409840){return function(_0x5bf81b){if(_0x5bf81b){return _0x5bf81b[_0x488f('0x23')](_0x365072)[_0x488f('0x24')](function(_0x18f1b6){return _0x18f1b6;});}return null;};}function removeEntity(_0x14ff89,_0x21409b){return function(_0x4410f2){if(_0x4410f2){return _0x4410f2[_0x488f('0x25')]()[_0x488f('0x24')](function(){_0x14ff89[_0x488f('0x19')](0xcc)[_0x488f('0x1a')]();});}};}function handleEntityNotFound(_0x39a1a9,_0x30a1a2){return function(_0x10156e){if(!_0x10156e){_0x39a1a9['sendStatus'](0x194);}return _0x10156e;};}function handleError(_0x47c8d9,_0x248a2d){_0x248a2d=_0x248a2d||0x1f4;return function(_0x53cb1d){logger[_0x488f('0x26')](_0x53cb1d[_0x488f('0x27')]);if(_0x53cb1d[_0x488f('0x28')]){delete _0x53cb1d[_0x488f('0x28')];}_0x47c8d9[_0x488f('0x19')](_0x248a2d)[_0x488f('0x29')](_0x53cb1d);};}exports[_0x488f('0x2a')]=function(_0x10dfc2,_0x590f48){var _0x2266d3={},_0x577cc2={},_0x4b1075={'count':0x0,'rows':[]};var _0x45ce61=_[_0x488f('0x2b')](db['SquareDetailsReport']['rawAttributes'],function(_0x339ca3){return{'name':_0x339ca3[_0x488f('0x2c')],'type':_0x339ca3[_0x488f('0x2d')][_0x488f('0x2e')]};});_0x577cc2[_0x488f('0x2f')]=_[_0x488f('0x2b')](_0x45ce61,'name');_0x577cc2[_0x488f('0x30')]=_[_0x488f('0x31')](_0x10dfc2[_0x488f('0x30')]);_0x577cc2[_0x488f('0x32')]=_[_0x488f('0x33')](_0x577cc2[_0x488f('0x2f')],_0x577cc2[_0x488f('0x30')]);_0x2266d3[_0x488f('0x34')]=_['intersection'](_0x577cc2[_0x488f('0x2f')],qs[_0x488f('0x35')](_0x10dfc2[_0x488f('0x30')][_0x488f('0x35')]));_0x2266d3[_0x488f('0x34')]=_0x2266d3['attributes'][_0x488f('0x36')]?_0x2266d3['attributes']:_0x577cc2['model'];if(!_0x10dfc2[_0x488f('0x30')][_0x488f('0x37')](_0x488f('0x38'))){_0x2266d3[_0x488f('0x1d')]=qs[_0x488f('0x1d')](_0x10dfc2[_0x488f('0x30')][_0x488f('0x1d')]);_0x2266d3[_0x488f('0x1f')]=qs[_0x488f('0x1f')](_0x10dfc2[_0x488f('0x30')][_0x488f('0x1f')]);}_0x2266d3[_0x488f('0x39')]=qs[_0x488f('0x3a')](_0x10dfc2[_0x488f('0x30')][_0x488f('0x3a')]);_0x2266d3[_0x488f('0x3b')]=qs['filters'](_[_0x488f('0x3c')](_0x10dfc2[_0x488f('0x30')],_0x577cc2[_0x488f('0x32')]),_0x45ce61);if(_0x10dfc2['query'][_0x488f('0x3d')]){_0x2266d3['where']=_[_0x488f('0x3e')](_0x2266d3[_0x488f('0x3b')],{'$or':_['map'](_0x45ce61,function(_0x527064){if(_0x527064[_0x488f('0x2d')]!==_0x488f('0x3f')){var _0x1a3b0e={};_0x1a3b0e[_0x527064['name']]={'$like':'%'+_0x10dfc2[_0x488f('0x30')][_0x488f('0x3d')]+'%'};return _0x1a3b0e;}})});}_0x2266d3=_[_0x488f('0x3e')]({},_0x2266d3,_0x10dfc2[_0x488f('0x40')]);var _0x35e0b5={'where':_0x2266d3[_0x488f('0x3b')]};return db[_0x488f('0x41')][_0x488f('0x1e')](_0x35e0b5)[_0x488f('0x24')](function(_0x4d4f3d){_0x4b1075[_0x488f('0x1e')]=_0x4d4f3d;if(_0x10dfc2[_0x488f('0x30')][_0x488f('0x42')]){_0x2266d3['include']=[{'all':!![]}];}return db[_0x488f('0x41')][_0x488f('0x43')](_0x2266d3);})[_0x488f('0x24')](function(_0x317974){_0x4b1075[_0x488f('0x44')]=_0x317974;return _0x4b1075;})[_0x488f('0x24')](respondWithFilteredResult(_0x590f48,_0x2266d3))[_0x488f('0x45')](handleError(_0x590f48,null));};exports['show']=function(_0x43abc4,_0x4a2e46){var _0x5d32e1={'raw':!![],'where':{'id':_0x43abc4[_0x488f('0x46')]['id']}},_0x4fffe3={};_0x4fffe3[_0x488f('0x2f')]=_['keys'](db[_0x488f('0x41')][_0x488f('0x47')]);_0x4fffe3[_0x488f('0x30')]=_[_0x488f('0x31')](_0x43abc4[_0x488f('0x30')]);_0x4fffe3['filters']=_[_0x488f('0x33')](_0x4fffe3[_0x488f('0x2f')],_0x4fffe3['query']);_0x5d32e1['attributes']=_[_0x488f('0x33')](_0x4fffe3[_0x488f('0x2f')],qs['fields'](_0x43abc4[_0x488f('0x30')][_0x488f('0x35')]));_0x5d32e1[_0x488f('0x34')]=_0x5d32e1[_0x488f('0x34')][_0x488f('0x36')]?_0x5d32e1[_0x488f('0x34')]:_0x4fffe3[_0x488f('0x2f')];if(_0x43abc4[_0x488f('0x30')][_0x488f('0x42')]){_0x5d32e1[_0x488f('0x48')]=[{'all':!![]}];}_0x5d32e1=_[_0x488f('0x3e')]({},_0x5d32e1,_0x43abc4['options']);return db[_0x488f('0x41')][_0x488f('0x49')](_0x5d32e1)['then'](handleEntityNotFound(_0x4a2e46,null))[_0x488f('0x24')](respondWithResult(_0x4a2e46,null))[_0x488f('0x45')](handleError(_0x4a2e46,null));};exports[_0x488f('0x4a')]=function(_0x1aef1a,_0x4c9f6e){return db['SquareDetailsReport'][_0x488f('0x4a')](_0x1aef1a['body'],{})[_0x488f('0x24')](respondWithResult(_0x4c9f6e,0xc9))['catch'](handleError(_0x4c9f6e,null));};exports[_0x488f('0x23')]=function(_0x3c40b0,_0x33dd5b){if(_0x3c40b0['body']['id']){delete _0x3c40b0[_0x488f('0x4b')]['id'];}return db[_0x488f('0x41')][_0x488f('0x49')]({'where':{'id':_0x3c40b0['params']['id']}})[_0x488f('0x24')](handleEntityNotFound(_0x33dd5b,null))[_0x488f('0x24')](saveUpdates(_0x3c40b0['body'],null))['then'](respondWithResult(_0x33dd5b,null))[_0x488f('0x45')](handleError(_0x33dd5b,null));};exports[_0x488f('0x25')]=function(_0x6f52d0,_0x1515e9){return db[_0x488f('0x41')]['find']({'where':{'id':_0x6f52d0[_0x488f('0x46')]['id']}})['then'](handleEntityNotFound(_0x1515e9,null))[_0x488f('0x24')](removeEntity(_0x1515e9,null))[_0x488f('0x45')](handleError(_0x1515e9,null));};exports[_0x488f('0x4c')]=function(_0x4fba60,_0x4bd8eb){return db[_0x488f('0x41')]['describe']()['then'](respondWithResult(_0x4bd8eb,null))[_0x488f('0x45')](handleError(_0x4bd8eb,null));}; \ No newline at end of file +var _0x69a8=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','offset','count','set','apply','save','update','then','destroy','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','length','nolimit','order','sort','where','VIRTUAL','merge','options','SquareDetailsReport','includeAll','findAll','rows','catch','show','params','fields','include','find','create','body'];(function(_0x1be137,_0x3f1753){var _0x4d9d09=function(_0x3b4dd8){while(--_0x3b4dd8){_0x1be137['push'](_0x1be137['shift']());}};_0x4d9d09(++_0x3f1753);}(_0x69a8,0x1c2));var _0x869a=function(_0x41fbb1,_0x1a226b){_0x41fbb1=_0x41fbb1-0x0;var _0x3ddd72=_0x69a8[_0x41fbb1];return _0x3ddd72;};'use strict';var emlformat=require(_0x869a('0x0'));var rimraf=require(_0x869a('0x1'));var zipdir=require(_0x869a('0x2'));var jsonpatch=require(_0x869a('0x3'));var rp=require(_0x869a('0x4'));var moment=require(_0x869a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x869a('0x6'));var path=require(_0x869a('0x7'));var sox=require(_0x869a('0x8'));var csv=require(_0x869a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x869a('0xa'));var _=require(_0x869a('0xb'));var squel=require(_0x869a('0xc'));var crypto=require(_0x869a('0xd'));var jsforce=require(_0x869a('0xe'));var deskjs=require(_0x869a('0xf'));var toCsv=require('to-csv');var querystring=require(_0x869a('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x869a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x869a('0x12'));var hardwareService=require(_0x869a('0x13'));var logger=require(_0x869a('0x14'))(_0x869a('0x15'));var utils=require(_0x869a('0x16'));var config=require(_0x869a('0x17'));var licenseUtil=require(_0x869a('0x18'));var db=require(_0x869a('0x19'))['db'];function respondWithStatusCode(_0xa4a9a7,_0x3c587f){_0x3c587f=_0x3c587f||0xcc;return function(_0x52656e){if(_0x52656e){return _0xa4a9a7[_0x869a('0x1a')](_0x3c587f);}return _0xa4a9a7[_0x869a('0x1b')](_0x3c587f)['end']();};}function respondWithResult(_0x4a7f7b,_0x5d94ad){_0x5d94ad=_0x5d94ad||0xc8;return function(_0x2cb89a){if(_0x2cb89a){return _0x4a7f7b[_0x869a('0x1b')](_0x5d94ad)[_0x869a('0x1c')](_0x2cb89a);}};}function respondWithFilteredResult(_0x1f6669,_0x23bdec){return function(_0x45bece){if(_0x45bece){var _0xcad7f4=typeof _0x23bdec['offset']==='undefined'&&typeof _0x23bdec[_0x869a('0x1d')]===_0x869a('0x1e');var _0x173a9a=_0x45bece['count'];var _0x225619=_0xcad7f4?0x0:_0x23bdec[_0x869a('0x1f')];var _0x5317bc=_0xcad7f4?_0x45bece[_0x869a('0x20')]:_0x23bdec[_0x869a('0x1f')]+_0x23bdec[_0x869a('0x1d')];var _0x1fe01f;if(_0x5317bc>=_0x173a9a){_0x5317bc=_0x173a9a;_0x1fe01f=0xc8;}else{_0x1fe01f=0xce;}_0x1f6669[_0x869a('0x1b')](_0x1fe01f);return _0x1f6669[_0x869a('0x21')]('Content-Range',_0x225619+'-'+_0x5317bc+'/'+_0x173a9a)[_0x869a('0x1c')](_0x45bece);}return null;};}function patchUpdates(_0x3e93e1){return function(_0x2c199f){try{jsonpatch[_0x869a('0x22')](_0x2c199f,_0x3e93e1,!![]);}catch(_0x56eef6){return BPromise['reject'](_0x56eef6);}return _0x2c199f[_0x869a('0x23')]();};}function saveUpdates(_0x5d5104,_0x4992db){return function(_0x57adea){if(_0x57adea){return _0x57adea[_0x869a('0x24')](_0x5d5104)[_0x869a('0x25')](function(_0x3ac8d5){return _0x3ac8d5;});}return null;};}function removeEntity(_0xa32ea5,_0x5a4521){return function(_0x5f3bac){if(_0x5f3bac){return _0x5f3bac[_0x869a('0x26')]()[_0x869a('0x25')](function(){_0xa32ea5[_0x869a('0x1b')](0xcc)[_0x869a('0x27')]();});}};}function handleEntityNotFound(_0x367926,_0x492cc0){return function(_0x1310cc){if(!_0x1310cc){_0x367926[_0x869a('0x1a')](0x194);}return _0x1310cc;};}function handleError(_0xd45fc8,_0x5a70ad){_0x5a70ad=_0x5a70ad||0x1f4;return function(_0xba8714){logger[_0x869a('0x28')](_0xba8714[_0x869a('0x29')]);if(_0xba8714[_0x869a('0x2a')]){delete _0xba8714[_0x869a('0x2a')];}_0xd45fc8[_0x869a('0x1b')](_0x5a70ad)['send'](_0xba8714);};}exports[_0x869a('0x2b')]=function(_0x505e27,_0x48fed1){var _0x38004d={},_0x6b8bc4={},_0x43464e={'count':0x0,'rows':[]};var _0x5538f3=_[_0x869a('0x2c')](db['SquareDetailsReport'][_0x869a('0x2d')],function(_0x24db3c){return{'name':_0x24db3c[_0x869a('0x2e')],'type':_0x24db3c[_0x869a('0x2f')][_0x869a('0x30')]};});_0x6b8bc4['model']=_['map'](_0x5538f3,_0x869a('0x2a'));_0x6b8bc4[_0x869a('0x31')]=_[_0x869a('0x32')](_0x505e27[_0x869a('0x31')]);_0x6b8bc4[_0x869a('0x33')]=_['intersection'](_0x6b8bc4[_0x869a('0x34')],_0x6b8bc4[_0x869a('0x31')]);_0x38004d[_0x869a('0x35')]=_[_0x869a('0x36')](_0x6b8bc4[_0x869a('0x34')],qs['fields'](_0x505e27[_0x869a('0x31')]['fields']));_0x38004d['attributes']=_0x38004d[_0x869a('0x35')][_0x869a('0x37')]?_0x38004d[_0x869a('0x35')]:_0x6b8bc4['model'];if(!_0x505e27[_0x869a('0x31')]['hasOwnProperty'](_0x869a('0x38'))){_0x38004d['limit']=qs[_0x869a('0x1d')](_0x505e27[_0x869a('0x31')][_0x869a('0x1d')]);_0x38004d['offset']=qs['offset'](_0x505e27[_0x869a('0x31')]['offset']);}_0x38004d[_0x869a('0x39')]=qs[_0x869a('0x3a')](_0x505e27[_0x869a('0x31')][_0x869a('0x3a')]);_0x38004d[_0x869a('0x3b')]=qs[_0x869a('0x33')](_['pick'](_0x505e27[_0x869a('0x31')],_0x6b8bc4[_0x869a('0x33')]),_0x5538f3);if(_0x505e27[_0x869a('0x31')]['filter']){_0x38004d[_0x869a('0x3b')]=_['merge'](_0x38004d['where'],{'$or':_['map'](_0x5538f3,function(_0x2b76d2){if(_0x2b76d2[_0x869a('0x2f')]!==_0x869a('0x3c')){var _0x644c8a={};_0x644c8a[_0x2b76d2['name']]={'$like':'%'+_0x505e27[_0x869a('0x31')]['filter']+'%'};return _0x644c8a;}})});}_0x38004d=_[_0x869a('0x3d')]({},_0x38004d,_0x505e27[_0x869a('0x3e')]);var _0x14477b={'where':_0x38004d[_0x869a('0x3b')]};return db[_0x869a('0x3f')][_0x869a('0x20')](_0x14477b)[_0x869a('0x25')](function(_0x58a5b7){_0x43464e[_0x869a('0x20')]=_0x58a5b7;if(_0x505e27[_0x869a('0x31')][_0x869a('0x40')]){_0x38004d['include']=[{'all':!![]}];}return db[_0x869a('0x3f')][_0x869a('0x41')](_0x38004d);})[_0x869a('0x25')](function(_0x451583){_0x43464e[_0x869a('0x42')]=_0x451583;return _0x43464e;})[_0x869a('0x25')](respondWithFilteredResult(_0x48fed1,_0x38004d))[_0x869a('0x43')](handleError(_0x48fed1,null));};exports[_0x869a('0x44')]=function(_0x2d1c92,_0x4d35b6){var _0x66c5b4={'raw':!![],'where':{'id':_0x2d1c92[_0x869a('0x45')]['id']}},_0x3e1a7b={};_0x3e1a7b[_0x869a('0x34')]=_[_0x869a('0x32')](db[_0x869a('0x3f')][_0x869a('0x2d')]);_0x3e1a7b[_0x869a('0x31')]=_[_0x869a('0x32')](_0x2d1c92['query']);_0x3e1a7b['filters']=_[_0x869a('0x36')](_0x3e1a7b[_0x869a('0x34')],_0x3e1a7b[_0x869a('0x31')]);_0x66c5b4['attributes']=_[_0x869a('0x36')](_0x3e1a7b[_0x869a('0x34')],qs[_0x869a('0x46')](_0x2d1c92[_0x869a('0x31')][_0x869a('0x46')]));_0x66c5b4['attributes']=_0x66c5b4[_0x869a('0x35')][_0x869a('0x37')]?_0x66c5b4[_0x869a('0x35')]:_0x3e1a7b[_0x869a('0x34')];if(_0x2d1c92['query'][_0x869a('0x40')]){_0x66c5b4[_0x869a('0x47')]=[{'all':!![]}];}_0x66c5b4=_[_0x869a('0x3d')]({},_0x66c5b4,_0x2d1c92[_0x869a('0x3e')]);return db[_0x869a('0x3f')][_0x869a('0x48')](_0x66c5b4)[_0x869a('0x25')](handleEntityNotFound(_0x4d35b6,null))[_0x869a('0x25')](respondWithResult(_0x4d35b6,null))[_0x869a('0x43')](handleError(_0x4d35b6,null));};exports[_0x869a('0x49')]=function(_0x28abac,_0x4cd8b7){return db[_0x869a('0x3f')][_0x869a('0x49')](_0x28abac['body'],{})['then'](respondWithResult(_0x4cd8b7,0xc9))[_0x869a('0x43')](handleError(_0x4cd8b7,null));};exports[_0x869a('0x24')]=function(_0x467667,_0x528b76){if(_0x467667[_0x869a('0x4a')]['id']){delete _0x467667['body']['id'];}return db[_0x869a('0x3f')][_0x869a('0x48')]({'where':{'id':_0x467667[_0x869a('0x45')]['id']}})[_0x869a('0x25')](handleEntityNotFound(_0x528b76,null))[_0x869a('0x25')](saveUpdates(_0x467667['body'],null))[_0x869a('0x25')](respondWithResult(_0x528b76,null))[_0x869a('0x43')](handleError(_0x528b76,null));};exports[_0x869a('0x26')]=function(_0x5c8a33,_0x204d32){return db[_0x869a('0x3f')]['find']({'where':{'id':_0x5c8a33[_0x869a('0x45')]['id']}})[_0x869a('0x25')](handleEntityNotFound(_0x204d32,null))[_0x869a('0x25')](removeEntity(_0x204d32,null))[_0x869a('0x43')](handleError(_0x204d32,null));};exports['describe']=function(_0x3dbccb,_0x2bbed0){return db[_0x869a('0x3f')]['describe']()[_0x869a('0x25')](respondWithResult(_0x2bbed0,null))['catch'](handleError(_0x2bbed0,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 615b8c5..a1aa28b 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 _0x0f3a=['path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x0f3a,0x1d9));var _0xa0f3=function(_0x38f239,_0x4060e8){_0x38f239=_0x38f239-0x0;var _0x29924b=_0x0f3a[_0x38f239];return _0x29924b;};'use strict';var _=require(_0xa0f3('0x0'));var util=require(_0xa0f3('0x1'));var logger=require(_0xa0f3('0x2'))(_0xa0f3('0x3'));var moment=require(_0xa0f3('0x4'));var BPromise=require(_0xa0f3('0x5'));var rp=require(_0xa0f3('0x6'));var fs=require('fs');var path=require(_0xa0f3('0x7'));var rimraf=require(_0xa0f3('0x8'));var config=require(_0xa0f3('0x9'));var attributes=require(_0xa0f3('0xa'));module[_0xa0f3('0xb')]=function(_0x3c6bd1,_0x1aa5a4){return _0x3c6bd1[_0xa0f3('0xc')](_0xa0f3('0xd'),attributes,{'tableName':_0xa0f3('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc549=['bluebird','request-promise','path','rimraf','exports','SquareDetailsReport','report_square_details','util','api'];(function(_0x5e1800,_0x4dc976){var _0x3bf794=function(_0x3aed5c){while(--_0x3aed5c){_0x5e1800['push'](_0x5e1800['shift']());}};_0x3bf794(++_0x4dc976);}(_0xc549,0x14b));var _0x9c54=function(_0x4962aa,_0x238b33){_0x4962aa=_0x4962aa-0x0;var _0x3684d7=_0xc549[_0x4962aa];return _0x3684d7;};'use strict';var _=require('lodash');var util=require(_0x9c54('0x0'));var logger=require('../../config/logger')(_0x9c54('0x1'));var moment=require('moment');var BPromise=require(_0x9c54('0x2'));var rp=require(_0x9c54('0x3'));var fs=require('fs');var path=require(_0x9c54('0x4'));var rimraf=require(_0x9c54('0x5'));var config=require('../../config/environment');var attributes=require('./squareReportDetail.attributes');module[_0x9c54('0x6')]=function(_0x1fc1cf,_0x5aed42){return _0x1fc1cf['define'](_0x9c54('0x7'),attributes,{'tableName':_0x9c54('0x8'),'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 5391867..83bb0c8 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 _0x36ee=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','options','raw'];(function(_0x57aed5,_0x325ee9){var _0x4ad0aa=function(_0x1622ed){while(--_0x1622ed){_0x57aed5['push'](_0x57aed5['shift']());}};_0x4ad0aa(++_0x325ee9);}(_0x36ee,0xe8));var _0xe36e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x36ee[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe36e('0x0'));var BPromise=require('bluebird');var rs=require(_0xe36e('0x1'));var fs=require('fs');var Redis=require(_0xe36e('0x2'));var db=require(_0xe36e('0x3'))['db'];var utils=require(_0xe36e('0x4'));var logger=require(_0xe36e('0x5'))(_0xe36e('0x6'));var config=require(_0xe36e('0x7'));var jayson=require(_0xe36e('0x8'));var client=jayson[_0xe36e('0x9')][_0xe36e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21be0b,_0x1aa596,_0x51b4bd){return new BPromise(function(_0x74b4b7,_0x4aebdd){return client[_0xe36e('0xb')](_0x21be0b,_0x51b4bd)[_0xe36e('0xc')](function(_0x46f239){logger['info'](_0xe36e('0xd'),_0x1aa596,'request\x20sent');logger[_0xe36e('0xe')](_0xe36e('0xf'),_0x1aa596,_0xe36e('0x10'),JSON[_0xe36e('0x11')](_0x46f239));if(_0x46f239[_0xe36e('0x12')]){if(_0x46f239[_0xe36e('0x12')][_0xe36e('0x13')]===0x1f4){logger[_0xe36e('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x1aa596,_0x46f239[_0xe36e('0x12')][_0xe36e('0x14')]);return _0x4aebdd(_0x46f239[_0xe36e('0x12')][_0xe36e('0x14')]);}logger['error'](_0xe36e('0xd'),_0x1aa596,_0x46f239['error']['message']);return _0x74b4b7(_0x46f239[_0xe36e('0x12')][_0xe36e('0x14')]);}else{logger[_0xe36e('0x15')](_0xe36e('0xd'),_0x1aa596,_0xe36e('0x10'));_0x74b4b7(_0x46f239[_0xe36e('0x16')][_0xe36e('0x14')]);}})[_0xe36e('0x17')](function(_0x387c37){logger[_0xe36e('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x1aa596,_0x387c37);_0x4aebdd(_0x387c37);});});}exports[_0xe36e('0x18')]=function(_0x2184ae){var _0x56c019=this;return new Promise(function(_0x21d9a3,_0x533c06){return db[_0xe36e('0x19')][_0xe36e('0x1a')](_0x2184ae['body'],{'raw':_0x2184ae[_0xe36e('0x1b')]?_0x2184ae[_0xe36e('0x1b')][_0xe36e('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x21e95e){logger[_0xe36e('0x15')](_0xe36e('0x18'),_0x2184ae);logger[_0xe36e('0xe')](_0xe36e('0x18'),_0x2184ae,JSON[_0xe36e('0x11')](_0x21e95e));_0x21d9a3(_0x21e95e);})['catch'](function(_0xd71137){logger[_0xe36e('0x12')](_0xe36e('0x18'),_0xd71137[_0xe36e('0x14')],_0x2184ae);_0x533c06(_0x56c019[_0xe36e('0x12')](0x1f4,_0xd71137['message']));});});}; \ No newline at end of file +var _0x253d=['create','options','catch','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','code','message','result','SquareDetailsReport,\x20%s,\x20%s','CreateSquareDetailsReport'];(function(_0x300915,_0x320ae4){var _0x5887ed=function(_0x211c35){while(--_0x211c35){_0x300915['push'](_0x300915['shift']());}};_0x5887ed(++_0x320ae4);}(_0x253d,0x1b3));var _0xd253=function(_0x1ef98e,_0x2433ad){_0x1ef98e=_0x1ef98e-0x0;var _0x4a11e9=_0x253d[_0x1ef98e];return _0x4a11e9;};'use strict';var _=require(_0xd253('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd253('0x1'));var db=require(_0xd253('0x2'))['db'];var utils=require(_0xd253('0x3'));var logger=require(_0xd253('0x4'))(_0xd253('0x5'));var config=require('../../config/environment');var jayson=require(_0xd253('0x6'));var client=jayson[_0xd253('0x7')][_0xd253('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x17589a,_0xf4b457,_0x487f4e){return new BPromise(function(_0x2c4de4,_0x712c81){return client[_0xd253('0x9')](_0x17589a,_0x487f4e)[_0xd253('0xa')](function(_0x351047){logger[_0xd253('0xb')]('SquareDetailsReport,\x20%s,\x20%s',_0xf4b457,'request\x20sent');logger[_0xd253('0xc')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0xf4b457,_0xd253('0xd'),JSON[_0xd253('0xe')](_0x351047));if(_0x351047[_0xd253('0xf')]){if(_0x351047[_0xd253('0xf')][_0xd253('0x10')]===0x1f4){logger[_0xd253('0xf')]('SquareDetailsReport,\x20%s,\x20%s',_0xf4b457,_0x351047['error'][_0xd253('0x11')]);return _0x712c81(_0x351047[_0xd253('0xf')][_0xd253('0x11')]);}logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0xf4b457,_0x351047[_0xd253('0xf')][_0xd253('0x11')]);return _0x2c4de4(_0x351047[_0xd253('0xf')]['message']);}else{logger[_0xd253('0xb')]('SquareDetailsReport,\x20%s,\x20%s',_0xf4b457,_0xd253('0xd'));_0x2c4de4(_0x351047[_0xd253('0x12')][_0xd253('0x11')]);}})['catch'](function(_0x1b7ed1){logger['error'](_0xd253('0x13'),_0xf4b457,_0x1b7ed1);_0x712c81(_0x1b7ed1);});});}exports[_0xd253('0x14')]=function(_0x5e4051){var _0x2496cb=this;return new Promise(function(_0x2a2adc,_0x5b24ff){return db['SquareDetailsReport'][_0xd253('0x15')](_0x5e4051['body'],{'raw':_0x5e4051['options']?_0x5e4051[_0xd253('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xd253('0xa')](function(_0x1e48c3){logger[_0xd253('0xb')](_0xd253('0x14'),_0x5e4051);logger['debug'](_0xd253('0x14'),_0x5e4051,JSON['stringify'](_0x1e48c3));_0x2a2adc(_0x1e48c3);})[_0xd253('0x17')](function(_0x50f8b5){logger[_0xd253('0xf')](_0xd253('0x14'),_0x50f8b5[_0xd253('0x11')],_0x5e4051);_0x5b24ff(_0x2496cb[_0xd253('0xf')](0x1f4,_0x50f8b5['message']));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 82bd742..7a4d163 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 _0xdbfa=['./system.controller','get','index','/process/:pid/kill','isAuthenticated','killProcess','exports','express','Router','../../components/auth/service'];(function(_0x3d78c8,_0x3faef8){var _0x336dd0=function(_0x14216d){while(--_0x14216d){_0x3d78c8['push'](_0x3d78c8['shift']());}};_0x336dd0(++_0x3faef8);}(_0xdbfa,0x93));var _0xadbf=function(_0x58a2ca,_0x4d7d41){_0x58a2ca=_0x58a2ca-0x0;var _0x10cc61=_0xdbfa[_0x58a2ca];return _0x10cc61;};'use strict';var express=require(_0xadbf('0x0'));var router=express[_0xadbf('0x1')]();var auth=require(_0xadbf('0x2'));var controller=require(_0xadbf('0x3'));router[_0xadbf('0x4')]('/',auth['isAuthenticated'](),controller[_0xadbf('0x5')]);router[_0xadbf('0x4')](_0xadbf('0x6'),auth[_0xadbf('0x7')](),controller[_0xadbf('0x8')]);module[_0xadbf('0x9')]=router; \ No newline at end of file +var _0x5174=['get','isAuthenticated','killProcess','exports','express','../../components/auth/service','./system.controller'];(function(_0x5f0501,_0x19196e){var _0x3c2c45=function(_0x107fe6){while(--_0x107fe6){_0x5f0501['push'](_0x5f0501['shift']());}};_0x3c2c45(++_0x19196e);}(_0x5174,0x154));var _0x4517=function(_0x190c22,_0x34e16c){_0x190c22=_0x190c22-0x0;var _0x453a4b=_0x5174[_0x190c22];return _0x453a4b;};'use strict';var express=require(_0x4517('0x0'));var router=express['Router']();var auth=require(_0x4517('0x1'));var controller=require(_0x4517('0x2'));router[_0x4517('0x3')]('/',auth[_0x4517('0x4')](),controller['index']);router['get']('/process/:pid/kill',auth['isAuthenticated'](),controller[_0x4517('0x5')]);module[_0x4517('0x6')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 78ab7fa..79a8482 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 _0x244c=['format','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','params','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','exec','../../config/logger','api','util','bluebird','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status','index','then','json','catch','killProcess','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','split','length','indexOf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x244c,0xf9));var _0xc244=function(_0xd9ebb6,_0x5209a6){_0xd9ebb6=_0xd9ebb6-0x0;var _0x5eb80d=_0x244c[_0xd9ebb6];return _0x5eb80d;};'use strict';var info=require(_0xc244('0x0'));var exec=require('child_process')[_0xc244('0x1')];var logger=require(_0xc244('0x2'))(_0xc244('0x3'));var util=require(_0xc244('0x4'));var BPromise=require(_0xc244('0x5'));var _=require(_0xc244('0x6'));function handleError(_0x585576,_0x4a5876,_0x152cc2){_0x4a5876=_0x4a5876||0x1f4;return function(_0x53c160){logger['error'](_0xc244('0x7'),_0x152cc2,_0x4a5876,util[_0xc244('0x8')](_0x53c160,{'showHidden':![],'depth':null}));delete _0x53c160['name'];_0x585576[_0xc244('0x9')](_0x4a5876)['send'](_0x53c160);};}exports[_0xc244('0xa')]=function(_0x276261,_0x3818da){return info['getAllData']()[_0xc244('0xb')](function(_0x12f50a){return _0x3818da[_0xc244('0x9')](0xc8)[_0xc244('0xc')](_0x12f50a);})[_0xc244('0xd')](function(_0x43d6b9){return _0x3818da[_0xc244('0x9')](0x1f4)[_0xc244('0xc')](_0x43d6b9);});};exports[_0xc244('0xe')]=function(_0x5c4a7c,_0x19827f){var _0x8dd142=[_0xc244('0xf')];return new BPromise(function(_0xab42cd,_0x412f3e){return exec(util['format'](_0xc244('0x10'),_0x5c4a7c['params'][_0xc244('0x11')]),function(_0xf5abe1,_0x7d7789,_0x541e28){if(_0xf5abe1){return _0x412f3e(_0xf5abe1);}return _0xab42cd(_0x7d7789);});})[_0xc244('0xb')](function(_0x40bd25){var _0x1f4188=![];var _0x18256f=_0x40bd25[_0xc244('0x12')](/\n/);for(var _0x3816bb=0x0,_0x3353c7=_0x8dd142[_0xc244('0x13')];_0x3816bb<_0x3353c7,_0x1f4188===![];_0x3816bb+=0x1){if(_0x40bd25[_0xc244('0x14')](_0x8dd142[_0x3816bb])>=0x0){_0x1f4188=!![];}}if(!_0x1f4188){throw new Error(util[_0xc244('0x15')](_0xc244('0x16'),_0x5c4a7c['params'][_0xc244('0x11')]));}process[_0xc244('0x17')](_0x5c4a7c[_0xc244('0x18')]['pid'],_0xc244('0x19'));return _0x19827f[_0xc244('0x9')](0xc8)[_0xc244('0xc')]({'message':util['format'](_0xc244('0x1a'),_0x5c4a7c[_0xc244('0x18')][_0xc244('0x11')])});})[_0xc244('0xd')](handleError(_0x19827f,null,_0xc244('0xe')));}; \ No newline at end of file +var _0x331f=['pid','split','length','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','util','bluebird','error','inspect','name','status','send','index','getAllData','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params'];(function(_0x45fb04,_0x573d03){var _0x353dae=function(_0x3fdc31){while(--_0x3fdc31){_0x45fb04['push'](_0x45fb04['shift']());}};_0x353dae(++_0x573d03);}(_0x331f,0x10d));var _0xf331=function(_0x3d4698,_0x2c9d8c){_0x3d4698=_0x3d4698-0x0;var _0x58c0f9=_0x331f[_0x3d4698];return _0x58c0f9;};'use strict';var info=require(_0xf331('0x0'));var exec=require(_0xf331('0x1'))[_0xf331('0x2')];var logger=require('../../config/logger')('api');var util=require(_0xf331('0x3'));var BPromise=require(_0xf331('0x4'));var _=require('lodash');function handleError(_0x4a157c,_0x13d5f0,_0x44567b){_0x13d5f0=_0x13d5f0||0x1f4;return function(_0x2d5cc3){logger[_0xf331('0x5')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x44567b,_0x13d5f0,util[_0xf331('0x6')](_0x2d5cc3,{'showHidden':![],'depth':null}));delete _0x2d5cc3[_0xf331('0x7')];_0x4a157c[_0xf331('0x8')](_0x13d5f0)[_0xf331('0x9')](_0x2d5cc3);};}exports[_0xf331('0xa')]=function(_0x5b901c,_0x5a7002){return info[_0xf331('0xb')]()['then'](function(_0x5f43dc){return _0x5a7002[_0xf331('0x8')](0xc8)[_0xf331('0xc')](_0x5f43dc);})[_0xf331('0xd')](function(_0x18a19a){return _0x5a7002[_0xf331('0x8')](0x1f4)[_0xf331('0xc')](_0x18a19a);});};exports[_0xf331('0xe')]=function(_0x3a868c,_0x289ef1){var _0x3427f8=[_0xf331('0xf')];return new BPromise(function(_0x5b3858,_0x47ece9){return exec(util[_0xf331('0x10')](_0xf331('0x11'),_0x3a868c[_0xf331('0x12')][_0xf331('0x13')]),function(_0x2e909b,_0x577525,_0x492cd2){if(_0x2e909b){return _0x47ece9(_0x2e909b);}return _0x5b3858(_0x577525);});})['then'](function(_0x6ce266){var _0x206a0b=![];var _0x3911a2=_0x6ce266[_0xf331('0x14')](/\n/);for(var _0x440698=0x0,_0x52c75c=_0x3427f8[_0xf331('0x15')];_0x440698<_0x52c75c,_0x206a0b===![];_0x440698+=0x1){if(_0x6ce266['indexOf'](_0x3427f8[_0x440698])>=0x0){_0x206a0b=!![];}}if(!_0x206a0b){throw new Error(util[_0xf331('0x10')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x3a868c[_0xf331('0x12')][_0xf331('0x13')]));}process[_0xf331('0x16')](_0x3a868c[_0xf331('0x12')][_0xf331('0x13')],'SIGINT');return _0x289ef1['status'](0xc8)[_0xf331('0xc')]({'message':util[_0xf331('0x10')](_0xf331('0x17'),_0x3a868c[_0xf331('0x12')][_0xf331('0x13')])});})[_0xf331('0xd')](handleError(_0x289ef1,null,_0xf331('0xe')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index f16620f..6837b1f 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 _0x930b=['delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./tag.controller','get','index','/:id','isAuthenticated','show','post','create','put','update'];(function(_0x5dfacb,_0x5aeab3){var _0x216bbe=function(_0x25b57f){while(--_0x25b57f){_0x5dfacb['push'](_0x5dfacb['shift']());}};_0x216bbe(++_0x5aeab3);}(_0x930b,0xc1));var _0xb930=function(_0x273a59,_0x15cb78){_0x273a59=_0x273a59-0x0;var _0x538d89=_0x930b[_0x273a59];return _0x538d89;};'use strict';var multer=require(_0xb930('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb930('0x1'));var express=require(_0xb930('0x2'));var router=express[_0xb930('0x3')]();var fs_extra=require(_0xb930('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb930('0x5'));var config=require('../../config/environment');var controller=require(_0xb930('0x6'));router[_0xb930('0x7')]('/',auth['isAuthenticated'](),controller[_0xb930('0x8')]);router['get'](_0xb930('0x9'),auth[_0xb930('0xa')](),controller[_0xb930('0xb')]);router[_0xb930('0xc')]('/',auth[_0xb930('0xa')](),controller[_0xb930('0xd')]);router[_0xb930('0xe')](_0xb930('0x9'),auth['isAuthenticated'](),controller[_0xb930('0xf')]);router[_0xb930('0x10')](_0xb930('0x9'),auth[_0xb930('0xa')](),controller[_0xb930('0x11')]);module[_0xb930('0x12')]=router; \ No newline at end of file +var _0x1219=['multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports'];(function(_0x368684,_0x538fe0){var _0x4871a7=function(_0x483c55){while(--_0x483c55){_0x368684['push'](_0x368684['shift']());}};_0x4871a7(++_0x538fe0);}(_0x1219,0x17c));var _0x9121=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1219[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9121('0x0'));var util=require(_0x9121('0x1'));var path=require(_0x9121('0x2'));var timeout=require(_0x9121('0x3'));var express=require(_0x9121('0x4'));var router=express['Router']();var fs_extra=require(_0x9121('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9121('0x6'));var config=require(_0x9121('0x7'));var controller=require(_0x9121('0x8'));router[_0x9121('0x9')]('/',auth[_0x9121('0xa')](),controller[_0x9121('0xb')]);router[_0x9121('0x9')](_0x9121('0xc'),auth[_0x9121('0xa')](),controller[_0x9121('0xd')]);router[_0x9121('0xe')]('/',auth['isAuthenticated'](),controller[_0x9121('0xf')]);router[_0x9121('0x10')](_0x9121('0xc'),auth[_0x9121('0xa')](),controller['update']);router[_0x9121('0x11')](_0x9121('0xc'),auth[_0x9121('0xa')](),controller[_0x9121('0x12')]);module[_0x9121('0x13')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 16b6e90..490bb41 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 _0x71f4=['STRING','name','#0091EA'];(function(_0x2e665c,_0x1dcefc){var _0x39f7e2=function(_0x5ba9f2){while(--_0x5ba9f2){_0x2e665c['push'](_0x2e665c['shift']());}};_0x39f7e2(++_0x1dcefc);}(_0x71f4,0xf9));var _0x471f=function(_0x4c2a39,_0x267b73){_0x4c2a39=_0x4c2a39-0x0;var _0x1729ad=_0x71f4[_0x4c2a39];return _0x1729ad;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x471f('0x0')],'unique':_0x471f('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x471f('0x0')],'defaultValue':_0x471f('0x2')},'description':{'type':Sequelize[_0x471f('0x0')]}}; \ No newline at end of file +var _0xe511=['#0091EA','STRING','sequelize','exports','name'];(function(_0x334d69,_0x1e9842){var _0x3e7b10=function(_0x548a13){while(--_0x548a13){_0x334d69['push'](_0x334d69['shift']());}};_0x3e7b10(++_0x1e9842);}(_0xe511,0x16f));var _0x1e51=function(_0x344089,_0x481955){_0x344089=_0x344089-0x0;var _0x27b276=_0xe511[_0x344089];return _0x27b276;};'use strict';var Sequelize=require(_0x1e51('0x0'));module[_0x1e51('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1e51('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x1e51('0x3')},'description':{'type':Sequelize[_0x1e51('0x4')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 28a7c14..7537a1d 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 _0x2750=['sendStatus','status','end','json','undefined','limit','count','offset','set','reject','save','update','destroy','then','get','Tags','UserProfileResource','error','stack','name','send','map','Tag','fieldName','type','key','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','keys','length','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x44e72b,_0x490c9c){var _0x285c7a=function(_0x32d0a7){while(--_0x32d0a7){_0x44e72b['push'](_0x44e72b['shift']());}};_0x285c7a(++_0x490c9c);}(_0x2750,0x13b));var _0x0275=function(_0x4e8fe5,_0x47d49b){_0x4e8fe5=_0x4e8fe5-0x0;var _0x46d27c=_0x2750[_0x4e8fe5];return _0x46d27c;};'use strict';var emlformat=require(_0x0275('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0275('0x1'));var jsonpatch=require(_0x0275('0x2'));var rp=require(_0x0275('0x3'));var moment=require(_0x0275('0x4'));var BPromise=require(_0x0275('0x5'));var Mustache=require(_0x0275('0x6'));var util=require(_0x0275('0x7'));var path=require(_0x0275('0x8'));var sox=require(_0x0275('0x9'));var csv=require(_0x0275('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0275('0xb'));var _=require(_0x0275('0xc'));var squel=require(_0x0275('0xd'));var crypto=require(_0x0275('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0275('0xf'));var toCsv=require(_0x0275('0xa'));var querystring=require(_0x0275('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0275('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0275('0x12'));var hardwareService=require(_0x0275('0x13'));var logger=require(_0x0275('0x14'))(_0x0275('0x15'));var utils=require(_0x0275('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0275('0x17'));var db=require(_0x0275('0x18'))['db'];function respondWithStatusCode(_0x1f128d,_0x4c6ee0){_0x4c6ee0=_0x4c6ee0||0xcc;return function(_0x55ffd6){if(_0x55ffd6){return _0x1f128d[_0x0275('0x19')](_0x4c6ee0);}return _0x1f128d[_0x0275('0x1a')](_0x4c6ee0)[_0x0275('0x1b')]();};}function respondWithResult(_0x46a729,_0x28827b){_0x28827b=_0x28827b||0xc8;return function(_0x36921c){if(_0x36921c){return _0x46a729['status'](_0x28827b)[_0x0275('0x1c')](_0x36921c);}};}function respondWithFilteredResult(_0x3030c0,_0x4aa412){return function(_0x6344fc){if(_0x6344fc){var _0xaae367=typeof _0x4aa412['offset']===_0x0275('0x1d')&&typeof _0x4aa412[_0x0275('0x1e')]==='undefined';var _0x5e7466=_0x6344fc['count'];var _0x591d27=_0xaae367?0x0:_0x4aa412['offset'];var _0x566ad6=_0xaae367?_0x6344fc[_0x0275('0x1f')]:_0x4aa412[_0x0275('0x20')]+_0x4aa412['limit'];var _0x7075c9;if(_0x566ad6>=_0x5e7466){_0x566ad6=_0x5e7466;_0x7075c9=0xc8;}else{_0x7075c9=0xce;}_0x3030c0[_0x0275('0x1a')](_0x7075c9);return _0x3030c0[_0x0275('0x21')]('Content-Range',_0x591d27+'-'+_0x566ad6+'/'+_0x5e7466)[_0x0275('0x1c')](_0x6344fc);}return null;};}function patchUpdates(_0x402f0d){return function(_0x575786){try{jsonpatch['apply'](_0x575786,_0x402f0d,!![]);}catch(_0x31ba9e){return BPromise[_0x0275('0x22')](_0x31ba9e);}return _0x575786[_0x0275('0x23')]();};}function saveUpdates(_0x592a53,_0xf3b68e){return function(_0x5ab9e7){if(_0x5ab9e7){return _0x5ab9e7[_0x0275('0x24')](_0x592a53)['then'](function(_0x26f2c2){return _0x26f2c2;});}return null;};}function removeEntity(_0xfa0081,_0x594321){return function(_0x140a18){if(_0x140a18){return _0x140a18[_0x0275('0x25')]()[_0x0275('0x26')](function(){var _0x52946b=_0x140a18[_0x0275('0x27')]({'plain':!![]});var _0x44bbf8=_0x0275('0x28');return db[_0x0275('0x29')][_0x0275('0x25')]({'where':{'type':_0x44bbf8,'resourceId':_0x52946b['id']}})[_0x0275('0x26')](function(){return _0x140a18;});})['then'](function(){_0xfa0081[_0x0275('0x1a')](0xcc)[_0x0275('0x1b')]();});}};}function handleEntityNotFound(_0x1d24b2,_0x275dac){return function(_0x4689a3){if(!_0x4689a3){_0x1d24b2['sendStatus'](0x194);}return _0x4689a3;};}function handleError(_0x1ffd57,_0xd59d69){_0xd59d69=_0xd59d69||0x1f4;return function(_0x3246ea){logger[_0x0275('0x2a')](_0x3246ea[_0x0275('0x2b')]);if(_0x3246ea['name']){delete _0x3246ea[_0x0275('0x2c')];}_0x1ffd57[_0x0275('0x1a')](_0xd59d69)[_0x0275('0x2d')](_0x3246ea);};}exports['index']=function(_0x5e2e22,_0x3cb2d7){var _0x299190={},_0x5dc2bc={},_0x7eff96={'count':0x0,'rows':[]};var _0x155a50=_[_0x0275('0x2e')](db[_0x0275('0x2f')]['rawAttributes'],function(_0x24c762){return{'name':_0x24c762[_0x0275('0x30')],'type':_0x24c762[_0x0275('0x31')][_0x0275('0x32')]};});_0x5dc2bc['model']=_[_0x0275('0x2e')](_0x155a50,'name');_0x5dc2bc[_0x0275('0x33')]=_['keys'](_0x5e2e22[_0x0275('0x33')]);_0x5dc2bc[_0x0275('0x34')]=_['intersection'](_0x5dc2bc[_0x0275('0x35')],_0x5dc2bc[_0x0275('0x33')]);_0x299190[_0x0275('0x36')]=_[_0x0275('0x37')](_0x5dc2bc['model'],qs[_0x0275('0x38')](_0x5e2e22[_0x0275('0x33')][_0x0275('0x38')]));_0x299190[_0x0275('0x36')]=_0x299190[_0x0275('0x36')]['length']?_0x299190[_0x0275('0x36')]:_0x5dc2bc[_0x0275('0x35')];if(!_0x5e2e22[_0x0275('0x33')][_0x0275('0x39')](_0x0275('0x3a'))){_0x299190[_0x0275('0x1e')]=qs[_0x0275('0x1e')](_0x5e2e22[_0x0275('0x33')][_0x0275('0x1e')]);_0x299190[_0x0275('0x20')]=qs[_0x0275('0x20')](_0x5e2e22['query'][_0x0275('0x20')]);}_0x299190[_0x0275('0x3b')]=qs[_0x0275('0x3c')](_0x5e2e22[_0x0275('0x33')][_0x0275('0x3c')]);_0x299190[_0x0275('0x3d')]=qs[_0x0275('0x34')](_[_0x0275('0x3e')](_0x5e2e22[_0x0275('0x33')],_0x5dc2bc[_0x0275('0x34')]),_0x155a50);if(_0x5e2e22[_0x0275('0x33')][_0x0275('0x3f')]){_0x299190[_0x0275('0x3d')]=_[_0x0275('0x40')](_0x299190['where'],{'$or':_[_0x0275('0x2e')](_0x155a50,function(_0x1cc40d){if(_0x1cc40d['type']!==_0x0275('0x41')){var _0x76b8fa={};_0x76b8fa[_0x1cc40d[_0x0275('0x2c')]]={'$like':'%'+_0x5e2e22[_0x0275('0x33')][_0x0275('0x3f')]+'%'};return _0x76b8fa;}})});}_0x299190=_[_0x0275('0x40')]({},_0x299190,_0x5e2e22[_0x0275('0x42')]);var _0x5e57b5={'where':_0x299190[_0x0275('0x3d')]};return db[_0x0275('0x2f')][_0x0275('0x1f')](_0x5e57b5)[_0x0275('0x26')](function(_0x4f888c){_0x7eff96[_0x0275('0x1f')]=_0x4f888c;if(_0x5e2e22[_0x0275('0x33')][_0x0275('0x43')]){_0x299190[_0x0275('0x44')]=[{'all':!![]}];}return db['Tag'][_0x0275('0x45')](_0x299190);})['then'](function(_0x261e66){_0x7eff96[_0x0275('0x46')]=_0x261e66;return _0x7eff96;})[_0x0275('0x26')](respondWithFilteredResult(_0x3cb2d7,_0x299190))[_0x0275('0x47')](handleError(_0x3cb2d7,null));};exports['show']=function(_0x13c651,_0x3d1bfc){var _0x59839d={'raw':!![],'where':{'id':_0x13c651[_0x0275('0x48')]['id']}},_0x1e143e={};_0x1e143e[_0x0275('0x35')]=_['keys'](db[_0x0275('0x2f')][_0x0275('0x49')]);_0x1e143e['query']=_[_0x0275('0x4a')](_0x13c651[_0x0275('0x33')]);_0x1e143e[_0x0275('0x34')]=_[_0x0275('0x37')](_0x1e143e[_0x0275('0x35')],_0x1e143e[_0x0275('0x33')]);_0x59839d[_0x0275('0x36')]=_[_0x0275('0x37')](_0x1e143e[_0x0275('0x35')],qs[_0x0275('0x38')](_0x13c651[_0x0275('0x33')]['fields']));_0x59839d[_0x0275('0x36')]=_0x59839d[_0x0275('0x36')][_0x0275('0x4b')]?_0x59839d[_0x0275('0x36')]:_0x1e143e[_0x0275('0x35')];if(_0x13c651[_0x0275('0x33')][_0x0275('0x43')]){_0x59839d[_0x0275('0x44')]=[{'all':!![]}];}_0x59839d=_[_0x0275('0x40')]({},_0x59839d,_0x13c651[_0x0275('0x42')]);return db[_0x0275('0x2f')]['find'](_0x59839d)['then'](handleEntityNotFound(_0x3d1bfc,null))[_0x0275('0x26')](respondWithResult(_0x3d1bfc,null))[_0x0275('0x47')](handleError(_0x3d1bfc,null));};exports[_0x0275('0x4c')]=function(_0x3bd019,_0x310c6b){return db['Tag'][_0x0275('0x4c')](_0x3bd019['body'],{})[_0x0275('0x26')](function(_0x17dde0){var _0x27a469=_0x3bd019[_0x0275('0x4d')]['get']({'plain':!![]});if(!_0x27a469)throw new Error(_0x0275('0x4e'));if(_0x27a469['role']==='user'){var _0x515860=_0x17dde0[_0x0275('0x27')]({'plain':!![]});var _0x4e36fc=_0x0275('0x28');return db[_0x0275('0x4f')][_0x0275('0x50')]({'where':{'name':_0x4e36fc,'userProfileId':_0x27a469[_0x0275('0x51')]},'raw':!![]})[_0x0275('0x26')](function(_0x11794b){if(_0x11794b&&_0x11794b[_0x0275('0x52')]===0x0){return db['UserProfileResource'][_0x0275('0x4c')]({'name':_0x515860['name'],'resourceId':_0x515860['id'],'type':_0x11794b[_0x0275('0x2c')],'sectionId':_0x11794b['id']},{})[_0x0275('0x26')](function(){return _0x17dde0;});}else{return _0x17dde0;}})[_0x0275('0x47')](function(_0x1686d9){logger[_0x0275('0x2a')](_0x0275('0x53'),_0x1686d9);throw _0x1686d9;});}return _0x17dde0;})[_0x0275('0x26')](respondWithResult(_0x310c6b,0xc9))[_0x0275('0x47')](handleError(_0x310c6b,null));};exports[_0x0275('0x24')]=function(_0x3673ad,_0x545333){if(_0x3673ad['body']['id']){delete _0x3673ad[_0x0275('0x54')]['id'];}return db['Tag']['find']({'where':{'id':_0x3673ad[_0x0275('0x48')]['id']}})[_0x0275('0x26')](handleEntityNotFound(_0x545333,null))[_0x0275('0x26')](saveUpdates(_0x3673ad[_0x0275('0x54')],null))[_0x0275('0x26')](respondWithResult(_0x545333,null))[_0x0275('0x47')](handleError(_0x545333,null));};exports['destroy']=function(_0x104232,_0x163ce2){return db[_0x0275('0x2f')][_0x0275('0x50')]({'where':{'id':_0x104232[_0x0275('0x48')]['id']}})[_0x0275('0x26')](handleEntityNotFound(_0x163ce2,null))['then'](removeEntity(_0x163ce2,null))[_0x0275('0x47')](handleError(_0x163ce2,null));}; \ No newline at end of file +var _0x524a=['rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','count','status','set','Content-Range','apply','reject','save','update','then','Tags','UserProfileResource','destroy','stack','name','index','map','Tag','fieldName','model','query','filters','attributes','intersection','fields','length','limit','order','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','keys','rawAttributes','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format'];(function(_0x6c6d75,_0xef7deb){var _0x48a161=function(_0xf0fba0){while(--_0xf0fba0){_0x6c6d75['push'](_0x6c6d75['shift']());}};_0x48a161(++_0xef7deb);}(_0x524a,0xf5));var _0xa524=function(_0x5f2cf0,_0x357be6){_0x5f2cf0=_0x5f2cf0-0x0;var _0x7d9266=_0x524a[_0x5f2cf0];return _0x7d9266;};'use strict';var emlformat=require(_0xa524('0x0'));var rimraf=require(_0xa524('0x1'));var zipdir=require(_0xa524('0x2'));var jsonpatch=require(_0xa524('0x3'));var rp=require('request-promise');var moment=require(_0xa524('0x4'));var BPromise=require(_0xa524('0x5'));var Mustache=require(_0xa524('0x6'));var util=require('util');var path=require('path');var sox=require(_0xa524('0x7'));var csv=require(_0xa524('0x8'));var ejs=require(_0xa524('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa524('0xa'));var squel=require('squel');var crypto=require(_0xa524('0xb'));var jsforce=require(_0xa524('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa524('0x8'));var querystring=require(_0xa524('0xd'));var Papa=require(_0xa524('0xe'));var Redis=require(_0xa524('0xf'));var authService=require(_0xa524('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa524('0x11'));var hardwareService=require(_0xa524('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xa524('0x13'));var config=require(_0xa524('0x14'));var licenseUtil=require(_0xa524('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55117f,_0x14a0d6){_0x14a0d6=_0x14a0d6||0xcc;return function(_0x4aa46d){if(_0x4aa46d){return _0x55117f[_0xa524('0x16')](_0x14a0d6);}return _0x55117f['status'](_0x14a0d6)[_0xa524('0x17')]();};}function respondWithResult(_0x5c7e6a,_0x75bfe8){_0x75bfe8=_0x75bfe8||0xc8;return function(_0x281137){if(_0x281137){return _0x5c7e6a['status'](_0x75bfe8)[_0xa524('0x18')](_0x281137);}};}function respondWithFilteredResult(_0x15b14c,_0xe85361){return function(_0x1de01e){if(_0x1de01e){var _0x45347f=typeof _0xe85361[_0xa524('0x19')]===_0xa524('0x1a')&&typeof _0xe85361['limit']===_0xa524('0x1a');var _0x3d8494=_0x1de01e[_0xa524('0x1b')];var _0x3d6a0d=_0x45347f?0x0:_0xe85361[_0xa524('0x19')];var _0x805b93=_0x45347f?_0x1de01e[_0xa524('0x1b')]:_0xe85361[_0xa524('0x19')]+_0xe85361['limit'];var _0x304dea;if(_0x805b93>=_0x3d8494){_0x805b93=_0x3d8494;_0x304dea=0xc8;}else{_0x304dea=0xce;}_0x15b14c[_0xa524('0x1c')](_0x304dea);return _0x15b14c[_0xa524('0x1d')](_0xa524('0x1e'),_0x3d6a0d+'-'+_0x805b93+'/'+_0x3d8494)['json'](_0x1de01e);}return null;};}function patchUpdates(_0x5510fa){return function(_0x40f4bd){try{jsonpatch[_0xa524('0x1f')](_0x40f4bd,_0x5510fa,!![]);}catch(_0x21e114){return BPromise[_0xa524('0x20')](_0x21e114);}return _0x40f4bd[_0xa524('0x21')]();};}function saveUpdates(_0x3866e2,_0x4abffe){return function(_0x262eac){if(_0x262eac){return _0x262eac[_0xa524('0x22')](_0x3866e2)[_0xa524('0x23')](function(_0x40fb4b){return _0x40fb4b;});}return null;};}function removeEntity(_0x226784,_0x45cdcc){return function(_0x26e931){if(_0x26e931){return _0x26e931['destroy']()[_0xa524('0x23')](function(){var _0x221bf=_0x26e931['get']({'plain':!![]});var _0x47efb3=_0xa524('0x24');return db[_0xa524('0x25')][_0xa524('0x26')]({'where':{'type':_0x47efb3,'resourceId':_0x221bf['id']}})[_0xa524('0x23')](function(){return _0x26e931;});})[_0xa524('0x23')](function(){_0x226784['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1aeabc,_0x869b22){return function(_0x1582fa){if(!_0x1582fa){_0x1aeabc[_0xa524('0x16')](0x194);}return _0x1582fa;};}function handleError(_0x505c42,_0x1c84c6){_0x1c84c6=_0x1c84c6||0x1f4;return function(_0x32ba03){logger['error'](_0x32ba03[_0xa524('0x27')]);if(_0x32ba03[_0xa524('0x28')]){delete _0x32ba03['name'];}_0x505c42[_0xa524('0x1c')](_0x1c84c6)['send'](_0x32ba03);};}exports[_0xa524('0x29')]=function(_0x38e051,_0x45b846){var _0x238133={},_0x136e83={},_0x1c706b={'count':0x0,'rows':[]};var _0x4f6133=_[_0xa524('0x2a')](db[_0xa524('0x2b')]['rawAttributes'],function(_0x535e41){return{'name':_0x535e41[_0xa524('0x2c')],'type':_0x535e41['type']['key']};});_0x136e83[_0xa524('0x2d')]=_[_0xa524('0x2a')](_0x4f6133,_0xa524('0x28'));_0x136e83[_0xa524('0x2e')]=_['keys'](_0x38e051['query']);_0x136e83[_0xa524('0x2f')]=_['intersection'](_0x136e83['model'],_0x136e83[_0xa524('0x2e')]);_0x238133[_0xa524('0x30')]=_[_0xa524('0x31')](_0x136e83[_0xa524('0x2d')],qs[_0xa524('0x32')](_0x38e051[_0xa524('0x2e')][_0xa524('0x32')]));_0x238133[_0xa524('0x30')]=_0x238133[_0xa524('0x30')][_0xa524('0x33')]?_0x238133[_0xa524('0x30')]:_0x136e83[_0xa524('0x2d')];if(!_0x38e051['query']['hasOwnProperty']('nolimit')){_0x238133[_0xa524('0x34')]=qs[_0xa524('0x34')](_0x38e051['query'][_0xa524('0x34')]);_0x238133['offset']=qs[_0xa524('0x19')](_0x38e051[_0xa524('0x2e')]['offset']);}_0x238133[_0xa524('0x35')]=qs[_0xa524('0x36')](_0x38e051[_0xa524('0x2e')]['sort']);_0x238133[_0xa524('0x37')]=qs[_0xa524('0x2f')](_['pick'](_0x38e051[_0xa524('0x2e')],_0x136e83[_0xa524('0x2f')]),_0x4f6133);if(_0x38e051['query'][_0xa524('0x38')]){_0x238133[_0xa524('0x37')]=_['merge'](_0x238133[_0xa524('0x37')],{'$or':_[_0xa524('0x2a')](_0x4f6133,function(_0x186395){if(_0x186395[_0xa524('0x39')]!==_0xa524('0x3a')){var _0x38f87a={};_0x38f87a[_0x186395[_0xa524('0x28')]]={'$like':'%'+_0x38e051[_0xa524('0x2e')][_0xa524('0x38')]+'%'};return _0x38f87a;}})});}_0x238133=_[_0xa524('0x3b')]({},_0x238133,_0x38e051[_0xa524('0x3c')]);var _0x51cd09={'where':_0x238133[_0xa524('0x37')]};return db['Tag'][_0xa524('0x1b')](_0x51cd09)[_0xa524('0x23')](function(_0x35d92d){_0x1c706b[_0xa524('0x1b')]=_0x35d92d;if(_0x38e051[_0xa524('0x2e')][_0xa524('0x3d')]){_0x238133[_0xa524('0x3e')]=[{'all':!![]}];}return db[_0xa524('0x2b')][_0xa524('0x3f')](_0x238133);})[_0xa524('0x23')](function(_0x4a87d4){_0x1c706b[_0xa524('0x40')]=_0x4a87d4;return _0x1c706b;})[_0xa524('0x23')](respondWithFilteredResult(_0x45b846,_0x238133))['catch'](handleError(_0x45b846,null));};exports[_0xa524('0x41')]=function(_0x3f5564,_0x4885a4){var _0x492851={'raw':!![],'where':{'id':_0x3f5564['params']['id']}},_0x4dff4b={};_0x4dff4b['model']=_[_0xa524('0x42')](db[_0xa524('0x2b')][_0xa524('0x43')]);_0x4dff4b[_0xa524('0x2e')]=_['keys'](_0x3f5564[_0xa524('0x2e')]);_0x4dff4b[_0xa524('0x2f')]=_[_0xa524('0x31')](_0x4dff4b[_0xa524('0x2d')],_0x4dff4b['query']);_0x492851[_0xa524('0x30')]=_[_0xa524('0x31')](_0x4dff4b[_0xa524('0x2d')],qs[_0xa524('0x32')](_0x3f5564[_0xa524('0x2e')]['fields']));_0x492851[_0xa524('0x30')]=_0x492851[_0xa524('0x30')][_0xa524('0x33')]?_0x492851[_0xa524('0x30')]:_0x4dff4b[_0xa524('0x2d')];if(_0x3f5564[_0xa524('0x2e')][_0xa524('0x3d')]){_0x492851[_0xa524('0x3e')]=[{'all':!![]}];}_0x492851=_[_0xa524('0x3b')]({},_0x492851,_0x3f5564['options']);return db['Tag'][_0xa524('0x44')](_0x492851)[_0xa524('0x23')](handleEntityNotFound(_0x4885a4,null))[_0xa524('0x23')](respondWithResult(_0x4885a4,null))[_0xa524('0x45')](handleError(_0x4885a4,null));};exports[_0xa524('0x46')]=function(_0xddc80,_0x56e570){return db[_0xa524('0x2b')][_0xa524('0x46')](_0xddc80[_0xa524('0x47')],{})[_0xa524('0x23')](function(_0x24c7ef){var _0x451bbe=_0xddc80['user'][_0xa524('0x48')]({'plain':!![]});if(!_0x451bbe)throw new Error(_0xa524('0x49'));if(_0x451bbe[_0xa524('0x4a')]===_0xa524('0x4b')){var _0x25ffbd=_0x24c7ef[_0xa524('0x48')]({'plain':!![]});var _0xef18b7=_0xa524('0x24');return db[_0xa524('0x4c')][_0xa524('0x44')]({'where':{'name':_0xef18b7,'userProfileId':_0x451bbe[_0xa524('0x4d')]},'raw':!![]})[_0xa524('0x23')](function(_0x3a374f){if(_0x3a374f&&_0x3a374f[_0xa524('0x4e')]===0x0){return db[_0xa524('0x25')]['create']({'name':_0x25ffbd[_0xa524('0x28')],'resourceId':_0x25ffbd['id'],'type':_0x3a374f[_0xa524('0x28')],'sectionId':_0x3a374f['id']},{})['then'](function(){return _0x24c7ef;});}else{return _0x24c7ef;}})['catch'](function(_0x32844c){logger[_0xa524('0x4f')](_0xa524('0x50'),_0x32844c);throw _0x32844c;});}return _0x24c7ef;})[_0xa524('0x23')](respondWithResult(_0x56e570,0xc9))[_0xa524('0x45')](handleError(_0x56e570,null));};exports[_0xa524('0x22')]=function(_0x121fc5,_0x4e3709){if(_0x121fc5[_0xa524('0x47')]['id']){delete _0x121fc5[_0xa524('0x47')]['id'];}return db[_0xa524('0x2b')][_0xa524('0x44')]({'where':{'id':_0x121fc5[_0xa524('0x51')]['id']}})['then'](handleEntityNotFound(_0x4e3709,null))[_0xa524('0x23')](saveUpdates(_0x121fc5['body'],null))[_0xa524('0x23')](respondWithResult(_0x4e3709,null))[_0xa524('0x45')](handleError(_0x4e3709,null));};exports[_0xa524('0x26')]=function(_0x3f5694,_0x161393){return db[_0xa524('0x2b')][_0xa524('0x44')]({'where':{'id':_0x3f5694['params']['id']}})['then'](handleEntityNotFound(_0x161393,null))[_0xa524('0x23')](removeEntity(_0x161393,null))[_0xa524('0x45')](handleError(_0x161393,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index af5b3d0..9acccd2 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 _0xb93d=['rimraf','./tag.attributes','define','Tag','tools_tags','util','../../config/logger','api','moment','bluebird','path'];(function(_0x3a5a6f,_0x5c88fa){var _0x51d90d=function(_0x3199c1){while(--_0x3199c1){_0x3a5a6f['push'](_0x3a5a6f['shift']());}};_0x51d90d(++_0x5c88fa);}(_0xb93d,0xaa));var _0xdb93=function(_0x589aee,_0x140a03){_0x589aee=_0x589aee-0x0;var _0x2f5ed4=_0xb93d[_0x589aee];return _0x2f5ed4;};'use strict';var _=require('lodash');var util=require(_0xdb93('0x0'));var logger=require(_0xdb93('0x1'))(_0xdb93('0x2'));var moment=require(_0xdb93('0x3'));var BPromise=require(_0xdb93('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdb93('0x5'));var rimraf=require(_0xdb93('0x6'));var config=require('../../config/environment');var attributes=require(_0xdb93('0x7'));module['exports']=function(_0x301be0,_0x3ad2cc){return _0x301be0[_0xdb93('0x8')](_0xdb93('0x9'),attributes,{'tableName':_0xdb93('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x938b=['api','moment','request-promise','path','rimraf','../../config/environment','./tag.attributes','exports','Tag','tools_tags','lodash'];(function(_0x378e5f,_0x404e88){var _0x4cfd4a=function(_0x42cee8){while(--_0x42cee8){_0x378e5f['push'](_0x378e5f['shift']());}};_0x4cfd4a(++_0x404e88);}(_0x938b,0x1cd));var _0xb938=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x938b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb938('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb938('0x1'));var moment=require(_0xb938('0x2'));var BPromise=require('bluebird');var rp=require(_0xb938('0x3'));var fs=require('fs');var path=require(_0xb938('0x4'));var rimraf=require(_0xb938('0x5'));var config=require(_0xb938('0x6'));var attributes=require(_0xb938('0x7'));module[_0xb938('0x8')]=function(_0x317569,_0x39af3e){return _0x317569['define'](_0xb938('0x9'),attributes,{'tableName':_0xb938('0xa'),'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 2168367..ee89d15 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 _0x00bb=['stringify','error','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s'];(function(_0x5243c8,_0x3fab66){var _0xda00c8=function(_0x2a5450){while(--_0x2a5450){_0x5243c8['push'](_0x5243c8['shift']());}};_0xda00c8(++_0x3fab66);}(_0x00bb,0x1d8));var _0xb00b=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x00bb[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var moment=require(_0xb00b('0x2'));var BPromise=require('bluebird');var rs=require(_0xb00b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb00b('0x4'))['db'];var utils=require(_0xb00b('0x5'));var logger=require('../../config/logger')(_0xb00b('0x6'));var config=require(_0xb00b('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36e363,_0xf737d0,_0x41dfc9){return new BPromise(function(_0x37f07d,_0xfa4181){return client[_0xb00b('0x8')](_0x36e363,_0x41dfc9)['then'](function(_0x51d12b){logger[_0xb00b('0x9')](_0xb00b('0xa'),_0xf737d0,_0xb00b('0xb'));logger[_0xb00b('0xc')](_0xb00b('0xd'),_0xf737d0,'request\x20sent',JSON[_0xb00b('0xe')](_0x51d12b));if(_0x51d12b['error']){if(_0x51d12b['error']['code']===0x1f4){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);return _0xfa4181(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}logger['error'](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')]['message']);return _0x37f07d(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}else{logger['info']('Tag,\x20%s,\x20%s',_0xf737d0,_0xb00b('0xb'));_0x37f07d(_0x51d12b['result']['message']);}})[_0xb00b('0x11')](function(_0x638443){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x638443);_0xfa4181(_0x638443);});});} \ No newline at end of file +var _0xaba6=['../../mysqldb','../../config/utils','rpc','../../config/environment','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xaba6,0xe2));var _0x6aba=function(_0x38bce7,_0x366405){_0x38bce7=_0x38bce7-0x0;var _0x4f8b4e=_0xaba6[_0x38bce7];return _0x4f8b4e;};'use strict';var _=require(_0x6aba('0x0'));var util=require(_0x6aba('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6aba('0x2'))['db'];var utils=require(_0x6aba('0x3'));var logger=require('../../config/logger')(_0x6aba('0x4'));var config=require(_0x6aba('0x5'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x39c32a,_0x54416a,_0x3766d4){return new BPromise(function(_0x1a4fbc,_0x508dff){return client[_0x6aba('0x6')](_0x39c32a,_0x3766d4)[_0x6aba('0x7')](function(_0x4ea8eb){logger[_0x6aba('0x8')](_0x6aba('0x9'),_0x54416a,_0x6aba('0xa'));logger[_0x6aba('0xb')](_0x6aba('0xc'),_0x54416a,_0x6aba('0xa'),JSON[_0x6aba('0xd')](_0x4ea8eb));if(_0x4ea8eb['error']){if(_0x4ea8eb[_0x6aba('0xe')][_0x6aba('0xf')]===0x1f4){logger[_0x6aba('0xe')](_0x6aba('0x9'),_0x54416a,_0x4ea8eb['error'][_0x6aba('0x10')]);return _0x508dff(_0x4ea8eb[_0x6aba('0xe')]['message']);}logger[_0x6aba('0xe')](_0x6aba('0x9'),_0x54416a,_0x4ea8eb[_0x6aba('0xe')]['message']);return _0x1a4fbc(_0x4ea8eb[_0x6aba('0xe')][_0x6aba('0x10')]);}else{logger[_0x6aba('0x8')]('Tag,\x20%s,\x20%s',_0x54416a,_0x6aba('0xa'));_0x1a4fbc(_0x4ea8eb[_0x6aba('0x11')][_0x6aba('0x10')]);}})[_0x6aba('0x12')](function(_0x379b17){logger[_0x6aba('0xe')](_0x6aba('0x9'),_0x54416a,_0x379b17);_0x508dff(_0x379b17);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 8786d92..4a91924 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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'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(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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 6f67301..72d58a0 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 _0xb10b=['name','sequelize','STRING'];(function(_0x295d07,_0x1c935c){var _0x1b3fe6=function(_0x52a439){while(--_0x52a439){_0x295d07['push'](_0x295d07['shift']());}};_0x1b3fe6(++_0x1c935c);}(_0xb10b,0x12a));var _0xbb10=function(_0x23bb07,_0x2d8a9b){_0x23bb07=_0x23bb07-0x0;var _0x3577df=_0xb10b[_0x23bb07];return _0x3577df;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x19ca3c,_0xba828){var _0x271ce=function(_0x3e36b9){while(--_0x3e36b9){_0x19ca3c['push'](_0x19ca3c['shift']());}};_0x271ce(++_0xba828);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 82efe23..95a95af 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 _0x1a8d=['Teams','getQueues','findOne','isValidChannel','channel','ValidationError','Unknown\x20channel','capitalize','Queue','length','add','toLowerCase','Queues','ids','removeQueues','remove','addAgents','isArray','Voice','Chat','Mail','Sms','Fax','Whatsapp','through','QueueId','TeamVoiceQueue','penalty','User','findOrCreate','emit','online','interface','UserVoiceQueueRt','upsert','format','voicePause','all','TeamVoicePrefix','VoicePrefixId','spread','removeAgents','Openchannel','Queue:remove','getAgents','hasOwnProperty','nolimit','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','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','./team.socket','register','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','save','update','then','error','send','index','Team','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','order','sort','where','pick','filter','merge','map','VIRTUAL','name','options','includeAll','include','findAll','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','UserId','SELECT','VoiceQueueId','UserVoiceQueue','MailQueueId','UserMailQueue','SmsQueueId','UserSmsQueue','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','UserFaxQueue','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','UserVoicePrefix'];(function(_0xb6a965,_0x5c5ace){var _0x51d37d=function(_0x1c7c0d){while(--_0x1c7c0d){_0xb6a965['push'](_0xb6a965['shift']());}};_0x51d37d(++_0x5c5ace);}(_0x1a8d,0xcc));var _0xd1a8=function(_0x5b5881,_0x2544d7){_0x5b5881=_0x5b5881-0x0;var _0x311675=_0x1a8d[_0x5b5881];return _0x311675;};'use strict';var emlformat=require(_0xd1a8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd1a8('0x1'));var jsonpatch=require(_0xd1a8('0x2'));var rp=require(_0xd1a8('0x3'));var moment=require(_0xd1a8('0x4'));var BPromise=require(_0xd1a8('0x5'));var Mustache=require(_0xd1a8('0x6'));var util=require('util');var path=require(_0xd1a8('0x7'));var sox=require(_0xd1a8('0x8'));var csv=require('to-csv');var ejs=require(_0xd1a8('0x9'));var fs=require('fs');var fs_extra=require(_0xd1a8('0xa'));var _=require(_0xd1a8('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd1a8('0xc'));var deskjs=require(_0xd1a8('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd1a8('0xe'));var Papa=require(_0xd1a8('0xf'));var Redis=require(_0xd1a8('0x10'));var authService=require(_0xd1a8('0x11'));var qs=require(_0xd1a8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd1a8('0x13'));var logger=require(_0xd1a8('0x14'))(_0xd1a8('0x15'));var utils=require(_0xd1a8('0x16'));var config=require(_0xd1a8('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xd1a8('0x18'))['db'];config[_0xd1a8('0x19')]=_[_0xd1a8('0x1a')](config[_0xd1a8('0x19')],{'host':_0xd1a8('0x1b'),'port':0x18eb});var socket=require(_0xd1a8('0x1c'))(new Redis(config[_0xd1a8('0x19')]));require(_0xd1a8('0x1d'))[_0xd1a8('0x1e')](socket);function respondWithStatusCode(_0x1e042f,_0x2046b1){_0x2046b1=_0x2046b1||0xcc;return function(_0x536ec4){if(_0x536ec4){return _0x1e042f[_0xd1a8('0x1f')](_0x2046b1);}return _0x1e042f[_0xd1a8('0x20')](_0x2046b1)[_0xd1a8('0x21')]();};}function respondWithResult(_0x5342cc,_0x244afa){_0x244afa=_0x244afa||0xc8;return function(_0x51e777){if(_0x51e777){return _0x5342cc[_0xd1a8('0x20')](_0x244afa)[_0xd1a8('0x22')](_0x51e777);}};}function respondWithFilteredResult(_0x234300,_0x36553a){return function(_0x5aacb1){if(_0x5aacb1){var _0x30237d=typeof _0x36553a['offset']===_0xd1a8('0x23')&&typeof _0x36553a['limit']===_0xd1a8('0x23');var _0x2778f2=_0x5aacb1['count'];var _0x532a7f=_0x30237d?0x0:_0x36553a[_0xd1a8('0x24')];var _0x46ac48=_0x30237d?_0x5aacb1[_0xd1a8('0x25')]:_0x36553a['offset']+_0x36553a[_0xd1a8('0x26')];var _0x46ee1f;if(_0x46ac48>=_0x2778f2){_0x46ac48=_0x2778f2;_0x46ee1f=0xc8;}else{_0x46ee1f=0xce;}_0x234300['status'](_0x46ee1f);return _0x234300[_0xd1a8('0x27')](_0xd1a8('0x28'),_0x532a7f+'-'+_0x46ac48+'/'+_0x2778f2)['json'](_0x5aacb1);}return null;};}function patchUpdates(_0x268e5c){return function(_0x169f5a){try{jsonpatch['apply'](_0x169f5a,_0x268e5c,!![]);}catch(_0x395ceb){return BPromise['reject'](_0x395ceb);}return _0x169f5a[_0xd1a8('0x29')]();};}function saveUpdates(_0x5f0d75,_0x5cba56){return function(_0x3cb19a){if(_0x3cb19a){return _0x3cb19a[_0xd1a8('0x2a')](_0x5f0d75)[_0xd1a8('0x2b')](function(_0x559d74){return _0x559d74;});}return null;};}function handleEntityNotFound(_0x2ab6c9,_0x5799e2){return function(_0x589103){if(!_0x589103){_0x2ab6c9[_0xd1a8('0x1f')](0x194);}return _0x589103;};}function handleError(_0x4fdb15,_0x516ad3){_0x516ad3=_0x516ad3||0x1f4;return function(_0x5938f5){logger[_0xd1a8('0x2c')](_0x5938f5['stack']);if(_0x5938f5['name']){delete _0x5938f5['name'];}_0x4fdb15[_0xd1a8('0x20')](_0x516ad3)[_0xd1a8('0x2d')](_0x5938f5);};}exports[_0xd1a8('0x2e')]=function(_0xacd822,_0x1045d4){var _0x286617={},_0x1c9ec2={},_0x1e8f1a={'count':0x0,'rows':[]};var _0x26a570=_['map'](db[_0xd1a8('0x2f')][_0xd1a8('0x30')],function(_0xa4b95c){return{'name':_0xa4b95c[_0xd1a8('0x31')],'type':_0xa4b95c[_0xd1a8('0x32')][_0xd1a8('0x33')]};});_0x1c9ec2[_0xd1a8('0x34')]=_['map'](_0x26a570,'name');_0x1c9ec2[_0xd1a8('0x35')]=_[_0xd1a8('0x36')](_0xacd822['query']);_0x1c9ec2[_0xd1a8('0x37')]=_[_0xd1a8('0x38')](_0x1c9ec2[_0xd1a8('0x34')],_0x1c9ec2[_0xd1a8('0x35')]);_0x286617['attributes']=_[_0xd1a8('0x38')](_0x1c9ec2[_0xd1a8('0x34')],qs[_0xd1a8('0x39')](_0xacd822[_0xd1a8('0x35')][_0xd1a8('0x39')]));_0x286617[_0xd1a8('0x3a')]=_0x286617[_0xd1a8('0x3a')]['length']?_0x286617[_0xd1a8('0x3a')]:_0x1c9ec2[_0xd1a8('0x34')];if(!_0xacd822[_0xd1a8('0x35')]['hasOwnProperty']('nolimit')){_0x286617[_0xd1a8('0x26')]=qs['limit'](_0xacd822['query'][_0xd1a8('0x26')]);_0x286617[_0xd1a8('0x24')]=qs['offset'](_0xacd822[_0xd1a8('0x35')][_0xd1a8('0x24')]);}_0x286617[_0xd1a8('0x3b')]=qs[_0xd1a8('0x3c')](_0xacd822['query'][_0xd1a8('0x3c')]);_0x286617[_0xd1a8('0x3d')]=qs[_0xd1a8('0x37')](_[_0xd1a8('0x3e')](_0xacd822[_0xd1a8('0x35')],_0x1c9ec2[_0xd1a8('0x37')]),_0x26a570);if(_0xacd822[_0xd1a8('0x35')][_0xd1a8('0x3f')]){_0x286617[_0xd1a8('0x3d')]=_[_0xd1a8('0x40')](_0x286617[_0xd1a8('0x3d')],{'$or':_[_0xd1a8('0x41')](_0x26a570,function(_0x319303){if(_0x319303[_0xd1a8('0x32')]!==_0xd1a8('0x42')){var _0x499d03={};_0x499d03[_0x319303[_0xd1a8('0x43')]]={'$like':'%'+_0xacd822[_0xd1a8('0x35')]['filter']+'%'};return _0x499d03;}})});}_0x286617=_[_0xd1a8('0x40')]({},_0x286617,_0xacd822[_0xd1a8('0x44')]);var _0x43f84f={'where':_0x286617[_0xd1a8('0x3d')]};return db[_0xd1a8('0x2f')][_0xd1a8('0x25')](_0x43f84f)['then'](function(_0x2c400d){_0x1e8f1a[_0xd1a8('0x25')]=_0x2c400d;if(_0xacd822[_0xd1a8('0x35')][_0xd1a8('0x45')]){_0x286617[_0xd1a8('0x46')]=[{'all':!![]}];}return db['Team'][_0xd1a8('0x47')](_0x286617);})[_0xd1a8('0x2b')](function(_0x1f5e10){_0x1e8f1a['rows']=_0x1f5e10;return _0x1e8f1a;})[_0xd1a8('0x2b')](respondWithFilteredResult(_0x1045d4,_0x286617))[_0xd1a8('0x48')](handleError(_0x1045d4,null));};exports[_0xd1a8('0x49')]=function(_0x5972b1,_0x533043){var _0xabeed5={'raw':![],'where':{'id':_0x5972b1[_0xd1a8('0x4a')]['id']}},_0x3a715e={};_0x3a715e[_0xd1a8('0x34')]=_[_0xd1a8('0x36')](db['Team'][_0xd1a8('0x30')]);_0x3a715e[_0xd1a8('0x35')]=_['keys'](_0x5972b1[_0xd1a8('0x35')]);_0x3a715e[_0xd1a8('0x37')]=_[_0xd1a8('0x38')](_0x3a715e[_0xd1a8('0x34')],_0x3a715e['query']);_0xabeed5[_0xd1a8('0x3a')]=_[_0xd1a8('0x38')](_0x3a715e['model'],qs['fields'](_0x5972b1[_0xd1a8('0x35')][_0xd1a8('0x39')]));_0xabeed5[_0xd1a8('0x3a')]=_0xabeed5[_0xd1a8('0x3a')]['length']?_0xabeed5[_0xd1a8('0x3a')]:_0x3a715e[_0xd1a8('0x34')];if(_0x5972b1[_0xd1a8('0x35')]['includeAll']){_0xabeed5[_0xd1a8('0x46')]=[{'all':!![]}];}_0xabeed5=_[_0xd1a8('0x40')]({},_0xabeed5,_0x5972b1['options']);return db[_0xd1a8('0x2f')][_0xd1a8('0x4b')](_0xabeed5)[_0xd1a8('0x2b')](handleEntityNotFound(_0x533043,null))[_0xd1a8('0x2b')](respondWithResult(_0x533043,null))['catch'](handleError(_0x533043,null));};exports['create']=function(_0x51a4fc,_0x1a2187){return db['Team'][_0xd1a8('0x4c')](_0x51a4fc[_0xd1a8('0x4d')],{})[_0xd1a8('0x2b')](function(_0x2ed5a3){var _0x3b426a=_0x51a4fc[_0xd1a8('0x4e')][_0xd1a8('0x4f')]({'plain':!![]});if(!_0x3b426a)throw new Error(_0xd1a8('0x50'));if(_0x3b426a[_0xd1a8('0x51')]===_0xd1a8('0x4e')){var _0x28b409=_0x2ed5a3[_0xd1a8('0x4f')]({'plain':!![]});var _0x3861a3='Teams';return db[_0xd1a8('0x52')][_0xd1a8('0x4b')]({'where':{'name':_0x3861a3,'userProfileId':_0x3b426a[_0xd1a8('0x53')]},'raw':!![]})[_0xd1a8('0x2b')](function(_0x17406c){if(_0x17406c&&_0x17406c['autoAssociation']===0x0){return db[_0xd1a8('0x54')][_0xd1a8('0x4c')]({'name':_0x28b409[_0xd1a8('0x43')],'resourceId':_0x28b409['id'],'type':_0x17406c[_0xd1a8('0x43')],'sectionId':_0x17406c['id']},{})[_0xd1a8('0x2b')](function(){return _0x2ed5a3;});}else{return _0x2ed5a3;}})[_0xd1a8('0x48')](function(_0x1ac64b){logger[_0xd1a8('0x2c')](_0xd1a8('0x55'),_0x1ac64b);throw _0x1ac64b;});}return _0x2ed5a3;})['then'](respondWithResult(_0x1a2187,0xc9))[_0xd1a8('0x48')](handleError(_0x1a2187,null));};exports[_0xd1a8('0x2a')]=function(_0x4ce0b8,_0x12658e){if(_0x4ce0b8[_0xd1a8('0x4d')]['id']){delete _0x4ce0b8[_0xd1a8('0x4d')]['id'];}return db[_0xd1a8('0x2f')][_0xd1a8('0x4b')]({'where':{'id':_0x4ce0b8[_0xd1a8('0x4a')]['id']}})[_0xd1a8('0x2b')](handleEntityNotFound(_0x12658e,null))['then'](saveUpdates(_0x4ce0b8[_0xd1a8('0x4d')],null))['then'](respondWithResult(_0x12658e,null))[_0xd1a8('0x48')](handleError(_0x12658e,null));};exports[_0xd1a8('0x56')]=function(_0x291e06,_0x26ff3e){var _0x5927d0=_0x291e06['params']['id'];var _0x5ad593=[];return db[_0xd1a8('0x57')][_0xd1a8('0x58')](function(_0x19a0a8){var _0xda2487=_0xd1a8('0x59')+_0x5927d0;return db[_0xd1a8('0x57')][_0xd1a8('0x35')](_0xda2487,{'type':db[_0xd1a8('0x5a')][_0xd1a8('0x5b')]['SELECT'],'raw':!![],'transaction':_0x19a0a8})[_0xd1a8('0x2b')](function(_0x2fac5d){_0x5ad593=_[_0xd1a8('0x41')](_0x2fac5d,function(_0x48fbd1){return Number(_0x48fbd1[_0xd1a8('0x5c')]);});})[_0xd1a8('0x2b')](function(){var _0xe8b3fb='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x5927d0;return db['sequelize'][_0xd1a8('0x35')](_0xe8b3fb,{'type':db['Sequelize'][_0xd1a8('0x5b')][_0xd1a8('0x5d')],'raw':!![],'transaction':_0x19a0a8});})['then'](function(_0x433cc5){var _0x6a1b1f=_[_0xd1a8('0x41')](_0x433cc5,function(_0x233051){return Number(_0x233051[_0xd1a8('0x5e')]);});return db[_0xd1a8('0x5f')][_0xd1a8('0x56')]({'where':{'UserId':{'$in':_0x5ad593},'VoiceQueueId':{'$in':_0x6a1b1f}},'transaction':_0x19a0a8});})['then'](function(){var _0x16881d='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x5927d0;return db[_0xd1a8('0x57')][_0xd1a8('0x35')](_0x16881d,{'type':db[_0xd1a8('0x5a')][_0xd1a8('0x5b')][_0xd1a8('0x5d')],'raw':!![],'transaction':_0x19a0a8});})['then'](function(_0xd13a5f){var _0x3600f1=_['map'](_0xd13a5f,function(_0x55f2cc){return Number(_0x55f2cc[_0xd1a8('0x60')]);});return db[_0xd1a8('0x61')][_0xd1a8('0x56')]({'where':{'UserId':{'$in':_0x5ad593},'MailQueueId':{'$in':_0x3600f1}},'transaction':_0x19a0a8});})[_0xd1a8('0x2b')](function(){var _0x1b6fcd='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x5927d0;return db[_0xd1a8('0x57')][_0xd1a8('0x35')](_0x1b6fcd,{'type':db['Sequelize']['QueryTypes'][_0xd1a8('0x5d')],'raw':!![],'transaction':_0x19a0a8});})[_0xd1a8('0x2b')](function(_0x281a40){var _0xd68041=_[_0xd1a8('0x41')](_0x281a40,function(_0x123ceb){return Number(_0x123ceb[_0xd1a8('0x62')]);});return db[_0xd1a8('0x63')][_0xd1a8('0x56')]({'where':{'UserId':{'$in':_0x5ad593},'SmsQueueId':{'$in':_0xd68041}},'transaction':_0x19a0a8});})[_0xd1a8('0x2b')](function(){var _0x3f1dff='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x5927d0;return db[_0xd1a8('0x57')][_0xd1a8('0x35')](_0x3f1dff,{'type':db[_0xd1a8('0x5a')][_0xd1a8('0x5b')][_0xd1a8('0x5d')],'raw':!![],'transaction':_0x19a0a8});})['then'](function(_0x25fecb){var _0x25d7a2=_[_0xd1a8('0x41')](_0x25fecb,function(_0x290362){return Number(_0x290362[_0xd1a8('0x64')]);});return db[_0xd1a8('0x65')][_0xd1a8('0x56')]({'where':{'UserId':{'$in':_0x5ad593},'ChatQueueId':{'$in':_0x25d7a2}},'transaction':_0x19a0a8});})[_0xd1a8('0x2b')](function(){var _0x1a26cb=_0xd1a8('0x66')+_0x5927d0;return db['sequelize'][_0xd1a8('0x35')](_0x1a26cb,{'type':db[_0xd1a8('0x5a')][_0xd1a8('0x5b')][_0xd1a8('0x5d')],'raw':!![],'transaction':_0x19a0a8});})[_0xd1a8('0x2b')](function(_0x2c2014){var _0x2a0852=_['map'](_0x2c2014,function(_0x50186a){return Number(_0x50186a['FaxQueueId']);});return db[_0xd1a8('0x67')][_0xd1a8('0x56')]({'where':{'UserId':{'$in':_0x5ad593},'FaxQueueId':{'$in':_0x2a0852}},'transaction':_0x19a0a8});})[_0xd1a8('0x2b')](function(){var _0x58c42a='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x5927d0;return db[_0xd1a8('0x57')][_0xd1a8('0x35')](_0x58c42a,{'type':db[_0xd1a8('0x5a')]['QueryTypes'][_0xd1a8('0x5d')],'raw':!![],'transaction':_0x19a0a8});})['then'](function(_0x2d13ea){var _0x30d93a=_[_0xd1a8('0x41')](_0x2d13ea,function(_0x2a9c63){return Number(_0x2a9c63[_0xd1a8('0x68')]);});return db[_0xd1a8('0x69')]['destroy']({'where':{'UserId':{'$in':_0x5ad593},'OpenchannelQueueId':{'$in':_0x30d93a}},'transaction':_0x19a0a8});})[_0xd1a8('0x2b')](function(){var _0x546a84=_0xd1a8('0x6a')+_0x5927d0;return db[_0xd1a8('0x57')][_0xd1a8('0x35')](_0x546a84,{'type':db[_0xd1a8('0x5a')][_0xd1a8('0x5b')]['SELECT'],'raw':!![],'transaction':_0x19a0a8});})['then'](function(_0x5e22e9){var _0x1177be=_[_0xd1a8('0x41')](_0x5e22e9,function(_0x3623bb){return Number(_0x3623bb[_0xd1a8('0x6b')]);});return db[_0xd1a8('0x6c')][_0xd1a8('0x56')]({'where':{'UserId':{'$in':_0x5ad593},'WhatsappQueueId':{'$in':_0x1177be}},'transaction':_0x19a0a8});})[_0xd1a8('0x2b')](function(){return db['TeamVoicePrefix'][_0xd1a8('0x4b')]({'where':{'TeamId':_0x5927d0}});})[_0xd1a8('0x2b')](function(_0x2b84cb){if(_0x2b84cb===null){return;}return db[_0xd1a8('0x6d')][_0xd1a8('0x56')]({'where':{'UserId':{'$in':_0x5ad593},'VoicePrefixId':_0x2b84cb['VoicePrefixId']},'transaction':_0x19a0a8});})[_0xd1a8('0x2b')](function(){return db['Team'][_0xd1a8('0x56')]({'where':{'id':_0x5927d0},'cascade':!![],'transaction':_0x19a0a8});})[_0xd1a8('0x2b')](function(_0x5dd1cf){if(_0x5dd1cf===0x0){_0x26ff3e[_0xd1a8('0x1f')](0x194);}else{return db[_0xd1a8('0x54')]['destroy']({'where':{'type':_0xd1a8('0x6e'),'resourceId':_0x5927d0},'cascade':!![],'transaction':_0x19a0a8})[_0xd1a8('0x2b')](function(){_0x26ff3e[_0xd1a8('0x20')](0xcc)['end']();});}})['catch'](function(_0x3188be){_0x26ff3e[_0xd1a8('0x20')](0x1f4)['send'](_0x3188be);});});};exports[_0xd1a8('0x6f')]=function(_0x3a73c9,_0x33ddf3,_0x504c92){return db[_0xd1a8('0x2f')][_0xd1a8('0x70')]({'where':{'id':_0x3a73c9[_0xd1a8('0x4a')]['id']}})[_0xd1a8('0x2b')](handleEntityNotFound(_0x33ddf3,null))[_0xd1a8('0x2b')](function(_0x3121cc){if(!_0x3a73c9['query']['channel']||!utils[_0xd1a8('0x71')](_0x3a73c9[_0xd1a8('0x35')][_0xd1a8('0x72')])){throw new db['Sequelize'][(_0xd1a8('0x73'))](_0xd1a8('0x74'));}var _0x326e48={};var _0x1ef52f={};_0x1ef52f[_0xd1a8('0x34')]=_['keys'](db[_[_0xd1a8('0x75')](_0x3a73c9['query'][_0xd1a8('0x72')]['toLowerCase']())+_0xd1a8('0x76')][_0xd1a8('0x30')]);_0x1ef52f[_0xd1a8('0x35')]=_[_0xd1a8('0x36')](_0x3a73c9['query']);_0x1ef52f['filters']=_[_0xd1a8('0x38')](_0x1ef52f[_0xd1a8('0x34')],_0x1ef52f[_0xd1a8('0x35')]);_0x326e48[_0xd1a8('0x3a')]=_[_0xd1a8('0x38')](_0x1ef52f[_0xd1a8('0x34')],qs['fields'](_0x3a73c9[_0xd1a8('0x35')][_0xd1a8('0x39')]));_0x326e48[_0xd1a8('0x3a')]=_0x326e48[_0xd1a8('0x3a')][_0xd1a8('0x77')]?_0x326e48[_0xd1a8('0x3a')]:_0x1ef52f[_0xd1a8('0x34')];_0x326e48[_0xd1a8('0x26')]=qs[_0xd1a8('0x26')](_0x3a73c9[_0xd1a8('0x35')][_0xd1a8('0x26')]);_0x326e48['offset']=qs[_0xd1a8('0x24')](_0x3a73c9[_0xd1a8('0x35')][_0xd1a8('0x24')]);_0x326e48[_0xd1a8('0x3b')]=qs[_0xd1a8('0x3c')](_0x3a73c9[_0xd1a8('0x35')][_0xd1a8('0x3c')]);_0x326e48[_0xd1a8('0x3d')]=qs['filters'](_['pick'](_0x3a73c9[_0xd1a8('0x35')],_0x1ef52f[_0xd1a8('0x37')]));_0x326e48=_[_0xd1a8('0x40')]({},_0x326e48,_0x3a73c9[_0xd1a8('0x44')]);return _0x3121cc[_0xd1a8('0x4f')+_[_0xd1a8('0x75')](_0x3a73c9['query'][_0xd1a8('0x72')]['toLowerCase']())+'Queues'](_0x326e48);})[_0xd1a8('0x2b')](respondWithResult(_0x33ddf3,null))[_0xd1a8('0x48')](handleError(_0x33ddf3,null));};exports['addQueues']=function(_0x10544b,_0x1dfe5f,_0x4e1908){return db['Team'][_0xd1a8('0x70')]({'where':{'id':_0x10544b[_0xd1a8('0x4a')]['id']}})[_0xd1a8('0x2b')](function(_0x568b47){if(_0x568b47){if(!_0x10544b[_0xd1a8('0x4d')][_0xd1a8('0x72')]||!utils[_0xd1a8('0x71')](_0x10544b[_0xd1a8('0x4d')][_0xd1a8('0x72')])){throw new db[(_0xd1a8('0x5a'))][(_0xd1a8('0x73'))](_0xd1a8('0x74'));}return _0x568b47[_0xd1a8('0x78')+_['capitalize'](_0x10544b[_0xd1a8('0x4d')][_0xd1a8('0x72')][_0xd1a8('0x79')]())+_0xd1a8('0x7a')](_0x10544b[_0xd1a8('0x4d')][_0xd1a8('0x7b')]);}return null;})[_0xd1a8('0x2b')](handleEntityNotFound(_0x1dfe5f,null))[_0xd1a8('0x2b')](respondWithStatusCode(_0x1dfe5f,null))[_0xd1a8('0x48')](handleError(_0x1dfe5f,null));};exports[_0xd1a8('0x7c')]=function(_0x106cf0,_0x597503,_0x5991e3){return db['Team'][_0xd1a8('0x70')]({'where':{'id':_0x106cf0[_0xd1a8('0x4a')]['id']}})[_0xd1a8('0x2b')](function(_0x349cd6){if(_0x349cd6){if(!_0x106cf0[_0xd1a8('0x35')][_0xd1a8('0x72')]||!utils[_0xd1a8('0x71')](_0x106cf0[_0xd1a8('0x35')][_0xd1a8('0x72')])){throw new db[(_0xd1a8('0x5a'))][(_0xd1a8('0x73'))](_0xd1a8('0x74'));}return _0x349cd6[_0xd1a8('0x7d')+_[_0xd1a8('0x75')](_0x106cf0[_0xd1a8('0x35')][_0xd1a8('0x72')][_0xd1a8('0x79')]())+'Queues'](_0x106cf0[_0xd1a8('0x35')][_0xd1a8('0x7b')]);}return null;})[_0xd1a8('0x2b')](handleEntityNotFound(_0x597503,null))[_0xd1a8('0x2b')](respondWithStatusCode(_0x597503,null))[_0xd1a8('0x48')](handleError(_0x597503,null));};exports[_0xd1a8('0x7e')]=function(_0x3c3927,_0x344e93){var _0x23b9e2=_[_0xd1a8('0x7f')](_0x3c3927[_0xd1a8('0x4d')][_0xd1a8('0x7b')])?_0x3c3927[_0xd1a8('0x4d')][_0xd1a8('0x7b')]:[_0x3c3927[_0xd1a8('0x4d')][_0xd1a8('0x7b')]];var _0x21d513=_0x3c3927[_0xd1a8('0x4a')]['id'];return db[_0xd1a8('0x2f')][_0xd1a8('0x4b')]({'where':{'id':_0x21d513}})[_0xd1a8('0x2b')](handleEntityNotFound(_0x344e93,null))[_0xd1a8('0x2b')](function(_0x39d02a){if(_0x39d02a){var _0x196410=[_0xd1a8('0x80'),_0xd1a8('0x81'),_0xd1a8('0x82'),_0xd1a8('0x83'),_0xd1a8('0x84'),'Openchannel',_0xd1a8('0x85')];return db[_0xd1a8('0x57')]['transaction'](function(_0x3d0c14){var _0x1e8ff4=_[_0xd1a8('0x41')](_0x196410,function(_0x4722a7){var _0x466f76={'attributes':['id',_0xd1a8('0x43')]};if(_0x4722a7==='Voice'){_0x466f76[_0xd1a8('0x86')]={'attributes':['penalty']};}return _0x39d02a[_0xd1a8('0x4f')+_0x4722a7+_0xd1a8('0x7a')](_0x466f76)[_0xd1a8('0x2b')](function(_0x4cb606){var _0x32413b=_[_0xd1a8('0x41')](_0x4cb606,function(_0x3f7c96){var _0x50f659=_[_0xd1a8('0x41')](_0x23b9e2,function(_0x2a6137){var _0x1866eb={'where':{'UserId':_0x2a6137,[_0x4722a7+_0xd1a8('0x87')]:_0x3f7c96['id']},'transaction':_0x3d0c14};if(_0x4722a7===_0xd1a8('0x80')){_0x1866eb[_0xd1a8('0x1a')]={'penalty':_0x3f7c96[_0xd1a8('0x88')][_0xd1a8('0x89')]};}return db[_0xd1a8('0x8a')+_0x4722a7+_0xd1a8('0x76')][_0xd1a8('0x8b')](_0x1866eb)['then'](function(){socket[_0xd1a8('0x8c')]('user'+_0x4722a7+'Queue:save',{'UserId':_0x2a6137,[_0x4722a7+_0xd1a8('0x87')]:_0x3f7c96['id']});if(_0x4722a7!==_0xd1a8('0x80')){return;}return db['User'][_0xd1a8('0x47')]({'where':{'id':_0x23b9e2,'online':0x1},'attributes':['id','name',_0xd1a8('0x8d'),'voicePause',_0xd1a8('0x8e')],'raw':!![]})[_0xd1a8('0x2b')](function(_0x262e37){var _0x1f0585=_['map'](_0x262e37,function(_0xf4b7aa){return db[_0xd1a8('0x8f')][_0xd1a8('0x90')]({'membername':_0xf4b7aa[_0xd1a8('0x43')],'UserId':_0xf4b7aa['id'],'queue_name':_0x3f7c96[_0xd1a8('0x43')],'VoiceQueueId':_0x3f7c96['id'],'interface':_['isNil'](_0xf4b7aa['interface'])?util[_0xd1a8('0x91')]('SIP/%s',_0xf4b7aa[_0xd1a8('0x43')]):_0xf4b7aa[_0xd1a8('0x8e')],'paused':_0xf4b7aa[_0xd1a8('0x92')]||![],'penalty':_0x3f7c96[_0xd1a8('0x88')]['penalty']},{'transaction':_0x3d0c14});});return Promise[_0xd1a8('0x93')](_0x1f0585);});});});return Promise['all'](_0x50f659);});return Promise[_0xd1a8('0x93')](_0x32413b);})[_0xd1a8('0x2b')](function(){return db[_0xd1a8('0x94')][_0xd1a8('0x70')]({'where':{'teamId':_0x21d513}})[_0xd1a8('0x2b')](function(_0x14e0ab){if(_0x14e0ab){var _0xbd99c=_[_0xd1a8('0x41')](_0x23b9e2,function(_0x3de7f5){db[_0xd1a8('0x6d')][_0xd1a8('0x90')]({'UserId':_0x3de7f5,'VoicePrefixId':_0x14e0ab[_0xd1a8('0x95')]});});return Promise[_0xd1a8('0x93')](_0xbd99c);}});});});return Promise[_0xd1a8('0x93')](_0x1e8ff4)['then'](function(){return _0x39d02a['addAgents'](_0x23b9e2,{'transaction':_0x3d0c14})[_0xd1a8('0x96')](function(_0x3317aa){return _0x3317aa;});});});}})[_0xd1a8('0x2b')](respondWithResult(_0x344e93,null))[_0xd1a8('0x48')](handleError(_0x344e93,null));};exports[_0xd1a8('0x97')]=function(_0x688cc8,_0x339138){var _0x1e3ea4=_[_0xd1a8('0x7f')](_0x688cc8[_0xd1a8('0x35')][_0xd1a8('0x7b')])?_0x688cc8[_0xd1a8('0x35')][_0xd1a8('0x7b')]:[_0x688cc8[_0xd1a8('0x35')][_0xd1a8('0x7b')]];var _0x183b58=_0x688cc8['params']['id'];return db[_0xd1a8('0x2f')]['find']({'where':{'id':_0x183b58}})[_0xd1a8('0x2b')](handleEntityNotFound(_0x339138,null))[_0xd1a8('0x2b')](function(_0x364e47){if(_0x364e47){var _0x309178=[_0xd1a8('0x80'),'Chat',_0xd1a8('0x82'),_0xd1a8('0x83'),_0xd1a8('0x84'),_0xd1a8('0x98'),_0xd1a8('0x85')];return db[_0xd1a8('0x57')]['transaction'](function(_0x44b901){var _0x198ca4=_[_0xd1a8('0x41')](_0x309178,function(_0x220b2e){var _0x2a54f7={'attributes':['id',_0xd1a8('0x43')]};return _0x364e47[_0xd1a8('0x4f')+_0x220b2e+_0xd1a8('0x7a')](_0x2a54f7)[_0xd1a8('0x2b')](function(_0x3a376f){var _0x2dd177=_[_0xd1a8('0x41')](_0x3a376f,function(_0x58f5bb){return _0x58f5bb[_0xd1a8('0x97')](_0x1e3ea4,{'transaction':_0x44b901})[_0xd1a8('0x2b')](function(){var _0x5c3286=_[_0xd1a8('0x41')](_0x1e3ea4,function(_0x32573c){socket[_0xd1a8('0x8c')](_0xd1a8('0x4e')+_0x220b2e+_0xd1a8('0x99'),{'UserId':Number(_0x32573c),[_0x220b2e+_0xd1a8('0x87')]:_0x58f5bb['id']});if(_0x220b2e!==_0xd1a8('0x80')){return;}return db[_0xd1a8('0x8f')][_0xd1a8('0x56')]({'where':{'VoiceQueueId':_0x58f5bb['id'],'UserId':_0x32573c},'transaction':_0x44b901});});return Promise[_0xd1a8('0x93')](_0x5c3286);});});return Promise['all'](_0x2dd177);});});return Promise[_0xd1a8('0x93')](_0x198ca4)[_0xd1a8('0x2b')](function(){return _0x364e47['removeAgents'](_0x1e3ea4,{'transaction':_0x44b901});})[_0xd1a8('0x2b')](function(){return db[_0xd1a8('0x94')]['findOne']({'where':{'teamId':_0x183b58}})[_0xd1a8('0x2b')](function(_0x5f7236){if(_0x5f7236){var _0x1d6f3=_[_0xd1a8('0x41')](_0x1e3ea4,function(_0x22aec7){db['UserVoicePrefix'][_0xd1a8('0x56')]({'where':{'UserId':_0x22aec7,'VoicePrefixId':_0x5f7236['VoicePrefixId']}});});return Promise[_0xd1a8('0x93')](_0x1d6f3);}});});});}})[_0xd1a8('0x2b')](respondWithStatusCode(_0x339138,null))[_0xd1a8('0x48')](handleError(_0x339138,null));};exports['getAgents']=function(_0x2c2585,_0x2db3b3,_0x197bab){var _0x1ed3bb={};var _0x3adaf4={};var _0x4f61ce;var _0x5ea38a;return db[_0xd1a8('0x2f')]['findOne']({'where':{'id':_0x2c2585[_0xd1a8('0x4a')]['id']}})[_0xd1a8('0x2b')](handleEntityNotFound(_0x2db3b3,null))[_0xd1a8('0x2b')](function(_0x3df9b2){if(_0x3df9b2){_0x4f61ce=_0x3df9b2;_0x3adaf4[_0xd1a8('0x34')]=_[_0xd1a8('0x36')](db[_0xd1a8('0x8a')][_0xd1a8('0x30')]);_0x3adaf4['query']=_[_0xd1a8('0x36')](_0x2c2585[_0xd1a8('0x35')]);_0x3adaf4[_0xd1a8('0x37')]=_[_0xd1a8('0x38')](_0x3adaf4[_0xd1a8('0x34')],_0x3adaf4[_0xd1a8('0x35')]);_0x1ed3bb[_0xd1a8('0x3a')]=_[_0xd1a8('0x38')](_0x3adaf4[_0xd1a8('0x34')],qs[_0xd1a8('0x39')](_0x2c2585['query'][_0xd1a8('0x39')]));_0x1ed3bb[_0xd1a8('0x3a')]=_0x1ed3bb['attributes'][_0xd1a8('0x77')]?_0x1ed3bb[_0xd1a8('0x3a')]:_0x3adaf4[_0xd1a8('0x34')];_0x1ed3bb[_0xd1a8('0x3b')]=qs[_0xd1a8('0x3c')](_0x2c2585['query'][_0xd1a8('0x3c')]);_0x1ed3bb[_0xd1a8('0x3d')]=qs[_0xd1a8('0x37')](_[_0xd1a8('0x3e')](_0x2c2585['query'],_0x3adaf4[_0xd1a8('0x37')]));if(_0x2c2585[_0xd1a8('0x35')][_0xd1a8('0x3f')]){_0x1ed3bb['where']=_[_0xd1a8('0x40')](_0x1ed3bb[_0xd1a8('0x3d')],{'$or':_[_0xd1a8('0x41')](_0x1ed3bb[_0xd1a8('0x3a')],function(_0xe42505){var _0x518345={};_0x518345[_0xe42505]={'$like':'%'+_0x2c2585[_0xd1a8('0x35')][_0xd1a8('0x3f')]+'%'};return _0x518345;})});}_0x1ed3bb=_[_0xd1a8('0x40')]({},_0x1ed3bb,_0x2c2585[_0xd1a8('0x44')]);return _0x4f61ce[_0xd1a8('0x9a')](_0x1ed3bb);}})[_0xd1a8('0x2b')](function(_0x283d1){if(_0x283d1){_0x5ea38a=_0x283d1[_0xd1a8('0x77')];if(!_0x2c2585[_0xd1a8('0x35')][_0xd1a8('0x9b')](_0xd1a8('0x9c'))){_0x1ed3bb[_0xd1a8('0x26')]=qs['limit'](_0x2c2585['query'][_0xd1a8('0x26')]);_0x1ed3bb[_0xd1a8('0x24')]=qs[_0xd1a8('0x24')](_0x2c2585['query']['offset']);}return _0x4f61ce[_0xd1a8('0x9a')](_0x1ed3bb);}})[_0xd1a8('0x2b')](function(_0x485ffa){if(_0x485ffa){return _0x485ffa?{'count':_0x5ea38a,'rows':_0x485ffa}:null;}})['then'](respondWithResult(_0x2db3b3,null))[_0xd1a8('0x48')](handleError(_0x2db3b3,null));}; \ No newline at end of file +var _0xbcee=['stack','name','send','index','map','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','limit','order','sort','where','filters','filter','merge','VIRTUAL','options','Team','include','findAll','rows','catch','show','params','rawAttributes','includeAll','create','body','user','role','get','Teams','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','VoiceQueueId','UserVoiceQueue','destroy','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','VoicePrefixId','getQueues','isValidChannel','channel','ValidationError','capitalize','toLowerCase','Queue','pick','addQueues','findOne','Unknown\x20channel','add','ids','removeQueues','Queues','addAgents','isArray','Voice','Chat','Sms','Fax','Whatsapp','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','emit','Queue:save','online','voicePause','UserVoiceQueueRt','upsert','interface','SIP/%s','all','TeamVoicePrefix','UserVoicePrefix','removeAgents','Mail','Openchannel','getAgents','rimraf','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','./team.socket','register','status','end','json','offset','undefined','count','set','apply','save','update','then','sendStatus','error'];(function(_0x337b9c,_0x3afc9c){var _0x211ae3=function(_0x40150a){while(--_0x40150a){_0x337b9c['push'](_0x337b9c['shift']());}};_0x211ae3(++_0x3afc9c);}(_0xbcee,0x196));var _0xebce=function(_0x1ecd14,_0x1e2b1f){_0x1ecd14=_0x1ecd14-0x0;var _0x32e56d=_0xbcee[_0x1ecd14];return _0x32e56d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xebce('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xebce('0x1'));var BPromise=require(_0xebce('0x2'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xebce('0x3'));var csv=require(_0xebce('0x4'));var ejs=require(_0xebce('0x5'));var fs=require('fs');var fs_extra=require(_0xebce('0x6'));var _=require(_0xebce('0x7'));var squel=require(_0xebce('0x8'));var crypto=require(_0xebce('0x9'));var jsforce=require(_0xebce('0xa'));var deskjs=require(_0xebce('0xb'));var toCsv=require(_0xebce('0x4'));var querystring=require(_0xebce('0xc'));var Papa=require('papaparse');var Redis=require(_0xebce('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xebce('0xe'));var hardwareService=require(_0xebce('0xf'));var logger=require(_0xebce('0x10'))(_0xebce('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xebce('0x12'));var db=require(_0xebce('0x13'))['db'];config[_0xebce('0x14')]=_[_0xebce('0x15')](config[_0xebce('0x14')],{'host':_0xebce('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xebce('0x14')]));require(_0xebce('0x17'))[_0xebce('0x18')](socket);function respondWithStatusCode(_0x4bddd3,_0x51628a){_0x51628a=_0x51628a||0xcc;return function(_0x25425b){if(_0x25425b){return _0x4bddd3['sendStatus'](_0x51628a);}return _0x4bddd3[_0xebce('0x19')](_0x51628a)[_0xebce('0x1a')]();};}function respondWithResult(_0x5861f0,_0x2e150f){_0x2e150f=_0x2e150f||0xc8;return function(_0x15990a){if(_0x15990a){return _0x5861f0[_0xebce('0x19')](_0x2e150f)[_0xebce('0x1b')](_0x15990a);}};}function respondWithFilteredResult(_0x58eaa0,_0x51c044){return function(_0x3364a1){if(_0x3364a1){var _0x3ac5d5=typeof _0x51c044[_0xebce('0x1c')]===_0xebce('0x1d')&&typeof _0x51c044['limit']===_0xebce('0x1d');var _0x392837=_0x3364a1[_0xebce('0x1e')];var _0x13658e=_0x3ac5d5?0x0:_0x51c044[_0xebce('0x1c')];var _0x5a478a=_0x3ac5d5?_0x3364a1[_0xebce('0x1e')]:_0x51c044[_0xebce('0x1c')]+_0x51c044['limit'];var _0x55f43f;if(_0x5a478a>=_0x392837){_0x5a478a=_0x392837;_0x55f43f=0xc8;}else{_0x55f43f=0xce;}_0x58eaa0[_0xebce('0x19')](_0x55f43f);return _0x58eaa0[_0xebce('0x1f')]('Content-Range',_0x13658e+'-'+_0x5a478a+'/'+_0x392837)[_0xebce('0x1b')](_0x3364a1);}return null;};}function patchUpdates(_0x43142e){return function(_0x5a1e2b){try{jsonpatch[_0xebce('0x20')](_0x5a1e2b,_0x43142e,!![]);}catch(_0x8b049c){return BPromise['reject'](_0x8b049c);}return _0x5a1e2b[_0xebce('0x21')]();};}function saveUpdates(_0xcd528e,_0x1c1ff8){return function(_0x4bfb50){if(_0x4bfb50){return _0x4bfb50[_0xebce('0x22')](_0xcd528e)[_0xebce('0x23')](function(_0x53f0df){return _0x53f0df;});}return null;};}function handleEntityNotFound(_0x50362b,_0x3aac9b){return function(_0x4711fa){if(!_0x4711fa){_0x50362b[_0xebce('0x24')](0x194);}return _0x4711fa;};}function handleError(_0x4f1b17,_0x58da34){_0x58da34=_0x58da34||0x1f4;return function(_0xc3a4fc){logger[_0xebce('0x25')](_0xc3a4fc[_0xebce('0x26')]);if(_0xc3a4fc[_0xebce('0x27')]){delete _0xc3a4fc[_0xebce('0x27')];}_0x4f1b17[_0xebce('0x19')](_0x58da34)[_0xebce('0x28')](_0xc3a4fc);};}exports[_0xebce('0x29')]=function(_0x3d18f5,_0x4e55bc){var _0x18c48b={},_0x40cbef={},_0x4eb8ee={'count':0x0,'rows':[]};var _0x197e69=_[_0xebce('0x2a')](db['Team']['rawAttributes'],function(_0x470a2d){return{'name':_0x470a2d[_0xebce('0x2b')],'type':_0x470a2d[_0xebce('0x2c')][_0xebce('0x2d')]};});_0x40cbef[_0xebce('0x2e')]=_[_0xebce('0x2a')](_0x197e69,'name');_0x40cbef[_0xebce('0x2f')]=_[_0xebce('0x30')](_0x3d18f5[_0xebce('0x2f')]);_0x40cbef['filters']=_[_0xebce('0x31')](_0x40cbef[_0xebce('0x2e')],_0x40cbef['query']);_0x18c48b['attributes']=_[_0xebce('0x31')](_0x40cbef['model'],qs['fields'](_0x3d18f5[_0xebce('0x2f')][_0xebce('0x32')]));_0x18c48b[_0xebce('0x33')]=_0x18c48b[_0xebce('0x33')][_0xebce('0x34')]?_0x18c48b[_0xebce('0x33')]:_0x40cbef[_0xebce('0x2e')];if(!_0x3d18f5['query']['hasOwnProperty'](_0xebce('0x35'))){_0x18c48b[_0xebce('0x36')]=qs[_0xebce('0x36')](_0x3d18f5[_0xebce('0x2f')][_0xebce('0x36')]);_0x18c48b[_0xebce('0x1c')]=qs[_0xebce('0x1c')](_0x3d18f5[_0xebce('0x2f')][_0xebce('0x1c')]);}_0x18c48b[_0xebce('0x37')]=qs[_0xebce('0x38')](_0x3d18f5[_0xebce('0x2f')][_0xebce('0x38')]);_0x18c48b[_0xebce('0x39')]=qs[_0xebce('0x3a')](_['pick'](_0x3d18f5[_0xebce('0x2f')],_0x40cbef['filters']),_0x197e69);if(_0x3d18f5[_0xebce('0x2f')][_0xebce('0x3b')]){_0x18c48b[_0xebce('0x39')]=_[_0xebce('0x3c')](_0x18c48b[_0xebce('0x39')],{'$or':_[_0xebce('0x2a')](_0x197e69,function(_0x240f55){if(_0x240f55[_0xebce('0x2c')]!==_0xebce('0x3d')){var _0x14039a={};_0x14039a[_0x240f55[_0xebce('0x27')]]={'$like':'%'+_0x3d18f5[_0xebce('0x2f')]['filter']+'%'};return _0x14039a;}})});}_0x18c48b=_[_0xebce('0x3c')]({},_0x18c48b,_0x3d18f5[_0xebce('0x3e')]);var _0x3b069e={'where':_0x18c48b[_0xebce('0x39')]};return db[_0xebce('0x3f')][_0xebce('0x1e')](_0x3b069e)[_0xebce('0x23')](function(_0x47cfd3){_0x4eb8ee[_0xebce('0x1e')]=_0x47cfd3;if(_0x3d18f5[_0xebce('0x2f')]['includeAll']){_0x18c48b[_0xebce('0x40')]=[{'all':!![]}];}return db['Team'][_0xebce('0x41')](_0x18c48b);})[_0xebce('0x23')](function(_0x57192b){_0x4eb8ee[_0xebce('0x42')]=_0x57192b;return _0x4eb8ee;})[_0xebce('0x23')](respondWithFilteredResult(_0x4e55bc,_0x18c48b))[_0xebce('0x43')](handleError(_0x4e55bc,null));};exports[_0xebce('0x44')]=function(_0x1d48e8,_0x42aab4){var _0xb6490e={'raw':![],'where':{'id':_0x1d48e8[_0xebce('0x45')]['id']}},_0x16bf4b={};_0x16bf4b[_0xebce('0x2e')]=_[_0xebce('0x30')](db[_0xebce('0x3f')][_0xebce('0x46')]);_0x16bf4b[_0xebce('0x2f')]=_[_0xebce('0x30')](_0x1d48e8['query']);_0x16bf4b[_0xebce('0x3a')]=_[_0xebce('0x31')](_0x16bf4b[_0xebce('0x2e')],_0x16bf4b[_0xebce('0x2f')]);_0xb6490e[_0xebce('0x33')]=_[_0xebce('0x31')](_0x16bf4b['model'],qs[_0xebce('0x32')](_0x1d48e8[_0xebce('0x2f')][_0xebce('0x32')]));_0xb6490e[_0xebce('0x33')]=_0xb6490e['attributes']['length']?_0xb6490e['attributes']:_0x16bf4b[_0xebce('0x2e')];if(_0x1d48e8['query'][_0xebce('0x47')]){_0xb6490e[_0xebce('0x40')]=[{'all':!![]}];}_0xb6490e=_[_0xebce('0x3c')]({},_0xb6490e,_0x1d48e8[_0xebce('0x3e')]);return db[_0xebce('0x3f')]['find'](_0xb6490e)[_0xebce('0x23')](handleEntityNotFound(_0x42aab4,null))[_0xebce('0x23')](respondWithResult(_0x42aab4,null))[_0xebce('0x43')](handleError(_0x42aab4,null));};exports[_0xebce('0x48')]=function(_0x51f896,_0x43c5e2){return db['Team'][_0xebce('0x48')](_0x51f896[_0xebce('0x49')],{})[_0xebce('0x23')](function(_0x4d0600){var _0x1b0740=_0x51f896[_0xebce('0x4a')]['get']({'plain':!![]});if(!_0x1b0740)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1b0740[_0xebce('0x4b')]===_0xebce('0x4a')){var _0x44d802=_0x4d0600[_0xebce('0x4c')]({'plain':!![]});var _0x290fcc=_0xebce('0x4d');return db['UserProfileSection'][_0xebce('0x4e')]({'where':{'name':_0x290fcc,'userProfileId':_0x1b0740[_0xebce('0x4f')]},'raw':!![]})[_0xebce('0x23')](function(_0x376659){if(_0x376659&&_0x376659['autoAssociation']===0x0){return db[_0xebce('0x50')]['create']({'name':_0x44d802['name'],'resourceId':_0x44d802['id'],'type':_0x376659['name'],'sectionId':_0x376659['id']},{})[_0xebce('0x23')](function(){return _0x4d0600;});}else{return _0x4d0600;}})[_0xebce('0x43')](function(_0x44aa3e){logger[_0xebce('0x25')](_0xebce('0x51'),_0x44aa3e);throw _0x44aa3e;});}return _0x4d0600;})[_0xebce('0x23')](respondWithResult(_0x43c5e2,0xc9))[_0xebce('0x43')](handleError(_0x43c5e2,null));};exports[_0xebce('0x22')]=function(_0x4c11bc,_0x2f56ab){if(_0x4c11bc['body']['id']){delete _0x4c11bc['body']['id'];}return db[_0xebce('0x3f')][_0xebce('0x4e')]({'where':{'id':_0x4c11bc[_0xebce('0x45')]['id']}})[_0xebce('0x23')](handleEntityNotFound(_0x2f56ab,null))['then'](saveUpdates(_0x4c11bc[_0xebce('0x49')],null))['then'](respondWithResult(_0x2f56ab,null))['catch'](handleError(_0x2f56ab,null));};exports['destroy']=function(_0x1f40d4,_0x3cf28c){var _0xa48786=_0x1f40d4['params']['id'];var _0x2da844=[];return db[_0xebce('0x52')][_0xebce('0x53')](function(_0x54b99f){var _0x595caa=_0xebce('0x54')+_0xa48786;return db[_0xebce('0x52')][_0xebce('0x2f')](_0x595caa,{'type':db['Sequelize'][_0xebce('0x55')][_0xebce('0x56')],'raw':!![],'transaction':_0x54b99f})[_0xebce('0x23')](function(_0x2683fe){_0x2da844=_[_0xebce('0x2a')](_0x2683fe,function(_0x16a4db){return Number(_0x16a4db[_0xebce('0x57')]);});})['then'](function(){var _0x478301=_0xebce('0x58')+_0xa48786;return db['sequelize'][_0xebce('0x2f')](_0x478301,{'type':db[_0xebce('0x59')][_0xebce('0x55')][_0xebce('0x56')],'raw':!![],'transaction':_0x54b99f});})[_0xebce('0x23')](function(_0xecd27d){var _0x6b1c96=_[_0xebce('0x2a')](_0xecd27d,function(_0x1c25f3){return Number(_0x1c25f3[_0xebce('0x5a')]);});return db[_0xebce('0x5b')][_0xebce('0x5c')]({'where':{'UserId':{'$in':_0x2da844},'VoiceQueueId':{'$in':_0x6b1c96}},'transaction':_0x54b99f});})[_0xebce('0x23')](function(){var _0x4bd7ee=_0xebce('0x5d')+_0xa48786;return db[_0xebce('0x52')]['query'](_0x4bd7ee,{'type':db[_0xebce('0x59')][_0xebce('0x55')][_0xebce('0x56')],'raw':!![],'transaction':_0x54b99f});})[_0xebce('0x23')](function(_0x5493f6){var _0x574dbd=_['map'](_0x5493f6,function(_0x4f1901){return Number(_0x4f1901[_0xebce('0x5e')]);});return db['UserMailQueue'][_0xebce('0x5c')]({'where':{'UserId':{'$in':_0x2da844},'MailQueueId':{'$in':_0x574dbd}},'transaction':_0x54b99f});})[_0xebce('0x23')](function(){var _0x2dbfb0='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0xa48786;return db[_0xebce('0x52')][_0xebce('0x2f')](_0x2dbfb0,{'type':db[_0xebce('0x59')][_0xebce('0x55')]['SELECT'],'raw':!![],'transaction':_0x54b99f});})[_0xebce('0x23')](function(_0x218fcf){var _0x3d40e1=_[_0xebce('0x2a')](_0x218fcf,function(_0x1b99a6){return Number(_0x1b99a6[_0xebce('0x5f')]);});return db[_0xebce('0x60')][_0xebce('0x5c')]({'where':{'UserId':{'$in':_0x2da844},'SmsQueueId':{'$in':_0x3d40e1}},'transaction':_0x54b99f});})['then'](function(){var _0x3eb0aa=_0xebce('0x61')+_0xa48786;return db['sequelize'][_0xebce('0x2f')](_0x3eb0aa,{'type':db[_0xebce('0x59')][_0xebce('0x55')][_0xebce('0x56')],'raw':!![],'transaction':_0x54b99f});})[_0xebce('0x23')](function(_0x229d81){var _0x17f840=_['map'](_0x229d81,function(_0x421723){return Number(_0x421723['ChatQueueId']);});return db[_0xebce('0x62')][_0xebce('0x5c')]({'where':{'UserId':{'$in':_0x2da844},'ChatQueueId':{'$in':_0x17f840}},'transaction':_0x54b99f});})[_0xebce('0x23')](function(){var _0x3c26ce=_0xebce('0x63')+_0xa48786;return db[_0xebce('0x52')][_0xebce('0x2f')](_0x3c26ce,{'type':db[_0xebce('0x59')][_0xebce('0x55')][_0xebce('0x56')],'raw':!![],'transaction':_0x54b99f});})['then'](function(_0x31d5f6){var _0x5d42a8=_[_0xebce('0x2a')](_0x31d5f6,function(_0x4fcd49){return Number(_0x4fcd49['FaxQueueId']);});return db[_0xebce('0x64')][_0xebce('0x5c')]({'where':{'UserId':{'$in':_0x2da844},'FaxQueueId':{'$in':_0x5d42a8}},'transaction':_0x54b99f});})['then'](function(){var _0x340ed9=_0xebce('0x65')+_0xa48786;return db[_0xebce('0x52')]['query'](_0x340ed9,{'type':db['Sequelize'][_0xebce('0x55')][_0xebce('0x56')],'raw':!![],'transaction':_0x54b99f});})[_0xebce('0x23')](function(_0x113b1f){var _0xfb47d7=_['map'](_0x113b1f,function(_0xad24b8){return Number(_0xad24b8['OpenchannelQueueId']);});return db[_0xebce('0x66')]['destroy']({'where':{'UserId':{'$in':_0x2da844},'OpenchannelQueueId':{'$in':_0xfb47d7}},'transaction':_0x54b99f});})[_0xebce('0x23')](function(){var _0x42cc4e=_0xebce('0x67')+_0xa48786;return db[_0xebce('0x52')][_0xebce('0x2f')](_0x42cc4e,{'type':db[_0xebce('0x59')]['QueryTypes'][_0xebce('0x56')],'raw':!![],'transaction':_0x54b99f});})[_0xebce('0x23')](function(_0x77021d){var _0x3293ac=_[_0xebce('0x2a')](_0x77021d,function(_0x14ec5b){return Number(_0x14ec5b['WhatsappQueueId']);});return db[_0xebce('0x68')]['destroy']({'where':{'UserId':{'$in':_0x2da844},'WhatsappQueueId':{'$in':_0x3293ac}},'transaction':_0x54b99f});})[_0xebce('0x23')](function(){return db['TeamVoicePrefix'][_0xebce('0x4e')]({'where':{'TeamId':_0xa48786}});})[_0xebce('0x23')](function(_0x354c13){if(_0x354c13===null){return;}return db['UserVoicePrefix'][_0xebce('0x5c')]({'where':{'UserId':{'$in':_0x2da844},'VoicePrefixId':_0x354c13[_0xebce('0x69')]},'transaction':_0x54b99f});})[_0xebce('0x23')](function(){return db[_0xebce('0x3f')][_0xebce('0x5c')]({'where':{'id':_0xa48786},'cascade':!![],'transaction':_0x54b99f});})[_0xebce('0x23')](function(_0x2784c8){if(_0x2784c8===0x0){_0x3cf28c[_0xebce('0x24')](0x194);}else{return db['UserProfileResource'][_0xebce('0x5c')]({'where':{'type':_0xebce('0x4d'),'resourceId':_0xa48786},'cascade':!![],'transaction':_0x54b99f})[_0xebce('0x23')](function(){_0x3cf28c[_0xebce('0x19')](0xcc)[_0xebce('0x1a')]();});}})[_0xebce('0x43')](function(_0x2e85d1){_0x3cf28c['status'](0x1f4)['send'](_0x2e85d1);});});};exports[_0xebce('0x6a')]=function(_0x5c28c3,_0x38cc0b,_0x46808b){return db[_0xebce('0x3f')]['findOne']({'where':{'id':_0x5c28c3['params']['id']}})['then'](handleEntityNotFound(_0x38cc0b,null))['then'](function(_0x1c6f3c){if(!_0x5c28c3[_0xebce('0x2f')]['channel']||!utils[_0xebce('0x6b')](_0x5c28c3[_0xebce('0x2f')][_0xebce('0x6c')])){throw new db[(_0xebce('0x59'))][(_0xebce('0x6d'))]('Unknown\x20channel');}var _0x23e320={};var _0x300c3b={};_0x300c3b[_0xebce('0x2e')]=_[_0xebce('0x30')](db[_[_0xebce('0x6e')](_0x5c28c3['query']['channel'][_0xebce('0x6f')]())+_0xebce('0x70')][_0xebce('0x46')]);_0x300c3b[_0xebce('0x2f')]=_[_0xebce('0x30')](_0x5c28c3[_0xebce('0x2f')]);_0x300c3b['filters']=_['intersection'](_0x300c3b['model'],_0x300c3b[_0xebce('0x2f')]);_0x23e320[_0xebce('0x33')]=_[_0xebce('0x31')](_0x300c3b[_0xebce('0x2e')],qs['fields'](_0x5c28c3[_0xebce('0x2f')]['fields']));_0x23e320['attributes']=_0x23e320[_0xebce('0x33')][_0xebce('0x34')]?_0x23e320[_0xebce('0x33')]:_0x300c3b[_0xebce('0x2e')];_0x23e320[_0xebce('0x36')]=qs['limit'](_0x5c28c3[_0xebce('0x2f')][_0xebce('0x36')]);_0x23e320[_0xebce('0x1c')]=qs[_0xebce('0x1c')](_0x5c28c3[_0xebce('0x2f')]['offset']);_0x23e320[_0xebce('0x37')]=qs[_0xebce('0x38')](_0x5c28c3[_0xebce('0x2f')][_0xebce('0x38')]);_0x23e320[_0xebce('0x39')]=qs[_0xebce('0x3a')](_[_0xebce('0x71')](_0x5c28c3[_0xebce('0x2f')],_0x300c3b['filters']));_0x23e320=_[_0xebce('0x3c')]({},_0x23e320,_0x5c28c3[_0xebce('0x3e')]);return _0x1c6f3c['get'+_[_0xebce('0x6e')](_0x5c28c3['query'][_0xebce('0x6c')][_0xebce('0x6f')]())+'Queues'](_0x23e320);})[_0xebce('0x23')](respondWithResult(_0x38cc0b,null))[_0xebce('0x43')](handleError(_0x38cc0b,null));};exports[_0xebce('0x72')]=function(_0x485ef5,_0x4fb69b,_0x14033c){return db[_0xebce('0x3f')][_0xebce('0x73')]({'where':{'id':_0x485ef5[_0xebce('0x45')]['id']}})[_0xebce('0x23')](function(_0x328a8a){if(_0x328a8a){if(!_0x485ef5['body'][_0xebce('0x6c')]||!utils[_0xebce('0x6b')](_0x485ef5[_0xebce('0x49')][_0xebce('0x6c')])){throw new db[(_0xebce('0x59'))][(_0xebce('0x6d'))](_0xebce('0x74'));}return _0x328a8a[_0xebce('0x75')+_[_0xebce('0x6e')](_0x485ef5[_0xebce('0x49')]['channel'][_0xebce('0x6f')]())+'Queues'](_0x485ef5[_0xebce('0x49')][_0xebce('0x76')]);}return null;})[_0xebce('0x23')](handleEntityNotFound(_0x4fb69b,null))[_0xebce('0x23')](respondWithStatusCode(_0x4fb69b,null))[_0xebce('0x43')](handleError(_0x4fb69b,null));};exports[_0xebce('0x77')]=function(_0x16f431,_0x3d3415,_0x293a40){return db[_0xebce('0x3f')][_0xebce('0x73')]({'where':{'id':_0x16f431[_0xebce('0x45')]['id']}})[_0xebce('0x23')](function(_0x121eda){if(_0x121eda){if(!_0x16f431[_0xebce('0x2f')]['channel']||!utils[_0xebce('0x6b')](_0x16f431[_0xebce('0x2f')]['channel'])){throw new db[(_0xebce('0x59'))]['ValidationError'](_0xebce('0x74'));}return _0x121eda['remove'+_['capitalize'](_0x16f431[_0xebce('0x2f')]['channel'][_0xebce('0x6f')]())+_0xebce('0x78')](_0x16f431[_0xebce('0x2f')][_0xebce('0x76')]);}return null;})[_0xebce('0x23')](handleEntityNotFound(_0x3d3415,null))[_0xebce('0x23')](respondWithStatusCode(_0x3d3415,null))[_0xebce('0x43')](handleError(_0x3d3415,null));};exports[_0xebce('0x79')]=function(_0x1f9e25,_0x1558a3){var _0x26b1f1=_[_0xebce('0x7a')](_0x1f9e25[_0xebce('0x49')]['ids'])?_0x1f9e25['body']['ids']:[_0x1f9e25[_0xebce('0x49')][_0xebce('0x76')]];var _0xd39ea4=_0x1f9e25[_0xebce('0x45')]['id'];return db['Team'][_0xebce('0x4e')]({'where':{'id':_0xd39ea4}})[_0xebce('0x23')](handleEntityNotFound(_0x1558a3,null))[_0xebce('0x23')](function(_0x4c119a){if(_0x4c119a){var _0x51c0fb=[_0xebce('0x7b'),_0xebce('0x7c'),'Mail',_0xebce('0x7d'),_0xebce('0x7e'),'Openchannel',_0xebce('0x7f')];return db[_0xebce('0x52')][_0xebce('0x53')](function(_0x3f9e9f){var _0x4c8ba8=_['map'](_0x51c0fb,function(_0x54949a){var _0x3c3467={'attributes':['id',_0xebce('0x27')]};if(_0x54949a===_0xebce('0x7b')){_0x3c3467['through']={'attributes':[_0xebce('0x80')]};}return _0x4c119a['get'+_0x54949a+'Queues'](_0x3c3467)[_0xebce('0x23')](function(_0x3694ff){var _0xf4d4b=_[_0xebce('0x2a')](_0x3694ff,function(_0x118451){var _0x53dc7a=_[_0xebce('0x2a')](_0x26b1f1,function(_0x1175af){var _0x1346a3={'where':{'UserId':_0x1175af,[_0x54949a+_0xebce('0x81')]:_0x118451['id']},'transaction':_0x3f9e9f};if(_0x54949a===_0xebce('0x7b')){_0x1346a3[_0xebce('0x15')]={'penalty':_0x118451[_0xebce('0x82')][_0xebce('0x80')]};}return db[_0xebce('0x83')+_0x54949a+_0xebce('0x70')][_0xebce('0x84')](_0x1346a3)[_0xebce('0x23')](function(){socket[_0xebce('0x85')](_0xebce('0x4a')+_0x54949a+_0xebce('0x86'),{'UserId':_0x1175af,[_0x54949a+'QueueId']:_0x118451['id']});if(_0x54949a!==_0xebce('0x7b')){return;}return db[_0xebce('0x83')][_0xebce('0x41')]({'where':{'id':_0x26b1f1,'online':0x1},'attributes':['id','name',_0xebce('0x87'),_0xebce('0x88'),'interface'],'raw':!![]})[_0xebce('0x23')](function(_0x415b87){var _0x519e06=_[_0xebce('0x2a')](_0x415b87,function(_0x3bc442){return db[_0xebce('0x89')][_0xebce('0x8a')]({'membername':_0x3bc442[_0xebce('0x27')],'UserId':_0x3bc442['id'],'queue_name':_0x118451[_0xebce('0x27')],'VoiceQueueId':_0x118451['id'],'interface':_['isNil'](_0x3bc442[_0xebce('0x8b')])?util['format'](_0xebce('0x8c'),_0x3bc442['name']):_0x3bc442[_0xebce('0x8b')],'paused':_0x3bc442[_0xebce('0x88')]||![],'penalty':_0x118451[_0xebce('0x82')][_0xebce('0x80')]},{'transaction':_0x3f9e9f});});return Promise[_0xebce('0x8d')](_0x519e06);});});});return Promise[_0xebce('0x8d')](_0x53dc7a);});return Promise[_0xebce('0x8d')](_0xf4d4b);})[_0xebce('0x23')](function(){return db[_0xebce('0x8e')][_0xebce('0x73')]({'where':{'teamId':_0xd39ea4}})[_0xebce('0x23')](function(_0xda9ef9){if(_0xda9ef9){var _0x4d6c72=_[_0xebce('0x2a')](_0x26b1f1,function(_0x144e90){db[_0xebce('0x8f')][_0xebce('0x8a')]({'UserId':_0x144e90,'VoicePrefixId':_0xda9ef9[_0xebce('0x69')]});});return Promise[_0xebce('0x8d')](_0x4d6c72);}});});});return Promise[_0xebce('0x8d')](_0x4c8ba8)['then'](function(){return _0x4c119a[_0xebce('0x79')](_0x26b1f1,{'transaction':_0x3f9e9f})['spread'](function(_0x3c6556){return _0x3c6556;});});});}})[_0xebce('0x23')](respondWithResult(_0x1558a3,null))[_0xebce('0x43')](handleError(_0x1558a3,null));};exports[_0xebce('0x90')]=function(_0x367320,_0x519d45){var _0x50aff1=_[_0xebce('0x7a')](_0x367320[_0xebce('0x2f')][_0xebce('0x76')])?_0x367320[_0xebce('0x2f')][_0xebce('0x76')]:[_0x367320[_0xebce('0x2f')][_0xebce('0x76')]];var _0x1a25fa=_0x367320[_0xebce('0x45')]['id'];return db[_0xebce('0x3f')][_0xebce('0x4e')]({'where':{'id':_0x1a25fa}})[_0xebce('0x23')](handleEntityNotFound(_0x519d45,null))[_0xebce('0x23')](function(_0x32f5cc){if(_0x32f5cc){var _0x3e18e2=['Voice','Chat',_0xebce('0x91'),_0xebce('0x7d'),_0xebce('0x7e'),_0xebce('0x92'),_0xebce('0x7f')];return db[_0xebce('0x52')]['transaction'](function(_0x4c7343){var _0x8c92fb=_[_0xebce('0x2a')](_0x3e18e2,function(_0x4c3607){var _0x14c7fd={'attributes':['id',_0xebce('0x27')]};return _0x32f5cc[_0xebce('0x4c')+_0x4c3607+_0xebce('0x78')](_0x14c7fd)[_0xebce('0x23')](function(_0x11e17e){var _0x54f689=_['map'](_0x11e17e,function(_0x59a95e){return _0x59a95e[_0xebce('0x90')](_0x50aff1,{'transaction':_0x4c7343})[_0xebce('0x23')](function(){var _0x320a32=_[_0xebce('0x2a')](_0x50aff1,function(_0x87411f){socket[_0xebce('0x85')]('user'+_0x4c3607+'Queue:remove',{'UserId':Number(_0x87411f),[_0x4c3607+_0xebce('0x81')]:_0x59a95e['id']});if(_0x4c3607!==_0xebce('0x7b')){return;}return db[_0xebce('0x89')][_0xebce('0x5c')]({'where':{'VoiceQueueId':_0x59a95e['id'],'UserId':_0x87411f},'transaction':_0x4c7343});});return Promise[_0xebce('0x8d')](_0x320a32);});});return Promise[_0xebce('0x8d')](_0x54f689);});});return Promise[_0xebce('0x8d')](_0x8c92fb)[_0xebce('0x23')](function(){return _0x32f5cc[_0xebce('0x90')](_0x50aff1,{'transaction':_0x4c7343});})[_0xebce('0x23')](function(){return db[_0xebce('0x8e')][_0xebce('0x73')]({'where':{'teamId':_0x1a25fa}})['then'](function(_0x51ee3a){if(_0x51ee3a){var _0xce128d=_[_0xebce('0x2a')](_0x50aff1,function(_0x2e6474){db['UserVoicePrefix'][_0xebce('0x5c')]({'where':{'UserId':_0x2e6474,'VoicePrefixId':_0x51ee3a[_0xebce('0x69')]}});});return Promise[_0xebce('0x8d')](_0xce128d);}});});});}})[_0xebce('0x23')](respondWithStatusCode(_0x519d45,null))[_0xebce('0x43')](handleError(_0x519d45,null));};exports[_0xebce('0x93')]=function(_0x412571,_0x3cc5d2,_0x2444bd){var _0x3a3960={};var _0x283eb2={};var _0x17b8d2;var _0x51adb3;return db[_0xebce('0x3f')][_0xebce('0x73')]({'where':{'id':_0x412571[_0xebce('0x45')]['id']}})[_0xebce('0x23')](handleEntityNotFound(_0x3cc5d2,null))[_0xebce('0x23')](function(_0x31888d){if(_0x31888d){_0x17b8d2=_0x31888d;_0x283eb2['model']=_[_0xebce('0x30')](db[_0xebce('0x83')][_0xebce('0x46')]);_0x283eb2[_0xebce('0x2f')]=_['keys'](_0x412571[_0xebce('0x2f')]);_0x283eb2[_0xebce('0x3a')]=_[_0xebce('0x31')](_0x283eb2[_0xebce('0x2e')],_0x283eb2[_0xebce('0x2f')]);_0x3a3960[_0xebce('0x33')]=_['intersection'](_0x283eb2[_0xebce('0x2e')],qs[_0xebce('0x32')](_0x412571[_0xebce('0x2f')][_0xebce('0x32')]));_0x3a3960[_0xebce('0x33')]=_0x3a3960[_0xebce('0x33')]['length']?_0x3a3960[_0xebce('0x33')]:_0x283eb2[_0xebce('0x2e')];_0x3a3960[_0xebce('0x37')]=qs[_0xebce('0x38')](_0x412571['query'][_0xebce('0x38')]);_0x3a3960[_0xebce('0x39')]=qs[_0xebce('0x3a')](_[_0xebce('0x71')](_0x412571[_0xebce('0x2f')],_0x283eb2[_0xebce('0x3a')]));if(_0x412571[_0xebce('0x2f')][_0xebce('0x3b')]){_0x3a3960['where']=_['merge'](_0x3a3960['where'],{'$or':_[_0xebce('0x2a')](_0x3a3960[_0xebce('0x33')],function(_0x1b6a94){var _0x25cbe8={};_0x25cbe8[_0x1b6a94]={'$like':'%'+_0x412571[_0xebce('0x2f')][_0xebce('0x3b')]+'%'};return _0x25cbe8;})});}_0x3a3960=_['merge']({},_0x3a3960,_0x412571[_0xebce('0x3e')]);return _0x17b8d2[_0xebce('0x93')](_0x3a3960);}})[_0xebce('0x23')](function(_0x44d8b2){if(_0x44d8b2){_0x51adb3=_0x44d8b2[_0xebce('0x34')];if(!_0x412571[_0xebce('0x2f')]['hasOwnProperty'](_0xebce('0x35'))){_0x3a3960['limit']=qs[_0xebce('0x36')](_0x412571[_0xebce('0x2f')][_0xebce('0x36')]);_0x3a3960['offset']=qs['offset'](_0x412571[_0xebce('0x2f')][_0xebce('0x1c')]);}return _0x17b8d2[_0xebce('0x93')](_0x3a3960);}})[_0xebce('0x23')](function(_0x2c2309){if(_0x2c2309){return _0x2c2309?{'count':_0x51adb3,'rows':_0x2c2309}:null;}})[_0xebce('0x23')](respondWithResult(_0x3cc5d2,null))[_0xebce('0x43')](handleError(_0x3cc5d2,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index e7a2b83..e51b35e 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 _0x23fe=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x2dd382,_0x2838c6){var _0x28796f=function(_0x436be6){while(--_0x436be6){_0x2dd382['push'](_0x2dd382['shift']());}};_0x28796f(++_0x2838c6);}(_0x23fe,0x8a));var _0xe23f=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0x23fe[_0x3c4737];return _0x2bb926;};'use strict';var EventEmitter=require('events');var Team=require(_0xe23f('0x0'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0xe23f('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xe23f('0x2')};function emitEvent(_0x1970e1){return function(_0x370b40,_0x96ca3c,_0x414eb5){TeamEvents[_0xe23f('0x3')](_0x1970e1+':'+_0x370b40['id'],_0x370b40);TeamEvents[_0xe23f('0x3')](_0x1970e1,_0x370b40);_0x414eb5(null);};}for(var e in events){if(events[_0xe23f('0x4')](e)){var event=events[e];Team[_0xe23f('0x5')](e,emitEvent(event));}}module[_0xe23f('0x6')]=TeamEvents; \ No newline at end of file +var _0xf3f7=['save','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','Team'];(function(_0x528575,_0x2e067d){var _0x3063b7=function(_0x1ee183){while(--_0x1ee183){_0x528575['push'](_0x528575['shift']());}};_0x3063b7(++_0x2e067d);}(_0xf3f7,0x19e));var _0x7f3f=function(_0x1b173a,_0x2ff8fa){_0x1b173a=_0x1b173a-0x0;var _0x582217=_0xf3f7[_0x1b173a];return _0x582217;};'use strict';var EventEmitter=require('events');var Team=require(_0x7f3f('0x0'))['db'][_0x7f3f('0x1')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7f3f('0x2'),'afterUpdate':'update','afterDestroy':_0x7f3f('0x3')};function emitEvent(_0x6daef3){return function(_0x2a60dd,_0x5ec53d,_0x34c3fd){TeamEvents['emit'](_0x6daef3+':'+_0x2a60dd['id'],_0x2a60dd);TeamEvents[_0x7f3f('0x4')](_0x6daef3,_0x2a60dd);_0x34c3fd(null);};}for(var e in events){if(events[_0x7f3f('0x5')](e)){var event=events[e];Team[_0x7f3f('0x6')](e,emitEvent(event));}}module[_0x7f3f('0x7')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 953acd1..742915a 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 _0x0a91=['Whatsapp','map','all','catch','lodash','./team.attributes','Queues','then','setDataValue','channel','exports','define','Team','teams','Chat','Fax','Mail','Sms','Voice'];(function(_0x304be3,_0x4f9b4a){var _0x1212e9=function(_0x22f7d1){while(--_0x22f7d1){_0x304be3['push'](_0x304be3['shift']());}};_0x1212e9(++_0x4f9b4a);}(_0x0a91,0x121));var _0x10a9=function(_0x374dd6,_0xadc0eb){_0x374dd6=_0x374dd6-0x0;var _0x1aadd0=_0x0a91[_0x374dd6];return _0x1aadd0;};'use strict';var _=require(_0x10a9('0x0'));var attributes=require(_0x10a9('0x1'));function getQueuesByChannel(_0x152722,_0x2d7377){var _0x493322='get'+_0x2d7377+_0x10a9('0x2');return _0x152722[_0x493322]()[_0x10a9('0x3')](function(_0x3f9e39){return _['map'](_0x3f9e39,function(_0xfd7602){_0xfd7602[_0x10a9('0x4')](_0x10a9('0x5'),_0x2d7377);return _0xfd7602;});})['catch'](function(_0x2912e8){throw _0x2912e8;});}module[_0x10a9('0x6')]=function(_0x2ecb1b){return _0x2ecb1b[_0x10a9('0x7')](_0x10a9('0x8'),attributes,{'tableName':_0x10a9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x40a0a6=this;var _0x2d96ca=[_0x10a9('0xa'),_0x10a9('0xb'),_0x10a9('0xc'),'Openchannel',_0x10a9('0xd'),_0x10a9('0xe'),_0x10a9('0xf')];return Promise['resolve']()[_0x10a9('0x3')](function(){var _0x4375b5=_[_0x10a9('0x10')](_0x2d96ca,function(_0x37bced){return getQueuesByChannel(_0x40a0a6,_0x37bced);});return Promise[_0x10a9('0x11')](_0x4375b5);})[_0x10a9('0x12')](function(_0x4bead8){throw _0x4bead8;});}}});}; \ No newline at end of file +var _0xe569=['Voice','Whatsapp','resolve','map','all','./team.attributes','get','Queues','then','setDataValue','channel','exports','define','Team','teams','Chat','Mail','Openchannel'];(function(_0x5a8600,_0x277861){var _0x5ab160=function(_0x1c3269){while(--_0x1c3269){_0x5a8600['push'](_0x5a8600['shift']());}};_0x5ab160(++_0x277861);}(_0xe569,0x149));var _0x9e56=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0xe569[_0x1ae5ab];return _0x1ce001;};'use strict';var _=require('lodash');var attributes=require(_0x9e56('0x0'));function getQueuesByChannel(_0x3dfd41,_0x31c452){var _0x3bf55a=_0x9e56('0x1')+_0x31c452+_0x9e56('0x2');return _0x3dfd41[_0x3bf55a]()[_0x9e56('0x3')](function(_0x2bd0f6){return _['map'](_0x2bd0f6,function(_0x1f890a){_0x1f890a[_0x9e56('0x4')](_0x9e56('0x5'),_0x31c452);return _0x1f890a;});})['catch'](function(_0x3efb19){throw _0x3efb19;});}module[_0x9e56('0x6')]=function(_0x410d78){return _0x410d78[_0x9e56('0x7')](_0x9e56('0x8'),attributes,{'tableName':_0x9e56('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x37d2f2=this;var _0x36ca0e=[_0x9e56('0xa'),'Fax',_0x9e56('0xb'),_0x9e56('0xc'),'Sms',_0x9e56('0xd'),_0x9e56('0xe')];return Promise[_0x9e56('0xf')]()['then'](function(){var _0x25c86e=_[_0x9e56('0x10')](_0x36ca0e,function(_0x507e50){return getQueuesByChannel(_0x37d2f2,_0x507e50);});return Promise[_0x9e56('0x11')](_0x25c86e);})['catch'](function(_0x2d6b97){throw _0x2d6b97;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index f9cca46..0483083 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 _0xc550=['rpc','client','http','redis','socket.io-emitter','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger'];(function(_0x8234d1,_0xf651d4){var _0x2990fe=function(_0x21f36b){while(--_0x21f36b){_0x8234d1['push'](_0x8234d1['shift']());}};_0x2990fe(++_0xf651d4);}(_0xc550,0x1f2));var _0x0c55=function(_0x891c55,_0x233fe8){_0x891c55=_0x891c55-0x0;var _0x260823=_0xc550[_0x891c55];return _0x260823;};'use strict';var _=require(_0x0c55('0x0'));var util=require(_0x0c55('0x1'));var moment=require(_0x0c55('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0c55('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0c55('0x4'));var logger=require(_0x0c55('0x5'))(_0x0c55('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0c55('0x7')][_0x0c55('0x8')]({'port':0x232a});config[_0x0c55('0x9')]=_['defaults'](config[_0x0c55('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x0c55('0xa'))(new Redis(config['redis']));require(_0x0c55('0xb'))[_0x0c55('0xc')](socket);function respondWithRpcPromise(_0x2fc55e,_0x301fdb,_0x5125c5){return new BPromise(function(_0x217104,_0x42237e){return client[_0x0c55('0xd')](_0x2fc55e,_0x5125c5)[_0x0c55('0xe')](function(_0x42db6a){logger[_0x0c55('0xf')](_0x0c55('0x10'),_0x301fdb,_0x0c55('0x11'));logger['debug'](_0x0c55('0x12'),_0x301fdb,_0x0c55('0x11'),JSON[_0x0c55('0x13')](_0x42db6a));if(_0x42db6a[_0x0c55('0x14')]){if(_0x42db6a[_0x0c55('0x14')]['code']===0x1f4){logger[_0x0c55('0x14')]('Team,\x20%s,\x20%s',_0x301fdb,_0x42db6a[_0x0c55('0x14')][_0x0c55('0x15')]);return _0x42237e(_0x42db6a[_0x0c55('0x14')][_0x0c55('0x15')]);}logger['error']('Team,\x20%s,\x20%s',_0x301fdb,_0x42db6a[_0x0c55('0x14')][_0x0c55('0x15')]);return _0x217104(_0x42db6a[_0x0c55('0x14')][_0x0c55('0x15')]);}else{logger[_0x0c55('0xf')](_0x0c55('0x10'),_0x301fdb,'request\x20sent');_0x217104(_0x42db6a[_0x0c55('0x16')][_0x0c55('0x15')]);}})[_0x0c55('0x17')](function(_0x2ea72e){logger[_0x0c55('0x14')](_0x0c55('0x10'),_0x301fdb,_0x2ea72e);_0x42237e(_0x2ea72e);});});} \ No newline at end of file +var _0x68c3=['http','defaults','redis','localhost','socket.io-emitter','./team.socket','register','info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x68c3,0x1db));var _0x368c=function(_0x1a4c39,_0x13aade){_0x1a4c39=_0x1a4c39-0x0;var _0x55b641=_0x68c3[_0x1a4c39];return _0x55b641;};'use strict';var _=require(_0x368c('0x0'));var util=require(_0x368c('0x1'));var moment=require(_0x368c('0x2'));var BPromise=require(_0x368c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x368c('0x4'));var db=require(_0x368c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x368c('0x6'))(_0x368c('0x7'));var config=require(_0x368c('0x8'));var jayson=require(_0x368c('0x9'));var client=jayson[_0x368c('0xa')][_0x368c('0xb')]({'port':0x232a});config['redis']=_[_0x368c('0xc')](config[_0x368c('0xd')],{'host':_0x368c('0xe'),'port':0x18eb});var socket=require(_0x368c('0xf'))(new Redis(config[_0x368c('0xd')]));require(_0x368c('0x10'))[_0x368c('0x11')](socket);function respondWithRpcPromise(_0x48593d,_0x2f217d,_0xe5762e){return new BPromise(function(_0x471b94,_0x215bd){return client['request'](_0x48593d,_0xe5762e)['then'](function(_0x1e429d){logger[_0x368c('0x12')]('Team,\x20%s,\x20%s',_0x2f217d,_0x368c('0x13'));logger[_0x368c('0x14')](_0x368c('0x15'),_0x2f217d,_0x368c('0x13'),JSON['stringify'](_0x1e429d));if(_0x1e429d[_0x368c('0x16')]){if(_0x1e429d['error'][_0x368c('0x17')]===0x1f4){logger[_0x368c('0x16')]('Team,\x20%s,\x20%s',_0x2f217d,_0x1e429d[_0x368c('0x16')]['message']);return _0x215bd(_0x1e429d['error'][_0x368c('0x18')]);}logger['error']('Team,\x20%s,\x20%s',_0x2f217d,_0x1e429d['error'][_0x368c('0x18')]);return _0x471b94(_0x1e429d[_0x368c('0x16')]['message']);}else{logger[_0x368c('0x12')]('Team,\x20%s,\x20%s',_0x2f217d,_0x368c('0x13'));_0x471b94(_0x1e429d[_0x368c('0x19')][_0x368c('0x18')]);}})[_0x368c('0x1a')](function(_0x191a6a){logger['error']('Team,\x20%s,\x20%s',_0x2f217d,_0x191a6a);_0x215bd(_0x191a6a);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index ef36e1c..2f9f90e 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 _0x0d90=['save','remove','removeListener','register','length','team:','./team.events'];(function(_0x1b3842,_0x2f9397){var _0x2edd58=function(_0x346cf2){while(--_0x346cf2){_0x1b3842['push'](_0x1b3842['shift']());}};_0x2edd58(++_0x2f9397);}(_0x0d90,0xa0));var _0x00d9=function(_0x58ccb9,_0x316ab8){_0x58ccb9=_0x58ccb9-0x0;var _0x404e2c=_0x0d90[_0x58ccb9];return _0x404e2c;};'use strict';var TeamEvents=require(_0x00d9('0x0'));var events=[_0x00d9('0x1'),_0x00d9('0x2'),'update'];function createListener(_0x333681,_0x253fa8){return function(_0x123347){_0x253fa8['emit'](_0x333681,_0x123347);};}function removeListener(_0x277043,_0x3e06af){return function(){TeamEvents[_0x00d9('0x3')](_0x277043,_0x3e06af);};}exports[_0x00d9('0x4')]=function(_0xf76e6a){for(var _0x5768fb=0x0,_0x39b71b=events[_0x00d9('0x5')];_0x5768fb<_0x39b71b;_0x5768fb++){var _0x3935cd=events[_0x5768fb];var _0x5cedd0=createListener(_0x00d9('0x6')+_0x3935cd,_0xf76e6a);TeamEvents['on'](_0x3935cd,_0x5cedd0);}}; \ No newline at end of file +var _0x5a1c=['save','emit','register','length','team:','./team.events'];(function(_0x422524,_0x1c4311){var _0x450526=function(_0x4d897e){while(--_0x4d897e){_0x422524['push'](_0x422524['shift']());}};_0x450526(++_0x1c4311);}(_0x5a1c,0x1b5));var _0xc5a1=function(_0xa58a3e,_0x115109){_0xa58a3e=_0xa58a3e-0x0;var _0x4f6cd2=_0x5a1c[_0xa58a3e];return _0x4f6cd2;};'use strict';var TeamEvents=require(_0xc5a1('0x0'));var events=[_0xc5a1('0x1'),'remove','update'];function createListener(_0x196f8b,_0x4b9c2c){return function(_0x1d1f86){_0x4b9c2c[_0xc5a1('0x2')](_0x196f8b,_0x1d1f86);};}function removeListener(_0x71fc1,_0x5c3f2d){return function(){TeamEvents['removeListener'](_0x71fc1,_0x5c3f2d);};}exports[_0xc5a1('0x3')]=function(_0x3d356e){for(var _0x1ed54a=0x0,_0x5782b9=events[_0xc5a1('0x4')];_0x1ed54a<_0x5782b9;_0x1ed54a++){var _0x159ed5=events[_0x1ed54a];var _0x1ce1df=createListener(_0xc5a1('0x5')+_0x159ed5,_0x3d356e);TeamEvents['on'](_0x159ed5,_0x1ce1df);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 45f90cd..d52ce02 100644 --- a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js +++ b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1703=['exports','INTEGER'];(function(_0x1e08ee,_0x85586a){var _0x356a3f=function(_0x272350){while(--_0x272350){_0x1e08ee['push'](_0x1e08ee['shift']());}};_0x356a3f(++_0x85586a);}(_0x1703,0x16a));var _0x3170=function(_0x377466,_0x40a2e6){_0x377466=_0x377466-0x0;var _0x4bf5eb=_0x1703[_0x377466];return _0x4bf5eb;};'use strict';var Sequelize=require('sequelize');module[_0x3170('0x0')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x3170('0x1')]}}; \ No newline at end of file +var _0x643f=['exports'];(function(_0x2e6e9c,_0x3f6a11){var _0xac3b79=function(_0x2e922e){while(--_0x2e922e){_0x2e6e9c['push'](_0x2e6e9c['shift']());}};_0xac3b79(++_0x3f6a11);}(_0x643f,0x1e6));var _0xf643=function(_0x20ef42,_0x511459){_0x20ef42=_0x20ef42-0x0;var _0x509694=_0x643f[_0x20ef42];return _0x509694;};'use strict';var Sequelize=require('sequelize');module[_0xf643('0x0')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index aaf683b..3accc3d 100644 --- a/server/api/teamVoicePrefix/teamVoicePrefix.model.js +++ b/server/api/teamVoicePrefix/teamVoicePrefix.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa5dd=['./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x20eef2,_0x17d4ac){var _0x40e1b3=function(_0x707c04){while(--_0x707c04){_0x20eef2['push'](_0x20eef2['shift']());}};_0x40e1b3(++_0x17d4ac);}(_0xa5dd,0x101));var _0xda5d=function(_0x43ba31,_0xe5419e){_0x43ba31=_0x43ba31-0x0;var _0x5d38e1=_0xa5dd[_0x43ba31];return _0x5d38e1;};'use strict';var _=require(_0xda5d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xda5d('0x1'));var moment=require(_0xda5d('0x2'));var BPromise=require(_0xda5d('0x3'));var rp=require(_0xda5d('0x4'));var fs=require('fs');var path=require(_0xda5d('0x5'));var rimraf=require('rimraf');var config=require(_0xda5d('0x6'));var attributes=require(_0xda5d('0x7'));module[_0xda5d('0x8')]=function(_0x5a437a,_0x555107){return _0x5a437a[_0xda5d('0x9')](_0xda5d('0xa'),attributes,{'tableName':_0xda5d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x065e=['moment','bluebird','request-promise','../../config/environment','./teamVoicePrefix.attributes','define','team_has_voice_prefixes','lodash'];(function(_0x43a62a,_0x3e8935){var _0x3c5d0b=function(_0x5e3815){while(--_0x5e3815){_0x43a62a['push'](_0x43a62a['shift']());}};_0x3c5d0b(++_0x3e8935);}(_0x065e,0x1a7));var _0xe065=function(_0x1184e6,_0x567817){_0x1184e6=_0x1184e6-0x0;var _0x52052d=_0x065e[_0x1184e6];return _0x52052d;};'use strict';var _=require(_0xe065('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xe065('0x1'));var BPromise=require(_0xe065('0x2'));var rp=require(_0xe065('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe065('0x4'));var attributes=require(_0xe065('0x5'));module['exports']=function(_0x10b45f,_0x1e7e69){return _0x10b45f[_0xe065('0x6')]('TeamVoicePrefix',attributes,{'tableName':_0xe065('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 0ffdbbb..c06e1cb 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x364d29,_0x3535e8){var _0xe49f82=function(_0x1b2472){while(--_0x1b2472){_0x364d29['push'](_0x364d29['shift']());}};_0xe49f82(++_0x3535e8);}(_0xe706,0xa3));var _0x6e70=function(_0x14a34a,_0x424129){_0x14a34a=_0x14a34a-0x0;var _0x4d921e=_0xe706[_0x14a34a];return _0x4d921e;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x41137f,_0x59cf71){var _0x152edc=function(_0xddb05c){while(--_0xddb05c){_0x41137f['push'](_0x41137f['shift']());}};_0x152edc(++_0x59cf71);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 0ffd876..7811e1d 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 _0x7758=['exports','INTEGER','sequelize'];(function(_0x17a1e3,_0x31c5ac){var _0x4b5e0c=function(_0x558dc1){while(--_0x558dc1){_0x17a1e3['push'](_0x17a1e3['shift']());}};_0x4b5e0c(++_0x31c5ac);}(_0x7758,0xc2));var _0x8775=function(_0x485383,_0x1a5e7e){_0x485383=_0x485383-0x0;var _0x496680=_0x7758[_0x485383];return _0x496680;};'use strict';var Sequelize=require(_0x8775('0x0'));module[_0x8775('0x1')]={'penalty':{'type':Sequelize[_0x8775('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xebba=['sequelize','exports'];(function(_0x31990f,_0x531d99){var _0x3b1368=function(_0x25e875){while(--_0x25e875){_0x31990f['push'](_0x31990f['shift']());}};_0x3b1368(++_0x531d99);}(_0xebba,0x14e));var _0xaebb=function(_0x22d663,_0x98ae13){_0x22d663=_0x22d663-0x0;var _0x4e9227=_0xebba[_0x22d663];return _0x4e9227;};'use strict';var Sequelize=require(_0xaebb('0x0'));module[_0xaebb('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'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 2b8978f..b6cf979 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 _0x9b2a=['path','./teamVoiceQueue.attributes','exports','TeamVoiceQueue','team_has_voice_queues','lodash','../../config/logger','api','moment','request-promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9b2a,0x127));var _0xa9b2=function(_0x169503,_0x222654){_0x169503=_0x169503-0x0;var _0x3f8893=_0x9b2a[_0x169503];return _0x3f8893;};'use strict';var _=require(_0xa9b2('0x0'));var util=require('util');var logger=require(_0xa9b2('0x1'))(_0xa9b2('0x2'));var moment=require(_0xa9b2('0x3'));var BPromise=require('bluebird');var rp=require(_0xa9b2('0x4'));var fs=require('fs');var path=require(_0xa9b2('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa9b2('0x6'));module[_0xa9b2('0x7')]=function(_0x181a8f,_0xd7801e){return _0x181a8f['define'](_0xa9b2('0x8'),attributes,{'tableName':_0xa9b2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb3ea=['../../config/environment','./teamVoiceQueue.attributes','exports','define','team_has_voice_queues','lodash','util','../../config/logger','moment','request-promise','rimraf'];(function(_0x49cac1,_0x52dc7f){var _0x1f9987=function(_0x4153b5){while(--_0x4153b5){_0x49cac1['push'](_0x49cac1['shift']());}};_0x1f9987(++_0x52dc7f);}(_0xb3ea,0x10d));var _0xab3e=function(_0x13545c,_0x1e11c8){_0x13545c=_0x13545c-0x0;var _0x30176e=_0xb3ea[_0x13545c];return _0x30176e;};'use strict';var _=require(_0xab3e('0x0'));var util=require(_0xab3e('0x1'));var logger=require(_0xab3e('0x2'))('api');var moment=require(_0xab3e('0x3'));var BPromise=require('bluebird');var rp=require(_0xab3e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xab3e('0x5'));var config=require(_0xab3e('0x6'));var attributes=require(_0xab3e('0x7'));module[_0xab3e('0x8')]=function(_0x135941,_0x570744){return _0x135941[_0xab3e('0x9')]('TeamVoiceQueue',attributes,{'tableName':_0xab3e('0xa'),'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 328d9f4..95a8398 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 _0x76bc=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','TeamVoiceQueue,\x20%s,\x20%s','message','result','lodash'];(function(_0x3e0b24,_0x91f3d){var _0x93584e=function(_0x49ed36){while(--_0x49ed36){_0x3e0b24['push'](_0x3e0b24['shift']());}};_0x93584e(++_0x91f3d);}(_0x76bc,0x17f));var _0xc76b=function(_0x4b26b5,_0x4f71fd){_0x4b26b5=_0x4b26b5-0x0;var _0x4dec71=_0x76bc[_0x4b26b5];return _0x4dec71;};'use strict';var _=require(_0xc76b('0x0'));var util=require(_0xc76b('0x1'));var moment=require(_0xc76b('0x2'));var BPromise=require(_0xc76b('0x3'));var rs=require(_0xc76b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc76b('0x5'));var logger=require(_0xc76b('0x6'))(_0xc76b('0x7'));var config=require(_0xc76b('0x8'));var jayson=require(_0xc76b('0x9'));var client=jayson[_0xc76b('0xa')][_0xc76b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2cbe53,_0x110f3b,_0x1cb174){return new BPromise(function(_0x235ff3,_0xaf195c){return client[_0xc76b('0xc')](_0x2cbe53,_0x1cb174)[_0xc76b('0xd')](function(_0x2803e9){logger[_0xc76b('0xe')]('TeamVoiceQueue,\x20%s,\x20%s',_0x110f3b,_0xc76b('0xf'));logger[_0xc76b('0x10')](_0xc76b('0x11'),_0x110f3b,_0xc76b('0xf'),JSON[_0xc76b('0x12')](_0x2803e9));if(_0x2803e9[_0xc76b('0x13')]){if(_0x2803e9['error'][_0xc76b('0x14')]===0x1f4){logger[_0xc76b('0x13')](_0xc76b('0x15'),_0x110f3b,_0x2803e9[_0xc76b('0x13')][_0xc76b('0x16')]);return _0xaf195c(_0x2803e9[_0xc76b('0x13')][_0xc76b('0x16')]);}logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x110f3b,_0x2803e9[_0xc76b('0x13')][_0xc76b('0x16')]);return _0x235ff3(_0x2803e9[_0xc76b('0x13')][_0xc76b('0x16')]);}else{logger[_0xc76b('0xe')]('TeamVoiceQueue,\x20%s,\x20%s',_0x110f3b,_0xc76b('0xf'));_0x235ff3(_0x2803e9[_0xc76b('0x17')][_0xc76b('0x16')]);}})['catch'](function(_0x4e759e){logger[_0xc76b('0x13')](_0xc76b('0x15'),_0x110f3b,_0x4e759e);_0xaf195c(_0x4e759e);});});} \ No newline at end of file +var _0x9428=['TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x19b1b4,_0x245bb5){var _0x456196=function(_0x4d726c){while(--_0x4d726c){_0x19b1b4['push'](_0x19b1b4['shift']());}};_0x456196(++_0x245bb5);}(_0x9428,0xa5));var _0x8942=function(_0x4b12ae,_0xf2b3b){_0x4b12ae=_0x4b12ae-0x0;var _0x16957b=_0x9428[_0x4b12ae];return _0x16957b;};'use strict';var _=require(_0x8942('0x0'));var util=require(_0x8942('0x1'));var moment=require(_0x8942('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8942('0x3'))['db'];var utils=require(_0x8942('0x4'));var logger=require('../../config/logger')(_0x8942('0x5'));var config=require(_0x8942('0x6'));var jayson=require(_0x8942('0x7'));var client=jayson[_0x8942('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b3880,_0x33bb4f,_0x22fc26){return new BPromise(function(_0x4a3651,_0x58d649){return client[_0x8942('0x9')](_0x1b3880,_0x22fc26)[_0x8942('0xa')](function(_0x29a04e){logger['info'](_0x8942('0xb'),_0x33bb4f,_0x8942('0xc'));logger[_0x8942('0xd')](_0x8942('0xe'),_0x33bb4f,_0x8942('0xc'),JSON[_0x8942('0xf')](_0x29a04e));if(_0x29a04e[_0x8942('0x10')]){if(_0x29a04e[_0x8942('0x10')][_0x8942('0x11')]===0x1f4){logger[_0x8942('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x33bb4f,_0x29a04e[_0x8942('0x10')][_0x8942('0x12')]);return _0x58d649(_0x29a04e[_0x8942('0x10')][_0x8942('0x12')]);}logger[_0x8942('0x10')](_0x8942('0xb'),_0x33bb4f,_0x29a04e[_0x8942('0x10')][_0x8942('0x12')]);return _0x4a3651(_0x29a04e[_0x8942('0x10')][_0x8942('0x12')]);}else{logger[_0x8942('0x13')](_0x8942('0xb'),_0x33bb4f,_0x8942('0xc'));_0x4a3651(_0x29a04e[_0x8942('0x14')]['message']);}})[_0x8942('0x15')](function(_0x5ee430){logger[_0x8942('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x33bb4f,_0x5ee430);_0x58d649(_0x5ee430);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 3041b1d..e8b7010 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 _0xa35e=['../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','show','post','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x4e9df7,_0x835b62){var _0x585ef1=function(_0x26f9ca){while(--_0x26f9ca){_0x4e9df7['push'](_0x4e9df7['shift']());}};_0x585ef1(++_0x835b62);}(_0xa35e,0x111));var _0xea35=function(_0x1e7e0f,_0x25835a){_0x1e7e0f=_0x1e7e0f-0x0;var _0x112df8=_0xa35e[_0x1e7e0f];return _0x112df8;};'use strict';var multer=require(_0xea35('0x0'));var util=require('util');var path=require(_0xea35('0x1'));var timeout=require(_0xea35('0x2'));var express=require(_0xea35('0x3'));var router=express[_0xea35('0x4')]();var fs_extra=require(_0xea35('0x5'));var auth=require(_0xea35('0x6'));var interaction=require(_0xea35('0x7'));var config=require(_0xea35('0x8'));var controller=require(_0xea35('0x9'));router[_0xea35('0xa')]('/',auth[_0xea35('0xb')](),controller[_0xea35('0xc')]);router[_0xea35('0xa')](_0xea35('0xd'),auth['isAuthenticated'](),controller[_0xea35('0xe')]);router[_0xea35('0xf')]('/',auth[_0xea35('0xb')](),controller['create']);router[_0xea35('0x10')](_0xea35('0xd'),auth[_0xea35('0xb')](),controller['update']);router[_0xea35('0x11')](_0xea35('0xd'),auth[_0xea35('0xb')](),controller[_0xea35('0x12')]);module[_0xea35('0x13')]=router; \ No newline at end of file +var _0xd4ad=['isAuthenticated','get','/:id','show','create','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./template.controller'];(function(_0xd5fb24,_0x577953){var _0x59ad67=function(_0x4a86bf){while(--_0x4a86bf){_0xd5fb24['push'](_0xd5fb24['shift']());}};_0x59ad67(++_0x577953);}(_0xd4ad,0x158));var _0xdd4a=function(_0x2aa9a7,_0x5a32ea){_0x2aa9a7=_0x2aa9a7-0x0;var _0x3c99c0=_0xd4ad[_0x2aa9a7];return _0x3c99c0;};'use strict';var multer=require(_0xdd4a('0x0'));var util=require(_0xdd4a('0x1'));var path=require(_0xdd4a('0x2'));var timeout=require(_0xdd4a('0x3'));var express=require('express');var router=express[_0xdd4a('0x4')]();var fs_extra=require(_0xdd4a('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdd4a('0x6'));var controller=require(_0xdd4a('0x7'));router['get']('/',auth[_0xdd4a('0x8')](),controller['index']);router[_0xdd4a('0x9')](_0xdd4a('0xa'),auth['isAuthenticated'](),controller[_0xdd4a('0xb')]);router['post']('/',auth[_0xdd4a('0x8')](),controller[_0xdd4a('0xc')]);router[_0xdd4a('0xd')](_0xdd4a('0xa'),auth[_0xdd4a('0x8')](),controller[_0xdd4a('0xe')]);router['delete']('/:id',auth[_0xdd4a('0x8')](),controller['destroy']);module[_0xdd4a('0xf')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index e8ae2b3..a5ef591 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 _0xcd00=['STRING','sequelize'];(function(_0x3c1e0a,_0x428fc9){var _0xd7a87d=function(_0x478835){while(--_0x478835){_0x3c1e0a['push'](_0x3c1e0a['shift']());}};_0xd7a87d(++_0x428fc9);}(_0xcd00,0x1c3));var _0x0cd0=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xcd00[_0xa148b7];return _0x51efd3;};'use strict';var Sequelize=require(_0x0cd0('0x0'));module['exports']={'name':{'type':Sequelize[_0x0cd0('0x1')]},'description':{'type':Sequelize[_0x0cd0('0x1')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xb12e=['exports','STRING','TEXT'];(function(_0x4cebf3,_0x2d3fd1){var _0x51a440=function(_0x513e8c){while(--_0x513e8c){_0x4cebf3['push'](_0x4cebf3['shift']());}};_0x51a440(++_0x2d3fd1);}(_0xb12e,0xb7));var _0xeb12=function(_0x2a5c60,_0xac1569){_0x2a5c60=_0x2a5c60-0x0;var _0xe2e9a2=_0xb12e[_0x2a5c60];return _0xe2e9a2;};'use strict';var Sequelize=require('sequelize');module[_0xeb12('0x0')]={'name':{'type':Sequelize[_0xeb12('0x1')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0xeb12('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index f7e1478..407ddfe 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 _0x5686=['userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','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','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','Templates','sendStatus','error','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','Template','include','findAll','rows','catch','show','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection'];(function(_0x1ad93b,_0x56bee2){var _0x5c83a3=function(_0x425765){while(--_0x425765){_0x1ad93b['push'](_0x1ad93b['shift']());}};_0x5c83a3(++_0x56bee2);}(_0x5686,0x16d));var _0x6568=function(_0x43e97d,_0x56a06b){_0x43e97d=_0x43e97d-0x0;var _0x424cd9=_0x5686[_0x43e97d];return _0x424cd9;};'use strict';var emlformat=require(_0x6568('0x0'));var rimraf=require(_0x6568('0x1'));var zipdir=require(_0x6568('0x2'));var jsonpatch=require(_0x6568('0x3'));var rp=require(_0x6568('0x4'));var moment=require(_0x6568('0x5'));var BPromise=require(_0x6568('0x6'));var Mustache=require(_0x6568('0x7'));var util=require(_0x6568('0x8'));var path=require(_0x6568('0x9'));var sox=require(_0x6568('0xa'));var csv=require(_0x6568('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6568('0xc'));var _=require(_0x6568('0xd'));var squel=require(_0x6568('0xe'));var crypto=require('crypto');var jsforce=require(_0x6568('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x6568('0xb'));var querystring=require(_0x6568('0x10'));var Papa=require(_0x6568('0x11'));var Redis=require(_0x6568('0x12'));var authService=require(_0x6568('0x13'));var qs=require(_0x6568('0x14'));var as=require(_0x6568('0x15'));var hardwareService=require(_0x6568('0x16'));var logger=require('../../config/logger')(_0x6568('0x17'));var utils=require(_0x6568('0x18'));var config=require(_0x6568('0x19'));var licenseUtil=require(_0x6568('0x1a'));var db=require(_0x6568('0x1b'))['db'];function respondWithStatusCode(_0x193a4f,_0x1b01a1){_0x1b01a1=_0x1b01a1||0xcc;return function(_0x25299e){if(_0x25299e){return _0x193a4f['sendStatus'](_0x1b01a1);}return _0x193a4f[_0x6568('0x1c')](_0x1b01a1)[_0x6568('0x1d')]();};}function respondWithResult(_0x1a7c68,_0x4e5f91){_0x4e5f91=_0x4e5f91||0xc8;return function(_0x1d7e06){if(_0x1d7e06){return _0x1a7c68[_0x6568('0x1c')](_0x4e5f91)[_0x6568('0x1e')](_0x1d7e06);}};}function respondWithFilteredResult(_0x1e231f,_0x3e54e1){return function(_0x471556){if(_0x471556){var _0x4ebea0=typeof _0x3e54e1['offset']===_0x6568('0x1f')&&typeof _0x3e54e1[_0x6568('0x20')]===_0x6568('0x1f');var _0x34a1fb=_0x471556[_0x6568('0x21')];var _0x4976e6=_0x4ebea0?0x0:_0x3e54e1[_0x6568('0x22')];var _0x4ef03e=_0x4ebea0?_0x471556[_0x6568('0x21')]:_0x3e54e1[_0x6568('0x22')]+_0x3e54e1['limit'];var _0x42adab;if(_0x4ef03e>=_0x34a1fb){_0x4ef03e=_0x34a1fb;_0x42adab=0xc8;}else{_0x42adab=0xce;}_0x1e231f[_0x6568('0x1c')](_0x42adab);return _0x1e231f[_0x6568('0x23')](_0x6568('0x24'),_0x4976e6+'-'+_0x4ef03e+'/'+_0x34a1fb)[_0x6568('0x1e')](_0x471556);}return null;};}function patchUpdates(_0x2b5fc3){return function(_0x4bd8e3){try{jsonpatch['apply'](_0x4bd8e3,_0x2b5fc3,!![]);}catch(_0xe20bc0){return BPromise[_0x6568('0x25')](_0xe20bc0);}return _0x4bd8e3[_0x6568('0x26')]();};}function saveUpdates(_0x42cf70,_0x4e0218){return function(_0x25f455){if(_0x25f455){return _0x25f455[_0x6568('0x27')](_0x42cf70)[_0x6568('0x28')](function(_0x416a5c){return _0x416a5c;});}return null;};}function removeEntity(_0x286e36,_0x2f5d9f){return function(_0x157248){if(_0x157248){return _0x157248[_0x6568('0x29')]()[_0x6568('0x28')](function(){var _0x4d1dac=_0x157248['get']({'plain':!![]});var _0x544b94=_0x6568('0x2a');return db['UserProfileResource'][_0x6568('0x29')]({'where':{'type':_0x544b94,'resourceId':_0x4d1dac['id']}})['then'](function(){return _0x157248;});})[_0x6568('0x28')](function(){_0x286e36[_0x6568('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f0bbe,_0xdf7720){return function(_0x51753f){if(!_0x51753f){_0x2f0bbe[_0x6568('0x2b')](0x194);}return _0x51753f;};}function handleError(_0x4e7501,_0x28016a){_0x28016a=_0x28016a||0x1f4;return function(_0x1a660e){logger[_0x6568('0x2c')](_0x1a660e['stack']);if(_0x1a660e[_0x6568('0x2d')]){delete _0x1a660e[_0x6568('0x2d')];}_0x4e7501['status'](_0x28016a)[_0x6568('0x2e')](_0x1a660e);};}exports[_0x6568('0x2f')]=function(_0x3efdd1,_0x1ab549){var _0x25253f={},_0x34fd95={},_0x45902b={'count':0x0,'rows':[]};var _0x508d61=_['map'](db['Template'][_0x6568('0x30')],function(_0x4ba24a){return{'name':_0x4ba24a[_0x6568('0x31')],'type':_0x4ba24a[_0x6568('0x32')][_0x6568('0x33')]};});_0x34fd95[_0x6568('0x34')]=_[_0x6568('0x35')](_0x508d61,'name');_0x34fd95[_0x6568('0x36')]=_[_0x6568('0x37')](_0x3efdd1[_0x6568('0x36')]);_0x34fd95[_0x6568('0x38')]=_[_0x6568('0x39')](_0x34fd95[_0x6568('0x34')],_0x34fd95[_0x6568('0x36')]);_0x25253f[_0x6568('0x3a')]=_[_0x6568('0x39')](_0x34fd95[_0x6568('0x34')],qs[_0x6568('0x3b')](_0x3efdd1[_0x6568('0x36')]['fields']));_0x25253f[_0x6568('0x3a')]=_0x25253f[_0x6568('0x3a')][_0x6568('0x3c')]?_0x25253f[_0x6568('0x3a')]:_0x34fd95[_0x6568('0x34')];if(!_0x3efdd1[_0x6568('0x36')][_0x6568('0x3d')](_0x6568('0x3e'))){_0x25253f[_0x6568('0x20')]=qs[_0x6568('0x20')](_0x3efdd1[_0x6568('0x36')][_0x6568('0x20')]);_0x25253f[_0x6568('0x22')]=qs[_0x6568('0x22')](_0x3efdd1[_0x6568('0x36')]['offset']);}_0x25253f[_0x6568('0x3f')]=qs[_0x6568('0x40')](_0x3efdd1[_0x6568('0x36')][_0x6568('0x40')]);_0x25253f[_0x6568('0x41')]=qs['filters'](_[_0x6568('0x42')](_0x3efdd1['query'],_0x34fd95[_0x6568('0x38')]),_0x508d61);if(_0x3efdd1[_0x6568('0x36')]['filter']){_0x25253f[_0x6568('0x41')]=_[_0x6568('0x43')](_0x25253f[_0x6568('0x41')],{'$or':_['map'](_0x508d61,function(_0x16dcb8){if(_0x16dcb8[_0x6568('0x32')]!==_0x6568('0x44')){var _0x167530={};_0x167530[_0x16dcb8[_0x6568('0x2d')]]={'$like':'%'+_0x3efdd1[_0x6568('0x36')][_0x6568('0x45')]+'%'};return _0x167530;}})});}_0x25253f=_[_0x6568('0x43')]({},_0x25253f,_0x3efdd1['options']);var _0x11bed2={'where':_0x25253f[_0x6568('0x41')]};return db[_0x6568('0x46')]['count'](_0x11bed2)[_0x6568('0x28')](function(_0x46bde1){_0x45902b[_0x6568('0x21')]=_0x46bde1;if(_0x3efdd1[_0x6568('0x36')]['includeAll']){_0x25253f[_0x6568('0x47')]=[{'all':!![]}];}return db[_0x6568('0x46')][_0x6568('0x48')](_0x25253f);})[_0x6568('0x28')](function(_0x9314ab){_0x45902b[_0x6568('0x49')]=_0x9314ab;return _0x45902b;})[_0x6568('0x28')](respondWithFilteredResult(_0x1ab549,_0x25253f))[_0x6568('0x4a')](handleError(_0x1ab549,null));};exports[_0x6568('0x4b')]=function(_0x293d40,_0x3976f0){var _0x34c9a0={'raw':!![],'where':{'id':_0x293d40['params']['id']}},_0x1c889c={};_0x1c889c['model']=_[_0x6568('0x37')](db[_0x6568('0x46')]['rawAttributes']);_0x1c889c[_0x6568('0x36')]=_[_0x6568('0x37')](_0x293d40['query']);_0x1c889c['filters']=_['intersection'](_0x1c889c[_0x6568('0x34')],_0x1c889c[_0x6568('0x36')]);_0x34c9a0[_0x6568('0x3a')]=_['intersection'](_0x1c889c[_0x6568('0x34')],qs['fields'](_0x293d40[_0x6568('0x36')][_0x6568('0x3b')]));_0x34c9a0[_0x6568('0x3a')]=_0x34c9a0[_0x6568('0x3a')][_0x6568('0x3c')]?_0x34c9a0['attributes']:_0x1c889c[_0x6568('0x34')];if(_0x293d40[_0x6568('0x36')]['includeAll']){_0x34c9a0[_0x6568('0x47')]=[{'all':!![]}];}_0x34c9a0=_['merge']({},_0x34c9a0,_0x293d40[_0x6568('0x4c')]);return db[_0x6568('0x46')][_0x6568('0x4d')](_0x34c9a0)[_0x6568('0x28')](handleEntityNotFound(_0x3976f0,null))[_0x6568('0x28')](respondWithResult(_0x3976f0,null))[_0x6568('0x4a')](handleError(_0x3976f0,null));};exports[_0x6568('0x4e')]=function(_0x4e7515,_0x5cbe10){return db['Template'][_0x6568('0x4e')](_0x4e7515[_0x6568('0x4f')],{})[_0x6568('0x28')](function(_0x4e7864){var _0x162627=_0x4e7515[_0x6568('0x50')][_0x6568('0x51')]({'plain':!![]});if(!_0x162627)throw new Error(_0x6568('0x52'));if(_0x162627[_0x6568('0x53')]==='user'){var _0x2d3c45=_0x4e7864[_0x6568('0x51')]({'plain':!![]});var _0x35a3b6=_0x6568('0x2a');return db[_0x6568('0x54')][_0x6568('0x4d')]({'where':{'name':_0x35a3b6,'userProfileId':_0x162627[_0x6568('0x55')]},'raw':!![]})[_0x6568('0x28')](function(_0x338845){if(_0x338845&&_0x338845[_0x6568('0x56')]===0x0){return db[_0x6568('0x57')][_0x6568('0x4e')]({'name':_0x2d3c45[_0x6568('0x2d')],'resourceId':_0x2d3c45['id'],'type':_0x338845[_0x6568('0x2d')],'sectionId':_0x338845['id']},{})[_0x6568('0x28')](function(){return _0x4e7864;});}else{return _0x4e7864;}})[_0x6568('0x4a')](function(_0x242838){logger['error'](_0x6568('0x58'),_0x242838);throw _0x242838;});}return _0x4e7864;})['then'](respondWithResult(_0x5cbe10,0xc9))[_0x6568('0x4a')](handleError(_0x5cbe10,null));};exports[_0x6568('0x27')]=function(_0x1a3a84,_0x2807d1){if(_0x1a3a84['body']['id']){delete _0x1a3a84[_0x6568('0x4f')]['id'];}return db[_0x6568('0x46')][_0x6568('0x4d')]({'where':{'id':_0x1a3a84[_0x6568('0x59')]['id']}})['then'](handleEntityNotFound(_0x2807d1,null))[_0x6568('0x28')](saveUpdates(_0x1a3a84[_0x6568('0x4f')],null))['then'](respondWithResult(_0x2807d1,null))['catch'](handleError(_0x2807d1,null));};exports[_0x6568('0x29')]=function(_0x252651,_0x5077c7){return db[_0x6568('0x46')][_0x6568('0x4d')]({'where':{'id':_0x252651[_0x6568('0x59')]['id']}})[_0x6568('0x28')](handleEntityNotFound(_0x5077c7,null))[_0x6568('0x28')](removeEntity(_0x5077c7,null))['catch'](handleError(_0x5077c7,null));}; \ No newline at end of file +var _0x16c7=['undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Templates','UserProfileResource','error','stack','send','index','Template','rawAttributes','fieldName','type','key','model','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','find','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0x16c7,0xe1));var _0x716c=function(_0x4cb47f,_0x53123c){_0x4cb47f=_0x4cb47f-0x0;var _0x1e576a=_0x16c7[_0x4cb47f];return _0x1e576a;};'use strict';var emlformat=require(_0x716c('0x0'));var rimraf=require(_0x716c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x716c('0x2'));var rp=require('request-promise');var moment=require(_0x716c('0x3'));var BPromise=require(_0x716c('0x4'));var Mustache=require('mustache');var util=require(_0x716c('0x5'));var path=require(_0x716c('0x6'));var sox=require(_0x716c('0x7'));var csv=require(_0x716c('0x8'));var ejs=require(_0x716c('0x9'));var fs=require('fs');var fs_extra=require(_0x716c('0xa'));var _=require(_0x716c('0xb'));var squel=require(_0x716c('0xc'));var crypto=require('crypto');var jsforce=require(_0x716c('0xd'));var deskjs=require(_0x716c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x716c('0xf'));var Papa=require(_0x716c('0x10'));var Redis=require('ioredis');var authService=require(_0x716c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x716c('0x12'));var hardwareService=require(_0x716c('0x13'));var logger=require('../../config/logger')(_0x716c('0x14'));var utils=require(_0x716c('0x15'));var config=require(_0x716c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x716c('0x17'))['db'];function respondWithStatusCode(_0x2bb8be,_0x1423d7){_0x1423d7=_0x1423d7||0xcc;return function(_0xfe37e2){if(_0xfe37e2){return _0x2bb8be[_0x716c('0x18')](_0x1423d7);}return _0x2bb8be[_0x716c('0x19')](_0x1423d7)[_0x716c('0x1a')]();};}function respondWithResult(_0x24e10f,_0x52fbd4){_0x52fbd4=_0x52fbd4||0xc8;return function(_0x5d6a93){if(_0x5d6a93){return _0x24e10f[_0x716c('0x19')](_0x52fbd4)[_0x716c('0x1b')](_0x5d6a93);}};}function respondWithFilteredResult(_0x2d4788,_0x221e4c){return function(_0x540deb){if(_0x540deb){var _0x3b2a4e=typeof _0x221e4c[_0x716c('0x1c')]==='undefined'&&typeof _0x221e4c[_0x716c('0x1d')]===_0x716c('0x1e');var _0x3a595c=_0x540deb['count'];var _0x46df9f=_0x3b2a4e?0x0:_0x221e4c[_0x716c('0x1c')];var _0x3e8fe2=_0x3b2a4e?_0x540deb[_0x716c('0x1f')]:_0x221e4c[_0x716c('0x1c')]+_0x221e4c[_0x716c('0x1d')];var _0x46ab33;if(_0x3e8fe2>=_0x3a595c){_0x3e8fe2=_0x3a595c;_0x46ab33=0xc8;}else{_0x46ab33=0xce;}_0x2d4788[_0x716c('0x19')](_0x46ab33);return _0x2d4788[_0x716c('0x20')](_0x716c('0x21'),_0x46df9f+'-'+_0x3e8fe2+'/'+_0x3a595c)[_0x716c('0x1b')](_0x540deb);}return null;};}function patchUpdates(_0x211427){return function(_0x14dd4a){try{jsonpatch[_0x716c('0x22')](_0x14dd4a,_0x211427,!![]);}catch(_0x29ce35){return BPromise[_0x716c('0x23')](_0x29ce35);}return _0x14dd4a[_0x716c('0x24')]();};}function saveUpdates(_0x5e4ccd,_0x538e14){return function(_0x24f59e){if(_0x24f59e){return _0x24f59e[_0x716c('0x25')](_0x5e4ccd)[_0x716c('0x26')](function(_0x34e355){return _0x34e355;});}return null;};}function removeEntity(_0x3b013a,_0xfcd4d0){return function(_0x3a97d4){if(_0x3a97d4){return _0x3a97d4[_0x716c('0x27')]()[_0x716c('0x26')](function(){var _0x11bf8b=_0x3a97d4[_0x716c('0x28')]({'plain':!![]});var _0x354d3c=_0x716c('0x29');return db[_0x716c('0x2a')][_0x716c('0x27')]({'where':{'type':_0x354d3c,'resourceId':_0x11bf8b['id']}})['then'](function(){return _0x3a97d4;});})['then'](function(){_0x3b013a[_0x716c('0x19')](0xcc)[_0x716c('0x1a')]();});}};}function handleEntityNotFound(_0xdc55d0,_0x1cd7a4){return function(_0xaaf7ef){if(!_0xaaf7ef){_0xdc55d0['sendStatus'](0x194);}return _0xaaf7ef;};}function handleError(_0x3fa03e,_0x317d23){_0x317d23=_0x317d23||0x1f4;return function(_0x5aecb5){logger[_0x716c('0x2b')](_0x5aecb5[_0x716c('0x2c')]);if(_0x5aecb5['name']){delete _0x5aecb5['name'];}_0x3fa03e[_0x716c('0x19')](_0x317d23)[_0x716c('0x2d')](_0x5aecb5);};}exports[_0x716c('0x2e')]=function(_0x42a929,_0x521e41){var _0x2cb239={},_0x3c2e52={},_0x159015={'count':0x0,'rows':[]};var _0x1d07d8=_['map'](db[_0x716c('0x2f')][_0x716c('0x30')],function(_0x1d7f66){return{'name':_0x1d7f66[_0x716c('0x31')],'type':_0x1d7f66[_0x716c('0x32')][_0x716c('0x33')]};});_0x3c2e52[_0x716c('0x34')]=_['map'](_0x1d07d8,_0x716c('0x35'));_0x3c2e52[_0x716c('0x36')]=_[_0x716c('0x37')](_0x42a929['query']);_0x3c2e52[_0x716c('0x38')]=_['intersection'](_0x3c2e52[_0x716c('0x34')],_0x3c2e52[_0x716c('0x36')]);_0x2cb239[_0x716c('0x39')]=_[_0x716c('0x3a')](_0x3c2e52['model'],qs[_0x716c('0x3b')](_0x42a929[_0x716c('0x36')]['fields']));_0x2cb239[_0x716c('0x39')]=_0x2cb239[_0x716c('0x39')][_0x716c('0x3c')]?_0x2cb239[_0x716c('0x39')]:_0x3c2e52[_0x716c('0x34')];if(!_0x42a929[_0x716c('0x36')][_0x716c('0x3d')](_0x716c('0x3e'))){_0x2cb239[_0x716c('0x1d')]=qs[_0x716c('0x1d')](_0x42a929[_0x716c('0x36')]['limit']);_0x2cb239[_0x716c('0x1c')]=qs[_0x716c('0x1c')](_0x42a929[_0x716c('0x36')]['offset']);}_0x2cb239['order']=qs[_0x716c('0x3f')](_0x42a929[_0x716c('0x36')]['sort']);_0x2cb239[_0x716c('0x40')]=qs[_0x716c('0x38')](_[_0x716c('0x41')](_0x42a929[_0x716c('0x36')],_0x3c2e52[_0x716c('0x38')]),_0x1d07d8);if(_0x42a929[_0x716c('0x36')][_0x716c('0x42')]){_0x2cb239[_0x716c('0x40')]=_[_0x716c('0x43')](_0x2cb239[_0x716c('0x40')],{'$or':_['map'](_0x1d07d8,function(_0x3aecd7){if(_0x3aecd7[_0x716c('0x32')]!=='VIRTUAL'){var _0x5258e3={};_0x5258e3[_0x3aecd7[_0x716c('0x35')]]={'$like':'%'+_0x42a929[_0x716c('0x36')]['filter']+'%'};return _0x5258e3;}})});}_0x2cb239=_[_0x716c('0x43')]({},_0x2cb239,_0x42a929[_0x716c('0x44')]);var _0x9c7632={'where':_0x2cb239['where']};return db[_0x716c('0x2f')][_0x716c('0x1f')](_0x9c7632)[_0x716c('0x26')](function(_0x40fc7f){_0x159015['count']=_0x40fc7f;if(_0x42a929['query'][_0x716c('0x45')]){_0x2cb239[_0x716c('0x46')]=[{'all':!![]}];}return db[_0x716c('0x2f')][_0x716c('0x47')](_0x2cb239);})[_0x716c('0x26')](function(_0x1def34){_0x159015[_0x716c('0x48')]=_0x1def34;return _0x159015;})[_0x716c('0x26')](respondWithFilteredResult(_0x521e41,_0x2cb239))[_0x716c('0x49')](handleError(_0x521e41,null));};exports[_0x716c('0x4a')]=function(_0x2bdf85,_0x3c9215){var _0x4413d6={'raw':!![],'where':{'id':_0x2bdf85['params']['id']}},_0x4b7cd0={};_0x4b7cd0[_0x716c('0x34')]=_[_0x716c('0x37')](db[_0x716c('0x2f')][_0x716c('0x30')]);_0x4b7cd0[_0x716c('0x36')]=_[_0x716c('0x37')](_0x2bdf85[_0x716c('0x36')]);_0x4b7cd0[_0x716c('0x38')]=_['intersection'](_0x4b7cd0['model'],_0x4b7cd0[_0x716c('0x36')]);_0x4413d6[_0x716c('0x39')]=_[_0x716c('0x3a')](_0x4b7cd0[_0x716c('0x34')],qs[_0x716c('0x3b')](_0x2bdf85[_0x716c('0x36')][_0x716c('0x3b')]));_0x4413d6[_0x716c('0x39')]=_0x4413d6[_0x716c('0x39')][_0x716c('0x3c')]?_0x4413d6['attributes']:_0x4b7cd0[_0x716c('0x34')];if(_0x2bdf85[_0x716c('0x36')]['includeAll']){_0x4413d6[_0x716c('0x46')]=[{'all':!![]}];}_0x4413d6=_[_0x716c('0x43')]({},_0x4413d6,_0x2bdf85[_0x716c('0x44')]);return db[_0x716c('0x2f')]['find'](_0x4413d6)[_0x716c('0x26')](handleEntityNotFound(_0x3c9215,null))[_0x716c('0x26')](respondWithResult(_0x3c9215,null))[_0x716c('0x49')](handleError(_0x3c9215,null));};exports[_0x716c('0x4b')]=function(_0x46ff2b,_0x19d2c2){return db[_0x716c('0x2f')][_0x716c('0x4b')](_0x46ff2b[_0x716c('0x4c')],{})[_0x716c('0x26')](function(_0x4c5d8a){var _0x26015a=_0x46ff2b[_0x716c('0x4d')][_0x716c('0x28')]({'plain':!![]});if(!_0x26015a)throw new Error(_0x716c('0x4e'));if(_0x26015a['role']===_0x716c('0x4d')){var _0x5d65f4=_0x4c5d8a[_0x716c('0x28')]({'plain':!![]});var _0x50bc19=_0x716c('0x29');return db[_0x716c('0x4f')]['find']({'where':{'name':_0x50bc19,'userProfileId':_0x26015a[_0x716c('0x50')]},'raw':!![]})[_0x716c('0x26')](function(_0x1ca7a8){if(_0x1ca7a8&&_0x1ca7a8[_0x716c('0x51')]===0x0){return db[_0x716c('0x2a')][_0x716c('0x4b')]({'name':_0x5d65f4[_0x716c('0x35')],'resourceId':_0x5d65f4['id'],'type':_0x1ca7a8[_0x716c('0x35')],'sectionId':_0x1ca7a8['id']},{})['then'](function(){return _0x4c5d8a;});}else{return _0x4c5d8a;}})['catch'](function(_0x3baba3){logger[_0x716c('0x2b')](_0x716c('0x52'),_0x3baba3);throw _0x3baba3;});}return _0x4c5d8a;})[_0x716c('0x26')](respondWithResult(_0x19d2c2,0xc9))[_0x716c('0x49')](handleError(_0x19d2c2,null));};exports[_0x716c('0x25')]=function(_0x48d706,_0x1197f7){if(_0x48d706['body']['id']){delete _0x48d706[_0x716c('0x4c')]['id'];}return db[_0x716c('0x2f')]['find']({'where':{'id':_0x48d706[_0x716c('0x53')]['id']}})[_0x716c('0x26')](handleEntityNotFound(_0x1197f7,null))[_0x716c('0x26')](saveUpdates(_0x48d706[_0x716c('0x4c')],null))[_0x716c('0x26')](respondWithResult(_0x1197f7,null))[_0x716c('0x49')](handleError(_0x1197f7,null));};exports['destroy']=function(_0xf209e8,_0x5588fa){return db[_0x716c('0x2f')][_0x716c('0x54')]({'where':{'id':_0xf209e8['params']['id']}})[_0x716c('0x26')](handleEntityNotFound(_0x5588fa,null))[_0x716c('0x26')](removeEntity(_0x5588fa,null))['catch'](handleError(_0x5588fa,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 5fb2a4c..f7115cb 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 _0x9d06=['define','Template','tools_templates','lodash','api','moment','bluebird','path','rimraf','../../config/environment','./template.attributes'];(function(_0x41ee16,_0xfa94c3){var _0x1f60de=function(_0x1c8ffc){while(--_0x1c8ffc){_0x41ee16['push'](_0x41ee16['shift']());}};_0x1f60de(++_0xfa94c3);}(_0x9d06,0xa8));var _0x69d0=function(_0x484732,_0x171a60){_0x484732=_0x484732-0x0;var _0x4dfff6=_0x9d06[_0x484732];return _0x4dfff6;};'use strict';var _=require(_0x69d0('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x69d0('0x1'));var moment=require(_0x69d0('0x2'));var BPromise=require(_0x69d0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x69d0('0x4'));var rimraf=require(_0x69d0('0x5'));var config=require(_0x69d0('0x6'));var attributes=require(_0x69d0('0x7'));module['exports']=function(_0x47032a,_0x3b7aa2){return _0x47032a[_0x69d0('0x8')](_0x69d0('0x9'),attributes,{'tableName':_0x69d0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x15e8=['bluebird','request-promise','path','../../config/environment','./template.attributes','exports','define','lodash','../../config/logger','api','moment'];(function(_0x5b5d20,_0x4bf336){var _0x47c48f=function(_0x4976f5){while(--_0x4976f5){_0x5b5d20['push'](_0x5b5d20['shift']());}};_0x47c48f(++_0x4bf336);}(_0x15e8,0x130));var _0x815e=function(_0x2a4c2b,_0x1ce4a3){_0x2a4c2b=_0x2a4c2b-0x0;var _0x5c5cd1=_0x15e8[_0x2a4c2b];return _0x5c5cd1;};'use strict';var _=require(_0x815e('0x0'));var util=require('util');var logger=require(_0x815e('0x1'))(_0x815e('0x2'));var moment=require(_0x815e('0x3'));var BPromise=require(_0x815e('0x4'));var rp=require(_0x815e('0x5'));var fs=require('fs');var path=require(_0x815e('0x6'));var rimraf=require('rimraf');var config=require(_0x815e('0x7'));var attributes=require(_0x815e('0x8'));module[_0x815e('0x9')]=function(_0x384a2b,_0x1fe695){return _0x384a2b[_0x815e('0xa')]('Template',attributes,{'tableName':'tools_templates','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 1f7cfbe..4b3b972 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 _0x8409=['Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTemplate','findAll','options','raw','where','attributes','limit','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','then','info','Template,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4f1334,_0x5497a2){var _0x108156=function(_0x374c2f){while(--_0x374c2f){_0x4f1334['push'](_0x4f1334['shift']());}};_0x108156(++_0x5497a2);}(_0x8409,0x91));var _0x9840=function(_0x425ec8,_0x293ff){_0x425ec8=_0x425ec8-0x0;var _0x1cbf90=_0x8409[_0x425ec8];return _0x1cbf90;};'use strict';var _=require(_0x9840('0x0'));var util=require(_0x9840('0x1'));var moment=require(_0x9840('0x2'));var BPromise=require(_0x9840('0x3'));var rs=require(_0x9840('0x4'));var fs=require('fs');var Redis=require(_0x9840('0x5'));var db=require(_0x9840('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9840('0x7'))('rpc');var config=require(_0x9840('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9840('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e514f,_0x3652c5,_0xa3195f){return new BPromise(function(_0x1a23a1,_0x2815a0){return client['request'](_0x3e514f,_0xa3195f)[_0x9840('0xa')](function(_0x4933e9){logger[_0x9840('0xb')](_0x9840('0xc'),_0x3652c5,_0x9840('0xd'));logger[_0x9840('0xe')](_0x9840('0xf'),_0x3652c5,'request\x20sent',JSON[_0x9840('0x10')](_0x4933e9));if(_0x4933e9[_0x9840('0x11')]){if(_0x4933e9[_0x9840('0x11')][_0x9840('0x12')]===0x1f4){logger[_0x9840('0x11')](_0x9840('0xc'),_0x3652c5,_0x4933e9['error'][_0x9840('0x13')]);return _0x2815a0(_0x4933e9[_0x9840('0x11')]['message']);}logger['error'](_0x9840('0xc'),_0x3652c5,_0x4933e9['error'][_0x9840('0x13')]);return _0x1a23a1(_0x4933e9[_0x9840('0x11')][_0x9840('0x13')]);}else{logger[_0x9840('0xb')]('Template,\x20%s,\x20%s',_0x3652c5,_0x9840('0xd'));_0x1a23a1(_0x4933e9[_0x9840('0x14')][_0x9840('0x13')]);}})[_0x9840('0x15')](function(_0xa00dd){logger[_0x9840('0x11')](_0x9840('0xc'),_0x3652c5,_0xa00dd);_0x2815a0(_0xa00dd);});});}exports[_0x9840('0x16')]=function(_0x1f01fc){var _0x95a8ec=this;return new Promise(function(_0x59a76c,_0x3c3339){return db['Template'][_0x9840('0x17')]({'raw':_0x1f01fc['options']?_0x1f01fc[_0x9840('0x18')][_0x9840('0x19')]===undefined?!![]:![]:!![],'where':_0x1f01fc[_0x9840('0x18')]?_0x1f01fc['options'][_0x9840('0x1a')]||null:null,'attributes':_0x1f01fc[_0x9840('0x18')]?_0x1f01fc[_0x9840('0x18')][_0x9840('0x1b')]||null:null,'limit':_0x1f01fc[_0x9840('0x18')]?_0x1f01fc[_0x9840('0x18')][_0x9840('0x1c')]||null:null,'include':_0x1f01fc[_0x9840('0x18')]?_0x1f01fc[_0x9840('0x18')][_0x9840('0x1d')]?_[_0x9840('0x1e')](_0x1f01fc[_0x9840('0x18')]['include'],function(_0x7f641e){return{'model':db[_0x7f641e[_0x9840('0x1f')]],'as':_0x7f641e['as'],'attributes':_0x7f641e[_0x9840('0x1b')],'include':_0x7f641e['include']?_[_0x9840('0x1e')](_0x7f641e[_0x9840('0x1d')],function(_0x15c006){return{'model':db[_0x15c006[_0x9840('0x1f')]],'as':_0x15c006['as'],'attributes':_0x15c006[_0x9840('0x1b')],'include':_0x15c006[_0x9840('0x1d')]?_[_0x9840('0x1e')](_0x15c006['include'],function(_0x4c4411){return{'model':db[_0x4c4411[_0x9840('0x1f')]],'as':_0x4c4411['as'],'attributes':_0x4c4411[_0x9840('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9840('0xa')](function(_0x5e7527){logger[_0x9840('0xb')](_0x9840('0x16'),_0x1f01fc);logger['debug'](_0x9840('0x16'),_0x1f01fc,JSON['stringify'](_0x5e7527));_0x59a76c(_0x5e7527);})['catch'](function(_0x120960){logger[_0x9840('0x11')](_0x9840('0x16'),_0x120960[_0x9840('0x13')],_0x1f01fc);_0x3c3339(_0x95a8ec[_0x9840('0x11')](0x1f4,_0x120960[_0x9840('0x13')]));});});}; \ No newline at end of file +var _0x06a1=['include','map','model','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetTemplate','Template','findAll','options','raw','where','attributes','limit'];(function(_0x1d59e7,_0x54e8ed){var _0x5355d9=function(_0x4bab0c){while(--_0x4bab0c){_0x1d59e7['push'](_0x1d59e7['shift']());}};_0x5355d9(++_0x54e8ed);}(_0x06a1,0x14d));var _0x106a=function(_0x4d65b1,_0x424678){_0x4d65b1=_0x4d65b1-0x0;var _0x4a0286=_0x06a1[_0x4d65b1];return _0x4a0286;};'use strict';var _=require(_0x106a('0x0'));var util=require(_0x106a('0x1'));var moment=require('moment');var BPromise=require(_0x106a('0x2'));var rs=require(_0x106a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x106a('0x4'));var logger=require(_0x106a('0x5'))(_0x106a('0x6'));var config=require(_0x106a('0x7'));var jayson=require(_0x106a('0x8'));var client=jayson[_0x106a('0x9')][_0x106a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x222f7e,_0x4e0b7d,_0xf871cb){return new BPromise(function(_0x24b030,_0x4f44f9){return client['request'](_0x222f7e,_0xf871cb)['then'](function(_0x2fb511){logger['info'](_0x106a('0xb'),_0x4e0b7d,_0x106a('0xc'));logger[_0x106a('0xd')](_0x106a('0xe'),_0x4e0b7d,'request\x20sent',JSON[_0x106a('0xf')](_0x2fb511));if(_0x2fb511[_0x106a('0x10')]){if(_0x2fb511[_0x106a('0x10')]['code']===0x1f4){logger[_0x106a('0x10')](_0x106a('0xb'),_0x4e0b7d,_0x2fb511[_0x106a('0x10')]['message']);return _0x4f44f9(_0x2fb511[_0x106a('0x10')]['message']);}logger['error'](_0x106a('0xb'),_0x4e0b7d,_0x2fb511['error'][_0x106a('0x11')]);return _0x24b030(_0x2fb511[_0x106a('0x10')][_0x106a('0x11')]);}else{logger['info'](_0x106a('0xb'),_0x4e0b7d,_0x106a('0xc'));_0x24b030(_0x2fb511['result'][_0x106a('0x11')]);}})[_0x106a('0x12')](function(_0x96d14d){logger[_0x106a('0x10')]('Template,\x20%s,\x20%s',_0x4e0b7d,_0x96d14d);_0x4f44f9(_0x96d14d);});});}exports[_0x106a('0x13')]=function(_0x4c8c6d){var _0x3c7787=this;return new Promise(function(_0x25d948,_0x2b662a){return db[_0x106a('0x14')][_0x106a('0x15')]({'raw':_0x4c8c6d[_0x106a('0x16')]?_0x4c8c6d[_0x106a('0x16')][_0x106a('0x17')]===undefined?!![]:![]:!![],'where':_0x4c8c6d['options']?_0x4c8c6d[_0x106a('0x16')][_0x106a('0x18')]||null:null,'attributes':_0x4c8c6d[_0x106a('0x16')]?_0x4c8c6d[_0x106a('0x16')][_0x106a('0x19')]||null:null,'limit':_0x4c8c6d[_0x106a('0x16')]?_0x4c8c6d[_0x106a('0x16')][_0x106a('0x1a')]||null:null,'include':_0x4c8c6d[_0x106a('0x16')]?_0x4c8c6d['options'][_0x106a('0x1b')]?_[_0x106a('0x1c')](_0x4c8c6d[_0x106a('0x16')][_0x106a('0x1b')],function(_0x531ac5){return{'model':db[_0x531ac5[_0x106a('0x1d')]],'as':_0x531ac5['as'],'attributes':_0x531ac5[_0x106a('0x19')],'include':_0x531ac5[_0x106a('0x1b')]?_['map'](_0x531ac5[_0x106a('0x1b')],function(_0x4d61d1){return{'model':db[_0x4d61d1[_0x106a('0x1d')]],'as':_0x4d61d1['as'],'attributes':_0x4d61d1[_0x106a('0x19')],'include':_0x4d61d1[_0x106a('0x1b')]?_[_0x106a('0x1c')](_0x4d61d1[_0x106a('0x1b')],function(_0xbae5c1){return{'model':db[_0xbae5c1['model']],'as':_0xbae5c1['as'],'attributes':_0xbae5c1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d39cb){logger['info'](_0x106a('0x13'),_0x4c8c6d);logger['debug']('GetTemplate',_0x4c8c6d,JSON[_0x106a('0xf')](_0x1d39cb));_0x25d948(_0x1d39cb);})[_0x106a('0x12')](function(_0x2f41d1){logger['error'](_0x106a('0x13'),_0x2f41d1['message'],_0x4c8c6d);_0x2b662a(_0x3c7787['error'](0x1f4,_0x2f41d1['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 7ef9989..c176aa8 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 _0xc283=['/:id/all_conditions','/:id/any_conditions','getAnyConditions','getActions','post','create','put','/:id','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show'];(function(_0x29b1e2,_0x120062){var _0x44b2c0=function(_0x591c94){while(--_0x591c94){_0x29b1e2['push'](_0x29b1e2['shift']());}};_0x44b2c0(++_0x120062);}(_0xc283,0x17f));var _0x3c28=function(_0x56a0b1,_0x49c7a0){_0x56a0b1=_0x56a0b1-0x0;var _0x3cc2ce=_0xc283[_0x56a0b1];return _0x3cc2ce;};'use strict';var multer=require(_0x3c28('0x0'));var util=require(_0x3c28('0x1'));var path=require(_0x3c28('0x2'));var timeout=require(_0x3c28('0x3'));var express=require(_0x3c28('0x4'));var router=express[_0x3c28('0x5')]();var fs_extra=require(_0x3c28('0x6'));var auth=require(_0x3c28('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x3c28('0x8'));var controller=require('./trigger.controller');router[_0x3c28('0x9')]('/',auth[_0x3c28('0xa')](),controller[_0x3c28('0xb')]);router[_0x3c28('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x3c28('0xc')]);router[_0x3c28('0x9')](_0x3c28('0xd'),auth[_0x3c28('0xa')](),controller['getAllConditions']);router[_0x3c28('0x9')](_0x3c28('0xe'),auth['isAuthenticated'](),controller[_0x3c28('0xf')]);router[_0x3c28('0x9')]('/:id/actions',auth[_0x3c28('0xa')](),controller[_0x3c28('0x10')]);router[_0x3c28('0x11')]('/',auth['isAuthenticated'](),controller[_0x3c28('0x12')]);router['post'](_0x3c28('0xd'),auth[_0x3c28('0xa')](),controller['addAllCondition']);router[_0x3c28('0x11')](_0x3c28('0xe'),auth[_0x3c28('0xa')](),controller['addAnyCondition']);router[_0x3c28('0x11')]('/:id/actions',auth[_0x3c28('0xa')](),controller['addAction']);router[_0x3c28('0x13')](_0x3c28('0x14'),auth[_0x3c28('0xa')](),controller['update']);router['delete'](_0x3c28('0x14'),auth[_0x3c28('0xa')](),controller[_0x3c28('0x15')]);module['exports']=router; \ No newline at end of file +var _0x9172=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./trigger.controller','get','index','/:id','isAuthenticated','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','/:id/actions','getActions','post','create','addAllCondition','addAnyCondition','put','update','delete','exports','multer','util'];(function(_0x486a19,_0xa9059c){var _0x10b0f4=function(_0x58b4b6){while(--_0x58b4b6){_0x486a19['push'](_0x486a19['shift']());}};_0x10b0f4(++_0xa9059c);}(_0x9172,0x19e));var _0x2917=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x9172[_0x9cd4c3];return _0x4c9025;};'use strict';var multer=require(_0x2917('0x0'));var util=require(_0x2917('0x1'));var path=require('path');var timeout=require(_0x2917('0x2'));var express=require('express');var router=express[_0x2917('0x3')]();var fs_extra=require(_0x2917('0x4'));var auth=require(_0x2917('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2917('0x6'));var controller=require(_0x2917('0x7'));router[_0x2917('0x8')]('/',auth['isAuthenticated'](),controller[_0x2917('0x9')]);router[_0x2917('0x8')](_0x2917('0xa'),auth[_0x2917('0xb')](),controller[_0x2917('0xc')]);router[_0x2917('0x8')](_0x2917('0xd'),auth[_0x2917('0xb')](),controller[_0x2917('0xe')]);router[_0x2917('0x8')](_0x2917('0xf'),auth[_0x2917('0xb')](),controller['getAnyConditions']);router[_0x2917('0x8')](_0x2917('0x10'),auth[_0x2917('0xb')](),controller[_0x2917('0x11')]);router[_0x2917('0x12')]('/',auth[_0x2917('0xb')](),controller[_0x2917('0x13')]);router[_0x2917('0x12')]('/:id/all_conditions',auth['isAuthenticated'](),controller[_0x2917('0x14')]);router[_0x2917('0x12')]('/:id/any_conditions',auth[_0x2917('0xb')](),controller[_0x2917('0x15')]);router[_0x2917('0x12')](_0x2917('0x10'),auth['isAuthenticated'](),controller['addAction']);router[_0x2917('0x16')](_0x2917('0xa'),auth[_0x2917('0xb')](),controller[_0x2917('0x17')]);router[_0x2917('0x18')](_0x2917('0xa'),auth[_0x2917('0xb')](),controller['destroy']);module[_0x2917('0x19')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 0a34654..7064a68 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 _0x4373=['sequelize','exports','STRING'];(function(_0xfd183f,_0x21bbde){var _0x40b42e=function(_0x5dfbf3){while(--_0x5dfbf3){_0xfd183f['push'](_0xfd183f['shift']());}};_0x40b42e(++_0x21bbde);}(_0x4373,0x1e6));var _0x3437=function(_0x5f5ddc,_0x17831a){_0x5f5ddc=_0x5f5ddc-0x0;var _0x9f6d82=_0x4373[_0x5f5ddc];return _0x9f6d82;};'use strict';var Sequelize=require(_0x3437('0x0'));module[_0x3437('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x3437('0x2')]},'description':{'type':Sequelize[_0x3437('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x8d8e=['BOOLEAN','sequelize','exports','STRING'];(function(_0x24b04c,_0x3f6761){var _0x1728ca=function(_0x48cf21){while(--_0x48cf21){_0x24b04c['push'](_0x24b04c['shift']());}};_0x1728ca(++_0x3f6761);}(_0x8d8e,0xd9));var _0xe8d8=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x8d8e[_0x5e3b04];return _0x1fc44d;};'use strict';var Sequelize=require(_0xe8d8('0x0'));module[_0xe8d8('0x1')]={'name':{'type':Sequelize[_0xe8d8('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe8d8('0x2')]},'status':{'type':Sequelize[_0xe8d8('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 a8772b4..2fe5861 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 _0x0ba8=['include','create','get','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','params','addAllCondition','Condition','TriggerAnyId','getAllConditions','findOne','hasOwnProperty','nolimit','getAnyConditions','addAction','getActions','Action','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','json','reject','save','update','then','Triggers','UserProfileResource','error','stack','name','index','Trigger','rawAttributes','key','model','map','query','keys','filters','intersection','fields','attributes','length','order','sort','pick','filter','where','merge','type','options','findAll','rows','catch','show','includeAll'];(function(_0x5786f9,_0x59a148){var _0x22c3cf=function(_0x360be2){while(--_0x360be2){_0x5786f9['push'](_0x5786f9['shift']());}};_0x22c3cf(++_0x59a148);}(_0x0ba8,0xc3));var _0x80ba=function(_0x501a35,_0x1e07b3){_0x501a35=_0x501a35-0x0;var _0x2c70ea=_0x0ba8[_0x501a35];return _0x2c70ea;};'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(_0x80ba('0x0'));var moment=require(_0x80ba('0x1'));var BPromise=require(_0x80ba('0x2'));var Mustache=require(_0x80ba('0x3'));var util=require('util');var path=require(_0x80ba('0x4'));var sox=require('sox');var csv=require(_0x80ba('0x5'));var ejs=require(_0x80ba('0x6'));var fs=require('fs');var fs_extra=require(_0x80ba('0x7'));var _=require(_0x80ba('0x8'));var squel=require(_0x80ba('0x9'));var crypto=require(_0x80ba('0xa'));var jsforce=require(_0x80ba('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x80ba('0xc'));var Papa=require(_0x80ba('0xd'));var Redis=require('ioredis');var authService=require(_0x80ba('0xe'));var qs=require(_0x80ba('0xf'));var as=require(_0x80ba('0x10'));var hardwareService=require(_0x80ba('0x11'));var logger=require(_0x80ba('0x12'))(_0x80ba('0x13'));var utils=require('../../config/utils');var config=require(_0x80ba('0x14'));var licenseUtil=require(_0x80ba('0x15'));var db=require(_0x80ba('0x16'))['db'];function respondWithStatusCode(_0x532572,_0x42656c){_0x42656c=_0x42656c||0xcc;return function(_0x3ae6ba){if(_0x3ae6ba){return _0x532572[_0x80ba('0x17')](_0x42656c);}return _0x532572[_0x80ba('0x18')](_0x42656c)['end']();};}function respondWithResult(_0x2eabc5,_0x6593f4){_0x6593f4=_0x6593f4||0xc8;return function(_0x51ca67){if(_0x51ca67){return _0x2eabc5[_0x80ba('0x18')](_0x6593f4)['json'](_0x51ca67);}};}function respondWithFilteredResult(_0x552563,_0x4cb7d5){return function(_0x4dc0d4){if(_0x4dc0d4){var _0x4abffd=typeof _0x4cb7d5[_0x80ba('0x19')]===_0x80ba('0x1a')&&typeof _0x4cb7d5['limit']===_0x80ba('0x1a');var _0x321404=_0x4dc0d4[_0x80ba('0x1b')];var _0x440418=_0x4abffd?0x0:_0x4cb7d5[_0x80ba('0x19')];var _0xadfd3c=_0x4abffd?_0x4dc0d4[_0x80ba('0x1b')]:_0x4cb7d5[_0x80ba('0x19')]+_0x4cb7d5[_0x80ba('0x1c')];var _0x58bcf8;if(_0xadfd3c>=_0x321404){_0xadfd3c=_0x321404;_0x58bcf8=0xc8;}else{_0x58bcf8=0xce;}_0x552563[_0x80ba('0x18')](_0x58bcf8);return _0x552563[_0x80ba('0x1d')]('Content-Range',_0x440418+'-'+_0xadfd3c+'/'+_0x321404)[_0x80ba('0x1e')](_0x4dc0d4);}return null;};}function patchUpdates(_0x2d922d){return function(_0x13d742){try{jsonpatch['apply'](_0x13d742,_0x2d922d,!![]);}catch(_0x5c1a55){return BPromise[_0x80ba('0x1f')](_0x5c1a55);}return _0x13d742[_0x80ba('0x20')]();};}function saveUpdates(_0xf92a68,_0x1e3e95){return function(_0x5f10a9){if(_0x5f10a9){return _0x5f10a9[_0x80ba('0x21')](_0xf92a68)[_0x80ba('0x22')](function(_0x23d40b){return _0x23d40b;});}return null;};}function removeEntity(_0x279f1a,_0x139ad2){return function(_0x5d0915){if(_0x5d0915){return _0x5d0915['destroy']()['then'](function(){var _0x1666a0=_0x5d0915['get']({'plain':!![]});var _0x1c42cc=_0x80ba('0x23');return db[_0x80ba('0x24')]['destroy']({'where':{'type':_0x1c42cc,'resourceId':_0x1666a0['id']}})[_0x80ba('0x22')](function(){return _0x5d0915;});})[_0x80ba('0x22')](function(){_0x279f1a[_0x80ba('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x376520,_0xd26603){return function(_0x146c3a){if(!_0x146c3a){_0x376520[_0x80ba('0x17')](0x194);}return _0x146c3a;};}function handleError(_0x1b9bae,_0x4fe19e){_0x4fe19e=_0x4fe19e||0x1f4;return function(_0x20aee4){logger[_0x80ba('0x25')](_0x20aee4[_0x80ba('0x26')]);if(_0x20aee4[_0x80ba('0x27')]){delete _0x20aee4[_0x80ba('0x27')];}_0x1b9bae['status'](_0x4fe19e)['send'](_0x20aee4);};}exports[_0x80ba('0x28')]=function(_0x3f91c6,_0x64b20b){var _0x255e0e={},_0x4c0f28={},_0x5a7084={'count':0x0,'rows':[]};var _0x30f1b6=_['map'](db[_0x80ba('0x29')][_0x80ba('0x2a')],function(_0x1a0415){return{'name':_0x1a0415['fieldName'],'type':_0x1a0415['type'][_0x80ba('0x2b')]};});_0x4c0f28[_0x80ba('0x2c')]=_[_0x80ba('0x2d')](_0x30f1b6,_0x80ba('0x27'));_0x4c0f28[_0x80ba('0x2e')]=_[_0x80ba('0x2f')](_0x3f91c6[_0x80ba('0x2e')]);_0x4c0f28[_0x80ba('0x30')]=_[_0x80ba('0x31')](_0x4c0f28[_0x80ba('0x2c')],_0x4c0f28[_0x80ba('0x2e')]);_0x255e0e['attributes']=_['intersection'](_0x4c0f28[_0x80ba('0x2c')],qs[_0x80ba('0x32')](_0x3f91c6[_0x80ba('0x2e')]['fields']));_0x255e0e[_0x80ba('0x33')]=_0x255e0e[_0x80ba('0x33')][_0x80ba('0x34')]?_0x255e0e['attributes']:_0x4c0f28['model'];if(!_0x3f91c6[_0x80ba('0x2e')]['hasOwnProperty']('nolimit')){_0x255e0e[_0x80ba('0x1c')]=qs[_0x80ba('0x1c')](_0x3f91c6[_0x80ba('0x2e')][_0x80ba('0x1c')]);_0x255e0e[_0x80ba('0x19')]=qs['offset'](_0x3f91c6[_0x80ba('0x2e')]['offset']);}_0x255e0e[_0x80ba('0x35')]=qs[_0x80ba('0x36')](_0x3f91c6['query']['sort']);_0x255e0e['where']=qs[_0x80ba('0x30')](_[_0x80ba('0x37')](_0x3f91c6[_0x80ba('0x2e')],_0x4c0f28['filters']),_0x30f1b6);if(_0x3f91c6[_0x80ba('0x2e')][_0x80ba('0x38')]){_0x255e0e[_0x80ba('0x39')]=_[_0x80ba('0x3a')](_0x255e0e[_0x80ba('0x39')],{'$or':_[_0x80ba('0x2d')](_0x30f1b6,function(_0x34feb5){if(_0x34feb5[_0x80ba('0x3b')]!=='VIRTUAL'){var _0x3f9877={};_0x3f9877[_0x34feb5[_0x80ba('0x27')]]={'$like':'%'+_0x3f91c6['query']['filter']+'%'};return _0x3f9877;}})});}_0x255e0e=_[_0x80ba('0x3a')]({},_0x255e0e,_0x3f91c6[_0x80ba('0x3c')]);var _0x4a695a={'where':_0x255e0e['where']};return db[_0x80ba('0x29')][_0x80ba('0x1b')](_0x4a695a)['then'](function(_0x56cf6a){_0x5a7084['count']=_0x56cf6a;if(_0x3f91c6[_0x80ba('0x2e')]['includeAll']){_0x255e0e['include']=[{'all':!![]}];}return db[_0x80ba('0x29')][_0x80ba('0x3d')](_0x255e0e);})[_0x80ba('0x22')](function(_0x3f14e6){_0x5a7084[_0x80ba('0x3e')]=_0x3f14e6;return _0x5a7084;})[_0x80ba('0x22')](respondWithFilteredResult(_0x64b20b,_0x255e0e))[_0x80ba('0x3f')](handleError(_0x64b20b,null));};exports[_0x80ba('0x40')]=function(_0x390620,_0x4ef1d3){var _0x1deeef={'raw':![],'where':{'id':_0x390620['params']['id']}},_0x1bf043={};_0x1bf043[_0x80ba('0x2c')]=_[_0x80ba('0x2f')](db[_0x80ba('0x29')][_0x80ba('0x2a')]);_0x1bf043[_0x80ba('0x2e')]=_['keys'](_0x390620['query']);_0x1bf043['filters']=_[_0x80ba('0x31')](_0x1bf043[_0x80ba('0x2c')],_0x1bf043[_0x80ba('0x2e')]);_0x1deeef[_0x80ba('0x33')]=_[_0x80ba('0x31')](_0x1bf043[_0x80ba('0x2c')],qs['fields'](_0x390620[_0x80ba('0x2e')][_0x80ba('0x32')]));_0x1deeef[_0x80ba('0x33')]=_0x1deeef[_0x80ba('0x33')][_0x80ba('0x34')]?_0x1deeef[_0x80ba('0x33')]:_0x1bf043[_0x80ba('0x2c')];if(_0x390620['query'][_0x80ba('0x41')]){_0x1deeef[_0x80ba('0x42')]=[{'all':!![]}];}_0x1deeef=_[_0x80ba('0x3a')]({},_0x1deeef,_0x390620['options']);return db[_0x80ba('0x29')]['find'](_0x1deeef)[_0x80ba('0x22')](handleEntityNotFound(_0x4ef1d3,null))['then'](respondWithResult(_0x4ef1d3,null))[_0x80ba('0x3f')](handleError(_0x4ef1d3,null));};exports[_0x80ba('0x43')]=function(_0x324cb0,_0x10f66c){return db[_0x80ba('0x29')][_0x80ba('0x43')](_0x324cb0['body'],{})[_0x80ba('0x22')](function(_0xe15157){var _0xdf64b7=_0x324cb0['user'][_0x80ba('0x44')]({'plain':!![]});if(!_0xdf64b7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xdf64b7['role']===_0x80ba('0x45')){var _0x3afd26=_0xe15157['get']({'plain':!![]});var _0x1dcdfe='Triggers';return db[_0x80ba('0x46')]['find']({'where':{'name':_0x1dcdfe,'userProfileId':_0xdf64b7['userProfileId']},'raw':!![]})[_0x80ba('0x22')](function(_0x30bb1f){if(_0x30bb1f&&_0x30bb1f[_0x80ba('0x47')]===0x0){return db[_0x80ba('0x24')][_0x80ba('0x43')]({'name':_0x3afd26[_0x80ba('0x27')],'resourceId':_0x3afd26['id'],'type':_0x30bb1f[_0x80ba('0x27')],'sectionId':_0x30bb1f['id']},{})[_0x80ba('0x22')](function(){return _0xe15157;});}else{return _0xe15157;}})[_0x80ba('0x3f')](function(_0x27a44a){logger[_0x80ba('0x25')](_0x80ba('0x48'),_0x27a44a);throw _0x27a44a;});}return _0xe15157;})[_0x80ba('0x22')](respondWithResult(_0x10f66c,0xc9))[_0x80ba('0x3f')](handleError(_0x10f66c,null));};exports[_0x80ba('0x21')]=function(_0x187810,_0x506998){if(_0x187810[_0x80ba('0x49')]['id']){delete _0x187810[_0x80ba('0x49')]['id'];}return db[_0x80ba('0x29')][_0x80ba('0x4a')]({'where':{'id':_0x187810['params']['id']}})[_0x80ba('0x22')](handleEntityNotFound(_0x506998,null))[_0x80ba('0x22')](saveUpdates(_0x187810[_0x80ba('0x49')],null))[_0x80ba('0x22')](respondWithResult(_0x506998,null))['catch'](handleError(_0x506998,null));};exports['destroy']=function(_0x2e8a85,_0x1a1fe4){return db[_0x80ba('0x29')][_0x80ba('0x4a')]({'where':{'id':_0x2e8a85[_0x80ba('0x4b')]['id']}})[_0x80ba('0x22')](handleEntityNotFound(_0x1a1fe4,null))['then'](removeEntity(_0x1a1fe4,null))[_0x80ba('0x3f')](handleError(_0x1a1fe4,null));};exports[_0x80ba('0x4c')]=function(_0x4f7e34,_0x1ff63c,_0x5436ea){if(_0x4f7e34[_0x80ba('0x49')]['id']){delete _0x4f7e34[_0x80ba('0x49')]['id'];}return db[_0x80ba('0x29')][_0x80ba('0x4a')]({'where':{'id':_0x4f7e34['params']['id']}})[_0x80ba('0x22')](handleEntityNotFound(_0x1ff63c,null))[_0x80ba('0x22')](function(_0x19d565){if(_0x19d565){_0x4f7e34['body']['TriggerAllId']=_0x19d565['id'];return db[_0x80ba('0x4d')][_0x80ba('0x43')](_0x4f7e34[_0x80ba('0x49')]);}})[_0x80ba('0x22')](respondWithResult(_0x1ff63c,null))[_0x80ba('0x3f')](handleError(_0x1ff63c,null));};exports['addAnyCondition']=function(_0x197cd8,_0x9fbe2f,_0x571205){if(_0x197cd8[_0x80ba('0x49')]['id']){delete _0x197cd8[_0x80ba('0x49')]['id'];}return db[_0x80ba('0x29')][_0x80ba('0x4a')]({'where':{'id':_0x197cd8[_0x80ba('0x4b')]['id']}})['then'](handleEntityNotFound(_0x9fbe2f,null))['then'](function(_0x3b02f8){if(_0x3b02f8){_0x197cd8[_0x80ba('0x49')][_0x80ba('0x4e')]=_0x3b02f8['id'];return db[_0x80ba('0x4d')][_0x80ba('0x43')](_0x197cd8[_0x80ba('0x49')]);}})['then'](respondWithResult(_0x9fbe2f,null))[_0x80ba('0x3f')](handleError(_0x9fbe2f,null));};exports[_0x80ba('0x4f')]=function(_0x2c5fd7,_0x29b21c,_0x3273b8){var _0x533da0={};var _0x1ef1c1={};var _0x33fcc8;var _0x443376;return db['Trigger'][_0x80ba('0x50')]({'where':{'id':_0x2c5fd7['params']['id']}})[_0x80ba('0x22')](handleEntityNotFound(_0x29b21c,null))[_0x80ba('0x22')](function(_0xe38050){if(_0xe38050){_0x33fcc8=_0xe38050;_0x1ef1c1[_0x80ba('0x2c')]=_[_0x80ba('0x2f')](db[_0x80ba('0x4d')][_0x80ba('0x2a')]);_0x1ef1c1[_0x80ba('0x2e')]=_[_0x80ba('0x2f')](_0x2c5fd7[_0x80ba('0x2e')]);_0x1ef1c1[_0x80ba('0x30')]=_[_0x80ba('0x31')](_0x1ef1c1[_0x80ba('0x2c')],_0x1ef1c1[_0x80ba('0x2e')]);_0x533da0[_0x80ba('0x33')]=_[_0x80ba('0x31')](_0x1ef1c1[_0x80ba('0x2c')],qs[_0x80ba('0x32')](_0x2c5fd7[_0x80ba('0x2e')][_0x80ba('0x32')]));_0x533da0[_0x80ba('0x33')]=_0x533da0[_0x80ba('0x33')][_0x80ba('0x34')]?_0x533da0[_0x80ba('0x33')]:_0x1ef1c1[_0x80ba('0x2c')];_0x533da0[_0x80ba('0x35')]=qs[_0x80ba('0x36')](_0x2c5fd7['query'][_0x80ba('0x36')]);_0x533da0['where']=qs[_0x80ba('0x30')](_['pick'](_0x2c5fd7['query'],_0x1ef1c1[_0x80ba('0x30')]));if(_0x2c5fd7[_0x80ba('0x2e')][_0x80ba('0x38')]){_0x533da0[_0x80ba('0x39')]=_[_0x80ba('0x3a')](_0x533da0['where'],{'$or':_[_0x80ba('0x2d')](_0x533da0[_0x80ba('0x33')],function(_0x1a2d5a){var _0xce2f7e={};_0xce2f7e[_0x1a2d5a]={'$like':'%'+_0x2c5fd7[_0x80ba('0x2e')][_0x80ba('0x38')]+'%'};return _0xce2f7e;})});}_0x533da0=_[_0x80ba('0x3a')]({},_0x533da0,_0x2c5fd7[_0x80ba('0x3c')]);return _0x33fcc8[_0x80ba('0x4f')](_0x533da0);}})[_0x80ba('0x22')](function(_0x3687ab){if(_0x3687ab){_0x443376=_0x3687ab[_0x80ba('0x34')];if(!_0x2c5fd7[_0x80ba('0x2e')][_0x80ba('0x51')](_0x80ba('0x52'))){_0x533da0[_0x80ba('0x1c')]=qs[_0x80ba('0x1c')](_0x2c5fd7[_0x80ba('0x2e')]['limit']);_0x533da0[_0x80ba('0x19')]=qs[_0x80ba('0x19')](_0x2c5fd7[_0x80ba('0x2e')][_0x80ba('0x19')]);}return _0x33fcc8[_0x80ba('0x4f')](_0x533da0);}})[_0x80ba('0x22')](function(_0x2150de){if(_0x2150de){return _0x2150de?{'count':_0x443376,'rows':_0x2150de}:null;}})['then'](respondWithResult(_0x29b21c,null))[_0x80ba('0x3f')](handleError(_0x29b21c,null));};exports[_0x80ba('0x53')]=function(_0x4fa25d,_0x46241f,_0x4ffcb8){var _0x4c81a2={};var _0x4c3ab7={};var _0x1ec75f;var _0x3cdd63;return db[_0x80ba('0x29')]['findOne']({'where':{'id':_0x4fa25d[_0x80ba('0x4b')]['id']}})[_0x80ba('0x22')](handleEntityNotFound(_0x46241f,null))['then'](function(_0x116c25){if(_0x116c25){_0x1ec75f=_0x116c25;_0x4c3ab7[_0x80ba('0x2c')]=_['keys'](db[_0x80ba('0x4d')]['rawAttributes']);_0x4c3ab7[_0x80ba('0x2e')]=_[_0x80ba('0x2f')](_0x4fa25d['query']);_0x4c3ab7[_0x80ba('0x30')]=_[_0x80ba('0x31')](_0x4c3ab7[_0x80ba('0x2c')],_0x4c3ab7[_0x80ba('0x2e')]);_0x4c81a2[_0x80ba('0x33')]=_[_0x80ba('0x31')](_0x4c3ab7[_0x80ba('0x2c')],qs[_0x80ba('0x32')](_0x4fa25d[_0x80ba('0x2e')][_0x80ba('0x32')]));_0x4c81a2['attributes']=_0x4c81a2['attributes'][_0x80ba('0x34')]?_0x4c81a2[_0x80ba('0x33')]:_0x4c3ab7[_0x80ba('0x2c')];_0x4c81a2['order']=qs['sort'](_0x4fa25d[_0x80ba('0x2e')][_0x80ba('0x36')]);_0x4c81a2[_0x80ba('0x39')]=qs['filters'](_[_0x80ba('0x37')](_0x4fa25d['query'],_0x4c3ab7[_0x80ba('0x30')]));if(_0x4fa25d[_0x80ba('0x2e')][_0x80ba('0x38')]){_0x4c81a2[_0x80ba('0x39')]=_[_0x80ba('0x3a')](_0x4c81a2[_0x80ba('0x39')],{'$or':_[_0x80ba('0x2d')](_0x4c81a2[_0x80ba('0x33')],function(_0x1b46f3){var _0x25b52c={};_0x25b52c[_0x1b46f3]={'$like':'%'+_0x4fa25d['query'][_0x80ba('0x38')]+'%'};return _0x25b52c;})});}_0x4c81a2=_[_0x80ba('0x3a')]({},_0x4c81a2,_0x4fa25d[_0x80ba('0x3c')]);return _0x1ec75f[_0x80ba('0x53')](_0x4c81a2);}})[_0x80ba('0x22')](function(_0x3e57fa){if(_0x3e57fa){_0x3cdd63=_0x3e57fa[_0x80ba('0x34')];if(!_0x4fa25d[_0x80ba('0x2e')][_0x80ba('0x51')]('nolimit')){_0x4c81a2[_0x80ba('0x1c')]=qs['limit'](_0x4fa25d[_0x80ba('0x2e')][_0x80ba('0x1c')]);_0x4c81a2['offset']=qs[_0x80ba('0x19')](_0x4fa25d[_0x80ba('0x2e')][_0x80ba('0x19')]);}return _0x1ec75f[_0x80ba('0x53')](_0x4c81a2);}})[_0x80ba('0x22')](function(_0x816c90){if(_0x816c90){return _0x816c90?{'count':_0x3cdd63,'rows':_0x816c90}:null;}})[_0x80ba('0x22')](respondWithResult(_0x46241f,null))[_0x80ba('0x3f')](handleError(_0x46241f,null));};exports[_0x80ba('0x54')]=function(_0x5399f8,_0x397c7e,_0x112c92){if(_0x5399f8[_0x80ba('0x49')]['id']){delete _0x5399f8[_0x80ba('0x49')]['id'];}return db[_0x80ba('0x29')]['find']({'where':{'id':_0x5399f8[_0x80ba('0x4b')]['id']}})[_0x80ba('0x22')](handleEntityNotFound(_0x397c7e,null))[_0x80ba('0x22')](function(_0x1068a3){if(_0x1068a3){_0x5399f8['body']['TriggerId']=_0x1068a3['id'];return db['Action']['create'](_0x5399f8[_0x80ba('0x49')]);}})[_0x80ba('0x22')](respondWithResult(_0x397c7e,null))['catch'](handleError(_0x397c7e,null));};exports[_0x80ba('0x55')]=function(_0x116859,_0x5cffe6,_0x268d0c){var _0x35494b={};var _0x1220c9={};var _0xc12234;var _0x5c1b31;return db[_0x80ba('0x29')][_0x80ba('0x50')]({'where':{'id':_0x116859['params']['id']}})[_0x80ba('0x22')](handleEntityNotFound(_0x5cffe6,null))[_0x80ba('0x22')](function(_0x3138e7){if(_0x3138e7){_0xc12234=_0x3138e7;_0x1220c9[_0x80ba('0x2c')]=_[_0x80ba('0x2f')](db[_0x80ba('0x56')][_0x80ba('0x2a')]);_0x1220c9['query']=_[_0x80ba('0x2f')](_0x116859['query']);_0x1220c9[_0x80ba('0x30')]=_[_0x80ba('0x31')](_0x1220c9['model'],_0x1220c9[_0x80ba('0x2e')]);_0x35494b[_0x80ba('0x33')]=_[_0x80ba('0x31')](_0x1220c9['model'],qs[_0x80ba('0x32')](_0x116859[_0x80ba('0x2e')]['fields']));_0x35494b[_0x80ba('0x33')]=_0x35494b['attributes'][_0x80ba('0x34')]?_0x35494b['attributes']:_0x1220c9[_0x80ba('0x2c')];_0x35494b[_0x80ba('0x35')]=qs[_0x80ba('0x36')](_0x116859[_0x80ba('0x2e')][_0x80ba('0x36')]);_0x35494b[_0x80ba('0x39')]=qs[_0x80ba('0x30')](_['pick'](_0x116859[_0x80ba('0x2e')],_0x1220c9[_0x80ba('0x30')]));if(_0x116859[_0x80ba('0x2e')]['filter']){_0x35494b[_0x80ba('0x39')]=_[_0x80ba('0x3a')](_0x35494b[_0x80ba('0x39')],{'$or':_[_0x80ba('0x2d')](_0x35494b[_0x80ba('0x33')],function(_0x127ab5){var _0x4f4b7f={};_0x4f4b7f[_0x127ab5]={'$like':'%'+_0x116859[_0x80ba('0x2e')][_0x80ba('0x38')]+'%'};return _0x4f4b7f;})});}_0x35494b=_[_0x80ba('0x3a')]({},_0x35494b,_0x116859[_0x80ba('0x3c')]);return _0xc12234[_0x80ba('0x55')](_0x35494b);}})['then'](function(_0x504131){if(_0x504131){_0x5c1b31=_0x504131[_0x80ba('0x34')];if(!_0x116859[_0x80ba('0x2e')][_0x80ba('0x51')](_0x80ba('0x52'))){_0x35494b['limit']=qs[_0x80ba('0x1c')](_0x116859['query'][_0x80ba('0x1c')]);_0x35494b[_0x80ba('0x19')]=qs[_0x80ba('0x19')](_0x116859['query'][_0x80ba('0x19')]);}return _0xc12234[_0x80ba('0x55')](_0x35494b);}})[_0x80ba('0x22')](function(_0xc0bfea){if(_0xc0bfea){return _0xc0bfea?{'count':_0x5c1b31,'rows':_0xc0bfea}:null;}})[_0x80ba('0x22')](respondWithResult(_0x5cffe6,null))['catch'](handleError(_0x5cffe6,null));}; \ No newline at end of file +var _0xc5f9=['nolimit','sort','filter','merge','where','VIRTUAL','options','includeAll','Trigger','findAll','rows','catch','show','params','include','find','create','user','get','Triggers','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','order','pick','getAnyConditions','TriggerId','Action','getActions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','rawAttributes','fieldName','type','keys','filters','intersection','model','attributes','fields','query','length','hasOwnProperty'];(function(_0x2702f5,_0x5d5195){var _0x51c631=function(_0x1e81b0){while(--_0x1e81b0){_0x2702f5['push'](_0x2702f5['shift']());}};_0x51c631(++_0x5d5195);}(_0xc5f9,0xdb));var _0x9c5f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc5f9[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x9c5f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9c5f('0x1'));var jsonpatch=require(_0x9c5f('0x2'));var rp=require(_0x9c5f('0x3'));var moment=require(_0x9c5f('0x4'));var BPromise=require(_0x9c5f('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9c5f('0x6'));var sox=require(_0x9c5f('0x7'));var csv=require('to-csv');var ejs=require(_0x9c5f('0x8'));var fs=require('fs');var fs_extra=require(_0x9c5f('0x9'));var _=require(_0x9c5f('0xa'));var squel=require(_0x9c5f('0xb'));var crypto=require('crypto');var jsforce=require(_0x9c5f('0xc'));var deskjs=require(_0x9c5f('0xd'));var toCsv=require(_0x9c5f('0xe'));var querystring=require('querystring');var Papa=require(_0x9c5f('0xf'));var Redis=require(_0x9c5f('0x10'));var authService=require(_0x9c5f('0x11'));var qs=require(_0x9c5f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9c5f('0x13'))(_0x9c5f('0x14'));var utils=require(_0x9c5f('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9c5f('0x16'))['db'];function respondWithStatusCode(_0x48e4c5,_0x31b9bf){_0x31b9bf=_0x31b9bf||0xcc;return function(_0x14f466){if(_0x14f466){return _0x48e4c5[_0x9c5f('0x17')](_0x31b9bf);}return _0x48e4c5[_0x9c5f('0x18')](_0x31b9bf)[_0x9c5f('0x19')]();};}function respondWithResult(_0x594a44,_0x394aa6){_0x394aa6=_0x394aa6||0xc8;return function(_0x45fdc3){if(_0x45fdc3){return _0x594a44['status'](_0x394aa6)[_0x9c5f('0x1a')](_0x45fdc3);}};}function respondWithFilteredResult(_0x8641c5,_0x3b4c13){return function(_0x17a225){if(_0x17a225){var _0x25a88b=typeof _0x3b4c13[_0x9c5f('0x1b')]===_0x9c5f('0x1c')&&typeof _0x3b4c13[_0x9c5f('0x1d')]===_0x9c5f('0x1c');var _0x358758=_0x17a225[_0x9c5f('0x1e')];var _0x4906b4=_0x25a88b?0x0:_0x3b4c13['offset'];var _0x568dd2=_0x25a88b?_0x17a225[_0x9c5f('0x1e')]:_0x3b4c13['offset']+_0x3b4c13[_0x9c5f('0x1d')];var _0x20a290;if(_0x568dd2>=_0x358758){_0x568dd2=_0x358758;_0x20a290=0xc8;}else{_0x20a290=0xce;}_0x8641c5['status'](_0x20a290);return _0x8641c5['set'](_0x9c5f('0x1f'),_0x4906b4+'-'+_0x568dd2+'/'+_0x358758)['json'](_0x17a225);}return null;};}function patchUpdates(_0x3ce950){return function(_0x2b6866){try{jsonpatch[_0x9c5f('0x20')](_0x2b6866,_0x3ce950,!![]);}catch(_0x408435){return BPromise[_0x9c5f('0x21')](_0x408435);}return _0x2b6866[_0x9c5f('0x22')]();};}function saveUpdates(_0x4d7c5a,_0xfe855e){return function(_0x17a194){if(_0x17a194){return _0x17a194[_0x9c5f('0x23')](_0x4d7c5a)[_0x9c5f('0x24')](function(_0x527ad1){return _0x527ad1;});}return null;};}function removeEntity(_0xc80be1,_0x95625f){return function(_0x2e7991){if(_0x2e7991){return _0x2e7991['destroy']()[_0x9c5f('0x24')](function(){var _0xe3b5f3=_0x2e7991['get']({'plain':!![]});var _0x5d8e80='Triggers';return db['UserProfileResource'][_0x9c5f('0x25')]({'where':{'type':_0x5d8e80,'resourceId':_0xe3b5f3['id']}})[_0x9c5f('0x24')](function(){return _0x2e7991;});})[_0x9c5f('0x24')](function(){_0xc80be1[_0x9c5f('0x18')](0xcc)[_0x9c5f('0x19')]();});}};}function handleEntityNotFound(_0x547f52,_0x4725d9){return function(_0x3bb6de){if(!_0x3bb6de){_0x547f52['sendStatus'](0x194);}return _0x3bb6de;};}function handleError(_0x7ba27d,_0x43c52d){_0x43c52d=_0x43c52d||0x1f4;return function(_0x143585){logger['error'](_0x143585[_0x9c5f('0x26')]);if(_0x143585[_0x9c5f('0x27')]){delete _0x143585[_0x9c5f('0x27')];}_0x7ba27d[_0x9c5f('0x18')](_0x43c52d)['send'](_0x143585);};}exports[_0x9c5f('0x28')]=function(_0x3a650d,_0x3dc135){var _0xbf0b24={},_0x1155b3={},_0x3fb009={'count':0x0,'rows':[]};var _0x15d481=_[_0x9c5f('0x29')](db['Trigger'][_0x9c5f('0x2a')],function(_0x218e29){return{'name':_0x218e29[_0x9c5f('0x2b')],'type':_0x218e29[_0x9c5f('0x2c')]['key']};});_0x1155b3['model']=_['map'](_0x15d481,'name');_0x1155b3['query']=_[_0x9c5f('0x2d')](_0x3a650d['query']);_0x1155b3[_0x9c5f('0x2e')]=_[_0x9c5f('0x2f')](_0x1155b3[_0x9c5f('0x30')],_0x1155b3['query']);_0xbf0b24[_0x9c5f('0x31')]=_[_0x9c5f('0x2f')](_0x1155b3[_0x9c5f('0x30')],qs[_0x9c5f('0x32')](_0x3a650d[_0x9c5f('0x33')][_0x9c5f('0x32')]));_0xbf0b24[_0x9c5f('0x31')]=_0xbf0b24['attributes'][_0x9c5f('0x34')]?_0xbf0b24['attributes']:_0x1155b3[_0x9c5f('0x30')];if(!_0x3a650d[_0x9c5f('0x33')][_0x9c5f('0x35')](_0x9c5f('0x36'))){_0xbf0b24[_0x9c5f('0x1d')]=qs[_0x9c5f('0x1d')](_0x3a650d['query'][_0x9c5f('0x1d')]);_0xbf0b24[_0x9c5f('0x1b')]=qs[_0x9c5f('0x1b')](_0x3a650d[_0x9c5f('0x33')][_0x9c5f('0x1b')]);}_0xbf0b24['order']=qs[_0x9c5f('0x37')](_0x3a650d[_0x9c5f('0x33')]['sort']);_0xbf0b24['where']=qs[_0x9c5f('0x2e')](_['pick'](_0x3a650d[_0x9c5f('0x33')],_0x1155b3[_0x9c5f('0x2e')]),_0x15d481);if(_0x3a650d[_0x9c5f('0x33')][_0x9c5f('0x38')]){_0xbf0b24['where']=_[_0x9c5f('0x39')](_0xbf0b24[_0x9c5f('0x3a')],{'$or':_[_0x9c5f('0x29')](_0x15d481,function(_0x45bad6){if(_0x45bad6[_0x9c5f('0x2c')]!==_0x9c5f('0x3b')){var _0x3f381a={};_0x3f381a[_0x45bad6['name']]={'$like':'%'+_0x3a650d[_0x9c5f('0x33')][_0x9c5f('0x38')]+'%'};return _0x3f381a;}})});}_0xbf0b24=_['merge']({},_0xbf0b24,_0x3a650d[_0x9c5f('0x3c')]);var _0x1914a6={'where':_0xbf0b24[_0x9c5f('0x3a')]};return db['Trigger'][_0x9c5f('0x1e')](_0x1914a6)[_0x9c5f('0x24')](function(_0x468107){_0x3fb009[_0x9c5f('0x1e')]=_0x468107;if(_0x3a650d['query'][_0x9c5f('0x3d')]){_0xbf0b24['include']=[{'all':!![]}];}return db[_0x9c5f('0x3e')][_0x9c5f('0x3f')](_0xbf0b24);})[_0x9c5f('0x24')](function(_0x46d063){_0x3fb009[_0x9c5f('0x40')]=_0x46d063;return _0x3fb009;})['then'](respondWithFilteredResult(_0x3dc135,_0xbf0b24))[_0x9c5f('0x41')](handleError(_0x3dc135,null));};exports[_0x9c5f('0x42')]=function(_0x3e84f0,_0x3a3214){var _0x57fde7={'raw':![],'where':{'id':_0x3e84f0[_0x9c5f('0x43')]['id']}},_0x5a6402={};_0x5a6402['model']=_[_0x9c5f('0x2d')](db[_0x9c5f('0x3e')][_0x9c5f('0x2a')]);_0x5a6402['query']=_['keys'](_0x3e84f0['query']);_0x5a6402[_0x9c5f('0x2e')]=_['intersection'](_0x5a6402[_0x9c5f('0x30')],_0x5a6402['query']);_0x57fde7[_0x9c5f('0x31')]=_[_0x9c5f('0x2f')](_0x5a6402[_0x9c5f('0x30')],qs['fields'](_0x3e84f0[_0x9c5f('0x33')]['fields']));_0x57fde7[_0x9c5f('0x31')]=_0x57fde7[_0x9c5f('0x31')][_0x9c5f('0x34')]?_0x57fde7[_0x9c5f('0x31')]:_0x5a6402[_0x9c5f('0x30')];if(_0x3e84f0['query'][_0x9c5f('0x3d')]){_0x57fde7[_0x9c5f('0x44')]=[{'all':!![]}];}_0x57fde7=_[_0x9c5f('0x39')]({},_0x57fde7,_0x3e84f0[_0x9c5f('0x3c')]);return db[_0x9c5f('0x3e')][_0x9c5f('0x45')](_0x57fde7)[_0x9c5f('0x24')](handleEntityNotFound(_0x3a3214,null))[_0x9c5f('0x24')](respondWithResult(_0x3a3214,null))['catch'](handleError(_0x3a3214,null));};exports[_0x9c5f('0x46')]=function(_0x2cc5aa,_0x3f8ff4){return db[_0x9c5f('0x3e')][_0x9c5f('0x46')](_0x2cc5aa['body'],{})[_0x9c5f('0x24')](function(_0x197344){var _0x2644d7=_0x2cc5aa[_0x9c5f('0x47')][_0x9c5f('0x48')]({'plain':!![]});if(!_0x2644d7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2644d7['role']===_0x9c5f('0x47')){var _0x389800=_0x197344[_0x9c5f('0x48')]({'plain':!![]});var _0x1fdc0e=_0x9c5f('0x49');return db[_0x9c5f('0x4a')][_0x9c5f('0x45')]({'where':{'name':_0x1fdc0e,'userProfileId':_0x2644d7[_0x9c5f('0x4b')]},'raw':!![]})['then'](function(_0x5686a0){if(_0x5686a0&&_0x5686a0[_0x9c5f('0x4c')]===0x0){return db['UserProfileResource'][_0x9c5f('0x46')]({'name':_0x389800['name'],'resourceId':_0x389800['id'],'type':_0x5686a0[_0x9c5f('0x27')],'sectionId':_0x5686a0['id']},{})[_0x9c5f('0x24')](function(){return _0x197344;});}else{return _0x197344;}})[_0x9c5f('0x41')](function(_0x20f85a){logger[_0x9c5f('0x4d')](_0x9c5f('0x4e'),_0x20f85a);throw _0x20f85a;});}return _0x197344;})[_0x9c5f('0x24')](respondWithResult(_0x3f8ff4,0xc9))[_0x9c5f('0x41')](handleError(_0x3f8ff4,null));};exports[_0x9c5f('0x23')]=function(_0x4f155a,_0x484968){if(_0x4f155a[_0x9c5f('0x4f')]['id']){delete _0x4f155a[_0x9c5f('0x4f')]['id'];}return db['Trigger']['find']({'where':{'id':_0x4f155a[_0x9c5f('0x43')]['id']}})['then'](handleEntityNotFound(_0x484968,null))[_0x9c5f('0x24')](saveUpdates(_0x4f155a['body'],null))[_0x9c5f('0x24')](respondWithResult(_0x484968,null))[_0x9c5f('0x41')](handleError(_0x484968,null));};exports[_0x9c5f('0x25')]=function(_0x180dd6,_0x48c5aa){return db['Trigger'][_0x9c5f('0x45')]({'where':{'id':_0x180dd6[_0x9c5f('0x43')]['id']}})['then'](handleEntityNotFound(_0x48c5aa,null))[_0x9c5f('0x24')](removeEntity(_0x48c5aa,null))['catch'](handleError(_0x48c5aa,null));};exports['addAllCondition']=function(_0x22da94,_0x2f0860,_0x20dc0a){if(_0x22da94[_0x9c5f('0x4f')]['id']){delete _0x22da94[_0x9c5f('0x4f')]['id'];}return db[_0x9c5f('0x3e')]['find']({'where':{'id':_0x22da94[_0x9c5f('0x43')]['id']}})[_0x9c5f('0x24')](handleEntityNotFound(_0x2f0860,null))[_0x9c5f('0x24')](function(_0x21e90e){if(_0x21e90e){_0x22da94[_0x9c5f('0x4f')]['TriggerAllId']=_0x21e90e['id'];return db[_0x9c5f('0x50')]['create'](_0x22da94[_0x9c5f('0x4f')]);}})[_0x9c5f('0x24')](respondWithResult(_0x2f0860,null))[_0x9c5f('0x41')](handleError(_0x2f0860,null));};exports[_0x9c5f('0x51')]=function(_0x3344a2,_0x1c28a3,_0x3b18e0){if(_0x3344a2[_0x9c5f('0x4f')]['id']){delete _0x3344a2[_0x9c5f('0x4f')]['id'];}return db['Trigger'][_0x9c5f('0x45')]({'where':{'id':_0x3344a2[_0x9c5f('0x43')]['id']}})['then'](handleEntityNotFound(_0x1c28a3,null))[_0x9c5f('0x24')](function(_0x293b1a){if(_0x293b1a){_0x3344a2[_0x9c5f('0x4f')][_0x9c5f('0x52')]=_0x293b1a['id'];return db[_0x9c5f('0x50')][_0x9c5f('0x46')](_0x3344a2[_0x9c5f('0x4f')]);}})[_0x9c5f('0x24')](respondWithResult(_0x1c28a3,null))[_0x9c5f('0x41')](handleError(_0x1c28a3,null));};exports[_0x9c5f('0x53')]=function(_0x5495eb,_0x1b7121,_0x15b427){var _0x753d40={};var _0x2dc3d1={};var _0x4cbba0;var _0x5d6829;return db[_0x9c5f('0x3e')][_0x9c5f('0x54')]({'where':{'id':_0x5495eb['params']['id']}})[_0x9c5f('0x24')](handleEntityNotFound(_0x1b7121,null))[_0x9c5f('0x24')](function(_0x2740ec){if(_0x2740ec){_0x4cbba0=_0x2740ec;_0x2dc3d1['model']=_['keys'](db['Condition'][_0x9c5f('0x2a')]);_0x2dc3d1[_0x9c5f('0x33')]=_['keys'](_0x5495eb['query']);_0x2dc3d1[_0x9c5f('0x2e')]=_[_0x9c5f('0x2f')](_0x2dc3d1['model'],_0x2dc3d1[_0x9c5f('0x33')]);_0x753d40[_0x9c5f('0x31')]=_[_0x9c5f('0x2f')](_0x2dc3d1[_0x9c5f('0x30')],qs[_0x9c5f('0x32')](_0x5495eb['query'][_0x9c5f('0x32')]));_0x753d40[_0x9c5f('0x31')]=_0x753d40[_0x9c5f('0x31')]['length']?_0x753d40[_0x9c5f('0x31')]:_0x2dc3d1[_0x9c5f('0x30')];_0x753d40[_0x9c5f('0x55')]=qs[_0x9c5f('0x37')](_0x5495eb[_0x9c5f('0x33')][_0x9c5f('0x37')]);_0x753d40['where']=qs[_0x9c5f('0x2e')](_[_0x9c5f('0x56')](_0x5495eb[_0x9c5f('0x33')],_0x2dc3d1['filters']));if(_0x5495eb[_0x9c5f('0x33')][_0x9c5f('0x38')]){_0x753d40['where']=_[_0x9c5f('0x39')](_0x753d40[_0x9c5f('0x3a')],{'$or':_['map'](_0x753d40[_0x9c5f('0x31')],function(_0x1373d6){var _0x1c476f={};_0x1c476f[_0x1373d6]={'$like':'%'+_0x5495eb[_0x9c5f('0x33')]['filter']+'%'};return _0x1c476f;})});}_0x753d40=_[_0x9c5f('0x39')]({},_0x753d40,_0x5495eb['options']);return _0x4cbba0['getAllConditions'](_0x753d40);}})[_0x9c5f('0x24')](function(_0x4800a7){if(_0x4800a7){_0x5d6829=_0x4800a7[_0x9c5f('0x34')];if(!_0x5495eb['query'][_0x9c5f('0x35')](_0x9c5f('0x36'))){_0x753d40['limit']=qs['limit'](_0x5495eb['query'][_0x9c5f('0x1d')]);_0x753d40[_0x9c5f('0x1b')]=qs['offset'](_0x5495eb[_0x9c5f('0x33')][_0x9c5f('0x1b')]);}return _0x4cbba0[_0x9c5f('0x53')](_0x753d40);}})[_0x9c5f('0x24')](function(_0x3f4179){if(_0x3f4179){return _0x3f4179?{'count':_0x5d6829,'rows':_0x3f4179}:null;}})[_0x9c5f('0x24')](respondWithResult(_0x1b7121,null))[_0x9c5f('0x41')](handleError(_0x1b7121,null));};exports[_0x9c5f('0x57')]=function(_0x144896,_0x2fd102,_0x5f438f){var _0x3b0529={};var _0x38dbce={};var _0x58b9fc;var _0x3ea56f;return db[_0x9c5f('0x3e')]['findOne']({'where':{'id':_0x144896['params']['id']}})[_0x9c5f('0x24')](handleEntityNotFound(_0x2fd102,null))[_0x9c5f('0x24')](function(_0x50760a){if(_0x50760a){_0x58b9fc=_0x50760a;_0x38dbce[_0x9c5f('0x30')]=_['keys'](db[_0x9c5f('0x50')]['rawAttributes']);_0x38dbce[_0x9c5f('0x33')]=_['keys'](_0x144896['query']);_0x38dbce[_0x9c5f('0x2e')]=_[_0x9c5f('0x2f')](_0x38dbce['model'],_0x38dbce[_0x9c5f('0x33')]);_0x3b0529[_0x9c5f('0x31')]=_[_0x9c5f('0x2f')](_0x38dbce[_0x9c5f('0x30')],qs[_0x9c5f('0x32')](_0x144896['query'][_0x9c5f('0x32')]));_0x3b0529[_0x9c5f('0x31')]=_0x3b0529[_0x9c5f('0x31')][_0x9c5f('0x34')]?_0x3b0529[_0x9c5f('0x31')]:_0x38dbce[_0x9c5f('0x30')];_0x3b0529[_0x9c5f('0x55')]=qs['sort'](_0x144896[_0x9c5f('0x33')][_0x9c5f('0x37')]);_0x3b0529[_0x9c5f('0x3a')]=qs[_0x9c5f('0x2e')](_[_0x9c5f('0x56')](_0x144896[_0x9c5f('0x33')],_0x38dbce[_0x9c5f('0x2e')]));if(_0x144896[_0x9c5f('0x33')][_0x9c5f('0x38')]){_0x3b0529[_0x9c5f('0x3a')]=_['merge'](_0x3b0529[_0x9c5f('0x3a')],{'$or':_[_0x9c5f('0x29')](_0x3b0529[_0x9c5f('0x31')],function(_0x230900){var _0x7f2af4={};_0x7f2af4[_0x230900]={'$like':'%'+_0x144896['query'][_0x9c5f('0x38')]+'%'};return _0x7f2af4;})});}_0x3b0529=_[_0x9c5f('0x39')]({},_0x3b0529,_0x144896[_0x9c5f('0x3c')]);return _0x58b9fc[_0x9c5f('0x57')](_0x3b0529);}})[_0x9c5f('0x24')](function(_0x1e6132){if(_0x1e6132){_0x3ea56f=_0x1e6132['length'];if(!_0x144896[_0x9c5f('0x33')]['hasOwnProperty']('nolimit')){_0x3b0529['limit']=qs[_0x9c5f('0x1d')](_0x144896[_0x9c5f('0x33')][_0x9c5f('0x1d')]);_0x3b0529[_0x9c5f('0x1b')]=qs['offset'](_0x144896[_0x9c5f('0x33')]['offset']);}return _0x58b9fc[_0x9c5f('0x57')](_0x3b0529);}})[_0x9c5f('0x24')](function(_0x166d07){if(_0x166d07){return _0x166d07?{'count':_0x3ea56f,'rows':_0x166d07}:null;}})[_0x9c5f('0x24')](respondWithResult(_0x2fd102,null))[_0x9c5f('0x41')](handleError(_0x2fd102,null));};exports['addAction']=function(_0x225cc0,_0x2211b1,_0xe18034){if(_0x225cc0['body']['id']){delete _0x225cc0[_0x9c5f('0x4f')]['id'];}return db[_0x9c5f('0x3e')][_0x9c5f('0x45')]({'where':{'id':_0x225cc0[_0x9c5f('0x43')]['id']}})['then'](handleEntityNotFound(_0x2211b1,null))['then'](function(_0x1b0385){if(_0x1b0385){_0x225cc0[_0x9c5f('0x4f')][_0x9c5f('0x58')]=_0x1b0385['id'];return db[_0x9c5f('0x59')][_0x9c5f('0x46')](_0x225cc0[_0x9c5f('0x4f')]);}})[_0x9c5f('0x24')](respondWithResult(_0x2211b1,null))[_0x9c5f('0x41')](handleError(_0x2211b1,null));};exports[_0x9c5f('0x5a')]=function(_0x3837aa,_0x56203c,_0x2bff03){var _0x40eeda={};var _0x5b7710={};var _0x1fa4c1;var _0x3fadf5;return db[_0x9c5f('0x3e')][_0x9c5f('0x54')]({'where':{'id':_0x3837aa[_0x9c5f('0x43')]['id']}})[_0x9c5f('0x24')](handleEntityNotFound(_0x56203c,null))['then'](function(_0x53ae3f){if(_0x53ae3f){_0x1fa4c1=_0x53ae3f;_0x5b7710[_0x9c5f('0x30')]=_[_0x9c5f('0x2d')](db[_0x9c5f('0x59')][_0x9c5f('0x2a')]);_0x5b7710['query']=_['keys'](_0x3837aa['query']);_0x5b7710[_0x9c5f('0x2e')]=_[_0x9c5f('0x2f')](_0x5b7710[_0x9c5f('0x30')],_0x5b7710[_0x9c5f('0x33')]);_0x40eeda[_0x9c5f('0x31')]=_['intersection'](_0x5b7710['model'],qs[_0x9c5f('0x32')](_0x3837aa[_0x9c5f('0x33')][_0x9c5f('0x32')]));_0x40eeda['attributes']=_0x40eeda[_0x9c5f('0x31')][_0x9c5f('0x34')]?_0x40eeda[_0x9c5f('0x31')]:_0x5b7710[_0x9c5f('0x30')];_0x40eeda[_0x9c5f('0x55')]=qs[_0x9c5f('0x37')](_0x3837aa[_0x9c5f('0x33')][_0x9c5f('0x37')]);_0x40eeda[_0x9c5f('0x3a')]=qs[_0x9c5f('0x2e')](_[_0x9c5f('0x56')](_0x3837aa[_0x9c5f('0x33')],_0x5b7710[_0x9c5f('0x2e')]));if(_0x3837aa['query'][_0x9c5f('0x38')]){_0x40eeda[_0x9c5f('0x3a')]=_[_0x9c5f('0x39')](_0x40eeda[_0x9c5f('0x3a')],{'$or':_[_0x9c5f('0x29')](_0x40eeda['attributes'],function(_0x1d2f5e){var _0x2c0772={};_0x2c0772[_0x1d2f5e]={'$like':'%'+_0x3837aa['query'][_0x9c5f('0x38')]+'%'};return _0x2c0772;})});}_0x40eeda=_['merge']({},_0x40eeda,_0x3837aa[_0x9c5f('0x3c')]);return _0x1fa4c1[_0x9c5f('0x5a')](_0x40eeda);}})[_0x9c5f('0x24')](function(_0x1bf0cf){if(_0x1bf0cf){_0x3fadf5=_0x1bf0cf['length'];if(!_0x3837aa['query'][_0x9c5f('0x35')](_0x9c5f('0x36'))){_0x40eeda[_0x9c5f('0x1d')]=qs[_0x9c5f('0x1d')](_0x3837aa[_0x9c5f('0x33')]['limit']);_0x40eeda[_0x9c5f('0x1b')]=qs[_0x9c5f('0x1b')](_0x3837aa[_0x9c5f('0x33')][_0x9c5f('0x1b')]);}return _0x1fa4c1[_0x9c5f('0x5a')](_0x40eeda);}})[_0x9c5f('0x24')](function(_0x3e6818){if(_0x3e6818){return _0x3e6818?{'count':_0x3fadf5,'rows':_0x3e6818}:null;}})[_0x9c5f('0x24')](respondWithResult(_0x56203c,null))[_0x9c5f('0x41')](handleError(_0x56203c,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 866b683..06e4cbe 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 _0x1f38=['./trigger.attributes','exports','define','Trigger','tools_triggers','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x8c5ce5,_0x31154b){var _0x30769b=function(_0x63e626){while(--_0x63e626){_0x8c5ce5['push'](_0x8c5ce5['shift']());}};_0x30769b(++_0x31154b);}(_0x1f38,0xd7));var _0x81f3=function(_0x5a0693,_0x5e80b8){_0x5a0693=_0x5a0693-0x0;var _0x5daa64=_0x1f38[_0x5a0693];return _0x5daa64;};'use strict';var _=require(_0x81f3('0x0'));var util=require(_0x81f3('0x1'));var logger=require(_0x81f3('0x2'))(_0x81f3('0x3'));var moment=require(_0x81f3('0x4'));var BPromise=require(_0x81f3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x81f3('0x6'));var rimraf=require(_0x81f3('0x7'));var config=require(_0x81f3('0x8'));var attributes=require(_0x81f3('0x9'));module[_0x81f3('0xa')]=function(_0x59e5ae,_0x39633a){return _0x59e5ae[_0x81f3('0xb')](_0x81f3('0xc'),attributes,{'tableName':_0x81f3('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ec9=['exports','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment'];(function(_0x1420fc,_0x485b44){var _0x2e155d=function(_0x35e0e0){while(--_0x35e0e0){_0x1420fc['push'](_0x1420fc['shift']());}};_0x2e155d(++_0x485b44);}(_0x6ec9,0x174));var _0x96ec=function(_0x161593,_0x212b7e){_0x161593=_0x161593-0x0;var _0x1ab1e2=_0x6ec9[_0x161593];return _0x1ab1e2;};'use strict';var _=require(_0x96ec('0x0'));var util=require('util');var logger=require(_0x96ec('0x1'))('api');var moment=require(_0x96ec('0x2'));var BPromise=require('bluebird');var rp=require(_0x96ec('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x96ec('0x4'));var config=require(_0x96ec('0x5'));var attributes=require('./trigger.attributes');module[_0x96ec('0x6')]=function(_0x41a215,_0x2fcbb7){return _0x41a215['define']('Trigger',attributes,{'tableName':'tools_triggers','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 4792586..96aca05 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 _0x7294=['result','catch','GetTrigger','Trigger','options','raw','where','attributes','limit','include','map','model','stringify','ShowTrigger','find','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','error','Trigger,\x20%s,\x20%s','message'];(function(_0x340d75,_0x561cb0){var _0x3f1114=function(_0x2e2bcf){while(--_0x2e2bcf){_0x340d75['push'](_0x340d75['shift']());}};_0x3f1114(++_0x561cb0);}(_0x7294,0x1d6));var _0x4729=function(_0x2c77e7,_0x244dda){_0x2c77e7=_0x2c77e7-0x0;var _0x4d6295=_0x7294[_0x2c77e7];return _0x4d6295;};'use strict';var _=require(_0x4729('0x0'));var util=require('util');var moment=require(_0x4729('0x1'));var BPromise=require(_0x4729('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4729('0x3'));var db=require(_0x4729('0x4'))['db'];var utils=require(_0x4729('0x5'));var logger=require('../../config/logger')(_0x4729('0x6'));var config=require(_0x4729('0x7'));var jayson=require(_0x4729('0x8'));var client=jayson[_0x4729('0x9')][_0x4729('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x487028,_0x31c889,_0x5118b2){return new BPromise(function(_0x4a7a04,_0x56da01){return client[_0x4729('0xb')](_0x487028,_0x5118b2)[_0x4729('0xc')](function(_0x49975b){logger[_0x4729('0xd')]('Trigger,\x20%s,\x20%s',_0x31c889,_0x4729('0xe'));logger[_0x4729('0xf')](_0x4729('0x10'),_0x31c889,_0x4729('0xe'),JSON['stringify'](_0x49975b));if(_0x49975b[_0x4729('0x11')]){if(_0x49975b[_0x4729('0x11')]['code']===0x1f4){logger[_0x4729('0x11')](_0x4729('0x12'),_0x31c889,_0x49975b[_0x4729('0x11')][_0x4729('0x13')]);return _0x56da01(_0x49975b[_0x4729('0x11')][_0x4729('0x13')]);}logger[_0x4729('0x11')](_0x4729('0x12'),_0x31c889,_0x49975b[_0x4729('0x11')][_0x4729('0x13')]);return _0x4a7a04(_0x49975b[_0x4729('0x11')]['message']);}else{logger['info'](_0x4729('0x12'),_0x31c889,_0x4729('0xe'));_0x4a7a04(_0x49975b[_0x4729('0x14')][_0x4729('0x13')]);}})[_0x4729('0x15')](function(_0x406bca){logger[_0x4729('0x11')](_0x4729('0x12'),_0x31c889,_0x406bca);_0x56da01(_0x406bca);});});}exports[_0x4729('0x16')]=function(_0x215015){var _0x5f582b=this;return new Promise(function(_0x179993,_0x329292){return db[_0x4729('0x17')]['findAll']({'raw':_0x215015[_0x4729('0x18')]?_0x215015[_0x4729('0x18')][_0x4729('0x19')]===undefined?!![]:![]:!![],'where':_0x215015[_0x4729('0x18')]?_0x215015['options'][_0x4729('0x1a')]||null:null,'attributes':_0x215015[_0x4729('0x18')]?_0x215015[_0x4729('0x18')][_0x4729('0x1b')]||null:null,'limit':_0x215015[_0x4729('0x18')]?_0x215015[_0x4729('0x18')][_0x4729('0x1c')]||null:null,'include':_0x215015[_0x4729('0x18')]?_0x215015[_0x4729('0x18')][_0x4729('0x1d')]?_[_0x4729('0x1e')](_0x215015[_0x4729('0x18')][_0x4729('0x1d')],function(_0x46f231){return{'model':db[_0x46f231[_0x4729('0x1f')]],'as':_0x46f231['as'],'attributes':_0x46f231[_0x4729('0x1b')],'include':_0x46f231[_0x4729('0x1d')]?_[_0x4729('0x1e')](_0x46f231[_0x4729('0x1d')],function(_0x5116e6){return{'model':db[_0x5116e6[_0x4729('0x1f')]],'as':_0x5116e6['as'],'attributes':_0x5116e6[_0x4729('0x1b')],'include':_0x5116e6[_0x4729('0x1d')]?_[_0x4729('0x1e')](_0x5116e6[_0x4729('0x1d')],function(_0x472bf4){return{'model':db[_0x472bf4[_0x4729('0x1f')]],'as':_0x472bf4['as'],'attributes':_0x472bf4[_0x4729('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4729('0xc')](function(_0x38757d){logger['info']('GetTrigger',_0x215015);logger[_0x4729('0xf')](_0x4729('0x16'),_0x215015,JSON[_0x4729('0x20')](_0x38757d));_0x179993(_0x38757d);})['catch'](function(_0x2f73ad){logger['error'](_0x4729('0x16'),_0x2f73ad[_0x4729('0x13')],_0x215015);_0x329292(_0x5f582b[_0x4729('0x11')](0x1f4,_0x2f73ad[_0x4729('0x13')]));});});};exports[_0x4729('0x21')]=function(_0x3f150c){var _0x21dce0=this;return new Promise(function(_0x2ce26b,_0x469e07){return db['Trigger'][_0x4729('0x22')]({'raw':_0x3f150c[_0x4729('0x18')]?_0x3f150c['options'][_0x4729('0x19')]===undefined?!![]:![]:!![],'where':_0x3f150c['options']?_0x3f150c[_0x4729('0x18')][_0x4729('0x1a')]||null:null,'attributes':_0x3f150c['options']?_0x3f150c[_0x4729('0x18')][_0x4729('0x1b')]||null:null,'include':_0x3f150c[_0x4729('0x18')]?_0x3f150c[_0x4729('0x18')][_0x4729('0x1d')]?_['map'](_0x3f150c[_0x4729('0x18')][_0x4729('0x1d')],function(_0x972531){return{'model':db[_0x972531[_0x4729('0x1f')]],'as':_0x972531['as'],'attributes':_0x972531[_0x4729('0x1b')],'include':_0x972531[_0x4729('0x1d')]?_['map'](_0x972531[_0x4729('0x1d')],function(_0x49d7e6){return{'model':db[_0x49d7e6[_0x4729('0x1f')]],'as':_0x49d7e6['as'],'attributes':_0x49d7e6[_0x4729('0x1b')],'include':_0x49d7e6[_0x4729('0x1d')]?_[_0x4729('0x1e')](_0x49d7e6[_0x4729('0x1d')],function(_0x26e506){return{'model':db[_0x26e506[_0x4729('0x1f')]],'as':_0x26e506['as'],'attributes':_0x26e506['attributes']};}):[]};}):[]};}):[]:[]})[_0x4729('0xc')](function(_0x5d18a7){logger[_0x4729('0xd')](_0x4729('0x21'),_0x3f150c);logger[_0x4729('0xf')](_0x4729('0x21'),_0x3f150c,JSON['stringify'](_0x5d18a7));_0x2ce26b(_0x5d18a7);})[_0x4729('0x15')](function(_0x470304){logger[_0x4729('0x11')]('ShowTrigger',_0x470304[_0x4729('0x13')],_0x3f150c);_0x469e07(_0x21dce0['error'](0x1f4,_0x470304[_0x4729('0x13')]));});});}; \ No newline at end of file +var _0x1099=['message','result','catch','Trigger','findAll','options','raw','attributes','include','model','map','then','GetTrigger','debug','ShowTrigger','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x389bac,_0xa87c5d){var _0x29d99c=function(_0x173690){while(--_0x173690){_0x389bac['push'](_0x389bac['shift']());}};_0x29d99c(++_0xa87c5d);}(_0x1099,0x141));var _0x9109=function(_0x595288,_0x41d340){_0x595288=_0x595288-0x0;var _0x50cdda=_0x1099[_0x595288];return _0x50cdda;};'use strict';var _=require(_0x9109('0x0'));var util=require(_0x9109('0x1'));var moment=require(_0x9109('0x2'));var BPromise=require(_0x9109('0x3'));var rs=require(_0x9109('0x4'));var fs=require('fs');var Redis=require(_0x9109('0x5'));var db=require(_0x9109('0x6'))['db'];var utils=require(_0x9109('0x7'));var logger=require(_0x9109('0x8'))('rpc');var config=require(_0x9109('0x9'));var jayson=require(_0x9109('0xa'));var client=jayson[_0x9109('0xb')][_0x9109('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xe91af3,_0x571f8e,_0xd7d752){return new BPromise(function(_0x263a1b,_0xfb3629){return client[_0x9109('0xd')](_0xe91af3,_0xd7d752)['then'](function(_0x459844){logger[_0x9109('0xe')](_0x9109('0xf'),_0x571f8e,_0x9109('0x10'));logger['debug'](_0x9109('0x11'),_0x571f8e,_0x9109('0x10'),JSON[_0x9109('0x12')](_0x459844));if(_0x459844[_0x9109('0x13')]){if(_0x459844[_0x9109('0x13')][_0x9109('0x14')]===0x1f4){logger['error']('Trigger,\x20%s,\x20%s',_0x571f8e,_0x459844[_0x9109('0x13')][_0x9109('0x15')]);return _0xfb3629(_0x459844[_0x9109('0x13')][_0x9109('0x15')]);}logger[_0x9109('0x13')](_0x9109('0xf'),_0x571f8e,_0x459844[_0x9109('0x13')][_0x9109('0x15')]);return _0x263a1b(_0x459844[_0x9109('0x13')][_0x9109('0x15')]);}else{logger[_0x9109('0xe')]('Trigger,\x20%s,\x20%s',_0x571f8e,_0x9109('0x10'));_0x263a1b(_0x459844[_0x9109('0x16')]['message']);}})[_0x9109('0x17')](function(_0x21cb2b){logger[_0x9109('0x13')]('Trigger,\x20%s,\x20%s',_0x571f8e,_0x21cb2b);_0xfb3629(_0x21cb2b);});});}exports['GetTrigger']=function(_0x2ca2d6){var _0x45c4c7=this;return new Promise(function(_0x43e81c,_0x11f33c){return db[_0x9109('0x18')][_0x9109('0x19')]({'raw':_0x2ca2d6[_0x9109('0x1a')]?_0x2ca2d6['options'][_0x9109('0x1b')]===undefined?!![]:![]:!![],'where':_0x2ca2d6[_0x9109('0x1a')]?_0x2ca2d6[_0x9109('0x1a')]['where']||null:null,'attributes':_0x2ca2d6[_0x9109('0x1a')]?_0x2ca2d6[_0x9109('0x1a')][_0x9109('0x1c')]||null:null,'limit':_0x2ca2d6[_0x9109('0x1a')]?_0x2ca2d6[_0x9109('0x1a')]['limit']||null:null,'include':_0x2ca2d6[_0x9109('0x1a')]?_0x2ca2d6[_0x9109('0x1a')][_0x9109('0x1d')]?_['map'](_0x2ca2d6['options'][_0x9109('0x1d')],function(_0x17f130){return{'model':db[_0x17f130[_0x9109('0x1e')]],'as':_0x17f130['as'],'attributes':_0x17f130[_0x9109('0x1c')],'include':_0x17f130['include']?_[_0x9109('0x1f')](_0x17f130[_0x9109('0x1d')],function(_0x55ffc8){return{'model':db[_0x55ffc8[_0x9109('0x1e')]],'as':_0x55ffc8['as'],'attributes':_0x55ffc8[_0x9109('0x1c')],'include':_0x55ffc8['include']?_['map'](_0x55ffc8[_0x9109('0x1d')],function(_0x2122b4){return{'model':db[_0x2122b4[_0x9109('0x1e')]],'as':_0x2122b4['as'],'attributes':_0x2122b4[_0x9109('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9109('0x20')](function(_0x3a639d){logger[_0x9109('0xe')](_0x9109('0x21'),_0x2ca2d6);logger[_0x9109('0x22')](_0x9109('0x21'),_0x2ca2d6,JSON[_0x9109('0x12')](_0x3a639d));_0x43e81c(_0x3a639d);})[_0x9109('0x17')](function(_0x70327c){logger[_0x9109('0x13')]('GetTrigger',_0x70327c[_0x9109('0x15')],_0x2ca2d6);_0x11f33c(_0x45c4c7[_0x9109('0x13')](0x1f4,_0x70327c[_0x9109('0x15')]));});});};exports[_0x9109('0x23')]=function(_0x4d9f72){var _0x11c7d2=this;return new Promise(function(_0x49c31d,_0x1b798e){return db[_0x9109('0x18')][_0x9109('0x24')]({'raw':_0x4d9f72['options']?_0x4d9f72['options'][_0x9109('0x1b')]===undefined?!![]:![]:!![],'where':_0x4d9f72[_0x9109('0x1a')]?_0x4d9f72['options'][_0x9109('0x25')]||null:null,'attributes':_0x4d9f72[_0x9109('0x1a')]?_0x4d9f72['options']['attributes']||null:null,'include':_0x4d9f72[_0x9109('0x1a')]?_0x4d9f72[_0x9109('0x1a')][_0x9109('0x1d')]?_[_0x9109('0x1f')](_0x4d9f72[_0x9109('0x1a')]['include'],function(_0x226e0b){return{'model':db[_0x226e0b[_0x9109('0x1e')]],'as':_0x226e0b['as'],'attributes':_0x226e0b[_0x9109('0x1c')],'include':_0x226e0b[_0x9109('0x1d')]?_['map'](_0x226e0b[_0x9109('0x1d')],function(_0x255616){return{'model':db[_0x255616[_0x9109('0x1e')]],'as':_0x255616['as'],'attributes':_0x255616[_0x9109('0x1c')],'include':_0x255616[_0x9109('0x1d')]?_[_0x9109('0x1f')](_0x255616['include'],function(_0x1d0d42){return{'model':db[_0x1d0d42[_0x9109('0x1e')]],'as':_0x1d0d42['as'],'attributes':_0x1d0d42[_0x9109('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9109('0x20')](function(_0x18f9b9){logger[_0x9109('0xe')](_0x9109('0x23'),_0x4d9f72);logger[_0x9109('0x22')](_0x9109('0x23'),_0x4d9f72,JSON[_0x9109('0x12')](_0x18f9b9));_0x49c31d(_0x18f9b9);})[_0x9109('0x17')](function(_0x5996dd){logger['error'](_0x9109('0x23'),_0x5996dd['message'],_0x4d9f72);_0x1b798e(_0x11c7d2['error'](0x1f4,_0x5996dd[_0x9109('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 00207d2..efc10b7 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 _0x569f=['clone','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','./trunk.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x2ce9fc,_0x18f322){var _0x2a21ed=function(_0x44cfaa){while(--_0x44cfaa){_0x2ce9fc['push'](_0x2ce9fc['shift']());}};_0x2a21ed(++_0x18f322);}(_0x569f,0xa7));var _0xf569=function(_0x39aedf,_0x2f5df8){_0x39aedf=_0x39aedf-0x0;var _0x39356c=_0x569f[_0x39aedf];return _0x39356c;};'use strict';var multer=require(_0xf569('0x0'));var util=require(_0xf569('0x1'));var path=require('path');var timeout=require(_0xf569('0x2'));var express=require(_0xf569('0x3'));var router=express[_0xf569('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf569('0x5'));var config=require('../../config/environment');var controller=require(_0xf569('0x6'));router[_0xf569('0x7')]('/',auth[_0xf569('0x8')](),controller[_0xf569('0x9')]);router[_0xf569('0x7')](_0xf569('0xa'),auth[_0xf569('0x8')](),controller[_0xf569('0xb')]);router[_0xf569('0xc')]('/:id/clone',auth[_0xf569('0x8')](),controller[_0xf569('0xd')]);router[_0xf569('0xc')]('/',auth[_0xf569('0x8')](),controller[_0xf569('0xe')]);router[_0xf569('0xf')](_0xf569('0xa'),auth[_0xf569('0x8')](),controller[_0xf569('0x10')]);router[_0xf569('0x11')](_0xf569('0xa'),auth[_0xf569('0x8')](),controller[_0xf569('0x12')]);module[_0xf569('0x13')]=router; \ No newline at end of file +var _0xf6e0=['isAuthenticated','index','get','/:id','post','/:id/clone','clone','update','delete','destroy','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x1c8cc6,_0x411e5c){var _0x522936=function(_0x38d044){while(--_0x38d044){_0x1c8cc6['push'](_0x1c8cc6['shift']());}};_0x522936(++_0x411e5c);}(_0xf6e0,0x9a));var _0x0f6e=function(_0x3b11d0,_0x43cc28){_0x3b11d0=_0x3b11d0-0x0;var _0x29f83d=_0xf6e0[_0x3b11d0];return _0x29f83d;};'use strict';var multer=require(_0x0f6e('0x0'));var util=require('util');var path=require(_0x0f6e('0x1'));var timeout=require(_0x0f6e('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0f6e('0x3'));var auth=require(_0x0f6e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0f6e('0x5'));var controller=require('./trunk.controller');router['get']('/',auth[_0x0f6e('0x6')](),controller[_0x0f6e('0x7')]);router[_0x0f6e('0x8')](_0x0f6e('0x9'),auth[_0x0f6e('0x6')](),controller['show']);router[_0x0f6e('0xa')](_0x0f6e('0xb'),auth[_0x0f6e('0x6')](),controller[_0x0f6e('0xc')]);router[_0x0f6e('0xa')]('/',auth[_0x0f6e('0x6')](),controller['create']);router['put'](_0x0f6e('0x9'),auth['isAuthenticated'](),controller[_0x0f6e('0xd')]);router[_0x0f6e('0xe')](_0x0f6e('0x9'),auth['isAuthenticated'](),controller[_0x0f6e('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index b60c1f5..6124c88 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 _0x6d12=['String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','active','passive','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','ENUM','peer','friend','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','nonat','update','outgoing','yes','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow'];(function(_0x33c5ac,_0x2a71e0){var _0x151a1b=function(_0x4c29f6){while(--_0x4c29f6){_0x33c5ac['push'](_0x33c5ac['shift']());}};_0x151a1b(++_0x2a71e0);}(_0x6d12,0xdf));var _0x26d1=function(_0x57a4d0,_0xa6e6b){_0x57a4d0=_0x57a4d0-0x0;var _0xaaadee=_0x6d12[_0x57a4d0];return _0xaaadee;};'use strict';var Sequelize=require(_0x26d1('0x0'));module[_0x26d1('0x1')]={'name':{'type':Sequelize[_0x26d1('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x26d1('0x3')]('friend','user',_0x26d1('0x4')),'allowNull':![],'defaultValue':_0x26d1('0x5')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x26d1('0x3')]('ALLOWED_NOT_SCREENED',_0x26d1('0x6'),_0x26d1('0x7'),_0x26d1('0x8'),'PROHIB_NOT_SCREENED',_0x26d1('0x9'),_0x26d1('0xa'),_0x26d1('0xb'))},'deny':{'type':Sequelize[_0x26d1('0x2')]},'permit':{'type':Sequelize[_0x26d1('0x2')]},'secret':{'type':Sequelize[_0x26d1('0x2')]},'md5secret':{'type':Sequelize[_0x26d1('0x2')]},'remotesecret':{'type':Sequelize[_0x26d1('0x2')]},'transport':{'type':Sequelize['STRING'],'defaultValue':'udp','set':function(_0x1c5a79){this[_0x26d1('0xc')](_0x26d1('0xd'),_0x1c5a79?_0x1c5a79[_0x26d1('0xe')](','):null);},'get':function(){return this[_0x26d1('0xf')](_0x26d1('0xd'))?this[_0x26d1('0xf')](_0x26d1('0xd'))[_0x26d1('0x10')](','):null;},'comment':_0x26d1('0x11')},'dtmfmode':{'type':Sequelize[_0x26d1('0x3')](_0x26d1('0x12'),_0x26d1('0x13'),_0x26d1('0x14'),_0x26d1('0x15'),_0x26d1('0x16')),'defaultValue':_0x26d1('0x12')},'directmedia':{'type':Sequelize[_0x26d1('0x3')]('yes','no',_0x26d1('0x17'),_0x26d1('0x18'),_0x26d1('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x26d1('0x3')](_0x26d1('0x1a'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x26d1('0x2')]},'nat':{'type':Sequelize[_0x26d1('0x2')],'defaultValue':_0x26d1('0x1b'),'set':function(_0x4f22de){this[_0x26d1('0xc')](_0x26d1('0x1c'),_0x4f22de?_0x4f22de['join'](','):null);},'get':function(){return this[_0x26d1('0xf')](_0x26d1('0x1c'))?this[_0x26d1('0xf')]('nat')[_0x26d1('0x10')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x26d1('0x2')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x26d1('0x2')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0x26d1('0x2')],'defaultValue':_0x26d1('0x1d')},'allow':{'type':Sequelize[_0x26d1('0x2')],'allowNull':![],'defaultValue':_0x26d1('0x1e'),'set':function(_0x149ad8){this[_0x26d1('0xc')](_0x26d1('0x1f'),_0x149ad8?_0x149ad8[_0x26d1('0xe')](';'):_0x26d1('0x1e'));},'get':function(){return this[_0x26d1('0xf')](_0x26d1('0x1f'))?this[_0x26d1('0xf')](_0x26d1('0x1f'))['split'](';'):null;},'comment':_0x26d1('0x20')},'autoframing':{'type':Sequelize[_0x26d1('0x3')](_0x26d1('0x1a'),'no')},'insecure':{'type':Sequelize[_0x26d1('0x2')],'defaultValue':'port,invite','set':function(_0x5cd59d){this['setDataValue'](_0x26d1('0x21'),_0x5cd59d?_0x5cd59d['join'](','):null);},'get':function(){return this[_0x26d1('0xf')](_0x26d1('0x21'))?this[_0x26d1('0xf')](_0x26d1('0x21'))[_0x26d1('0x10')](','):null;},'comment':_0x26d1('0x22')},'trustrpid':{'type':Sequelize[_0x26d1('0x3')](_0x26d1('0x1a'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x26d1('0x3')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x26d1('0x3')](_0x26d1('0x1a'),'no',_0x26d1('0x23'))},'promiscredir':{'type':Sequelize['ENUM']('yes','no')},'useclientcode':{'type':Sequelize[_0x26d1('0x3')](_0x26d1('0x1a'),'no')},'accountcode':{'type':Sequelize[_0x26d1('0x24')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x26d1('0x2')],'defaultValue':_0x26d1('0x25')},'amaflags':{'type':Sequelize[_0x26d1('0x2')]},'callcounter':{'type':Sequelize[_0x26d1('0x3')](_0x26d1('0x1a'),'no'),'defaultValue':_0x26d1('0x1a')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x26d1('0x1a'),'no')},'allowsubscribe':{'type':Sequelize[_0x26d1('0x3')](_0x26d1('0x1a'),'no')},'allowtransfer':{'type':Sequelize[_0x26d1('0x3')](_0x26d1('0x1a'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x26d1('0x1a'),'no')},'subscribecontext':{'type':Sequelize[_0x26d1('0x2')]},'template':{'type':Sequelize[_0x26d1('0x2')]},'videosupport':{'type':Sequelize[_0x26d1('0x3')]('yes','no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x26d1('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x26d1('0x1a'),'no')},'mailbox':{'type':Sequelize[_0x26d1('0x2')]},'session_timers':{'type':Sequelize[_0x26d1('0x3')](_0x26d1('0x26'),_0x26d1('0x27'),_0x26d1('0x28'))},'session_expires':{'type':Sequelize[_0x26d1('0x24')](0xb)},'session_minse':{'type':Sequelize[_0x26d1('0x24')](0xb)},'session_refresher':{'type':Sequelize[_0x26d1('0x3')](_0x26d1('0x29'),_0x26d1('0x2a')),'defaultValue':_0x26d1('0x2a')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x26d1('0x2')]},'fromuser':{'type':Sequelize[_0x26d1('0x2')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x26d1('0x3')](_0x26d1('0x1a'),'no'),'defaultValue':_0x26d1('0x1a')},'keepalive':{'type':Sequelize[_0x26d1('0x24')](0xb)},'defaultip':{'type':Sequelize[_0x26d1('0x2')]},'defaultuser':{'type':Sequelize[_0x26d1('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x26d1('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x26d1('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0x26d1('0x3')](_0x26d1('0x1a'),'no',_0x26d1('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x26d1('0x2')]},'callbackextension':{'type':Sequelize[_0x26d1('0x2')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x26d1('0x24')](0xb)},'qualifyfreq':{'type':Sequelize[_0x26d1('0x24')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x26d1('0x2')]},'contactacl':{'type':Sequelize[_0x26d1('0x2')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x26d1('0x3')](_0x26d1('0x1a'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x26d1('0x3')](_0x26d1('0x1a'),'no')},'force_avp':{'type':Sequelize[_0x26d1('0x3')](_0x26d1('0x1a'),'no')},'icesupport':{'type':Sequelize[_0x26d1('0x3')](_0x26d1('0x1a'),'no')},'dtlsenable':{'type':Sequelize[_0x26d1('0x3')](_0x26d1('0x1a'),'no')},'dtlsverify':{'type':Sequelize[_0x26d1('0x3')](_0x26d1('0x1a'),'no',_0x26d1('0x2c'),_0x26d1('0x2d'))},'dtlsrekey':{'type':Sequelize[_0x26d1('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0x26d1('0x2')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x26d1('0x2')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x26d1('0x3')](_0x26d1('0x2e'),_0x26d1('0x2f'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x26d1('0x2')]},'usereqphone':{'type':Sequelize[_0x26d1('0x3')](_0x26d1('0x1a'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x26d1('0x2')]},'recordofffeature':{'type':Sequelize[_0x26d1('0x2')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x26d1('0x3')](_0x26d1('0x1a'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x26d1('0x1a'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x26d1('0x2')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x26d1('0x2')]},'description':{'type':Sequelize[_0x26d1('0x2')]},'host':{'type':Sequelize[_0x26d1('0x2')],'defaultValue':_0x26d1('0x30')},'canreinvite':{'type':Sequelize[_0x26d1('0x3')](_0x26d1('0x1a'),'no',_0x26d1('0x17'),_0x26d1('0x18'),_0x26d1('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x26d1('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x26d1('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x0802=['active','passive','actpass','BOOLEAN','sequelize','exports','STRING','name','friend','user','peer','from-voip-provider','ENUM','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','setDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','originate','INTEGER','uac','uas','fingerprint','certificate'];(function(_0x2d2623,_0x1aaea0){var _0x28f6c1=function(_0x599d40){while(--_0x599d40){_0x2d2623['push'](_0x2d2623['shift']());}};_0x28f6c1(++_0x1aaea0);}(_0x0802,0x117));var _0x2080=function(_0x4ee651,_0xe3dfe3){_0x4ee651=_0x4ee651-0x0;var _0x351f0e=_0x0802[_0x4ee651];return _0x351f0e;};'use strict';var Sequelize=require(_0x2080('0x0'));module[_0x2080('0x1')]={'name':{'type':Sequelize[_0x2080('0x2')],'allowNull':![],'unique':_0x2080('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x2080('0x4'),_0x2080('0x5'),_0x2080('0x6')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x2080('0x2')],'allowNull':![],'defaultValue':_0x2080('0x7')},'callingpres':{'type':Sequelize[_0x2080('0x8')]('ALLOWED_NOT_SCREENED',_0x2080('0x9'),_0x2080('0xa'),_0x2080('0xb'),_0x2080('0xc'),_0x2080('0xd'),_0x2080('0xe'),_0x2080('0xf'))},'deny':{'type':Sequelize[_0x2080('0x2')]},'permit':{'type':Sequelize[_0x2080('0x2')]},'secret':{'type':Sequelize[_0x2080('0x2')]},'md5secret':{'type':Sequelize[_0x2080('0x2')]},'remotesecret':{'type':Sequelize[_0x2080('0x2')]},'transport':{'type':Sequelize[_0x2080('0x2')],'defaultValue':_0x2080('0x10'),'set':function(_0x2dc87a){this['setDataValue'](_0x2080('0x11'),_0x2dc87a?_0x2dc87a['join'](','):null);},'get':function(){return this['getDataValue'](_0x2080('0x11'))?this[_0x2080('0x12')](_0x2080('0x11'))[_0x2080('0x13')](','):null;},'comment':_0x2080('0x14')},'dtmfmode':{'type':Sequelize[_0x2080('0x8')](_0x2080('0x15'),_0x2080('0x16'),'shortinfo',_0x2080('0x17'),_0x2080('0x18')),'defaultValue':_0x2080('0x15')},'directmedia':{'type':Sequelize[_0x2080('0x8')](_0x2080('0x19'),'no',_0x2080('0x1a'),_0x2080('0x1b'),_0x2080('0x1c')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x2080('0x8')](_0x2080('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x2080('0x2')]},'directmediadeny':{'type':Sequelize[_0x2080('0x2')]},'nat':{'type':Sequelize[_0x2080('0x2')],'defaultValue':_0x2080('0x1d'),'set':function(_0x588ed2){this['setDataValue'](_0x2080('0x1e'),_0x588ed2?_0x588ed2[_0x2080('0x1f')](','):null);},'get':function(){return this[_0x2080('0x12')](_0x2080('0x1e'))?this['getDataValue']('nat')[_0x2080('0x13')](','):null;},'comment':_0x2080('0x20')},'callgroup':{'type':Sequelize[_0x2080('0x2')]},'namedcallgroup':{'type':Sequelize[_0x2080('0x2')]},'pickupgroup':{'type':Sequelize[_0x2080('0x2')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x2080('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x2080('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x2080('0x2')],'defaultValue':_0x2080('0x21')},'allow':{'type':Sequelize[_0x2080('0x2')],'allowNull':![],'defaultValue':_0x2080('0x22'),'set':function(_0x5c052c){this[_0x2080('0x23')]('allow',_0x5c052c?_0x5c052c[_0x2080('0x1f')](';'):_0x2080('0x22'));},'get':function(){return this[_0x2080('0x12')]('allow')?this['getDataValue']('allow')['split'](';'):null;},'comment':_0x2080('0x24')},'autoframing':{'type':Sequelize['ENUM']('yes','no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0x2080('0x25'),'set':function(_0x1bacae){this[_0x2080('0x23')](_0x2080('0x26'),_0x1bacae?_0x1bacae['join'](','):null);},'get':function(){return this[_0x2080('0x12')]('insecure')?this[_0x2080('0x12')](_0x2080('0x26'))['split'](','):null;},'comment':_0x2080('0x27')},'trustrpid':{'type':Sequelize[_0x2080('0x8')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x2080('0x8')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x2080('0x8')]('yes','no',_0x2080('0x28'))},'promiscredir':{'type':Sequelize[_0x2080('0x8')](_0x2080('0x19'),'no')},'useclientcode':{'type':Sequelize[_0x2080('0x8')]('yes','no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x2080('0x29')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize['ENUM'](_0x2080('0x19'),'no'),'defaultValue':_0x2080('0x19')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x2080('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0x2080('0x8')](_0x2080('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0x2080('0x8')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0x2080('0x8')]('yes','no')},'subscribecontext':{'type':Sequelize[_0x2080('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x2080('0x8')](_0x2080('0x19'),'no',_0x2080('0x2a')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x2080('0x19'),'no')},'mailbox':{'type':Sequelize[_0x2080('0x2')]},'session_timers':{'type':Sequelize[_0x2080('0x8')](_0x2080('0x2b'),_0x2080('0x2c'),_0x2080('0x2d'))},'session_expires':{'type':Sequelize[_0x2080('0x2e')](0xb)},'session_minse':{'type':Sequelize[_0x2080('0x2e')](0xb)},'session_refresher':{'type':Sequelize[_0x2080('0x8')](_0x2080('0x2f'),_0x2080('0x30')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x2080('0x2')]},'fromdomain':{'type':Sequelize[_0x2080('0x2')]},'fromuser':{'type':Sequelize[_0x2080('0x2')]},'port':{'type':Sequelize[_0x2080('0x2e')](0x5)},'qualify':{'type':Sequelize[_0x2080('0x8')]('yes','no'),'defaultValue':_0x2080('0x19')},'keepalive':{'type':Sequelize[_0x2080('0x2e')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x2080('0x2')]},'rtptimeout':{'type':Sequelize[_0x2080('0x2e')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x2080('0x2e')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x2080('0x2e')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x2080('0x19'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x2080('0x2')]},'callbackextension':{'type':Sequelize[_0x2080('0x2')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x2080('0x2e')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x2080('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x2080('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x2080('0x2')]},'use_q850_reason':{'type':Sequelize[_0x2080('0x2')]},'maxforwards':{'type':Sequelize[_0x2080('0x2e')](0xb)},'encryption':{'type':Sequelize[_0x2080('0x8')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x2080('0x8')](_0x2080('0x19'),'no')},'force_avp':{'type':Sequelize[_0x2080('0x8')](_0x2080('0x19'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0x2080('0x19'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x2080('0x19'),'no')},'dtlsverify':{'type':Sequelize[_0x2080('0x8')]('yes','no',_0x2080('0x31'),_0x2080('0x32'))},'dtlsrekey':{'type':Sequelize[_0x2080('0x2e')](0xb)},'dtlscertfile':{'type':Sequelize[_0x2080('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x2080('0x2')]},'dtlscipher':{'type':Sequelize[_0x2080('0x2')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x2080('0x2')]},'dtlssetup':{'type':Sequelize[_0x2080('0x8')](_0x2080('0x33'),_0x2080('0x34'),_0x2080('0x35')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x2080('0x2')]},'usereqphone':{'type':Sequelize[_0x2080('0x8')](_0x2080('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x2080('0x2')]},'recordofffeature':{'type':Sequelize[_0x2080('0x2')]},'call_limit':{'type':Sequelize[_0x2080('0x2e')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x2080('0x8')](_0x2080('0x19'),'no')},'subscribemwi':{'type':Sequelize[_0x2080('0x8')]('yes','no')},'vmexten':{'type':Sequelize[_0x2080('0x2')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x2080('0x2')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING'],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x2080('0x8')](_0x2080('0x19'),'no',_0x2080('0x1a'),_0x2080('0x1b'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x2080('0x2')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x2080('0x36')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'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 cc92ff6..d6da867 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 _0xf3cd=['length','limit','sort','where','filter','merge','options','Trunk','includeAll','include','findAll','show','find','clone','createdAt','updatedAt','omit','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Trunks','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','server/files/templates/registry.ejs','utf8','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','render','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','userProfileId','autoAssociation','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','undefined','offset','count','json','reject','save','update','get','UserProfileResource','destroy','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields'];(function(_0x4353c9,_0x167ec9){var _0x45cad1=function(_0x2c192a){while(--_0x2c192a){_0x4353c9['push'](_0x4353c9['shift']());}};_0x45cad1(++_0x167ec9);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x725a4c,_0x102507){_0x725a4c=_0x725a4c-0x0;var _0x37b2cc=_0xf3cd[_0x725a4c];return _0x37b2cc;};'use strict';var emlformat=require(_0xdf3c('0x0'));var rimraf=require(_0xdf3c('0x1'));var zipdir=require(_0xdf3c('0x2'));var jsonpatch=require(_0xdf3c('0x3'));var rp=require(_0xdf3c('0x4'));var moment=require(_0xdf3c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdf3c('0x6'));var util=require(_0xdf3c('0x7'));var path=require(_0xdf3c('0x8'));var sox=require('sox');var csv=require(_0xdf3c('0x9'));var ejs=require(_0xdf3c('0xa'));var fs=require('fs');var fs_extra=require(_0xdf3c('0xb'));var _=require(_0xdf3c('0xc'));var squel=require(_0xdf3c('0xd'));var crypto=require(_0xdf3c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xdf3c('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdf3c('0x10'));var Redis=require(_0xdf3c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xdf3c('0x12'));var as=require(_0xdf3c('0x13'));var hardwareService=require(_0xdf3c('0x14'));var logger=require(_0xdf3c('0x15'))(_0xdf3c('0x16'));var utils=require(_0xdf3c('0x17'));var config=require(_0xdf3c('0x18'));var licenseUtil=require(_0xdf3c('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0xdf3c('0x1a'));var client=jayson[_0xdf3c('0x1b')][_0xdf3c('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x17319c,_0x59e431,_0x2ae4ad,_0x461079){return new BPromise(function(_0x13ea5f,_0x5e0047){var _0x18aafa=_0x461079||client;return _0x18aafa[_0xdf3c('0x1d')](_0x17319c,_0x2ae4ad)[_0xdf3c('0x1e')](function(_0x4274fd){logger[_0xdf3c('0x1f')](_0xdf3c('0x20'),_0x59e431,_0xdf3c('0x21'));logger[_0xdf3c('0x22')](_0xdf3c('0x23'),_0x59e431,_0xdf3c('0x21'),JSON['stringify'](_0x4274fd));if(_0x4274fd[_0xdf3c('0x24')]){if(_0x4274fd[_0xdf3c('0x24')][_0xdf3c('0x25')]===0x1f4){logger[_0xdf3c('0x24')](_0xdf3c('0x20'),_0x59e431,_0x4274fd[_0xdf3c('0x24')][_0xdf3c('0x26')]);return _0x5e0047(_0x4274fd[_0xdf3c('0x24')][_0xdf3c('0x26')]);}logger[_0xdf3c('0x24')](_0xdf3c('0x20'),_0x59e431,_0x4274fd[_0xdf3c('0x24')][_0xdf3c('0x26')]);return _0x13ea5f(_0x4274fd['error']['message']);}else{logger[_0xdf3c('0x1f')]('Trunk,\x20%s,\x20%s',_0x59e431,_0xdf3c('0x21'));_0x13ea5f(_0x4274fd[_0xdf3c('0x27')][_0xdf3c('0x26')]);}})[_0xdf3c('0x28')](function(_0x33652f){logger[_0xdf3c('0x24')]('Trunk,\x20%s,\x20%s',_0x59e431,_0x33652f);_0x5e0047(_0x33652f);});});}function respondWithStatusCode(_0x22a164,_0x213d75){_0x213d75=_0x213d75||0xcc;return function(_0x13e3ca){if(_0x13e3ca){return _0x22a164[_0xdf3c('0x29')](_0x213d75);}return _0x22a164[_0xdf3c('0x2a')](_0x213d75)[_0xdf3c('0x2b')]();};}function respondWithResult(_0xef54cb,_0x155f54){_0x155f54=_0x155f54||0xc8;return function(_0x18cb46){if(_0x18cb46){return _0xef54cb[_0xdf3c('0x2a')](_0x155f54)['json'](_0x18cb46);}};}function respondWithFilteredResult(_0xd284d7,_0x153daa){return function(_0x4b57a4){if(_0x4b57a4){var _0xdc8962=typeof _0x153daa['offset']==='undefined'&&typeof _0x153daa['limit']===_0xdf3c('0x2c');var _0x186bba=_0x4b57a4['count'];var _0x5c3b5a=_0xdc8962?0x0:_0x153daa[_0xdf3c('0x2d')];var _0x1f2ce4=_0xdc8962?_0x4b57a4[_0xdf3c('0x2e')]:_0x153daa[_0xdf3c('0x2d')]+_0x153daa['limit'];var _0x43ce06;if(_0x1f2ce4>=_0x186bba){_0x1f2ce4=_0x186bba;_0x43ce06=0xc8;}else{_0x43ce06=0xce;}_0xd284d7[_0xdf3c('0x2a')](_0x43ce06);return _0xd284d7['set']('Content-Range',_0x5c3b5a+'-'+_0x1f2ce4+'/'+_0x186bba)[_0xdf3c('0x2f')](_0x4b57a4);}return null;};}function patchUpdates(_0x46f0e3){return function(_0x36937e){try{jsonpatch['apply'](_0x36937e,_0x46f0e3,!![]);}catch(_0x2355f6){return BPromise[_0xdf3c('0x30')](_0x2355f6);}return _0x36937e[_0xdf3c('0x31')]();};}function saveUpdates(_0x10099e,_0x575ae1){return function(_0xda0de0){if(_0xda0de0){return _0xda0de0[_0xdf3c('0x32')](_0x10099e)['then'](function(_0x40ae3d){return _0x40ae3d;});}return null;};}function removeEntity(_0x3daeda,_0x217a65){return function(_0x2287f){if(_0x2287f){return _0x2287f['destroy']()[_0xdf3c('0x1e')](function(){var _0x360d5c=_0x2287f[_0xdf3c('0x33')]({'plain':!![]});var _0x3b9ce8='Trunks';return db[_0xdf3c('0x34')][_0xdf3c('0x35')]({'where':{'type':_0x3b9ce8,'resourceId':_0x360d5c['id']}})['then'](function(){return _0x2287f;});})['then'](function(){_0x3daeda[_0xdf3c('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x216115,_0x5e8130){return function(_0x57faba){if(!_0x57faba){_0x216115['sendStatus'](0x194);}return _0x57faba;};}function handleError(_0x44a478,_0x2ee9ad){_0x2ee9ad=_0x2ee9ad||0x1f4;return function(_0x1d0b8a){logger[_0xdf3c('0x24')](_0x1d0b8a['stack']);if(_0x1d0b8a['name']){delete _0x1d0b8a[_0xdf3c('0x36')];}_0x44a478['status'](_0x2ee9ad)[_0xdf3c('0x37')](_0x1d0b8a);};}exports[_0xdf3c('0x38')]=function(_0x3628ae,_0xcdd731){var _0x1004e9={},_0x1e0cf2={},_0x1c7335={'count':0x0,'rows':[]};var _0x809f3d=_[_0xdf3c('0x39')](db['Trunk'][_0xdf3c('0x3a')],function(_0x54e689){return{'name':_0x54e689['fieldName'],'type':_0x54e689[_0xdf3c('0x3b')]['key']};});_0x1e0cf2[_0xdf3c('0x3c')]=_['map'](_0x809f3d,_0xdf3c('0x36'));_0x1e0cf2[_0xdf3c('0x3d')]=_[_0xdf3c('0x3e')](_0x3628ae[_0xdf3c('0x3d')]);_0x1e0cf2[_0xdf3c('0x3f')]=_[_0xdf3c('0x40')](_0x1e0cf2[_0xdf3c('0x3c')],_0x1e0cf2[_0xdf3c('0x3d')]);_0x1004e9[_0xdf3c('0x41')]=_[_0xdf3c('0x40')](_0x1e0cf2[_0xdf3c('0x3c')],qs[_0xdf3c('0x42')](_0x3628ae['query']['fields']));_0x1004e9[_0xdf3c('0x41')]=_0x1004e9['attributes'][_0xdf3c('0x43')]?_0x1004e9[_0xdf3c('0x41')]:_0x1e0cf2[_0xdf3c('0x3c')];if(!_0x3628ae[_0xdf3c('0x3d')]['hasOwnProperty']('nolimit')){_0x1004e9[_0xdf3c('0x44')]=qs[_0xdf3c('0x44')](_0x3628ae[_0xdf3c('0x3d')]['limit']);_0x1004e9[_0xdf3c('0x2d')]=qs[_0xdf3c('0x2d')](_0x3628ae[_0xdf3c('0x3d')][_0xdf3c('0x2d')]);}_0x1004e9['order']=qs[_0xdf3c('0x45')](_0x3628ae[_0xdf3c('0x3d')][_0xdf3c('0x45')]);_0x1004e9[_0xdf3c('0x46')]=qs[_0xdf3c('0x3f')](_['pick'](_0x3628ae[_0xdf3c('0x3d')],_0x1e0cf2[_0xdf3c('0x3f')]),_0x809f3d);if(_0x3628ae[_0xdf3c('0x3d')][_0xdf3c('0x47')]){_0x1004e9[_0xdf3c('0x46')]=_[_0xdf3c('0x48')](_0x1004e9['where'],{'$or':_['map'](_0x809f3d,function(_0x2c6c6d){if(_0x2c6c6d[_0xdf3c('0x3b')]!=='VIRTUAL'){var _0x5c9885={};_0x5c9885[_0x2c6c6d[_0xdf3c('0x36')]]={'$like':'%'+_0x3628ae[_0xdf3c('0x3d')][_0xdf3c('0x47')]+'%'};return _0x5c9885;}})});}_0x1004e9=_[_0xdf3c('0x48')]({},_0x1004e9,_0x3628ae[_0xdf3c('0x49')]);var _0x2dbf54={'where':_0x1004e9[_0xdf3c('0x46')]};return db[_0xdf3c('0x4a')][_0xdf3c('0x2e')](_0x2dbf54)['then'](function(_0x129c2a){_0x1c7335[_0xdf3c('0x2e')]=_0x129c2a;if(_0x3628ae[_0xdf3c('0x3d')][_0xdf3c('0x4b')]){_0x1004e9[_0xdf3c('0x4c')]=[{'all':!![]}];}return db[_0xdf3c('0x4a')][_0xdf3c('0x4d')](_0x1004e9);})['then'](function(_0x1751a8){_0x1c7335['rows']=_0x1751a8;return _0x1c7335;})[_0xdf3c('0x1e')](respondWithFilteredResult(_0xcdd731,_0x1004e9))['catch'](handleError(_0xcdd731,null));};exports[_0xdf3c('0x4e')]=function(_0x28144f,_0x2ec575){var _0x94c5b9={'raw':![],'where':{'id':_0x28144f['params']['id']}},_0x5eef94={};_0x5eef94['model']=_[_0xdf3c('0x3e')](db['Trunk'][_0xdf3c('0x3a')]);_0x5eef94[_0xdf3c('0x3d')]=_[_0xdf3c('0x3e')](_0x28144f[_0xdf3c('0x3d')]);_0x5eef94[_0xdf3c('0x3f')]=_['intersection'](_0x5eef94['model'],_0x5eef94[_0xdf3c('0x3d')]);_0x94c5b9[_0xdf3c('0x41')]=_['intersection'](_0x5eef94[_0xdf3c('0x3c')],qs[_0xdf3c('0x42')](_0x28144f[_0xdf3c('0x3d')][_0xdf3c('0x42')]));_0x94c5b9[_0xdf3c('0x41')]=_0x94c5b9[_0xdf3c('0x41')][_0xdf3c('0x43')]?_0x94c5b9['attributes']:_0x5eef94['model'];if(_0x28144f[_0xdf3c('0x3d')][_0xdf3c('0x4b')]){_0x94c5b9[_0xdf3c('0x4c')]=[{'all':!![]}];}_0x94c5b9=_[_0xdf3c('0x48')]({},_0x94c5b9,_0x28144f[_0xdf3c('0x49')]);return db[_0xdf3c('0x4a')][_0xdf3c('0x4f')](_0x94c5b9)[_0xdf3c('0x1e')](handleEntityNotFound(_0x2ec575,null))[_0xdf3c('0x1e')](respondWithResult(_0x2ec575,null))[_0xdf3c('0x28')](handleError(_0x2ec575,null));};exports[_0xdf3c('0x50')]=function(_0x4cb28f,_0x1eebcf){var _0x47cb74={'where':{'id':_0x4cb28f['params']['id']}},_0x5e7247={};_0x5e7247['model']=_['keys'](db[_0xdf3c('0x4a')][_0xdf3c('0x3a')]);_0x47cb74['attributes']=_[_0xdf3c('0x40')](_0x5e7247[_0xdf3c('0x3c')],qs['fields'](_0x4cb28f[_0xdf3c('0x3d')][_0xdf3c('0x42')]));_0x47cb74[_0xdf3c('0x41')]=_0x47cb74[_0xdf3c('0x41')][_0xdf3c('0x43')]?_0x47cb74[_0xdf3c('0x41')]:_0x5e7247[_0xdf3c('0x3c')];if(_0x4cb28f[_0xdf3c('0x3d')][_0xdf3c('0x4b')]){_0x47cb74[_0xdf3c('0x4c')]=[{'all':!![]}];}_0x47cb74=_[_0xdf3c('0x48')]({},_0x47cb74,_0x4cb28f['options']);return db[_0xdf3c('0x4a')][_0xdf3c('0x4f')](_0x47cb74)[_0xdf3c('0x1e')](handleEntityNotFound(_0x1eebcf,null))['then'](function(_0x245c68){if(_0x245c68){var _0x3e327e=_0x245c68[_0xdf3c('0x33')]({'plain':!![]});_0x3e327e=qs['omit'](_0x3e327e,['id',_0xdf3c('0x51'),_0xdf3c('0x52')]);_0x4cb28f['body']=_[_0xdf3c('0x53')](_0x4cb28f['body'],['id',_0xdf3c('0x51'),_0xdf3c('0x52')]);return db[_0xdf3c('0x4a')][_0xdf3c('0x54')](_[_0xdf3c('0x48')](_0x3e327e,_0x4cb28f[_0xdf3c('0x55')]),{'include':_0x4cb28f[_0xdf3c('0x3d')][_0xdf3c('0x4b')]?[{'all':!![]}]:undefined})[_0xdf3c('0x1e')](function(_0x330730){var _0x283be2=_0x4cb28f[_0xdf3c('0x56')][_0xdf3c('0x33')]({'plain':!![]});if(!_0x283be2)throw new Error(_0xdf3c('0x57'));if(_0x283be2[_0xdf3c('0x58')]===_0xdf3c('0x56')){var _0xd7fb2d=_0x330730['get']({'plain':!![]});var _0x4dade5=_0xdf3c('0x59');return db[_0xdf3c('0x5a')][_0xdf3c('0x4f')]({'where':{'name':_0x4dade5,'userProfileId':_0x283be2['userProfileId']},'raw':!![]})[_0xdf3c('0x1e')](function(_0x5f2765){if(_0x5f2765&&_0x5f2765['autoAssociation']===0x0){return db[_0xdf3c('0x34')][_0xdf3c('0x54')]({'name':_0xd7fb2d[_0xdf3c('0x36')],'resourceId':_0xd7fb2d['id'],'type':_0x5f2765[_0xdf3c('0x36')],'sectionId':_0x5f2765['id']},{})[_0xdf3c('0x1e')](function(){return _0x330730;});}else{return _0x330730;}})[_0xdf3c('0x28')](function(_0x1a31d7){logger[_0xdf3c('0x24')](_0xdf3c('0x5b'),_0x1a31d7);throw _0x1a31d7;});}return _0x330730;});}})[_0xdf3c('0x1e')](respondWithResult(_0x1eebcf,0xc9))[_0xdf3c('0x28')](handleError(_0x1eebcf,null));};exports[_0xdf3c('0x54')]=function(_0x34000c,_0x4be79a,_0x3febac){var _0x2cb0f5;return db[_0xdf3c('0x4a')][_0xdf3c('0x54')](_0x34000c[_0xdf3c('0x55')],{'raw':!![]})['then'](function(_0x18bf4f){_0x2cb0f5=_0x18bf4f;return db[_0xdf3c('0x4a')][_0xdf3c('0x4d')]({'raw':!![]});})[_0xdf3c('0x1e')](function(_0x1efa9c){var _0x50805c=fs[_0xdf3c('0x5c')](path[_0xdf3c('0x5d')](config[_0xdf3c('0x5e')],_0xdf3c('0x5f')),'utf8');var _0xb867a1=fs[_0xdf3c('0x5c')](path[_0xdf3c('0x5d')](config[_0xdf3c('0x5e')],_0xdf3c('0x60')),_0xdf3c('0x61'));var _0x19c851=ejs['render'](_0x50805c,{'trunks':_0x1efa9c||[]});fs[_0xdf3c('0x62')](_0xdf3c('0x63'),_0x19c851);if(_0x2cb0f5['registry']){var _0x52a2e1=ejs[_0xdf3c('0x64')](_0xb867a1,{'trunks':_0x1efa9c||[]});fs[_0xdf3c('0x62')](_0xdf3c('0x65'),_0x52a2e1);}})[_0xdf3c('0x1e')](function(){return respondWithRpcPromise(_0xdf3c('0x66'),_0xdf3c('0x54'),{'module':_0xdf3c('0x67')});})[_0xdf3c('0x1e')](function(){var _0x5e6606=_0x34000c[_0xdf3c('0x56')][_0xdf3c('0x33')]({'plain':!![]});if(!_0x5e6606)throw new Error(_0xdf3c('0x57'));if(_0x5e6606['role']===_0xdf3c('0x56')){var _0x354ff4=_0x2cb0f5[_0xdf3c('0x33')]({'plain':!![]});return db['UserProfileSection'][_0xdf3c('0x4f')]({'where':{'name':_0xdf3c('0x59'),'userProfileId':_0x5e6606[_0xdf3c('0x68')]},'raw':!![]})[_0xdf3c('0x1e')](function(_0xe01538){if(_0xe01538&&_0xe01538[_0xdf3c('0x69')]===0x0){return db['UserProfileResource']['create']({'name':_0x354ff4['name'],'resourceId':_0x354ff4['id'],'type':_0xe01538['name'],'sectionId':_0xe01538['id']},{})['then'](function(){return _0x2cb0f5;});}else{return _0x2cb0f5;}})[_0xdf3c('0x28')](function(_0x3f43a0){logger[_0xdf3c('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f43a0);throw _0x3f43a0;});}return _0x2cb0f5;})[_0xdf3c('0x1e')](respondWithResult(_0x4be79a,0xc9))[_0xdf3c('0x28')](handleError(_0x4be79a,null));};exports[_0xdf3c('0x32')]=function(_0x51e8c6,_0x591936,_0x233718){var _0x4e3517;return db[_0xdf3c('0x4a')]['find']({'where':{'id':_0x51e8c6[_0xdf3c('0x6a')]['id']}})[_0xdf3c('0x1e')](handleEntityNotFound(_0x591936,null))[_0xdf3c('0x1e')](saveUpdates(_0x51e8c6[_0xdf3c('0x55')],null))['then'](function(_0x5148f6){if(_0x5148f6){_0x4e3517=_0x5148f6;return db[_0xdf3c('0x4a')][_0xdf3c('0x4d')]({'raw':!![]});}})[_0xdf3c('0x1e')](function(_0x12a7b0){if(_0x12a7b0){var _0x39d9f0=fs[_0xdf3c('0x5c')](path['join'](config[_0xdf3c('0x5e')],'server/files/templates/trunk.ejs'),_0xdf3c('0x61'));var _0x9c761a=fs[_0xdf3c('0x5c')](path[_0xdf3c('0x5d')](config[_0xdf3c('0x5e')],'server/files/templates/registry.ejs'),_0xdf3c('0x61'));var _0x5c27cc=ejs[_0xdf3c('0x64')](_0x39d9f0,{'trunks':_0x12a7b0||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x5c27cc);var _0x53b0c3=ejs['render'](_0x9c761a,{'trunks':_0x12a7b0||[]});fs[_0xdf3c('0x62')](_0xdf3c('0x65'),_0x53b0c3);return respondWithRpcPromise(_0xdf3c('0x66'),_0xdf3c('0x32'),{'module':_0xdf3c('0x67')});}return null;})[_0xdf3c('0x1e')](function(_0x5c8e5e){if(_0x5c8e5e){return _0x4e3517;}})[_0xdf3c('0x1e')](respondWithResult(_0x591936,null))['catch'](handleError(_0x591936,null));};exports[_0xdf3c('0x35')]=function(_0x389708,_0x2e5f82,_0x15a057){var _0x320452;return db[_0xdf3c('0x4a')][_0xdf3c('0x4f')]({'where':{'id':_0x389708[_0xdf3c('0x6a')]['id']}})[_0xdf3c('0x1e')](handleEntityNotFound(_0x2e5f82,null))[_0xdf3c('0x1e')](removeEntity(_0x2e5f82,null))[_0xdf3c('0x1e')](function(){return db[_0xdf3c('0x4a')][_0xdf3c('0x4d')]({'raw':!![]});})[_0xdf3c('0x1e')](function(_0x55fd73){var _0x118ab5=fs[_0xdf3c('0x5c')](path[_0xdf3c('0x5d')](config[_0xdf3c('0x5e')],'server/files/templates/trunk.ejs'),_0xdf3c('0x61'));var _0x1c8fe4=fs['readFileSync'](path['join'](config[_0xdf3c('0x5e')],_0xdf3c('0x60')),_0xdf3c('0x61'));var _0x1aaf8b=ejs[_0xdf3c('0x64')](_0x118ab5,{'trunks':_0x55fd73});var _0x56fc77=ejs[_0xdf3c('0x64')](_0x1c8fe4,{'trunks':_0x55fd73});fs[_0xdf3c('0x62')](_0xdf3c('0x63'),_0x1aaf8b);fs[_0xdf3c('0x62')](_0xdf3c('0x65'),_0x56fc77);return respondWithRpcPromise(_0xdf3c('0x66'),'destroy',{'module':_0xdf3c('0x67')});})[_0xdf3c('0x28')](handleError(_0x2e5f82,null));}; \ No newline at end of file +var _0x8ef6=['userProfileId','autoAssociation','UserProfileResource','readFileSync','join','root','server/files/templates/trunk.ejs','server/files/templates/registry.ejs','utf8','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Reload','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','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/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','update','destroy','Trunks','stack','name','send','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','options','Trunk','includeAll','include','findAll','rows','show','params','rawAttributes','merge','find','catch','clone','omit','createdAt','updatedAt','create','body','get','role','UserProfileSection'];(function(_0x151583,_0x4ee353){var _0x36661c=function(_0x37889a){while(--_0x37889a){_0x151583['push'](_0x151583['shift']());}};_0x36661c(++_0x4ee353);}(_0x8ef6,0xf2));var _0x68ef=function(_0x5f1885,_0x4bc2e6){_0x5f1885=_0x5f1885-0x0;var _0x51c92b=_0x8ef6[_0x5f1885];return _0x51c92b;};'use strict';var emlformat=require(_0x68ef('0x0'));var rimraf=require(_0x68ef('0x1'));var zipdir=require(_0x68ef('0x2'));var jsonpatch=require(_0x68ef('0x3'));var rp=require(_0x68ef('0x4'));var moment=require(_0x68ef('0x5'));var BPromise=require(_0x68ef('0x6'));var Mustache=require('mustache');var util=require(_0x68ef('0x7'));var path=require(_0x68ef('0x8'));var sox=require(_0x68ef('0x9'));var csv=require(_0x68ef('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x68ef('0xb'));var squel=require(_0x68ef('0xc'));var crypto=require(_0x68ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68ef('0xe'));var toCsv=require(_0x68ef('0xa'));var querystring=require(_0x68ef('0xf'));var Papa=require(_0x68ef('0x10'));var Redis=require(_0x68ef('0x11'));var authService=require(_0x68ef('0x12'));var qs=require(_0x68ef('0x13'));var as=require(_0x68ef('0x14'));var hardwareService=require(_0x68ef('0x15'));var logger=require(_0x68ef('0x16'))(_0x68ef('0x17'));var utils=require(_0x68ef('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x68ef('0x19'));var db=require(_0x68ef('0x1a'))['db'];var jayson=require(_0x68ef('0x1b'));var client=jayson[_0x68ef('0x1c')][_0x68ef('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x288cc9,_0x508671,_0x3b48dd,_0xc50cce){return new BPromise(function(_0x2657c5,_0x47fbb5){var _0x22fe96=_0xc50cce||client;return _0x22fe96[_0x68ef('0x1e')](_0x288cc9,_0x3b48dd)[_0x68ef('0x1f')](function(_0x5005ba){logger[_0x68ef('0x20')](_0x68ef('0x21'),_0x508671,_0x68ef('0x22'));logger[_0x68ef('0x23')]('Trunk,\x20%s,\x20%s,\x20%s',_0x508671,_0x68ef('0x22'),JSON['stringify'](_0x5005ba));if(_0x5005ba['error']){if(_0x5005ba[_0x68ef('0x24')][_0x68ef('0x25')]===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x508671,_0x5005ba[_0x68ef('0x24')][_0x68ef('0x26')]);return _0x47fbb5(_0x5005ba[_0x68ef('0x24')]['message']);}logger[_0x68ef('0x24')](_0x68ef('0x21'),_0x508671,_0x5005ba[_0x68ef('0x24')]['message']);return _0x2657c5(_0x5005ba[_0x68ef('0x24')][_0x68ef('0x26')]);}else{logger['info'](_0x68ef('0x21'),_0x508671,_0x68ef('0x22'));_0x2657c5(_0x5005ba[_0x68ef('0x27')]['message']);}})['catch'](function(_0x59bebc){logger[_0x68ef('0x24')](_0x68ef('0x21'),_0x508671,_0x59bebc);_0x47fbb5(_0x59bebc);});});}function respondWithStatusCode(_0x312cc9,_0x2e6e39){_0x2e6e39=_0x2e6e39||0xcc;return function(_0x438b4c){if(_0x438b4c){return _0x312cc9[_0x68ef('0x28')](_0x2e6e39);}return _0x312cc9[_0x68ef('0x29')](_0x2e6e39)[_0x68ef('0x2a')]();};}function respondWithResult(_0x65fd09,_0x13280b){_0x13280b=_0x13280b||0xc8;return function(_0x5e4dbe){if(_0x5e4dbe){return _0x65fd09[_0x68ef('0x29')](_0x13280b)['json'](_0x5e4dbe);}};}function respondWithFilteredResult(_0x599243,_0x55d8b0){return function(_0x1a7ce1){if(_0x1a7ce1){var _0x268f32=typeof _0x55d8b0[_0x68ef('0x2b')]===_0x68ef('0x2c')&&typeof _0x55d8b0['limit']==='undefined';var _0x1cbe4f=_0x1a7ce1[_0x68ef('0x2d')];var _0x7bf96=_0x268f32?0x0:_0x55d8b0[_0x68ef('0x2b')];var _0x22ef25=_0x268f32?_0x1a7ce1[_0x68ef('0x2d')]:_0x55d8b0[_0x68ef('0x2b')]+_0x55d8b0[_0x68ef('0x2e')];var _0x5a6dfd;if(_0x22ef25>=_0x1cbe4f){_0x22ef25=_0x1cbe4f;_0x5a6dfd=0xc8;}else{_0x5a6dfd=0xce;}_0x599243[_0x68ef('0x29')](_0x5a6dfd);return _0x599243[_0x68ef('0x2f')](_0x68ef('0x30'),_0x7bf96+'-'+_0x22ef25+'/'+_0x1cbe4f)['json'](_0x1a7ce1);}return null;};}function patchUpdates(_0x370a8f){return function(_0x523120){try{jsonpatch[_0x68ef('0x31')](_0x523120,_0x370a8f,!![]);}catch(_0x17588a){return BPromise['reject'](_0x17588a);}return _0x523120['save']();};}function saveUpdates(_0x159395,_0x5fa72a){return function(_0x4b8fc8){if(_0x4b8fc8){return _0x4b8fc8[_0x68ef('0x32')](_0x159395)[_0x68ef('0x1f')](function(_0x2d67be){return _0x2d67be;});}return null;};}function removeEntity(_0x2d1e9f,_0x59e9fb){return function(_0x2c8bd0){if(_0x2c8bd0){return _0x2c8bd0[_0x68ef('0x33')]()['then'](function(){var _0x2f8de2=_0x2c8bd0['get']({'plain':!![]});var _0x14581d=_0x68ef('0x34');return db['UserProfileResource'][_0x68ef('0x33')]({'where':{'type':_0x14581d,'resourceId':_0x2f8de2['id']}})['then'](function(){return _0x2c8bd0;});})[_0x68ef('0x1f')](function(){_0x2d1e9f['status'](0xcc)[_0x68ef('0x2a')]();});}};}function handleEntityNotFound(_0x1444e0,_0x798276){return function(_0x569949){if(!_0x569949){_0x1444e0[_0x68ef('0x28')](0x194);}return _0x569949;};}function handleError(_0x485dc3,_0x476938){_0x476938=_0x476938||0x1f4;return function(_0x4c9506){logger[_0x68ef('0x24')](_0x4c9506[_0x68ef('0x35')]);if(_0x4c9506[_0x68ef('0x36')]){delete _0x4c9506[_0x68ef('0x36')];}_0x485dc3[_0x68ef('0x29')](_0x476938)[_0x68ef('0x37')](_0x4c9506);};}exports['index']=function(_0x294fba,_0x15a6ab){var _0x32074a={},_0x52a8b9={},_0x32eddd={'count':0x0,'rows':[]};var _0x3c5de6=_[_0x68ef('0x38')](db['Trunk']['rawAttributes'],function(_0x14f0fc){return{'name':_0x14f0fc[_0x68ef('0x39')],'type':_0x14f0fc[_0x68ef('0x3a')][_0x68ef('0x3b')]};});_0x52a8b9[_0x68ef('0x3c')]=_[_0x68ef('0x38')](_0x3c5de6,_0x68ef('0x36'));_0x52a8b9['query']=_[_0x68ef('0x3d')](_0x294fba[_0x68ef('0x3e')]);_0x52a8b9[_0x68ef('0x3f')]=_[_0x68ef('0x40')](_0x52a8b9['model'],_0x52a8b9[_0x68ef('0x3e')]);_0x32074a[_0x68ef('0x41')]=_[_0x68ef('0x40')](_0x52a8b9[_0x68ef('0x3c')],qs[_0x68ef('0x42')](_0x294fba[_0x68ef('0x3e')]['fields']));_0x32074a[_0x68ef('0x41')]=_0x32074a[_0x68ef('0x41')][_0x68ef('0x43')]?_0x32074a[_0x68ef('0x41')]:_0x52a8b9[_0x68ef('0x3c')];if(!_0x294fba[_0x68ef('0x3e')][_0x68ef('0x44')](_0x68ef('0x45'))){_0x32074a[_0x68ef('0x2e')]=qs['limit'](_0x294fba[_0x68ef('0x3e')][_0x68ef('0x2e')]);_0x32074a[_0x68ef('0x2b')]=qs[_0x68ef('0x2b')](_0x294fba[_0x68ef('0x3e')][_0x68ef('0x2b')]);}_0x32074a[_0x68ef('0x46')]=qs['sort'](_0x294fba[_0x68ef('0x3e')]['sort']);_0x32074a[_0x68ef('0x47')]=qs[_0x68ef('0x3f')](_[_0x68ef('0x48')](_0x294fba[_0x68ef('0x3e')],_0x52a8b9['filters']),_0x3c5de6);if(_0x294fba[_0x68ef('0x3e')]['filter']){_0x32074a[_0x68ef('0x47')]=_['merge'](_0x32074a[_0x68ef('0x47')],{'$or':_[_0x68ef('0x38')](_0x3c5de6,function(_0x105e8c){if(_0x105e8c['type']!=='VIRTUAL'){var _0x4044d5={};_0x4044d5[_0x105e8c[_0x68ef('0x36')]]={'$like':'%'+_0x294fba['query']['filter']+'%'};return _0x4044d5;}})});}_0x32074a=_['merge']({},_0x32074a,_0x294fba[_0x68ef('0x49')]);var _0x15c753={'where':_0x32074a[_0x68ef('0x47')]};return db[_0x68ef('0x4a')][_0x68ef('0x2d')](_0x15c753)['then'](function(_0x55f385){_0x32eddd[_0x68ef('0x2d')]=_0x55f385;if(_0x294fba[_0x68ef('0x3e')][_0x68ef('0x4b')]){_0x32074a[_0x68ef('0x4c')]=[{'all':!![]}];}return db['Trunk'][_0x68ef('0x4d')](_0x32074a);})[_0x68ef('0x1f')](function(_0x1c9b6f){_0x32eddd[_0x68ef('0x4e')]=_0x1c9b6f;return _0x32eddd;})['then'](respondWithFilteredResult(_0x15a6ab,_0x32074a))['catch'](handleError(_0x15a6ab,null));};exports[_0x68ef('0x4f')]=function(_0x3c3074,_0x566e7c){var _0xfc7a74={'raw':![],'where':{'id':_0x3c3074[_0x68ef('0x50')]['id']}},_0x12fff3={};_0x12fff3[_0x68ef('0x3c')]=_[_0x68ef('0x3d')](db['Trunk'][_0x68ef('0x51')]);_0x12fff3[_0x68ef('0x3e')]=_[_0x68ef('0x3d')](_0x3c3074['query']);_0x12fff3[_0x68ef('0x3f')]=_[_0x68ef('0x40')](_0x12fff3[_0x68ef('0x3c')],_0x12fff3['query']);_0xfc7a74[_0x68ef('0x41')]=_['intersection'](_0x12fff3['model'],qs[_0x68ef('0x42')](_0x3c3074['query'][_0x68ef('0x42')]));_0xfc7a74[_0x68ef('0x41')]=_0xfc7a74[_0x68ef('0x41')][_0x68ef('0x43')]?_0xfc7a74[_0x68ef('0x41')]:_0x12fff3[_0x68ef('0x3c')];if(_0x3c3074[_0x68ef('0x3e')][_0x68ef('0x4b')]){_0xfc7a74[_0x68ef('0x4c')]=[{'all':!![]}];}_0xfc7a74=_[_0x68ef('0x52')]({},_0xfc7a74,_0x3c3074['options']);return db['Trunk'][_0x68ef('0x53')](_0xfc7a74)[_0x68ef('0x1f')](handleEntityNotFound(_0x566e7c,null))[_0x68ef('0x1f')](respondWithResult(_0x566e7c,null))[_0x68ef('0x54')](handleError(_0x566e7c,null));};exports[_0x68ef('0x55')]=function(_0x1d11d7,_0x15400c){var _0x300a64={'where':{'id':_0x1d11d7['params']['id']}},_0x40c784={};_0x40c784['model']=_[_0x68ef('0x3d')](db['Trunk'][_0x68ef('0x51')]);_0x300a64['attributes']=_[_0x68ef('0x40')](_0x40c784[_0x68ef('0x3c')],qs['fields'](_0x1d11d7[_0x68ef('0x3e')]['fields']));_0x300a64[_0x68ef('0x41')]=_0x300a64[_0x68ef('0x41')][_0x68ef('0x43')]?_0x300a64[_0x68ef('0x41')]:_0x40c784[_0x68ef('0x3c')];if(_0x1d11d7[_0x68ef('0x3e')]['includeAll']){_0x300a64[_0x68ef('0x4c')]=[{'all':!![]}];}_0x300a64=_[_0x68ef('0x52')]({},_0x300a64,_0x1d11d7[_0x68ef('0x49')]);return db[_0x68ef('0x4a')][_0x68ef('0x53')](_0x300a64)[_0x68ef('0x1f')](handleEntityNotFound(_0x15400c,null))['then'](function(_0x9a978f){if(_0x9a978f){var _0x42d2a3=_0x9a978f['get']({'plain':!![]});_0x42d2a3=qs[_0x68ef('0x56')](_0x42d2a3,['id',_0x68ef('0x57'),_0x68ef('0x58')]);_0x1d11d7['body']=_[_0x68ef('0x56')](_0x1d11d7['body'],['id','createdAt',_0x68ef('0x58')]);return db['Trunk'][_0x68ef('0x59')](_['merge'](_0x42d2a3,_0x1d11d7[_0x68ef('0x5a')]),{'include':_0x1d11d7[_0x68ef('0x3e')][_0x68ef('0x4b')]?[{'all':!![]}]:undefined})[_0x68ef('0x1f')](function(_0x19ce17){var _0x19a9c4=_0x1d11d7['user'][_0x68ef('0x5b')]({'plain':!![]});if(!_0x19a9c4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x19a9c4[_0x68ef('0x5c')]==='user'){var _0x2f97c5=_0x19ce17[_0x68ef('0x5b')]({'plain':!![]});var _0x212ec4=_0x68ef('0x34');return db[_0x68ef('0x5d')][_0x68ef('0x53')]({'where':{'name':_0x212ec4,'userProfileId':_0x19a9c4[_0x68ef('0x5e')]},'raw':!![]})['then'](function(_0x3ea4e7){if(_0x3ea4e7&&_0x3ea4e7[_0x68ef('0x5f')]===0x0){return db[_0x68ef('0x60')][_0x68ef('0x59')]({'name':_0x2f97c5[_0x68ef('0x36')],'resourceId':_0x2f97c5['id'],'type':_0x3ea4e7['name'],'sectionId':_0x3ea4e7['id']},{})[_0x68ef('0x1f')](function(){return _0x19ce17;});}else{return _0x19ce17;}})['catch'](function(_0x1ed172){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ed172);throw _0x1ed172;});}return _0x19ce17;});}})[_0x68ef('0x1f')](respondWithResult(_0x15400c,0xc9))[_0x68ef('0x54')](handleError(_0x15400c,null));};exports[_0x68ef('0x59')]=function(_0x21b2ce,_0x51f905,_0x124b49){var _0x570e0c;return db[_0x68ef('0x4a')][_0x68ef('0x59')](_0x21b2ce[_0x68ef('0x5a')],{'raw':!![]})['then'](function(_0x541e35){_0x570e0c=_0x541e35;return db[_0x68ef('0x4a')][_0x68ef('0x4d')]({'raw':!![]});})[_0x68ef('0x1f')](function(_0x454c6f){var _0x5b41e1=fs[_0x68ef('0x61')](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x64')),'utf8');var _0x3f56a7=fs['readFileSync'](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x65')),_0x68ef('0x66'));var _0xed16d1=ejs['render'](_0x5b41e1,{'trunks':_0x454c6f||[]});fs[_0x68ef('0x67')](_0x68ef('0x68'),_0xed16d1);if(_0x570e0c[_0x68ef('0x69')]){var _0x595e79=ejs[_0x68ef('0x6a')](_0x3f56a7,{'trunks':_0x454c6f||[]});fs['writeFileSync'](_0x68ef('0x6b'),_0x595e79);}})['then'](function(){return respondWithRpcPromise('Reload',_0x68ef('0x59'),{'module':_0x68ef('0x6c')});})[_0x68ef('0x1f')](function(){var _0x405971=_0x21b2ce['user'][_0x68ef('0x5b')]({'plain':!![]});if(!_0x405971)throw new Error(_0x68ef('0x6d'));if(_0x405971[_0x68ef('0x5c')]==='user'){var _0x3e14a4=_0x570e0c[_0x68ef('0x5b')]({'plain':!![]});return db[_0x68ef('0x5d')][_0x68ef('0x53')]({'where':{'name':_0x68ef('0x34'),'userProfileId':_0x405971[_0x68ef('0x5e')]},'raw':!![]})[_0x68ef('0x1f')](function(_0xfe72dc){if(_0xfe72dc&&_0xfe72dc[_0x68ef('0x5f')]===0x0){return db[_0x68ef('0x60')][_0x68ef('0x59')]({'name':_0x3e14a4[_0x68ef('0x36')],'resourceId':_0x3e14a4['id'],'type':_0xfe72dc['name'],'sectionId':_0xfe72dc['id']},{})[_0x68ef('0x1f')](function(){return _0x570e0c;});}else{return _0x570e0c;}})[_0x68ef('0x54')](function(_0x5db443){logger['error'](_0x68ef('0x6e'),_0x5db443);throw _0x5db443;});}return _0x570e0c;})['then'](respondWithResult(_0x51f905,0xc9))[_0x68ef('0x54')](handleError(_0x51f905,null));};exports[_0x68ef('0x32')]=function(_0x5f1b12,_0x4e0874,_0x31a336){var _0x5c500c;return db[_0x68ef('0x4a')]['find']({'where':{'id':_0x5f1b12[_0x68ef('0x50')]['id']}})['then'](handleEntityNotFound(_0x4e0874,null))[_0x68ef('0x1f')](saveUpdates(_0x5f1b12[_0x68ef('0x5a')],null))['then'](function(_0x3c5e35){if(_0x3c5e35){_0x5c500c=_0x3c5e35;return db[_0x68ef('0x4a')][_0x68ef('0x4d')]({'raw':!![]});}})[_0x68ef('0x1f')](function(_0x50c308){if(_0x50c308){var _0x2bebdc=fs[_0x68ef('0x61')](path['join'](config[_0x68ef('0x63')],_0x68ef('0x64')),_0x68ef('0x66'));var _0x4de1d1=fs[_0x68ef('0x61')](path['join'](config[_0x68ef('0x63')],_0x68ef('0x65')),'utf8');var _0x4b0fb4=ejs['render'](_0x2bebdc,{'trunks':_0x50c308||[]});fs['writeFileSync'](_0x68ef('0x68'),_0x4b0fb4);var _0x28ad22=ejs[_0x68ef('0x6a')](_0x4de1d1,{'trunks':_0x50c308||[]});fs[_0x68ef('0x67')](_0x68ef('0x6b'),_0x28ad22);return respondWithRpcPromise(_0x68ef('0x6f'),_0x68ef('0x32'),{'module':_0x68ef('0x6c')});}return null;})[_0x68ef('0x1f')](function(_0x3ae3e9){if(_0x3ae3e9){return _0x5c500c;}})[_0x68ef('0x1f')](respondWithResult(_0x4e0874,null))[_0x68ef('0x54')](handleError(_0x4e0874,null));};exports[_0x68ef('0x33')]=function(_0x4bd5c3,_0x2b20dc,_0x556dfc){var _0x791181;return db['Trunk']['find']({'where':{'id':_0x4bd5c3[_0x68ef('0x50')]['id']}})[_0x68ef('0x1f')](handleEntityNotFound(_0x2b20dc,null))[_0x68ef('0x1f')](removeEntity(_0x2b20dc,null))[_0x68ef('0x1f')](function(){return db['Trunk']['findAll']({'raw':!![]});})[_0x68ef('0x1f')](function(_0x308997){var _0x1f1dfd=fs['readFileSync'](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x64')),_0x68ef('0x66'));var _0x4dc885=fs[_0x68ef('0x61')](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x65')),_0x68ef('0x66'));var _0x346049=ejs['render'](_0x1f1dfd,{'trunks':_0x308997});var _0x2a72e8=ejs['render'](_0x4dc885,{'trunks':_0x308997});fs[_0x68ef('0x67')](_0x68ef('0x68'),_0x346049);fs[_0x68ef('0x67')](_0x68ef('0x6b'),_0x2a72e8);return respondWithRpcPromise('Reload',_0x68ef('0x33'),{'module':'chan_sip.so'});})[_0x68ef('0x54')](handleError(_0x2b20dc,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 6772069..e7b798d 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 _0xcb78=['path','rimraf','../../config/environment','./trunk.attributes','define','Trunk','tools_trunks','lodash','api','bluebird','request-promise'];(function(_0x3ee21e,_0x5cf64c){var _0x10755a=function(_0x31d3a9){while(--_0x31d3a9){_0x3ee21e['push'](_0x3ee21e['shift']());}};_0x10755a(++_0x5cf64c);}(_0xcb78,0x167));var _0x8cb7=function(_0x4471d3,_0x4c57ee){_0x4471d3=_0x4471d3-0x0;var _0x9aa975=_0xcb78[_0x4471d3];return _0x9aa975;};'use strict';var _=require(_0x8cb7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8cb7('0x1'));var moment=require('moment');var BPromise=require(_0x8cb7('0x2'));var rp=require(_0x8cb7('0x3'));var fs=require('fs');var path=require(_0x8cb7('0x4'));var rimraf=require(_0x8cb7('0x5'));var config=require(_0x8cb7('0x6'));var attributes=require(_0x8cb7('0x7'));module['exports']=function(_0x4df1d5,_0x12858b){return _0x4df1d5[_0x8cb7('0x8')](_0x8cb7('0x9'),attributes,{'tableName':_0x8cb7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ff7=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','Trunk','tools_trunks','lodash','util','../../config/logger','api'];(function(_0x572b48,_0x59136f){var _0x20891c=function(_0x5ec467){while(--_0x5ec467){_0x572b48['push'](_0x572b48['shift']());}};_0x20891c(++_0x59136f);}(_0x7ff7,0xf3));var _0x77ff=function(_0x5fdb22,_0x24aaf9){_0x5fdb22=_0x5fdb22-0x0;var _0xaa6d7e=_0x7ff7[_0x5fdb22];return _0xaa6d7e;};'use strict';var _=require(_0x77ff('0x0'));var util=require(_0x77ff('0x1'));var logger=require(_0x77ff('0x2'))(_0x77ff('0x3'));var moment=require(_0x77ff('0x4'));var BPromise=require(_0x77ff('0x5'));var rp=require(_0x77ff('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x77ff('0x7'));var config=require(_0x77ff('0x8'));var attributes=require('./trunk.attributes');module[_0x77ff('0x9')]=function(_0x320c4f,_0x1d00ff){return _0x320c4f[_0x77ff('0xa')](_0x77ff('0xb'),attributes,{'tableName':_0x77ff('0xc'),'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 92bb237..425ef48 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 _0xd036=['bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','GetTrunk','findAll','options','raw','where','attributes','limit','include','model','map','then','debug','ShowTrunk','Trunk','find','lodash','util','moment'];(function(_0x5eb1e0,_0x5b7720){var _0x4295e2=function(_0x164e6a){while(--_0x164e6a){_0x5eb1e0['push'](_0x5eb1e0['shift']());}};_0x4295e2(++_0x5b7720);}(_0xd036,0x100));var _0x6d03=function(_0x3bdd40,_0x414ee6){_0x3bdd40=_0x3bdd40-0x0;var _0x216370=_0xd036[_0x3bdd40];return _0x216370;};'use strict';var _=require(_0x6d03('0x0'));var util=require(_0x6d03('0x1'));var moment=require(_0x6d03('0x2'));var BPromise=require(_0x6d03('0x3'));var rs=require(_0x6d03('0x4'));var fs=require('fs');var Redis=require(_0x6d03('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6d03('0x6'));var logger=require('../../config/logger')(_0x6d03('0x7'));var config=require(_0x6d03('0x8'));var jayson=require(_0x6d03('0x9'));var client=jayson[_0x6d03('0xa')][_0x6d03('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3cc2f8,_0x53a338,_0x2a31d1){return new BPromise(function(_0x1ffbb0,_0x560c2e){return client[_0x6d03('0xc')](_0x3cc2f8,_0x2a31d1)['then'](function(_0x14c514){logger[_0x6d03('0xd')](_0x6d03('0xe'),_0x53a338,_0x6d03('0xf'));logger['debug'](_0x6d03('0x10'),_0x53a338,_0x6d03('0xf'),JSON[_0x6d03('0x11')](_0x14c514));if(_0x14c514['error']){if(_0x14c514['error'][_0x6d03('0x12')]===0x1f4){logger[_0x6d03('0x13')](_0x6d03('0xe'),_0x53a338,_0x14c514[_0x6d03('0x13')]['message']);return _0x560c2e(_0x14c514[_0x6d03('0x13')]['message']);}logger[_0x6d03('0x13')](_0x6d03('0xe'),_0x53a338,_0x14c514['error'][_0x6d03('0x14')]);return _0x1ffbb0(_0x14c514['error'][_0x6d03('0x14')]);}else{logger[_0x6d03('0xd')]('Trunk,\x20%s,\x20%s',_0x53a338,'request\x20sent');_0x1ffbb0(_0x14c514['result'][_0x6d03('0x14')]);}})[_0x6d03('0x15')](function(_0x439e75){logger[_0x6d03('0x13')]('Trunk,\x20%s,\x20%s',_0x53a338,_0x439e75);_0x560c2e(_0x439e75);});});}exports[_0x6d03('0x16')]=function(_0x4493cd){var _0x4d7e22=this;return new Promise(function(_0x4077c4,_0x478957){return db['Trunk'][_0x6d03('0x17')]({'raw':_0x4493cd[_0x6d03('0x18')]?_0x4493cd[_0x6d03('0x18')][_0x6d03('0x19')]===undefined?!![]:![]:!![],'where':_0x4493cd[_0x6d03('0x18')]?_0x4493cd[_0x6d03('0x18')][_0x6d03('0x1a')]||null:null,'attributes':_0x4493cd[_0x6d03('0x18')]?_0x4493cd['options'][_0x6d03('0x1b')]||null:null,'limit':_0x4493cd[_0x6d03('0x18')]?_0x4493cd['options'][_0x6d03('0x1c')]||null:null,'include':_0x4493cd[_0x6d03('0x18')]?_0x4493cd[_0x6d03('0x18')][_0x6d03('0x1d')]?_['map'](_0x4493cd[_0x6d03('0x18')][_0x6d03('0x1d')],function(_0xa3bb1d){return{'model':db[_0xa3bb1d[_0x6d03('0x1e')]],'as':_0xa3bb1d['as'],'attributes':_0xa3bb1d[_0x6d03('0x1b')],'include':_0xa3bb1d[_0x6d03('0x1d')]?_[_0x6d03('0x1f')](_0xa3bb1d[_0x6d03('0x1d')],function(_0x228c2d){return{'model':db[_0x228c2d['model']],'as':_0x228c2d['as'],'attributes':_0x228c2d[_0x6d03('0x1b')],'include':_0x228c2d[_0x6d03('0x1d')]?_['map'](_0x228c2d['include'],function(_0x11321a){return{'model':db[_0x11321a['model']],'as':_0x11321a['as'],'attributes':_0x11321a[_0x6d03('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6d03('0x20')](function(_0x46211e){logger['info'](_0x6d03('0x16'),_0x4493cd);logger[_0x6d03('0x21')]('GetTrunk',_0x4493cd,JSON[_0x6d03('0x11')](_0x46211e));_0x4077c4(_0x46211e);})[_0x6d03('0x15')](function(_0x170730){logger[_0x6d03('0x13')](_0x6d03('0x16'),_0x170730[_0x6d03('0x14')],_0x4493cd);_0x478957(_0x4d7e22[_0x6d03('0x13')](0x1f4,_0x170730[_0x6d03('0x14')]));});});};exports[_0x6d03('0x22')]=function(_0x5bb05a){var _0x461ff1=this;return new Promise(function(_0x2be040,_0x4d5697){return db[_0x6d03('0x23')][_0x6d03('0x24')]({'raw':_0x5bb05a['options']?_0x5bb05a[_0x6d03('0x18')][_0x6d03('0x19')]===undefined?!![]:![]:!![],'where':_0x5bb05a[_0x6d03('0x18')]?_0x5bb05a[_0x6d03('0x18')][_0x6d03('0x1a')]||null:null,'attributes':_0x5bb05a[_0x6d03('0x18')]?_0x5bb05a['options'][_0x6d03('0x1b')]||null:null,'include':_0x5bb05a[_0x6d03('0x18')]?_0x5bb05a['options']['include']?_['map'](_0x5bb05a[_0x6d03('0x18')][_0x6d03('0x1d')],function(_0x3e5b45){return{'model':db[_0x3e5b45[_0x6d03('0x1e')]],'as':_0x3e5b45['as'],'attributes':_0x3e5b45[_0x6d03('0x1b')],'include':_0x3e5b45[_0x6d03('0x1d')]?_['map'](_0x3e5b45[_0x6d03('0x1d')],function(_0x20006c){return{'model':db[_0x20006c[_0x6d03('0x1e')]],'as':_0x20006c['as'],'attributes':_0x20006c['attributes'],'include':_0x20006c[_0x6d03('0x1d')]?_[_0x6d03('0x1f')](_0x20006c[_0x6d03('0x1d')],function(_0x51437f){return{'model':db[_0x51437f[_0x6d03('0x1e')]],'as':_0x51437f['as'],'attributes':_0x51437f[_0x6d03('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6d03('0x20')](function(_0x560c10){logger[_0x6d03('0xd')](_0x6d03('0x22'),_0x5bb05a);logger['debug'](_0x6d03('0x22'),_0x5bb05a,JSON[_0x6d03('0x11')](_0x560c10));_0x2be040(_0x560c10);})[_0x6d03('0x15')](function(_0x17737c){logger[_0x6d03('0x13')](_0x6d03('0x22'),_0x17737c[_0x6d03('0x14')],_0x5bb05a);_0x4d5697(_0x461ff1['error'](0x1f4,_0x17737c[_0x6d03('0x14')]));});});}; \ No newline at end of file +var _0x0157=['options','raw','where','attributes','limit','include','model','map','catch','ShowTrunk','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','GetTrunk','Trunk'];(function(_0x4f380b,_0x5ce6ea){var _0x3958bf=function(_0x11437a){while(--_0x11437a){_0x4f380b['push'](_0x4f380b['shift']());}};_0x3958bf(++_0x5ce6ea);}(_0x0157,0xf9));var _0x7015=function(_0x594966,_0x50d223){_0x594966=_0x594966-0x0;var _0x186138=_0x0157[_0x594966];return _0x186138;};'use strict';var _=require(_0x7015('0x0'));var util=require('util');var moment=require(_0x7015('0x1'));var BPromise=require(_0x7015('0x2'));var rs=require(_0x7015('0x3'));var fs=require('fs');var Redis=require(_0x7015('0x4'));var db=require(_0x7015('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7015('0x6'))(_0x7015('0x7'));var config=require(_0x7015('0x8'));var jayson=require(_0x7015('0x9'));var client=jayson[_0x7015('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x37d143,_0x4a2931,_0x3d06fc){return new BPromise(function(_0x43b84e,_0x46db77){return client[_0x7015('0xb')](_0x37d143,_0x3d06fc)[_0x7015('0xc')](function(_0x232eed){logger[_0x7015('0xd')](_0x7015('0xe'),_0x4a2931,_0x7015('0xf'));logger[_0x7015('0x10')]('Trunk,\x20%s,\x20%s,\x20%s',_0x4a2931,_0x7015('0xf'),JSON[_0x7015('0x11')](_0x232eed));if(_0x232eed[_0x7015('0x12')]){if(_0x232eed['error']['code']===0x1f4){logger[_0x7015('0x12')]('Trunk,\x20%s,\x20%s',_0x4a2931,_0x232eed[_0x7015('0x12')][_0x7015('0x13')]);return _0x46db77(_0x232eed[_0x7015('0x12')][_0x7015('0x13')]);}logger[_0x7015('0x12')](_0x7015('0xe'),_0x4a2931,_0x232eed[_0x7015('0x12')]['message']);return _0x43b84e(_0x232eed[_0x7015('0x12')][_0x7015('0x13')]);}else{logger[_0x7015('0xd')](_0x7015('0xe'),_0x4a2931,_0x7015('0xf'));_0x43b84e(_0x232eed[_0x7015('0x14')][_0x7015('0x13')]);}})['catch'](function(_0x30625e){logger[_0x7015('0x12')](_0x7015('0xe'),_0x4a2931,_0x30625e);_0x46db77(_0x30625e);});});}exports[_0x7015('0x15')]=function(_0x1156f8){var _0x330b12=this;return new Promise(function(_0x41ee98,_0x5bf7e1){return db[_0x7015('0x16')]['findAll']({'raw':_0x1156f8[_0x7015('0x17')]?_0x1156f8[_0x7015('0x17')][_0x7015('0x18')]===undefined?!![]:![]:!![],'where':_0x1156f8[_0x7015('0x17')]?_0x1156f8[_0x7015('0x17')][_0x7015('0x19')]||null:null,'attributes':_0x1156f8[_0x7015('0x17')]?_0x1156f8['options'][_0x7015('0x1a')]||null:null,'limit':_0x1156f8['options']?_0x1156f8['options'][_0x7015('0x1b')]||null:null,'include':_0x1156f8[_0x7015('0x17')]?_0x1156f8[_0x7015('0x17')][_0x7015('0x1c')]?_['map'](_0x1156f8[_0x7015('0x17')]['include'],function(_0x276fad){return{'model':db[_0x276fad[_0x7015('0x1d')]],'as':_0x276fad['as'],'attributes':_0x276fad[_0x7015('0x1a')],'include':_0x276fad[_0x7015('0x1c')]?_['map'](_0x276fad[_0x7015('0x1c')],function(_0x5866dc){return{'model':db[_0x5866dc[_0x7015('0x1d')]],'as':_0x5866dc['as'],'attributes':_0x5866dc[_0x7015('0x1a')],'include':_0x5866dc[_0x7015('0x1c')]?_[_0x7015('0x1e')](_0x5866dc['include'],function(_0x4454a6){return{'model':db[_0x4454a6[_0x7015('0x1d')]],'as':_0x4454a6['as'],'attributes':_0x4454a6[_0x7015('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x20b217){logger['info']('GetTrunk',_0x1156f8);logger[_0x7015('0x10')](_0x7015('0x15'),_0x1156f8,JSON[_0x7015('0x11')](_0x20b217));_0x41ee98(_0x20b217);})[_0x7015('0x1f')](function(_0xf982df){logger['error'](_0x7015('0x15'),_0xf982df[_0x7015('0x13')],_0x1156f8);_0x5bf7e1(_0x330b12['error'](0x1f4,_0xf982df['message']));});});};exports[_0x7015('0x20')]=function(_0x51cb57){var _0x4013b0=this;return new Promise(function(_0xd61dc7,_0x31c569){return db['Trunk'][_0x7015('0x21')]({'raw':_0x51cb57[_0x7015('0x17')]?_0x51cb57['options'][_0x7015('0x18')]===undefined?!![]:![]:!![],'where':_0x51cb57[_0x7015('0x17')]?_0x51cb57[_0x7015('0x17')][_0x7015('0x19')]||null:null,'attributes':_0x51cb57['options']?_0x51cb57[_0x7015('0x17')][_0x7015('0x1a')]||null:null,'include':_0x51cb57['options']?_0x51cb57['options']['include']?_[_0x7015('0x1e')](_0x51cb57[_0x7015('0x17')][_0x7015('0x1c')],function(_0x5efa9e){return{'model':db[_0x5efa9e[_0x7015('0x1d')]],'as':_0x5efa9e['as'],'attributes':_0x5efa9e['attributes'],'include':_0x5efa9e['include']?_[_0x7015('0x1e')](_0x5efa9e[_0x7015('0x1c')],function(_0x18976b){return{'model':db[_0x18976b[_0x7015('0x1d')]],'as':_0x18976b['as'],'attributes':_0x18976b[_0x7015('0x1a')],'include':_0x18976b[_0x7015('0x1c')]?_[_0x7015('0x1e')](_0x18976b['include'],function(_0x391507){return{'model':db[_0x391507[_0x7015('0x1d')]],'as':_0x391507['as'],'attributes':_0x391507[_0x7015('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x7015('0xc')](function(_0x32d0b4){logger[_0x7015('0xd')]('ShowTrunk',_0x51cb57);logger[_0x7015('0x10')]('ShowTrunk',_0x51cb57,JSON['stringify'](_0x32d0b4));_0xd61dc7(_0x32d0b4);})[_0x7015('0x1f')](function(_0x225ec3){logger['error'](_0x7015('0x20'),_0x225ec3[_0x7015('0x13')],_0x51cb57);_0x31c569(_0x4013b0[_0x7015('0x12')](0x1f4,_0x225ec3['message']));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 1fe21d8..f38d3ec 100644 --- a/server/api/user-setting/index.js +++ b/server/api/user-setting/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0bf5=['isAuthenticated','update','express','Router','../../components/auth/service','./user-setting.controller','put','/:id'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x0bf5,0xfa));var _0x50bf=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x0bf5[_0x46e363];return _0x3fb059;};'use strict';var express=require(_0x50bf('0x0'));var router=express[_0x50bf('0x1')]();var auth=require(_0x50bf('0x2'));var controller=require(_0x50bf('0x3'));router[_0x50bf('0x4')](_0x50bf('0x5'),auth[_0x50bf('0x6')](),controller[_0x50bf('0x7')]);module['exports']=router; \ No newline at end of file +var _0x4da8=['../../components/auth/service','./user-setting.controller','put','/:id','isAuthenticated','update','exports','express'];(function(_0x1dd385,_0x3610ec){var _0x1f0a4a=function(_0x15ebd0){while(--_0x15ebd0){_0x1dd385['push'](_0x1dd385['shift']());}};_0x1f0a4a(++_0x3610ec);}(_0x4da8,0x197));var _0x84da=function(_0x1cad56,_0x454803){_0x1cad56=_0x1cad56-0x0;var _0x552e0b=_0x4da8[_0x1cad56];return _0x552e0b;};'use strict';var express=require(_0x84da('0x0'));var router=express['Router']();var auth=require(_0x84da('0x1'));var controller=require(_0x84da('0x2'));router[_0x84da('0x3')](_0x84da('0x4'),auth[_0x84da('0x5')](),controller[_0x84da('0x6')]);module[_0x84da('0x7')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index da0de26..6dee0f5 100644 --- a/server/api/user-setting/user-setting.attributes.js +++ b/server/api/user-setting/user-setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4126=['info','debug','ENUM','BOOLEAN','TEXT','DATE','INTEGER','UserId','sequelize','error','warning'];(function(_0x45346d,_0xffd56b){var _0x5ce7ca=function(_0x27ce87){while(--_0x27ce87){_0x45346d['push'](_0x45346d['shift']());}};_0x5ce7ca(++_0xffd56b);}(_0x4126,0x1aa));var _0x6412=function(_0x479160,_0x3ab560){_0x479160=_0x479160-0x0;var _0x47ac6d=_0x4126[_0x479160];return _0x47ac6d;};'use strict';var Sequelize=require(_0x6412('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x6412('0x1'),_0x6412('0x2'),_0x6412('0x3'),_0x6412('0x4')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0x6412('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x6412('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x6412('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x6412('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x6412('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x6412('0x9')],'unique':_0x6412('0xa')}}; \ No newline at end of file +var _0x1b23=['ENUM','BOOLEAN','DATE','INTEGER','UserId','sequelize','error','warning','info','debug'];(function(_0x37ab65,_0x2e824d){var _0x5a7ea8=function(_0x10c08c){while(--_0x10c08c){_0x37ab65['push'](_0x37ab65['shift']());}};_0x5a7ea8(++_0x2e824d);}(_0x1b23,0x1e5));var _0x31b2=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1b23[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0x31b2('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x31b2('0x1'),_0x31b2('0x2'),_0x31b2('0x3'),_0x31b2('0x4')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0x31b2('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x31b2('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x31b2('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x31b2('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x31b2('0x8')],'unique':_0x31b2('0x9')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index 258bfc4..1997167 100644 --- a/server/api/user-setting/user-setting.controller.js +++ b/server/api/user-setting/user-setting.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0434=['api','../../config/environment','redis','./user-setting.socket','register','defaults','json','update','then','error','stack','name','status','send','user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','body','catch','lodash','ioredis','../../config/logger'];(function(_0xfb42e6,_0x5f5d4b){var _0x27265b=function(_0x163e81){while(--_0x163e81){_0xfb42e6['push'](_0xfb42e6['shift']());}};_0x27265b(++_0x5f5d4b);}(_0x0434,0x1ad));var _0x4043=function(_0x25fa5c,_0x421141){_0x25fa5c=_0x25fa5c-0x0;var _0x1bade2=_0x0434[_0x25fa5c];return _0x1bade2;};'use strict';var _=require(_0x4043('0x0'));var Redis=require(_0x4043('0x1'));var logger=require(_0x4043('0x2'))(_0x4043('0x3'));var config=require(_0x4043('0x4'));var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x4043('0x5')]));require(_0x4043('0x6'))[_0x4043('0x7')](socket);config[_0x4043('0x5')]=_[_0x4043('0x8')](config[_0x4043('0x5')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x41d0a9,_0x1ed6c4){_0x1ed6c4=_0x1ed6c4||0xc8;return function(_0x5080e5){if(_0x5080e5){return _0x41d0a9['status'](_0x1ed6c4)[_0x4043('0x9')](_0x5080e5);}};}function saveUpdates(_0x2b959b){return function(_0x3d42ca){if(_0x3d42ca){return _0x3d42ca[_0x4043('0xa')](_0x2b959b)[_0x4043('0xb')](function(_0x22e13c){return _0x22e13c;});}return null;};}function handleEntityNotFound(_0xaff9dd){return function(_0x113bbe){if(!_0x113bbe){_0xaff9dd['sendStatus'](0x194);}return _0x113bbe;};}function handleError(_0x15602f,_0xb765cd){_0xb765cd=_0xb765cd||0x1f4;return function(_0x427128){logger[_0x4043('0xc')](_0x427128[_0x4043('0xd')]);if(_0x427128['name']){delete _0x427128[_0x4043('0xe')];}_0x15602f[_0x4043('0xf')](_0xb765cd)[_0x4043('0x10')](_0x427128);};}exports[_0x4043('0xa')]=function(_0x256291,_0x5bb2a6){if(_0x256291[_0x4043('0x11')][_0x4043('0x12')]!==_0x4043('0x13'))throw new Error(_0x4043('0x14'));if(isNaN(Number(_0x256291[_0x4043('0x15')]['id'])))throw new Error(_0x4043('0x16'));return db[_0x4043('0x17')][_0x4043('0x18')]({'where':{'id':_0x256291[_0x4043('0x15')]['id']}})[_0x4043('0xb')](handleEntityNotFound(_0x5bb2a6,null))[_0x4043('0xb')](saveUpdates(_0x256291[_0x4043('0x19')],null))['then'](respondWithResult(_0x5bb2a6,null))[_0x4043('0x1a')](handleError(_0x5bb2a6,null));}; \ No newline at end of file +var _0xa588=['ioredis','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','defaults','localhost','status','json','update','then','sendStatus','name','send','role','admin','params','Invalid\x20user\x20setting\x20id','UserSetting','find','catch'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xa588,0xe1));var _0x8a58=function(_0x31de3d,_0x3e858e){_0x31de3d=_0x31de3d-0x0;var _0x3e717a=_0xa588[_0x31de3d];return _0x3e717a;};'use strict';var _=require('lodash');var Redis=require(_0x8a58('0x0'));var logger=require(_0x8a58('0x1'))(_0x8a58('0x2'));var config=require(_0x8a58('0x3'));var db=require(_0x8a58('0x4'))['db'];var socket=require(_0x8a58('0x5'))(new Redis(config[_0x8a58('0x6')]));require(_0x8a58('0x7'))[_0x8a58('0x8')](socket);config['redis']=_[_0x8a58('0x9')](config[_0x8a58('0x6')],{'host':_0x8a58('0xa'),'port':0x18eb});function respondWithResult(_0x35d5ad,_0xe0af18){_0xe0af18=_0xe0af18||0xc8;return function(_0x140f99){if(_0x140f99){return _0x35d5ad[_0x8a58('0xb')](_0xe0af18)[_0x8a58('0xc')](_0x140f99);}};}function saveUpdates(_0x49acb3){return function(_0x336276){if(_0x336276){return _0x336276[_0x8a58('0xd')](_0x49acb3)[_0x8a58('0xe')](function(_0x214351){return _0x214351;});}return null;};}function handleEntityNotFound(_0x1a43e3){return function(_0x4eab6a){if(!_0x4eab6a){_0x1a43e3[_0x8a58('0xf')](0x194);}return _0x4eab6a;};}function handleError(_0x469d66,_0x143805){_0x143805=_0x143805||0x1f4;return function(_0x290c17){logger['error'](_0x290c17['stack']);if(_0x290c17[_0x8a58('0x10')]){delete _0x290c17['name'];}_0x469d66[_0x8a58('0xb')](_0x143805)[_0x8a58('0x11')](_0x290c17);};}exports['update']=function(_0xf98b8d,_0x15b0d2){if(_0xf98b8d['user'][_0x8a58('0x12')]!==_0x8a58('0x13'))throw new Error('Unauthorized');if(isNaN(Number(_0xf98b8d[_0x8a58('0x14')]['id'])))throw new Error(_0x8a58('0x15'));return db[_0x8a58('0x16')][_0x8a58('0x17')]({'where':{'id':_0xf98b8d[_0x8a58('0x14')]['id']}})[_0x8a58('0xe')](handleEntityNotFound(_0x15b0d2,null))[_0x8a58('0xe')](saveUpdates(_0xf98b8d['body'],null))['then'](respondWithResult(_0x15b0d2,null))[_0x8a58('0x18')](handleError(_0x15b0d2,null));}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.events.js b/server/api/user-setting/user-setting.events.js index 2854d36..ee58678 100644 --- a/server/api/user-setting/user-setting.events.js +++ b/server/api/user-setting/user-setting.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x43c6=['save','update','remove','hook','events','UserSetting','setMaxListeners'];(function(_0x3bfb6c,_0x1c54d0){var _0x3fb88b=function(_0x26a9bd){while(--_0x26a9bd){_0x3bfb6c['push'](_0x3bfb6c['shift']());}};_0x3fb88b(++_0x1c54d0);}(_0x43c6,0x89));var _0x643c=function(_0x46abc0,_0x60b380){_0x46abc0=_0x46abc0-0x0;var _0x558919=_0x43c6[_0x46abc0];return _0x558919;};'use strict';var EventEmitter=require(_0x643c('0x0'));var UserSetting=require('../../mysqldb')['db'][_0x643c('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x643c('0x2')](0x0);var events={'afterCreate':_0x643c('0x3'),'afterUpdate':_0x643c('0x4'),'afterDestroy':_0x643c('0x5')};function emitEvent(_0x3e1fe4){return function(_0x451c95,_0x2dcc06,_0x38fec2){UserSettingEvents['emit'](_0x3e1fe4+':'+_0x451c95['id'],_0x451c95);UserSettingEvents['emit'](_0x3e1fe4,_0x451c95);_0x38fec2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0x643c('0x6')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file +var _0x49d6=['UserSetting','update','remove','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x46e9dd,_0x1c3a1c){var _0xfe5a27=function(_0x419eaa){while(--_0x419eaa){_0x46e9dd['push'](_0x46e9dd['shift']());}};_0xfe5a27(++_0x1c3a1c);}(_0x49d6,0xee));var _0x649d=function(_0x31c2c8,_0x49a32b){_0x31c2c8=_0x31c2c8-0x0;var _0x468426=_0x49d6[_0x31c2c8];return _0x468426;};'use strict';var EventEmitter=require(_0x649d('0x0'));var UserSetting=require(_0x649d('0x1'))['db'][_0x649d('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x649d('0x3'),'afterDestroy':_0x649d('0x4')};function emitEvent(_0x1d6f8b){return function(_0x5a7f46,_0x13e0ce,_0x53ccf3){UserSettingEvents['emit'](_0x1d6f8b+':'+_0x5a7f46['id'],_0x5a7f46);UserSettingEvents['emit'](_0x1d6f8b,_0x5a7f46);_0x53ccf3(null);};}for(var e in events){if(events[_0x649d('0x5')](e)){var event=events[e];UserSetting[_0x649d('0x6')](e,emitEvent(event));}}module[_0x649d('0x7')]=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index 110b937..e3f6c93 100644 --- a/server/api/user-setting/user-setting.model.js +++ b/server/api/user-setting/user-setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7d98=['user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','define','UserSetting'];(function(_0x1289fc,_0x43f90c){var _0x535c0d=function(_0x3de9f2){while(--_0x3de9f2){_0x1289fc['push'](_0x1289fc['shift']());}};_0x535c0d(++_0x43f90c);}(_0x7d98,0xe7));var _0x87d9=function(_0x128bef,_0xc7a0af){_0x128bef=_0x128bef-0x0;var _0x1ba862=_0x7d98[_0x128bef];return _0x1ba862;};'use strict';var attributes=require(_0x87d9('0x0'));module['exports']=function(_0x450298){return _0x450298[_0x87d9('0x1')](_0x87d9('0x2'),attributes,{'tableName':_0x87d9('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x47cceb){if(!_0x47cceb[_0x87d9('0x4')])_0x47cceb[_0x87d9('0x5')]=null;else if(_0x47cceb['clientSideLoggingEnabledSince']===null)_0x47cceb[_0x87d9('0x5')]=new Date();}}});}; \ No newline at end of file +var _0xefe3=['./user-setting.attributes','UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince'];(function(_0x12bfdf,_0x53e41d){var _0x4ce841=function(_0x323e62){while(--_0x323e62){_0x12bfdf['push'](_0x12bfdf['shift']());}};_0x4ce841(++_0x53e41d);}(_0xefe3,0xf5));var _0x3efe=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xefe3[_0x20a584];return _0x4b41a8;};'use strict';var attributes=require(_0x3efe('0x0'));module['exports']=function(_0x5b1924){return _0x5b1924['define'](_0x3efe('0x1'),attributes,{'tableName':_0x3efe('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x28c2d6){if(!_0x28c2d6[_0x3efe('0x3')])_0x28c2d6['clientSideLoggingEnabledSince']=null;else if(_0x28c2d6[_0x3efe('0x4')]===null)_0x28c2d6['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 3e122f1..8972221 100644 --- a/server/api/user-setting/user-setting.socket.js +++ b/server/api/user-setting/user-setting.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4490=['update','emit','user-setting:update','user-setting:update:user-','UserId','register','length','user-setting:','./user-setting.events','remove'];(function(_0x2f48cd,_0x46a75a){var _0x193ae2=function(_0x253c01){while(--_0x253c01){_0x2f48cd['push'](_0x2f48cd['shift']());}};_0x193ae2(++_0x46a75a);}(_0x4490,0x94));var _0x0449=function(_0x5b1137,_0x25df06){_0x5b1137=_0x5b1137-0x0;var _0x126878=_0x4490[_0x5b1137];return _0x126878;};'use strict';var UserSettingEvents=require(_0x0449('0x0'));var events=['save',_0x0449('0x1'),_0x0449('0x2')];function createListener(_0x481792,_0x1571c2){return function(_0x288e58){_0x1571c2[_0x0449('0x3')](_0x481792,_0x288e58);if(_0x481792===_0x0449('0x4')){_0x1571c2[_0x0449('0x3')](_0x0449('0x5')+_0x288e58[_0x0449('0x6')],_0x288e58);}};}exports[_0x0449('0x7')]=function(_0x6971f7){for(var _0x5e6628=0x0,_0x421483=events[_0x0449('0x8')];_0x5e6628<_0x421483;_0x5e6628++){var _0x52b0c1=events[_0x5e6628];var _0x977039=createListener(_0x0449('0x9')+_0x52b0c1,_0x6971f7);UserSettingEvents['on'](_0x52b0c1,_0x977039);}}; \ No newline at end of file +var _0x0cf1=['emit','length','./user-setting.events','remove','update','user-setting:update'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x0cf1,0xb0));var _0x10cf=function(_0x1b780c,_0x241b93){_0x1b780c=_0x1b780c-0x0;var _0x4c2b0d=_0x0cf1[_0x1b780c];return _0x4c2b0d;};'use strict';var UserSettingEvents=require(_0x10cf('0x0'));var events=['save',_0x10cf('0x1'),_0x10cf('0x2')];function createListener(_0x47ed2c,_0x52d5be){return function(_0x32efc4){_0x52d5be['emit'](_0x47ed2c,_0x32efc4);if(_0x47ed2c===_0x10cf('0x3')){_0x52d5be[_0x10cf('0x4')]('user-setting:update:user-'+_0x32efc4['UserId'],_0x32efc4);}};}exports['register']=function(_0x5097d8){for(var _0x543af9=0x0,_0x5e2051=events[_0x10cf('0x5')];_0x543af9<_0x5e2051;_0x543af9++){var _0x33aca3=events[_0x543af9];var _0x1ae1fb=createListener('user-setting:'+_0x33aca3,_0x5097d8);UserSettingEvents['on'](_0x33aca3,_0x1ae1fb);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index e71d618..3ae6c2f 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 _0xa739=['logout','pause','/:id/unpause','unpause','/:id/chat_interactions','/:id/fax_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','put','/:id','update','/:id/password','delete','removeQueues','destroy','removeChatInteractions','/:id/mail_interactions','removeMailInteractions','removeFaxInteractions','/:id/sms_interactions','removeSmsInteractions','removeWhatsappInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./user.controller','get','isAuthenticated','index','/describe','describe','/whoami','whoami','/presence','getPresence','show','getAvatar','/:id/open_tabs','getOpenTabs','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','create','/create_many','bulkCreate','addQueues','join','%s-%s','now','originalname','/:id/avatar','single','file','addAvatar','/:id/login','login'];(function(_0x1becf6,_0x4308d3){var _0x2fa817=function(_0x45523a){while(--_0x45523a){_0x1becf6['push'](_0x1becf6['shift']());}};_0x2fa817(++_0x4308d3);}(_0xa739,0x1e1));var _0x9a73=function(_0x49200a,_0x2cc56f){_0x49200a=_0x49200a-0x0;var _0x168ac1=_0xa739[_0x49200a];return _0x168ac1;};'use strict';var multer=require('multer');var util=require(_0x9a73('0x0'));var path=require('path');var timeout=require(_0x9a73('0x1'));var express=require(_0x9a73('0x2'));var router=express['Router']();var fs_extra=require(_0x9a73('0x3'));var auth=require(_0x9a73('0x4'));var interaction=require(_0x9a73('0x5'));var config=require('../../config/environment');var controller=require(_0x9a73('0x6'));router[_0x9a73('0x7')]('/',auth[_0x9a73('0x8')](),controller[_0x9a73('0x9')]);router[_0x9a73('0x7')](_0x9a73('0xa'),auth[_0x9a73('0x8')](),controller[_0x9a73('0xb')]);router['get'](_0x9a73('0xc'),auth['isAuthenticated'](),controller[_0x9a73('0xd')]);router[_0x9a73('0x7')](_0x9a73('0xe'),auth['isAuthenticated'](),controller[_0x9a73('0xf')]);router[_0x9a73('0x7')]('/:id',auth[_0x9a73('0x8')](),controller[_0x9a73('0x10')]);router[_0x9a73('0x7')]('/:id/avatar',controller[_0x9a73('0x11')]);router[_0x9a73('0x7')](_0x9a73('0x12'),auth['isAuthenticated'](),controller[_0x9a73('0x13')]);router[_0x9a73('0x7')]('/:id/contacts',auth[_0x9a73('0x8')](),controller[_0x9a73('0x14')]);router['get'](_0x9a73('0x15'),auth['isAuthenticated'](),controller[_0x9a73('0x16')]);router['get'](_0x9a73('0x17'),auth['isAuthenticated'](),controller[_0x9a73('0x18')]);router[_0x9a73('0x7')](_0x9a73('0x19'),auth[_0x9a73('0x8')](),controller[_0x9a73('0x1a')]);router[_0x9a73('0x7')](_0x9a73('0x1b'),auth['isAuthenticated'](),controller[_0x9a73('0x1c')]);router['get'](_0x9a73('0x1d'),auth[_0x9a73('0x8')](),controller[_0x9a73('0x1e')]);router[_0x9a73('0x7')](_0x9a73('0x1f'),auth['isAuthenticated'](),controller[_0x9a73('0x20')]);router['get'](_0x9a73('0x21'),auth[_0x9a73('0x8')](),controller[_0x9a73('0x22')]);router[_0x9a73('0x7')](_0x9a73('0x23'),auth[_0x9a73('0x8')](),controller[_0x9a73('0x24')]);router[_0x9a73('0x7')](_0x9a73('0x25'),auth[_0x9a73('0x8')](),controller['getSmsInteractions']);router[_0x9a73('0x7')](_0x9a73('0x26'),auth[_0x9a73('0x8')](),controller[_0x9a73('0x27')]);router[_0x9a73('0x7')](_0x9a73('0x28'),auth[_0x9a73('0x8')](),controller[_0x9a73('0x29')]);router[_0x9a73('0x7')](_0x9a73('0x2a'),auth[_0x9a73('0x8')](),controller[_0x9a73('0x2b')]);router[_0x9a73('0x7')](_0x9a73('0x2c'),auth[_0x9a73('0x8')](),controller[_0x9a73('0x2d')]);router[_0x9a73('0x7')](_0x9a73('0x2e'),auth['isAuthenticated'](),controller[_0x9a73('0x2f')]);router[_0x9a73('0x7')](_0x9a73('0x30'),auth['isAuthenticated'](),controller[_0x9a73('0x31')]);router[_0x9a73('0x7')](_0x9a73('0x32'),auth[_0x9a73('0x8')](),controller['getFaxAccounts']);router[_0x9a73('0x7')](_0x9a73('0x33'),auth[_0x9a73('0x8')](),controller['getMailAccounts']);router['get']('/:id/openchannel_accounts',auth[_0x9a73('0x8')](),controller[_0x9a73('0x34')]);router['get'](_0x9a73('0x35'),auth[_0x9a73('0x8')](),controller[_0x9a73('0x36')]);router[_0x9a73('0x7')]('/:id/chat_websites',auth[_0x9a73('0x8')](),controller[_0x9a73('0x37')]);router[_0x9a73('0x7')]('/:id/whatsapp_accounts',auth[_0x9a73('0x8')](),controller['getWhatsappAccounts']);router[_0x9a73('0x7')](_0x9a73('0x38'),auth[_0x9a73('0x8')](),controller[_0x9a73('0x39')]);router[_0x9a73('0x7')](_0x9a73('0x3a'),auth[_0x9a73('0x8')](),controller['getApiKey']);router[_0x9a73('0x3b')]('/:id/contacts',auth[_0x9a73('0x8')](),controller['addContacts']);router[_0x9a73('0x3b')]('/',auth[_0x9a73('0x8')](),controller[_0x9a73('0x3c')]);router[_0x9a73('0x3b')](_0x9a73('0x3d'),auth[_0x9a73('0x8')](),controller[_0x9a73('0x3e')]);router[_0x9a73('0x3b')](_0x9a73('0x15'),auth[_0x9a73('0x8')](),controller[_0x9a73('0x3f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xf9f180,_0x2394ca,_0x1dab4b){_0x1dab4b(null,path[_0x9a73('0x40')](config['root'],'server/files/images/'));},'filename':function(_0x198d23,_0x5c3348,_0x28e398){_0x28e398(null,util['format'](_0x9a73('0x41'),Date[_0x9a73('0x42')](),_0x5c3348[_0x9a73('0x43')]));}})});router['post'](_0x9a73('0x44'),upload[_0x9a73('0x45')](_0x9a73('0x46')),controller[_0x9a73('0x47')]);router['post'](_0x9a73('0x48'),auth[_0x9a73('0x8')](),controller[_0x9a73('0x49')]);router['post']('/:id/logout',auth['isAuthenticated'](),controller[_0x9a73('0x4a')]);router[_0x9a73('0x3b')]('/:id/pause',auth[_0x9a73('0x8')](),controller[_0x9a73('0x4b')]);router[_0x9a73('0x3b')](_0x9a73('0x4c'),auth[_0x9a73('0x8')](),controller[_0x9a73('0x4d')]);router[_0x9a73('0x3b')](_0x9a73('0x2a'),auth[_0x9a73('0x8')](),controller['addTeams']);router[_0x9a73('0x3b')](_0x9a73('0x4e'),auth['isAuthenticated'](),controller['addChatInteractions']);router[_0x9a73('0x3b')]('/:id/mail_interactions',auth[_0x9a73('0x8')](),controller['addMailInteractions']);router[_0x9a73('0x3b')](_0x9a73('0x4f'),auth[_0x9a73('0x8')](),controller['addFaxInteractions']);router[_0x9a73('0x3b')]('/:id/sms_interactions',auth['isAuthenticated'](),controller['addSmsInteractions']);router['post'](_0x9a73('0x50'),auth['isAuthenticated'](),controller[_0x9a73('0x51')]);router['post'](_0x9a73('0x52'),auth[_0x9a73('0x8')](),controller[_0x9a73('0x53')]);router[_0x9a73('0x3b')](_0x9a73('0x32'),auth['isAuthenticated'](),controller[_0x9a73('0x54')]);router['post'](_0x9a73('0x33'),auth[_0x9a73('0x8')](),controller[_0x9a73('0x55')]);router[_0x9a73('0x3b')]('/:id/openchannel_accounts',auth[_0x9a73('0x8')](),controller[_0x9a73('0x56')]);router[_0x9a73('0x3b')](_0x9a73('0x35'),auth[_0x9a73('0x8')](),controller['addSmsAccounts']);router[_0x9a73('0x3b')]('/:id/chat_websites',auth[_0x9a73('0x8')](),controller[_0x9a73('0x57')]);router[_0x9a73('0x3b')](_0x9a73('0x58'),auth[_0x9a73('0x8')](),controller[_0x9a73('0x59')]);router[_0x9a73('0x3b')](_0x9a73('0x3a'),auth[_0x9a73('0x8')](),controller['createApiKey']);router[_0x9a73('0x5a')](_0x9a73('0x5b'),auth[_0x9a73('0x8')](),controller[_0x9a73('0x5c')]);router[_0x9a73('0x5a')](_0x9a73('0x5d'),auth['isAuthenticated'](),controller['changePassword']);router[_0x9a73('0x5e')](_0x9a73('0x15'),auth[_0x9a73('0x8')](),controller[_0x9a73('0x5f')]);router['delete']('/:id/teams',auth[_0x9a73('0x8')](),controller['removeTeams']);router[_0x9a73('0x5e')](_0x9a73('0x5b'),auth['isAuthenticated'](),controller[_0x9a73('0x60')]);router[_0x9a73('0x5e')](_0x9a73('0x4e'),auth[_0x9a73('0x8')](),controller[_0x9a73('0x61')]);router[_0x9a73('0x5e')](_0x9a73('0x62'),auth[_0x9a73('0x8')](),controller[_0x9a73('0x63')]);router[_0x9a73('0x5e')](_0x9a73('0x4f'),auth[_0x9a73('0x8')](),controller[_0x9a73('0x64')]);router[_0x9a73('0x5e')](_0x9a73('0x65'),auth['isAuthenticated'](),controller[_0x9a73('0x66')]);router[_0x9a73('0x5e')](_0x9a73('0x50'),auth[_0x9a73('0x8')](),controller['removeOpenchannelInteractions']);router[_0x9a73('0x5e')](_0x9a73('0x52'),auth[_0x9a73('0x8')](),controller[_0x9a73('0x67')]);router[_0x9a73('0x5e')](_0x9a73('0x32'),auth[_0x9a73('0x8')](),controller[_0x9a73('0x68')]);router[_0x9a73('0x5e')]('/:id/mail_accounts',auth[_0x9a73('0x8')](),controller['removeMailAccounts']);router[_0x9a73('0x5e')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0x9a73('0x69')]);router['delete']('/:id/sms_accounts',auth[_0x9a73('0x8')](),controller[_0x9a73('0x6a')]);router[_0x9a73('0x5e')]('/:id/chat_websites',auth[_0x9a73('0x8')](),controller[_0x9a73('0x6b')]);router[_0x9a73('0x5e')](_0x9a73('0x58'),auth[_0x9a73('0x8')](),controller[_0x9a73('0x6c')]);router[_0x9a73('0x5e')](_0x9a73('0x3a'),auth[_0x9a73('0x8')](),controller[_0x9a73('0x6d')]);module[_0x9a73('0x6e')]=router; \ No newline at end of file +var _0xb11e=['createApiKey','put','/:id/password','removeQueues','delete','removeTeams','destroy','removeChatInteractions','/:id/mail_interactions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','/:id/fax_accounts','removeOpenchannelAccounts','removeSmsAccounts','/:id/chat_websites','removeChatWebsites','removeWhatsappAccounts','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','/describe','get','/whoami','/presence','getPresence','/:id','show','/:id/avatar','getAvatar','getContacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','getScreenRecordings','getChatInteractions','getOpenchannelInteractions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','/:id/scheduled_calls','post','/:id/contacts','addContacts','create','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','originalname','single','addAvatar','/:id/login','/:id/logout','logout','pause','/:id/unpause','addTeams','/:id/chat_interactions','addChatInteractions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','addWhatsappAccounts','/:id/api_key'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xb11e,0x7d));var _0xeb11=function(_0x3b7554,_0x2e36e5){_0x3b7554=_0x3b7554-0x0;var _0x58f1d3=_0xb11e[_0x3b7554];return _0x58f1d3;};'use strict';var multer=require(_0xeb11('0x0'));var util=require(_0xeb11('0x1'));var path=require(_0xeb11('0x2'));var timeout=require(_0xeb11('0x3'));var express=require(_0xeb11('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeb11('0x5'));var interaction=require(_0xeb11('0x6'));var config=require(_0xeb11('0x7'));var controller=require(_0xeb11('0x8'));router['get']('/',auth[_0xeb11('0x9')](),controller['index']);router['get'](_0xeb11('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xeb11('0xb')](_0xeb11('0xc'),auth[_0xeb11('0x9')](),controller['whoami']);router[_0xeb11('0xb')](_0xeb11('0xd'),auth[_0xeb11('0x9')](),controller[_0xeb11('0xe')]);router[_0xeb11('0xb')](_0xeb11('0xf'),auth[_0xeb11('0x9')](),controller[_0xeb11('0x10')]);router['get'](_0xeb11('0x11'),controller[_0xeb11('0x12')]);router[_0xeb11('0xb')]('/:id/open_tabs',auth[_0xeb11('0x9')](),controller['getOpenTabs']);router[_0xeb11('0xb')]('/:id/contacts',auth['isAuthenticated'](),controller[_0xeb11('0x13')]);router[_0xeb11('0xb')](_0xeb11('0x14'),auth[_0xeb11('0x9')](),controller['getQueues']);router['get'](_0xeb11('0x15'),auth[_0xeb11('0x9')](),controller[_0xeb11('0x16')]);router['get'](_0xeb11('0x17'),auth['isAuthenticated'](),controller[_0xeb11('0x18')]);router[_0xeb11('0xb')](_0xeb11('0x19'),auth['isAuthenticated'](),controller[_0xeb11('0x1a')]);router[_0xeb11('0xb')]('/:id/screen_recordings',auth['isAuthenticated'](),controller[_0xeb11('0x1b')]);router[_0xeb11('0xb')]('/:id/chat/interactions',auth['isAuthenticated'](),controller[_0xeb11('0x1c')]);router[_0xeb11('0xb')]('/:id/openchannel/interactions',auth['isAuthenticated'](),controller[_0xeb11('0x1d')]);router['get']('/:id/mail/interactions',auth['isAuthenticated'](),controller[_0xeb11('0x1e')]);router[_0xeb11('0xb')]('/:id/sms/interactions',auth[_0xeb11('0x9')](),controller[_0xeb11('0x1f')]);router['get'](_0xeb11('0x20'),auth[_0xeb11('0x9')](),controller[_0xeb11('0x21')]);router['get'](_0xeb11('0x22'),auth['isAuthenticated'](),controller['getWhatsappInteractions']);router[_0xeb11('0xb')](_0xeb11('0x23'),auth[_0xeb11('0x9')](),controller['getTeams']);router['get'](_0xeb11('0x24'),auth['isAuthenticated'](),controller[_0xeb11('0x25')]);router[_0xeb11('0xb')](_0xeb11('0x26'),auth[_0xeb11('0x9')](),controller[_0xeb11('0x27')]);router['get'](_0xeb11('0x28'),auth[_0xeb11('0x9')](),controller['getVoicePrefixes']);router[_0xeb11('0xb')]('/:id/fax_accounts',auth[_0xeb11('0x9')](),controller[_0xeb11('0x29')]);router[_0xeb11('0xb')](_0xeb11('0x2a'),auth[_0xeb11('0x9')](),controller[_0xeb11('0x2b')]);router[_0xeb11('0xb')](_0xeb11('0x2c'),auth[_0xeb11('0x9')](),controller['getOpenchannelAccounts']);router[_0xeb11('0xb')]('/:id/sms_accounts',auth[_0xeb11('0x9')](),controller[_0xeb11('0x2d')]);router[_0xeb11('0xb')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0xeb11('0x2e')]);router[_0xeb11('0xb')](_0xeb11('0x2f'),auth[_0xeb11('0x9')](),controller['getWhatsappAccounts']);router[_0xeb11('0xb')](_0xeb11('0x30'),auth[_0xeb11('0x9')](),controller['getScheduledCalls']);router[_0xeb11('0xb')]('/:id/api_key',auth[_0xeb11('0x9')](),controller['getApiKey']);router[_0xeb11('0x31')](_0xeb11('0x32'),auth[_0xeb11('0x9')](),controller[_0xeb11('0x33')]);router[_0xeb11('0x31')]('/',auth[_0xeb11('0x9')](),controller[_0xeb11('0x34')]);router['post'](_0xeb11('0x35'),auth['isAuthenticated'](),controller[_0xeb11('0x36')]);router['post'](_0xeb11('0x14'),auth[_0xeb11('0x9')](),controller[_0xeb11('0x37')]);var upload=multer({'storage':multer[_0xeb11('0x38')]({'destination':function(_0x53a811,_0x149431,_0x22f116){_0x22f116(null,path[_0xeb11('0x39')](config[_0xeb11('0x3a')],_0xeb11('0x3b')));},'filename':function(_0x5ba5b6,_0x320afc,_0x3a462a){_0x3a462a(null,util[_0xeb11('0x3c')](_0xeb11('0x3d'),Date[_0xeb11('0x3e')](),_0x320afc[_0xeb11('0x3f')]));}})});router[_0xeb11('0x31')](_0xeb11('0x11'),upload[_0xeb11('0x40')]('file'),controller[_0xeb11('0x41')]);router['post'](_0xeb11('0x42'),auth[_0xeb11('0x9')](),controller['login']);router['post'](_0xeb11('0x43'),auth[_0xeb11('0x9')](),controller[_0xeb11('0x44')]);router[_0xeb11('0x31')]('/:id/pause',auth[_0xeb11('0x9')](),controller[_0xeb11('0x45')]);router[_0xeb11('0x31')](_0xeb11('0x46'),auth['isAuthenticated'](),controller['unpause']);router[_0xeb11('0x31')]('/:id/teams',auth[_0xeb11('0x9')](),controller[_0xeb11('0x47')]);router[_0xeb11('0x31')](_0xeb11('0x48'),auth[_0xeb11('0x9')](),controller[_0xeb11('0x49')]);router['post']('/:id/mail_interactions',auth[_0xeb11('0x9')](),controller[_0xeb11('0x4a')]);router[_0xeb11('0x31')]('/:id/fax_interactions',auth[_0xeb11('0x9')](),controller[_0xeb11('0x4b')]);router[_0xeb11('0x31')](_0xeb11('0x4c'),auth[_0xeb11('0x9')](),controller['addSmsInteractions']);router['post'](_0xeb11('0x4d'),auth['isAuthenticated'](),controller[_0xeb11('0x4e')]);router[_0xeb11('0x31')](_0xeb11('0x4f'),auth[_0xeb11('0x9')](),controller[_0xeb11('0x50')]);router[_0xeb11('0x31')]('/:id/fax_accounts',auth[_0xeb11('0x9')](),controller[_0xeb11('0x51')]);router[_0xeb11('0x31')](_0xeb11('0x2a'),auth[_0xeb11('0x9')](),controller['addMailAccounts']);router[_0xeb11('0x31')](_0xeb11('0x2c'),auth['isAuthenticated'](),controller[_0xeb11('0x52')]);router[_0xeb11('0x31')](_0xeb11('0x53'),auth[_0xeb11('0x9')](),controller[_0xeb11('0x54')]);router['post']('/:id/chat_websites',auth[_0xeb11('0x9')](),controller['addChatWebsites']);router[_0xeb11('0x31')](_0xeb11('0x2f'),auth[_0xeb11('0x9')](),controller[_0xeb11('0x55')]);router['post'](_0xeb11('0x56'),auth[_0xeb11('0x9')](),controller[_0xeb11('0x57')]);router[_0xeb11('0x58')](_0xeb11('0xf'),auth['isAuthenticated'](),controller['update']);router['put'](_0xeb11('0x59'),auth[_0xeb11('0x9')](),controller['changePassword']);router['delete'](_0xeb11('0x14'),auth['isAuthenticated'](),controller[_0xeb11('0x5a')]);router[_0xeb11('0x5b')](_0xeb11('0x23'),auth[_0xeb11('0x9')](),controller[_0xeb11('0x5c')]);router[_0xeb11('0x5b')](_0xeb11('0xf'),auth[_0xeb11('0x9')](),controller[_0xeb11('0x5d')]);router[_0xeb11('0x5b')](_0xeb11('0x48'),auth[_0xeb11('0x9')](),controller[_0xeb11('0x5e')]);router[_0xeb11('0x5b')](_0xeb11('0x5f'),auth[_0xeb11('0x9')](),controller[_0xeb11('0x60')]);router[_0xeb11('0x5b')]('/:id/fax_interactions',auth[_0xeb11('0x9')](),controller[_0xeb11('0x61')]);router[_0xeb11('0x5b')]('/:id/sms_interactions',auth[_0xeb11('0x9')](),controller[_0xeb11('0x62')]);router[_0xeb11('0x5b')](_0xeb11('0x4d'),auth['isAuthenticated'](),controller[_0xeb11('0x63')]);router[_0xeb11('0x5b')](_0xeb11('0x4f'),auth['isAuthenticated'](),controller['removeWhatsappInteractions']);router[_0xeb11('0x5b')](_0xeb11('0x64'),auth[_0xeb11('0x9')](),controller['removeFaxAccounts']);router[_0xeb11('0x5b')](_0xeb11('0x2a'),auth[_0xeb11('0x9')](),controller['removeMailAccounts']);router[_0xeb11('0x5b')](_0xeb11('0x2c'),auth[_0xeb11('0x9')](),controller[_0xeb11('0x65')]);router['delete'](_0xeb11('0x53'),auth[_0xeb11('0x9')](),controller[_0xeb11('0x66')]);router[_0xeb11('0x5b')](_0xeb11('0x67'),auth[_0xeb11('0x9')](),controller[_0xeb11('0x68')]);router[_0xeb11('0x5b')](_0xeb11('0x2f'),auth['isAuthenticated'](),controller[_0xeb11('0x69')]);router[_0xeb11('0x5b')](_0xeb11('0x56'),auth['isAuthenticated'](),controller['removeApiKey']);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index c137030..6aae119 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 _0x70e0=['refuse','originate','uac','uas','fingerprint','update,nonat','TEXT','showWebBar','get','isArray','wss','udp','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','actpass','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','INTEGER','BOOLEAN','DATE','dynamic','friend','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','join','transport','split','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','ulaw;alaw;gsm','allow','insecure','\x22\x22\x20<>','always','accept'];(function(_0x6f07ce,_0x3557e5){var _0xdc52af=function(_0x103d2a){while(--_0x103d2a){_0x6f07ce['push'](_0x6f07ce['shift']());}};_0xdc52af(++_0x3557e5);}(_0x70e0,0x17b));var _0x070e=function(_0x1718fa,_0x59dbc1){_0x1718fa=_0x1718fa-0x0;var _0x244d85=_0x70e0[_0x1718fa];return _0x244d85;};'use strict';var Sequelize=require(_0x070e('0x0'));var moment=require(_0x070e('0x1'));var util=require(_0x070e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'unique':_0x070e('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x277d32){this[_0x070e('0x5')]('name',_0x277d32);this[_0x070e('0x5')]('defaultuser',_0x277d32);},'comment':_0x070e('0x6')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x56e420){this['setDataValue'](_0x070e('0x7'),_0x56e420);this[_0x070e('0x5')](_0x070e('0x8'),util[_0x070e('0x9')](_0x070e('0xa'),_0x56e420,this[_0x070e('0xb')](_0x070e('0xc'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x070e('0xd'),'validate':{'isEmail':!![]},'set':function(_0x2e3e5e){if(_0x2e3e5e){this[_0x070e('0x5')](_0x070e('0xd'),_0x2e3e5e[_0x070e('0xe')]());}}},'role':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x10'),_0x070e('0x11'),_0x070e('0x12'),_0x070e('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':![],'unique':'internal','set':function(_0x4a33d2){this['setDataValue'](_0x070e('0xc'),_0x4a33d2);this[_0x070e('0x5')]('accountcode',_0x4a33d2);this['setDataValue'](_0x070e('0x8'),util[_0x070e('0x9')](_0x070e('0xa'),this[_0x070e('0xb')]('fullname'),_0x4a33d2));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x070e('0x3')]},'mobile':{'type':Sequelize[_0x070e('0x3')]},'address':{'type':Sequelize[_0x070e('0x3')]},'zipcode':{'type':Sequelize[_0x070e('0x3')]},'userpic':{'type':Sequelize[_0x070e('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x070e('0x3')]},'online':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x070e('0x16')]},'voicePause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x070e('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x070e('0x16')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x070e('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x17')},'ipaddr':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x070e('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x18'),_0x070e('0x11'),_0x070e('0x19')),'allowNull':!![],'defaultValue':_0x070e('0x18')},'context':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x1a'),_0x070e('0x1b'),'ALLOWED_FAILED_SCREEN','ALLOWED',_0x070e('0x1c'),_0x070e('0x1d'),_0x070e('0x1e'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'udp','set':function(_0x59c5b4){this[_0x070e('0x5')]('transport',_0x59c5b4?_0x59c5b4[_0x070e('0x1f')](','):null);},'get':function(){return this[_0x070e('0xb')]('transport')?this['getDataValue'](_0x070e('0x20'))[_0x070e('0x21')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0x070e('0x22'),_0x070e('0x23'),_0x070e('0x24'),_0x070e('0x25'),_0x070e('0x26')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no',_0x070e('0x28'),_0x070e('0x29'),_0x070e('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x2b'),'set':function(_0x34746e){this['setDataValue']('nat',_0x34746e?_0x34746e['join'](','):null);},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2c'))?this[_0x070e('0xb')](_0x070e('0x2c'))[_0x070e('0x21')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x070e('0x3')]},'namedcallgroup':{'type':Sequelize[_0x070e('0x3')]},'pickupgroup':{'type':Sequelize[_0x070e('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x070e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x070e('0x3')]},'disallow':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'defaultValue':_0x070e('0x2d'),'set':function(_0x4800a9){this[_0x070e('0x5')]('allow',_0x4800a9?_0x4800a9[_0x070e('0x1f')](';'):_0x070e('0x2d'));},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2e'))?this[_0x070e('0xb')]('allow')[_0x070e('0x21')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![],'set':function(_0x38879f){this['setDataValue'](_0x070e('0x2f'),_0x38879f?_0x38879f[_0x070e('0x1f')](','):null);},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2f'))?this['getDataValue'](_0x070e('0x2f'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x30')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':_0x070e('0x27')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no',_0x070e('0x31')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x32'),_0x070e('0x33'),_0x070e('0x34')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x35'),'uas'),'allowNull':!![],'defaultValue':_0x070e('0x36')},'t38pt_usertpsource':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':_0x070e('0x27')},'keepalive':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no',_0x070e('0x37'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x070e('0xf')]('active','passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no',_0x070e('0x28'),'update',_0x070e('0x38')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x070e('0x16')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x070e('0x39')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x4cb86f){this['setDataValue'](_0x070e('0x3a'),_0x4cb86f);var _0x1ae5cb=this[_0x070e('0x3b')]({'plain':!![]});switch(_0x4cb86f){case 0x0:case 0x1:var _0x122198=_0x1ae5cb[_0x070e('0x20')]?_[_0x070e('0x3c')](_0x1ae5cb['transport'])?_0x1ae5cb[_0x070e('0x20')]['join']():_0x1ae5cb[_0x070e('0x20')]:'udp';if(_0x122198===_0x070e('0x3d')){_0x122198=_0x070e('0x3e');}this['setDataValue'](_0x070e('0x20'),_0x122198);this['setDataValue'](_0x070e('0x3f'),'no');this[_0x070e('0x5')](_0x070e('0x40'),null);this[_0x070e('0x5')](_0x070e('0x41'),null);this[_0x070e('0x5')](_0x070e('0x42'),null);this[_0x070e('0x5')](_0x070e('0x43'),null);this[_0x070e('0x5')](_0x070e('0x44'),null);this[_0x070e('0x5')](_0x070e('0x45'),null);this[_0x070e('0x5')]('dtlscertfile',null);this[_0x070e('0x5')](_0x070e('0x46'),null);this[_0x070e('0x5')](_0x070e('0x47'),'no');break;case 0x2:this['setDataValue'](_0x070e('0x20'),_0x070e('0x3d'));this[_0x070e('0x5')](_0x070e('0x3f'),_0x070e('0x27'));this[_0x070e('0x5')]('avpf',_0x070e('0x27'));this[_0x070e('0x5')](_0x070e('0x41'),_0x070e('0x27'));this['setDataValue'](_0x070e('0x42'),'yes');this[_0x070e('0x5')](_0x070e('0x43'),_0x070e('0x27'));this[_0x070e('0x5')](_0x070e('0x44'),'no');this['setDataValue'](_0x070e('0x45'),_0x070e('0x48'));this[_0x070e('0x5')](_0x070e('0x49'),_0x1ae5cb['dtlscertfile']||_0x070e('0x4a'));this['setDataValue'](_0x070e('0x46'),_0x1ae5cb[_0x070e('0x46')]||_0x070e('0x4b'));this['setDataValue'](_0x070e('0x47'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0x070e('0x39')],'set':function(_0x5ce157){this[_0x070e('0x5')](_0x070e('0x4c'),_0x5ce157?_0x5ce157['join'](','):[]);},'get':function(){return this[_0x070e('0xb')]('permissions')?_[_0x070e('0x4d')](this[_0x070e('0xb')]('permissions')['split'](','),function(_0x29ee66){return parseInt(_0x29ee66,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x070e('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x070e('0x4e')],'get':function(){return this[_0x070e('0xb')](_0x070e('0x4f'))?this[_0x070e('0xb')](_0x070e('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0x070e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x4f720f){if(typeof _0x4f720f==='string'){var _0x1624cd=_0x4f720f==='1'?!![]:_0x4f720f==='0'?![]:_0x4f720f===_0x070e('0x50')?!![]:_0x4f720f===_0x070e('0x51')?![]:![];this[_0x070e('0x5')]('screenrecording',_0x1624cd);}else{this[_0x070e('0x5')](_0x070e('0x52'),_0x4f720f);}}},'blocked':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![],'set':function(_0xd74f9c){this[_0x070e('0x5')](_0x070e('0x53'),_0xd74f9c);if(_0xd74f9c===!![]){this['setDataValue'](_0x070e('0x54'),moment());this['setDataValue'](_0x070e('0x55'),0x0);}else{this[_0x070e('0x5')](_0x070e('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0x070e('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x070e('0x14')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9c44=['get','udp','encryption','avpf','force_avp','icesupport','dtlscertfile','dtlsprivatekey','wss','dtlsenable','dtlsverify','dtlssetup','actpass','/etc/pki/tls/certs/motion.crt','rtcp_mux','permissions','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','loginAttempts','blockedAt','UNSIGNED','util','lodash','exports','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','email','admin','user','telephone','local','INTEGER','internal','accountcode','DATE','BOOLEAN','DEFAULT\x20PAUSE','dynamic','ENUM','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','yes','nonat','update','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','accept','refuse','originate','uac','uas','fingerprint','certificate','active','update,nonat','TEXT'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x9c44,0x178));var _0x49c4=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x9c44[_0x1d9aa0];return _0x226868;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0x49c4('0x0'));var _=require(_0x49c4('0x1'));module[_0x49c4('0x2')]={'name':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'unique':_0x49c4('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2ad237){this['setDataValue']('name',_0x2ad237);this[_0x49c4('0x5')]('defaultuser',_0x2ad237);},'comment':_0x49c4('0x6')},'fullname':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'set':function(_0x69bc41){this[_0x49c4('0x5')](_0x49c4('0x7'),_0x69bc41);this['setDataValue'](_0x49c4('0x8'),util[_0x49c4('0x9')](_0x49c4('0xa'),_0x69bc41,this[_0x49c4('0xb')]('internal')));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'unique':_0x49c4('0xc'),'validate':{'isEmail':!![]},'set':function(_0x58cad7){if(_0x58cad7){this[_0x49c4('0x5')](_0x49c4('0xc'),_0x58cad7['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x49c4('0xd'),_0x49c4('0xe'),'agent',_0x49c4('0xf')),'allowNull':![]},'password':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x49c4('0x10')},'internal':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':![],'unique':_0x49c4('0x12'),'set':function(_0x2decee){this[_0x49c4('0x5')](_0x49c4('0x12'),_0x2decee);this[_0x49c4('0x5')](_0x49c4('0x13'),_0x2decee);this['setDataValue'](_0x49c4('0x8'),util[_0x49c4('0x9')](_0x49c4('0xa'),this[_0x49c4('0xb')](_0x49c4('0x7')),_0x2decee));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x49c4('0x3')]},'mobile':{'type':Sequelize[_0x49c4('0x3')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x49c4('0x3')]},'city':{'type':Sequelize[_0x49c4('0x3')]},'country':{'type':Sequelize[_0x49c4('0x3')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x49c4('0x14')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':_0x49c4('0x16')},'lastPauseAt':{'type':Sequelize[_0x49c4('0x14')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x49c4('0x11')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x49c4('0x11')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':_0x49c4('0x17')},'ipaddr':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x19'),'user',_0x49c4('0x1a')),'allowNull':!![],'defaultValue':_0x49c4('0x19')},'context':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':_0x49c4('0x1b')},'callingpres':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x1c'),_0x49c4('0x1d'),_0x49c4('0x1e'),_0x49c4('0x1f'),_0x49c4('0x20'),_0x49c4('0x21'),'PROHIB_FAILED_SCREEN','PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':'udp','set':function(_0x38ad77){this[_0x49c4('0x5')](_0x49c4('0x22'),_0x38ad77?_0x38ad77[_0x49c4('0x23')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0x49c4('0xb')](_0x49c4('0x22'))[_0x49c4('0x24')](','):null;},'comment':_0x49c4('0x25')},'dtmfmode':{'type':Sequelize[_0x49c4('0x18')]('rfc2833',_0x49c4('0x26'),_0x49c4('0x27'),_0x49c4('0x28'),'auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no',_0x49c4('0x2a'),_0x49c4('0x2b'),_0x49c4('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x49c4('0x2d'),'set':function(_0x5b96df){this[_0x49c4('0x5')](_0x49c4('0x2e'),_0x5b96df?_0x5b96df[_0x49c4('0x23')](','):null);},'get':function(){return this[_0x49c4('0xb')]('nat')?this[_0x49c4('0xb')](_0x49c4('0x2e'))[_0x49c4('0x24')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x49c4('0x3')]},'namedcallgroup':{'type':Sequelize[_0x49c4('0x3')]},'pickupgroup':{'type':Sequelize[_0x49c4('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x49c4('0x3')]},'language':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x49c4('0x3')]},'disallow':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'defaultValue':_0x49c4('0x2f')},'allow':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'defaultValue':_0x49c4('0x30'),'set':function(_0x1e506a){this['setDataValue'](_0x49c4('0x31'),_0x1e506a?_0x1e506a[_0x49c4('0x23')](';'):_0x49c4('0x30'));},'get':function(){return this[_0x49c4('0xb')](_0x49c4('0x31'))?this[_0x49c4('0xb')](_0x49c4('0x31'))[_0x49c4('0x24')](';'):null;},'comment':_0x49c4('0x32')},'autoframing':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'set':function(_0x326142){this['setDataValue'](_0x49c4('0x33'),_0x326142?_0x326142['join'](','):null);},'get':function(){return this[_0x49c4('0xb')](_0x49c4('0x33'))?this[_0x49c4('0xb')](_0x49c4('0x33'))[_0x49c4('0x24')](','):null;},'comment':_0x49c4('0x34')},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':_0x49c4('0x35')},'amaflags':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x36'),_0x49c4('0x37'),_0x49c4('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x39'),'uas'),'allowNull':!![],'defaultValue':_0x49c4('0x3a')},'t38pt_usertpsource':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x49c4('0x18')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x49c4('0x18')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no',_0x49c4('0x3b'),_0x49c4('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x3d'),'passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x49c4('0x18')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no',_0x49c4('0x2a'),_0x49c4('0x2b'),_0x49c4('0x3e')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x49c4('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x49c4('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x49c4('0x3f')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x10dec7){this[_0x49c4('0x5')]('showWebBar',_0x10dec7);var _0x39c455=this[_0x49c4('0x40')]({'plain':!![]});switch(_0x10dec7){case 0x0:case 0x1:var _0x4f50bf=_0x39c455['transport']?_['isArray'](_0x39c455['transport'])?_0x39c455[_0x49c4('0x22')]['join']():_0x39c455[_0x49c4('0x22')]:_0x49c4('0x41');if(_0x4f50bf==='wss'){_0x4f50bf=_0x49c4('0x41');}this[_0x49c4('0x5')]('transport',_0x4f50bf);this[_0x49c4('0x5')](_0x49c4('0x42'),'no');this[_0x49c4('0x5')](_0x49c4('0x43'),null);this['setDataValue'](_0x49c4('0x44'),null);this[_0x49c4('0x5')](_0x49c4('0x45'),null);this[_0x49c4('0x5')]('dtlsenable',null);this[_0x49c4('0x5')]('dtlsverify',null);this['setDataValue']('dtlssetup',null);this['setDataValue'](_0x49c4('0x46'),null);this[_0x49c4('0x5')](_0x49c4('0x47'),null);this[_0x49c4('0x5')]('rtcp_mux','no');break;case 0x2:this['setDataValue'](_0x49c4('0x22'),_0x49c4('0x48'));this[_0x49c4('0x5')](_0x49c4('0x42'),_0x49c4('0x29'));this[_0x49c4('0x5')](_0x49c4('0x43'),_0x49c4('0x29'));this['setDataValue'](_0x49c4('0x44'),'yes');this[_0x49c4('0x5')](_0x49c4('0x45'),_0x49c4('0x29'));this[_0x49c4('0x5')](_0x49c4('0x49'),_0x49c4('0x29'));this[_0x49c4('0x5')](_0x49c4('0x4a'),'no');this[_0x49c4('0x5')](_0x49c4('0x4b'),_0x49c4('0x4c'));this[_0x49c4('0x5')](_0x49c4('0x46'),_0x39c455[_0x49c4('0x46')]||_0x49c4('0x4d'));this[_0x49c4('0x5')](_0x49c4('0x47'),_0x39c455[_0x49c4('0x47')]||'/etc/pki/tls/private/motion.key');this['setDataValue'](_0x49c4('0x4e'),_0x49c4('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x1a15f3){this[_0x49c4('0x5')](_0x49c4('0x4f'),_0x1a15f3?_0x1a15f3[_0x49c4('0x23')](','):[]);},'get':function(){return this['getDataValue']('permissions')?_['map'](this[_0x49c4('0xb')](_0x49c4('0x4f'))[_0x49c4('0x24')](','),function(_0x2f4289){return parseInt(_0x2f4289,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x49c4('0xb')](_0x49c4('0x50'))?this[_0x49c4('0xb')](_0x49c4('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![],'set':function(_0x27b77d){if(typeof _0x27b77d===_0x49c4('0x51')){var _0x34870e=_0x27b77d==='1'?!![]:_0x27b77d==='0'?![]:_0x27b77d==='true'?!![]:_0x27b77d===_0x49c4('0x52')?![]:![];this[_0x49c4('0x5')](_0x49c4('0x53'),_0x34870e);}else{this[_0x49c4('0x5')](_0x49c4('0x53'),_0x27b77d);}}},'blocked':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![],'set':function(_0x38b291){this[_0x49c4('0x5')](_0x49c4('0x54'),_0x38b291);if(_0x38b291===!![]){this[_0x49c4('0x5')]('blockedAt',moment());this[_0x49c4('0x5')](_0x49c4('0x55'),0x0);}else{this['setDataValue'](_0x49c4('0x56'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x49c4('0x11')](0x5)[_0x49c4('0x57')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 22bc76c..d36cd7b 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 _0xc0df=['getChatInteractions','ChatInteraction','OpenchannelInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','FaxInteraction','getFaxInteractions','getWhatsappInteractions','login','phone','mobile','LOCAL/%s@from-sip/n','user:%s','user:forcelogout','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','isMiddleware','resolve','logout','pause','QueuePause','type','DEFAULT\x20PAUSE','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','unpause','getTeams','Team','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','getAssociatedQueues','flattenDeep','addAgent','Voice','TeamVoicePrefix','UserVoicePrefix','getDataValue','removeTeams','removeAgent','VoicePrefixId','Queue:remove','getLists','getAgents','getVoiceQueues','send','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','omit','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','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','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','OpenchannelAccount','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','CmHopper','$and','$or','$gte','$lt','$eq','$not','$between','$in','$notIn','$like','$iLike','$notILike','$contains','$contained','$any','lastName','CmContact','Contact','dialActive','VoiceQueue','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','createApiKey','generateApiKey','nonce','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','teams','queues','flatten','lower','col','toString','desc','asc','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','offline','idle','unknown','unavailable','ringing','voiceStatus','busy','slice','charAt','toUpperCase','select','field','ui.','InteractionId','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','moment','lodash','squel','jayson/promise','ioredis','../../components/auth/service','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../errors/api','APIBadRequestError','handleError','socket.io-emitter','redis','./user.socket','client','http','request','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','error','code','message','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','update','then','role','agent','emit','userNotification:recalc:','destroy','get','Users','user','Agents','Telephones','telephone','filter','ignore','value','includes','find','name','UserProfileResource','stack','index','User','rawAttributes','fieldName','key','salt','getOptions','include','query','userSetting','true','attributes','push','findAll','rows','openTabs','length','dataValues','fax','openchannel','whatsapp','all','show','params','keys','password','filters','intersection','model','fields','includeAll','merge','options','sms','mail','catch','body','describe','addContacts','ids','Setting','securePassword','validatePasswordPattern','max','internal','min_internal','isNil','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)','sequelize','QueryTypes','from','voicemail','mailbox','fullname','email','permissions','101','102','103','113','110','105','106','107','108','109','100','114','115','create','Unauthorized','admin','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','VoiceMail','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','map','userProfileId','isEmpty','compact','changePassword','oldPassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','updatePasswordsHistory','addQueues','online','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','penalty','spread','QueueId','Queue:save','voice','format','SIP/%s','UserVoiceQueueRt','upsert','removeQueues','channel','remove','isArray','addAvatar','file','filename','root','server/files/images/logos/default_profile.png','userpic','download','existsSync','join','server/files/images/','getOpenTabs','chat','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','concat','getContacts','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','CmList','List','Tag','tag','getQueues','sort','where','Queue','Unknown\x20role','nolimit','Queues','order','getVoiceQueuesRt','getGroups','ChatGroup','pick','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording'];(function(_0x1bf445,_0x55c66d){var _0x19ce29=function(_0x2e2fee){while(--_0x2e2fee){_0x1bf445['push'](_0x1bf445['shift']());}};_0x19ce29(++_0x55c66d);}(_0xc0df,0xb2));var _0xfc0d=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc0df[_0x2dafbe];return _0x58a45a;};'use strict';var moment=require(_0xfc0d('0x0'));var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0xfc0d('0x1'));var squel=require(_0xfc0d('0x2'));var jayson=require(_0xfc0d('0x3'));var Redis=require(_0xfc0d('0x4'));var authService=require(_0xfc0d('0x5'));var contacts=require(_0xfc0d('0x6'));var qs=require(_0xfc0d('0x7'));var logger=require(_0xfc0d('0x8'))(_0xfc0d('0x9'));var utils=require(_0xfc0d('0xa'));var config=require(_0xfc0d('0xb'));var licenseUtil=require(_0xfc0d('0xc'));var APIBadRequestError=require(_0xfc0d('0xd'))[_0xfc0d('0xe')];var APINotFoundError=require(_0xfc0d('0xd'))['APINotFoundError'];var APIHandleError=require(_0xfc0d('0xd'))[_0xfc0d('0xf')];var db=require('../../mysqldb')['db'];var socket=require(_0xfc0d('0x10'))(new Redis(config[_0xfc0d('0x11')]));require(_0xfc0d('0x12'))['register'](socket);config[_0xfc0d('0x11')]=_['defaults'](config[_0xfc0d('0x11')],{'host':'localhost','port':0x18eb});var amiClient=jayson[_0xfc0d('0x13')][_0xfc0d('0x14')]({'port':0x232a});var values;function respondWithRpcPromise(_0x377131,_0x4e94f9,_0x35992c,_0x2ac527){return new Promise(function(_0x5855d9,_0x18417f){var _0x2e075f=_0x2ac527||amiClient;return _0x2e075f[_0xfc0d('0x15')](_0x377131,_0x35992c)['then'](function(_0x53b9cb){logger[_0xfc0d('0x16')](_0xfc0d('0x17'),_0x4e94f9,_0xfc0d('0x18'));logger[_0xfc0d('0x19')](_0xfc0d('0x1a'),_0x4e94f9,'request\x20sent',JSON['stringify'](_0x53b9cb));if(_0x53b9cb[_0xfc0d('0x1b')]){if(_0x53b9cb[_0xfc0d('0x1b')][_0xfc0d('0x1c')]===0x1f4){logger[_0xfc0d('0x1b')](_0xfc0d('0x17'),_0x4e94f9,_0x53b9cb[_0xfc0d('0x1b')][_0xfc0d('0x1d')]);return _0x18417f(_0x53b9cb[_0xfc0d('0x1b')][_0xfc0d('0x1d')]);}logger['error']('User,\x20%s,\x20%s',_0x4e94f9,_0x53b9cb[_0xfc0d('0x1b')]['message']);return _0x5855d9(_0x53b9cb['error']['message']);}else{logger[_0xfc0d('0x16')](_0xfc0d('0x17'),_0x4e94f9,_0xfc0d('0x18'));_0x5855d9(_0x53b9cb['result'][_0xfc0d('0x1d')]);}})['catch'](function(_0x3fd4f3){logger[_0xfc0d('0x1b')](_0xfc0d('0x17'),_0x4e94f9,_0x3fd4f3);_0x18417f(_0x3fd4f3);});});}function respondWithStatusCode(_0x27d3fb,_0x18f6ee){_0x18f6ee=_0x18f6ee||0xcc;return function(_0x144a8d){if(_0x144a8d){return _0x27d3fb[_0xfc0d('0x1e')](_0x18f6ee);}return _0x27d3fb['status'](_0x18f6ee)[_0xfc0d('0x1f')]();};}function respondWithResult(_0x395687,_0x3fb140){_0x3fb140=_0x3fb140||0xc8;return function(_0x2bb856){if(_0x2bb856){return _0x395687[_0xfc0d('0x20')](_0x3fb140)[_0xfc0d('0x21')](_0x2bb856);}};}function respondWithFilteredResult(_0x5d2a86,_0x5a37eb){return function(_0x3ba086){if(_0x3ba086){var _0xa753c6=typeof _0x5a37eb[_0xfc0d('0x22')]===_0xfc0d('0x23')&&typeof _0x5a37eb['limit']==='undefined';var _0x1ebb3=_0x3ba086[_0xfc0d('0x24')];var _0x414aaa=_0xa753c6?0x0:_0x5a37eb[_0xfc0d('0x22')];var _0x373ce6=_0xa753c6?_0x3ba086[_0xfc0d('0x24')]:_0x5a37eb[_0xfc0d('0x22')]+_0x5a37eb[_0xfc0d('0x25')];var _0x165d4c;if(_0x373ce6>=_0x1ebb3){_0x373ce6=_0x1ebb3;_0x165d4c=0xc8;}else{_0x165d4c=0xce;}_0x5d2a86['status'](_0x165d4c);return _0x5d2a86[_0xfc0d('0x26')](_0xfc0d('0x27'),_0x414aaa+'-'+_0x373ce6+'/'+_0x1ebb3)[_0xfc0d('0x21')](_0x3ba086);}return null;};}function saveUpdates(_0x10f327){return function(_0x4aa091){if(_0x4aa091){return _0x4aa091[_0xfc0d('0x28')](_0x10f327)[_0xfc0d('0x29')](function(_0x1da5ab){if(_0x1da5ab[_0xfc0d('0x2a')]===_0xfc0d('0x2b')){socket[_0xfc0d('0x2c')](_0xfc0d('0x2d')+_0x1da5ab['id'],_0x1da5ab);}return _0x1da5ab;});}return null;};}function removeEntity(_0x13fb47){return function(_0x13638f){if(_0x13638f){return _0x13638f[_0xfc0d('0x2e')]()[_0xfc0d('0x29')](function(){var _0x291c86=_0x13638f[_0xfc0d('0x2f')]({'plain':!![]});if(_0x291c86['role']==='admin')return;var _0x176d2a=[{'name':_0xfc0d('0x30'),'value':_0xfc0d('0x31'),'ignore':!![]},{'name':_0xfc0d('0x32'),'value':_0xfc0d('0x2b'),'ignore':![]},{'name':_0xfc0d('0x33'),'value':_0xfc0d('0x34'),'ignore':![]}];var _0x36aa7d=_(_0x176d2a)[_0xfc0d('0x35')](_0xfc0d('0x36'))['map'](_0xfc0d('0x37'))[_0xfc0d('0x37')]();if(_[_0xfc0d('0x38')](_0x36aa7d,_0x291c86[_0xfc0d('0x2a')])){return;}var _0x40e5ce=_[_0xfc0d('0x39')](_0x176d2a,['value',_0x291c86[_0xfc0d('0x2a')]])[_0xfc0d('0x3a')];return db[_0xfc0d('0x3b')][_0xfc0d('0x2e')]({'where':{'type':_0x40e5ce,'resourceId':_0x291c86['id']}})[_0xfc0d('0x29')](function(){return _0x13638f;});})[_0xfc0d('0x29')](function(){_0x13fb47[_0xfc0d('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a84d9){return function(_0x524b81){if(!_0x524b81){_0x4a84d9[_0xfc0d('0x1e')](0x194);}return _0x524b81;};}function handleError(_0x56301e,_0x4c2b6d){_0x4c2b6d=_0x4c2b6d||0x1f4;return function(_0x217610){logger[_0xfc0d('0x1b')](_0x217610[_0xfc0d('0x3c')]);if(_0x217610[_0xfc0d('0x3a')]){delete _0x217610[_0xfc0d('0x3a')];}_0x56301e[_0xfc0d('0x20')](_0x4c2b6d)['send'](_0x217610);};}exports[_0xfc0d('0x3d')]=function(_0xb21164,_0x1e765c){var _0x3f7417={},_0xcf209={'count':0x0,'rows':[]};var _0x70f394=_(db[_0xfc0d('0x3e')][_0xfc0d('0x3f')])['map'](function(_0x1aa558){return{'name':_0x1aa558[_0xfc0d('0x40')],'type':_0x1aa558['type'][_0xfc0d('0x41')]};})['filter'](function(_0x1e8cc5){return!_['includes'](['password',_0xfc0d('0x42')],_0x1e8cc5[_0xfc0d('0x3a')]);})['value']();_0x3f7417=qs[_0xfc0d('0x43')](_0x70f394,_0xb21164);var _0x259624={'where':_0x3f7417['where']};return db[_0xfc0d('0x3e')][_0xfc0d('0x24')](_0x259624)[_0xfc0d('0x29')](function(_0x19bb2a){_0xcf209[_0xfc0d('0x24')]=_0x19bb2a;if(_0xb21164['query']['includeAll']){_0x3f7417[_0xfc0d('0x44')]=[{'all':!![]}];}if(_0xb21164[_0xfc0d('0x45')][_0xfc0d('0x46')]===_0xfc0d('0x47')){_0x3f7417[_0xfc0d('0x44')]=[{'model':db['UserSetting'],'as':_0xfc0d('0x46')}];}if(!_[_0xfc0d('0x38')](_0x3f7417[_0xfc0d('0x48')],'id')){_0x3f7417['attributes'][_0xfc0d('0x49')]('id');}return db['User'][_0xfc0d('0x4a')](_0x3f7417);})[_0xfc0d('0x29')](function(_0x5df060){_0xcf209[_0xfc0d('0x4b')]=_0x5df060;if(_0xb21164[_0xfc0d('0x45')][_0xfc0d('0x4c')]===_0xfc0d('0x47')){var _0x1886a7=[];for(var _0x2f047a=0x0;_0x2f047a<_0xcf209[_0xfc0d('0x4b')][_0xfc0d('0x4d')];_0x2f047a++){_0x1886a7[_0xfc0d('0x49')](get_open_tabs('chat',_0xcf209[_0xfc0d('0x4b')][_0x2f047a][_0xfc0d('0x4e')]));_0x1886a7['push'](get_open_tabs('sms',_0xcf209['rows'][_0x2f047a]['dataValues']));_0x1886a7[_0xfc0d('0x49')](get_open_tabs(_0xfc0d('0x4f'),_0xcf209[_0xfc0d('0x4b')][_0x2f047a][_0xfc0d('0x4e')]));_0x1886a7[_0xfc0d('0x49')](get_open_tabs('mail',_0xcf209['rows'][_0x2f047a][_0xfc0d('0x4e')]));_0x1886a7[_0xfc0d('0x49')](get_open_tabs(_0xfc0d('0x50'),_0xcf209[_0xfc0d('0x4b')][_0x2f047a][_0xfc0d('0x4e')]));_0x1886a7['push'](get_open_tabs(_0xfc0d('0x51'),_0xcf209[_0xfc0d('0x4b')][_0x2f047a][_0xfc0d('0x4e')]));}return Promise[_0xfc0d('0x52')](_0x1886a7)[_0xfc0d('0x29')](function(){return _0xcf209;});}else{return _0xcf209;}})['then'](respondWithFilteredResult(_0x1e765c,_0x3f7417))['catch'](handleError(_0x1e765c,null));};exports[_0xfc0d('0x53')]=function(_0x30a8ca,_0x1d2c86){var _0x2b648d={'raw':![],'where':{'id':_0x30a8ca[_0xfc0d('0x54')]['id']}},_0x1db24b={};_0x1db24b['model']=_['differenceBy'](_[_0xfc0d('0x55')](db[_0xfc0d('0x3e')][_0xfc0d('0x3f')]),[_0xfc0d('0x56'),_0xfc0d('0x42')]);_0x1db24b[_0xfc0d('0x45')]=_[_0xfc0d('0x55')](_0x30a8ca['query']);_0x1db24b[_0xfc0d('0x57')]=_[_0xfc0d('0x58')](_0x1db24b[_0xfc0d('0x59')],_0x1db24b['query']);_0x2b648d[_0xfc0d('0x48')]=_[_0xfc0d('0x58')](_0x1db24b[_0xfc0d('0x59')],qs[_0xfc0d('0x5a')](_0x30a8ca[_0xfc0d('0x45')]['fields']));_0x2b648d[_0xfc0d('0x48')]=_0x2b648d[_0xfc0d('0x48')][_0xfc0d('0x4d')]?_0x2b648d[_0xfc0d('0x48')]:_0x1db24b[_0xfc0d('0x59')];if(_0x30a8ca[_0xfc0d('0x45')][_0xfc0d('0x5b')]){_0x2b648d['include']=[{'all':!![]}];}if(_0x30a8ca['query'][_0xfc0d('0x46')]==='true'){_0x2b648d[_0xfc0d('0x44')]=[{'model':db['UserSetting'],'as':_0xfc0d('0x46')}];}_0x2b648d=_[_0xfc0d('0x5c')]({},_0x2b648d,_0x30a8ca[_0xfc0d('0x5d')]);if(!_[_0xfc0d('0x38')](_0x2b648d[_0xfc0d('0x48')],'id')){_0x2b648d['attributes'][_0xfc0d('0x49')]('id');}return db[_0xfc0d('0x3e')][_0xfc0d('0x39')](_0x2b648d)[_0xfc0d('0x29')](handleEntityNotFound(_0x1d2c86,null))[_0xfc0d('0x29')](function(_0x17a4f9){var _0x475ff0=[];values=_0x17a4f9;if(_0x30a8ca['query'][_0xfc0d('0x4c')]==='true'){_0x475ff0['push'](get_open_tabs('chat',_0x17a4f9[_0xfc0d('0x4e')]));_0x475ff0[_0xfc0d('0x49')](get_open_tabs(_0xfc0d('0x5e'),_0x17a4f9['dataValues']));_0x475ff0[_0xfc0d('0x49')](get_open_tabs(_0xfc0d('0x50'),_0x17a4f9[_0xfc0d('0x4e')]));_0x475ff0[_0xfc0d('0x49')](get_open_tabs(_0xfc0d('0x51'),_0x17a4f9[_0xfc0d('0x4e')]));_0x475ff0[_0xfc0d('0x49')](get_open_tabs(_0xfc0d('0x4f'),_0x17a4f9[_0xfc0d('0x4e')]));_0x475ff0['push'](get_open_tabs(_0xfc0d('0x5f'),_0x17a4f9[_0xfc0d('0x4e')]));return Promise[_0xfc0d('0x52')](_0x475ff0);}else{return values;}})[_0xfc0d('0x29')](function(){return values;})[_0xfc0d('0x29')](respondWithResult(_0x1d2c86,null))[_0xfc0d('0x60')](handleError(_0x1d2c86,null));};exports['update']=function(_0x3ab736,_0x429f53){if(_0x3ab736[_0xfc0d('0x61')]['id']){delete _0x3ab736[_0xfc0d('0x61')]['id'];}delete _0x3ab736[_0xfc0d('0x61')]['role'];return db['User'][_0xfc0d('0x39')]({'where':{'id':_0x3ab736[_0xfc0d('0x54')]['id']}})['then'](handleEntityNotFound(_0x429f53,null))[_0xfc0d('0x29')](saveUpdates(_0x3ab736[_0xfc0d('0x61')],null))[_0xfc0d('0x29')](respondWithResult(_0x429f53,null))[_0xfc0d('0x60')](handleError(_0x429f53,null));};exports[_0xfc0d('0x62')]=function(_0x3ed4be,_0x3e0b6e){return db[_0xfc0d('0x3e')][_0xfc0d('0x62')]()[_0xfc0d('0x29')](respondWithResult(_0x3e0b6e,null))[_0xfc0d('0x60')](handleError(_0x3e0b6e,null));};exports['addContacts']=function(_0x5df428,_0x1f2f69){return db[_0xfc0d('0x3e')][_0xfc0d('0x39')]({'where':{'id':_0x5df428['params']['id']}})['then'](handleEntityNotFound(_0x1f2f69,null))[_0xfc0d('0x29')](function(_0x1a35d1){if(_0x1a35d1){return _0x1a35d1[_0xfc0d('0x63')](_0x5df428[_0xfc0d('0x61')]['ids'],_['omit'](_0x5df428[_0xfc0d('0x61')],[_0xfc0d('0x64'),'id'])||{});}})[_0xfc0d('0x29')](respondWithResult(_0x1f2f69,null))[_0xfc0d('0x60')](handleError(_0x1f2f69,null));};function validateUser(_0x2e06cf){return new Promise(function(_0x59ac31,_0x3961f5){if(_0x2e06cf['internal'])return _0x59ac31(_0x2e06cf);return db[_0xfc0d('0x65')]['findById'](0x1)[_0xfc0d('0x29')](function(_0x1d0928){if(_0x1d0928[_0xfc0d('0x66')])authService[_0xfc0d('0x67')](_0x2e06cf[_0xfc0d('0x56')]);db[_0xfc0d('0x3e')][_0xfc0d('0x68')](_0xfc0d('0x69'))[_0xfc0d('0x29')](function(_0x4fc103){if(_['isNil'](_0x4fc103)){_0x2e06cf[_0xfc0d('0x69')]=_0x1d0928[_0xfc0d('0x6a')]||0x1;return;}if(_[_0xfc0d('0x6b')](_0x1d0928['min_internal'])||_0x1d0928[_0xfc0d('0x6a')]===_0x4fc103){_0x2e06cf[_0xfc0d('0x69')]=_0x4fc103+0x1;return;}if(_0x1d0928[_0xfc0d('0x6a')]>_0x4fc103){_0x2e06cf[_0xfc0d('0x69')]=_0x1d0928['min_internal'];return;}return db['sequelize'][_0xfc0d('0x45')](_0xfc0d('0x6c'),{'type':db[_0xfc0d('0x6d')][_0xfc0d('0x6e')]['SELECT']})[_0xfc0d('0x29')](function(_0x5e5efa){if(_0x5e5efa&&_0x5e5efa[_0xfc0d('0x4d')]){for(var _0x5589ed=0x0,_0x247b69=_0x5e5efa[_0xfc0d('0x4d')];_0x5589ed<_0x247b69&&_[_0xfc0d('0x6b')](_0x2e06cf[_0xfc0d('0x69')]);_0x5589ed++){if(_0x1d0928['min_internal']<=_0x5e5efa[_0x5589ed][_0xfc0d('0x6f')]){_0x2e06cf[_0xfc0d('0x69')]=_0x5e5efa[_0x5589ed][_0xfc0d('0x6f')];}else if(_0x1d0928[_0xfc0d('0x6a')]>_0x5e5efa[_0x5589ed]['from']&&_0x1d0928[_0xfc0d('0x6a')]<=_0x5e5efa[_0x5589ed]['to']){_0x2e06cf['internal']=_0x1d0928[_0xfc0d('0x6a')];}}}if(_[_0xfc0d('0x6b')](_0x2e06cf[_0xfc0d('0x69')])){_0x2e06cf[_0xfc0d('0x69')]=_0x4fc103+0x1;}return _0x59ac31(_0x2e06cf);});});})[_0xfc0d('0x60')](function(_0x3e9026){_0x3961f5(_0x3e9026);});});}function updateUser(_0x41f73d){return new Promise(function(_0x8c792b,_0x45b617){try{if(_0x41f73d[_0xfc0d('0x70')]){_0x41f73d[_0xfc0d('0x71')]=_0x41f73d[_0xfc0d('0x69')];_0x41f73d['VoiceMail']={'mailbox':_0x41f73d[_0xfc0d('0x69')],'password':_0x41f73d[_0xfc0d('0x56')],'fullname':_0x41f73d[_0xfc0d('0x72')],'email':_0x41f73d[_0xfc0d('0x73')]};}if(_0x41f73d[_0xfc0d('0x2a')]==='agent'){if(!_0x41f73d[_0xfc0d('0x74')])_0x41f73d[_0xfc0d('0x74')]=[_0xfc0d('0x75'),_0xfc0d('0x76'),_0xfc0d('0x77'),_0xfc0d('0x78'),_0xfc0d('0x79'),'104',_0xfc0d('0x7a'),_0xfc0d('0x7b'),_0xfc0d('0x7c'),_0xfc0d('0x7d'),_0xfc0d('0x7e'),_0xfc0d('0x7f'),'111',_0xfc0d('0x80'),_0xfc0d('0x81')];}_0x8c792b(_0x41f73d);}catch(_0x43af7e){_0x45b617(_0x43af7e);}});}exports[_0xfc0d('0x82')]=function(_0x447d68,_0x33ee99){if(_0x447d68[_0xfc0d('0x31')][_0xfc0d('0x2a')]===_0xfc0d('0x2b'))throw new Error(_0xfc0d('0x83'));if(_0x447d68[_0xfc0d('0x61')]['role']===_0xfc0d('0x31')&&_0x447d68[_0xfc0d('0x31')]['role']!==_0xfc0d('0x84')){throw new Error(_0xfc0d('0x85'));}if(_0x447d68[_0xfc0d('0x61')][_0xfc0d('0x2a')]===_0xfc0d('0x84')&&_0x447d68[_0xfc0d('0x31')][_0xfc0d('0x2a')]!==_0xfc0d('0x84')){throw new Error(_0xfc0d('0x86'));}return licenseUtil[_0xfc0d('0x87')]([_0x447d68[_0xfc0d('0x61')]])[_0xfc0d('0x29')](function(){return validateUser(_0x447d68['body']);})[_0xfc0d('0x29')](function(_0x125680){return updateUser(_0x125680)[_0xfc0d('0x29')](function(_0x226991){if(_0x226991['role']===_0xfc0d('0x84')){_0x226991['settingsEnabled']=_0x447d68[_0xfc0d('0x31')]['settingsEnabled'];delete _0x226991['userProfileId'];}return _0x226991;});})[_0xfc0d('0x29')](function(_0x282e95){return db['User']['create'](_0x282e95,{'include':[{'model':db[_0xfc0d('0x88')],'as':'VoiceMail'}]});})[_0xfc0d('0x29')](function(_0x23ea34){if(_0x447d68['body'][_0xfc0d('0x2a')]===_0xfc0d('0x31'))return _0x23ea34;if(_0x447d68[_0xfc0d('0x31')][_0xfc0d('0x2a')]!==_0xfc0d('0x31'))return _0x23ea34;return db[_0xfc0d('0x89')][_0xfc0d('0x39')]({'where':{'name':_0x23ea34[_0xfc0d('0x2a')]===_0xfc0d('0x2b')?_0xfc0d('0x32'):_0xfc0d('0x33'),'userProfileId':_0x447d68[_0xfc0d('0x31')]['userProfileId']},'raw':!![]})['then'](function(_0x4e1a98){if(!_0x4e1a98||_0x4e1a98[_0xfc0d('0x8a')]!=0x0)return _0x23ea34;return db[_0xfc0d('0x3b')][_0xfc0d('0x82')]({'name':_0x23ea34['name'],'resourceId':_0x23ea34['id'],'type':_0x4e1a98[_0xfc0d('0x3a')],'sectionId':_0x4e1a98['id']},{})[_0xfc0d('0x29')](function(){return _0x23ea34;});})[_0xfc0d('0x60')](function(_0x45106d){logger[_0xfc0d('0x1b')](_0xfc0d('0x8b'),_0x45106d);throw _0x45106d;});})['then'](respondWithResult(_0x33ee99,0xc9))[_0xfc0d('0x60')](handleError(_0x33ee99,null));};exports[_0xfc0d('0x8c')]=function(_0x9aff1e,_0x3a8a66){var _0x207bfb=_0x9aff1e[_0xfc0d('0x61')];var _0x552ed7=[];if(_0x9aff1e['user'][_0xfc0d('0x2a')]===_0xfc0d('0x2b'))throw new Error(_0xfc0d('0x83'));if(_[_0xfc0d('0x8d')](_0x207bfb,[_0xfc0d('0x2a'),'user'])&&_0x9aff1e['user'][_0xfc0d('0x2a')]!=='admin'){throw new Error(_0xfc0d('0x85'));}if(_[_0xfc0d('0x8d')](_0x207bfb,[_0xfc0d('0x2a'),_0xfc0d('0x84')])&&_0x9aff1e['user']['role']!==_0xfc0d('0x84')){throw new Error(_0xfc0d('0x8e'));}return licenseUtil[_0xfc0d('0x87')](_0x207bfb)[_0xfc0d('0x29')](function(){return validateUser(_0x207bfb[0x0]);})[_0xfc0d('0x29')](function(){for(var _0x1a4385=0x1;_0x1a4385<_0x207bfb[_0xfc0d('0x4d')];_0x1a4385++){var _0x936810=_0x207bfb[_0x1a4385-0x1][_0xfc0d('0x69')];if(!_0x207bfb[_0x1a4385][_0xfc0d('0x69')])_0x207bfb[_0x1a4385][_0xfc0d('0x69')]=_0x936810+0x1;_0x552ed7[_0xfc0d('0x49')](validateUser(_0x207bfb[_0x1a4385]));}return Promise[_0xfc0d('0x52')](_0x552ed7);})['then'](function(){_0x552ed7=[];for(var _0x1927d6=0x0;_0x1927d6<_0x207bfb[_0xfc0d('0x4d')];_0x1927d6++){_0x552ed7[_0xfc0d('0x49')](updateUser(_0x207bfb[_0x1927d6]));}return Promise[_0xfc0d('0x52')](_0x552ed7);})[_0xfc0d('0x29')](function(){_0x552ed7=_0x207bfb[_0xfc0d('0x8f')](function(_0x5cf1ab){return db['User'][_0xfc0d('0x82')](_0x5cf1ab,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]})[_0xfc0d('0x29')](function(_0x2c78b9){_0x5cf1ab['id']=_0x2c78b9['id'];return _0x5cf1ab;});});return Promise[_0xfc0d('0x52')](_0x552ed7);})['then'](function(_0x256ffd){if(_0x9aff1e[_0xfc0d('0x61')][_0xfc0d('0x2a')]===_0xfc0d('0x31'))return _0x256ffd;if(_0x9aff1e['user'][_0xfc0d('0x2a')]!==_0xfc0d('0x31'))return _0x256ffd;var _0xe4ffb0=_[_0xfc0d('0x8d')](_0x256ffd,function(_0x2d3050){return _0x2d3050['role']==='agent'||_0x2d3050[_0xfc0d('0x2a')]===_0xfc0d('0x34');});if(!_0xe4ffb0)return _0x256ffd;return db[_0xfc0d('0x89')][_0xfc0d('0x4a')]({'where':{'name':{'$or':[_0xfc0d('0x32'),'Telephones']},'userProfileId':_0x9aff1e[_0xfc0d('0x31')][_0xfc0d('0x90')]},'raw':!![]})[_0xfc0d('0x29')](function(_0x37109c){if(_[_0xfc0d('0x91')](_0x37109c)||!_['some'](_0x37109c,['autoAssociation',0x0]))return _0x256ffd;_0x552ed7=[];var _0x3843c4=_(_0x37109c)[_0xfc0d('0x8f')](function(_0x20a276){if(_0x20a276['autoAssociation']===0x1)return;return _0x20a276[_0xfc0d('0x3a')]==='Agents'?_0xfc0d('0x2b'):'telephone';})[_0xfc0d('0x92')]()[_0xfc0d('0x37')]();for(var _0x5eba93=0x0;_0x5eba93<_0x256ffd['length'];_0x5eba93++){if(!_[_0xfc0d('0x38')](_0x3843c4,_0x256ffd[_0x5eba93]['role']))return;var _0x2a94ff=_0x256ffd[_0x5eba93]['role']==='agent'?_0xfc0d('0x32'):_0xfc0d('0x33');_0x552ed7['push'](db[_0xfc0d('0x3b')][_0xfc0d('0x82')]({'name':_0x256ffd[_0x5eba93][_0xfc0d('0x3a')],'resourceId':_0x256ffd[_0x5eba93]['id'],'type':_0x2a94ff,'sectionId':_[_0xfc0d('0x39')](_0x37109c,[_0xfc0d('0x3a'),_0x2a94ff])['id']},{}));}return Promise['all'](_0x552ed7);});})[_0xfc0d('0x29')](respondWithResult(_0x3a8a66,0xc9))[_0xfc0d('0x60')](handleError(_0x3a8a66,null));};exports[_0xfc0d('0x93')]=function(_0x1d4e90,_0x4673a4){if(_0x1d4e90['body']['id']){delete _0x1d4e90[_0xfc0d('0x61')]['id'];}return db[_0xfc0d('0x3e')][_0xfc0d('0x39')]({'where':{'id':_0x1d4e90[_0xfc0d('0x54')]['id']}})[_0xfc0d('0x29')](function(_0x4756ab){if(!_0x4756ab)return null;if(_0x4756ab['id']===_0x1d4e90['user']['id']){if(!_0x1d4e90[_0xfc0d('0x61')][_0xfc0d('0x94')]||!_0x1d4e90[_0xfc0d('0x61')][_0xfc0d('0x95')]){throw new db[(_0xfc0d('0x96'))][(_0xfc0d('0x97'))](_0xfc0d('0x98'));}if(!_0x4756ab['authenticate'](_0x1d4e90[_0xfc0d('0x61')][_0xfc0d('0x94')])){throw new db[(_0xfc0d('0x96'))][(_0xfc0d('0x97'))](_0xfc0d('0x99'));}if(_0x1d4e90[_0xfc0d('0x61')]['oldPassword']===_0x1d4e90[_0xfc0d('0x61')][_0xfc0d('0x95')]){throw new db['Sequelize'][(_0xfc0d('0x97'))](_0xfc0d('0x9a'));}}else if(_0x1d4e90[_0xfc0d('0x31')][_0xfc0d('0x2a')]===_0xfc0d('0x84')){if(!_0x1d4e90[_0xfc0d('0x61')][_0xfc0d('0x95')]){throw new db[(_0xfc0d('0x96'))][(_0xfc0d('0x97'))](_0xfc0d('0x9b'));}}else if(_0x1d4e90[_0xfc0d('0x31')][_0xfc0d('0x2a')]==='user'){if(!_0x1d4e90['body'][_0xfc0d('0x95')]){throw new db['Sequelize'][(_0xfc0d('0x97'))](_0xfc0d('0x9b'));}if(_0x4756ab[_0xfc0d('0x2a')]!==_0xfc0d('0x2b')){throw new db[(_0xfc0d('0x96'))][(_0xfc0d('0x97'))](_0xfc0d('0x83'));}}else{throw new db[(_0xfc0d('0x96'))][(_0xfc0d('0x97'))](_0xfc0d('0x83'));}return _0x4756ab;})[_0xfc0d('0x29')](handleEntityNotFound(_0x4673a4,null))[_0xfc0d('0x29')](function(_0x1c73f2){return db[_0xfc0d('0x65')][_0xfc0d('0x9c')]({'attributes':['id',_0xfc0d('0x66'),_0xfc0d('0x9d'),_0xfc0d('0x9e')]})[_0xfc0d('0x29')](function(_0x5b7170){if(_0x5b7170[_0xfc0d('0x66')])authService[_0xfc0d('0x67')](_0x1d4e90['body'][_0xfc0d('0x95')]);if(!_0x5b7170['enforcePasswordHistory']||!_0x1c73f2[_0xfc0d('0x9f')])return _0x1c73f2;authService['validatePasswordHistory'](_0x1d4e90[_0xfc0d('0x61')][_0xfc0d('0x95')],_0x1c73f2['previousPasswords'],_0x5b7170[_0xfc0d('0x9e')]);return _0x1c73f2;})[_0xfc0d('0x29')](saveUpdates({'password':_0x1d4e90[_0xfc0d('0x61')][_0xfc0d('0x95')],'passwordResetAt':_0x1d4e90[_0xfc0d('0x31')]['id']==_0x1d4e90[_0xfc0d('0x54')]['id']?moment():null,'previousPasswords':authService[_0xfc0d('0xa0')](_0x1d4e90[_0xfc0d('0x61')][_0xfc0d('0x95')],_0x1c73f2['previousPasswords'])},null));})[_0xfc0d('0x29')](respondWithResult(_0x4673a4,null))[_0xfc0d('0x60')](handleError(_0x4673a4,null));};exports[_0xfc0d('0xa1')]=function(_0x50310a,_0x7d1298){var _0x497f59=_0x50310a[_0xfc0d('0x61')]['channel'];return db[_0xfc0d('0x3e')][_0xfc0d('0x39')]({'where':{'id':_0x50310a[_0xfc0d('0x54')]['id']},'attributes':['id','name',_0xfc0d('0x2a'),_0xfc0d('0xa2'),_0xfc0d('0xa3'),_0xfc0d('0xa4'),_0xfc0d('0xa5')]})[_0xfc0d('0x29')](handleEntityNotFound(_0x7d1298,null))[_0xfc0d('0x29')](function(_0x2f236e){if(_0x2f236e){if(!utils[_0xfc0d('0xa6')](_0x497f59)){throw new db[(_0xfc0d('0x96'))][(_0xfc0d('0x97'))](_0xfc0d('0xa7'));}return _0x2f236e[_0xfc0d('0xa8')+_[_0xfc0d('0xa9')](_0x497f59[_0xfc0d('0xaa')]())+'Queues'](_0x50310a[_0xfc0d('0x61')]['ids'],{'penalty':_0x50310a[_0xfc0d('0x61')][_0xfc0d('0xab')]||0x0})[_0xfc0d('0xac')](function(_0x45bf20){for(var _0x153150=0x0;_0x153150<_0x50310a[_0xfc0d('0x61')][_0xfc0d('0x64')][_0xfc0d('0x4d')];_0x153150+=0x1){var _0x324726={'UserId':Number(_0x50310a[_0xfc0d('0x54')]['id'])};_0x324726[_[_0xfc0d('0xa9')](_0x497f59['toLowerCase']())+_0xfc0d('0xad')]=Number(_0x50310a[_0xfc0d('0x61')][_0xfc0d('0x64')][_0x153150]);socket[_0xfc0d('0x2c')]('user'+_[_0xfc0d('0xa9')](_0x497f59[_0xfc0d('0xaa')]())+_0xfc0d('0xae'),_0x324726);}return _0x45bf20;})[_0xfc0d('0x29')](function(){if(_0x497f59===_0xfc0d('0xaf')){return db['VoiceQueue'][_0xfc0d('0x4a')]({'where':{'id':_0x50310a[_0xfc0d('0x61')][_0xfc0d('0x64')]||[]},'raw':!![],'attributes':['id',_0xfc0d('0x3a')]});}})[_0xfc0d('0x29')](function(_0x17c841){var _0xbbdd91=_0x2f236e[_0xfc0d('0x2f')]({'plain':!![]});var _0x3574d6=[];if(_0x497f59===_0xfc0d('0xaf')&&_0xbbdd91[_0xfc0d('0x2a')]===_0xfc0d('0x2b')&&_0xbbdd91[_0xfc0d('0xa2')]){for(let _0x3a8535=0x0;_0x3a8535<_0x17c841['length'];_0x3a8535+=0x1){_0x3574d6['push']({'membername':_0xbbdd91[_0xfc0d('0x3a')],'UserId':_0xbbdd91['id'],'queue_name':_0x17c841[_0x3a8535][_0xfc0d('0x3a')],'VoiceQueueId':_0x17c841[_0x3a8535]['id'],'interface':_[_0xfc0d('0x6b')](_0xbbdd91['interface'])?util[_0xfc0d('0xb0')](_0xfc0d('0xb1'),_0xbbdd91[_0xfc0d('0x3a')]):_0xbbdd91['interface'],'paused':_0xbbdd91[_0xfc0d('0xa4')]||![],'penalty':_0x50310a[_0xfc0d('0x61')][_0xfc0d('0xab')]||0x0});}return Promise[_0xfc0d('0x52')](_0x3574d6['map'](function(_0x47afeb){return db[_0xfc0d('0xb2')][_0xfc0d('0xb3')](_0x47afeb);}));}return _0x2f236e;});}})[_0xfc0d('0x29')](respondWithStatusCode(_0x7d1298,null))['catch'](handleError(_0x7d1298,null));};exports[_0xfc0d('0xb4')]=function(_0x5b17da,_0x2bd136){var _0x120d43,_0x4ded55;return db[_0xfc0d('0x3e')][_0xfc0d('0x39')]({'where':{'id':_0x5b17da[_0xfc0d('0x54')]['id']},'attributes':['id','name',_0xfc0d('0x2a')]})[_0xfc0d('0x29')](handleEntityNotFound(_0x2bd136,null))[_0xfc0d('0x29')](function(_0x43af49){if(_0x43af49){_0x120d43=_0x43af49;if(!_0x5b17da[_0xfc0d('0x45')]['channel']||!utils['isValidChannel'](_0x5b17da[_0xfc0d('0x45')][_0xfc0d('0xb5')])){throw new db['Sequelize'][(_0xfc0d('0x97'))](_0xfc0d('0xa7'));}return _0x43af49[_0xfc0d('0xb6')+_['capitalize'](_0x5b17da[_0xfc0d('0x45')][_0xfc0d('0xb5')][_0xfc0d('0xaa')]())+'Queues'](_0x5b17da[_0xfc0d('0x45')][_0xfc0d('0x64')]);}})[_0xfc0d('0x29')](function(_0x572207){if(_[_0xfc0d('0xb7')](_0x5b17da[_0xfc0d('0x45')]['ids'])){for(var _0x5f2104=0x0;_0x5f2104<_0x5b17da[_0xfc0d('0x45')][_0xfc0d('0x64')][_0xfc0d('0x4d')];_0x5f2104+=0x1){_0x4ded55={'UserId':Number(_0x5b17da[_0xfc0d('0x54')]['id'])};_0x4ded55[_[_0xfc0d('0xa9')](_0x5b17da[_0xfc0d('0x45')]['channel']['toLowerCase']())+_0xfc0d('0xad')]=Number(_0x5b17da[_0xfc0d('0x45')][_0xfc0d('0x64')][_0x5f2104]);socket[_0xfc0d('0x2c')](_0xfc0d('0x31')+_[_0xfc0d('0xa9')](_0x5b17da[_0xfc0d('0x45')][_0xfc0d('0xb5')][_0xfc0d('0xaa')]())+'Queue:remove',_0x4ded55);}}else{_0x4ded55={'UserId':Number(_0x5b17da['params']['id'])};_0x4ded55[_['capitalize'](_0x5b17da[_0xfc0d('0x45')][_0xfc0d('0xb5')][_0xfc0d('0xaa')]())+_0xfc0d('0xad')]=Number(_0x5b17da[_0xfc0d('0x45')]['ids']);socket[_0xfc0d('0x2c')](_0xfc0d('0x31')+_[_0xfc0d('0xa9')](_0x5b17da[_0xfc0d('0x45')][_0xfc0d('0xb5')]['toLowerCase']())+'Queue:remove',_0x4ded55);}return _0x572207;})[_0xfc0d('0x29')](function(){if(_0x5b17da[_0xfc0d('0x45')][_0xfc0d('0xb5')]===_0xfc0d('0xaf')){return db[_0xfc0d('0xb2')][_0xfc0d('0x2e')]({'where':{'UserId':_0x5b17da[_0xfc0d('0x54')]['id'],'VoiceQueueId':_0x5b17da[_0xfc0d('0x45')][_0xfc0d('0x64')]},'individualHooks':!![]})[_0xfc0d('0x29')](function(){return _0x120d43;});}return _0x120d43;})[_0xfc0d('0x29')](respondWithStatusCode(_0x2bd136,null))[_0xfc0d('0x60')](handleError(_0x2bd136,null));};exports[_0xfc0d('0xb8')]=function(_0x4d5ebd,_0x6206af){_0x4d5ebd[_0xfc0d('0x61')]['userpic']=_0x4d5ebd[_0xfc0d('0xb9')][_0xfc0d('0xba')];return db[_0xfc0d('0x3e')][_0xfc0d('0x39')]({'where':{'id':_0x4d5ebd[_0xfc0d('0x54')]['id']}})[_0xfc0d('0x29')](handleEntityNotFound(_0x6206af,null))[_0xfc0d('0x29')](saveUpdates(_0x4d5ebd[_0xfc0d('0x61')],null))[_0xfc0d('0x29')](respondWithResult(_0x6206af,null))[_0xfc0d('0x60')](handleError(_0x6206af,null));};exports['getAvatar']=function(_0x52367b,_0x5ea75d){var _0x158bb4=path['join'](config[_0xfc0d('0xbb')],_0xfc0d('0xbc'));return db['User'][_0xfc0d('0x39')]({'where':{'id':_0x52367b[_0xfc0d('0x54')]['id']},'attributes':['id',_0xfc0d('0xbd')],'raw':!![]})[_0xfc0d('0x29')](handleEntityNotFound(_0x5ea75d,null))[_0xfc0d('0x29')](function(_0x14f42a){if(_0x14f42a){if(_[_0xfc0d('0x6b')](_0x14f42a['userpic'])){return _0x5ea75d[_0xfc0d('0xbe')](_0x158bb4);}else{if(!fs[_0xfc0d('0xbf')](path[_0xfc0d('0xc0')](config['root'],_0xfc0d('0xc1'),_0x14f42a[_0xfc0d('0xbd')]))){return _0x5ea75d[_0xfc0d('0xbe')](_0x158bb4);}return _0x5ea75d['download'](path['join'](config[_0xfc0d('0xbb')],_0xfc0d('0xc1'),_0x14f42a['userpic']));}}})[_0xfc0d('0x60')](handleError(_0x5ea75d,null));};exports[_0xfc0d('0xc2')]=function(_0x353051,_0x3e2ef4){return db[_0xfc0d('0x3e')][_0xfc0d('0x39')]({'where':{'id':_0x353051[_0xfc0d('0x54')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x3e2ef4,null))[_0xfc0d('0x29')](function(_0x39bff2){var _0x39448f=[];values=_0x39bff2[_0xfc0d('0x4e')];_0x39448f['push'](get_open_tabs(_0xfc0d('0xc3'),_0x39bff2['dataValues']));_0x39448f[_0xfc0d('0x49')](get_open_tabs('sms',_0x39bff2[_0xfc0d('0x4e')]));_0x39448f[_0xfc0d('0x49')](get_open_tabs(_0xfc0d('0x50'),_0x39bff2[_0xfc0d('0x4e')]));_0x39448f[_0xfc0d('0x49')](get_open_tabs(_0xfc0d('0x51'),_0x39bff2['dataValues']));_0x39448f[_0xfc0d('0x49')](get_open_tabs('fax',_0x39bff2[_0xfc0d('0x4e')]));_0x39448f[_0xfc0d('0x49')](get_open_tabs('mail',_0x39bff2[_0xfc0d('0x4e')]));return Promise[_0xfc0d('0x52')](_0x39448f);})[_0xfc0d('0x29')](function(_0x58debd){if(_0x58debd){var _0x1b7909=_['map'](values[_0xfc0d('0xc4')],function(_0x572b97){return{'channel':_0xfc0d('0xc5'),'id':_0x572b97['id'],'createdAt':_0x572b97[_0xfc0d('0xc6')]};});var _0x5783d0=_['map'](values[_0xfc0d('0xc7')],function(_0x6a4b40){return{'channel':_0xfc0d('0xc8'),'id':_0x6a4b40['id'],'createdAt':_0x6a4b40[_0xfc0d('0xc6')]};});var _0x2155cf=_[_0xfc0d('0x8f')](values[_0xfc0d('0xc9')],function(_0x1f36cb){return{'channel':_0xfc0d('0xca'),'id':_0x1f36cb['id'],'createdAt':_0x1f36cb[_0xfc0d('0xc6')]};});var _0x4cbdb4=_['map'](values[_0xfc0d('0xcb')],function(_0x2184c1){return{'channel':_0xfc0d('0xcc'),'id':_0x2184c1['id'],'createdAt':_0x2184c1[_0xfc0d('0xc6')]};});var _0xc70322=_['map'](values[_0xfc0d('0xcd')],function(_0x377ca6){return{'channel':_0xfc0d('0xce'),'id':_0x377ca6['id'],'createdAt':_0x377ca6[_0xfc0d('0xc6')]};});var _0x245e5d=_[_0xfc0d('0x8f')](values[_0xfc0d('0xcf')],function(_0x2065ff){return{'channel':_0xfc0d('0xd0'),'id':_0x2065ff['id'],'createdAt':_0x2065ff[_0xfc0d('0xc6')]};});var _0x420d52=_[_0xfc0d('0xd1')](_0x1b7909,_0x5783d0,_0x2155cf,_0x4cbdb4,_0xc70322,_0x245e5d);var _0x5b0c20={'count':_0x420d52['length'],'rows':_0x420d52};return _0x5b0c20;}else return null;})['then'](respondWithResult(_0x3e2ef4,null))[_0xfc0d('0x60')](handleError(_0x3e2ef4,null));};exports[_0xfc0d('0xd2')]=function(_0x22a49a,_0x22c957){var _0x409f28={};return db[_0xfc0d('0x3e')][_0xfc0d('0x9c')]({'where':{'id':_0x22a49a[_0xfc0d('0x54')]['id']}})[_0xfc0d('0x29')](function(_0x2827ee){if(!_0x2827ee){throw new APINotFoundError(util[_0xfc0d('0xb0')](_0xfc0d('0xd3'),_0x22a49a[_0xfc0d('0x54')]['id']));}return contacts['describe']();})[_0xfc0d('0x29')](function(_0x131ea2){_0x22a49a[_0xfc0d('0x45')][_0xfc0d('0x3e')]=_0x22a49a['params']['id'];_0x409f28=qs['getOptions'](_0x131ea2,_0x22a49a);if(_0x22a49a[_0xfc0d('0x45')][_0xfc0d('0xd4')](_0xfc0d('0x5b'))){_0x409f28[_0xfc0d('0x44')]=[{'model':db[_0xfc0d('0xd5')],'as':_0xfc0d('0xd6'),'required':![]},{'model':db[_0xfc0d('0xd7')],'as':'Tags','attributes':['id',_0xfc0d('0x3a'),'color'],'where':_0x22a49a[_0xfc0d('0x45')][_0xfc0d('0xd8')]?{'id':_0x22a49a[_0xfc0d('0x45')][_0xfc0d('0xd8')]}:undefined,'required':_0x22a49a[_0xfc0d('0x45')]['tag']?!![]:![]}];}return contacts[_0xfc0d('0x4a')](_0x22a49a[_0xfc0d('0x45')],_0x22a49a[_0xfc0d('0x31')],_0x409f28,_0x131ea2);})[_0xfc0d('0x29')](respondWithFilteredResult(_0x22c957,_0x409f28))['catch'](APIHandleError(_0x22c957));};exports[_0xfc0d('0xd9')]=function(_0x24cdeb,_0x2d3737){var _0x5bb0bd;var _0x2a9507={};var _0x282bed;return db[_0xfc0d('0x3e')][_0xfc0d('0x9c')]({'where':{'id':_0x24cdeb['params']['id']},'attributes':['id',_0xfc0d('0x3a'),_0xfc0d('0x2a')]})[_0xfc0d('0x29')](handleEntityNotFound(_0x2d3737,null))[_0xfc0d('0x29')](function(_0x15c8c6){if(!utils[_0xfc0d('0xa6')](_0x24cdeb[_0xfc0d('0x45')][_0xfc0d('0xb5')])){throw new db['Sequelize']['ValidationError'](_0xfc0d('0xa7'));}_0x5bb0bd=_0x15c8c6;var _0x3740a8={};_0x3740a8[_0xfc0d('0x59')]=_[_0xfc0d('0x55')](db[_[_0xfc0d('0xa9')](_0x24cdeb[_0xfc0d('0x45')][_0xfc0d('0xb5')])+'Queue'][_0xfc0d('0x3f')]);_0x3740a8['query']=_[_0xfc0d('0x55')](_0x24cdeb[_0xfc0d('0x45')]);_0x3740a8[_0xfc0d('0x57')]=_[_0xfc0d('0x58')](_0x3740a8[_0xfc0d('0x59')],_0x3740a8['query']);_0x2a9507[_0xfc0d('0x48')]=_[_0xfc0d('0x58')](_0x3740a8[_0xfc0d('0x59')],qs[_0xfc0d('0x5a')](_0x24cdeb[_0xfc0d('0x45')][_0xfc0d('0x5a')]));_0x2a9507[_0xfc0d('0x48')]=_0x2a9507[_0xfc0d('0x48')][_0xfc0d('0x4d')]?_0x2a9507[_0xfc0d('0x48')]:_0x3740a8[_0xfc0d('0x59')];_0x2a9507['order']=qs[_0xfc0d('0xda')](_0x24cdeb[_0xfc0d('0x45')][_0xfc0d('0xda')]);_0x2a9507[_0xfc0d('0xdb')]=qs['filters'](_['pick'](_0x24cdeb[_0xfc0d('0x45')],_0x3740a8[_0xfc0d('0x57')]));if(_0x24cdeb[_0xfc0d('0x45')][_0xfc0d('0x35')]){_0x2a9507[_0xfc0d('0xdb')]=_[_0xfc0d('0x5c')](_0x2a9507[_0xfc0d('0xdb')],{'$or':_['map'](_0x2a9507['attributes'],function(_0x3e22dd){var _0x37d8d5={};_0x37d8d5[_0x3e22dd]={'$like':'%'+_0x24cdeb[_0xfc0d('0x45')]['filter']+'%'};return _0x37d8d5;})});}_0x2a9507=_[_0xfc0d('0x5c')]({},_0x2a9507,_0x24cdeb[_0xfc0d('0x5d')]);switch(_0x5bb0bd[_0xfc0d('0x2a')]){case _0xfc0d('0x84'):return db[_[_0xfc0d('0xa9')](_0x24cdeb[_0xfc0d('0x45')][_0xfc0d('0xb5')])+_0xfc0d('0xdc')][_0xfc0d('0x4a')](_0x2a9507);case'user':case _0xfc0d('0x2b'):return _0x5bb0bd[_0xfc0d('0x2f')+_[_0xfc0d('0xa9')](_0x24cdeb[_0xfc0d('0x45')][_0xfc0d('0xb5')])+'Queues'](_0x2a9507);default:throw new db[(_0xfc0d('0x96'))][(_0xfc0d('0x97'))](_0xfc0d('0xdd'));}})[_0xfc0d('0x29')](function(_0x568a4f){_0x282bed=_0x568a4f[_0xfc0d('0x4d')];if(!_0x24cdeb[_0xfc0d('0x45')][_0xfc0d('0xd4')](_0xfc0d('0xde'))){_0x2a9507[_0xfc0d('0x25')]=qs['limit'](_0x24cdeb['query'][_0xfc0d('0x25')]);_0x2a9507['offset']=qs['offset'](_0x24cdeb[_0xfc0d('0x45')][_0xfc0d('0x22')]);}switch(_0x5bb0bd[_0xfc0d('0x2a')]){case _0xfc0d('0x84'):return db[_[_0xfc0d('0xa9')](_0x24cdeb[_0xfc0d('0x45')][_0xfc0d('0xb5')])+_0xfc0d('0xdc')][_0xfc0d('0x4a')](_0x2a9507);case _0xfc0d('0x31'):case'agent':return _0x5bb0bd['get'+_[_0xfc0d('0xa9')](_0x24cdeb['query']['channel'])+_0xfc0d('0xdf')](_0x2a9507);}})[_0xfc0d('0x29')](function(_0x396804){return{'count':_0x282bed,'rows':_0x396804};})[_0xfc0d('0x29')](respondWithResult(_0x2d3737,null))[_0xfc0d('0x60')](handleError(_0x2d3737,null));};exports['getVoiceQueuesRt']=function(_0x146322,_0x1a0ae8){var _0x4d6b0d={};var _0x358d08={};var _0x5e3d39;var _0x207acd;return db[_0xfc0d('0x3e')][_0xfc0d('0x9c')]({'where':{'id':_0x146322[_0xfc0d('0x54')]['id']}})[_0xfc0d('0x29')](handleEntityNotFound(_0x1a0ae8,null))[_0xfc0d('0x29')](function(_0x50de1c){if(_0x50de1c){_0x5e3d39=_0x50de1c;_0x358d08[_0xfc0d('0x59')]=_['keys'](db[_0xfc0d('0xb2')][_0xfc0d('0x3f')]);_0x358d08[_0xfc0d('0x45')]=_['keys'](_0x146322[_0xfc0d('0x45')]);_0x358d08['filters']=_[_0xfc0d('0x58')](_0x358d08[_0xfc0d('0x59')],_0x358d08[_0xfc0d('0x45')]);_0x4d6b0d[_0xfc0d('0x48')]=_['intersection'](_0x358d08[_0xfc0d('0x59')],qs[_0xfc0d('0x5a')](_0x146322[_0xfc0d('0x45')][_0xfc0d('0x5a')]));_0x4d6b0d['attributes']=_0x4d6b0d['attributes'][_0xfc0d('0x4d')]?_0x4d6b0d[_0xfc0d('0x48')]:_0x358d08[_0xfc0d('0x59')];_0x4d6b0d[_0xfc0d('0xe0')]=qs[_0xfc0d('0xda')](_0x146322['query'][_0xfc0d('0xda')]);_0x4d6b0d[_0xfc0d('0xdb')]=qs['filters'](_['pick'](_0x146322['query'],_0x358d08[_0xfc0d('0x57')]));if(_0x146322[_0xfc0d('0x45')]['filter']){_0x4d6b0d[_0xfc0d('0xdb')]=_[_0xfc0d('0x5c')](_0x4d6b0d[_0xfc0d('0xdb')],{'$or':_[_0xfc0d('0x8f')](_0x4d6b0d['attributes'],function(_0x441f0a){var _0x2b9168={};_0x2b9168[_0x441f0a]={'$like':'%'+_0x146322['query']['filter']+'%'};return _0x2b9168;})});}_0x4d6b0d=_[_0xfc0d('0x5c')]({},_0x4d6b0d,_0x146322[_0xfc0d('0x5d')]);return _0x5e3d39[_0xfc0d('0xe1')](_0x4d6b0d);}})[_0xfc0d('0x29')](function(_0x4f2847){if(_0x4f2847){_0x207acd=_0x4f2847[_0xfc0d('0x4d')];if(!_0x146322[_0xfc0d('0x45')][_0xfc0d('0xd4')](_0xfc0d('0xde'))){_0x4d6b0d[_0xfc0d('0x25')]=qs['limit'](_0x146322['query'][_0xfc0d('0x25')]);_0x4d6b0d[_0xfc0d('0x22')]=qs[_0xfc0d('0x22')](_0x146322[_0xfc0d('0x45')][_0xfc0d('0x22')]);}return _0x5e3d39[_0xfc0d('0xe1')](_0x4d6b0d);}})['then'](function(_0x388b9f){if(_0x388b9f){return _0x388b9f?{'count':_0x207acd,'rows':_0x388b9f}:null;}})[_0xfc0d('0x29')](respondWithResult(_0x1a0ae8,null))[_0xfc0d('0x60')](handleError(_0x1a0ae8,null));};exports[_0xfc0d('0xe2')]=function(_0x3d2233,_0x3a6b57){var _0x1d7f61={};var _0x207f2d={};var _0x389bb1;var _0x12cfb8;return db['User'][_0xfc0d('0x9c')]({'where':{'id':_0x3d2233['params']['id']}})[_0xfc0d('0x29')](handleEntityNotFound(_0x3a6b57,null))[_0xfc0d('0x29')](function(_0x4a725f){if(_0x4a725f){_0x389bb1=_0x4a725f;_0x207f2d[_0xfc0d('0x59')]=_[_0xfc0d('0x55')](db[_0xfc0d('0xe3')][_0xfc0d('0x3f')]);_0x207f2d[_0xfc0d('0x45')]=_[_0xfc0d('0x55')](_0x3d2233[_0xfc0d('0x45')]);_0x207f2d[_0xfc0d('0x57')]=_[_0xfc0d('0x58')](_0x207f2d[_0xfc0d('0x59')],_0x207f2d[_0xfc0d('0x45')]);_0x1d7f61[_0xfc0d('0x48')]=_[_0xfc0d('0x58')](_0x207f2d[_0xfc0d('0x59')],qs[_0xfc0d('0x5a')](_0x3d2233[_0xfc0d('0x45')]['fields']));_0x1d7f61[_0xfc0d('0x48')]=_0x1d7f61[_0xfc0d('0x48')]['length']?_0x1d7f61[_0xfc0d('0x48')]:_0x207f2d[_0xfc0d('0x59')];_0x1d7f61[_0xfc0d('0xe0')]=qs[_0xfc0d('0xda')](_0x3d2233[_0xfc0d('0x45')][_0xfc0d('0xda')]);_0x1d7f61[_0xfc0d('0xdb')]=qs[_0xfc0d('0x57')](_[_0xfc0d('0xe4')](_0x3d2233[_0xfc0d('0x45')],_0x207f2d[_0xfc0d('0x57')]));if(_0x3d2233[_0xfc0d('0x45')][_0xfc0d('0x35')]){_0x1d7f61[_0xfc0d('0xdb')]=_[_0xfc0d('0x5c')](_0x1d7f61[_0xfc0d('0xdb')],{'$or':_[_0xfc0d('0x8f')](_0x1d7f61[_0xfc0d('0x48')],function(_0x9dff85){var _0x2214b6={};_0x2214b6[_0x9dff85]={'$like':'%'+_0x3d2233[_0xfc0d('0x45')][_0xfc0d('0x35')]+'%'};return _0x2214b6;})});}_0x1d7f61=_['merge']({},_0x1d7f61,_0x3d2233[_0xfc0d('0x5d')]);return _0x389bb1[_0xfc0d('0xe2')](_0x1d7f61);}})['then'](function(_0x1a1c81){if(_0x1a1c81){_0x12cfb8=_0x1a1c81['length'];if(!_0x3d2233[_0xfc0d('0x45')][_0xfc0d('0xd4')]('nolimit')){_0x1d7f61['limit']=qs[_0xfc0d('0x25')](_0x3d2233['query'][_0xfc0d('0x25')]);_0x1d7f61[_0xfc0d('0x22')]=qs['offset'](_0x3d2233[_0xfc0d('0x45')][_0xfc0d('0x22')]);}return _0x389bb1['getGroups'](_0x1d7f61);}})[_0xfc0d('0x29')](function(_0x44321a){if(_0x44321a){return _0x44321a?{'count':_0x12cfb8,'rows':_0x44321a}:null;}})[_0xfc0d('0x29')](respondWithResult(_0x3a6b57,null))[_0xfc0d('0x60')](handleError(_0x3a6b57,null));};exports[_0xfc0d('0xe5')]=function(_0x57f388,_0xe54a39){var _0x2a6562={'raw':!![],'where':{}};var _0x25cf37={};var _0x40555c={'count':0x0,'rows':[]};return db[_0xfc0d('0x3e')][_0xfc0d('0x9c')]({'where':{'id':_0x57f388[_0xfc0d('0x54')]['id']}})[_0xfc0d('0x29')](handleEntityNotFound(_0xe54a39,null))[_0xfc0d('0x29')](function(_0x5db8ec){if(_0x5db8ec){_0x25cf37[_0xfc0d('0x59')]=_[_0xfc0d('0x55')](db[_0xfc0d('0xe6')][_0xfc0d('0x3f')]);_0x25cf37[_0xfc0d('0x45')]=_[_0xfc0d('0x55')](_0x57f388[_0xfc0d('0x45')]);_0x25cf37[_0xfc0d('0x57')]=_[_0xfc0d('0x58')](_0x25cf37[_0xfc0d('0x59')],_0x25cf37[_0xfc0d('0x45')]);_0x2a6562['attributes']=_[_0xfc0d('0x58')](_0x25cf37['model'],qs[_0xfc0d('0x5a')](_0x57f388[_0xfc0d('0x45')][_0xfc0d('0x5a')]));_0x2a6562[_0xfc0d('0x48')]=_0x2a6562[_0xfc0d('0x48')][_0xfc0d('0x4d')]?_0x2a6562[_0xfc0d('0x48')]:_0x25cf37[_0xfc0d('0x59')];if(!_0x57f388[_0xfc0d('0x45')][_0xfc0d('0xd4')](_0xfc0d('0xde'))){_0x2a6562[_0xfc0d('0x25')]=qs['limit'](_0x57f388[_0xfc0d('0x45')]['limit']);_0x2a6562[_0xfc0d('0x22')]=qs['offset'](_0x57f388[_0xfc0d('0x45')][_0xfc0d('0x22')]);}_0x2a6562['order']=qs[_0xfc0d('0xda')](_0x57f388['query'][_0xfc0d('0xda')]);_0x2a6562[_0xfc0d('0xdb')]=qs[_0xfc0d('0x57')](_['pick'](_0x57f388['query'],_0x25cf37['filters']));_0x2a6562[_0xfc0d('0xdb')][_0xfc0d('0xe7')]=_0x5db8ec['id'];if(_0x57f388[_0xfc0d('0x45')][_0xfc0d('0x35')]){_0x2a6562[_0xfc0d('0xdb')]=_[_0xfc0d('0x5c')](_0x2a6562[_0xfc0d('0xdb')],{'$or':_[_0xfc0d('0x8f')](_0x2a6562[_0xfc0d('0x48')],function(_0x1ca439){var _0x48612e={};_0x48612e[_0x1ca439]={'$like':'%'+_0x57f388[_0xfc0d('0x45')]['filter']+'%'};return _0x48612e;})});}_0x2a6562=_[_0xfc0d('0x5c')]({},_0x2a6562,_0x57f388[_0xfc0d('0x5d')]);return db[_0xfc0d('0xe6')]['count']({'where':_0x2a6562[_0xfc0d('0xdb')]})[_0xfc0d('0x29')](function(_0x252505){_0x40555c[_0xfc0d('0x24')]=_0x252505;if(_0x57f388[_0xfc0d('0x45')][_0xfc0d('0x5b')]){_0x2a6562[_0xfc0d('0x44')]=[{'all':!![]}];}return db[_0xfc0d('0xe6')]['findAll'](_0x2a6562);})['then'](function(_0xfda849){_0x40555c[_0xfc0d('0x4b')]=_0xfda849;return _0x40555c;});}})[_0xfc0d('0x29')](respondWithFilteredResult(_0xe54a39,_0x2a6562))[_0xfc0d('0x60')](handleError(_0xe54a39,null));};exports[_0xfc0d('0xe8')]=function(_0x1931de,_0x439379){var _0x557bdb={'raw':!![],'where':{}};var _0x3a909b={};var _0x14dd6c={'count':0x0,'rows':[]};return db['User'][_0xfc0d('0x9c')]({'where':{'id':_0x1931de[_0xfc0d('0x54')]['id']}})[_0xfc0d('0x29')](handleEntityNotFound(_0x439379,null))[_0xfc0d('0x29')](function(_0x230c7b){if(_0x230c7b){_0x3a909b['model']=_[_0xfc0d('0x55')](db[_0xfc0d('0xe9')][_0xfc0d('0x3f')]);_0x3a909b['query']=_['keys'](_0x1931de[_0xfc0d('0x45')]);_0x3a909b['filters']=_[_0xfc0d('0x58')](_0x3a909b[_0xfc0d('0x59')],_0x3a909b[_0xfc0d('0x45')]);_0x557bdb[_0xfc0d('0x48')]=_['intersection'](_0x3a909b[_0xfc0d('0x59')],qs[_0xfc0d('0x5a')](_0x1931de[_0xfc0d('0x45')][_0xfc0d('0x5a')]));_0x557bdb[_0xfc0d('0x48')]=_0x557bdb[_0xfc0d('0x48')]['length']?_0x557bdb['attributes']:_0x3a909b[_0xfc0d('0x59')];if(!_0x1931de[_0xfc0d('0x45')]['hasOwnProperty'](_0xfc0d('0xde'))){_0x557bdb[_0xfc0d('0x25')]=qs[_0xfc0d('0x25')](_0x1931de[_0xfc0d('0x45')][_0xfc0d('0x25')]);_0x557bdb['offset']=qs[_0xfc0d('0x22')](_0x1931de[_0xfc0d('0x45')][_0xfc0d('0x22')]);}_0x557bdb[_0xfc0d('0xe0')]=qs[_0xfc0d('0xda')](_0x1931de[_0xfc0d('0x45')][_0xfc0d('0xda')]);_0x557bdb['where']=qs[_0xfc0d('0x57')](_[_0xfc0d('0xe4')](_0x1931de['query'],_0x3a909b[_0xfc0d('0x57')]));_0x557bdb[_0xfc0d('0xdb')]['UserId']=_0x230c7b['id'];if(_0x1931de[_0xfc0d('0x45')]['filter']){_0x557bdb[_0xfc0d('0xdb')]=_['merge'](_0x557bdb[_0xfc0d('0xdb')],{'$or':_[_0xfc0d('0x8f')](_0x557bdb['attributes'],function(_0xf13e22){var _0x2f18f0={};_0x2f18f0[_0xf13e22]={'$like':'%'+_0x1931de[_0xfc0d('0x45')][_0xfc0d('0x35')]+'%'};return _0x2f18f0;})});}_0x557bdb=_[_0xfc0d('0x5c')]({},_0x557bdb,_0x1931de[_0xfc0d('0x5d')]);return db['ScreenRecording'][_0xfc0d('0x24')]({'where':_0x557bdb[_0xfc0d('0xdb')]})[_0xfc0d('0x29')](function(_0x1e0138){_0x14dd6c[_0xfc0d('0x24')]=_0x1e0138;if(_0x1931de['query'][_0xfc0d('0x5b')]){_0x557bdb[_0xfc0d('0x44')]=[{'all':!![]}];}return db['ScreenRecording'][_0xfc0d('0x4a')](_0x557bdb);})[_0xfc0d('0x29')](function(_0x44b5ec){_0x14dd6c[_0xfc0d('0x4b')]=_0x44b5ec;return _0x14dd6c;});}})['then'](respondWithFilteredResult(_0x439379,_0x557bdb))[_0xfc0d('0x60')](handleError(_0x439379,null));};exports[_0xfc0d('0xea')]=function(_0x4fceba,_0x3f2096){var _0x154c00={};var _0x4aeb2f={};var _0x5447d6;var _0x27fceb;return db[_0xfc0d('0x3e')]['findOne']({'where':{'id':_0x4fceba['params']['id']}})['then'](handleEntityNotFound(_0x3f2096,null))[_0xfc0d('0x29')](function(_0x221913){if(_0x221913){_0x5447d6=_0x221913;_0x4aeb2f['model']=_[_0xfc0d('0x55')](db[_0xfc0d('0xeb')][_0xfc0d('0x3f')]);_0x4aeb2f['query']=_['keys'](_0x4fceba[_0xfc0d('0x45')]);_0x4aeb2f['filters']=_[_0xfc0d('0x58')](_0x4aeb2f[_0xfc0d('0x59')],_0x4aeb2f[_0xfc0d('0x45')]);_0x154c00[_0xfc0d('0x48')]=_[_0xfc0d('0x58')](_0x4aeb2f[_0xfc0d('0x59')],qs[_0xfc0d('0x5a')](_0x4fceba[_0xfc0d('0x45')][_0xfc0d('0x5a')]));_0x154c00[_0xfc0d('0x48')]=_0x154c00[_0xfc0d('0x48')][_0xfc0d('0x4d')]?_0x154c00[_0xfc0d('0x48')]:_0x4aeb2f[_0xfc0d('0x59')];_0x154c00[_0xfc0d('0xe0')]=qs[_0xfc0d('0xda')](_0x4fceba['query']['sort']);_0x154c00[_0xfc0d('0xdb')]=qs[_0xfc0d('0x57')](_[_0xfc0d('0xe4')](_0x4fceba[_0xfc0d('0x45')],_0x4aeb2f['filters']));if(_0x4fceba[_0xfc0d('0x45')][_0xfc0d('0x35')]){_0x154c00[_0xfc0d('0xdb')]=_[_0xfc0d('0x5c')](_0x154c00[_0xfc0d('0xdb')],{'$or':_['map'](_0x154c00[_0xfc0d('0x48')],function(_0x40ef0c){var _0x3d82d1={};_0x3d82d1[_0x40ef0c]={'$like':'%'+_0x4fceba[_0xfc0d('0x45')][_0xfc0d('0x35')]+'%'};return _0x3d82d1;})});}_0x154c00=_[_0xfc0d('0x5c')]({},_0x154c00,_0x4fceba[_0xfc0d('0x5d')]);return _0x5447d6[_0xfc0d('0xea')](_0x154c00);}})[_0xfc0d('0x29')](function(_0x370c13){if(_0x370c13){_0x27fceb=_0x370c13[_0xfc0d('0x4d')];if(!_0x4fceba[_0xfc0d('0x45')]['hasOwnProperty'](_0xfc0d('0xde'))){_0x154c00['limit']=qs[_0xfc0d('0x25')](_0x4fceba['query'][_0xfc0d('0x25')]);_0x154c00[_0xfc0d('0x22')]=qs[_0xfc0d('0x22')](_0x4fceba[_0xfc0d('0x45')][_0xfc0d('0x22')]);}return _0x5447d6[_0xfc0d('0xea')](_0x154c00);}})[_0xfc0d('0x29')](function(_0x8783db){if(_0x8783db){return _0x8783db?{'count':_0x27fceb,'rows':_0x8783db}:null;}})['then'](respondWithResult(_0x3f2096,null))[_0xfc0d('0x60')](handleError(_0x3f2096,null));};exports['getOpenchannelInteractions']=function(_0x765721,_0x435441){var _0x4c685c={};var _0x2b77b5={};var _0x9e8d26;var _0x562261;return db[_0xfc0d('0x3e')]['findOne']({'where':{'id':_0x765721[_0xfc0d('0x54')]['id']}})['then'](handleEntityNotFound(_0x435441,null))[_0xfc0d('0x29')](function(_0x210218){if(_0x210218){_0x9e8d26=_0x210218;_0x2b77b5['model']=_[_0xfc0d('0x55')](db[_0xfc0d('0xec')][_0xfc0d('0x3f')]);_0x2b77b5[_0xfc0d('0x45')]=_[_0xfc0d('0x55')](_0x765721[_0xfc0d('0x45')]);_0x2b77b5[_0xfc0d('0x57')]=_['intersection'](_0x2b77b5[_0xfc0d('0x59')],_0x2b77b5[_0xfc0d('0x45')]);_0x4c685c[_0xfc0d('0x48')]=_[_0xfc0d('0x58')](_0x2b77b5[_0xfc0d('0x59')],qs[_0xfc0d('0x5a')](_0x765721[_0xfc0d('0x45')][_0xfc0d('0x5a')]));_0x4c685c['attributes']=_0x4c685c[_0xfc0d('0x48')][_0xfc0d('0x4d')]?_0x4c685c['attributes']:_0x2b77b5[_0xfc0d('0x59')];_0x4c685c[_0xfc0d('0xe0')]=qs[_0xfc0d('0xda')](_0x765721['query'][_0xfc0d('0xda')]);_0x4c685c[_0xfc0d('0xdb')]=qs[_0xfc0d('0x57')](_[_0xfc0d('0xe4')](_0x765721[_0xfc0d('0x45')],_0x2b77b5[_0xfc0d('0x57')]));if(_0x765721[_0xfc0d('0x45')]['filter']){_0x4c685c['where']=_[_0xfc0d('0x5c')](_0x4c685c[_0xfc0d('0xdb')],{'$or':_[_0xfc0d('0x8f')](_0x4c685c[_0xfc0d('0x48')],function(_0x1433e2){var _0x1dff35={};_0x1dff35[_0x1433e2]={'$like':'%'+_0x765721[_0xfc0d('0x45')][_0xfc0d('0x35')]+'%'};return _0x1dff35;})});}_0x4c685c=_[_0xfc0d('0x5c')]({},_0x4c685c,_0x765721[_0xfc0d('0x5d')]);return _0x9e8d26['getOpenchannelInteractions'](_0x4c685c);}})['then'](function(_0x43d5f4){if(_0x43d5f4){_0x562261=_0x43d5f4['length'];if(!_0x765721[_0xfc0d('0x45')][_0xfc0d('0xd4')](_0xfc0d('0xde'))){_0x4c685c[_0xfc0d('0x25')]=qs['limit'](_0x765721['query'][_0xfc0d('0x25')]);_0x4c685c[_0xfc0d('0x22')]=qs[_0xfc0d('0x22')](_0x765721[_0xfc0d('0x45')][_0xfc0d('0x22')]);}return _0x9e8d26[_0xfc0d('0xed')](_0x4c685c);}})[_0xfc0d('0x29')](function(_0x2b4ef9){if(_0x2b4ef9){return _0x2b4ef9?{'count':_0x562261,'rows':_0x2b4ef9}:null;}})[_0xfc0d('0x29')](respondWithResult(_0x435441,null))[_0xfc0d('0x60')](handleError(_0x435441,null));};exports[_0xfc0d('0xee')]=function(_0x481f88,_0x3f5c1a){var _0x191ab7={'raw':!![],'where':{}};var _0x5d2059={};var _0x2973b2={'count':0x0,'rows':[]};return db['User'][_0xfc0d('0x9c')]({'where':{'id':_0x481f88[_0xfc0d('0x54')]['id']}})[_0xfc0d('0x29')](handleEntityNotFound(_0x3f5c1a,null))['then'](function(_0x338a39){if(_0x338a39){_0x5d2059['model']=_[_0xfc0d('0x55')](db[_0xfc0d('0xef')]['rawAttributes']);_0x5d2059[_0xfc0d('0x45')]=_[_0xfc0d('0x55')](_0x481f88[_0xfc0d('0x45')]);_0x5d2059[_0xfc0d('0x57')]=_[_0xfc0d('0x58')](_0x5d2059[_0xfc0d('0x59')],_0x5d2059['query']);_0x191ab7[_0xfc0d('0x48')]=_[_0xfc0d('0x58')](_0x5d2059[_0xfc0d('0x59')],qs[_0xfc0d('0x5a')](_0x481f88[_0xfc0d('0x45')][_0xfc0d('0x5a')]));_0x191ab7[_0xfc0d('0x48')]=_0x191ab7[_0xfc0d('0x48')][_0xfc0d('0x4d')]?_0x191ab7[_0xfc0d('0x48')]:_0x5d2059[_0xfc0d('0x59')];if(!_0x481f88['query'][_0xfc0d('0xd4')](_0xfc0d('0xde'))){_0x191ab7[_0xfc0d('0x25')]=qs[_0xfc0d('0x25')](_0x481f88[_0xfc0d('0x45')][_0xfc0d('0x25')]);_0x191ab7[_0xfc0d('0x22')]=qs[_0xfc0d('0x22')](_0x481f88[_0xfc0d('0x45')]['offset']);}_0x191ab7[_0xfc0d('0xe0')]=qs['sort'](_0x481f88[_0xfc0d('0x45')]['sort']);_0x191ab7[_0xfc0d('0xdb')]=qs['filters'](_[_0xfc0d('0xe4')](_0x481f88[_0xfc0d('0x45')],_0x5d2059[_0xfc0d('0x57')]));_0x191ab7[_0xfc0d('0xdb')][_0xfc0d('0xe7')]=_0x338a39['id'];if(_0x481f88[_0xfc0d('0x45')]['filter']){_0x191ab7[_0xfc0d('0xdb')]=_[_0xfc0d('0x5c')](_0x191ab7[_0xfc0d('0xdb')],{'$or':_[_0xfc0d('0x8f')](_0x191ab7['attributes'],function(_0x52f634){var _0x245f4b={};_0x245f4b[_0x52f634]={'$like':'%'+_0x481f88[_0xfc0d('0x45')][_0xfc0d('0x35')]+'%'};return _0x245f4b;})});}_0x191ab7=_[_0xfc0d('0x5c')]({},_0x191ab7,_0x481f88[_0xfc0d('0x5d')]);return db[_0xfc0d('0xef')][_0xfc0d('0x24')]({'where':_0x191ab7[_0xfc0d('0xdb')]})[_0xfc0d('0x29')](function(_0x254735){_0x2973b2[_0xfc0d('0x24')]=_0x254735;if(_0x481f88[_0xfc0d('0x45')][_0xfc0d('0x5b')]){_0x191ab7['include']=[{'all':!![]}];}return db[_0xfc0d('0xef')][_0xfc0d('0x4a')](_0x191ab7);})[_0xfc0d('0x29')](function(_0x454474){_0x2973b2[_0xfc0d('0x4b')]=_0x454474;return _0x2973b2;});}})['then'](respondWithFilteredResult(_0x3f5c1a,_0x191ab7))[_0xfc0d('0x60')](handleError(_0x3f5c1a,null));};exports[_0xfc0d('0xf0')]=function(_0x3c9c62,_0x2139d9){var _0xb8862={};var _0x4b81ca={};var _0x1f4bcf;var _0x30af40;return db[_0xfc0d('0x3e')][_0xfc0d('0x9c')]({'where':{'id':_0x3c9c62[_0xfc0d('0x54')]['id']}})[_0xfc0d('0x29')](handleEntityNotFound(_0x2139d9,null))['then'](function(_0x130a4a){if(_0x130a4a){_0x1f4bcf=_0x130a4a;_0x4b81ca[_0xfc0d('0x59')]=_[_0xfc0d('0x55')](db[_0xfc0d('0xf1')][_0xfc0d('0x3f')]);_0x4b81ca[_0xfc0d('0x45')]=_[_0xfc0d('0x55')](_0x3c9c62[_0xfc0d('0x45')]);_0x4b81ca['filters']=_['intersection'](_0x4b81ca[_0xfc0d('0x59')],_0x4b81ca[_0xfc0d('0x45')]);_0xb8862[_0xfc0d('0x48')]=_[_0xfc0d('0x58')](_0x4b81ca[_0xfc0d('0x59')],qs['fields'](_0x3c9c62[_0xfc0d('0x45')][_0xfc0d('0x5a')]));_0xb8862[_0xfc0d('0x48')]=_0xb8862[_0xfc0d('0x48')][_0xfc0d('0x4d')]?_0xb8862[_0xfc0d('0x48')]:_0x4b81ca[_0xfc0d('0x59')];_0xb8862[_0xfc0d('0xe0')]=qs[_0xfc0d('0xda')](_0x3c9c62['query'][_0xfc0d('0xda')]);_0xb8862[_0xfc0d('0xdb')]=qs['filters'](_[_0xfc0d('0xe4')](_0x3c9c62['query'],_0x4b81ca[_0xfc0d('0x57')]));if(_0x3c9c62[_0xfc0d('0x45')][_0xfc0d('0x35')]){_0xb8862[_0xfc0d('0xdb')]=_[_0xfc0d('0x5c')](_0xb8862[_0xfc0d('0xdb')],{'$or':_[_0xfc0d('0x8f')](_0xb8862['attributes'],function(_0x81d0e4){var _0x434b21={};_0x434b21[_0x81d0e4]={'$like':'%'+_0x3c9c62[_0xfc0d('0x45')][_0xfc0d('0x35')]+'%'};return _0x434b21;})});}_0xb8862=_['merge']({},_0xb8862,_0x3c9c62[_0xfc0d('0x5d')]);return _0x1f4bcf[_0xfc0d('0xf0')](_0xb8862);}})[_0xfc0d('0x29')](function(_0x35d755){if(_0x35d755){_0x30af40=_0x35d755[_0xfc0d('0x4d')];if(!_0x3c9c62[_0xfc0d('0x45')][_0xfc0d('0xd4')](_0xfc0d('0xde'))){_0xb8862[_0xfc0d('0x25')]=qs[_0xfc0d('0x25')](_0x3c9c62[_0xfc0d('0x45')]['limit']);_0xb8862['offset']=qs[_0xfc0d('0x22')](_0x3c9c62[_0xfc0d('0x45')][_0xfc0d('0x22')]);}return _0x1f4bcf['getSmsInteractions'](_0xb8862);}})[_0xfc0d('0x29')](function(_0x2f20f0){if(_0x2f20f0){return _0x2f20f0?{'count':_0x30af40,'rows':_0x2f20f0}:null;}})[_0xfc0d('0x29')](respondWithResult(_0x2139d9,null))[_0xfc0d('0x60')](handleError(_0x2139d9,null));};exports['getFaxInteractions']=function(_0x2387f8,_0x535082){var _0x16969b={};var _0x3c33e8={};var _0x25e0d0;var _0x4f256b;return db[_0xfc0d('0x3e')][_0xfc0d('0x9c')]({'where':{'id':_0x2387f8[_0xfc0d('0x54')]['id']}})[_0xfc0d('0x29')](handleEntityNotFound(_0x535082,null))[_0xfc0d('0x29')](function(_0x433264){if(_0x433264){_0x25e0d0=_0x433264;_0x3c33e8[_0xfc0d('0x59')]=_[_0xfc0d('0x55')](db[_0xfc0d('0xf2')][_0xfc0d('0x3f')]);_0x3c33e8[_0xfc0d('0x45')]=_[_0xfc0d('0x55')](_0x2387f8['query']);_0x3c33e8[_0xfc0d('0x57')]=_[_0xfc0d('0x58')](_0x3c33e8['model'],_0x3c33e8['query']);_0x16969b[_0xfc0d('0x48')]=_[_0xfc0d('0x58')](_0x3c33e8['model'],qs['fields'](_0x2387f8[_0xfc0d('0x45')][_0xfc0d('0x5a')]));_0x16969b[_0xfc0d('0x48')]=_0x16969b[_0xfc0d('0x48')][_0xfc0d('0x4d')]?_0x16969b[_0xfc0d('0x48')]:_0x3c33e8[_0xfc0d('0x59')];_0x16969b['order']=qs[_0xfc0d('0xda')](_0x2387f8[_0xfc0d('0x45')][_0xfc0d('0xda')]);_0x16969b[_0xfc0d('0xdb')]=qs[_0xfc0d('0x57')](_[_0xfc0d('0xe4')](_0x2387f8['query'],_0x3c33e8[_0xfc0d('0x57')]));if(_0x2387f8[_0xfc0d('0x45')][_0xfc0d('0x35')]){_0x16969b[_0xfc0d('0xdb')]=_['merge'](_0x16969b['where'],{'$or':_[_0xfc0d('0x8f')](_0x16969b[_0xfc0d('0x48')],function(_0x2d6db4){var _0x503c1e={};_0x503c1e[_0x2d6db4]={'$like':'%'+_0x2387f8[_0xfc0d('0x45')]['filter']+'%'};return _0x503c1e;})});}_0x16969b=_['merge']({},_0x16969b,_0x2387f8[_0xfc0d('0x5d')]);return _0x25e0d0[_0xfc0d('0xf3')](_0x16969b);}})['then'](function(_0x1b0b8a){if(_0x1b0b8a){_0x4f256b=_0x1b0b8a['length'];if(!_0x2387f8[_0xfc0d('0x45')][_0xfc0d('0xd4')](_0xfc0d('0xde'))){_0x16969b[_0xfc0d('0x25')]=qs[_0xfc0d('0x25')](_0x2387f8['query'][_0xfc0d('0x25')]);_0x16969b['offset']=qs['offset'](_0x2387f8[_0xfc0d('0x45')][_0xfc0d('0x22')]);}return _0x25e0d0[_0xfc0d('0xf3')](_0x16969b);}})[_0xfc0d('0x29')](function(_0x529777){if(_0x529777){return _0x529777?{'count':_0x4f256b,'rows':_0x529777}:null;}})[_0xfc0d('0x29')](respondWithResult(_0x535082,null))[_0xfc0d('0x60')](handleError(_0x535082,null));};exports['getWhatsappInteractions']=function(_0x194adf,_0xed154d){var _0x48e6a1={};var _0x1466ac={};var _0x1e9151;var _0x50c171;return db[_0xfc0d('0x3e')]['findOne']({'where':{'id':_0x194adf[_0xfc0d('0x54')]['id']}})['then'](handleEntityNotFound(_0xed154d,null))[_0xfc0d('0x29')](function(_0x4c8358){if(_0x4c8358){_0x1e9151=_0x4c8358;_0x1466ac[_0xfc0d('0x59')]=_[_0xfc0d('0x55')](db['WhatsappInteraction'][_0xfc0d('0x3f')]);_0x1466ac[_0xfc0d('0x45')]=_[_0xfc0d('0x55')](_0x194adf[_0xfc0d('0x45')]);_0x1466ac[_0xfc0d('0x57')]=_[_0xfc0d('0x58')](_0x1466ac[_0xfc0d('0x59')],_0x1466ac[_0xfc0d('0x45')]);_0x48e6a1[_0xfc0d('0x48')]=_[_0xfc0d('0x58')](_0x1466ac[_0xfc0d('0x59')],qs[_0xfc0d('0x5a')](_0x194adf[_0xfc0d('0x45')][_0xfc0d('0x5a')]));_0x48e6a1[_0xfc0d('0x48')]=_0x48e6a1[_0xfc0d('0x48')][_0xfc0d('0x4d')]?_0x48e6a1[_0xfc0d('0x48')]:_0x1466ac[_0xfc0d('0x59')];_0x48e6a1[_0xfc0d('0xe0')]=qs[_0xfc0d('0xda')](_0x194adf['query'][_0xfc0d('0xda')]);_0x48e6a1[_0xfc0d('0xdb')]=qs[_0xfc0d('0x57')](_['pick'](_0x194adf[_0xfc0d('0x45')],_0x1466ac['filters']));if(_0x194adf[_0xfc0d('0x45')]['filter']){_0x48e6a1[_0xfc0d('0xdb')]=_['merge'](_0x48e6a1[_0xfc0d('0xdb')],{'$or':_['map'](_0x48e6a1[_0xfc0d('0x48')],function(_0x202a8d){var _0x1340b5={};_0x1340b5[_0x202a8d]={'$like':'%'+_0x194adf['query'][_0xfc0d('0x35')]+'%'};return _0x1340b5;})});}_0x48e6a1=_[_0xfc0d('0x5c')]({},_0x48e6a1,_0x194adf[_0xfc0d('0x5d')]);return _0x1e9151['getWhatsappInteractions'](_0x48e6a1);}})['then'](function(_0x2650cd){if(_0x2650cd){_0x50c171=_0x2650cd[_0xfc0d('0x4d')];if(!_0x194adf[_0xfc0d('0x45')]['hasOwnProperty']('nolimit')){_0x48e6a1[_0xfc0d('0x25')]=qs['limit'](_0x194adf[_0xfc0d('0x45')][_0xfc0d('0x25')]);_0x48e6a1[_0xfc0d('0x22')]=qs['offset'](_0x194adf[_0xfc0d('0x45')][_0xfc0d('0x22')]);}return _0x1e9151[_0xfc0d('0xf4')](_0x48e6a1);}})[_0xfc0d('0x29')](function(_0x43c6d5){if(_0x43c6d5){return _0x43c6d5?{'count':_0x50c171,'rows':_0x43c6d5}:null;}})[_0xfc0d('0x29')](respondWithResult(_0xed154d,null))[_0xfc0d('0x60')](handleError(_0xed154d,null));};exports[_0xfc0d('0xf5')]=function(_0x5992f2,_0x594b30,_0x455b26){var _0xbb853a;var _0x434a49;var _0x2f3045;var _0x763f42=!_[_0xfc0d('0x6b')](_0x5992f2[_0xfc0d('0x54')]['id'])?_0x5992f2[_0xfc0d('0x54')]['id']:!_[_0xfc0d('0x6b')](_0x5992f2[_0xfc0d('0x31')]['id'])?_0x5992f2[_0xfc0d('0x31')]['id']:null;return db[_0xfc0d('0x3e')]['find']({'where':{'id':_0x763f42,'role':{'$or':[_0xfc0d('0x84'),_0xfc0d('0x31'),'agent']}},'attributes':['id',_0xfc0d('0x3a'),_0xfc0d('0xf6'),_0xfc0d('0xf7'),_0xfc0d('0x2a'),'internal','loginInPause']})[_0xfc0d('0x29')](function(_0x3899fb){if(_0x3899fb){if(_0x3899fb[_0xfc0d('0x2a')]===_0xfc0d('0x2b')){_0xbb853a=_0x3899fb;if(_0x5992f2[_0xfc0d('0x61')][_0xfc0d('0xa5')]){_0x2f3045=util['format'](_0xfc0d('0xf8'),_0xbb853a[_0x5992f2[_0xfc0d('0x61')][_0xfc0d('0xa5')]]);}else if(_0x5992f2['body']['intrf']){_0x2f3045=util[_0xfc0d('0xb0')](_0xfc0d('0xb1'),_0x5992f2[_0xfc0d('0x61')]['intrf']);}else{_0x2f3045=util['format'](_0xfc0d('0xb1'),_0xbb853a[_0xfc0d('0x3a')]);}socket['to'](util[_0xfc0d('0xb0')](_0xfc0d('0xf9'),_0xbb853a[_0xfc0d('0x3a')]))[_0xfc0d('0x2c')](_0xfc0d('0xfa'),{'user':{'id':_0xbb853a['id'],'name':_0xbb853a[_0xfc0d('0x3a')]},'ip':_0x5992f2['headers']['x-forwarded-for']||_0x5992f2[_0xfc0d('0xfb')][_0xfc0d('0xfc')]||_0x5992f2[_0xfc0d('0xfd')][_0xfc0d('0xfc')]||_0x5992f2[_0xfc0d('0xfb')][_0xfc0d('0xfd')]['remoteAddress']});return db[_0xfc0d('0xb2')][_0xfc0d('0x2e')]({'where':{'membername':_0xbb853a[_0xfc0d('0x3a')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0xfc0d('0x97'))](_0xfc0d('0xfe'));}})[_0xfc0d('0x29')](function(){if(_0xbb853a){return _0xbb853a['getVoiceQueues']({'raw':!![]});}})[_0xfc0d('0x29')](function(_0x1b0c0d){if(_0xbb853a){if(_0x1b0c0d){_0x434a49=_0x1b0c0d;if(_0x434a49['length']){var _0x3ff300=_0x434a49[_0xfc0d('0x8f')](function(_0x3532c3){var _0x402ef7={'membername':_0xbb853a[_0xfc0d('0x3a')],'UserId':_0xbb853a['id'],'queue_name':_0x3532c3[_0xfc0d('0x3a')],'VoiceQueueId':_0x3532c3['id'],'interface':_0x2f3045,'paused':_0xbb853a[_0xfc0d('0xa3')]||![],'penalty':_0x3532c3['UserVoiceQueue.penalty']||0x0};return db['UserVoiceQueueRt']['upsert'](_0x402ef7);});return Promise[_0xfc0d('0x52')](_0x3ff300);}}}})['then'](function(){if(_0xbb853a){return db[_0xfc0d('0xff')][_0xfc0d('0x4a')]({'where':{'membername':_0xbb853a['name'],'exitAt':null}});}})[_0xfc0d('0x29')](function(_0x12fbcd){if(_0xbb853a){var _0x4aee6c=[];_0x12fbcd[_0xfc0d('0x100')](function(_0x1c2a92){_0x4aee6c[_0xfc0d('0x49')](_0x1c2a92[_0xfc0d('0x28')]({'exitAt':moment()[_0xfc0d('0xb0')](_0xfc0d('0x101'))}));});return Promise['all'](_0x4aee6c);}})['then'](function(){if(_0xbb853a){var _0x4348df=[];var _0x5dcec6=[];var _0x29beb9=utils[_0xfc0d('0x102')]();var _0x10ad52={'membername':_0xbb853a[_0xfc0d('0x3a')],'interface':_0x2f3045,'enterAt':moment()[_0xfc0d('0xb0')](_0xfc0d('0x101')),'role':_0xbb853a['role'],'internal':_0xbb853a[_0xfc0d('0x69')]};_0x29beb9[_0xfc0d('0x100')](function(_0x53c119){_0x4348df['push'](_[_0xfc0d('0x5c')]({'channel':_0x53c119,'type':_0xfc0d('0x103'),'data1':_0x5992f2[_0xfc0d('0x61')][_0xfc0d('0x104')],'data2':_0x2f3045},_0x10ad52));if(_0xbb853a[_0xfc0d('0xa3')]){_0x5dcec6['push'](_['merge']({'channel':_0x53c119,'type':_0xfc0d('0x105'),'data1':_0xfc0d('0x106')},_0x10ad52));}});return db[_0xfc0d('0xff')]['bulkCreate'](_0x4348df[_0xfc0d('0xd1')](_0x5dcec6),{'individualHooks':!![]});}})['then'](function(){if(_0xbb853a){return _0xbb853a[_0xfc0d('0x28')]({'online':!![],'lastLoginAt':moment()[_0xfc0d('0xb0')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0xbb853a[_0xfc0d('0xa3')]||![],'mailPause':_0xbb853a[_0xfc0d('0xa3')]||![],'chatPause':_0xbb853a[_0xfc0d('0xa3')]||![],'faxPause':_0xbb853a[_0xfc0d('0xa3')]||![],'smsPause':_0xbb853a['loginInPause']||![],'openchannelPause':_0xbb853a[_0xfc0d('0xa3')]||![],'whatsappPause':_0xbb853a[_0xfc0d('0xa3')]||![],'pauseType':_0xbb853a[_0xfc0d('0xa3')]?_0xfc0d('0x106'):null,'interface':_0x2f3045,'lastPauseAt':moment()[_0xfc0d('0xb0')](_0xfc0d('0x101'))});}})[_0xfc0d('0x29')](function(_0x5f3be9){if(_0x5992f2[_0xfc0d('0x107')]){return _0x455b26();}else{return Promise[_0xfc0d('0x108')](_0x5f3be9)['then'](respondWithResult(_0x594b30,null));}})[_0xfc0d('0x60')](handleError(_0x594b30,null));};exports[_0xfc0d('0x109')]=function(_0x2b5dab,_0xe113b7){var _0x1d2b81;return db[_0xfc0d('0x3e')][_0xfc0d('0x39')]({'where':{'id':_0x2b5dab[_0xfc0d('0x54')]['id'],'role':_0xfc0d('0x2b')},'attributes':['id','name','role']})[_0xfc0d('0x29')](handleEntityNotFound(_0xe113b7,null))[_0xfc0d('0x29')](function(_0xe615bc){if(_0xe615bc){_0x1d2b81=_0xe615bc;return db[_0xfc0d('0xb2')][_0xfc0d('0x2e')]({'where':{'membername':_0x1d2b81[_0xfc0d('0x3a')]},'individualHooks':!![]});}})[_0xfc0d('0x29')](function(){return db[_0xfc0d('0xff')][_0xfc0d('0x4a')]({'where':{'membername':_0x1d2b81[_0xfc0d('0x3a')],'exitAt':null}});})[_0xfc0d('0x29')](function(_0x56ad69){var _0x5368c8=[];_0x56ad69[_0xfc0d('0x100')](function(_0x29ce36){_0x5368c8[_0xfc0d('0x49')](_0x29ce36[_0xfc0d('0x28')]({'exitAt':moment()[_0xfc0d('0xb0')](_0xfc0d('0x101'))}));});return Promise[_0xfc0d('0x52')](_0x5368c8);})[_0xfc0d('0x29')](function(){return _0x1d2b81[_0xfc0d('0x28')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xfc0d('0x29')](respondWithResult(_0xe113b7,null))['catch'](handleError(_0xe113b7,null));};exports[_0xfc0d('0x10a')]=function(_0x57fc46,_0x504adc){var _0x1417e7;return db[_0xfc0d('0xb2')][_0xfc0d('0x28')]({'paused':0x1},{'where':{'UserId':_0x57fc46[_0xfc0d('0x54')]['id']},'individualHooks':!![]})[_0xfc0d('0x29')](function(){return db[_0xfc0d('0x3e')]['find']({'where':{'id':_0x57fc46['params']['id'],'role':_0xfc0d('0x2b')},'attributes':['id',_0xfc0d('0x3a'),_0xfc0d('0x2a'),_0xfc0d('0x69'),'interface',_0xfc0d('0xa2')]});})[_0xfc0d('0x29')](handleEntityNotFound(_0x504adc,null))[_0xfc0d('0x29')](function(_0x46f87f){if(_0x46f87f){_0x1417e7=_0x46f87f;return respondWithRpcPromise(_0xfc0d('0x10b'),'pause',{'id':_0x1417e7['id'],'name':_0x1417e7[_0xfc0d('0x3a')],'pause':!![]});}})['then'](function(){if(_0x1417e7){return db['MemberReport'][_0xfc0d('0x4a')]({'where':{'membername':_0x1417e7[_0xfc0d('0x3a')],'type':'PAUSE','exitAt':null}});}})[_0xfc0d('0x29')](function(_0x4d583f){if(_0x4d583f[_0xfc0d('0x4d')]){var _0x5e0fc5=moment()[_0xfc0d('0xb0')](_0xfc0d('0x101'));for(var _0x17bde7=0x0,_0x5b77e8=_0x4d583f[_0xfc0d('0x4d')];_0x17bde7<_0x5b77e8;_0x17bde7++){_0x4d583f[_0x17bde7]['updateAttributes']({'exitAt':_0x5e0fc5});}}})['then'](function(){var _0x40de4f=[];var _0x351e1d=utils['getChannels']();_0x351e1d[_0xfc0d('0x100')](function(_0x16d44d){_0x40de4f[_0xfc0d('0x49')]({'channel':_0x16d44d,'membername':_0x1417e7[_0xfc0d('0x3a')],'interface':_[_0xfc0d('0x6b')](_0x1417e7['interface'])?util[_0xfc0d('0xb0')]('SIP/%s',_0x1417e7[_0xfc0d('0x3a')]):_0x1417e7[_0xfc0d('0xa5')],'type':'PAUSE','enterAt':moment()[_0xfc0d('0xb0')](_0xfc0d('0x101')),'data1':_0x57fc46[_0xfc0d('0x61')][_0xfc0d('0x10c')]||_0xfc0d('0x10d'),'role':_0x1417e7[_0xfc0d('0x2a')],'internal':_0x1417e7['internal']});});return db[_0xfc0d('0xff')][_0xfc0d('0x8c')](_0x40de4f,{'individualHooks':!![]});})[_0xfc0d('0x29')](function(){return _0x1417e7['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x57fc46[_0xfc0d('0x61')]['type']||_0xfc0d('0x10d'),'lastPauseAt':moment()[_0xfc0d('0xb0')](_0xfc0d('0x101'))});})[_0xfc0d('0x29')](respondWithResult(_0x504adc,null))[_0xfc0d('0x60')](handleError(_0x504adc,null));};exports['unpause']=function(_0x23ede1,_0x1a6f1e){if(_0x23ede1[_0xfc0d('0x61')]['channel']&&!utils[_0xfc0d('0xa6')](_0x23ede1[_0xfc0d('0x61')][_0xfc0d('0xb5')])){throw new APIBadRequestError(util['format'](_0xfc0d('0x10e'),_0x23ede1[_0xfc0d('0x61')][_0xfc0d('0xb5')]));}return db[_0xfc0d('0x3e')]['find']({'where':{'id':_0x23ede1[_0xfc0d('0x54')]['id']},'attributes':['id','name',_0xfc0d('0x2a'),_0xfc0d('0x69'),_0xfc0d('0xa5'),_0xfc0d('0xa2'),_0xfc0d('0xa4'),_0xfc0d('0x10f'),_0xfc0d('0x110'),_0xfc0d('0x111'),_0xfc0d('0x112'),_0xfc0d('0x113'),_0xfc0d('0x114'),_0xfc0d('0x115'),_0xfc0d('0x116')]})[_0xfc0d('0x29')](function(_0x466bcb){if(!_0x466bcb){throw new APINotFoundError(util[_0xfc0d('0xb0')]('User\x20with\x20id\x20%s\x20not\x20found',_0x23ede1[_0xfc0d('0x54')]['id']));}return _0x466bcb[_0xfc0d('0x117')](_0x23ede1[_0xfc0d('0x61')][_0xfc0d('0xb5')]);})['then'](respondWithResult(_0x1a6f1e,null))[_0xfc0d('0x60')](APIHandleError(_0x1a6f1e));};exports[_0xfc0d('0x118')]=function(_0x36ea9d,_0x1b38d9){var _0x1a9a83={};var _0x155bfe={};var _0x15b56a;var _0x50e1b5;return db[_0xfc0d('0x3e')][_0xfc0d('0x9c')]({'where':{'id':_0x36ea9d[_0xfc0d('0x54')]['id']}})[_0xfc0d('0x29')](handleEntityNotFound(_0x1b38d9,null))['then'](function(_0x5863bc){if(_0x5863bc){_0x15b56a=_0x5863bc;_0x155bfe['model']=_[_0xfc0d('0x55')](db[_0xfc0d('0x119')][_0xfc0d('0x3f')]);_0x155bfe['query']=_['keys'](_0x36ea9d[_0xfc0d('0x45')]);_0x155bfe[_0xfc0d('0x57')]=_[_0xfc0d('0x58')](_0x155bfe[_0xfc0d('0x59')],_0x155bfe[_0xfc0d('0x45')]);_0x1a9a83[_0xfc0d('0x48')]=_['intersection'](_0x155bfe['model'],qs[_0xfc0d('0x5a')](_0x36ea9d[_0xfc0d('0x45')][_0xfc0d('0x5a')]));_0x1a9a83[_0xfc0d('0x48')]=_0x1a9a83[_0xfc0d('0x48')][_0xfc0d('0x4d')]?_0x1a9a83[_0xfc0d('0x48')]:_0x155bfe[_0xfc0d('0x59')];_0x1a9a83['order']=qs[_0xfc0d('0xda')](_0x36ea9d[_0xfc0d('0x45')]['sort']);_0x1a9a83[_0xfc0d('0xdb')]=qs[_0xfc0d('0x57')](_[_0xfc0d('0xe4')](_0x36ea9d[_0xfc0d('0x45')],_0x155bfe[_0xfc0d('0x57')]));if(_0x36ea9d['query'][_0xfc0d('0x35')]){_0x1a9a83[_0xfc0d('0xdb')]=_[_0xfc0d('0x5c')](_0x1a9a83[_0xfc0d('0xdb')],{'$or':_[_0xfc0d('0x8f')](_0x1a9a83[_0xfc0d('0x48')],function(_0x470c23){var _0x370ec0={};_0x370ec0[_0x470c23]={'$like':'%'+_0x36ea9d[_0xfc0d('0x45')]['filter']+'%'};return _0x370ec0;})});}_0x1a9a83=_['merge']({},_0x1a9a83,_0x36ea9d[_0xfc0d('0x5d')]);return _0x15b56a[_0xfc0d('0x118')](_0x1a9a83);}})[_0xfc0d('0x29')](function(_0x8ec49f){if(_0x8ec49f){_0x50e1b5=_0x8ec49f['length'];if(!_0x36ea9d['query'][_0xfc0d('0xd4')](_0xfc0d('0xde'))){_0x1a9a83[_0xfc0d('0x25')]=qs['limit'](_0x36ea9d[_0xfc0d('0x45')][_0xfc0d('0x25')]);_0x1a9a83[_0xfc0d('0x22')]=qs[_0xfc0d('0x22')](_0x36ea9d['query'][_0xfc0d('0x22')]);}return _0x15b56a[_0xfc0d('0x118')](_0x1a9a83);}})['then'](function(_0x4327e4){if(_0x4327e4){return _0x4327e4?{'count':_0x50e1b5,'rows':_0x4327e4}:null;}})[_0xfc0d('0x29')](respondWithResult(_0x1b38d9,null))[_0xfc0d('0x60')](handleError(_0x1b38d9,null));};exports[_0xfc0d('0x11a')]=function(_0x1b0b81,_0x452f5a){var _0x11ba27=_0x1b0b81[_0xfc0d('0x54')]['id'];var _0xefe7ce=_0x1b0b81['body']?_0x1b0b81[_0xfc0d('0x61')][_0xfc0d('0x64')]:null;var _0x48ee6e=[];return Promise['resolve']()[_0xfc0d('0x29')](function(){if(!_0xefe7ce)throw new APIBadRequestError(_0xfc0d('0x11b'));})[_0xfc0d('0x29')](function(){return db[_0xfc0d('0x3e')]['findOne']({'where':{'id':_0x11ba27}});})[_0xfc0d('0x29')](function(_0x8f4095){if(!_0x8f4095)throw new APINotFoundError(util['format'](_0xfc0d('0xd3'),_0x1b0b81[_0xfc0d('0x54')]['id']));return db[_0xfc0d('0x6d')]['transaction'](function(_0x4aee37){return _0x8f4095[_0xfc0d('0x11a')](_0xefe7ce,{'transaction':_0x4aee37})['then'](function(){return db[_0xfc0d('0x119')][_0xfc0d('0x4a')]({'where':{'id':{'$in':_0xefe7ce}}});})[_0xfc0d('0x29')](function(_0x4c4666){var _0x3084f3=_[_0xfc0d('0x8f')](_0x4c4666,function(_0x4ae432){return _0x4ae432[_0xfc0d('0x11c')]();});return Promise[_0xfc0d('0x52')](_0x3084f3);})[_0xfc0d('0x29')](function(_0x1e381c){_0x48ee6e=_[_0xfc0d('0x11d')](_0x1e381c);var _0x88865e=_[_0xfc0d('0x8f')](_0x48ee6e,function(_0x5985bf){return _0x5985bf[_0xfc0d('0x11e')](_0x8f4095['id'],{'transaction':_0x4aee37});});return Promise[_0xfc0d('0x52')](_0x88865e);})['then'](function(){if(!_0x8f4095[_0xfc0d('0xa2')])return;var _0x163193=_[_0xfc0d('0x35')](_0x48ee6e,function(_0x2375c6){return _0x2375c6['getDataValue'](_0xfc0d('0xb5'))===_0xfc0d('0x11f');});var _0x91dd4e=_[_0xfc0d('0x8f')](_0x163193,function(_0x205d5b){return db['UserVoiceQueueRt']['upsert']({'membername':_0x8f4095[_0xfc0d('0x3a')],'UserId':_0x8f4095['id'],'queue_name':_0x205d5b[_0xfc0d('0x3a')],'VoiceQueueId':_0x205d5b['id'],'interface':_[_0xfc0d('0x6b')](_0x8f4095[_0xfc0d('0xa5')])?util['format'](_0xfc0d('0xb1'),_0x8f4095[_0xfc0d('0x3a')]):_0x8f4095[_0xfc0d('0xa5')],'paused':_0x8f4095[_0xfc0d('0xa4')]||![],'penalty':_0x8f4095['penalty']},{'transaction':_0x4aee37});});return Promise[_0xfc0d('0x52')](_0x91dd4e);})['then'](function(){return db[_0xfc0d('0x120')][_0xfc0d('0x4a')]({'where':{'teamId':{'$in':_0xefe7ce}}});})['then'](function(_0x4e7430){var _0x4ec80b=_[_0xfc0d('0x8f')](_0x4e7430,function(_0x26890c){return db[_0xfc0d('0x121')]['create']({'UserId':_0x8f4095['id'],'VoicePrefixId':_0x26890c['VoicePrefixId']},{'transaction':_0x4aee37});});return Promise[_0xfc0d('0x52')](_0x4ec80b);});});})['then'](function(){for(var _0x244fb7=0x0;_0x244fb7<_0x48ee6e['length'];_0x244fb7++){var _0x386dfc=_0x48ee6e[_0x244fb7][_0xfc0d('0x122')](_0xfc0d('0xb5'));var _0xfe6599=_0x386dfc+_0xfc0d('0xad');socket[_0xfc0d('0x2c')](_0xfc0d('0x31')+_0x386dfc+_0xfc0d('0xae'),{'UserId':_0x11ba27,['queueField']:_0x48ee6e[_0x244fb7]['id']});}})['then'](respondWithStatusCode(_0x452f5a,null))[_0xfc0d('0x60')](APIHandleError(_0x452f5a));};exports[_0xfc0d('0x123')]=function(_0x1a454f,_0x458d07){var _0x5b79fa=_0x1a454f['params']['id'];var _0x307cd3=null;if(_0x1a454f['query']['ids']){_0x307cd3=_['isArray'](_0x1a454f[_0xfc0d('0x45')][_0xfc0d('0x64')])?_0x1a454f['query'][_0xfc0d('0x64')]:[_0x1a454f[_0xfc0d('0x45')][_0xfc0d('0x64')]];}var _0x13d610=[];return Promise[_0xfc0d('0x108')]()[_0xfc0d('0x29')](function(){if(!_0x307cd3)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0xfc0d('0x29')](function(){return db[_0xfc0d('0x3e')]['findOne']({'where':{'id':_0x5b79fa}});})['then'](function(_0x1b7645){if(!_0x1b7645)throw new APINotFoundError(util[_0xfc0d('0xb0')]('User\x20with\x20id\x20%s\x20not\x20found',_0x1a454f['params']['id']));return db[_0xfc0d('0x6d')]['transaction'](function(_0x5d2c49){return _0x1b7645[_0xfc0d('0x123')](_0x307cd3,{'transaction':_0x5d2c49})['then'](function(){return db[_0xfc0d('0x119')][_0xfc0d('0x4a')]({'where':{'id':{'$in':_0x307cd3}}});})[_0xfc0d('0x29')](function(_0x1e838e){var _0x49d2be=_[_0xfc0d('0x8f')](_0x1e838e,function(_0x3a835b){return _0x3a835b['getAssociatedQueues']();});return Promise[_0xfc0d('0x52')](_0x49d2be);})[_0xfc0d('0x29')](function(_0x38edf2){_0x13d610=_[_0xfc0d('0x11d')](_0x38edf2);var _0x44c628=_['map'](_0x13d610,function(_0x8c68a6){return _0x8c68a6[_0xfc0d('0x124')](_0x1b7645['id'],{'transaction':_0x5d2c49});});return Promise[_0xfc0d('0x52')](_0x44c628);})['then'](function(){if(!_0x1b7645['online'])return;var _0x1f7985=_[_0xfc0d('0x35')](_0x13d610,function(_0x239140){return _0x239140[_0xfc0d('0x122')](_0xfc0d('0xb5'))===_0xfc0d('0x11f');});var _0x4d87a3=_['map'](_0x1f7985,function(_0xc3c4d7){return db[_0xfc0d('0xb2')][_0xfc0d('0x2e')]({'where':{'VoiceQueueId':_0xc3c4d7['id'],'UserId':_0x1b7645['id']},'transaction':_0x5d2c49});});return Promise[_0xfc0d('0x52')](_0x4d87a3);})[_0xfc0d('0x29')](function(){return db[_0xfc0d('0x120')]['findAll']({'where':{'teamId':{'$in':_0x307cd3}}});})[_0xfc0d('0x29')](function(_0x478795){var _0x4f5e21=_[_0xfc0d('0x8f')](_0x478795,function(_0x3f1d62){return db['UserVoicePrefix'][_0xfc0d('0x2e')]({'where':{'UserId':_0x1b7645['id'],'VoicePrefixId':_0x3f1d62[_0xfc0d('0x125')]}},{'transaction':_0x5d2c49});});return Promise[_0xfc0d('0x52')](_0x4f5e21);});});})['then'](function(){for(var _0x36269d=0x0;_0x36269d<_0x13d610[_0xfc0d('0x4d')];_0x36269d++){var _0x3dbbd2=_0x13d610[_0x36269d][_0xfc0d('0x122')](_0xfc0d('0xb5'));var _0x1af1e2=_0x3dbbd2+_0xfc0d('0xad');socket[_0xfc0d('0x2c')](_0xfc0d('0x31')+_0x3dbbd2+_0xfc0d('0x126'),{'UserId':_0x5b79fa,['queueField']:_0x13d610[_0x36269d]['id']});}})[_0xfc0d('0x29')](respondWithStatusCode(_0x458d07,null))[_0xfc0d('0x60')](APIHandleError(_0x458d07));};exports[_0xfc0d('0x127')]=function(_0x8a0012,_0x3affe9){var _0x2da031={};var _0x10fbc7={};var _0x150823;var _0x2107c3;return db[_0xfc0d('0x3e')]['findOne']({'where':{'id':_0x8a0012[_0xfc0d('0x54')]['id']}})[_0xfc0d('0x29')](handleEntityNotFound(_0x3affe9,null))[_0xfc0d('0x29')](function(_0x26b315){if(_0x26b315){_0x150823=_0x26b315;_0x10fbc7[_0xfc0d('0x59')]=_[_0xfc0d('0x55')](db['CmList']['rawAttributes']);_0x10fbc7[_0xfc0d('0x45')]=_['keys'](_0x8a0012[_0xfc0d('0x45')]);_0x10fbc7[_0xfc0d('0x57')]=_[_0xfc0d('0x58')](_0x10fbc7[_0xfc0d('0x59')],_0x10fbc7[_0xfc0d('0x45')]);_0x2da031['attributes']=_[_0xfc0d('0x58')](_0x10fbc7[_0xfc0d('0x59')],qs[_0xfc0d('0x5a')](_0x8a0012[_0xfc0d('0x45')]['fields']));_0x2da031['attributes']=_0x2da031[_0xfc0d('0x48')][_0xfc0d('0x4d')]?_0x2da031[_0xfc0d('0x48')]:_0x10fbc7[_0xfc0d('0x59')];_0x2da031['order']=qs[_0xfc0d('0xda')](_0x8a0012[_0xfc0d('0x45')]['sort']);_0x2da031[_0xfc0d('0xdb')]=qs[_0xfc0d('0x57')](_[_0xfc0d('0xe4')](_0x8a0012[_0xfc0d('0x45')],_0x10fbc7[_0xfc0d('0x57')]));if(_0x8a0012[_0xfc0d('0x45')][_0xfc0d('0x35')]){_0x2da031['where']=_['merge'](_0x2da031[_0xfc0d('0xdb')],{'$or':_[_0xfc0d('0x8f')](_0x2da031[_0xfc0d('0x48')],function(_0x54167e){var _0x3e228b={};_0x3e228b[_0x54167e]={'$like':'%'+_0x8a0012['query']['filter']+'%'};return _0x3e228b;})});}_0x2da031=_[_0xfc0d('0x5c')]({},_0x2da031,_0x8a0012[_0xfc0d('0x5d')]);return _0x150823[_0xfc0d('0x127')](_0x2da031);}})['then'](function(_0x142b66){if(_0x142b66){_0x2107c3=_0x142b66[_0xfc0d('0x4d')];if(!_0x8a0012['query']['hasOwnProperty'](_0xfc0d('0xde'))){_0x2da031['limit']=qs[_0xfc0d('0x25')](_0x8a0012[_0xfc0d('0x45')][_0xfc0d('0x25')]);_0x2da031[_0xfc0d('0x22')]=qs['offset'](_0x8a0012[_0xfc0d('0x45')][_0xfc0d('0x22')]);}return _0x150823[_0xfc0d('0x127')](_0x2da031);}})[_0xfc0d('0x29')](function(_0x1359a0){if(_0x1359a0){return _0x1359a0?{'count':_0x2107c3,'rows':_0x1359a0}:null;}})[_0xfc0d('0x29')](respondWithResult(_0x3affe9,null))[_0xfc0d('0x60')](handleError(_0x3affe9,null));};exports[_0xfc0d('0x128')]=function(_0x5d80c3,_0x421111){var _0x58a15b={};var _0x5819cd={};var _0x5339e7;return db[_0xfc0d('0x3e')][_0xfc0d('0x9c')]({'where':{'id':_0x5d80c3[_0xfc0d('0x54')]['id']}})[_0xfc0d('0x29')](handleEntityNotFound(_0x421111,null))[_0xfc0d('0x29')](function(_0x4d54b6){if(_0x4d54b6){_0x5339e7=_0x4d54b6;_0x5819cd[_0xfc0d('0x59')]=_[_0xfc0d('0x55')](db[_0xfc0d('0x3e')][_0xfc0d('0x3f')]);_0x5819cd['query']=_['keys'](_0x5d80c3[_0xfc0d('0x45')]);_0x5819cd[_0xfc0d('0x57')]=_[_0xfc0d('0x58')](_0x5819cd[_0xfc0d('0x59')],_0x5819cd[_0xfc0d('0x45')]);_0x58a15b[_0xfc0d('0x48')]=_['intersection'](_0x5819cd[_0xfc0d('0x59')],qs[_0xfc0d('0x5a')](_0x5d80c3[_0xfc0d('0x45')][_0xfc0d('0x5a')]));_0x58a15b[_0xfc0d('0x48')]=_0x58a15b['attributes'][_0xfc0d('0x4d')]?_0x58a15b[_0xfc0d('0x48')]:_0x5819cd[_0xfc0d('0x59')];_0x58a15b['order']=qs[_0xfc0d('0xda')](_0x5d80c3['query']['sort']);_0x58a15b[_0xfc0d('0xdb')]=qs['filters'](_[_0xfc0d('0xe4')](_0x5d80c3['query'],_0x5819cd['filters']));if(_0x5d80c3[_0xfc0d('0x45')]['filter']){_0x58a15b[_0xfc0d('0xdb')]=_[_0xfc0d('0x5c')](_0x58a15b[_0xfc0d('0xdb')],{'$or':_[_0xfc0d('0x8f')](_0x58a15b['attributes'],function(_0x54f09e){var _0x1d1289={};_0x1d1289[_0x54f09e]={'$like':'%'+_0x5d80c3['query']['filter']+'%'};return _0x1d1289;})});}_0x58a15b[_0xfc0d('0x59')]=db[_0xfc0d('0x3e')];_0x58a15b['as']=_0xfc0d('0x32');_0x58a15b=_['merge']({},_0x58a15b,_0x5d80c3[_0xfc0d('0x5d')]);return _0x5339e7[_0xfc0d('0x129')]({'include':[_0x58a15b]});}})[_0xfc0d('0x29')](function(_0x3fbfd7){if(_0x3fbfd7){var _0x169d60={},_0x3954b8=[];for(var _0x29d37e=0x0;_0x29d37e<_0x3fbfd7['length'];_0x29d37e+=0x1){for(var _0x5bb220=0x0,_0x344cce;_0x5bb220<_0x3fbfd7[_0x29d37e][_0xfc0d('0x32')]['length'];_0x5bb220+=0x1){_0x344cce=_0x3fbfd7[_0x29d37e][_0xfc0d('0x32')][_0x5bb220]['get']({'plain':!![]});_0x169d60[_0x344cce['id']]=_0x344cce;}}_0x169d60=_['values'](_0x169d60);for(var _0x3cdbfe=qs['offset'](_0x5d80c3[_0xfc0d('0x45')][_0xfc0d('0x22')]);_0x3cdbfe<_0x169d60[_0xfc0d('0x4d')]&&_0x3954b8[_0xfc0d('0x4d')]=_0x59777b){_0x1bc7f4=_0x59777b;_0x3947ba=0xc8;}else{_0x3947ba=0xce;}_0xff48d1['status'](_0x3947ba);return _0xff48d1[_0xe8e7('0x22')](_0xe8e7('0x23'),_0x9b04b4+'-'+_0x1bc7f4+'/'+_0x59777b)[_0xe8e7('0x24')](_0x4716af);}return null;};}function saveUpdates(_0x47bec1){return function(_0x5da6bf){if(_0x5da6bf){return _0x5da6bf['update'](_0x47bec1)[_0xe8e7('0x25')](function(_0x5dbe0e){if(_0x5dbe0e[_0xe8e7('0x26')]===_0xe8e7('0x27')){socket[_0xe8e7('0x28')](_0xe8e7('0x29')+_0x5dbe0e['id'],_0x5dbe0e);}return _0x5dbe0e;});}return null;};}function removeEntity(_0xb4bcec){return function(_0x24fe81){if(_0x24fe81){return _0x24fe81[_0xe8e7('0x2a')]()[_0xe8e7('0x25')](function(){var _0x506b6b=_0x24fe81[_0xe8e7('0x2b')]({'plain':!![]});if(_0x506b6b[_0xe8e7('0x26')]===_0xe8e7('0x2c'))return;var _0x459651=[{'name':_0xe8e7('0x2d'),'value':_0xe8e7('0x2e'),'ignore':!![]},{'name':_0xe8e7('0x2f'),'value':_0xe8e7('0x27'),'ignore':![]},{'name':_0xe8e7('0x30'),'value':'telephone','ignore':![]}];var _0x4d81c3=_(_0x459651)[_0xe8e7('0x31')](_0xe8e7('0x32'))[_0xe8e7('0x33')](_0xe8e7('0x34'))['value']();if(_[_0xe8e7('0x35')](_0x4d81c3,_0x506b6b['role'])){return;}var _0x536e4b=_[_0xe8e7('0x36')](_0x459651,[_0xe8e7('0x34'),_0x506b6b[_0xe8e7('0x26')]])['name'];return db[_0xe8e7('0x37')]['destroy']({'where':{'type':_0x536e4b,'resourceId':_0x506b6b['id']}})[_0xe8e7('0x25')](function(){return _0x24fe81;});})[_0xe8e7('0x25')](function(){_0xb4bcec[_0xe8e7('0x1d')](0xcc)[_0xe8e7('0x1e')]();});}};}function handleEntityNotFound(_0x5e4947){return function(_0x45e2cd){if(!_0x45e2cd){_0x5e4947[_0xe8e7('0x1c')](0x194);}return _0x45e2cd;};}function handleError(_0x4247c4,_0xccc623){_0xccc623=_0xccc623||0x1f4;return function(_0x3cdafb){logger[_0xe8e7('0x17')](_0x3cdafb[_0xe8e7('0x38')]);if(_0x3cdafb[_0xe8e7('0x39')]){delete _0x3cdafb[_0xe8e7('0x39')];}_0x4247c4[_0xe8e7('0x1d')](_0xccc623)[_0xe8e7('0x3a')](_0x3cdafb);};}exports['index']=function(_0x5f20e7,_0x53755d){var _0x35986d={},_0x299834={'count':0x0,'rows':[]};var _0x5d7202=_(db['User']['rawAttributes'])[_0xe8e7('0x33')](function(_0x4da139){return{'name':_0x4da139[_0xe8e7('0x3b')],'type':_0x4da139[_0xe8e7('0x3c')][_0xe8e7('0x3d')]};})[_0xe8e7('0x31')](function(_0x4745bb){return!_[_0xe8e7('0x35')]([_0xe8e7('0x3e'),_0xe8e7('0x3f')],_0x4745bb[_0xe8e7('0x39')]);})['value']();_0x35986d=qs['getOptions'](_0x5d7202,_0x5f20e7);var _0x3cb44a={'where':_0x35986d[_0xe8e7('0x40')]};return db[_0xe8e7('0x41')][_0xe8e7('0x20')](_0x3cb44a)[_0xe8e7('0x25')](function(_0x245fa2){_0x299834['count']=_0x245fa2;if(_0x5f20e7[_0xe8e7('0x42')]['includeAll']){_0x35986d['include']=[{'all':!![]}];}if(_0x5f20e7[_0xe8e7('0x42')]['userSetting']===_0xe8e7('0x43')){_0x35986d[_0xe8e7('0x44')]=[{'model':db[_0xe8e7('0x45')],'as':_0xe8e7('0x46')}];}if(!_[_0xe8e7('0x35')](_0x35986d[_0xe8e7('0x47')],'id')){_0x35986d['attributes'][_0xe8e7('0x48')]('id');}return db['User'][_0xe8e7('0x49')](_0x35986d);})[_0xe8e7('0x25')](function(_0x3f9645){_0x299834['rows']=_0x3f9645;if(_0x5f20e7[_0xe8e7('0x42')][_0xe8e7('0x4a')]===_0xe8e7('0x43')){var _0x174cbc=[];for(var _0x297947=0x0;_0x297947<_0x299834[_0xe8e7('0x4b')][_0xe8e7('0x4c')];_0x297947++){_0x174cbc[_0xe8e7('0x48')](get_open_tabs(_0xe8e7('0x4d'),_0x299834[_0xe8e7('0x4b')][_0x297947][_0xe8e7('0x4e')]));_0x174cbc['push'](get_open_tabs(_0xe8e7('0x4f'),_0x299834[_0xe8e7('0x4b')][_0x297947]['dataValues']));_0x174cbc[_0xe8e7('0x48')](get_open_tabs(_0xe8e7('0x50'),_0x299834['rows'][_0x297947][_0xe8e7('0x4e')]));_0x174cbc[_0xe8e7('0x48')](get_open_tabs(_0xe8e7('0x51'),_0x299834[_0xe8e7('0x4b')][_0x297947][_0xe8e7('0x4e')]));_0x174cbc[_0xe8e7('0x48')](get_open_tabs(_0xe8e7('0x52'),_0x299834[_0xe8e7('0x4b')][_0x297947][_0xe8e7('0x4e')]));_0x174cbc['push'](get_open_tabs('whatsapp',_0x299834[_0xe8e7('0x4b')][_0x297947][_0xe8e7('0x4e')]));}return Promise['all'](_0x174cbc)['then'](function(){return _0x299834;});}else{return _0x299834;}})[_0xe8e7('0x25')](respondWithFilteredResult(_0x53755d,_0x35986d))[_0xe8e7('0x1b')](handleError(_0x53755d,null));};exports[_0xe8e7('0x53')]=function(_0x505dcd,_0x45df42){var _0x2cde86={'raw':![],'where':{'id':_0x505dcd[_0xe8e7('0x54')]['id']}},_0x3d468f={};_0x3d468f[_0xe8e7('0x55')]=_[_0xe8e7('0x56')](_['keys'](db[_0xe8e7('0x41')][_0xe8e7('0x57')]),[_0xe8e7('0x3e'),_0xe8e7('0x3f')]);_0x3d468f['query']=_[_0xe8e7('0x58')](_0x505dcd[_0xe8e7('0x42')]);_0x3d468f[_0xe8e7('0x59')]=_[_0xe8e7('0x5a')](_0x3d468f[_0xe8e7('0x55')],_0x3d468f[_0xe8e7('0x42')]);_0x2cde86['attributes']=_[_0xe8e7('0x5a')](_0x3d468f[_0xe8e7('0x55')],qs[_0xe8e7('0x5b')](_0x505dcd[_0xe8e7('0x42')][_0xe8e7('0x5b')]));_0x2cde86['attributes']=_0x2cde86[_0xe8e7('0x47')][_0xe8e7('0x4c')]?_0x2cde86['attributes']:_0x3d468f[_0xe8e7('0x55')];if(_0x505dcd[_0xe8e7('0x42')][_0xe8e7('0x5c')]){_0x2cde86[_0xe8e7('0x44')]=[{'all':!![]}];}if(_0x505dcd[_0xe8e7('0x42')][_0xe8e7('0x46')]===_0xe8e7('0x43')){_0x2cde86[_0xe8e7('0x44')]=[{'model':db[_0xe8e7('0x45')],'as':_0xe8e7('0x46')}];}_0x2cde86=_['merge']({},_0x2cde86,_0x505dcd[_0xe8e7('0x5d')]);if(!_[_0xe8e7('0x35')](_0x2cde86['attributes'],'id')){_0x2cde86[_0xe8e7('0x47')]['push']('id');}return db[_0xe8e7('0x41')][_0xe8e7('0x36')](_0x2cde86)[_0xe8e7('0x25')](handleEntityNotFound(_0x45df42,null))[_0xe8e7('0x25')](function(_0x32a688){var _0x16deb3=[];values=_0x32a688;if(_0x505dcd[_0xe8e7('0x42')][_0xe8e7('0x4a')]===_0xe8e7('0x43')){_0x16deb3[_0xe8e7('0x48')](get_open_tabs(_0xe8e7('0x4d'),_0x32a688['dataValues']));_0x16deb3[_0xe8e7('0x48')](get_open_tabs(_0xe8e7('0x4f'),_0x32a688[_0xe8e7('0x4e')]));_0x16deb3[_0xe8e7('0x48')](get_open_tabs('openchannel',_0x32a688[_0xe8e7('0x4e')]));_0x16deb3['push'](get_open_tabs('whatsapp',_0x32a688[_0xe8e7('0x4e')]));_0x16deb3[_0xe8e7('0x48')](get_open_tabs(_0xe8e7('0x50'),_0x32a688['dataValues']));_0x16deb3[_0xe8e7('0x48')](get_open_tabs(_0xe8e7('0x51'),_0x32a688[_0xe8e7('0x4e')]));return Promise[_0xe8e7('0x5e')](_0x16deb3);}else{return values;}})['then'](function(){return values;})[_0xe8e7('0x25')](respondWithResult(_0x45df42,null))[_0xe8e7('0x1b')](handleError(_0x45df42,null));};exports[_0xe8e7('0x5f')]=function(_0x4cf499,_0x2181af){if(_0x4cf499[_0xe8e7('0x60')]['id']){delete _0x4cf499['body']['id'];}delete _0x4cf499['body'][_0xe8e7('0x26')];return db[_0xe8e7('0x41')][_0xe8e7('0x36')]({'where':{'id':_0x4cf499[_0xe8e7('0x54')]['id']}})[_0xe8e7('0x25')](handleEntityNotFound(_0x2181af,null))['then'](saveUpdates(_0x4cf499[_0xe8e7('0x60')],null))[_0xe8e7('0x25')](respondWithResult(_0x2181af,null))['catch'](handleError(_0x2181af,null));};exports['describe']=function(_0x3b4c38,_0x5bdd76){return db[_0xe8e7('0x41')][_0xe8e7('0x61')]()[_0xe8e7('0x25')](respondWithResult(_0x5bdd76,null))[_0xe8e7('0x1b')](handleError(_0x5bdd76,null));};exports[_0xe8e7('0x62')]=function(_0x3cc77c,_0x4f8a20){return db[_0xe8e7('0x41')]['find']({'where':{'id':_0x3cc77c[_0xe8e7('0x54')]['id']}})['then'](handleEntityNotFound(_0x4f8a20,null))[_0xe8e7('0x25')](function(_0x3f259e){if(_0x3f259e){return _0x3f259e[_0xe8e7('0x62')](_0x3cc77c[_0xe8e7('0x60')][_0xe8e7('0x63')],_[_0xe8e7('0x64')](_0x3cc77c[_0xe8e7('0x60')],[_0xe8e7('0x63'),'id'])||{});}})[_0xe8e7('0x25')](respondWithResult(_0x4f8a20,null))[_0xe8e7('0x1b')](handleError(_0x4f8a20,null));};function validateUser(_0x245b44){return new Promise(function(_0x5bfec4,_0x4fdcd8){if(_0x245b44[_0xe8e7('0x65')])return _0x5bfec4(_0x245b44);return db[_0xe8e7('0x66')]['findById'](0x1)[_0xe8e7('0x25')](function(_0x9d4261){if(_0x9d4261[_0xe8e7('0x67')])authService[_0xe8e7('0x68')](_0x245b44[_0xe8e7('0x3e')]);db[_0xe8e7('0x41')][_0xe8e7('0x69')](_0xe8e7('0x65'))[_0xe8e7('0x25')](function(_0x552259){if(_['isNil'](_0x552259)){_0x245b44[_0xe8e7('0x65')]=_0x9d4261[_0xe8e7('0x6a')]||0x1;return;}if(_[_0xe8e7('0x6b')](_0x9d4261['min_internal'])||_0x9d4261['min_internal']===_0x552259){_0x245b44[_0xe8e7('0x65')]=_0x552259+0x1;return;}if(_0x9d4261['min_internal']>_0x552259){_0x245b44[_0xe8e7('0x65')]=_0x9d4261[_0xe8e7('0x6a')];return;}return db[_0xe8e7('0x6c')][_0xe8e7('0x42')]('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[_0xe8e7('0x6c')][_0xe8e7('0x6d')][_0xe8e7('0x6e')]})[_0xe8e7('0x25')](function(_0x8c02f8){if(_0x8c02f8&&_0x8c02f8[_0xe8e7('0x4c')]){for(var _0xe0e041=0x0,_0x51eebf=_0x8c02f8['length'];_0xe0e041<_0x51eebf&&_[_0xe8e7('0x6b')](_0x245b44[_0xe8e7('0x65')]);_0xe0e041++){if(_0x9d4261[_0xe8e7('0x6a')]<=_0x8c02f8[_0xe0e041][_0xe8e7('0x6f')]){_0x245b44[_0xe8e7('0x65')]=_0x8c02f8[_0xe0e041][_0xe8e7('0x6f')];}else if(_0x9d4261[_0xe8e7('0x6a')]>_0x8c02f8[_0xe0e041][_0xe8e7('0x6f')]&&_0x9d4261[_0xe8e7('0x6a')]<=_0x8c02f8[_0xe0e041]['to']){_0x245b44[_0xe8e7('0x65')]=_0x9d4261[_0xe8e7('0x6a')];}}}if(_['isNil'](_0x245b44[_0xe8e7('0x65')])){_0x245b44['internal']=_0x552259+0x1;}return _0x5bfec4(_0x245b44);});});})[_0xe8e7('0x1b')](function(_0x1865e1){_0x4fdcd8(_0x1865e1);});});}function updateUser(_0x2fb8ee){return new Promise(function(_0x3c504e,_0x414c68){try{if(_0x2fb8ee['voicemail']){_0x2fb8ee['mailbox']=_0x2fb8ee[_0xe8e7('0x65')];_0x2fb8ee['VoiceMail']={'mailbox':_0x2fb8ee['internal'],'password':_0x2fb8ee[_0xe8e7('0x3e')],'fullname':_0x2fb8ee[_0xe8e7('0x70')],'email':_0x2fb8ee['email']};}if(_0x2fb8ee[_0xe8e7('0x26')]===_0xe8e7('0x27')){if(!_0x2fb8ee[_0xe8e7('0x71')])_0x2fb8ee[_0xe8e7('0x71')]=[_0xe8e7('0x72'),_0xe8e7('0x73'),_0xe8e7('0x74'),_0xe8e7('0x75'),_0xe8e7('0x76'),_0xe8e7('0x77'),'105',_0xe8e7('0x78'),_0xe8e7('0x79'),_0xe8e7('0x7a'),'109',_0xe8e7('0x7b'),_0xe8e7('0x7c'),_0xe8e7('0x7d'),_0xe8e7('0x7e')];}_0x3c504e(_0x2fb8ee);}catch(_0x1d4901){_0x414c68(_0x1d4901);}});}exports[_0xe8e7('0x7f')]=function(_0x1d2695,_0x5d3b3d){if(_0x1d2695[_0xe8e7('0x2e')][_0xe8e7('0x26')]===_0xe8e7('0x27'))throw new Error(_0xe8e7('0x80'));if(_0x1d2695[_0xe8e7('0x60')][_0xe8e7('0x26')]==='user'&&_0x1d2695[_0xe8e7('0x2e')][_0xe8e7('0x26')]!=='admin'){throw new Error(_0xe8e7('0x81'));}if(_0x1d2695[_0xe8e7('0x60')]['role']===_0xe8e7('0x2c')&&_0x1d2695[_0xe8e7('0x2e')]['role']!==_0xe8e7('0x2c')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0xe8e7('0x82')]([_0x1d2695[_0xe8e7('0x60')]])[_0xe8e7('0x25')](function(){return validateUser(_0x1d2695['body']);})[_0xe8e7('0x25')](function(_0x59817a){return updateUser(_0x59817a)['then'](function(_0x1fc667){if(_0x1fc667['role']===_0xe8e7('0x2c')){_0x1fc667[_0xe8e7('0x83')]=_0x1d2695['user'][_0xe8e7('0x83')];delete _0x1fc667['userProfileId'];}return _0x1fc667;});})[_0xe8e7('0x25')](function(_0x1729d7){return db[_0xe8e7('0x41')][_0xe8e7('0x7f')](_0x1729d7,{'include':[{'model':db[_0xe8e7('0x84')],'as':_0xe8e7('0x84')}]});})['then'](function(_0x5ad2be){if(_0x1d2695[_0xe8e7('0x60')][_0xe8e7('0x26')]==='user')return _0x5ad2be;if(_0x1d2695['user']['role']!==_0xe8e7('0x2e'))return _0x5ad2be;return db['UserProfileSection']['find']({'where':{'name':_0x5ad2be[_0xe8e7('0x26')]==='agent'?_0xe8e7('0x2f'):_0xe8e7('0x30'),'userProfileId':_0x1d2695['user']['userProfileId']},'raw':!![]})['then'](function(_0x319ac7){if(!_0x319ac7||_0x319ac7[_0xe8e7('0x85')]!=0x0)return _0x5ad2be;return db[_0xe8e7('0x37')][_0xe8e7('0x7f')]({'name':_0x5ad2be[_0xe8e7('0x39')],'resourceId':_0x5ad2be['id'],'type':_0x319ac7[_0xe8e7('0x39')],'sectionId':_0x319ac7['id']},{})[_0xe8e7('0x25')](function(){return _0x5ad2be;});})[_0xe8e7('0x1b')](function(_0x3e94a7){logger[_0xe8e7('0x17')](_0xe8e7('0x86'),_0x3e94a7);throw _0x3e94a7;});})[_0xe8e7('0x25')](respondWithResult(_0x5d3b3d,0xc9))[_0xe8e7('0x1b')](handleError(_0x5d3b3d,null));};exports['bulkCreate']=function(_0xee9214,_0x5a4439){var _0x8a10a3=_0xee9214[_0xe8e7('0x60')];var _0x379789=[];if(_0xee9214['user']['role']===_0xe8e7('0x27'))throw new Error(_0xe8e7('0x80'));if(_[_0xe8e7('0x87')](_0x8a10a3,['role',_0xe8e7('0x2e')])&&_0xee9214[_0xe8e7('0x2e')][_0xe8e7('0x26')]!==_0xe8e7('0x2c')){throw new Error(_0xe8e7('0x81'));}if(_[_0xe8e7('0x87')](_0x8a10a3,['role','admin'])&&_0xee9214[_0xe8e7('0x2e')]['role']!==_0xe8e7('0x2c')){throw new Error(_0xe8e7('0x88'));}return licenseUtil['checkUserLimits'](_0x8a10a3)['then'](function(){return validateUser(_0x8a10a3[0x0]);})[_0xe8e7('0x25')](function(){for(var _0x4d0d07=0x1;_0x4d0d07<_0x8a10a3[_0xe8e7('0x4c')];_0x4d0d07++){var _0x2d9541=_0x8a10a3[_0x4d0d07-0x1][_0xe8e7('0x65')];if(!_0x8a10a3[_0x4d0d07][_0xe8e7('0x65')])_0x8a10a3[_0x4d0d07][_0xe8e7('0x65')]=_0x2d9541+0x1;_0x379789[_0xe8e7('0x48')](validateUser(_0x8a10a3[_0x4d0d07]));}return Promise[_0xe8e7('0x5e')](_0x379789);})[_0xe8e7('0x25')](function(){_0x379789=[];for(var _0x5c728a=0x0;_0x5c728a<_0x8a10a3[_0xe8e7('0x4c')];_0x5c728a++){_0x379789[_0xe8e7('0x48')](updateUser(_0x8a10a3[_0x5c728a]));}return Promise[_0xe8e7('0x5e')](_0x379789);})[_0xe8e7('0x25')](function(){_0x379789=_0x8a10a3['map'](function(_0x4cb8b7){return db[_0xe8e7('0x41')][_0xe8e7('0x7f')](_0x4cb8b7,{'include':[{'model':db[_0xe8e7('0x84')],'as':'VoiceMail'}]})[_0xe8e7('0x25')](function(_0x56b40d){_0x4cb8b7['id']=_0x56b40d['id'];return _0x4cb8b7;});});return Promise['all'](_0x379789);})['then'](function(_0x194a79){if(_0xee9214[_0xe8e7('0x60')][_0xe8e7('0x26')]===_0xe8e7('0x2e'))return _0x194a79;if(_0xee9214[_0xe8e7('0x2e')]['role']!==_0xe8e7('0x2e'))return _0x194a79;var _0x556c47=_[_0xe8e7('0x87')](_0x194a79,function(_0x1b6d40){return _0x1b6d40[_0xe8e7('0x26')]===_0xe8e7('0x27')||_0x1b6d40[_0xe8e7('0x26')]===_0xe8e7('0x89');});if(!_0x556c47)return _0x194a79;return db[_0xe8e7('0x8a')][_0xe8e7('0x49')]({'where':{'name':{'$or':['Agents',_0xe8e7('0x30')]},'userProfileId':_0xee9214[_0xe8e7('0x2e')][_0xe8e7('0x8b')]},'raw':!![]})[_0xe8e7('0x25')](function(_0x120caa){if(_[_0xe8e7('0x8c')](_0x120caa)||!_[_0xe8e7('0x87')](_0x120caa,['autoAssociation',0x0]))return _0x194a79;_0x379789=[];var _0xbb1e3a=_(_0x120caa)[_0xe8e7('0x33')](function(_0x26f53d){if(_0x26f53d['autoAssociation']===0x1)return;return _0x26f53d[_0xe8e7('0x39')]==='Agents'?_0xe8e7('0x27'):_0xe8e7('0x89');})['compact']()[_0xe8e7('0x34')]();for(var _0x5202ee=0x0;_0x5202ee<_0x194a79[_0xe8e7('0x4c')];_0x5202ee++){if(!_[_0xe8e7('0x35')](_0xbb1e3a,_0x194a79[_0x5202ee]['role']))return;var _0x5c85c8=_0x194a79[_0x5202ee]['role']===_0xe8e7('0x27')?_0xe8e7('0x2f'):_0xe8e7('0x30');_0x379789[_0xe8e7('0x48')](db[_0xe8e7('0x37')][_0xe8e7('0x7f')]({'name':_0x194a79[_0x5202ee]['name'],'resourceId':_0x194a79[_0x5202ee]['id'],'type':_0x5c85c8,'sectionId':_[_0xe8e7('0x36')](_0x120caa,[_0xe8e7('0x39'),_0x5c85c8])['id']},{}));}return Promise['all'](_0x379789);});})['then'](respondWithResult(_0x5a4439,0xc9))[_0xe8e7('0x1b')](handleError(_0x5a4439,null));};exports['changePassword']=function(_0x17e4f5,_0x1ee283){if(_0x17e4f5['body']['id']){delete _0x17e4f5[_0xe8e7('0x60')]['id'];}return db[_0xe8e7('0x41')][_0xe8e7('0x36')]({'where':{'id':_0x17e4f5[_0xe8e7('0x54')]['id']}})['then'](function(_0x36ec41){if(!_0x36ec41)return null;if(_0x36ec41['id']===_0x17e4f5[_0xe8e7('0x2e')]['id']){if(!_0x17e4f5[_0xe8e7('0x60')][_0xe8e7('0x8d')]||!_0x17e4f5[_0xe8e7('0x60')]['newPassword']){throw new db[(_0xe8e7('0x8e'))][(_0xe8e7('0x8f'))](_0xe8e7('0x90'));}if(!_0x36ec41[_0xe8e7('0x91')](_0x17e4f5['body'][_0xe8e7('0x8d')])){throw new db[(_0xe8e7('0x8e'))]['ValidationError']('Wrong\x20credentials');}if(_0x17e4f5[_0xe8e7('0x60')][_0xe8e7('0x8d')]===_0x17e4f5[_0xe8e7('0x60')][_0xe8e7('0x92')]){throw new db['Sequelize'][(_0xe8e7('0x8f'))](_0xe8e7('0x93'));}}else if(_0x17e4f5[_0xe8e7('0x2e')][_0xe8e7('0x26')]==='admin'){if(!_0x17e4f5['body'][_0xe8e7('0x92')]){throw new db[(_0xe8e7('0x8e'))][(_0xe8e7('0x8f'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x17e4f5[_0xe8e7('0x2e')][_0xe8e7('0x26')]===_0xe8e7('0x2e')){if(!_0x17e4f5[_0xe8e7('0x60')][_0xe8e7('0x92')]){throw new db['Sequelize']['ValidationError'](_0xe8e7('0x94'));}if(_0x36ec41[_0xe8e7('0x26')]!==_0xe8e7('0x27')){throw new db[(_0xe8e7('0x8e'))][(_0xe8e7('0x8f'))](_0xe8e7('0x80'));}}else{throw new db[(_0xe8e7('0x8e'))][(_0xe8e7('0x8f'))]('Unauthorized');}return _0x36ec41;})[_0xe8e7('0x25')](handleEntityNotFound(_0x1ee283,null))[_0xe8e7('0x25')](function(_0x56e02f){return db[_0xe8e7('0x66')][_0xe8e7('0x95')]({'attributes':['id',_0xe8e7('0x67'),_0xe8e7('0x96'),_0xe8e7('0x97')]})[_0xe8e7('0x25')](function(_0x18d07b){if(_0x18d07b[_0xe8e7('0x67')])authService[_0xe8e7('0x68')](_0x17e4f5[_0xe8e7('0x60')][_0xe8e7('0x92')]);if(!_0x18d07b[_0xe8e7('0x96')]||!_0x56e02f[_0xe8e7('0x98')])return _0x56e02f;authService[_0xe8e7('0x99')](_0x17e4f5[_0xe8e7('0x60')][_0xe8e7('0x92')],_0x56e02f[_0xe8e7('0x98')],_0x18d07b[_0xe8e7('0x97')]);return _0x56e02f;})[_0xe8e7('0x25')](saveUpdates({'password':_0x17e4f5[_0xe8e7('0x60')][_0xe8e7('0x92')],'passwordResetAt':_0x17e4f5[_0xe8e7('0x2e')]['id']==_0x17e4f5[_0xe8e7('0x54')]['id']?moment():null,'previousPasswords':authService[_0xe8e7('0x9a')](_0x17e4f5['body'][_0xe8e7('0x92')],_0x56e02f[_0xe8e7('0x98')])},null));})[_0xe8e7('0x25')](respondWithResult(_0x1ee283,null))['catch'](handleError(_0x1ee283,null));};exports[_0xe8e7('0x9b')]=function(_0x344deb,_0x4f5303){var _0x56fd5d=_0x344deb[_0xe8e7('0x60')]['channel'];return db['User']['find']({'where':{'id':_0x344deb[_0xe8e7('0x54')]['id']},'attributes':['id',_0xe8e7('0x39'),_0xe8e7('0x26'),'online','loginInPause',_0xe8e7('0x9c'),_0xe8e7('0x9d')]})['then'](handleEntityNotFound(_0x4f5303,null))[_0xe8e7('0x25')](function(_0x3515bc){if(_0x3515bc){if(!utils[_0xe8e7('0x9e')](_0x56fd5d)){throw new db[(_0xe8e7('0x8e'))][(_0xe8e7('0x8f'))]('Unknown\x20channel');}return _0x3515bc[_0xe8e7('0x9f')+_['capitalize'](_0x56fd5d[_0xe8e7('0xa0')]())+_0xe8e7('0xa1')](_0x344deb[_0xe8e7('0x60')][_0xe8e7('0x63')],{'penalty':_0x344deb[_0xe8e7('0x60')]['penalty']||0x0})['spread'](function(_0x3e4247){for(var _0x5d9613=0x0;_0x5d9613<_0x344deb[_0xe8e7('0x60')][_0xe8e7('0x63')][_0xe8e7('0x4c')];_0x5d9613+=0x1){var _0x57cdab={'UserId':Number(_0x344deb[_0xe8e7('0x54')]['id'])};_0x57cdab[_[_0xe8e7('0xa2')](_0x56fd5d[_0xe8e7('0xa0')]())+_0xe8e7('0xa3')]=Number(_0x344deb[_0xe8e7('0x60')][_0xe8e7('0x63')][_0x5d9613]);socket['emit'](_0xe8e7('0x2e')+_['capitalize'](_0x56fd5d[_0xe8e7('0xa0')]())+'Queue:save',_0x57cdab);}return _0x3e4247;})[_0xe8e7('0x25')](function(){if(_0x56fd5d===_0xe8e7('0xa4')){return db['VoiceQueue'][_0xe8e7('0x49')]({'where':{'id':_0x344deb[_0xe8e7('0x60')][_0xe8e7('0x63')]||[]},'raw':!![],'attributes':['id',_0xe8e7('0x39')]});}})[_0xe8e7('0x25')](function(_0x341001){var _0x3cc60b=_0x3515bc[_0xe8e7('0x2b')]({'plain':!![]});var _0x566d67=[];if(_0x56fd5d===_0xe8e7('0xa4')&&_0x3cc60b[_0xe8e7('0x26')]===_0xe8e7('0x27')&&_0x3cc60b[_0xe8e7('0xa5')]){for(let _0x50bf39=0x0;_0x50bf39<_0x341001[_0xe8e7('0x4c')];_0x50bf39+=0x1){_0x566d67[_0xe8e7('0x48')]({'membername':_0x3cc60b[_0xe8e7('0x39')],'UserId':_0x3cc60b['id'],'queue_name':_0x341001[_0x50bf39]['name'],'VoiceQueueId':_0x341001[_0x50bf39]['id'],'interface':_[_0xe8e7('0x6b')](_0x3cc60b['interface'])?util[_0xe8e7('0xa6')](_0xe8e7('0xa7'),_0x3cc60b[_0xe8e7('0x39')]):_0x3cc60b['interface'],'paused':_0x3cc60b[_0xe8e7('0x9c')]||![],'penalty':_0x344deb['body'][_0xe8e7('0xa8')]||0x0});}return Promise[_0xe8e7('0x5e')](_0x566d67[_0xe8e7('0x33')](function(_0x5ec42c){return db[_0xe8e7('0xa9')]['upsert'](_0x5ec42c);}));}return _0x3515bc;});}})[_0xe8e7('0x25')](respondWithStatusCode(_0x4f5303,null))[_0xe8e7('0x1b')](handleError(_0x4f5303,null));};exports[_0xe8e7('0xaa')]=function(_0x2051cb,_0x5f4e96){var _0x310bfd,_0x15b442;return db[_0xe8e7('0x41')][_0xe8e7('0x36')]({'where':{'id':_0x2051cb[_0xe8e7('0x54')]['id']},'attributes':['id',_0xe8e7('0x39'),_0xe8e7('0x26')]})[_0xe8e7('0x25')](handleEntityNotFound(_0x5f4e96,null))[_0xe8e7('0x25')](function(_0x162ef9){if(_0x162ef9){_0x310bfd=_0x162ef9;if(!_0x2051cb[_0xe8e7('0x42')][_0xe8e7('0xab')]||!utils['isValidChannel'](_0x2051cb[_0xe8e7('0x42')][_0xe8e7('0xab')])){throw new db[(_0xe8e7('0x8e'))]['ValidationError'](_0xe8e7('0xac'));}return _0x162ef9[_0xe8e7('0xad')+_[_0xe8e7('0xa2')](_0x2051cb[_0xe8e7('0x42')][_0xe8e7('0xab')][_0xe8e7('0xa0')]())+'Queues'](_0x2051cb[_0xe8e7('0x42')][_0xe8e7('0x63')]);}})['then'](function(_0x1c0cb1){if(_[_0xe8e7('0xae')](_0x2051cb[_0xe8e7('0x42')]['ids'])){for(var _0x100a0b=0x0;_0x100a0b<_0x2051cb['query'][_0xe8e7('0x63')][_0xe8e7('0x4c')];_0x100a0b+=0x1){_0x15b442={'UserId':Number(_0x2051cb[_0xe8e7('0x54')]['id'])};_0x15b442[_[_0xe8e7('0xa2')](_0x2051cb['query']['channel'][_0xe8e7('0xa0')]())+_0xe8e7('0xa3')]=Number(_0x2051cb['query'][_0xe8e7('0x63')][_0x100a0b]);socket['emit'](_0xe8e7('0x2e')+_[_0xe8e7('0xa2')](_0x2051cb[_0xe8e7('0x42')][_0xe8e7('0xab')][_0xe8e7('0xa0')]())+_0xe8e7('0xaf'),_0x15b442);}}else{_0x15b442={'UserId':Number(_0x2051cb[_0xe8e7('0x54')]['id'])};_0x15b442[_[_0xe8e7('0xa2')](_0x2051cb['query']['channel'][_0xe8e7('0xa0')]())+_0xe8e7('0xa3')]=Number(_0x2051cb[_0xe8e7('0x42')][_0xe8e7('0x63')]);socket[_0xe8e7('0x28')](_0xe8e7('0x2e')+_[_0xe8e7('0xa2')](_0x2051cb['query'][_0xe8e7('0xab')][_0xe8e7('0xa0')]())+_0xe8e7('0xaf'),_0x15b442);}return _0x1c0cb1;})[_0xe8e7('0x25')](function(){if(_0x2051cb[_0xe8e7('0x42')][_0xe8e7('0xab')]===_0xe8e7('0xa4')){return db[_0xe8e7('0xa9')][_0xe8e7('0x2a')]({'where':{'UserId':_0x2051cb['params']['id'],'VoiceQueueId':_0x2051cb[_0xe8e7('0x42')][_0xe8e7('0x63')]},'individualHooks':!![]})[_0xe8e7('0x25')](function(){return _0x310bfd;});}return _0x310bfd;})[_0xe8e7('0x25')](respondWithStatusCode(_0x5f4e96,null))['catch'](handleError(_0x5f4e96,null));};exports[_0xe8e7('0xb0')]=function(_0x362c00,_0x1d9570){_0x362c00[_0xe8e7('0x60')][_0xe8e7('0xb1')]=_0x362c00[_0xe8e7('0xb2')][_0xe8e7('0xb3')];return db[_0xe8e7('0x41')][_0xe8e7('0x36')]({'where':{'id':_0x362c00[_0xe8e7('0x54')]['id']}})[_0xe8e7('0x25')](handleEntityNotFound(_0x1d9570,null))[_0xe8e7('0x25')](saveUpdates(_0x362c00['body'],null))['then'](respondWithResult(_0x1d9570,null))[_0xe8e7('0x1b')](handleError(_0x1d9570,null));};exports[_0xe8e7('0xb4')]=function(_0x4d7408,_0x382e16){var _0x3593c1=path[_0xe8e7('0xb5')](config[_0xe8e7('0xb6')],_0xe8e7('0xb7'));return db['User'][_0xe8e7('0x36')]({'where':{'id':_0x4d7408[_0xe8e7('0x54')]['id']},'attributes':['id',_0xe8e7('0xb1')],'raw':!![]})[_0xe8e7('0x25')](handleEntityNotFound(_0x382e16,null))[_0xe8e7('0x25')](function(_0x1a66b7){if(_0x1a66b7){if(_['isNil'](_0x1a66b7[_0xe8e7('0xb1')])){return _0x382e16[_0xe8e7('0xb8')](_0x3593c1);}else{if(!fs[_0xe8e7('0xb9')](path[_0xe8e7('0xb5')](config[_0xe8e7('0xb6')],_0xe8e7('0xba'),_0x1a66b7[_0xe8e7('0xb1')]))){return _0x382e16[_0xe8e7('0xb8')](_0x3593c1);}return _0x382e16[_0xe8e7('0xb8')](path[_0xe8e7('0xb5')](config['root'],'server/files/images/',_0x1a66b7[_0xe8e7('0xb1')]));}}})[_0xe8e7('0x1b')](handleError(_0x382e16,null));};exports[_0xe8e7('0xbb')]=function(_0x3d1dbd,_0x2acdab){return db[_0xe8e7('0x41')][_0xe8e7('0x36')]({'where':{'id':_0x3d1dbd['params']['id']},'attributes':['id']})[_0xe8e7('0x25')](handleEntityNotFound(_0x2acdab,null))[_0xe8e7('0x25')](function(_0x1f1c41){var _0x1c01eb=[];values=_0x1f1c41[_0xe8e7('0x4e')];_0x1c01eb[_0xe8e7('0x48')](get_open_tabs(_0xe8e7('0x4d'),_0x1f1c41[_0xe8e7('0x4e')]));_0x1c01eb[_0xe8e7('0x48')](get_open_tabs('sms',_0x1f1c41['dataValues']));_0x1c01eb[_0xe8e7('0x48')](get_open_tabs('openchannel',_0x1f1c41[_0xe8e7('0x4e')]));_0x1c01eb[_0xe8e7('0x48')](get_open_tabs(_0xe8e7('0xbc'),_0x1f1c41[_0xe8e7('0x4e')]));_0x1c01eb['push'](get_open_tabs(_0xe8e7('0x50'),_0x1f1c41[_0xe8e7('0x4e')]));_0x1c01eb[_0xe8e7('0x48')](get_open_tabs('mail',_0x1f1c41[_0xe8e7('0x4e')]));return Promise[_0xe8e7('0x5e')](_0x1c01eb);})[_0xe8e7('0x25')](function(_0x3506cc){if(_0x3506cc){var _0x4e4e36=_[_0xe8e7('0x33')](values[_0xe8e7('0xbd')],function(_0x2df3cb){return{'channel':_0xe8e7('0xbe'),'id':_0x2df3cb['id'],'createdAt':_0x2df3cb[_0xe8e7('0xbf')]};});var _0x1e8341=_[_0xe8e7('0x33')](values[_0xe8e7('0xc0')],function(_0x4c0d01){return{'channel':_0xe8e7('0xc1'),'id':_0x4c0d01['id'],'createdAt':_0x4c0d01[_0xe8e7('0xbf')]};});var _0x15393f=_['map'](values[_0xe8e7('0xc2')],function(_0x46b7f9){return{'channel':'OPENCHANNEL','id':_0x46b7f9['id'],'createdAt':_0x46b7f9[_0xe8e7('0xbf')]};});var _0x36e462=_[_0xe8e7('0x33')](values[_0xe8e7('0xc3')],function(_0x307b03){return{'channel':_0xe8e7('0xc4'),'id':_0x307b03['id'],'createdAt':_0x307b03['createdAt']};});var _0x4d0b2f=_[_0xe8e7('0x33')](values[_0xe8e7('0xc5')],function(_0x5557de){return{'channel':_0xe8e7('0xc6'),'id':_0x5557de['id'],'createdAt':_0x5557de[_0xe8e7('0xbf')]};});var _0x27e422=_[_0xe8e7('0x33')](values[_0xe8e7('0xc7')],function(_0x110a6a){return{'channel':_0xe8e7('0xc8'),'id':_0x110a6a['id'],'createdAt':_0x110a6a['createdAt']};});var _0x4c2f0f=_[_0xe8e7('0xc9')](_0x4e4e36,_0x1e8341,_0x15393f,_0x36e462,_0x4d0b2f,_0x27e422);var _0x3b8f06={'count':_0x4c2f0f[_0xe8e7('0x4c')],'rows':_0x4c2f0f};return _0x3b8f06;}else return null;})[_0xe8e7('0x25')](respondWithResult(_0x2acdab,null))[_0xe8e7('0x1b')](handleError(_0x2acdab,null));};exports[_0xe8e7('0xca')]=function(_0x3fc96a,_0x4429a2){var _0x4e537d={};var _0x5e77f4={};var _0x80cb76;var _0x4f688e;return db['User'][_0xe8e7('0x95')]({'where':{'id':_0x3fc96a[_0xe8e7('0x54')]['id']}})[_0xe8e7('0x25')](handleEntityNotFound(_0x4429a2,null))[_0xe8e7('0x25')](function(_0x2bbbd8){if(_0x2bbbd8){_0x80cb76=_0x2bbbd8;_0x5e77f4[_0xe8e7('0x55')]=_[_0xe8e7('0x58')](db['CmContact'][_0xe8e7('0x57')]);_0x5e77f4[_0xe8e7('0x42')]=_[_0xe8e7('0x58')](_0x3fc96a['query']);_0x5e77f4[_0xe8e7('0x59')]=_[_0xe8e7('0x5a')](_0x5e77f4[_0xe8e7('0x55')],_0x5e77f4['query']);_0x4e537d[_0xe8e7('0x47')]=_[_0xe8e7('0x5a')](_0x5e77f4[_0xe8e7('0x55')],qs['fields'](_0x3fc96a[_0xe8e7('0x42')]['fields']));_0x4e537d[_0xe8e7('0x47')]=_0x4e537d[_0xe8e7('0x47')][_0xe8e7('0x4c')]?_0x4e537d['attributes']:_0x5e77f4[_0xe8e7('0x55')];_0x4e537d[_0xe8e7('0xcb')]=qs[_0xe8e7('0xcc')](_0x3fc96a['query'][_0xe8e7('0xcc')]);_0x4e537d[_0xe8e7('0x40')]=qs[_0xe8e7('0x59')](_[_0xe8e7('0xcd')](_0x3fc96a[_0xe8e7('0x42')],_0x5e77f4[_0xe8e7('0x59')]));if(_0x3fc96a[_0xe8e7('0x42')][_0xe8e7('0x31')]){_0x4e537d[_0xe8e7('0x40')]=_[_0xe8e7('0xce')](_0x4e537d[_0xe8e7('0x40')],{'$or':_[_0xe8e7('0x33')](_0x4e537d['attributes'],function(_0x4bb68a){var _0x67c290={};_0x67c290[_0x4bb68a]={'$like':'%'+_0x3fc96a[_0xe8e7('0x42')]['filter']+'%'};return _0x67c290;})});}_0x4e537d=_[_0xe8e7('0xce')]({},_0x4e537d,_0x3fc96a[_0xe8e7('0x5d')]);return _0x80cb76[_0xe8e7('0xca')](_0x4e537d);}})['then'](function(_0x2c8e94){if(_0x2c8e94){_0x4f688e=_0x2c8e94[_0xe8e7('0x4c')];if(_0x3fc96a['query']['hasOwnProperty']('includeAll')){_0x4e537d[_0xe8e7('0x44')]=[{'model':db[_0xe8e7('0xcf')],'as':_0xe8e7('0xd0'),'required':![]},{'model':db['Tag'],'as':_0xe8e7('0xd1'),'attributes':['id',_0xe8e7('0x39'),_0xe8e7('0xd2')],'where':_0x3fc96a['query']['tag']?{'id':_0x3fc96a[_0xe8e7('0x42')][_0xe8e7('0xd3')]}:undefined,'required':_0x3fc96a['query'][_0xe8e7('0xd3')]?!![]:![]}];}if(!_0x3fc96a[_0xe8e7('0x42')][_0xe8e7('0xd4')](_0xe8e7('0xd5'))){_0x4e537d[_0xe8e7('0x21')]=qs[_0xe8e7('0x21')](_0x3fc96a[_0xe8e7('0x42')]['limit']);_0x4e537d[_0xe8e7('0xd6')]=qs[_0xe8e7('0xd6')](_0x3fc96a[_0xe8e7('0x42')][_0xe8e7('0xd6')]);}return _0x80cb76[_0xe8e7('0xca')](_0x4e537d);}})[_0xe8e7('0x25')](function(_0x225895){if(_0x225895){return _0x225895?{'count':_0x4f688e,'rows':_0x225895}:null;}})[_0xe8e7('0x25')](respondWithResult(_0x4429a2,null))[_0xe8e7('0x1b')](handleError(_0x4429a2,null));};exports[_0xe8e7('0xd7')]=function(_0x1c920c,_0x4920e4){var _0x34f679;var _0x2299c7={};var _0x5a7968;return db[_0xe8e7('0x41')][_0xe8e7('0x95')]({'where':{'id':_0x1c920c[_0xe8e7('0x54')]['id']},'attributes':['id','name','role']})[_0xe8e7('0x25')](handleEntityNotFound(_0x4920e4,null))[_0xe8e7('0x25')](function(_0x303ae4){if(!utils[_0xe8e7('0x9e')](_0x1c920c[_0xe8e7('0x42')]['channel'])){throw new db[(_0xe8e7('0x8e'))]['ValidationError'](_0xe8e7('0xac'));}_0x34f679=_0x303ae4;var _0x2cf2b3={};_0x2cf2b3[_0xe8e7('0x55')]=_[_0xe8e7('0x58')](db[_[_0xe8e7('0xa2')](_0x1c920c[_0xe8e7('0x42')][_0xe8e7('0xab')])+_0xe8e7('0xd8')][_0xe8e7('0x57')]);_0x2cf2b3['query']=_[_0xe8e7('0x58')](_0x1c920c[_0xe8e7('0x42')]);_0x2cf2b3[_0xe8e7('0x59')]=_[_0xe8e7('0x5a')](_0x2cf2b3[_0xe8e7('0x55')],_0x2cf2b3[_0xe8e7('0x42')]);_0x2299c7['attributes']=_[_0xe8e7('0x5a')](_0x2cf2b3[_0xe8e7('0x55')],qs[_0xe8e7('0x5b')](_0x1c920c[_0xe8e7('0x42')][_0xe8e7('0x5b')]));_0x2299c7['attributes']=_0x2299c7['attributes'][_0xe8e7('0x4c')]?_0x2299c7[_0xe8e7('0x47')]:_0x2cf2b3['model'];_0x2299c7[_0xe8e7('0xcb')]=qs[_0xe8e7('0xcc')](_0x1c920c['query'][_0xe8e7('0xcc')]);_0x2299c7[_0xe8e7('0x40')]=qs[_0xe8e7('0x59')](_[_0xe8e7('0xcd')](_0x1c920c[_0xe8e7('0x42')],_0x2cf2b3[_0xe8e7('0x59')]));if(_0x1c920c['query'][_0xe8e7('0x31')]){_0x2299c7[_0xe8e7('0x40')]=_[_0xe8e7('0xce')](_0x2299c7[_0xe8e7('0x40')],{'$or':_[_0xe8e7('0x33')](_0x2299c7['attributes'],function(_0x23bb99){var _0x33db56={};_0x33db56[_0x23bb99]={'$like':'%'+_0x1c920c['query'][_0xe8e7('0x31')]+'%'};return _0x33db56;})});}_0x2299c7=_[_0xe8e7('0xce')]({},_0x2299c7,_0x1c920c[_0xe8e7('0x5d')]);switch(_0x34f679[_0xe8e7('0x26')]){case _0xe8e7('0x2c'):return db[_[_0xe8e7('0xa2')](_0x1c920c['query'][_0xe8e7('0xab')])+_0xe8e7('0xd8')][_0xe8e7('0x49')](_0x2299c7);case'user':case'agent':return _0x34f679['get'+_['capitalize'](_0x1c920c['query'][_0xe8e7('0xab')])+'Queues'](_0x2299c7);default:throw new db[(_0xe8e7('0x8e'))][(_0xe8e7('0x8f'))](_0xe8e7('0xd9'));}})[_0xe8e7('0x25')](function(_0x4979b1){_0x5a7968=_0x4979b1[_0xe8e7('0x4c')];if(!_0x1c920c[_0xe8e7('0x42')]['hasOwnProperty'](_0xe8e7('0xd5'))){_0x2299c7['limit']=qs[_0xe8e7('0x21')](_0x1c920c[_0xe8e7('0x42')][_0xe8e7('0x21')]);_0x2299c7[_0xe8e7('0xd6')]=qs[_0xe8e7('0xd6')](_0x1c920c[_0xe8e7('0x42')][_0xe8e7('0xd6')]);}switch(_0x34f679[_0xe8e7('0x26')]){case'admin':return db[_[_0xe8e7('0xa2')](_0x1c920c[_0xe8e7('0x42')][_0xe8e7('0xab')])+'Queue']['findAll'](_0x2299c7);case _0xe8e7('0x2e'):case _0xe8e7('0x27'):return _0x34f679[_0xe8e7('0x2b')+_['capitalize'](_0x1c920c['query']['channel'])+'Queues'](_0x2299c7);}})[_0xe8e7('0x25')](function(_0x2b9735){return{'count':_0x5a7968,'rows':_0x2b9735};})[_0xe8e7('0x25')](respondWithResult(_0x4920e4,null))[_0xe8e7('0x1b')](handleError(_0x4920e4,null));};exports[_0xe8e7('0xda')]=function(_0x53df12,_0x36e546){var _0x705b65={};var _0x376c8f={};var _0x11e236;var _0x486b45;return db[_0xe8e7('0x41')][_0xe8e7('0x95')]({'where':{'id':_0x53df12[_0xe8e7('0x54')]['id']}})[_0xe8e7('0x25')](handleEntityNotFound(_0x36e546,null))[_0xe8e7('0x25')](function(_0x46492e){if(_0x46492e){_0x11e236=_0x46492e;_0x376c8f[_0xe8e7('0x55')]=_[_0xe8e7('0x58')](db[_0xe8e7('0xa9')]['rawAttributes']);_0x376c8f[_0xe8e7('0x42')]=_[_0xe8e7('0x58')](_0x53df12[_0xe8e7('0x42')]);_0x376c8f['filters']=_['intersection'](_0x376c8f[_0xe8e7('0x55')],_0x376c8f[_0xe8e7('0x42')]);_0x705b65['attributes']=_[_0xe8e7('0x5a')](_0x376c8f[_0xe8e7('0x55')],qs[_0xe8e7('0x5b')](_0x53df12[_0xe8e7('0x42')]['fields']));_0x705b65[_0xe8e7('0x47')]=_0x705b65[_0xe8e7('0x47')][_0xe8e7('0x4c')]?_0x705b65[_0xe8e7('0x47')]:_0x376c8f['model'];_0x705b65[_0xe8e7('0xcb')]=qs[_0xe8e7('0xcc')](_0x53df12[_0xe8e7('0x42')][_0xe8e7('0xcc')]);_0x705b65[_0xe8e7('0x40')]=qs[_0xe8e7('0x59')](_['pick'](_0x53df12[_0xe8e7('0x42')],_0x376c8f[_0xe8e7('0x59')]));if(_0x53df12[_0xe8e7('0x42')][_0xe8e7('0x31')]){_0x705b65[_0xe8e7('0x40')]=_[_0xe8e7('0xce')](_0x705b65[_0xe8e7('0x40')],{'$or':_['map'](_0x705b65[_0xe8e7('0x47')],function(_0x36b20a){var _0x1559bb={};_0x1559bb[_0x36b20a]={'$like':'%'+_0x53df12['query']['filter']+'%'};return _0x1559bb;})});}_0x705b65=_[_0xe8e7('0xce')]({},_0x705b65,_0x53df12[_0xe8e7('0x5d')]);return _0x11e236[_0xe8e7('0xda')](_0x705b65);}})[_0xe8e7('0x25')](function(_0x1154a5){if(_0x1154a5){_0x486b45=_0x1154a5[_0xe8e7('0x4c')];if(!_0x53df12[_0xe8e7('0x42')]['hasOwnProperty'](_0xe8e7('0xd5'))){_0x705b65['limit']=qs[_0xe8e7('0x21')](_0x53df12[_0xe8e7('0x42')]['limit']);_0x705b65[_0xe8e7('0xd6')]=qs['offset'](_0x53df12[_0xe8e7('0x42')]['offset']);}return _0x11e236[_0xe8e7('0xda')](_0x705b65);}})['then'](function(_0x4e1217){if(_0x4e1217){return _0x4e1217?{'count':_0x486b45,'rows':_0x4e1217}:null;}})[_0xe8e7('0x25')](respondWithResult(_0x36e546,null))[_0xe8e7('0x1b')](handleError(_0x36e546,null));};exports['getGroups']=function(_0x2fa070,_0xe5dcdf){var _0x2c7129={};var _0xbf4de={};var _0x49a74a;var _0x281e9d;return db[_0xe8e7('0x41')][_0xe8e7('0x95')]({'where':{'id':_0x2fa070['params']['id']}})[_0xe8e7('0x25')](handleEntityNotFound(_0xe5dcdf,null))[_0xe8e7('0x25')](function(_0xa0fb0f){if(_0xa0fb0f){_0x49a74a=_0xa0fb0f;_0xbf4de[_0xe8e7('0x55')]=_[_0xe8e7('0x58')](db['ChatGroup']['rawAttributes']);_0xbf4de[_0xe8e7('0x42')]=_[_0xe8e7('0x58')](_0x2fa070[_0xe8e7('0x42')]);_0xbf4de[_0xe8e7('0x59')]=_[_0xe8e7('0x5a')](_0xbf4de[_0xe8e7('0x55')],_0xbf4de[_0xe8e7('0x42')]);_0x2c7129['attributes']=_['intersection'](_0xbf4de[_0xe8e7('0x55')],qs['fields'](_0x2fa070['query'][_0xe8e7('0x5b')]));_0x2c7129[_0xe8e7('0x47')]=_0x2c7129['attributes'][_0xe8e7('0x4c')]?_0x2c7129['attributes']:_0xbf4de[_0xe8e7('0x55')];_0x2c7129['order']=qs[_0xe8e7('0xcc')](_0x2fa070[_0xe8e7('0x42')][_0xe8e7('0xcc')]);_0x2c7129['where']=qs[_0xe8e7('0x59')](_[_0xe8e7('0xcd')](_0x2fa070['query'],_0xbf4de['filters']));if(_0x2fa070['query'][_0xe8e7('0x31')]){_0x2c7129[_0xe8e7('0x40')]=_[_0xe8e7('0xce')](_0x2c7129[_0xe8e7('0x40')],{'$or':_[_0xe8e7('0x33')](_0x2c7129['attributes'],function(_0x1ac8df){var _0x3ec85b={};_0x3ec85b[_0x1ac8df]={'$like':'%'+_0x2fa070[_0xe8e7('0x42')]['filter']+'%'};return _0x3ec85b;})});}_0x2c7129=_[_0xe8e7('0xce')]({},_0x2c7129,_0x2fa070['options']);return _0x49a74a['getGroups'](_0x2c7129);}})[_0xe8e7('0x25')](function(_0xc55e14){if(_0xc55e14){_0x281e9d=_0xc55e14['length'];if(!_0x2fa070[_0xe8e7('0x42')][_0xe8e7('0xd4')](_0xe8e7('0xd5'))){_0x2c7129[_0xe8e7('0x21')]=qs['limit'](_0x2fa070[_0xe8e7('0x42')]['limit']);_0x2c7129[_0xe8e7('0xd6')]=qs[_0xe8e7('0xd6')](_0x2fa070[_0xe8e7('0x42')]['offset']);}return _0x49a74a[_0xe8e7('0xdb')](_0x2c7129);}})['then'](function(_0x2612bd){if(_0x2612bd){return _0x2612bd?{'count':_0x281e9d,'rows':_0x2612bd}:null;}})[_0xe8e7('0x25')](respondWithResult(_0xe5dcdf,null))[_0xe8e7('0x1b')](handleError(_0xe5dcdf,null));};exports[_0xe8e7('0xdc')]=function(_0x5db166,_0x2e95d8){var _0x5829e5={'raw':!![],'where':{}};var _0x13bf51={};var _0x58b014={'count':0x0,'rows':[]};return db[_0xe8e7('0x41')]['findOne']({'where':{'id':_0x5db166['params']['id']}})[_0xe8e7('0x25')](handleEntityNotFound(_0x2e95d8,null))[_0xe8e7('0x25')](function(_0x5c1367){if(_0x5c1367){_0x13bf51[_0xe8e7('0x55')]=_[_0xe8e7('0x58')](db['VoiceRecording'][_0xe8e7('0x57')]);_0x13bf51[_0xe8e7('0x42')]=_[_0xe8e7('0x58')](_0x5db166[_0xe8e7('0x42')]);_0x13bf51[_0xe8e7('0x59')]=_[_0xe8e7('0x5a')](_0x13bf51[_0xe8e7('0x55')],_0x13bf51[_0xe8e7('0x42')]);_0x5829e5['attributes']=_[_0xe8e7('0x5a')](_0x13bf51['model'],qs[_0xe8e7('0x5b')](_0x5db166[_0xe8e7('0x42')][_0xe8e7('0x5b')]));_0x5829e5[_0xe8e7('0x47')]=_0x5829e5[_0xe8e7('0x47')][_0xe8e7('0x4c')]?_0x5829e5[_0xe8e7('0x47')]:_0x13bf51['model'];if(!_0x5db166[_0xe8e7('0x42')][_0xe8e7('0xd4')]('nolimit')){_0x5829e5[_0xe8e7('0x21')]=qs[_0xe8e7('0x21')](_0x5db166[_0xe8e7('0x42')][_0xe8e7('0x21')]);_0x5829e5['offset']=qs[_0xe8e7('0xd6')](_0x5db166['query'][_0xe8e7('0xd6')]);}_0x5829e5[_0xe8e7('0xcb')]=qs[_0xe8e7('0xcc')](_0x5db166[_0xe8e7('0x42')]['sort']);_0x5829e5[_0xe8e7('0x40')]=qs[_0xe8e7('0x59')](_[_0xe8e7('0xcd')](_0x5db166[_0xe8e7('0x42')],_0x13bf51[_0xe8e7('0x59')]));_0x5829e5[_0xe8e7('0x40')]['UserId']=_0x5c1367['id'];if(_0x5db166[_0xe8e7('0x42')]['filter']){_0x5829e5[_0xe8e7('0x40')]=_['merge'](_0x5829e5[_0xe8e7('0x40')],{'$or':_[_0xe8e7('0x33')](_0x5829e5[_0xe8e7('0x47')],function(_0x6a42cb){var _0x127f64={};_0x127f64[_0x6a42cb]={'$like':'%'+_0x5db166[_0xe8e7('0x42')][_0xe8e7('0x31')]+'%'};return _0x127f64;})});}_0x5829e5=_[_0xe8e7('0xce')]({},_0x5829e5,_0x5db166[_0xe8e7('0x5d')]);return db[_0xe8e7('0xdd')][_0xe8e7('0x20')]({'where':_0x5829e5[_0xe8e7('0x40')]})[_0xe8e7('0x25')](function(_0x565556){_0x58b014['count']=_0x565556;if(_0x5db166[_0xe8e7('0x42')][_0xe8e7('0x5c')]){_0x5829e5[_0xe8e7('0x44')]=[{'all':!![]}];}return db[_0xe8e7('0xdd')][_0xe8e7('0x49')](_0x5829e5);})[_0xe8e7('0x25')](function(_0x707f09){_0x58b014[_0xe8e7('0x4b')]=_0x707f09;return _0x58b014;});}})[_0xe8e7('0x25')](respondWithFilteredResult(_0x2e95d8,_0x5829e5))[_0xe8e7('0x1b')](handleError(_0x2e95d8,null));};exports['getScreenRecordings']=function(_0x186e23,_0x1aefcc){var _0x40e8d2={'raw':!![],'where':{}};var _0x2e4d20={};var _0x13b200={'count':0x0,'rows':[]};return db[_0xe8e7('0x41')]['findOne']({'where':{'id':_0x186e23[_0xe8e7('0x54')]['id']}})[_0xe8e7('0x25')](handleEntityNotFound(_0x1aefcc,null))[_0xe8e7('0x25')](function(_0x4bc3de){if(_0x4bc3de){_0x2e4d20[_0xe8e7('0x55')]=_[_0xe8e7('0x58')](db[_0xe8e7('0xde')][_0xe8e7('0x57')]);_0x2e4d20[_0xe8e7('0x42')]=_['keys'](_0x186e23['query']);_0x2e4d20[_0xe8e7('0x59')]=_[_0xe8e7('0x5a')](_0x2e4d20[_0xe8e7('0x55')],_0x2e4d20['query']);_0x40e8d2[_0xe8e7('0x47')]=_[_0xe8e7('0x5a')](_0x2e4d20['model'],qs[_0xe8e7('0x5b')](_0x186e23[_0xe8e7('0x42')][_0xe8e7('0x5b')]));_0x40e8d2['attributes']=_0x40e8d2[_0xe8e7('0x47')]['length']?_0x40e8d2[_0xe8e7('0x47')]:_0x2e4d20['model'];if(!_0x186e23['query'][_0xe8e7('0xd4')]('nolimit')){_0x40e8d2[_0xe8e7('0x21')]=qs['limit'](_0x186e23[_0xe8e7('0x42')][_0xe8e7('0x21')]);_0x40e8d2[_0xe8e7('0xd6')]=qs[_0xe8e7('0xd6')](_0x186e23[_0xe8e7('0x42')][_0xe8e7('0xd6')]);}_0x40e8d2[_0xe8e7('0xcb')]=qs[_0xe8e7('0xcc')](_0x186e23[_0xe8e7('0x42')][_0xe8e7('0xcc')]);_0x40e8d2[_0xe8e7('0x40')]=qs['filters'](_[_0xe8e7('0xcd')](_0x186e23['query'],_0x2e4d20['filters']));_0x40e8d2['where'][_0xe8e7('0xdf')]=_0x4bc3de['id'];if(_0x186e23[_0xe8e7('0x42')][_0xe8e7('0x31')]){_0x40e8d2['where']=_['merge'](_0x40e8d2['where'],{'$or':_['map'](_0x40e8d2['attributes'],function(_0x35e844){var _0x9c7263={};_0x9c7263[_0x35e844]={'$like':'%'+_0x186e23['query'][_0xe8e7('0x31')]+'%'};return _0x9c7263;})});}_0x40e8d2=_['merge']({},_0x40e8d2,_0x186e23[_0xe8e7('0x5d')]);return db['ScreenRecording'][_0xe8e7('0x20')]({'where':_0x40e8d2['where']})[_0xe8e7('0x25')](function(_0x321bdf){_0x13b200['count']=_0x321bdf;if(_0x186e23[_0xe8e7('0x42')][_0xe8e7('0x5c')]){_0x40e8d2[_0xe8e7('0x44')]=[{'all':!![]}];}return db['ScreenRecording'][_0xe8e7('0x49')](_0x40e8d2);})[_0xe8e7('0x25')](function(_0x4bb1f6){_0x13b200[_0xe8e7('0x4b')]=_0x4bb1f6;return _0x13b200;});}})[_0xe8e7('0x25')](respondWithFilteredResult(_0x1aefcc,_0x40e8d2))['catch'](handleError(_0x1aefcc,null));};exports[_0xe8e7('0xe0')]=function(_0xaffd1b,_0x2b35b1){var _0x3bf01a={};var _0x305260={};var _0x27f4d2;var _0x53a188;return db[_0xe8e7('0x41')][_0xe8e7('0x95')]({'where':{'id':_0xaffd1b[_0xe8e7('0x54')]['id']}})['then'](handleEntityNotFound(_0x2b35b1,null))[_0xe8e7('0x25')](function(_0x34a4fa){if(_0x34a4fa){_0x27f4d2=_0x34a4fa;_0x305260[_0xe8e7('0x55')]=_[_0xe8e7('0x58')](db[_0xe8e7('0xe1')][_0xe8e7('0x57')]);_0x305260[_0xe8e7('0x42')]=_[_0xe8e7('0x58')](_0xaffd1b[_0xe8e7('0x42')]);_0x305260['filters']=_[_0xe8e7('0x5a')](_0x305260[_0xe8e7('0x55')],_0x305260[_0xe8e7('0x42')]);_0x3bf01a[_0xe8e7('0x47')]=_[_0xe8e7('0x5a')](_0x305260[_0xe8e7('0x55')],qs[_0xe8e7('0x5b')](_0xaffd1b['query'][_0xe8e7('0x5b')]));_0x3bf01a[_0xe8e7('0x47')]=_0x3bf01a[_0xe8e7('0x47')][_0xe8e7('0x4c')]?_0x3bf01a[_0xe8e7('0x47')]:_0x305260[_0xe8e7('0x55')];_0x3bf01a[_0xe8e7('0xcb')]=qs[_0xe8e7('0xcc')](_0xaffd1b['query'][_0xe8e7('0xcc')]);_0x3bf01a[_0xe8e7('0x40')]=qs['filters'](_[_0xe8e7('0xcd')](_0xaffd1b[_0xe8e7('0x42')],_0x305260[_0xe8e7('0x59')]));if(_0xaffd1b[_0xe8e7('0x42')][_0xe8e7('0x31')]){_0x3bf01a[_0xe8e7('0x40')]=_['merge'](_0x3bf01a['where'],{'$or':_['map'](_0x3bf01a['attributes'],function(_0x5dbf59){var _0x4b4fc7={};_0x4b4fc7[_0x5dbf59]={'$like':'%'+_0xaffd1b[_0xe8e7('0x42')][_0xe8e7('0x31')]+'%'};return _0x4b4fc7;})});}_0x3bf01a=_['merge']({},_0x3bf01a,_0xaffd1b[_0xe8e7('0x5d')]);return _0x27f4d2['getChatInteractions'](_0x3bf01a);}})['then'](function(_0x42be48){if(_0x42be48){_0x53a188=_0x42be48[_0xe8e7('0x4c')];if(!_0xaffd1b['query']['hasOwnProperty']('nolimit')){_0x3bf01a[_0xe8e7('0x21')]=qs['limit'](_0xaffd1b[_0xe8e7('0x42')][_0xe8e7('0x21')]);_0x3bf01a[_0xe8e7('0xd6')]=qs[_0xe8e7('0xd6')](_0xaffd1b[_0xe8e7('0x42')]['offset']);}return _0x27f4d2[_0xe8e7('0xe0')](_0x3bf01a);}})[_0xe8e7('0x25')](function(_0xbcbeb6){if(_0xbcbeb6){return _0xbcbeb6?{'count':_0x53a188,'rows':_0xbcbeb6}:null;}})['then'](respondWithResult(_0x2b35b1,null))['catch'](handleError(_0x2b35b1,null));};exports[_0xe8e7('0xe2')]=function(_0x2f37ae,_0x33196f){var _0x172050={};var _0x4d351d={};var _0x140203;var _0x16ee68;return db[_0xe8e7('0x41')][_0xe8e7('0x95')]({'where':{'id':_0x2f37ae['params']['id']}})[_0xe8e7('0x25')](handleEntityNotFound(_0x33196f,null))[_0xe8e7('0x25')](function(_0x53cf30){if(_0x53cf30){_0x140203=_0x53cf30;_0x4d351d['model']=_[_0xe8e7('0x58')](db[_0xe8e7('0xe3')][_0xe8e7('0x57')]);_0x4d351d['query']=_[_0xe8e7('0x58')](_0x2f37ae[_0xe8e7('0x42')]);_0x4d351d[_0xe8e7('0x59')]=_['intersection'](_0x4d351d[_0xe8e7('0x55')],_0x4d351d[_0xe8e7('0x42')]);_0x172050[_0xe8e7('0x47')]=_['intersection'](_0x4d351d[_0xe8e7('0x55')],qs['fields'](_0x2f37ae[_0xe8e7('0x42')][_0xe8e7('0x5b')]));_0x172050[_0xe8e7('0x47')]=_0x172050[_0xe8e7('0x47')]['length']?_0x172050[_0xe8e7('0x47')]:_0x4d351d[_0xe8e7('0x55')];_0x172050['order']=qs['sort'](_0x2f37ae[_0xe8e7('0x42')][_0xe8e7('0xcc')]);_0x172050[_0xe8e7('0x40')]=qs['filters'](_['pick'](_0x2f37ae[_0xe8e7('0x42')],_0x4d351d['filters']));if(_0x2f37ae[_0xe8e7('0x42')][_0xe8e7('0x31')]){_0x172050[_0xe8e7('0x40')]=_[_0xe8e7('0xce')](_0x172050[_0xe8e7('0x40')],{'$or':_[_0xe8e7('0x33')](_0x172050['attributes'],function(_0x197559){var _0x59ab0a={};_0x59ab0a[_0x197559]={'$like':'%'+_0x2f37ae[_0xe8e7('0x42')][_0xe8e7('0x31')]+'%'};return _0x59ab0a;})});}_0x172050=_[_0xe8e7('0xce')]({},_0x172050,_0x2f37ae['options']);return _0x140203[_0xe8e7('0xe2')](_0x172050);}})[_0xe8e7('0x25')](function(_0x56d786){if(_0x56d786){_0x16ee68=_0x56d786[_0xe8e7('0x4c')];if(!_0x2f37ae['query'][_0xe8e7('0xd4')](_0xe8e7('0xd5'))){_0x172050['limit']=qs['limit'](_0x2f37ae[_0xe8e7('0x42')][_0xe8e7('0x21')]);_0x172050['offset']=qs['offset'](_0x2f37ae[_0xe8e7('0x42')][_0xe8e7('0xd6')]);}return _0x140203['getOpenchannelInteractions'](_0x172050);}})[_0xe8e7('0x25')](function(_0x4f6b74){if(_0x4f6b74){return _0x4f6b74?{'count':_0x16ee68,'rows':_0x4f6b74}:null;}})[_0xe8e7('0x25')](respondWithResult(_0x33196f,null))[_0xe8e7('0x1b')](handleError(_0x33196f,null));};exports[_0xe8e7('0xe4')]=function(_0x359705,_0x3b098a){var _0x29eba4={'raw':!![],'where':{}};var _0x28be8b={};var _0x3765c7={'count':0x0,'rows':[]};return db[_0xe8e7('0x41')]['findOne']({'where':{'id':_0x359705[_0xe8e7('0x54')]['id']}})[_0xe8e7('0x25')](handleEntityNotFound(_0x3b098a,null))[_0xe8e7('0x25')](function(_0x258a9a){if(_0x258a9a){_0x28be8b[_0xe8e7('0x55')]=_['keys'](db[_0xe8e7('0xe5')]['rawAttributes']);_0x28be8b['query']=_['keys'](_0x359705['query']);_0x28be8b['filters']=_[_0xe8e7('0x5a')](_0x28be8b[_0xe8e7('0x55')],_0x28be8b[_0xe8e7('0x42')]);_0x29eba4[_0xe8e7('0x47')]=_[_0xe8e7('0x5a')](_0x28be8b[_0xe8e7('0x55')],qs[_0xe8e7('0x5b')](_0x359705[_0xe8e7('0x42')][_0xe8e7('0x5b')]));_0x29eba4[_0xe8e7('0x47')]=_0x29eba4[_0xe8e7('0x47')][_0xe8e7('0x4c')]?_0x29eba4[_0xe8e7('0x47')]:_0x28be8b[_0xe8e7('0x55')];if(!_0x359705[_0xe8e7('0x42')][_0xe8e7('0xd4')]('nolimit')){_0x29eba4[_0xe8e7('0x21')]=qs['limit'](_0x359705[_0xe8e7('0x42')][_0xe8e7('0x21')]);_0x29eba4[_0xe8e7('0xd6')]=qs[_0xe8e7('0xd6')](_0x359705['query'][_0xe8e7('0xd6')]);}_0x29eba4[_0xe8e7('0xcb')]=qs[_0xe8e7('0xcc')](_0x359705[_0xe8e7('0x42')][_0xe8e7('0xcc')]);_0x29eba4[_0xe8e7('0x40')]=qs['filters'](_['pick'](_0x359705['query'],_0x28be8b[_0xe8e7('0x59')]));_0x29eba4[_0xe8e7('0x40')][_0xe8e7('0xdf')]=_0x258a9a['id'];if(_0x359705[_0xe8e7('0x42')]['filter']){_0x29eba4['where']=_[_0xe8e7('0xce')](_0x29eba4[_0xe8e7('0x40')],{'$or':_[_0xe8e7('0x33')](_0x29eba4[_0xe8e7('0x47')],function(_0x1499d8){var _0x40ab38={};_0x40ab38[_0x1499d8]={'$like':'%'+_0x359705[_0xe8e7('0x42')][_0xe8e7('0x31')]+'%'};return _0x40ab38;})});}_0x29eba4=_[_0xe8e7('0xce')]({},_0x29eba4,_0x359705['options']);return db[_0xe8e7('0xe5')][_0xe8e7('0x20')]({'where':_0x29eba4[_0xe8e7('0x40')]})[_0xe8e7('0x25')](function(_0x315208){_0x3765c7['count']=_0x315208;if(_0x359705[_0xe8e7('0x42')][_0xe8e7('0x5c')]){_0x29eba4[_0xe8e7('0x44')]=[{'all':!![]}];}return db[_0xe8e7('0xe5')][_0xe8e7('0x49')](_0x29eba4);})['then'](function(_0x19e4ff){_0x3765c7['rows']=_0x19e4ff;return _0x3765c7;});}})[_0xe8e7('0x25')](respondWithFilteredResult(_0x3b098a,_0x29eba4))['catch'](handleError(_0x3b098a,null));};exports[_0xe8e7('0xe6')]=function(_0x3eaa45,_0x17b159){var _0x20a8a1={};var _0x3018c7={};var _0x312b89;var _0x4fccd1;return db[_0xe8e7('0x41')][_0xe8e7('0x95')]({'where':{'id':_0x3eaa45[_0xe8e7('0x54')]['id']}})[_0xe8e7('0x25')](handleEntityNotFound(_0x17b159,null))[_0xe8e7('0x25')](function(_0x474a13){if(_0x474a13){_0x312b89=_0x474a13;_0x3018c7['model']=_['keys'](db[_0xe8e7('0xe7')][_0xe8e7('0x57')]);_0x3018c7['query']=_['keys'](_0x3eaa45['query']);_0x3018c7[_0xe8e7('0x59')]=_[_0xe8e7('0x5a')](_0x3018c7[_0xe8e7('0x55')],_0x3018c7['query']);_0x20a8a1[_0xe8e7('0x47')]=_[_0xe8e7('0x5a')](_0x3018c7['model'],qs[_0xe8e7('0x5b')](_0x3eaa45[_0xe8e7('0x42')][_0xe8e7('0x5b')]));_0x20a8a1['attributes']=_0x20a8a1[_0xe8e7('0x47')][_0xe8e7('0x4c')]?_0x20a8a1[_0xe8e7('0x47')]:_0x3018c7['model'];_0x20a8a1[_0xe8e7('0xcb')]=qs[_0xe8e7('0xcc')](_0x3eaa45[_0xe8e7('0x42')][_0xe8e7('0xcc')]);_0x20a8a1[_0xe8e7('0x40')]=qs['filters'](_['pick'](_0x3eaa45[_0xe8e7('0x42')],_0x3018c7['filters']));if(_0x3eaa45['query'][_0xe8e7('0x31')]){_0x20a8a1[_0xe8e7('0x40')]=_[_0xe8e7('0xce')](_0x20a8a1[_0xe8e7('0x40')],{'$or':_['map'](_0x20a8a1['attributes'],function(_0x5e4ab4){var _0x1ec6ba={};_0x1ec6ba[_0x5e4ab4]={'$like':'%'+_0x3eaa45[_0xe8e7('0x42')][_0xe8e7('0x31')]+'%'};return _0x1ec6ba;})});}_0x20a8a1=_[_0xe8e7('0xce')]({},_0x20a8a1,_0x3eaa45[_0xe8e7('0x5d')]);return _0x312b89[_0xe8e7('0xe6')](_0x20a8a1);}})['then'](function(_0x5267a3){if(_0x5267a3){_0x4fccd1=_0x5267a3[_0xe8e7('0x4c')];if(!_0x3eaa45['query'][_0xe8e7('0xd4')]('nolimit')){_0x20a8a1['limit']=qs[_0xe8e7('0x21')](_0x3eaa45[_0xe8e7('0x42')][_0xe8e7('0x21')]);_0x20a8a1[_0xe8e7('0xd6')]=qs[_0xe8e7('0xd6')](_0x3eaa45[_0xe8e7('0x42')][_0xe8e7('0xd6')]);}return _0x312b89[_0xe8e7('0xe6')](_0x20a8a1);}})[_0xe8e7('0x25')](function(_0x3ce287){if(_0x3ce287){return _0x3ce287?{'count':_0x4fccd1,'rows':_0x3ce287}:null;}})['then'](respondWithResult(_0x17b159,null))[_0xe8e7('0x1b')](handleError(_0x17b159,null));};exports[_0xe8e7('0xe8')]=function(_0x127a13,_0x3b4107){var _0x5145d9={};var _0x2c62f3={};var _0x162571;var _0x4b0ab9;return db[_0xe8e7('0x41')]['findOne']({'where':{'id':_0x127a13[_0xe8e7('0x54')]['id']}})['then'](handleEntityNotFound(_0x3b4107,null))['then'](function(_0x321935){if(_0x321935){_0x162571=_0x321935;_0x2c62f3[_0xe8e7('0x55')]=_[_0xe8e7('0x58')](db[_0xe8e7('0xe9')][_0xe8e7('0x57')]);_0x2c62f3['query']=_[_0xe8e7('0x58')](_0x127a13['query']);_0x2c62f3[_0xe8e7('0x59')]=_[_0xe8e7('0x5a')](_0x2c62f3['model'],_0x2c62f3[_0xe8e7('0x42')]);_0x5145d9[_0xe8e7('0x47')]=_[_0xe8e7('0x5a')](_0x2c62f3[_0xe8e7('0x55')],qs['fields'](_0x127a13[_0xe8e7('0x42')][_0xe8e7('0x5b')]));_0x5145d9[_0xe8e7('0x47')]=_0x5145d9[_0xe8e7('0x47')][_0xe8e7('0x4c')]?_0x5145d9[_0xe8e7('0x47')]:_0x2c62f3['model'];_0x5145d9['order']=qs[_0xe8e7('0xcc')](_0x127a13[_0xe8e7('0x42')][_0xe8e7('0xcc')]);_0x5145d9[_0xe8e7('0x40')]=qs[_0xe8e7('0x59')](_['pick'](_0x127a13[_0xe8e7('0x42')],_0x2c62f3['filters']));if(_0x127a13[_0xe8e7('0x42')][_0xe8e7('0x31')]){_0x5145d9[_0xe8e7('0x40')]=_[_0xe8e7('0xce')](_0x5145d9[_0xe8e7('0x40')],{'$or':_[_0xe8e7('0x33')](_0x5145d9[_0xe8e7('0x47')],function(_0xc6d851){var _0x3fd742={};_0x3fd742[_0xc6d851]={'$like':'%'+_0x127a13[_0xe8e7('0x42')][_0xe8e7('0x31')]+'%'};return _0x3fd742;})});}_0x5145d9=_['merge']({},_0x5145d9,_0x127a13[_0xe8e7('0x5d')]);return _0x162571[_0xe8e7('0xe8')](_0x5145d9);}})['then'](function(_0x43b190){if(_0x43b190){_0x4b0ab9=_0x43b190[_0xe8e7('0x4c')];if(!_0x127a13[_0xe8e7('0x42')]['hasOwnProperty']('nolimit')){_0x5145d9[_0xe8e7('0x21')]=qs[_0xe8e7('0x21')](_0x127a13[_0xe8e7('0x42')]['limit']);_0x5145d9[_0xe8e7('0xd6')]=qs[_0xe8e7('0xd6')](_0x127a13['query'][_0xe8e7('0xd6')]);}return _0x162571['getFaxInteractions'](_0x5145d9);}})[_0xe8e7('0x25')](function(_0x4ef4f3){if(_0x4ef4f3){return _0x4ef4f3?{'count':_0x4b0ab9,'rows':_0x4ef4f3}:null;}})[_0xe8e7('0x25')](respondWithResult(_0x3b4107,null))['catch'](handleError(_0x3b4107,null));};exports[_0xe8e7('0xea')]=function(_0x3541ef,_0x5a350c){var _0x2960ba={};var _0x57af18={};var _0x599acc;var _0x42c4d3;return db[_0xe8e7('0x41')][_0xe8e7('0x95')]({'where':{'id':_0x3541ef[_0xe8e7('0x54')]['id']}})['then'](handleEntityNotFound(_0x5a350c,null))[_0xe8e7('0x25')](function(_0x10db42){if(_0x10db42){_0x599acc=_0x10db42;_0x57af18[_0xe8e7('0x55')]=_['keys'](db[_0xe8e7('0xeb')][_0xe8e7('0x57')]);_0x57af18[_0xe8e7('0x42')]=_['keys'](_0x3541ef[_0xe8e7('0x42')]);_0x57af18[_0xe8e7('0x59')]=_['intersection'](_0x57af18[_0xe8e7('0x55')],_0x57af18['query']);_0x2960ba[_0xe8e7('0x47')]=_['intersection'](_0x57af18[_0xe8e7('0x55')],qs['fields'](_0x3541ef['query'][_0xe8e7('0x5b')]));_0x2960ba['attributes']=_0x2960ba[_0xe8e7('0x47')][_0xe8e7('0x4c')]?_0x2960ba[_0xe8e7('0x47')]:_0x57af18[_0xe8e7('0x55')];_0x2960ba[_0xe8e7('0xcb')]=qs[_0xe8e7('0xcc')](_0x3541ef[_0xe8e7('0x42')][_0xe8e7('0xcc')]);_0x2960ba[_0xe8e7('0x40')]=qs['filters'](_[_0xe8e7('0xcd')](_0x3541ef['query'],_0x57af18[_0xe8e7('0x59')]));if(_0x3541ef[_0xe8e7('0x42')]['filter']){_0x2960ba[_0xe8e7('0x40')]=_[_0xe8e7('0xce')](_0x2960ba[_0xe8e7('0x40')],{'$or':_[_0xe8e7('0x33')](_0x2960ba['attributes'],function(_0x34d737){var _0x5cf371={};_0x5cf371[_0x34d737]={'$like':'%'+_0x3541ef[_0xe8e7('0x42')][_0xe8e7('0x31')]+'%'};return _0x5cf371;})});}_0x2960ba=_[_0xe8e7('0xce')]({},_0x2960ba,_0x3541ef['options']);return _0x599acc[_0xe8e7('0xea')](_0x2960ba);}})[_0xe8e7('0x25')](function(_0x33ac91){if(_0x33ac91){_0x42c4d3=_0x33ac91[_0xe8e7('0x4c')];if(!_0x3541ef[_0xe8e7('0x42')]['hasOwnProperty'](_0xe8e7('0xd5'))){_0x2960ba[_0xe8e7('0x21')]=qs[_0xe8e7('0x21')](_0x3541ef[_0xe8e7('0x42')]['limit']);_0x2960ba['offset']=qs['offset'](_0x3541ef[_0xe8e7('0x42')][_0xe8e7('0xd6')]);}return _0x599acc[_0xe8e7('0xea')](_0x2960ba);}})[_0xe8e7('0x25')](function(_0x470ab1){if(_0x470ab1){return _0x470ab1?{'count':_0x42c4d3,'rows':_0x470ab1}:null;}})[_0xe8e7('0x25')](respondWithResult(_0x5a350c,null))['catch'](handleError(_0x5a350c,null));};exports['login']=function(_0x56c7fa,_0x2e2d64,_0x677b14){var _0x165aed;var _0x1f09f8;var _0x38914a;var _0x5109ab=!_['isNil'](_0x56c7fa[_0xe8e7('0x54')]['id'])?_0x56c7fa[_0xe8e7('0x54')]['id']:!_[_0xe8e7('0x6b')](_0x56c7fa['user']['id'])?_0x56c7fa[_0xe8e7('0x2e')]['id']:null;return db[_0xe8e7('0x41')][_0xe8e7('0x36')]({'where':{'id':_0x5109ab,'role':{'$or':['admin',_0xe8e7('0x2e'),_0xe8e7('0x27')]}},'attributes':['id',_0xe8e7('0x39'),'phone',_0xe8e7('0xec'),'role','internal',_0xe8e7('0xed')]})[_0xe8e7('0x25')](function(_0x4e30da){if(_0x4e30da){if(_0x4e30da[_0xe8e7('0x26')]==='agent'){_0x165aed=_0x4e30da;if(_0x56c7fa[_0xe8e7('0x60')]['interface']){_0x38914a=util[_0xe8e7('0xa6')]('LOCAL/%s@from-sip/n',_0x165aed[_0x56c7fa[_0xe8e7('0x60')]['interface']]);}else if(_0x56c7fa[_0xe8e7('0x60')][_0xe8e7('0xee')]){_0x38914a=util[_0xe8e7('0xa6')](_0xe8e7('0xa7'),_0x56c7fa[_0xe8e7('0x60')][_0xe8e7('0xee')]);}else{_0x38914a=util[_0xe8e7('0xa6')]('SIP/%s',_0x165aed[_0xe8e7('0x39')]);}socket['to'](util[_0xe8e7('0xa6')](_0xe8e7('0xef'),_0x165aed['name']))['emit'](_0xe8e7('0xf0'),{'user':{'id':_0x165aed['id'],'name':_0x165aed[_0xe8e7('0x39')]},'ip':_0x56c7fa[_0xe8e7('0xf1')][_0xe8e7('0xf2')]||_0x56c7fa[_0xe8e7('0xf3')][_0xe8e7('0xf4')]||_0x56c7fa[_0xe8e7('0xf5')][_0xe8e7('0xf4')]||_0x56c7fa[_0xe8e7('0xf3')][_0xe8e7('0xf5')][_0xe8e7('0xf4')]});return db[_0xe8e7('0xa9')]['destroy']({'where':{'membername':_0x165aed[_0xe8e7('0x39')]},'individualHooks':!![]});}}else{throw new db[(_0xe8e7('0x8e'))]['ValidationError'](_0xe8e7('0xf6'));}})[_0xe8e7('0x25')](function(){if(_0x165aed){return _0x165aed[_0xe8e7('0xf7')]({'raw':!![]});}})[_0xe8e7('0x25')](function(_0x367dfb){if(_0x165aed){if(_0x367dfb){_0x1f09f8=_0x367dfb;if(_0x1f09f8[_0xe8e7('0x4c')]){var _0x526c56=_0x1f09f8[_0xe8e7('0x33')](function(_0xf7109a){var _0x44233c={'membername':_0x165aed['name'],'UserId':_0x165aed['id'],'queue_name':_0xf7109a[_0xe8e7('0x39')],'VoiceQueueId':_0xf7109a['id'],'interface':_0x38914a,'paused':_0x165aed[_0xe8e7('0xed')]||![],'penalty':_0xf7109a[_0xe8e7('0xf8')]||0x0};return db['UserVoiceQueueRt']['upsert'](_0x44233c);});return Promise[_0xe8e7('0x5e')](_0x526c56);}}}})[_0xe8e7('0x25')](function(){if(_0x165aed){return db[_0xe8e7('0xf9')][_0xe8e7('0x49')]({'where':{'membername':_0x165aed[_0xe8e7('0x39')],'exitAt':null}});}})[_0xe8e7('0x25')](function(_0x5de938){if(_0x165aed){var _0x273643=[];_0x5de938['forEach'](function(_0x5aaa50){_0x273643['push'](_0x5aaa50[_0xe8e7('0x5f')]({'exitAt':moment()[_0xe8e7('0xa6')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0xe8e7('0x5e')](_0x273643);}})[_0xe8e7('0x25')](function(){if(_0x165aed){var _0xe4992b=[];var _0x11ede6=[];var _0x3cd004=utils[_0xe8e7('0xfa')]();var _0x444230={'membername':_0x165aed[_0xe8e7('0x39')],'interface':_0x38914a,'enterAt':moment()['format'](_0xe8e7('0xfb')),'role':_0x165aed[_0xe8e7('0x26')],'internal':_0x165aed[_0xe8e7('0x65')]};_0x3cd004['forEach'](function(_0x1e4fb6){_0xe4992b['push'](_[_0xe8e7('0xce')]({'channel':_0x1e4fb6,'type':_0xe8e7('0xfc'),'data1':_0x56c7fa['body'][_0xe8e7('0xfd')],'data2':_0x38914a},_0x444230));if(_0x165aed[_0xe8e7('0xed')]){_0x11ede6['push'](_[_0xe8e7('0xce')]({'channel':_0x1e4fb6,'type':_0xe8e7('0xfe'),'data1':_0xe8e7('0xff')},_0x444230));}});return db['MemberReport'][_0xe8e7('0x100')](_0xe4992b[_0xe8e7('0xc9')](_0x11ede6),{'individualHooks':!![]});}})[_0xe8e7('0x25')](function(){if(_0x165aed){return _0x165aed[_0xe8e7('0x5f')]({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x165aed[_0xe8e7('0xed')]||![],'mailPause':_0x165aed['loginInPause']||![],'chatPause':_0x165aed[_0xe8e7('0xed')]||![],'faxPause':_0x165aed[_0xe8e7('0xed')]||![],'smsPause':_0x165aed['loginInPause']||![],'openchannelPause':_0x165aed[_0xe8e7('0xed')]||![],'whatsappPause':_0x165aed['loginInPause']||![],'pauseType':_0x165aed[_0xe8e7('0xed')]?'LOGININPAUSE':null,'interface':_0x38914a,'lastPauseAt':moment()[_0xe8e7('0xa6')](_0xe8e7('0xfb'))});}})['then'](function(_0x430ee8){if(_0x56c7fa[_0xe8e7('0x101')]){return _0x677b14();}else{return Promise[_0xe8e7('0x102')](_0x430ee8)['then'](respondWithResult(_0x2e2d64,null));}})[_0xe8e7('0x1b')](handleError(_0x2e2d64,null));};exports[_0xe8e7('0x103')]=function(_0x209e3f,_0x3c51dd){var _0x38e2d1;return db[_0xe8e7('0x41')][_0xe8e7('0x36')]({'where':{'id':_0x209e3f[_0xe8e7('0x54')]['id'],'role':'agent'},'attributes':['id',_0xe8e7('0x39'),_0xe8e7('0x26')]})['then'](handleEntityNotFound(_0x3c51dd,null))[_0xe8e7('0x25')](function(_0x214a0e){if(_0x214a0e){_0x38e2d1=_0x214a0e;return db[_0xe8e7('0xa9')][_0xe8e7('0x2a')]({'where':{'membername':_0x38e2d1[_0xe8e7('0x39')]},'individualHooks':!![]});}})[_0xe8e7('0x25')](function(){return db[_0xe8e7('0xf9')][_0xe8e7('0x49')]({'where':{'membername':_0x38e2d1[_0xe8e7('0x39')],'exitAt':null}});})[_0xe8e7('0x25')](function(_0x15227c){var _0x3eea29=[];_0x15227c['forEach'](function(_0x4a4d96){_0x3eea29[_0xe8e7('0x48')](_0x4a4d96[_0xe8e7('0x5f')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0xe8e7('0x5e')](_0x3eea29);})['then'](function(){return _0x38e2d1[_0xe8e7('0x5f')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xe8e7('0x25')](respondWithResult(_0x3c51dd,null))['catch'](handleError(_0x3c51dd,null));};exports[_0xe8e7('0x104')]=function(_0xf18d10,_0x42a601){var _0x29b273;return db[_0xe8e7('0xa9')]['update']({'paused':0x1},{'where':{'UserId':_0xf18d10[_0xe8e7('0x54')]['id']},'individualHooks':!![]})[_0xe8e7('0x25')](function(){return db['User']['find']({'where':{'id':_0xf18d10[_0xe8e7('0x54')]['id'],'role':_0xe8e7('0x27')},'attributes':['id',_0xe8e7('0x39'),'role',_0xe8e7('0x65'),_0xe8e7('0x9d'),_0xe8e7('0xa5')]});})[_0xe8e7('0x25')](handleEntityNotFound(_0x42a601,null))[_0xe8e7('0x25')](function(_0xa9e390){if(_0xa9e390){_0x29b273=_0xa9e390;return respondWithRpcPromise('QueuePause',_0xe8e7('0x104'),{'id':_0x29b273['id'],'name':_0x29b273[_0xe8e7('0x39')],'pause':!![]});}})[_0xe8e7('0x25')](function(){if(_0x29b273){return db[_0xe8e7('0xf9')][_0xe8e7('0x49')]({'where':{'membername':_0x29b273['name'],'type':_0xe8e7('0xfe'),'exitAt':null}});}})[_0xe8e7('0x25')](function(_0x4064be){if(_0x4064be[_0xe8e7('0x4c')]){var _0x2a495a=moment()[_0xe8e7('0xa6')](_0xe8e7('0xfb'));for(var _0x47cb41=0x0,_0x107e8d=_0x4064be[_0xe8e7('0x4c')];_0x47cb41<_0x107e8d;_0x47cb41++){_0x4064be[_0x47cb41][_0xe8e7('0x105')]({'exitAt':_0x2a495a});}}})[_0xe8e7('0x25')](function(){var _0x1ef194=[];var _0x680ce1=utils[_0xe8e7('0xfa')]();_0x680ce1[_0xe8e7('0x106')](function(_0x47ada8){_0x1ef194[_0xe8e7('0x48')]({'channel':_0x47ada8,'membername':_0x29b273[_0xe8e7('0x39')],'interface':_[_0xe8e7('0x6b')](_0x29b273[_0xe8e7('0x9d')])?util[_0xe8e7('0xa6')](_0xe8e7('0xa7'),_0x29b273[_0xe8e7('0x39')]):_0x29b273[_0xe8e7('0x9d')],'type':_0xe8e7('0xfe'),'enterAt':moment()[_0xe8e7('0xa6')](_0xe8e7('0xfb')),'data1':_0xf18d10['body'][_0xe8e7('0x3c')]||_0xe8e7('0x107'),'role':_0x29b273[_0xe8e7('0x26')],'internal':_0x29b273[_0xe8e7('0x65')]});});return db[_0xe8e7('0xf9')][_0xe8e7('0x100')](_0x1ef194,{'individualHooks':!![]});})['then'](function(){return _0x29b273[_0xe8e7('0x5f')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0xf18d10[_0xe8e7('0x60')][_0xe8e7('0x3c')]||_0xe8e7('0x107'),'lastPauseAt':moment()['format'](_0xe8e7('0xfb'))});})[_0xe8e7('0x25')](respondWithResult(_0x42a601,null))[_0xe8e7('0x1b')](handleError(_0x42a601,null));};exports[_0xe8e7('0x108')]=function(_0x12aa06,_0x438127){if(_0x12aa06[_0xe8e7('0x60')][_0xe8e7('0xab')]&&!utils[_0xe8e7('0x9e')](_0x12aa06[_0xe8e7('0x60')]['channel'])){throw new APIBadRequestError(util[_0xe8e7('0xa6')](_0xe8e7('0x109'),_0x12aa06[_0xe8e7('0x60')][_0xe8e7('0xab')]));}return db['User'][_0xe8e7('0x36')]({'where':{'id':_0x12aa06[_0xe8e7('0x54')]['id']},'attributes':['id','name',_0xe8e7('0x26'),_0xe8e7('0x65'),_0xe8e7('0x9d'),'online','voicePause','mailPause',_0xe8e7('0x10a'),_0xe8e7('0x10b'),_0xe8e7('0x10c'),_0xe8e7('0x10d'),_0xe8e7('0x10e'),_0xe8e7('0x10f'),_0xe8e7('0x110')]})['then'](function(_0x1b6e4c){if(!_0x1b6e4c){throw new APINotFoundError(util[_0xe8e7('0xa6')](_0xe8e7('0x111'),_0x12aa06[_0xe8e7('0x54')]['id']));}return _0x1b6e4c['unpause'](_0x12aa06[_0xe8e7('0x60')][_0xe8e7('0xab')]);})[_0xe8e7('0x25')](respondWithResult(_0x438127,null))[_0xe8e7('0x1b')](APIHandleError(_0x438127));};exports[_0xe8e7('0x112')]=function(_0x431439,_0xa7a786){var _0x20f246={};var _0x5f547f={};var _0x109d67;var _0x3c9e32;return db[_0xe8e7('0x41')][_0xe8e7('0x95')]({'where':{'id':_0x431439[_0xe8e7('0x54')]['id']}})[_0xe8e7('0x25')](handleEntityNotFound(_0xa7a786,null))[_0xe8e7('0x25')](function(_0x2e9a0a){if(_0x2e9a0a){_0x109d67=_0x2e9a0a;_0x5f547f[_0xe8e7('0x55')]=_[_0xe8e7('0x58')](db[_0xe8e7('0x113')][_0xe8e7('0x57')]);_0x5f547f['query']=_['keys'](_0x431439['query']);_0x5f547f[_0xe8e7('0x59')]=_['intersection'](_0x5f547f[_0xe8e7('0x55')],_0x5f547f['query']);_0x20f246[_0xe8e7('0x47')]=_[_0xe8e7('0x5a')](_0x5f547f[_0xe8e7('0x55')],qs[_0xe8e7('0x5b')](_0x431439[_0xe8e7('0x42')]['fields']));_0x20f246[_0xe8e7('0x47')]=_0x20f246[_0xe8e7('0x47')][_0xe8e7('0x4c')]?_0x20f246['attributes']:_0x5f547f[_0xe8e7('0x55')];_0x20f246[_0xe8e7('0xcb')]=qs['sort'](_0x431439[_0xe8e7('0x42')]['sort']);_0x20f246[_0xe8e7('0x40')]=qs[_0xe8e7('0x59')](_['pick'](_0x431439['query'],_0x5f547f[_0xe8e7('0x59')]));if(_0x431439[_0xe8e7('0x42')][_0xe8e7('0x31')]){_0x20f246[_0xe8e7('0x40')]=_['merge'](_0x20f246[_0xe8e7('0x40')],{'$or':_['map'](_0x20f246[_0xe8e7('0x47')],function(_0x2c9fb8){var _0x21bf6c={};_0x21bf6c[_0x2c9fb8]={'$like':'%'+_0x431439[_0xe8e7('0x42')][_0xe8e7('0x31')]+'%'};return _0x21bf6c;})});}_0x20f246=_[_0xe8e7('0xce')]({},_0x20f246,_0x431439[_0xe8e7('0x5d')]);return _0x109d67[_0xe8e7('0x112')](_0x20f246);}})[_0xe8e7('0x25')](function(_0x323245){if(_0x323245){_0x3c9e32=_0x323245[_0xe8e7('0x4c')];if(!_0x431439[_0xe8e7('0x42')][_0xe8e7('0xd4')](_0xe8e7('0xd5'))){_0x20f246['limit']=qs[_0xe8e7('0x21')](_0x431439[_0xe8e7('0x42')]['limit']);_0x20f246[_0xe8e7('0xd6')]=qs[_0xe8e7('0xd6')](_0x431439[_0xe8e7('0x42')]['offset']);}return _0x109d67['getTeams'](_0x20f246);}})['then'](function(_0x35868c){if(_0x35868c){return _0x35868c?{'count':_0x3c9e32,'rows':_0x35868c}:null;}})[_0xe8e7('0x25')](respondWithResult(_0xa7a786,null))[_0xe8e7('0x1b')](handleError(_0xa7a786,null));};exports[_0xe8e7('0x114')]=function(_0x8a8dea,_0x2d70ec){var _0x356b1a=_0x8a8dea[_0xe8e7('0x54')]['id'];var _0x5cf1db=_0x8a8dea[_0xe8e7('0x60')]?_0x8a8dea['body'][_0xe8e7('0x63')]:null;var _0x369530=[];return Promise[_0xe8e7('0x102')]()[_0xe8e7('0x25')](function(){if(!_0x5cf1db)throw new APIBadRequestError(_0xe8e7('0x115'));})[_0xe8e7('0x25')](function(){return db['User']['findOne']({'where':{'id':_0x356b1a}});})['then'](function(_0xb3857d){if(!_0xb3857d)throw new APINotFoundError(util[_0xe8e7('0xa6')](_0xe8e7('0x111'),_0x8a8dea[_0xe8e7('0x54')]['id']));return db[_0xe8e7('0x6c')][_0xe8e7('0x116')](function(_0x39347e){return _0xb3857d[_0xe8e7('0x114')](_0x5cf1db,{'transaction':_0x39347e})[_0xe8e7('0x25')](function(){return db[_0xe8e7('0x113')][_0xe8e7('0x49')]({'where':{'id':{'$in':_0x5cf1db}}});})[_0xe8e7('0x25')](function(_0x31b915){var _0x72249e=_['map'](_0x31b915,function(_0x2ed10d){return _0x2ed10d['getAssociatedQueues']();});return Promise['all'](_0x72249e);})[_0xe8e7('0x25')](function(_0x30ef6f){_0x369530=_[_0xe8e7('0x117')](_0x30ef6f);var _0x504888=_[_0xe8e7('0x33')](_0x369530,function(_0x274a40){return _0x274a40['addAgent'](_0xb3857d['id'],{'transaction':_0x39347e});});return Promise[_0xe8e7('0x5e')](_0x504888);})[_0xe8e7('0x25')](function(){if(!_0xb3857d['online'])return;var _0x401e12=_['filter'](_0x369530,function(_0x23f6a4){return _0x23f6a4[_0xe8e7('0x118')](_0xe8e7('0xab'))===_0xe8e7('0x119');});var _0xb4104d=_[_0xe8e7('0x33')](_0x401e12,function(_0x3071da){return db[_0xe8e7('0xa9')][_0xe8e7('0x11a')]({'membername':_0xb3857d['name'],'UserId':_0xb3857d['id'],'queue_name':_0x3071da['name'],'VoiceQueueId':_0x3071da['id'],'interface':_['isNil'](_0xb3857d[_0xe8e7('0x9d')])?util['format'](_0xe8e7('0xa7'),_0xb3857d['name']):_0xb3857d[_0xe8e7('0x9d')],'paused':_0xb3857d[_0xe8e7('0x9c')]||![],'penalty':_0xb3857d[_0xe8e7('0xa8')]},{'transaction':_0x39347e});});return Promise[_0xe8e7('0x5e')](_0xb4104d);})[_0xe8e7('0x25')](function(){return db[_0xe8e7('0x11b')][_0xe8e7('0x49')]({'where':{'teamId':{'$in':_0x5cf1db}}});})[_0xe8e7('0x25')](function(_0xc478f3){var _0x6594f=_[_0xe8e7('0x33')](_0xc478f3,function(_0x4da3ca){return db['UserVoicePrefix'][_0xe8e7('0x7f')]({'UserId':_0xb3857d['id'],'VoicePrefixId':_0x4da3ca[_0xe8e7('0x11c')]},{'transaction':_0x39347e});});return Promise[_0xe8e7('0x5e')](_0x6594f);});});})[_0xe8e7('0x25')](function(){for(var _0x5dca26=0x0;_0x5dca26<_0x369530['length'];_0x5dca26++){var _0x19b552=_0x369530[_0x5dca26][_0xe8e7('0x118')]('channel');var _0x9d8374=_0x19b552+'QueueId';socket[_0xe8e7('0x28')](_0xe8e7('0x2e')+_0x19b552+_0xe8e7('0x11d'),{'UserId':_0x356b1a,['queueField']:_0x369530[_0x5dca26]['id']});}})[_0xe8e7('0x25')](respondWithStatusCode(_0x2d70ec,null))[_0xe8e7('0x1b')](APIHandleError(_0x2d70ec));};exports[_0xe8e7('0x11e')]=function(_0x21cd73,_0x2ddc98){var _0x32d829=_0x21cd73[_0xe8e7('0x54')]['id'];var _0x1da0df=null;if(_0x21cd73['query'][_0xe8e7('0x63')]){_0x1da0df=_[_0xe8e7('0xae')](_0x21cd73['query']['ids'])?_0x21cd73[_0xe8e7('0x42')][_0xe8e7('0x63')]:[_0x21cd73['query'][_0xe8e7('0x63')]];}var _0x599acb=[];return Promise[_0xe8e7('0x102')]()[_0xe8e7('0x25')](function(){if(!_0x1da0df)throw new APIBadRequestError(_0xe8e7('0x11f'));})['then'](function(){return db[_0xe8e7('0x41')][_0xe8e7('0x95')]({'where':{'id':_0x32d829}});})[_0xe8e7('0x25')](function(_0x1d0994){if(!_0x1d0994)throw new APINotFoundError(util[_0xe8e7('0xa6')]('User\x20with\x20id\x20%s\x20not\x20found',_0x21cd73[_0xe8e7('0x54')]['id']));return db[_0xe8e7('0x6c')]['transaction'](function(_0x224389){return _0x1d0994['removeTeams'](_0x1da0df,{'transaction':_0x224389})[_0xe8e7('0x25')](function(){return db['Team'][_0xe8e7('0x49')]({'where':{'id':{'$in':_0x1da0df}}});})['then'](function(_0x223558){var _0x3c40e3=_['map'](_0x223558,function(_0x57ed36){return _0x57ed36[_0xe8e7('0x120')]();});return Promise[_0xe8e7('0x5e')](_0x3c40e3);})[_0xe8e7('0x25')](function(_0x568049){_0x599acb=_[_0xe8e7('0x117')](_0x568049);var _0x5b437c=_[_0xe8e7('0x33')](_0x599acb,function(_0x1dfd96){return _0x1dfd96[_0xe8e7('0x121')](_0x1d0994['id'],{'transaction':_0x224389});});return Promise[_0xe8e7('0x5e')](_0x5b437c);})[_0xe8e7('0x25')](function(){if(!_0x1d0994[_0xe8e7('0xa5')])return;var _0x3ff635=_[_0xe8e7('0x31')](_0x599acb,function(_0x50e9c3){return _0x50e9c3['getDataValue'](_0xe8e7('0xab'))===_0xe8e7('0x119');});var _0x1c57e7=_['map'](_0x3ff635,function(_0x4079e7){return db[_0xe8e7('0xa9')][_0xe8e7('0x2a')]({'where':{'VoiceQueueId':_0x4079e7['id'],'UserId':_0x1d0994['id']},'transaction':_0x224389});});return Promise[_0xe8e7('0x5e')](_0x1c57e7);})['then'](function(){return db[_0xe8e7('0x11b')][_0xe8e7('0x49')]({'where':{'teamId':{'$in':_0x1da0df}}});})[_0xe8e7('0x25')](function(_0x1e6e57){var _0x40b6f2=_[_0xe8e7('0x33')](_0x1e6e57,function(_0x2cd672){return db[_0xe8e7('0x122')][_0xe8e7('0x2a')]({'where':{'UserId':_0x1d0994['id'],'VoicePrefixId':_0x2cd672[_0xe8e7('0x11c')]}},{'transaction':_0x224389});});return Promise['all'](_0x40b6f2);});});})['then'](function(){for(var _0x27788c=0x0;_0x27788c<_0x599acb[_0xe8e7('0x4c')];_0x27788c++){var _0x329829=_0x599acb[_0x27788c][_0xe8e7('0x118')](_0xe8e7('0xab'));var _0xfcc534=_0x329829+_0xe8e7('0xa3');socket[_0xe8e7('0x28')](_0xe8e7('0x2e')+_0x329829+_0xe8e7('0xaf'),{'UserId':_0x32d829,['queueField']:_0x599acb[_0x27788c]['id']});}})['then'](respondWithStatusCode(_0x2ddc98,null))[_0xe8e7('0x1b')](APIHandleError(_0x2ddc98));};exports['getLists']=function(_0x1a7254,_0x4ce087){var _0x3fb437={};var _0x3f5573={};var _0x4eb79b;var _0x47cf91;return db[_0xe8e7('0x41')][_0xe8e7('0x95')]({'where':{'id':_0x1a7254[_0xe8e7('0x54')]['id']}})[_0xe8e7('0x25')](handleEntityNotFound(_0x4ce087,null))[_0xe8e7('0x25')](function(_0x2095bd){if(_0x2095bd){_0x4eb79b=_0x2095bd;_0x3f5573[_0xe8e7('0x55')]=_['keys'](db[_0xe8e7('0xcf')][_0xe8e7('0x57')]);_0x3f5573[_0xe8e7('0x42')]=_[_0xe8e7('0x58')](_0x1a7254[_0xe8e7('0x42')]);_0x3f5573[_0xe8e7('0x59')]=_[_0xe8e7('0x5a')](_0x3f5573[_0xe8e7('0x55')],_0x3f5573[_0xe8e7('0x42')]);_0x3fb437[_0xe8e7('0x47')]=_[_0xe8e7('0x5a')](_0x3f5573['model'],qs['fields'](_0x1a7254[_0xe8e7('0x42')]['fields']));_0x3fb437['attributes']=_0x3fb437[_0xe8e7('0x47')][_0xe8e7('0x4c')]?_0x3fb437['attributes']:_0x3f5573[_0xe8e7('0x55')];_0x3fb437['order']=qs[_0xe8e7('0xcc')](_0x1a7254['query'][_0xe8e7('0xcc')]);_0x3fb437[_0xe8e7('0x40')]=qs['filters'](_[_0xe8e7('0xcd')](_0x1a7254[_0xe8e7('0x42')],_0x3f5573[_0xe8e7('0x59')]));if(_0x1a7254[_0xe8e7('0x42')][_0xe8e7('0x31')]){_0x3fb437['where']=_[_0xe8e7('0xce')](_0x3fb437[_0xe8e7('0x40')],{'$or':_[_0xe8e7('0x33')](_0x3fb437['attributes'],function(_0x4febd6){var _0x530da4={};_0x530da4[_0x4febd6]={'$like':'%'+_0x1a7254[_0xe8e7('0x42')][_0xe8e7('0x31')]+'%'};return _0x530da4;})});}_0x3fb437=_[_0xe8e7('0xce')]({},_0x3fb437,_0x1a7254[_0xe8e7('0x5d')]);return _0x4eb79b[_0xe8e7('0x123')](_0x3fb437);}})[_0xe8e7('0x25')](function(_0x188fed){if(_0x188fed){_0x47cf91=_0x188fed[_0xe8e7('0x4c')];if(!_0x1a7254['query']['hasOwnProperty'](_0xe8e7('0xd5'))){_0x3fb437['limit']=qs[_0xe8e7('0x21')](_0x1a7254[_0xe8e7('0x42')]['limit']);_0x3fb437['offset']=qs[_0xe8e7('0xd6')](_0x1a7254['query'][_0xe8e7('0xd6')]);}return _0x4eb79b[_0xe8e7('0x123')](_0x3fb437);}})[_0xe8e7('0x25')](function(_0x538781){if(_0x538781){return _0x538781?{'count':_0x47cf91,'rows':_0x538781}:null;}})[_0xe8e7('0x25')](respondWithResult(_0x4ce087,null))[_0xe8e7('0x1b')](handleError(_0x4ce087,null));};exports[_0xe8e7('0x124')]=function(_0x810320,_0x9c0aec){var _0x3c9b1c={};var _0x160ce0={};var _0x1e810d;return db[_0xe8e7('0x41')][_0xe8e7('0x95')]({'where':{'id':_0x810320[_0xe8e7('0x54')]['id']}})[_0xe8e7('0x25')](handleEntityNotFound(_0x9c0aec,null))[_0xe8e7('0x25')](function(_0x247f02){if(_0x247f02){_0x1e810d=_0x247f02;_0x160ce0[_0xe8e7('0x55')]=_['keys'](db[_0xe8e7('0x41')]['rawAttributes']);_0x160ce0[_0xe8e7('0x42')]=_['keys'](_0x810320['query']);_0x160ce0[_0xe8e7('0x59')]=_['intersection'](_0x160ce0[_0xe8e7('0x55')],_0x160ce0[_0xe8e7('0x42')]);_0x3c9b1c[_0xe8e7('0x47')]=_[_0xe8e7('0x5a')](_0x160ce0[_0xe8e7('0x55')],qs['fields'](_0x810320[_0xe8e7('0x42')][_0xe8e7('0x5b')]));_0x3c9b1c[_0xe8e7('0x47')]=_0x3c9b1c[_0xe8e7('0x47')][_0xe8e7('0x4c')]?_0x3c9b1c[_0xe8e7('0x47')]:_0x160ce0[_0xe8e7('0x55')];_0x3c9b1c['order']=qs['sort'](_0x810320[_0xe8e7('0x42')]['sort']);_0x3c9b1c[_0xe8e7('0x40')]=qs[_0xe8e7('0x59')](_[_0xe8e7('0xcd')](_0x810320[_0xe8e7('0x42')],_0x160ce0[_0xe8e7('0x59')]));if(_0x810320[_0xe8e7('0x42')][_0xe8e7('0x31')]){_0x3c9b1c[_0xe8e7('0x40')]=_[_0xe8e7('0xce')](_0x3c9b1c[_0xe8e7('0x40')],{'$or':_[_0xe8e7('0x33')](_0x3c9b1c['attributes'],function(_0x5aaa0e){var _0x5a56cb={};_0x5a56cb[_0x5aaa0e]={'$like':'%'+_0x810320[_0xe8e7('0x42')][_0xe8e7('0x31')]+'%'};return _0x5a56cb;})});}_0x3c9b1c[_0xe8e7('0x55')]=db['User'];_0x3c9b1c['as']='Agents';_0x3c9b1c=_['merge']({},_0x3c9b1c,_0x810320[_0xe8e7('0x5d')]);return _0x1e810d[_0xe8e7('0xf7')]({'include':[_0x3c9b1c]});}})[_0xe8e7('0x25')](function(_0x40119b){if(_0x40119b){var _0x58e25f={},_0x3c65fe=[];for(var _0x4104a1=0x0;_0x4104a1<_0x40119b[_0xe8e7('0x4c')];_0x4104a1+=0x1){for(var _0x58d6d8=0x0,_0x3b3435;_0x58d6d8<_0x40119b[_0x4104a1][_0xe8e7('0x2f')][_0xe8e7('0x4c')];_0x58d6d8+=0x1){_0x3b3435=_0x40119b[_0x4104a1][_0xe8e7('0x2f')][_0x58d6d8][_0xe8e7('0x2b')]({'plain':!![]});_0x58e25f[_0x3b3435['id']]=_0x3b3435;}}_0x58e25f=_['values'](_0x58e25f);for(var _0x3e36c2=qs[_0xe8e7('0xd6')](_0x810320[_0xe8e7('0x42')][_0xe8e7('0xd6')]);_0x3e36c2<_0x58e25f[_0xe8e7('0x4c')]&&_0x3c65fe['length']=_0x581dd9[_0xc481('0x4e')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0xc481('0x14')](function(){if(_0xa3922c){return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0xa3922c[_0xc481('0x1f')]},'individualHooks':!![]});}})[_0xc481('0x14')](function(){if(_0xa3922c){return _0xa3922c[_0xc481('0x4f')]({'raw':!![]});}})[_0xc481('0x14')](function(_0x33dc15){if(_0xa3922c){if(_0x33dc15){var _0xd25e6c=[];_0x5cc0d9=_0x33dc15;if(_0x5cc0d9['length']){for(var _0x180e76=0x0;_0x180e76<_0x5cc0d9[_0xc481('0x26')];_0x180e76++){_0xd25e6c[_0xc481('0x28')](db[_0xc481('0x25')][_0xc481('0x50')]({'membername':_0xa3922c[_0xc481('0x1f')],'UserId':_0xa3922c['id'],'queue_name':_0x5cc0d9[_0x180e76][_0xc481('0x1f')],'VoiceQueueId':_0x5cc0d9[_0x180e76]['id'],'interface':_0x333254,'paused':_0xa3922c[_0xc481('0x48')]||![],'penalty':_0x5cc0d9[_0x180e76][_0xc481('0x51')]||0x0}));}return BPromise[_0xc481('0x43')](_0xd25e6c);}}}})['then'](function(){if(_0xa3922c){return db[_0xc481('0x41')][_0xc481('0xe')]({'where':{'membername':_0xa3922c[_0xc481('0x1f')],'exitAt':null}});}})[_0xc481('0x14')](function(_0x3194aa){if(_0xa3922c){if(_0x3194aa&&_0x3194aa[_0xc481('0x26')]){var _0x5e96e6=[];_0x3194aa[_0xc481('0x42')](function(_0x2d855e){_0x5e96e6[_0xc481('0x28')](_0x2d855e[_0xc481('0x44')]({'exitAt':moment()[_0xc481('0x23')](_0xc481('0x2a'))}));});return BPromise['all'](_0x5e96e6);}}})['then'](function(){if(_0xa3922c){var _0x3d80a0=[];var _0x566569=[];var _0x2ead70=utils[_0xc481('0x52')]();var _0x4b3881={'membername':_0xa3922c[_0xc481('0x1f')],'interface':_0x333254,'enterAt':moment()[_0xc481('0x23')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xa3922c['role'],'internal':_0xa3922c[_0xc481('0x21')]};_0x2ead70[_0xc481('0x42')](function(_0x1d815f){_0x3d80a0[_0xc481('0x28')](_['merge']({'channel':_0x1d815f,'type':_0xc481('0x53'),'data1':'callysquare','data2':_0x333254},_0x4b3881));if(_0xa3922c[_0xc481('0x48')]){_0x566569[_0xc481('0x28')](_[_0xc481('0x54')]({'channel':_0x1d815f,'type':_0xc481('0x29'),'data1':'LOGININPAUSE'},_0x4b3881));}});return db[_0xc481('0x41')][_0xc481('0x2f')](_0x3d80a0[_0xc481('0x55')](_0x566569),{'individualHooks':!![]});}})[_0xc481('0x14')](function(){if(_0xa3922c){return _0xa3922c[_0xc481('0x44')]({'online':!![],'lastLoginAt':moment()[_0xc481('0x23')](_0xc481('0x2a')),'voicePause':_0xa3922c[_0xc481('0x48')]||![],'mailPause':_0xa3922c[_0xc481('0x48')]||![],'chatPause':_0xa3922c[_0xc481('0x48')]||![],'faxPause':_0xa3922c[_0xc481('0x48')]||![],'smsPause':_0xa3922c[_0xc481('0x48')]||![],'openchannelPause':_0xa3922c['loginInPause']||![],'pauseType':_0xa3922c['loginInPause']?_0xc481('0x56'):null,'lastPauseAt':moment()[_0xc481('0x23')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x333254});}})['then'](function(_0x2bb10c){_0x3794f0(_0x2bb10c);})[_0xc481('0x17')](function(_0x4ca4f6){_0x24e305(_0x1787c1[_0xc481('0x18')](0x1f4,_0x4ca4f6[_0xc481('0x19')]));});});}; \ No newline at end of file +var _0xec19=['LogoutUser','UserVoiceQueueRt','forEach','all','LoginUser','phone','loginInPause','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','destroy','upsert','UserVoiceQueue.penalty','merge','LOGIN','callysquare','LOGININPAUSE','bulkCreate','concat','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','redis','defaults','socket.io-emitter','register','GetUser','User','findAll','options','raw','attributes','map','include','model','then','info','debug','stringify','catch','error','message','ShowUser','find','PauseUser','where','internal','interface','params','update','name','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','push','isNil','format','SIP/%s','body','type','DEFAULT\x20PAUSE','role','uniqueid','MemberReport','UnpauseUser','resolve','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','mailPause','openchannelPause','smsPause','pauseType','User\x20with\x20id\x20%s\x20not\x20found','unpause','system'];(function(_0x2aa9ea,_0x109517){var _0x3d0705=function(_0x17ee2b){while(--_0x17ee2b){_0x2aa9ea['push'](_0x2aa9ea['shift']());}};_0x3d0705(++_0x109517);}(_0xec19,0x6e));var _0x9ec1=function(_0x2af755,_0x4a91f3){_0x2af755=_0x2af755-0x0;var _0x352dfd=_0xec19[_0x2af755];return _0x352dfd;};'use strict';var _=require(_0x9ec1('0x0'));var util=require(_0x9ec1('0x1'));var moment=require(_0x9ec1('0x2'));var BPromise=require(_0x9ec1('0x3'));var Redis=require('ioredis');var db=require(_0x9ec1('0x4'))['db'];var utils=require(_0x9ec1('0x5'));var logger=require(_0x9ec1('0x6'))('rpc');var config=require(_0x9ec1('0x7'));config[_0x9ec1('0x8')]=_[_0x9ec1('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9ec1('0xa'))(new Redis(config['redis']));require('./user.socket')[_0x9ec1('0xb')](socket);exports[_0x9ec1('0xc')]=function(_0x2b6876){var _0x1e9d73=this;return new Promise(function(_0x8a0bf0,_0x295adb){return db[_0x9ec1('0xd')][_0x9ec1('0xe')]({'raw':_0x2b6876[_0x9ec1('0xf')]?_0x2b6876['options'][_0x9ec1('0x10')]===undefined?!![]:![]:!![],'where':_0x2b6876[_0x9ec1('0xf')]?_0x2b6876[_0x9ec1('0xf')]['where']||null:null,'attributes':_0x2b6876['options']?_0x2b6876[_0x9ec1('0xf')][_0x9ec1('0x11')]||null:null,'limit':_0x2b6876['options']?_0x2b6876[_0x9ec1('0xf')]['limit']||null:null,'include':_0x2b6876[_0x9ec1('0xf')]?_0x2b6876[_0x9ec1('0xf')]['include']?_[_0x9ec1('0x12')](_0x2b6876[_0x9ec1('0xf')][_0x9ec1('0x13')],function(_0x3cc4d8){return{'model':db[_0x3cc4d8[_0x9ec1('0x14')]],'as':_0x3cc4d8['as'],'attributes':_0x3cc4d8[_0x9ec1('0x11')],'include':_0x3cc4d8[_0x9ec1('0x13')]?_[_0x9ec1('0x12')](_0x3cc4d8[_0x9ec1('0x13')],function(_0x44df35){return{'model':db[_0x44df35[_0x9ec1('0x14')]],'as':_0x44df35['as'],'attributes':_0x44df35['attributes'],'include':_0x44df35[_0x9ec1('0x13')]?_[_0x9ec1('0x12')](_0x44df35[_0x9ec1('0x13')],function(_0x184f4e){return{'model':db[_0x184f4e[_0x9ec1('0x14')]],'as':_0x184f4e['as'],'attributes':_0x184f4e['attributes']};}):[]};}):[]};}):[]:[]})[_0x9ec1('0x15')](function(_0x3ae065){logger[_0x9ec1('0x16')](_0x9ec1('0xc'),_0x2b6876);logger[_0x9ec1('0x17')](_0x9ec1('0xc'),_0x2b6876,JSON[_0x9ec1('0x18')](_0x3ae065));_0x8a0bf0(_0x3ae065);})[_0x9ec1('0x19')](function(_0x97d3c0){logger['error']('GetUser',_0x97d3c0['message'],_0x2b6876);_0x295adb(_0x1e9d73[_0x9ec1('0x1a')](0x1f4,_0x97d3c0[_0x9ec1('0x1b')]));});});};exports[_0x9ec1('0x1c')]=function(_0x10d6ab){var _0x27e1cb=this;return new Promise(function(_0x40e93f,_0x338916){return db[_0x9ec1('0xd')][_0x9ec1('0x1d')]({'raw':_0x10d6ab[_0x9ec1('0xf')]?_0x10d6ab[_0x9ec1('0xf')]['raw']===undefined?!![]:![]:!![],'where':_0x10d6ab['options']?_0x10d6ab[_0x9ec1('0xf')]['where']||null:null,'attributes':_0x10d6ab[_0x9ec1('0xf')]?_0x10d6ab[_0x9ec1('0xf')]['attributes']||null:null,'include':_0x10d6ab[_0x9ec1('0xf')]?_0x10d6ab[_0x9ec1('0xf')][_0x9ec1('0x13')]?_[_0x9ec1('0x12')](_0x10d6ab['options'][_0x9ec1('0x13')],function(_0x56b59a){return{'model':db[_0x56b59a[_0x9ec1('0x14')]],'as':_0x56b59a['as'],'attributes':_0x56b59a['attributes'],'include':_0x56b59a[_0x9ec1('0x13')]?_[_0x9ec1('0x12')](_0x56b59a[_0x9ec1('0x13')],function(_0x34d90a){return{'model':db[_0x34d90a['model']],'as':_0x34d90a['as'],'attributes':_0x34d90a[_0x9ec1('0x11')],'include':_0x34d90a['include']?_[_0x9ec1('0x12')](_0x34d90a[_0x9ec1('0x13')],function(_0x2c485a){return{'model':db[_0x2c485a[_0x9ec1('0x14')]],'as':_0x2c485a['as'],'attributes':_0x2c485a[_0x9ec1('0x11')]};}):[]};}):[]};}):[]:[]})[_0x9ec1('0x15')](function(_0x1a24f5){logger[_0x9ec1('0x16')]('ShowUser',_0x10d6ab);logger['debug'](_0x9ec1('0x1c'),_0x10d6ab,JSON[_0x9ec1('0x18')](_0x1a24f5));_0x40e93f(_0x1a24f5);})[_0x9ec1('0x19')](function(_0x1afe31){logger[_0x9ec1('0x1a')](_0x9ec1('0x1c'),_0x1afe31['message'],_0x10d6ab);_0x338916(_0x27e1cb[_0x9ec1('0x1a')](0x1f4,_0x1afe31['message']));});});};exports[_0x9ec1('0x1e')]=function(_0x206cc8){var _0x478f8c;return db[_0x9ec1('0xd')][_0x9ec1('0x1d')]({'where':_0x206cc8[_0x9ec1('0xf')][_0x9ec1('0x1f')]||{},'attributes':['id','name','role',_0x9ec1('0x20'),_0x9ec1('0x21')]})[_0x9ec1('0x15')](function(_0x2027df){if(!_0x2027df){throw new Error(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x206cc8[_0x9ec1('0x22')]['id']));}_0x478f8c=_0x2027df;return db['UserVoiceQueueRt'][_0x9ec1('0x23')]({'paused':0x1},{'where':{'UserId':_0x478f8c['id']},'individualHooks':!![]});})[_0x9ec1('0x15')](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x478f8c[_0x9ec1('0x24')],'type':_0x9ec1('0x25'),'exitAt':null}});})[_0x9ec1('0x15')](function(_0x371f88){if(_0x371f88&&_0x371f88[_0x9ec1('0x26')]){var _0x17be88=moment()['format'](_0x9ec1('0x27'));for(var _0x3870b8=0x0,_0x5c03f8=_0x371f88[_0x9ec1('0x26')];_0x3870b8<_0x5c03f8;_0x3870b8++){_0x371f88[_0x3870b8][_0x9ec1('0x28')]({'exitAt':_0x17be88});}}})[_0x9ec1('0x15')](function(){var _0x3e724f=[];var _0x14318a=utils[_0x9ec1('0x29')]();_0x14318a['forEach'](function(_0x5700c5){_0x3e724f[_0x9ec1('0x2a')]({'channel':_0x5700c5,'membername':_0x478f8c[_0x9ec1('0x24')],'interface':_[_0x9ec1('0x2b')](_0x478f8c['interface'])?util[_0x9ec1('0x2c')](_0x9ec1('0x2d'),_0x478f8c[_0x9ec1('0x24')]):_0x478f8c[_0x9ec1('0x21')],'type':_0x9ec1('0x25'),'enterAt':moment()[_0x9ec1('0x2c')](_0x9ec1('0x27')),'data1':_0x206cc8[_0x9ec1('0x2e')][_0x9ec1('0x2f')]||_0x9ec1('0x30'),'role':_0x478f8c[_0x9ec1('0x31')],'internal':_0x478f8c['internal'],'uniqueid':_0x206cc8[_0x9ec1('0x2e')][_0x9ec1('0x32')]||null});});return db[_0x9ec1('0x33')]['bulkCreate'](_0x3e724f,{'individualHooks':!![]});})[_0x9ec1('0x15')](function(){return _0x478f8c[_0x9ec1('0x23')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x206cc8[_0x9ec1('0x2e')]['type']||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x9ec1('0x2c')]('YYYY-MM-DD\x20HH:mm:ss')});})['catch'](function(_0x1874e3){throw _0x1874e3;});};exports[_0x9ec1('0x34')]=function(_0x4ad4c4){return Promise[_0x9ec1('0x35')]()[_0x9ec1('0x15')](function(){if(_0x4ad4c4[_0x9ec1('0x2e')][_0x9ec1('0x36')]&&!utils[_0x9ec1('0x37')](_0x4ad4c4[_0x9ec1('0x2e')][_0x9ec1('0x36')])){throw new Error(util[_0x9ec1('0x2c')](_0x9ec1('0x38'),_0x4ad4c4['body']['channel']));}return db['User'][_0x9ec1('0x39')]({'where':_0x4ad4c4['options'][_0x9ec1('0x1f')]||{},'attributes':['id',_0x9ec1('0x24'),_0x9ec1('0x31'),_0x9ec1('0x20'),_0x9ec1('0x21'),_0x9ec1('0x3a'),'voicePause',_0x9ec1('0x3b'),'chatPause','faxPause',_0x9ec1('0x3c'),_0x9ec1('0x3d'),'whatsappPause',_0x9ec1('0x3e'),'lastPauseAt']});})['then'](function(_0x1264ab){if(!_0x1264ab){throw new Error(util['format'](_0x9ec1('0x3f'),_0x4ad4c4['params']['id']));}return _0x1264ab[_0x9ec1('0x40')](_0x4ad4c4[_0x9ec1('0x2e')][_0x9ec1('0x36')],_0x9ec1('0x41'));})[_0x9ec1('0x19')](function(_0x4352f7){throw _0x4352f7;});};exports[_0x9ec1('0x42')]=function(_0x475ff0){var _0x3dae08=this;return new Promise(function(_0x173160,_0x3ed606){var _0x4de0e6;return db[_0x9ec1('0xd')][_0x9ec1('0x39')]({'where':_0x475ff0[_0x9ec1('0xf')][_0x9ec1('0x1f')]||{},'attributes':['id',_0x9ec1('0x24')]})[_0x9ec1('0x15')](function(_0x5b1d80){if(_0x5b1d80){_0x4de0e6=_0x5b1d80;return db[_0x9ec1('0x43')]['destroy']({'where':{'membername':_0x4de0e6[_0x9ec1('0x24')]},'individualHooks':!![]});}})['then'](function(){if(_0x4de0e6){return db[_0x9ec1('0x33')][_0x9ec1('0xe')]({'where':{'membername':_0x4de0e6[_0x9ec1('0x24')],'exitAt':null}});}})[_0x9ec1('0x15')](function(_0x58c2aa){if(_0x4de0e6){if(_0x58c2aa&&_0x58c2aa[_0x9ec1('0x26')]){var _0x4722b4=[];_0x58c2aa[_0x9ec1('0x44')](function(_0x1247c0){_0x4722b4[_0x9ec1('0x2a')](_0x1247c0[_0x9ec1('0x23')]({'exitAt':moment()['format'](_0x9ec1('0x27'))}));});return BPromise[_0x9ec1('0x45')](_0x4722b4);}}})['then'](function(){if(_0x4de0e6){return _0x4de0e6[_0x9ec1('0x23')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x9ec1('0x15')](function(_0x3189c2){_0x173160(_0x3189c2);})['catch'](function(_0x151f28){_0x3ed606(_0x3dae08['error'](0x1f4,_0x151f28[_0x9ec1('0x1b')]));});});};exports[_0x9ec1('0x46')]=function(_0x232147){var _0x3c5393=this;return new Promise(function(_0x3ec2c3,_0x570a71){var _0x1ceab7;var _0x4f6802;var _0x5c1b0c;var _0x465344;return db[_0x9ec1('0xd')][_0x9ec1('0x39')]({'where':_0x232147['options'][_0x9ec1('0x1f')]||{},'attributes':['id','name',_0x9ec1('0x31'),'mobile',_0x9ec1('0x47'),'internal',_0x9ec1('0x48'),_0x9ec1('0x21')]})[_0x9ec1('0x15')](function(_0x3ae40a){if(_0x3ae40a){_0x1ceab7=_0x3ae40a;_0x465344=_0x232147[_0x9ec1('0x2e')][_0x9ec1('0x21')]?_0x232147['body'][_0x9ec1('0x21')]:util[_0x9ec1('0x2c')](_0x9ec1('0x2d'),_0x1ceab7['name']);return db[_0x9ec1('0xd')][_0x9ec1('0x49')]({'where':{'role':_0x9ec1('0x4a'),'online':!![],'id':{'$ne':_0x1ceab7['id']}}});}})[_0x9ec1('0x15')](function(_0x256ba3){if(_0x256ba3){_0x5c1b0c=_0x256ba3;return require(_0x9ec1('0x4b'))[_0x9ec1('0x4c')]();}})[_0x9ec1('0x15')](function(_0x512291){if(_0x512291&&_0x512291['agents']&&_0x5c1b0c>=_0x512291[_0x9ec1('0x4d')]){throw new Error(_0x9ec1('0x4e'));}})[_0x9ec1('0x15')](function(){if(_0x1ceab7){return db['UserVoiceQueueRt'][_0x9ec1('0x4f')]({'where':{'membername':_0x1ceab7[_0x9ec1('0x24')]},'individualHooks':!![]});}})[_0x9ec1('0x15')](function(){if(_0x1ceab7){return _0x1ceab7['getVoiceQueues']({'raw':!![]});}})[_0x9ec1('0x15')](function(_0x1cecf2){if(_0x1ceab7){if(_0x1cecf2){var _0x83bdae=[];_0x4f6802=_0x1cecf2;if(_0x4f6802[_0x9ec1('0x26')]){for(var _0x4d4894=0x0;_0x4d4894<_0x4f6802['length'];_0x4d4894++){_0x83bdae['push'](db['UserVoiceQueueRt'][_0x9ec1('0x50')]({'membername':_0x1ceab7[_0x9ec1('0x24')],'UserId':_0x1ceab7['id'],'queue_name':_0x4f6802[_0x4d4894]['name'],'VoiceQueueId':_0x4f6802[_0x4d4894]['id'],'interface':_0x465344,'paused':_0x1ceab7[_0x9ec1('0x48')]||![],'penalty':_0x4f6802[_0x4d4894][_0x9ec1('0x51')]||0x0}));}return BPromise[_0x9ec1('0x45')](_0x83bdae);}}}})[_0x9ec1('0x15')](function(){if(_0x1ceab7){return db[_0x9ec1('0x33')]['findAll']({'where':{'membername':_0x1ceab7['name'],'exitAt':null}});}})['then'](function(_0x5dcd6a){if(_0x1ceab7){if(_0x5dcd6a&&_0x5dcd6a[_0x9ec1('0x26')]){var _0x3f4c6c=[];_0x5dcd6a[_0x9ec1('0x44')](function(_0x13f701){_0x3f4c6c['push'](_0x13f701[_0x9ec1('0x23')]({'exitAt':moment()[_0x9ec1('0x2c')](_0x9ec1('0x27'))}));});return BPromise[_0x9ec1('0x45')](_0x3f4c6c);}}})[_0x9ec1('0x15')](function(){if(_0x1ceab7){var _0x432c3b=[];var _0x2f4984=[];var _0x25367c=utils[_0x9ec1('0x29')]();var _0x3393a3={'membername':_0x1ceab7[_0x9ec1('0x24')],'interface':_0x465344,'enterAt':moment()[_0x9ec1('0x2c')](_0x9ec1('0x27')),'role':_0x1ceab7['role'],'internal':_0x1ceab7['internal']};_0x25367c[_0x9ec1('0x44')](function(_0x1208b8){_0x432c3b['push'](_[_0x9ec1('0x52')]({'channel':_0x1208b8,'type':_0x9ec1('0x53'),'data1':_0x9ec1('0x54'),'data2':_0x465344},_0x3393a3));if(_0x1ceab7[_0x9ec1('0x48')]){_0x2f4984[_0x9ec1('0x2a')](_[_0x9ec1('0x52')]({'channel':_0x1208b8,'type':_0x9ec1('0x25'),'data1':_0x9ec1('0x55')},_0x3393a3));}});return db[_0x9ec1('0x33')][_0x9ec1('0x56')](_0x432c3b[_0x9ec1('0x57')](_0x2f4984),{'individualHooks':!![]});}})[_0x9ec1('0x15')](function(){if(_0x1ceab7){return _0x1ceab7['update']({'online':!![],'lastLoginAt':moment()['format'](_0x9ec1('0x27')),'voicePause':_0x1ceab7['loginInPause']||![],'mailPause':_0x1ceab7[_0x9ec1('0x48')]||![],'chatPause':_0x1ceab7['loginInPause']||![],'faxPause':_0x1ceab7[_0x9ec1('0x48')]||![],'smsPause':_0x1ceab7[_0x9ec1('0x48')]||![],'openchannelPause':_0x1ceab7[_0x9ec1('0x48')]||![],'pauseType':_0x1ceab7[_0x9ec1('0x48')]?_0x9ec1('0x55'):null,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x465344});}})['then'](function(_0x3292aa){_0x3ec2c3(_0x3292aa);})[_0x9ec1('0x19')](function(_0x22de08){_0x570a71(_0x3c5393[_0x9ec1('0x1a')](0x1f4,_0x22de08['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 3f1b2a9..8a2af5b 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 _0xe705=['register','length','./user.events','save','removeListener'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0xe705,0x1c9));var _0x5e70=function(_0x50b1c5,_0x1cf2a9){_0x50b1c5=_0x50b1c5-0x0;var _0x344f99=_0xe705[_0x50b1c5];return _0x344f99;};'use strict';var UserEvents=require(_0x5e70('0x0'));var events=[_0x5e70('0x1'),'remove','update'];function createListener(_0x3c1d45,_0x435b1b){return function(_0x41d0b0){_0x435b1b['emit'](_0x3c1d45,_0x41d0b0);};}function removeListener(_0x501d35,_0x2f5322){return function(){UserEvents[_0x5e70('0x2')](_0x501d35,_0x2f5322);};}exports[_0x5e70('0x3')]=function(_0x11b12e){for(var _0x19b735=0x0,_0x590a91=events[_0x5e70('0x4')];_0x19b735<_0x590a91;_0x19b735++){var _0x590b27=events[_0x19b735];var _0x375f00=createListener('user:'+_0x590b27,_0x11b12e);UserEvents['on'](_0x590b27,_0x375f00);}}; \ No newline at end of file +var _0x4493=['update','emit','removeListener','register','length','user:','./user.events','save','remove'];(function(_0x5bc5fe,_0x2afaef){var _0x298ea7=function(_0x1c6bd5){while(--_0x1c6bd5){_0x5bc5fe['push'](_0x5bc5fe['shift']());}};_0x298ea7(++_0x2afaef);}(_0x4493,0xcc));var _0x3449=function(_0x493c48,_0x1cde2b){_0x493c48=_0x493c48-0x0;var _0x322f84=_0x4493[_0x493c48];return _0x322f84;};'use strict';var UserEvents=require(_0x3449('0x0'));var events=[_0x3449('0x1'),_0x3449('0x2'),_0x3449('0x3')];function createListener(_0x12345a,_0x97c63c){return function(_0x176883){_0x97c63c[_0x3449('0x4')](_0x12345a,_0x176883);};}function removeListener(_0x58dc71,_0x571fcc){return function(){UserEvents[_0x3449('0x5')](_0x58dc71,_0x571fcc);};}exports[_0x3449('0x6')]=function(_0x2d2d20){for(var _0x2a0aca=0x0,_0x6c3fff=events[_0x3449('0x7')];_0x2a0aca<_0x6c3fff;_0x2a0aca++){var _0xdca3c1=events[_0x2a0aca];var _0x4e5f6d=createListener(_0x3449('0x8')+_0xdca3c1,_0x2d2d20);UserEvents['on'](_0xdca3c1,_0x4e5f6d);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index c8e44cb..ff135b3 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1e5242,_0x1696f5){var _0x56d91d=function(_0x159e20){while(--_0x159e20){_0x1e5242['push'](_0x1e5242['shift']());}};_0x56d91d(++_0x1696f5);}(_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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x25f5f2,_0x2739a3){var _0x250d44=function(_0x42c225){while(--_0x42c225){_0x25f5f2['push'](_0x25f5f2['shift']());}};_0x250d44(++_0x2739a3);}(_0x70e0,0x17b));var _0x070e=function(_0x51f4bb,_0x18fd79){_0x51f4bb=_0x51f4bb-0x0;var _0x5b86fc=_0x70e0[_0x51f4bb];return _0x5b86fc;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index d075462..3ed3e0f 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 _0xa3b0=['sequelize','exports'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0xa3b0,0x188));var _0x0a3b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa3b0[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x0a3b('0x0'));module[_0x0a3b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x2732=['sequelize','exports','INTEGER'];(function(_0x5b7b03,_0x49c653){var _0x4dd9c6=function(_0x16176b){while(--_0x16176b){_0x5b7b03['push'](_0x5b7b03['shift']());}};_0x4dd9c6(++_0x49c653);}(_0x2732,0x1ce));var _0x2273=function(_0x1e4656,_0x37d354){_0x1e4656=_0x1e4656-0x0;var _0x9e88af=_0x2732[_0x1e4656];return _0x9e88af;};'use strict';var Sequelize=require(_0x2273('0x0'));module[_0x2273('0x1')]={'penalty':{'type':Sequelize[_0x2273('0x2')],'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 44b5f26..3b0f1d5 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 _0xd851=['lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userChatQueue.attributes','exports','UserChatQueue','user_has_chat_queues'];(function(_0x1b2fc5,_0x55bfc0){var _0xa1a00a=function(_0x4e5d02){while(--_0x4e5d02){_0x1b2fc5['push'](_0x1b2fc5['shift']());}};_0xa1a00a(++_0x55bfc0);}(_0xd851,0x120));var _0x1d85=function(_0x13b330,_0x297092){_0x13b330=_0x13b330-0x0;var _0x1f666c=_0xd851[_0x13b330];return _0x1f666c;};'use strict';var _=require(_0x1d85('0x0'));var util=require('util');var logger=require(_0x1d85('0x1'))(_0x1d85('0x2'));var moment=require(_0x1d85('0x3'));var BPromise=require(_0x1d85('0x4'));var rp=require(_0x1d85('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1d85('0x6'));var config=require(_0x1d85('0x7'));var attributes=require(_0x1d85('0x8'));module[_0x1d85('0x9')]=function(_0xbb575c,_0x30c6cb){return _0xbb575c['define'](_0x1d85('0xa'),attributes,{'tableName':_0x1d85('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x37c1=['request-promise','path','rimraf','./userChatQueue.attributes','exports','user_has_chat_queues','lodash','util','../../config/logger','bluebird'];(function(_0x453074,_0x4cd4e2){var _0x29c129=function(_0x564fba){while(--_0x564fba){_0x453074['push'](_0x453074['shift']());}};_0x29c129(++_0x4cd4e2);}(_0x37c1,0xa6));var _0x137c=function(_0x3ea891,_0x3316a9){_0x3ea891=_0x3ea891-0x0;var _0x2ff698=_0x37c1[_0x3ea891];return _0x2ff698;};'use strict';var _=require(_0x137c('0x0'));var util=require(_0x137c('0x1'));var logger=require(_0x137c('0x2'))('api');var moment=require('moment');var BPromise=require(_0x137c('0x3'));var rp=require(_0x137c('0x4'));var fs=require('fs');var path=require(_0x137c('0x5'));var rimraf=require(_0x137c('0x6'));var config=require('../../config/environment');var attributes=require(_0x137c('0x7'));module[_0x137c('0x8')]=function(_0x25de31,_0x4bdbba){return _0x25de31['define']('UserChatQueue',attributes,{'tableName':_0x137c('0x9'),'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 0c6b9e2..66aaeb8 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 _0x11b2=['debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','rpc','client','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x463df1,_0x359e22){var _0x4e467f=function(_0x2540b7){while(--_0x2540b7){_0x463df1['push'](_0x463df1['shift']());}};_0x4e467f(++_0x359e22);}(_0x11b2,0x181));var _0x211b=function(_0x2e83ee,_0x5330b4){_0x2e83ee=_0x2e83ee-0x0;var _0x4f07bc=_0x11b2[_0x2e83ee];return _0x4f07bc;};'use strict';var _=require(_0x211b('0x0'));var util=require(_0x211b('0x1'));var moment=require('moment');var BPromise=require(_0x211b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x211b('0x3'));var db=require(_0x211b('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x211b('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x211b('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8669dc,_0x376986,_0x1ca21e){return new BPromise(function(_0x43634e,_0x11538c){return client['request'](_0x8669dc,_0x1ca21e)[_0x211b('0x7')](function(_0x42718e){logger[_0x211b('0x8')](_0x211b('0x9'),_0x376986,_0x211b('0xa'));logger[_0x211b('0xb')](_0x211b('0xc'),_0x376986,_0x211b('0xa'),JSON[_0x211b('0xd')](_0x42718e));if(_0x42718e[_0x211b('0xe')]){if(_0x42718e[_0x211b('0xe')][_0x211b('0xf')]===0x1f4){logger[_0x211b('0xe')](_0x211b('0x9'),_0x376986,_0x42718e[_0x211b('0xe')][_0x211b('0x10')]);return _0x11538c(_0x42718e[_0x211b('0xe')][_0x211b('0x10')]);}logger[_0x211b('0xe')](_0x211b('0x9'),_0x376986,_0x42718e['error'][_0x211b('0x10')]);return _0x43634e(_0x42718e[_0x211b('0xe')][_0x211b('0x10')]);}else{logger[_0x211b('0x8')](_0x211b('0x9'),_0x376986,_0x211b('0xa'));_0x43634e(_0x42718e['result']['message']);}})[_0x211b('0x11')](function(_0x4f9276){logger['error'](_0x211b('0x9'),_0x376986,_0x4f9276);_0x11538c(_0x4f9276);});});} \ No newline at end of file +var _0xb086=['rpc','jayson/promise','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x421143,_0x48a1df){var _0x4cdab8=function(_0x4d703e){while(--_0x4d703e){_0x421143['push'](_0x421143['shift']());}};_0x4cdab8(++_0x48a1df);}(_0xb086,0x1ad));var _0x6b08=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb086[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x6b08('0x0'));var util=require('util');var moment=require(_0x6b08('0x1'));var BPromise=require(_0x6b08('0x2'));var rs=require(_0x6b08('0x3'));var fs=require('fs');var Redis=require(_0x6b08('0x4'));var db=require(_0x6b08('0x5'))['db'];var utils=require(_0x6b08('0x6'));var logger=require(_0x6b08('0x7'))(_0x6b08('0x8'));var config=require('../../config/environment');var jayson=require(_0x6b08('0x9'));var client=jayson[_0x6b08('0xa')][_0x6b08('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x273f42,_0x2c7e5f,_0x2162ff){return new BPromise(function(_0x162416,_0x4884fb){return client[_0x6b08('0xc')](_0x273f42,_0x2162ff)[_0x6b08('0xd')](function(_0xa81e73){logger[_0x6b08('0xe')](_0x6b08('0xf'),_0x2c7e5f,_0x6b08('0x10'));logger['debug'](_0x6b08('0x11'),_0x2c7e5f,'request\x20sent',JSON[_0x6b08('0x12')](_0xa81e73));if(_0xa81e73[_0x6b08('0x13')]){if(_0xa81e73[_0x6b08('0x13')][_0x6b08('0x14')]===0x1f4){logger[_0x6b08('0x13')]('UserChatQueue,\x20%s,\x20%s',_0x2c7e5f,_0xa81e73['error'][_0x6b08('0x15')]);return _0x4884fb(_0xa81e73[_0x6b08('0x13')][_0x6b08('0x15')]);}logger[_0x6b08('0x13')](_0x6b08('0xf'),_0x2c7e5f,_0xa81e73['error'][_0x6b08('0x15')]);return _0x162416(_0xa81e73[_0x6b08('0x13')][_0x6b08('0x15')]);}else{logger[_0x6b08('0xe')]('UserChatQueue,\x20%s,\x20%s',_0x2c7e5f,_0x6b08('0x10'));_0x162416(_0xa81e73['result'][_0x6b08('0x15')]);}})[_0x6b08('0x16')](function(_0x490ec5){logger[_0x6b08('0x13')](_0x6b08('0xf'),_0x2c7e5f,_0x490ec5);_0x4884fb(_0x490ec5);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index c24757f..5074326 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x1e0cc2,_0x590419){var _0x23712c=function(_0x6975d7){while(--_0x6975d7){_0x1e0cc2['push'](_0x1e0cc2['shift']());}};_0x23712c(++_0x590419);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4c6c2d,_0x4401d4){var _0x49622e=function(_0x3ac235){while(--_0x3ac235){_0x4c6c2d['push'](_0x4c6c2d['shift']());}};_0x49622e(++_0x4401d4);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x381379,_0x3f3b86){_0x381379=_0x381379-0x0;var _0x3e1063=_0xcb91[_0x381379];return _0x3e1063;};'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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index a68fb4f..730318b 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 _0x31c8=['INTEGER','STRING','exports'];(function(_0x39f13e,_0x452dd2){var _0x2264c4=function(_0x2fba94){while(--_0x2fba94){_0x39f13e['push'](_0x39f13e['shift']());}};_0x2264c4(++_0x452dd2);}(_0x31c8,0x1d9));var _0x831c=function(_0x50bd25,_0x1491a9){_0x50bd25=_0x50bd25-0x0;var _0x3863c9=_0x31c8[_0x50bd25];return _0x3863c9;};'use strict';var Sequelize=require('sequelize');module[_0x831c('0x0')]={'penalty':{'type':Sequelize[_0x831c('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x831c('0x2')]}}; \ No newline at end of file +var _0x0ba0=['INTEGER','STRING','sequelize'];(function(_0x152664,_0x2f5173){var _0x51d153=function(_0xde49d4){while(--_0xde49d4){_0x152664['push'](_0x152664['shift']());}};_0x51d153(++_0x2f5173);}(_0x0ba0,0x167));var _0x00ba=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x0ba0[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require(_0x00ba('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x00ba('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x00ba('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x00ba('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index c5e2748..3e61748 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 _0xb568=['./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment'];(function(_0x810e4d,_0x909ef4){var _0x13f01c=function(_0x12fd89){while(--_0x12fd89){_0x810e4d['push'](_0x810e4d['shift']());}};_0x13f01c(++_0x909ef4);}(_0xb568,0xc5));var _0x8b56=function(_0x45a472,_0x3fd9f6){_0x45a472=_0x45a472-0x0;var _0x46a410=_0xb568[_0x45a472];return _0x46a410;};'use strict';var _=require(_0x8b56('0x0'));var util=require(_0x8b56('0x1'));var logger=require(_0x8b56('0x2'))(_0x8b56('0x3'));var moment=require(_0x8b56('0x4'));var BPromise=require(_0x8b56('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8b56('0x6'));var attributes=require(_0x8b56('0x7'));module[_0x8b56('0x8')]=function(_0x1e007b,_0x542da5){return _0x1e007b[_0x8b56('0x9')](_0x8b56('0xa'),attributes,{'tableName':_0x8b56('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1224=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','util'];(function(_0x19e2af,_0x483b5f){var _0x3ab1e1=function(_0x48f8c4){while(--_0x48f8c4){_0x19e2af['push'](_0x19e2af['shift']());}};_0x3ab1e1(++_0x483b5f);}(_0x1224,0x137));var _0x4122=function(_0x3a54c1,_0x1b19a7){_0x3a54c1=_0x3a54c1-0x0;var _0x532e71=_0x1224[_0x3a54c1];return _0x532e71;};'use strict';var _=require('lodash');var util=require(_0x4122('0x0'));var logger=require(_0x4122('0x1'))(_0x4122('0x2'));var moment=require(_0x4122('0x3'));var BPromise=require(_0x4122('0x4'));var rp=require(_0x4122('0x5'));var fs=require('fs');var path=require(_0x4122('0x6'));var rimraf=require(_0x4122('0x7'));var config=require(_0x4122('0x8'));var attributes=require(_0x4122('0x9'));module[_0x4122('0xa')]=function(_0x25a573,_0x543549){return _0x25a573[_0x4122('0xb')](_0x4122('0xc'),attributes,{'tableName':'user_has_fax_queues','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 4dc8e27..83866ea 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 _0x58a6=['moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util'];(function(_0x241f80,_0x4a1085){var _0x12013d=function(_0x6a185d){while(--_0x6a185d){_0x241f80['push'](_0x241f80['shift']());}};_0x12013d(++_0x4a1085);}(_0x58a6,0x1cb));var _0x658a=function(_0x3cb08d,_0x4141cf){_0x3cb08d=_0x3cb08d-0x0;var _0x7cd918=_0x58a6[_0x3cb08d];return _0x7cd918;};'use strict';var _=require('lodash');var util=require(_0x658a('0x0'));var moment=require(_0x658a('0x1'));var BPromise=require(_0x658a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x658a('0x3'));var db=require(_0x658a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x658a('0x5'))(_0x658a('0x6'));var config=require(_0x658a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x658a('0x8')][_0x658a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3961a7,_0x14f6ca,_0x4b847c){return new BPromise(function(_0x293f48,_0x3492da){return client['request'](_0x3961a7,_0x4b847c)[_0x658a('0xa')](function(_0x504016){logger[_0x658a('0xb')](_0x658a('0xc'),_0x14f6ca,_0x658a('0xd'));logger['debug'](_0x658a('0xe'),_0x14f6ca,'request\x20sent',JSON[_0x658a('0xf')](_0x504016));if(_0x504016['error']){if(_0x504016[_0x658a('0x10')][_0x658a('0x11')]===0x1f4){logger[_0x658a('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x14f6ca,_0x504016['error'][_0x658a('0x12')]);return _0x3492da(_0x504016['error']['message']);}logger[_0x658a('0x10')](_0x658a('0xc'),_0x14f6ca,_0x504016[_0x658a('0x10')]['message']);return _0x293f48(_0x504016[_0x658a('0x10')][_0x658a('0x12')]);}else{logger[_0x658a('0xb')](_0x658a('0xc'),_0x14f6ca,_0x658a('0xd'));_0x293f48(_0x504016['result'][_0x658a('0x12')]);}})[_0x658a('0x13')](function(_0x3fea49){logger[_0x658a('0x10')](_0x658a('0xc'),_0x14f6ca,_0x3fea49);_0x3492da(_0x3fea49);});});} \ No newline at end of file +var _0xa4d0=['message','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x412ab8,_0x3703d3){var _0x10c4f2=function(_0x2e17e4){while(--_0x2e17e4){_0x412ab8['push'](_0x412ab8['shift']());}};_0x10c4f2(++_0x3703d3);}(_0xa4d0,0x1b2));var _0x0a4d=function(_0x5a93d9,_0x467244){_0x5a93d9=_0x5a93d9-0x0;var _0x417b68=_0xa4d0[_0x5a93d9];return _0x417b68;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0a4d('0x0'));var BPromise=require(_0x0a4d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a4d('0x2'));var db=require(_0x0a4d('0x3'))['db'];var utils=require(_0x0a4d('0x4'));var logger=require('../../config/logger')(_0x0a4d('0x5'));var config=require(_0x0a4d('0x6'));var jayson=require(_0x0a4d('0x7'));var client=jayson['client'][_0x0a4d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x44fcf5,_0x49a802,_0x2485e3){return new BPromise(function(_0x33a069,_0x22bdbd){return client['request'](_0x44fcf5,_0x2485e3)['then'](function(_0x41f728){logger[_0x0a4d('0x9')](_0x0a4d('0xa'),_0x49a802,_0x0a4d('0xb'));logger[_0x0a4d('0xc')](_0x0a4d('0xd'),_0x49a802,_0x0a4d('0xb'),JSON['stringify'](_0x41f728));if(_0x41f728[_0x0a4d('0xe')]){if(_0x41f728['error'][_0x0a4d('0xf')]===0x1f4){logger[_0x0a4d('0xe')](_0x0a4d('0xa'),_0x49a802,_0x41f728[_0x0a4d('0xe')][_0x0a4d('0x10')]);return _0x22bdbd(_0x41f728[_0x0a4d('0xe')]['message']);}logger[_0x0a4d('0xe')](_0x0a4d('0xa'),_0x49a802,_0x41f728[_0x0a4d('0xe')][_0x0a4d('0x10')]);return _0x33a069(_0x41f728[_0x0a4d('0xe')][_0x0a4d('0x10')]);}else{logger[_0x0a4d('0x9')](_0x0a4d('0xa'),_0x49a802,_0x0a4d('0xb'));_0x33a069(_0x41f728['result'][_0x0a4d('0x10')]);}})[_0x0a4d('0x11')](function(_0x4de682){logger[_0x0a4d('0xe')](_0x0a4d('0xa'),_0x49a802,_0x4de682);_0x22bdbd(_0x4de682);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 8217d86..899ee50 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x4b9d70,_0x36c641){var _0x355e51=function(_0x43201c){while(--_0x43201c){_0x4b9d70['push'](_0x4b9d70['shift']());}};_0x355e51(++_0x36c641);}(_0xe706,0xa3));var _0x6e70=function(_0x59dc02,_0x120477){_0x59dc02=_0x59dc02-0x0;var _0x556178=_0xe706[_0x59dc02];return _0x556178;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x97f5f7,_0x3fdd1a){var _0x2fda22=function(_0x2b0847){while(--_0x2b0847){_0x97f5f7['push'](_0x97f5f7['shift']());}};_0x2fda22(++_0x3fdd1a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0xcb91[_0x20a558];return _0x53d3f7;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index ffc9b00..ef564f0 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 _0x3f2f=['sequelize','INTEGER'];(function(_0x37f930,_0x298321){var _0x56d871=function(_0xc9c1ec){while(--_0xc9c1ec){_0x37f930['push'](_0x37f930['shift']());}};_0x56d871(++_0x298321);}(_0x3f2f,0x120));var _0xf3f2=function(_0x3627bc,_0x4a24ef){_0x3627bc=_0x3627bc-0x0;var _0x269016=_0x3f2f[_0x3627bc];return _0x269016;};'use strict';var Sequelize=require(_0xf3f2('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xf3f2('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe617=['exports','INTEGER','sequelize'];(function(_0x32439d,_0x304a85){var _0x5b9a18=function(_0x459753){while(--_0x459753){_0x32439d['push'](_0x32439d['shift']());}};_0x5b9a18(++_0x304a85);}(_0xe617,0x17c));var _0x7e61=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe617[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x7e61('0x0'));module[_0x7e61('0x1')]={'penalty':{'type':Sequelize[_0x7e61('0x2')],'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 05eb1d5..856a282 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 _0x0fae=['api','moment','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','util','../../config/logger'];(function(_0x1ffa56,_0xd85a22){var _0x31b126=function(_0x20b97a){while(--_0x20b97a){_0x1ffa56['push'](_0x1ffa56['shift']());}};_0x31b126(++_0xd85a22);}(_0x0fae,0xb4));var _0xe0fa=function(_0x236cba,_0x5b560a){_0x236cba=_0x236cba-0x0;var _0x470852=_0x0fae[_0x236cba];return _0x470852;};'use strict';var _=require('lodash');var util=require(_0xe0fa('0x0'));var logger=require(_0xe0fa('0x1'))(_0xe0fa('0x2'));var moment=require(_0xe0fa('0x3'));var BPromise=require('bluebird');var rp=require(_0xe0fa('0x4'));var fs=require('fs');var path=require(_0xe0fa('0x5'));var rimraf=require(_0xe0fa('0x6'));var config=require(_0xe0fa('0x7'));var attributes=require(_0xe0fa('0x8'));module[_0xe0fa('0x9')]=function(_0x123cff,_0x4e3c81){return _0x123cff[_0xe0fa('0xa')](_0xe0fa('0xb'),attributes,{'tableName':_0xe0fa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b89=['request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','define','user_has_mail_queues','../../config/logger','moment','bluebird'];(function(_0x478219,_0x28aa3d){var _0x4ff324=function(_0x226fb8){while(--_0x226fb8){_0x478219['push'](_0x478219['shift']());}};_0x4ff324(++_0x28aa3d);}(_0x5b89,0xbb));var _0x95b8=function(_0x3de7e0,_0x28cbff){_0x3de7e0=_0x3de7e0-0x0;var _0x11d0b3=_0x5b89[_0x3de7e0];return _0x11d0b3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x95b8('0x0'))('api');var moment=require(_0x95b8('0x1'));var BPromise=require(_0x95b8('0x2'));var rp=require(_0x95b8('0x3'));var fs=require('fs');var path=require(_0x95b8('0x4'));var rimraf=require(_0x95b8('0x5'));var config=require(_0x95b8('0x6'));var attributes=require(_0x95b8('0x7'));module['exports']=function(_0x5e3ab1,_0x572d35){return _0x5e3ab1[_0x95b8('0x8')]('UserMailQueue',attributes,{'tableName':_0x95b8('0x9'),'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 21671e3..24b2f5c 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 _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x411542,_0x55050e){var _0x4bfd83=function(_0x345be0){while(--_0x345be0){_0x411542['push'](_0x411542['shift']());}};_0x4bfd83(++_0x55050e);}(_0x34e8,0x12c));var _0x834e=function(_0x35cbcb,_0x37bba2){_0x35cbcb=_0x35cbcb-0x0;var _0x3a1e02=_0x34e8[_0x35cbcb];return _0x3a1e02;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file +var _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x48fca4,_0x4f50a4){var _0x5b52ed=function(_0x3000ef){while(--_0x3000ef){_0x48fca4['push'](_0x48fca4['shift']());}};_0x5b52ed(++_0x4f50a4);}(_0x34e8,0x12c));var _0x834e=function(_0x321260,_0x3c3824){_0x321260=_0x321260-0x0;var _0x2ceec0=_0x34e8[_0x321260];return _0x2ceec0;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index ceaa925..2072fff 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 _0x3746=['isAuthenticated','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./userNotification.controller','post'];(function(_0x5dc4e8,_0x273735){var _0x418674=function(_0x556821){while(--_0x556821){_0x5dc4e8['push'](_0x5dc4e8['shift']());}};_0x418674(++_0x273735);}(_0x3746,0x1bc));var _0x6374=function(_0x105c05,_0x3e73df){_0x105c05=_0x105c05-0x0;var _0x5e39f1=_0x3746[_0x105c05];return _0x5e39f1;};'use strict';var multer=require(_0x6374('0x0'));var util=require(_0x6374('0x1'));var path=require(_0x6374('0x2'));var timeout=require(_0x6374('0x3'));var express=require(_0x6374('0x4'));var router=express[_0x6374('0x5')]();var fs_extra=require(_0x6374('0x6'));var auth=require(_0x6374('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x6374('0x8'));var controller=require(_0x6374('0x9'));router[_0x6374('0xa')]('/',auth[_0x6374('0xb')](),controller['sendUserNotification']);module[_0x6374('0xc')]=router; \ No newline at end of file +var _0xdf98=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','multer','connect-timeout'];(function(_0x57ec11,_0x539404){var _0x19805d=function(_0x571c86){while(--_0x571c86){_0x57ec11['push'](_0x57ec11['shift']());}};_0x19805d(++_0x539404);}(_0xdf98,0x8d));var _0x8df9=function(_0x56b794,_0x50003f){_0x56b794=_0x56b794-0x0;var _0x80c80=_0xdf98[_0x56b794];return _0x80c80;};'use strict';var multer=require(_0x8df9('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8df9('0x1'));var express=require(_0x8df9('0x2'));var router=express[_0x8df9('0x3')]();var fs_extra=require(_0x8df9('0x4'));var auth=require(_0x8df9('0x5'));var interaction=require(_0x8df9('0x6'));var config=require(_0x8df9('0x7'));var controller=require(_0x8df9('0x8'));router[_0x8df9('0x9')]('/',auth[_0x8df9('0xa')](),controller[_0x8df9('0xb')]);module[_0x8df9('0xc')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 33478f4..dd317f5 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 _0xbd01=['sequelize','TEXT','STRING','BOOLEAN'];(function(_0x51d810,_0x30b6c3){var _0x2ad77b=function(_0x2bd6eb){while(--_0x2bd6eb){_0x51d810['push'](_0x51d810['shift']());}};_0x2ad77b(++_0x30b6c3);}(_0xbd01,0x154));var _0x1bd0=function(_0x59bf83,_0x12ab3c){_0x59bf83=_0x59bf83-0x0;var _0x409c17=_0xbd01[_0x59bf83];return _0x409c17;};'use strict';var Sequelize=require(_0x1bd0('0x0'));module['exports']={'body':{'type':Sequelize[_0x1bd0('0x1')]},'senderName':{'type':Sequelize[_0x1bd0('0x2')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x1bd0('0x2')]},'beep':{'type':Sequelize[_0x1bd0('0x3')]}}; \ No newline at end of file +var _0x0abc=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x4f1dbd,_0x36bfba){var _0x44e6c5=function(_0x210bb9){while(--_0x210bb9){_0x4f1dbd['push'](_0x4f1dbd['shift']());}};_0x44e6c5(++_0x36bfba);}(_0x0abc,0xcf));var _0xc0ab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0abc[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc0ab('0x0'));module[_0xc0ab('0x1')]={'body':{'type':Sequelize[_0xc0ab('0x2')]},'senderName':{'type':Sequelize[_0xc0ab('0x3')]},'recipientsId':{'type':Sequelize[_0xc0ab('0x2')]},'recipientsDescription':{'type':Sequelize[_0xc0ab('0x3')]},'beep':{'type':Sequelize[_0xc0ab('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index eb388d6..38575eb 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 _0x2f18=['create','forEach','emit','catch','Template','findOne','html','TemplateId','Invalid\x20\x27TemplateId\x27\x20parameter','view','User','union','ids','queue','replace','Queue','push','all','getAgents','map','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','send','sendUserNotification','body','hasOwnProperty','text','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification'];(function(_0x125bad,_0x4bc955){var _0x40e256=function(_0x2449ad){while(--_0x2449ad){_0x125bad['push'](_0x125bad['shift']());}};_0x40e256(++_0x4bc955);}(_0x2f18,0x149));var _0x82f1=function(_0x27405c,_0xfb3b33){_0x27405c=_0x27405c-0x0;var _0x5d3a09=_0x2f18[_0x27405c];return _0x5d3a09;};'use strict';var emlformat=require(_0x82f1('0x0'));var rimraf=require(_0x82f1('0x1'));var zipdir=require(_0x82f1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x82f1('0x3'));var moment=require(_0x82f1('0x4'));var BPromise=require(_0x82f1('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x82f1('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x82f1('0x7'));var fs=require('fs');var fs_extra=require(_0x82f1('0x8'));var _=require(_0x82f1('0x9'));var squel=require(_0x82f1('0xa'));var crypto=require(_0x82f1('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x82f1('0xc'));var toCsv=require(_0x82f1('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x82f1('0xe'));var authService=require(_0x82f1('0xf'));var qs=require(_0x82f1('0x10'));var as=require(_0x82f1('0x11'));var hardwareService=require(_0x82f1('0x12'));var logger=require(_0x82f1('0x13'))(_0x82f1('0x14'));var utils=require(_0x82f1('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x82f1('0x16'));var db=require(_0x82f1('0x17'))['db'];config[_0x82f1('0x18')]=_[_0x82f1('0x19')](config[_0x82f1('0x18')],{'host':_0x82f1('0x1a'),'port':0x18eb});var socket=require(_0x82f1('0x1b'))(new Redis(config[_0x82f1('0x18')]));require(_0x82f1('0x1c'))['register'](socket);function respondWithStatusCode(_0x48bcb6,_0x4dea1d){_0x4dea1d=_0x4dea1d||0xcc;return function(_0x3b3a76){if(_0x3b3a76){return _0x48bcb6[_0x82f1('0x1d')](_0x4dea1d);}return _0x48bcb6['status'](_0x4dea1d)[_0x82f1('0x1e')]();};}function respondWithResult(_0x128640,_0x4fc763){_0x4fc763=_0x4fc763||0xc8;return function(_0x9a4e74){if(_0x9a4e74){return _0x128640[_0x82f1('0x1f')](_0x4fc763)[_0x82f1('0x20')](_0x9a4e74);}};}function respondWithFilteredResult(_0x2d7443,_0x5e9e0e){return function(_0x443693){if(_0x443693){var _0x3ce337=typeof _0x5e9e0e[_0x82f1('0x21')]===_0x82f1('0x22')&&typeof _0x5e9e0e[_0x82f1('0x23')]===_0x82f1('0x22');var _0x1012e7=_0x443693[_0x82f1('0x24')];var _0x22b5fe=_0x3ce337?0x0:_0x5e9e0e[_0x82f1('0x21')];var _0xeec85d=_0x3ce337?_0x443693[_0x82f1('0x24')]:_0x5e9e0e[_0x82f1('0x21')]+_0x5e9e0e['limit'];var _0x23c831;if(_0xeec85d>=_0x1012e7){_0xeec85d=_0x1012e7;_0x23c831=0xc8;}else{_0x23c831=0xce;}_0x2d7443['status'](_0x23c831);return _0x2d7443[_0x82f1('0x25')](_0x82f1('0x26'),_0x22b5fe+'-'+_0xeec85d+'/'+_0x1012e7)['json'](_0x443693);}return null;};}function patchUpdates(_0x1cb038){return function(_0x4a9a6b){try{jsonpatch[_0x82f1('0x27')](_0x4a9a6b,_0x1cb038,!![]);}catch(_0x5f46f5){return BPromise[_0x82f1('0x28')](_0x5f46f5);}return _0x4a9a6b[_0x82f1('0x29')]();};}function saveUpdates(_0x1ae654,_0x3dc0fb){return function(_0x203cc3){if(_0x203cc3){return _0x203cc3[_0x82f1('0x2a')](_0x1ae654)[_0x82f1('0x2b')](function(_0x576947){return _0x576947;});}return null;};}function removeEntity(_0x398341,_0x31a117){return function(_0x355c49){if(_0x355c49){return _0x355c49['destroy']()[_0x82f1('0x2b')](function(){_0x398341[_0x82f1('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43da60,_0x44638a){return function(_0x1fde8a){if(!_0x1fde8a){_0x43da60[_0x82f1('0x1d')](0x194);}return _0x1fde8a;};}function handleError(_0x5cca84,_0x2b7999){_0x2b7999=_0x2b7999||0x1f4;return function(_0x48c228){logger[_0x82f1('0x2c')](_0x48c228['stack']);if(_0x48c228[_0x82f1('0x2d')]){delete _0x48c228['name'];}_0x5cca84['status'](_0x2b7999)[_0x82f1('0x2e')](_0x48c228);};}exports[_0x82f1('0x2f')]=function(_0x448c0e,_0x29574b,_0x4409fd){if(!_0x448c0e[_0x82f1('0x30')][_0x82f1('0x31')](_0x82f1('0x32'))&&!_0x448c0e['body'][_0x82f1('0x31')]('TemplateId')){throw new db[(_0x82f1('0x33'))]['ValidationError'](_0x82f1('0x34'));}else{if(_0x448c0e[_0x82f1('0x30')][_0x82f1('0x31')]('TemplateId')&&!_0x448c0e[_0x82f1('0x30')][_0x82f1('0x31')]('view')){throw new db['Sequelize'][(_0x82f1('0x35'))](_0x82f1('0x36'));}if(!_0x448c0e[_0x82f1('0x30')][_0x82f1('0x31')](_0x82f1('0x37'))){throw new db[(_0x82f1('0x33'))]['ValidationError'](_0x82f1('0x38'));}else{try{var _0x1baa6c=JSON[_0x82f1('0x39')](_0x448c0e[_0x82f1('0x30')][_0x82f1('0x37')]);}catch(_0x115e1e){logger['error'](_0x115e1e);throw new db[(_0x82f1('0x33'))][(_0x82f1('0x35'))](_0x82f1('0x3a'));}var _0x3a97ee=['chatqueue',_0x82f1('0x3b'),_0x82f1('0x3c'),_0x82f1('0x3d'),_0x82f1('0x3e'),_0x82f1('0x3f'),'whatsappqueue',_0x82f1('0x40'),_0x82f1('0x41')];if(_[_0x82f1('0x42')](_0x1baa6c,function(_0x32b200){return!_[_0x82f1('0x43')](_0x3a97ee,_0x32b200[_0x82f1('0x44')][_0x82f1('0x45')]());})){throw new db[(_0x82f1('0x33'))][(_0x82f1('0x35'))](_0x82f1('0x46'));}}}var _0x55b294={};_0x55b294[_0x82f1('0x47')]=_0x448c0e[_0x82f1('0x30')][_0x82f1('0x31')](_0x82f1('0x47'))?_0x448c0e[_0x82f1('0x30')]['senderName']:_0x448c0e[_0x82f1('0x41')][_0x82f1('0x48')];_0x55b294[_0x82f1('0x49')]=_[_0x82f1('0x4a')](_0x448c0e['body']['recipientsDescription'])?null:_0x448c0e[_0x82f1('0x30')]['recipientsDescription'];_0x55b294[_0x82f1('0x4b')]=_0x448c0e['body'][_0x82f1('0x4b')]||![];_0x55b294[_0x82f1('0x4c')]=_0x448c0e[_0x82f1('0x41')]['id'];return getContent(_0x448c0e['body'])['then'](function(_0x553021){_0x55b294['body']=_0x553021;return getRecipients(_0x1baa6c);})[_0x82f1('0x2b')](function(_0x8245b2){_0x55b294[_0x82f1('0x4d')]=_[_0x82f1('0x4e')](_0x8245b2)[_0x82f1('0x4f')](',');return db[_0x82f1('0x50')][_0x82f1('0x51')](function(_0x49b704){return db[_0x82f1('0x52')][_0x82f1('0x53')](_0x55b294,{'raw':!![],'transaction':_0x49b704})[_0x82f1('0x2b')](function(_0x1065a3){var _0x33cdcb={'sender':_0x55b294[_0x82f1('0x47')],'description':_0x55b294[_0x82f1('0x49')],'content':_0x55b294[_0x82f1('0x30')],'beep':_0x55b294[_0x82f1('0x4b')]};_0x8245b2[_0x82f1('0x54')](function(_0x5b0c6a){_0x33cdcb['recipient']=_0x5b0c6a;socket[_0x82f1('0x55')]('userNotification:send',_0x33cdcb);});return _0x1065a3;});});})[_0x82f1('0x2b')](respondWithResult(_0x29574b,0xc9))[_0x82f1('0x56')](handleError(_0x29574b,null));};function getContent(_0x3cdb4f){return new BPromise(function(_0x41215e,_0x493c1e){if(_0x3cdb4f[_0x82f1('0x32')]){_0x41215e(_0x3cdb4f[_0x82f1('0x32')]);return;}return db[_0x82f1('0x57')][_0x82f1('0x58')]({'attributes':[_0x82f1('0x59')],'where':{'id':_0x3cdb4f[_0x82f1('0x5a')]},'raw':!![]})['then'](function(_0x560327){if(!_0x560327)throw new db[(_0x82f1('0x33'))][(_0x82f1('0x35'))](_0x82f1('0x5b'));var _0x23095b=Mustache['render'](_0x560327['html'],_0x3cdb4f[_0x82f1('0x5c')]);_0x41215e(_0x23095b);})[_0x82f1('0x56')](function(_0x590ab6){_0x493c1e(_0x590ab6);});});}function getRecipients(_0x1ed452){return new BPromise(function(_0x64bdd9,_0x586367){var _0x3b578a=[];var _0x2d5679=[];_0x1ed452['forEach'](function(_0x4b7d77){var _0x534e06=_['startCase'](_0x4b7d77['model'][_0x82f1('0x45')]());if(_0x534e06===_0x82f1('0x5d')){_0x3b578a=_[_0x82f1('0x5e')](_0x3b578a,_0x4b7d77[_0x82f1('0x5f')]);}else{if(_[_0x82f1('0x43')](_0x534e06,_0x82f1('0x60')))_0x534e06=_0x534e06[_0x82f1('0x61')](_0x82f1('0x60'),_0x82f1('0x62'));_0x4b7d77['ids'][_0x82f1('0x54')](function(_0x5ee811){_0x2d5679[_0x82f1('0x63')](getAgents(_0x534e06,_0x5ee811));});}});return BPromise[_0x82f1('0x64')](_0x2d5679)[_0x82f1('0x2b')](function(_0x325617){_0x3b578a=_[_0x82f1('0x5e')](_0x3b578a,_['flatten'](_0x325617));_0x64bdd9(_0x3b578a);})[_0x82f1('0x56')](function(_0x234819){_0x586367(_0x234819);});});}function getAgents(_0x459928,_0x488323){return new BPromise(function(_0x3c23fc,_0x52b553){return db[_0x459928][_0x82f1('0x58')]({'where':{'id':_0x488323}})[_0x82f1('0x2b')](function(_0x596399){return _0x596399[_0x82f1('0x65')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4626c2){var _0x1cb3e2=_[_0x82f1('0x66')](_0x4626c2,'id');_0x3c23fc(_0x1cb3e2);});})[_0x82f1('0x56')](function(_0x19d9d9){_0x52b553(_0x19d9d9);});});} \ No newline at end of file +var _0xf5fb=['queue','replace','push','flatten','findOne','map','eml-format','rimraf','zip-dir','request-promise','bluebird','util','to-csv','ejs','fs-extra','lodash','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','save','update','then','destroy','error','stack','name','send','body','text','hasOwnProperty','TemplateId','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','smsqueue','team','user','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','emit','catch','Template','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','union','ids'];(function(_0x34bc6c,_0x10d089){var _0x168820=function(_0xb058d9){while(--_0xb058d9){_0x34bc6c['push'](_0x34bc6c['shift']());}};_0x168820(++_0x10d089);}(_0xf5fb,0x117));var _0xbf5f=function(_0x145630,_0x19b3bd){_0x145630=_0x145630-0x0;var _0x4c8ebf=_0xf5fb[_0x145630];return _0x4c8ebf;};'use strict';var emlformat=require(_0xbf5f('0x0'));var rimraf=require(_0xbf5f('0x1'));var zipdir=require(_0xbf5f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbf5f('0x3'));var moment=require('moment');var BPromise=require(_0xbf5f('0x4'));var Mustache=require('mustache');var util=require(_0xbf5f('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xbf5f('0x6'));var ejs=require(_0xbf5f('0x7'));var fs=require('fs');var fs_extra=require(_0xbf5f('0x8'));var _=require(_0xbf5f('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbf5f('0xa'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbf5f('0xb'));var hardwareService=require(_0xbf5f('0xc'));var logger=require(_0xbf5f('0xd'))(_0xbf5f('0xe'));var utils=require(_0xbf5f('0xf'));var config=require(_0xbf5f('0x10'));var licenseUtil=require(_0xbf5f('0x11'));var db=require(_0xbf5f('0x12'))['db'];config[_0xbf5f('0x13')]=_[_0xbf5f('0x14')](config[_0xbf5f('0x13')],{'host':_0xbf5f('0x15'),'port':0x18eb});var socket=require(_0xbf5f('0x16'))(new Redis(config['redis']));require(_0xbf5f('0x17'))[_0xbf5f('0x18')](socket);function respondWithStatusCode(_0x54bdd8,_0x5d1aed){_0x5d1aed=_0x5d1aed||0xcc;return function(_0x4b9233){if(_0x4b9233){return _0x54bdd8[_0xbf5f('0x19')](_0x5d1aed);}return _0x54bdd8[_0xbf5f('0x1a')](_0x5d1aed)[_0xbf5f('0x1b')]();};}function respondWithResult(_0x5ec4fd,_0x396204){_0x396204=_0x396204||0xc8;return function(_0x15a010){if(_0x15a010){return _0x5ec4fd['status'](_0x396204)[_0xbf5f('0x1c')](_0x15a010);}};}function respondWithFilteredResult(_0x27fcda,_0x4f9c45){return function(_0x338541){if(_0x338541){var _0x143d51=typeof _0x4f9c45['offset']===_0xbf5f('0x1d')&&typeof _0x4f9c45['limit']===_0xbf5f('0x1d');var _0x16dc28=_0x338541['count'];var _0x4f419d=_0x143d51?0x0:_0x4f9c45[_0xbf5f('0x1e')];var _0x59f021=_0x143d51?_0x338541[_0xbf5f('0x1f')]:_0x4f9c45[_0xbf5f('0x1e')]+_0x4f9c45[_0xbf5f('0x20')];var _0x1112b9;if(_0x59f021>=_0x16dc28){_0x59f021=_0x16dc28;_0x1112b9=0xc8;}else{_0x1112b9=0xce;}_0x27fcda['status'](_0x1112b9);return _0x27fcda[_0xbf5f('0x21')](_0xbf5f('0x22'),_0x4f419d+'-'+_0x59f021+'/'+_0x16dc28)['json'](_0x338541);}return null;};}function patchUpdates(_0x25a668){return function(_0x36f931){try{jsonpatch['apply'](_0x36f931,_0x25a668,!![]);}catch(_0x5d9037){return BPromise['reject'](_0x5d9037);}return _0x36f931[_0xbf5f('0x23')]();};}function saveUpdates(_0x4f4f0c,_0x4a9347){return function(_0x3e4455){if(_0x3e4455){return _0x3e4455[_0xbf5f('0x24')](_0x4f4f0c)[_0xbf5f('0x25')](function(_0x4464d8){return _0x4464d8;});}return null;};}function removeEntity(_0x5eccf6,_0x2f9b50){return function(_0x48913f){if(_0x48913f){return _0x48913f[_0xbf5f('0x26')]()['then'](function(){_0x5eccf6[_0xbf5f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4caf3a,_0x10a475){return function(_0x5e9c58){if(!_0x5e9c58){_0x4caf3a[_0xbf5f('0x19')](0x194);}return _0x5e9c58;};}function handleError(_0x562f39,_0x477b0c){_0x477b0c=_0x477b0c||0x1f4;return function(_0x2dfe0d){logger[_0xbf5f('0x27')](_0x2dfe0d[_0xbf5f('0x28')]);if(_0x2dfe0d[_0xbf5f('0x29')]){delete _0x2dfe0d[_0xbf5f('0x29')];}_0x562f39[_0xbf5f('0x1a')](_0x477b0c)[_0xbf5f('0x2a')](_0x2dfe0d);};}exports['sendUserNotification']=function(_0x6814e9,_0x39a706,_0x2320a8){if(!_0x6814e9[_0xbf5f('0x2b')]['hasOwnProperty'](_0xbf5f('0x2c'))&&!_0x6814e9[_0xbf5f('0x2b')][_0xbf5f('0x2d')](_0xbf5f('0x2e'))){throw new db[(_0xbf5f('0x2f'))]['ValidationError'](_0xbf5f('0x30'));}else{if(_0x6814e9[_0xbf5f('0x2b')][_0xbf5f('0x2d')](_0xbf5f('0x2e'))&&!_0x6814e9[_0xbf5f('0x2b')][_0xbf5f('0x2d')](_0xbf5f('0x31'))){throw new db[(_0xbf5f('0x2f'))][(_0xbf5f('0x32'))](_0xbf5f('0x33'));}if(!_0x6814e9[_0xbf5f('0x2b')][_0xbf5f('0x2d')](_0xbf5f('0x34'))){throw new db['Sequelize'][(_0xbf5f('0x32'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x428861=JSON[_0xbf5f('0x35')](_0x6814e9['body']['recipients']);}catch(_0xaf59d7){logger[_0xbf5f('0x27')](_0xaf59d7);throw new db[(_0xbf5f('0x2f'))][(_0xbf5f('0x32'))](_0xbf5f('0x36'));}var _0x2571ec=[_0xbf5f('0x37'),'faxqueue','mailqueue','openchannelqueue',_0xbf5f('0x38'),'voicequeue','whatsappqueue',_0xbf5f('0x39'),_0xbf5f('0x3a')];if(_['some'](_0x428861,function(_0x37286c){return!_[_0xbf5f('0x3b')](_0x2571ec,_0x37286c[_0xbf5f('0x3c')][_0xbf5f('0x3d')]());})){throw new db[(_0xbf5f('0x2f'))][(_0xbf5f('0x32'))](_0xbf5f('0x3e'));}}}var _0x54adee={};_0x54adee[_0xbf5f('0x3f')]=_0x6814e9[_0xbf5f('0x2b')][_0xbf5f('0x2d')](_0xbf5f('0x3f'))?_0x6814e9[_0xbf5f('0x2b')][_0xbf5f('0x3f')]:_0x6814e9[_0xbf5f('0x3a')][_0xbf5f('0x40')];_0x54adee[_0xbf5f('0x41')]=_[_0xbf5f('0x42')](_0x6814e9[_0xbf5f('0x2b')][_0xbf5f('0x41')])?null:_0x6814e9['body'][_0xbf5f('0x41')];_0x54adee['beep']=_0x6814e9['body'][_0xbf5f('0x43')]||![];_0x54adee[_0xbf5f('0x44')]=_0x6814e9[_0xbf5f('0x3a')]['id'];return getContent(_0x6814e9[_0xbf5f('0x2b')])[_0xbf5f('0x25')](function(_0x4d7679){_0x54adee[_0xbf5f('0x2b')]=_0x4d7679;return getRecipients(_0x428861);})[_0xbf5f('0x25')](function(_0x2c7958){_0x54adee['recipientsId']=_[_0xbf5f('0x45')](_0x2c7958)[_0xbf5f('0x46')](',');return db[_0xbf5f('0x47')][_0xbf5f('0x48')](function(_0x44b4d5){return db[_0xbf5f('0x49')][_0xbf5f('0x4a')](_0x54adee,{'raw':!![],'transaction':_0x44b4d5})[_0xbf5f('0x25')](function(_0x4f849b){var _0x4b3191={'sender':_0x54adee['senderName'],'description':_0x54adee[_0xbf5f('0x41')],'content':_0x54adee[_0xbf5f('0x2b')],'beep':_0x54adee[_0xbf5f('0x43')]};_0x2c7958[_0xbf5f('0x4b')](function(_0x599a67){_0x4b3191[_0xbf5f('0x4c')]=_0x599a67;socket[_0xbf5f('0x4d')]('userNotification:send',_0x4b3191);});return _0x4f849b;});});})[_0xbf5f('0x25')](respondWithResult(_0x39a706,0xc9))[_0xbf5f('0x4e')](handleError(_0x39a706,null));};function getContent(_0x3cf318){return new BPromise(function(_0x21b38c,_0x205053){if(_0x3cf318[_0xbf5f('0x2c')]){_0x21b38c(_0x3cf318[_0xbf5f('0x2c')]);return;}return db[_0xbf5f('0x4f')]['findOne']({'attributes':['html'],'where':{'id':_0x3cf318['TemplateId']},'raw':!![]})[_0xbf5f('0x25')](function(_0xdda552){if(!_0xdda552)throw new db[(_0xbf5f('0x2f'))][(_0xbf5f('0x32'))](_0xbf5f('0x50'));var _0x42ad60=Mustache[_0xbf5f('0x51')](_0xdda552['html'],_0x3cf318['view']);_0x21b38c(_0x42ad60);})[_0xbf5f('0x4e')](function(_0x42d856){_0x205053(_0x42d856);});});}function getRecipients(_0x4288ea){return new BPromise(function(_0x25903f,_0x2d3f77){var _0x299352=[];var _0x2f9077=[];_0x4288ea[_0xbf5f('0x4b')](function(_0x11088d){var _0x4898e7=_[_0xbf5f('0x52')](_0x11088d[_0xbf5f('0x3c')][_0xbf5f('0x3d')]());if(_0x4898e7==='User'){_0x299352=_[_0xbf5f('0x53')](_0x299352,_0x11088d[_0xbf5f('0x54')]);}else{if(_[_0xbf5f('0x3b')](_0x4898e7,_0xbf5f('0x55')))_0x4898e7=_0x4898e7[_0xbf5f('0x56')](_0xbf5f('0x55'),'Queue');_0x11088d[_0xbf5f('0x54')][_0xbf5f('0x4b')](function(_0x28fa0c){_0x2f9077[_0xbf5f('0x57')](getAgents(_0x4898e7,_0x28fa0c));});}});return BPromise['all'](_0x2f9077)[_0xbf5f('0x25')](function(_0x4674c9){_0x299352=_['union'](_0x299352,_[_0xbf5f('0x58')](_0x4674c9));_0x25903f(_0x299352);})[_0xbf5f('0x4e')](function(_0x2b511c){_0x2d3f77(_0x2b511c);});});}function getAgents(_0x3460d6,_0x311708){return new BPromise(function(_0x4cf30c,_0x37394a){return db[_0x3460d6][_0xbf5f('0x59')]({'where':{'id':_0x311708}})[_0xbf5f('0x25')](function(_0x506908){return _0x506908['getAgents']({'attributes':['id'],'raw':!![]})[_0xbf5f('0x25')](function(_0x447efc){var _0x42062f=_[_0xbf5f('0x5a')](_0x447efc,'id');_0x4cf30c(_0x42062f);});})[_0xbf5f('0x4e')](function(_0x1af1fa){_0x37394a(_0x1af1fa);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index ce4c924..a2c3fbb 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 _0x44a5=['UserNotification','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x2742db,_0x58e00c){var _0x18659e=function(_0x5bd3ac){while(--_0x5bd3ac){_0x2742db['push'](_0x2742db['shift']());}};_0x18659e(++_0x58e00c);}(_0x44a5,0x17f));var _0x544a=function(_0x4b43c0,_0x3a8091){_0x4b43c0=_0x4b43c0-0x0;var _0x574c13=_0x44a5[_0x4b43c0];return _0x574c13;};'use strict';var EventEmitter=require(_0x544a('0x0'));var UserNotification=require(_0x544a('0x1'))['db'][_0x544a('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x544a('0x3')](0x0);var events={'afterCreate':_0x544a('0x4'),'afterUpdate':_0x544a('0x5'),'afterDestroy':_0x544a('0x6')};function emitEvent(_0x53f9c5){return function(_0x31a9af,_0xbcdd5,_0x4f6353){UserNotificationEvents[_0x544a('0x7')](_0x53f9c5+':'+_0x31a9af['id'],_0x31a9af);UserNotificationEvents['emit'](_0x53f9c5,_0x31a9af);_0x4f6353(null);};}for(var e in events){if(events[_0x544a('0x8')](e)){var event=events[e];UserNotification[_0x544a('0x9')](e,emitEvent(event));}}module[_0x544a('0xa')]=UserNotificationEvents; \ No newline at end of file +var _0xc659=['save','update','emit','hasOwnProperty','hook','exports','UserNotification','setMaxListeners'];(function(_0x1a1149,_0x33be22){var _0x12887f=function(_0x5be9a6){while(--_0x5be9a6){_0x1a1149['push'](_0x1a1149['shift']());}};_0x12887f(++_0x33be22);}(_0xc659,0x7e));var _0x9c65=function(_0x51bcd4,_0x397b28){_0x51bcd4=_0x51bcd4-0x0;var _0x38c609=_0xc659[_0x51bcd4];return _0x38c609;};'use strict';var EventEmitter=require('events');var UserNotification=require('../../mysqldb')['db'][_0x9c65('0x0')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x9c65('0x1')](0x0);var events={'afterCreate':_0x9c65('0x2'),'afterUpdate':_0x9c65('0x3'),'afterDestroy':'remove'};function emitEvent(_0x393774){return function(_0x3376b3,_0x210759,_0x2f4a77){UserNotificationEvents[_0x9c65('0x4')](_0x393774+':'+_0x3376b3['id'],_0x3376b3);UserNotificationEvents[_0x9c65('0x4')](_0x393774,_0x3376b3);_0x2f4a77(null);};}for(var e in events){if(events[_0x9c65('0x5')](e)){var event=events[e];UserNotification[_0x9c65('0x6')](e,emitEvent(event));}}module[_0x9c65('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 8e0da22..ff455f5 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 _0x0519=['lodash','util','moment','bluebird','request-promise','path','rimraf','./userNotification.attributes','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x3895ce,_0x3ab5dc){var _0x179037=function(_0x33f72f){while(--_0x33f72f){_0x3895ce['push'](_0x3895ce['shift']());}};_0x179037(++_0x3ab5dc);}(_0x0519,0x16c));var _0x9051=function(_0x42bafd,_0x3f0fe3){_0x42bafd=_0x42bafd-0x0;var _0x2ed705=_0x0519[_0x42bafd];return _0x2ed705;};'use strict';var _=require(_0x9051('0x0'));var util=require(_0x9051('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9051('0x2'));var BPromise=require(_0x9051('0x3'));var rp=require(_0x9051('0x4'));var fs=require('fs');var path=require(_0x9051('0x5'));var rimraf=require(_0x9051('0x6'));var config=require('../../config/environment');var attributes=require(_0x9051('0x7'));module['exports']=function(_0x1c0bf3,_0x1425bd){return _0x1c0bf3[_0x9051('0x8')](_0x9051('0x9'),attributes,{'tableName':_0x9051('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9051('0xb'),'collate':_0x9051('0xc')});}; \ No newline at end of file +var _0x3cb6=['userNotifications','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','UserNotification'];(function(_0xcd0918,_0x56bdf9){var _0x250704=function(_0x56788e){while(--_0x56788e){_0xcd0918['push'](_0xcd0918['shift']());}};_0x250704(++_0x56bdf9);}(_0x3cb6,0x121));var _0x63cb=function(_0x176996,_0x71174e){_0x176996=_0x176996-0x0;var _0x2ba772=_0x3cb6[_0x176996];return _0x2ba772;};'use strict';var _=require('lodash');var util=require(_0x63cb('0x0'));var logger=require(_0x63cb('0x1'))(_0x63cb('0x2'));var moment=require(_0x63cb('0x3'));var BPromise=require(_0x63cb('0x4'));var rp=require(_0x63cb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x63cb('0x6'));var config=require(_0x63cb('0x7'));var attributes=require('./userNotification.attributes');module[_0x63cb('0x8')]=function(_0x20bc29,_0x4dd8a0){return _0x20bc29[_0x63cb('0x9')](_0x63cb('0xa'),attributes,{'tableName':_0x63cb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 3e90f21..27a6537 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 _0x9535=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xb218f0,_0x408110){var _0x1061ec=function(_0x552f62){while(--_0x552f62){_0xb218f0['push'](_0xb218f0['shift']());}};_0x1061ec(++_0x408110);}(_0x9535,0xa4));var _0x5953=function(_0x47c35c,_0x13a12e){_0x47c35c=_0x47c35c-0x0;var _0x53fd37=_0x9535[_0x47c35c];return _0x53fd37;};'use strict';var _=require(_0x5953('0x0'));var util=require(_0x5953('0x1'));var moment=require('moment');var BPromise=require(_0x5953('0x2'));var rs=require(_0x5953('0x3'));var fs=require('fs');var Redis=require(_0x5953('0x4'));var db=require(_0x5953('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5953('0x6'));var config=require(_0x5953('0x7'));var jayson=require(_0x5953('0x8'));var client=jayson['client'][_0x5953('0x9')]({'port':0x232a});config['redis']=_[_0x5953('0xa')](config[_0x5953('0xb')],{'host':_0x5953('0xc'),'port':0x18eb});var socket=require(_0x5953('0xd'))(new Redis(config[_0x5953('0xb')]));require(_0x5953('0xe'))['register'](socket);function respondWithRpcPromise(_0x2ddf18,_0x38218a,_0x259d05){return new BPromise(function(_0x3d6bc8,_0x595dbc){return client[_0x5953('0xf')](_0x2ddf18,_0x259d05)[_0x5953('0x10')](function(_0x503ffe){logger[_0x5953('0x11')](_0x5953('0x12'),_0x38218a,_0x5953('0x13'));logger['debug'](_0x5953('0x14'),_0x38218a,'request\x20sent',JSON[_0x5953('0x15')](_0x503ffe));if(_0x503ffe[_0x5953('0x16')]){if(_0x503ffe[_0x5953('0x16')][_0x5953('0x17')]===0x1f4){logger[_0x5953('0x16')]('UserNotification,\x20%s,\x20%s',_0x38218a,_0x503ffe[_0x5953('0x16')]['message']);return _0x595dbc(_0x503ffe[_0x5953('0x16')][_0x5953('0x18')]);}logger[_0x5953('0x16')](_0x5953('0x12'),_0x38218a,_0x503ffe[_0x5953('0x16')][_0x5953('0x18')]);return _0x3d6bc8(_0x503ffe[_0x5953('0x16')][_0x5953('0x18')]);}else{logger['info'](_0x5953('0x12'),_0x38218a,_0x5953('0x13'));_0x3d6bc8(_0x503ffe[_0x5953('0x19')][_0x5953('0x18')]);}})[_0x5953('0x1a')](function(_0x130c10){logger[_0x5953('0x16')]('UserNotification,\x20%s,\x20%s',_0x38218a,_0x130c10);_0x595dbc(_0x130c10);});});} \ No newline at end of file +var _0xf9fd=['info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','request','then'];(function(_0x18ee27,_0x2908d8){var _0x37db04=function(_0x56e95c){while(--_0x56e95c){_0x18ee27['push'](_0x18ee27['shift']());}};_0x37db04(++_0x2908d8);}(_0xf9fd,0x78));var _0xdf9f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xf9fd[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xdf9f('0x0'));var util=require(_0xdf9f('0x1'));var moment=require(_0xdf9f('0x2'));var BPromise=require('bluebird');var rs=require(_0xdf9f('0x3'));var fs=require('fs');var Redis=require(_0xdf9f('0x4'));var db=require(_0xdf9f('0x5'))['db'];var utils=require(_0xdf9f('0x6'));var logger=require(_0xdf9f('0x7'))(_0xdf9f('0x8'));var config=require(_0xdf9f('0x9'));var jayson=require(_0xdf9f('0xa'));var client=jayson['client'][_0xdf9f('0xb')]({'port':0x232a});config[_0xdf9f('0xc')]=_[_0xdf9f('0xd')](config[_0xdf9f('0xc')],{'host':_0xdf9f('0xe'),'port':0x18eb});var socket=require(_0xdf9f('0xf'))(new Redis(config['redis']));require(_0xdf9f('0x10'))[_0xdf9f('0x11')](socket);function respondWithRpcPromise(_0xbbc3f1,_0x5a3653,_0x42b16b){return new BPromise(function(_0x3dbccd,_0x1cfdeb){return client[_0xdf9f('0x12')](_0xbbc3f1,_0x42b16b)[_0xdf9f('0x13')](function(_0x13c531){logger[_0xdf9f('0x14')](_0xdf9f('0x15'),_0x5a3653,_0xdf9f('0x16'));logger[_0xdf9f('0x17')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x5a3653,_0xdf9f('0x16'),JSON[_0xdf9f('0x18')](_0x13c531));if(_0x13c531[_0xdf9f('0x19')]){if(_0x13c531[_0xdf9f('0x19')]['code']===0x1f4){logger[_0xdf9f('0x19')](_0xdf9f('0x15'),_0x5a3653,_0x13c531[_0xdf9f('0x19')][_0xdf9f('0x1a')]);return _0x1cfdeb(_0x13c531[_0xdf9f('0x19')]['message']);}logger['error']('UserNotification,\x20%s,\x20%s',_0x5a3653,_0x13c531[_0xdf9f('0x19')]['message']);return _0x3dbccd(_0x13c531[_0xdf9f('0x19')][_0xdf9f('0x1a')]);}else{logger['info'](_0xdf9f('0x15'),_0x5a3653,_0xdf9f('0x16'));_0x3dbccd(_0x13c531['result'][_0xdf9f('0x1a')]);}})[_0xdf9f('0x1b')](function(_0x2cadfe){logger[_0xdf9f('0x19')]('UserNotification,\x20%s,\x20%s',_0x5a3653,_0x2cadfe);_0x1cfdeb(_0x2cadfe);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index f0340c6..82227dc 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 _0x03be=['./userNotification.events','save','update','emit','removeListener','length'];(function(_0x4fda88,_0x1a4d19){var _0xe37511=function(_0x51f461){while(--_0x51f461){_0x4fda88['push'](_0x4fda88['shift']());}};_0xe37511(++_0x1a4d19);}(_0x03be,0x126));var _0xe03b=function(_0x39f5b4,_0x4109bb){_0x39f5b4=_0x39f5b4-0x0;var _0x377119=_0x03be[_0x39f5b4];return _0x377119;};'use strict';var UserNotificationEvents=require(_0xe03b('0x0'));var events=[_0xe03b('0x1'),'remove',_0xe03b('0x2')];function createListener(_0x58e6a7,_0x1c63e7){return function(_0x30a7b7){_0x1c63e7[_0xe03b('0x3')](_0x58e6a7,_0x30a7b7);};}function removeListener(_0x88ace0,_0xd0e2b8){return function(){UserNotificationEvents[_0xe03b('0x4')](_0x88ace0,_0xd0e2b8);};}exports['register']=function(_0x4e0874){for(var _0x2cde53=0x0,_0x4135d9=events[_0xe03b('0x5')];_0x2cde53<_0x4135d9;_0x2cde53++){var _0x4aa81d=events[_0x2cde53];var _0x4466ec=createListener('userNotification:'+_0x4aa81d,_0x4e0874);UserNotificationEvents['on'](_0x4aa81d,_0x4466ec);}}; \ No newline at end of file +var _0x8e77=['register','userNotification:','./userNotification.events','save','remove','update','removeListener'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x8e77,0x79));var _0x78e7=function(_0x4131da,_0x124783){_0x4131da=_0x4131da-0x0;var _0x583242=_0x8e77[_0x4131da];return _0x583242;};'use strict';var UserNotificationEvents=require(_0x78e7('0x0'));var events=[_0x78e7('0x1'),_0x78e7('0x2'),_0x78e7('0x3')];function createListener(_0x3ef899,_0x1335c8){return function(_0xeffd52){_0x1335c8['emit'](_0x3ef899,_0xeffd52);};}function removeListener(_0x27fd29,_0x458ed7){return function(){UserNotificationEvents[_0x78e7('0x4')](_0x27fd29,_0x458ed7);};}exports[_0x78e7('0x5')]=function(_0x13ae91){for(var _0x2d01b4=0x0,_0x1dfcf9=events['length'];_0x2d01b4<_0x1dfcf9;_0x2d01b4++){var _0xf9ff6b=events[_0x2d01b4];var _0x322914=createListener(_0x78e7('0x6')+_0xf9ff6b,_0x13ae91);UserNotificationEvents['on'](_0xf9ff6b,_0x322914);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 03d632e..b4f776f 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x4314d7,_0x355218){var _0x5c599b=function(_0x556354){while(--_0x556354){_0x4314d7['push'](_0x4314d7['shift']());}};_0x5c599b(++_0x355218);}(_0x9c44,0x178));var _0x49c4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c44[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x31929b,_0x5edd81){var _0x13fdff=function(_0xe8e2fa){while(--_0xe8e2fa){_0x31929b['push'](_0x31929b['shift']());}};_0x13fdff(++_0x5edd81);}(_0xe706,0xa3));var _0x6e70=function(_0x132b71,_0x25f23e){_0x132b71=_0x132b71-0x0;var _0x224664=_0xe706[_0x132b71];return _0x224664;};'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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index b40f6eb..949935a 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 _0xbdda=['INTEGER','exports'];(function(_0x12e13a,_0x3f8461){var _0xf4cf3c=function(_0x54012f){while(--_0x54012f){_0x12e13a['push'](_0x12e13a['shift']());}};_0xf4cf3c(++_0x3f8461);}(_0xbdda,0x137));var _0xabdd=function(_0x2a354d,_0x3f01fd){_0x2a354d=_0x2a354d-0x0;var _0x445e03=_0xbdda[_0x2a354d];return _0x445e03;};'use strict';var Sequelize=require('sequelize');module[_0xabdd('0x0')]={'penalty':{'type':Sequelize[_0xabdd('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb4b7=['sequelize','INTEGER'];(function(_0xdd827a,_0x482ad2){var _0x2f46f1=function(_0x221046){while(--_0x221046){_0xdd827a['push'](_0xdd827a['shift']());}};_0x2f46f1(++_0x482ad2);}(_0xb4b7,0x6a));var _0x7b4b=function(_0x440d29,_0x13f33d){_0x440d29=_0x440d29-0x0;var _0xeb2d67=_0xb4b7[_0x440d29];return _0xeb2d67;};'use strict';var Sequelize=require(_0x7b4b('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x7b4b('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 bb6bdf1..cd4a47b 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 _0x4171=['bluebird','request-promise','path','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment'];(function(_0x51320f,_0x3fa2b1){var _0x3a6bf9=function(_0x3c21a3){while(--_0x3c21a3){_0x51320f['push'](_0x51320f['shift']());}};_0x3a6bf9(++_0x3fa2b1);}(_0x4171,0x1ad));var _0x1417=function(_0x5131f1,_0x25fe29){_0x5131f1=_0x5131f1-0x0;var _0x244886=_0x4171[_0x5131f1];return _0x244886;};'use strict';var _=require(_0x1417('0x0'));var util=require(_0x1417('0x1'));var logger=require(_0x1417('0x2'))(_0x1417('0x3'));var moment=require(_0x1417('0x4'));var BPromise=require(_0x1417('0x5'));var rp=require(_0x1417('0x6'));var fs=require('fs');var path=require(_0x1417('0x7'));var rimraf=require('rimraf');var config=require(_0x1417('0x8'));var attributes=require(_0x1417('0x9'));module[_0x1417('0xa')]=function(_0x1bc634,_0x2f8b82){return _0x1bc634[_0x1417('0xb')](_0x1417('0xc'),attributes,{'tableName':_0x1417('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe6eb=['path','rimraf','./userOpenchannelQueue.attributes','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x2ffc82,_0x4938e8){var _0x1ddef0=function(_0x8217c4){while(--_0x8217c4){_0x2ffc82['push'](_0x2ffc82['shift']());}};_0x1ddef0(++_0x4938e8);}(_0xe6eb,0x13e));var _0xbe6e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe6eb[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xbe6e('0x0'));var util=require(_0xbe6e('0x1'));var logger=require(_0xbe6e('0x2'))(_0xbe6e('0x3'));var moment=require(_0xbe6e('0x4'));var BPromise=require('bluebird');var rp=require(_0xbe6e('0x5'));var fs=require('fs');var path=require(_0xbe6e('0x6'));var rimraf=require(_0xbe6e('0x7'));var config=require('../../config/environment');var attributes=require(_0xbe6e('0x8'));module['exports']=function(_0x3d5c2f,_0x129ee6){return _0x3d5c2f[_0xbe6e('0x9')](_0xbe6e('0xa'),attributes,{'tableName':_0xbe6e('0xb'),'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 6be0e58..641db0d 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 _0x7d20=['client','http','request','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x2a7b8e,_0x50ffce){var _0x29b5c8=function(_0x131fe0){while(--_0x131fe0){_0x2a7b8e['push'](_0x2a7b8e['shift']());}};_0x29b5c8(++_0x50ffce);}(_0x7d20,0x86));var _0x07d2=function(_0x3ec522,_0x3562b7){_0x3ec522=_0x3ec522-0x0;var _0x44863b=_0x7d20[_0x3ec522];return _0x44863b;};'use strict';var _=require(_0x07d2('0x0'));var util=require(_0x07d2('0x1'));var moment=require(_0x07d2('0x2'));var BPromise=require(_0x07d2('0x3'));var rs=require(_0x07d2('0x4'));var fs=require('fs');var Redis=require(_0x07d2('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x07d2('0x6'));var logger=require(_0x07d2('0x7'))('rpc');var config=require(_0x07d2('0x8'));var jayson=require(_0x07d2('0x9'));var client=jayson[_0x07d2('0xa')][_0x07d2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x43f8ea,_0x2a6dd8,_0x10cd39){return new BPromise(function(_0x32c4a5,_0x2bd55c){return client[_0x07d2('0xc')](_0x43f8ea,_0x10cd39)['then'](function(_0x502e76){logger[_0x07d2('0xd')](_0x07d2('0xe'),_0x2a6dd8,_0x07d2('0xf'));logger[_0x07d2('0x10')](_0x07d2('0x11'),_0x2a6dd8,'request\x20sent',JSON[_0x07d2('0x12')](_0x502e76));if(_0x502e76[_0x07d2('0x13')]){if(_0x502e76[_0x07d2('0x13')][_0x07d2('0x14')]===0x1f4){logger[_0x07d2('0x13')](_0x07d2('0xe'),_0x2a6dd8,_0x502e76[_0x07d2('0x13')][_0x07d2('0x15')]);return _0x2bd55c(_0x502e76['error']['message']);}logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x2a6dd8,_0x502e76[_0x07d2('0x13')][_0x07d2('0x15')]);return _0x32c4a5(_0x502e76[_0x07d2('0x13')][_0x07d2('0x15')]);}else{logger['info'](_0x07d2('0xe'),_0x2a6dd8,_0x07d2('0xf'));_0x32c4a5(_0x502e76[_0x07d2('0x16')]['message']);}})[_0x07d2('0x17')](function(_0x213c1b){logger[_0x07d2('0x13')](_0x07d2('0xe'),_0x2a6dd8,_0x213c1b);_0x2bd55c(_0x213c1b);});});} \ No newline at end of file +var _0xf43c=['jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x39ae1e,_0x4f6690){var _0x3683f5=function(_0x4b7b15){while(--_0x4b7b15){_0x39ae1e['push'](_0x39ae1e['shift']());}};_0x3683f5(++_0x4f6690);}(_0xf43c,0x123));var _0xcf43=function(_0x55e962,_0xa4721f){_0x55e962=_0x55e962-0x0;var _0x2564d6=_0xf43c[_0x55e962];return _0x2564d6;};'use strict';var _=require(_0xcf43('0x0'));var util=require(_0xcf43('0x1'));var moment=require(_0xcf43('0x2'));var BPromise=require('bluebird');var rs=require(_0xcf43('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcf43('0x4'))['db'];var utils=require(_0xcf43('0x5'));var logger=require(_0xcf43('0x6'))(_0xcf43('0x7'));var config=require(_0xcf43('0x8'));var jayson=require(_0xcf43('0x9'));var client=jayson[_0xcf43('0xa')][_0xcf43('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x37e8e9,_0x524b0f,_0x2b1c80){return new BPromise(function(_0x1d2907,_0x57d3b4){return client[_0xcf43('0xc')](_0x37e8e9,_0x2b1c80)[_0xcf43('0xd')](function(_0x18afa1){logger[_0xcf43('0xe')](_0xcf43('0xf'),_0x524b0f,_0xcf43('0x10'));logger[_0xcf43('0x11')](_0xcf43('0x12'),_0x524b0f,_0xcf43('0x10'),JSON[_0xcf43('0x13')](_0x18afa1));if(_0x18afa1[_0xcf43('0x14')]){if(_0x18afa1[_0xcf43('0x14')][_0xcf43('0x15')]===0x1f4){logger[_0xcf43('0x14')](_0xcf43('0xf'),_0x524b0f,_0x18afa1['error'][_0xcf43('0x16')]);return _0x57d3b4(_0x18afa1[_0xcf43('0x14')][_0xcf43('0x16')]);}logger[_0xcf43('0x14')](_0xcf43('0xf'),_0x524b0f,_0x18afa1[_0xcf43('0x14')]['message']);return _0x1d2907(_0x18afa1[_0xcf43('0x14')][_0xcf43('0x16')]);}else{logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x524b0f,_0xcf43('0x10'));_0x1d2907(_0x18afa1[_0xcf43('0x17')][_0xcf43('0x16')]);}})[_0xcf43('0x18')](function(_0xbe1275){logger[_0xcf43('0x14')](_0xcf43('0xf'),_0x524b0f,_0xbe1275);_0x57d3b4(_0xbe1275);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index cfa03c0..b04c203 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 _0xc9af=['../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','getSections','/:id/resources','getResources','post','create','/:id/clone','clone','/:id/sections','addSections','put','destroy','removeSections','delete','removeResources','exports','multer','util','path','connect-timeout','fs-extra'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xc9af,0xe3));var _0xfc9a=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xc9af[_0x53ccf2];return _0x5a2964;};'use strict';var multer=require(_0xfc9a('0x0'));var util=require(_0xfc9a('0x1'));var path=require(_0xfc9a('0x2'));var timeout=require(_0xfc9a('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xfc9a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xfc9a('0x5'));var config=require(_0xfc9a('0x6'));var controller=require('./userProfile.controller');router['get']('/',auth[_0xfc9a('0x7')](),controller[_0xfc9a('0x8')]);router[_0xfc9a('0x9')](_0xfc9a('0xa'),auth[_0xfc9a('0x7')](),controller[_0xfc9a('0xb')]);router[_0xfc9a('0x9')](_0xfc9a('0xc'),auth[_0xfc9a('0x7')](),controller[_0xfc9a('0xd')]);router[_0xfc9a('0x9')]('/:id/sections',auth[_0xfc9a('0x7')](),controller[_0xfc9a('0xe')]);router['get'](_0xfc9a('0xf'),auth[_0xfc9a('0x7')](),controller[_0xfc9a('0x10')]);router[_0xfc9a('0x11')]('/',auth[_0xfc9a('0x7')](),controller[_0xfc9a('0x12')]);router[_0xfc9a('0x11')](_0xfc9a('0x13'),auth[_0xfc9a('0x7')](),controller[_0xfc9a('0x14')]);router[_0xfc9a('0x11')](_0xfc9a('0x15'),auth['isAuthenticated'](),controller[_0xfc9a('0x16')]);router[_0xfc9a('0x11')](_0xfc9a('0xf'),auth[_0xfc9a('0x7')](),controller['addResources']);router[_0xfc9a('0x17')](_0xfc9a('0xc'),auth[_0xfc9a('0x7')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xfc9a('0x18')]);router['delete'](_0xfc9a('0x15'),auth['isAuthenticated'](),controller[_0xfc9a('0x19')]);router[_0xfc9a('0x1a')]('/:id/resources',auth['isAuthenticated'](),controller[_0xfc9a('0x1b')]);module[_0xfc9a('0x1c')]=router; \ No newline at end of file +var _0x1140=['getResources','post','create','/:id/clone','clone','addSections','addResources','/:id','update','delete','destroy','removeSections','removeResources','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','index','get','/describe','isAuthenticated','describe','/:id/sections','/:id/resources'];(function(_0x78d813,_0xc8740f){var _0x4c2647=function(_0x343eef){while(--_0x343eef){_0x78d813['push'](_0x78d813['shift']());}};_0x4c2647(++_0xc8740f);}(_0x1140,0xfe));var _0x0114=function(_0x5ba661,_0x4a7854){_0x5ba661=_0x5ba661-0x0;var _0x179abb=_0x1140[_0x5ba661];return _0x179abb;};'use strict';var multer=require(_0x0114('0x0'));var util=require('util');var path=require(_0x0114('0x1'));var timeout=require(_0x0114('0x2'));var express=require(_0x0114('0x3'));var router=express[_0x0114('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0114('0x5'));var interaction=require(_0x0114('0x6'));var config=require(_0x0114('0x7'));var controller=require(_0x0114('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x0114('0x9')]);router[_0x0114('0xa')](_0x0114('0xb'),auth[_0x0114('0xc')](),controller[_0x0114('0xd')]);router['get']('/:id',auth[_0x0114('0xc')](),controller['show']);router[_0x0114('0xa')](_0x0114('0xe'),auth[_0x0114('0xc')](),controller['getSections']);router['get'](_0x0114('0xf'),auth[_0x0114('0xc')](),controller[_0x0114('0x10')]);router[_0x0114('0x11')]('/',auth['isAuthenticated'](),controller[_0x0114('0x12')]);router[_0x0114('0x11')](_0x0114('0x13'),auth[_0x0114('0xc')](),controller[_0x0114('0x14')]);router[_0x0114('0x11')](_0x0114('0xe'),auth[_0x0114('0xc')](),controller[_0x0114('0x15')]);router[_0x0114('0x11')](_0x0114('0xf'),auth['isAuthenticated'](),controller[_0x0114('0x16')]);router['put'](_0x0114('0x17'),auth['isAuthenticated'](),controller[_0x0114('0x18')]);router[_0x0114('0x19')](_0x0114('0x17'),auth[_0x0114('0xc')](),controller[_0x0114('0x1a')]);router['delete'](_0x0114('0xe'),auth[_0x0114('0xc')](),controller[_0x0114('0x1b')]);router[_0x0114('0x19')](_0x0114('0xf'),auth[_0x0114('0xc')](),controller[_0x0114('0x1c')]);module[_0x0114('0x1d')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 8dc6eb7..5e30aad 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 _0xa1ec=['getDataValue','split','BOOLEAN','sequelize','exports','STRING','name','setDataValue','crudPermissions','join'];(function(_0x3838eb,_0x47159c){var _0x2c7dda=function(_0x318df3){while(--_0x318df3){_0x3838eb['push'](_0x3838eb['shift']());}};_0x2c7dda(++_0x47159c);}(_0xa1ec,0x1d9));var _0xca1e=function(_0x3b25f3,_0x275d5f){_0x3b25f3=_0x3b25f3-0x0;var _0x1a55f7=_0xa1ec[_0x3b25f3];return _0x1a55f7;};'use strict';var Sequelize=require(_0xca1e('0x0'));module[_0xca1e('0x1')]={'name':{'type':Sequelize[_0xca1e('0x2')],'allowNull':![],'unique':_0xca1e('0x3')},'crudPermissions':{'type':Sequelize[_0xca1e('0x2')],'set':function(_0x271a0f){this[_0xca1e('0x4')](_0xca1e('0x5'),_0x271a0f?_0x271a0f[_0xca1e('0x6')](''):[]);},'get':function(){return this[_0xca1e('0x7')](_0xca1e('0x5'))?this[_0xca1e('0x7')](_0xca1e('0x5'))[_0xca1e('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xca1e('0x9')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xca1e('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xca1e('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xca1e('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xca1e('0x9')],'defaultValue':!![]}}; \ No newline at end of file +var _0xf919=['BOOLEAN','exports','STRING','name','setDataValue','crudPermissions','join','getDataValue','split'];(function(_0x25b186,_0x230363){var _0x5b3392=function(_0x131859){while(--_0x131859){_0x25b186['push'](_0x25b186['shift']());}};_0x5b3392(++_0x230363);}(_0xf919,0x1c3));var _0x9f91=function(_0x2adfb1,_0x406e6e){_0x2adfb1=_0x2adfb1-0x0;var _0xa52d45=_0xf919[_0x2adfb1];return _0xa52d45;};'use strict';var Sequelize=require('sequelize');module[_0x9f91('0x0')]={'name':{'type':Sequelize[_0x9f91('0x1')],'allowNull':![],'unique':_0x9f91('0x2')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x3ea08b){this[_0x9f91('0x3')](_0x9f91('0x4'),_0x3ea08b?_0x3ea08b[_0x9f91('0x5')](''):[]);},'get':function(){return this[_0x9f91('0x6')](_0x9f91('0x4'))?this[_0x9f91('0x6')](_0x9f91('0x4'))[_0x9f91('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x9f91('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x9f91('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x9f91('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x9f91('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x9f91('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x9f91('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x9f91('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x9f91('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index aefe43b..d0b077e 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 _0x7ad6=['save','update','then','destroy','error','stack','name','send','index','map','UserProfile','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','length','find','create','body','get','omit','updatedAt','crudPermissions','createdAt','sequelize','transaction','UserProfileSection','params','each','autoAssociation','sectionId','userProfileId','UserProfileResource','Resources','describe','push','removeSections','ids','enabled','includes','isEmpty','subsections','concat','forEach','Plugin','resourceId','addResources','bulkCreate','removeResources','getResources','section','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','fast-json-patch','request-promise','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject'];(function(_0x11f518,_0x4f30dc){var _0x34ab8f=function(_0xae090d){while(--_0xae090d){_0x11f518['push'](_0x11f518['shift']());}};_0x34ab8f(++_0x4f30dc);}(_0x7ad6,0x12e));var _0x67ad=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x7ad6[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x67ad('0x0'));var rimraf=require(_0x67ad('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x67ad('0x2'));var rp=require(_0x67ad('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x67ad('0x4'));var csv=require(_0x67ad('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x67ad('0x6'));var _=require('lodash');var squel=require(_0x67ad('0x7'));var crypto=require(_0x67ad('0x8'));var jsforce=require(_0x67ad('0x9'));var deskjs=require(_0x67ad('0xa'));var toCsv=require(_0x67ad('0x5'));var querystring=require(_0x67ad('0xb'));var Papa=require(_0x67ad('0xc'));var Redis=require(_0x67ad('0xd'));var authService=require(_0x67ad('0xe'));var qs=require(_0x67ad('0xf'));var as=require(_0x67ad('0x10'));var hardwareService=require(_0x67ad('0x11'));var logger=require('../../config/logger')(_0x67ad('0x12'));var utils=require(_0x67ad('0x13'));var config=require(_0x67ad('0x14'));var licenseUtil=require(_0x67ad('0x15'));var db=require(_0x67ad('0x16'))['db'];config[_0x67ad('0x17')]=_['defaults'](config[_0x67ad('0x17')],{'host':_0x67ad('0x18'),'port':0x18eb});var socket=require(_0x67ad('0x19'))(new Redis(config[_0x67ad('0x17')]));require(_0x67ad('0x1a'))[_0x67ad('0x1b')](socket);function respondWithStatusCode(_0x5037e6,_0x3ea096){_0x3ea096=_0x3ea096||0xcc;return function(_0x29620f){if(_0x29620f){return _0x5037e6[_0x67ad('0x1c')](_0x3ea096);}return _0x5037e6['status'](_0x3ea096)[_0x67ad('0x1d')]();};}function respondWithResult(_0x46ae92,_0x130f3a){_0x130f3a=_0x130f3a||0xc8;return function(_0xcfbf75){if(_0xcfbf75){return _0x46ae92[_0x67ad('0x1e')](_0x130f3a)[_0x67ad('0x1f')](_0xcfbf75);}};}function respondWithFilteredResult(_0x5f4d07,_0x3ad2cd){return function(_0x378dea){if(_0x378dea){var _0x1d9a26=typeof _0x3ad2cd[_0x67ad('0x20')]===_0x67ad('0x21')&&typeof _0x3ad2cd[_0x67ad('0x22')]===_0x67ad('0x21');var _0x2d222e=_0x378dea['count'];var _0x44858a=_0x1d9a26?0x0:_0x3ad2cd['offset'];var _0x4cb19a=_0x1d9a26?_0x378dea[_0x67ad('0x23')]:_0x3ad2cd[_0x67ad('0x20')]+_0x3ad2cd[_0x67ad('0x22')];var _0x1eb0bb;if(_0x4cb19a>=_0x2d222e){_0x4cb19a=_0x2d222e;_0x1eb0bb=0xc8;}else{_0x1eb0bb=0xce;}_0x5f4d07['status'](_0x1eb0bb);return _0x5f4d07[_0x67ad('0x24')](_0x67ad('0x25'),_0x44858a+'-'+_0x4cb19a+'/'+_0x2d222e)['json'](_0x378dea);}return null;};}function patchUpdates(_0x3eacee){return function(_0x415013){try{jsonpatch[_0x67ad('0x26')](_0x415013,_0x3eacee,!![]);}catch(_0xa39b36){return BPromise[_0x67ad('0x27')](_0xa39b36);}return _0x415013[_0x67ad('0x28')]();};}function saveUpdates(_0xd8987d,_0x485f05){return function(_0x32fbcd){if(_0x32fbcd){return _0x32fbcd[_0x67ad('0x29')](_0xd8987d)[_0x67ad('0x2a')](function(_0x16db01){return _0x16db01;});}return null;};}function removeEntity(_0x1cb293,_0x4c7b62){return function(_0x434795){if(_0x434795){return _0x434795[_0x67ad('0x2b')]()[_0x67ad('0x2a')](function(){_0x1cb293['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x278f7b,_0x14a6b8){return function(_0x4895f6){if(!_0x4895f6){_0x278f7b[_0x67ad('0x1c')](0x194);}return _0x4895f6;};}function handleError(_0x130069,_0x5c0c00){_0x5c0c00=_0x5c0c00||0x1f4;return function(_0x5140da){logger[_0x67ad('0x2c')](_0x5140da[_0x67ad('0x2d')]);if(_0x5140da[_0x67ad('0x2e')]){delete _0x5140da['name'];}_0x130069[_0x67ad('0x1e')](_0x5c0c00)[_0x67ad('0x2f')](_0x5140da);};}exports[_0x67ad('0x30')]=function(_0x4b6e6c,_0x3ab69d){var _0x44707a={},_0x27aa7f={},_0x3ff044={'count':0x0,'rows':[]};var _0xdd69a=_[_0x67ad('0x31')](db[_0x67ad('0x32')][_0x67ad('0x33')],function(_0xc49990){return{'name':_0xc49990[_0x67ad('0x34')],'type':_0xc49990[_0x67ad('0x35')][_0x67ad('0x36')]};});_0x27aa7f[_0x67ad('0x37')]=_['map'](_0xdd69a,_0x67ad('0x2e'));_0x27aa7f[_0x67ad('0x38')]=_[_0x67ad('0x39')](_0x4b6e6c['query']);_0x27aa7f[_0x67ad('0x3a')]=_[_0x67ad('0x3b')](_0x27aa7f[_0x67ad('0x37')],_0x27aa7f[_0x67ad('0x38')]);_0x44707a[_0x67ad('0x3c')]=_[_0x67ad('0x3b')](_0x27aa7f[_0x67ad('0x37')],qs[_0x67ad('0x3d')](_0x4b6e6c[_0x67ad('0x38')][_0x67ad('0x3d')]));_0x44707a[_0x67ad('0x3c')]=_0x44707a[_0x67ad('0x3c')]['length']?_0x44707a[_0x67ad('0x3c')]:_0x27aa7f['model'];if(!_0x4b6e6c[_0x67ad('0x38')][_0x67ad('0x3e')](_0x67ad('0x3f'))){_0x44707a['limit']=qs[_0x67ad('0x22')](_0x4b6e6c['query'][_0x67ad('0x22')]);_0x44707a['offset']=qs[_0x67ad('0x20')](_0x4b6e6c['query'][_0x67ad('0x20')]);}_0x44707a[_0x67ad('0x40')]=qs[_0x67ad('0x41')](_0x4b6e6c[_0x67ad('0x38')][_0x67ad('0x41')]);_0x44707a[_0x67ad('0x42')]=qs['filters'](_[_0x67ad('0x43')](_0x4b6e6c['query'],_0x27aa7f['filters']),_0xdd69a);if(_0x4b6e6c[_0x67ad('0x38')][_0x67ad('0x44')]){_0x44707a[_0x67ad('0x42')]=_[_0x67ad('0x45')](_0x44707a[_0x67ad('0x42')],{'$or':_[_0x67ad('0x31')](_0xdd69a,function(_0x573c66){if(_0x573c66[_0x67ad('0x35')]!==_0x67ad('0x46')){var _0x3df07b={};_0x3df07b[_0x573c66[_0x67ad('0x2e')]]={'$like':'%'+_0x4b6e6c['query'][_0x67ad('0x44')]+'%'};return _0x3df07b;}})});}_0x44707a=_[_0x67ad('0x45')]({},_0x44707a,_0x4b6e6c[_0x67ad('0x47')]);var _0x1b3948={'where':_0x44707a[_0x67ad('0x42')]};return db[_0x67ad('0x32')]['count'](_0x1b3948)['then'](function(_0x456892){_0x3ff044[_0x67ad('0x23')]=_0x456892;if(_0x4b6e6c[_0x67ad('0x38')][_0x67ad('0x48')]){_0x44707a[_0x67ad('0x49')]=[{'all':!![]}];}return db[_0x67ad('0x32')][_0x67ad('0x4a')](_0x44707a);})[_0x67ad('0x2a')](function(_0x3a5188){_0x3ff044['rows']=_0x3a5188;return _0x3ff044;})[_0x67ad('0x2a')](respondWithFilteredResult(_0x3ab69d,_0x44707a))[_0x67ad('0x4b')](handleError(_0x3ab69d,null));};exports[_0x67ad('0x4c')]=function(_0x4455c6,_0x5afacd){var _0x415eb4={'raw':![],'where':{'id':_0x4455c6['params']['id']}},_0x92bce6={};_0x92bce6[_0x67ad('0x37')]=_[_0x67ad('0x39')](db['UserProfile'][_0x67ad('0x33')]);_0x92bce6[_0x67ad('0x38')]=_[_0x67ad('0x39')](_0x4455c6[_0x67ad('0x38')]);_0x92bce6[_0x67ad('0x3a')]=_['intersection'](_0x92bce6[_0x67ad('0x37')],_0x92bce6[_0x67ad('0x38')]);_0x415eb4[_0x67ad('0x3c')]=_[_0x67ad('0x3b')](_0x92bce6[_0x67ad('0x37')],qs[_0x67ad('0x3d')](_0x4455c6[_0x67ad('0x38')][_0x67ad('0x3d')]));_0x415eb4['attributes']=_0x415eb4['attributes'][_0x67ad('0x4d')]?_0x415eb4['attributes']:_0x92bce6[_0x67ad('0x37')];if(_0x4455c6[_0x67ad('0x38')][_0x67ad('0x48')]){_0x415eb4[_0x67ad('0x49')]=[{'all':!![]}];}_0x415eb4=_[_0x67ad('0x45')]({},_0x415eb4,_0x4455c6['options']);return db['UserProfile'][_0x67ad('0x4e')](_0x415eb4)[_0x67ad('0x2a')](handleEntityNotFound(_0x5afacd,null))[_0x67ad('0x2a')](respondWithResult(_0x5afacd,null))[_0x67ad('0x4b')](handleError(_0x5afacd,null));};exports['create']=function(_0x2344cf,_0x27afa0){return db[_0x67ad('0x32')][_0x67ad('0x4f')](_0x2344cf[_0x67ad('0x50')],{})[_0x67ad('0x2a')](respondWithResult(_0x27afa0,0xc9))[_0x67ad('0x4b')](handleError(_0x27afa0,null));};exports['clone']=function(_0x565a7a,_0x4e0e8b){var _0x52b01c={'where':{'id':_0x565a7a['params']['id']}},_0x4f5808={};_0x4f5808[_0x67ad('0x37')]=_[_0x67ad('0x39')](db[_0x67ad('0x32')][_0x67ad('0x33')]);_0x52b01c[_0x67ad('0x3c')]=_[_0x67ad('0x3b')](_0x4f5808[_0x67ad('0x37')],qs[_0x67ad('0x3d')](_0x565a7a[_0x67ad('0x38')][_0x67ad('0x3d')]));_0x52b01c[_0x67ad('0x3c')]=_0x52b01c[_0x67ad('0x3c')]['length']?_0x52b01c['attributes']:_0x4f5808[_0x67ad('0x37')];if(_0x565a7a[_0x67ad('0x38')][_0x67ad('0x48')]){_0x52b01c[_0x67ad('0x49')]=[{'all':!![]}];}_0x52b01c=_[_0x67ad('0x45')]({},_0x52b01c,_0x565a7a[_0x67ad('0x47')]);return db[_0x67ad('0x32')]['find'](_0x52b01c)[_0x67ad('0x2a')](handleEntityNotFound(_0x4e0e8b,null))[_0x67ad('0x2a')](function(_0xa6f360){if(_0xa6f360){var _0x3c6932=_0xa6f360[_0x67ad('0x51')]({'plain':!![]});_0x3c6932=qs[_0x67ad('0x52')](_0x3c6932,['id','createdAt',_0x67ad('0x53'),_0x67ad('0x54')]);_0x565a7a[_0x67ad('0x50')]=_[_0x67ad('0x52')](_0x565a7a['body'],['id',_0x67ad('0x55'),'updatedAt']);return db[_0x67ad('0x56')][_0x67ad('0x57')](function(_0x57a1ca){return db[_0x67ad('0x32')][_0x67ad('0x4f')](_[_0x67ad('0x45')](_0x3c6932,_0x565a7a['body']),{'include':_0x565a7a[_0x67ad('0x38')][_0x67ad('0x48')]?[{'all':!![]}]:undefined,'transaction':_0x57a1ca})[_0x67ad('0x2a')](function(_0x4a981b){var _0x37a1bd=_0x4a981b[_0x67ad('0x51')]({'plain':!![]});return db[_0x67ad('0x58')]['findAll']({'where':{'userProfileId':_0x565a7a[_0x67ad('0x59')]['id']},'raw':!![]})[_0x67ad('0x2a')](function(_0x5e13da){if(_0x5e13da){return BPromise[_0x67ad('0x5a')](_0x5e13da,function(_0x3eb263){return new BPromise(function(_0x4d7169,_0xb62d8d){if(_0x3eb263[_0x67ad('0x5b')]===null||_0x3eb263[_0x67ad('0x5b')]===0x1)_0x4d7169(null);return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x3eb263['id']},'raw':!![]})['then'](function(_0x4c963c){var _0x4cb0e5=_[_0x67ad('0x31')](_0x4c963c,function(_0xecb6be){return qs[_0x67ad('0x52')](_0xecb6be,['id',_0x67ad('0x55'),_0x67ad('0x53'),_0x67ad('0x5c')]);});_0x4d7169(_0x4cb0e5);})[_0x67ad('0x4b')](function(_0x51c898){_0xb62d8d(_0x51c898);});})[_0x67ad('0x2a')](function(_0x4f0df7){var _0x213c86=qs[_0x67ad('0x52')](_0x3eb263,['id',_0x67ad('0x55'),_0x67ad('0x53')]);_0x213c86[_0x67ad('0x5d')]=_0x37a1bd['id'];if(_0x4f0df7)_0x213c86['Resources']=_0x4f0df7;return _0x213c86;})[_0x67ad('0x2a')](function(_0x43b5c2){return db['UserProfileSection']['create'](_0x43b5c2,{'include':[{'model':db[_0x67ad('0x5e')],'as':_0x67ad('0x5f')}],'raw':!![],'transaction':_0x57a1ca});});})['then'](function(){return _0x37a1bd;});}});});});}})[_0x67ad('0x2a')](respondWithResult(_0x4e0e8b,0xc9))['catch'](handleError(_0x4e0e8b,null));};exports['update']=function(_0x25d702,_0x3400ef){if(_0x25d702[_0x67ad('0x50')]['id']){delete _0x25d702[_0x67ad('0x50')]['id'];}return db[_0x67ad('0x32')]['find']({'where':{'id':_0x25d702[_0x67ad('0x59')]['id']}})['then'](handleEntityNotFound(_0x3400ef,null))[_0x67ad('0x2a')](saveUpdates(_0x25d702[_0x67ad('0x50')],null))[_0x67ad('0x2a')](respondWithResult(_0x3400ef,null))[_0x67ad('0x4b')](handleError(_0x3400ef,null));};exports[_0x67ad('0x2b')]=function(_0x15f2ae,_0x1a6dba){return db[_0x67ad('0x32')]['find']({'where':{'id':_0x15f2ae[_0x67ad('0x59')]['id']}})[_0x67ad('0x2a')](handleEntityNotFound(_0x1a6dba,null))[_0x67ad('0x2a')](removeEntity(_0x1a6dba,null))[_0x67ad('0x4b')](handleError(_0x1a6dba,null));};exports[_0x67ad('0x60')]=function(_0x2f2003,_0x18a793){return db['UserProfile'][_0x67ad('0x60')]()[_0x67ad('0x2a')](respondWithResult(_0x18a793,null))[_0x67ad('0x4b')](handleError(_0x18a793,null));};exports['addSections']=function(_0x20c33f,_0x408367){var _0x17b380=_0x20c33f[_0x67ad('0x50')];return db[_0x67ad('0x32')][_0x67ad('0x4e')]({'where':{'id':_0x20c33f['params']['id']}})[_0x67ad('0x2a')](handleEntityNotFound(_0x408367,null))[_0x67ad('0x2a')](function(_0x57d4e0){if(_0x57d4e0){return db[_0x67ad('0x56')][_0x67ad('0x57')](function(_0x3836aa){return db[_0x67ad('0x58')][_0x67ad('0x2b')]({'where':{'userProfileId':_0x20c33f[_0x67ad('0x59')]['id'],'sectionId':_['map'](_0x17b380,function(_0x544f71){return _0x544f71['sectionId'];})},'transaction':_0x3836aa})[_0x67ad('0x2a')](function(){var _0x179451=_['map'](_0x17b380,function(_0x1ebcea){_0x1ebcea[_0x67ad('0x5d')]=_0x20c33f[_0x67ad('0x59')]['id'];return _0x1ebcea;});var _0x2d757a=[];return BPromise['each'](_0x179451,function(_0x298357){return db['UserProfileSection']['create'](_0x298357,{'include':[{'model':db[_0x67ad('0x5e')],'as':'Resources'}],'raw':!![],'transaction':_0x3836aa})[_0x67ad('0x2a')](function(_0x111d8c){_0x2d757a[_0x67ad('0x61')](_0x111d8c[_0x67ad('0x51')]({'plain':!![]}));});})[_0x67ad('0x2a')](function(){return _0x2d757a;});});});}})[_0x67ad('0x2a')](function(_0x30a703){return _0x30a703;})[_0x67ad('0x2a')](respondWithResult(_0x408367,null))[_0x67ad('0x4b')](handleError(_0x408367,null));};exports[_0x67ad('0x62')]=function(_0x4befe4,_0x387508){var _0x3402de;return db[_0x67ad('0x32')][_0x67ad('0x4e')]({'where':{'id':_0x4befe4[_0x67ad('0x59')]['id']},'attributes':['id',_0x67ad('0x2e')]})['then'](handleEntityNotFound(_0x387508,null))[_0x67ad('0x2a')](function(_0x17d025){if(_0x17d025){_0x3402de=_0x17d025;return db[_0x67ad('0x58')][_0x67ad('0x2b')]({'where':{'userProfileId':_0x4befe4[_0x67ad('0x59')]['id'],'sectionId':_0x4befe4[_0x67ad('0x38')][_0x67ad('0x63')]}});}})[_0x67ad('0x2a')](function(){return _0x3402de;})[_0x67ad('0x2a')](respondWithStatusCode(_0x387508,null))[_0x67ad('0x4b')](handleError(_0x387508,null));};exports['getSections']=function(_0x4cd566,_0x22c2d0){var _0x27b019=[];var _0x34c594=[];return db[_0x67ad('0x58')]['findAll']({'where':{'userProfileId':_0x4cd566[_0x67ad('0x59')]['id']},'raw':!![]})[_0x67ad('0x2a')](function(_0x14673b){_0x27b019=_['filter'](_0x14673b,function(_0x47dfd1){return _0x47dfd1[_0x67ad('0x64')]===0x1||_[_0x67ad('0x65')]([0x3eb,0x709],_0x47dfd1[_0x67ad('0x5c')]);});if(!_[_0x67ad('0x66')](_0x27b019)){return _['map'](_0x27b019,function(_0x5c7e48){return _0x5c7e48['sectionId'];});}else{return;}})['then'](function(_0x3b468f){if(_0x3b468f)_0x34c594=_0x3b468f;if(_[_0x67ad('0x65')](_0x34c594,0x64)){var _0x9c88fa=_[_0x67ad('0x4e')](_0x27b019,{'sectionId':0x64});return hasDefaultDashboard(_0x9c88fa)[_0x67ad('0x2a')](function(_0x28b667){return _[_0x67ad('0x31')](_0x27b019,function(_0xda5aae){if(_0xda5aae[_0x67ad('0x5c')]===0x64){_0xda5aae['subsections']=_0x28b667;}return _0xda5aae;});});}else{return;}})['then'](function(_0x3dd238){if(_0x3dd238)_0x27b019=_0x3dd238;if(_['includes'](_0x34c594,0x3eb)){var _0x30d5e4=_['find'](_0x27b019,{'sectionId':0x3eb});return getCustomDashboards(_0x30d5e4)[_0x67ad('0x2a')](function(_0x79382a){return _[_0x67ad('0x31')](_0x27b019,function(_0x330478){if(_0x30d5e4[_0x67ad('0x64')]){if(_0x330478[_0x67ad('0x5c')]===0x3eb){_0x330478[_0x67ad('0x67')]=_0x79382a;}}else{if(_0x330478[_0x67ad('0x5c')]===0x64){if(!_0x330478[_0x67ad('0x67')]){_0x330478['subsections']=[];}_0x330478[_0x67ad('0x67')]=_0x330478[_0x67ad('0x67')][_0x67ad('0x68')](_0x79382a);}}return _0x330478;});});}else{return;}})[_0x67ad('0x2a')](function(_0x248865){if(_0x248865)_0x27b019=_0x248865;if(_['includes'](_0x34c594,0x709)){var _0x5a2261=_['find'](_0x27b019,{'sectionId':0x709});return getPlugins(_0x5a2261)[_0x67ad('0x2a')](function(_0x38d7e6){if(_0x5a2261[_0x67ad('0x64')]){return _[_0x67ad('0x31')](_0x27b019,function(_0x125a33){if(_0x125a33[_0x67ad('0x5c')]===0x709){_0x125a33[_0x67ad('0x67')]=_0x38d7e6;}return _0x125a33;});}else{var _0xd6d837={'sectionId':0x76c,'enabled':0x1,'subsections':_0x38d7e6};var _0x25fa9f=_[_0x67ad('0x31')](_0x27b019);_0x25fa9f[_0x67ad('0x61')](_0xd6d837);return _0x25fa9f;}});}else{return;}})[_0x67ad('0x2a')](function(_0x57b2e4){if(_0x57b2e4)_0x27b019=_0x57b2e4;return _[_0x67ad('0x44')](_0x27b019,[_0x67ad('0x64'),0x1]);})['then'](respondWithResult(_0x22c2d0,null))[_0x67ad('0x4b')](handleError(_0x22c2d0,null));};function hasDefaultDashboard(_0x5ac5c7){var _0x129764=[0x65];return new BPromise(function(_0x3a6ed6,_0x26aa34){try{if(_0x5ac5c7[_0x67ad('0x5b')]){_0x3a6ed6(_0x129764);}else{return db[_0x67ad('0x5e')]['findOne']({'where':{'sectionId':_0x5ac5c7['id']},'raw':!![]})['then'](function(_0x4b9cd1){_0x4b9cd1?_0x3a6ed6(_0x129764):_0x3a6ed6();});}}catch(_0x55d453){_0x26aa34(_0x55d453);}});}function getCustomDashboards(_0xfc5243){var _0x39e4fe=[];return new BPromise(function(_0x37e3b4,_0x3ddeb9){try{if(_0xfc5243[_0x67ad('0x5b')]){return db['Dashboard'][_0x67ad('0x4a')]({'raw':!![]})['then'](function(_0x53cdfc){_0x53cdfc[_0x67ad('0x69')](function(_0x241a13){_0x39e4fe[_0x67ad('0x61')](_0x241a13['id']+0x1869f);});_0x37e3b4(_0x39e4fe);});}else{return db[_0x67ad('0x5e')][_0x67ad('0x4a')]({'where':{'sectionId':_0xfc5243['id']},'raw':!![]})['then'](function(_0x44fcc3){_0x44fcc3['forEach'](function(_0x24af9d){_0x39e4fe[_0x67ad('0x61')](_0x24af9d['resourceId']+0x1869f);});_0x37e3b4(_0x39e4fe);});}}catch(_0x3deab1){_0x3ddeb9(_0x3deab1);}});}function getPlugins(_0x3667e4){var _0x4c6e8a=[];return new BPromise(function(_0x1e8b28,_0x5063f2){try{if(_0x3667e4[_0x67ad('0x5b')]){return db[_0x67ad('0x6a')][_0x67ad('0x4a')]({'raw':!![]})['then'](function(_0x156a82){_0x156a82[_0x67ad('0x69')](function(_0x3eba10){_0x4c6e8a[_0x67ad('0x61')](_0x3eba10['id']+0x15b38);});_0x1e8b28(_0x4c6e8a);});}else{return db[_0x67ad('0x5e')][_0x67ad('0x4a')]({'where':{'sectionId':_0x3667e4['id']},'raw':!![]})[_0x67ad('0x2a')](function(_0x382cbe){_0x382cbe['forEach'](function(_0x2ddd51){_0x4c6e8a[_0x67ad('0x61')](_0x2ddd51[_0x67ad('0x6b')]+0x15b38);});_0x1e8b28(_0x4c6e8a);});}}catch(_0x4d7661){_0x5063f2(_0x4d7661);}});}exports[_0x67ad('0x6c')]=function(_0x2a48cf,_0x5d40c0){return db['UserProfile'][_0x67ad('0x4e')]({'where':{'id':_0x2a48cf['params']['id']}})[_0x67ad('0x2a')](handleEntityNotFound(_0x5d40c0,null))[_0x67ad('0x2a')](function(_0x52467c){if(_0x52467c){return db['sequelize'][_0x67ad('0x57')](function(_0x3d4b8b){return db[_0x67ad('0x58')][_0x67ad('0x4a')]({'where':{'userProfileId':_0x2a48cf[_0x67ad('0x59')]['id']},'attributes':['id'],'raw':!![]})[_0x67ad('0x2a')](function(_0x328a93){if(_0x328a93){return db[_0x67ad('0x58')][_0x67ad('0x2b')]({'where':{'userProfileId':_0x2a48cf[_0x67ad('0x59')]['id'],'id':_[_0x67ad('0x31')](_0x328a93,function(_0x3cd4f8){return _0x3cd4f8['id'];})},'transaction':_0x3d4b8b});}})[_0x67ad('0x2a')](function(_0x22f99c){var _0xf4d176=_[_0x67ad('0x31')](_0x2a48cf[_0x67ad('0x50')],function(_0x26a649){_0x26a649['userProfileId']=_0x2a48cf[_0x67ad('0x59')]['id'];return _0x26a649;});return db[_0x67ad('0x58')][_0x67ad('0x6d')](_0xf4d176,{'raw':!![],'transaction':_0x3d4b8b});})['then'](function(_0x1a349b){var _0x320edb=_[_0x67ad('0x44')](_['map'](_0x1a349b,function(_0x34e408){return _0x34e408[_0x67ad('0x51')]({'plain':!![]});}),{'includeAll':![]});if(_0x320edb){return db['UserProfileSection'][_0x67ad('0x4a')]({'where':{'userProfileId':_0x2a48cf[_0x67ad('0x59')]['id'],'sectionId':_[_0x67ad('0x31')](_0x320edb,function(_0x3c8736){return _0x3c8736[_0x67ad('0x5c')];})},'attributes':['id',_0x67ad('0x5c')],'raw':!![]})[_0x67ad('0x2a')](function(_0x5357a8){var _0x3b5ac4=_[_0x67ad('0x31')](_0x2a48cf[_0x67ad('0x50')],function(_0xf2e734){_0xf2e734[_0x67ad('0x5d')]=_0x2a48cf[_0x67ad('0x59')]['id'];return _0xf2e734;});return db[_0x67ad('0x5e')][_0x67ad('0x6d')](_0x3b5ac4,{'raw':!![],'transaction':_0x3d4b8b});});}})['catch'](handleError(_0x5d40c0,null));});}})[_0x67ad('0x2a')](function(_0x28132c){var _0x3eb8de=_[_0x67ad('0x31')](_0x28132c,function(_0x150aa2){return _0x150aa2['get']({'plain':!![]});});})['then'](respondWithResult(_0x5d40c0,null))[_0x67ad('0x4b')](handleError(_0x5d40c0,null));};exports[_0x67ad('0x6e')]=function(_0x4e25d0,_0x232706,_0x556223){return db[_0x67ad('0x32')][_0x67ad('0x4e')]({'where':{'id':_0x4e25d0['params']['id']}})[_0x67ad('0x2a')](handleEntityNotFound(_0x232706,null))['then'](function(_0x1aec8a){if(_0x1aec8a){return _0x1aec8a[_0x67ad('0x6e')](_0x4e25d0[_0x67ad('0x38')][_0x67ad('0x63')]);}})[_0x67ad('0x2a')](respondWithStatusCode(_0x232706,null))[_0x67ad('0x4b')](handleError(_0x232706,null));};exports[_0x67ad('0x6f')]=function(_0x2bc211,_0x1419e5){var _0xe73365={};if(!_0x2bc211[_0x67ad('0x38')][_0x67ad('0x70')])throw new Error('Missing\x20section\x20parameter');if(!_0x2bc211[_0x67ad('0x38')][_0x67ad('0x3e')]('nolimit')){_0xe73365['limit']=qs[_0x67ad('0x22')](_0x2bc211[_0x67ad('0x38')][_0x67ad('0x22')]);_0xe73365[_0x67ad('0x20')]=qs[_0x67ad('0x20')](_0x2bc211[_0x67ad('0x38')][_0x67ad('0x20')]);}return db[_0x67ad('0x32')][_0x67ad('0x4e')]({'where':{'id':_0x2bc211[_0x67ad('0x59')]['id']}})[_0x67ad('0x2a')](function(_0x4d2d14){if(!_0x4d2d14)throw new Error(_0x67ad('0x71')+_0x2bc211[_0x67ad('0x59')]['id']);return db[_0x67ad('0x32')]['getResources'](_0x2bc211);})[_0x67ad('0x2a')](respondWithFilteredResult(_0x1419e5,_0xe73365))[_0x67ad('0x4b')](handleError(_0x1419e5,null));}; \ No newline at end of file +var _0x5341=['then','destroy','sendStatus','name','send','index','map','UserProfile','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','create','body','clone','find','get','omit','updatedAt','crudPermissions','createdAt','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','push','removeSections','getSections','includes','isEmpty','subsections','enabled','findOne','Dashboard','forEach','resourceId','addResources','removeResources','ids','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update'];(function(_0x99f811,_0x44d59e){var _0x37ba7f=function(_0x3f3961){while(--_0x3f3961){_0x99f811['push'](_0x99f811['shift']());}};_0x37ba7f(++_0x44d59e);}(_0x5341,0xbb));var _0x1534=function(_0x1bfe4e,_0x5ba960){_0x1bfe4e=_0x1bfe4e-0x0;var _0x575316=_0x5341[_0x1bfe4e];return _0x575316;};'use strict';var emlformat=require(_0x1534('0x0'));var rimraf=require(_0x1534('0x1'));var zipdir=require(_0x1534('0x2'));var jsonpatch=require(_0x1534('0x3'));var rp=require(_0x1534('0x4'));var moment=require(_0x1534('0x5'));var BPromise=require(_0x1534('0x6'));var Mustache=require(_0x1534('0x7'));var util=require('util');var path=require(_0x1534('0x8'));var sox=require('sox');var csv=require(_0x1534('0x9'));var ejs=require(_0x1534('0xa'));var fs=require('fs');var fs_extra=require(_0x1534('0xb'));var _=require(_0x1534('0xc'));var squel=require(_0x1534('0xd'));var crypto=require('crypto');var jsforce=require(_0x1534('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1534('0x9'));var querystring=require('querystring');var Papa=require(_0x1534('0xf'));var Redis=require(_0x1534('0x10'));var authService=require(_0x1534('0x11'));var qs=require(_0x1534('0x12'));var as=require(_0x1534('0x13'));var hardwareService=require(_0x1534('0x14'));var logger=require(_0x1534('0x15'))('api');var utils=require(_0x1534('0x16'));var config=require(_0x1534('0x17'));var licenseUtil=require(_0x1534('0x18'));var db=require(_0x1534('0x19'))['db'];config[_0x1534('0x1a')]=_['defaults'](config[_0x1534('0x1a')],{'host':_0x1534('0x1b'),'port':0x18eb});var socket=require(_0x1534('0x1c'))(new Redis(config['redis']));require('./userProfile.socket')[_0x1534('0x1d')](socket);function respondWithStatusCode(_0x42d504,_0x16570c){_0x16570c=_0x16570c||0xcc;return function(_0x23a515){if(_0x23a515){return _0x42d504['sendStatus'](_0x16570c);}return _0x42d504[_0x1534('0x1e')](_0x16570c)[_0x1534('0x1f')]();};}function respondWithResult(_0x46074d,_0x2c34c5){_0x2c34c5=_0x2c34c5||0xc8;return function(_0x13ee42){if(_0x13ee42){return _0x46074d[_0x1534('0x1e')](_0x2c34c5)['json'](_0x13ee42);}};}function respondWithFilteredResult(_0x2292fd,_0x22a9b3){return function(_0x31c5f9){if(_0x31c5f9){var _0x39d5cb=typeof _0x22a9b3[_0x1534('0x20')]===_0x1534('0x21')&&typeof _0x22a9b3['limit']===_0x1534('0x21');var _0x4dfb05=_0x31c5f9[_0x1534('0x22')];var _0x5c9041=_0x39d5cb?0x0:_0x22a9b3[_0x1534('0x20')];var _0x23e3f9=_0x39d5cb?_0x31c5f9[_0x1534('0x22')]:_0x22a9b3[_0x1534('0x20')]+_0x22a9b3[_0x1534('0x23')];var _0x1645f5;if(_0x23e3f9>=_0x4dfb05){_0x23e3f9=_0x4dfb05;_0x1645f5=0xc8;}else{_0x1645f5=0xce;}_0x2292fd['status'](_0x1645f5);return _0x2292fd[_0x1534('0x24')](_0x1534('0x25'),_0x5c9041+'-'+_0x23e3f9+'/'+_0x4dfb05)[_0x1534('0x26')](_0x31c5f9);}return null;};}function patchUpdates(_0x5e1733){return function(_0x2003d7){try{jsonpatch[_0x1534('0x27')](_0x2003d7,_0x5e1733,!![]);}catch(_0x22ec6d){return BPromise[_0x1534('0x28')](_0x22ec6d);}return _0x2003d7[_0x1534('0x29')]();};}function saveUpdates(_0x19b424,_0x1a08dd){return function(_0x408d34){if(_0x408d34){return _0x408d34[_0x1534('0x2a')](_0x19b424)[_0x1534('0x2b')](function(_0x467f59){return _0x467f59;});}return null;};}function removeEntity(_0x2b3cbe,_0x11fe23){return function(_0x8f8614){if(_0x8f8614){return _0x8f8614[_0x1534('0x2c')]()[_0x1534('0x2b')](function(){_0x2b3cbe[_0x1534('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2935d6,_0x107113){return function(_0x194932){if(!_0x194932){_0x2935d6[_0x1534('0x2d')](0x194);}return _0x194932;};}function handleError(_0x31a201,_0x157889){_0x157889=_0x157889||0x1f4;return function(_0x44fcb1){logger['error'](_0x44fcb1['stack']);if(_0x44fcb1[_0x1534('0x2e')]){delete _0x44fcb1['name'];}_0x31a201['status'](_0x157889)[_0x1534('0x2f')](_0x44fcb1);};}exports[_0x1534('0x30')]=function(_0x312635,_0x2768e9){var _0x2d7bbd={},_0x3ff721={},_0x372dec={'count':0x0,'rows':[]};var _0x1e193e=_[_0x1534('0x31')](db[_0x1534('0x32')]['rawAttributes'],function(_0x2e37be){return{'name':_0x2e37be[_0x1534('0x33')],'type':_0x2e37be['type'][_0x1534('0x34')]};});_0x3ff721[_0x1534('0x35')]=_['map'](_0x1e193e,'name');_0x3ff721[_0x1534('0x36')]=_[_0x1534('0x37')](_0x312635[_0x1534('0x36')]);_0x3ff721[_0x1534('0x38')]=_[_0x1534('0x39')](_0x3ff721[_0x1534('0x35')],_0x3ff721[_0x1534('0x36')]);_0x2d7bbd[_0x1534('0x3a')]=_[_0x1534('0x39')](_0x3ff721[_0x1534('0x35')],qs['fields'](_0x312635['query'][_0x1534('0x3b')]));_0x2d7bbd['attributes']=_0x2d7bbd['attributes'][_0x1534('0x3c')]?_0x2d7bbd['attributes']:_0x3ff721['model'];if(!_0x312635[_0x1534('0x36')][_0x1534('0x3d')](_0x1534('0x3e'))){_0x2d7bbd[_0x1534('0x23')]=qs['limit'](_0x312635[_0x1534('0x36')][_0x1534('0x23')]);_0x2d7bbd[_0x1534('0x20')]=qs['offset'](_0x312635[_0x1534('0x36')][_0x1534('0x20')]);}_0x2d7bbd[_0x1534('0x3f')]=qs[_0x1534('0x40')](_0x312635[_0x1534('0x36')][_0x1534('0x40')]);_0x2d7bbd[_0x1534('0x41')]=qs[_0x1534('0x38')](_['pick'](_0x312635[_0x1534('0x36')],_0x3ff721['filters']),_0x1e193e);if(_0x312635['query'][_0x1534('0x42')]){_0x2d7bbd[_0x1534('0x41')]=_[_0x1534('0x43')](_0x2d7bbd[_0x1534('0x41')],{'$or':_[_0x1534('0x31')](_0x1e193e,function(_0x199e2){if(_0x199e2[_0x1534('0x44')]!=='VIRTUAL'){var _0x5eec43={};_0x5eec43[_0x199e2[_0x1534('0x2e')]]={'$like':'%'+_0x312635[_0x1534('0x36')]['filter']+'%'};return _0x5eec43;}})});}_0x2d7bbd=_[_0x1534('0x43')]({},_0x2d7bbd,_0x312635['options']);var _0x36e49b={'where':_0x2d7bbd[_0x1534('0x41')]};return db[_0x1534('0x32')][_0x1534('0x22')](_0x36e49b)[_0x1534('0x2b')](function(_0x8ab61e){_0x372dec[_0x1534('0x22')]=_0x8ab61e;if(_0x312635[_0x1534('0x36')][_0x1534('0x45')]){_0x2d7bbd[_0x1534('0x46')]=[{'all':!![]}];}return db[_0x1534('0x32')][_0x1534('0x47')](_0x2d7bbd);})['then'](function(_0x475abb){_0x372dec[_0x1534('0x48')]=_0x475abb;return _0x372dec;})[_0x1534('0x2b')](respondWithFilteredResult(_0x2768e9,_0x2d7bbd))[_0x1534('0x49')](handleError(_0x2768e9,null));};exports[_0x1534('0x4a')]=function(_0x28aa0e,_0x418f96){var _0x3cbe19={'raw':![],'where':{'id':_0x28aa0e[_0x1534('0x4b')]['id']}},_0x2d87df={};_0x2d87df['model']=_[_0x1534('0x37')](db['UserProfile'][_0x1534('0x4c')]);_0x2d87df[_0x1534('0x36')]=_[_0x1534('0x37')](_0x28aa0e[_0x1534('0x36')]);_0x2d87df[_0x1534('0x38')]=_[_0x1534('0x39')](_0x2d87df[_0x1534('0x35')],_0x2d87df[_0x1534('0x36')]);_0x3cbe19[_0x1534('0x3a')]=_[_0x1534('0x39')](_0x2d87df['model'],qs['fields'](_0x28aa0e[_0x1534('0x36')][_0x1534('0x3b')]));_0x3cbe19['attributes']=_0x3cbe19[_0x1534('0x3a')]['length']?_0x3cbe19[_0x1534('0x3a')]:_0x2d87df[_0x1534('0x35')];if(_0x28aa0e[_0x1534('0x36')][_0x1534('0x45')]){_0x3cbe19[_0x1534('0x46')]=[{'all':!![]}];}_0x3cbe19=_['merge']({},_0x3cbe19,_0x28aa0e[_0x1534('0x4d')]);return db[_0x1534('0x32')]['find'](_0x3cbe19)['then'](handleEntityNotFound(_0x418f96,null))['then'](respondWithResult(_0x418f96,null))['catch'](handleError(_0x418f96,null));};exports[_0x1534('0x4e')]=function(_0x5ca63c,_0x2a4307){return db[_0x1534('0x32')][_0x1534('0x4e')](_0x5ca63c[_0x1534('0x4f')],{})[_0x1534('0x2b')](respondWithResult(_0x2a4307,0xc9))[_0x1534('0x49')](handleError(_0x2a4307,null));};exports[_0x1534('0x50')]=function(_0x41bd08,_0x404b83){var _0x3781d3={'where':{'id':_0x41bd08[_0x1534('0x4b')]['id']}},_0x3f556d={};_0x3f556d['model']=_[_0x1534('0x37')](db[_0x1534('0x32')][_0x1534('0x4c')]);_0x3781d3['attributes']=_[_0x1534('0x39')](_0x3f556d[_0x1534('0x35')],qs[_0x1534('0x3b')](_0x41bd08[_0x1534('0x36')][_0x1534('0x3b')]));_0x3781d3[_0x1534('0x3a')]=_0x3781d3['attributes'][_0x1534('0x3c')]?_0x3781d3[_0x1534('0x3a')]:_0x3f556d[_0x1534('0x35')];if(_0x41bd08['query'][_0x1534('0x45')]){_0x3781d3[_0x1534('0x46')]=[{'all':!![]}];}_0x3781d3=_[_0x1534('0x43')]({},_0x3781d3,_0x41bd08['options']);return db[_0x1534('0x32')][_0x1534('0x51')](_0x3781d3)[_0x1534('0x2b')](handleEntityNotFound(_0x404b83,null))[_0x1534('0x2b')](function(_0x28bf34){if(_0x28bf34){var _0x4e716d=_0x28bf34[_0x1534('0x52')]({'plain':!![]});_0x4e716d=qs[_0x1534('0x53')](_0x4e716d,['id','createdAt',_0x1534('0x54'),_0x1534('0x55')]);_0x41bd08['body']=_[_0x1534('0x53')](_0x41bd08[_0x1534('0x4f')],['id',_0x1534('0x56'),_0x1534('0x54')]);return db[_0x1534('0x57')][_0x1534('0x58')](function(_0x3949be){return db[_0x1534('0x32')][_0x1534('0x4e')](_['merge'](_0x4e716d,_0x41bd08[_0x1534('0x4f')]),{'include':_0x41bd08[_0x1534('0x36')][_0x1534('0x45')]?[{'all':!![]}]:undefined,'transaction':_0x3949be})[_0x1534('0x2b')](function(_0x474180){var _0x1d8d40=_0x474180['get']({'plain':!![]});return db[_0x1534('0x59')][_0x1534('0x47')]({'where':{'userProfileId':_0x41bd08[_0x1534('0x4b')]['id']},'raw':!![]})[_0x1534('0x2b')](function(_0x3b85ae){if(_0x3b85ae){return BPromise[_0x1534('0x5a')](_0x3b85ae,function(_0x96945b){return new BPromise(function(_0xc7a02d,_0x285f86){if(_0x96945b[_0x1534('0x5b')]===null||_0x96945b[_0x1534('0x5b')]===0x1)_0xc7a02d(null);return db[_0x1534('0x5c')]['findAll']({'where':{'sectionId':_0x96945b['id']},'raw':!![]})[_0x1534('0x2b')](function(_0x4a5e92){var _0x2cb86b=_[_0x1534('0x31')](_0x4a5e92,function(_0x362c01){return qs[_0x1534('0x53')](_0x362c01,['id',_0x1534('0x56'),'updatedAt',_0x1534('0x5d')]);});_0xc7a02d(_0x2cb86b);})[_0x1534('0x49')](function(_0x5e7edd){_0x285f86(_0x5e7edd);});})[_0x1534('0x2b')](function(_0x1d6313){var _0x7caa7b=qs[_0x1534('0x53')](_0x96945b,['id','createdAt',_0x1534('0x54')]);_0x7caa7b[_0x1534('0x5e')]=_0x1d8d40['id'];if(_0x1d6313)_0x7caa7b[_0x1534('0x5f')]=_0x1d6313;return _0x7caa7b;})[_0x1534('0x2b')](function(_0x525eb0){return db[_0x1534('0x59')][_0x1534('0x4e')](_0x525eb0,{'include':[{'model':db['UserProfileResource'],'as':_0x1534('0x5f')}],'raw':!![],'transaction':_0x3949be});});})[_0x1534('0x2b')](function(){return _0x1d8d40;});}});});});}})[_0x1534('0x2b')](respondWithResult(_0x404b83,0xc9))[_0x1534('0x49')](handleError(_0x404b83,null));};exports[_0x1534('0x2a')]=function(_0xaf7079,_0x5de5b2){if(_0xaf7079[_0x1534('0x4f')]['id']){delete _0xaf7079[_0x1534('0x4f')]['id'];}return db[_0x1534('0x32')][_0x1534('0x51')]({'where':{'id':_0xaf7079[_0x1534('0x4b')]['id']}})[_0x1534('0x2b')](handleEntityNotFound(_0x5de5b2,null))[_0x1534('0x2b')](saveUpdates(_0xaf7079[_0x1534('0x4f')],null))[_0x1534('0x2b')](respondWithResult(_0x5de5b2,null))[_0x1534('0x49')](handleError(_0x5de5b2,null));};exports[_0x1534('0x2c')]=function(_0x146454,_0x55df0c){return db[_0x1534('0x32')]['find']({'where':{'id':_0x146454[_0x1534('0x4b')]['id']}})[_0x1534('0x2b')](handleEntityNotFound(_0x55df0c,null))[_0x1534('0x2b')](removeEntity(_0x55df0c,null))[_0x1534('0x49')](handleError(_0x55df0c,null));};exports[_0x1534('0x60')]=function(_0x5264f9,_0x1113e5){return db['UserProfile']['describe']()[_0x1534('0x2b')](respondWithResult(_0x1113e5,null))[_0x1534('0x49')](handleError(_0x1113e5,null));};exports['addSections']=function(_0x425267,_0x4283e0){var _0x364e8a=_0x425267['body'];return db[_0x1534('0x32')][_0x1534('0x51')]({'where':{'id':_0x425267['params']['id']}})['then'](handleEntityNotFound(_0x4283e0,null))['then'](function(_0x58b2a2){if(_0x58b2a2){return db['sequelize'][_0x1534('0x58')](function(_0x514d06){return db[_0x1534('0x59')]['destroy']({'where':{'userProfileId':_0x425267['params']['id'],'sectionId':_[_0x1534('0x31')](_0x364e8a,function(_0x548f98){return _0x548f98['sectionId'];})},'transaction':_0x514d06})[_0x1534('0x2b')](function(){var _0x14e384=_['map'](_0x364e8a,function(_0xf32170){_0xf32170[_0x1534('0x5e')]=_0x425267[_0x1534('0x4b')]['id'];return _0xf32170;});var _0x1c27c6=[];return BPromise[_0x1534('0x5a')](_0x14e384,function(_0x16705f){return db['UserProfileSection'][_0x1534('0x4e')](_0x16705f,{'include':[{'model':db['UserProfileResource'],'as':_0x1534('0x5f')}],'raw':!![],'transaction':_0x514d06})[_0x1534('0x2b')](function(_0x46c9f7){_0x1c27c6[_0x1534('0x61')](_0x46c9f7[_0x1534('0x52')]({'plain':!![]}));});})[_0x1534('0x2b')](function(){return _0x1c27c6;});});});}})[_0x1534('0x2b')](function(_0x62a479){return _0x62a479;})[_0x1534('0x2b')](respondWithResult(_0x4283e0,null))['catch'](handleError(_0x4283e0,null));};exports[_0x1534('0x62')]=function(_0x4931f1,_0x6788c3){var _0x2f1cfa;return db[_0x1534('0x32')]['find']({'where':{'id':_0x4931f1[_0x1534('0x4b')]['id']},'attributes':['id',_0x1534('0x2e')]})['then'](handleEntityNotFound(_0x6788c3,null))['then'](function(_0xe9a103){if(_0xe9a103){_0x2f1cfa=_0xe9a103;return db[_0x1534('0x59')][_0x1534('0x2c')]({'where':{'userProfileId':_0x4931f1[_0x1534('0x4b')]['id'],'sectionId':_0x4931f1[_0x1534('0x36')]['ids']}});}})[_0x1534('0x2b')](function(){return _0x2f1cfa;})[_0x1534('0x2b')](respondWithStatusCode(_0x6788c3,null))[_0x1534('0x49')](handleError(_0x6788c3,null));};exports[_0x1534('0x63')]=function(_0x53cf8b,_0x55c210){var _0xa37ab1=[];var _0x15c1d4=[];return db[_0x1534('0x59')]['findAll']({'where':{'userProfileId':_0x53cf8b['params']['id']},'raw':!![]})['then'](function(_0x132b0f){_0xa37ab1=_[_0x1534('0x42')](_0x132b0f,function(_0x1f40d4){return _0x1f40d4['enabled']===0x1||_[_0x1534('0x64')]([0x3eb,0x709],_0x1f40d4[_0x1534('0x5d')]);});if(!_[_0x1534('0x65')](_0xa37ab1)){return _[_0x1534('0x31')](_0xa37ab1,function(_0x3f591a){return _0x3f591a[_0x1534('0x5d')];});}else{return;}})['then'](function(_0x1dca2f){if(_0x1dca2f)_0x15c1d4=_0x1dca2f;if(_[_0x1534('0x64')](_0x15c1d4,0x64)){var _0x44d0e3=_[_0x1534('0x51')](_0xa37ab1,{'sectionId':0x64});return hasDefaultDashboard(_0x44d0e3)[_0x1534('0x2b')](function(_0x5d9e94){return _[_0x1534('0x31')](_0xa37ab1,function(_0x38cd09){if(_0x38cd09['sectionId']===0x64){_0x38cd09[_0x1534('0x66')]=_0x5d9e94;}return _0x38cd09;});});}else{return;}})['then'](function(_0x48824a){if(_0x48824a)_0xa37ab1=_0x48824a;if(_[_0x1534('0x64')](_0x15c1d4,0x3eb)){var _0x56c903=_[_0x1534('0x51')](_0xa37ab1,{'sectionId':0x3eb});return getCustomDashboards(_0x56c903)['then'](function(_0x5cc909){return _[_0x1534('0x31')](_0xa37ab1,function(_0xf85f55){if(_0x56c903[_0x1534('0x67')]){if(_0xf85f55[_0x1534('0x5d')]===0x3eb){_0xf85f55[_0x1534('0x66')]=_0x5cc909;}}else{if(_0xf85f55[_0x1534('0x5d')]===0x64){if(!_0xf85f55[_0x1534('0x66')]){_0xf85f55[_0x1534('0x66')]=[];}_0xf85f55[_0x1534('0x66')]=_0xf85f55[_0x1534('0x66')]['concat'](_0x5cc909);}}return _0xf85f55;});});}else{return;}})[_0x1534('0x2b')](function(_0x33b9a2){if(_0x33b9a2)_0xa37ab1=_0x33b9a2;if(_[_0x1534('0x64')](_0x15c1d4,0x709)){var _0x159551=_['find'](_0xa37ab1,{'sectionId':0x709});return getPlugins(_0x159551)['then'](function(_0xc239de){if(_0x159551[_0x1534('0x67')]){return _[_0x1534('0x31')](_0xa37ab1,function(_0x5a8fe6){if(_0x5a8fe6[_0x1534('0x5d')]===0x709){_0x5a8fe6['subsections']=_0xc239de;}return _0x5a8fe6;});}else{var _0x3ecaef={'sectionId':0x76c,'enabled':0x1,'subsections':_0xc239de};var _0x4ef90b=_[_0x1534('0x31')](_0xa37ab1);_0x4ef90b['push'](_0x3ecaef);return _0x4ef90b;}});}else{return;}})[_0x1534('0x2b')](function(_0x24b39d){if(_0x24b39d)_0xa37ab1=_0x24b39d;return _['filter'](_0xa37ab1,[_0x1534('0x67'),0x1]);})[_0x1534('0x2b')](respondWithResult(_0x55c210,null))[_0x1534('0x49')](handleError(_0x55c210,null));};function hasDefaultDashboard(_0x2382a1){var _0x1b6277=[0x65];return new BPromise(function(_0x1aa3b8,_0x3a487b){try{if(_0x2382a1[_0x1534('0x5b')]){_0x1aa3b8(_0x1b6277);}else{return db[_0x1534('0x5c')][_0x1534('0x68')]({'where':{'sectionId':_0x2382a1['id']},'raw':!![]})['then'](function(_0x495799){_0x495799?_0x1aa3b8(_0x1b6277):_0x1aa3b8();});}}catch(_0x5e31fc){_0x3a487b(_0x5e31fc);}});}function getCustomDashboards(_0x1648bf){var _0xe85ec4=[];return new BPromise(function(_0x23af5f,_0x3dd084){try{if(_0x1648bf['autoAssociation']){return db[_0x1534('0x69')]['findAll']({'raw':!![]})[_0x1534('0x2b')](function(_0x2098fa){_0x2098fa[_0x1534('0x6a')](function(_0x3b498f){_0xe85ec4[_0x1534('0x61')](_0x3b498f['id']+0x1869f);});_0x23af5f(_0xe85ec4);});}else{return db['UserProfileResource'][_0x1534('0x47')]({'where':{'sectionId':_0x1648bf['id']},'raw':!![]})[_0x1534('0x2b')](function(_0x136fc3){_0x136fc3[_0x1534('0x6a')](function(_0x50e339){_0xe85ec4[_0x1534('0x61')](_0x50e339['resourceId']+0x1869f);});_0x23af5f(_0xe85ec4);});}}catch(_0x2949db){_0x3dd084(_0x2949db);}});}function getPlugins(_0x2dc96c){var _0x5a50ef=[];return new BPromise(function(_0x105e3f,_0x8f888b){try{if(_0x2dc96c[_0x1534('0x5b')]){return db['Plugin'][_0x1534('0x47')]({'raw':!![]})['then'](function(_0x119dd4){_0x119dd4[_0x1534('0x6a')](function(_0x1cec0b){_0x5a50ef[_0x1534('0x61')](_0x1cec0b['id']+0x15b38);});_0x105e3f(_0x5a50ef);});}else{return db[_0x1534('0x5c')]['findAll']({'where':{'sectionId':_0x2dc96c['id']},'raw':!![]})[_0x1534('0x2b')](function(_0x1a1794){_0x1a1794[_0x1534('0x6a')](function(_0x35fcae){_0x5a50ef['push'](_0x35fcae[_0x1534('0x6b')]+0x15b38);});_0x105e3f(_0x5a50ef);});}}catch(_0x15c23a){_0x8f888b(_0x15c23a);}});}exports[_0x1534('0x6c')]=function(_0x226958,_0x439e08){return db[_0x1534('0x32')][_0x1534('0x51')]({'where':{'id':_0x226958[_0x1534('0x4b')]['id']}})['then'](handleEntityNotFound(_0x439e08,null))[_0x1534('0x2b')](function(_0x2e0636){if(_0x2e0636){return db[_0x1534('0x57')]['transaction'](function(_0x4ab2b7){return db[_0x1534('0x59')]['findAll']({'where':{'userProfileId':_0x226958[_0x1534('0x4b')]['id']},'attributes':['id'],'raw':!![]})[_0x1534('0x2b')](function(_0x9a6c44){if(_0x9a6c44){return db[_0x1534('0x59')][_0x1534('0x2c')]({'where':{'userProfileId':_0x226958['params']['id'],'id':_[_0x1534('0x31')](_0x9a6c44,function(_0x2437ce){return _0x2437ce['id'];})},'transaction':_0x4ab2b7});}})[_0x1534('0x2b')](function(_0xf44891){var _0x224f5b=_[_0x1534('0x31')](_0x226958[_0x1534('0x4f')],function(_0x496343){_0x496343[_0x1534('0x5e')]=_0x226958[_0x1534('0x4b')]['id'];return _0x496343;});return db[_0x1534('0x59')]['bulkCreate'](_0x224f5b,{'raw':!![],'transaction':_0x4ab2b7});})[_0x1534('0x2b')](function(_0x27b23b){var _0x98c9ed=_[_0x1534('0x42')](_['map'](_0x27b23b,function(_0x30525e){return _0x30525e['get']({'plain':!![]});}),{'includeAll':![]});if(_0x98c9ed){return db[_0x1534('0x59')][_0x1534('0x47')]({'where':{'userProfileId':_0x226958['params']['id'],'sectionId':_[_0x1534('0x31')](_0x98c9ed,function(_0x2c01ae){return _0x2c01ae[_0x1534('0x5d')];})},'attributes':['id',_0x1534('0x5d')],'raw':!![]})[_0x1534('0x2b')](function(_0x190490){var _0x176e05=_['map'](_0x226958[_0x1534('0x4f')],function(_0x3a1ee3){_0x3a1ee3[_0x1534('0x5e')]=_0x226958[_0x1534('0x4b')]['id'];return _0x3a1ee3;});return db['UserProfileResource']['bulkCreate'](_0x176e05,{'raw':!![],'transaction':_0x4ab2b7});});}})[_0x1534('0x49')](handleError(_0x439e08,null));});}})[_0x1534('0x2b')](function(_0x106fc8){var _0x307347=_[_0x1534('0x31')](_0x106fc8,function(_0xe400c7){return _0xe400c7[_0x1534('0x52')]({'plain':!![]});});})[_0x1534('0x2b')](respondWithResult(_0x439e08,null))['catch'](handleError(_0x439e08,null));};exports[_0x1534('0x6d')]=function(_0x475c8a,_0x3bd222,_0x1f2aa5){return db['UserProfile'][_0x1534('0x51')]({'where':{'id':_0x475c8a[_0x1534('0x4b')]['id']}})[_0x1534('0x2b')](handleEntityNotFound(_0x3bd222,null))[_0x1534('0x2b')](function(_0x2fdabb){if(_0x2fdabb){return _0x2fdabb[_0x1534('0x6d')](_0x475c8a[_0x1534('0x36')][_0x1534('0x6e')]);}})[_0x1534('0x2b')](respondWithStatusCode(_0x3bd222,null))[_0x1534('0x49')](handleError(_0x3bd222,null));};exports[_0x1534('0x6f')]=function(_0x565d19,_0x390edc){var _0x196804={};if(!_0x565d19[_0x1534('0x36')][_0x1534('0x70')])throw new Error(_0x1534('0x71'));if(!_0x565d19[_0x1534('0x36')][_0x1534('0x3d')](_0x1534('0x3e'))){_0x196804[_0x1534('0x23')]=qs[_0x1534('0x23')](_0x565d19['query']['limit']);_0x196804['offset']=qs[_0x1534('0x20')](_0x565d19[_0x1534('0x36')][_0x1534('0x20')]);}return db['UserProfile'][_0x1534('0x51')]({'where':{'id':_0x565d19[_0x1534('0x4b')]['id']}})[_0x1534('0x2b')](function(_0x2a27b3){if(!_0x2a27b3)throw new Error(_0x1534('0x72')+_0x565d19['params']['id']);return db[_0x1534('0x32')][_0x1534('0x6f')](_0x565d19);})[_0x1534('0x2b')](respondWithFilteredResult(_0x390edc,_0x196804))[_0x1534('0x49')](handleError(_0x390edc,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 692a67c..deefa97 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 _0x8b8e=['save','emit','hasOwnProperty','hook','exports','events','UserProfile'];(function(_0x47a491,_0x45e171){var _0x3b176b=function(_0x8c826){while(--_0x8c826){_0x47a491['push'](_0x47a491['shift']());}};_0x3b176b(++_0x45e171);}(_0x8b8e,0x108));var _0xe8b8=function(_0x1097d2,_0x53ad38){_0x1097d2=_0x1097d2-0x0;var _0x4d972c=_0x8b8e[_0x1097d2];return _0x4d972c;};'use strict';var EventEmitter=require(_0xe8b8('0x0'));var UserProfile=require('../../mysqldb')['db'][_0xe8b8('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe8b8('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xb409fe){return function(_0x472a91,_0x13a865,_0x221ccc){UserProfileEvents[_0xe8b8('0x3')](_0xb409fe+':'+_0x472a91['id'],_0x472a91);UserProfileEvents[_0xe8b8('0x3')](_0xb409fe,_0x472a91);_0x221ccc(null);};}for(var e in events){if(events[_0xe8b8('0x4')](e)){var event=events[e];UserProfile[_0xe8b8('0x5')](e,emitEvent(event));}}module[_0xe8b8('0x6')]=UserProfileEvents; \ No newline at end of file +var _0xc359=['save','update','emit','../../mysqldb','setMaxListeners'];(function(_0x7f4255,_0xac7471){var _0x437103=function(_0x308f9f){while(--_0x308f9f){_0x7f4255['push'](_0x7f4255['shift']());}};_0x437103(++_0xac7471);}(_0xc359,0x1d9));var _0x9c35=function(_0x2c8b7a,_0x483fe0){_0x2c8b7a=_0x2c8b7a-0x0;var _0x1c1cf9=_0xc359[_0x2c8b7a];return _0x1c1cf9;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x9c35('0x0'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x9c35('0x1')](0x0);var events={'afterCreate':_0x9c35('0x2'),'afterUpdate':_0x9c35('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3cfffd){return function(_0x53a490,_0x1540b4,_0x5d4ee8){UserProfileEvents[_0x9c35('0x4')](_0x3cfffd+':'+_0x53a490['id'],_0x53a490);UserProfileEvents['emit'](_0x3cfffd,_0x53a490);_0x5d4ee8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 55b69bf..2f420ea 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 _0x0d62=['projects','JscriptyProject','contacts','CmContact','Lists','ListId','lists','CmList','companies','CmCompany','chatqueues','ChatQueue','chatwebsites','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','contexts','voicemails','voicerecordings','membername','User','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','mailqueues','MailQueue','mailaccounts','MailAccount','MailSubstatus','openchannelaccounts','SmsAccount','WhatsappAccount','teams','Team','queuecampaigns','users','agents','telephones','Users','role','user','Agents','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','pauses','Schedule','sounds','Sound','tags','Tag','templates','Template','triggers','Trigger','trunks','Trunk','Variable','plugins','Plugin','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','Sequelize','QueryTypes','ui.','from','_interactions','sequelize','toString','OpenTabs','user_profiles','query','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','push','UserProfileSection','find','all','ignore','autoAssociation','length','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','offset','order','sort','where','key','forEach','merge','reportType','default','DefaultReports','custom','count','rows','ids','customSorting','extraQueryConditions','includeAll','color','tag','include','sms','dataValues','mail','whatsapp','lodash','./userProfile.attributes','squel','exports','models','filter','field','value','findAll','then','associatedResources','map','catch','model','name','resolve','UserProfileResource','AnalyticExtractedReport','type','resourceId','toLowerCase','squareprojects','SquareProject','odbc','childModel','SquareOdbc','squarerecordings','SquareRecording','parentSections','projectName'];(function(_0x5cb094,_0x1b7132){var _0x14b755=function(_0x439ec3){while(--_0x439ec3){_0x5cb094['push'](_0x5cb094['shift']());}};_0x14b755(++_0x1b7132);}(_0x0d62,0x1ef));var _0x20d6=function(_0xd7b0a4,_0x53c7d3){_0xd7b0a4=_0xd7b0a4-0x0;var _0x184e9e=_0x0d62[_0xd7b0a4];return _0x184e9e;};'use strict';var _=require(_0x20d6('0x0'));var attributes=require(_0x20d6('0x1'));var qs=require('../../components/parsers/qs');var squel=require(_0x20d6('0x2'));module[_0x20d6('0x3')]=function(_0x257d54){var _0x227ce0=_0x257d54[_0x20d6('0x4')];function _0x2ecf43(_0x2c697b,_0x47ed3a){return new Promise(function(_0x2bb626,_0x51fa91){if(!_0x47ed3a)return _0x2bb626(null);var _0x1e3781=_0x47ed3a[_0x20d6('0x5')]?{[_0x47ed3a[_0x20d6('0x5')][_0x20d6('0x6')]]:_0x47ed3a['filter'][_0x20d6('0x7')]}:undefined;return _0x227ce0[_0x2c697b][_0x20d6('0x8')]({'where':_0x1e3781,'raw':!![]})[_0x20d6('0x9')](function(_0x5ec549){_0x47ed3a[_0x20d6('0xa')]=_[_0x20d6('0xb')](_0x5ec549,'id');_0x2bb626(_0x47ed3a);})[_0x20d6('0xc')](function(_0x3f011e){_0x51fa91(_0x3f011e);});});}function _0x33fc8c(_0x5d0714,_0x4a8b5d){return new Promise(function(_0x237306,_0x1b4621){var _0x4a1ba7=_0x5d0714[_0x20d6('0x5')]?{[_0x5d0714['filter'][_0x20d6('0x6')]]:_0x5d0714[_0x20d6('0x5')][_0x20d6('0x7')]}:undefined;return _0x227ce0[_0x5d0714[_0x20d6('0xd')]][_0x20d6('0x8')]({'where':_0x4a1ba7,'raw':!![]})['then'](function(_0x5f24c5){_0x4a8b5d[_0x20d6('0xa')]=_['map'](_0x5f24c5,function(_0x3453fb){return _0x3453fb[_0x20d6('0xe')];});_0x237306(_0x4a8b5d);})['catch'](function(_0x1ac416){_0x1b4621(_0x1ac416);});});}function _0x2a91e1(_0x209580,_0x5868a4,_0x42bc79){if(!_0x5868a4)return Promise[_0x20d6('0xf')](null);return new Promise(function(_0x5297d8,_0x37fe4f){return _0x227ce0[_0x20d6('0x10')]['findAll']({'where':{'sectionId':_0x5868a4['id']},'raw':!![]})[_0x20d6('0x9')](function(_0x1e3c63){if(_0x209580[_0x20d6('0x6')]&&_0x209580['field']!=='id'){_0x5868a4['associatedResources']=_['map'](_0x1e3c63,function(_0x438c00){return _0x438c00[_0x209580[_0x20d6('0x6')]];});}else{if(_0x42bc79===_0x20d6('0x11')){_0x5868a4[_0x20d6('0xa')]=_[_0x20d6('0xb')](_0x1e3c63,function(_0x2e6bfe){return{'id':_0x2e6bfe['resourceId'],'type':_0x2e6bfe[_0x20d6('0x12')]};});}else{_0x5868a4[_0x20d6('0xa')]=_['map'](_0x1e3c63,function(_0x4856a8){return _0x4856a8[_0x20d6('0x13')];});}}_0x5297d8(_0x5868a4);})[_0x20d6('0xc')](function(_0x55ce38){_0x37fe4f(_0x55ce38);});});}function _0x3cecef(_0x28c954,_0x487bfc){var _0x46e51d={'parentSections':[]};switch(_0x28c954[_0x20d6('0x14')]()){case _0x20d6('0x15'):_0x46e51d['childModel']=_0x20d6('0x16');break;case _0x20d6('0x17'):_0x46e51d[_0x20d6('0x18')]=_0x20d6('0x19');break;case _0x20d6('0x1a'):_0x46e51d[_0x20d6('0x18')]=_0x20d6('0x1b');_0x46e51d[_0x20d6('0x1c')]=[{'name':'SquareProjects','field':_0x20d6('0xe'),'foreignKey':_0x20d6('0x1d')}];break;case _0x20d6('0x1e'):_0x46e51d['childModel']=_0x20d6('0x1f');break;case _0x20d6('0x20'):_0x46e51d['childModel']=_0x20d6('0x21');_0x46e51d['parentSections']=[{'name':_0x20d6('0x22'),'field':'id','foreignKey':_0x20d6('0x23')}];break;case _0x20d6('0x24'):_0x46e51d[_0x20d6('0x18')]=_0x20d6('0x25');break;case _0x20d6('0x26'):_0x46e51d[_0x20d6('0x18')]=_0x20d6('0x27');break;case'globalcustomfields':_0x46e51d['childModel']='CmCustomField';break;case _0x20d6('0x28'):_0x46e51d[_0x20d6('0x18')]=_0x20d6('0x29');break;case _0x20d6('0x2a'):_0x46e51d[_0x20d6('0x18')]='ChatWebsite';break;case'faxqueues':_0x46e51d[_0x20d6('0x18')]=_0x20d6('0x2b');break;case _0x20d6('0x2c'):_0x46e51d['childModel']=_0x20d6('0x2d');break;case _0x20d6('0x2e'):case _0x20d6('0x2f'):case _0x20d6('0x30'):_0x46e51d[_0x20d6('0x18')]='VoiceExtension';break;case _0x20d6('0x31'):_0x46e51d['childModel']='VoiceContext';break;case _0x20d6('0x32'):_0x46e51d['childModel']='VoiceMail';break;case _0x20d6('0x33'):_0x46e51d[_0x20d6('0x18')]='VoiceRecording';_0x46e51d[_0x20d6('0x1c')]=[{'name':'Agents','field':_0x20d6('0xe'),'foreignKey':_0x20d6('0x34'),'model':_0x20d6('0x35'),'filter':{'field':'role','value':[_0x20d6('0x36')]}},{'name':_0x20d6('0x37'),'field':'name','foreignKey':'membername','model':_0x20d6('0x35'),'filter':{'field':'role','value':[_0x20d6('0x38')]}},{'name':_0x20d6('0x39'),'field':_0x20d6('0xe'),'foreignKey':_0x20d6('0x3a'),'model':_0x20d6('0x3b'),'filter':{'field':_0x20d6('0x12'),'value':[_0x20d6('0x3c')]}},{'name':_0x20d6('0x3d'),'field':_0x20d6('0xe'),'foreignKey':_0x20d6('0x3a'),'model':_0x20d6('0x3b'),'filter':{'field':_0x20d6('0x12'),'value':[_0x20d6('0x3e')]}}];break;case _0x20d6('0x3f'):_0x46e51d[_0x20d6('0x18')]=_0x20d6('0x40');break;case _0x20d6('0x41'):_0x46e51d[_0x20d6('0x18')]=_0x20d6('0x42');break;case'voiceprefixes':_0x46e51d['childModel']='VoicePrefix';break;case'ivrcampaigns':_0x46e51d[_0x20d6('0x18')]='Campaign';break;case _0x20d6('0x43'):_0x46e51d[_0x20d6('0x18')]=_0x20d6('0x44');break;case _0x20d6('0x45'):_0x46e51d['childModel']=_0x20d6('0x46');break;case'mailsubstatuses':_0x46e51d[_0x20d6('0x18')]=_0x20d6('0x47');break;case'openchannelqueues':_0x46e51d['childModel']='OpenchannelQueue';break;case _0x20d6('0x48'):_0x46e51d[_0x20d6('0x18')]='OpenchannelAccount';break;case'smsqueues':_0x46e51d[_0x20d6('0x18')]='SmsQueue';break;case'smsaccounts':_0x46e51d[_0x20d6('0x18')]=_0x20d6('0x49');break;case'whatsappqueues':_0x46e51d['childModel']='WhatsappQueue';break;case'whatsappaccounts':_0x46e51d[_0x20d6('0x18')]=_0x20d6('0x4a');break;case _0x20d6('0x4b'):_0x46e51d[_0x20d6('0x18')]=_0x20d6('0x4c');break;case'voicequeues':case _0x20d6('0x4d'):_0x46e51d[_0x20d6('0x18')]=_0x20d6('0x3b');if(_0x487bfc){_0x46e51d['parentSections']=[{'name':_0x20d6('0x39')},{'name':_0x20d6('0x3d')}];}break;case _0x20d6('0x4e'):case _0x20d6('0x4f'):case _0x20d6('0x50'):_0x46e51d[_0x20d6('0x18')]=_0x20d6('0x35');if(_0x487bfc){_0x46e51d[_0x20d6('0x1c')]=[{'name':_0x20d6('0x51'),'filter':{'field':_0x20d6('0x52'),'value':['admin',_0x20d6('0x53')]},'ignore':!![]},{'name':_0x20d6('0x54')},{'name':_0x20d6('0x37')}];}break;case _0x20d6('0x55'):_0x46e51d[_0x20d6('0x18')]=_0x20d6('0x56');break;case _0x20d6('0x57'):_0x46e51d['childModel']=_0x20d6('0x58');break;case _0x20d6('0x59'):_0x46e51d['childModel']=_0x20d6('0x5a');break;case'sugarcrmaccounts':_0x46e51d['childModel']=_0x20d6('0x5b');break;case _0x20d6('0x5c'):_0x46e51d[_0x20d6('0x18')]=_0x20d6('0x5d');break;case _0x20d6('0x5e'):_0x46e51d['childModel']='ZohoAccount';break;case'vtigeraccounts':_0x46e51d['childModel']='User';break;case _0x20d6('0x5f'):_0x46e51d['childModel']=_0x20d6('0x60');break;case _0x20d6('0x61'):_0x46e51d[_0x20d6('0x18')]=_0x20d6('0x62');break;case _0x20d6('0x63'):_0x46e51d[_0x20d6('0x18')]=_0x20d6('0x64');break;case _0x20d6('0x65'):_0x46e51d[_0x20d6('0x18')]='Interval';break;case _0x20d6('0x66'):_0x46e51d['childModel']='Pause';break;case'scheduler':_0x46e51d[_0x20d6('0x18')]=_0x20d6('0x67');break;case _0x20d6('0x68'):_0x46e51d[_0x20d6('0x18')]=_0x20d6('0x69');break;case _0x20d6('0x6a'):_0x46e51d[_0x20d6('0x18')]=_0x20d6('0x6b');break;case _0x20d6('0x6c'):_0x46e51d[_0x20d6('0x18')]=_0x20d6('0x6d');break;case _0x20d6('0x6e'):_0x46e51d[_0x20d6('0x18')]=_0x20d6('0x6f');break;case _0x20d6('0x70'):_0x46e51d[_0x20d6('0x18')]=_0x20d6('0x71');break;case'variables':_0x46e51d['childModel']=_0x20d6('0x72');break;case _0x20d6('0x73'):_0x46e51d[_0x20d6('0x18')]=_0x20d6('0x74');break;case _0x20d6('0x75'):_0x46e51d[_0x20d6('0x18')]='AnalyticExtractedReport';_0x46e51d[_0x20d6('0x1c')]=[{'name':_0x20d6('0x76'),'field':'id','foreignKey':_0x20d6('0x77')}];break;case _0x20d6('0x78'):_0x46e51d['childModel']=_0x20d6('0x79');break;}return _0x46e51d;}function _0x13393c(_0x479870,_0x30c0b7){var _0x2e48ee=_0x479870[_0x20d6('0x7a')](0x0)['toUpperCase']()+_0x479870['slice'](0x1);var _0x506c21={'type':_0x227ce0[_0x20d6('0x7b')][_0x20d6('0x7c')]['SELECT'],'raw':!![]};return new Promise(function(_0x1a6149,_0x49ff32){var _0x21240e=squel['select']()[_0x20d6('0x6')](_0x20d6('0x7d')+_0x2e48ee+'InteractionId','id')[_0x20d6('0x6')]('ui.createdAt')[_0x20d6('0x7e')]('user_has_'+_0x479870+_0x20d6('0x7f'),'ui')['where']('ui.UserId\x20=\x20?',_0x30c0b7['id']);return _0x227ce0[_0x20d6('0x80')]['query'](_0x21240e[_0x20d6('0x81')](),_0x506c21)[_0x20d6('0x9')](function(_0x407680){_0x30c0b7[_0x2e48ee+_0x20d6('0x82')]=_0x407680;_0x1a6149(_0x407680);})['catch'](function(_0x5aad92){_0x49ff32(_0x5aad92);});});}return _0x257d54['define']('UserProfile',attributes,{'tableName':_0x20d6('0x83'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x439603){var _0x34ef7b={'raw':_0x439603[_0x20d6('0x84')]['raw'],'where':{}};var _0x256154={};var _0x3122f9={'count':0x0,'rows':[]};var _0x1122c0=_0x439603[_0x20d6('0x84')][_0x20d6('0x85')];var _0x179b57=_0x439603['query'][_0x20d6('0x86')]||![];var _0x561010=_0x3cecef(_0x1122c0,_0x179b57);if(!_0x561010[_0x20d6('0x18')])throw new Error(_0x20d6('0x87')+_0x1122c0+'\x27');var _0x2c31a8=[{'name':_0x1122c0}];if(!_[_0x20d6('0x88')](_0x561010['parentSections']))_0x2c31a8=_0x561010[_0x20d6('0x1c')];var _0x27619a=[];for(var _0x12b4d3=0x0;_0x12b4d3<_0x2c31a8['length'];_0x12b4d3++){_0x27619a[_0x20d6('0x89')](_0x227ce0[_0x20d6('0x8a')][_0x20d6('0x8b')]({'where':{'userProfileId':_0x439603['params']['id'],'name':_0x2c31a8[_0x12b4d3]['name']},'raw':!![]}));}return Promise[_0x20d6('0x8c')](_0x27619a)['then'](function(_0x53cca0){var _0x50744a=_[_0x20d6('0x5')](_0x53cca0,function(_0x160ff0){return _0x160ff0?_0x160ff0:undefined;});var _0x59f59b=_[_0x20d6('0x5')](_0x2c31a8,['ignore',!![]]);var _0x1d681b=_['isEmpty'](_0x50744a)&&_[_0x20d6('0x88')](_0x59f59b)?null:_['union'](_0x59f59b,_0x50744a);if(!_0x1d681b)return null;var _0xae4959=[];for(var _0x497ae0=0x0;_0x497ae0<_0x1d681b['length'];_0x497ae0++){var _0x79d727=_[_0x20d6('0x8b')](_0x2c31a8,function(_0x3343a9){return _0x1d681b[_0x497ae0]?_0x3343a9[_0x20d6('0xe')]===_0x1d681b[_0x497ae0][_0x20d6('0xe')]:null;});if(_0x79d727){if(_0x1d681b[_0x497ae0][_0x20d6('0x8d')]){_0xae4959['push'](_0x2ecf43(_0x561010[_0x20d6('0x18')],_0x1d681b[_0x497ae0]));}else{if(!_0x1d681b[_0x497ae0][_0x20d6('0x8e')]){_0xae4959[_0x20d6('0x89')](_0x2a91e1(_0x79d727,_0x1d681b[_0x497ae0],_0x561010[_0x20d6('0x18')]));}else{if(_0x79d727[_0x20d6('0xd')]){_0xae4959['push'](_0x33fc8c(_0x79d727,_0x1d681b[_0x497ae0]));}}}}}return Promise[_0x20d6('0x8c')](_0xae4959);})[_0x20d6('0x9')](function(_0x24ae98){var _0x231f9=_0x24ae98;var _0x20cd9b=null;if(_0x231f9){_0x20cd9b=_0x231f9[_0x20d6('0x8f')]===0x1?_0x231f9[0x0]:null;}if(!_0x20cd9b&&!_0x231f9)return _0x3122f9;var _0x3d0131=_0x227ce0[_0x561010['childModel']]['rawAttributes'];_0x256154[_0x20d6('0xd')]=_[_0x20d6('0x90')](_0x3d0131);_0x256154[_0x20d6('0x84')]=_[_0x20d6('0x90')](_0x439603[_0x20d6('0x84')]);_0x256154[_0x20d6('0x91')]=_[_0x20d6('0x92')](_0x256154[_0x20d6('0xd')],_0x256154[_0x20d6('0x84')]);_0x34ef7b[_0x20d6('0x93')]=_[_0x20d6('0x92')](_0x256154[_0x20d6('0xd')],qs[_0x20d6('0x94')](_0x439603[_0x20d6('0x84')][_0x20d6('0x94')]));_0x34ef7b[_0x20d6('0x93')]=_0x34ef7b[_0x20d6('0x93')][_0x20d6('0x8f')]?_0x34ef7b['attributes']:_0x256154[_0x20d6('0xd')];if(!_0x439603[_0x20d6('0x84')][_0x20d6('0x95')]('nolimit')){_0x34ef7b[_0x20d6('0x96')]=qs[_0x20d6('0x96')](_0x439603['query'][_0x20d6('0x96')]);_0x34ef7b[_0x20d6('0x97')]=qs[_0x20d6('0x97')](_0x439603[_0x20d6('0x84')]['offset']);}_0x34ef7b[_0x20d6('0x98')]=qs[_0x20d6('0x99')](_0x439603[_0x20d6('0x84')][_0x20d6('0x99')]);_0x34ef7b[_0x20d6('0x9a')]=qs[_0x20d6('0x91')](_['pick'](_0x439603[_0x20d6('0x84')],_0x256154[_0x20d6('0x91')]));if(_0x439603[_0x20d6('0x84')][_0x20d6('0x5')]){_0x34ef7b[_0x20d6('0x9a')]=_['merge'](_0x34ef7b[_0x20d6('0x9a')],{'$or':_[_0x20d6('0xb')](_0x3d0131,function(_0x2a4e7e){if(_0x2a4e7e[_0x20d6('0x12')][_0x20d6('0x9b')]!=='VIRTUAL'){var _0x4254a3={};_0x4254a3[_0x2a4e7e['field']]={'$like':'%'+_0x439603['query']['filter']+'%'};return _0x4254a3;}})});}var _0x4f0be9=[];var _0x2f2d7a=null;var _0x74ce4b={};if(_0x20cd9b){_0x2f2d7a=_[_0x20d6('0x8b')](_0x2c31a8,['name',_0x20cd9b['name']]);if(_0x2f2d7a[_0x20d6('0x6')]){_0x74ce4b={};if(_0x561010['childModel']===_0x20d6('0x11')){_0x74ce4b[_0x2f2d7a['foreignKey']]=_[_0x20d6('0xb')](_0x20cd9b[_0x20d6('0xa')],'id');}else{_0x74ce4b[_0x2f2d7a['foreignKey']]=_0x20cd9b[_0x20d6('0xa')];}_0x4f0be9[_0x20d6('0x89')](_0x74ce4b);}else{_0x34ef7b[_0x20d6('0x9a')]['id']=_0x20cd9b[_0x20d6('0xa')];}}else{for(var _0x1d022a=0x0;_0x1d022a<_0x231f9[_0x20d6('0x8f')];_0x1d022a++){_0x2f2d7a=_[_0x20d6('0x8b')](_0x2c31a8,[_0x20d6('0xe'),_0x231f9[_0x1d022a][_0x20d6('0xe')]]);if(_0x2f2d7a[_0x20d6('0x6')]){_0x74ce4b={};_0x74ce4b[_0x2f2d7a['foreignKey']]=_0x231f9[_0x1d022a][_0x20d6('0xa')];_0x4f0be9[_0x20d6('0x89')](_0x74ce4b);}else{if(!_0x34ef7b[_0x20d6('0x9a')]['id'])_0x34ef7b[_0x20d6('0x9a')]['id']=[];_0x231f9[_0x1d022a]['associatedResources'][_0x20d6('0x9c')](function(_0x57b623){_0x34ef7b[_0x20d6('0x9a')]['id'][_0x20d6('0x89')](_0x57b623);});}}}if(!_[_0x20d6('0x88')](_0x4f0be9)){_0x34ef7b[_0x20d6('0x9a')]=_['merge'](_0x34ef7b['where'],{'$and':{'$or':_0x4f0be9}});}_0x34ef7b=_[_0x20d6('0x9d')]({},_0x34ef7b,_0x439603['options']);if(_0x20cd9b&&!_0x20cd9b[_0x20d6('0x8e')]&&_0x561010[_0x20d6('0x18')]===_0x20d6('0x11')){if(_0x439603[_0x20d6('0x84')]['includeAll']){_0x34ef7b['include']=[{'all':!![]}];}return _0x227ce0[_0x561010[_0x20d6('0x18')]]['findAll'](_0x34ef7b)[_0x20d6('0x9')](function(_0x2118c7){var _0x178308=[];_0x2118c7['forEach'](function(_0x2348ca){var _0x123683;switch(_0x2348ca[_0x20d6('0x9e')]){case _0x20d6('0x9f'):_0x123683=_['find'](_0x20cd9b[_0x20d6('0xa')],function(_0x307455){return _0x307455['id']===_0x2348ca[_0x20d6('0x77')]&&_0x307455[_0x20d6('0x12')]===_0x20d6('0xa0');});break;case _0x20d6('0xa1'):_0x123683=_['find'](_0x20cd9b[_0x20d6('0xa')],function(_0x5097c7){return _0x5097c7['id']===_0x2348ca[_0x20d6('0x77')]&&_0x5097c7['type']==='CustomReports';});break;}if(_0x123683)_0x178308[_0x20d6('0x89')](_0x2348ca);});_0x3122f9[_0x20d6('0xa2')]=_0x178308[_0x20d6('0x8f')];_0x3122f9[_0x20d6('0xa3')]=_0x178308;return _0x3122f9;});}else{if(!_[_0x20d6('0x88')](_0x439603[_0x20d6('0x84')][_0x20d6('0xa4')])){_0x34ef7b[_0x20d6('0x9a')]['id']=_0x34ef7b[_0x20d6('0x9a')]['id']?_['intersection'](_0x34ef7b[_0x20d6('0x9a')]['id'],_0x439603['query']['ids']):_0x439603[_0x20d6('0x84')]['ids'];if(_0x439603['query'][_0x20d6('0xa5')]){_0x34ef7b[_0x20d6('0x98')]=_0x439603[_0x20d6('0x84')]['customSorting'];}}if(_0x439603[_0x20d6('0x84')][_0x20d6('0xa6')]){_0x34ef7b[_0x20d6('0x9a')]=_[_0x20d6('0x9d')](_0x34ef7b[_0x20d6('0x9a')],{'$and':_0x439603['query'][_0x20d6('0xa6')]});}return _0x227ce0[_0x561010[_0x20d6('0x18')]][_0x20d6('0xa2')]({'where':_0x34ef7b['where']})[_0x20d6('0x9')](function(_0x2c8aae){_0x3122f9[_0x20d6('0xa2')]=_0x2c8aae;if(_0x439603['query'][_0x20d6('0xa7')]){if(_0x561010[_0x20d6('0x18')]==='CmContact'){_0x34ef7b['include']=[{'model':_0x227ce0[_0x20d6('0x6b')],'as':'Tags','attributes':['id',_0x20d6('0xe'),_0x20d6('0xa8')],'required':_0x439603[_0x20d6('0x84')][_0x20d6('0xa9')]?!![]:![]},{'model':_0x227ce0[_0x20d6('0x6b')],'as':'ThroughTags','attributes':['id','name',_0x20d6('0xa8')],'through':_0x439603[_0x20d6('0x84')][_0x20d6('0xa9')]?{'attributes':[],'where':{'TagId':_0x439603[_0x20d6('0x84')][_0x20d6('0xa9')]||undefined}}:{},'required':_0x439603[_0x20d6('0x84')][_0x20d6('0xa9')]?!![]:![]}];}else{_0x34ef7b[_0x20d6('0xaa')]=[{'all':!![]}];}}return _0x227ce0[_0x561010[_0x20d6('0x18')]]['findAll'](_0x34ef7b);})[_0x20d6('0x9')](function(_0x43bbb6){_0x3122f9[_0x20d6('0xa3')]=_0x43bbb6;if(_0x1122c0===_0x20d6('0x54')&&_0x439603['query']['openTabs']==='true'){var _0x3fff1d=[];for(var _0x3f94e8=0x0;_0x3f94e8<_0x3122f9['rows'][_0x20d6('0x8f')];_0x3f94e8++){_0x3fff1d[_0x20d6('0x89')](_0x13393c('chat',_0x3122f9[_0x20d6('0xa3')][_0x3f94e8]['dataValues']));_0x3fff1d[_0x20d6('0x89')](_0x13393c(_0x20d6('0xab'),_0x3122f9[_0x20d6('0xa3')][_0x3f94e8][_0x20d6('0xac')]));_0x3fff1d[_0x20d6('0x89')](_0x13393c('fax',_0x3122f9['rows'][_0x3f94e8][_0x20d6('0xac')]));_0x3fff1d[_0x20d6('0x89')](_0x13393c(_0x20d6('0xad'),_0x3122f9['rows'][_0x3f94e8]['dataValues']));_0x3fff1d['push'](_0x13393c('openchannel',_0x3122f9[_0x20d6('0xa3')][_0x3f94e8][_0x20d6('0xac')]));_0x3fff1d['push'](_0x13393c(_0x20d6('0xae'),_0x3122f9[_0x20d6('0xa3')][_0x3f94e8]['dataValues']));}return Promise[_0x20d6('0x8c')](_0x3fff1d)['then'](function(){return _0x3122f9;});}return _0x3122f9;});}});}}});}; \ No newline at end of file +var _0xf40d=['sort','filters','merge','key','VIRTUAL','foreignKey','options','includeAll','reportType','default','DefaultReports','custom','CustomReports','rows','ids','customSorting','extraQueryConditions','count','include','Tags','color','tag','ThroughTags','true','dataValues','sms','fax','mail','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','filter','field','value','findAll','then','associatedResources','map','catch','model','UserProfileResource','AnalyticExtractedReport','resourceId','toLowerCase','childModel','SquareProject','SquareOdbc','SquareRecording','SquareProjects','name','projectName','JscriptyProject','contacts','CmContact','parentSections','Lists','lists','CmCompany','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','contexts','VoiceContext','voicemails','VoiceRecording','Agents','membername','Telephones','User','role','telephone','VoiceQueues','queue','VoiceQueue','type','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','Team','queuecampaigns','users','agents','telephones','Users','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','ZohoAccount','vtigeraccounts','dispositions','Disposition','customdashboards','intervals','Interval','Pause','scheduler','Schedule','Sound','tags','Tag','templates','Template','triggers','trunks','Trunk','variables','Variable','Plugin','Reports','reportId','metrics','charAt','toUpperCase','slice','QueryTypes','SELECT','select','InteractionId','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','UserProfile','user_profiles','raw','section','mergeResources','Invalid\x20section\x20\x27','length','push','find','params','all','ignore','isEmpty','autoAssociation','rawAttributes','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order'];(function(_0x59808b,_0x448eac){var _0x32e13a=function(_0x20c6b0){while(--_0x20c6b0){_0x59808b['push'](_0x59808b['shift']());}};_0x32e13a(++_0x448eac);}(_0xf40d,0xda));var _0xdf40=function(_0x581f33,_0x3bd481){_0x581f33=_0x581f33-0x0;var _0x5c26a0=_0xf40d[_0x581f33];return _0x5c26a0;};'use strict';var _=require(_0xdf40('0x0'));var attributes=require(_0xdf40('0x1'));var qs=require(_0xdf40('0x2'));var squel=require(_0xdf40('0x3'));module[_0xdf40('0x4')]=function(_0x7a9753){var _0x1ace6c=_0x7a9753['models'];function _0x5580c4(_0x972cab,_0x3f30cd){return new Promise(function(_0x35c469,_0x379606){if(!_0x3f30cd)return _0x35c469(null);var _0x4d92f1=_0x3f30cd[_0xdf40('0x5')]?{[_0x3f30cd[_0xdf40('0x5')][_0xdf40('0x6')]]:_0x3f30cd[_0xdf40('0x5')][_0xdf40('0x7')]}:undefined;return _0x1ace6c[_0x972cab][_0xdf40('0x8')]({'where':_0x4d92f1,'raw':!![]})[_0xdf40('0x9')](function(_0xb35f14){_0x3f30cd[_0xdf40('0xa')]=_[_0xdf40('0xb')](_0xb35f14,'id');_0x35c469(_0x3f30cd);})[_0xdf40('0xc')](function(_0x583c09){_0x379606(_0x583c09);});});}function _0x7437d2(_0x8c22bc,_0x21f905){return new Promise(function(_0xcb133c,_0x3f7b17){var _0x219ba7=_0x8c22bc[_0xdf40('0x5')]?{[_0x8c22bc['filter'][_0xdf40('0x6')]]:_0x8c22bc['filter'][_0xdf40('0x7')]}:undefined;return _0x1ace6c[_0x8c22bc[_0xdf40('0xd')]][_0xdf40('0x8')]({'where':_0x219ba7,'raw':!![]})[_0xdf40('0x9')](function(_0x4be9fc){_0x21f905[_0xdf40('0xa')]=_[_0xdf40('0xb')](_0x4be9fc,function(_0x9e5f9f){return _0x9e5f9f['name'];});_0xcb133c(_0x21f905);})[_0xdf40('0xc')](function(_0x22d7a6){_0x3f7b17(_0x22d7a6);});});}function _0x5678a6(_0x1b3582,_0x105e51,_0x1408d0){if(!_0x105e51)return Promise['resolve'](null);return new Promise(function(_0x9b4757,_0x22b9b2){return _0x1ace6c[_0xdf40('0xe')][_0xdf40('0x8')]({'where':{'sectionId':_0x105e51['id']},'raw':!![]})[_0xdf40('0x9')](function(_0x36b975){if(_0x1b3582[_0xdf40('0x6')]&&_0x1b3582['field']!=='id'){_0x105e51['associatedResources']=_['map'](_0x36b975,function(_0x52067a){return _0x52067a[_0x1b3582[_0xdf40('0x6')]];});}else{if(_0x1408d0===_0xdf40('0xf')){_0x105e51[_0xdf40('0xa')]=_[_0xdf40('0xb')](_0x36b975,function(_0xc53db0){return{'id':_0xc53db0[_0xdf40('0x10')],'type':_0xc53db0['type']};});}else{_0x105e51[_0xdf40('0xa')]=_[_0xdf40('0xb')](_0x36b975,function(_0x42662b){return _0x42662b[_0xdf40('0x10')];});}}_0x9b4757(_0x105e51);})[_0xdf40('0xc')](function(_0x56bbce){_0x22b9b2(_0x56bbce);});});}function _0x26cb31(_0x3102e2,_0x51f592){var _0x57a3e2={'parentSections':[]};switch(_0x3102e2[_0xdf40('0x11')]()){case'squareprojects':_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x13');break;case'odbc':_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x14');break;case'squarerecordings':_0x57a3e2['childModel']=_0xdf40('0x15');_0x57a3e2['parentSections']=[{'name':_0xdf40('0x16'),'field':_0xdf40('0x17'),'foreignKey':_0xdf40('0x18')}];break;case'projects':_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x19');break;case _0xdf40('0x1a'):_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x1b');_0x57a3e2[_0xdf40('0x1c')]=[{'name':_0xdf40('0x1d'),'field':'id','foreignKey':'ListId'}];break;case _0xdf40('0x1e'):_0x57a3e2['childModel']='CmList';break;case'companies':_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x1f');break;case'globalcustomfields':_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x20');break;case _0xdf40('0x21'):_0x57a3e2['childModel']=_0xdf40('0x22');break;case _0xdf40('0x23'):_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x24');break;case'faxqueues':_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x25');break;case _0xdf40('0x26'):_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x27');break;case _0xdf40('0x28'):case _0xdf40('0x29'):case _0xdf40('0x2a'):_0x57a3e2['childModel']='VoiceExtension';break;case _0xdf40('0x2b'):_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x2c');break;case _0xdf40('0x2d'):_0x57a3e2[_0xdf40('0x12')]='VoiceMail';break;case'voicerecordings':_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x2e');_0x57a3e2['parentSections']=[{'name':_0xdf40('0x2f'),'field':_0xdf40('0x17'),'foreignKey':_0xdf40('0x30'),'model':'User','filter':{'field':'role','value':['agent']}},{'name':_0xdf40('0x31'),'field':_0xdf40('0x17'),'foreignKey':_0xdf40('0x30'),'model':_0xdf40('0x32'),'filter':{'field':_0xdf40('0x33'),'value':[_0xdf40('0x34')]}},{'name':_0xdf40('0x35'),'field':_0xdf40('0x17'),'foreignKey':_0xdf40('0x36'),'model':_0xdf40('0x37'),'filter':{'field':_0xdf40('0x38'),'value':[_0xdf40('0x39')]}},{'name':_0xdf40('0x3a'),'field':'name','foreignKey':'queue','model':'VoiceQueue','filter':{'field':_0xdf40('0x38'),'value':[_0xdf40('0x3b')]}}];break;case _0xdf40('0x3c'):_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x3d');break;case'chanspies':_0x57a3e2['childModel']=_0xdf40('0x3e');break;case _0xdf40('0x3f'):_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x40');break;case _0xdf40('0x41'):_0x57a3e2[_0xdf40('0x12')]='Campaign';break;case _0xdf40('0x42'):_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x43');break;case _0xdf40('0x44'):_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x45');break;case _0xdf40('0x46'):_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x47');break;case _0xdf40('0x48'):_0x57a3e2[_0xdf40('0x12')]='OpenchannelQueue';break;case _0xdf40('0x49'):_0x57a3e2['childModel']=_0xdf40('0x4a');break;case _0xdf40('0x4b'):_0x57a3e2[_0xdf40('0x12')]='SmsQueue';break;case _0xdf40('0x4c'):_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x4d');break;case _0xdf40('0x4e'):_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x4f');break;case _0xdf40('0x50'):_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x51');break;case'teams':_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x52');break;case'voicequeues':case _0xdf40('0x53'):_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x37');if(_0x51f592){_0x57a3e2[_0xdf40('0x1c')]=[{'name':'VoiceQueues'},{'name':_0xdf40('0x3a')}];}break;case _0xdf40('0x54'):case _0xdf40('0x55'):case _0xdf40('0x56'):_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x32');if(_0x51f592){_0x57a3e2[_0xdf40('0x1c')]=[{'name':_0xdf40('0x57'),'filter':{'field':'role','value':['admin','user']},'ignore':!![]},{'name':'Agents'},{'name':_0xdf40('0x31')}];}break;case _0xdf40('0x58'):_0x57a3e2['childModel']=_0xdf40('0x59');break;case _0xdf40('0x5a'):_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x5b');break;case _0xdf40('0x5c'):_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x5d');break;case _0xdf40('0x5e'):_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x5f');break;case'deskaccounts':_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x60');break;case'zohoaccounts':_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x61');break;case _0xdf40('0x62'):_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x32');break;case'cannedanswers':_0x57a3e2['childModel']='CannedAnswer';break;case _0xdf40('0x63'):_0x57a3e2['childModel']=_0xdf40('0x64');break;case _0xdf40('0x65'):_0x57a3e2['childModel']='Dashboard';break;case _0xdf40('0x66'):_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x67');break;case'pauses':_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x68');break;case _0xdf40('0x69'):_0x57a3e2['childModel']=_0xdf40('0x6a');break;case'sounds':_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x6b');break;case _0xdf40('0x6c'):_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x6d');break;case _0xdf40('0x6e'):_0x57a3e2['childModel']=_0xdf40('0x6f');break;case _0xdf40('0x70'):_0x57a3e2[_0xdf40('0x12')]='Trigger';break;case _0xdf40('0x71'):_0x57a3e2['childModel']=_0xdf40('0x72');break;case _0xdf40('0x73'):_0x57a3e2['childModel']=_0xdf40('0x74');break;case'plugins':_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x75');break;case'extractedreports':_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0xf');_0x57a3e2[_0xdf40('0x1c')]=[{'name':_0xdf40('0x76'),'field':'id','foreignKey':_0xdf40('0x77')}];break;case _0xdf40('0x78'):_0x57a3e2[_0xdf40('0x12')]='AnalyticMetric';break;}return _0x57a3e2;}function _0x11059f(_0xe5df97,_0x233fa0){var _0x5bd382=_0xe5df97[_0xdf40('0x79')](0x0)[_0xdf40('0x7a')]()+_0xe5df97[_0xdf40('0x7b')](0x1);var _0x1c1213={'type':_0x1ace6c['Sequelize'][_0xdf40('0x7c')][_0xdf40('0x7d')],'raw':!![]};return new Promise(function(_0x2528e7,_0x276d75){var _0x8e46f2=squel[_0xdf40('0x7e')]()[_0xdf40('0x6')]('ui.'+_0x5bd382+_0xdf40('0x7f'),'id')[_0xdf40('0x6')]('ui.createdAt')[_0xdf40('0x80')](_0xdf40('0x81')+_0xe5df97+_0xdf40('0x82'),'ui')[_0xdf40('0x83')](_0xdf40('0x84'),_0x233fa0['id']);return _0x1ace6c[_0xdf40('0x85')][_0xdf40('0x86')](_0x8e46f2[_0xdf40('0x87')](),_0x1c1213)[_0xdf40('0x9')](function(_0x3c5fbb){_0x233fa0[_0x5bd382+'OpenTabs']=_0x3c5fbb;_0x2528e7(_0x3c5fbb);})[_0xdf40('0xc')](function(_0x562875){_0x276d75(_0x562875);});});}return _0x7a9753['define'](_0xdf40('0x88'),attributes,{'tableName':_0xdf40('0x89'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x436c29){var _0x2b7531={'raw':_0x436c29[_0xdf40('0x86')][_0xdf40('0x8a')],'where':{}};var _0x4b068c={};var _0x3b012c={'count':0x0,'rows':[]};var _0x4e6da7=_0x436c29[_0xdf40('0x86')][_0xdf40('0x8b')];var _0x25fb8a=_0x436c29[_0xdf40('0x86')][_0xdf40('0x8c')]||![];var _0x301088=_0x26cb31(_0x4e6da7,_0x25fb8a);if(!_0x301088[_0xdf40('0x12')])throw new Error(_0xdf40('0x8d')+_0x4e6da7+'\x27');var _0x3f8d89=[{'name':_0x4e6da7}];if(!_['isEmpty'](_0x301088[_0xdf40('0x1c')]))_0x3f8d89=_0x301088[_0xdf40('0x1c')];var _0x2d2664=[];for(var _0x135a4f=0x0;_0x135a4f<_0x3f8d89[_0xdf40('0x8e')];_0x135a4f++){_0x2d2664[_0xdf40('0x8f')](_0x1ace6c['UserProfileSection'][_0xdf40('0x90')]({'where':{'userProfileId':_0x436c29[_0xdf40('0x91')]['id'],'name':_0x3f8d89[_0x135a4f][_0xdf40('0x17')]},'raw':!![]}));}return Promise[_0xdf40('0x92')](_0x2d2664)[_0xdf40('0x9')](function(_0x774497){var _0x102ee3=_[_0xdf40('0x5')](_0x774497,function(_0x538173){return _0x538173?_0x538173:undefined;});var _0x45ae4d=_[_0xdf40('0x5')](_0x3f8d89,[_0xdf40('0x93'),!![]]);var _0x2e306e=_[_0xdf40('0x94')](_0x102ee3)&&_[_0xdf40('0x94')](_0x45ae4d)?null:_['union'](_0x45ae4d,_0x102ee3);if(!_0x2e306e)return null;var _0x7ea394=[];for(var _0x493d52=0x0;_0x493d52<_0x2e306e['length'];_0x493d52++){var _0x529d89=_[_0xdf40('0x90')](_0x3f8d89,function(_0xbf4ef9){return _0x2e306e[_0x493d52]?_0xbf4ef9[_0xdf40('0x17')]===_0x2e306e[_0x493d52][_0xdf40('0x17')]:null;});if(_0x529d89){if(_0x2e306e[_0x493d52][_0xdf40('0x93')]){_0x7ea394[_0xdf40('0x8f')](_0x5580c4(_0x301088[_0xdf40('0x12')],_0x2e306e[_0x493d52]));}else{if(!_0x2e306e[_0x493d52][_0xdf40('0x95')]){_0x7ea394['push'](_0x5678a6(_0x529d89,_0x2e306e[_0x493d52],_0x301088[_0xdf40('0x12')]));}else{if(_0x529d89[_0xdf40('0xd')]){_0x7ea394[_0xdf40('0x8f')](_0x7437d2(_0x529d89,_0x2e306e[_0x493d52]));}}}}}return Promise[_0xdf40('0x92')](_0x7ea394);})['then'](function(_0x527be5){var _0x370b22=_0x527be5;var _0x50575b=null;if(_0x370b22){_0x50575b=_0x370b22[_0xdf40('0x8e')]===0x1?_0x370b22[0x0]:null;}if(!_0x50575b&&!_0x370b22)return _0x3b012c;var _0x443a06=_0x1ace6c[_0x301088['childModel']][_0xdf40('0x96')];_0x4b068c[_0xdf40('0xd')]=_[_0xdf40('0x97')](_0x443a06);_0x4b068c['query']=_[_0xdf40('0x97')](_0x436c29['query']);_0x4b068c['filters']=_[_0xdf40('0x98')](_0x4b068c[_0xdf40('0xd')],_0x4b068c['query']);_0x2b7531[_0xdf40('0x99')]=_[_0xdf40('0x98')](_0x4b068c[_0xdf40('0xd')],qs['fields'](_0x436c29[_0xdf40('0x86')][_0xdf40('0x9a')]));_0x2b7531[_0xdf40('0x99')]=_0x2b7531[_0xdf40('0x99')]['length']?_0x2b7531['attributes']:_0x4b068c[_0xdf40('0xd')];if(!_0x436c29['query'][_0xdf40('0x9b')](_0xdf40('0x9c'))){_0x2b7531[_0xdf40('0x9d')]=qs[_0xdf40('0x9d')](_0x436c29[_0xdf40('0x86')]['limit']);_0x2b7531[_0xdf40('0x9e')]=qs['offset'](_0x436c29[_0xdf40('0x86')][_0xdf40('0x9e')]);}_0x2b7531[_0xdf40('0x9f')]=qs[_0xdf40('0xa0')](_0x436c29[_0xdf40('0x86')][_0xdf40('0xa0')]);_0x2b7531[_0xdf40('0x83')]=qs[_0xdf40('0xa1')](_['pick'](_0x436c29['query'],_0x4b068c['filters']));if(_0x436c29['query'][_0xdf40('0x5')]){_0x2b7531[_0xdf40('0x83')]=_[_0xdf40('0xa2')](_0x2b7531['where'],{'$or':_[_0xdf40('0xb')](_0x443a06,function(_0x22af50){if(_0x22af50['type'][_0xdf40('0xa3')]!==_0xdf40('0xa4')){var _0x33d514={};_0x33d514[_0x22af50[_0xdf40('0x6')]]={'$like':'%'+_0x436c29[_0xdf40('0x86')][_0xdf40('0x5')]+'%'};return _0x33d514;}})});}var _0x34db95=[];var _0x476434=null;var _0x2f821d={};if(_0x50575b){_0x476434=_[_0xdf40('0x90')](_0x3f8d89,[_0xdf40('0x17'),_0x50575b[_0xdf40('0x17')]]);if(_0x476434[_0xdf40('0x6')]){_0x2f821d={};if(_0x301088[_0xdf40('0x12')]===_0xdf40('0xf')){_0x2f821d[_0x476434[_0xdf40('0xa5')]]=_[_0xdf40('0xb')](_0x50575b[_0xdf40('0xa')],'id');}else{_0x2f821d[_0x476434[_0xdf40('0xa5')]]=_0x50575b[_0xdf40('0xa')];}_0x34db95[_0xdf40('0x8f')](_0x2f821d);}else{_0x2b7531[_0xdf40('0x83')]['id']=_0x50575b[_0xdf40('0xa')];}}else{for(var _0x1ab27f=0x0;_0x1ab27f<_0x370b22['length'];_0x1ab27f++){_0x476434=_[_0xdf40('0x90')](_0x3f8d89,[_0xdf40('0x17'),_0x370b22[_0x1ab27f][_0xdf40('0x17')]]);if(_0x476434['field']){_0x2f821d={};_0x2f821d[_0x476434[_0xdf40('0xa5')]]=_0x370b22[_0x1ab27f][_0xdf40('0xa')];_0x34db95[_0xdf40('0x8f')](_0x2f821d);}else{if(!_0x2b7531[_0xdf40('0x83')]['id'])_0x2b7531[_0xdf40('0x83')]['id']=[];_0x370b22[_0x1ab27f]['associatedResources']['forEach'](function(_0x5a1e35){_0x2b7531['where']['id'][_0xdf40('0x8f')](_0x5a1e35);});}}}if(!_[_0xdf40('0x94')](_0x34db95)){_0x2b7531[_0xdf40('0x83')]=_[_0xdf40('0xa2')](_0x2b7531[_0xdf40('0x83')],{'$and':{'$or':_0x34db95}});}_0x2b7531=_[_0xdf40('0xa2')]({},_0x2b7531,_0x436c29[_0xdf40('0xa6')]);if(_0x50575b&&!_0x50575b[_0xdf40('0x95')]&&_0x301088['childModel']===_0xdf40('0xf')){if(_0x436c29[_0xdf40('0x86')][_0xdf40('0xa7')]){_0x2b7531['include']=[{'all':!![]}];}return _0x1ace6c[_0x301088[_0xdf40('0x12')]]['findAll'](_0x2b7531)['then'](function(_0x123d1c){var _0x169457=[];_0x123d1c['forEach'](function(_0x20bf00){var _0x21a4a4;switch(_0x20bf00[_0xdf40('0xa8')]){case _0xdf40('0xa9'):_0x21a4a4=_[_0xdf40('0x90')](_0x50575b[_0xdf40('0xa')],function(_0x289375){return _0x289375['id']===_0x20bf00[_0xdf40('0x77')]&&_0x289375[_0xdf40('0x38')]===_0xdf40('0xaa');});break;case _0xdf40('0xab'):_0x21a4a4=_[_0xdf40('0x90')](_0x50575b['associatedResources'],function(_0x2d48a8){return _0x2d48a8['id']===_0x20bf00[_0xdf40('0x77')]&&_0x2d48a8[_0xdf40('0x38')]===_0xdf40('0xac');});break;}if(_0x21a4a4)_0x169457['push'](_0x20bf00);});_0x3b012c['count']=_0x169457[_0xdf40('0x8e')];_0x3b012c[_0xdf40('0xad')]=_0x169457;return _0x3b012c;});}else{if(!_[_0xdf40('0x94')](_0x436c29[_0xdf40('0x86')][_0xdf40('0xae')])){_0x2b7531[_0xdf40('0x83')]['id']=_0x2b7531['where']['id']?_[_0xdf40('0x98')](_0x2b7531[_0xdf40('0x83')]['id'],_0x436c29['query'][_0xdf40('0xae')]):_0x436c29['query'][_0xdf40('0xae')];if(_0x436c29['query'][_0xdf40('0xaf')]){_0x2b7531[_0xdf40('0x9f')]=_0x436c29[_0xdf40('0x86')]['customSorting'];}}if(_0x436c29['query'][_0xdf40('0xb0')]){_0x2b7531[_0xdf40('0x83')]=_['merge'](_0x2b7531[_0xdf40('0x83')],{'$and':_0x436c29[_0xdf40('0x86')][_0xdf40('0xb0')]});}return _0x1ace6c[_0x301088[_0xdf40('0x12')]][_0xdf40('0xb1')]({'where':_0x2b7531[_0xdf40('0x83')]})[_0xdf40('0x9')](function(_0x5d4c78){_0x3b012c[_0xdf40('0xb1')]=_0x5d4c78;if(_0x436c29[_0xdf40('0x86')][_0xdf40('0xa7')]){if(_0x301088[_0xdf40('0x12')]===_0xdf40('0x1b')){_0x2b7531[_0xdf40('0xb2')]=[{'model':_0x1ace6c[_0xdf40('0x6d')],'as':_0xdf40('0xb3'),'attributes':['id','name',_0xdf40('0xb4')],'required':_0x436c29[_0xdf40('0x86')][_0xdf40('0xb5')]?!![]:![]},{'model':_0x1ace6c['Tag'],'as':_0xdf40('0xb6'),'attributes':['id',_0xdf40('0x17'),'color'],'through':_0x436c29[_0xdf40('0x86')][_0xdf40('0xb5')]?{'attributes':[],'where':{'TagId':_0x436c29[_0xdf40('0x86')][_0xdf40('0xb5')]||undefined}}:{},'required':_0x436c29[_0xdf40('0x86')]['tag']?!![]:![]}];}else{_0x2b7531[_0xdf40('0xb2')]=[{'all':!![]}];}}return _0x1ace6c[_0x301088[_0xdf40('0x12')]][_0xdf40('0x8')](_0x2b7531);})[_0xdf40('0x9')](function(_0x556f41){_0x3b012c[_0xdf40('0xad')]=_0x556f41;if(_0x4e6da7===_0xdf40('0x2f')&&_0x436c29[_0xdf40('0x86')]['openTabs']===_0xdf40('0xb7')){var _0x231a27=[];for(var _0x18c67f=0x0;_0x18c67f<_0x3b012c['rows'][_0xdf40('0x8e')];_0x18c67f++){_0x231a27[_0xdf40('0x8f')](_0x11059f('chat',_0x3b012c[_0xdf40('0xad')][_0x18c67f][_0xdf40('0xb8')]));_0x231a27[_0xdf40('0x8f')](_0x11059f(_0xdf40('0xb9'),_0x3b012c['rows'][_0x18c67f][_0xdf40('0xb8')]));_0x231a27['push'](_0x11059f(_0xdf40('0xba'),_0x3b012c['rows'][_0x18c67f][_0xdf40('0xb8')]));_0x231a27[_0xdf40('0x8f')](_0x11059f(_0xdf40('0xbb'),_0x3b012c['rows'][_0x18c67f][_0xdf40('0xb8')]));_0x231a27[_0xdf40('0x8f')](_0x11059f('openchannel',_0x3b012c[_0xdf40('0xad')][_0x18c67f][_0xdf40('0xb8')]));_0x231a27[_0xdf40('0x8f')](_0x11059f(_0xdf40('0xbc'),_0x3b012c['rows'][_0x18c67f][_0xdf40('0xb8')]));}return Promise[_0xdf40('0x92')](_0x231a27)[_0xdf40('0x9')](function(){return _0x3b012c;});}return _0x3b012c;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index d12cf63..830e018 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 _0xd206=['./userProfile.socket','register','then','info','request\x20sent','stringify','error','code','message','UserProfile,\x20%s,\x20%s','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','defaults','redis','socket.io-emitter'];(function(_0x547c57,_0x5b52bb){var _0x3dc551=function(_0x3815d7){while(--_0x3815d7){_0x547c57['push'](_0x547c57['shift']());}};_0x3dc551(++_0x5b52bb);}(_0xd206,0x107));var _0x6d20=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xd206[_0x5f309e];return _0x487b5e;};'use strict';var _=require(_0x6d20('0x0'));var util=require(_0x6d20('0x1'));var moment=require('moment');var BPromise=require(_0x6d20('0x2'));var rs=require(_0x6d20('0x3'));var fs=require('fs');var Redis=require(_0x6d20('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6d20('0x5'));var logger=require(_0x6d20('0x6'))(_0x6d20('0x7'));var config=require(_0x6d20('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6d20('0x9')]['http']({'port':0x232a});config['redis']=_[_0x6d20('0xa')](config[_0x6d20('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x6d20('0xc'))(new Redis(config['redis']));require(_0x6d20('0xd'))[_0x6d20('0xe')](socket);function respondWithRpcPromise(_0x49fc93,_0x588dfb,_0x5610b6){return new BPromise(function(_0x2d5a4c,_0x3d91f8){return client['request'](_0x49fc93,_0x5610b6)[_0x6d20('0xf')](function(_0x58cc72){logger[_0x6d20('0x10')]('UserProfile,\x20%s,\x20%s',_0x588dfb,'request\x20sent');logger['debug']('UserProfile,\x20%s,\x20%s,\x20%s',_0x588dfb,_0x6d20('0x11'),JSON[_0x6d20('0x12')](_0x58cc72));if(_0x58cc72[_0x6d20('0x13')]){if(_0x58cc72[_0x6d20('0x13')][_0x6d20('0x14')]===0x1f4){logger[_0x6d20('0x13')]('UserProfile,\x20%s,\x20%s',_0x588dfb,_0x58cc72[_0x6d20('0x13')]['message']);return _0x3d91f8(_0x58cc72[_0x6d20('0x13')][_0x6d20('0x15')]);}logger['error'](_0x6d20('0x16'),_0x588dfb,_0x58cc72[_0x6d20('0x13')][_0x6d20('0x15')]);return _0x2d5a4c(_0x58cc72[_0x6d20('0x13')]['message']);}else{logger['info'](_0x6d20('0x16'),_0x588dfb,_0x6d20('0x11'));_0x2d5a4c(_0x58cc72['result'][_0x6d20('0x15')]);}})['catch'](function(_0x4fb6fe){logger[_0x6d20('0x13')](_0x6d20('0x16'),_0x588dfb,_0x4fb6fe);_0x3d91f8(_0x4fb6fe);});});} \ No newline at end of file +var _0x6337=['http','defaults','localhost','socket.io-emitter','./userProfile.socket','request','then','UserProfile,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x10b317,_0x2adf32){var _0x1e3054=function(_0x38ed3e){while(--_0x38ed3e){_0x10b317['push'](_0x10b317['shift']());}};_0x1e3054(++_0x2adf32);}(_0x6337,0x18a));var _0x7633=function(_0xa9fc2d,_0x24d396){_0xa9fc2d=_0xa9fc2d-0x0;var _0x154e79=_0x6337[_0xa9fc2d];return _0x154e79;};'use strict';var _=require('lodash');var util=require(_0x7633('0x0'));var moment=require(_0x7633('0x1'));var BPromise=require(_0x7633('0x2'));var rs=require(_0x7633('0x3'));var fs=require('fs');var Redis=require(_0x7633('0x4'));var db=require(_0x7633('0x5'))['db'];var utils=require(_0x7633('0x6'));var logger=require(_0x7633('0x7'))(_0x7633('0x8'));var config=require('../../config/environment');var jayson=require(_0x7633('0x9'));var client=jayson[_0x7633('0xa')][_0x7633('0xb')]({'port':0x232a});config['redis']=_[_0x7633('0xc')](config['redis'],{'host':_0x7633('0xd'),'port':0x18eb});var socket=require(_0x7633('0xe'))(new Redis(config['redis']));require(_0x7633('0xf'))['register'](socket);function respondWithRpcPromise(_0x35a196,_0x4c0f0a,_0x174d9f){return new BPromise(function(_0x2404e4,_0x59e518){return client[_0x7633('0x10')](_0x35a196,_0x174d9f)[_0x7633('0x11')](function(_0x332283){logger['info'](_0x7633('0x12'),_0x4c0f0a,_0x7633('0x13'));logger[_0x7633('0x14')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x4c0f0a,_0x7633('0x13'),JSON[_0x7633('0x15')](_0x332283));if(_0x332283[_0x7633('0x16')]){if(_0x332283['error']['code']===0x1f4){logger['error'](_0x7633('0x12'),_0x4c0f0a,_0x332283[_0x7633('0x16')][_0x7633('0x17')]);return _0x59e518(_0x332283[_0x7633('0x16')][_0x7633('0x17')]);}logger[_0x7633('0x16')](_0x7633('0x12'),_0x4c0f0a,_0x332283[_0x7633('0x16')][_0x7633('0x17')]);return _0x2404e4(_0x332283['error'][_0x7633('0x17')]);}else{logger[_0x7633('0x18')](_0x7633('0x12'),_0x4c0f0a,_0x7633('0x13'));_0x2404e4(_0x332283[_0x7633('0x19')]['message']);}})[_0x7633('0x1a')](function(_0x30b58b){logger[_0x7633('0x16')](_0x7633('0x12'),_0x4c0f0a,_0x30b58b);_0x59e518(_0x30b58b);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index e3ff429..3c2c2cc 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 _0x1c80=['length','userProfile:','./userProfile.events','save','remove','update','emit','removeListener','register'];(function(_0x259d8c,_0x54e284){var _0x3158c5=function(_0x143b68){while(--_0x143b68){_0x259d8c['push'](_0x259d8c['shift']());}};_0x3158c5(++_0x54e284);}(_0x1c80,0x65));var _0x01c8=function(_0x57be03,_0x2533bf){_0x57be03=_0x57be03-0x0;var _0x300082=_0x1c80[_0x57be03];return _0x300082;};'use strict';var UserProfileEvents=require(_0x01c8('0x0'));var events=[_0x01c8('0x1'),_0x01c8('0x2'),_0x01c8('0x3')];function createListener(_0x12dd25,_0x448a04){return function(_0x4d21fa){_0x448a04[_0x01c8('0x4')](_0x12dd25,_0x4d21fa);};}function removeListener(_0x397b3f,_0x3fb780){return function(){UserProfileEvents[_0x01c8('0x5')](_0x397b3f,_0x3fb780);};}exports[_0x01c8('0x6')]=function(_0x4a19c4){for(var _0x5eb8ee=0x0,_0x358a2b=events[_0x01c8('0x7')];_0x5eb8ee<_0x358a2b;_0x5eb8ee++){var _0x382e56=events[_0x5eb8ee];var _0xa1027e=createListener(_0x01c8('0x8')+_0x382e56,_0x4a19c4);UserProfileEvents['on'](_0x382e56,_0xa1027e);}}; \ No newline at end of file +var _0xbd21=['userProfile:','./userProfile.events','remove','update','emit','removeListener','register','length'];(function(_0x19ac6e,_0x435862){var _0x1cdcf3=function(_0x23151c){while(--_0x23151c){_0x19ac6e['push'](_0x19ac6e['shift']());}};_0x1cdcf3(++_0x435862);}(_0xbd21,0xe1));var _0x1bd2=function(_0x56bcf2,_0x265052){_0x56bcf2=_0x56bcf2-0x0;var _0x53b4c9=_0xbd21[_0x56bcf2];return _0x53b4c9;};'use strict';var UserProfileEvents=require(_0x1bd2('0x0'));var events=['save',_0x1bd2('0x1'),_0x1bd2('0x2')];function createListener(_0x165523,_0x4433c3){return function(_0x13a0ab){_0x4433c3[_0x1bd2('0x3')](_0x165523,_0x13a0ab);};}function removeListener(_0x3ad898,_0x4227a7){return function(){UserProfileEvents[_0x1bd2('0x4')](_0x3ad898,_0x4227a7);};}exports[_0x1bd2('0x5')]=function(_0x1f509f){for(var _0x2c4301=0x0,_0x434b89=events[_0x1bd2('0x6')];_0x2c4301<_0x434b89;_0x2c4301++){var _0xeed9ac=events[_0x2c4301];var _0x21b65a=createListener(_0x1bd2('0x7')+_0xeed9ac,_0x1f509f);UserProfileEvents['on'](_0xeed9ac,_0x21b65a);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 721ad3c..4179c36 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 _0x7829=['../../config/environment','./userProfileResource.controller','isAuthenticated','index','get','/describe','post','create','/:id','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1adb04,_0x573de9){var _0x37bdf8=function(_0x2ed75c){while(--_0x2ed75c){_0x1adb04['push'](_0x1adb04['shift']());}};_0x37bdf8(++_0x573de9);}(_0x7829,0xd4));var _0x9782=function(_0x75beb8,_0x394b2b){_0x75beb8=_0x75beb8-0x0;var _0x2208cb=_0x7829[_0x75beb8];return _0x2208cb;};'use strict';var multer=require(_0x9782('0x0'));var util=require(_0x9782('0x1'));var path=require('path');var timeout=require(_0x9782('0x2'));var express=require(_0x9782('0x3'));var router=express[_0x9782('0x4')]();var fs_extra=require(_0x9782('0x5'));var auth=require(_0x9782('0x6'));var interaction=require(_0x9782('0x7'));var config=require(_0x9782('0x8'));var controller=require(_0x9782('0x9'));router['get']('/',auth[_0x9782('0xa')](),controller[_0x9782('0xb')]);router[_0x9782('0xc')](_0x9782('0xd'),auth[_0x9782('0xa')](),controller['describe']);router[_0x9782('0xc')]('/:id',auth[_0x9782('0xa')](),controller['show']);router[_0x9782('0xe')]('/',auth['isAuthenticated'](),controller[_0x9782('0xf')]);router['put'](_0x9782('0x10'),auth['isAuthenticated'](),controller[_0x9782('0x11')]);router[_0x9782('0x12')](_0x9782('0x10'),auth[_0x9782('0xa')](),controller['destroy']);module[_0x9782('0x13')]=router; \ No newline at end of file +var _0xa6fe=['/:id','show','post','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','index','get','/describe','isAuthenticated','describe'];(function(_0x57e618,_0x2aaa01){var _0x2718f2=function(_0x3c467e){while(--_0x3c467e){_0x57e618['push'](_0x57e618['shift']());}};_0x2718f2(++_0x2aaa01);}(_0xa6fe,0xc0));var _0xea6f=function(_0x7cc48b,_0x238e60){_0x7cc48b=_0x7cc48b-0x0;var _0xc94ef5=_0xa6fe[_0x7cc48b];return _0xc94ef5;};'use strict';var multer=require(_0xea6f('0x0'));var util=require(_0xea6f('0x1'));var path=require('path');var timeout=require(_0xea6f('0x2'));var express=require(_0xea6f('0x3'));var router=express[_0xea6f('0x4')]();var fs_extra=require(_0xea6f('0x5'));var auth=require(_0xea6f('0x6'));var interaction=require(_0xea6f('0x7'));var config=require(_0xea6f('0x8'));var controller=require(_0xea6f('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xea6f('0xa')]);router[_0xea6f('0xb')](_0xea6f('0xc'),auth[_0xea6f('0xd')](),controller[_0xea6f('0xe')]);router[_0xea6f('0xb')](_0xea6f('0xf'),auth[_0xea6f('0xd')](),controller[_0xea6f('0x10')]);router[_0xea6f('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xea6f('0x12')](_0xea6f('0xf'),auth[_0xea6f('0xd')](),controller[_0xea6f('0x13')]);router[_0xea6f('0x14')]('/:id',auth[_0xea6f('0xd')](),controller[_0xea6f('0x15')]);module[_0xea6f('0x16')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 9915c41..db3952b 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 _0x0fd7=['sequelize','STRING','INTEGER'];(function(_0x55e0c3,_0x456cf4){var _0x3ee5d8=function(_0x356abe){while(--_0x356abe){_0x55e0c3['push'](_0x55e0c3['shift']());}};_0x3ee5d8(++_0x456cf4);}(_0x0fd7,0xcc));var _0x70fd=function(_0x2d903b,_0x1baa9e){_0x2d903b=_0x2d903b-0x0;var _0x4baf23=_0x0fd7[_0x2d903b];return _0x4baf23;};'use strict';var Sequelize=require(_0x70fd('0x0'));module['exports']={'name':{'type':Sequelize[_0x70fd('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x70fd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x70fd('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xf24e=['STRING','sequelize','exports'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0xf24e,0x13c));var _0xef24=function(_0x3d2e4b,_0x1f6653){_0x3d2e4b=_0x3d2e4b-0x0;var _0x509e78=_0xf24e[_0x3d2e4b];return _0x509e78;};'use strict';var Sequelize=require(_0xef24('0x0'));module[_0xef24('0x1')]={'name':{'type':Sequelize[_0xef24('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'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 ec2669e..cbc0b99 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 _0x430c=['status','end','json','limit','undefined','offset','count','set','Content-Range','then','destroy','error','stack','name','send','index','UserProfileResource','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','create','body','update','find','describe','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'];(function(_0x361078,_0x283dcb){var _0x22d9e8=function(_0x140b4b){while(--_0x140b4b){_0x361078['push'](_0x361078['shift']());}};_0x22d9e8(++_0x283dcb);}(_0x430c,0x1a1));var _0xc430=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0x430c[_0xb24a3e];return _0x4038d7;};'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['create']=function(_0x10db27,_0x4eafae){return db[_0xc430('0x25')][_0xc430('0x44')](_0x10db27[_0xc430('0x45')],{})['then'](respondWithResult(_0x4eafae,0xc9))[_0xc430('0x40')](handleError(_0x4eafae,null));};exports[_0xc430('0x46')]=function(_0x19e563,_0x549400){if(_0x19e563[_0xc430('0x45')]['id']){delete _0x19e563[_0xc430('0x45')]['id'];}return db[_0xc430('0x25')][_0xc430('0x47')]({'where':{'id':_0x19e563[_0xc430('0x42')]['id']}})[_0xc430('0x1e')](handleEntityNotFound(_0x549400,null))[_0xc430('0x1e')](saveUpdates(_0x19e563['body'],null))[_0xc430('0x1e')](respondWithResult(_0x549400,null))[_0xc430('0x40')](handleError(_0x549400,null));};exports[_0xc430('0x1f')]=function(_0x4e9aff,_0x23cb41){return db[_0xc430('0x25')][_0xc430('0x47')]({'where':{'id':_0x4e9aff[_0xc430('0x42')]['id']}})['then'](handleEntityNotFound(_0x23cb41,null))[_0xc430('0x1e')](removeEntity(_0x23cb41,null))['catch'](handleError(_0x23cb41,null));};exports[_0xc430('0x48')]=function(_0x214954,_0x2a5143){return db[_0xc430('0x25')][_0xc430('0x48')]()[_0xc430('0x1e')](respondWithResult(_0x2a5143,null))['catch'](handleError(_0x2a5143,null));}; \ No newline at end of file +var _0x1623=['filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','options','UserProfileResource','findAll','rows','catch','show','params','length','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','apply','save','update','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x1623,0xab));var _0x3162=function(_0x575012,_0x257234){_0x575012=_0x575012-0x0;var _0xccbdb4=_0x1623[_0x575012];return _0xccbdb4;};'use strict';var emlformat=require(_0x3162('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3162('0x1'));var rp=require(_0x3162('0x2'));var moment=require(_0x3162('0x3'));var BPromise=require(_0x3162('0x4'));var Mustache=require(_0x3162('0x5'));var util=require('util');var path=require('path');var sox=require(_0x3162('0x6'));var csv=require('to-csv');var ejs=require(_0x3162('0x7'));var fs=require('fs');var fs_extra=require(_0x3162('0x8'));var _=require('lodash');var squel=require(_0x3162('0x9'));var crypto=require(_0x3162('0xa'));var jsforce=require(_0x3162('0xb'));var deskjs=require(_0x3162('0xc'));var toCsv=require(_0x3162('0xd'));var querystring=require(_0x3162('0xe'));var Papa=require(_0x3162('0xf'));var Redis=require(_0x3162('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3162('0x11'));var hardwareService=require(_0x3162('0x12'));var logger=require(_0x3162('0x13'))(_0x3162('0x14'));var utils=require(_0x3162('0x15'));var config=require(_0x3162('0x16'));var licenseUtil=require(_0x3162('0x17'));var db=require(_0x3162('0x18'))['db'];function respondWithStatusCode(_0x157ab8,_0x4c3625){_0x4c3625=_0x4c3625||0xcc;return function(_0x2d11c5){if(_0x2d11c5){return _0x157ab8['sendStatus'](_0x4c3625);}return _0x157ab8[_0x3162('0x19')](_0x4c3625)[_0x3162('0x1a')]();};}function respondWithResult(_0x49d1ad,_0x4a393a){_0x4a393a=_0x4a393a||0xc8;return function(_0x198764){if(_0x198764){return _0x49d1ad[_0x3162('0x19')](_0x4a393a)[_0x3162('0x1b')](_0x198764);}};}function respondWithFilteredResult(_0x4b8a3b,_0x15e348){return function(_0x3d0bea){if(_0x3d0bea){var _0x2705d1=typeof _0x15e348['offset']===_0x3162('0x1c')&&typeof _0x15e348[_0x3162('0x1d')]===_0x3162('0x1c');var _0xc3ee06=_0x3d0bea[_0x3162('0x1e')];var _0x1eed46=_0x2705d1?0x0:_0x15e348[_0x3162('0x1f')];var _0x4b2bf3=_0x2705d1?_0x3d0bea[_0x3162('0x1e')]:_0x15e348[_0x3162('0x1f')]+_0x15e348[_0x3162('0x1d')];var _0x36ca97;if(_0x4b2bf3>=_0xc3ee06){_0x4b2bf3=_0xc3ee06;_0x36ca97=0xc8;}else{_0x36ca97=0xce;}_0x4b8a3b['status'](_0x36ca97);return _0x4b8a3b[_0x3162('0x20')]('Content-Range',_0x1eed46+'-'+_0x4b2bf3+'/'+_0xc3ee06)['json'](_0x3d0bea);}return null;};}function patchUpdates(_0xa5c62b){return function(_0x3e4d23){try{jsonpatch[_0x3162('0x21')](_0x3e4d23,_0xa5c62b,!![]);}catch(_0x523fab){return BPromise['reject'](_0x523fab);}return _0x3e4d23[_0x3162('0x22')]();};}function saveUpdates(_0x396372,_0x32c051){return function(_0x26c90d){if(_0x26c90d){return _0x26c90d[_0x3162('0x23')](_0x396372)[_0x3162('0x24')](function(_0x52ae25){return _0x52ae25;});}return null;};}function removeEntity(_0x1b2713,_0x5a4994){return function(_0xd283d6){if(_0xd283d6){return _0xd283d6[_0x3162('0x25')]()[_0x3162('0x24')](function(){_0x1b2713[_0x3162('0x19')](0xcc)[_0x3162('0x1a')]();});}};}function handleEntityNotFound(_0x3c543e,_0x30552f){return function(_0x5f8f7){if(!_0x5f8f7){_0x3c543e[_0x3162('0x26')](0x194);}return _0x5f8f7;};}function handleError(_0x356c5d,_0x8fa09f){_0x8fa09f=_0x8fa09f||0x1f4;return function(_0x2f62d7){logger[_0x3162('0x27')](_0x2f62d7['stack']);if(_0x2f62d7[_0x3162('0x28')]){delete _0x2f62d7['name'];}_0x356c5d[_0x3162('0x19')](_0x8fa09f)[_0x3162('0x29')](_0x2f62d7);};}exports[_0x3162('0x2a')]=function(_0x57f567,_0x4903e7){var _0xda0389={},_0xaa1f35={},_0x14df16={'count':0x0,'rows':[]};var _0x399148=_[_0x3162('0x2b')](db['UserProfileResource'][_0x3162('0x2c')],function(_0x4e3cc2){return{'name':_0x4e3cc2[_0x3162('0x2d')],'type':_0x4e3cc2[_0x3162('0x2e')][_0x3162('0x2f')]};});_0xaa1f35[_0x3162('0x30')]=_[_0x3162('0x2b')](_0x399148,_0x3162('0x28'));_0xaa1f35[_0x3162('0x31')]=_[_0x3162('0x32')](_0x57f567['query']);_0xaa1f35[_0x3162('0x33')]=_[_0x3162('0x34')](_0xaa1f35['model'],_0xaa1f35[_0x3162('0x31')]);_0xda0389[_0x3162('0x35')]=_['intersection'](_0xaa1f35['model'],qs[_0x3162('0x36')](_0x57f567['query'][_0x3162('0x36')]));_0xda0389[_0x3162('0x35')]=_0xda0389[_0x3162('0x35')]['length']?_0xda0389['attributes']:_0xaa1f35[_0x3162('0x30')];if(!_0x57f567[_0x3162('0x31')]['hasOwnProperty'](_0x3162('0x37'))){_0xda0389['limit']=qs[_0x3162('0x1d')](_0x57f567[_0x3162('0x31')][_0x3162('0x1d')]);_0xda0389[_0x3162('0x1f')]=qs[_0x3162('0x1f')](_0x57f567[_0x3162('0x31')][_0x3162('0x1f')]);}_0xda0389[_0x3162('0x38')]=qs[_0x3162('0x39')](_0x57f567[_0x3162('0x31')][_0x3162('0x39')]);_0xda0389['where']=qs[_0x3162('0x33')](_[_0x3162('0x3a')](_0x57f567[_0x3162('0x31')],_0xaa1f35['filters']),_0x399148);if(_0x57f567['query'][_0x3162('0x3b')]){_0xda0389[_0x3162('0x3c')]=_[_0x3162('0x3d')](_0xda0389[_0x3162('0x3c')],{'$or':_['map'](_0x399148,function(_0x4186b6){if(_0x4186b6['type']!=='VIRTUAL'){var _0x5dee49={};_0x5dee49[_0x4186b6[_0x3162('0x28')]]={'$like':'%'+_0x57f567[_0x3162('0x31')][_0x3162('0x3b')]+'%'};return _0x5dee49;}})});}_0xda0389=_['merge']({},_0xda0389,_0x57f567[_0x3162('0x3e')]);var _0x2ce9c6={'where':_0xda0389[_0x3162('0x3c')]};return db[_0x3162('0x3f')][_0x3162('0x1e')](_0x2ce9c6)['then'](function(_0x5447d6){_0x14df16[_0x3162('0x1e')]=_0x5447d6;if(_0x57f567[_0x3162('0x31')]['includeAll']){_0xda0389['include']=[{'all':!![]}];}return db[_0x3162('0x3f')][_0x3162('0x40')](_0xda0389);})[_0x3162('0x24')](function(_0x4883ac){_0x14df16[_0x3162('0x41')]=_0x4883ac;return _0x14df16;})[_0x3162('0x24')](respondWithFilteredResult(_0x4903e7,_0xda0389))[_0x3162('0x42')](handleError(_0x4903e7,null));};exports[_0x3162('0x43')]=function(_0x534708,_0x2617d3){var _0x282e3e={'raw':![],'where':{'id':_0x534708[_0x3162('0x44')]['id']}},_0x522cce={};_0x522cce[_0x3162('0x30')]=_['keys'](db[_0x3162('0x3f')][_0x3162('0x2c')]);_0x522cce['query']=_[_0x3162('0x32')](_0x534708['query']);_0x522cce[_0x3162('0x33')]=_[_0x3162('0x34')](_0x522cce[_0x3162('0x30')],_0x522cce[_0x3162('0x31')]);_0x282e3e[_0x3162('0x35')]=_[_0x3162('0x34')](_0x522cce['model'],qs[_0x3162('0x36')](_0x534708[_0x3162('0x31')][_0x3162('0x36')]));_0x282e3e['attributes']=_0x282e3e[_0x3162('0x35')][_0x3162('0x45')]?_0x282e3e['attributes']:_0x522cce[_0x3162('0x30')];if(_0x534708['query']['includeAll']){_0x282e3e['include']=[{'all':!![]}];}_0x282e3e=_[_0x3162('0x3d')]({},_0x282e3e,_0x534708[_0x3162('0x3e')]);return db[_0x3162('0x3f')][_0x3162('0x46')](_0x282e3e)[_0x3162('0x24')](handleEntityNotFound(_0x2617d3,null))[_0x3162('0x24')](respondWithResult(_0x2617d3,null))[_0x3162('0x42')](handleError(_0x2617d3,null));};exports[_0x3162('0x47')]=function(_0x3d2958,_0x28865c){return db[_0x3162('0x3f')][_0x3162('0x47')](_0x3d2958[_0x3162('0x48')],{})['then'](respondWithResult(_0x28865c,0xc9))[_0x3162('0x42')](handleError(_0x28865c,null));};exports['update']=function(_0x4f1dde,_0x12d791){if(_0x4f1dde[_0x3162('0x48')]['id']){delete _0x4f1dde[_0x3162('0x48')]['id'];}return db[_0x3162('0x3f')]['find']({'where':{'id':_0x4f1dde[_0x3162('0x44')]['id']}})['then'](handleEntityNotFound(_0x12d791,null))[_0x3162('0x24')](saveUpdates(_0x4f1dde[_0x3162('0x48')],null))['then'](respondWithResult(_0x12d791,null))[_0x3162('0x42')](handleError(_0x12d791,null));};exports['destroy']=function(_0x516599,_0x13e7c4){return db[_0x3162('0x3f')][_0x3162('0x46')]({'where':{'id':_0x516599[_0x3162('0x44')]['id']}})[_0x3162('0x24')](handleEntityNotFound(_0x13e7c4,null))[_0x3162('0x24')](removeEntity(_0x13e7c4,null))[_0x3162('0x42')](handleError(_0x13e7c4,null));};exports[_0x3162('0x49')]=function(_0x554a03,_0x48b81d){return db['UserProfileResource'][_0x3162('0x49')]()[_0x3162('0x24')](respondWithResult(_0x48b81d,null))[_0x3162('0x42')](handleError(_0x48b81d,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 67ef34e..5cf5ebf 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 _0x72c5=['util','../../config/logger','api','moment','bluebird','request-promise','path','./userProfileResource.attributes','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x72c5,0x1b2));var _0x572c=function(_0x2e2a10,_0x55f9f5){_0x2e2a10=_0x2e2a10-0x0;var _0x5ad6cd=_0x72c5[_0x2e2a10];return _0x5ad6cd;};'use strict';var _=require(_0x572c('0x0'));var util=require(_0x572c('0x1'));var logger=require(_0x572c('0x2'))(_0x572c('0x3'));var moment=require(_0x572c('0x4'));var BPromise=require(_0x572c('0x5'));var rp=require(_0x572c('0x6'));var fs=require('fs');var path=require(_0x572c('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x572c('0x8'));module['exports']=function(_0x39eaa6,_0x27c04e){return _0x39eaa6[_0x572c('0x9')](_0x572c('0xa'),attributes,{'tableName':_0x572c('0xb'),'paranoid':![],'indexes':[{'name':_0x572c('0xc'),'fields':[_0x572c('0xd'),_0x572c('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x063b=['user_profile_has_resources','compositeIndex','sectionId','lodash','util','api','bluebird','request-promise','../../config/environment','./userProfileResource.attributes','define','UserProfileResource'];(function(_0x550f20,_0x3412bc){var _0x2ca4b8=function(_0x24f5dd){while(--_0x24f5dd){_0x550f20['push'](_0x550f20['shift']());}};_0x2ca4b8(++_0x3412bc);}(_0x063b,0x15f));var _0xb063=function(_0x5aa387,_0xa4581d){_0x5aa387=_0x5aa387-0x0;var _0x1a14fe=_0x063b[_0x5aa387];return _0x1a14fe;};'use strict';var _=require(_0xb063('0x0'));var util=require(_0xb063('0x1'));var logger=require('../../config/logger')(_0xb063('0x2'));var moment=require('moment');var BPromise=require(_0xb063('0x3'));var rp=require(_0xb063('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb063('0x5'));var attributes=require(_0xb063('0x6'));module['exports']=function(_0x3fa248,_0x4dba23){return _0x3fa248[_0xb063('0x7')](_0xb063('0x8'),attributes,{'tableName':_0xb063('0x9'),'paranoid':![],'indexes':[{'name':_0xb063('0xa'),'fields':['resourceId',_0xb063('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 239820f..c8841d6 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 _0x13c1=['result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','http','request','then','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x13c1,0x156));var _0x113c=function(_0x586beb,_0x3f6c3f){_0x586beb=_0x586beb-0x0;var _0x240855=_0x13c1[_0x586beb];return _0x240855;};'use strict';var _=require(_0x113c('0x0'));var util=require('util');var moment=require(_0x113c('0x1'));var BPromise=require(_0x113c('0x2'));var rs=require(_0x113c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x113c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x113c('0x5'))(_0x113c('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x113c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3d030d,_0x313e92,_0x1da7e9){return new BPromise(function(_0x64f0bc,_0x3de312){return client[_0x113c('0x8')](_0x3d030d,_0x1da7e9)[_0x113c('0x9')](function(_0x211d25){logger['info'](_0x113c('0xa'),_0x313e92,_0x113c('0xb'));logger[_0x113c('0xc')](_0x113c('0xd'),_0x313e92,_0x113c('0xb'),JSON[_0x113c('0xe')](_0x211d25));if(_0x211d25[_0x113c('0xf')]){if(_0x211d25[_0x113c('0xf')]['code']===0x1f4){logger[_0x113c('0xf')](_0x113c('0xa'),_0x313e92,_0x211d25[_0x113c('0xf')][_0x113c('0x10')]);return _0x3de312(_0x211d25[_0x113c('0xf')][_0x113c('0x10')]);}logger[_0x113c('0xf')](_0x113c('0xa'),_0x313e92,_0x211d25[_0x113c('0xf')]['message']);return _0x64f0bc(_0x211d25[_0x113c('0xf')][_0x113c('0x10')]);}else{logger[_0x113c('0x11')](_0x113c('0xa'),_0x313e92,_0x113c('0xb'));_0x64f0bc(_0x211d25[_0x113c('0x12')][_0x113c('0x10')]);}})[_0x113c('0x13')](function(_0x3fc714){logger[_0x113c('0xf')](_0x113c('0xa'),_0x313e92,_0x3fc714);_0x3de312(_0x3fc714);});});} \ No newline at end of file +var _0xb5a2=['error','message','info','request\x20sent','result','catch','lodash','util','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','UserProfileResource,\x20%s,\x20%s','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x506172,_0xbc3a3){var _0x2723c0=function(_0x57c3d9){while(--_0x57c3d9){_0x506172['push'](_0x506172['shift']());}};_0x2723c0(++_0xbc3a3);}(_0xb5a2,0xa6));var _0x2b5a=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xb5a2[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x2b5a('0x0'));var util=require(_0x2b5a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2b5a('0x2'));var fs=require('fs');var Redis=require(_0x2b5a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2b5a('0x4'));var logger=require('../../config/logger')(_0x2b5a('0x5'));var config=require(_0x2b5a('0x6'));var jayson=require(_0x2b5a('0x7'));var client=jayson['client'][_0x2b5a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5a65cb,_0x140ea1,_0x20a64e){return new BPromise(function(_0x512ecb,_0x7f7f1e){return client[_0x2b5a('0x9')](_0x5a65cb,_0x20a64e)[_0x2b5a('0xa')](function(_0x1986a3){logger['info'](_0x2b5a('0xb'),_0x140ea1,'request\x20sent');logger['debug'](_0x2b5a('0xc'),_0x140ea1,'request\x20sent',JSON[_0x2b5a('0xd')](_0x1986a3));if(_0x1986a3[_0x2b5a('0xe')]){if(_0x1986a3['error']['code']===0x1f4){logger[_0x2b5a('0xe')](_0x2b5a('0xb'),_0x140ea1,_0x1986a3[_0x2b5a('0xe')][_0x2b5a('0xf')]);return _0x7f7f1e(_0x1986a3[_0x2b5a('0xe')][_0x2b5a('0xf')]);}logger[_0x2b5a('0xe')](_0x2b5a('0xb'),_0x140ea1,_0x1986a3[_0x2b5a('0xe')][_0x2b5a('0xf')]);return _0x512ecb(_0x1986a3['error'][_0x2b5a('0xf')]);}else{logger[_0x2b5a('0x10')](_0x2b5a('0xb'),_0x140ea1,_0x2b5a('0x11'));_0x512ecb(_0x1986a3[_0x2b5a('0x12')][_0x2b5a('0xf')]);}})[_0x2b5a('0x13')](function(_0x3ea488){logger[_0x2b5a('0xe')](_0x2b5a('0xb'),_0x140ea1,_0x3ea488);_0x7f7f1e(_0x3ea488);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index b0937b3..3a7d43a 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 _0xf03d=['destroy','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','isAuthenticated','index','get','/describe','describe','post','create','/:id','delete'];(function(_0x5c3e8a,_0x55d7fa){var _0x3775a8=function(_0x3ad587){while(--_0x3ad587){_0x5c3e8a['push'](_0x5c3e8a['shift']());}};_0x3775a8(++_0x55d7fa);}(_0xf03d,0x1ef));var _0xdf03=function(_0x3c8c94,_0x56ae56){_0x3c8c94=_0x3c8c94-0x0;var _0x2b4f9b=_0xf03d[_0x3c8c94];return _0x2b4f9b;};'use strict';var multer=require('multer');var util=require(_0xdf03('0x0'));var path=require(_0xdf03('0x1'));var timeout=require(_0xdf03('0x2'));var express=require(_0xdf03('0x3'));var router=express['Router']();var fs_extra=require(_0xdf03('0x4'));var auth=require(_0xdf03('0x5'));var interaction=require(_0xdf03('0x6'));var config=require(_0xdf03('0x7'));var controller=require(_0xdf03('0x8'));router['get']('/',auth[_0xdf03('0x9')](),controller[_0xdf03('0xa')]);router[_0xdf03('0xb')](_0xdf03('0xc'),auth[_0xdf03('0x9')](),controller[_0xdf03('0xd')]);router[_0xdf03('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xdf03('0xe')]('/',auth[_0xdf03('0x9')](),controller[_0xdf03('0xf')]);router['put'](_0xdf03('0x10'),auth[_0xdf03('0x9')](),controller['update']);router[_0xdf03('0x11')](_0xdf03('0x10'),auth[_0xdf03('0x9')](),controller[_0xdf03('0x12')]);module['exports']=router; \ No newline at end of file +var _0x3a6d=['./userProfileSection.controller','/describe','isAuthenticated','describe','show','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3a6d,0xe7));var _0xd3a6=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x3a6d[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0xd3a6('0x0'));var util=require(_0xd3a6('0x1'));var path=require(_0xd3a6('0x2'));var timeout=require(_0xd3a6('0x3'));var express=require(_0xd3a6('0x4'));var router=express[_0xd3a6('0x5')]();var fs_extra=require(_0xd3a6('0x6'));var auth=require(_0xd3a6('0x7'));var interaction=require(_0xd3a6('0x8'));var config=require('../../config/environment');var controller=require(_0xd3a6('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xd3a6('0xa'),auth[_0xd3a6('0xb')](),controller[_0xd3a6('0xc')]);router['get']('/:id',auth[_0xd3a6('0xb')](),controller[_0xd3a6('0xd')]);router['post']('/',auth[_0xd3a6('0xb')](),controller[_0xd3a6('0xe')]);router[_0xd3a6('0xf')](_0xd3a6('0x10'),auth[_0xd3a6('0xb')](),controller[_0xd3a6('0x11')]);router[_0xd3a6('0x12')](_0xd3a6('0x10'),auth[_0xd3a6('0xb')](),controller[_0xd3a6('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 3943f01..58164aa 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 _0xfcbb=['BOOLEAN','setDataValue','getDataValue','crudPermissions','split','sequelize','exports','STRING'];(function(_0xc3c2f9,_0x2f886){var _0x422046=function(_0x10eb47){while(--_0x10eb47){_0xc3c2f9['push'](_0xc3c2f9['shift']());}};_0x422046(++_0x2f886);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x587e21,_0x457443){_0x587e21=_0x587e21-0x0;var _0x3f70a6=_0xfcbb[_0x587e21];return _0x3f70a6;};'use strict';var Sequelize=require(_0xbfcb('0x0'));module[_0xbfcb('0x1')]={'name':{'type':Sequelize[_0xbfcb('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0xbfcb('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xbfcb('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xbfcb('0x2')],'set':function(_0x135741){this[_0xbfcb('0x4')]('crudPermissions',_0x135741?_0x135741['join'](''):[]);},'get':function(){return this[_0xbfcb('0x5')](_0xbfcb('0x6'))?this[_0xbfcb('0x5')](_0xbfcb('0x6'))[_0xbfcb('0x7')](''):[];}}}; \ No newline at end of file +var _0x1eba=['join','getDataValue','split','sequelize','exports','STRING','INTEGER','setDataValue','crudPermissions'];(function(_0x2b7d52,_0x23cc7d){var _0x1f8c53=function(_0x3982a0){while(--_0x3982a0){_0x2b7d52['push'](_0x2b7d52['shift']());}};_0x1f8c53(++_0x23cc7d);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x3cb3ca,_0x44d697){_0x3cb3ca=_0x3cb3ca-0x0;var _0x214366=_0x1eba[_0x3cb3ca];return _0x214366;};'use strict';var Sequelize=require(_0xa1eb('0x0'));module[_0xa1eb('0x1')]={'name':{'type':Sequelize[_0xa1eb('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xa1eb('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xa1eb('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xa1eb('0x2')],'set':function(_0x34be5a){this[_0xa1eb('0x4')](_0xa1eb('0x5'),_0x34be5a?_0x34be5a[_0xa1eb('0x6')](''):[]);},'get':function(){return this[_0xa1eb('0x7')](_0xa1eb('0x5'))?this[_0xa1eb('0x7')](_0xa1eb('0x5'))[_0xa1eb('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index e576bd9..5c3e0b8 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 _0x7eb2=['params','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','undefined','count','offset','limit','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','pick','filter','merge','options','where','includeAll','include','rows','catch','show'];(function(_0x541551,_0x25f9a9){var _0x47974a=function(_0x2b388f){while(--_0x2b388f){_0x541551['push'](_0x541551['shift']());}};_0x47974a(++_0x25f9a9);}(_0x7eb2,0x1bb));var _0x27eb=function(_0x4ceaee,_0x2da909){_0x4ceaee=_0x4ceaee-0x0;var _0x42ee59=_0x7eb2[_0x4ceaee];return _0x42ee59;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x27eb('0x0'));var zipdir=require(_0x27eb('0x1'));var jsonpatch=require(_0x27eb('0x2'));var rp=require(_0x27eb('0x3'));var moment=require(_0x27eb('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x27eb('0x5'));var path=require(_0x27eb('0x6'));var sox=require(_0x27eb('0x7'));var csv=require(_0x27eb('0x8'));var ejs=require(_0x27eb('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x27eb('0xa'));var squel=require(_0x27eb('0xb'));var crypto=require(_0x27eb('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x27eb('0xd'));var toCsv=require(_0x27eb('0x8'));var querystring=require(_0x27eb('0xe'));var Papa=require(_0x27eb('0xf'));var Redis=require(_0x27eb('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x27eb('0x11'));var as=require(_0x27eb('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x27eb('0x13'));var utils=require(_0x27eb('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x27eb('0x15'));var db=require(_0x27eb('0x16'))['db'];function respondWithStatusCode(_0x13e8e6,_0x5cde71){_0x5cde71=_0x5cde71||0xcc;return function(_0x70e5ba){if(_0x70e5ba){return _0x13e8e6['sendStatus'](_0x5cde71);}return _0x13e8e6['status'](_0x5cde71)[_0x27eb('0x17')]();};}function respondWithResult(_0x3563f7,_0x47d8e6){_0x47d8e6=_0x47d8e6||0xc8;return function(_0x45d0b8){if(_0x45d0b8){return _0x3563f7[_0x27eb('0x18')](_0x47d8e6)[_0x27eb('0x19')](_0x45d0b8);}};}function respondWithFilteredResult(_0x244de1,_0x54382b){return function(_0x4de866){if(_0x4de866){var _0x5aea17=typeof _0x54382b['offset']===_0x27eb('0x1a')&&typeof _0x54382b['limit']===_0x27eb('0x1a');var _0x4f8e7d=_0x4de866[_0x27eb('0x1b')];var _0x32b3b8=_0x5aea17?0x0:_0x54382b[_0x27eb('0x1c')];var _0x1674b1=_0x5aea17?_0x4de866[_0x27eb('0x1b')]:_0x54382b[_0x27eb('0x1c')]+_0x54382b[_0x27eb('0x1d')];var _0x54d7f4;if(_0x1674b1>=_0x4f8e7d){_0x1674b1=_0x4f8e7d;_0x54d7f4=0xc8;}else{_0x54d7f4=0xce;}_0x244de1[_0x27eb('0x18')](_0x54d7f4);return _0x244de1['set']('Content-Range',_0x32b3b8+'-'+_0x1674b1+'/'+_0x4f8e7d)['json'](_0x4de866);}return null;};}function patchUpdates(_0x5708b1){return function(_0x4ad86d){try{jsonpatch[_0x27eb('0x1e')](_0x4ad86d,_0x5708b1,!![]);}catch(_0x43f582){return BPromise[_0x27eb('0x1f')](_0x43f582);}return _0x4ad86d[_0x27eb('0x20')]();};}function saveUpdates(_0x4db984,_0x12ff4d){return function(_0x15ada7){if(_0x15ada7){return _0x15ada7[_0x27eb('0x21')](_0x4db984)[_0x27eb('0x22')](function(_0x2218f8){return _0x2218f8;});}return null;};}function removeEntity(_0x690cda,_0x2f81fa){return function(_0x158a77){if(_0x158a77){return _0x158a77[_0x27eb('0x23')]()[_0x27eb('0x22')](function(){_0x690cda[_0x27eb('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x216e06,_0x3375ed){return function(_0x5710a9){if(!_0x5710a9){_0x216e06[_0x27eb('0x24')](0x194);}return _0x5710a9;};}function handleError(_0x267596,_0x377edb){_0x377edb=_0x377edb||0x1f4;return function(_0x4fd525){logger[_0x27eb('0x25')](_0x4fd525[_0x27eb('0x26')]);if(_0x4fd525[_0x27eb('0x27')]){delete _0x4fd525[_0x27eb('0x27')];}_0x267596['status'](_0x377edb)[_0x27eb('0x28')](_0x4fd525);};}exports[_0x27eb('0x29')]=function(_0x3f997a,_0x1afb86){var _0x4c4481={},_0x4b4acd={},_0x41603a={'count':0x0,'rows':[]};var _0x56492b=_[_0x27eb('0x2a')](db[_0x27eb('0x2b')][_0x27eb('0x2c')],function(_0x4e7d3e){return{'name':_0x4e7d3e[_0x27eb('0x2d')],'type':_0x4e7d3e[_0x27eb('0x2e')]['key']};});_0x4b4acd['model']=_[_0x27eb('0x2a')](_0x56492b,_0x27eb('0x27'));_0x4b4acd[_0x27eb('0x2f')]=_[_0x27eb('0x30')](_0x3f997a[_0x27eb('0x2f')]);_0x4b4acd[_0x27eb('0x31')]=_[_0x27eb('0x32')](_0x4b4acd[_0x27eb('0x33')],_0x4b4acd['query']);_0x4c4481[_0x27eb('0x34')]=_['intersection'](_0x4b4acd[_0x27eb('0x33')],qs[_0x27eb('0x35')](_0x3f997a[_0x27eb('0x2f')][_0x27eb('0x35')]));_0x4c4481[_0x27eb('0x34')]=_0x4c4481[_0x27eb('0x34')][_0x27eb('0x36')]?_0x4c4481[_0x27eb('0x34')]:_0x4b4acd[_0x27eb('0x33')];if(!_0x3f997a['query']['hasOwnProperty'](_0x27eb('0x37'))){_0x4c4481[_0x27eb('0x1d')]=qs[_0x27eb('0x1d')](_0x3f997a['query']['limit']);_0x4c4481[_0x27eb('0x1c')]=qs[_0x27eb('0x1c')](_0x3f997a['query'][_0x27eb('0x1c')]);}_0x4c4481[_0x27eb('0x38')]=qs[_0x27eb('0x39')](_0x3f997a[_0x27eb('0x2f')][_0x27eb('0x39')]);_0x4c4481['where']=qs[_0x27eb('0x31')](_[_0x27eb('0x3a')](_0x3f997a[_0x27eb('0x2f')],_0x4b4acd['filters']),_0x56492b);if(_0x3f997a[_0x27eb('0x2f')][_0x27eb('0x3b')]){_0x4c4481['where']=_[_0x27eb('0x3c')](_0x4c4481['where'],{'$or':_['map'](_0x56492b,function(_0x4ee378){if(_0x4ee378[_0x27eb('0x2e')]!=='VIRTUAL'){var _0xd7a0e6={};_0xd7a0e6[_0x4ee378[_0x27eb('0x27')]]={'$like':'%'+_0x3f997a[_0x27eb('0x2f')]['filter']+'%'};return _0xd7a0e6;}})});}_0x4c4481=_[_0x27eb('0x3c')]({},_0x4c4481,_0x3f997a[_0x27eb('0x3d')]);var _0x549acb={'where':_0x4c4481[_0x27eb('0x3e')]};return db[_0x27eb('0x2b')][_0x27eb('0x1b')](_0x549acb)['then'](function(_0x5d9cbe){_0x41603a[_0x27eb('0x1b')]=_0x5d9cbe;if(_0x3f997a[_0x27eb('0x2f')][_0x27eb('0x3f')]){_0x4c4481[_0x27eb('0x40')]=[{'all':!![]}];}return db[_0x27eb('0x2b')]['findAll'](_0x4c4481);})[_0x27eb('0x22')](function(_0x290cd2){_0x41603a[_0x27eb('0x41')]=_0x290cd2;return _0x41603a;})['then'](respondWithFilteredResult(_0x1afb86,_0x4c4481))[_0x27eb('0x42')](handleError(_0x1afb86,null));};exports[_0x27eb('0x43')]=function(_0x1de281,_0x29129e){var _0x2bec70={'raw':![],'where':{'id':_0x1de281[_0x27eb('0x44')]['id']}},_0x1bfee6={};_0x1bfee6[_0x27eb('0x33')]=_[_0x27eb('0x30')](db[_0x27eb('0x2b')][_0x27eb('0x2c')]);_0x1bfee6[_0x27eb('0x2f')]=_[_0x27eb('0x30')](_0x1de281[_0x27eb('0x2f')]);_0x1bfee6['filters']=_[_0x27eb('0x32')](_0x1bfee6[_0x27eb('0x33')],_0x1bfee6[_0x27eb('0x2f')]);_0x2bec70['attributes']=_[_0x27eb('0x32')](_0x1bfee6[_0x27eb('0x33')],qs[_0x27eb('0x35')](_0x1de281[_0x27eb('0x2f')][_0x27eb('0x35')]));_0x2bec70[_0x27eb('0x34')]=_0x2bec70[_0x27eb('0x34')]['length']?_0x2bec70[_0x27eb('0x34')]:_0x1bfee6[_0x27eb('0x33')];if(_0x1de281['query'][_0x27eb('0x3f')]){_0x2bec70[_0x27eb('0x40')]=[{'all':!![]}];}_0x2bec70=_['merge']({},_0x2bec70,_0x1de281[_0x27eb('0x3d')]);return db[_0x27eb('0x2b')][_0x27eb('0x45')](_0x2bec70)[_0x27eb('0x22')](handleEntityNotFound(_0x29129e,null))[_0x27eb('0x22')](respondWithResult(_0x29129e,null))[_0x27eb('0x42')](handleError(_0x29129e,null));};exports[_0x27eb('0x46')]=function(_0x2fa2f5,_0x529b9d){return db['UserProfileSection'][_0x27eb('0x46')](_0x2fa2f5['body'],{})[_0x27eb('0x22')](respondWithResult(_0x529b9d,0xc9))[_0x27eb('0x42')](handleError(_0x529b9d,null));};exports['update']=function(_0x212662,_0x2ce010){if(_0x212662[_0x27eb('0x47')]['id']){delete _0x212662[_0x27eb('0x47')]['id'];}return db[_0x27eb('0x2b')][_0x27eb('0x45')]({'where':{'id':_0x212662[_0x27eb('0x44')]['id']}})[_0x27eb('0x22')](handleEntityNotFound(_0x2ce010,null))[_0x27eb('0x22')](saveUpdates(_0x212662[_0x27eb('0x47')],null))[_0x27eb('0x22')](respondWithResult(_0x2ce010,null))[_0x27eb('0x42')](handleError(_0x2ce010,null));};exports[_0x27eb('0x23')]=function(_0xebf623,_0x2e0319){return db[_0x27eb('0x2b')][_0x27eb('0x45')]({'where':{'id':_0xebf623[_0x27eb('0x44')]['id']}})['then'](handleEntityNotFound(_0x2e0319,null))[_0x27eb('0x22')](removeEntity(_0x2e0319,null))[_0x27eb('0x42')](handleError(_0x2e0319,null));};exports[_0x27eb('0x48')]=function(_0x56254e,_0x31cf4b){return db['UserProfileSection'][_0x27eb('0x48')]()['then'](respondWithResult(_0x31cf4b,null))[_0x27eb('0x42')](handleError(_0x31cf4b,null));}; \ No newline at end of file +var _0x5e1b=['params','rawAttributes','includeAll','find','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','UserProfileSection','key','map','query','keys','filters','attributes','intersection','model','fields','length','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','include','findAll','rows','catch'];(function(_0xbd2356,_0x441dc9){var _0xf0b100=function(_0x5eb948){while(--_0x5eb948){_0xbd2356['push'](_0xbd2356['shift']());}};_0xf0b100(++_0x441dc9);}(_0x5e1b,0x17e));var _0xb5e1=function(_0x35e92e,_0x21581b){_0x35e92e=_0x35e92e-0x0;var _0x1205a8=_0x5e1b[_0x35e92e];return _0x1205a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb5e1('0x0'));var zipdir=require(_0xb5e1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb5e1('0x2'));var moment=require(_0xb5e1('0x3'));var BPromise=require(_0xb5e1('0x4'));var Mustache=require(_0xb5e1('0x5'));var util=require('util');var path=require(_0xb5e1('0x6'));var sox=require(_0xb5e1('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb5e1('0x8'));var _=require('lodash');var squel=require(_0xb5e1('0x9'));var crypto=require(_0xb5e1('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xb5e1('0xb'));var toCsv=require(_0xb5e1('0xc'));var querystring=require(_0xb5e1('0xd'));var Papa=require(_0xb5e1('0xe'));var Redis=require('ioredis');var authService=require(_0xb5e1('0xf'));var qs=require(_0xb5e1('0x10'));var as=require(_0xb5e1('0x11'));var hardwareService=require(_0xb5e1('0x12'));var logger=require(_0xb5e1('0x13'))(_0xb5e1('0x14'));var utils=require(_0xb5e1('0x15'));var config=require(_0xb5e1('0x16'));var licenseUtil=require(_0xb5e1('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x457ecb,_0x25714a){_0x25714a=_0x25714a||0xcc;return function(_0x4eb8b5){if(_0x4eb8b5){return _0x457ecb[_0xb5e1('0x18')](_0x25714a);}return _0x457ecb[_0xb5e1('0x19')](_0x25714a)[_0xb5e1('0x1a')]();};}function respondWithResult(_0x51cd96,_0xf372d2){_0xf372d2=_0xf372d2||0xc8;return function(_0x126f82){if(_0x126f82){return _0x51cd96[_0xb5e1('0x19')](_0xf372d2)['json'](_0x126f82);}};}function respondWithFilteredResult(_0x372566,_0x25c957){return function(_0x1903a5){if(_0x1903a5){var _0x4780aa=typeof _0x25c957[_0xb5e1('0x1b')]==='undefined'&&typeof _0x25c957[_0xb5e1('0x1c')]===_0xb5e1('0x1d');var _0x2a2b0d=_0x1903a5[_0xb5e1('0x1e')];var _0x5ab389=_0x4780aa?0x0:_0x25c957[_0xb5e1('0x1b')];var _0x26f86e=_0x4780aa?_0x1903a5[_0xb5e1('0x1e')]:_0x25c957['offset']+_0x25c957[_0xb5e1('0x1c')];var _0x4b3519;if(_0x26f86e>=_0x2a2b0d){_0x26f86e=_0x2a2b0d;_0x4b3519=0xc8;}else{_0x4b3519=0xce;}_0x372566[_0xb5e1('0x19')](_0x4b3519);return _0x372566[_0xb5e1('0x1f')](_0xb5e1('0x20'),_0x5ab389+'-'+_0x26f86e+'/'+_0x2a2b0d)[_0xb5e1('0x21')](_0x1903a5);}return null;};}function patchUpdates(_0x385d4d){return function(_0x39f77c){try{jsonpatch[_0xb5e1('0x22')](_0x39f77c,_0x385d4d,!![]);}catch(_0xd12538){return BPromise[_0xb5e1('0x23')](_0xd12538);}return _0x39f77c[_0xb5e1('0x24')]();};}function saveUpdates(_0x46b4ec,_0x3fd3fd){return function(_0x569e37){if(_0x569e37){return _0x569e37[_0xb5e1('0x25')](_0x46b4ec)[_0xb5e1('0x26')](function(_0x3a45a2){return _0x3a45a2;});}return null;};}function removeEntity(_0x293a68,_0x4ac25a){return function(_0x5d63cb){if(_0x5d63cb){return _0x5d63cb[_0xb5e1('0x27')]()[_0xb5e1('0x26')](function(){_0x293a68[_0xb5e1('0x19')](0xcc)[_0xb5e1('0x1a')]();});}};}function handleEntityNotFound(_0x545163,_0x5270ad){return function(_0x4d964b){if(!_0x4d964b){_0x545163[_0xb5e1('0x18')](0x194);}return _0x4d964b;};}function handleError(_0x4ec60b,_0x13ed3c){_0x13ed3c=_0x13ed3c||0x1f4;return function(_0x4eccd2){logger[_0xb5e1('0x28')](_0x4eccd2[_0xb5e1('0x29')]);if(_0x4eccd2[_0xb5e1('0x2a')]){delete _0x4eccd2['name'];}_0x4ec60b['status'](_0x13ed3c)[_0xb5e1('0x2b')](_0x4eccd2);};}exports[_0xb5e1('0x2c')]=function(_0x50915d,_0x308fd7){var _0x441379={},_0x4f8656={},_0x1a5ec0={'count':0x0,'rows':[]};var _0x59e3fc=_['map'](db[_0xb5e1('0x2d')]['rawAttributes'],function(_0x55b442){return{'name':_0x55b442['fieldName'],'type':_0x55b442['type'][_0xb5e1('0x2e')]};});_0x4f8656['model']=_[_0xb5e1('0x2f')](_0x59e3fc,'name');_0x4f8656[_0xb5e1('0x30')]=_[_0xb5e1('0x31')](_0x50915d['query']);_0x4f8656[_0xb5e1('0x32')]=_['intersection'](_0x4f8656['model'],_0x4f8656[_0xb5e1('0x30')]);_0x441379[_0xb5e1('0x33')]=_[_0xb5e1('0x34')](_0x4f8656[_0xb5e1('0x35')],qs[_0xb5e1('0x36')](_0x50915d[_0xb5e1('0x30')]['fields']));_0x441379[_0xb5e1('0x33')]=_0x441379[_0xb5e1('0x33')][_0xb5e1('0x37')]?_0x441379[_0xb5e1('0x33')]:_0x4f8656[_0xb5e1('0x35')];if(!_0x50915d[_0xb5e1('0x30')]['hasOwnProperty'](_0xb5e1('0x38'))){_0x441379[_0xb5e1('0x1c')]=qs[_0xb5e1('0x1c')](_0x50915d[_0xb5e1('0x30')][_0xb5e1('0x1c')]);_0x441379[_0xb5e1('0x1b')]=qs[_0xb5e1('0x1b')](_0x50915d[_0xb5e1('0x30')][_0xb5e1('0x1b')]);}_0x441379['order']=qs[_0xb5e1('0x39')](_0x50915d[_0xb5e1('0x30')]['sort']);_0x441379[_0xb5e1('0x3a')]=qs[_0xb5e1('0x32')](_[_0xb5e1('0x3b')](_0x50915d['query'],_0x4f8656[_0xb5e1('0x32')]),_0x59e3fc);if(_0x50915d['query']['filter']){_0x441379['where']=_['merge'](_0x441379['where'],{'$or':_[_0xb5e1('0x2f')](_0x59e3fc,function(_0x1dc9be){if(_0x1dc9be['type']!==_0xb5e1('0x3c')){var _0x422191={};_0x422191[_0x1dc9be[_0xb5e1('0x2a')]]={'$like':'%'+_0x50915d[_0xb5e1('0x30')][_0xb5e1('0x3d')]+'%'};return _0x422191;}})});}_0x441379=_[_0xb5e1('0x3e')]({},_0x441379,_0x50915d[_0xb5e1('0x3f')]);var _0x44d3d8={'where':_0x441379[_0xb5e1('0x3a')]};return db[_0xb5e1('0x2d')][_0xb5e1('0x1e')](_0x44d3d8)[_0xb5e1('0x26')](function(_0x3315e5){_0x1a5ec0[_0xb5e1('0x1e')]=_0x3315e5;if(_0x50915d[_0xb5e1('0x30')]['includeAll']){_0x441379[_0xb5e1('0x40')]=[{'all':!![]}];}return db[_0xb5e1('0x2d')][_0xb5e1('0x41')](_0x441379);})[_0xb5e1('0x26')](function(_0x318055){_0x1a5ec0[_0xb5e1('0x42')]=_0x318055;return _0x1a5ec0;})[_0xb5e1('0x26')](respondWithFilteredResult(_0x308fd7,_0x441379))[_0xb5e1('0x43')](handleError(_0x308fd7,null));};exports['show']=function(_0x349a34,_0xd9ec95){var _0x2ee402={'raw':![],'where':{'id':_0x349a34[_0xb5e1('0x44')]['id']}},_0x42e0f5={};_0x42e0f5['model']=_[_0xb5e1('0x31')](db[_0xb5e1('0x2d')][_0xb5e1('0x45')]);_0x42e0f5[_0xb5e1('0x30')]=_[_0xb5e1('0x31')](_0x349a34['query']);_0x42e0f5[_0xb5e1('0x32')]=_[_0xb5e1('0x34')](_0x42e0f5[_0xb5e1('0x35')],_0x42e0f5[_0xb5e1('0x30')]);_0x2ee402[_0xb5e1('0x33')]=_[_0xb5e1('0x34')](_0x42e0f5[_0xb5e1('0x35')],qs[_0xb5e1('0x36')](_0x349a34[_0xb5e1('0x30')][_0xb5e1('0x36')]));_0x2ee402[_0xb5e1('0x33')]=_0x2ee402[_0xb5e1('0x33')][_0xb5e1('0x37')]?_0x2ee402[_0xb5e1('0x33')]:_0x42e0f5['model'];if(_0x349a34[_0xb5e1('0x30')][_0xb5e1('0x46')]){_0x2ee402[_0xb5e1('0x40')]=[{'all':!![]}];}_0x2ee402=_[_0xb5e1('0x3e')]({},_0x2ee402,_0x349a34[_0xb5e1('0x3f')]);return db[_0xb5e1('0x2d')][_0xb5e1('0x47')](_0x2ee402)[_0xb5e1('0x26')](handleEntityNotFound(_0xd9ec95,null))['then'](respondWithResult(_0xd9ec95,null))[_0xb5e1('0x43')](handleError(_0xd9ec95,null));};exports[_0xb5e1('0x48')]=function(_0x233b5e,_0x463a54){return db[_0xb5e1('0x2d')]['create'](_0x233b5e[_0xb5e1('0x49')],{})[_0xb5e1('0x26')](respondWithResult(_0x463a54,0xc9))['catch'](handleError(_0x463a54,null));};exports[_0xb5e1('0x25')]=function(_0x147a37,_0x2e3721){if(_0x147a37[_0xb5e1('0x49')]['id']){delete _0x147a37[_0xb5e1('0x49')]['id'];}return db['UserProfileSection'][_0xb5e1('0x47')]({'where':{'id':_0x147a37['params']['id']}})[_0xb5e1('0x26')](handleEntityNotFound(_0x2e3721,null))['then'](saveUpdates(_0x147a37[_0xb5e1('0x49')],null))[_0xb5e1('0x26')](respondWithResult(_0x2e3721,null))['catch'](handleError(_0x2e3721,null));};exports[_0xb5e1('0x27')]=function(_0x2cdefa,_0x3638a7){return db[_0xb5e1('0x2d')][_0xb5e1('0x47')]({'where':{'id':_0x2cdefa['params']['id']}})[_0xb5e1('0x26')](handleEntityNotFound(_0x3638a7,null))[_0xb5e1('0x26')](removeEntity(_0x3638a7,null))['catch'](handleError(_0x3638a7,null));};exports['describe']=function(_0x568436,_0x10ca42){return db[_0xb5e1('0x2d')][_0xb5e1('0x4a')]()[_0xb5e1('0x26')](respondWithResult(_0x10ca42,null))[_0xb5e1('0x43')](handleError(_0x10ca42,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 142ee35..1bde459 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 _0x8206=['bluebird','request-promise','path','./userProfileSection.attributes','define','UserProfileSection','user_profile_has_sections','compositeIndex','userProfileId','lodash','util','../../config/logger','api'];(function(_0x5be0a6,_0x50084f){var _0x894f13=function(_0x2b5f68){while(--_0x2b5f68){_0x5be0a6['push'](_0x5be0a6['shift']());}};_0x894f13(++_0x50084f);}(_0x8206,0xf3));var _0x6820=function(_0x5e353d,_0x361f3b){_0x5e353d=_0x5e353d-0x0;var _0x23523b=_0x8206[_0x5e353d];return _0x23523b;};'use strict';var _=require(_0x6820('0x0'));var util=require(_0x6820('0x1'));var logger=require(_0x6820('0x2'))(_0x6820('0x3'));var moment=require('moment');var BPromise=require(_0x6820('0x4'));var rp=require(_0x6820('0x5'));var fs=require('fs');var path=require(_0x6820('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6820('0x7'));module['exports']=function(_0x1495d1,_0x2613c0){return _0x1495d1[_0x6820('0x8')](_0x6820('0x9'),attributes,{'tableName':_0x6820('0xa'),'paranoid':![],'indexes':[{'name':_0x6820('0xb'),'fields':['sectionId',_0x6820('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0ac5=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','UserProfileSection','compositeIndex','sectionId','userProfileId','lodash'];(function(_0x326bc4,_0x4a925d){var _0xc42f1a=function(_0x1d9d7d){while(--_0x1d9d7d){_0x326bc4['push'](_0x326bc4['shift']());}};_0xc42f1a(++_0x4a925d);}(_0x0ac5,0x151));var _0x50ac=function(_0x1374cd,_0x239113){_0x1374cd=_0x1374cd-0x0;var _0x69a754=_0x0ac5[_0x1374cd];return _0x69a754;};'use strict';var _=require(_0x50ac('0x0'));var util=require(_0x50ac('0x1'));var logger=require(_0x50ac('0x2'))('api');var moment=require('moment');var BPromise=require(_0x50ac('0x3'));var rp=require(_0x50ac('0x4'));var fs=require('fs');var path=require(_0x50ac('0x5'));var rimraf=require(_0x50ac('0x6'));var config=require(_0x50ac('0x7'));var attributes=require('./userProfileSection.attributes');module[_0x50ac('0x8')]=function(_0xd80659,_0x59150f){return _0xd80659['define'](_0x50ac('0x9'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x50ac('0xa'),'fields':[_0x50ac('0xb'),_0x50ac('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index ca78b31..b426933 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 _0x7ea9=['stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xb7cf89,_0x59608e){var _0x220974=function(_0x417d5a){while(--_0x417d5a){_0xb7cf89['push'](_0xb7cf89['shift']());}};_0x220974(++_0x59608e);}(_0x7ea9,0x10d));var _0x97ea=function(_0x45a862,_0x183523){_0x45a862=_0x45a862-0x0;var _0x56e0fa=_0x7ea9[_0x45a862];return _0x56e0fa;};'use strict';var _=require('lodash');var util=require(_0x97ea('0x0'));var moment=require(_0x97ea('0x1'));var BPromise=require(_0x97ea('0x2'));var rs=require(_0x97ea('0x3'));var fs=require('fs');var Redis=require(_0x97ea('0x4'));var db=require(_0x97ea('0x5'))['db'];var utils=require(_0x97ea('0x6'));var logger=require(_0x97ea('0x7'))(_0x97ea('0x8'));var config=require('../../config/environment');var jayson=require(_0x97ea('0x9'));var client=jayson[_0x97ea('0xa')][_0x97ea('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4bdb0c,_0x2095c4,_0x214c53){return new BPromise(function(_0x2ea8c4,_0x409c59){return client['request'](_0x4bdb0c,_0x214c53)[_0x97ea('0xc')](function(_0xf0aaf){logger[_0x97ea('0xd')](_0x97ea('0xe'),_0x2095c4,_0x97ea('0xf'));logger[_0x97ea('0x10')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x2095c4,_0x97ea('0xf'),JSON[_0x97ea('0x11')](_0xf0aaf));if(_0xf0aaf[_0x97ea('0x12')]){if(_0xf0aaf['error'][_0x97ea('0x13')]===0x1f4){logger[_0x97ea('0x12')](_0x97ea('0xe'),_0x2095c4,_0xf0aaf[_0x97ea('0x12')]['message']);return _0x409c59(_0xf0aaf[_0x97ea('0x12')]['message']);}logger[_0x97ea('0x12')](_0x97ea('0xe'),_0x2095c4,_0xf0aaf[_0x97ea('0x12')][_0x97ea('0x14')]);return _0x2ea8c4(_0xf0aaf['error']['message']);}else{logger[_0x97ea('0xd')](_0x97ea('0xe'),_0x2095c4,'request\x20sent');_0x2ea8c4(_0xf0aaf['result'][_0x97ea('0x14')]);}})[_0x97ea('0x15')](function(_0x31a977){logger[_0x97ea('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x2095c4,_0x31a977);_0x409c59(_0x31a977);});});} \ No newline at end of file +var _0x6ca1=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileSection,\x20%s,\x20%s','message','catch','lodash','util','moment','ioredis'];(function(_0xe43a77,_0x5d8c78){var _0x3a7d24=function(_0x1286dd){while(--_0x1286dd){_0xe43a77['push'](_0xe43a77['shift']());}};_0x3a7d24(++_0x5d8c78);}(_0x6ca1,0x13e));var _0x16ca=function(_0x9ce14,_0x922b2e){_0x9ce14=_0x9ce14-0x0;var _0x17a5b3=_0x6ca1[_0x9ce14];return _0x17a5b3;};'use strict';var _=require(_0x16ca('0x0'));var util=require(_0x16ca('0x1'));var moment=require(_0x16ca('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x16ca('0x3'));var db=require(_0x16ca('0x4'))['db'];var utils=require(_0x16ca('0x5'));var logger=require(_0x16ca('0x6'))(_0x16ca('0x7'));var config=require(_0x16ca('0x8'));var jayson=require(_0x16ca('0x9'));var client=jayson[_0x16ca('0xa')][_0x16ca('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c2a0c,_0x5d5888,_0x19dc33){return new BPromise(function(_0x3764b6,_0x229fef){return client['request'](_0x4c2a0c,_0x19dc33)[_0x16ca('0xc')](function(_0x404c9e){logger[_0x16ca('0xd')]('UserProfileSection,\x20%s,\x20%s',_0x5d5888,_0x16ca('0xe'));logger[_0x16ca('0xf')](_0x16ca('0x10'),_0x5d5888,_0x16ca('0xe'),JSON[_0x16ca('0x11')](_0x404c9e));if(_0x404c9e[_0x16ca('0x12')]){if(_0x404c9e[_0x16ca('0x12')][_0x16ca('0x13')]===0x1f4){logger[_0x16ca('0x12')](_0x16ca('0x14'),_0x5d5888,_0x404c9e['error'][_0x16ca('0x15')]);return _0x229fef(_0x404c9e[_0x16ca('0x12')]['message']);}logger['error'](_0x16ca('0x14'),_0x5d5888,_0x404c9e[_0x16ca('0x12')]['message']);return _0x3764b6(_0x404c9e[_0x16ca('0x12')][_0x16ca('0x15')]);}else{logger[_0x16ca('0xd')]('UserProfileSection,\x20%s,\x20%s',_0x5d5888,'request\x20sent');_0x3764b6(_0x404c9e['result']['message']);}})[_0x16ca('0x16')](function(_0x26201e){logger[_0x16ca('0x12')](_0x16ca('0x14'),_0x5d5888,_0x26201e);_0x229fef(_0x26201e);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index dec2637..0cec7a2 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x25476c,_0x2b1a73){var _0x33f038=function(_0x20d554){while(--_0x20d554){_0x25476c['push'](_0x25476c['shift']());}};_0x33f038(++_0x2b1a73);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x305486,_0x24acd4){_0x305486=_0x305486-0x0;var _0xa04940=_0xcb91[_0x305486];return _0xa04940;};'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(_0xc069,_0x3005d6){var _0x3f143c=function(_0x2de702){while(--_0x2de702){_0xc069['push'](_0xc069['shift']());}};_0x3f143c(++_0x3005d6);}(_0x9c44,0x178));var _0x49c4=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x9c44[_0x3d42d8];return _0x27fc41;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 2abfb3c..a275947 100644 --- a/server/api/userSmsQueue/userSmsQueue.attributes.js +++ b/server/api/userSmsQueue/userSmsQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaf99=['exports','INTEGER'];(function(_0x3d5f2d,_0x104d9a){var _0x4e9041=function(_0x58c3ce){while(--_0x58c3ce){_0x3d5f2d['push'](_0x3d5f2d['shift']());}};_0x4e9041(++_0x104d9a);}(_0xaf99,0x13a));var _0x9af9=function(_0x3ff3b8,_0x58c404){_0x3ff3b8=_0x3ff3b8-0x0;var _0x2f7c15=_0xaf99[_0x3ff3b8];return _0x2f7c15;};'use strict';var Sequelize=require('sequelize');module[_0x9af9('0x0')]={'penalty':{'type':Sequelize[_0x9af9('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc627=['exports','INTEGER'];(function(_0x2a518e,_0x5e7939){var _0x4e8da0=function(_0xbe809a){while(--_0xbe809a){_0x2a518e['push'](_0x2a518e['shift']());}};_0x4e8da0(++_0x5e7939);}(_0xc627,0x14a));var _0x7c62=function(_0x54f6bd,_0x170176){_0x54f6bd=_0x54f6bd-0x0;var _0x11dd90=_0xc627[_0x54f6bd];return _0x11dd90;};'use strict';var Sequelize=require('sequelize');module[_0x7c62('0x0')]={'penalty':{'type':Sequelize[_0x7c62('0x1')],'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 89037dc..d9e432c 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 _0x1261=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','define','user_has_sms_queues'];(function(_0x4a7bdf,_0x5f1653){var _0x3c4224=function(_0x3508e2){while(--_0x3508e2){_0x4a7bdf['push'](_0x4a7bdf['shift']());}};_0x3c4224(++_0x5f1653);}(_0x1261,0x144));var _0x1126=function(_0xc8a02c,_0x4809d3){_0xc8a02c=_0xc8a02c-0x0;var _0x3d89da=_0x1261[_0xc8a02c];return _0x3d89da;};'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')]('UserSmsQueue',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce68=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./userSmsQueue.attributes','user_has_sms_queues','lodash','../../config/logger'];(function(_0x1da53d,_0x4ce99c){var _0x2e6382=function(_0x1a96a6){while(--_0x1a96a6){_0x1da53d['push'](_0x1da53d['shift']());}};_0x2e6382(++_0x4ce99c);}(_0xce68,0x10c));var _0x8ce6=function(_0x3ce9b2,_0x186535){_0x3ce9b2=_0x3ce9b2-0x0;var _0x3ab4f2=_0xce68[_0x3ce9b2];return _0x3ab4f2;};'use strict';var _=require(_0x8ce6('0x0'));var util=require('util');var logger=require(_0x8ce6('0x1'))(_0x8ce6('0x2'));var moment=require(_0x8ce6('0x3'));var BPromise=require(_0x8ce6('0x4'));var rp=require(_0x8ce6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8ce6('0x6'));var config=require(_0x8ce6('0x7'));var attributes=require(_0x8ce6('0x8'));module['exports']=function(_0x116e0a,_0x10b3ca){return _0x116e0a['define']('UserSmsQueue',attributes,{'tableName':_0x8ce6('0x9'),'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 eb1b999..d7de7cb 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 _0x8e62=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x8e62,0x177));var _0x28e6=function(_0x265e0e,_0x38b2bb){_0x265e0e=_0x265e0e-0x0;var _0x518157=_0x8e62[_0x265e0e];return _0x518157;};'use strict';var _=require(_0x28e6('0x0'));var util=require(_0x28e6('0x1'));var moment=require(_0x28e6('0x2'));var BPromise=require(_0x28e6('0x3'));var rs=require(_0x28e6('0x4'));var fs=require('fs');var Redis=require(_0x28e6('0x5'));var db=require(_0x28e6('0x6'))['db'];var utils=require(_0x28e6('0x7'));var logger=require(_0x28e6('0x8'))(_0x28e6('0x9'));var config=require('../../config/environment');var jayson=require(_0x28e6('0xa'));var client=jayson[_0x28e6('0xb')][_0x28e6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x48aa35,_0x5d262f,_0x329ba7){return new BPromise(function(_0x32a108,_0x29333b){return client[_0x28e6('0xd')](_0x48aa35,_0x329ba7)[_0x28e6('0xe')](function(_0x265f6f){logger[_0x28e6('0xf')](_0x28e6('0x10'),_0x5d262f,_0x28e6('0x11'));logger[_0x28e6('0x12')](_0x28e6('0x13'),_0x5d262f,_0x28e6('0x11'),JSON['stringify'](_0x265f6f));if(_0x265f6f[_0x28e6('0x14')]){if(_0x265f6f[_0x28e6('0x14')][_0x28e6('0x15')]===0x1f4){logger[_0x28e6('0x14')](_0x28e6('0x10'),_0x5d262f,_0x265f6f['error'][_0x28e6('0x16')]);return _0x29333b(_0x265f6f[_0x28e6('0x14')]['message']);}logger[_0x28e6('0x14')]('UserSmsQueue,\x20%s,\x20%s',_0x5d262f,_0x265f6f[_0x28e6('0x14')][_0x28e6('0x16')]);return _0x32a108(_0x265f6f[_0x28e6('0x14')][_0x28e6('0x16')]);}else{logger[_0x28e6('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x5d262f,_0x28e6('0x11'));_0x32a108(_0x265f6f[_0x28e6('0x17')][_0x28e6('0x16')]);}})[_0x28e6('0x18')](function(_0x3eab26){logger[_0x28e6('0x14')](_0x28e6('0x10'),_0x5d262f,_0x3eab26);_0x29333b(_0x3eab26);});});} \ No newline at end of file +var _0x15d8=['request','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0x15d8,0xdc));var _0x815d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x15d8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x815d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x815d('0x1'));var rs=require(_0x815d('0x2'));var fs=require('fs');var Redis=require(_0x815d('0x3'));var db=require(_0x815d('0x4'))['db'];var utils=require(_0x815d('0x5'));var logger=require('../../config/logger')(_0x815d('0x6'));var config=require(_0x815d('0x7'));var jayson=require(_0x815d('0x8'));var client=jayson[_0x815d('0x9')][_0x815d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x169fcf,_0x383834,_0x2be71e){return new BPromise(function(_0x265271,_0x273a82){return client[_0x815d('0xb')](_0x169fcf,_0x2be71e)['then'](function(_0x1ad76f){logger[_0x815d('0xc')](_0x815d('0xd'),_0x383834,_0x815d('0xe'));logger['debug']('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x383834,'request\x20sent',JSON[_0x815d('0xf')](_0x1ad76f));if(_0x1ad76f[_0x815d('0x10')]){if(_0x1ad76f[_0x815d('0x10')][_0x815d('0x11')]===0x1f4){logger[_0x815d('0x10')](_0x815d('0xd'),_0x383834,_0x1ad76f[_0x815d('0x10')][_0x815d('0x12')]);return _0x273a82(_0x1ad76f['error'][_0x815d('0x12')]);}logger[_0x815d('0x10')](_0x815d('0xd'),_0x383834,_0x1ad76f[_0x815d('0x10')][_0x815d('0x12')]);return _0x265271(_0x1ad76f[_0x815d('0x10')]['message']);}else{logger[_0x815d('0xc')](_0x815d('0xd'),_0x383834,_0x815d('0xe'));_0x265271(_0x1ad76f[_0x815d('0x13')][_0x815d('0x12')]);}})[_0x815d('0x14')](function(_0x7ca30c){logger[_0x815d('0x10')](_0x815d('0xd'),_0x383834,_0x7ca30c);_0x273a82(_0x7ca30c);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 2119102..91e374a 100644 --- a/server/api/userVoicePrefix/userVoicePrefix.attributes.js +++ b/server/api/userVoicePrefix/userVoicePrefix.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x842a=['INTEGER','sequelize','exports'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x842a,0x181));var _0xa842=function(_0x402731,_0x43c115){_0x402731=_0x402731-0x0;var _0x111736=_0x842a[_0x402731];return _0x111736;};'use strict';var Sequelize=require(_0xa842('0x0'));module[_0xa842('0x1')]={'UserId':{'type':Sequelize[_0xa842('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xa842('0x2')]}}; \ No newline at end of file +var _0xe64b=['INTEGER','sequelize','exports'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0xe64b,0xee));var _0xbe64=function(_0x7a6bef,_0x145158){_0x7a6bef=_0x7a6bef-0x0;var _0x58cc4f=_0xe64b[_0x7a6bef];return _0x58cc4f;};'use strict';var Sequelize=require(_0xbe64('0x0'));module[_0xbe64('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xbe64('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 963b525..4741f78 100644 --- a/server/api/userVoicePrefix/userVoicePrefix.model.js +++ b/server/api/userVoicePrefix/userVoicePrefix.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x2e1951,_0x57876b){var _0x56f086=function(_0x54f964){while(--_0x54f964){_0x2e1951['push'](_0x2e1951['shift']());}};_0x56f086(++_0x57876b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x5e2e40,_0x1bff26){var _0x20ee19=function(_0x5d0a1d){while(--_0x5d0a1d){_0x5e2e40['push'](_0x5e2e40['shift']());}};_0x20ee19(++_0x1bff26);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index e7a74f3..8ba4160 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x535e29,_0x1c75e0){var _0x252f54=function(_0x1b3f7d){while(--_0x1b3f7d){_0x535e29['push'](_0x535e29['shift']());}};_0x252f54(++_0x1c75e0);}(_0xe706,0xa3));var _0x6e70=function(_0x972b32,_0x56ea80){_0x972b32=_0x972b32-0x0;var _0x6e8e75=_0xe706[_0x972b32];return _0x6e8e75;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2859f2,_0x1e3102){var _0x4974cd=function(_0x13ec65){while(--_0x13ec65){_0x2859f2['push'](_0x2859f2['shift']());}};_0x4974cd(++_0x1e3102);}(_0x9c44,0x178));var _0x49c4=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x9c44[_0x2064e5];return _0x21a233;};'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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 5f8f9a7..0d70ccf 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 _0x99bd=['sequelize','exports','INTEGER'];(function(_0x576505,_0x326db3){var _0x91a19f=function(_0x2abdbc){while(--_0x2abdbc){_0x576505['push'](_0x576505['shift']());}};_0x91a19f(++_0x326db3);}(_0x99bd,0xb4));var _0xd99b=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x99bd[_0x3511d3];return _0x5d6321;};'use strict';var Sequelize=require(_0xd99b('0x0'));module[_0xd99b('0x1')]={'penalty':{'type':Sequelize[_0xd99b('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa271=['exports','INTEGER'];(function(_0x53b52d,_0x2f2bff){var _0x2a12c0=function(_0x496f5c){while(--_0x496f5c){_0x53b52d['push'](_0x53b52d['shift']());}};_0x2a12c0(++_0x2f2bff);}(_0xa271,0xe8));var _0x1a27=function(_0x1cac3b,_0x344896){_0x1cac3b=_0x1cac3b-0x0;var _0x36c22b=_0xa271[_0x1cac3b];return _0x36c22b;};'use strict';var Sequelize=require('sequelize');module[_0x1a27('0x0')]={'penalty':{'type':Sequelize[_0x1a27('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index ae39f1b..f98436d 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 _0x5da3=['api','moment','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5da3,0xa5));var _0x35da=function(_0x304730,_0x483b78){_0x304730=_0x304730-0x0;var _0xe27bbf=_0x5da3[_0x304730];return _0xe27bbf;};'use strict';var _=require(_0x35da('0x0'));var util=require(_0x35da('0x1'));var logger=require(_0x35da('0x2'))(_0x35da('0x3'));var moment=require(_0x35da('0x4'));var BPromise=require('bluebird');var rp=require(_0x35da('0x5'));var fs=require('fs');var path=require(_0x35da('0x6'));var rimraf=require(_0x35da('0x7'));var config=require(_0x35da('0x8'));var attributes=require(_0x35da('0x9'));module[_0x35da('0xa')]=function(_0xd5a19a,_0x437289){return _0xd5a19a[_0x35da('0xb')](_0x35da('0xc'),attributes,{'tableName':_0x35da('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0820=['request-promise','path','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','../../config/logger','api','moment','bluebird'];(function(_0x309f89,_0x4dcee4){var _0xbbbf35=function(_0x5461c4){while(--_0x5461c4){_0x309f89['push'](_0x309f89['shift']());}};_0xbbbf35(++_0x4dcee4);}(_0x0820,0x103));var _0x0082=function(_0x11f92a,_0x67abff){_0x11f92a=_0x11f92a-0x0;var _0x4a5c6c=_0x0820[_0x11f92a];return _0x4a5c6c;};'use strict';var _=require(_0x0082('0x0'));var util=require('util');var logger=require(_0x0082('0x1'))(_0x0082('0x2'));var moment=require(_0x0082('0x3'));var BPromise=require(_0x0082('0x4'));var rp=require(_0x0082('0x5'));var fs=require('fs');var path=require(_0x0082('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userVoiceQueue.attributes');module[_0x0082('0x7')]=function(_0x5501e6,_0x59c844){return _0x5501e6[_0x0082('0x8')](_0x0082('0x9'),attributes,{'tableName':_0x0082('0xa'),'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 54065d6..4875452 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 _0x7da7=['message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x3b2fcb,_0x494e5e){var _0x270e00=function(_0xdfb3e){while(--_0xdfb3e){_0x3b2fcb['push'](_0x3b2fcb['shift']());}};_0x270e00(++_0x494e5e);}(_0x7da7,0x121));var _0x77da=function(_0x242a4f,_0x369c57){_0x242a4f=_0x242a4f-0x0;var _0x122117=_0x7da7[_0x242a4f];return _0x122117;};'use strict';var _=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var moment=require(_0x77da('0x2'));var BPromise=require('bluebird');var rs=require(_0x77da('0x3'));var fs=require('fs');var Redis=require(_0x77da('0x4'));var db=require(_0x77da('0x5'))['db'];var utils=require(_0x77da('0x6'));var logger=require('../../config/logger')(_0x77da('0x7'));var config=require(_0x77da('0x8'));var jayson=require(_0x77da('0x9'));var client=jayson['client'][_0x77da('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54626e,_0x3958dd,_0x936195){return new BPromise(function(_0x5c9425,_0x412855){return client[_0x77da('0xb')](_0x54626e,_0x936195)[_0x77da('0xc')](function(_0x14ddb6){logger[_0x77da('0xd')](_0x77da('0xe'),_0x3958dd,_0x77da('0xf'));logger[_0x77da('0x10')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x3958dd,_0x77da('0xf'),JSON[_0x77da('0x11')](_0x14ddb6));if(_0x14ddb6[_0x77da('0x12')]){if(_0x14ddb6[_0x77da('0x12')]['code']===0x1f4){logger[_0x77da('0x12')](_0x77da('0xe'),_0x3958dd,_0x14ddb6[_0x77da('0x12')]['message']);return _0x412855(_0x14ddb6[_0x77da('0x12')]['message']);}logger['error'](_0x77da('0xe'),_0x3958dd,_0x14ddb6[_0x77da('0x12')][_0x77da('0x13')]);return _0x5c9425(_0x14ddb6[_0x77da('0x12')][_0x77da('0x13')]);}else{logger[_0x77da('0xd')](_0x77da('0xe'),_0x3958dd,_0x77da('0xf'));_0x5c9425(_0x14ddb6[_0x77da('0x14')][_0x77da('0x13')]);}})[_0x77da('0x15')](function(_0x597b74){logger[_0x77da('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x3958dd,_0x597b74);_0x412855(_0x597b74);});});} \ No newline at end of file +var _0x2944=['code','message','info','result','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','request','UserVoiceQueue,\x20%s,\x20%s','debug','request\x20sent','error'];(function(_0x23f19e,_0x4d583b){var _0x2a95d4=function(_0x5bb558){while(--_0x5bb558){_0x23f19e['push'](_0x23f19e['shift']());}};_0x2a95d4(++_0x4d583b);}(_0x2944,0x8c));var _0x4294=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x2944[_0x47aa64];return _0x549c7a;};'use strict';var _=require('lodash');var util=require(_0x4294('0x0'));var moment=require('moment');var BPromise=require(_0x4294('0x1'));var rs=require(_0x4294('0x2'));var fs=require('fs');var Redis=require(_0x4294('0x3'));var db=require(_0x4294('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4294('0x5'));var config=require(_0x4294('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4294('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x133d9f,_0x41e0d3,_0x170b7f){return new BPromise(function(_0x4aeba6,_0x1422f3){return client[_0x4294('0x8')](_0x133d9f,_0x170b7f)['then'](function(_0x254f0a){logger['info'](_0x4294('0x9'),_0x41e0d3,'request\x20sent');logger[_0x4294('0xa')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x41e0d3,_0x4294('0xb'),JSON['stringify'](_0x254f0a));if(_0x254f0a[_0x4294('0xc')]){if(_0x254f0a['error'][_0x4294('0xd')]===0x1f4){logger[_0x4294('0xc')]('UserVoiceQueue,\x20%s,\x20%s',_0x41e0d3,_0x254f0a[_0x4294('0xc')][_0x4294('0xe')]);return _0x1422f3(_0x254f0a[_0x4294('0xc')]['message']);}logger[_0x4294('0xc')](_0x4294('0x9'),_0x41e0d3,_0x254f0a[_0x4294('0xc')]['message']);return _0x4aeba6(_0x254f0a['error'][_0x4294('0xe')]);}else{logger[_0x4294('0xf')](_0x4294('0x9'),_0x41e0d3,_0x4294('0xb'));_0x4aeba6(_0x254f0a[_0x4294('0x10')][_0x4294('0xe')]);}})['catch'](function(_0x461de5){logger[_0x4294('0xc')](_0x4294('0x9'),_0x41e0d3,_0x461de5);_0x1422f3(_0x461de5);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index b6c16ff..afd6692 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x377279,_0x276354){var _0x57fb88=function(_0x3f8262){while(--_0x3f8262){_0x377279['push'](_0x377279['shift']());}};_0x57fb88(++_0x276354);}(_0xe706,0xa3));var _0x6e70=function(_0x3a7634,_0x2db384){_0x3a7634=_0x3a7634-0x0;var _0x23bbe9=_0xe706[_0x3a7634];return _0x23bbe9;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1d930e,_0x20d8b8){var _0x5bbd66=function(_0x3c7488){while(--_0x3c7488){_0x1d930e['push'](_0x1d930e['shift']());}};_0x5bbd66(++_0x20d8b8);}(_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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index b075caa..a20b55c 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 _0xd145=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0x3c7f77,_0x50b2a2){var _0x7f4d0=function(_0x4a3ea4){while(--_0x4a3ea4){_0x3c7f77['push'](_0x3c7f77['shift']());}};_0x7f4d0(++_0x50b2a2);}(_0xd145,0xcb));var _0x5d14=function(_0x37b4ce,_0x5f3b7e){_0x37b4ce=_0x37b4ce-0x0;var _0x3133cb=_0xd145[_0x37b4ce];return _0x3133cb;};'use strict';var Sequelize=require(_0x5d14('0x0'));module[_0x5d14('0x1')]={'uniqueid':{'type':Sequelize[_0x5d14('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x5d14('0x3')},'membername':{'type':Sequelize[_0x5d14('0x4')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x5d14('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x5d14('0x4')],'allowNull':![],'unique':_0x5d14('0x5'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x5d14('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x5d14('0x4')],'allowNull':![],'unique':'queue_interface','comment':_0x5d14('0x3')},'penalty':{'type':Sequelize[_0x5d14('0x2')](0xb),'defaultValue':0x0,'comment':_0x5d14('0x3')},'paused':{'type':Sequelize[_0x5d14('0x2')](0xb),'defaultValue':0x0,'comment':_0x5d14('0x3')}}; \ No newline at end of file +var _0xba77=['queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x4eda15,_0x28fa8c){var _0x292fe7=function(_0x2474f4){while(--_0x2474f4){_0x4eda15['push'](_0x4eda15['shift']());}};_0x292fe7(++_0x28fa8c);}(_0xba77,0x133));var _0x7ba7=function(_0x51c52b,_0x147712){_0x51c52b=_0x51c52b-0x0;var _0x581ce3=_0xba77[_0x51c52b];return _0x581ce3;};'use strict';var Sequelize=require(_0x7ba7('0x0'));module[_0x7ba7('0x1')]={'uniqueid':{'type':Sequelize[_0x7ba7('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x7ba7('0x3')},'membername':{'type':Sequelize[_0x7ba7('0x4')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x7ba7('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x7ba7('0x4')],'allowNull':![],'unique':_0x7ba7('0x5'),'comment':_0x7ba7('0x3')},'VoiceQueueId':{'type':Sequelize[_0x7ba7('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x7ba7('0x4')],'allowNull':![],'unique':_0x7ba7('0x5'),'comment':_0x7ba7('0x3')},'penalty':{'type':Sequelize[_0x7ba7('0x2')](0xb),'defaultValue':0x0,'comment':_0x7ba7('0x3')},'paused':{'type':Sequelize[_0x7ba7('0x2')](0xb),'defaultValue':0x0,'comment':_0x7ba7('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index a0834cf..6999113 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 _0xd40e=['../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x30abff,_0x5f2c5f){var _0x4c571e=function(_0x43de9a){while(--_0x43de9a){_0x30abff['push'](_0x30abff['shift']());}};_0x4c571e(++_0x5f2c5f);}(_0xd40e,0x140));var _0xed40=function(_0x4cdcdc,_0x34eac7){_0x4cdcdc=_0x4cdcdc-0x0;var _0x4704ce=_0xd40e[_0x4cdcdc];return _0x4704ce;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0xed40('0x0'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xed40('0x1')](0x0);var events={'afterCreate':_0xed40('0x2'),'afterUpdate':'update','afterDestroy':_0xed40('0x3')};function emitEvent(_0x41da91){return function(_0xa4b493,_0x716de6,_0x5b0f67){UserVoiceQueueRtEvents[_0xed40('0x4')](_0x41da91+':'+_0xa4b493['id'],_0xa4b493);UserVoiceQueueRtEvents['emit'](_0x41da91,_0xa4b493);_0x5b0f67(null);};}for(var e in events){if(events[_0xed40('0x5')](e)){var event=events[e];UserVoiceQueueRt[_0xed40('0x6')](e,emitEvent(event));}}module[_0xed40('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xe4a3=['save','emit','hasOwnProperty','hook','exports','events','UserVoiceQueueRt','setMaxListeners'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xe4a3,0xad));var _0x3e4a=function(_0x22e11c,_0x32ef49){_0x22e11c=_0x22e11c-0x0;var _0x4fd8ed=_0xe4a3[_0x22e11c];return _0x4fd8ed;};'use strict';var EventEmitter=require(_0x3e4a('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x3e4a('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x3e4a('0x2')](0x0);var events={'afterCreate':_0x3e4a('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4f7f26){return function(_0x3d01fe,_0x4e2cd9,_0x49ed0d){UserVoiceQueueRtEvents[_0x3e4a('0x4')](_0x4f7f26+':'+_0x3d01fe['id'],_0x3d01fe);UserVoiceQueueRtEvents[_0x3e4a('0x4')](_0x4f7f26,_0x3d01fe);_0x49ed0d(null);};}for(var e in events){if(events[_0x3e4a('0x5')](e)){var event=events[e];UserVoiceQueueRt[_0x3e4a('0x6')](e,emitEvent(event));}}module[_0x3e4a('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index bc728b5..a9756a8 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 _0x7411=['../../config/logger','api','moment','bluebird','request-promise','rimraf','./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash'];(function(_0x1937f5,_0xd9605f){var _0x217472=function(_0xdc0e83){while(--_0xdc0e83){_0x1937f5['push'](_0x1937f5['shift']());}};_0x217472(++_0xd9605f);}(_0x7411,0x78));var _0x1741=function(_0x4a660b,_0x280710){_0x4a660b=_0x4a660b-0x0;var _0x930cb5=_0x7411[_0x4a660b];return _0x930cb5;};'use strict';var _=require(_0x1741('0x0'));var util=require('util');var logger=require(_0x1741('0x1'))(_0x1741('0x2'));var moment=require(_0x1741('0x3'));var BPromise=require(_0x1741('0x4'));var rp=require(_0x1741('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1741('0x6'));var config=require('../../config/environment');var attributes=require(_0x1741('0x7'));module['exports']=function(_0xb0b796,_0x56108d){return _0xb0b796[_0x1741('0x8')](_0x1741('0x9'),attributes,{'tableName':_0x1741('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2171=['bluebird','request-promise','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment'];(function(_0x1a08cf,_0x186382){var _0x4174b7=function(_0x263861){while(--_0x263861){_0x1a08cf['push'](_0x1a08cf['shift']());}};_0x4174b7(++_0x186382);}(_0x2171,0xbf));var _0x1217=function(_0x599b95,_0x309373){_0x599b95=_0x599b95-0x0;var _0x36f888=_0x2171[_0x599b95];return _0x36f888;};'use strict';var _=require(_0x1217('0x0'));var util=require(_0x1217('0x1'));var logger=require(_0x1217('0x2'))(_0x1217('0x3'));var moment=require(_0x1217('0x4'));var BPromise=require(_0x1217('0x5'));var rp=require(_0x1217('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1217('0x7'));var config=require(_0x1217('0x8'));var attributes=require(_0x1217('0x9'));module[_0x1217('0xa')]=function(_0x178683,_0x2a2207){return _0x178683[_0x1217('0xb')](_0x1217('0xc'),attributes,{'tableName':_0x1217('0xd'),'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 11b952c..4613f36 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 _0x065e=['defaults','localhost','./userVoiceQueueRt.socket','request','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','UserVoiceQueueRt,\x20%s,\x20%s','message','info','result','catch','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','GetVoiceQueueRtPauses','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis'];(function(_0x52a5ca,_0x5228d4){var _0x1b023f=function(_0xb1546){while(--_0xb1546){_0x52a5ca['push'](_0x52a5ca['shift']());}};_0x1b023f(++_0x5228d4);}(_0x065e,0x10f));var _0xe065=function(_0x5361d6,_0x5b6674){_0x5361d6=_0x5361d6-0x0;var _0x482f3e=_0x065e[_0x5361d6];return _0x482f3e;};'use strict';var _=require(_0xe065('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe065('0x1'));var fs=require('fs');var Redis=require(_0xe065('0x2'));var db=require(_0xe065('0x3'))['db'];var utils=require(_0xe065('0x4'));var logger=require(_0xe065('0x5'))('rpc');var config=require(_0xe065('0x6'));var jayson=require(_0xe065('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0xe065('0x8')]=_[_0xe065('0x9')](config[_0xe065('0x8')],{'host':_0xe065('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe065('0x8')]));require(_0xe065('0xb'))['register'](socket);function respondWithRpcPromise(_0x24fa3c,_0x2342b3,_0x4c3a8e){return new BPromise(function(_0x5992a9,_0x1f3be1){return client[_0xe065('0xc')](_0x24fa3c,_0x4c3a8e)['then'](function(_0x45ca24){logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x2342b3,'request\x20sent');logger[_0xe065('0xd')](_0xe065('0xe'),_0x2342b3,_0xe065('0xf'),JSON[_0xe065('0x10')](_0x45ca24));if(_0x45ca24['error']){if(_0x45ca24['error'][_0xe065('0x11')]===0x1f4){logger[_0xe065('0x12')](_0xe065('0x13'),_0x2342b3,_0x45ca24[_0xe065('0x12')][_0xe065('0x14')]);return _0x1f3be1(_0x45ca24[_0xe065('0x12')][_0xe065('0x14')]);}logger['error'](_0xe065('0x13'),_0x2342b3,_0x45ca24[_0xe065('0x12')][_0xe065('0x14')]);return _0x5992a9(_0x45ca24[_0xe065('0x12')][_0xe065('0x14')]);}else{logger[_0xe065('0x15')](_0xe065('0x13'),_0x2342b3,_0xe065('0xf'));_0x5992a9(_0x45ca24[_0xe065('0x16')][_0xe065('0x14')]);}})[_0xe065('0x17')](function(_0x513e7f){logger[_0xe065('0x12')](_0xe065('0x13'),_0x2342b3,_0x513e7f);_0x1f3be1(_0x513e7f);});});}exports['GetVoiceQueueRtPauses']=function(_0x49daf3){var _0x1c4f75=this;return new Promise(function(_0x5803fb,_0x19d2e2){return db[_0xe065('0x18')][_0xe065('0x19')]({'raw':_0x49daf3[_0xe065('0x1a')]?_0x49daf3[_0xe065('0x1a')][_0xe065('0x1b')]===undefined?!![]:![]:!![],'where':_0x49daf3['options']?_0x49daf3[_0xe065('0x1a')][_0xe065('0x1c')]||null:null,'attributes':[[db[_0xe065('0x1d')]['fn'](_0xe065('0x1e'),db[_0xe065('0x1d')]['fn']('IF',db[_0xe065('0x1d')]['literal'](_0xe065('0x1f')))),_0xe065('0x20')]]})[_0xe065('0x21')](function(_0x5a2439){logger['info']('GetVoiceQueueRtPauses',_0x49daf3);logger[_0xe065('0xd')](_0xe065('0x22'),_0x49daf3,JSON['stringify'](_0x5a2439));_0x5803fb(_0x5a2439);})[_0xe065('0x17')](function(_0x404882){logger[_0xe065('0x12')](_0xe065('0x22'),_0x404882[_0xe065('0x14')],_0x49daf3);_0x19d2e2(_0x1c4f75[_0xe065('0x12')](0x1f4,_0x404882[_0xe065('0x14')]));});});}; \ No newline at end of file +var _0x28b7=['GetVoiceQueueRtPauses','findAll','options','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./userVoiceQueueRt.socket','request','then','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch'];(function(_0x8bad6f,_0x15b2e4){var _0x2dd542=function(_0x42228a){while(--_0x42228a){_0x8bad6f['push'](_0x8bad6f['shift']());}};_0x2dd542(++_0x15b2e4);}(_0x28b7,0x1a0));var _0x728b=function(_0x43b9af,_0x2c8316){_0x43b9af=_0x43b9af-0x0;var _0x1df62e=_0x28b7[_0x43b9af];return _0x1df62e;};'use strict';var _=require(_0x728b('0x0'));var util=require(_0x728b('0x1'));var moment=require(_0x728b('0x2'));var BPromise=require(_0x728b('0x3'));var rs=require(_0x728b('0x4'));var fs=require('fs');var Redis=require(_0x728b('0x5'));var db=require(_0x728b('0x6'))['db'];var utils=require(_0x728b('0x7'));var logger=require(_0x728b('0x8'))('rpc');var config=require(_0x728b('0x9'));var jayson=require(_0x728b('0xa'));var client=jayson[_0x728b('0xb')][_0x728b('0xc')]({'port':0x232a});config[_0x728b('0xd')]=_[_0x728b('0xe')](config[_0x728b('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x728b('0xf'))(new Redis(config[_0x728b('0xd')]));require(_0x728b('0x10'))['register'](socket);function respondWithRpcPromise(_0x5e6a25,_0x44b88c,_0x177e7d){return new BPromise(function(_0x5a2377,_0x2ed167){return client[_0x728b('0x11')](_0x5e6a25,_0x177e7d)[_0x728b('0x12')](function(_0x13f849){logger['info'](_0x728b('0x13'),_0x44b88c,_0x728b('0x14'));logger[_0x728b('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x44b88c,'request\x20sent',JSON[_0x728b('0x16')](_0x13f849));if(_0x13f849['error']){if(_0x13f849[_0x728b('0x17')][_0x728b('0x18')]===0x1f4){logger[_0x728b('0x17')](_0x728b('0x13'),_0x44b88c,_0x13f849['error']['message']);return _0x2ed167(_0x13f849[_0x728b('0x17')][_0x728b('0x19')]);}logger[_0x728b('0x17')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x44b88c,_0x13f849['error'][_0x728b('0x19')]);return _0x5a2377(_0x13f849['error'][_0x728b('0x19')]);}else{logger[_0x728b('0x1a')](_0x728b('0x13'),_0x44b88c,_0x728b('0x14'));_0x5a2377(_0x13f849['result'][_0x728b('0x19')]);}})[_0x728b('0x1b')](function(_0x1e5931){logger['error'](_0x728b('0x13'),_0x44b88c,_0x1e5931);_0x2ed167(_0x1e5931);});});}exports[_0x728b('0x1c')]=function(_0x3fb4bf){var _0x22aa03=this;return new Promise(function(_0x3ba4f6,_0x5efc98){return db['UserVoiceQueueRt'][_0x728b('0x1d')]({'raw':_0x3fb4bf['options']?_0x3fb4bf[_0x728b('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x3fb4bf[_0x728b('0x1e')]?_0x3fb4bf[_0x728b('0x1e')][_0x728b('0x1f')]||null:null,'attributes':[[db[_0x728b('0x20')]['fn'](_0x728b('0x21'),db[_0x728b('0x20')]['fn']('IF',db[_0x728b('0x20')][_0x728b('0x22')](_0x728b('0x23')))),_0x728b('0x24')]]})[_0x728b('0x12')](function(_0x1a5f14){logger['info'](_0x728b('0x1c'),_0x3fb4bf);logger['debug']('GetVoiceQueueRtPauses',_0x3fb4bf,JSON['stringify'](_0x1a5f14));_0x3ba4f6(_0x1a5f14);})[_0x728b('0x1b')](function(_0x3f54bb){logger[_0x728b('0x17')](_0x728b('0x1c'),_0x3f54bb[_0x728b('0x19')],_0x3fb4bf);_0x5efc98(_0x22aa03['error'](0x1f4,_0x3f54bb[_0x728b('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index cad2071..df56608 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 _0xaf0d=['userVoiceQueueRt:','save','remove','removeListener'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xaf0d,0x6d));var _0xdaf0=function(_0x3aad9b,_0x7fb540){_0x3aad9b=_0x3aad9b-0x0;var _0x2c2716=_0xaf0d[_0x3aad9b];return _0x2c2716;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xdaf0('0x0'),_0xdaf0('0x1'),'update'];function createListener(_0x53877e,_0x5ed0cf){return function(_0x4d0160){_0x5ed0cf['emit'](_0x53877e,_0x4d0160);};}function removeListener(_0x1b6f35,_0x21a3fa){return function(){UserVoiceQueueRtEvents[_0xdaf0('0x2')](_0x1b6f35,_0x21a3fa);};}exports['register']=function(_0x35fe4f){for(var _0x14b19d=0x0,_0x53aec7=events['length'];_0x14b19d<_0x53aec7;_0x14b19d++){var _0x26bda3=events[_0x14b19d];var _0x1dc345=createListener(_0xdaf0('0x3')+_0x26bda3,_0x35fe4f);UserVoiceQueueRtEvents['on'](_0x26bda3,_0x1dc345);}}; \ No newline at end of file +var _0x038b=['removeListener','register','length','save','remove','update','emit'];(function(_0x4d7a61,_0x3fb6e6){var _0x186f73=function(_0x4eeeeb){while(--_0x4eeeeb){_0x4d7a61['push'](_0x4d7a61['shift']());}};_0x186f73(++_0x3fb6e6);}(_0x038b,0x114));var _0xb038=function(_0x5eb8d6,_0x5cbbad){_0x5eb8d6=_0x5eb8d6-0x0;var _0x591d44=_0x038b[_0x5eb8d6];return _0x591d44;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xb038('0x0'),_0xb038('0x1'),_0xb038('0x2')];function createListener(_0x5623c3,_0x3d7dfe){return function(_0x5ed31a){_0x3d7dfe[_0xb038('0x3')](_0x5623c3,_0x5ed31a);};}function removeListener(_0x3d090b,_0x4a8a30){return function(){UserVoiceQueueRtEvents[_0xb038('0x4')](_0x3d090b,_0x4a8a30);};}exports[_0xb038('0x5')]=function(_0x4fe092){for(var _0x54e1e7=0x0,_0x2e3e64=events[_0xb038('0x6')];_0x54e1e7<_0x2e3e64;_0x54e1e7++){var _0x1534a9=events[_0x54e1e7];var _0x4b4085=createListener('userVoiceQueueRt:'+_0x1534a9,_0x4fe092);UserVoiceQueueRtEvents['on'](_0x1534a9,_0x4b4085);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 2669776..fc5cb0f 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(_0x4098d8,_0x3e9354){var _0xd8629c=function(_0x27a8de){while(--_0x27a8de){_0x4098d8['push'](_0x4098d8['shift']());}};_0xd8629c(++_0x3e9354);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x440237,_0x403080){var _0x59c5b8=function(_0x4740a5){while(--_0x4740a5){_0x440237['push'](_0x440237['shift']());}};_0x59c5b8(++_0x403080);}(_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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 8a10647..180d725 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 _0x2f14=['sequelize','exports'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x2f14,0x1b4));var _0x42f1=function(_0x33bb21,_0x5463c2){_0x33bb21=_0x33bb21-0x0;var _0x36ab0a=_0x2f14[_0x33bb21];return _0x36ab0a;};'use strict';var Sequelize=require(_0x42f1('0x0'));module[_0x42f1('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x374a=['sequelize','INTEGER'];(function(_0x1d9962,_0x1812b0){var _0x4b2463=function(_0xa5a845){while(--_0xa5a845){_0x1d9962['push'](_0x1d9962['shift']());}};_0x4b2463(++_0x1812b0);}(_0x374a,0x122));var _0xa374=function(_0xaa8be9,_0x568c26){_0xaa8be9=_0xaa8be9-0x0;var _0x22e504=_0x374a[_0xaa8be9];return _0x22e504;};'use strict';var Sequelize=require(_0xa374('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xa374('0x1')],'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 8ccea49..c9c8ea9 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 _0x5a16=['exports','define','user_has_whatsapp_queues','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x5b704f,_0x557509){var _0x57dcc6=function(_0xe82fae){while(--_0xe82fae){_0x5b704f['push'](_0x5b704f['shift']());}};_0x57dcc6(++_0x557509);}(_0x5a16,0xc1));var _0x65a1=function(_0x5c883f,_0x38f092){_0x5c883f=_0x5c883f-0x0;var _0x4210cc=_0x5a16[_0x5c883f];return _0x4210cc;};'use strict';var _=require(_0x65a1('0x0'));var util=require('util');var logger=require(_0x65a1('0x1'))(_0x65a1('0x2'));var moment=require(_0x65a1('0x3'));var BPromise=require(_0x65a1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x65a1('0x5'));var rimraf=require('rimraf');var config=require(_0x65a1('0x6'));var attributes=require('./userWhatsappQueue.attributes');module[_0x65a1('0x7')]=function(_0x394977,_0x58bce3){return _0x394977[_0x65a1('0x8')]('UserWhatsappQueue',attributes,{'tableName':_0x65a1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b6a=['user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment','request-promise','path','define','UserWhatsappQueue'];(function(_0x20aadb,_0x5a607a){var _0x520018=function(_0x1d258a){while(--_0x1d258a){_0x20aadb['push'](_0x20aadb['shift']());}};_0x520018(++_0x5a607a);}(_0x3b6a,0x105));var _0xa3b6=function(_0x5ba513,_0x459c3b){_0x5ba513=_0x5ba513-0x0;var _0x1132a0=_0x3b6a[_0x5ba513];return _0x1132a0;};'use strict';var _=require(_0xa3b6('0x0'));var util=require(_0xa3b6('0x1'));var logger=require(_0xa3b6('0x2'))(_0xa3b6('0x3'));var moment=require(_0xa3b6('0x4'));var BPromise=require('bluebird');var rp=require(_0xa3b6('0x5'));var fs=require('fs');var path=require(_0xa3b6('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userWhatsappQueue.attributes');module['exports']=function(_0x45f9fd,_0x40ccfb){return _0x45f9fd[_0xa3b6('0x7')](_0xa3b6('0x8'),attributes,{'tableName':_0xa3b6('0x9'),'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 b380607..5792bd8 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 _0x9821=['stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s'];(function(_0x2e5606,_0x20802c){var _0xd4dd6d=function(_0x200c20){while(--_0x200c20){_0x2e5606['push'](_0x2e5606['shift']());}};_0xd4dd6d(++_0x20802c);}(_0x9821,0x13e));var _0x1982=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x9821[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0x1982('0x0'));var util=require(_0x1982('0x1'));var moment=require('moment');var BPromise=require(_0x1982('0x2'));var rs=require(_0x1982('0x3'));var fs=require('fs');var Redis=require(_0x1982('0x4'));var db=require(_0x1982('0x5'))['db'];var utils=require(_0x1982('0x6'));var logger=require(_0x1982('0x7'))(_0x1982('0x8'));var config=require(_0x1982('0x9'));var jayson=require(_0x1982('0xa'));var client=jayson[_0x1982('0xb')][_0x1982('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x139bd7,_0x93bafb,_0x5867af){return new BPromise(function(_0x3002e3,_0xee8f94){return client['request'](_0x139bd7,_0x5867af)[_0x1982('0xd')](function(_0x29e797){logger[_0x1982('0xe')](_0x1982('0xf'),_0x93bafb,_0x1982('0x10'));logger['debug'](_0x1982('0x11'),_0x93bafb,'request\x20sent',JSON[_0x1982('0x12')](_0x29e797));if(_0x29e797[_0x1982('0x13')]){if(_0x29e797['error'][_0x1982('0x14')]===0x1f4){logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x93bafb,_0x29e797[_0x1982('0x13')][_0x1982('0x15')]);return _0xee8f94(_0x29e797[_0x1982('0x13')][_0x1982('0x15')]);}logger['error'](_0x1982('0xf'),_0x93bafb,_0x29e797[_0x1982('0x13')][_0x1982('0x15')]);return _0x3002e3(_0x29e797[_0x1982('0x13')][_0x1982('0x15')]);}else{logger['info'](_0x1982('0xf'),_0x93bafb,_0x1982('0x10'));_0x3002e3(_0x29e797[_0x1982('0x16')]['message']);}})[_0x1982('0x17')](function(_0x1f2be3){logger[_0x1982('0x13')](_0x1982('0xf'),_0x93bafb,_0x1f2be3);_0xee8f94(_0x1f2be3);});});} \ No newline at end of file +var _0xfc99=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0xfc99,0x93));var _0x9fc9=function(_0x1bb7f8,_0x57b7c0){_0x1bb7f8=_0x1bb7f8-0x0;var _0x5912d4=_0xfc99[_0x1bb7f8];return _0x5912d4;};'use strict';var _=require(_0x9fc9('0x0'));var util=require(_0x9fc9('0x1'));var moment=require(_0x9fc9('0x2'));var BPromise=require(_0x9fc9('0x3'));var rs=require(_0x9fc9('0x4'));var fs=require('fs');var Redis=require(_0x9fc9('0x5'));var db=require(_0x9fc9('0x6'))['db'];var utils=require(_0x9fc9('0x7'));var logger=require(_0x9fc9('0x8'))(_0x9fc9('0x9'));var config=require(_0x9fc9('0xa'));var jayson=require(_0x9fc9('0xb'));var client=jayson[_0x9fc9('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c82b6,_0x1893fb,_0x38b21f){return new BPromise(function(_0x2b69a4,_0x53296b){return client[_0x9fc9('0xd')](_0x5c82b6,_0x38b21f)['then'](function(_0x31037a){logger[_0x9fc9('0xe')](_0x9fc9('0xf'),_0x1893fb,_0x9fc9('0x10'));logger[_0x9fc9('0x11')](_0x9fc9('0x12'),_0x1893fb,_0x9fc9('0x10'),JSON[_0x9fc9('0x13')](_0x31037a));if(_0x31037a['error']){if(_0x31037a[_0x9fc9('0x14')]['code']===0x1f4){logger[_0x9fc9('0x14')]('UserWhatsappQueue,\x20%s,\x20%s',_0x1893fb,_0x31037a[_0x9fc9('0x14')]['message']);return _0x53296b(_0x31037a[_0x9fc9('0x14')][_0x9fc9('0x15')]);}logger['error'](_0x9fc9('0xf'),_0x1893fb,_0x31037a[_0x9fc9('0x14')][_0x9fc9('0x15')]);return _0x2b69a4(_0x31037a['error']['message']);}else{logger[_0x9fc9('0xe')](_0x9fc9('0xf'),_0x1893fb,_0x9fc9('0x10'));_0x2b69a4(_0x31037a[_0x9fc9('0x16')]['message']);}})[_0x9fc9('0x17')](function(_0x2fa504){logger[_0x9fc9('0x14')](_0x9fc9('0xf'),_0x1893fb,_0x2fa504);_0x53296b(_0x2fa504);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 644cf20..b655282 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 _0xcf95=['util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./variable.controller','get','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','multer'];(function(_0x3ccc6c,_0x12cd9c){var _0x360d00=function(_0x469236){while(--_0x469236){_0x3ccc6c['push'](_0x3ccc6c['shift']());}};_0x360d00(++_0x12cd9c);}(_0xcf95,0xa1));var _0x5cf9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf95[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x5cf9('0x0'));var util=require(_0x5cf9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5cf9('0x2')]();var fs_extra=require(_0x5cf9('0x3'));var auth=require(_0x5cf9('0x4'));var interaction=require(_0x5cf9('0x5'));var config=require('../../config/environment');var controller=require(_0x5cf9('0x6'));router[_0x5cf9('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5cf9('0x7')](_0x5cf9('0x8'),auth['isAuthenticated'](),controller[_0x5cf9('0x9')]);router[_0x5cf9('0xa')]('/',auth[_0x5cf9('0xb')](),controller[_0x5cf9('0xc')]);router[_0x5cf9('0xd')](_0x5cf9('0x8'),auth[_0x5cf9('0xb')](),controller[_0x5cf9('0xe')]);router[_0x5cf9('0xf')]('/:id',auth[_0x5cf9('0xb')](),controller[_0x5cf9('0x10')]);module[_0x5cf9('0x11')]=router; \ No newline at end of file +var _0x032a=['delete','destroy','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','put','/:id','update'];(function(_0x272b07,_0x48c104){var _0xcca884=function(_0x3ee3ba){while(--_0x3ee3ba){_0x272b07['push'](_0x272b07['shift']());}};_0xcca884(++_0x48c104);}(_0x032a,0xf0));var _0xa032=function(_0x1e4f2d,_0x22e2bb){_0x1e4f2d=_0x1e4f2d-0x0;var _0xd05ce5=_0x032a[_0x1e4f2d];return _0xd05ce5;};'use strict';var multer=require('multer');var util=require(_0xa032('0x0'));var path=require('path');var timeout=require(_0xa032('0x1'));var express=require(_0xa032('0x2'));var router=express[_0xa032('0x3')]();var fs_extra=require(_0xa032('0x4'));var auth=require(_0xa032('0x5'));var interaction=require(_0xa032('0x6'));var config=require(_0xa032('0x7'));var controller=require(_0xa032('0x8'));router[_0xa032('0x9')]('/',auth[_0xa032('0xa')](),controller[_0xa032('0xb')]);router[_0xa032('0x9')]('/:id',auth[_0xa032('0xa')](),controller['show']);router['post']('/',auth[_0xa032('0xa')](),controller['create']);router[_0xa032('0xc')](_0xa032('0xd'),auth[_0xa032('0xa')](),controller[_0xa032('0xe')]);router[_0xa032('0xf')]('/:id',auth[_0xa032('0xa')](),controller[_0xa032('0x10')]);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 c8d6847..ef3451f 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 _0xf629=['STRING','sequelize'];(function(_0x263b1f,_0x3f2376){var _0x4aa612=function(_0x3cae79){while(--_0x3cae79){_0x263b1f['push'](_0x263b1f['shift']());}};_0x4aa612(++_0x3f2376);}(_0xf629,0xd7));var _0x9f62=function(_0x5e5efd,_0x1ea9ae){_0x5e5efd=_0x5e5efd-0x0;var _0x5d0b26=_0xf629[_0x5e5efd];return _0x5d0b26;};'use strict';var Sequelize=require(_0x9f62('0x0'));module['exports']={'name':{'type':Sequelize[_0x9f62('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9f62('0x1')]}}; \ No newline at end of file +var _0x255c=['STRING','sequelize','name'];(function(_0x553579,_0x269bd9){var _0x156ea3=function(_0x3bd6bb){while(--_0x3bd6bb){_0x553579['push'](_0x553579['shift']());}};_0x156ea3(++_0x269bd9);}(_0x255c,0x1bd));var _0xc255=function(_0xc817a7,_0x235e01){_0xc817a7=_0xc817a7-0x0;var _0x5c8426=_0x255c[_0xc817a7];return _0x5c8426;};'use strict';var Sequelize=require(_0xc255('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xc255('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xc255('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 7066c8f..bc8d105 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 _0x2bdb=['attributes','fields','nolimit','order','where','filters','pick','filter','merge','map','VIRTUAL','options','includeAll','rows','catch','show','params','length','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','get','Variables','UserProfileResource','end','sendStatus','error','stack','name','send','index','Variable','fieldName','type','key','query','keys','intersection','model'];(function(_0x1cd51f,_0x23bf2d){var _0x45f4ee=function(_0xf82ccb){while(--_0xf82ccb){_0x1cd51f['push'](_0x1cd51f['shift']());}};_0x45f4ee(++_0x23bf2d);}(_0x2bdb,0x1bb));var _0xb2bd=function(_0xb47d5d,_0x3a5e70){_0xb47d5d=_0xb47d5d-0x0;var _0x5dfd0a=_0x2bdb[_0xb47d5d];return _0x5dfd0a;};'use strict';var emlformat=require(_0xb2bd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb2bd('0x1'));var jsonpatch=require(_0xb2bd('0x2'));var rp=require(_0xb2bd('0x3'));var moment=require('moment');var BPromise=require(_0xb2bd('0x4'));var Mustache=require(_0xb2bd('0x5'));var util=require(_0xb2bd('0x6'));var path=require(_0xb2bd('0x7'));var sox=require(_0xb2bd('0x8'));var csv=require(_0xb2bd('0x9'));var ejs=require(_0xb2bd('0xa'));var fs=require('fs');var fs_extra=require(_0xb2bd('0xb'));var _=require('lodash');var squel=require(_0xb2bd('0xc'));var crypto=require('crypto');var jsforce=require(_0xb2bd('0xd'));var deskjs=require(_0xb2bd('0xe'));var toCsv=require(_0xb2bd('0x9'));var querystring=require(_0xb2bd('0xf'));var Papa=require(_0xb2bd('0x10'));var Redis=require(_0xb2bd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb2bd('0x12'));var hardwareService=require(_0xb2bd('0x13'));var logger=require(_0xb2bd('0x14'))(_0xb2bd('0x15'));var utils=require(_0xb2bd('0x16'));var config=require(_0xb2bd('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xb2bd('0x18'))['db'];function respondWithStatusCode(_0x5525c1,_0x357e49){_0x357e49=_0x357e49||0xcc;return function(_0xfb61b1){if(_0xfb61b1){return _0x5525c1['sendStatus'](_0x357e49);}return _0x5525c1[_0xb2bd('0x19')](_0x357e49)['end']();};}function respondWithResult(_0x4ffb04,_0x2f1de9){_0x2f1de9=_0x2f1de9||0xc8;return function(_0x17d0e1){if(_0x17d0e1){return _0x4ffb04[_0xb2bd('0x19')](_0x2f1de9)[_0xb2bd('0x1a')](_0x17d0e1);}};}function respondWithFilteredResult(_0x530f7f,_0x174a64){return function(_0x45c3f3){if(_0x45c3f3){var _0x5f5bce=typeof _0x174a64[_0xb2bd('0x1b')]===_0xb2bd('0x1c')&&typeof _0x174a64[_0xb2bd('0x1d')]===_0xb2bd('0x1c');var _0x1dce8a=_0x45c3f3[_0xb2bd('0x1e')];var _0x26bada=_0x5f5bce?0x0:_0x174a64[_0xb2bd('0x1b')];var _0x3e259f=_0x5f5bce?_0x45c3f3[_0xb2bd('0x1e')]:_0x174a64[_0xb2bd('0x1b')]+_0x174a64[_0xb2bd('0x1d')];var _0x501295;if(_0x3e259f>=_0x1dce8a){_0x3e259f=_0x1dce8a;_0x501295=0xc8;}else{_0x501295=0xce;}_0x530f7f['status'](_0x501295);return _0x530f7f[_0xb2bd('0x1f')]('Content-Range',_0x26bada+'-'+_0x3e259f+'/'+_0x1dce8a)[_0xb2bd('0x1a')](_0x45c3f3);}return null;};}function patchUpdates(_0x328745){return function(_0x53cd1d){try{jsonpatch[_0xb2bd('0x20')](_0x53cd1d,_0x328745,!![]);}catch(_0x4ad508){return BPromise['reject'](_0x4ad508);}return _0x53cd1d[_0xb2bd('0x21')]();};}function saveUpdates(_0x3e2069,_0x54ade7){return function(_0x5dc7a7){if(_0x5dc7a7){return _0x5dc7a7[_0xb2bd('0x22')](_0x3e2069)[_0xb2bd('0x23')](function(_0x74b15d){return _0x74b15d;});}return null;};}function removeEntity(_0x559490,_0x4e5a54){return function(_0x55085a){if(_0x55085a){return _0x55085a[_0xb2bd('0x24')]()[_0xb2bd('0x23')](function(){var _0xf9ea81=_0x55085a[_0xb2bd('0x25')]({'plain':!![]});var _0x3330da=_0xb2bd('0x26');return db[_0xb2bd('0x27')]['destroy']({'where':{'type':_0x3330da,'resourceId':_0xf9ea81['id']}})[_0xb2bd('0x23')](function(){return _0x55085a;});})['then'](function(){_0x559490[_0xb2bd('0x19')](0xcc)[_0xb2bd('0x28')]();});}};}function handleEntityNotFound(_0x262e01,_0x483671){return function(_0x56f7be){if(!_0x56f7be){_0x262e01[_0xb2bd('0x29')](0x194);}return _0x56f7be;};}function handleError(_0x2f5b76,_0x4f0efe){_0x4f0efe=_0x4f0efe||0x1f4;return function(_0x5dd99e){logger[_0xb2bd('0x2a')](_0x5dd99e[_0xb2bd('0x2b')]);if(_0x5dd99e['name']){delete _0x5dd99e[_0xb2bd('0x2c')];}_0x2f5b76[_0xb2bd('0x19')](_0x4f0efe)[_0xb2bd('0x2d')](_0x5dd99e);};}exports[_0xb2bd('0x2e')]=function(_0x1cee9c,_0x273595){var _0x5e6120={},_0x4edf1a={},_0xbd32ef={'count':0x0,'rows':[]};var _0xdc55c0=_['map'](db[_0xb2bd('0x2f')]['rawAttributes'],function(_0x4c4cfa){return{'name':_0x4c4cfa[_0xb2bd('0x30')],'type':_0x4c4cfa[_0xb2bd('0x31')][_0xb2bd('0x32')]};});_0x4edf1a['model']=_['map'](_0xdc55c0,_0xb2bd('0x2c'));_0x4edf1a[_0xb2bd('0x33')]=_[_0xb2bd('0x34')](_0x1cee9c['query']);_0x4edf1a['filters']=_[_0xb2bd('0x35')](_0x4edf1a[_0xb2bd('0x36')],_0x4edf1a['query']);_0x5e6120[_0xb2bd('0x37')]=_[_0xb2bd('0x35')](_0x4edf1a[_0xb2bd('0x36')],qs[_0xb2bd('0x38')](_0x1cee9c[_0xb2bd('0x33')][_0xb2bd('0x38')]));_0x5e6120[_0xb2bd('0x37')]=_0x5e6120['attributes']['length']?_0x5e6120[_0xb2bd('0x37')]:_0x4edf1a[_0xb2bd('0x36')];if(!_0x1cee9c[_0xb2bd('0x33')]['hasOwnProperty'](_0xb2bd('0x39'))){_0x5e6120[_0xb2bd('0x1d')]=qs['limit'](_0x1cee9c[_0xb2bd('0x33')][_0xb2bd('0x1d')]);_0x5e6120[_0xb2bd('0x1b')]=qs[_0xb2bd('0x1b')](_0x1cee9c[_0xb2bd('0x33')][_0xb2bd('0x1b')]);}_0x5e6120[_0xb2bd('0x3a')]=qs['sort'](_0x1cee9c[_0xb2bd('0x33')]['sort']);_0x5e6120[_0xb2bd('0x3b')]=qs[_0xb2bd('0x3c')](_[_0xb2bd('0x3d')](_0x1cee9c['query'],_0x4edf1a[_0xb2bd('0x3c')]),_0xdc55c0);if(_0x1cee9c[_0xb2bd('0x33')][_0xb2bd('0x3e')]){_0x5e6120[_0xb2bd('0x3b')]=_[_0xb2bd('0x3f')](_0x5e6120[_0xb2bd('0x3b')],{'$or':_[_0xb2bd('0x40')](_0xdc55c0,function(_0x25b474){if(_0x25b474[_0xb2bd('0x31')]!==_0xb2bd('0x41')){var _0x3cef00={};_0x3cef00[_0x25b474['name']]={'$like':'%'+_0x1cee9c[_0xb2bd('0x33')][_0xb2bd('0x3e')]+'%'};return _0x3cef00;}})});}_0x5e6120=_[_0xb2bd('0x3f')]({},_0x5e6120,_0x1cee9c[_0xb2bd('0x42')]);var _0x37be57={'where':_0x5e6120[_0xb2bd('0x3b')]};return db[_0xb2bd('0x2f')][_0xb2bd('0x1e')](_0x37be57)[_0xb2bd('0x23')](function(_0x29b08b){_0xbd32ef[_0xb2bd('0x1e')]=_0x29b08b;if(_0x1cee9c[_0xb2bd('0x33')][_0xb2bd('0x43')]){_0x5e6120['include']=[{'all':!![]}];}return db['Variable']['findAll'](_0x5e6120);})['then'](function(_0x3383e5){_0xbd32ef[_0xb2bd('0x44')]=_0x3383e5;return _0xbd32ef;})[_0xb2bd('0x23')](respondWithFilteredResult(_0x273595,_0x5e6120))[_0xb2bd('0x45')](handleError(_0x273595,null));};exports[_0xb2bd('0x46')]=function(_0x5126dc,_0x54799f){var _0xd966fb={'raw':!![],'where':{'id':_0x5126dc[_0xb2bd('0x47')]['id']}},_0x59bfd9={};_0x59bfd9['model']=_[_0xb2bd('0x34')](db[_0xb2bd('0x2f')]['rawAttributes']);_0x59bfd9[_0xb2bd('0x33')]=_['keys'](_0x5126dc[_0xb2bd('0x33')]);_0x59bfd9[_0xb2bd('0x3c')]=_['intersection'](_0x59bfd9[_0xb2bd('0x36')],_0x59bfd9[_0xb2bd('0x33')]);_0xd966fb[_0xb2bd('0x37')]=_[_0xb2bd('0x35')](_0x59bfd9[_0xb2bd('0x36')],qs[_0xb2bd('0x38')](_0x5126dc[_0xb2bd('0x33')][_0xb2bd('0x38')]));_0xd966fb['attributes']=_0xd966fb['attributes'][_0xb2bd('0x48')]?_0xd966fb[_0xb2bd('0x37')]:_0x59bfd9[_0xb2bd('0x36')];if(_0x5126dc[_0xb2bd('0x33')][_0xb2bd('0x43')]){_0xd966fb['include']=[{'all':!![]}];}_0xd966fb=_[_0xb2bd('0x3f')]({},_0xd966fb,_0x5126dc[_0xb2bd('0x42')]);return db[_0xb2bd('0x2f')]['find'](_0xd966fb)['then'](handleEntityNotFound(_0x54799f,null))[_0xb2bd('0x23')](respondWithResult(_0x54799f,null))[_0xb2bd('0x45')](handleError(_0x54799f,null));};exports['create']=function(_0x4d0f7b,_0x194da1){return db[_0xb2bd('0x2f')][_0xb2bd('0x49')](_0x4d0f7b['body'],{})['then'](function(_0x19cc97){var _0x1d478e=_0x4d0f7b[_0xb2bd('0x4a')][_0xb2bd('0x25')]({'plain':!![]});if(!_0x1d478e)throw new Error(_0xb2bd('0x4b'));if(_0x1d478e[_0xb2bd('0x4c')]==='user'){var _0x2a1425=_0x19cc97[_0xb2bd('0x25')]({'plain':!![]});var _0x259a92='Variables';return db[_0xb2bd('0x4d')][_0xb2bd('0x4e')]({'where':{'name':_0x259a92,'userProfileId':_0x1d478e[_0xb2bd('0x4f')]},'raw':!![]})[_0xb2bd('0x23')](function(_0xdd105e){if(_0xdd105e&&_0xdd105e[_0xb2bd('0x50')]===0x0){return db[_0xb2bd('0x27')][_0xb2bd('0x49')]({'name':_0x2a1425[_0xb2bd('0x2c')],'resourceId':_0x2a1425['id'],'type':_0xdd105e[_0xb2bd('0x2c')],'sectionId':_0xdd105e['id']},{})['then'](function(){return _0x19cc97;});}else{return _0x19cc97;}})[_0xb2bd('0x45')](function(_0x1213a1){logger['error'](_0xb2bd('0x51'),_0x1213a1);throw _0x1213a1;});}return _0x19cc97;})[_0xb2bd('0x23')](respondWithResult(_0x194da1,0xc9))[_0xb2bd('0x45')](handleError(_0x194da1,null));};exports[_0xb2bd('0x22')]=function(_0x603827,_0x4f6cfa){if(_0x603827[_0xb2bd('0x52')]['id']){delete _0x603827[_0xb2bd('0x52')]['id'];}return db[_0xb2bd('0x2f')][_0xb2bd('0x4e')]({'where':{'id':_0x603827[_0xb2bd('0x47')]['id']}})[_0xb2bd('0x23')](handleEntityNotFound(_0x4f6cfa,null))[_0xb2bd('0x23')](saveUpdates(_0x603827[_0xb2bd('0x52')],null))['then'](respondWithResult(_0x4f6cfa,null))[_0xb2bd('0x45')](handleError(_0x4f6cfa,null));};exports[_0xb2bd('0x24')]=function(_0x3eab36,_0x424300){return db[_0xb2bd('0x2f')][_0xb2bd('0x4e')]({'where':{'id':_0x3eab36['params']['id']}})[_0xb2bd('0x23')](handleEntityNotFound(_0x424300,null))[_0xb2bd('0x23')](removeEntity(_0x424300,null))[_0xb2bd('0x45')](handleError(_0x424300,null));}; \ No newline at end of file +var _0x3c4c=['userProfileId','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','UserProfileResource','end','error','stack','name','send','index','map','fieldName','type','key','model','intersection','query','fields','attributes','length','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','Variable','includeAll','include','findAll','catch','show','keys','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x1db254,_0xd3194a){var _0x3cf061=function(_0x18d5b0){while(--_0x18d5b0){_0x1db254['push'](_0x1db254['shift']());}};_0x3cf061(++_0xd3194a);}(_0x3c4c,0x146));var _0xc3c4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3c4c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc3c4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc3c4('0x1'));var jsonpatch=require(_0xc3c4('0x2'));var rp=require(_0xc3c4('0x3'));var moment=require(_0xc3c4('0x4'));var BPromise=require(_0xc3c4('0x5'));var Mustache=require(_0xc3c4('0x6'));var util=require('util');var path=require('path');var sox=require(_0xc3c4('0x7'));var csv=require(_0xc3c4('0x8'));var ejs=require(_0xc3c4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc3c4('0xa'));var squel=require(_0xc3c4('0xb'));var crypto=require(_0xc3c4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc3c4('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc3c4('0xe'));var Papa=require(_0xc3c4('0xf'));var Redis=require(_0xc3c4('0x10'));var authService=require(_0xc3c4('0x11'));var qs=require(_0xc3c4('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc3c4('0x13'));var logger=require(_0xc3c4('0x14'))('api');var utils=require(_0xc3c4('0x15'));var config=require(_0xc3c4('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc3c4('0x17'))['db'];function respondWithStatusCode(_0x224b66,_0x50b1cb){_0x50b1cb=_0x50b1cb||0xcc;return function(_0x2493f0){if(_0x2493f0){return _0x224b66[_0xc3c4('0x18')](_0x50b1cb);}return _0x224b66[_0xc3c4('0x19')](_0x50b1cb)['end']();};}function respondWithResult(_0x322af0,_0x11b9e3){_0x11b9e3=_0x11b9e3||0xc8;return function(_0x7455bc){if(_0x7455bc){return _0x322af0[_0xc3c4('0x19')](_0x11b9e3)['json'](_0x7455bc);}};}function respondWithFilteredResult(_0x1e061b,_0x2b0d16){return function(_0x2b7d00){if(_0x2b7d00){var _0x42be08=typeof _0x2b0d16[_0xc3c4('0x1a')]===_0xc3c4('0x1b')&&typeof _0x2b0d16[_0xc3c4('0x1c')]===_0xc3c4('0x1b');var _0x39994a=_0x2b7d00[_0xc3c4('0x1d')];var _0xd2cc73=_0x42be08?0x0:_0x2b0d16['offset'];var _0x129a3b=_0x42be08?_0x2b7d00[_0xc3c4('0x1d')]:_0x2b0d16['offset']+_0x2b0d16[_0xc3c4('0x1c')];var _0x27e222;if(_0x129a3b>=_0x39994a){_0x129a3b=_0x39994a;_0x27e222=0xc8;}else{_0x27e222=0xce;}_0x1e061b['status'](_0x27e222);return _0x1e061b[_0xc3c4('0x1e')](_0xc3c4('0x1f'),_0xd2cc73+'-'+_0x129a3b+'/'+_0x39994a)['json'](_0x2b7d00);}return null;};}function patchUpdates(_0x19839c){return function(_0x424f89){try{jsonpatch[_0xc3c4('0x20')](_0x424f89,_0x19839c,!![]);}catch(_0x2138a7){return BPromise[_0xc3c4('0x21')](_0x2138a7);}return _0x424f89[_0xc3c4('0x22')]();};}function saveUpdates(_0x222c5a,_0x14b14d){return function(_0x261ab3){if(_0x261ab3){return _0x261ab3[_0xc3c4('0x23')](_0x222c5a)['then'](function(_0x1268a5){return _0x1268a5;});}return null;};}function removeEntity(_0x28935f,_0x3dae1f){return function(_0x3cf762){if(_0x3cf762){return _0x3cf762[_0xc3c4('0x24')]()[_0xc3c4('0x25')](function(){var _0x405584=_0x3cf762[_0xc3c4('0x26')]({'plain':!![]});var _0x78e6c6='Variables';return db[_0xc3c4('0x27')][_0xc3c4('0x24')]({'where':{'type':_0x78e6c6,'resourceId':_0x405584['id']}})[_0xc3c4('0x25')](function(){return _0x3cf762;});})[_0xc3c4('0x25')](function(){_0x28935f[_0xc3c4('0x19')](0xcc)[_0xc3c4('0x28')]();});}};}function handleEntityNotFound(_0x3f599e,_0x3ae076){return function(_0x37b621){if(!_0x37b621){_0x3f599e[_0xc3c4('0x18')](0x194);}return _0x37b621;};}function handleError(_0x2fef18,_0x1e16ca){_0x1e16ca=_0x1e16ca||0x1f4;return function(_0x37b5dd){logger[_0xc3c4('0x29')](_0x37b5dd[_0xc3c4('0x2a')]);if(_0x37b5dd['name']){delete _0x37b5dd[_0xc3c4('0x2b')];}_0x2fef18['status'](_0x1e16ca)[_0xc3c4('0x2c')](_0x37b5dd);};}exports[_0xc3c4('0x2d')]=function(_0x348ca4,_0x4015e0){var _0x33f63e={},_0x10c62f={},_0x4225cd={'count':0x0,'rows':[]};var _0x524492=_[_0xc3c4('0x2e')](db['Variable']['rawAttributes'],function(_0x40296c){return{'name':_0x40296c[_0xc3c4('0x2f')],'type':_0x40296c[_0xc3c4('0x30')][_0xc3c4('0x31')]};});_0x10c62f[_0xc3c4('0x32')]=_['map'](_0x524492,_0xc3c4('0x2b'));_0x10c62f['query']=_['keys'](_0x348ca4['query']);_0x10c62f['filters']=_[_0xc3c4('0x33')](_0x10c62f['model'],_0x10c62f[_0xc3c4('0x34')]);_0x33f63e['attributes']=_['intersection'](_0x10c62f[_0xc3c4('0x32')],qs[_0xc3c4('0x35')](_0x348ca4[_0xc3c4('0x34')][_0xc3c4('0x35')]));_0x33f63e['attributes']=_0x33f63e[_0xc3c4('0x36')][_0xc3c4('0x37')]?_0x33f63e[_0xc3c4('0x36')]:_0x10c62f['model'];if(!_0x348ca4['query'][_0xc3c4('0x38')]('nolimit')){_0x33f63e[_0xc3c4('0x1c')]=qs[_0xc3c4('0x1c')](_0x348ca4[_0xc3c4('0x34')][_0xc3c4('0x1c')]);_0x33f63e[_0xc3c4('0x1a')]=qs['offset'](_0x348ca4[_0xc3c4('0x34')]['offset']);}_0x33f63e['order']=qs['sort'](_0x348ca4[_0xc3c4('0x34')][_0xc3c4('0x39')]);_0x33f63e[_0xc3c4('0x3a')]=qs[_0xc3c4('0x3b')](_[_0xc3c4('0x3c')](_0x348ca4[_0xc3c4('0x34')],_0x10c62f[_0xc3c4('0x3b')]),_0x524492);if(_0x348ca4['query'][_0xc3c4('0x3d')]){_0x33f63e[_0xc3c4('0x3a')]=_[_0xc3c4('0x3e')](_0x33f63e[_0xc3c4('0x3a')],{'$or':_[_0xc3c4('0x2e')](_0x524492,function(_0x539e30){if(_0x539e30[_0xc3c4('0x30')]!==_0xc3c4('0x3f')){var _0x1e2dce={};_0x1e2dce[_0x539e30['name']]={'$like':'%'+_0x348ca4[_0xc3c4('0x34')][_0xc3c4('0x3d')]+'%'};return _0x1e2dce;}})});}_0x33f63e=_[_0xc3c4('0x3e')]({},_0x33f63e,_0x348ca4[_0xc3c4('0x40')]);var _0x2f99f7={'where':_0x33f63e[_0xc3c4('0x3a')]};return db[_0xc3c4('0x41')][_0xc3c4('0x1d')](_0x2f99f7)['then'](function(_0x289646){_0x4225cd['count']=_0x289646;if(_0x348ca4[_0xc3c4('0x34')][_0xc3c4('0x42')]){_0x33f63e[_0xc3c4('0x43')]=[{'all':!![]}];}return db[_0xc3c4('0x41')][_0xc3c4('0x44')](_0x33f63e);})[_0xc3c4('0x25')](function(_0x12e127){_0x4225cd['rows']=_0x12e127;return _0x4225cd;})[_0xc3c4('0x25')](respondWithFilteredResult(_0x4015e0,_0x33f63e))[_0xc3c4('0x45')](handleError(_0x4015e0,null));};exports[_0xc3c4('0x46')]=function(_0x5c0476,_0x103134){var _0x2e3320={'raw':!![],'where':{'id':_0x5c0476['params']['id']}},_0x21fe04={};_0x21fe04[_0xc3c4('0x32')]=_[_0xc3c4('0x47')](db['Variable'][_0xc3c4('0x48')]);_0x21fe04['query']=_[_0xc3c4('0x47')](_0x5c0476[_0xc3c4('0x34')]);_0x21fe04[_0xc3c4('0x3b')]=_[_0xc3c4('0x33')](_0x21fe04[_0xc3c4('0x32')],_0x21fe04['query']);_0x2e3320['attributes']=_[_0xc3c4('0x33')](_0x21fe04['model'],qs[_0xc3c4('0x35')](_0x5c0476[_0xc3c4('0x34')]['fields']));_0x2e3320[_0xc3c4('0x36')]=_0x2e3320[_0xc3c4('0x36')][_0xc3c4('0x37')]?_0x2e3320[_0xc3c4('0x36')]:_0x21fe04[_0xc3c4('0x32')];if(_0x5c0476[_0xc3c4('0x34')][_0xc3c4('0x42')]){_0x2e3320[_0xc3c4('0x43')]=[{'all':!![]}];}_0x2e3320=_[_0xc3c4('0x3e')]({},_0x2e3320,_0x5c0476[_0xc3c4('0x40')]);return db[_0xc3c4('0x41')][_0xc3c4('0x49')](_0x2e3320)['then'](handleEntityNotFound(_0x103134,null))['then'](respondWithResult(_0x103134,null))[_0xc3c4('0x45')](handleError(_0x103134,null));};exports[_0xc3c4('0x4a')]=function(_0x50b113,_0x5b0255){return db[_0xc3c4('0x41')][_0xc3c4('0x4a')](_0x50b113[_0xc3c4('0x4b')],{})[_0xc3c4('0x25')](function(_0x12f4d1){var _0x485518=_0x50b113[_0xc3c4('0x4c')][_0xc3c4('0x26')]({'plain':!![]});if(!_0x485518)throw new Error(_0xc3c4('0x4d'));if(_0x485518[_0xc3c4('0x4e')]==='user'){var _0xb14697=_0x12f4d1[_0xc3c4('0x26')]({'plain':!![]});var _0x2a49ef='Variables';return db['UserProfileSection'][_0xc3c4('0x49')]({'where':{'name':_0x2a49ef,'userProfileId':_0x485518[_0xc3c4('0x4f')]},'raw':!![]})['then'](function(_0x14a433){if(_0x14a433&&_0x14a433['autoAssociation']===0x0){return db[_0xc3c4('0x27')]['create']({'name':_0xb14697['name'],'resourceId':_0xb14697['id'],'type':_0x14a433[_0xc3c4('0x2b')],'sectionId':_0x14a433['id']},{})['then'](function(){return _0x12f4d1;});}else{return _0x12f4d1;}})[_0xc3c4('0x45')](function(_0x354281){logger[_0xc3c4('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x354281);throw _0x354281;});}return _0x12f4d1;})[_0xc3c4('0x25')](respondWithResult(_0x5b0255,0xc9))[_0xc3c4('0x45')](handleError(_0x5b0255,null));};exports[_0xc3c4('0x23')]=function(_0x4a3d85,_0x435065){if(_0x4a3d85[_0xc3c4('0x4b')]['id']){delete _0x4a3d85[_0xc3c4('0x4b')]['id'];}return db[_0xc3c4('0x41')]['find']({'where':{'id':_0x4a3d85[_0xc3c4('0x50')]['id']}})[_0xc3c4('0x25')](handleEntityNotFound(_0x435065,null))[_0xc3c4('0x25')](saveUpdates(_0x4a3d85[_0xc3c4('0x4b')],null))['then'](respondWithResult(_0x435065,null))[_0xc3c4('0x45')](handleError(_0x435065,null));};exports[_0xc3c4('0x24')]=function(_0x4d332b,_0x5261fd){return db[_0xc3c4('0x41')][_0xc3c4('0x49')]({'where':{'id':_0x4d332b['params']['id']}})[_0xc3c4('0x25')](handleEntityNotFound(_0x5261fd,null))[_0xc3c4('0x25')](removeEntity(_0x5261fd,null))[_0xc3c4('0x45')](handleError(_0x5261fd,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 37dc27e..dfcfaf8 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 _0xd0fb=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./variable.attributes','exports','define','Variable','tools_variables','util'];(function(_0x2c7877,_0x4d0091){var _0x209597=function(_0xff6877){while(--_0xff6877){_0x2c7877['push'](_0x2c7877['shift']());}};_0x209597(++_0x4d0091);}(_0xd0fb,0x1bb));var _0xbd0f=function(_0x5bf6aa,_0x4862cb){_0x5bf6aa=_0x5bf6aa-0x0;var _0xd2773d=_0xd0fb[_0x5bf6aa];return _0xd2773d;};'use strict';var _=require('lodash');var util=require(_0xbd0f('0x0'));var logger=require(_0xbd0f('0x1'))(_0xbd0f('0x2'));var moment=require(_0xbd0f('0x3'));var BPromise=require(_0xbd0f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbd0f('0x5'));var config=require(_0xbd0f('0x6'));var attributes=require(_0xbd0f('0x7'));module[_0xbd0f('0x8')]=function(_0xa02f82,_0x1466b7){return _0xa02f82[_0xbd0f('0x9')](_0xbd0f('0xa'),attributes,{'tableName':_0xbd0f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd358=['util','../../config/logger','api','moment','bluebird','rimraf','./variable.attributes','exports','define','Variable','tools_variables','lodash'];(function(_0x526da2,_0x54996e){var _0x11390c=function(_0x21f3d1){while(--_0x21f3d1){_0x526da2['push'](_0x526da2['shift']());}};_0x11390c(++_0x54996e);}(_0xd358,0x1eb));var _0x8d35=function(_0x4069b3,_0x1ffd97){_0x4069b3=_0x4069b3-0x0;var _0x4fec1e=_0xd358[_0x4069b3];return _0x4fec1e;};'use strict';var _=require(_0x8d35('0x0'));var util=require(_0x8d35('0x1'));var logger=require(_0x8d35('0x2'))(_0x8d35('0x3'));var moment=require(_0x8d35('0x4'));var BPromise=require(_0x8d35('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8d35('0x6'));var config=require('../../config/environment');var attributes=require(_0x8d35('0x7'));module[_0x8d35('0x8')]=function(_0xdeb097,_0x366997){return _0xdeb097[_0x8d35('0x9')](_0x8d35('0xa'),attributes,{'tableName':_0x8d35('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index d4dc600..ce1b6fe 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(_0x5b733d,_0x272606){var _0x2b7995=function(_0x1e5bf8){while(--_0x1e5bf8){_0x5b733d['push'](_0x5b733d['shift']());}};_0x2b7995(++_0x272606);}(_0x55ca,0x126));var _0xa55c=function(_0x436b6e,_0x30ccab){_0x436b6e=_0x436b6e-0x0;var _0x3fe68d=_0x55ca[_0x436b6e];return _0x3fe68d;};'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 _0x7217=['where','attributes','map','include','model','ShowVariable','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','debug','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','Variable','find','options','raw'];(function(_0x644f39,_0x29de5a){var _0x153f00=function(_0x5505ef){while(--_0x5505ef){_0x644f39['push'](_0x644f39['shift']());}};_0x153f00(++_0x29de5a);}(_0x7217,0x19e));var _0x7721=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0x7217[_0x1b349a];return _0x5d1f7c;};'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')]('Variable,\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']('Variable,\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);});});}exports['ShowVariable']=function(_0x3fc09e){var _0x5cb0e6=this;return new Promise(function(_0xfec626,_0x4e96fb){return db[_0x7721('0x18')][_0x7721('0x19')]({'raw':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1b')]===undefined?!![]:![]:!![],'where':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1c')]||null:null,'attributes':_0x3fc09e['options']?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1d')]||null:null,'include':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')]['include']?_[_0x7721('0x1e')](_0x3fc09e['options'][_0x7721('0x1f')],function(_0x288e3a){return{'model':db[_0x288e3a[_0x7721('0x20')]],'as':_0x288e3a['as'],'attributes':_0x288e3a[_0x7721('0x1d')],'include':_0x288e3a[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x288e3a[_0x7721('0x1f')],function(_0x5b4d74){return{'model':db[_0x5b4d74[_0x7721('0x20')]],'as':_0x5b4d74['as'],'attributes':_0x5b4d74[_0x7721('0x1d')],'include':_0x5b4d74[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x5b4d74[_0x7721('0x1f')],function(_0x16355a){return{'model':db[_0x16355a[_0x7721('0x20')]],'as':_0x16355a['as'],'attributes':_0x16355a[_0x7721('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7721('0xc')](function(_0x52316e){logger[_0x7721('0xd')]('ShowVariable',_0x3fc09e);logger['debug'](_0x7721('0x21'),_0x3fc09e,JSON[_0x7721('0x12')](_0x52316e));_0xfec626(_0x52316e);})[_0x7721('0x17')](function(_0x158d98){logger[_0x7721('0x13')](_0x7721('0x21'),_0x158d98[_0x7721('0x15')],_0x3fc09e);_0x4e96fb(_0x5cb0e6[_0x7721('0x13')](0x1f4,_0x158d98['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 62e2954..9f9a178 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 _0x877c=['/reset','reset','/pull','pull','restart','/migrations','migrations','exports','Router','../../components/auth/service','./version.controller','get','isAuthenticated','canUpdate','fetch'];(function(_0x170758,_0x29e993){var _0x221204=function(_0x101027){while(--_0x101027){_0x170758['push'](_0x170758['shift']());}};_0x221204(++_0x29e993);}(_0x877c,0x161));var _0xc877=function(_0x3a8bc7,_0xf26990){_0x3a8bc7=_0x3a8bc7-0x0;var _0x466ad9=_0x877c[_0x3a8bc7];return _0x466ad9;};'use strict';var express=require('express');var router=express[_0xc877('0x0')]();var auth=require(_0xc877('0x1'));var controller=require(_0xc877('0x2'));router[_0xc877('0x3')]('/',controller['index']);router[_0xc877('0x3')]('/fetch',auth[_0xc877('0x4')](),auth[_0xc877('0x5')](),controller[_0xc877('0x6')]);router[_0xc877('0x3')](_0xc877('0x7'),auth[_0xc877('0x4')](),auth[_0xc877('0x5')](),controller[_0xc877('0x8')]);router['get'](_0xc877('0x9'),auth['isAuthenticated'](),auth[_0xc877('0x5')](),controller[_0xc877('0xa')]);router[_0xc877('0x3')]('/restart',auth[_0xc877('0x4')](),controller[_0xc877('0xb')]);router['get'](_0xc877('0xc'),controller[_0xc877('0xd')]);module[_0xc877('0xe')]=router; \ No newline at end of file +var _0xb11d=['migrations','exports','express','Router','../../components/auth/service','./version.controller','get','/fetch','isAuthenticated','/reset','reset','/pull','canUpdate','/restart','restart'];(function(_0x305542,_0x4b921a){var _0x413821=function(_0x4c1204){while(--_0x4c1204){_0x305542['push'](_0x305542['shift']());}};_0x413821(++_0x4b921a);}(_0xb11d,0x179));var _0xdb11=function(_0x4c465a,_0x59403a){_0x4c465a=_0x4c465a-0x0;var _0x5223cb=_0xb11d[_0x4c465a];return _0x5223cb;};'use strict';var express=require(_0xdb11('0x0'));var router=express[_0xdb11('0x1')]();var auth=require(_0xdb11('0x2'));var controller=require(_0xdb11('0x3'));router[_0xdb11('0x4')]('/',controller['index']);router[_0xdb11('0x4')](_0xdb11('0x5'),auth[_0xdb11('0x6')](),auth['canUpdate'](),controller['fetch']);router['get'](_0xdb11('0x7'),auth[_0xdb11('0x6')](),auth['canUpdate'](),controller[_0xdb11('0x8')]);router[_0xdb11('0x4')](_0xdb11('0x9'),auth['isAuthenticated'](),auth[_0xdb11('0xa')](),controller['pull']);router[_0xdb11('0x4')](_0xdb11('0xb'),auth['isAuthenticated'](),controller[_0xdb11('0xc')]);router[_0xdb11('0x4')]('/migrations',controller[_0xdb11('0xd')]);module[_0xdb11('0xe')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 1b7add9..d5db7b2 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 _0xf2c3=['\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','path','pkginfo','version','compare-versions','../../mysqldb','../../config/environment','update','simple-git','root','index','exports','query','latest','tags','2.0.0','status','json','fetch','origin','master','error','git\x20fetch','git\x20fetch\x20origin\x20master','reset','info','git\x20reset\x20--hard\x20FETCH_HEAD','pull','npm\x20install\x20--production','restart','motion2','then','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','length','replace','.js','push','sort','sequelize','Migration','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','server'];(function(_0x2623f2,_0x3b88f0){var _0x1707de=function(_0x33db50){while(--_0x33db50){_0x2623f2['push'](_0x2623f2['shift']());}};_0x1707de(++_0x3b88f0);}(_0xf2c3,0x162));var _0x3f2c=function(_0x1ebdd4,_0x5eb34a){_0x1ebdd4=_0x1ebdd4-0x0;var _0x265e7=_0xf2c3[_0x1ebdd4];return _0x265e7;};'use strict';var Umzug=require('umzug');var path=require(_0x3f2c('0x0'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x3f2c('0x1'))(module,_0x3f2c('0x2'));var compareVersions=require(_0x3f2c('0x3'));var exec=require('child_process')['exec'];var db=require(_0x3f2c('0x4'))['db'];var config=require(_0x3f2c('0x5'));var pm2=require('../../config/pm2');var logger=require('../../config/logger')(_0x3f2c('0x6'));var git=require(_0x3f2c('0x7'))(config[_0x3f2c('0x8')]);exports[_0x3f2c('0x9')]=function(_0x3fe00b,_0x58b157){var _0x3162b2={'current':module[_0x3f2c('0xa')][_0x3f2c('0x2')],'phonebar':0x2};if(_0x3fe00b[_0x3f2c('0xb')]&&_0x3fe00b[_0x3f2c('0xb')][_0x3f2c('0xc')]){return git['fetch']()[_0x3f2c('0xd')](function(_0x1d41ae,_0x5e27bb){_0x3162b2['latest']=(_0x1d41ae?module[_0x3f2c('0xa')][_0x3f2c('0x2')]:_0x5e27bb['latest'])||_0x3f2c('0xe');return _0x58b157['status'](0xc8)['json'](_0x3162b2);});}else{return _0x58b157[_0x3f2c('0xf')](0xc8)[_0x3f2c('0x10')](_0x3162b2);}};exports[_0x3f2c('0x11')]=function(_0x1656e2,_0xde3ca1){return git[_0x3f2c('0x11')]([_0x3f2c('0x12'),_0x3f2c('0x13')],function(_0x6c9fec){if(_0x6c9fec){logger[_0x3f2c('0x14')](_0x6c9fec);return _0xde3ca1['status'](0x1f4)[_0x3f2c('0x10')](_0x6c9fec);}logger['info'](_0x3f2c('0x15'));return _0xde3ca1['status'](0xc8)[_0x3f2c('0x10')]({'output':_0x3f2c('0x16')});});};exports[_0x3f2c('0x17')]=function(_0x1d0728,_0x41aa09){return git[_0x3f2c('0x17')](['--hard','FETCH_HEAD'],function(_0x2b4df7){if(_0x2b4df7){logger[_0x3f2c('0x14')](_0x2b4df7);return _0x41aa09[_0x3f2c('0xf')](0x1f4)['json'](_0x2b4df7);}logger[_0x3f2c('0x18')](_0x3f2c('0x19'));return _0x41aa09[_0x3f2c('0xf')](0xc8)[_0x3f2c('0x10')]({'output':'git\x20reset\x20--hard'});});};exports[_0x3f2c('0x1a')]=function(_0xdca49d,_0x14a9d6){exec(_0x3f2c('0x1b'),function(_0xcbb327,_0x106d83,_0x1f1e36){logger[_0x3f2c('0x18')](_0x106d83);logger[_0x3f2c('0x18')](_0x1f1e36);if(_0xcbb327){logger['error'](_0xcbb327);return _0x14a9d6[_0x3f2c('0xf')](0x1f4)['json'](_0xcbb327);}return _0x14a9d6[_0x3f2c('0xf')](0xc8)[_0x3f2c('0x10')]({'output':_0x106d83});});};exports[_0x3f2c('0x1c')]=function(_0x2839f9,_0x599f49){return pm2[_0x3f2c('0x1c')](_0x3f2c('0x1d'))[_0x3f2c('0x1e')](function(_0x4fa32e){logger[_0x3f2c('0x18')]('pm2\x20restart\x20motion\x20%s',_0x4fa32e);return _0x599f49[_0x3f2c('0xf')](0xc8)['json']({'output':_0x3f2c('0x1f')});})[_0x3f2c('0x20')](function(_0x4301f9){logger[_0x3f2c('0x14')](_0x4301f9);return _0x599f49[_0x3f2c('0xf')](0x1f4)[_0x3f2c('0x10')](_0x4301f9);});};exports[_0x3f2c('0x21')]=function(_0x428806,_0x2ccbe4){var _0x14eb46=fs[_0x3f2c('0x22')](path[_0x3f2c('0x23')](config[_0x3f2c('0x8')],'server',_0x3f2c('0x21')));var _0xcc9612=[];for(var _0x562eda=0x0;_0x562eda<_0x14eb46[_0x3f2c('0x24')];_0x562eda++){var _0xed29dd=_0x14eb46[_0x562eda][_0x3f2c('0x25')](_0x3f2c('0x26'),'');if(compareVersions(module[_0x3f2c('0xa')][_0x3f2c('0x2')],_0xed29dd)===-0x1){_0xcc9612[_0x3f2c('0x27')](_0xed29dd);}}if(_0xcc9612[_0x3f2c('0x24')]){var _0x252aec=_0xcc9612[_0x3f2c('0x28')](compareVersions);var _0x224546=new Umzug({'storage':_0x3f2c('0x29'),'storageOptions':{'model':db[_0x3f2c('0x2a')],'modelName':_0x3f2c('0x2a'),'columnName':'version'},'migrations':{'params':[db[_0x3f2c('0x29')][_0x3f2c('0x2b')](),db[_0x3f2c('0x29')]['constructor'],function(){throw new Error(_0x3f2c('0x2c'));}],'path':path['join'](config[_0x3f2c('0x8')],_0x3f2c('0x2d'),'migrations'),'pattern':/\.js$/}});_0x224546['up']({'migrations':_['map'](_0x252aec,function(_0x445412){return _0x445412+_0x3f2c('0x26');})})[_0x3f2c('0x1e')](function(){return _0x2ccbe4[_0x3f2c('0xf')](0xc8)[_0x3f2c('0x10')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x3f2c('0xa')][_0x3f2c('0x2')]+_0x3f2c('0x2e')+_[_0x3f2c('0x2f')](_0x252aec),'migrations':_[_0x3f2c('0x23')](_0x252aec)});})[_0x3f2c('0x20')](function(_0x2727dc){if(_0x2727dc instanceof db[_0x3f2c('0x29')][_0x3f2c('0x30')]){return _0x2ccbe4[_0x3f2c('0xf')](0xc8)[_0x3f2c('0x10')]({'output':_0x3f2c('0x31')});}else{return _0x2ccbe4[_0x3f2c('0xf')](0x1f4)['json'](_0x2727dc);}});}else{return _0x2ccbe4[_0x3f2c('0xf')](0xc8)[_0x3f2c('0x10')]({'output':_0x3f2c('0x31')});}}; \ No newline at end of file +var _0x48ab=['readdirSync','server','length','.js','exports','push','sort','sequelize','Migration','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','migrations','map','last','join','UniqueConstraintError','Database\x20already\x20up-to-date','lodash','pkginfo','version','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','root','index','query','latest','tags','status','json','fetch','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully'];(function(_0x336abc,_0x176943){var _0xfb2174=function(_0x50e553){while(--_0x50e553){_0x336abc['push'](_0x336abc['shift']());}};_0xfb2174(++_0x176943);}(_0x48ab,0x1db));var _0xb48a=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x48ab[_0x3ff085];return _0x2b68c3;};'use strict';var Umzug=require('umzug');var path=require('path');var fs=require('fs');var _=require(_0xb48a('0x0'));var pkginfo=require(_0xb48a('0x1'))(module,_0xb48a('0x2'));var compareVersions=require('compare-versions');var exec=require(_0xb48a('0x3'))[_0xb48a('0x4')];var db=require(_0xb48a('0x5'))['db'];var config=require(_0xb48a('0x6'));var pm2=require(_0xb48a('0x7'));var logger=require(_0xb48a('0x8'))(_0xb48a('0x9'));var git=require('simple-git')(config[_0xb48a('0xa')]);exports[_0xb48a('0xb')]=function(_0x2594e1,_0x4a8cd5){var _0x395403={'current':module['exports'][_0xb48a('0x2')],'phonebar':0x2};if(_0x2594e1[_0xb48a('0xc')]&&_0x2594e1[_0xb48a('0xc')][_0xb48a('0xd')]){return git['fetch']()[_0xb48a('0xe')](function(_0x3e0749,_0xd0d44d){_0x395403[_0xb48a('0xd')]=(_0x3e0749?module['exports'][_0xb48a('0x2')]:_0xd0d44d['latest'])||'2.0.0';return _0x4a8cd5[_0xb48a('0xf')](0xc8)[_0xb48a('0x10')](_0x395403);});}else{return _0x4a8cd5[_0xb48a('0xf')](0xc8)[_0xb48a('0x10')](_0x395403);}};exports[_0xb48a('0x11')]=function(_0xf1c629,_0x3142a8){return git[_0xb48a('0x11')]([_0xb48a('0x12'),_0xb48a('0x13')],function(_0x2c6abe){if(_0x2c6abe){logger[_0xb48a('0x14')](_0x2c6abe);return _0x3142a8[_0xb48a('0xf')](0x1f4)['json'](_0x2c6abe);}logger[_0xb48a('0x15')](_0xb48a('0x16'));return _0x3142a8[_0xb48a('0xf')](0xc8)[_0xb48a('0x10')]({'output':_0xb48a('0x17')});});};exports[_0xb48a('0x18')]=function(_0x3521c8,_0x1e20c3){return git[_0xb48a('0x18')](['--hard',_0xb48a('0x19')],function(_0x107b11){if(_0x107b11){logger[_0xb48a('0x14')](_0x107b11);return _0x1e20c3[_0xb48a('0xf')](0x1f4)[_0xb48a('0x10')](_0x107b11);}logger[_0xb48a('0x15')](_0xb48a('0x1a'));return _0x1e20c3[_0xb48a('0xf')](0xc8)[_0xb48a('0x10')]({'output':_0xb48a('0x1b')});});};exports[_0xb48a('0x1c')]=function(_0x52ce8a,_0xf40c57){exec(_0xb48a('0x1d'),function(_0xde97d0,_0x43797e,_0x28caf7){logger[_0xb48a('0x15')](_0x43797e);logger[_0xb48a('0x15')](_0x28caf7);if(_0xde97d0){logger[_0xb48a('0x14')](_0xde97d0);return _0xf40c57[_0xb48a('0xf')](0x1f4)[_0xb48a('0x10')](_0xde97d0);}return _0xf40c57[_0xb48a('0xf')](0xc8)[_0xb48a('0x10')]({'output':_0x43797e});});};exports[_0xb48a('0x1e')]=function(_0x503d5e,_0x213682){return pm2[_0xb48a('0x1e')](_0xb48a('0x1f'))[_0xb48a('0x20')](function(_0x309d56){logger[_0xb48a('0x15')](_0xb48a('0x21'),_0x309d56);return _0x213682[_0xb48a('0xf')](0xc8)['json']({'output':_0xb48a('0x22')});})['catch'](function(_0x3c5325){logger['error'](_0x3c5325);return _0x213682[_0xb48a('0xf')](0x1f4)[_0xb48a('0x10')](_0x3c5325);});};exports['migrations']=function(_0x293817,_0x3045b7){var _0x4e3c57=fs[_0xb48a('0x23')](path['join'](config['root'],_0xb48a('0x24'),'migrations'));var _0x2c72c7=[];for(var _0x114261=0x0;_0x114261<_0x4e3c57[_0xb48a('0x25')];_0x114261++){var _0x116601=_0x4e3c57[_0x114261]['replace'](_0xb48a('0x26'),'');if(compareVersions(module[_0xb48a('0x27')]['version'],_0x116601)===-0x1){_0x2c72c7[_0xb48a('0x28')](_0x116601);}}if(_0x2c72c7[_0xb48a('0x25')]){var _0x4b8813=_0x2c72c7[_0xb48a('0x29')](compareVersions);var _0x33ee6d=new Umzug({'storage':_0xb48a('0x2a'),'storageOptions':{'model':db[_0xb48a('0x2b')],'modelName':_0xb48a('0x2b'),'columnName':_0xb48a('0x2')},'migrations':{'params':[db['sequelize']['getQueryInterface'](),db[_0xb48a('0x2a')]['constructor'],function(){throw new Error(_0xb48a('0x2c'));}],'path':path['join'](config['root'],_0xb48a('0x24'),_0xb48a('0x2d')),'pattern':/\.js$/}});_0x33ee6d['up']({'migrations':_[_0xb48a('0x2e')](_0x4b8813,function(_0x4bdb9a){return _0x4bdb9a+_0xb48a('0x26');})})['then'](function(){return _0x3045b7[_0xb48a('0xf')](0xc8)[_0xb48a('0x10')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module['exports'][_0xb48a('0x2')]+'\x20to\x20'+_[_0xb48a('0x2f')](_0x4b8813),'migrations':_[_0xb48a('0x30')](_0x4b8813)});})['catch'](function(_0x4481c1){if(_0x4481c1 instanceof db[_0xb48a('0x2a')][_0xb48a('0x31')]){return _0x3045b7[_0xb48a('0xf')](0xc8)[_0xb48a('0x10')]({'output':_0xb48a('0x32')});}else{return _0x3045b7[_0xb48a('0xf')](0x1f4)[_0xb48a('0x10')](_0x4481c1);}});}else{return _0x3045b7[_0xb48a('0xf')](0xc8)[_0xb48a('0x10')]({'output':_0xb48a('0x32')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index b7ca507..9159bc5 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 _0x63a3=['put','update','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceAgentReport.controller','isAuthenticated','get','/describe','/:id','post','create'];(function(_0x412dd8,_0x355780){var _0x47b96=function(_0x58b680){while(--_0x58b680){_0x412dd8['push'](_0x412dd8['shift']());}};_0x47b96(++_0x355780);}(_0x63a3,0x1f0));var _0x363a=function(_0x2d61b2,_0x142947){_0x2d61b2=_0x2d61b2-0x0;var _0x12df89=_0x63a3[_0x2d61b2];return _0x12df89;};'use strict';var multer=require(_0x363a('0x0'));var util=require('util');var path=require(_0x363a('0x1'));var timeout=require(_0x363a('0x2'));var express=require('express');var router=express[_0x363a('0x3')]();var fs_extra=require(_0x363a('0x4'));var auth=require(_0x363a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x363a('0x6'));var controller=require(_0x363a('0x7'));router['get']('/',auth[_0x363a('0x8')](),controller['index']);router[_0x363a('0x9')](_0x363a('0xa'),auth[_0x363a('0x8')](),controller['describe']);router[_0x363a('0x9')](_0x363a('0xb'),auth[_0x363a('0x8')](),controller['show']);router[_0x363a('0xc')]('/',auth['isAuthenticated'](),controller[_0x363a('0xd')]);router[_0x363a('0xe')](_0x363a('0xb'),auth[_0x363a('0x8')](),controller[_0x363a('0xf')]);router['delete'](_0x363a('0xb'),auth[_0x363a('0x8')](),controller[_0x363a('0x10')]);module['exports']=router; \ No newline at end of file +var _0xf6e4=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','/describe','/:id','show','create','put','delete','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x2fc284,_0x5d271c){var _0x221234=function(_0x39fb00){while(--_0x39fb00){_0x2fc284['push'](_0x2fc284['shift']());}};_0x221234(++_0x5d271c);}(_0xf6e4,0xcb));var _0x4f6e=function(_0x45b5cd,_0x27abdf){_0x45b5cd=_0x45b5cd-0x0;var _0x10945e=_0xf6e4[_0x45b5cd];return _0x10945e;};'use strict';var multer=require(_0x4f6e('0x0'));var util=require('util');var path=require(_0x4f6e('0x1'));var timeout=require(_0x4f6e('0x2'));var express=require(_0x4f6e('0x3'));var router=express[_0x4f6e('0x4')]();var fs_extra=require(_0x4f6e('0x5'));var auth=require(_0x4f6e('0x6'));var interaction=require(_0x4f6e('0x7'));var config=require(_0x4f6e('0x8'));var controller=require(_0x4f6e('0x9'));router[_0x4f6e('0xa')]('/',auth[_0x4f6e('0xb')](),controller['index']);router[_0x4f6e('0xa')](_0x4f6e('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x4f6e('0xa')](_0x4f6e('0xd'),auth['isAuthenticated'](),controller[_0x4f6e('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4f6e('0xf')]);router[_0x4f6e('0x10')]('/:id',auth[_0x4f6e('0xb')](),controller['update']);router[_0x4f6e('0x11')](_0x4f6e('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x4f6e('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 32a94f9..f7d846e 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 _0x9c1d=['exports','STRING','DATE','INTEGER','BOOLEAN','sequelize'];(function(_0x4d2d34,_0x57429d){var _0x23fe99=function(_0x4b2bbd){while(--_0x4b2bbd){_0x4d2d34['push'](_0x4d2d34['shift']());}};_0x23fe99(++_0x57429d);}(_0x9c1d,0x1a9));var _0xd9c1=function(_0x41a5c2,_0x531678){_0x41a5c2=_0x41a5c2-0x0;var _0xefed50=_0x9c1d[_0x41a5c2];return _0xefed50;};'use strict';var Sequelize=require(_0xd9c1('0x0'));module[_0xd9c1('0x1')]={'type':{'type':Sequelize[_0xd9c1('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xd9c1('0x2')]},'calleridname':{'type':Sequelize[_0xd9c1('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xd9c1('0x2')]},'membername':{'type':Sequelize[_0xd9c1('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xd9c1('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xd9c1('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xd9c1('0x3')]},'agentdumpAt':{'type':Sequelize[_0xd9c1('0x3')]},'holdtime':{'type':Sequelize[_0xd9c1('0x4')]},'agentcomplete':{'type':Sequelize[_0xd9c1('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xd9c1('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xd9c1('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xd9c1('0x4')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xd9c1('0x4')]},'reason':{'type':Sequelize[_0xd9c1('0x2')]},'lastevent':{'type':Sequelize[_0xd9c1('0x2')]},'channel':{'type':Sequelize[_0xd9c1('0x2')]},'channelstate':{'type':Sequelize[_0xd9c1('0x4')]},'channelstatedesc':{'type':Sequelize[_0xd9c1('0x2')]},'connectedlinenum':{'type':Sequelize[_0xd9c1('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xd9c1('0x2')]},'accountcode':{'type':Sequelize[_0xd9c1('0x2')]},'context':{'type':Sequelize[_0xd9c1('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xd9c1('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xd9c1('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xd9c1('0x2')]},'destcalleridnum':{'type':Sequelize[_0xd9c1('0x2')]},'destcalleridname':{'type':Sequelize[_0xd9c1('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xd9c1('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xd9c1('0x2')]},'destlanguage':{'type':Sequelize[_0xd9c1('0x2')]},'destaccountcode':{'type':Sequelize[_0xd9c1('0x2')]},'destcontext':{'type':Sequelize[_0xd9c1('0x2')]},'destexten':{'type':Sequelize[_0xd9c1('0x2')]},'destpriority':{'type':Sequelize[_0xd9c1('0x2')]},'destuniqueid':{'type':Sequelize[_0xd9c1('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xd9c1('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xd9c1('0x2')]},'transfer':{'type':Sequelize[_0xd9c1('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xd9c1('0x2')]},'transferuniqueid':{'type':Sequelize[_0xd9c1('0x2')]},'agententerreason':{'type':Sequelize[_0xd9c1('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe9e8=['BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','INTEGER'];(function(_0x9f37f1,_0x55f13c){var _0x47419b=function(_0x4b9e72){while(--_0x4b9e72){_0x9f37f1['push'](_0x9f37f1['shift']());}};_0x47419b(++_0x55f13c);}(_0xe9e8,0x6b));var _0x8e9e=function(_0x64f489,_0x58f52a){_0x64f489=_0x64f489-0x0;var _0x255951=_0xe9e8[_0x64f489];return _0x255951;};'use strict';var Sequelize=require(_0x8e9e('0x0'));module[_0x8e9e('0x1')]={'type':{'type':Sequelize[_0x8e9e('0x2')]},'uniqueid':{'type':Sequelize[_0x8e9e('0x2')]},'calleridnum':{'type':Sequelize[_0x8e9e('0x2')]},'calleridname':{'type':Sequelize[_0x8e9e('0x2')]},'queue':{'type':Sequelize[_0x8e9e('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x8e9e('0x2')]},'agentcalledAt':{'type':Sequelize[_0x8e9e('0x3')]},'agentconnectAt':{'type':Sequelize[_0x8e9e('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x8e9e('0x3')]},'agentdumpAt':{'type':Sequelize[_0x8e9e('0x3')]},'holdtime':{'type':Sequelize[_0x8e9e('0x4')]},'agentcomplete':{'type':Sequelize[_0x8e9e('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x8e9e('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x8e9e('0x4')]},'agentacw':{'type':Sequelize[_0x8e9e('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x8e9e('0x2')]},'lastevent':{'type':Sequelize[_0x8e9e('0x2')]},'channel':{'type':Sequelize[_0x8e9e('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x8e9e('0x2')]},'connectedlinenum':{'type':Sequelize[_0x8e9e('0x2')]},'connectedlinename':{'type':Sequelize[_0x8e9e('0x2')]},'language':{'type':Sequelize[_0x8e9e('0x2')]},'accountcode':{'type':Sequelize[_0x8e9e('0x2')]},'context':{'type':Sequelize[_0x8e9e('0x2')]},'exten':{'type':Sequelize[_0x8e9e('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x8e9e('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x8e9e('0x2')]},'destcalleridnum':{'type':Sequelize[_0x8e9e('0x2')]},'destcalleridname':{'type':Sequelize[_0x8e9e('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x8e9e('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x8e9e('0x2')]},'destlanguage':{'type':Sequelize[_0x8e9e('0x2')]},'destaccountcode':{'type':Sequelize[_0x8e9e('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x8e9e('0x2')]},'destuniqueid':{'type':Sequelize[_0x8e9e('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x8e9e('0x2')]},'transfer':{'type':Sequelize[_0x8e9e('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x8e9e('0x2')],'comment':_0x8e9e('0x6')},'transferexten':{'type':Sequelize[_0x8e9e('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'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 7dc2124..a60bf49 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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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 e95e209..6b2e81a 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 _0x72a2=['define','VoiceAgentReport','report_agent','util','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x3da63b,_0xcd98e5){var _0x2302e3=function(_0xdc449b){while(--_0xdc449b){_0x3da63b['push'](_0x3da63b['shift']());}};_0x2302e3(++_0xcd98e5);}(_0x72a2,0x161));var _0x272a=function(_0x5a153e,_0xf979f6){_0x5a153e=_0x5a153e-0x0;var _0xd6f47c=_0x72a2[_0x5a153e];return _0xd6f47c;};'use strict';var _=require('lodash');var util=require(_0x272a('0x0'));var logger=require(_0x272a('0x1'))(_0x272a('0x2'));var moment=require(_0x272a('0x3'));var BPromise=require(_0x272a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x272a('0x5'));var rimraf=require('rimraf');var config=require(_0x272a('0x6'));var attributes=require('./voiceAgentReport.attributes');module['exports']=function(_0x4f628a,_0x2ba5db){return _0x4f628a[_0x272a('0x7')](_0x272a('0x8'),attributes,{'tableName':_0x272a('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid','destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8784=['exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','api','moment','bluebird','request-promise','path','./voiceAgentReport.attributes'];(function(_0x628eee,_0x3f3fba){var _0x447718=function(_0x38112b){while(--_0x38112b){_0x628eee['push'](_0x628eee['shift']());}};_0x447718(++_0x3f3fba);}(_0x8784,0x172));var _0x4878=function(_0x9df3d8,_0x4074e3){_0x9df3d8=_0x9df3d8-0x0;var _0x366da1=_0x8784[_0x9df3d8];return _0x366da1;};'use strict';var _=require(_0x4878('0x0'));var util=require(_0x4878('0x1'));var logger=require('../../config/logger')(_0x4878('0x2'));var moment=require(_0x4878('0x3'));var BPromise=require(_0x4878('0x4'));var rp=require(_0x4878('0x5'));var fs=require('fs');var path=require(_0x4878('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4878('0x7'));module[_0x4878('0x8')]=function(_0x158bc8,_0xdf70f){return _0x158bc8[_0x4878('0x9')](_0x4878('0xa'),attributes,{'tableName':_0x4878('0xb'),'paranoid':![],'indexes':[{'fields':[_0x4878('0xc'),_0x4878('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 66c1191..7b1cf7f 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 _0x2d7c=['UpdateVoiceAgentReport','update','where','attributes','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceAgentReport','body','options','then','CreateVoiceAgentReport'];(function(_0x152350,_0x3b0fe2){var _0x23a26b=function(_0x5148ca){while(--_0x5148ca){_0x152350['push'](_0x152350['shift']());}};_0x23a26b(++_0x3b0fe2);}(_0x2d7c,0x112));var _0xc2d7=function(_0x2c7780,_0x100f4a){_0x2c7780=_0x2c7780-0x0;var _0x580bc8=_0x2d7c[_0x2c7780];return _0x580bc8;};'use strict';var _=require(_0xc2d7('0x0'));var util=require(_0xc2d7('0x1'));var moment=require('moment');var BPromise=require(_0xc2d7('0x2'));var rs=require(_0xc2d7('0x3'));var fs=require('fs');var Redis=require(_0xc2d7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc2d7('0x5'));var logger=require(_0xc2d7('0x6'))(_0xc2d7('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc2d7('0x8')][_0xc2d7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20b6cc,_0x8e3c11,_0x148d7d){return new BPromise(function(_0x329938,_0x526cfc){return client[_0xc2d7('0xa')](_0x20b6cc,_0x148d7d)['then'](function(_0xf030c){logger[_0xc2d7('0xb')](_0xc2d7('0xc'),_0x8e3c11,_0xc2d7('0xd'));logger['debug'](_0xc2d7('0xe'),_0x8e3c11,'request\x20sent',JSON[_0xc2d7('0xf')](_0xf030c));if(_0xf030c[_0xc2d7('0x10')]){if(_0xf030c[_0xc2d7('0x10')][_0xc2d7('0x11')]===0x1f4){logger[_0xc2d7('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x8e3c11,_0xf030c[_0xc2d7('0x10')]['message']);return _0x526cfc(_0xf030c[_0xc2d7('0x10')][_0xc2d7('0x12')]);}logger[_0xc2d7('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x8e3c11,_0xf030c[_0xc2d7('0x10')][_0xc2d7('0x12')]);return _0x329938(_0xf030c['error']['message']);}else{logger[_0xc2d7('0xb')]('VoiceAgentReport,\x20%s,\x20%s',_0x8e3c11,_0xc2d7('0xd'));_0x329938(_0xf030c[_0xc2d7('0x13')][_0xc2d7('0x12')]);}})[_0xc2d7('0x14')](function(_0x37394a){logger[_0xc2d7('0x10')](_0xc2d7('0xc'),_0x8e3c11,_0x37394a);_0x526cfc(_0x37394a);});});}exports['CreateVoiceAgentReport']=function(_0x3daeec){var _0x2e48e2=this;return new Promise(function(_0xadffe,_0x418c7c){return db[_0xc2d7('0x15')]['create'](_0x3daeec[_0xc2d7('0x16')],{'raw':_0x3daeec[_0xc2d7('0x17')]?_0x3daeec[_0xc2d7('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xc2d7('0x18')](function(_0x3e8aa6){logger[_0xc2d7('0xb')](_0xc2d7('0x19'),_0x3daeec);logger['debug'](_0xc2d7('0x19'),_0x3daeec,JSON[_0xc2d7('0xf')](_0x3e8aa6));_0xadffe(_0x3e8aa6);})['catch'](function(_0x41e69b){logger[_0xc2d7('0x10')](_0xc2d7('0x19'),_0x41e69b[_0xc2d7('0x12')],_0x3daeec);_0x418c7c(_0x2e48e2['error'](0x1f4,_0x41e69b[_0xc2d7('0x12')]));});});};exports[_0xc2d7('0x1a')]=function(_0x2b1e8f){var _0x187b21=this;return new Promise(function(_0x35500e,_0x1935bf){return db[_0xc2d7('0x15')][_0xc2d7('0x1b')](_0x2b1e8f[_0xc2d7('0x16')],{'raw':_0x2b1e8f[_0xc2d7('0x17')]?_0x2b1e8f[_0xc2d7('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b1e8f[_0xc2d7('0x17')]?_0x2b1e8f[_0xc2d7('0x17')][_0xc2d7('0x1c')]||null:null,'attributes':_0x2b1e8f[_0xc2d7('0x17')]?_0x2b1e8f[_0xc2d7('0x17')][_0xc2d7('0x1d')]||null:null,'limit':_0x2b1e8f[_0xc2d7('0x17')]?_0x2b1e8f[_0xc2d7('0x17')]['limit']||null:null})[_0xc2d7('0x18')](function(_0x1d8d2a){logger[_0xc2d7('0xb')](_0xc2d7('0x1a'),_0x2b1e8f);logger['debug'](_0xc2d7('0x1a'),_0x2b1e8f,JSON['stringify'](_0x1d8d2a));_0x35500e(_0x1d8d2a);})['catch'](function(_0x5700d6){logger[_0xc2d7('0x10')](_0xc2d7('0x1a'),_0x5700d6[_0xc2d7('0x12')],_0x2b1e8f);_0x1935bf(_0x187b21[_0xc2d7('0x10')](0x1f4,_0x5700d6[_0xc2d7('0x12')]));});});}; \ No newline at end of file +var _0xa565=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','UpdateVoiceAgentReport','update','where','attributes','limit','lodash','bluebird','randomstring','ioredis'];(function(_0x1e6d6b,_0x20bb9a){var _0x19aea8=function(_0x14b054){while(--_0x14b054){_0x1e6d6b['push'](_0x1e6d6b['shift']());}};_0x19aea8(++_0x20bb9a);}(_0xa565,0x9c));var _0x5a56=function(_0x47a389,_0x499c1f){_0x47a389=_0x47a389-0x0;var _0x7b01e=_0xa565[_0x47a389];return _0x7b01e;};'use strict';var _=require(_0x5a56('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5a56('0x1'));var rs=require(_0x5a56('0x2'));var fs=require('fs');var Redis=require(_0x5a56('0x3'));var db=require(_0x5a56('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5a56('0x5'))(_0x5a56('0x6'));var config=require(_0x5a56('0x7'));var jayson=require(_0x5a56('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x49487d,_0x24f91c,_0x4d6e07){return new BPromise(function(_0x201684,_0x239790){return client['request'](_0x49487d,_0x4d6e07)[_0x5a56('0x9')](function(_0x381073){logger[_0x5a56('0xa')](_0x5a56('0xb'),_0x24f91c,_0x5a56('0xc'));logger[_0x5a56('0xd')](_0x5a56('0xe'),_0x24f91c,_0x5a56('0xc'),JSON[_0x5a56('0xf')](_0x381073));if(_0x381073['error']){if(_0x381073[_0x5a56('0x10')][_0x5a56('0x11')]===0x1f4){logger[_0x5a56('0x10')](_0x5a56('0xb'),_0x24f91c,_0x381073[_0x5a56('0x10')][_0x5a56('0x12')]);return _0x239790(_0x381073['error'][_0x5a56('0x12')]);}logger[_0x5a56('0x10')](_0x5a56('0xb'),_0x24f91c,_0x381073[_0x5a56('0x10')][_0x5a56('0x12')]);return _0x201684(_0x381073['error']['message']);}else{logger[_0x5a56('0xa')](_0x5a56('0xb'),_0x24f91c,'request\x20sent');_0x201684(_0x381073[_0x5a56('0x13')][_0x5a56('0x12')]);}})[_0x5a56('0x14')](function(_0x2c195e){logger[_0x5a56('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x24f91c,_0x2c195e);_0x239790(_0x2c195e);});});}exports[_0x5a56('0x15')]=function(_0x21ec91){var _0x314644=this;return new Promise(function(_0x236e7b,_0x24a3d8){return db[_0x5a56('0x16')][_0x5a56('0x17')](_0x21ec91[_0x5a56('0x18')],{'raw':_0x21ec91[_0x5a56('0x19')]?_0x21ec91[_0x5a56('0x19')][_0x5a56('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x96cec6){logger[_0x5a56('0xa')](_0x5a56('0x15'),_0x21ec91);logger[_0x5a56('0xd')]('CreateVoiceAgentReport',_0x21ec91,JSON['stringify'](_0x96cec6));_0x236e7b(_0x96cec6);})[_0x5a56('0x14')](function(_0x148687){logger['error'](_0x5a56('0x15'),_0x148687[_0x5a56('0x12')],_0x21ec91);_0x24a3d8(_0x314644[_0x5a56('0x10')](0x1f4,_0x148687['message']));});});};exports[_0x5a56('0x1b')]=function(_0x27dce0){var _0x2ad469=this;return new Promise(function(_0x361e67,_0x377fe1){return db['VoiceAgentReport'][_0x5a56('0x1c')](_0x27dce0[_0x5a56('0x18')],{'raw':_0x27dce0['options']?_0x27dce0[_0x5a56('0x19')][_0x5a56('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27dce0[_0x5a56('0x19')]?_0x27dce0[_0x5a56('0x19')][_0x5a56('0x1d')]||null:null,'attributes':_0x27dce0['options']?_0x27dce0[_0x5a56('0x19')][_0x5a56('0x1e')]||null:null,'limit':_0x27dce0[_0x5a56('0x19')]?_0x27dce0['options'][_0x5a56('0x1f')]||null:null})[_0x5a56('0x9')](function(_0x5e258e){logger[_0x5a56('0xa')](_0x5a56('0x1b'),_0x27dce0);logger['debug']('UpdateVoiceAgentReport',_0x27dce0,JSON[_0x5a56('0xf')](_0x5e258e));_0x361e67(_0x5e258e);})['catch'](function(_0x30cc9b){logger[_0x5a56('0x10')](_0x5a56('0x1b'),_0x30cc9b['message'],_0x27dce0);_0x377fe1(_0x2ad469['error'](0x1f4,_0x30cc9b[_0x5a56('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index ba1446a..c054f31 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 _0x6b8f=['destroy','exports','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./voiceCallReport.controller','get','index','/describe','isAuthenticated','/:id','show','post','create','put'];(function(_0x19d339,_0x18ae8e){var _0x49e86f=function(_0x51de9c){while(--_0x51de9c){_0x19d339['push'](_0x19d339['shift']());}};_0x49e86f(++_0x18ae8e);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x593ea9,_0xd1f751){_0x593ea9=_0x593ea9-0x0;var _0x5c04f6=_0x6b8f[_0x593ea9];return _0x5c04f6;};'use strict';var multer=require('multer');var util=require(_0xf6b8('0x0'));var path=require('path');var timeout=require(_0xf6b8('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf6b8('0x2'));var auth=require(_0xf6b8('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xf6b8('0x4'));var controller=require(_0xf6b8('0x5'));router[_0xf6b8('0x6')]('/',auth['isAuthenticated'](),controller[_0xf6b8('0x7')]);router[_0xf6b8('0x6')](_0xf6b8('0x8'),auth[_0xf6b8('0x9')](),controller['describe']);router['get'](_0xf6b8('0xa'),auth['isAuthenticated'](),controller[_0xf6b8('0xb')]);router[_0xf6b8('0xc')]('/',auth[_0xf6b8('0x9')](),controller[_0xf6b8('0xd')]);router[_0xf6b8('0xe')](_0xf6b8('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xf6b8('0xa'),auth[_0xf6b8('0x9')](),controller[_0xf6b8('0xf')]);module[_0xf6b8('0x10')]=router; \ No newline at end of file +var _0x8ef6=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x196054,_0x36712b){var _0x3ef8b7=function(_0x276a0f){while(--_0x276a0f){_0x196054['push'](_0x196054['shift']());}};_0x3ef8b7(++_0x36712b);}(_0x8ef6,0xf2));var _0x68ef=function(_0x142487,_0x3ae69b){_0x142487=_0x142487-0x0;var _0x4b605b=_0x8ef6[_0x142487];return _0x4b605b;};'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('0xf')]('/',auth[_0x68ef('0xc')](),controller[_0x68ef('0x10')]);router[_0x68ef('0x11')](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x12')]);router[_0x68ef('0x13')]('/:id',auth[_0x68ef('0xc')](),controller[_0x68ef('0x14')]);module[_0x68ef('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index b5ca5df..bc2d33e 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 _0xcc85=['INTEGER','exports','ENUM','inbound','outbound','outbound-fax','dialer','STRING','DATE'];(function(_0x8a9de,_0x3790ff){var _0x20733f=function(_0x58f543){while(--_0x58f543){_0x8a9de['push'](_0x8a9de['shift']());}};_0x20733f(++_0x3790ff);}(_0xcc85,0x121));var _0x5cc8=function(_0x786e9,_0x1a029){_0x786e9=_0x786e9-0x0;var _0x1f891b=_0xcc85[_0x786e9];return _0x1f891b;};'use strict';var Sequelize=require('sequelize');module[_0x5cc8('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x5cc8('0x1')](_0x5cc8('0x2'),'internal',_0x5cc8('0x3'),'inbound-fax',_0x5cc8('0x4'),_0x5cc8('0x5'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x5cc8('0x6')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0x5cc8('0x6')]},'callerid':{'type':Sequelize[_0x5cc8('0x6')]},'channel':{'type':Sequelize[_0x5cc8('0x6')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x5cc8('0x6')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x5cc8('0x7')]},'answertime':{'type':Sequelize[_0x5cc8('0x7')]},'endtime':{'type':Sequelize[_0x5cc8('0x7')]},'duration':{'type':Sequelize[_0x5cc8('0x8')]},'billableseconds':{'type':Sequelize[_0x5cc8('0x8')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x5cc8('0x6')]},'amaflags':{'type':Sequelize[_0x5cc8('0x6')]},'userfield':{'type':Sequelize[_0x5cc8('0x6')]},'userDisposition':{'type':Sequelize[_0x5cc8('0x6')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x5cc8('0x6')]},'prefix':{'type':Sequelize[_0x5cc8('0x6')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x5cc8('0x6')]}}; \ No newline at end of file +var _0xb98e=['TEXT','DATE','INTEGER','sequelize','exports','inbound','internal','outbound','outbound-fax','dialer','STRING'];(function(_0x29311d,_0x3f9e23){var _0xa29b8f=function(_0x2bb490){while(--_0x2bb490){_0x29311d['push'](_0x29311d['shift']());}};_0xa29b8f(++_0x3f9e23);}(_0xb98e,0x184));var _0xeb98=function(_0x1ba32d,_0x40fc84){_0x1ba32d=_0x1ba32d-0x0;var _0x2fb7f7=_0xb98e[_0x1ba32d];return _0x2fb7f7;};'use strict';var Sequelize=require(_0xeb98('0x0'));module[_0xeb98('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0xeb98('0x2'),_0xeb98('0x3'),_0xeb98('0x4'),'inbound-fax',_0xeb98('0x5'),_0xeb98('0x6'))},'tag':{'type':Sequelize[_0xeb98('0x7')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0xeb98('0x7')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0xeb98('0x7')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xeb98('0x7')]},'destinationchannel':{'type':Sequelize[_0xeb98('0x7')]},'lastapplication':{'type':Sequelize[_0xeb98('0x7')]},'lastdata':{'type':Sequelize[_0xeb98('0x8')]},'starttime':{'type':Sequelize[_0xeb98('0x9')]},'systemanswertime':{'type':Sequelize[_0xeb98('0x9')]},'answertime':{'type':Sequelize[_0xeb98('0x9')]},'endtime':{'type':Sequelize[_0xeb98('0x9')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xeb98('0xa')]},'mohtime':{'type':Sequelize[_0xeb98('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xeb98('0x7')]},'amaflags':{'type':Sequelize[_0xeb98('0x7')]},'userfield':{'type':Sequelize[_0xeb98('0x7')]},'userDisposition':{'type':Sequelize[_0xeb98('0x7')]},'userSecondDisposition':{'type':Sequelize[_0xeb98('0x7')]},'userThirdDisposition':{'type':Sequelize[_0xeb98('0x7')]},'note':{'type':Sequelize[_0xeb98('0x7')]},'prefix':{'type':Sequelize[_0xeb98('0x7')]},'routeid':{'type':Sequelize[_0xeb98('0xa')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index c5d222c..ae5bd80 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(_0x50aaaa,_0xd65e82){_0x50aaaa=_0x50aaaa-0x0;var _0x183baf=_0x2032[_0x50aaaa];return _0x183baf;};'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 _0x5f66=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','VoiceCallReport','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','includeAll','include','fullname','alias','User','rows','catch','show','params','find','create','body','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x5f66,0x1a0));var _0x65f6=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x5f66[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419819,_0x4862a5){_0x4862a5=_0x4862a5||0xcc;return function(_0x2f964a){if(_0x2f964a){return _0x419819[_0x65f6('0x14')](_0x4862a5);}return _0x419819[_0x65f6('0x15')](_0x4862a5)[_0x65f6('0x16')]();};}function respondWithResult(_0x369f96,_0x1d29fd){_0x1d29fd=_0x1d29fd||0xc8;return function(_0x44144b){if(_0x44144b){return _0x369f96[_0x65f6('0x15')](_0x1d29fd)[_0x65f6('0x17')](_0x44144b);}};}function respondWithFilteredResult(_0x3440af,_0x59154e){return function(_0x19b9ff){if(_0x19b9ff){var _0x49a913=typeof _0x59154e['offset']===_0x65f6('0x18')&&typeof _0x59154e[_0x65f6('0x19')]===_0x65f6('0x18');var _0x1c955c=_0x19b9ff[_0x65f6('0x1a')];var _0x1f974c=_0x49a913?0x0:_0x59154e[_0x65f6('0x1b')];var _0x18380e=_0x49a913?_0x19b9ff['count']:_0x59154e['offset']+_0x59154e[_0x65f6('0x19')];var _0x5b4055;if(_0x18380e>=_0x1c955c){_0x18380e=_0x1c955c;_0x5b4055=0xc8;}else{_0x5b4055=0xce;}_0x3440af['status'](_0x5b4055);return _0x3440af['set'](_0x65f6('0x1c'),_0x1f974c+'-'+_0x18380e+'/'+_0x1c955c)[_0x65f6('0x17')](_0x19b9ff);}return null;};}function patchUpdates(_0x5114a4){return function(_0x39e19f){try{jsonpatch[_0x65f6('0x1d')](_0x39e19f,_0x5114a4,!![]);}catch(_0xbee6a4){return BPromise[_0x65f6('0x1e')](_0xbee6a4);}return _0x39e19f[_0x65f6('0x1f')]();};}function saveUpdates(_0xc139c2,_0x581374){return function(_0x197a49){if(_0x197a49){return _0x197a49['update'](_0xc139c2)['then'](function(_0x212247){return _0x212247;});}return null;};}function removeEntity(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(_0x1eeaaa){return _0x1eeaaa[_0x65f6('0x20')]()[_0x65f6('0x21')](function(){_0xd173f4[_0x65f6('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d7bb0,_0x59ea32){return function(_0x20a161){if(!_0x20a161){_0x9d7bb0['sendStatus'](0x194);}return _0x20a161;};}function handleError(_0x5cb131,_0x4fde2f){_0x4fde2f=_0x4fde2f||0x1f4;return function(_0x29abdb){logger[_0x65f6('0x22')](_0x29abdb['stack']);if(_0x29abdb[_0x65f6('0x23')]){delete _0x29abdb[_0x65f6('0x23')];}_0x5cb131['status'](_0x4fde2f)[_0x65f6('0x24')](_0x29abdb);};}exports[_0x65f6('0x25')]=function(_0x28d0df,_0x559330){var _0x4ac04b={},_0x488d36={},_0x266cfe={'count':0x0,'rows':[]};var _0x3c032f=_[_0x65f6('0x26')](db[_0x65f6('0x27')][_0x65f6('0x28')],function(_0x14a387){return{'name':_0x14a387[_0x65f6('0x29')],'type':_0x14a387['type']['key']};});_0x488d36[_0x65f6('0x2a')]=_[_0x65f6('0x26')](_0x3c032f,'name');_0x488d36['query']=_[_0x65f6('0x2b')](_0x28d0df[_0x65f6('0x2c')]);_0x488d36[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],_0x488d36[_0x65f6('0x2c')]);_0x4ac04b['attributes']=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x28d0df['query'][_0x65f6('0x2f')]));_0x4ac04b[_0x65f6('0x30')]=_0x4ac04b[_0x65f6('0x30')][_0x65f6('0x31')]?_0x4ac04b[_0x65f6('0x30')]:_0x488d36[_0x65f6('0x2a')];if(!_0x28d0df['query'][_0x65f6('0x32')](_0x65f6('0x33'))){_0x4ac04b['limit']=qs[_0x65f6('0x19')](_0x28d0df['query'][_0x65f6('0x19')]);_0x4ac04b['offset']=qs[_0x65f6('0x1b')](_0x28d0df[_0x65f6('0x2c')]['offset']);}_0x4ac04b[_0x65f6('0x34')]=qs[_0x65f6('0x35')](_0x28d0df[_0x65f6('0x2c')]['sort']);_0x4ac04b['where']=qs[_0x65f6('0x2d')](_['pick'](_0x28d0df[_0x65f6('0x2c')],_0x488d36['filters']),_0x3c032f);if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]){_0x4ac04b['where']=_[_0x65f6('0x37')](_0x4ac04b['where'],{'$or':_['map'](_0x3c032f,function(_0x71b16b){if(_0x71b16b[_0x65f6('0x38')]!==_0x65f6('0x39')){var _0x313be5={};_0x313be5[_0x71b16b[_0x65f6('0x23')]]={'$like':'%'+_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]+'%'};return _0x313be5;}})});}_0x4ac04b=_[_0x65f6('0x37')]({},_0x4ac04b,_0x28d0df['options']);var _0x3aa254={'where':_0x4ac04b['where']};return db[_0x65f6('0x27')][_0x65f6('0x1a')](_0x3aa254)[_0x65f6('0x21')](function(_0x2ea7f7){_0x266cfe['count']=_0x2ea7f7;if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x4ac04b[_0x65f6('0x3b')]=[{'attributes':['id',_0x65f6('0x23'),_0x65f6('0x3c'),_0x65f6('0x3d')],'model':db[_0x65f6('0x3e')],'as':_0x65f6('0x3e')}];}return db[_0x65f6('0x27')]['findAll'](_0x4ac04b);})[_0x65f6('0x21')](function(_0x400ed2){_0x266cfe[_0x65f6('0x3f')]=_0x400ed2;return _0x266cfe;})[_0x65f6('0x21')](respondWithFilteredResult(_0x559330,_0x4ac04b))[_0x65f6('0x40')](handleError(_0x559330,null));};exports[_0x65f6('0x41')]=function(_0xe0b72d,_0x2e91e8){var _0x461393={'raw':!![],'where':{'id':_0xe0b72d[_0x65f6('0x42')]['id']}},_0x2abbed={};_0x2abbed[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](db[_0x65f6('0x27')][_0x65f6('0x28')]);_0x2abbed[_0x65f6('0x2c')]=_['keys'](_0xe0b72d[_0x65f6('0x2c')]);_0x2abbed[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],_0x2abbed['query']);_0x461393[_0x65f6('0x30')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],qs['fields'](_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x2f')]));_0x461393[_0x65f6('0x30')]=_0x461393[_0x65f6('0x30')]['length']?_0x461393[_0x65f6('0x30')]:_0x2abbed['model'];if(_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x461393['include']=[{'all':!![]}];}_0x461393=_[_0x65f6('0x37')]({},_0x461393,_0xe0b72d['options']);return db[_0x65f6('0x27')][_0x65f6('0x43')](_0x461393)[_0x65f6('0x21')](handleEntityNotFound(_0x2e91e8,null))[_0x65f6('0x21')](respondWithResult(_0x2e91e8,null))[_0x65f6('0x40')](handleError(_0x2e91e8,null));};exports[_0x65f6('0x44')]=function(_0x4d30c5,_0x51bf6c){return db[_0x65f6('0x27')][_0x65f6('0x44')](_0x4d30c5[_0x65f6('0x45')],{})[_0x65f6('0x21')](respondWithResult(_0x51bf6c,0xc9))[_0x65f6('0x40')](handleError(_0x51bf6c,null));};exports[_0x65f6('0x20')]=function(_0x149c28,_0x41690c){return db[_0x65f6('0x27')]['find']({'where':{'id':_0x149c28[_0x65f6('0x42')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x41690c,null))[_0x65f6('0x21')](removeEntity(_0x41690c,null))['catch'](handleError(_0x41690c,null));};exports[_0x65f6('0x46')]=function(_0x42d453,_0x49ba5a){return db[_0x65f6('0x27')][_0x65f6('0x46')]()['then'](respondWithResult(_0x49ba5a,null))[_0x65f6('0x40')](handleError(_0x49ba5a,null));};exports['update']=function(_0x247be3,_0x3b241f){if(_0x247be3[_0x65f6('0x45')]['uniqueid']){delete _0x247be3[_0x65f6('0x45')][_0x65f6('0x47')];}return db['VoiceCallReport'][_0x65f6('0x43')]({'where':{'uniqueid':_0x247be3[_0x65f6('0x42')]['id'],'UserId':{'$or':[null,_0x247be3['user']['id']]}}})[_0x65f6('0x21')](handleEntityNotFound(_0x3b241f,null))[_0x65f6('0x21')](saveUpdates(_0x247be3[_0x65f6('0x45')],null))[_0x65f6('0x21')](respondWithResult(_0x3b241f,null))[_0x65f6('0x40')](handleError(_0x3b241f,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 4fe9351..1cd5858 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 _0x2efa=['report_call','uniqueid','lodash','../../config/logger','moment','bluebird','path','./voiceCallReport.attributes','exports','define','VoiceCallReport'];(function(_0x3f76ae,_0x3597d7){var _0x900e94=function(_0x447102){while(--_0x447102){_0x3f76ae['push'](_0x3f76ae['shift']());}};_0x900e94(++_0x3597d7);}(_0x2efa,0x141));var _0xa2ef=function(_0x403d69,_0x4221d7){_0x403d69=_0x403d69-0x0;var _0x1b5b82=_0x2efa[_0x403d69];return _0x1b5b82;};'use strict';var _=require(_0xa2ef('0x0'));var util=require('util');var logger=require(_0xa2ef('0x1'))('api');var moment=require(_0xa2ef('0x2'));var BPromise=require(_0xa2ef('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa2ef('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa2ef('0x5'));module[_0xa2ef('0x6')]=function(_0x315d81,_0x3e53a6){return _0x315d81[_0xa2ef('0x7')](_0xa2ef('0x8'),attributes,{'tableName':_0xa2ef('0x9'),'paranoid':![],'indexes':[{'fields':[_0xa2ef('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4baf=['define','VoiceCallReport','report_call','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports'];(function(_0x525fef,_0xd49ded){var _0x2333bb=function(_0x2ba5c6){while(--_0x2ba5c6){_0x525fef['push'](_0x525fef['shift']());}};_0x2333bb(++_0xd49ded);}(_0x4baf,0x14d));var _0xf4ba=function(_0x49cd8a,_0x4b95f3){_0x49cd8a=_0x49cd8a-0x0;var _0x489f31=_0x4baf[_0x49cd8a];return _0x489f31;};'use strict';var _=require(_0xf4ba('0x0'));var util=require(_0xf4ba('0x1'));var logger=require(_0xf4ba('0x2'))(_0xf4ba('0x3'));var moment=require(_0xf4ba('0x4'));var BPromise=require(_0xf4ba('0x5'));var rp=require(_0xf4ba('0x6'));var fs=require('fs');var path=require(_0xf4ba('0x7'));var rimraf=require(_0xf4ba('0x8'));var config=require(_0xf4ba('0x9'));var attributes=require(_0xf4ba('0xa'));module[_0xf4ba('0xb')]=function(_0x4f6dda,_0x149233){return _0x4f6dda[_0xf4ba('0xc')](_0xf4ba('0xd'),attributes,{'tableName':_0xf4ba('0xe'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index fe57af4..201fd40 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 _0x9e75=['debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','message','VoiceCallReport,\x20%s,\x20%s','result','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','include','map','model','stringify','catch','body','CreateVoiceCallReport','UpdateVoiceCallReport','update','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','then','info','request\x20sent'];(function(_0x1868a3,_0x513888){var _0x3cf4e1=function(_0x5c4e98){while(--_0x5c4e98){_0x1868a3['push'](_0x1868a3['shift']());}};_0x3cf4e1(++_0x513888);}(_0x9e75,0x10c));var _0x59e7=function(_0x27d04a,_0x2f9e0b){_0x27d04a=_0x27d04a-0x0;var _0x201940=_0x9e75[_0x27d04a];return _0x201940;};'use strict';var _=require('lodash');var util=require(_0x59e7('0x0'));var moment=require(_0x59e7('0x1'));var BPromise=require(_0x59e7('0x2'));var rs=require(_0x59e7('0x3'));var fs=require('fs');var Redis=require(_0x59e7('0x4'));var db=require(_0x59e7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x59e7('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x59e7('0x7'));var client=jayson[_0x59e7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16bb3d,_0x53ab91,_0x34b051){return new BPromise(function(_0x4635f5,_0x31b48e){return client['request'](_0x16bb3d,_0x34b051)[_0x59e7('0x9')](function(_0x5d5501){logger[_0x59e7('0xa')]('VoiceCallReport,\x20%s,\x20%s',_0x53ab91,_0x59e7('0xb'));logger[_0x59e7('0xc')](_0x59e7('0xd'),_0x53ab91,'request\x20sent',JSON['stringify'](_0x5d5501));if(_0x5d5501[_0x59e7('0xe')]){if(_0x5d5501[_0x59e7('0xe')]['code']===0x1f4){logger[_0x59e7('0xe')]('VoiceCallReport,\x20%s,\x20%s',_0x53ab91,_0x5d5501['error'][_0x59e7('0xf')]);return _0x31b48e(_0x5d5501[_0x59e7('0xe')][_0x59e7('0xf')]);}logger[_0x59e7('0xe')](_0x59e7('0x10'),_0x53ab91,_0x5d5501['error'][_0x59e7('0xf')]);return _0x4635f5(_0x5d5501[_0x59e7('0xe')]['message']);}else{logger[_0x59e7('0xa')](_0x59e7('0x10'),_0x53ab91,_0x59e7('0xb'));_0x4635f5(_0x5d5501[_0x59e7('0x11')][_0x59e7('0xf')]);}})['catch'](function(_0x35a3f8){logger['error'](_0x59e7('0x10'),_0x53ab91,_0x35a3f8);_0x31b48e(_0x35a3f8);});});}exports[_0x59e7('0x12')]=function(_0x573020){var _0x510027=this;return new Promise(function(_0x5b2b5e,_0x3fb8a5){return db[_0x59e7('0x13')][_0x59e7('0x14')]({'raw':_0x573020['options']?_0x573020[_0x59e7('0x15')][_0x59e7('0x16')]===undefined?!![]:![]:!![],'where':_0x573020['options']?_0x573020['options'][_0x59e7('0x17')]||null:null,'attributes':_0x573020['options']?_0x573020['options'][_0x59e7('0x18')]||null:null,'limit':_0x573020[_0x59e7('0x15')]?_0x573020['options']['limit']||null:null,'include':_0x573020[_0x59e7('0x15')]?_0x573020['options'][_0x59e7('0x19')]?_[_0x59e7('0x1a')](_0x573020[_0x59e7('0x15')]['include'],function(_0x1ad2ee){return{'model':db[_0x1ad2ee[_0x59e7('0x1b')]],'as':_0x1ad2ee['as'],'attributes':_0x1ad2ee[_0x59e7('0x18')],'include':_0x1ad2ee[_0x59e7('0x19')]?_[_0x59e7('0x1a')](_0x1ad2ee[_0x59e7('0x19')],function(_0x2574f0){return{'model':db[_0x2574f0[_0x59e7('0x1b')]],'as':_0x2574f0['as'],'attributes':_0x2574f0['attributes'],'include':_0x2574f0[_0x59e7('0x19')]?_['map'](_0x2574f0[_0x59e7('0x19')],function(_0x410e16){return{'model':db[_0x410e16['model']],'as':_0x410e16['as'],'attributes':_0x410e16[_0x59e7('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d348b){logger[_0x59e7('0xa')](_0x59e7('0x12'),_0x573020);logger[_0x59e7('0xc')](_0x59e7('0x12'),_0x573020,JSON[_0x59e7('0x1c')](_0x1d348b));_0x5b2b5e(_0x1d348b);})[_0x59e7('0x1d')](function(_0x448eef){logger[_0x59e7('0xe')](_0x59e7('0x12'),_0x448eef[_0x59e7('0xf')],_0x573020);_0x3fb8a5(_0x510027[_0x59e7('0xe')](0x1f4,_0x448eef['message']));});});};exports['CreateVoiceCallReport']=function(_0x2b805a){var _0x1329b9=this;return new Promise(function(_0x4f6d71,_0x5a4347){return db[_0x59e7('0x13')]['create'](_0x2b805a[_0x59e7('0x1e')],{'raw':_0x2b805a[_0x59e7('0x15')]?_0x2b805a[_0x59e7('0x15')][_0x59e7('0x16')]===undefined?!![]:![]:!![]})[_0x59e7('0x9')](function(_0x3cf0fb){logger[_0x59e7('0xa')]('CreateVoiceCallReport',_0x2b805a);logger[_0x59e7('0xc')](_0x59e7('0x1f'),_0x2b805a,JSON[_0x59e7('0x1c')](_0x3cf0fb));_0x4f6d71(_0x3cf0fb);})['catch'](function(_0x6294c0){logger['error'](_0x59e7('0x1f'),_0x6294c0[_0x59e7('0xf')],_0x2b805a);_0x5a4347(_0x1329b9['error'](0x1f4,_0x6294c0[_0x59e7('0xf')]));});});};exports[_0x59e7('0x20')]=function(_0x2020b8){var _0x2c075d=this;return new Promise(function(_0x4777cf,_0x5a8292){return db['VoiceCallReport'][_0x59e7('0x21')](_0x2020b8[_0x59e7('0x1e')],{'raw':_0x2020b8[_0x59e7('0x15')]?_0x2020b8[_0x59e7('0x15')][_0x59e7('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2020b8[_0x59e7('0x15')]?_0x2020b8[_0x59e7('0x15')][_0x59e7('0x17')]||null:null,'attributes':_0x2020b8[_0x59e7('0x15')]?_0x2020b8[_0x59e7('0x15')]['attributes']||null:null,'limit':_0x2020b8[_0x59e7('0x15')]?_0x2020b8[_0x59e7('0x15')][_0x59e7('0x22')]||null:null})['then'](function(_0x27ffc1){logger['info']('UpdateVoiceCallReport',_0x2020b8);logger[_0x59e7('0xc')]('UpdateVoiceCallReport',_0x2020b8,JSON[_0x59e7('0x1c')](_0x27ffc1));_0x4777cf(_0x27ffc1);})[_0x59e7('0x1d')](function(_0x16df45){logger['error']('UpdateVoiceCallReport',_0x16df45[_0x59e7('0xf')],_0x2020b8);_0x5a8292(_0x2c075d[_0x59e7('0xe')](0x1f4,_0x16df45[_0x59e7('0xf')]));});});}; \ No newline at end of file +var _0xe0b5=['VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','model','map','stringify','create','CreateVoiceCallReport','body','then','UpdateVoiceCallReport','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xe0b5,0x14b));var _0x5e0b=function(_0x1daa83,_0x5642e2){_0x1daa83=_0x1daa83-0x0;var _0x428708=_0xe0b5[_0x1daa83];return _0x428708;};'use strict';var _=require('lodash');var util=require(_0x5e0b('0x0'));var moment=require('moment');var BPromise=require(_0x5e0b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5e0b('0x2'));var db=require(_0x5e0b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5e0b('0x4'))(_0x5e0b('0x5'));var config=require(_0x5e0b('0x6'));var jayson=require(_0x5e0b('0x7'));var client=jayson['client'][_0x5e0b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1f6cdd,_0x5ce1f7,_0x407469){return new BPromise(function(_0x147059,_0x127502){return client['request'](_0x1f6cdd,_0x407469)['then'](function(_0x47358a){logger['info'](_0x5e0b('0x9'),_0x5ce1f7,_0x5e0b('0xa'));logger[_0x5e0b('0xb')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x5ce1f7,_0x5e0b('0xa'),JSON['stringify'](_0x47358a));if(_0x47358a[_0x5e0b('0xc')]){if(_0x47358a[_0x5e0b('0xc')]['code']===0x1f4){logger['error'](_0x5e0b('0x9'),_0x5ce1f7,_0x47358a[_0x5e0b('0xc')][_0x5e0b('0xd')]);return _0x127502(_0x47358a[_0x5e0b('0xc')][_0x5e0b('0xd')]);}logger[_0x5e0b('0xc')]('VoiceCallReport,\x20%s,\x20%s',_0x5ce1f7,_0x47358a[_0x5e0b('0xc')][_0x5e0b('0xd')]);return _0x147059(_0x47358a['error'][_0x5e0b('0xd')]);}else{logger[_0x5e0b('0xe')](_0x5e0b('0x9'),_0x5ce1f7,_0x5e0b('0xa'));_0x147059(_0x47358a[_0x5e0b('0xf')][_0x5e0b('0xd')]);}})[_0x5e0b('0x10')](function(_0x250cb8){logger['error'](_0x5e0b('0x9'),_0x5ce1f7,_0x250cb8);_0x127502(_0x250cb8);});});}exports[_0x5e0b('0x11')]=function(_0x26fde4){var _0x361e00=this;return new Promise(function(_0x1084e6,_0x7b2b1e){return db[_0x5e0b('0x12')][_0x5e0b('0x13')]({'raw':_0x26fde4[_0x5e0b('0x14')]?_0x26fde4[_0x5e0b('0x14')][_0x5e0b('0x15')]===undefined?!![]:![]:!![],'where':_0x26fde4[_0x5e0b('0x14')]?_0x26fde4[_0x5e0b('0x14')][_0x5e0b('0x16')]||null:null,'attributes':_0x26fde4[_0x5e0b('0x14')]?_0x26fde4[_0x5e0b('0x14')][_0x5e0b('0x17')]||null:null,'limit':_0x26fde4[_0x5e0b('0x14')]?_0x26fde4['options'][_0x5e0b('0x18')]||null:null,'include':_0x26fde4[_0x5e0b('0x14')]?_0x26fde4['options'][_0x5e0b('0x19')]?_['map'](_0x26fde4[_0x5e0b('0x14')]['include'],function(_0x51ece3){return{'model':db[_0x51ece3[_0x5e0b('0x1a')]],'as':_0x51ece3['as'],'attributes':_0x51ece3[_0x5e0b('0x17')],'include':_0x51ece3[_0x5e0b('0x19')]?_[_0x5e0b('0x1b')](_0x51ece3[_0x5e0b('0x19')],function(_0x5752af){return{'model':db[_0x5752af[_0x5e0b('0x1a')]],'as':_0x5752af['as'],'attributes':_0x5752af[_0x5e0b('0x17')],'include':_0x5752af['include']?_[_0x5e0b('0x1b')](_0x5752af[_0x5e0b('0x19')],function(_0x28e755){return{'model':db[_0x28e755[_0x5e0b('0x1a')]],'as':_0x28e755['as'],'attributes':_0x28e755['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3cd98b){logger[_0x5e0b('0xe')](_0x5e0b('0x11'),_0x26fde4);logger[_0x5e0b('0xb')]('GetVoiceCallReport',_0x26fde4,JSON[_0x5e0b('0x1c')](_0x3cd98b));_0x1084e6(_0x3cd98b);})[_0x5e0b('0x10')](function(_0xc8d8d3){logger[_0x5e0b('0xc')]('GetVoiceCallReport',_0xc8d8d3[_0x5e0b('0xd')],_0x26fde4);_0x7b2b1e(_0x361e00[_0x5e0b('0xc')](0x1f4,_0xc8d8d3[_0x5e0b('0xd')]));});});};exports['CreateVoiceCallReport']=function(_0x5c26d1){var _0xf1d381=this;return new Promise(function(_0x4a4c33,_0xda3a9f){return db[_0x5e0b('0x12')][_0x5e0b('0x1d')](_0x5c26d1['body'],{'raw':_0x5c26d1[_0x5e0b('0x14')]?_0x5c26d1[_0x5e0b('0x14')][_0x5e0b('0x15')]===undefined?!![]:![]:!![]})['then'](function(_0x56878b){logger[_0x5e0b('0xe')](_0x5e0b('0x1e'),_0x5c26d1);logger[_0x5e0b('0xb')](_0x5e0b('0x1e'),_0x5c26d1,JSON[_0x5e0b('0x1c')](_0x56878b));_0x4a4c33(_0x56878b);})[_0x5e0b('0x10')](function(_0x39bd6f){logger['error'](_0x5e0b('0x1e'),_0x39bd6f[_0x5e0b('0xd')],_0x5c26d1);_0xda3a9f(_0xf1d381['error'](0x1f4,_0x39bd6f[_0x5e0b('0xd')]));});});};exports['UpdateVoiceCallReport']=function(_0x2e9cae){var _0x3167a8=this;return new Promise(function(_0xfb420d,_0x409167){return db[_0x5e0b('0x12')]['update'](_0x2e9cae[_0x5e0b('0x1f')],{'raw':_0x2e9cae[_0x5e0b('0x14')]?_0x2e9cae[_0x5e0b('0x14')][_0x5e0b('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e9cae[_0x5e0b('0x14')]?_0x2e9cae['options'][_0x5e0b('0x16')]||null:null,'attributes':_0x2e9cae['options']?_0x2e9cae[_0x5e0b('0x14')][_0x5e0b('0x17')]||null:null,'limit':_0x2e9cae['options']?_0x2e9cae[_0x5e0b('0x14')]['limit']||null:null})[_0x5e0b('0x20')](function(_0x10b2e3){logger['info'](_0x5e0b('0x21'),_0x2e9cae);logger['debug']('UpdateVoiceCallReport',_0x2e9cae,JSON[_0x5e0b('0x1c')](_0x10b2e3));_0xfb420d(_0x10b2e3);})[_0x5e0b('0x10')](function(_0x49c55f){logger[_0x5e0b('0xc')](_0x5e0b('0x21'),_0x49c55f[_0x5e0b('0xd')],_0x2e9cae);_0x409167(_0x3167a8['error'](0x1f4,_0x49c55f['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 9ec2c67..19ad20f 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 _0xbcb4=['index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbcb4,0x14b));var _0x4bcb=function(_0x3cb0f5,_0x22d68a){_0x3cb0f5=_0x3cb0f5-0x0;var _0x8584cd=_0xbcb4[_0x3cb0f5];return _0x8584cd;};'use strict';var multer=require(_0x4bcb('0x0'));var util=require('util');var path=require(_0x4bcb('0x1'));var timeout=require(_0x4bcb('0x2'));var express=require('express');var router=express[_0x4bcb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4bcb('0x4'));var interaction=require(_0x4bcb('0x5'));var config=require(_0x4bcb('0x6'));var controller=require(_0x4bcb('0x7'));router[_0x4bcb('0x8')]('/',auth['isAuthenticated'](),controller[_0x4bcb('0x9')]);router[_0x4bcb('0x8')](_0x4bcb('0xa'),auth[_0x4bcb('0xb')](),controller[_0x4bcb('0xc')]);router[_0x4bcb('0xd')]('/',auth[_0x4bcb('0xb')](),controller[_0x4bcb('0xe')]);router[_0x4bcb('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x4bcb('0x10')]);router[_0x4bcb('0x11')](_0x4bcb('0xa'),auth[_0x4bcb('0xb')](),controller[_0x4bcb('0x12')]);module[_0x4bcb('0x13')]=router; \ No newline at end of file +var _0x386b=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x386b,0x178));var _0xb386=function(_0x1c6f43,_0xfcb4e7){_0x1c6f43=_0x1c6f43-0x0;var _0x5adba5=_0x386b[_0x1c6f43];return _0x5adba5;};'use strict';var multer=require(_0xb386('0x0'));var util=require(_0xb386('0x1'));var path=require(_0xb386('0x2'));var timeout=require(_0xb386('0x3'));var express=require(_0xb386('0x4'));var router=express[_0xb386('0x5')]();var fs_extra=require(_0xb386('0x6'));var auth=require(_0xb386('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb386('0x8'));router[_0xb386('0x9')]('/',auth[_0xb386('0xa')](),controller[_0xb386('0xb')]);router[_0xb386('0x9')](_0xb386('0xc'),auth[_0xb386('0xa')](),controller[_0xb386('0xd')]);router[_0xb386('0xe')]('/',auth[_0xb386('0xa')](),controller[_0xb386('0xf')]);router[_0xb386('0x10')](_0xb386('0xc'),auth[_0xb386('0xa')](),controller[_0xb386('0x11')]);router[_0xb386('0x12')](_0xb386('0xc'),auth[_0xb386('0xa')](),controller[_0xb386('0x13')]);module[_0xb386('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index b519bb9..1e75172 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 _0x161f=['setDataValue','options','join','getDataValue','split','BOOLEAN','exports','name','STRING'];(function(_0x52ab62,_0x203d25){var _0x42f499=function(_0x56adfd){while(--_0x56adfd){_0x52ab62['push'](_0x52ab62['shift']());}};_0x42f499(++_0x203d25);}(_0x161f,0xde));var _0xf161=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x161f[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require('sequelize');module[_0xf161('0x0')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING'],'unique':_0xf161('0x1'),'allowNull':![]},'options':{'type':Sequelize[_0xf161('0x2')],'set':function(_0x115f06){this[_0xf161('0x3')](_0xf161('0x4'),_0x115f06?_0x115f06[_0xf161('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0xf161('0x4'))?this[_0xf161('0x6')](_0xf161('0x4'))[_0xf161('0x7')](''):[];}},'auth':{'type':Sequelize[_0xf161('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0xf161('0x2')]},'record':{'type':Sequelize[_0xf161('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xf161('0x2')]},'description':{'type':Sequelize[_0xf161('0x2')]}}; \ No newline at end of file +var _0x8580=['join','getDataValue','split','BOOLEAN','exports','STRING','name','setDataValue','options'];(function(_0x1766bd,_0x3e0cb3){var _0x136a2a=function(_0x2699d8){while(--_0x2699d8){_0x1766bd['push'](_0x1766bd['shift']());}};_0x136a2a(++_0x3e0cb3);}(_0x8580,0x163));var _0x0858=function(_0xc204bc,_0x42a9af){_0xc204bc=_0xc204bc-0x0;var _0x291021=_0x8580[_0xc204bc];return _0x291021;};'use strict';var Sequelize=require('sequelize');module[_0x0858('0x0')]={'name':{'type':Sequelize[_0x0858('0x1')]},'prefix':{'type':Sequelize[_0x0858('0x1')],'unique':_0x0858('0x2'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x5b63bd){this[_0x0858('0x3')](_0x0858('0x4'),_0x5b63bd?_0x5b63bd[_0x0858('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0x0858('0x4'))?this[_0x0858('0x6')](_0x0858('0x4'))[_0x0858('0x7')](''):[];}},'auth':{'type':Sequelize[_0x0858('0x8')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x0858('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x0858('0x1')]},'description':{'type':Sequelize[_0x0858('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index a0b7324..67b0b4d 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 _0x584a=['sort','where','pick','filter','merge','type','VIRTUAL','options','VoiceChanSpy','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','ejs','fs-extra','squel','crypto','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','apply','reject','save','update','then','destroy','UserProfileResource','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','length','nolimit','order'];(function(_0x16eb11,_0x1a2251){var _0x3ae7ef=function(_0x575a01){while(--_0x575a01){_0x16eb11['push'](_0x16eb11['shift']());}};_0x3ae7ef(++_0x1a2251);}(_0x584a,0x1c0));var _0xa584=function(_0x2298f0,_0x3bbf4f){_0x2298f0=_0x2298f0-0x0;var _0x39b136=_0x584a[_0x2298f0];return _0x39b136;};'use strict';var emlformat=require(_0xa584('0x0'));var rimraf=require(_0xa584('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa584('0x2'));var rp=require(_0xa584('0x3'));var moment=require(_0xa584('0x4'));var BPromise=require(_0xa584('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa584('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa584('0x7'));var fs=require('fs');var fs_extra=require(_0xa584('0x8'));var _=require('lodash');var squel=require(_0xa584('0x9'));var crypto=require(_0xa584('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa584('0xb'));var Papa=require(_0xa584('0xc'));var Redis=require(_0xa584('0xd'));var authService=require(_0xa584('0xe'));var qs=require(_0xa584('0xf'));var as=require(_0xa584('0x10'));var hardwareService=require(_0xa584('0x11'));var logger=require(_0xa584('0x12'))(_0xa584('0x13'));var utils=require(_0xa584('0x14'));var config=require(_0xa584('0x15'));var licenseUtil=require(_0xa584('0x16'));var db=require(_0xa584('0x17'))['db'];function respondWithStatusCode(_0x5cc1f6,_0x26cb6f){_0x26cb6f=_0x26cb6f||0xcc;return function(_0x2fe849){if(_0x2fe849){return _0x5cc1f6[_0xa584('0x18')](_0x26cb6f);}return _0x5cc1f6[_0xa584('0x19')](_0x26cb6f)[_0xa584('0x1a')]();};}function respondWithResult(_0x4a7bb2,_0x15e73a){_0x15e73a=_0x15e73a||0xc8;return function(_0x30a56e){if(_0x30a56e){return _0x4a7bb2[_0xa584('0x19')](_0x15e73a)[_0xa584('0x1b')](_0x30a56e);}};}function respondWithFilteredResult(_0x1674b8,_0x4d1c2c){return function(_0x36a630){if(_0x36a630){var _0x588dd7=typeof _0x4d1c2c[_0xa584('0x1c')]===_0xa584('0x1d')&&typeof _0x4d1c2c[_0xa584('0x1e')]==='undefined';var _0x3eb268=_0x36a630[_0xa584('0x1f')];var _0x245885=_0x588dd7?0x0:_0x4d1c2c['offset'];var _0xa510d6=_0x588dd7?_0x36a630['count']:_0x4d1c2c[_0xa584('0x1c')]+_0x4d1c2c[_0xa584('0x1e')];var _0x50ca21;if(_0xa510d6>=_0x3eb268){_0xa510d6=_0x3eb268;_0x50ca21=0xc8;}else{_0x50ca21=0xce;}_0x1674b8[_0xa584('0x19')](_0x50ca21);return _0x1674b8[_0xa584('0x20')](_0xa584('0x21'),_0x245885+'-'+_0xa510d6+'/'+_0x3eb268)[_0xa584('0x1b')](_0x36a630);}return null;};}function patchUpdates(_0xd6f63c){return function(_0x52ec62){try{jsonpatch[_0xa584('0x22')](_0x52ec62,_0xd6f63c,!![]);}catch(_0x2dfda5){return BPromise[_0xa584('0x23')](_0x2dfda5);}return _0x52ec62[_0xa584('0x24')]();};}function saveUpdates(_0x373e81,_0x58f55a){return function(_0x5c3e32){if(_0x5c3e32){return _0x5c3e32[_0xa584('0x25')](_0x373e81)[_0xa584('0x26')](function(_0x276cb2){return _0x276cb2;});}return null;};}function removeEntity(_0x1e5bb9,_0x25a228){return function(_0x3c9e92){if(_0x3c9e92){return _0x3c9e92[_0xa584('0x27')]()[_0xa584('0x26')](function(){var _0x22066=_0x3c9e92['get']({'plain':!![]});var _0x24a65f='ChanSpies';return db[_0xa584('0x28')][_0xa584('0x27')]({'where':{'type':_0x24a65f,'resourceId':_0x22066['id']}})[_0xa584('0x26')](function(){return _0x3c9e92;});})[_0xa584('0x26')](function(){_0x1e5bb9['status'](0xcc)[_0xa584('0x1a')]();});}};}function handleEntityNotFound(_0x53d14b,_0x329add){return function(_0x3dd79f){if(!_0x3dd79f){_0x53d14b[_0xa584('0x18')](0x194);}return _0x3dd79f;};}function handleError(_0x19c531,_0x48230a){_0x48230a=_0x48230a||0x1f4;return function(_0x1880fa){logger['error'](_0x1880fa['stack']);if(_0x1880fa[_0xa584('0x29')]){delete _0x1880fa['name'];}_0x19c531[_0xa584('0x19')](_0x48230a)[_0xa584('0x2a')](_0x1880fa);};}exports['index']=function(_0x1b371b,_0x8300d8){var _0x14c933={},_0x23e5c1={},_0x6d47ba={'count':0x0,'rows':[]};var _0xf371f0=_[_0xa584('0x2b')](db['VoiceChanSpy'][_0xa584('0x2c')],function(_0x196162){return{'name':_0x196162[_0xa584('0x2d')],'type':_0x196162['type'][_0xa584('0x2e')]};});_0x23e5c1[_0xa584('0x2f')]=_[_0xa584('0x2b')](_0xf371f0,_0xa584('0x29'));_0x23e5c1[_0xa584('0x30')]=_[_0xa584('0x31')](_0x1b371b[_0xa584('0x30')]);_0x23e5c1[_0xa584('0x32')]=_['intersection'](_0x23e5c1[_0xa584('0x2f')],_0x23e5c1['query']);_0x14c933[_0xa584('0x33')]=_['intersection'](_0x23e5c1[_0xa584('0x2f')],qs['fields'](_0x1b371b['query'][_0xa584('0x34')]));_0x14c933[_0xa584('0x33')]=_0x14c933['attributes'][_0xa584('0x35')]?_0x14c933[_0xa584('0x33')]:_0x23e5c1[_0xa584('0x2f')];if(!_0x1b371b['query']['hasOwnProperty'](_0xa584('0x36'))){_0x14c933[_0xa584('0x1e')]=qs[_0xa584('0x1e')](_0x1b371b[_0xa584('0x30')][_0xa584('0x1e')]);_0x14c933[_0xa584('0x1c')]=qs['offset'](_0x1b371b[_0xa584('0x30')][_0xa584('0x1c')]);}_0x14c933[_0xa584('0x37')]=qs[_0xa584('0x38')](_0x1b371b['query'][_0xa584('0x38')]);_0x14c933[_0xa584('0x39')]=qs[_0xa584('0x32')](_[_0xa584('0x3a')](_0x1b371b[_0xa584('0x30')],_0x23e5c1[_0xa584('0x32')]),_0xf371f0);if(_0x1b371b[_0xa584('0x30')][_0xa584('0x3b')]){_0x14c933[_0xa584('0x39')]=_[_0xa584('0x3c')](_0x14c933[_0xa584('0x39')],{'$or':_[_0xa584('0x2b')](_0xf371f0,function(_0x5808fa){if(_0x5808fa[_0xa584('0x3d')]!==_0xa584('0x3e')){var _0x3ff63b={};_0x3ff63b[_0x5808fa['name']]={'$like':'%'+_0x1b371b['query'][_0xa584('0x3b')]+'%'};return _0x3ff63b;}})});}_0x14c933=_[_0xa584('0x3c')]({},_0x14c933,_0x1b371b[_0xa584('0x3f')]);var _0x5ca380={'where':_0x14c933[_0xa584('0x39')]};return db[_0xa584('0x40')][_0xa584('0x1f')](_0x5ca380)['then'](function(_0x28a755){_0x6d47ba[_0xa584('0x1f')]=_0x28a755;if(_0x1b371b[_0xa584('0x30')][_0xa584('0x41')]){_0x14c933[_0xa584('0x42')]=[{'all':!![]}];}return db[_0xa584('0x40')][_0xa584('0x43')](_0x14c933);})['then'](function(_0x4e7c29){_0x6d47ba[_0xa584('0x44')]=_0x4e7c29;return _0x6d47ba;})[_0xa584('0x26')](respondWithFilteredResult(_0x8300d8,_0x14c933))[_0xa584('0x45')](handleError(_0x8300d8,null));};exports[_0xa584('0x46')]=function(_0x87ff9,_0x52bed4){var _0x1664c2={'raw':![],'where':{'id':_0x87ff9[_0xa584('0x47')]['id']}},_0x1d68a4={};_0x1d68a4[_0xa584('0x2f')]=_[_0xa584('0x31')](db[_0xa584('0x40')][_0xa584('0x2c')]);_0x1d68a4[_0xa584('0x30')]=_['keys'](_0x87ff9[_0xa584('0x30')]);_0x1d68a4['filters']=_[_0xa584('0x48')](_0x1d68a4[_0xa584('0x2f')],_0x1d68a4['query']);_0x1664c2['attributes']=_[_0xa584('0x48')](_0x1d68a4[_0xa584('0x2f')],qs[_0xa584('0x34')](_0x87ff9[_0xa584('0x30')][_0xa584('0x34')]));_0x1664c2[_0xa584('0x33')]=_0x1664c2[_0xa584('0x33')][_0xa584('0x35')]?_0x1664c2[_0xa584('0x33')]:_0x1d68a4[_0xa584('0x2f')];if(_0x87ff9['query'][_0xa584('0x41')]){_0x1664c2[_0xa584('0x42')]=[{'all':!![]}];}_0x1664c2=_[_0xa584('0x3c')]({},_0x1664c2,_0x87ff9['options']);return db[_0xa584('0x40')][_0xa584('0x49')](_0x1664c2)[_0xa584('0x26')](handleEntityNotFound(_0x52bed4,null))[_0xa584('0x26')](respondWithResult(_0x52bed4,null))[_0xa584('0x45')](handleError(_0x52bed4,null));};exports[_0xa584('0x4a')]=function(_0x3e82f3,_0x5536c3){return db[_0xa584('0x40')]['create'](_0x3e82f3['body'],{})[_0xa584('0x26')](function(_0x266a7f){var _0x4b2152=_0x3e82f3[_0xa584('0x4b')][_0xa584('0x4c')]({'plain':!![]});if(!_0x4b2152)throw new Error(_0xa584('0x4d'));if(_0x4b2152[_0xa584('0x4e')]===_0xa584('0x4b')){var _0x4f7739=_0x266a7f[_0xa584('0x4c')]({'plain':!![]});var _0x4c9412='ChanSpies';return db['UserProfileSection'][_0xa584('0x49')]({'where':{'name':_0x4c9412,'userProfileId':_0x4b2152[_0xa584('0x4f')]},'raw':!![]})[_0xa584('0x26')](function(_0x1bc741){if(_0x1bc741&&_0x1bc741[_0xa584('0x50')]===0x0){return db[_0xa584('0x28')][_0xa584('0x4a')]({'name':_0x4f7739[_0xa584('0x29')],'resourceId':_0x4f7739['id'],'type':_0x1bc741[_0xa584('0x29')],'sectionId':_0x1bc741['id']},{})['then'](function(){return _0x266a7f;});}else{return _0x266a7f;}})[_0xa584('0x45')](function(_0x2e03fa){logger[_0xa584('0x51')](_0xa584('0x52'),_0x2e03fa);throw _0x2e03fa;});}return _0x266a7f;})['then'](respondWithResult(_0x5536c3,0xc9))['catch'](handleError(_0x5536c3,null));};exports['update']=function(_0x1a6338,_0x2c277e){if(_0x1a6338['body']['id']){delete _0x1a6338['body']['id'];}return db[_0xa584('0x40')]['find']({'where':{'id':_0x1a6338[_0xa584('0x47')]['id']}})[_0xa584('0x26')](handleEntityNotFound(_0x2c277e,null))[_0xa584('0x26')](saveUpdates(_0x1a6338[_0xa584('0x53')],null))[_0xa584('0x26')](respondWithResult(_0x2c277e,null))[_0xa584('0x45')](handleError(_0x2c277e,null));};exports[_0xa584('0x27')]=function(_0x50aae9,_0x3488bf){return db['VoiceChanSpy'][_0xa584('0x49')]({'where':{'id':_0x50aae9[_0xa584('0x47')]['id']}})[_0xa584('0x26')](handleEntityNotFound(_0x3488bf,null))['then'](removeEntity(_0x3488bf,null))[_0xa584('0x45')](handleError(_0x3488bf,null));}; \ No newline at end of file +var _0x9c2c=['moment','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','ChanSpies','UserProfileResource','error','stack','name','send','map','VoiceChanSpy','rawAttributes','fieldName','type','query','filters','intersection','model','fields','attributes','length','nolimit','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9c2c,0x1c0));var _0xc9c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c2c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc9c2('0x0'));var rimraf=require(_0xc9c2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc9c2('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xc9c2('0x3'));var util=require(_0xc9c2('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xc9c2('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc9c2('0x6'));var _=require(_0xc9c2('0x7'));var squel=require(_0xc9c2('0x8'));var crypto=require(_0xc9c2('0x9'));var jsforce=require(_0xc9c2('0xa'));var deskjs=require(_0xc9c2('0xb'));var toCsv=require(_0xc9c2('0x5'));var querystring=require(_0xc9c2('0xc'));var Papa=require(_0xc9c2('0xd'));var Redis=require('ioredis');var authService=require(_0xc9c2('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xc9c2('0xf'));var hardwareService=require(_0xc9c2('0x10'));var logger=require(_0xc9c2('0x11'))(_0xc9c2('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc9c2('0x13'));var db=require(_0xc9c2('0x14'))['db'];function respondWithStatusCode(_0x568f69,_0x7ec780){_0x7ec780=_0x7ec780||0xcc;return function(_0x1f08a7){if(_0x1f08a7){return _0x568f69[_0xc9c2('0x15')](_0x7ec780);}return _0x568f69[_0xc9c2('0x16')](_0x7ec780)[_0xc9c2('0x17')]();};}function respondWithResult(_0x3b0058,_0x33b288){_0x33b288=_0x33b288||0xc8;return function(_0x132702){if(_0x132702){return _0x3b0058[_0xc9c2('0x16')](_0x33b288)[_0xc9c2('0x18')](_0x132702);}};}function respondWithFilteredResult(_0xf94209,_0x383667){return function(_0x480d7c){if(_0x480d7c){var _0x27840d=typeof _0x383667[_0xc9c2('0x19')]===_0xc9c2('0x1a')&&typeof _0x383667[_0xc9c2('0x1b')]===_0xc9c2('0x1a');var _0x49413b=_0x480d7c[_0xc9c2('0x1c')];var _0x37c027=_0x27840d?0x0:_0x383667[_0xc9c2('0x19')];var _0x4e4ded=_0x27840d?_0x480d7c[_0xc9c2('0x1c')]:_0x383667[_0xc9c2('0x19')]+_0x383667[_0xc9c2('0x1b')];var _0x484ca3;if(_0x4e4ded>=_0x49413b){_0x4e4ded=_0x49413b;_0x484ca3=0xc8;}else{_0x484ca3=0xce;}_0xf94209[_0xc9c2('0x16')](_0x484ca3);return _0xf94209[_0xc9c2('0x1d')]('Content-Range',_0x37c027+'-'+_0x4e4ded+'/'+_0x49413b)['json'](_0x480d7c);}return null;};}function patchUpdates(_0x37e3){return function(_0x50f280){try{jsonpatch[_0xc9c2('0x1e')](_0x50f280,_0x37e3,!![]);}catch(_0x140c8a){return BPromise[_0xc9c2('0x1f')](_0x140c8a);}return _0x50f280[_0xc9c2('0x20')]();};}function saveUpdates(_0x3e1774,_0x53c460){return function(_0x1fbac4){if(_0x1fbac4){return _0x1fbac4[_0xc9c2('0x21')](_0x3e1774)[_0xc9c2('0x22')](function(_0x11cc07){return _0x11cc07;});}return null;};}function removeEntity(_0x32c372,_0x385030){return function(_0x56e515){if(_0x56e515){return _0x56e515[_0xc9c2('0x23')]()[_0xc9c2('0x22')](function(){var _0x5e47c2=_0x56e515[_0xc9c2('0x24')]({'plain':!![]});var _0x4b3b97=_0xc9c2('0x25');return db[_0xc9c2('0x26')][_0xc9c2('0x23')]({'where':{'type':_0x4b3b97,'resourceId':_0x5e47c2['id']}})[_0xc9c2('0x22')](function(){return _0x56e515;});})['then'](function(){_0x32c372[_0xc9c2('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fcaa3,_0x3bd8e8){return function(_0x41f3e8){if(!_0x41f3e8){_0x2fcaa3[_0xc9c2('0x15')](0x194);}return _0x41f3e8;};}function handleError(_0x2119c6,_0x4cf642){_0x4cf642=_0x4cf642||0x1f4;return function(_0x3cedb5){logger[_0xc9c2('0x27')](_0x3cedb5[_0xc9c2('0x28')]);if(_0x3cedb5[_0xc9c2('0x29')]){delete _0x3cedb5[_0xc9c2('0x29')];}_0x2119c6[_0xc9c2('0x16')](_0x4cf642)[_0xc9c2('0x2a')](_0x3cedb5);};}exports['index']=function(_0x55b9c6,_0x4a9fca){var _0x228971={},_0x17d174={},_0x49fcd3={'count':0x0,'rows':[]};var _0xefbf7a=_[_0xc9c2('0x2b')](db[_0xc9c2('0x2c')][_0xc9c2('0x2d')],function(_0x5ccb7a){return{'name':_0x5ccb7a[_0xc9c2('0x2e')],'type':_0x5ccb7a[_0xc9c2('0x2f')]['key']};});_0x17d174['model']=_[_0xc9c2('0x2b')](_0xefbf7a,_0xc9c2('0x29'));_0x17d174[_0xc9c2('0x30')]=_['keys'](_0x55b9c6['query']);_0x17d174[_0xc9c2('0x31')]=_[_0xc9c2('0x32')](_0x17d174['model'],_0x17d174[_0xc9c2('0x30')]);_0x228971['attributes']=_[_0xc9c2('0x32')](_0x17d174[_0xc9c2('0x33')],qs[_0xc9c2('0x34')](_0x55b9c6[_0xc9c2('0x30')][_0xc9c2('0x34')]));_0x228971[_0xc9c2('0x35')]=_0x228971[_0xc9c2('0x35')][_0xc9c2('0x36')]?_0x228971[_0xc9c2('0x35')]:_0x17d174['model'];if(!_0x55b9c6[_0xc9c2('0x30')]['hasOwnProperty'](_0xc9c2('0x37'))){_0x228971[_0xc9c2('0x1b')]=qs['limit'](_0x55b9c6[_0xc9c2('0x30')][_0xc9c2('0x1b')]);_0x228971['offset']=qs[_0xc9c2('0x19')](_0x55b9c6[_0xc9c2('0x30')][_0xc9c2('0x19')]);}_0x228971['order']=qs[_0xc9c2('0x38')](_0x55b9c6['query'][_0xc9c2('0x38')]);_0x228971[_0xc9c2('0x39')]=qs['filters'](_[_0xc9c2('0x3a')](_0x55b9c6[_0xc9c2('0x30')],_0x17d174[_0xc9c2('0x31')]),_0xefbf7a);if(_0x55b9c6[_0xc9c2('0x30')][_0xc9c2('0x3b')]){_0x228971[_0xc9c2('0x39')]=_[_0xc9c2('0x3c')](_0x228971[_0xc9c2('0x39')],{'$or':_[_0xc9c2('0x2b')](_0xefbf7a,function(_0x42b8ec){if(_0x42b8ec[_0xc9c2('0x2f')]!=='VIRTUAL'){var _0x4c3bc0={};_0x4c3bc0[_0x42b8ec[_0xc9c2('0x29')]]={'$like':'%'+_0x55b9c6[_0xc9c2('0x30')][_0xc9c2('0x3b')]+'%'};return _0x4c3bc0;}})});}_0x228971=_[_0xc9c2('0x3c')]({},_0x228971,_0x55b9c6[_0xc9c2('0x3d')]);var _0x394050={'where':_0x228971['where']};return db[_0xc9c2('0x2c')][_0xc9c2('0x1c')](_0x394050)[_0xc9c2('0x22')](function(_0x46c740){_0x49fcd3[_0xc9c2('0x1c')]=_0x46c740;if(_0x55b9c6['query'][_0xc9c2('0x3e')]){_0x228971[_0xc9c2('0x3f')]=[{'all':!![]}];}return db[_0xc9c2('0x2c')]['findAll'](_0x228971);})[_0xc9c2('0x22')](function(_0xd3d946){_0x49fcd3[_0xc9c2('0x40')]=_0xd3d946;return _0x49fcd3;})[_0xc9c2('0x22')](respondWithFilteredResult(_0x4a9fca,_0x228971))[_0xc9c2('0x41')](handleError(_0x4a9fca,null));};exports['show']=function(_0x54857b,_0x136dfb){var _0x75de3={'raw':![],'where':{'id':_0x54857b[_0xc9c2('0x42')]['id']}},_0x4df180={};_0x4df180[_0xc9c2('0x33')]=_[_0xc9c2('0x43')](db[_0xc9c2('0x2c')][_0xc9c2('0x2d')]);_0x4df180[_0xc9c2('0x30')]=_[_0xc9c2('0x43')](_0x54857b['query']);_0x4df180[_0xc9c2('0x31')]=_['intersection'](_0x4df180[_0xc9c2('0x33')],_0x4df180['query']);_0x75de3[_0xc9c2('0x35')]=_['intersection'](_0x4df180[_0xc9c2('0x33')],qs['fields'](_0x54857b[_0xc9c2('0x30')][_0xc9c2('0x34')]));_0x75de3[_0xc9c2('0x35')]=_0x75de3[_0xc9c2('0x35')][_0xc9c2('0x36')]?_0x75de3[_0xc9c2('0x35')]:_0x4df180[_0xc9c2('0x33')];if(_0x54857b['query'][_0xc9c2('0x3e')]){_0x75de3[_0xc9c2('0x3f')]=[{'all':!![]}];}_0x75de3=_[_0xc9c2('0x3c')]({},_0x75de3,_0x54857b[_0xc9c2('0x3d')]);return db[_0xc9c2('0x2c')][_0xc9c2('0x44')](_0x75de3)['then'](handleEntityNotFound(_0x136dfb,null))[_0xc9c2('0x22')](respondWithResult(_0x136dfb,null))[_0xc9c2('0x41')](handleError(_0x136dfb,null));};exports[_0xc9c2('0x45')]=function(_0x88fa84,_0x2e9925){return db[_0xc9c2('0x2c')][_0xc9c2('0x45')](_0x88fa84[_0xc9c2('0x46')],{})['then'](function(_0x44d1bb){var _0x7aff01=_0x88fa84[_0xc9c2('0x47')][_0xc9c2('0x24')]({'plain':!![]});if(!_0x7aff01)throw new Error(_0xc9c2('0x48'));if(_0x7aff01['role']===_0xc9c2('0x47')){var _0x4e2589=_0x44d1bb[_0xc9c2('0x24')]({'plain':!![]});var _0x5c8933=_0xc9c2('0x25');return db['UserProfileSection'][_0xc9c2('0x44')]({'where':{'name':_0x5c8933,'userProfileId':_0x7aff01['userProfileId']},'raw':!![]})['then'](function(_0x13bcbd){if(_0x13bcbd&&_0x13bcbd[_0xc9c2('0x49')]===0x0){return db[_0xc9c2('0x26')][_0xc9c2('0x45')]({'name':_0x4e2589[_0xc9c2('0x29')],'resourceId':_0x4e2589['id'],'type':_0x13bcbd[_0xc9c2('0x29')],'sectionId':_0x13bcbd['id']},{})[_0xc9c2('0x22')](function(){return _0x44d1bb;});}else{return _0x44d1bb;}})[_0xc9c2('0x41')](function(_0x3f8fce){logger[_0xc9c2('0x27')](_0xc9c2('0x4a'),_0x3f8fce);throw _0x3f8fce;});}return _0x44d1bb;})['then'](respondWithResult(_0x2e9925,0xc9))[_0xc9c2('0x41')](handleError(_0x2e9925,null));};exports[_0xc9c2('0x21')]=function(_0x568de4,_0x8a840){if(_0x568de4[_0xc9c2('0x46')]['id']){delete _0x568de4[_0xc9c2('0x46')]['id'];}return db['VoiceChanSpy']['find']({'where':{'id':_0x568de4[_0xc9c2('0x42')]['id']}})[_0xc9c2('0x22')](handleEntityNotFound(_0x8a840,null))[_0xc9c2('0x22')](saveUpdates(_0x568de4[_0xc9c2('0x46')],null))[_0xc9c2('0x22')](respondWithResult(_0x8a840,null))[_0xc9c2('0x41')](handleError(_0x8a840,null));};exports[_0xc9c2('0x23')]=function(_0x42905b,_0x158632){return db[_0xc9c2('0x2c')][_0xc9c2('0x44')]({'where':{'id':_0x42905b[_0xc9c2('0x42')]['id']}})[_0xc9c2('0x22')](handleEntityNotFound(_0x158632,null))[_0xc9c2('0x22')](removeEntity(_0x158632,null))[_0xc9c2('0x41')](handleError(_0x158632,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index b2df948..3010119 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 _0x2b65=['models','define','VoiceChanSpy','voice_chanspy','length','VoiceExtension','bulkCreate','destroy','lodash','./voiceChanSpy.attributes','context','format','%s%s','prefix','system','push','merge','Set','CDR(type)=%s','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','name','record','StopMixMonitor','internal','concat','then','catch'];(function(_0x55d451,_0x105b63){var _0x53dc14=function(_0x4929c0){while(--_0x4929c0){_0x55d451['push'](_0x55d451['shift']());}};_0x53dc14(++_0x105b63);}(_0x2b65,0x128));var _0x52b6=function(_0x5941f9,_0x1261f1){_0x5941f9=_0x5941f9-0x0;var _0xbdc9f9=_0x2b65[_0x5941f9];return _0xbdc9f9;};'use strict';var _=require(_0x52b6('0x0'));var util=require('util');var BPromise=require('bluebird');var attributes=require(_0x52b6('0x1'));var getUserApplications=function(_0x3bf83c,_0x16be9a,_0x2e2bb5){var _0x446e25=0x1;var _0x36dd22=[];var _0x383b1f={'context':_0x16be9a[_0x52b6('0x2')]||'from-sip','exten':util[_0x52b6('0x3')](_0x52b6('0x4'),_0x3bf83c[_0x52b6('0x5')],_0x2e2bb5),'type':_0x52b6('0x6'),'isApp':![],'ChanSpyId':_0x3bf83c['id'],'UserId':_0x16be9a['id']};_0x36dd22[_0x52b6('0x7')](_[_0x52b6('0x8')]({'app':_0x52b6('0x9'),'appdata':util[_0x52b6('0x3')](_0x52b6('0xa'),'chanspy'),'priority':_0x446e25++},_0x383b1f));if(_0x3bf83c['record']){_0x36dd22[_0x52b6('0x7')](_[_0x52b6('0x8')]({'app':'MixMonitor','appdata':util['format'](_0x52b6('0xb'),_0x3bf83c[_0x52b6('0xc')]),'priority':_0x446e25++},_0x383b1f));}if(_0x3bf83c[_0x52b6('0xd')]){_0x36dd22[_0x52b6('0x7')](_[_0x52b6('0x8')]({'app':_0x52b6('0xe'),'appdata':_0x3bf83c[_0x52b6('0xf')],'priority':_0x446e25++},_0x383b1f));}_0x36dd22[_0x52b6('0x7')](_['merge']({'app':_0x52b6('0x10'),'appdata':util['format']('SIP/%s,%s',_0x16be9a[_0x52b6('0x11')],_0x3bf83c['options']?_0x3bf83c['options']['join'](''):''),'priority':_0x446e25++},_0x383b1f));if(_0x3bf83c[_0x52b6('0x12')]){_0x36dd22[_0x52b6('0x7')](_[_0x52b6('0x8')]({'app':_0x52b6('0x13'),'priority':_0x446e25++},_0x383b1f));}return _0x36dd22;};var getChanSpyApplications=function(_0x20e097,_0x58bab8){var _0x4c0c5f=[];for(var _0xbf942c=0x0,_0x5779e4=0x1;_0xbf942c<_0x58bab8['length'];_0xbf942c++,_0x5779e4=0x1){_0x4c0c5f=_0x4c0c5f['concat'](getUserApplications(_0x20e097,_0x58bab8[_0xbf942c],_0x58bab8[_0xbf942c][_0x52b6('0x14')]));if(_0x58bab8[_0xbf942c][_0x52b6('0x14')]!=_0x58bab8[_0xbf942c]['name']){_0x4c0c5f=_0x4c0c5f[_0x52b6('0x15')](getUserApplications(_0x20e097,_0x58bab8[_0xbf942c],_0x58bab8[_0xbf942c][_0x52b6('0x11')]));}}return _0x4c0c5f;};var getChanSpyPromise=function(_0x1bd68a,_0x6017c1){return new BPromise(function(_0x529a09,_0x2aae1d){return _0x1bd68a['User']['findAll']({'attributes':['id',_0x52b6('0x11'),_0x52b6('0x14')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0x52b6('0x16')](function(_0x21c67a){if(_0x21c67a){return _0x529a09(getChanSpyApplications(_0x6017c1,_0x21c67a));}return _0x529a09([]);})[_0x52b6('0x17')](function(_0xb0d0c){_0x2aae1d(_0xb0d0c);});});};module['exports']=function(_0x2c3728,_0x5135f7){var _0x434945=_0x2c3728[_0x52b6('0x18')];return _0x2c3728[_0x52b6('0x19')](_0x52b6('0x1a'),attributes,{'tableName':_0x52b6('0x1b'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4411a1,_0x51e1a3,_0xe962af){return getChanSpyPromise(_0x434945,_0x4411a1)['then'](function(_0x1f078d){if(_0x1f078d&&_0x1f078d[_0x52b6('0x1c')]){return _0x434945[_0x52b6('0x1d')][_0x52b6('0x1e')](_0x1f078d);}})['then'](function(){_0xe962af();})[_0x52b6('0x17')](function(_0x3e5f69){_0xe962af(_0x3e5f69);});},'afterUpdate':function(_0x56b617,_0x27f082,_0x3a0143){return _0x434945['VoiceExtension'][_0x52b6('0x1f')]({'where':{'ChanSpyId':_0x56b617['id']}})['then'](function(){return getChanSpyPromise(_0x434945,_0x56b617);})['then'](function(_0x3b6e39){if(_0x3b6e39&&_0x3b6e39[_0x52b6('0x1c')]){return _0x434945[_0x52b6('0x1d')][_0x52b6('0x1e')](_0x3b6e39);}})['then'](function(){_0x3a0143();})['catch'](function(_0x50837e){_0x3a0143(_0x50837e);});},'afterDestroy':function(_0x19d043,_0x3829f4,_0x5dfb07){return _0x434945[_0x52b6('0x1d')][_0x52b6('0x1f')]({'where':{'ChanSpyId':_0x19d043['id']}})['then'](function(){_0x5dfb07();})[_0x52b6('0x17')](function(_0x31d8e5){_0x5dfb07(_0x31d8e5);});}}});}; \ No newline at end of file +var _0xf83b=['bluebird','context','from-sip','%s%s','Set','format','CDR(type)=%s','chanspy','record','push','merge','MixMonitor','recordingFormat','Authenticate','password','SIP/%s,%s','name','options','join','concat','internal','User','findAll','agent','then','catch','VoiceChanSpy','voice_chanspy','length','bulkCreate','VoiceExtension','destroy','lodash'];(function(_0x15b344,_0x3dcb66){var _0x37022c=function(_0xfa6558){while(--_0xfa6558){_0x15b344['push'](_0x15b344['shift']());}};_0x37022c(++_0x3dcb66);}(_0xf83b,0xe6));var _0xbf83=function(_0x19d347,_0x4da4cc){_0x19d347=_0x19d347-0x0;var _0x286d56=_0xf83b[_0x19d347];return _0x286d56;};'use strict';var _=require(_0xbf83('0x0'));var util=require('util');var BPromise=require(_0xbf83('0x1'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x175b1d,_0x320bf1,_0x531da8){var _0x1adc51=0x1;var _0x17acdf=[];var _0x114d11={'context':_0x320bf1[_0xbf83('0x2')]||_0xbf83('0x3'),'exten':util['format'](_0xbf83('0x4'),_0x175b1d['prefix'],_0x531da8),'type':'system','isApp':![],'ChanSpyId':_0x175b1d['id'],'UserId':_0x320bf1['id']};_0x17acdf['push'](_['merge']({'app':_0xbf83('0x5'),'appdata':util[_0xbf83('0x6')](_0xbf83('0x7'),_0xbf83('0x8')),'priority':_0x1adc51++},_0x114d11));if(_0x175b1d[_0xbf83('0x9')]){_0x17acdf[_0xbf83('0xa')](_[_0xbf83('0xb')]({'app':_0xbf83('0xc'),'appdata':util[_0xbf83('0x6')]('${UNIQUEID}.%s,a',_0x175b1d[_0xbf83('0xd')]),'priority':_0x1adc51++},_0x114d11));}if(_0x175b1d['auth']){_0x17acdf[_0xbf83('0xa')](_[_0xbf83('0xb')]({'app':_0xbf83('0xe'),'appdata':_0x175b1d[_0xbf83('0xf')],'priority':_0x1adc51++},_0x114d11));}_0x17acdf[_0xbf83('0xa')](_['merge']({'app':'ChanSpy','appdata':util[_0xbf83('0x6')](_0xbf83('0x10'),_0x320bf1[_0xbf83('0x11')],_0x175b1d[_0xbf83('0x12')]?_0x175b1d['options'][_0xbf83('0x13')](''):''),'priority':_0x1adc51++},_0x114d11));if(_0x175b1d[_0xbf83('0x9')]){_0x17acdf['push'](_['merge']({'app':'StopMixMonitor','priority':_0x1adc51++},_0x114d11));}return _0x17acdf;};var getChanSpyApplications=function(_0x48408e,_0x573983){var _0x398611=[];for(var _0x1c3e18=0x0,_0x35cda5=0x1;_0x1c3e18<_0x573983['length'];_0x1c3e18++,_0x35cda5=0x1){_0x398611=_0x398611[_0xbf83('0x14')](getUserApplications(_0x48408e,_0x573983[_0x1c3e18],_0x573983[_0x1c3e18][_0xbf83('0x15')]));if(_0x573983[_0x1c3e18]['internal']!=_0x573983[_0x1c3e18][_0xbf83('0x11')]){_0x398611=_0x398611['concat'](getUserApplications(_0x48408e,_0x573983[_0x1c3e18],_0x573983[_0x1c3e18][_0xbf83('0x11')]));}}return _0x398611;};var getChanSpyPromise=function(_0x14c68c,_0x196a9d){return new BPromise(function(_0x23fdb8,_0x2c13ad){return _0x14c68c[_0xbf83('0x16')][_0xbf83('0x17')]({'attributes':['id','name',_0xbf83('0x15')],'where':{'role':_0xbf83('0x18'),'chanspy':!![]},'raw':!![]})[_0xbf83('0x19')](function(_0x288f2b){if(_0x288f2b){return _0x23fdb8(getChanSpyApplications(_0x196a9d,_0x288f2b));}return _0x23fdb8([]);})[_0xbf83('0x1a')](function(_0x33bde9){_0x2c13ad(_0x33bde9);});});};module['exports']=function(_0x58e14f,_0x5f851a){var _0x48db78=_0x58e14f['models'];return _0x58e14f['define'](_0xbf83('0x1b'),attributes,{'tableName':_0xbf83('0x1c'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4f0c15,_0x10c607,_0x443897){return getChanSpyPromise(_0x48db78,_0x4f0c15)['then'](function(_0x3346cb){if(_0x3346cb&&_0x3346cb[_0xbf83('0x1d')]){return _0x48db78['VoiceExtension'][_0xbf83('0x1e')](_0x3346cb);}})['then'](function(){_0x443897();})['catch'](function(_0x31fb8a){_0x443897(_0x31fb8a);});},'afterUpdate':function(_0x4e0ba2,_0x4bb9be,_0x2d98d7){return _0x48db78[_0xbf83('0x1f')]['destroy']({'where':{'ChanSpyId':_0x4e0ba2['id']}})[_0xbf83('0x19')](function(){return getChanSpyPromise(_0x48db78,_0x4e0ba2);})[_0xbf83('0x19')](function(_0x2f69ff){if(_0x2f69ff&&_0x2f69ff['length']){return _0x48db78[_0xbf83('0x1f')]['bulkCreate'](_0x2f69ff);}})[_0xbf83('0x19')](function(){_0x2d98d7();})[_0xbf83('0x1a')](function(_0x56a482){_0x2d98d7(_0x56a482);});},'afterDestroy':function(_0x35218b,_0x2deb67,_0x544c57){return _0x48db78['VoiceExtension'][_0xbf83('0x20')]({'where':{'ChanSpyId':_0x35218b['id']}})['then'](function(){_0x544c57();})[_0xbf83('0x1a')](function(_0x212663){_0x544c57(_0x212663);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index b29b7d2..4914f5c 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 _0xa902=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x26b80e,_0x5c9333){var _0x84a8a8=function(_0x2e5b4a){while(--_0x2e5b4a){_0x26b80e['push'](_0x26b80e['shift']());}};_0x84a8a8(++_0x5c9333);}(_0xa902,0x8d));var _0x2a90=function(_0x505cbb,_0x18297a){_0x505cbb=_0x505cbb-0x0;var _0x8e86b2=_0xa902[_0x505cbb];return _0x8e86b2;};'use strict';var _=require(_0x2a90('0x0'));var util=require(_0x2a90('0x1'));var moment=require(_0x2a90('0x2'));var BPromise=require(_0x2a90('0x3'));var rs=require(_0x2a90('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2a90('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2a90('0x6'));var config=require(_0x2a90('0x7'));var jayson=require(_0x2a90('0x8'));var client=jayson[_0x2a90('0x9')][_0x2a90('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25bcfc,_0x58369a,_0x4109e6){return new BPromise(function(_0x570659,_0x5ec2b9){return client[_0x2a90('0xb')](_0x25bcfc,_0x4109e6)[_0x2a90('0xc')](function(_0xe500bc){logger[_0x2a90('0xd')](_0x2a90('0xe'),_0x58369a,'request\x20sent');logger[_0x2a90('0xf')](_0x2a90('0x10'),_0x58369a,_0x2a90('0x11'),JSON[_0x2a90('0x12')](_0xe500bc));if(_0xe500bc['error']){if(_0xe500bc[_0x2a90('0x13')]['code']===0x1f4){logger[_0x2a90('0x13')]('VoiceChanSpy,\x20%s,\x20%s',_0x58369a,_0xe500bc[_0x2a90('0x13')]['message']);return _0x5ec2b9(_0xe500bc[_0x2a90('0x13')][_0x2a90('0x14')]);}logger[_0x2a90('0x13')]('VoiceChanSpy,\x20%s,\x20%s',_0x58369a,_0xe500bc['error']['message']);return _0x570659(_0xe500bc[_0x2a90('0x13')][_0x2a90('0x14')]);}else{logger['info'](_0x2a90('0xe'),_0x58369a,_0x2a90('0x11'));_0x570659(_0xe500bc[_0x2a90('0x15')][_0x2a90('0x14')]);}})[_0x2a90('0x16')](function(_0x37858e){logger[_0x2a90('0x13')](_0x2a90('0xe'),_0x58369a,_0x37858e);_0x5ec2b9(_0x37858e);});});} \ No newline at end of file +var _0xa25c=['message','VoiceChanSpy,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','info','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x579daf,_0x2f946e){var _0x46078f=function(_0x11282c){while(--_0x11282c){_0x579daf['push'](_0x579daf['shift']());}};_0x46078f(++_0x2f946e);}(_0xa25c,0x13f));var _0xca25=function(_0x383f90,_0x42edf5){_0x383f90=_0x383f90-0x0;var _0x101752=_0xa25c[_0x383f90];return _0x101752;};'use strict';var _=require('lodash');var util=require(_0xca25('0x0'));var moment=require(_0xca25('0x1'));var BPromise=require(_0xca25('0x2'));var rs=require(_0xca25('0x3'));var fs=require('fs');var Redis=require(_0xca25('0x4'));var db=require(_0xca25('0x5'))['db'];var utils=require(_0xca25('0x6'));var logger=require(_0xca25('0x7'))('rpc');var config=require(_0xca25('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xca25('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e9352,_0xb2fc94,_0x3cee89){return new BPromise(function(_0x2c0b8c,_0x42a97a){return client[_0xca25('0xa')](_0x4e9352,_0x3cee89)['then'](function(_0x5d820c){logger[_0xca25('0xb')]('VoiceChanSpy,\x20%s,\x20%s',_0xb2fc94,_0xca25('0xc'));logger[_0xca25('0xd')](_0xca25('0xe'),_0xb2fc94,'request\x20sent',JSON['stringify'](_0x5d820c));if(_0x5d820c['error']){if(_0x5d820c[_0xca25('0xf')][_0xca25('0x10')]===0x1f4){logger[_0xca25('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0xb2fc94,_0x5d820c['error'][_0xca25('0x11')]);return _0x42a97a(_0x5d820c['error'][_0xca25('0x11')]);}logger[_0xca25('0xf')](_0xca25('0x12'),_0xb2fc94,_0x5d820c[_0xca25('0xf')][_0xca25('0x11')]);return _0x2c0b8c(_0x5d820c[_0xca25('0xf')][_0xca25('0x11')]);}else{logger[_0xca25('0xb')](_0xca25('0x12'),_0xb2fc94,_0xca25('0xc'));_0x2c0b8c(_0x5d820c[_0xca25('0x13')]['message']);}})[_0xca25('0x14')](function(_0x340c9b){logger['error'](_0xca25('0x12'),_0xb2fc94,_0x340c9b);_0x42a97a(_0x340c9b);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 1b4260c..dbebc42 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 _0x90c8=['post','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceContext.controller','isAuthenticated','index','get','/:id','show'];(function(_0xe2e6f1,_0x5d363f){var _0x18c4ea=function(_0x1542b7){while(--_0x1542b7){_0xe2e6f1['push'](_0xe2e6f1['shift']());}};_0x18c4ea(++_0x5d363f);}(_0x90c8,0xe2));var _0x890c=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x90c8[_0x11005e];return _0x29338f;};'use strict';var multer=require('multer');var util=require(_0x890c('0x0'));var path=require(_0x890c('0x1'));var timeout=require(_0x890c('0x2'));var express=require(_0x890c('0x3'));var router=express[_0x890c('0x4')]();var fs_extra=require(_0x890c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x890c('0x6'));var config=require(_0x890c('0x7'));var controller=require(_0x890c('0x8'));router['get']('/',auth[_0x890c('0x9')](),controller[_0x890c('0xa')]);router[_0x890c('0xb')](_0x890c('0xc'),auth['isAuthenticated'](),controller[_0x890c('0xd')]);router[_0x890c('0xe')]('/',auth[_0x890c('0x9')](),controller[_0x890c('0xf')]);router[_0x890c('0x10')](_0x890c('0xc'),auth[_0x890c('0x9')](),controller['update']);router[_0x890c('0x11')](_0x890c('0xc'),auth[_0x890c('0x9')](),controller[_0x890c('0x12')]);module[_0x890c('0x13')]=router; \ No newline at end of file +var _0x8513=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','put','update','delete','multer','util'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x8513,0x12e));var _0x3851=function(_0x9c31b0,_0x448ee5){_0x9c31b0=_0x9c31b0-0x0;var _0x3113bd=_0x8513[_0x9c31b0];return _0x3113bd;};'use strict';var multer=require(_0x3851('0x0'));var util=require(_0x3851('0x1'));var path=require(_0x3851('0x2'));var timeout=require(_0x3851('0x3'));var express=require(_0x3851('0x4'));var router=express[_0x3851('0x5')]();var fs_extra=require(_0x3851('0x6'));var auth=require(_0x3851('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x3851('0x8'));var controller=require('./voiceContext.controller');router[_0x3851('0x9')]('/',auth['isAuthenticated'](),controller[_0x3851('0xa')]);router[_0x3851('0x9')](_0x3851('0xb'),auth[_0x3851('0xc')](),controller['show']);router['post']('/',auth[_0x3851('0xc')](),controller['create']);router[_0x3851('0xd')](_0x3851('0xb'),auth['isAuthenticated'](),controller[_0x3851('0xe')]);router[_0x3851('0xf')](_0x3851('0xb'),auth['isAuthenticated'](),controller['destroy']);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 af3d87a..5674ac4 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 _0xe40a=['exports','STRING','name','BOOLEAN','sequelize'];(function(_0x3f65b6,_0x8acdd){var _0x3d0710=function(_0x1e6ed9){while(--_0x1e6ed9){_0x3f65b6['push'](_0x3f65b6['shift']());}};_0x3d0710(++_0x8acdd);}(_0xe40a,0xc2));var _0xae40=function(_0x52a4c7,_0x46cf13){_0x52a4c7=_0x52a4c7-0x0;var _0x1f8958=_0xe40a[_0x52a4c7];return _0x1f8958;};'use strict';var Sequelize=require(_0xae40('0x0'));module[_0xae40('0x1')]={'name':{'type':Sequelize[_0xae40('0x2')],'unique':_0xae40('0x3')},'description':{'type':Sequelize[_0xae40('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xae40('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8ae8=['name','BOOLEAN','sequelize','STRING'];(function(_0x336b65,_0x3f857a){var _0xb8017f=function(_0x332113){while(--_0x332113){_0x336b65['push'](_0x336b65['shift']());}};_0xb8017f(++_0x3f857a);}(_0x8ae8,0xd2));var _0x88ae=function(_0x553145,_0x4f9ab8){_0x553145=_0x553145-0x0;var _0x11cfbd=_0x8ae8[_0x553145];return _0x11cfbd;};'use strict';var Sequelize=require(_0x88ae('0x0'));module['exports']={'name':{'type':Sequelize[_0x88ae('0x1')],'unique':_0x88ae('0x2')},'description':{'type':Sequelize[_0x88ae('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x88ae('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 97a092c..49f9fd5 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 _0xec89=['status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','get','Contexts','UserProfileResource','stack','name','index','map','VoiceContext','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','Reload','eml-format','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus'];(function(_0x1d3046,_0x8b14e1){var _0x3b9b62=function(_0xb69d69){while(--_0xb69d69){_0x1d3046['push'](_0x1d3046['shift']());}};_0x3b9b62(++_0x8b14e1);}(_0xec89,0x173));var _0x9ec8=function(_0x343f03,_0x4561b4){_0x343f03=_0x343f03-0x0;var _0x372473=_0xec89[_0x343f03];return _0x372473;};'use strict';var emlformat=require(_0x9ec8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9ec8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9ec8('0x2'));var moment=require(_0x9ec8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9ec8('0x4'));var util=require(_0x9ec8('0x5'));var path=require(_0x9ec8('0x6'));var sox=require('sox');var csv=require(_0x9ec8('0x7'));var ejs=require(_0x9ec8('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9ec8('0x9'));var squel=require(_0x9ec8('0xa'));var crypto=require(_0x9ec8('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9ec8('0xc'));var toCsv=require(_0x9ec8('0x7'));var querystring=require(_0x9ec8('0xd'));var Papa=require(_0x9ec8('0xe'));var Redis=require(_0x9ec8('0xf'));var authService=require(_0x9ec8('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9ec8('0x11'));var hardwareService=require(_0x9ec8('0x12'));var logger=require(_0x9ec8('0x13'))(_0x9ec8('0x14'));var utils=require('../../config/utils');var config=require(_0x9ec8('0x15'));var licenseUtil=require(_0x9ec8('0x16'));var db=require(_0x9ec8('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x9ec8('0x18')][_0x9ec8('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x396df8,_0x55b2be,_0x2c0b1f,_0x4343c6){return new BPromise(function(_0x461494,_0x41d27a){var _0x26b768=_0x4343c6||client;return _0x26b768[_0x9ec8('0x1a')](_0x396df8,_0x2c0b1f)[_0x9ec8('0x1b')](function(_0x262b75){logger[_0x9ec8('0x1c')](_0x9ec8('0x1d'),_0x55b2be,'request\x20sent');logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x55b2be,_0x9ec8('0x1e'),JSON[_0x9ec8('0x1f')](_0x262b75));if(_0x262b75[_0x9ec8('0x20')]){if(_0x262b75[_0x9ec8('0x20')]['code']===0x1f4){logger[_0x9ec8('0x20')]('VoiceContext,\x20%s,\x20%s',_0x55b2be,_0x262b75[_0x9ec8('0x20')][_0x9ec8('0x21')]);return _0x41d27a(_0x262b75[_0x9ec8('0x20')][_0x9ec8('0x21')]);}logger[_0x9ec8('0x20')](_0x9ec8('0x1d'),_0x55b2be,_0x262b75[_0x9ec8('0x20')]['message']);return _0x461494(_0x262b75[_0x9ec8('0x20')][_0x9ec8('0x21')]);}else{logger[_0x9ec8('0x1c')](_0x9ec8('0x1d'),_0x55b2be,_0x9ec8('0x1e'));_0x461494(_0x262b75[_0x9ec8('0x22')]['message']);}})[_0x9ec8('0x23')](function(_0x3044cf){logger[_0x9ec8('0x20')](_0x9ec8('0x1d'),_0x55b2be,_0x3044cf);_0x41d27a(_0x3044cf);});});}function respondWithStatusCode(_0x1ec090,_0x1e69d6){_0x1e69d6=_0x1e69d6||0xcc;return function(_0xd0cef7){if(_0xd0cef7){return _0x1ec090[_0x9ec8('0x24')](_0x1e69d6);}return _0x1ec090[_0x9ec8('0x25')](_0x1e69d6)[_0x9ec8('0x26')]();};}function respondWithResult(_0x511531,_0x531112){_0x531112=_0x531112||0xc8;return function(_0x1dbd2d){if(_0x1dbd2d){return _0x511531['status'](_0x531112)[_0x9ec8('0x27')](_0x1dbd2d);}};}function respondWithFilteredResult(_0x169fd1,_0x33a4bb){return function(_0x38cb6c){if(_0x38cb6c){var _0x4d8fc8=typeof _0x33a4bb[_0x9ec8('0x28')]===_0x9ec8('0x29')&&typeof _0x33a4bb['limit']===_0x9ec8('0x29');var _0xaba411=_0x38cb6c[_0x9ec8('0x2a')];var _0x1e6779=_0x4d8fc8?0x0:_0x33a4bb[_0x9ec8('0x28')];var _0x136b8c=_0x4d8fc8?_0x38cb6c[_0x9ec8('0x2a')]:_0x33a4bb[_0x9ec8('0x28')]+_0x33a4bb[_0x9ec8('0x2b')];var _0x8c460e;if(_0x136b8c>=_0xaba411){_0x136b8c=_0xaba411;_0x8c460e=0xc8;}else{_0x8c460e=0xce;}_0x169fd1[_0x9ec8('0x25')](_0x8c460e);return _0x169fd1[_0x9ec8('0x2c')](_0x9ec8('0x2d'),_0x1e6779+'-'+_0x136b8c+'/'+_0xaba411)['json'](_0x38cb6c);}return null;};}function patchUpdates(_0x7fc86e){return function(_0x48e4f4){try{jsonpatch[_0x9ec8('0x2e')](_0x48e4f4,_0x7fc86e,!![]);}catch(_0x3eabaf){return BPromise['reject'](_0x3eabaf);}return _0x48e4f4[_0x9ec8('0x2f')]();};}function saveUpdates(_0x1a9a46,_0xd01f5d){return function(_0xb06e92){if(_0xb06e92){return _0xb06e92[_0x9ec8('0x30')](_0x1a9a46)[_0x9ec8('0x1b')](function(_0x274175){return _0x274175;});}return null;};}function removeEntity(_0x1e9665,_0x5b3263){return function(_0x54828a){if(_0x54828a){return _0x54828a[_0x9ec8('0x31')]()[_0x9ec8('0x1b')](function(){var _0x23a3eb=_0x54828a[_0x9ec8('0x32')]({'plain':!![]});var _0x532877=_0x9ec8('0x33');return db[_0x9ec8('0x34')][_0x9ec8('0x31')]({'where':{'type':_0x532877,'resourceId':_0x23a3eb['id']}})['then'](function(){return _0x54828a;});})[_0x9ec8('0x1b')](function(){_0x1e9665[_0x9ec8('0x25')](0xcc)[_0x9ec8('0x26')]();});}};}function handleEntityNotFound(_0x3c5baf,_0x2cf10d){return function(_0x48e904){if(!_0x48e904){_0x3c5baf[_0x9ec8('0x24')](0x194);}return _0x48e904;};}function handleError(_0x34b01b,_0x5ef8eb){_0x5ef8eb=_0x5ef8eb||0x1f4;return function(_0x236e59){logger[_0x9ec8('0x20')](_0x236e59[_0x9ec8('0x35')]);if(_0x236e59[_0x9ec8('0x36')]){delete _0x236e59[_0x9ec8('0x36')];}_0x34b01b[_0x9ec8('0x25')](_0x5ef8eb)['send'](_0x236e59);};}exports[_0x9ec8('0x37')]=function(_0x3062f4,_0x1ee07b){var _0x25f755={},_0x48f9eb={},_0x25ac30={'count':0x0,'rows':[]};var _0x2fdaba=_[_0x9ec8('0x38')](db[_0x9ec8('0x39')]['rawAttributes'],function(_0x523e1e){return{'name':_0x523e1e['fieldName'],'type':_0x523e1e[_0x9ec8('0x3a')][_0x9ec8('0x3b')]};});_0x48f9eb['model']=_[_0x9ec8('0x38')](_0x2fdaba,'name');_0x48f9eb[_0x9ec8('0x3c')]=_[_0x9ec8('0x3d')](_0x3062f4[_0x9ec8('0x3c')]);_0x48f9eb[_0x9ec8('0x3e')]=_[_0x9ec8('0x3f')](_0x48f9eb[_0x9ec8('0x40')],_0x48f9eb[_0x9ec8('0x3c')]);_0x25f755[_0x9ec8('0x41')]=_[_0x9ec8('0x3f')](_0x48f9eb[_0x9ec8('0x40')],qs[_0x9ec8('0x42')](_0x3062f4[_0x9ec8('0x3c')][_0x9ec8('0x42')]));_0x25f755[_0x9ec8('0x41')]=_0x25f755[_0x9ec8('0x41')][_0x9ec8('0x43')]?_0x25f755[_0x9ec8('0x41')]:_0x48f9eb[_0x9ec8('0x40')];if(!_0x3062f4['query'][_0x9ec8('0x44')](_0x9ec8('0x45'))){_0x25f755['limit']=qs[_0x9ec8('0x2b')](_0x3062f4[_0x9ec8('0x3c')][_0x9ec8('0x2b')]);_0x25f755[_0x9ec8('0x28')]=qs[_0x9ec8('0x28')](_0x3062f4['query'][_0x9ec8('0x28')]);}_0x25f755['order']=qs[_0x9ec8('0x46')](_0x3062f4['query'][_0x9ec8('0x46')]);_0x25f755[_0x9ec8('0x47')]=qs[_0x9ec8('0x3e')](_['pick'](_0x3062f4[_0x9ec8('0x3c')],_0x48f9eb[_0x9ec8('0x3e')]),_0x2fdaba);if(_0x3062f4[_0x9ec8('0x3c')][_0x9ec8('0x48')]){_0x25f755[_0x9ec8('0x47')]=_[_0x9ec8('0x49')](_0x25f755[_0x9ec8('0x47')],{'$or':_[_0x9ec8('0x38')](_0x2fdaba,function(_0x2a84cf){if(_0x2a84cf['type']!==_0x9ec8('0x4a')){var _0x18ae8f={};_0x18ae8f[_0x2a84cf[_0x9ec8('0x36')]]={'$like':'%'+_0x3062f4['query']['filter']+'%'};return _0x18ae8f;}})});}_0x25f755=_[_0x9ec8('0x49')]({},_0x25f755,_0x3062f4[_0x9ec8('0x4b')]);var _0x551840={'where':_0x25f755['where']};return db[_0x9ec8('0x39')][_0x9ec8('0x2a')](_0x551840)[_0x9ec8('0x1b')](function(_0x2551b2){_0x25ac30[_0x9ec8('0x2a')]=_0x2551b2;if(_0x3062f4['query'][_0x9ec8('0x4c')]){_0x25f755[_0x9ec8('0x4d')]=[{'all':!![]}];}return db['VoiceContext'][_0x9ec8('0x4e')](_0x25f755);})[_0x9ec8('0x1b')](function(_0x4d7741){_0x25ac30[_0x9ec8('0x4f')]=_0x4d7741;return _0x25ac30;})['then'](respondWithFilteredResult(_0x1ee07b,_0x25f755))[_0x9ec8('0x23')](handleError(_0x1ee07b,null));};exports[_0x9ec8('0x50')]=function(_0x696817,_0x3a7946){var _0x20fcbd={'raw':![],'where':{'id':_0x696817[_0x9ec8('0x51')]['id']}},_0x483c4a={};_0x483c4a[_0x9ec8('0x40')]=_['keys'](db['VoiceContext'][_0x9ec8('0x52')]);_0x483c4a[_0x9ec8('0x3c')]=_[_0x9ec8('0x3d')](_0x696817[_0x9ec8('0x3c')]);_0x483c4a[_0x9ec8('0x3e')]=_['intersection'](_0x483c4a[_0x9ec8('0x40')],_0x483c4a[_0x9ec8('0x3c')]);_0x20fcbd['attributes']=_[_0x9ec8('0x3f')](_0x483c4a['model'],qs['fields'](_0x696817[_0x9ec8('0x3c')][_0x9ec8('0x42')]));_0x20fcbd[_0x9ec8('0x41')]=_0x20fcbd[_0x9ec8('0x41')][_0x9ec8('0x43')]?_0x20fcbd[_0x9ec8('0x41')]:_0x483c4a[_0x9ec8('0x40')];if(_0x696817[_0x9ec8('0x3c')][_0x9ec8('0x4c')]){_0x20fcbd[_0x9ec8('0x4d')]=[{'all':!![]}];}_0x20fcbd=_[_0x9ec8('0x49')]({},_0x20fcbd,_0x696817[_0x9ec8('0x4b')]);return db[_0x9ec8('0x39')]['find'](_0x20fcbd)[_0x9ec8('0x1b')](handleEntityNotFound(_0x3a7946,null))[_0x9ec8('0x1b')](respondWithResult(_0x3a7946,null))['catch'](handleError(_0x3a7946,null));};exports[_0x9ec8('0x53')]=function(_0x5c8b6b,_0x353347,_0x35490d){var _0x452ec3;return db[_0x9ec8('0x39')][_0x9ec8('0x53')](_0x5c8b6b[_0x9ec8('0x54')],{'raw':!![]})[_0x9ec8('0x1b')](function(_0x18cadf){_0x452ec3=_0x18cadf;return db['VoiceContext'][_0x9ec8('0x4e')]({'raw':!![]});})[_0x9ec8('0x1b')](function(_0x2c7872){var _0x58bddb=fs[_0x9ec8('0x55')](path[_0x9ec8('0x56')](config[_0x9ec8('0x57')],_0x9ec8('0x58')),_0x9ec8('0x59'));var _0x34592c=ejs[_0x9ec8('0x5a')](_0x58bddb,{'contexts':_0x2c7872||[]});fs[_0x9ec8('0x5b')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x34592c);})[_0x9ec8('0x1b')](function(){return respondWithRpcPromise('Reload',_0x9ec8('0x53'),{'module':'chan_sip.so'});})[_0x9ec8('0x1b')](function(){var _0x7cb3ff=_0x5c8b6b[_0x9ec8('0x5c')][_0x9ec8('0x32')]({'plain':!![]});if(!_0x7cb3ff)throw new Error(_0x9ec8('0x5d'));if(_0x7cb3ff[_0x9ec8('0x5e')]===_0x9ec8('0x5c')){var _0x3b2dd3=_0x452ec3[_0x9ec8('0x32')]({'plain':!![]});return db[_0x9ec8('0x5f')][_0x9ec8('0x60')]({'where':{'name':_0x9ec8('0x33'),'userProfileId':_0x7cb3ff[_0x9ec8('0x61')]},'raw':!![]})[_0x9ec8('0x1b')](function(_0x5d8140){if(_0x5d8140&&_0x5d8140[_0x9ec8('0x62')]===0x0){return db['UserProfileResource'][_0x9ec8('0x53')]({'name':_0x3b2dd3['name'],'resourceId':_0x3b2dd3['id'],'type':_0x5d8140[_0x9ec8('0x36')],'sectionId':_0x5d8140['id']},{})['then'](function(){return _0x452ec3;});}else{return _0x452ec3;}})[_0x9ec8('0x23')](function(_0x159fe9){logger[_0x9ec8('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x159fe9);throw _0x159fe9;});}return _0x452ec3;})[_0x9ec8('0x1b')](respondWithResult(_0x353347,0xc9))[_0x9ec8('0x23')](handleError(_0x353347,null));};exports[_0x9ec8('0x30')]=function(_0x5fa85f,_0x37f6ac,_0x1afbbe){var _0x1183be;return db['VoiceContext'][_0x9ec8('0x60')]({'where':{'id':_0x5fa85f['params']['id']}})[_0x9ec8('0x1b')](handleEntityNotFound(_0x37f6ac,null))[_0x9ec8('0x1b')](saveUpdates(_0x5fa85f['body'],null))[_0x9ec8('0x1b')](function(_0x2c73ed){if(_0x2c73ed){_0x1183be=_0x2c73ed;return db['VoiceContext'][_0x9ec8('0x4e')]({'raw':!![]});}})[_0x9ec8('0x1b')](function(_0x3ff912){var _0x6fcf13=fs[_0x9ec8('0x55')](path[_0x9ec8('0x56')](config['root'],'server/files/templates/context.ejs'),_0x9ec8('0x59'));var _0x21edad=ejs[_0x9ec8('0x5a')](_0x6fcf13,{'contexts':_0x3ff912||[]});fs[_0x9ec8('0x5b')](_0x9ec8('0x63'),_0x21edad);})[_0x9ec8('0x1b')](function(){return respondWithRpcPromise('Reload',_0x9ec8('0x30'),{'module':_0x9ec8('0x64')});})[_0x9ec8('0x1b')](function(){return _0x1183be;})[_0x9ec8('0x1b')](respondWithResult(_0x37f6ac,null))[_0x9ec8('0x23')](handleError(_0x37f6ac,null));};exports[_0x9ec8('0x31')]=function(_0xcaba92,_0x2488d0,_0x4ac0fa){var _0x493d91;return db[_0x9ec8('0x39')][_0x9ec8('0x60')]({'where':{'id':_0xcaba92['params']['id']}})[_0x9ec8('0x1b')](handleEntityNotFound(_0x2488d0,null))[_0x9ec8('0x1b')](removeEntity(_0x2488d0,null))[_0x9ec8('0x1b')](function(){return db[_0x9ec8('0x39')][_0x9ec8('0x4e')]({'raw':!![]});})[_0x9ec8('0x1b')](function(_0x4ac7aa){var _0x3cbda4=fs[_0x9ec8('0x55')](path['join'](config[_0x9ec8('0x57')],_0x9ec8('0x58')),_0x9ec8('0x59'));var _0x441c40=ejs[_0x9ec8('0x5a')](_0x3cbda4,{'contexts':_0x4ac7aa});fs[_0x9ec8('0x5b')](_0x9ec8('0x63'),_0x441c40);return respondWithRpcPromise(_0x9ec8('0x65'),_0x9ec8('0x31'),{'module':'chan_sip.so'});})[_0x9ec8('0x23')](handleError(_0x2488d0,null));}; \ No newline at end of file +var _0x6b6d=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','destroy','UserProfileResource','end','stack','name','index','map','VoiceContext','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','findAll','show','params','length','includeAll','include','create','readFileSync','root','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','role','get','UserProfileSection','find','Contexts','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','join','writeFileSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6b6d,0x1ee));var _0xd6b6=function(_0x5ac84c,_0x287781){_0x5ac84c=_0x5ac84c-0x0;var _0x3c53d2=_0x6b6d[_0x5ac84c];return _0x3c53d2;};'use strict';var emlformat=require(_0xd6b6('0x0'));var rimraf=require(_0xd6b6('0x1'));var zipdir=require(_0xd6b6('0x2'));var jsonpatch=require(_0xd6b6('0x3'));var rp=require(_0xd6b6('0x4'));var moment=require(_0xd6b6('0x5'));var BPromise=require(_0xd6b6('0x6'));var Mustache=require('mustache');var util=require(_0xd6b6('0x7'));var path=require(_0xd6b6('0x8'));var sox=require(_0xd6b6('0x9'));var csv=require('to-csv');var ejs=require(_0xd6b6('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd6b6('0xb'));var squel=require('squel');var crypto=require(_0xd6b6('0xc'));var jsforce=require(_0xd6b6('0xd'));var deskjs=require(_0xd6b6('0xe'));var toCsv=require(_0xd6b6('0xf'));var querystring=require(_0xd6b6('0x10'));var Papa=require(_0xd6b6('0x11'));var Redis=require(_0xd6b6('0x12'));var authService=require(_0xd6b6('0x13'));var qs=require(_0xd6b6('0x14'));var as=require(_0xd6b6('0x15'));var hardwareService=require(_0xd6b6('0x16'));var logger=require(_0xd6b6('0x17'))('api');var utils=require(_0xd6b6('0x18'));var config=require(_0xd6b6('0x19'));var licenseUtil=require(_0xd6b6('0x1a'));var db=require(_0xd6b6('0x1b'))['db'];var jayson=require(_0xd6b6('0x1c'));var client=jayson[_0xd6b6('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a685a,_0x1d5a96,_0x2f8295,_0x6f9e52){return new BPromise(function(_0x4b3d0a,_0x4d27f8){var _0x373666=_0x6f9e52||client;return _0x373666[_0xd6b6('0x1e')](_0x2a685a,_0x2f8295)[_0xd6b6('0x1f')](function(_0x4d7e89){logger['info'](_0xd6b6('0x20'),_0x1d5a96,_0xd6b6('0x21'));logger[_0xd6b6('0x22')](_0xd6b6('0x23'),_0x1d5a96,_0xd6b6('0x21'),JSON[_0xd6b6('0x24')](_0x4d7e89));if(_0x4d7e89[_0xd6b6('0x25')]){if(_0x4d7e89['error'][_0xd6b6('0x26')]===0x1f4){logger['error'](_0xd6b6('0x20'),_0x1d5a96,_0x4d7e89['error']['message']);return _0x4d27f8(_0x4d7e89[_0xd6b6('0x25')]['message']);}logger[_0xd6b6('0x25')](_0xd6b6('0x20'),_0x1d5a96,_0x4d7e89[_0xd6b6('0x25')]['message']);return _0x4b3d0a(_0x4d7e89['error'][_0xd6b6('0x27')]);}else{logger[_0xd6b6('0x28')](_0xd6b6('0x20'),_0x1d5a96,'request\x20sent');_0x4b3d0a(_0x4d7e89['result'][_0xd6b6('0x27')]);}})[_0xd6b6('0x29')](function(_0x5a762c){logger[_0xd6b6('0x25')](_0xd6b6('0x20'),_0x1d5a96,_0x5a762c);_0x4d27f8(_0x5a762c);});});}function respondWithStatusCode(_0x3b1837,_0x1b12ae){_0x1b12ae=_0x1b12ae||0xcc;return function(_0x4ebf36){if(_0x4ebf36){return _0x3b1837[_0xd6b6('0x2a')](_0x1b12ae);}return _0x3b1837[_0xd6b6('0x2b')](_0x1b12ae)['end']();};}function respondWithResult(_0x43ca1b,_0x46c02a){_0x46c02a=_0x46c02a||0xc8;return function(_0x594941){if(_0x594941){return _0x43ca1b[_0xd6b6('0x2b')](_0x46c02a)[_0xd6b6('0x2c')](_0x594941);}};}function respondWithFilteredResult(_0x5df5dd,_0x2aa075){return function(_0x315e5d){if(_0x315e5d){var _0x3a2805=typeof _0x2aa075['offset']==='undefined'&&typeof _0x2aa075['limit']==='undefined';var _0x17a263=_0x315e5d[_0xd6b6('0x2d')];var _0x535674=_0x3a2805?0x0:_0x2aa075[_0xd6b6('0x2e')];var _0x3707d8=_0x3a2805?_0x315e5d[_0xd6b6('0x2d')]:_0x2aa075[_0xd6b6('0x2e')]+_0x2aa075[_0xd6b6('0x2f')];var _0x1c1faa;if(_0x3707d8>=_0x17a263){_0x3707d8=_0x17a263;_0x1c1faa=0xc8;}else{_0x1c1faa=0xce;}_0x5df5dd['status'](_0x1c1faa);return _0x5df5dd['set'](_0xd6b6('0x30'),_0x535674+'-'+_0x3707d8+'/'+_0x17a263)[_0xd6b6('0x2c')](_0x315e5d);}return null;};}function patchUpdates(_0x479f12){return function(_0x3b0a46){try{jsonpatch[_0xd6b6('0x31')](_0x3b0a46,_0x479f12,!![]);}catch(_0x340e82){return BPromise[_0xd6b6('0x32')](_0x340e82);}return _0x3b0a46[_0xd6b6('0x33')]();};}function saveUpdates(_0x3f187d,_0x26c306){return function(_0xafb930){if(_0xafb930){return _0xafb930['update'](_0x3f187d)[_0xd6b6('0x1f')](function(_0x2b94a2){return _0x2b94a2;});}return null;};}function removeEntity(_0x4ff466,_0x1a96d4){return function(_0x2e3ca0){if(_0x2e3ca0){return _0x2e3ca0[_0xd6b6('0x34')]()['then'](function(){var _0x5dc67a=_0x2e3ca0['get']({'plain':!![]});var _0x449e82='Contexts';return db[_0xd6b6('0x35')][_0xd6b6('0x34')]({'where':{'type':_0x449e82,'resourceId':_0x5dc67a['id']}})['then'](function(){return _0x2e3ca0;});})['then'](function(){_0x4ff466[_0xd6b6('0x2b')](0xcc)[_0xd6b6('0x36')]();});}};}function handleEntityNotFound(_0x26ddaa,_0x191a1c){return function(_0x27f62b){if(!_0x27f62b){_0x26ddaa['sendStatus'](0x194);}return _0x27f62b;};}function handleError(_0x5e02c7,_0x49ab0c){_0x49ab0c=_0x49ab0c||0x1f4;return function(_0x4e30a7){logger[_0xd6b6('0x25')](_0x4e30a7[_0xd6b6('0x37')]);if(_0x4e30a7[_0xd6b6('0x38')]){delete _0x4e30a7[_0xd6b6('0x38')];}_0x5e02c7['status'](_0x49ab0c)['send'](_0x4e30a7);};}exports[_0xd6b6('0x39')]=function(_0x1d5849,_0x737404){var _0xfd856b={},_0x3bcbd4={},_0x37e203={'count':0x0,'rows':[]};var _0x33af7f=_[_0xd6b6('0x3a')](db[_0xd6b6('0x3b')]['rawAttributes'],function(_0x1b27a6){return{'name':_0x1b27a6['fieldName'],'type':_0x1b27a6[_0xd6b6('0x3c')][_0xd6b6('0x3d')]};});_0x3bcbd4[_0xd6b6('0x3e')]=_[_0xd6b6('0x3a')](_0x33af7f,_0xd6b6('0x38'));_0x3bcbd4['query']=_[_0xd6b6('0x3f')](_0x1d5849[_0xd6b6('0x40')]);_0x3bcbd4[_0xd6b6('0x41')]=_[_0xd6b6('0x42')](_0x3bcbd4[_0xd6b6('0x3e')],_0x3bcbd4[_0xd6b6('0x40')]);_0xfd856b[_0xd6b6('0x43')]=_['intersection'](_0x3bcbd4[_0xd6b6('0x3e')],qs[_0xd6b6('0x44')](_0x1d5849[_0xd6b6('0x40')]['fields']));_0xfd856b[_0xd6b6('0x43')]=_0xfd856b[_0xd6b6('0x43')]['length']?_0xfd856b['attributes']:_0x3bcbd4['model'];if(!_0x1d5849[_0xd6b6('0x40')]['hasOwnProperty'](_0xd6b6('0x45'))){_0xfd856b[_0xd6b6('0x2f')]=qs[_0xd6b6('0x2f')](_0x1d5849[_0xd6b6('0x40')][_0xd6b6('0x2f')]);_0xfd856b[_0xd6b6('0x2e')]=qs[_0xd6b6('0x2e')](_0x1d5849[_0xd6b6('0x40')]['offset']);}_0xfd856b[_0xd6b6('0x46')]=qs['sort'](_0x1d5849['query'][_0xd6b6('0x47')]);_0xfd856b['where']=qs[_0xd6b6('0x41')](_[_0xd6b6('0x48')](_0x1d5849[_0xd6b6('0x40')],_0x3bcbd4[_0xd6b6('0x41')]),_0x33af7f);if(_0x1d5849[_0xd6b6('0x40')][_0xd6b6('0x49')]){_0xfd856b[_0xd6b6('0x4a')]=_[_0xd6b6('0x4b')](_0xfd856b[_0xd6b6('0x4a')],{'$or':_['map'](_0x33af7f,function(_0xc33707){if(_0xc33707[_0xd6b6('0x3c')]!==_0xd6b6('0x4c')){var _0x3cb81f={};_0x3cb81f[_0xc33707[_0xd6b6('0x38')]]={'$like':'%'+_0x1d5849[_0xd6b6('0x40')][_0xd6b6('0x49')]+'%'};return _0x3cb81f;}})});}_0xfd856b=_[_0xd6b6('0x4b')]({},_0xfd856b,_0x1d5849[_0xd6b6('0x4d')]);var _0x102786={'where':_0xfd856b[_0xd6b6('0x4a')]};return db['VoiceContext'][_0xd6b6('0x2d')](_0x102786)[_0xd6b6('0x1f')](function(_0x5edd15){_0x37e203[_0xd6b6('0x2d')]=_0x5edd15;if(_0x1d5849[_0xd6b6('0x40')]['includeAll']){_0xfd856b['include']=[{'all':!![]}];}return db[_0xd6b6('0x3b')][_0xd6b6('0x4e')](_0xfd856b);})[_0xd6b6('0x1f')](function(_0x1c3b54){_0x37e203['rows']=_0x1c3b54;return _0x37e203;})[_0xd6b6('0x1f')](respondWithFilteredResult(_0x737404,_0xfd856b))[_0xd6b6('0x29')](handleError(_0x737404,null));};exports[_0xd6b6('0x4f')]=function(_0x571c6a,_0xbb1e2){var _0x17ed51={'raw':![],'where':{'id':_0x571c6a[_0xd6b6('0x50')]['id']}},_0x4c2635={};_0x4c2635[_0xd6b6('0x3e')]=_[_0xd6b6('0x3f')](db[_0xd6b6('0x3b')]['rawAttributes']);_0x4c2635['query']=_[_0xd6b6('0x3f')](_0x571c6a['query']);_0x4c2635[_0xd6b6('0x41')]=_[_0xd6b6('0x42')](_0x4c2635[_0xd6b6('0x3e')],_0x4c2635[_0xd6b6('0x40')]);_0x17ed51[_0xd6b6('0x43')]=_[_0xd6b6('0x42')](_0x4c2635[_0xd6b6('0x3e')],qs[_0xd6b6('0x44')](_0x571c6a[_0xd6b6('0x40')][_0xd6b6('0x44')]));_0x17ed51[_0xd6b6('0x43')]=_0x17ed51[_0xd6b6('0x43')][_0xd6b6('0x51')]?_0x17ed51[_0xd6b6('0x43')]:_0x4c2635[_0xd6b6('0x3e')];if(_0x571c6a[_0xd6b6('0x40')][_0xd6b6('0x52')]){_0x17ed51[_0xd6b6('0x53')]=[{'all':!![]}];}_0x17ed51=_[_0xd6b6('0x4b')]({},_0x17ed51,_0x571c6a['options']);return db[_0xd6b6('0x3b')]['find'](_0x17ed51)[_0xd6b6('0x1f')](handleEntityNotFound(_0xbb1e2,null))[_0xd6b6('0x1f')](respondWithResult(_0xbb1e2,null))[_0xd6b6('0x29')](handleError(_0xbb1e2,null));};exports['create']=function(_0x58c768,_0x2fac6b,_0x4ed53d){var _0x2afceb;return db[_0xd6b6('0x3b')][_0xd6b6('0x54')](_0x58c768['body'],{'raw':!![]})['then'](function(_0x5d49fb){_0x2afceb=_0x5d49fb;return db[_0xd6b6('0x3b')][_0xd6b6('0x4e')]({'raw':!![]});})[_0xd6b6('0x1f')](function(_0x21e1be){var _0x479ebd=fs[_0xd6b6('0x55')](path['join'](config[_0xd6b6('0x56')],'server/files/templates/context.ejs'),_0xd6b6('0x57'));var _0x2d90ca=ejs[_0xd6b6('0x58')](_0x479ebd,{'contexts':_0x21e1be||[]});fs['writeFileSync'](_0xd6b6('0x59'),_0x2d90ca);})[_0xd6b6('0x1f')](function(){return respondWithRpcPromise(_0xd6b6('0x5a'),_0xd6b6('0x54'),{'module':_0xd6b6('0x5b')});})['then'](function(){var _0x378f91=_0x58c768[_0xd6b6('0x5c')]['get']({'plain':!![]});if(!_0x378f91)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x378f91[_0xd6b6('0x5d')]===_0xd6b6('0x5c')){var _0x265c00=_0x2afceb[_0xd6b6('0x5e')]({'plain':!![]});return db[_0xd6b6('0x5f')][_0xd6b6('0x60')]({'where':{'name':_0xd6b6('0x61'),'userProfileId':_0x378f91['userProfileId']},'raw':!![]})[_0xd6b6('0x1f')](function(_0x5bb593){if(_0x5bb593&&_0x5bb593['autoAssociation']===0x0){return db[_0xd6b6('0x35')][_0xd6b6('0x54')]({'name':_0x265c00[_0xd6b6('0x38')],'resourceId':_0x265c00['id'],'type':_0x5bb593[_0xd6b6('0x38')],'sectionId':_0x5bb593['id']},{})[_0xd6b6('0x1f')](function(){return _0x2afceb;});}else{return _0x2afceb;}})[_0xd6b6('0x29')](function(_0x43eda5){logger[_0xd6b6('0x25')](_0xd6b6('0x62'),_0x43eda5);throw _0x43eda5;});}return _0x2afceb;})[_0xd6b6('0x1f')](respondWithResult(_0x2fac6b,0xc9))['catch'](handleError(_0x2fac6b,null));};exports[_0xd6b6('0x63')]=function(_0x527316,_0x5b6573,_0xd6c447){var _0x2a716f;return db['VoiceContext'][_0xd6b6('0x60')]({'where':{'id':_0x527316['params']['id']}})['then'](handleEntityNotFound(_0x5b6573,null))[_0xd6b6('0x1f')](saveUpdates(_0x527316[_0xd6b6('0x64')],null))['then'](function(_0x3c19aa){if(_0x3c19aa){_0x2a716f=_0x3c19aa;return db[_0xd6b6('0x3b')][_0xd6b6('0x4e')]({'raw':!![]});}})[_0xd6b6('0x1f')](function(_0x10e5e1){var _0xfc39ff=fs[_0xd6b6('0x55')](path[_0xd6b6('0x65')](config[_0xd6b6('0x56')],'server/files/templates/context.ejs'),_0xd6b6('0x57'));var _0x504fda=ejs['render'](_0xfc39ff,{'contexts':_0x10e5e1||[]});fs[_0xd6b6('0x66')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x504fda);})[_0xd6b6('0x1f')](function(){return respondWithRpcPromise(_0xd6b6('0x5a'),_0xd6b6('0x63'),{'module':_0xd6b6('0x5b')});})[_0xd6b6('0x1f')](function(){return _0x2a716f;})[_0xd6b6('0x1f')](respondWithResult(_0x5b6573,null))[_0xd6b6('0x29')](handleError(_0x5b6573,null));};exports[_0xd6b6('0x34')]=function(_0x49f275,_0x3bf6af,_0x1a8cda){var _0x24d8cf;return db['VoiceContext'][_0xd6b6('0x60')]({'where':{'id':_0x49f275[_0xd6b6('0x50')]['id']}})['then'](handleEntityNotFound(_0x3bf6af,null))['then'](removeEntity(_0x3bf6af,null))[_0xd6b6('0x1f')](function(){return db['VoiceContext']['findAll']({'raw':!![]});})['then'](function(_0x314ce0){var _0x501cf5=fs[_0xd6b6('0x55')](path['join'](config['root'],'server/files/templates/context.ejs'),_0xd6b6('0x57'));var _0x2322d8=ejs[_0xd6b6('0x58')](_0x501cf5,{'contexts':_0x314ce0});fs['writeFileSync'](_0xd6b6('0x59'),_0x2322d8);return respondWithRpcPromise('Reload',_0xd6b6('0x34'),{'module':_0xd6b6('0x5b')});})['catch'](handleError(_0x3bf6af,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 836978b..3da0268 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 _0xa442=['define','VoiceContext','voice_contexts','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports'];(function(_0x2999e7,_0x31e00c){var _0x4ebaeb=function(_0x1eb0a2){while(--_0x1eb0a2){_0x2999e7['push'](_0x2999e7['shift']());}};_0x4ebaeb(++_0x31e00c);}(_0xa442,0x153));var _0x2a44=function(_0x4d4c55,_0x38573a){_0x4d4c55=_0x4d4c55-0x0;var _0x1dec71=_0xa442[_0x4d4c55];return _0x1dec71;};'use strict';var _=require(_0x2a44('0x0'));var util=require(_0x2a44('0x1'));var logger=require(_0x2a44('0x2'))('api');var moment=require(_0x2a44('0x3'));var BPromise=require(_0x2a44('0x4'));var rp=require(_0x2a44('0x5'));var fs=require('fs');var path=require(_0x2a44('0x6'));var rimraf=require(_0x2a44('0x7'));var config=require(_0x2a44('0x8'));var attributes=require(_0x2a44('0x9'));module[_0x2a44('0xa')]=function(_0x3975fa,_0x4b40a3){return _0x3975fa[_0x2a44('0xb')](_0x2a44('0xc'),attributes,{'tableName':_0x2a44('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcbb8=['rimraf','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5f042d,_0x487095){var _0x191268=function(_0x462ce7){while(--_0x462ce7){_0x5f042d['push'](_0x5f042d['shift']());}};_0x191268(++_0x487095);}(_0xcbb8,0x77));var _0x8cbb=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0xcbb8[_0x39d544];return _0x5a5ff2;};'use strict';var _=require(_0x8cbb('0x0'));var util=require(_0x8cbb('0x1'));var logger=require(_0x8cbb('0x2'))(_0x8cbb('0x3'));var moment=require(_0x8cbb('0x4'));var BPromise=require(_0x8cbb('0x5'));var rp=require(_0x8cbb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8cbb('0x7'));var config=require(_0x8cbb('0x8'));var attributes=require(_0x8cbb('0x9'));module[_0x8cbb('0xa')]=function(_0x1e4a47,_0x541cd7){return _0x1e4a47[_0x8cbb('0xb')](_0x8cbb('0xc'),attributes,{'tableName':_0x8cbb('0xd'),'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 dc92fd1..eab790f 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 _0x3a5d=['debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3a5d,0x193));var _0xd3a5=function(_0xa56b53,_0x53dbb7){_0xa56b53=_0xa56b53-0x0;var _0x19849f=_0x3a5d[_0xa56b53];return _0x19849f;};'use strict';var _=require(_0xd3a5('0x0'));var util=require('util');var moment=require(_0xd3a5('0x1'));var BPromise=require(_0xd3a5('0x2'));var rs=require(_0xd3a5('0x3'));var fs=require('fs');var Redis=require(_0xd3a5('0x4'));var db=require(_0xd3a5('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd3a5('0x6'));var config=require(_0xd3a5('0x7'));var jayson=require(_0xd3a5('0x8'));var client=jayson[_0xd3a5('0x9')][_0xd3a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2586e5,_0x3fd8d3,_0x43aade){return new BPromise(function(_0x1a1b85,_0x301ca7){return client[_0xd3a5('0xb')](_0x2586e5,_0x43aade)[_0xd3a5('0xc')](function(_0x3d106d){logger[_0xd3a5('0xd')]('VoiceContext,\x20%s,\x20%s',_0x3fd8d3,_0xd3a5('0xe'));logger[_0xd3a5('0xf')](_0xd3a5('0x10'),_0x3fd8d3,'request\x20sent',JSON[_0xd3a5('0x11')](_0x3d106d));if(_0x3d106d[_0xd3a5('0x12')]){if(_0x3d106d['error'][_0xd3a5('0x13')]===0x1f4){logger[_0xd3a5('0x12')](_0xd3a5('0x14'),_0x3fd8d3,_0x3d106d['error'][_0xd3a5('0x15')]);return _0x301ca7(_0x3d106d['error']['message']);}logger[_0xd3a5('0x12')](_0xd3a5('0x14'),_0x3fd8d3,_0x3d106d[_0xd3a5('0x12')]['message']);return _0x1a1b85(_0x3d106d['error'][_0xd3a5('0x15')]);}else{logger[_0xd3a5('0xd')]('VoiceContext,\x20%s,\x20%s',_0x3fd8d3,_0xd3a5('0xe'));_0x1a1b85(_0x3d106d['result'][_0xd3a5('0x15')]);}})['catch'](function(_0x460b6b){logger[_0xd3a5('0x12')]('VoiceContext,\x20%s,\x20%s',_0x3fd8d3,_0x460b6b);_0x301ca7(_0x460b6b);});});} \ No newline at end of file +var _0xf7b4=['result','catch','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','VoiceContext,\x20%s,\x20%s','message'];(function(_0x1ed791,_0x3c86aa){var _0xea6482=function(_0x168cc9){while(--_0x168cc9){_0x1ed791['push'](_0x1ed791['shift']());}};_0xea6482(++_0x3c86aa);}(_0xf7b4,0x152));var _0x4f7b=function(_0x5db20e,_0x58b0b3){_0x5db20e=_0x5db20e-0x0;var _0xba0729=_0xf7b4[_0x5db20e];return _0xba0729;};'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});function respondWithRpcPromise(_0x3ad135,_0x173784,_0x351036){return new BPromise(function(_0x36ea9c,_0x3ef6e1){return client[_0x4f7b('0xa')](_0x3ad135,_0x351036)['then'](function(_0x433563){logger[_0x4f7b('0xb')]('VoiceContext,\x20%s,\x20%s',_0x173784,_0x4f7b('0xc'));logger[_0x4f7b('0xd')](_0x4f7b('0xe'),_0x173784,_0x4f7b('0xc'),JSON[_0x4f7b('0xf')](_0x433563));if(_0x433563['error']){if(_0x433563[_0x4f7b('0x10')]['code']===0x1f4){logger['error'](_0x4f7b('0x11'),_0x173784,_0x433563[_0x4f7b('0x10')][_0x4f7b('0x12')]);return _0x3ef6e1(_0x433563[_0x4f7b('0x10')]['message']);}logger[_0x4f7b('0x10')](_0x4f7b('0x11'),_0x173784,_0x433563[_0x4f7b('0x10')][_0x4f7b('0x12')]);return _0x36ea9c(_0x433563[_0x4f7b('0x10')][_0x4f7b('0x12')]);}else{logger[_0x4f7b('0xb')](_0x4f7b('0x11'),_0x173784,_0x4f7b('0xc'));_0x36ea9c(_0x433563[_0x4f7b('0x13')][_0x4f7b('0x12')]);}})[_0x4f7b('0x14')](function(_0x50a161){logger[_0x4f7b('0x10')]('VoiceContext,\x20%s,\x20%s',_0x173784,_0x50a161);_0x3ef6e1(_0x50a161);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 50e4912..e4617a8 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 _0x3b75=['multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./voiceDialReport.controller','get','isAuthenticated','index','describe','post','create','put','/:id','update','delete','destroy','exports'];(function(_0x29af39,_0x343c56){var _0x3ab715=function(_0x24eaea){while(--_0x24eaea){_0x29af39['push'](_0x29af39['shift']());}};_0x3ab715(++_0x343c56);}(_0x3b75,0xdc));var _0x53b7=function(_0x5cabfd,_0x5dea47){_0x5cabfd=_0x5cabfd-0x0;var _0x4bc06c=_0x3b75[_0x5cabfd];return _0x4bc06c;};'use strict';var multer=require(_0x53b7('0x0'));var util=require(_0x53b7('0x1'));var path=require(_0x53b7('0x2'));var timeout=require(_0x53b7('0x3'));var express=require(_0x53b7('0x4'));var router=express['Router']();var fs_extra=require(_0x53b7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x53b7('0x6'));var config=require('../../config/environment');var controller=require(_0x53b7('0x7'));router[_0x53b7('0x8')]('/',auth[_0x53b7('0x9')](),controller[_0x53b7('0xa')]);router[_0x53b7('0x8')]('/describe',auth[_0x53b7('0x9')](),controller[_0x53b7('0xb')]);router[_0x53b7('0x8')]('/:id',auth[_0x53b7('0x9')](),controller['show']);router[_0x53b7('0xc')]('/',auth[_0x53b7('0x9')](),controller[_0x53b7('0xd')]);router[_0x53b7('0xe')](_0x53b7('0xf'),auth['isAuthenticated'](),controller[_0x53b7('0x10')]);router[_0x53b7('0x11')](_0x53b7('0xf'),auth[_0x53b7('0x9')](),controller[_0x53b7('0x12')]);module[_0x53b7('0x13')]=router; \ No newline at end of file +var _0x644a=['./voiceDialReport.controller','get','isAuthenticated','/describe','describe','show','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x4052bc,_0x2bc3de){var _0x28410a=function(_0x5d4d99){while(--_0x5d4d99){_0x4052bc['push'](_0x4052bc['shift']());}};_0x28410a(++_0x2bc3de);}(_0x644a,0xfd));var _0xa644=function(_0x24d711,_0x3cdb28){_0x24d711=_0x24d711-0x0;var _0x3491b4=_0x644a[_0x24d711];return _0x3491b4;};'use strict';var multer=require(_0xa644('0x0'));var util=require(_0xa644('0x1'));var path=require(_0xa644('0x2'));var timeout=require(_0xa644('0x3'));var express=require(_0xa644('0x4'));var router=express['Router']();var fs_extra=require(_0xa644('0x5'));var auth=require(_0xa644('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa644('0x7'));router[_0xa644('0x8')]('/',auth[_0xa644('0x9')](),controller['index']);router[_0xa644('0x8')](_0xa644('0xa'),auth['isAuthenticated'](),controller[_0xa644('0xb')]);router[_0xa644('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xa644('0xc')]);router[_0xa644('0xd')]('/',auth['isAuthenticated'](),controller[_0xa644('0xe')]);router[_0xa644('0xf')](_0xa644('0x10'),auth[_0xa644('0x9')](),controller[_0xa644('0x11')]);router['delete'](_0xa644('0x10'),auth[_0xa644('0x9')](),controller[_0xa644('0x12')]);module[_0xa644('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index d58fd84..a2820e5 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 _0xe5b3=['STRING','INTEGER','DATE','exports'];(function(_0x57c4ff,_0x102e4e){var _0x21649c=function(_0x5a4fa9){while(--_0x5a4fa9){_0x57c4ff['push'](_0x57c4ff['shift']());}};_0x21649c(++_0x102e4e);}(_0xe5b3,0x133));var _0x3e5b=function(_0x282104,_0x1f85bc){_0x282104=_0x282104-0x0;var _0x5cb7d7=_0xe5b3[_0x282104];return _0x5cb7d7;};'use strict';var Sequelize=require('sequelize');module[_0x3e5b('0x0')]={'privilege':{'type':Sequelize[_0x3e5b('0x1')]},'channel':{'type':Sequelize[_0x3e5b('0x1')]},'channelstate':{'type':Sequelize[_0x3e5b('0x2')]},'channelstatedesc':{'type':Sequelize[_0x3e5b('0x1')]},'calleridnum':{'type':Sequelize[_0x3e5b('0x1')]},'calleridname':{'type':Sequelize[_0x3e5b('0x1')]},'connectedlinenum':{'type':Sequelize[_0x3e5b('0x1')]},'connectedlinename':{'type':Sequelize[_0x3e5b('0x1')]},'language':{'type':Sequelize[_0x3e5b('0x1')]},'accountcode':{'type':Sequelize[_0x3e5b('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x3e5b('0x1')]},'priority':{'type':Sequelize[_0x3e5b('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x3e5b('0x1')]},'destchannel':{'type':Sequelize[_0x3e5b('0x1')]},'destchannelstate':{'type':Sequelize[_0x3e5b('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x3e5b('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x3e5b('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x3e5b('0x1')]},'destlanguage':{'type':Sequelize[_0x3e5b('0x1')]},'destaccountcode':{'type':Sequelize[_0x3e5b('0x1')]},'destcontext':{'type':Sequelize[_0x3e5b('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x3e5b('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x3e5b('0x1')]},'dialstring':{'type':Sequelize[_0x3e5b('0x1')]},'dialstatus':{'type':Sequelize[_0x3e5b('0x1')]},'starttime':{'type':Sequelize[_0x3e5b('0x3')]},'answertime':{'type':Sequelize[_0x3e5b('0x3')]},'endtime':{'type':Sequelize[_0x3e5b('0x3')]},'lastevent':{'type':Sequelize[_0x3e5b('0x1')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x3e5b('0x2')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x9957=['INTEGER','DATE','called,connect,complete','sequelize','exports','STRING'];(function(_0x381694,_0x22054c){var _0x129eea=function(_0x5e7a9d){while(--_0x5e7a9d){_0x381694['push'](_0x381694['shift']());}};_0x129eea(++_0x22054c);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'privilege':{'type':Sequelize[_0x7995('0x2')]},'channel':{'type':Sequelize[_0x7995('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x7995('0x2')]},'calleridnum':{'type':Sequelize[_0x7995('0x2')]},'calleridname':{'type':Sequelize[_0x7995('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7995('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x7995('0x2')]},'accountcode':{'type':Sequelize[_0x7995('0x2')]},'context':{'type':Sequelize[_0x7995('0x2')]},'exten':{'type':Sequelize[_0x7995('0x2')]},'priority':{'type':Sequelize[_0x7995('0x3')]},'uniqueid':{'type':Sequelize[_0x7995('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x7995('0x2')]},'destchannelstate':{'type':Sequelize[_0x7995('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x7995('0x2')]},'destcalleridname':{'type':Sequelize[_0x7995('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x7995('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x7995('0x2')]},'destlanguage':{'type':Sequelize[_0x7995('0x2')]},'destaccountcode':{'type':Sequelize[_0x7995('0x2')]},'destcontext':{'type':Sequelize[_0x7995('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x7995('0x3')]},'destuniqueid':{'type':Sequelize[_0x7995('0x2')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x7995('0x2')]},'dialstatus':{'type':Sequelize[_0x7995('0x2')]},'starttime':{'type':Sequelize[_0x7995('0x4')]},'answertime':{'type':Sequelize[_0x7995('0x4')]},'endtime':{'type':Sequelize[_0x7995('0x4')]},'lastevent':{'type':Sequelize[_0x7995('0x2')],'comment':_0x7995('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x7995('0x3')]},'billableseconds':{'type':Sequelize[_0x7995('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index d32d9c2..cbc398a 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 _0xe788=['save','update','then','end','error','stack','name','map','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','VoiceDialReport','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','apply','reject'];(function(_0x2194bc,_0xaf2ba5){var _0x418183=function(_0x5ded32){while(--_0x5ded32){_0x2194bc['push'](_0x2194bc['shift']());}};_0x418183(++_0xaf2ba5);}(_0xe788,0x72));var _0x8e78=function(_0x59c437,_0x4dc090){_0x59c437=_0x59c437-0x0;var _0xab7fe7=_0xe788[_0x59c437];return _0xab7fe7;};'use strict';var emlformat=require(_0x8e78('0x0'));var rimraf=require(_0x8e78('0x1'));var zipdir=require(_0x8e78('0x2'));var jsonpatch=require(_0x8e78('0x3'));var rp=require(_0x8e78('0x4'));var moment=require('moment');var BPromise=require(_0x8e78('0x5'));var Mustache=require(_0x8e78('0x6'));var util=require('util');var path=require(_0x8e78('0x7'));var sox=require('sox');var csv=require(_0x8e78('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8e78('0x9'));var _=require(_0x8e78('0xa'));var squel=require(_0x8e78('0xb'));var crypto=require(_0x8e78('0xc'));var jsforce=require(_0x8e78('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8e78('0x8'));var querystring=require(_0x8e78('0xe'));var Papa=require(_0x8e78('0xf'));var Redis=require(_0x8e78('0x10'));var authService=require(_0x8e78('0x11'));var qs=require(_0x8e78('0x12'));var as=require(_0x8e78('0x13'));var hardwareService=require(_0x8e78('0x14'));var logger=require(_0x8e78('0x15'))(_0x8e78('0x16'));var utils=require(_0x8e78('0x17'));var config=require(_0x8e78('0x18'));var licenseUtil=require(_0x8e78('0x19'));var db=require(_0x8e78('0x1a'))['db'];function respondWithStatusCode(_0x296e06,_0x55dc62){_0x55dc62=_0x55dc62||0xcc;return function(_0x558302){if(_0x558302){return _0x296e06[_0x8e78('0x1b')](_0x55dc62);}return _0x296e06[_0x8e78('0x1c')](_0x55dc62)['end']();};}function respondWithResult(_0x37729e,_0x50e4db){_0x50e4db=_0x50e4db||0xc8;return function(_0x273eeb){if(_0x273eeb){return _0x37729e['status'](_0x50e4db)[_0x8e78('0x1d')](_0x273eeb);}};}function respondWithFilteredResult(_0x5a9599,_0x1847a7){return function(_0x1de0d7){if(_0x1de0d7){var _0x9cceb=typeof _0x1847a7[_0x8e78('0x1e')]===_0x8e78('0x1f')&&typeof _0x1847a7[_0x8e78('0x20')]===_0x8e78('0x1f');var _0x5ac3fb=_0x1de0d7['count'];var _0x2209c4=_0x9cceb?0x0:_0x1847a7[_0x8e78('0x1e')];var _0x5c4756=_0x9cceb?_0x1de0d7[_0x8e78('0x21')]:_0x1847a7[_0x8e78('0x1e')]+_0x1847a7[_0x8e78('0x20')];var _0x27a788;if(_0x5c4756>=_0x5ac3fb){_0x5c4756=_0x5ac3fb;_0x27a788=0xc8;}else{_0x27a788=0xce;}_0x5a9599[_0x8e78('0x1c')](_0x27a788);return _0x5a9599['set']('Content-Range',_0x2209c4+'-'+_0x5c4756+'/'+_0x5ac3fb)[_0x8e78('0x1d')](_0x1de0d7);}return null;};}function patchUpdates(_0x26753d){return function(_0x1f8089){try{jsonpatch[_0x8e78('0x22')](_0x1f8089,_0x26753d,!![]);}catch(_0x2c6529){return BPromise[_0x8e78('0x23')](_0x2c6529);}return _0x1f8089[_0x8e78('0x24')]();};}function saveUpdates(_0x34cf8b,_0x35638e){return function(_0x417a7f){if(_0x417a7f){return _0x417a7f[_0x8e78('0x25')](_0x34cf8b)[_0x8e78('0x26')](function(_0x1786d7){return _0x1786d7;});}return null;};}function removeEntity(_0x56489e,_0x533ba3){return function(_0x3d81eb){if(_0x3d81eb){return _0x3d81eb['destroy']()[_0x8e78('0x26')](function(){_0x56489e[_0x8e78('0x1c')](0xcc)[_0x8e78('0x27')]();});}};}function handleEntityNotFound(_0x338025,_0x3ae53b){return function(_0x132f77){if(!_0x132f77){_0x338025['sendStatus'](0x194);}return _0x132f77;};}function handleError(_0x5686fb,_0x5e323d){_0x5e323d=_0x5e323d||0x1f4;return function(_0x258324){logger[_0x8e78('0x28')](_0x258324[_0x8e78('0x29')]);if(_0x258324[_0x8e78('0x2a')]){delete _0x258324[_0x8e78('0x2a')];}_0x5686fb[_0x8e78('0x1c')](_0x5e323d)['send'](_0x258324);};}exports['index']=function(_0x3b681c,_0xf3b69){var _0xd34e1a={},_0x47bc60={},_0x1d921a={'count':0x0,'rows':[]};var _0x30890c=_[_0x8e78('0x2b')](db['VoiceDialReport'][_0x8e78('0x2c')],function(_0x174f83){return{'name':_0x174f83['fieldName'],'type':_0x174f83[_0x8e78('0x2d')][_0x8e78('0x2e')]};});_0x47bc60['model']=_[_0x8e78('0x2b')](_0x30890c,_0x8e78('0x2a'));_0x47bc60[_0x8e78('0x2f')]=_[_0x8e78('0x30')](_0x3b681c['query']);_0x47bc60[_0x8e78('0x31')]=_[_0x8e78('0x32')](_0x47bc60[_0x8e78('0x33')],_0x47bc60[_0x8e78('0x2f')]);_0xd34e1a['attributes']=_[_0x8e78('0x32')](_0x47bc60[_0x8e78('0x33')],qs['fields'](_0x3b681c[_0x8e78('0x2f')][_0x8e78('0x34')]));_0xd34e1a[_0x8e78('0x35')]=_0xd34e1a[_0x8e78('0x35')][_0x8e78('0x36')]?_0xd34e1a[_0x8e78('0x35')]:_0x47bc60[_0x8e78('0x33')];if(!_0x3b681c[_0x8e78('0x2f')]['hasOwnProperty'](_0x8e78('0x37'))){_0xd34e1a[_0x8e78('0x20')]=qs[_0x8e78('0x20')](_0x3b681c[_0x8e78('0x2f')][_0x8e78('0x20')]);_0xd34e1a[_0x8e78('0x1e')]=qs[_0x8e78('0x1e')](_0x3b681c[_0x8e78('0x2f')][_0x8e78('0x1e')]);}_0xd34e1a[_0x8e78('0x38')]=qs[_0x8e78('0x39')](_0x3b681c[_0x8e78('0x2f')]['sort']);_0xd34e1a[_0x8e78('0x3a')]=qs['filters'](_['pick'](_0x3b681c[_0x8e78('0x2f')],_0x47bc60[_0x8e78('0x31')]),_0x30890c);if(_0x3b681c[_0x8e78('0x2f')][_0x8e78('0x3b')]){_0xd34e1a[_0x8e78('0x3a')]=_[_0x8e78('0x3c')](_0xd34e1a[_0x8e78('0x3a')],{'$or':_['map'](_0x30890c,function(_0x207604){if(_0x207604['type']!==_0x8e78('0x3d')){var _0x183fd9={};_0x183fd9[_0x207604[_0x8e78('0x2a')]]={'$like':'%'+_0x3b681c['query'][_0x8e78('0x3b')]+'%'};return _0x183fd9;}})});}_0xd34e1a=_[_0x8e78('0x3c')]({},_0xd34e1a,_0x3b681c[_0x8e78('0x3e')]);var _0x1a7c3b={'where':_0xd34e1a['where']};return db[_0x8e78('0x3f')][_0x8e78('0x21')](_0x1a7c3b)['then'](function(_0xccbe18){_0x1d921a['count']=_0xccbe18;if(_0x3b681c[_0x8e78('0x2f')][_0x8e78('0x40')]){_0xd34e1a['include']=[{'all':!![]}];}return db['VoiceDialReport'][_0x8e78('0x41')](_0xd34e1a);})[_0x8e78('0x26')](function(_0x10c266){_0x1d921a[_0x8e78('0x42')]=_0x10c266;return _0x1d921a;})[_0x8e78('0x26')](respondWithFilteredResult(_0xf3b69,_0xd34e1a))[_0x8e78('0x43')](handleError(_0xf3b69,null));};exports[_0x8e78('0x44')]=function(_0x36aa5c,_0x2cc95f){var _0x45380b={'raw':!![],'where':{'id':_0x36aa5c[_0x8e78('0x45')]['id']}},_0x18d0e3={};_0x18d0e3[_0x8e78('0x33')]=_[_0x8e78('0x30')](db[_0x8e78('0x3f')][_0x8e78('0x2c')]);_0x18d0e3['query']=_[_0x8e78('0x30')](_0x36aa5c[_0x8e78('0x2f')]);_0x18d0e3[_0x8e78('0x31')]=_['intersection'](_0x18d0e3['model'],_0x18d0e3['query']);_0x45380b[_0x8e78('0x35')]=_['intersection'](_0x18d0e3['model'],qs[_0x8e78('0x34')](_0x36aa5c['query'][_0x8e78('0x34')]));_0x45380b[_0x8e78('0x35')]=_0x45380b['attributes'][_0x8e78('0x36')]?_0x45380b[_0x8e78('0x35')]:_0x18d0e3[_0x8e78('0x33')];if(_0x36aa5c[_0x8e78('0x2f')][_0x8e78('0x40')]){_0x45380b[_0x8e78('0x46')]=[{'all':!![]}];}_0x45380b=_[_0x8e78('0x3c')]({},_0x45380b,_0x36aa5c[_0x8e78('0x3e')]);return db[_0x8e78('0x3f')][_0x8e78('0x47')](_0x45380b)[_0x8e78('0x26')](handleEntityNotFound(_0x2cc95f,null))['then'](respondWithResult(_0x2cc95f,null))[_0x8e78('0x43')](handleError(_0x2cc95f,null));};exports[_0x8e78('0x48')]=function(_0x46a489,_0xff459e){return db[_0x8e78('0x3f')][_0x8e78('0x48')](_0x46a489[_0x8e78('0x49')],{})[_0x8e78('0x26')](respondWithResult(_0xff459e,0xc9))[_0x8e78('0x43')](handleError(_0xff459e,null));};exports[_0x8e78('0x25')]=function(_0x19ff50,_0x6ca5c){if(_0x19ff50[_0x8e78('0x49')]['id']){delete _0x19ff50[_0x8e78('0x49')]['id'];}return db[_0x8e78('0x3f')][_0x8e78('0x47')]({'where':{'id':_0x19ff50['params']['id']}})['then'](handleEntityNotFound(_0x6ca5c,null))[_0x8e78('0x26')](saveUpdates(_0x19ff50[_0x8e78('0x49')],null))[_0x8e78('0x26')](respondWithResult(_0x6ca5c,null))[_0x8e78('0x43')](handleError(_0x6ca5c,null));};exports['destroy']=function(_0x53ac9a,_0x2501ff){return db[_0x8e78('0x3f')][_0x8e78('0x47')]({'where':{'id':_0x53ac9a[_0x8e78('0x45')]['id']}})[_0x8e78('0x26')](handleEntityNotFound(_0x2501ff,null))[_0x8e78('0x26')](removeEntity(_0x2501ff,null))[_0x8e78('0x43')](handleError(_0x2501ff,null));};exports['describe']=function(_0x39999f,_0x569df2){return db['VoiceDialReport'][_0x8e78('0x4a')]()[_0x8e78('0x26')](respondWithResult(_0x569df2,null))['catch'](handleError(_0x569df2,null));}; \ No newline at end of file +var _0x5c04=['VIRTUAL','options','includeAll','include','findAll','rows','show','length','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','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','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','VoiceDialReport','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge'];(function(_0x2c17dd,_0x28b928){var _0x2398ea=function(_0x4bfb23){while(--_0x4bfb23){_0x2c17dd['push'](_0x2c17dd['shift']());}};_0x2398ea(++_0x28b928);}(_0x5c04,0xa6));var _0x45c0=function(_0x2e0603,_0x39f7df){_0x2e0603=_0x2e0603-0x0;var _0x2cb9ac=_0x5c04[_0x2e0603];return _0x2cb9ac;};'use strict';var emlformat=require(_0x45c0('0x0'));var rimraf=require(_0x45c0('0x1'));var zipdir=require(_0x45c0('0x2'));var jsonpatch=require(_0x45c0('0x3'));var rp=require('request-promise');var moment=require(_0x45c0('0x4'));var BPromise=require(_0x45c0('0x5'));var Mustache=require('mustache');var util=require(_0x45c0('0x6'));var path=require('path');var sox=require(_0x45c0('0x7'));var csv=require(_0x45c0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x45c0('0x9'));var _=require(_0x45c0('0xa'));var squel=require(_0x45c0('0xb'));var crypto=require(_0x45c0('0xc'));var jsforce=require(_0x45c0('0xd'));var deskjs=require(_0x45c0('0xe'));var toCsv=require(_0x45c0('0x8'));var querystring=require(_0x45c0('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x45c0('0x10'));var qs=require(_0x45c0('0x11'));var as=require(_0x45c0('0x12'));var hardwareService=require(_0x45c0('0x13'));var logger=require(_0x45c0('0x14'))(_0x45c0('0x15'));var utils=require(_0x45c0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x45c0('0x17'));var db=require(_0x45c0('0x18'))['db'];function respondWithStatusCode(_0xafa086,_0x5c022f){_0x5c022f=_0x5c022f||0xcc;return function(_0x9f7303){if(_0x9f7303){return _0xafa086[_0x45c0('0x19')](_0x5c022f);}return _0xafa086[_0x45c0('0x1a')](_0x5c022f)[_0x45c0('0x1b')]();};}function respondWithResult(_0x566e50,_0x196352){_0x196352=_0x196352||0xc8;return function(_0x525576){if(_0x525576){return _0x566e50['status'](_0x196352)[_0x45c0('0x1c')](_0x525576);}};}function respondWithFilteredResult(_0xccf4f6,_0x3a6a94){return function(_0x13818c){if(_0x13818c){var _0x1b4f01=typeof _0x3a6a94[_0x45c0('0x1d')]===_0x45c0('0x1e')&&typeof _0x3a6a94['limit']===_0x45c0('0x1e');var _0x5a7f2b=_0x13818c[_0x45c0('0x1f')];var _0x40197a=_0x1b4f01?0x0:_0x3a6a94[_0x45c0('0x1d')];var _0x35e844=_0x1b4f01?_0x13818c[_0x45c0('0x1f')]:_0x3a6a94[_0x45c0('0x1d')]+_0x3a6a94['limit'];var _0x372688;if(_0x35e844>=_0x5a7f2b){_0x35e844=_0x5a7f2b;_0x372688=0xc8;}else{_0x372688=0xce;}_0xccf4f6[_0x45c0('0x1a')](_0x372688);return _0xccf4f6['set'](_0x45c0('0x20'),_0x40197a+'-'+_0x35e844+'/'+_0x5a7f2b)[_0x45c0('0x1c')](_0x13818c);}return null;};}function patchUpdates(_0x24caa3){return function(_0x31b2d2){try{jsonpatch[_0x45c0('0x21')](_0x31b2d2,_0x24caa3,!![]);}catch(_0x5d32f1){return BPromise[_0x45c0('0x22')](_0x5d32f1);}return _0x31b2d2[_0x45c0('0x23')]();};}function saveUpdates(_0x19bae1,_0x4d7987){return function(_0x34272e){if(_0x34272e){return _0x34272e[_0x45c0('0x24')](_0x19bae1)[_0x45c0('0x25')](function(_0x1f8f4c){return _0x1f8f4c;});}return null;};}function removeEntity(_0x2175d2,_0x193db8){return function(_0x13ebd7){if(_0x13ebd7){return _0x13ebd7[_0x45c0('0x26')]()[_0x45c0('0x25')](function(){_0x2175d2['status'](0xcc)[_0x45c0('0x1b')]();});}};}function handleEntityNotFound(_0x5d4f3c,_0x32a52e){return function(_0x4d2cd0){if(!_0x4d2cd0){_0x5d4f3c['sendStatus'](0x194);}return _0x4d2cd0;};}function handleError(_0x3e1d95,_0x5ad7a0){_0x5ad7a0=_0x5ad7a0||0x1f4;return function(_0x5bfa9e){logger[_0x45c0('0x27')](_0x5bfa9e['stack']);if(_0x5bfa9e[_0x45c0('0x28')]){delete _0x5bfa9e[_0x45c0('0x28')];}_0x3e1d95[_0x45c0('0x1a')](_0x5ad7a0)[_0x45c0('0x29')](_0x5bfa9e);};}exports[_0x45c0('0x2a')]=function(_0x2648e4,_0x2886b6){var _0x2c8854={},_0x16d6c1={},_0x187f1b={'count':0x0,'rows':[]};var _0x255234=_[_0x45c0('0x2b')](db[_0x45c0('0x2c')][_0x45c0('0x2d')],function(_0x4e67d4){return{'name':_0x4e67d4['fieldName'],'type':_0x4e67d4[_0x45c0('0x2e')]['key']};});_0x16d6c1['model']=_[_0x45c0('0x2b')](_0x255234,_0x45c0('0x28'));_0x16d6c1[_0x45c0('0x2f')]=_[_0x45c0('0x30')](_0x2648e4[_0x45c0('0x2f')]);_0x16d6c1[_0x45c0('0x31')]=_[_0x45c0('0x32')](_0x16d6c1[_0x45c0('0x33')],_0x16d6c1[_0x45c0('0x2f')]);_0x2c8854[_0x45c0('0x34')]=_[_0x45c0('0x32')](_0x16d6c1[_0x45c0('0x33')],qs['fields'](_0x2648e4[_0x45c0('0x2f')][_0x45c0('0x35')]));_0x2c8854[_0x45c0('0x34')]=_0x2c8854[_0x45c0('0x34')]['length']?_0x2c8854[_0x45c0('0x34')]:_0x16d6c1['model'];if(!_0x2648e4[_0x45c0('0x2f')][_0x45c0('0x36')](_0x45c0('0x37'))){_0x2c8854[_0x45c0('0x38')]=qs[_0x45c0('0x38')](_0x2648e4[_0x45c0('0x2f')][_0x45c0('0x38')]);_0x2c8854[_0x45c0('0x1d')]=qs[_0x45c0('0x1d')](_0x2648e4[_0x45c0('0x2f')][_0x45c0('0x1d')]);}_0x2c8854['order']=qs[_0x45c0('0x39')](_0x2648e4[_0x45c0('0x2f')][_0x45c0('0x39')]);_0x2c8854[_0x45c0('0x3a')]=qs['filters'](_[_0x45c0('0x3b')](_0x2648e4[_0x45c0('0x2f')],_0x16d6c1[_0x45c0('0x31')]),_0x255234);if(_0x2648e4[_0x45c0('0x2f')][_0x45c0('0x3c')]){_0x2c8854[_0x45c0('0x3a')]=_[_0x45c0('0x3d')](_0x2c8854['where'],{'$or':_[_0x45c0('0x2b')](_0x255234,function(_0x1fd3be){if(_0x1fd3be[_0x45c0('0x2e')]!==_0x45c0('0x3e')){var _0xc2d3c9={};_0xc2d3c9[_0x1fd3be[_0x45c0('0x28')]]={'$like':'%'+_0x2648e4['query'][_0x45c0('0x3c')]+'%'};return _0xc2d3c9;}})});}_0x2c8854=_[_0x45c0('0x3d')]({},_0x2c8854,_0x2648e4[_0x45c0('0x3f')]);var _0x3de92c={'where':_0x2c8854[_0x45c0('0x3a')]};return db[_0x45c0('0x2c')][_0x45c0('0x1f')](_0x3de92c)[_0x45c0('0x25')](function(_0xdececd){_0x187f1b[_0x45c0('0x1f')]=_0xdececd;if(_0x2648e4[_0x45c0('0x2f')][_0x45c0('0x40')]){_0x2c8854[_0x45c0('0x41')]=[{'all':!![]}];}return db[_0x45c0('0x2c')][_0x45c0('0x42')](_0x2c8854);})['then'](function(_0x58ec64){_0x187f1b[_0x45c0('0x43')]=_0x58ec64;return _0x187f1b;})[_0x45c0('0x25')](respondWithFilteredResult(_0x2886b6,_0x2c8854))['catch'](handleError(_0x2886b6,null));};exports[_0x45c0('0x44')]=function(_0x5c3187,_0x44d93e){var _0x48de76={'raw':!![],'where':{'id':_0x5c3187['params']['id']}},_0x13f048={};_0x13f048[_0x45c0('0x33')]=_[_0x45c0('0x30')](db[_0x45c0('0x2c')][_0x45c0('0x2d')]);_0x13f048[_0x45c0('0x2f')]=_[_0x45c0('0x30')](_0x5c3187[_0x45c0('0x2f')]);_0x13f048['filters']=_['intersection'](_0x13f048['model'],_0x13f048[_0x45c0('0x2f')]);_0x48de76[_0x45c0('0x34')]=_['intersection'](_0x13f048[_0x45c0('0x33')],qs[_0x45c0('0x35')](_0x5c3187[_0x45c0('0x2f')][_0x45c0('0x35')]));_0x48de76[_0x45c0('0x34')]=_0x48de76[_0x45c0('0x34')][_0x45c0('0x45')]?_0x48de76[_0x45c0('0x34')]:_0x13f048['model'];if(_0x5c3187[_0x45c0('0x2f')][_0x45c0('0x40')]){_0x48de76['include']=[{'all':!![]}];}_0x48de76=_[_0x45c0('0x3d')]({},_0x48de76,_0x5c3187[_0x45c0('0x3f')]);return db[_0x45c0('0x2c')][_0x45c0('0x46')](_0x48de76)[_0x45c0('0x25')](handleEntityNotFound(_0x44d93e,null))[_0x45c0('0x25')](respondWithResult(_0x44d93e,null))[_0x45c0('0x47')](handleError(_0x44d93e,null));};exports[_0x45c0('0x48')]=function(_0x51baa0,_0x20652e){return db[_0x45c0('0x2c')][_0x45c0('0x48')](_0x51baa0[_0x45c0('0x49')],{})[_0x45c0('0x25')](respondWithResult(_0x20652e,0xc9))[_0x45c0('0x47')](handleError(_0x20652e,null));};exports[_0x45c0('0x24')]=function(_0x43094f,_0x200076){if(_0x43094f[_0x45c0('0x49')]['id']){delete _0x43094f[_0x45c0('0x49')]['id'];}return db[_0x45c0('0x2c')][_0x45c0('0x46')]({'where':{'id':_0x43094f[_0x45c0('0x4a')]['id']}})[_0x45c0('0x25')](handleEntityNotFound(_0x200076,null))[_0x45c0('0x25')](saveUpdates(_0x43094f['body'],null))['then'](respondWithResult(_0x200076,null))[_0x45c0('0x47')](handleError(_0x200076,null));};exports[_0x45c0('0x26')]=function(_0x174b8a,_0x52e272){return db[_0x45c0('0x2c')][_0x45c0('0x46')]({'where':{'id':_0x174b8a[_0x45c0('0x4a')]['id']}})[_0x45c0('0x25')](handleEntityNotFound(_0x52e272,null))[_0x45c0('0x25')](removeEntity(_0x52e272,null))[_0x45c0('0x47')](handleError(_0x52e272,null));};exports[_0x45c0('0x4b')]=function(_0x286ddd,_0x221b39){return db[_0x45c0('0x2c')][_0x45c0('0x4b')]()[_0x45c0('0x25')](respondWithResult(_0x221b39,null))[_0x45c0('0x47')](handleError(_0x221b39,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index e5bdf3f..79a50d0 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 _0x7c8e=['rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x6d76e8,_0x3a5b96){var _0x10a933=function(_0xcca43b){while(--_0xcca43b){_0x6d76e8['push'](_0x6d76e8['shift']());}};_0x10a933(++_0x3a5b96);}(_0x7c8e,0x94));var _0xe7c8=function(_0x314c1d,_0x3fba0c){_0x314c1d=_0x314c1d-0x0;var _0x511529=_0x7c8e[_0x314c1d];return _0x511529;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7c8('0x0'))(_0xe7c8('0x1'));var moment=require(_0xe7c8('0x2'));var BPromise=require(_0xe7c8('0x3'));var rp=require(_0xe7c8('0x4'));var fs=require('fs');var path=require(_0xe7c8('0x5'));var rimraf=require(_0xe7c8('0x6'));var config=require(_0xe7c8('0x7'));var attributes=require(_0xe7c8('0x8'));module[_0xe7c8('0x9')]=function(_0x1cd3e5,_0x52ac01){return _0x1cd3e5[_0xe7c8('0xa')](_0xe7c8('0xb'),attributes,{'tableName':_0xe7c8('0xc'),'paranoid':![],'indexes':[{'fields':[_0xe7c8('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x65eb=['uniqueid','lodash','util','api','moment','bluebird','request-promise','./voiceDialReport.attributes','exports','define','VoiceDialReport'];(function(_0x27fb22,_0xab9f66){var _0x2046fc=function(_0x1a692c){while(--_0x1a692c){_0x27fb22['push'](_0x27fb22['shift']());}};_0x2046fc(++_0xab9f66);}(_0x65eb,0x1a3));var _0xb65e=function(_0x4ec145,_0x46c110){_0x4ec145=_0x4ec145-0x0;var _0x36bf68=_0x65eb[_0x4ec145];return _0x36bf68;};'use strict';var _=require(_0xb65e('0x0'));var util=require(_0xb65e('0x1'));var logger=require('../../config/logger')(_0xb65e('0x2'));var moment=require(_0xb65e('0x3'));var BPromise=require(_0xb65e('0x4'));var rp=require(_0xb65e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb65e('0x6'));module[_0xb65e('0x7')]=function(_0x3acce1,_0x3ce1db){return _0x3acce1[_0xb65e('0x8')](_0xb65e('0x9'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0xb65e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index aa2f8e7..827aba8 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 _0x39a1=['create','options','raw','then','UpdateVoiceDialReport','update','body','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','result','CreateVoiceDialReport','VoiceDialReport'];(function(_0x5199e,_0x55b73e){var _0x20078f=function(_0x3ae326){while(--_0x3ae326){_0x5199e['push'](_0x5199e['shift']());}};_0x20078f(++_0x55b73e);}(_0x39a1,0x18a));var _0x139a=function(_0x588a13,_0xc084e2){_0x588a13=_0x588a13-0x0;var _0x5a778e=_0x39a1[_0x588a13];return _0x5a778e;};'use strict';var _=require(_0x139a('0x0'));var util=require(_0x139a('0x1'));var moment=require(_0x139a('0x2'));var BPromise=require(_0x139a('0x3'));var rs=require(_0x139a('0x4'));var fs=require('fs');var Redis=require(_0x139a('0x5'));var db=require(_0x139a('0x6'))['db'];var utils=require(_0x139a('0x7'));var logger=require(_0x139a('0x8'))(_0x139a('0x9'));var config=require(_0x139a('0xa'));var jayson=require(_0x139a('0xb'));var client=jayson[_0x139a('0xc')][_0x139a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x41ddbd,_0x46c1d8,_0x5aad23){return new BPromise(function(_0x590b70,_0x50e9cc){return client[_0x139a('0xe')](_0x41ddbd,_0x5aad23)['then'](function(_0x24b529){logger[_0x139a('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0x46c1d8,_0x139a('0x10'));logger['debug'](_0x139a('0x11'),_0x46c1d8,'request\x20sent',JSON[_0x139a('0x12')](_0x24b529));if(_0x24b529[_0x139a('0x13')]){if(_0x24b529[_0x139a('0x13')][_0x139a('0x14')]===0x1f4){logger['error'](_0x139a('0x15'),_0x46c1d8,_0x24b529[_0x139a('0x13')][_0x139a('0x16')]);return _0x50e9cc(_0x24b529['error'][_0x139a('0x16')]);}logger[_0x139a('0x13')]('VoiceDialReport,\x20%s,\x20%s',_0x46c1d8,_0x24b529[_0x139a('0x13')][_0x139a('0x16')]);return _0x590b70(_0x24b529[_0x139a('0x13')][_0x139a('0x16')]);}else{logger[_0x139a('0xf')](_0x139a('0x15'),_0x46c1d8,_0x139a('0x10'));_0x590b70(_0x24b529[_0x139a('0x17')][_0x139a('0x16')]);}})['catch'](function(_0x2c7334){logger[_0x139a('0x13')]('VoiceDialReport,\x20%s,\x20%s',_0x46c1d8,_0x2c7334);_0x50e9cc(_0x2c7334);});});}exports[_0x139a('0x18')]=function(_0x4910bd){var _0xd0338a=this;return new Promise(function(_0x1bcc21,_0x3d178c){return db[_0x139a('0x19')][_0x139a('0x1a')](_0x4910bd['body'],{'raw':_0x4910bd[_0x139a('0x1b')]?_0x4910bd[_0x139a('0x1b')][_0x139a('0x1c')]===undefined?!![]:![]:!![]})[_0x139a('0x1d')](function(_0x18bc7d){logger[_0x139a('0xf')]('CreateVoiceDialReport',_0x4910bd);logger['debug'](_0x139a('0x18'),_0x4910bd,JSON['stringify'](_0x18bc7d));_0x1bcc21(_0x18bc7d);})['catch'](function(_0x3b7ab9){logger[_0x139a('0x13')](_0x139a('0x18'),_0x3b7ab9[_0x139a('0x16')],_0x4910bd);_0x3d178c(_0xd0338a['error'](0x1f4,_0x3b7ab9[_0x139a('0x16')]));});});};exports[_0x139a('0x1e')]=function(_0x328cd0){var _0x2bc0dd=this;return new Promise(function(_0x1f6a20,_0x10605e){return db[_0x139a('0x19')][_0x139a('0x1f')](_0x328cd0[_0x139a('0x20')],{'raw':_0x328cd0['options']?_0x328cd0[_0x139a('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x328cd0[_0x139a('0x1b')]?_0x328cd0[_0x139a('0x1b')][_0x139a('0x21')]||null:null,'attributes':_0x328cd0[_0x139a('0x1b')]?_0x328cd0[_0x139a('0x1b')]['attributes']||null:null,'limit':_0x328cd0[_0x139a('0x1b')]?_0x328cd0[_0x139a('0x1b')][_0x139a('0x22')]||null:null})[_0x139a('0x1d')](function(_0x1edafe){logger[_0x139a('0xf')](_0x139a('0x1e'),_0x328cd0);logger['debug'](_0x139a('0x1e'),_0x328cd0,JSON['stringify'](_0x1edafe));_0x1f6a20(_0x1edafe);})['catch'](function(_0x5afe1b){logger[_0x139a('0x13')]('UpdateVoiceDialReport',_0x5afe1b[_0x139a('0x16')],_0x328cd0);_0x10605e(_0x2bc0dd['error'](0x1f4,_0x5afe1b[_0x139a('0x16')]));});});}; \ No newline at end of file +var _0xd45e=['raw','UpdateVoiceDialReport','update','attributes','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','body','options'];(function(_0xefcad4,_0x5cba66){var _0x1dfc41=function(_0x72457){while(--_0x72457){_0xefcad4['push'](_0xefcad4['shift']());}};_0x1dfc41(++_0x5cba66);}(_0xd45e,0xd0));var _0xed45=function(_0xf41c8e,_0x391401){_0xf41c8e=_0xf41c8e-0x0;var _0x1e7529=_0xd45e[_0xf41c8e];return _0x1e7529;};'use strict';var _=require('lodash');var util=require(_0xed45('0x0'));var moment=require(_0xed45('0x1'));var BPromise=require(_0xed45('0x2'));var rs=require(_0xed45('0x3'));var fs=require('fs');var Redis=require(_0xed45('0x4'));var db=require(_0xed45('0x5'))['db'];var utils=require(_0xed45('0x6'));var logger=require(_0xed45('0x7'))(_0xed45('0x8'));var config=require(_0xed45('0x9'));var jayson=require(_0xed45('0xa'));var client=jayson[_0xed45('0xb')][_0xed45('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x15e86e,_0x264f6d,_0x5a8977){return new BPromise(function(_0x2b3b44,_0x54db29){return client[_0xed45('0xd')](_0x15e86e,_0x5a8977)[_0xed45('0xe')](function(_0x18891d){logger[_0xed45('0xf')](_0xed45('0x10'),_0x264f6d,'request\x20sent');logger[_0xed45('0x11')](_0xed45('0x12'),_0x264f6d,_0xed45('0x13'),JSON[_0xed45('0x14')](_0x18891d));if(_0x18891d['error']){if(_0x18891d[_0xed45('0x15')][_0xed45('0x16')]===0x1f4){logger['error'](_0xed45('0x10'),_0x264f6d,_0x18891d[_0xed45('0x15')][_0xed45('0x17')]);return _0x54db29(_0x18891d[_0xed45('0x15')]['message']);}logger[_0xed45('0x15')](_0xed45('0x10'),_0x264f6d,_0x18891d['error'][_0xed45('0x17')]);return _0x2b3b44(_0x18891d[_0xed45('0x15')]['message']);}else{logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x264f6d,_0xed45('0x13'));_0x2b3b44(_0x18891d[_0xed45('0x18')][_0xed45('0x17')]);}})[_0xed45('0x19')](function(_0xa63732){logger[_0xed45('0x15')]('VoiceDialReport,\x20%s,\x20%s',_0x264f6d,_0xa63732);_0x54db29(_0xa63732);});});}exports[_0xed45('0x1a')]=function(_0x26758a){var _0x32ca91=this;return new Promise(function(_0x38ad43,_0x1091b3){return db[_0xed45('0x1b')]['create'](_0x26758a[_0xed45('0x1c')],{'raw':_0x26758a['options']?_0x26758a[_0xed45('0x1d')][_0xed45('0x1e')]===undefined?!![]:![]:!![]})[_0xed45('0xe')](function(_0x19f581){logger[_0xed45('0xf')](_0xed45('0x1a'),_0x26758a);logger[_0xed45('0x11')](_0xed45('0x1a'),_0x26758a,JSON['stringify'](_0x19f581));_0x38ad43(_0x19f581);})['catch'](function(_0x30bc3c){logger[_0xed45('0x15')](_0xed45('0x1a'),_0x30bc3c['message'],_0x26758a);_0x1091b3(_0x32ca91[_0xed45('0x15')](0x1f4,_0x30bc3c[_0xed45('0x17')]));});});};exports[_0xed45('0x1f')]=function(_0x49bd6c){var _0x337e7b=this;return new Promise(function(_0x5d71fe,_0x2ae456){return db[_0xed45('0x1b')][_0xed45('0x20')](_0x49bd6c[_0xed45('0x1c')],{'raw':_0x49bd6c[_0xed45('0x1d')]?_0x49bd6c['options'][_0xed45('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49bd6c[_0xed45('0x1d')]?_0x49bd6c['options']['where']||null:null,'attributes':_0x49bd6c['options']?_0x49bd6c[_0xed45('0x1d')][_0xed45('0x21')]||null:null,'limit':_0x49bd6c[_0xed45('0x1d')]?_0x49bd6c[_0xed45('0x1d')]['limit']||null:null})[_0xed45('0xe')](function(_0x427f92){logger[_0xed45('0xf')](_0xed45('0x1f'),_0x49bd6c);logger[_0xed45('0x11')](_0xed45('0x1f'),_0x49bd6c,JSON[_0xed45('0x14')](_0x427f92));_0x5d71fe(_0x427f92);})[_0xed45('0x19')](function(_0xb61813){logger[_0xed45('0x15')](_0xed45('0x1f'),_0xb61813[_0xed45('0x17')],_0x49bd6c);_0x2ae456(_0x337e7b['error'](0x1f4,_0xb61813[_0xed45('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index e3ee01f..8b6b78b 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 _0xde6b=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','create','/:id/applications','addApplications','put','update','destroy','exports','util','path','connect-timeout'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xde6b,0x1cb));var _0xbde6=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xde6b[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require('multer');var util=require(_0xbde6('0x0'));var path=require(_0xbde6('0x1'));var timeout=require(_0xbde6('0x2'));var express=require('express');var router=express[_0xbde6('0x3')]();var fs_extra=require(_0xbde6('0x4'));var auth=require(_0xbde6('0x5'));var interaction=require(_0xbde6('0x6'));var config=require(_0xbde6('0x7'));var controller=require(_0xbde6('0x8'));router[_0xbde6('0x9')]('/',auth[_0xbde6('0xa')](),controller[_0xbde6('0xb')]);router[_0xbde6('0x9')](_0xbde6('0xc'),auth[_0xbde6('0xa')](),controller[_0xbde6('0xd')]);router[_0xbde6('0xe')]('/',auth[_0xbde6('0xa')](),controller[_0xbde6('0xf')]);router[_0xbde6('0xe')](_0xbde6('0x10'),auth['isAuthenticated'](),controller[_0xbde6('0x11')]);router[_0xbde6('0x12')](_0xbde6('0xc'),auth[_0xbde6('0xa')](),controller[_0xbde6('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xbde6('0x14')]);module[_0xbde6('0x15')]=router; \ No newline at end of file +var _0xcb43=['create','addApplications','put','update','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post'];(function(_0x2e78e9,_0x42957c){var _0x35aad4=function(_0x360fa1){while(--_0x360fa1){_0x2e78e9['push'](_0x2e78e9['shift']());}};_0x35aad4(++_0x42957c);}(_0xcb43,0x148));var _0x3cb4=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0xcb43[_0x456fb1];return _0x4083d6;};'use strict';var multer=require(_0x3cb4('0x0'));var util=require(_0x3cb4('0x1'));var path=require(_0x3cb4('0x2'));var timeout=require('connect-timeout');var express=require(_0x3cb4('0x3'));var router=express[_0x3cb4('0x4')]();var fs_extra=require(_0x3cb4('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3cb4('0x6'));var config=require(_0x3cb4('0x7'));var controller=require('./voiceExtension.controller');router['get']('/',auth[_0x3cb4('0x8')](),controller[_0x3cb4('0x9')]);router[_0x3cb4('0xa')](_0x3cb4('0xb'),auth['isAuthenticated'](),controller[_0x3cb4('0xc')]);router[_0x3cb4('0xd')]('/',auth[_0x3cb4('0x8')](),controller[_0x3cb4('0xe')]);router[_0x3cb4('0xd')]('/:id/applications',auth[_0x3cb4('0x8')](),controller[_0x3cb4('0xf')]);router[_0x3cb4('0x10')](_0x3cb4('0xb'),auth[_0x3cb4('0x8')](),controller[_0x3cb4('0x11')]);router['delete'](_0x3cb4('0xb'),auth[_0x3cb4('0x8')](),controller['destroy']);module[_0x3cb4('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 6e01961..bda1cb7 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 _0x5f4c=['inbound-fax','outbound-fax','system','any','INTEGER','BOOLEAN','getDataValue','exten','sequelize','compositeIndex','STRING','NoOp','ENUM','inbound'];(function(_0x3350a0,_0x86fd48){var _0x5efabf=function(_0x56b5a8){while(--_0x56b5a8){_0x3350a0['push'](_0x3350a0['shift']());}};_0x5efabf(++_0x86fd48);}(_0x5f4c,0x1ba));var _0xc5f4=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x5f4c[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0xc5f4('0x0'));module['exports']={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc5f4('0x1'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc5f4('0x1')},'priority':{'type':Sequelize[_0xc5f4('0x2')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0xc5f4('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xc5f4('0x2')],'allowNull':![],'defaultValue':_0xc5f4('0x3')},'appdata':{'type':Sequelize[_0xc5f4('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xc5f4('0x4')](_0xc5f4('0x5'),'outbound','internal',_0xc5f4('0x6'),_0xc5f4('0x7'),_0xc5f4('0x8'),_0xc5f4('0x9')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xc5f4('0x2')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0xc5f4('0xa')]},'isApp':{'type':Sequelize[_0xc5f4('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xc5f4('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0xc5f4('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0xc5f4('0x2')],'defaultValue':'wav'},'answer':{'type':Sequelize[_0xc5f4('0xb')],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x47f019){return this[_0xc5f4('0xc')](_0xc5f4('0xd'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x0c0c=['INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound-fax','outbound-fax','system','any'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x0c0c,0xaa));var _0xc0c0=function(_0x3ddfc8,_0xc7ea18){_0x3ddfc8=_0x3ddfc8-0x0;var _0x8a9392=_0x0c0c[_0x3ddfc8];return _0x8a9392;};'use strict';var Sequelize=require(_0xc0c0('0x0'));module[_0xc0c0('0x1')]={'context':{'type':Sequelize[_0xc0c0('0x2')],'allowNull':![],'unique':_0xc0c0('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xc0c0('0x2')],'allowNull':![],'unique':_0xc0c0('0x3')},'priority':{'type':Sequelize[_0xc0c0('0x2')],'allowNull':![],'defaultValue':'1','unique':_0xc0c0('0x3')},'tag':{'type':Sequelize[_0xc0c0('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xc0c0('0x2')],'allowNull':![],'defaultValue':_0xc0c0('0x4')},'appdata':{'type':Sequelize[_0xc0c0('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xc0c0('0x5')]('inbound','outbound','internal',_0xc0c0('0x6'),_0xc0c0('0x7'),_0xc0c0('0x8'),_0xc0c0('0x9')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0xc0c0('0xa')]},'isApp':{'type':Sequelize[_0xc0c0('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xc0c0('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0xc0c0('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xc0c0('0xa')]},'recordingFormat':{'type':Sequelize[_0xc0c0('0x2')],'defaultValue':_0xc0c0('0xc')},'answer':{'type':Sequelize[_0xc0c0('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0xc0c0('0xd')],'get':function(_0x437f33){return this[_0xc0c0('0xe')]('exten');}},'alias':{'type':Sequelize[_0xc0c0('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index cd3221d..40acb62 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 _0x4722=['Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','createRouting','bulkCreate','cast(priority\x20as\x20unsigned)','finally','json','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','status','end','offset','undefined','limit','count','set','Content-Range','destroy','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','includes','find','value','type','then','sendStatus','error','stack','name','send','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','merge','where','includeAll','VoiceExtension','catch','show','keys','rawAttributes','include','params','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','context','recordingFormat','cutdigits'];(function(_0x2e4fef,_0x2afaef){var _0x1a73e9=function(_0x3c1c44){while(--_0x3c1c44){_0x2e4fef['push'](_0x2e4fef['shift']());}};_0x1a73e9(++_0x2afaef);}(_0x4722,0x161));var _0x2472=function(_0x1d8491,_0x2057dc){_0x1d8491=_0x1d8491-0x0;var _0x16a05e=_0x4722[_0x1d8491];return _0x16a05e;};'use strict';var _=require(_0x2472('0x0'));var Redis=require('ioredis');var qs=require(_0x2472('0x1'));var logger=require(_0x2472('0x2'))(_0x2472('0x3'));var config=require('../../config/environment');var db=require(_0x2472('0x4'))['db'];config[_0x2472('0x5')]=_[_0x2472('0x6')](config[_0x2472('0x5')],{'host':_0x2472('0x7'),'port':0x18eb});var socket=require(_0x2472('0x8'))(new Redis(config[_0x2472('0x5')]));require(_0x2472('0x9'))[_0x2472('0xa')](socket);function respondWithStatusCode(_0x3147a7,_0x5cc577){_0x5cc577=_0x5cc577||0xcc;return function(_0x560417){if(_0x560417){return _0x3147a7['sendStatus'](_0x5cc577);}return _0x3147a7[_0x2472('0xb')](_0x5cc577)[_0x2472('0xc')]();};}function respondWithResult(_0x4c243b,_0x22b0f3){_0x22b0f3=_0x22b0f3||0xc8;return function(_0xbab99f){if(_0xbab99f){return _0x4c243b[_0x2472('0xb')](_0x22b0f3)['json'](_0xbab99f);}};}function respondWithFilteredResult(_0x3eb866,_0x37484a){return function(_0x5a7f2a){if(_0x5a7f2a){var _0x478107=typeof _0x37484a[_0x2472('0xd')]===_0x2472('0xe')&&typeof _0x37484a[_0x2472('0xf')]==='undefined';var _0x2454cd=_0x5a7f2a[_0x2472('0x10')];var _0xa917ce=_0x478107?0x0:_0x37484a[_0x2472('0xd')];var _0x30e117=_0x478107?_0x5a7f2a[_0x2472('0x10')]:_0x37484a['offset']+_0x37484a[_0x2472('0xf')];var _0x448a13;if(_0x30e117>=_0x2454cd){_0x30e117=_0x2454cd;_0x448a13=0xc8;}else{_0x448a13=0xce;}_0x3eb866['status'](_0x448a13);return _0x3eb866[_0x2472('0x11')](_0x2472('0x12'),_0xa917ce+'-'+_0x30e117+'/'+_0x2454cd)['json'](_0x5a7f2a);}return null;};}function removeEntity(_0x331d17){return function(_0x1ad1c3){if(_0x1ad1c3){return _0x1ad1c3[_0x2472('0x13')]()['then'](function(){var _0x190c21=_0x1ad1c3[_0x2472('0x14')]({'plain':!![]});var _0x269c3c=[{'name':_0x2472('0x15'),'value':_0x2472('0x16'),'ignore':![]},{'name':_0x2472('0x17'),'value':_0x2472('0x18'),'ignore':![]},{'name':_0x2472('0x19'),'value':_0x2472('0x1a'),'ignore':![]}];var _0x3fc21f=_(_0x269c3c)[_0x2472('0x1b')](_0x2472('0x1c'))[_0x2472('0x1d')]('value')['value']();if(_[_0x2472('0x1e')](_0x3fc21f,_0x190c21['type'])){return;}var _0x5557ae=_[_0x2472('0x1f')](_0x269c3c,[_0x2472('0x20'),_0x190c21[_0x2472('0x21')]])['name'];return db['UserProfileResource']['destroy']({'where':{'type':_0x5557ae,'resourceId':_0x190c21['id']}})[_0x2472('0x22')](function(){return _0x1ad1c3;});})[_0x2472('0x22')](function(){_0x331d17[_0x2472('0xb')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2206c4){return function(_0x2de35d){if(!_0x2de35d){_0x2206c4[_0x2472('0x23')](0x194);}return _0x2de35d;};}function handleError(_0x48be46,_0x7f73dd){_0x7f73dd=_0x7f73dd||0x1f4;return function(_0x56e4e1){logger[_0x2472('0x24')](_0x56e4e1[_0x2472('0x25')]);if(_0x56e4e1[_0x2472('0x26')]){delete _0x56e4e1[_0x2472('0x26')];}_0x48be46['status'](_0x7f73dd)[_0x2472('0x27')](_0x56e4e1);};}exports['index']=function(_0x8d8d8f,_0x39ee04){var _0xf2cd16={},_0x40a247={},_0x4eeedf={'count':0x0,'rows':[]};var _0x351338=_[_0x2472('0x1d')](db['VoiceExtension']['rawAttributes'],function(_0x30734e){return{'name':_0x30734e['fieldName'],'type':_0x30734e['type'][_0x2472('0x28')]};});_0x40a247[_0x2472('0x29')]=_[_0x2472('0x1d')](_0x351338,_0x2472('0x26'));_0x40a247[_0x2472('0x2a')]=_['keys'](_0x8d8d8f[_0x2472('0x2a')]);_0x40a247[_0x2472('0x2b')]=_[_0x2472('0x2c')](_0x40a247[_0x2472('0x29')],_0x40a247[_0x2472('0x2a')]);_0xf2cd16[_0x2472('0x2d')]=_[_0x2472('0x2c')](_0x40a247[_0x2472('0x29')],qs[_0x2472('0x2e')](_0x8d8d8f[_0x2472('0x2a')][_0x2472('0x2e')]));_0xf2cd16[_0x2472('0x2d')]=_0xf2cd16[_0x2472('0x2d')]['length']?_0xf2cd16['attributes']:_0x40a247[_0x2472('0x29')];if(!_0x8d8d8f[_0x2472('0x2a')][_0x2472('0x2f')](_0x2472('0x30'))){_0xf2cd16['limit']=qs[_0x2472('0xf')](_0x8d8d8f[_0x2472('0x2a')]['limit']);_0xf2cd16['offset']=qs['offset'](_0x8d8d8f[_0x2472('0x2a')][_0x2472('0xd')]);}_0xf2cd16['order']=qs['sort'](_0x8d8d8f[_0x2472('0x2a')]['sort']);_0xf2cd16['where']=qs[_0x2472('0x2b')](_['pick'](_0x8d8d8f[_0x2472('0x2a')],_0x40a247['filters']),_0x351338);if(_0x8d8d8f['query']['filter']){_0xf2cd16['where']=_[_0x2472('0x31')](_0xf2cd16[_0x2472('0x32')],{'$or':_[_0x2472('0x1d')](_0x351338,function(_0x344838){if(_0x344838[_0x2472('0x21')]!=='VIRTUAL'){var _0x54f626={};_0x54f626[_0x344838[_0x2472('0x26')]]={'$like':'%'+_0x8d8d8f[_0x2472('0x2a')][_0x2472('0x1b')]+'%'};return _0x54f626;}})});}_0xf2cd16=_['merge']({},_0xf2cd16,_0x8d8d8f['options']);var _0x591354={'where':_0xf2cd16[_0x2472('0x32')]};return db['VoiceExtension']['count'](_0x591354)[_0x2472('0x22')](function(_0x5593ec){_0x4eeedf['count']=_0x5593ec;if(_0x8d8d8f[_0x2472('0x2a')][_0x2472('0x33')]){_0xf2cd16['include']=[{'all':!![]}];}return db[_0x2472('0x34')]['findAll'](_0xf2cd16);})[_0x2472('0x22')](function(_0x3e30b2){_0x4eeedf['rows']=_0x3e30b2;return _0x4eeedf;})[_0x2472('0x22')](respondWithFilteredResult(_0x39ee04,_0xf2cd16))[_0x2472('0x35')](handleError(_0x39ee04,null));};exports[_0x2472('0x36')]=function(_0x4631c3,_0x4713f2){var _0x5bb6bf={'raw':![],'where':{'id':_0x4631c3['params']['id']}},_0x1130c5={};_0x1130c5['model']=_[_0x2472('0x37')](db['VoiceExtension'][_0x2472('0x38')]);_0x1130c5['query']=_[_0x2472('0x37')](_0x4631c3['query']);_0x1130c5[_0x2472('0x2b')]=_[_0x2472('0x2c')](_0x1130c5[_0x2472('0x29')],_0x1130c5[_0x2472('0x2a')]);_0x5bb6bf[_0x2472('0x2d')]=_['intersection'](_0x1130c5[_0x2472('0x29')],qs[_0x2472('0x2e')](_0x4631c3['query'][_0x2472('0x2e')]));_0x5bb6bf['attributes']=_0x5bb6bf[_0x2472('0x2d')]['length']?_0x5bb6bf[_0x2472('0x2d')]:_0x1130c5[_0x2472('0x29')];if(_0x4631c3['query'][_0x2472('0x33')]){_0x5bb6bf[_0x2472('0x39')]=[{'all':!![]}];}_0x5bb6bf=_[_0x2472('0x31')]({},_0x5bb6bf,_0x4631c3['options']);return db['VoiceExtension'][_0x2472('0x1f')](_0x5bb6bf)[_0x2472('0x22')](handleEntityNotFound(_0x4713f2,null))[_0x2472('0x22')](respondWithResult(_0x4713f2,null))[_0x2472('0x35')](handleError(_0x4713f2,null));};exports[_0x2472('0x13')]=function(_0x499b9c,_0x3fb3d7){return db[_0x2472('0x34')][_0x2472('0x1f')]({'where':{'id':_0x499b9c[_0x2472('0x3a')]['id']}})[_0x2472('0x22')](handleEntityNotFound(_0x3fb3d7,null))[_0x2472('0x22')](removeEntity(_0x3fb3d7,null))[_0x2472('0x35')](handleError(_0x3fb3d7,null));};exports['create']=function(_0x749ac,_0x1d5fc3){if(_0x749ac[_0x2472('0x3b')][_0x2472('0x21')]==='outbound'&&!_[_0x2472('0x3c')](_0x749ac[_0x2472('0x3b')][_0x2472('0x3d')],'_')){_0x749ac[_0x2472('0x3b')][_0x2472('0x3d')]='_'[_0x2472('0x3e')](_0x749ac['body'][_0x2472('0x3d')]);}return db['VoiceExtension']['create'](_0x749ac['body'],{'raw':![]})[_0x2472('0x22')](function(_0x4361f7){var _0x1e4642=_0x749ac[_0x2472('0x3f')][_0x2472('0x14')]({'plain':!![]});if(!_0x1e4642)throw new Error(_0x2472('0x40'));if(_0x1e4642[_0x2472('0x41')]==='user'){var _0x54b156=_0x4361f7[_0x2472('0x14')]({'plain':!![]});var _0x57408c=[{'name':_0x2472('0x15'),'value':'inbound'},{'name':'OutboundRoutes','value':'outbound'},{'name':_0x2472('0x19'),'value':'internal'}];var _0x5528ae=_['find'](_0x57408c,['value',_0x54b156[_0x2472('0x21')]])[_0x2472('0x26')];return db[_0x2472('0x42')][_0x2472('0x1f')]({'where':{'name':_0x5528ae,'userProfileId':_0x1e4642[_0x2472('0x43')]},'raw':!![]})[_0x2472('0x22')](function(_0xe06fad){if(_0xe06fad&&_0xe06fad[_0x2472('0x44')]===0x0){return db[_0x2472('0x45')][_0x2472('0x46')]({'name':_0x54b156[_0x2472('0x26')],'resourceId':_0x54b156['id'],'type':_0xe06fad['name'],'sectionId':_0xe06fad['id']},{})['then'](function(){return _0x4361f7;});}else{return _0x4361f7;}})[_0x2472('0x35')](function(_0x36c79e){logger['error'](_0x2472('0x47'),_0x36c79e);throw _0x36c79e;});}return _0x4361f7;})[_0x2472('0x22')](respondWithResult(_0x1d5fc3,0xc9))[_0x2472('0x35')](handleError(_0x1d5fc3,null));};exports[_0x2472('0x48')]=function(_0x2f9e81,_0x3ffc9f){if(_0x2f9e81[_0x2472('0x3b')]['id']){delete _0x2f9e81['body']['id'];}return db[_0x2472('0x34')][_0x2472('0x1f')]({'where':{'id':_0x2f9e81[_0x2472('0x3a')]['id']}})[_0x2472('0x22')](handleEntityNotFound(_0x3ffc9f,null))['then'](function(_0x509dde){if(_0x509dde){return db[_0x2472('0x34')][_0x2472('0x48')](_[_0x2472('0x49')](_0x2f9e81[_0x2472('0x3b')],[_0x2472('0x3d'),_0x2472('0x4a'),'description',_0x2472('0x4b'),_0x2472('0x4c'),'mandatoryDisposition','alias']),{'where':{'context':_0x509dde[_0x2472('0x4a')],'exten':_0x509dde[_0x2472('0x3d')]},'individualHooks':!![]})['then'](function(_0xd48f50){return _0xd48f50;});}return null;})[_0x2472('0x22')](respondWithStatusCode(_0x3ffc9f,null))[_0x2472('0x35')](handleError(_0x3ffc9f,null));};exports['addApplications']=function(_0x131bb1,_0x15817f){var _0x4a22e3=_0x131bb1[_0x2472('0x3a')]['id'];var _0x2e60a7=_0x131bb1[_0x2472('0x3b')];var _0x5b8068=0xc8;var _0x1c1669=null;return db['sequelize']['transaction']({'isolationLevel':db['sequelize'][_0x2472('0x4d')][_0x2472('0x4e')][_0x2472('0x4f')]},function(_0x5c61cc){return db['VoiceExtension'][_0x2472('0x50')]({'where':{'id':_0x4a22e3},'transaction':_0x5c61cc})['then'](function(_0x41947f){if(_0x41947f){return db[_0x2472('0x34')]['destroy']({'where':{'VoiceExtensionId':_0x4a22e3},'transaction':_0x5c61cc})[_0x2472('0x22')](function(){var _0x5b8b19=_[_0x2472('0x1d')](_0x2e60a7,function(_0xebb56b){_0xebb56b['VoiceExtensionId']=_0x4a22e3;_0xebb56b['isApp']=!![];return _0xebb56b;});return _0x41947f[_0x2472('0x51')](_0x5b8b19);})[_0x2472('0x22')](function(_0x2dcca6){return db[_0x2472('0x34')][_0x2472('0x52')](_0x2dcca6,{'transaction':_0x5c61cc});});}else{_0x5b8068=0x194;_0x1c1669=[];}});})[_0x2472('0x22')](function(){if(_0x5b8068!==0x194){return db[_0x2472('0x34')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x4a22e3},'order':_0x2472('0x53')})[_0x2472('0x22')](function(_0x522d74){_0x1c1669=_0x522d74;});}})[_0x2472('0x35')](function(_0x5dd5ba){_0x5b8068=0x1f4;logger[_0x2472('0x24')](_0x5dd5ba[_0x2472('0x25')]);if(_0x5dd5ba[_0x2472('0x26')]){delete _0x5dd5ba[_0x2472('0x26')];}_0x1c1669=_0x5dd5ba;})[_0x2472('0x54')](function(){if(_0x1c1669===null){_0x15817f[_0x2472('0x23')](_0x5b8068);}else{if(_0x5b8068===0x1f4){_0x15817f['status'](_0x5b8068)[_0x2472('0x27')](_0x1c1669);}else{_0x15817f['status'](_0x5b8068)[_0x2472('0x55')](_0x1c1669);}}});}; \ No newline at end of file +var _0x11b7=['UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','recordingFormat','cutdigits','mandatoryDisposition','alias','context','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','bulkCreate','cast(priority\x20as\x20unsigned)','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','./voiceExtension.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','get','InboundRoutes','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','value','includes','type','UserProfileResource','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','VoiceExtension','includeAll','include','findAll','rows','catch','show','params','find','create','body','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x11b7,0xd6));var _0x711b=function(_0x508fa4,_0x36dd59){_0x508fa4=_0x508fa4-0x0;var _0x3b0bd4=_0x11b7[_0x508fa4];return _0x3b0bd4;};'use strict';var _=require(_0x711b('0x0'));var Redis=require(_0x711b('0x1'));var qs=require(_0x711b('0x2'));var logger=require(_0x711b('0x3'))(_0x711b('0x4'));var config=require('../../config/environment');var db=require(_0x711b('0x5'))['db'];config[_0x711b('0x6')]=_[_0x711b('0x7')](config[_0x711b('0x6')],{'host':_0x711b('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x711b('0x6')]));require(_0x711b('0x9'))[_0x711b('0xa')](socket);function respondWithStatusCode(_0x18a21f,_0x1e365f){_0x1e365f=_0x1e365f||0xcc;return function(_0x2dc370){if(_0x2dc370){return _0x18a21f['sendStatus'](_0x1e365f);}return _0x18a21f[_0x711b('0xb')](_0x1e365f)[_0x711b('0xc')]();};}function respondWithResult(_0x1f009b,_0x534341){_0x534341=_0x534341||0xc8;return function(_0x7da8f6){if(_0x7da8f6){return _0x1f009b['status'](_0x534341)[_0x711b('0xd')](_0x7da8f6);}};}function respondWithFilteredResult(_0x315cd5,_0x32692b){return function(_0x5ae0db){if(_0x5ae0db){var _0x2bcf10=typeof _0x32692b[_0x711b('0xe')]===_0x711b('0xf')&&typeof _0x32692b[_0x711b('0x10')]===_0x711b('0xf');var _0x57db08=_0x5ae0db[_0x711b('0x11')];var _0x526230=_0x2bcf10?0x0:_0x32692b[_0x711b('0xe')];var _0x2e93d0=_0x2bcf10?_0x5ae0db['count']:_0x32692b['offset']+_0x32692b[_0x711b('0x10')];var _0x4625be;if(_0x2e93d0>=_0x57db08){_0x2e93d0=_0x57db08;_0x4625be=0xc8;}else{_0x4625be=0xce;}_0x315cd5[_0x711b('0xb')](_0x4625be);return _0x315cd5[_0x711b('0x12')](_0x711b('0x13'),_0x526230+'-'+_0x2e93d0+'/'+_0x57db08)[_0x711b('0xd')](_0x5ae0db);}return null;};}function removeEntity(_0x1919d4){return function(_0x58dea5){if(_0x58dea5){return _0x58dea5[_0x711b('0x14')]()['then'](function(){var _0x284db3=_0x58dea5[_0x711b('0x15')]({'plain':!![]});var _0x87d66a=[{'name':_0x711b('0x16'),'value':'inbound','ignore':![]},{'name':_0x711b('0x17'),'value':_0x711b('0x18'),'ignore':![]},{'name':_0x711b('0x19'),'value':_0x711b('0x1a'),'ignore':![]}];var _0x4bb428=_(_0x87d66a)[_0x711b('0x1b')](_0x711b('0x1c'))['map'](_0x711b('0x1d'))['value']();if(_[_0x711b('0x1e')](_0x4bb428,_0x284db3[_0x711b('0x1f')])){return;}var _0x34b26d=_['find'](_0x87d66a,['value',_0x284db3[_0x711b('0x1f')]])['name'];return db[_0x711b('0x20')][_0x711b('0x14')]({'where':{'type':_0x34b26d,'resourceId':_0x284db3['id']}})[_0x711b('0x21')](function(){return _0x58dea5;});})[_0x711b('0x21')](function(){_0x1919d4[_0x711b('0xb')](0xcc)[_0x711b('0xc')]();});}};}function handleEntityNotFound(_0x5cd4f2){return function(_0x4cfbbf){if(!_0x4cfbbf){_0x5cd4f2[_0x711b('0x22')](0x194);}return _0x4cfbbf;};}function handleError(_0x4a0aff,_0x191f39){_0x191f39=_0x191f39||0x1f4;return function(_0x5df301){logger[_0x711b('0x23')](_0x5df301[_0x711b('0x24')]);if(_0x5df301['name']){delete _0x5df301[_0x711b('0x25')];}_0x4a0aff['status'](_0x191f39)[_0x711b('0x26')](_0x5df301);};}exports[_0x711b('0x27')]=function(_0x2b78f8,_0x36c30c){var _0x3309e0={},_0x3febd0={},_0x2d016b={'count':0x0,'rows':[]};var _0x16d5e5=_[_0x711b('0x28')](db['VoiceExtension'][_0x711b('0x29')],function(_0x2c72de){return{'name':_0x2c72de[_0x711b('0x2a')],'type':_0x2c72de['type'][_0x711b('0x2b')]};});_0x3febd0['model']=_[_0x711b('0x28')](_0x16d5e5,_0x711b('0x25'));_0x3febd0[_0x711b('0x2c')]=_[_0x711b('0x2d')](_0x2b78f8[_0x711b('0x2c')]);_0x3febd0[_0x711b('0x2e')]=_[_0x711b('0x2f')](_0x3febd0[_0x711b('0x30')],_0x3febd0[_0x711b('0x2c')]);_0x3309e0[_0x711b('0x31')]=_[_0x711b('0x2f')](_0x3febd0[_0x711b('0x30')],qs['fields'](_0x2b78f8[_0x711b('0x2c')][_0x711b('0x32')]));_0x3309e0[_0x711b('0x31')]=_0x3309e0[_0x711b('0x31')][_0x711b('0x33')]?_0x3309e0[_0x711b('0x31')]:_0x3febd0[_0x711b('0x30')];if(!_0x2b78f8[_0x711b('0x2c')][_0x711b('0x34')](_0x711b('0x35'))){_0x3309e0[_0x711b('0x10')]=qs['limit'](_0x2b78f8['query'][_0x711b('0x10')]);_0x3309e0[_0x711b('0xe')]=qs[_0x711b('0xe')](_0x2b78f8['query'][_0x711b('0xe')]);}_0x3309e0[_0x711b('0x36')]=qs['sort'](_0x2b78f8[_0x711b('0x2c')][_0x711b('0x37')]);_0x3309e0[_0x711b('0x38')]=qs[_0x711b('0x2e')](_[_0x711b('0x39')](_0x2b78f8[_0x711b('0x2c')],_0x3febd0[_0x711b('0x2e')]),_0x16d5e5);if(_0x2b78f8['query']['filter']){_0x3309e0[_0x711b('0x38')]=_[_0x711b('0x3a')](_0x3309e0[_0x711b('0x38')],{'$or':_[_0x711b('0x28')](_0x16d5e5,function(_0x535bde){if(_0x535bde[_0x711b('0x1f')]!==_0x711b('0x3b')){var _0x19da65={};_0x19da65[_0x535bde[_0x711b('0x25')]]={'$like':'%'+_0x2b78f8['query'][_0x711b('0x1b')]+'%'};return _0x19da65;}})});}_0x3309e0=_[_0x711b('0x3a')]({},_0x3309e0,_0x2b78f8[_0x711b('0x3c')]);var _0x24ce59={'where':_0x3309e0[_0x711b('0x38')]};return db[_0x711b('0x3d')]['count'](_0x24ce59)[_0x711b('0x21')](function(_0x38a9fe){_0x2d016b['count']=_0x38a9fe;if(_0x2b78f8[_0x711b('0x2c')][_0x711b('0x3e')]){_0x3309e0[_0x711b('0x3f')]=[{'all':!![]}];}return db['VoiceExtension'][_0x711b('0x40')](_0x3309e0);})[_0x711b('0x21')](function(_0x4a8b90){_0x2d016b[_0x711b('0x41')]=_0x4a8b90;return _0x2d016b;})['then'](respondWithFilteredResult(_0x36c30c,_0x3309e0))[_0x711b('0x42')](handleError(_0x36c30c,null));};exports[_0x711b('0x43')]=function(_0xf55286,_0x1e635a){var _0x573147={'raw':![],'where':{'id':_0xf55286[_0x711b('0x44')]['id']}},_0x50dd0b={};_0x50dd0b[_0x711b('0x30')]=_['keys'](db['VoiceExtension'][_0x711b('0x29')]);_0x50dd0b[_0x711b('0x2c')]=_[_0x711b('0x2d')](_0xf55286['query']);_0x50dd0b[_0x711b('0x2e')]=_[_0x711b('0x2f')](_0x50dd0b[_0x711b('0x30')],_0x50dd0b[_0x711b('0x2c')]);_0x573147['attributes']=_[_0x711b('0x2f')](_0x50dd0b[_0x711b('0x30')],qs['fields'](_0xf55286[_0x711b('0x2c')][_0x711b('0x32')]));_0x573147[_0x711b('0x31')]=_0x573147[_0x711b('0x31')][_0x711b('0x33')]?_0x573147[_0x711b('0x31')]:_0x50dd0b[_0x711b('0x30')];if(_0xf55286[_0x711b('0x2c')]['includeAll']){_0x573147[_0x711b('0x3f')]=[{'all':!![]}];}_0x573147=_['merge']({},_0x573147,_0xf55286['options']);return db[_0x711b('0x3d')][_0x711b('0x45')](_0x573147)[_0x711b('0x21')](handleEntityNotFound(_0x1e635a,null))[_0x711b('0x21')](respondWithResult(_0x1e635a,null))[_0x711b('0x42')](handleError(_0x1e635a,null));};exports[_0x711b('0x14')]=function(_0xc9dcf2,_0x25466f){return db[_0x711b('0x3d')]['find']({'where':{'id':_0xc9dcf2[_0x711b('0x44')]['id']}})[_0x711b('0x21')](handleEntityNotFound(_0x25466f,null))[_0x711b('0x21')](removeEntity(_0x25466f,null))[_0x711b('0x42')](handleError(_0x25466f,null));};exports[_0x711b('0x46')]=function(_0xc07f4d,_0x4839a3){if(_0xc07f4d['body'][_0x711b('0x1f')]===_0x711b('0x18')&&!_['startsWith'](_0xc07f4d[_0x711b('0x47')][_0x711b('0x48')],'_')){_0xc07f4d[_0x711b('0x47')]['exten']='_'[_0x711b('0x49')](_0xc07f4d[_0x711b('0x47')][_0x711b('0x48')]);}return db['VoiceExtension'][_0x711b('0x46')](_0xc07f4d[_0x711b('0x47')],{'raw':![]})[_0x711b('0x21')](function(_0x39b84c){var _0x395e42=_0xc07f4d[_0x711b('0x4a')]['get']({'plain':!![]});if(!_0x395e42)throw new Error(_0x711b('0x4b'));if(_0x395e42[_0x711b('0x4c')]==='user'){var _0x34d6d7=_0x39b84c[_0x711b('0x15')]({'plain':!![]});var _0x438736=[{'name':'InboundRoutes','value':'inbound'},{'name':_0x711b('0x17'),'value':_0x711b('0x18')},{'name':_0x711b('0x19'),'value':'internal'}];var _0x5b15bc=_['find'](_0x438736,['value',_0x34d6d7[_0x711b('0x1f')]])['name'];return db[_0x711b('0x4d')]['find']({'where':{'name':_0x5b15bc,'userProfileId':_0x395e42[_0x711b('0x4e')]},'raw':!![]})[_0x711b('0x21')](function(_0x562aaf){if(_0x562aaf&&_0x562aaf[_0x711b('0x4f')]===0x0){return db[_0x711b('0x20')][_0x711b('0x46')]({'name':_0x34d6d7[_0x711b('0x25')],'resourceId':_0x34d6d7['id'],'type':_0x562aaf[_0x711b('0x25')],'sectionId':_0x562aaf['id']},{})['then'](function(){return _0x39b84c;});}else{return _0x39b84c;}})[_0x711b('0x42')](function(_0xc0cfbb){logger[_0x711b('0x23')](_0x711b('0x50'),_0xc0cfbb);throw _0xc0cfbb;});}return _0x39b84c;})[_0x711b('0x21')](respondWithResult(_0x4839a3,0xc9))['catch'](handleError(_0x4839a3,null));};exports[_0x711b('0x51')]=function(_0x4c11fa,_0x529948){if(_0x4c11fa[_0x711b('0x47')]['id']){delete _0x4c11fa[_0x711b('0x47')]['id'];}return db[_0x711b('0x3d')][_0x711b('0x45')]({'where':{'id':_0x4c11fa[_0x711b('0x44')]['id']}})[_0x711b('0x21')](handleEntityNotFound(_0x529948,null))[_0x711b('0x21')](function(_0x3ba185){if(_0x3ba185){return db[_0x711b('0x3d')][_0x711b('0x51')](_['pick'](_0x4c11fa[_0x711b('0x47')],[_0x711b('0x48'),'context',_0x711b('0x52'),_0x711b('0x53'),_0x711b('0x54'),_0x711b('0x55'),_0x711b('0x56')]),{'where':{'context':_0x3ba185[_0x711b('0x57')],'exten':_0x3ba185['exten']},'individualHooks':!![]})[_0x711b('0x21')](function(_0x5a692a){return _0x5a692a;});}return null;})[_0x711b('0x21')](respondWithStatusCode(_0x529948,null))[_0x711b('0x42')](handleError(_0x529948,null));};exports['addApplications']=function(_0x1643ea,_0x49a4a9){var _0x38ce38=_0x1643ea[_0x711b('0x44')]['id'];var _0x45715f=_0x1643ea[_0x711b('0x47')];var _0x360db2=0xc8;var _0xf9fdb=null;return db[_0x711b('0x58')][_0x711b('0x59')]({'isolationLevel':db['sequelize'][_0x711b('0x5a')][_0x711b('0x5b')][_0x711b('0x5c')]},function(_0x40b5fd){return db[_0x711b('0x3d')][_0x711b('0x5d')]({'where':{'id':_0x38ce38},'transaction':_0x40b5fd})[_0x711b('0x21')](function(_0x5b2cd4){if(_0x5b2cd4){return db[_0x711b('0x3d')]['destroy']({'where':{'VoiceExtensionId':_0x38ce38},'transaction':_0x40b5fd})[_0x711b('0x21')](function(){var _0x3819ab=_[_0x711b('0x28')](_0x45715f,function(_0x29c8ae){_0x29c8ae[_0x711b('0x5e')]=_0x38ce38;_0x29c8ae['isApp']=!![];return _0x29c8ae;});return _0x5b2cd4['createRouting'](_0x3819ab);})['then'](function(_0x14ecd2){return db['VoiceExtension'][_0x711b('0x5f')](_0x14ecd2,{'transaction':_0x40b5fd});});}else{_0x360db2=0x194;_0xf9fdb=[];}});})['then'](function(){if(_0x360db2!==0x194){return db['VoiceExtension']['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x38ce38},'order':_0x711b('0x60')})[_0x711b('0x21')](function(_0x3af5a4){_0xf9fdb=_0x3af5a4;});}})['catch'](function(_0x4dece8){_0x360db2=0x1f4;logger[_0x711b('0x23')](_0x4dece8[_0x711b('0x24')]);if(_0x4dece8[_0x711b('0x25')]){delete _0x4dece8['name'];}_0xf9fdb=_0x4dece8;})['finally'](function(){if(_0xf9fdb===null){_0x49a4a9[_0x711b('0x22')](_0x360db2);}else{if(_0x360db2===0x1f4){_0x49a4a9[_0x711b('0xb')](_0x360db2)[_0x711b('0x26')](_0xf9fdb);}else{_0x49a4a9[_0x711b('0xb')](_0x360db2)['json'](_0xf9fdb);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index a155a36..9dd0ccc 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 _0x3f12=['hook','events','VoiceExtension','save','update','emit','hasOwnProperty'];(function(_0x189bd4,_0x6954af){var _0x31e195=function(_0x269a71){while(--_0x269a71){_0x189bd4['push'](_0x189bd4['shift']());}};_0x31e195(++_0x6954af);}(_0x3f12,0xa2));var _0x23f1=function(_0x397c4c,_0x4af56e){_0x397c4c=_0x397c4c-0x0;var _0x116427=_0x3f12[_0x397c4c];return _0x116427;};'use strict';var EventEmitter=require(_0x23f1('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x23f1('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x23f1('0x2'),'afterUpdate':_0x23f1('0x3'),'afterDestroy':'remove'};function emitEvent(_0x57bc95){return function(_0x4369b6,_0x493263,_0x5f187e){VoiceExtensionEvents['emit'](_0x57bc95+':'+_0x4369b6['id'],_0x4369b6);VoiceExtensionEvents[_0x23f1('0x4')](_0x57bc95,_0x4369b6);_0x5f187e(null);};}for(var e in events){if(events[_0x23f1('0x5')](e)){var event=events[e];VoiceExtension[_0x23f1('0x6')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0xa867=['update','remove','emit','hasOwnProperty','hook','VoiceExtension','setMaxListeners'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xa867,0x15c));var _0x7a86=function(_0x19e7a2,_0x2da155){_0x19e7a2=_0x19e7a2-0x0;var _0xf04960=_0xa867[_0x19e7a2];return _0xf04960;};'use strict';var EventEmitter=require('events');var VoiceExtension=require('../../mysqldb')['db'][_0x7a86('0x0')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x7a86('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7a86('0x2'),'afterDestroy':_0x7a86('0x3')};function emitEvent(_0x101d36){return function(_0xb0fc56,_0x579d75,_0x34783b){VoiceExtensionEvents['emit'](_0x101d36+':'+_0xb0fc56['id'],_0xb0fc56);VoiceExtensionEvents[_0x7a86('0x4')](_0x101d36,_0xb0fc56);_0x34783b(null);};}for(var e in events){if(events[_0x7a86('0x5')](e)){var event=events[e];VoiceExtension[_0x7a86('0x6')](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 9e09c13..7d26c4d 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 _0x4ab0=['param','split','phone','prefix','${EXTEN}','join','options','indexOf','U(xcally-mixmonitor-context)','replace','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)=','queue','playback','includes','appType','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','concat','catch','define','voice_extensions','get','Hangup','./voiceExtension.attributes','exports','models','Set','CDR(type)=','context','exten','type','NoOp','alias','CDR(routeAlias)=','No\x20alias\x20set','push','inbound','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','CDR(type)=outbound','outbound','CDR(destination)=','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','timeout','length','name','trunk'];(function(_0x1715dd,_0x3d30e5){var _0x59cab3=function(_0x47b0fe){while(--_0x47b0fe){_0x1715dd['push'](_0x1715dd['shift']());}};_0x59cab3(++_0x3d30e5);}(_0x4ab0,0xd5));var _0x04ab=function(_0x40c4ba,_0x2b2833){_0x40c4ba=_0x40c4ba-0x0;var _0x234c81=_0x4ab0[_0x40c4ba];return _0x234c81;};'use strict';var _=require('lodash');var attributes=require(_0x04ab('0x0'));module[_0x04ab('0x1')]=function(_0x203005){var _0x3d8417=_0x203005[_0x04ab('0x2')];function _0x51135e(_0x4c3a53){var _0x45dfee=0x2;var _0xb1bf2d=[{'type':_0x4c3a53['type'],'app':_0x04ab('0x3'),'appdata':_0x04ab('0x4')+_0x4c3a53['type'],'context':_0x4c3a53[_0x04ab('0x5')],'exten':_0x4c3a53[_0x04ab('0x6')],'priority':_0x45dfee++,'VoiceExtensionId':_0x4c3a53['id']},{'type':_0x4c3a53[_0x04ab('0x7')],'app':_0x4c3a53['alias']?_0x04ab('0x3'):_0x04ab('0x8'),'appdata':_0x4c3a53[_0x04ab('0x9')]?_0x04ab('0xa')+_0x4c3a53['alias']:_0x04ab('0xb'),'context':_0x4c3a53[_0x04ab('0x5')],'exten':_0x4c3a53[_0x04ab('0x6')],'priority':_0x45dfee++,'VoiceExtensionId':_0x4c3a53['id']}];if(_0x4c3a53[_0x04ab('0x7')]==='inbound'){_0xb1bf2d[_0x04ab('0xc')]({'type':_0x04ab('0xd'),'app':_0x04ab('0x3'),'appdata':_0x04ab('0xe')+_0x4c3a53['id'],'context':_0x4c3a53[_0x04ab('0x5')],'exten':_0x4c3a53[_0x04ab('0x6')],'priority':_0x45dfee++,'VoiceExtensionId':_0x4c3a53['id']});}_0xb1bf2d['push']({'type':_0x4c3a53[_0x04ab('0x7')],'app':'Set','appdata':_0x04ab('0xf'),'context':_0x4c3a53[_0x04ab('0x5')],'exten':_0x4c3a53[_0x04ab('0x6')],'priority':_0x45dfee++,'VoiceExtensionId':_0x4c3a53['id']},{'type':_0x4c3a53[_0x04ab('0x7')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x4c3a53['context'],'exten':_0x4c3a53[_0x04ab('0x6')],'priority':_0x45dfee++,'VoiceExtensionId':_0x4c3a53['id']},{'type':_0x4c3a53[_0x04ab('0x7')],'app':_0x04ab('0x3'),'appdata':_0x04ab('0x10'),'context':_0x4c3a53[_0x04ab('0x5')],'exten':_0x4c3a53[_0x04ab('0x6')],'priority':_0x45dfee++,'VoiceExtensionId':_0x4c3a53['id']});return _0xb1bf2d;}function _0x42c937(_0x384f89){var _0x1f3251=0x2;var _0x205600=[{'type':'outbound','app':_0x04ab('0x3'),'appdata':_0x04ab('0x11'),'context':_0x384f89[_0x04ab('0x5')],'exten':_0x384f89[_0x04ab('0x6')],'priority':_0x1f3251++,'VoiceExtensionId':_0x384f89['id']},{'type':_0x04ab('0x12'),'app':_0x384f89[_0x04ab('0x9')]?_0x04ab('0x3'):_0x04ab('0x8'),'appdata':_0x384f89[_0x04ab('0x9')]?'CDR(routeAlias)='+_0x384f89[_0x04ab('0x9')]:'No\x20alias\x20set','context':_0x384f89[_0x04ab('0x5')],'exten':_0x384f89[_0x04ab('0x6')],'priority':_0x1f3251++,'VoiceExtensionId':_0x384f89['id']},{'type':_0x04ab('0x12'),'app':'Set','appdata':_0x04ab('0x13')+(_0x384f89[_0x04ab('0x14')]?_0x04ab('0x15')+_0x384f89['cutdigits']+'}':'${EXTEN}'),'context':_0x384f89[_0x04ab('0x5')],'exten':_0x384f89[_0x04ab('0x6')],'priority':_0x1f3251++,'VoiceExtensionId':_0x384f89['id']},{'type':'outbound','app':'Set','appdata':_0x04ab('0xe')+_0x384f89['id'],'context':_0x384f89[_0x04ab('0x5')],'exten':_0x384f89[_0x04ab('0x6')],'priority':_0x1f3251++,'VoiceExtensionId':_0x384f89['id']},{'type':_0x04ab('0x12'),'app':_0x04ab('0x16'),'appdata':_0x04ab('0x17')+(_0x1f3251+0x2)+_0x04ab('0x18')+(_0x1f3251+0x1)+')','context':_0x384f89[_0x04ab('0x5')],'exten':_0x384f89[_0x04ab('0x6')],'priority':_0x1f3251++,'VoiceExtensionId':_0x384f89['id']},{'type':'outbound','app':_0x04ab('0x3'),'appdata':_0x384f89[_0x04ab('0x14')]?_0x04ab('0x19')+_0x384f89[_0x04ab('0x14')]+'}':'CDR(prefix)=noprefix','context':_0x384f89['context'],'exten':_0x384f89[_0x04ab('0x6')],'priority':_0x1f3251++,'VoiceExtensionId':_0x384f89['id']},{'type':'outbound','app':_0x04ab('0x3'),'appdata':_0x04ab('0xf'),'context':_0x384f89[_0x04ab('0x5')],'exten':_0x384f89[_0x04ab('0x6')],'priority':_0x1f3251++,'VoiceExtensionId':_0x384f89['id']},{'type':_0x04ab('0x12'),'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x384f89[_0x04ab('0x5')],'exten':_0x384f89[_0x04ab('0x6')],'priority':_0x1f3251++,'VoiceExtensionId':_0x384f89['id']},{'type':_0x04ab('0x12'),'app':_0x04ab('0x3'),'appdata':_0x04ab('0x10'),'context':_0x384f89[_0x04ab('0x5')],'exten':_0x384f89[_0x04ab('0x6')],'priority':_0x1f3251++,'VoiceExtensionId':_0x384f89['id']},{'type':_0x04ab('0x12'),'app':_0x04ab('0x3'),'appdata':_0x04ab('0x1a')+_0x384f89['id'],'context':_0x384f89[_0x04ab('0x5')],'exten':_0x384f89[_0x04ab('0x6')],'priority':_0x1f3251++,'VoiceExtensionId':_0x384f89['id']}];if(_0x384f89[_0x04ab('0x1b')]('recordingFormat')&&_0x384f89[_0x04ab('0x1c')]!==_0x04ab('0x1d')){_0x205600['push']({'type':_0x04ab('0x12'),'app':_0x04ab('0x3'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x384f89[_0x04ab('0x5')],'exten':_0x384f89[_0x04ab('0x6')],'priority':_0x1f3251++,'VoiceExtensionId':_0x384f89['id']},{'type':'outbound','app':_0x04ab('0x3'),'appdata':_0x04ab('0x1e')+_0x384f89[_0x04ab('0x1c')]||_0x04ab('0x1f'),'context':_0x384f89[_0x04ab('0x5')],'exten':_0x384f89[_0x04ab('0x6')],'priority':_0x1f3251++,'VoiceExtensionId':_0x384f89['id']});}return _0x205600;}function _0x538cf7(_0x2dab83,_0x3f4d83){var _0x2ad8ee=[{'name':'trunk','param':0x0},{'name':_0x04ab('0x20'),'param':0x1},{'name':'options','param':0x2},{'name':'url','param':0x3}];var _0x5e5a9a={};var _0x3b7b51=_0x3f4d83['split'](',');var _0x40995c=[];for(var _0x487093=0x0;_0x487093<_0x2ad8ee[_0x04ab('0x21')];_0x487093++){switch(_0x2ad8ee[_0x487093][_0x04ab('0x22')]){case _0x04ab('0x23'):_0x5e5a9a[_0x04ab('0x23')]=_0x3b7b51[_0x2ad8ee[_0x487093][_0x04ab('0x24')]][_0x04ab('0x25')]('/')[0x1];_0x5e5a9a[_0x04ab('0x26')]=_0x3b7b51[_0x2ad8ee[_0x487093][_0x04ab('0x24')]][_0x04ab('0x25')]('/')[0x2];_0x5e5a9a[_0x04ab('0x27')]=_0x5e5a9a[_0x04ab('0x26')]?_0x5e5a9a[_0x04ab('0x26')]['split']('$')[0x0]:undefined;_0x5e5a9a[_0x04ab('0x26')]=_0x2dab83[_0x04ab('0x14')]?(_0x5e5a9a['prefix']||'')+'${EXTEN:'+_0x2dab83[_0x04ab('0x14')]+'}':(_0x5e5a9a[_0x04ab('0x27')]||'')+_0x04ab('0x28');_0x40995c[_0x2ad8ee[_0x487093][_0x04ab('0x24')]]=['SIP',_0x5e5a9a[_0x04ab('0x23')],_0x5e5a9a[_0x04ab('0x26')]][_0x04ab('0x29')]('/');break;case _0x04ab('0x2a'):_0x5e5a9a['options']=_0x3b7b51[_0x2ad8ee[_0x487093][_0x04ab('0x24')]];if(_0x2dab83[_0x04ab('0x1c')]!==_0x04ab('0x1d')){if(_0x5e5a9a[_0x04ab('0x2a')][_0x04ab('0x2b')](_0x04ab('0x2c'))<0x0){_0x5e5a9a[_0x04ab('0x2a')]+=_0x04ab('0x2c');}}else{_0x5e5a9a['options']=_0x5e5a9a['options'][_0x04ab('0x2d')](_0x04ab('0x2c'),'');}_0x40995c[_0x2ad8ee[_0x487093][_0x04ab('0x24')]]=_0x5e5a9a[_0x04ab('0x2a')];break;default:_0x40995c[_0x2ad8ee[_0x487093][_0x04ab('0x24')]]=_0x3b7b51[_0x2ad8ee[_0x487093]['param']];}}return _0x40995c[_0x04ab('0x29')](',');}function _0x1c425f(_0x1d5ec6,_0x5c8a12,_0x30d11d){return new Promise(function(_0x1f30f2,_0x437f7a){var _0x437a9f=[];if(_[_0x04ab('0x2e')](_0x5c8a12))return _0x1f30f2(_0x437a9f);_0x3d8417[_0x04ab('0x2f')][_0x04ab('0x30')]({'attributes':['id',_0x04ab('0x31'),_0x04ab('0x32')],'raw':!![]})[_0x04ab('0x33')](function(_0x49999e){for(var _0x1b07db=0x0,_0xaac4e3=0x0;_0x1b07db<_0x5c8a12[_0x04ab('0x21')];_0x1b07db++,_0xaac4e3=0x0){var _0x440482=_0x5c8a12[_0x1b07db];var _0x3d9653=[];var _0x245528=[];delete _0x440482['id'];if(_0x440482['interval']!==_0x04ab('0x34')){_0x440482[_0x04ab('0x35')]=[_0x440482[_0x04ab('0x31')]];}else{_0x440482[_0x04ab('0x35')]=_0x440482['IntervalId']?_[_0x04ab('0x36')](_[_0x04ab('0x37')](_0x49999e,{'IntervalId':_0x440482[_0x04ab('0x32')]}),_0x04ab('0x31')):[];}_0x440482[_0x04ab('0x5')]=_0x1d5ec6['context'];_0x440482[_0x04ab('0x6')]=_0x1d5ec6[_0x04ab('0x6')];if(_0x440482['type'])_0x440482['type']=_0x440482[_0x04ab('0x7')][_0x04ab('0x38')]();if(_0x1d5ec6[_0x04ab('0x7')]===_0x04ab('0x12')){if(_0x440482[_0x04ab('0x1b')](_0x04ab('0x39'))&&_0x440482[_0x04ab('0x39')]&&_0x440482['tag']!=='--'){_0x3d9653[_0x04ab('0xc')]({'type':_0x440482[_0x04ab('0x7')][_0x04ab('0x38')](),'app':'Set','appdata':_0x04ab('0x3a')+_0x440482[_0x04ab('0x39')],'context':_0x1d5ec6['context'],'exten':_0x1d5ec6[_0x04ab('0x6')],'priority':_0x440482['intervals'][_0x04ab('0x21')]+_0x30d11d+_0xaac4e3++,'VoiceExtensionId':_0x1d5ec6['id']});}_0x3d9653['push']({'type':_0x440482[_0x04ab('0x7')]['toLowerCase'](),'app':'ExecIf','appdata':_0x04ab('0x3b')+(_0x440482[_0x04ab('0x3c')]?_0x04ab('0x3d')+_0x440482['callerID']+')':'NoOp(No\x20number\x20available)'),'context':_0x1d5ec6[_0x04ab('0x5')],'exten':_0x1d5ec6[_0x04ab('0x6')],'priority':_0x440482[_0x04ab('0x35')]['length']+_0x30d11d+_0xaac4e3++,'VoiceExtensionId':_0x1d5ec6['id']});}else{if(_0x440482[_0x04ab('0x1b')]('answer')){if([_0x04ab('0x3e'),_0x04ab('0x3f')][_0x04ab('0x40')](_0x440482['app'][_0x04ab('0x38')]())&&_0x440482[_0x04ab('0x41')]!==_0x04ab('0x42')){if(_0x440482[_0x04ab('0x43')]){_0x3d9653[_0x04ab('0xc')]({'type':_0x440482[_0x04ab('0x7')][_0x04ab('0x38')](),'app':_0x04ab('0x16'),'appdata':_0x04ab('0x44'),'context':_0x1d5ec6[_0x04ab('0x5')],'exten':_0x1d5ec6[_0x04ab('0x6')],'priority':_0x440482['intervals'][_0x04ab('0x21')]+_0x30d11d+_0xaac4e3++,'VoiceExtensionId':_0x1d5ec6['id']});_0x3d9653['push']({'type':_0x440482[_0x04ab('0x7')][_0x04ab('0x38')](),'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x1d5ec6[_0x04ab('0x5')],'exten':_0x1d5ec6[_0x04ab('0x6')],'priority':_0x440482[_0x04ab('0x35')][_0x04ab('0x21')]+_0x30d11d+_0xaac4e3++,'VoiceExtensionId':_0x1d5ec6['id']});}else{_0x3d9653[_0x04ab('0xc')]({'type':_0x440482[_0x04ab('0x7')][_0x04ab('0x38')](),'app':_0x04ab('0x16'),'appdata':_0x04ab('0x45'),'context':_0x1d5ec6['context'],'exten':_0x1d5ec6[_0x04ab('0x6')],'priority':_0x440482[_0x04ab('0x35')][_0x04ab('0x21')]+_0x30d11d+_0xaac4e3++,'VoiceExtensionId':_0x1d5ec6['id']});_0x3d9653['push']({'type':_0x440482[_0x04ab('0x7')][_0x04ab('0x38')](),'app':_0x04ab('0x3'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x1d5ec6[_0x04ab('0x5')],'exten':_0x1d5ec6[_0x04ab('0x6')],'priority':_0x440482[_0x04ab('0x35')][_0x04ab('0x21')]+_0x30d11d+_0xaac4e3++,'VoiceExtensionId':_0x1d5ec6['id']});}}}}for(var _0x59ddca=0x0;_0x59ddca<_0x440482[_0x04ab('0x35')]['length'];_0x59ddca++){var _0x811a23=_0x30d11d+_0x440482[_0x04ab('0x35')]['length'];var _0x3245b2=_0x59ddca===_0x440482['intervals'][_0x04ab('0x21')]-0x1?_0x30d11d+_0x3d9653[_0x04ab('0x21')]+_0x245528[_0x04ab('0x21')]+0x2:_0x30d11d+_0x59ddca+0x1;_0x3d9653[_0x04ab('0x46')](_0x59ddca,0x0,{'type':_0x1d5ec6['type'],'app':_0x04ab('0x47'),'appdata':_0x440482[_0x04ab('0x35')][_0x59ddca]+'?'+_0x1d5ec6[_0x04ab('0x5')]+_0x04ab('0x48')+_0x811a23+':'+_0x1d5ec6[_0x04ab('0x5')]+_0x04ab('0x48')+_0x3245b2,'exten':_0x1d5ec6[_0x04ab('0x6')],'context':_0x1d5ec6[_0x04ab('0x5')],'priority':_0x30d11d+_0x59ddca,'VoiceExtensionId':_0x1d5ec6['id']});}if(_0x440482[_0x04ab('0x41')]===_0x04ab('0x49'))_0x440482[_0x04ab('0x4a')]=_0x538cf7(_0x1d5ec6,_0x440482[_0x04ab('0x4a')]);_0x440482[_0x04ab('0x4b')]=_0x3d9653[_0x04ab('0x21')]?_[_0x04ab('0x4c')](_0x3d9653)[_0x04ab('0x4b')]+0x1:_0x30d11d;_0x437a9f=_[_0x04ab('0x4d')](_0x437a9f,_0x3d9653,[_0x440482],_0x245528);_0x30d11d=_[_0x04ab('0x4c')](_0x437a9f)[_0x04ab('0x4b')]+0x1;}return _0x1f30f2(_0x437a9f);})[_0x04ab('0x4e')](function(_0x3554e9){_0x437f7a(_0x3554e9);});});}return _0x203005[_0x04ab('0x4f')]('VoiceExtension',attributes,{'tableName':_0x04ab('0x50'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x4f57f3){var _0x4761=this[_0x04ab('0x51')]({'plain':!![]});var _0x2e6521=_0x4761['type']===_0x04ab('0x12')?_0x42c937(_0x4761):_0x51135e(_0x4761);return _0x1c425f(_0x4761,_0x4f57f3,_[_0x04ab('0x4c')](_0x2e6521)[_0x04ab('0x4b')]+0x1)['then'](function(_0x2f5be4){var _0x9630bb=_[_0x04ab('0x4d')](_0x2e6521,_0x2f5be4);_0x9630bb['push']({'type':_0x4761[_0x04ab('0x7')],'app':_0x04ab('0x52'),'exten':_0x4761['exten'],'context':_0x4761[_0x04ab('0x5')],'priority':_['last'](_0x9630bb)['priority']+0x1,'VoiceExtensionId':_0x4761['id']});return _0x9630bb;});}}});}; \ No newline at end of file +var _0xc4a1=['Set','CDR(type)=','context','exten','alias','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','outbound','CDR(type)=outbound','NoOp','CDR(destination)=','cutdigits','${EXTEN:','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','MONITOR_OPTIONS=ab','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','trunk','timeout','url','length','name','param','split','phone','prefix','SIP','join','options','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','concat','VoiceExtension','get','Hangup','lodash','exports','type'];(function(_0x23be0b,_0x95d7d0){var _0x4af33b=function(_0x5cd56a){while(--_0x5cd56a){_0x23be0b['push'](_0x23be0b['shift']());}};_0x4af33b(++_0x95d7d0);}(_0xc4a1,0x1ef));var _0x1c4a=function(_0x46dc08,_0x398f4b){_0x46dc08=_0x46dc08-0x0;var _0x3f067e=_0xc4a1[_0x46dc08];return _0x3f067e;};'use strict';var _=require(_0x1c4a('0x0'));var attributes=require('./voiceExtension.attributes');module[_0x1c4a('0x1')]=function(_0xab754c){var _0x2e5eea=_0xab754c['models'];function _0x105b6f(_0x1b0091){var _0x132b97=0x2;var _0x3a1a32=[{'type':_0x1b0091[_0x1c4a('0x2')],'app':_0x1c4a('0x3'),'appdata':_0x1c4a('0x4')+_0x1b0091[_0x1c4a('0x2')],'context':_0x1b0091[_0x1c4a('0x5')],'exten':_0x1b0091[_0x1c4a('0x6')],'priority':_0x132b97++,'VoiceExtensionId':_0x1b0091['id']},{'type':_0x1b0091[_0x1c4a('0x2')],'app':_0x1b0091[_0x1c4a('0x7')]?_0x1c4a('0x3'):'NoOp','appdata':_0x1b0091[_0x1c4a('0x7')]?_0x1c4a('0x8')+_0x1b0091['alias']:_0x1c4a('0x9'),'context':_0x1b0091['context'],'exten':_0x1b0091['exten'],'priority':_0x132b97++,'VoiceExtensionId':_0x1b0091['id']}];if(_0x1b0091[_0x1c4a('0x2')]===_0x1c4a('0xa')){_0x3a1a32['push']({'type':_0x1c4a('0xa'),'app':_0x1c4a('0x3'),'appdata':'CDR(routeid)='+_0x1b0091['id'],'context':_0x1b0091['context'],'exten':_0x1b0091[_0x1c4a('0x6')],'priority':_0x132b97++,'VoiceExtensionId':_0x1b0091['id']});}_0x3a1a32[_0x1c4a('0xb')]({'type':_0x1b0091['type'],'app':'Set','appdata':_0x1c4a('0xc'),'context':_0x1b0091[_0x1c4a('0x5')],'exten':_0x1b0091[_0x1c4a('0x6')],'priority':_0x132b97++,'VoiceExtensionId':_0x1b0091['id']},{'type':_0x1b0091[_0x1c4a('0x2')],'app':_0x1c4a('0x3'),'appdata':_0x1c4a('0xd'),'context':_0x1b0091[_0x1c4a('0x5')],'exten':_0x1b0091[_0x1c4a('0x6')],'priority':_0x132b97++,'VoiceExtensionId':_0x1b0091['id']},{'type':_0x1b0091[_0x1c4a('0x2')],'app':_0x1c4a('0x3'),'appdata':'MONITOR_OPTIONS=ab','context':_0x1b0091[_0x1c4a('0x5')],'exten':_0x1b0091[_0x1c4a('0x6')],'priority':_0x132b97++,'VoiceExtensionId':_0x1b0091['id']});return _0x3a1a32;}function _0x1b1358(_0x36be47){var _0x4e7781=0x2;var _0x57a68a=[{'type':_0x1c4a('0xe'),'app':_0x1c4a('0x3'),'appdata':_0x1c4a('0xf'),'context':_0x36be47[_0x1c4a('0x5')],'exten':_0x36be47['exten'],'priority':_0x4e7781++,'VoiceExtensionId':_0x36be47['id']},{'type':_0x1c4a('0xe'),'app':_0x36be47[_0x1c4a('0x7')]?'Set':_0x1c4a('0x10'),'appdata':_0x36be47[_0x1c4a('0x7')]?_0x1c4a('0x8')+_0x36be47['alias']:'No\x20alias\x20set','context':_0x36be47[_0x1c4a('0x5')],'exten':_0x36be47[_0x1c4a('0x6')],'priority':_0x4e7781++,'VoiceExtensionId':_0x36be47['id']},{'type':'outbound','app':'Set','appdata':_0x1c4a('0x11')+(_0x36be47[_0x1c4a('0x12')]?_0x1c4a('0x13')+_0x36be47[_0x1c4a('0x12')]+'}':'${EXTEN}'),'context':_0x36be47[_0x1c4a('0x5')],'exten':_0x36be47[_0x1c4a('0x6')],'priority':_0x4e7781++,'VoiceExtensionId':_0x36be47['id']},{'type':_0x1c4a('0xe'),'app':_0x1c4a('0x3'),'appdata':_0x1c4a('0x14')+_0x36be47['id'],'context':_0x36be47[_0x1c4a('0x5')],'exten':_0x36be47[_0x1c4a('0x6')],'priority':_0x4e7781++,'VoiceExtensionId':_0x36be47['id']},{'type':_0x1c4a('0xe'),'app':_0x1c4a('0x15'),'appdata':_0x1c4a('0x16')+(_0x4e7781+0x2)+_0x1c4a('0x17')+(_0x4e7781+0x1)+')','context':_0x36be47[_0x1c4a('0x5')],'exten':_0x36be47['exten'],'priority':_0x4e7781++,'VoiceExtensionId':_0x36be47['id']},{'type':_0x1c4a('0xe'),'app':_0x1c4a('0x3'),'appdata':_0x36be47[_0x1c4a('0x12')]?_0x1c4a('0x18')+_0x36be47[_0x1c4a('0x12')]+'}':_0x1c4a('0x19'),'context':_0x36be47[_0x1c4a('0x5')],'exten':_0x36be47[_0x1c4a('0x6')],'priority':_0x4e7781++,'VoiceExtensionId':_0x36be47['id']},{'type':_0x1c4a('0xe'),'app':_0x1c4a('0x3'),'appdata':_0x1c4a('0xc'),'context':_0x36be47[_0x1c4a('0x5')],'exten':_0x36be47[_0x1c4a('0x6')],'priority':_0x4e7781++,'VoiceExtensionId':_0x36be47['id']},{'type':_0x1c4a('0xe'),'app':_0x1c4a('0x3'),'appdata':_0x1c4a('0xd'),'context':_0x36be47[_0x1c4a('0x5')],'exten':_0x36be47[_0x1c4a('0x6')],'priority':_0x4e7781++,'VoiceExtensionId':_0x36be47['id']},{'type':_0x1c4a('0xe'),'app':'Set','appdata':_0x1c4a('0x1a'),'context':_0x36be47['context'],'exten':_0x36be47[_0x1c4a('0x6')],'priority':_0x4e7781++,'VoiceExtensionId':_0x36be47['id']},{'type':_0x1c4a('0xe'),'app':_0x1c4a('0x3'),'appdata':'outboundrouteid='+_0x36be47['id'],'context':_0x36be47[_0x1c4a('0x5')],'exten':_0x36be47['exten'],'priority':_0x4e7781++,'VoiceExtensionId':_0x36be47['id']}];if(_0x36be47[_0x1c4a('0x1b')](_0x1c4a('0x1c'))&&_0x36be47[_0x1c4a('0x1c')]!==_0x1c4a('0x1d')){_0x57a68a[_0x1c4a('0xb')]({'type':'outbound','app':'Set','appdata':_0x1c4a('0x1e'),'context':_0x36be47['context'],'exten':_0x36be47[_0x1c4a('0x6')],'priority':_0x4e7781++,'VoiceExtensionId':_0x36be47['id']},{'type':_0x1c4a('0xe'),'app':_0x1c4a('0x3'),'appdata':_0x1c4a('0x1f')+_0x36be47['recordingFormat']||'wav','context':_0x36be47[_0x1c4a('0x5')],'exten':_0x36be47[_0x1c4a('0x6')],'priority':_0x4e7781++,'VoiceExtensionId':_0x36be47['id']});}return _0x57a68a;}function _0xba2cfa(_0x2c2b99,_0x2640e0){var _0x5d2da2=[{'name':_0x1c4a('0x20'),'param':0x0},{'name':_0x1c4a('0x21'),'param':0x1},{'name':'options','param':0x2},{'name':_0x1c4a('0x22'),'param':0x3}];var _0x2965a2={};var _0x48b4d5=_0x2640e0['split'](',');var _0x596f60=[];for(var _0x45a66f=0x0;_0x45a66f<_0x5d2da2[_0x1c4a('0x23')];_0x45a66f++){switch(_0x5d2da2[_0x45a66f][_0x1c4a('0x24')]){case'trunk':_0x2965a2[_0x1c4a('0x20')]=_0x48b4d5[_0x5d2da2[_0x45a66f][_0x1c4a('0x25')]][_0x1c4a('0x26')]('/')[0x1];_0x2965a2[_0x1c4a('0x27')]=_0x48b4d5[_0x5d2da2[_0x45a66f][_0x1c4a('0x25')]][_0x1c4a('0x26')]('/')[0x2];_0x2965a2['prefix']=_0x2965a2['phone']?_0x2965a2[_0x1c4a('0x27')][_0x1c4a('0x26')]('$')[0x0]:undefined;_0x2965a2['phone']=_0x2c2b99[_0x1c4a('0x12')]?(_0x2965a2[_0x1c4a('0x28')]||'')+_0x1c4a('0x13')+_0x2c2b99['cutdigits']+'}':(_0x2965a2[_0x1c4a('0x28')]||'')+'${EXTEN}';_0x596f60[_0x5d2da2[_0x45a66f][_0x1c4a('0x25')]]=[_0x1c4a('0x29'),_0x2965a2[_0x1c4a('0x20')],_0x2965a2[_0x1c4a('0x27')]][_0x1c4a('0x2a')]('/');break;case _0x1c4a('0x2b'):_0x2965a2[_0x1c4a('0x2b')]=_0x48b4d5[_0x5d2da2[_0x45a66f][_0x1c4a('0x25')]];if(_0x2c2b99[_0x1c4a('0x1c')]!=='none'){if(_0x2965a2[_0x1c4a('0x2b')]['indexOf'](_0x1c4a('0x2c'))<0x0){_0x2965a2[_0x1c4a('0x2b')]+=_0x1c4a('0x2c');}}else{_0x2965a2[_0x1c4a('0x2b')]=_0x2965a2[_0x1c4a('0x2b')][_0x1c4a('0x2d')](_0x1c4a('0x2c'),'');}_0x596f60[_0x5d2da2[_0x45a66f][_0x1c4a('0x25')]]=_0x2965a2[_0x1c4a('0x2b')];break;default:_0x596f60[_0x5d2da2[_0x45a66f][_0x1c4a('0x25')]]=_0x48b4d5[_0x5d2da2[_0x45a66f][_0x1c4a('0x25')]];}}return _0x596f60[_0x1c4a('0x2a')](',');}function _0x269feb(_0x3388c6,_0x2f98e1,_0x77d8f6){return new Promise(function(_0x4beea0,_0xce3e09){var _0x38be7d=[];if(_[_0x1c4a('0x2e')](_0x2f98e1))return _0x4beea0(_0x38be7d);_0x2e5eea[_0x1c4a('0x2f')][_0x1c4a('0x30')]({'attributes':['id',_0x1c4a('0x31'),_0x1c4a('0x32')],'raw':!![]})[_0x1c4a('0x33')](function(_0x260748){for(var _0x3d7e00=0x0,_0xac60c6=0x0;_0x3d7e00<_0x2f98e1[_0x1c4a('0x23')];_0x3d7e00++,_0xac60c6=0x0){var _0x155059=_0x2f98e1[_0x3d7e00];var _0x5ed4be=[];var _0x5615c0=[];delete _0x155059['id'];if(_0x155059[_0x1c4a('0x31')]!==_0x1c4a('0x34')){_0x155059[_0x1c4a('0x35')]=[_0x155059[_0x1c4a('0x31')]];}else{_0x155059[_0x1c4a('0x35')]=_0x155059['IntervalId']?_[_0x1c4a('0x36')](_['filter'](_0x260748,{'IntervalId':_0x155059['IntervalId']}),_0x1c4a('0x31')):[];}_0x155059[_0x1c4a('0x5')]=_0x3388c6[_0x1c4a('0x5')];_0x155059[_0x1c4a('0x6')]=_0x3388c6[_0x1c4a('0x6')];if(_0x155059[_0x1c4a('0x2')])_0x155059[_0x1c4a('0x2')]=_0x155059[_0x1c4a('0x2')][_0x1c4a('0x37')]();if(_0x3388c6[_0x1c4a('0x2')]===_0x1c4a('0xe')){if(_0x155059[_0x1c4a('0x1b')](_0x1c4a('0x38'))&&_0x155059[_0x1c4a('0x38')]&&_0x155059[_0x1c4a('0x38')]!=='--'){_0x5ed4be[_0x1c4a('0xb')]({'type':_0x155059['type'][_0x1c4a('0x37')](),'app':_0x1c4a('0x3'),'appdata':_0x1c4a('0x39')+_0x155059[_0x1c4a('0x38')],'context':_0x3388c6['context'],'exten':_0x3388c6[_0x1c4a('0x6')],'priority':_0x155059[_0x1c4a('0x35')][_0x1c4a('0x23')]+_0x77d8f6+_0xac60c6++,'VoiceExtensionId':_0x3388c6['id']});}_0x5ed4be['push']({'type':_0x155059['type'][_0x1c4a('0x37')](),'app':_0x1c4a('0x15'),'appdata':_0x1c4a('0x3a')+(_0x155059['callerID']?'Set(CALLERID(all)='+_0x155059[_0x1c4a('0x3b')]+')':_0x1c4a('0x3c')),'context':_0x3388c6[_0x1c4a('0x5')],'exten':_0x3388c6[_0x1c4a('0x6')],'priority':_0x155059[_0x1c4a('0x35')]['length']+_0x77d8f6+_0xac60c6++,'VoiceExtensionId':_0x3388c6['id']});}else{if(_0x155059[_0x1c4a('0x1b')](_0x1c4a('0x3d'))){if([_0x1c4a('0x3e'),_0x1c4a('0x3f')][_0x1c4a('0x40')](_0x155059[_0x1c4a('0x41')][_0x1c4a('0x37')]())&&_0x155059[_0x1c4a('0x42')]!==_0x1c4a('0x43')){if(_0x155059[_0x1c4a('0x3d')]){_0x5ed4be[_0x1c4a('0xb')]({'type':_0x155059[_0x1c4a('0x2')][_0x1c4a('0x37')](),'app':_0x1c4a('0x15'),'appdata':_0x1c4a('0x44'),'context':_0x3388c6[_0x1c4a('0x5')],'exten':_0x3388c6[_0x1c4a('0x6')],'priority':_0x155059[_0x1c4a('0x35')][_0x1c4a('0x23')]+_0x77d8f6+_0xac60c6++,'VoiceExtensionId':_0x3388c6['id']});_0x5ed4be[_0x1c4a('0xb')]({'type':_0x155059[_0x1c4a('0x2')][_0x1c4a('0x37')](),'app':_0x1c4a('0x3'),'appdata':_0x1c4a('0x45'),'context':_0x3388c6['context'],'exten':_0x3388c6[_0x1c4a('0x6')],'priority':_0x155059[_0x1c4a('0x35')][_0x1c4a('0x23')]+_0x77d8f6+_0xac60c6++,'VoiceExtensionId':_0x3388c6['id']});}else{_0x5ed4be['push']({'type':_0x155059[_0x1c4a('0x2')]['toLowerCase'](),'app':_0x1c4a('0x15'),'appdata':_0x1c4a('0x46'),'context':_0x3388c6[_0x1c4a('0x5')],'exten':_0x3388c6[_0x1c4a('0x6')],'priority':_0x155059[_0x1c4a('0x35')][_0x1c4a('0x23')]+_0x77d8f6+_0xac60c6++,'VoiceExtensionId':_0x3388c6['id']});_0x5ed4be[_0x1c4a('0xb')]({'type':_0x155059[_0x1c4a('0x2')][_0x1c4a('0x37')](),'app':_0x1c4a('0x3'),'appdata':_0x1c4a('0x47'),'context':_0x3388c6[_0x1c4a('0x5')],'exten':_0x3388c6['exten'],'priority':_0x155059[_0x1c4a('0x35')][_0x1c4a('0x23')]+_0x77d8f6+_0xac60c6++,'VoiceExtensionId':_0x3388c6['id']});}}}}for(var _0x2d3d0a=0x0;_0x2d3d0a<_0x155059[_0x1c4a('0x35')]['length'];_0x2d3d0a++){var _0x5ded2f=_0x77d8f6+_0x155059['intervals'][_0x1c4a('0x23')];var _0xb32d4c=_0x2d3d0a===_0x155059[_0x1c4a('0x35')]['length']-0x1?_0x77d8f6+_0x5ed4be[_0x1c4a('0x23')]+_0x5615c0[_0x1c4a('0x23')]+0x2:_0x77d8f6+_0x2d3d0a+0x1;_0x5ed4be[_0x1c4a('0x48')](_0x2d3d0a,0x0,{'type':_0x3388c6[_0x1c4a('0x2')],'app':_0x1c4a('0x49'),'appdata':_0x155059[_0x1c4a('0x35')][_0x2d3d0a]+'?'+_0x3388c6[_0x1c4a('0x5')]+_0x1c4a('0x4a')+_0x5ded2f+':'+_0x3388c6[_0x1c4a('0x5')]+',${EXTEN},'+_0xb32d4c,'exten':_0x3388c6[_0x1c4a('0x6')],'context':_0x3388c6[_0x1c4a('0x5')],'priority':_0x77d8f6+_0x2d3d0a,'VoiceExtensionId':_0x3388c6['id']});}if(_0x155059['appType']===_0x1c4a('0x4b'))_0x155059[_0x1c4a('0x4c')]=_0xba2cfa(_0x3388c6,_0x155059['appdata']);_0x155059[_0x1c4a('0x4d')]=_0x5ed4be[_0x1c4a('0x23')]?_[_0x1c4a('0x4e')](_0x5ed4be)[_0x1c4a('0x4d')]+0x1:_0x77d8f6;_0x38be7d=_[_0x1c4a('0x4f')](_0x38be7d,_0x5ed4be,[_0x155059],_0x5615c0);_0x77d8f6=_['last'](_0x38be7d)[_0x1c4a('0x4d')]+0x1;}return _0x4beea0(_0x38be7d);})['catch'](function(_0x424613){_0xce3e09(_0x424613);});});}return _0xab754c['define'](_0x1c4a('0x50'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x4dd257){var _0x7a8533=this[_0x1c4a('0x51')]({'plain':!![]});var _0x3bef10=_0x7a8533[_0x1c4a('0x2')]===_0x1c4a('0xe')?_0x1b1358(_0x7a8533):_0x105b6f(_0x7a8533);return _0x269feb(_0x7a8533,_0x4dd257,_[_0x1c4a('0x4e')](_0x3bef10)[_0x1c4a('0x4d')]+0x1)['then'](function(_0x49b655){var _0x294890=_[_0x1c4a('0x4f')](_0x3bef10,_0x49b655);_0x294890[_0x1c4a('0xb')]({'type':_0x7a8533[_0x1c4a('0x2')],'app':_0x1c4a('0x52'),'exten':_0x7a8533[_0x1c4a('0x6')],'context':_0x7a8533[_0x1c4a('0x5')],'priority':_['last'](_0x294890)[_0x1c4a('0x4d')]+0x1,'VoiceExtensionId':_0x7a8533['id']});return _0x294890;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 2b98321..7504916 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 _0x9ab0=['localhost','socket.io-emitter','./voiceExtension.socket','info','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','include','map','model','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','defaults'];(function(_0x48dfb8,_0x2b7194){var _0x5c96c4=function(_0xd02431){while(--_0xd02431){_0x48dfb8['push'](_0x48dfb8['shift']());}};_0x5c96c4(++_0x2b7194);}(_0x9ab0,0x195));var _0x09ab=function(_0x33656a,_0x355dac){_0x33656a=_0x33656a-0x0;var _0x305631=_0x9ab0[_0x33656a];return _0x305631;};'use strict';var _=require(_0x09ab('0x0'));var util=require(_0x09ab('0x1'));var moment=require(_0x09ab('0x2'));var BPromise=require(_0x09ab('0x3'));var rs=require(_0x09ab('0x4'));var fs=require('fs');var Redis=require(_0x09ab('0x5'));var db=require(_0x09ab('0x6'))['db'];var utils=require(_0x09ab('0x7'));var logger=require(_0x09ab('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x09ab('0x9')][_0x09ab('0xa')]({'port':0x232a});config[_0x09ab('0xb')]=_[_0x09ab('0xc')](config[_0x09ab('0xb')],{'host':_0x09ab('0xd'),'port':0x18eb});var socket=require(_0x09ab('0xe'))(new Redis(config[_0x09ab('0xb')]));require(_0x09ab('0xf'))['register'](socket);function respondWithRpcPromise(_0xfb19c3,_0x5ee23c,_0x10fc51){return new BPromise(function(_0x426e31,_0x2d03e2){return client['request'](_0xfb19c3,_0x10fc51)['then'](function(_0x147a79){logger[_0x09ab('0x10')]('VoiceExtension,\x20%s,\x20%s',_0x5ee23c,'request\x20sent');logger[_0x09ab('0x11')](_0x09ab('0x12'),_0x5ee23c,_0x09ab('0x13'),JSON[_0x09ab('0x14')](_0x147a79));if(_0x147a79[_0x09ab('0x15')]){if(_0x147a79[_0x09ab('0x15')][_0x09ab('0x16')]===0x1f4){logger[_0x09ab('0x15')](_0x09ab('0x17'),_0x5ee23c,_0x147a79[_0x09ab('0x15')][_0x09ab('0x18')]);return _0x2d03e2(_0x147a79[_0x09ab('0x15')]['message']);}logger[_0x09ab('0x15')](_0x09ab('0x17'),_0x5ee23c,_0x147a79[_0x09ab('0x15')]['message']);return _0x426e31(_0x147a79[_0x09ab('0x15')][_0x09ab('0x18')]);}else{logger[_0x09ab('0x10')]('VoiceExtension,\x20%s,\x20%s',_0x5ee23c,_0x09ab('0x13'));_0x426e31(_0x147a79[_0x09ab('0x19')][_0x09ab('0x18')]);}})[_0x09ab('0x1a')](function(_0x2e3af2){logger[_0x09ab('0x15')]('VoiceExtension,\x20%s,\x20%s',_0x5ee23c,_0x2e3af2);_0x2d03e2(_0x2e3af2);});});}exports[_0x09ab('0x1b')]=function(_0x437ffc){var _0x4a2a7b=this;return new Promise(function(_0xddb65d,_0x6a3b15){return db[_0x09ab('0x1c')][_0x09ab('0x1d')]({'raw':_0x437ffc[_0x09ab('0x1e')]?_0x437ffc[_0x09ab('0x1e')][_0x09ab('0x1f')]===undefined?!![]:![]:!![],'where':_0x437ffc[_0x09ab('0x1e')]?_0x437ffc['options'][_0x09ab('0x20')]||null:null,'attributes':_0x437ffc[_0x09ab('0x1e')]?_0x437ffc[_0x09ab('0x1e')][_0x09ab('0x21')]||null:null,'limit':_0x437ffc[_0x09ab('0x1e')]?_0x437ffc[_0x09ab('0x1e')]['limit']||null:null,'include':_0x437ffc[_0x09ab('0x1e')]?_0x437ffc[_0x09ab('0x1e')][_0x09ab('0x22')]?_[_0x09ab('0x23')](_0x437ffc[_0x09ab('0x1e')]['include'],function(_0x50a95b){return{'model':db[_0x50a95b[_0x09ab('0x24')]],'as':_0x50a95b['as'],'attributes':_0x50a95b[_0x09ab('0x21')],'include':_0x50a95b['include']?_[_0x09ab('0x23')](_0x50a95b[_0x09ab('0x22')],function(_0x22d3dd){return{'model':db[_0x22d3dd[_0x09ab('0x24')]],'as':_0x22d3dd['as'],'attributes':_0x22d3dd[_0x09ab('0x21')],'include':_0x22d3dd[_0x09ab('0x22')]?_[_0x09ab('0x23')](_0x22d3dd[_0x09ab('0x22')],function(_0x55c5f0){return{'model':db[_0x55c5f0[_0x09ab('0x24')]],'as':_0x55c5f0['as'],'attributes':_0x55c5f0[_0x09ab('0x21')]};}):[]};}):[]};}):[]:[]})[_0x09ab('0x25')](function(_0x333684){logger[_0x09ab('0x10')](_0x09ab('0x1b'),_0x437ffc);logger[_0x09ab('0x11')](_0x09ab('0x1b'),_0x437ffc,JSON[_0x09ab('0x14')](_0x333684));_0xddb65d(_0x333684);})[_0x09ab('0x1a')](function(_0x12f4f2){logger[_0x09ab('0x15')](_0x09ab('0x1b'),_0x12f4f2['message'],_0x437ffc);_0x6a3b15(_0x4a2a7b[_0x09ab('0x15')](0x1f4,_0x12f4f2[_0x09ab('0x18')]));});});}; \ No newline at end of file +var _0x3595=['stringify','error','code','message','result','GetVoiceExtension','VoiceExtension','options','where','limit','include','map','attributes','model','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s'];(function(_0x1768f0,_0x24083a){var _0xaf56f=function(_0x16b3a5){while(--_0x16b3a5){_0x1768f0['push'](_0x1768f0['shift']());}};_0xaf56f(++_0x24083a);}(_0x3595,0x147));var _0x5359=function(_0x4cfbc1,_0x19582b){_0x4cfbc1=_0x4cfbc1-0x0;var _0x4b951d=_0x3595[_0x4cfbc1];return _0x4b951d;};'use strict';var _=require(_0x5359('0x0'));var util=require(_0x5359('0x1'));var moment=require(_0x5359('0x2'));var BPromise=require('bluebird');var rs=require(_0x5359('0x3'));var fs=require('fs');var Redis=require(_0x5359('0x4'));var db=require(_0x5359('0x5'))['db'];var utils=require(_0x5359('0x6'));var logger=require(_0x5359('0x7'))(_0x5359('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5359('0x9')][_0x5359('0xa')]({'port':0x232a});config[_0x5359('0xb')]=_[_0x5359('0xc')](config[_0x5359('0xb')],{'host':_0x5359('0xd'),'port':0x18eb});var socket=require(_0x5359('0xe'))(new Redis(config[_0x5359('0xb')]));require(_0x5359('0xf'))[_0x5359('0x10')](socket);function respondWithRpcPromise(_0x5d33a0,_0x4804bb,_0x4c70d7){return new BPromise(function(_0x541386,_0x1496b5){return client[_0x5359('0x11')](_0x5d33a0,_0x4c70d7)[_0x5359('0x12')](function(_0x2f7a5b){logger[_0x5359('0x13')](_0x5359('0x14'),_0x4804bb,_0x5359('0x15'));logger[_0x5359('0x16')](_0x5359('0x17'),_0x4804bb,_0x5359('0x15'),JSON[_0x5359('0x18')](_0x2f7a5b));if(_0x2f7a5b[_0x5359('0x19')]){if(_0x2f7a5b[_0x5359('0x19')][_0x5359('0x1a')]===0x1f4){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x4804bb,_0x2f7a5b[_0x5359('0x19')][_0x5359('0x1b')]);return _0x1496b5(_0x2f7a5b[_0x5359('0x19')][_0x5359('0x1b')]);}logger[_0x5359('0x19')](_0x5359('0x14'),_0x4804bb,_0x2f7a5b['error']['message']);return _0x541386(_0x2f7a5b[_0x5359('0x19')][_0x5359('0x1b')]);}else{logger['info'](_0x5359('0x14'),_0x4804bb,_0x5359('0x15'));_0x541386(_0x2f7a5b[_0x5359('0x1c')][_0x5359('0x1b')]);}})['catch'](function(_0x50d158){logger['error'](_0x5359('0x14'),_0x4804bb,_0x50d158);_0x1496b5(_0x50d158);});});}exports[_0x5359('0x1d')]=function(_0x53f00f){var _0x35e920=this;return new Promise(function(_0x211580,_0x45bf1c){return db[_0x5359('0x1e')]['findAll']({'raw':_0x53f00f[_0x5359('0x1f')]?_0x53f00f[_0x5359('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x53f00f[_0x5359('0x1f')]?_0x53f00f[_0x5359('0x1f')][_0x5359('0x20')]||null:null,'attributes':_0x53f00f[_0x5359('0x1f')]?_0x53f00f[_0x5359('0x1f')]['attributes']||null:null,'limit':_0x53f00f['options']?_0x53f00f[_0x5359('0x1f')][_0x5359('0x21')]||null:null,'include':_0x53f00f[_0x5359('0x1f')]?_0x53f00f[_0x5359('0x1f')][_0x5359('0x22')]?_[_0x5359('0x23')](_0x53f00f[_0x5359('0x1f')][_0x5359('0x22')],function(_0x3fea11){return{'model':db[_0x3fea11['model']],'as':_0x3fea11['as'],'attributes':_0x3fea11[_0x5359('0x24')],'include':_0x3fea11[_0x5359('0x22')]?_[_0x5359('0x23')](_0x3fea11[_0x5359('0x22')],function(_0x234c96){return{'model':db[_0x234c96[_0x5359('0x25')]],'as':_0x234c96['as'],'attributes':_0x234c96['attributes'],'include':_0x234c96[_0x5359('0x22')]?_['map'](_0x234c96[_0x5359('0x22')],function(_0x4b130a){return{'model':db[_0x4b130a[_0x5359('0x25')]],'as':_0x4b130a['as'],'attributes':_0x4b130a[_0x5359('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x9fc4a){logger['info'](_0x5359('0x1d'),_0x53f00f);logger[_0x5359('0x16')](_0x5359('0x1d'),_0x53f00f,JSON[_0x5359('0x18')](_0x9fc4a));_0x211580(_0x9fc4a);})[_0x5359('0x26')](function(_0x3a2552){logger[_0x5359('0x19')](_0x5359('0x1d'),_0x3a2552[_0x5359('0x1b')],_0x53f00f);_0x45bf1c(_0x35e920[_0x5359('0x19')](0x1f4,_0x3a2552[_0x5359('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index e1de812..1b10bd4 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 _0x1cb9=['update','emit','removeListener','register','length','./voiceExtension.events','remove'];(function(_0x3cea78,_0x4a6751){var _0x33b66b=function(_0x1f45cd){while(--_0x1f45cd){_0x3cea78['push'](_0x3cea78['shift']());}};_0x33b66b(++_0x4a6751);}(_0x1cb9,0x14e));var _0x91cb=function(_0x5670d6,_0x3af941){_0x5670d6=_0x5670d6-0x0;var _0x4d5a68=_0x1cb9[_0x5670d6];return _0x4d5a68;};'use strict';var VoiceExtensionEvents=require(_0x91cb('0x0'));var events=['save',_0x91cb('0x1'),_0x91cb('0x2')];function createListener(_0x2b1894,_0x351bdb){return function(_0x57ea48){_0x351bdb[_0x91cb('0x3')](_0x2b1894,_0x57ea48);};}function removeListener(_0x2b7314,_0x5652cd){return function(){VoiceExtensionEvents[_0x91cb('0x4')](_0x2b7314,_0x5652cd);};}exports[_0x91cb('0x5')]=function(_0x186dc3){for(var _0x28543e=0x0,_0x3b9d98=events[_0x91cb('0x6')];_0x28543e<_0x3b9d98;_0x28543e++){var _0x4c1f56=events[_0x28543e];var _0x15c517=createListener('voiceExtension:'+_0x4c1f56,_0x186dc3);VoiceExtensionEvents['on'](_0x4c1f56,_0x15c517);}}; \ No newline at end of file +var _0xabce=['voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0x39c2fa,_0x393904){var _0x4ea5cf=function(_0x1abf55){while(--_0x1abf55){_0x39c2fa['push'](_0x39c2fa['shift']());}};_0x4ea5cf(++_0x393904);}(_0xabce,0x103));var _0xeabc=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xabce[_0x481bf7];return _0x461787;};'use strict';var VoiceExtensionEvents=require(_0xeabc('0x0'));var events=[_0xeabc('0x1'),_0xeabc('0x2'),_0xeabc('0x3')];function createListener(_0x49dbcc,_0x5bd1a4){return function(_0x5ebc95){_0x5bd1a4[_0xeabc('0x4')](_0x49dbcc,_0x5ebc95);};}function removeListener(_0x1d9f37,_0x1a88a7){return function(){VoiceExtensionEvents['removeListener'](_0x1d9f37,_0x1a88a7);};}exports['register']=function(_0x1b07a8){for(var _0x52a4d7=0x0,_0x229ba4=events['length'];_0x52a4d7<_0x229ba4;_0x52a4d7++){var _0x3bdc29=events[_0x52a4d7];var _0x9417af=createListener(_0xeabc('0x5')+_0x3bdc29,_0x1b07a8);VoiceExtensionEvents['on'](_0x3bdc29,_0x9417af);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 88d8321..718deac 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 _0x7ee1=['fs-extra','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','index','isAuthenticated','/:id/messages','create','/:id','update','delete','exports','multer','express','Router'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0x7ee1,0x8d));var _0x17ee=function(_0x3a7652,_0x1a8373){_0x3a7652=_0x3a7652-0x0;var _0x23b755=_0x7ee1[_0x3a7652];return _0x23b755;};'use strict';var multer=require(_0x17ee('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x17ee('0x1'));var router=express[_0x17ee('0x2')]();var fs_extra=require(_0x17ee('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x17ee('0x4'));var config=require(_0x17ee('0x5'));var controller=require(_0x17ee('0x6'));router[_0x17ee('0x7')]('/',auth['isAuthenticated'](),controller[_0x17ee('0x8')]);router[_0x17ee('0x7')]('/:id',auth[_0x17ee('0x9')](),controller['show']);router[_0x17ee('0x7')](_0x17ee('0xa'),auth[_0x17ee('0x9')](),controller['getMessages']);router['post']('/',auth['isAuthenticated'](),controller[_0x17ee('0xb')]);router['put'](_0x17ee('0xc'),auth[_0x17ee('0x9')](),controller[_0x17ee('0xd')]);router[_0x17ee('0xe')]('/:id',auth[_0x17ee('0x9')](),controller['destroy']);module[_0x17ee('0xf')]=router; \ No newline at end of file +var _0xed1c=['get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','post','create','update','delete','destroy','multer','util','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMail.controller'];(function(_0x79ac23,_0x42956a){var _0x2837eb=function(_0x160ec2){while(--_0x160ec2){_0x79ac23['push'](_0x79ac23['shift']());}};_0x2837eb(++_0x42956a);}(_0xed1c,0xe4));var _0xced1=function(_0x3c6eba,_0x2a7a77){_0x3c6eba=_0x3c6eba-0x0;var _0x40c865=_0xed1c[_0x3c6eba];return _0x40c865;};'use strict';var multer=require(_0xced1('0x0'));var util=require(_0xced1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xced1('0x2'));var auth=require(_0xced1('0x3'));var interaction=require(_0xced1('0x4'));var config=require('../../config/environment');var controller=require(_0xced1('0x5'));router[_0xced1('0x6')]('/',auth[_0xced1('0x7')](),controller[_0xced1('0x8')]);router['get'](_0xced1('0x9'),auth[_0xced1('0x7')](),controller[_0xced1('0xa')]);router[_0xced1('0x6')](_0xced1('0xb'),auth[_0xced1('0x7')](),controller[_0xced1('0xc')]);router[_0xced1('0xd')]('/',auth['isAuthenticated'](),controller[_0xced1('0xe')]);router['put'](_0xced1('0x9'),auth[_0xced1('0x7')](),controller[_0xced1('0xf')]);router[_0xced1('0x10')](_0xced1('0x9'),auth[_0xced1('0x7')](),controller[_0xced1('0x11')]);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 857a707..beccac8 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 _0xc24e=['TIMESTAMP','INTEGER','VIRTUAL','fullname','\x20-\x20','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)'];(function(_0x420a0a,_0x13c02b){var _0x18dbf4=function(_0x49ea43){while(--_0x49ea43){_0x420a0a['push'](_0x420a0a['shift']());}};_0x18dbf4(++_0x13c02b);}(_0xc24e,0x1bf));var _0xec24=function(_0x48e432,_0x361946){_0x48e432=_0x48e432-0x0;var _0x38cd24=_0xc24e[_0x48e432];return _0x38cd24;};'use strict';var Sequelize=require('sequelize');module[_0xec24('0x0')]={'customer_id':{'type':Sequelize[_0xec24('0x1')]},'context':{'type':Sequelize[_0xec24('0x1')],'defaultValue':_0xec24('0x2'),'unique':_0xec24('0x3')},'mailbox':{'type':Sequelize[_0xec24('0x1')],'defaultValue':'','allowNull':![],'unique':_0xec24('0x3')},'password':{'type':Sequelize[_0xec24('0x1')]},'fullname':{'type':Sequelize[_0xec24('0x1')]},'email':{'type':Sequelize[_0xec24('0x1')],'validate':{'isEmail':!![]},'set':function(_0xc79a28){this[_0xec24('0x4')](_0xec24('0x5'),typeof _0xc79a28===_0xec24('0x6')&&_0xc79a28[_0xec24('0x7')]()?_0xc79a28[_0xec24('0x7')]():null);}},'pager':{'type':Sequelize[_0xec24('0x1')]},'tz':{'type':Sequelize[_0xec24('0x1')],'defaultValue':_0xec24('0x8')},'attach':{'type':Sequelize[_0xec24('0x9')](_0xec24('0xa'),'no'),'defaultValue':_0xec24('0xa'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0xec24('0xa'),'no'),'defaultValue':_0xec24('0xa'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize['ENUM'](_0xec24('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xec24('0x9')](_0xec24('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0xec24('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xec24('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xec24('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0xec24('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xec24('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0xec24('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0xec24('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0xec24('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xec24('0x9')](_0xec24('0xa'),'no'),'defaultValue':_0xec24('0xa'),'allowNull':![]},'stamp':{'type':_0xec24('0xc')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0xec24('0x1')]},'maxsecs':{'type':Sequelize[_0xec24('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xec24('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xec24('0xe')],'get':function(){return this['getDataValue'](_0xec24('0xf'))+_0xec24('0x10')+this['getDataValue']('mailbox');}}}; \ No newline at end of file +var _0xf4fb=['TIMESTAMP','INTEGER','VIRTUAL','fullname','\x20-\x20','getDataValue','mailbox','sequelize','STRING','from-voicemail','contest_mailbox','email','string','trim','central','yes','ENUM','TINYINT(4)'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xf4fb,0x14b));var _0xbf4f=function(_0x559985,_0x920257){_0x559985=_0x559985-0x0;var _0x449cdf=_0xf4fb[_0x559985];return _0x449cdf;};'use strict';var Sequelize=require(_0xbf4f('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0xbf4f('0x1')]},'context':{'type':Sequelize[_0xbf4f('0x1')],'defaultValue':_0xbf4f('0x2'),'unique':_0xbf4f('0x3')},'mailbox':{'type':Sequelize[_0xbf4f('0x1')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0xbf4f('0x1')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x4ae8e2){this['setDataValue'](_0xbf4f('0x4'),typeof _0x4ae8e2===_0xbf4f('0x5')&&_0x4ae8e2[_0xbf4f('0x6')]()?_0x4ae8e2['trim']():null);}},'pager':{'type':Sequelize[_0xbf4f('0x1')]},'tz':{'type':Sequelize[_0xbf4f('0x1')],'defaultValue':_0xbf4f('0x7')},'attach':{'type':Sequelize['ENUM'](_0xbf4f('0x8'),'no'),'defaultValue':_0xbf4f('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0xbf4f('0x9')](_0xbf4f('0x8'),'no'),'defaultValue':_0xbf4f('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0xbf4f('0x1')]},'callback':{'type':Sequelize[_0xbf4f('0x1')]},'review':{'type':Sequelize[_0xbf4f('0x9')](_0xbf4f('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xbf4f('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xbf4f('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xbf4f('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xbf4f('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xbf4f('0x9')](_0xbf4f('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xbf4f('0x9')](_0xbf4f('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xbf4f('0x9')](_0xbf4f('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0xbf4f('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xbf4f('0x9')](_0xbf4f('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xbf4f('0x9')]('yes','no'),'defaultValue':_0xbf4f('0x8'),'allowNull':![]},'stamp':{'type':_0xbf4f('0xb')},'emailsubject':{'type':Sequelize[_0xbf4f('0x1')]},'emailbody':{'type':Sequelize[_0xbf4f('0x1')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xbf4f('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xbf4f('0xd')],'get':function(){return this['getDataValue'](_0xbf4f('0xe'))+_0xbf4f('0xf')+this[_0xbf4f('0x10')](_0xbf4f('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index a5bc451..bc0cd71 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 _0x97c1=['error','stack','name','VoiceMail','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','findAll','rows','catch','show','params','keys','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','getMessages','pick','mailbox','VoiceMailMessage','findAndCountAll','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Voicemails','sendStatus'];(function(_0x22662f,_0x3bdfd3){var _0x29e07b=function(_0x259eb6){while(--_0x259eb6){_0x22662f['push'](_0x22662f['shift']());}};_0x29e07b(++_0x3bdfd3);}(_0x97c1,0xdf));var _0x197c=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x97c1[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0x197c('0x0'));var rimraf=require(_0x197c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x197c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x197c('0x3'));var Mustache=require(_0x197c('0x4'));var util=require(_0x197c('0x5'));var path=require(_0x197c('0x6'));var sox=require(_0x197c('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x197c('0x8'));var _=require(_0x197c('0x9'));var squel=require(_0x197c('0xa'));var crypto=require(_0x197c('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x197c('0xc'));var querystring=require('querystring');var Papa=require(_0x197c('0xd'));var Redis=require(_0x197c('0xe'));var authService=require(_0x197c('0xf'));var qs=require(_0x197c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x197c('0x11'));var logger=require(_0x197c('0x12'))(_0x197c('0x13'));var utils=require(_0x197c('0x14'));var config=require(_0x197c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x197c('0x16'))['db'];function respondWithStatusCode(_0x668f8,_0x27e46f){_0x27e46f=_0x27e46f||0xcc;return function(_0x1adcfa){if(_0x1adcfa){return _0x668f8['sendStatus'](_0x27e46f);}return _0x668f8[_0x197c('0x17')](_0x27e46f)[_0x197c('0x18')]();};}function respondWithResult(_0x5a7e1c,_0xf735ce){_0xf735ce=_0xf735ce||0xc8;return function(_0x188ff2){if(_0x188ff2){return _0x5a7e1c[_0x197c('0x17')](_0xf735ce)['json'](_0x188ff2);}};}function respondWithFilteredResult(_0x5194c3,_0x422dfa){return function(_0x2bc612){if(_0x2bc612){var _0x2083d4=typeof _0x422dfa[_0x197c('0x19')]===_0x197c('0x1a')&&typeof _0x422dfa[_0x197c('0x1b')]===_0x197c('0x1a');var _0x75beba=_0x2bc612['count'];var _0x372311=_0x2083d4?0x0:_0x422dfa['offset'];var _0x50ac52=_0x2083d4?_0x2bc612[_0x197c('0x1c')]:_0x422dfa[_0x197c('0x19')]+_0x422dfa[_0x197c('0x1b')];var _0x2ce10d;if(_0x50ac52>=_0x75beba){_0x50ac52=_0x75beba;_0x2ce10d=0xc8;}else{_0x2ce10d=0xce;}_0x5194c3['status'](_0x2ce10d);return _0x5194c3[_0x197c('0x1d')](_0x197c('0x1e'),_0x372311+'-'+_0x50ac52+'/'+_0x75beba)[_0x197c('0x1f')](_0x2bc612);}return null;};}function patchUpdates(_0x5c278a){return function(_0x1adb43){try{jsonpatch[_0x197c('0x20')](_0x1adb43,_0x5c278a,!![]);}catch(_0x3b5c4c){return BPromise[_0x197c('0x21')](_0x3b5c4c);}return _0x1adb43[_0x197c('0x22')]();};}function saveUpdates(_0x3c2151,_0x362bbf){return function(_0x2092a0){if(_0x2092a0){return _0x2092a0[_0x197c('0x23')](_0x3c2151)[_0x197c('0x24')](function(_0x29b266){return _0x29b266;});}return null;};}function removeEntity(_0x177bc9,_0x174942){return function(_0x2a1310){if(_0x2a1310){return _0x2a1310[_0x197c('0x25')]()[_0x197c('0x24')](function(){var _0x5f4a02=_0x2a1310[_0x197c('0x26')]({'plain':!![]});var _0x2911dd=_0x197c('0x27');return db['UserProfileResource'][_0x197c('0x25')]({'where':{'type':_0x2911dd,'resourceId':_0x5f4a02['id']}})[_0x197c('0x24')](function(){return _0x2a1310;});})['then'](function(){_0x177bc9['status'](0xcc)[_0x197c('0x18')]();});}};}function handleEntityNotFound(_0x48f759,_0xfbca7a){return function(_0x14b0aa){if(!_0x14b0aa){_0x48f759[_0x197c('0x28')](0x194);}return _0x14b0aa;};}function handleError(_0x16e026,_0x2f031c){_0x2f031c=_0x2f031c||0x1f4;return function(_0x3cdcd8){logger[_0x197c('0x29')](_0x3cdcd8[_0x197c('0x2a')]);if(_0x3cdcd8[_0x197c('0x2b')]){delete _0x3cdcd8['name'];}_0x16e026['status'](_0x2f031c)['send'](_0x3cdcd8);};}exports['index']=function(_0x5f7425,_0x4c9256){var _0x252cde={},_0x35dbf3={},_0x58bc60={'count':0x0,'rows':[]};var _0x422ac6=_['map'](db[_0x197c('0x2c')][_0x197c('0x2d')],function(_0x2ace33){return{'name':_0x2ace33[_0x197c('0x2e')],'type':_0x2ace33[_0x197c('0x2f')][_0x197c('0x30')]};});_0x35dbf3[_0x197c('0x31')]=_[_0x197c('0x32')](_0x422ac6,_0x197c('0x2b'));_0x35dbf3['query']=_['keys'](_0x5f7425[_0x197c('0x33')]);_0x35dbf3[_0x197c('0x34')]=_[_0x197c('0x35')](_0x35dbf3[_0x197c('0x31')],_0x35dbf3[_0x197c('0x33')]);_0x252cde[_0x197c('0x36')]=_[_0x197c('0x35')](_0x35dbf3['model'],qs['fields'](_0x5f7425[_0x197c('0x33')][_0x197c('0x37')]));_0x252cde['attributes']=_0x252cde['attributes'][_0x197c('0x38')]?_0x252cde[_0x197c('0x36')]:_0x35dbf3[_0x197c('0x31')];if(!_0x5f7425[_0x197c('0x33')][_0x197c('0x39')](_0x197c('0x3a'))){_0x252cde[_0x197c('0x1b')]=qs[_0x197c('0x1b')](_0x5f7425[_0x197c('0x33')]['limit']);_0x252cde[_0x197c('0x19')]=qs[_0x197c('0x19')](_0x5f7425[_0x197c('0x33')][_0x197c('0x19')]);}_0x252cde[_0x197c('0x3b')]=qs[_0x197c('0x3c')](_0x5f7425['query'][_0x197c('0x3c')]);_0x252cde[_0x197c('0x3d')]=qs[_0x197c('0x34')](_['pick'](_0x5f7425[_0x197c('0x33')],_0x35dbf3[_0x197c('0x34')]),_0x422ac6);if(_0x5f7425[_0x197c('0x33')][_0x197c('0x3e')]){_0x252cde[_0x197c('0x3d')]=_[_0x197c('0x3f')](_0x252cde[_0x197c('0x3d')],{'$or':_[_0x197c('0x32')](_0x422ac6,function(_0x323a14){if(_0x323a14[_0x197c('0x2f')]!=='VIRTUAL'){var _0x2705f5={};_0x2705f5[_0x323a14[_0x197c('0x2b')]]={'$like':'%'+_0x5f7425['query']['filter']+'%'};return _0x2705f5;}})});}_0x252cde=_[_0x197c('0x3f')]({},_0x252cde,_0x5f7425[_0x197c('0x40')]);var _0x3517a6={'where':_0x252cde[_0x197c('0x3d')]};return db[_0x197c('0x2c')]['count'](_0x3517a6)[_0x197c('0x24')](function(_0x3efae){_0x58bc60[_0x197c('0x1c')]=_0x3efae;if(_0x5f7425[_0x197c('0x33')][_0x197c('0x41')]){_0x252cde['include']=[{'all':!![]}];}return db[_0x197c('0x2c')][_0x197c('0x42')](_0x252cde);})[_0x197c('0x24')](function(_0x197b27){_0x58bc60[_0x197c('0x43')]=_0x197b27;return _0x58bc60;})['then'](respondWithFilteredResult(_0x4c9256,_0x252cde))[_0x197c('0x44')](handleError(_0x4c9256,null));};exports[_0x197c('0x45')]=function(_0x3b7fc1,_0x35f36d){var _0x3e6d6e={'raw':!![],'where':{'id':_0x3b7fc1[_0x197c('0x46')]['id']}},_0x41eb51={};_0x41eb51[_0x197c('0x31')]=_[_0x197c('0x47')](db[_0x197c('0x2c')][_0x197c('0x2d')]);_0x41eb51['query']=_['keys'](_0x3b7fc1['query']);_0x41eb51['filters']=_[_0x197c('0x35')](_0x41eb51[_0x197c('0x31')],_0x41eb51['query']);_0x3e6d6e[_0x197c('0x36')]=_[_0x197c('0x35')](_0x41eb51['model'],qs[_0x197c('0x37')](_0x3b7fc1[_0x197c('0x33')]['fields']));_0x3e6d6e[_0x197c('0x36')]=_0x3e6d6e[_0x197c('0x36')]['length']?_0x3e6d6e[_0x197c('0x36')]:_0x41eb51[_0x197c('0x31')];if(_0x3b7fc1[_0x197c('0x33')]['includeAll']){_0x3e6d6e[_0x197c('0x48')]=[{'all':!![]}];}_0x3e6d6e=_[_0x197c('0x3f')]({},_0x3e6d6e,_0x3b7fc1[_0x197c('0x40')]);return db[_0x197c('0x2c')]['find'](_0x3e6d6e)[_0x197c('0x24')](handleEntityNotFound(_0x35f36d,null))[_0x197c('0x24')](respondWithResult(_0x35f36d,null))[_0x197c('0x44')](handleError(_0x35f36d,null));};exports['create']=function(_0x5994bf,_0x3a5089){return db[_0x197c('0x2c')][_0x197c('0x49')](_0x5994bf[_0x197c('0x4a')],{})[_0x197c('0x24')](function(_0x28fac4){var _0x4c82d5=_0x5994bf[_0x197c('0x4b')]['get']({'plain':!![]});if(!_0x4c82d5)throw new Error(_0x197c('0x4c'));if(_0x4c82d5[_0x197c('0x4d')]===_0x197c('0x4b')){var _0x9e8c6a=_0x28fac4[_0x197c('0x26')]({'plain':!![]});var _0x2ab21f=_0x197c('0x27');return db[_0x197c('0x4e')]['find']({'where':{'name':_0x2ab21f,'userProfileId':_0x4c82d5[_0x197c('0x4f')]},'raw':!![]})[_0x197c('0x24')](function(_0x43e9b7){if(_0x43e9b7&&_0x43e9b7['autoAssociation']===0x0){return db[_0x197c('0x50')]['create']({'name':_0x9e8c6a[_0x197c('0x2b')],'resourceId':_0x9e8c6a['id'],'type':_0x43e9b7[_0x197c('0x2b')],'sectionId':_0x43e9b7['id']},{})[_0x197c('0x24')](function(){return _0x28fac4;});}else{return _0x28fac4;}})[_0x197c('0x44')](function(_0x1d7cdd){logger[_0x197c('0x29')](_0x197c('0x51'),_0x1d7cdd);throw _0x1d7cdd;});}return _0x28fac4;})[_0x197c('0x24')](respondWithResult(_0x3a5089,0xc9))['catch'](handleError(_0x3a5089,null));};exports[_0x197c('0x23')]=function(_0x3a9261,_0x275294){if(_0x3a9261['body']['id']){delete _0x3a9261[_0x197c('0x4a')]['id'];}return db[_0x197c('0x2c')][_0x197c('0x52')]({'where':{'id':_0x3a9261[_0x197c('0x46')]['id']}})[_0x197c('0x24')](handleEntityNotFound(_0x275294,null))['then'](saveUpdates(_0x3a9261['body'],null))[_0x197c('0x24')](respondWithResult(_0x275294,null))[_0x197c('0x44')](handleError(_0x275294,null));};exports[_0x197c('0x25')]=function(_0x42a13f,_0x15e50f){return db['VoiceMail']['find']({'where':{'id':_0x42a13f[_0x197c('0x46')]['id']}})[_0x197c('0x24')](handleEntityNotFound(_0x15e50f,null))['then'](removeEntity(_0x15e50f,null))[_0x197c('0x44')](handleError(_0x15e50f,null));};exports[_0x197c('0x53')]=function(_0x1a607c,_0x40867c,_0xc10419){return db[_0x197c('0x2c')]['findOne']({'where':{'id':_0x1a607c[_0x197c('0x46')]['id']}})[_0x197c('0x24')](handleEntityNotFound(_0x40867c,null))['then'](function(_0x480cab){var _0x1b71cf;var _0x5a70dd={},_0xfc9461={};_0xfc9461[_0x197c('0x31')]=_[_0x197c('0x47')](db['VoiceMailMessage'][_0x197c('0x2d')]);_0xfc9461[_0x197c('0x33')]=_['keys'](_0x1a607c[_0x197c('0x33')]);_0xfc9461[_0x197c('0x34')]=_[_0x197c('0x35')](_0xfc9461['model'],_0xfc9461[_0x197c('0x33')]);_0x5a70dd[_0x197c('0x36')]=_['intersection'](_0xfc9461['model'],qs[_0x197c('0x37')](_0x1a607c[_0x197c('0x33')][_0x197c('0x37')]));_0x5a70dd['attributes']=_0x5a70dd[_0x197c('0x36')][_0x197c('0x38')]?_0x5a70dd[_0x197c('0x36')]:_0xfc9461['model'];if(!_0x1a607c[_0x197c('0x33')][_0x197c('0x39')](_0x197c('0x3a'))){_0x5a70dd[_0x197c('0x1b')]=qs[_0x197c('0x1b')](_0x1a607c[_0x197c('0x33')][_0x197c('0x1b')]);_0x5a70dd[_0x197c('0x19')]=qs[_0x197c('0x19')](_0x1a607c[_0x197c('0x33')]['offset']);}_0x5a70dd[_0x197c('0x3b')]=qs['sort'](_0x1a607c['query']['sort']);_0x5a70dd['where']=qs[_0x197c('0x34')](_[_0x197c('0x54')](_0x1a607c[_0x197c('0x33')],_0xfc9461[_0x197c('0x34')]));if(_0x1a607c['query'][_0x197c('0x3e')]){_0x5a70dd['where']=_[_0x197c('0x3f')](_0x5a70dd['where'],{'$or':_[_0x197c('0x32')](_0x5a70dd['attributes'],function(_0x12d31a){var _0x1f6c6f={};_0x1f6c6f[_0x12d31a]={'$like':'%'+_0x1a607c[_0x197c('0x33')][_0x197c('0x3e')]+'%'};return _0x1f6c6f;})});}_0x5a70dd['where']=_[_0x197c('0x3f')](_0x5a70dd[_0x197c('0x3d')],{'mailboxuser':_0x480cab[_0x197c('0x55')]});_0x5a70dd=_['merge']({},_0x5a70dd,_0x1a607c[_0x197c('0x40')]);return db[_0x197c('0x56')][_0x197c('0x57')](_0x5a70dd)[_0x197c('0x24')](respondWithFilteredResult(_0x40867c,_0x5a70dd));})[_0x197c('0x44')](handleError(_0x40867c,null));}; \ No newline at end of file +var _0x9ffd=['moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','apply','update','then','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','VoiceMail','includeAll','include','findAll','rows','catch','params','find','create','user','get','Voicemails','UserProfileSection','userProfileId','autoAssociation','body','destroy','getMessages','findOne','VoiceMailMessage','order','mailbox','findAndCountAll','eml-format','rimraf','zip-dir','request-promise'];(function(_0x57f88a,_0xb91046){var _0x4f8813=function(_0x1e9591){while(--_0x1e9591){_0x57f88a['push'](_0x57f88a['shift']());}};_0x4f8813(++_0xb91046);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x1eb7a8,_0x36b24a){_0x1eb7a8=_0x1eb7a8-0x0;var _0x175a88=_0x9ffd[_0x1eb7a8];return _0x175a88;};'use strict';var emlformat=require(_0xd9ff('0x0'));var rimraf=require(_0xd9ff('0x1'));var zipdir=require(_0xd9ff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd9ff('0x3'));var moment=require(_0xd9ff('0x4'));var BPromise=require(_0xd9ff('0x5'));var Mustache=require(_0xd9ff('0x6'));var util=require('util');var path=require(_0xd9ff('0x7'));var sox=require(_0xd9ff('0x8'));var csv=require('to-csv');var ejs=require(_0xd9ff('0x9'));var fs=require('fs');var fs_extra=require(_0xd9ff('0xa'));var _=require(_0xd9ff('0xb'));var squel=require(_0xd9ff('0xc'));var crypto=require(_0xd9ff('0xd'));var jsforce=require(_0xd9ff('0xe'));var deskjs=require(_0xd9ff('0xf'));var toCsv=require(_0xd9ff('0x10'));var querystring=require(_0xd9ff('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd9ff('0x12'));var hardwareService=require(_0xd9ff('0x13'));var logger=require(_0xd9ff('0x14'))(_0xd9ff('0x15'));var utils=require(_0xd9ff('0x16'));var config=require(_0xd9ff('0x17'));var licenseUtil=require(_0xd9ff('0x18'));var db=require(_0xd9ff('0x19'))['db'];function respondWithStatusCode(_0x47d842,_0x47b0d7){_0x47b0d7=_0x47b0d7||0xcc;return function(_0xaaf7af){if(_0xaaf7af){return _0x47d842[_0xd9ff('0x1a')](_0x47b0d7);}return _0x47d842[_0xd9ff('0x1b')](_0x47b0d7)[_0xd9ff('0x1c')]();};}function respondWithResult(_0x12c39a,_0x556aa4){_0x556aa4=_0x556aa4||0xc8;return function(_0x2f78c1){if(_0x2f78c1){return _0x12c39a[_0xd9ff('0x1b')](_0x556aa4)['json'](_0x2f78c1);}};}function respondWithFilteredResult(_0xf14c9f,_0x5db010){return function(_0x4ffe54){if(_0x4ffe54){var _0x547e28=typeof _0x5db010['offset']===_0xd9ff('0x1d')&&typeof _0x5db010['limit']===_0xd9ff('0x1d');var _0xa30fd2=_0x4ffe54[_0xd9ff('0x1e')];var _0x3afd19=_0x547e28?0x0:_0x5db010[_0xd9ff('0x1f')];var _0x2d4df1=_0x547e28?_0x4ffe54[_0xd9ff('0x1e')]:_0x5db010[_0xd9ff('0x1f')]+_0x5db010[_0xd9ff('0x20')];var _0x1f028f;if(_0x2d4df1>=_0xa30fd2){_0x2d4df1=_0xa30fd2;_0x1f028f=0xc8;}else{_0x1f028f=0xce;}_0xf14c9f[_0xd9ff('0x1b')](_0x1f028f);return _0xf14c9f[_0xd9ff('0x21')](_0xd9ff('0x22'),_0x3afd19+'-'+_0x2d4df1+'/'+_0xa30fd2)['json'](_0x4ffe54);}return null;};}function patchUpdates(_0x4cf8ec){return function(_0x264a3d){try{jsonpatch[_0xd9ff('0x23')](_0x264a3d,_0x4cf8ec,!![]);}catch(_0x4eea4d){return BPromise['reject'](_0x4eea4d);}return _0x264a3d['save']();};}function saveUpdates(_0x4b1477,_0x1f4d9e){return function(_0x58eb5f){if(_0x58eb5f){return _0x58eb5f[_0xd9ff('0x24')](_0x4b1477)[_0xd9ff('0x25')](function(_0x291f52){return _0x291f52;});}return null;};}function removeEntity(_0x9f074e,_0x278b66){return function(_0x42a828){if(_0x42a828){return _0x42a828['destroy']()['then'](function(){var _0x1136e9=_0x42a828['get']({'plain':!![]});var _0x3ca906='Voicemails';return db[_0xd9ff('0x26')]['destroy']({'where':{'type':_0x3ca906,'resourceId':_0x1136e9['id']}})[_0xd9ff('0x25')](function(){return _0x42a828;});})[_0xd9ff('0x25')](function(){_0x9f074e[_0xd9ff('0x1b')](0xcc)[_0xd9ff('0x1c')]();});}};}function handleEntityNotFound(_0x5d685e,_0x11a17b){return function(_0xe11f88){if(!_0xe11f88){_0x5d685e[_0xd9ff('0x1a')](0x194);}return _0xe11f88;};}function handleError(_0x4390f7,_0x5c1c1f){_0x5c1c1f=_0x5c1c1f||0x1f4;return function(_0x1d3684){logger[_0xd9ff('0x27')](_0x1d3684[_0xd9ff('0x28')]);if(_0x1d3684[_0xd9ff('0x29')]){delete _0x1d3684[_0xd9ff('0x29')];}_0x4390f7[_0xd9ff('0x1b')](_0x5c1c1f)[_0xd9ff('0x2a')](_0x1d3684);};}exports[_0xd9ff('0x2b')]=function(_0x3dc443,_0x5706cf){var _0xcea5db={},_0x4ba2be={},_0x1d55fd={'count':0x0,'rows':[]};var _0x29c532=_[_0xd9ff('0x2c')](db['VoiceMail'][_0xd9ff('0x2d')],function(_0x3b26da){return{'name':_0x3b26da[_0xd9ff('0x2e')],'type':_0x3b26da[_0xd9ff('0x2f')]['key']};});_0x4ba2be[_0xd9ff('0x30')]=_['map'](_0x29c532,_0xd9ff('0x29'));_0x4ba2be[_0xd9ff('0x31')]=_[_0xd9ff('0x32')](_0x3dc443[_0xd9ff('0x31')]);_0x4ba2be[_0xd9ff('0x33')]=_[_0xd9ff('0x34')](_0x4ba2be[_0xd9ff('0x30')],_0x4ba2be[_0xd9ff('0x31')]);_0xcea5db[_0xd9ff('0x35')]=_[_0xd9ff('0x34')](_0x4ba2be[_0xd9ff('0x30')],qs[_0xd9ff('0x36')](_0x3dc443[_0xd9ff('0x31')][_0xd9ff('0x36')]));_0xcea5db['attributes']=_0xcea5db[_0xd9ff('0x35')][_0xd9ff('0x37')]?_0xcea5db[_0xd9ff('0x35')]:_0x4ba2be['model'];if(!_0x3dc443[_0xd9ff('0x31')]['hasOwnProperty'](_0xd9ff('0x38'))){_0xcea5db['limit']=qs[_0xd9ff('0x20')](_0x3dc443['query'][_0xd9ff('0x20')]);_0xcea5db[_0xd9ff('0x1f')]=qs[_0xd9ff('0x1f')](_0x3dc443['query']['offset']);}_0xcea5db['order']=qs[_0xd9ff('0x39')](_0x3dc443[_0xd9ff('0x31')][_0xd9ff('0x39')]);_0xcea5db[_0xd9ff('0x3a')]=qs[_0xd9ff('0x33')](_[_0xd9ff('0x3b')](_0x3dc443['query'],_0x4ba2be['filters']),_0x29c532);if(_0x3dc443['query'][_0xd9ff('0x3c')]){_0xcea5db[_0xd9ff('0x3a')]=_[_0xd9ff('0x3d')](_0xcea5db[_0xd9ff('0x3a')],{'$or':_['map'](_0x29c532,function(_0x2692c0){if(_0x2692c0['type']!==_0xd9ff('0x3e')){var _0x3e2beb={};_0x3e2beb[_0x2692c0[_0xd9ff('0x29')]]={'$like':'%'+_0x3dc443[_0xd9ff('0x31')]['filter']+'%'};return _0x3e2beb;}})});}_0xcea5db=_[_0xd9ff('0x3d')]({},_0xcea5db,_0x3dc443[_0xd9ff('0x3f')]);var _0x4961a7={'where':_0xcea5db[_0xd9ff('0x3a')]};return db[_0xd9ff('0x40')][_0xd9ff('0x1e')](_0x4961a7)[_0xd9ff('0x25')](function(_0x1fe44d){_0x1d55fd[_0xd9ff('0x1e')]=_0x1fe44d;if(_0x3dc443['query'][_0xd9ff('0x41')]){_0xcea5db[_0xd9ff('0x42')]=[{'all':!![]}];}return db[_0xd9ff('0x40')][_0xd9ff('0x43')](_0xcea5db);})[_0xd9ff('0x25')](function(_0x52aab8){_0x1d55fd[_0xd9ff('0x44')]=_0x52aab8;return _0x1d55fd;})[_0xd9ff('0x25')](respondWithFilteredResult(_0x5706cf,_0xcea5db))[_0xd9ff('0x45')](handleError(_0x5706cf,null));};exports['show']=function(_0x5d06dd,_0x36843b){var _0x7eb1a={'raw':!![],'where':{'id':_0x5d06dd[_0xd9ff('0x46')]['id']}},_0x18d1c4={};_0x18d1c4[_0xd9ff('0x30')]=_[_0xd9ff('0x32')](db['VoiceMail'][_0xd9ff('0x2d')]);_0x18d1c4[_0xd9ff('0x31')]=_['keys'](_0x5d06dd[_0xd9ff('0x31')]);_0x18d1c4[_0xd9ff('0x33')]=_[_0xd9ff('0x34')](_0x18d1c4[_0xd9ff('0x30')],_0x18d1c4[_0xd9ff('0x31')]);_0x7eb1a['attributes']=_['intersection'](_0x18d1c4['model'],qs[_0xd9ff('0x36')](_0x5d06dd['query'][_0xd9ff('0x36')]));_0x7eb1a[_0xd9ff('0x35')]=_0x7eb1a[_0xd9ff('0x35')]['length']?_0x7eb1a[_0xd9ff('0x35')]:_0x18d1c4[_0xd9ff('0x30')];if(_0x5d06dd['query'][_0xd9ff('0x41')]){_0x7eb1a[_0xd9ff('0x42')]=[{'all':!![]}];}_0x7eb1a=_[_0xd9ff('0x3d')]({},_0x7eb1a,_0x5d06dd[_0xd9ff('0x3f')]);return db['VoiceMail'][_0xd9ff('0x47')](_0x7eb1a)['then'](handleEntityNotFound(_0x36843b,null))[_0xd9ff('0x25')](respondWithResult(_0x36843b,null))['catch'](handleError(_0x36843b,null));};exports[_0xd9ff('0x48')]=function(_0x3d91e6,_0x2bf37a){return db[_0xd9ff('0x40')][_0xd9ff('0x48')](_0x3d91e6['body'],{})[_0xd9ff('0x25')](function(_0x3d6f11){var _0x2fbe53=_0x3d91e6[_0xd9ff('0x49')]['get']({'plain':!![]});if(!_0x2fbe53)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2fbe53['role']===_0xd9ff('0x49')){var _0x40be56=_0x3d6f11[_0xd9ff('0x4a')]({'plain':!![]});var _0x572618=_0xd9ff('0x4b');return db[_0xd9ff('0x4c')][_0xd9ff('0x47')]({'where':{'name':_0x572618,'userProfileId':_0x2fbe53[_0xd9ff('0x4d')]},'raw':!![]})[_0xd9ff('0x25')](function(_0x40d391){if(_0x40d391&&_0x40d391[_0xd9ff('0x4e')]===0x0){return db[_0xd9ff('0x26')][_0xd9ff('0x48')]({'name':_0x40be56[_0xd9ff('0x29')],'resourceId':_0x40be56['id'],'type':_0x40d391[_0xd9ff('0x29')],'sectionId':_0x40d391['id']},{})[_0xd9ff('0x25')](function(){return _0x3d6f11;});}else{return _0x3d6f11;}})[_0xd9ff('0x45')](function(_0x487b07){logger[_0xd9ff('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x487b07);throw _0x487b07;});}return _0x3d6f11;})[_0xd9ff('0x25')](respondWithResult(_0x2bf37a,0xc9))['catch'](handleError(_0x2bf37a,null));};exports[_0xd9ff('0x24')]=function(_0x49623d,_0xc82610){if(_0x49623d['body']['id']){delete _0x49623d[_0xd9ff('0x4f')]['id'];}return db['VoiceMail'][_0xd9ff('0x47')]({'where':{'id':_0x49623d['params']['id']}})[_0xd9ff('0x25')](handleEntityNotFound(_0xc82610,null))['then'](saveUpdates(_0x49623d[_0xd9ff('0x4f')],null))[_0xd9ff('0x25')](respondWithResult(_0xc82610,null))[_0xd9ff('0x45')](handleError(_0xc82610,null));};exports[_0xd9ff('0x50')]=function(_0x4df17b,_0x8c136b){return db[_0xd9ff('0x40')][_0xd9ff('0x47')]({'where':{'id':_0x4df17b['params']['id']}})[_0xd9ff('0x25')](handleEntityNotFound(_0x8c136b,null))[_0xd9ff('0x25')](removeEntity(_0x8c136b,null))[_0xd9ff('0x45')](handleError(_0x8c136b,null));};exports[_0xd9ff('0x51')]=function(_0x11dd0c,_0x56e8e8,_0x27cc9e){return db[_0xd9ff('0x40')][_0xd9ff('0x52')]({'where':{'id':_0x11dd0c[_0xd9ff('0x46')]['id']}})[_0xd9ff('0x25')](handleEntityNotFound(_0x56e8e8,null))[_0xd9ff('0x25')](function(_0x458fd4){var _0x5bac6f;var _0x3be850={},_0x11251f={};_0x11251f['model']=_[_0xd9ff('0x32')](db[_0xd9ff('0x53')]['rawAttributes']);_0x11251f[_0xd9ff('0x31')]=_[_0xd9ff('0x32')](_0x11dd0c[_0xd9ff('0x31')]);_0x11251f['filters']=_['intersection'](_0x11251f[_0xd9ff('0x30')],_0x11251f['query']);_0x3be850[_0xd9ff('0x35')]=_[_0xd9ff('0x34')](_0x11251f[_0xd9ff('0x30')],qs[_0xd9ff('0x36')](_0x11dd0c['query']['fields']));_0x3be850['attributes']=_0x3be850[_0xd9ff('0x35')][_0xd9ff('0x37')]?_0x3be850[_0xd9ff('0x35')]:_0x11251f[_0xd9ff('0x30')];if(!_0x11dd0c[_0xd9ff('0x31')]['hasOwnProperty'](_0xd9ff('0x38'))){_0x3be850['limit']=qs[_0xd9ff('0x20')](_0x11dd0c[_0xd9ff('0x31')][_0xd9ff('0x20')]);_0x3be850[_0xd9ff('0x1f')]=qs[_0xd9ff('0x1f')](_0x11dd0c[_0xd9ff('0x31')][_0xd9ff('0x1f')]);}_0x3be850[_0xd9ff('0x54')]=qs['sort'](_0x11dd0c[_0xd9ff('0x31')][_0xd9ff('0x39')]);_0x3be850['where']=qs['filters'](_[_0xd9ff('0x3b')](_0x11dd0c['query'],_0x11251f[_0xd9ff('0x33')]));if(_0x11dd0c[_0xd9ff('0x31')]['filter']){_0x3be850[_0xd9ff('0x3a')]=_[_0xd9ff('0x3d')](_0x3be850[_0xd9ff('0x3a')],{'$or':_[_0xd9ff('0x2c')](_0x3be850[_0xd9ff('0x35')],function(_0x49c5fa){var _0x12a8d7={};_0x12a8d7[_0x49c5fa]={'$like':'%'+_0x11dd0c['query']['filter']+'%'};return _0x12a8d7;})});}_0x3be850[_0xd9ff('0x3a')]=_[_0xd9ff('0x3d')](_0x3be850[_0xd9ff('0x3a')],{'mailboxuser':_0x458fd4[_0xd9ff('0x55')]});_0x3be850=_['merge']({},_0x3be850,_0x11dd0c[_0xd9ff('0x3f')]);return db[_0xd9ff('0x53')][_0xd9ff('0x56')](_0x3be850)[_0xd9ff('0x25')](respondWithFilteredResult(_0x56e8e8,_0x3be850));})[_0xd9ff('0x45')](handleError(_0x56e8e8,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index f3ae56f..2d5ad29 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 _0x082c=['path','rimraf','../../config/environment','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','util','api','moment','bluebird','request-promise'];(function(_0x52713c,_0x202d39){var _0x2e2239=function(_0x41df42){while(--_0x41df42){_0x52713c['push'](_0x52713c['shift']());}};_0x2e2239(++_0x202d39);}(_0x082c,0x17a));var _0xc082=function(_0x50620b,_0x10bb13){_0x50620b=_0x50620b-0x0;var _0x3afc55=_0x082c[_0x50620b];return _0x3afc55;};'use strict';var _=require(_0xc082('0x0'));var util=require(_0xc082('0x1'));var logger=require('../../config/logger')(_0xc082('0x2'));var moment=require(_0xc082('0x3'));var BPromise=require(_0xc082('0x4'));var rp=require(_0xc082('0x5'));var fs=require('fs');var path=require(_0xc082('0x6'));var rimraf=require(_0xc082('0x7'));var config=require(_0xc082('0x8'));var attributes=require('./voiceMail.attributes');module[_0xc082('0x9')]=function(_0x5d8cb4,_0x3b2006){return _0x5d8cb4[_0xc082('0xa')](_0xc082('0xb'),attributes,{'tableName':_0xc082('0xc'),'paranoid':![],'indexes':[{'name':_0xc082('0xd'),'fields':[_0xc082('0xe'),_0xc082('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x320e=['define','VoiceMail','mailbox_context','mailbox','context','lodash','util','api','bluebird','request-promise','path','./voiceMail.attributes','exports'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x320e,0x1a5));var _0xe320=function(_0x241424,_0x25eb5d){_0x241424=_0x241424-0x0;var _0x3da798=_0x320e[_0x241424];return _0x3da798;};'use strict';var _=require(_0xe320('0x0'));var util=require(_0xe320('0x1'));var logger=require('../../config/logger')(_0xe320('0x2'));var moment=require('moment');var BPromise=require(_0xe320('0x3'));var rp=require(_0xe320('0x4'));var fs=require('fs');var path=require(_0xe320('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe320('0x6'));module[_0xe320('0x7')]=function(_0x29bb48,_0x183f60){return _0x29bb48[_0xe320('0x8')](_0xe320('0x9'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0xe320('0xa'),'fields':[_0xe320('0xb'),_0xe320('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index d3197e9..a73e82e 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 _0xad08=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','code','error','VoiceMail,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x1bc679,_0x1e044d){var _0x27ca45=function(_0x43f22a){while(--_0x43f22a){_0x1bc679['push'](_0x1bc679['shift']());}};_0x27ca45(++_0x1e044d);}(_0xad08,0x181));var _0x8ad0=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xad08[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x8ad0('0x0'));var util=require(_0x8ad0('0x1'));var moment=require(_0x8ad0('0x2'));var BPromise=require(_0x8ad0('0x3'));var rs=require(_0x8ad0('0x4'));var fs=require('fs');var Redis=require(_0x8ad0('0x5'));var db=require(_0x8ad0('0x6'))['db'];var utils=require(_0x8ad0('0x7'));var logger=require(_0x8ad0('0x8'))(_0x8ad0('0x9'));var config=require(_0x8ad0('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x8ad0('0xb')][_0x8ad0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x28935e,_0x48c665,_0x41bd50){return new BPromise(function(_0x11cf95,_0x59d091){return client[_0x8ad0('0xd')](_0x28935e,_0x41bd50)['then'](function(_0x3b97f7){logger[_0x8ad0('0xe')]('VoiceMail,\x20%s,\x20%s',_0x48c665,_0x8ad0('0xf'));logger[_0x8ad0('0x10')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x48c665,'request\x20sent',JSON['stringify'](_0x3b97f7));if(_0x3b97f7['error']){if(_0x3b97f7['error'][_0x8ad0('0x11')]===0x1f4){logger[_0x8ad0('0x12')](_0x8ad0('0x13'),_0x48c665,_0x3b97f7[_0x8ad0('0x12')][_0x8ad0('0x14')]);return _0x59d091(_0x3b97f7[_0x8ad0('0x12')][_0x8ad0('0x14')]);}logger[_0x8ad0('0x12')]('VoiceMail,\x20%s,\x20%s',_0x48c665,_0x3b97f7[_0x8ad0('0x12')][_0x8ad0('0x14')]);return _0x11cf95(_0x3b97f7[_0x8ad0('0x12')][_0x8ad0('0x14')]);}else{logger[_0x8ad0('0xe')]('VoiceMail,\x20%s,\x20%s',_0x48c665,_0x8ad0('0xf'));_0x11cf95(_0x3b97f7[_0x8ad0('0x15')]['message']);}})[_0x8ad0('0x16')](function(_0x2cfd8d){logger[_0x8ad0('0x12')]('VoiceMail,\x20%s,\x20%s',_0x48c665,_0x2cfd8d);_0x59d091(_0x2cfd8d);});});} \ No newline at end of file +var _0x7624=['moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash'];(function(_0x31621f,_0x1bf7e4){var _0x5f3de0=function(_0x5ec3af){while(--_0x5ec3af){_0x31621f['push'](_0x31621f['shift']());}};_0x5f3de0(++_0x1bf7e4);}(_0x7624,0x1cd));var _0x4762=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7624[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x4762('0x0'));var util=require('util');var moment=require(_0x4762('0x1'));var BPromise=require(_0x4762('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4762('0x3'))['db'];var utils=require(_0x4762('0x4'));var logger=require(_0x4762('0x5'))(_0x4762('0x6'));var config=require(_0x4762('0x7'));var jayson=require(_0x4762('0x8'));var client=jayson['client'][_0x4762('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x458e28,_0x4bb7e3,_0x3edefd){return new BPromise(function(_0x312120,_0x105f83){return client[_0x4762('0xa')](_0x458e28,_0x3edefd)[_0x4762('0xb')](function(_0x5d71ca){logger[_0x4762('0xc')](_0x4762('0xd'),_0x4bb7e3,_0x4762('0xe'));logger[_0x4762('0xf')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x4bb7e3,_0x4762('0xe'),JSON['stringify'](_0x5d71ca));if(_0x5d71ca[_0x4762('0x10')]){if(_0x5d71ca[_0x4762('0x10')][_0x4762('0x11')]===0x1f4){logger[_0x4762('0x10')](_0x4762('0xd'),_0x4bb7e3,_0x5d71ca[_0x4762('0x10')]['message']);return _0x105f83(_0x5d71ca['error'][_0x4762('0x12')]);}logger[_0x4762('0x10')](_0x4762('0xd'),_0x4bb7e3,_0x5d71ca['error'][_0x4762('0x12')]);return _0x312120(_0x5d71ca[_0x4762('0x10')][_0x4762('0x12')]);}else{logger[_0x4762('0xc')](_0x4762('0xd'),_0x4bb7e3,'request\x20sent');_0x312120(_0x5d71ca[_0x4762('0x13')][_0x4762('0x12')]);}})[_0x4762('0x14')](function(_0x5103de){logger[_0x4762('0x10')]('VoiceMail,\x20%s,\x20%s',_0x4bb7e3,_0x5103de);_0x105f83(_0x5103de);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index c64ad62..8184355 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 _0xf33d=['util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/download','download','post','create','put','/:id','update','destroy','exports','multer'];(function(_0x5f46ee,_0x550dbb){var _0x5f3804=function(_0x1fcd12){while(--_0x1fcd12){_0x5f46ee['push'](_0x5f46ee['shift']());}};_0x5f3804(++_0x550dbb);}(_0xf33d,0x92));var _0xdf33=function(_0xd0ebf2,_0x9596d9){_0xd0ebf2=_0xd0ebf2-0x0;var _0x47ec74=_0xf33d[_0xd0ebf2];return _0x47ec74;};'use strict';var multer=require(_0xdf33('0x0'));var util=require(_0xdf33('0x1'));var path=require('path');var timeout=require(_0xdf33('0x2'));var express=require(_0xdf33('0x3'));var router=express[_0xdf33('0x4')]();var fs_extra=require(_0xdf33('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xdf33('0x6'));var config=require(_0xdf33('0x7'));var controller=require('./voiceMailMessage.controller');router[_0xdf33('0x8')]('/',auth[_0xdf33('0x9')](),controller[_0xdf33('0xa')]);router[_0xdf33('0x8')]('/:id',auth[_0xdf33('0x9')](),controller[_0xdf33('0xb')]);router['get'](_0xdf33('0xc'),auth[_0xdf33('0x9')](),controller[_0xdf33('0xd')]);router[_0xdf33('0xe')]('/',auth[_0xdf33('0x9')](),controller[_0xdf33('0xf')]);router[_0xdf33('0x10')](_0xdf33('0x11'),auth[_0xdf33('0x9')](),controller[_0xdf33('0x12')]);router['delete'](_0xdf33('0x11'),auth[_0xdf33('0x9')](),controller[_0xdf33('0x13')]);module[_0xdf33('0x14')]=router; \ No newline at end of file +var _0x53c5=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','isAuthenticated','index','get','/:id/download','download','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x27c1ab,_0x3734be){var _0x5087a3=function(_0x471a6a){while(--_0x471a6a){_0x27c1ab['push'](_0x27c1ab['shift']());}};_0x5087a3(++_0x3734be);}(_0x53c5,0x137));var _0x553c=function(_0x2b4d83,_0x1b2963){_0x2b4d83=_0x2b4d83-0x0;var _0x29c658=_0x53c5[_0x2b4d83];return _0x29c658;};'use strict';var multer=require(_0x553c('0x0'));var util=require(_0x553c('0x1'));var path=require(_0x553c('0x2'));var timeout=require(_0x553c('0x3'));var express=require(_0x553c('0x4'));var router=express[_0x553c('0x5')]();var fs_extra=require(_0x553c('0x6'));var auth=require(_0x553c('0x7'));var interaction=require(_0x553c('0x8'));var config=require(_0x553c('0x9'));var controller=require(_0x553c('0xa'));router['get']('/',auth[_0x553c('0xb')](),controller[_0x553c('0xc')]);router[_0x553c('0xd')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x553c('0xd')](_0x553c('0xe'),auth['isAuthenticated'](),controller[_0x553c('0xf')]);router[_0x553c('0x10')]('/',auth['isAuthenticated'](),controller[_0x553c('0x11')]);router[_0x553c('0x12')](_0x553c('0x13'),auth['isAuthenticated'](),controller[_0x553c('0x14')]);router[_0x553c('0x15')](_0x553c('0x13'),auth[_0x553c('0xb')](),controller[_0x553c('0x16')]);module[_0x553c('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index d21c89b..692adf6 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 _0xc230=['BLOB','long','TIMESTAMP','sequelize','exports','getDataValue','INTEGER','STRING'];(function(_0x21ccfc,_0x48834e){var _0x279454=function(_0x12b780){while(--_0x12b780){_0x21ccfc['push'](_0x21ccfc['shift']());}};_0x279454(++_0x48834e);}(_0xc230,0x1db));var _0x0c23=function(_0x406819,_0x2a782b){_0x406819=_0x406819-0x0;var _0x47c315=_0xc230[_0x406819];return _0x47c315;};'use strict';var Sequelize=require(_0x0c23('0x0'));module[_0x0c23('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x23ebf0){return this[_0x0c23('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x0c23('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x0c23('0x4')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x0c23('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x0c23('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x0c23('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x0c23('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x0c23('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x0c23('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x0c23('0x5')](_0x0c23('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x0c23('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x0c23('0x4')],'defaultValue':''},'stamp':{'type':_0x0c23('0x7'),'defaultValue':Sequelize['literal']('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x5e50=['getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL'];(function(_0x5ecc4d,_0x192051){var _0x5412f3=function(_0xd38f1b){while(--_0xd38f1b){_0x5ecc4d['push'](_0x5ecc4d['shift']());}};_0x5412f3(++_0x192051);}(_0x5e50,0xb2));var _0x05e5=function(_0x15ced4,_0x14b0f1){_0x15ced4=_0x15ced4-0x0;var _0x12a26f=_0x5e50[_0x15ced4];return _0x12a26f;};'use strict';var Sequelize=require(_0x05e5('0x0'));module['exports']={'name':{'type':Sequelize[_0x05e5('0x1')],'get':function(_0x5e2496){return this[_0x05e5('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x05e5('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x05e5('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x05e5('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x05e5('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x05e5('0x4')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x05e5('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x05e5('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x05e5('0x5')](_0x05e5('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x05e5('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x05e5('0x4')],'defaultValue':''},'stamp':{'type':_0x05e5('0x7'),'defaultValue':Sequelize[_0x05e5('0x8')](_0x05e5('0x9'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index fdc1849..f8fd547 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 _0x804c=['audio/wav','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','VoiceMailMessage','rawAttributes','type','key','model','differenceBy','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','catch','params','keys','includeAll','include','find','create','body','download','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x804c,0xa7));var _0xc804=function(_0x681ef2,_0x4df0be){_0x681ef2=_0x681ef2-0x0;var _0x5ded30=_0x804c[_0x681ef2];return _0x5ded30;};'use strict';var emlformat=require(_0xc804('0x0'));var rimraf=require(_0xc804('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc804('0x2'));var moment=require(_0xc804('0x3'));var BPromise=require(_0xc804('0x4'));var Mustache=require(_0xc804('0x5'));var util=require(_0xc804('0x6'));var path=require(_0xc804('0x7'));var sox=require(_0xc804('0x8'));var csv=require(_0xc804('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc804('0xa'));var _=require('lodash');var squel=require(_0xc804('0xb'));var crypto=require(_0xc804('0xc'));var jsforce=require(_0xc804('0xd'));var deskjs=require(_0xc804('0xe'));var toCsv=require(_0xc804('0x9'));var querystring=require('querystring');var Papa=require(_0xc804('0xf'));var Redis=require(_0xc804('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc804('0x11'));var as=require(_0xc804('0x12'));var hardwareService=require(_0xc804('0x13'));var logger=require('../../config/logger')(_0xc804('0x14'));var utils=require('../../config/utils');var config=require(_0xc804('0x15'));var licenseUtil=require(_0xc804('0x16'));var db=require(_0xc804('0x17'))['db'];function respondWithStatusCode(_0xb72d8e,_0x362e10){_0x362e10=_0x362e10||0xcc;return function(_0x3000f8){if(_0x3000f8){return _0xb72d8e[_0xc804('0x18')](_0x362e10);}return _0xb72d8e[_0xc804('0x19')](_0x362e10)[_0xc804('0x1a')]();};}function respondWithResult(_0x1e23b4,_0xab0b5a){_0xab0b5a=_0xab0b5a||0xc8;return function(_0x22b031){if(_0x22b031){return _0x1e23b4[_0xc804('0x19')](_0xab0b5a)[_0xc804('0x1b')](_0x22b031);}};}function respondWithFilteredResult(_0x9905bb,_0x2d0969){return function(_0x5d1a7c){if(_0x5d1a7c){var _0x3df02a=typeof _0x2d0969[_0xc804('0x1c')]==='undefined'&&typeof _0x2d0969[_0xc804('0x1d')]==='undefined';var _0x3732c4=_0x5d1a7c[_0xc804('0x1e')];var _0x68f2f2=_0x3df02a?0x0:_0x2d0969[_0xc804('0x1c')];var _0x40d685=_0x3df02a?_0x5d1a7c[_0xc804('0x1e')]:_0x2d0969[_0xc804('0x1c')]+_0x2d0969[_0xc804('0x1d')];var _0x314186;if(_0x40d685>=_0x3732c4){_0x40d685=_0x3732c4;_0x314186=0xc8;}else{_0x314186=0xce;}_0x9905bb[_0xc804('0x19')](_0x314186);return _0x9905bb[_0xc804('0x1f')](_0xc804('0x20'),_0x68f2f2+'-'+_0x40d685+'/'+_0x3732c4)[_0xc804('0x1b')](_0x5d1a7c);}return null;};}function patchUpdates(_0x37350c){return function(_0x47d5c1){try{jsonpatch['apply'](_0x47d5c1,_0x37350c,!![]);}catch(_0xbf1e0e){return BPromise[_0xc804('0x21')](_0xbf1e0e);}return _0x47d5c1[_0xc804('0x22')]();};}function saveUpdates(_0x582ea5,_0x1716de){return function(_0x18e0b9){if(_0x18e0b9){return _0x18e0b9[_0xc804('0x23')](_0x582ea5)[_0xc804('0x24')](function(_0x1ddd44){return _0x1ddd44;});}return null;};}function removeEntity(_0x1589b6,_0x5181b0){return function(_0x30541e){if(_0x30541e){return _0x30541e[_0xc804('0x25')]()[_0xc804('0x24')](function(){_0x1589b6[_0xc804('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24c028,_0x3db0d1){return function(_0x793c1c){if(!_0x793c1c){_0x24c028[_0xc804('0x18')](0x194);}return _0x793c1c;};}function handleError(_0x3d55f4,_0x3b0956){_0x3b0956=_0x3b0956||0x1f4;return function(_0x4b03bb){logger[_0xc804('0x26')](_0x4b03bb[_0xc804('0x27')]);if(_0x4b03bb[_0xc804('0x28')]){delete _0x4b03bb[_0xc804('0x28')];}_0x3d55f4[_0xc804('0x19')](_0x3b0956)[_0xc804('0x29')](_0x4b03bb);};}exports[_0xc804('0x2a')]=function(_0x1e64dd,_0x56cc0e){var _0x48f4a3={},_0xdb7fd4={},_0x1ac030={'count':0x0,'rows':[]};var _0x5569d2=_['map'](db[_0xc804('0x2b')][_0xc804('0x2c')],function(_0x3260fc){return{'name':_0x3260fc['fieldName'],'type':_0x3260fc[_0xc804('0x2d')][_0xc804('0x2e')]};});_0xdb7fd4[_0xc804('0x2f')]=_[_0xc804('0x30')](_[_0xc804('0x31')](_0x5569d2,'name'),[_0xc804('0x28')]);_0xdb7fd4[_0xc804('0x32')]=_['keys'](_0x1e64dd['query']);_0xdb7fd4[_0xc804('0x33')]=_[_0xc804('0x34')](_0xdb7fd4[_0xc804('0x2f')],_0xdb7fd4[_0xc804('0x32')]);_0x48f4a3[_0xc804('0x35')]=_['intersection'](_0xdb7fd4[_0xc804('0x2f')],qs[_0xc804('0x36')](_0x1e64dd[_0xc804('0x32')][_0xc804('0x36')]));_0x48f4a3[_0xc804('0x35')]=_0x48f4a3['attributes'][_0xc804('0x37')]?_0x48f4a3[_0xc804('0x35')]:_0xdb7fd4['model'];if(!_0x1e64dd[_0xc804('0x32')][_0xc804('0x38')](_0xc804('0x39'))){_0x48f4a3[_0xc804('0x1d')]=qs[_0xc804('0x1d')](_0x1e64dd[_0xc804('0x32')][_0xc804('0x1d')]);_0x48f4a3['offset']=qs['offset'](_0x1e64dd[_0xc804('0x32')][_0xc804('0x1c')]);}_0x48f4a3['order']=qs[_0xc804('0x3a')](_0x1e64dd['query'][_0xc804('0x3a')]);_0x48f4a3[_0xc804('0x3b')]=qs[_0xc804('0x33')](_[_0xc804('0x3c')](_0x1e64dd[_0xc804('0x32')],_0xdb7fd4['filters']),_0x5569d2);if(_0x1e64dd['query'][_0xc804('0x3d')]){_0x48f4a3[_0xc804('0x3b')]=_[_0xc804('0x3e')](_0x48f4a3['where'],{'$or':_[_0xc804('0x31')](_0x5569d2,function(_0x2c9beb){if(_0x2c9beb[_0xc804('0x2d')]!==_0xc804('0x3f')){var _0x3dcdf1={};_0x3dcdf1[_0x2c9beb[_0xc804('0x28')]]={'$like':'%'+_0x1e64dd['query']['filter']+'%'};return _0x3dcdf1;}})});}_0x48f4a3=_['merge']({},_0x48f4a3,_0x1e64dd[_0xc804('0x40')]);var _0x374b33={'where':_0x48f4a3['where']};return db['VoiceMailMessage']['count'](_0x374b33)[_0xc804('0x24')](function(_0x1253e5){_0x1ac030[_0xc804('0x1e')]=_0x1253e5;if(_0x1e64dd[_0xc804('0x32')]['includeAll']){_0x48f4a3['include']=[{'all':!![]}];}return db[_0xc804('0x2b')][_0xc804('0x41')](_0x48f4a3);})['then'](function(_0x13f560){_0x1ac030['rows']=_0x13f560;return _0x1ac030;})['then'](respondWithFilteredResult(_0x56cc0e,_0x48f4a3))[_0xc804('0x42')](handleError(_0x56cc0e,null));};exports['show']=function(_0x5d61c1,_0x4737d0){var _0x2505e2={'raw':!![],'where':{'id':_0x5d61c1[_0xc804('0x43')]['id']}},_0x1cee22={};_0x1cee22['model']=_[_0xc804('0x44')](db[_0xc804('0x2b')][_0xc804('0x2c')]);_0x1cee22[_0xc804('0x32')]=_[_0xc804('0x44')](_0x5d61c1[_0xc804('0x32')]);_0x1cee22[_0xc804('0x33')]=_[_0xc804('0x34')](_0x1cee22['model'],_0x1cee22[_0xc804('0x32')]);_0x2505e2[_0xc804('0x35')]=_[_0xc804('0x34')](_0x1cee22[_0xc804('0x2f')],qs['fields'](_0x5d61c1[_0xc804('0x32')]['fields']));_0x2505e2[_0xc804('0x35')]=_0x2505e2[_0xc804('0x35')][_0xc804('0x37')]?_0x2505e2[_0xc804('0x35')]:_0x1cee22['model'];if(_0x5d61c1['query'][_0xc804('0x45')]){_0x2505e2[_0xc804('0x46')]=[{'all':!![]}];}_0x2505e2=_[_0xc804('0x3e')]({},_0x2505e2,_0x5d61c1[_0xc804('0x40')]);return db['VoiceMailMessage'][_0xc804('0x47')](_0x2505e2)[_0xc804('0x24')](handleEntityNotFound(_0x4737d0,null))['then'](respondWithResult(_0x4737d0,null))[_0xc804('0x42')](handleError(_0x4737d0,null));};exports[_0xc804('0x48')]=function(_0x28fa9d,_0x4c15a2){return db[_0xc804('0x2b')][_0xc804('0x48')](_0x28fa9d[_0xc804('0x49')],{})[_0xc804('0x24')](respondWithResult(_0x4c15a2,0xc9))[_0xc804('0x42')](handleError(_0x4c15a2,null));};exports[_0xc804('0x23')]=function(_0x25cbcc,_0x3727c9){if(_0x25cbcc['body']['id']){delete _0x25cbcc[_0xc804('0x49')]['id'];}return db['VoiceMailMessage'][_0xc804('0x47')]({'where':{'id':_0x25cbcc[_0xc804('0x43')]['id']}})[_0xc804('0x24')](handleEntityNotFound(_0x3727c9,null))['then'](saveUpdates(_0x25cbcc[_0xc804('0x49')],null))[_0xc804('0x24')](respondWithResult(_0x3727c9,null))[_0xc804('0x42')](handleError(_0x3727c9,null));};exports[_0xc804('0x25')]=function(_0x57e710,_0x3a4ff4){return db[_0xc804('0x2b')][_0xc804('0x47')]({'where':{'id':_0x57e710[_0xc804('0x43')]['id']}})[_0xc804('0x24')](handleEntityNotFound(_0x3a4ff4,null))['then'](removeEntity(_0x3a4ff4,null))[_0xc804('0x42')](handleError(_0x3a4ff4,null));};exports[_0xc804('0x4a')]=function(_0x201114,_0x1a4d0d,_0x1fcf7c){return db['VoiceMailMessage'][_0xc804('0x47')]({'where':{'id':_0x201114[_0xc804('0x43')]['id']},'attributes':['id',_0xc804('0x4b'),_0xc804('0x4c')]})[_0xc804('0x24')](handleEntityNotFound(_0x1a4d0d,null))['then'](function(_0xd7a472){if(_0xd7a472){if(!_0xd7a472['recording']){throw new db[(_0xc804('0x4d'))]['ValidationError'](_0xc804('0x4e'));}var _0x4a8980={'Content-Type':_0xc804('0x4f'),'Content-Disposition':'attachment'};if(_0xd7a472[_0xc804('0x4c')]){_0x4a8980['Content-Disposition']=_0xc804('0x50')+_0xd7a472[_0xc804('0x4c')]+_0xc804('0x51');}_0x1a4d0d[_0xc804('0x1f')](_0x4a8980);return _0x1a4d0d[_0xc804('0x29')](new Buffer(_0xd7a472[_0xc804('0x4b')]));}})['catch'](handleError(_0x1a4d0d,null));}; \ No newline at end of file +var _0x1711=['fieldName','type','key','model','differenceBy','keys','intersection','query','attributes','length','hasOwnProperty','where','filters','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','params','fields','includeAll','options','find','create','body','download','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','attachment;\x20filename=\x22','msg_id','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','VoiceMailMessage','rawAttributes'];(function(_0x5900b6,_0x542703){var _0x33347b=function(_0x4971d6){while(--_0x4971d6){_0x5900b6['push'](_0x5900b6['shift']());}};_0x33347b(++_0x542703);}(_0x1711,0x134));var _0x1171=function(_0x58790b,_0x4f2c3e){_0x58790b=_0x58790b-0x0;var _0x51820d=_0x1711[_0x58790b];return _0x51820d;};'use strict';var emlformat=require(_0x1171('0x0'));var rimraf=require(_0x1171('0x1'));var zipdir=require(_0x1171('0x2'));var jsonpatch=require(_0x1171('0x3'));var rp=require(_0x1171('0x4'));var moment=require('moment');var BPromise=require(_0x1171('0x5'));var Mustache=require(_0x1171('0x6'));var util=require(_0x1171('0x7'));var path=require(_0x1171('0x8'));var sox=require(_0x1171('0x9'));var csv=require(_0x1171('0xa'));var ejs=require(_0x1171('0xb'));var fs=require('fs');var fs_extra=require(_0x1171('0xc'));var _=require(_0x1171('0xd'));var squel=require(_0x1171('0xe'));var crypto=require(_0x1171('0xf'));var jsforce=require(_0x1171('0x10'));var deskjs=require(_0x1171('0x11'));var toCsv=require('to-csv');var querystring=require(_0x1171('0x12'));var Papa=require(_0x1171('0x13'));var Redis=require(_0x1171('0x14'));var authService=require(_0x1171('0x15'));var qs=require(_0x1171('0x16'));var as=require(_0x1171('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1171('0x18'))(_0x1171('0x19'));var utils=require(_0x1171('0x1a'));var config=require(_0x1171('0x1b'));var licenseUtil=require(_0x1171('0x1c'));var db=require(_0x1171('0x1d'))['db'];function respondWithStatusCode(_0x4b5f05,_0x198de4){_0x198de4=_0x198de4||0xcc;return function(_0x3e8889){if(_0x3e8889){return _0x4b5f05[_0x1171('0x1e')](_0x198de4);}return _0x4b5f05[_0x1171('0x1f')](_0x198de4)[_0x1171('0x20')]();};}function respondWithResult(_0x4a721e,_0xff6cca){_0xff6cca=_0xff6cca||0xc8;return function(_0x3dc38e){if(_0x3dc38e){return _0x4a721e[_0x1171('0x1f')](_0xff6cca)['json'](_0x3dc38e);}};}function respondWithFilteredResult(_0x36f243,_0x4a0b47){return function(_0x3f2f75){if(_0x3f2f75){var _0x5430b9=typeof _0x4a0b47[_0x1171('0x21')]==='undefined'&&typeof _0x4a0b47[_0x1171('0x22')]===_0x1171('0x23');var _0x8b8fca=_0x3f2f75[_0x1171('0x24')];var _0x4e3057=_0x5430b9?0x0:_0x4a0b47['offset'];var _0x4e92d9=_0x5430b9?_0x3f2f75[_0x1171('0x24')]:_0x4a0b47[_0x1171('0x21')]+_0x4a0b47[_0x1171('0x22')];var _0x278f0d;if(_0x4e92d9>=_0x8b8fca){_0x4e92d9=_0x8b8fca;_0x278f0d=0xc8;}else{_0x278f0d=0xce;}_0x36f243['status'](_0x278f0d);return _0x36f243[_0x1171('0x25')]('Content-Range',_0x4e3057+'-'+_0x4e92d9+'/'+_0x8b8fca)[_0x1171('0x26')](_0x3f2f75);}return null;};}function patchUpdates(_0x107db8){return function(_0x45acb1){try{jsonpatch[_0x1171('0x27')](_0x45acb1,_0x107db8,!![]);}catch(_0x19a6e4){return BPromise[_0x1171('0x28')](_0x19a6e4);}return _0x45acb1[_0x1171('0x29')]();};}function saveUpdates(_0x1c06f6,_0x1ab230){return function(_0x23c8ab){if(_0x23c8ab){return _0x23c8ab[_0x1171('0x2a')](_0x1c06f6)[_0x1171('0x2b')](function(_0x37a36e){return _0x37a36e;});}return null;};}function removeEntity(_0xc39264,_0x70b233){return function(_0x3d3f58){if(_0x3d3f58){return _0x3d3f58[_0x1171('0x2c')]()[_0x1171('0x2b')](function(){_0xc39264[_0x1171('0x1f')](0xcc)[_0x1171('0x20')]();});}};}function handleEntityNotFound(_0x30894e,_0x188bd2){return function(_0x566b00){if(!_0x566b00){_0x30894e[_0x1171('0x1e')](0x194);}return _0x566b00;};}function handleError(_0x52b6e2,_0xeeee32){_0xeeee32=_0xeeee32||0x1f4;return function(_0x12fa5c){logger[_0x1171('0x2d')](_0x12fa5c[_0x1171('0x2e')]);if(_0x12fa5c[_0x1171('0x2f')]){delete _0x12fa5c[_0x1171('0x2f')];}_0x52b6e2[_0x1171('0x1f')](_0xeeee32)['send'](_0x12fa5c);};}exports[_0x1171('0x30')]=function(_0x3a22b6,_0x4c3ded){var _0x35da79={},_0x28cdf1={},_0x186505={'count':0x0,'rows':[]};var _0x1e72f0=_[_0x1171('0x31')](db[_0x1171('0x32')][_0x1171('0x33')],function(_0x53a966){return{'name':_0x53a966[_0x1171('0x34')],'type':_0x53a966[_0x1171('0x35')][_0x1171('0x36')]};});_0x28cdf1[_0x1171('0x37')]=_[_0x1171('0x38')](_['map'](_0x1e72f0,_0x1171('0x2f')),[_0x1171('0x2f')]);_0x28cdf1['query']=_[_0x1171('0x39')](_0x3a22b6['query']);_0x28cdf1['filters']=_[_0x1171('0x3a')](_0x28cdf1[_0x1171('0x37')],_0x28cdf1[_0x1171('0x3b')]);_0x35da79[_0x1171('0x3c')]=_[_0x1171('0x3a')](_0x28cdf1['model'],qs['fields'](_0x3a22b6['query']['fields']));_0x35da79[_0x1171('0x3c')]=_0x35da79['attributes'][_0x1171('0x3d')]?_0x35da79[_0x1171('0x3c')]:_0x28cdf1[_0x1171('0x37')];if(!_0x3a22b6['query'][_0x1171('0x3e')]('nolimit')){_0x35da79[_0x1171('0x22')]=qs[_0x1171('0x22')](_0x3a22b6[_0x1171('0x3b')][_0x1171('0x22')]);_0x35da79['offset']=qs['offset'](_0x3a22b6[_0x1171('0x3b')][_0x1171('0x21')]);}_0x35da79['order']=qs['sort'](_0x3a22b6['query']['sort']);_0x35da79[_0x1171('0x3f')]=qs[_0x1171('0x40')](_[_0x1171('0x41')](_0x3a22b6[_0x1171('0x3b')],_0x28cdf1[_0x1171('0x40')]),_0x1e72f0);if(_0x3a22b6[_0x1171('0x3b')][_0x1171('0x42')]){_0x35da79[_0x1171('0x3f')]=_[_0x1171('0x43')](_0x35da79[_0x1171('0x3f')],{'$or':_['map'](_0x1e72f0,function(_0x1903fc){if(_0x1903fc[_0x1171('0x35')]!==_0x1171('0x44')){var _0x4d1e5f={};_0x4d1e5f[_0x1903fc[_0x1171('0x2f')]]={'$like':'%'+_0x3a22b6[_0x1171('0x3b')][_0x1171('0x42')]+'%'};return _0x4d1e5f;}})});}_0x35da79=_[_0x1171('0x43')]({},_0x35da79,_0x3a22b6['options']);var _0x9d1c2a={'where':_0x35da79[_0x1171('0x3f')]};return db[_0x1171('0x32')]['count'](_0x9d1c2a)[_0x1171('0x2b')](function(_0x2cbf5b){_0x186505['count']=_0x2cbf5b;if(_0x3a22b6[_0x1171('0x3b')]['includeAll']){_0x35da79[_0x1171('0x45')]=[{'all':!![]}];}return db[_0x1171('0x32')][_0x1171('0x46')](_0x35da79);})[_0x1171('0x2b')](function(_0x26372c){_0x186505[_0x1171('0x47')]=_0x26372c;return _0x186505;})['then'](respondWithFilteredResult(_0x4c3ded,_0x35da79))[_0x1171('0x48')](handleError(_0x4c3ded,null));};exports['show']=function(_0x25f413,_0x7d2f5e){var _0x37283d={'raw':!![],'where':{'id':_0x25f413[_0x1171('0x49')]['id']}},_0x49dabb={};_0x49dabb['model']=_['keys'](db[_0x1171('0x32')][_0x1171('0x33')]);_0x49dabb['query']=_[_0x1171('0x39')](_0x25f413[_0x1171('0x3b')]);_0x49dabb[_0x1171('0x40')]=_['intersection'](_0x49dabb['model'],_0x49dabb[_0x1171('0x3b')]);_0x37283d[_0x1171('0x3c')]=_['intersection'](_0x49dabb[_0x1171('0x37')],qs[_0x1171('0x4a')](_0x25f413['query'][_0x1171('0x4a')]));_0x37283d[_0x1171('0x3c')]=_0x37283d[_0x1171('0x3c')][_0x1171('0x3d')]?_0x37283d[_0x1171('0x3c')]:_0x49dabb[_0x1171('0x37')];if(_0x25f413['query'][_0x1171('0x4b')]){_0x37283d[_0x1171('0x45')]=[{'all':!![]}];}_0x37283d=_[_0x1171('0x43')]({},_0x37283d,_0x25f413[_0x1171('0x4c')]);return db[_0x1171('0x32')][_0x1171('0x4d')](_0x37283d)[_0x1171('0x2b')](handleEntityNotFound(_0x7d2f5e,null))[_0x1171('0x2b')](respondWithResult(_0x7d2f5e,null))[_0x1171('0x48')](handleError(_0x7d2f5e,null));};exports[_0x1171('0x4e')]=function(_0x2b274a,_0x3c84ae){return db[_0x1171('0x32')][_0x1171('0x4e')](_0x2b274a[_0x1171('0x4f')],{})['then'](respondWithResult(_0x3c84ae,0xc9))[_0x1171('0x48')](handleError(_0x3c84ae,null));};exports[_0x1171('0x2a')]=function(_0x1317cd,_0x266052){if(_0x1317cd[_0x1171('0x4f')]['id']){delete _0x1317cd[_0x1171('0x4f')]['id'];}return db['VoiceMailMessage'][_0x1171('0x4d')]({'where':{'id':_0x1317cd[_0x1171('0x49')]['id']}})[_0x1171('0x2b')](handleEntityNotFound(_0x266052,null))['then'](saveUpdates(_0x1317cd['body'],null))[_0x1171('0x2b')](respondWithResult(_0x266052,null))[_0x1171('0x48')](handleError(_0x266052,null));};exports['destroy']=function(_0x37b0ab,_0x59a53f){return db[_0x1171('0x32')][_0x1171('0x4d')]({'where':{'id':_0x37b0ab['params']['id']}})[_0x1171('0x2b')](handleEntityNotFound(_0x59a53f,null))[_0x1171('0x2b')](removeEntity(_0x59a53f,null))[_0x1171('0x48')](handleError(_0x59a53f,null));};exports[_0x1171('0x50')]=function(_0x1509ef,_0x464611,_0x2f319e){return db['VoiceMailMessage'][_0x1171('0x4d')]({'where':{'id':_0x1509ef['params']['id']},'attributes':['id',_0x1171('0x51'),'msg_id']})[_0x1171('0x2b')](handleEntityNotFound(_0x464611,null))[_0x1171('0x2b')](function(_0x8c34bf){if(_0x8c34bf){if(!_0x8c34bf[_0x1171('0x51')]){throw new db[(_0x1171('0x52'))][(_0x1171('0x53'))](_0x1171('0x54'));}var _0x4e48b8={'Content-Type':_0x1171('0x55'),'Content-Disposition':_0x1171('0x56')};if(_0x8c34bf['msg_id']){_0x4e48b8['Content-Disposition']=_0x1171('0x57')+_0x8c34bf[_0x1171('0x58')]+'.wav\x22';}_0x464611['set'](_0x4e48b8);return _0x464611[_0x1171('0x59')](new Buffer(_0x8c34bf[_0x1171('0x51')]));}})[_0x1171('0x48')](handleError(_0x464611,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 74efda8..b175770 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 _0x17e4=['VoiceMailMessage','voice_voicemail_messages','dir','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes'];(function(_0x37756b,_0x24db76){var _0x46efec=function(_0x319807){while(--_0x319807){_0x37756b['push'](_0x37756b['shift']());}};_0x46efec(++_0x24db76);}(_0x17e4,0x18f));var _0x417e=function(_0x21e17f,_0x400d75){_0x21e17f=_0x21e17f-0x0;var _0x7fd555=_0x17e4[_0x21e17f];return _0x7fd555;};'use strict';var _=require(_0x417e('0x0'));var util=require('util');var logger=require(_0x417e('0x1'))('api');var moment=require(_0x417e('0x2'));var BPromise=require(_0x417e('0x3'));var rp=require(_0x417e('0x4'));var fs=require('fs');var path=require(_0x417e('0x5'));var rimraf=require(_0x417e('0x6'));var config=require(_0x417e('0x7'));var attributes=require(_0x417e('0x8'));module['exports']=function(_0x57b9ed,_0x24e5e2){return _0x57b9ed['define'](_0x417e('0x9'),attributes,{'tableName':_0x417e('0xa'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x417e('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0xab21=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','VoiceMailMessage','dir'];(function(_0x3c6554,_0x2822e2){var _0x4111b3=function(_0x16aa41){while(--_0x16aa41){_0x3c6554['push'](_0x3c6554['shift']());}};_0x4111b3(++_0x2822e2);}(_0xab21,0x193));var _0x1ab2=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0xab21[_0x1762b4];return _0x29beda;};'use strict';var _=require(_0x1ab2('0x0'));var util=require(_0x1ab2('0x1'));var logger=require(_0x1ab2('0x2'))(_0x1ab2('0x3'));var moment=require(_0x1ab2('0x4'));var BPromise=require(_0x1ab2('0x5'));var rp=require(_0x1ab2('0x6'));var fs=require('fs');var path=require(_0x1ab2('0x7'));var rimraf=require('rimraf');var config=require(_0x1ab2('0x8'));var attributes=require('./voiceMailMessage.attributes');module[_0x1ab2('0x9')]=function(_0x3d4905,_0x228ef9){return _0x3d4905[_0x1ab2('0xa')](_0x1ab2('0xb'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x1ab2('0xc'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 1d50135..62a7894 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 _0xf703=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird'];(function(_0x49f1cf,_0x5e9d54){var _0x567020=function(_0x54e406){while(--_0x54e406){_0x49f1cf['push'](_0x49f1cf['shift']());}};_0x567020(++_0x5e9d54);}(_0xf703,0x11a));var _0x3f70=function(_0x3bb8c3,_0x1f6934){_0x3bb8c3=_0x3bb8c3-0x0;var _0x53d4fd=_0xf703[_0x3bb8c3];return _0x53d4fd;};'use strict';var _=require(_0x3f70('0x0'));var util=require(_0x3f70('0x1'));var moment=require(_0x3f70('0x2'));var BPromise=require(_0x3f70('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3f70('0x4'));var db=require(_0x3f70('0x5'))['db'];var utils=require(_0x3f70('0x6'));var logger=require(_0x3f70('0x7'))(_0x3f70('0x8'));var config=require(_0x3f70('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3f70('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ed5ec,_0x5ac94e,_0x2eb483){return new BPromise(function(_0x14e510,_0x4c4d03){return client[_0x3f70('0xb')](_0x2ed5ec,_0x2eb483)[_0x3f70('0xc')](function(_0x3dab7b){logger[_0x3f70('0xd')](_0x3f70('0xe'),_0x5ac94e,_0x3f70('0xf'));logger['debug'](_0x3f70('0x10'),_0x5ac94e,_0x3f70('0xf'),JSON[_0x3f70('0x11')](_0x3dab7b));if(_0x3dab7b[_0x3f70('0x12')]){if(_0x3dab7b['error'][_0x3f70('0x13')]===0x1f4){logger[_0x3f70('0x12')](_0x3f70('0xe'),_0x5ac94e,_0x3dab7b[_0x3f70('0x12')]['message']);return _0x4c4d03(_0x3dab7b[_0x3f70('0x12')][_0x3f70('0x14')]);}logger[_0x3f70('0x12')](_0x3f70('0xe'),_0x5ac94e,_0x3dab7b[_0x3f70('0x12')][_0x3f70('0x14')]);return _0x14e510(_0x3dab7b[_0x3f70('0x12')][_0x3f70('0x14')]);}else{logger[_0x3f70('0xd')]('VoiceMailMessage,\x20%s,\x20%s',_0x5ac94e,_0x3f70('0xf'));_0x14e510(_0x3dab7b[_0x3f70('0x15')][_0x3f70('0x14')]);}})['catch'](function(_0x5079a6){logger['error'](_0x3f70('0xe'),_0x5ac94e,_0x5079a6);_0x4c4d03(_0x5079a6);});});} \ No newline at end of file +var _0xe7f1=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util'];(function(_0x5c1353,_0x328298){var _0x31e2e6=function(_0x5d37e4){while(--_0x5d37e4){_0x5c1353['push'](_0x5c1353['shift']());}};_0x31e2e6(++_0x328298);}(_0xe7f1,0x1ae));var _0x1e7f=function(_0x267cfa,_0x2bf8b0){_0x267cfa=_0x267cfa-0x0;var _0x20d10d=_0xe7f1[_0x267cfa];return _0x20d10d;};'use strict';var _=require(_0x1e7f('0x0'));var util=require(_0x1e7f('0x1'));var moment=require(_0x1e7f('0x2'));var BPromise=require(_0x1e7f('0x3'));var rs=require(_0x1e7f('0x4'));var fs=require('fs');var Redis=require(_0x1e7f('0x5'));var db=require(_0x1e7f('0x6'))['db'];var utils=require(_0x1e7f('0x7'));var logger=require(_0x1e7f('0x8'))(_0x1e7f('0x9'));var config=require('../../config/environment');var jayson=require(_0x1e7f('0xa'));var client=jayson[_0x1e7f('0xb')][_0x1e7f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4c37b9,_0xdd8b28,_0x3bb7e9){return new BPromise(function(_0x115de1,_0x4136be){return client[_0x1e7f('0xd')](_0x4c37b9,_0x3bb7e9)[_0x1e7f('0xe')](function(_0x2ca38a){logger['info'](_0x1e7f('0xf'),_0xdd8b28,'request\x20sent');logger[_0x1e7f('0x10')](_0x1e7f('0x11'),_0xdd8b28,_0x1e7f('0x12'),JSON[_0x1e7f('0x13')](_0x2ca38a));if(_0x2ca38a[_0x1e7f('0x14')]){if(_0x2ca38a[_0x1e7f('0x14')][_0x1e7f('0x15')]===0x1f4){logger[_0x1e7f('0x14')](_0x1e7f('0xf'),_0xdd8b28,_0x2ca38a[_0x1e7f('0x14')][_0x1e7f('0x16')]);return _0x4136be(_0x2ca38a[_0x1e7f('0x14')][_0x1e7f('0x16')]);}logger['error'](_0x1e7f('0xf'),_0xdd8b28,_0x2ca38a['error'][_0x1e7f('0x16')]);return _0x115de1(_0x2ca38a[_0x1e7f('0x14')]['message']);}else{logger['info'](_0x1e7f('0xf'),_0xdd8b28,_0x1e7f('0x12'));_0x115de1(_0x2ca38a['result'][_0x1e7f('0x16')]);}})[_0x1e7f('0x17')](function(_0xf92204){logger['error'](_0x1e7f('0xf'),_0xdd8b28,_0xf92204);_0x4136be(_0xf92204);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 8cebd8e..855dc51 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 _0xf043=['delete','destroy','/:id/sounds/:id2','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','isAuthenticated','index','get','/:id','show','/:id/sounds','getSounds','post','create','addSound','put','update'];(function(_0x1d5c12,_0x3a49b0){var _0x56edd2=function(_0x5cdf71){while(--_0x5cdf71){_0x1d5c12['push'](_0x1d5c12['shift']());}};_0x56edd2(++_0x3a49b0);}(_0xf043,0x130));var _0x3f04=function(_0x5724b4,_0x4f40e2){_0x5724b4=_0x5724b4-0x0;var _0x38e492=_0xf043[_0x5724b4];return _0x38e492;};'use strict';var multer=require('multer');var util=require(_0x3f04('0x0'));var path=require(_0x3f04('0x1'));var timeout=require(_0x3f04('0x2'));var express=require('express');var router=express[_0x3f04('0x3')]();var fs_extra=require(_0x3f04('0x4'));var auth=require(_0x3f04('0x5'));var interaction=require(_0x3f04('0x6'));var config=require(_0x3f04('0x7'));var controller=require(_0x3f04('0x8'));router['get']('/',auth[_0x3f04('0x9')](),controller[_0x3f04('0xa')]);router[_0x3f04('0xb')](_0x3f04('0xc'),auth[_0x3f04('0x9')](),controller[_0x3f04('0xd')]);router[_0x3f04('0xb')](_0x3f04('0xe'),auth['isAuthenticated'](),controller[_0x3f04('0xf')]);router[_0x3f04('0x10')]('/',auth[_0x3f04('0x9')](),controller[_0x3f04('0x11')]);router[_0x3f04('0x10')](_0x3f04('0xe'),auth['isAuthenticated'](),controller[_0x3f04('0x12')]);router[_0x3f04('0x13')](_0x3f04('0xc'),auth['isAuthenticated'](),controller[_0x3f04('0x14')]);router[_0x3f04('0x15')](_0x3f04('0xc'),auth[_0x3f04('0x9')](),controller[_0x3f04('0x16')]);router[_0x3f04('0x15')](_0x3f04('0x17'),auth[_0x3f04('0x9')](),controller['removeSound']);module[_0x3f04('0x18')]=router; \ No newline at end of file +var _0xa4ec=['post','addSound','put','update','destroy','/:id/sounds/:id2','removeSound','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','isAuthenticated','get','/:id','/:id/sounds','getSounds'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0xa4ec,0x184));var _0xca4e=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xa4ec[_0x23e7c1];return _0x1add43;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xca4e('0x0'));var timeout=require(_0xca4e('0x1'));var express=require('express');var router=express[_0xca4e('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xca4e('0x3'));var interaction=require(_0xca4e('0x4'));var config=require(_0xca4e('0x5'));var controller=require(_0xca4e('0x6'));router['get']('/',auth[_0xca4e('0x7')](),controller['index']);router[_0xca4e('0x8')](_0xca4e('0x9'),auth[_0xca4e('0x7')](),controller['show']);router[_0xca4e('0x8')](_0xca4e('0xa'),auth[_0xca4e('0x7')](),controller[_0xca4e('0xb')]);router[_0xca4e('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xca4e('0xa'),auth['isAuthenticated'](),controller[_0xca4e('0xd')]);router[_0xca4e('0xe')](_0xca4e('0x9'),auth[_0xca4e('0x7')](),controller[_0xca4e('0xf')]);router['delete'](_0xca4e('0x9'),auth[_0xca4e('0x7')](),controller[_0xca4e('0x10')]);router['delete'](_0xca4e('0x11'),auth['isAuthenticated'](),controller[_0xca4e('0x12')]);module[_0xca4e('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 53408ef..8ec7698 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 _0x86af=['files','quietmp3nb','quietmp3','mp3','STRING','alpha','TIMESTAMP','sequelize','exports','name','ENUM'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x86af,0x6a));var _0xf86a=function(_0x2e8874,_0x13cd6c){_0x2e8874=_0x2e8874-0x0;var _0x4ca0cb=_0x86af[_0x2e8874];return _0x4ca0cb;};'use strict';var Sequelize=require(_0xf86a('0x0'));module[_0xf86a('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf86a('0x2')},'mode':{'type':Sequelize[_0xf86a('0x3')]('custom',_0xf86a('0x4'),'mp3nb',_0xf86a('0x5'),_0xf86a('0x6'),_0xf86a('0x7')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0xf86a('0x8')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xf86a('0x9')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0xf86a('0xa')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0xecbf=['BOOLEAN','STRING','custom','mp3nb','quietmp3nb','alpha','TIMESTAMP'];(function(_0x1bd6d2,_0x20cb59){var _0x5378c6=function(_0x2582ec){while(--_0x2582ec){_0x1bd6d2['push'](_0x1bd6d2['shift']());}};_0x5378c6(++_0x20cb59);}(_0xecbf,0x6a));var _0xfecb=function(_0x33c835,_0x5a6b5a){_0x33c835=_0x33c835-0x0;var _0x32503d=_0xecbf[_0x33c835];return _0x32503d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xfecb('0x0')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize['ENUM'](_0xfecb('0x1'),'files',_0xfecb('0x2'),_0xfecb('0x3'),'quietmp3','mp3'),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0xfecb('0x0')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0xfecb('0x0')],'allowNull':!![]},'sort':{'type':Sequelize[_0xfecb('0x0')],'allowNull':!![],'defaultValue':_0xfecb('0x4')},'format':{'type':Sequelize[_0xfecb('0x0')],'allowNull':!![]},'stamp':{'type':_0xfecb('0x5')},'defaultEntry':{'type':Sequelize[_0xfecb('0x6')],'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 cf9c449..20db8fe 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 _0x5188=['0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','readdirSync','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','save_name','converted_format','createdAt','format','extname','%s.%s','symlinkSync','removeSound','findOne','id2','Sound','getSounds','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','get','MusicOnHolds','UserProfileResource','sendStatus','error','name','index','fieldName','type','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceMusicOnHold','includeAll','include','findAll','rows','show','params','rawAttributes','intersection','find','catch','body','create','sequelize','mode','files','directory','join','root','server/files/moh','mkdirSync'];(function(_0x3fec73,_0x467a23){var _0x335b2c=function(_0x392e26){while(--_0x392e26){_0x3fec73['push'](_0x3fec73['shift']());}};_0x335b2c(++_0x467a23);}(_0x5188,0xfc));var _0x8518=function(_0x341903,_0x2fc016){_0x341903=_0x341903-0x0;var _0x438514=_0x5188[_0x341903];return _0x438514;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8518('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8518('0x1'));var rp=require(_0x8518('0x2'));var moment=require(_0x8518('0x3'));var BPromise=require(_0x8518('0x4'));var Mustache=require(_0x8518('0x5'));var util=require('util');var path=require(_0x8518('0x6'));var sox=require(_0x8518('0x7'));var csv=require(_0x8518('0x8'));var ejs=require(_0x8518('0x9'));var fs=require('fs');var fs_extra=require(_0x8518('0xa'));var _=require(_0x8518('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8518('0xc'));var toCsv=require(_0x8518('0x8'));var querystring=require(_0x8518('0xd'));var Papa=require('papaparse');var Redis=require(_0x8518('0xe'));var authService=require(_0x8518('0xf'));var qs=require(_0x8518('0x10'));var as=require(_0x8518('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8518('0x12'))(_0x8518('0x13'));var utils=require(_0x8518('0x14'));var config=require(_0x8518('0x15'));var licenseUtil=require(_0x8518('0x16'));var db=require(_0x8518('0x17'))['db'];function respondWithStatusCode(_0x3bb9a9,_0x163a52){_0x163a52=_0x163a52||0xcc;return function(_0x407b99){if(_0x407b99){return _0x3bb9a9['sendStatus'](_0x163a52);}return _0x3bb9a9[_0x8518('0x18')](_0x163a52)['end']();};}function respondWithResult(_0x24563c,_0x2cf599){_0x2cf599=_0x2cf599||0xc8;return function(_0x1dca82){if(_0x1dca82){return _0x24563c[_0x8518('0x18')](_0x2cf599)[_0x8518('0x19')](_0x1dca82);}};}function respondWithFilteredResult(_0x2c3fdd,_0x11e9eb){return function(_0x476995){if(_0x476995){var _0x33d579=typeof _0x11e9eb[_0x8518('0x1a')]===_0x8518('0x1b')&&typeof _0x11e9eb[_0x8518('0x1c')]===_0x8518('0x1b');var _0x581cf6=_0x476995[_0x8518('0x1d')];var _0x474387=_0x33d579?0x0:_0x11e9eb[_0x8518('0x1a')];var _0x57a1e0=_0x33d579?_0x476995['count']:_0x11e9eb[_0x8518('0x1a')]+_0x11e9eb[_0x8518('0x1c')];var _0x1ef316;if(_0x57a1e0>=_0x581cf6){_0x57a1e0=_0x581cf6;_0x1ef316=0xc8;}else{_0x1ef316=0xce;}_0x2c3fdd[_0x8518('0x18')](_0x1ef316);return _0x2c3fdd['set'](_0x8518('0x1e'),_0x474387+'-'+_0x57a1e0+'/'+_0x581cf6)['json'](_0x476995);}return null;};}function patchUpdates(_0x463001){return function(_0x1757f9){try{jsonpatch[_0x8518('0x1f')](_0x1757f9,_0x463001,!![]);}catch(_0x28c02d){return BPromise[_0x8518('0x20')](_0x28c02d);}return _0x1757f9['save']();};}function saveUpdates(_0x48c25d,_0x510f93){return function(_0x788ce3){if(_0x788ce3){return _0x788ce3[_0x8518('0x21')](_0x48c25d)[_0x8518('0x22')](function(_0x5c1de0){return _0x5c1de0;});}return null;};}function removeEntity(_0x2fc114,_0x425678){return function(_0x1bca68){if(_0x1bca68){return _0x1bca68[_0x8518('0x23')]()['then'](function(){var _0x4931d8=_0x1bca68[_0x8518('0x24')]({'plain':!![]});var _0x1672f7=_0x8518('0x25');return db[_0x8518('0x26')][_0x8518('0x23')]({'where':{'type':_0x1672f7,'resourceId':_0x4931d8['id']}})[_0x8518('0x22')](function(){return _0x1bca68;});})[_0x8518('0x22')](function(){_0x2fc114['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f81af,_0x12fc42){return function(_0x53267a){if(!_0x53267a){_0x4f81af[_0x8518('0x27')](0x194);}return _0x53267a;};}function handleError(_0x25c773,_0x31ca49){_0x31ca49=_0x31ca49||0x1f4;return function(_0x4125a1){logger[_0x8518('0x28')](_0x4125a1['stack']);if(_0x4125a1[_0x8518('0x29')]){delete _0x4125a1['name'];}_0x25c773[_0x8518('0x18')](_0x31ca49)['send'](_0x4125a1);};}exports[_0x8518('0x2a')]=function(_0x4e4f9e,_0x55d17f){var _0x4385ce={},_0x2b9ff4={},_0x285f5a={'count':0x0,'rows':[]};var _0x225773=_['map'](db['VoiceMusicOnHold']['rawAttributes'],function(_0x477428){return{'name':_0x477428[_0x8518('0x2b')],'type':_0x477428[_0x8518('0x2c')]['key']};});_0x2b9ff4[_0x8518('0x2d')]=_[_0x8518('0x2e')](_0x225773,_0x8518('0x29'));_0x2b9ff4[_0x8518('0x2f')]=_[_0x8518('0x30')](_0x4e4f9e['query']);_0x2b9ff4[_0x8518('0x31')]=_['intersection'](_0x2b9ff4[_0x8518('0x2d')],_0x2b9ff4['query']);_0x4385ce[_0x8518('0x32')]=_['intersection'](_0x2b9ff4[_0x8518('0x2d')],qs[_0x8518('0x33')](_0x4e4f9e['query']['fields']));_0x4385ce[_0x8518('0x32')]=_0x4385ce[_0x8518('0x32')][_0x8518('0x34')]?_0x4385ce['attributes']:_0x2b9ff4[_0x8518('0x2d')];if(!_0x4e4f9e[_0x8518('0x2f')][_0x8518('0x35')](_0x8518('0x36'))){_0x4385ce['limit']=qs[_0x8518('0x1c')](_0x4e4f9e[_0x8518('0x2f')][_0x8518('0x1c')]);_0x4385ce[_0x8518('0x1a')]=qs['offset'](_0x4e4f9e[_0x8518('0x2f')][_0x8518('0x1a')]);}_0x4385ce[_0x8518('0x37')]=qs[_0x8518('0x38')](_0x4e4f9e['query'][_0x8518('0x38')]);delete _0x4e4f9e[_0x8518('0x2f')][_0x8518('0x38')];_0x4385ce[_0x8518('0x39')]=qs[_0x8518('0x31')](_[_0x8518('0x3a')](_0x4e4f9e[_0x8518('0x2f')],_0x2b9ff4[_0x8518('0x31')]),_0x225773);if(_0x4e4f9e[_0x8518('0x2f')][_0x8518('0x3b')]){_0x4385ce[_0x8518('0x39')]=_[_0x8518('0x3c')](_0x4385ce[_0x8518('0x39')],{'$or':_[_0x8518('0x2e')](_0x225773,function(_0x47586d){if(_0x47586d[_0x8518('0x2c')]!==_0x8518('0x3d')){var _0x2e72ae={};_0x2e72ae[_0x47586d[_0x8518('0x29')]]={'$like':'%'+_0x4e4f9e['query'][_0x8518('0x3b')]+'%'};return _0x2e72ae;}})});}_0x4385ce=_[_0x8518('0x3c')]({},_0x4385ce,_0x4e4f9e[_0x8518('0x3e')]);var _0x430d5f={'where':_0x4385ce[_0x8518('0x39')]};return db[_0x8518('0x3f')][_0x8518('0x1d')](_0x430d5f)['then'](function(_0xe04ea0){_0x285f5a[_0x8518('0x1d')]=_0xe04ea0;if(_0x4e4f9e[_0x8518('0x2f')][_0x8518('0x40')]){_0x4385ce[_0x8518('0x41')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x8518('0x42')](_0x4385ce);})[_0x8518('0x22')](function(_0x31dd9c){_0x285f5a[_0x8518('0x43')]=_0x31dd9c;return _0x285f5a;})[_0x8518('0x22')](respondWithFilteredResult(_0x55d17f,_0x4385ce))['catch'](handleError(_0x55d17f,null));};exports[_0x8518('0x44')]=function(_0x433768,_0xe9aa3e){var _0x1d0419={'raw':![],'where':{'id':_0x433768[_0x8518('0x45')]['id']}},_0x433047={};_0x433047[_0x8518('0x2d')]=_[_0x8518('0x30')](db[_0x8518('0x3f')][_0x8518('0x46')]);_0x433047['query']=_[_0x8518('0x30')](_0x433768[_0x8518('0x2f')]);_0x433047[_0x8518('0x31')]=_[_0x8518('0x47')](_0x433047[_0x8518('0x2d')],_0x433047[_0x8518('0x2f')]);_0x1d0419[_0x8518('0x32')]=_[_0x8518('0x47')](_0x433047['model'],qs['fields'](_0x433768[_0x8518('0x2f')][_0x8518('0x33')]));_0x1d0419[_0x8518('0x32')]=_0x1d0419[_0x8518('0x32')]['length']?_0x1d0419[_0x8518('0x32')]:_0x433047[_0x8518('0x2d')];if(_0x433768[_0x8518('0x2f')][_0x8518('0x40')]){_0x1d0419[_0x8518('0x41')]=[{'all':!![]}];}_0x1d0419=_[_0x8518('0x3c')]({},_0x1d0419,_0x433768[_0x8518('0x3e')]);return db['VoiceMusicOnHold'][_0x8518('0x48')](_0x1d0419)['then'](handleEntityNotFound(_0xe9aa3e,null))[_0x8518('0x22')](respondWithResult(_0xe9aa3e,null))[_0x8518('0x49')](handleError(_0xe9aa3e,null));};exports[_0x8518('0x21')]=function(_0x3a5679,_0x5449fb){if(_0x3a5679[_0x8518('0x4a')]['id']){delete _0x3a5679['body']['id'];}return db[_0x8518('0x3f')][_0x8518('0x48')]({'where':{'id':_0x3a5679[_0x8518('0x45')]['id']}})[_0x8518('0x22')](handleEntityNotFound(_0x5449fb,null))['then'](saveUpdates(_0x3a5679['body'],null))[_0x8518('0x22')](respondWithResult(_0x5449fb,null))[_0x8518('0x49')](handleError(_0x5449fb,null));};exports[_0x8518('0x4b')]=function(_0x131c3e,_0x406b13,_0x688b53){return db[_0x8518('0x4c')]['transaction'](function(_0x457f2a){if(_0x131c3e[_0x8518('0x4a')][_0x8518('0x4d')]===_0x8518('0x4e')){_0x131c3e[_0x8518('0x4a')][_0x8518('0x4f')]=path[_0x8518('0x50')](config[_0x8518('0x51')],_0x8518('0x52'),_0x131c3e[_0x8518('0x4a')][_0x8518('0x29')]);}return db[_0x8518('0x3f')]['create'](_0x131c3e['body'],{'transaction':_0x457f2a})['then'](function(_0x3e8e9b){if(_0x131c3e[_0x8518('0x4a')][_0x8518('0x4d')]===_0x8518('0x4e')){fs[_0x8518('0x53')](_0x3e8e9b['directory'],parseInt(_0x8518('0x54'),0x8));}var _0x21f3bc=_0x131c3e[_0x8518('0x55')][_0x8518('0x24')]({'plain':!![]});if(!_0x21f3bc)throw new Error(_0x8518('0x56'));if(_0x21f3bc[_0x8518('0x57')]===_0x8518('0x55')){var _0x1349c5=_0x3e8e9b[_0x8518('0x24')]({'plain':!![]});return db[_0x8518('0x58')][_0x8518('0x48')]({'where':{'name':'MusicOnHolds','userProfileId':_0x21f3bc[_0x8518('0x59')]},'raw':!![]})[_0x8518('0x22')](function(_0x69c9d){if(_0x69c9d&&_0x69c9d[_0x8518('0x5a')]===0x0){return db['UserProfileResource'][_0x8518('0x4b')]({'name':_0x1349c5['name'],'resourceId':_0x1349c5['id'],'type':_0x69c9d[_0x8518('0x29')],'sectionId':_0x69c9d['id']},{})[_0x8518('0x22')](function(){return _0x3e8e9b;});}else{return _0x3e8e9b;}})['catch'](function(_0xee8cf6){logger[_0x8518('0x28')](_0x8518('0x5b'),_0xee8cf6);});}return _0x3e8e9b;});})[_0x8518('0x22')](respondWithResult(_0x406b13,0xc9))[_0x8518('0x49')](handleError(_0x406b13,null));};exports[_0x8518('0x23')]=function(_0x5cb7ff,_0x2adb86,_0x2a4d08){var _0x3ee947;return db[_0x8518('0x3f')][_0x8518('0x48')]({'where':{'id':_0x5cb7ff['params']['id']}})[_0x8518('0x22')](function(_0x20cf0d){if(_0x20cf0d){return db[_0x8518('0x4c')][_0x8518('0x5c')](function(_0x31c26d){return _0x20cf0d[_0x8518('0x23')]({'transaction':_0x31c26d,'raw':!![]})[_0x8518('0x22')](function(_0x61bb6e){if(_0x61bb6e['directory']){fs[_0x8518('0x5d')](_0x61bb6e[_0x8518('0x4f')])['forEach'](function(_0x55fda9){fs[_0x8518('0x5e')](path[_0x8518('0x50')](_0x61bb6e[_0x8518('0x4f')],_0x55fda9));});fs[_0x8518('0x5f')](_0x61bb6e[_0x8518('0x4f')]);}return _0x61bb6e;});})[_0x8518('0x49')](function(_0x54de4a){throw new db[(_0x8518('0x60'))][(_0x8518('0x61'))](_0x54de4a[_0x8518('0x62')]);});}})['then'](handleEntityNotFound(_0x2adb86,null))[_0x8518('0x22')](removeEntity(_0x2adb86,null))['catch'](handleError(_0x2adb86,null));};exports[_0x8518('0x63')]=function(_0x53a92a,_0x2d8d0c,_0x4a2547){return db[_0x8518('0x4c')][_0x8518('0x5c')](function(_0x559d41){var _0x56518c;return db[_0x8518('0x3f')][_0x8518('0x48')]({'where':{'id':_0x53a92a['params']['id']}})[_0x8518('0x22')](function(_0x7372aa){if(_0x7372aa){_0x56518c=_0x7372aa;return _0x7372aa['addSound'](_0x53a92a['body']['id'],{'transaction':_0x559d41});}})[_0x8518('0x22')](function(_0x2a1b25){if(_0x2a1b25){return db['Sound']['findOne']({'where':{'id':_0x53a92a['body']['id']},'attributes':['id',_0x8518('0x29'),_0x8518('0x64'),_0x8518('0x65'),_0x8518('0x66')],'raw':!![]});}})[_0x8518('0x22')](function(_0x1ab51c){if(_0x1ab51c){var _0x5d9f97=path[_0x8518('0x50')](config[_0x8518('0x51')],'server/files/sounds/converted',util[_0x8518('0x67')]('%s.%s',path['basename'](_0x1ab51c[_0x8518('0x64')],path[_0x8518('0x68')](_0x1ab51c['save_name'])),_0x1ab51c['converted_format']));var _0x26de16=path[_0x8518('0x50')](config[_0x8518('0x51')],_0x8518('0x52'),_0x56518c[_0x8518('0x29')],util['format'](_0x8518('0x69'),_0x1ab51c[_0x8518('0x29')],_0x1ab51c[_0x8518('0x65')]));fs[_0x8518('0x6a')](_0x5d9f97,_0x26de16);return _0x1ab51c;}})[_0x8518('0x49')](function(_0x2aad6e){throw new db[(_0x8518('0x60'))][(_0x8518('0x61'))](_0x2aad6e[_0x8518('0x62')]);});})[_0x8518('0x22')](handleEntityNotFound(_0x2d8d0c,null))[_0x8518('0x22')](respondWithResult(_0x2d8d0c,0xc9))['catch'](handleError(_0x2d8d0c,null));};exports[_0x8518('0x6b')]=function(_0x16d99f,_0x564c3b,_0x499509){return db[_0x8518('0x4c')][_0x8518('0x5c')](function(_0x5e49cd){var _0x8f3741;return db[_0x8518('0x3f')][_0x8518('0x6c')]({'where':{'id':_0x16d99f[_0x8518('0x45')]['id']}})['then'](handleEntityNotFound(_0x564c3b,null))[_0x8518('0x22')](function(_0x177438){if(_0x177438){_0x8f3741=_0x177438;return _0x177438[_0x8518('0x6b')](_0x16d99f[_0x8518('0x45')][_0x8518('0x6d')]);}})[_0x8518('0x22')](function(_0x27104d){if(_0x27104d){return db[_0x8518('0x6e')][_0x8518('0x6c')]({'where':{'id':_0x16d99f[_0x8518('0x45')]['id2']},'attributes':['id',_0x8518('0x29'),_0x8518('0x64'),_0x8518('0x65'),_0x8518('0x66')],'raw':!![]});}})[_0x8518('0x22')](function(_0x253746){if(_0x253746){fs['unlinkSync'](path[_0x8518('0x50')](_0x8f3741[_0x8518('0x4f')],util[_0x8518('0x67')](_0x8518('0x69'),_0x253746['name'],_0x253746[_0x8518('0x65')])));return _0x253746;}})[_0x8518('0x49')](function(_0x42807a){throw new db[(_0x8518('0x60'))][(_0x8518('0x61'))](_0x42807a['message']);});})[_0x8518('0x22')](handleEntityNotFound(_0x564c3b,null))[_0x8518('0x22')](respondWithStatusCode(_0x564c3b,0xcc))[_0x8518('0x49')](handleError(_0x564c3b,null));};exports[_0x8518('0x6f')]=function(_0x4ec336,_0x559de6,_0x27204f){var _0x42d92b={};var _0x3bcb3a={};var _0x4d7237;var _0x3ab0f6;return db[_0x8518('0x3f')]['findOne']({'where':{'id':_0x4ec336[_0x8518('0x45')]['id']}})[_0x8518('0x22')](handleEntityNotFound(_0x559de6,null))[_0x8518('0x22')](function(_0xf7d39){if(_0xf7d39){_0x4d7237=_0xf7d39;_0x3bcb3a[_0x8518('0x2d')]=_[_0x8518('0x30')](db[_0x8518('0x6e')][_0x8518('0x46')]);_0x3bcb3a[_0x8518('0x2f')]=_[_0x8518('0x30')](_0x4ec336[_0x8518('0x2f')]);_0x3bcb3a[_0x8518('0x31')]=_[_0x8518('0x47')](_0x3bcb3a['model'],_0x3bcb3a[_0x8518('0x2f')]);_0x42d92b[_0x8518('0x32')]=_[_0x8518('0x47')](_0x3bcb3a[_0x8518('0x2d')],qs[_0x8518('0x33')](_0x4ec336[_0x8518('0x2f')][_0x8518('0x33')]));_0x42d92b[_0x8518('0x32')]=_0x42d92b[_0x8518('0x32')][_0x8518('0x34')]?_0x42d92b[_0x8518('0x32')]:_0x3bcb3a[_0x8518('0x2d')];_0x42d92b['order']=qs[_0x8518('0x38')](_0x4ec336[_0x8518('0x2f')][_0x8518('0x38')]);_0x42d92b[_0x8518('0x39')]=qs[_0x8518('0x31')](_[_0x8518('0x3a')](_0x4ec336['query'],_0x3bcb3a[_0x8518('0x31')]));if(_0x4ec336[_0x8518('0x2f')][_0x8518('0x3b')]){_0x42d92b['where']=_[_0x8518('0x3c')](_0x42d92b['where'],{'$or':_[_0x8518('0x2e')](_0x42d92b[_0x8518('0x32')],function(_0x468105){var _0x2f0bbb={};_0x2f0bbb[_0x468105]={'$like':'%'+_0x4ec336[_0x8518('0x2f')][_0x8518('0x3b')]+'%'};return _0x2f0bbb;})});}_0x42d92b=_[_0x8518('0x3c')]({},_0x42d92b,_0x4ec336['options']);return _0x4d7237[_0x8518('0x6f')](_0x42d92b);}})[_0x8518('0x22')](function(_0x385b2e){if(_0x385b2e){_0x3ab0f6=_0x385b2e['length'];if(!_0x4ec336[_0x8518('0x2f')][_0x8518('0x35')](_0x8518('0x36'))){_0x42d92b[_0x8518('0x1c')]=qs[_0x8518('0x1c')](_0x4ec336[_0x8518('0x2f')]['limit']);_0x42d92b[_0x8518('0x1a')]=qs[_0x8518('0x1a')](_0x4ec336[_0x8518('0x2f')]['offset']);}return _0x4d7237[_0x8518('0x6f')](_0x42d92b);}})[_0x8518('0x22')](function(_0x1f39ae){if(_0x1f39ae){return _0x1f39ae?{'count':_0x3ab0f6,'rows':_0x1f39ae}:null;}})[_0x8518('0x22')](respondWithResult(_0x559de6,null))[_0x8518('0x49')](handleError(_0x559de6,null));}; \ No newline at end of file +var _0x876e=['%s.%s','symlinkSync','message','removeSound','id2','createdAt','getSounds','order','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','fs-extra','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','end','error','stack','name','index','map','VoiceMusicOnHold','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','pick','filter','where','type','merge','options','includeAll','include','findAll','rows','catch','show','body','find','create','transaction','mode','files','directory','join','root','server/files/moh','mkdirSync','0777','user','role','userProfileId','params','sequelize','readdirSync','unlinkSync','rmdirSync','Sequelize','ValidationError','addSound','Sound','findOne','save_name','server/files/sounds/converted','basename','extname','converted_format','format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x876e,0xe2));var _0xe876=function(_0x18e0b5,_0x29c8e1){_0x18e0b5=_0x18e0b5-0x0;var _0x32fa5d=_0x876e[_0x18e0b5];return _0x32fa5d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe876('0x0'));var zipdir=require(_0xe876('0x1'));var jsonpatch=require(_0xe876('0x2'));var rp=require(_0xe876('0x3'));var moment=require(_0xe876('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe876('0x5'));var util=require(_0xe876('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xe876('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe876('0x8'));var _=require('lodash');var squel=require(_0xe876('0x9'));var crypto=require(_0xe876('0xa'));var jsforce=require(_0xe876('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xe876('0x7'));var querystring=require('querystring');var Papa=require(_0xe876('0xc'));var Redis=require('ioredis');var authService=require(_0xe876('0xd'));var qs=require(_0xe876('0xe'));var as=require(_0xe876('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe876('0x10'));var utils=require(_0xe876('0x11'));var config=require(_0xe876('0x12'));var licenseUtil=require(_0xe876('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c6dd1,_0x416fd9){_0x416fd9=_0x416fd9||0xcc;return function(_0xf90944){if(_0xf90944){return _0x4c6dd1[_0xe876('0x14')](_0x416fd9);}return _0x4c6dd1[_0xe876('0x15')](_0x416fd9)['end']();};}function respondWithResult(_0x19fd36,_0xf3ee71){_0xf3ee71=_0xf3ee71||0xc8;return function(_0x357214){if(_0x357214){return _0x19fd36[_0xe876('0x15')](_0xf3ee71)[_0xe876('0x16')](_0x357214);}};}function respondWithFilteredResult(_0x43383e,_0x3dd630){return function(_0x377458){if(_0x377458){var _0x3dc7a8=typeof _0x3dd630['offset']===_0xe876('0x17')&&typeof _0x3dd630['limit']===_0xe876('0x17');var _0x445685=_0x377458[_0xe876('0x18')];var _0x3b0fa3=_0x3dc7a8?0x0:_0x3dd630['offset'];var _0x1708f6=_0x3dc7a8?_0x377458[_0xe876('0x18')]:_0x3dd630['offset']+_0x3dd630[_0xe876('0x19')];var _0x5d3652;if(_0x1708f6>=_0x445685){_0x1708f6=_0x445685;_0x5d3652=0xc8;}else{_0x5d3652=0xce;}_0x43383e['status'](_0x5d3652);return _0x43383e[_0xe876('0x1a')](_0xe876('0x1b'),_0x3b0fa3+'-'+_0x1708f6+'/'+_0x445685)['json'](_0x377458);}return null;};}function patchUpdates(_0x2bfce3){return function(_0x9ff7a4){try{jsonpatch[_0xe876('0x1c')](_0x9ff7a4,_0x2bfce3,!![]);}catch(_0x110461){return BPromise[_0xe876('0x1d')](_0x110461);}return _0x9ff7a4[_0xe876('0x1e')]();};}function saveUpdates(_0x35f3bf,_0x57ab68){return function(_0x16769a){if(_0x16769a){return _0x16769a[_0xe876('0x1f')](_0x35f3bf)[_0xe876('0x20')](function(_0x58b053){return _0x58b053;});}return null;};}function removeEntity(_0x327901,_0x1b67ac){return function(_0x2b6b3a){if(_0x2b6b3a){return _0x2b6b3a[_0xe876('0x21')]()[_0xe876('0x20')](function(){var _0x17df98=_0x2b6b3a[_0xe876('0x22')]({'plain':!![]});var _0x2ba094=_0xe876('0x23');return db[_0xe876('0x24')][_0xe876('0x21')]({'where':{'type':_0x2ba094,'resourceId':_0x17df98['id']}})['then'](function(){return _0x2b6b3a;});})[_0xe876('0x20')](function(){_0x327901[_0xe876('0x15')](0xcc)[_0xe876('0x25')]();});}};}function handleEntityNotFound(_0x51b9f9,_0x3de96d){return function(_0x69a2a0){if(!_0x69a2a0){_0x51b9f9['sendStatus'](0x194);}return _0x69a2a0;};}function handleError(_0xeb990c,_0x1789d9){_0x1789d9=_0x1789d9||0x1f4;return function(_0x125af6){logger[_0xe876('0x26')](_0x125af6[_0xe876('0x27')]);if(_0x125af6[_0xe876('0x28')]){delete _0x125af6[_0xe876('0x28')];}_0xeb990c[_0xe876('0x15')](_0x1789d9)['send'](_0x125af6);};}exports[_0xe876('0x29')]=function(_0x2130ed,_0x2b4671){var _0x5e6020={},_0x557215={},_0x399fad={'count':0x0,'rows':[]};var _0x5bd172=_[_0xe876('0x2a')](db[_0xe876('0x2b')][_0xe876('0x2c')],function(_0x3abcc3){return{'name':_0x3abcc3[_0xe876('0x2d')],'type':_0x3abcc3['type']['key']};});_0x557215[_0xe876('0x2e')]=_[_0xe876('0x2a')](_0x5bd172,'name');_0x557215[_0xe876('0x2f')]=_[_0xe876('0x30')](_0x2130ed[_0xe876('0x2f')]);_0x557215[_0xe876('0x31')]=_[_0xe876('0x32')](_0x557215[_0xe876('0x2e')],_0x557215[_0xe876('0x2f')]);_0x5e6020[_0xe876('0x33')]=_[_0xe876('0x32')](_0x557215[_0xe876('0x2e')],qs['fields'](_0x2130ed['query'][_0xe876('0x34')]));_0x5e6020[_0xe876('0x33')]=_0x5e6020['attributes'][_0xe876('0x35')]?_0x5e6020[_0xe876('0x33')]:_0x557215['model'];if(!_0x2130ed[_0xe876('0x2f')][_0xe876('0x36')](_0xe876('0x37'))){_0x5e6020['limit']=qs['limit'](_0x2130ed[_0xe876('0x2f')]['limit']);_0x5e6020[_0xe876('0x38')]=qs[_0xe876('0x38')](_0x2130ed[_0xe876('0x2f')][_0xe876('0x38')]);}_0x5e6020['order']=qs[_0xe876('0x39')](_0x2130ed[_0xe876('0x2f')][_0xe876('0x39')]);delete _0x2130ed[_0xe876('0x2f')][_0xe876('0x39')];_0x5e6020['where']=qs[_0xe876('0x31')](_[_0xe876('0x3a')](_0x2130ed[_0xe876('0x2f')],_0x557215[_0xe876('0x31')]),_0x5bd172);if(_0x2130ed[_0xe876('0x2f')][_0xe876('0x3b')]){_0x5e6020[_0xe876('0x3c')]=_['merge'](_0x5e6020[_0xe876('0x3c')],{'$or':_[_0xe876('0x2a')](_0x5bd172,function(_0x3fe4f5){if(_0x3fe4f5[_0xe876('0x3d')]!=='VIRTUAL'){var _0x2242e2={};_0x2242e2[_0x3fe4f5[_0xe876('0x28')]]={'$like':'%'+_0x2130ed[_0xe876('0x2f')][_0xe876('0x3b')]+'%'};return _0x2242e2;}})});}_0x5e6020=_[_0xe876('0x3e')]({},_0x5e6020,_0x2130ed[_0xe876('0x3f')]);var _0xe9d224={'where':_0x5e6020[_0xe876('0x3c')]};return db[_0xe876('0x2b')][_0xe876('0x18')](_0xe9d224)[_0xe876('0x20')](function(_0x247eb0){_0x399fad[_0xe876('0x18')]=_0x247eb0;if(_0x2130ed[_0xe876('0x2f')][_0xe876('0x40')]){_0x5e6020[_0xe876('0x41')]=[{'all':!![]}];}return db[_0xe876('0x2b')][_0xe876('0x42')](_0x5e6020);})[_0xe876('0x20')](function(_0x4bb55d){_0x399fad[_0xe876('0x43')]=_0x4bb55d;return _0x399fad;})[_0xe876('0x20')](respondWithFilteredResult(_0x2b4671,_0x5e6020))[_0xe876('0x44')](handleError(_0x2b4671,null));};exports[_0xe876('0x45')]=function(_0x4b174b,_0x4d1ab2){var _0x1d7e81={'raw':![],'where':{'id':_0x4b174b['params']['id']}},_0x65da49={};_0x65da49[_0xe876('0x2e')]=_[_0xe876('0x30')](db[_0xe876('0x2b')]['rawAttributes']);_0x65da49['query']=_[_0xe876('0x30')](_0x4b174b[_0xe876('0x2f')]);_0x65da49[_0xe876('0x31')]=_[_0xe876('0x32')](_0x65da49['model'],_0x65da49[_0xe876('0x2f')]);_0x1d7e81['attributes']=_[_0xe876('0x32')](_0x65da49[_0xe876('0x2e')],qs[_0xe876('0x34')](_0x4b174b['query'][_0xe876('0x34')]));_0x1d7e81['attributes']=_0x1d7e81['attributes'][_0xe876('0x35')]?_0x1d7e81['attributes']:_0x65da49[_0xe876('0x2e')];if(_0x4b174b[_0xe876('0x2f')][_0xe876('0x40')]){_0x1d7e81[_0xe876('0x41')]=[{'all':!![]}];}_0x1d7e81=_[_0xe876('0x3e')]({},_0x1d7e81,_0x4b174b[_0xe876('0x3f')]);return db['VoiceMusicOnHold']['find'](_0x1d7e81)['then'](handleEntityNotFound(_0x4d1ab2,null))[_0xe876('0x20')](respondWithResult(_0x4d1ab2,null))['catch'](handleError(_0x4d1ab2,null));};exports[_0xe876('0x1f')]=function(_0x3f9512,_0x182b2c){if(_0x3f9512['body']['id']){delete _0x3f9512[_0xe876('0x46')]['id'];}return db[_0xe876('0x2b')][_0xe876('0x47')]({'where':{'id':_0x3f9512['params']['id']}})[_0xe876('0x20')](handleEntityNotFound(_0x182b2c,null))[_0xe876('0x20')](saveUpdates(_0x3f9512[_0xe876('0x46')],null))[_0xe876('0x20')](respondWithResult(_0x182b2c,null))[_0xe876('0x44')](handleError(_0x182b2c,null));};exports[_0xe876('0x48')]=function(_0x41be92,_0x1bc4e7,_0x1bcfc9){return db['sequelize'][_0xe876('0x49')](function(_0xb52d4b){if(_0x41be92[_0xe876('0x46')][_0xe876('0x4a')]===_0xe876('0x4b')){_0x41be92['body'][_0xe876('0x4c')]=path[_0xe876('0x4d')](config[_0xe876('0x4e')],_0xe876('0x4f'),_0x41be92[_0xe876('0x46')][_0xe876('0x28')]);}return db['VoiceMusicOnHold'][_0xe876('0x48')](_0x41be92[_0xe876('0x46')],{'transaction':_0xb52d4b})['then'](function(_0x153484){if(_0x41be92[_0xe876('0x46')][_0xe876('0x4a')]==='files'){fs[_0xe876('0x50')](_0x153484[_0xe876('0x4c')],parseInt(_0xe876('0x51'),0x8));}var _0x539eb4=_0x41be92[_0xe876('0x52')][_0xe876('0x22')]({'plain':!![]});if(!_0x539eb4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x539eb4[_0xe876('0x53')]===_0xe876('0x52')){var _0x9957f2=_0x153484[_0xe876('0x22')]({'plain':!![]});return db['UserProfileSection'][_0xe876('0x47')]({'where':{'name':'MusicOnHolds','userProfileId':_0x539eb4[_0xe876('0x54')]},'raw':!![]})[_0xe876('0x20')](function(_0x4c1543){if(_0x4c1543&&_0x4c1543['autoAssociation']===0x0){return db[_0xe876('0x24')][_0xe876('0x48')]({'name':_0x9957f2['name'],'resourceId':_0x9957f2['id'],'type':_0x4c1543[_0xe876('0x28')],'sectionId':_0x4c1543['id']},{})[_0xe876('0x20')](function(){return _0x153484;});}else{return _0x153484;}})[_0xe876('0x44')](function(_0x5ab1c2){logger[_0xe876('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5ab1c2);});}return _0x153484;});})[_0xe876('0x20')](respondWithResult(_0x1bc4e7,0xc9))[_0xe876('0x44')](handleError(_0x1bc4e7,null));};exports['destroy']=function(_0x52610f,_0x12140e,_0x489b65){var _0x2d7de5;return db[_0xe876('0x2b')][_0xe876('0x47')]({'where':{'id':_0x52610f[_0xe876('0x55')]['id']}})[_0xe876('0x20')](function(_0x199ccc){if(_0x199ccc){return db[_0xe876('0x56')]['transaction'](function(_0xca7e48){return _0x199ccc[_0xe876('0x21')]({'transaction':_0xca7e48,'raw':!![]})['then'](function(_0x58c720){if(_0x58c720[_0xe876('0x4c')]){fs[_0xe876('0x57')](_0x58c720[_0xe876('0x4c')])['forEach'](function(_0x3b4dea){fs[_0xe876('0x58')](path['join'](_0x58c720[_0xe876('0x4c')],_0x3b4dea));});fs[_0xe876('0x59')](_0x58c720[_0xe876('0x4c')]);}return _0x58c720;});})[_0xe876('0x44')](function(_0x5096f1){throw new db[(_0xe876('0x5a'))][(_0xe876('0x5b'))](_0x5096f1['message']);});}})['then'](handleEntityNotFound(_0x12140e,null))[_0xe876('0x20')](removeEntity(_0x12140e,null))['catch'](handleError(_0x12140e,null));};exports['addSound']=function(_0x2c7353,_0x24d91c,_0xc25e61){return db[_0xe876('0x56')][_0xe876('0x49')](function(_0x2682a7){var _0x2c20ca;return db[_0xe876('0x2b')][_0xe876('0x47')]({'where':{'id':_0x2c7353['params']['id']}})['then'](function(_0x3e0b5f){if(_0x3e0b5f){_0x2c20ca=_0x3e0b5f;return _0x3e0b5f[_0xe876('0x5c')](_0x2c7353[_0xe876('0x46')]['id'],{'transaction':_0x2682a7});}})[_0xe876('0x20')](function(_0x23e26f){if(_0x23e26f){return db[_0xe876('0x5d')][_0xe876('0x5e')]({'where':{'id':_0x2c7353['body']['id']},'attributes':['id',_0xe876('0x28'),_0xe876('0x5f'),'converted_format','createdAt'],'raw':!![]});}})[_0xe876('0x20')](function(_0x562d92){if(_0x562d92){var _0x214e87=path[_0xe876('0x4d')](config[_0xe876('0x4e')],_0xe876('0x60'),util['format']('%s.%s',path[_0xe876('0x61')](_0x562d92[_0xe876('0x5f')],path[_0xe876('0x62')](_0x562d92[_0xe876('0x5f')])),_0x562d92[_0xe876('0x63')]));var _0x210419=path[_0xe876('0x4d')](config[_0xe876('0x4e')],_0xe876('0x4f'),_0x2c20ca['name'],util[_0xe876('0x64')](_0xe876('0x65'),_0x562d92[_0xe876('0x28')],_0x562d92[_0xe876('0x63')]));fs[_0xe876('0x66')](_0x214e87,_0x210419);return _0x562d92;}})['catch'](function(_0x300aad){throw new db['Sequelize'][(_0xe876('0x5b'))](_0x300aad[_0xe876('0x67')]);});})[_0xe876('0x20')](handleEntityNotFound(_0x24d91c,null))['then'](respondWithResult(_0x24d91c,0xc9))['catch'](handleError(_0x24d91c,null));};exports[_0xe876('0x68')]=function(_0x59e8e1,_0x195e0a,_0x522798){return db[_0xe876('0x56')][_0xe876('0x49')](function(_0x1d07f5){var _0x560dd7;return db[_0xe876('0x2b')]['findOne']({'where':{'id':_0x59e8e1[_0xe876('0x55')]['id']}})[_0xe876('0x20')](handleEntityNotFound(_0x195e0a,null))[_0xe876('0x20')](function(_0x4d71b8){if(_0x4d71b8){_0x560dd7=_0x4d71b8;return _0x4d71b8['removeSound'](_0x59e8e1[_0xe876('0x55')][_0xe876('0x69')]);}})[_0xe876('0x20')](function(_0x1ae459){if(_0x1ae459){return db[_0xe876('0x5d')][_0xe876('0x5e')]({'where':{'id':_0x59e8e1['params'][_0xe876('0x69')]},'attributes':['id',_0xe876('0x28'),_0xe876('0x5f'),_0xe876('0x63'),_0xe876('0x6a')],'raw':!![]});}})[_0xe876('0x20')](function(_0x356e58){if(_0x356e58){fs[_0xe876('0x58')](path['join'](_0x560dd7[_0xe876('0x4c')],util['format']('%s.%s',_0x356e58['name'],_0x356e58[_0xe876('0x63')])));return _0x356e58;}})[_0xe876('0x44')](function(_0x5309b3){throw new db[(_0xe876('0x5a'))][(_0xe876('0x5b'))](_0x5309b3[_0xe876('0x67')]);});})['then'](handleEntityNotFound(_0x195e0a,null))[_0xe876('0x20')](respondWithStatusCode(_0x195e0a,0xcc))[_0xe876('0x44')](handleError(_0x195e0a,null));};exports[_0xe876('0x6b')]=function(_0x4bd2d4,_0x2a40fa,_0x580a50){var _0x49fa0b={};var _0x298f5c={};var _0x40d342;var _0x58ed46;return db[_0xe876('0x2b')][_0xe876('0x5e')]({'where':{'id':_0x4bd2d4[_0xe876('0x55')]['id']}})[_0xe876('0x20')](handleEntityNotFound(_0x2a40fa,null))[_0xe876('0x20')](function(_0x507846){if(_0x507846){_0x40d342=_0x507846;_0x298f5c[_0xe876('0x2e')]=_[_0xe876('0x30')](db['Sound']['rawAttributes']);_0x298f5c[_0xe876('0x2f')]=_['keys'](_0x4bd2d4['query']);_0x298f5c[_0xe876('0x31')]=_['intersection'](_0x298f5c[_0xe876('0x2e')],_0x298f5c[_0xe876('0x2f')]);_0x49fa0b[_0xe876('0x33')]=_[_0xe876('0x32')](_0x298f5c[_0xe876('0x2e')],qs['fields'](_0x4bd2d4[_0xe876('0x2f')][_0xe876('0x34')]));_0x49fa0b['attributes']=_0x49fa0b[_0xe876('0x33')][_0xe876('0x35')]?_0x49fa0b[_0xe876('0x33')]:_0x298f5c[_0xe876('0x2e')];_0x49fa0b[_0xe876('0x6c')]=qs[_0xe876('0x39')](_0x4bd2d4[_0xe876('0x2f')]['sort']);_0x49fa0b[_0xe876('0x3c')]=qs['filters'](_[_0xe876('0x3a')](_0x4bd2d4[_0xe876('0x2f')],_0x298f5c[_0xe876('0x31')]));if(_0x4bd2d4['query'][_0xe876('0x3b')]){_0x49fa0b[_0xe876('0x3c')]=_[_0xe876('0x3e')](_0x49fa0b[_0xe876('0x3c')],{'$or':_[_0xe876('0x2a')](_0x49fa0b[_0xe876('0x33')],function(_0xbebe49){var _0x237a29={};_0x237a29[_0xbebe49]={'$like':'%'+_0x4bd2d4['query']['filter']+'%'};return _0x237a29;})});}_0x49fa0b=_['merge']({},_0x49fa0b,_0x4bd2d4[_0xe876('0x3f')]);return _0x40d342[_0xe876('0x6b')](_0x49fa0b);}})[_0xe876('0x20')](function(_0x5bef6e){if(_0x5bef6e){_0x58ed46=_0x5bef6e[_0xe876('0x35')];if(!_0x4bd2d4['query'][_0xe876('0x36')](_0xe876('0x37'))){_0x49fa0b['limit']=qs[_0xe876('0x19')](_0x4bd2d4[_0xe876('0x2f')][_0xe876('0x19')]);_0x49fa0b[_0xe876('0x38')]=qs[_0xe876('0x38')](_0x4bd2d4[_0xe876('0x2f')][_0xe876('0x38')]);}return _0x40d342[_0xe876('0x6b')](_0x49fa0b);}})[_0xe876('0x20')](function(_0x48c7d4){if(_0x48c7d4){return _0x48c7d4?{'count':_0x58ed46,'rows':_0x48c7d4}:null;}})[_0xe876('0x20')](respondWithResult(_0x2a40fa,null))['catch'](handleError(_0x2a40fa,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 4c6502b..0e8dceb 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 _0xfab6=['rimraf','../../config/environment','exports','define','VoiceMusicOnHold','voice_musiconhold','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x358b03,_0x2436cc){var _0x560594=function(_0x2946a7){while(--_0x2946a7){_0x358b03['push'](_0x358b03['shift']());}};_0x560594(++_0x2436cc);}(_0xfab6,0xf0));var _0x6fab=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0xfab6[_0x24f31b];return _0x488401;};'use strict';var _=require('lodash');var util=require(_0x6fab('0x0'));var logger=require(_0x6fab('0x1'))(_0x6fab('0x2'));var moment=require(_0x6fab('0x3'));var BPromise=require(_0x6fab('0x4'));var rp=require(_0x6fab('0x5'));var fs=require('fs');var path=require(_0x6fab('0x6'));var rimraf=require(_0x6fab('0x7'));var config=require(_0x6fab('0x8'));var attributes=require('./voiceMusicOnHold.attributes');module[_0x6fab('0x9')]=function(_0x35ccf3,_0x1b8044){return _0x35ccf3[_0x6fab('0xa')](_0x6fab('0xb'),attributes,{'tableName':_0x6fab('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b8e=['voice_musiconhold','../../config/logger','moment','bluebird','request-promise','../../config/environment','exports'];(function(_0x1bf81c,_0x4a3ad2){var _0x4c531e=function(_0x2d8d65){while(--_0x2d8d65){_0x1bf81c['push'](_0x1bf81c['shift']());}};_0x4c531e(++_0x4a3ad2);}(_0x3b8e,0x10b));var _0xe3b8=function(_0x273e94,_0x2814d8){_0x273e94=_0x273e94-0x0;var _0x2adb36=_0x3b8e[_0x273e94];return _0x2adb36;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe3b8('0x0'))('api');var moment=require(_0xe3b8('0x1'));var BPromise=require(_0xe3b8('0x2'));var rp=require(_0xe3b8('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe3b8('0x4'));var attributes=require('./voiceMusicOnHold.attributes');module[_0xe3b8('0x5')]=function(_0x4b0bf0,_0x540432){return _0x4b0bf0['define']('VoiceMusicOnHold',attributes,{'tableName':_0xe3b8('0x6'),'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 abfdeb2..54b4c27 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 _0xa9e0=['http','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\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(_0x32811d,_0xbd8c7a){var _0x2ef2d5=function(_0xaad7aa){while(--_0xaad7aa){_0x32811d['push'](_0x32811d['shift']());}};_0x2ef2d5(++_0xbd8c7a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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 _0x0713=['VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x42dbf6,_0x280468){var _0x10e43d=function(_0x3d12f4){while(--_0x3d12f4){_0x42dbf6['push'](_0x42dbf6['shift']());}};_0x10e43d(++_0x280468);}(_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 BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 281e0af..3270774 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 _0x43fd=['post','create','addAgents','/:id/teams','addTeams','put','delete','removeTeams','util','express','Router','../../components/auth/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','/describe','describe','/:id','/:id/users','getAgents','getTeams'];(function(_0xa54290,_0x50b0cf){var _0x37625f=function(_0x17d8b0){while(--_0x17d8b0){_0xa54290['push'](_0xa54290['shift']());}};_0x37625f(++_0x50b0cf);}(_0x43fd,0x1ec));var _0xd43f=function(_0x1ab1b3,_0x3588a7){_0x1ab1b3=_0x1ab1b3-0x0;var _0x484c40=_0x43fd[_0x1ab1b3];return _0x484c40;};'use strict';var multer=require('multer');var util=require(_0xd43f('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd43f('0x1'));var router=express[_0xd43f('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xd43f('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xd43f('0x4'));var controller=require(_0xd43f('0x5'));router[_0xd43f('0x6')]('/',auth[_0xd43f('0x7')](),controller['index']);router[_0xd43f('0x6')](_0xd43f('0x8'),auth[_0xd43f('0x7')](),controller[_0xd43f('0x9')]);router['get'](_0xd43f('0xa'),auth[_0xd43f('0x7')](),controller['show']);router[_0xd43f('0x6')](_0xd43f('0xb'),auth[_0xd43f('0x7')](),controller[_0xd43f('0xc')]);router[_0xd43f('0x6')]('/:id/teams',auth[_0xd43f('0x7')](),controller[_0xd43f('0xd')]);router[_0xd43f('0xe')]('/',auth[_0xd43f('0x7')](),controller[_0xd43f('0xf')]);router[_0xd43f('0xe')](_0xd43f('0xb'),auth[_0xd43f('0x7')](),controller[_0xd43f('0x10')]);router[_0xd43f('0xe')](_0xd43f('0x11'),auth['isAuthenticated'](),controller[_0xd43f('0x12')]);router[_0xd43f('0x13')](_0xd43f('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xd43f('0xa'),auth[_0xd43f('0x7')](),controller['destroy']);router[_0xd43f('0x14')](_0xd43f('0xb'),auth['isAuthenticated'](),controller['removeAgents']);router['delete']('/:id/teams',auth[_0xd43f('0x7')](),controller[_0xd43f('0x15')]);module['exports']=router; \ No newline at end of file +var _0xd6bb=['show','getAgents','/:id/teams','post','create','/:id/users','addAgents','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voicePrefix.controller','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0x555b2f,_0x43b622){var _0x81c0a6=function(_0x4629e6){while(--_0x4629e6){_0x555b2f['push'](_0x555b2f['shift']());}};_0x81c0a6(++_0x43b622);}(_0xd6bb,0x1cc));var _0xbd6b=function(_0xaf29da,_0x117f5a){_0xaf29da=_0xaf29da-0x0;var _0x295c51=_0xd6bb[_0xaf29da];return _0x295c51;};'use strict';var multer=require(_0xbd6b('0x0'));var util=require('util');var path=require(_0xbd6b('0x1'));var timeout=require(_0xbd6b('0x2'));var express=require(_0xbd6b('0x3'));var router=express[_0xbd6b('0x4')]();var fs_extra=require(_0xbd6b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbd6b('0x6'));var config=require(_0xbd6b('0x7'));var controller=require(_0xbd6b('0x8'));router['get']('/',auth[_0xbd6b('0x9')](),controller[_0xbd6b('0xa')]);router[_0xbd6b('0xb')](_0xbd6b('0xc'),auth[_0xbd6b('0x9')](),controller[_0xbd6b('0xd')]);router[_0xbd6b('0xb')](_0xbd6b('0xe'),auth[_0xbd6b('0x9')](),controller[_0xbd6b('0xf')]);router[_0xbd6b('0xb')]('/:id/users',auth[_0xbd6b('0x9')](),controller[_0xbd6b('0x10')]);router['get'](_0xbd6b('0x11'),auth[_0xbd6b('0x9')](),controller['getTeams']);router[_0xbd6b('0x12')]('/',auth[_0xbd6b('0x9')](),controller[_0xbd6b('0x13')]);router[_0xbd6b('0x12')](_0xbd6b('0x14'),auth['isAuthenticated'](),controller[_0xbd6b('0x15')]);router[_0xbd6b('0x12')](_0xbd6b('0x11'),auth[_0xbd6b('0x9')](),controller['addTeams']);router['put'](_0xbd6b('0xe'),auth[_0xbd6b('0x9')](),controller[_0xbd6b('0x16')]);router[_0xbd6b('0x17')](_0xbd6b('0xe'),auth[_0xbd6b('0x9')](),controller['destroy']);router[_0xbd6b('0x17')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);router[_0xbd6b('0x17')](_0xbd6b('0x11'),auth[_0xbd6b('0x9')](),controller['removeTeams']);module[_0xbd6b('0x18')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index daf5594..a41ad43 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 _0xae43=['name','exports','STRING','VIRTUAL','system-','getDataValue'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xae43,0xc7));var _0x3ae4=function(_0x6eb833,_0x2bb5e5){_0x6eb833=_0x6eb833-0x0;var _0xdfc38c=_0xae43[_0x6eb833];return _0xdfc38c;};'use strict';var Sequelize=require('sequelize');module[_0x3ae4('0x0')]={'name':{'type':Sequelize[_0x3ae4('0x1')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x3ae4('0x2')],'get':function(_0x23ff66){return _0x3ae4('0x3')+this[_0x3ae4('0x4')](_0x3ae4('0x5'))+'-';}},'description':{'type':Sequelize[_0x3ae4('0x1')]},'callerIdAll':{'type':Sequelize[_0x3ae4('0x1')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xb915=['STRING','VIRTUAL','system-','getDataValue','name','INTEGER','sequelize'];(function(_0x2a56ad,_0x2b94bf){var _0x425175=function(_0x342f20){while(--_0x342f20){_0x2a56ad['push'](_0x2a56ad['shift']());}};_0x425175(++_0x2b94bf);}(_0xb915,0xf4));var _0x5b91=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xb915[_0x3d42d8];return _0x27fc41;};'use strict';var Sequelize=require(_0x5b91('0x0'));module['exports']={'name':{'type':Sequelize[_0x5b91('0x1')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x5b91('0x2')],'get':function(_0x149179){return _0x5b91('0x3')+this[_0x5b91('0x4')](_0x5b91('0x5'))+'-';}},'description':{'type':Sequelize[_0x5b91('0x1')]},'callerIdAll':{'type':Sequelize[_0x5b91('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x5b91('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index ce4c24c..f54ce8d 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 _0x8952=['rawAttributes','fieldName','type','map','keys','filters','intersection','query','fields','attributes','length','model','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','rows','catch','params','find','describe','create','sequelize','transaction','body','get','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','context','from-sip','exten','system','Voice\x20Prefix\x20Extension','prefix','Voice\x20Prefix','VoicePrefixId','push','Set','CDR(prefix)=','callerIdAll','NoOp','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','findById','addAgents','ids','omit','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','getTeams','Team','findAll','Agents','online','interface','addTeams','each','TeamVoicePrefix','upsert','UserVoicePrefix','forEach','select','field','from','team_has_voice_prefixes','join','user_has_teams','VoicePrefixId\x20=\x20?','every','includes','all','union','compact','value','removeTeams','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./voicePrefix.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','VoicePrefixes','error','stack','name','send','index','VoicePrefix'];(function(_0x47fb54,_0x28698c){var _0x1139a7=function(_0x17c781){while(--_0x17c781){_0x47fb54['push'](_0x47fb54['shift']());}};_0x1139a7(++_0x28698c);}(_0x8952,0x17e));var _0x2895=function(_0x32d4a6,_0x5eab34){_0x32d4a6=_0x32d4a6-0x0;var _0x4627df=_0x8952[_0x32d4a6];return _0x4627df;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2895('0x0'));var zipdir=require(_0x2895('0x1'));var jsonpatch=require(_0x2895('0x2'));var rp=require(_0x2895('0x3'));var moment=require(_0x2895('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2895('0x5'));var util=require(_0x2895('0x6'));var path=require(_0x2895('0x7'));var sox=require('sox');var csv=require(_0x2895('0x8'));var ejs=require(_0x2895('0x9'));var fs=require('fs');var fs_extra=require(_0x2895('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2895('0xb'));var jsforce=require(_0x2895('0xc'));var deskjs=require(_0x2895('0xd'));var toCsv=require(_0x2895('0x8'));var querystring=require(_0x2895('0xe'));var Papa=require('papaparse');var Redis=require(_0x2895('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2895('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2895('0x11'));var utils=require(_0x2895('0x12'));var config=require(_0x2895('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x2895('0x14'))['db'];config[_0x2895('0x15')]=_['defaults'](config[_0x2895('0x15')],{'host':_0x2895('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2895('0x17'))[_0x2895('0x18')](socket);function respondWithStatusCode(_0x5777a0,_0x2198c3){_0x2198c3=_0x2198c3||0xcc;return function(_0xd8192e){if(_0xd8192e){return _0x5777a0[_0x2895('0x19')](_0x2198c3);}return _0x5777a0[_0x2895('0x1a')](_0x2198c3)[_0x2895('0x1b')]();};}function respondWithResult(_0x2627e6,_0x6a5c7e){_0x6a5c7e=_0x6a5c7e||0xc8;return function(_0x31bb7f){if(_0x31bb7f){return _0x2627e6[_0x2895('0x1a')](_0x6a5c7e)[_0x2895('0x1c')](_0x31bb7f);}};}function respondWithFilteredResult(_0x10a1bf,_0x183b05){return function(_0xbf8b63){if(_0xbf8b63){var _0x2cb505=typeof _0x183b05[_0x2895('0x1d')]===_0x2895('0x1e')&&typeof _0x183b05[_0x2895('0x1f')]===_0x2895('0x1e');var _0x5a8eab=_0xbf8b63['count'];var _0x493851=_0x2cb505?0x0:_0x183b05[_0x2895('0x1d')];var _0x12c2fb=_0x2cb505?_0xbf8b63[_0x2895('0x20')]:_0x183b05['offset']+_0x183b05[_0x2895('0x1f')];var _0x190b79;if(_0x12c2fb>=_0x5a8eab){_0x12c2fb=_0x5a8eab;_0x190b79=0xc8;}else{_0x190b79=0xce;}_0x10a1bf[_0x2895('0x1a')](_0x190b79);return _0x10a1bf[_0x2895('0x21')](_0x2895('0x22'),_0x493851+'-'+_0x12c2fb+'/'+_0x5a8eab)['json'](_0xbf8b63);}return null;};}function patchUpdates(_0x30c6c3){return function(_0x5e93a4){try{jsonpatch['apply'](_0x5e93a4,_0x30c6c3,!![]);}catch(_0x142e58){return BPromise[_0x2895('0x23')](_0x142e58);}return _0x5e93a4[_0x2895('0x24')]();};}function saveUpdates(_0x511286,_0x4e884f){return function(_0x3a72fa){if(_0x3a72fa){return _0x3a72fa[_0x2895('0x25')](_0x511286)[_0x2895('0x26')](function(_0x4a21cf){return _0x4a21cf;});}return null;};}function removeEntity(_0x3d3320,_0x3690ce){return function(_0x480604){if(_0x480604){return _0x480604[_0x2895('0x27')]()[_0x2895('0x26')](function(){var _0x2cd4df=_0x480604['get']({'plain':!![]});var _0x320661=_0x2895('0x28');return db['UserProfileResource'][_0x2895('0x27')]({'where':{'type':_0x320661,'resourceId':_0x2cd4df['id']}})['then'](function(){return _0x480604;});})['then'](function(){_0x3d3320[_0x2895('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfa4f85,_0x381538){return function(_0x4fdd94){if(!_0x4fdd94){_0xfa4f85['sendStatus'](0x194);}return _0x4fdd94;};}function handleError(_0x32db49,_0x30dc2f){_0x30dc2f=_0x30dc2f||0x1f4;return function(_0x190e07){logger[_0x2895('0x29')](_0x190e07[_0x2895('0x2a')]);if(_0x190e07[_0x2895('0x2b')]){delete _0x190e07[_0x2895('0x2b')];}_0x32db49['status'](_0x30dc2f)[_0x2895('0x2c')](_0x190e07);};}exports[_0x2895('0x2d')]=function(_0x3625ba,_0x5546eb){var _0x1e9c13={},_0x458a55={},_0x31ab90={'count':0x0,'rows':[]};var _0x35a2e8=_['map'](db[_0x2895('0x2e')][_0x2895('0x2f')],function(_0x4765c9){return{'name':_0x4765c9[_0x2895('0x30')],'type':_0x4765c9[_0x2895('0x31')]['key']};});_0x458a55['model']=_[_0x2895('0x32')](_0x35a2e8,_0x2895('0x2b'));_0x458a55['query']=_[_0x2895('0x33')](_0x3625ba['query']);_0x458a55[_0x2895('0x34')]=_[_0x2895('0x35')](_0x458a55['model'],_0x458a55[_0x2895('0x36')]);_0x1e9c13['attributes']=_[_0x2895('0x35')](_0x458a55['model'],qs['fields'](_0x3625ba[_0x2895('0x36')][_0x2895('0x37')]));_0x1e9c13[_0x2895('0x38')]=_0x1e9c13['attributes'][_0x2895('0x39')]?_0x1e9c13[_0x2895('0x38')]:_0x458a55[_0x2895('0x3a')];if(!_0x3625ba[_0x2895('0x36')][_0x2895('0x3b')](_0x2895('0x3c'))){_0x1e9c13[_0x2895('0x1f')]=qs[_0x2895('0x1f')](_0x3625ba[_0x2895('0x36')][_0x2895('0x1f')]);_0x1e9c13['offset']=qs[_0x2895('0x1d')](_0x3625ba[_0x2895('0x36')][_0x2895('0x1d')]);}_0x1e9c13[_0x2895('0x3d')]=qs[_0x2895('0x3e')](_0x3625ba[_0x2895('0x36')][_0x2895('0x3e')]);_0x1e9c13['where']=qs['filters'](_[_0x2895('0x3f')](_0x3625ba[_0x2895('0x36')],_0x458a55[_0x2895('0x34')]),_0x35a2e8);if(_0x3625ba[_0x2895('0x36')][_0x2895('0x40')]){_0x1e9c13[_0x2895('0x41')]=_['merge'](_0x1e9c13['where'],{'$or':_[_0x2895('0x32')](_0x35a2e8,function(_0x20208f){if(_0x20208f['type']!=='VIRTUAL'){var _0x2a0eaf={};_0x2a0eaf[_0x20208f[_0x2895('0x2b')]]={'$like':'%'+_0x3625ba[_0x2895('0x36')][_0x2895('0x40')]+'%'};return _0x2a0eaf;}})});}_0x1e9c13=_[_0x2895('0x42')]({},_0x1e9c13,_0x3625ba[_0x2895('0x43')]);var _0x5d4e23={'where':_0x1e9c13[_0x2895('0x41')]};return db[_0x2895('0x2e')][_0x2895('0x20')](_0x5d4e23)[_0x2895('0x26')](function(_0x4af6d6){_0x31ab90[_0x2895('0x20')]=_0x4af6d6;if(_0x3625ba[_0x2895('0x36')][_0x2895('0x44')]){_0x1e9c13[_0x2895('0x45')]=[{'all':!![]}];}return db['VoicePrefix']['findAll'](_0x1e9c13);})[_0x2895('0x26')](function(_0x19ce85){_0x31ab90[_0x2895('0x46')]=_0x19ce85;return _0x31ab90;})[_0x2895('0x26')](respondWithFilteredResult(_0x5546eb,_0x1e9c13))[_0x2895('0x47')](handleError(_0x5546eb,null));};exports['show']=function(_0x5bd425,_0x4b336c){var _0x28dd37={'raw':![],'where':{'id':_0x5bd425[_0x2895('0x48')]['id']}},_0x2130b2={};_0x2130b2[_0x2895('0x3a')]=_[_0x2895('0x33')](db[_0x2895('0x2e')]['rawAttributes']);_0x2130b2[_0x2895('0x36')]=_[_0x2895('0x33')](_0x5bd425[_0x2895('0x36')]);_0x2130b2[_0x2895('0x34')]=_[_0x2895('0x35')](_0x2130b2[_0x2895('0x3a')],_0x2130b2[_0x2895('0x36')]);_0x28dd37[_0x2895('0x38')]=_['intersection'](_0x2130b2[_0x2895('0x3a')],qs[_0x2895('0x37')](_0x5bd425[_0x2895('0x36')]['fields']));_0x28dd37[_0x2895('0x38')]=_0x28dd37[_0x2895('0x38')]['length']?_0x28dd37[_0x2895('0x38')]:_0x2130b2[_0x2895('0x3a')];if(_0x5bd425[_0x2895('0x36')][_0x2895('0x44')]){_0x28dd37[_0x2895('0x45')]=[{'all':!![]}];}_0x28dd37=_[_0x2895('0x42')]({},_0x28dd37,_0x5bd425[_0x2895('0x43')]);return db['VoicePrefix'][_0x2895('0x49')](_0x28dd37)[_0x2895('0x26')](handleEntityNotFound(_0x4b336c,null))['then'](respondWithResult(_0x4b336c,null))['catch'](handleError(_0x4b336c,null));};exports['destroy']=function(_0x212a1f,_0xe552b6){return db[_0x2895('0x2e')][_0x2895('0x49')]({'where':{'id':_0x212a1f[_0x2895('0x48')]['id']}})[_0x2895('0x26')](handleEntityNotFound(_0xe552b6,null))[_0x2895('0x26')](removeEntity(_0xe552b6,null))[_0x2895('0x47')](handleError(_0xe552b6,null));};exports[_0x2895('0x4a')]=function(_0x3d043c,_0x45302c){return db[_0x2895('0x2e')][_0x2895('0x4a')]()[_0x2895('0x26')](respondWithResult(_0x45302c,null))[_0x2895('0x47')](handleError(_0x45302c,null));};exports[_0x2895('0x4b')]=function(_0x2116a6,_0x3e0fde){var _0xbcf98;return db[_0x2895('0x4c')][_0x2895('0x4d')](function(_0x90ed5d){return db[_0x2895('0x2e')][_0x2895('0x4b')](_0x2116a6[_0x2895('0x4e')],{'transaction':_0x90ed5d})[_0x2895('0x26')](function(_0x16ff3d){_0xbcf98=_0x16ff3d[_0x2895('0x4f')]({'plain':!![]});return db[_0x2895('0x50')][_0x2895('0x49')]({'where':{'id':_0xbcf98[_0x2895('0x51')]},'raw':!![]})['then'](function(_0xbc538a){return createVoicePrefixExtensions(_0xbcf98,_0xbc538a,_0x90ed5d);});});})[_0x2895('0x26')](function(){var _0x2bc573=_0x2116a6[_0x2895('0x52')][_0x2895('0x4f')]({'plain':!![]});if(!_0x2bc573)throw new Error(_0x2895('0x53'));if(_0x2bc573['role']===_0x2895('0x52')){var _0x5579b3=_0xbcf98;return db[_0x2895('0x54')][_0x2895('0x49')]({'where':{'name':_0x2895('0x28'),'userProfileId':_0x2bc573[_0x2895('0x55')]},'raw':!![]})[_0x2895('0x26')](function(_0x56a2c0){if(_0x56a2c0&&_0x56a2c0['autoAssociation']===0x0){return db[_0x2895('0x56')][_0x2895('0x4b')]({'name':_0x5579b3[_0x2895('0x2b')],'resourceId':_0x5579b3['id'],'type':_0x56a2c0['name'],'sectionId':_0x56a2c0['id']},{})[_0x2895('0x26')](function(){return _0xbcf98;});}else{return _0xbcf98;}})['catch'](function(_0x3c1f50){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c1f50);throw _0x3c1f50;});}return _0xbcf98;})['then'](respondWithResult(_0x3e0fde,null))['catch'](handleError(_0x3e0fde,null));};function Extension(_0x36177d,_0x2ff725,_0x402e00,_0x4336c){this[_0x2895('0x57')]=_0x2895('0x58');this[_0x2895('0x59')]=_0x36177d;this['app']=_0x402e00;this[_0x2895('0x31')]=_0x2895('0x5a');this['description']=_0x2895('0x5b');this['priority']=_0x2ff725;this['appdata']=_0x4336c;}function createVoicePrefixExtensions(_0x2a9194,_0x14d7f9,_0x50299a){return new BPromise(function(_0xf5be,_0x3c5e32){var _0x35d979=new Extension(formatPrefixName(_0x2a9194[_0x2895('0x5c')]),0x1,'NoOp',_0x2895('0x5d'));_0x35d979['VoicePrefixId']=_0x2a9194['id'];return db[_0x2895('0x50')]['create'](_0x35d979,{'transaction':_0x50299a})['then'](function(_0x1af031){var _0x58f96a=_0x1af031[_0x2895('0x4f')]({'plain':!![]});var _0x39a28b=_[_0x2895('0x32')](addVoicePrefixExtensions(_0x2a9194,_0x14d7f9),function(_0x559ef3){_0x559ef3[_0x2895('0x51')]=_0x58f96a['id'];_0x559ef3[_0x2895('0x5e')]=_0x2a9194['id'];return _0x559ef3;});return db['VoiceExtension']['bulkCreate'](_0x39a28b,{'transaction':_0x50299a})[_0x2895('0x26')](function(_0x347445){if(!_0x347445){return _0x3c5e32('Extensions\x20creation\x20failed');}else{return _0xf5be(_0x347445);}})[_0x2895('0x47')](function(_0x53f9d8){return _0x3c5e32(_0x53f9d8);});});;});};function addVoicePrefixExtensions(_0x567520,_0x98b64d){var _0x3241cb=[];var _0x16b39c=formatPrefixName(_0x567520['prefix']);_0x3241cb[_0x2895('0x5f')](new Extension(_0x16b39c,0x2,_0x2895('0x60'),_0x2895('0x61')+_0x567520[_0x2895('0x2b')]));if(_0x567520[_0x2895('0x62')]){_0x3241cb[_0x2895('0x5f')](new Extension(_0x16b39c,0x3,_0x2895('0x60'),'PREFIX-CALLERIDALL='+_0x567520[_0x2895('0x62')]));}else{_0x3241cb[_0x2895('0x5f')](new Extension(_0x16b39c,0x3,_0x2895('0x63'),_0x2895('0x64')));}_0x3241cb[_0x2895('0x5f')](new Extension(_0x16b39c,0x4,_0x2895('0x65'),_0x98b64d[_0x2895('0x57')]+','+_0x2895('0x66')+(0x8+_0x567520['name'][_0x2895('0x39')])+'}'+','+0x1));return _0x3241cb;}function formatPrefixName(_0x354718){var _0x16f369='_';for(var _0x2288ff=0x0;_0x2288ff<_0x354718[_0x2895('0x39')];_0x2288ff++){if(_0x354718[_0x2895('0x67')](_0x2288ff)=='-'){_0x16f369+=_0x354718[_0x2895('0x67')](_0x2288ff);}else{_0x16f369+='['+_0x354718[_0x2895('0x67')](_0x2288ff)+']';}}_0x16f369+='.';return _0x16f369;}exports[_0x2895('0x25')]=function(_0x2862aa,_0x53a270,_0x477385){var _0x1a2045=_0x2862aa[_0x2895('0x4e')];_0x1a2045[_0x2895('0x5c')]=_0x2895('0x68')+_0x1a2045[_0x2895('0x2b')]+'-';return db[_0x2895('0x4c')][_0x2895('0x4d')](function(_0x203609){return db[_0x2895('0x2e')]['update'](_0x1a2045,{'where':{'id':_0x1a2045['id']},'transaction':_0x203609})[_0x2895('0x26')](function(){return db[_0x2895('0x50')][_0x2895('0x27')]({'where':{'VoicePrefixId':_0x1a2045['id']},'transaction':_0x203609})[_0x2895('0x26')](function(){return db[_0x2895('0x50')]['find']({'where':{'id':_0x1a2045[_0x2895('0x51')]},'raw':!![]})[_0x2895('0x26')](function(_0x4c569e){return createVoicePrefixExtensions(_0x1a2045,_0x4c569e,_0x203609);});});});})['then'](function(){return db['VoicePrefix'][_0x2895('0x69')](_0x1a2045['id']);})[_0x2895('0x26')](respondWithResult(_0x53a270,null))[_0x2895('0x47')](handleError(_0x53a270,null));};exports[_0x2895('0x6a')]=function(_0x31e21a,_0x48c014,_0x5e6a1f){return db[_0x2895('0x2e')]['find']({'where':{'id':_0x31e21a[_0x2895('0x48')]['id']}})['then'](handleEntityNotFound(_0x48c014,null))[_0x2895('0x26')](function(_0x3de634){if(_0x3de634){return _0x3de634['addAgents'](_0x31e21a[_0x2895('0x4e')][_0x2895('0x6b')],_[_0x2895('0x6c')](_0x31e21a[_0x2895('0x4e')],['ids','id'])||{})['spread'](function(_0x10ca0f){for(var _0x5dde20=0x0;_0x5dde20<_0x31e21a['body'][_0x2895('0x6b')][_0x2895('0x39')];_0x5dde20+=0x1){socket[_0x2895('0x6d')](_0x2895('0x6e'),{'UserId':Number(_0x31e21a['body'][_0x2895('0x6b')][_0x5dde20]),'VoicePrefixId':Number(_0x31e21a[_0x2895('0x48')]['id'])});}return _0x10ca0f;});}})[_0x2895('0x26')](respondWithResult(_0x48c014,null))[_0x2895('0x47')](handleError(_0x48c014,null));};exports[_0x2895('0x6f')]=function(_0x45e80c,_0x21d3dd,_0x3346c2){return db[_0x2895('0x2e')][_0x2895('0x49')]({'where':{'id':_0x45e80c[_0x2895('0x48')]['id']}})[_0x2895('0x26')](handleEntityNotFound(_0x21d3dd,null))['then'](function(_0x1a9c84){if(_0x1a9c84){return _0x1a9c84[_0x2895('0x6f')](_0x45e80c[_0x2895('0x36')]['ids'])[_0x2895('0x26')](function(){if(_[_0x2895('0x70')](_0x45e80c['query'][_0x2895('0x6b')])){for(var _0x1693b6=0x0;_0x1693b6<_0x45e80c[_0x2895('0x36')]['ids'][_0x2895('0x39')];_0x1693b6+=0x1){socket[_0x2895('0x6d')](_0x2895('0x71'),{'UserId':Number(_0x45e80c[_0x2895('0x36')]['ids'][_0x1693b6]),'VoicePrefixId':Number(_0x45e80c[_0x2895('0x48')]['id'])});}}else{socket[_0x2895('0x6d')](_0x2895('0x71'),{'UserId':Number(_0x45e80c['query'][_0x2895('0x6b')]),'VoicePrefixId':Number(_0x45e80c['params']['id'])});}});}})[_0x2895('0x26')](respondWithStatusCode(_0x21d3dd,null))[_0x2895('0x47')](handleError(_0x21d3dd,null));};exports[_0x2895('0x72')]=function(_0x253e07,_0x570dd9,_0x6eef86){var _0x46bbca={};var _0x413aa4={};var _0x5e892a;var _0x34898e;return db['VoicePrefix'][_0x2895('0x73')]({'where':{'id':_0x253e07[_0x2895('0x48')]['id']}})['then'](handleEntityNotFound(_0x570dd9,null))['then'](function(_0x3bd07c){if(_0x3bd07c){_0x5e892a=_0x3bd07c;_0x413aa4[_0x2895('0x3a')]=_['keys'](db[_0x2895('0x74')][_0x2895('0x2f')]);_0x413aa4['query']=_[_0x2895('0x33')](_0x253e07[_0x2895('0x36')]);_0x413aa4[_0x2895('0x34')]=_[_0x2895('0x35')](_0x413aa4[_0x2895('0x3a')],_0x413aa4['query']);_0x46bbca[_0x2895('0x38')]=_[_0x2895('0x35')](_0x413aa4[_0x2895('0x3a')],qs[_0x2895('0x37')](_0x253e07[_0x2895('0x36')]['fields']));_0x46bbca[_0x2895('0x38')]=_0x46bbca[_0x2895('0x38')][_0x2895('0x39')]?_0x46bbca[_0x2895('0x38')]:_0x413aa4['model'];_0x46bbca[_0x2895('0x3d')]=qs[_0x2895('0x3e')](_0x253e07[_0x2895('0x36')][_0x2895('0x3e')]);_0x46bbca['where']=qs[_0x2895('0x34')](_[_0x2895('0x3f')](_0x253e07[_0x2895('0x36')],_0x413aa4[_0x2895('0x34')]));if(_0x253e07[_0x2895('0x36')][_0x2895('0x40')]){_0x46bbca['where']=_[_0x2895('0x42')](_0x46bbca[_0x2895('0x41')],{'$or':_[_0x2895('0x32')](_0x46bbca['attributes'],function(_0x553af0){var _0x1ff21e={};_0x1ff21e[_0x553af0]={'$like':'%'+_0x253e07[_0x2895('0x36')][_0x2895('0x40')]+'%'};return _0x1ff21e;})});}_0x46bbca=_[_0x2895('0x42')]({},_0x46bbca,_0x253e07[_0x2895('0x43')]);return _0x5e892a['getAgents'](_0x46bbca);}})[_0x2895('0x26')](function(_0x837eef){if(_0x837eef){_0x34898e=_0x837eef[_0x2895('0x39')];if(!_0x253e07['query']['hasOwnProperty'](_0x2895('0x3c'))){_0x46bbca[_0x2895('0x1f')]=qs[_0x2895('0x1f')](_0x253e07['query'][_0x2895('0x1f')]);_0x46bbca[_0x2895('0x1d')]=qs[_0x2895('0x1d')](_0x253e07[_0x2895('0x36')]['offset']);}return _0x5e892a[_0x2895('0x72')](_0x46bbca);}})[_0x2895('0x26')](function(_0x71d436){if(_0x71d436){return _0x71d436?{'count':_0x34898e,'rows':_0x71d436}:null;}})[_0x2895('0x26')](respondWithResult(_0x570dd9,null))[_0x2895('0x47')](handleError(_0x570dd9,null));};exports[_0x2895('0x75')]=function(_0x3ae81f,_0x25f5c9,_0x2d6167){var _0x265c7a={};var _0x32baef={};var _0x3d2996;var _0x3d47d0;return db[_0x2895('0x2e')]['findOne']({'where':{'id':_0x3ae81f['params']['id']}})['then'](handleEntityNotFound(_0x25f5c9,null))['then'](function(_0x440fbf){if(_0x440fbf){_0x3d2996=_0x440fbf;_0x32baef[_0x2895('0x3a')]=_[_0x2895('0x33')](db[_0x2895('0x76')][_0x2895('0x2f')]);_0x32baef[_0x2895('0x36')]=_[_0x2895('0x33')](_0x3ae81f[_0x2895('0x36')]);_0x32baef[_0x2895('0x34')]=_[_0x2895('0x35')](_0x32baef[_0x2895('0x3a')],_0x32baef[_0x2895('0x36')]);_0x265c7a[_0x2895('0x38')]=_[_0x2895('0x35')](_0x32baef['model'],qs[_0x2895('0x37')](_0x3ae81f[_0x2895('0x36')][_0x2895('0x37')]));_0x265c7a['attributes']=_0x265c7a['attributes'][_0x2895('0x39')]?_0x265c7a[_0x2895('0x38')]:_0x32baef['model'];_0x265c7a[_0x2895('0x3d')]=qs['sort'](_0x3ae81f[_0x2895('0x36')][_0x2895('0x3e')]);_0x265c7a[_0x2895('0x41')]=qs[_0x2895('0x34')](_[_0x2895('0x3f')](_0x3ae81f[_0x2895('0x36')],_0x32baef[_0x2895('0x34')]));if(_0x3ae81f['query'][_0x2895('0x40')]){_0x265c7a[_0x2895('0x41')]=_['merge'](_0x265c7a[_0x2895('0x41')],{'$or':_[_0x2895('0x32')](_0x265c7a['attributes'],function(_0x1cf787){var _0x3c8ea2={};_0x3c8ea2[_0x1cf787]={'$like':'%'+_0x3ae81f[_0x2895('0x36')][_0x2895('0x40')]+'%'};return _0x3c8ea2;})});}_0x265c7a=_[_0x2895('0x42')]({},_0x265c7a,_0x3ae81f[_0x2895('0x43')]);return _0x3d2996[_0x2895('0x75')](_0x265c7a);}})[_0x2895('0x26')](function(_0xdbd16a){if(_0xdbd16a){_0x3d47d0=_0xdbd16a[_0x2895('0x39')];if(!_0x3ae81f[_0x2895('0x36')][_0x2895('0x3b')](_0x2895('0x3c'))){_0x265c7a[_0x2895('0x1f')]=qs['limit'](_0x3ae81f[_0x2895('0x36')][_0x2895('0x1f')]);_0x265c7a[_0x2895('0x1d')]=qs[_0x2895('0x1d')](_0x3ae81f[_0x2895('0x36')][_0x2895('0x1d')]);}return _0x3d2996[_0x2895('0x75')](_0x265c7a);}})['then'](function(_0x17055a){if(_0x17055a){return _0x17055a?{'count':_0x3d47d0,'rows':_0x17055a}:null;}})['then'](respondWithResult(_0x25f5c9,null))[_0x2895('0x47')](handleError(_0x25f5c9,null));};exports['addTeams']=function(_0x204af3,_0x3e2994,_0x1e85d9){var _0x53ccff=_0x204af3[_0x2895('0x4e')]['ids'];var _0x3f024f;return db[_0x2895('0x76')][_0x2895('0x77')]({'where':{'id':_0x53ccff},'attributes':['id'],'include':[{'model':db[_0x2895('0x74')],'as':_0x2895('0x78'),'attributes':['id',_0x2895('0x2b'),_0x2895('0x79'),'voicePause',_0x2895('0x7a')],'raw':!![]}]})[_0x2895('0x26')](function(_0x1b8f32){if(_0x1b8f32){_0x3f024f=_0x1b8f32;var _0x4b7c11=_['flatMap'](_0x1b8f32,function(_0x335da0){var _0x13e113=_0x335da0[_0x2895('0x4f')]({'plain':!![]});return _0x13e113['Agents'];});return db[_0x2895('0x2e')][_0x2895('0x49')]({'where':{'id':_0x204af3[_0x2895('0x48')]['id']}})[_0x2895('0x26')](function(_0x1dcc85){return db[_0x2895('0x4c')][_0x2895('0x4d')](function(_0x2d6109){return _0x1dcc85[_0x2895('0x7b')](_0x53ccff,{'transaction':_0x2d6109})[_0x2895('0x26')](function(){return BPromise[_0x2895('0x7c')](_0x3f024f,function(_0x16ec29){return db[_0x2895('0x7d')][_0x2895('0x7e')]({'TeamId':_0x16ec29['id'],'VoicePrefixId':_0x204af3[_0x2895('0x48')]['id']},{'transaction':_0x2d6109});});})[_0x2895('0x26')](function(){return BPromise[_0x2895('0x7c')](_0x4b7c11,function(_0x2c6df4){return db[_0x2895('0x7f')]['findOrCreate']({'where':{'UserId':_0x2c6df4['id'],'VoicePrefixId':_0x204af3['params']['id']},'transaction':_0x2d6109});});})[_0x2895('0x26')](function(){_0x4b7c11[_0x2895('0x80')](function(_0x366ca5){socket[_0x2895('0x6d')](_0x2895('0x6e'),{'UserId':_0x366ca5['id'],'VoicePrefixId':_0x1dcc85['id']});});});});});}})[_0x2895('0x26')](respondWithStatusCode(_0x3e2994,null))['catch'](handleError(_0x3e2994,null));};exports['removeTeams']=function(_0x51b96a,_0x40d48c,_0x4f0b85){return db[_0x2895('0x76')][_0x2895('0x77')]({'where':{'id':_0x51b96a[_0x2895('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0x2895('0x74')],'as':_0x2895('0x78'),'attributes':['id'],'raw':!![]}]})[_0x2895('0x26')](handleEntityNotFound(_0x40d48c,null))['then'](function(_0x340cb7){var _0x2458f1=_[_0x2895('0x32')](_0x340cb7,'id');var _0x2e3651=[];var _0x2187ce=[];var _0x175202=squel[_0x2895('0x81')]();_0x175202[_0x2895('0x82')]('tq.TeamId')[_0x2895('0x83')](_0x2895('0x84'),'tq')[_0x2895('0x85')](_0x2895('0x86'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x2895('0x87'),_0x51b96a[_0x2895('0x48')]['id']);for(var _0x53eef2=0x0;_0x53eef2<_0x340cb7[_0x2895('0x39')];_0x53eef2+=0x1){let _0x1e2311=_0x340cb7[_0x53eef2];for(var _0x368a30=0x0;_0x368a30<_0x1e2311['Agents'][_0x2895('0x39')];_0x368a30+=0x1){let _0x2dd3d9=_0x1e2311[_0x2895('0x78')][_0x368a30];var _0x233136=_0x175202['clone']();_0x233136[_0x2895('0x41')]('ut.UserId\x20=\x20?',_0x2dd3d9['id']);_0x2187ce['push'](db['sequelize'][_0x2895('0x36')](_0x233136['toString'](),{'type':db['sequelize']['QueryTypes']['SELECT']})['then'](function(_0x2bbb3e){if(_0x2bbb3e[_0x2895('0x39')]===0x1){return _0x2dd3d9['id'];}else{var _0x25969b=_[_0x2895('0x88')](_['map'](_0x2bbb3e,'TeamId'),function(_0x5cc9fc){return _[_0x2895('0x89')](_0x2458f1,_0x5cc9fc);});if(_0x25969b){return _0x2dd3d9['id'];}}}));}}return BPromise[_0x2895('0x8a')](_0x2187ce)[_0x2895('0x26')](function(_0x2ccc9f){_0x2e3651=_(_0x2e3651)[_0x2895('0x8b')](_0x2ccc9f)[_0x2895('0x8c')]()[_0x2895('0x8d')]();return db[_0x2895('0x2e')]['find']({'where':{'id':_0x51b96a[_0x2895('0x48')]['id']}})[_0x2895('0x26')](function(_0x16f74a){return db['sequelize'][_0x2895('0x4d')](function(_0x5d05d3){return _0x16f74a[_0x2895('0x8e')](_0x51b96a[_0x2895('0x36')][_0x2895('0x6b')],{'transaction':_0x5d05d3})[_0x2895('0x26')](function(){if(!_['isEmpty'](_0x2e3651)){return _0x16f74a[_0x2895('0x6f')](_0x2e3651,{'transaction':_0x5d05d3});}})[_0x2895('0x26')](function(){_0x2e3651[_0x2895('0x80')](function(_0x3fb18a){socket[_0x2895('0x6d')]('userVoicePrefix:remove',{'UserId':_0x3fb18a,'VoicePrefixId':_0x16f74a['id']});});});});});});})[_0x2895('0x26')](respondWithStatusCode(_0x40d48c,null))[_0x2895('0x47')](handleError(_0x40d48c,null));}; \ No newline at end of file +var _0x958a=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','redis','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','get','VoicePrefixes','UserProfileResource','destroy','error','stack','name','index','map','VoicePrefix','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','findAll','rows','catch','show','params','rawAttributes','include','find','describe','sequelize','transaction','create','body','VoiceExtension','VoiceExtensionId','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','type','description','Voice\x20Prefix\x20Extension','priority','prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','CDR(prefix)=','Set','PREFIX-CALLERIDALL=','callerIdAll','NoOp','No\x20callerid\x20available','charAt','system-','findById','addAgents','ids','spread','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','findOne','getAgents','getTeams','addTeams','Team','User','online','voicePause','flatMap','Agents','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','removeTeams','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','includes','all','compact','value','isEmpty','forEach','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x958a,0x128));var _0xa958=function(_0x519272,_0x22f519){_0x519272=_0x519272-0x0;var _0x32ee57=_0x958a[_0x519272];return _0x32ee57;};'use strict';var emlformat=require(_0xa958('0x0'));var rimraf=require(_0xa958('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa958('0x2'));var rp=require(_0xa958('0x3'));var moment=require(_0xa958('0x4'));var BPromise=require(_0xa958('0x5'));var Mustache=require(_0xa958('0x6'));var util=require('util');var path=require(_0xa958('0x7'));var sox=require('sox');var csv=require(_0xa958('0x8'));var ejs=require(_0xa958('0x9'));var fs=require('fs');var fs_extra=require(_0xa958('0xa'));var _=require(_0xa958('0xb'));var squel=require(_0xa958('0xc'));var crypto=require(_0xa958('0xd'));var jsforce=require(_0xa958('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa958('0xf'));var Papa=require(_0xa958('0x10'));var Redis=require(_0xa958('0x11'));var authService=require(_0xa958('0x12'));var qs=require(_0xa958('0x13'));var as=require(_0xa958('0x14'));var hardwareService=require(_0xa958('0x15'));var logger=require(_0xa958('0x16'))(_0xa958('0x17'));var utils=require(_0xa958('0x18'));var config=require(_0xa958('0x19'));var licenseUtil=require(_0xa958('0x1a'));var db=require(_0xa958('0x1b'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xa958('0x1c'),'port':0x18eb});var socket=require(_0xa958('0x1d'))(new Redis(config[_0xa958('0x1e')]));require('./voicePrefix.socket')[_0xa958('0x1f')](socket);function respondWithStatusCode(_0x54c439,_0x5194b4){_0x5194b4=_0x5194b4||0xcc;return function(_0x53d5c7){if(_0x53d5c7){return _0x54c439[_0xa958('0x20')](_0x5194b4);}return _0x54c439[_0xa958('0x21')](_0x5194b4)[_0xa958('0x22')]();};}function respondWithResult(_0x6a81c7,_0x2c270c){_0x2c270c=_0x2c270c||0xc8;return function(_0x398931){if(_0x398931){return _0x6a81c7[_0xa958('0x21')](_0x2c270c)[_0xa958('0x23')](_0x398931);}};}function respondWithFilteredResult(_0x4d836f,_0x39af49){return function(_0x4eadc9){if(_0x4eadc9){var _0x3a053f=typeof _0x39af49[_0xa958('0x24')]==='undefined'&&typeof _0x39af49[_0xa958('0x25')]===_0xa958('0x26');var _0x47636f=_0x4eadc9[_0xa958('0x27')];var _0x2759ad=_0x3a053f?0x0:_0x39af49[_0xa958('0x24')];var _0x56314b=_0x3a053f?_0x4eadc9['count']:_0x39af49[_0xa958('0x24')]+_0x39af49[_0xa958('0x25')];var _0x16c0be;if(_0x56314b>=_0x47636f){_0x56314b=_0x47636f;_0x16c0be=0xc8;}else{_0x16c0be=0xce;}_0x4d836f['status'](_0x16c0be);return _0x4d836f[_0xa958('0x28')](_0xa958('0x29'),_0x2759ad+'-'+_0x56314b+'/'+_0x47636f)['json'](_0x4eadc9);}return null;};}function patchUpdates(_0x28cf12){return function(_0x401175){try{jsonpatch['apply'](_0x401175,_0x28cf12,!![]);}catch(_0x5c5a2b){return BPromise[_0xa958('0x2a')](_0x5c5a2b);}return _0x401175[_0xa958('0x2b')]();};}function saveUpdates(_0x50b3c3,_0x25f461){return function(_0x27097a){if(_0x27097a){return _0x27097a[_0xa958('0x2c')](_0x50b3c3)[_0xa958('0x2d')](function(_0x16b04a){return _0x16b04a;});}return null;};}function removeEntity(_0xf1436e,_0x50fdb1){return function(_0x3e3d77){if(_0x3e3d77){return _0x3e3d77['destroy']()[_0xa958('0x2d')](function(){var _0x3c2ea3=_0x3e3d77[_0xa958('0x2e')]({'plain':!![]});var _0x18f600=_0xa958('0x2f');return db[_0xa958('0x30')][_0xa958('0x31')]({'where':{'type':_0x18f600,'resourceId':_0x3c2ea3['id']}})[_0xa958('0x2d')](function(){return _0x3e3d77;});})[_0xa958('0x2d')](function(){_0xf1436e[_0xa958('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47895c,_0xd2fcc9){return function(_0x4ef4f6){if(!_0x4ef4f6){_0x47895c[_0xa958('0x20')](0x194);}return _0x4ef4f6;};}function handleError(_0x1b76de,_0x4b3089){_0x4b3089=_0x4b3089||0x1f4;return function(_0x23bdbf){logger[_0xa958('0x32')](_0x23bdbf[_0xa958('0x33')]);if(_0x23bdbf[_0xa958('0x34')]){delete _0x23bdbf[_0xa958('0x34')];}_0x1b76de['status'](_0x4b3089)['send'](_0x23bdbf);};}exports[_0xa958('0x35')]=function(_0x5d9a3d,_0x51e50b){var _0x30d51f={},_0x3f6de3={},_0x135322={'count':0x0,'rows':[]};var _0x43b912=_[_0xa958('0x36')](db[_0xa958('0x37')]['rawAttributes'],function(_0x32c4e3){return{'name':_0x32c4e3['fieldName'],'type':_0x32c4e3['type'][_0xa958('0x38')]};});_0x3f6de3[_0xa958('0x39')]=_[_0xa958('0x36')](_0x43b912,_0xa958('0x34'));_0x3f6de3[_0xa958('0x3a')]=_[_0xa958('0x3b')](_0x5d9a3d[_0xa958('0x3a')]);_0x3f6de3[_0xa958('0x3c')]=_['intersection'](_0x3f6de3['model'],_0x3f6de3[_0xa958('0x3a')]);_0x30d51f[_0xa958('0x3d')]=_[_0xa958('0x3e')](_0x3f6de3[_0xa958('0x39')],qs[_0xa958('0x3f')](_0x5d9a3d['query'][_0xa958('0x3f')]));_0x30d51f[_0xa958('0x3d')]=_0x30d51f[_0xa958('0x3d')][_0xa958('0x40')]?_0x30d51f['attributes']:_0x3f6de3[_0xa958('0x39')];if(!_0x5d9a3d[_0xa958('0x3a')][_0xa958('0x41')](_0xa958('0x42'))){_0x30d51f[_0xa958('0x25')]=qs['limit'](_0x5d9a3d[_0xa958('0x3a')][_0xa958('0x25')]);_0x30d51f[_0xa958('0x24')]=qs[_0xa958('0x24')](_0x5d9a3d[_0xa958('0x3a')][_0xa958('0x24')]);}_0x30d51f[_0xa958('0x43')]=qs[_0xa958('0x44')](_0x5d9a3d[_0xa958('0x3a')][_0xa958('0x44')]);_0x30d51f['where']=qs[_0xa958('0x3c')](_[_0xa958('0x45')](_0x5d9a3d[_0xa958('0x3a')],_0x3f6de3['filters']),_0x43b912);if(_0x5d9a3d[_0xa958('0x3a')][_0xa958('0x46')]){_0x30d51f['where']=_['merge'](_0x30d51f[_0xa958('0x47')],{'$or':_['map'](_0x43b912,function(_0x3b5e74){if(_0x3b5e74['type']!==_0xa958('0x48')){var _0x59d562={};_0x59d562[_0x3b5e74[_0xa958('0x34')]]={'$like':'%'+_0x5d9a3d[_0xa958('0x3a')][_0xa958('0x46')]+'%'};return _0x59d562;}})});}_0x30d51f=_[_0xa958('0x49')]({},_0x30d51f,_0x5d9a3d[_0xa958('0x4a')]);var _0x45b383={'where':_0x30d51f[_0xa958('0x47')]};return db[_0xa958('0x37')]['count'](_0x45b383)[_0xa958('0x2d')](function(_0x38dfb4){_0x135322[_0xa958('0x27')]=_0x38dfb4;if(_0x5d9a3d['query']['includeAll']){_0x30d51f['include']=[{'all':!![]}];}return db[_0xa958('0x37')][_0xa958('0x4b')](_0x30d51f);})[_0xa958('0x2d')](function(_0x155901){_0x135322[_0xa958('0x4c')]=_0x155901;return _0x135322;})['then'](respondWithFilteredResult(_0x51e50b,_0x30d51f))[_0xa958('0x4d')](handleError(_0x51e50b,null));};exports[_0xa958('0x4e')]=function(_0x2fdf2b,_0x2bfdee){var _0x303331={'raw':![],'where':{'id':_0x2fdf2b[_0xa958('0x4f')]['id']}},_0x1118bb={};_0x1118bb[_0xa958('0x39')]=_[_0xa958('0x3b')](db[_0xa958('0x37')][_0xa958('0x50')]);_0x1118bb[_0xa958('0x3a')]=_[_0xa958('0x3b')](_0x2fdf2b[_0xa958('0x3a')]);_0x1118bb[_0xa958('0x3c')]=_[_0xa958('0x3e')](_0x1118bb[_0xa958('0x39')],_0x1118bb['query']);_0x303331['attributes']=_['intersection'](_0x1118bb[_0xa958('0x39')],qs[_0xa958('0x3f')](_0x2fdf2b[_0xa958('0x3a')][_0xa958('0x3f')]));_0x303331['attributes']=_0x303331[_0xa958('0x3d')][_0xa958('0x40')]?_0x303331[_0xa958('0x3d')]:_0x1118bb[_0xa958('0x39')];if(_0x2fdf2b[_0xa958('0x3a')]['includeAll']){_0x303331[_0xa958('0x51')]=[{'all':!![]}];}_0x303331=_[_0xa958('0x49')]({},_0x303331,_0x2fdf2b[_0xa958('0x4a')]);return db['VoicePrefix'][_0xa958('0x52')](_0x303331)['then'](handleEntityNotFound(_0x2bfdee,null))[_0xa958('0x2d')](respondWithResult(_0x2bfdee,null))[_0xa958('0x4d')](handleError(_0x2bfdee,null));};exports[_0xa958('0x31')]=function(_0x4e0740,_0x35f6bf){return db['VoicePrefix'][_0xa958('0x52')]({'where':{'id':_0x4e0740[_0xa958('0x4f')]['id']}})[_0xa958('0x2d')](handleEntityNotFound(_0x35f6bf,null))[_0xa958('0x2d')](removeEntity(_0x35f6bf,null))[_0xa958('0x4d')](handleError(_0x35f6bf,null));};exports['describe']=function(_0x1e9c64,_0x49f9da){return db[_0xa958('0x37')][_0xa958('0x53')]()['then'](respondWithResult(_0x49f9da,null))[_0xa958('0x4d')](handleError(_0x49f9da,null));};exports['create']=function(_0x317059,_0x39619f){var _0x15c0fe;return db[_0xa958('0x54')][_0xa958('0x55')](function(_0x65f37f){return db[_0xa958('0x37')][_0xa958('0x56')](_0x317059[_0xa958('0x57')],{'transaction':_0x65f37f})['then'](function(_0x37d54f){_0x15c0fe=_0x37d54f['get']({'plain':!![]});return db[_0xa958('0x58')][_0xa958('0x52')]({'where':{'id':_0x15c0fe[_0xa958('0x59')]},'raw':!![]})['then'](function(_0x4f0440){return createVoicePrefixExtensions(_0x15c0fe,_0x4f0440,_0x65f37f);});});})[_0xa958('0x2d')](function(){var _0xab6085=_0x317059[_0xa958('0x5a')][_0xa958('0x2e')]({'plain':!![]});if(!_0xab6085)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xab6085[_0xa958('0x5b')]===_0xa958('0x5a')){var _0x4cf7af=_0x15c0fe;return db[_0xa958('0x5c')][_0xa958('0x52')]({'where':{'name':'VoicePrefixes','userProfileId':_0xab6085[_0xa958('0x5d')]},'raw':!![]})['then'](function(_0x5629c4){if(_0x5629c4&&_0x5629c4['autoAssociation']===0x0){return db[_0xa958('0x30')][_0xa958('0x56')]({'name':_0x4cf7af[_0xa958('0x34')],'resourceId':_0x4cf7af['id'],'type':_0x5629c4[_0xa958('0x34')],'sectionId':_0x5629c4['id']},{})['then'](function(){return _0x15c0fe;});}else{return _0x15c0fe;}})[_0xa958('0x4d')](function(_0x4aaf1a){logger[_0xa958('0x32')](_0xa958('0x5e'),_0x4aaf1a);throw _0x4aaf1a;});}return _0x15c0fe;})[_0xa958('0x2d')](respondWithResult(_0x39619f,null))[_0xa958('0x4d')](handleError(_0x39619f,null));};function Extension(_0x25865d,_0x11cc0b,_0x485e67,_0x4937a5){this[_0xa958('0x5f')]=_0xa958('0x60');this[_0xa958('0x61')]=_0x25865d;this[_0xa958('0x62')]=_0x485e67;this[_0xa958('0x63')]='system';this[_0xa958('0x64')]=_0xa958('0x65');this[_0xa958('0x66')]=_0x11cc0b;this['appdata']=_0x4937a5;}function createVoicePrefixExtensions(_0xf7e817,_0x2496f8,_0x364725){return new BPromise(function(_0x14cbb6,_0x35177a){var _0x2d40b1=new Extension(formatPrefixName(_0xf7e817[_0xa958('0x67')]),0x1,'NoOp','Voice\x20Prefix');_0x2d40b1[_0xa958('0x68')]=_0xf7e817['id'];return db['VoiceExtension'][_0xa958('0x56')](_0x2d40b1,{'transaction':_0x364725})[_0xa958('0x2d')](function(_0x1ea51b){var _0x3f0396=_0x1ea51b[_0xa958('0x2e')]({'plain':!![]});var _0x3859e2=_[_0xa958('0x36')](addVoicePrefixExtensions(_0xf7e817,_0x2496f8),function(_0x358c8b){_0x358c8b[_0xa958('0x59')]=_0x3f0396['id'];_0x358c8b['VoicePrefixId']=_0xf7e817['id'];return _0x358c8b;});return db[_0xa958('0x58')][_0xa958('0x69')](_0x3859e2,{'transaction':_0x364725})['then'](function(_0x53a26d){if(!_0x53a26d){return _0x35177a(_0xa958('0x6a'));}else{return _0x14cbb6(_0x53a26d);}})[_0xa958('0x4d')](function(_0xa769e0){return _0x35177a(_0xa769e0);});});;});};function addVoicePrefixExtensions(_0x36d3cd,_0x3736df){var _0x5625e7=[];var _0x25ca0b=formatPrefixName(_0x36d3cd['prefix']);_0x5625e7[_0xa958('0x6b')](new Extension(_0x25ca0b,0x2,'Set',_0xa958('0x6c')+_0x36d3cd[_0xa958('0x34')]));if(_0x36d3cd['callerIdAll']){_0x5625e7[_0xa958('0x6b')](new Extension(_0x25ca0b,0x3,_0xa958('0x6d'),_0xa958('0x6e')+_0x36d3cd[_0xa958('0x6f')]));}else{_0x5625e7[_0xa958('0x6b')](new Extension(_0x25ca0b,0x3,_0xa958('0x70'),_0xa958('0x71')));}_0x5625e7[_0xa958('0x6b')](new Extension(_0x25ca0b,0x4,'goto',_0x3736df['context']+','+'${EXTEN:'+(0x8+_0x36d3cd[_0xa958('0x34')]['length'])+'}'+','+0x1));return _0x5625e7;}function formatPrefixName(_0x21d139){var _0x739fa1='_';for(var _0x52484f=0x0;_0x52484f<_0x21d139['length'];_0x52484f++){if(_0x21d139[_0xa958('0x72')](_0x52484f)=='-'){_0x739fa1+=_0x21d139[_0xa958('0x72')](_0x52484f);}else{_0x739fa1+='['+_0x21d139[_0xa958('0x72')](_0x52484f)+']';}}_0x739fa1+='.';return _0x739fa1;}exports[_0xa958('0x2c')]=function(_0x2c2e81,_0x58083e,_0x32f9dc){var _0x5379f1=_0x2c2e81[_0xa958('0x57')];_0x5379f1[_0xa958('0x67')]=_0xa958('0x73')+_0x5379f1['name']+'-';return db[_0xa958('0x54')][_0xa958('0x55')](function(_0x4df64f){return db[_0xa958('0x37')][_0xa958('0x2c')](_0x5379f1,{'where':{'id':_0x5379f1['id']},'transaction':_0x4df64f})[_0xa958('0x2d')](function(){return db[_0xa958('0x58')][_0xa958('0x31')]({'where':{'VoicePrefixId':_0x5379f1['id']},'transaction':_0x4df64f})['then'](function(){return db[_0xa958('0x58')]['find']({'where':{'id':_0x5379f1[_0xa958('0x59')]},'raw':!![]})['then'](function(_0x1b2d7e){return createVoicePrefixExtensions(_0x5379f1,_0x1b2d7e,_0x4df64f);});});});})[_0xa958('0x2d')](function(){return db[_0xa958('0x37')][_0xa958('0x74')](_0x5379f1['id']);})[_0xa958('0x2d')](respondWithResult(_0x58083e,null))[_0xa958('0x4d')](handleError(_0x58083e,null));};exports[_0xa958('0x75')]=function(_0x5de628,_0x4a41a8,_0x349bf9){return db['VoicePrefix'][_0xa958('0x52')]({'where':{'id':_0x5de628[_0xa958('0x4f')]['id']}})[_0xa958('0x2d')](handleEntityNotFound(_0x4a41a8,null))[_0xa958('0x2d')](function(_0x3b8dbf){if(_0x3b8dbf){return _0x3b8dbf[_0xa958('0x75')](_0x5de628[_0xa958('0x57')][_0xa958('0x76')],_['omit'](_0x5de628[_0xa958('0x57')],[_0xa958('0x76'),'id'])||{})[_0xa958('0x77')](function(_0x443e97){for(var _0x4eb829=0x0;_0x4eb829<_0x5de628[_0xa958('0x57')][_0xa958('0x76')][_0xa958('0x40')];_0x4eb829+=0x1){socket[_0xa958('0x78')](_0xa958('0x79'),{'UserId':Number(_0x5de628[_0xa958('0x57')]['ids'][_0x4eb829]),'VoicePrefixId':Number(_0x5de628[_0xa958('0x4f')]['id'])});}return _0x443e97;});}})[_0xa958('0x2d')](respondWithResult(_0x4a41a8,null))[_0xa958('0x4d')](handleError(_0x4a41a8,null));};exports[_0xa958('0x7a')]=function(_0x2d54ba,_0x3c87c6,_0x501462){return db['VoicePrefix']['find']({'where':{'id':_0x2d54ba[_0xa958('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3c87c6,null))['then'](function(_0x1c05fa){if(_0x1c05fa){return _0x1c05fa[_0xa958('0x7a')](_0x2d54ba[_0xa958('0x3a')][_0xa958('0x76')])[_0xa958('0x2d')](function(){if(_['isArray'](_0x2d54ba['query'][_0xa958('0x76')])){for(var _0x477402=0x0;_0x477402<_0x2d54ba[_0xa958('0x3a')][_0xa958('0x76')]['length'];_0x477402+=0x1){socket[_0xa958('0x78')](_0xa958('0x7b'),{'UserId':Number(_0x2d54ba[_0xa958('0x3a')][_0xa958('0x76')][_0x477402]),'VoicePrefixId':Number(_0x2d54ba[_0xa958('0x4f')]['id'])});}}else{socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x2d54ba[_0xa958('0x3a')]['ids']),'VoicePrefixId':Number(_0x2d54ba[_0xa958('0x4f')]['id'])});}});}})[_0xa958('0x2d')](respondWithStatusCode(_0x3c87c6,null))[_0xa958('0x4d')](handleError(_0x3c87c6,null));};exports['getAgents']=function(_0x15544d,_0x4e4a98,_0x20a536){var _0xba7442={};var _0x5b32bf={};var _0x484790;var _0x5f2995;return db['VoicePrefix'][_0xa958('0x7c')]({'where':{'id':_0x15544d[_0xa958('0x4f')]['id']}})[_0xa958('0x2d')](handleEntityNotFound(_0x4e4a98,null))[_0xa958('0x2d')](function(_0x2aec5f){if(_0x2aec5f){_0x484790=_0x2aec5f;_0x5b32bf['model']=_[_0xa958('0x3b')](db['User']['rawAttributes']);_0x5b32bf[_0xa958('0x3a')]=_[_0xa958('0x3b')](_0x15544d[_0xa958('0x3a')]);_0x5b32bf['filters']=_[_0xa958('0x3e')](_0x5b32bf['model'],_0x5b32bf[_0xa958('0x3a')]);_0xba7442[_0xa958('0x3d')]=_['intersection'](_0x5b32bf['model'],qs[_0xa958('0x3f')](_0x15544d[_0xa958('0x3a')][_0xa958('0x3f')]));_0xba7442[_0xa958('0x3d')]=_0xba7442['attributes'][_0xa958('0x40')]?_0xba7442[_0xa958('0x3d')]:_0x5b32bf['model'];_0xba7442[_0xa958('0x43')]=qs['sort'](_0x15544d[_0xa958('0x3a')][_0xa958('0x44')]);_0xba7442[_0xa958('0x47')]=qs['filters'](_[_0xa958('0x45')](_0x15544d[_0xa958('0x3a')],_0x5b32bf['filters']));if(_0x15544d[_0xa958('0x3a')][_0xa958('0x46')]){_0xba7442[_0xa958('0x47')]=_[_0xa958('0x49')](_0xba7442[_0xa958('0x47')],{'$or':_[_0xa958('0x36')](_0xba7442[_0xa958('0x3d')],function(_0x1b5d8c){var _0x252300={};_0x252300[_0x1b5d8c]={'$like':'%'+_0x15544d['query'][_0xa958('0x46')]+'%'};return _0x252300;})});}_0xba7442=_[_0xa958('0x49')]({},_0xba7442,_0x15544d['options']);return _0x484790[_0xa958('0x7d')](_0xba7442);}})[_0xa958('0x2d')](function(_0x4fbefb){if(_0x4fbefb){_0x5f2995=_0x4fbefb['length'];if(!_0x15544d[_0xa958('0x3a')]['hasOwnProperty']('nolimit')){_0xba7442[_0xa958('0x25')]=qs[_0xa958('0x25')](_0x15544d['query']['limit']);_0xba7442[_0xa958('0x24')]=qs[_0xa958('0x24')](_0x15544d[_0xa958('0x3a')]['offset']);}return _0x484790[_0xa958('0x7d')](_0xba7442);}})['then'](function(_0x4d6455){if(_0x4d6455){return _0x4d6455?{'count':_0x5f2995,'rows':_0x4d6455}:null;}})[_0xa958('0x2d')](respondWithResult(_0x4e4a98,null))[_0xa958('0x4d')](handleError(_0x4e4a98,null));};exports[_0xa958('0x7e')]=function(_0x58feea,_0x278505,_0x36d9d4){var _0x213ee2={};var _0x4fffd9={};var _0x2b4e65;var _0x9207c3;return db[_0xa958('0x37')][_0xa958('0x7c')]({'where':{'id':_0x58feea['params']['id']}})[_0xa958('0x2d')](handleEntityNotFound(_0x278505,null))[_0xa958('0x2d')](function(_0x71d394){if(_0x71d394){_0x2b4e65=_0x71d394;_0x4fffd9[_0xa958('0x39')]=_['keys'](db['Team']['rawAttributes']);_0x4fffd9['query']=_[_0xa958('0x3b')](_0x58feea[_0xa958('0x3a')]);_0x4fffd9['filters']=_['intersection'](_0x4fffd9[_0xa958('0x39')],_0x4fffd9[_0xa958('0x3a')]);_0x213ee2[_0xa958('0x3d')]=_['intersection'](_0x4fffd9[_0xa958('0x39')],qs[_0xa958('0x3f')](_0x58feea['query'][_0xa958('0x3f')]));_0x213ee2[_0xa958('0x3d')]=_0x213ee2[_0xa958('0x3d')][_0xa958('0x40')]?_0x213ee2[_0xa958('0x3d')]:_0x4fffd9[_0xa958('0x39')];_0x213ee2[_0xa958('0x43')]=qs[_0xa958('0x44')](_0x58feea[_0xa958('0x3a')][_0xa958('0x44')]);_0x213ee2[_0xa958('0x47')]=qs[_0xa958('0x3c')](_['pick'](_0x58feea['query'],_0x4fffd9[_0xa958('0x3c')]));if(_0x58feea[_0xa958('0x3a')][_0xa958('0x46')]){_0x213ee2[_0xa958('0x47')]=_[_0xa958('0x49')](_0x213ee2[_0xa958('0x47')],{'$or':_[_0xa958('0x36')](_0x213ee2['attributes'],function(_0x7a2730){var _0x46ad43={};_0x46ad43[_0x7a2730]={'$like':'%'+_0x58feea['query'][_0xa958('0x46')]+'%'};return _0x46ad43;})});}_0x213ee2=_[_0xa958('0x49')]({},_0x213ee2,_0x58feea['options']);return _0x2b4e65[_0xa958('0x7e')](_0x213ee2);}})['then'](function(_0x57e780){if(_0x57e780){_0x9207c3=_0x57e780[_0xa958('0x40')];if(!_0x58feea[_0xa958('0x3a')][_0xa958('0x41')]('nolimit')){_0x213ee2['limit']=qs[_0xa958('0x25')](_0x58feea['query']['limit']);_0x213ee2[_0xa958('0x24')]=qs['offset'](_0x58feea[_0xa958('0x3a')][_0xa958('0x24')]);}return _0x2b4e65[_0xa958('0x7e')](_0x213ee2);}})[_0xa958('0x2d')](function(_0x3f58a2){if(_0x3f58a2){return _0x3f58a2?{'count':_0x9207c3,'rows':_0x3f58a2}:null;}})[_0xa958('0x2d')](respondWithResult(_0x278505,null))[_0xa958('0x4d')](handleError(_0x278505,null));};exports[_0xa958('0x7f')]=function(_0x22ba2f,_0x429870,_0x4d82b5){var _0x7f6ca5=_0x22ba2f['body'][_0xa958('0x76')];var _0x23823d;return db[_0xa958('0x80')]['findAll']({'where':{'id':_0x7f6ca5},'attributes':['id'],'include':[{'model':db[_0xa958('0x81')],'as':'Agents','attributes':['id','name',_0xa958('0x82'),_0xa958('0x83'),'interface'],'raw':!![]}]})[_0xa958('0x2d')](function(_0x4d907b){if(_0x4d907b){_0x23823d=_0x4d907b;var _0x310918=_[_0xa958('0x84')](_0x4d907b,function(_0x4fe178){var _0x57a1d9=_0x4fe178[_0xa958('0x2e')]({'plain':!![]});return _0x57a1d9[_0xa958('0x85')];});return db[_0xa958('0x37')][_0xa958('0x52')]({'where':{'id':_0x22ba2f[_0xa958('0x4f')]['id']}})[_0xa958('0x2d')](function(_0x162760){return db[_0xa958('0x54')]['transaction'](function(_0x1bdced){return _0x162760[_0xa958('0x7f')](_0x7f6ca5,{'transaction':_0x1bdced})['then'](function(){return BPromise[_0xa958('0x86')](_0x23823d,function(_0x167bb6){return db[_0xa958('0x87')][_0xa958('0x88')]({'TeamId':_0x167bb6['id'],'VoicePrefixId':_0x22ba2f[_0xa958('0x4f')]['id']},{'transaction':_0x1bdced});});})['then'](function(){return BPromise[_0xa958('0x86')](_0x310918,function(_0x2f8f94){return db[_0xa958('0x89')][_0xa958('0x8a')]({'where':{'UserId':_0x2f8f94['id'],'VoicePrefixId':_0x22ba2f[_0xa958('0x4f')]['id']},'transaction':_0x1bdced});});})[_0xa958('0x2d')](function(){_0x310918['forEach'](function(_0x46561b){socket[_0xa958('0x78')]('userVoicePrefix:save',{'UserId':_0x46561b['id'],'VoicePrefixId':_0x162760['id']});});});});});}})['then'](respondWithStatusCode(_0x429870,null))['catch'](handleError(_0x429870,null));};exports[_0xa958('0x8b')]=function(_0x5e31b4,_0x4edc45,_0x22890c){return db[_0xa958('0x80')][_0xa958('0x4b')]({'where':{'id':_0x5e31b4[_0xa958('0x3a')][_0xa958('0x76')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xa958('0x2d')](handleEntityNotFound(_0x4edc45,null))[_0xa958('0x2d')](function(_0x42e2b4){var _0x24d6a4=_[_0xa958('0x36')](_0x42e2b4,'id');var _0x19a1da=[];var _0x2a29ad=[];var _0x4ecadc=squel['select']();_0x4ecadc[_0xa958('0x8c')](_0xa958('0x8d'))[_0xa958('0x8e')](_0xa958('0x8f'),'tq')[_0xa958('0x90')](_0xa958('0x91'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xa958('0x47')](_0xa958('0x92'),_0x5e31b4[_0xa958('0x4f')]['id']);for(var _0x57f1eb=0x0;_0x57f1eb<_0x42e2b4[_0xa958('0x40')];_0x57f1eb+=0x1){let _0x3062c5=_0x42e2b4[_0x57f1eb];for(var _0x3cc980=0x0;_0x3cc980<_0x3062c5[_0xa958('0x85')][_0xa958('0x40')];_0x3cc980+=0x1){let _0x166267=_0x3062c5['Agents'][_0x3cc980];var _0x30133f=_0x4ecadc[_0xa958('0x93')]();_0x30133f['where'](_0xa958('0x94'),_0x166267['id']);_0x2a29ad[_0xa958('0x6b')](db[_0xa958('0x54')][_0xa958('0x3a')](_0x30133f[_0xa958('0x95')](),{'type':db[_0xa958('0x54')][_0xa958('0x96')][_0xa958('0x97')]})[_0xa958('0x2d')](function(_0x4f54a1){if(_0x4f54a1['length']===0x1){return _0x166267['id'];}else{var _0x563f9=_['every'](_[_0xa958('0x36')](_0x4f54a1,_0xa958('0x98')),function(_0x495b6d){return _[_0xa958('0x99')](_0x24d6a4,_0x495b6d);});if(_0x563f9){return _0x166267['id'];}}}));}}return BPromise[_0xa958('0x9a')](_0x2a29ad)[_0xa958('0x2d')](function(_0x48e953){_0x19a1da=_(_0x19a1da)['union'](_0x48e953)[_0xa958('0x9b')]()[_0xa958('0x9c')]();return db[_0xa958('0x37')][_0xa958('0x52')]({'where':{'id':_0x5e31b4[_0xa958('0x4f')]['id']}})['then'](function(_0x5548d1){return db[_0xa958('0x54')][_0xa958('0x55')](function(_0x4a4253){return _0x5548d1[_0xa958('0x8b')](_0x5e31b4['query']['ids'],{'transaction':_0x4a4253})[_0xa958('0x2d')](function(){if(!_[_0xa958('0x9d')](_0x19a1da)){return _0x5548d1[_0xa958('0x7a')](_0x19a1da,{'transaction':_0x4a4253});}})[_0xa958('0x2d')](function(){_0x19a1da[_0xa958('0x9e')](function(_0x5c0653){socket[_0xa958('0x78')]('userVoicePrefix:remove',{'UserId':_0x5c0653,'VoicePrefixId':_0x5548d1['id']});});});});});});})[_0xa958('0x2d')](respondWithStatusCode(_0x4edc45,null))[_0xa958('0x4d')](handleError(_0x4edc45,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index e43de8d..e97fe00 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 _0xebbd=['VoicePrefix','save','update','remove','emit','hook','events','../../mysqldb'];(function(_0x45a93a,_0x21e029){var _0x2dce82=function(_0xf4f810){while(--_0xf4f810){_0x45a93a['push'](_0x45a93a['shift']());}};_0x2dce82(++_0x21e029);}(_0xebbd,0xfe));var _0xdebb=function(_0x194adf,_0x220258){_0x194adf=_0x194adf-0x0;var _0x2242e3=_0xebbd[_0x194adf];return _0x2242e3;};'use strict';var EventEmitter=require(_0xdebb('0x0'));var VoicePrefix=require(_0xdebb('0x1'))['db'][_0xdebb('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdebb('0x3'),'afterUpdate':_0xdebb('0x4'),'afterDestroy':_0xdebb('0x5')};function emitEvent(_0x3a88bb){return function(_0x1e4ced,_0x126348,_0x215357){VoicePrefixEvents[_0xdebb('0x6')](_0x3a88bb+':'+_0x1e4ced['id'],_0x1e4ced);VoicePrefixEvents[_0xdebb('0x6')](_0x3a88bb,_0x1e4ced);_0x215357(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0xdebb('0x7')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x2539=['emit','events','../../mysqldb','VoicePrefix','setMaxListeners','update','remove'];(function(_0x55a618,_0x9379b2){var _0x282149=function(_0x4bbf69){while(--_0x4bbf69){_0x55a618['push'](_0x55a618['shift']());}};_0x282149(++_0x9379b2);}(_0x2539,0x166));var _0x9253=function(_0x2ef52c,_0x4ff712){_0x2ef52c=_0x2ef52c-0x0;var _0x33b34f=_0x2539[_0x2ef52c];return _0x33b34f;};'use strict';var EventEmitter=require(_0x9253('0x0'));var VoicePrefix=require(_0x9253('0x1'))['db'][_0x9253('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x9253('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9253('0x4'),'afterDestroy':_0x9253('0x5')};function emitEvent(_0x43a105){return function(_0x472842,_0x27862a,_0x11e071){VoicePrefixEvents[_0x9253('0x6')](_0x43a105+':'+_0x472842['id'],_0x472842);VoicePrefixEvents[_0x9253('0x6')](_0x43a105,_0x472842);_0x11e071(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index f21fd24..1846e17 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 _0xa01f=['rimraf','../../config/environment','./voicePrefix.attributes','exports','VoicePrefix','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x21f035,_0xee30e){var _0x55de4d=function(_0x4147f4){while(--_0x4147f4){_0x21f035['push'](_0x21f035['shift']());}};_0x55de4d(++_0xee30e);}(_0xa01f,0x1d9));var _0xfa01=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0xa01f[_0x266618];return _0x54dbf5;};'use strict';var _=require(_0xfa01('0x0'));var util=require(_0xfa01('0x1'));var logger=require(_0xfa01('0x2'))(_0xfa01('0x3'));var moment=require(_0xfa01('0x4'));var BPromise=require('bluebird');var rp=require(_0xfa01('0x5'));var fs=require('fs');var path=require(_0xfa01('0x6'));var rimraf=require(_0xfa01('0x7'));var config=require(_0xfa01('0x8'));var attributes=require(_0xfa01('0x9'));module[_0xfa01('0xa')]=function(_0x89ac01,_0x341325){return _0x89ac01['define'](_0xfa01('0xb'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x67be=['api','bluebird','request-promise','path','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash','util','../../config/logger'];(function(_0x3440aa,_0x5375d9){var _0x4de467=function(_0x126ef5){while(--_0x126ef5){_0x3440aa['push'](_0x3440aa['shift']());}};_0x4de467(++_0x5375d9);}(_0x67be,0x8d));var _0xe67b=function(_0x123ea3,_0x5cb1a6){_0x123ea3=_0x123ea3-0x0;var _0x5e741e=_0x67be[_0x123ea3];return _0x5e741e;};'use strict';var _=require(_0xe67b('0x0'));var util=require(_0xe67b('0x1'));var logger=require(_0xe67b('0x2'))(_0xe67b('0x3'));var moment=require('moment');var BPromise=require(_0xe67b('0x4'));var rp=require(_0xe67b('0x5'));var fs=require('fs');var path=require(_0xe67b('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe67b('0x7'));module[_0xe67b('0x8')]=function(_0x212774,_0x5a9390){return _0x212774[_0xe67b('0x9')](_0xe67b('0xa'),attributes,{'tableName':_0xe67b('0xb'),'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 766c15c..3109ac5 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 _0x5430=['moment','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util'];(function(_0x1abe37,_0x145eb6){var _0x3cab43=function(_0x2c738b){while(--_0x2c738b){_0x1abe37['push'](_0x1abe37['shift']());}};_0x3cab43(++_0x145eb6);}(_0x5430,0x10c));var _0x0543=function(_0x507dca,_0x260349){_0x507dca=_0x507dca-0x0;var _0x1e936e=_0x5430[_0x507dca];return _0x1e936e;};'use strict';var _=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var moment=require(_0x0543('0x2'));var BPromise=require(_0x0543('0x3'));var rs=require(_0x0543('0x4'));var fs=require('fs');var Redis=require(_0x0543('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0543('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0543('0x7'));var client=jayson[_0x0543('0x8')][_0x0543('0x9')]({'port':0x232a});config[_0x0543('0xa')]=_[_0x0543('0xb')](config['redis'],{'host':_0x0543('0xc'),'port':0x18eb});var socket=require(_0x0543('0xd'))(new Redis(config[_0x0543('0xa')]));require(_0x0543('0xe'))[_0x0543('0xf')](socket);function respondWithRpcPromise(_0x94b9e7,_0x56003c,_0x1ed7cc){return new BPromise(function(_0x1ac048,_0x52c9b7){return client[_0x0543('0x10')](_0x94b9e7,_0x1ed7cc)[_0x0543('0x11')](function(_0x2bb810){logger[_0x0543('0x12')](_0x0543('0x13'),_0x56003c,_0x0543('0x14'));logger[_0x0543('0x15')](_0x0543('0x16'),_0x56003c,_0x0543('0x14'),JSON[_0x0543('0x17')](_0x2bb810));if(_0x2bb810[_0x0543('0x18')]){if(_0x2bb810[_0x0543('0x18')]['code']===0x1f4){logger[_0x0543('0x18')](_0x0543('0x13'),_0x56003c,_0x2bb810['error']['message']);return _0x52c9b7(_0x2bb810[_0x0543('0x18')][_0x0543('0x19')]);}logger[_0x0543('0x18')](_0x0543('0x13'),_0x56003c,_0x2bb810[_0x0543('0x18')]['message']);return _0x1ac048(_0x2bb810[_0x0543('0x18')][_0x0543('0x19')]);}else{logger[_0x0543('0x12')](_0x0543('0x13'),_0x56003c,_0x0543('0x14'));_0x1ac048(_0x2bb810[_0x0543('0x1a')][_0x0543('0x19')]);}})['catch'](function(_0x37b084){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x56003c,_0x37b084);_0x52c9b7(_0x37b084);});});} \ No newline at end of file +var _0xd26f=['lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','then','info','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','request\x20sent','result'];(function(_0x10fd77,_0x2a09da){var _0x14c34e=function(_0x559833){while(--_0x559833){_0x10fd77['push'](_0x10fd77['shift']());}};_0x14c34e(++_0x2a09da);}(_0xd26f,0x113));var _0xfd26=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0xd26f[_0x4e9628];return _0x27bc8c;};'use strict';var _=require(_0xfd26('0x0'));var util=require(_0xfd26('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfd26('0x2'));var fs=require('fs');var Redis=require(_0xfd26('0x3'));var db=require(_0xfd26('0x4'))['db'];var utils=require(_0xfd26('0x5'));var logger=require(_0xfd26('0x6'))(_0xfd26('0x7'));var config=require(_0xfd26('0x8'));var jayson=require(_0xfd26('0x9'));var client=jayson[_0xfd26('0xa')]['http']({'port':0x232a});config[_0xfd26('0xb')]=_[_0xfd26('0xc')](config[_0xfd26('0xb')],{'host':_0xfd26('0xd'),'port':0x18eb});var socket=require(_0xfd26('0xe'))(new Redis(config[_0xfd26('0xb')]));require('./voicePrefix.socket')[_0xfd26('0xf')](socket);function respondWithRpcPromise(_0x3b74d7,_0x1e01bf,_0x43e9b3){return new BPromise(function(_0x13719f,_0x1aa684){return client['request'](_0x3b74d7,_0x43e9b3)[_0xfd26('0x10')](function(_0x5144d1){logger[_0xfd26('0x11')]('VoicePrefix,\x20%s,\x20%s',_0x1e01bf,'request\x20sent');logger['debug']('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x1e01bf,'request\x20sent',JSON[_0xfd26('0x12')](_0x5144d1));if(_0x5144d1[_0xfd26('0x13')]){if(_0x5144d1[_0xfd26('0x13')][_0xfd26('0x14')]===0x1f4){logger[_0xfd26('0x13')](_0xfd26('0x15'),_0x1e01bf,_0x5144d1[_0xfd26('0x13')][_0xfd26('0x16')]);return _0x1aa684(_0x5144d1[_0xfd26('0x13')][_0xfd26('0x16')]);}logger[_0xfd26('0x13')](_0xfd26('0x15'),_0x1e01bf,_0x5144d1[_0xfd26('0x13')][_0xfd26('0x16')]);return _0x13719f(_0x5144d1[_0xfd26('0x13')]['message']);}else{logger[_0xfd26('0x11')](_0xfd26('0x15'),_0x1e01bf,_0xfd26('0x17'));_0x13719f(_0x5144d1[_0xfd26('0x18')][_0xfd26('0x16')]);}})['catch'](function(_0x3a2725){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x1e01bf,_0x3a2725);_0x1aa684(_0x3a2725);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 4bca9ef..c57c922 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 _0x4157=['removeListener','register','voicePrefix:','./voicePrefix.events','save','remove','update','emit'];(function(_0x28f414,_0x7e5745){var _0x24d793=function(_0x184f95){while(--_0x184f95){_0x28f414['push'](_0x28f414['shift']());}};_0x24d793(++_0x7e5745);}(_0x4157,0xf3));var _0x7415=function(_0xe80583,_0x3cb3ae){_0xe80583=_0xe80583-0x0;var _0x351c5c=_0x4157[_0xe80583];return _0x351c5c;};'use strict';var VoicePrefixEvents=require(_0x7415('0x0'));var events=[_0x7415('0x1'),_0x7415('0x2'),_0x7415('0x3')];function createListener(_0x4509ca,_0x4c49e7){return function(_0x3efb60){_0x4c49e7[_0x7415('0x4')](_0x4509ca,_0x3efb60);};}function removeListener(_0x311038,_0x341b12){return function(){VoicePrefixEvents[_0x7415('0x5')](_0x311038,_0x341b12);};}exports[_0x7415('0x6')]=function(_0x23038f){for(var _0x2f43eb=0x0,_0x3c7980=events['length'];_0x2f43eb<_0x3c7980;_0x2f43eb++){var _0x26fe93=events[_0x2f43eb];var _0x588c5a=createListener(_0x7415('0x7')+_0x26fe93,_0x23038f);VoicePrefixEvents['on'](_0x26fe93,_0x588c5a);}}; \ No newline at end of file +var _0x878f=['save','remove','update','emit','removeListener','register','length'];(function(_0xa14363,_0x5f52dd){var _0x2462bc=function(_0x28802a){while(--_0x28802a){_0xa14363['push'](_0xa14363['shift']());}};_0x2462bc(++_0x5f52dd);}(_0x878f,0x173));var _0xf878=function(_0x51230d,_0x4b618a){_0x51230d=_0x51230d-0x0;var _0xf9448e=_0x878f[_0x51230d];return _0xf9448e;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0xf878('0x0'),_0xf878('0x1'),_0xf878('0x2')];function createListener(_0x12df2b,_0x1b3d0b){return function(_0x3d74cf){_0x1b3d0b[_0xf878('0x3')](_0x12df2b,_0x3d74cf);};}function removeListener(_0x45a37b,_0x240b48){return function(){VoicePrefixEvents[_0xf878('0x4')](_0x45a37b,_0x240b48);};}exports[_0xf878('0x5')]=function(_0x4bc9aa){for(var _0x4ac8d8=0x0,_0x3c5f5c=events[_0xf878('0x6')];_0x4ac8d8<_0x3c5f5c;_0x4ac8d8++){var _0x59e564=events[_0x4ac8d8];var _0x52851e=createListener('voicePrefix:'+_0x59e564,_0x4bc9aa);VoicePrefixEvents['on'](_0x59e564,_0x52851e);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index a1db2e3..365268b 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 _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x42e223,_0x36df9b){var _0x571f9d=function(_0x960681){while(--_0x960681){_0x42e223['push'](_0x42e223['shift']());}};_0x571f9d(++_0x36df9b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x1da827,_0x37b758){var _0x13cd71=function(_0x285b3e){while(--_0x285b3e){_0x1da827['push'](_0x1da827['shift']());}};_0x13cd71(++_0x37b758);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 89b64cb..c226586 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 _0x86b9=['Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','always','never','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','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)','#Machine\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','ENUM','inbound','outbound','default','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','ringall','setDataValue','getDataValue','type','strategy','preview','roundrobin','includes','INTEGER','yes','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','progressive','power','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','FLOAT','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'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x86b9,0x1e3));var _0x986b=function(_0x556b4c,_0x43f1af){_0x556b4c=_0x556b4c-0x0;var _0x20b878=_0x86b9[_0x556b4c];return _0x20b878;};'use strict';var Sequelize=require(_0x986b('0x0'));module[_0x986b('0x1')]={'name':{'type':Sequelize[_0x986b('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x986b('0x3')](_0x986b('0x4'),_0x986b('0x5')),'allowNull':![],'defaultValue':_0x986b('0x4')},'musiconhold':{'type':Sequelize[_0x986b('0x2')],'defaultValue':_0x986b('0x6')},'announce':{'type':Sequelize[_0x986b('0x2')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr','ringall',_0x986b('0x7'),_0x986b('0x8'),_0x986b('0x9'),_0x986b('0xa'),_0x986b('0xb'),_0x986b('0xc'),_0x986b('0xd')),'allowNull':![],'defaultValue':_0x986b('0xe'),'set':function(_0x4b1e4a){this[_0x986b('0xf')]('strategy',_0x4b1e4a?_0x4b1e4a:'rrmemory');},'get':function(){var _0xa7a995=this[_0x986b('0x10')](_0x986b('0x11'));var _0x45ff4a=this[_0x986b('0x10')]('dialMethod');var _0x3da956=this[_0x986b('0x10')](_0x986b('0x12'));if(_0xa7a995===_0x986b('0x5')){if(_0x45ff4a===_0x986b('0x13')){return null;}if(_0x45ff4a==='booked'&&![_0x986b('0xa'),_0x986b('0x14')][_0x986b('0x15')](_0x3da956)){this['setDataValue']('strategy','rrmemory');}}return _0x3da956;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x986b('0x16')](0xb)},'timeout':{'type':Sequelize[_0x986b('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x986b('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x986b('0x2')]},'weight':{'type':Sequelize[_0x986b('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x986b('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x986b('0x3')]('yes','no'),'defaultValue':_0x986b('0x17')},'autopause':{'type':Sequelize[_0x986b('0x3')](_0x986b('0x17'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x986b('0x3')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x986b('0x3')](_0x986b('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x986b('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x986b('0x3')](_0x986b('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x986b('0x3')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x986b('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x986b('0x3')](_0x986b('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x986b('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x986b('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x986b('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x986b('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0x986b('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x986b('0x3')]('yes','no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x986b('0x3')](_0x986b('0x17'),'no',_0x986b('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x986b('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x986b('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0x986b('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x986b('0x2')]},'queue_youarenext':{'type':Sequelize[_0x986b('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x986b('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x986b('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x986b('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x986b('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x986b('0x2')]},'queue_quantity1':{'type':Sequelize[_0x986b('0x2')]},'queue_quantity2':{'type':Sequelize[_0x986b('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x986b('0x2')]},'queue_less_than':{'type':Sequelize[_0x986b('0x2')]},'periodic_announce':{'type':Sequelize[_0x986b('0x19')],'set':function(_0x346450){this[_0x986b('0xf')](_0x986b('0x1a'),_0x346450?_0x346450[_0x986b('0x1b')](','):[]);},'get':function(){return this['getDataValue'](_0x986b('0x1a'))?this[_0x986b('0x10')](_0x986b('0x1a'))[_0x986b('0x1c')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0x986b('0x17'),'set':function(_0x547785){this[_0x986b('0xf')]('joinempty',_0x547785?_0x547785[_0x986b('0x1b')](','):undefined);},'get':function(){return this[_0x986b('0x10')](_0x986b('0x1d'))?this[_0x986b('0x10')](_0x986b('0x1d'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x986b('0x2')],'defaultValue':'no','set':function(_0x537ab1){this['setDataValue'](_0x986b('0x1e'),_0x537ab1?_0x537ab1[_0x986b('0x1b')](','):undefined);},'get':function(){return this[_0x986b('0x10')](_0x986b('0x1e'))?this[_0x986b('0x10')](_0x986b('0x1e'))[_0x986b('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x986b('0x3')](_0x986b('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x986b('0x3')](_0x986b('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x986b('0x3')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x986b('0x2')]},'acw':{'type':Sequelize[_0x986b('0x1f')],'defaultValue':0x0,'set':function(_0x4c517a){this[_0x986b('0xf')](_0x986b('0x20'),_0x4c517a);if(_0x4c517a){if(this[_0x986b('0x10')](_0x986b('0x21'))<0x2){this[_0x986b('0xf')](_0x986b('0x21'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x986b('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0x986b('0x3')]('preview',_0x986b('0x22'),_0x986b('0x23'),_0x986b('0x24'),'booked'),'defaultValue':_0x986b('0x22'),'comment':_0x986b('0x25')},'dialLimitChannel':{'type':Sequelize[_0x986b('0x16')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0x986b('0x16')](0x4)[_0x986b('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x986b('0x27')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x986b('0x28')},'dialPredictiveOptimization':{'type':Sequelize[_0x986b('0x3')](_0x986b('0x29'),_0x986b('0x2a')),'defaultValue':_0x986b('0x2a'),'comment':_0x986b('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x986b('0x2c')](0x2)[_0x986b('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x986b('0x2d')},'dialPredictiveInterval':{'type':Sequelize[_0x986b('0x16')](0x3)[_0x986b('0x26')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x986b('0x2e')},'dialOriginateCallerIdName':{'type':Sequelize[_0x986b('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x986b('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x986b('0x26')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x986b('0x2f')},'dialQueueOptions':{'type':Sequelize[_0x986b('0x2')],'defaultValue':_0x986b('0x30'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0x986b('0x16')](0x3)[_0x986b('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x986b('0x31')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x986b('0x32')},'dialCongestionMaxRetry':{'type':Sequelize[_0x986b('0x16')](0x3)[_0x986b('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x986b('0x33')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x986b('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x986b('0x34')},'dialBusyMaxRetry':{'type':Sequelize[_0x986b('0x16')](0x3)[_0x986b('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x986b('0x16')](0x5)[_0x986b('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x986b('0x16')](0x3)[_0x986b('0x26')],'defaultValue':0x3,'comment':_0x986b('0x35')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x986b('0x16')](0x5)[_0x986b('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x986b('0x16')](0x3)[_0x986b('0x26')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x986b('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0x986b('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x986b('0x3')](_0x986b('0x36'),_0x986b('0x37'),'onlyIfOpen'),'defaultValue':_0x986b('0x36')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x986b('0x38')},'dialAMDInitialSilence':{'type':Sequelize[_0x986b('0x16')](0x9)[_0x986b('0x26')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x986b('0x26')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x986b('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x986b('0x16')](0x9)[_0x986b('0x26')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x986b('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x986b('0x3a')},'dialAMDMinWordLength':{'type':Sequelize[_0x986b('0x16')](0x9)[_0x986b('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x986b('0x3b')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x986b('0x26')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x986b('0x3c')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x986b('0x26')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x986b('0x3d')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x986b('0x3e')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x986b('0x16')](0x9)[_0x986b('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x986b('0x16')](0x5)[_0x986b('0x26')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x986b('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0x986b('0x1f')],'defaultValue':0x0,'comment':_0x986b('0x40')},'dialOrderByScheduledAt':{'type':Sequelize[_0x986b('0x3')](_0x986b('0x41'),_0x986b('0x42')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x986b('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x986b('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x986b('0x16')](0x3)[_0x986b('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x986b('0x43')},'dialCutDigit':{'type':Sequelize[_0x986b('0x16')](0x3)[_0x986b('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x986b('0x16')](0x3)[_0x986b('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x986b('0x16')](0x5)[_0x986b('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x986b('0x44')},'dialDropMaxRetry':{'type':Sequelize[_0x986b('0x16')](0x3)[_0x986b('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x986b('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x986b('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x986b('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x986b('0x16')](0x3)[_0x986b('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x986b('0x47')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x986b('0x16')](0x5)[_0x986b('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x986b('0x16')](0x3)[_0x986b('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x986b('0x48')},'dialMachineRetryFrequency':{'type':Sequelize[_0x986b('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x986b('0x16')](0x3)[_0x986b('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x986b('0x16')](0x5)[_0x986b('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x986b('0x49')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x986b('0x16')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x986b('0x4a'),'set':function(_0x52d593){if(!_0x52d593)this[_0x986b('0xf')]('mandatoryDispositionPauseId',null);this[_0x986b('0xf')](_0x986b('0x4b'),_0x52d593);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x986b('0x16')](0x3)[_0x986b('0x26')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x986b('0x16')](0x3)[_0x986b('0x26')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x986b('0x1f')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x986b('0x16')](0x3)[_0x986b('0x26')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x17ba=['includes','setDataValue','INTEGER','yes','once','periodic_announce','join','split','joinempty','leavewhenempty','wrapuptime','progressive','predictive','booked','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','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)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','ASC','DESC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Cut\x20Digit\x20(min:1,\x20max:15)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','name','ENUM','inbound','outbound','STRING','default','ringall','leastrecent','fewestcalls','random','linear','strategy','rrmemory','getDataValue','type','dialMethod','preview','roundrobin'];(function(_0x27bcf5,_0x236765){var _0x4ce4cf=function(_0x4864ea){while(--_0x4864ea){_0x27bcf5['push'](_0x27bcf5['shift']());}};_0x4ce4cf(++_0x236765);}(_0x17ba,0xd6));var _0xa17b=function(_0xa3ba6e,_0x322e2a){_0xa3ba6e=_0xa3ba6e-0x0;var _0x88c2fc=_0x17ba[_0xa3ba6e];return _0x88c2fc;};'use strict';var Sequelize=require(_0xa17b('0x0'));module[_0xa17b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa17b('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xa17b('0x3')](_0xa17b('0x4'),_0xa17b('0x5')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0xa17b('0x6')],'defaultValue':_0xa17b('0x7')},'announce':{'type':Sequelize[_0xa17b('0x6')],'defaultValue':''},'strategy':{'type':Sequelize[_0xa17b('0x3')]('rr',_0xa17b('0x8'),_0xa17b('0x9'),_0xa17b('0xa'),_0xa17b('0xb'),'rrmemory',_0xa17b('0xc'),'wrandom','rrordered'),'allowNull':![],'defaultValue':_0xa17b('0x8'),'set':function(_0x27b6ec){this['setDataValue'](_0xa17b('0xd'),_0x27b6ec?_0x27b6ec:_0xa17b('0xe'));},'get':function(){var _0x176560=this[_0xa17b('0xf')](_0xa17b('0x10'));var _0x33547d=this[_0xa17b('0xf')](_0xa17b('0x11'));var _0x5c55cf=this[_0xa17b('0xf')](_0xa17b('0xd'));if(_0x176560===_0xa17b('0x5')){if(_0x33547d===_0xa17b('0x12')){return null;}if(_0x33547d==='booked'&&![_0xa17b('0xe'),_0xa17b('0x13')][_0xa17b('0x14')](_0x5c55cf)){this[_0xa17b('0x15')](_0xa17b('0xd'),_0xa17b('0xe'));}}return _0x5c55cf;}},'servicelevel':{'type':Sequelize[_0xa17b('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xa17b('0x6')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xa17b('0x16')](0xb)},'timeout':{'type':Sequelize[_0xa17b('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xa17b('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xa17b('0x6')]},'weight':{'type':Sequelize[_0xa17b('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xa17b('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xa17b('0x3')]('yes','no'),'defaultValue':'yes'},'autopause':{'type':Sequelize['ENUM']('yes','no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xa17b('0x16')](0xb)},'autopausebusy':{'type':Sequelize[_0xa17b('0x3')](_0xa17b('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xa17b('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xa17b('0x3')](_0xa17b('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xa17b('0x3')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xa17b('0x3')](_0xa17b('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xa17b('0x3')](_0xa17b('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xa17b('0x6')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xa17b('0x6')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xa17b('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xa17b('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0xa17b('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0xa17b('0x17'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0xa17b('0x3')](_0xa17b('0x17'),'no',_0xa17b('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xa17b('0x6')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xa17b('0x3')](_0xa17b('0x17'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0xa17b('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xa17b('0x6')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xa17b('0x6')]},'queue_youarenext':{'type':Sequelize[_0xa17b('0x6')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xa17b('0x6')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xa17b('0x6')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xa17b('0x6')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xa17b('0x6')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xa17b('0x6')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xa17b('0x6')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xa17b('0x6')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xa17b('0x6')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0xa17b('0x6')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x447a2e){this[_0xa17b('0x15')](_0xa17b('0x19'),_0x447a2e?_0x447a2e[_0xa17b('0x1a')](','):[]);},'get':function(){return this[_0xa17b('0xf')](_0xa17b('0x19'))?this[_0xa17b('0xf')]('periodic_announce')[_0xa17b('0x1b')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0xa17b('0x17'),'set':function(_0x48a2df){this[_0xa17b('0x15')](_0xa17b('0x1c'),_0x48a2df?_0x48a2df[_0xa17b('0x1a')](','):undefined);},'get':function(){return this[_0xa17b('0xf')](_0xa17b('0x1c'))?this['getDataValue']('joinempty')[_0xa17b('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x336f6d){this[_0xa17b('0x15')](_0xa17b('0x1d'),_0x336f6d?_0x336f6d[_0xa17b('0x1a')](','):undefined);},'get':function(){return this[_0xa17b('0xf')]('leavewhenempty')?this[_0xa17b('0xf')](_0xa17b('0x1d'))[_0xa17b('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xa17b('0x3')](_0xa17b('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xa17b('0x3')](_0xa17b('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xa17b('0x3')](_0xa17b('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xa17b('0x6')]},'description':{'type':Sequelize[_0xa17b('0x6')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x3cada1){this['setDataValue']('acw',_0x3cada1);if(_0x3cada1){if(this[_0xa17b('0xf')]('wrapuptime')<0x2){this[_0xa17b('0x15')](_0xa17b('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0xa17b('0x3')](_0xa17b('0x12'),_0xa17b('0x1f'),'power',_0xa17b('0x20'),_0xa17b('0x21')),'defaultValue':_0xa17b('0x1f'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0xa17b('0x16')](0x4)[_0xa17b('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xa17b('0x23')},'dialLimitQueue':{'type':Sequelize[_0xa17b('0x16')](0x4)[_0xa17b('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xa17b('0x24')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0xa17b('0x22')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xa17b('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0xa17b('0x3')]('agentBusyFactor',_0xa17b('0x26')),'defaultValue':_0xa17b('0x26'),'comment':_0xa17b('0x27')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xa17b('0x28')](0x2)[_0xa17b('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xa17b('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0xa17b('0x16')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xa17b('0x16')](0x3)[_0xa17b('0x22')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa17b('0x2a')},'dialQueueOptions':{'type':Sequelize[_0xa17b('0x6')],'defaultValue':_0xa17b('0x2b'),'comment':_0xa17b('0x2c')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xa17b('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa17b('0x2d')},'dialQueueProject':{'type':Sequelize[_0xa17b('0x6')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xa17b('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa17b('0x2e')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xa17b('0x16')](0x5)[_0xa17b('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xa17b('0x16')](0x3)[_0xa17b('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa17b('0x2f')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xa17b('0x16')](0x3)[_0xa17b('0x22')],'defaultValue':0x3,'comment':_0xa17b('0x30')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xa17b('0x16')](0x5)[_0xa17b('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xa17b('0x16')](0x3)[_0xa17b('0x22')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xa17b('0x31')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xa17b('0x32')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xa17b('0x3')](_0xa17b('0x33'),_0xa17b('0x34'),'onlyIfOpen'),'defaultValue':_0xa17b('0x33')},'dialAMDActive':{'type':Sequelize[_0xa17b('0x35')],'defaultValue':0x0,'comment':_0xa17b('0x36')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xa17b('0x22')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xa17b('0x37')},'dialAMDGreeting':{'type':Sequelize[_0xa17b('0x16')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xa17b('0x38')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xa17b('0x22')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xa17b('0x16')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xa17b('0x39')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xa17b('0x22')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xa17b('0x3a')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xa17b('0x16')](0x9)[_0xa17b('0x22')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xa17b('0x3b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xa17b('0x16')](0x9)[_0xa17b('0x22')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xa17b('0x3c')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xa17b('0x16')](0x5)[_0xa17b('0x22')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xa17b('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xa17b('0x16')](0x9)[_0xa17b('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xa17b('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0xa17b('0x16')](0x5)[_0xa17b('0x22')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xa17b('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0xa17b('0x35')],'defaultValue':0x0,'comment':_0xa17b('0x40')},'dialOrderByScheduledAt':{'type':Sequelize[_0xa17b('0x3')]('DESC',_0xa17b('0x41')),'defaultValue':_0xa17b('0x42')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0xa17b('0x43')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xa17b('0x35')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xa17b('0x35')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xa17b('0x16')](0x3)[_0xa17b('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xa17b('0x16')](0x3)[_0xa17b('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xa17b('0x44')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa17b('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xa17b('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xa17b('0x16')](0x3)[_0xa17b('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa17b('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0xa17b('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xa17b('0x16')](0x3)[_0xa17b('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa17b('0x46')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xa17b('0x16')](0x5)[_0xa17b('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa17b('0x47')},'dialMachineMaxRetry':{'type':Sequelize[_0xa17b('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xa17b('0x16')](0x5)[_0xa17b('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa17b('0x48')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xa17b('0x16')](0x3)[_0xa17b('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa17b('0x49')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xa17b('0x16')](0x5)[_0xa17b('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa17b('0x16')],'allowNull':!![],'comment':_0xa17b('0x4a')},'mandatoryDisposition':{'type':Sequelize[_0xa17b('0x35')],'defaultValue':![],'comment':_0xa17b('0x4b'),'set':function(_0x16cec4){if(!_0x16cec4)this[_0xa17b('0x15')](_0xa17b('0x4c'),null);this[_0xa17b('0x15')](_0xa17b('0x4d'),_0x16cec4);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xa17b('0x22')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xa17b('0x16')](0x3)[_0xa17b('0x22')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xa17b('0x35')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xa17b('0x16')](0x3)[_0xa17b('0x22')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xa17b('0x35')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 18d9c25..173288a 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 _0xcfef=['userProfileId','getHoppers','findOne','CmHopper','hasOwnProperty','VoiceQueueId','rows','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getTeams','Agents','online','interface','flatMap','forEach','penalty','transaction','addTeams','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','format','SIP/%s','userVoiceQueue:save','Team','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?','push','sequelize','QueryTypes','SELECT','all','union','compact','removeTeams','emit','addAgents','spread','voicePause','isEmpty','isNil','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','field','CmListId','toString','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','COALESCE(phone,\x27\x27)','onlyIfOpen','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','cm_hopper_additional_phones','h.id','cm_contact_has_items','join','ci.ItemClass=?','PHONE','removeLists','getBlackLists','cm_hopper_black','NOW()','removeBlackLists','rimraf','zip-dir','fast-json-patch','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./voiceQueue.socket','register','end','offset','limit','undefined','count','status','json','apply','save','update','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','find','name','UserProfileResource','destroy','error','stack','send','index','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','where','VIRTUAL','merge','options','VoiceQueue','includeAll','include','findAll','show','rawAttributes','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt'];(function(_0x3dbb2b,_0x3b0d16){var _0x157d52=function(_0x5c20c7){while(--_0x5c20c7){_0x3dbb2b['push'](_0x3dbb2b['shift']());}};_0x157d52(++_0x3b0d16);}(_0xcfef,0x1cc));var _0xfcfe=function(_0x1605b1,_0x1d3569){_0x1605b1=_0x1605b1-0x0;var _0x15e20c=_0xcfef[_0x1605b1];return _0x15e20c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfcfe('0x0'));var zipdir=require(_0xfcfe('0x1'));var jsonpatch=require(_0xfcfe('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfcfe('0x3'));var path=require(_0xfcfe('0x4'));var sox=require(_0xfcfe('0x5'));var csv=require(_0xfcfe('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfcfe('0x7'));var squel=require('squel');var crypto=require(_0xfcfe('0x8'));var jsforce=require(_0xfcfe('0x9'));var deskjs=require(_0xfcfe('0xa'));var toCsv=require('to-csv');var querystring=require(_0xfcfe('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfcfe('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xfcfe('0xd'));var hardwareService=require(_0xfcfe('0xe'));var logger=require(_0xfcfe('0xf'))(_0xfcfe('0x10'));var utils=require(_0xfcfe('0x11'));var config=require(_0xfcfe('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xfcfe('0x13'))['db'];config['redis']=_['defaults'](config[_0xfcfe('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0xfcfe('0x15'))(new Redis(config[_0xfcfe('0x14')]));require(_0xfcfe('0x16'))[_0xfcfe('0x17')](socket);function respondWithStatusCode(_0xaba08f,_0x3f0aca){_0x3f0aca=_0x3f0aca||0xcc;return function(_0x1e64d8){if(_0x1e64d8){return _0xaba08f['sendStatus'](_0x3f0aca);}return _0xaba08f['status'](_0x3f0aca)[_0xfcfe('0x18')]();};}function respondWithResult(_0x17305a,_0x181629){_0x181629=_0x181629||0xc8;return function(_0x443900){if(_0x443900){return _0x17305a['status'](_0x181629)['json'](_0x443900);}};}function respondWithFilteredResult(_0x2f71fa,_0x1c6362){return function(_0x4393e4){if(_0x4393e4){var _0x58dc99=typeof _0x1c6362[_0xfcfe('0x19')]==='undefined'&&typeof _0x1c6362[_0xfcfe('0x1a')]===_0xfcfe('0x1b');var _0x4fcc54=_0x4393e4[_0xfcfe('0x1c')];var _0x561af9=_0x58dc99?0x0:_0x1c6362[_0xfcfe('0x19')];var _0x19a650=_0x58dc99?_0x4393e4[_0xfcfe('0x1c')]:_0x1c6362[_0xfcfe('0x19')]+_0x1c6362[_0xfcfe('0x1a')];var _0x577cdc;if(_0x19a650>=_0x4fcc54){_0x19a650=_0x4fcc54;_0x577cdc=0xc8;}else{_0x577cdc=0xce;}_0x2f71fa[_0xfcfe('0x1d')](_0x577cdc);return _0x2f71fa['set']('Content-Range',_0x561af9+'-'+_0x19a650+'/'+_0x4fcc54)[_0xfcfe('0x1e')](_0x4393e4);}return null;};}function patchUpdates(_0xc07ffc){return function(_0x4202a7){try{jsonpatch[_0xfcfe('0x1f')](_0x4202a7,_0xc07ffc,!![]);}catch(_0x34e2bf){return BPromise['reject'](_0x34e2bf);}return _0x4202a7[_0xfcfe('0x20')]();};}function saveUpdates(_0x4c7c82,_0x35b19f){return function(_0x40eeb2){if(_0x40eeb2){return _0x40eeb2[_0xfcfe('0x21')](_0x4c7c82)['then'](function(_0x3ebd99){return _0x3ebd99;});}return null;};}function removeEntity(_0x4e10f8,_0x115f23){return function(_0x3b5fbb){if(_0x3b5fbb){return _0x3b5fbb['destroy']()[_0xfcfe('0x22')](function(){var _0x24f3a7=_0x3b5fbb[_0xfcfe('0x23')]({'plain':!![]});var _0x141038=[{'name':_0xfcfe('0x24'),'value':_0xfcfe('0x25'),'ignore':![]},{'name':_0xfcfe('0x26'),'value':_0xfcfe('0x27'),'ignore':![]}];var _0x138eca=_(_0x141038)[_0xfcfe('0x28')](_0xfcfe('0x29'))[_0xfcfe('0x2a')](_0xfcfe('0x2b'))[_0xfcfe('0x2b')]();if(_[_0xfcfe('0x2c')](_0x138eca,_0x24f3a7[_0xfcfe('0x2d')])){return;}var _0x5bbcaa=_[_0xfcfe('0x2e')](_0x141038,[_0xfcfe('0x2b'),_0x24f3a7[_0xfcfe('0x2d')]])[_0xfcfe('0x2f')];return db[_0xfcfe('0x30')][_0xfcfe('0x31')]({'where':{'type':_0x5bbcaa,'resourceId':_0x24f3a7['id']}})[_0xfcfe('0x22')](function(){return _0x3b5fbb;});})[_0xfcfe('0x22')](function(){_0x4e10f8[_0xfcfe('0x1d')](0xcc)[_0xfcfe('0x18')]();});}};}function handleEntityNotFound(_0x5df2a7,_0x164d5d){return function(_0x1d5701){if(!_0x1d5701){_0x5df2a7['sendStatus'](0x194);}return _0x1d5701;};}function handleError(_0x176402,_0x1cb2f4){_0x1cb2f4=_0x1cb2f4||0x1f4;return function(_0x1cf1e1){logger[_0xfcfe('0x32')](_0x1cf1e1[_0xfcfe('0x33')]);if(_0x1cf1e1['name']){delete _0x1cf1e1[_0xfcfe('0x2f')];}_0x176402['status'](_0x1cb2f4)[_0xfcfe('0x34')](_0x1cf1e1);};}exports[_0xfcfe('0x35')]=function(_0xf6658e,_0x270da6){var _0x44d074={},_0x415996={},_0x46a7dc={'count':0x0,'rows':[]};var _0x489709=_[_0xfcfe('0x2a')](db['VoiceQueue']['rawAttributes'],function(_0x417e6d){return{'name':_0x417e6d[_0xfcfe('0x36')],'type':_0x417e6d[_0xfcfe('0x2d')][_0xfcfe('0x37')]};});_0x415996[_0xfcfe('0x38')]=_[_0xfcfe('0x2a')](_0x489709,_0xfcfe('0x2f'));_0x415996[_0xfcfe('0x39')]=_[_0xfcfe('0x3a')](_0xf6658e[_0xfcfe('0x39')]);_0x415996[_0xfcfe('0x3b')]=_[_0xfcfe('0x3c')](_0x415996['model'],_0x415996[_0xfcfe('0x39')]);_0x44d074[_0xfcfe('0x3d')]=_[_0xfcfe('0x3c')](_0x415996[_0xfcfe('0x38')],qs[_0xfcfe('0x3e')](_0xf6658e[_0xfcfe('0x39')]['fields']));_0x44d074[_0xfcfe('0x3d')]=_0x44d074[_0xfcfe('0x3d')][_0xfcfe('0x3f')]?_0x44d074[_0xfcfe('0x3d')]:_0x415996[_0xfcfe('0x38')];if(!_0xf6658e[_0xfcfe('0x39')]['hasOwnProperty'](_0xfcfe('0x40'))){_0x44d074['limit']=qs[_0xfcfe('0x1a')](_0xf6658e['query'][_0xfcfe('0x1a')]);_0x44d074[_0xfcfe('0x19')]=qs['offset'](_0xf6658e['query'][_0xfcfe('0x19')]);}_0x44d074[_0xfcfe('0x41')]=qs[_0xfcfe('0x42')](_0xf6658e['query'][_0xfcfe('0x42')]);_0x44d074['where']=qs[_0xfcfe('0x3b')](_[_0xfcfe('0x43')](_0xf6658e[_0xfcfe('0x39')],_0x415996[_0xfcfe('0x3b')]),_0x489709);if(_0xf6658e[_0xfcfe('0x39')][_0xfcfe('0x28')]){_0x44d074['where']=_['merge'](_0x44d074[_0xfcfe('0x44')],{'$or':_[_0xfcfe('0x2a')](_0x489709,function(_0x38c219){if(_0x38c219[_0xfcfe('0x2d')]!==_0xfcfe('0x45')){var _0x15ed7a={};_0x15ed7a[_0x38c219['name']]={'$like':'%'+_0xf6658e[_0xfcfe('0x39')][_0xfcfe('0x28')]+'%'};return _0x15ed7a;}})});}_0x44d074=_[_0xfcfe('0x46')]({},_0x44d074,_0xf6658e[_0xfcfe('0x47')]);var _0x9a280a={'where':_0x44d074[_0xfcfe('0x44')]};return db[_0xfcfe('0x48')][_0xfcfe('0x1c')](_0x9a280a)[_0xfcfe('0x22')](function(_0x47fae0){_0x46a7dc['count']=_0x47fae0;if(_0xf6658e[_0xfcfe('0x39')][_0xfcfe('0x49')]){_0x44d074[_0xfcfe('0x4a')]=[{'all':!![]}];}return db[_0xfcfe('0x48')][_0xfcfe('0x4b')](_0x44d074);})[_0xfcfe('0x22')](function(_0x481ca9){_0x46a7dc['rows']=_0x481ca9;return _0x46a7dc;})['then'](respondWithFilteredResult(_0x270da6,_0x44d074))['catch'](handleError(_0x270da6,null));};exports[_0xfcfe('0x4c')]=function(_0x1f9e49,_0x2f7e10){var _0x2e6078={'raw':![],'where':{'id':_0x1f9e49['params']['id']}},_0x41fd82={};_0x41fd82[_0xfcfe('0x38')]=_[_0xfcfe('0x3a')](db[_0xfcfe('0x48')][_0xfcfe('0x4d')]);_0x41fd82[_0xfcfe('0x39')]=_['keys'](_0x1f9e49[_0xfcfe('0x39')]);_0x41fd82[_0xfcfe('0x3b')]=_['intersection'](_0x41fd82[_0xfcfe('0x38')],_0x41fd82['query']);_0x2e6078[_0xfcfe('0x3d')]=_[_0xfcfe('0x3c')](_0x41fd82[_0xfcfe('0x38')],qs[_0xfcfe('0x3e')](_0x1f9e49[_0xfcfe('0x39')][_0xfcfe('0x3e')]));_0x2e6078[_0xfcfe('0x3d')]=_0x2e6078[_0xfcfe('0x3d')][_0xfcfe('0x3f')]?_0x2e6078[_0xfcfe('0x3d')]:_0x41fd82[_0xfcfe('0x38')];if(_0x1f9e49[_0xfcfe('0x39')]['includeAll']){_0x2e6078['include']=[{'all':!![]}];}_0x2e6078=_[_0xfcfe('0x46')]({},_0x2e6078,_0x1f9e49[_0xfcfe('0x47')]);return db['VoiceQueue'][_0xfcfe('0x2e')](_0x2e6078)['then'](handleEntityNotFound(_0x2f7e10,null))[_0xfcfe('0x22')](respondWithResult(_0x2f7e10,null))[_0xfcfe('0x4e')](handleError(_0x2f7e10,null));};exports[_0xfcfe('0x4f')]=function(_0x22ee70,_0x145dbe){return db[_0xfcfe('0x48')]['create'](_0x22ee70[_0xfcfe('0x50')],{})['then'](function(_0x5e6df0){var _0x49d237=_0x22ee70[_0xfcfe('0x51')][_0xfcfe('0x23')]({'plain':!![]});if(!_0x49d237)throw new Error(_0xfcfe('0x52'));if(_0x49d237[_0xfcfe('0x53')]==='user'){var _0x57f573=_0x5e6df0['get']({'plain':!![]});var _0x160e7a=[{'name':_0xfcfe('0x24'),'value':'inbound'},{'name':'QueueCampaigns','value':'outbound'}];var _0x241e75=_[_0xfcfe('0x2e')](_0x160e7a,[_0xfcfe('0x2b'),_0x57f573[_0xfcfe('0x2d')]])[_0xfcfe('0x2f')];return db[_0xfcfe('0x54')][_0xfcfe('0x2e')]({'where':{'name':_0x241e75,'userProfileId':_0x49d237['userProfileId']},'raw':!![]})[_0xfcfe('0x22')](function(_0xd68bc7){if(_0xd68bc7&&_0xd68bc7[_0xfcfe('0x55')]===0x0){return db['UserProfileResource']['create']({'name':_0x57f573['name'],'resourceId':_0x57f573['id'],'type':_0xd68bc7['name'],'sectionId':_0xd68bc7['id']},{})[_0xfcfe('0x22')](function(){return _0x5e6df0;});}else{return _0x5e6df0;}})[_0xfcfe('0x4e')](function(_0x59bed5){logger[_0xfcfe('0x32')](_0xfcfe('0x56'),_0x59bed5);throw _0x59bed5;});}return _0x5e6df0;})['then'](respondWithResult(_0x145dbe,0xc9))['catch'](handleError(_0x145dbe,null));};exports[_0xfcfe('0x57')]=function(_0x488eb0,_0x2ac10d){var _0x1cef53={'where':{'id':_0x488eb0[_0xfcfe('0x58')]['id']}},_0x4496ac={};_0x4496ac[_0xfcfe('0x38')]=_[_0xfcfe('0x3a')](db[_0xfcfe('0x48')][_0xfcfe('0x4d')]);_0x1cef53[_0xfcfe('0x3d')]=_['intersection'](_0x4496ac['model'],qs['fields'](_0x488eb0[_0xfcfe('0x39')]['fields']));_0x1cef53[_0xfcfe('0x3d')]=_0x1cef53[_0xfcfe('0x3d')][_0xfcfe('0x3f')]?_0x1cef53[_0xfcfe('0x3d')]:_0x4496ac[_0xfcfe('0x38')];if(_0x488eb0[_0xfcfe('0x39')]['includeAll']){_0x1cef53['include']=[{'all':!![]}];}_0x1cef53=_[_0xfcfe('0x46')]({},_0x1cef53,_0x488eb0[_0xfcfe('0x47')]);return db[_0xfcfe('0x48')][_0xfcfe('0x2e')](_0x1cef53)[_0xfcfe('0x22')](handleEntityNotFound(_0x2ac10d,null))[_0xfcfe('0x22')](function(_0x3f2297){if(_0x3f2297){var _0x58dc6f=_0x3f2297[_0xfcfe('0x23')]({'plain':!![]});_0x58dc6f=qs[_0xfcfe('0x59')](_0x58dc6f,['id',_0xfcfe('0x5a'),'updatedAt']);_0x488eb0[_0xfcfe('0x50')]=_[_0xfcfe('0x59')](_0x488eb0['body'],['id',_0xfcfe('0x5a'),_0xfcfe('0x5b')]);return db[_0xfcfe('0x48')]['create'](_[_0xfcfe('0x46')](_0x58dc6f,_0x488eb0[_0xfcfe('0x50')]),{'include':_0x488eb0[_0xfcfe('0x39')][_0xfcfe('0x49')]?[{'all':!![]}]:undefined})['then'](function(_0x1e3e5d){var _0x454c3f=_0x488eb0['user']['get']({'plain':!![]});if(!_0x454c3f)throw new Error(_0xfcfe('0x52'));if(_0x454c3f['role']===_0xfcfe('0x51')){var _0x4b968c=_0x1e3e5d['get']({'plain':!![]});var _0x188e05=[{'name':_0xfcfe('0x24'),'value':_0xfcfe('0x25')},{'name':_0xfcfe('0x26'),'value':_0xfcfe('0x27')}];var _0x26c992=_[_0xfcfe('0x2e')](_0x188e05,[_0xfcfe('0x2b'),_0x4b968c[_0xfcfe('0x2d')]])[_0xfcfe('0x2f')];return db[_0xfcfe('0x54')][_0xfcfe('0x2e')]({'where':{'name':_0x26c992,'userProfileId':_0x454c3f[_0xfcfe('0x5c')]},'raw':!![]})['then'](function(_0x40940b){if(_0x40940b&&_0x40940b[_0xfcfe('0x55')]===0x0){return db[_0xfcfe('0x30')][_0xfcfe('0x4f')]({'name':_0x4b968c[_0xfcfe('0x2f')],'resourceId':_0x4b968c['id'],'type':_0x40940b[_0xfcfe('0x2f')],'sectionId':_0x40940b['id']},{})[_0xfcfe('0x22')](function(){return _0x1e3e5d;});}else{return _0x1e3e5d;}})[_0xfcfe('0x4e')](function(_0x983cfd){logger[_0xfcfe('0x32')](_0xfcfe('0x56'),_0x983cfd);throw _0x983cfd;});}return _0x1e3e5d;});}})[_0xfcfe('0x22')](respondWithResult(_0x2ac10d,0xc9))[_0xfcfe('0x4e')](handleError(_0x2ac10d,null));};exports[_0xfcfe('0x21')]=function(_0x1d879e,_0x14bb48){if(_0x1d879e['body']['id']){delete _0x1d879e[_0xfcfe('0x50')]['id'];}return db[_0xfcfe('0x48')][_0xfcfe('0x2e')]({'where':{'id':_0x1d879e['params']['id']}})[_0xfcfe('0x22')](handleEntityNotFound(_0x14bb48,null))[_0xfcfe('0x22')](saveUpdates(_0x1d879e[_0xfcfe('0x50')],null))['then'](respondWithResult(_0x14bb48,null))[_0xfcfe('0x4e')](handleError(_0x14bb48,null));};exports['destroy']=function(_0x35db99,_0x540f07){return db['VoiceQueue'][_0xfcfe('0x2e')]({'where':{'id':_0x35db99[_0xfcfe('0x58')]['id']}})[_0xfcfe('0x22')](handleEntityNotFound(_0x540f07,null))[_0xfcfe('0x22')](removeEntity(_0x540f07,null))[_0xfcfe('0x4e')](handleError(_0x540f07,null));};exports[_0xfcfe('0x5d')]=function(_0x147cc8,_0x18cc11,_0x137204){var _0x3b4971={'raw':![],'where':{}};var _0x19b4d6={};var _0x15806b={'count':0x0,'rows':[]};return db[_0xfcfe('0x48')][_0xfcfe('0x5e')]({'where':{'id':_0x147cc8[_0xfcfe('0x58')]['id']}})[_0xfcfe('0x22')](handleEntityNotFound(_0x18cc11,null))[_0xfcfe('0x22')](function(_0x40b081){if(_0x40b081){_0x19b4d6[_0xfcfe('0x38')]=_['keys'](db[_0xfcfe('0x5f')][_0xfcfe('0x4d')]);_0x19b4d6['query']=_['keys'](_0x147cc8['query']);_0x19b4d6[_0xfcfe('0x3b')]=_[_0xfcfe('0x3c')](_0x19b4d6[_0xfcfe('0x38')],_0x19b4d6[_0xfcfe('0x39')]);_0x3b4971[_0xfcfe('0x3d')]=_[_0xfcfe('0x3c')](_0x19b4d6[_0xfcfe('0x38')],qs['fields'](_0x147cc8[_0xfcfe('0x39')][_0xfcfe('0x3e')]));_0x3b4971['attributes']=_0x3b4971[_0xfcfe('0x3d')][_0xfcfe('0x3f')]?_0x3b4971[_0xfcfe('0x3d')]:_0x19b4d6[_0xfcfe('0x38')];if(!_0x147cc8[_0xfcfe('0x39')][_0xfcfe('0x60')](_0xfcfe('0x40'))){_0x3b4971[_0xfcfe('0x1a')]=qs['limit'](_0x147cc8[_0xfcfe('0x39')][_0xfcfe('0x1a')]);_0x3b4971[_0xfcfe('0x19')]=qs[_0xfcfe('0x19')](_0x147cc8[_0xfcfe('0x39')][_0xfcfe('0x19')]);}_0x3b4971[_0xfcfe('0x41')]=qs['sort'](_0x147cc8['query'][_0xfcfe('0x42')]);_0x3b4971[_0xfcfe('0x44')]=qs['filters'](_[_0xfcfe('0x43')](_0x147cc8['query'],_0x19b4d6['filters']));_0x3b4971['where'][_0xfcfe('0x61')]=_0x40b081['id'];if(_0x147cc8['query'][_0xfcfe('0x28')]){_0x3b4971['where']=_[_0xfcfe('0x46')](_0x3b4971[_0xfcfe('0x44')],{'$or':_['map'](_0x3b4971[_0xfcfe('0x3d')],function(_0x188f15){var _0x465625={};_0x465625[_0x188f15]={'$like':'%'+_0x147cc8[_0xfcfe('0x39')][_0xfcfe('0x28')]+'%'};return _0x465625;})});}_0x3b4971=_[_0xfcfe('0x46')]({},_0x3b4971,_0x147cc8[_0xfcfe('0x47')]);return db[_0xfcfe('0x5f')]['count']({'where':_0x3b4971[_0xfcfe('0x44')]})[_0xfcfe('0x22')](function(_0xf79167){_0x15806b['count']=_0xf79167;if(_0x147cc8[_0xfcfe('0x39')][_0xfcfe('0x49')]){_0x3b4971['include']=[{'all':!![]}];}return db[_0xfcfe('0x5f')][_0xfcfe('0x4b')](_0x3b4971);})[_0xfcfe('0x22')](function(_0x50aefa){_0x15806b[_0xfcfe('0x62')]=_0x50aefa;return _0x15806b;});}})['then'](respondWithFilteredResult(_0x18cc11,_0x3b4971))[_0xfcfe('0x4e')](handleError(_0x18cc11,null));};exports['getHopperHistories']=function(_0x3b2f05,_0x89d73,_0x5dd8d8){var _0x393b2e={'raw':!![],'where':{}};var _0x155a69={};var _0x5c8436={'count':0x0,'rows':[]};return db[_0xfcfe('0x48')][_0xfcfe('0x5e')]({'where':{'id':_0x3b2f05[_0xfcfe('0x58')]['id']}})['then'](handleEntityNotFound(_0x89d73,null))[_0xfcfe('0x22')](function(_0x44070e){if(_0x44070e){_0x155a69[_0xfcfe('0x38')]=_[_0xfcfe('0x3a')](db[_0xfcfe('0x63')]['rawAttributes']);_0x155a69[_0xfcfe('0x39')]=_[_0xfcfe('0x3a')](_0x3b2f05[_0xfcfe('0x39')]);_0x155a69[_0xfcfe('0x3b')]=_[_0xfcfe('0x3c')](_0x155a69[_0xfcfe('0x38')],_0x155a69['query']);_0x393b2e[_0xfcfe('0x3d')]=_[_0xfcfe('0x3c')](_0x155a69['model'],qs[_0xfcfe('0x3e')](_0x3b2f05['query'][_0xfcfe('0x3e')]));_0x393b2e[_0xfcfe('0x3d')]=_0x393b2e['attributes']['length']?_0x393b2e['attributes']:_0x155a69['model'];if(!_0x3b2f05[_0xfcfe('0x39')][_0xfcfe('0x60')](_0xfcfe('0x40'))){_0x393b2e['limit']=qs[_0xfcfe('0x1a')](_0x3b2f05['query'][_0xfcfe('0x1a')]);_0x393b2e[_0xfcfe('0x19')]=qs[_0xfcfe('0x19')](_0x3b2f05[_0xfcfe('0x39')][_0xfcfe('0x19')]);}_0x393b2e[_0xfcfe('0x41')]=qs[_0xfcfe('0x42')](_0x3b2f05[_0xfcfe('0x39')]['sort']);_0x393b2e['where']=qs['filters'](_[_0xfcfe('0x43')](_0x3b2f05[_0xfcfe('0x39')],_0x155a69[_0xfcfe('0x3b')]));_0x393b2e[_0xfcfe('0x44')][_0xfcfe('0x61')]=_0x44070e['id'];if(_0x3b2f05[_0xfcfe('0x39')][_0xfcfe('0x28')]){_0x393b2e['where']=_[_0xfcfe('0x46')](_0x393b2e['where'],{'$or':_[_0xfcfe('0x2a')](_0x393b2e['attributes'],function(_0x5b0ef0){var _0x45858d={};_0x45858d[_0x5b0ef0]={'$like':'%'+_0x3b2f05[_0xfcfe('0x39')][_0xfcfe('0x28')]+'%'};return _0x45858d;})});}_0x393b2e=_['merge']({},_0x393b2e,_0x3b2f05[_0xfcfe('0x47')]);return db[_0xfcfe('0x63')]['count']({'where':_0x393b2e['where']})['then'](function(_0x15620e){_0x5c8436[_0xfcfe('0x1c')]=_0x15620e;if(_0x3b2f05[_0xfcfe('0x39')][_0xfcfe('0x49')]){_0x393b2e['include']=[{'all':!![]}];}return db[_0xfcfe('0x63')][_0xfcfe('0x4b')](_0x393b2e);})[_0xfcfe('0x22')](function(_0x9c5563){_0x5c8436[_0xfcfe('0x62')]=_0x9c5563;return _0x5c8436;});}})[_0xfcfe('0x22')](respondWithFilteredResult(_0x89d73,_0x393b2e))['catch'](handleError(_0x89d73,null));};exports[_0xfcfe('0x64')]=function(_0x17cef6,_0x41b30a,_0x363f89){var _0xb07d9c={'raw':!![],'where':{}};var _0xed8e85={};var _0x3a7d02={'count':0x0,'rows':[]};return db[_0xfcfe('0x48')][_0xfcfe('0x5e')]({'where':{'id':_0x17cef6[_0xfcfe('0x58')]['id']}})['then'](handleEntityNotFound(_0x41b30a,null))[_0xfcfe('0x22')](function(_0x4f1df1){if(_0x4f1df1){_0xed8e85[_0xfcfe('0x38')]=_[_0xfcfe('0x3a')](db[_0xfcfe('0x65')][_0xfcfe('0x4d')]);_0xed8e85[_0xfcfe('0x39')]=_[_0xfcfe('0x3a')](_0x17cef6[_0xfcfe('0x39')]);_0xed8e85[_0xfcfe('0x3b')]=_[_0xfcfe('0x3c')](_0xed8e85[_0xfcfe('0x38')],_0xed8e85[_0xfcfe('0x39')]);_0xb07d9c[_0xfcfe('0x3d')]=_[_0xfcfe('0x3c')](_0xed8e85['model'],qs[_0xfcfe('0x3e')](_0x17cef6['query'][_0xfcfe('0x3e')]));_0xb07d9c[_0xfcfe('0x3d')]=_0xb07d9c['attributes']['length']?_0xb07d9c[_0xfcfe('0x3d')]:_0xed8e85[_0xfcfe('0x38')];if(!_0x17cef6[_0xfcfe('0x39')][_0xfcfe('0x60')](_0xfcfe('0x40'))){_0xb07d9c[_0xfcfe('0x1a')]=qs['limit'](_0x17cef6['query'][_0xfcfe('0x1a')]);_0xb07d9c[_0xfcfe('0x19')]=qs[_0xfcfe('0x19')](_0x17cef6[_0xfcfe('0x39')][_0xfcfe('0x19')]);}_0xb07d9c[_0xfcfe('0x41')]=qs['sort'](_0x17cef6['query']['sort']);_0xb07d9c[_0xfcfe('0x44')]=qs['filters'](_[_0xfcfe('0x43')](_0x17cef6[_0xfcfe('0x39')],_0xed8e85[_0xfcfe('0x3b')]));_0xb07d9c[_0xfcfe('0x44')]['VoiceQueueId']=_0x4f1df1['id'];if(_0x17cef6['query']['filter']){_0xb07d9c['where']=_['merge'](_0xb07d9c[_0xfcfe('0x44')],{'$or':_[_0xfcfe('0x2a')](_0xb07d9c['attributes'],function(_0x46c68f){var _0x51727d={};_0x51727d[_0x46c68f]={'$like':'%'+_0x17cef6[_0xfcfe('0x39')][_0xfcfe('0x28')]+'%'};return _0x51727d;})});}_0xb07d9c=_[_0xfcfe('0x46')]({},_0xb07d9c,_0x17cef6['options']);return db[_0xfcfe('0x65')]['count']({'where':_0xb07d9c['where']})['then'](function(_0x63607e){_0x3a7d02[_0xfcfe('0x1c')]=_0x63607e;if(_0x17cef6['query'][_0xfcfe('0x49')]){_0xb07d9c[_0xfcfe('0x4a')]=[{'all':!![]}];}return db[_0xfcfe('0x65')][_0xfcfe('0x4b')](_0xb07d9c);})[_0xfcfe('0x22')](function(_0x12a6fd){_0x3a7d02[_0xfcfe('0x62')]=_0x12a6fd;return _0x3a7d02;});}})[_0xfcfe('0x22')](respondWithFilteredResult(_0x41b30a,_0xb07d9c))['catch'](handleError(_0x41b30a,null));};exports['getHopperBlacks']=function(_0xd0bad8,_0xcf031d,_0xf68327){var _0xd7d4db={'raw':!![],'where':{}};var _0x3a699b={};var _0x1f5422={'count':0x0,'rows':[]};return db[_0xfcfe('0x48')]['findOne']({'where':{'id':_0xd0bad8[_0xfcfe('0x58')]['id']}})[_0xfcfe('0x22')](handleEntityNotFound(_0xcf031d,null))[_0xfcfe('0x22')](function(_0x361906){if(_0x361906){_0x3a699b[_0xfcfe('0x38')]=_[_0xfcfe('0x3a')](db['CmHopperBlack']['rawAttributes']);_0x3a699b[_0xfcfe('0x39')]=_['keys'](_0xd0bad8[_0xfcfe('0x39')]);_0x3a699b[_0xfcfe('0x3b')]=_['intersection'](_0x3a699b[_0xfcfe('0x38')],_0x3a699b[_0xfcfe('0x39')]);_0xd7d4db[_0xfcfe('0x3d')]=_[_0xfcfe('0x3c')](_0x3a699b[_0xfcfe('0x38')],qs[_0xfcfe('0x3e')](_0xd0bad8['query'][_0xfcfe('0x3e')]));_0xd7d4db[_0xfcfe('0x3d')]=_0xd7d4db[_0xfcfe('0x3d')][_0xfcfe('0x3f')]?_0xd7d4db[_0xfcfe('0x3d')]:_0x3a699b[_0xfcfe('0x38')];if(!_0xd0bad8[_0xfcfe('0x39')][_0xfcfe('0x60')]('nolimit')){_0xd7d4db[_0xfcfe('0x1a')]=qs[_0xfcfe('0x1a')](_0xd0bad8['query'][_0xfcfe('0x1a')]);_0xd7d4db['offset']=qs[_0xfcfe('0x19')](_0xd0bad8[_0xfcfe('0x39')][_0xfcfe('0x19')]);}_0xd7d4db[_0xfcfe('0x41')]=qs[_0xfcfe('0x42')](_0xd0bad8['query'][_0xfcfe('0x42')]);_0xd7d4db[_0xfcfe('0x44')]=qs[_0xfcfe('0x3b')](_['pick'](_0xd0bad8[_0xfcfe('0x39')],_0x3a699b[_0xfcfe('0x3b')]));_0xd7d4db[_0xfcfe('0x44')][_0xfcfe('0x61')]=_0x361906['id'];if(_0xd0bad8['query'][_0xfcfe('0x28')]){_0xd7d4db[_0xfcfe('0x44')]=_[_0xfcfe('0x46')](_0xd7d4db[_0xfcfe('0x44')],{'$or':_[_0xfcfe('0x2a')](_0xd7d4db[_0xfcfe('0x3d')],function(_0xa98423){var _0x3b5639={};_0x3b5639[_0xa98423]={'$like':'%'+_0xd0bad8[_0xfcfe('0x39')][_0xfcfe('0x28')]+'%'};return _0x3b5639;})});}_0xd7d4db=_[_0xfcfe('0x46')]({},_0xd7d4db,_0xd0bad8[_0xfcfe('0x47')]);return db['CmHopperBlack'][_0xfcfe('0x1c')]({'where':_0xd7d4db['where']})[_0xfcfe('0x22')](function(_0x428258){_0x1f5422['count']=_0x428258;if(_0xd0bad8[_0xfcfe('0x39')][_0xfcfe('0x49')]){_0xd7d4db[_0xfcfe('0x4a')]=[{'all':!![]}];}return db[_0xfcfe('0x66')]['findAll'](_0xd7d4db);})[_0xfcfe('0x22')](function(_0x2aae92){_0x1f5422['rows']=_0x2aae92;return _0x1f5422;});}})['then'](respondWithFilteredResult(_0xcf031d,_0xd7d4db))[_0xfcfe('0x4e')](handleError(_0xcf031d,null));};exports[_0xfcfe('0x67')]=function(_0x1bf546,_0x41260f,_0x4ed85e){var _0x58401a={};var _0x1e7668={};var _0x2fd51d;var _0x587a25;return db['VoiceQueue'][_0xfcfe('0x5e')]({'where':{'id':_0x1bf546[_0xfcfe('0x58')]['id']}})[_0xfcfe('0x22')](handleEntityNotFound(_0x41260f,null))[_0xfcfe('0x22')](function(_0x3c686c){if(_0x3c686c){_0x2fd51d=_0x3c686c;_0x1e7668[_0xfcfe('0x38')]=_['keys'](db['Team'][_0xfcfe('0x4d')]);_0x1e7668[_0xfcfe('0x39')]=_[_0xfcfe('0x3a')](_0x1bf546[_0xfcfe('0x39')]);_0x1e7668[_0xfcfe('0x3b')]=_[_0xfcfe('0x3c')](_0x1e7668[_0xfcfe('0x38')],_0x1e7668['query']);_0x58401a[_0xfcfe('0x3d')]=_['intersection'](_0x1e7668['model'],qs['fields'](_0x1bf546[_0xfcfe('0x39')][_0xfcfe('0x3e')]));_0x58401a['attributes']=_0x58401a['attributes'][_0xfcfe('0x3f')]?_0x58401a[_0xfcfe('0x3d')]:_0x1e7668[_0xfcfe('0x38')];_0x58401a[_0xfcfe('0x41')]=qs[_0xfcfe('0x42')](_0x1bf546[_0xfcfe('0x39')]['sort']);_0x58401a['where']=qs['filters'](_['pick'](_0x1bf546[_0xfcfe('0x39')],_0x1e7668[_0xfcfe('0x3b')]));if(_0x1bf546['query']['filter']){_0x58401a[_0xfcfe('0x44')]=_[_0xfcfe('0x46')](_0x58401a[_0xfcfe('0x44')],{'$or':_[_0xfcfe('0x2a')](_0x58401a[_0xfcfe('0x3d')],function(_0x29efab){var _0x145cd6={};_0x145cd6[_0x29efab]={'$like':'%'+_0x1bf546['query'][_0xfcfe('0x28')]+'%'};return _0x145cd6;})});}_0x58401a=_[_0xfcfe('0x46')]({},_0x58401a,_0x1bf546[_0xfcfe('0x47')]);return _0x2fd51d[_0xfcfe('0x67')](_0x58401a);}})[_0xfcfe('0x22')](function(_0x30d202){if(_0x30d202){_0x587a25=_0x30d202[_0xfcfe('0x3f')];if(!_0x1bf546[_0xfcfe('0x39')][_0xfcfe('0x60')](_0xfcfe('0x40'))){_0x58401a[_0xfcfe('0x1a')]=qs[_0xfcfe('0x1a')](_0x1bf546[_0xfcfe('0x39')][_0xfcfe('0x1a')]);_0x58401a[_0xfcfe('0x19')]=qs['offset'](_0x1bf546[_0xfcfe('0x39')]['offset']);}return _0x2fd51d[_0xfcfe('0x67')](_0x58401a);}})[_0xfcfe('0x22')](function(_0x591ae9){if(_0x591ae9){return _0x591ae9?{'count':_0x587a25,'rows':_0x591ae9}:null;}})[_0xfcfe('0x22')](respondWithResult(_0x41260f,null))[_0xfcfe('0x4e')](handleError(_0x41260f,null));};exports['addTeams']=function(_0x3aae82,_0x36f191,_0x5f04e7){var _0x2fb7db=_0x3aae82[_0xfcfe('0x50')]['teams'];var _0xcab26c=_[_0xfcfe('0x2a')](_0x2fb7db,'id');return db['Team'][_0xfcfe('0x4b')]({'where':{'id':_0xcab26c},'attributes':['id'],'include':[{'model':db['User'],'as':_0xfcfe('0x68'),'attributes':['id',_0xfcfe('0x2f'),_0xfcfe('0x69'),'voicePause',_0xfcfe('0x6a')],'raw':!![]}]})[_0xfcfe('0x22')](function(_0x461053){if(_0x461053){var _0x163300=_[_0xfcfe('0x6b')](_0x461053,function(_0x65c7c6){var _0x1c2e97=_0x65c7c6[_0xfcfe('0x23')]({'plain':!![]});_0x1c2e97[_0xfcfe('0x68')][_0xfcfe('0x6c')](function(_0x8a540e){_0x8a540e[_0xfcfe('0x6d')]=_[_0xfcfe('0x2e')](_0x2fb7db,{'id':_0x1c2e97['id']})[_0xfcfe('0x6d')];});return _0x1c2e97[_0xfcfe('0x68')];});return db['VoiceQueue'][_0xfcfe('0x2e')]({'where':{'id':_0x3aae82[_0xfcfe('0x58')]['id']}})[_0xfcfe('0x22')](function(_0x4ced7a){return db['sequelize'][_0xfcfe('0x6e')](function(_0x3b0b63){return _0x4ced7a[_0xfcfe('0x6f')](_0xcab26c,{'transaction':_0x3b0b63})[_0xfcfe('0x22')](function(){return BPromise[_0xfcfe('0x70')](_0x2fb7db,function(_0x58387f){return db[_0xfcfe('0x71')][_0xfcfe('0x72')]({'TeamId':_0x58387f['id'],'VoiceQueueId':_0x3aae82[_0xfcfe('0x58')]['id'],'penalty':_0x58387f[_0xfcfe('0x6d')]},{'transaction':_0x3b0b63});});})[_0xfcfe('0x22')](function(){return BPromise[_0xfcfe('0x70')](_0x163300,function(_0x89d034){return db[_0xfcfe('0x73')][_0xfcfe('0x74')]({'where':{'UserId':_0x89d034['id'],'VoiceQueueId':_0x3aae82[_0xfcfe('0x58')]['id']},'defaults':{'penalty':_0x89d034[_0xfcfe('0x6d')]},'transaction':_0x3b0b63});});})[_0xfcfe('0x22')](function(){return BPromise[_0xfcfe('0x70')](_[_0xfcfe('0x28')](_0x163300,{'online':!![]}),function(_0x39adcb){return db[_0xfcfe('0x75')][_0xfcfe('0x72')]({'membername':_0x39adcb[_0xfcfe('0x2f')],'UserId':_0x39adcb['id'],'queue_name':_0x4ced7a[_0xfcfe('0x2f')],'VoiceQueueId':_0x4ced7a['id'],'interface':_['isNil'](_0x39adcb[_0xfcfe('0x6a')])?util[_0xfcfe('0x76')](_0xfcfe('0x77'),_0x39adcb[_0xfcfe('0x2f')]):_0x39adcb[_0xfcfe('0x6a')],'paused':_0x39adcb['voicePause']||![],'penalty':_0x39adcb[_0xfcfe('0x6d')]},{'transaction':_0x3b0b63});});})[_0xfcfe('0x22')](function(){_0x163300['forEach'](function(_0x532ce1){socket['emit'](_0xfcfe('0x78'),{'UserId':_0x532ce1['id'],'VoiceQueueId':_0x4ced7a['id']});});});});});}})[_0xfcfe('0x22')](respondWithStatusCode(_0x36f191,null))['catch'](handleError(_0x36f191,null));};exports['removeTeams']=function(_0x4205ae,_0xfb8d36,_0x5843c9){return db[_0xfcfe('0x79')][_0xfcfe('0x4b')]({'where':{'id':_0x4205ae[_0xfcfe('0x39')][_0xfcfe('0x7a')]},'attributes':['id'],'include':[{'model':db[_0xfcfe('0x7b')],'as':_0xfcfe('0x68'),'attributes':['id'],'raw':!![]}]})[_0xfcfe('0x22')](handleEntityNotFound(_0xfb8d36,null))['then'](function(_0x5196f1){var _0x5885d1=_[_0xfcfe('0x2a')](_0x5196f1,'id');var _0x444415=[];var _0x568b17=[];var _0xce3ffb=squel[_0xfcfe('0x7c')]();_0xce3ffb['field'](_0xfcfe('0x7d'))[_0xfcfe('0x7e')](_0xfcfe('0x7f'),'tq')['join'](_0xfcfe('0x80'),'ut',_0xfcfe('0x81'))[_0xfcfe('0x44')](_0xfcfe('0x82'),_0x4205ae[_0xfcfe('0x58')]['id']);for(var _0xce2527=0x0;_0xce2527<_0x5196f1[_0xfcfe('0x3f')];_0xce2527+=0x1){let _0x2cdf07=_0x5196f1[_0xce2527];for(var _0x29ccf7=0x0;_0x29ccf7<_0x2cdf07[_0xfcfe('0x68')][_0xfcfe('0x3f')];_0x29ccf7+=0x1){let _0x1e0dbf=_0x2cdf07[_0xfcfe('0x68')][_0x29ccf7];var _0x1d4ee8=_0xce3ffb[_0xfcfe('0x57')]();_0x1d4ee8[_0xfcfe('0x44')](_0xfcfe('0x83'),_0x1e0dbf['id']);_0x568b17[_0xfcfe('0x84')](db[_0xfcfe('0x85')]['query'](_0x1d4ee8['toString'](),{'type':db['sequelize'][_0xfcfe('0x86')][_0xfcfe('0x87')]})[_0xfcfe('0x22')](function(_0x1b4cee){if(_0x1b4cee[_0xfcfe('0x3f')]===0x1){return _0x1e0dbf['id'];}else{var _0x567e69=_['every'](_[_0xfcfe('0x2a')](_0x1b4cee,'TeamId'),function(_0x4f1f0b){return _[_0xfcfe('0x2c')](_0x5885d1,_0x4f1f0b);});if(_0x567e69){return _0x1e0dbf['id'];}}}));}}return BPromise[_0xfcfe('0x88')](_0x568b17)[_0xfcfe('0x22')](function(_0xc006c4){_0x444415=_(_0x444415)[_0xfcfe('0x89')](_0xc006c4)[_0xfcfe('0x8a')]()[_0xfcfe('0x2b')]();return db[_0xfcfe('0x48')][_0xfcfe('0x2e')]({'where':{'id':_0x4205ae['params']['id']}})['then'](function(_0x233323){return db[_0xfcfe('0x85')][_0xfcfe('0x6e')](function(_0x59310f){return _0x233323[_0xfcfe('0x8b')](_0x4205ae[_0xfcfe('0x39')]['ids'],{'transaction':_0x59310f})[_0xfcfe('0x22')](function(){if(!_['isEmpty'](_0x444415)){return _0x233323['removeAgents'](_0x444415,{'transaction':_0x59310f})[_0xfcfe('0x22')](function(){return db[_0xfcfe('0x75')][_0xfcfe('0x31')]({'where':{'VoiceQueueId':_0x4205ae['params']['id'],'UserId':_0x444415},'transaction':_0x59310f});});}})[_0xfcfe('0x22')](function(){_0x444415[_0xfcfe('0x6c')](function(_0x2bcde8){socket[_0xfcfe('0x8c')]('userVoiceQueue:remove',{'UserId':_0x2bcde8,'VoiceQueueId':_0x233323['id']});});});});});});})[_0xfcfe('0x22')](respondWithStatusCode(_0xfb8d36,null))[_0xfcfe('0x4e')](handleError(_0xfb8d36,null));};exports['addAgents']=function(_0xe7834b,_0x380e37,_0x168d14){var _0x4cd6f8,_0x1194cc;return db[_0xfcfe('0x48')][_0xfcfe('0x2e')]({'where':{'id':_0xe7834b[_0xfcfe('0x58')]['id']}})[_0xfcfe('0x22')](handleEntityNotFound(_0x380e37,null))[_0xfcfe('0x22')](function(_0x1e96ca){if(_0x1e96ca){_0x1194cc=_0x1e96ca;return _0x1e96ca[_0xfcfe('0x8d')](_0xe7834b[_0xfcfe('0x50')]['ids'],_[_0xfcfe('0x59')](_0xe7834b[_0xfcfe('0x50')],[_0xfcfe('0x7a'),'id'])||{})[_0xfcfe('0x8e')](function(_0x41cd4e){for(var _0x5049f5=0x0;_0x5049f5<_0xe7834b[_0xfcfe('0x50')][_0xfcfe('0x7a')][_0xfcfe('0x3f')];_0x5049f5+=0x1){socket['emit'](_0xfcfe('0x78'),{'UserId':Number(_0xe7834b[_0xfcfe('0x50')]['ids'][_0x5049f5]),'VoiceQueueId':Number(_0xe7834b[_0xfcfe('0x58')]['id'])});}return _0x41cd4e;});}})['then'](function(_0x558e0b){_0x4cd6f8=_0x558e0b||[];if(_0x1194cc){return db[_0xfcfe('0x7b')][_0xfcfe('0x4b')]({'where':{'id':_0xe7834b['body']['ids']},'attributes':['id','name',_0xfcfe('0x69'),_0xfcfe('0x8f'),_0xfcfe('0x6a')],'raw':!![]});}})[_0xfcfe('0x22')](function(_0x335ff8){if(!_[_0xfcfe('0x90')](_0x335ff8)){var _0x379d71=[];for(var _0x250acd=0x0;_0x250acd<_0x335ff8[_0xfcfe('0x3f')];_0x250acd++){if(_0x335ff8[_0x250acd]['online']){_0x379d71['push'](db[_0xfcfe('0x75')][_0xfcfe('0x72')]({'membername':_0x335ff8[_0x250acd][_0xfcfe('0x2f')],'UserId':_0x335ff8[_0x250acd]['id'],'queue_name':_0x1194cc['name'],'VoiceQueueId':_0x1194cc['id'],'interface':_[_0xfcfe('0x91')](_0x335ff8[_0x250acd]['interface'])?util['format'](_0xfcfe('0x77'),_0x335ff8[_0x250acd]['name']):_0x335ff8[_0x250acd][_0xfcfe('0x6a')],'paused':_0x335ff8[_0x250acd][_0xfcfe('0x8f')]||![],'penalty':_0xe7834b[_0xfcfe('0x50')][_0xfcfe('0x6d')]||0x0}));}}return BPromise[_0xfcfe('0x88')](_0x379d71);}})[_0xfcfe('0x22')](function(){return _0x4cd6f8;})[_0xfcfe('0x22')](respondWithResult(_0x380e37,null))[_0xfcfe('0x4e')](handleError(_0x380e37,null));};exports['removeAgents']=function(_0x539df4,_0x31ccf1,_0x2eb202){return db[_0xfcfe('0x48')][_0xfcfe('0x2e')]({'where':{'id':_0x539df4[_0xfcfe('0x58')]['id']}})[_0xfcfe('0x22')](handleEntityNotFound(_0x31ccf1,null))[_0xfcfe('0x22')](function(_0x3e310f){if(_0x3e310f){return _0x3e310f['removeAgents'](_0x539df4[_0xfcfe('0x39')][_0xfcfe('0x7a')])[_0xfcfe('0x22')](function(){if(_['isArray'](_0x539df4[_0xfcfe('0x39')][_0xfcfe('0x7a')])){for(var _0x27cd34=0x0;_0x27cd34<_0x539df4[_0xfcfe('0x39')][_0xfcfe('0x7a')][_0xfcfe('0x3f')];_0x27cd34+=0x1){socket[_0xfcfe('0x8c')](_0xfcfe('0x92'),{'UserId':Number(_0x539df4[_0xfcfe('0x39')][_0xfcfe('0x7a')][_0x27cd34]),'VoiceQueueId':Number(_0x539df4[_0xfcfe('0x58')]['id'])});}}else{socket[_0xfcfe('0x8c')](_0xfcfe('0x92'),{'UserId':Number(_0x539df4[_0xfcfe('0x39')][_0xfcfe('0x7a')]),'VoiceQueueId':Number(_0x539df4[_0xfcfe('0x58')]['id'])});}});}})[_0xfcfe('0x22')](function(_0xbc9491){return db[_0xfcfe('0x75')][_0xfcfe('0x31')]({'where':{'VoiceQueueId':_0x539df4[_0xfcfe('0x58')]['id'],'UserId':_0x539df4[_0xfcfe('0x39')][_0xfcfe('0x7a')]}})[_0xfcfe('0x22')](function(){return _0xbc9491;});})['then'](respondWithStatusCode(_0x31ccf1,null))[_0xfcfe('0x4e')](handleError(_0x31ccf1,null));};exports[_0xfcfe('0x93')]=function(_0x409d3e,_0x5a0d2e,_0x570ce1){var _0x1169f6={};var _0x54e5e9={};var _0x475d9d;var _0xb9e0f1;return db[_0xfcfe('0x48')]['findOne']({'where':{'id':_0x409d3e[_0xfcfe('0x58')]['id']}})['then'](handleEntityNotFound(_0x5a0d2e,null))[_0xfcfe('0x22')](function(_0x5ea0c3){if(_0x5ea0c3){_0x475d9d=_0x5ea0c3;_0x54e5e9[_0xfcfe('0x38')]=_['keys'](db[_0xfcfe('0x7b')]['rawAttributes']);_0x54e5e9[_0xfcfe('0x39')]=_[_0xfcfe('0x3a')](_0x409d3e[_0xfcfe('0x39')]);_0x54e5e9[_0xfcfe('0x3b')]=_[_0xfcfe('0x3c')](_0x54e5e9['model'],_0x54e5e9['query']);_0x1169f6['attributes']=_['intersection'](_0x54e5e9[_0xfcfe('0x38')],qs[_0xfcfe('0x3e')](_0x409d3e[_0xfcfe('0x39')]['fields']));_0x1169f6['attributes']=_0x1169f6[_0xfcfe('0x3d')][_0xfcfe('0x3f')]?_0x1169f6[_0xfcfe('0x3d')]:_0x54e5e9[_0xfcfe('0x38')];_0x1169f6[_0xfcfe('0x41')]=qs['sort'](_0x409d3e[_0xfcfe('0x39')][_0xfcfe('0x42')]);_0x1169f6[_0xfcfe('0x44')]=qs[_0xfcfe('0x3b')](_[_0xfcfe('0x43')](_0x409d3e[_0xfcfe('0x39')],_0x54e5e9[_0xfcfe('0x3b')]));if(_0x409d3e[_0xfcfe('0x39')][_0xfcfe('0x28')]){_0x1169f6[_0xfcfe('0x44')]=_['merge'](_0x1169f6['where'],{'$or':_[_0xfcfe('0x2a')](_0x1169f6['attributes'],function(_0x16dd26){var _0x3f427a={};_0x3f427a[_0x16dd26]={'$like':'%'+_0x409d3e[_0xfcfe('0x39')]['filter']+'%'};return _0x3f427a;})});}_0x1169f6=_[_0xfcfe('0x46')]({},_0x1169f6,_0x409d3e[_0xfcfe('0x47')]);return _0x475d9d[_0xfcfe('0x93')](_0x1169f6);}})[_0xfcfe('0x22')](function(_0xcedca0){if(_0xcedca0){_0xb9e0f1=_0xcedca0[_0xfcfe('0x3f')];if(!_0x409d3e[_0xfcfe('0x39')][_0xfcfe('0x60')]('nolimit')){_0x1169f6[_0xfcfe('0x1a')]=qs[_0xfcfe('0x1a')](_0x409d3e[_0xfcfe('0x39')]['limit']);_0x1169f6[_0xfcfe('0x19')]=qs['offset'](_0x409d3e[_0xfcfe('0x39')][_0xfcfe('0x19')]);}return _0x475d9d[_0xfcfe('0x93')](_0x1169f6);}})['then'](function(_0x2ec48d){if(_0x2ec48d){return _0x2ec48d?{'count':_0xb9e0f1,'rows':_0x2ec48d}:null;}})[_0xfcfe('0x22')](respondWithResult(_0x5a0d2e,null))[_0xfcfe('0x4e')](handleError(_0x5a0d2e,null));};exports[_0xfcfe('0x94')]=function(_0xbba699,_0x327e31,_0x277a77){var _0x335982={};var _0x46671f={};var _0x36d673;var _0x37d9cd;return db['VoiceQueue'][_0xfcfe('0x5e')]({'where':{'id':_0xbba699[_0xfcfe('0x58')]['id']}})['then'](handleEntityNotFound(_0x327e31,null))[_0xfcfe('0x22')](function(_0x2db65e){if(_0x2db65e){_0x36d673=_0x2db65e;_0x46671f['model']=_[_0xfcfe('0x3a')](db[_0xfcfe('0x75')][_0xfcfe('0x4d')]);_0x46671f[_0xfcfe('0x39')]=_[_0xfcfe('0x3a')](_0xbba699[_0xfcfe('0x39')]);_0x46671f[_0xfcfe('0x3b')]=_[_0xfcfe('0x3c')](_0x46671f[_0xfcfe('0x38')],_0x46671f[_0xfcfe('0x39')]);_0x335982[_0xfcfe('0x3d')]=_[_0xfcfe('0x3c')](_0x46671f['model'],qs[_0xfcfe('0x3e')](_0xbba699['query'][_0xfcfe('0x3e')]));_0x335982[_0xfcfe('0x3d')]=_0x335982[_0xfcfe('0x3d')][_0xfcfe('0x3f')]?_0x335982[_0xfcfe('0x3d')]:_0x46671f[_0xfcfe('0x38')];_0x335982[_0xfcfe('0x41')]=qs[_0xfcfe('0x42')](_0xbba699[_0xfcfe('0x39')][_0xfcfe('0x42')]);_0x335982[_0xfcfe('0x44')]=qs[_0xfcfe('0x3b')](_[_0xfcfe('0x43')](_0xbba699['query'],_0x46671f[_0xfcfe('0x3b')]));if(_0xbba699[_0xfcfe('0x39')][_0xfcfe('0x28')]){_0x335982['where']=_[_0xfcfe('0x46')](_0x335982[_0xfcfe('0x44')],{'$or':_[_0xfcfe('0x2a')](_0x335982[_0xfcfe('0x3d')],function(_0x6b9d68){var _0x770d55={};_0x770d55[_0x6b9d68]={'$like':'%'+_0xbba699[_0xfcfe('0x39')][_0xfcfe('0x28')]+'%'};return _0x770d55;})});}_0x335982=_[_0xfcfe('0x46')]({},_0x335982,_0xbba699[_0xfcfe('0x47')]);return _0x36d673['getMembers'](_0x335982);}})[_0xfcfe('0x22')](function(_0x4a76b4){if(_0x4a76b4){_0x37d9cd=_0x4a76b4[_0xfcfe('0x3f')];if(!_0xbba699[_0xfcfe('0x39')][_0xfcfe('0x60')](_0xfcfe('0x40'))){_0x335982['limit']=qs[_0xfcfe('0x1a')](_0xbba699[_0xfcfe('0x39')][_0xfcfe('0x1a')]);_0x335982[_0xfcfe('0x19')]=qs['offset'](_0xbba699[_0xfcfe('0x39')][_0xfcfe('0x19')]);}return _0x36d673[_0xfcfe('0x94')](_0x335982);}})[_0xfcfe('0x22')](function(_0x36a806){return _0x36a806?{'count':_0x37d9cd,'rows':_0x36a806}:null;})[_0xfcfe('0x22')](respondWithResult(_0x327e31,null))['catch'](handleError(_0x327e31,null));};exports[_0xfcfe('0x95')]=function(_0x38c10b,_0x26cdbc,_0x2c7335){var _0x1ede52={};var _0x294b5a={};var _0x2225dd;var _0x216c01;return db[_0xfcfe('0x48')][_0xfcfe('0x5e')]({'where':{'id':_0x38c10b[_0xfcfe('0x58')]['id']}})[_0xfcfe('0x22')](handleEntityNotFound(_0x26cdbc,null))['then'](function(_0x1d8d75){if(_0x1d8d75){_0x2225dd=_0x1d8d75;_0x294b5a[_0xfcfe('0x38')]=_[_0xfcfe('0x3a')](db[_0xfcfe('0x96')]['rawAttributes']);_0x294b5a[_0xfcfe('0x39')]=_[_0xfcfe('0x3a')](_0x38c10b[_0xfcfe('0x39')]);_0x294b5a[_0xfcfe('0x3b')]=_[_0xfcfe('0x3c')](_0x294b5a['model'],_0x294b5a[_0xfcfe('0x39')]);_0x1ede52[_0xfcfe('0x3d')]=_[_0xfcfe('0x3c')](_0x294b5a[_0xfcfe('0x38')],qs[_0xfcfe('0x3e')](_0x38c10b[_0xfcfe('0x39')][_0xfcfe('0x3e')]));_0x1ede52[_0xfcfe('0x3d')]=_0x1ede52[_0xfcfe('0x3d')][_0xfcfe('0x3f')]?_0x1ede52['attributes']:_0x294b5a[_0xfcfe('0x38')];_0x1ede52['order']=qs[_0xfcfe('0x42')](_0x38c10b[_0xfcfe('0x39')][_0xfcfe('0x42')]);_0x1ede52['where']=qs[_0xfcfe('0x3b')](_['pick'](_0x38c10b[_0xfcfe('0x39')],_0x294b5a[_0xfcfe('0x3b')]));if(_0x38c10b[_0xfcfe('0x39')]['filter']){_0x1ede52[_0xfcfe('0x44')]=_[_0xfcfe('0x46')](_0x1ede52[_0xfcfe('0x44')],{'$or':_['map'](_0x1ede52[_0xfcfe('0x3d')],function(_0x12ae43){var _0x29550e={};_0x29550e[_0x12ae43]={'$like':'%'+_0x38c10b['query'][_0xfcfe('0x28')]+'%'};return _0x29550e;})});}_0x1ede52=_[_0xfcfe('0x46')]({},_0x1ede52,_0x38c10b[_0xfcfe('0x47')]);return _0x2225dd[_0xfcfe('0x95')](_0x1ede52);}})[_0xfcfe('0x22')](function(_0x5c3990){if(_0x5c3990){_0x216c01=_0x5c3990[_0xfcfe('0x3f')];if(!_0x38c10b[_0xfcfe('0x39')][_0xfcfe('0x60')](_0xfcfe('0x40'))){_0x1ede52['limit']=qs[_0xfcfe('0x1a')](_0x38c10b[_0xfcfe('0x39')][_0xfcfe('0x1a')]);_0x1ede52[_0xfcfe('0x19')]=qs['offset'](_0x38c10b[_0xfcfe('0x39')][_0xfcfe('0x19')]);}return _0x2225dd[_0xfcfe('0x95')](_0x1ede52);}})[_0xfcfe('0x22')](function(_0x50a731){if(_0x50a731){return _0x50a731?{'count':_0x216c01,'rows':_0x50a731}:null;}})['then'](respondWithResult(_0x26cdbc,null))['catch'](handleError(_0x26cdbc,null));};exports[_0xfcfe('0x97')]=function(_0x5aba52,_0x5b1837,_0x5a8931){var _0x3fb60d=moment()['format'](_0xfcfe('0x98'));var _0x2836bd,_0x3370c9;return db[_0xfcfe('0x48')][_0xfcfe('0x2e')]({'where':{'id':_0x5aba52['params']['id']}})[_0xfcfe('0x22')](handleEntityNotFound(_0x5b1837,null))[_0xfcfe('0x22')](function(_0x23c57a){if(_0x23c57a){_0x3370c9=_0x23c57a;return _0x23c57a[_0xfcfe('0x97')](_0x5aba52[_0xfcfe('0x50')][_0xfcfe('0x7a')],_[_0xfcfe('0x59')](_0x5aba52[_0xfcfe('0x50')],[_0xfcfe('0x7a'),'id'])||{});}return null;})['spread'](function(_0xc8c1f6){var _0xef52f3;_0x2836bd=_0xc8c1f6||[];var _0x392aba=[];if(_0xc8c1f6){for(var _0x20fa7b=0x0;_0x20fa7b<_0xc8c1f6[_0xfcfe('0x3f')];_0x20fa7b+=0x1){var _0x234c60=_0xc8c1f6[_0x20fa7b][_0xfcfe('0x23')]({'plain':!![]});_0x3370c9[_0xfcfe('0x99')]=_0x5aba52[_0xfcfe('0x50')][_0xfcfe('0x99')]?_0x5aba52[_0xfcfe('0x50')][_0xfcfe('0x99')]:_0x3370c9['dialCheckDuplicateType'];switch(_0x3370c9['dialCheckDuplicateType']){case _0xfcfe('0x9a'):_0xef52f3=squel[_0xfcfe('0x9b')]()[_0xfcfe('0x9c')](_0xfcfe('0x9d'))[_0xfcfe('0x9e')]([_0xfcfe('0x9f'),_0xfcfe('0xa0'),_0xfcfe('0xa1'),_0xfcfe('0xa2'),_0xfcfe('0x61'),_0xfcfe('0x5a'),_0xfcfe('0x5b')],squel[_0xfcfe('0x7c')]()['field'](_0xfcfe('0x9f'),_0xfcfe('0x9f'))['field']('\x27'+_0x3fb60d+'\x27','scheduledAt')['field']('id',_0xfcfe('0xa1'))[_0xfcfe('0xa3')](_0x234c60[_0xfcfe('0xa4')][_0xfcfe('0xa5')](),_0xfcfe('0xa2'))[_0xfcfe('0xa3')](_0x5aba52[_0xfcfe('0x58')]['id'][_0xfcfe('0xa5')](),_0xfcfe('0x61'))[_0xfcfe('0xa3')]('\x27'+_0x3fb60d+'\x27',_0xfcfe('0x5a'))['field']('\x27'+_0x3fb60d+'\x27',_0xfcfe('0x5b'))[_0xfcfe('0x7e')]('cm_contacts')[_0xfcfe('0x44')]('deletedAt\x20IS\x20NULL')[_0xfcfe('0x44')]('ListId\x20=\x20?',_0x234c60[_0xfcfe('0xa4')]['toString']())[_0xfcfe('0x44')]('phone\x20IS\x20NOT\x20NULL')['where'](_0xfcfe('0xa6'),squel[_0xfcfe('0x7c')]()[_0xfcfe('0xa3')](_0xfcfe('0xa7'))['from']('cm_hopper_final')[_0xfcfe('0x44')]('VoiceQueueId\x20=\x20?',_0x5aba52[_0xfcfe('0x58')]['id'][_0xfcfe('0xa5')]()))['where'](_0xfcfe('0xa6'),squel[_0xfcfe('0x7c')]()['field'](_0xfcfe('0xa8'))[_0xfcfe('0x7e')]('cm_hopper')['where'](_0xfcfe('0x82'),_0x5aba52[_0xfcfe('0x58')]['id']['toString']())))[_0xfcfe('0xa5')]();break;case _0xfcfe('0xa9'):_0xef52f3=squel['insert']()['into'](_0xfcfe('0x9d'))['fromQuery'](['phone',_0xfcfe('0xa0'),_0xfcfe('0xa1'),'ListId',_0xfcfe('0x61'),_0xfcfe('0x5a'),_0xfcfe('0x5b')],squel[_0xfcfe('0x7c')]()['field'](_0xfcfe('0x9f'),_0xfcfe('0x9f'))[_0xfcfe('0xa3')]('\x27'+_0x3fb60d+'\x27',_0xfcfe('0xa0'))[_0xfcfe('0xa3')]('id',_0xfcfe('0xa1'))['field'](_0x234c60[_0xfcfe('0xa4')][_0xfcfe('0xa5')](),'ListId')['field'](_0x5aba52['params']['id']['toString'](),_0xfcfe('0x61'))[_0xfcfe('0xa3')]('\x27'+_0x3fb60d+'\x27',_0xfcfe('0x5a'))['field']('\x27'+_0x3fb60d+'\x27','updatedAt')['from']('cm_contacts')[_0xfcfe('0x44')](_0xfcfe('0xaa'))[_0xfcfe('0x44')](_0xfcfe('0xab'),_0x234c60[_0xfcfe('0xa4')][_0xfcfe('0xa5')]())[_0xfcfe('0x44')](_0xfcfe('0xac'))['where'](_0xfcfe('0xa6'),squel[_0xfcfe('0x7c')]()[_0xfcfe('0xa3')]('COALESCE(phone,\x27\x27)')[_0xfcfe('0x7e')](_0xfcfe('0x9d'))[_0xfcfe('0x44')](_0xfcfe('0x82'),_0x5aba52['params']['id']['toString']())))[_0xfcfe('0xa5')]();break;default:_0xef52f3=squel[_0xfcfe('0x9b')]()[_0xfcfe('0x9c')](_0xfcfe('0x9d'))['fromQuery']([_0xfcfe('0x9f'),'scheduledAt',_0xfcfe('0xa1'),'ListId',_0xfcfe('0x61'),_0xfcfe('0x5a'),_0xfcfe('0x5b')],squel['select']()[_0xfcfe('0xa3')](_0xfcfe('0x9f'),_0xfcfe('0x9f'))[_0xfcfe('0xa3')]('\x27'+_0x3fb60d+'\x27',_0xfcfe('0xa0'))[_0xfcfe('0xa3')]('id',_0xfcfe('0xa1'))[_0xfcfe('0xa3')](_0x234c60[_0xfcfe('0xa4')][_0xfcfe('0xa5')](),'ListId')['field'](_0x5aba52['params']['id'][_0xfcfe('0xa5')](),_0xfcfe('0x61'))[_0xfcfe('0xa3')]('\x27'+_0x3fb60d+'\x27',_0xfcfe('0x5a'))[_0xfcfe('0xa3')]('\x27'+_0x3fb60d+'\x27',_0xfcfe('0x5b'))['from']('cm_contacts')[_0xfcfe('0x44')](_0xfcfe('0xaa'))['where'](_0xfcfe('0xab'),_0x234c60[_0xfcfe('0xa4')][_0xfcfe('0xa5')]())[_0xfcfe('0x44')](_0xfcfe('0xac')))[_0xfcfe('0xa5')]();}_0x392aba[_0xfcfe('0x84')](db[_0xfcfe('0x85')][_0xfcfe('0x39')](_0xef52f3));}return BPromise['all'](_0x392aba);}})[_0xfcfe('0x22')](function(){var _0x37d59a=[];var _0x18e609=squel[_0xfcfe('0x9b')]()[_0xfcfe('0x9c')](_0xfcfe('0xad'))[_0xfcfe('0x9e')](['CmHopperId',_0xfcfe('0x9f'),'OrderBy',_0xfcfe('0x5a'),'updatedAt'],squel[_0xfcfe('0x7c')]()[_0xfcfe('0xa3')](_0xfcfe('0xae'))[_0xfcfe('0xa3')]('ci.item')[_0xfcfe('0xa3')]('ci.OrderBy+1')[_0xfcfe('0xa3')]('\x27'+_0x3fb60d+'\x27','createdAt')['field']('\x27'+_0x3fb60d+'\x27','updatedAt')[_0xfcfe('0x7e')](_0xfcfe('0xaf'),'ci')[_0xfcfe('0xb0')](_0xfcfe('0x9d'),'h','h.ContactId=ci.CmContactId')[_0xfcfe('0x44')]('h.scheduledat=?',_0x3fb60d)[_0xfcfe('0x44')](_0xfcfe('0xb1'),_0xfcfe('0xb2')))[_0xfcfe('0xa5')]();_0x37d59a[_0xfcfe('0x84')](db[_0xfcfe('0x85')][_0xfcfe('0x39')](_0x18e609));return BPromise[_0xfcfe('0x88')](_0x37d59a);})[_0xfcfe('0x22')](function(){return _0x2836bd;})[_0xfcfe('0x22')](respondWithResult(_0x5b1837,null))['catch'](handleError(_0x5b1837,null));};exports[_0xfcfe('0xb3')]=function(_0x292e2e,_0x4eeec5,_0x41eb86){return db[_0xfcfe('0x48')][_0xfcfe('0x2e')]({'where':{'id':_0x292e2e[_0xfcfe('0x58')]['id']}})[_0xfcfe('0x22')](handleEntityNotFound(_0x4eeec5,null))[_0xfcfe('0x22')](function(_0x45585a){if(_0x45585a){return _0x45585a[_0xfcfe('0xb3')](_0x292e2e[_0xfcfe('0x39')]['ids']);}})[_0xfcfe('0x22')](function(_0x564bbb){if(_0x564bbb){return db[_0xfcfe('0x5f')][_0xfcfe('0x31')]({'where':{'ListId':_0x292e2e[_0xfcfe('0x39')][_0xfcfe('0x7a')],'VoiceQueueId':_0x292e2e['params']['id']}})[_0xfcfe('0x22')](function(){return _0x564bbb;});}})[_0xfcfe('0x22')](respondWithStatusCode(_0x4eeec5,null))[_0xfcfe('0x4e')](handleError(_0x4eeec5,null));};exports[_0xfcfe('0xb4')]=function(_0x404957,_0x1073cd,_0x10c694){var _0x4eee83={};var _0x1e06d6={};var _0x598eb0;var _0x4d0e79;return db[_0xfcfe('0x48')][_0xfcfe('0x5e')]({'where':{'id':_0x404957[_0xfcfe('0x58')]['id']}})['then'](handleEntityNotFound(_0x1073cd,null))[_0xfcfe('0x22')](function(_0xecb331){if(_0xecb331){_0x598eb0=_0xecb331;_0x1e06d6[_0xfcfe('0x38')]=_[_0xfcfe('0x3a')](db[_0xfcfe('0x96')][_0xfcfe('0x4d')]);_0x1e06d6['query']=_['keys'](_0x404957[_0xfcfe('0x39')]);_0x1e06d6[_0xfcfe('0x3b')]=_[_0xfcfe('0x3c')](_0x1e06d6[_0xfcfe('0x38')],_0x1e06d6[_0xfcfe('0x39')]);_0x4eee83[_0xfcfe('0x3d')]=_[_0xfcfe('0x3c')](_0x1e06d6[_0xfcfe('0x38')],qs[_0xfcfe('0x3e')](_0x404957['query'][_0xfcfe('0x3e')]));_0x4eee83[_0xfcfe('0x3d')]=_0x4eee83['attributes']['length']?_0x4eee83[_0xfcfe('0x3d')]:_0x1e06d6['model'];_0x4eee83[_0xfcfe('0x41')]=qs[_0xfcfe('0x42')](_0x404957[_0xfcfe('0x39')][_0xfcfe('0x42')]);_0x4eee83[_0xfcfe('0x44')]=qs[_0xfcfe('0x3b')](_[_0xfcfe('0x43')](_0x404957[_0xfcfe('0x39')],_0x1e06d6[_0xfcfe('0x3b')]));if(_0x404957[_0xfcfe('0x39')]['filter']){_0x4eee83[_0xfcfe('0x44')]=_[_0xfcfe('0x46')](_0x4eee83[_0xfcfe('0x44')],{'$or':_['map'](_0x4eee83[_0xfcfe('0x3d')],function(_0x53331c){var _0x34fb5e={};_0x34fb5e[_0x53331c]={'$like':'%'+_0x404957[_0xfcfe('0x39')]['filter']+'%'};return _0x34fb5e;})});}_0x4eee83=_[_0xfcfe('0x46')]({},_0x4eee83,_0x404957[_0xfcfe('0x47')]);return _0x598eb0[_0xfcfe('0xb4')](_0x4eee83);}})[_0xfcfe('0x22')](function(_0x279d2c){if(_0x279d2c){_0x4d0e79=_0x279d2c[_0xfcfe('0x3f')];if(!_0x404957['query'][_0xfcfe('0x60')](_0xfcfe('0x40'))){_0x4eee83[_0xfcfe('0x1a')]=qs[_0xfcfe('0x1a')](_0x404957[_0xfcfe('0x39')][_0xfcfe('0x1a')]);_0x4eee83[_0xfcfe('0x19')]=qs[_0xfcfe('0x19')](_0x404957[_0xfcfe('0x39')][_0xfcfe('0x19')]);}return _0x598eb0[_0xfcfe('0xb4')](_0x4eee83);}})[_0xfcfe('0x22')](function(_0x4efe1a){if(_0x4efe1a){return _0x4efe1a?{'count':_0x4d0e79,'rows':_0x4efe1a}:null;}})['then'](respondWithResult(_0x1073cd,null))[_0xfcfe('0x4e')](handleError(_0x1073cd,null));};exports['addBlackLists']=function(_0x338ba6,_0x4fd865,_0x3b1126){var _0x506e6e,_0x115a80;return db[_0xfcfe('0x48')][_0xfcfe('0x2e')]({'where':{'id':_0x338ba6[_0xfcfe('0x58')]['id']}})[_0xfcfe('0x22')](handleEntityNotFound(_0x4fd865,null))[_0xfcfe('0x22')](function(_0x1d18da){if(_0x1d18da){_0x115a80=_0x1d18da;return _0x1d18da['addBlackLists'](_0x338ba6[_0xfcfe('0x50')][_0xfcfe('0x7a')],_[_0xfcfe('0x59')](_0x338ba6[_0xfcfe('0x50')],[_0xfcfe('0x7a'),'id'])||{});}return null;})['spread'](function(_0x1866a8){var _0x8968cd;_0x506e6e=_0x1866a8||[];var _0x2662ab=[];if(_0x1866a8){for(var _0x427ebe=0x0;_0x427ebe<_0x1866a8[_0xfcfe('0x3f')];_0x427ebe+=0x1){var _0x12a41b=_0x1866a8[_0x427ebe][_0xfcfe('0x23')]({'plain':!![]});_0x8968cd=squel[_0xfcfe('0x9b')]()[_0xfcfe('0x9c')](_0xfcfe('0xb5'))[_0xfcfe('0x9e')](['phone','ContactId','ListId',_0xfcfe('0x61'),_0xfcfe('0x5a'),_0xfcfe('0x5b')],squel['select']()['field']('phone','phone')[_0xfcfe('0xa3')]('id',_0xfcfe('0xa1'))[_0xfcfe('0xa3')](_0x12a41b['CmListId'][_0xfcfe('0xa5')](),'ListId')[_0xfcfe('0xa3')](_0x338ba6[_0xfcfe('0x58')]['id'][_0xfcfe('0xa5')](),_0xfcfe('0x61'))[_0xfcfe('0xa3')]('NOW()',_0xfcfe('0x5a'))[_0xfcfe('0xa3')](_0xfcfe('0xb6'),_0xfcfe('0x5b'))[_0xfcfe('0x7e')]('cm_contacts')[_0xfcfe('0x44')](_0xfcfe('0xaa'))[_0xfcfe('0x44')]('ListId\x20=\x20?',_0x12a41b[_0xfcfe('0xa4')][_0xfcfe('0xa5')]())[_0xfcfe('0x44')](_0xfcfe('0xac')))[_0xfcfe('0xa5')]();_0x2662ab[_0xfcfe('0x84')](db[_0xfcfe('0x85')][_0xfcfe('0x39')](_0x8968cd));}return BPromise[_0xfcfe('0x88')](_0x2662ab);}})[_0xfcfe('0x22')](function(){return _0x506e6e;})['then'](respondWithResult(_0x4fd865,null))[_0xfcfe('0x4e')](handleError(_0x4fd865,null));};exports[_0xfcfe('0xb7')]=function(_0xca06fa,_0x4f90e7,_0x9d9aba){return db['VoiceQueue'][_0xfcfe('0x2e')]({'where':{'id':_0xca06fa['params']['id']}})[_0xfcfe('0x22')](handleEntityNotFound(_0x4f90e7,null))[_0xfcfe('0x22')](function(_0x58b55c){if(_0x58b55c){return _0x58b55c['removeBlackLists'](_0xca06fa[_0xfcfe('0x39')][_0xfcfe('0x7a')]);}})['then'](function(_0x50281d){if(_0x50281d){return db[_0xfcfe('0x66')][_0xfcfe('0x31')]({'where':{'ListId':_0xca06fa['query'][_0xfcfe('0x7a')],'VoiceQueueId':_0xca06fa[_0xfcfe('0x58')]['id']}})[_0xfcfe('0x22')](function(){return _0x50281d;});}})[_0xfcfe('0x22')](respondWithStatusCode(_0x4f90e7,null))['catch'](handleError(_0x4f90e7,null));}; \ No newline at end of file +var _0x49e5=['create','body','get','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','length','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','error','findOne','CmHopper','VoiceQueueId','getHopperHistories','CmHopperHistory','order','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','Agents','online','interface','forEach','penalty','sequelize','transaction','TeamVoiceQueue','upsert','each','findOrCreate','UserVoiceQueueRt','format','SIP/%s','userVoiceQueue:save','removeTeams','ids','User','select','field','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','isEmpty','removeAgents','emit','userVoiceQueue:remove','addAgents','spread','isNil','voicePause','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','cm_contacts','deletedAt\x20IS\x20NULL','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','onlyIfOpen','insert','COALESCE(phone,\x27\x27)','ListId\x20=\x20?','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./voiceQueue.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','apply','save','update','then','destroy','VoiceQueues','inbound','QueueCampaigns','outbound','ignore','map','value','type','find','name','UserProfileResource','index','VoiceQueue','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show'];(function(_0xd5fbdb,_0x592fcc){var _0x44166a=function(_0x1e3de0){while(--_0x1e3de0){_0xd5fbdb['push'](_0xd5fbdb['shift']());}};_0x44166a(++_0x592fcc);}(_0x49e5,0x71));var _0x549e=function(_0x50a9de,_0xa5cc8e){_0x50a9de=_0x50a9de-0x0;var _0x4d6259=_0x49e5[_0x50a9de];return _0x4d6259;};'use strict';var emlformat=require(_0x549e('0x0'));var rimraf=require(_0x549e('0x1'));var zipdir=require(_0x549e('0x2'));var jsonpatch=require(_0x549e('0x3'));var rp=require(_0x549e('0x4'));var moment=require('moment');var BPromise=require(_0x549e('0x5'));var Mustache=require(_0x549e('0x6'));var util=require(_0x549e('0x7'));var path=require(_0x549e('0x8'));var sox=require(_0x549e('0x9'));var csv=require('to-csv');var ejs=require(_0x549e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x549e('0xb'));var crypto=require(_0x549e('0xc'));var jsforce=require(_0x549e('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x549e('0xe'));var Redis=require(_0x549e('0xf'));var authService=require(_0x549e('0x10'));var qs=require(_0x549e('0x11'));var as=require(_0x549e('0x12'));var hardwareService=require(_0x549e('0x13'));var logger=require('../../config/logger')(_0x549e('0x14'));var utils=require('../../config/utils');var config=require(_0x549e('0x15'));var licenseUtil=require(_0x549e('0x16'));var db=require(_0x549e('0x17'))['db'];config['redis']=_[_0x549e('0x18')](config[_0x549e('0x19')],{'host':_0x549e('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x549e('0x19')]));require(_0x549e('0x1b'))[_0x549e('0x1c')](socket);function respondWithStatusCode(_0x2b7310,_0x1b06d7){_0x1b06d7=_0x1b06d7||0xcc;return function(_0xea1957){if(_0xea1957){return _0x2b7310[_0x549e('0x1d')](_0x1b06d7);}return _0x2b7310[_0x549e('0x1e')](_0x1b06d7)[_0x549e('0x1f')]();};}function respondWithResult(_0x3636f9,_0x240e70){_0x240e70=_0x240e70||0xc8;return function(_0x207fe0){if(_0x207fe0){return _0x3636f9[_0x549e('0x1e')](_0x240e70)[_0x549e('0x20')](_0x207fe0);}};}function respondWithFilteredResult(_0x347f67,_0x48c662){return function(_0x294cb3){if(_0x294cb3){var _0x233a69=typeof _0x48c662['offset']===_0x549e('0x21')&&typeof _0x48c662[_0x549e('0x22')]===_0x549e('0x21');var _0xe8fa08=_0x294cb3[_0x549e('0x23')];var _0x10cdbe=_0x233a69?0x0:_0x48c662[_0x549e('0x24')];var _0x3dd01a=_0x233a69?_0x294cb3[_0x549e('0x23')]:_0x48c662[_0x549e('0x24')]+_0x48c662[_0x549e('0x22')];var _0x20378b;if(_0x3dd01a>=_0xe8fa08){_0x3dd01a=_0xe8fa08;_0x20378b=0xc8;}else{_0x20378b=0xce;}_0x347f67[_0x549e('0x1e')](_0x20378b);return _0x347f67['set']('Content-Range',_0x10cdbe+'-'+_0x3dd01a+'/'+_0xe8fa08)['json'](_0x294cb3);}return null;};}function patchUpdates(_0x393eb0){return function(_0x22ef6f){try{jsonpatch[_0x549e('0x25')](_0x22ef6f,_0x393eb0,!![]);}catch(_0x5e152a){return BPromise['reject'](_0x5e152a);}return _0x22ef6f[_0x549e('0x26')]();};}function saveUpdates(_0x58c4f2,_0x138ac4){return function(_0x3f06e2){if(_0x3f06e2){return _0x3f06e2[_0x549e('0x27')](_0x58c4f2)[_0x549e('0x28')](function(_0xabf2dc){return _0xabf2dc;});}return null;};}function removeEntity(_0x4adba5,_0x48e480){return function(_0x2cd6a3){if(_0x2cd6a3){return _0x2cd6a3[_0x549e('0x29')]()[_0x549e('0x28')](function(){var _0x425f53=_0x2cd6a3['get']({'plain':!![]});var _0x4d54a3=[{'name':_0x549e('0x2a'),'value':_0x549e('0x2b'),'ignore':![]},{'name':_0x549e('0x2c'),'value':_0x549e('0x2d'),'ignore':![]}];var _0x2c2064=_(_0x4d54a3)['filter'](_0x549e('0x2e'))[_0x549e('0x2f')](_0x549e('0x30'))['value']();if(_['includes'](_0x2c2064,_0x425f53[_0x549e('0x31')])){return;}var _0x1921e3=_[_0x549e('0x32')](_0x4d54a3,[_0x549e('0x30'),_0x425f53[_0x549e('0x31')]])[_0x549e('0x33')];return db[_0x549e('0x34')][_0x549e('0x29')]({'where':{'type':_0x1921e3,'resourceId':_0x425f53['id']}})[_0x549e('0x28')](function(){return _0x2cd6a3;});})[_0x549e('0x28')](function(){_0x4adba5['status'](0xcc)[_0x549e('0x1f')]();});}};}function handleEntityNotFound(_0x3492d5,_0x18f077){return function(_0x163a6b){if(!_0x163a6b){_0x3492d5[_0x549e('0x1d')](0x194);}return _0x163a6b;};}function handleError(_0x1e29d8,_0x5dd388){_0x5dd388=_0x5dd388||0x1f4;return function(_0xac391e){logger['error'](_0xac391e['stack']);if(_0xac391e[_0x549e('0x33')]){delete _0xac391e[_0x549e('0x33')];}_0x1e29d8[_0x549e('0x1e')](_0x5dd388)['send'](_0xac391e);};}exports[_0x549e('0x35')]=function(_0x6435d7,_0x310f55){var _0x228036={},_0x1007a1={},_0x5bd5e5={'count':0x0,'rows':[]};var _0x18740d=_[_0x549e('0x2f')](db[_0x549e('0x36')][_0x549e('0x37')],function(_0x5a49af){return{'name':_0x5a49af[_0x549e('0x38')],'type':_0x5a49af[_0x549e('0x31')]['key']};});_0x1007a1[_0x549e('0x39')]=_[_0x549e('0x2f')](_0x18740d,_0x549e('0x33'));_0x1007a1[_0x549e('0x3a')]=_[_0x549e('0x3b')](_0x6435d7[_0x549e('0x3a')]);_0x1007a1[_0x549e('0x3c')]=_[_0x549e('0x3d')](_0x1007a1['model'],_0x1007a1[_0x549e('0x3a')]);_0x228036[_0x549e('0x3e')]=_[_0x549e('0x3d')](_0x1007a1['model'],qs[_0x549e('0x3f')](_0x6435d7[_0x549e('0x3a')][_0x549e('0x3f')]));_0x228036['attributes']=_0x228036[_0x549e('0x3e')]['length']?_0x228036[_0x549e('0x3e')]:_0x1007a1[_0x549e('0x39')];if(!_0x6435d7[_0x549e('0x3a')][_0x549e('0x40')](_0x549e('0x41'))){_0x228036[_0x549e('0x22')]=qs['limit'](_0x6435d7[_0x549e('0x3a')][_0x549e('0x22')]);_0x228036['offset']=qs[_0x549e('0x24')](_0x6435d7['query'][_0x549e('0x24')]);}_0x228036['order']=qs[_0x549e('0x42')](_0x6435d7['query']['sort']);_0x228036['where']=qs[_0x549e('0x3c')](_[_0x549e('0x43')](_0x6435d7['query'],_0x1007a1[_0x549e('0x3c')]),_0x18740d);if(_0x6435d7[_0x549e('0x3a')][_0x549e('0x44')]){_0x228036['where']=_['merge'](_0x228036[_0x549e('0x45')],{'$or':_[_0x549e('0x2f')](_0x18740d,function(_0xef7c1a){if(_0xef7c1a[_0x549e('0x31')]!==_0x549e('0x46')){var _0x55bd5e={};_0x55bd5e[_0xef7c1a[_0x549e('0x33')]]={'$like':'%'+_0x6435d7['query'][_0x549e('0x44')]+'%'};return _0x55bd5e;}})});}_0x228036=_[_0x549e('0x47')]({},_0x228036,_0x6435d7[_0x549e('0x48')]);var _0x123864={'where':_0x228036['where']};return db[_0x549e('0x36')]['count'](_0x123864)[_0x549e('0x28')](function(_0x20b523){_0x5bd5e5[_0x549e('0x23')]=_0x20b523;if(_0x6435d7[_0x549e('0x3a')][_0x549e('0x49')]){_0x228036[_0x549e('0x4a')]=[{'all':!![]}];}return db[_0x549e('0x36')][_0x549e('0x4b')](_0x228036);})['then'](function(_0x9b64ef){_0x5bd5e5[_0x549e('0x4c')]=_0x9b64ef;return _0x5bd5e5;})[_0x549e('0x28')](respondWithFilteredResult(_0x310f55,_0x228036))[_0x549e('0x4d')](handleError(_0x310f55,null));};exports[_0x549e('0x4e')]=function(_0x330dc0,_0x1c8d47){var _0x141333={'raw':![],'where':{'id':_0x330dc0['params']['id']}},_0xea952f={};_0xea952f[_0x549e('0x39')]=_[_0x549e('0x3b')](db[_0x549e('0x36')][_0x549e('0x37')]);_0xea952f['query']=_[_0x549e('0x3b')](_0x330dc0['query']);_0xea952f['filters']=_[_0x549e('0x3d')](_0xea952f[_0x549e('0x39')],_0xea952f[_0x549e('0x3a')]);_0x141333['attributes']=_[_0x549e('0x3d')](_0xea952f[_0x549e('0x39')],qs['fields'](_0x330dc0[_0x549e('0x3a')]['fields']));_0x141333[_0x549e('0x3e')]=_0x141333[_0x549e('0x3e')]['length']?_0x141333[_0x549e('0x3e')]:_0xea952f['model'];if(_0x330dc0['query']['includeAll']){_0x141333[_0x549e('0x4a')]=[{'all':!![]}];}_0x141333=_[_0x549e('0x47')]({},_0x141333,_0x330dc0[_0x549e('0x48')]);return db[_0x549e('0x36')][_0x549e('0x32')](_0x141333)[_0x549e('0x28')](handleEntityNotFound(_0x1c8d47,null))[_0x549e('0x28')](respondWithResult(_0x1c8d47,null))[_0x549e('0x4d')](handleError(_0x1c8d47,null));};exports[_0x549e('0x4f')]=function(_0x2f0036,_0x1c7431){return db[_0x549e('0x36')]['create'](_0x2f0036[_0x549e('0x50')],{})[_0x549e('0x28')](function(_0x27dcf6){var _0xe403b2=_0x2f0036['user'][_0x549e('0x51')]({'plain':!![]});if(!_0xe403b2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe403b2['role']===_0x549e('0x52')){var _0x32b253=_0x27dcf6[_0x549e('0x51')]({'plain':!![]});var _0x2e4032=[{'name':'VoiceQueues','value':_0x549e('0x2b')},{'name':'QueueCampaigns','value':_0x549e('0x2d')}];var _0x15ec63=_[_0x549e('0x32')](_0x2e4032,[_0x549e('0x30'),_0x32b253[_0x549e('0x31')]])[_0x549e('0x33')];return db[_0x549e('0x53')][_0x549e('0x32')]({'where':{'name':_0x15ec63,'userProfileId':_0xe403b2[_0x549e('0x54')]},'raw':!![]})['then'](function(_0x320994){if(_0x320994&&_0x320994[_0x549e('0x55')]===0x0){return db[_0x549e('0x34')][_0x549e('0x4f')]({'name':_0x32b253[_0x549e('0x33')],'resourceId':_0x32b253['id'],'type':_0x320994[_0x549e('0x33')],'sectionId':_0x320994['id']},{})[_0x549e('0x28')](function(){return _0x27dcf6;});}else{return _0x27dcf6;}})[_0x549e('0x4d')](function(_0x46a131){logger['error'](_0x549e('0x56'),_0x46a131);throw _0x46a131;});}return _0x27dcf6;})[_0x549e('0x28')](respondWithResult(_0x1c7431,0xc9))[_0x549e('0x4d')](handleError(_0x1c7431,null));};exports[_0x549e('0x57')]=function(_0x18edb0,_0x56950f){var _0x22ad7f={'where':{'id':_0x18edb0[_0x549e('0x58')]['id']}},_0x2d7bf8={};_0x2d7bf8[_0x549e('0x39')]=_['keys'](db['VoiceQueue'][_0x549e('0x37')]);_0x22ad7f[_0x549e('0x3e')]=_[_0x549e('0x3d')](_0x2d7bf8['model'],qs[_0x549e('0x3f')](_0x18edb0[_0x549e('0x3a')][_0x549e('0x3f')]));_0x22ad7f[_0x549e('0x3e')]=_0x22ad7f[_0x549e('0x3e')][_0x549e('0x59')]?_0x22ad7f[_0x549e('0x3e')]:_0x2d7bf8[_0x549e('0x39')];if(_0x18edb0[_0x549e('0x3a')]['includeAll']){_0x22ad7f[_0x549e('0x4a')]=[{'all':!![]}];}_0x22ad7f=_[_0x549e('0x47')]({},_0x22ad7f,_0x18edb0[_0x549e('0x48')]);return db[_0x549e('0x36')][_0x549e('0x32')](_0x22ad7f)[_0x549e('0x28')](handleEntityNotFound(_0x56950f,null))[_0x549e('0x28')](function(_0x41c258){if(_0x41c258){var _0x3dbb32=_0x41c258[_0x549e('0x51')]({'plain':!![]});_0x3dbb32=qs[_0x549e('0x5a')](_0x3dbb32,['id',_0x549e('0x5b'),_0x549e('0x5c')]);_0x18edb0[_0x549e('0x50')]=_[_0x549e('0x5a')](_0x18edb0[_0x549e('0x50')],['id',_0x549e('0x5b'),_0x549e('0x5c')]);return db['VoiceQueue'][_0x549e('0x4f')](_[_0x549e('0x47')](_0x3dbb32,_0x18edb0[_0x549e('0x50')]),{'include':_0x18edb0[_0x549e('0x3a')][_0x549e('0x49')]?[{'all':!![]}]:undefined})[_0x549e('0x28')](function(_0x36e2e1){var _0x298d89=_0x18edb0['user']['get']({'plain':!![]});if(!_0x298d89)throw new Error(_0x549e('0x5d'));if(_0x298d89[_0x549e('0x5e')]==='user'){var _0x5025de=_0x36e2e1['get']({'plain':!![]});var _0x47ce57=[{'name':_0x549e('0x2a'),'value':'inbound'},{'name':'QueueCampaigns','value':_0x549e('0x2d')}];var _0x2440de=_[_0x549e('0x32')](_0x47ce57,[_0x549e('0x30'),_0x5025de[_0x549e('0x31')]])[_0x549e('0x33')];return db['UserProfileSection']['find']({'where':{'name':_0x2440de,'userProfileId':_0x298d89[_0x549e('0x54')]},'raw':!![]})[_0x549e('0x28')](function(_0x1e1e7f){if(_0x1e1e7f&&_0x1e1e7f['autoAssociation']===0x0){return db[_0x549e('0x34')][_0x549e('0x4f')]({'name':_0x5025de[_0x549e('0x33')],'resourceId':_0x5025de['id'],'type':_0x1e1e7f['name'],'sectionId':_0x1e1e7f['id']},{})[_0x549e('0x28')](function(){return _0x36e2e1;});}else{return _0x36e2e1;}})[_0x549e('0x4d')](function(_0x256c8a){logger[_0x549e('0x5f')](_0x549e('0x56'),_0x256c8a);throw _0x256c8a;});}return _0x36e2e1;});}})['then'](respondWithResult(_0x56950f,0xc9))[_0x549e('0x4d')](handleError(_0x56950f,null));};exports['update']=function(_0x17cb76,_0x3ce722){if(_0x17cb76['body']['id']){delete _0x17cb76[_0x549e('0x50')]['id'];}return db[_0x549e('0x36')][_0x549e('0x32')]({'where':{'id':_0x17cb76[_0x549e('0x58')]['id']}})[_0x549e('0x28')](handleEntityNotFound(_0x3ce722,null))[_0x549e('0x28')](saveUpdates(_0x17cb76['body'],null))[_0x549e('0x28')](respondWithResult(_0x3ce722,null))[_0x549e('0x4d')](handleError(_0x3ce722,null));};exports['destroy']=function(_0x44166f,_0x2b801e){return db['VoiceQueue'][_0x549e('0x32')]({'where':{'id':_0x44166f[_0x549e('0x58')]['id']}})[_0x549e('0x28')](handleEntityNotFound(_0x2b801e,null))[_0x549e('0x28')](removeEntity(_0x2b801e,null))[_0x549e('0x4d')](handleError(_0x2b801e,null));};exports['getHoppers']=function(_0x3da5ef,_0x426652,_0x392fe5){var _0x893916={'raw':![],'where':{}};var _0x42f17f={};var _0x256430={'count':0x0,'rows':[]};return db[_0x549e('0x36')][_0x549e('0x60')]({'where':{'id':_0x3da5ef['params']['id']}})[_0x549e('0x28')](handleEntityNotFound(_0x426652,null))[_0x549e('0x28')](function(_0x3dcffa){if(_0x3dcffa){_0x42f17f[_0x549e('0x39')]=_[_0x549e('0x3b')](db[_0x549e('0x61')][_0x549e('0x37')]);_0x42f17f[_0x549e('0x3a')]=_[_0x549e('0x3b')](_0x3da5ef[_0x549e('0x3a')]);_0x42f17f[_0x549e('0x3c')]=_[_0x549e('0x3d')](_0x42f17f[_0x549e('0x39')],_0x42f17f[_0x549e('0x3a')]);_0x893916[_0x549e('0x3e')]=_['intersection'](_0x42f17f[_0x549e('0x39')],qs[_0x549e('0x3f')](_0x3da5ef[_0x549e('0x3a')]['fields']));_0x893916['attributes']=_0x893916[_0x549e('0x3e')][_0x549e('0x59')]?_0x893916[_0x549e('0x3e')]:_0x42f17f[_0x549e('0x39')];if(!_0x3da5ef[_0x549e('0x3a')][_0x549e('0x40')](_0x549e('0x41'))){_0x893916[_0x549e('0x22')]=qs['limit'](_0x3da5ef['query'][_0x549e('0x22')]);_0x893916[_0x549e('0x24')]=qs[_0x549e('0x24')](_0x3da5ef[_0x549e('0x3a')][_0x549e('0x24')]);}_0x893916['order']=qs[_0x549e('0x42')](_0x3da5ef[_0x549e('0x3a')][_0x549e('0x42')]);_0x893916[_0x549e('0x45')]=qs['filters'](_[_0x549e('0x43')](_0x3da5ef[_0x549e('0x3a')],_0x42f17f[_0x549e('0x3c')]));_0x893916[_0x549e('0x45')][_0x549e('0x62')]=_0x3dcffa['id'];if(_0x3da5ef['query']['filter']){_0x893916['where']=_[_0x549e('0x47')](_0x893916['where'],{'$or':_['map'](_0x893916['attributes'],function(_0x52d6f2){var _0x46559d={};_0x46559d[_0x52d6f2]={'$like':'%'+_0x3da5ef['query']['filter']+'%'};return _0x46559d;})});}_0x893916=_[_0x549e('0x47')]({},_0x893916,_0x3da5ef[_0x549e('0x48')]);return db[_0x549e('0x61')][_0x549e('0x23')]({'where':_0x893916[_0x549e('0x45')]})[_0x549e('0x28')](function(_0x37dfb1){_0x256430[_0x549e('0x23')]=_0x37dfb1;if(_0x3da5ef['query'][_0x549e('0x49')]){_0x893916['include']=[{'all':!![]}];}return db[_0x549e('0x61')][_0x549e('0x4b')](_0x893916);})[_0x549e('0x28')](function(_0x18da4f){_0x256430[_0x549e('0x4c')]=_0x18da4f;return _0x256430;});}})[_0x549e('0x28')](respondWithFilteredResult(_0x426652,_0x893916))[_0x549e('0x4d')](handleError(_0x426652,null));};exports[_0x549e('0x63')]=function(_0x4de3ad,_0xaa132f,_0x32c62e){var _0x1dfe3d={'raw':!![],'where':{}};var _0x1f266a={};var _0x550182={'count':0x0,'rows':[]};return db[_0x549e('0x36')][_0x549e('0x60')]({'where':{'id':_0x4de3ad['params']['id']}})[_0x549e('0x28')](handleEntityNotFound(_0xaa132f,null))[_0x549e('0x28')](function(_0x177627){if(_0x177627){_0x1f266a[_0x549e('0x39')]=_['keys'](db[_0x549e('0x64')][_0x549e('0x37')]);_0x1f266a[_0x549e('0x3a')]=_['keys'](_0x4de3ad[_0x549e('0x3a')]);_0x1f266a[_0x549e('0x3c')]=_['intersection'](_0x1f266a[_0x549e('0x39')],_0x1f266a[_0x549e('0x3a')]);_0x1dfe3d[_0x549e('0x3e')]=_[_0x549e('0x3d')](_0x1f266a[_0x549e('0x39')],qs[_0x549e('0x3f')](_0x4de3ad[_0x549e('0x3a')][_0x549e('0x3f')]));_0x1dfe3d[_0x549e('0x3e')]=_0x1dfe3d[_0x549e('0x3e')][_0x549e('0x59')]?_0x1dfe3d['attributes']:_0x1f266a[_0x549e('0x39')];if(!_0x4de3ad['query'][_0x549e('0x40')]('nolimit')){_0x1dfe3d[_0x549e('0x22')]=qs['limit'](_0x4de3ad[_0x549e('0x3a')][_0x549e('0x22')]);_0x1dfe3d['offset']=qs[_0x549e('0x24')](_0x4de3ad[_0x549e('0x3a')][_0x549e('0x24')]);}_0x1dfe3d[_0x549e('0x65')]=qs[_0x549e('0x42')](_0x4de3ad['query'][_0x549e('0x42')]);_0x1dfe3d[_0x549e('0x45')]=qs[_0x549e('0x3c')](_[_0x549e('0x43')](_0x4de3ad[_0x549e('0x3a')],_0x1f266a['filters']));_0x1dfe3d[_0x549e('0x45')][_0x549e('0x62')]=_0x177627['id'];if(_0x4de3ad[_0x549e('0x3a')][_0x549e('0x44')]){_0x1dfe3d['where']=_['merge'](_0x1dfe3d['where'],{'$or':_['map'](_0x1dfe3d[_0x549e('0x3e')],function(_0x55c686){var _0x391244={};_0x391244[_0x55c686]={'$like':'%'+_0x4de3ad[_0x549e('0x3a')][_0x549e('0x44')]+'%'};return _0x391244;})});}_0x1dfe3d=_[_0x549e('0x47')]({},_0x1dfe3d,_0x4de3ad[_0x549e('0x48')]);return db[_0x549e('0x64')][_0x549e('0x23')]({'where':_0x1dfe3d[_0x549e('0x45')]})[_0x549e('0x28')](function(_0x1c9104){_0x550182[_0x549e('0x23')]=_0x1c9104;if(_0x4de3ad[_0x549e('0x3a')][_0x549e('0x49')]){_0x1dfe3d[_0x549e('0x4a')]=[{'all':!![]}];}return db[_0x549e('0x64')][_0x549e('0x4b')](_0x1dfe3d);})[_0x549e('0x28')](function(_0x477e23){_0x550182[_0x549e('0x4c')]=_0x477e23;return _0x550182;});}})['then'](respondWithFilteredResult(_0xaa132f,_0x1dfe3d))[_0x549e('0x4d')](handleError(_0xaa132f,null));};exports[_0x549e('0x66')]=function(_0x54c12c,_0x101e50,_0x1b5321){var _0x127497={'raw':!![],'where':{}};var _0x209649={};var _0x51a1cc={'count':0x0,'rows':[]};return db[_0x549e('0x36')][_0x549e('0x60')]({'where':{'id':_0x54c12c['params']['id']}})[_0x549e('0x28')](handleEntityNotFound(_0x101e50,null))[_0x549e('0x28')](function(_0x5aaa57){if(_0x5aaa57){_0x209649[_0x549e('0x39')]=_[_0x549e('0x3b')](db[_0x549e('0x67')][_0x549e('0x37')]);_0x209649['query']=_['keys'](_0x54c12c[_0x549e('0x3a')]);_0x209649[_0x549e('0x3c')]=_[_0x549e('0x3d')](_0x209649[_0x549e('0x39')],_0x209649[_0x549e('0x3a')]);_0x127497[_0x549e('0x3e')]=_[_0x549e('0x3d')](_0x209649[_0x549e('0x39')],qs['fields'](_0x54c12c[_0x549e('0x3a')][_0x549e('0x3f')]));_0x127497[_0x549e('0x3e')]=_0x127497['attributes'][_0x549e('0x59')]?_0x127497['attributes']:_0x209649[_0x549e('0x39')];if(!_0x54c12c['query'][_0x549e('0x40')]('nolimit')){_0x127497[_0x549e('0x22')]=qs[_0x549e('0x22')](_0x54c12c[_0x549e('0x3a')]['limit']);_0x127497[_0x549e('0x24')]=qs[_0x549e('0x24')](_0x54c12c[_0x549e('0x3a')][_0x549e('0x24')]);}_0x127497['order']=qs['sort'](_0x54c12c[_0x549e('0x3a')]['sort']);_0x127497[_0x549e('0x45')]=qs[_0x549e('0x3c')](_['pick'](_0x54c12c[_0x549e('0x3a')],_0x209649[_0x549e('0x3c')]));_0x127497['where'][_0x549e('0x62')]=_0x5aaa57['id'];if(_0x54c12c[_0x549e('0x3a')]['filter']){_0x127497[_0x549e('0x45')]=_[_0x549e('0x47')](_0x127497[_0x549e('0x45')],{'$or':_['map'](_0x127497[_0x549e('0x3e')],function(_0x55c652){var _0x25445e={};_0x25445e[_0x55c652]={'$like':'%'+_0x54c12c[_0x549e('0x3a')][_0x549e('0x44')]+'%'};return _0x25445e;})});}_0x127497=_[_0x549e('0x47')]({},_0x127497,_0x54c12c['options']);return db[_0x549e('0x67')][_0x549e('0x23')]({'where':_0x127497[_0x549e('0x45')]})[_0x549e('0x28')](function(_0x1555ce){_0x51a1cc[_0x549e('0x23')]=_0x1555ce;if(_0x54c12c[_0x549e('0x3a')][_0x549e('0x49')]){_0x127497['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0x549e('0x4b')](_0x127497);})[_0x549e('0x28')](function(_0x24d6c3){_0x51a1cc[_0x549e('0x4c')]=_0x24d6c3;return _0x51a1cc;});}})[_0x549e('0x28')](respondWithFilteredResult(_0x101e50,_0x127497))[_0x549e('0x4d')](handleError(_0x101e50,null));};exports[_0x549e('0x68')]=function(_0x401a7e,_0x43a4dc,_0x3c17d8){var _0x23bd4b={'raw':!![],'where':{}};var _0x26086b={};var _0x3a2569={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x401a7e[_0x549e('0x58')]['id']}})[_0x549e('0x28')](handleEntityNotFound(_0x43a4dc,null))['then'](function(_0x375afb){if(_0x375afb){_0x26086b[_0x549e('0x39')]=_[_0x549e('0x3b')](db['CmHopperBlack'][_0x549e('0x37')]);_0x26086b['query']=_[_0x549e('0x3b')](_0x401a7e['query']);_0x26086b[_0x549e('0x3c')]=_[_0x549e('0x3d')](_0x26086b[_0x549e('0x39')],_0x26086b['query']);_0x23bd4b[_0x549e('0x3e')]=_['intersection'](_0x26086b[_0x549e('0x39')],qs[_0x549e('0x3f')](_0x401a7e[_0x549e('0x3a')][_0x549e('0x3f')]));_0x23bd4b[_0x549e('0x3e')]=_0x23bd4b['attributes'][_0x549e('0x59')]?_0x23bd4b['attributes']:_0x26086b[_0x549e('0x39')];if(!_0x401a7e[_0x549e('0x3a')]['hasOwnProperty']('nolimit')){_0x23bd4b[_0x549e('0x22')]=qs['limit'](_0x401a7e[_0x549e('0x3a')]['limit']);_0x23bd4b['offset']=qs[_0x549e('0x24')](_0x401a7e['query'][_0x549e('0x24')]);}_0x23bd4b['order']=qs[_0x549e('0x42')](_0x401a7e[_0x549e('0x3a')][_0x549e('0x42')]);_0x23bd4b['where']=qs['filters'](_[_0x549e('0x43')](_0x401a7e['query'],_0x26086b['filters']));_0x23bd4b['where'][_0x549e('0x62')]=_0x375afb['id'];if(_0x401a7e[_0x549e('0x3a')][_0x549e('0x44')]){_0x23bd4b[_0x549e('0x45')]=_[_0x549e('0x47')](_0x23bd4b[_0x549e('0x45')],{'$or':_[_0x549e('0x2f')](_0x23bd4b[_0x549e('0x3e')],function(_0x41d724){var _0x51197c={};_0x51197c[_0x41d724]={'$like':'%'+_0x401a7e[_0x549e('0x3a')][_0x549e('0x44')]+'%'};return _0x51197c;})});}_0x23bd4b=_[_0x549e('0x47')]({},_0x23bd4b,_0x401a7e[_0x549e('0x48')]);return db[_0x549e('0x69')]['count']({'where':_0x23bd4b[_0x549e('0x45')]})['then'](function(_0x2cbe92){_0x3a2569[_0x549e('0x23')]=_0x2cbe92;if(_0x401a7e[_0x549e('0x3a')][_0x549e('0x49')]){_0x23bd4b[_0x549e('0x4a')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x549e('0x4b')](_0x23bd4b);})['then'](function(_0x273c62){_0x3a2569[_0x549e('0x4c')]=_0x273c62;return _0x3a2569;});}})[_0x549e('0x28')](respondWithFilteredResult(_0x43a4dc,_0x23bd4b))[_0x549e('0x4d')](handleError(_0x43a4dc,null));};exports[_0x549e('0x6a')]=function(_0xb6f6c1,_0x4d70bd,_0xaaf56c){var _0xf68546={};var _0x4dc5f3={};var _0x42b0c8;var _0x3ebebf;return db[_0x549e('0x36')][_0x549e('0x60')]({'where':{'id':_0xb6f6c1[_0x549e('0x58')]['id']}})[_0x549e('0x28')](handleEntityNotFound(_0x4d70bd,null))['then'](function(_0xfd2ebe){if(_0xfd2ebe){_0x42b0c8=_0xfd2ebe;_0x4dc5f3['model']=_[_0x549e('0x3b')](db[_0x549e('0x6b')]['rawAttributes']);_0x4dc5f3['query']=_[_0x549e('0x3b')](_0xb6f6c1[_0x549e('0x3a')]);_0x4dc5f3['filters']=_[_0x549e('0x3d')](_0x4dc5f3[_0x549e('0x39')],_0x4dc5f3[_0x549e('0x3a')]);_0xf68546[_0x549e('0x3e')]=_[_0x549e('0x3d')](_0x4dc5f3[_0x549e('0x39')],qs['fields'](_0xb6f6c1['query'][_0x549e('0x3f')]));_0xf68546[_0x549e('0x3e')]=_0xf68546[_0x549e('0x3e')][_0x549e('0x59')]?_0xf68546[_0x549e('0x3e')]:_0x4dc5f3[_0x549e('0x39')];_0xf68546['order']=qs[_0x549e('0x42')](_0xb6f6c1[_0x549e('0x3a')]['sort']);_0xf68546[_0x549e('0x45')]=qs[_0x549e('0x3c')](_['pick'](_0xb6f6c1[_0x549e('0x3a')],_0x4dc5f3[_0x549e('0x3c')]));if(_0xb6f6c1[_0x549e('0x3a')][_0x549e('0x44')]){_0xf68546[_0x549e('0x45')]=_[_0x549e('0x47')](_0xf68546[_0x549e('0x45')],{'$or':_[_0x549e('0x2f')](_0xf68546[_0x549e('0x3e')],function(_0x1a4047){var _0x28bf27={};_0x28bf27[_0x1a4047]={'$like':'%'+_0xb6f6c1[_0x549e('0x3a')][_0x549e('0x44')]+'%'};return _0x28bf27;})});}_0xf68546=_['merge']({},_0xf68546,_0xb6f6c1[_0x549e('0x48')]);return _0x42b0c8[_0x549e('0x6a')](_0xf68546);}})['then'](function(_0x15dfcc){if(_0x15dfcc){_0x3ebebf=_0x15dfcc[_0x549e('0x59')];if(!_0xb6f6c1['query'][_0x549e('0x40')](_0x549e('0x41'))){_0xf68546[_0x549e('0x22')]=qs['limit'](_0xb6f6c1['query'][_0x549e('0x22')]);_0xf68546[_0x549e('0x24')]=qs[_0x549e('0x24')](_0xb6f6c1[_0x549e('0x3a')][_0x549e('0x24')]);}return _0x42b0c8['getTeams'](_0xf68546);}})['then'](function(_0x21aaf9){if(_0x21aaf9){return _0x21aaf9?{'count':_0x3ebebf,'rows':_0x21aaf9}:null;}})[_0x549e('0x28')](respondWithResult(_0x4d70bd,null))['catch'](handleError(_0x4d70bd,null));};exports[_0x549e('0x6c')]=function(_0x52dbcf,_0x498124,_0x446726){var _0x4a20be=_0x52dbcf['body'][_0x549e('0x6d')];var _0x282316=_['map'](_0x4a20be,'id');return db['Team'][_0x549e('0x4b')]({'where':{'id':_0x282316},'attributes':['id'],'include':[{'model':db['User'],'as':_0x549e('0x6e'),'attributes':['id','name',_0x549e('0x6f'),'voicePause',_0x549e('0x70')],'raw':!![]}]})[_0x549e('0x28')](function(_0x1dd77d){if(_0x1dd77d){var _0x4eb07b=_['flatMap'](_0x1dd77d,function(_0x26414f){var _0x460b44=_0x26414f[_0x549e('0x51')]({'plain':!![]});_0x460b44[_0x549e('0x6e')][_0x549e('0x71')](function(_0x29937e){_0x29937e[_0x549e('0x72')]=_[_0x549e('0x32')](_0x4a20be,{'id':_0x460b44['id']})[_0x549e('0x72')];});return _0x460b44[_0x549e('0x6e')];});return db[_0x549e('0x36')][_0x549e('0x32')]({'where':{'id':_0x52dbcf[_0x549e('0x58')]['id']}})[_0x549e('0x28')](function(_0x5e17b5){return db[_0x549e('0x73')][_0x549e('0x74')](function(_0x4693fa){return _0x5e17b5['addTeams'](_0x282316,{'transaction':_0x4693fa})[_0x549e('0x28')](function(){return BPromise['each'](_0x4a20be,function(_0x345398){return db[_0x549e('0x75')][_0x549e('0x76')]({'TeamId':_0x345398['id'],'VoiceQueueId':_0x52dbcf[_0x549e('0x58')]['id'],'penalty':_0x345398[_0x549e('0x72')]},{'transaction':_0x4693fa});});})[_0x549e('0x28')](function(){return BPromise[_0x549e('0x77')](_0x4eb07b,function(_0x3eefcf){return db['UserVoiceQueue'][_0x549e('0x78')]({'where':{'UserId':_0x3eefcf['id'],'VoiceQueueId':_0x52dbcf[_0x549e('0x58')]['id']},'defaults':{'penalty':_0x3eefcf[_0x549e('0x72')]},'transaction':_0x4693fa});});})[_0x549e('0x28')](function(){return BPromise[_0x549e('0x77')](_[_0x549e('0x44')](_0x4eb07b,{'online':!![]}),function(_0xece09){return db[_0x549e('0x79')][_0x549e('0x76')]({'membername':_0xece09[_0x549e('0x33')],'UserId':_0xece09['id'],'queue_name':_0x5e17b5[_0x549e('0x33')],'VoiceQueueId':_0x5e17b5['id'],'interface':_['isNil'](_0xece09['interface'])?util[_0x549e('0x7a')](_0x549e('0x7b'),_0xece09['name']):_0xece09['interface'],'paused':_0xece09['voicePause']||![],'penalty':_0xece09[_0x549e('0x72')]},{'transaction':_0x4693fa});});})[_0x549e('0x28')](function(){_0x4eb07b[_0x549e('0x71')](function(_0x418bf6){socket['emit'](_0x549e('0x7c'),{'UserId':_0x418bf6['id'],'VoiceQueueId':_0x5e17b5['id']});});});});});}})[_0x549e('0x28')](respondWithStatusCode(_0x498124,null))[_0x549e('0x4d')](handleError(_0x498124,null));};exports[_0x549e('0x7d')]=function(_0x87743f,_0xc573a5,_0x5423c8){return db[_0x549e('0x6b')][_0x549e('0x4b')]({'where':{'id':_0x87743f['query'][_0x549e('0x7e')]},'attributes':['id'],'include':[{'model':db[_0x549e('0x7f')],'as':_0x549e('0x6e'),'attributes':['id'],'raw':!![]}]})[_0x549e('0x28')](handleEntityNotFound(_0xc573a5,null))[_0x549e('0x28')](function(_0x50d9df){var _0xc085d5=_['map'](_0x50d9df,'id');var _0x300215=[];var _0x556cd8=[];var _0x27edbe=squel[_0x549e('0x80')]();_0x27edbe[_0x549e('0x81')]('tq.TeamId')[_0x549e('0x82')](_0x549e('0x83'),'tq')[_0x549e('0x84')](_0x549e('0x85'),'ut',_0x549e('0x86'))[_0x549e('0x45')](_0x549e('0x87'),_0x87743f[_0x549e('0x58')]['id']);for(var _0x1f11a6=0x0;_0x1f11a6<_0x50d9df[_0x549e('0x59')];_0x1f11a6+=0x1){let _0x10a48d=_0x50d9df[_0x1f11a6];for(var _0x1d151d=0x0;_0x1d151d<_0x10a48d['Agents'][_0x549e('0x59')];_0x1d151d+=0x1){let _0x5beeec=_0x10a48d[_0x549e('0x6e')][_0x1d151d];var _0x3eac30=_0x27edbe[_0x549e('0x57')]();_0x3eac30['where'](_0x549e('0x88'),_0x5beeec['id']);_0x556cd8[_0x549e('0x89')](db[_0x549e('0x73')][_0x549e('0x3a')](_0x3eac30[_0x549e('0x8a')](),{'type':db['sequelize'][_0x549e('0x8b')][_0x549e('0x8c')]})[_0x549e('0x28')](function(_0x2f586b){if(_0x2f586b[_0x549e('0x59')]===0x1){return _0x5beeec['id'];}else{var _0x3101fa=_[_0x549e('0x8d')](_[_0x549e('0x2f')](_0x2f586b,_0x549e('0x8e')),function(_0x1cc48e){return _[_0x549e('0x8f')](_0xc085d5,_0x1cc48e);});if(_0x3101fa){return _0x5beeec['id'];}}}));}}return BPromise[_0x549e('0x90')](_0x556cd8)[_0x549e('0x28')](function(_0x233fb8){_0x300215=_(_0x300215)[_0x549e('0x91')](_0x233fb8)['compact']()[_0x549e('0x30')]();return db[_0x549e('0x36')][_0x549e('0x32')]({'where':{'id':_0x87743f[_0x549e('0x58')]['id']}})[_0x549e('0x28')](function(_0x3eef76){return db[_0x549e('0x73')][_0x549e('0x74')](function(_0x4dff4d){return _0x3eef76[_0x549e('0x7d')](_0x87743f['query'][_0x549e('0x7e')],{'transaction':_0x4dff4d})[_0x549e('0x28')](function(){if(!_[_0x549e('0x92')](_0x300215)){return _0x3eef76[_0x549e('0x93')](_0x300215,{'transaction':_0x4dff4d})['then'](function(){return db[_0x549e('0x79')]['destroy']({'where':{'VoiceQueueId':_0x87743f[_0x549e('0x58')]['id'],'UserId':_0x300215},'transaction':_0x4dff4d});});}})[_0x549e('0x28')](function(){_0x300215[_0x549e('0x71')](function(_0x4b23c0){socket[_0x549e('0x94')](_0x549e('0x95'),{'UserId':_0x4b23c0,'VoiceQueueId':_0x3eef76['id']});});});});});});})['then'](respondWithStatusCode(_0xc573a5,null))[_0x549e('0x4d')](handleError(_0xc573a5,null));};exports[_0x549e('0x96')]=function(_0x4acc29,_0x353241,_0x43a17a){var _0x1d629f,_0x19ecc5;return db[_0x549e('0x36')]['find']({'where':{'id':_0x4acc29[_0x549e('0x58')]['id']}})[_0x549e('0x28')](handleEntityNotFound(_0x353241,null))[_0x549e('0x28')](function(_0x481a8d){if(_0x481a8d){_0x19ecc5=_0x481a8d;return _0x481a8d[_0x549e('0x96')](_0x4acc29['body']['ids'],_[_0x549e('0x5a')](_0x4acc29[_0x549e('0x50')],[_0x549e('0x7e'),'id'])||{})[_0x549e('0x97')](function(_0x5af996){for(var _0x2c68ff=0x0;_0x2c68ff<_0x4acc29[_0x549e('0x50')][_0x549e('0x7e')][_0x549e('0x59')];_0x2c68ff+=0x1){socket[_0x549e('0x94')]('userVoiceQueue:save',{'UserId':Number(_0x4acc29[_0x549e('0x50')][_0x549e('0x7e')][_0x2c68ff]),'VoiceQueueId':Number(_0x4acc29[_0x549e('0x58')]['id'])});}return _0x5af996;});}})[_0x549e('0x28')](function(_0x4daf87){_0x1d629f=_0x4daf87||[];if(_0x19ecc5){return db[_0x549e('0x7f')]['findAll']({'where':{'id':_0x4acc29[_0x549e('0x50')][_0x549e('0x7e')]},'attributes':['id',_0x549e('0x33'),_0x549e('0x6f'),'voicePause','interface'],'raw':!![]});}})[_0x549e('0x28')](function(_0x2a38af){if(!_['isEmpty'](_0x2a38af)){var _0x278325=[];for(var _0x8509cd=0x0;_0x8509cd<_0x2a38af[_0x549e('0x59')];_0x8509cd++){if(_0x2a38af[_0x8509cd][_0x549e('0x6f')]){_0x278325[_0x549e('0x89')](db[_0x549e('0x79')][_0x549e('0x76')]({'membername':_0x2a38af[_0x8509cd][_0x549e('0x33')],'UserId':_0x2a38af[_0x8509cd]['id'],'queue_name':_0x19ecc5[_0x549e('0x33')],'VoiceQueueId':_0x19ecc5['id'],'interface':_[_0x549e('0x98')](_0x2a38af[_0x8509cd][_0x549e('0x70')])?util['format'](_0x549e('0x7b'),_0x2a38af[_0x8509cd][_0x549e('0x33')]):_0x2a38af[_0x8509cd][_0x549e('0x70')],'paused':_0x2a38af[_0x8509cd][_0x549e('0x99')]||![],'penalty':_0x4acc29[_0x549e('0x50')][_0x549e('0x72')]||0x0}));}}return BPromise['all'](_0x278325);}})['then'](function(){return _0x1d629f;})[_0x549e('0x28')](respondWithResult(_0x353241,null))[_0x549e('0x4d')](handleError(_0x353241,null));};exports[_0x549e('0x93')]=function(_0x3d3bca,_0x1df785,_0x23bc2c){return db['VoiceQueue'][_0x549e('0x32')]({'where':{'id':_0x3d3bca[_0x549e('0x58')]['id']}})[_0x549e('0x28')](handleEntityNotFound(_0x1df785,null))[_0x549e('0x28')](function(_0x5c884a){if(_0x5c884a){return _0x5c884a[_0x549e('0x93')](_0x3d3bca[_0x549e('0x3a')][_0x549e('0x7e')])['then'](function(){if(_[_0x549e('0x9a')](_0x3d3bca[_0x549e('0x3a')][_0x549e('0x7e')])){for(var _0x49fd12=0x0;_0x49fd12<_0x3d3bca[_0x549e('0x3a')]['ids'][_0x549e('0x59')];_0x49fd12+=0x1){socket[_0x549e('0x94')](_0x549e('0x95'),{'UserId':Number(_0x3d3bca[_0x549e('0x3a')][_0x549e('0x7e')][_0x49fd12]),'VoiceQueueId':Number(_0x3d3bca['params']['id'])});}}else{socket['emit']('userVoiceQueue:remove',{'UserId':Number(_0x3d3bca[_0x549e('0x3a')][_0x549e('0x7e')]),'VoiceQueueId':Number(_0x3d3bca[_0x549e('0x58')]['id'])});}});}})['then'](function(_0x379124){return db['UserVoiceQueueRt'][_0x549e('0x29')]({'where':{'VoiceQueueId':_0x3d3bca[_0x549e('0x58')]['id'],'UserId':_0x3d3bca['query'][_0x549e('0x7e')]}})[_0x549e('0x28')](function(){return _0x379124;});})['then'](respondWithStatusCode(_0x1df785,null))[_0x549e('0x4d')](handleError(_0x1df785,null));};exports[_0x549e('0x9b')]=function(_0x56b097,_0x27abe8,_0x595080){var _0x14e462={};var _0x40e3d9={};var _0x460f1f;var _0x547adf;return db[_0x549e('0x36')][_0x549e('0x60')]({'where':{'id':_0x56b097[_0x549e('0x58')]['id']}})[_0x549e('0x28')](handleEntityNotFound(_0x27abe8,null))[_0x549e('0x28')](function(_0x4934af){if(_0x4934af){_0x460f1f=_0x4934af;_0x40e3d9['model']=_[_0x549e('0x3b')](db['User']['rawAttributes']);_0x40e3d9[_0x549e('0x3a')]=_[_0x549e('0x3b')](_0x56b097[_0x549e('0x3a')]);_0x40e3d9[_0x549e('0x3c')]=_[_0x549e('0x3d')](_0x40e3d9[_0x549e('0x39')],_0x40e3d9[_0x549e('0x3a')]);_0x14e462['attributes']=_['intersection'](_0x40e3d9[_0x549e('0x39')],qs[_0x549e('0x3f')](_0x56b097[_0x549e('0x3a')]['fields']));_0x14e462[_0x549e('0x3e')]=_0x14e462[_0x549e('0x3e')][_0x549e('0x59')]?_0x14e462[_0x549e('0x3e')]:_0x40e3d9[_0x549e('0x39')];_0x14e462[_0x549e('0x65')]=qs[_0x549e('0x42')](_0x56b097[_0x549e('0x3a')]['sort']);_0x14e462[_0x549e('0x45')]=qs[_0x549e('0x3c')](_[_0x549e('0x43')](_0x56b097[_0x549e('0x3a')],_0x40e3d9[_0x549e('0x3c')]));if(_0x56b097[_0x549e('0x3a')][_0x549e('0x44')]){_0x14e462[_0x549e('0x45')]=_[_0x549e('0x47')](_0x14e462['where'],{'$or':_['map'](_0x14e462[_0x549e('0x3e')],function(_0x208b77){var _0x33f583={};_0x33f583[_0x208b77]={'$like':'%'+_0x56b097[_0x549e('0x3a')]['filter']+'%'};return _0x33f583;})});}_0x14e462=_[_0x549e('0x47')]({},_0x14e462,_0x56b097['options']);return _0x460f1f[_0x549e('0x9b')](_0x14e462);}})[_0x549e('0x28')](function(_0x59a9ef){if(_0x59a9ef){_0x547adf=_0x59a9ef['length'];if(!_0x56b097[_0x549e('0x3a')][_0x549e('0x40')](_0x549e('0x41'))){_0x14e462[_0x549e('0x22')]=qs[_0x549e('0x22')](_0x56b097[_0x549e('0x3a')][_0x549e('0x22')]);_0x14e462[_0x549e('0x24')]=qs[_0x549e('0x24')](_0x56b097['query'][_0x549e('0x24')]);}return _0x460f1f['getAgents'](_0x14e462);}})[_0x549e('0x28')](function(_0x38e2f6){if(_0x38e2f6){return _0x38e2f6?{'count':_0x547adf,'rows':_0x38e2f6}:null;}})[_0x549e('0x28')](respondWithResult(_0x27abe8,null))['catch'](handleError(_0x27abe8,null));};exports[_0x549e('0x9c')]=function(_0x2c1ef6,_0x347cec,_0x465061){var _0x522828={};var _0x3ed6f6={};var _0x560c85;var _0x3419b6;return db[_0x549e('0x36')][_0x549e('0x60')]({'where':{'id':_0x2c1ef6[_0x549e('0x58')]['id']}})[_0x549e('0x28')](handleEntityNotFound(_0x347cec,null))[_0x549e('0x28')](function(_0x283c75){if(_0x283c75){_0x560c85=_0x283c75;_0x3ed6f6[_0x549e('0x39')]=_[_0x549e('0x3b')](db[_0x549e('0x79')][_0x549e('0x37')]);_0x3ed6f6['query']=_[_0x549e('0x3b')](_0x2c1ef6[_0x549e('0x3a')]);_0x3ed6f6[_0x549e('0x3c')]=_[_0x549e('0x3d')](_0x3ed6f6['model'],_0x3ed6f6['query']);_0x522828['attributes']=_['intersection'](_0x3ed6f6[_0x549e('0x39')],qs['fields'](_0x2c1ef6[_0x549e('0x3a')][_0x549e('0x3f')]));_0x522828['attributes']=_0x522828['attributes'][_0x549e('0x59')]?_0x522828['attributes']:_0x3ed6f6['model'];_0x522828[_0x549e('0x65')]=qs[_0x549e('0x42')](_0x2c1ef6[_0x549e('0x3a')][_0x549e('0x42')]);_0x522828[_0x549e('0x45')]=qs[_0x549e('0x3c')](_['pick'](_0x2c1ef6[_0x549e('0x3a')],_0x3ed6f6[_0x549e('0x3c')]));if(_0x2c1ef6[_0x549e('0x3a')]['filter']){_0x522828[_0x549e('0x45')]=_[_0x549e('0x47')](_0x522828[_0x549e('0x45')],{'$or':_['map'](_0x522828[_0x549e('0x3e')],function(_0x4e5988){var _0x53ac31={};_0x53ac31[_0x4e5988]={'$like':'%'+_0x2c1ef6['query']['filter']+'%'};return _0x53ac31;})});}_0x522828=_['merge']({},_0x522828,_0x2c1ef6['options']);return _0x560c85[_0x549e('0x9c')](_0x522828);}})[_0x549e('0x28')](function(_0x3b68bb){if(_0x3b68bb){_0x3419b6=_0x3b68bb[_0x549e('0x59')];if(!_0x2c1ef6[_0x549e('0x3a')][_0x549e('0x40')](_0x549e('0x41'))){_0x522828[_0x549e('0x22')]=qs['limit'](_0x2c1ef6[_0x549e('0x3a')]['limit']);_0x522828[_0x549e('0x24')]=qs[_0x549e('0x24')](_0x2c1ef6[_0x549e('0x3a')][_0x549e('0x24')]);}return _0x560c85['getMembers'](_0x522828);}})['then'](function(_0x909d53){return _0x909d53?{'count':_0x3419b6,'rows':_0x909d53}:null;})[_0x549e('0x28')](respondWithResult(_0x347cec,null))[_0x549e('0x4d')](handleError(_0x347cec,null));};exports[_0x549e('0x9d')]=function(_0x31a961,_0x17cd7a,_0x535fe8){var _0xbfb44={};var _0x203e96={};var _0xe523f;var _0x1182fb;return db[_0x549e('0x36')][_0x549e('0x60')]({'where':{'id':_0x31a961['params']['id']}})[_0x549e('0x28')](handleEntityNotFound(_0x17cd7a,null))['then'](function(_0x5b276e){if(_0x5b276e){_0xe523f=_0x5b276e;_0x203e96[_0x549e('0x39')]=_['keys'](db[_0x549e('0x9e')][_0x549e('0x37')]);_0x203e96['query']=_[_0x549e('0x3b')](_0x31a961[_0x549e('0x3a')]);_0x203e96['filters']=_['intersection'](_0x203e96[_0x549e('0x39')],_0x203e96['query']);_0xbfb44[_0x549e('0x3e')]=_[_0x549e('0x3d')](_0x203e96[_0x549e('0x39')],qs[_0x549e('0x3f')](_0x31a961[_0x549e('0x3a')]['fields']));_0xbfb44[_0x549e('0x3e')]=_0xbfb44[_0x549e('0x3e')][_0x549e('0x59')]?_0xbfb44['attributes']:_0x203e96[_0x549e('0x39')];_0xbfb44[_0x549e('0x65')]=qs[_0x549e('0x42')](_0x31a961[_0x549e('0x3a')][_0x549e('0x42')]);_0xbfb44[_0x549e('0x45')]=qs['filters'](_[_0x549e('0x43')](_0x31a961[_0x549e('0x3a')],_0x203e96[_0x549e('0x3c')]));if(_0x31a961[_0x549e('0x3a')][_0x549e('0x44')]){_0xbfb44[_0x549e('0x45')]=_[_0x549e('0x47')](_0xbfb44[_0x549e('0x45')],{'$or':_['map'](_0xbfb44[_0x549e('0x3e')],function(_0xd6337d){var _0x1dfe81={};_0x1dfe81[_0xd6337d]={'$like':'%'+_0x31a961[_0x549e('0x3a')][_0x549e('0x44')]+'%'};return _0x1dfe81;})});}_0xbfb44=_['merge']({},_0xbfb44,_0x31a961['options']);return _0xe523f[_0x549e('0x9d')](_0xbfb44);}})[_0x549e('0x28')](function(_0x1383ee){if(_0x1383ee){_0x1182fb=_0x1383ee[_0x549e('0x59')];if(!_0x31a961['query'][_0x549e('0x40')](_0x549e('0x41'))){_0xbfb44[_0x549e('0x22')]=qs[_0x549e('0x22')](_0x31a961['query'][_0x549e('0x22')]);_0xbfb44[_0x549e('0x24')]=qs[_0x549e('0x24')](_0x31a961['query'][_0x549e('0x24')]);}return _0xe523f[_0x549e('0x9d')](_0xbfb44);}})[_0x549e('0x28')](function(_0x92512b){if(_0x92512b){return _0x92512b?{'count':_0x1182fb,'rows':_0x92512b}:null;}})[_0x549e('0x28')](respondWithResult(_0x17cd7a,null))[_0x549e('0x4d')](handleError(_0x17cd7a,null));};exports[_0x549e('0x9f')]=function(_0x511715,_0x37dc1a,_0x308913){var _0x2c320e=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x1225df,_0xdb6fa3;return db[_0x549e('0x36')][_0x549e('0x32')]({'where':{'id':_0x511715['params']['id']}})[_0x549e('0x28')](handleEntityNotFound(_0x37dc1a,null))['then'](function(_0xf1b7cb){if(_0xf1b7cb){_0xdb6fa3=_0xf1b7cb;return _0xf1b7cb['addLists'](_0x511715[_0x549e('0x50')][_0x549e('0x7e')],_[_0x549e('0x5a')](_0x511715[_0x549e('0x50')],[_0x549e('0x7e'),'id'])||{});}return null;})[_0x549e('0x97')](function(_0x2e1900){var _0x5d41f9;_0x1225df=_0x2e1900||[];var _0x5ddbb4=[];if(_0x2e1900){for(var _0x1219d4=0x0;_0x1219d4<_0x2e1900[_0x549e('0x59')];_0x1219d4+=0x1){var _0x57bc78=_0x2e1900[_0x1219d4][_0x549e('0x51')]({'plain':!![]});_0xdb6fa3[_0x549e('0xa0')]=_0x511715['body'][_0x549e('0xa0')]?_0x511715['body'][_0x549e('0xa0')]:_0xdb6fa3[_0x549e('0xa0')];switch(_0xdb6fa3[_0x549e('0xa0')]){case _0x549e('0xa1'):_0x5d41f9=squel['insert']()[_0x549e('0xa2')](_0x549e('0xa3'))[_0x549e('0xa4')]([_0x549e('0xa5'),_0x549e('0xa6'),_0x549e('0xa7'),_0x549e('0xa8'),'VoiceQueueId',_0x549e('0x5b'),'updatedAt'],squel['select']()[_0x549e('0x81')](_0x549e('0xa5'),_0x549e('0xa5'))[_0x549e('0x81')]('\x27'+_0x2c320e+'\x27',_0x549e('0xa6'))[_0x549e('0x81')]('id',_0x549e('0xa7'))['field'](_0x57bc78['CmListId'][_0x549e('0x8a')](),_0x549e('0xa8'))[_0x549e('0x81')](_0x511715[_0x549e('0x58')]['id'][_0x549e('0x8a')](),_0x549e('0x62'))['field']('\x27'+_0x2c320e+'\x27',_0x549e('0x5b'))[_0x549e('0x81')]('\x27'+_0x2c320e+'\x27',_0x549e('0x5c'))[_0x549e('0x82')](_0x549e('0xa9'))['where'](_0x549e('0xaa'))[_0x549e('0x45')]('ListId\x20=\x20?',_0x57bc78[_0x549e('0xab')][_0x549e('0x8a')]())[_0x549e('0x45')](_0x549e('0xac'))[_0x549e('0x45')](_0x549e('0xad'),squel[_0x549e('0x80')]()['field']('COALESCE(calleridnum,\x27\x27)')[_0x549e('0x82')](_0x549e('0xae'))['where'](_0x549e('0x87'),_0x511715[_0x549e('0x58')]['id'][_0x549e('0x8a')]()))['where'](_0x549e('0xad'),squel[_0x549e('0x80')]()[_0x549e('0x81')]('COALESCE(phone,\x27\x27)')[_0x549e('0x82')](_0x549e('0xa3'))['where'](_0x549e('0x87'),_0x511715[_0x549e('0x58')]['id'][_0x549e('0x8a')]())))[_0x549e('0x8a')]();break;case _0x549e('0xaf'):_0x5d41f9=squel[_0x549e('0xb0')]()[_0x549e('0xa2')](_0x549e('0xa3'))['fromQuery']([_0x549e('0xa5'),_0x549e('0xa6'),_0x549e('0xa7'),_0x549e('0xa8'),_0x549e('0x62'),'createdAt',_0x549e('0x5c')],squel[_0x549e('0x80')]()[_0x549e('0x81')](_0x549e('0xa5'),'phone')[_0x549e('0x81')]('\x27'+_0x2c320e+'\x27','scheduledAt')[_0x549e('0x81')]('id','ContactId')['field'](_0x57bc78['CmListId']['toString'](),_0x549e('0xa8'))['field'](_0x511715[_0x549e('0x58')]['id']['toString'](),_0x549e('0x62'))['field']('\x27'+_0x2c320e+'\x27',_0x549e('0x5b'))[_0x549e('0x81')]('\x27'+_0x2c320e+'\x27',_0x549e('0x5c'))[_0x549e('0x82')](_0x549e('0xa9'))['where']('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x57bc78[_0x549e('0xab')][_0x549e('0x8a')]())[_0x549e('0x45')]('phone\x20IS\x20NOT\x20NULL')[_0x549e('0x45')](_0x549e('0xad'),squel[_0x549e('0x80')]()[_0x549e('0x81')](_0x549e('0xb1'))['from'](_0x549e('0xa3'))[_0x549e('0x45')](_0x549e('0x87'),_0x511715[_0x549e('0x58')]['id']['toString']())))[_0x549e('0x8a')]();break;default:_0x5d41f9=squel[_0x549e('0xb0')]()[_0x549e('0xa2')](_0x549e('0xa3'))[_0x549e('0xa4')]([_0x549e('0xa5'),_0x549e('0xa6'),_0x549e('0xa7'),_0x549e('0xa8'),_0x549e('0x62'),_0x549e('0x5b'),'updatedAt'],squel[_0x549e('0x80')]()[_0x549e('0x81')](_0x549e('0xa5'),'phone')['field']('\x27'+_0x2c320e+'\x27',_0x549e('0xa6'))[_0x549e('0x81')]('id','ContactId')[_0x549e('0x81')](_0x57bc78[_0x549e('0xab')][_0x549e('0x8a')](),_0x549e('0xa8'))['field'](_0x511715[_0x549e('0x58')]['id'][_0x549e('0x8a')](),_0x549e('0x62'))['field']('\x27'+_0x2c320e+'\x27',_0x549e('0x5b'))[_0x549e('0x81')]('\x27'+_0x2c320e+'\x27',_0x549e('0x5c'))[_0x549e('0x82')](_0x549e('0xa9'))[_0x549e('0x45')](_0x549e('0xaa'))['where'](_0x549e('0xb2'),_0x57bc78[_0x549e('0xab')][_0x549e('0x8a')]())[_0x549e('0x45')](_0x549e('0xac')))['toString']();}_0x5ddbb4['push'](db[_0x549e('0x73')][_0x549e('0x3a')](_0x5d41f9));}return BPromise[_0x549e('0x90')](_0x5ddbb4);}})[_0x549e('0x28')](function(){var _0x381668=[];var _0x1fd074=squel[_0x549e('0xb0')]()[_0x549e('0xa2')]('cm_hopper_additional_phones')['fromQuery'](['CmHopperId',_0x549e('0xa5'),_0x549e('0xb3'),'createdAt',_0x549e('0x5c')],squel['select']()['field']('h.id')['field'](_0x549e('0xb4'))['field'](_0x549e('0xb5'))[_0x549e('0x81')]('\x27'+_0x2c320e+'\x27',_0x549e('0x5b'))[_0x549e('0x81')]('\x27'+_0x2c320e+'\x27',_0x549e('0x5c'))[_0x549e('0x82')](_0x549e('0xb6'),'ci')[_0x549e('0x84')](_0x549e('0xa3'),'h',_0x549e('0xb7'))['where'](_0x549e('0xb8'),_0x2c320e)['where']('ci.ItemClass=?',_0x549e('0xb9')))['toString']();_0x381668['push'](db['sequelize'][_0x549e('0x3a')](_0x1fd074));return BPromise['all'](_0x381668);})['then'](function(){return _0x1225df;})[_0x549e('0x28')](respondWithResult(_0x37dc1a,null))[_0x549e('0x4d')](handleError(_0x37dc1a,null));};exports[_0x549e('0xba')]=function(_0x591f68,_0x474cb4,_0x5c045f){return db[_0x549e('0x36')][_0x549e('0x32')]({'where':{'id':_0x591f68['params']['id']}})['then'](handleEntityNotFound(_0x474cb4,null))[_0x549e('0x28')](function(_0x486e54){if(_0x486e54){return _0x486e54['removeLists'](_0x591f68[_0x549e('0x3a')][_0x549e('0x7e')]);}})['then'](function(_0x5eed5d){if(_0x5eed5d){return db[_0x549e('0x61')][_0x549e('0x29')]({'where':{'ListId':_0x591f68[_0x549e('0x3a')]['ids'],'VoiceQueueId':_0x591f68['params']['id']}})[_0x549e('0x28')](function(){return _0x5eed5d;});}})[_0x549e('0x28')](respondWithStatusCode(_0x474cb4,null))['catch'](handleError(_0x474cb4,null));};exports[_0x549e('0xbb')]=function(_0x7e6ae3,_0x35b880,_0x3995cf){var _0x211c7c={};var _0x35bbf8={};var _0x806c1f;var _0x2999d2;return db[_0x549e('0x36')]['findOne']({'where':{'id':_0x7e6ae3['params']['id']}})[_0x549e('0x28')](handleEntityNotFound(_0x35b880,null))['then'](function(_0x3159f5){if(_0x3159f5){_0x806c1f=_0x3159f5;_0x35bbf8[_0x549e('0x39')]=_['keys'](db[_0x549e('0x9e')][_0x549e('0x37')]);_0x35bbf8[_0x549e('0x3a')]=_[_0x549e('0x3b')](_0x7e6ae3[_0x549e('0x3a')]);_0x35bbf8[_0x549e('0x3c')]=_['intersection'](_0x35bbf8['model'],_0x35bbf8['query']);_0x211c7c[_0x549e('0x3e')]=_['intersection'](_0x35bbf8[_0x549e('0x39')],qs[_0x549e('0x3f')](_0x7e6ae3[_0x549e('0x3a')]['fields']));_0x211c7c['attributes']=_0x211c7c['attributes']['length']?_0x211c7c[_0x549e('0x3e')]:_0x35bbf8[_0x549e('0x39')];_0x211c7c[_0x549e('0x65')]=qs[_0x549e('0x42')](_0x7e6ae3[_0x549e('0x3a')][_0x549e('0x42')]);_0x211c7c['where']=qs[_0x549e('0x3c')](_[_0x549e('0x43')](_0x7e6ae3[_0x549e('0x3a')],_0x35bbf8['filters']));if(_0x7e6ae3['query'][_0x549e('0x44')]){_0x211c7c[_0x549e('0x45')]=_[_0x549e('0x47')](_0x211c7c['where'],{'$or':_[_0x549e('0x2f')](_0x211c7c[_0x549e('0x3e')],function(_0x2abda1){var _0x51b294={};_0x51b294[_0x2abda1]={'$like':'%'+_0x7e6ae3[_0x549e('0x3a')][_0x549e('0x44')]+'%'};return _0x51b294;})});}_0x211c7c=_[_0x549e('0x47')]({},_0x211c7c,_0x7e6ae3[_0x549e('0x48')]);return _0x806c1f[_0x549e('0xbb')](_0x211c7c);}})[_0x549e('0x28')](function(_0x34bcbe){if(_0x34bcbe){_0x2999d2=_0x34bcbe[_0x549e('0x59')];if(!_0x7e6ae3[_0x549e('0x3a')][_0x549e('0x40')](_0x549e('0x41'))){_0x211c7c[_0x549e('0x22')]=qs[_0x549e('0x22')](_0x7e6ae3[_0x549e('0x3a')][_0x549e('0x22')]);_0x211c7c[_0x549e('0x24')]=qs['offset'](_0x7e6ae3[_0x549e('0x3a')]['offset']);}return _0x806c1f[_0x549e('0xbb')](_0x211c7c);}})['then'](function(_0x53f5af){if(_0x53f5af){return _0x53f5af?{'count':_0x2999d2,'rows':_0x53f5af}:null;}})['then'](respondWithResult(_0x35b880,null))[_0x549e('0x4d')](handleError(_0x35b880,null));};exports[_0x549e('0xbc')]=function(_0x44e499,_0x4b935e,_0x4a312d){var _0x3fc56b,_0x4493e7;return db[_0x549e('0x36')][_0x549e('0x32')]({'where':{'id':_0x44e499[_0x549e('0x58')]['id']}})[_0x549e('0x28')](handleEntityNotFound(_0x4b935e,null))[_0x549e('0x28')](function(_0x53a77b){if(_0x53a77b){_0x4493e7=_0x53a77b;return _0x53a77b[_0x549e('0xbc')](_0x44e499[_0x549e('0x50')]['ids'],_[_0x549e('0x5a')](_0x44e499[_0x549e('0x50')],[_0x549e('0x7e'),'id'])||{});}return null;})[_0x549e('0x97')](function(_0x4b5070){var _0x227e82;_0x3fc56b=_0x4b5070||[];var _0x4fe4dc=[];if(_0x4b5070){for(var _0x25f82b=0x0;_0x25f82b<_0x4b5070[_0x549e('0x59')];_0x25f82b+=0x1){var _0x30214b=_0x4b5070[_0x25f82b][_0x549e('0x51')]({'plain':!![]});_0x227e82=squel['insert']()[_0x549e('0xa2')](_0x549e('0xbd'))[_0x549e('0xa4')]([_0x549e('0xa5'),_0x549e('0xa7'),_0x549e('0xa8'),_0x549e('0x62'),'createdAt',_0x549e('0x5c')],squel['select']()[_0x549e('0x81')](_0x549e('0xa5'),_0x549e('0xa5'))[_0x549e('0x81')]('id',_0x549e('0xa7'))[_0x549e('0x81')](_0x30214b[_0x549e('0xab')][_0x549e('0x8a')](),'ListId')['field'](_0x44e499[_0x549e('0x58')]['id'][_0x549e('0x8a')](),_0x549e('0x62'))['field'](_0x549e('0xbe'),_0x549e('0x5b'))[_0x549e('0x81')](_0x549e('0xbe'),'updatedAt')[_0x549e('0x82')](_0x549e('0xa9'))[_0x549e('0x45')](_0x549e('0xaa'))[_0x549e('0x45')]('ListId\x20=\x20?',_0x30214b[_0x549e('0xab')][_0x549e('0x8a')]())[_0x549e('0x45')](_0x549e('0xac')))[_0x549e('0x8a')]();_0x4fe4dc['push'](db[_0x549e('0x73')]['query'](_0x227e82));}return BPromise[_0x549e('0x90')](_0x4fe4dc);}})[_0x549e('0x28')](function(){return _0x3fc56b;})['then'](respondWithResult(_0x4b935e,null))[_0x549e('0x4d')](handleError(_0x4b935e,null));};exports[_0x549e('0xbf')]=function(_0x32cdef,_0x4bb7f,_0x153d63){return db[_0x549e('0x36')][_0x549e('0x32')]({'where':{'id':_0x32cdef['params']['id']}})['then'](handleEntityNotFound(_0x4bb7f,null))[_0x549e('0x28')](function(_0x58514c){if(_0x58514c){return _0x58514c[_0x549e('0xbf')](_0x32cdef['query'][_0x549e('0x7e')]);}})['then'](function(_0x329de2){if(_0x329de2){return db[_0x549e('0x69')][_0x549e('0x29')]({'where':{'ListId':_0x32cdef['query'][_0x549e('0x7e')],'VoiceQueueId':_0x32cdef[_0x549e('0x58')]['id']}})[_0x549e('0x28')](function(){return _0x329de2;});}})[_0x549e('0x28')](respondWithStatusCode(_0x4bb7f,null))[_0x549e('0x4d')](handleError(_0x4bb7f,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 5314274..5335f4a 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 _0xb7eb=['hasOwnProperty','hook','exports','../../mysqldb','VoiceQueue','setMaxListeners','save','update'];(function(_0x1991d8,_0x58c8bd){var _0xb3fb46=function(_0x4c9ef4){while(--_0x4c9ef4){_0x1991d8['push'](_0x1991d8['shift']());}};_0xb3fb46(++_0x58c8bd);}(_0xb7eb,0x18b));var _0xbb7e=function(_0x9f7702,_0x5a2a54){_0x9f7702=_0x9f7702-0x0;var _0x558261=_0xb7eb[_0x9f7702];return _0x558261;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0xbb7e('0x0'))['db'][_0xbb7e('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xbb7e('0x2')](0x0);var events={'afterCreate':_0xbb7e('0x3'),'afterUpdate':_0xbb7e('0x4'),'afterDestroy':'remove'};function emitEvent(_0x55f7cc){return function(_0x50d2d5,_0x49fb69,_0x48975f){VoiceQueueEvents['emit'](_0x55f7cc+':'+_0x50d2d5['id'],_0x50d2d5);VoiceQueueEvents['emit'](_0x55f7cc,_0x50d2d5);_0x48975f(null);};}for(var e in events){if(events[_0xbb7e('0x5')](e)){var event=events[e];VoiceQueue[_0xbb7e('0x6')](e,emitEvent(event));}}module[_0xbb7e('0x7')]=VoiceQueueEvents; \ No newline at end of file +var _0x8997=['emit','hasOwnProperty','hook','../../mysqldb','VoiceQueue','update'];(function(_0x22cff2,_0x5ad3ed){var _0x27b388=function(_0x1146d0){while(--_0x1146d0){_0x22cff2['push'](_0x22cff2['shift']());}};_0x27b388(++_0x5ad3ed);}(_0x8997,0x15f));var _0x7899=function(_0x4798d3,_0x1a3419){_0x4798d3=_0x4798d3-0x0;var _0x45b361=_0x8997[_0x4798d3];return _0x45b361;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x7899('0x0'))['db'][_0x7899('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x7899('0x2'),'afterDestroy':'remove'};function emitEvent(_0x5759b8){return function(_0x463d7b,_0x51c9b0,_0x105f01){VoiceQueueEvents[_0x7899('0x3')](_0x5759b8+':'+_0x463d7b['id'],_0x463d7b);VoiceQueueEvents[_0x7899('0x3')](_0x5759b8,_0x463d7b);_0x105f01(null);};}for(var e in events){if(events[_0x7899('0x4')](e)){var event=events[e];VoiceQueue[_0x7899('0x5')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index e72e111..b479a76 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 _0x3e74=['exports','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes'];(function(_0x192b6f,_0x603378){var _0x30f545=function(_0x190a70){while(--_0x190a70){_0x192b6f['push'](_0x192b6f['shift']());}};_0x30f545(++_0x603378);}(_0x3e74,0x175));var _0x43e7=function(_0x20a5ce,_0x13b295){_0x20a5ce=_0x20a5ce-0x0;var _0x508eb3=_0x3e74[_0x20a5ce];return _0x508eb3;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e74=['exports','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes'];(function(_0x45cb2b,_0x285349){var _0x9411a6=function(_0x15da36){while(--_0x15da36){_0x45cb2b['push'](_0x45cb2b['shift']());}};_0x9411a6(++_0x285349);}(_0x3e74,0x175));var _0x43e7=function(_0x2030cc,_0x37589b){_0x2030cc=_0x2030cc-0x0;var _0x231c13=_0x3e74[_0x2030cc];return _0x231c13;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index dba4dfd..065a716 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 _0x1f66=['defaults','localhost','socket.io-emitter','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','include','model','map','find','ShowVoiceQueue','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/environment','client','http','redis'];(function(_0x5b6779,_0x4886bc){var _0x530515=function(_0x937555){while(--_0x937555){_0x5b6779['push'](_0x5b6779['shift']());}};_0x530515(++_0x4886bc);}(_0x1f66,0x66));var _0x61f6=function(_0x273dea,_0x286c8f){_0x273dea=_0x273dea-0x0;var _0x39b5c8=_0x1f66[_0x273dea];return _0x39b5c8;};'use strict';var _=require(_0x61f6('0x0'));var util=require('util');var moment=require(_0x61f6('0x1'));var BPromise=require(_0x61f6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x61f6('0x3'))['db'];var utils=require(_0x61f6('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x61f6('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x61f6('0x6')][_0x61f6('0x7')]({'port':0x232a});config[_0x61f6('0x8')]=_[_0x61f6('0x9')](config[_0x61f6('0x8')],{'host':_0x61f6('0xa'),'port':0x18eb});var socket=require(_0x61f6('0xb'))(new Redis(config['redis']));require('./voiceQueue.socket')['register'](socket);function respondWithRpcPromise(_0x406657,_0x13ff6a,_0x3756f9){return new BPromise(function(_0x26b74f,_0x4b5683){return client['request'](_0x406657,_0x3756f9)[_0x61f6('0xc')](function(_0xddfc77){logger[_0x61f6('0xd')](_0x61f6('0xe'),_0x13ff6a,_0x61f6('0xf'));logger[_0x61f6('0x10')](_0x61f6('0x11'),_0x13ff6a,_0x61f6('0xf'),JSON[_0x61f6('0x12')](_0xddfc77));if(_0xddfc77[_0x61f6('0x13')]){if(_0xddfc77['error'][_0x61f6('0x14')]===0x1f4){logger[_0x61f6('0x13')](_0x61f6('0xe'),_0x13ff6a,_0xddfc77['error'][_0x61f6('0x15')]);return _0x4b5683(_0xddfc77[_0x61f6('0x13')][_0x61f6('0x15')]);}logger[_0x61f6('0x13')](_0x61f6('0xe'),_0x13ff6a,_0xddfc77[_0x61f6('0x13')][_0x61f6('0x15')]);return _0x26b74f(_0xddfc77['error'][_0x61f6('0x15')]);}else{logger['info'](_0x61f6('0xe'),_0x13ff6a,_0x61f6('0xf'));_0x26b74f(_0xddfc77[_0x61f6('0x16')][_0x61f6('0x15')]);}})[_0x61f6('0x17')](function(_0x526f29){logger[_0x61f6('0x13')](_0x61f6('0xe'),_0x13ff6a,_0x526f29);_0x4b5683(_0x526f29);});});}exports[_0x61f6('0x18')]=function(_0xa9babe){var _0x4a0dd1=this;return new Promise(function(_0x2b6b0e,_0x283265){return db[_0x61f6('0x19')][_0x61f6('0x1a')]({'raw':_0xa9babe[_0x61f6('0x1b')]?_0xa9babe[_0x61f6('0x1b')][_0x61f6('0x1c')]===undefined?!![]:![]:!![],'where':_0xa9babe[_0x61f6('0x1b')]?_0xa9babe[_0x61f6('0x1b')][_0x61f6('0x1d')]||null:null,'attributes':_0xa9babe['options']?_0xa9babe[_0x61f6('0x1b')][_0x61f6('0x1e')]||null:null,'limit':_0xa9babe[_0x61f6('0x1b')]?_0xa9babe[_0x61f6('0x1b')][_0x61f6('0x1f')]||null:null,'include':_0xa9babe[_0x61f6('0x1b')]?_0xa9babe[_0x61f6('0x1b')][_0x61f6('0x20')]?_['map'](_0xa9babe[_0x61f6('0x1b')][_0x61f6('0x20')],function(_0x5358f7){return{'model':db[_0x5358f7[_0x61f6('0x21')]],'as':_0x5358f7['as'],'attributes':_0x5358f7['attributes'],'include':_0x5358f7['include']?_[_0x61f6('0x22')](_0x5358f7[_0x61f6('0x20')],function(_0x4b8ab8){return{'model':db[_0x4b8ab8['model']],'as':_0x4b8ab8['as'],'attributes':_0x4b8ab8['attributes'],'include':_0x4b8ab8['include']?_['map'](_0x4b8ab8[_0x61f6('0x20')],function(_0x10d92d){return{'model':db[_0x10d92d[_0x61f6('0x21')]],'as':_0x10d92d['as'],'attributes':_0x10d92d['attributes']};}):[]};}):[]};}):[]:[]})[_0x61f6('0xc')](function(_0xa3164a){logger[_0x61f6('0xd')]('GetVoiceQueue',_0xa9babe);logger[_0x61f6('0x10')]('GetVoiceQueue',_0xa9babe,JSON['stringify'](_0xa3164a));_0x2b6b0e(_0xa3164a);})['catch'](function(_0x364e17){logger[_0x61f6('0x13')](_0x61f6('0x18'),_0x364e17[_0x61f6('0x15')],_0xa9babe);_0x283265(_0x4a0dd1[_0x61f6('0x13')](0x1f4,_0x364e17[_0x61f6('0x15')]));});});};exports['ShowVoiceQueue']=function(_0x3b994f){var _0x213627=this;return new Promise(function(_0x2ff9c9,_0x230f62){return db[_0x61f6('0x19')][_0x61f6('0x23')]({'raw':_0x3b994f['options']?_0x3b994f['options'][_0x61f6('0x1c')]===undefined?!![]:![]:!![],'where':_0x3b994f['options']?_0x3b994f[_0x61f6('0x1b')][_0x61f6('0x1d')]||null:null,'attributes':_0x3b994f[_0x61f6('0x1b')]?_0x3b994f['options'][_0x61f6('0x1e')]||null:null,'include':_0x3b994f[_0x61f6('0x1b')]?_0x3b994f[_0x61f6('0x1b')][_0x61f6('0x20')]?_[_0x61f6('0x22')](_0x3b994f[_0x61f6('0x1b')][_0x61f6('0x20')],function(_0x5937d7){return{'model':db[_0x5937d7[_0x61f6('0x21')]],'as':_0x5937d7['as'],'attributes':_0x5937d7['attributes'],'include':_0x5937d7[_0x61f6('0x20')]?_[_0x61f6('0x22')](_0x5937d7[_0x61f6('0x20')],function(_0x51011d){return{'model':db[_0x51011d['model']],'as':_0x51011d['as'],'attributes':_0x51011d['attributes'],'include':_0x51011d[_0x61f6('0x20')]?_['map'](_0x51011d[_0x61f6('0x20')],function(_0x66a207){return{'model':db[_0x66a207[_0x61f6('0x21')]],'as':_0x66a207['as'],'attributes':_0x66a207[_0x61f6('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x61f6('0xc')](function(_0x32c115){logger[_0x61f6('0xd')](_0x61f6('0x24'),_0x3b994f);logger['debug'](_0x61f6('0x24'),_0x3b994f,JSON['stringify'](_0x32c115));_0x2ff9c9(_0x32c115);})['catch'](function(_0x419207){logger[_0x61f6('0x13')](_0x61f6('0x24'),_0x419207[_0x61f6('0x15')],_0x3b994f);_0x230f62(_0x213627[_0x61f6('0x13')](0x1f4,_0x419207[_0x61f6('0x15')]));});});}; \ No newline at end of file +var _0xd8de=['debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceQueue','findAll','options','where','attributes','limit','include','map','model','GetVoiceQueue','ShowVoiceQueue','find','raw','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','redis','./voiceQueue.socket','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x25683f,_0x4c732a){var _0x1c5f7b=function(_0x3ae9f8){while(--_0x3ae9f8){_0x25683f['push'](_0x25683f['shift']());}};_0x1c5f7b(++_0x4c732a);}(_0xd8de,0xf3));var _0xed8d=function(_0xc6a0a3,_0x2b2b99){_0xc6a0a3=_0xc6a0a3-0x0;var _0x5eaee8=_0xd8de[_0xc6a0a3];return _0x5eaee8;};'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(_0xed8d('0x0'));var db=require(_0xed8d('0x1'))['db'];var utils=require(_0xed8d('0x2'));var logger=require('../../config/logger')(_0xed8d('0x3'));var config=require(_0xed8d('0x4'));var jayson=require(_0xed8d('0x5'));var client=jayson['client'][_0xed8d('0x6')]({'port':0x232a});config['redis']=_[_0xed8d('0x7')](config['redis'],{'host':_0xed8d('0x8'),'port':0x18eb});var socket=require(_0xed8d('0x9'))(new Redis(config[_0xed8d('0xa')]));require(_0xed8d('0xb'))['register'](socket);function respondWithRpcPromise(_0x534c42,_0x4d44a0,_0x51ee46){return new BPromise(function(_0x2b8ac8,_0xbd5a4){return client['request'](_0x534c42,_0x51ee46)[_0xed8d('0xc')](function(_0x58065a){logger[_0xed8d('0xd')](_0xed8d('0xe'),_0x4d44a0,_0xed8d('0xf'));logger[_0xed8d('0x10')](_0xed8d('0x11'),_0x4d44a0,'request\x20sent',JSON[_0xed8d('0x12')](_0x58065a));if(_0x58065a[_0xed8d('0x13')]){if(_0x58065a['error'][_0xed8d('0x14')]===0x1f4){logger['error'](_0xed8d('0xe'),_0x4d44a0,_0x58065a['error'][_0xed8d('0x15')]);return _0xbd5a4(_0x58065a[_0xed8d('0x13')][_0xed8d('0x15')]);}logger['error'](_0xed8d('0xe'),_0x4d44a0,_0x58065a['error'][_0xed8d('0x15')]);return _0x2b8ac8(_0x58065a['error']['message']);}else{logger[_0xed8d('0xd')](_0xed8d('0xe'),_0x4d44a0,_0xed8d('0xf'));_0x2b8ac8(_0x58065a[_0xed8d('0x16')]['message']);}})[_0xed8d('0x17')](function(_0x5d52d1){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x4d44a0,_0x5d52d1);_0xbd5a4(_0x5d52d1);});});}exports['GetVoiceQueue']=function(_0x41776e){var _0x4c5d4f=this;return new Promise(function(_0x553232,_0x14bb68){return db[_0xed8d('0x18')][_0xed8d('0x19')]({'raw':_0x41776e[_0xed8d('0x1a')]?_0x41776e[_0xed8d('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x41776e[_0xed8d('0x1a')]?_0x41776e[_0xed8d('0x1a')][_0xed8d('0x1b')]||null:null,'attributes':_0x41776e['options']?_0x41776e[_0xed8d('0x1a')][_0xed8d('0x1c')]||null:null,'limit':_0x41776e['options']?_0x41776e[_0xed8d('0x1a')][_0xed8d('0x1d')]||null:null,'include':_0x41776e[_0xed8d('0x1a')]?_0x41776e[_0xed8d('0x1a')][_0xed8d('0x1e')]?_[_0xed8d('0x1f')](_0x41776e['options'][_0xed8d('0x1e')],function(_0x2a1ae1){return{'model':db[_0x2a1ae1[_0xed8d('0x20')]],'as':_0x2a1ae1['as'],'attributes':_0x2a1ae1['attributes'],'include':_0x2a1ae1['include']?_[_0xed8d('0x1f')](_0x2a1ae1[_0xed8d('0x1e')],function(_0x2970e3){return{'model':db[_0x2970e3[_0xed8d('0x20')]],'as':_0x2970e3['as'],'attributes':_0x2970e3['attributes'],'include':_0x2970e3['include']?_['map'](_0x2970e3[_0xed8d('0x1e')],function(_0x331904){return{'model':db[_0x331904['model']],'as':_0x331904['as'],'attributes':_0x331904[_0xed8d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xed8d('0xc')](function(_0x52164a){logger[_0xed8d('0xd')](_0xed8d('0x21'),_0x41776e);logger[_0xed8d('0x10')](_0xed8d('0x21'),_0x41776e,JSON[_0xed8d('0x12')](_0x52164a));_0x553232(_0x52164a);})[_0xed8d('0x17')](function(_0x4d0254){logger[_0xed8d('0x13')]('GetVoiceQueue',_0x4d0254[_0xed8d('0x15')],_0x41776e);_0x14bb68(_0x4c5d4f[_0xed8d('0x13')](0x1f4,_0x4d0254[_0xed8d('0x15')]));});});};exports[_0xed8d('0x22')]=function(_0x3c8115){var _0x3d0c8b=this;return new Promise(function(_0x118c5b,_0x3d37f8){return db['VoiceQueue'][_0xed8d('0x23')]({'raw':_0x3c8115[_0xed8d('0x1a')]?_0x3c8115[_0xed8d('0x1a')][_0xed8d('0x24')]===undefined?!![]:![]:!![],'where':_0x3c8115[_0xed8d('0x1a')]?_0x3c8115[_0xed8d('0x1a')][_0xed8d('0x1b')]||null:null,'attributes':_0x3c8115['options']?_0x3c8115[_0xed8d('0x1a')][_0xed8d('0x1c')]||null:null,'include':_0x3c8115['options']?_0x3c8115[_0xed8d('0x1a')][_0xed8d('0x1e')]?_[_0xed8d('0x1f')](_0x3c8115[_0xed8d('0x1a')]['include'],function(_0x4345cb){return{'model':db[_0x4345cb['model']],'as':_0x4345cb['as'],'attributes':_0x4345cb['attributes'],'include':_0x4345cb[_0xed8d('0x1e')]?_[_0xed8d('0x1f')](_0x4345cb['include'],function(_0x1c2eb4){return{'model':db[_0x1c2eb4[_0xed8d('0x20')]],'as':_0x1c2eb4['as'],'attributes':_0x1c2eb4[_0xed8d('0x1c')],'include':_0x1c2eb4[_0xed8d('0x1e')]?_['map'](_0x1c2eb4[_0xed8d('0x1e')],function(_0x177b39){return{'model':db[_0x177b39['model']],'as':_0x177b39['as'],'attributes':_0x177b39[_0xed8d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xed8d('0xc')](function(_0x16b5e6){logger[_0xed8d('0xd')]('ShowVoiceQueue',_0x3c8115);logger[_0xed8d('0x10')]('ShowVoiceQueue',_0x3c8115,JSON[_0xed8d('0x12')](_0x16b5e6));_0x118c5b(_0x16b5e6);})[_0xed8d('0x17')](function(_0x518681){logger[_0xed8d('0x13')](_0xed8d('0x22'),_0x518681[_0xed8d('0x15')],_0x3c8115);_0x3d37f8(_0x3d0c8b[_0xed8d('0x13')](0x1f4,_0x518681[_0xed8d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index f32f804..1f5e775 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 _0x3e12=['emit','register','length','./voiceQueue.events','save','remove'];(function(_0xffa198,_0x5a8940){var _0x1e4b50=function(_0x1f1c43){while(--_0x1f1c43){_0xffa198['push'](_0xffa198['shift']());}};_0x1e4b50(++_0x5a8940);}(_0x3e12,0x165));var _0x23e1=function(_0x44b3bd,_0x44c97d){_0x44b3bd=_0x44b3bd-0x0;var _0x1efc4a=_0x3e12[_0x44b3bd];return _0x1efc4a;};'use strict';var VoiceQueueEvents=require(_0x23e1('0x0'));var events=[_0x23e1('0x1'),_0x23e1('0x2'),'update'];function createListener(_0x3b4e91,_0x481df3){return function(_0xac2c7b){_0x481df3[_0x23e1('0x3')](_0x3b4e91,_0xac2c7b);};}function removeListener(_0x322c99,_0x10b10f){return function(){VoiceQueueEvents['removeListener'](_0x322c99,_0x10b10f);};}exports[_0x23e1('0x4')]=function(_0x3b1e17){for(var _0x32b728=0x0,_0x18c11c=events[_0x23e1('0x5')];_0x32b728<_0x18c11c;_0x32b728++){var _0x3db416=events[_0x32b728];var _0xe143e=createListener('voiceQueue:'+_0x3db416,_0x3b1e17);VoiceQueueEvents['on'](_0x3db416,_0xe143e);}}; \ No newline at end of file +var _0x2047=['register','length','voiceQueue:','save','remove','removeListener'];(function(_0x286bfb,_0x46ac3c){var _0x52b683=function(_0x3e7fb1){while(--_0x3e7fb1){_0x286bfb['push'](_0x286bfb['shift']());}};_0x52b683(++_0x46ac3c);}(_0x2047,0x8d));var _0x7204=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x2047[_0x13ea00];return _0x1f7347;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x7204('0x0'),_0x7204('0x1'),'update'];function createListener(_0xdc209c,_0x1847c4){return function(_0x3074ba){_0x1847c4['emit'](_0xdc209c,_0x3074ba);};}function removeListener(_0x5819eb,_0xbff9b3){return function(){VoiceQueueEvents[_0x7204('0x2')](_0x5819eb,_0xbff9b3);};}exports[_0x7204('0x3')]=function(_0x104737){for(var _0x24db7=0x0,_0x57e35f=events[_0x7204('0x4')];_0x24db7<_0x57e35f;_0x24db7++){var _0x1ec2a3=events[_0x24db7];var _0x1cdb1a=createListener(_0x7204('0x5')+_0x1ec2a3,_0x104737);VoiceQueueEvents['on'](_0x1ec2a3,_0x1cdb1a);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index d55d35b..c965aa8 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 _0x637a=['getVoiceQueuesReport','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/index'];(function(_0x39ada9,_0x25d549){var _0xc3f08e=function(_0x3b6a37){while(--_0x3b6a37){_0x39ada9['push'](_0x39ada9['shift']());}};_0xc3f08e(++_0x25d549);}(_0x637a,0xca));var _0xa637=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x637a[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0xa637('0x0'));var util=require(_0xa637('0x1'));var path=require(_0xa637('0x2'));var timeout=require(_0xa637('0x3'));var express=require(_0xa637('0x4'));var router=express[_0xa637('0x5')]();var fs_extra=require(_0xa637('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xa637('0x7'));var config=require('../../config/environment');var controller=require('./voiceQueueReport.controller');router[_0xa637('0x8')]('/',auth[_0xa637('0x9')](),controller[_0xa637('0xa')]);router[_0xa637('0x8')](_0xa637('0xb'),auth[_0xa637('0x9')](),controller[_0xa637('0xc')]);router[_0xa637('0x8')](_0xa637('0xd'),auth[_0xa637('0x9')](),controller[_0xa637('0xe')]);router[_0xa637('0x8')](_0xa637('0xf'),auth[_0xa637('0x9')](),controller[_0xa637('0x10')]);router[_0xa637('0x11')]('/',auth[_0xa637('0x9')](),controller[_0xa637('0x12')]);router[_0xa637('0x13')](_0xa637('0xf'),auth[_0xa637('0x9')](),controller[_0xa637('0x14')]);router[_0xa637('0x15')](_0xa637('0xf'),auth[_0xa637('0x9')](),controller[_0xa637('0x16')]);module[_0xa637('0x17')]=router; \ No newline at end of file +var _0xa4be=['../../components/auth/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated','index','describe','/index','getVoiceQueuesReport','get','/:id','post','create','update','destroy','multer','util','fs-extra'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xa4be,0xa7));var _0xea4b=function(_0x4ee7be,_0x22c019){_0x4ee7be=_0x4ee7be-0x0;var _0x97db86=_0xa4be[_0x4ee7be];return _0x97db86;};'use strict';var multer=require(_0xea4b('0x0'));var util=require(_0xea4b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xea4b('0x2'));var auth=require(_0xea4b('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xea4b('0x4'));var controller=require(_0xea4b('0x5'));router['get']('/',auth[_0xea4b('0x6')](),controller[_0xea4b('0x7')]);router['get']('/describe',auth[_0xea4b('0x6')](),controller[_0xea4b('0x8')]);router['get'](_0xea4b('0x9'),auth[_0xea4b('0x6')](),controller[_0xea4b('0xa')]);router[_0xea4b('0xb')](_0xea4b('0xc'),auth[_0xea4b('0x6')](),controller['show']);router[_0xea4b('0xd')]('/',auth[_0xea4b('0x6')](),controller[_0xea4b('0xe')]);router['put'](_0xea4b('0xc'),auth[_0xea4b('0x6')](),controller[_0xea4b('0xf')]);router['delete'](_0xea4b('0xc'),auth[_0xea4b('0x6')](),controller[_0xea4b('0x10')]);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 7f1ded3..fe49d3f 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 _0x3f7f=['queuecallerleaveAt','setDataValue','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','diff','seconds'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3f7f,0xd6));var _0xf3f7=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x3f7f[_0x580576];return _0x3f55a0;};'use strict';var Sequelize=require(_0xf3f7('0x0'));var moment=require(_0xf3f7('0x1'));module[_0xf3f7('0x2')]={'type':{'type':Sequelize[_0xf3f7('0x3')]},'uniqueid':{'type':Sequelize[_0xf3f7('0x3')]},'calleridnum':{'type':Sequelize[_0xf3f7('0x3')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xf3f7('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0xf3f7('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0xf3f7('0x4')],'set':function(_0x2a04bc){var _0x14fbbd=moment(_0x2a04bc);var _0x3a7863=moment(this[_0xf3f7('0x5')](_0xf3f7('0x6')))['format'](_0xf3f7('0x7'));var _0x39c0d7=_0x14fbbd[_0xf3f7('0x8')](_0x3a7863,_0xf3f7('0x9'));this['setDataValue'](_0xf3f7('0xa'),_0x2a04bc);this[_0xf3f7('0xb')]('holdtime',_0x39c0d7||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xf3f7('0x4')]},'queuecallerexit':{'type':Sequelize[_0xf3f7('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xf3f7('0x4')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0xf3f7('0xd')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0xf3f7('0x3')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xf3f7('0x3')]},'accountcode':{'type':Sequelize[_0xf3f7('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xf3f7('0x3')]},'priority':{'type':Sequelize[_0xf3f7('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xf3f7('0xe')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xf3f7('0x3')]},'transfer':{'type':Sequelize[_0xf3f7('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xf3f7('0x3')],'comment':_0xf3f7('0xf')},'transferexten':{'type':Sequelize[_0xf3f7('0x3')]},'transferuniqueid':{'type':Sequelize[_0xf3f7('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xf3f7('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0xf3f7('0xe')],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd6ac=['BOOLEAN','DATE','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','STRING','format','diff','setDataValue','holdtime','INTEGER'];(function(_0x4ff596,_0x3210c3){var _0x1a0c8b=function(_0x3bd519){while(--_0x3bd519){_0x4ff596['push'](_0x4ff596['shift']());}};_0x1a0c8b(++_0x3210c3);}(_0xd6ac,0x111));var _0xcd6a=function(_0x117ad0,_0x395fee){_0x117ad0=_0x117ad0-0x0;var _0x20f1b7=_0xd6ac[_0x117ad0];return _0x20f1b7;};'use strict';var Sequelize=require(_0xcd6a('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0xcd6a('0x1')]},'uniqueid':{'type':Sequelize[_0xcd6a('0x1')]},'calleridnum':{'type':Sequelize[_0xcd6a('0x1')]},'calleridname':{'type':Sequelize[_0xcd6a('0x1')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x2f4811){var _0x12a4a0=moment(_0x2f4811);var _0x1f38ac=moment(this['getDataValue']('queuecallerjoinAt'))[_0xcd6a('0x2')]('YYYY-MM-DD\x20HH:mm:ss');var _0x247e47=_0x12a4a0[_0xcd6a('0x3')](_0x1f38ac,'seconds');this[_0xcd6a('0x4')]('queuecallerleaveAt',_0x2f4811);this['setDataValue'](_0xcd6a('0x5'),_0x247e47||null);}},'position':{'type':Sequelize[_0xcd6a('0x6')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0xcd6a('0x7')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0xcd6a('0x7')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xcd6a('0x8')]},'queuecallerexit':{'type':Sequelize[_0xcd6a('0x7')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xcd6a('0x8')]},'queuecallerexitreason':{'type':Sequelize[_0xcd6a('0x1')],'comment':_0xcd6a('0x9')},'originalposition':{'type':Sequelize[_0xcd6a('0x6')]},'channel':{'type':Sequelize[_0xcd6a('0x1')]},'connectedlinenum':{'type':Sequelize[_0xcd6a('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xcd6a('0x1')]},'context':{'type':Sequelize[_0xcd6a('0x1')]},'exten':{'type':Sequelize[_0xcd6a('0x1')]},'priority':{'type':Sequelize[_0xcd6a('0x1')]},'holdtime':{'type':Sequelize[_0xcd6a('0x6')]},'mohtime':{'type':Sequelize[_0xcd6a('0x6')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xcd6a('0x7')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xcd6a('0x1')]},'transfer':{'type':Sequelize[_0xcd6a('0x7')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xcd6a('0x1')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xcd6a('0x1')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xcd6a('0x1')]},'thirdDisposition':{'type':Sequelize[_0xcd6a('0x1')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize[_0xcd6a('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index adca892..1f8ac78 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 _0xa011=['fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','update','destroy','error','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','then','includeAll','include','VoiceQueueReport','findAll','rows','params','length','find','catch','create','body','describe','getVoiceQueuesReport','order','pick','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x2ba3ee,_0x34a4a1){var _0x572417=function(_0x41bf37){while(--_0x41bf37){_0x2ba3ee['push'](_0x2ba3ee['shift']());}};_0x572417(++_0x34a4a1);}(_0xa011,0x135));var _0x1a01=function(_0x12805e,_0x1fb6c9){_0x12805e=_0x12805e-0x0;var _0x57988b=_0xa011[_0x12805e];return _0x57988b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1a01('0x0'));var zipdir=require(_0x1a01('0x1'));var jsonpatch=require(_0x1a01('0x2'));var rp=require(_0x1a01('0x3'));var moment=require('moment');var BPromise=require(_0x1a01('0x4'));var Mustache=require(_0x1a01('0x5'));var util=require(_0x1a01('0x6'));var path=require(_0x1a01('0x7'));var sox=require(_0x1a01('0x8'));var csv=require(_0x1a01('0x9'));var ejs=require(_0x1a01('0xa'));var fs=require('fs');var fs_extra=require(_0x1a01('0xb'));var _=require(_0x1a01('0xc'));var squel=require(_0x1a01('0xd'));var crypto=require(_0x1a01('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x1a01('0xf'));var toCsv=require(_0x1a01('0x9'));var querystring=require(_0x1a01('0x10'));var Papa=require(_0x1a01('0x11'));var Redis=require('ioredis');var authService=require(_0x1a01('0x12'));var qs=require(_0x1a01('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1a01('0x14'))(_0x1a01('0x15'));var utils=require(_0x1a01('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x1a01('0x17'));var db=require('../../mysqldb')['db'];config[_0x1a01('0x18')]=_[_0x1a01('0x19')](config['redis'],{'host':_0x1a01('0x1a'),'port':0x18eb});var socket=require(_0x1a01('0x1b'))(new Redis(config['redis']));require('./voiceQueueReport.socket')['register'](socket);function respondWithStatusCode(_0x329d46,_0x4a3411){_0x4a3411=_0x4a3411||0xcc;return function(_0x4f7967){if(_0x4f7967){return _0x329d46[_0x1a01('0x1c')](_0x4a3411);}return _0x329d46[_0x1a01('0x1d')](_0x4a3411)[_0x1a01('0x1e')]();};}function respondWithResult(_0x5cb265,_0x3b69ee){_0x3b69ee=_0x3b69ee||0xc8;return function(_0x24a95a){if(_0x24a95a){return _0x5cb265[_0x1a01('0x1d')](_0x3b69ee)['json'](_0x24a95a);}};}function respondWithFilteredResult(_0x1cc548,_0x1b20bc){return function(_0x3045aa){if(_0x3045aa){var _0x4331d3=typeof _0x1b20bc['offset']===_0x1a01('0x1f')&&typeof _0x1b20bc[_0x1a01('0x20')]===_0x1a01('0x1f');var _0x12af25=_0x3045aa[_0x1a01('0x21')];var _0x733bc=_0x4331d3?0x0:_0x1b20bc[_0x1a01('0x22')];var _0x10aed3=_0x4331d3?_0x3045aa['count']:_0x1b20bc[_0x1a01('0x22')]+_0x1b20bc[_0x1a01('0x20')];var _0x2a8b13;if(_0x10aed3>=_0x12af25){_0x10aed3=_0x12af25;_0x2a8b13=0xc8;}else{_0x2a8b13=0xce;}_0x1cc548[_0x1a01('0x1d')](_0x2a8b13);return _0x1cc548['set'](_0x1a01('0x23'),_0x733bc+'-'+_0x10aed3+'/'+_0x12af25)[_0x1a01('0x24')](_0x3045aa);}return null;};}function patchUpdates(_0x1e9bdb){return function(_0x8d2d1f){try{jsonpatch[_0x1a01('0x25')](_0x8d2d1f,_0x1e9bdb,!![]);}catch(_0x32aa78){return BPromise[_0x1a01('0x26')](_0x32aa78);}return _0x8d2d1f['save']();};}function saveUpdates(_0x16b44d,_0x275f26){return function(_0x28f9c6){if(_0x28f9c6){return _0x28f9c6[_0x1a01('0x27')](_0x16b44d)['then'](function(_0x2189d9){return _0x2189d9;});}return null;};}function removeEntity(_0x4a1f09,_0xaea196){return function(_0x5be8df){if(_0x5be8df){return _0x5be8df[_0x1a01('0x28')]()['then'](function(){_0x4a1f09[_0x1a01('0x1d')](0xcc)[_0x1a01('0x1e')]();});}};}function handleEntityNotFound(_0xf7ff05,_0x430e39){return function(_0x5d1f7a){if(!_0x5d1f7a){_0xf7ff05[_0x1a01('0x1c')](0x194);}return _0x5d1f7a;};}function handleError(_0xcb77ec,_0x4c9e7b){_0x4c9e7b=_0x4c9e7b||0x1f4;return function(_0x302078){logger[_0x1a01('0x29')](_0x302078['stack']);if(_0x302078['name']){delete _0x302078[_0x1a01('0x2a')];}_0xcb77ec[_0x1a01('0x1d')](_0x4c9e7b)[_0x1a01('0x2b')](_0x302078);};}exports[_0x1a01('0x2c')]=function(_0x5399ed,_0x4cd794){var _0x338518={},_0x6b815a={},_0x6ec6c7={'count':0x0,'rows':[]};var _0xf5d4bf=_[_0x1a01('0x2d')](db['VoiceQueueReport'][_0x1a01('0x2e')],function(_0x276664){return{'name':_0x276664[_0x1a01('0x2f')],'type':_0x276664[_0x1a01('0x30')]['key']};});_0x6b815a[_0x1a01('0x31')]=_[_0x1a01('0x2d')](_0xf5d4bf,'name');_0x6b815a[_0x1a01('0x32')]=_[_0x1a01('0x33')](_0x5399ed[_0x1a01('0x32')]);_0x6b815a[_0x1a01('0x34')]=_['intersection'](_0x6b815a[_0x1a01('0x31')],_0x6b815a['query']);_0x338518[_0x1a01('0x35')]=_[_0x1a01('0x36')](_0x6b815a[_0x1a01('0x31')],qs[_0x1a01('0x37')](_0x5399ed[_0x1a01('0x32')][_0x1a01('0x37')]));_0x338518[_0x1a01('0x35')]=_0x338518[_0x1a01('0x35')]['length']?_0x338518[_0x1a01('0x35')]:_0x6b815a[_0x1a01('0x31')];if(!_0x5399ed['query'][_0x1a01('0x38')](_0x1a01('0x39'))){_0x338518[_0x1a01('0x20')]=qs[_0x1a01('0x20')](_0x5399ed[_0x1a01('0x32')][_0x1a01('0x20')]);_0x338518[_0x1a01('0x22')]=qs[_0x1a01('0x22')](_0x5399ed[_0x1a01('0x32')][_0x1a01('0x22')]);}_0x338518['order']=qs[_0x1a01('0x3a')](_0x5399ed[_0x1a01('0x32')][_0x1a01('0x3a')]);_0x338518[_0x1a01('0x3b')]=qs[_0x1a01('0x34')](_['pick'](_0x5399ed[_0x1a01('0x32')],_0x6b815a[_0x1a01('0x34')]),_0xf5d4bf);if(_0x5399ed[_0x1a01('0x32')][_0x1a01('0x3c')]){_0x338518[_0x1a01('0x3b')]=_[_0x1a01('0x3d')](_0x338518['where'],{'$or':_['map'](_0xf5d4bf,function(_0x595808){if(_0x595808[_0x1a01('0x30')]!==_0x1a01('0x3e')){var _0x2619d2={};_0x2619d2[_0x595808['name']]={'$like':'%'+_0x5399ed['query']['filter']+'%'};return _0x2619d2;}})});}_0x338518=_['merge']({},_0x338518,_0x5399ed[_0x1a01('0x3f')]);var _0x1ef4dc={'where':_0x338518['where']};return db['VoiceQueueReport'][_0x1a01('0x21')](_0x1ef4dc)[_0x1a01('0x40')](function(_0x25d97e){_0x6ec6c7[_0x1a01('0x21')]=_0x25d97e;if(_0x5399ed['query'][_0x1a01('0x41')]){_0x338518[_0x1a01('0x42')]=[{'all':!![]}];}return db[_0x1a01('0x43')][_0x1a01('0x44')](_0x338518);})[_0x1a01('0x40')](function(_0x278099){_0x6ec6c7[_0x1a01('0x45')]=_0x278099;return _0x6ec6c7;})[_0x1a01('0x40')](respondWithFilteredResult(_0x4cd794,_0x338518))['catch'](handleError(_0x4cd794,null));};exports['show']=function(_0x3adfe3,_0x525016){var _0x13706c={'raw':![],'where':{'id':_0x3adfe3[_0x1a01('0x46')]['id']}},_0x34947d={};_0x34947d[_0x1a01('0x31')]=_[_0x1a01('0x33')](db['VoiceQueueReport'][_0x1a01('0x2e')]);_0x34947d[_0x1a01('0x32')]=_[_0x1a01('0x33')](_0x3adfe3[_0x1a01('0x32')]);_0x34947d['filters']=_['intersection'](_0x34947d[_0x1a01('0x31')],_0x34947d[_0x1a01('0x32')]);_0x13706c['attributes']=_[_0x1a01('0x36')](_0x34947d['model'],qs[_0x1a01('0x37')](_0x3adfe3[_0x1a01('0x32')][_0x1a01('0x37')]));_0x13706c['attributes']=_0x13706c[_0x1a01('0x35')][_0x1a01('0x47')]?_0x13706c[_0x1a01('0x35')]:_0x34947d['model'];if(_0x3adfe3['query'][_0x1a01('0x41')]){_0x13706c[_0x1a01('0x42')]=[{'all':!![]}];}_0x13706c=_[_0x1a01('0x3d')]({},_0x13706c,_0x3adfe3[_0x1a01('0x3f')]);return db[_0x1a01('0x43')][_0x1a01('0x48')](_0x13706c)[_0x1a01('0x40')](handleEntityNotFound(_0x525016,null))['then'](respondWithResult(_0x525016,null))[_0x1a01('0x49')](handleError(_0x525016,null));};exports[_0x1a01('0x4a')]=function(_0xca12f8,_0x2c8127){return db[_0x1a01('0x43')]['create'](_0xca12f8[_0x1a01('0x4b')],{})[_0x1a01('0x40')](respondWithResult(_0x2c8127,0xc9))['catch'](handleError(_0x2c8127,null));};exports[_0x1a01('0x27')]=function(_0x2d78ac,_0x2c1b28){if(_0x2d78ac[_0x1a01('0x4b')]['id']){delete _0x2d78ac[_0x1a01('0x4b')]['id'];}return db['VoiceQueueReport'][_0x1a01('0x48')]({'where':{'id':_0x2d78ac['params']['id']}})['then'](handleEntityNotFound(_0x2c1b28,null))['then'](saveUpdates(_0x2d78ac['body'],null))['then'](respondWithResult(_0x2c1b28,null))['catch'](handleError(_0x2c1b28,null));};exports[_0x1a01('0x28')]=function(_0x1ed273,_0x7f5ed9){return db[_0x1a01('0x43')][_0x1a01('0x48')]({'where':{'id':_0x1ed273[_0x1a01('0x46')]['id']}})[_0x1a01('0x40')](handleEntityNotFound(_0x7f5ed9,null))[_0x1a01('0x40')](removeEntity(_0x7f5ed9,null))[_0x1a01('0x49')](handleError(_0x7f5ed9,null));};exports[_0x1a01('0x4c')]=function(_0x1f6281,_0x532848){return db[_0x1a01('0x43')]['describe']()['then'](respondWithResult(_0x532848,null))[_0x1a01('0x49')](handleError(_0x532848,null));};exports[_0x1a01('0x4d')]=function(_0x2930c6,_0x4e8707){var _0x360530={},_0x15c49b={},_0x3e9491={'count':0x0,'rows':[]};_0x15c49b[_0x1a01('0x31')]=_[_0x1a01('0x33')](db[_0x1a01('0x43')][_0x1a01('0x2e')]);_0x15c49b[_0x1a01('0x32')]=_[_0x1a01('0x33')](_0x2930c6['query']);_0x15c49b['filters']=_[_0x1a01('0x36')](_0x15c49b['model'],_0x15c49b['query']);_0x360530['attributes']=_['intersection'](_0x15c49b[_0x1a01('0x31')],qs[_0x1a01('0x37')](_0x2930c6[_0x1a01('0x32')][_0x1a01('0x37')]));_0x360530[_0x1a01('0x35')]=_0x360530[_0x1a01('0x35')][_0x1a01('0x47')]?_0x360530[_0x1a01('0x35')]:_0x15c49b[_0x1a01('0x31')];if(!_0x2930c6['query']['hasOwnProperty']('nolimit')){_0x360530['limit']=qs[_0x1a01('0x20')](_0x2930c6[_0x1a01('0x32')][_0x1a01('0x20')]);_0x360530[_0x1a01('0x22')]=qs[_0x1a01('0x22')](_0x2930c6[_0x1a01('0x32')][_0x1a01('0x22')]);}_0x360530[_0x1a01('0x4e')]=qs['sort'](_0x2930c6[_0x1a01('0x32')][_0x1a01('0x3a')]);_0x360530['where']=qs[_0x1a01('0x34')](_[_0x1a01('0x4f')](_0x2930c6[_0x1a01('0x32')],_0x15c49b[_0x1a01('0x34')]));if(_0x2930c6[_0x1a01('0x32')]['filter']){_0x360530[_0x1a01('0x3b')]=_['merge'](_0x360530[_0x1a01('0x3b')],{'$or':_[_0x1a01('0x2d')](_0x360530[_0x1a01('0x35')],function(_0x456794){var _0x542c4f={};_0x542c4f[_0x456794]={'$like':'%'+_0x2930c6[_0x1a01('0x32')][_0x1a01('0x3c')]+'%'};return _0x542c4f;})});}_0x360530=_[_0x1a01('0x3d')]({},_0x360530,_0x2930c6[_0x1a01('0x3f')]);var _0xf59fd2={'where':_0x360530[_0x1a01('0x3b')]};return db['VoiceQueueReport']['count'](_0xf59fd2)['then'](function(_0x572150){_0x3e9491[_0x1a01('0x21')]=_0x572150;if(_0x2930c6[_0x1a01('0x32')][_0x1a01('0x41')]){_0x360530['include']=[{'all':!![]}];}return db[_0x1a01('0x43')]['findAll'](_0x360530);})[_0x1a01('0x40')](function(_0x449461){_0x3e9491['rows']=_0x449461;return _0x3e9491;})[_0x1a01('0x40')](respondWithFilteredResult(_0x4e8707,_0x360530,_0x1a01('0x4d')))[_0x1a01('0x49')](handleError(_0x4e8707,null,_0x1a01('0x4d')));}; \ No newline at end of file +var _0x4209=['params','describe','hasOwnProperty','include','getVoiceQueuesReport','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','sendStatus','error','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','options','includeAll','findAll','rows','catch','show','find','create','body'];(function(_0x9d86e5,_0x5ee78f){var _0x461d8e=function(_0x52ccb5){while(--_0x52ccb5){_0x9d86e5['push'](_0x9d86e5['shift']());}};_0x461d8e(++_0x5ee78f);}(_0x4209,0xa9));var _0x9420=function(_0x549278,_0x450754){_0x549278=_0x549278-0x0;var _0x1ea9a1=_0x4209[_0x549278];return _0x1ea9a1;};'use strict';var emlformat=require(_0x9420('0x0'));var rimraf=require(_0x9420('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9420('0x2'));var rp=require(_0x9420('0x3'));var moment=require(_0x9420('0x4'));var BPromise=require(_0x9420('0x5'));var Mustache=require('mustache');var util=require(_0x9420('0x6'));var path=require(_0x9420('0x7'));var sox=require(_0x9420('0x8'));var csv=require(_0x9420('0x9'));var ejs=require(_0x9420('0xa'));var fs=require('fs');var fs_extra=require(_0x9420('0xb'));var _=require(_0x9420('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9420('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9420('0xe'));var Papa=require(_0x9420('0xf'));var Redis=require(_0x9420('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9420('0x11'));var as=require(_0x9420('0x12'));var hardwareService=require(_0x9420('0x13'));var logger=require('../../config/logger')(_0x9420('0x14'));var utils=require(_0x9420('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x9420('0x16'));var db=require(_0x9420('0x17'))['db'];config[_0x9420('0x18')]=_[_0x9420('0x19')](config[_0x9420('0x18')],{'host':_0x9420('0x1a'),'port':0x18eb});var socket=require(_0x9420('0x1b'))(new Redis(config[_0x9420('0x18')]));require('./voiceQueueReport.socket')[_0x9420('0x1c')](socket);function respondWithStatusCode(_0x91a58f,_0x534990){_0x534990=_0x534990||0xcc;return function(_0x546d86){if(_0x546d86){return _0x91a58f['sendStatus'](_0x534990);}return _0x91a58f[_0x9420('0x1d')](_0x534990)[_0x9420('0x1e')]();};}function respondWithResult(_0x4a3dae,_0x3d8de6){_0x3d8de6=_0x3d8de6||0xc8;return function(_0x5458f4){if(_0x5458f4){return _0x4a3dae['status'](_0x3d8de6)['json'](_0x5458f4);}};}function respondWithFilteredResult(_0x4b41d4,_0x208c82){return function(_0x2261e4){if(_0x2261e4){var _0x1f0f3b=typeof _0x208c82[_0x9420('0x1f')]===_0x9420('0x20')&&typeof _0x208c82[_0x9420('0x21')]===_0x9420('0x20');var _0x1441c9=_0x2261e4[_0x9420('0x22')];var _0x35d948=_0x1f0f3b?0x0:_0x208c82[_0x9420('0x1f')];var _0x10ddb5=_0x1f0f3b?_0x2261e4[_0x9420('0x22')]:_0x208c82[_0x9420('0x1f')]+_0x208c82[_0x9420('0x21')];var _0x40c5d6;if(_0x10ddb5>=_0x1441c9){_0x10ddb5=_0x1441c9;_0x40c5d6=0xc8;}else{_0x40c5d6=0xce;}_0x4b41d4[_0x9420('0x1d')](_0x40c5d6);return _0x4b41d4[_0x9420('0x23')](_0x9420('0x24'),_0x35d948+'-'+_0x10ddb5+'/'+_0x1441c9)[_0x9420('0x25')](_0x2261e4);}return null;};}function patchUpdates(_0x561963){return function(_0x3d5394){try{jsonpatch[_0x9420('0x26')](_0x3d5394,_0x561963,!![]);}catch(_0x23b343){return BPromise[_0x9420('0x27')](_0x23b343);}return _0x3d5394[_0x9420('0x28')]();};}function saveUpdates(_0x18a094,_0x4604e6){return function(_0x5c2417){if(_0x5c2417){return _0x5c2417[_0x9420('0x29')](_0x18a094)[_0x9420('0x2a')](function(_0xf5ac0e){return _0xf5ac0e;});}return null;};}function removeEntity(_0x4fbab9,_0x1419b0){return function(_0x1fe113){if(_0x1fe113){return _0x1fe113['destroy']()[_0x9420('0x2a')](function(){_0x4fbab9[_0x9420('0x1d')](0xcc)[_0x9420('0x1e')]();});}};}function handleEntityNotFound(_0x49b06b,_0x49de5c){return function(_0x3b7342){if(!_0x3b7342){_0x49b06b[_0x9420('0x2b')](0x194);}return _0x3b7342;};}function handleError(_0x3cfc1c,_0x59a72a){_0x59a72a=_0x59a72a||0x1f4;return function(_0x5d95c3){logger[_0x9420('0x2c')](_0x5d95c3['stack']);if(_0x5d95c3[_0x9420('0x2d')]){delete _0x5d95c3['name'];}_0x3cfc1c['status'](_0x59a72a)[_0x9420('0x2e')](_0x5d95c3);};}exports[_0x9420('0x2f')]=function(_0x5e9d8b,_0x19952c){var _0x332640={},_0x3038af={},_0x175a29={'count':0x0,'rows':[]};var _0xe49438=_[_0x9420('0x30')](db[_0x9420('0x31')][_0x9420('0x32')],function(_0x37e95a){return{'name':_0x37e95a[_0x9420('0x33')],'type':_0x37e95a['type'][_0x9420('0x34')]};});_0x3038af[_0x9420('0x35')]=_[_0x9420('0x30')](_0xe49438,_0x9420('0x2d'));_0x3038af[_0x9420('0x36')]=_[_0x9420('0x37')](_0x5e9d8b[_0x9420('0x36')]);_0x3038af[_0x9420('0x38')]=_[_0x9420('0x39')](_0x3038af[_0x9420('0x35')],_0x3038af['query']);_0x332640['attributes']=_['intersection'](_0x3038af['model'],qs[_0x9420('0x3a')](_0x5e9d8b[_0x9420('0x36')][_0x9420('0x3a')]));_0x332640[_0x9420('0x3b')]=_0x332640['attributes'][_0x9420('0x3c')]?_0x332640['attributes']:_0x3038af[_0x9420('0x35')];if(!_0x5e9d8b['query']['hasOwnProperty'](_0x9420('0x3d'))){_0x332640[_0x9420('0x21')]=qs[_0x9420('0x21')](_0x5e9d8b[_0x9420('0x36')][_0x9420('0x21')]);_0x332640[_0x9420('0x1f')]=qs[_0x9420('0x1f')](_0x5e9d8b[_0x9420('0x36')][_0x9420('0x1f')]);}_0x332640[_0x9420('0x3e')]=qs[_0x9420('0x3f')](_0x5e9d8b[_0x9420('0x36')][_0x9420('0x3f')]);_0x332640['where']=qs[_0x9420('0x38')](_[_0x9420('0x40')](_0x5e9d8b['query'],_0x3038af[_0x9420('0x38')]),_0xe49438);if(_0x5e9d8b[_0x9420('0x36')][_0x9420('0x41')]){_0x332640[_0x9420('0x42')]=_[_0x9420('0x43')](_0x332640['where'],{'$or':_[_0x9420('0x30')](_0xe49438,function(_0x48305c){if(_0x48305c['type']!=='VIRTUAL'){var _0x3209d7={};_0x3209d7[_0x48305c['name']]={'$like':'%'+_0x5e9d8b['query'][_0x9420('0x41')]+'%'};return _0x3209d7;}})});}_0x332640=_['merge']({},_0x332640,_0x5e9d8b[_0x9420('0x44')]);var _0xcbb997={'where':_0x332640['where']};return db[_0x9420('0x31')]['count'](_0xcbb997)[_0x9420('0x2a')](function(_0xaee3){_0x175a29[_0x9420('0x22')]=_0xaee3;if(_0x5e9d8b['query'][_0x9420('0x45')]){_0x332640['include']=[{'all':!![]}];}return db[_0x9420('0x31')][_0x9420('0x46')](_0x332640);})[_0x9420('0x2a')](function(_0x37d78a){_0x175a29[_0x9420('0x47')]=_0x37d78a;return _0x175a29;})['then'](respondWithFilteredResult(_0x19952c,_0x332640))[_0x9420('0x48')](handleError(_0x19952c,null));};exports[_0x9420('0x49')]=function(_0x20374e,_0x4c61f5){var _0x2489a4={'raw':![],'where':{'id':_0x20374e['params']['id']}},_0x192bb5={};_0x192bb5[_0x9420('0x35')]=_[_0x9420('0x37')](db['VoiceQueueReport'][_0x9420('0x32')]);_0x192bb5['query']=_[_0x9420('0x37')](_0x20374e[_0x9420('0x36')]);_0x192bb5[_0x9420('0x38')]=_[_0x9420('0x39')](_0x192bb5[_0x9420('0x35')],_0x192bb5[_0x9420('0x36')]);_0x2489a4[_0x9420('0x3b')]=_['intersection'](_0x192bb5[_0x9420('0x35')],qs[_0x9420('0x3a')](_0x20374e['query'][_0x9420('0x3a')]));_0x2489a4[_0x9420('0x3b')]=_0x2489a4[_0x9420('0x3b')][_0x9420('0x3c')]?_0x2489a4[_0x9420('0x3b')]:_0x192bb5[_0x9420('0x35')];if(_0x20374e[_0x9420('0x36')]['includeAll']){_0x2489a4['include']=[{'all':!![]}];}_0x2489a4=_['merge']({},_0x2489a4,_0x20374e['options']);return db[_0x9420('0x31')][_0x9420('0x4a')](_0x2489a4)[_0x9420('0x2a')](handleEntityNotFound(_0x4c61f5,null))[_0x9420('0x2a')](respondWithResult(_0x4c61f5,null))['catch'](handleError(_0x4c61f5,null));};exports[_0x9420('0x4b')]=function(_0x4808cc,_0x38876f){return db[_0x9420('0x31')][_0x9420('0x4b')](_0x4808cc[_0x9420('0x4c')],{})[_0x9420('0x2a')](respondWithResult(_0x38876f,0xc9))[_0x9420('0x48')](handleError(_0x38876f,null));};exports[_0x9420('0x29')]=function(_0x4e6d1a,_0x4bb680){if(_0x4e6d1a[_0x9420('0x4c')]['id']){delete _0x4e6d1a[_0x9420('0x4c')]['id'];}return db[_0x9420('0x31')]['find']({'where':{'id':_0x4e6d1a[_0x9420('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4bb680,null))[_0x9420('0x2a')](saveUpdates(_0x4e6d1a[_0x9420('0x4c')],null))[_0x9420('0x2a')](respondWithResult(_0x4bb680,null))[_0x9420('0x48')](handleError(_0x4bb680,null));};exports['destroy']=function(_0x3120ad,_0x1fb25c){return db[_0x9420('0x31')][_0x9420('0x4a')]({'where':{'id':_0x3120ad['params']['id']}})[_0x9420('0x2a')](handleEntityNotFound(_0x1fb25c,null))[_0x9420('0x2a')](removeEntity(_0x1fb25c,null))[_0x9420('0x48')](handleError(_0x1fb25c,null));};exports[_0x9420('0x4e')]=function(_0x59118a,_0x473801){return db[_0x9420('0x31')]['describe']()[_0x9420('0x2a')](respondWithResult(_0x473801,null))['catch'](handleError(_0x473801,null));};exports['getVoiceQueuesReport']=function(_0xb4d24a,_0x390094){var _0x250ab5={},_0x2c15f0={},_0x3519a8={'count':0x0,'rows':[]};_0x2c15f0[_0x9420('0x35')]=_[_0x9420('0x37')](db[_0x9420('0x31')][_0x9420('0x32')]);_0x2c15f0[_0x9420('0x36')]=_[_0x9420('0x37')](_0xb4d24a[_0x9420('0x36')]);_0x2c15f0[_0x9420('0x38')]=_['intersection'](_0x2c15f0[_0x9420('0x35')],_0x2c15f0[_0x9420('0x36')]);_0x250ab5['attributes']=_['intersection'](_0x2c15f0['model'],qs[_0x9420('0x3a')](_0xb4d24a[_0x9420('0x36')][_0x9420('0x3a')]));_0x250ab5[_0x9420('0x3b')]=_0x250ab5[_0x9420('0x3b')][_0x9420('0x3c')]?_0x250ab5[_0x9420('0x3b')]:_0x2c15f0[_0x9420('0x35')];if(!_0xb4d24a[_0x9420('0x36')][_0x9420('0x4f')](_0x9420('0x3d'))){_0x250ab5[_0x9420('0x21')]=qs[_0x9420('0x21')](_0xb4d24a[_0x9420('0x36')][_0x9420('0x21')]);_0x250ab5['offset']=qs['offset'](_0xb4d24a[_0x9420('0x36')][_0x9420('0x1f')]);}_0x250ab5[_0x9420('0x3e')]=qs[_0x9420('0x3f')](_0xb4d24a['query'][_0x9420('0x3f')]);_0x250ab5['where']=qs['filters'](_[_0x9420('0x40')](_0xb4d24a[_0x9420('0x36')],_0x2c15f0[_0x9420('0x38')]));if(_0xb4d24a[_0x9420('0x36')][_0x9420('0x41')]){_0x250ab5[_0x9420('0x42')]=_['merge'](_0x250ab5['where'],{'$or':_[_0x9420('0x30')](_0x250ab5[_0x9420('0x3b')],function(_0x5f3393){var _0x3d56e1={};_0x3d56e1[_0x5f3393]={'$like':'%'+_0xb4d24a['query'][_0x9420('0x41')]+'%'};return _0x3d56e1;})});}_0x250ab5=_[_0x9420('0x43')]({},_0x250ab5,_0xb4d24a[_0x9420('0x44')]);var _0x3c313b={'where':_0x250ab5['where']};return db['VoiceQueueReport'][_0x9420('0x22')](_0x3c313b)[_0x9420('0x2a')](function(_0x5103d7){_0x3519a8[_0x9420('0x22')]=_0x5103d7;if(_0xb4d24a['query'][_0x9420('0x45')]){_0x250ab5[_0x9420('0x50')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x9420('0x46')](_0x250ab5);})[_0x9420('0x2a')](function(_0x15140b){_0x3519a8[_0x9420('0x47')]=_0x15140b;return _0x3519a8;})[_0x9420('0x2a')](respondWithFilteredResult(_0x390094,_0x250ab5,'getVoiceQueuesReport'))['catch'](handleError(_0x390094,null,_0x9420('0x51')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index b4e08c1..7ae4271 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 _0x1ae6=['../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','remove','emit','exports'];(function(_0x172133,_0x10246b){var _0x2460e5=function(_0x3c4918){while(--_0x3c4918){_0x172133['push'](_0x172133['shift']());}};_0x2460e5(++_0x10246b);}(_0x1ae6,0x1b0));var _0x61ae=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x1ae6[_0x565c49];return _0x20ca34;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x61ae('0x0'))['db'][_0x61ae('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x61ae('0x2')](0x0);var events={'afterCreate':_0x61ae('0x3'),'afterUpdate':_0x61ae('0x4'),'afterDestroy':_0x61ae('0x5')};function emitEvent(_0xd8fa4a){return function(_0x56a572,_0x15ab89,_0x1a0d16){VoiceQueueReportEvents[_0x61ae('0x6')](_0xd8fa4a+':'+_0x56a572['id'],_0x56a572);VoiceQueueReportEvents[_0x61ae('0x6')](_0xd8fa4a,_0x56a572);_0x1a0d16(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x61ae('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xe634=['hook','exports','events','../../mysqldb','VoiceQueueReport','save','update','emit','hasOwnProperty'];(function(_0x2ab3d9,_0x50e716){var _0x210a54=function(_0x24c479){while(--_0x24c479){_0x2ab3d9['push'](_0x2ab3d9['shift']());}};_0x210a54(++_0x50e716);}(_0xe634,0x1c4));var _0x4e63=function(_0x222aed,_0x5b9158){_0x222aed=_0x222aed-0x0;var _0x44b98e=_0xe634[_0x222aed];return _0x44b98e;};'use strict';var EventEmitter=require(_0x4e63('0x0'));var VoiceQueueReport=require(_0x4e63('0x1'))['db'][_0x4e63('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4e63('0x3'),'afterUpdate':_0x4e63('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2b1964){return function(_0x46bfbe,_0x28f849,_0x3507ba){VoiceQueueReportEvents[_0x4e63('0x5')](_0x2b1964+':'+_0x46bfbe['id'],_0x46bfbe);VoiceQueueReportEvents[_0x4e63('0x5')](_0x2b1964,_0x46bfbe);_0x3507ba(null);};}for(var e in events){if(events[_0x4e63('0x6')](e)){var event=events[e];VoiceQueueReport[_0x4e63('0x7')](e,emitEvent(event));}}module[_0x4e63('0x8')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 4cafcaa..04b8922 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 _0x901c=['exports','define','VoiceQueueReport','report_queue','uniqueid','lodash','../../config/logger','moment','bluebird','path','rimraf','./voiceQueueReport.attributes'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x901c,0x119));var _0xc901=function(_0x1b0ddf,_0x3a5576){_0x1b0ddf=_0x1b0ddf-0x0;var _0x1182b3=_0x901c[_0x1b0ddf];return _0x1182b3;};'use strict';var _=require(_0xc901('0x0'));var util=require('util');var logger=require(_0xc901('0x1'))('api');var moment=require(_0xc901('0x2'));var BPromise=require(_0xc901('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc901('0x4'));var rimraf=require(_0xc901('0x5'));var config=require('../../config/environment');var attributes=require(_0xc901('0x6'));module[_0xc901('0x7')]=function(_0x29e64d,_0x5cad1b){return _0x29e64d[_0xc901('0x8')](_0xc901('0x9'),attributes,{'tableName':_0xc901('0xa'),'paranoid':![],'indexes':[{'fields':[_0xc901('0xb')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0xac75=['rimraf','../../config/environment','./voiceQueueReport.attributes','exports','VoiceQueueReport','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x253f27,_0x559d16){var _0x6a46e8=function(_0xefcd7e){while(--_0xefcd7e){_0x253f27['push'](_0x253f27['shift']());}};_0x6a46e8(++_0x559d16);}(_0xac75,0x18c));var _0x5ac7=function(_0x3a658e,_0x42e82c){_0x3a658e=_0x3a658e-0x0;var _0x46ca59=_0xac75[_0x3a658e];return _0x46ca59;};'use strict';var _=require('lodash');var util=require(_0x5ac7('0x0'));var logger=require(_0x5ac7('0x1'))(_0x5ac7('0x2'));var moment=require(_0x5ac7('0x3'));var BPromise=require(_0x5ac7('0x4'));var rp=require(_0x5ac7('0x5'));var fs=require('fs');var path=require(_0x5ac7('0x6'));var rimraf=require(_0x5ac7('0x7'));var config=require(_0x5ac7('0x8'));var attributes=require(_0x5ac7('0x9'));module[_0x5ac7('0xa')]=function(_0x376337,_0x200a74){return _0x376337['define'](_0x5ac7('0xb'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x5ac7('0xc')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 9dd665b..8f18f13 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 _0x8bb3=['../../config/logger','rpc','jayson/promise','client','http','defaults','redis','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','where','attributes','limit','map','include','model','CreateVoiceQueueReport','create','body','raw','UpdateVoiceQueueReport','update','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x118619,_0x1262c5){var _0x566f5a=function(_0x5d555b){while(--_0x5d555b){_0x118619['push'](_0x118619['shift']());}};_0x566f5a(++_0x1262c5);}(_0x8bb3,0x18f));var _0x38bb=function(_0x57b34c,_0x247ade){_0x57b34c=_0x57b34c-0x0;var _0x3a3f08=_0x8bb3[_0x57b34c];return _0x3a3f08;};'use strict';var _=require(_0x38bb('0x0'));var util=require(_0x38bb('0x1'));var moment=require('moment');var BPromise=require(_0x38bb('0x2'));var rs=require(_0x38bb('0x3'));var fs=require('fs');var Redis=require(_0x38bb('0x4'));var db=require(_0x38bb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x38bb('0x6'))(_0x38bb('0x7'));var config=require('../../config/environment');var jayson=require(_0x38bb('0x8'));var client=jayson[_0x38bb('0x9')][_0x38bb('0xa')]({'port':0x232a});config['redis']=_[_0x38bb('0xb')](config[_0x38bb('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x38bb('0xd'))(new Redis(config[_0x38bb('0xc')]));require(_0x38bb('0xe'))[_0x38bb('0xf')](socket);function respondWithRpcPromise(_0xaaf59a,_0x1c3688,_0x1229f1){return new BPromise(function(_0x27a7b7,_0x3bb8f6){return client[_0x38bb('0x10')](_0xaaf59a,_0x1229f1)[_0x38bb('0x11')](function(_0x3dff9d){logger[_0x38bb('0x12')](_0x38bb('0x13'),_0x1c3688,_0x38bb('0x14'));logger[_0x38bb('0x15')](_0x38bb('0x16'),_0x1c3688,_0x38bb('0x14'),JSON[_0x38bb('0x17')](_0x3dff9d));if(_0x3dff9d[_0x38bb('0x18')]){if(_0x3dff9d[_0x38bb('0x18')][_0x38bb('0x19')]===0x1f4){logger[_0x38bb('0x18')](_0x38bb('0x13'),_0x1c3688,_0x3dff9d[_0x38bb('0x18')][_0x38bb('0x1a')]);return _0x3bb8f6(_0x3dff9d[_0x38bb('0x18')]['message']);}logger[_0x38bb('0x18')](_0x38bb('0x13'),_0x1c3688,_0x3dff9d[_0x38bb('0x18')]['message']);return _0x27a7b7(_0x3dff9d[_0x38bb('0x18')]['message']);}else{logger[_0x38bb('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x1c3688,'request\x20sent');_0x27a7b7(_0x3dff9d[_0x38bb('0x1b')][_0x38bb('0x1a')]);}})[_0x38bb('0x1c')](function(_0x43322a){logger[_0x38bb('0x18')](_0x38bb('0x13'),_0x1c3688,_0x43322a);_0x3bb8f6(_0x43322a);});});}exports[_0x38bb('0x1d')]=function(_0x4525de){var _0x5d3aa4=this;return new Promise(function(_0x4f6fef,_0x334c70){return db[_0x38bb('0x1e')][_0x38bb('0x1f')]({'raw':_0x4525de[_0x38bb('0x20')]?_0x4525de[_0x38bb('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x4525de[_0x38bb('0x20')]?_0x4525de[_0x38bb('0x20')][_0x38bb('0x21')]||null:null,'attributes':_0x4525de[_0x38bb('0x20')]?_0x4525de['options'][_0x38bb('0x22')]||null:null,'limit':_0x4525de[_0x38bb('0x20')]?_0x4525de[_0x38bb('0x20')][_0x38bb('0x23')]||null:null,'include':_0x4525de[_0x38bb('0x20')]?_0x4525de[_0x38bb('0x20')]['include']?_[_0x38bb('0x24')](_0x4525de['options'][_0x38bb('0x25')],function(_0x1297f0){return{'model':db[_0x1297f0[_0x38bb('0x26')]],'as':_0x1297f0['as'],'attributes':_0x1297f0['attributes'],'include':_0x1297f0['include']?_[_0x38bb('0x24')](_0x1297f0[_0x38bb('0x25')],function(_0x369ca9){return{'model':db[_0x369ca9['model']],'as':_0x369ca9['as'],'attributes':_0x369ca9[_0x38bb('0x22')],'include':_0x369ca9[_0x38bb('0x25')]?_[_0x38bb('0x24')](_0x369ca9[_0x38bb('0x25')],function(_0x220587){return{'model':db[_0x220587['model']],'as':_0x220587['as'],'attributes':_0x220587[_0x38bb('0x22')]};}):[]};}):[]};}):[]:[]})[_0x38bb('0x11')](function(_0x515153){logger['info']('GetVoiceQueueReport',_0x4525de);logger[_0x38bb('0x15')](_0x38bb('0x1d'),_0x4525de,JSON[_0x38bb('0x17')](_0x515153));_0x4f6fef(_0x515153);})[_0x38bb('0x1c')](function(_0x5daa7c){logger[_0x38bb('0x18')](_0x38bb('0x1d'),_0x5daa7c[_0x38bb('0x1a')],_0x4525de);_0x334c70(_0x5d3aa4[_0x38bb('0x18')](0x1f4,_0x5daa7c['message']));});});};exports[_0x38bb('0x27')]=function(_0x46cc25){var _0x56d25e=this;return new Promise(function(_0x3e1943,_0x4310ec){return db[_0x38bb('0x1e')][_0x38bb('0x28')](_0x46cc25[_0x38bb('0x29')],{'raw':_0x46cc25['options']?_0x46cc25[_0x38bb('0x20')][_0x38bb('0x2a')]===undefined?!![]:![]:!![]})['then'](function(_0x5ec153){logger[_0x38bb('0x12')]('CreateVoiceQueueReport',_0x46cc25);logger[_0x38bb('0x15')]('CreateVoiceQueueReport',_0x46cc25,JSON[_0x38bb('0x17')](_0x5ec153));_0x3e1943(_0x5ec153);})[_0x38bb('0x1c')](function(_0x3c8d75){logger[_0x38bb('0x18')](_0x38bb('0x27'),_0x3c8d75['message'],_0x46cc25);_0x4310ec(_0x56d25e['error'](0x1f4,_0x3c8d75[_0x38bb('0x1a')]));});});};exports[_0x38bb('0x2b')]=function(_0x2e0303){var _0x5bb952=this;return new Promise(function(_0x428058,_0x435686){return db[_0x38bb('0x1e')][_0x38bb('0x2c')](_0x2e0303['body'],{'raw':_0x2e0303[_0x38bb('0x20')]?_0x2e0303['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e0303['options']?_0x2e0303[_0x38bb('0x20')][_0x38bb('0x21')]||null:null,'attributes':_0x2e0303[_0x38bb('0x20')]?_0x2e0303[_0x38bb('0x20')][_0x38bb('0x22')]||null:null,'limit':_0x2e0303[_0x38bb('0x20')]?_0x2e0303[_0x38bb('0x20')][_0x38bb('0x23')]||null:null})['then'](function(_0x14b701){logger[_0x38bb('0x12')](_0x38bb('0x2b'),_0x2e0303);logger[_0x38bb('0x15')](_0x38bb('0x2b'),_0x2e0303,JSON['stringify'](_0x14b701));_0x428058(_0x14b701);})[_0x38bb('0x1c')](function(_0x42a32c){logger[_0x38bb('0x18')]('UpdateVoiceQueueReport',_0x42a32c[_0x38bb('0x1a')],_0x2e0303);_0x435686(_0x5bb952[_0x38bb('0x18')](0x1f4,_0x42a32c[_0x38bb('0x1a')]));});});}; \ No newline at end of file +var _0x87d3=['error','code','message','catch','VoiceQueueReport','findAll','options','where','attributes','include','model','map','then','debug','GetVoiceQueueReport','CreateVoiceQueueReport','create','body','raw','UpdateVoiceQueueReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x21dc0c,_0x64bb32){var _0x57d588=function(_0x62a3f4){while(--_0x62a3f4){_0x21dc0c['push'](_0x21dc0c['shift']());}};_0x57d588(++_0x64bb32);}(_0x87d3,0x13a));var _0x387d=function(_0x49e6db,_0x1a4546){_0x49e6db=_0x49e6db-0x0;var _0x5a6137=_0x87d3[_0x49e6db];return _0x5a6137;};'use strict';var _=require(_0x387d('0x0'));var util=require(_0x387d('0x1'));var moment=require(_0x387d('0x2'));var BPromise=require('bluebird');var rs=require(_0x387d('0x3'));var fs=require('fs');var Redis=require(_0x387d('0x4'));var db=require(_0x387d('0x5'))['db'];var utils=require(_0x387d('0x6'));var logger=require(_0x387d('0x7'))(_0x387d('0x8'));var config=require('../../config/environment');var jayson=require(_0x387d('0x9'));var client=jayson[_0x387d('0xa')][_0x387d('0xb')]({'port':0x232a});config[_0x387d('0xc')]=_[_0x387d('0xd')](config['redis'],{'host':_0x387d('0xe'),'port':0x18eb});var socket=require(_0x387d('0xf'))(new Redis(config['redis']));require('./voiceQueueReport.socket')[_0x387d('0x10')](socket);function respondWithRpcPromise(_0x51467a,_0x474a9b,_0x2901ad){return new BPromise(function(_0x2c6d22,_0x515f8f){return client['request'](_0x51467a,_0x2901ad)['then'](function(_0x87e367){logger[_0x387d('0x11')](_0x387d('0x12'),_0x474a9b,_0x387d('0x13'));logger['debug'](_0x387d('0x14'),_0x474a9b,_0x387d('0x13'),JSON[_0x387d('0x15')](_0x87e367));if(_0x87e367[_0x387d('0x16')]){if(_0x87e367[_0x387d('0x16')][_0x387d('0x17')]===0x1f4){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x474a9b,_0x87e367[_0x387d('0x16')][_0x387d('0x18')]);return _0x515f8f(_0x87e367[_0x387d('0x16')]['message']);}logger[_0x387d('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x474a9b,_0x87e367['error'][_0x387d('0x18')]);return _0x2c6d22(_0x87e367[_0x387d('0x16')]['message']);}else{logger[_0x387d('0x11')]('VoiceQueueReport,\x20%s,\x20%s',_0x474a9b,_0x387d('0x13'));_0x2c6d22(_0x87e367['result'][_0x387d('0x18')]);}})[_0x387d('0x19')](function(_0x22d582){logger['error'](_0x387d('0x12'),_0x474a9b,_0x22d582);_0x515f8f(_0x22d582);});});}exports['GetVoiceQueueReport']=function(_0x1a9ef2){var _0x7dc2db=this;return new Promise(function(_0x218023,_0x53933e){return db[_0x387d('0x1a')][_0x387d('0x1b')]({'raw':_0x1a9ef2[_0x387d('0x1c')]?_0x1a9ef2[_0x387d('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x1a9ef2[_0x387d('0x1c')]?_0x1a9ef2[_0x387d('0x1c')][_0x387d('0x1d')]||null:null,'attributes':_0x1a9ef2[_0x387d('0x1c')]?_0x1a9ef2['options'][_0x387d('0x1e')]||null:null,'limit':_0x1a9ef2[_0x387d('0x1c')]?_0x1a9ef2['options']['limit']||null:null,'include':_0x1a9ef2['options']?_0x1a9ef2[_0x387d('0x1c')][_0x387d('0x1f')]?_['map'](_0x1a9ef2[_0x387d('0x1c')]['include'],function(_0x17d51e){return{'model':db[_0x17d51e[_0x387d('0x20')]],'as':_0x17d51e['as'],'attributes':_0x17d51e[_0x387d('0x1e')],'include':_0x17d51e[_0x387d('0x1f')]?_[_0x387d('0x21')](_0x17d51e['include'],function(_0x2547c4){return{'model':db[_0x2547c4[_0x387d('0x20')]],'as':_0x2547c4['as'],'attributes':_0x2547c4[_0x387d('0x1e')],'include':_0x2547c4[_0x387d('0x1f')]?_[_0x387d('0x21')](_0x2547c4[_0x387d('0x1f')],function(_0x38c77a){return{'model':db[_0x38c77a['model']],'as':_0x38c77a['as'],'attributes':_0x38c77a[_0x387d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x387d('0x22')](function(_0x568a42){logger[_0x387d('0x11')]('GetVoiceQueueReport',_0x1a9ef2);logger[_0x387d('0x23')]('GetVoiceQueueReport',_0x1a9ef2,JSON['stringify'](_0x568a42));_0x218023(_0x568a42);})[_0x387d('0x19')](function(_0x358ac6){logger[_0x387d('0x16')](_0x387d('0x24'),_0x358ac6[_0x387d('0x18')],_0x1a9ef2);_0x53933e(_0x7dc2db[_0x387d('0x16')](0x1f4,_0x358ac6[_0x387d('0x18')]));});});};exports[_0x387d('0x25')]=function(_0x42bcf7){var _0x54029c=this;return new Promise(function(_0x269a24,_0x306767){return db[_0x387d('0x1a')][_0x387d('0x26')](_0x42bcf7[_0x387d('0x27')],{'raw':_0x42bcf7['options']?_0x42bcf7[_0x387d('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x387d('0x22')](function(_0x46305d){logger[_0x387d('0x11')](_0x387d('0x25'),_0x42bcf7);logger['debug']('CreateVoiceQueueReport',_0x42bcf7,JSON[_0x387d('0x15')](_0x46305d));_0x269a24(_0x46305d);})[_0x387d('0x19')](function(_0x33e5e2){logger[_0x387d('0x16')](_0x387d('0x25'),_0x33e5e2['message'],_0x42bcf7);_0x306767(_0x54029c[_0x387d('0x16')](0x1f4,_0x33e5e2[_0x387d('0x18')]));});});};exports['UpdateVoiceQueueReport']=function(_0x1df6a5){var _0x18a588=this;return new Promise(function(_0x35deb6,_0x522681){return db['VoiceQueueReport']['update'](_0x1df6a5[_0x387d('0x27')],{'raw':_0x1df6a5[_0x387d('0x1c')]?_0x1df6a5[_0x387d('0x1c')][_0x387d('0x28')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1df6a5[_0x387d('0x1c')]?_0x1df6a5[_0x387d('0x1c')][_0x387d('0x1d')]||null:null,'attributes':_0x1df6a5['options']?_0x1df6a5[_0x387d('0x1c')]['attributes']||null:null,'limit':_0x1df6a5[_0x387d('0x1c')]?_0x1df6a5[_0x387d('0x1c')]['limit']||null:null})[_0x387d('0x22')](function(_0x4ab136){logger['info'](_0x387d('0x29'),_0x1df6a5);logger[_0x387d('0x23')](_0x387d('0x29'),_0x1df6a5,JSON[_0x387d('0x15')](_0x4ab136));_0x35deb6(_0x4ab136);})[_0x387d('0x19')](function(_0x385627){logger[_0x387d('0x16')](_0x387d('0x29'),_0x385627[_0x387d('0x18')],_0x1df6a5);_0x522681(_0x18a588[_0x387d('0x16')](0x1f4,_0x385627[_0x387d('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 3a391a8..b27a181 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 _0x77f2=['save','update','register','length'];(function(_0x58875a,_0x2ca6bc){var _0x478bb8=function(_0x263009){while(--_0x263009){_0x58875a['push'](_0x58875a['shift']());}};_0x478bb8(++_0x2ca6bc);}(_0x77f2,0x188));var _0x277f=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x77f2[_0x1d24eb];return _0x1dc576;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x277f('0x0'),'remove',_0x277f('0x1')];function createListener(_0x2e92f9,_0x594016){return function(_0x5147da){_0x594016['emit'](_0x2e92f9,_0x5147da);};}function removeListener(_0x148ab0,_0x26bc5b){return function(){VoiceQueueReportEvents['removeListener'](_0x148ab0,_0x26bc5b);};}exports[_0x277f('0x2')]=function(_0x4e3fa5){for(var _0x498f51=0x0,_0x5cfad8=events[_0x277f('0x3')];_0x498f51<_0x5cfad8;_0x498f51++){var _0x24b21a=events[_0x498f51];var _0x422495=createListener('voiceQueueReport:'+_0x24b21a,_0x4e3fa5);VoiceQueueReportEvents['on'](_0x24b21a,_0x422495);}}; \ No newline at end of file +var _0xbc61=['length','voiceQueueReport:','./voiceQueueReport.events','save','remove','update','emit','removeListener','register'];(function(_0x79fb36,_0x2f6c6f){var _0x536c1d=function(_0x452815){while(--_0x452815){_0x79fb36['push'](_0x79fb36['shift']());}};_0x536c1d(++_0x2f6c6f);}(_0xbc61,0x1b2));var _0x1bc6=function(_0x4cd78d,_0x4e15ea){_0x4cd78d=_0x4cd78d-0x0;var _0x58d8d1=_0xbc61[_0x4cd78d];return _0x58d8d1;};'use strict';var VoiceQueueReportEvents=require(_0x1bc6('0x0'));var events=[_0x1bc6('0x1'),_0x1bc6('0x2'),_0x1bc6('0x3')];function createListener(_0x5ad531,_0x20d016){return function(_0x5945ee){_0x20d016[_0x1bc6('0x4')](_0x5ad531,_0x5945ee);};}function removeListener(_0x2416a1,_0x571edc){return function(){VoiceQueueReportEvents[_0x1bc6('0x5')](_0x2416a1,_0x571edc);};}exports[_0x1bc6('0x6')]=function(_0x23c00e){for(var _0x15da49=0x0,_0x51c8c7=events[_0x1bc6('0x7')];_0x15da49<_0x51c8c7;_0x15da49++){var _0xeb728e=events[_0x15da49];var _0x3112bc=createListener(_0x1bc6('0x8')+_0xeb728e,_0x23c00e);VoiceQueueReportEvents['on'](_0xeb728e,_0x3112bc);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 6e1754c..8ef82d0 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 _0xf631=['/:id','show','post','put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index'];(function(_0x5ec961,_0x35befb){var _0x2798d2=function(_0x316576){while(--_0x316576){_0x5ec961['push'](_0x5ec961['shift']());}};_0x2798d2(++_0x35befb);}(_0xf631,0x1a9));var _0x1f63=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf631[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x1f63('0x0'));var util=require(_0x1f63('0x1'));var path=require(_0x1f63('0x2'));var timeout=require('connect-timeout');var express=require(_0x1f63('0x3'));var router=express[_0x1f63('0x4')]();var fs_extra=require(_0x1f63('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1f63('0x6'));var config=require(_0x1f63('0x7'));var controller=require(_0x1f63('0x8'));router[_0x1f63('0x9')]('/',auth[_0x1f63('0xa')](),controller[_0x1f63('0xb')]);router[_0x1f63('0x9')](_0x1f63('0xc'),auth['isAuthenticated'](),controller[_0x1f63('0xd')]);router[_0x1f63('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1f63('0xf')](_0x1f63('0xc'),auth[_0x1f63('0xa')](),controller[_0x1f63('0x10')]);router[_0x1f63('0x11')](_0x1f63('0xc'),auth[_0x1f63('0xa')](),controller['destroy']);module[_0x1f63('0x12')]=router; \ No newline at end of file +var _0xa71e=['delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','post','put','update'];(function(_0x414c77,_0x17b360){var _0x937a24=function(_0x3a135a){while(--_0x3a135a){_0x414c77['push'](_0x414c77['shift']());}};_0x937a24(++_0x17b360);}(_0xa71e,0x7b));var _0xea71=function(_0x35a779,_0x27f8fb){_0x35a779=_0x35a779-0x0;var _0xca723b=_0xa71e[_0x35a779];return _0xca723b;};'use strict';var multer=require(_0xea71('0x0'));var util=require(_0xea71('0x1'));var path=require('path');var timeout=require(_0xea71('0x2'));var express=require('express');var router=express[_0xea71('0x3')]();var fs_extra=require(_0xea71('0x4'));var auth=require(_0xea71('0x5'));var interaction=require(_0xea71('0x6'));var config=require(_0xea71('0x7'));var controller=require(_0xea71('0x8'));router[_0xea71('0x9')]('/',auth[_0xea71('0xa')](),controller[_0xea71('0xb')]);router['get'](_0xea71('0xc'),auth[_0xea71('0xa')](),controller[_0xea71('0xd')]);router[_0xea71('0xe')]('/',auth[_0xea71('0xa')](),controller['create']);router[_0xea71('0xf')](_0xea71('0xc'),auth['isAuthenticated'](),controller[_0xea71('0x10')]);router[_0xea71('0x11')](_0xea71('0xc'),auth[_0xea71('0xa')](),controller[_0xea71('0x12')]);module[_0xea71('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 96d3542..00f41a6 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 _0x9614=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment','exports','STRING','DATE'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9614,0xb8));var _0x4961=function(_0x4f96b0,_0x4b2175){_0x4f96b0=_0x4f96b0-0x0;var _0x49025b=_0x9614[_0x4f96b0];return _0x49025b;};'use strict';var Sequelize=require(_0x4961('0x0'));var moment=require(_0x4961('0x1'));module[_0x4961('0x2')]={'time':{'type':Sequelize[_0x4961('0x3')]},'callid':{'type':Sequelize[_0x4961('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x4961('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x4961('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x4961('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x4961('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x4961('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x4961('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x4961('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x4961('0x5')](_0x4961('0x6'))}}; \ No newline at end of file +var _0x1cbc=['exports','STRING','DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment'];(function(_0x3416c3,_0x314646){var _0x2934d1=function(_0x107488){while(--_0x107488){_0x3416c3['push'](_0x3416c3['shift']());}};_0x2934d1(++_0x314646);}(_0x1cbc,0x1cc));var _0xc1cb=function(_0x45283b,_0xe68902){_0x45283b=_0x45283b-0x0;var _0x1b23f9=_0x1cbc[_0x45283b];return _0x1b23f9;};'use strict';var Sequelize=require(_0xc1cb('0x0'));var moment=require(_0xc1cb('0x1'));module[_0xc1cb('0x2')]={'time':{'type':Sequelize[_0xc1cb('0x3')]},'callid':{'type':Sequelize[_0xc1cb('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xc1cb('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xc1cb('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xc1cb('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xc1cb('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xc1cb('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xc1cb('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xc1cb('0x4')],'allowNull':![],'defaultValue':Sequelize[_0xc1cb('0x5')](_0xc1cb('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index f9ada92..dde6076 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 _0xf5ae=['rawAttributes','type','key','map','query','keys','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','VoiceQueuesLog','includeAll','rows','catch','show','length','include','find','create','body','params','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','then','sendStatus','stack','name','send','index'];(function(_0x1fc18b,_0x13d27d){var _0x16a351=function(_0x54a799){while(--_0x54a799){_0x1fc18b['push'](_0x1fc18b['shift']());}};_0x16a351(++_0x13d27d);}(_0xf5ae,0x1d0));var _0xef5a=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xf5ae[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xef5a('0x0'));var jsonpatch=require(_0xef5a('0x1'));var rp=require(_0xef5a('0x2'));var moment=require('moment');var BPromise=require(_0xef5a('0x3'));var Mustache=require('mustache');var util=require(_0xef5a('0x4'));var path=require(_0xef5a('0x5'));var sox=require('sox');var csv=require(_0xef5a('0x6'));var ejs=require(_0xef5a('0x7'));var fs=require('fs');var fs_extra=require(_0xef5a('0x8'));var _=require(_0xef5a('0x9'));var squel=require(_0xef5a('0xa'));var crypto=require(_0xef5a('0xb'));var jsforce=require(_0xef5a('0xc'));var deskjs=require(_0xef5a('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xef5a('0xe'));var authService=require(_0xef5a('0xf'));var qs=require(_0xef5a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xef5a('0x11'))(_0xef5a('0x12'));var utils=require('../../config/utils');var config=require(_0xef5a('0x13'));var licenseUtil=require(_0xef5a('0x14'));var db=require(_0xef5a('0x15'))['db'];function respondWithStatusCode(_0x1b0ef4,_0x298633){_0x298633=_0x298633||0xcc;return function(_0x4c509d){if(_0x4c509d){return _0x1b0ef4['sendStatus'](_0x298633);}return _0x1b0ef4[_0xef5a('0x16')](_0x298633)[_0xef5a('0x17')]();};}function respondWithResult(_0x2acf1b,_0x19f286){_0x19f286=_0x19f286||0xc8;return function(_0x15e898){if(_0x15e898){return _0x2acf1b['status'](_0x19f286)[_0xef5a('0x18')](_0x15e898);}};}function respondWithFilteredResult(_0x347886,_0x2ce07f){return function(_0x28d924){if(_0x28d924){var _0x34f2f6=typeof _0x2ce07f[_0xef5a('0x19')]===_0xef5a('0x1a')&&typeof _0x2ce07f[_0xef5a('0x1b')]===_0xef5a('0x1a');var _0x5d1369=_0x28d924['count'];var _0x17780e=_0x34f2f6?0x0:_0x2ce07f[_0xef5a('0x19')];var _0xc9fb1b=_0x34f2f6?_0x28d924[_0xef5a('0x1c')]:_0x2ce07f[_0xef5a('0x19')]+_0x2ce07f[_0xef5a('0x1b')];var _0x30d33f;if(_0xc9fb1b>=_0x5d1369){_0xc9fb1b=_0x5d1369;_0x30d33f=0xc8;}else{_0x30d33f=0xce;}_0x347886[_0xef5a('0x16')](_0x30d33f);return _0x347886['set'](_0xef5a('0x1d'),_0x17780e+'-'+_0xc9fb1b+'/'+_0x5d1369)[_0xef5a('0x18')](_0x28d924);}return null;};}function patchUpdates(_0x274eb9){return function(_0x1497ed){try{jsonpatch['apply'](_0x1497ed,_0x274eb9,!![]);}catch(_0x2d1a5f){return BPromise[_0xef5a('0x1e')](_0x2d1a5f);}return _0x1497ed[_0xef5a('0x1f')]();};}function saveUpdates(_0xeef1f4,_0x33760d){return function(_0x1fde51){if(_0x1fde51){return _0x1fde51[_0xef5a('0x20')](_0xeef1f4)['then'](function(_0x13b6b8){return _0x13b6b8;});}return null;};}function removeEntity(_0x19850d,_0x18c52b){return function(_0x24a2a0){if(_0x24a2a0){return _0x24a2a0[_0xef5a('0x21')]()[_0xef5a('0x22')](function(){_0x19850d[_0xef5a('0x16')](0xcc)[_0xef5a('0x17')]();});}};}function handleEntityNotFound(_0x27a68f,_0x3ddd83){return function(_0x370e79){if(!_0x370e79){_0x27a68f[_0xef5a('0x23')](0x194);}return _0x370e79;};}function handleError(_0x209ac3,_0x194894){_0x194894=_0x194894||0x1f4;return function(_0x5e3415){logger['error'](_0x5e3415[_0xef5a('0x24')]);if(_0x5e3415['name']){delete _0x5e3415[_0xef5a('0x25')];}_0x209ac3[_0xef5a('0x16')](_0x194894)[_0xef5a('0x26')](_0x5e3415);};}exports[_0xef5a('0x27')]=function(_0x29abae,_0x22ee0f){var _0x544bb3={},_0xd916a4={},_0x88e4a={'count':0x0,'rows':[]};var _0xef9e75=_['map'](db['VoiceQueuesLog'][_0xef5a('0x28')],function(_0x3795d9){return{'name':_0x3795d9['fieldName'],'type':_0x3795d9[_0xef5a('0x29')][_0xef5a('0x2a')]};});_0xd916a4['model']=_[_0xef5a('0x2b')](_0xef9e75,_0xef5a('0x25'));_0xd916a4[_0xef5a('0x2c')]=_[_0xef5a('0x2d')](_0x29abae[_0xef5a('0x2c')]);_0xd916a4['filters']=_['intersection'](_0xd916a4[_0xef5a('0x2e')],_0xd916a4[_0xef5a('0x2c')]);_0x544bb3['attributes']=_[_0xef5a('0x2f')](_0xd916a4[_0xef5a('0x2e')],qs[_0xef5a('0x30')](_0x29abae[_0xef5a('0x2c')][_0xef5a('0x30')]));_0x544bb3['attributes']=_0x544bb3[_0xef5a('0x31')]['length']?_0x544bb3[_0xef5a('0x31')]:_0xd916a4['model'];if(!_0x29abae['query'][_0xef5a('0x32')](_0xef5a('0x33'))){_0x544bb3[_0xef5a('0x1b')]=qs[_0xef5a('0x1b')](_0x29abae[_0xef5a('0x2c')]['limit']);_0x544bb3[_0xef5a('0x19')]=qs[_0xef5a('0x19')](_0x29abae[_0xef5a('0x2c')][_0xef5a('0x19')]);}_0x544bb3[_0xef5a('0x34')]=qs[_0xef5a('0x35')](_0x29abae[_0xef5a('0x2c')][_0xef5a('0x35')]);_0x544bb3['where']=qs[_0xef5a('0x36')](_[_0xef5a('0x37')](_0x29abae[_0xef5a('0x2c')],_0xd916a4['filters']),_0xef9e75);if(_0x29abae['query'][_0xef5a('0x38')]){_0x544bb3[_0xef5a('0x39')]=_[_0xef5a('0x3a')](_0x544bb3[_0xef5a('0x39')],{'$or':_[_0xef5a('0x2b')](_0xef9e75,function(_0x335ba4){if(_0x335ba4[_0xef5a('0x29')]!==_0xef5a('0x3b')){var _0x41eb41={};_0x41eb41[_0x335ba4['name']]={'$like':'%'+_0x29abae[_0xef5a('0x2c')][_0xef5a('0x38')]+'%'};return _0x41eb41;}})});}_0x544bb3=_[_0xef5a('0x3a')]({},_0x544bb3,_0x29abae[_0xef5a('0x3c')]);var _0x1fa2ed={'where':_0x544bb3[_0xef5a('0x39')]};return db[_0xef5a('0x3d')][_0xef5a('0x1c')](_0x1fa2ed)[_0xef5a('0x22')](function(_0x51fe41){_0x88e4a[_0xef5a('0x1c')]=_0x51fe41;if(_0x29abae['query'][_0xef5a('0x3e')]){_0x544bb3['include']=[{'all':!![]}];}return db[_0xef5a('0x3d')]['findAll'](_0x544bb3);})['then'](function(_0x30a86a){_0x88e4a[_0xef5a('0x3f')]=_0x30a86a;return _0x88e4a;})[_0xef5a('0x22')](respondWithFilteredResult(_0x22ee0f,_0x544bb3))[_0xef5a('0x40')](handleError(_0x22ee0f,null));};exports[_0xef5a('0x41')]=function(_0x3c5b42,_0x132c26){var _0xf61fea={'raw':!![],'where':{'id':_0x3c5b42['params']['id']}},_0x1edd1e={};_0x1edd1e[_0xef5a('0x2e')]=_[_0xef5a('0x2d')](db[_0xef5a('0x3d')]['rawAttributes']);_0x1edd1e[_0xef5a('0x2c')]=_[_0xef5a('0x2d')](_0x3c5b42[_0xef5a('0x2c')]);_0x1edd1e[_0xef5a('0x36')]=_[_0xef5a('0x2f')](_0x1edd1e[_0xef5a('0x2e')],_0x1edd1e[_0xef5a('0x2c')]);_0xf61fea[_0xef5a('0x31')]=_[_0xef5a('0x2f')](_0x1edd1e[_0xef5a('0x2e')],qs[_0xef5a('0x30')](_0x3c5b42[_0xef5a('0x2c')]['fields']));_0xf61fea[_0xef5a('0x31')]=_0xf61fea[_0xef5a('0x31')][_0xef5a('0x42')]?_0xf61fea[_0xef5a('0x31')]:_0x1edd1e[_0xef5a('0x2e')];if(_0x3c5b42[_0xef5a('0x2c')][_0xef5a('0x3e')]){_0xf61fea[_0xef5a('0x43')]=[{'all':!![]}];}_0xf61fea=_[_0xef5a('0x3a')]({},_0xf61fea,_0x3c5b42[_0xef5a('0x3c')]);return db[_0xef5a('0x3d')][_0xef5a('0x44')](_0xf61fea)[_0xef5a('0x22')](handleEntityNotFound(_0x132c26,null))['then'](respondWithResult(_0x132c26,null))[_0xef5a('0x40')](handleError(_0x132c26,null));};exports[_0xef5a('0x45')]=function(_0x48e41a,_0x4598e3){return db[_0xef5a('0x3d')][_0xef5a('0x45')](_0x48e41a[_0xef5a('0x46')],{})[_0xef5a('0x22')](respondWithResult(_0x4598e3,0xc9))[_0xef5a('0x40')](handleError(_0x4598e3,null));};exports[_0xef5a('0x20')]=function(_0x55ad5c,_0x16c34c){if(_0x55ad5c[_0xef5a('0x46')]['id']){delete _0x55ad5c['body']['id'];}return db[_0xef5a('0x3d')]['find']({'where':{'id':_0x55ad5c[_0xef5a('0x47')]['id']}})[_0xef5a('0x22')](handleEntityNotFound(_0x16c34c,null))[_0xef5a('0x22')](saveUpdates(_0x55ad5c[_0xef5a('0x46')],null))['then'](respondWithResult(_0x16c34c,null))[_0xef5a('0x40')](handleError(_0x16c34c,null));};exports[_0xef5a('0x21')]=function(_0x9bd3d9,_0x2f3a13){return db['VoiceQueuesLog'][_0xef5a('0x44')]({'where':{'id':_0x9bd3d9['params']['id']}})[_0xef5a('0x22')](handleEntityNotFound(_0x2f3a13,null))[_0xef5a('0x22')](removeEntity(_0x2f3a13,null))['catch'](handleError(_0x2f3a13,null));}; \ No newline at end of file +var _0x5e23=['keys','attributes','fields','length','nolimit','sort','filters','filter','where','merge','options','includeAll','findAll','rows','catch','show','intersection','find','create','body','params','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','send','index','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','map','name','query'];(function(_0x5d2c85,_0x50b8e7){var _0x5d59ff=function(_0x3371b6){while(--_0x3371b6){_0x5d2c85['push'](_0x5d2c85['shift']());}};_0x5d59ff(++_0x50b8e7);}(_0x5e23,0xe4));var _0x35e2=function(_0x57a1bf,_0x3b3732){_0x57a1bf=_0x57a1bf-0x0;var _0xb1facb=_0x5e23[_0x57a1bf];return _0xb1facb;};'use strict';var emlformat=require(_0x35e2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x35e2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x35e2('0x2'));var BPromise=require(_0x35e2('0x3'));var Mustache=require(_0x35e2('0x4'));var util=require(_0x35e2('0x5'));var path=require(_0x35e2('0x6'));var sox=require(_0x35e2('0x7'));var csv=require('to-csv');var ejs=require(_0x35e2('0x8'));var fs=require('fs');var fs_extra=require(_0x35e2('0x9'));var _=require(_0x35e2('0xa'));var squel=require(_0x35e2('0xb'));var crypto=require(_0x35e2('0xc'));var jsforce=require(_0x35e2('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x35e2('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x35e2('0xf'));var authService=require(_0x35e2('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x35e2('0x11'));var hardwareService=require(_0x35e2('0x12'));var logger=require(_0x35e2('0x13'))(_0x35e2('0x14'));var utils=require('../../config/utils');var config=require(_0x35e2('0x15'));var licenseUtil=require(_0x35e2('0x16'));var db=require(_0x35e2('0x17'))['db'];function respondWithStatusCode(_0xef95f3,_0x3f75cb){_0x3f75cb=_0x3f75cb||0xcc;return function(_0x5def34){if(_0x5def34){return _0xef95f3['sendStatus'](_0x3f75cb);}return _0xef95f3['status'](_0x3f75cb)['end']();};}function respondWithResult(_0x12c638,_0x840e03){_0x840e03=_0x840e03||0xc8;return function(_0x5f04fa){if(_0x5f04fa){return _0x12c638[_0x35e2('0x18')](_0x840e03)[_0x35e2('0x19')](_0x5f04fa);}};}function respondWithFilteredResult(_0x43e526,_0x198762){return function(_0x190cfe){if(_0x190cfe){var _0xe6cda4=typeof _0x198762[_0x35e2('0x1a')]==='undefined'&&typeof _0x198762[_0x35e2('0x1b')]===_0x35e2('0x1c');var _0x58aace=_0x190cfe[_0x35e2('0x1d')];var _0x731585=_0xe6cda4?0x0:_0x198762[_0x35e2('0x1a')];var _0x3c0247=_0xe6cda4?_0x190cfe[_0x35e2('0x1d')]:_0x198762['offset']+_0x198762['limit'];var _0x365f6a;if(_0x3c0247>=_0x58aace){_0x3c0247=_0x58aace;_0x365f6a=0xc8;}else{_0x365f6a=0xce;}_0x43e526['status'](_0x365f6a);return _0x43e526[_0x35e2('0x1e')]('Content-Range',_0x731585+'-'+_0x3c0247+'/'+_0x58aace)['json'](_0x190cfe);}return null;};}function patchUpdates(_0x591456){return function(_0x23deaa){try{jsonpatch[_0x35e2('0x1f')](_0x23deaa,_0x591456,!![]);}catch(_0x1f4660){return BPromise[_0x35e2('0x20')](_0x1f4660);}return _0x23deaa[_0x35e2('0x21')]();};}function saveUpdates(_0x58297d,_0x36505c){return function(_0x3d73a9){if(_0x3d73a9){return _0x3d73a9[_0x35e2('0x22')](_0x58297d)[_0x35e2('0x23')](function(_0x225b15){return _0x225b15;});}return null;};}function removeEntity(_0x2665d4,_0x5091e9){return function(_0x146f8d){if(_0x146f8d){return _0x146f8d[_0x35e2('0x24')]()[_0x35e2('0x23')](function(){_0x2665d4[_0x35e2('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c9ced,_0x52e99e){return function(_0x2a303e){if(!_0x2a303e){_0x3c9ced['sendStatus'](0x194);}return _0x2a303e;};}function handleError(_0x7d36ae,_0x224601){_0x224601=_0x224601||0x1f4;return function(_0x5c6f59){logger['error'](_0x5c6f59['stack']);if(_0x5c6f59['name']){delete _0x5c6f59['name'];}_0x7d36ae[_0x35e2('0x18')](_0x224601)[_0x35e2('0x25')](_0x5c6f59);};}exports[_0x35e2('0x26')]=function(_0xb6f55d,_0x138478){var _0x681815={},_0x3ddc7a={},_0x2d5e6d={'count':0x0,'rows':[]};var _0x4e7beb=_['map'](db[_0x35e2('0x27')][_0x35e2('0x28')],function(_0x2a4f66){return{'name':_0x2a4f66[_0x35e2('0x29')],'type':_0x2a4f66[_0x35e2('0x2a')][_0x35e2('0x2b')]};});_0x3ddc7a[_0x35e2('0x2c')]=_[_0x35e2('0x2d')](_0x4e7beb,_0x35e2('0x2e'));_0x3ddc7a[_0x35e2('0x2f')]=_[_0x35e2('0x30')](_0xb6f55d[_0x35e2('0x2f')]);_0x3ddc7a['filters']=_['intersection'](_0x3ddc7a[_0x35e2('0x2c')],_0x3ddc7a[_0x35e2('0x2f')]);_0x681815[_0x35e2('0x31')]=_['intersection'](_0x3ddc7a[_0x35e2('0x2c')],qs[_0x35e2('0x32')](_0xb6f55d[_0x35e2('0x2f')][_0x35e2('0x32')]));_0x681815[_0x35e2('0x31')]=_0x681815[_0x35e2('0x31')][_0x35e2('0x33')]?_0x681815[_0x35e2('0x31')]:_0x3ddc7a[_0x35e2('0x2c')];if(!_0xb6f55d[_0x35e2('0x2f')]['hasOwnProperty'](_0x35e2('0x34'))){_0x681815[_0x35e2('0x1b')]=qs[_0x35e2('0x1b')](_0xb6f55d['query'][_0x35e2('0x1b')]);_0x681815['offset']=qs[_0x35e2('0x1a')](_0xb6f55d[_0x35e2('0x2f')][_0x35e2('0x1a')]);}_0x681815['order']=qs[_0x35e2('0x35')](_0xb6f55d[_0x35e2('0x2f')][_0x35e2('0x35')]);_0x681815['where']=qs[_0x35e2('0x36')](_['pick'](_0xb6f55d[_0x35e2('0x2f')],_0x3ddc7a[_0x35e2('0x36')]),_0x4e7beb);if(_0xb6f55d[_0x35e2('0x2f')][_0x35e2('0x37')]){_0x681815[_0x35e2('0x38')]=_[_0x35e2('0x39')](_0x681815['where'],{'$or':_['map'](_0x4e7beb,function(_0x431047){if(_0x431047[_0x35e2('0x2a')]!=='VIRTUAL'){var _0x2f8032={};_0x2f8032[_0x431047[_0x35e2('0x2e')]]={'$like':'%'+_0xb6f55d[_0x35e2('0x2f')][_0x35e2('0x37')]+'%'};return _0x2f8032;}})});}_0x681815=_['merge']({},_0x681815,_0xb6f55d[_0x35e2('0x3a')]);var _0x3c6541={'where':_0x681815['where']};return db['VoiceQueuesLog'][_0x35e2('0x1d')](_0x3c6541)[_0x35e2('0x23')](function(_0x49e8b4){_0x2d5e6d[_0x35e2('0x1d')]=_0x49e8b4;if(_0xb6f55d[_0x35e2('0x2f')][_0x35e2('0x3b')]){_0x681815['include']=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x35e2('0x3c')](_0x681815);})[_0x35e2('0x23')](function(_0x440389){_0x2d5e6d[_0x35e2('0x3d')]=_0x440389;return _0x2d5e6d;})[_0x35e2('0x23')](respondWithFilteredResult(_0x138478,_0x681815))[_0x35e2('0x3e')](handleError(_0x138478,null));};exports[_0x35e2('0x3f')]=function(_0xa7466e,_0x81c711){var _0x460a27={'raw':!![],'where':{'id':_0xa7466e['params']['id']}},_0x5d118d={};_0x5d118d[_0x35e2('0x2c')]=_['keys'](db[_0x35e2('0x27')][_0x35e2('0x28')]);_0x5d118d['query']=_[_0x35e2('0x30')](_0xa7466e[_0x35e2('0x2f')]);_0x5d118d['filters']=_['intersection'](_0x5d118d['model'],_0x5d118d[_0x35e2('0x2f')]);_0x460a27[_0x35e2('0x31')]=_[_0x35e2('0x40')](_0x5d118d['model'],qs['fields'](_0xa7466e[_0x35e2('0x2f')][_0x35e2('0x32')]));_0x460a27[_0x35e2('0x31')]=_0x460a27[_0x35e2('0x31')][_0x35e2('0x33')]?_0x460a27[_0x35e2('0x31')]:_0x5d118d[_0x35e2('0x2c')];if(_0xa7466e[_0x35e2('0x2f')]['includeAll']){_0x460a27['include']=[{'all':!![]}];}_0x460a27=_[_0x35e2('0x39')]({},_0x460a27,_0xa7466e['options']);return db[_0x35e2('0x27')][_0x35e2('0x41')](_0x460a27)[_0x35e2('0x23')](handleEntityNotFound(_0x81c711,null))[_0x35e2('0x23')](respondWithResult(_0x81c711,null))['catch'](handleError(_0x81c711,null));};exports[_0x35e2('0x42')]=function(_0x292c05,_0xf61d4f){return db[_0x35e2('0x27')][_0x35e2('0x42')](_0x292c05[_0x35e2('0x43')],{})[_0x35e2('0x23')](respondWithResult(_0xf61d4f,0xc9))[_0x35e2('0x3e')](handleError(_0xf61d4f,null));};exports[_0x35e2('0x22')]=function(_0x11c9dc,_0x351303){if(_0x11c9dc[_0x35e2('0x43')]['id']){delete _0x11c9dc[_0x35e2('0x43')]['id'];}return db[_0x35e2('0x27')][_0x35e2('0x41')]({'where':{'id':_0x11c9dc[_0x35e2('0x44')]['id']}})[_0x35e2('0x23')](handleEntityNotFound(_0x351303,null))[_0x35e2('0x23')](saveUpdates(_0x11c9dc[_0x35e2('0x43')],null))[_0x35e2('0x23')](respondWithResult(_0x351303,null))[_0x35e2('0x3e')](handleError(_0x351303,null));};exports['destroy']=function(_0x3aa410,_0x28a239){return db[_0x35e2('0x27')][_0x35e2('0x41')]({'where':{'id':_0x3aa410[_0x35e2('0x44')]['id']}})[_0x35e2('0x23')](handleEntityNotFound(_0x28a239,null))[_0x35e2('0x23')](removeEntity(_0x28a239,null))[_0x35e2('0x3e')](handleError(_0x28a239,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index b587008..a9e9360 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 _0x7793=['event_dtm','dtm','util','../../config/logger','moment','path','rimraf','./voiceQueuesLog.attributes','exports','define','voice_queues_log'];(function(_0x250633,_0x1365b5){var _0x10d6e9=function(_0x5db66f){while(--_0x5db66f){_0x250633['push'](_0x250633['shift']());}};_0x10d6e9(++_0x1365b5);}(_0x7793,0x120));var _0x3779=function(_0x346fb5,_0x45ef82){_0x346fb5=_0x346fb5-0x0;var _0x3e782f=_0x7793[_0x346fb5];return _0x3e782f;};'use strict';var _=require('lodash');var util=require(_0x3779('0x0'));var logger=require(_0x3779('0x1'))('api');var moment=require(_0x3779('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3779('0x3'));var rimraf=require(_0x3779('0x4'));var config=require('../../config/environment');var attributes=require(_0x3779('0x5'));module[_0x3779('0x6')]=function(_0x59dfb7,_0x25b30d){return _0x59dfb7[_0x3779('0x7')]('VoiceQueuesLog',attributes,{'tableName':_0x3779('0x8'),'paranoid':![],'indexes':[{'name':_0x3779('0x9'),'fields':['event',_0x3779('0xa')]}],'timestamps':![]});}; \ No newline at end of file +var _0xc130=['./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event','dtm','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x5dca1c,_0x4d4281){var _0x5ce01c=function(_0x100860){while(--_0x100860){_0x5dca1c['push'](_0x5dca1c['shift']());}};_0x5ce01c(++_0x4d4281);}(_0xc130,0x115));var _0x0c13=function(_0x41911b,_0x4068c4){_0x41911b=_0x41911b-0x0;var _0x4c9e16=_0xc130[_0x41911b];return _0x4c9e16;};'use strict';var _=require(_0x0c13('0x0'));var util=require(_0x0c13('0x1'));var logger=require(_0x0c13('0x2'))(_0x0c13('0x3'));var moment=require(_0x0c13('0x4'));var BPromise=require(_0x0c13('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0c13('0x6'));var rimraf=require(_0x0c13('0x7'));var config=require('../../config/environment');var attributes=require(_0x0c13('0x8'));module[_0x0c13('0x9')]=function(_0x5e1fa9,_0x502fee){return _0x5e1fa9[_0x0c13('0xa')](_0x0c13('0xb'),attributes,{'tableName':_0x0c13('0xc'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x0c13('0xd'),_0x0c13('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 3056f63..9d9c9ce 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 _0x3a42=['../../mysqldb','../../config/logger','jayson/promise','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x49dd24,_0x1c20b5){var _0x1c9cfe=function(_0x20b560){while(--_0x20b560){_0x49dd24['push'](_0x49dd24['shift']());}};_0x1c9cfe(++_0x1c20b5);}(_0x3a42,0x19c));var _0x23a4=function(_0x3fbb74,_0x2c259a){_0x3fbb74=_0x3fbb74-0x0;var _0xaefbc0=_0x3a42[_0x3fbb74];return _0xaefbc0;};'use strict';var _=require(_0x23a4('0x0'));var util=require(_0x23a4('0x1'));var moment=require(_0x23a4('0x2'));var BPromise=require(_0x23a4('0x3'));var rs=require(_0x23a4('0x4'));var fs=require('fs');var Redis=require(_0x23a4('0x5'));var db=require(_0x23a4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x23a4('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x23a4('0x8'));var client=jayson['client'][_0x23a4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x112e31,_0x45a727,_0xd0be79){return new BPromise(function(_0x5c5dbe,_0x42b11a){return client[_0x23a4('0xa')](_0x112e31,_0xd0be79)[_0x23a4('0xb')](function(_0x5f3913){logger[_0x23a4('0xc')](_0x23a4('0xd'),_0x45a727,_0x23a4('0xe'));logger[_0x23a4('0xf')](_0x23a4('0x10'),_0x45a727,_0x23a4('0xe'),JSON[_0x23a4('0x11')](_0x5f3913));if(_0x5f3913[_0x23a4('0x12')]){if(_0x5f3913[_0x23a4('0x12')][_0x23a4('0x13')]===0x1f4){logger[_0x23a4('0x12')](_0x23a4('0xd'),_0x45a727,_0x5f3913[_0x23a4('0x12')]['message']);return _0x42b11a(_0x5f3913[_0x23a4('0x12')][_0x23a4('0x14')]);}logger[_0x23a4('0x12')](_0x23a4('0xd'),_0x45a727,_0x5f3913[_0x23a4('0x12')][_0x23a4('0x14')]);return _0x5c5dbe(_0x5f3913[_0x23a4('0x12')][_0x23a4('0x14')]);}else{logger[_0x23a4('0xc')](_0x23a4('0xd'),_0x45a727,'request\x20sent');_0x5c5dbe(_0x5f3913[_0x23a4('0x15')][_0x23a4('0x14')]);}})['catch'](function(_0x431b42){logger[_0x23a4('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x45a727,_0x431b42);_0x42b11a(_0x431b42);});});} \ No newline at end of file +var _0xd4f8=['../../config/logger','../../config/environment','jayson/promise','client','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x522ae8,_0x3b637e){var _0x3189b9=function(_0x3115d4){while(--_0x3115d4){_0x522ae8['push'](_0x522ae8['shift']());}};_0x3189b9(++_0x3b637e);}(_0xd4f8,0xae));var _0x8d4f=function(_0x5a13ba,_0x4702e9){_0x5a13ba=_0x5a13ba-0x0;var _0x425288=_0xd4f8[_0x5a13ba];return _0x425288;};'use strict';var _=require(_0x8d4f('0x0'));var util=require(_0x8d4f('0x1'));var moment=require('moment');var BPromise=require(_0x8d4f('0x2'));var rs=require(_0x8d4f('0x3'));var fs=require('fs');var Redis=require(_0x8d4f('0x4'));var db=require(_0x8d4f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8d4f('0x6'))('rpc');var config=require(_0x8d4f('0x7'));var jayson=require(_0x8d4f('0x8'));var client=jayson[_0x8d4f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2adc56,_0x2f81dc,_0x590e61){return new BPromise(function(_0x2ed4c0,_0xc84d4e){return client[_0x8d4f('0xa')](_0x2adc56,_0x590e61)[_0x8d4f('0xb')](function(_0x44c119){logger[_0x8d4f('0xc')](_0x8d4f('0xd'),_0x2f81dc,_0x8d4f('0xe'));logger['debug']('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x2f81dc,_0x8d4f('0xe'),JSON[_0x8d4f('0xf')](_0x44c119));if(_0x44c119[_0x8d4f('0x10')]){if(_0x44c119[_0x8d4f('0x10')][_0x8d4f('0x11')]===0x1f4){logger['error'](_0x8d4f('0xd'),_0x2f81dc,_0x44c119[_0x8d4f('0x10')][_0x8d4f('0x12')]);return _0xc84d4e(_0x44c119[_0x8d4f('0x10')][_0x8d4f('0x12')]);}logger[_0x8d4f('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x2f81dc,_0x44c119[_0x8d4f('0x10')][_0x8d4f('0x12')]);return _0x2ed4c0(_0x44c119['error'][_0x8d4f('0x12')]);}else{logger[_0x8d4f('0xc')](_0x8d4f('0xd'),_0x2f81dc,_0x8d4f('0xe'));_0x2ed4c0(_0x44c119['result'][_0x8d4f('0x12')]);}})[_0x8d4f('0x13')](function(_0x1cd78a){logger['error'](_0x8d4f('0xd'),_0x2f81dc,_0x1cd78a);_0xc84d4e(_0x1cd78a);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index fff6a04..9025147 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 _0xef6f=['runTranscribe','update','delete','/:id','destroy','exports','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','index','/describe','describe','isAuthenticated','/:id/download','downloads','/:id/transcribe','downloadTranscribe','post','create'];(function(_0x31cd2a,_0x1c57ac){var _0x1a85ba=function(_0x3a2568){while(--_0x3a2568){_0x31cd2a['push'](_0x31cd2a['shift']());}};_0x1a85ba(++_0x1c57ac);}(_0xef6f,0xf8));var _0xfef6=function(_0xddd0f9,_0x1f7bf4){_0xddd0f9=_0xddd0f9-0x0;var _0x1b41b9=_0xef6f[_0xddd0f9];return _0x1b41b9;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xfef6('0x0'));var express=require(_0xfef6('0x1'));var router=express[_0xfef6('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfef6('0x3'));var config=require(_0xfef6('0x4'));var controller=require('./voiceRecording.controller');router[_0xfef6('0x5')]('/',auth['isAuthenticated'](),controller[_0xfef6('0x6')]);router[_0xfef6('0x5')](_0xfef6('0x7'),auth['isAuthenticated'](),controller[_0xfef6('0x8')]);router[_0xfef6('0x5')]('/:id',auth[_0xfef6('0x9')](),controller['show']);router[_0xfef6('0x5')](_0xfef6('0xa'),auth[_0xfef6('0x9')](),controller['download']);router['get']('/:id/downloads',controller[_0xfef6('0xb')]);router[_0xfef6('0x5')](_0xfef6('0xc'),auth[_0xfef6('0x9')](),controller[_0xfef6('0xd')]);router[_0xfef6('0xe')]('/',auth[_0xfef6('0x9')](),controller[_0xfef6('0xf')]);router[_0xfef6('0xe')]('/:id/transcribe',auth['isAuthenticated'](),controller[_0xfef6('0x10')]);router['put']('/:id',auth[_0xfef6('0x9')](),controller[_0xfef6('0x11')]);router[_0xfef6('0x12')](_0xfef6('0x13'),auth['isAuthenticated'](),controller[_0xfef6('0x14')]);module[_0xfef6('0x15')]=router; \ No newline at end of file +var _0x46cb=['index','/describe','describe','/:id','show','/:id/download','download','downloads','/:id/transcribe','create','runTranscribe','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated'];(function(_0xa990b7,_0x26c527){var _0x52c99c=function(_0xf94328){while(--_0xf94328){_0xa990b7['push'](_0xa990b7['shift']());}};_0x52c99c(++_0x26c527);}(_0x46cb,0x127));var _0xb46c=function(_0x17a0a0,_0x1befaa){_0x17a0a0=_0x17a0a0-0x0;var _0x4da752=_0x46cb[_0x17a0a0];return _0x4da752;};'use strict';var multer=require(_0xb46c('0x0'));var util=require(_0xb46c('0x1'));var path=require(_0xb46c('0x2'));var timeout=require(_0xb46c('0x3'));var express=require(_0xb46c('0x4'));var router=express[_0xb46c('0x5')]();var fs_extra=require(_0xb46c('0x6'));var auth=require(_0xb46c('0x7'));var interaction=require(_0xb46c('0x8'));var config=require(_0xb46c('0x9'));var controller=require(_0xb46c('0xa'));router[_0xb46c('0xb')]('/',auth[_0xb46c('0xc')](),controller[_0xb46c('0xd')]);router[_0xb46c('0xb')](_0xb46c('0xe'),auth[_0xb46c('0xc')](),controller[_0xb46c('0xf')]);router[_0xb46c('0xb')](_0xb46c('0x10'),auth['isAuthenticated'](),controller[_0xb46c('0x11')]);router[_0xb46c('0xb')](_0xb46c('0x12'),auth[_0xb46c('0xc')](),controller[_0xb46c('0x13')]);router['get']('/:id/downloads',controller[_0xb46c('0x14')]);router[_0xb46c('0xb')](_0xb46c('0x15'),auth[_0xb46c('0xc')](),controller['downloadTranscribe']);router['post']('/',auth['isAuthenticated'](),controller[_0xb46c('0x16')]);router['post'](_0xb46c('0x15'),auth[_0xb46c('0xc')](),controller[_0xb46c('0x17')]);router[_0xb46c('0x18')]('/:id',auth[_0xb46c('0xc')](),controller[_0xb46c('0x19')]);router[_0xb46c('0x1a')](_0xb46c('0x10'),auth[_0xb46c('0xc')](),controller[_0xb46c('0x1b')]);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 f71e5f3..303705c 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(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_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 7664210..903b5ee 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 _0x5459=['count','offset','set','Content-Range','reject','save','update','then','destroy','end','error','name','index','map','rawAttributes','fieldName','type','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','VoiceRecording','include','rows','params','length','includeAll','catch','create','body','find','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','message','Not\x20found','downloads','sequelize','MD5','col','token','$and','push','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','Location','Bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','bucket','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','transcribeRegion','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','updateAttributes','writeFile','downloadTranscribe','fileText','root','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','crypto','querystring','aws-sdk','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit'];(function(_0x5bc3d8,_0x234136){var _0x3c2ee5=function(_0x3dded1){while(--_0x3dded1){_0x5bc3d8['push'](_0x5bc3d8['shift']());}};_0x3c2ee5(++_0x234136);}(_0x5459,0x112));var _0x9545=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x5459[_0x3ab9ee];return _0x82ee88;};'use strict';var emlformat=require(_0x9545('0x0'));var rimraf=require(_0x9545('0x1'));var zipdir=require(_0x9545('0x2'));var jsonpatch=require(_0x9545('0x3'));var rp=require(_0x9545('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9545('0x5'));var path=require(_0x9545('0x6'));var sox=require(_0x9545('0x7'));var csv=require(_0x9545('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(_0x9545('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9545('0x8'));var querystring=require(_0x9545('0xa'));var Papa=require('papaparse');var AWS=require(_0x9545('0xb'));var uuidv4=require('uuid/v4');var Redis=require(_0x9545('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x9545('0xd'));var as=require(_0x9545('0xe'));var hardwareService=require(_0x9545('0xf'));var logger=require(_0x9545('0x10'))('api');var utils=require(_0x9545('0x11'));var config=require(_0x9545('0x12'));var licenseUtil=require(_0x9545('0x13'));var db=require(_0x9545('0x14'))['db'];function respondWithStatusCode(_0x21b7ab,_0x350e1f){_0x350e1f=_0x350e1f||0xcc;return function(_0x3951dc){if(_0x3951dc){return _0x21b7ab[_0x9545('0x15')](_0x350e1f);}return _0x21b7ab[_0x9545('0x16')](_0x350e1f)['end']();};}function respondWithResult(_0x161925,_0x42a07e){_0x42a07e=_0x42a07e||0xc8;return function(_0x28c5e1){if(_0x28c5e1){return _0x161925[_0x9545('0x16')](_0x42a07e)[_0x9545('0x17')](_0x28c5e1);}};}function respondWithFilteredResult(_0x3872d2,_0x1131ef){return function(_0x51464d){if(_0x51464d){var _0xdcd3e5=typeof _0x1131ef['offset']===_0x9545('0x18')&&typeof _0x1131ef[_0x9545('0x19')]==='undefined';var _0x56249d=_0x51464d[_0x9545('0x1a')];var _0xe64a2=_0xdcd3e5?0x0:_0x1131ef['offset'];var _0x1a68a7=_0xdcd3e5?_0x51464d['count']:_0x1131ef[_0x9545('0x1b')]+_0x1131ef['limit'];var _0x36e67b;if(_0x1a68a7>=_0x56249d){_0x1a68a7=_0x56249d;_0x36e67b=0xc8;}else{_0x36e67b=0xce;}_0x3872d2[_0x9545('0x16')](_0x36e67b);return _0x3872d2[_0x9545('0x1c')](_0x9545('0x1d'),_0xe64a2+'-'+_0x1a68a7+'/'+_0x56249d)[_0x9545('0x17')](_0x51464d);}return null;};}function patchUpdates(_0x457f90){return function(_0x55d129){try{jsonpatch['apply'](_0x55d129,_0x457f90,!![]);}catch(_0x2f78ec){return BPromise[_0x9545('0x1e')](_0x2f78ec);}return _0x55d129[_0x9545('0x1f')]();};}function saveUpdates(_0x4454a2,_0x437ea9){return function(_0x437f72){if(_0x437f72){return _0x437f72[_0x9545('0x20')](_0x4454a2)[_0x9545('0x21')](function(_0x4bc6ad){return _0x4bc6ad;});}return null;};}function removeEntity(_0x19aedb,_0xd766ad){return function(_0x1736c2){if(_0x1736c2){return _0x1736c2[_0x9545('0x22')]()[_0x9545('0x21')](function(){_0x19aedb[_0x9545('0x16')](0xcc)[_0x9545('0x23')]();});}};}function handleEntityNotFound(_0x30874b,_0x3d0d86){return function(_0x3afef6){if(!_0x3afef6){_0x30874b[_0x9545('0x15')](0x194);}return _0x3afef6;};}function handleError(_0x2c23ff,_0x5b4182){_0x5b4182=_0x5b4182||0x1f4;return function(_0x4a5038){logger[_0x9545('0x24')](_0x4a5038['stack']);if(_0x4a5038[_0x9545('0x25')]){delete _0x4a5038[_0x9545('0x25')];}_0x2c23ff[_0x9545('0x16')](_0x5b4182)['send'](_0x4a5038);};}exports[_0x9545('0x26')]=function(_0xcb496c,_0x58b005){var _0x12ed9f={},_0x3268d8={},_0x5314ff={'count':0x0,'rows':[]};var _0x44453e=_[_0x9545('0x27')](db['VoiceRecording'][_0x9545('0x28')],function(_0x5771a2){return{'name':_0x5771a2[_0x9545('0x29')],'type':_0x5771a2[_0x9545('0x2a')]['key']};});_0x3268d8[_0x9545('0x2b')]=_[_0x9545('0x2c')](_[_0x9545('0x27')](_0x44453e,_0x9545('0x25')),[_0x9545('0x2d')]);_0x3268d8[_0x9545('0x2e')]=_[_0x9545('0x2f')](_0xcb496c[_0x9545('0x2e')]);_0x3268d8[_0x9545('0x30')]=_[_0x9545('0x31')](_0x3268d8[_0x9545('0x2b')],_0x3268d8[_0x9545('0x2e')]);_0x12ed9f[_0x9545('0x32')]=_[_0x9545('0x31')](_0x3268d8[_0x9545('0x2b')],qs[_0x9545('0x33')](_0xcb496c['query'][_0x9545('0x33')]));_0x12ed9f[_0x9545('0x32')]=_0x12ed9f['attributes']['length']?_0x12ed9f[_0x9545('0x32')]:_0x3268d8[_0x9545('0x2b')];if(!_0xcb496c[_0x9545('0x2e')][_0x9545('0x34')](_0x9545('0x35'))){_0x12ed9f[_0x9545('0x19')]=qs['limit'](_0xcb496c[_0x9545('0x2e')][_0x9545('0x19')]);_0x12ed9f['offset']=qs[_0x9545('0x1b')](_0xcb496c['query'][_0x9545('0x1b')]);}_0x12ed9f[_0x9545('0x36')]=qs[_0x9545('0x37')](_0xcb496c[_0x9545('0x2e')][_0x9545('0x37')]);_0x12ed9f[_0x9545('0x38')]=qs['filters'](_[_0x9545('0x39')](_0xcb496c[_0x9545('0x2e')],_0x3268d8[_0x9545('0x30')]),_0x44453e);if(_0xcb496c[_0x9545('0x2e')]['filter']){_0x12ed9f[_0x9545('0x38')]=_[_0x9545('0x3a')](_0x12ed9f[_0x9545('0x38')],{'$or':_[_0x9545('0x27')](_0x44453e,function(_0x3dc3b5){if(_0x3dc3b5[_0x9545('0x2a')]!==_0x9545('0x3b')){var _0x3fcf1c={};_0x3fcf1c[_0x3dc3b5[_0x9545('0x25')]]={'$like':'%'+_0xcb496c[_0x9545('0x2e')][_0x9545('0x3c')]+'%'};return _0x3fcf1c;}})});}_0x12ed9f=_['merge']({},_0x12ed9f,_0xcb496c[_0x9545('0x3d')]);var _0x30f86d={'where':_0x12ed9f['where']};return db[_0x9545('0x3e')][_0x9545('0x1a')](_0x30f86d)[_0x9545('0x21')](function(_0x3564d5){_0x5314ff[_0x9545('0x1a')]=_0x3564d5;if(_0xcb496c[_0x9545('0x2e')]['includeAll']){_0x12ed9f[_0x9545('0x3f')]=[{'all':!![]}];}return db[_0x9545('0x3e')]['findAll'](_0x12ed9f);})[_0x9545('0x21')](function(_0xde2d43){_0x5314ff[_0x9545('0x40')]=_0xde2d43;return _0x5314ff;})[_0x9545('0x21')](respondWithFilteredResult(_0x58b005,_0x12ed9f))['catch'](handleError(_0x58b005,null));};exports['show']=function(_0x4212bc,_0x25ad4d){var _0x3e7175={'raw':![],'where':{'id':_0x4212bc[_0x9545('0x41')]['id']}},_0x449ac6={};_0x449ac6[_0x9545('0x2b')]=_['keys'](db[_0x9545('0x3e')][_0x9545('0x28')]);_0x449ac6['query']=_['keys'](_0x4212bc[_0x9545('0x2e')]);_0x449ac6['filters']=_['intersection'](_0x449ac6[_0x9545('0x2b')],_0x449ac6[_0x9545('0x2e')]);_0x3e7175[_0x9545('0x32')]=_['intersection'](_0x449ac6[_0x9545('0x2b')],qs['fields'](_0x4212bc['query'][_0x9545('0x33')]));_0x3e7175[_0x9545('0x32')]=_0x3e7175['attributes'][_0x9545('0x42')]?_0x3e7175['attributes']:_0x449ac6[_0x9545('0x2b')];if(_0x4212bc['query'][_0x9545('0x43')]){_0x3e7175[_0x9545('0x3f')]=[{'all':!![]}];}_0x3e7175=_[_0x9545('0x3a')]({},_0x3e7175,_0x4212bc[_0x9545('0x3d')]);return db[_0x9545('0x3e')]['find'](_0x3e7175)['then'](handleEntityNotFound(_0x25ad4d,null))[_0x9545('0x21')](respondWithResult(_0x25ad4d,null))[_0x9545('0x44')](handleError(_0x25ad4d,null));};exports[_0x9545('0x45')]=function(_0x4356fd,_0x42848b){return db[_0x9545('0x3e')]['create'](_0x4356fd['body'],{})[_0x9545('0x21')](respondWithResult(_0x42848b,0xc9))[_0x9545('0x44')](handleError(_0x42848b,null));};exports[_0x9545('0x20')]=function(_0x30f3c9,_0x1f4bf6){if(_0x30f3c9[_0x9545('0x46')]['id']){delete _0x30f3c9['body']['id'];}return db[_0x9545('0x3e')][_0x9545('0x47')]({'where':{'id':_0x30f3c9['params']['id']}})[_0x9545('0x21')](handleEntityNotFound(_0x1f4bf6,null))[_0x9545('0x21')](saveUpdates(_0x30f3c9[_0x9545('0x46')],null))['then'](respondWithResult(_0x1f4bf6,null))[_0x9545('0x44')](handleError(_0x1f4bf6,null));};exports['describe']=function(_0x4e0bc8,_0x5b7cae){return db[_0x9545('0x3e')]['describe']()[_0x9545('0x21')](respondWithResult(_0x5b7cae,null))['catch'](handleError(_0x5b7cae,null));};exports[_0x9545('0x48')]=function(_0xb06a7a,_0x468946,_0xb48d2c){var _0x1096db=require(_0x9545('0x49'));var _0x28b0d8=![];var _0x5a88f1={};if(_0xb06a7a[_0x9545('0x2e')][_0x9545('0x2a')]&&_0xb06a7a[_0x9545('0x2e')][_0x9545('0x2a')]===_0x9545('0x4a')){_0x5a88f1[_0x9545('0x4a')]=_0xb06a7a['params']['id'];}else{_0x5a88f1['id']=_0xb06a7a['params']['id'];}return db['VoiceRecording'][_0x9545('0x47')]({'where':_0x5a88f1,'attributes':['id',_0x9545('0x4b')],'raw':!![]})[_0x9545('0x21')](handleEntityNotFound(_0x468946,null))[_0x9545('0x21')](function(_0x511387){if(_0x511387){var _0x45bded=_0x511387['value'];var _0x17dd99=util[_0x9545('0x2d')](_0x9545('0x4c'),_0x45bded);if(fs[_0x9545('0x4d')](_0x17dd99)){_0x28b0d8=!![];return _0x1096db[_0x9545('0x4e')](_0x17dd99,_0x45bded,config[_0x9545('0x4f')][_0x9545('0x50')])[_0x9545('0x21')](function(){return _0x511387;});}return _0x511387;}})[_0x9545('0x21')](function(_0x1bb4b2){if(_0x1bb4b2){var _0x6a74a2=_0x1bb4b2['value'];if(!fs['existsSync'](_0x6a74a2)){throw new db[(_0x9545('0x51'))][(_0x9545('0x52'))](_0x9545('0x53'));}if(_0x1bb4b2[_0x9545('0x54')]){return _0x468946[_0x9545('0x48')](_0x6a74a2,_0x1bb4b2[_0x9545('0x54')]+path['extname'](_0x6a74a2),function(){if(_0x28b0d8){fs[_0x9545('0x55')](_0x6a74a2);}});}else{return _0x468946[_0x9545('0x48')](_0x6a74a2,function(_0x497501){if(_0x28b0d8){fs[_0x9545('0x55')](_0x6a74a2);}});}}})[_0x9545('0x44')](function(_0x7083ea){if(_0x7083ea[_0x9545('0x56')]===_0x9545('0x53')){_0x468946[_0x9545('0x16')](0x194)['send'](_0x9545('0x57'));}else{return handleError(_0x468946,null);}});};exports[_0x9545('0x58')]=function(_0x4e591e,_0x30f665,_0x356c92){var _0x507b2e=require(_0x9545('0x49'));var _0x8914fc=![];var _0x2101f3={'$and':[db[_0x9545('0x59')][_0x9545('0x38')](db[_0x9545('0x59')]['fn'](_0x9545('0x5a'),db[_0x9545('0x59')][_0x9545('0x5b')]('uniqueid')),_0x4e591e['query'][_0x9545('0x5c')])]};if(_0x4e591e['query']['type']&&_0x4e591e[_0x9545('0x2e')][_0x9545('0x2a')]===_0x9545('0x4a')){_0x2101f3[_0x9545('0x5d')][_0x9545('0x5e')]({'uniqueid':_0x4e591e['params']['id']});}else{_0x2101f3[_0x9545('0x5d')]['push']({'id':_0x4e591e[_0x9545('0x41')]['id']});}return db['VoiceRecording'][_0x9545('0x47')]({'where':_0x2101f3,'attributes':['id',_0x9545('0x4b')],'raw':!![]})[_0x9545('0x21')](handleEntityNotFound(_0x30f665,null))[_0x9545('0x21')](function(_0x546092){if(_0x546092){var _0x3e5bf2=util[_0x9545('0x2d')](_0x9545('0x4c'),_0x546092[_0x9545('0x4b')]);if(fs[_0x9545('0x4d')](_0x3e5bf2)){_0x8914fc=!![];return _0x507b2e[_0x9545('0x4e')](_0x3e5bf2,_0x546092[_0x9545('0x4b')],config[_0x9545('0x4f')][_0x9545('0x50')])['then'](function(){return _0x546092;});}return _0x546092;}})['then'](function(_0x1a1400){if(_0x1a1400){if(!fs[_0x9545('0x4d')](_0x1a1400[_0x9545('0x4b')])){throw new db[(_0x9545('0x51'))][(_0x9545('0x52'))]('VoiceRecording\x20not\x20found');}if(_0x1a1400[_0x9545('0x54')]){return _0x30f665[_0x9545('0x48')](_0x1a1400['value'],_0x1a1400[_0x9545('0x54')]+path['extname'](_0x1a1400['value']),function(){if(_0x8914fc){fs[_0x9545('0x55')](_0x1a1400[_0x9545('0x4b')]);}});}else{return _0x30f665[_0x9545('0x48')](_0x1a1400[_0x9545('0x4b')],function(_0x17be66){if(_0x8914fc){fs[_0x9545('0x55')](_0x1a1400[_0x9545('0x4b')]);}});}}})[_0x9545('0x44')](handleError(_0x30f665,null));};exports[_0x9545('0x22')]=function(_0x2c716b,_0x4f8444){return db['VoiceRecording'][_0x9545('0x47')]({'where':{'id':_0x2c716b['params']['id']}})[_0x9545('0x21')](function(_0x44f011){if(_[_0x9545('0x5f')](_0x44f011)){throw new ReferenceError(_0x9545('0x60'));}return _0x44f011;})[_0x9545('0x21')](function(_0x3b2b8a){var _0x1458c8=_0x3b2b8a[_0x9545('0x4b')];logger[_0x9545('0x61')](_0x9545('0x62'),_0x1458c8);if(!_[_0x9545('0x5f')](_0x3b2b8a['value'])&&fs[_0x9545('0x4d')](_0x1458c8)){logger[_0x9545('0x61')](_0x9545('0x63')+_0x1458c8+_0x9545('0x64'));fs['unlinkSync'](_0x1458c8);}_0x1458c8=_0x1458c8+_0x9545('0x65');if(!_[_0x9545('0x5f')](_0x3b2b8a[_0x9545('0x4b')])&&fs[_0x9545('0x4d')](_0x1458c8)){logger[_0x9545('0x61')](_0x9545('0x63')+_0x1458c8+_0x9545('0x64'));fs['unlinkSync'](_0x1458c8);}return _0x3b2b8a;})[_0x9545('0x21')](function(_0xc8b911){if(!_0xc8b911)throw new InternalError();return _0xc8b911[_0x9545('0x22')]();})[_0x9545('0x21')](function(){_0x4f8444[_0x9545('0x16')](0xcc)[_0x9545('0x23')]();})[_0x9545('0x44')](handleError(_0x4f8444,null));};function getBucketslist(_0x24ac2d,_0x581f6f,_0x481bf1){return new Promise(function(_0x2f465c,_0x2f7e0d){var _0x3bbd71=new AWS['S3']({'accessKeyId':_0x581f6f,'secretAccessKey':_0x24ac2d,'region':_0x481bf1});_0x3bbd71[_0x9545('0x66')]({},function(_0xef1d54,_0x33b35d){if(_0xef1d54){return _0x2f7e0d(_0xef1d54);}else{return _0x2f465c(_0x33b35d);}});});}function createBucket(_0x4567a9,_0x184596,_0x4d5373,_0x3ca4e2){return new Promise(function(_0x4acc5c,_0x13c049){var _0x3b7923=new AWS['S3']({'accessKeyId':_0x184596,'secretAccessKey':_0x4567a9,'region':_0x4d5373});_0x3b7923[_0x9545('0x67')]({'Bucket':_0x3ca4e2},function(_0xdd1830,_0x3a62c0){if(_0xdd1830){return _0x13c049(_0xdd1830);}else{return _0x4acc5c(_0x3a62c0);}});});}function uploadFile(_0x3abbaa,_0x12a863,_0x2ef075,_0x1aa8aa,_0x51fe7b,_0x219516){return new Promise(function(_0x5bffa2,_0xe77920){var _0x3446a4=new AWS['S3']({'accessKeyId':_0x12a863,'secretAccessKey':_0x3abbaa,'region':_0x2ef075});_0x3446a4[_0x9545('0x68')]({'Bucket':_0x1aa8aa,'Key':_0x51fe7b,'Body':_0x219516},function(_0x34ac56,_0x40b93b){if(_0x34ac56){return _0xe77920(_0x34ac56);}else{return _0x5bffa2(_0x40b93b);}});});}function startTranscribe(_0x135cc8,_0x1f8506,_0x1823b1,_0x3423ac,_0x5c5bc4,_0x553003){return new Promise(function(_0xb417c7,_0x267b8f){var _0x1b8ed2=new AWS[(_0x9545('0x69'))]({'accessKeyId':_0x1f8506,'secretAccessKey':_0x135cc8,'region':_0x1823b1});_0x1b8ed2[_0x9545('0x6a')]({'TranscriptionJobName':_0x3423ac,'LanguageCode':_0x5c5bc4,'Media':{'MediaFileUri':_0x553003}},function(_0x52bfd3,_0x58ef7e){if(_0x52bfd3){return _0x267b8f(_0x52bfd3);}else{return _0xb417c7(_0x58ef7e);}});});}function transcribe(_0x462029,_0x2d4f43,_0x250acb,_0x46b99c,_0x48ee32,_0x168191,_0x5bfc20){return new Promise(function(_0x368af9,_0xa06c47){var _0x251469={};logger[_0x9545('0x61')](util[_0x9545('0x2d')](_0x9545('0x6b'),_0x462029,_0x48ee32));return uploadFile(_0x2d4f43,_0x250acb,_0x46b99c,_0x48ee32,path[_0x9545('0x6c')](_0x168191),fs['readFileSync'](_0x168191))['then'](function(_0x48490e){logger['info'](util[_0x9545('0x2d')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x462029,_0x48ee32,_0x48490e[_0x9545('0x6d')]));_0x251469['bucket']=_0x48490e[_0x9545('0x6e')];_0x251469['location']=_0x48490e[_0x9545('0x6d')];logger[_0x9545('0x61')](util['format'](_0x9545('0x6f'),_0x462029));return startTranscribe(_0x2d4f43,_0x250acb,_0x46b99c,uuidv4(),_0x5bfc20,_0x48490e[_0x9545('0x6d')]);})['then'](function(_0x5df0b8){logger[_0x9545('0x61')](util['format'](_0x9545('0x70'),_0x462029,_0x5df0b8[_0x9545('0x71')][_0x9545('0x72')]));_0x251469[_0x9545('0x73')]=_0x5df0b8[_0x9545('0x71')][_0x9545('0x72')];_0x251469['transcribeStatus']=_0x5df0b8[_0x9545('0x71')][_0x9545('0x74')];return _0x368af9(_0x251469);})[_0x9545('0x44')](function(_0x1e9a45){return _0xa06c47(_0x1e9a45);});});}exports[_0x9545('0x75')]=function(_0x3f1f84,_0x1fe7a9,_0x70e819){var _0x292824;var _0x5d5712;var _0x19c336;var _0x2077a0=require(_0x9545('0x49'));return db[_0x9545('0x3e')][_0x9545('0x76')]({'where':{'id':_0x3f1f84[_0x9545('0x41')]['id']}})[_0x9545('0x21')](function(_0x56a2cc){if(_0x56a2cc){var _0x4f0ebc=util[_0x9545('0x2d')](_0x9545('0x4c'),_0x56a2cc['value']);if(fs['existsSync'](_0x4f0ebc)){cypher=!![];return _0x2077a0[_0x9545('0x4e')](_0x4f0ebc,_0x56a2cc[_0x9545('0x4b')],config[_0x9545('0x4f')][_0x9545('0x50')])[_0x9545('0x21')](function(){return _0x56a2cc;});}return _0x56a2cc;}})['then'](function(_0x1d09fa){if(!_0x1d09fa){throw new db[(_0x9545('0x51'))][(_0x9545('0x52'))](_0x9545('0x77'));}_0x5d5712=_0x1d09fa;return db[_0x9545('0x78')]['findOne']({'where':{'id':0x1}});})[_0x9545('0x21')](handleEntityNotFound(_0x1fe7a9,null))['then'](function(_0x1b71f2){if(_0x1b71f2){_0x292824=_0x1b71f2;if(!_0x292824[_0x9545('0x79')]||!_0x292824[_0x9545('0x7a')]||!_0x292824['transcribeRegion']||!_0x292824['language']||!_0x292824[_0x9545('0x7b')]){throw new db['Sequelize'][(_0x9545('0x52'))](_0x9545('0x7c'));}if(_0x3f1f84[_0x9545('0x46')][_0x9545('0x7d')]&&(!_0x292824[_0x9545('0x7e')]||!_0x292824[_0x9545('0x7f')]||!_0x292824[_0x9545('0x80')]||!_0x292824[_0x9545('0x81')]||!_0x292824[_0x9545('0x7b')])){throw new db[(_0x9545('0x51'))][(_0x9545('0x52'))](_0x9545('0x82'));}return db[_0x9545('0x83')][_0x9545('0x76')]({'where':{'id':_0x292824['transcribeAccountId']}});}})[_0x9545('0x21')](function(_0x449e0e){if(!_0x449e0e){throw new db[(_0x9545('0x51'))][(_0x9545('0x52'))](_0x9545('0x84'));}if(!_0x449e0e[_0x9545('0x85')]||!_0x449e0e[_0x9545('0x86')]){throw new db[(_0x9545('0x51'))][(_0x9545('0x52'))](_0x9545('0x87'));}_0x19c336=_0x449e0e;return getBucketslist(_0x19c336[_0x9545('0x85')],_0x19c336[_0x9545('0x86')],_0x292824[_0x9545('0x88')]);})[_0x9545('0x21')](function(_0x35e936){if(_0x35e936&&_0x35e936['Buckets']){var _0x594382=_['find'](_0x35e936['Buckets'],function(_0x59f48e){return _0x59f48e[_0x9545('0x89')]===_0x292824['bucket'];});if(!_0x594382){logger[_0x9545('0x61')](util[_0x9545('0x2d')](_0x9545('0x8a'),_0x3f1f84[_0x9545('0x41')]['id'],_0x292824[_0x9545('0x7b')]));return createBucket(_0x19c336['data1'],_0x19c336[_0x9545('0x86')],_0x292824[_0x9545('0x88')],_0x292824[_0x9545('0x7b')]);}logger[_0x9545('0x61')](util[_0x9545('0x2d')](_0x9545('0x8b'),_0x3f1f84[_0x9545('0x41')]['id'],_0x292824[_0x9545('0x7b')]));return;}})['then'](function(_0x497f62){if(_0x5d5712[_0x9545('0x8c')]===_0x9545('0x8d')){return transcribe(_0x3f1f84['params']['id'],_0x19c336[_0x9545('0x85')],_0x19c336[_0x9545('0x86')],_0x292824[_0x9545('0x88')],_0x292824[_0x9545('0x7b')],_0x5d5712[_0x9545('0x4b')],_0x292824[_0x9545('0x81')]);}else{logger['info'](util[_0x9545('0x2d')](_0x9545('0x8e'),_0x3f1f84[_0x9545('0x41')]['id']));return{'transcribeStatus':_0x9545('0x8f')};}})[_0x9545('0x21')](function(_0x3c09c2){if(_0x3c09c2){_0x3c09c2['tempSentiment']=_0x3f1f84[_0x9545('0x46')]['runSentiment'];return _0x5d5712[_0x9545('0x90')](_0x3c09c2);}})[_0x9545('0x21')](respondWithResult(_0x1fe7a9,null))[_0x9545('0x44')](handleError(_0x1fe7a9,null));};function writeFile(_0x550817,_0x24000a){return new Promise(function(_0x1405f4,_0x3aa195){fs[_0x9545('0x91')](_0x24000a,_0x550817,function(_0x13c43b,_0xd60810){if(_0x13c43b){return _0x3aa195(_0x13c43b);}else{return _0x1405f4(_0xd60810);}});});}exports[_0x9545('0x92')]=function(_0x54373f,_0x2e85d4,_0x12f736){return db[_0x9545('0x3e')]['findOne']({'where':{'id':_0x54373f[_0x9545('0x41')]['id']}})[_0x9545('0x21')](handleEntityNotFound(_0x2e85d4))[_0x9545('0x21')](function(_0x357a18){if(_0x357a18&&_0x357a18[_0x9545('0x93')]){var _0x5b786b=_0x357a18['fileText'];var _0x112ffc=config[_0x9545('0x94')]+'/server/files/transcribes/transcribe_'+_0x357a18['id']+'.txt';if(fs[_0x9545('0x4d')](_0x112ffc)){return _0x112ffc;}return writeFile(_0x5b786b,_0x112ffc)[_0x9545('0x21')](function(){return _0x112ffc;});}else{throw new db[(_0x9545('0x51'))]['ValidationError'](_0x9545('0x95'));}})[_0x9545('0x21')](function(_0x16bf97){return _0x2e85d4[_0x9545('0x48')](_0x16bf97);})['catch'](handleError(_0x2e85d4));}; \ No newline at end of file +var _0x3c7e=['intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceRecording','include','findAll','rows','show','params','find','catch','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','decryptFile','secrets','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','MD5','sequelize','col','$and','push','existsSync','recording','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','createBucket','upload','TranscribeService','startTranscriptionJob','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','transcribeName','TranscriptionJobStatus','runTranscribe','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribe','transcribeRegion','bucket','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','updateAttributes','writeFile','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','map','fieldName','type','key','model','differenceBy','format','keys','query','filters','attributes'];(function(_0x483f13,_0x100cdf){var _0xf62bd0=function(_0x426aee){while(--_0x426aee){_0x483f13['push'](_0x483f13['shift']());}};_0xf62bd0(++_0x100cdf);}(_0x3c7e,0x101));var _0xe3c7=function(_0x430e15,_0x4ae0f2){_0x430e15=_0x430e15-0x0;var _0x16c170=_0x3c7e[_0x430e15];return _0x16c170;};'use strict';var emlformat=require(_0xe3c7('0x0'));var rimraf=require(_0xe3c7('0x1'));var zipdir=require(_0xe3c7('0x2'));var jsonpatch=require(_0xe3c7('0x3'));var rp=require('request-promise');var moment=require(_0xe3c7('0x4'));var BPromise=require(_0xe3c7('0x5'));var Mustache=require(_0xe3c7('0x6'));var util=require(_0xe3c7('0x7'));var path=require(_0xe3c7('0x8'));var sox=require('sox');var csv=require(_0xe3c7('0x9'));var ejs=require(_0xe3c7('0xa'));var fs=require('fs');var fs_extra=require(_0xe3c7('0xb'));var _=require(_0xe3c7('0xc'));var squel=require('squel');var crypto=require(_0xe3c7('0xd'));var jsforce=require(_0xe3c7('0xe'));var deskjs=require(_0xe3c7('0xf'));var toCsv=require(_0xe3c7('0x9'));var querystring=require(_0xe3c7('0x10'));var Papa=require(_0xe3c7('0x11'));var AWS=require(_0xe3c7('0x12'));var uuidv4=require(_0xe3c7('0x13'));var Redis=require('ioredis');var authService=require(_0xe3c7('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xe3c7('0x15'));var hardwareService=require(_0xe3c7('0x16'));var logger=require(_0xe3c7('0x17'))(_0xe3c7('0x18'));var utils=require(_0xe3c7('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe3c7('0x1a'))['db'];function respondWithStatusCode(_0x702329,_0x177da2){_0x177da2=_0x177da2||0xcc;return function(_0x284cf0){if(_0x284cf0){return _0x702329[_0xe3c7('0x1b')](_0x177da2);}return _0x702329[_0xe3c7('0x1c')](_0x177da2)[_0xe3c7('0x1d')]();};}function respondWithResult(_0x47bc9d,_0x6e19ad){_0x6e19ad=_0x6e19ad||0xc8;return function(_0x3a4abc){if(_0x3a4abc){return _0x47bc9d[_0xe3c7('0x1c')](_0x6e19ad)['json'](_0x3a4abc);}};}function respondWithFilteredResult(_0x23ede8,_0x275f81){return function(_0x3ea169){if(_0x3ea169){var _0x237c7d=typeof _0x275f81[_0xe3c7('0x1e')]==='undefined'&&typeof _0x275f81['limit']==='undefined';var _0x2d593b=_0x3ea169[_0xe3c7('0x1f')];var _0x44c26a=_0x237c7d?0x0:_0x275f81[_0xe3c7('0x1e')];var _0x980038=_0x237c7d?_0x3ea169[_0xe3c7('0x1f')]:_0x275f81[_0xe3c7('0x1e')]+_0x275f81[_0xe3c7('0x20')];var _0x5d5cfa;if(_0x980038>=_0x2d593b){_0x980038=_0x2d593b;_0x5d5cfa=0xc8;}else{_0x5d5cfa=0xce;}_0x23ede8[_0xe3c7('0x1c')](_0x5d5cfa);return _0x23ede8[_0xe3c7('0x21')](_0xe3c7('0x22'),_0x44c26a+'-'+_0x980038+'/'+_0x2d593b)[_0xe3c7('0x23')](_0x3ea169);}return null;};}function patchUpdates(_0xe34bef){return function(_0x44080c){try{jsonpatch[_0xe3c7('0x24')](_0x44080c,_0xe34bef,!![]);}catch(_0x1a434d){return BPromise[_0xe3c7('0x25')](_0x1a434d);}return _0x44080c[_0xe3c7('0x26')]();};}function saveUpdates(_0x62af3d,_0x13c6e7){return function(_0x511ddc){if(_0x511ddc){return _0x511ddc[_0xe3c7('0x27')](_0x62af3d)[_0xe3c7('0x28')](function(_0x3ff93a){return _0x3ff93a;});}return null;};}function removeEntity(_0x3f9577,_0x28bf92){return function(_0x3fb2a2){if(_0x3fb2a2){return _0x3fb2a2[_0xe3c7('0x29')]()[_0xe3c7('0x28')](function(){_0x3f9577[_0xe3c7('0x1c')](0xcc)[_0xe3c7('0x1d')]();});}};}function handleEntityNotFound(_0x124c76,_0x1784bc){return function(_0x502213){if(!_0x502213){_0x124c76[_0xe3c7('0x1b')](0x194);}return _0x502213;};}function handleError(_0x41683,_0x217998){_0x217998=_0x217998||0x1f4;return function(_0x5630b3){logger[_0xe3c7('0x2a')](_0x5630b3['stack']);if(_0x5630b3[_0xe3c7('0x2b')]){delete _0x5630b3['name'];}_0x41683[_0xe3c7('0x1c')](_0x217998)[_0xe3c7('0x2c')](_0x5630b3);};}exports[_0xe3c7('0x2d')]=function(_0x2fcc23,_0x33cc60){var _0x381679={},_0x54bf7e={},_0x2df42a={'count':0x0,'rows':[]};var _0x4d8621=_[_0xe3c7('0x2e')](db['VoiceRecording']['rawAttributes'],function(_0xc68983){return{'name':_0xc68983[_0xe3c7('0x2f')],'type':_0xc68983[_0xe3c7('0x30')][_0xe3c7('0x31')]};});_0x54bf7e[_0xe3c7('0x32')]=_[_0xe3c7('0x33')](_[_0xe3c7('0x2e')](_0x4d8621,_0xe3c7('0x2b')),[_0xe3c7('0x34')]);_0x54bf7e['query']=_[_0xe3c7('0x35')](_0x2fcc23[_0xe3c7('0x36')]);_0x54bf7e[_0xe3c7('0x37')]=_['intersection'](_0x54bf7e['model'],_0x54bf7e[_0xe3c7('0x36')]);_0x381679[_0xe3c7('0x38')]=_[_0xe3c7('0x39')](_0x54bf7e['model'],qs[_0xe3c7('0x3a')](_0x2fcc23[_0xe3c7('0x36')]['fields']));_0x381679[_0xe3c7('0x38')]=_0x381679['attributes'][_0xe3c7('0x3b')]?_0x381679[_0xe3c7('0x38')]:_0x54bf7e[_0xe3c7('0x32')];if(!_0x2fcc23[_0xe3c7('0x36')][_0xe3c7('0x3c')](_0xe3c7('0x3d'))){_0x381679['limit']=qs[_0xe3c7('0x20')](_0x2fcc23[_0xe3c7('0x36')][_0xe3c7('0x20')]);_0x381679[_0xe3c7('0x1e')]=qs[_0xe3c7('0x1e')](_0x2fcc23[_0xe3c7('0x36')][_0xe3c7('0x1e')]);}_0x381679[_0xe3c7('0x3e')]=qs[_0xe3c7('0x3f')](_0x2fcc23[_0xe3c7('0x36')][_0xe3c7('0x3f')]);_0x381679[_0xe3c7('0x40')]=qs[_0xe3c7('0x37')](_[_0xe3c7('0x41')](_0x2fcc23[_0xe3c7('0x36')],_0x54bf7e['filters']),_0x4d8621);if(_0x2fcc23[_0xe3c7('0x36')][_0xe3c7('0x42')]){_0x381679[_0xe3c7('0x40')]=_[_0xe3c7('0x43')](_0x381679['where'],{'$or':_[_0xe3c7('0x2e')](_0x4d8621,function(_0x5876d8){if(_0x5876d8[_0xe3c7('0x30')]!==_0xe3c7('0x44')){var _0x1734a3={};_0x1734a3[_0x5876d8[_0xe3c7('0x2b')]]={'$like':'%'+_0x2fcc23[_0xe3c7('0x36')]['filter']+'%'};return _0x1734a3;}})});}_0x381679=_[_0xe3c7('0x43')]({},_0x381679,_0x2fcc23[_0xe3c7('0x45')]);var _0x48e823={'where':_0x381679[_0xe3c7('0x40')]};return db[_0xe3c7('0x46')][_0xe3c7('0x1f')](_0x48e823)['then'](function(_0x1d5459){_0x2df42a['count']=_0x1d5459;if(_0x2fcc23['query']['includeAll']){_0x381679[_0xe3c7('0x47')]=[{'all':!![]}];}return db['VoiceRecording'][_0xe3c7('0x48')](_0x381679);})[_0xe3c7('0x28')](function(_0x1bf218){_0x2df42a[_0xe3c7('0x49')]=_0x1bf218;return _0x2df42a;})['then'](respondWithFilteredResult(_0x33cc60,_0x381679))['catch'](handleError(_0x33cc60,null));};exports[_0xe3c7('0x4a')]=function(_0x23a53e,_0x2b4f54){var _0xaee45c={'raw':![],'where':{'id':_0x23a53e[_0xe3c7('0x4b')]['id']}},_0x3d344a={};_0x3d344a[_0xe3c7('0x32')]=_[_0xe3c7('0x35')](db[_0xe3c7('0x46')]['rawAttributes']);_0x3d344a[_0xe3c7('0x36')]=_[_0xe3c7('0x35')](_0x23a53e[_0xe3c7('0x36')]);_0x3d344a[_0xe3c7('0x37')]=_[_0xe3c7('0x39')](_0x3d344a[_0xe3c7('0x32')],_0x3d344a[_0xe3c7('0x36')]);_0xaee45c[_0xe3c7('0x38')]=_[_0xe3c7('0x39')](_0x3d344a[_0xe3c7('0x32')],qs['fields'](_0x23a53e[_0xe3c7('0x36')][_0xe3c7('0x3a')]));_0xaee45c['attributes']=_0xaee45c['attributes'][_0xe3c7('0x3b')]?_0xaee45c['attributes']:_0x3d344a[_0xe3c7('0x32')];if(_0x23a53e[_0xe3c7('0x36')]['includeAll']){_0xaee45c[_0xe3c7('0x47')]=[{'all':!![]}];}_0xaee45c=_[_0xe3c7('0x43')]({},_0xaee45c,_0x23a53e['options']);return db['VoiceRecording'][_0xe3c7('0x4c')](_0xaee45c)[_0xe3c7('0x28')](handleEntityNotFound(_0x2b4f54,null))['then'](respondWithResult(_0x2b4f54,null))[_0xe3c7('0x4d')](handleError(_0x2b4f54,null));};exports['create']=function(_0x4e11c9,_0x5a3cfb){return db[_0xe3c7('0x46')][_0xe3c7('0x4e')](_0x4e11c9[_0xe3c7('0x4f')],{})[_0xe3c7('0x28')](respondWithResult(_0x5a3cfb,0xc9))['catch'](handleError(_0x5a3cfb,null));};exports[_0xe3c7('0x27')]=function(_0xd81634,_0x363bbc){if(_0xd81634[_0xe3c7('0x4f')]['id']){delete _0xd81634[_0xe3c7('0x4f')]['id'];}return db[_0xe3c7('0x46')]['find']({'where':{'id':_0xd81634['params']['id']}})[_0xe3c7('0x28')](handleEntityNotFound(_0x363bbc,null))['then'](saveUpdates(_0xd81634['body'],null))[_0xe3c7('0x28')](respondWithResult(_0x363bbc,null))['catch'](handleError(_0x363bbc,null));};exports[_0xe3c7('0x50')]=function(_0x129e66,_0x2e818a){return db[_0xe3c7('0x46')][_0xe3c7('0x50')]()[_0xe3c7('0x28')](respondWithResult(_0x2e818a,null))[_0xe3c7('0x4d')](handleError(_0x2e818a,null));};exports[_0xe3c7('0x51')]=function(_0x470023,_0x582fea,_0x1478f9){var _0x1c8b59=require(_0xe3c7('0x52'));var _0x1a3098=![];var _0x457405={};if(_0x470023[_0xe3c7('0x36')]['type']&&_0x470023['query'][_0xe3c7('0x30')]===_0xe3c7('0x53')){_0x457405[_0xe3c7('0x53')]=_0x470023[_0xe3c7('0x4b')]['id'];}else{_0x457405['id']=_0x470023[_0xe3c7('0x4b')]['id'];}return db['VoiceRecording'][_0xe3c7('0x4c')]({'where':_0x457405,'attributes':['id',_0xe3c7('0x54')],'raw':!![]})[_0xe3c7('0x28')](handleEntityNotFound(_0x582fea,null))['then'](function(_0x542e2a){if(_0x542e2a){var _0x3ea450=_0x542e2a[_0xe3c7('0x54')];var _0x5929c8=util[_0xe3c7('0x34')](_0xe3c7('0x55'),_0x3ea450);if(fs['existsSync'](_0x5929c8)){_0x1a3098=!![];return _0x1c8b59[_0xe3c7('0x56')](_0x5929c8,_0x3ea450,config[_0xe3c7('0x57')]['recording'])[_0xe3c7('0x28')](function(){return _0x542e2a;});}return _0x542e2a;}})['then'](function(_0x1997f4){if(_0x1997f4){var _0x585a5b=_0x1997f4['value'];if(!fs['existsSync'](_0x585a5b)){throw new db[(_0xe3c7('0x58'))][(_0xe3c7('0x59'))](_0xe3c7('0x5a'));}if(_0x1997f4[_0xe3c7('0x5b')]){return _0x582fea['download'](_0x585a5b,_0x1997f4[_0xe3c7('0x5b')]+path[_0xe3c7('0x5c')](_0x585a5b),function(){if(_0x1a3098){fs[_0xe3c7('0x5d')](_0x585a5b);}});}else{return _0x582fea[_0xe3c7('0x51')](_0x585a5b,function(_0x277165){if(_0x1a3098){fs[_0xe3c7('0x5d')](_0x585a5b);}});}}})[_0xe3c7('0x4d')](function(_0x4c6d35){if(_0x4c6d35[_0xe3c7('0x5e')]===_0xe3c7('0x5a')){_0x582fea['status'](0x194)[_0xe3c7('0x2c')](_0xe3c7('0x5f'));}else{return handleError(_0x582fea,null);}});};exports[_0xe3c7('0x60')]=function(_0x36a2a0,_0x272406,_0xa0a302){var _0x50515d=require(_0xe3c7('0x52'));var _0x3694ca=![];var _0x1309d9={'$and':[db['sequelize']['where'](db['sequelize']['fn'](_0xe3c7('0x61'),db[_0xe3c7('0x62')][_0xe3c7('0x63')]('uniqueid')),_0x36a2a0[_0xe3c7('0x36')]['token'])]};if(_0x36a2a0[_0xe3c7('0x36')][_0xe3c7('0x30')]&&_0x36a2a0[_0xe3c7('0x36')][_0xe3c7('0x30')]==='uniqueid'){_0x1309d9['$and']['push']({'uniqueid':_0x36a2a0[_0xe3c7('0x4b')]['id']});}else{_0x1309d9[_0xe3c7('0x64')][_0xe3c7('0x65')]({'id':_0x36a2a0['params']['id']});}return db[_0xe3c7('0x46')][_0xe3c7('0x4c')]({'where':_0x1309d9,'attributes':['id',_0xe3c7('0x54')],'raw':!![]})[_0xe3c7('0x28')](handleEntityNotFound(_0x272406,null))[_0xe3c7('0x28')](function(_0x235204){if(_0x235204){var _0x59d569=util[_0xe3c7('0x34')](_0xe3c7('0x55'),_0x235204['value']);if(fs[_0xe3c7('0x66')](_0x59d569)){_0x3694ca=!![];return _0x50515d[_0xe3c7('0x56')](_0x59d569,_0x235204['value'],config[_0xe3c7('0x57')][_0xe3c7('0x67')])['then'](function(){return _0x235204;});}return _0x235204;}})[_0xe3c7('0x28')](function(_0x3eb19f){if(_0x3eb19f){if(!fs[_0xe3c7('0x66')](_0x3eb19f['value'])){throw new db[(_0xe3c7('0x58'))][(_0xe3c7('0x59'))](_0xe3c7('0x5a'));}if(_0x3eb19f['filename']){return _0x272406[_0xe3c7('0x51')](_0x3eb19f['value'],_0x3eb19f[_0xe3c7('0x5b')]+path[_0xe3c7('0x5c')](_0x3eb19f['value']),function(){if(_0x3694ca){fs[_0xe3c7('0x5d')](_0x3eb19f['value']);}});}else{return _0x272406[_0xe3c7('0x51')](_0x3eb19f[_0xe3c7('0x54')],function(_0x54ab43){if(_0x3694ca){fs['unlink'](_0x3eb19f[_0xe3c7('0x54')]);}});}}})[_0xe3c7('0x4d')](handleError(_0x272406,null));};exports[_0xe3c7('0x29')]=function(_0x33b060,_0x48dd66){return db['VoiceRecording'][_0xe3c7('0x4c')]({'where':{'id':_0x33b060[_0xe3c7('0x4b')]['id']}})['then'](function(_0x1bc612){if(_[_0xe3c7('0x68')](_0x1bc612)){throw new ReferenceError(_0xe3c7('0x69'));}return _0x1bc612;})['then'](function(_0x41b500){var _0x29e1d8=_0x41b500[_0xe3c7('0x54')];logger['info'](_0xe3c7('0x6a'),_0x29e1d8);if(!_['isNil'](_0x41b500['value'])&&fs[_0xe3c7('0x66')](_0x29e1d8)){logger[_0xe3c7('0x6b')](_0xe3c7('0x6c')+_0x29e1d8+_0xe3c7('0x6d'));fs['unlinkSync'](_0x29e1d8);}_0x29e1d8=_0x29e1d8+_0xe3c7('0x6e');if(!_[_0xe3c7('0x68')](_0x41b500[_0xe3c7('0x54')])&&fs[_0xe3c7('0x66')](_0x29e1d8)){logger[_0xe3c7('0x6b')]('File:\x20\x22'+_0x29e1d8+_0xe3c7('0x6d'));fs['unlinkSync'](_0x29e1d8);}return _0x41b500;})['then'](function(_0x1f2c8c){if(!_0x1f2c8c)throw new InternalError();return _0x1f2c8c[_0xe3c7('0x29')]();})[_0xe3c7('0x28')](function(){_0x48dd66[_0xe3c7('0x1c')](0xcc)[_0xe3c7('0x1d')]();})['catch'](handleError(_0x48dd66,null));};function getBucketslist(_0x259500,_0x3f498c,_0x3bc679){return new Promise(function(_0x395f9f,_0x3fa54b){var _0x4d7a82=new AWS['S3']({'accessKeyId':_0x3f498c,'secretAccessKey':_0x259500,'region':_0x3bc679});_0x4d7a82['listBuckets']({},function(_0x5c7035,_0x278d56){if(_0x5c7035){return _0x3fa54b(_0x5c7035);}else{return _0x395f9f(_0x278d56);}});});}function createBucket(_0x272bb4,_0x480b49,_0x492cad,_0x5667cb){return new Promise(function(_0x4718c4,_0xb770d8){var _0x1001ca=new AWS['S3']({'accessKeyId':_0x480b49,'secretAccessKey':_0x272bb4,'region':_0x492cad});_0x1001ca[_0xe3c7('0x6f')]({'Bucket':_0x5667cb},function(_0x371c98,_0x2f1af8){if(_0x371c98){return _0xb770d8(_0x371c98);}else{return _0x4718c4(_0x2f1af8);}});});}function uploadFile(_0x4394ae,_0x4e287e,_0x1d59ed,_0x327525,_0x43b5e1,_0x45ce1c){return new Promise(function(_0x36624c,_0x25aad1){var _0x15b447=new AWS['S3']({'accessKeyId':_0x4e287e,'secretAccessKey':_0x4394ae,'region':_0x1d59ed});_0x15b447[_0xe3c7('0x70')]({'Bucket':_0x327525,'Key':_0x43b5e1,'Body':_0x45ce1c},function(_0xf52766,_0x227a4e){if(_0xf52766){return _0x25aad1(_0xf52766);}else{return _0x36624c(_0x227a4e);}});});}function startTranscribe(_0x224042,_0x4994a1,_0x4deed3,_0x34cc27,_0x19d5cf,_0x527f44){return new Promise(function(_0x1f3435,_0x9a1e1d){var _0x44a556=new AWS[(_0xe3c7('0x71'))]({'accessKeyId':_0x4994a1,'secretAccessKey':_0x224042,'region':_0x4deed3});_0x44a556[_0xe3c7('0x72')]({'TranscriptionJobName':_0x34cc27,'LanguageCode':_0x19d5cf,'Media':{'MediaFileUri':_0x527f44}},function(_0x165801,_0x254a67){if(_0x165801){return _0x9a1e1d(_0x165801);}else{return _0x1f3435(_0x254a67);}});});}function transcribe(_0x561207,_0x284e28,_0xc90b34,_0x30c34d,_0xcbcfa4,_0x1d8526,_0x33fc62){return new Promise(function(_0x175bd4,_0x498a98){var _0x128ec6={};logger[_0xe3c7('0x6b')](util['format']('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x561207,_0xcbcfa4));return uploadFile(_0x284e28,_0xc90b34,_0x30c34d,_0xcbcfa4,path[_0xe3c7('0x73')](_0x1d8526),fs[_0xe3c7('0x74')](_0x1d8526))['then'](function(_0x497a87){logger[_0xe3c7('0x6b')](util['format'](_0xe3c7('0x75'),_0x561207,_0xcbcfa4,_0x497a87['Location']));_0x128ec6['bucket']=_0x497a87[_0xe3c7('0x76')];_0x128ec6[_0xe3c7('0x77')]=_0x497a87[_0xe3c7('0x78')];logger[_0xe3c7('0x6b')](util[_0xe3c7('0x34')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x561207));return startTranscribe(_0x284e28,_0xc90b34,_0x30c34d,uuidv4(),_0x33fc62,_0x497a87[_0xe3c7('0x78')]);})[_0xe3c7('0x28')](function(_0x4df5b4){logger[_0xe3c7('0x6b')](util[_0xe3c7('0x34')](_0xe3c7('0x79'),_0x561207,_0x4df5b4['TranscriptionJob'][_0xe3c7('0x7a')]));_0x128ec6[_0xe3c7('0x7b')]=_0x4df5b4['TranscriptionJob'][_0xe3c7('0x7a')];_0x128ec6['transcribeStatus']=_0x4df5b4['TranscriptionJob'][_0xe3c7('0x7c')];return _0x175bd4(_0x128ec6);})[_0xe3c7('0x4d')](function(_0x232dd8){return _0x498a98(_0x232dd8);});});}exports[_0xe3c7('0x7d')]=function(_0xc25d35,_0x596105,_0x330f49){var _0x15db9b;var _0x2de7c6;var _0x204e38;var _0x38e73f=require(_0xe3c7('0x52'));return db[_0xe3c7('0x46')]['findOne']({'where':{'id':_0xc25d35[_0xe3c7('0x4b')]['id']}})[_0xe3c7('0x28')](function(_0x4d62b1){if(_0x4d62b1){var _0x387331=util[_0xe3c7('0x34')](_0xe3c7('0x55'),_0x4d62b1[_0xe3c7('0x54')]);if(fs[_0xe3c7('0x66')](_0x387331)){cypher=!![];return _0x38e73f[_0xe3c7('0x56')](_0x387331,_0x4d62b1[_0xe3c7('0x54')],config[_0xe3c7('0x57')][_0xe3c7('0x67')])[_0xe3c7('0x28')](function(){return _0x4d62b1;});}return _0x4d62b1;}})['then'](function(_0x48af7e){if(!_0x48af7e){throw new db['Sequelize'][(_0xe3c7('0x59'))](_0xe3c7('0x7e'));}_0x2de7c6=_0x48af7e;return db[_0xe3c7('0x7f')][_0xe3c7('0x80')]({'where':{'id':0x1}});})[_0xe3c7('0x28')](handleEntityNotFound(_0x596105,null))[_0xe3c7('0x28')](function(_0x5bac3b){if(_0x5bac3b){_0x15db9b=_0x5bac3b;if(!_0x15db9b[_0xe3c7('0x81')]||!_0x15db9b['transcribeAccountId']||!_0x15db9b[_0xe3c7('0x82')]||!_0x15db9b['language']||!_0x15db9b[_0xe3c7('0x83')]){throw new db[(_0xe3c7('0x58'))][(_0xe3c7('0x59'))](_0xe3c7('0x84'));}if(_0xc25d35[_0xe3c7('0x4f')][_0xe3c7('0x85')]&&(!_0x15db9b[_0xe3c7('0x86')]||!_0x15db9b[_0xe3c7('0x87')]||!_0x15db9b[_0xe3c7('0x88')]||!_0x15db9b[_0xe3c7('0x89')]||!_0x15db9b[_0xe3c7('0x83')])){throw new db[(_0xe3c7('0x58'))][(_0xe3c7('0x59'))](_0xe3c7('0x8a'));}return db[_0xe3c7('0x8b')]['findOne']({'where':{'id':_0x15db9b[_0xe3c7('0x8c')]}});}})['then'](function(_0x415dd2){if(!_0x415dd2){throw new db['Sequelize'][(_0xe3c7('0x59'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x415dd2[_0xe3c7('0x8d')]||!_0x415dd2[_0xe3c7('0x8e')]){throw new db[(_0xe3c7('0x58'))]['ValidationError'](_0xe3c7('0x8f'));}_0x204e38=_0x415dd2;return getBucketslist(_0x204e38[_0xe3c7('0x8d')],_0x204e38[_0xe3c7('0x8e')],_0x15db9b['transcribeRegion']);})['then'](function(_0x5329da){if(_0x5329da&&_0x5329da[_0xe3c7('0x90')]){var _0x1ef396=_[_0xe3c7('0x4c')](_0x5329da['Buckets'],function(_0x3edab2){return _0x3edab2['Name']===_0x15db9b[_0xe3c7('0x83')];});if(!_0x1ef396){logger['info'](util[_0xe3c7('0x34')](_0xe3c7('0x91'),_0xc25d35['params']['id'],_0x15db9b[_0xe3c7('0x83')]));return createBucket(_0x204e38[_0xe3c7('0x8d')],_0x204e38[_0xe3c7('0x8e')],_0x15db9b[_0xe3c7('0x82')],_0x15db9b[_0xe3c7('0x83')]);}logger[_0xe3c7('0x6b')](util[_0xe3c7('0x34')](_0xe3c7('0x92'),_0xc25d35[_0xe3c7('0x4b')]['id'],_0x15db9b[_0xe3c7('0x83')]));return;}})[_0xe3c7('0x28')](function(_0x3d1955){if(_0x2de7c6[_0xe3c7('0x93')]===_0xe3c7('0x94')){return transcribe(_0xc25d35['params']['id'],_0x204e38['data1'],_0x204e38[_0xe3c7('0x8e')],_0x15db9b['transcribeRegion'],_0x15db9b['bucket'],_0x2de7c6[_0xe3c7('0x54')],_0x15db9b[_0xe3c7('0x89')]);}else{logger['info'](util[_0xe3c7('0x34')](_0xe3c7('0x95'),_0xc25d35[_0xe3c7('0x4b')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})['then'](function(_0x26ce23){if(_0x26ce23){_0x26ce23['tempSentiment']=_0xc25d35[_0xe3c7('0x4f')][_0xe3c7('0x85')];return _0x2de7c6[_0xe3c7('0x96')](_0x26ce23);}})[_0xe3c7('0x28')](respondWithResult(_0x596105,null))[_0xe3c7('0x4d')](handleError(_0x596105,null));};function writeFile(_0x1ece51,_0x51ad08){return new Promise(function(_0x1732e1,_0x3d50a8){fs[_0xe3c7('0x97')](_0x51ad08,_0x1ece51,function(_0x4460b0,_0x5064a1){if(_0x4460b0){return _0x3d50a8(_0x4460b0);}else{return _0x1732e1(_0x5064a1);}});});}exports['downloadTranscribe']=function(_0x5508f3,_0x550903,_0x375c87){return db[_0xe3c7('0x46')][_0xe3c7('0x80')]({'where':{'id':_0x5508f3[_0xe3c7('0x4b')]['id']}})[_0xe3c7('0x28')](handleEntityNotFound(_0x550903))['then'](function(_0x3d84f7){if(_0x3d84f7&&_0x3d84f7['fileText']){var _0x9974cd=_0x3d84f7[_0xe3c7('0x98')];var _0x1056dd=config[_0xe3c7('0x99')]+_0xe3c7('0x9a')+_0x3d84f7['id']+_0xe3c7('0x9b');if(fs[_0xe3c7('0x66')](_0x1056dd)){return _0x1056dd;}return writeFile(_0x9974cd,_0x1056dd)[_0xe3c7('0x28')](function(){return _0x1056dd;});}else{throw new db[(_0xe3c7('0x58'))][(_0xe3c7('0x59'))](_0xe3c7('0x9c'));}})[_0xe3c7('0x28')](function(_0x18cf41){return _0x550903['download'](_0x18cf41);})[_0xe3c7('0x4d')](handleError(_0x550903));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 72c6d11..2de3e85 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 _0x3036=['voice_recordings','transcribeStatus','define'];(function(_0x274dd7,_0x2e6051){var _0x148829=function(_0x4cec98){while(--_0x4cec98){_0x274dd7['push'](_0x274dd7['shift']());}};_0x148829(++_0x2e6051);}(_0x3036,0x1a9));var _0x6303=function(_0x366547,_0xc12254){_0x366547=_0x366547-0x0;var _0x418b5b=_0x3036[_0x366547];return _0x418b5b;};'use strict';var attributes=require('./voiceRecording.attributes');module['exports']=function(_0x7aa5f9,_0xd38168){return _0x7aa5f9[_0x6303('0x0')]('VoiceRecording',attributes,{'tableName':_0x6303('0x1'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']},{'name':'transcribeStatus','fields':[_0x6303('0x2')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd6d6=['VoiceRecording','voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes','exports'];(function(_0xf7224d,_0x2b8c21){var _0x525740=function(_0x10278d){while(--_0x10278d){_0xf7224d['push'](_0xf7224d['shift']());}};_0x525740(++_0x2b8c21);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x7b0715,_0x239b8f){_0x7b0715=_0x7b0715-0x0;var _0x4ec3a6=_0xd6d6[_0x7b0715];return _0x4ec3a6;};'use strict';var attributes=require(_0x6d6d('0x0'));module[_0x6d6d('0x1')]=function(_0x24bd2a,_0x33226e){return _0x24bd2a['define'](_0x6d6d('0x2'),attributes,{'tableName':_0x6d6d('0x3'),'paranoid':![],'indexes':[{'name':_0x6d6d('0x4'),'fields':[_0x6d6d('0x4')]},{'name':_0x6d6d('0x5'),'fields':[_0x6d6d('0x5')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index cb434c8..8187d7f 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 _0x5464=['UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','limit','stringify','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','existsSync','format','encryptFile','value','secrets','unlink','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','VoiceRecording,\x20%s,\x20%s','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch'];(function(_0x29a1bb,_0x52859d){var _0x19f85e=function(_0x1b1000){while(--_0x1b1000){_0x29a1bb['push'](_0x29a1bb['shift']());}};_0x19f85e(++_0x52859d);}(_0x5464,0x15d));var _0x4546=function(_0x5ecf54,_0x1649ed){_0x5ecf54=_0x5ecf54-0x0;var _0x561aad=_0x5464[_0x5ecf54];return _0x561aad;};'use strict';var _=require(_0x4546('0x0'));var util=require(_0x4546('0x1'));var moment=require(_0x4546('0x2'));var BPromise=require('bluebird');var rs=require(_0x4546('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4546('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4546('0x5'))(_0x4546('0x6'));var config=require(_0x4546('0x7'));var jayson=require(_0x4546('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5c5e09,_0x224c7c,_0x36c875){return new BPromise(function(_0x1a76c1,_0x2e860a){return client[_0x4546('0x9')](_0x5c5e09,_0x36c875)[_0x4546('0xa')](function(_0x11d63e){logger[_0x4546('0xb')](_0x4546('0xc'),_0x224c7c,'request\x20sent');logger[_0x4546('0xd')](_0x4546('0xe'),_0x224c7c,_0x4546('0xf'),JSON['stringify'](_0x11d63e));if(_0x11d63e[_0x4546('0x10')]){if(_0x11d63e[_0x4546('0x10')][_0x4546('0x11')]===0x1f4){logger[_0x4546('0x10')]('VoiceRecording,\x20%s,\x20%s',_0x224c7c,_0x11d63e['error'][_0x4546('0x12')]);return _0x2e860a(_0x11d63e['error']['message']);}logger['error']('VoiceRecording,\x20%s,\x20%s',_0x224c7c,_0x11d63e['error']['message']);return _0x1a76c1(_0x11d63e[_0x4546('0x10')]['message']);}else{logger[_0x4546('0xb')]('VoiceRecording,\x20%s,\x20%s',_0x224c7c,_0x4546('0xf'));_0x1a76c1(_0x11d63e['result'][_0x4546('0x12')]);}})[_0x4546('0x13')](function(_0x24b32a){logger[_0x4546('0x10')](_0x4546('0xc'),_0x224c7c,_0x24b32a);_0x2e860a(_0x24b32a);});});}exports[_0x4546('0x14')]=function(_0x57d8de){var _0x4ffd6b=this;return new Promise(function(_0x5780a7,_0x330235){return db[_0x4546('0x15')][_0x4546('0x16')](_0x57d8de[_0x4546('0x17')],{'raw':_0x57d8de[_0x4546('0x18')]?_0x57d8de[_0x4546('0x18')][_0x4546('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57d8de[_0x4546('0x18')]?_0x57d8de[_0x4546('0x18')][_0x4546('0x1a')]||null:null,'attributes':_0x57d8de['options']?_0x57d8de[_0x4546('0x18')][_0x4546('0x1b')]||null:null,'limit':_0x57d8de['options']?_0x57d8de[_0x4546('0x18')][_0x4546('0x1c')]||null:null})[_0x4546('0xa')](function(_0x2f065d){logger[_0x4546('0xb')](_0x4546('0x14'),_0x57d8de);logger['debug'](_0x4546('0x14'),_0x57d8de,JSON[_0x4546('0x1d')](_0x2f065d));_0x5780a7(_0x2f065d);})['catch'](function(_0x824698){logger[_0x4546('0x10')](_0x4546('0x14'),_0x824698[_0x4546('0x12')],_0x57d8de);_0x330235(_0x4ffd6b[_0x4546('0x10')](0x1f4,_0x824698['message']));});});};exports[_0x4546('0x1e')]=function(_0x3796fe){var _0x831fa5=this;return new Promise(function(_0x48fc36,_0x4c1dad){var _0x43740e=require(_0x4546('0x1f'));var _0x15611c;return db[_0x4546('0x20')][_0x4546('0x21')]({'attributes':['id',_0x4546('0x22')],'where':{'id':0x1},'raw':!![]})[_0x4546('0xa')](function(_0x586ff1){_0x15611c=_0x586ff1;return db[_0x4546('0x15')]['create'](_0x3796fe[_0x4546('0x17')]);})[_0x4546('0xa')](function(_0x5396c5){if(_0x15611c['callRecordingEncryption']&&fs[_0x4546('0x23')](_0x5396c5['value'])){var _0x3c7c7d=util[_0x4546('0x24')]('%s.cypher',_0x5396c5['value']);return _0x43740e[_0x4546('0x25')](_0x5396c5[_0x4546('0x26')],_0x3c7c7d,config[_0x4546('0x27')]['recording'])[_0x4546('0xa')](function(){fs[_0x4546('0x28')](_0x5396c5['value']);logger[_0x4546('0xb')]('CreateVoiceRecording\x20file\x20encrypted');return _0x5396c5;});}return _0x5396c5;})[_0x4546('0xa')](function(_0x44f604){logger[_0x4546('0xb')](_0x4546('0x1e'),_0x3796fe);logger['debug'](_0x4546('0x1e'),_0x3796fe,JSON[_0x4546('0x1d')](_0x44f604));_0x48fc36(_0x44f604);})[_0x4546('0x13')](function(_0x298bef){logger[_0x4546('0x10')](_0x4546('0x1e'),_0x298bef['message'],_0x3796fe);_0x4c1dad(_0x831fa5[_0x4546('0x10')](0x1f4,_0x298bef[_0x4546('0x12')]));});});}; \ No newline at end of file +var _0x5204=['attributes','limit','then','CreateVoiceRecording','../../components/encryptor','Setting','findOne','create','callRecordingEncryption','value','format','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','where'];(function(_0x345e1b,_0x5151c2){var _0x454302=function(_0x1eb18c){while(--_0x1eb18c){_0x345e1b['push'](_0x345e1b['shift']());}};_0x454302(++_0x5151c2);}(_0x5204,0xdf));var _0x4520=function(_0xc5a279,_0x155360){_0xc5a279=_0xc5a279-0x0;var _0xc755d3=_0x5204[_0xc5a279];return _0xc755d3;};'use strict';var _=require(_0x4520('0x0'));var util=require(_0x4520('0x1'));var moment=require('moment');var BPromise=require(_0x4520('0x2'));var rs=require(_0x4520('0x3'));var fs=require('fs');var Redis=require(_0x4520('0x4'));var db=require(_0x4520('0x5'))['db'];var utils=require(_0x4520('0x6'));var logger=require('../../config/logger')(_0x4520('0x7'));var config=require('../../config/environment');var jayson=require(_0x4520('0x8'));var client=jayson[_0x4520('0x9')][_0x4520('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe741c2,_0x396d29,_0x446dc9){return new BPromise(function(_0x27890f,_0x55b44f){return client[_0x4520('0xb')](_0xe741c2,_0x446dc9)['then'](function(_0x168e62){logger[_0x4520('0xc')](_0x4520('0xd'),_0x396d29,_0x4520('0xe'));logger[_0x4520('0xf')](_0x4520('0x10'),_0x396d29,_0x4520('0xe'),JSON[_0x4520('0x11')](_0x168e62));if(_0x168e62[_0x4520('0x12')]){if(_0x168e62[_0x4520('0x12')][_0x4520('0x13')]===0x1f4){logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);return _0x55b44f(_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);}logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);return _0x27890f(_0x168e62['error'][_0x4520('0x14')]);}else{logger[_0x4520('0xc')](_0x4520('0xd'),_0x396d29,_0x4520('0xe'));_0x27890f(_0x168e62[_0x4520('0x15')]['message']);}})[_0x4520('0x16')](function(_0x33ac29){logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x33ac29);_0x55b44f(_0x33ac29);});});}exports[_0x4520('0x17')]=function(_0x2e00f4){var _0x1dcf51=this;return new Promise(function(_0x4ba69f,_0x3791b6){return db[_0x4520('0x18')][_0x4520('0x19')](_0x2e00f4[_0x4520('0x1a')],{'raw':_0x2e00f4['options']?_0x2e00f4[_0x4520('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e00f4['options']?_0x2e00f4['options'][_0x4520('0x1c')]||null:null,'attributes':_0x2e00f4['options']?_0x2e00f4[_0x4520('0x1b')][_0x4520('0x1d')]||null:null,'limit':_0x2e00f4[_0x4520('0x1b')]?_0x2e00f4['options'][_0x4520('0x1e')]||null:null})[_0x4520('0x1f')](function(_0x3b2ede){logger['info'](_0x4520('0x17'),_0x2e00f4);logger[_0x4520('0xf')](_0x4520('0x17'),_0x2e00f4,JSON[_0x4520('0x11')](_0x3b2ede));_0x4ba69f(_0x3b2ede);})[_0x4520('0x16')](function(_0x552da1){logger[_0x4520('0x12')](_0x4520('0x17'),_0x552da1[_0x4520('0x14')],_0x2e00f4);_0x3791b6(_0x1dcf51[_0x4520('0x12')](0x1f4,_0x552da1['message']));});});};exports[_0x4520('0x20')]=function(_0x4602a4){var _0x92168b=this;return new Promise(function(_0x21e1f3,_0xad9f8){var _0x2c95ea=require(_0x4520('0x21'));var _0x195c58;return db[_0x4520('0x22')][_0x4520('0x23')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x4520('0x1f')](function(_0x5c1a0b){_0x195c58=_0x5c1a0b;return db[_0x4520('0x18')][_0x4520('0x24')](_0x4602a4[_0x4520('0x1a')]);})[_0x4520('0x1f')](function(_0x1da740){if(_0x195c58[_0x4520('0x25')]&&fs['existsSync'](_0x1da740[_0x4520('0x26')])){var _0x508c05=util[_0x4520('0x27')]('%s.cypher',_0x1da740[_0x4520('0x26')]);return _0x2c95ea['encryptFile'](_0x1da740[_0x4520('0x26')],_0x508c05,config['secrets']['recording'])[_0x4520('0x1f')](function(){fs[_0x4520('0x28')](_0x1da740[_0x4520('0x26')]);logger['info'](_0x4520('0x29'));return _0x1da740;});}return _0x1da740;})[_0x4520('0x1f')](function(_0x2acb4e){logger[_0x4520('0xc')]('CreateVoiceRecording',_0x4602a4);logger['debug'](_0x4520('0x20'),_0x4602a4,JSON[_0x4520('0x11')](_0x2acb4e));_0x21e1f3(_0x2acb4e);})['catch'](function(_0x779e94){logger[_0x4520('0x12')](_0x4520('0x20'),_0x779e94[_0x4520('0x14')],_0x4602a4);_0xad9f8(_0x92168b[_0x4520('0x12')](0x1f4,_0x779e94[_0x4520('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 0ed7210..d8fb4bb 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 _0x79c1=['describe','show','post','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated'];(function(_0x4fbce1,_0x32ab07){var _0x5980b9=function(_0x47f248){while(--_0x47f248){_0x4fbce1['push'](_0x4fbce1['shift']());}};_0x5980b9(++_0x32ab07);}(_0x79c1,0x126));var _0x179c=function(_0x198c8d,_0x41a563){_0x198c8d=_0x198c8d-0x0;var _0x142be5=_0x79c1[_0x198c8d];return _0x142be5;};'use strict';var multer=require(_0x179c('0x0'));var util=require('util');var path=require(_0x179c('0x1'));var timeout=require(_0x179c('0x2'));var express=require(_0x179c('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x179c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x179c('0x5'));var controller=require('./voiceTransferReport.controller');router[_0x179c('0x6')]('/',auth['isAuthenticated'](),controller[_0x179c('0x7')]);router['get'](_0x179c('0x8'),auth[_0x179c('0x9')](),controller[_0x179c('0xa')]);router[_0x179c('0x6')]('/:id',auth[_0x179c('0x9')](),controller[_0x179c('0xb')]);router[_0x179c('0xc')]('/',auth[_0x179c('0x9')](),controller['create']);router[_0x179c('0xd')](_0x179c('0xe'),auth['isAuthenticated'](),controller[_0x179c('0xf')]);router[_0x179c('0x10')](_0x179c('0xe'),auth[_0x179c('0x9')](),controller[_0x179c('0x11')]);module[_0x179c('0x12')]=router; \ No newline at end of file +var _0xc584=['isAuthenticated','index','describe','/:id','show','create','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x802997,_0x5534a2){var _0x35c641=function(_0x22c4f2){while(--_0x22c4f2){_0x802997['push'](_0x802997['shift']());}};_0x35c641(++_0x5534a2);}(_0xc584,0x82));var _0x4c58=function(_0x1655bb,_0x5a82ae){_0x1655bb=_0x1655bb-0x0;var _0x5e2020=_0xc584[_0x1655bb];return _0x5e2020;};'use strict';var multer=require(_0x4c58('0x0'));var util=require(_0x4c58('0x1'));var path=require(_0x4c58('0x2'));var timeout=require('connect-timeout');var express=require(_0x4c58('0x3'));var router=express[_0x4c58('0x4')]();var fs_extra=require(_0x4c58('0x5'));var auth=require(_0x4c58('0x6'));var interaction=require(_0x4c58('0x7'));var config=require(_0x4c58('0x8'));var controller=require('./voiceTransferReport.controller');router[_0x4c58('0x9')]('/',auth[_0x4c58('0xa')](),controller[_0x4c58('0xb')]);router[_0x4c58('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x4c58('0xc')]);router[_0x4c58('0x9')](_0x4c58('0xd'),auth[_0x4c58('0xa')](),controller[_0x4c58('0xe')]);router['post']('/',auth[_0x4c58('0xa')](),controller[_0x4c58('0xf')]);router['put'](_0x4c58('0xd'),auth[_0x4c58('0xa')](),controller[_0x4c58('0x10')]);router[_0x4c58('0x11')](_0x4c58('0xd'),auth['isAuthenticated'](),controller[_0x4c58('0x12')]);module[_0x4c58('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index f127d77..40b5822 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 _0x2472=['attended','STRING','Yes','sequelize','moment','exports','ENUM','blind'];(function(_0x861f0,_0x53366d){var _0x415bf4=function(_0x566778){while(--_0x566778){_0x861f0['push'](_0x861f0['shift']());}};_0x415bf4(++_0x53366d);}(_0x2472,0x1ab));var _0x2247=function(_0x51ee72,_0x339cbc){_0x51ee72=_0x51ee72-0x0;var _0x1359b7=_0x2472[_0x51ee72];return _0x1359b7;};'use strict';var Sequelize=require(_0x2247('0x0'));var moment=require(_0x2247('0x1'));module[_0x2247('0x2')]={'type':{'type':Sequelize[_0x2247('0x3')](_0x2247('0x4'),_0x2247('0x5'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x2247('0x6')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x2247('0x6')]},'transfererconnectedlinenum':{'type':Sequelize[_0x2247('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0x2247('0x6')]},'transfereraccountcode':{'type':Sequelize[_0x2247('0x6')]},'transferercontext':{'type':Sequelize[_0x2247('0x6')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x2247('0x6')]},'transfereechannel':{'type':Sequelize[_0x2247('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0x2247('0x6')]},'transfereecalleridname':{'type':Sequelize[_0x2247('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x2247('0x6')]},'transfereecontext':{'type':Sequelize[_0x2247('0x6')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x2247('0x6')]},'isexternal':{'type':Sequelize[_0x2247('0x3')](_0x2247('0x7'),'No')},'context':{'type':Sequelize[_0x2247('0x6')]},'extension':{'type':Sequelize[_0x2247('0x6')]}}; \ No newline at end of file +var _0xbe71=['exports','ENUM','blind','attended','STRING','Yes','sequelize','moment'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0xbe71,0x12e));var _0x1be7=function(_0x49b7ed,_0x4877fe){_0x49b7ed=_0x49b7ed-0x0;var _0x296dc9=_0xbe71[_0x49b7ed];return _0x296dc9;};'use strict';var Sequelize=require(_0x1be7('0x0'));var moment=require(_0x1be7('0x1'));module[_0x1be7('0x2')]={'type':{'type':Sequelize[_0x1be7('0x3')](_0x1be7('0x4'),_0x1be7('0x5'))},'result':{'type':Sequelize[_0x1be7('0x6')]},'transfererchannel':{'type':Sequelize[_0x1be7('0x6')]},'transferercalleridnum':{'type':Sequelize[_0x1be7('0x6')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x1be7('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0x1be7('0x6')]},'transfereraccountcode':{'type':Sequelize[_0x1be7('0x6')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x1be7('0x6')]},'transfereechannel':{'type':Sequelize[_0x1be7('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0x1be7('0x6')]},'transfereecalleridname':{'type':Sequelize[_0x1be7('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x1be7('0x6')]},'transfereeconnectedlinename':{'type':Sequelize[_0x1be7('0x6')]},'transfereeaccountcode':{'type':Sequelize[_0x1be7('0x6')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x1be7('0x6')]},'transfereelinkedid':{'type':Sequelize[_0x1be7('0x6')]},'isexternal':{'type':Sequelize[_0x1be7('0x3')](_0x1be7('0x7'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x1be7('0x6')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 1a22cb4..fe3581b 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 _0x4071=['reject','update','then','error','stack','name','send','index','VoiceTransferReport','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','includeAll','catch','params','length','include','options','find','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','end','json','undefined','limit','count','offset','status','set','apply'];(function(_0x5bcbd0,_0x39c098){var _0x2e8a8c=function(_0x50234b){while(--_0x50234b){_0x5bcbd0['push'](_0x5bcbd0['shift']());}};_0x2e8a8c(++_0x39c098);}(_0x4071,0x65));var _0x1407=function(_0x37a7fb,_0xdde3f4){_0x37a7fb=_0x37a7fb-0x0;var _0x5c1e65=_0x4071[_0x37a7fb];return _0x5c1e65;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1407('0x0'));var zipdir=require(_0x1407('0x1'));var jsonpatch=require(_0x1407('0x2'));var rp=require(_0x1407('0x3'));var moment=require('moment');var BPromise=require(_0x1407('0x4'));var Mustache=require(_0x1407('0x5'));var util=require('util');var path=require('path');var sox=require(_0x1407('0x6'));var csv=require(_0x1407('0x7'));var ejs=require(_0x1407('0x8'));var fs=require('fs');var fs_extra=require(_0x1407('0x9'));var _=require('lodash');var squel=require(_0x1407('0xa'));var crypto=require('crypto');var jsforce=require(_0x1407('0xb'));var deskjs=require(_0x1407('0xc'));var toCsv=require(_0x1407('0x7'));var querystring=require(_0x1407('0xd'));var Papa=require('papaparse');var Redis=require(_0x1407('0xe'));var authService=require(_0x1407('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1407('0x10'))(_0x1407('0x11'));var utils=require(_0x1407('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x1407('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x41091b,_0x5b0879){_0x5b0879=_0x5b0879||0xcc;return function(_0x6b213c){if(_0x6b213c){return _0x41091b['sendStatus'](_0x5b0879);}return _0x41091b['status'](_0x5b0879)[_0x1407('0x14')]();};}function respondWithResult(_0x29e4e1,_0x5410b9){_0x5410b9=_0x5410b9||0xc8;return function(_0x2f1eb8){if(_0x2f1eb8){return _0x29e4e1['status'](_0x5410b9)[_0x1407('0x15')](_0x2f1eb8);}};}function respondWithFilteredResult(_0x5b70c5,_0x4e3ddf){return function(_0x4ed7e2){if(_0x4ed7e2){var _0x3db310=typeof _0x4e3ddf['offset']===_0x1407('0x16')&&typeof _0x4e3ddf[_0x1407('0x17')]===_0x1407('0x16');var _0x3c7c8c=_0x4ed7e2[_0x1407('0x18')];var _0x70058c=_0x3db310?0x0:_0x4e3ddf[_0x1407('0x19')];var _0x1da5f1=_0x3db310?_0x4ed7e2[_0x1407('0x18')]:_0x4e3ddf[_0x1407('0x19')]+_0x4e3ddf[_0x1407('0x17')];var _0x2167f8;if(_0x1da5f1>=_0x3c7c8c){_0x1da5f1=_0x3c7c8c;_0x2167f8=0xc8;}else{_0x2167f8=0xce;}_0x5b70c5[_0x1407('0x1a')](_0x2167f8);return _0x5b70c5[_0x1407('0x1b')]('Content-Range',_0x70058c+'-'+_0x1da5f1+'/'+_0x3c7c8c)[_0x1407('0x15')](_0x4ed7e2);}return null;};}function patchUpdates(_0x1a4817){return function(_0x1c516b){try{jsonpatch[_0x1407('0x1c')](_0x1c516b,_0x1a4817,!![]);}catch(_0x5b9846){return BPromise[_0x1407('0x1d')](_0x5b9846);}return _0x1c516b['save']();};}function saveUpdates(_0x2abe98,_0x235aa6){return function(_0x404a03){if(_0x404a03){return _0x404a03[_0x1407('0x1e')](_0x2abe98)['then'](function(_0x59c765){return _0x59c765;});}return null;};}function removeEntity(_0x459441,_0x130ffb){return function(_0x310a77){if(_0x310a77){return _0x310a77['destroy']()[_0x1407('0x1f')](function(){_0x459441['status'](0xcc)[_0x1407('0x14')]();});}};}function handleEntityNotFound(_0x2ae8ca,_0x5455bb){return function(_0x1893c6){if(!_0x1893c6){_0x2ae8ca['sendStatus'](0x194);}return _0x1893c6;};}function handleError(_0x5bf833,_0x584205){_0x584205=_0x584205||0x1f4;return function(_0x146053){logger[_0x1407('0x20')](_0x146053[_0x1407('0x21')]);if(_0x146053[_0x1407('0x22')]){delete _0x146053[_0x1407('0x22')];}_0x5bf833[_0x1407('0x1a')](_0x584205)[_0x1407('0x23')](_0x146053);};}exports[_0x1407('0x24')]=function(_0x52d2b4,_0x52dd82){var _0x1d1925={},_0x59ddec={},_0xa8217a={'count':0x0,'rows':[]};var _0x366673=_['map'](db[_0x1407('0x25')][_0x1407('0x26')],function(_0x3f7059){return{'name':_0x3f7059[_0x1407('0x27')],'type':_0x3f7059[_0x1407('0x28')]['key']};});_0x59ddec['model']=_[_0x1407('0x29')](_0x366673,_0x1407('0x22'));_0x59ddec[_0x1407('0x2a')]=_[_0x1407('0x2b')](_0x52d2b4[_0x1407('0x2a')]);_0x59ddec[_0x1407('0x2c')]=_[_0x1407('0x2d')](_0x59ddec[_0x1407('0x2e')],_0x59ddec[_0x1407('0x2a')]);_0x1d1925[_0x1407('0x2f')]=_[_0x1407('0x2d')](_0x59ddec[_0x1407('0x2e')],qs[_0x1407('0x30')](_0x52d2b4['query'][_0x1407('0x30')]));_0x1d1925[_0x1407('0x2f')]=_0x1d1925[_0x1407('0x2f')]['length']?_0x1d1925[_0x1407('0x2f')]:_0x59ddec['model'];if(!_0x52d2b4[_0x1407('0x2a')][_0x1407('0x31')]('nolimit')){_0x1d1925[_0x1407('0x17')]=qs[_0x1407('0x17')](_0x52d2b4[_0x1407('0x2a')]['limit']);_0x1d1925[_0x1407('0x19')]=qs[_0x1407('0x19')](_0x52d2b4[_0x1407('0x2a')][_0x1407('0x19')]);}_0x1d1925['order']=qs[_0x1407('0x32')](_0x52d2b4[_0x1407('0x2a')][_0x1407('0x32')]);_0x1d1925['where']=qs[_0x1407('0x2c')](_[_0x1407('0x33')](_0x52d2b4[_0x1407('0x2a')],_0x59ddec['filters']),_0x366673);if(_0x52d2b4[_0x1407('0x2a')][_0x1407('0x34')]){_0x1d1925[_0x1407('0x35')]=_[_0x1407('0x36')](_0x1d1925[_0x1407('0x35')],{'$or':_[_0x1407('0x29')](_0x366673,function(_0x37170a){if(_0x37170a['type']!==_0x1407('0x37')){var _0x57c710={};_0x57c710[_0x37170a[_0x1407('0x22')]]={'$like':'%'+_0x52d2b4['query']['filter']+'%'};return _0x57c710;}})});}_0x1d1925=_[_0x1407('0x36')]({},_0x1d1925,_0x52d2b4['options']);var _0x59f8ea={'where':_0x1d1925[_0x1407('0x35')]};return db['VoiceTransferReport']['count'](_0x59f8ea)[_0x1407('0x1f')](function(_0x5286c5){_0xa8217a[_0x1407('0x18')]=_0x5286c5;if(_0x52d2b4['query'][_0x1407('0x38')]){_0x1d1925['include']=[{'all':!![]}];}return db[_0x1407('0x25')]['findAll'](_0x1d1925);})[_0x1407('0x1f')](function(_0x12b713){_0xa8217a['rows']=_0x12b713;return _0xa8217a;})[_0x1407('0x1f')](respondWithFilteredResult(_0x52dd82,_0x1d1925))[_0x1407('0x39')](handleError(_0x52dd82,null));};exports['show']=function(_0x42276d,_0x36e275){var _0x6a8a55={'raw':!![],'where':{'id':_0x42276d[_0x1407('0x3a')]['id']}},_0x1f4b69={};_0x1f4b69['model']=_['keys'](db[_0x1407('0x25')]['rawAttributes']);_0x1f4b69[_0x1407('0x2a')]=_[_0x1407('0x2b')](_0x42276d[_0x1407('0x2a')]);_0x1f4b69[_0x1407('0x2c')]=_[_0x1407('0x2d')](_0x1f4b69[_0x1407('0x2e')],_0x1f4b69[_0x1407('0x2a')]);_0x6a8a55['attributes']=_['intersection'](_0x1f4b69[_0x1407('0x2e')],qs['fields'](_0x42276d['query'][_0x1407('0x30')]));_0x6a8a55[_0x1407('0x2f')]=_0x6a8a55['attributes'][_0x1407('0x3b')]?_0x6a8a55[_0x1407('0x2f')]:_0x1f4b69['model'];if(_0x42276d[_0x1407('0x2a')][_0x1407('0x38')]){_0x6a8a55[_0x1407('0x3c')]=[{'all':!![]}];}_0x6a8a55=_[_0x1407('0x36')]({},_0x6a8a55,_0x42276d[_0x1407('0x3d')]);return db['VoiceTransferReport'][_0x1407('0x3e')](_0x6a8a55)[_0x1407('0x1f')](handleEntityNotFound(_0x36e275,null))['then'](respondWithResult(_0x36e275,null))[_0x1407('0x39')](handleError(_0x36e275,null));};exports['create']=function(_0x238331,_0x1da036){return db[_0x1407('0x25')]['create'](_0x238331[_0x1407('0x3f')],{})['then'](respondWithResult(_0x1da036,0xc9))[_0x1407('0x39')](handleError(_0x1da036,null));};exports[_0x1407('0x1e')]=function(_0x10638c,_0x3af264){if(_0x10638c[_0x1407('0x3f')]['id']){delete _0x10638c['body']['id'];}return db[_0x1407('0x25')]['find']({'where':{'id':_0x10638c['params']['id']}})['then'](handleEntityNotFound(_0x3af264,null))[_0x1407('0x1f')](saveUpdates(_0x10638c[_0x1407('0x3f')],null))[_0x1407('0x1f')](respondWithResult(_0x3af264,null))[_0x1407('0x39')](handleError(_0x3af264,null));};exports['destroy']=function(_0x244943,_0xd32af7){return db['VoiceTransferReport'][_0x1407('0x3e')]({'where':{'id':_0x244943[_0x1407('0x3a')]['id']}})[_0x1407('0x1f')](handleEntityNotFound(_0xd32af7,null))[_0x1407('0x1f')](removeEntity(_0xd32af7,null))[_0x1407('0x39')](handleError(_0xd32af7,null));};exports[_0x1407('0x40')]=function(_0x3cf017,_0x3eb115){return db[_0x1407('0x25')][_0x1407('0x40')]()[_0x1407('0x1f')](respondWithResult(_0x3eb115,null))[_0x1407('0x39')](handleError(_0x3eb115,null));}; \ No newline at end of file +var _0x3ee9=['error','stack','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','then','rows','catch','show','params','find','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','destroy'];(function(_0x11c47d,_0x58930b){var _0x4305e1=function(_0x1dde01){while(--_0x1dde01){_0x11c47d['push'](_0x11c47d['shift']());}};_0x4305e1(++_0x58930b);}(_0x3ee9,0x73));var _0x93ee=function(_0x481e35,_0x3ec80b){_0x481e35=_0x481e35-0x0;var _0x1dd292=_0x3ee9[_0x481e35];return _0x1dd292;};'use strict';var emlformat=require(_0x93ee('0x0'));var rimraf=require(_0x93ee('0x1'));var zipdir=require(_0x93ee('0x2'));var jsonpatch=require(_0x93ee('0x3'));var rp=require('request-promise');var moment=require(_0x93ee('0x4'));var BPromise=require(_0x93ee('0x5'));var Mustache=require('mustache');var util=require(_0x93ee('0x6'));var path=require(_0x93ee('0x7'));var sox=require(_0x93ee('0x8'));var csv=require(_0x93ee('0x9'));var ejs=require(_0x93ee('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x93ee('0xb'));var squel=require(_0x93ee('0xc'));var crypto=require(_0x93ee('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x93ee('0x9'));var querystring=require(_0x93ee('0xe'));var Papa=require('papaparse');var Redis=require(_0x93ee('0xf'));var authService=require(_0x93ee('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x93ee('0x11'))('api');var utils=require(_0x93ee('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x93ee('0x13'));var db=require(_0x93ee('0x14'))['db'];function respondWithStatusCode(_0x2f721c,_0x2febe1){_0x2febe1=_0x2febe1||0xcc;return function(_0x11639e){if(_0x11639e){return _0x2f721c[_0x93ee('0x15')](_0x2febe1);}return _0x2f721c[_0x93ee('0x16')](_0x2febe1)[_0x93ee('0x17')]();};}function respondWithResult(_0x1962d3,_0x235833){_0x235833=_0x235833||0xc8;return function(_0x484880){if(_0x484880){return _0x1962d3[_0x93ee('0x16')](_0x235833)[_0x93ee('0x18')](_0x484880);}};}function respondWithFilteredResult(_0x5c3e1d,_0x3ec524){return function(_0x124e09){if(_0x124e09){var _0x5e192c=typeof _0x3ec524['offset']===_0x93ee('0x19')&&typeof _0x3ec524[_0x93ee('0x1a')]===_0x93ee('0x19');var _0x4d4802=_0x124e09['count'];var _0x64fd7a=_0x5e192c?0x0:_0x3ec524[_0x93ee('0x1b')];var _0x55aa4b=_0x5e192c?_0x124e09[_0x93ee('0x1c')]:_0x3ec524[_0x93ee('0x1b')]+_0x3ec524[_0x93ee('0x1a')];var _0x458db7;if(_0x55aa4b>=_0x4d4802){_0x55aa4b=_0x4d4802;_0x458db7=0xc8;}else{_0x458db7=0xce;}_0x5c3e1d['status'](_0x458db7);return _0x5c3e1d[_0x93ee('0x1d')](_0x93ee('0x1e'),_0x64fd7a+'-'+_0x55aa4b+'/'+_0x4d4802)[_0x93ee('0x18')](_0x124e09);}return null;};}function patchUpdates(_0x4daca5){return function(_0x49e26f){try{jsonpatch[_0x93ee('0x1f')](_0x49e26f,_0x4daca5,!![]);}catch(_0x1bbded){return BPromise[_0x93ee('0x20')](_0x1bbded);}return _0x49e26f[_0x93ee('0x21')]();};}function saveUpdates(_0x156a12,_0x3cfdc3){return function(_0x3aa704){if(_0x3aa704){return _0x3aa704['update'](_0x156a12)['then'](function(_0x16fe47){return _0x16fe47;});}return null;};}function removeEntity(_0x20b122,_0x4d663a){return function(_0x2b449b){if(_0x2b449b){return _0x2b449b[_0x93ee('0x22')]()['then'](function(){_0x20b122[_0x93ee('0x16')](0xcc)[_0x93ee('0x17')]();});}};}function handleEntityNotFound(_0x41962c,_0x2a28c7){return function(_0x1933b6){if(!_0x1933b6){_0x41962c[_0x93ee('0x15')](0x194);}return _0x1933b6;};}function handleError(_0x5d82ac,_0x1f0bd4){_0x1f0bd4=_0x1f0bd4||0x1f4;return function(_0x1909de){logger[_0x93ee('0x23')](_0x1909de[_0x93ee('0x24')]);if(_0x1909de[_0x93ee('0x25')]){delete _0x1909de[_0x93ee('0x25')];}_0x5d82ac[_0x93ee('0x16')](_0x1f0bd4)[_0x93ee('0x26')](_0x1909de);};}exports[_0x93ee('0x27')]=function(_0x4e5a0f,_0x5d7c8c){var _0x1b4761={},_0x131ee8={},_0x3eaf50={'count':0x0,'rows':[]};var _0x1369af=_[_0x93ee('0x28')](db[_0x93ee('0x29')][_0x93ee('0x2a')],function(_0x4f7ce7){return{'name':_0x4f7ce7[_0x93ee('0x2b')],'type':_0x4f7ce7[_0x93ee('0x2c')][_0x93ee('0x2d')]};});_0x131ee8[_0x93ee('0x2e')]=_[_0x93ee('0x28')](_0x1369af,_0x93ee('0x25'));_0x131ee8[_0x93ee('0x2f')]=_[_0x93ee('0x30')](_0x4e5a0f['query']);_0x131ee8[_0x93ee('0x31')]=_[_0x93ee('0x32')](_0x131ee8[_0x93ee('0x2e')],_0x131ee8[_0x93ee('0x2f')]);_0x1b4761['attributes']=_[_0x93ee('0x32')](_0x131ee8[_0x93ee('0x2e')],qs['fields'](_0x4e5a0f['query'][_0x93ee('0x33')]));_0x1b4761[_0x93ee('0x34')]=_0x1b4761[_0x93ee('0x34')][_0x93ee('0x35')]?_0x1b4761['attributes']:_0x131ee8[_0x93ee('0x2e')];if(!_0x4e5a0f[_0x93ee('0x2f')][_0x93ee('0x36')]('nolimit')){_0x1b4761[_0x93ee('0x1a')]=qs[_0x93ee('0x1a')](_0x4e5a0f[_0x93ee('0x2f')][_0x93ee('0x1a')]);_0x1b4761[_0x93ee('0x1b')]=qs[_0x93ee('0x1b')](_0x4e5a0f['query'][_0x93ee('0x1b')]);}_0x1b4761[_0x93ee('0x37')]=qs[_0x93ee('0x38')](_0x4e5a0f['query'][_0x93ee('0x38')]);_0x1b4761[_0x93ee('0x39')]=qs[_0x93ee('0x31')](_[_0x93ee('0x3a')](_0x4e5a0f['query'],_0x131ee8[_0x93ee('0x31')]),_0x1369af);if(_0x4e5a0f[_0x93ee('0x2f')]['filter']){_0x1b4761[_0x93ee('0x39')]=_[_0x93ee('0x3b')](_0x1b4761[_0x93ee('0x39')],{'$or':_[_0x93ee('0x28')](_0x1369af,function(_0x5ca17c){if(_0x5ca17c[_0x93ee('0x2c')]!==_0x93ee('0x3c')){var _0x518070={};_0x518070[_0x5ca17c[_0x93ee('0x25')]]={'$like':'%'+_0x4e5a0f[_0x93ee('0x2f')][_0x93ee('0x3d')]+'%'};return _0x518070;}})});}_0x1b4761=_[_0x93ee('0x3b')]({},_0x1b4761,_0x4e5a0f[_0x93ee('0x3e')]);var _0x2dd9a5={'where':_0x1b4761[_0x93ee('0x39')]};return db['VoiceTransferReport'][_0x93ee('0x1c')](_0x2dd9a5)['then'](function(_0x4fecb0){_0x3eaf50[_0x93ee('0x1c')]=_0x4fecb0;if(_0x4e5a0f[_0x93ee('0x2f')][_0x93ee('0x3f')]){_0x1b4761[_0x93ee('0x40')]=[{'all':!![]}];}return db[_0x93ee('0x29')]['findAll'](_0x1b4761);})[_0x93ee('0x41')](function(_0x473342){_0x3eaf50[_0x93ee('0x42')]=_0x473342;return _0x3eaf50;})[_0x93ee('0x41')](respondWithFilteredResult(_0x5d7c8c,_0x1b4761))[_0x93ee('0x43')](handleError(_0x5d7c8c,null));};exports[_0x93ee('0x44')]=function(_0x2bb601,_0xef1e1f){var _0x544957={'raw':!![],'where':{'id':_0x2bb601[_0x93ee('0x45')]['id']}},_0x5d3801={};_0x5d3801['model']=_[_0x93ee('0x30')](db['VoiceTransferReport'][_0x93ee('0x2a')]);_0x5d3801['query']=_[_0x93ee('0x30')](_0x2bb601[_0x93ee('0x2f')]);_0x5d3801[_0x93ee('0x31')]=_['intersection'](_0x5d3801[_0x93ee('0x2e')],_0x5d3801[_0x93ee('0x2f')]);_0x544957[_0x93ee('0x34')]=_[_0x93ee('0x32')](_0x5d3801[_0x93ee('0x2e')],qs[_0x93ee('0x33')](_0x2bb601[_0x93ee('0x2f')][_0x93ee('0x33')]));_0x544957[_0x93ee('0x34')]=_0x544957[_0x93ee('0x34')][_0x93ee('0x35')]?_0x544957['attributes']:_0x5d3801['model'];if(_0x2bb601[_0x93ee('0x2f')]['includeAll']){_0x544957[_0x93ee('0x40')]=[{'all':!![]}];}_0x544957=_[_0x93ee('0x3b')]({},_0x544957,_0x2bb601[_0x93ee('0x3e')]);return db[_0x93ee('0x29')][_0x93ee('0x46')](_0x544957)[_0x93ee('0x41')](handleEntityNotFound(_0xef1e1f,null))[_0x93ee('0x41')](respondWithResult(_0xef1e1f,null))[_0x93ee('0x43')](handleError(_0xef1e1f,null));};exports[_0x93ee('0x47')]=function(_0x1d2f97,_0x391140){return db[_0x93ee('0x29')]['create'](_0x1d2f97['body'],{})[_0x93ee('0x41')](respondWithResult(_0x391140,0xc9))[_0x93ee('0x43')](handleError(_0x391140,null));};exports[_0x93ee('0x48')]=function(_0x276140,_0x103a8b){if(_0x276140[_0x93ee('0x49')]['id']){delete _0x276140[_0x93ee('0x49')]['id'];}return db['VoiceTransferReport'][_0x93ee('0x46')]({'where':{'id':_0x276140[_0x93ee('0x45')]['id']}})[_0x93ee('0x41')](handleEntityNotFound(_0x103a8b,null))[_0x93ee('0x41')](saveUpdates(_0x276140['body'],null))[_0x93ee('0x41')](respondWithResult(_0x103a8b,null))['catch'](handleError(_0x103a8b,null));};exports[_0x93ee('0x22')]=function(_0x3eddb4,_0x1dc496){return db[_0x93ee('0x29')][_0x93ee('0x46')]({'where':{'id':_0x3eddb4[_0x93ee('0x45')]['id']}})[_0x93ee('0x41')](handleEntityNotFound(_0x1dc496,null))[_0x93ee('0x41')](removeEntity(_0x1dc496,null))['catch'](handleError(_0x1dc496,null));};exports[_0x93ee('0x4a')]=function(_0x1157e9,_0x8995ac){return db[_0x93ee('0x29')][_0x93ee('0x4a')]()[_0x93ee('0x41')](respondWithResult(_0x8995ac,null))[_0x93ee('0x43')](handleError(_0x8995ac,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 7999086..cc04f8d 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 _0x1235=['../../config/environment','define','VoiceTransferReport','report_call_transfer','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x1235,0x1e8));var _0x5123=function(_0x4ac923,_0x5b03cf){_0x4ac923=_0x4ac923-0x0;var _0x142446=_0x1235[_0x4ac923];return _0x142446;};'use strict';var _=require(_0x5123('0x0'));var util=require('util');var logger=require(_0x5123('0x1'))(_0x5123('0x2'));var moment=require(_0x5123('0x3'));var BPromise=require(_0x5123('0x4'));var rp=require(_0x5123('0x5'));var fs=require('fs');var path=require(_0x5123('0x6'));var rimraf=require('rimraf');var config=require(_0x5123('0x7'));var attributes=require('./voiceTransferReport.attributes');module['exports']=function(_0x211ff8,_0x52ccfd){return _0x211ff8[_0x5123('0x8')](_0x5123('0x9'),attributes,{'tableName':_0x5123('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xacf6=['moment','bluebird','path','rimraf','../../config/environment','./voiceTransferReport.attributes','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api'];(function(_0x47f728,_0x41987f){var _0x427ab2=function(_0x13d8c5){while(--_0x13d8c5){_0x47f728['push'](_0x47f728['shift']());}};_0x427ab2(++_0x41987f);}(_0xacf6,0x19c));var _0x6acf=function(_0x181fba,_0x468f0c){_0x181fba=_0x181fba-0x0;var _0x346036=_0xacf6[_0x181fba];return _0x346036;};'use strict';var _=require(_0x6acf('0x0'));var util=require(_0x6acf('0x1'));var logger=require(_0x6acf('0x2'))(_0x6acf('0x3'));var moment=require(_0x6acf('0x4'));var BPromise=require(_0x6acf('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6acf('0x6'));var rimraf=require(_0x6acf('0x7'));var config=require(_0x6acf('0x8'));var attributes=require(_0x6acf('0x9'));module['exports']=function(_0x2fcfbc,_0xea1acf){return _0x2fcfbc[_0x6acf('0xa')](_0x6acf('0xb'),attributes,{'tableName':_0x6acf('0xc'),'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 c9bec32..548ae7e 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 _0x38b2=['client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x179c17,_0x30c02a){var _0x54b913=function(_0x100d4a){while(--_0x100d4a){_0x179c17['push'](_0x179c17['shift']());}};_0x54b913(++_0x30c02a);}(_0x38b2,0x1a1));var _0x238b=function(_0x4def44,_0x2522c0){_0x4def44=_0x4def44-0x0;var _0x54401b=_0x38b2[_0x4def44];return _0x54401b;};'use strict';var _=require(_0x238b('0x0'));var util=require(_0x238b('0x1'));var moment=require(_0x238b('0x2'));var BPromise=require(_0x238b('0x3'));var rs=require(_0x238b('0x4'));var fs=require('fs');var Redis=require(_0x238b('0x5'));var db=require(_0x238b('0x6'))['db'];var utils=require(_0x238b('0x7'));var logger=require(_0x238b('0x8'))(_0x238b('0x9'));var config=require(_0x238b('0xa'));var jayson=require(_0x238b('0xb'));var client=jayson[_0x238b('0xc')][_0x238b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5187fa,_0x2081d1,_0x3f8416){return new BPromise(function(_0x21fc7a,_0x14c782){return client[_0x238b('0xe')](_0x5187fa,_0x3f8416)[_0x238b('0xf')](function(_0x256205){logger[_0x238b('0x10')](_0x238b('0x11'),_0x2081d1,_0x238b('0x12'));logger[_0x238b('0x13')](_0x238b('0x14'),_0x2081d1,_0x238b('0x12'),JSON[_0x238b('0x15')](_0x256205));if(_0x256205[_0x238b('0x16')]){if(_0x256205[_0x238b('0x16')][_0x238b('0x17')]===0x1f4){logger[_0x238b('0x16')]('VoiceTransferReport,\x20%s,\x20%s',_0x2081d1,_0x256205['error'][_0x238b('0x18')]);return _0x14c782(_0x256205[_0x238b('0x16')][_0x238b('0x18')]);}logger['error'](_0x238b('0x11'),_0x2081d1,_0x256205[_0x238b('0x16')]['message']);return _0x21fc7a(_0x256205['error'][_0x238b('0x18')]);}else{logger[_0x238b('0x10')](_0x238b('0x11'),_0x2081d1,_0x238b('0x12'));_0x21fc7a(_0x256205[_0x238b('0x19')][_0x238b('0x18')]);}})[_0x238b('0x1a')](function(_0x5ef98e){logger[_0x238b('0x16')](_0x238b('0x11'),_0x2081d1,_0x5ef98e);_0x14c782(_0x5ef98e);});});}exports[_0x238b('0x1b')]=function(_0xe3e938){var _0x3be984=this;return new Promise(function(_0x46bf00,_0x16e721){return db[_0x238b('0x1c')][_0x238b('0x1d')](_0xe3e938[_0x238b('0x1e')],{'raw':_0xe3e938['options']?_0xe3e938[_0x238b('0x1f')][_0x238b('0x20')]===undefined?!![]:![]:!![]})[_0x238b('0xf')](function(_0xd1be2c){logger[_0x238b('0x10')](_0x238b('0x1b'),_0xe3e938);logger[_0x238b('0x13')](_0x238b('0x1b'),_0xe3e938,JSON['stringify'](_0xd1be2c));_0x46bf00(_0xd1be2c);})[_0x238b('0x1a')](function(_0x4e8458){logger[_0x238b('0x16')](_0x238b('0x1b'),_0x4e8458['message'],_0xe3e938);_0x16e721(_0x3be984[_0x238b('0x16')](0x1f4,_0x4e8458['message']));});});}; \ No newline at end of file +var _0x63e4=['request','then','info','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','VoiceTransferReport,\x20%s,\x20%s','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http'];(function(_0x229532,_0x1c0e67){var _0x598c8a=function(_0x3e25ac){while(--_0x3e25ac){_0x229532['push'](_0x229532['shift']());}};_0x598c8a(++_0x1c0e67);}(_0x63e4,0xd6));var _0x463e=function(_0x19ab22,_0x3c15c8){_0x19ab22=_0x19ab22-0x0;var _0x228117=_0x63e4[_0x19ab22];return _0x228117;};'use strict';var _=require('lodash');var util=require(_0x463e('0x0'));var moment=require(_0x463e('0x1'));var BPromise=require(_0x463e('0x2'));var rs=require(_0x463e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x463e('0x4'))['db'];var utils=require(_0x463e('0x5'));var logger=require(_0x463e('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x463e('0x7'));var client=jayson[_0x463e('0x8')][_0x463e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x741609,_0x45f666,_0x19dc1c){return new BPromise(function(_0x47c591,_0x25ce2b){return client[_0x463e('0xa')](_0x741609,_0x19dc1c)[_0x463e('0xb')](function(_0x4c0bc7){logger[_0x463e('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x45f666,'request\x20sent');logger[_0x463e('0xd')](_0x463e('0xe'),_0x45f666,_0x463e('0xf'),JSON[_0x463e('0x10')](_0x4c0bc7));if(_0x4c0bc7[_0x463e('0x11')]){if(_0x4c0bc7[_0x463e('0x11')]['code']===0x1f4){logger['error'](_0x463e('0x12'),_0x45f666,_0x4c0bc7[_0x463e('0x11')][_0x463e('0x13')]);return _0x25ce2b(_0x4c0bc7[_0x463e('0x11')][_0x463e('0x13')]);}logger['error'](_0x463e('0x12'),_0x45f666,_0x4c0bc7['error'][_0x463e('0x13')]);return _0x47c591(_0x4c0bc7[_0x463e('0x11')][_0x463e('0x13')]);}else{logger[_0x463e('0xc')](_0x463e('0x12'),_0x45f666,_0x463e('0xf'));_0x47c591(_0x4c0bc7[_0x463e('0x14')][_0x463e('0x13')]);}})[_0x463e('0x15')](function(_0x26e2a8){logger[_0x463e('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x45f666,_0x26e2a8);_0x25ce2b(_0x26e2a8);});});}exports[_0x463e('0x16')]=function(_0x17a94c){var _0xe5907a=this;return new Promise(function(_0x24df8d,_0x1ddff8){return db[_0x463e('0x17')][_0x463e('0x18')](_0x17a94c[_0x463e('0x19')],{'raw':_0x17a94c[_0x463e('0x1a')]?_0x17a94c[_0x463e('0x1a')][_0x463e('0x1b')]===undefined?!![]:![]:!![]})[_0x463e('0xb')](function(_0x51a080){logger[_0x463e('0xc')](_0x463e('0x16'),_0x17a94c);logger['debug'](_0x463e('0x16'),_0x17a94c,JSON[_0x463e('0x10')](_0x51a080));_0x24df8d(_0x51a080);})[_0x463e('0x15')](function(_0x32fe01){logger['error'](_0x463e('0x16'),_0x32fe01[_0x463e('0x13')],_0x17a94c);_0x1ddff8(_0xe5907a[_0x463e('0x11')](0x1f4,_0x32fe01['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 9647516..c64aa71 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 _0xf3cd=['/unhold','unhold','/calls','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','post','/originate','isWebrtcLicence','originate','isAuthenticated','hangup','/answer','answer'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x503cd5,_0x57774a){_0x503cd5=_0x503cd5-0x0;var _0x1fdf1e=_0xf3cd[_0x503cd5];return _0x1fdf1e;};'use strict';var express=require(_0xdf3c('0x0'));var router=express[_0xdf3c('0x1')]();var auth=require(_0xdf3c('0x2'));var controller=require(_0xdf3c('0x3'));router[_0xdf3c('0x4')](_0xdf3c('0x5'),auth['isAuthenticated'](),auth[_0xdf3c('0x6')](),controller[_0xdf3c('0x7')]);router[_0xdf3c('0x4')]('/hangup',auth[_0xdf3c('0x8')](),auth[_0xdf3c('0x6')](),controller[_0xdf3c('0x9')]);router[_0xdf3c('0x4')](_0xdf3c('0xa'),auth[_0xdf3c('0x8')](),auth['isWebrtcLicence'](),controller[_0xdf3c('0xb')]);router['post']('/hold',auth[_0xdf3c('0x8')](),auth[_0xdf3c('0x6')](),controller['hold']);router[_0xdf3c('0x4')](_0xdf3c('0xc'),auth[_0xdf3c('0x8')](),auth[_0xdf3c('0x6')](),controller[_0xdf3c('0xd')]);router[_0xdf3c('0x4')](_0xdf3c('0xe'),auth[_0xdf3c('0x8')](),auth['isWebrtcLicence'](),controller[_0xdf3c('0xf')]);router[_0xdf3c('0x4')](_0xdf3c('0x10'),auth[_0xdf3c('0x8')](),auth['isWebrtcLicence'](),controller[_0xdf3c('0x11')]);module[_0xdf3c('0x12')]=router; \ No newline at end of file +var _0x54ef=['unhold','/calls','/transfer','transfer','express','Router','../../components/auth/service','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','hangup','/answer','/hold','hold','/unhold'];(function(_0x442c90,_0x4bf71f){var _0x642cd2=function(_0x5dffb7){while(--_0x5dffb7){_0x442c90['push'](_0x442c90['shift']());}};_0x642cd2(++_0x4bf71f);}(_0x54ef,0x112));var _0xf54e=function(_0x22235e,_0x5a2d61){_0x22235e=_0x22235e-0x0;var _0x5ded42=_0x54ef[_0x22235e];return _0x5ded42;};'use strict';var express=require(_0xf54e('0x0'));var router=express[_0xf54e('0x1')]();var auth=require(_0xf54e('0x2'));var controller=require('./webbar.controller');router[_0xf54e('0x3')](_0xf54e('0x4'),auth[_0xf54e('0x5')](),auth[_0xf54e('0x6')](),controller[_0xf54e('0x7')]);router[_0xf54e('0x3')](_0xf54e('0x8'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xf54e('0x9')]);router[_0xf54e('0x3')](_0xf54e('0xa'),auth['isAuthenticated'](),auth[_0xf54e('0x6')](),controller['answer']);router[_0xf54e('0x3')](_0xf54e('0xb'),auth['isAuthenticated'](),auth[_0xf54e('0x6')](),controller[_0xf54e('0xc')]);router[_0xf54e('0x3')](_0xf54e('0xd'),auth['isAuthenticated'](),auth[_0xf54e('0x6')](),controller[_0xf54e('0xe')]);router[_0xf54e('0x3')](_0xf54e('0xf'),auth['isAuthenticated'](),auth[_0xf54e('0x6')](),controller['calls']);router['post'](_0xf54e('0x10'),auth[_0xf54e('0x5')](),auth[_0xf54e('0x6')](),controller[_0xf54e('0x11')]);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 23e079b..26a2737 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 _0x61a5=['redis','defaults','localhost','socket.io-emitter','number','string','callNumber\x20is\x20required','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','error','stack','name','send','NotFound','request','then','code','message','result','catch','User','findOne','agent','VoiceChannels','all','filter','UserId','sessionId','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','validate','length','status','json','userId','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','rows','conference\x20fired:','webbar:conference','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','http','../../config/logger','ioredis'];(function(_0x880aed,_0x16597b){var _0x40df37=function(_0x303925){while(--_0x303925){_0x880aed['push'](_0x880aed['shift']());}};_0x40df37(++_0x16597b);}(_0x61a5,0xf0));var _0x561a=function(_0x57474e,_0x4178b8){_0x57474e=_0x57474e-0x0;var _0xfaae8c=_0x61a5[_0x57474e];return _0xfaae8c;};'use strict';var path=require(_0x561a('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0x561a('0x1'))['db'];var config=require(_0x561a('0x2'));var util=require(_0x561a('0x3'));var BPromise=require(_0x561a('0x4'));var jayson=require(_0x561a('0x5'));var amiClient=jayson['client'][_0x561a('0x6')]({'port':0x232a});var logger=require(_0x561a('0x7'))('webbarapi');var Redis=require(_0x561a('0x8'));config[_0x561a('0x9')]=_[_0x561a('0xa')](config[_0x561a('0x9')],{'host':_0x561a('0xb'),'port':0x18eb});var io=require(_0x561a('0xc'))(new Redis(config[_0x561a('0x9')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x561a('0xd'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x561a('0xe'),'required':[!![],_0x561a('0xf')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0x561a('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0x561a('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x561a('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x561a('0x10')]},'sessionId':{'type':_0x561a('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x561a('0xd'),'required':[!![],_0x561a('0x10')]},'sessionId':{'type':_0x561a('0xe'),'required':[!![],_0x561a('0x11')]},'transferNumber':{'type':_0x561a('0xe'),'required':[!![],_0x561a('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0x561a('0xd'),'required':[!![],_0x561a('0x10')]},'sessionId':{'type':_0x561a('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x561a('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x561a('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x561a('0xd'),'required':[!![],_0x561a('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':_0x561a('0xd'),'required':[!![],_0x561a('0x10')]}});function emit(_0x28ad8b,_0x3d91be,_0x14f141){logger[_0x561a('0x13')](_0x28ad8b,_0x3d91be,JSON[_0x561a('0x14')](_0x14f141));io['to'](_0x28ad8b)[_0x561a('0x15')](_0x3d91be,_0x14f141);}function handleError(_0x48df6a){return function(_0x43c5aa){console[_0x561a('0x16')]('handleError:',_0x43c5aa,_0x43c5aa instanceof RangeError);logger[_0x561a('0x17')](_0x43c5aa[_0x561a('0x18')]);if(_0x43c5aa instanceof RangeError){if(_0x43c5aa['name']){delete _0x43c5aa[_0x561a('0x19')];}_0x48df6a['status'](0x194)['send'](_0x43c5aa);}else{if(_0x43c5aa[_0x561a('0x19')]){delete _0x43c5aa[_0x561a('0x19')];}_0x48df6a['status'](0x1f4)[_0x561a('0x1a')](_0x43c5aa);}};}function checkError(){return function(_0x88b2b5){if(!_0x88b2b5){throw new RangeError(_0x561a('0x1b'));}return _0x88b2b5;};}function respondWithRpcPromise(_0x3cf6c8,_0x345941){return new BPromise(function(_0x1bb8df,_0x4f9c3a){var _0x3e5509=amiClient;return _0x3e5509[_0x561a('0x1c')](_0x3cf6c8,_0x345941)[_0x561a('0x1d')](function(_0x527207){if(_0x527207['error']){if(_0x527207[_0x561a('0x17')][_0x561a('0x1e')]===0x1f4){return _0x4f9c3a(_0x527207[_0x561a('0x17')][_0x561a('0x1f')]);}return _0x1bb8df(_0x527207[_0x561a('0x17')][_0x561a('0x1f')]);}else{_0x1bb8df(_0x527207[_0x561a('0x20')]);}})[_0x561a('0x21')](function(_0x5bf2fa){_0x4f9c3a(_0x5bf2fa);});});}function getAgent(_0x4c2752){return db[_0x561a('0x22')][_0x561a('0x23')]({'where':{'id':_0x4c2752,'role':_0x561a('0x24')}})[_0x561a('0x1d')](checkError());}function getAgentCheckSession(_0x5a0acd,_0x186862){return new BPromise(function(_0x3f0789,_0x44c851){var _0x23b489=respondWithRpcPromise(_0x561a('0x25'));var _0x47f93a=getAgent(_0x5a0acd);Promise[_0x561a('0x26')]([_0x23b489,_0x47f93a])[_0x561a('0x1d')](function(_0x4f0b23){var _0x401636=_0x4f0b23[0x0];var _0x276ae7=_0x4f0b23[0x1];var _0x58db23=_[_0x561a('0x27')](_0x401636['rows'],function(_0x54a47a){return _0x54a47a[_0x561a('0x28')]==_0x276ae7['id']&&_0x54a47a[_0x561a('0x29')]==_0x186862;});if(_0x58db23['length']==0x1){_0x3f0789(_0x276ae7);}else{_0x44c851(new RangeError(_0x561a('0x2a')+_0x186862+_0x561a('0x2b')));}});});}exports[_0x561a('0x2c')]=function(_0x278c7e,_0x169243){logger[_0x561a('0x13')](_0x561a('0x2d'),_0x278c7e[_0x561a('0x2e')]);var _0x506c2e=originateValidation[_0x561a('0x2f')](_0x278c7e[_0x561a('0x2e')]);if(_0x506c2e[_0x561a('0x30')]>0x0){return _0x169243[_0x561a('0x31')](0x190)[_0x561a('0x32')](_0x506c2e);}var _0x4ab97f=_0x278c7e[_0x561a('0x2e')][_0x561a('0x33')];var _0x2d0063=_0x278c7e[_0x561a('0x2e')]['callNumber'];var _0x9ea469=_0x278c7e[_0x561a('0x2e')][_0x561a('0x34')];var _0x48f470=_0x278c7e['body'][_0x561a('0x35')];return getAgent(_0x4ab97f)['then'](function(_0x5a45a4){logger['info'](_0x561a('0x36'),_0x5a45a4[_0x561a('0x19')]);emit(util[_0x561a('0x37')](_0x561a('0x38'),_0x5a45a4[_0x561a('0x19')]),_0x561a('0x39'),{'callNumber':_0x2d0063,'callerId':_0x9ea469,'callbackUrl':_0x48f470});return _0x169243['status'](0xc8)['json']({'error':![],'message':_0x561a('0x3a')});})[_0x561a('0x21')](handleError(_0x169243));};exports[_0x561a('0x3b')]=function(_0x4e7d95,_0x4d81f7){logger[_0x561a('0x13')](_0x561a('0x3c'),_0x4e7d95[_0x561a('0x2e')]);var _0x5865c7=hangupValidation[_0x561a('0x2f')](_0x4e7d95[_0x561a('0x2e')]);if(_0x5865c7[_0x561a('0x30')]>0x0){return _0x4d81f7[_0x561a('0x31')](0x190)['json'](_0x5865c7);}var _0xbd11c4=_0x4e7d95[_0x561a('0x2e')][_0x561a('0x33')];var _0x5c59dc=_0x4e7d95[_0x561a('0x2e')][_0x561a('0x29')];return getAgent(_0xbd11c4)[_0x561a('0x1d')](function(_0x16779d){logger[_0x561a('0x13')](_0x561a('0x36'),_0x16779d[_0x561a('0x19')]);emit(util['format'](_0x561a('0x38'),_0x16779d[_0x561a('0x19')]),_0x561a('0x3d'),{'sessionId':_0x5c59dc});return _0x4d81f7[_0x561a('0x31')](0xc8)[_0x561a('0x32')]({'error':![],'message':_0x561a('0x3e')});})['catch'](handleError(_0x4d81f7));};exports[_0x561a('0x3f')]=function(_0xd991f8,_0x3f0f44){logger[_0x561a('0x13')](_0x561a('0x40'),_0xd991f8[_0x561a('0x2e')]);var _0x293e11=answerValidation[_0x561a('0x2f')](_0xd991f8[_0x561a('0x2e')]);if(_0x293e11['length']>0x0){return _0x3f0f44[_0x561a('0x31')](0x190)[_0x561a('0x32')](_0x293e11);}var _0x5197b1=_0xd991f8[_0x561a('0x2e')]['userId'];var _0x141971=_0xd991f8[_0x561a('0x2e')][_0x561a('0x29')];return getAgent(_0x5197b1)[_0x561a('0x1d')](function(_0x93103b){logger['info'](_0x561a('0x36'),_0x93103b[_0x561a('0x19')]);emit(util[_0x561a('0x37')](_0x561a('0x38'),_0x93103b[_0x561a('0x19')]),_0x561a('0x41'),{'sessionId':_0x141971});return _0x3f0f44['status'](0xc8)['json']({'error':![],'message':_0x561a('0x42')});})['catch'](handleError(_0x3f0f44));};exports['hold']=function(_0x4d7a38,_0x5e9e37){logger['info'](_0x561a('0x43'),_0x4d7a38[_0x561a('0x2e')]);var _0x21858b=holdValidation['validate'](_0x4d7a38[_0x561a('0x2e')]);if(_0x21858b['length']>0x0){return _0x5e9e37['status'](0x190)[_0x561a('0x32')](_0x21858b);}var _0x13a2ad=_0x4d7a38[_0x561a('0x2e')]['userId'];var _0x3bfd1b=_0x4d7a38['body'][_0x561a('0x29')];return getAgent(_0x13a2ad)['then'](function(_0x1bd3df){logger[_0x561a('0x13')](_0x561a('0x36'),_0x1bd3df[_0x561a('0x19')]);emit(util[_0x561a('0x37')](_0x561a('0x38'),_0x1bd3df[_0x561a('0x19')]),_0x561a('0x44'),{'sessionId':_0x3bfd1b});return _0x5e9e37[_0x561a('0x31')](0xc8)['json']({'error':![],'message':_0x561a('0x45')});})[_0x561a('0x21')](handleError(_0x5e9e37));};exports[_0x561a('0x46')]=function(_0x48ed34,_0x14fe1b){logger[_0x561a('0x13')]('unhold\x20fired:',_0x48ed34[_0x561a('0x2e')]);var _0x99dc7f=unholdValidation[_0x561a('0x2f')](_0x48ed34['body']);if(_0x99dc7f[_0x561a('0x30')]>0x0){return _0x14fe1b[_0x561a('0x31')](0x190)[_0x561a('0x32')](_0x99dc7f);}var _0x2cd4e0=_0x48ed34[_0x561a('0x2e')][_0x561a('0x33')];var _0x3d9b63=_0x48ed34['body'][_0x561a('0x29')];return getAgent(_0x2cd4e0)[_0x561a('0x1d')](function(_0x2dc1a3){logger[_0x561a('0x13')](_0x561a('0x36'),_0x2dc1a3[_0x561a('0x19')]);emit(util[_0x561a('0x37')]('user:%s',_0x2dc1a3[_0x561a('0x19')]),_0x561a('0x47'),{'sessionId':_0x3d9b63});return _0x14fe1b[_0x561a('0x31')](0xc8)['json']({'error':![],'message':_0x561a('0x48')});})['catch'](handleError(_0x14fe1b));};exports[_0x561a('0x49')]=function(_0x3d03c5,_0x2e0351){logger[_0x561a('0x13')](_0x561a('0x4a'),_0x2e0351[_0x561a('0x2e')]);var _0x29d981=callsValidation['validate'](_0x3d03c5['body']);if(_0x29d981[_0x561a('0x30')]>0x0){return _0x2e0351[_0x561a('0x31')](0x190)[_0x561a('0x32')](_0x29d981);}var _0x2945c1=_0x3d03c5[_0x561a('0x2e')][_0x561a('0x33')];var _0x4d13c8=respondWithRpcPromise(_0x561a('0x25'));var _0x1b0ecf=getAgent(_0x2945c1);return Promise['all']([_0x4d13c8,_0x1b0ecf])[_0x561a('0x1d')](function(_0x574ee2){var _0x5194d5=_0x574ee2[0x0];var _0xc7447e=_0x574ee2[0x1];var _0x16daeb=_[_0x561a('0x27')](_0x5194d5[_0x561a('0x4b')],function(_0x4a714c){return _0x4a714c[_0x561a('0x28')]==_0xc7447e['id'];});return _0x2e0351['status'](0xc8)[_0x561a('0x32')]({'count':_0x16daeb[_0x561a('0x30')],'rows':_0x16daeb});})[_0x561a('0x21')](handleError(_0x2e0351));};exports['conference']=function(_0x4ec13c,_0x52074a){logger['info'](_0x561a('0x4c'),_0x4ec13c[_0x561a('0x2e')]);var _0x485b80=conferenceValidation[_0x561a('0x2f')](_0x4ec13c[_0x561a('0x2e')]);if(_0x485b80[_0x561a('0x30')]>0x0){return _0x52074a['status'](0x190)[_0x561a('0x32')](_0x485b80);}var _0xb046d8=_0x4ec13c[_0x561a('0x2e')][_0x561a('0x33')];return getAgent(_0xb046d8)[_0x561a('0x1d')](function(_0x849fe){logger[_0x561a('0x13')](_0x561a('0x36'),_0x849fe[_0x561a('0x19')]);emit(util[_0x561a('0x37')](_0x561a('0x38'),_0x849fe['name']),_0x561a('0x4d'));return _0x52074a[_0x561a('0x31')](0xc8)['json']({'error':![],'message':'conference\x20executed!'});})[_0x561a('0x21')](handleError(_0x52074a));};exports[_0x561a('0x4e')]=function(_0x565867,_0x40f22e){logger[_0x561a('0x13')](_0x561a('0x4f'),_0x565867[_0x561a('0x2e')]);var _0x30d2a7=transferValidation[_0x561a('0x2f')](_0x565867['body']);if(_0x30d2a7['length']>0x0){return _0x40f22e[_0x561a('0x31')](0x190)[_0x561a('0x32')](_0x30d2a7);}var _0x3c8b20=_0x565867[_0x561a('0x2e')][_0x561a('0x33')];var _0x1656b=_0x565867['body']['sessionId'];var _0x53a93a=_0x565867[_0x561a('0x2e')][_0x561a('0x50')];return getAgent(_0x3c8b20)[_0x561a('0x1d')](function(_0x57bffc){logger['info']('entityFound:',_0x57bffc['name']);emit(util[_0x561a('0x37')](_0x561a('0x38'),_0x57bffc['name']),_0x561a('0x51'),{'sessionId':_0x1656b,'transferNumber':_0x53a93a});return _0x40f22e['status'](0xc8)['json']({'error':![],'message':_0x561a('0x52')});})[_0x561a('0x21')](handleError(_0x40f22e));}; \ No newline at end of file +var _0x6953=['calls','calls\x20fired:','VoiceChannels','conference','conference\x20fired:','webbar:conference','transfer','transferNumber','transfer\x20executed!','path','lodash','bluebird','client','http','../../config/logger','ioredis','defaults','redis','localhost','socket.io-emitter','number','string','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','log','handleError:','error','stack','name','status','send','NotFound','request','message','catch','findOne','then','all','filter','rows','UserId','sessionId','length','\x20not\x20found!','originate','originate\x20fired:','validate','json','body','userId','entityFound:','user:%s','webbar:originate','hangup','hangup\x20fired:','format','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold\x20fired:','webbar:hold','webbar:unhold','unhold\x20executed!'];(function(_0x3ccaf9,_0xe61c96){var _0x778007=function(_0x1d198f){while(--_0x1d198f){_0x3ccaf9['push'](_0x3ccaf9['shift']());}};_0x778007(++_0xe61c96);}(_0x6953,0x91));var _0x3695=function(_0x1dfbdf,_0x459d58){_0x1dfbdf=_0x1dfbdf-0x0;var _0x2893a6=_0x6953[_0x1dfbdf];return _0x2893a6;};'use strict';var path=require(_0x3695('0x0'));var fs=require('fs');var _=require(_0x3695('0x1'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var util=require('util');var BPromise=require(_0x3695('0x2'));var jayson=require('jayson/promise');var amiClient=jayson[_0x3695('0x3')][_0x3695('0x4')]({'port':0x232a});var logger=require(_0x3695('0x5'))('webbarapi');var Redis=require(_0x3695('0x6'));config['redis']=_[_0x3695('0x7')](config[_0x3695('0x8')],{'host':_0x3695('0x9'),'port':0x18eb});var io=require(_0x3695('0xa'))(new Redis(config[_0x3695('0x8')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x3695('0xb'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x3695('0xc'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':'string'},'callbackUrl':{'type':_0x3695('0xc')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x3695('0xd')]},'sessionId':{'type':_0x3695('0xc'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x3695('0xb'),'required':[!![],_0x3695('0xd')]},'sessionId':{'type':_0x3695('0xc'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x3695('0xb'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x3695('0xc'),'required':[!![],_0x3695('0xe')]},'transferNumber':{'type':_0x3695('0xc'),'required':[!![],_0x3695('0xf')]}});var holdValidation=new Schema({'userId':{'type':_0x3695('0xb'),'required':[!![],_0x3695('0xd')]},'sessionId':{'type':_0x3695('0xc'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x3695('0xb'),'required':[!![],_0x3695('0xd')]},'sessionId':{'type':_0x3695('0xc'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x3695('0xb'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x3695('0xb'),'required':[!![],_0x3695('0xd')]}});function emit(_0x2cdd3,_0x3cb320,_0x367191){logger[_0x3695('0x10')](_0x2cdd3,_0x3cb320,JSON[_0x3695('0x11')](_0x367191));io['to'](_0x2cdd3)['emit'](_0x3cb320,_0x367191);}function handleError(_0x717ee4){return function(_0x5edf8d){console[_0x3695('0x12')](_0x3695('0x13'),_0x5edf8d,_0x5edf8d instanceof RangeError);logger[_0x3695('0x14')](_0x5edf8d[_0x3695('0x15')]);if(_0x5edf8d instanceof RangeError){if(_0x5edf8d[_0x3695('0x16')]){delete _0x5edf8d['name'];}_0x717ee4[_0x3695('0x17')](0x194)[_0x3695('0x18')](_0x5edf8d);}else{if(_0x5edf8d[_0x3695('0x16')]){delete _0x5edf8d[_0x3695('0x16')];}_0x717ee4[_0x3695('0x17')](0x1f4)[_0x3695('0x18')](_0x5edf8d);}};}function checkError(){return function(_0x34b0fc){if(!_0x34b0fc){throw new RangeError(_0x3695('0x19'));}return _0x34b0fc;};}function respondWithRpcPromise(_0x1f267a,_0xbbffe2){return new BPromise(function(_0x1b97d2,_0xf2c747){var _0x459f33=amiClient;return _0x459f33[_0x3695('0x1a')](_0x1f267a,_0xbbffe2)['then'](function(_0x42648c){if(_0x42648c[_0x3695('0x14')]){if(_0x42648c['error']['code']===0x1f4){return _0xf2c747(_0x42648c[_0x3695('0x14')][_0x3695('0x1b')]);}return _0x1b97d2(_0x42648c[_0x3695('0x14')][_0x3695('0x1b')]);}else{_0x1b97d2(_0x42648c['result']);}})[_0x3695('0x1c')](function(_0x48c2fd){_0xf2c747(_0x48c2fd);});});}function getAgent(_0xeddb06){return db['User'][_0x3695('0x1d')]({'where':{'id':_0xeddb06,'role':'agent'}})[_0x3695('0x1e')](checkError());}function getAgentCheckSession(_0x19f834,_0x462ff0){return new BPromise(function(_0x18a474,_0x3d4442){var _0x31fdf3=respondWithRpcPromise('VoiceChannels');var _0x2be6ee=getAgent(_0x19f834);Promise[_0x3695('0x1f')]([_0x31fdf3,_0x2be6ee])['then'](function(_0x392107){var _0x4d0742=_0x392107[0x0];var _0x39c39f=_0x392107[0x1];var _0x399bc6=_[_0x3695('0x20')](_0x4d0742[_0x3695('0x21')],function(_0x30a5ba){return _0x30a5ba[_0x3695('0x22')]==_0x39c39f['id']&&_0x30a5ba[_0x3695('0x23')]==_0x462ff0;});if(_0x399bc6[_0x3695('0x24')]==0x1){_0x18a474(_0x39c39f);}else{_0x3d4442(new RangeError('sessionId\x20'+_0x462ff0+_0x3695('0x25')));}});});}exports[_0x3695('0x26')]=function(_0xe6455e,_0x4c604f){logger['info'](_0x3695('0x27'),_0xe6455e['body']);var _0x12dbce=originateValidation[_0x3695('0x28')](_0xe6455e['body']);if(_0x12dbce[_0x3695('0x24')]>0x0){return _0x4c604f['status'](0x190)[_0x3695('0x29')](_0x12dbce);}var _0x197396=_0xe6455e[_0x3695('0x2a')][_0x3695('0x2b')];var _0x30eab2=_0xe6455e[_0x3695('0x2a')]['callNumber'];var _0x3ab2a0=_0xe6455e[_0x3695('0x2a')]['callerId'];var _0x2e657e=_0xe6455e[_0x3695('0x2a')]['callbackUrl'];return getAgent(_0x197396)['then'](function(_0x4c359d){logger['info'](_0x3695('0x2c'),_0x4c359d[_0x3695('0x16')]);emit(util['format'](_0x3695('0x2d'),_0x4c359d[_0x3695('0x16')]),_0x3695('0x2e'),{'callNumber':_0x30eab2,'callerId':_0x3ab2a0,'callbackUrl':_0x2e657e});return _0x4c604f[_0x3695('0x17')](0xc8)['json']({'error':![],'message':'originate\x20executed!'});})[_0x3695('0x1c')](handleError(_0x4c604f));};exports[_0x3695('0x2f')]=function(_0x59c271,_0x12ebe9){logger[_0x3695('0x10')](_0x3695('0x30'),_0x59c271[_0x3695('0x2a')]);var _0xaee5e8=hangupValidation[_0x3695('0x28')](_0x59c271[_0x3695('0x2a')]);if(_0xaee5e8[_0x3695('0x24')]>0x0){return _0x12ebe9[_0x3695('0x17')](0x190)[_0x3695('0x29')](_0xaee5e8);}var _0x460b49=_0x59c271[_0x3695('0x2a')][_0x3695('0x2b')];var _0x1d0fa0=_0x59c271[_0x3695('0x2a')][_0x3695('0x23')];return getAgent(_0x460b49)['then'](function(_0x775d39){logger[_0x3695('0x10')](_0x3695('0x2c'),_0x775d39[_0x3695('0x16')]);emit(util[_0x3695('0x31')](_0x3695('0x2d'),_0x775d39[_0x3695('0x16')]),'webbar:hangup',{'sessionId':_0x1d0fa0});return _0x12ebe9[_0x3695('0x17')](0xc8)[_0x3695('0x29')]({'error':![],'message':_0x3695('0x32')});})['catch'](handleError(_0x12ebe9));};exports[_0x3695('0x33')]=function(_0x454e86,_0x3ffc79){logger[_0x3695('0x10')](_0x3695('0x34'),_0x454e86[_0x3695('0x2a')]);var _0x4261d1=answerValidation['validate'](_0x454e86[_0x3695('0x2a')]);if(_0x4261d1['length']>0x0){return _0x3ffc79['status'](0x190)[_0x3695('0x29')](_0x4261d1);}var _0x51f403=_0x454e86[_0x3695('0x2a')][_0x3695('0x2b')];var _0x65f4b3=_0x454e86[_0x3695('0x2a')]['sessionId'];return getAgent(_0x51f403)[_0x3695('0x1e')](function(_0x34cbd8){logger[_0x3695('0x10')]('entityFound:',_0x34cbd8[_0x3695('0x16')]);emit(util[_0x3695('0x31')](_0x3695('0x2d'),_0x34cbd8[_0x3695('0x16')]),_0x3695('0x35'),{'sessionId':_0x65f4b3});return _0x3ffc79[_0x3695('0x17')](0xc8)[_0x3695('0x29')]({'error':![],'message':_0x3695('0x36')});})[_0x3695('0x1c')](handleError(_0x3ffc79));};exports['hold']=function(_0x57bf10,_0x1a021e){logger[_0x3695('0x10')](_0x3695('0x37'),_0x57bf10['body']);var _0x1c8fc3=holdValidation[_0x3695('0x28')](_0x57bf10[_0x3695('0x2a')]);if(_0x1c8fc3['length']>0x0){return _0x1a021e[_0x3695('0x17')](0x190)[_0x3695('0x29')](_0x1c8fc3);}var _0x3d6a61=_0x57bf10[_0x3695('0x2a')][_0x3695('0x2b')];var _0x567d5e=_0x57bf10[_0x3695('0x2a')][_0x3695('0x23')];return getAgent(_0x3d6a61)[_0x3695('0x1e')](function(_0x361a9f){logger['info'](_0x3695('0x2c'),_0x361a9f['name']);emit(util['format'](_0x3695('0x2d'),_0x361a9f[_0x3695('0x16')]),_0x3695('0x38'),{'sessionId':_0x567d5e});return _0x1a021e[_0x3695('0x17')](0xc8)[_0x3695('0x29')]({'error':![],'message':'hold\x20executed!'});})['catch'](handleError(_0x1a021e));};exports['unhold']=function(_0x5173b8,_0x5eeaca){logger['info']('unhold\x20fired:',_0x5173b8['body']);var _0x3b1c1c=unholdValidation[_0x3695('0x28')](_0x5173b8['body']);if(_0x3b1c1c[_0x3695('0x24')]>0x0){return _0x5eeaca[_0x3695('0x17')](0x190)['json'](_0x3b1c1c);}var _0x4a0a78=_0x5173b8[_0x3695('0x2a')][_0x3695('0x2b')];var _0x1a61d6=_0x5173b8['body'][_0x3695('0x23')];return getAgent(_0x4a0a78)[_0x3695('0x1e')](function(_0x1422f0){logger[_0x3695('0x10')](_0x3695('0x2c'),_0x1422f0[_0x3695('0x16')]);emit(util[_0x3695('0x31')](_0x3695('0x2d'),_0x1422f0[_0x3695('0x16')]),_0x3695('0x39'),{'sessionId':_0x1a61d6});return _0x5eeaca[_0x3695('0x17')](0xc8)[_0x3695('0x29')]({'error':![],'message':_0x3695('0x3a')});})[_0x3695('0x1c')](handleError(_0x5eeaca));};exports[_0x3695('0x3b')]=function(_0x63771a,_0x441997){logger[_0x3695('0x10')](_0x3695('0x3c'),_0x441997[_0x3695('0x2a')]);var _0x42a960=callsValidation[_0x3695('0x28')](_0x63771a[_0x3695('0x2a')]);if(_0x42a960['length']>0x0){return _0x441997['status'](0x190)[_0x3695('0x29')](_0x42a960);}var _0xea6f22=_0x63771a['body'][_0x3695('0x2b')];var _0x43f6f5=respondWithRpcPromise(_0x3695('0x3d'));var _0x357564=getAgent(_0xea6f22);return Promise[_0x3695('0x1f')]([_0x43f6f5,_0x357564])[_0x3695('0x1e')](function(_0x38d20c){var _0x9a8d31=_0x38d20c[0x0];var _0x520fd3=_0x38d20c[0x1];var _0x29c8a3=_['filter'](_0x9a8d31[_0x3695('0x21')],function(_0x3098f7){return _0x3098f7[_0x3695('0x22')]==_0x520fd3['id'];});return _0x441997[_0x3695('0x17')](0xc8)[_0x3695('0x29')]({'count':_0x29c8a3['length'],'rows':_0x29c8a3});})[_0x3695('0x1c')](handleError(_0x441997));};exports[_0x3695('0x3e')]=function(_0xf18f60,_0x55f673){logger[_0x3695('0x10')](_0x3695('0x3f'),_0xf18f60['body']);var _0x47cd30=conferenceValidation[_0x3695('0x28')](_0xf18f60['body']);if(_0x47cd30['length']>0x0){return _0x55f673[_0x3695('0x17')](0x190)[_0x3695('0x29')](_0x47cd30);}var _0xade517=_0xf18f60[_0x3695('0x2a')][_0x3695('0x2b')];return getAgent(_0xade517)['then'](function(_0x3250f1){logger[_0x3695('0x10')](_0x3695('0x2c'),_0x3250f1['name']);emit(util[_0x3695('0x31')](_0x3695('0x2d'),_0x3250f1[_0x3695('0x16')]),_0x3695('0x40'));return _0x55f673[_0x3695('0x17')](0xc8)[_0x3695('0x29')]({'error':![],'message':'conference\x20executed!'});})[_0x3695('0x1c')](handleError(_0x55f673));};exports[_0x3695('0x41')]=function(_0x41e8de,_0x2551fd){logger[_0x3695('0x10')]('transfer\x20fired:',_0x41e8de[_0x3695('0x2a')]);var _0x19b3e3=transferValidation[_0x3695('0x28')](_0x41e8de[_0x3695('0x2a')]);if(_0x19b3e3[_0x3695('0x24')]>0x0){return _0x2551fd[_0x3695('0x17')](0x190)['json'](_0x19b3e3);}var _0x1effea=_0x41e8de[_0x3695('0x2a')]['userId'];var _0x4e7d7a=_0x41e8de[_0x3695('0x2a')][_0x3695('0x23')];var _0x1b500b=_0x41e8de['body'][_0x3695('0x42')];return getAgent(_0x1effea)[_0x3695('0x1e')](function(_0x1bd95d){logger[_0x3695('0x10')](_0x3695('0x2c'),_0x1bd95d['name']);emit(util[_0x3695('0x31')]('user:%s',_0x1bd95d['name']),'webbar:transfer',{'sessionId':_0x4e7d7a,'transferNumber':_0x1b500b});return _0x2551fd[_0x3695('0x17')](0xc8)[_0x3695('0x29')]({'error':![],'message':_0x3695('0x43')});})[_0x3695('0x1c')](handleError(_0x2551fd));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 47ddda8..d91fd95 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(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9582,0x95));var _0x2958=function(_0x561173,_0x12477c){_0x561173=_0x561173-0x0;var _0x3b16d4=_0x9582[_0x561173];return _0x3b16d4;};'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 _0x430c=['Router','./whatsappAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','getAgents','/:id/applications','getApplications','post','addDisposition','/:id/users','addAgents','send','put','delete','destroy','removeDispositions','/:id/canned_answers','removeAgents','multer','connect-timeout','express'];(function(_0x5a516a,_0x541200){var _0x38c0d9=function(_0x4d2d8f){while(--_0x4d2d8f){_0x5a516a['push'](_0x5a516a['shift']());}};_0x38c0d9(++_0x541200);}(_0x430c,0x1a1));var _0xc430=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x430c[_0x5f309e];return _0x487b5e;};'use strict';var multer=require(_0xc430('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc430('0x1'));var express=require(_0xc430('0x2'));var router=express[_0xc430('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(_0xc430('0x4'));router[_0xc430('0x5')]('/',auth['isAuthenticated'](),controller[_0xc430('0x6')]);router['get'](_0xc430('0x7'),auth[_0xc430('0x8')](),controller[_0xc430('0x9')]);router[_0xc430('0x5')](_0xc430('0xa'),auth[_0xc430('0x8')](),controller[_0xc430('0xb')]);router[_0xc430('0x5')](_0xc430('0xc'),auth['isAuthenticated'](),controller[_0xc430('0xd')]);router[_0xc430('0x5')]('/:id/canned_answers',auth[_0xc430('0x8')](),controller['getAnswers']);router[_0xc430('0x5')]('/:id/users',auth[_0xc430('0x8')](),controller[_0xc430('0xe')]);router[_0xc430('0x5')](_0xc430('0xf'),auth[_0xc430('0x8')](),controller[_0xc430('0x10')]);router[_0xc430('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc430('0x11')](_0xc430('0xc'),auth[_0xc430('0x8')](),controller[_0xc430('0x12')]);router[_0xc430('0x11')]('/:id/canned_answers',auth[_0xc430('0x8')](),controller['addAnswer']);router['post'](_0xc430('0x13'),auth[_0xc430('0x8')](),controller[_0xc430('0x14')]);router['post']('/:id/applications',auth[_0xc430('0x8')](),controller['addApplications']);router[_0xc430('0x11')]('/:id/notify',controller['notify']);router[_0xc430('0x11')]('/:id/send',auth[_0xc430('0x8')](),controller[_0xc430('0x15')]);router[_0xc430('0x16')](_0xc430('0xa'),auth[_0xc430('0x8')](),controller['update']);router[_0xc430('0x17')]('/:id',auth['isAuthenticated'](),controller[_0xc430('0x18')]);router[_0xc430('0x17')](_0xc430('0xc'),auth['isAuthenticated'](),controller[_0xc430('0x19')]);router['delete'](_0xc430('0x1a'),auth[_0xc430('0x8')](),controller['removeAnswers']);router[_0xc430('0x17')](_0xc430('0x13'),auth['isAuthenticated'](),controller[_0xc430('0x1b')]);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 5e1cbfc..7eac557 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 _0xcc5c=['mandatoryDisposition','randomstring','exports','STRING','name','generate','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue'];(function(_0x45049b,_0x2cf91d){var _0x2ebfdb=function(_0xcd5bee){while(--_0xcd5bee){_0x45049b['push'](_0x45049b['shift']());}};_0x2ebfdb(++_0x2cf91d);}(_0xcc5c,0x1a5));var _0xccc5=function(_0xc95b04,_0x3bf272){_0xc95b04=_0xc95b04-0x0;var _0x6deb17=_0xcc5c[_0xc95b04];return _0x6deb17;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xccc5('0x0'));module[_0xccc5('0x1')]={'name':{'type':Sequelize[_0xccc5('0x2')],'unique':_0xccc5('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xccc5('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xccc5('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xccc5('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0xccc5('0x5'),_0xccc5('0x6'))},'accountSid':{'type':Sequelize[_0xccc5('0x2')]},'baseUrl':{'type':Sequelize[_0xccc5('0x2')]},'authToken':{'type':Sequelize[_0xccc5('0x2')]},'notificationTemplate':{'type':Sequelize[_0xccc5('0x7')],'defaultValue':function(){return _0xccc5('0x8');}},'notificationSound':{'type':Sequelize[_0xccc5('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xccc5('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xccc5('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xccc5('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xccc5('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xccc5('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xccc5('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xccc5('0xa')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xccc5('0xb'),'set':function(_0x4f612b){if(!_0x4f612b){this['setDataValue'](_0xccc5('0xc'),null);}this[_0xccc5('0xd')](_0xccc5('0xe'),_0x4f612b);}},'description':{'type':Sequelize[_0xccc5('0x2')]}}; \ No newline at end of file +var _0xea8d=['mandatoryDisposition','sequelize','randomstring','STRING','generate','ENUM','sinch','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xea8d,0x71));var _0xdea8=function(_0x41a782,_0x127c91){_0x41a782=_0x41a782-0x0;var _0x49e3f8=_0xea8d[_0x41a782];return _0x49e3f8;};'use strict';var Sequelize=require(_0xdea8('0x0'));var rs=require(_0xdea8('0x1'));module['exports']={'name':{'type':Sequelize[_0xdea8('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xdea8('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xdea8('0x2')],'defaultValue':function(){return rs[_0xdea8('0x3')]();}},'phone':{'type':Sequelize[_0xdea8('0x2')]},'type':{'type':Sequelize[_0xdea8('0x4')]('twilio',_0xdea8('0x5'))},'accountSid':{'type':Sequelize[_0xdea8('0x2')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xdea8('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xdea8('0x6');}},'notificationSound':{'type':Sequelize[_0xdea8('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xdea8('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xdea8('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xdea8('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdea8('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdea8('0x8')],'comment':_0xdea8('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xdea8('0x7')],'defaultValue':![],'comment':_0xdea8('0xa'),'set':function(_0x1b85ac){if(!_0x1b85ac){this[_0xdea8('0xb')](_0xdea8('0xc'),null);}this[_0xdea8('0xb')](_0xdea8('0xd'),_0x1b85ac);}},'description':{'type':Sequelize[_0xdea8('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 47c9268..74f9d00 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 _0x6e38=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','redis','defaults','socket.io-emitter','./whatsappAccount.socket','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','save','update','get','WhatsappAccounts','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','include','catch','show','rawAttributes','includeAll','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','WhatsappAccountId','Disposition','getDispositions','findOne','filter','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findAll','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','destroy','bulkCreate','priority','finally','json','getApplications','notify','whatsapp','Applications','account','sinch','statuses','read','WhatsappMessage','message_id','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','CompanyId','twilio','from','From','replace','whatsapp:','Body','MessageSid','notifications','messageId','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','updatedAt','DESC','list','WhatsappInteraction','interaction','autoclose','applications','push','close','unmanaged','ContactId','UserId','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','text/xml','send','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','List','dataValues','Messages','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis'];(function(_0x217d94,_0x1b79e9){var _0x26d2da=function(_0x63ee8a){while(--_0x63ee8a){_0x217d94['push'](_0x217d94['shift']());}};_0x26d2da(++_0x1b79e9);}(_0x6e38,0xb2));var _0x86e3=function(_0x459abc,_0x42a0bd){_0x459abc=_0x459abc-0x0;var _0x57f8c2=_0x6e38[_0x459abc];return _0x57f8c2;};'use strict';var emlformat=require(_0x86e3('0x0'));var rimraf=require(_0x86e3('0x1'));var zipdir=require(_0x86e3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x86e3('0x3'));var moment=require(_0x86e3('0x4'));var BPromise=require(_0x86e3('0x5'));var Mustache=require('mustache');var util=require(_0x86e3('0x6'));var path=require(_0x86e3('0x7'));var sox=require(_0x86e3('0x8'));var csv=require(_0x86e3('0x9'));var ejs=require(_0x86e3('0xa'));var fs=require('fs');var fs_extra=require(_0x86e3('0xb'));var _=require(_0x86e3('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x86e3('0xd'));var deskjs=require(_0x86e3('0xe'));var toCsv=require(_0x86e3('0x9'));var querystring=require(_0x86e3('0xf'));var Papa=require('papaparse');var Redis=require(_0x86e3('0x10'));var authService=require(_0x86e3('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x86e3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x86e3('0x13'))('api');var utils=require(_0x86e3('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x86e3('0x15'));var db=require('../../mysqldb')['db'];config[_0x86e3('0x16')]=_[_0x86e3('0x17')](config[_0x86e3('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x86e3('0x18'))(new Redis(config['redis']));require(_0x86e3('0x19'))['register'](socket);var jayson=require(_0x86e3('0x1a'));var client=jayson[_0x86e3('0x1b')][_0x86e3('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x1ae475,_0x563b5e,_0x3d2877,_0x146641){return new BPromise(function(_0x4f2216,_0x9f5f35){var _0x407a9e=_0x146641||client;return _0x407a9e[_0x86e3('0x1d')](_0x1ae475,_0x3d2877)[_0x86e3('0x1e')](function(_0x57b3bb){logger[_0x86e3('0x1f')](_0x86e3('0x20'),_0x563b5e,'request\x20sent');logger[_0x86e3('0x21')](_0x86e3('0x22'),_0x563b5e,_0x86e3('0x23'),JSON[_0x86e3('0x24')](_0x57b3bb));if(_0x57b3bb['error']){if(_0x57b3bb['error'][_0x86e3('0x25')]===0x1f4){logger[_0x86e3('0x26')](_0x86e3('0x20'),_0x563b5e,_0x57b3bb['error'][_0x86e3('0x27')]);return _0x9f5f35(_0x57b3bb[_0x86e3('0x26')][_0x86e3('0x27')]);}logger[_0x86e3('0x26')](_0x86e3('0x20'),_0x563b5e,_0x57b3bb[_0x86e3('0x26')][_0x86e3('0x27')]);return _0x4f2216(_0x57b3bb[_0x86e3('0x26')][_0x86e3('0x27')]);}else{logger['info'](_0x86e3('0x20'),_0x563b5e,_0x86e3('0x23'));_0x4f2216(_0x57b3bb[_0x86e3('0x28')]['message']);}})['catch'](function(_0x147aeb){logger[_0x86e3('0x26')](_0x86e3('0x20'),_0x563b5e,_0x147aeb);_0x9f5f35(_0x147aeb);});});}function respondWithStatusCode(_0x7afc73,_0x2c7169){_0x2c7169=_0x2c7169||0xcc;return function(_0x5071bc){if(_0x5071bc){return _0x7afc73[_0x86e3('0x29')](_0x2c7169);}return _0x7afc73[_0x86e3('0x2a')](_0x2c7169)[_0x86e3('0x2b')]();};}function respondWithResult(_0x2f3171,_0x238be6){_0x238be6=_0x238be6||0xc8;return function(_0x27f9f6){if(_0x27f9f6){return _0x2f3171[_0x86e3('0x2a')](_0x238be6)['json'](_0x27f9f6);}};}function respondWithFilteredResult(_0x3c07b5,_0x5d05b1){return function(_0x2d0ec4){if(_0x2d0ec4){var _0x25c58b=typeof _0x5d05b1[_0x86e3('0x2c')]===_0x86e3('0x2d')&&typeof _0x5d05b1['limit']===_0x86e3('0x2d');var _0x50408b=_0x2d0ec4[_0x86e3('0x2e')];var _0x5cd703=_0x25c58b?0x0:_0x5d05b1['offset'];var _0xc3072b=_0x25c58b?_0x2d0ec4[_0x86e3('0x2e')]:_0x5d05b1[_0x86e3('0x2c')]+_0x5d05b1[_0x86e3('0x2f')];var _0x5eb61f;if(_0xc3072b>=_0x50408b){_0xc3072b=_0x50408b;_0x5eb61f=0xc8;}else{_0x5eb61f=0xce;}_0x3c07b5[_0x86e3('0x2a')](_0x5eb61f);return _0x3c07b5[_0x86e3('0x30')](_0x86e3('0x31'),_0x5cd703+'-'+_0xc3072b+'/'+_0x50408b)['json'](_0x2d0ec4);}return null;};}function patchUpdates(_0x4996ec){return function(_0x4da939){try{jsonpatch[_0x86e3('0x32')](_0x4da939,_0x4996ec,!![]);}catch(_0x2b12a5){return BPromise['reject'](_0x2b12a5);}return _0x4da939[_0x86e3('0x33')]();};}function saveUpdates(_0x510941,_0x5df46f){return function(_0x44f2fc){if(_0x44f2fc){return _0x44f2fc[_0x86e3('0x34')](_0x510941)[_0x86e3('0x1e')](function(_0x4aa136){return _0x4aa136;});}return null;};}function removeEntity(_0x24ebd4,_0x5322da){return function(_0x3f71b6){if(_0x3f71b6){return _0x3f71b6['destroy']()[_0x86e3('0x1e')](function(){var _0x3dedfb=_0x3f71b6[_0x86e3('0x35')]({'plain':!![]});var _0x368028=_0x86e3('0x36');return db[_0x86e3('0x37')]['destroy']({'where':{'type':_0x368028,'resourceId':_0x3dedfb['id']}})['then'](function(){return _0x3f71b6;});})[_0x86e3('0x1e')](function(){_0x24ebd4['status'](0xcc)[_0x86e3('0x2b')]();});}};}function handleEntityNotFound(_0x55a0ee,_0x5717aa){return function(_0xcc8e94){if(!_0xcc8e94){_0x55a0ee['sendStatus'](0x194);}return _0xcc8e94;};}function handleError(_0x364a2a,_0x3a00d7){_0x3a00d7=_0x3a00d7||0x1f4;return function(_0x3d7f53){logger['error'](_0x3d7f53[_0x86e3('0x38')]);if(_0x3d7f53[_0x86e3('0x39')]){delete _0x3d7f53[_0x86e3('0x39')];}_0x364a2a['status'](_0x3a00d7)['send'](_0x3d7f53);};}exports[_0x86e3('0x3a')]=function(_0xe9e839,_0x43509c){var _0x5df7b7={'include':[{'model':db[_0x86e3('0x3b')],'as':_0x86e3('0x3c')}]},_0x567c41={},_0xd14b82={'count':0x0,'rows':[]};var _0xcabc4=_[_0x86e3('0x3d')](db[_0x86e3('0x3e')]['rawAttributes'],function(_0x42f7b5){return{'name':_0x42f7b5['fieldName'],'type':_0x42f7b5[_0x86e3('0x3f')][_0x86e3('0x40')]};});_0x567c41[_0x86e3('0x41')]=_[_0x86e3('0x3d')](_0xcabc4,_0x86e3('0x39'));_0x567c41[_0x86e3('0x42')]=_[_0x86e3('0x43')](_0xe9e839[_0x86e3('0x42')]);_0x567c41[_0x86e3('0x44')]=_[_0x86e3('0x45')](_0x567c41[_0x86e3('0x41')],_0x567c41[_0x86e3('0x42')]);_0x5df7b7['attributes']=_[_0x86e3('0x45')](_0x567c41['model'],qs[_0x86e3('0x46')](_0xe9e839['query'][_0x86e3('0x46')]));_0x5df7b7[_0x86e3('0x47')]=_0x5df7b7[_0x86e3('0x47')][_0x86e3('0x48')]?_0x5df7b7[_0x86e3('0x47')]:_0x567c41[_0x86e3('0x41')];if(!_0xe9e839[_0x86e3('0x42')][_0x86e3('0x49')](_0x86e3('0x4a'))){_0x5df7b7['limit']=qs[_0x86e3('0x2f')](_0xe9e839[_0x86e3('0x42')][_0x86e3('0x2f')]);_0x5df7b7[_0x86e3('0x2c')]=qs[_0x86e3('0x2c')](_0xe9e839[_0x86e3('0x42')]['offset']);}_0x5df7b7[_0x86e3('0x4b')]=qs[_0x86e3('0x4c')](_0xe9e839[_0x86e3('0x42')][_0x86e3('0x4c')]);_0x5df7b7[_0x86e3('0x4d')]=qs[_0x86e3('0x44')](_[_0x86e3('0x4e')](_0xe9e839[_0x86e3('0x42')],_0x567c41[_0x86e3('0x44')]),_0xcabc4);if(_0xe9e839[_0x86e3('0x42')]['filter']){_0x5df7b7[_0x86e3('0x4d')]=_[_0x86e3('0x4f')](_0x5df7b7[_0x86e3('0x4d')],{'$or':_['map'](_0xcabc4,function(_0xebca0c){if(_0xebca0c['type']!==_0x86e3('0x50')){var _0x313707={};_0x313707[_0xebca0c[_0x86e3('0x39')]]={'$like':'%'+_0xe9e839[_0x86e3('0x42')]['filter']+'%'};return _0x313707;}})});}_0x5df7b7=_[_0x86e3('0x4f')]({},_0x5df7b7,_0xe9e839[_0x86e3('0x51')]);var _0x5a1fea={'where':_0x5df7b7[_0x86e3('0x4d')]};return db['WhatsappAccount'][_0x86e3('0x2e')](_0x5a1fea)[_0x86e3('0x1e')](function(_0x4f1ef3){_0xd14b82[_0x86e3('0x2e')]=_0x4f1ef3;if(_0xe9e839['query']['includeAll']){_0x5df7b7[_0x86e3('0x52')]=[{'all':!![]}];}return db[_0x86e3('0x3e')]['findAll'](_0x5df7b7);})[_0x86e3('0x1e')](function(_0x2144b2){_0xd14b82['rows']=_0x2144b2;return _0xd14b82;})[_0x86e3('0x1e')](respondWithFilteredResult(_0x43509c,_0x5df7b7))[_0x86e3('0x53')](handleError(_0x43509c,null));};exports[_0x86e3('0x54')]=function(_0x1e2d44,_0x5f3a55){var _0x44a7e8={'raw':![],'where':{'id':_0x1e2d44['params']['id']},'include':[{'model':db['Pause'],'as':_0x86e3('0x3c')}]},_0x393e45={};_0x393e45[_0x86e3('0x41')]=_['keys'](db[_0x86e3('0x3e')][_0x86e3('0x55')]);_0x393e45['query']=_[_0x86e3('0x43')](_0x1e2d44[_0x86e3('0x42')]);_0x393e45[_0x86e3('0x44')]=_['intersection'](_0x393e45[_0x86e3('0x41')],_0x393e45['query']);_0x44a7e8[_0x86e3('0x47')]=_['intersection'](_0x393e45[_0x86e3('0x41')],qs[_0x86e3('0x46')](_0x1e2d44[_0x86e3('0x42')][_0x86e3('0x46')]));_0x44a7e8[_0x86e3('0x47')]=_0x44a7e8[_0x86e3('0x47')]['length']?_0x44a7e8[_0x86e3('0x47')]:_0x393e45['model'];if(_0x1e2d44['query'][_0x86e3('0x56')]){_0x44a7e8[_0x86e3('0x52')]=[{'all':!![]}];}_0x44a7e8=_[_0x86e3('0x4f')]({},_0x44a7e8,_0x1e2d44[_0x86e3('0x51')]);return db[_0x86e3('0x3e')]['find'](_0x44a7e8)['then'](handleEntityNotFound(_0x5f3a55,null))['then'](respondWithResult(_0x5f3a55,null))[_0x86e3('0x53')](handleError(_0x5f3a55,null));};exports[_0x86e3('0x57')]=function(_0x14afae,_0x362c34){return db[_0x86e3('0x3e')]['create'](_0x14afae[_0x86e3('0x58')],{})['then'](function(_0x594935){var _0x177604=_0x14afae['user'][_0x86e3('0x35')]({'plain':!![]});if(!_0x177604)throw new Error(_0x86e3('0x59'));if(_0x177604[_0x86e3('0x5a')]===_0x86e3('0x5b')){var _0x3eb2af=_0x594935[_0x86e3('0x35')]({'plain':!![]});var _0x54cf40=_0x86e3('0x36');return db['UserProfileSection'][_0x86e3('0x5c')]({'where':{'name':_0x54cf40,'userProfileId':_0x177604[_0x86e3('0x5d')]},'raw':!![]})[_0x86e3('0x1e')](function(_0x6d1cc3){if(_0x6d1cc3&&_0x6d1cc3[_0x86e3('0x5e')]===0x0){return db[_0x86e3('0x37')][_0x86e3('0x57')]({'name':_0x3eb2af[_0x86e3('0x39')],'resourceId':_0x3eb2af['id'],'type':_0x6d1cc3[_0x86e3('0x39')],'sectionId':_0x6d1cc3['id']},{})[_0x86e3('0x1e')](function(){return _0x594935;});}else{return _0x594935;}})[_0x86e3('0x53')](function(_0x2598ca){logger[_0x86e3('0x26')](_0x86e3('0x5f'),_0x2598ca);throw _0x2598ca;});}return _0x594935;})[_0x86e3('0x1e')](respondWithResult(_0x362c34,0xc9))[_0x86e3('0x53')](handleError(_0x362c34,null));};exports[_0x86e3('0x34')]=function(_0x5688fa,_0x4e179d){if(_0x5688fa[_0x86e3('0x58')]['id']){delete _0x5688fa[_0x86e3('0x58')]['id'];}return db['WhatsappAccount'][_0x86e3('0x5c')]({'where':{'id':_0x5688fa[_0x86e3('0x60')]['id']},'include':[{'model':db['Pause'],'as':_0x86e3('0x3c')}]})['then'](handleEntityNotFound(_0x4e179d,null))['then'](saveUpdates(_0x5688fa[_0x86e3('0x58')],null))[_0x86e3('0x1e')](respondWithResult(_0x4e179d,null))['catch'](handleError(_0x4e179d,null));};exports['destroy']=function(_0xed78f5,_0x7b187b){return db[_0x86e3('0x3e')][_0x86e3('0x5c')]({'where':{'id':_0xed78f5['params']['id']}})['then'](handleEntityNotFound(_0x7b187b,null))[_0x86e3('0x1e')](removeEntity(_0x7b187b,null))[_0x86e3('0x53')](handleError(_0x7b187b,null));};exports[_0x86e3('0x61')]=function(_0x4ee0c1,_0x181c36){return db['WhatsappAccount'][_0x86e3('0x61')]()[_0x86e3('0x1e')](respondWithResult(_0x181c36,null))[_0x86e3('0x53')](handleError(_0x181c36,null));};exports['addDisposition']=function(_0x468eb9,_0x4b78db,_0x110031){if(_0x468eb9[_0x86e3('0x58')]['id']){delete _0x468eb9['body']['id'];}return db[_0x86e3('0x3e')][_0x86e3('0x5c')]({'where':{'id':_0x468eb9['params']['id']}})[_0x86e3('0x1e')](handleEntityNotFound(_0x4b78db,null))[_0x86e3('0x1e')](function(_0x3e4ebe){if(_0x3e4ebe){_0x468eb9[_0x86e3('0x58')][_0x86e3('0x62')]=_0x3e4ebe['id'];return db[_0x86e3('0x63')][_0x86e3('0x57')](_0x468eb9[_0x86e3('0x58')]);}})['then'](respondWithResult(_0x4b78db,null))[_0x86e3('0x53')](handleError(_0x4b78db,null));};exports[_0x86e3('0x64')]=function(_0x51ace6,_0x2eb244,_0xf7324f){var _0x516935={'raw':![],'where':{}};var _0x1a6c1e={};var _0x58cae={'count':0x0,'rows':[]};return db[_0x86e3('0x3e')][_0x86e3('0x65')]({'where':{'id':_0x51ace6[_0x86e3('0x60')]['id']}})[_0x86e3('0x1e')](handleEntityNotFound(_0x2eb244,null))[_0x86e3('0x1e')](function(_0x1831e5){if(_0x1831e5){_0x1a6c1e['model']=_[_0x86e3('0x43')](db[_0x86e3('0x63')][_0x86e3('0x55')]);_0x1a6c1e[_0x86e3('0x42')]=_[_0x86e3('0x43')](_0x51ace6['query']);_0x1a6c1e[_0x86e3('0x44')]=_[_0x86e3('0x45')](_0x1a6c1e[_0x86e3('0x41')],_0x1a6c1e[_0x86e3('0x42')]);_0x516935[_0x86e3('0x47')]=_['intersection'](_0x1a6c1e[_0x86e3('0x41')],qs[_0x86e3('0x46')](_0x51ace6['query'][_0x86e3('0x46')]));_0x516935['attributes']=_0x516935['attributes'][_0x86e3('0x48')]?_0x516935[_0x86e3('0x47')]:_0x1a6c1e[_0x86e3('0x41')];if(!_0x51ace6[_0x86e3('0x42')][_0x86e3('0x49')]('nolimit')){_0x516935['limit']=qs[_0x86e3('0x2f')](_0x51ace6[_0x86e3('0x42')]['limit']);_0x516935['offset']=qs[_0x86e3('0x2c')](_0x51ace6[_0x86e3('0x42')][_0x86e3('0x2c')]);}_0x516935[_0x86e3('0x4b')]=qs[_0x86e3('0x4c')](_0x51ace6[_0x86e3('0x42')][_0x86e3('0x4c')]);_0x516935['where']=qs['filters'](_[_0x86e3('0x4e')](_0x51ace6['query'],_0x1a6c1e['filters']));_0x516935[_0x86e3('0x4d')]['WhatsappAccountId']=_0x1831e5['id'];if(_0x51ace6['query'][_0x86e3('0x66')]){_0x516935[_0x86e3('0x4d')]=_[_0x86e3('0x4f')](_0x516935[_0x86e3('0x4d')],{'$or':_[_0x86e3('0x3d')](_0x516935['attributes'],function(_0x191ef2){var _0x26b321={};_0x26b321[_0x191ef2]={'$like':'%'+_0x51ace6[_0x86e3('0x42')][_0x86e3('0x66')]+'%'};return _0x26b321;})});}_0x516935=_[_0x86e3('0x4f')]({},_0x516935,_0x51ace6[_0x86e3('0x51')]);return db[_0x86e3('0x63')][_0x86e3('0x2e')]({'where':_0x516935[_0x86e3('0x4d')]})['then'](function(_0x489ff4){_0x58cae['count']=_0x489ff4;if(_0x51ace6[_0x86e3('0x42')][_0x86e3('0x56')]){_0x516935['include']=[{'all':!![]}];}return db[_0x86e3('0x63')]['findAll'](_0x516935);})[_0x86e3('0x1e')](function(_0x3e4d70){_0x58cae['rows']=_0x3e4d70;return _0x58cae;});}})[_0x86e3('0x1e')](respondWithFilteredResult(_0x2eb244,_0x516935))['catch'](handleError(_0x2eb244,null));};exports[_0x86e3('0x67')]=function(_0xb27c8,_0x24f4c5,_0x215c45){return db[_0x86e3('0x3e')][_0x86e3('0x5c')]({'where':{'id':_0xb27c8[_0x86e3('0x60')]['id']}})[_0x86e3('0x1e')](handleEntityNotFound(_0x24f4c5,null))[_0x86e3('0x1e')](function(_0x498eab){if(_0x498eab){return _0x498eab[_0x86e3('0x67')](_0xb27c8[_0x86e3('0x42')][_0x86e3('0x68')]);}})['then'](respondWithStatusCode(_0x24f4c5,null))['catch'](handleError(_0x24f4c5,null));};exports[_0x86e3('0x69')]=function(_0x57d47c,_0x29f099,_0x11037d){if(_0x57d47c[_0x86e3('0x58')]['id']){delete _0x57d47c[_0x86e3('0x58')]['id'];}return db[_0x86e3('0x3e')]['find']({'where':{'id':_0x57d47c[_0x86e3('0x60')]['id']}})[_0x86e3('0x1e')](handleEntityNotFound(_0x29f099,null))[_0x86e3('0x1e')](function(_0x10dcee){if(_0x10dcee){_0x57d47c[_0x86e3('0x58')]['WhatsappAccountId']=_0x10dcee['id'];return db[_0x86e3('0x6a')][_0x86e3('0x57')](_0x57d47c[_0x86e3('0x58')]);}})[_0x86e3('0x1e')](respondWithResult(_0x29f099,null))[_0x86e3('0x53')](handleError(_0x29f099,null));};exports[_0x86e3('0x6b')]=function(_0x4f06d1,_0x419ce8,_0x4cfe6e){var _0x10e586={'raw':![],'where':{}};var _0x1edcad={};var _0x38025a={'count':0x0,'rows':[]};return db[_0x86e3('0x3e')][_0x86e3('0x65')]({'where':{'id':_0x4f06d1['params']['id']}})[_0x86e3('0x1e')](handleEntityNotFound(_0x419ce8,null))[_0x86e3('0x1e')](function(_0x5cf686){if(_0x5cf686){_0x1edcad[_0x86e3('0x41')]=_[_0x86e3('0x43')](db[_0x86e3('0x6a')]['rawAttributes']);_0x1edcad[_0x86e3('0x42')]=_[_0x86e3('0x43')](_0x4f06d1[_0x86e3('0x42')]);_0x1edcad[_0x86e3('0x44')]=_[_0x86e3('0x45')](_0x1edcad[_0x86e3('0x41')],_0x1edcad[_0x86e3('0x42')]);_0x10e586[_0x86e3('0x47')]=_['intersection'](_0x1edcad[_0x86e3('0x41')],qs[_0x86e3('0x46')](_0x4f06d1[_0x86e3('0x42')][_0x86e3('0x46')]));_0x10e586[_0x86e3('0x47')]=_0x10e586['attributes'][_0x86e3('0x48')]?_0x10e586[_0x86e3('0x47')]:_0x1edcad[_0x86e3('0x41')];if(!_0x4f06d1['query'][_0x86e3('0x49')]('nolimit')){_0x10e586[_0x86e3('0x2f')]=qs[_0x86e3('0x2f')](_0x4f06d1['query'][_0x86e3('0x2f')]);_0x10e586[_0x86e3('0x2c')]=qs[_0x86e3('0x2c')](_0x4f06d1[_0x86e3('0x42')]['offset']);}_0x10e586['order']=qs[_0x86e3('0x4c')](_0x4f06d1['query']['sort']);_0x10e586[_0x86e3('0x4d')]=qs['filters'](_['pick'](_0x4f06d1[_0x86e3('0x42')],_0x1edcad[_0x86e3('0x44')]));_0x10e586[_0x86e3('0x4d')]['WhatsappAccountId']=_0x5cf686['id'];if(_0x4f06d1[_0x86e3('0x42')][_0x86e3('0x66')]){_0x10e586['where']=_[_0x86e3('0x4f')](_0x10e586[_0x86e3('0x4d')],{'$or':_['map'](_0x10e586['attributes'],function(_0x46dda9){var _0x54ed3f={};_0x54ed3f[_0x46dda9]={'$like':'%'+_0x4f06d1[_0x86e3('0x42')][_0x86e3('0x66')]+'%'};return _0x54ed3f;})});}_0x10e586=_['merge']({},_0x10e586,_0x4f06d1[_0x86e3('0x51')]);return db[_0x86e3('0x6a')][_0x86e3('0x2e')]({'where':_0x10e586[_0x86e3('0x4d')]})['then'](function(_0x5b91a6){_0x38025a[_0x86e3('0x2e')]=_0x5b91a6;if(_0x4f06d1[_0x86e3('0x42')]['includeAll']){_0x10e586[_0x86e3('0x52')]=[{'all':!![]}];}return db['CannedAnswer'][_0x86e3('0x6c')](_0x10e586);})[_0x86e3('0x1e')](function(_0x368f1f){_0x38025a['rows']=_0x368f1f;return _0x38025a;});}})[_0x86e3('0x1e')](respondWithFilteredResult(_0x419ce8,_0x10e586))['catch'](handleError(_0x419ce8,null));};exports['removeAnswers']=function(_0x362b6f,_0x15093b,_0x3f92e1){return db[_0x86e3('0x3e')][_0x86e3('0x5c')]({'where':{'id':_0x362b6f[_0x86e3('0x60')]['id']}})[_0x86e3('0x1e')](handleEntityNotFound(_0x15093b,null))[_0x86e3('0x1e')](function(_0x4137db){if(_0x4137db){return _0x4137db[_0x86e3('0x6d')](_0x362b6f[_0x86e3('0x42')]['ids']);}})['then'](respondWithStatusCode(_0x15093b,null))['catch'](handleError(_0x15093b,null));};exports[_0x86e3('0x6e')]=function(_0x3c8f84,_0x27973e,_0x20e857){return db[_0x86e3('0x3e')]['find']({'where':{'id':_0x3c8f84[_0x86e3('0x60')]['id']}})[_0x86e3('0x1e')](handleEntityNotFound(_0x27973e,null))[_0x86e3('0x1e')](function(_0x4f542f){if(_0x4f542f){return _0x4f542f[_0x86e3('0x6e')](_0x3c8f84[_0x86e3('0x58')][_0x86e3('0x68')],_[_0x86e3('0x6f')](_0x3c8f84['body'],[_0x86e3('0x68'),'id'])||{})[_0x86e3('0x70')](function(_0xee9440){for(var _0x2fe72b=0x0;_0x2fe72b<_0x3c8f84[_0x86e3('0x58')][_0x86e3('0x68')]['length'];_0x2fe72b+=0x1){socket[_0x86e3('0x71')](_0x86e3('0x72'),{'UserId':Number(_0x3c8f84[_0x86e3('0x58')]['ids'][_0x2fe72b]),'WhatsappAccountId':Number(_0x3c8f84[_0x86e3('0x60')]['id'])});}return _0xee9440;});}})[_0x86e3('0x1e')](respondWithResult(_0x27973e,null))[_0x86e3('0x53')](handleError(_0x27973e,null));};exports[_0x86e3('0x73')]=function(_0x1bc941,_0xc6aa3e,_0x3da25b){return db[_0x86e3('0x3e')]['find']({'where':{'id':_0x1bc941[_0x86e3('0x60')]['id']}})[_0x86e3('0x1e')](handleEntityNotFound(_0xc6aa3e,null))['then'](function(_0x24e752){if(_0x24e752){return _0x24e752[_0x86e3('0x73')](_0x1bc941[_0x86e3('0x42')][_0x86e3('0x68')])[_0x86e3('0x1e')](function(){if(_[_0x86e3('0x74')](_0x1bc941[_0x86e3('0x42')]['ids'])){for(var _0x47c7dd=0x0;_0x47c7dd<_0x1bc941[_0x86e3('0x42')][_0x86e3('0x68')][_0x86e3('0x48')];_0x47c7dd+=0x1){socket['emit'](_0x86e3('0x75'),{'UserId':Number(_0x1bc941['query'][_0x86e3('0x68')][_0x47c7dd]),'WhatsappAccountId':Number(_0x1bc941[_0x86e3('0x60')]['id'])});}}else{socket[_0x86e3('0x71')](_0x86e3('0x75'),{'UserId':Number(_0x1bc941[_0x86e3('0x42')][_0x86e3('0x68')]),'WhatsappAccountId':Number(_0x1bc941[_0x86e3('0x60')]['id'])});}});}})[_0x86e3('0x1e')](respondWithStatusCode(_0xc6aa3e,null))['catch'](handleError(_0xc6aa3e,null));};exports[_0x86e3('0x76')]=function(_0x30bd7d,_0x33730c,_0x4ef386){var _0x1d3c11={};var _0x4e27a3={};var _0x4a0978;var _0xe93d08;return db['WhatsappAccount'][_0x86e3('0x65')]({'where':{'id':_0x30bd7d[_0x86e3('0x60')]['id']}})[_0x86e3('0x1e')](handleEntityNotFound(_0x33730c,null))[_0x86e3('0x1e')](function(_0x1ee7c4){if(_0x1ee7c4){_0x4a0978=_0x1ee7c4;_0x4e27a3['model']=_['keys'](db[_0x86e3('0x77')][_0x86e3('0x55')]);_0x4e27a3[_0x86e3('0x42')]=_[_0x86e3('0x43')](_0x30bd7d[_0x86e3('0x42')]);_0x4e27a3['filters']=_[_0x86e3('0x45')](_0x4e27a3['model'],_0x4e27a3['query']);_0x1d3c11['attributes']=_[_0x86e3('0x45')](_0x4e27a3[_0x86e3('0x41')],qs['fields'](_0x30bd7d['query']['fields']));_0x1d3c11[_0x86e3('0x47')]=_0x1d3c11[_0x86e3('0x47')][_0x86e3('0x48')]?_0x1d3c11[_0x86e3('0x47')]:_0x4e27a3[_0x86e3('0x41')];_0x1d3c11[_0x86e3('0x4b')]=qs[_0x86e3('0x4c')](_0x30bd7d[_0x86e3('0x42')][_0x86e3('0x4c')]);_0x1d3c11[_0x86e3('0x4d')]=qs['filters'](_['pick'](_0x30bd7d[_0x86e3('0x42')],_0x4e27a3[_0x86e3('0x44')]));if(_0x30bd7d[_0x86e3('0x42')]['filter']){_0x1d3c11['where']=_['merge'](_0x1d3c11[_0x86e3('0x4d')],{'$or':_['map'](_0x1d3c11[_0x86e3('0x47')],function(_0x309a01){var _0x23cfd4={};_0x23cfd4[_0x309a01]={'$like':'%'+_0x30bd7d[_0x86e3('0x42')][_0x86e3('0x66')]+'%'};return _0x23cfd4;})});}_0x1d3c11=_[_0x86e3('0x4f')]({},_0x1d3c11,_0x30bd7d[_0x86e3('0x51')]);return _0x4a0978[_0x86e3('0x76')](_0x1d3c11);}})[_0x86e3('0x1e')](function(_0x3f1819){if(_0x3f1819){_0xe93d08=_0x3f1819['length'];if(!_0x30bd7d[_0x86e3('0x42')]['hasOwnProperty'](_0x86e3('0x4a'))){_0x1d3c11[_0x86e3('0x2f')]=qs[_0x86e3('0x2f')](_0x30bd7d[_0x86e3('0x42')][_0x86e3('0x2f')]);_0x1d3c11[_0x86e3('0x2c')]=qs[_0x86e3('0x2c')](_0x30bd7d[_0x86e3('0x42')][_0x86e3('0x2c')]);}return _0x4a0978['getAgents'](_0x1d3c11);}})[_0x86e3('0x1e')](function(_0xa056b5){if(_0xa056b5){return _0xa056b5?{'count':_0xe93d08,'rows':_0xa056b5}:null;}})[_0x86e3('0x1e')](respondWithResult(_0x33730c,null))[_0x86e3('0x53')](handleError(_0x33730c,null));};exports[_0x86e3('0x78')]=function(_0x34bfa3,_0x14225b){var _0x423683=_0x34bfa3[_0x86e3('0x60')]['id'];var _0x59d90d=_0x34bfa3[_0x86e3('0x58')];var _0xcddae5=0xc8;var _0x596a7b=null;return db[_0x86e3('0x79')][_0x86e3('0x7a')]({'isolationLevel':db['sequelize'][_0x86e3('0x7b')][_0x86e3('0x7c')][_0x86e3('0x7d')]},function(_0x280ba9){return db[_0x86e3('0x3e')][_0x86e3('0x65')]({'where':{'id':_0x423683},'transaction':_0x280ba9})[_0x86e3('0x1e')](function(_0x54418c){if(_0x54418c){return db[_0x86e3('0x7e')][_0x86e3('0x7f')]({'where':{'WhatsappAccountId':_0x423683},'transaction':_0x280ba9})['then'](function(){var _0x8adb9c=_[_0x86e3('0x3d')](_0x59d90d,function(_0xd6c64f){_0xd6c64f['WhatsappAccountId']=_0x423683;return _0xd6c64f;});return db[_0x86e3('0x7e')][_0x86e3('0x80')](_0x8adb9c,{'transaction':_0x280ba9});});}else{_0xcddae5=0x194;_0x596a7b=[];}});})[_0x86e3('0x1e')](function(){if(_0xcddae5!==0x194){return db[_0x86e3('0x7e')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x423683},'order':_0x86e3('0x81')})[_0x86e3('0x1e')](function(_0x45fa7a){_0x596a7b=_0x45fa7a;});}})['catch'](function(_0x356d16){_0xcddae5=0x1f4;logger[_0x86e3('0x26')](_0x356d16[_0x86e3('0x38')]);if(_0x356d16[_0x86e3('0x39')]){delete _0x356d16[_0x86e3('0x39')];}_0x596a7b=_0x356d16;})[_0x86e3('0x82')](function(){if(_0x596a7b===null){_0x14225b['sendStatus'](_0xcddae5);}else{if(_0xcddae5===0x1f4){_0x14225b[_0x86e3('0x2a')](_0xcddae5)['send'](_0x596a7b);}else{_0x14225b[_0x86e3('0x2a')](_0xcddae5)[_0x86e3('0x83')](_0x596a7b);}}});};exports[_0x86e3('0x84')]=function(_0x3ffe50,_0x6a4811,_0x3eda0b){var _0x2ba05d={};var _0x384997={};var _0x4720a5;var _0x3af69e;return db[_0x86e3('0x3e')][_0x86e3('0x65')]({'where':{'id':_0x3ffe50[_0x86e3('0x60')]['id']}})['then'](handleEntityNotFound(_0x6a4811,null))[_0x86e3('0x1e')](function(_0x30636a){if(_0x30636a){_0x4720a5=_0x30636a;_0x384997['model']=_[_0x86e3('0x43')](db['WhatsappApplication'][_0x86e3('0x55')]);_0x384997[_0x86e3('0x42')]=_['keys'](_0x3ffe50[_0x86e3('0x42')]);_0x384997[_0x86e3('0x44')]=_[_0x86e3('0x45')](_0x384997[_0x86e3('0x41')],_0x384997[_0x86e3('0x42')]);_0x2ba05d['attributes']=_['intersection'](_0x384997[_0x86e3('0x41')],qs[_0x86e3('0x46')](_0x3ffe50[_0x86e3('0x42')][_0x86e3('0x46')]));_0x2ba05d['attributes']=_0x2ba05d[_0x86e3('0x47')][_0x86e3('0x48')]?_0x2ba05d[_0x86e3('0x47')]:_0x384997[_0x86e3('0x41')];_0x2ba05d[_0x86e3('0x4b')]=qs[_0x86e3('0x4c')](_0x3ffe50[_0x86e3('0x42')][_0x86e3('0x4c')]);_0x2ba05d[_0x86e3('0x4d')]=qs[_0x86e3('0x44')](_[_0x86e3('0x4e')](_0x3ffe50[_0x86e3('0x42')],_0x384997[_0x86e3('0x44')]));if(_0x3ffe50[_0x86e3('0x42')][_0x86e3('0x66')]){_0x2ba05d[_0x86e3('0x4d')]=_[_0x86e3('0x4f')](_0x2ba05d[_0x86e3('0x4d')],{'$or':_['map'](_0x2ba05d[_0x86e3('0x47')],function(_0x5c0397){var _0x31c252={};_0x31c252[_0x5c0397]={'$like':'%'+_0x3ffe50[_0x86e3('0x42')][_0x86e3('0x66')]+'%'};return _0x31c252;})});}_0x2ba05d=_[_0x86e3('0x4f')]({},_0x2ba05d,_0x3ffe50['options']);return _0x4720a5[_0x86e3('0x84')](_0x2ba05d);}})[_0x86e3('0x1e')](function(_0x20d288){if(_0x20d288){_0x3af69e=_0x20d288[_0x86e3('0x48')];if(!_0x3ffe50[_0x86e3('0x42')][_0x86e3('0x49')](_0x86e3('0x4a'))){_0x2ba05d[_0x86e3('0x2f')]=qs['limit'](_0x3ffe50['query']['limit']);_0x2ba05d['offset']=qs['offset'](_0x3ffe50[_0x86e3('0x42')][_0x86e3('0x2c')]);}return _0x4720a5[_0x86e3('0x84')](_0x2ba05d);}})[_0x86e3('0x1e')](function(_0xc09052){if(_0xc09052){return _0xc09052?{'count':_0x3af69e,'rows':_0xc09052}:null;}})['then'](respondWithResult(_0x6a4811,null))[_0x86e3('0x53')](handleError(_0x6a4811,null));};exports[_0x86e3('0x85')]=function(_0x7c722,_0x389aa5,_0x85de83){var _0x1ed0a4={'channel':_0x86e3('0x86')};var _0xa7c025=[];var _0x48c729=[];var _0x5496bd={};return db[_0x86e3('0x3e')][_0x86e3('0x5c')]({'where':{'id':_0x7c722[_0x86e3('0x60')]['id']},'include':[{'model':db[_0x86e3('0x7e')],'as':_0x86e3('0x87')}]})[_0x86e3('0x1e')](handleEntityNotFound(_0x389aa5,null))[_0x86e3('0x1e')](function(_0x55ad08){_0x1ed0a4['account']=_0x55ad08;if(_0x1ed0a4[_0x86e3('0x88')]&&_0x1ed0a4[_0x86e3('0x88')][_0x86e3('0x3f')]===_0x86e3('0x89')&&_0x7c722[_0x86e3('0x58')][_0x86e3('0x8a')]){if(_0x7c722['body'][_0x86e3('0x8a')][_0x86e3('0x48')]===0x0)return;if(_0x7c722[_0x86e3('0x58')][_0x86e3('0x8a')][0x0]['state']!==_0x86e3('0x8b'))return;return db[_0x86e3('0x8c')][_0x86e3('0x34')]({'read':!![],'readAt':_0x7c722['body'][_0x86e3('0x8a')][0x0]['timestamp']},{'where':{'messageId':_0x7c722['body']['statuses'][0x0][_0x86e3('0x8d')]},'individualHooks':!![]})[_0x86e3('0x1e')](function(_0x45dc34){return _0x389aa5[_0x86e3('0x2a')](0xc8)[_0x86e3('0x83')](_0x45dc34);});}_0x1ed0a4['applications']=_[_0x86e3('0x8e')](_0x55ad08[_0x86e3('0x87')],[_0x86e3('0x81')],[_0x86e3('0x8f')]);if(_0x1ed0a4[_0x86e3('0x88')]['Applications']){delete _0x1ed0a4[_0x86e3('0x88')][_0x86e3('0x87')];}return db[_0x86e3('0x90')]['describe']()[_0x86e3('0x1e')](function(_0xf1a38b){if(!_0xf1a38b){throw new db[(_0x86e3('0x91'))][(_0x86e3('0x92'))](_0x86e3('0x93'));}_0xa7c025=_['difference'](_[_0x86e3('0x43')](_0xf1a38b),['createdAt','updatedAt']);_0x48c729=_[_0x86e3('0x94')](_['keys'](_0xf1a38b),[_0x86e3('0x95'),'updatedAt',_0x86e3('0x96'),'ListId']);_0x1ed0a4['body']={'mapKey':'mobile'};if(_0x1ed0a4[_0x86e3('0x88')]&&_0x1ed0a4['account'][_0x86e3('0x3f')]===_0x86e3('0x97')){_0x1ed0a4['body'][_0x86e3('0x98')]=_0x7c722[_0x86e3('0x58')][_0x86e3('0x99')][_0x86e3('0x9a')](_0x86e3('0x9b'),'');_0x1ed0a4[_0x86e3('0x58')][_0x86e3('0x58')]=_0x7c722[_0x86e3('0x58')][_0x86e3('0x9c')];_0x1ed0a4['body']['messageId']=_0x7c722[_0x86e3('0x58')][_0x86e3('0x9d')];}if(_0x1ed0a4['account']&&_0x1ed0a4[_0x86e3('0x88')][_0x86e3('0x3f')]===_0x86e3('0x89')){_0x1ed0a4[_0x86e3('0x58')][_0x86e3('0x98')]=_0x7c722[_0x86e3('0x58')]['notifications'][0x0][_0x86e3('0x98')];_0x1ed0a4[_0x86e3('0x58')][_0x86e3('0x58')]=_0x7c722[_0x86e3('0x58')][_0x86e3('0x9e')][0x0][_0x86e3('0x27')][_0x86e3('0x58')];_0x1ed0a4[_0x86e3('0x58')][_0x86e3('0x9f')]=_0x7c722[_0x86e3('0x58')][_0x86e3('0x9e')][0x0][_0x86e3('0x8d')];}if(_0x1ed0a4[_0x86e3('0x58')]['id']){delete _0x1ed0a4[_0x86e3('0x58')]['id'];}if(_[_0x86e3('0xa0')](_0x1ed0a4[_0x86e3('0x58')][_0x86e3('0x98')])){throw new db[(_0x86e3('0x91'))][(_0x86e3('0x92'))](_0x86e3('0xa1'));}if(_[_0x86e3('0xa0')](_0x1ed0a4[_0x86e3('0x58')][_0x86e3('0x58')])||_0x1ed0a4['body'][_0x86e3('0x58')]===''){throw new db['Sequelize'][(_0x86e3('0x92'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x86e3('0xa0')](_0x1ed0a4[_0x86e3('0x58')][_0x86e3('0xa2')])){throw new db[(_0x86e3('0x91'))]['ValidationError'](_0x86e3('0xa3')+_0x48c729);}if(!_['includes'](_0x48c729,_0x1ed0a4[_0x86e3('0x58')][_0x86e3('0xa2')])){throw new db[(_0x86e3('0x91'))][(_0x86e3('0x92'))](_0x86e3('0xa4')+_0x48c729);}_0x5496bd[_0x1ed0a4[_0x86e3('0x58')][_0x86e3('0xa2')]]=_0x1ed0a4[_0x86e3('0x58')]['from'];return db[_0x86e3('0xa5')]['find']({'where':{'id':_0x1ed0a4[_0x86e3('0x88')][_0x86e3('0xa6')]},'include':[{'model':db[_0x86e3('0x90')],'as':_0x86e3('0xa7'),'where':_0x5496bd,'limit':0x1,'order':[[_0x86e3('0xa8'),_0x86e3('0xa9')]]}]});})[_0x86e3('0x1e')](handleEntityNotFound(_0x389aa5,null))[_0x86e3('0x1e')](function(_0x107abc){if(_0x107abc){_0x1ed0a4[_0x86e3('0xaa')]=_['omit'](_0x107abc,[_0x86e3('0xa7')]);if(_0x107abc[_0x86e3('0xa7')][_0x86e3('0x48')]){return _0x107abc[_0x86e3('0xa7')][0x0];}var _0x22427c=_[_0x86e3('0x17')](_0x1ed0a4[_0x86e3('0x58')],{'firstName':_0x1ed0a4[_0x86e3('0x58')][_0x86e3('0x98')],'ListId':_0x107abc['id']});_0x22427c[_0x1ed0a4['body'][_0x86e3('0xa2')]]=_0x1ed0a4[_0x86e3('0x58')][_0x86e3('0x98')];return db[_0x86e3('0x90')]['create'](_0x22427c,{'fields':_0xa7c025,'raw':!![]});}})[_0x86e3('0x1e')](handleEntityNotFound(_0x389aa5,null))[_0x86e3('0x1e')](function(_0x11fe48){if(_0x11fe48){_0x1ed0a4['contact']=_0x11fe48;var _0x18470c={'ContactId':_0x11fe48['id'],'phone':_0x1ed0a4[_0x86e3('0x58')]['from'],'WhatsappAccountId':_0x7c722[_0x86e3('0x60')]['id']};var _0x6c78ac={'ContactId':_0x11fe48['id'],'WhatsappAccountId':_0x7c722[_0x86e3('0x60')]['id'],'closed':![]};return db['WhatsappInteraction'][_0x86e3('0x5c')]({'where':_0x6c78ac})[_0x86e3('0x1e')](function(_0x1210ed){if(_0x1210ed){return[_0x1210ed,![]];}return db[_0x86e3('0xab')]['create'](_0x18470c)[_0x86e3('0x1e')](function(_0x4e1ae3){return[_0x4e1ae3,!![]];});});}})[_0x86e3('0x70')](function(_0x2344c9,_0x104d2d){_0x1ed0a4[_0x86e3('0xac')]=_0x2344c9[_0x86e3('0x35')]({'plain':!![]});_0x1ed0a4[_0x86e3('0xac')]['created']=![];if(_0x104d2d){if(_0x1ed0a4[_0x86e3('0x88')][_0x86e3('0xad')]){_0x1ed0a4[_0x86e3('0xae')][_0x86e3('0xaf')]({'id':0x0,'priority':_0x1ed0a4['applications'][_0x86e3('0x48')]+0x1,'app':_0x86e3('0xb0'),'appdata':_0x86e3('0xb1'),'interval':'*,*,*,*'});}_0x1ed0a4[_0x86e3('0xac')]['created']=!![];}return db['WhatsappMessage'][_0x86e3('0x57')]({'phone':_0x1ed0a4[_0x86e3('0x58')][_0x86e3('0x98')],'messageId':_0x1ed0a4[_0x86e3('0x58')][_0x86e3('0x9f')],'body':_0x1ed0a4[_0x86e3('0x58')]['body'],'WhatsappAccountId':_0x7c722[_0x86e3('0x60')]['id'],'WhatsappInteractionId':_0x2344c9['id'],'direction':'in','ContactId':_0x2344c9[_0x86e3('0xb2')],'AttachmentId':_0x1ed0a4[_0x86e3('0x58')]['AttachmentId']});})[_0x86e3('0x1e')](function(_0x28a33a){_0x1ed0a4[_0x86e3('0x27')]=_0x28a33a;if(_0x1ed0a4[_0x86e3('0xac')][_0x86e3('0xb3')]){return db[_0x86e3('0x77')][_0x86e3('0x5c')]({'attributes':['id','name'],'where':{'id':_0x1ed0a4[_0x86e3('0xac')][_0x86e3('0xb3')]}})[_0x86e3('0x1e')](function(_0x5c6ead){if(_0x5c6ead){_0x1ed0a4['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x86e3('0xb4'),'appdata':_0x5c6ead[_0x86e3('0x39')]+','+(_0x1ed0a4[_0x86e3('0x88')][_0x86e3('0xb5')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x86e3('0xb6'),_0x86e3('0xb7'),_0x1ed0a4);});}return respondWithRpcPromise(_0x86e3('0xb6'),_0x86e3('0xb7'),_0x1ed0a4);})[_0x86e3('0x1e')](function(_0x36d47d){if(_0x36d47d){var _0x2a5c83=0xc8;var _0x3ad6f1=_0x86e3('0xb8');logger[_0x86e3('0x1f')](_0x86e3('0x22'),_0x3ad6f1,_0x2a5c83,'entity\x20found');logger[_0x86e3('0x21')](_0x86e3('0xb9'),_0x3ad6f1,_0x2a5c83,_0x86e3('0xba'),JSON['stringify'](_0x36d47d));if(_0x1ed0a4[_0x86e3('0x88')]['type']===_0x86e3('0x97')){return _0x389aa5[_0x86e3('0x2a')](_0x2a5c83)[_0x86e3('0x30')](_0x86e3('0xbb'),_0x86e3('0xbc'))[_0x86e3('0xbd')](_0x86e3('0xbe'));}else{return _0x389aa5[_0x86e3('0x2a')](_0x2a5c83)[_0x86e3('0x83')](_0x36d47d);}}});})['catch'](handleError(_0x389aa5,null));};exports[_0x86e3('0xbd')]=function(_0x46e1dc,_0x6b9892,_0x380e2b){var _0x55c416,_0x553f48,_0x2c683f;if(_[_0x86e3('0xa0')](_0x46e1dc[_0x86e3('0x58')][_0x86e3('0x58')])||_0x46e1dc[_0x86e3('0x58')][_0x86e3('0x58')]===''){throw new db[(_0x86e3('0x91'))][(_0x86e3('0x92'))](_0x86e3('0xbf'));}if(_[_0x86e3('0xa0')](_0x46e1dc['body']['to'])){throw new db[(_0x86e3('0x91'))][(_0x86e3('0x92'))]('to\x20is\x20mandatory');}_0x55c416=_0x46e1dc['body']['to'];return db[_0x86e3('0x3e')]['find']({'where':{'id':_0x46e1dc['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x86e3('0x90')],'as':'Contacts','where':{'mobile':_0x55c416},'limit':0x1,'order':[[_0x86e3('0xa8'),_0x86e3('0xa9')]]}]}]})[_0x86e3('0x1e')](handleEntityNotFound(_0x6b9892,null))[_0x86e3('0x1e')](function(_0x53d505){if(_0x53d505&&_0x53d505[_0x86e3('0xc0')]){_0x553f48=_0x53d505[_0x86e3('0x35')]({'plain':!![]});if(_0x553f48[_0x86e3('0xc0')]&&_0x553f48[_0x86e3('0xc0')]['Contacts'][_0x86e3('0x48')]){return _0x553f48[_0x86e3('0xc0')][_0x86e3('0xa7')][0x0];}return db[_0x86e3('0x90')][_0x86e3('0x57')](_['defaults'](_0x46e1dc['body'],{'firstName':_0x55c416,'mobile':_0x55c416,'phone':_0x55c416,'ListId':_0x553f48[_0x86e3('0xa6')]}));}})[_0x86e3('0x1e')](handleEntityNotFound(_0x6b9892,null))[_0x86e3('0x1e')](function(_0x228289){if(_0x228289){_0x2c683f=_0x228289;return db[_0x86e3('0xab')]['find']({'where':{'ContactId':_0x2c683f['id'],'closed':![],'WhatsappAccountId':_0x553f48['id']}})['then'](function(_0x197daf){if(_0x197daf){return[_0x197daf,![]];}return db[_0x86e3('0xab')][_0x86e3('0x57')]({'UserId':_0x46e1dc[_0x86e3('0x5b')]['id'],'ContactId':_0x2c683f['id'],'WhatsappAccountId':_0x553f48['id'],'phone':_0x55c416,'firstMsgDirection':'out','Messages':[_['merge'](_0x46e1dc['body'],{'read':![],'body':_0x46e1dc[_0x86e3('0x58')][_0x86e3('0x58')],'phone':_0x55c416,'WhatsappAccountId':_0x553f48['id'],'UserId':_0x46e1dc['user']['id'],'ContactId':_0x2c683f['id']})]},{'include':[{'model':db[_0x86e3('0x8c')],'as':'Messages'}]})[_0x86e3('0x1e')](function(_0x18eae9){return[_0x18eae9,!![]];});});}})[_0x86e3('0x70')](function(_0x3b17dc,_0x472280){if(_0x472280){return _0x3b17dc;}return db[_0x86e3('0x8c')][_0x86e3('0x57')](_[_0x86e3('0x4f')](_0x46e1dc['body'],{'read':![],'body':_0x46e1dc[_0x86e3('0x58')][_0x86e3('0x58')],'phone':_0x55c416,'WhatsappAccountId':_0x553f48['id'],'WhatsappInteractionId':_0x3b17dc['id'],'UserId':_0x46e1dc['user']['id'],'ContactId':_0x2c683f['id']}))[_0x86e3('0x1e')](function(_0x340c46){_0x3b17dc[_0x86e3('0xc1')][_0x86e3('0xc2')]=[];_0x3b17dc['dataValues'][_0x86e3('0xc2')][_0x86e3('0xaf')](_0x340c46[_0x86e3('0xc1')]);return _0x3b17dc;});})['then'](respondWithResult(_0x6b9892,null))[_0x86e3('0x53')](handleError(_0x6b9892,null));}; \ No newline at end of file +var _0xd0fb=['get','WhatsappAccounts','name','index','Pause','map','WhatsappAccount','rawAttributes','type','query','keys','intersection','model','attributes','fields','length','order','sort','where','pick','filters','filter','merge','options','include','findAll','rows','catch','show','params','mandatoryDispositionPause','includeAll','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','update','find','describe','addDisposition','Disposition','getDispositions','findOne','hasOwnProperty','nolimit','WhatsappAccountId','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','finally','send','json','getApplications','notify','whatsapp','Applications','account','statuses','WhatsappMessage','message_id','applications','orderBy','priority','Sequelize','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','mobile','twilio','from','replace','Body','messageId','notifications','isNil','from\x20is\x20mandatory','ValidationError','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','ListId','CmContact','Contacts','list','contact','WhatsappInteraction','interaction','created','push','close','unmanaged','ContactId','AttachmentId','UserId','unshift','agent','startRouting','Start','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','text/xml','\x0a','DESC','List','defaults','out','Messages','dataValues','eml-format','zip-dir','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','register','jayson/promise','http','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','offset','limit','count','set','apply','reject','save','destroy'];(function(_0x546a54,_0x45462e){var _0x3e71f3=function(_0x5517e6){while(--_0x5517e6){_0x546a54['push'](_0x546a54['shift']());}};_0x3e71f3(++_0x45462e);}(_0xd0fb,0x8a));var _0xbd0f=function(_0x618b7,_0x3c05b2){_0x618b7=_0x618b7-0x0;var _0x2992e8=_0xd0fb[_0x618b7];return _0x2992e8;};'use strict';var emlformat=require(_0xbd0f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbd0f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbd0f('0x2'));var BPromise=require(_0xbd0f('0x3'));var Mustache=require(_0xbd0f('0x4'));var util=require('util');var path=require('path');var sox=require(_0xbd0f('0x5'));var csv=require('to-csv');var ejs=require(_0xbd0f('0x6'));var fs=require('fs');var fs_extra=require(_0xbd0f('0x7'));var _=require(_0xbd0f('0x8'));var squel=require(_0xbd0f('0x9'));var crypto=require(_0xbd0f('0xa'));var jsforce=require(_0xbd0f('0xb'));var deskjs=require(_0xbd0f('0xc'));var toCsv=require(_0xbd0f('0xd'));var querystring=require('querystring');var Papa=require(_0xbd0f('0xe'));var Redis=require(_0xbd0f('0xf'));var authService=require(_0xbd0f('0x10'));var qs=require(_0xbd0f('0x11'));var as=require(_0xbd0f('0x12'));var hardwareService=require(_0xbd0f('0x13'));var logger=require(_0xbd0f('0x14'))('api');var utils=require(_0xbd0f('0x15'));var config=require(_0xbd0f('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbd0f('0x17'))['db'];config[_0xbd0f('0x18')]=_['defaults'](config['redis'],{'host':_0xbd0f('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappAccount.socket')[_0xbd0f('0x1a')](socket);var jayson=require(_0xbd0f('0x1b'));var client=jayson['client'][_0xbd0f('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x275ea3,_0x3e949b,_0x466c79,_0x34c8df){return new BPromise(function(_0x3e48ba,_0x2f1a8a){var _0x511541=_0x34c8df||client;return _0x511541['request'](_0x275ea3,_0x466c79)[_0xbd0f('0x1d')](function(_0x1374e2){logger[_0xbd0f('0x1e')](_0xbd0f('0x1f'),_0x3e949b,_0xbd0f('0x20'));logger[_0xbd0f('0x21')](_0xbd0f('0x22'),_0x3e949b,_0xbd0f('0x20'),JSON[_0xbd0f('0x23')](_0x1374e2));if(_0x1374e2[_0xbd0f('0x24')]){if(_0x1374e2['error'][_0xbd0f('0x25')]===0x1f4){logger[_0xbd0f('0x24')](_0xbd0f('0x1f'),_0x3e949b,_0x1374e2[_0xbd0f('0x24')][_0xbd0f('0x26')]);return _0x2f1a8a(_0x1374e2[_0xbd0f('0x24')][_0xbd0f('0x26')]);}logger[_0xbd0f('0x24')](_0xbd0f('0x1f'),_0x3e949b,_0x1374e2['error'][_0xbd0f('0x26')]);return _0x3e48ba(_0x1374e2[_0xbd0f('0x24')][_0xbd0f('0x26')]);}else{logger[_0xbd0f('0x1e')](_0xbd0f('0x1f'),_0x3e949b,_0xbd0f('0x20'));_0x3e48ba(_0x1374e2[_0xbd0f('0x27')][_0xbd0f('0x26')]);}})['catch'](function(_0x10c9fb){logger[_0xbd0f('0x24')](_0xbd0f('0x1f'),_0x3e949b,_0x10c9fb);_0x2f1a8a(_0x10c9fb);});});}function respondWithStatusCode(_0x2975da,_0x120f8c){_0x120f8c=_0x120f8c||0xcc;return function(_0x46051d){if(_0x46051d){return _0x2975da[_0xbd0f('0x28')](_0x120f8c);}return _0x2975da[_0xbd0f('0x29')](_0x120f8c)[_0xbd0f('0x2a')]();};}function respondWithResult(_0x1cc0a2,_0xa6a1fe){_0xa6a1fe=_0xa6a1fe||0xc8;return function(_0x17dacb){if(_0x17dacb){return _0x1cc0a2[_0xbd0f('0x29')](_0xa6a1fe)['json'](_0x17dacb);}};}function respondWithFilteredResult(_0x41eaaf,_0x5bd41f){return function(_0x123fd2){if(_0x123fd2){var _0x434311=typeof _0x5bd41f[_0xbd0f('0x2b')]==='undefined'&&typeof _0x5bd41f[_0xbd0f('0x2c')]==='undefined';var _0x11f439=_0x123fd2[_0xbd0f('0x2d')];var _0x44276e=_0x434311?0x0:_0x5bd41f['offset'];var _0x3cb2d5=_0x434311?_0x123fd2['count']:_0x5bd41f[_0xbd0f('0x2b')]+_0x5bd41f[_0xbd0f('0x2c')];var _0xde58e5;if(_0x3cb2d5>=_0x11f439){_0x3cb2d5=_0x11f439;_0xde58e5=0xc8;}else{_0xde58e5=0xce;}_0x41eaaf[_0xbd0f('0x29')](_0xde58e5);return _0x41eaaf[_0xbd0f('0x2e')]('Content-Range',_0x44276e+'-'+_0x3cb2d5+'/'+_0x11f439)['json'](_0x123fd2);}return null;};}function patchUpdates(_0x462169){return function(_0x56aa4d){try{jsonpatch[_0xbd0f('0x2f')](_0x56aa4d,_0x462169,!![]);}catch(_0x1efe8d){return BPromise[_0xbd0f('0x30')](_0x1efe8d);}return _0x56aa4d[_0xbd0f('0x31')]();};}function saveUpdates(_0x131f35,_0x1870e7){return function(_0xeaa28e){if(_0xeaa28e){return _0xeaa28e['update'](_0x131f35)[_0xbd0f('0x1d')](function(_0x2f5856){return _0x2f5856;});}return null;};}function removeEntity(_0x5df05c,_0x450580){return function(_0x23ff8c){if(_0x23ff8c){return _0x23ff8c[_0xbd0f('0x32')]()[_0xbd0f('0x1d')](function(){var _0x71b177=_0x23ff8c[_0xbd0f('0x33')]({'plain':!![]});var _0x1d3de4=_0xbd0f('0x34');return db['UserProfileResource']['destroy']({'where':{'type':_0x1d3de4,'resourceId':_0x71b177['id']}})[_0xbd0f('0x1d')](function(){return _0x23ff8c;});})[_0xbd0f('0x1d')](function(){_0x5df05c[_0xbd0f('0x29')](0xcc)[_0xbd0f('0x2a')]();});}};}function handleEntityNotFound(_0x39f4b6,_0x336cde){return function(_0x2833b6){if(!_0x2833b6){_0x39f4b6['sendStatus'](0x194);}return _0x2833b6;};}function handleError(_0x409afe,_0x379ac9){_0x379ac9=_0x379ac9||0x1f4;return function(_0x37cc9c){logger[_0xbd0f('0x24')](_0x37cc9c['stack']);if(_0x37cc9c['name']){delete _0x37cc9c[_0xbd0f('0x35')];}_0x409afe[_0xbd0f('0x29')](_0x379ac9)['send'](_0x37cc9c);};}exports[_0xbd0f('0x36')]=function(_0x68cf3d,_0x48caae){var _0x208448={'include':[{'model':db[_0xbd0f('0x37')],'as':'mandatoryDispositionPause'}]},_0x4dbfd7={},_0x401846={'count':0x0,'rows':[]};var _0x3619f2=_[_0xbd0f('0x38')](db[_0xbd0f('0x39')][_0xbd0f('0x3a')],function(_0x12ea4c){return{'name':_0x12ea4c['fieldName'],'type':_0x12ea4c[_0xbd0f('0x3b')]['key']};});_0x4dbfd7['model']=_['map'](_0x3619f2,_0xbd0f('0x35'));_0x4dbfd7[_0xbd0f('0x3c')]=_[_0xbd0f('0x3d')](_0x68cf3d['query']);_0x4dbfd7['filters']=_[_0xbd0f('0x3e')](_0x4dbfd7[_0xbd0f('0x3f')],_0x4dbfd7[_0xbd0f('0x3c')]);_0x208448[_0xbd0f('0x40')]=_['intersection'](_0x4dbfd7[_0xbd0f('0x3f')],qs[_0xbd0f('0x41')](_0x68cf3d[_0xbd0f('0x3c')][_0xbd0f('0x41')]));_0x208448[_0xbd0f('0x40')]=_0x208448[_0xbd0f('0x40')][_0xbd0f('0x42')]?_0x208448[_0xbd0f('0x40')]:_0x4dbfd7[_0xbd0f('0x3f')];if(!_0x68cf3d[_0xbd0f('0x3c')]['hasOwnProperty']('nolimit')){_0x208448[_0xbd0f('0x2c')]=qs[_0xbd0f('0x2c')](_0x68cf3d[_0xbd0f('0x3c')][_0xbd0f('0x2c')]);_0x208448[_0xbd0f('0x2b')]=qs[_0xbd0f('0x2b')](_0x68cf3d[_0xbd0f('0x3c')][_0xbd0f('0x2b')]);}_0x208448[_0xbd0f('0x43')]=qs[_0xbd0f('0x44')](_0x68cf3d[_0xbd0f('0x3c')][_0xbd0f('0x44')]);_0x208448[_0xbd0f('0x45')]=qs['filters'](_[_0xbd0f('0x46')](_0x68cf3d[_0xbd0f('0x3c')],_0x4dbfd7[_0xbd0f('0x47')]),_0x3619f2);if(_0x68cf3d[_0xbd0f('0x3c')][_0xbd0f('0x48')]){_0x208448[_0xbd0f('0x45')]=_['merge'](_0x208448[_0xbd0f('0x45')],{'$or':_[_0xbd0f('0x38')](_0x3619f2,function(_0x110c06){if(_0x110c06[_0xbd0f('0x3b')]!=='VIRTUAL'){var _0xc7bb83={};_0xc7bb83[_0x110c06[_0xbd0f('0x35')]]={'$like':'%'+_0x68cf3d[_0xbd0f('0x3c')][_0xbd0f('0x48')]+'%'};return _0xc7bb83;}})});}_0x208448=_[_0xbd0f('0x49')]({},_0x208448,_0x68cf3d[_0xbd0f('0x4a')]);var _0x83e104={'where':_0x208448[_0xbd0f('0x45')]};return db[_0xbd0f('0x39')][_0xbd0f('0x2d')](_0x83e104)[_0xbd0f('0x1d')](function(_0x73d63b){_0x401846['count']=_0x73d63b;if(_0x68cf3d[_0xbd0f('0x3c')]['includeAll']){_0x208448[_0xbd0f('0x4b')]=[{'all':!![]}];}return db[_0xbd0f('0x39')][_0xbd0f('0x4c')](_0x208448);})['then'](function(_0x1f37e1){_0x401846[_0xbd0f('0x4d')]=_0x1f37e1;return _0x401846;})[_0xbd0f('0x1d')](respondWithFilteredResult(_0x48caae,_0x208448))[_0xbd0f('0x4e')](handleError(_0x48caae,null));};exports[_0xbd0f('0x4f')]=function(_0x3260d6,_0x18ae6e){var _0x470544={'raw':![],'where':{'id':_0x3260d6[_0xbd0f('0x50')]['id']},'include':[{'model':db['Pause'],'as':_0xbd0f('0x51')}]},_0x4c5cfb={};_0x4c5cfb[_0xbd0f('0x3f')]=_[_0xbd0f('0x3d')](db[_0xbd0f('0x39')][_0xbd0f('0x3a')]);_0x4c5cfb['query']=_[_0xbd0f('0x3d')](_0x3260d6[_0xbd0f('0x3c')]);_0x4c5cfb[_0xbd0f('0x47')]=_[_0xbd0f('0x3e')](_0x4c5cfb[_0xbd0f('0x3f')],_0x4c5cfb[_0xbd0f('0x3c')]);_0x470544[_0xbd0f('0x40')]=_[_0xbd0f('0x3e')](_0x4c5cfb['model'],qs['fields'](_0x3260d6[_0xbd0f('0x3c')][_0xbd0f('0x41')]));_0x470544[_0xbd0f('0x40')]=_0x470544[_0xbd0f('0x40')][_0xbd0f('0x42')]?_0x470544[_0xbd0f('0x40')]:_0x4c5cfb[_0xbd0f('0x3f')];if(_0x3260d6[_0xbd0f('0x3c')][_0xbd0f('0x52')]){_0x470544[_0xbd0f('0x4b')]=[{'all':!![]}];}_0x470544=_[_0xbd0f('0x49')]({},_0x470544,_0x3260d6[_0xbd0f('0x4a')]);return db['WhatsappAccount']['find'](_0x470544)[_0xbd0f('0x1d')](handleEntityNotFound(_0x18ae6e,null))[_0xbd0f('0x1d')](respondWithResult(_0x18ae6e,null))[_0xbd0f('0x4e')](handleError(_0x18ae6e,null));};exports['create']=function(_0x107089,_0x58b22b){return db['WhatsappAccount'][_0xbd0f('0x53')](_0x107089[_0xbd0f('0x54')],{})[_0xbd0f('0x1d')](function(_0x11d53e){var _0x3a9aee=_0x107089[_0xbd0f('0x55')][_0xbd0f('0x33')]({'plain':!![]});if(!_0x3a9aee)throw new Error(_0xbd0f('0x56'));if(_0x3a9aee[_0xbd0f('0x57')]===_0xbd0f('0x55')){var _0x2f0faa=_0x11d53e[_0xbd0f('0x33')]({'plain':!![]});var _0x244d07='WhatsappAccounts';return db[_0xbd0f('0x58')]['find']({'where':{'name':_0x244d07,'userProfileId':_0x3a9aee[_0xbd0f('0x59')]},'raw':!![]})[_0xbd0f('0x1d')](function(_0x1e2ac7){if(_0x1e2ac7&&_0x1e2ac7[_0xbd0f('0x5a')]===0x0){return db[_0xbd0f('0x5b')][_0xbd0f('0x53')]({'name':_0x2f0faa['name'],'resourceId':_0x2f0faa['id'],'type':_0x1e2ac7[_0xbd0f('0x35')],'sectionId':_0x1e2ac7['id']},{})[_0xbd0f('0x1d')](function(){return _0x11d53e;});}else{return _0x11d53e;}})['catch'](function(_0x5f3364){logger[_0xbd0f('0x24')](_0xbd0f('0x5c'),_0x5f3364);throw _0x5f3364;});}return _0x11d53e;})['then'](respondWithResult(_0x58b22b,0xc9))['catch'](handleError(_0x58b22b,null));};exports[_0xbd0f('0x5d')]=function(_0x526fc3,_0x4a94af){if(_0x526fc3[_0xbd0f('0x54')]['id']){delete _0x526fc3[_0xbd0f('0x54')]['id'];}return db[_0xbd0f('0x39')]['find']({'where':{'id':_0x526fc3[_0xbd0f('0x50')]['id']},'include':[{'model':db[_0xbd0f('0x37')],'as':_0xbd0f('0x51')}]})[_0xbd0f('0x1d')](handleEntityNotFound(_0x4a94af,null))[_0xbd0f('0x1d')](saveUpdates(_0x526fc3[_0xbd0f('0x54')],null))['then'](respondWithResult(_0x4a94af,null))[_0xbd0f('0x4e')](handleError(_0x4a94af,null));};exports['destroy']=function(_0x3a90d2,_0xd45fe5){return db[_0xbd0f('0x39')][_0xbd0f('0x5e')]({'where':{'id':_0x3a90d2[_0xbd0f('0x50')]['id']}})[_0xbd0f('0x1d')](handleEntityNotFound(_0xd45fe5,null))[_0xbd0f('0x1d')](removeEntity(_0xd45fe5,null))[_0xbd0f('0x4e')](handleError(_0xd45fe5,null));};exports['describe']=function(_0x2a0439,_0x20a0fd){return db[_0xbd0f('0x39')][_0xbd0f('0x5f')]()[_0xbd0f('0x1d')](respondWithResult(_0x20a0fd,null))[_0xbd0f('0x4e')](handleError(_0x20a0fd,null));};exports[_0xbd0f('0x60')]=function(_0x43cdfe,_0x3edc89,_0x492570){if(_0x43cdfe[_0xbd0f('0x54')]['id']){delete _0x43cdfe[_0xbd0f('0x54')]['id'];}return db[_0xbd0f('0x39')]['find']({'where':{'id':_0x43cdfe[_0xbd0f('0x50')]['id']}})[_0xbd0f('0x1d')](handleEntityNotFound(_0x3edc89,null))[_0xbd0f('0x1d')](function(_0x23924b){if(_0x23924b){_0x43cdfe[_0xbd0f('0x54')]['WhatsappAccountId']=_0x23924b['id'];return db[_0xbd0f('0x61')][_0xbd0f('0x53')](_0x43cdfe[_0xbd0f('0x54')]);}})['then'](respondWithResult(_0x3edc89,null))[_0xbd0f('0x4e')](handleError(_0x3edc89,null));};exports[_0xbd0f('0x62')]=function(_0x5a8ba5,_0x2a14bb,_0x32bc16){var _0x7bda0d={'raw':![],'where':{}};var _0x3d31c1={};var _0x4d3cdd={'count':0x0,'rows':[]};return db[_0xbd0f('0x39')][_0xbd0f('0x63')]({'where':{'id':_0x5a8ba5[_0xbd0f('0x50')]['id']}})[_0xbd0f('0x1d')](handleEntityNotFound(_0x2a14bb,null))[_0xbd0f('0x1d')](function(_0x4fac83){if(_0x4fac83){_0x3d31c1[_0xbd0f('0x3f')]=_[_0xbd0f('0x3d')](db[_0xbd0f('0x61')][_0xbd0f('0x3a')]);_0x3d31c1[_0xbd0f('0x3c')]=_[_0xbd0f('0x3d')](_0x5a8ba5[_0xbd0f('0x3c')]);_0x3d31c1[_0xbd0f('0x47')]=_[_0xbd0f('0x3e')](_0x3d31c1['model'],_0x3d31c1[_0xbd0f('0x3c')]);_0x7bda0d[_0xbd0f('0x40')]=_['intersection'](_0x3d31c1[_0xbd0f('0x3f')],qs['fields'](_0x5a8ba5[_0xbd0f('0x3c')][_0xbd0f('0x41')]));_0x7bda0d['attributes']=_0x7bda0d[_0xbd0f('0x40')][_0xbd0f('0x42')]?_0x7bda0d[_0xbd0f('0x40')]:_0x3d31c1[_0xbd0f('0x3f')];if(!_0x5a8ba5['query'][_0xbd0f('0x64')](_0xbd0f('0x65'))){_0x7bda0d[_0xbd0f('0x2c')]=qs[_0xbd0f('0x2c')](_0x5a8ba5['query']['limit']);_0x7bda0d[_0xbd0f('0x2b')]=qs[_0xbd0f('0x2b')](_0x5a8ba5[_0xbd0f('0x3c')]['offset']);}_0x7bda0d[_0xbd0f('0x43')]=qs['sort'](_0x5a8ba5[_0xbd0f('0x3c')][_0xbd0f('0x44')]);_0x7bda0d[_0xbd0f('0x45')]=qs[_0xbd0f('0x47')](_['pick'](_0x5a8ba5[_0xbd0f('0x3c')],_0x3d31c1[_0xbd0f('0x47')]));_0x7bda0d[_0xbd0f('0x45')][_0xbd0f('0x66')]=_0x4fac83['id'];if(_0x5a8ba5['query'][_0xbd0f('0x48')]){_0x7bda0d[_0xbd0f('0x45')]=_[_0xbd0f('0x49')](_0x7bda0d['where'],{'$or':_[_0xbd0f('0x38')](_0x7bda0d['attributes'],function(_0x250105){var _0x367176={};_0x367176[_0x250105]={'$like':'%'+_0x5a8ba5['query'][_0xbd0f('0x48')]+'%'};return _0x367176;})});}_0x7bda0d=_['merge']({},_0x7bda0d,_0x5a8ba5['options']);return db[_0xbd0f('0x61')][_0xbd0f('0x2d')]({'where':_0x7bda0d[_0xbd0f('0x45')]})['then'](function(_0x723883){_0x4d3cdd[_0xbd0f('0x2d')]=_0x723883;if(_0x5a8ba5[_0xbd0f('0x3c')][_0xbd0f('0x52')]){_0x7bda0d[_0xbd0f('0x4b')]=[{'all':!![]}];}return db[_0xbd0f('0x61')][_0xbd0f('0x4c')](_0x7bda0d);})[_0xbd0f('0x1d')](function(_0x2b7a06){_0x4d3cdd[_0xbd0f('0x4d')]=_0x2b7a06;return _0x4d3cdd;});}})['then'](respondWithFilteredResult(_0x2a14bb,_0x7bda0d))[_0xbd0f('0x4e')](handleError(_0x2a14bb,null));};exports[_0xbd0f('0x67')]=function(_0xf8f8fb,_0x3adac6,_0x509fdd){return db['WhatsappAccount'][_0xbd0f('0x5e')]({'where':{'id':_0xf8f8fb[_0xbd0f('0x50')]['id']}})[_0xbd0f('0x1d')](handleEntityNotFound(_0x3adac6,null))[_0xbd0f('0x1d')](function(_0x6106de){if(_0x6106de){return _0x6106de[_0xbd0f('0x67')](_0xf8f8fb[_0xbd0f('0x3c')][_0xbd0f('0x68')]);}})[_0xbd0f('0x1d')](respondWithStatusCode(_0x3adac6,null))[_0xbd0f('0x4e')](handleError(_0x3adac6,null));};exports['addAnswer']=function(_0x58d4ff,_0x233dc8,_0x92009b){if(_0x58d4ff[_0xbd0f('0x54')]['id']){delete _0x58d4ff[_0xbd0f('0x54')]['id'];}return db[_0xbd0f('0x39')][_0xbd0f('0x5e')]({'where':{'id':_0x58d4ff[_0xbd0f('0x50')]['id']}})[_0xbd0f('0x1d')](handleEntityNotFound(_0x233dc8,null))[_0xbd0f('0x1d')](function(_0x110f23){if(_0x110f23){_0x58d4ff[_0xbd0f('0x54')]['WhatsappAccountId']=_0x110f23['id'];return db[_0xbd0f('0x69')]['create'](_0x58d4ff['body']);}})['then'](respondWithResult(_0x233dc8,null))[_0xbd0f('0x4e')](handleError(_0x233dc8,null));};exports[_0xbd0f('0x6a')]=function(_0x31c17f,_0x5851e6,_0x484081){var _0x25fc8e={'raw':![],'where':{}};var _0x3fa253={};var _0x50df3d={'count':0x0,'rows':[]};return db[_0xbd0f('0x39')][_0xbd0f('0x63')]({'where':{'id':_0x31c17f['params']['id']}})['then'](handleEntityNotFound(_0x5851e6,null))[_0xbd0f('0x1d')](function(_0x3bfe70){if(_0x3bfe70){_0x3fa253['model']=_[_0xbd0f('0x3d')](db[_0xbd0f('0x69')][_0xbd0f('0x3a')]);_0x3fa253[_0xbd0f('0x3c')]=_[_0xbd0f('0x3d')](_0x31c17f['query']);_0x3fa253['filters']=_[_0xbd0f('0x3e')](_0x3fa253[_0xbd0f('0x3f')],_0x3fa253['query']);_0x25fc8e['attributes']=_['intersection'](_0x3fa253[_0xbd0f('0x3f')],qs[_0xbd0f('0x41')](_0x31c17f[_0xbd0f('0x3c')]['fields']));_0x25fc8e[_0xbd0f('0x40')]=_0x25fc8e['attributes'][_0xbd0f('0x42')]?_0x25fc8e[_0xbd0f('0x40')]:_0x3fa253[_0xbd0f('0x3f')];if(!_0x31c17f[_0xbd0f('0x3c')]['hasOwnProperty'](_0xbd0f('0x65'))){_0x25fc8e['limit']=qs['limit'](_0x31c17f[_0xbd0f('0x3c')][_0xbd0f('0x2c')]);_0x25fc8e[_0xbd0f('0x2b')]=qs[_0xbd0f('0x2b')](_0x31c17f['query'][_0xbd0f('0x2b')]);}_0x25fc8e[_0xbd0f('0x43')]=qs[_0xbd0f('0x44')](_0x31c17f[_0xbd0f('0x3c')][_0xbd0f('0x44')]);_0x25fc8e[_0xbd0f('0x45')]=qs['filters'](_['pick'](_0x31c17f[_0xbd0f('0x3c')],_0x3fa253['filters']));_0x25fc8e['where'][_0xbd0f('0x66')]=_0x3bfe70['id'];if(_0x31c17f[_0xbd0f('0x3c')][_0xbd0f('0x48')]){_0x25fc8e[_0xbd0f('0x45')]=_[_0xbd0f('0x49')](_0x25fc8e[_0xbd0f('0x45')],{'$or':_[_0xbd0f('0x38')](_0x25fc8e['attributes'],function(_0x10ba26){var _0xbb9904={};_0xbb9904[_0x10ba26]={'$like':'%'+_0x31c17f['query'][_0xbd0f('0x48')]+'%'};return _0xbb9904;})});}_0x25fc8e=_[_0xbd0f('0x49')]({},_0x25fc8e,_0x31c17f['options']);return db[_0xbd0f('0x69')]['count']({'where':_0x25fc8e[_0xbd0f('0x45')]})['then'](function(_0x40879d){_0x50df3d[_0xbd0f('0x2d')]=_0x40879d;if(_0x31c17f[_0xbd0f('0x3c')]['includeAll']){_0x25fc8e[_0xbd0f('0x4b')]=[{'all':!![]}];}return db[_0xbd0f('0x69')][_0xbd0f('0x4c')](_0x25fc8e);})[_0xbd0f('0x1d')](function(_0x3ba464){_0x50df3d[_0xbd0f('0x4d')]=_0x3ba464;return _0x50df3d;});}})[_0xbd0f('0x1d')](respondWithFilteredResult(_0x5851e6,_0x25fc8e))[_0xbd0f('0x4e')](handleError(_0x5851e6,null));};exports[_0xbd0f('0x6b')]=function(_0x228507,_0x1f224a,_0x262f69){return db[_0xbd0f('0x39')][_0xbd0f('0x5e')]({'where':{'id':_0x228507[_0xbd0f('0x50')]['id']}})['then'](handleEntityNotFound(_0x1f224a,null))[_0xbd0f('0x1d')](function(_0x3c1d3d){if(_0x3c1d3d){return _0x3c1d3d['removeAnswers'](_0x228507['query']['ids']);}})[_0xbd0f('0x1d')](respondWithStatusCode(_0x1f224a,null))[_0xbd0f('0x4e')](handleError(_0x1f224a,null));};exports[_0xbd0f('0x6c')]=function(_0x25efba,_0x5252d3,_0x3bcbf7){return db[_0xbd0f('0x39')][_0xbd0f('0x5e')]({'where':{'id':_0x25efba[_0xbd0f('0x50')]['id']}})[_0xbd0f('0x1d')](handleEntityNotFound(_0x5252d3,null))[_0xbd0f('0x1d')](function(_0x1dbad6){if(_0x1dbad6){return _0x1dbad6[_0xbd0f('0x6c')](_0x25efba[_0xbd0f('0x54')]['ids'],_[_0xbd0f('0x6d')](_0x25efba['body'],[_0xbd0f('0x68'),'id'])||{})[_0xbd0f('0x6e')](function(_0x1d4f71){for(var _0x371a67=0x0;_0x371a67<_0x25efba[_0xbd0f('0x54')][_0xbd0f('0x68')][_0xbd0f('0x42')];_0x371a67+=0x1){socket[_0xbd0f('0x6f')]('userWhatsappAccount:save',{'UserId':Number(_0x25efba[_0xbd0f('0x54')][_0xbd0f('0x68')][_0x371a67]),'WhatsappAccountId':Number(_0x25efba[_0xbd0f('0x50')]['id'])});}return _0x1d4f71;});}})[_0xbd0f('0x1d')](respondWithResult(_0x5252d3,null))[_0xbd0f('0x4e')](handleError(_0x5252d3,null));};exports['removeAgents']=function(_0x48bb25,_0x356409,_0x43b2fb){return db[_0xbd0f('0x39')][_0xbd0f('0x5e')]({'where':{'id':_0x48bb25[_0xbd0f('0x50')]['id']}})['then'](handleEntityNotFound(_0x356409,null))['then'](function(_0x50a35a){if(_0x50a35a){return _0x50a35a['removeAgents'](_0x48bb25[_0xbd0f('0x3c')][_0xbd0f('0x68')])['then'](function(){if(_['isArray'](_0x48bb25['query'][_0xbd0f('0x68')])){for(var _0x40718b=0x0;_0x40718b<_0x48bb25[_0xbd0f('0x3c')][_0xbd0f('0x68')]['length'];_0x40718b+=0x1){socket['emit'](_0xbd0f('0x70'),{'UserId':Number(_0x48bb25[_0xbd0f('0x3c')][_0xbd0f('0x68')][_0x40718b]),'WhatsappAccountId':Number(_0x48bb25['params']['id'])});}}else{socket[_0xbd0f('0x6f')](_0xbd0f('0x70'),{'UserId':Number(_0x48bb25['query'][_0xbd0f('0x68')]),'WhatsappAccountId':Number(_0x48bb25[_0xbd0f('0x50')]['id'])});}});}})[_0xbd0f('0x1d')](respondWithStatusCode(_0x356409,null))[_0xbd0f('0x4e')](handleError(_0x356409,null));};exports[_0xbd0f('0x71')]=function(_0x13a58c,_0xb425c5,_0x3840ed){var _0x10bd7={};var _0x2dc4cc={};var _0x3cb23d;var _0x58a008;return db[_0xbd0f('0x39')][_0xbd0f('0x63')]({'where':{'id':_0x13a58c['params']['id']}})[_0xbd0f('0x1d')](handleEntityNotFound(_0xb425c5,null))['then'](function(_0x3c85f8){if(_0x3c85f8){_0x3cb23d=_0x3c85f8;_0x2dc4cc[_0xbd0f('0x3f')]=_[_0xbd0f('0x3d')](db[_0xbd0f('0x72')][_0xbd0f('0x3a')]);_0x2dc4cc[_0xbd0f('0x3c')]=_[_0xbd0f('0x3d')](_0x13a58c[_0xbd0f('0x3c')]);_0x2dc4cc['filters']=_['intersection'](_0x2dc4cc[_0xbd0f('0x3f')],_0x2dc4cc['query']);_0x10bd7[_0xbd0f('0x40')]=_[_0xbd0f('0x3e')](_0x2dc4cc[_0xbd0f('0x3f')],qs['fields'](_0x13a58c[_0xbd0f('0x3c')]['fields']));_0x10bd7[_0xbd0f('0x40')]=_0x10bd7[_0xbd0f('0x40')][_0xbd0f('0x42')]?_0x10bd7['attributes']:_0x2dc4cc[_0xbd0f('0x3f')];_0x10bd7[_0xbd0f('0x43')]=qs['sort'](_0x13a58c[_0xbd0f('0x3c')][_0xbd0f('0x44')]);_0x10bd7[_0xbd0f('0x45')]=qs[_0xbd0f('0x47')](_['pick'](_0x13a58c['query'],_0x2dc4cc[_0xbd0f('0x47')]));if(_0x13a58c['query']['filter']){_0x10bd7[_0xbd0f('0x45')]=_[_0xbd0f('0x49')](_0x10bd7[_0xbd0f('0x45')],{'$or':_['map'](_0x10bd7[_0xbd0f('0x40')],function(_0x55f2f6){var _0x2f1936={};_0x2f1936[_0x55f2f6]={'$like':'%'+_0x13a58c[_0xbd0f('0x3c')]['filter']+'%'};return _0x2f1936;})});}_0x10bd7=_['merge']({},_0x10bd7,_0x13a58c[_0xbd0f('0x4a')]);return _0x3cb23d[_0xbd0f('0x71')](_0x10bd7);}})[_0xbd0f('0x1d')](function(_0x2a6a69){if(_0x2a6a69){_0x58a008=_0x2a6a69[_0xbd0f('0x42')];if(!_0x13a58c[_0xbd0f('0x3c')][_0xbd0f('0x64')](_0xbd0f('0x65'))){_0x10bd7[_0xbd0f('0x2c')]=qs[_0xbd0f('0x2c')](_0x13a58c[_0xbd0f('0x3c')][_0xbd0f('0x2c')]);_0x10bd7[_0xbd0f('0x2b')]=qs[_0xbd0f('0x2b')](_0x13a58c['query'][_0xbd0f('0x2b')]);}return _0x3cb23d[_0xbd0f('0x71')](_0x10bd7);}})[_0xbd0f('0x1d')](function(_0x393a59){if(_0x393a59){return _0x393a59?{'count':_0x58a008,'rows':_0x393a59}:null;}})[_0xbd0f('0x1d')](respondWithResult(_0xb425c5,null))[_0xbd0f('0x4e')](handleError(_0xb425c5,null));};exports[_0xbd0f('0x73')]=function(_0x27a3d6,_0x50d1ca){var _0x5992dd=_0x27a3d6[_0xbd0f('0x50')]['id'];var _0x163c3e=_0x27a3d6[_0xbd0f('0x54')];var _0x479efb=0xc8;var _0x47a448=null;return db[_0xbd0f('0x74')][_0xbd0f('0x75')]({'isolationLevel':db[_0xbd0f('0x74')][_0xbd0f('0x76')][_0xbd0f('0x77')][_0xbd0f('0x78')]},function(_0xbbb3fc){return db[_0xbd0f('0x39')]['findOne']({'where':{'id':_0x5992dd},'transaction':_0xbbb3fc})[_0xbd0f('0x1d')](function(_0x366028){if(_0x366028){return db[_0xbd0f('0x79')][_0xbd0f('0x32')]({'where':{'WhatsappAccountId':_0x5992dd},'transaction':_0xbbb3fc})[_0xbd0f('0x1d')](function(){var _0x18b0fa=_[_0xbd0f('0x38')](_0x163c3e,function(_0x21f377){_0x21f377[_0xbd0f('0x66')]=_0x5992dd;return _0x21f377;});return db[_0xbd0f('0x79')][_0xbd0f('0x7a')](_0x18b0fa,{'transaction':_0xbbb3fc});});}else{_0x479efb=0x194;_0x47a448=[];}});})[_0xbd0f('0x1d')](function(){if(_0x479efb!==0x194){return db[_0xbd0f('0x79')][_0xbd0f('0x7b')]({'where':{'WhatsappAccountId':_0x5992dd},'order':'priority'})[_0xbd0f('0x1d')](function(_0x5869f5){_0x47a448=_0x5869f5;});}})['catch'](function(_0x1217fd){_0x479efb=0x1f4;logger['error'](_0x1217fd['stack']);if(_0x1217fd[_0xbd0f('0x35')]){delete _0x1217fd['name'];}_0x47a448=_0x1217fd;})[_0xbd0f('0x7c')](function(){if(_0x47a448===null){_0x50d1ca[_0xbd0f('0x28')](_0x479efb);}else{if(_0x479efb===0x1f4){_0x50d1ca[_0xbd0f('0x29')](_0x479efb)[_0xbd0f('0x7d')](_0x47a448);}else{_0x50d1ca[_0xbd0f('0x29')](_0x479efb)[_0xbd0f('0x7e')](_0x47a448);}}});};exports['getApplications']=function(_0x14b8f0,_0x474761,_0x39f8e5){var _0x1ae307={};var _0x278080={};var _0x57918d;var _0x170d22;return db[_0xbd0f('0x39')]['findOne']({'where':{'id':_0x14b8f0[_0xbd0f('0x50')]['id']}})['then'](handleEntityNotFound(_0x474761,null))[_0xbd0f('0x1d')](function(_0x19604e){if(_0x19604e){_0x57918d=_0x19604e;_0x278080[_0xbd0f('0x3f')]=_[_0xbd0f('0x3d')](db[_0xbd0f('0x79')][_0xbd0f('0x3a')]);_0x278080[_0xbd0f('0x3c')]=_[_0xbd0f('0x3d')](_0x14b8f0['query']);_0x278080[_0xbd0f('0x47')]=_[_0xbd0f('0x3e')](_0x278080[_0xbd0f('0x3f')],_0x278080[_0xbd0f('0x3c')]);_0x1ae307[_0xbd0f('0x40')]=_[_0xbd0f('0x3e')](_0x278080['model'],qs[_0xbd0f('0x41')](_0x14b8f0[_0xbd0f('0x3c')][_0xbd0f('0x41')]));_0x1ae307[_0xbd0f('0x40')]=_0x1ae307['attributes'][_0xbd0f('0x42')]?_0x1ae307['attributes']:_0x278080[_0xbd0f('0x3f')];_0x1ae307[_0xbd0f('0x43')]=qs[_0xbd0f('0x44')](_0x14b8f0[_0xbd0f('0x3c')][_0xbd0f('0x44')]);_0x1ae307[_0xbd0f('0x45')]=qs[_0xbd0f('0x47')](_['pick'](_0x14b8f0[_0xbd0f('0x3c')],_0x278080[_0xbd0f('0x47')]));if(_0x14b8f0[_0xbd0f('0x3c')][_0xbd0f('0x48')]){_0x1ae307[_0xbd0f('0x45')]=_[_0xbd0f('0x49')](_0x1ae307[_0xbd0f('0x45')],{'$or':_['map'](_0x1ae307[_0xbd0f('0x40')],function(_0x32fcf9){var _0x323918={};_0x323918[_0x32fcf9]={'$like':'%'+_0x14b8f0['query'][_0xbd0f('0x48')]+'%'};return _0x323918;})});}_0x1ae307=_['merge']({},_0x1ae307,_0x14b8f0[_0xbd0f('0x4a')]);return _0x57918d[_0xbd0f('0x7f')](_0x1ae307);}})[_0xbd0f('0x1d')](function(_0x1018de){if(_0x1018de){_0x170d22=_0x1018de['length'];if(!_0x14b8f0[_0xbd0f('0x3c')][_0xbd0f('0x64')](_0xbd0f('0x65'))){_0x1ae307[_0xbd0f('0x2c')]=qs[_0xbd0f('0x2c')](_0x14b8f0[_0xbd0f('0x3c')][_0xbd0f('0x2c')]);_0x1ae307[_0xbd0f('0x2b')]=qs['offset'](_0x14b8f0[_0xbd0f('0x3c')][_0xbd0f('0x2b')]);}return _0x57918d[_0xbd0f('0x7f')](_0x1ae307);}})[_0xbd0f('0x1d')](function(_0x4f10a4){if(_0x4f10a4){return _0x4f10a4?{'count':_0x170d22,'rows':_0x4f10a4}:null;}})[_0xbd0f('0x1d')](respondWithResult(_0x474761,null))[_0xbd0f('0x4e')](handleError(_0x474761,null));};exports[_0xbd0f('0x80')]=function(_0x46f254,_0x381025,_0x34f8d6){var _0x179062={'channel':_0xbd0f('0x81')};var _0x51df6d=[];var _0x5c00ec=[];var _0x2b087f={};return db['WhatsappAccount']['find']({'where':{'id':_0x46f254[_0xbd0f('0x50')]['id']},'include':[{'model':db[_0xbd0f('0x79')],'as':_0xbd0f('0x82')}]})[_0xbd0f('0x1d')](handleEntityNotFound(_0x381025,null))[_0xbd0f('0x1d')](function(_0x1b7440){_0x179062['account']=_0x1b7440;if(_0x179062[_0xbd0f('0x83')]&&_0x179062['account'][_0xbd0f('0x3b')]==='sinch'&&_0x46f254[_0xbd0f('0x54')][_0xbd0f('0x84')]){if(_0x46f254[_0xbd0f('0x54')]['statuses'][_0xbd0f('0x42')]===0x0)return;if(_0x46f254[_0xbd0f('0x54')][_0xbd0f('0x84')][0x0]['state']!=='read')return;return db[_0xbd0f('0x85')][_0xbd0f('0x5d')]({'read':!![],'readAt':_0x46f254['body'][_0xbd0f('0x84')][0x0]['timestamp']},{'where':{'messageId':_0x46f254['body'][_0xbd0f('0x84')][0x0][_0xbd0f('0x86')]},'individualHooks':!![]})[_0xbd0f('0x1d')](function(_0x2d7aaa){return _0x381025[_0xbd0f('0x29')](0xc8)[_0xbd0f('0x7e')](_0x2d7aaa);});}_0x179062[_0xbd0f('0x87')]=_[_0xbd0f('0x88')](_0x1b7440[_0xbd0f('0x82')],[_0xbd0f('0x89')],['asc']);if(_0x179062['account']['Applications']){delete _0x179062[_0xbd0f('0x83')][_0xbd0f('0x82')];}return db['CmContact'][_0xbd0f('0x5f')]()[_0xbd0f('0x1d')](function(_0x495664){if(!_0x495664){throw new db[(_0xbd0f('0x8a'))]['ValidationError'](_0xbd0f('0x8b'));}_0x51df6d=_['difference'](_[_0xbd0f('0x3d')](_0x495664),[_0xbd0f('0x8c'),_0xbd0f('0x8d')]);_0x5c00ec=_[_0xbd0f('0x8e')](_[_0xbd0f('0x3d')](_0x495664),[_0xbd0f('0x8c'),_0xbd0f('0x8d'),_0xbd0f('0x8f'),'ListId']);_0x179062[_0xbd0f('0x54')]={'mapKey':_0xbd0f('0x90')};if(_0x179062['account']&&_0x179062[_0xbd0f('0x83')][_0xbd0f('0x3b')]===_0xbd0f('0x91')){_0x179062['body'][_0xbd0f('0x92')]=_0x46f254['body']['From'][_0xbd0f('0x93')]('whatsapp:','');_0x179062[_0xbd0f('0x54')][_0xbd0f('0x54')]=_0x46f254['body'][_0xbd0f('0x94')];_0x179062[_0xbd0f('0x54')][_0xbd0f('0x95')]=_0x46f254[_0xbd0f('0x54')]['MessageSid'];}if(_0x179062[_0xbd0f('0x83')]&&_0x179062[_0xbd0f('0x83')]['type']==='sinch'){_0x179062[_0xbd0f('0x54')][_0xbd0f('0x92')]=_0x46f254[_0xbd0f('0x54')][_0xbd0f('0x96')][0x0][_0xbd0f('0x92')];_0x179062[_0xbd0f('0x54')][_0xbd0f('0x54')]=_0x46f254['body'][_0xbd0f('0x96')][0x0][_0xbd0f('0x26')][_0xbd0f('0x54')];_0x179062['body'][_0xbd0f('0x95')]=_0x46f254[_0xbd0f('0x54')][_0xbd0f('0x96')][0x0][_0xbd0f('0x86')];}if(_0x179062[_0xbd0f('0x54')]['id']){delete _0x179062['body']['id'];}if(_[_0xbd0f('0x97')](_0x179062['body']['from'])){throw new db['Sequelize']['ValidationError'](_0xbd0f('0x98'));}if(_[_0xbd0f('0x97')](_0x179062[_0xbd0f('0x54')]['body'])||_0x179062[_0xbd0f('0x54')][_0xbd0f('0x54')]===''){throw new db[(_0xbd0f('0x8a'))][(_0xbd0f('0x99'))](_0xbd0f('0x9a'));}if(_[_0xbd0f('0x97')](_0x179062['body'][_0xbd0f('0x9b')])){throw new db[(_0xbd0f('0x8a'))][(_0xbd0f('0x99'))](_0xbd0f('0x9c')+_0x5c00ec);}if(!_['includes'](_0x5c00ec,_0x179062[_0xbd0f('0x54')]['mapKey'])){throw new db[(_0xbd0f('0x8a'))][(_0xbd0f('0x99'))](_0xbd0f('0x9d')+_0x5c00ec);}_0x2b087f[_0x179062[_0xbd0f('0x54')][_0xbd0f('0x9b')]]=_0x179062['body']['from'];return db[_0xbd0f('0x9e')]['find']({'where':{'id':_0x179062['account'][_0xbd0f('0x9f')]},'include':[{'model':db[_0xbd0f('0xa0')],'as':_0xbd0f('0xa1'),'where':_0x2b087f,'limit':0x1,'order':[[_0xbd0f('0x8d'),'DESC']]}]});})[_0xbd0f('0x1d')](handleEntityNotFound(_0x381025,null))[_0xbd0f('0x1d')](function(_0x3df416){if(_0x3df416){_0x179062[_0xbd0f('0xa2')]=_[_0xbd0f('0x6d')](_0x3df416,[_0xbd0f('0xa1')]);if(_0x3df416[_0xbd0f('0xa1')][_0xbd0f('0x42')]){return _0x3df416['Contacts'][0x0];}var _0x4ddbf1=_['defaults'](_0x179062['body'],{'firstName':_0x179062[_0xbd0f('0x54')][_0xbd0f('0x92')],'ListId':_0x3df416['id']});_0x4ddbf1[_0x179062['body'][_0xbd0f('0x9b')]]=_0x179062[_0xbd0f('0x54')]['from'];return db[_0xbd0f('0xa0')]['create'](_0x4ddbf1,{'fields':_0x51df6d,'raw':!![]});}})['then'](handleEntityNotFound(_0x381025,null))['then'](function(_0xc252d9){if(_0xc252d9){_0x179062[_0xbd0f('0xa3')]=_0xc252d9;var _0x71539e={'ContactId':_0xc252d9['id'],'phone':_0x179062[_0xbd0f('0x54')][_0xbd0f('0x92')],'WhatsappAccountId':_0x46f254['params']['id']};var _0x2a337d={'ContactId':_0xc252d9['id'],'WhatsappAccountId':_0x46f254[_0xbd0f('0x50')]['id'],'closed':![]};return db[_0xbd0f('0xa4')]['find']({'where':_0x2a337d})[_0xbd0f('0x1d')](function(_0x3aee4c){if(_0x3aee4c){return[_0x3aee4c,![]];}return db[_0xbd0f('0xa4')][_0xbd0f('0x53')](_0x71539e)[_0xbd0f('0x1d')](function(_0xcf5330){return[_0xcf5330,!![]];});});}})[_0xbd0f('0x6e')](function(_0x9c17f5,_0xa3522){_0x179062[_0xbd0f('0xa5')]=_0x9c17f5['get']({'plain':!![]});_0x179062['interaction'][_0xbd0f('0xa6')]=![];if(_0xa3522){if(_0x179062[_0xbd0f('0x83')]['autoclose']){_0x179062['applications'][_0xbd0f('0xa7')]({'id':0x0,'priority':_0x179062[_0xbd0f('0x87')][_0xbd0f('0x42')]+0x1,'app':_0xbd0f('0xa8'),'appdata':_0xbd0f('0xa9'),'interval':'*,*,*,*'});}_0x179062['interaction']['created']=!![];}return db['WhatsappMessage'][_0xbd0f('0x53')]({'phone':_0x179062[_0xbd0f('0x54')][_0xbd0f('0x92')],'messageId':_0x179062['body']['messageId'],'body':_0x179062['body'][_0xbd0f('0x54')],'WhatsappAccountId':_0x46f254[_0xbd0f('0x50')]['id'],'WhatsappInteractionId':_0x9c17f5['id'],'direction':'in','ContactId':_0x9c17f5[_0xbd0f('0xaa')],'AttachmentId':_0x179062[_0xbd0f('0x54')][_0xbd0f('0xab')]});})['then'](function(_0x5460ed){_0x179062[_0xbd0f('0x26')]=_0x5460ed;if(_0x179062[_0xbd0f('0xa5')][_0xbd0f('0xac')]){return db[_0xbd0f('0x72')][_0xbd0f('0x5e')]({'attributes':['id',_0xbd0f('0x35')],'where':{'id':_0x179062[_0xbd0f('0xa5')][_0xbd0f('0xac')]}})[_0xbd0f('0x1d')](function(_0x160006){if(_0x160006){_0x179062[_0xbd0f('0x87')][_0xbd0f('0xad')]({'id':0x0,'priority':0x0,'app':_0xbd0f('0xae'),'appdata':_0x160006[_0xbd0f('0x35')]+','+(_0x179062[_0xbd0f('0x83')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0xbd0f('0xaf'),_0x179062);});}return respondWithRpcPromise(_0xbd0f('0xb0'),_0xbd0f('0xaf'),_0x179062);})[_0xbd0f('0x1d')](function(_0x378dab){if(_0x378dab){var _0x1d31d3=0xc8;var _0x2c5835=_0xbd0f('0xb1');logger[_0xbd0f('0x1e')](_0xbd0f('0x22'),_0x2c5835,_0x1d31d3,'entity\x20found');logger[_0xbd0f('0x21')](_0xbd0f('0xb2'),_0x2c5835,_0x1d31d3,_0xbd0f('0xb3'),JSON[_0xbd0f('0x23')](_0x378dab));if(_0x179062[_0xbd0f('0x83')][_0xbd0f('0x3b')]==='twilio'){return _0x381025[_0xbd0f('0x29')](_0x1d31d3)[_0xbd0f('0x2e')](_0xbd0f('0xb4'),_0xbd0f('0xb5'))[_0xbd0f('0x7d')](_0xbd0f('0xb6'));}else{return _0x381025[_0xbd0f('0x29')](_0x1d31d3)[_0xbd0f('0x7e')](_0x378dab);}}});})[_0xbd0f('0x4e')](handleError(_0x381025,null));};exports['send']=function(_0x30c11a,_0x84527,_0xfd41c2){var _0x5cf308,_0x487385,_0x319bf1;if(_['isNil'](_0x30c11a['body'][_0xbd0f('0x54')])||_0x30c11a['body'][_0xbd0f('0x54')]===''){throw new db[(_0xbd0f('0x8a'))][(_0xbd0f('0x99'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xbd0f('0x97')](_0x30c11a[_0xbd0f('0x54')]['to'])){throw new db[(_0xbd0f('0x8a'))][(_0xbd0f('0x99'))]('to\x20is\x20mandatory');}_0x5cf308=_0x30c11a['body']['to'];return db['WhatsappAccount'][_0xbd0f('0x5e')]({'where':{'id':_0x30c11a[_0xbd0f('0x50')]['id']},'include':[{'model':db[_0xbd0f('0x9e')],'as':'List','include':[{'model':db[_0xbd0f('0xa0')],'as':_0xbd0f('0xa1'),'where':{'mobile':_0x5cf308},'limit':0x1,'order':[[_0xbd0f('0x8d'),_0xbd0f('0xb7')]]}]}]})[_0xbd0f('0x1d')](handleEntityNotFound(_0x84527,null))[_0xbd0f('0x1d')](function(_0x2b5f69){if(_0x2b5f69&&_0x2b5f69[_0xbd0f('0xb8')]){_0x487385=_0x2b5f69['get']({'plain':!![]});if(_0x487385[_0xbd0f('0xb8')]&&_0x487385[_0xbd0f('0xb8')][_0xbd0f('0xa1')][_0xbd0f('0x42')]){return _0x487385[_0xbd0f('0xb8')][_0xbd0f('0xa1')][0x0];}return db[_0xbd0f('0xa0')][_0xbd0f('0x53')](_[_0xbd0f('0xb9')](_0x30c11a[_0xbd0f('0x54')],{'firstName':_0x5cf308,'mobile':_0x5cf308,'phone':_0x5cf308,'ListId':_0x487385[_0xbd0f('0x9f')]}));}})[_0xbd0f('0x1d')](handleEntityNotFound(_0x84527,null))[_0xbd0f('0x1d')](function(_0x1a9a0f){if(_0x1a9a0f){_0x319bf1=_0x1a9a0f;return db[_0xbd0f('0xa4')]['find']({'where':{'ContactId':_0x319bf1['id'],'closed':![],'WhatsappAccountId':_0x487385['id']}})[_0xbd0f('0x1d')](function(_0x485cbf){if(_0x485cbf){return[_0x485cbf,![]];}return db[_0xbd0f('0xa4')][_0xbd0f('0x53')]({'UserId':_0x30c11a['user']['id'],'ContactId':_0x319bf1['id'],'WhatsappAccountId':_0x487385['id'],'phone':_0x5cf308,'firstMsgDirection':_0xbd0f('0xba'),'Messages':[_[_0xbd0f('0x49')](_0x30c11a[_0xbd0f('0x54')],{'read':![],'body':_0x30c11a[_0xbd0f('0x54')][_0xbd0f('0x54')],'phone':_0x5cf308,'WhatsappAccountId':_0x487385['id'],'UserId':_0x30c11a['user']['id'],'ContactId':_0x319bf1['id']})]},{'include':[{'model':db[_0xbd0f('0x85')],'as':'Messages'}]})[_0xbd0f('0x1d')](function(_0x3e2ba1){return[_0x3e2ba1,!![]];});});}})[_0xbd0f('0x6e')](function(_0x38098d,_0x105b49){if(_0x105b49){return _0x38098d;}return db[_0xbd0f('0x85')][_0xbd0f('0x53')](_[_0xbd0f('0x49')](_0x30c11a[_0xbd0f('0x54')],{'read':![],'body':_0x30c11a[_0xbd0f('0x54')]['body'],'phone':_0x5cf308,'WhatsappAccountId':_0x487385['id'],'WhatsappInteractionId':_0x38098d['id'],'UserId':_0x30c11a[_0xbd0f('0x55')]['id'],'ContactId':_0x319bf1['id']}))[_0xbd0f('0x1d')](function(_0x345925){_0x38098d['dataValues'][_0xbd0f('0xbb')]=[];_0x38098d['dataValues'][_0xbd0f('0xbb')][_0xbd0f('0xa7')](_0x345925[_0xbd0f('0xbc')]);return _0x38098d;});})[_0xbd0f('0x1d')](respondWithResult(_0x84527,null))['catch'](handleError(_0x84527,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 5bf754a..08dec5f 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 _0x4f7e=['exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x3fc833,_0x57293a){var _0x593bd1=function(_0x3ba874){while(--_0x3ba874){_0x3fc833['push'](_0x3fc833['shift']());}};_0x593bd1(++_0x57293a);}(_0x4f7e,0xbf));var _0xe4f7=function(_0x4550b0,_0x2564a4){_0x4550b0=_0x4550b0-0x0;var _0x54cb42=_0x4f7e[_0x4550b0];return _0x54cb42;};'use strict';var EventEmitter=require(_0xe4f7('0x0'));var WhatsappAccount=require(_0xe4f7('0x1'))['db'][_0xe4f7('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xe4f7('0x3')](0x0);var events={'afterCreate':_0xe4f7('0x4'),'afterUpdate':_0xe4f7('0x5'),'afterDestroy':'remove'};function emitEvent(_0xfaf886){return function(_0xcf5199,_0x5c2724,_0x423453){WhatsappAccountEvents[_0xe4f7('0x6')](_0xfaf886+':'+_0xcf5199['id'],_0xcf5199);WhatsappAccountEvents[_0xe4f7('0x6')](_0xfaf886,_0xcf5199);_0x423453(null);};}for(var e in events){if(events[_0xe4f7('0x7')](e)){var event=events[e];WhatsappAccount[_0xe4f7('0x8')](e,emitEvent(event));}}module[_0xe4f7('0x9')]=WhatsappAccountEvents; \ No newline at end of file +var _0x0a2d=['events','../../mysqldb','WhatsappAccount','setMaxListeners','emit','hasOwnProperty','hook'];(function(_0x2bc7fa,_0x10771a){var _0x20a728=function(_0x42dd3f){while(--_0x42dd3f){_0x2bc7fa['push'](_0x2bc7fa['shift']());}};_0x20a728(++_0x10771a);}(_0x0a2d,0xee));var _0xd0a2=function(_0x37e5cb,_0xd5d8f5){_0x37e5cb=_0x37e5cb-0x0;var _0x3ba227=_0x0a2d[_0x37e5cb];return _0x3ba227;};'use strict';var EventEmitter=require(_0xd0a2('0x0'));var WhatsappAccount=require(_0xd0a2('0x1'))['db'][_0xd0a2('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xd0a2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x18e1f1){return function(_0x5d3209,_0x213f1e,_0x34fe60){WhatsappAccountEvents['emit'](_0x18e1f1+':'+_0x5d3209['id'],_0x5d3209);WhatsappAccountEvents[_0xd0a2('0x4')](_0x18e1f1,_0x5d3209);_0x34fe60(null);};}for(var e in events){if(events[_0xd0a2('0x5')](e)){var event=events[e];WhatsappAccount[_0xd0a2('0x6')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 509a3f6..7f373ac 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 _0xe06b=['whatsapp_accounts','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0xe06b,0x1a5));var _0xbe06=function(_0x36e4bf,_0x24ce5e){_0x36e4bf=_0x36e4bf-0x0;var _0x50b94d=_0xe06b[_0x36e4bf];return _0x50b94d;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xbe06('0x0'));var moment=require(_0xbe06('0x1'));var BPromise=require(_0xbe06('0x2'));var rp=require(_0xbe06('0x3'));var fs=require('fs');var path=require(_0xbe06('0x4'));var rimraf=require(_0xbe06('0x5'));var config=require(_0xbe06('0x6'));var attributes=require(_0xbe06('0x7'));module[_0xbe06('0x8')]=function(_0x36fa71,_0x524b9c){return _0x36fa71[_0xbe06('0x9')](_0xbe06('0xa'),attributes,{'tableName':_0xbe06('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf6f7=['./whatsappAccount.attributes','define','WhatsappAccount','lodash','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xf6f7,0x66));var _0x7f6f=function(_0x22ee1e,_0x3eff80){_0x22ee1e=_0x22ee1e-0x0;var _0x49a5c9=_0xf6f7[_0x22ee1e];return _0x49a5c9;};'use strict';var _=require(_0x7f6f('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x7f6f('0x1'));var BPromise=require(_0x7f6f('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7f6f('0x3'));var rimraf=require(_0x7f6f('0x4'));var config=require(_0x7f6f('0x5'));var attributes=require(_0x7f6f('0x6'));module['exports']=function(_0xfabb85,_0x27e279){return _0xfabb85[_0x7f6f('0x7')](_0x7f6f('0x8'),attributes,{'tableName':'whatsapp_accounts','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 14e2861..f7157b5 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 _0xbfe1=['randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','defaults','socket.io-emitter','./whatsappAccount.socket','register','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappAccount','options','raw','include','map','model','attributes','then','ShowWhatsappAccount','debug','lodash','util','moment'];(function(_0x2153d7,_0x1dd133){var _0x13eff6=function(_0x2f2fa9){while(--_0x2f2fa9){_0x2153d7['push'](_0x2153d7['shift']());}};_0x13eff6(++_0x1dd133);}(_0xbfe1,0x66));var _0x1bfe=function(_0x3d3141,_0x5a275b){_0x3d3141=_0x3d3141-0x0;var _0xa23521=_0xbfe1[_0x3d3141];return _0xa23521;};'use strict';var _=require(_0x1bfe('0x0'));var util=require(_0x1bfe('0x1'));var moment=require(_0x1bfe('0x2'));var BPromise=require('bluebird');var rs=require(_0x1bfe('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1bfe('0x4'))['db'];var utils=require(_0x1bfe('0x5'));var logger=require(_0x1bfe('0x6'))('rpc');var config=require(_0x1bfe('0x7'));var jayson=require(_0x1bfe('0x8'));var client=jayson['client'][_0x1bfe('0x9')]({'port':0x232a});config['redis']=_[_0x1bfe('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1bfe('0xb'))(new Redis(config['redis']));require(_0x1bfe('0xc'))[_0x1bfe('0xd')](socket);function respondWithRpcPromise(_0xe50b5c,_0x5c3b05,_0x2045a8){return new BPromise(function(_0x59dac5,_0x48f480){return client[_0x1bfe('0xe')](_0xe50b5c,_0x2045a8)['then'](function(_0x2a2534){logger[_0x1bfe('0xf')](_0x1bfe('0x10'),_0x5c3b05,_0x1bfe('0x11'));logger['debug'](_0x1bfe('0x12'),_0x5c3b05,_0x1bfe('0x11'),JSON[_0x1bfe('0x13')](_0x2a2534));if(_0x2a2534['error']){if(_0x2a2534[_0x1bfe('0x14')][_0x1bfe('0x15')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x5c3b05,_0x2a2534['error'][_0x1bfe('0x16')]);return _0x48f480(_0x2a2534[_0x1bfe('0x14')][_0x1bfe('0x16')]);}logger[_0x1bfe('0x14')](_0x1bfe('0x10'),_0x5c3b05,_0x2a2534[_0x1bfe('0x14')][_0x1bfe('0x16')]);return _0x59dac5(_0x2a2534[_0x1bfe('0x14')][_0x1bfe('0x16')]);}else{logger['info'](_0x1bfe('0x10'),_0x5c3b05,_0x1bfe('0x11'));_0x59dac5(_0x2a2534[_0x1bfe('0x17')][_0x1bfe('0x16')]);}})[_0x1bfe('0x18')](function(_0xd9f6d2){logger['error'](_0x1bfe('0x10'),_0x5c3b05,_0xd9f6d2);_0x48f480(_0xd9f6d2);});});}exports['ShowWhatsappAccount']=function(_0x295fa0){var _0x5cd556=this;return new Promise(function(_0x5313a8,_0x2103e0){return db[_0x1bfe('0x19')]['find']({'raw':_0x295fa0[_0x1bfe('0x1a')]?_0x295fa0[_0x1bfe('0x1a')][_0x1bfe('0x1b')]===undefined?!![]:![]:!![],'where':_0x295fa0[_0x1bfe('0x1a')]?_0x295fa0['options']['where']||null:null,'attributes':_0x295fa0[_0x1bfe('0x1a')]?_0x295fa0[_0x1bfe('0x1a')]['attributes']||null:null,'include':_0x295fa0[_0x1bfe('0x1a')]?_0x295fa0['options'][_0x1bfe('0x1c')]?_[_0x1bfe('0x1d')](_0x295fa0[_0x1bfe('0x1a')][_0x1bfe('0x1c')],function(_0x201a7a){return{'model':db[_0x201a7a[_0x1bfe('0x1e')]],'as':_0x201a7a['as'],'attributes':_0x201a7a['attributes'],'include':_0x201a7a[_0x1bfe('0x1c')]?_[_0x1bfe('0x1d')](_0x201a7a[_0x1bfe('0x1c')],function(_0x58ce15){return{'model':db[_0x58ce15['model']],'as':_0x58ce15['as'],'attributes':_0x58ce15[_0x1bfe('0x1f')],'include':_0x58ce15[_0x1bfe('0x1c')]?_[_0x1bfe('0x1d')](_0x58ce15[_0x1bfe('0x1c')],function(_0x4bfe3c){return{'model':db[_0x4bfe3c[_0x1bfe('0x1e')]],'as':_0x4bfe3c['as'],'attributes':_0x4bfe3c[_0x1bfe('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x1bfe('0x20')](function(_0x4571ec){logger[_0x1bfe('0xf')](_0x1bfe('0x21'),_0x295fa0);logger[_0x1bfe('0x22')]('ShowWhatsappAccount',_0x295fa0,JSON['stringify'](_0x4571ec));_0x5313a8(_0x4571ec);})[_0x1bfe('0x18')](function(_0x40bbb5){logger[_0x1bfe('0x14')]('ShowWhatsappAccount',_0x40bbb5['message'],_0x295fa0);_0x2103e0(_0x5cd556[_0x1bfe('0x14')](0x1f4,_0x40bbb5[_0x1bfe('0x16')]));});});}; \ No newline at end of file +var _0x1c45=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ShowWhatsappAccount','find','options','raw','attributes','include','map','model','catch'];(function(_0x301b04,_0x584382){var _0x2f5043=function(_0x415474){while(--_0x415474){_0x301b04['push'](_0x301b04['shift']());}};_0x2f5043(++_0x584382);}(_0x1c45,0x1b0));var _0x51c4=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x1c45[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x51c4('0x0'));var util=require(_0x51c4('0x1'));var moment=require(_0x51c4('0x2'));var BPromise=require(_0x51c4('0x3'));var rs=require(_0x51c4('0x4'));var fs=require('fs');var Redis=require(_0x51c4('0x5'));var db=require(_0x51c4('0x6'))['db'];var utils=require(_0x51c4('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x51c4('0x8'));var jayson=require(_0x51c4('0x9'));var client=jayson[_0x51c4('0xa')][_0x51c4('0xb')]({'port':0x232a});config[_0x51c4('0xc')]=_[_0x51c4('0xd')](config[_0x51c4('0xc')],{'host':_0x51c4('0xe'),'port':0x18eb});var socket=require(_0x51c4('0xf'))(new Redis(config['redis']));require('./whatsappAccount.socket')[_0x51c4('0x10')](socket);function respondWithRpcPromise(_0x3f0716,_0x42e523,_0xab88cb){return new BPromise(function(_0x109781,_0x1882e7){return client['request'](_0x3f0716,_0xab88cb)[_0x51c4('0x11')](function(_0xb3ac98){logger[_0x51c4('0x12')](_0x51c4('0x13'),_0x42e523,_0x51c4('0x14'));logger[_0x51c4('0x15')](_0x51c4('0x16'),_0x42e523,_0x51c4('0x14'),JSON[_0x51c4('0x17')](_0xb3ac98));if(_0xb3ac98[_0x51c4('0x18')]){if(_0xb3ac98[_0x51c4('0x18')][_0x51c4('0x19')]===0x1f4){logger[_0x51c4('0x18')]('WhatsappAccount,\x20%s,\x20%s',_0x42e523,_0xb3ac98[_0x51c4('0x18')][_0x51c4('0x1a')]);return _0x1882e7(_0xb3ac98['error'][_0x51c4('0x1a')]);}logger[_0x51c4('0x18')](_0x51c4('0x13'),_0x42e523,_0xb3ac98[_0x51c4('0x18')][_0x51c4('0x1a')]);return _0x109781(_0xb3ac98[_0x51c4('0x18')][_0x51c4('0x1a')]);}else{logger['info'](_0x51c4('0x13'),_0x42e523,_0x51c4('0x14'));_0x109781(_0xb3ac98['result'][_0x51c4('0x1a')]);}})['catch'](function(_0x2b3e0b){logger[_0x51c4('0x18')](_0x51c4('0x13'),_0x42e523,_0x2b3e0b);_0x1882e7(_0x2b3e0b);});});}exports[_0x51c4('0x1b')]=function(_0x535690){var _0x3a67ed=this;return new Promise(function(_0x3842d8,_0x47878a){return db['WhatsappAccount'][_0x51c4('0x1c')]({'raw':_0x535690[_0x51c4('0x1d')]?_0x535690[_0x51c4('0x1d')][_0x51c4('0x1e')]===undefined?!![]:![]:!![],'where':_0x535690[_0x51c4('0x1d')]?_0x535690[_0x51c4('0x1d')]['where']||null:null,'attributes':_0x535690[_0x51c4('0x1d')]?_0x535690[_0x51c4('0x1d')][_0x51c4('0x1f')]||null:null,'include':_0x535690[_0x51c4('0x1d')]?_0x535690[_0x51c4('0x1d')][_0x51c4('0x20')]?_[_0x51c4('0x21')](_0x535690[_0x51c4('0x1d')][_0x51c4('0x20')],function(_0x15154f){return{'model':db[_0x15154f[_0x51c4('0x22')]],'as':_0x15154f['as'],'attributes':_0x15154f['attributes'],'include':_0x15154f[_0x51c4('0x20')]?_[_0x51c4('0x21')](_0x15154f[_0x51c4('0x20')],function(_0x29a148){return{'model':db[_0x29a148[_0x51c4('0x22')]],'as':_0x29a148['as'],'attributes':_0x29a148[_0x51c4('0x1f')],'include':_0x29a148[_0x51c4('0x20')]?_[_0x51c4('0x21')](_0x29a148[_0x51c4('0x20')],function(_0x3a01f2){return{'model':db[_0x3a01f2[_0x51c4('0x22')]],'as':_0x3a01f2['as'],'attributes':_0x3a01f2[_0x51c4('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x51c4('0x11')](function(_0x1cf544){logger[_0x51c4('0x12')]('ShowWhatsappAccount',_0x535690);logger[_0x51c4('0x15')](_0x51c4('0x1b'),_0x535690,JSON['stringify'](_0x1cf544));_0x3842d8(_0x1cf544);})[_0x51c4('0x23')](function(_0x2974a3){logger[_0x51c4('0x18')](_0x51c4('0x1b'),_0x2974a3[_0x51c4('0x1a')],_0x535690);_0x47878a(_0x3a67ed['error'](0x1f4,_0x2974a3[_0x51c4('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index e03c06c..0b75bdb 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 _0x2e82=['whatsappAccount:','./whatsappAccount.events','update','emit','removeListener','register','length'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0x2e82,0x7f));var _0x22e8=function(_0x4d5581,_0x342e11){_0x4d5581=_0x4d5581-0x0;var _0x2e021c=_0x2e82[_0x4d5581];return _0x2e021c;};'use strict';var WhatsappAccountEvents=require(_0x22e8('0x0'));var events=['save','remove',_0x22e8('0x1')];function createListener(_0x134373,_0x2efa5c){return function(_0xb6de47){_0x2efa5c[_0x22e8('0x2')](_0x134373,_0xb6de47);};}function removeListener(_0x3b0305,_0x579a60){return function(){WhatsappAccountEvents[_0x22e8('0x3')](_0x3b0305,_0x579a60);};}exports[_0x22e8('0x4')]=function(_0x1ad1d7){for(var _0x2a10a5=0x0,_0x1bd02e=events[_0x22e8('0x5')];_0x2a10a5<_0x1bd02e;_0x2a10a5++){var _0x17fd39=events[_0x2a10a5];var _0x10e2cf=createListener(_0x22e8('0x6')+_0x17fd39,_0x1ad1d7);WhatsappAccountEvents['on'](_0x17fd39,_0x10e2cf);}}; \ No newline at end of file +var _0xa632=['remove','update','emit','register','whatsappAccount:','./whatsappAccount.events'];(function(_0x32bfe1,_0x155613){var _0x5b8556=function(_0xdd83ee){while(--_0xdd83ee){_0x32bfe1['push'](_0x32bfe1['shift']());}};_0x5b8556(++_0x155613);}(_0xa632,0xb3));var _0x2a63=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa632[_0x481bf7];return _0x461787;};'use strict';var WhatsappAccountEvents=require(_0x2a63('0x0'));var events=['save',_0x2a63('0x1'),_0x2a63('0x2')];function createListener(_0x1bfdda,_0x56b59e){return function(_0x45c872){_0x56b59e[_0x2a63('0x3')](_0x1bfdda,_0x45c872);};}function removeListener(_0x1ec7fa,_0x3c300e){return function(){WhatsappAccountEvents['removeListener'](_0x1ec7fa,_0x3c300e);};}exports[_0x2a63('0x4')]=function(_0x5ef8c2){for(var _0x247d7f=0x0,_0x5ef626=events['length'];_0x247d7f<_0x5ef626;_0x247d7f++){var _0x9124e5=events[_0x247d7f];var _0x428424=createListener(_0x2a63('0x5')+_0x9124e5,_0x5ef8c2);WhatsappAccountEvents['on'](_0x9124e5,_0x428424);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index c7a19e4..f926766 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 _0x102d=['./whatsappApplication.controller','get','index','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x5bf4ed,_0xb54e4f){var _0x14e79b=function(_0x4efef8){while(--_0x4efef8){_0x5bf4ed['push'](_0x5bf4ed['shift']());}};_0x14e79b(++_0xb54e4f);}(_0x102d,0x108));var _0xd102=function(_0x3d7bd2,_0x52d31b){_0x3d7bd2=_0x3d7bd2-0x0;var _0x6e368a=_0x102d[_0x3d7bd2];return _0x6e368a;};'use strict';var multer=require(_0xd102('0x0'));var util=require('util');var path=require(_0xd102('0x1'));var timeout=require(_0xd102('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd102('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xd102('0x4'));var config=require(_0xd102('0x5'));var controller=require(_0xd102('0x6'));router[_0xd102('0x7')]('/',auth['isAuthenticated'](),controller[_0xd102('0x8')]);router[_0xd102('0x7')](_0xd102('0x9'),auth[_0xd102('0xa')](),controller[_0xd102('0xb')]);router[_0xd102('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd102('0xd')](_0xd102('0x9'),auth[_0xd102('0xa')](),controller[_0xd102('0xe')]);router[_0xd102('0xf')](_0xd102('0x9'),auth[_0xd102('0xa')](),controller[_0xd102('0x10')]);module[_0xd102('0x11')]=router; \ No newline at end of file +var _0xd32a=['delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','show','post','put','/:id','update'];(function(_0x38f137,_0x56e82b){var _0x564380=function(_0x3768ae){while(--_0x3768ae){_0x38f137['push'](_0x38f137['shift']());}};_0x564380(++_0x56e82b);}(_0xd32a,0x157));var _0xad32=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xd32a[_0x25e7cb];return _0x375d92;};'use strict';var multer=require(_0xad32('0x0'));var util=require(_0xad32('0x1'));var path=require(_0xad32('0x2'));var timeout=require(_0xad32('0x3'));var express=require(_0xad32('0x4'));var router=express['Router']();var fs_extra=require(_0xad32('0x5'));var auth=require(_0xad32('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xad32('0x7'));var controller=require(_0xad32('0x8'));router[_0xad32('0x9')]('/',auth[_0xad32('0xa')](),controller[_0xad32('0xb')]);router[_0xad32('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xad32('0xc')]);router[_0xad32('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xad32('0xe')](_0xad32('0xf'),auth[_0xad32('0xa')](),controller[_0xad32('0x10')]);router[_0xad32('0x11')](_0xad32('0xf'),auth[_0xad32('0xa')](),controller[_0xad32('0x12')]);module[_0xad32('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 13fdae7..92f5c4c 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 _0x1a17=['exports','INTEGER','STRING','noop','TEXT','sequelize'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x1a17,0x185));var _0x71a1=function(_0x2f2a81,_0x1cdfbe){_0x2f2a81=_0x2f2a81-0x0;var _0xecefe8=_0x1a17[_0x2f2a81];return _0xecefe8;};'use strict';var Sequelize=require(_0x71a1('0x0'));module[_0x71a1('0x1')]={'priority':{'type':Sequelize[_0x71a1('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x71a1('0x3')],'allowNull':![],'defaultValue':_0x71a1('0x4')},'appdata':{'type':Sequelize[_0x71a1('0x5')]()},'description':{'type':Sequelize[_0x71a1('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x4ff9=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x2242a5,_0x3604cf){var _0x422ac8=function(_0xf455df){while(--_0xf455df){_0x2242a5['push'](_0x2242a5['shift']());}};_0x422ac8(++_0x3604cf);}(_0x4ff9,0x1d7));var _0x94ff=function(_0x1de5f6,_0x249cae){_0x1de5f6=_0x1de5f6-0x0;var _0x3aa6f2=_0x4ff9[_0x1de5f6];return _0x3aa6f2;};'use strict';var Sequelize=require(_0x94ff('0x0'));module[_0x94ff('0x1')]={'priority':{'type':Sequelize[_0x94ff('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x94ff('0x3')],'allowNull':![],'defaultValue':_0x94ff('0x4')},'appdata':{'type':Sequelize[_0x94ff('0x5')]()},'description':{'type':Sequelize[_0x94ff('0x3')]},'interval':{'type':Sequelize[_0x94ff('0x3')],'defaultValue':_0x94ff('0x6')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index fe8ef71..1572047 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 _0x0af5=['ejs','squel','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','WhatsappApplication','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','rows','catch','show','length','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x1ab9ce,_0x5c5755){var _0x192313=function(_0x3b6cda){while(--_0x3b6cda){_0x1ab9ce['push'](_0x1ab9ce['shift']());}};_0x192313(++_0x5c5755);}(_0x0af5,0x158));var _0x50af=function(_0x16caa7,_0x10cb7e){_0x16caa7=_0x16caa7-0x0;var _0x4772f1=_0x0af5[_0x16caa7];return _0x4772f1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x50af('0x0'));var zipdir=require(_0x50af('0x1'));var jsonpatch=require(_0x50af('0x2'));var rp=require(_0x50af('0x3'));var moment=require(_0x50af('0x4'));var BPromise=require(_0x50af('0x5'));var Mustache=require(_0x50af('0x6'));var util=require(_0x50af('0x7'));var path=require(_0x50af('0x8'));var sox=require(_0x50af('0x9'));var csv=require(_0x50af('0xa'));var ejs=require(_0x50af('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x50af('0xc'));var crypto=require(_0x50af('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x50af('0xa'));var querystring=require(_0x50af('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x50af('0xf'));var qs=require(_0x50af('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x50af('0x11'));var logger=require(_0x50af('0x12'))(_0x50af('0x13'));var utils=require(_0x50af('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x50af('0x15'));var db=require(_0x50af('0x16'))['db'];function respondWithStatusCode(_0x2792bb,_0x3373bf){_0x3373bf=_0x3373bf||0xcc;return function(_0x252a02){if(_0x252a02){return _0x2792bb[_0x50af('0x17')](_0x3373bf);}return _0x2792bb['status'](_0x3373bf)['end']();};}function respondWithResult(_0x569851,_0x620389){_0x620389=_0x620389||0xc8;return function(_0x561cd2){if(_0x561cd2){return _0x569851[_0x50af('0x18')](_0x620389)[_0x50af('0x19')](_0x561cd2);}};}function respondWithFilteredResult(_0x4fba1c,_0x5c3db3){return function(_0x1378fd){if(_0x1378fd){var _0x13cbf4=typeof _0x5c3db3['offset']==='undefined'&&typeof _0x5c3db3[_0x50af('0x1a')]===_0x50af('0x1b');var _0x33869f=_0x1378fd[_0x50af('0x1c')];var _0x1906e6=_0x13cbf4?0x0:_0x5c3db3[_0x50af('0x1d')];var _0x23bad2=_0x13cbf4?_0x1378fd[_0x50af('0x1c')]:_0x5c3db3[_0x50af('0x1d')]+_0x5c3db3[_0x50af('0x1a')];var _0x5c6f8e;if(_0x23bad2>=_0x33869f){_0x23bad2=_0x33869f;_0x5c6f8e=0xc8;}else{_0x5c6f8e=0xce;}_0x4fba1c[_0x50af('0x18')](_0x5c6f8e);return _0x4fba1c[_0x50af('0x1e')](_0x50af('0x1f'),_0x1906e6+'-'+_0x23bad2+'/'+_0x33869f)[_0x50af('0x19')](_0x1378fd);}return null;};}function patchUpdates(_0x4b0164){return function(_0x2a96fb){try{jsonpatch[_0x50af('0x20')](_0x2a96fb,_0x4b0164,!![]);}catch(_0x4b5e21){return BPromise[_0x50af('0x21')](_0x4b5e21);}return _0x2a96fb[_0x50af('0x22')]();};}function saveUpdates(_0x3b6d04,_0x2d093c){return function(_0xb6de0d){if(_0xb6de0d){return _0xb6de0d[_0x50af('0x23')](_0x3b6d04)[_0x50af('0x24')](function(_0x53e362){return _0x53e362;});}return null;};}function removeEntity(_0x76a6b3,_0x156154){return function(_0x3c6388){if(_0x3c6388){return _0x3c6388[_0x50af('0x25')]()[_0x50af('0x24')](function(){_0x76a6b3[_0x50af('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb3c15a,_0x1550ee){return function(_0x5e096d){if(!_0x5e096d){_0xb3c15a[_0x50af('0x17')](0x194);}return _0x5e096d;};}function handleError(_0x3fa2da,_0x311b08){_0x311b08=_0x311b08||0x1f4;return function(_0x5dc58a){logger['error'](_0x5dc58a[_0x50af('0x26')]);if(_0x5dc58a[_0x50af('0x27')]){delete _0x5dc58a[_0x50af('0x27')];}_0x3fa2da[_0x50af('0x18')](_0x311b08)[_0x50af('0x28')](_0x5dc58a);};}exports[_0x50af('0x29')]=function(_0x520bd6,_0x212fc2){var _0x5122e5={},_0x1a1104={},_0x382c5d={'count':0x0,'rows':[]};var _0x4118af=_['map'](db[_0x50af('0x2a')]['rawAttributes'],function(_0xadca5b){return{'name':_0xadca5b['fieldName'],'type':_0xadca5b['type']['key']};});_0x1a1104[_0x50af('0x2b')]=_[_0x50af('0x2c')](_0x4118af,_0x50af('0x27'));_0x1a1104[_0x50af('0x2d')]=_[_0x50af('0x2e')](_0x520bd6[_0x50af('0x2d')]);_0x1a1104[_0x50af('0x2f')]=_[_0x50af('0x30')](_0x1a1104[_0x50af('0x2b')],_0x1a1104[_0x50af('0x2d')]);_0x5122e5['attributes']=_[_0x50af('0x30')](_0x1a1104[_0x50af('0x2b')],qs[_0x50af('0x31')](_0x520bd6[_0x50af('0x2d')][_0x50af('0x31')]));_0x5122e5['attributes']=_0x5122e5[_0x50af('0x32')]['length']?_0x5122e5['attributes']:_0x1a1104['model'];if(!_0x520bd6[_0x50af('0x2d')][_0x50af('0x33')](_0x50af('0x34'))){_0x5122e5[_0x50af('0x1a')]=qs[_0x50af('0x1a')](_0x520bd6['query']['limit']);_0x5122e5[_0x50af('0x1d')]=qs[_0x50af('0x1d')](_0x520bd6[_0x50af('0x2d')][_0x50af('0x1d')]);}_0x5122e5[_0x50af('0x35')]=qs['sort'](_0x520bd6[_0x50af('0x2d')][_0x50af('0x36')]);_0x5122e5[_0x50af('0x37')]=qs[_0x50af('0x2f')](_['pick'](_0x520bd6[_0x50af('0x2d')],_0x1a1104[_0x50af('0x2f')]),_0x4118af);if(_0x520bd6[_0x50af('0x2d')][_0x50af('0x38')]){_0x5122e5[_0x50af('0x37')]=_['merge'](_0x5122e5['where'],{'$or':_['map'](_0x4118af,function(_0x198ec5){if(_0x198ec5[_0x50af('0x39')]!==_0x50af('0x3a')){var _0x194539={};_0x194539[_0x198ec5[_0x50af('0x27')]]={'$like':'%'+_0x520bd6[_0x50af('0x2d')][_0x50af('0x38')]+'%'};return _0x194539;}})});}_0x5122e5=_[_0x50af('0x3b')]({},_0x5122e5,_0x520bd6[_0x50af('0x3c')]);var _0x2d2a3f={'where':_0x5122e5[_0x50af('0x37')]};return db[_0x50af('0x2a')][_0x50af('0x1c')](_0x2d2a3f)[_0x50af('0x24')](function(_0xb96d73){_0x382c5d[_0x50af('0x1c')]=_0xb96d73;if(_0x520bd6['query'][_0x50af('0x3d')]){_0x5122e5[_0x50af('0x3e')]=[{'all':!![]}];}return db[_0x50af('0x2a')]['findAll'](_0x5122e5);})['then'](function(_0x208c88){_0x382c5d[_0x50af('0x3f')]=_0x208c88;return _0x382c5d;})[_0x50af('0x24')](respondWithFilteredResult(_0x212fc2,_0x5122e5))[_0x50af('0x40')](handleError(_0x212fc2,null));};exports[_0x50af('0x41')]=function(_0x2917b7,_0x37bdfc){var _0x3f74bb={'raw':!![],'where':{'id':_0x2917b7['params']['id']}},_0x533d35={};_0x533d35[_0x50af('0x2b')]=_[_0x50af('0x2e')](db['WhatsappApplication']['rawAttributes']);_0x533d35[_0x50af('0x2d')]=_[_0x50af('0x2e')](_0x2917b7[_0x50af('0x2d')]);_0x533d35['filters']=_[_0x50af('0x30')](_0x533d35[_0x50af('0x2b')],_0x533d35[_0x50af('0x2d')]);_0x3f74bb[_0x50af('0x32')]=_[_0x50af('0x30')](_0x533d35[_0x50af('0x2b')],qs[_0x50af('0x31')](_0x2917b7[_0x50af('0x2d')][_0x50af('0x31')]));_0x3f74bb['attributes']=_0x3f74bb[_0x50af('0x32')][_0x50af('0x42')]?_0x3f74bb[_0x50af('0x32')]:_0x533d35[_0x50af('0x2b')];if(_0x2917b7['query']['includeAll']){_0x3f74bb['include']=[{'all':!![]}];}_0x3f74bb=_[_0x50af('0x3b')]({},_0x3f74bb,_0x2917b7[_0x50af('0x3c')]);return db['WhatsappApplication'][_0x50af('0x43')](_0x3f74bb)[_0x50af('0x24')](handleEntityNotFound(_0x37bdfc,null))[_0x50af('0x24')](respondWithResult(_0x37bdfc,null))[_0x50af('0x40')](handleError(_0x37bdfc,null));};exports[_0x50af('0x44')]=function(_0xb64bed,_0x59057e){return db['WhatsappApplication'][_0x50af('0x44')](_0xb64bed[_0x50af('0x45')],{})[_0x50af('0x24')](respondWithResult(_0x59057e,0xc9))[_0x50af('0x40')](handleError(_0x59057e,null));};exports[_0x50af('0x23')]=function(_0x97713f,_0x5f0834){if(_0x97713f[_0x50af('0x45')]['id']){delete _0x97713f[_0x50af('0x45')]['id'];}return db['WhatsappApplication']['find']({'where':{'id':_0x97713f[_0x50af('0x46')]['id']}})[_0x50af('0x24')](handleEntityNotFound(_0x5f0834,null))[_0x50af('0x24')](saveUpdates(_0x97713f[_0x50af('0x45')],null))[_0x50af('0x24')](respondWithResult(_0x5f0834,null))[_0x50af('0x40')](handleError(_0x5f0834,null));};exports[_0x50af('0x25')]=function(_0x1401a3,_0x173a2a){return db[_0x50af('0x2a')]['find']({'where':{'id':_0x1401a3[_0x50af('0x46')]['id']}})[_0x50af('0x24')](handleEntityNotFound(_0x173a2a,null))[_0x50af('0x24')](removeEntity(_0x173a2a,null))[_0x50af('0x40')](handleError(_0x173a2a,null));}; \ No newline at end of file +var _0x27eb=['to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','then','error','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','create','body','find','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox'];(function(_0x312686,_0x4a942d){var _0x62a376=function(_0x31f5df){while(--_0x31f5df){_0x312686['push'](_0x312686['shift']());}};_0x62a376(++_0x4a942d);}(_0x27eb,0xd0));var _0xb27e=function(_0x476f79,_0x4c61b6){_0x476f79=_0x476f79-0x0;var _0x2bc4c7=_0x27eb[_0x476f79];return _0x2bc4c7;};'use strict';var emlformat=require(_0xb27e('0x0'));var rimraf=require(_0xb27e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb27e('0x2'));var moment=require(_0xb27e('0x3'));var BPromise=require(_0xb27e('0x4'));var Mustache=require('mustache');var util=require(_0xb27e('0x5'));var path=require(_0xb27e('0x6'));var sox=require(_0xb27e('0x7'));var csv=require(_0xb27e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb27e('0x9'));var _=require(_0xb27e('0xa'));var squel=require(_0xb27e('0xb'));var crypto=require(_0xb27e('0xc'));var jsforce=require(_0xb27e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb27e('0x8'));var querystring=require(_0xb27e('0xe'));var Papa=require(_0xb27e('0xf'));var Redis=require(_0xb27e('0x10'));var authService=require(_0xb27e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb27e('0x12'));var hardwareService=require(_0xb27e('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xb27e('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xb27e('0x15'));var db=require(_0xb27e('0x16'))['db'];function respondWithStatusCode(_0x4d0b5d,_0x58b37f){_0x58b37f=_0x58b37f||0xcc;return function(_0x48c914){if(_0x48c914){return _0x4d0b5d[_0xb27e('0x17')](_0x58b37f);}return _0x4d0b5d['status'](_0x58b37f)[_0xb27e('0x18')]();};}function respondWithResult(_0x54657b,_0x1b55e2){_0x1b55e2=_0x1b55e2||0xc8;return function(_0x5aa86f){if(_0x5aa86f){return _0x54657b[_0xb27e('0x19')](_0x1b55e2)[_0xb27e('0x1a')](_0x5aa86f);}};}function respondWithFilteredResult(_0x28cc6d,_0x522bbf){return function(_0x26ec32){if(_0x26ec32){var _0x1d14bb=typeof _0x522bbf[_0xb27e('0x1b')]===_0xb27e('0x1c')&&typeof _0x522bbf[_0xb27e('0x1d')]===_0xb27e('0x1c');var _0x25ce70=_0x26ec32[_0xb27e('0x1e')];var _0x317f4e=_0x1d14bb?0x0:_0x522bbf['offset'];var _0x8be243=_0x1d14bb?_0x26ec32[_0xb27e('0x1e')]:_0x522bbf[_0xb27e('0x1b')]+_0x522bbf['limit'];var _0x352856;if(_0x8be243>=_0x25ce70){_0x8be243=_0x25ce70;_0x352856=0xc8;}else{_0x352856=0xce;}_0x28cc6d['status'](_0x352856);return _0x28cc6d['set'](_0xb27e('0x1f'),_0x317f4e+'-'+_0x8be243+'/'+_0x25ce70)[_0xb27e('0x1a')](_0x26ec32);}return null;};}function patchUpdates(_0x4ec66c){return function(_0x2a78c0){try{jsonpatch[_0xb27e('0x20')](_0x2a78c0,_0x4ec66c,!![]);}catch(_0x16c950){return BPromise[_0xb27e('0x21')](_0x16c950);}return _0x2a78c0['save']();};}function saveUpdates(_0x3c9e21,_0x5a3cdf){return function(_0x19c0f2){if(_0x19c0f2){return _0x19c0f2[_0xb27e('0x22')](_0x3c9e21)['then'](function(_0x58fc84){return _0x58fc84;});}return null;};}function removeEntity(_0x2146c0,_0xfbc258){return function(_0x3703ab){if(_0x3703ab){return _0x3703ab[_0xb27e('0x23')]()[_0xb27e('0x24')](function(){_0x2146c0['status'](0xcc)[_0xb27e('0x18')]();});}};}function handleEntityNotFound(_0x4cba0b,_0x3972bc){return function(_0x1ac460){if(!_0x1ac460){_0x4cba0b[_0xb27e('0x17')](0x194);}return _0x1ac460;};}function handleError(_0x3fbc78,_0x3254fb){_0x3254fb=_0x3254fb||0x1f4;return function(_0x4dab95){logger[_0xb27e('0x25')](_0x4dab95['stack']);if(_0x4dab95[_0xb27e('0x26')]){delete _0x4dab95[_0xb27e('0x26')];}_0x3fbc78[_0xb27e('0x19')](_0x3254fb)[_0xb27e('0x27')](_0x4dab95);};}exports[_0xb27e('0x28')]=function(_0x35169a,_0xd27061){var _0x125c0b={},_0x42c5de={},_0x4ef0e6={'count':0x0,'rows':[]};var _0x377d79=_[_0xb27e('0x29')](db[_0xb27e('0x2a')][_0xb27e('0x2b')],function(_0x58a1a9){return{'name':_0x58a1a9[_0xb27e('0x2c')],'type':_0x58a1a9[_0xb27e('0x2d')][_0xb27e('0x2e')]};});_0x42c5de[_0xb27e('0x2f')]=_[_0xb27e('0x29')](_0x377d79,_0xb27e('0x26'));_0x42c5de[_0xb27e('0x30')]=_['keys'](_0x35169a['query']);_0x42c5de[_0xb27e('0x31')]=_['intersection'](_0x42c5de[_0xb27e('0x2f')],_0x42c5de['query']);_0x125c0b[_0xb27e('0x32')]=_[_0xb27e('0x33')](_0x42c5de[_0xb27e('0x2f')],qs[_0xb27e('0x34')](_0x35169a[_0xb27e('0x30')][_0xb27e('0x34')]));_0x125c0b['attributes']=_0x125c0b[_0xb27e('0x32')]['length']?_0x125c0b[_0xb27e('0x32')]:_0x42c5de['model'];if(!_0x35169a[_0xb27e('0x30')]['hasOwnProperty'](_0xb27e('0x35'))){_0x125c0b[_0xb27e('0x1d')]=qs['limit'](_0x35169a['query'][_0xb27e('0x1d')]);_0x125c0b['offset']=qs['offset'](_0x35169a['query'][_0xb27e('0x1b')]);}_0x125c0b[_0xb27e('0x36')]=qs['sort'](_0x35169a[_0xb27e('0x30')][_0xb27e('0x37')]);_0x125c0b['where']=qs['filters'](_[_0xb27e('0x38')](_0x35169a['query'],_0x42c5de[_0xb27e('0x31')]),_0x377d79);if(_0x35169a['query'][_0xb27e('0x39')]){_0x125c0b[_0xb27e('0x3a')]=_[_0xb27e('0x3b')](_0x125c0b[_0xb27e('0x3a')],{'$or':_[_0xb27e('0x29')](_0x377d79,function(_0x1239d4){if(_0x1239d4[_0xb27e('0x2d')]!==_0xb27e('0x3c')){var _0x533343={};_0x533343[_0x1239d4[_0xb27e('0x26')]]={'$like':'%'+_0x35169a[_0xb27e('0x30')][_0xb27e('0x39')]+'%'};return _0x533343;}})});}_0x125c0b=_[_0xb27e('0x3b')]({},_0x125c0b,_0x35169a[_0xb27e('0x3d')]);var _0x564699={'where':_0x125c0b['where']};return db[_0xb27e('0x2a')][_0xb27e('0x1e')](_0x564699)[_0xb27e('0x24')](function(_0x5c7742){_0x4ef0e6[_0xb27e('0x1e')]=_0x5c7742;if(_0x35169a[_0xb27e('0x30')][_0xb27e('0x3e')]){_0x125c0b[_0xb27e('0x3f')]=[{'all':!![]}];}return db[_0xb27e('0x2a')][_0xb27e('0x40')](_0x125c0b);})[_0xb27e('0x24')](function(_0x4d90bf){_0x4ef0e6['rows']=_0x4d90bf;return _0x4ef0e6;})[_0xb27e('0x24')](respondWithFilteredResult(_0xd27061,_0x125c0b))[_0xb27e('0x41')](handleError(_0xd27061,null));};exports[_0xb27e('0x42')]=function(_0x3272ba,_0x11fafd){var _0x42f5e3={'raw':!![],'where':{'id':_0x3272ba[_0xb27e('0x43')]['id']}},_0x2959f5={};_0x2959f5['model']=_[_0xb27e('0x44')](db[_0xb27e('0x2a')][_0xb27e('0x2b')]);_0x2959f5[_0xb27e('0x30')]=_['keys'](_0x3272ba[_0xb27e('0x30')]);_0x2959f5['filters']=_['intersection'](_0x2959f5[_0xb27e('0x2f')],_0x2959f5[_0xb27e('0x30')]);_0x42f5e3['attributes']=_[_0xb27e('0x33')](_0x2959f5[_0xb27e('0x2f')],qs[_0xb27e('0x34')](_0x3272ba[_0xb27e('0x30')][_0xb27e('0x34')]));_0x42f5e3[_0xb27e('0x32')]=_0x42f5e3[_0xb27e('0x32')]['length']?_0x42f5e3[_0xb27e('0x32')]:_0x2959f5['model'];if(_0x3272ba[_0xb27e('0x30')][_0xb27e('0x3e')]){_0x42f5e3[_0xb27e('0x3f')]=[{'all':!![]}];}_0x42f5e3=_[_0xb27e('0x3b')]({},_0x42f5e3,_0x3272ba[_0xb27e('0x3d')]);return db[_0xb27e('0x2a')]['find'](_0x42f5e3)['then'](handleEntityNotFound(_0x11fafd,null))[_0xb27e('0x24')](respondWithResult(_0x11fafd,null))[_0xb27e('0x41')](handleError(_0x11fafd,null));};exports[_0xb27e('0x45')]=function(_0x15b5cb,_0x238bb9){return db['WhatsappApplication'][_0xb27e('0x45')](_0x15b5cb[_0xb27e('0x46')],{})[_0xb27e('0x24')](respondWithResult(_0x238bb9,0xc9))[_0xb27e('0x41')](handleError(_0x238bb9,null));};exports[_0xb27e('0x22')]=function(_0x16a71b,_0x320b9c){if(_0x16a71b[_0xb27e('0x46')]['id']){delete _0x16a71b[_0xb27e('0x46')]['id'];}return db[_0xb27e('0x2a')][_0xb27e('0x47')]({'where':{'id':_0x16a71b['params']['id']}})[_0xb27e('0x24')](handleEntityNotFound(_0x320b9c,null))['then'](saveUpdates(_0x16a71b[_0xb27e('0x46')],null))[_0xb27e('0x24')](respondWithResult(_0x320b9c,null))[_0xb27e('0x41')](handleError(_0x320b9c,null));};exports[_0xb27e('0x23')]=function(_0x91095,_0x1af27d){return db[_0xb27e('0x2a')][_0xb27e('0x47')]({'where':{'id':_0x91095['params']['id']}})['then'](handleEntityNotFound(_0x1af27d,null))[_0xb27e('0x24')](removeEntity(_0x1af27d,null))[_0xb27e('0x41')](handleError(_0x1af27d,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index f653202..bb0dbcd 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 _0x20ce=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x80ab9e,_0x32c636){var _0x7605e6=function(_0x207f0d){while(--_0x207f0d){_0x80ab9e['push'](_0x80ab9e['shift']());}};_0x7605e6(++_0x32c636);}(_0x20ce,0x10d));var _0xe20c=function(_0x499726,_0x42f4c4){_0x499726=_0x499726-0x0;var _0x7093f7=_0x20ce[_0x499726];return _0x7093f7;};'use strict';var _=require(_0xe20c('0x0'));var util=require(_0xe20c('0x1'));var logger=require(_0xe20c('0x2'))('api');var moment=require(_0xe20c('0x3'));var BPromise=require(_0xe20c('0x4'));var rp=require(_0xe20c('0x5'));var fs=require('fs');var path=require(_0xe20c('0x6'));var rimraf=require(_0xe20c('0x7'));var config=require(_0xe20c('0x8'));var attributes=require(_0xe20c('0x9'));module[_0xe20c('0xa')]=function(_0x373f9f,_0x2c9e6a){return _0x373f9f[_0xe20c('0xb')](_0xe20c('0xc'),attributes,{'tableName':_0xe20c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe20c('0xe'),'collate':_0xe20c('0xf')});}; \ No newline at end of file +var _0xe5d5=['exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment','request-promise','rimraf','../../config/environment','./whatsappApplication.attributes'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xe5d5,0x156));var _0x5e5d=function(_0xb5883,_0x3069f4){_0xb5883=_0xb5883-0x0;var _0x45c919=_0xe5d5[_0xb5883];return _0x45c919;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5e5d('0x0'))('api');var moment=require(_0x5e5d('0x1'));var BPromise=require('bluebird');var rp=require(_0x5e5d('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5e5d('0x3'));var config=require(_0x5e5d('0x4'));var attributes=require(_0x5e5d('0x5'));module[_0x5e5d('0x6')]=function(_0x13bcb7,_0x39077f){return _0x13bcb7[_0x5e5d('0x7')](_0x5e5d('0x8'),attributes,{'tableName':_0x5e5d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5e5d('0xa'),'collate':_0x5e5d('0xb')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 33377d9..b7df321 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 _0xbec5=['info','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappApplication,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x45cd59,_0x5be7c0){var _0x39541a=function(_0xab724a){while(--_0xab724a){_0x45cd59['push'](_0x45cd59['shift']());}};_0x39541a(++_0x5be7c0);}(_0xbec5,0xe5));var _0x5bec=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0xbec5[_0x1589dd];return _0x1bddd1;};'use strict';var _=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var moment=require('moment');var BPromise=require(_0x5bec('0x2'));var rs=require(_0x5bec('0x3'));var fs=require('fs');var Redis=require(_0x5bec('0x4'));var db=require(_0x5bec('0x5'))['db'];var utils=require(_0x5bec('0x6'));var logger=require('../../config/logger')(_0x5bec('0x7'));var config=require(_0x5bec('0x8'));var jayson=require(_0x5bec('0x9'));var client=jayson['client'][_0x5bec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28a427,_0x38456e,_0x406e65){return new BPromise(function(_0x43d96e,_0x302aae){return client[_0x5bec('0xb')](_0x28a427,_0x406e65)[_0x5bec('0xc')](function(_0x4d0d29){logger[_0x5bec('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x38456e,_0x5bec('0xe'));logger[_0x5bec('0xf')](_0x5bec('0x10'),_0x38456e,'request\x20sent',JSON[_0x5bec('0x11')](_0x4d0d29));if(_0x4d0d29[_0x5bec('0x12')]){if(_0x4d0d29[_0x5bec('0x12')]['code']===0x1f4){logger[_0x5bec('0x12')](_0x5bec('0x13'),_0x38456e,_0x4d0d29['error'][_0x5bec('0x14')]);return _0x302aae(_0x4d0d29[_0x5bec('0x12')][_0x5bec('0x14')]);}logger[_0x5bec('0x12')](_0x5bec('0x13'),_0x38456e,_0x4d0d29[_0x5bec('0x12')][_0x5bec('0x14')]);return _0x43d96e(_0x4d0d29[_0x5bec('0x12')][_0x5bec('0x14')]);}else{logger[_0x5bec('0xd')](_0x5bec('0x13'),_0x38456e,_0x5bec('0xe'));_0x43d96e(_0x4d0d29[_0x5bec('0x15')]['message']);}})['catch'](function(_0x15af9b){logger[_0x5bec('0x12')](_0x5bec('0x13'),_0x38456e,_0x15af9b);_0x302aae(_0x15af9b);});});} \ No newline at end of file +var _0x98a8=['request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4488ac,_0x2e1b0c){var _0xdef698=function(_0x3c83c9){while(--_0x3c83c9){_0x4488ac['push'](_0x4488ac['shift']());}};_0xdef698(++_0x2e1b0c);}(_0x98a8,0x12c));var _0x898a=function(_0x2057aa,_0x523872){_0x2057aa=_0x2057aa-0x0;var _0x255f6d=_0x98a8[_0x2057aa];return _0x255f6d;};'use strict';var _=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var moment=require(_0x898a('0x2'));var BPromise=require(_0x898a('0x3'));var rs=require(_0x898a('0x4'));var fs=require('fs');var Redis=require(_0x898a('0x5'));var db=require(_0x898a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x898a('0x7'))(_0x898a('0x8'));var config=require(_0x898a('0x9'));var jayson=require(_0x898a('0xa'));var client=jayson[_0x898a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3aadc2,_0x564583,_0xfa8c50){return new BPromise(function(_0x4fbce5,_0x42021d){return client[_0x898a('0xc')](_0x3aadc2,_0xfa8c50)[_0x898a('0xd')](function(_0x96b636){logger[_0x898a('0xe')](_0x898a('0xf'),_0x564583,_0x898a('0x10'));logger[_0x898a('0x11')](_0x898a('0x12'),_0x564583,'request\x20sent',JSON[_0x898a('0x13')](_0x96b636));if(_0x96b636['error']){if(_0x96b636[_0x898a('0x14')]['code']===0x1f4){logger[_0x898a('0x14')](_0x898a('0xf'),_0x564583,_0x96b636[_0x898a('0x14')]['message']);return _0x42021d(_0x96b636['error']['message']);}logger[_0x898a('0x14')](_0x898a('0xf'),_0x564583,_0x96b636[_0x898a('0x14')][_0x898a('0x15')]);return _0x4fbce5(_0x96b636[_0x898a('0x14')][_0x898a('0x15')]);}else{logger['info'](_0x898a('0xf'),_0x564583,'request\x20sent');_0x4fbce5(_0x96b636[_0x898a('0x16')]['message']);}})[_0x898a('0x17')](function(_0x4fb05b){logger[_0x898a('0x14')]('WhatsappApplication,\x20%s,\x20%s',_0x564583,_0x4fb05b);_0x42021d(_0x4fb05b);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index f7123a1..4c7c695 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 _0xbff5=['addTags','put','tracked','whatsapp','update','delete','whatsappinteraction:destroy','destroy','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','post','addMessage','/:id/tags','whatsappinteraction:addtags'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbff5,0x1bc));var _0x5bff=function(_0x580fbd,_0x33b153){_0x580fbd=_0x580fbd-0x0;var _0x34ffd7=_0xbff5[_0x580fbd];return _0x34ffd7;};'use strict';var multer=require(_0x5bff('0x0'));var util=require(_0x5bff('0x1'));var path=require(_0x5bff('0x2'));var timeout=require(_0x5bff('0x3'));var express=require(_0x5bff('0x4'));var router=express[_0x5bff('0x5')]();var fs_extra=require(_0x5bff('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5bff('0x7'));var config=require('../../config/environment');var controller=require('./whatsappInteraction.controller');router[_0x5bff('0x8')]('/',auth[_0x5bff('0x9')](),controller[_0x5bff('0xa')]);router[_0x5bff('0x8')](_0x5bff('0xb'),auth[_0x5bff('0x9')](),controller[_0x5bff('0xc')]);router[_0x5bff('0x8')](_0x5bff('0xd'),auth['isAuthenticated'](),controller[_0x5bff('0xe')]);router['get'](_0x5bff('0xf'),auth[_0x5bff('0x9')](),controller['getMessages']);router[_0x5bff('0x8')]('/:id/download',auth[_0x5bff('0x9')](),controller['download']);router[_0x5bff('0x10')]('/',auth[_0x5bff('0x9')](),controller['create']);router[_0x5bff('0x10')]('/:id/messages',auth[_0x5bff('0x9')](),controller[_0x5bff('0x11')]);router['post'](_0x5bff('0x12'),auth[_0x5bff('0x9')](),interaction['tracked']('whatsapp',_0x5bff('0x13')),controller[_0x5bff('0x14')]);router[_0x5bff('0x15')]('/:id',auth[_0x5bff('0x9')](),interaction[_0x5bff('0x16')](_0x5bff('0x17'),'whatsappinteraction:update'),controller[_0x5bff('0x18')]);router[_0x5bff('0x19')](_0x5bff('0xd'),auth['isAuthenticated'](),interaction[_0x5bff('0x16')](_0x5bff('0x17'),_0x5bff('0x1a')),controller[_0x5bff('0x1b')]);router['delete'](_0x5bff('0x12'),auth['isAuthenticated'](),controller[_0x5bff('0x1c')]);module['exports']=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(_0x7ef952,_0x43faeb){var _0x421d44=function(_0x29c936){while(--_0x29c936){_0x7ef952['push'](_0x7ef952['shift']());}};_0x421d44(++_0x43faeb);}(_0xafb9,0x68));var _0x9afb=function(_0x24a30c,_0x332d98){_0x24a30c=_0x24a30c-0x0;var _0x4b4a0e=_0xafb9[_0x24a30c];return _0x4b4a0e;};'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 2b35a01..9f70caa 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 _0x5549=['DATE','STRING','out','ENUM','sequelize','moment','exports','BOOLEAN'];(function(_0x2185a7,_0x571edd){var _0x1a66c3=function(_0x4ba478){while(--_0x4ba478){_0x2185a7['push'](_0x2185a7['shift']());}};_0x1a66c3(++_0x571edd);}(_0x5549,0x1f4));var _0x9554=function(_0x5caf2d,_0x4658a7){_0x5caf2d=_0x5caf2d-0x0;var _0x2410b4=_0x5549[_0x5caf2d];return _0x2410b4;};'use strict';var Sequelize=require(_0x9554('0x0'));var moment=require(_0x9554('0x1'));module[_0x9554('0x2')]={'closed':{'type':Sequelize[_0x9554('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9554('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x9554('0x5')]},'thirdDisposition':{'type':Sequelize[_0x9554('0x5')]},'note':{'type':Sequelize[_0x9554('0x5')]},'phone':{'type':Sequelize[_0x9554('0x5')]},'read1stAt':{'type':Sequelize[_0x9554('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x9554('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x9554('0x7')]('in',_0x9554('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x9554('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x9b6d=['ENUM','out','moment','exports','BOOLEAN','DATE','STRING'];(function(_0x564e64,_0x5d9c26){var _0x5caffb=function(_0x230899){while(--_0x230899){_0x564e64['push'](_0x564e64['shift']());}};_0x5caffb(++_0x5d9c26);}(_0x9b6d,0x105));var _0xd9b6=function(_0x2808a4,_0xb44d5){_0x2808a4=_0x2808a4-0x0;var _0x2b0cab=_0x9b6d[_0x2808a4];return _0x2b0cab;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xd9b6('0x0'));module[_0xd9b6('0x1')]={'closed':{'type':Sequelize[_0xd9b6('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd9b6('0x3')]},'disposition':{'type':Sequelize[_0xd9b6('0x4')]},'secondDisposition':{'type':Sequelize[_0xd9b6('0x4')]},'thirdDisposition':{'type':Sequelize[_0xd9b6('0x4')]},'note':{'type':Sequelize[_0xd9b6('0x4')]},'phone':{'type':Sequelize[_0xd9b6('0x4')]},'read1stAt':{'type':Sequelize[_0xd9b6('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xd9b6('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd9b6('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xd9b6('0x5')]('in',_0xd9b6('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xd9b6('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 343cb20..21e130e 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 _0x0c06=['catch','params','model','keys','WhatsappInteraction','filters','attributes','intersection','length','includeAll','merge','options','create','body','update','find','describe','addMessage','WhatsappMessage','omit','ids','getMessages','findOne','fields','hasOwnProperty','nolimit','order','sort','where','WhatsappInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','spread','Tag','color','emit','whatsappInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','User','fullname','push','Contact','firstName','lastName','createdAt','secret','read','Account','get','mkdirSync','Whatsapp','Owner','N.A.','closed','closedAt','disposition','Messages','Attachment','basename','existsSync','createReadStream','pipe','createWriteStream','direction','out','System','renderFile','downloadInteraction.ejs','transcript-','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','status','end','json','limit','undefined','count','offset','set','Content-Range','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','user'];(function(_0x44ef00,_0x113d5c){var _0x31ff71=function(_0x344a8d){while(--_0x344a8d){_0x44ef00['push'](_0x44ef00['shift']());}};_0x31ff71(++_0x113d5c);}(_0x0c06,0x158));var _0x60c0=function(_0x5b7087,_0x3de60a){_0x5b7087=_0x5b7087-0x0;var _0x45168e=_0x0c06[_0x5b7087];return _0x45168e;};'use strict';var rimraf=require(_0x60c0('0x0'));var zipdir=require(_0x60c0('0x1'));var moment=require(_0x60c0('0x2'));var BPromise=require(_0x60c0('0x3'));var util=require(_0x60c0('0x4'));var path=require(_0x60c0('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x60c0('0x6'));var Redis=require(_0x60c0('0x7'));var interaction=require(_0x60c0('0x8'));var qs=require(_0x60c0('0x9'));var pdf=require(_0x60c0('0xa'));var logger=require(_0x60c0('0xb'))('api');var config=require('../../config/environment');var db=require(_0x60c0('0xc'))['db'];config[_0x60c0('0xd')]=_['defaults'](config[_0x60c0('0xd')],{'host':_0x60c0('0xe'),'port':0x18eb});var socket=require(_0x60c0('0xf'))(new Redis(config[_0x60c0('0xd')]));require(_0x60c0('0x10'))['register'](socket);function respondWithStatusCode(_0x5a7d3d,_0x1d6cf6){_0x1d6cf6=_0x1d6cf6||0xcc;return function(_0x495400){if(_0x495400){return _0x5a7d3d['sendStatus'](_0x1d6cf6);}return _0x5a7d3d[_0x60c0('0x11')](_0x1d6cf6)[_0x60c0('0x12')]();};}function respondWithResult(_0x31fe68,_0x56117b){_0x56117b=_0x56117b||0xc8;return function(_0x41ad06){if(_0x41ad06){return _0x31fe68[_0x60c0('0x11')](_0x56117b)[_0x60c0('0x13')](_0x41ad06);}};}function respondWithFilteredResult(_0x13e4ce,_0x2adc37){return function(_0x29f273){if(_0x29f273){var _0x24097e=typeof _0x2adc37['offset']==='undefined'&&typeof _0x2adc37[_0x60c0('0x14')]===_0x60c0('0x15');var _0x12d764=_0x29f273[_0x60c0('0x16')];var _0x33b340=_0x24097e?0x0:_0x2adc37['offset'];var _0x297e17=_0x24097e?_0x29f273[_0x60c0('0x16')]:_0x2adc37[_0x60c0('0x17')]+_0x2adc37[_0x60c0('0x14')];var _0x5a3254;if(_0x297e17>=_0x12d764){_0x297e17=_0x12d764;_0x5a3254=0xc8;}else{_0x5a3254=0xce;}_0x13e4ce['status'](_0x5a3254);return _0x13e4ce[_0x60c0('0x18')](_0x60c0('0x19'),_0x33b340+'-'+_0x297e17+'/'+_0x12d764)[_0x60c0('0x13')](_0x29f273);}return null;};}function saveUpdates(_0x1c9e57){return function(_0x1320a3){if(_0x1320a3){return _0x1320a3['update'](_0x1c9e57)[_0x60c0('0x1a')](function(_0x524fba){return _0x524fba;});}return null;};}function removeEntity(_0x3072ed){return function(_0x10b3b9){if(_0x10b3b9){return _0x10b3b9[_0x60c0('0x1b')]()[_0x60c0('0x1a')](function(){_0x3072ed['status'](0xcc)[_0x60c0('0x12')]();});}};}function handleEntityNotFound(_0x16c9e8){return function(_0x5b0cdc){if(!_0x5b0cdc){_0x16c9e8[_0x60c0('0x1c')](0x194);}return _0x5b0cdc;};}function handleError(_0x36bb98,_0x50a107){_0x50a107=_0x50a107||0x1f4;return function(_0x3eecb3){logger[_0x60c0('0x1d')](_0x3eecb3[_0x60c0('0x1e')]);if(_0x3eecb3[_0x60c0('0x1f')]){delete _0x3eecb3[_0x60c0('0x1f')];}_0x36bb98[_0x60c0('0x11')](_0x50a107)[_0x60c0('0x20')](_0x3eecb3);};}exports[_0x60c0('0x21')]=function(_0x4bb3b2,_0x23c255){var _0x2bb6d1={};var _0x185d49=_[_0x60c0('0x22')](db['WhatsappInteraction'][_0x60c0('0x23')],function(_0x142b60){return{'name':_0x142b60[_0x60c0('0x24')],'type':_0x142b60[_0x60c0('0x25')]['key']};});_0x2bb6d1=qs['getOptions'](_0x185d49,_0x4bb3b2);return interaction['findAll']('whatsapp',_0x4bb3b2[_0x60c0('0x26')],_0x4bb3b2[_0x60c0('0x27')],_0x2bb6d1,_0x185d49)['then'](respondWithFilteredResult(_0x23c255,_0x2bb6d1))[_0x60c0('0x28')](handleError(_0x23c255,null));};exports['show']=function(_0x5d7a88,_0x515908){var _0x213e07={'raw':![],'where':{'id':_0x5d7a88[_0x60c0('0x29')]['id']}},_0x5576fe={};_0x5576fe[_0x60c0('0x2a')]=_[_0x60c0('0x2b')](db[_0x60c0('0x2c')][_0x60c0('0x23')]);_0x5576fe[_0x60c0('0x26')]=_[_0x60c0('0x2b')](_0x5d7a88[_0x60c0('0x26')]);_0x5576fe[_0x60c0('0x2d')]=_['intersection'](_0x5576fe[_0x60c0('0x2a')],_0x5576fe[_0x60c0('0x26')]);_0x213e07[_0x60c0('0x2e')]=_[_0x60c0('0x2f')](_0x5576fe[_0x60c0('0x2a')],qs['fields'](_0x5d7a88[_0x60c0('0x26')]['fields']));_0x213e07[_0x60c0('0x2e')]=_0x213e07['attributes'][_0x60c0('0x30')]?_0x213e07[_0x60c0('0x2e')]:_0x5576fe[_0x60c0('0x2a')];if(_0x5d7a88[_0x60c0('0x26')][_0x60c0('0x31')]){_0x213e07['include']=[{'all':!![]}];}_0x213e07=_[_0x60c0('0x32')]({},_0x213e07,_0x5d7a88[_0x60c0('0x33')]);return db[_0x60c0('0x2c')]['find'](_0x213e07)[_0x60c0('0x1a')](handleEntityNotFound(_0x515908,null))[_0x60c0('0x1a')](respondWithResult(_0x515908,null))[_0x60c0('0x28')](handleError(_0x515908,null));};exports[_0x60c0('0x34')]=function(_0x4ddc99,_0x19ee34){return db[_0x60c0('0x2c')][_0x60c0('0x34')](_0x4ddc99[_0x60c0('0x35')],{})['then'](respondWithResult(_0x19ee34,0xc9))[_0x60c0('0x28')](handleError(_0x19ee34,null));};exports[_0x60c0('0x36')]=function(_0x84d2f7,_0x5bd919){if(_0x84d2f7[_0x60c0('0x35')]['id']){delete _0x84d2f7[_0x60c0('0x35')]['id'];}return db[_0x60c0('0x2c')]['find']({'where':{'id':_0x84d2f7[_0x60c0('0x29')]['id']}})['then'](handleEntityNotFound(_0x5bd919,null))[_0x60c0('0x1a')](saveUpdates(_0x84d2f7['body'],null))[_0x60c0('0x1a')](respondWithResult(_0x5bd919,null))[_0x60c0('0x28')](handleError(_0x5bd919,null));};exports[_0x60c0('0x1b')]=function(_0x1df824,_0x3915fd){return db[_0x60c0('0x2c')][_0x60c0('0x37')]({'where':{'id':_0x1df824[_0x60c0('0x29')]['id']}})[_0x60c0('0x1a')](handleEntityNotFound(_0x3915fd,null))[_0x60c0('0x1a')](removeEntity(_0x3915fd,null))[_0x60c0('0x28')](handleError(_0x3915fd,null));};exports[_0x60c0('0x38')]=function(_0x37a852,_0x397e1a){return db[_0x60c0('0x2c')][_0x60c0('0x38')]()[_0x60c0('0x1a')](respondWithResult(_0x397e1a,null))['catch'](handleError(_0x397e1a,null));};exports[_0x60c0('0x39')]=function(_0x135b91,_0x1ca4ad){return db[_0x60c0('0x3a')][_0x60c0('0x37')]({'where':{'id':_0x135b91[_0x60c0('0x29')]['id']}})[_0x60c0('0x1a')](handleEntityNotFound(_0x1ca4ad,null))[_0x60c0('0x1a')](function(_0x481a88){if(_0x481a88){return _0x481a88[_0x60c0('0x39')](_0x135b91[_0x60c0('0x35')]['ids'],_[_0x60c0('0x3b')](_0x135b91[_0x60c0('0x35')],[_0x60c0('0x3c'),'id'])||{});}})[_0x60c0('0x1a')](respondWithResult(_0x1ca4ad,null))[_0x60c0('0x28')](handleError(_0x1ca4ad,null));};exports[_0x60c0('0x3d')]=function(_0x2a4f68,_0x24317e){var _0x4f798c={'raw':![],'where':{}};var _0x22e990={};var _0x4d2dca={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x60c0('0x3e')]({'where':{'id':_0x2a4f68[_0x60c0('0x29')]['id']}})['then'](handleEntityNotFound(_0x24317e,null))[_0x60c0('0x1a')](function(_0x474e5b){if(_0x474e5b){_0x22e990[_0x60c0('0x2a')]=_['keys'](db['WhatsappMessage'][_0x60c0('0x23')]);_0x22e990[_0x60c0('0x26')]=_[_0x60c0('0x2b')](_0x2a4f68[_0x60c0('0x26')]);_0x22e990[_0x60c0('0x2d')]=_[_0x60c0('0x2f')](_0x22e990[_0x60c0('0x2a')],_0x22e990['query']);_0x4f798c['attributes']=_[_0x60c0('0x2f')](_0x22e990[_0x60c0('0x2a')],qs[_0x60c0('0x3f')](_0x2a4f68['query']['fields']));_0x4f798c['attributes']=_0x4f798c['attributes'][_0x60c0('0x30')]?_0x4f798c[_0x60c0('0x2e')]:_0x22e990[_0x60c0('0x2a')];if(!_0x2a4f68['query'][_0x60c0('0x40')](_0x60c0('0x41'))){_0x4f798c[_0x60c0('0x14')]=qs[_0x60c0('0x14')](_0x2a4f68['query']['limit']);_0x4f798c[_0x60c0('0x17')]=qs[_0x60c0('0x17')](_0x2a4f68[_0x60c0('0x26')][_0x60c0('0x17')]);}_0x4f798c[_0x60c0('0x42')]=qs[_0x60c0('0x43')](_0x2a4f68[_0x60c0('0x26')][_0x60c0('0x43')]);_0x4f798c[_0x60c0('0x44')]=qs[_0x60c0('0x2d')](_['pick'](_0x2a4f68[_0x60c0('0x26')],_0x22e990[_0x60c0('0x2d')]));_0x4f798c[_0x60c0('0x44')][_0x60c0('0x45')]=_0x474e5b['id'];if(_0x2a4f68[_0x60c0('0x26')][_0x60c0('0x46')]){_0x4f798c[_0x60c0('0x44')]=_[_0x60c0('0x32')](_0x4f798c[_0x60c0('0x44')],{'$or':_['map'](_0x4f798c[_0x60c0('0x2e')],function(_0x2acb4a){var _0x169994={};_0x169994[_0x2acb4a]={'$like':'%'+_0x2a4f68[_0x60c0('0x26')][_0x60c0('0x46')]+'%'};return _0x169994;})});}if(_0x2a4f68[_0x60c0('0x26')][_0x60c0('0x47')]){var _0x1a6e55=_0x2a4f68[_0x60c0('0x26')]['$gte'][_0x60c0('0x48')](',');var _0x262009={};_0x262009[_0x1a6e55[0x0]]={'$gte':moment(_0x1a6e55[0x1])[_0x60c0('0x49')](_0x60c0('0x4a'))};_0x4f798c[_0x60c0('0x44')]=_[_0x60c0('0x32')](_0x4f798c['where'],_0x262009);}_0x4f798c=_[_0x60c0('0x32')]({},_0x4f798c,_0x2a4f68[_0x60c0('0x33')]);return db[_0x60c0('0x3a')]['count']({'where':_0x4f798c[_0x60c0('0x44')]})[_0x60c0('0x1a')](function(_0x5cdff7){_0x4d2dca['count']=_0x5cdff7;if(_0x2a4f68['query'][_0x60c0('0x31')]){_0x4f798c[_0x60c0('0x4b')]=[{'all':!![]}];}return db[_0x60c0('0x3a')][_0x60c0('0x4c')](_0x4f798c);})['then'](function(_0x2d44ec){_0x4d2dca['rows']=_0x2d44ec;return _0x4d2dca;});}})['then'](respondWithFilteredResult(_0x24317e,_0x4f798c))['catch'](handleError(_0x24317e,null));};exports['addTags']=function(_0x3a4e02,_0x20ce93){return db[_0x60c0('0x2c')][_0x60c0('0x37')]({'where':{'id':_0x3a4e02[_0x60c0('0x29')]['id']}})[_0x60c0('0x1a')](handleEntityNotFound(_0x20ce93,null))['then'](function(_0x35945a){if(_0x35945a){return _0x35945a['setTags'](_0x3a4e02[_0x60c0('0x35')]['ids'],_['omit'](_0x3a4e02[_0x60c0('0x35')],[_0x60c0('0x3c'),'id'])||{})[_0x60c0('0x4d')](function(){return db[_0x60c0('0x4e')][_0x60c0('0x4c')]({'attributes':['id','name',_0x60c0('0x4f')],'where':{'id':_0x3a4e02['body'][_0x60c0('0x3c')]}});})['then'](function(_0x27c982){socket[_0x60c0('0x50')](_0x60c0('0x51'),{'id':Number(_0x3a4e02['params']['id']),'tags':_0x27c982||[]});return{'id':Number(_0x3a4e02[_0x60c0('0x29')]['id']),'tags':_0x27c982||[]};});}})['then'](respondWithResult(_0x20ce93,null))[_0x60c0('0x28')](handleError(_0x20ce93,null));};exports[_0x60c0('0x52')]=function(_0x1d2a3b,_0x1c416e){return db[_0x60c0('0x2c')][_0x60c0('0x37')]({'where':{'id':_0x1d2a3b[_0x60c0('0x29')]['id']}})['then'](handleEntityNotFound(_0x1c416e,null))[_0x60c0('0x1a')](function(_0x3d49a2){if(_0x3d49a2){return _0x3d49a2[_0x60c0('0x52')](_0x1d2a3b[_0x60c0('0x26')][_0x60c0('0x3c')]);}})[_0x60c0('0x1a')](respondWithStatusCode(_0x1c416e,null))['catch'](handleError(_0x1c416e,null));};exports[_0x60c0('0x53')]=function(_0x51a679,_0x542d9d){var _0x5de309=moment()[_0x60c0('0x54')]()[_0x60c0('0x55')]();var _0x14c018=path[_0x60c0('0x56')](config[_0x60c0('0x57')],_0x60c0('0x58'),_0x60c0('0x59'),_0x60c0('0x5a'));var _0x6e46b7=path[_0x60c0('0x56')](config[_0x60c0('0x57')],_0x60c0('0x58'),_0x60c0('0x59'),_0x60c0('0x5b'));var _0x218560=path['join'](_0x14c018,_0x5de309);var _0x4df5e9=util[_0x60c0('0x49')](_0x60c0('0x5c'),_0x51a679['params']['id'],_0x5de309);var _0x68a5ca=path['join'](_0x14c018,_0x4df5e9);var _0x53e349=[];_0x53e349['push']({'model':db[_0x60c0('0x5d')],'as':_0x60c0('0x5d'),'attributes':['id',_0x60c0('0x5e')],'raw':!![]});_0x53e349[_0x60c0('0x5f')]({'model':db['CmContact'],'as':_0x60c0('0x60'),'attributes':['id',_0x60c0('0x61'),_0x60c0('0x62')],'raw':!![]});if(_0x51a679[_0x60c0('0x26')][_0x60c0('0x5b')]){_0x53e349[_0x60c0('0x5f')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x79add8=[{'model':db[_0x60c0('0x3a')],'as':'Messages','attributes':['id',_0x60c0('0x35'),_0x60c0('0x63'),'direction',_0x60c0('0x64'),_0x60c0('0x65')],'include':_0x53e349}];_0x79add8['push']({'model':db['WhatsappAccount'],'as':_0x60c0('0x66'),'attributes':['id','name']});_0x79add8[_0x60c0('0x5f')]({'model':db[_0x60c0('0x5d')],'as':'Owner','attributes':['id',_0x60c0('0x5e')]});return db[_0x60c0('0x2c')][_0x60c0('0x37')]({'where':{'id':_0x51a679['params']['id']},'include':_0x79add8})['then'](handleEntityNotFound(_0x542d9d,null))[_0x60c0('0x1a')](function(_0x3e866e){if(_0x3e866e){var _0x19c36b=_0x3e866e[_0x60c0('0x67')]({'plain':!![]});fs[_0x60c0('0x68')](_0x218560);var _0x40bc79={'channel':_0x60c0('0x69'),'account':_0x19c36b[_0x60c0('0x66')][_0x60c0('0x1f')],'agent':_0x19c36b[_0x60c0('0x6a')]?_0x19c36b['Owner'][_0x60c0('0x5e')]:_0x60c0('0x6b'),'createdAt':moment(_0x19c36b[_0x60c0('0x63')])['format'](_0x60c0('0x4a'))[_0x60c0('0x55')](),'closedAt':_0x19c36b[_0x60c0('0x6c')]?moment(_0x19c36b[_0x60c0('0x6d')])['format'](_0x60c0('0x4a'))[_0x60c0('0x55')]():'','disposition':_0x19c36b[_0x60c0('0x6e')],'messages':_(_0x19c36b[_0x60c0('0x6f')])[_0x60c0('0x46')]({'secret':![]})[_0x60c0('0x22')](function(_0x3c67a0){if(_0x3c67a0['Attachment']){var _0x50049b=path[_0x60c0('0x56')](_0x6e46b7,_0x3c67a0[_0x60c0('0x70')][_0x60c0('0x71')]);if(fs[_0x60c0('0x72')](_0x50049b)){fs[_0x60c0('0x73')](_0x50049b)[_0x60c0('0x74')](fs[_0x60c0('0x75')](path['join'](_0x218560,_0x3c67a0[_0x60c0('0x70')][_0x60c0('0x71')])));}}return{'date':moment(_0x3c67a0[_0x60c0('0x63')])['format'](_0x60c0('0x4a'))['toString'](),'sender':_0x3c67a0[_0x60c0('0x76')]===_0x60c0('0x77')?_0x3c67a0[_0x60c0('0x5d')]?_0x3c67a0['User'][_0x60c0('0x5e')]:_0x60c0('0x78'):_0x3c67a0['Contact']['firstName']+(_0x3c67a0[_0x60c0('0x60')][_0x60c0('0x62')]?'\x20'+_0x3c67a0[_0x60c0('0x60')][_0x60c0('0x62')]:''),'body':_0x3c67a0[_0x60c0('0x70')]?_0x3c67a0['Attachment'][_0x60c0('0x71')]:_0x3c67a0[_0x60c0('0x35')],'direction':_0x3c67a0[_0x60c0('0x76')]==='out'?'A':'C','secret':_0x3c67a0['secret'],'read':_0x3c67a0['read'],'attachment':_0x3c67a0[_0x60c0('0x70')]};})['value']()};return ejs[_0x60c0('0x79')](path[_0x60c0('0x56')](config[_0x60c0('0x57')],_0x60c0('0x58'),'views',_0x60c0('0x7a')),{'interaction':_0x40bc79})['then'](function(_0x2ccc91){var _0x39825a=path[_0x60c0('0x56')](_0x218560,_0x60c0('0x7b')+_0x19c36b['id']+'-'+_0x5de309+'.pdf');var _0xab64f0={'path':_0x39825a,'channel':'Whatsapp','interactionId':_0x19c36b['id']};return pdf[_0x60c0('0x7c')](_0x2ccc91,_0xab64f0);})['then'](function(){return new BPromise(function(_0x47ea7f,_0x4cf8b4){zipdir(_0x218560,{'saveTo':_0x68a5ca},function(_0xbf4bf4,_0x49f1f4){if(_0xbf4bf4)return _0x4cf8b4(_0xbf4bf4);return _0x47ea7f(_0x49f1f4);});})['then'](function(){return new BPromise(function(_0x10b936,_0x4adc74){rimraf(_0x218560,function(_0xb16076){if(_0xb16076)_0x4adc74(_0xb16076);return _0x10b936();});});})['then'](function(){return _0x542d9d[_0x60c0('0x53')](_0x68a5ca,_0x4df5e9,function(_0x4b9663){if(_0x4b9663){console[_0x60c0('0x7d')](_0x60c0('0x7e'),_0x4b9663);}else{fs[_0x60c0('0x7f')](_0x68a5ca);}});});});}else{return _0x542d9d[_0x60c0('0x1c')](0xc8);}})[_0x60c0('0x28')](handleError(_0x542d9d,null));}; \ No newline at end of file +var _0xacdd=['renderFile','downloadInteraction.ejs','transcript-','.pdf','Whatsapp','log','unlinkSync','zip-dir','moment','path','lodash','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./whatsappInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','json','update','then','destroy','error','name','index','rawAttributes','type','key','getOptions','findAll','whatsapp','catch','show','params','model','keys','WhatsappInteraction','query','attributes','intersection','fields','includeAll','include','merge','options','find','create','body','describe','addMessage','ids','getMessages','findOne','WhatsappMessage','filters','length','hasOwnProperty','nolimit','order','sort','where','pick','WhatsappInteractionId','filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','Tag','color','removeTags','download','join','root','tmp','server','files','transcript-%d-%s.zip','User','fullname','push','CmContact','Contact','lastName','attachments','Attachment','createdAt','direction','secret','read','Account','Owner','mkdirSync','toString','closed','closedAt','disposition','Messages','basename','existsSync','createReadStream','createWriteStream','out','System'];(function(_0x544999,_0x50742a){var _0x18a4c6=function(_0x2a5907){while(--_0x2a5907){_0x544999['push'](_0x544999['shift']());}};_0x18a4c6(++_0x50742a);}(_0xacdd,0x16f));var _0xdacd=function(_0x18b165,_0x40a7ea){_0x18b165=_0x18b165-0x0;var _0x1d8e19=_0xacdd[_0x18b165];return _0x1d8e19;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xdacd('0x0'));var moment=require(_0xdacd('0x1'));var BPromise=require('bluebird');var util=require('util');var path=require(_0xdacd('0x2'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdacd('0x3'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0xdacd('0x4'));var pdf=require(_0xdacd('0x5'));var logger=require(_0xdacd('0x6'))(_0xdacd('0x7'));var config=require('../../config/environment');var db=require(_0xdacd('0x8'))['db'];config['redis']=_[_0xdacd('0x9')](config['redis'],{'host':_0xdacd('0xa'),'port':0x18eb});var socket=require(_0xdacd('0xb'))(new Redis(config[_0xdacd('0xc')]));require(_0xdacd('0xd'))[_0xdacd('0xe')](socket);function respondWithStatusCode(_0x2155c2,_0x80974e){_0x80974e=_0x80974e||0xcc;return function(_0x2ad769){if(_0x2ad769){return _0x2155c2[_0xdacd('0xf')](_0x80974e);}return _0x2155c2[_0xdacd('0x10')](_0x80974e)[_0xdacd('0x11')]();};}function respondWithResult(_0x26f437,_0x537a1a){_0x537a1a=_0x537a1a||0xc8;return function(_0x2dbffe){if(_0x2dbffe){return _0x26f437[_0xdacd('0x10')](_0x537a1a)['json'](_0x2dbffe);}};}function respondWithFilteredResult(_0x3131d6,_0x284853){return function(_0xb3e636){if(_0xb3e636){var _0x3327c0=typeof _0x284853[_0xdacd('0x12')]===_0xdacd('0x13')&&typeof _0x284853[_0xdacd('0x14')]===_0xdacd('0x13');var _0x110dc8=_0xb3e636[_0xdacd('0x15')];var _0x265a4c=_0x3327c0?0x0:_0x284853[_0xdacd('0x12')];var _0x3d6c06=_0x3327c0?_0xb3e636['count']:_0x284853[_0xdacd('0x12')]+_0x284853[_0xdacd('0x14')];var _0x98680e;if(_0x3d6c06>=_0x110dc8){_0x3d6c06=_0x110dc8;_0x98680e=0xc8;}else{_0x98680e=0xce;}_0x3131d6[_0xdacd('0x10')](_0x98680e);return _0x3131d6[_0xdacd('0x16')]('Content-Range',_0x265a4c+'-'+_0x3d6c06+'/'+_0x110dc8)[_0xdacd('0x17')](_0xb3e636);}return null;};}function saveUpdates(_0xc632f4){return function(_0x35a172){if(_0x35a172){return _0x35a172[_0xdacd('0x18')](_0xc632f4)[_0xdacd('0x19')](function(_0x34e0f0){return _0x34e0f0;});}return null;};}function removeEntity(_0x284ce4){return function(_0x106af6){if(_0x106af6){return _0x106af6[_0xdacd('0x1a')]()['then'](function(){_0x284ce4[_0xdacd('0x10')](0xcc)[_0xdacd('0x11')]();});}};}function handleEntityNotFound(_0x5d9035){return function(_0xdf4898){if(!_0xdf4898){_0x5d9035['sendStatus'](0x194);}return _0xdf4898;};}function handleError(_0x9cf821,_0x1fe4e0){_0x1fe4e0=_0x1fe4e0||0x1f4;return function(_0x6f20b1){logger[_0xdacd('0x1b')](_0x6f20b1['stack']);if(_0x6f20b1[_0xdacd('0x1c')]){delete _0x6f20b1[_0xdacd('0x1c')];}_0x9cf821[_0xdacd('0x10')](_0x1fe4e0)['send'](_0x6f20b1);};}exports[_0xdacd('0x1d')]=function(_0x5e629c,_0xdeba09){var _0x599533={};var _0x2248d7=_['map'](db['WhatsappInteraction'][_0xdacd('0x1e')],function(_0x3ce3e9){return{'name':_0x3ce3e9['fieldName'],'type':_0x3ce3e9[_0xdacd('0x1f')][_0xdacd('0x20')]};});_0x599533=qs[_0xdacd('0x21')](_0x2248d7,_0x5e629c);return interaction[_0xdacd('0x22')](_0xdacd('0x23'),_0x5e629c['query'],_0x5e629c['user'],_0x599533,_0x2248d7)[_0xdacd('0x19')](respondWithFilteredResult(_0xdeba09,_0x599533))[_0xdacd('0x24')](handleError(_0xdeba09,null));};exports[_0xdacd('0x25')]=function(_0x23115d,_0x4a42c8){var _0x622fd1={'raw':![],'where':{'id':_0x23115d[_0xdacd('0x26')]['id']}},_0x4c3b1e={};_0x4c3b1e[_0xdacd('0x27')]=_[_0xdacd('0x28')](db[_0xdacd('0x29')][_0xdacd('0x1e')]);_0x4c3b1e[_0xdacd('0x2a')]=_[_0xdacd('0x28')](_0x23115d[_0xdacd('0x2a')]);_0x4c3b1e['filters']=_['intersection'](_0x4c3b1e[_0xdacd('0x27')],_0x4c3b1e[_0xdacd('0x2a')]);_0x622fd1[_0xdacd('0x2b')]=_[_0xdacd('0x2c')](_0x4c3b1e[_0xdacd('0x27')],qs[_0xdacd('0x2d')](_0x23115d[_0xdacd('0x2a')][_0xdacd('0x2d')]));_0x622fd1[_0xdacd('0x2b')]=_0x622fd1[_0xdacd('0x2b')]['length']?_0x622fd1['attributes']:_0x4c3b1e[_0xdacd('0x27')];if(_0x23115d[_0xdacd('0x2a')][_0xdacd('0x2e')]){_0x622fd1[_0xdacd('0x2f')]=[{'all':!![]}];}_0x622fd1=_[_0xdacd('0x30')]({},_0x622fd1,_0x23115d[_0xdacd('0x31')]);return db['WhatsappInteraction'][_0xdacd('0x32')](_0x622fd1)[_0xdacd('0x19')](handleEntityNotFound(_0x4a42c8,null))['then'](respondWithResult(_0x4a42c8,null))[_0xdacd('0x24')](handleError(_0x4a42c8,null));};exports[_0xdacd('0x33')]=function(_0x36a298,_0x38eedc){return db[_0xdacd('0x29')]['create'](_0x36a298[_0xdacd('0x34')],{})[_0xdacd('0x19')](respondWithResult(_0x38eedc,0xc9))[_0xdacd('0x24')](handleError(_0x38eedc,null));};exports[_0xdacd('0x18')]=function(_0x5ea43a,_0x256bb3){if(_0x5ea43a['body']['id']){delete _0x5ea43a['body']['id'];}return db['WhatsappInteraction'][_0xdacd('0x32')]({'where':{'id':_0x5ea43a[_0xdacd('0x26')]['id']}})[_0xdacd('0x19')](handleEntityNotFound(_0x256bb3,null))[_0xdacd('0x19')](saveUpdates(_0x5ea43a[_0xdacd('0x34')],null))['then'](respondWithResult(_0x256bb3,null))['catch'](handleError(_0x256bb3,null));};exports['destroy']=function(_0x4d3649,_0x45eb1f){return db[_0xdacd('0x29')][_0xdacd('0x32')]({'where':{'id':_0x4d3649[_0xdacd('0x26')]['id']}})[_0xdacd('0x19')](handleEntityNotFound(_0x45eb1f,null))[_0xdacd('0x19')](removeEntity(_0x45eb1f,null))[_0xdacd('0x24')](handleError(_0x45eb1f,null));};exports[_0xdacd('0x35')]=function(_0x2017bd,_0x1a6661){return db[_0xdacd('0x29')][_0xdacd('0x35')]()[_0xdacd('0x19')](respondWithResult(_0x1a6661,null))[_0xdacd('0x24')](handleError(_0x1a6661,null));};exports[_0xdacd('0x36')]=function(_0x5de1fc,_0x565c3e){return db['WhatsappMessage'][_0xdacd('0x32')]({'where':{'id':_0x5de1fc[_0xdacd('0x26')]['id']}})[_0xdacd('0x19')](handleEntityNotFound(_0x565c3e,null))[_0xdacd('0x19')](function(_0x97cfc5){if(_0x97cfc5){return _0x97cfc5['addMessage'](_0x5de1fc[_0xdacd('0x34')][_0xdacd('0x37')],_['omit'](_0x5de1fc[_0xdacd('0x34')],[_0xdacd('0x37'),'id'])||{});}})['then'](respondWithResult(_0x565c3e,null))[_0xdacd('0x24')](handleError(_0x565c3e,null));};exports[_0xdacd('0x38')]=function(_0x5e6601,_0x2a36d7){var _0x427d96={'raw':![],'where':{}};var _0x545d00={};var _0xf2e008={'count':0x0,'rows':[]};return db[_0xdacd('0x29')][_0xdacd('0x39')]({'where':{'id':_0x5e6601[_0xdacd('0x26')]['id']}})['then'](handleEntityNotFound(_0x2a36d7,null))[_0xdacd('0x19')](function(_0x325cf2){if(_0x325cf2){_0x545d00[_0xdacd('0x27')]=_[_0xdacd('0x28')](db[_0xdacd('0x3a')][_0xdacd('0x1e')]);_0x545d00[_0xdacd('0x2a')]=_['keys'](_0x5e6601[_0xdacd('0x2a')]);_0x545d00[_0xdacd('0x3b')]=_[_0xdacd('0x2c')](_0x545d00[_0xdacd('0x27')],_0x545d00[_0xdacd('0x2a')]);_0x427d96[_0xdacd('0x2b')]=_[_0xdacd('0x2c')](_0x545d00[_0xdacd('0x27')],qs[_0xdacd('0x2d')](_0x5e6601[_0xdacd('0x2a')][_0xdacd('0x2d')]));_0x427d96[_0xdacd('0x2b')]=_0x427d96[_0xdacd('0x2b')][_0xdacd('0x3c')]?_0x427d96[_0xdacd('0x2b')]:_0x545d00[_0xdacd('0x27')];if(!_0x5e6601[_0xdacd('0x2a')][_0xdacd('0x3d')](_0xdacd('0x3e'))){_0x427d96[_0xdacd('0x14')]=qs['limit'](_0x5e6601[_0xdacd('0x2a')]['limit']);_0x427d96[_0xdacd('0x12')]=qs[_0xdacd('0x12')](_0x5e6601[_0xdacd('0x2a')]['offset']);}_0x427d96[_0xdacd('0x3f')]=qs[_0xdacd('0x40')](_0x5e6601[_0xdacd('0x2a')]['sort']);_0x427d96[_0xdacd('0x41')]=qs[_0xdacd('0x3b')](_[_0xdacd('0x42')](_0x5e6601[_0xdacd('0x2a')],_0x545d00[_0xdacd('0x3b')]));_0x427d96[_0xdacd('0x41')][_0xdacd('0x43')]=_0x325cf2['id'];if(_0x5e6601[_0xdacd('0x2a')][_0xdacd('0x44')]){_0x427d96[_0xdacd('0x41')]=_['merge'](_0x427d96[_0xdacd('0x41')],{'$or':_[_0xdacd('0x45')](_0x427d96[_0xdacd('0x2b')],function(_0x26c798){var _0x49e57d={};_0x49e57d[_0x26c798]={'$like':'%'+_0x5e6601[_0xdacd('0x2a')]['filter']+'%'};return _0x49e57d;})});}if(_0x5e6601[_0xdacd('0x2a')][_0xdacd('0x46')]){var _0xb33a2=_0x5e6601[_0xdacd('0x2a')][_0xdacd('0x46')][_0xdacd('0x47')](',');var _0x1197f3={};_0x1197f3[_0xb33a2[0x0]]={'$gte':moment(_0xb33a2[0x1])[_0xdacd('0x48')](_0xdacd('0x49'))};_0x427d96[_0xdacd('0x41')]=_['merge'](_0x427d96[_0xdacd('0x41')],_0x1197f3);}_0x427d96=_[_0xdacd('0x30')]({},_0x427d96,_0x5e6601[_0xdacd('0x31')]);return db['WhatsappMessage'][_0xdacd('0x15')]({'where':_0x427d96['where']})[_0xdacd('0x19')](function(_0x4b6440){_0xf2e008['count']=_0x4b6440;if(_0x5e6601['query'][_0xdacd('0x2e')]){_0x427d96[_0xdacd('0x2f')]=[{'all':!![]}];}return db['WhatsappMessage'][_0xdacd('0x22')](_0x427d96);})['then'](function(_0x363ab0){_0xf2e008['rows']=_0x363ab0;return _0xf2e008;});}})[_0xdacd('0x19')](respondWithFilteredResult(_0x2a36d7,_0x427d96))['catch'](handleError(_0x2a36d7,null));};exports[_0xdacd('0x4a')]=function(_0x2ea5ca,_0x1ed847){return db[_0xdacd('0x29')]['find']({'where':{'id':_0x2ea5ca['params']['id']}})[_0xdacd('0x19')](handleEntityNotFound(_0x1ed847,null))[_0xdacd('0x19')](function(_0x2c7a56){if(_0x2c7a56){return _0x2c7a56[_0xdacd('0x4b')](_0x2ea5ca[_0xdacd('0x34')][_0xdacd('0x37')],_['omit'](_0x2ea5ca[_0xdacd('0x34')],[_0xdacd('0x37'),'id'])||{})[_0xdacd('0x4c')](function(){return db[_0xdacd('0x4d')][_0xdacd('0x22')]({'attributes':['id','name',_0xdacd('0x4e')],'where':{'id':_0x2ea5ca[_0xdacd('0x34')][_0xdacd('0x37')]}});})['then'](function(_0x5d9e36){socket['emit']('whatsappInteractionTags:save',{'id':Number(_0x2ea5ca[_0xdacd('0x26')]['id']),'tags':_0x5d9e36||[]});return{'id':Number(_0x2ea5ca[_0xdacd('0x26')]['id']),'tags':_0x5d9e36||[]};});}})[_0xdacd('0x19')](respondWithResult(_0x1ed847,null))[_0xdacd('0x24')](handleError(_0x1ed847,null));};exports[_0xdacd('0x4f')]=function(_0xc87553,_0x49dbe0){return db[_0xdacd('0x29')]['find']({'where':{'id':_0xc87553[_0xdacd('0x26')]['id']}})[_0xdacd('0x19')](handleEntityNotFound(_0x49dbe0,null))[_0xdacd('0x19')](function(_0x47a3d0){if(_0x47a3d0){return _0x47a3d0[_0xdacd('0x4f')](_0xc87553[_0xdacd('0x2a')][_0xdacd('0x37')]);}})[_0xdacd('0x19')](respondWithStatusCode(_0x49dbe0,null))['catch'](handleError(_0x49dbe0,null));};exports[_0xdacd('0x50')]=function(_0x3358d6,_0x247bec){var _0x36ee65=moment()['unix']()['toString']();var _0x86bf7e=path[_0xdacd('0x51')](config[_0xdacd('0x52')],'server','files',_0xdacd('0x53'));var _0x14186c=path[_0xdacd('0x51')](config['root'],_0xdacd('0x54'),_0xdacd('0x55'),'attachments');var _0x13255a=path[_0xdacd('0x51')](_0x86bf7e,_0x36ee65);var _0x366a42=util['format'](_0xdacd('0x56'),_0x3358d6['params']['id'],_0x36ee65);var _0x5e8e30=path[_0xdacd('0x51')](_0x86bf7e,_0x366a42);var _0x344f8a=[];_0x344f8a['push']({'model':db[_0xdacd('0x57')],'as':_0xdacd('0x57'),'attributes':['id',_0xdacd('0x58')],'raw':!![]});_0x344f8a[_0xdacd('0x59')]({'model':db[_0xdacd('0x5a')],'as':_0xdacd('0x5b'),'attributes':['id','firstName',_0xdacd('0x5c')],'raw':!![]});if(_0x3358d6['query'][_0xdacd('0x5d')]){_0x344f8a[_0xdacd('0x59')]({'model':db[_0xdacd('0x5e')],'as':'Attachment','raw':!![]});}var _0x5a80bc=[{'model':db[_0xdacd('0x3a')],'as':'Messages','attributes':['id',_0xdacd('0x34'),_0xdacd('0x5f'),_0xdacd('0x60'),_0xdacd('0x61'),_0xdacd('0x62')],'include':_0x344f8a}];_0x5a80bc[_0xdacd('0x59')]({'model':db['WhatsappAccount'],'as':_0xdacd('0x63'),'attributes':['id',_0xdacd('0x1c')]});_0x5a80bc[_0xdacd('0x59')]({'model':db['User'],'as':_0xdacd('0x64'),'attributes':['id','fullname']});return db['WhatsappInteraction']['find']({'where':{'id':_0x3358d6[_0xdacd('0x26')]['id']},'include':_0x5a80bc})['then'](handleEntityNotFound(_0x247bec,null))[_0xdacd('0x19')](function(_0x2a1744){if(_0x2a1744){var _0x235130=_0x2a1744['get']({'plain':!![]});fs[_0xdacd('0x65')](_0x13255a);var _0x801e0f={'channel':'Whatsapp','account':_0x235130[_0xdacd('0x63')][_0xdacd('0x1c')],'agent':_0x235130[_0xdacd('0x64')]?_0x235130[_0xdacd('0x64')]['fullname']:'N.A.','createdAt':moment(_0x235130[_0xdacd('0x5f')])[_0xdacd('0x48')](_0xdacd('0x49'))[_0xdacd('0x66')](),'closedAt':_0x235130[_0xdacd('0x67')]?moment(_0x235130[_0xdacd('0x68')])[_0xdacd('0x48')](_0xdacd('0x49'))[_0xdacd('0x66')]():'','disposition':_0x235130[_0xdacd('0x69')],'messages':_(_0x235130[_0xdacd('0x6a')])['filter']({'secret':![]})[_0xdacd('0x45')](function(_0x3f90da){if(_0x3f90da[_0xdacd('0x5e')]){var _0x391006=path[_0xdacd('0x51')](_0x14186c,_0x3f90da[_0xdacd('0x5e')][_0xdacd('0x6b')]);if(fs[_0xdacd('0x6c')](_0x391006)){fs[_0xdacd('0x6d')](_0x391006)['pipe'](fs[_0xdacd('0x6e')](path[_0xdacd('0x51')](_0x13255a,_0x3f90da[_0xdacd('0x5e')][_0xdacd('0x6b')])));}}return{'date':moment(_0x3f90da[_0xdacd('0x5f')])[_0xdacd('0x48')](_0xdacd('0x49'))[_0xdacd('0x66')](),'sender':_0x3f90da[_0xdacd('0x60')]===_0xdacd('0x6f')?_0x3f90da[_0xdacd('0x57')]?_0x3f90da[_0xdacd('0x57')]['fullname']:_0xdacd('0x70'):_0x3f90da[_0xdacd('0x5b')]['firstName']+(_0x3f90da['Contact'][_0xdacd('0x5c')]?'\x20'+_0x3f90da[_0xdacd('0x5b')][_0xdacd('0x5c')]:''),'body':_0x3f90da[_0xdacd('0x5e')]?_0x3f90da[_0xdacd('0x5e')]['basename']:_0x3f90da[_0xdacd('0x34')],'direction':_0x3f90da['direction']===_0xdacd('0x6f')?'A':'C','secret':_0x3f90da[_0xdacd('0x61')],'read':_0x3f90da[_0xdacd('0x62')],'attachment':_0x3f90da[_0xdacd('0x5e')]};})['value']()};return ejs[_0xdacd('0x71')](path[_0xdacd('0x51')](config[_0xdacd('0x52')],'server','views',_0xdacd('0x72')),{'interaction':_0x801e0f})[_0xdacd('0x19')](function(_0x17f7c4){var _0x361c96=path[_0xdacd('0x51')](_0x13255a,_0xdacd('0x73')+_0x235130['id']+'-'+_0x36ee65+_0xdacd('0x74'));var _0x1f907e={'path':_0x361c96,'channel':_0xdacd('0x75'),'interactionId':_0x235130['id']};return pdf['createPdfFromHTML'](_0x17f7c4,_0x1f907e);})[_0xdacd('0x19')](function(){return new BPromise(function(_0x44428d,_0x53a85f){zipdir(_0x13255a,{'saveTo':_0x5e8e30},function(_0x141262,_0x54ae4b){if(_0x141262)return _0x53a85f(_0x141262);return _0x44428d(_0x54ae4b);});})['then'](function(){return new BPromise(function(_0x4d0c75,_0x5d37fd){rimraf(_0x13255a,function(_0x35ce45){if(_0x35ce45)_0x5d37fd(_0x35ce45);return _0x4d0c75();});});})['then'](function(){return _0x247bec[_0xdacd('0x50')](_0x5e8e30,_0x366a42,function(_0x13e37a){if(_0x13e37a){console[_0xdacd('0x76')]('err',_0x13e37a);}else{fs[_0xdacd('0x77')](_0x5e8e30);}});});});}else{return _0x247bec['sendStatus'](0xc8);}})[_0xdacd('0x24')](handleError(_0x247bec,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index b1e5fec..1a2f190 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 _0x12fd=['getUsers','setDataValue','Users','map','findAll','emit','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','save','update','remove'];(function(_0xc57c17,_0x587991){var _0x19165e=function(_0x139d42){while(--_0x139d42){_0xc57c17['push'](_0xc57c17['shift']());}};_0x19165e(++_0x587991);}(_0x12fd,0x199));var _0xd12f=function(_0x3e36b9,_0x23dfcc){_0x3e36b9=_0x3e36b9-0x0;var _0x1ea7ba=_0x12fd[_0x3e36b9];return _0x1ea7ba;};'use strict';var EventEmitter=require(_0xd12f('0x0'));var WhatsappInteraction=require(_0xd12f('0x1'))['db'][_0xd12f('0x2')];var WhatsappMessage=require(_0xd12f('0x1'))['db'][_0xd12f('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd12f('0x4'),'afterUpdate':_0xd12f('0x5'),'afterDestroy':_0xd12f('0x6')};function emitEvent(_0x239bf2){return function(_0x79c5c9,_0x154c72,_0x55bb7d){_0x79c5c9[_0xd12f('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x285abf){_0x79c5c9[_0xd12f('0x8')](_0xd12f('0x9'),_0x285abf[_0xd12f('0xa')](function(_0x504504){return{'id':_0x504504['id']};}));return WhatsappMessage[_0xd12f('0xb')]({'where':{'WhatsappInteractionId':_0x79c5c9['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xd848dd){_0x79c5c9['setDataValue']('unreadMessages',_0xd848dd['length']);WhatsappInteractionEvents[_0xd12f('0xc')](_0x239bf2+':'+_0x79c5c9['id'],_0x79c5c9);WhatsappInteractionEvents[_0xd12f('0xc')](_0x239bf2,_0x79c5c9);_0x55bb7d(null);})['catch'](_0x55bb7d(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0xf00e=['length','emit','catch','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users'];(function(_0x159fd1,_0x73b713){var _0x5c85b1=function(_0x378e6c){while(--_0x378e6c){_0x159fd1['push'](_0x159fd1['shift']());}};_0x5c85b1(++_0x73b713);}(_0xf00e,0x12f));var _0xef00=function(_0x498bbd,_0x168b20){_0x498bbd=_0x498bbd-0x0;var _0x59a0a5=_0xf00e[_0x498bbd];return _0x59a0a5;};'use strict';var EventEmitter=require(_0xef00('0x0'));var WhatsappInteraction=require(_0xef00('0x1'))['db'][_0xef00('0x2')];var WhatsappMessage=require(_0xef00('0x1'))['db'][_0xef00('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xef00('0x4')](0x0);var events={'afterCreate':_0xef00('0x5'),'afterUpdate':_0xef00('0x6'),'afterDestroy':_0xef00('0x7')};function emitEvent(_0x4261ea){return function(_0x409186,_0x471e92,_0x397c39){_0x409186[_0xef00('0x8')]({'attributes':['id'],'raw':!![]})[_0xef00('0x9')](function(_0x17ec9e){_0x409186[_0xef00('0xa')](_0xef00('0xb'),_0x17ec9e['map'](function(_0x1d3b1c){return{'id':_0x1d3b1c['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x409186['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x173074){_0x409186['setDataValue']('unreadMessages',_0x173074[_0xef00('0xc')]);WhatsappInteractionEvents['emit'](_0x4261ea+':'+_0x409186['id'],_0x409186);WhatsappInteractionEvents[_0xef00('0xd')](_0x4261ea,_0x409186);_0x397c39(null);})[_0xef00('0xe')](_0x397c39(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 9e63ab2..35cc8fc 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 _0xba40=['exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./whatsappInteraction.attributes'];(function(_0x36db64,_0x95f6b6){var _0x354657=function(_0x468ee1){while(--_0x468ee1){_0x36db64['push'](_0x36db64['shift']());}};_0x354657(++_0x95f6b6);}(_0xba40,0x75));var _0x0ba4=function(_0x11a48b,_0x24d984){_0x11a48b=_0x11a48b-0x0;var _0x4a275e=_0xba40[_0x11a48b];return _0x4a275e;};'use strict';var _=require(_0x0ba4('0x0'));var util=require('util');var logger=require(_0x0ba4('0x1'))(_0x0ba4('0x2'));var moment=require(_0x0ba4('0x3'));var BPromise=require(_0x0ba4('0x4'));var rp=require(_0x0ba4('0x5'));var fs=require('fs');var path=require(_0x0ba4('0x6'));var rimraf=require(_0x0ba4('0x7'));var config=require('../../config/environment');var attributes=require(_0x0ba4('0x8'));module[_0x0ba4('0x9')]=function(_0x4aeee3,_0x2544d0){return _0x4aeee3[_0x0ba4('0xa')](_0x0ba4('0xb'),attributes,{'tableName':_0x0ba4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x31deb7,_0x361a4b,_0x48e684){if(_0x31deb7[_0x0ba4('0xd')](_0x0ba4('0xe'))){_0x31deb7[_0x0ba4('0xf')]=moment()[_0x0ba4('0x10')](_0x0ba4('0x11'));}_0x48e684(null,_0x31deb7);}}});}; \ No newline at end of file +var _0x09d6=['path','rimraf','../../config/environment','./whatsappInteraction.attributes','define','WhatsappInteraction','whatsapp_interactions','closed','YYYY-MM-DD\x20HH:mm:ss','util','api','request-promise'];(function(_0x5e09d2,_0xccfe30){var _0x310dae=function(_0x29dd41){while(--_0x29dd41){_0x5e09d2['push'](_0x5e09d2['shift']());}};_0x310dae(++_0xccfe30);}(_0x09d6,0x159));var _0x609d=function(_0x271080,_0x50839d){_0x271080=_0x271080-0x0;var _0x3f08e5=_0x09d6[_0x271080];return _0x3f08e5;};'use strict';var _=require('lodash');var util=require(_0x609d('0x0'));var logger=require('../../config/logger')(_0x609d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x609d('0x2'));var fs=require('fs');var path=require(_0x609d('0x3'));var rimraf=require(_0x609d('0x4'));var config=require(_0x609d('0x5'));var attributes=require(_0x609d('0x6'));module['exports']=function(_0x2ed60d,_0x57772a){return _0x2ed60d[_0x609d('0x7')](_0x609d('0x8'),attributes,{'tableName':_0x609d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x174ed5,_0x210ac6,_0x2b0d60){if(_0x174ed5['changed'](_0x609d('0xa'))){_0x174ed5['closedAt']=moment()['format'](_0x609d('0xb'));}_0x2b0d60(null,_0x174ed5);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 5bcd3e9..fc5ad3f 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 _0xbd6c=['options','raw','attributes','limit','debug','catch','AddTagsToWhatsappInteraction','find','where','addTags','omit','ids','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','UpdateWhatsappInteraction','WhatsappInteraction','body'];(function(_0x5c6772,_0x5e8d9e){var _0x4a5d6a=function(_0x4dd12c){while(--_0x4dd12c){_0x5c6772['push'](_0x5c6772['shift']());}};_0x4a5d6a(++_0x5e8d9e);}(_0xbd6c,0x1d0));var _0xcbd6=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xbd6c[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xcbd6('0x0'));var util=require(_0xcbd6('0x1'));var moment=require(_0xcbd6('0x2'));var BPromise=require('bluebird');var rs=require(_0xcbd6('0x3'));var fs=require('fs');var Redis=require(_0xcbd6('0x4'));var db=require(_0xcbd6('0x5'))['db'];var utils=require(_0xcbd6('0x6'));var logger=require('../../config/logger')(_0xcbd6('0x7'));var config=require(_0xcbd6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xcbd6('0x9')][_0xcbd6('0xa')]({'port':0x232a});config[_0xcbd6('0xb')]=_[_0xcbd6('0xc')](config[_0xcbd6('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xcbd6('0xd'))(new Redis(config[_0xcbd6('0xb')]));require(_0xcbd6('0xe'))['register'](socket);function respondWithRpcPromise(_0x1eb483,_0x54b582,_0x32daa3){return new BPromise(function(_0x48ae0c,_0x51f7d5){return client[_0xcbd6('0xf')](_0x1eb483,_0x32daa3)[_0xcbd6('0x10')](function(_0xef05ad){logger[_0xcbd6('0x11')](_0xcbd6('0x12'),_0x54b582,_0xcbd6('0x13'));logger['debug']('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x54b582,_0xcbd6('0x13'),JSON[_0xcbd6('0x14')](_0xef05ad));if(_0xef05ad[_0xcbd6('0x15')]){if(_0xef05ad[_0xcbd6('0x15')][_0xcbd6('0x16')]===0x1f4){logger[_0xcbd6('0x15')](_0xcbd6('0x12'),_0x54b582,_0xef05ad[_0xcbd6('0x15')][_0xcbd6('0x17')]);return _0x51f7d5(_0xef05ad[_0xcbd6('0x15')][_0xcbd6('0x17')]);}logger[_0xcbd6('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0x54b582,_0xef05ad[_0xcbd6('0x15')][_0xcbd6('0x17')]);return _0x48ae0c(_0xef05ad[_0xcbd6('0x15')][_0xcbd6('0x17')]);}else{logger[_0xcbd6('0x11')](_0xcbd6('0x12'),_0x54b582,_0xcbd6('0x13'));_0x48ae0c(_0xef05ad[_0xcbd6('0x18')][_0xcbd6('0x17')]);}})['catch'](function(_0x3728c4){logger[_0xcbd6('0x15')](_0xcbd6('0x12'),_0x54b582,_0x3728c4);_0x51f7d5(_0x3728c4);});});}exports[_0xcbd6('0x19')]=function(_0x2fd42e){var _0x27439e=this;return new Promise(function(_0x418d0d,_0x2bf9fb){return db[_0xcbd6('0x1a')]['update'](_0x2fd42e[_0xcbd6('0x1b')],{'raw':_0x2fd42e[_0xcbd6('0x1c')]?_0x2fd42e[_0xcbd6('0x1c')][_0xcbd6('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2fd42e['options']?_0x2fd42e[_0xcbd6('0x1c')]['where']||null:null,'attributes':_0x2fd42e[_0xcbd6('0x1c')]?_0x2fd42e[_0xcbd6('0x1c')][_0xcbd6('0x1e')]||null:null,'limit':_0x2fd42e[_0xcbd6('0x1c')]?_0x2fd42e[_0xcbd6('0x1c')][_0xcbd6('0x1f')]||null:null})['then'](function(_0x2a7944){logger[_0xcbd6('0x11')](_0xcbd6('0x19'),_0x2fd42e);logger[_0xcbd6('0x20')]('UpdateWhatsappInteraction',_0x2fd42e,JSON[_0xcbd6('0x14')](_0x2a7944));_0x418d0d(_0x2a7944);})[_0xcbd6('0x21')](function(_0x105a6d){logger[_0xcbd6('0x15')](_0xcbd6('0x19'),_0x105a6d['message'],_0x2fd42e);_0x2bf9fb(_0x27439e[_0xcbd6('0x15')](0x1f4,_0x105a6d[_0xcbd6('0x17')]));});});};exports[_0xcbd6('0x22')]=function(_0x1f3336){return new Promise(function(_0x5514b4,_0x3e5505){return db[_0xcbd6('0x1a')][_0xcbd6('0x23')]({'where':_0x1f3336['options']?_0x1f3336[_0xcbd6('0x1c')][_0xcbd6('0x24')]||null:null})[_0xcbd6('0x10')](function(_0x1e6d63){if(_0x1e6d63){return _0x1e6d63[_0xcbd6('0x25')](_0x1f3336[_0xcbd6('0x1b')]['ids'],_[_0xcbd6('0x26')](_0x1f3336[_0xcbd6('0x1b')],[_0xcbd6('0x27'),'id'])||{});}})['spread'](function(_0x2ff7eb){logger[_0xcbd6('0x11')](_0xcbd6('0x28'),_0x1f3336);logger[_0xcbd6('0x20')](_0xcbd6('0x28'),_0x1f3336,JSON[_0xcbd6('0x14')](_0x2ff7eb));_0x5514b4(_0x2ff7eb);})['catch'](function(_0x567337){logger['error']('AddTags',_0x567337[_0xcbd6('0x17')],_0x1f3336);_0x3e5505(_this[_0xcbd6('0x15')](0x1f4,_0x567337[_0xcbd6('0x17')]));});});}; \ No newline at end of file +var _0xf312=['limit','AddTagsToWhatsappInteraction','find','addTags','ids','omit','spread','AddTags','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','then','info','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','where','attributes'];(function(_0x2b91b9,_0x35c185){var _0x428e90=function(_0x2ba0b0){while(--_0x2ba0b0){_0x2b91b9['push'](_0x2b91b9['shift']());}};_0x428e90(++_0x35c185);}(_0xf312,0x179));var _0x2f31=function(_0x3a28e3,_0x168f52){_0x3a28e3=_0x3a28e3-0x0;var _0x54aac4=_0xf312[_0x3a28e3];return _0x54aac4;};'use strict';var _=require('lodash');var util=require(_0x2f31('0x0'));var moment=require(_0x2f31('0x1'));var BPromise=require(_0x2f31('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2f31('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2f31('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x2f31('0x5'));var jayson=require(_0x2f31('0x6'));var client=jayson['client'][_0x2f31('0x7')]({'port':0x232a});config[_0x2f31('0x8')]=_[_0x2f31('0x9')](config[_0x2f31('0x8')],{'host':_0x2f31('0xa'),'port':0x18eb});var socket=require(_0x2f31('0xb'))(new Redis(config[_0x2f31('0x8')]));require(_0x2f31('0xc'))[_0x2f31('0xd')](socket);function respondWithRpcPromise(_0x3fe578,_0x9d7e8d,_0x417727){return new BPromise(function(_0x4b30fa,_0x1e0020){return client['request'](_0x3fe578,_0x417727)[_0x2f31('0xe')](function(_0x47cc3c){logger[_0x2f31('0xf')]('WhatsappInteraction,\x20%s,\x20%s',_0x9d7e8d,_0x2f31('0x10'));logger[_0x2f31('0x11')](_0x2f31('0x12'),_0x9d7e8d,_0x2f31('0x10'),JSON[_0x2f31('0x13')](_0x47cc3c));if(_0x47cc3c[_0x2f31('0x14')]){if(_0x47cc3c[_0x2f31('0x14')][_0x2f31('0x15')]===0x1f4){logger[_0x2f31('0x14')](_0x2f31('0x16'),_0x9d7e8d,_0x47cc3c[_0x2f31('0x14')][_0x2f31('0x17')]);return _0x1e0020(_0x47cc3c[_0x2f31('0x14')]['message']);}logger[_0x2f31('0x14')](_0x2f31('0x16'),_0x9d7e8d,_0x47cc3c[_0x2f31('0x14')]['message']);return _0x4b30fa(_0x47cc3c[_0x2f31('0x14')][_0x2f31('0x17')]);}else{logger[_0x2f31('0xf')](_0x2f31('0x16'),_0x9d7e8d,_0x2f31('0x10'));_0x4b30fa(_0x47cc3c[_0x2f31('0x18')][_0x2f31('0x17')]);}})[_0x2f31('0x19')](function(_0x5ec8ee){logger[_0x2f31('0x14')]('WhatsappInteraction,\x20%s,\x20%s',_0x9d7e8d,_0x5ec8ee);_0x1e0020(_0x5ec8ee);});});}exports[_0x2f31('0x1a')]=function(_0xe9ca5f){var _0x26bf5b=this;return new Promise(function(_0x3b552b,_0x504a6c){return db[_0x2f31('0x1b')][_0x2f31('0x1c')](_0xe9ca5f[_0x2f31('0x1d')],{'raw':_0xe9ca5f['options']?_0xe9ca5f[_0x2f31('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe9ca5f[_0x2f31('0x1e')]?_0xe9ca5f[_0x2f31('0x1e')][_0x2f31('0x1f')]||null:null,'attributes':_0xe9ca5f[_0x2f31('0x1e')]?_0xe9ca5f[_0x2f31('0x1e')][_0x2f31('0x20')]||null:null,'limit':_0xe9ca5f['options']?_0xe9ca5f[_0x2f31('0x1e')][_0x2f31('0x21')]||null:null})[_0x2f31('0xe')](function(_0x14174c){logger['info'](_0x2f31('0x1a'),_0xe9ca5f);logger[_0x2f31('0x11')](_0x2f31('0x1a'),_0xe9ca5f,JSON[_0x2f31('0x13')](_0x14174c));_0x3b552b(_0x14174c);})['catch'](function(_0x4ce5da){logger[_0x2f31('0x14')]('UpdateWhatsappInteraction',_0x4ce5da['message'],_0xe9ca5f);_0x504a6c(_0x26bf5b[_0x2f31('0x14')](0x1f4,_0x4ce5da['message']));});});};exports[_0x2f31('0x22')]=function(_0x348a12){return new Promise(function(_0xc33708,_0x481f80){return db[_0x2f31('0x1b')][_0x2f31('0x23')]({'where':_0x348a12[_0x2f31('0x1e')]?_0x348a12[_0x2f31('0x1e')][_0x2f31('0x1f')]||null:null})[_0x2f31('0xe')](function(_0x3b366d){if(_0x3b366d){return _0x3b366d[_0x2f31('0x24')](_0x348a12[_0x2f31('0x1d')][_0x2f31('0x25')],_[_0x2f31('0x26')](_0x348a12[_0x2f31('0x1d')],[_0x2f31('0x25'),'id'])||{});}})[_0x2f31('0x27')](function(_0x43c214){logger[_0x2f31('0xf')](_0x2f31('0x28'),_0x348a12);logger[_0x2f31('0x11')](_0x2f31('0x28'),_0x348a12,JSON[_0x2f31('0x13')](_0x43c214));_0xc33708(_0x43c214);})[_0x2f31('0x19')](function(_0xdae53d){logger[_0x2f31('0x14')](_0x2f31('0x28'),_0xdae53d[_0x2f31('0x17')],_0x348a12);_0x481f80(_this['error'](0x1f4,_0xdae53d[_0x2f31('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index d308104..7c85b84 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 _0x1bee=['removeListener','register','length','whatsappInteraction:','save','update'];(function(_0x2081a3,_0xdc9e3){var _0x5a64d6=function(_0x2c6bb2){while(--_0x2c6bb2){_0x2081a3['push'](_0x2081a3['shift']());}};_0x5a64d6(++_0xdc9e3);}(_0x1bee,0x82));var _0xe1be=function(_0x28089e,_0x530f8a){_0x28089e=_0x28089e-0x0;var _0x46a73c=_0x1bee[_0x28089e];return _0x46a73c;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0xe1be('0x0'),'remove',_0xe1be('0x1')];function createListener(_0x31c47b,_0x2e4bfb){return function(_0x9e85de){_0x2e4bfb['emit'](_0x31c47b,_0x9e85de);};}function removeListener(_0x3d491c,_0xa73ab5){return function(){WhatsappInteractionEvents[_0xe1be('0x2')](_0x3d491c,_0xa73ab5);};}exports[_0xe1be('0x3')]=function(_0x431bce){for(var _0x1e28ac=0x0,_0x280143=events[_0xe1be('0x4')];_0x1e28ac<_0x280143;_0x1e28ac++){var _0x42b5c1=events[_0x1e28ac];var _0x1265b2=createListener(_0xe1be('0x5')+_0x42b5c1,_0x431bce);WhatsappInteractionEvents['on'](_0x42b5c1,_0x1265b2);}}; \ No newline at end of file +var _0xcb26=['length','save','update','emit','removeListener','register'];(function(_0x36ce02,_0x3e794d){var _0xed10fd=function(_0x2b00b){while(--_0x2b00b){_0x36ce02['push'](_0x36ce02['shift']());}};_0xed10fd(++_0x3e794d);}(_0xcb26,0x97));var _0x6cb2=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xcb26[_0x346737];return _0x1ade2e;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x6cb2('0x0'),'remove',_0x6cb2('0x1')];function createListener(_0x5205cc,_0x14b265){return function(_0x323742){_0x14b265[_0x6cb2('0x2')](_0x5205cc,_0x323742);};}function removeListener(_0xedc0a4,_0x330da1){return function(){WhatsappInteractionEvents[_0x6cb2('0x3')](_0xedc0a4,_0x330da1);};}exports[_0x6cb2('0x4')]=function(_0x332cf8){for(var _0x548b22=0x0,_0xde2bd6=events[_0x6cb2('0x5')];_0x548b22<_0xde2bd6;_0x548b22++){var _0x4cbb99=events[_0x548b22];var _0x2de7fd=createListener('whatsappInteraction:'+_0x4cbb99,_0x332cf8);WhatsappInteractionEvents['on'](_0x4cbb99,_0x2de7fd);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index ed8de69..55c6e85 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 _0xef55=['show','post','tracked','whatsappmessage:create','create','status','update','put','/:id/accept','reject','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x3c3285,_0x2c0e23){var _0x6065c0=function(_0x40b071){while(--_0x40b071){_0x3c3285['push'](_0x3c3285['shift']());}};_0x6065c0(++_0x2c0e23);}(_0xef55,0x191));var _0x5ef5=function(_0x1afe96,_0x404ff6){_0x1afe96=_0x1afe96-0x0;var _0x3038cc=_0xef55[_0x1afe96];return _0x3038cc;};'use strict';var multer=require(_0x5ef5('0x0'));var util=require(_0x5ef5('0x1'));var path=require(_0x5ef5('0x2'));var timeout=require(_0x5ef5('0x3'));var express=require(_0x5ef5('0x4'));var router=express['Router']();var fs_extra=require(_0x5ef5('0x5'));var auth=require(_0x5ef5('0x6'));var interaction=require(_0x5ef5('0x7'));var config=require(_0x5ef5('0x8'));var controller=require(_0x5ef5('0x9'));router[_0x5ef5('0xa')]('/',auth[_0x5ef5('0xb')](),controller[_0x5ef5('0xc')]);router[_0x5ef5('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x5ef5('0xd')]);router[_0x5ef5('0xa')](_0x5ef5('0xe'),auth['isAuthenticated'](),controller[_0x5ef5('0xf')]);router[_0x5ef5('0x10')]('/',auth[_0x5ef5('0xb')](),interaction[_0x5ef5('0x11')]('whatsapp',_0x5ef5('0x12')),controller[_0x5ef5('0x13')]);router[_0x5ef5('0x10')]('/:id/status',controller[_0x5ef5('0x14')]);router['put'](_0x5ef5('0xe'),auth['isAuthenticated'](),controller[_0x5ef5('0x15')]);router[_0x5ef5('0x16')](_0x5ef5('0x17'),auth[_0x5ef5('0xb')](),controller['accept']);router[_0x5ef5('0x16')]('/:id/reject',auth[_0x5ef5('0xb')](),controller[_0x5ef5('0x18')]);router[_0x5ef5('0x19')](_0x5ef5('0xe'),auth[_0x5ef5('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x97d3=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','reject','delete','util','path','connect-timeout','fs-extra'];(function(_0x584308,_0x1379b3){var _0x45865b=function(_0x145a82){while(--_0x145a82){_0x584308['push'](_0x584308['shift']());}};_0x45865b(++_0x1379b3);}(_0x97d3,0x140));var _0x397d=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0x97d3[_0x342700];return _0x53406f;};'use strict';var multer=require('multer');var util=require(_0x397d('0x0'));var path=require(_0x397d('0x1'));var timeout=require(_0x397d('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x397d('0x3'));var auth=require(_0x397d('0x4'));var interaction=require(_0x397d('0x5'));var config=require(_0x397d('0x6'));var controller=require('./whatsappMessage.controller');router[_0x397d('0x7')]('/',auth[_0x397d('0x8')](),controller[_0x397d('0x9')]);router[_0x397d('0x7')](_0x397d('0xa'),auth[_0x397d('0x8')](),controller[_0x397d('0xb')]);router['get'](_0x397d('0xc'),auth[_0x397d('0x8')](),controller[_0x397d('0xd')]);router[_0x397d('0xe')]('/',auth[_0x397d('0x8')](),interaction[_0x397d('0xf')](_0x397d('0x10'),_0x397d('0x11')),controller[_0x397d('0x12')]);router['post'](_0x397d('0x13'),controller[_0x397d('0x14')]);router[_0x397d('0x15')](_0x397d('0xc'),auth[_0x397d('0x8')](),controller[_0x397d('0x16')]);router['put'](_0x397d('0x17'),auth[_0x397d('0x8')](),controller[_0x397d('0x18')]);router[_0x397d('0x15')]('/:id/reject',auth[_0x397d('0x8')](),controller[_0x397d('0x19')]);router[_0x397d('0x1a')](_0x397d('0xc'),auth[_0x397d('0x8')](),controller['destroy']);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 6873390..4ff9052 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 _0x677f=['sequelize','exports','medium','BOOLEAN','out','STRING','DATE','TEXT'];(function(_0x3d485b,_0x44118a){var _0x48a23c=function(_0x9d5b17){while(--_0x9d5b17){_0x3d485b['push'](_0x3d485b['shift']());}};_0x48a23c(++_0x44118a);}(_0x677f,0xf8));var _0xf677=function(_0x3b647c,_0x466d43){_0x3b647c=_0x3b647c-0x0;var _0x536cff=_0x677f[_0x3b647c];return _0x536cff;};'use strict';var Sequelize=require(_0xf677('0x0'));module[_0xf677('0x1')]={'body':{'type':Sequelize['TEXT'](_0xf677('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xf677('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xf677('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xf677('0x5')](0xbe)},'phone':{'type':Sequelize[_0xf677('0x5')]},'readAt':{'type':Sequelize[_0xf677('0x6')]},'secret':{'type':Sequelize[_0xf677('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xf677('0x5')]},'providerResponse':{'type':Sequelize[_0xf677('0x7')]}}; \ No newline at end of file +var _0x8f2d=['ENUM','STRING','DATE','sequelize','exports','medium','BOOLEAN'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x8f2d,0xd5));var _0xd8f2=function(_0x28bd31,_0x379174){_0x28bd31=_0x28bd31-0x0;var _0x56d6dd=_0x8f2d[_0x28bd31];return _0x56d6dd;};'use strict';var Sequelize=require(_0xd8f2('0x0'));module[_0xd8f2('0x1')]={'body':{'type':Sequelize['TEXT'](_0xd8f2('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xd8f2('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd8f2('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xd8f2('0x5')](0xbe)},'phone':{'type':Sequelize[_0xd8f2('0x5')]},'readAt':{'type':Sequelize[_0xd8f2('0x6')]},'secret':{'type':Sequelize[_0xd8f2('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xd8f2('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 53d76fb..9bea15f 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 _0x4af3=['redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','client','http','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','undefined','count','limit','Content-Range','apply','reject','update','destroy','then','name','send','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','offset','order','sort','where','pick','filter','merge','includeAll','include','WhatsappMessage','rows','show','params','rawAttributes','length','find','create','body','describe','whatsapp-interactions','whatsapp','read','readAt','format','user','agent','get','WhatsappInteraction','WhatsappInteractionId','UserId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','fullname','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','SELECT','email','motionChannel','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','eml-format','zip-dir','request-promise','moment','util','path','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x4af3,0x72));var _0x34af=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x4af3[_0x2064e5];return _0x21a233;};'use strict';var emlformat=require(_0x34af('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x34af('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x34af('0x2'));var moment=require(_0x34af('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x34af('0x4'));var path=require(_0x34af('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x34af('0x6'));var fs=require('fs');var fs_extra=require(_0x34af('0x7'));var _=require(_0x34af('0x8'));var squel=require(_0x34af('0x9'));var crypto=require('crypto');var jsforce=require(_0x34af('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x34af('0xb'));var querystring=require(_0x34af('0xc'));var Papa=require('papaparse');var Redis=require(_0x34af('0xd'));var authService=require(_0x34af('0xe'));var qs=require(_0x34af('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x34af('0x10'))(_0x34af('0x11'));var utils=require(_0x34af('0x12'));var config=require(_0x34af('0x13'));var licenseUtil=require(_0x34af('0x14'));var db=require(_0x34af('0x15'))['db'];config['redis']=_['defaults'](config[_0x34af('0x16')],{'host':_0x34af('0x17'),'port':0x18eb});var socket=require(_0x34af('0x18'))(new Redis(config[_0x34af('0x16')]));require(_0x34af('0x19'))[_0x34af('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0x34af('0x1b')][_0x34af('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0x34af('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x29d2e,_0x2c4e87,_0x45f3d4,_0xaf1012){return new BPromise(function(_0x1ebe54,_0x3154de){var _0x2751ac=_0xaf1012||client;return _0x2751ac[_0x34af('0x1d')](_0x29d2e,_0x45f3d4)['then'](function(_0x19e5a5){logger[_0x34af('0x1e')](_0x34af('0x1f'),_0x2c4e87,_0x34af('0x20'));logger[_0x34af('0x21')](_0x34af('0x22'),_0x2c4e87,'request\x20sent',JSON[_0x34af('0x23')](_0x19e5a5));if(_0x19e5a5[_0x34af('0x24')]){if(_0x19e5a5[_0x34af('0x24')]['code']===0x1f4){logger[_0x34af('0x24')]('WhatsappMessage,\x20%s,\x20%s',_0x2c4e87,_0x19e5a5[_0x34af('0x24')][_0x34af('0x25')]);return _0x3154de(_0x19e5a5[_0x34af('0x24')][_0x34af('0x25')]);}logger['error'](_0x34af('0x1f'),_0x2c4e87,_0x19e5a5[_0x34af('0x24')]['message']);return _0x1ebe54(_0x19e5a5['error'][_0x34af('0x25')]);}else{logger[_0x34af('0x1e')](_0x34af('0x1f'),_0x2c4e87,_0x34af('0x20'));_0x1ebe54(_0x19e5a5[_0x34af('0x26')][_0x34af('0x25')]);}})[_0x34af('0x27')](function(_0x2acaed){logger[_0x34af('0x24')](_0x34af('0x1f'),_0x2c4e87,_0x2acaed);_0x3154de(_0x2acaed);});});}function respondWithStatusCode(_0x36f0ef,_0x2299de){_0x2299de=_0x2299de||0xcc;return function(_0x313b76){if(_0x313b76){return _0x36f0ef[_0x34af('0x28')](_0x2299de);}return _0x36f0ef[_0x34af('0x29')](_0x2299de)['end']();};}function respondWithResult(_0x30d35d,_0x34d270){_0x34d270=_0x34d270||0xc8;return function(_0x53e69b){if(_0x53e69b){return _0x30d35d[_0x34af('0x29')](_0x34d270)[_0x34af('0x2a')](_0x53e69b);}};}function respondWithFilteredResult(_0x1f0e56,_0x2694d4){return function(_0x230680){if(_0x230680){var _0x38ed52=typeof _0x2694d4['offset']==='undefined'&&typeof _0x2694d4['limit']===_0x34af('0x2b');var _0x450028=_0x230680['count'];var _0x36b7f4=_0x38ed52?0x0:_0x2694d4['offset'];var _0x13551e=_0x38ed52?_0x230680[_0x34af('0x2c')]:_0x2694d4['offset']+_0x2694d4[_0x34af('0x2d')];var _0x9c5195;if(_0x13551e>=_0x450028){_0x13551e=_0x450028;_0x9c5195=0xc8;}else{_0x9c5195=0xce;}_0x1f0e56[_0x34af('0x29')](_0x9c5195);return _0x1f0e56['set'](_0x34af('0x2e'),_0x36b7f4+'-'+_0x13551e+'/'+_0x450028)[_0x34af('0x2a')](_0x230680);}return null;};}function patchUpdates(_0x32dd2a){return function(_0x2d7150){try{jsonpatch[_0x34af('0x2f')](_0x2d7150,_0x32dd2a,!![]);}catch(_0x218425){return BPromise[_0x34af('0x30')](_0x218425);}return _0x2d7150['save']();};}function saveUpdates(_0x4fbe44,_0x364590){return function(_0x2ea221){if(_0x2ea221){return _0x2ea221[_0x34af('0x31')](_0x4fbe44)['then'](function(_0x89273f){return _0x89273f;});}return null;};}function removeEntity(_0x2f65f4,_0xfa9801){return function(_0x215380){if(_0x215380){return _0x215380[_0x34af('0x32')]()[_0x34af('0x33')](function(){_0x2f65f4[_0x34af('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x103473,_0x23610b){return function(_0x26c707){if(!_0x26c707){_0x103473[_0x34af('0x28')](0x194);}return _0x26c707;};}function handleError(_0x548aa6,_0x4473d9){_0x4473d9=_0x4473d9||0x1f4;return function(_0x18365b){logger[_0x34af('0x24')](_0x18365b['stack']);if(_0x18365b[_0x34af('0x34')]){delete _0x18365b[_0x34af('0x34')];}_0x548aa6['status'](_0x4473d9)[_0x34af('0x35')](_0x18365b);};}exports['index']=function(_0x50646e,_0x197ad1){var _0x557f43={},_0x50a172={},_0x6e877b={'count':0x0,'rows':[]};var _0x54f90d=_[_0x34af('0x36')](db['WhatsappMessage']['rawAttributes'],function(_0x4128a7){return{'name':_0x4128a7[_0x34af('0x37')],'type':_0x4128a7[_0x34af('0x38')][_0x34af('0x39')]};});_0x50a172[_0x34af('0x3a')]=_['map'](_0x54f90d,_0x34af('0x34'));_0x50a172[_0x34af('0x3b')]=_[_0x34af('0x3c')](_0x50646e[_0x34af('0x3b')]);_0x50a172['filters']=_[_0x34af('0x3d')](_0x50a172['model'],_0x50a172[_0x34af('0x3b')]);_0x557f43[_0x34af('0x3e')]=_['intersection'](_0x50a172[_0x34af('0x3a')],qs[_0x34af('0x3f')](_0x50646e[_0x34af('0x3b')]['fields']));_0x557f43['attributes']=_0x557f43['attributes']['length']?_0x557f43[_0x34af('0x3e')]:_0x50a172['model'];if(!_0x50646e[_0x34af('0x3b')][_0x34af('0x40')]('nolimit')){_0x557f43['limit']=qs[_0x34af('0x2d')](_0x50646e['query']['limit']);_0x557f43[_0x34af('0x41')]=qs['offset'](_0x50646e[_0x34af('0x3b')][_0x34af('0x41')]);}_0x557f43[_0x34af('0x42')]=qs[_0x34af('0x43')](_0x50646e['query'][_0x34af('0x43')]);_0x557f43[_0x34af('0x44')]=qs['filters'](_[_0x34af('0x45')](_0x50646e[_0x34af('0x3b')],_0x50a172['filters']),_0x54f90d);if(_0x50646e[_0x34af('0x3b')][_0x34af('0x46')]){_0x557f43[_0x34af('0x44')]=_['merge'](_0x557f43[_0x34af('0x44')],{'$or':_[_0x34af('0x36')](_0x54f90d,function(_0x5e5836){if(_0x5e5836[_0x34af('0x38')]!=='VIRTUAL'){var _0x4c019b={};_0x4c019b[_0x5e5836[_0x34af('0x34')]]={'$like':'%'+_0x50646e['query'][_0x34af('0x46')]+'%'};return _0x4c019b;}})});}_0x557f43=_[_0x34af('0x47')]({},_0x557f43,_0x50646e['options']);var _0x4fb3ff={'where':_0x557f43[_0x34af('0x44')]};return db['WhatsappMessage']['count'](_0x4fb3ff)[_0x34af('0x33')](function(_0x5388a4){_0x6e877b[_0x34af('0x2c')]=_0x5388a4;if(_0x50646e[_0x34af('0x3b')][_0x34af('0x48')]){_0x557f43[_0x34af('0x49')]=[{'all':!![]}];}return db[_0x34af('0x4a')]['findAll'](_0x557f43);})['then'](function(_0x44e91f){_0x6e877b[_0x34af('0x4b')]=_0x44e91f;return _0x6e877b;})[_0x34af('0x33')](respondWithFilteredResult(_0x197ad1,_0x557f43))['catch'](handleError(_0x197ad1,null));};exports[_0x34af('0x4c')]=function(_0x4bedea,_0x239dda){var _0x5a0f9f={'raw':!![],'where':{'id':_0x4bedea[_0x34af('0x4d')]['id']}},_0x289e03={};_0x289e03[_0x34af('0x3a')]=_['keys'](db[_0x34af('0x4a')][_0x34af('0x4e')]);_0x289e03[_0x34af('0x3b')]=_['keys'](_0x4bedea[_0x34af('0x3b')]);_0x289e03['filters']=_[_0x34af('0x3d')](_0x289e03[_0x34af('0x3a')],_0x289e03[_0x34af('0x3b')]);_0x5a0f9f[_0x34af('0x3e')]=_['intersection'](_0x289e03[_0x34af('0x3a')],qs[_0x34af('0x3f')](_0x4bedea['query']['fields']));_0x5a0f9f[_0x34af('0x3e')]=_0x5a0f9f[_0x34af('0x3e')][_0x34af('0x4f')]?_0x5a0f9f['attributes']:_0x289e03[_0x34af('0x3a')];if(_0x4bedea[_0x34af('0x3b')][_0x34af('0x48')]){_0x5a0f9f[_0x34af('0x49')]=[{'all':!![]}];}_0x5a0f9f=_[_0x34af('0x47')]({},_0x5a0f9f,_0x4bedea['options']);return db[_0x34af('0x4a')][_0x34af('0x50')](_0x5a0f9f)[_0x34af('0x33')](handleEntityNotFound(_0x239dda,null))['then'](respondWithResult(_0x239dda,null))[_0x34af('0x27')](handleError(_0x239dda,null));};exports[_0x34af('0x51')]=function(_0x34315d,_0x429ad5){return db[_0x34af('0x4a')][_0x34af('0x51')](_0x34315d[_0x34af('0x52')],{})[_0x34af('0x33')](respondWithResult(_0x429ad5,0xc9))['catch'](handleError(_0x429ad5,null));};exports[_0x34af('0x31')]=function(_0x162273,_0x224a2b){if(_0x162273[_0x34af('0x52')]['id']){delete _0x162273[_0x34af('0x52')]['id'];}return db[_0x34af('0x4a')][_0x34af('0x50')]({'where':{'id':_0x162273['params']['id']}})['then'](handleEntityNotFound(_0x224a2b,null))[_0x34af('0x33')](saveUpdates(_0x162273[_0x34af('0x52')],null))[_0x34af('0x33')](respondWithResult(_0x224a2b,null))[_0x34af('0x27')](handleError(_0x224a2b,null));};exports[_0x34af('0x32')]=function(_0x1873e0,_0x1128bb){return db['WhatsappMessage']['find']({'where':{'id':_0x1873e0['params']['id']}})[_0x34af('0x33')](handleEntityNotFound(_0x1128bb,null))[_0x34af('0x33')](removeEntity(_0x1128bb,null))[_0x34af('0x27')](handleError(_0x1128bb,null));};exports[_0x34af('0x53')]=function(_0x40a461,_0x48a5dc){return db[_0x34af('0x4a')][_0x34af('0x53')]()['then'](respondWithResult(_0x48a5dc,null))['catch'](handleError(_0x48a5dc,null));};var interaction_log=require(_0x34af('0x10'))(_0x34af('0x54'));exports['accept']=function(_0x476d1a,_0x4cf2fe,_0x1f6179){var _0x1695da={'agent':{},'channel':_0x34af('0x55')};if(_0x476d1a[_0x34af('0x52')]['id']){delete _0x476d1a[_0x34af('0x52')]['id'];}_0x476d1a[_0x34af('0x52')][_0x34af('0x56')]=!![];_0x476d1a[_0x34af('0x52')][_0x34af('0x57')]=moment()[_0x34af('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x476d1a[_0x34af('0x52')]['UserId']=_0x476d1a[_0x34af('0x52')]['UserId']||_0x476d1a[_0x34af('0x59')]['id'];_0x1695da[_0x34af('0x5a')]['id']=_0x476d1a[_0x34af('0x52')]['UserId'];return db[_0x34af('0x4a')][_0x34af('0x50')]({'where':{'id':_0x476d1a[_0x34af('0x4d')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4cf2fe,null))[_0x34af('0x33')](saveUpdates(_0x476d1a[_0x34af('0x52')],null))[_0x34af('0x33')](function(_0x3aa9ce){if(_0x3aa9ce){_0x1695da[_0x34af('0x25')]=_0x3aa9ce[_0x34af('0x5b')]({'plain':!![]});return db[_0x34af('0x5c')][_0x34af('0x50')]({'where':{'id':_0x3aa9ce[_0x34af('0x5d')]}});}return null;})[_0x34af('0x33')](handleEntityNotFound(_0x4cf2fe,null))[_0x34af('0x33')](function(_0x4a1861){if(_0x4a1861){return _0x4a1861['update']({'UserId':_0x476d1a['body'][_0x34af('0x5e')],'read1stAt':_[_0x34af('0x5f')](_0x4a1861[_0x34af('0x60')])?moment()['format'](_0x34af('0x61')):undefined});}return null;})[_0x34af('0x33')](function(_0x250d1e){if(_0x250d1e){_0x1695da['interaction']=_0x250d1e[_0x34af('0x5b')]({'plain':!![]});interaction_log[_0x34af('0x1e')](_0x34af('0x62'),_0x476d1a[_0x34af('0x59')]['id'],_0x476d1a['user'][_0x34af('0x34')],_0x476d1a[_0x34af('0x59')]['role'],_0x1695da[_0x34af('0x63')]['id'],_0x476d1a[_0x34af('0x52')]?JSON[_0x34af('0x23')](_0x476d1a[_0x34af('0x52')]):'null');return respondWithRpcPromise(_0x34af('0x64'),_0x34af('0x65'),_0x1695da);}return null;})[_0x34af('0x33')](function(_0x4b9cb0){var _0x5deb2a=_0x34af('0x66')+_0x4b9cb0[_0x34af('0x25')][_0x34af('0x67')];return db[_0x34af('0x68')][_0x34af('0x3b')](_0x5deb2a,{'type':db[_0x34af('0x69')][_0x34af('0x6a')]['SELECT'],'raw':!![]})[_0x34af('0x33')](function(_0x458523){return _0x458523;});})['then'](function(_0x44c10a){if(_0x44c10a){_0x1695da[_0x34af('0x25')][_0x34af('0x6b')]=_0x44c10a[0x0];if(!_0x476d1a[_0x34af('0x52')]['UserId'])return;return db[_0x34af('0x6c')][_0x34af('0x50')]({'where':{'id':_0x476d1a['body'][_0x34af('0x5e')],'role':_0x34af('0x5a')},'attributes':['id',_0x34af('0x34'),_0x34af('0x6d'),'email',_0x34af('0x6e')],'raw':!![]});}return null;})[_0x34af('0x33')](function(_0x5b3350){if(!_0x5b3350)return null;_0x1695da[_0x34af('0x25')]['agent']=_0x5b3350;return _0x1695da;})[_0x34af('0x33')](function(_0x367a2e){if(_0x367a2e){if(_0x476d1a[_0x34af('0x52')][_0x34af('0x6f')]){_0x1695da[_0x34af('0x25')][_0x34af('0x70')]=util[_0x34af('0x58')](_0x34af('0x71'),_0x476d1a['user'][_0x34af('0x34')]);_0x1695da['message'][_0x34af('0x72')]=_0x1695da[_0x34af('0x72')];_0x1695da[_0x34af('0x25')]['motionChannel']=_0x1695da[_0x34af('0x72')];_0x1695da[_0x34af('0x25')][_0x34af('0x73')]='accept';return respondWithRpcPromise('EventManager',_0x34af('0x74'),{'event':_0x34af('0x75'),'message':_0x1695da[_0x34af('0x25')]},client9002)[_0x34af('0x33')](function(){return _0x1695da;});}return _0x1695da;}return null;})[_0x34af('0x33')](respondWithResult(_0x4cf2fe,null))[_0x34af('0x27')](handleError(_0x4cf2fe,null));};var interaction_log=require(_0x34af('0x10'))(_0x34af('0x54'));exports['reject']=function(_0xd9cabf,_0x185377,_0x23d019){var _0x5de314={'agent':{},'channel':_0x34af('0x55')};if(_0xd9cabf[_0x34af('0x52')]['id']){delete _0xd9cabf[_0x34af('0x52')]['id'];}_0xd9cabf[_0x34af('0x52')]['UserId']=_0xd9cabf['body'][_0x34af('0x5e')]||_0xd9cabf[_0x34af('0x59')]['id'];_0x5de314[_0x34af('0x5a')]['id']=_0xd9cabf[_0x34af('0x52')][_0x34af('0x5e')];return db['WhatsappMessage'][_0x34af('0x50')]({'where':{'id':_0xd9cabf[_0x34af('0x4d')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x185377,null))[_0x34af('0x33')](function(_0x2c48f3){if(_0x2c48f3){_0x5de314[_0x34af('0x25')]=_0x2c48f3[_0x34af('0x5b')]({'plain':!![]});return db[_0x34af('0x5c')][_0x34af('0x50')]({'where':{'id':_0x2c48f3[_0x34af('0x5d')]}});}return null;})[_0x34af('0x33')](handleEntityNotFound(_0x185377,null))[_0x34af('0x33')](function(_0x6748f4){if(_0x6748f4){_0x5de314[_0x34af('0x63')]=_0x6748f4['get']({'plain':!![]});interaction_log[_0x34af('0x1e')](_0x34af('0x76'),_0xd9cabf['user']['id'],_0xd9cabf[_0x34af('0x59')][_0x34af('0x34')],_0xd9cabf['user'][_0x34af('0x77')],_0x5de314[_0x34af('0x63')]['id'],_0xd9cabf[_0x34af('0x52')]?JSON[_0x34af('0x23')](_0xd9cabf['body']):_0x34af('0x78'));return respondWithRpcPromise(_0x34af('0x79'),_0x34af('0x7a'),_0x5de314);}return null;})['then'](function(_0xe92b0d){var _0xd9bfb2=_0x34af('0x66')+_0xe92b0d[_0x34af('0x25')][_0x34af('0x67')];return db[_0x34af('0x68')][_0x34af('0x3b')](_0xd9bfb2,{'type':db[_0x34af('0x69')]['QueryTypes'][_0x34af('0x7b')],'raw':!![]})[_0x34af('0x33')](function(_0x1cee6d){return _0x1cee6d;});})['then'](function(_0x5c7ba0){if(_0x5c7ba0){_0x5de314[_0x34af('0x25')]['contact']=_0x5c7ba0[0x0];if(!_0xd9cabf[_0x34af('0x52')][_0x34af('0x5e')])return;return db['User'][_0x34af('0x50')]({'where':{'id':_0xd9cabf['body'][_0x34af('0x5e')],'role':'agent'},'attributes':['id',_0x34af('0x34'),_0x34af('0x6d'),_0x34af('0x7c'),_0x34af('0x6e')],'raw':!![]});}return null;})[_0x34af('0x33')](function(_0x1ab441){if(!_0x1ab441)return null;_0x5de314[_0x34af('0x25')]['agent']=_0x1ab441;return _0x5de314;})[_0x34af('0x33')](function(_0x313b22){if(_0x313b22){_0x313b22[_0x34af('0x25')][_0x34af('0x70')]=util['format'](_0x34af('0x71'),_0xd9cabf[_0x34af('0x59')][_0x34af('0x34')]);_0x313b22[_0x34af('0x25')][_0x34af('0x72')]=_0x5de314[_0x34af('0x72')];_0x313b22['message'][_0x34af('0x7d')]=_0x5de314['channel'];_0x313b22['message'][_0x34af('0x73')]=_0x34af('0x30');respondWithRpcPromise(_0x34af('0x74'),_0x34af('0x74'),{'event':_0x34af('0x7e'),'message':_0x313b22[_0x34af('0x25')]},client9002);return _0x5de314;}return null;})[_0x34af('0x33')](respondWithResult(_0x185377,null))['catch'](handleError(_0x185377,null));};exports[_0x34af('0x29')]=function(_0x295f17,_0x4c55c3,_0xd89620){if(_0x295f17[_0x34af('0x52')]['id']){delete _0x295f17['body']['id'];}var _0x2024ce;return db['WhatsappMessage'][_0x34af('0x50')]({'where':{'id':_0x295f17[_0x34af('0x4d')]['id']}})[_0x34af('0x33')](handleEntityNotFound(_0x4c55c3,null))[_0x34af('0x33')](function(_0x398384){if(_0x398384){_0x2024ce=_0x398384;return db[_0x34af('0x7f')]['find']({'where':{'id':_0x398384[_0x34af('0x80')]}});}})[_0x34af('0x33')](handleEntityNotFound(_0x4c55c3,null))['then'](function(_0x5473a6){if(_0x5473a6){logger[_0x34af('0x21')](_0x34af('0x81'),'status','received\x20delivery\x20report\x20from',_0x5473a6[_0x34af('0x38')],util['inspect'](_0x295f17[_0x34af('0x52')],{'showHidden':![],'depth':null}));switch(_0x5473a6[_0x34af('0x38')]){case _0x34af('0x82'):if(_0x295f17[_0x34af('0x52')][_0x34af('0x83')]&&_0x295f17['body'][_0x34af('0x83')]===_0x2024ce[_0x34af('0x84')]&&_0x295f17[_0x34af('0x52')][_0x34af('0x85')]&&_0x295f17[_0x34af('0x52')]['MessageStatus']===_0x34af('0x56')){return _0x2024ce[_0x34af('0x31')]({'read':!![]});}else{logger[_0x34af('0x24')](_0x34af('0x86'),_0x34af('0x29'),_0x34af('0x82'),util[_0x34af('0x87')](_0x295f17[_0x34af('0x52')],{'showHidden':![],'depth':null}));}break;}return _0x2024ce;}})[_0x34af('0x33')](respondWithResult(_0x4c55c3,null))[_0x34af('0x27')](handleError(_0x4c55c3,null));}; \ No newline at end of file +var _0x1c22=['where','filter','merge','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','whatsapp-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','email','internal','manual','interface','channel','event','EventManager','acceptmessage','whatsapp','info','RejectMessage','fullname','SIP/%s','motionChannel','WhatsappAccount','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','rimraf','zip-dir','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/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','./whatsappMessage.socket','client','http','request','then','request\x20sent','stringify','error','WhatsappMessage,\x20%s,\x20%s','message','sendStatus','status','end','limit','count','offset','set','json','reject','save','update','destroy','stack','name','index','WhatsappMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1c22,0x1d4));var _0x21c2=function(_0x4a36cc,_0x20f92d){_0x4a36cc=_0x4a36cc-0x0;var _0x4a1127=_0x1c22[_0x4a36cc];return _0x4a1127;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x21c2('0x0'));var zipdir=require(_0x21c2('0x1'));var jsonpatch=require(_0x21c2('0x2'));var rp=require(_0x21c2('0x3'));var moment=require(_0x21c2('0x4'));var BPromise=require(_0x21c2('0x5'));var Mustache=require(_0x21c2('0x6'));var util=require(_0x21c2('0x7'));var path=require(_0x21c2('0x8'));var sox=require(_0x21c2('0x9'));var csv=require(_0x21c2('0xa'));var ejs=require(_0x21c2('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x21c2('0xc'));var squel=require(_0x21c2('0xd'));var crypto=require(_0x21c2('0xe'));var jsforce=require(_0x21c2('0xf'));var deskjs=require(_0x21c2('0x10'));var toCsv=require('to-csv');var querystring=require(_0x21c2('0x11'));var Papa=require(_0x21c2('0x12'));var Redis=require(_0x21c2('0x13'));var authService=require(_0x21c2('0x14'));var qs=require(_0x21c2('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x21c2('0x16'))(_0x21c2('0x17'));var utils=require(_0x21c2('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x21c2('0x19'));var db=require(_0x21c2('0x1a'))['db'];config[_0x21c2('0x1b')]=_['defaults'](config[_0x21c2('0x1b')],{'host':_0x21c2('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x21c2('0x1d'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x21c2('0x1e')][_0x21c2('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x11252a,_0x3c7567,_0x270d6b,_0x80c45f){return new BPromise(function(_0x311617,_0x7df785){var _0x349dec=_0x80c45f||client;return _0x349dec[_0x21c2('0x20')](_0x11252a,_0x270d6b)[_0x21c2('0x21')](function(_0x471238){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x3c7567,_0x21c2('0x22'));logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x3c7567,_0x21c2('0x22'),JSON[_0x21c2('0x23')](_0x471238));if(_0x471238[_0x21c2('0x24')]){if(_0x471238[_0x21c2('0x24')]['code']===0x1f4){logger[_0x21c2('0x24')](_0x21c2('0x25'),_0x3c7567,_0x471238['error'][_0x21c2('0x26')]);return _0x7df785(_0x471238['error'][_0x21c2('0x26')]);}logger['error'](_0x21c2('0x25'),_0x3c7567,_0x471238[_0x21c2('0x24')][_0x21c2('0x26')]);return _0x311617(_0x471238['error']['message']);}else{logger['info'](_0x21c2('0x25'),_0x3c7567,_0x21c2('0x22'));_0x311617(_0x471238['result'][_0x21c2('0x26')]);}})['catch'](function(_0x276475){logger['error'](_0x21c2('0x25'),_0x3c7567,_0x276475);_0x7df785(_0x276475);});});}function respondWithStatusCode(_0x341554,_0x4629d1){_0x4629d1=_0x4629d1||0xcc;return function(_0x5c07f1){if(_0x5c07f1){return _0x341554[_0x21c2('0x27')](_0x4629d1);}return _0x341554[_0x21c2('0x28')](_0x4629d1)[_0x21c2('0x29')]();};}function respondWithResult(_0x184187,_0x22446f){_0x22446f=_0x22446f||0xc8;return function(_0x5d376a){if(_0x5d376a){return _0x184187[_0x21c2('0x28')](_0x22446f)['json'](_0x5d376a);}};}function respondWithFilteredResult(_0x33e848,_0x14e8f1){return function(_0x3be9ed){if(_0x3be9ed){var _0x323281=typeof _0x14e8f1['offset']==='undefined'&&typeof _0x14e8f1[_0x21c2('0x2a')]==='undefined';var _0x3060f4=_0x3be9ed[_0x21c2('0x2b')];var _0x374847=_0x323281?0x0:_0x14e8f1['offset'];var _0x3d2677=_0x323281?_0x3be9ed[_0x21c2('0x2b')]:_0x14e8f1[_0x21c2('0x2c')]+_0x14e8f1[_0x21c2('0x2a')];var _0x4e548b;if(_0x3d2677>=_0x3060f4){_0x3d2677=_0x3060f4;_0x4e548b=0xc8;}else{_0x4e548b=0xce;}_0x33e848[_0x21c2('0x28')](_0x4e548b);return _0x33e848[_0x21c2('0x2d')]('Content-Range',_0x374847+'-'+_0x3d2677+'/'+_0x3060f4)[_0x21c2('0x2e')](_0x3be9ed);}return null;};}function patchUpdates(_0x104834){return function(_0x34397){try{jsonpatch['apply'](_0x34397,_0x104834,!![]);}catch(_0x15a293){return BPromise[_0x21c2('0x2f')](_0x15a293);}return _0x34397[_0x21c2('0x30')]();};}function saveUpdates(_0x1f703f,_0x322f50){return function(_0x540a72){if(_0x540a72){return _0x540a72[_0x21c2('0x31')](_0x1f703f)['then'](function(_0x333636){return _0x333636;});}return null;};}function removeEntity(_0xc977fc,_0x2fed5f){return function(_0xaee3fe){if(_0xaee3fe){return _0xaee3fe[_0x21c2('0x32')]()['then'](function(){_0xc977fc[_0x21c2('0x28')](0xcc)[_0x21c2('0x29')]();});}};}function handleEntityNotFound(_0x1aa54f,_0x2cb658){return function(_0x4e3fe7){if(!_0x4e3fe7){_0x1aa54f[_0x21c2('0x27')](0x194);}return _0x4e3fe7;};}function handleError(_0x327a1d,_0x3da5b3){_0x3da5b3=_0x3da5b3||0x1f4;return function(_0x28db2e){logger[_0x21c2('0x24')](_0x28db2e[_0x21c2('0x33')]);if(_0x28db2e[_0x21c2('0x34')]){delete _0x28db2e[_0x21c2('0x34')];}_0x327a1d[_0x21c2('0x28')](_0x3da5b3)['send'](_0x28db2e);};}exports[_0x21c2('0x35')]=function(_0xd9a56e,_0x2edc22){var _0xe2f98e={},_0x42bef1={},_0x2ca0ea={'count':0x0,'rows':[]};var _0x2f9b11=_['map'](db[_0x21c2('0x36')][_0x21c2('0x37')],function(_0x18802e){return{'name':_0x18802e[_0x21c2('0x38')],'type':_0x18802e[_0x21c2('0x39')][_0x21c2('0x3a')]};});_0x42bef1[_0x21c2('0x3b')]=_[_0x21c2('0x3c')](_0x2f9b11,_0x21c2('0x34'));_0x42bef1[_0x21c2('0x3d')]=_[_0x21c2('0x3e')](_0xd9a56e[_0x21c2('0x3d')]);_0x42bef1[_0x21c2('0x3f')]=_['intersection'](_0x42bef1[_0x21c2('0x3b')],_0x42bef1[_0x21c2('0x3d')]);_0xe2f98e[_0x21c2('0x40')]=_[_0x21c2('0x41')](_0x42bef1['model'],qs[_0x21c2('0x42')](_0xd9a56e[_0x21c2('0x3d')][_0x21c2('0x42')]));_0xe2f98e['attributes']=_0xe2f98e[_0x21c2('0x40')][_0x21c2('0x43')]?_0xe2f98e['attributes']:_0x42bef1[_0x21c2('0x3b')];if(!_0xd9a56e[_0x21c2('0x3d')][_0x21c2('0x44')](_0x21c2('0x45'))){_0xe2f98e[_0x21c2('0x2a')]=qs[_0x21c2('0x2a')](_0xd9a56e[_0x21c2('0x3d')]['limit']);_0xe2f98e[_0x21c2('0x2c')]=qs[_0x21c2('0x2c')](_0xd9a56e[_0x21c2('0x3d')][_0x21c2('0x2c')]);}_0xe2f98e[_0x21c2('0x46')]=qs[_0x21c2('0x47')](_0xd9a56e[_0x21c2('0x3d')]['sort']);_0xe2f98e[_0x21c2('0x48')]=qs[_0x21c2('0x3f')](_['pick'](_0xd9a56e[_0x21c2('0x3d')],_0x42bef1[_0x21c2('0x3f')]),_0x2f9b11);if(_0xd9a56e['query'][_0x21c2('0x49')]){_0xe2f98e[_0x21c2('0x48')]=_[_0x21c2('0x4a')](_0xe2f98e[_0x21c2('0x48')],{'$or':_[_0x21c2('0x3c')](_0x2f9b11,function(_0x4d1f2a){if(_0x4d1f2a['type']!=='VIRTUAL'){var _0x51a1a0={};_0x51a1a0[_0x4d1f2a[_0x21c2('0x34')]]={'$like':'%'+_0xd9a56e[_0x21c2('0x3d')][_0x21c2('0x49')]+'%'};return _0x51a1a0;}})});}_0xe2f98e=_['merge']({},_0xe2f98e,_0xd9a56e['options']);var _0x354802={'where':_0xe2f98e[_0x21c2('0x48')]};return db[_0x21c2('0x36')][_0x21c2('0x2b')](_0x354802)[_0x21c2('0x21')](function(_0x400dd4){_0x2ca0ea[_0x21c2('0x2b')]=_0x400dd4;if(_0xd9a56e[_0x21c2('0x3d')][_0x21c2('0x4b')]){_0xe2f98e[_0x21c2('0x4c')]=[{'all':!![]}];}return db[_0x21c2('0x36')][_0x21c2('0x4d')](_0xe2f98e);})[_0x21c2('0x21')](function(_0x417cb1){_0x2ca0ea[_0x21c2('0x4e')]=_0x417cb1;return _0x2ca0ea;})[_0x21c2('0x21')](respondWithFilteredResult(_0x2edc22,_0xe2f98e))[_0x21c2('0x4f')](handleError(_0x2edc22,null));};exports[_0x21c2('0x50')]=function(_0x5bc7fb,_0x504b17){var _0x245896={'raw':!![],'where':{'id':_0x5bc7fb[_0x21c2('0x51')]['id']}},_0xf297a4={};_0xf297a4['model']=_['keys'](db['WhatsappMessage'][_0x21c2('0x37')]);_0xf297a4[_0x21c2('0x3d')]=_[_0x21c2('0x3e')](_0x5bc7fb[_0x21c2('0x3d')]);_0xf297a4[_0x21c2('0x3f')]=_[_0x21c2('0x41')](_0xf297a4['model'],_0xf297a4['query']);_0x245896[_0x21c2('0x40')]=_[_0x21c2('0x41')](_0xf297a4[_0x21c2('0x3b')],qs[_0x21c2('0x42')](_0x5bc7fb[_0x21c2('0x3d')][_0x21c2('0x42')]));_0x245896[_0x21c2('0x40')]=_0x245896[_0x21c2('0x40')][_0x21c2('0x43')]?_0x245896[_0x21c2('0x40')]:_0xf297a4['model'];if(_0x5bc7fb[_0x21c2('0x3d')]['includeAll']){_0x245896['include']=[{'all':!![]}];}_0x245896=_[_0x21c2('0x4a')]({},_0x245896,_0x5bc7fb['options']);return db['WhatsappMessage']['find'](_0x245896)['then'](handleEntityNotFound(_0x504b17,null))[_0x21c2('0x21')](respondWithResult(_0x504b17,null))[_0x21c2('0x4f')](handleError(_0x504b17,null));};exports[_0x21c2('0x52')]=function(_0x5af6f7,_0x992684){return db['WhatsappMessage'][_0x21c2('0x52')](_0x5af6f7['body'],{})[_0x21c2('0x21')](respondWithResult(_0x992684,0xc9))[_0x21c2('0x4f')](handleError(_0x992684,null));};exports[_0x21c2('0x31')]=function(_0x423e73,_0x5a8d15){if(_0x423e73[_0x21c2('0x53')]['id']){delete _0x423e73[_0x21c2('0x53')]['id'];}return db[_0x21c2('0x36')][_0x21c2('0x54')]({'where':{'id':_0x423e73[_0x21c2('0x51')]['id']}})[_0x21c2('0x21')](handleEntityNotFound(_0x5a8d15,null))[_0x21c2('0x21')](saveUpdates(_0x423e73[_0x21c2('0x53')],null))['then'](respondWithResult(_0x5a8d15,null))['catch'](handleError(_0x5a8d15,null));};exports[_0x21c2('0x32')]=function(_0x4e8eb8,_0x2d5dc7){return db[_0x21c2('0x36')][_0x21c2('0x54')]({'where':{'id':_0x4e8eb8['params']['id']}})[_0x21c2('0x21')](handleEntityNotFound(_0x2d5dc7,null))[_0x21c2('0x21')](removeEntity(_0x2d5dc7,null))[_0x21c2('0x4f')](handleError(_0x2d5dc7,null));};exports[_0x21c2('0x55')]=function(_0x45b7d5,_0x3274c2){return db[_0x21c2('0x36')][_0x21c2('0x55')]()['then'](respondWithResult(_0x3274c2,null))[_0x21c2('0x4f')](handleError(_0x3274c2,null));};var interaction_log=require(_0x21c2('0x16'))(_0x21c2('0x56'));exports[_0x21c2('0x57')]=function(_0x44aea,_0x2457ee,_0x366876){var _0x4b7fca={'agent':{},'channel':'whatsapp'};if(_0x44aea[_0x21c2('0x53')]['id']){delete _0x44aea['body']['id'];}_0x44aea['body'][_0x21c2('0x58')]=!![];_0x44aea[_0x21c2('0x53')][_0x21c2('0x59')]=moment()[_0x21c2('0x5a')](_0x21c2('0x5b'));_0x44aea[_0x21c2('0x53')][_0x21c2('0x5c')]=_0x44aea[_0x21c2('0x53')][_0x21c2('0x5c')]||_0x44aea[_0x21c2('0x5d')]['id'];_0x4b7fca[_0x21c2('0x5e')]['id']=_0x44aea[_0x21c2('0x53')][_0x21c2('0x5c')];return db['WhatsappMessage'][_0x21c2('0x54')]({'where':{'id':_0x44aea[_0x21c2('0x51')]['id'],'UserId':null}})[_0x21c2('0x21')](handleEntityNotFound(_0x2457ee,null))['then'](saveUpdates(_0x44aea[_0x21c2('0x53')],null))['then'](function(_0x6af9ca){if(_0x6af9ca){_0x4b7fca['message']=_0x6af9ca['get']({'plain':!![]});return db[_0x21c2('0x5f')]['find']({'where':{'id':_0x6af9ca[_0x21c2('0x60')]}});}return null;})[_0x21c2('0x21')](handleEntityNotFound(_0x2457ee,null))[_0x21c2('0x21')](function(_0xdc1e62){if(_0xdc1e62){return _0xdc1e62['update']({'UserId':_0x44aea[_0x21c2('0x53')][_0x21c2('0x5c')],'read1stAt':_[_0x21c2('0x61')](_0xdc1e62[_0x21c2('0x62')])?moment()[_0x21c2('0x5a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x21c2('0x21')](function(_0x2e74a3){if(_0x2e74a3){_0x4b7fca[_0x21c2('0x63')]=_0x2e74a3[_0x21c2('0x64')]({'plain':!![]});interaction_log['info'](_0x21c2('0x65'),_0x44aea['user']['id'],_0x44aea[_0x21c2('0x5d')][_0x21c2('0x34')],_0x44aea[_0x21c2('0x5d')][_0x21c2('0x66')],_0x4b7fca[_0x21c2('0x63')]['id'],_0x44aea['body']?JSON[_0x21c2('0x23')](_0x44aea[_0x21c2('0x53')]):_0x21c2('0x67'));return respondWithRpcPromise(_0x21c2('0x68'),_0x21c2('0x69'),_0x4b7fca);}return null;})[_0x21c2('0x21')](function(_0x1993bf){var _0x1531de=_0x21c2('0x6a')+_0x1993bf[_0x21c2('0x26')][_0x21c2('0x6b')];return db[_0x21c2('0x6c')][_0x21c2('0x3d')](_0x1531de,{'type':db[_0x21c2('0x6d')][_0x21c2('0x6e')][_0x21c2('0x6f')],'raw':!![]})[_0x21c2('0x21')](function(_0x81e7f4){return _0x81e7f4;});})[_0x21c2('0x21')](function(_0x49621c){if(_0x49621c){_0x4b7fca[_0x21c2('0x26')][_0x21c2('0x70')]=_0x49621c[0x0];if(!_0x44aea[_0x21c2('0x53')]['UserId'])return;return db['User'][_0x21c2('0x54')]({'where':{'id':_0x44aea[_0x21c2('0x53')]['UserId'],'role':_0x21c2('0x5e')},'attributes':['id','name','fullname',_0x21c2('0x71'),_0x21c2('0x72')],'raw':!![]});}return null;})[_0x21c2('0x21')](function(_0xc026a7){if(!_0xc026a7)return null;_0x4b7fca[_0x21c2('0x26')]['agent']=_0xc026a7;return _0x4b7fca;})[_0x21c2('0x21')](function(_0x2a3418){if(_0x2a3418){if(_0x44aea[_0x21c2('0x53')][_0x21c2('0x73')]){_0x4b7fca[_0x21c2('0x26')][_0x21c2('0x74')]=util[_0x21c2('0x5a')]('SIP/%s',_0x44aea[_0x21c2('0x5d')][_0x21c2('0x34')]);_0x4b7fca[_0x21c2('0x26')][_0x21c2('0x75')]=_0x4b7fca[_0x21c2('0x75')];_0x4b7fca[_0x21c2('0x26')]['motionChannel']=_0x4b7fca[_0x21c2('0x75')];_0x4b7fca['message'][_0x21c2('0x76')]=_0x21c2('0x57');return respondWithRpcPromise('EventManager',_0x21c2('0x77'),{'event':_0x21c2('0x78'),'message':_0x4b7fca[_0x21c2('0x26')]},client9002)[_0x21c2('0x21')](function(){return _0x4b7fca;});}return _0x4b7fca;}return null;})[_0x21c2('0x21')](respondWithResult(_0x2457ee,null))[_0x21c2('0x4f')](handleError(_0x2457ee,null));};var interaction_log=require(_0x21c2('0x16'))('whatsapp-interactions');exports['reject']=function(_0xa17f41,_0x7639c7,_0x139e4d){var _0x4db482={'agent':{},'channel':_0x21c2('0x79')};if(_0xa17f41[_0x21c2('0x53')]['id']){delete _0xa17f41[_0x21c2('0x53')]['id'];}_0xa17f41[_0x21c2('0x53')][_0x21c2('0x5c')]=_0xa17f41[_0x21c2('0x53')][_0x21c2('0x5c')]||_0xa17f41['user']['id'];_0x4db482[_0x21c2('0x5e')]['id']=_0xa17f41[_0x21c2('0x53')][_0x21c2('0x5c')];return db[_0x21c2('0x36')][_0x21c2('0x54')]({'where':{'id':_0xa17f41[_0x21c2('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x7639c7,null))[_0x21c2('0x21')](function(_0x5660cb){if(_0x5660cb){_0x4db482[_0x21c2('0x26')]=_0x5660cb[_0x21c2('0x64')]({'plain':!![]});return db[_0x21c2('0x5f')][_0x21c2('0x54')]({'where':{'id':_0x5660cb[_0x21c2('0x60')]}});}return null;})['then'](handleEntityNotFound(_0x7639c7,null))['then'](function(_0xd64d6){if(_0xd64d6){_0x4db482[_0x21c2('0x63')]=_0xd64d6[_0x21c2('0x64')]({'plain':!![]});interaction_log[_0x21c2('0x7a')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xa17f41[_0x21c2('0x5d')]['id'],_0xa17f41[_0x21c2('0x5d')]['name'],_0xa17f41[_0x21c2('0x5d')]['role'],_0x4db482[_0x21c2('0x63')]['id'],_0xa17f41[_0x21c2('0x53')]?JSON[_0x21c2('0x23')](_0xa17f41[_0x21c2('0x53')]):'null');return respondWithRpcPromise(_0x21c2('0x7b'),'rejectMessage',_0x4db482);}return null;})[_0x21c2('0x21')](function(_0x2f4123){var _0x2875ce=_0x21c2('0x6a')+_0x2f4123[_0x21c2('0x26')][_0x21c2('0x6b')];return db[_0x21c2('0x6c')]['query'](_0x2875ce,{'type':db['Sequelize'][_0x21c2('0x6e')][_0x21c2('0x6f')],'raw':!![]})[_0x21c2('0x21')](function(_0x2c9b47){return _0x2c9b47;});})[_0x21c2('0x21')](function(_0x576998){if(_0x576998){_0x4db482[_0x21c2('0x26')][_0x21c2('0x70')]=_0x576998[0x0];if(!_0xa17f41['body']['UserId'])return;return db['User'][_0x21c2('0x54')]({'where':{'id':_0xa17f41[_0x21c2('0x53')][_0x21c2('0x5c')],'role':_0x21c2('0x5e')},'attributes':['id',_0x21c2('0x34'),_0x21c2('0x7c'),'email',_0x21c2('0x72')],'raw':!![]});}return null;})[_0x21c2('0x21')](function(_0x73e4c0){if(!_0x73e4c0)return null;_0x4db482[_0x21c2('0x26')]['agent']=_0x73e4c0;return _0x4db482;})['then'](function(_0x47138a){if(_0x47138a){_0x47138a[_0x21c2('0x26')][_0x21c2('0x74')]=util[_0x21c2('0x5a')](_0x21c2('0x7d'),_0xa17f41[_0x21c2('0x5d')]['name']);_0x47138a['message'][_0x21c2('0x75')]=_0x4db482['channel'];_0x47138a[_0x21c2('0x26')][_0x21c2('0x7e')]=_0x4db482[_0x21c2('0x75')];_0x47138a['message']['event']='reject';respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_0x47138a[_0x21c2('0x26')]},client9002);return _0x4db482;}return null;})[_0x21c2('0x21')](respondWithResult(_0x7639c7,null))[_0x21c2('0x4f')](handleError(_0x7639c7,null));};exports[_0x21c2('0x28')]=function(_0x10294c,_0x227cd5,_0x1cfdf4){if(_0x10294c[_0x21c2('0x53')]['id']){delete _0x10294c[_0x21c2('0x53')]['id'];}var _0x52732b;return db['WhatsappMessage'][_0x21c2('0x54')]({'where':{'id':_0x10294c[_0x21c2('0x51')]['id']}})[_0x21c2('0x21')](handleEntityNotFound(_0x227cd5,null))[_0x21c2('0x21')](function(_0x3955fc){if(_0x3955fc){_0x52732b=_0x3955fc;return db[_0x21c2('0x7f')][_0x21c2('0x54')]({'where':{'id':_0x3955fc['WhatsappAccountId']}});}})[_0x21c2('0x21')](handleEntityNotFound(_0x227cd5,null))['then'](function(_0xcf2abd){if(_0xcf2abd){logger[_0x21c2('0x80')](_0x21c2('0x81'),_0x21c2('0x28'),'received\x20delivery\x20report\x20from',_0xcf2abd['type'],util[_0x21c2('0x82')](_0x10294c[_0x21c2('0x53')],{'showHidden':![],'depth':null}));switch(_0xcf2abd['type']){case _0x21c2('0x83'):if(_0x10294c[_0x21c2('0x53')][_0x21c2('0x84')]&&_0x10294c[_0x21c2('0x53')][_0x21c2('0x84')]===_0x52732b['messageId']&&_0x10294c[_0x21c2('0x53')][_0x21c2('0x85')]&&_0x10294c['body'][_0x21c2('0x85')]==='read'){return _0x52732b['update']({'read':!![]});}else{logger[_0x21c2('0x24')](_0x21c2('0x86'),_0x21c2('0x28'),_0x21c2('0x83'),util[_0x21c2('0x82')](_0x10294c[_0x21c2('0x53')],{'showHidden':![],'depth':null}));}break;}return _0x52732b;}})['then'](respondWithResult(_0x227cd5,null))[_0x21c2('0x4f')](handleError(_0x227cd5,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 470a322..72d6ec7 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 _0x0102=['setMaxListeners','save','emit','hasOwnProperty','exports','../../mysqldb','WhatsappMessage'];(function(_0x26cb95,_0x4e8b8b){var _0x229c28=function(_0x55d310){while(--_0x55d310){_0x26cb95['push'](_0x26cb95['shift']());}};_0x229c28(++_0x4e8b8b);}(_0x0102,0x186));var _0x2010=function(_0x570ef2,_0x5b755e){_0x570ef2=_0x570ef2-0x0;var _0x50b3d2=_0x0102[_0x570ef2];return _0x50b3d2;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x2010('0x0'))['db'][_0x2010('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x2010('0x2')](0x0);var events={'afterCreate':_0x2010('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x575b0a){return function(_0x4e30b3,_0x59082d,_0x22e49f){WhatsappMessageEvents[_0x2010('0x4')](_0x575b0a+':'+_0x4e30b3['id'],_0x4e30b3);WhatsappMessageEvents[_0x2010('0x4')](_0x575b0a,_0x4e30b3);_0x22e49f(null);};}for(var e in events){if(events[_0x2010('0x5')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x2010('0x6')]=WhatsappMessageEvents; \ No newline at end of file +var _0xd8b0=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x31e6f0,_0x370bdc){var _0x14de41=function(_0x3c3257){while(--_0x3c3257){_0x31e6f0['push'](_0x31e6f0['shift']());}};_0x14de41(++_0x370bdc);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x0d8b('0x0'));var WhatsappMessage=require(_0x0d8b('0x1'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0d8b('0x2'),'afterDestroy':_0x0d8b('0x3')};function emitEvent(_0x43bca1){return function(_0x364286,_0x8196ed,_0x577834){WhatsappMessageEvents['emit'](_0x43bca1+':'+_0x364286['id'],_0x364286);WhatsappMessageEvents[_0x0d8b('0x4')](_0x43bca1,_0x364286);_0x577834(null);};}for(var e in events){if(events[_0x0d8b('0x5')](e)){var event=events[e];WhatsappMessage[_0x0d8b('0x6')](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 e3b8760..ee67851 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 _0x5573=['catch','error','secret','find','WhatsappAccountId','type','twilio','authToken','messages','/status?token=','token','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','phone','POST','Bearer\x20','application/json','statuses','message_id','err','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','direction','toLowerCase','out','UserId','WhatsappInteraction','findOne','then','update'];(function(_0x41e0f5,_0x1a9415){var _0x5bb0ad=function(_0x87ac26){while(--_0x87ac26){_0x41e0f5['push'](_0x41e0f5['shift']());}};_0x5bb0ad(++_0x1a9415);}(_0x5573,0x85));var _0x3557=function(_0x3aeb36,_0x312dc9){_0x3aeb36=_0x3aeb36-0x0;var _0xa2ef21=_0x5573[_0x3aeb36];return _0xa2ef21;};'use strict';var _=require(_0x3557('0x0'));var util=require(_0x3557('0x1'));var logger=require(_0x3557('0x2'))('api');var moment=require(_0x3557('0x3'));var BPromise=require(_0x3557('0x4'));var rp=require('request-promise');var fetch=require('node-fetch');var fs=require('fs');var path=require(_0x3557('0x5'));var rimraf=require(_0x3557('0x6'));var config=require(_0x3557('0x7'));var attributes=require(_0x3557('0x8'));module[_0x3557('0x9')]=function(_0x3c4ba9,_0x5cfc85){return _0x3c4ba9[_0x3557('0xa')](_0x3557('0xb'),attributes,{'tableName':_0x3557('0xc'),'paranoid':![],'indexes':[{'name':_0x3557('0xd'),'fields':[_0x3557('0xd')]},{'name':_0x3557('0xe'),'fields':[_0x3557('0xf')],'type':_0x3557('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xe59753,_0x3a5007,_0x3bfd9a){var _0x39f2a9=_0x3c4ba9[_0x3557('0x11')];var _0x924668=_0xe59753['get']({'plain':!![]});if(_0x924668[_0x3557('0x12')][_0x3557('0x13')]()==='in'||_0x924668[_0x3557('0x12')]['toLowerCase']()===_0x3557('0x14')&&!_0x924668['secret']&&!_['isNil'](_0x924668[_0x3557('0x15')])){_0x39f2a9[_0x3557('0x16')][_0x3557('0x17')]({'where':{'id':_0x924668['WhatsappInteractionId']}})[_0x3557('0x18')](function(_0x2de999){if(_0x2de999){_0x2de999[_0x3557('0x19')]({'lastMsgAt':_0x924668['createdAt'],'lastMsgDirection':_0x924668['direction']['toLowerCase']()});}})[_0x3557('0x1a')](function(_0x5e18b1){console[_0x3557('0x1b')](_0x5e18b1);});}if(_0x924668[_0x3557('0x12')]===_0x3557('0x14')&&!_0x924668[_0x3557('0x1c')]){var _0xd4ff22;_0x39f2a9['WhatsappAccount'][_0x3557('0x1d')]({'where':{'id':_0x924668[_0x3557('0x1e')]},'raw':!![]})['then'](function(_0x49266b){_0xd4ff22=_0x49266b;if(_0xd4ff22&&_0xd4ff22[_0x3557('0x1f')]){switch(_0xd4ff22[_0x3557('0x1f')]){case _0x3557('0x20'):var _0x10dee2=require(_0x3557('0x20'));if(_0xd4ff22['accountSid']&&_0xd4ff22[_0x3557('0x21')]&&_0xd4ff22['phone']){var _0x21bc34=new _0x10dee2(_0xd4ff22['accountSid'],_0xd4ff22[_0x3557('0x21')]);_0x21bc34[_0x3557('0x22')]['create']({'body':_0x924668[_0x3557('0xf')],'to':'whatsapp:'+_0x924668['phone'],'from':'whatsapp:'+_0xd4ff22['phone'],'statusCallback':_0xd4ff22['remote']+'/api/whatsapp/messages/'+_0x924668['id']+_0x3557('0x23')+_0xd4ff22[_0x3557('0x24')]})[_0x3557('0x18')](function(_0x4f7465){if(_0x4f7465['sid']){return _0xe59753[_0x3557('0x19')]({'messageId':_0x4f7465['sid']});}})[_0x3557('0x1a')](function(_0x4963af){logger[_0x3557('0x1b')](_0x3557('0x25'),'afterCreate',_0x3557('0x20'),util['inspect'](_0x4963af,{'showHidden':![],'depth':null}));});}else{logger[_0x3557('0x1b')](_0x3557('0x25'),_0x3557('0x26'),_0x3557('0x20'),_0x3557('0x27'));}break;case _0x3557('0x28'):var _0xdfbfa0=_0xd4ff22['accountSid'];var _0x316ca6=_0xd4ff22[_0x3557('0x21')];var _0x4cffad=_0xd4ff22[_0x3557('0x29')]+_0x3557('0x2a')+_0xdfbfa0+_0x3557('0x2b');var _0x4b1130={'to':[_0x924668[_0x3557('0x2c')]],'message':{'type':'text','text':_0x924668[_0x3557('0xf')]}};var _0x6fd48e={'method':_0x3557('0x2d'),'uri':_0x4cffad,'headers':{'Authorization':_0x3557('0x2e')+_0x316ca6,'Content-Type':_0x3557('0x2f')},'body':_0x4b1130,'json':!![]};rp(_0x6fd48e)['then'](function(_0x588384){if(_0x588384[_0x3557('0x30')][0x0][_0x3557('0x31')]){return _0xe59753['update']({'messageId':_0x588384[_0x3557('0x30')][0x0][_0x3557('0x31')]});}})[_0x3557('0x1a')](function(_0x16d670){logger[_0x3557('0x32')]('WhatsappMessage,\x20%s',_0x16d670);});break;}}})['finally'](function(){_0x3bfd9a();});}else{_0x3bfd9a();}}},'charset':_0x3557('0x33'),'collate':_0x3557('0x34')});}; \ No newline at end of file +var _0xedad=['moment','bluebird','request-promise','node-fetch','path','rimraf','./whatsappMessage.attributes','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','direction','toLowerCase','secret','isNil','WhatsappInteraction','findOne','update','createdAt','error','out','find','WhatsappAccountId','phone','authToken','create','whatsapp:','/api/whatsapp/messages/','/status?token=','token','then','sid','catch','afterCreate','twilio','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','text','Bearer\x20','statuses','message_id','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x114749,_0x9b572a){var _0x499080=function(_0x564790){while(--_0x564790){_0x114749['push'](_0x114749['shift']());}};_0x499080(++_0x9b572a);}(_0xedad,0x17e));var _0xdeda=function(_0x4480b9,_0x5c2949){_0x4480b9=_0x4480b9-0x0;var _0x3f0f02=_0xedad[_0x4480b9];return _0x3f0f02;};'use strict';var _=require(_0xdeda('0x0'));var util=require(_0xdeda('0x1'));var logger=require(_0xdeda('0x2'))('api');var moment=require(_0xdeda('0x3'));var BPromise=require(_0xdeda('0x4'));var rp=require(_0xdeda('0x5'));var fetch=require(_0xdeda('0x6'));var fs=require('fs');var path=require(_0xdeda('0x7'));var rimraf=require(_0xdeda('0x8'));var config=require('../../config/environment');var attributes=require(_0xdeda('0x9'));module['exports']=function(_0x184fe7,_0x5227cc){return _0x184fe7[_0xdeda('0xa')](_0xdeda('0xb'),attributes,{'tableName':_0xdeda('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xdeda('0xd')]},{'name':_0xdeda('0xe'),'fields':[_0xdeda('0xf')],'type':_0xdeda('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x417a4d,_0x367e32,_0x59d4e0){var _0x3dd9b3=_0x184fe7['models'];var _0x3098ce=_0x417a4d['get']({'plain':!![]});if(_0x3098ce[_0xdeda('0x11')][_0xdeda('0x12')]()==='in'||_0x3098ce[_0xdeda('0x11')][_0xdeda('0x12')]()==='out'&&!_0x3098ce[_0xdeda('0x13')]&&!_[_0xdeda('0x14')](_0x3098ce['UserId'])){_0x3dd9b3[_0xdeda('0x15')][_0xdeda('0x16')]({'where':{'id':_0x3098ce['WhatsappInteractionId']}})['then'](function(_0x4be048){if(_0x4be048){_0x4be048[_0xdeda('0x17')]({'lastMsgAt':_0x3098ce[_0xdeda('0x18')],'lastMsgDirection':_0x3098ce['direction'][_0xdeda('0x12')]()});}})['catch'](function(_0x4d6d27){console[_0xdeda('0x19')](_0x4d6d27);});}if(_0x3098ce['direction']===_0xdeda('0x1a')&&!_0x3098ce[_0xdeda('0x13')]){var _0x58cca3;_0x3dd9b3['WhatsappAccount'][_0xdeda('0x1b')]({'where':{'id':_0x3098ce[_0xdeda('0x1c')]},'raw':!![]})['then'](function(_0x28ef21){_0x58cca3=_0x28ef21;if(_0x58cca3&&_0x58cca3['type']){switch(_0x58cca3['type']){case'twilio':var _0x365f45=require('twilio');if(_0x58cca3['accountSid']&&_0x58cca3['authToken']&&_0x58cca3[_0xdeda('0x1d')]){var _0x40addd=new _0x365f45(_0x58cca3['accountSid'],_0x58cca3[_0xdeda('0x1e')]);_0x40addd['messages'][_0xdeda('0x1f')]({'body':_0x3098ce['body'],'to':_0xdeda('0x20')+_0x3098ce['phone'],'from':_0xdeda('0x20')+_0x58cca3['phone'],'statusCallback':_0x58cca3['remote']+_0xdeda('0x21')+_0x3098ce['id']+_0xdeda('0x22')+_0x58cca3[_0xdeda('0x23')]})[_0xdeda('0x24')](function(_0x53b779){if(_0x53b779['sid']){return _0x417a4d[_0xdeda('0x17')]({'messageId':_0x53b779[_0xdeda('0x25')]});}})[_0xdeda('0x26')](function(_0x311881){logger[_0xdeda('0x19')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xdeda('0x27'),_0xdeda('0x28'),util[_0xdeda('0x29')](_0x311881,{'showHidden':![],'depth':null}));});}else{logger[_0xdeda('0x19')](_0xdeda('0x2a'),_0xdeda('0x27'),_0xdeda('0x28'),_0xdeda('0x2b'));}break;case _0xdeda('0x2c'):var _0x2d816c=_0x58cca3['accountSid'];var _0x1f6f1a=_0x58cca3[_0xdeda('0x1e')];var _0x1cb818=_0x58cca3[_0xdeda('0x2d')]+_0xdeda('0x2e')+_0x2d816c+'/messages/';var _0x86c373={'to':[_0x3098ce[_0xdeda('0x1d')]],'message':{'type':_0xdeda('0x2f'),'text':_0x3098ce['body']}};var _0x1a0905={'method':'POST','uri':_0x1cb818,'headers':{'Authorization':_0xdeda('0x30')+_0x1f6f1a,'Content-Type':'application/json'},'body':_0x86c373,'json':!![]};rp(_0x1a0905)[_0xdeda('0x24')](function(_0x5bdbb9){if(_0x5bdbb9[_0xdeda('0x31')][0x0][_0xdeda('0x32')]){return _0x417a4d['update']({'messageId':_0x5bdbb9[_0xdeda('0x31')][0x0][_0xdeda('0x32')]});}})[_0xdeda('0x26')](function(_0x1efffe){logger['err'](_0xdeda('0x33'),_0x1efffe);});break;}}})[_0xdeda('0x34')](function(){_0x59d4e0();});}else{_0x59d4e0();}}},'charset':_0xdeda('0x35'),'collate':_0xdeda('0x36')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 145b992..84fb47d 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 _0x9088=['rpc','jayson/promise','redis','defaults','./whatsappMessage.socket','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','raw','CreateWhatsappMessage','stringify','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x9088,0x131));var _0x8908=function(_0x2c609f,_0x4e758a){_0x2c609f=_0x2c609f-0x0;var _0xb59412=_0x9088[_0x2c609f];return _0xb59412;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8908('0x0'));var BPromise=require(_0x8908('0x1'));var rs=require(_0x8908('0x2'));var fs=require('fs');var Redis=require(_0x8908('0x3'));var db=require(_0x8908('0x4'))['db'];var utils=require(_0x8908('0x5'));var logger=require(_0x8908('0x6'))(_0x8908('0x7'));var config=require('../../config/environment');var jayson=require(_0x8908('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x8908('0x9')]=_[_0x8908('0xa')](config[_0x8908('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8908('0x9')]));require(_0x8908('0xb'))['register'](socket);function respondWithRpcPromise(_0x35c1cc,_0x536ad1,_0x8a735c){return new BPromise(function(_0x4e1ad2,_0x52de76){return client[_0x8908('0xc')](_0x35c1cc,_0x8a735c)[_0x8908('0xd')](function(_0x21c211){logger[_0x8908('0xe')](_0x8908('0xf'),_0x536ad1,_0x8908('0x10'));logger[_0x8908('0x11')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x536ad1,'request\x20sent',JSON['stringify'](_0x21c211));if(_0x21c211[_0x8908('0x12')]){if(_0x21c211['error'][_0x8908('0x13')]===0x1f4){logger[_0x8908('0x12')](_0x8908('0xf'),_0x536ad1,_0x21c211[_0x8908('0x12')][_0x8908('0x14')]);return _0x52de76(_0x21c211[_0x8908('0x12')][_0x8908('0x14')]);}logger['error'](_0x8908('0xf'),_0x536ad1,_0x21c211[_0x8908('0x12')][_0x8908('0x14')]);return _0x4e1ad2(_0x21c211[_0x8908('0x12')][_0x8908('0x14')]);}else{logger[_0x8908('0xe')](_0x8908('0xf'),_0x536ad1,_0x8908('0x10'));_0x4e1ad2(_0x21c211[_0x8908('0x15')][_0x8908('0x14')]);}})[_0x8908('0x16')](function(_0x1c75b9){logger[_0x8908('0x12')](_0x8908('0xf'),_0x536ad1,_0x1c75b9);_0x52de76(_0x1c75b9);});});}exports['CreateWhatsappMessage']=function(_0x5974d1){var _0x4f4a31=this;return new Promise(function(_0x546447,_0xb44553){return db['WhatsappMessage']['create'](_0x5974d1['body'],{'raw':_0x5974d1['options']?_0x5974d1['options'][_0x8908('0x17')]===undefined?!![]:![]:!![]})[_0x8908('0xd')](function(_0x5a9de2){logger['info'](_0x8908('0x18'),_0x5974d1);logger['debug'](_0x8908('0x18'),_0x5974d1,JSON[_0x8908('0x19')](_0x5a9de2));_0x546447(_0x5a9de2);})[_0x8908('0x16')](function(_0x3773ca){logger['error']('CreateWhatsappMessage',_0x3773ca[_0x8908('0x14')],_0x5974d1);_0xb44553(_0x4f4a31[_0x8908('0x12')](0x1f4,_0x3773ca[_0x8908('0x14')]));});});}; \ No newline at end of file +var _0x1ea0=['create','body','options','raw','then','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage'];(function(_0x53b5b1,_0x584a1b){var _0x37d808=function(_0x57b0be){while(--_0x57b0be){_0x53b5b1['push'](_0x53b5b1['shift']());}};_0x37d808(++_0x584a1b);}(_0x1ea0,0x117));var _0x01ea=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1ea0[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x01ea('0x0'));var util=require(_0x01ea('0x1'));var moment=require(_0x01ea('0x2'));var BPromise=require(_0x01ea('0x3'));var rs=require(_0x01ea('0x4'));var fs=require('fs');var Redis=require(_0x01ea('0x5'));var db=require(_0x01ea('0x6'))['db'];var utils=require(_0x01ea('0x7'));var logger=require(_0x01ea('0x8'))(_0x01ea('0x9'));var config=require(_0x01ea('0xa'));var jayson=require(_0x01ea('0xb'));var client=jayson[_0x01ea('0xc')][_0x01ea('0xd')]({'port':0x232a});config[_0x01ea('0xe')]=_[_0x01ea('0xf')](config['redis'],{'host':_0x01ea('0x10'),'port':0x18eb});var socket=require(_0x01ea('0x11'))(new Redis(config['redis']));require(_0x01ea('0x12'))[_0x01ea('0x13')](socket);function respondWithRpcPromise(_0x394035,_0x366998,_0x131692){return new BPromise(function(_0x5851f,_0x16f9e0){return client[_0x01ea('0x14')](_0x394035,_0x131692)['then'](function(_0x461b08){logger[_0x01ea('0x15')](_0x01ea('0x16'),_0x366998,_0x01ea('0x17'));logger[_0x01ea('0x18')](_0x01ea('0x19'),_0x366998,'request\x20sent',JSON['stringify'](_0x461b08));if(_0x461b08[_0x01ea('0x1a')]){if(_0x461b08[_0x01ea('0x1a')][_0x01ea('0x1b')]===0x1f4){logger[_0x01ea('0x1a')]('WhatsappMessage,\x20%s,\x20%s',_0x366998,_0x461b08[_0x01ea('0x1a')][_0x01ea('0x1c')]);return _0x16f9e0(_0x461b08[_0x01ea('0x1a')][_0x01ea('0x1c')]);}logger[_0x01ea('0x1a')](_0x01ea('0x16'),_0x366998,_0x461b08[_0x01ea('0x1a')][_0x01ea('0x1c')]);return _0x5851f(_0x461b08['error']['message']);}else{logger[_0x01ea('0x15')](_0x01ea('0x16'),_0x366998,'request\x20sent');_0x5851f(_0x461b08[_0x01ea('0x1d')][_0x01ea('0x1c')]);}})[_0x01ea('0x1e')](function(_0x116ae4){logger[_0x01ea('0x1a')](_0x01ea('0x16'),_0x366998,_0x116ae4);_0x16f9e0(_0x116ae4);});});}exports[_0x01ea('0x1f')]=function(_0x236bf6){var _0x28561b=this;return new Promise(function(_0x52e710,_0x5d65e4){return db[_0x01ea('0x20')][_0x01ea('0x21')](_0x236bf6[_0x01ea('0x22')],{'raw':_0x236bf6['options']?_0x236bf6[_0x01ea('0x23')][_0x01ea('0x24')]===undefined?!![]:![]:!![]})[_0x01ea('0x25')](function(_0x361457){logger[_0x01ea('0x15')](_0x01ea('0x1f'),_0x236bf6);logger[_0x01ea('0x18')](_0x01ea('0x1f'),_0x236bf6,JSON[_0x01ea('0x26')](_0x361457));_0x52e710(_0x361457);})[_0x01ea('0x1e')](function(_0x107562){logger['error'](_0x01ea('0x1f'),_0x107562['message'],_0x236bf6);_0x5d65e4(_0x28561b[_0x01ea('0x1a')](0x1f4,_0x107562['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index b9e4c50..5395bc1 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 _0x5e7b=['emit','register','length','./whatsappMessage.events','save','remove'];(function(_0x4a0b15,_0x54818b){var _0x54f515=function(_0x1338f2){while(--_0x1338f2){_0x4a0b15['push'](_0x4a0b15['shift']());}};_0x54f515(++_0x54818b);}(_0x5e7b,0x1b9));var _0xb5e7=function(_0x2bbc07,_0x1e2168){_0x2bbc07=_0x2bbc07-0x0;var _0x6879e4=_0x5e7b[_0x2bbc07];return _0x6879e4;};'use strict';var WhatsappMessageEvents=require(_0xb5e7('0x0'));var events=[_0xb5e7('0x1'),_0xb5e7('0x2'),'update'];function createListener(_0x3a0231,_0x583189){return function(_0x5f1d46){_0x583189[_0xb5e7('0x3')](_0x3a0231,_0x5f1d46);};}function removeListener(_0x2d213a,_0x3db307){return function(){WhatsappMessageEvents['removeListener'](_0x2d213a,_0x3db307);};}exports[_0xb5e7('0x4')]=function(_0x30db33){for(var _0x464846=0x0,_0x3d9ef4=events[_0xb5e7('0x5')];_0x464846<_0x3d9ef4;_0x464846++){var _0x15682b=events[_0x464846];var _0x99092c=createListener('whatsappMessage:'+_0x15682b,_0x30db33);WhatsappMessageEvents['on'](_0x15682b,_0x99092c);}}; \ No newline at end of file +var _0x978f=['whatsappMessage:','./whatsappMessage.events','save','remove','update','emit','removeListener','register','length'];(function(_0x105584,_0x1d6506){var _0x19e52e=function(_0x390b10){while(--_0x390b10){_0x105584['push'](_0x105584['shift']());}};_0x19e52e(++_0x1d6506);}(_0x978f,0x1d5));var _0xf978=function(_0xff6d6,_0x55c0ea){_0xff6d6=_0xff6d6-0x0;var _0x1d3f22=_0x978f[_0xff6d6];return _0x1d3f22;};'use strict';var WhatsappMessageEvents=require(_0xf978('0x0'));var events=[_0xf978('0x1'),_0xf978('0x2'),_0xf978('0x3')];function createListener(_0x14c1bb,_0x5765cc){return function(_0x15532d){_0x5765cc[_0xf978('0x4')](_0x14c1bb,_0x15532d);};}function removeListener(_0x1871f2,_0x3b14ae){return function(){WhatsappMessageEvents[_0xf978('0x5')](_0x1871f2,_0x3b14ae);};}exports[_0xf978('0x6')]=function(_0x19a5f1){for(var _0x50fdb7=0x0,_0x3ecc1a=events[_0xf978('0x7')];_0x50fdb7<_0x3ecc1a;_0x50fdb7++){var _0x243285=events[_0x50fdb7];var _0x12ec29=createListener(_0xf978('0x8')+_0x243285,_0x19a5f1);WhatsappMessageEvents['on'](_0x243285,_0x12ec29);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 562dde8..a75dce1 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 _0x72d6=['/describe','describe','/:id/teams','getTeams','/:id/users','getAgents','create','addTeams','addAgents','put','/:id','update','delete','destroy','removeTeams','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','isAuthenticated','index','get'];(function(_0x6c4187,_0x5d4789){var _0x331de=function(_0x3cb69e){while(--_0x3cb69e){_0x6c4187['push'](_0x6c4187['shift']());}};_0x331de(++_0x5d4789);}(_0x72d6,0x1bf));var _0x672d=function(_0x5bfcc3,_0x165f86){_0x5bfcc3=_0x5bfcc3-0x0;var _0x289b9e=_0x72d6[_0x5bfcc3];return _0x289b9e;};'use strict';var multer=require(_0x672d('0x0'));var util=require(_0x672d('0x1'));var path=require(_0x672d('0x2'));var timeout=require('connect-timeout');var express=require(_0x672d('0x3'));var router=express[_0x672d('0x4')]();var fs_extra=require(_0x672d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x672d('0x6'));var config=require(_0x672d('0x7'));var controller=require(_0x672d('0x8'));router['get']('/',auth[_0x672d('0x9')](),controller[_0x672d('0xa')]);router[_0x672d('0xb')](_0x672d('0xc'),auth[_0x672d('0x9')](),controller[_0x672d('0xd')]);router[_0x672d('0xb')]('/:id',auth[_0x672d('0x9')](),controller['show']);router[_0x672d('0xb')]('/:id/members',auth[_0x672d('0x9')](),controller['getMembers']);router[_0x672d('0xb')](_0x672d('0xe'),auth[_0x672d('0x9')](),controller[_0x672d('0xf')]);router['get'](_0x672d('0x10'),auth[_0x672d('0x9')](),controller[_0x672d('0x11')]);router['post']('/',auth[_0x672d('0x9')](),controller[_0x672d('0x12')]);router['post'](_0x672d('0xe'),auth[_0x672d('0x9')](),controller[_0x672d('0x13')]);router['post']('/:id/users',auth[_0x672d('0x9')](),controller[_0x672d('0x14')]);router[_0x672d('0x15')](_0x672d('0x16'),auth[_0x672d('0x9')](),controller[_0x672d('0x17')]);router[_0x672d('0x18')](_0x672d('0x16'),auth[_0x672d('0x9')](),controller[_0x672d('0x19')]);router['delete'](_0x672d('0xe'),auth[_0x672d('0x9')](),controller[_0x672d('0x1a')]);router[_0x672d('0x18')](_0x672d('0x10'),auth[_0x672d('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xb573=['/:id/teams','getTeams','/:id/users','post','addTeams','put','/:id','delete','destroy','removeTeams','removeAgents','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','show','/:id/members','getMembers'];(function(_0x6a21f4,_0x220ad8){var _0x4c15ac=function(_0x52f4dd){while(--_0x52f4dd){_0x6a21f4['push'](_0x6a21f4['shift']());}};_0x4c15ac(++_0x220ad8);}(_0xb573,0x173));var _0x3b57=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb573[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x3b57('0x0'));var express=require(_0x3b57('0x1'));var router=express['Router']();var fs_extra=require(_0x3b57('0x2'));var auth=require(_0x3b57('0x3'));var interaction=require(_0x3b57('0x4'));var config=require(_0x3b57('0x5'));var controller=require(_0x3b57('0x6'));router[_0x3b57('0x7')]('/',auth[_0x3b57('0x8')](),controller[_0x3b57('0x9')]);router[_0x3b57('0x7')]('/describe',auth[_0x3b57('0x8')](),controller['describe']);router[_0x3b57('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x3b57('0xa')]);router[_0x3b57('0x7')](_0x3b57('0xb'),auth[_0x3b57('0x8')](),controller[_0x3b57('0xc')]);router[_0x3b57('0x7')](_0x3b57('0xd'),auth[_0x3b57('0x8')](),controller[_0x3b57('0xe')]);router[_0x3b57('0x7')](_0x3b57('0xf'),auth[_0x3b57('0x8')](),controller['getAgents']);router[_0x3b57('0x10')]('/',auth[_0x3b57('0x8')](),controller['create']);router[_0x3b57('0x10')](_0x3b57('0xd'),auth['isAuthenticated'](),controller[_0x3b57('0x11')]);router[_0x3b57('0x10')](_0x3b57('0xf'),auth['isAuthenticated'](),controller['addAgents']);router[_0x3b57('0x12')](_0x3b57('0x13'),auth[_0x3b57('0x8')](),controller['update']);router[_0x3b57('0x14')](_0x3b57('0x13'),auth[_0x3b57('0x8')](),controller[_0x3b57('0x15')]);router['delete'](_0x3b57('0xd'),auth[_0x3b57('0x8')](),controller[_0x3b57('0x16')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x3b57('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 4650efa..e5659cb 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 _0x63bb=['INTEGER','ENUM','rrmemory','sequelize','exports','STRING','name'];(function(_0x296ce7,_0xc7ccab){var _0x16c411=function(_0x5dd200){while(--_0x5dd200){_0x296ce7['push'](_0x296ce7['shift']());}};_0x16c411(++_0xc7ccab);}(_0x63bb,0xf8));var _0xb63b=function(_0x1419f6,_0x4180de){_0x1419f6=_0x1419f6-0x0;var _0x5b07c7=_0x63bb[_0x1419f6];return _0x5b07c7;};'use strict';var Sequelize=require(_0xb63b('0x0'));module[_0xb63b('0x1')]={'name':{'type':Sequelize[_0xb63b('0x2')],'unique':_0xb63b('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xb63b('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb63b('0x5')](_0xb63b('0x6'),'beepall','roundrobin')},'description':{'type':Sequelize[_0xb63b('0x2')]}}; \ No newline at end of file +var _0x0e35=['INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x2ab9fa,_0x1898a1){var _0x5dc487=function(_0x3e9929){while(--_0x3e9929){_0x2ab9fa['push'](_0x2ab9fa['shift']());}};_0x5dc487(++_0x1898a1);}(_0x0e35,0xc2));var _0x50e3=function(_0x3708dc,_0x10c3d1){_0x3708dc=_0x3708dc-0x0;var _0x24e8f4=_0x0e35[_0x3708dc];return _0x24e8f4;};'use strict';var Sequelize=require(_0x50e3('0x0'));module[_0x50e3('0x1')]={'name':{'type':Sequelize[_0x50e3('0x2')],'unique':_0x50e3('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x50e3('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x50e3('0x5')](_0x50e3('0x6'),_0x50e3('0x7'),_0x50e3('0x8'))},'description':{'type':Sequelize[_0x50e3('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index e8d5812..b6d7694 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 _0x22fd=['pick','filter','merge','options','WhatsappQueue','includeAll','include','findAll','rows','catch','params','keys','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserWhatsappQueue','order','WhatsappQueueId','User','findAndCountAll','UserId','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','addTeams','ids','Agents','online','interface','flatMap','transaction','findOrCreate','forEach','emit','userWhatsappQueue:save','Team','select','field','tq.TeamId','from','team_has_whatsapp_queues','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','sequelize','toString','QueryTypes','SELECT','union','compact','removeTeams','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','end','status','offset','undefined','count','limit','json','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','rawAttributes','fieldName','type','model','map','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x22fd,0xcb));var _0xd22f=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0x22fd[_0x11ce46];return _0x368a1e;};'use strict';var emlformat=require(_0xd22f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd22f('0x1'));var jsonpatch=require(_0xd22f('0x2'));var rp=require(_0xd22f('0x3'));var moment=require(_0xd22f('0x4'));var BPromise=require(_0xd22f('0x5'));var Mustache=require(_0xd22f('0x6'));var util=require('util');var path=require(_0xd22f('0x7'));var sox=require(_0xd22f('0x8'));var csv=require('to-csv');var ejs=require(_0xd22f('0x9'));var fs=require('fs');var fs_extra=require(_0xd22f('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd22f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd22f('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd22f('0xd'));var Papa=require(_0xd22f('0xe'));var Redis=require(_0xd22f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd22f('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd22f('0x11'));var logger=require(_0xd22f('0x12'))(_0xd22f('0x13'));var utils=require(_0xd22f('0x14'));var config=require(_0xd22f('0x15'));var licenseUtil=require(_0xd22f('0x16'));var db=require(_0xd22f('0x17'))['db'];config['redis']=_['defaults'](config[_0xd22f('0x18')],{'host':_0xd22f('0x19'),'port':0x18eb});var socket=require(_0xd22f('0x1a'))(new Redis(config[_0xd22f('0x18')]));require('./whatsappQueue.socket')[_0xd22f('0x1b')](socket);function respondWithStatusCode(_0x3518c9,_0x324cba){_0x324cba=_0x324cba||0xcc;return function(_0x46023e){if(_0x46023e){return _0x3518c9[_0xd22f('0x1c')](_0x324cba);}return _0x3518c9['status'](_0x324cba)[_0xd22f('0x1d')]();};}function respondWithResult(_0x3e56d3,_0x4d4ef2){_0x4d4ef2=_0x4d4ef2||0xc8;return function(_0x4e7998){if(_0x4e7998){return _0x3e56d3[_0xd22f('0x1e')](_0x4d4ef2)['json'](_0x4e7998);}};}function respondWithFilteredResult(_0x340c12,_0x67d4f8){return function(_0x1b660a){if(_0x1b660a){var _0x18e2c4=typeof _0x67d4f8[_0xd22f('0x1f')]===_0xd22f('0x20')&&typeof _0x67d4f8['limit']==='undefined';var _0x234caa=_0x1b660a['count'];var _0x513509=_0x18e2c4?0x0:_0x67d4f8[_0xd22f('0x1f')];var _0x1b4b6a=_0x18e2c4?_0x1b660a[_0xd22f('0x21')]:_0x67d4f8['offset']+_0x67d4f8[_0xd22f('0x22')];var _0x46658d;if(_0x1b4b6a>=_0x234caa){_0x1b4b6a=_0x234caa;_0x46658d=0xc8;}else{_0x46658d=0xce;}_0x340c12[_0xd22f('0x1e')](_0x46658d);return _0x340c12['set']('Content-Range',_0x513509+'-'+_0x1b4b6a+'/'+_0x234caa)[_0xd22f('0x23')](_0x1b660a);}return null;};}function patchUpdates(_0x33912d){return function(_0x32fee7){try{jsonpatch['apply'](_0x32fee7,_0x33912d,!![]);}catch(_0x14ee07){return BPromise[_0xd22f('0x24')](_0x14ee07);}return _0x32fee7[_0xd22f('0x25')]();};}function saveUpdates(_0x4e7082,_0x2dde14){return function(_0x34740d){if(_0x34740d){return _0x34740d[_0xd22f('0x26')](_0x4e7082)[_0xd22f('0x27')](function(_0x5c65af){return _0x5c65af;});}return null;};}function removeEntity(_0x4f60a0,_0x31dbcd){return function(_0x384610){if(_0x384610){return _0x384610[_0xd22f('0x28')]()[_0xd22f('0x27')](function(){var _0x7f42a4=_0x384610[_0xd22f('0x29')]({'plain':!![]});var _0x52f7a5='WhatsappQueues';return db[_0xd22f('0x2a')][_0xd22f('0x28')]({'where':{'type':_0x52f7a5,'resourceId':_0x7f42a4['id']}})[_0xd22f('0x27')](function(){return _0x384610;});})[_0xd22f('0x27')](function(){_0x4f60a0[_0xd22f('0x1e')](0xcc)[_0xd22f('0x1d')]();});}};}function handleEntityNotFound(_0x408333,_0x34f337){return function(_0x4a8d10){if(!_0x4a8d10){_0x408333[_0xd22f('0x1c')](0x194);}return _0x4a8d10;};}function handleError(_0x3501cf,_0x3c74f1){_0x3c74f1=_0x3c74f1||0x1f4;return function(_0x2a73f2){logger[_0xd22f('0x2b')](_0x2a73f2[_0xd22f('0x2c')]);if(_0x2a73f2[_0xd22f('0x2d')]){delete _0x2a73f2['name'];}_0x3501cf[_0xd22f('0x1e')](_0x3c74f1)[_0xd22f('0x2e')](_0x2a73f2);};}exports['index']=function(_0x1c8da4,_0x231099){var _0x2c4b21={},_0xa2157c={},_0x367e3c={'count':0x0,'rows':[]};var _0x1f5146=_['map'](db['WhatsappQueue'][_0xd22f('0x2f')],function(_0x5ebafa){return{'name':_0x5ebafa[_0xd22f('0x30')],'type':_0x5ebafa[_0xd22f('0x31')]['key']};});_0xa2157c[_0xd22f('0x32')]=_[_0xd22f('0x33')](_0x1f5146,_0xd22f('0x2d'));_0xa2157c[_0xd22f('0x34')]=_['keys'](_0x1c8da4[_0xd22f('0x34')]);_0xa2157c['filters']=_['intersection'](_0xa2157c[_0xd22f('0x32')],_0xa2157c[_0xd22f('0x34')]);_0x2c4b21[_0xd22f('0x35')]=_['intersection'](_0xa2157c[_0xd22f('0x32')],qs[_0xd22f('0x36')](_0x1c8da4['query']['fields']));_0x2c4b21[_0xd22f('0x35')]=_0x2c4b21[_0xd22f('0x35')][_0xd22f('0x37')]?_0x2c4b21['attributes']:_0xa2157c[_0xd22f('0x32')];if(!_0x1c8da4[_0xd22f('0x34')][_0xd22f('0x38')](_0xd22f('0x39'))){_0x2c4b21[_0xd22f('0x22')]=qs['limit'](_0x1c8da4[_0xd22f('0x34')][_0xd22f('0x22')]);_0x2c4b21[_0xd22f('0x1f')]=qs[_0xd22f('0x1f')](_0x1c8da4[_0xd22f('0x34')][_0xd22f('0x1f')]);}_0x2c4b21['order']=qs[_0xd22f('0x3a')](_0x1c8da4[_0xd22f('0x34')][_0xd22f('0x3a')]);_0x2c4b21[_0xd22f('0x3b')]=qs[_0xd22f('0x3c')](_[_0xd22f('0x3d')](_0x1c8da4['query'],_0xa2157c[_0xd22f('0x3c')]),_0x1f5146);if(_0x1c8da4[_0xd22f('0x34')][_0xd22f('0x3e')]){_0x2c4b21[_0xd22f('0x3b')]=_[_0xd22f('0x3f')](_0x2c4b21[_0xd22f('0x3b')],{'$or':_[_0xd22f('0x33')](_0x1f5146,function(_0x5a03ae){if(_0x5a03ae[_0xd22f('0x31')]!=='VIRTUAL'){var _0xfeba9d={};_0xfeba9d[_0x5a03ae[_0xd22f('0x2d')]]={'$like':'%'+_0x1c8da4[_0xd22f('0x34')][_0xd22f('0x3e')]+'%'};return _0xfeba9d;}})});}_0x2c4b21=_[_0xd22f('0x3f')]({},_0x2c4b21,_0x1c8da4[_0xd22f('0x40')]);var _0x4a6d22={'where':_0x2c4b21[_0xd22f('0x3b')]};return db[_0xd22f('0x41')]['count'](_0x4a6d22)[_0xd22f('0x27')](function(_0x257d2d){_0x367e3c['count']=_0x257d2d;if(_0x1c8da4[_0xd22f('0x34')][_0xd22f('0x42')]){_0x2c4b21[_0xd22f('0x43')]=[{'all':!![]}];}return db[_0xd22f('0x41')][_0xd22f('0x44')](_0x2c4b21);})[_0xd22f('0x27')](function(_0x13f9b9){_0x367e3c[_0xd22f('0x45')]=_0x13f9b9;return _0x367e3c;})['then'](respondWithFilteredResult(_0x231099,_0x2c4b21))[_0xd22f('0x46')](handleError(_0x231099,null));};exports['show']=function(_0x165435,_0x524740){var _0x26ac18={'raw':!![],'where':{'id':_0x165435[_0xd22f('0x47')]['id']}},_0x477148={};_0x477148[_0xd22f('0x32')]=_[_0xd22f('0x48')](db['WhatsappQueue'][_0xd22f('0x2f')]);_0x477148[_0xd22f('0x34')]=_['keys'](_0x165435[_0xd22f('0x34')]);_0x477148[_0xd22f('0x3c')]=_[_0xd22f('0x49')](_0x477148[_0xd22f('0x32')],_0x477148[_0xd22f('0x34')]);_0x26ac18[_0xd22f('0x35')]=_['intersection'](_0x477148[_0xd22f('0x32')],qs[_0xd22f('0x36')](_0x165435[_0xd22f('0x34')]['fields']));_0x26ac18[_0xd22f('0x35')]=_0x26ac18['attributes']['length']?_0x26ac18[_0xd22f('0x35')]:_0x477148[_0xd22f('0x32')];if(_0x165435[_0xd22f('0x34')][_0xd22f('0x42')]){_0x26ac18['include']=[{'all':!![]}];}_0x26ac18=_[_0xd22f('0x3f')]({},_0x26ac18,_0x165435[_0xd22f('0x40')]);return db[_0xd22f('0x41')][_0xd22f('0x4a')](_0x26ac18)['then'](handleEntityNotFound(_0x524740,null))[_0xd22f('0x27')](respondWithResult(_0x524740,null))[_0xd22f('0x46')](handleError(_0x524740,null));};exports[_0xd22f('0x4b')]=function(_0x17288d,_0x154012){return db[_0xd22f('0x41')]['create'](_0x17288d[_0xd22f('0x4c')],{})[_0xd22f('0x27')](function(_0x10ea8a){var _0x52d504=_0x17288d[_0xd22f('0x4d')][_0xd22f('0x29')]({'plain':!![]});if(!_0x52d504)throw new Error(_0xd22f('0x4e'));if(_0x52d504[_0xd22f('0x4f')]===_0xd22f('0x4d')){var _0x4af81f=_0x10ea8a['get']({'plain':!![]});var _0x5635ad='WhatsappQueues';return db['UserProfileSection'][_0xd22f('0x4a')]({'where':{'name':_0x5635ad,'userProfileId':_0x52d504[_0xd22f('0x50')]},'raw':!![]})[_0xd22f('0x27')](function(_0x4a2346){if(_0x4a2346&&_0x4a2346[_0xd22f('0x51')]===0x0){return db['UserProfileResource'][_0xd22f('0x4b')]({'name':_0x4af81f['name'],'resourceId':_0x4af81f['id'],'type':_0x4a2346[_0xd22f('0x2d')],'sectionId':_0x4a2346['id']},{})[_0xd22f('0x27')](function(){return _0x10ea8a;});}else{return _0x10ea8a;}})[_0xd22f('0x46')](function(_0x3fb23d){logger['error'](_0xd22f('0x52'),_0x3fb23d);throw _0x3fb23d;});}return _0x10ea8a;})[_0xd22f('0x27')](respondWithResult(_0x154012,0xc9))['catch'](handleError(_0x154012,null));};exports[_0xd22f('0x26')]=function(_0x334324,_0x889644){if(_0x334324['body']['id']){delete _0x334324[_0xd22f('0x4c')]['id'];}return db[_0xd22f('0x41')]['find']({'where':{'id':_0x334324[_0xd22f('0x47')]['id']}})[_0xd22f('0x27')](handleEntityNotFound(_0x889644,null))[_0xd22f('0x27')](saveUpdates(_0x334324['body'],null))[_0xd22f('0x27')](respondWithResult(_0x889644,null))[_0xd22f('0x46')](handleError(_0x889644,null));};exports[_0xd22f('0x28')]=function(_0x449b32,_0x116028){return db[_0xd22f('0x41')][_0xd22f('0x4a')]({'where':{'id':_0x449b32[_0xd22f('0x47')]['id']}})[_0xd22f('0x27')](handleEntityNotFound(_0x116028,null))[_0xd22f('0x27')](removeEntity(_0x116028,null))['catch'](handleError(_0x116028,null));};exports[_0xd22f('0x53')]=function(_0x138bc3,_0x2cbe48){return db[_0xd22f('0x41')][_0xd22f('0x53')]()[_0xd22f('0x27')](respondWithResult(_0x2cbe48,null))[_0xd22f('0x46')](handleError(_0x2cbe48,null));};exports[_0xd22f('0x54')]=function(_0x7eb2e3,_0x1ddf80,_0x4953b3){var _0x1d7136={'raw':!![],'where':{}},_0x553094={},_0x3422bc;return db[_0xd22f('0x41')]['findOne']({'where':{'id':_0x7eb2e3[_0xd22f('0x47')]['id']}})[_0xd22f('0x27')](handleEntityNotFound(_0x1ddf80,null))['then'](function(_0x2e29bd){if(_0x2e29bd){_0x3422bc=_0x2e29bd['get']({'plain':!![]});_0x553094[_0xd22f('0x32')]=_[_0xd22f('0x48')](db[_0xd22f('0x55')][_0xd22f('0x2f')]);_0x553094[_0xd22f('0x34')]=_[_0xd22f('0x48')](_0x7eb2e3[_0xd22f('0x34')]);_0x553094['filters']=_[_0xd22f('0x49')](_0x553094[_0xd22f('0x32')],_0x553094['query']);_0x1d7136[_0xd22f('0x35')]=_[_0xd22f('0x49')](_0x553094[_0xd22f('0x32')],qs[_0xd22f('0x36')](_0x7eb2e3[_0xd22f('0x34')]['fields']));_0x1d7136[_0xd22f('0x35')]=_0x1d7136[_0xd22f('0x35')][_0xd22f('0x37')]?_0x1d7136[_0xd22f('0x35')]:_0x553094[_0xd22f('0x32')];if(!_0x7eb2e3[_0xd22f('0x34')][_0xd22f('0x38')](_0xd22f('0x39'))){_0x1d7136[_0xd22f('0x22')]=qs['limit'](_0x7eb2e3[_0xd22f('0x34')][_0xd22f('0x22')]);_0x1d7136[_0xd22f('0x1f')]=qs[_0xd22f('0x1f')](_0x7eb2e3[_0xd22f('0x34')][_0xd22f('0x1f')]);}_0x1d7136[_0xd22f('0x56')]=qs[_0xd22f('0x3a')](_0x7eb2e3[_0xd22f('0x34')][_0xd22f('0x3a')]);_0x1d7136['where']=qs['filters'](_['pick'](_0x7eb2e3[_0xd22f('0x34')],_0x553094[_0xd22f('0x3c')]));_0x1d7136['where'][_0xd22f('0x57')]=_0x2e29bd['id'];if(_0x7eb2e3[_0xd22f('0x34')][_0xd22f('0x3e')]){_0x1d7136[_0xd22f('0x3b')]=_[_0xd22f('0x3f')](_0x1d7136[_0xd22f('0x3b')],{'$or':_[_0xd22f('0x33')](_0x1d7136[_0xd22f('0x35')],function(_0x44f7ad){var _0x22212b={};_0x22212b[_0x44f7ad]={'$like':'%'+_0x7eb2e3[_0xd22f('0x34')]['filter']+'%'};return _0x22212b;})});}_0x1d7136=_['merge']({},_0x1d7136,_0x7eb2e3[_0xd22f('0x40')]);return db[_0xd22f('0x55')][_0xd22f('0x44')](_0x1d7136);}})[_0xd22f('0x27')](function(_0x41cabd){if(_0x41cabd){return db[_0xd22f('0x58')][_0xd22f('0x59')]({'where':{'id':_['map'](_0x41cabd,_0xd22f('0x5a')),'role':'agent'},'attributes':['id','name',_0xd22f('0x5b'),_0xd22f('0x5c'),_0xd22f('0x5d')]});}})[_0xd22f('0x27')](function(_0x194ffa){if(_0x194ffa){return{'count':_0x194ffa['count'],'rows':_[_0xd22f('0x33')](_0x194ffa['rows'],function(_0x125737){return{'membername':_0x125737[_0xd22f('0x2d')],'UserId':_0x125737['id'],'queue_name':_0x3422bc[_0xd22f('0x2d')],'WhatsappQueueId':_0x3422bc['id'],'interface':util[_0xd22f('0x5e')](_0xd22f('0x5f'),_0xd22f('0x60'),_0x125737[_0xd22f('0x2d')]),'penalty':0x0,'paused':_0x125737[_0xd22f('0x5b')],'createdAt':_0x125737[_0xd22f('0x5d')],'updatedAt':_0x125737[_0xd22f('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd22f('0x27')](respondWithFilteredResult(_0x1ddf80,_0x1d7136))[_0xd22f('0x46')](handleError(_0x1ddf80,null));};exports[_0xd22f('0x61')]=function(_0x36ac4e,_0x3267ee,_0x12d897){var _0x1d33b3={};var _0x197538={};var _0x14c129;var _0x4693d9;return db[_0xd22f('0x41')][_0xd22f('0x62')]({'where':{'id':_0x36ac4e[_0xd22f('0x47')]['id']}})['then'](handleEntityNotFound(_0x3267ee,null))[_0xd22f('0x27')](function(_0x386db4){if(_0x386db4){_0x14c129=_0x386db4;_0x197538[_0xd22f('0x32')]=_['keys'](db['Team'][_0xd22f('0x2f')]);_0x197538['query']=_['keys'](_0x36ac4e[_0xd22f('0x34')]);_0x197538[_0xd22f('0x3c')]=_[_0xd22f('0x49')](_0x197538[_0xd22f('0x32')],_0x197538[_0xd22f('0x34')]);_0x1d33b3['attributes']=_[_0xd22f('0x49')](_0x197538['model'],qs[_0xd22f('0x36')](_0x36ac4e[_0xd22f('0x34')][_0xd22f('0x36')]));_0x1d33b3['attributes']=_0x1d33b3[_0xd22f('0x35')][_0xd22f('0x37')]?_0x1d33b3[_0xd22f('0x35')]:_0x197538['model'];_0x1d33b3[_0xd22f('0x56')]=qs[_0xd22f('0x3a')](_0x36ac4e[_0xd22f('0x34')][_0xd22f('0x3a')]);_0x1d33b3['where']=qs[_0xd22f('0x3c')](_[_0xd22f('0x3d')](_0x36ac4e[_0xd22f('0x34')],_0x197538[_0xd22f('0x3c')]));if(_0x36ac4e[_0xd22f('0x34')][_0xd22f('0x3e')]){_0x1d33b3[_0xd22f('0x3b')]=_['merge'](_0x1d33b3['where'],{'$or':_[_0xd22f('0x33')](_0x1d33b3['attributes'],function(_0x544bae){var _0x31a4b8={};_0x31a4b8[_0x544bae]={'$like':'%'+_0x36ac4e[_0xd22f('0x34')][_0xd22f('0x3e')]+'%'};return _0x31a4b8;})});}_0x1d33b3=_['merge']({},_0x1d33b3,_0x36ac4e[_0xd22f('0x40')]);return _0x14c129[_0xd22f('0x61')](_0x1d33b3);}})['then'](function(_0x3284ab){if(_0x3284ab){_0x4693d9=_0x3284ab[_0xd22f('0x37')];if(!_0x36ac4e['query'][_0xd22f('0x38')]('nolimit')){_0x1d33b3[_0xd22f('0x22')]=qs[_0xd22f('0x22')](_0x36ac4e[_0xd22f('0x34')][_0xd22f('0x22')]);_0x1d33b3[_0xd22f('0x1f')]=qs[_0xd22f('0x1f')](_0x36ac4e['query']['offset']);}return _0x14c129['getTeams'](_0x1d33b3);}})[_0xd22f('0x27')](function(_0x2fd5fa){if(_0x2fd5fa){return _0x2fd5fa?{'count':_0x4693d9,'rows':_0x2fd5fa}:null;}})[_0xd22f('0x27')](respondWithResult(_0x3267ee,null))[_0xd22f('0x46')](handleError(_0x3267ee,null));};exports[_0xd22f('0x63')]=function(_0x44f20c,_0x152d42,_0x3ca134){var _0x1a7a24=_0x44f20c[_0xd22f('0x4c')][_0xd22f('0x64')];return db['Team'][_0xd22f('0x44')]({'where':{'id':_0x1a7a24},'attributes':['id'],'include':[{'model':db[_0xd22f('0x58')],'as':_0xd22f('0x65'),'attributes':['id',_0xd22f('0x2d'),_0xd22f('0x66'),'voicePause',_0xd22f('0x67')],'raw':!![]}]})['then'](function(_0x79aa1b){if(_0x79aa1b){var _0x53bc7b=_[_0xd22f('0x68')](_0x79aa1b,function(_0x5de8c6){var _0x434632=_0x5de8c6['get']({'plain':!![]});return _0x434632[_0xd22f('0x65')];});return db[_0xd22f('0x41')][_0xd22f('0x4a')]({'where':{'id':_0x44f20c[_0xd22f('0x47')]['id']}})[_0xd22f('0x27')](function(_0x2addc1){return db['sequelize'][_0xd22f('0x69')](function(_0x116bfe){return _0x2addc1['addTeams'](_0x1a7a24,{'transaction':_0x116bfe})['then'](function(){return BPromise['each'](_0x53bc7b,function(_0x48f53e){return db[_0xd22f('0x55')][_0xd22f('0x6a')]({'where':{'UserId':_0x48f53e['id'],'WhatsappQueueId':_0x44f20c[_0xd22f('0x47')]['id']},'transaction':_0x116bfe});});})[_0xd22f('0x27')](function(){_0x53bc7b[_0xd22f('0x6b')](function(_0x573057){socket[_0xd22f('0x6c')](_0xd22f('0x6d'),{'UserId':_0x573057['id'],'WhatsappQueueId':_0x2addc1['id']});});});});});}})[_0xd22f('0x27')](respondWithStatusCode(_0x152d42,null))['catch'](handleError(_0x152d42,null));};exports['removeTeams']=function(_0x5bab67,_0x3d3c61,_0x5c8382){return db[_0xd22f('0x6e')][_0xd22f('0x44')]({'where':{'id':_0x5bab67[_0xd22f('0x34')][_0xd22f('0x64')]},'attributes':['id'],'include':[{'model':db[_0xd22f('0x58')],'as':_0xd22f('0x65'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3d3c61,null))[_0xd22f('0x27')](function(_0x2338f3){var _0x44a6c9=_[_0xd22f('0x33')](_0x2338f3,'id');var _0x6f0e5d=[];var _0xb93abd=[];var _0x285d55=squel[_0xd22f('0x6f')]();_0x285d55[_0xd22f('0x70')](_0xd22f('0x71'))[_0xd22f('0x72')](_0xd22f('0x73'),'tq')['join']('user_has_teams','ut',_0xd22f('0x74'))[_0xd22f('0x3b')]('WhatsappQueueId\x20=\x20?',_0x5bab67[_0xd22f('0x47')]['id']);for(var _0x2dc17c=0x0;_0x2dc17c<_0x2338f3[_0xd22f('0x37')];_0x2dc17c+=0x1){let _0x86332f=_0x2338f3[_0x2dc17c];for(var _0x1e742e=0x0;_0x1e742e<_0x86332f[_0xd22f('0x65')]['length'];_0x1e742e+=0x1){let _0x24772a=_0x86332f[_0xd22f('0x65')][_0x1e742e];var _0xd40e24=_0x285d55['clone']();_0xd40e24[_0xd22f('0x3b')](_0xd22f('0x75'),_0x24772a['id']);_0xb93abd['push'](db[_0xd22f('0x76')][_0xd22f('0x34')](_0xd40e24[_0xd22f('0x77')](),{'type':db[_0xd22f('0x76')][_0xd22f('0x78')][_0xd22f('0x79')]})[_0xd22f('0x27')](function(_0x1ad0e3){if(_0x1ad0e3[_0xd22f('0x37')]===0x1){return _0x24772a['id'];}else{var _0x5df0de=_['every'](_[_0xd22f('0x33')](_0x1ad0e3,'TeamId'),function(_0x539ea5){return _['includes'](_0x44a6c9,_0x539ea5);});if(_0x5df0de){return _0x24772a['id'];}}}));}}return BPromise['all'](_0xb93abd)[_0xd22f('0x27')](function(_0x626296){_0x6f0e5d=_(_0x6f0e5d)[_0xd22f('0x7a')](_0x626296)[_0xd22f('0x7b')]()['value']();return db['WhatsappQueue']['find']({'where':{'id':_0x5bab67['params']['id']}})[_0xd22f('0x27')](function(_0x1ecedb){return db[_0xd22f('0x76')]['transaction'](function(_0x336ab6){return _0x1ecedb[_0xd22f('0x7c')](_0x5bab67['query'][_0xd22f('0x64')],{'transaction':_0x336ab6})[_0xd22f('0x27')](function(){if(!_['isEmpty'](_0x6f0e5d)){return _0x1ecedb[_0xd22f('0x7d')](_0x6f0e5d,{'transaction':_0x336ab6});}})[_0xd22f('0x27')](function(){_0x6f0e5d[_0xd22f('0x6b')](function(_0x451fc9){socket[_0xd22f('0x6c')](_0xd22f('0x7e'),{'UserId':_0x451fc9,'WhatsappQueueId':_0x1ecedb['id']});});});});});});})['then'](respondWithStatusCode(_0x3d3c61,null))['catch'](handleError(_0x3d3c61,null));};exports[_0xd22f('0x7f')]=function(_0x2f6602,_0x5119b5,_0x481231){return db[_0xd22f('0x41')]['find']({'where':{'id':_0x2f6602['params']['id']}})[_0xd22f('0x27')](handleEntityNotFound(_0x5119b5,null))['then'](function(_0x20bea2){if(_0x20bea2){return _0x20bea2['addAgents'](_0x2f6602['body'][_0xd22f('0x64')],_[_0xd22f('0x80')](_0x2f6602['body'],[_0xd22f('0x64'),'id'])||{})[_0xd22f('0x81')](function(_0x35be2e){for(var _0x2e5cc7=0x0;_0x2e5cc7<_0x2f6602[_0xd22f('0x4c')]['ids']['length'];_0x2e5cc7+=0x1){socket['emit'](_0xd22f('0x6d'),{'UserId':Number(_0x2f6602['body']['ids'][_0x2e5cc7]),'WhatsappQueueId':Number(_0x2f6602[_0xd22f('0x47')]['id'])});}return _0x35be2e;});}})[_0xd22f('0x27')](respondWithResult(_0x5119b5,null))[_0xd22f('0x46')](handleError(_0x5119b5,null));};exports[_0xd22f('0x7d')]=function(_0x915769,_0x45b49b,_0x3d4f60){return db[_0xd22f('0x41')][_0xd22f('0x4a')]({'where':{'id':_0x915769[_0xd22f('0x47')]['id']}})[_0xd22f('0x27')](handleEntityNotFound(_0x45b49b,null))[_0xd22f('0x27')](function(_0x1b0b37){if(_0x1b0b37){return _0x1b0b37[_0xd22f('0x7d')](_0x915769['query'][_0xd22f('0x64')])[_0xd22f('0x27')](function(){if(_[_0xd22f('0x82')](_0x915769[_0xd22f('0x34')][_0xd22f('0x64')])){for(var _0x3faf88=0x0;_0x3faf88<_0x915769[_0xd22f('0x34')][_0xd22f('0x64')]['length'];_0x3faf88+=0x1){socket[_0xd22f('0x6c')](_0xd22f('0x7e'),{'UserId':Number(_0x915769[_0xd22f('0x34')][_0xd22f('0x64')][_0x3faf88]),'WhatsappQueueId':Number(_0x915769[_0xd22f('0x47')]['id'])});}}else{socket[_0xd22f('0x6c')](_0xd22f('0x7e'),{'UserId':Number(_0x915769[_0xd22f('0x34')][_0xd22f('0x64')]),'WhatsappQueueId':Number(_0x915769[_0xd22f('0x47')]['id'])});}});}})['then'](respondWithStatusCode(_0x45b49b,null))[_0xd22f('0x46')](handleError(_0x45b49b,null));};exports['getAgents']=function(_0x34d434,_0x47dd84,_0x52f19b){var _0x202720={};var _0x1adba4={};var _0x21ac19;var _0xc8a00b;return db['WhatsappQueue'][_0xd22f('0x62')]({'where':{'id':_0x34d434['params']['id']}})[_0xd22f('0x27')](handleEntityNotFound(_0x47dd84,null))['then'](function(_0x37ec38){if(_0x37ec38){_0x21ac19=_0x37ec38;_0x1adba4[_0xd22f('0x32')]=_['keys'](db['User'][_0xd22f('0x2f')]);_0x1adba4['query']=_[_0xd22f('0x48')](_0x34d434[_0xd22f('0x34')]);_0x1adba4[_0xd22f('0x3c')]=_[_0xd22f('0x49')](_0x1adba4[_0xd22f('0x32')],_0x1adba4['query']);_0x202720[_0xd22f('0x35')]=_[_0xd22f('0x49')](_0x1adba4[_0xd22f('0x32')],qs[_0xd22f('0x36')](_0x34d434[_0xd22f('0x34')][_0xd22f('0x36')]));_0x202720[_0xd22f('0x35')]=_0x202720[_0xd22f('0x35')][_0xd22f('0x37')]?_0x202720[_0xd22f('0x35')]:_0x1adba4['model'];_0x202720[_0xd22f('0x56')]=qs['sort'](_0x34d434[_0xd22f('0x34')][_0xd22f('0x3a')]);_0x202720['where']=qs['filters'](_[_0xd22f('0x3d')](_0x34d434[_0xd22f('0x34')],_0x1adba4['filters']));if(_0x34d434['query'][_0xd22f('0x3e')]){_0x202720[_0xd22f('0x3b')]=_[_0xd22f('0x3f')](_0x202720[_0xd22f('0x3b')],{'$or':_['map'](_0x202720[_0xd22f('0x35')],function(_0x584ab1){var _0x99ea60={};_0x99ea60[_0x584ab1]={'$like':'%'+_0x34d434[_0xd22f('0x34')]['filter']+'%'};return _0x99ea60;})});}_0x202720=_[_0xd22f('0x3f')]({},_0x202720,_0x34d434[_0xd22f('0x40')]);return _0x21ac19[_0xd22f('0x83')](_0x202720);}})[_0xd22f('0x27')](function(_0x477203){if(_0x477203){_0xc8a00b=_0x477203['length'];if(!_0x34d434[_0xd22f('0x34')][_0xd22f('0x38')](_0xd22f('0x39'))){_0x202720[_0xd22f('0x22')]=qs[_0xd22f('0x22')](_0x34d434['query'][_0xd22f('0x22')]);_0x202720[_0xd22f('0x1f')]=qs[_0xd22f('0x1f')](_0x34d434[_0xd22f('0x34')][_0xd22f('0x1f')]);}return _0x21ac19['getAgents'](_0x202720);}})[_0xd22f('0x27')](function(_0x3b039e){if(_0x3b039e){return _0x3b039e?{'count':_0xc8a00b,'rows':_0x3b039e}:null;}})['then'](respondWithResult(_0x47dd84,null))[_0xd22f('0x46')](handleError(_0x47dd84,null));}; \ No newline at end of file +var _0xb24e=['user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','removeAgents','addAgents','spread','isArray','userWhatsappQueue:remove','getAgents','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','undefined','offset','count','set','apply','reject','update','then','get','WhatsappQueues','UserProfileResource','destroy','error','stack','name','index','map','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','pick','VIRTUAL','filter','WhatsappQueue','findAll','rows','catch','rawAttributes','includeAll','merge','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','body','params','describe','getMembers','findOne','hasOwnProperty','WhatsappQueueId','UserWhatsappQueue','User','findAndCountAll','UserId','whatsappPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','ids','Agents','online','flatMap','sequelize','transaction','each','forEach','emit','userWhatsappQueue:save','removeTeams','field','tq.TeamId','team_has_whatsapp_queues','join'];(function(_0x25c3a,_0x28b9b0){var _0x35da4c=function(_0x47834b){while(--_0x47834b){_0x25c3a['push'](_0x25c3a['shift']());}};_0x35da4c(++_0x28b9b0);}(_0xb24e,0x122));var _0xeb24=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xb24e[_0xfae23b];return _0x200640;};'use strict';var emlformat=require(_0xeb24('0x0'));var rimraf=require(_0xeb24('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xeb24('0x2'));var moment=require(_0xeb24('0x3'));var BPromise=require(_0xeb24('0x4'));var Mustache=require(_0xeb24('0x5'));var util=require('util');var path=require(_0xeb24('0x6'));var sox=require(_0xeb24('0x7'));var csv=require(_0xeb24('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeb24('0x9'));var _=require('lodash');var squel=require(_0xeb24('0xa'));var crypto=require(_0xeb24('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xeb24('0xc'));var toCsv=require(_0xeb24('0x8'));var querystring=require(_0xeb24('0xd'));var Papa=require(_0xeb24('0xe'));var Redis=require(_0xeb24('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xeb24('0x10'));var as=require(_0xeb24('0x11'));var hardwareService=require(_0xeb24('0x12'));var logger=require(_0xeb24('0x13'))(_0xeb24('0x14'));var utils=require(_0xeb24('0x15'));var config=require(_0xeb24('0x16'));var licenseUtil=require(_0xeb24('0x17'));var db=require(_0xeb24('0x18'))['db'];config['redis']=_[_0xeb24('0x19')](config[_0xeb24('0x1a')],{'host':_0xeb24('0x1b'),'port':0x18eb});var socket=require(_0xeb24('0x1c'))(new Redis(config[_0xeb24('0x1a')]));require(_0xeb24('0x1d'))[_0xeb24('0x1e')](socket);function respondWithStatusCode(_0x319d91,_0x17824b){_0x17824b=_0x17824b||0xcc;return function(_0x5392e4){if(_0x5392e4){return _0x319d91[_0xeb24('0x1f')](_0x17824b);}return _0x319d91[_0xeb24('0x20')](_0x17824b)[_0xeb24('0x21')]();};}function respondWithResult(_0x327a7b,_0x446283){_0x446283=_0x446283||0xc8;return function(_0xdcad2e){if(_0xdcad2e){return _0x327a7b[_0xeb24('0x20')](_0x446283)[_0xeb24('0x22')](_0xdcad2e);}};}function respondWithFilteredResult(_0x39e731,_0x510b4d){return function(_0x177c11){if(_0x177c11){var _0x3392ef=typeof _0x510b4d['offset']===_0xeb24('0x23')&&typeof _0x510b4d['limit']==='undefined';var _0x4f5fa2=_0x177c11['count'];var _0x1f5e73=_0x3392ef?0x0:_0x510b4d[_0xeb24('0x24')];var _0x30e48d=_0x3392ef?_0x177c11[_0xeb24('0x25')]:_0x510b4d['offset']+_0x510b4d['limit'];var _0x32f284;if(_0x30e48d>=_0x4f5fa2){_0x30e48d=_0x4f5fa2;_0x32f284=0xc8;}else{_0x32f284=0xce;}_0x39e731[_0xeb24('0x20')](_0x32f284);return _0x39e731[_0xeb24('0x26')]('Content-Range',_0x1f5e73+'-'+_0x30e48d+'/'+_0x4f5fa2)['json'](_0x177c11);}return null;};}function patchUpdates(_0x10c627){return function(_0x257335){try{jsonpatch[_0xeb24('0x27')](_0x257335,_0x10c627,!![]);}catch(_0x20e204){return BPromise[_0xeb24('0x28')](_0x20e204);}return _0x257335['save']();};}function saveUpdates(_0x1cb571,_0x2df7f3){return function(_0x6a1034){if(_0x6a1034){return _0x6a1034[_0xeb24('0x29')](_0x1cb571)[_0xeb24('0x2a')](function(_0x254ad1){return _0x254ad1;});}return null;};}function removeEntity(_0xbb66da,_0x5c672b){return function(_0x3d3156){if(_0x3d3156){return _0x3d3156['destroy']()[_0xeb24('0x2a')](function(){var _0x1ca5bb=_0x3d3156[_0xeb24('0x2b')]({'plain':!![]});var _0x492014=_0xeb24('0x2c');return db[_0xeb24('0x2d')][_0xeb24('0x2e')]({'where':{'type':_0x492014,'resourceId':_0x1ca5bb['id']}})[_0xeb24('0x2a')](function(){return _0x3d3156;});})['then'](function(){_0xbb66da[_0xeb24('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35b02c,_0x2b8960){return function(_0x5b647b){if(!_0x5b647b){_0x35b02c[_0xeb24('0x1f')](0x194);}return _0x5b647b;};}function handleError(_0x40e502,_0x52cf46){_0x52cf46=_0x52cf46||0x1f4;return function(_0x3c55bd){logger[_0xeb24('0x2f')](_0x3c55bd[_0xeb24('0x30')]);if(_0x3c55bd[_0xeb24('0x31')]){delete _0x3c55bd['name'];}_0x40e502[_0xeb24('0x20')](_0x52cf46)['send'](_0x3c55bd);};}exports[_0xeb24('0x32')]=function(_0x3f8336,_0x58a780){var _0x57b097={},_0x5ddaeb={},_0x52fa05={'count':0x0,'rows':[]};var _0x5ac017=_[_0xeb24('0x33')](db['WhatsappQueue']['rawAttributes'],function(_0x5a4619){return{'name':_0x5a4619['fieldName'],'type':_0x5a4619[_0xeb24('0x34')][_0xeb24('0x35')]};});_0x5ddaeb[_0xeb24('0x36')]=_[_0xeb24('0x33')](_0x5ac017,'name');_0x5ddaeb[_0xeb24('0x37')]=_[_0xeb24('0x38')](_0x3f8336[_0xeb24('0x37')]);_0x5ddaeb[_0xeb24('0x39')]=_[_0xeb24('0x3a')](_0x5ddaeb['model'],_0x5ddaeb[_0xeb24('0x37')]);_0x57b097['attributes']=_[_0xeb24('0x3a')](_0x5ddaeb[_0xeb24('0x36')],qs[_0xeb24('0x3b')](_0x3f8336['query'][_0xeb24('0x3b')]));_0x57b097[_0xeb24('0x3c')]=_0x57b097[_0xeb24('0x3c')][_0xeb24('0x3d')]?_0x57b097[_0xeb24('0x3c')]:_0x5ddaeb[_0xeb24('0x36')];if(!_0x3f8336[_0xeb24('0x37')]['hasOwnProperty'](_0xeb24('0x3e'))){_0x57b097[_0xeb24('0x3f')]=qs[_0xeb24('0x3f')](_0x3f8336[_0xeb24('0x37')]['limit']);_0x57b097[_0xeb24('0x24')]=qs[_0xeb24('0x24')](_0x3f8336[_0xeb24('0x37')]['offset']);}_0x57b097[_0xeb24('0x40')]=qs[_0xeb24('0x41')](_0x3f8336[_0xeb24('0x37')][_0xeb24('0x41')]);_0x57b097[_0xeb24('0x42')]=qs[_0xeb24('0x39')](_[_0xeb24('0x43')](_0x3f8336[_0xeb24('0x37')],_0x5ddaeb['filters']),_0x5ac017);if(_0x3f8336['query']['filter']){_0x57b097[_0xeb24('0x42')]=_['merge'](_0x57b097[_0xeb24('0x42')],{'$or':_['map'](_0x5ac017,function(_0x3da6e8){if(_0x3da6e8[_0xeb24('0x34')]!==_0xeb24('0x44')){var _0x3020fe={};_0x3020fe[_0x3da6e8[_0xeb24('0x31')]]={'$like':'%'+_0x3f8336[_0xeb24('0x37')][_0xeb24('0x45')]+'%'};return _0x3020fe;}})});}_0x57b097=_['merge']({},_0x57b097,_0x3f8336['options']);var _0x3b7b35={'where':_0x57b097[_0xeb24('0x42')]};return db['WhatsappQueue'][_0xeb24('0x25')](_0x3b7b35)[_0xeb24('0x2a')](function(_0x17014c){_0x52fa05[_0xeb24('0x25')]=_0x17014c;if(_0x3f8336['query']['includeAll']){_0x57b097['include']=[{'all':!![]}];}return db[_0xeb24('0x46')][_0xeb24('0x47')](_0x57b097);})['then'](function(_0x522f0e){_0x52fa05[_0xeb24('0x48')]=_0x522f0e;return _0x52fa05;})[_0xeb24('0x2a')](respondWithFilteredResult(_0x58a780,_0x57b097))[_0xeb24('0x49')](handleError(_0x58a780,null));};exports['show']=function(_0x2ede0c,_0x393c6b){var _0x4fd23e={'raw':!![],'where':{'id':_0x2ede0c['params']['id']}},_0x1e85fb={};_0x1e85fb[_0xeb24('0x36')]=_['keys'](db[_0xeb24('0x46')][_0xeb24('0x4a')]);_0x1e85fb['query']=_[_0xeb24('0x38')](_0x2ede0c[_0xeb24('0x37')]);_0x1e85fb[_0xeb24('0x39')]=_['intersection'](_0x1e85fb['model'],_0x1e85fb[_0xeb24('0x37')]);_0x4fd23e['attributes']=_['intersection'](_0x1e85fb[_0xeb24('0x36')],qs[_0xeb24('0x3b')](_0x2ede0c['query'][_0xeb24('0x3b')]));_0x4fd23e[_0xeb24('0x3c')]=_0x4fd23e[_0xeb24('0x3c')][_0xeb24('0x3d')]?_0x4fd23e['attributes']:_0x1e85fb[_0xeb24('0x36')];if(_0x2ede0c[_0xeb24('0x37')][_0xeb24('0x4b')]){_0x4fd23e['include']=[{'all':!![]}];}_0x4fd23e=_[_0xeb24('0x4c')]({},_0x4fd23e,_0x2ede0c[_0xeb24('0x4d')]);return db['WhatsappQueue'][_0xeb24('0x4e')](_0x4fd23e)[_0xeb24('0x2a')](handleEntityNotFound(_0x393c6b,null))[_0xeb24('0x2a')](respondWithResult(_0x393c6b,null))[_0xeb24('0x49')](handleError(_0x393c6b,null));};exports[_0xeb24('0x4f')]=function(_0x43643c,_0x232602){return db[_0xeb24('0x46')][_0xeb24('0x4f')](_0x43643c['body'],{})['then'](function(_0x132b84){var _0x58cd57=_0x43643c['user'][_0xeb24('0x2b')]({'plain':!![]});if(!_0x58cd57)throw new Error(_0xeb24('0x50'));if(_0x58cd57[_0xeb24('0x51')]===_0xeb24('0x52')){var _0x23fb3d=_0x132b84[_0xeb24('0x2b')]({'plain':!![]});var _0x5b4020='WhatsappQueues';return db[_0xeb24('0x53')][_0xeb24('0x4e')]({'where':{'name':_0x5b4020,'userProfileId':_0x58cd57['userProfileId']},'raw':!![]})[_0xeb24('0x2a')](function(_0x40e801){if(_0x40e801&&_0x40e801[_0xeb24('0x54')]===0x0){return db['UserProfileResource'][_0xeb24('0x4f')]({'name':_0x23fb3d[_0xeb24('0x31')],'resourceId':_0x23fb3d['id'],'type':_0x40e801[_0xeb24('0x31')],'sectionId':_0x40e801['id']},{})[_0xeb24('0x2a')](function(){return _0x132b84;});}else{return _0x132b84;}})[_0xeb24('0x49')](function(_0x3132c5){logger[_0xeb24('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3132c5);throw _0x3132c5;});}return _0x132b84;})[_0xeb24('0x2a')](respondWithResult(_0x232602,0xc9))[_0xeb24('0x49')](handleError(_0x232602,null));};exports[_0xeb24('0x29')]=function(_0x1f6635,_0x3d5429){if(_0x1f6635[_0xeb24('0x55')]['id']){delete _0x1f6635[_0xeb24('0x55')]['id'];}return db[_0xeb24('0x46')]['find']({'where':{'id':_0x1f6635[_0xeb24('0x56')]['id']}})['then'](handleEntityNotFound(_0x3d5429,null))['then'](saveUpdates(_0x1f6635[_0xeb24('0x55')],null))[_0xeb24('0x2a')](respondWithResult(_0x3d5429,null))['catch'](handleError(_0x3d5429,null));};exports[_0xeb24('0x2e')]=function(_0x555daa,_0x2f58c4){return db[_0xeb24('0x46')]['find']({'where':{'id':_0x555daa[_0xeb24('0x56')]['id']}})[_0xeb24('0x2a')](handleEntityNotFound(_0x2f58c4,null))[_0xeb24('0x2a')](removeEntity(_0x2f58c4,null))[_0xeb24('0x49')](handleError(_0x2f58c4,null));};exports['describe']=function(_0xce5c2,_0x4a815c){return db[_0xeb24('0x46')][_0xeb24('0x57')]()[_0xeb24('0x2a')](respondWithResult(_0x4a815c,null))['catch'](handleError(_0x4a815c,null));};exports[_0xeb24('0x58')]=function(_0x3a1379,_0x29f5b8,_0x4ed0a0){var _0x355cf2={'raw':!![],'where':{}},_0x225128={},_0x1eca72;return db['WhatsappQueue'][_0xeb24('0x59')]({'where':{'id':_0x3a1379[_0xeb24('0x56')]['id']}})[_0xeb24('0x2a')](handleEntityNotFound(_0x29f5b8,null))['then'](function(_0x2cf649){if(_0x2cf649){_0x1eca72=_0x2cf649['get']({'plain':!![]});_0x225128[_0xeb24('0x36')]=_[_0xeb24('0x38')](db['UserWhatsappQueue'][_0xeb24('0x4a')]);_0x225128[_0xeb24('0x37')]=_[_0xeb24('0x38')](_0x3a1379['query']);_0x225128['filters']=_[_0xeb24('0x3a')](_0x225128['model'],_0x225128['query']);_0x355cf2['attributes']=_['intersection'](_0x225128[_0xeb24('0x36')],qs[_0xeb24('0x3b')](_0x3a1379['query']['fields']));_0x355cf2[_0xeb24('0x3c')]=_0x355cf2['attributes'][_0xeb24('0x3d')]?_0x355cf2[_0xeb24('0x3c')]:_0x225128['model'];if(!_0x3a1379[_0xeb24('0x37')][_0xeb24('0x5a')](_0xeb24('0x3e'))){_0x355cf2['limit']=qs['limit'](_0x3a1379[_0xeb24('0x37')][_0xeb24('0x3f')]);_0x355cf2['offset']=qs[_0xeb24('0x24')](_0x3a1379[_0xeb24('0x37')][_0xeb24('0x24')]);}_0x355cf2[_0xeb24('0x40')]=qs['sort'](_0x3a1379[_0xeb24('0x37')][_0xeb24('0x41')]);_0x355cf2[_0xeb24('0x42')]=qs[_0xeb24('0x39')](_[_0xeb24('0x43')](_0x3a1379[_0xeb24('0x37')],_0x225128['filters']));_0x355cf2['where'][_0xeb24('0x5b')]=_0x2cf649['id'];if(_0x3a1379['query'][_0xeb24('0x45')]){_0x355cf2[_0xeb24('0x42')]=_[_0xeb24('0x4c')](_0x355cf2['where'],{'$or':_[_0xeb24('0x33')](_0x355cf2[_0xeb24('0x3c')],function(_0x14891c){var _0x1b2b1f={};_0x1b2b1f[_0x14891c]={'$like':'%'+_0x3a1379[_0xeb24('0x37')][_0xeb24('0x45')]+'%'};return _0x1b2b1f;})});}_0x355cf2=_['merge']({},_0x355cf2,_0x3a1379[_0xeb24('0x4d')]);return db[_0xeb24('0x5c')]['findAll'](_0x355cf2);}})['then'](function(_0x215cca){if(_0x215cca){return db[_0xeb24('0x5d')][_0xeb24('0x5e')]({'where':{'id':_['map'](_0x215cca,_0xeb24('0x5f')),'role':'agent'},'attributes':['id',_0xeb24('0x31'),_0xeb24('0x60'),_0xeb24('0x61'),_0xeb24('0x62')]});}})['then'](function(_0x1b3483){if(_0x1b3483){return{'count':_0x1b3483[_0xeb24('0x25')],'rows':_['map'](_0x1b3483[_0xeb24('0x48')],function(_0x51b343){return{'membername':_0x51b343[_0xeb24('0x31')],'UserId':_0x51b343['id'],'queue_name':_0x1eca72['name'],'WhatsappQueueId':_0x1eca72['id'],'interface':util[_0xeb24('0x63')](_0xeb24('0x64'),'SIP',_0x51b343[_0xeb24('0x31')]),'penalty':0x0,'paused':_0x51b343[_0xeb24('0x60')],'createdAt':_0x51b343[_0xeb24('0x62')],'updatedAt':_0x51b343['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xeb24('0x2a')](respondWithFilteredResult(_0x29f5b8,_0x355cf2))[_0xeb24('0x49')](handleError(_0x29f5b8,null));};exports[_0xeb24('0x65')]=function(_0x5c3fd0,_0xedc580,_0x36deff){var _0x516f54={};var _0x2c2773={};var _0x8aee80;var _0x12da6b;return db[_0xeb24('0x46')][_0xeb24('0x59')]({'where':{'id':_0x5c3fd0[_0xeb24('0x56')]['id']}})[_0xeb24('0x2a')](handleEntityNotFound(_0xedc580,null))['then'](function(_0x594e5b){if(_0x594e5b){_0x8aee80=_0x594e5b;_0x2c2773['model']=_['keys'](db[_0xeb24('0x66')][_0xeb24('0x4a')]);_0x2c2773['query']=_[_0xeb24('0x38')](_0x5c3fd0['query']);_0x2c2773[_0xeb24('0x39')]=_[_0xeb24('0x3a')](_0x2c2773[_0xeb24('0x36')],_0x2c2773['query']);_0x516f54[_0xeb24('0x3c')]=_[_0xeb24('0x3a')](_0x2c2773[_0xeb24('0x36')],qs['fields'](_0x5c3fd0['query'][_0xeb24('0x3b')]));_0x516f54['attributes']=_0x516f54[_0xeb24('0x3c')]['length']?_0x516f54[_0xeb24('0x3c')]:_0x2c2773[_0xeb24('0x36')];_0x516f54['order']=qs[_0xeb24('0x41')](_0x5c3fd0[_0xeb24('0x37')][_0xeb24('0x41')]);_0x516f54[_0xeb24('0x42')]=qs[_0xeb24('0x39')](_['pick'](_0x5c3fd0[_0xeb24('0x37')],_0x2c2773[_0xeb24('0x39')]));if(_0x5c3fd0[_0xeb24('0x37')]['filter']){_0x516f54['where']=_['merge'](_0x516f54[_0xeb24('0x42')],{'$or':_[_0xeb24('0x33')](_0x516f54['attributes'],function(_0x3d684f){var _0x1577cb={};_0x1577cb[_0x3d684f]={'$like':'%'+_0x5c3fd0[_0xeb24('0x37')][_0xeb24('0x45')]+'%'};return _0x1577cb;})});}_0x516f54=_[_0xeb24('0x4c')]({},_0x516f54,_0x5c3fd0[_0xeb24('0x4d')]);return _0x8aee80['getTeams'](_0x516f54);}})[_0xeb24('0x2a')](function(_0x3a2183){if(_0x3a2183){_0x12da6b=_0x3a2183[_0xeb24('0x3d')];if(!_0x5c3fd0['query']['hasOwnProperty'](_0xeb24('0x3e'))){_0x516f54[_0xeb24('0x3f')]=qs[_0xeb24('0x3f')](_0x5c3fd0[_0xeb24('0x37')][_0xeb24('0x3f')]);_0x516f54[_0xeb24('0x24')]=qs[_0xeb24('0x24')](_0x5c3fd0[_0xeb24('0x37')][_0xeb24('0x24')]);}return _0x8aee80[_0xeb24('0x65')](_0x516f54);}})[_0xeb24('0x2a')](function(_0x35de3c){if(_0x35de3c){return _0x35de3c?{'count':_0x12da6b,'rows':_0x35de3c}:null;}})[_0xeb24('0x2a')](respondWithResult(_0xedc580,null))['catch'](handleError(_0xedc580,null));};exports['addTeams']=function(_0x51d3e9,_0x4557a3,_0x308490){var _0xc67efa=_0x51d3e9[_0xeb24('0x55')][_0xeb24('0x67')];return db['Team'][_0xeb24('0x47')]({'where':{'id':_0xc67efa},'attributes':['id'],'include':[{'model':db[_0xeb24('0x5d')],'as':_0xeb24('0x68'),'attributes':['id','name',_0xeb24('0x69'),'voicePause','interface'],'raw':!![]}]})[_0xeb24('0x2a')](function(_0x3eb2fd){if(_0x3eb2fd){var _0x1a37cf=_[_0xeb24('0x6a')](_0x3eb2fd,function(_0x2a1cf5){var _0x258452=_0x2a1cf5[_0xeb24('0x2b')]({'plain':!![]});return _0x258452['Agents'];});return db[_0xeb24('0x46')][_0xeb24('0x4e')]({'where':{'id':_0x51d3e9['params']['id']}})['then'](function(_0x41afbc){return db[_0xeb24('0x6b')][_0xeb24('0x6c')](function(_0x3ecead){return _0x41afbc['addTeams'](_0xc67efa,{'transaction':_0x3ecead})[_0xeb24('0x2a')](function(){return BPromise[_0xeb24('0x6d')](_0x1a37cf,function(_0x717ba){return db['UserWhatsappQueue']['findOrCreate']({'where':{'UserId':_0x717ba['id'],'WhatsappQueueId':_0x51d3e9[_0xeb24('0x56')]['id']},'transaction':_0x3ecead});});})[_0xeb24('0x2a')](function(){_0x1a37cf[_0xeb24('0x6e')](function(_0xdd764f){socket[_0xeb24('0x6f')](_0xeb24('0x70'),{'UserId':_0xdd764f['id'],'WhatsappQueueId':_0x41afbc['id']});});});});});}})[_0xeb24('0x2a')](respondWithStatusCode(_0x4557a3,null))[_0xeb24('0x49')](handleError(_0x4557a3,null));};exports[_0xeb24('0x71')]=function(_0x1c7f1a,_0x57db9d,_0xcb102){return db[_0xeb24('0x66')][_0xeb24('0x47')]({'where':{'id':_0x1c7f1a[_0xeb24('0x37')][_0xeb24('0x67')]},'attributes':['id'],'include':[{'model':db[_0xeb24('0x5d')],'as':_0xeb24('0x68'),'attributes':['id'],'raw':!![]}]})[_0xeb24('0x2a')](handleEntityNotFound(_0x57db9d,null))['then'](function(_0x3b808c){var _0x1d3751=_[_0xeb24('0x33')](_0x3b808c,'id');var _0x83151c=[];var _0x2f82b5=[];var _0x68e553=squel['select']();_0x68e553[_0xeb24('0x72')](_0xeb24('0x73'))['from'](_0xeb24('0x74'),'tq')[_0xeb24('0x75')](_0xeb24('0x76'),'ut',_0xeb24('0x77'))['where'](_0xeb24('0x78'),_0x1c7f1a[_0xeb24('0x56')]['id']);for(var _0x4f0d6a=0x0;_0x4f0d6a<_0x3b808c[_0xeb24('0x3d')];_0x4f0d6a+=0x1){let _0x2754b9=_0x3b808c[_0x4f0d6a];for(var _0x58954b=0x0;_0x58954b<_0x2754b9['Agents'][_0xeb24('0x3d')];_0x58954b+=0x1){let _0x3760f7=_0x2754b9[_0xeb24('0x68')][_0x58954b];var _0x2d9251=_0x68e553['clone']();_0x2d9251[_0xeb24('0x42')](_0xeb24('0x79'),_0x3760f7['id']);_0x2f82b5['push'](db[_0xeb24('0x6b')][_0xeb24('0x37')](_0x2d9251[_0xeb24('0x7a')](),{'type':db['sequelize'][_0xeb24('0x7b')][_0xeb24('0x7c')]})[_0xeb24('0x2a')](function(_0x17006f){if(_0x17006f['length']===0x1){return _0x3760f7['id'];}else{var _0x934d0d=_['every'](_['map'](_0x17006f,_0xeb24('0x7d')),function(_0x26b268){return _[_0xeb24('0x7e')](_0x1d3751,_0x26b268);});if(_0x934d0d){return _0x3760f7['id'];}}}));}}return BPromise[_0xeb24('0x7f')](_0x2f82b5)['then'](function(_0x3d6bec){_0x83151c=_(_0x83151c)[_0xeb24('0x80')](_0x3d6bec)[_0xeb24('0x81')]()['value']();return db['WhatsappQueue'][_0xeb24('0x4e')]({'where':{'id':_0x1c7f1a[_0xeb24('0x56')]['id']}})[_0xeb24('0x2a')](function(_0x5f48e2){return db[_0xeb24('0x6b')][_0xeb24('0x6c')](function(_0x34d492){return _0x5f48e2[_0xeb24('0x71')](_0x1c7f1a[_0xeb24('0x37')]['ids'],{'transaction':_0x34d492})[_0xeb24('0x2a')](function(){if(!_['isEmpty'](_0x83151c)){return _0x5f48e2[_0xeb24('0x82')](_0x83151c,{'transaction':_0x34d492});}})[_0xeb24('0x2a')](function(){_0x83151c['forEach'](function(_0x453fe4){socket['emit']('userWhatsappQueue:remove',{'UserId':_0x453fe4,'WhatsappQueueId':_0x5f48e2['id']});});});});});});})['then'](respondWithStatusCode(_0x57db9d,null))['catch'](handleError(_0x57db9d,null));};exports[_0xeb24('0x83')]=function(_0x164615,_0x22c312,_0x44f3f5){return db['WhatsappQueue'][_0xeb24('0x4e')]({'where':{'id':_0x164615[_0xeb24('0x56')]['id']}})['then'](handleEntityNotFound(_0x22c312,null))[_0xeb24('0x2a')](function(_0x58c5bd){if(_0x58c5bd){return _0x58c5bd['addAgents'](_0x164615[_0xeb24('0x55')]['ids'],_['omit'](_0x164615[_0xeb24('0x55')],[_0xeb24('0x67'),'id'])||{})[_0xeb24('0x84')](function(_0x315f1d){for(var _0x3c1b1d=0x0;_0x3c1b1d<_0x164615[_0xeb24('0x55')][_0xeb24('0x67')]['length'];_0x3c1b1d+=0x1){socket[_0xeb24('0x6f')](_0xeb24('0x70'),{'UserId':Number(_0x164615[_0xeb24('0x55')][_0xeb24('0x67')][_0x3c1b1d]),'WhatsappQueueId':Number(_0x164615[_0xeb24('0x56')]['id'])});}return _0x315f1d;});}})[_0xeb24('0x2a')](respondWithResult(_0x22c312,null))[_0xeb24('0x49')](handleError(_0x22c312,null));};exports['removeAgents']=function(_0x196559,_0x3397c0,_0x219aa2){return db[_0xeb24('0x46')][_0xeb24('0x4e')]({'where':{'id':_0x196559[_0xeb24('0x56')]['id']}})[_0xeb24('0x2a')](handleEntityNotFound(_0x3397c0,null))[_0xeb24('0x2a')](function(_0x3db45e){if(_0x3db45e){return _0x3db45e[_0xeb24('0x82')](_0x196559[_0xeb24('0x37')][_0xeb24('0x67')])[_0xeb24('0x2a')](function(){if(_[_0xeb24('0x85')](_0x196559[_0xeb24('0x37')]['ids'])){for(var _0x35112d=0x0;_0x35112d<_0x196559[_0xeb24('0x37')]['ids']['length'];_0x35112d+=0x1){socket['emit'](_0xeb24('0x86'),{'UserId':Number(_0x196559[_0xeb24('0x37')][_0xeb24('0x67')][_0x35112d]),'WhatsappQueueId':Number(_0x196559[_0xeb24('0x56')]['id'])});}}else{socket[_0xeb24('0x6f')]('userWhatsappQueue:remove',{'UserId':Number(_0x196559[_0xeb24('0x37')][_0xeb24('0x67')]),'WhatsappQueueId':Number(_0x196559[_0xeb24('0x56')]['id'])});}});}})[_0xeb24('0x2a')](respondWithStatusCode(_0x3397c0,null))[_0xeb24('0x49')](handleError(_0x3397c0,null));};exports[_0xeb24('0x87')]=function(_0x203327,_0x4217d8,_0x3af25a){var _0xe1ceec={};var _0xeb015f={};var _0x5b0475;var _0x4f3423;return db[_0xeb24('0x46')][_0xeb24('0x59')]({'where':{'id':_0x203327[_0xeb24('0x56')]['id']}})[_0xeb24('0x2a')](handleEntityNotFound(_0x4217d8,null))[_0xeb24('0x2a')](function(_0x3ebe52){if(_0x3ebe52){_0x5b0475=_0x3ebe52;_0xeb015f[_0xeb24('0x36')]=_[_0xeb24('0x38')](db[_0xeb24('0x5d')][_0xeb24('0x4a')]);_0xeb015f['query']=_[_0xeb24('0x38')](_0x203327[_0xeb24('0x37')]);_0xeb015f['filters']=_[_0xeb24('0x3a')](_0xeb015f['model'],_0xeb015f[_0xeb24('0x37')]);_0xe1ceec['attributes']=_['intersection'](_0xeb015f[_0xeb24('0x36')],qs[_0xeb24('0x3b')](_0x203327[_0xeb24('0x37')][_0xeb24('0x3b')]));_0xe1ceec[_0xeb24('0x3c')]=_0xe1ceec['attributes'][_0xeb24('0x3d')]?_0xe1ceec[_0xeb24('0x3c')]:_0xeb015f[_0xeb24('0x36')];_0xe1ceec[_0xeb24('0x40')]=qs[_0xeb24('0x41')](_0x203327[_0xeb24('0x37')][_0xeb24('0x41')]);_0xe1ceec['where']=qs[_0xeb24('0x39')](_[_0xeb24('0x43')](_0x203327['query'],_0xeb015f['filters']));if(_0x203327[_0xeb24('0x37')][_0xeb24('0x45')]){_0xe1ceec[_0xeb24('0x42')]=_[_0xeb24('0x4c')](_0xe1ceec[_0xeb24('0x42')],{'$or':_[_0xeb24('0x33')](_0xe1ceec[_0xeb24('0x3c')],function(_0x650e1d){var _0x4ba3bc={};_0x4ba3bc[_0x650e1d]={'$like':'%'+_0x203327[_0xeb24('0x37')][_0xeb24('0x45')]+'%'};return _0x4ba3bc;})});}_0xe1ceec=_[_0xeb24('0x4c')]({},_0xe1ceec,_0x203327[_0xeb24('0x4d')]);return _0x5b0475[_0xeb24('0x87')](_0xe1ceec);}})[_0xeb24('0x2a')](function(_0x54e6c6){if(_0x54e6c6){_0x4f3423=_0x54e6c6[_0xeb24('0x3d')];if(!_0x203327[_0xeb24('0x37')][_0xeb24('0x5a')](_0xeb24('0x3e'))){_0xe1ceec[_0xeb24('0x3f')]=qs[_0xeb24('0x3f')](_0x203327['query'][_0xeb24('0x3f')]);_0xe1ceec[_0xeb24('0x24')]=qs[_0xeb24('0x24')](_0x203327[_0xeb24('0x37')][_0xeb24('0x24')]);}return _0x5b0475[_0xeb24('0x87')](_0xe1ceec);}})[_0xeb24('0x2a')](function(_0x724d44){if(_0x724d44){return _0x724d44?{'count':_0x4f3423,'rows':_0x724d44}:null;}})['then'](respondWithResult(_0x4217d8,null))[_0xeb24('0x49')](handleError(_0x4217d8,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 374200e..72aef83 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 _0x975d=['../../mysqldb','setMaxListeners','save','update','remove','hasOwnProperty','hook','events'];(function(_0x23f5bd,_0x3cd2bf){var _0x1330d5=function(_0x5230de){while(--_0x5230de){_0x23f5bd['push'](_0x23f5bd['shift']());}};_0x1330d5(++_0x3cd2bf);}(_0x975d,0x1ef));var _0xd975=function(_0x4c5b56,_0x424881){_0x4c5b56=_0x4c5b56-0x0;var _0x1db159=_0x975d[_0x4c5b56];return _0x1db159;};'use strict';var EventEmitter=require(_0xd975('0x0'));var WhatsappQueue=require(_0xd975('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xd975('0x2')](0x0);var events={'afterCreate':_0xd975('0x3'),'afterUpdate':_0xd975('0x4'),'afterDestroy':_0xd975('0x5')};function emitEvent(_0x322a26){return function(_0x55ddf6,_0x566274,_0x4b3b29){WhatsappQueueEvents['emit'](_0x322a26+':'+_0x55ddf6['id'],_0x55ddf6);WhatsappQueueEvents['emit'](_0x322a26,_0x55ddf6);_0x4b3b29(null);};}for(var e in events){if(events[_0xd975('0x6')](e)){var event=events[e];WhatsappQueue[_0xd975('0x7')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0x2b26=['WhatsappQueue','save','update','hasOwnProperty','hook','exports','events'];(function(_0x165ece,_0x1f0a42){var _0x545fe6=function(_0x1ac8e9){while(--_0x1ac8e9){_0x165ece['push'](_0x165ece['shift']());}};_0x545fe6(++_0x1f0a42);}(_0x2b26,0x12c));var _0x62b2=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x2b26[_0x3ab51d];return _0x29a04e;};'use strict';var EventEmitter=require(_0x62b2('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0x62b2('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x62b2('0x2'),'afterUpdate':_0x62b2('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5785a6){return function(_0x301744,_0xdea916,_0x3f7d33){WhatsappQueueEvents['emit'](_0x5785a6+':'+_0x301744['id'],_0x301744);WhatsappQueueEvents['emit'](_0x5785a6,_0x301744);_0x3f7d33(null);};}for(var e in events){if(events[_0x62b2('0x4')](e)){var event=events[e];WhatsappQueue[_0x62b2('0x5')](e,emitEvent(event));}}module[_0x62b2('0x6')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index a26576c..598516d 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 _0x1296=['moment','bluebird','request-promise','path','../../config/environment','exports','whatsapp_queues','lodash','util','../../config/logger','api'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x1296,0x193));var _0x6129=function(_0x4b3e89,_0x29e2dd){_0x4b3e89=_0x4b3e89-0x0;var _0x3124be=_0x1296[_0x4b3e89];return _0x3124be;};'use strict';var _=require(_0x6129('0x0'));var util=require(_0x6129('0x1'));var logger=require(_0x6129('0x2'))(_0x6129('0x3'));var moment=require(_0x6129('0x4'));var BPromise=require(_0x6129('0x5'));var rp=require(_0x6129('0x6'));var fs=require('fs');var path=require(_0x6129('0x7'));var rimraf=require('rimraf');var config=require(_0x6129('0x8'));var attributes=require('./whatsappQueue.attributes');module[_0x6129('0x9')]=function(_0x57f8b8,_0x5561d1){return _0x57f8b8['define']('WhatsappQueue',attributes,{'tableName':_0x6129('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb92a=['request-promise','path','rimraf','../../config/environment','exports','whatsapp_queues','lodash','util','../../config/logger','api','bluebird'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xb92a,0x1c9));var _0xab92=function(_0x104cf7,_0x4a29d5){_0x104cf7=_0x104cf7-0x0;var _0x50d33f=_0xb92a[_0x104cf7];return _0x50d33f;};'use strict';var _=require(_0xab92('0x0'));var util=require(_0xab92('0x1'));var logger=require(_0xab92('0x2'))(_0xab92('0x3'));var moment=require('moment');var BPromise=require(_0xab92('0x4'));var rp=require(_0xab92('0x5'));var fs=require('fs');var path=require(_0xab92('0x6'));var rimraf=require(_0xab92('0x7'));var config=require(_0xab92('0x8'));var attributes=require('./whatsappQueue.attributes');module[_0xab92('0x9')]=function(_0x9a7553,_0xe2bcee){return _0x9a7553['define']('WhatsappQueue',attributes,{'tableName':_0xab92('0xa'),'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 4259e14..fe5d62c 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 _0xb1cf=['message','result','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','catch','ShowWhatsappQueue','stringify','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./whatsappQueue.socket','register','request','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x248619,_0x44ee73){var _0x42a399=function(_0x5b894d){while(--_0x5b894d){_0x248619['push'](_0x248619['shift']());}};_0x42a399(++_0x44ee73);}(_0xb1cf,0x101));var _0xfb1c=function(_0x4014c8,_0x38efb6){_0x4014c8=_0x4014c8-0x0;var _0x194847=_0xb1cf[_0x4014c8];return _0x194847;};'use strict';var _=require('lodash');var util=require(_0xfb1c('0x0'));var moment=require(_0xfb1c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfb1c('0x2'));var db=require(_0xfb1c('0x3'))['db'];var utils=require(_0xfb1c('0x4'));var logger=require('../../config/logger')(_0xfb1c('0x5'));var config=require('../../config/environment');var jayson=require(_0xfb1c('0x6'));var client=jayson[_0xfb1c('0x7')][_0xfb1c('0x8')]({'port':0x232a});config['redis']=_[_0xfb1c('0x9')](config['redis'],{'host':_0xfb1c('0xa'),'port':0x18eb});var socket=require(_0xfb1c('0xb'))(new Redis(config[_0xfb1c('0xc')]));require(_0xfb1c('0xd'))[_0xfb1c('0xe')](socket);function respondWithRpcPromise(_0x3871a8,_0x3960c2,_0x55ddb4){return new BPromise(function(_0x560fde,_0x2427ba){return client[_0xfb1c('0xf')](_0x3871a8,_0x55ddb4)['then'](function(_0x128504){logger[_0xfb1c('0x10')](_0xfb1c('0x11'),_0x3960c2,_0xfb1c('0x12'));logger[_0xfb1c('0x13')](_0xfb1c('0x14'),_0x3960c2,_0xfb1c('0x12'),JSON['stringify'](_0x128504));if(_0x128504[_0xfb1c('0x15')]){if(_0x128504[_0xfb1c('0x15')][_0xfb1c('0x16')]===0x1f4){logger['error'](_0xfb1c('0x11'),_0x3960c2,_0x128504[_0xfb1c('0x15')]['message']);return _0x2427ba(_0x128504[_0xfb1c('0x15')][_0xfb1c('0x17')]);}logger[_0xfb1c('0x15')](_0xfb1c('0x11'),_0x3960c2,_0x128504[_0xfb1c('0x15')][_0xfb1c('0x17')]);return _0x560fde(_0x128504[_0xfb1c('0x15')][_0xfb1c('0x17')]);}else{logger[_0xfb1c('0x10')](_0xfb1c('0x11'),_0x3960c2,_0xfb1c('0x12'));_0x560fde(_0x128504[_0xfb1c('0x18')]['message']);}})['catch'](function(_0x301ce1){logger[_0xfb1c('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x3960c2,_0x301ce1);_0x2427ba(_0x301ce1);});});}exports[_0xfb1c('0x19')]=function(_0x421d56){var _0x1601ad=this;return new Promise(function(_0x9c2eb1,_0x369946){return db[_0xfb1c('0x1a')][_0xfb1c('0x1b')]({'raw':_0x421d56[_0xfb1c('0x1c')]?_0x421d56[_0xfb1c('0x1c')][_0xfb1c('0x1d')]===undefined?!![]:![]:!![],'where':_0x421d56[_0xfb1c('0x1c')]?_0x421d56[_0xfb1c('0x1c')][_0xfb1c('0x1e')]||null:null,'attributes':_0x421d56[_0xfb1c('0x1c')]?_0x421d56[_0xfb1c('0x1c')][_0xfb1c('0x1f')]||null:null,'limit':_0x421d56['options']?_0x421d56[_0xfb1c('0x1c')][_0xfb1c('0x20')]||null:null,'include':_0x421d56[_0xfb1c('0x1c')]?_0x421d56[_0xfb1c('0x1c')][_0xfb1c('0x21')]?_[_0xfb1c('0x22')](_0x421d56[_0xfb1c('0x1c')][_0xfb1c('0x21')],function(_0x3a2e49){return{'model':db[_0x3a2e49[_0xfb1c('0x23')]],'as':_0x3a2e49['as'],'attributes':_0x3a2e49[_0xfb1c('0x1f')],'include':_0x3a2e49[_0xfb1c('0x21')]?_['map'](_0x3a2e49['include'],function(_0x165f1e){return{'model':db[_0x165f1e[_0xfb1c('0x23')]],'as':_0x165f1e['as'],'attributes':_0x165f1e[_0xfb1c('0x1f')],'include':_0x165f1e[_0xfb1c('0x21')]?_['map'](_0x165f1e[_0xfb1c('0x21')],function(_0xd0daf2){return{'model':db[_0xd0daf2[_0xfb1c('0x23')]],'as':_0xd0daf2['as'],'attributes':_0xd0daf2[_0xfb1c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xfb1c('0x24')](function(_0x3ea941){logger[_0xfb1c('0x10')](_0xfb1c('0x19'),_0x421d56);logger[_0xfb1c('0x13')](_0xfb1c('0x19'),_0x421d56,JSON['stringify'](_0x3ea941));_0x9c2eb1(_0x3ea941);})[_0xfb1c('0x25')](function(_0x3b41eb){logger[_0xfb1c('0x15')](_0xfb1c('0x19'),_0x3b41eb[_0xfb1c('0x17')],_0x421d56);_0x369946(_0x1601ad['error'](0x1f4,_0x3b41eb[_0xfb1c('0x17')]));});});};exports[_0xfb1c('0x26')]=function(_0x15ff6e){var _0x35a606=this;return new Promise(function(_0x536d10,_0x4ea35c){return db[_0xfb1c('0x1a')]['find']({'raw':_0x15ff6e[_0xfb1c('0x1c')]?_0x15ff6e['options'][_0xfb1c('0x1d')]===undefined?!![]:![]:!![],'where':_0x15ff6e['options']?_0x15ff6e['options'][_0xfb1c('0x1e')]||null:null,'attributes':_0x15ff6e[_0xfb1c('0x1c')]?_0x15ff6e[_0xfb1c('0x1c')][_0xfb1c('0x1f')]||null:null,'include':_0x15ff6e['options']?_0x15ff6e['options'][_0xfb1c('0x21')]?_[_0xfb1c('0x22')](_0x15ff6e[_0xfb1c('0x1c')][_0xfb1c('0x21')],function(_0x4e03a6){return{'model':db[_0x4e03a6['model']],'as':_0x4e03a6['as'],'attributes':_0x4e03a6[_0xfb1c('0x1f')],'include':_0x4e03a6[_0xfb1c('0x21')]?_[_0xfb1c('0x22')](_0x4e03a6[_0xfb1c('0x21')],function(_0xd1498c){return{'model':db[_0xd1498c[_0xfb1c('0x23')]],'as':_0xd1498c['as'],'attributes':_0xd1498c[_0xfb1c('0x1f')],'include':_0xd1498c[_0xfb1c('0x21')]?_[_0xfb1c('0x22')](_0xd1498c[_0xfb1c('0x21')],function(_0x41a7eb){return{'model':db[_0x41a7eb['model']],'as':_0x41a7eb['as'],'attributes':_0x41a7eb[_0xfb1c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xfb1c('0x24')](function(_0x599e6d){logger[_0xfb1c('0x10')](_0xfb1c('0x26'),_0x15ff6e);logger['debug'](_0xfb1c('0x26'),_0x15ff6e,JSON[_0xfb1c('0x27')](_0x599e6d));_0x536d10(_0x599e6d);})['catch'](function(_0x278164){logger[_0xfb1c('0x15')](_0xfb1c('0x26'),_0x278164[_0xfb1c('0x17')],_0x15ff6e);_0x4ea35c(_0x35a606[_0xfb1c('0x15')](0x1f4,_0x278164['message']));});});}; \ No newline at end of file +var _0xf628=['localhost','socket.io-emitter','./whatsappQueue.socket','register','then','info','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','where','attributes','limit','map','include','model','stringify','find','raw','ShowWhatsappQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis'];(function(_0x2404a3,_0x1c9119){var _0x5d5985=function(_0x55ea6a){while(--_0x55ea6a){_0x2404a3['push'](_0x2404a3['shift']());}};_0x5d5985(++_0x1c9119);}(_0xf628,0x97));var _0x8f62=function(_0x1b3e12,_0x3cbdfd){_0x1b3e12=_0x1b3e12-0x0;var _0x54d691=_0xf628[_0x1b3e12];return _0x54d691;};'use strict';var _=require(_0x8f62('0x0'));var util=require(_0x8f62('0x1'));var moment=require(_0x8f62('0x2'));var BPromise=require(_0x8f62('0x3'));var rs=require(_0x8f62('0x4'));var fs=require('fs');var Redis=require(_0x8f62('0x5'));var db=require(_0x8f62('0x6'))['db'];var utils=require(_0x8f62('0x7'));var logger=require(_0x8f62('0x8'))(_0x8f62('0x9'));var config=require(_0x8f62('0xa'));var jayson=require(_0x8f62('0xb'));var client=jayson['client']['http']({'port':0x232a});config[_0x8f62('0xc')]=_['defaults'](config[_0x8f62('0xc')],{'host':_0x8f62('0xd'),'port':0x18eb});var socket=require(_0x8f62('0xe'))(new Redis(config[_0x8f62('0xc')]));require(_0x8f62('0xf'))[_0x8f62('0x10')](socket);function respondWithRpcPromise(_0x1aec63,_0x28c12f,_0x554360){return new BPromise(function(_0x444d7c,_0x5c00d4){return client['request'](_0x1aec63,_0x554360)[_0x8f62('0x11')](function(_0x1953b8){logger[_0x8f62('0x12')](_0x8f62('0x13'),_0x28c12f,'request\x20sent');logger[_0x8f62('0x14')](_0x8f62('0x15'),_0x28c12f,_0x8f62('0x16'),JSON['stringify'](_0x1953b8));if(_0x1953b8[_0x8f62('0x17')]){if(_0x1953b8[_0x8f62('0x17')]['code']===0x1f4){logger['error'](_0x8f62('0x13'),_0x28c12f,_0x1953b8[_0x8f62('0x17')][_0x8f62('0x18')]);return _0x5c00d4(_0x1953b8[_0x8f62('0x17')]['message']);}logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x28c12f,_0x1953b8[_0x8f62('0x17')]['message']);return _0x444d7c(_0x1953b8[_0x8f62('0x17')][_0x8f62('0x18')]);}else{logger[_0x8f62('0x12')](_0x8f62('0x13'),_0x28c12f,'request\x20sent');_0x444d7c(_0x1953b8[_0x8f62('0x19')][_0x8f62('0x18')]);}})[_0x8f62('0x1a')](function(_0x3c35d2){logger[_0x8f62('0x17')]('WhatsappQueue,\x20%s,\x20%s',_0x28c12f,_0x3c35d2);_0x5c00d4(_0x3c35d2);});});}exports[_0x8f62('0x1b')]=function(_0xd81796){var _0x5a6f55=this;return new Promise(function(_0xca8fb,_0x57dee0){return db[_0x8f62('0x1c')][_0x8f62('0x1d')]({'raw':_0xd81796[_0x8f62('0x1e')]?_0xd81796[_0x8f62('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0xd81796['options']?_0xd81796[_0x8f62('0x1e')][_0x8f62('0x1f')]||null:null,'attributes':_0xd81796['options']?_0xd81796[_0x8f62('0x1e')][_0x8f62('0x20')]||null:null,'limit':_0xd81796['options']?_0xd81796[_0x8f62('0x1e')][_0x8f62('0x21')]||null:null,'include':_0xd81796[_0x8f62('0x1e')]?_0xd81796[_0x8f62('0x1e')]['include']?_[_0x8f62('0x22')](_0xd81796[_0x8f62('0x1e')][_0x8f62('0x23')],function(_0x56b0d3){return{'model':db[_0x56b0d3['model']],'as':_0x56b0d3['as'],'attributes':_0x56b0d3[_0x8f62('0x20')],'include':_0x56b0d3[_0x8f62('0x23')]?_[_0x8f62('0x22')](_0x56b0d3[_0x8f62('0x23')],function(_0x509a28){return{'model':db[_0x509a28['model']],'as':_0x509a28['as'],'attributes':_0x509a28['attributes'],'include':_0x509a28[_0x8f62('0x23')]?_[_0x8f62('0x22')](_0x509a28[_0x8f62('0x23')],function(_0x680343){return{'model':db[_0x680343[_0x8f62('0x24')]],'as':_0x680343['as'],'attributes':_0x680343[_0x8f62('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x487680){logger[_0x8f62('0x12')](_0x8f62('0x1b'),_0xd81796);logger[_0x8f62('0x14')](_0x8f62('0x1b'),_0xd81796,JSON[_0x8f62('0x25')](_0x487680));_0xca8fb(_0x487680);})['catch'](function(_0x1a8c0d){logger['error']('GetWhatsappQueue',_0x1a8c0d[_0x8f62('0x18')],_0xd81796);_0x57dee0(_0x5a6f55[_0x8f62('0x17')](0x1f4,_0x1a8c0d['message']));});});};exports['ShowWhatsappQueue']=function(_0x2f2beb){var _0x1aea83=this;return new Promise(function(_0x99d9d5,_0x538a1d){return db[_0x8f62('0x1c')][_0x8f62('0x26')]({'raw':_0x2f2beb[_0x8f62('0x1e')]?_0x2f2beb[_0x8f62('0x1e')][_0x8f62('0x27')]===undefined?!![]:![]:!![],'where':_0x2f2beb[_0x8f62('0x1e')]?_0x2f2beb[_0x8f62('0x1e')][_0x8f62('0x1f')]||null:null,'attributes':_0x2f2beb[_0x8f62('0x1e')]?_0x2f2beb['options'][_0x8f62('0x20')]||null:null,'include':_0x2f2beb[_0x8f62('0x1e')]?_0x2f2beb[_0x8f62('0x1e')][_0x8f62('0x23')]?_[_0x8f62('0x22')](_0x2f2beb['options'][_0x8f62('0x23')],function(_0xc0e9e5){return{'model':db[_0xc0e9e5[_0x8f62('0x24')]],'as':_0xc0e9e5['as'],'attributes':_0xc0e9e5[_0x8f62('0x20')],'include':_0xc0e9e5[_0x8f62('0x23')]?_['map'](_0xc0e9e5['include'],function(_0x2ddfc5){return{'model':db[_0x2ddfc5[_0x8f62('0x24')]],'as':_0x2ddfc5['as'],'attributes':_0x2ddfc5['attributes'],'include':_0x2ddfc5[_0x8f62('0x23')]?_['map'](_0x2ddfc5[_0x8f62('0x23')],function(_0x10a9ab){return{'model':db[_0x10a9ab['model']],'as':_0x10a9ab['as'],'attributes':_0x10a9ab[_0x8f62('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8f62('0x11')](function(_0x4b62d8){logger[_0x8f62('0x12')](_0x8f62('0x28'),_0x2f2beb);logger[_0x8f62('0x14')]('ShowWhatsappQueue',_0x2f2beb,JSON[_0x8f62('0x25')](_0x4b62d8));_0x99d9d5(_0x4b62d8);})['catch'](function(_0x470b89){logger[_0x8f62('0x17')](_0x8f62('0x28'),_0x470b89[_0x8f62('0x18')],_0x2f2beb);_0x538a1d(_0x1aea83['error'](0x1f4,_0x470b89[_0x8f62('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index f27c309..802058e 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 _0xe9a5=['emit','removeListener','length','whatsappQueue:','./whatsappQueue.events','save','remove','update'];(function(_0x33975a,_0x2c6ad9){var _0x30e5d3=function(_0x278928){while(--_0x278928){_0x33975a['push'](_0x33975a['shift']());}};_0x30e5d3(++_0x2c6ad9);}(_0xe9a5,0x1ac));var _0x5e9a=function(_0xd3b8c0,_0xcadde0){_0xd3b8c0=_0xd3b8c0-0x0;var _0x5b3e97=_0xe9a5[_0xd3b8c0];return _0x5b3e97;};'use strict';var WhatsappQueueEvents=require(_0x5e9a('0x0'));var events=[_0x5e9a('0x1'),_0x5e9a('0x2'),_0x5e9a('0x3')];function createListener(_0x2ad9b9,_0x36ce8c){return function(_0x443723){_0x36ce8c[_0x5e9a('0x4')](_0x2ad9b9,_0x443723);};}function removeListener(_0x2f6225,_0x3f19d1){return function(){WhatsappQueueEvents[_0x5e9a('0x5')](_0x2f6225,_0x3f19d1);};}exports['register']=function(_0x18e099){for(var _0x1976d3=0x0,_0x429f9e=events[_0x5e9a('0x6')];_0x1976d3<_0x429f9e;_0x1976d3++){var _0xfd90b3=events[_0x1976d3];var _0x5c0e59=createListener(_0x5e9a('0x7')+_0xfd90b3,_0x18e099);WhatsappQueueEvents['on'](_0xfd90b3,_0x5c0e59);}}; \ No newline at end of file +var _0xd1a1=['whatsappQueue:','./whatsappQueue.events','save','remove','emit','removeListener','length'];(function(_0x4763f7,_0x7c6950){var _0x5d419e=function(_0x593f4b){while(--_0x593f4b){_0x4763f7['push'](_0x4763f7['shift']());}};_0x5d419e(++_0x7c6950);}(_0xd1a1,0x120));var _0x1d1a=function(_0x1cb853,_0x3b0296){_0x1cb853=_0x1cb853-0x0;var _0x8ac2e3=_0xd1a1[_0x1cb853];return _0x8ac2e3;};'use strict';var WhatsappQueueEvents=require(_0x1d1a('0x0'));var events=[_0x1d1a('0x1'),_0x1d1a('0x2'),'update'];function createListener(_0xa9f8e7,_0xb97168){return function(_0x3e7aab){_0xb97168[_0x1d1a('0x3')](_0xa9f8e7,_0x3e7aab);};}function removeListener(_0x1bb44d,_0x329e6e){return function(){WhatsappQueueEvents[_0x1d1a('0x4')](_0x1bb44d,_0x329e6e);};}exports['register']=function(_0x15c866){for(var _0x5bd769=0x0,_0x8616c=events[_0x1d1a('0x5')];_0x5bd769<_0x8616c;_0x5bd769++){var _0x4a5c5=events[_0x5bd769];var _0x13be73=createListener(_0x1d1a('0x6')+_0x4a5c5,_0x15c866);WhatsappQueueEvents['on'](_0x4a5c5,_0x13be73);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 521cff9..d618622 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 _0x1119=['util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','isAuthenticated','index','get','/describe','/:id','show','create','delete','destroy','exports','multer'];(function(_0x157593,_0x1b4d2c){var _0x47e99a=function(_0x20a3f0){while(--_0x20a3f0){_0x157593['push'](_0x157593['shift']());}};_0x47e99a(++_0x1b4d2c);}(_0x1119,0x18e));var _0x9111=function(_0x37d317,_0x46dcc1){_0x37d317=_0x37d317-0x0;var _0x2c757f=_0x1119[_0x37d317];return _0x2c757f;};'use strict';var multer=require(_0x9111('0x0'));var util=require(_0x9111('0x1'));var path=require('path');var timeout=require(_0x9111('0x2'));var express=require(_0x9111('0x3'));var router=express[_0x9111('0x4')]();var fs_extra=require(_0x9111('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9111('0x6'));var config=require(_0x9111('0x7'));var controller=require(_0x9111('0x8'));router['get']('/',auth[_0x9111('0x9')](),controller[_0x9111('0xa')]);router[_0x9111('0xb')](_0x9111('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x9111('0xb')](_0x9111('0xd'),auth[_0x9111('0x9')](),controller[_0x9111('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9111('0xf')]);router['put']('/:id',auth[_0x9111('0x9')](),controller['update']);router[_0x9111('0x10')](_0x9111('0xd'),auth['isAuthenticated'](),controller[_0x9111('0x11')]);module[_0x9111('0x12')]=router; \ No newline at end of file +var _0x7b32=['post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','index','get','/describe','isAuthenticated','describe','/:id','show'];(function(_0x137faa,_0x24f399){var _0x35a2f0=function(_0x4a22b3){while(--_0x4a22b3){_0x137faa['push'](_0x137faa['shift']());}};_0x35a2f0(++_0x24f399);}(_0x7b32,0x1d2));var _0x27b3=function(_0x523b8f,_0x4b05ef){_0x523b8f=_0x523b8f-0x0;var _0x5e77fc=_0x7b32[_0x523b8f];return _0x5e77fc;};'use strict';var multer=require(_0x27b3('0x0'));var util=require(_0x27b3('0x1'));var path=require(_0x27b3('0x2'));var timeout=require(_0x27b3('0x3'));var express=require(_0x27b3('0x4'));var router=express[_0x27b3('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x27b3('0x6'));var interaction=require(_0x27b3('0x7'));var config=require(_0x27b3('0x8'));var controller=require(_0x27b3('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x27b3('0xa')]);router[_0x27b3('0xb')](_0x27b3('0xc'),auth[_0x27b3('0xd')](),controller[_0x27b3('0xe')]);router[_0x27b3('0xb')](_0x27b3('0xf'),auth['isAuthenticated'](),controller[_0x27b3('0x10')]);router[_0x27b3('0x11')]('/',auth[_0x27b3('0xd')](),controller[_0x27b3('0x12')]);router[_0x27b3('0x13')](_0x27b3('0xf'),auth[_0x27b3('0xd')](),controller[_0x27b3('0x14')]);router[_0x27b3('0x15')](_0x27b3('0xf'),auth[_0x27b3('0xd')](),controller[_0x27b3('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index df48c52..0e71b06 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(_0x5e300b,_0x1e106f){var _0x3af457=function(_0x590195){while(--_0x590195){_0x5e300b['push'](_0x5e300b['shift']());}};_0x3af457(++_0x1e106f);}(_0x7a54,0x106));var _0x47a5=function(_0x52a806,_0x5bc4ba){_0x52a806=_0x52a806-0x0;var _0xe3fa17=_0x7a54[_0x52a806];return _0xe3fa17;};'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(_0x7e9e77,_0x55562c){var _0x1ab1ea=function(_0x51076e){while(--_0x51076e){_0x7e9e77['push'](_0x7e9e77['shift']());}};_0x1ab1ea(++_0x55562c);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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 5464226..866e9d5 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 _0xdd4f=['intersection','includeAll','create','body','find','describe','eml-format','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','map','WhatsappQueueReport','rawAttributes','fieldName','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys'];(function(_0x49ed14,_0x279550){var _0x204f89=function(_0x1255d2){while(--_0x1255d2){_0x49ed14['push'](_0x49ed14['shift']());}};_0x204f89(++_0x279550);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0xcb3bc4,_0x2a2df8){_0xcb3bc4=_0xcb3bc4-0x0;var _0x23c89f=_0xdd4f[_0xcb3bc4];return _0x23c89f;};'use strict';var emlformat=require(_0xfdd4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfdd4('0x1'));var moment=require(_0xfdd4('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xfdd4('0x3'));var util=require(_0xfdd4('0x4'));var path=require(_0xfdd4('0x5'));var sox=require('sox');var csv=require(_0xfdd4('0x6'));var ejs=require(_0xfdd4('0x7'));var fs=require('fs');var fs_extra=require(_0xfdd4('0x8'));var _=require(_0xfdd4('0x9'));var squel=require(_0xfdd4('0xa'));var crypto=require('crypto');var jsforce=require(_0xfdd4('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xfdd4('0x6'));var querystring=require(_0xfdd4('0xc'));var Papa=require(_0xfdd4('0xd'));var Redis=require('ioredis');var authService=require(_0xfdd4('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xfdd4('0xf'));var hardwareService=require(_0xfdd4('0x10'));var logger=require(_0xfdd4('0x11'))(_0xfdd4('0x12'));var utils=require(_0xfdd4('0x13'));var config=require(_0xfdd4('0x14'));var licenseUtil=require(_0xfdd4('0x15'));var db=require(_0xfdd4('0x16'))['db'];function respondWithStatusCode(_0x3f07f1,_0x4565e6){_0x4565e6=_0x4565e6||0xcc;return function(_0x1bf37b){if(_0x1bf37b){return _0x3f07f1['sendStatus'](_0x4565e6);}return _0x3f07f1[_0xfdd4('0x17')](_0x4565e6)[_0xfdd4('0x18')]();};}function respondWithResult(_0x227099,_0x57b21f){_0x57b21f=_0x57b21f||0xc8;return function(_0x1b7da1){if(_0x1b7da1){return _0x227099['status'](_0x57b21f)[_0xfdd4('0x19')](_0x1b7da1);}};}function respondWithFilteredResult(_0x42c3a8,_0x2f34ec){return function(_0x431255){if(_0x431255){var _0x37b05f=typeof _0x2f34ec['offset']==='undefined'&&typeof _0x2f34ec['limit']===_0xfdd4('0x1a');var _0x216c7e=_0x431255[_0xfdd4('0x1b')];var _0x2ccc88=_0x37b05f?0x0:_0x2f34ec[_0xfdd4('0x1c')];var _0x33d752=_0x37b05f?_0x431255[_0xfdd4('0x1b')]:_0x2f34ec[_0xfdd4('0x1c')]+_0x2f34ec[_0xfdd4('0x1d')];var _0x52ce34;if(_0x33d752>=_0x216c7e){_0x33d752=_0x216c7e;_0x52ce34=0xc8;}else{_0x52ce34=0xce;}_0x42c3a8[_0xfdd4('0x17')](_0x52ce34);return _0x42c3a8[_0xfdd4('0x1e')](_0xfdd4('0x1f'),_0x2ccc88+'-'+_0x33d752+'/'+_0x216c7e)[_0xfdd4('0x19')](_0x431255);}return null;};}function patchUpdates(_0x1454f1){return function(_0x29cc8d){try{jsonpatch[_0xfdd4('0x20')](_0x29cc8d,_0x1454f1,!![]);}catch(_0x34dfa8){return BPromise['reject'](_0x34dfa8);}return _0x29cc8d[_0xfdd4('0x21')]();};}function saveUpdates(_0x17302b,_0x2a24e8){return function(_0x16e81b){if(_0x16e81b){return _0x16e81b[_0xfdd4('0x22')](_0x17302b)[_0xfdd4('0x23')](function(_0x451767){return _0x451767;});}return null;};}function removeEntity(_0x277ec1,_0x538b00){return function(_0x1e14da){if(_0x1e14da){return _0x1e14da[_0xfdd4('0x24')]()[_0xfdd4('0x23')](function(){_0x277ec1['status'](0xcc)[_0xfdd4('0x18')]();});}};}function handleEntityNotFound(_0x39b712,_0xf9c346){return function(_0x2f8268){if(!_0x2f8268){_0x39b712[_0xfdd4('0x25')](0x194);}return _0x2f8268;};}function handleError(_0x4a8790,_0x18bafb){_0x18bafb=_0x18bafb||0x1f4;return function(_0x2c88ad){logger[_0xfdd4('0x26')](_0x2c88ad[_0xfdd4('0x27')]);if(_0x2c88ad[_0xfdd4('0x28')]){delete _0x2c88ad[_0xfdd4('0x28')];}_0x4a8790[_0xfdd4('0x17')](_0x18bafb)[_0xfdd4('0x29')](_0x2c88ad);};}exports['index']=function(_0xcbd1fb,_0x39981f){var _0x385a68={},_0xef012e={},_0x2207ae={'count':0x0,'rows':[]};var _0x4a36a2=_[_0xfdd4('0x2a')](db[_0xfdd4('0x2b')][_0xfdd4('0x2c')],function(_0x2bb793){return{'name':_0x2bb793[_0xfdd4('0x2d')],'type':_0x2bb793['type'][_0xfdd4('0x2e')]};});_0xef012e[_0xfdd4('0x2f')]=_[_0xfdd4('0x2a')](_0x4a36a2,'name');_0xef012e[_0xfdd4('0x30')]=_['keys'](_0xcbd1fb[_0xfdd4('0x30')]);_0xef012e[_0xfdd4('0x31')]=_['intersection'](_0xef012e['model'],_0xef012e[_0xfdd4('0x30')]);_0x385a68[_0xfdd4('0x32')]=_['intersection'](_0xef012e['model'],qs[_0xfdd4('0x33')](_0xcbd1fb[_0xfdd4('0x30')][_0xfdd4('0x33')]));_0x385a68[_0xfdd4('0x32')]=_0x385a68[_0xfdd4('0x32')][_0xfdd4('0x34')]?_0x385a68[_0xfdd4('0x32')]:_0xef012e[_0xfdd4('0x2f')];if(!_0xcbd1fb[_0xfdd4('0x30')][_0xfdd4('0x35')](_0xfdd4('0x36'))){_0x385a68[_0xfdd4('0x1d')]=qs[_0xfdd4('0x1d')](_0xcbd1fb[_0xfdd4('0x30')][_0xfdd4('0x1d')]);_0x385a68[_0xfdd4('0x1c')]=qs[_0xfdd4('0x1c')](_0xcbd1fb[_0xfdd4('0x30')][_0xfdd4('0x1c')]);}_0x385a68[_0xfdd4('0x37')]=qs[_0xfdd4('0x38')](_0xcbd1fb[_0xfdd4('0x30')][_0xfdd4('0x38')]);_0x385a68[_0xfdd4('0x39')]=qs[_0xfdd4('0x31')](_[_0xfdd4('0x3a')](_0xcbd1fb['query'],_0xef012e[_0xfdd4('0x31')]),_0x4a36a2);if(_0xcbd1fb[_0xfdd4('0x30')][_0xfdd4('0x3b')]){_0x385a68[_0xfdd4('0x39')]=_[_0xfdd4('0x3c')](_0x385a68[_0xfdd4('0x39')],{'$or':_['map'](_0x4a36a2,function(_0x245ce4){if(_0x245ce4['type']!==_0xfdd4('0x3d')){var _0x2c5199={};_0x2c5199[_0x245ce4[_0xfdd4('0x28')]]={'$like':'%'+_0xcbd1fb[_0xfdd4('0x30')]['filter']+'%'};return _0x2c5199;}})});}_0x385a68=_[_0xfdd4('0x3c')]({},_0x385a68,_0xcbd1fb[_0xfdd4('0x3e')]);var _0x1040e8={'where':_0x385a68[_0xfdd4('0x39')]};return db[_0xfdd4('0x2b')][_0xfdd4('0x1b')](_0x1040e8)[_0xfdd4('0x23')](function(_0x55fcec){_0x2207ae[_0xfdd4('0x1b')]=_0x55fcec;if(_0xcbd1fb[_0xfdd4('0x30')]['includeAll']){_0x385a68[_0xfdd4('0x3f')]=[{'all':!![]}];}return db[_0xfdd4('0x2b')][_0xfdd4('0x40')](_0x385a68);})[_0xfdd4('0x23')](function(_0x5173db){_0x2207ae[_0xfdd4('0x41')]=_0x5173db;return _0x2207ae;})[_0xfdd4('0x23')](respondWithFilteredResult(_0x39981f,_0x385a68))[_0xfdd4('0x42')](handleError(_0x39981f,null));};exports[_0xfdd4('0x43')]=function(_0x362c4f,_0x496747){var _0x1411e0={'raw':!![],'where':{'id':_0x362c4f[_0xfdd4('0x44')]['id']}},_0x23af2a={};_0x23af2a[_0xfdd4('0x2f')]=_[_0xfdd4('0x45')](db[_0xfdd4('0x2b')][_0xfdd4('0x2c')]);_0x23af2a['query']=_[_0xfdd4('0x45')](_0x362c4f['query']);_0x23af2a[_0xfdd4('0x31')]=_[_0xfdd4('0x46')](_0x23af2a[_0xfdd4('0x2f')],_0x23af2a[_0xfdd4('0x30')]);_0x1411e0['attributes']=_[_0xfdd4('0x46')](_0x23af2a[_0xfdd4('0x2f')],qs['fields'](_0x362c4f[_0xfdd4('0x30')][_0xfdd4('0x33')]));_0x1411e0['attributes']=_0x1411e0[_0xfdd4('0x32')]['length']?_0x1411e0['attributes']:_0x23af2a['model'];if(_0x362c4f[_0xfdd4('0x30')][_0xfdd4('0x47')]){_0x1411e0[_0xfdd4('0x3f')]=[{'all':!![]}];}_0x1411e0=_['merge']({},_0x1411e0,_0x362c4f[_0xfdd4('0x3e')]);return db[_0xfdd4('0x2b')]['find'](_0x1411e0)[_0xfdd4('0x23')](handleEntityNotFound(_0x496747,null))[_0xfdd4('0x23')](respondWithResult(_0x496747,null))[_0xfdd4('0x42')](handleError(_0x496747,null));};exports[_0xfdd4('0x48')]=function(_0x746f6a,_0x3817fe){return db[_0xfdd4('0x2b')][_0xfdd4('0x48')](_0x746f6a[_0xfdd4('0x49')],{})[_0xfdd4('0x23')](respondWithResult(_0x3817fe,0xc9))[_0xfdd4('0x42')](handleError(_0x3817fe,null));};exports[_0xfdd4('0x22')]=function(_0x300965,_0x3c0ee1){if(_0x300965['body']['id']){delete _0x300965['body']['id'];}return db[_0xfdd4('0x2b')][_0xfdd4('0x4a')]({'where':{'id':_0x300965[_0xfdd4('0x44')]['id']}})[_0xfdd4('0x23')](handleEntityNotFound(_0x3c0ee1,null))['then'](saveUpdates(_0x300965[_0xfdd4('0x49')],null))[_0xfdd4('0x23')](respondWithResult(_0x3c0ee1,null))['catch'](handleError(_0x3c0ee1,null));};exports['destroy']=function(_0x53c66d,_0x51dd34){return db['WhatsappQueueReport'][_0xfdd4('0x4a')]({'where':{'id':_0x53c66d[_0xfdd4('0x44')]['id']}})[_0xfdd4('0x23')](handleEntityNotFound(_0x51dd34,null))[_0xfdd4('0x23')](removeEntity(_0x51dd34,null))[_0xfdd4('0x42')](handleError(_0x51dd34,null));};exports[_0xfdd4('0x4b')]=function(_0x4d0332,_0x17bbab){return db[_0xfdd4('0x2b')][_0xfdd4('0x4b')]()[_0xfdd4('0x23')](respondWithResult(_0x17bbab,null))['catch'](handleError(_0x17bbab,null));}; \ No newline at end of file +var _0x757a=['include','findAll','rows','show','params','WhatsappQueueReport','find','create','body','catch','destroy','describe','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','status','json','offset','undefined','count','limit','Content-Range','apply','update','then','end','sendStatus','error','stack','name','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll'];(function(_0x5337d2,_0x4b79b1){var _0x4b054d=function(_0x58043f){while(--_0x58043f){_0x5337d2['push'](_0x5337d2['shift']());}};_0x4b054d(++_0x4b79b1);}(_0x757a,0xde));var _0xa757=function(_0x4ff369,_0x47a9a6){_0x4ff369=_0x4ff369-0x0;var _0x1741de=_0x757a[_0x4ff369];return _0x1741de;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa757('0x0'));var zipdir=require(_0xa757('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa757('0x2'));var Mustache=require(_0xa757('0x3'));var util=require(_0xa757('0x4'));var path=require(_0xa757('0x5'));var sox=require(_0xa757('0x6'));var csv=require(_0xa757('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa757('0x8'));var _=require(_0xa757('0x9'));var squel=require('squel');var crypto=require(_0xa757('0xa'));var jsforce=require(_0xa757('0xb'));var deskjs=require(_0xa757('0xc'));var toCsv=require(_0xa757('0x7'));var querystring=require(_0xa757('0xd'));var Papa=require('papaparse');var Redis=require(_0xa757('0xe'));var authService=require(_0xa757('0xf'));var qs=require(_0xa757('0x10'));var as=require(_0xa757('0x11'));var hardwareService=require(_0xa757('0x12'));var logger=require(_0xa757('0x13'))(_0xa757('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4db68e,_0x421040){_0x421040=_0x421040||0xcc;return function(_0x544b45){if(_0x544b45){return _0x4db68e['sendStatus'](_0x421040);}return _0x4db68e[_0xa757('0x15')](_0x421040)['end']();};}function respondWithResult(_0x481508,_0x32112b){_0x32112b=_0x32112b||0xc8;return function(_0x1b670e){if(_0x1b670e){return _0x481508[_0xa757('0x15')](_0x32112b)[_0xa757('0x16')](_0x1b670e);}};}function respondWithFilteredResult(_0x86abd,_0x31cfd2){return function(_0xf12b68){if(_0xf12b68){var _0x2f7947=typeof _0x31cfd2[_0xa757('0x17')]===_0xa757('0x18')&&typeof _0x31cfd2['limit']===_0xa757('0x18');var _0x44eab8=_0xf12b68[_0xa757('0x19')];var _0x4d9f58=_0x2f7947?0x0:_0x31cfd2['offset'];var _0x151c04=_0x2f7947?_0xf12b68[_0xa757('0x19')]:_0x31cfd2[_0xa757('0x17')]+_0x31cfd2[_0xa757('0x1a')];var _0x27f4ba;if(_0x151c04>=_0x44eab8){_0x151c04=_0x44eab8;_0x27f4ba=0xc8;}else{_0x27f4ba=0xce;}_0x86abd[_0xa757('0x15')](_0x27f4ba);return _0x86abd['set'](_0xa757('0x1b'),_0x4d9f58+'-'+_0x151c04+'/'+_0x44eab8)['json'](_0xf12b68);}return null;};}function patchUpdates(_0x32c2a1){return function(_0x167640){try{jsonpatch[_0xa757('0x1c')](_0x167640,_0x32c2a1,!![]);}catch(_0x2c9ec6){return BPromise['reject'](_0x2c9ec6);}return _0x167640['save']();};}function saveUpdates(_0x40ec48,_0x2159cf){return function(_0x2ba923){if(_0x2ba923){return _0x2ba923[_0xa757('0x1d')](_0x40ec48)[_0xa757('0x1e')](function(_0x40562f){return _0x40562f;});}return null;};}function removeEntity(_0x2ca10d,_0x21f1af){return function(_0x2bf276){if(_0x2bf276){return _0x2bf276['destroy']()[_0xa757('0x1e')](function(){_0x2ca10d['status'](0xcc)[_0xa757('0x1f')]();});}};}function handleEntityNotFound(_0x47903b,_0x40551d){return function(_0x3859ce){if(!_0x3859ce){_0x47903b[_0xa757('0x20')](0x194);}return _0x3859ce;};}function handleError(_0x4d58a4,_0x2b19d5){_0x2b19d5=_0x2b19d5||0x1f4;return function(_0xcd98bd){logger[_0xa757('0x21')](_0xcd98bd[_0xa757('0x22')]);if(_0xcd98bd['name']){delete _0xcd98bd[_0xa757('0x23')];}_0x4d58a4['status'](_0x2b19d5)['send'](_0xcd98bd);};}exports['index']=function(_0x4f8de2,_0xfdf69d){var _0x596ae2={},_0x2208f9={},_0x3bc24c={'count':0x0,'rows':[]};var _0x55c5f8=_[_0xa757('0x24')](db['WhatsappQueueReport'][_0xa757('0x25')],function(_0xa6d0f6){return{'name':_0xa6d0f6['fieldName'],'type':_0xa6d0f6[_0xa757('0x26')]['key']};});_0x2208f9[_0xa757('0x27')]=_[_0xa757('0x24')](_0x55c5f8,_0xa757('0x23'));_0x2208f9[_0xa757('0x28')]=_[_0xa757('0x29')](_0x4f8de2[_0xa757('0x28')]);_0x2208f9[_0xa757('0x2a')]=_[_0xa757('0x2b')](_0x2208f9[_0xa757('0x27')],_0x2208f9[_0xa757('0x28')]);_0x596ae2[_0xa757('0x2c')]=_[_0xa757('0x2b')](_0x2208f9[_0xa757('0x27')],qs[_0xa757('0x2d')](_0x4f8de2[_0xa757('0x28')][_0xa757('0x2d')]));_0x596ae2[_0xa757('0x2c')]=_0x596ae2[_0xa757('0x2c')][_0xa757('0x2e')]?_0x596ae2[_0xa757('0x2c')]:_0x2208f9[_0xa757('0x27')];if(!_0x4f8de2[_0xa757('0x28')][_0xa757('0x2f')](_0xa757('0x30'))){_0x596ae2['limit']=qs[_0xa757('0x1a')](_0x4f8de2[_0xa757('0x28')][_0xa757('0x1a')]);_0x596ae2[_0xa757('0x17')]=qs[_0xa757('0x17')](_0x4f8de2['query'][_0xa757('0x17')]);}_0x596ae2[_0xa757('0x31')]=qs[_0xa757('0x32')](_0x4f8de2[_0xa757('0x28')][_0xa757('0x32')]);_0x596ae2[_0xa757('0x33')]=qs['filters'](_[_0xa757('0x34')](_0x4f8de2[_0xa757('0x28')],_0x2208f9[_0xa757('0x2a')]),_0x55c5f8);if(_0x4f8de2[_0xa757('0x28')][_0xa757('0x35')]){_0x596ae2[_0xa757('0x33')]=_[_0xa757('0x36')](_0x596ae2[_0xa757('0x33')],{'$or':_[_0xa757('0x24')](_0x55c5f8,function(_0x4f9d98){if(_0x4f9d98[_0xa757('0x26')]!==_0xa757('0x37')){var _0x9f73c6={};_0x9f73c6[_0x4f9d98[_0xa757('0x23')]]={'$like':'%'+_0x4f8de2[_0xa757('0x28')][_0xa757('0x35')]+'%'};return _0x9f73c6;}})});}_0x596ae2=_['merge']({},_0x596ae2,_0x4f8de2[_0xa757('0x38')]);var _0x6d77ed={'where':_0x596ae2['where']};return db['WhatsappQueueReport'][_0xa757('0x19')](_0x6d77ed)[_0xa757('0x1e')](function(_0x5b11fe){_0x3bc24c['count']=_0x5b11fe;if(_0x4f8de2[_0xa757('0x28')][_0xa757('0x39')]){_0x596ae2[_0xa757('0x3a')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0xa757('0x3b')](_0x596ae2);})[_0xa757('0x1e')](function(_0x26802c){_0x3bc24c[_0xa757('0x3c')]=_0x26802c;return _0x3bc24c;})[_0xa757('0x1e')](respondWithFilteredResult(_0xfdf69d,_0x596ae2))['catch'](handleError(_0xfdf69d,null));};exports[_0xa757('0x3d')]=function(_0x52c728,_0x564d40){var _0x43329c={'raw':!![],'where':{'id':_0x52c728[_0xa757('0x3e')]['id']}},_0x57298b={};_0x57298b[_0xa757('0x27')]=_[_0xa757('0x29')](db['WhatsappQueueReport']['rawAttributes']);_0x57298b[_0xa757('0x28')]=_[_0xa757('0x29')](_0x52c728[_0xa757('0x28')]);_0x57298b[_0xa757('0x2a')]=_[_0xa757('0x2b')](_0x57298b[_0xa757('0x27')],_0x57298b['query']);_0x43329c[_0xa757('0x2c')]=_[_0xa757('0x2b')](_0x57298b['model'],qs[_0xa757('0x2d')](_0x52c728['query'][_0xa757('0x2d')]));_0x43329c[_0xa757('0x2c')]=_0x43329c['attributes'][_0xa757('0x2e')]?_0x43329c[_0xa757('0x2c')]:_0x57298b['model'];if(_0x52c728[_0xa757('0x28')][_0xa757('0x39')]){_0x43329c[_0xa757('0x3a')]=[{'all':!![]}];}_0x43329c=_[_0xa757('0x36')]({},_0x43329c,_0x52c728['options']);return db[_0xa757('0x3f')][_0xa757('0x40')](_0x43329c)[_0xa757('0x1e')](handleEntityNotFound(_0x564d40,null))[_0xa757('0x1e')](respondWithResult(_0x564d40,null))['catch'](handleError(_0x564d40,null));};exports[_0xa757('0x41')]=function(_0x5b6017,_0x50c131){return db[_0xa757('0x3f')][_0xa757('0x41')](_0x5b6017[_0xa757('0x42')],{})['then'](respondWithResult(_0x50c131,0xc9))[_0xa757('0x43')](handleError(_0x50c131,null));};exports['update']=function(_0x2ed63f,_0x151cc3){if(_0x2ed63f[_0xa757('0x42')]['id']){delete _0x2ed63f[_0xa757('0x42')]['id'];}return db[_0xa757('0x3f')][_0xa757('0x40')]({'where':{'id':_0x2ed63f[_0xa757('0x3e')]['id']}})[_0xa757('0x1e')](handleEntityNotFound(_0x151cc3,null))['then'](saveUpdates(_0x2ed63f[_0xa757('0x42')],null))[_0xa757('0x1e')](respondWithResult(_0x151cc3,null))[_0xa757('0x43')](handleError(_0x151cc3,null));};exports[_0xa757('0x44')]=function(_0x319988,_0x1f10cf){return db[_0xa757('0x3f')][_0xa757('0x40')]({'where':{'id':_0x319988[_0xa757('0x3e')]['id']}})[_0xa757('0x1e')](handleEntityNotFound(_0x1f10cf,null))[_0xa757('0x1e')](removeEntity(_0x1f10cf,null))[_0xa757('0x43')](handleError(_0x1f10cf,null));};exports[_0xa757('0x45')]=function(_0x354ad5,_0x388573){return db[_0xa757('0x3f')]['describe']()[_0xa757('0x1e')](respondWithResult(_0x388573,null))['catch'](handleError(_0x388573,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index ea1ef08..c9110c5 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 _0x6fc6=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash'];(function(_0x443d6c,_0x3b9f76){var _0x2c4221=function(_0x1fa6e4){while(--_0x1fa6e4){_0x443d6c['push'](_0x443d6c['shift']());}};_0x2c4221(++_0x3b9f76);}(_0x6fc6,0xf6));var _0x66fc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6fc6[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x66fc('0x0'));var util=require(_0x66fc('0x1'));var logger=require(_0x66fc('0x2'))(_0x66fc('0x3'));var moment=require(_0x66fc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x66fc('0x5'));var rimraf=require(_0x66fc('0x6'));var config=require(_0x66fc('0x7'));var attributes=require(_0x66fc('0x8'));module['exports']=function(_0xb4111a,_0x4827f5){return _0xb4111a[_0x66fc('0x9')](_0x66fc('0xa'),attributes,{'tableName':_0x66fc('0xb'),'paranoid':![],'indexes':[{'name':_0x66fc('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe989=['report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport'];(function(_0x4b017a,_0x171787){var _0x19c799=function(_0x306583){while(--_0x306583){_0x4b017a['push'](_0x4b017a['shift']());}};_0x19c799(++_0x171787);}(_0xe989,0x9c));var _0x9e98=function(_0xc9b988,_0x429150){_0xc9b988=_0xc9b988-0x0;var _0x5f14fe=_0xe989[_0xc9b988];return _0x5f14fe;};'use strict';var _=require(_0x9e98('0x0'));var util=require(_0x9e98('0x1'));var logger=require(_0x9e98('0x2'))(_0x9e98('0x3'));var moment=require(_0x9e98('0x4'));var BPromise=require(_0x9e98('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9e98('0x6'));var rimraf=require(_0x9e98('0x7'));var config=require('../../config/environment');var attributes=require(_0x9e98('0x8'));module[_0x9e98('0x9')]=function(_0x106746,_0x27d849){return _0x106746[_0x9e98('0xa')](_0x9e98('0xb'),attributes,{'tableName':_0x9e98('0xc'),'paranoid':![],'indexes':[{'name':_0x9e98('0xd'),'fields':[_0x9e98('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 705ba90..81a283d 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 _0x3d15=['result','catch','CreateWhatsappQueueReport','create','body','options','raw','UpdateWhatsappQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','WhatsappQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info'];(function(_0x144ab4,_0x21562a){var _0x5b17c0=function(_0x7543e){while(--_0x7543e){_0x144ab4['push'](_0x144ab4['shift']());}};_0x5b17c0(++_0x21562a);}(_0x3d15,0x94));var _0x53d1=function(_0x2cd04b,_0xd130f9){_0x2cd04b=_0x2cd04b-0x0;var _0x213da5=_0x3d15[_0x2cd04b];return _0x213da5;};'use strict';var _=require(_0x53d1('0x0'));var util=require(_0x53d1('0x1'));var moment=require(_0x53d1('0x2'));var BPromise=require(_0x53d1('0x3'));var rs=require(_0x53d1('0x4'));var fs=require('fs');var Redis=require(_0x53d1('0x5'));var db=require(_0x53d1('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x53d1('0x7'))('rpc');var config=require(_0x53d1('0x8'));var jayson=require(_0x53d1('0x9'));var client=jayson[_0x53d1('0xa')][_0x53d1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e8bc9,_0x1bf5b9,_0x38d14a){return new BPromise(function(_0x398ff8,_0xc8d43b){return client[_0x53d1('0xc')](_0x4e8bc9,_0x38d14a)[_0x53d1('0xd')](function(_0xd26227){logger['info'](_0x53d1('0xe'),_0x1bf5b9,'request\x20sent');logger[_0x53d1('0xf')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x1bf5b9,_0x53d1('0x10'),JSON[_0x53d1('0x11')](_0xd26227));if(_0xd26227[_0x53d1('0x12')]){if(_0xd26227[_0x53d1('0x12')][_0x53d1('0x13')]===0x1f4){logger[_0x53d1('0x12')](_0x53d1('0xe'),_0x1bf5b9,_0xd26227[_0x53d1('0x12')][_0x53d1('0x14')]);return _0xc8d43b(_0xd26227[_0x53d1('0x12')][_0x53d1('0x14')]);}logger[_0x53d1('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x1bf5b9,_0xd26227[_0x53d1('0x12')][_0x53d1('0x14')]);return _0x398ff8(_0xd26227[_0x53d1('0x12')][_0x53d1('0x14')]);}else{logger[_0x53d1('0x15')](_0x53d1('0xe'),_0x1bf5b9,_0x53d1('0x10'));_0x398ff8(_0xd26227[_0x53d1('0x16')]['message']);}})[_0x53d1('0x17')](function(_0x4ae0d0){logger[_0x53d1('0x12')](_0x53d1('0xe'),_0x1bf5b9,_0x4ae0d0);_0xc8d43b(_0x4ae0d0);});});}exports[_0x53d1('0x18')]=function(_0x519e75){var _0x3099cd=this;return new Promise(function(_0x34606a,_0x18de3e){return db['WhatsappQueueReport'][_0x53d1('0x19')](_0x519e75[_0x53d1('0x1a')],{'raw':_0x519e75[_0x53d1('0x1b')]?_0x519e75[_0x53d1('0x1b')][_0x53d1('0x1c')]===undefined?!![]:![]:!![]})[_0x53d1('0xd')](function(_0x302aac){logger['info'](_0x53d1('0x18'),_0x519e75);logger[_0x53d1('0xf')](_0x53d1('0x18'),_0x519e75,JSON[_0x53d1('0x11')](_0x302aac));_0x34606a(_0x302aac);})[_0x53d1('0x17')](function(_0x265c93){logger[_0x53d1('0x12')](_0x53d1('0x18'),_0x265c93[_0x53d1('0x14')],_0x519e75);_0x18de3e(_0x3099cd[_0x53d1('0x12')](0x1f4,_0x265c93[_0x53d1('0x14')]));});});};exports[_0x53d1('0x1d')]=function(_0xf6bcb6){var _0x7949b8=this;return new Promise(function(_0x5335fc,_0x4ebd40){return db['WhatsappQueueReport'][_0x53d1('0x1e')](_0xf6bcb6['body'],{'raw':_0xf6bcb6[_0x53d1('0x1b')]?_0xf6bcb6[_0x53d1('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf6bcb6['options']?_0xf6bcb6['options'][_0x53d1('0x1f')]||null:null,'attributes':_0xf6bcb6[_0x53d1('0x1b')]?_0xf6bcb6[_0x53d1('0x1b')][_0x53d1('0x20')]||null:null,'limit':_0xf6bcb6[_0x53d1('0x1b')]?_0xf6bcb6[_0x53d1('0x1b')][_0x53d1('0x21')]||null:null})[_0x53d1('0xd')](function(_0x2f1521){logger[_0x53d1('0x15')](_0x53d1('0x1d'),_0xf6bcb6);logger['debug'](_0x53d1('0x1d'),_0xf6bcb6,JSON[_0x53d1('0x11')](_0x2f1521));_0x5335fc(_0x2f1521);})[_0x53d1('0x17')](function(_0x19a5c3){logger['error'](_0x53d1('0x1d'),_0x19a5c3[_0x53d1('0x14')],_0xf6bcb6);_0x4ebd40(_0x7949b8['error'](0x1f4,_0x19a5c3[_0x53d1('0x14')]));});});}; \ No newline at end of file +var _0x7562=['info','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappQueueReport,\x20%s,\x20%s','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','raw','then','debug','UpdateWhatsappQueueReport','update','options','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3e6d4d,_0x2c9389){var _0x425cc4=function(_0x27c4e4){while(--_0x27c4e4){_0x3e6d4d['push'](_0x3e6d4d['shift']());}};_0x425cc4(++_0x2c9389);}(_0x7562,0x1a0));var _0x2756=function(_0x3caccc,_0x43d12c){_0x3caccc=_0x3caccc-0x0;var _0x2c2c0f=_0x7562[_0x3caccc];return _0x2c2c0f;};'use strict';var _=require(_0x2756('0x0'));var util=require(_0x2756('0x1'));var moment=require(_0x2756('0x2'));var BPromise=require(_0x2756('0x3'));var rs=require(_0x2756('0x4'));var fs=require('fs');var Redis=require(_0x2756('0x5'));var db=require(_0x2756('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2756('0x7'))(_0x2756('0x8'));var config=require(_0x2756('0x9'));var jayson=require(_0x2756('0xa'));var client=jayson[_0x2756('0xb')][_0x2756('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3b58dc,_0x535f4f,_0x458f48){return new BPromise(function(_0x14eeb3,_0xe111fe){return client['request'](_0x3b58dc,_0x458f48)['then'](function(_0x43f9c2){logger[_0x2756('0xd')]('WhatsappQueueReport,\x20%s,\x20%s',_0x535f4f,_0x2756('0xe'));logger['debug'](_0x2756('0xf'),_0x535f4f,_0x2756('0xe'),JSON[_0x2756('0x10')](_0x43f9c2));if(_0x43f9c2['error']){if(_0x43f9c2[_0x2756('0x11')][_0x2756('0x12')]===0x1f4){logger[_0x2756('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x535f4f,_0x43f9c2[_0x2756('0x11')][_0x2756('0x13')]);return _0xe111fe(_0x43f9c2[_0x2756('0x11')]['message']);}logger[_0x2756('0x11')](_0x2756('0x14'),_0x535f4f,_0x43f9c2[_0x2756('0x11')]['message']);return _0x14eeb3(_0x43f9c2[_0x2756('0x11')][_0x2756('0x13')]);}else{logger['info'](_0x2756('0x14'),_0x535f4f,_0x2756('0xe'));_0x14eeb3(_0x43f9c2[_0x2756('0x15')]['message']);}})[_0x2756('0x16')](function(_0x160089){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x535f4f,_0x160089);_0xe111fe(_0x160089);});});}exports[_0x2756('0x17')]=function(_0x4591eb){var _0x44ba45=this;return new Promise(function(_0xcf8ab0,_0x70f40a){return db[_0x2756('0x18')][_0x2756('0x19')](_0x4591eb['body'],{'raw':_0x4591eb['options']?_0x4591eb['options'][_0x2756('0x1a')]===undefined?!![]:![]:!![]})[_0x2756('0x1b')](function(_0x2d8d34){logger[_0x2756('0xd')]('CreateWhatsappQueueReport',_0x4591eb);logger[_0x2756('0x1c')](_0x2756('0x17'),_0x4591eb,JSON[_0x2756('0x10')](_0x2d8d34));_0xcf8ab0(_0x2d8d34);})[_0x2756('0x16')](function(_0x24b0af){logger['error'](_0x2756('0x17'),_0x24b0af['message'],_0x4591eb);_0x70f40a(_0x44ba45['error'](0x1f4,_0x24b0af[_0x2756('0x13')]));});});};exports[_0x2756('0x1d')]=function(_0x34270d){var _0x2100a2=this;return new Promise(function(_0x5c11bb,_0xbcb050){return db[_0x2756('0x18')][_0x2756('0x1e')](_0x34270d['body'],{'raw':_0x34270d[_0x2756('0x1f')]?_0x34270d['options'][_0x2756('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34270d[_0x2756('0x1f')]?_0x34270d[_0x2756('0x1f')]['where']||null:null,'attributes':_0x34270d[_0x2756('0x1f')]?_0x34270d[_0x2756('0x1f')][_0x2756('0x20')]||null:null,'limit':_0x34270d['options']?_0x34270d[_0x2756('0x1f')]['limit']||null:null})[_0x2756('0x1b')](function(_0x832aa3){logger[_0x2756('0xd')](_0x2756('0x1d'),_0x34270d);logger['debug'](_0x2756('0x1d'),_0x34270d,JSON[_0x2756('0x10')](_0x832aa3));_0x5c11bb(_0x832aa3);})[_0x2756('0x16')](function(_0x2e53c1){logger[_0x2756('0x11')](_0x2756('0x1d'),_0x2e53c1[_0x2756('0x13')],_0x34270d);_0xbcb050(_0x2100a2[_0x2756('0x11')](0x1f4,_0x2e53c1[_0x2756('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index abee9df..215cedc 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 _0xb759=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','index','get','/describe','describe','/:id','show','post','isAuthenticated','update','destroy'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb759,0x65));var _0x9b75=function(_0x2526bd,_0x751acd){_0x2526bd=_0x2526bd-0x0;var _0x5991a7=_0xb759[_0x2526bd];return _0x5991a7;};'use strict';var multer=require('multer');var util=require(_0x9b75('0x0'));var path=require(_0x9b75('0x1'));var timeout=require(_0x9b75('0x2'));var express=require(_0x9b75('0x3'));var router=express[_0x9b75('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9b75('0x5'));var interaction=require(_0x9b75('0x6'));var config=require(_0x9b75('0x7'));var controller=require(_0x9b75('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x9b75('0x9')]);router[_0x9b75('0xa')](_0x9b75('0xb'),auth['isAuthenticated'](),controller[_0x9b75('0xc')]);router[_0x9b75('0xa')](_0x9b75('0xd'),auth['isAuthenticated'](),controller[_0x9b75('0xe')]);router[_0x9b75('0xf')]('/',auth[_0x9b75('0x10')](),controller['create']);router['put'](_0x9b75('0xd'),auth[_0x9b75('0x10')](),controller[_0x9b75('0x11')]);router['delete'](_0x9b75('0xd'),auth[_0x9b75('0x10')](),controller[_0x9b75('0x12')]);module[_0x9b75('0x13')]=router; \ No newline at end of file +var _0xcebe=['index','/describe','/:id','show','post','update','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated'];(function(_0x2b6361,_0xe212f8){var _0x3fe110=function(_0x28eec7){while(--_0x28eec7){_0x2b6361['push'](_0x2b6361['shift']());}};_0x3fe110(++_0xe212f8);}(_0xcebe,0x85));var _0xeceb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcebe[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xeceb('0x0'));var util=require(_0xeceb('0x1'));var path=require(_0xeceb('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xeceb('0x3')]();var fs_extra=require(_0xeceb('0x4'));var auth=require(_0xeceb('0x5'));var interaction=require(_0xeceb('0x6'));var config=require(_0xeceb('0x7'));var controller=require(_0xeceb('0x8'));router[_0xeceb('0x9')]('/',auth[_0xeceb('0xa')](),controller[_0xeceb('0xb')]);router[_0xeceb('0x9')](_0xeceb('0xc'),auth[_0xeceb('0xa')](),controller['describe']);router[_0xeceb('0x9')](_0xeceb('0xd'),auth[_0xeceb('0xa')](),controller[_0xeceb('0xe')]);router[_0xeceb('0xf')]('/',auth[_0xeceb('0xa')](),controller['create']);router['put'](_0xeceb('0xd'),auth['isAuthenticated'](),controller[_0xeceb('0x10')]);router['delete']('/:id',auth[_0xeceb('0xa')](),controller['destroy']);module[_0xeceb('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index fab1a43..7855fcd 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 _0x7334=['STRING','agent','DATE','sequelize','exports'];(function(_0x56e4f1,_0x4af5bb){var _0xec71bf=function(_0x56c864){while(--_0x56c864){_0x56e4f1['push'](_0x56e4f1['shift']());}};_0xec71bf(++_0x4af5bb);}(_0x7334,0x184));var _0x4733=function(_0x2d3bb8,_0x55dba4){_0x2d3bb8=_0x2d3bb8-0x0;var _0xd06a1a=_0x7334[_0x2d3bb8];return _0xd06a1a;};'use strict';var Sequelize=require(_0x4733('0x0'));module[_0x4733('0x1')]={'uniqueid':{'type':Sequelize[_0x4733('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account',_0x4733('0x3'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x4733('0x4')]}}; \ No newline at end of file +var _0x110f=['agent','DATE','sequelize','exports'];(function(_0x106ad9,_0x5d9dd4){var _0x56f33f=function(_0x27debf){while(--_0x27debf){_0x106ad9['push'](_0x106ad9['shift']());}};_0x56f33f(++_0x5d9dd4);}(_0x110f,0x1e6));var _0xf110=function(_0x3e78cf,_0x39e5e6){_0x3e78cf=_0x3e78cf-0x0;var _0x37cefe=_0x110f[_0x3e78cf];return _0x37cefe;};'use strict';var Sequelize=require(_0xf110('0x0'));module[_0xf110('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account',_0xf110('0x2'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xf110('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index bdf2f79..a44822c 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 _0xbbbc=['query','intersection','fields','attributes','length','order','sort','where','merge','VIRTUAL','filter','options','findAll','rows','catch','params','keys','filters','includeAll','include','create','body','find','describe','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','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x251535,_0x4a49e8){_0x251535=_0x251535-0x0;var _0x4a7b3e=_0xbbbc[_0x251535];return _0x4a7b3e;};'use strict';var emlformat=require(_0xcbbb('0x0'));var rimraf=require(_0xcbbb('0x1'));var zipdir=require(_0xcbbb('0x2'));var jsonpatch=require(_0xcbbb('0x3'));var rp=require(_0xcbbb('0x4'));var moment=require(_0xcbbb('0x5'));var BPromise=require(_0xcbbb('0x6'));var Mustache=require('mustache');var util=require(_0xcbbb('0x7'));var path=require(_0xcbbb('0x8'));var sox=require(_0xcbbb('0x9'));var csv=require(_0xcbbb('0xa'));var ejs=require(_0xcbbb('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcbbb('0xc'));var squel=require(_0xcbbb('0xd'));var crypto=require(_0xcbbb('0xe'));var jsforce=require(_0xcbbb('0xf'));var deskjs=require(_0xcbbb('0x10'));var toCsv=require(_0xcbbb('0xa'));var querystring=require(_0xcbbb('0x11'));var Papa=require('papaparse');var Redis=require(_0xcbbb('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcbbb('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcbbb('0x14'))('api');var utils=require(_0xcbbb('0x15'));var config=require(_0xcbbb('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xcbbb('0x17'))['db'];function respondWithStatusCode(_0x53e651,_0x56f81){_0x56f81=_0x56f81||0xcc;return function(_0x523c50){if(_0x523c50){return _0x53e651[_0xcbbb('0x18')](_0x56f81);}return _0x53e651[_0xcbbb('0x19')](_0x56f81)[_0xcbbb('0x1a')]();};}function respondWithResult(_0x47ea6a,_0x27ba56){_0x27ba56=_0x27ba56||0xc8;return function(_0x3ff767){if(_0x3ff767){return _0x47ea6a[_0xcbbb('0x19')](_0x27ba56)[_0xcbbb('0x1b')](_0x3ff767);}};}function respondWithFilteredResult(_0x47e679,_0x5af226){return function(_0x1bba39){if(_0x1bba39){var _0x30297d=typeof _0x5af226[_0xcbbb('0x1c')]===_0xcbbb('0x1d')&&typeof _0x5af226['limit']===_0xcbbb('0x1d');var _0x4ff973=_0x1bba39[_0xcbbb('0x1e')];var _0x3436af=_0x30297d?0x0:_0x5af226[_0xcbbb('0x1c')];var _0x5052df=_0x30297d?_0x1bba39['count']:_0x5af226['offset']+_0x5af226[_0xcbbb('0x1f')];var _0x3ae91b;if(_0x5052df>=_0x4ff973){_0x5052df=_0x4ff973;_0x3ae91b=0xc8;}else{_0x3ae91b=0xce;}_0x47e679[_0xcbbb('0x19')](_0x3ae91b);return _0x47e679[_0xcbbb('0x20')](_0xcbbb('0x21'),_0x3436af+'-'+_0x5052df+'/'+_0x4ff973)[_0xcbbb('0x1b')](_0x1bba39);}return null;};}function patchUpdates(_0x45de5f){return function(_0x2be36c){try{jsonpatch[_0xcbbb('0x22')](_0x2be36c,_0x45de5f,!![]);}catch(_0x2d4335){return BPromise['reject'](_0x2d4335);}return _0x2be36c[_0xcbbb('0x23')]();};}function saveUpdates(_0xe07b0,_0x159c62){return function(_0x42aaf1){if(_0x42aaf1){return _0x42aaf1[_0xcbbb('0x24')](_0xe07b0)[_0xcbbb('0x25')](function(_0x297eae){return _0x297eae;});}return null;};}function removeEntity(_0xabb565,_0x3ca570){return function(_0x5e3970){if(_0x5e3970){return _0x5e3970[_0xcbbb('0x26')]()[_0xcbbb('0x25')](function(){_0xabb565['status'](0xcc)[_0xcbbb('0x1a')]();});}};}function handleEntityNotFound(_0x4ffa80,_0x48dfc4){return function(_0x575d56){if(!_0x575d56){_0x4ffa80[_0xcbbb('0x18')](0x194);}return _0x575d56;};}function handleError(_0x548440,_0x59c422){_0x59c422=_0x59c422||0x1f4;return function(_0x5499a1){logger[_0xcbbb('0x27')](_0x5499a1['stack']);if(_0x5499a1['name']){delete _0x5499a1[_0xcbbb('0x28')];}_0x548440[_0xcbbb('0x19')](_0x59c422)[_0xcbbb('0x29')](_0x5499a1);};}exports[_0xcbbb('0x2a')]=function(_0x372024,_0x39ba8b){var _0x3d4c0d={},_0x1c986d={},_0x2a023f={'count':0x0,'rows':[]};var _0x26c05e=_[_0xcbbb('0x2b')](db[_0xcbbb('0x2c')][_0xcbbb('0x2d')],function(_0x1ce741){return{'name':_0x1ce741[_0xcbbb('0x2e')],'type':_0x1ce741[_0xcbbb('0x2f')][_0xcbbb('0x30')]};});_0x1c986d[_0xcbbb('0x31')]=_['map'](_0x26c05e,_0xcbbb('0x28'));_0x1c986d[_0xcbbb('0x32')]=_['keys'](_0x372024[_0xcbbb('0x32')]);_0x1c986d['filters']=_[_0xcbbb('0x33')](_0x1c986d[_0xcbbb('0x31')],_0x1c986d[_0xcbbb('0x32')]);_0x3d4c0d['attributes']=_[_0xcbbb('0x33')](_0x1c986d[_0xcbbb('0x31')],qs[_0xcbbb('0x34')](_0x372024[_0xcbbb('0x32')][_0xcbbb('0x34')]));_0x3d4c0d[_0xcbbb('0x35')]=_0x3d4c0d[_0xcbbb('0x35')][_0xcbbb('0x36')]?_0x3d4c0d[_0xcbbb('0x35')]:_0x1c986d[_0xcbbb('0x31')];if(!_0x372024['query']['hasOwnProperty']('nolimit')){_0x3d4c0d['limit']=qs[_0xcbbb('0x1f')](_0x372024[_0xcbbb('0x32')][_0xcbbb('0x1f')]);_0x3d4c0d[_0xcbbb('0x1c')]=qs[_0xcbbb('0x1c')](_0x372024[_0xcbbb('0x32')][_0xcbbb('0x1c')]);}_0x3d4c0d[_0xcbbb('0x37')]=qs[_0xcbbb('0x38')](_0x372024[_0xcbbb('0x32')][_0xcbbb('0x38')]);_0x3d4c0d[_0xcbbb('0x39')]=qs['filters'](_['pick'](_0x372024[_0xcbbb('0x32')],_0x1c986d['filters']),_0x26c05e);if(_0x372024['query']['filter']){_0x3d4c0d[_0xcbbb('0x39')]=_[_0xcbbb('0x3a')](_0x3d4c0d[_0xcbbb('0x39')],{'$or':_[_0xcbbb('0x2b')](_0x26c05e,function(_0x38e59d){if(_0x38e59d[_0xcbbb('0x2f')]!==_0xcbbb('0x3b')){var _0x14c1a2={};_0x14c1a2[_0x38e59d[_0xcbbb('0x28')]]={'$like':'%'+_0x372024[_0xcbbb('0x32')][_0xcbbb('0x3c')]+'%'};return _0x14c1a2;}})});}_0x3d4c0d=_['merge']({},_0x3d4c0d,_0x372024[_0xcbbb('0x3d')]);var _0x55d349={'where':_0x3d4c0d[_0xcbbb('0x39')]};return db[_0xcbbb('0x2c')][_0xcbbb('0x1e')](_0x55d349)[_0xcbbb('0x25')](function(_0x433065){_0x2a023f[_0xcbbb('0x1e')]=_0x433065;if(_0x372024['query']['includeAll']){_0x3d4c0d['include']=[{'all':!![]}];}return db[_0xcbbb('0x2c')][_0xcbbb('0x3e')](_0x3d4c0d);})[_0xcbbb('0x25')](function(_0x162979){_0x2a023f[_0xcbbb('0x3f')]=_0x162979;return _0x2a023f;})[_0xcbbb('0x25')](respondWithFilteredResult(_0x39ba8b,_0x3d4c0d))[_0xcbbb('0x40')](handleError(_0x39ba8b,null));};exports['show']=function(_0x1a7799,_0x22076a){var _0x5550d2={'raw':!![],'where':{'id':_0x1a7799[_0xcbbb('0x41')]['id']}},_0x15b3bc={};_0x15b3bc[_0xcbbb('0x31')]=_[_0xcbbb('0x42')](db[_0xcbbb('0x2c')]['rawAttributes']);_0x15b3bc[_0xcbbb('0x32')]=_['keys'](_0x1a7799['query']);_0x15b3bc[_0xcbbb('0x43')]=_[_0xcbbb('0x33')](_0x15b3bc[_0xcbbb('0x31')],_0x15b3bc[_0xcbbb('0x32')]);_0x5550d2[_0xcbbb('0x35')]=_[_0xcbbb('0x33')](_0x15b3bc[_0xcbbb('0x31')],qs[_0xcbbb('0x34')](_0x1a7799[_0xcbbb('0x32')][_0xcbbb('0x34')]));_0x5550d2[_0xcbbb('0x35')]=_0x5550d2[_0xcbbb('0x35')][_0xcbbb('0x36')]?_0x5550d2[_0xcbbb('0x35')]:_0x15b3bc['model'];if(_0x1a7799[_0xcbbb('0x32')][_0xcbbb('0x44')]){_0x5550d2[_0xcbbb('0x45')]=[{'all':!![]}];}_0x5550d2=_[_0xcbbb('0x3a')]({},_0x5550d2,_0x1a7799['options']);return db['WhatsappTransferReport']['find'](_0x5550d2)[_0xcbbb('0x25')](handleEntityNotFound(_0x22076a,null))[_0xcbbb('0x25')](respondWithResult(_0x22076a,null))[_0xcbbb('0x40')](handleError(_0x22076a,null));};exports[_0xcbbb('0x46')]=function(_0x146f37,_0x1ef25b){return db[_0xcbbb('0x2c')]['create'](_0x146f37[_0xcbbb('0x47')],{})[_0xcbbb('0x25')](respondWithResult(_0x1ef25b,0xc9))[_0xcbbb('0x40')](handleError(_0x1ef25b,null));};exports[_0xcbbb('0x24')]=function(_0x478c22,_0x3378cd){if(_0x478c22[_0xcbbb('0x47')]['id']){delete _0x478c22[_0xcbbb('0x47')]['id'];}return db[_0xcbbb('0x2c')]['find']({'where':{'id':_0x478c22['params']['id']}})[_0xcbbb('0x25')](handleEntityNotFound(_0x3378cd,null))[_0xcbbb('0x25')](saveUpdates(_0x478c22[_0xcbbb('0x47')],null))['then'](respondWithResult(_0x3378cd,null))['catch'](handleError(_0x3378cd,null));};exports['destroy']=function(_0x189a40,_0x3070d9){return db['WhatsappTransferReport'][_0xcbbb('0x48')]({'where':{'id':_0x189a40[_0xcbbb('0x41')]['id']}})[_0xcbbb('0x25')](handleEntityNotFound(_0x3070d9,null))[_0xcbbb('0x25')](removeEntity(_0x3070d9,null))['catch'](handleError(_0x3070d9,null));};exports[_0xcbbb('0x49')]=function(_0x1e4bb0,_0x39640d){return db[_0xcbbb('0x2c')][_0xcbbb('0x49')]()[_0xcbbb('0x25')](respondWithResult(_0x39640d,null))[_0xcbbb('0x40')](handleError(_0x39640d,null));}; \ No newline at end of file +var _0x1ed7=['undefined','count','limit','set','apply','save','update','destroy','then','error','name','index','WhatsappTransferReport','fieldName','type','key','map','keys','query','filters','intersection','model','attributes','fields','length','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','body','describe','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset'];(function(_0x31893f,_0x59d5b1){var _0x4364d2=function(_0x402945){while(--_0x402945){_0x31893f['push'](_0x31893f['shift']());}};_0x4364d2(++_0x59d5b1);}(_0x1ed7,0x6e));var _0x71ed=function(_0x45f143,_0x42ba90){_0x45f143=_0x45f143-0x0;var _0x898312=_0x1ed7[_0x45f143];return _0x898312;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x71ed('0x0'));var rp=require(_0x71ed('0x1'));var moment=require(_0x71ed('0x2'));var BPromise=require(_0x71ed('0x3'));var Mustache=require(_0x71ed('0x4'));var util=require('util');var path=require(_0x71ed('0x5'));var sox=require(_0x71ed('0x6'));var csv=require(_0x71ed('0x7'));var ejs=require(_0x71ed('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x71ed('0x9'));var crypto=require(_0x71ed('0xa'));var jsforce=require(_0x71ed('0xb'));var deskjs=require(_0x71ed('0xc'));var toCsv=require(_0x71ed('0x7'));var querystring=require(_0x71ed('0xd'));var Papa=require('papaparse');var Redis=require(_0x71ed('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x71ed('0xf'));var as=require(_0x71ed('0x10'));var hardwareService=require(_0x71ed('0x11'));var logger=require(_0x71ed('0x12'))(_0x71ed('0x13'));var utils=require(_0x71ed('0x14'));var config=require(_0x71ed('0x15'));var licenseUtil=require(_0x71ed('0x16'));var db=require(_0x71ed('0x17'))['db'];function respondWithStatusCode(_0x5f26e3,_0x363084){_0x363084=_0x363084||0xcc;return function(_0x5b40e8){if(_0x5b40e8){return _0x5f26e3[_0x71ed('0x18')](_0x363084);}return _0x5f26e3[_0x71ed('0x19')](_0x363084)['end']();};}function respondWithResult(_0x40557e,_0x16bc2c){_0x16bc2c=_0x16bc2c||0xc8;return function(_0x53d5e0){if(_0x53d5e0){return _0x40557e['status'](_0x16bc2c)[_0x71ed('0x1a')](_0x53d5e0);}};}function respondWithFilteredResult(_0xe01160,_0x26595e){return function(_0x43eb51){if(_0x43eb51){var _0x4b9b72=typeof _0x26595e[_0x71ed('0x1b')]===_0x71ed('0x1c')&&typeof _0x26595e['limit']===_0x71ed('0x1c');var _0x1c0585=_0x43eb51['count'];var _0x4a9f42=_0x4b9b72?0x0:_0x26595e['offset'];var _0x1ce561=_0x4b9b72?_0x43eb51[_0x71ed('0x1d')]:_0x26595e['offset']+_0x26595e[_0x71ed('0x1e')];var _0x255776;if(_0x1ce561>=_0x1c0585){_0x1ce561=_0x1c0585;_0x255776=0xc8;}else{_0x255776=0xce;}_0xe01160[_0x71ed('0x19')](_0x255776);return _0xe01160[_0x71ed('0x1f')]('Content-Range',_0x4a9f42+'-'+_0x1ce561+'/'+_0x1c0585)[_0x71ed('0x1a')](_0x43eb51);}return null;};}function patchUpdates(_0x500c40){return function(_0x24edf7){try{jsonpatch[_0x71ed('0x20')](_0x24edf7,_0x500c40,!![]);}catch(_0x5a41e5){return BPromise['reject'](_0x5a41e5);}return _0x24edf7[_0x71ed('0x21')]();};}function saveUpdates(_0x3f4fac,_0x134e37){return function(_0x5a1c85){if(_0x5a1c85){return _0x5a1c85[_0x71ed('0x22')](_0x3f4fac)['then'](function(_0x3b9775){return _0x3b9775;});}return null;};}function removeEntity(_0x243da8,_0x5a953e){return function(_0x22cfbb){if(_0x22cfbb){return _0x22cfbb[_0x71ed('0x23')]()[_0x71ed('0x24')](function(){_0x243da8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xb01ddd,_0x125065){return function(_0x1472ac){if(!_0x1472ac){_0xb01ddd[_0x71ed('0x18')](0x194);}return _0x1472ac;};}function handleError(_0x4afd64,_0x2a72c6){_0x2a72c6=_0x2a72c6||0x1f4;return function(_0x57b5b3){logger[_0x71ed('0x25')](_0x57b5b3['stack']);if(_0x57b5b3[_0x71ed('0x26')]){delete _0x57b5b3[_0x71ed('0x26')];}_0x4afd64['status'](_0x2a72c6)['send'](_0x57b5b3);};}exports[_0x71ed('0x27')]=function(_0xff59b8,_0x3223d7){var _0x22acb4={},_0x4fb283={},_0x503e00={'count':0x0,'rows':[]};var _0x36ccba=_['map'](db[_0x71ed('0x28')]['rawAttributes'],function(_0x36b7c3){return{'name':_0x36b7c3[_0x71ed('0x29')],'type':_0x36b7c3[_0x71ed('0x2a')][_0x71ed('0x2b')]};});_0x4fb283['model']=_[_0x71ed('0x2c')](_0x36ccba,_0x71ed('0x26'));_0x4fb283['query']=_[_0x71ed('0x2d')](_0xff59b8[_0x71ed('0x2e')]);_0x4fb283[_0x71ed('0x2f')]=_[_0x71ed('0x30')](_0x4fb283[_0x71ed('0x31')],_0x4fb283[_0x71ed('0x2e')]);_0x22acb4[_0x71ed('0x32')]=_[_0x71ed('0x30')](_0x4fb283['model'],qs[_0x71ed('0x33')](_0xff59b8[_0x71ed('0x2e')][_0x71ed('0x33')]));_0x22acb4['attributes']=_0x22acb4[_0x71ed('0x32')][_0x71ed('0x34')]?_0x22acb4[_0x71ed('0x32')]:_0x4fb283['model'];if(!_0xff59b8[_0x71ed('0x2e')]['hasOwnProperty']('nolimit')){_0x22acb4[_0x71ed('0x1e')]=qs[_0x71ed('0x1e')](_0xff59b8[_0x71ed('0x2e')]['limit']);_0x22acb4[_0x71ed('0x1b')]=qs[_0x71ed('0x1b')](_0xff59b8[_0x71ed('0x2e')][_0x71ed('0x1b')]);}_0x22acb4['order']=qs[_0x71ed('0x35')](_0xff59b8[_0x71ed('0x2e')][_0x71ed('0x35')]);_0x22acb4[_0x71ed('0x36')]=qs['filters'](_['pick'](_0xff59b8['query'],_0x4fb283[_0x71ed('0x2f')]),_0x36ccba);if(_0xff59b8[_0x71ed('0x2e')][_0x71ed('0x37')]){_0x22acb4[_0x71ed('0x36')]=_[_0x71ed('0x38')](_0x22acb4[_0x71ed('0x36')],{'$or':_[_0x71ed('0x2c')](_0x36ccba,function(_0x530d20){if(_0x530d20['type']!==_0x71ed('0x39')){var _0x301fde={};_0x301fde[_0x530d20[_0x71ed('0x26')]]={'$like':'%'+_0xff59b8[_0x71ed('0x2e')][_0x71ed('0x37')]+'%'};return _0x301fde;}})});}_0x22acb4=_['merge']({},_0x22acb4,_0xff59b8[_0x71ed('0x3a')]);var _0x404383={'where':_0x22acb4['where']};return db[_0x71ed('0x28')][_0x71ed('0x1d')](_0x404383)[_0x71ed('0x24')](function(_0x1387be){_0x503e00[_0x71ed('0x1d')]=_0x1387be;if(_0xff59b8[_0x71ed('0x2e')][_0x71ed('0x3b')]){_0x22acb4[_0x71ed('0x3c')]=[{'all':!![]}];}return db[_0x71ed('0x28')][_0x71ed('0x3d')](_0x22acb4);})['then'](function(_0x17d0dc){_0x503e00['rows']=_0x17d0dc;return _0x503e00;})[_0x71ed('0x24')](respondWithFilteredResult(_0x3223d7,_0x22acb4))[_0x71ed('0x3e')](handleError(_0x3223d7,null));};exports[_0x71ed('0x3f')]=function(_0x530645,_0x18d389){var _0x2fb2e1={'raw':!![],'where':{'id':_0x530645[_0x71ed('0x40')]['id']}},_0x5a3ae3={};_0x5a3ae3[_0x71ed('0x31')]=_['keys'](db[_0x71ed('0x28')][_0x71ed('0x41')]);_0x5a3ae3['query']=_[_0x71ed('0x2d')](_0x530645[_0x71ed('0x2e')]);_0x5a3ae3['filters']=_[_0x71ed('0x30')](_0x5a3ae3['model'],_0x5a3ae3['query']);_0x2fb2e1['attributes']=_[_0x71ed('0x30')](_0x5a3ae3[_0x71ed('0x31')],qs[_0x71ed('0x33')](_0x530645['query'][_0x71ed('0x33')]));_0x2fb2e1[_0x71ed('0x32')]=_0x2fb2e1[_0x71ed('0x32')][_0x71ed('0x34')]?_0x2fb2e1[_0x71ed('0x32')]:_0x5a3ae3[_0x71ed('0x31')];if(_0x530645[_0x71ed('0x2e')]['includeAll']){_0x2fb2e1[_0x71ed('0x3c')]=[{'all':!![]}];}_0x2fb2e1=_[_0x71ed('0x38')]({},_0x2fb2e1,_0x530645[_0x71ed('0x3a')]);return db['WhatsappTransferReport'][_0x71ed('0x42')](_0x2fb2e1)[_0x71ed('0x24')](handleEntityNotFound(_0x18d389,null))['then'](respondWithResult(_0x18d389,null))[_0x71ed('0x3e')](handleError(_0x18d389,null));};exports['create']=function(_0x3fefb7,_0x56f995){return db[_0x71ed('0x28')]['create'](_0x3fefb7[_0x71ed('0x43')],{})[_0x71ed('0x24')](respondWithResult(_0x56f995,0xc9))['catch'](handleError(_0x56f995,null));};exports['update']=function(_0x2307ac,_0x3d55a3){if(_0x2307ac[_0x71ed('0x43')]['id']){delete _0x2307ac[_0x71ed('0x43')]['id'];}return db[_0x71ed('0x28')][_0x71ed('0x42')]({'where':{'id':_0x2307ac[_0x71ed('0x40')]['id']}})[_0x71ed('0x24')](handleEntityNotFound(_0x3d55a3,null))[_0x71ed('0x24')](saveUpdates(_0x2307ac['body'],null))[_0x71ed('0x24')](respondWithResult(_0x3d55a3,null))[_0x71ed('0x3e')](handleError(_0x3d55a3,null));};exports['destroy']=function(_0x93e7df,_0x171914){return db[_0x71ed('0x28')][_0x71ed('0x42')]({'where':{'id':_0x93e7df['params']['id']}})[_0x71ed('0x24')](handleEntityNotFound(_0x171914,null))['then'](removeEntity(_0x171914,null))['catch'](handleError(_0x171914,null));};exports[_0x71ed('0x44')]=function(_0x13e64d,_0x174e48){return db[_0x71ed('0x28')][_0x71ed('0x44')]()[_0x71ed('0x24')](respondWithResult(_0x174e48,null))[_0x71ed('0x3e')](handleError(_0x174e48,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index f292631..17bb9b2 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 _0xc4de=['define','WhatsappTransferReport','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','./whatsappTransferReport.attributes','exports'];(function(_0x44606e,_0x2bf244){var _0xe68388=function(_0x488a30){while(--_0x488a30){_0x44606e['push'](_0x44606e['shift']());}};_0xe68388(++_0x2bf244);}(_0xc4de,0x18f));var _0xec4d=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xc4de[_0x46698a];return _0x356db0;};'use strict';var _=require(_0xec4d('0x0'));var util=require(_0xec4d('0x1'));var logger=require(_0xec4d('0x2'))('api');var moment=require(_0xec4d('0x3'));var BPromise=require(_0xec4d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xec4d('0x5'));var rimraf=require('rimraf');var config=require(_0xec4d('0x6'));var attributes=require(_0xec4d('0x7'));module[_0xec4d('0x8')]=function(_0x9e123b,_0x5f33c6){return _0x9e123b[_0xec4d('0x9')](_0xec4d('0xa'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0xec4d('0xb'),'fields':[_0xec4d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1a43=['../../config/environment','./whatsappTransferReport.attributes','exports','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x1a43,0x93));var _0x31a4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1a43[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x31a4('0x0'));var util=require(_0x31a4('0x1'));var logger=require(_0x31a4('0x2'))(_0x31a4('0x3'));var moment=require(_0x31a4('0x4'));var BPromise=require('bluebird');var rp=require(_0x31a4('0x5'));var fs=require('fs');var path=require(_0x31a4('0x6'));var rimraf=require('rimraf');var config=require(_0x31a4('0x7'));var attributes=require(_0x31a4('0x8'));module[_0x31a4('0x9')]=function(_0x16aaea,_0x46d5a6){return _0x16aaea['define']('WhatsappTransferReport',attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x31a4('0xa'),'fields':[_0x31a4('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index fd582bf..70c2869 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 _0xee70=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xee70,0xc7));var _0x0ee7=function(_0x4966a7,_0x12d72b){_0x4966a7=_0x4966a7-0x0;var _0x21e443=_0xee70[_0x4966a7];return _0x21e443;};'use strict';var _=require(_0x0ee7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0ee7('0x1'));var rs=require(_0x0ee7('0x2'));var fs=require('fs');var Redis=require(_0x0ee7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0ee7('0x4'));var logger=require(_0x0ee7('0x5'))(_0x0ee7('0x6'));var config=require('../../config/environment');var jayson=require(_0x0ee7('0x7'));var client=jayson[_0x0ee7('0x8')][_0x0ee7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1af517,_0x400788,_0x5d17c4){return new BPromise(function(_0x381130,_0x1fcfa5){return client[_0x0ee7('0xa')](_0x1af517,_0x5d17c4)[_0x0ee7('0xb')](function(_0x364c68){logger[_0x0ee7('0xc')](_0x0ee7('0xd'),_0x400788,_0x0ee7('0xe'));logger[_0x0ee7('0xf')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x400788,'request\x20sent',JSON['stringify'](_0x364c68));if(_0x364c68[_0x0ee7('0x10')]){if(_0x364c68[_0x0ee7('0x10')][_0x0ee7('0x11')]===0x1f4){logger[_0x0ee7('0x10')](_0x0ee7('0xd'),_0x400788,_0x364c68[_0x0ee7('0x10')][_0x0ee7('0x12')]);return _0x1fcfa5(_0x364c68[_0x0ee7('0x10')][_0x0ee7('0x12')]);}logger[_0x0ee7('0x10')](_0x0ee7('0xd'),_0x400788,_0x364c68['error']['message']);return _0x381130(_0x364c68[_0x0ee7('0x10')][_0x0ee7('0x12')]);}else{logger[_0x0ee7('0xc')]('WhatsappTransferReport,\x20%s,\x20%s',_0x400788,_0x0ee7('0xe'));_0x381130(_0x364c68[_0x0ee7('0x13')][_0x0ee7('0x12')]);}})['catch'](function(_0x2f1b02){logger[_0x0ee7('0x10')]('WhatsappTransferReport,\x20%s,\x20%s',_0x400788,_0x2f1b02);_0x1fcfa5(_0x2f1b02);});});} \ No newline at end of file +var _0x2e0e=['../../config/utils','rpc','../../config/environment','jayson/promise','http','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','../../mysqldb'];(function(_0x1985d0,_0x5983a0){var _0x1e3d7a=function(_0x453a7c){while(--_0x453a7c){_0x1985d0['push'](_0x1985d0['shift']());}};_0x1e3d7a(++_0x5983a0);}(_0x2e0e,0xb0));var _0xe2e0=function(_0x34378e,_0xb6193){_0x34378e=_0x34378e-0x0;var _0x19683c=_0x2e0e[_0x34378e];return _0x19683c;};'use strict';var _=require(_0xe2e0('0x0'));var util=require(_0xe2e0('0x1'));var moment=require(_0xe2e0('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe2e0('0x3'))['db'];var utils=require(_0xe2e0('0x4'));var logger=require('../../config/logger')(_0xe2e0('0x5'));var config=require(_0xe2e0('0x6'));var jayson=require(_0xe2e0('0x7'));var client=jayson['client'][_0xe2e0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x298b18,_0x551e77,_0xc4f4d1){return new BPromise(function(_0xcbc3d7,_0x11f0d1){return client['request'](_0x298b18,_0xc4f4d1)['then'](function(_0x26e9f2){logger[_0xe2e0('0x9')](_0xe2e0('0xa'),_0x551e77,_0xe2e0('0xb'));logger[_0xe2e0('0xc')](_0xe2e0('0xd'),_0x551e77,_0xe2e0('0xb'),JSON[_0xe2e0('0xe')](_0x26e9f2));if(_0x26e9f2[_0xe2e0('0xf')]){if(_0x26e9f2[_0xe2e0('0xf')][_0xe2e0('0x10')]===0x1f4){logger['error'](_0xe2e0('0xa'),_0x551e77,_0x26e9f2[_0xe2e0('0xf')][_0xe2e0('0x11')]);return _0x11f0d1(_0x26e9f2[_0xe2e0('0xf')][_0xe2e0('0x11')]);}logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x551e77,_0x26e9f2[_0xe2e0('0xf')][_0xe2e0('0x11')]);return _0xcbc3d7(_0x26e9f2['error']['message']);}else{logger[_0xe2e0('0x9')](_0xe2e0('0xa'),_0x551e77,'request\x20sent');_0xcbc3d7(_0x26e9f2['result']['message']);}})['catch'](function(_0x5c4486){logger[_0xe2e0('0xf')](_0xe2e0('0xa'),_0x551e77,_0x5c4486);_0x11f0d1(_0x5c4486);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 1ef4a13..cb6407f 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe0c3=['pm2_env','name','Online\x20apps:','map','join','status','online','App\x20Ready!','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','exit','lodash','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','listen','info','start','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20'];(function(_0x1109db,_0x5c6dc7){var _0x27d529=function(_0x558547){while(--_0x558547){_0x1109db['push'](_0x1109db['shift']());}};_0x27d529(++_0x5c6dc7);}(_0xe0c3,0xea));var _0x3e0c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe0c3[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x3e0c('0x0'));var db=require('./mysqldb')['db'];var seedDb=require(_0x3e0c('0x1'));var checkLicense=require(_0x3e0c('0x2'));var rpc=require(_0x3e0c('0x3'));var config=require(_0x3e0c('0x4'));var logger=require(_0x3e0c('0x5'))(_0x3e0c('0x6'));var pm2=require(_0x3e0c('0x7'));var pm2Config=require(_0x3e0c('0x8'));var schedule=require(_0x3e0c('0x9'));var chat=require('./config/schedule/chat');var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x3e0c('0xa'));var provider=require(_0x3e0c('0xb'));function main(){return db[_0x3e0c('0xc')][_0x3e0c('0xd')]()[_0x3e0c('0xe')](function(){if(config[_0x3e0c('0xf')]){return seedDb[_0x3e0c('0x10')]();}})[_0x3e0c('0xe')](function(){return checkLicense[_0x3e0c('0x10')]();})[_0x3e0c('0xe')](function(){return rpc[_0x3e0c('0x11')]();})['then'](function(_0x5dca37){logger[_0x3e0c('0x12')](_0x5dca37);return chat[_0x3e0c('0x13')]();})[_0x3e0c('0xe')](function(){return whatsapp[_0x3e0c('0x13')]();})[_0x3e0c('0xe')](function(){return schedule[_0x3e0c('0x13')]();})[_0x3e0c('0xe')](function(){return transcribe['start']();})[_0x3e0c('0xe')](function(){return provider['start']();})[_0x3e0c('0xe')](function(_0x23a6a8){logger['info'](_0x23a6a8);return pm2[_0x3e0c('0x13')](pm2Config);})[_0x3e0c('0xe')](function(_0x409b2c){var _0x40e308=_0x409b2c[_0x3e0c('0x14')](function(_0x15a269){return typeof _0x15a269[_0x3e0c('0x15')]===_0x3e0c('0x16')&&_0x15a269[_0x3e0c('0x15')]>=0x0;});if(_0x40e308[_0x3e0c('0x17')]>0x0){throw new Error(_0x40e308[_0x3e0c('0x17')]+_0x3e0c('0x18')+_['map'](_0x40e308,function(_0x58c498){return'\x22'+_0x58c498[_0x3e0c('0x19')][_0x3e0c('0x1a')]+'\x22';}));}logger[_0x3e0c('0x12')](_0x3e0c('0x1b'),_[_0x3e0c('0x1c')](_[_0x3e0c('0x14')](_0x409b2c,{'status':'online'}),_0x3e0c('0x1a'))[_0x3e0c('0x1d')]());logger[_0x3e0c('0x12')]('Offline\x20apps:',_[_0x3e0c('0x1c')](_['filter'](_0x409b2c,function(_0x479265){return _0x479265[_0x3e0c('0x1e')]!==_0x3e0c('0x1f');}),_0x3e0c('0x1a'))[_0x3e0c('0x1d')]()||'None');console['log'](_0x3e0c('0x20'));})['catch'](function(_0x541418){console[_0x3e0c('0x21')](_0x3e0c('0x22'),_0x541418);logger[_0x3e0c('0x23')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x541418);process[_0x3e0c('0x24')](0x1);});}main(); \ No newline at end of file +var _0x444e=['exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','online','Offline\x20apps:','None','App\x20Ready!','catch','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','exit','lodash','./config/seedDB','./rpc','./config/logger','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','then','default','start','info','filter'];(function(_0x408d22,_0x53eef9){var _0x58effd=function(_0x4ab8ee){while(--_0x4ab8ee){_0x408d22['push'](_0x408d22['shift']());}};_0x58effd(++_0x53eef9);}(_0x444e,0xe8));var _0xe444=function(_0xbace63,_0x2b33ec){_0xbace63=_0xbace63-0x0;var _0x33a7cd=_0x444e[_0xbace63];return _0x33a7cd;};'use strict';var _=require(_0xe444('0x0'));var db=require('./mysqldb')['db'];var seedDb=require(_0xe444('0x1'));var checkLicense=require('./config/license');var rpc=require(_0xe444('0x2'));var config=require('./config/environment');var logger=require(_0xe444('0x3'))('app');var pm2=require(_0xe444('0x4'));var pm2Config=require(_0xe444('0x5'));var schedule=require(_0xe444('0x6'));var chat=require(_0xe444('0x7'));var whatsapp=require(_0xe444('0x8'));var transcribe=require(_0xe444('0x9'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0xe444('0xa')]['sync']()[_0xe444('0xb')](function(){if(config['seedDB']){return seedDb[_0xe444('0xc')]();}})[_0xe444('0xb')](function(){return checkLicense[_0xe444('0xc')]();})['then'](function(){return rpc['listen']();})[_0xe444('0xb')](function(_0x1f41ff){logger['info'](_0x1f41ff);return chat[_0xe444('0xd')]();})['then'](function(){return whatsapp['start']();})[_0xe444('0xb')](function(){return schedule['start']();})[_0xe444('0xb')](function(){return transcribe[_0xe444('0xd')]();})['then'](function(){return provider[_0xe444('0xd')]();})['then'](function(_0x5ba044){logger[_0xe444('0xe')](_0x5ba044);return pm2[_0xe444('0xd')](pm2Config);})['then'](function(_0x192c1a){var _0x5d739a=_0x192c1a[_0xe444('0xf')](function(_0x3acd97){return typeof _0x3acd97[_0xe444('0x10')]===_0xe444('0x11')&&_0x3acd97[_0xe444('0x10')]>=0x0;});if(_0x5d739a[_0xe444('0x12')]>0x0){throw new Error(_0x5d739a[_0xe444('0x12')]+_0xe444('0x13')+_[_0xe444('0x14')](_0x5d739a,function(_0x4009c7){return'\x22'+_0x4009c7[_0xe444('0x15')][_0xe444('0x16')]+'\x22';}));}logger[_0xe444('0xe')]('Online\x20apps:',_[_0xe444('0x14')](_[_0xe444('0xf')](_0x192c1a,{'status':_0xe444('0x17')}),_0xe444('0x16'))['join']());logger[_0xe444('0xe')](_0xe444('0x18'),_[_0xe444('0x14')](_[_0xe444('0xf')](_0x192c1a,function(_0x37c15e){return _0x37c15e['status']!==_0xe444('0x17');}),_0xe444('0x16'))['join']()||_0xe444('0x19'));console['log'](_0xe444('0x1a'));})[_0xe444('0x1b')](function(_0x3d36c7){console[_0xe444('0x1c')](_0xe444('0x1d'),_0x3d36c7);logger['error']('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x3d36c7);process[_0xe444('0x1e')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 37b1418..74da52d 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 _0xedd9=['crypto','bluebird','util','moment','session','fullname','name','internal','email','permissions','voicePause','chatPause','faxPause','smsPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','hotdesk','interface','userProfileId','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','selectRecallMeCampaign','chatAutoanswer','emailAutoanswerDelay','smsAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','closed','disposition','then','unmanaged','json','Unmanaged.','authorization','startsWith','headers','Basic','User','find','authenticate','pass','status','catch','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blocked','blockedAt','add','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','isWebrtcLicence','webrtc','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','motion.token','redirect','send','isNil','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','toLowerCase','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','split','unshift','join','promisify','secrets','payload','verify','hex','toString','HS512','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware'];(function(_0x15de57,_0x3cf1ed){var _0x119528=function(_0x51c745){while(--_0x51c745){_0x15de57['push'](_0x15de57['shift']());}};_0x119528(++_0x3cf1ed);}(_0xedd9,0xfc));var _0x9edd=function(_0x15c1d3,_0x3b7172){_0x15c1d3=_0x15c1d3-0x0;var _0x2f3e3e=_0xedd9[_0x15c1d3];return _0x2f3e3e;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x9edd('0x0'));var hardwareConf=require(_0x9edd('0x1'));var licenseUtil=require(_0x9edd('0x2'));var encryptor=require(_0x9edd('0x3'));var _=require(_0x9edd('0x4'));var jwt=require(_0x9edd('0x5'));var expressJwt=require(_0x9edd('0x6'));var compose=require(_0x9edd('0x7'));var basicAuth=require('basic-auth');var crypto=require(_0x9edd('0x8'));var BPromise=require(_0x9edd('0x9'));var util=require(_0x9edd('0xa'));var moment=require(_0x9edd('0xb'));var validateJwt=expressJwt({'secret':config['secrets'][_0x9edd('0xc')]});var userAttributes=['id','role',_0x9edd('0xd'),_0x9edd('0xe'),_0x9edd('0xf'),_0x9edd('0x10'),'userpic',_0x9edd('0x11'),'md5secret',_0x9edd('0x12'),_0x9edd('0x13'),'mailPause',_0x9edd('0x14'),_0x9edd('0x15'),'openchannelPause',_0x9edd('0x16'),_0x9edd('0x17'),_0x9edd('0x18'),_0x9edd('0x19'),_0x9edd('0x1a'),_0x9edd('0x1b'),_0x9edd('0x1c'),_0x9edd('0x1d'),'phoneBarAutoAnswer',_0x9edd('0x1e'),_0x9edd('0x1f'),_0x9edd('0x20'),_0x9edd('0x21'),_0x9edd('0x22'),_0x9edd('0x23'),_0x9edd('0x24'),_0x9edd('0x25'),'phoneBarRemoteControlPort',_0x9edd('0x26'),_0x9edd('0x27'),_0x9edd('0x28'),'privacyEnabled',_0x9edd('0x29'),_0x9edd('0x2a'),_0x9edd('0x2b'),'downloadOmnichannelInteractions',_0x9edd('0x2c'),'ignorePauseForPreviewCalls',_0x9edd('0x2d'),_0x9edd('0x2e'),'chatAutoanswerDelay','emailAutoanswer',_0x9edd('0x2f'),'smsAutoanswer',_0x9edd('0x30'),'openchannelAutoanswer','openchannelAutoanswerDelay',_0x9edd('0x31'),_0x9edd('0x32'),'whatsappAutoanswer','whatsappAutoanswerDelay'];exports[_0x9edd('0x33')]=function(){return this[_0x9edd('0x34')](!![])[_0x9edd('0x35')](function(_0x542172,_0x3741c8,_0x1dca43){if(_0x542172[_0x9edd('0x36')]){_0x1dca43();}else{return db[_0x9edd('0x37')][_0x9edd('0x38')]({'where':{'id':_0x542172['params']['id']},'attributes':['id',_0x9edd('0x39'),_0x9edd('0x3a')],'raw':!![]})[_0x9edd('0x3b')](function(_0x2f9f86){if(_0x2f9f86&&_0x2f9f86[_0x9edd('0x39')]){return _0x3741c8['status'](_0x2f9f86['disposition']===_0x9edd('0x3c')?0x195:0x193)[_0x9edd('0x3d')]({'message':_0x2f9f86[_0x9edd('0x3a')]===_0x9edd('0x3c')?_0x9edd('0x3e'):'Forbidden.'});}else{_0x1dca43();}})['catch'](function(_0x214d0a){_0x1dca43(_0x214d0a);});}});};exports[_0x9edd('0x34')]=function isAuthenticated(_0x1c762c){return compose()['use'](function(_0x238b22,_0x28cfae,_0x2ae8dd){var _0x41af53;if(_0x238b22['headers'][_0x9edd('0x3f')]){if(_[_0x9edd('0x40')](_0x238b22[_0x9edd('0x41')][_0x9edd('0x3f')],_0x9edd('0x42'))){var _0x42e664=basicAuth(_0x238b22);db[_0x9edd('0x43')][_0x9edd('0x44')]({'where':{'name':_0x42e664[_0x9edd('0xe')]}})[_0x9edd('0x3b')](function(_0x4fd03f){if(!_0x4fd03f||!_0x4fd03f[_0x9edd('0x45')](_0x42e664[_0x9edd('0x46')])){return _0x28cfae[_0x9edd('0x47')](0x191)[_0x9edd('0x3d')]({'message':'Wrong\x20credentials.'});}_0x238b22[_0x9edd('0x36')]={'id':_0x4fd03f['id']};_0x2ae8dd();})[_0x9edd('0x48')](function(_0x267c74){_0x2ae8dd(_0x267c74);});}else if(_['startsWith'](_0x238b22[_0x9edd('0x41')][_0x9edd('0x3f')],_0x9edd('0x49'))){validateJwt(_0x238b22,_0x28cfae,_0x2ae8dd);}else{if(_0x1c762c){_0x2ae8dd();}else{return _0x28cfae[_0x9edd('0x47')](0x193)[_0x9edd('0x3d')]({'message':_0x9edd('0x4a')});}}}else if(_0x238b22[_0x9edd('0x4b')][_0x9edd('0x4c')]){try{var _0xd0fd74={'audience':hardwareConf[_0x9edd('0x4d')](),'issuer':hardwareConf[_0x9edd('0x4d')]()};verifyJwt(_0x238b22[_0x9edd('0x4b')][_0x9edd('0x4c')],_0xd0fd74)[_0x9edd('0x3b')](function(_0x5757fc){return db[_0x9edd('0x43')]['find']({'where':{'id':_0x5757fc[_0x9edd('0x4e')]}})[_0x9edd('0x3b')](function(_0x10d6fd){_0x41af53=_0x10d6fd;return db[_0x9edd('0x4f')][_0x9edd('0x38')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x9edd('0x50')],'raw':!![]});})[_0x9edd('0x3b')](function(_0x2b3469){if(!_0x41af53||!_[_0x9edd('0x51')](_0x41af53[_0x9edd('0x52')],_0x5757fc[_0x9edd('0x53')])){return _0x28cfae[_0x9edd('0x47')](0x191)[_0x9edd('0x3d')]({'message':_0x9edd('0x54')});}if(_0x41af53[_0x9edd('0x55')]){return _0x28cfae['status'](0x191)[_0x9edd('0x3d')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x41af53[_0x9edd('0x56')]){if(_0x2b3469['blockDuration']>0x0){if(moment(_0x41af53[_0x9edd('0x57')])[_0x9edd('0x58')](_0x2b3469[_0x9edd('0x50')],'minutes')>moment()){return _0x28cfae[_0x9edd('0x47')](0x191)[_0x9edd('0x3d')]({'message':_0x9edd('0x59')});}}else{return _0x28cfae['status'](0x191)[_0x9edd('0x3d')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x238b22[_0x9edd('0x36')]={'id':_0x41af53['id']};_0x2ae8dd();});})[_0x9edd('0x48')](function(){return _0x28cfae['status'](0x191)[_0x9edd('0x3d')]({'message':_0x9edd('0x59')});});}catch(_0x389f51){_0x2ae8dd(_0x389f51);}}else if(_0x1c762c){_0x2ae8dd();}else{return _0x28cfae[_0x9edd('0x47')](0x193)['json']({'message':_0x9edd('0x4a')});}})['use'](function(_0x2bdb3f,_0xc1e657,_0x587d74){if(_0x2bdb3f[_0x9edd('0x36')]){db['User']['find']({'where':{'id':_0x2bdb3f[_0x9edd('0x36')]['id']},'attributes':userAttributes})[_0x9edd('0x3b')](function(_0x1f276b){if(!_0x1f276b){return _0xc1e657[_0x9edd('0x47')](0x194)[_0x9edd('0x3d')]({'message':_0x9edd('0x5a')});}_0x2bdb3f[_0x9edd('0x36')]=_0x1f276b;_0x587d74();})[_0x9edd('0x48')](function(_0x18c149){_0x587d74(_0x18c149);});}else if(_0x1c762c){_0x587d74();}else{return _0xc1e657[_0x9edd('0x47')](0x194)[_0x9edd('0x3d')]({'message':_0x9edd('0x5b')});}});};exports[_0x9edd('0x5c')]=function canUpdate(){return compose()[_0x9edd('0x35')](function(_0x46e9f4,_0x5416f8,_0x13197d){return licenseUtil[_0x9edd('0x5d')]()[_0x9edd('0x3b')](function(_0x1e5805){if(_0x1e5805[_0x9edd('0x5e')]){_0x13197d();}else{return _0x5416f8[_0x9edd('0x47')](0x193)[_0x9edd('0x3d')]({'message':'Forbidden'});}})['catch'](function(_0x4bc7a1){_0x13197d(_0x4bc7a1);});});};exports[_0x9edd('0x5f')]=function isWebrtcLicence(){return compose()['use'](function(_0x8b1fdb,_0x19b56b,_0x2b06d3){return licenseUtil[_0x9edd('0x5d')]()[_0x9edd('0x3b')](function(_0x53005b){if(_0x53005b[_0x9edd('0x60')]){_0x2b06d3();}else{return _0x19b56b[_0x9edd('0x47')](0x193)[_0x9edd('0x3d')]({'message':'Forbidden'});}})[_0x9edd('0x48')](function(_0xfd7bd1){_0x2b06d3(_0xfd7bd1);});});};exports[_0x9edd('0x61')]=function(_0x293b03,_0x1d78c4,_0x35bdec){_0x293b03['isMiddleware']=!![];return _0x35bdec();};exports[_0x9edd('0x62')]=function signToken(_0x237e91){return signJwt(_0x237e91);};exports['setTokenCookie']=function(_0xb93816,_0x8d8701){if(!_0xb93816['user']){return _0x8d8701[_0x9edd('0x47')](0x194)[_0x9edd('0x3d')]({'message':_0x9edd('0x63')});}var _0x5215b0={'payload':{'id':_0xb93816[_0x9edd('0x36')]['id'],'role':_0xb93816[_0x9edd('0x36')][_0x9edd('0x64')]},'options':{'expiresIn':0x15180}};return signJwt(_0x5215b0)[_0x9edd('0x3b')](function(_0x53f6e3){_0x8d8701[_0x9edd('0x65')](_0x9edd('0x66'),_0x53f6e3);_0x8d8701[_0x9edd('0x67')]('/dashboards/general');})[_0x9edd('0x48')](function(_0x21f6ce){return _0x8d8701['status'](0x1f4)[_0x9edd('0x68')](_0x21f6ce);});};exports['retrieveApiKey']=function(_0x336494){if(_[_0x9edd('0x69')](_0x336494[_0x9edd('0x52')])||_[_0x9edd('0x69')](_0x336494[_0x9edd('0x6a')])){return null;}else{return createJwt(_0x336494);}};exports[_0x9edd('0x6b')]=function(_0x2334d4){_0x2334d4[_0x9edd('0x52')]=generateNonce();_0x2334d4[_0x9edd('0x6a')]=generateIssuedAt();return createJwt(_0x2334d4);};exports[_0x9edd('0x6c')]=function(_0x31272d,_0x5a3b1d){var _0x161bea=_0x31272d[_0x9edd('0x4b')][_0x9edd('0x4c')];if(_0x161bea){var _0x58fe29={'nonce':_0x5a3b1d[_0x9edd('0x52')],'iat':_0x5a3b1d['apiKeyIat'],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x161bea,_0x58fe29)[_0x9edd('0x3b')](function(){return generateApiKey(_0x5a3b1d);});}else{throw{'message':_0x9edd('0x6d')};}};exports[_0x9edd('0x6e')]=function(_0x35ddb3){var _0x48a900=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x48a900['test'](_0x35ddb3))throw new db['Sequelize'][(_0x9edd('0x6f'))](_0x9edd('0x70'));return;};exports[_0x9edd('0x71')]=function(_0x1091ff,_0x2e2920,_0x41ec97){var _0x25906c=encryptor[_0x9edd('0x72')](_0x2e2920)['split'](',');for(var _0x16dfdc=0x0;_0x16dfdc<_0x41ec97;_0x16dfdc++){if(!_0x25906c[_0x16dfdc])break;if(_0x1091ff['toLowerCase']()===_0x25906c[_0x16dfdc][_0x9edd('0x73')]()){var _0x6a1cfc=util['format'](_0x9edd('0x74'),_0x41ec97);if(_0x41ec97===0x1){_0x6a1cfc=_0x9edd('0x75');}throw new db[(_0x9edd('0x76'))]['ValidationError'](_0x6a1cfc);}}return;};exports[_0x9edd('0x77')]=function(_0x2e1ce3,_0x430eb4){var _0x15ebfa=_0x430eb4?encryptor[_0x9edd('0x72')](_0x430eb4)[_0x9edd('0x78')](','):[];if(_0x15ebfa['length']===0x5){_0x15ebfa['splice'](-0x1,0x1);}_0x15ebfa[_0x9edd('0x79')](_0x2e1ce3);return encryptor['encryptString'](_0x15ebfa[_0x9edd('0x7a')](','));};function signJwt(_0x3e9a3e){var _0x439083=BPromise[_0x9edd('0x7b')](jwt['sign'],{'context':jwt});var _0x21ead2=_0x3e9a3e['secret']||config[_0x9edd('0x7c')][_0x9edd('0xc')];return new BPromise(function(_0xc6bde6,_0x5ca123){_0x439083(_0x3e9a3e[_0x9edd('0x7d')],_0x21ead2,_0x3e9a3e['options'])[_0x9edd('0x3b')](function(_0x4e1eda){_0xc6bde6(_0x4e1eda);})['catch'](function(_0x236b82){_0x5ca123(_0x236b82);});});}function verifyJwt(_0x4a72d0,_0x141137,_0x134c9c){var _0x307a61=BPromise['promisify'](jwt[_0x9edd('0x7e')],{'context':jwt});var _0x321485=_0x134c9c||config[_0x9edd('0x7c')][_0x9edd('0xc')];return new BPromise(function(_0x467512,_0x4d8fbb){_0x307a61(_0x4a72d0,_0x321485,_0x141137)['then'](function(_0x2e1a96){_0x467512(_0x2e1a96);})[_0x9edd('0x48')](function(_0x5516c4){_0x4d8fbb(_0x5516c4);});});}function generateNonce(){return crypto['randomBytes'](0x10)['toString'](_0x9edd('0x7f'));}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)[_0x9edd('0x80')]();}function createJwt(_0x32ff46){var _0x589348={'payload':{'iat':_0x32ff46[_0x9edd('0x6a')],'nonce':_0x32ff46[_0x9edd('0x52')]},'options':{'algorithm':_0x9edd('0x81'),'subject':_0x32ff46['id']['toString'](),'issuer':hardwareConf[_0x9edd('0x4d')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x589348)[_0x9edd('0x3b')](function(_0x18d1a0){return{'iat':_0x32ff46['apiKeyIat'],'nonce':_0x32ff46[_0x9edd('0x52')],'token':_0x18d1a0};});} \ No newline at end of file +var _0x00bb=['lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarRemoteControl','interface','userProfileId','privacyEnabled','settingsEnabled','downloadVoiceRecordings','downloadAttachments','selectRecallMeCampaign','chatAutoanswerDelay','emailAutoanswer','smsAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','isChatInteractionAuthorized','use','user','findOne','params','disposition','then','closed','unmanaged','Unmanaged.','Forbidden.','catch','isAuthenticated','headers','authorization','Basic','User','find','pass','status','Wrong\x20credentials.','Bearer','json','Unknown\x20authorization\x20format','query','getUuid','apikey','sub','Setting','allowedLoginAttempts','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockDuration','blockedAt','add','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','webrtc','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','redirect','/dashboards/general','send','isNil','apiKeyIat','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','unshift','encryptString','join','promisify','sign','secret','options','verify','toString','hex','floor','../../mysqldb','../../config/environment','../../config/license/hardware','../encryptor','jsonwebtoken','express-jwt','basic-auth','crypto','secrets','session','role','fullname','name','internal','permissions','md5secret','voicePause','chatPause','mailPause','smsPause'];(function(_0x4565c6,_0x284e6d){var _0x530df6=function(_0x21451d){while(--_0x21451d){_0x4565c6['push'](_0x4565c6['shift']());}};_0x530df6(++_0x284e6d);}(_0x00bb,0x1d8));var _0xb00b=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x00bb[_0x110c3d];return _0x226d67;};'use strict';var db=require(_0xb00b('0x0'))['db'];var config=require(_0xb00b('0x1'));var hardwareConf=require(_0xb00b('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0xb00b('0x3'));var _=require('lodash');var jwt=require(_0xb00b('0x4'));var expressJwt=require(_0xb00b('0x5'));var compose=require('composable-middleware');var basicAuth=require(_0xb00b('0x6'));var crypto=require(_0xb00b('0x7'));var BPromise=require('bluebird');var util=require('util');var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0xb00b('0x8')][_0xb00b('0x9')]});var userAttributes=['id',_0xb00b('0xa'),_0xb00b('0xb'),_0xb00b('0xc'),_0xb00b('0xd'),'email','userpic',_0xb00b('0xe'),_0xb00b('0xf'),_0xb00b('0x10'),_0xb00b('0x11'),_0xb00b('0x12'),'faxPause',_0xb00b('0x13'),'openchannelPause','pauseType','showWebBar',_0xb00b('0x14'),_0xb00b('0x15'),_0xb00b('0x16'),_0xb00b('0x17'),_0xb00b('0x18'),_0xb00b('0x19'),'phoneBarAutoAnswer',_0xb00b('0x1a'),_0xb00b('0x1b'),'phoneBarEnableRecording',_0xb00b('0x1c'),_0xb00b('0x1d'),'phoneBarExpires','phoneBarPrefixRequired',_0xb00b('0x1e'),'phoneBarRemoteControlPort','hotdesk',_0xb00b('0x1f'),_0xb00b('0x20'),_0xb00b('0x21'),_0xb00b('0x22'),'wssPort',_0xb00b('0x23'),'downloadOmnichannelInteractions',_0xb00b('0x24'),'ignorePauseForPreviewCalls',_0xb00b('0x25'),'chatAutoanswer',_0xb00b('0x26'),_0xb00b('0x27'),'emailAutoanswerDelay','smsAutoanswer',_0xb00b('0x28'),'openchannelAutoanswer',_0xb00b('0x29'),_0xb00b('0x2a'),_0xb00b('0x2b'),_0xb00b('0x2c'),'whatsappAutoanswerDelay'];exports[_0xb00b('0x2d')]=function(){return this['isAuthenticated'](!![])[_0xb00b('0x2e')](function(_0x121ec7,_0x51b841,_0x231293){if(_0x121ec7[_0xb00b('0x2f')]){_0x231293();}else{return db['ChatInteraction'][_0xb00b('0x30')]({'where':{'id':_0x121ec7[_0xb00b('0x31')]['id']},'attributes':['id','closed',_0xb00b('0x32')],'raw':!![]})[_0xb00b('0x33')](function(_0x3c9500){if(_0x3c9500&&_0x3c9500[_0xb00b('0x34')]){return _0x51b841['status'](_0x3c9500['disposition']===_0xb00b('0x35')?0x195:0x193)['json']({'message':_0x3c9500['disposition']==='unmanaged'?_0xb00b('0x36'):_0xb00b('0x37')});}else{_0x231293();}})[_0xb00b('0x38')](function(_0x3825af){_0x231293(_0x3825af);});}});};exports[_0xb00b('0x39')]=function isAuthenticated(_0x197379){return compose()[_0xb00b('0x2e')](function(_0x4a8d2b,_0x22c22d,_0x503c9c){var _0x450129;if(_0x4a8d2b[_0xb00b('0x3a')][_0xb00b('0x3b')]){if(_['startsWith'](_0x4a8d2b[_0xb00b('0x3a')][_0xb00b('0x3b')],_0xb00b('0x3c'))){var _0x183233=basicAuth(_0x4a8d2b);db[_0xb00b('0x3d')][_0xb00b('0x3e')]({'where':{'name':_0x183233[_0xb00b('0xc')]}})[_0xb00b('0x33')](function(_0x149c1a){if(!_0x149c1a||!_0x149c1a['authenticate'](_0x183233[_0xb00b('0x3f')])){return _0x22c22d[_0xb00b('0x40')](0x191)['json']({'message':_0xb00b('0x41')});}_0x4a8d2b[_0xb00b('0x2f')]={'id':_0x149c1a['id']};_0x503c9c();})['catch'](function(_0x456241){_0x503c9c(_0x456241);});}else if(_['startsWith'](_0x4a8d2b[_0xb00b('0x3a')][_0xb00b('0x3b')],_0xb00b('0x42'))){validateJwt(_0x4a8d2b,_0x22c22d,_0x503c9c);}else{if(_0x197379){_0x503c9c();}else{return _0x22c22d[_0xb00b('0x40')](0x193)[_0xb00b('0x43')]({'message':_0xb00b('0x44')});}}}else if(_0x4a8d2b[_0xb00b('0x45')]['apikey']){try{var _0x57e8f9={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xb00b('0x46')]()};verifyJwt(_0x4a8d2b[_0xb00b('0x45')][_0xb00b('0x47')],_0x57e8f9)[_0xb00b('0x33')](function(_0x5cfa60){return db[_0xb00b('0x3d')][_0xb00b('0x3e')]({'where':{'id':_0x5cfa60[_0xb00b('0x48')]}})[_0xb00b('0x33')](function(_0x261c80){_0x450129=_0x261c80;return db[_0xb00b('0x49')][_0xb00b('0x30')]({'where':{'id':0x1},'attributes':[_0xb00b('0x4a'),'blockDuration'],'raw':!![]});})['then'](function(_0x2ea41d){if(!_0x450129||!_['isEqual'](_0x450129[_0xb00b('0x4b')],_0x5cfa60[_0xb00b('0x4c')])){return _0x22c22d[_0xb00b('0x40')](0x191)[_0xb00b('0x43')]({'message':_0xb00b('0x4d')});}if(_0x450129[_0xb00b('0x4e')]){return _0x22c22d[_0xb00b('0x40')](0x191)['json']({'message':_0xb00b('0x4f')});}if(_0x450129[_0xb00b('0x50')]){if(_0x2ea41d[_0xb00b('0x51')]>0x0){if(moment(_0x450129[_0xb00b('0x52')])[_0xb00b('0x53')](_0x2ea41d[_0xb00b('0x51')],'minutes')>moment()){return _0x22c22d[_0xb00b('0x40')](0x191)[_0xb00b('0x43')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x22c22d[_0xb00b('0x40')](0x191)[_0xb00b('0x43')]({'message':_0xb00b('0x4f')});}}_0x4a8d2b[_0xb00b('0x2f')]={'id':_0x450129['id']};_0x503c9c();});})[_0xb00b('0x38')](function(){return _0x22c22d['status'](0x191)[_0xb00b('0x43')]({'message':_0xb00b('0x4f')});});}catch(_0xb76ede){_0x503c9c(_0xb76ede);}}else if(_0x197379){_0x503c9c();}else{return _0x22c22d[_0xb00b('0x40')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}})[_0xb00b('0x2e')](function(_0xf6ae0c,_0x10a348,_0x152437){if(_0xf6ae0c[_0xb00b('0x2f')]){db[_0xb00b('0x3d')][_0xb00b('0x3e')]({'where':{'id':_0xf6ae0c['user']['id']},'attributes':userAttributes})[_0xb00b('0x33')](function(_0x3b72c4){if(!_0x3b72c4){return _0x10a348[_0xb00b('0x40')](0x194)[_0xb00b('0x43')]({'message':_0xb00b('0x54')});}_0xf6ae0c[_0xb00b('0x2f')]=_0x3b72c4;_0x152437();})[_0xb00b('0x38')](function(_0x974a29){_0x152437(_0x974a29);});}else if(_0x197379){_0x152437();}else{return _0x10a348[_0xb00b('0x40')](0x194)[_0xb00b('0x43')]({'message':_0xb00b('0x55')});}});};exports[_0xb00b('0x56')]=function canUpdate(){return compose()['use'](function(_0x3da23c,_0x35a0ba,_0xd07fb8){return licenseUtil[_0xb00b('0x57')]()[_0xb00b('0x33')](function(_0x2d9174){if(_0x2d9174[_0xb00b('0x58')]){_0xd07fb8();}else{return _0x35a0ba[_0xb00b('0x40')](0x193)[_0xb00b('0x43')]({'message':_0xb00b('0x59')});}})[_0xb00b('0x38')](function(_0x3b3031){_0xd07fb8(_0x3b3031);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()['use'](function(_0x47c6c0,_0x3f8f60,_0x23d858){return licenseUtil['getLicense']()[_0xb00b('0x33')](function(_0x3c0fa){if(_0x3c0fa[_0xb00b('0x5a')]){_0x23d858();}else{return _0x3f8f60[_0xb00b('0x40')](0x193)['json']({'message':'Forbidden'});}})[_0xb00b('0x38')](function(_0x40c2fd){_0x23d858(_0x40c2fd);});});};exports['isMiddleware']=function(_0x514c5b,_0x154759,_0x3a205d){_0x514c5b['isMiddleware']=!![];return _0x3a205d();};exports[_0xb00b('0x5b')]=function signToken(_0x47a814){return signJwt(_0x47a814);};exports['setTokenCookie']=function(_0x4bcc9e,_0x465d90){if(!_0x4bcc9e['user']){return _0x465d90[_0xb00b('0x40')](0x194)[_0xb00b('0x43')]({'message':_0xb00b('0x5c')});}var _0xe724a5={'payload':{'id':_0x4bcc9e[_0xb00b('0x2f')]['id'],'role':_0x4bcc9e[_0xb00b('0x2f')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0xe724a5)['then'](function(_0x1d2a0d){_0x465d90[_0xb00b('0x5d')]('motion.token',_0x1d2a0d);_0x465d90[_0xb00b('0x5e')](_0xb00b('0x5f'));})['catch'](function(_0x15dcbf){return _0x465d90[_0xb00b('0x40')](0x1f4)[_0xb00b('0x60')](_0x15dcbf);});};exports['retrieveApiKey']=function(_0x501cbe){if(_[_0xb00b('0x61')](_0x501cbe[_0xb00b('0x4b')])||_[_0xb00b('0x61')](_0x501cbe[_0xb00b('0x62')])){return null;}else{return createJwt(_0x501cbe);}};exports['generateApiKey']=function(_0x380acb){_0x380acb[_0xb00b('0x4b')]=generateNonce();_0x380acb['apiKeyIat']=generateIssuedAt();return createJwt(_0x380acb);};exports['regenerateApiKey']=function(_0x160965,_0x524b05){var _0x1ab196=_0x160965[_0xb00b('0x45')][_0xb00b('0x47')];if(_0x1ab196){var _0x222459={'nonce':_0x524b05[_0xb00b('0x4b')],'iat':_0x524b05[_0xb00b('0x62')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xb00b('0x46')]()};return verifyJwt(_0x1ab196,_0x222459)['then'](function(){return generateApiKey(_0x524b05);});}else{throw{'message':_0xb00b('0x63')};}};exports[_0xb00b('0x64')]=function(_0x4129ba){var _0x5ac79e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x5ac79e[_0xb00b('0x65')](_0x4129ba))throw new db[(_0xb00b('0x66'))][(_0xb00b('0x67'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0xb00b('0x68')]=function(_0x309ae6,_0x219b74,_0x385029){var _0x131848=encryptor[_0xb00b('0x69')](_0x219b74)[_0xb00b('0x6a')](',');for(var _0x3a0b90=0x0;_0x3a0b90<_0x385029;_0x3a0b90++){if(!_0x131848[_0x3a0b90])break;if(_0x309ae6['toLowerCase']()===_0x131848[_0x3a0b90][_0xb00b('0x6b')]()){var _0x2cbe80=util[_0xb00b('0x6c')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x385029);if(_0x385029===0x1){_0x2cbe80=_0xb00b('0x6d');}throw new db[(_0xb00b('0x66'))][(_0xb00b('0x67'))](_0x2cbe80);}}return;};exports[_0xb00b('0x6e')]=function(_0x1ad387,_0x4bfe0b){var _0xfd4ecc=_0x4bfe0b?encryptor[_0xb00b('0x69')](_0x4bfe0b)[_0xb00b('0x6a')](','):[];if(_0xfd4ecc[_0xb00b('0x6f')]===0x5){_0xfd4ecc['splice'](-0x1,0x1);}_0xfd4ecc[_0xb00b('0x70')](_0x1ad387);return encryptor[_0xb00b('0x71')](_0xfd4ecc[_0xb00b('0x72')](','));};function signJwt(_0x2d73bb){var _0x161216=BPromise[_0xb00b('0x73')](jwt[_0xb00b('0x74')],{'context':jwt});var _0x542223=_0x2d73bb[_0xb00b('0x75')]||config['secrets'][_0xb00b('0x9')];return new BPromise(function(_0x4c2186,_0x3b3272){_0x161216(_0x2d73bb['payload'],_0x542223,_0x2d73bb[_0xb00b('0x76')])['then'](function(_0x3dffaf){_0x4c2186(_0x3dffaf);})[_0xb00b('0x38')](function(_0x3bae02){_0x3b3272(_0x3bae02);});});}function verifyJwt(_0x4d1cec,_0x51fbe2,_0x4f7a59){var _0x21a53d=BPromise[_0xb00b('0x73')](jwt[_0xb00b('0x77')],{'context':jwt});var _0x49246b=_0x4f7a59||config[_0xb00b('0x8')][_0xb00b('0x9')];return new BPromise(function(_0xca87d4,_0x2ddba4){_0x21a53d(_0x4d1cec,_0x49246b,_0x51fbe2)[_0xb00b('0x33')](function(_0x485033){_0xca87d4(_0x485033);})[_0xb00b('0x38')](function(_0x27b13b){_0x2ddba4(_0x27b13b);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0xb00b('0x78')](_0xb00b('0x79'));}function generateIssuedAt(){return Math[_0xb00b('0x7a')](Date['now']()/0x3e8)['toString']();}function createJwt(_0x359669){var _0x188da7={'payload':{'iat':_0x359669[_0xb00b('0x62')],'nonce':_0x359669['apiKeyNonce']},'options':{'algorithm':'HS512','subject':_0x359669['id']['toString'](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0xb00b('0x46')]()}};return signJwt(_0x188da7)['then'](function(_0x2434a0){return{'iat':_0x359669[_0xb00b('0x62')],'nonce':_0x359669['apiKeyNonce'],'token':_0x2434a0};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 5b367ac..a9cba18 100644 --- a/server/components/contacts/index.js +++ b/server/components/contacts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x551a=['map','CmCustomField','findOne','slice','fieldType','type','./sql-utils','../../mysqldb','skipContactsQuery','resolve','then','search','parseQueryParameters','default','fields','where','filter','user','clause','tags','skip','checkListsRestrictions','ids','countFilteredContacts','count','buildContactsQuery','getFilteredContacts','rows','catch','CmContact','describe','keys','cf_'];(function(_0xf2430,_0x1ff636){var _0x32df71=function(_0x51578a){while(--_0x51578a){_0xf2430['push'](_0xf2430['shift']());}};_0x32df71(++_0x1ff636);}(_0x551a,0x69));var _0xa551=function(_0x1d3c35,_0x38c5f9){_0x1d3c35=_0x1d3c35-0x0;var _0x3b4d05=_0x551a[_0x1d3c35];return _0x3b4d05;};'use strict';var _=require('lodash');var sqlUtils=require(_0xa551('0x0'));var db=require(_0xa551('0x1'))['db'];exports['findAll']=function(_0x4ec704,_0x18f529,_0xa2cc9e,_0x3f855f){var _0x471f95={'count':0x0,'rows':[]};var _0x3c5caf=sqlUtils[_0xa551('0x2')](_0x18f529,_0x4ec704);if(_0x3c5caf){return Promise[_0xa551('0x3')](_0x471f95);}var _0x4215f5=sqlUtils['getContactsSubquery']();var _0x21a732={};var _0xf927c8=![];var _0x570348=![];return Promise['resolve']()[_0xa551('0x4')](function(){if(_0x4ec704['search']){return sqlUtils['parseAdvancedSearchFilter'](_0x4ec704[_0xa551('0x5')],_0x3f855f);}else{return sqlUtils[_0xa551('0x6')](_0x4ec704,_0x3f855f);}})[_0xa551('0x4')](function(_0x1f918f){_0x4215f5['where'](_0x1f918f[_0xa551('0x7')]);_0x4215f5['where'](_0x1f918f[_0xa551('0x8')]);_0x4215f5[_0xa551('0x9')](_0x1f918f[_0xa551('0xa')]);_0x4215f5[_0xa551('0x9')](_0x1f918f[_0xa551('0xb')][_0xa551('0xc')]);_0x21a732=_0x1f918f[_0xa551('0xd')];_0x570348=_0x1f918f[_0xa551('0xb')][_0xa551('0xe')];return sqlUtils[_0xa551('0xf')](_0x18f529,_0x4ec704,_0x570348);})['then'](function(_0x42fd4f){_0x4215f5[_0xa551('0x9')](_0x42fd4f);var _0x173d23=_0x4ec704['search']?_0x21a732[_0xa551('0x10')]:_0x4ec704['tag'];_0xf927c8=_0x173d23?!![]:![];return sqlUtils[_0xa551('0x11')](_0x4215f5,_0x173d23);})[_0xa551('0x4')](function(_0x27e166){_0x471f95[_0xa551('0x12')]=_0x27e166;if(_0x471f95['count']===0x0){return;}if(_0x4ec704['User']){_0x570348=!![];}return sqlUtils[_0xa551('0x13')](_0x4215f5,_0x4ec704[_0xa551('0x8')],_0xa2cc9e,_0xf927c8,_0x21a732[_0xa551('0xc')],_0x570348);})['then'](function(_0x35c777){if(!_0x35c777){return[];}return sqlUtils[_0xa551('0x14')](_0x35c777,_0x4ec704,_0xa2cc9e);})[_0xa551('0x4')](function(_0x2fba53){_0x471f95[_0xa551('0x15')]=_0x2fba53;return _0x471f95;})[_0xa551('0x16')](function(_0x1cbaf9){throw _0x1cbaf9;});};exports['describe']=function(){var _0x26bbbd={};var _0x5533af=[];return db[_0xa551('0x17')][_0xa551('0x18')]()[_0xa551('0x4')](function(_0x45ab5a){_0x26bbbd=_0x45ab5a;var _0x321301=Object[_0xa551('0x19')](_0x26bbbd)[_0xa551('0xa')](function(_0x4b640a){return _['startsWith'](_0x4b640a,_0xa551('0x1a'))?_0x4b640a:undefined;});var _0x28d74a=_0x321301[_0xa551('0x1b')](function(_0x580748){return db[_0xa551('0x1c')][_0xa551('0x1d')]({'where':{'id':_0x580748[_0xa551('0x1e')](0x3)},'raw':!![]});});return Promise['all'](_0x28d74a);})['then'](function(_0x3a134f){for(var _0x346d20=0x0;_0x346d20<_0x3a134f['length'];_0x346d20++){if(_0x3a134f[_0x346d20]){var _0x4b1f77=_0xa551('0x1a')+_0x3a134f[_0x346d20]['id'];_0x26bbbd[_0x4b1f77][_0xa551('0x1f')]=_0x3a134f[_0x346d20][_0xa551('0x20')];}}_0x5533af=_[_0xa551('0x1b')](Object[_0xa551('0x19')](_0x26bbbd),function(_0x41ed83){return{'name':_0x41ed83,'type':_0x26bbbd[_0x41ed83][_0xa551('0x20')]};});return _0x5533af;})[_0xa551('0x16')](function(_0x2ad715){throw _0x2ad715;});}; \ No newline at end of file +var _0x5f66=['buildContactsQuery','getFilteredContacts','catch','CmContact','keys','filter','cf_','CmCustomField','slice','all','length','./sql-utils','findAll','resolve','then','search','parseAdvancedSearchFilter','where','default','fields','clause','user','skip','checkListsRestrictions','ids','tag','count'];(function(_0x52b163,_0x4ccf29){var _0x370394=function(_0x4f89d8){while(--_0x4f89d8){_0x52b163['push'](_0x52b163['shift']());}};_0x370394(++_0x4ccf29);}(_0x5f66,0x1a0));var _0x65f6=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5f66[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var sqlUtils=require(_0x65f6('0x0'));var db=require('../../mysqldb')['db'];exports[_0x65f6('0x1')]=function(_0x2f06ae,_0x3461cd,_0xbce843,_0x1a330c){var _0x5eb9ad={'count':0x0,'rows':[]};var _0x3c5029=sqlUtils['skipContactsQuery'](_0x3461cd,_0x2f06ae);if(_0x3c5029){return Promise[_0x65f6('0x2')](_0x5eb9ad);}var _0x22b017=sqlUtils['getContactsSubquery']();var _0x4ed98f={};var _0x1c0e12=![];var _0x2c6571=![];return Promise[_0x65f6('0x2')]()[_0x65f6('0x3')](function(){if(_0x2f06ae[_0x65f6('0x4')]){return sqlUtils[_0x65f6('0x5')](_0x2f06ae['search'],_0x1a330c);}else{return sqlUtils['parseQueryParameters'](_0x2f06ae,_0x1a330c);}})[_0x65f6('0x3')](function(_0x2f6d5b){_0x22b017[_0x65f6('0x6')](_0x2f6d5b[_0x65f6('0x7')]);_0x22b017['where'](_0x2f6d5b[_0x65f6('0x8')]);_0x22b017['where'](_0x2f6d5b['filter']);_0x22b017[_0x65f6('0x6')](_0x2f6d5b['user'][_0x65f6('0x9')]);_0x4ed98f=_0x2f6d5b['tags'];_0x2c6571=_0x2f6d5b[_0x65f6('0xa')][_0x65f6('0xb')];return sqlUtils[_0x65f6('0xc')](_0x3461cd,_0x2f06ae,_0x2c6571);})[_0x65f6('0x3')](function(_0x369f96){_0x22b017[_0x65f6('0x6')](_0x369f96);var _0x44144b=_0x2f06ae[_0x65f6('0x4')]?_0x4ed98f[_0x65f6('0xd')]:_0x2f06ae[_0x65f6('0xe')];_0x1c0e12=_0x44144b?!![]:![];return sqlUtils['countFilteredContacts'](_0x22b017,_0x44144b);})[_0x65f6('0x3')](function(_0x49a913){_0x5eb9ad['count']=_0x49a913;if(_0x5eb9ad[_0x65f6('0xf')]===0x0){return;}return sqlUtils[_0x65f6('0x10')](_0x22b017,_0x2f06ae[_0x65f6('0x8')],_0xbce843,_0x1c0e12,_0x4ed98f[_0x65f6('0x9')],_0x2c6571);})[_0x65f6('0x3')](function(_0x1f974c){if(!_0x1f974c){return[];}return sqlUtils[_0x65f6('0x11')](_0x1f974c,_0x2f06ae,_0xbce843);})[_0x65f6('0x3')](function(_0x495dd6){_0x5eb9ad['rows']=_0x495dd6;return _0x5eb9ad;})[_0x65f6('0x12')](function(_0x5b4055){throw _0x5b4055;});};exports['describe']=function(){var _0x5c5b91={};var _0x365159=[];return db[_0x65f6('0x13')]['describe']()[_0x65f6('0x3')](function(_0x270893){_0x5c5b91=_0x270893;var _0xbee6a4=Object[_0x65f6('0x14')](_0x5c5b91)[_0x65f6('0x15')](function(_0xc139c2){return _['startsWith'](_0xc139c2,_0x65f6('0x16'))?_0xc139c2:undefined;});var _0x4bb39e=_0xbee6a4['map'](function(_0x212247){return db[_0x65f6('0x17')]['findOne']({'where':{'id':_0x212247[_0x65f6('0x18')](0x3)},'raw':!![]});});return Promise[_0x65f6('0x19')](_0x4bb39e);})[_0x65f6('0x3')](function(_0x2774a1){for(var _0x4f5a69=0x0;_0x4f5a69<_0x2774a1[_0x65f6('0x1a')];_0x4f5a69++){if(_0x2774a1[_0x4f5a69]){var _0x59ea32=_0x65f6('0x16')+_0x2774a1[_0x4f5a69]['id'];_0x5c5b91[_0x59ea32]['fieldType']=_0x2774a1[_0x4f5a69]['type'];}}_0x365159=_['map'](Object[_0x65f6('0x14')](_0x5c5b91),function(_0x16cde8){return{'name':_0x16cde8,'type':_0x5c5b91[_0x16cde8]['type']};});return _0x365159;})[_0x65f6('0x12')](function(_0x28f710){throw _0x28f710;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 89a4d65..343e89b 100644 --- a/server/components/contacts/sql-utils.js +++ b/server/components/contacts/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1ec0=['forEach','TagIds','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','length','dateOfBirth','fieldType','datetime','DATE','buildExpression','text','value','start','end','Tag','map','tags','and','User','user','clause','skip','some','name','compact','Contact','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','uc.UserId\x20=\x20?','\x20=\x20?','then','fields','tag','filter','resolve','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','attributes','select','group','limit','offset','subqry.id','order','subqry.','DESC','findAll','keyBy','Sequelize','SELECT','CmContact','query','Tags','clone','COUNT(*)','c.id','isEmpty','t.id\x20IN\x20?','sequelize','exports','lodash','squel','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','search','true','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','cm_contact_has_tags','.id','firstName','lastName','phone','mobile','fax','email','ListId','CompanyId','createdAt','updatedAt','deletedAt','push'];(function(_0x5f6a8a,_0x45f474){var _0x2cce4d=function(_0x590b80){while(--_0x590b80){_0x5f6a8a['push'](_0x5f6a8a['shift']());}};_0x2cce4d(++_0x45f474);}(_0x1ec0,0x185));var _0x01ec=function(_0x490cbe,_0x3fc51f){_0x490cbe=_0x490cbe-0x0;var _0x58d3e0=_0x1ec0[_0x490cbe];return _0x58d3e0;};'use strict';var _=require(_0x01ec('0x0'));var squel=require(_0x01ec('0x1'));var as=require('../parsers/advancedSearch');var qs=require(_0x01ec('0x2'));var utils=require(_0x01ec('0x3'));var db=require(_0x01ec('0x4'))['db'];function skipContactsQuery(_0xcfb062,_0x79b2e7){var _0xa3084b=![];if(_0xcfb062[_0x01ec('0x5')]===_0x01ec('0x6')&&!_0x79b2e7[_0x01ec('0x7')]&&!_0x79b2e7['ListId']&&_0x79b2e7['autocomplete']!==_0x01ec('0x8')){_0xa3084b=!![];}return _0xa3084b;}function getContactsSubquery(){return squel['select']()[_0x01ec('0x9')](_0x01ec('0xa'),'c')[_0x01ec('0xb')](_0x01ec('0xc'));}function applyJoinClauses(_0x3a7121,_0x39565e){var _0x1fcc43=_0x39565e?'c':_0x01ec('0xd');_0x3a7121[_0x01ec('0xe')](_0x01ec('0xf'),'uc',_0x01ec('0x10')+_0x1fcc43+'.id')[_0x01ec('0xe')](_0x01ec('0x11'),'ct','ct.CmContactId\x20=\x20'+_0x1fcc43+_0x01ec('0x12'))['left_join']('tools_tags','t','t.id\x20=\x20ct.TagId');return _0x3a7121;}function addFieldsToQuery(_0xbc6305,_0x4d19db,_0x35d5b6,_0x1ef919,_0x147537){var _0x437707=_0x147537?'c':_0x01ec('0xd');if(!_0x4d19db){_0x4d19db=['id',_0x01ec('0x13'),_0x01ec('0x14'),_0x01ec('0x15'),_0x01ec('0x16'),_0x01ec('0x17'),_0x01ec('0x18'),_0x01ec('0x19'),_0x01ec('0x1a'),_0x01ec('0x1b'),_0x01ec('0x1c'),_0x01ec('0x1d'),'TagIds'];}else if(!_0x4d19db['includes']('id')){_0x4d19db[_0x01ec('0x1e')]('id');}var _0xf39569=_0x35d5b6&&_0x147537||!_0x35d5b6&&!_0x147537;if(_0x1ef919){_0xf39569=_0x1ef919&&_0x147537||!_0x1ef919&&!_0x147537;}_0x4d19db[_0x01ec('0x1f')](function(_0x275eac){if(_0x275eac===_0x01ec('0x20')){if(_0xf39569){_0xbc6305[_0x01ec('0x21')](_0x01ec('0x22'),_0x275eac);}else if(_0x35d5b6||_0x1ef919){_0xbc6305[_0x01ec('0x21')](_0x437707+'.'+_0x275eac);}}else{_0xbc6305['field'](_0x437707+'.'+_0x275eac);}});return _0xbc6305;}function getSqlClauses(){var _0x4af0d1={'default':squel['expr'](),'fields':squel[_0x01ec('0x23')](),'filter':squel[_0x01ec('0x23')](),'tags':{'clause':squel[_0x01ec('0x23')](),'ids':null},'user':{'clause':squel[_0x01ec('0x23')](),'skip':![]}};return _0x4af0d1;}function parseTagParameter(_0xea7c70){var _0x36a64c=squel[_0x01ec('0x23')]();if(_0xea7c70){var _0x20a686=utils[_0x01ec('0x24')](_0xea7c70);_0x20a686[_0x01ec('0x1f')](function(_0x1c11ec){_0x36a64c['or'](_0x01ec('0x25'),'%,'+_0x1c11ec+',%');});}return _0x36a64c;}function parseSearchFilter(_0x5659a3){var _0x2efa84=squel[_0x01ec('0x23')]();if(_0x5659a3){var _0x3457b8=_0x5659a3[_0x01ec('0x26')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(_0x3457b8[_0x01ec('0x27')]('\x20')['length']>0x1){_0x2efa84['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x01ec('0x28')](_0x3457b8,!![]),null);}else{if(qs[_0x01ec('0x29')](_0x3457b8)){_0x2efa84['or'](_0x01ec('0x2a'),_0x3457b8+'%');_0x2efa84['or'](_0x01ec('0x2b'),_0x3457b8+'%');_0x2efa84['or'](_0x01ec('0x2c'),_0x3457b8+'%');_0x2efa84['or'](_0x01ec('0x2d'),_0x3457b8+'%');}else if(qs[_0x01ec('0x2e')](_0x3457b8)){_0x2efa84['or'](_0x01ec('0x2f'),_0x3457b8+'%');}else{_0x2efa84['or'](_0x01ec('0x30'),'%'+_0x3457b8+'%');_0x2efa84['or'](_0x01ec('0x31'),'%'+_0x3457b8+'%');_0x2efa84['or'](_0x01ec('0x2f'),'%'+_0x3457b8+'%');}}}return _0x2efa84;}function parseAdvancedSearchFilter(_0x15715,_0x59af74){var _0x208b56=getSqlClauses();var _0x18548f=as['parseSearch'](_0x15715);var _0x4de51d=_0x18548f['sqlOperator'];for(var _0x130f30=0x0;_0x130f30<_0x18548f['conditions'][_0x01ec('0x32')];_0x130f30++){var _0x56057f=_0x18548f['conditions'][_0x130f30];var _0x573bc0='c';var _0x31e77e=_['find'](_0x59af74,['name',_0x56057f['field']]);if(_0x31e77e){if(_0x56057f[_0x01ec('0x21')]===_0x01ec('0x33')||_0x31e77e[_0x01ec('0x34')]===_0x01ec('0x35')){_0x56057f['castTo']=_0x01ec('0x36');}var _0xe66253=as[_0x01ec('0x37')](_0x573bc0,_0x31e77e['type'],_0x56057f);_0x208b56['default'][_0x4de51d](_0xe66253[_0x01ec('0x38')],_0xe66253[_0x01ec('0x39')][_0x01ec('0x3a')],_0xe66253['value'][_0x01ec('0x3b')]);}else{if(_0x56057f[_0x01ec('0x21')]===_0x01ec('0x3c')){var _0x1a6d13=_0x56057f[_0x01ec('0x39')][_0x01ec('0x27')](',')[_0x01ec('0x3d')](function(_0x1f7663){return Number(_0x1f7663);});var _0x2e4593=parseTagParameter(_0x1a6d13);_0x208b56[_0x01ec('0x3e')]['clause'][_0x01ec('0x3f')](_0x2e4593);_0x208b56[_0x01ec('0x3e')]['ids']=_0x1a6d13;}else if(_0x56057f[_0x01ec('0x21')]===_0x01ec('0x40')){_0x208b56[_0x01ec('0x41')][_0x01ec('0x42')][_0x01ec('0x3f')]('uc.UserId\x20=\x20?',_0x56057f[_0x01ec('0x39')]);_0x208b56[_0x01ec('0x41')][_0x01ec('0x43')]=!![];}}}return _0x208b56;}function parseModelFields(_0x26539f,_0x282464){var _0x537463=squel[_0x01ec('0x23')]();var _0x3ac157=_(_0x26539f)['keys']()[_0x01ec('0x3d')](function(_0x2a0723){return _[_0x01ec('0x44')](_0x282464,[_0x01ec('0x45'),_0x2a0723])?_0x2a0723:undefined;})[_0x01ec('0x46')]()[_0x01ec('0x39')]();if(_0x26539f[_0x01ec('0x47')]){_0x3ac157['push'](_0x01ec('0x47'));}if(_0x26539f[_0x01ec('0x40')]){_0x3ac157['push'](_0x01ec('0x40'));}if(_0x3ac157[_0x01ec('0x32')]>0x0){_0x3ac157[_0x01ec('0x1f')](function(_0x47af69){if(_0x47af69===_0x01ec('0x19')){_0x537463['and']('c.ListId\x20IN\x20?',[]['concat'](_0x26539f[_0x47af69]));}else if(_0x47af69===_0x01ec('0x47')){var _0x1d9c54='%'+_0x26539f[_0x47af69]+'%';_0x537463[_0x01ec('0x3f')](_0x01ec('0x48'),_0x1d9c54);}else if(_0x47af69===_0x01ec('0x40')){_0x537463[_0x01ec('0x3f')](_0x01ec('0x49'),_0x26539f[_0x47af69]);}else{_0x537463[_0x01ec('0x3f')]('c.'+_0x47af69+_0x01ec('0x4a'),_0x26539f[_0x47af69]);}});}return _0x537463;}function parseQueryParameters(_0x3cc2cf,_0x1402c8){var _0x374ca8=getSqlClauses();return Promise['resolve']()['then'](function(){return parseModelFields(_0x3cc2cf,_0x1402c8);})[_0x01ec('0x4b')](function(_0x1939d3){_0x374ca8[_0x01ec('0x4c')][_0x01ec('0x3f')](_0x1939d3);return parseTagParameter(_0x3cc2cf[_0x01ec('0x4d')]);})[_0x01ec('0x4b')](function(_0x21a72c){_0x374ca8[_0x01ec('0x3e')][_0x01ec('0x42')]['and'](_0x21a72c);return parseSearchFilter(_0x3cc2cf[_0x01ec('0x4e')]);})[_0x01ec('0x4b')](function(_0x379d6b){_0x374ca8[_0x01ec('0x4e')]=_0x379d6b;return _0x374ca8;});}function checkListsRestrictions(_0x4ada78,_0x275892,_0x1b218d){var _0x28adf8=squel[_0x01ec('0x23')]();return Promise[_0x01ec('0x4f')]()[_0x01ec('0x4b')](function(){if(_0x275892[_0x01ec('0x7')]&&_0x4ada78['role']===_0x01ec('0x6')&&!_0x1b218d){return _0x4ada78['getLists']({'attributes':['id'],'raw':!![]});}})[_0x01ec('0x4b')](function(_0x50381b){if(_0x50381b){if(_0x50381b[_0x01ec('0x32')]===0x0){_0x28adf8[_0x01ec('0x3f')](_0x01ec('0x50'));}else{_0x28adf8[_0x01ec('0x3f')](_0x01ec('0x51'),_[_0x01ec('0x3d')](_0x50381b,'id'));}}})['then'](function(){return _0x28adf8;});}function buildContactsQuery(_0x3f86e5,_0x1990e6,_0x523e08,_0xb71144,_0xb6816c,_0x509dbf){if(_0x1990e6){_0x1990e6=_0x523e08[_0x01ec('0x52')];}_0x3f86e5=addFieldsToQuery(_0x3f86e5,_0x1990e6,_0xb71144,_0x509dbf,!![]);var _0x24a9d9=squel[_0x01ec('0x53')]();_0x24a9d9=addFieldsToQuery(_0x24a9d9,_0x1990e6,_0xb71144,_0x509dbf,![]);if(_0xb71144||_0x509dbf){_0x3f86e5=applyJoinClauses(_0x3f86e5,!![]);_0x3f86e5[_0x01ec('0x54')]('c.id');if(_0x523e08['limit']){_0x24a9d9[_0x01ec('0x55')](_0x523e08[_0x01ec('0x55')]);}if(_0x523e08[_0x01ec('0x56')]){_0x24a9d9['offset'](_0x523e08[_0x01ec('0x56')]);}}else{_0x24a9d9=applyJoinClauses(_0x24a9d9,![]);_0x24a9d9['group'](_0x01ec('0x57'));if(_0x523e08[_0x01ec('0x55')]){_0x3f86e5[_0x01ec('0x55')](_0x523e08[_0x01ec('0x55')]);}if(_0x523e08[_0x01ec('0x56')]){_0x3f86e5[_0x01ec('0x56')](_0x523e08[_0x01ec('0x56')]);}}_0x24a9d9['having'](_0xb6816c);if(_0x523e08[_0x01ec('0x58')]){_0x523e08['order']['forEach'](function(_0x3f1d5a){_0x3f86e5['order']('c.'+_0x3f1d5a[0x0],_0x3f1d5a[0x1]==='DESC'?![]:!![]);_0x24a9d9[_0x01ec('0x58')](_0x01ec('0x59')+_0x3f1d5a[0x0],_0x3f1d5a[0x1]===_0x01ec('0x5a')?![]:!![]);});}_0x24a9d9[_0x01ec('0x9')](_0x3f86e5,_0x01ec('0xd'));return _0x24a9d9;}function getFilteredContacts(_0x5634eb){var _0x4d294e=[];return db['Tag'][_0x01ec('0x5b')]({'attributes':['id',_0x01ec('0x45'),'color'],'raw':!![]})[_0x01ec('0x4b')](function(_0xf37802){_0x4d294e=_[_0x01ec('0x5c')](_0xf37802,'id');var _0x1310dc={'type':db[_0x01ec('0x5d')]['QueryTypes'][_0x01ec('0x5e')],'model':db[_0x01ec('0x5f')],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize'][_0x01ec('0x60')](_0x5634eb['toString'](),_0x1310dc);})[_0x01ec('0x4b')](function(_0x273ba4){_0x273ba4['forEach'](function(_0x2f4593){if(_0x2f4593[_0x01ec('0x20')]){_0x2f4593[_0x01ec('0x61')]=[];_0x2f4593[_0x01ec('0x20')]['split'](',')[_0x01ec('0x1f')](function(_0x2ff1ee){_0x2f4593[_0x01ec('0x61')][_0x01ec('0x1e')](_0x4d294e[_0x2ff1ee]);});}delete _0x2f4593[_0x01ec('0x20')];});return _0x273ba4;});}function countFilteredContacts(_0xb111c8,_0x1a0060){var _0x51905b=_0xb111c8[_0x01ec('0x62')]();_0x51905b[_0x01ec('0x21')](_0x01ec('0x63'));_0x51905b=applyJoinClauses(_0x51905b,!![]);_0xb111c8[_0x01ec('0x54')](_0x01ec('0x64'));var _0x3ba252=utils[_0x01ec('0x24')](_0x1a0060);if(!_[_0x01ec('0x65')](_0x3ba252)){_0x51905b[_0x01ec('0xb')](_0x01ec('0x66'),_0x3ba252);}var _0x136bad={'type':db[_0x01ec('0x5d')]['QueryTypes'][_0x01ec('0x5e')],'raw':!![]};return db[_0x01ec('0x67')][_0x01ec('0x60')](_0x51905b['toString'](),_0x136bad)['then'](function(_0x3ace64){return _0x3ace64[0x0][_0x01ec('0x63')];});}module[_0x01ec('0x68')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x10eb=['ids','user','skip','name','compact','Contact','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','tag','filter','agent','getLists','c.ListId\x20IS\x20NULL','attributes','group','limit','offset','having','order','DESC','subqry.','Tag','findAll','color','keyBy','Sequelize','QueryTypes','SELECT','CmContact','query','toString','Tags','clone','COUNT(*)','c.id','getSelectedTags','isEmpty','t.id\x20IN\x20?','sequelize','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','role','search','ListId','autocomplete','true','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','phone','mobile','fax','email','CompanyId','createdAt','updatedAt','deletedAt','TagIds','includes','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','fieldType','castTo','DATE','type','text','start','value','end','map','clause','and'];(function(_0x3b6dbd,_0x33e896){var _0x3fa193=function(_0x33cf9d){while(--_0x33cf9d){_0x3b6dbd['push'](_0x3b6dbd['shift']());}};_0x3fa193(++_0x33e896);}(_0x10eb,0x176));var _0xb10e=function(_0x32153d,_0xb35650){_0x32153d=_0x32153d-0x0;var _0x1c442d=_0x10eb[_0x32153d];return _0x1c442d;};'use strict';var _=require(_0xb10e('0x0'));var squel=require(_0xb10e('0x1'));var as=require(_0xb10e('0x2'));var qs=require(_0xb10e('0x3'));var utils=require(_0xb10e('0x4'));var db=require(_0xb10e('0x5'))['db'];function skipContactsQuery(_0x42d40f,_0x6561e7){var _0x148587=![];if(_0x42d40f[_0xb10e('0x6')]==='agent'&&!_0x6561e7[_0xb10e('0x7')]&&!_0x6561e7[_0xb10e('0x8')]&&_0x6561e7[_0xb10e('0x9')]!==_0xb10e('0xa')){_0x148587=!![];}return _0x148587;}function getContactsSubquery(){return squel[_0xb10e('0xb')]()[_0xb10e('0xc')](_0xb10e('0xd'),'c')[_0xb10e('0xe')](_0xb10e('0xf'));}function applyJoinClauses(_0x108dd1,_0x4b0acc){var _0x591a68=_0x4b0acc?'c':_0xb10e('0x10');_0x108dd1[_0xb10e('0x11')](_0xb10e('0x12'),'uc','uc.CmContactId\x20=\x20'+_0x591a68+_0xb10e('0x13'))[_0xb10e('0x11')](_0xb10e('0x14'),'ct',_0xb10e('0x15')+_0x591a68+_0xb10e('0x13'))[_0xb10e('0x11')](_0xb10e('0x16'),'t',_0xb10e('0x17'));return _0x108dd1;}function addFieldsToQuery(_0x4b2728,_0x218e88,_0x4f41f1,_0x381ad6,_0x56679d){var _0x1b4165=_0x56679d?'c':_0xb10e('0x10');if(!_0x218e88){_0x218e88=['id','firstName','lastName',_0xb10e('0x18'),_0xb10e('0x19'),_0xb10e('0x1a'),_0xb10e('0x1b'),_0xb10e('0x8'),_0xb10e('0x1c'),_0xb10e('0x1d'),_0xb10e('0x1e'),_0xb10e('0x1f'),_0xb10e('0x20')];}else if(!_0x218e88[_0xb10e('0x21')]('id')){_0x218e88[_0xb10e('0x22')]('id');}var _0x10c2b9=_0x4f41f1&&_0x56679d||!_0x4f41f1&&!_0x56679d;if(_0x381ad6){_0x10c2b9=_0x381ad6&&_0x56679d||!_0x381ad6&&!_0x56679d;}_0x218e88[_0xb10e('0x23')](function(_0x455fbc){if(_0x455fbc===_0xb10e('0x20')){if(_0x10c2b9){_0x4b2728[_0xb10e('0x24')](_0xb10e('0x25'),_0x455fbc);}else if(_0x4f41f1||_0x381ad6){_0x4b2728['field'](_0x1b4165+'.'+_0x455fbc);}}else{_0x4b2728[_0xb10e('0x24')](_0x1b4165+'.'+_0x455fbc);}});return _0x4b2728;}function getSqlClauses(){var _0x5524cf={'default':squel[_0xb10e('0x26')](),'fields':squel[_0xb10e('0x26')](),'filter':squel['expr'](),'tags':{'clause':squel[_0xb10e('0x26')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x5524cf;}function parseTagParameter(_0x488124){var _0x4b825c=squel[_0xb10e('0x26')]();if(_0x488124){var _0x155968=utils['getSelectedTags'](_0x488124);_0x155968['forEach'](function(_0xa6bdd5){_0x4b825c['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xa6bdd5+',%');});}return _0x4b825c;}function parseSearchFilter(_0x39b716){var _0x21e549=squel[_0xb10e('0x26')]();if(_0x39b716){var _0x3207f0=_0x39b716[_0xb10e('0x27')]('\x5c','\x5c\x5c')[_0xb10e('0x27')](/'/g,'\x27\x27');if(_0x3207f0[_0xb10e('0x28')]('\x20')[_0xb10e('0x29')]>0x1){_0x21e549['or'](_0xb10e('0x2a'),qs[_0xb10e('0x2b')](_0x3207f0),null);}else{if(qs[_0xb10e('0x2c')](_0x3207f0)){_0x21e549['or']('c.id\x20LIKE\x20?',_0x3207f0+'%');_0x21e549['or'](_0xb10e('0x2d'),_0x3207f0+'%');_0x21e549['or'](_0xb10e('0x2e'),_0x3207f0+'%');_0x21e549['or'](_0xb10e('0x2f'),_0x3207f0+'%');}else if(qs[_0xb10e('0x30')](_0x3207f0)){_0x21e549['or'](_0xb10e('0x31'),_0x3207f0+'%');}else{_0x21e549['or'](_0xb10e('0x32'),'%'+_0x3207f0+'%');_0x21e549['or'](_0xb10e('0x33'),'%'+_0x3207f0+'%');_0x21e549['or'](_0xb10e('0x31'),'%'+_0x3207f0+'%');}}}return _0x21e549;}function parseAdvancedSearchFilter(_0xe85d88,_0x13b9df){var _0x5b74ea=getSqlClauses();var _0x538def=as[_0xb10e('0x34')](_0xe85d88);var _0x46f5f8=_0x538def[_0xb10e('0x35')];for(var _0x36a329=0x0;_0x36a329<_0x538def[_0xb10e('0x36')][_0xb10e('0x29')];_0x36a329++){var _0x5cdff2=_0x538def[_0xb10e('0x36')][_0x36a329];var _0x1c58dd='c';var _0x1ce56c=_['find'](_0x13b9df,['name',_0x5cdff2[_0xb10e('0x24')]]);if(_0x1ce56c){if(_0x5cdff2[_0xb10e('0x24')]==='dateOfBirth'||_0x1ce56c[_0xb10e('0x37')]==='datetime'){_0x5cdff2[_0xb10e('0x38')]=_0xb10e('0x39');}var _0x56486d=as['buildExpression'](_0x1c58dd,_0x1ce56c[_0xb10e('0x3a')],_0x5cdff2);_0x5b74ea['default'][_0x46f5f8](_0x56486d[_0xb10e('0x3b')],_0x56486d['value'][_0xb10e('0x3c')],_0x56486d[_0xb10e('0x3d')][_0xb10e('0x3e')]);}else{if(_0x5cdff2['field']==='Tag'){var _0x101e5d=_0x5cdff2['value'][_0xb10e('0x28')](',')[_0xb10e('0x3f')](function(_0x3570eb){return Number(_0x3570eb);});var _0x5dc950=parseTagParameter(_0x101e5d);_0x5b74ea['tags'][_0xb10e('0x40')][_0xb10e('0x41')](_0x5dc950);_0x5b74ea['tags'][_0xb10e('0x42')]=_0x101e5d;}else if(_0x5cdff2['field']==='User'){_0x5b74ea[_0xb10e('0x43')]['clause'][_0xb10e('0x41')]('uc.UserId\x20=\x20?',_0x5cdff2[_0xb10e('0x3d')]);_0x5b74ea[_0xb10e('0x43')][_0xb10e('0x44')]=!![];}}}return _0x5b74ea;}function parseModelFields(_0x2c0bc5,_0x52aa72){var _0x152fed=squel[_0xb10e('0x26')]();var _0xda6dd1=_(_0x2c0bc5)['keys']()['map'](function(_0x6dc45c){return _['some'](_0x52aa72,[_0xb10e('0x45'),_0x6dc45c])?_0x6dc45c:undefined;})[_0xb10e('0x46')]()[_0xb10e('0x3d')]();if(_0x2c0bc5[_0xb10e('0x47')]){_0xda6dd1['push']('Contact');}if(_0xda6dd1[_0xb10e('0x29')]>0x0){_0xda6dd1['forEach'](function(_0x1b189b){if(_0x1b189b==='ListId'){_0x152fed[_0xb10e('0x41')](_0xb10e('0x48'),[][_0xb10e('0x49')](_0x2c0bc5[_0x1b189b]));}else if(_0x1b189b===_0xb10e('0x47')){var _0x1fd4b6='%'+_0x2c0bc5[_0x1b189b]+'%';_0x152fed[_0xb10e('0x41')](_0xb10e('0x4a'),_0x1fd4b6);}else{_0x152fed[_0xb10e('0x41')]('c.'+_0x1b189b+_0xb10e('0x4b'),_0x2c0bc5[_0x1b189b]);}});}return _0x152fed;}function parseQueryParameters(_0x19fa93,_0x1c1459){var _0x35c920=getSqlClauses();return Promise[_0xb10e('0x4c')]()[_0xb10e('0x4d')](function(){return parseModelFields(_0x19fa93,_0x1c1459);})[_0xb10e('0x4d')](function(_0x233440){_0x35c920['fields'][_0xb10e('0x41')](_0x233440);return parseTagParameter(_0x19fa93[_0xb10e('0x4e')]);})[_0xb10e('0x4d')](function(_0x5a58d6){_0x35c920['tags'][_0xb10e('0x40')][_0xb10e('0x41')](_0x5a58d6);return parseSearchFilter(_0x19fa93[_0xb10e('0x4f')]);})[_0xb10e('0x4d')](function(_0x83744c){_0x35c920[_0xb10e('0x4f')]=_0x83744c;return _0x35c920;});}function checkListsRestrictions(_0x47d9cd,_0x3f1b41,_0x1cc15f){var _0x337840=squel[_0xb10e('0x26')]();return Promise[_0xb10e('0x4c')]()[_0xb10e('0x4d')](function(){if(_0x3f1b41['search']&&_0x47d9cd['role']===_0xb10e('0x50')&&!_0x1cc15f){return _0x47d9cd[_0xb10e('0x51')]({'attributes':['id'],'raw':!![]});}})[_0xb10e('0x4d')](function(_0x1cc0eb){if(_0x1cc0eb){if(_0x1cc0eb[_0xb10e('0x29')]===0x0){_0x337840[_0xb10e('0x41')](_0xb10e('0x52'));}else{_0x337840['and']('c.ListId\x20IN\x20?',_[_0xb10e('0x3f')](_0x1cc0eb,'id'));}}})['then'](function(){return _0x337840;});}function buildContactsQuery(_0x19f7f0,_0x26ce0e,_0x242fd8,_0x1b8392,_0x20c81a,_0x856869){if(_0x26ce0e){_0x26ce0e=_0x242fd8[_0xb10e('0x53')];}_0x19f7f0=addFieldsToQuery(_0x19f7f0,_0x26ce0e,_0x1b8392,_0x856869,!![]);var _0x262426=squel[_0xb10e('0xb')]();_0x262426=addFieldsToQuery(_0x262426,_0x26ce0e,_0x1b8392,_0x856869,![]);if(_0x1b8392||_0x856869){_0x19f7f0=applyJoinClauses(_0x19f7f0,!![]);_0x19f7f0[_0xb10e('0x54')]('c.id');if(_0x242fd8[_0xb10e('0x55')]){_0x262426['limit'](_0x242fd8[_0xb10e('0x55')]);}if(_0x242fd8[_0xb10e('0x56')]){_0x262426[_0xb10e('0x56')](_0x242fd8[_0xb10e('0x56')]);}}else{_0x262426=applyJoinClauses(_0x262426,![]);_0x262426[_0xb10e('0x54')]('subqry.id');if(_0x242fd8[_0xb10e('0x55')]){_0x19f7f0[_0xb10e('0x55')](_0x242fd8[_0xb10e('0x55')]);}if(_0x242fd8[_0xb10e('0x56')]){_0x19f7f0[_0xb10e('0x56')](_0x242fd8[_0xb10e('0x56')]);}}_0x262426[_0xb10e('0x57')](_0x20c81a);if(_0x242fd8[_0xb10e('0x58')]){_0x242fd8[_0xb10e('0x58')][_0xb10e('0x23')](function(_0xe15eb8){_0x19f7f0[_0xb10e('0x58')]('c.'+_0xe15eb8[0x0],_0xe15eb8[0x1]===_0xb10e('0x59')?![]:!![]);_0x262426[_0xb10e('0x58')](_0xb10e('0x5a')+_0xe15eb8[0x0],_0xe15eb8[0x1]===_0xb10e('0x59')?![]:!![]);});}_0x262426[_0xb10e('0xc')](_0x19f7f0,_0xb10e('0x10'));return _0x262426;}function getFilteredContacts(_0x544a14){var _0x2832b0=[];return db[_0xb10e('0x5b')][_0xb10e('0x5c')]({'attributes':['id',_0xb10e('0x45'),_0xb10e('0x5d')],'raw':!![]})[_0xb10e('0x4d')](function(_0x4186a6){_0x2832b0=_[_0xb10e('0x5e')](_0x4186a6,'id');var _0x735a7a={'type':db[_0xb10e('0x5f')][_0xb10e('0x60')][_0xb10e('0x61')],'model':db[_0xb10e('0x62')],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize'][_0xb10e('0x63')](_0x544a14[_0xb10e('0x64')](),_0x735a7a);})[_0xb10e('0x4d')](function(_0x3e0b05){_0x3e0b05['forEach'](function(_0x5135b1){if(_0x5135b1['TagIds']){_0x5135b1[_0xb10e('0x65')]=[];_0x5135b1[_0xb10e('0x20')][_0xb10e('0x28')](',')['forEach'](function(_0x265909){_0x5135b1[_0xb10e('0x65')][_0xb10e('0x22')](_0x2832b0[_0x265909]);});}delete _0x5135b1['TagIds'];});return _0x3e0b05;});}function countFilteredContacts(_0x5f1111,_0x12ef60){var _0x9ba9c5=_0x5f1111[_0xb10e('0x66')]();_0x9ba9c5[_0xb10e('0x24')](_0xb10e('0x67'));_0x9ba9c5=applyJoinClauses(_0x9ba9c5,!![]);_0x5f1111[_0xb10e('0x54')](_0xb10e('0x68'));var _0x774b62=utils[_0xb10e('0x69')](_0x12ef60);if(!_[_0xb10e('0x6a')](_0x774b62)){_0x9ba9c5[_0xb10e('0xe')](_0xb10e('0x6b'),_0x774b62);}var _0x14ca07={'type':db[_0xb10e('0x5f')]['QueryTypes'][_0xb10e('0x61')],'raw':!![]};return db[_0xb10e('0x6c')][_0xb10e('0x63')](_0x9ba9c5[_0xb10e('0x64')](),_0x14ca07)[_0xb10e('0x4d')](function(_0x140801){return _0x140801[0x0]['COUNT(*)'];});}module[_0xb10e('0x6d')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index cf1040a..9db138e 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 _0x13cc=['createCipher','data','update','binary','write','end','close','unlink','createDecipher','final','encryptString','secret','utf8','base64','decryptString','bluebird','lodash','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','test','getCiphers','filter','hasOwnProperty','encryptFile','createReadStream','createWriteStream'];(function(_0x13ff53,_0x5e1424){var _0x290228=function(_0x3e3133){while(--_0x3e3133){_0x13ff53['push'](_0x13ff53['shift']());}};_0x290228(++_0x5e1424);}(_0x13cc,0xbe));var _0xc13c=function(_0x4da522,_0x1672df){_0x4da522=_0x4da522-0x0;var _0x5e57f6=_0x13cc[_0x4da522];return _0x5e57f6;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0xc13c('0x0'));var _=require(_0xc13c('0x1'));var config=require(_0xc13c('0x2'));var logger=require(_0xc13c('0x3'))(_0xc13c('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xc13c('0x5')][_0xc13c('0x6')],'algorithm':_0xc13c('0x7')};const fileOptions={'algorithm':_0xc13c('0x8')};if(config['encrypt']&&config[_0xc13c('0x9')]['algorithm']){var isSupported=isAlgorithmSupported(config['encrypt'][_0xc13c('0xa')]);if(isSupported){fileOptions[_0xc13c('0xa')]=config[_0xc13c('0x9')][_0xc13c('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xc13c('0xb')](',\x20');logger[_0xc13c('0xc')](config[_0xc13c('0x9')]['algorithm'],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x2d1a47){return AES_SUPPORTED_RX[_0xc13c('0xd')](_0x2d1a47);}function getSupportedCiphers(){return crypto[_0xc13c('0xe')]()[_0xc13c('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0x4af910){return getSupportedCiphers()['indexOf'](_0x4af910)>-0x1;}function combineOptions(_0x3a0a8f){var _0xd9250={};for(var _0x37ba58 in fileOptions){if(fileOptions[_0xc13c('0x10')](_0x37ba58)){_0xd9250[_0x37ba58]=fileOptions[_0x37ba58];}}if(_0x3a0a8f){for(var _0x5c9628 in _0x3a0a8f){if(_0x3a0a8f[_0xc13c('0x10')](_0x5c9628)){_0xd9250[_0x5c9628]=_0x3a0a8f[_0x5c9628];}}}return _0xd9250;}exports[_0xc13c('0x11')]=function(_0x2c5119,_0x697ee,_0x53f701,_0x29e3b1){return new BPromise(function(_0x328fc8,_0x2a3abc){_0x29e3b1=combineOptions(_0x29e3b1);var _0x267b84=new Buffer(_0x53f701);var _0x464246=fs[_0xc13c('0x12')](_0x2c5119);var _0x3a8b21=fs[_0xc13c('0x13')](_0x697ee);var _0x11455a=crypto[_0xc13c('0x14')](_0x29e3b1[_0xc13c('0xa')],_0x267b84);_0x464246['on'](_0xc13c('0x15'),function(_0x1bed1d){var _0x25ceae=new Buffer(_0x11455a[_0xc13c('0x16')](_0x1bed1d),_0xc13c('0x17'));_0x3a8b21[_0xc13c('0x18')](_0x25ceae);});_0x464246['on'](_0xc13c('0x19'),function(){try{var _0x36f490=new Buffer(_0x11455a['final'](_0xc13c('0x17')),_0xc13c('0x17'));_0x3a8b21[_0xc13c('0x18')](_0x36f490);_0x3a8b21[_0xc13c('0x19')]();_0x3a8b21['on'](_0xc13c('0x1a'),function(){return _0x328fc8(_0x697ee);});}catch(_0x55eafd){fs[_0xc13c('0x1b')](_0x697ee);return _0x2a3abc(_0x55eafd);}});});};exports['decryptFile']=function(_0x190848,_0x463466,_0x357e5d,_0xa01371){return new BPromise(function(_0x7cb749,_0x3124c7){_0xa01371=combineOptions(_0xa01371);var _0x32d781=new Buffer(_0x357e5d);var _0x171f2a=fs['createReadStream'](_0x190848);var _0x2bc067=fs[_0xc13c('0x13')](_0x463466);var _0x518b5b=crypto[_0xc13c('0x1c')](_0xa01371[_0xc13c('0xa')],_0x32d781);_0x171f2a['on'](_0xc13c('0x15'),function(_0x5c7b34){var _0x433340=new Buffer(_0x518b5b[_0xc13c('0x16')](_0x5c7b34),_0xc13c('0x17'));_0x2bc067['write'](_0x433340);});_0x171f2a['on'](_0xc13c('0x19'),function(){try{var _0x1bd60d=new Buffer(_0x518b5b[_0xc13c('0x1d')](_0xc13c('0x17')),_0xc13c('0x17'));_0x2bc067['write'](_0x1bd60d);_0x2bc067[_0xc13c('0x19')]();_0x2bc067['on'](_0xc13c('0x1a'),function(){return _0x7cb749(_0x463466);});}catch(_0x46aaa3){fs[_0xc13c('0x1b')](_0x463466);return _0x3124c7(_0x46aaa3);}});});};exports[_0xc13c('0x1e')]=function(_0xceb3e6,_0x1f1978,_0x4aa122){var _0x127e80=_0x4aa122||stringOptions[_0xc13c('0xa')];var _0x5752db=_0x1f1978||stringOptions[_0xc13c('0x1f')];var _0x1ef7a9=crypto[_0xc13c('0x14')](_0x127e80,_0x5752db);var _0x74b106=_0x1ef7a9[_0xc13c('0x16')](_0xceb3e6,_0xc13c('0x20'),_0xc13c('0x21'));_0x74b106+=_0x1ef7a9[_0xc13c('0x1d')]('base64');return _0x74b106;};exports[_0xc13c('0x22')]=function(_0x4abdaa,_0x1f0041,_0x495123){var _0x3403c3=_0x495123||stringOptions[_0xc13c('0xa')];var _0x384ef9=_0x1f0041||stringOptions['secret'];var _0xb815fe=crypto[_0xc13c('0x1c')](_0x3403c3,_0x384ef9);var _0x14187a=_0xb815fe[_0xc13c('0x16')](_0x4abdaa,_0xc13c('0x21'),_0xc13c('0x20'));_0x14187a+=_0xb815fe[_0xc13c('0x1d')](_0xc13c('0x20'));return _0x14187a;}; \ No newline at end of file +var _0x80e3=['close','unlink','createReadStream','createDecipher','final','encryptString','base64','secret','utf8','crypto','lodash','../../config/environment','../../config/logger','app','secrets','session','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','filter','indexOf','hasOwnProperty','encryptFile','createWriteStream','createCipher','data','update','binary','write','end'];(function(_0x55fb83,_0x1d3856){var _0x59a87a=function(_0x38bdd1){while(--_0x38bdd1){_0x55fb83['push'](_0x55fb83['shift']());}};_0x59a87a(++_0x1d3856);}(_0x80e3,0x17f));var _0x380e=function(_0x4491b,_0x599c94){_0x4491b=_0x4491b-0x0;var _0x88cdf3=_0x80e3[_0x4491b];return _0x88cdf3;};'use strict';var crypto=require(_0x380e('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x380e('0x1'));var config=require(_0x380e('0x2'));var logger=require(_0x380e('0x3'))(_0x380e('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x380e('0x5')][_0x380e('0x6')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x380e('0x7')};if(config['encrypt']&&config[_0x380e('0x8')][_0x380e('0x9')]){var isSupported=isAlgorithmSupported(config[_0x380e('0x8')][_0x380e('0x9')]);if(isSupported){fileOptions['algorithm']=config[_0x380e('0x8')][_0x380e('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x380e('0xa')](',\x20');logger[_0x380e('0xb')](config[_0x380e('0x8')][_0x380e('0x9')],_0x380e('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0xdc6344){return AES_SUPPORTED_RX[_0x380e('0xd')](_0xdc6344);}function getSupportedCiphers(){return crypto['getCiphers']()[_0x380e('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0xa481c4){return getSupportedCiphers()[_0x380e('0xf')](_0xa481c4)>-0x1;}function combineOptions(_0x1ec806){var _0x595282={};for(var _0x38605d in fileOptions){if(fileOptions[_0x380e('0x10')](_0x38605d)){_0x595282[_0x38605d]=fileOptions[_0x38605d];}}if(_0x1ec806){for(var _0x31ce1f in _0x1ec806){if(_0x1ec806['hasOwnProperty'](_0x31ce1f)){_0x595282[_0x31ce1f]=_0x1ec806[_0x31ce1f];}}}return _0x595282;}exports[_0x380e('0x11')]=function(_0x30e89e,_0x6847a,_0x368fa6,_0x45d99c){return new BPromise(function(_0x1f6657,_0x2305cb){_0x45d99c=combineOptions(_0x45d99c);var _0x8e94e2=new Buffer(_0x368fa6);var _0x1b491a=fs['createReadStream'](_0x30e89e);var _0x22faa5=fs[_0x380e('0x12')](_0x6847a);var _0x389bbc=crypto[_0x380e('0x13')](_0x45d99c[_0x380e('0x9')],_0x8e94e2);_0x1b491a['on'](_0x380e('0x14'),function(_0x3d8714){var _0x2b197f=new Buffer(_0x389bbc[_0x380e('0x15')](_0x3d8714),_0x380e('0x16'));_0x22faa5[_0x380e('0x17')](_0x2b197f);});_0x1b491a['on'](_0x380e('0x18'),function(){try{var _0x561698=new Buffer(_0x389bbc['final'](_0x380e('0x16')),_0x380e('0x16'));_0x22faa5[_0x380e('0x17')](_0x561698);_0x22faa5[_0x380e('0x18')]();_0x22faa5['on'](_0x380e('0x19'),function(){return _0x1f6657(_0x6847a);});}catch(_0x49b188){fs[_0x380e('0x1a')](_0x6847a);return _0x2305cb(_0x49b188);}});});};exports['decryptFile']=function(_0x494565,_0x36e1fa,_0x38793a,_0x2decd3){return new BPromise(function(_0x2128a4,_0x3ceaf5){_0x2decd3=combineOptions(_0x2decd3);var _0x3132b4=new Buffer(_0x38793a);var _0x54741e=fs[_0x380e('0x1b')](_0x494565);var _0x5c85aa=fs[_0x380e('0x12')](_0x36e1fa);var _0x4f3a4f=crypto[_0x380e('0x1c')](_0x2decd3[_0x380e('0x9')],_0x3132b4);_0x54741e['on'](_0x380e('0x14'),function(_0x296c72){var _0x1ec422=new Buffer(_0x4f3a4f[_0x380e('0x15')](_0x296c72),'binary');_0x5c85aa['write'](_0x1ec422);});_0x54741e['on'](_0x380e('0x18'),function(){try{var _0x1f38c3=new Buffer(_0x4f3a4f[_0x380e('0x1d')](_0x380e('0x16')),_0x380e('0x16'));_0x5c85aa['write'](_0x1f38c3);_0x5c85aa['end']();_0x5c85aa['on'](_0x380e('0x19'),function(){return _0x2128a4(_0x36e1fa);});}catch(_0x450b2f){fs[_0x380e('0x1a')](_0x36e1fa);return _0x3ceaf5(_0x450b2f);}});});};exports[_0x380e('0x1e')]=function(_0x5b8c22,_0x316b9b,_0x4afafc){var _0x4aeba3=_0x4afafc||stringOptions['algorithm'];var _0x48c437=_0x316b9b||stringOptions['secret'];var _0x497522=crypto['createCipher'](_0x4aeba3,_0x48c437);var _0x2d7871=_0x497522[_0x380e('0x15')](_0x5b8c22,'utf8',_0x380e('0x1f'));_0x2d7871+=_0x497522[_0x380e('0x1d')](_0x380e('0x1f'));return _0x2d7871;};exports['decryptString']=function(_0x43f7de,_0x41a86b,_0x2f076f){var _0x4d1367=_0x2f076f||stringOptions[_0x380e('0x9')];var _0xee9ded=_0x41a86b||stringOptions[_0x380e('0x20')];var _0x1414f9=crypto[_0x380e('0x1c')](_0x4d1367,_0xee9ded);var _0x4907ee=_0x1414f9[_0x380e('0x15')](_0x43f7de,_0x380e('0x1f'),_0x380e('0x21'));_0x4907ee+=_0x1414f9[_0x380e('0x1d')]('utf8');return _0x4907ee;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 94029b3..4a3f387 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 _0xed87=['CSV','find','split','splitSizeCsv','then','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','Empty','length','num','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','mkdirSync','join','each','csv','%s.%s','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','util','lodash','to-csv','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format'];(function(_0xb09267,_0x525102){var _0x58e7c7=function(_0xd6b2a){while(--_0xd6b2a){_0xb09267['push'](_0xb09267['shift']());}};_0x58e7c7(++_0x525102);}(_0xed87,0xd8));var _0x7ed8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xed87[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x7ed8('0x0'));var path=require('path');var _=require(_0x7ed8('0x1'));var csv=require(_0x7ed8('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0x7ed8('0x3'));var db=require(_0x7ed8('0x4'))['db'];var dbH=require(_0x7ed8('0x4'))['dbH'];var logger=require(_0x7ed8('0x5'))(_0x7ed8('0x6'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x7ed8('0x7')][0x3];var PATH=process[_0x7ed8('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2e8429,_0x1a4783){var _0x17efef={'status':_0x2e8429};var _0x93f85a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1a4783){_0x17efef[_0x7ed8('0x8')]=_0x1a4783;}return db[_0x7ed8('0x9')][_0x7ed8('0xa')](_0x17efef,_0x93f85a);}function main(){var _0x34bd2a=0x1388;var _0x1421bf;logger[_0x7ed8('0xb')](util[_0x7ed8('0xc')](_0x7ed8('0xd'),EXTRACTED_REPORT_ID,_0x7ed8('0xe')));return db['Setting'][_0x7ed8('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x7ed8('0x10'),_0x7ed8('0x11')]})[_0x7ed8('0x12')](function(_0x3c6be2){if(_0x3c6be2){_0x1421bf=_0x3c6be2;_0x34bd2a=_0x1421bf['splitSizeCsv']||0x1388;}})['then'](function(){return dbH['sequelize']['query'](util[_0x7ed8('0xc')](_0x7ed8('0x13'),QUERY),{'type':dbH[_0x7ed8('0x14')][_0x7ed8('0x15')][_0x7ed8('0x16')]});})['then'](function(_0x43bd07){if(!_0x43bd07[0x0]['num']){return analyticExtractedReport(_0x7ed8('0x17'));}var _0x3fd4d9=[];var _0x4b74a1=0x0;if(_0x1421bf['split']){if(_0x43bd07&&_0x43bd07[_0x7ed8('0x18')]){var _0x1785ad=_['range'](_0x43bd07[0x0][_0x7ed8('0x19')]/_0x34bd2a);var _0x18edb9=Number['isInteger'](_0x43bd07[0x0]['num']/_0x34bd2a)?_0x43bd07[0x0][_0x7ed8('0x19')]%_0x34bd2a:0x0;_0x1785ad[_0x7ed8('0x1a')](function(_0x54a766){if(_0x54a766>0x0){_0x4b74a1+=_0x34bd2a;}_0x3fd4d9[_0x7ed8('0x1b')](dbH[_0x7ed8('0x14')][_0x7ed8('0x1c')](util[_0x7ed8('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x34bd2a,_0x4b74a1),{'type':dbH[_0x7ed8('0x14')][_0x7ed8('0x15')][_0x7ed8('0x16')]}));});if(_0x18edb9>0x0){_0x4b74a1+=_0x34bd2a;_0x3fd4d9['push'](dbH['sequelize'][_0x7ed8('0x1c')](util['format'](_0x7ed8('0x1d'),QUERY,_0x18edb9,_0x4b74a1),{'type':dbH[_0x7ed8('0x14')][_0x7ed8('0x15')]['SELECT']}));}}}else{_0x3fd4d9['push'](dbH['sequelize'][_0x7ed8('0x1c')](QUERY,{'type':dbH[_0x7ed8('0x14')][_0x7ed8('0x15')][_0x7ed8('0x16')]}));}var _0x3ac891=path[_0x7ed8('0x1e')](PATH);var _0x18893e=path[_0x7ed8('0x1f')](PATH,_0x7ed8('0x20'));var _0x4b8134=_0x1421bf[_0x7ed8('0x10')]&&_0x3fd4d9[_0x7ed8('0x18')]>0x1;var _0x408515=[];if(!fs['existsSync'](path['join'](_0x3ac891,_0x18893e))&&_0x4b8134){fs[_0x7ed8('0x21')](path[_0x7ed8('0x22')](_0x3ac891,_0x18893e));}return BPromise[_0x7ed8('0x23')](_0x3fd4d9,function(_0x490f2b){_0x408515['push'](_0x490f2b);})['then'](function(){for(var _0x25be92=0x0;_0x25be92<_0x408515[_0x7ed8('0x18')];_0x25be92+=0x1){var _0x445050;var _0x3b04f2=_0x408515[_0x25be92];if(_0x4b8134){_0x445050=path[_0x7ed8('0x22')](_0x3ac891,_0x18893e,util[_0x7ed8('0xc')]('%s%d.%s',_0x18893e,_0x25be92,_0x7ed8('0x24')));}else{_0x445050=path[_0x7ed8('0x22')](_0x3ac891,util['format'](_0x7ed8('0x25'),_0x18893e,_0x7ed8('0x24')));}fs['writeFileSync'](_0x445050,csv(_0x3b04f2));}})[_0x7ed8('0x12')](function(){if(_0x4b8134){return new Promise(function(_0x12265b){zipdir(path[_0x7ed8('0x22')](_0x3ac891,_0x18893e),{'saveTo':path['join'](_0x3ac891,util[_0x7ed8('0xc')](_0x7ed8('0x25'),_0x18893e,'zip'))},function(_0x11bece,_0x18bc79){rimraf(path[_0x7ed8('0x22')](_0x3ac891,_0x18893e),function(){});_0x12265b(_0x7ed8('0x26'));});});}})[_0x7ed8('0x12')](function(){logger['info'](util[_0x7ed8('0xc')](_0x7ed8('0x27'),EXTRACTED_REPORT_ID,_0x7ed8('0xe')));return analyticExtractedReport(_0x7ed8('0x28'),_0x4b8134?util[_0x7ed8('0xc')]('%s.%s',_0x18893e,_0x4b8134?'zip':_0x7ed8('0x24')):null);});})[_0x7ed8('0x29')](function(_0xa4f979){logger['info'](util[_0x7ed8('0xc')](_0x7ed8('0x2a'),EXTRACTED_REPORT_ID,_0x7ed8('0xe')),util['inspect'](_0xa4f979,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x7ed8('0x2b'));})[_0x7ed8('0x2c')](function(){process[_0x7ed8('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x8d5f=['forEach','push','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','join','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','lodash','to-csv','rimraf','../../mysqldb','dbH','argv','savename','AnalyticExtractedReport','info','CSV','Setting','find','split','splitSizeCsv','then','query','format','QueryTypes','SELECT','num','Empty','length','range','isInteger'];(function(_0x28b5ff,_0x3e774e){var _0x17db93=function(_0x54568a){while(--_0x54568a){_0x28b5ff['push'](_0x28b5ff['shift']());}};_0x17db93(++_0x3e774e);}(_0x8d5f,0x74));var _0xf8d5=function(_0x35af23,_0x9190f6){_0x35af23=_0x35af23-0x0;var _0x340506=_0x8d5f[_0x35af23];return _0x340506;};'use strict';var util=require(_0xf8d5('0x0'));var path=require('path');var _=require(_0xf8d5('0x1'));var csv=require(_0xf8d5('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0xf8d5('0x3'));var db=require('../../mysqldb')['db'];var dbH=require(_0xf8d5('0x4'))[_0xf8d5('0x5')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xf8d5('0x6')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x59c107,_0x5abb9f){var _0x2c1345={'status':_0x59c107};var _0x9379f6={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5abb9f){_0x2c1345[_0xf8d5('0x7')]=_0x5abb9f;}return db[_0xf8d5('0x8')]['update'](_0x2c1345,_0x9379f6);}function main(){var _0xf5b00=0x1388;var _0x1f8e78;logger[_0xf8d5('0x9')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xf8d5('0xa')));return db[_0xf8d5('0xb')][_0xf8d5('0xc')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf8d5('0xd'),'splitSizeCsv']})['then'](function(_0x301623){if(_0x301623){_0x1f8e78=_0x301623;_0xf5b00=_0x1f8e78[_0xf8d5('0xe')]||0x1388;}})[_0xf8d5('0xf')](function(){return dbH['sequelize'][_0xf8d5('0x10')](util[_0xf8d5('0x11')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0xf8d5('0x12')][_0xf8d5('0x13')]});})[_0xf8d5('0xf')](function(_0x2fa373){if(!_0x2fa373[0x0][_0xf8d5('0x14')]){return analyticExtractedReport(_0xf8d5('0x15'));}var _0x288370=[];var _0xe30b3d=0x0;if(_0x1f8e78[_0xf8d5('0xd')]){if(_0x2fa373&&_0x2fa373[_0xf8d5('0x16')]){var _0x3e3794=_[_0xf8d5('0x17')](_0x2fa373[0x0][_0xf8d5('0x14')]/_0xf5b00);var _0x34c0b2=Number[_0xf8d5('0x18')](_0x2fa373[0x0][_0xf8d5('0x14')]/_0xf5b00)?_0x2fa373[0x0][_0xf8d5('0x14')]%_0xf5b00:0x0;_0x3e3794[_0xf8d5('0x19')](function(_0x21ece3){if(_0x21ece3>0x0){_0xe30b3d+=_0xf5b00;}_0x288370[_0xf8d5('0x1a')](dbH[_0xf8d5('0x1b')]['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0xf5b00,_0xe30b3d),{'type':dbH['sequelize'][_0xf8d5('0x12')][_0xf8d5('0x13')]}));});if(_0x34c0b2>0x0){_0xe30b3d+=_0xf5b00;_0x288370[_0xf8d5('0x1a')](dbH[_0xf8d5('0x1b')]['query'](util[_0xf8d5('0x11')](_0xf8d5('0x1c'),QUERY,_0x34c0b2,_0xe30b3d),{'type':dbH[_0xf8d5('0x1b')]['QueryTypes'][_0xf8d5('0x13')]}));}}}else{_0x288370[_0xf8d5('0x1a')](dbH[_0xf8d5('0x1b')][_0xf8d5('0x10')](QUERY,{'type':dbH['sequelize'][_0xf8d5('0x12')][_0xf8d5('0x13')]}));}var _0x20f807=path[_0xf8d5('0x1d')](PATH);var _0x110a71=path[_0xf8d5('0x1e')](PATH,_0xf8d5('0x1f'));var _0x1a495f=_0x1f8e78['split']&&_0x288370[_0xf8d5('0x16')]>0x1;var _0x79c8c9=[];if(!fs['existsSync'](path[_0xf8d5('0x20')](_0x20f807,_0x110a71))&&_0x1a495f){fs['mkdirSync'](path[_0xf8d5('0x20')](_0x20f807,_0x110a71));}return BPromise[_0xf8d5('0x21')](_0x288370,function(_0x56979a){_0x79c8c9['push'](_0x56979a);})['then'](function(){for(var _0x239663=0x0;_0x239663<_0x79c8c9[_0xf8d5('0x16')];_0x239663+=0x1){var _0x37537d;var _0xacbaee=_0x79c8c9[_0x239663];if(_0x1a495f){_0x37537d=path[_0xf8d5('0x20')](_0x20f807,_0x110a71,util[_0xf8d5('0x11')](_0xf8d5('0x22'),_0x110a71,_0x239663,_0xf8d5('0x23')));}else{_0x37537d=path[_0xf8d5('0x20')](_0x20f807,util[_0xf8d5('0x11')](_0xf8d5('0x24'),_0x110a71,_0xf8d5('0x23')));}fs[_0xf8d5('0x25')](_0x37537d,csv(_0xacbaee));}})[_0xf8d5('0xf')](function(){if(_0x1a495f){return new Promise(function(_0x4e7dce){zipdir(path[_0xf8d5('0x20')](_0x20f807,_0x110a71),{'saveTo':path['join'](_0x20f807,util[_0xf8d5('0x11')]('%s.%s',_0x110a71,_0xf8d5('0x26')))},function(_0x3a05d7,_0x5c686b){rimraf(path[_0xf8d5('0x20')](_0x20f807,_0x110a71),function(){});_0x4e7dce(_0xf8d5('0x27'));});});}})['then'](function(){logger[_0xf8d5('0x9')](util[_0xf8d5('0x11')](_0xf8d5('0x28'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xf8d5('0x29'),_0x1a495f?util[_0xf8d5('0x11')](_0xf8d5('0x24'),_0x110a71,_0x1a495f?'zip':_0xf8d5('0x23')):null);});})[_0xf8d5('0x2a')](function(_0x31f5ef){logger[_0xf8d5('0x9')](util['format'](_0xf8d5('0x2b'),EXTRACTED_REPORT_ID,'CSV'),util[_0xf8d5('0x2c')](_0x31f5ef,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xf8d5('0x2d')](function(){process[_0xf8d5('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index badcc46..2f19fcd 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 _0x1544=['PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','channel','interactionId','Arial','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','createPdfFromHTML','catch','lodash','util','path','html-to-pdfmake','rimraf','jsdom','window','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','toString','value','fill','length','auto','body','concat','keys','push','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','header','pageBreak','before','margin','landscape','\x20/\x20','footer','black','right','num','Empty','find','splitSizePdf','then','split','range','isInteger','sequelize','query','QueryTypes','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.pdf','existsSync','join','each','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed'];(function(_0x425b19,_0x2dcf14){var _0x15ecab=function(_0x317d46){while(--_0x317d46){_0x425b19['push'](_0x425b19['shift']());}};_0x15ecab(++_0x2dcf14);}(_0x1544,0xd3));var _0x4154=function(_0x589eb4,_0xaa2019){_0x589eb4=_0x589eb4-0x0;var _0xf50816=_0x1544[_0x589eb4];return _0xf50816;};'use strict';var _=require(_0x4154('0x0'));var fs=require('fs');var util=require(_0x4154('0x1'));var path=require(_0x4154('0x2'));var moment=require('moment');var htmlToPdfmake=require(_0x4154('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require('zip-dir');var rimraf=require(_0x4154('0x4'));var JSDOM=require(_0x4154('0x5'))['JSDOM'];var window=new JSDOM('')[_0x4154('0x6')];var BPromise=require('bluebird');var db=require(_0x4154('0x7'))['db'];var dbH=require('../../mysqldb')[_0x4154('0x8')];var logger=require(_0x4154('0x9'))(_0x4154('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x4154('0xb')][0x2]);var QUERY=process[_0x4154('0xb')][0x3];var PATH=process[_0x4154('0xb')][0x4];var NAME=process[_0x4154('0xb')][0x5];var FORMAT=_0x4154('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x4f57a1,_0x3f3744){var _0x37868a={'status':_0x4f57a1};var _0x22a0ab={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3f3744){_0x37868a[_0x4154('0xd')]=_0x3f3744;}return db[_0x4154('0xe')][_0x4154('0xf')](_0x37868a,_0x22a0ab);}function getHeaders(_0x230575){return _[_0x4154('0x10')](_0x230575,function(_0x19501e){return{'text':_0x19501e,'style':_0x4154('0x11')};});}function getRows(_0x3e950c,_0x4afa28){return _['map'](_0x4afa28,function(_0x31f0b5){return _(_0x31f0b5)['pick'](_0x3e950c)['map'](function(_0x4cb228){return _0x4cb228?_[_0x4154('0x12')](_0x4cb228):'';})[_0x4154('0x13')]();});}function createTable(_0x40df24,_0x1401dd){var _0x2e2aef={'widths':_[_0x4154('0x14')](Array(_0x40df24[_0x4154('0x15')]),0x91),'heights':function(_0x35f2f4){return _0x35f2f4===0x0?_0x4154('0x16'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x4ae7f8=getHeaders(_0x40df24);_0x2e2aef[_0x4154('0x17')]['push'](_0x4ae7f8);var _0x1e52ae=getRows(_0x40df24,_0x1401dd);_0x2e2aef['body']=_0x2e2aef[_0x4154('0x17')][_0x4154('0x18')](_0x1e52ae);return _0x2e2aef;}function createTables(_0x2c5993){var _0x490be4=[];var _0x297a5d=_['chunk'](Object[_0x4154('0x19')](_0x2c5993[0x0]),0x5);_0x297a5d['forEach'](function(_0x278c17){_0x490be4[_0x4154('0x1a')](createTable(_0x278c17,_0x2c5993));});return _0x490be4;}function getPDFDocDefinition(_0x45801b){var _0x5d4f06=util[_0x4154('0x1b')](_0x4154('0x1c'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x4154('0x1d')])[_0x4154('0x1b')](FORMAT),moment(EXTRACTED_REPORT[_0x4154('0x1e')])[_0x4154('0x1b')](FORMAT));var _0x529e18=[];for(var _0x653583=0x0;_0x653583<_0x45801b['length'];_0x653583++){var _0x1eec69=[];if(_0x653583===0x0){_0x1eec69[_0x4154('0x1a')]({'text':_0x5d4f06,'style':_0x4154('0x1f')});}var _0x165394={'table':_0x45801b[_0x653583]};if(_0x653583>0x0){_0x165394[_0x4154('0x20')]=_0x4154('0x21');_0x165394[_0x4154('0x22')]=[0x0,0x46,0x0,0x0];}_0x1eec69[_0x4154('0x1a')](_0x165394);_0x529e18[_0x4154('0x1a')](_0x1eec69);}return{'pageSize':'A4','pageOrientation':_0x4154('0x23'),'content':_0x529e18,'footer':function(_0x30b9ab,_0x18210e){return{'text':_0x30b9ab[_0x4154('0x12')]()+_0x4154('0x24')+_0x18210e,'style':_0x4154('0x25')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x4154('0x26')},'footer':{'alignment':_0x4154('0x27'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x5b6fa2){var _0xbb573a=0x1388;var _0x3d8179;if(!_0x5b6fa2[0x0][_0x4154('0x28')]){return analyticExtractedReport(_0x4154('0x29'));}return db['Setting'][_0x4154('0x2a')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x4154('0x2b')]})[_0x4154('0x2c')](function(_0x46ea70){if(_0x46ea70){_0x3d8179=_0x46ea70;_0xbb573a=_0x3d8179[_0x4154('0x2b')]||0x3e8;}})['then'](function(){var _0xcf5d28=[];var _0x3822a6=0x0;if(_0x3d8179[_0x4154('0x2d')]){if(_0x5b6fa2&&_0x5b6fa2[_0x4154('0x15')]){var _0x54ef9a=_[_0x4154('0x2e')](_0x5b6fa2[0x0]['num']/_0xbb573a);var _0x19650b=Number[_0x4154('0x2f')](_0x5b6fa2[0x0]['num']/_0xbb573a)?_0x5b6fa2[0x0][_0x4154('0x28')]%_0xbb573a:0x0;_0x54ef9a['forEach'](function(_0x18907a){if(_0x18907a>0x0){_0x3822a6+=_0xbb573a;}_0xcf5d28[_0x4154('0x1a')](dbH[_0x4154('0x30')][_0x4154('0x31')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0xbb573a,_0x3822a6),{'type':dbH[_0x4154('0x30')][_0x4154('0x32')][_0x4154('0x33')]}));});if(_0x19650b>0x0){_0x3822a6+=_0xbb573a;_0xcf5d28['push'](dbH[_0x4154('0x30')][_0x4154('0x31')](util[_0x4154('0x1b')](_0x4154('0x34'),QUERY,_0x19650b,_0x3822a6),{'type':dbH[_0x4154('0x30')]['QueryTypes'][_0x4154('0x33')]}));}}}else{_0xcf5d28['push'](dbH[_0x4154('0x30')][_0x4154('0x31')](QUERY,{'type':dbH[_0x4154('0x30')][_0x4154('0x32')]['SELECT']}));}var _0x19cc28=path[_0x4154('0x35')](PATH);var _0x198a3a=path[_0x4154('0x36')](PATH,_0x4154('0x37'));var _0x494f66=_0x3d8179[_0x4154('0x2d')]&&_0xcf5d28[_0x4154('0x15')]>0x1;var _0x3d5d26=[];if(!fs[_0x4154('0x38')](path[_0x4154('0x39')](_0x19cc28,_0x198a3a))&&_0x494f66){fs['mkdirSync'](path[_0x4154('0x39')](_0x19cc28,_0x198a3a));}return BPromise[_0x4154('0x3a')](_0xcf5d28,function(_0x141a39){_0x3d5d26[_0x4154('0x1a')](_0x141a39);})['then'](function(){var _0x54261a=[];for(var _0x104162=0x0;_0x104162<_0x3d5d26[_0x4154('0x15')];_0x104162+=0x1){var _0x43cc18=_0x3d5d26[_0x104162];var _0x310079=createTables(_[_0x4154('0x3b')](_0x43cc18));var _0x580032;var _0x17468a=getPDFDocDefinition(_0x310079);var _0x4a3c44=getPDFPrinter();var _0x1887b=_0x4a3c44[_0x4154('0x3c')](_0x17468a);if(_0x494f66){_0x580032=path['join'](_0x19cc28,_0x198a3a,util[_0x4154('0x1b')](_0x4154('0x3d'),_0x198a3a,_0x104162,_0x4154('0x3e')));}else{_0x580032=path[_0x4154('0x39')](_0x19cc28,util[_0x4154('0x1b')](_0x4154('0x3f'),_0x198a3a,_0x4154('0x3e')));}_0x54261a[_0x4154('0x1a')](writePDFDocument(_0x1887b,_0x580032));}return Promise[_0x4154('0x40')](_0x54261a);})[_0x4154('0x2c')](function(){if(_0x494f66){return new Promise(function(_0x475ef4){zipdir(path[_0x4154('0x39')](_0x19cc28,_0x198a3a),{'saveTo':path['join'](_0x19cc28,util[_0x4154('0x1b')](_0x4154('0x3f'),_0x198a3a,'zip'))},function(){rimraf(path[_0x4154('0x39')](_0x19cc28,_0x198a3a),function(){});_0x475ef4(_0x4154('0x41'));});});}})[_0x4154('0x2c')](function(){if(!_0x494f66)return;rimraf(path[_0x4154('0x39')](_0x19cc28,_0x198a3a),function(){});})[_0x4154('0x2c')](function(){logger[_0x4154('0x42')](util['format'](_0x4154('0x43'),EXTRACTED_REPORT_ID,_0x4154('0x44')));return analyticExtractedReport(_0x4154('0x45'),_0x494f66?util['format'](_0x4154('0x3f'),_0x198a3a,_0x494f66?'zip':'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x4154('0x42')](util[_0x4154('0x1b')](_0x4154('0x46'),EXTRACTED_REPORT_ID,'PDF'));return db[_0x4154('0xe')][_0x4154('0x47')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x4154('0x2c')](function(_0x2eaed6){EXTRACTED_REPORT=_0x2eaed6;return dbH[_0x4154('0x30')][_0x4154('0x31')](util[_0x4154('0x1b')](_0x4154('0x48'),QUERY),{'type':dbH['sequelize'][_0x4154('0x32')][_0x4154('0x33')]});})[_0x4154('0x2c')](extractReport)['catch'](function(_0x20b9c2){logger[_0x4154('0x42')](util[_0x4154('0x1b')](_0x4154('0x49'),EXTRACTED_REPORT_ID,_0x4154('0x44')),util[_0x4154('0x4a')](_0x20b9c2,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x4154('0x4b'));})['finally'](function(){process[_0x4154('0x4c')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x361ea7=new PdfPrinter({'Arial':{'normal':__dirname+_0x4154('0x4d'),'bold':__dirname+_0x4154('0x4e'),'italics':__dirname+_0x4154('0x4f'),'bolditalics':__dirname+_0x4154('0x50')}});return _0x361ea7;}function getPDFDocDefinitionFromHTML(_0x48db0a,_0x12bd78){var _0x1ca0db=util[_0x4154('0x1b')]('%s\x20#%d',_0x12bd78[_0x4154('0x51')],_0x12bd78[_0x4154('0x52')]);var _0x26f6f3=moment()[_0x4154('0x1b')]('YYYY-MM-DD')[_0x4154('0x12')]();var _0x15225e=htmlToPdfmake(_0x48db0a,{'window':window,'tableAutoSize':!![]});return{'content':[_0x15225e],'defaultStyle':{'font':_0x4154('0x53')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x4154('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':_0x4154('0x54')}},'header':function(){return[{'text':_0x4154('0x55'),'style':'header'}];},'footer':function(_0x5adb98,_0x5920ec){return[{'text':util[_0x4154('0x1b')](_0x4154('0x56'),_0x1ca0db,_0x5adb98,_0x5920ec,_0x26f6f3),'style':_0x4154('0x25')}];}};}function writePDFDocument(_0x3d12d6,_0x1e3009){return new Promise(function(_0x2e826b,_0x50b552){var _0x5c387b=_0x3d12d6[_0x4154('0x57')](fs[_0x4154('0x58')](_0x1e3009));_0x5c387b['on'](_0x4154('0x59'),function(){_0x2e826b(_0x4154('0x59'));});_0x5c387b['on'](_0x4154('0x5a'),function(_0x2984aa){_0x50b552(_0x2984aa);});_0x3d12d6['end']();});}exports[_0x4154('0x5b')]=function(_0x5372fa,_0x1eb2bf){var _0x1e5961=getPDFPrinter();var _0x2884b4=getPDFDocDefinitionFromHTML(_0x5372fa,_0x1eb2bf);var _0x261c36=_0x1e5961[_0x4154('0x3c')](_0x2884b4);return writePDFDocument(_0x261c36,_0x1eb2bf[_0x4154('0x2')])[_0x4154('0x5c')](function(_0x1984ca){throw _0x1984ca;});}; \ No newline at end of file +var _0x09af=['landscape','\x20/\x20','Arial','right','num','Empty','Setting','find','split','splitSizePdf','range','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','%s.%s','pdf','all','then','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','interactionId','YYYY-MM-DD','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','createWriteStream','finish','end','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','jsdom','JSDOM','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','pick','toString','value','fill','length','auto','body','push','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','header','before','margin'];(function(_0x383028,_0x2fae0e){var _0xf358cc=function(_0x48f3bb){while(--_0x48f3bb){_0x383028['push'](_0x383028['shift']());}};_0xf358cc(++_0x2fae0e);}(_0x09af,0xee));var _0xf09a=function(_0x334748,_0x22a885){_0x334748=_0x334748-0x0;var _0x1b56c7=_0x09af[_0x334748];return _0x1b56c7;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0xf09a('0x0'));var path=require(_0xf09a('0x1'));var moment=require(_0xf09a('0x2'));var htmlToPdfmake=require(_0xf09a('0x3'));var PdfPrinter=require(_0xf09a('0x4'));var zipdir=require(_0xf09a('0x5'));var rimraf=require('rimraf');var JSDOM=require(_0xf09a('0x6'))[_0xf09a('0x7')];var window=new JSDOM('')['window'];var BPromise=require('bluebird');var db=require(_0xf09a('0x8'))['db'];var dbH=require(_0xf09a('0x8'))[_0xf09a('0x9')];var logger=require(_0xf09a('0xa'))(_0xf09a('0xb'));var EXTRACTED_REPORT_ID=Number(process[_0xf09a('0xc')][0x2]);var QUERY=process[_0xf09a('0xc')][0x3];var PATH=process[_0xf09a('0xc')][0x4];var NAME=process[_0xf09a('0xc')][0x5];var FORMAT=_0xf09a('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x593c30,_0x3bf8fd){var _0x2d12ad={'status':_0x593c30};var _0x4f71ae={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3bf8fd){_0x2d12ad[_0xf09a('0xe')]=_0x3bf8fd;}return db[_0xf09a('0xf')][_0xf09a('0x10')](_0x2d12ad,_0x4f71ae);}function getHeaders(_0xc9077a){return _[_0xf09a('0x11')](_0xc9077a,function(_0x2d7faa){return{'text':_0x2d7faa,'style':_0xf09a('0x12')};});}function getRows(_0x29b90f,_0x1ff4dc){return _[_0xf09a('0x11')](_0x1ff4dc,function(_0x2f9b8e){return _(_0x2f9b8e)[_0xf09a('0x13')](_0x29b90f)[_0xf09a('0x11')](function(_0x1233ee){return _0x1233ee?_[_0xf09a('0x14')](_0x1233ee):'';})[_0xf09a('0x15')]();});}function createTable(_0x51f57d,_0x6fa67b){var _0x3c8a85={'widths':_[_0xf09a('0x16')](Array(_0x51f57d[_0xf09a('0x17')]),0x91),'heights':function(_0x3882e6){return _0x3882e6===0x0?_0xf09a('0x18'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x3e0c53=getHeaders(_0x51f57d);_0x3c8a85[_0xf09a('0x19')][_0xf09a('0x1a')](_0x3e0c53);var _0x3cd3c0=getRows(_0x51f57d,_0x6fa67b);_0x3c8a85[_0xf09a('0x19')]=_0x3c8a85['body'][_0xf09a('0x1b')](_0x3cd3c0);return _0x3c8a85;}function createTables(_0x49e89c){var _0x4109fb=[];var _0x31e2a2=_[_0xf09a('0x1c')](Object[_0xf09a('0x1d')](_0x49e89c[0x0]),0x5);_0x31e2a2[_0xf09a('0x1e')](function(_0x568d46){_0x4109fb[_0xf09a('0x1a')](createTable(_0x568d46,_0x49e89c));});return _0x4109fb;}function getPDFDocDefinition(_0xc2d999){var _0x298349=util[_0xf09a('0x1f')](_0xf09a('0x20'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0xf09a('0x21')])[_0xf09a('0x1f')](FORMAT),moment(EXTRACTED_REPORT[_0xf09a('0x22')])[_0xf09a('0x1f')](FORMAT));var _0x56dc66=[];for(var _0x556268=0x0;_0x556268<_0xc2d999[_0xf09a('0x17')];_0x556268++){var _0x353155=[];if(_0x556268===0x0){_0x353155['push']({'text':_0x298349,'style':_0xf09a('0x23')});}var _0x408918={'table':_0xc2d999[_0x556268]};if(_0x556268>0x0){_0x408918['pageBreak']=_0xf09a('0x24');_0x408918[_0xf09a('0x25')]=[0x0,0x46,0x0,0x0];}_0x353155['push'](_0x408918);_0x56dc66[_0xf09a('0x1a')](_0x353155);}return{'pageSize':'A4','pageOrientation':_0xf09a('0x26'),'content':_0x56dc66,'footer':function(_0x4d748f,_0x267865){return{'text':_0x4d748f[_0xf09a('0x14')]()+_0xf09a('0x27')+_0x267865,'style':'footer'};},'defaultStyle':{'font':_0xf09a('0x28')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0xf09a('0x29'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x5d6823){var _0x304895=0x1388;var _0x527b12;if(!_0x5d6823[0x0][_0xf09a('0x2a')]){return analyticExtractedReport(_0xf09a('0x2b'));}return db[_0xf09a('0x2c')][_0xf09a('0x2d')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf09a('0x2e'),_0xf09a('0x2f')]})['then'](function(_0x1e9218){if(_0x1e9218){_0x527b12=_0x1e9218;_0x304895=_0x527b12[_0xf09a('0x2f')]||0x3e8;}})['then'](function(){var _0x2932ce=[];var _0x20123c=0x0;if(_0x527b12['split']){if(_0x5d6823&&_0x5d6823['length']){var _0x397589=_[_0xf09a('0x30')](_0x5d6823[0x0]['num']/_0x304895);var _0x42d8b2=Number[_0xf09a('0x31')](_0x5d6823[0x0][_0xf09a('0x2a')]/_0x304895)?_0x5d6823[0x0][_0xf09a('0x2a')]%_0x304895:0x0;_0x397589[_0xf09a('0x1e')](function(_0x226626){if(_0x226626>0x0){_0x20123c+=_0x304895;}_0x2932ce[_0xf09a('0x1a')](dbH[_0xf09a('0x32')][_0xf09a('0x33')](util[_0xf09a('0x1f')](_0xf09a('0x34'),QUERY,_0x304895,_0x20123c),{'type':dbH[_0xf09a('0x32')]['QueryTypes']['SELECT']}));});if(_0x42d8b2>0x0){_0x20123c+=_0x304895;_0x2932ce[_0xf09a('0x1a')](dbH[_0xf09a('0x32')][_0xf09a('0x33')](util[_0xf09a('0x1f')](_0xf09a('0x34'),QUERY,_0x42d8b2,_0x20123c),{'type':dbH[_0xf09a('0x32')][_0xf09a('0x35')][_0xf09a('0x36')]}));}}}else{_0x2932ce['push'](dbH[_0xf09a('0x32')][_0xf09a('0x33')](QUERY,{'type':dbH[_0xf09a('0x32')][_0xf09a('0x35')][_0xf09a('0x36')]}));}var _0x4581b8=path[_0xf09a('0x37')](PATH);var _0x110a4f=path[_0xf09a('0x38')](PATH,'.pdf');var _0x17498c=_0x527b12['split']&&_0x2932ce[_0xf09a('0x17')]>0x1;var _0x31bf90=[];if(!fs[_0xf09a('0x39')](path[_0xf09a('0x3a')](_0x4581b8,_0x110a4f))&&_0x17498c){fs[_0xf09a('0x3b')](path[_0xf09a('0x3a')](_0x4581b8,_0x110a4f));}return BPromise[_0xf09a('0x3c')](_0x2932ce,function(_0x2802e2){_0x31bf90['push'](_0x2802e2);})['then'](function(){var _0x5855a4=[];for(var _0x12cbbe=0x0;_0x12cbbe<_0x31bf90[_0xf09a('0x17')];_0x12cbbe+=0x1){var _0x179dcd=_0x31bf90[_0x12cbbe];var _0x4f8188=createTables(_[_0xf09a('0x3d')](_0x179dcd));var _0x396560;var _0x1c4360=getPDFDocDefinition(_0x4f8188);var _0x506fb4=getPDFPrinter();var _0x20c8c4=_0x506fb4[_0xf09a('0x3e')](_0x1c4360);if(_0x17498c){_0x396560=path[_0xf09a('0x3a')](_0x4581b8,_0x110a4f,util[_0xf09a('0x1f')]('%s%d.%s',_0x110a4f,_0x12cbbe,'pdf'));}else{_0x396560=path[_0xf09a('0x3a')](_0x4581b8,util[_0xf09a('0x1f')](_0xf09a('0x3f'),_0x110a4f,_0xf09a('0x40')));}_0x5855a4[_0xf09a('0x1a')](writePDFDocument(_0x20c8c4,_0x396560));}return Promise[_0xf09a('0x41')](_0x5855a4);})[_0xf09a('0x42')](function(){if(_0x17498c){return new Promise(function(_0x1c9b51){zipdir(path[_0xf09a('0x3a')](_0x4581b8,_0x110a4f),{'saveTo':path[_0xf09a('0x3a')](_0x4581b8,util[_0xf09a('0x1f')]('%s.%s',_0x110a4f,_0xf09a('0x43')))},function(){rimraf(path[_0xf09a('0x3a')](_0x4581b8,_0x110a4f),function(){});_0x1c9b51(_0xf09a('0x44'));});});}})[_0xf09a('0x42')](function(){if(!_0x17498c)return;rimraf(path[_0xf09a('0x3a')](_0x4581b8,_0x110a4f),function(){});})[_0xf09a('0x42')](function(){logger[_0xf09a('0x45')](util[_0xf09a('0x1f')](_0xf09a('0x46'),EXTRACTED_REPORT_ID,_0xf09a('0x47')));return analyticExtractedReport('Completed',_0x17498c?util[_0xf09a('0x1f')]('%s.%s',_0x110a4f,_0x17498c?_0xf09a('0x43'):_0xf09a('0x40')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0xf09a('0x1f')](_0xf09a('0x48'),EXTRACTED_REPORT_ID,_0xf09a('0x47')));return db[_0xf09a('0xf')][_0xf09a('0x49')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xf09a('0x42')](function(_0x4eacc5){EXTRACTED_REPORT=_0x4eacc5;return dbH[_0xf09a('0x32')][_0xf09a('0x33')](util[_0xf09a('0x1f')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0xf09a('0x35')][_0xf09a('0x36')]});})[_0xf09a('0x42')](extractReport)[_0xf09a('0x4a')](function(_0xa40692){logger[_0xf09a('0x45')](util['format'](_0xf09a('0x4b'),EXTRACTED_REPORT_ID,_0xf09a('0x47')),util[_0xf09a('0x4c')](_0xa40692,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xf09a('0x4d'));})[_0xf09a('0x4e')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x11666b=new PdfPrinter({'Arial':{'normal':__dirname+_0xf09a('0x4f'),'bold':__dirname+_0xf09a('0x50'),'italics':__dirname+_0xf09a('0x51'),'bolditalics':__dirname+_0xf09a('0x52')}});return _0x11666b;}function getPDFDocDefinitionFromHTML(_0x2e0ff7,_0x4c5759){var _0x4f3a0a=util[_0xf09a('0x1f')](_0xf09a('0x53'),_0x4c5759['channel'],_0x4c5759[_0xf09a('0x54')]);var _0x1e2d5e=moment()['format'](_0xf09a('0x55'))['toString']();var _0x146639=htmlToPdfmake(_0x2e0ff7,{'window':window,'tableAutoSize':!![]});return{'content':[_0x146639],'defaultStyle':{'font':_0xf09a('0x28')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xf09a('0x56'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0xf09a('0x23')}];},'footer':function(_0x26d3a7,_0x2100d6){return[{'text':util[_0xf09a('0x1f')](_0xf09a('0x57'),_0x4f3a0a,_0x26d3a7,_0x2100d6,_0x1e2d5e),'style':_0xf09a('0x58')}];}};}function writePDFDocument(_0xb1e854,_0x5846d3){return new Promise(function(_0x234f8b,_0x47f6b5){var _0x426f4a=_0xb1e854['pipe'](fs[_0xf09a('0x59')](_0x5846d3));_0x426f4a['on'](_0xf09a('0x5a'),function(){_0x234f8b('finish');});_0x426f4a['on']('error',function(_0x43bebf){_0x47f6b5(_0x43bebf);});_0xb1e854[_0xf09a('0x5b')]();});}exports['createPdfFromHTML']=function(_0x2077bd,_0x59af2b){var _0x2681fb=getPDFPrinter();var _0x2d9ade=getPDFDocDefinitionFromHTML(_0x2077bd,_0x59af2b);var _0x3f3c5d=_0x2681fb['createPdfKitDocument'](_0x2d9ade);return writePDFDocument(_0x3f3c5d,_0x59af2b['path'])[_0xf09a('0x4a')](function(_0x3db39d){throw _0x3db39d;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 4bd283d..972a67b 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 _0xe672=['query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','Empty','length','range','num','forEach','SELECT','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','existsSync','join','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','inspect','finally','util','lodash','json2xls','bluebird','zip-dir','rimraf','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize'];(function(_0x3c30a1,_0x1c3886){var _0x3e8bf5=function(_0x1c7d4e){while(--_0x1c7d4e){_0x3c30a1['push'](_0x3c30a1['shift']());}};_0x3e8bf5(++_0x1c3886);}(_0xe672,0x1e4));var _0x2e67=function(_0x3eada7,_0x110eca){_0x3eada7=_0x3eada7-0x0;var _0x147048=_0xe672[_0x3eada7];return _0x147048;};'use strict';var util=require(_0x2e67('0x0'));var path=require('path');var _=require(_0x2e67('0x1'));var fs=require('fs');var json2xls=require(_0x2e67('0x2'));var BPromise=require(_0x2e67('0x3'));var zipdir=require(_0x2e67('0x4'));var rimraf=require(_0x2e67('0x5'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0x2e67('0x6')];var logger=require(_0x2e67('0x7'))(_0x2e67('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x2e67('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x37dc36,_0x1d2188){var _0x25ebe1={'status':_0x37dc36};var _0x2b60df={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1d2188){_0x25ebe1['savename']=_0x1d2188;}return db[_0x2e67('0xa')][_0x2e67('0xb')](_0x25ebe1,_0x2b60df);}function main(){var _0x42793d=0x1388;var _0x11922e;logger[_0x2e67('0xc')](util[_0x2e67('0xd')](_0x2e67('0xe'),EXTRACTED_REPORT_ID,_0x2e67('0xf')));return db[_0x2e67('0x10')][_0x2e67('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x2e67('0x12'),_0x2e67('0x13')]})['then'](function(_0x5d41dd){if(_0x5d41dd){_0x11922e=_0x5d41dd;_0x42793d=_0x11922e[_0x2e67('0x13')]||0x1388;}})[_0x2e67('0x14')](function(){return dbH[_0x2e67('0x15')][_0x2e67('0x16')](util[_0x2e67('0xd')](_0x2e67('0x17'),QUERY),{'type':dbH[_0x2e67('0x15')][_0x2e67('0x18')]['SELECT']});})['then'](function(_0x31e75e){if(!_0x31e75e[0x0]['num']){return analyticExtractedReport(_0x2e67('0x19'));}var _0x55d14f=[];var _0x56284d=0x0;if(_0x11922e[_0x2e67('0x12')]){if(_0x31e75e&&_0x31e75e[_0x2e67('0x1a')]){var _0x3e9ded=_[_0x2e67('0x1b')](_0x31e75e[0x0]['num']/_0x42793d);var _0x22f740=Number['isInteger'](_0x31e75e[0x0]['num']/_0x42793d)?_0x31e75e[0x0][_0x2e67('0x1c')]%_0x42793d:0x0;_0x3e9ded[_0x2e67('0x1d')](function(_0x4468b4){if(_0x4468b4>0x0){_0x56284d+=_0x42793d;}_0x55d14f['push'](dbH['sequelize']['query'](util[_0x2e67('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x42793d,_0x56284d),{'type':dbH[_0x2e67('0x15')][_0x2e67('0x18')][_0x2e67('0x1e')]}));});if(_0x22f740>0x0){_0x56284d+=_0x42793d;_0x55d14f[_0x2e67('0x1f')](dbH[_0x2e67('0x15')][_0x2e67('0x16')](util[_0x2e67('0xd')](_0x2e67('0x20'),QUERY,_0x22f740,_0x56284d),{'type':dbH[_0x2e67('0x15')][_0x2e67('0x18')][_0x2e67('0x1e')]}));}}}else{_0x55d14f[_0x2e67('0x1f')](dbH[_0x2e67('0x15')][_0x2e67('0x16')](QUERY,{'type':dbH[_0x2e67('0x15')][_0x2e67('0x18')][_0x2e67('0x1e')]}));}var _0x2aaff8=path['dirname'](PATH);var _0x39d404=path[_0x2e67('0x21')](PATH,'.xlsx');var _0x3ab670=_0x11922e[_0x2e67('0x12')]&&_0x55d14f[_0x2e67('0x1a')]>0x1;var _0x59dc89=[];if(!fs[_0x2e67('0x22')](path[_0x2e67('0x23')](_0x2aaff8,_0x39d404))&&_0x3ab670){fs['mkdirSync'](path[_0x2e67('0x23')](_0x2aaff8,_0x39d404));}return BPromise['each'](_0x55d14f,function(_0xac38fe){_0x59dc89[_0x2e67('0x1f')](_0xac38fe);})[_0x2e67('0x14')](function(){for(var _0x40a5d0=0x0;_0x40a5d0<_0x59dc89[_0x2e67('0x1a')];_0x40a5d0+=0x1){var _0x4b916f;var _0x271dc3=_0x59dc89[_0x40a5d0];if(_0x3ab670){_0x4b916f=path[_0x2e67('0x23')](_0x2aaff8,_0x39d404,util[_0x2e67('0xd')](_0x2e67('0x24'),_0x39d404,_0x40a5d0,_0x2e67('0x25')));}else{_0x4b916f=path[_0x2e67('0x23')](_0x2aaff8,util[_0x2e67('0xd')](_0x2e67('0x26'),_0x39d404,_0x2e67('0x25')));}fs[_0x2e67('0x27')](_0x4b916f,json2xls(_0x271dc3),_0x2e67('0x28'));}})[_0x2e67('0x14')](function(){if(_0x3ab670){return new Promise(function(_0x4749cc){zipdir(path[_0x2e67('0x23')](_0x2aaff8,_0x39d404),{'saveTo':path[_0x2e67('0x23')](_0x2aaff8,util[_0x2e67('0xd')](_0x2e67('0x26'),_0x39d404,_0x2e67('0x29')))},function(_0x3d96a7,_0x5558fd){rimraf(path[_0x2e67('0x23')](_0x2aaff8,_0x39d404),function(){});_0x4749cc('zip\x20finished');});});}})[_0x2e67('0x14')](function(){logger[_0x2e67('0xc')](util[_0x2e67('0xd')](_0x2e67('0x2a'),EXTRACTED_REPORT_ID,_0x2e67('0xf')));return analyticExtractedReport(_0x2e67('0x2b'),_0x3ab670?util[_0x2e67('0xd')](_0x2e67('0x26'),_0x39d404,_0x3ab670?_0x2e67('0x29'):_0x2e67('0x25')):null);});})['catch'](function(_0x33eddf){logger[_0x2e67('0xc')](util[_0x2e67('0xd')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x2e67('0xf')),util[_0x2e67('0x2c')](_0x33eddf,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x2e67('0x2d')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0xe458=['finally','exit','util','path','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','splitSizeXlsx','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','split','length','range','isInteger','push','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.xlsx','existsSync','join','mkdirSync','%s%d.%s','xlsx','%s.%s','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed'];(function(_0x191154,_0x56f74c){var _0x3dcd73=function(_0x51c321){while(--_0x51c321){_0x191154['push'](_0x191154['shift']());}};_0x3dcd73(++_0x56f74c);}(_0xe458,0x160));var _0x8e45=function(_0x35e3ea,_0x25ea49){_0x35e3ea=_0x35e3ea-0x0;var _0xbd593e=_0xe458[_0x35e3ea];return _0xbd593e;};'use strict';var util=require(_0x8e45('0x0'));var path=require(_0x8e45('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0x8e45('0x2'));var BPromise=require(_0x8e45('0x3'));var zipdir=require(_0x8e45('0x4'));var rimraf=require(_0x8e45('0x5'));var db=require(_0x8e45('0x6'))['db'];var dbH=require(_0x8e45('0x6'))[_0x8e45('0x7')];var logger=require(_0x8e45('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x8e45('0x9')][0x3];var PATH=process[_0x8e45('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3a646f,_0x37cde4){var _0x27433a={'status':_0x3a646f};var _0x1f60da={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x37cde4){_0x27433a[_0x8e45('0xa')]=_0x37cde4;}return db['AnalyticExtractedReport']['update'](_0x27433a,_0x1f60da);}function main(){var _0x4a23d8=0x1388;var _0x5e442b;logger[_0x8e45('0xb')](util[_0x8e45('0xc')](_0x8e45('0xd'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0x8e45('0xe')][_0x8e45('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x8e45('0x10')]})[_0x8e45('0x11')](function(_0x49e36b){if(_0x49e36b){_0x5e442b=_0x49e36b;_0x4a23d8=_0x5e442b[_0x8e45('0x10')]||0x1388;}})[_0x8e45('0x11')](function(){return dbH['sequelize'][_0x8e45('0x12')](util[_0x8e45('0xc')](_0x8e45('0x13'),QUERY),{'type':dbH['sequelize'][_0x8e45('0x14')][_0x8e45('0x15')]});})[_0x8e45('0x11')](function(_0x4310ed){if(!_0x4310ed[0x0][_0x8e45('0x16')]){return analyticExtractedReport(_0x8e45('0x17'));}var _0x46a39b=[];var _0x2e1eeb=0x0;if(_0x5e442b[_0x8e45('0x18')]){if(_0x4310ed&&_0x4310ed[_0x8e45('0x19')]){var _0x3e8be2=_[_0x8e45('0x1a')](_0x4310ed[0x0][_0x8e45('0x16')]/_0x4a23d8);var _0x3521ff=Number[_0x8e45('0x1b')](_0x4310ed[0x0][_0x8e45('0x16')]/_0x4a23d8)?_0x4310ed[0x0][_0x8e45('0x16')]%_0x4a23d8:0x0;_0x3e8be2['forEach'](function(_0xdd2b81){if(_0xdd2b81>0x0){_0x2e1eeb+=_0x4a23d8;}_0x46a39b[_0x8e45('0x1c')](dbH[_0x8e45('0x1d')][_0x8e45('0x12')](util[_0x8e45('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x4a23d8,_0x2e1eeb),{'type':dbH[_0x8e45('0x1d')][_0x8e45('0x14')][_0x8e45('0x15')]}));});if(_0x3521ff>0x0){_0x2e1eeb+=_0x4a23d8;_0x46a39b[_0x8e45('0x1c')](dbH['sequelize'][_0x8e45('0x12')](util['format'](_0x8e45('0x1e'),QUERY,_0x3521ff,_0x2e1eeb),{'type':dbH[_0x8e45('0x1d')][_0x8e45('0x14')][_0x8e45('0x15')]}));}}}else{_0x46a39b[_0x8e45('0x1c')](dbH[_0x8e45('0x1d')][_0x8e45('0x12')](QUERY,{'type':dbH[_0x8e45('0x1d')][_0x8e45('0x14')][_0x8e45('0x15')]}));}var _0x46d0f0=path[_0x8e45('0x1f')](PATH);var _0x224695=path['basename'](PATH,_0x8e45('0x20'));var _0x1fbc5b=_0x5e442b[_0x8e45('0x18')]&&_0x46a39b[_0x8e45('0x19')]>0x1;var _0x33f40b=[];if(!fs[_0x8e45('0x21')](path[_0x8e45('0x22')](_0x46d0f0,_0x224695))&&_0x1fbc5b){fs[_0x8e45('0x23')](path[_0x8e45('0x22')](_0x46d0f0,_0x224695));}return BPromise['each'](_0x46a39b,function(_0x4306cc){_0x33f40b['push'](_0x4306cc);})[_0x8e45('0x11')](function(){for(var _0x30b004=0x0;_0x30b004<_0x33f40b['length'];_0x30b004+=0x1){var _0x185021;var _0x46792a=_0x33f40b[_0x30b004];if(_0x1fbc5b){_0x185021=path[_0x8e45('0x22')](_0x46d0f0,_0x224695,util[_0x8e45('0xc')](_0x8e45('0x24'),_0x224695,_0x30b004,_0x8e45('0x25')));}else{_0x185021=path['join'](_0x46d0f0,util[_0x8e45('0xc')](_0x8e45('0x26'),_0x224695,'xlsx'));}fs['writeFileSync'](_0x185021,json2xls(_0x46792a),_0x8e45('0x27'));}})['then'](function(){if(_0x1fbc5b){return new Promise(function(_0x59de90){zipdir(path['join'](_0x46d0f0,_0x224695),{'saveTo':path['join'](_0x46d0f0,util[_0x8e45('0xc')]('%s.%s',_0x224695,_0x8e45('0x28')))},function(_0x35214c,_0x1d49eb){rimraf(path[_0x8e45('0x22')](_0x46d0f0,_0x224695),function(){});_0x59de90(_0x8e45('0x29'));});});}})[_0x8e45('0x11')](function(){logger[_0x8e45('0xb')](util[_0x8e45('0xc')](_0x8e45('0x2a'),EXTRACTED_REPORT_ID,_0x8e45('0x2b')));return analyticExtractedReport(_0x8e45('0x2c'),_0x1fbc5b?util['format'](_0x8e45('0x26'),_0x224695,_0x1fbc5b?_0x8e45('0x28'):_0x8e45('0x25')):null);});})['catch'](function(_0x1375ec){logger[_0x8e45('0xb')](util[_0x8e45('0xc')](_0x8e45('0x2d'),EXTRACTED_REPORT_ID,_0x8e45('0x2b')),util[_0x8e45('0x2e')](_0x1375ec,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x8e45('0x2f'));})[_0x8e45('0x30')](function(){process[_0x8e45('0x31')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 4fc3b8b..32d98a5 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 _0xe57b=['error','rewrite','lodash','models','Interval','findAll','IntervalId','VoiceExtension','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','then','filter','groupBy','queue','hasOwnProperty','priority','extension','find','extensions','push','Set','CDR(type)=%s','type','context','VoiceExtensionId','inbound','CDR(routeid)=','outbound','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','app','appType','answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','sortBy','catch'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xe57b,0xdd));var _0xbe57=function(_0x3d98c7,_0x5017c6){_0x3d98c7=_0x3d98c7-0x0;var _0x2d08f6=_0xe57b[_0x3d98c7];return _0x2d08f6;};'use strict';var _=require(_0xbe57('0x0'));var util=require('util');function rewrite(_0x11eb32,_0x1fc276){var _0x3b75e1=this;return _0x11eb32[_0xbe57('0x1')][_0xbe57('0x2')][_0xbe57('0x3')]({'raw':!![]})['then'](function(_0x59186b){_0x3b75e1['intervals']=_0x59186b;return _0x11eb32[_0xbe57('0x1')]['VoiceExtension'][_0xbe57('0x3')]({'where':{'IntervalId':_0x1fc276[_0xbe57('0x4')]},'raw':!![]});})['then'](function(_0x52273c){return _0x11eb32[_0xbe57('0x1')][_0xbe57('0x5')][_0xbe57('0x3')]({'where':{'exten':{'$in':_[_0xbe57('0x6')](_[_0xbe57('0x7')](_0x52273c,_0xbe57('0x8')))}},'order':[{'raw':_0xbe57('0x9')}],'raw':!![]});})[_0xbe57('0xa')](function(_0x24d593){var _0x138e7f=_[_0xbe57('0xb')](_0x24d593,{'priority':'1'});var _0x273181=_[_0xbe57('0xb')](_0x24d593,{'isApp':0x1});var _0x4f5460=_[_0xbe57('0xc')](_0x273181,_0xbe57('0x8'));var _0x4d3323=[_0xbe57('0xd'),'playback'];var _0x259509=[];var _0x4a81a4=[];for(var _0xebdc86 in _0x4f5460){if(_0x4f5460[_0xbe57('0xe')](_0xebdc86)){_0x3b75e1[_0xbe57('0xf')]=0x2;_0x3b75e1['extensions']=[];_0x3b75e1[_0xbe57('0x10')]=_[_0xbe57('0x11')](_0x138e7f,{'exten':_0x4f5460[_0xebdc86][0x0][_0xbe57('0x8')]});_0x3b75e1[_0xbe57('0x12')][_0xbe57('0x13')]({'type':_0x4f5460[_0xebdc86][0x0]['type'],'app':_0xbe57('0x14'),'appdata':util['format'](_0xbe57('0x15'),_0x4f5460[_0xebdc86][0x0][_0xbe57('0x16')]),'context':_0x4f5460[_0xebdc86][0x0][_0xbe57('0x17')],'exten':_0x4f5460[_0xebdc86][0x0][_0xbe57('0x8')],'priority':_0x3b75e1[_0xbe57('0xf')]++,'VoiceExtensionId':_0x4f5460[_0xebdc86][0x0][_0xbe57('0x18')]});if(_0x4f5460[_0xebdc86][0x0][_0xbe57('0x16')]===_0xbe57('0x19')){_0x3b75e1[_0xbe57('0x12')][_0xbe57('0x13')]({'type':_0x4f5460[_0xebdc86][0x0][_0xbe57('0x16')],'app':_0xbe57('0x14'),'appdata':_0xbe57('0x1a')+_0x4f5460[_0xebdc86][0x0][_0xbe57('0x18')],'context':_0x4f5460[_0xebdc86][0x0][_0xbe57('0x17')],'exten':_0x4f5460[_0xebdc86][0x0][_0xbe57('0x8')],'priority':_0x3b75e1[_0xbe57('0xf')]++,'VoiceExtensionId':_0x4f5460[_0xebdc86][0x0][_0xbe57('0x18')]});}else if(_0x4f5460[_0xebdc86][0x0][_0xbe57('0x16')]===_0xbe57('0x1b')){if(_0x3b75e1[_0xbe57('0x10')]){_0x3b75e1[_0xbe57('0x12')][_0xbe57('0x13')]({'type':_0x4f5460[_0xebdc86][0x0][_0xbe57('0x16')],'app':_0xbe57('0x14'),'appdata':_0xbe57('0x1c')+(_0x3b75e1[_0xbe57('0x10')]['cutdigits']?_0xbe57('0x1d')+_0x3b75e1[_0xbe57('0x10')][_0xbe57('0x1e')]+'}':_0xbe57('0x1f')),'context':_0x4f5460[_0xebdc86][0x0][_0xbe57('0x17')],'exten':_0x4f5460[_0xebdc86][0x0][_0xbe57('0x8')],'priority':_0x3b75e1[_0xbe57('0xf')]++,'VoiceExtensionId':_0x4f5460[_0xebdc86][0x0][_0xbe57('0x18')]});}_0x3b75e1[_0xbe57('0x12')][_0xbe57('0x13')]({'type':_0x4f5460[_0xebdc86][0x0][_0xbe57('0x16')],'app':_0xbe57('0x14'),'appdata':_0xbe57('0x1a')+_0x4f5460[_0xebdc86][0x0]['VoiceExtensionId'],'context':_0x4f5460[_0xebdc86][0x0][_0xbe57('0x17')],'exten':_0x4f5460[_0xebdc86][0x0][_0xbe57('0x8')],'priority':_0x3b75e1[_0xbe57('0xf')]++,'VoiceExtensionId':_0x4f5460[_0xebdc86][0x0][_0xbe57('0x18')]});var _0x101b3a=_0x3b75e1[_0xbe57('0xf')]++;_0x3b75e1[_0xbe57('0x12')][_0xbe57('0x13')]({'type':_0x4f5460[_0xebdc86][0x0][_0xbe57('0x16')],'app':_0xbe57('0x20'),'appdata':_0xbe57('0x21')+(_0x101b3a+0x2)+_0xbe57('0x22')+(_0x101b3a+0x1)+')','context':_0x4f5460[_0xebdc86][0x0][_0xbe57('0x17')],'exten':_0x4f5460[_0xebdc86][0x0]['exten'],'priority':_0x101b3a,'VoiceExtensionId':_0x4f5460[_0xebdc86][0x0][_0xbe57('0x18')]});if(_0x3b75e1[_0xbe57('0x10')]){_0x3b75e1[_0xbe57('0x12')]['push']({'type':_0x4f5460[_0xebdc86][0x0][_0xbe57('0x16')],'app':_0xbe57('0x14'),'appdata':_0x3b75e1[_0xbe57('0x10')][_0xbe57('0x1e')]?_0xbe57('0x23')+_0x3b75e1[_0xbe57('0x10')][_0xbe57('0x1e')]+'}':_0xbe57('0x24'),'context':_0x4f5460[_0xebdc86][0x0][_0xbe57('0x17')],'exten':_0x4f5460[_0xebdc86][0x0][_0xbe57('0x8')],'priority':_0x3b75e1['priority']++,'VoiceExtensionId':_0x4f5460[_0xebdc86][0x0]['VoiceExtensionId']});}_0x3b75e1[_0xbe57('0x12')]['push']({'type':_0x4f5460[_0xebdc86][0x0][_0xbe57('0x16')],'app':_0xbe57('0x14'),'appdata':_0xbe57('0x25')+_0x4f5460[_0xebdc86][0x0]['VoiceExtensionId'],'context':_0x4f5460[_0xebdc86][0x0][_0xbe57('0x17')],'exten':_0x4f5460[_0xebdc86][0x0][_0xbe57('0x8')],'priority':_0x3b75e1[_0xbe57('0xf')]++,'VoiceExtensionId':_0x4f5460[_0xebdc86][0x0][_0xbe57('0x18')]});if(_0x3b75e1[_0xbe57('0x10')]&&_0x3b75e1[_0xbe57('0x10')][_0xbe57('0xe')](_0xbe57('0x26'))&&_0x3b75e1['extension']['recordingFormat']!==_0xbe57('0x27')){_0x3b75e1[_0xbe57('0x12')]['push']({'type':_0x4f5460[_0xebdc86][0x0]['type'],'app':_0xbe57('0x14'),'appdata':_0xbe57('0x28'),'context':_0x4f5460[_0xebdc86][0x0][_0xbe57('0x17')],'exten':_0x4f5460[_0xebdc86][0x0][_0xbe57('0x8')],'priority':_0x3b75e1['priority']++,'VoiceExtensionId':_0x4f5460[_0xebdc86][0x0]['VoiceExtensionId']});_0x3b75e1['extensions'][_0xbe57('0x13')]({'type':_0x4f5460[_0xebdc86][0x0][_0xbe57('0x16')],'app':_0xbe57('0x14'),'appdata':_0xbe57('0x29')+_0x3b75e1[_0xbe57('0x10')][_0xbe57('0x26')]||_0xbe57('0x2a'),'context':_0x4f5460[_0xebdc86][0x0][_0xbe57('0x17')],'exten':_0x4f5460[_0xebdc86][0x0][_0xbe57('0x8')],'priority':_0x3b75e1[_0xbe57('0xf')]++,'VoiceExtensionId':_0x4f5460[_0xebdc86][0x0][_0xbe57('0x18')]});}}_0x3b75e1[_0xbe57('0x12')][_0xbe57('0x13')]({'type':_0x4f5460[_0xebdc86][0x0]['type'],'app':'Set','appdata':_0xbe57('0x2b'),'context':_0x4f5460[_0xebdc86][0x0]['context'],'exten':_0x4f5460[_0xebdc86][0x0]['exten'],'priority':_0x3b75e1[_0xbe57('0xf')]++,'VoiceExtensionId':_0x4f5460[_0xebdc86][0x0][_0xbe57('0x18')]});_0x3b75e1[_0xbe57('0x12')][_0xbe57('0x13')]({'type':_0x4f5460[_0xebdc86][0x0][_0xbe57('0x16')],'app':_0xbe57('0x14'),'appdata':_0xbe57('0x2c'),'context':_0x4f5460[_0xebdc86][0x0][_0xbe57('0x17')],'exten':_0x4f5460[_0xebdc86][0x0]['exten'],'priority':_0x3b75e1['priority']++,'VoiceExtensionId':_0x4f5460[_0xebdc86][0x0][_0xbe57('0x18')]});_0x3b75e1[_0xbe57('0x12')]['push']({'type':_0x4f5460[_0xebdc86][0x0][_0xbe57('0x16')],'app':_0xbe57('0x14'),'appdata':_0xbe57('0x2d'),'context':_0x4f5460[_0xebdc86][0x0]['context'],'exten':_0x4f5460[_0xebdc86][0x0][_0xbe57('0x8')],'priority':_0x3b75e1[_0xbe57('0xf')]++,'VoiceExtensionId':_0x4f5460[_0xebdc86][0x0]['VoiceExtensionId']});for(var _0x116627=0x0,_0x1a11de=0x0;_0x116627<_0x4f5460[_0xebdc86][_0xbe57('0x2e')];_0x116627+=0x1,_0x1a11de=0x0){var _0x47fe9e=_0x4f5460[_0xebdc86][_0x116627];if(_0x47fe9e[_0xbe57('0x16')]){_0x47fe9e[_0xbe57('0x16')]=_0x47fe9e[_0xbe57('0x16')][_0xbe57('0x2f')]();}var _0x13251e=[];var _0x120702=[];delete _0x47fe9e['id'];delete _0x47fe9e[_0xbe57('0x30')];delete _0x47fe9e[_0xbe57('0x31')];var _0x3750e5=_0x47fe9e[_0xbe57('0x32')]!==_0xbe57('0x33')?[_0x47fe9e[_0xbe57('0x32')]]:_0x47fe9e[_0xbe57('0x4')]?_[_0xbe57('0x7')](_['filter'](_0x3b75e1['intervals'],{'IntervalId':_0x47fe9e[_0xbe57('0x4')]}),'interval'):[];if(_0x47fe9e[_0xbe57('0xe')](_0xbe57('0x34'))){if(_0x47fe9e['tag']&&_0x47fe9e[_0xbe57('0x34')]!=='--'){_0x13251e[_0xbe57('0x13')]({'type':_0x47fe9e['type'],'app':_0xbe57('0x14'),'appdata':'CDR(tag)='+_0x47fe9e['tag'],'context':_0x47fe9e[_0xbe57('0x17')],'exten':_0x47fe9e[_0xbe57('0x8')],'priority':_0x3750e5['length']+_0x3b75e1['priority']+_0x1a11de++,'VoiceExtensionId':_0x47fe9e[_0xbe57('0x18')]});}}if(_0x47fe9e['type']==='outbound'&&_0x47fe9e[_0xbe57('0xe')](_0xbe57('0x35'))){if(_0x47fe9e[_0xbe57('0x35')]){_0x13251e[_0xbe57('0x13')]({'type':_0x47fe9e['type'],'app':_0xbe57('0x20'),'appdata':_0xbe57('0x36')+_0x47fe9e[_0xbe57('0x35')]+')','context':_0x47fe9e[_0xbe57('0x17')],'exten':_0x47fe9e[_0xbe57('0x8')],'priority':_0x3750e5['length']+_0x3b75e1[_0xbe57('0xf')]+_0x1a11de++,'VoiceExtensionId':_0x47fe9e[_0xbe57('0x18')]});}else{_0x13251e['push']({'type':_0x47fe9e[_0xbe57('0x16')],'app':'ExecIf','appdata':_0xbe57('0x37'),'context':_0x47fe9e[_0xbe57('0x17')],'exten':_0x47fe9e[_0xbe57('0x8')],'priority':_0x3750e5[_0xbe57('0x2e')]+_0x3b75e1['priority']+_0x1a11de++,'VoiceExtensionId':_0x47fe9e[_0xbe57('0x18')]});}}if(_0x47fe9e[_0xbe57('0xe')]('answer')){if(_0x4d3323[_0xbe57('0x38')](_0x47fe9e[_0xbe57('0x39')][_0xbe57('0x2f')]())>=0x0&&_0x47fe9e[_0xbe57('0x3a')]!=='custom'){if(_0x47fe9e[_0xbe57('0x3b')]){_0x13251e[_0xbe57('0x13')]({'type':_0x47fe9e[_0xbe57('0x16')],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x47fe9e['context'],'exten':_0x47fe9e[_0xbe57('0x8')],'priority':_0x3750e5[_0xbe57('0x2e')]+_0x3b75e1[_0xbe57('0xf')]+_0x1a11de++,'VoiceExtensionId':_0x47fe9e['VoiceExtensionId']});_0x13251e[_0xbe57('0x13')]({'type':_0x47fe9e[_0xbe57('0x16')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x47fe9e['context'],'exten':_0x47fe9e['exten'],'priority':_0x3750e5[_0xbe57('0x2e')]+_0x3b75e1[_0xbe57('0xf')]+_0x1a11de++,'VoiceExtensionId':_0x47fe9e[_0xbe57('0x18')]});}else{_0x13251e[_0xbe57('0x13')]({'type':_0x47fe9e[_0xbe57('0x16')],'app':_0xbe57('0x20'),'appdata':_0xbe57('0x3c'),'context':_0x47fe9e['context'],'exten':_0x47fe9e[_0xbe57('0x8')],'priority':_0x3750e5[_0xbe57('0x2e')]+_0x3b75e1[_0xbe57('0xf')]+_0x1a11de++,'VoiceExtensionId':_0x47fe9e[_0xbe57('0x18')]});_0x13251e['push']({'type':_0x47fe9e[_0xbe57('0x16')],'app':_0xbe57('0x14'),'appdata':_0xbe57('0x3d'),'context':_0x47fe9e[_0xbe57('0x17')],'exten':_0x47fe9e[_0xbe57('0x8')],'priority':_0x3750e5[_0xbe57('0x2e')]+_0x3b75e1[_0xbe57('0xf')]+_0x1a11de++,'VoiceExtensionId':_0x47fe9e['VoiceExtensionId']});}}}for(var _0x4bc7e8=0x0;_0x4bc7e8<_0x3750e5['length'];_0x4bc7e8+=0x1){var _0x45e791=_0x3b75e1[_0xbe57('0xf')]+_0x3750e5[_0xbe57('0x2e')];var _0x531e99=_0x4bc7e8===_0x3750e5[_0xbe57('0x2e')]-0x1?_0x3b75e1[_0xbe57('0xf')]+_0x13251e[_0xbe57('0x2e')]+_0x120702['length']+0x2:_0x3b75e1['priority']+_0x4bc7e8+0x1;_0x13251e['splice'](_0x4bc7e8,0x0,{'type':_0x47fe9e[_0xbe57('0x16')],'app':_0xbe57('0x3e'),'appdata':_0x3750e5[_0x4bc7e8]+'?'+_0x47fe9e[_0xbe57('0x17')]+_0xbe57('0x3f')+_0x45e791+':'+_0x47fe9e[_0xbe57('0x17')]+_0xbe57('0x3f')+_0x531e99,'exten':_0x47fe9e[_0xbe57('0x8')],'context':_0x47fe9e[_0xbe57('0x17')],'priority':_0x3b75e1['priority']+_0x4bc7e8,'VoiceExtensionId':_0x4f5460[_0xebdc86][0x0]['VoiceExtensionId']});}_0x47fe9e[_0xbe57('0xf')]=_0x13251e[_0xbe57('0x2e')]?_[_0xbe57('0x40')](_0x13251e)[_0xbe57('0xf')]+0x1:_0x3b75e1['priority'];_0x3b75e1[_0xbe57('0xf')]=(_0x120702[_0xbe57('0x2e')]?_[_0xbe57('0x40')](_0x120702)['priority']:_0x47fe9e[_0xbe57('0xf')])+0x1;_0x3b75e1['extensions']=_[_0xbe57('0x41')](_0x3b75e1[_0xbe57('0x12')],_0x13251e,[_0x47fe9e],_0x120702);}_0x3b75e1[_0xbe57('0x12')][_0xbe57('0x13')]({'type':_0x4f5460[_0xebdc86][0x0][_0xbe57('0x16')],'app':_0xbe57('0x42'),'exten':_0x4f5460[_0xebdc86][0x0][_0xbe57('0x8')],'context':_0x4f5460[_0xebdc86][0x0]['context'],'priority':_0x3b75e1[_0xbe57('0xf')],'VoiceExtensionId':_0x4f5460[_0xebdc86][0x0][_0xbe57('0x18')]});_0x259509['push'](_0x4f5460[_0xebdc86][0x0]['VoiceExtensionId']);_0x4a81a4=_[_0xbe57('0x41')](_0x4a81a4,_0x3b75e1[_0xbe57('0x12')]);}}return _0x11eb32[_0xbe57('0x43')](function(_0x18194c){return _0x11eb32[_0xbe57('0x1')][_0xbe57('0x5')][_0xbe57('0x44')]({'where':{'VoiceExtensionId':{'$in':_0x259509}},'transaction':_0x18194c})['then'](function(_0x185c5e){return _0x11eb32[_0xbe57('0x1')][_0xbe57('0x5')]['bulkCreate'](_[_0xbe57('0x45')](_0x4a81a4,_0xbe57('0xf')),{'transaction':_0x18194c});});});})[_0xbe57('0x46')](function(_0x194399){console[_0xbe57('0x47')](_0x194399);});}exports[_0xbe57('0x48')]=rewrite; \ No newline at end of file +var _0x64ac=['VoiceExtension','IntervalId','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','playback','hasOwnProperty','priority','extension','extensions','push','Set','CDR(type)=%s','context','VoiceExtensionId','type','outbound','CDR(destination)=','cutdigits','${EXTEN}','CDR(routeid)=','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','callerID','length','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','Hangup','destroy','bulkCreate','sortBy','error','rewrite','lodash','util','models','Interval','findAll','then','intervals'];(function(_0x3729c,_0x1b1faf){var _0x20ce1f=function(_0x5f323d){while(--_0x5f323d){_0x3729c['push'](_0x3729c['shift']());}};_0x20ce1f(++_0x1b1faf);}(_0x64ac,0x143));var _0xc64a=function(_0x39e2e1,_0x1b54ac){_0x39e2e1=_0x39e2e1-0x0;var _0xcd723c=_0x64ac[_0x39e2e1];return _0xcd723c;};'use strict';var _=require(_0xc64a('0x0'));var util=require(_0xc64a('0x1'));function rewrite(_0x3eca08,_0x3c3e6c){var _0x2b217e=this;return _0x3eca08[_0xc64a('0x2')][_0xc64a('0x3')][_0xc64a('0x4')]({'raw':!![]})[_0xc64a('0x5')](function(_0x1a1297){_0x2b217e[_0xc64a('0x6')]=_0x1a1297;return _0x3eca08[_0xc64a('0x2')][_0xc64a('0x7')][_0xc64a('0x4')]({'where':{'IntervalId':_0x3c3e6c[_0xc64a('0x8')]},'raw':!![]});})[_0xc64a('0x5')](function(_0x493b6b){return _0x3eca08[_0xc64a('0x2')][_0xc64a('0x7')][_0xc64a('0x4')]({'where':{'exten':{'$in':_['uniq'](_[_0xc64a('0x9')](_0x493b6b,_0xc64a('0xa')))}},'order':[{'raw':_0xc64a('0xb')}],'raw':!![]});})[_0xc64a('0x5')](function(_0x2d32d8){var _0x2cc528=_[_0xc64a('0xc')](_0x2d32d8,{'priority':'1'});var _0x231a9d=_[_0xc64a('0xc')](_0x2d32d8,{'isApp':0x1});var _0x3a7f39=_['groupBy'](_0x231a9d,'exten');var _0x6a1743=['queue',_0xc64a('0xd')];var _0x517b1e=[];var _0x3a674c=[];for(var _0x57a156 in _0x3a7f39){if(_0x3a7f39[_0xc64a('0xe')](_0x57a156)){_0x2b217e[_0xc64a('0xf')]=0x2;_0x2b217e['extensions']=[];_0x2b217e[_0xc64a('0x10')]=_['find'](_0x2cc528,{'exten':_0x3a7f39[_0x57a156][0x0]['exten']});_0x2b217e[_0xc64a('0x11')][_0xc64a('0x12')]({'type':_0x3a7f39[_0x57a156][0x0]['type'],'app':_0xc64a('0x13'),'appdata':util['format'](_0xc64a('0x14'),_0x3a7f39[_0x57a156][0x0]['type']),'context':_0x3a7f39[_0x57a156][0x0][_0xc64a('0x15')],'exten':_0x3a7f39[_0x57a156][0x0][_0xc64a('0xa')],'priority':_0x2b217e[_0xc64a('0xf')]++,'VoiceExtensionId':_0x3a7f39[_0x57a156][0x0][_0xc64a('0x16')]});if(_0x3a7f39[_0x57a156][0x0][_0xc64a('0x17')]==='inbound'){_0x2b217e[_0xc64a('0x11')][_0xc64a('0x12')]({'type':_0x3a7f39[_0x57a156][0x0][_0xc64a('0x17')],'app':'Set','appdata':'CDR(routeid)='+_0x3a7f39[_0x57a156][0x0][_0xc64a('0x16')],'context':_0x3a7f39[_0x57a156][0x0]['context'],'exten':_0x3a7f39[_0x57a156][0x0][_0xc64a('0xa')],'priority':_0x2b217e[_0xc64a('0xf')]++,'VoiceExtensionId':_0x3a7f39[_0x57a156][0x0][_0xc64a('0x16')]});}else if(_0x3a7f39[_0x57a156][0x0][_0xc64a('0x17')]===_0xc64a('0x18')){if(_0x2b217e[_0xc64a('0x10')]){_0x2b217e[_0xc64a('0x11')][_0xc64a('0x12')]({'type':_0x3a7f39[_0x57a156][0x0][_0xc64a('0x17')],'app':_0xc64a('0x13'),'appdata':_0xc64a('0x19')+(_0x2b217e['extension'][_0xc64a('0x1a')]?'${EXTEN:'+_0x2b217e[_0xc64a('0x10')][_0xc64a('0x1a')]+'}':_0xc64a('0x1b')),'context':_0x3a7f39[_0x57a156][0x0]['context'],'exten':_0x3a7f39[_0x57a156][0x0][_0xc64a('0xa')],'priority':_0x2b217e[_0xc64a('0xf')]++,'VoiceExtensionId':_0x3a7f39[_0x57a156][0x0][_0xc64a('0x16')]});}_0x2b217e[_0xc64a('0x11')][_0xc64a('0x12')]({'type':_0x3a7f39[_0x57a156][0x0]['type'],'app':'Set','appdata':_0xc64a('0x1c')+_0x3a7f39[_0x57a156][0x0][_0xc64a('0x16')],'context':_0x3a7f39[_0x57a156][0x0][_0xc64a('0x15')],'exten':_0x3a7f39[_0x57a156][0x0][_0xc64a('0xa')],'priority':_0x2b217e[_0xc64a('0xf')]++,'VoiceExtensionId':_0x3a7f39[_0x57a156][0x0]['VoiceExtensionId']});var _0x22c283=_0x2b217e[_0xc64a('0xf')]++;_0x2b217e[_0xc64a('0x11')][_0xc64a('0x12')]({'type':_0x3a7f39[_0x57a156][0x0]['type'],'app':_0xc64a('0x1d'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x22c283+0x2)+_0xc64a('0x1e')+(_0x22c283+0x1)+')','context':_0x3a7f39[_0x57a156][0x0][_0xc64a('0x15')],'exten':_0x3a7f39[_0x57a156][0x0][_0xc64a('0xa')],'priority':_0x22c283,'VoiceExtensionId':_0x3a7f39[_0x57a156][0x0]['VoiceExtensionId']});if(_0x2b217e[_0xc64a('0x10')]){_0x2b217e[_0xc64a('0x11')][_0xc64a('0x12')]({'type':_0x3a7f39[_0x57a156][0x0][_0xc64a('0x17')],'app':_0xc64a('0x13'),'appdata':_0x2b217e[_0xc64a('0x10')]['cutdigits']?_0xc64a('0x1f')+_0x2b217e[_0xc64a('0x10')][_0xc64a('0x1a')]+'}':'CDR(prefix)=noprefix','context':_0x3a7f39[_0x57a156][0x0][_0xc64a('0x15')],'exten':_0x3a7f39[_0x57a156][0x0]['exten'],'priority':_0x2b217e[_0xc64a('0xf')]++,'VoiceExtensionId':_0x3a7f39[_0x57a156][0x0]['VoiceExtensionId']});}_0x2b217e[_0xc64a('0x11')][_0xc64a('0x12')]({'type':_0x3a7f39[_0x57a156][0x0]['type'],'app':'Set','appdata':_0xc64a('0x20')+_0x3a7f39[_0x57a156][0x0]['VoiceExtensionId'],'context':_0x3a7f39[_0x57a156][0x0][_0xc64a('0x15')],'exten':_0x3a7f39[_0x57a156][0x0][_0xc64a('0xa')],'priority':_0x2b217e[_0xc64a('0xf')]++,'VoiceExtensionId':_0x3a7f39[_0x57a156][0x0][_0xc64a('0x16')]});if(_0x2b217e[_0xc64a('0x10')]&&_0x2b217e['extension'][_0xc64a('0xe')](_0xc64a('0x21'))&&_0x2b217e['extension']['recordingFormat']!=='none'){_0x2b217e[_0xc64a('0x11')][_0xc64a('0x12')]({'type':_0x3a7f39[_0x57a156][0x0][_0xc64a('0x17')],'app':_0xc64a('0x13'),'appdata':_0xc64a('0x22'),'context':_0x3a7f39[_0x57a156][0x0][_0xc64a('0x15')],'exten':_0x3a7f39[_0x57a156][0x0][_0xc64a('0xa')],'priority':_0x2b217e[_0xc64a('0xf')]++,'VoiceExtensionId':_0x3a7f39[_0x57a156][0x0][_0xc64a('0x16')]});_0x2b217e[_0xc64a('0x11')]['push']({'type':_0x3a7f39[_0x57a156][0x0][_0xc64a('0x17')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x2b217e[_0xc64a('0x10')][_0xc64a('0x21')]||_0xc64a('0x23'),'context':_0x3a7f39[_0x57a156][0x0][_0xc64a('0x15')],'exten':_0x3a7f39[_0x57a156][0x0]['exten'],'priority':_0x2b217e[_0xc64a('0xf')]++,'VoiceExtensionId':_0x3a7f39[_0x57a156][0x0][_0xc64a('0x16')]});}}_0x2b217e[_0xc64a('0x11')]['push']({'type':_0x3a7f39[_0x57a156][0x0]['type'],'app':_0xc64a('0x13'),'appdata':_0xc64a('0x24'),'context':_0x3a7f39[_0x57a156][0x0]['context'],'exten':_0x3a7f39[_0x57a156][0x0][_0xc64a('0xa')],'priority':_0x2b217e[_0xc64a('0xf')]++,'VoiceExtensionId':_0x3a7f39[_0x57a156][0x0][_0xc64a('0x16')]});_0x2b217e[_0xc64a('0x11')][_0xc64a('0x12')]({'type':_0x3a7f39[_0x57a156][0x0]['type'],'app':_0xc64a('0x13'),'appdata':_0xc64a('0x25'),'context':_0x3a7f39[_0x57a156][0x0]['context'],'exten':_0x3a7f39[_0x57a156][0x0][_0xc64a('0xa')],'priority':_0x2b217e[_0xc64a('0xf')]++,'VoiceExtensionId':_0x3a7f39[_0x57a156][0x0][_0xc64a('0x16')]});_0x2b217e['extensions'][_0xc64a('0x12')]({'type':_0x3a7f39[_0x57a156][0x0][_0xc64a('0x17')],'app':_0xc64a('0x13'),'appdata':_0xc64a('0x26'),'context':_0x3a7f39[_0x57a156][0x0][_0xc64a('0x15')],'exten':_0x3a7f39[_0x57a156][0x0][_0xc64a('0xa')],'priority':_0x2b217e[_0xc64a('0xf')]++,'VoiceExtensionId':_0x3a7f39[_0x57a156][0x0][_0xc64a('0x16')]});for(var _0x1a7331=0x0,_0xdc1e5=0x0;_0x1a7331<_0x3a7f39[_0x57a156]['length'];_0x1a7331+=0x1,_0xdc1e5=0x0){var _0x3efa2b=_0x3a7f39[_0x57a156][_0x1a7331];if(_0x3efa2b[_0xc64a('0x17')]){_0x3efa2b[_0xc64a('0x17')]=_0x3efa2b[_0xc64a('0x17')]['toLowerCase']();}var _0x3ecc61=[];var _0x2c0ea7=[];delete _0x3efa2b['id'];delete _0x3efa2b[_0xc64a('0x27')];delete _0x3efa2b[_0xc64a('0x28')];var _0x534c06=_0x3efa2b[_0xc64a('0x29')]!==_0xc64a('0x2a')?[_0x3efa2b[_0xc64a('0x29')]]:_0x3efa2b[_0xc64a('0x8')]?_['map'](_[_0xc64a('0xc')](_0x2b217e[_0xc64a('0x6')],{'IntervalId':_0x3efa2b[_0xc64a('0x8')]}),_0xc64a('0x29')):[];if(_0x3efa2b['hasOwnProperty'](_0xc64a('0x2b'))){if(_0x3efa2b[_0xc64a('0x2b')]&&_0x3efa2b['tag']!=='--'){_0x3ecc61['push']({'type':_0x3efa2b[_0xc64a('0x17')],'app':_0xc64a('0x13'),'appdata':_0xc64a('0x2c')+_0x3efa2b[_0xc64a('0x2b')],'context':_0x3efa2b[_0xc64a('0x15')],'exten':_0x3efa2b[_0xc64a('0xa')],'priority':_0x534c06['length']+_0x2b217e['priority']+_0xdc1e5++,'VoiceExtensionId':_0x3efa2b[_0xc64a('0x16')]});}}if(_0x3efa2b[_0xc64a('0x17')]===_0xc64a('0x18')&&_0x3efa2b[_0xc64a('0xe')]('callerID')){if(_0x3efa2b[_0xc64a('0x2d')]){_0x3ecc61[_0xc64a('0x12')]({'type':_0x3efa2b[_0xc64a('0x17')],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x3efa2b[_0xc64a('0x2d')]+')','context':_0x3efa2b[_0xc64a('0x15')],'exten':_0x3efa2b[_0xc64a('0xa')],'priority':_0x534c06[_0xc64a('0x2e')]+_0x2b217e[_0xc64a('0xf')]+_0xdc1e5++,'VoiceExtensionId':_0x3efa2b[_0xc64a('0x16')]});}else{_0x3ecc61['push']({'type':_0x3efa2b[_0xc64a('0x17')],'app':_0xc64a('0x1d'),'appdata':_0xc64a('0x2f'),'context':_0x3efa2b['context'],'exten':_0x3efa2b[_0xc64a('0xa')],'priority':_0x534c06[_0xc64a('0x2e')]+_0x2b217e[_0xc64a('0xf')]+_0xdc1e5++,'VoiceExtensionId':_0x3efa2b[_0xc64a('0x16')]});}}if(_0x3efa2b[_0xc64a('0xe')](_0xc64a('0x30'))){if(_0x6a1743[_0xc64a('0x31')](_0x3efa2b[_0xc64a('0x32')]['toLowerCase']())>=0x0&&_0x3efa2b['appType']!==_0xc64a('0x33')){if(_0x3efa2b[_0xc64a('0x30')]){_0x3ecc61[_0xc64a('0x12')]({'type':_0x3efa2b['type'],'app':_0xc64a('0x1d'),'appdata':_0xc64a('0x34'),'context':_0x3efa2b['context'],'exten':_0x3efa2b[_0xc64a('0xa')],'priority':_0x534c06['length']+_0x2b217e[_0xc64a('0xf')]+_0xdc1e5++,'VoiceExtensionId':_0x3efa2b[_0xc64a('0x16')]});_0x3ecc61[_0xc64a('0x12')]({'type':_0x3efa2b[_0xc64a('0x17')],'app':_0xc64a('0x13'),'appdata':_0xc64a('0x35'),'context':_0x3efa2b[_0xc64a('0x15')],'exten':_0x3efa2b['exten'],'priority':_0x534c06[_0xc64a('0x2e')]+_0x2b217e[_0xc64a('0xf')]+_0xdc1e5++,'VoiceExtensionId':_0x3efa2b[_0xc64a('0x16')]});}else{_0x3ecc61[_0xc64a('0x12')]({'type':_0x3efa2b['type'],'app':_0xc64a('0x1d'),'appdata':_0xc64a('0x36'),'context':_0x3efa2b['context'],'exten':_0x3efa2b[_0xc64a('0xa')],'priority':_0x534c06[_0xc64a('0x2e')]+_0x2b217e[_0xc64a('0xf')]+_0xdc1e5++,'VoiceExtensionId':_0x3efa2b[_0xc64a('0x16')]});_0x3ecc61[_0xc64a('0x12')]({'type':_0x3efa2b[_0xc64a('0x17')],'app':_0xc64a('0x13'),'appdata':_0xc64a('0x37'),'context':_0x3efa2b[_0xc64a('0x15')],'exten':_0x3efa2b[_0xc64a('0xa')],'priority':_0x534c06[_0xc64a('0x2e')]+_0x2b217e[_0xc64a('0xf')]+_0xdc1e5++,'VoiceExtensionId':_0x3efa2b[_0xc64a('0x16')]});}}}for(var _0x5ef8a6=0x0;_0x5ef8a6<_0x534c06[_0xc64a('0x2e')];_0x5ef8a6+=0x1){var _0x35cc36=_0x2b217e[_0xc64a('0xf')]+_0x534c06[_0xc64a('0x2e')];var _0x1fde36=_0x5ef8a6===_0x534c06[_0xc64a('0x2e')]-0x1?_0x2b217e[_0xc64a('0xf')]+_0x3ecc61[_0xc64a('0x2e')]+_0x2c0ea7[_0xc64a('0x2e')]+0x2:_0x2b217e[_0xc64a('0xf')]+_0x5ef8a6+0x1;_0x3ecc61['splice'](_0x5ef8a6,0x0,{'type':_0x3efa2b[_0xc64a('0x17')],'app':_0xc64a('0x38'),'appdata':_0x534c06[_0x5ef8a6]+'?'+_0x3efa2b[_0xc64a('0x15')]+_0xc64a('0x39')+_0x35cc36+':'+_0x3efa2b[_0xc64a('0x15')]+_0xc64a('0x39')+_0x1fde36,'exten':_0x3efa2b[_0xc64a('0xa')],'context':_0x3efa2b[_0xc64a('0x15')],'priority':_0x2b217e[_0xc64a('0xf')]+_0x5ef8a6,'VoiceExtensionId':_0x3a7f39[_0x57a156][0x0]['VoiceExtensionId']});}_0x3efa2b[_0xc64a('0xf')]=_0x3ecc61[_0xc64a('0x2e')]?_[_0xc64a('0x3a')](_0x3ecc61)[_0xc64a('0xf')]+0x1:_0x2b217e[_0xc64a('0xf')];_0x2b217e[_0xc64a('0xf')]=(_0x2c0ea7[_0xc64a('0x2e')]?_[_0xc64a('0x3a')](_0x2c0ea7)[_0xc64a('0xf')]:_0x3efa2b['priority'])+0x1;_0x2b217e[_0xc64a('0x11')]=_[_0xc64a('0x3b')](_0x2b217e['extensions'],_0x3ecc61,[_0x3efa2b],_0x2c0ea7);}_0x2b217e[_0xc64a('0x11')][_0xc64a('0x12')]({'type':_0x3a7f39[_0x57a156][0x0][_0xc64a('0x17')],'app':_0xc64a('0x3c'),'exten':_0x3a7f39[_0x57a156][0x0][_0xc64a('0xa')],'context':_0x3a7f39[_0x57a156][0x0]['context'],'priority':_0x2b217e[_0xc64a('0xf')],'VoiceExtensionId':_0x3a7f39[_0x57a156][0x0][_0xc64a('0x16')]});_0x517b1e[_0xc64a('0x12')](_0x3a7f39[_0x57a156][0x0][_0xc64a('0x16')]);_0x3a674c=_['concat'](_0x3a674c,_0x2b217e['extensions']);}}return _0x3eca08['transaction'](function(_0x2c7b0c){return _0x3eca08[_0xc64a('0x2')][_0xc64a('0x7')][_0xc64a('0x3d')]({'where':{'VoiceExtensionId':{'$in':_0x517b1e}},'transaction':_0x2c7b0c})[_0xc64a('0x5')](function(_0x3c23a0){return _0x3eca08[_0xc64a('0x2')][_0xc64a('0x7')][_0xc64a('0x3e')](_[_0xc64a('0x3f')](_0x3a674c,_0xc64a('0xf')),{'transaction':_0x2c7b0c});});});})['catch'](function(_0x180af4){console[_0xc64a('0x40')](_0x180af4);});}exports[_0xc64a('0x41')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index ad30d94..64eedf5 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 _0x0d6c=['fromQuery','calleridnum','cm_hopper_final','\x20=\x20?','id\x20IN\x20?','str','VoiceQueue','findAll','outbound','CmList','Lists','get','dialCheckDuplicateType','sequelize','query','VoiceQueueId','onlyIfOpen','BlackLists','all','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','emit','contact:csv_','unlinkSync','info','CSV\x20import\x20process\x20stopped!','resolve','createReadStream','parse','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','util','papaparse','../../../mysqldb','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','join','data','firstName\x20not\x20specified!','phone','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','CompanyId','duplicate','Duplicate\x20Contact','CmContact','create','then','push','pick','catch','message','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','toString','NOW()','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)'];(function(_0x26f866,_0x1900bc){var _0x1abef3=function(_0x3217de){while(--_0x3217de){_0x26f866['push'](_0x26f866['shift']());}};_0x1abef3(++_0x1900bc);}(_0x0d6c,0xee));var _0xc0d6=function(_0x1e9c3c,_0x358531){_0x1e9c3c=_0x1e9c3c-0x0;var _0x213499=_0x0d6c[_0x1e9c3c];return _0x213499;};'use strict';var BPromise=require('bluebird');var util=require(_0xc0d6('0x0'));var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require(_0xc0d6('0x1'));var Redis=require('ioredis');var db=require(_0xc0d6('0x2'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xc0d6('0x3'));config['redis']=_['defaults'](config[_0xc0d6('0x4')],{'host':_0xc0d6('0x5'),'port':0x18eb});var socket=require(_0xc0d6('0x6'))(new Redis(config[_0xc0d6('0x4')]));require(_0xc0d6('0x7'))[_0xc0d6('0x8')](socket);try{if(!process[_0xc0d6('0x9')][0x2]||process['argv'][0x2]===_0xc0d6('0xa')||process['argv'][0x2]===_0xc0d6('0xb')){throw new Error(_0xc0d6('0xc'));}var FILEPATH=process[_0xc0d6('0x9')][0x2];if(!process[_0xc0d6('0x9')][0x3]||process['argv'][0x3]===_0xc0d6('0xa')||process['argv'][0x3]===_0xc0d6('0xb')||!process['argv'][0x4]||process['argv'][0x4]===_0xc0d6('0xa')||process[_0xc0d6('0x9')][0x4]==='null'){throw new Error(_0xc0d6('0xd'));}var FIELDS=_[_0xc0d6('0xe')](process[_0xc0d6('0x9')][0x3][_0xc0d6('0xf')](','),process['argv'][0x4]['split'](','));if(!process[_0xc0d6('0x9')][0x5]||process[_0xc0d6('0x9')][0x5]===_0xc0d6('0xa')||process['argv'][0x5]===_0xc0d6('0xb')){throw new Error(_0xc0d6('0x10'));}var LISTID=process[_0xc0d6('0x9')][0x5];var COMPANYID=process[_0xc0d6('0x9')][0x6]&&process[_0xc0d6('0x9')][0x6]!==_0xc0d6('0xa')&&process[_0xc0d6('0x9')][0x6]!==_0xc0d6('0xb')?process['argv'][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0xc0d6('0x9')][0x7]!==_0xc0d6('0xa')&&process[_0xc0d6('0x9')][0x7]!=='null'?process[_0xc0d6('0x9')][0x7]:null;if(!process[_0xc0d6('0x9')][0x8]||process['argv'][0x8]==='undefined'||process[_0xc0d6('0x9')][0x8]===_0xc0d6('0xb')){throw new Error(_0xc0d6('0x11'));}var SOCKET_TIMESTAMP=process[_0xc0d6('0x9')][0x8];}catch(_0x3fb2e4){logger[_0xc0d6('0x12')](_0x3fb2e4);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(_0x55cde9,_0x2b80c8,_0x147127,_0x21e698){var _0x149f3f={'message':_0x2b80c8};_0x149f3f[_0x55cde9]=!![];if(_0x147127){_0x149f3f[_0xc0d6('0x13')]=_0x147127;}if(_0x21e698){_0x149f3f['index']=_0x21e698;}return _0x149f3f;}function isEmail(_0x304097){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))*$/[_0xc0d6('0x14')](_0x304097);}function checkRow(_0x3b5b6b,_0x3f2c88,_0x414483){return new BPromise(function(_0x5b708c,_0xeda5f5){if(_[_0xc0d6('0x15')](_0x3b5b6b)){return _0xeda5f5(handleCheckRowError(_0xc0d6('0x12'),_0xc0d6('0x16'),null,_0x414483));}if(_0x3b5b6b[_0xc0d6('0x17')]&&_0x3b5b6b['errors'][_0xc0d6('0x18')]){var _0x43bc90=_[_0xc0d6('0x19')](_0x3b5b6b[_0xc0d6('0x17')],'message')[_0xc0d6('0x1a')](';');return _0xeda5f5(handleCheckRowError(_0xc0d6('0x12'),_0x43bc90,null,_0x414483));}var _0x20a2e1={};for(var _0x4d74a2 in FIELDS){if(FIELDS['hasOwnProperty'](_0x4d74a2)&&FIELDS[_0x4d74a2]){_0x20a2e1[_0x4d74a2]=_0x3b5b6b['data'][0x0][FIELDS[_0x4d74a2]]||_0x3b5b6b[_0xc0d6('0x1b')][0x0]['\ufeff'+FIELDS[_0x4d74a2]];}}if(!_0x20a2e1['firstName']){return _0xeda5f5(handleCheckRowError('error',_0xc0d6('0x1c'),null,_0x414483));}if(!_0x20a2e1[_0xc0d6('0x1d')]){return _0xeda5f5(handleCheckRowError(_0xc0d6('0x12'),'phone\x20not\x20specified!',null,_0x414483));}if(_0x20a2e1['birthDate']){var _0x2db5a3=moment(_0x20a2e1[_0xc0d6('0x1e')],_0xc0d6('0x1f'));if(!_0x2db5a3['isValid']()){return _0xeda5f5(handleCheckRowError(_0xc0d6('0x12'),_0xc0d6('0x20'),null,_0x414483));}}if(_0x20a2e1[_0xc0d6('0x21')]){if(!isEmail(_0x20a2e1[_0xc0d6('0x21')])){return _0xeda5f5(handleCheckRowError('error',_0xc0d6('0x22'),null,_0x414483));}}_0x20a2e1['ListId']=LISTID;_0x20a2e1[_0xc0d6('0x23')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xc0d6('0x18')]&&_0x3f2c88){var _0x42d395={};for(var _0x2bf9e1=0x0,_0x4f5b4b=DUPLICATES[_0xc0d6('0x18')];_0x2bf9e1<_0x4f5b4b;_0x2bf9e1+=0x1){_0x42d395[DUPLICATES[_0x2bf9e1]]=_0x20a2e1[DUPLICATES[_0x2bf9e1]];}var _0x56c916=_['find'](_0x3f2c88,_0x42d395);if(_0x56c916){return _0xeda5f5(handleCheckRowError(_0xc0d6('0x24'),_0xc0d6('0x25'),_0x56c916,_0x414483));}}return db[_0xc0d6('0x26')][_0xc0d6('0x27')](_0x20a2e1,{'raw':!![],'hooks':![],'fields':_['keys'](_0x20a2e1)})[_0xc0d6('0x28')](function(_0x3863ba){if(DUPLICATES&&DUPLICATES['length']&&_0x3f2c88){_0x3f2c88[_0xc0d6('0x29')](_[_0xc0d6('0x2a')](_0x20a2e1,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x3863ba['id'];return _0x5b708c();})[_0xc0d6('0x2b')](function(_0x513f2){return _0xeda5f5(handleCheckRowError(_0xc0d6('0x12'),'Error\x20while\x20creating\x20contact:\x20'+(_0x513f2[_0xc0d6('0x2c')]||JSON[_0xc0d6('0x2d')](_0x513f2)),null,_0x414483));});});}function checkHopper(){function _0x2448d4(){return function(_0x34050e){logger[_0xc0d6('0x12')](_0xc0d6('0x2e'),_0xc0d6('0x2f'),util[_0xc0d6('0x30')](_0x34050e,{'showHidden':![],'depth':null}));};}var _0x229208=function(_0x33c8c2,_0x22c111){var _0x1d9c3e=squel[_0xc0d6('0x31')]()[_0xc0d6('0x32')](_0xc0d6('0x33'))['fromQuery'](['phone',_0xc0d6('0x34'),_0xc0d6('0x35'),_0xc0d6('0x36'),_0x22c111,_0xc0d6('0x37'),_0xc0d6('0x38')],squel[_0xc0d6('0x39')]()[_0xc0d6('0x3a')](_0xc0d6('0x1d'),_0xc0d6('0x1d'))[_0xc0d6('0x3a')]('NOW()','scheduledAt')['field']('id',_0xc0d6('0x35'))[_0xc0d6('0x3a')](LISTID[_0xc0d6('0x3b')](),_0xc0d6('0x36'))[_0xc0d6('0x3a')](_0x33c8c2['id'][_0xc0d6('0x3b')](),_0x22c111)['field'](_0xc0d6('0x3c'),_0xc0d6('0x37'))['field']('NOW()',_0xc0d6('0x38'))[_0xc0d6('0x3d')](_0xc0d6('0x3e'))[_0xc0d6('0x3f')](_0xc0d6('0x40'))[_0xc0d6('0x3f')](_0xc0d6('0x41'),LISTID['toString']())[_0xc0d6('0x3f')](_0xc0d6('0x42'))['where'](_0xc0d6('0x43'),squel[_0xc0d6('0x39')]()[_0xc0d6('0x3a')]('phone')[_0xc0d6('0x3d')](_0xc0d6('0x33'))[_0xc0d6('0x3f')](_0x22c111+'\x20=\x20?',_0x33c8c2['id'][_0xc0d6('0x3b')]())))[_0xc0d6('0x3b')]();return _0x1d9c3e;};var _0x205c3f=function(_0x3a4af0,_0x23cc33){var _0x34cee9=squel['insert']()['into']('cm_hopper')[_0xc0d6('0x44')]([_0xc0d6('0x1d'),_0xc0d6('0x34'),_0xc0d6('0x35'),'ListId',_0x23cc33,_0xc0d6('0x37'),_0xc0d6('0x38')],squel['select']()[_0xc0d6('0x3a')](_0xc0d6('0x1d'),_0xc0d6('0x1d'))[_0xc0d6('0x3a')](_0xc0d6('0x3c'),_0xc0d6('0x34'))[_0xc0d6('0x3a')]('id',_0xc0d6('0x35'))[_0xc0d6('0x3a')](LISTID[_0xc0d6('0x3b')](),_0xc0d6('0x36'))['field'](_0x3a4af0['id']['toString'](),_0x23cc33)[_0xc0d6('0x3a')]('NOW()',_0xc0d6('0x37'))[_0xc0d6('0x3a')]('NOW()',_0xc0d6('0x38'))[_0xc0d6('0x3d')](_0xc0d6('0x3e'))[_0xc0d6('0x3f')](_0xc0d6('0x40'))[_0xc0d6('0x3f')](_0xc0d6('0x41'),LISTID[_0xc0d6('0x3b')]())['where']('id\x20IN\x20?',squel['str'](hopperContacts))[_0xc0d6('0x3f')](_0xc0d6('0x42'))[_0xc0d6('0x3f')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xc0d6('0x3a')](_0xc0d6('0x45'))[_0xc0d6('0x3d')](_0xc0d6('0x46'))[_0xc0d6('0x3f')](_0x23cc33+_0xc0d6('0x47'),_0x3a4af0['id']['toString']()))[_0xc0d6('0x3f')](_0xc0d6('0x43'),squel[_0xc0d6('0x39')]()[_0xc0d6('0x3a')](_0xc0d6('0x1d'))[_0xc0d6('0x3d')](_0xc0d6('0x33'))['where'](_0x23cc33+_0xc0d6('0x47'),_0x3a4af0['id'][_0xc0d6('0x3b')]())))['toString']();return _0x34cee9;};function _0x66fb47(_0x68cf61,_0x598a24){var _0x5f4dc9=squel[_0xc0d6('0x31')]()[_0xc0d6('0x32')](_0xc0d6('0x33'))[_0xc0d6('0x44')]([_0xc0d6('0x1d'),_0xc0d6('0x34'),'ContactId','ListId',_0x598a24,_0xc0d6('0x37'),_0xc0d6('0x38')],squel[_0xc0d6('0x39')]()[_0xc0d6('0x3a')](_0xc0d6('0x1d'),'phone')[_0xc0d6('0x3a')](_0xc0d6('0x3c'),_0xc0d6('0x34'))['field']('id',_0xc0d6('0x35'))['field'](LISTID['toString'](),_0xc0d6('0x36'))[_0xc0d6('0x3a')](_0x68cf61['id'][_0xc0d6('0x3b')](),_0x598a24)[_0xc0d6('0x3a')](_0xc0d6('0x3c'),'createdAt')[_0xc0d6('0x3a')](_0xc0d6('0x3c'),_0xc0d6('0x38'))[_0xc0d6('0x3d')](_0xc0d6('0x3e'))[_0xc0d6('0x3f')](_0xc0d6('0x40'))[_0xc0d6('0x3f')](_0xc0d6('0x41'),LISTID[_0xc0d6('0x3b')]())[_0xc0d6('0x3f')](_0xc0d6('0x48'),squel[_0xc0d6('0x49')](hopperContacts))[_0xc0d6('0x3f')](_0xc0d6('0x42')))[_0xc0d6('0x3b')]();return _0x5f4dc9;}function _0x146de2(_0x5d1a86,_0xb394f6){var _0x398ec8=squel['insert']()['into']('cm_hopper_black')[_0xc0d6('0x44')](['phone',_0xc0d6('0x35'),'ListId',_0xb394f6,_0xc0d6('0x37'),_0xc0d6('0x38')],squel[_0xc0d6('0x39')]()[_0xc0d6('0x3a')](_0xc0d6('0x1d'),_0xc0d6('0x1d'))['field']('id',_0xc0d6('0x35'))[_0xc0d6('0x3a')](LISTID[_0xc0d6('0x3b')](),_0xc0d6('0x36'))[_0xc0d6('0x3a')](_0x5d1a86['id'][_0xc0d6('0x3b')](),_0xb394f6)[_0xc0d6('0x3a')]('NOW()',_0xc0d6('0x37'))[_0xc0d6('0x3a')](_0xc0d6('0x3c'),_0xc0d6('0x38'))[_0xc0d6('0x3d')](_0xc0d6('0x3e'))[_0xc0d6('0x3f')](_0xc0d6('0x40'))[_0xc0d6('0x3f')](_0xc0d6('0x41'),LISTID['toString']())[_0xc0d6('0x3f')](_0xc0d6('0x48'),squel[_0xc0d6('0x49')](hopperContacts))[_0xc0d6('0x3f')](_0xc0d6('0x42')))[_0xc0d6('0x3b')]();return _0x398ec8;}return db[_0xc0d6('0x4a')][_0xc0d6('0x4b')]({'where':{'type':_0xc0d6('0x4c')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xc0d6('0x4d')],'as':_0xc0d6('0x4e'),'where':{'id':LISTID}}]})[_0xc0d6('0x28')](function(_0x1e958b){var _0x4991e3=[];if(_0x1e958b){var _0x79f3c3;for(var _0x4e3009=0x0,_0x17fe1d;_0x4e3009<_0x1e958b[_0xc0d6('0x18')];_0x4e3009+=0x1){_0x17fe1d=_0x1e958b[_0x4e3009][_0xc0d6('0x4f')]({'plain':!![]});switch(_0x17fe1d[_0xc0d6('0x50')]){case'always':_0x4991e3[_0xc0d6('0x29')](db[_0xc0d6('0x51')][_0xc0d6('0x52')](_0x205c3f(_0x17fe1d,_0xc0d6('0x53')))[_0xc0d6('0x28')](function(){})[_0xc0d6('0x2b')](_0x2448d4()));break;case _0xc0d6('0x54'):_0x4991e3[_0xc0d6('0x29')](db['sequelize'][_0xc0d6('0x52')](_0x229208(_0x17fe1d,_0xc0d6('0x53')))[_0xc0d6('0x28')](function(){})[_0xc0d6('0x2b')](_0x2448d4()));break;default:_0x4991e3[_0xc0d6('0x29')](db[_0xc0d6('0x51')][_0xc0d6('0x52')](_0x66fb47(_0x17fe1d,_0xc0d6('0x53')))[_0xc0d6('0x28')](function(){})[_0xc0d6('0x2b')](_0x2448d4()));}}}return _0x4991e3;})['all']()[_0xc0d6('0x28')](function(){return db[_0xc0d6('0x4a')][_0xc0d6('0x4b')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0xc0d6('0x4d')],'as':_0xc0d6('0x55'),'where':{'id':LISTID}}]})[_0xc0d6('0x28')](function(_0x15f866){var _0x16d500=[];if(_0x15f866){var _0x377089;for(var _0x41a143=0x0,_0x3c4327;_0x41a143<_0x15f866[_0xc0d6('0x18')];_0x41a143+=0x1){_0x3c4327=_0x15f866[_0x41a143][_0xc0d6('0x4f')]({'plain':!![]});_0x16d500[_0xc0d6('0x29')](db[_0xc0d6('0x51')][_0xc0d6('0x52')](_0x146de2(_0x3c4327,_0xc0d6('0x53')))['then'](function(){})['catch'](_0x2448d4()));}}return _0x16d500;})[_0xc0d6('0x56')]();})[_0xc0d6('0x28')](function(){return db[_0xc0d6('0x57')]['findAll']({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xc0d6('0x4d')],'as':_0xc0d6('0x4e'),'where':{'id':LISTID}}]})[_0xc0d6('0x28')](function(_0x420484){var _0x5c6f34=[];if(_0x420484){for(var _0x3749e4=0x0,_0x20175a;_0x3749e4<_0x420484[_0xc0d6('0x18')];_0x3749e4+=0x1){_0x20175a=_0x420484[_0x3749e4]['get']({'plain':!![]});switch(_0x20175a['dialCheckDuplicateType']){case'always':_0x5c6f34[_0xc0d6('0x29')](db[_0xc0d6('0x51')][_0xc0d6('0x52')](_0x205c3f(_0x20175a,_0xc0d6('0x58')))['then'](function(){})[_0xc0d6('0x2b')](_0x2448d4()));break;case _0xc0d6('0x54'):_0x5c6f34[_0xc0d6('0x29')](db[_0xc0d6('0x51')][_0xc0d6('0x52')](_0x229208(_0x20175a,'CampaignId'))[_0xc0d6('0x28')](function(){})['catch'](_0x2448d4()));break;default:_0x5c6f34['push'](db[_0xc0d6('0x51')][_0xc0d6('0x52')](_0x66fb47(_0x20175a,_0xc0d6('0x58')))[_0xc0d6('0x28')](function(){})[_0xc0d6('0x2b')](_0x2448d4()));}}}return _0x5c6f34;})['all']();})[_0xc0d6('0x28')](function(){return db['Campaign'][_0xc0d6('0x4b')]({'attributes':['id'],'include':[{'model':db[_0xc0d6('0x4d')],'as':_0xc0d6('0x55'),'where':{'id':LISTID}}]})[_0xc0d6('0x28')](function(_0x5a2a75){var _0x7952bd=[];if(_0x5a2a75){for(var _0x8051c1=0x0,_0x3c4c4f;_0x8051c1<_0x5a2a75[_0xc0d6('0x18')];_0x8051c1+=0x1){_0x3c4c4f=_0x5a2a75[_0x8051c1][_0xc0d6('0x4f')]({'plain':!![]});_0x7952bd[_0xc0d6('0x29')](db['sequelize'][_0xc0d6('0x52')](_0x146de2(_0x3c4c4f,_0xc0d6('0x58')))[_0xc0d6('0x28')](function(){})[_0xc0d6('0x2b')](_0x2448d4()));}}return _0x7952bd;})[_0xc0d6('0x56')]();})[_0xc0d6('0x2b')](function(_0x38b56d){logger['error'](_0xc0d6('0x59'),_0xc0d6('0x5a'),_0x38b56d[_0xc0d6('0x2c')]);});}var processPromises=function(_0x24aff8){return BPromise['all'](promises)[_0xc0d6('0x28')](function(_0xeae5a9){})['catch'](function(_0x57e9a2){logger[_0xc0d6('0x12')](_0xc0d6('0x5b'),JSON[_0xc0d6('0x2d')](_0x57e9a2));})['finally'](function(){socket[_0xc0d6('0x5c')](_0xc0d6('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x24aff8){return _0x24aff8['resume']();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0xc0d6('0x5c')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xc0d6('0x5e')](FILEPATH);}catch(_0x1e52e9){logger[_0xc0d6('0x12')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0xc0d6('0x2d')](_0x1e52e9));}finally{process['exit'](0x0);}});};process['on']('SIGINT',function(){logger[_0xc0d6('0x5f')](_0xc0d6('0x60'));endCsv();});function main(){return BPromise[_0xc0d6('0x61')]()[_0xc0d6('0x28')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db['CmContact'][_0xc0d6('0x4b')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xc0d6('0x28')](function(_0x3d4201){var _0x517225=fs[_0xc0d6('0x62')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xc0d6('0x63')](_0x517225,{'header':!![],'skipEmptyLines':!![],'step':function(_0x22be42,_0x23e902){total+=0x1;var _0x5ef88f=total;promises['push'](checkRow(_0x22be42,_0x3d4201,_0x5ef88f)[_0xc0d6('0x28')](function(){success+=0x1;})[_0xc0d6('0x2b')](function(_0xe0f44){if(_0xe0f44['error']){errors+=0x1;delete _0xe0f44[_0xc0d6('0x12')];}else if(_0xe0f44[_0xc0d6('0x24')]){duplicates+=0x1;delete _0xe0f44[_0xc0d6('0x24')];}rows[_0xc0d6('0x29')](_0xe0f44);}));if(total%0xc8===0x0){_0x23e902['pause']();return processPromises(_0x23e902);}},'complete':function(){return processPromises()['then'](function(){logger[_0xc0d6('0x5f')](_0xc0d6('0x64'));endCsv();});},'error':function(_0x57821e,_0x4a8d43){logger['info']('CSV\x20parse\x20error',JSON[_0xc0d6('0x2d')](_0x57821e));endCsv();}});})[_0xc0d6('0x2b')](function(_0x2dbc1b){logger[_0xc0d6('0x12')](_0xc0d6('0x65'),JSON[_0xc0d6('0x2d')](_0x2dbc1b));});}main(); \ No newline at end of file +var _0x56d1=['parse','info','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','squel','papaparse','ioredis','api','redis','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','errors','length','map','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','message','cmContact','checkHopper','inspect','scheduledAt','ContactId','ListId','createdAt','field','NOW()','toString','updatedAt','cm_contacts','deletedAt\x20IS\x20NULL','where','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','select','cm_hopper','\x20=\x20?','insert','into','fromQuery','from','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','cm_hopper_black','id\x20IN\x20?','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','get','always','sequelize','query','VoiceQueueId','onlyIfOpen','CmList','BlackLists','all','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','unlinkSync','stringify','SIGINT','CSV\x20import\x20process\x20stopped!','resolve','createReadStream'];(function(_0x4e697a,_0x56a14b){var _0x88850c=function(_0x4e368a){while(--_0x4e368a){_0x4e697a['push'](_0x4e697a['shift']());}};_0x88850c(++_0x56a14b);}(_0x56d1,0x72));var _0x156d=function(_0x5bc5fe,_0x2afaef){_0x5bc5fe=_0x5bc5fe-0x0;var _0x298ea7=_0x56d1[_0x5bc5fe];return _0x298ea7;};'use strict';var BPromise=require(_0x156d('0x0'));var util=require(_0x156d('0x1'));var _=require('lodash');var fs=require('fs');var squel=require(_0x156d('0x2'));var Papa=require(_0x156d('0x3'));var Redis=require(_0x156d('0x4'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x156d('0x5'));config[_0x156d('0x6')]=_['defaults'](config[_0x156d('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x156d('0x7'))(new Redis(config[_0x156d('0x6')]));require(_0x156d('0x8'))[_0x156d('0x9')](socket);try{if(!process[_0x156d('0xa')][0x2]||process[_0x156d('0xa')][0x2]===_0x156d('0xb')||process[_0x156d('0xa')][0x2]===_0x156d('0xc')){throw new Error(_0x156d('0xd'));}var FILEPATH=process['argv'][0x2];if(!process[_0x156d('0xa')][0x3]||process['argv'][0x3]===_0x156d('0xb')||process[_0x156d('0xa')][0x3]===_0x156d('0xc')||!process['argv'][0x4]||process[_0x156d('0xa')][0x4]==='undefined'||process[_0x156d('0xa')][0x4]==='null'){throw new Error(_0x156d('0xe'));}var FIELDS=_['zipObject'](process[_0x156d('0xa')][0x3][_0x156d('0xf')](','),process['argv'][0x4][_0x156d('0xf')](','));if(!process[_0x156d('0xa')][0x5]||process[_0x156d('0xa')][0x5]===_0x156d('0xb')||process['argv'][0x5]==='null'){throw new Error(_0x156d('0x10'));}var LISTID=process[_0x156d('0xa')][0x5];var COMPANYID=process[_0x156d('0xa')][0x6]&&process['argv'][0x6]!=='undefined'&&process[_0x156d('0xa')][0x6]!==_0x156d('0xc')?process[_0x156d('0xa')][0x6]:null;var DUPLICATES=process[_0x156d('0xa')][0x7]&&process[_0x156d('0xa')][0x7]!==_0x156d('0xb')&&process[_0x156d('0xa')][0x7]!==_0x156d('0xc')?process['argv'][0x7]:null;if(!process[_0x156d('0xa')][0x8]||process[_0x156d('0xa')][0x8]==='undefined'||process['argv'][0x8]===_0x156d('0xc')){throw new Error(_0x156d('0x11'));}var SOCKET_TIMESTAMP=process[_0x156d('0xa')][0x8];}catch(_0x81f588){logger[_0x156d('0x12')](_0x81f588);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(_0x262cb6,_0x3eb208,_0x4ec2d9,_0x23da99){var _0x45a92e={'message':_0x3eb208};_0x45a92e[_0x262cb6]=!![];if(_0x4ec2d9){_0x45a92e[_0x156d('0x13')]=_0x4ec2d9;}if(_0x23da99){_0x45a92e[_0x156d('0x14')]=_0x23da99;}return _0x45a92e;}function isEmail(_0x5e83cb){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))*$/[_0x156d('0x15')](_0x5e83cb);}function checkRow(_0x122e79,_0x18dbee,_0x3b179e){return new BPromise(function(_0x39b759,_0x539455){if(_[_0x156d('0x16')](_0x122e79)){return _0x539455(handleCheckRowError(_0x156d('0x12'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x3b179e));}if(_0x122e79[_0x156d('0x17')]&&_0x122e79[_0x156d('0x17')][_0x156d('0x18')]){var _0x3f0f63=_[_0x156d('0x19')](_0x122e79[_0x156d('0x17')],'message')['join'](';');return _0x539455(handleCheckRowError('error',_0x3f0f63,null,_0x3b179e));}var _0xc17fda={};for(var _0x428e5f in FIELDS){if(FIELDS[_0x156d('0x1a')](_0x428e5f)&&FIELDS[_0x428e5f]){_0xc17fda[_0x428e5f]=_0x122e79[_0x156d('0x1b')][0x0][FIELDS[_0x428e5f]]||_0x122e79[_0x156d('0x1b')][0x0]['\ufeff'+FIELDS[_0x428e5f]];}}if(!_0xc17fda[_0x156d('0x1c')]){return _0x539455(handleCheckRowError(_0x156d('0x12'),_0x156d('0x1d'),null,_0x3b179e));}if(!_0xc17fda[_0x156d('0x1e')]){return _0x539455(handleCheckRowError('error',_0x156d('0x1f'),null,_0x3b179e));}if(_0xc17fda['birthDate']){var _0x56478f=moment(_0xc17fda['birthDate'],_0x156d('0x20'));if(!_0x56478f['isValid']()){return _0x539455(handleCheckRowError(_0x156d('0x12'),_0x156d('0x21'),null,_0x3b179e));}}if(_0xc17fda[_0x156d('0x22')]){if(!isEmail(_0xc17fda[_0x156d('0x22')])){return _0x539455(handleCheckRowError(_0x156d('0x12'),_0x156d('0x23'),null,_0x3b179e));}}_0xc17fda['ListId']=LISTID;_0xc17fda[_0x156d('0x24')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x156d('0x18')]&&_0x18dbee){var _0x48a5f3={};for(var _0x553394=0x0,_0x579746=DUPLICATES[_0x156d('0x18')];_0x553394<_0x579746;_0x553394+=0x1){_0x48a5f3[DUPLICATES[_0x553394]]=_0xc17fda[DUPLICATES[_0x553394]];}var _0xfea7a9=_[_0x156d('0x25')](_0x18dbee,_0x48a5f3);if(_0xfea7a9){return _0x539455(handleCheckRowError(_0x156d('0x26'),_0x156d('0x27'),_0xfea7a9,_0x3b179e));}}return db[_0x156d('0x28')][_0x156d('0x29')](_0xc17fda,{'raw':!![],'hooks':![],'fields':_['keys'](_0xc17fda)})[_0x156d('0x2a')](function(_0x1ed185){if(DUPLICATES&&DUPLICATES['length']&&_0x18dbee){_0x18dbee[_0x156d('0x2b')](_[_0x156d('0x2c')](_0xc17fda,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x1ed185['id'];return _0x39b759();})[_0x156d('0x2d')](function(_0xd5ab67){return _0x539455(handleCheckRowError(_0x156d('0x12'),_0x156d('0x2e')+(_0xd5ab67[_0x156d('0x2f')]||JSON['stringify'](_0xd5ab67)),null,_0x3b179e));});});}function checkHopper(){function _0x434c9f(){return function(_0x31fbe9){logger[_0x156d('0x12')](_0x156d('0x30'),_0x156d('0x31'),util[_0x156d('0x32')](_0x31fbe9,{'showHidden':![],'depth':null}));};}var _0x2be297=function(_0x2332c4,_0x55d0a7){var _0x553b2e=squel['insert']()['into']('cm_hopper')['fromQuery']([_0x156d('0x1e'),_0x156d('0x33'),_0x156d('0x34'),_0x156d('0x35'),_0x55d0a7,_0x156d('0x36'),'updatedAt'],squel['select']()[_0x156d('0x37')](_0x156d('0x1e'),_0x156d('0x1e'))[_0x156d('0x37')](_0x156d('0x38'),_0x156d('0x33'))['field']('id',_0x156d('0x34'))[_0x156d('0x37')](LISTID[_0x156d('0x39')](),_0x156d('0x35'))['field'](_0x2332c4['id'][_0x156d('0x39')](),_0x55d0a7)[_0x156d('0x37')](_0x156d('0x38'),_0x156d('0x36'))[_0x156d('0x37')](_0x156d('0x38'),_0x156d('0x3a'))['from'](_0x156d('0x3b'))['where'](_0x156d('0x3c'))[_0x156d('0x3d')](_0x156d('0x3e'),LISTID['toString']())[_0x156d('0x3d')]('phone\x20IS\x20NOT\x20NULL')[_0x156d('0x3d')](_0x156d('0x3f'),squel[_0x156d('0x40')]()['field'](_0x156d('0x1e'))['from'](_0x156d('0x41'))['where'](_0x55d0a7+_0x156d('0x42'),_0x2332c4['id'][_0x156d('0x39')]())))[_0x156d('0x39')]();return _0x553b2e;};var _0x4d61a6=function(_0x22242f,_0x12cd95){var _0x2993a6=squel[_0x156d('0x43')]()[_0x156d('0x44')]('cm_hopper')[_0x156d('0x45')]([_0x156d('0x1e'),_0x156d('0x33'),'ContactId',_0x156d('0x35'),_0x12cd95,_0x156d('0x36'),'updatedAt'],squel[_0x156d('0x40')]()[_0x156d('0x37')](_0x156d('0x1e'),_0x156d('0x1e'))[_0x156d('0x37')]('NOW()',_0x156d('0x33'))[_0x156d('0x37')]('id',_0x156d('0x34'))[_0x156d('0x37')](LISTID[_0x156d('0x39')](),'ListId')['field'](_0x22242f['id'][_0x156d('0x39')](),_0x12cd95)['field'](_0x156d('0x38'),'createdAt')[_0x156d('0x37')](_0x156d('0x38'),_0x156d('0x3a'))[_0x156d('0x46')](_0x156d('0x3b'))['where'](_0x156d('0x3c'))[_0x156d('0x3d')](_0x156d('0x3e'),LISTID['toString']())[_0x156d('0x3d')]('id\x20IN\x20?',squel[_0x156d('0x47')](hopperContacts))['where'](_0x156d('0x48'))[_0x156d('0x3d')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x156d('0x37')](_0x156d('0x49'))[_0x156d('0x46')](_0x156d('0x4a'))[_0x156d('0x3d')](_0x12cd95+_0x156d('0x42'),_0x22242f['id'][_0x156d('0x39')]()))['where'](_0x156d('0x3f'),squel[_0x156d('0x40')]()['field'](_0x156d('0x1e'))[_0x156d('0x46')]('cm_hopper')[_0x156d('0x3d')](_0x12cd95+'\x20=\x20?',_0x22242f['id']['toString']())))[_0x156d('0x39')]();return _0x2993a6;};function _0x3f354b(_0x5632c7,_0x500aae){var _0x5c5295=squel['insert']()[_0x156d('0x44')](_0x156d('0x41'))[_0x156d('0x45')]([_0x156d('0x1e'),_0x156d('0x33'),'ContactId',_0x156d('0x35'),_0x500aae,_0x156d('0x36'),_0x156d('0x3a')],squel[_0x156d('0x40')]()[_0x156d('0x37')](_0x156d('0x1e'),_0x156d('0x1e'))[_0x156d('0x37')](_0x156d('0x38'),_0x156d('0x33'))[_0x156d('0x37')]('id',_0x156d('0x34'))[_0x156d('0x37')](LISTID[_0x156d('0x39')](),_0x156d('0x35'))['field'](_0x5632c7['id'][_0x156d('0x39')](),_0x500aae)[_0x156d('0x37')](_0x156d('0x38'),_0x156d('0x36'))[_0x156d('0x37')](_0x156d('0x38'),_0x156d('0x3a'))[_0x156d('0x46')]('cm_contacts')[_0x156d('0x3d')](_0x156d('0x3c'))[_0x156d('0x3d')](_0x156d('0x3e'),LISTID['toString']())[_0x156d('0x3d')]('id\x20IN\x20?',squel[_0x156d('0x47')](hopperContacts))[_0x156d('0x3d')](_0x156d('0x48')))['toString']();return _0x5c5295;}function _0x250106(_0xb16e01,_0x49c1f0){var _0x147a39=squel[_0x156d('0x43')]()[_0x156d('0x44')](_0x156d('0x4b'))[_0x156d('0x45')](['phone',_0x156d('0x34'),_0x156d('0x35'),_0x49c1f0,_0x156d('0x36'),'updatedAt'],squel[_0x156d('0x40')]()[_0x156d('0x37')](_0x156d('0x1e'),_0x156d('0x1e'))[_0x156d('0x37')]('id',_0x156d('0x34'))['field'](LISTID[_0x156d('0x39')](),'ListId')[_0x156d('0x37')](_0xb16e01['id'][_0x156d('0x39')](),_0x49c1f0)[_0x156d('0x37')](_0x156d('0x38'),_0x156d('0x36'))[_0x156d('0x37')](_0x156d('0x38'),_0x156d('0x3a'))[_0x156d('0x46')](_0x156d('0x3b'))[_0x156d('0x3d')](_0x156d('0x3c'))['where'](_0x156d('0x3e'),LISTID[_0x156d('0x39')]())[_0x156d('0x3d')](_0x156d('0x4c'),squel[_0x156d('0x47')](hopperContacts))[_0x156d('0x3d')](_0x156d('0x48')))[_0x156d('0x39')]();return _0x147a39;}return db[_0x156d('0x4d')][_0x156d('0x4e')]({'where':{'type':_0x156d('0x4f')},'attributes':['id',_0x156d('0x50')],'include':[{'model':db['CmList'],'as':_0x156d('0x51'),'where':{'id':LISTID}}]})[_0x156d('0x2a')](function(_0x50277b){var _0x28acc6=[];if(_0x50277b){var _0x5b6400;for(var _0x42fdc4=0x0,_0x315e90;_0x42fdc4<_0x50277b[_0x156d('0x18')];_0x42fdc4+=0x1){_0x315e90=_0x50277b[_0x42fdc4][_0x156d('0x52')]({'plain':!![]});switch(_0x315e90['dialCheckDuplicateType']){case _0x156d('0x53'):_0x28acc6[_0x156d('0x2b')](db[_0x156d('0x54')][_0x156d('0x55')](_0x4d61a6(_0x315e90,_0x156d('0x56')))[_0x156d('0x2a')](function(){})[_0x156d('0x2d')](_0x434c9f()));break;case _0x156d('0x57'):_0x28acc6['push'](db[_0x156d('0x54')][_0x156d('0x55')](_0x2be297(_0x315e90,_0x156d('0x56')))['then'](function(){})['catch'](_0x434c9f()));break;default:_0x28acc6[_0x156d('0x2b')](db[_0x156d('0x54')][_0x156d('0x55')](_0x3f354b(_0x315e90,_0x156d('0x56')))[_0x156d('0x2a')](function(){})['catch'](_0x434c9f()));}}}return _0x28acc6;})['all']()[_0x156d('0x2a')](function(){return db[_0x156d('0x4d')][_0x156d('0x4e')]({'where':{'type':_0x156d('0x4f')},'attributes':['id'],'include':[{'model':db[_0x156d('0x58')],'as':_0x156d('0x59'),'where':{'id':LISTID}}]})['then'](function(_0x2e9058){var _0x5ed421=[];if(_0x2e9058){var _0x427870;for(var _0x1a2f4c=0x0,_0x580719;_0x1a2f4c<_0x2e9058['length'];_0x1a2f4c+=0x1){_0x580719=_0x2e9058[_0x1a2f4c]['get']({'plain':!![]});_0x5ed421[_0x156d('0x2b')](db['sequelize'][_0x156d('0x55')](_0x250106(_0x580719,_0x156d('0x56')))[_0x156d('0x2a')](function(){})[_0x156d('0x2d')](_0x434c9f()));}}return _0x5ed421;})[_0x156d('0x5a')]();})['then'](function(){return db[_0x156d('0x5b')]['findAll']({'attributes':['id',_0x156d('0x50')],'include':[{'model':db[_0x156d('0x58')],'as':_0x156d('0x51'),'where':{'id':LISTID}}]})[_0x156d('0x2a')](function(_0x146740){var _0x49130f=[];if(_0x146740){for(var _0x341c87=0x0,_0x2d3a8e;_0x341c87<_0x146740[_0x156d('0x18')];_0x341c87+=0x1){_0x2d3a8e=_0x146740[_0x341c87][_0x156d('0x52')]({'plain':!![]});switch(_0x2d3a8e[_0x156d('0x50')]){case _0x156d('0x53'):_0x49130f[_0x156d('0x2b')](db[_0x156d('0x54')][_0x156d('0x55')](_0x4d61a6(_0x2d3a8e,'CampaignId'))[_0x156d('0x2a')](function(){})[_0x156d('0x2d')](_0x434c9f()));break;case _0x156d('0x57'):_0x49130f[_0x156d('0x2b')](db[_0x156d('0x54')][_0x156d('0x55')](_0x2be297(_0x2d3a8e,_0x156d('0x5c')))['then'](function(){})[_0x156d('0x2d')](_0x434c9f()));break;default:_0x49130f[_0x156d('0x2b')](db[_0x156d('0x54')][_0x156d('0x55')](_0x3f354b(_0x2d3a8e,_0x156d('0x5c')))['then'](function(){})[_0x156d('0x2d')](_0x434c9f()));}}}return _0x49130f;})[_0x156d('0x5a')]();})[_0x156d('0x2a')](function(){return db[_0x156d('0x5b')][_0x156d('0x4e')]({'attributes':['id'],'include':[{'model':db[_0x156d('0x58')],'as':_0x156d('0x59'),'where':{'id':LISTID}}]})[_0x156d('0x2a')](function(_0x43e765){var _0x1f539b=[];if(_0x43e765){for(var _0x258ba6=0x0,_0x249e33;_0x258ba6<_0x43e765['length'];_0x258ba6+=0x1){_0x249e33=_0x43e765[_0x258ba6][_0x156d('0x52')]({'plain':!![]});_0x1f539b[_0x156d('0x2b')](db[_0x156d('0x54')][_0x156d('0x55')](_0x250106(_0x249e33,_0x156d('0x5c')))['then'](function(){})[_0x156d('0x2d')](_0x434c9f()));}}return _0x1f539b;})[_0x156d('0x5a')]();})[_0x156d('0x2d')](function(_0x2842d7){logger['error'](_0x156d('0x5d'),_0x156d('0x5e'),_0x2842d7[_0x156d('0x2f')]);});}var processPromises=function(_0xdbfc22){return BPromise['all'](promises)[_0x156d('0x2a')](function(_0x55693a){})[_0x156d('0x2d')](function(_0xb2aad3){logger[_0x156d('0x12')](_0x156d('0x5f'),JSON['stringify'](_0xb2aad3));})[_0x156d('0x60')](function(){socket[_0x156d('0x61')](_0x156d('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0xdbfc22){return _0xdbfc22[_0x156d('0x63')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x156d('0x2a')](function(){if(hopperContacts){return checkHopper();}})[_0x156d('0x2a')](function(){socket[_0x156d('0x61')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x156d('0x64')](FILEPATH);}catch(_0x570606){logger[_0x156d('0x12')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x156d('0x65')](_0x570606));}finally{process['exit'](0x0);}});};process['on'](_0x156d('0x66'),function(){logger['info'](_0x156d('0x67'));endCsv();});function main(){return BPromise[_0x156d('0x68')]()[_0x156d('0x2a')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x156d('0x28')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x156d('0x2a')](function(_0x161356){var _0x3ad1cd=fs[_0x156d('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x156d('0x6a')](_0x3ad1cd,{'header':!![],'skipEmptyLines':!![],'step':function(_0x131989,_0x542bf1){total+=0x1;var _0x349e20=total;promises['push'](checkRow(_0x131989,_0x161356,_0x349e20)[_0x156d('0x2a')](function(){success+=0x1;})[_0x156d('0x2d')](function(_0xc0b8c7){if(_0xc0b8c7[_0x156d('0x12')]){errors+=0x1;delete _0xc0b8c7['error'];}else if(_0xc0b8c7[_0x156d('0x26')]){duplicates+=0x1;delete _0xc0b8c7[_0x156d('0x26')];}rows[_0x156d('0x2b')](_0xc0b8c7);}));if(total%0xc8===0x0){_0x542bf1['pause']();return processPromises(_0x542bf1);}},'complete':function(){return processPromises()[_0x156d('0x2a')](function(){logger['info']('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x159e37,_0x2ad1fc){logger[_0x156d('0x6b')](_0x156d('0x6c'),JSON[_0x156d('0x65')](_0x159e37));endCsv();}});})[_0x156d('0x2d')](function(_0x23eb4c){logger[_0x156d('0x12')](_0x156d('0x6d'),JSON[_0x156d('0x65')](_0x23eb4c));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 7993b1c..457e251 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 _0x20d9=['data','rows','find','hasOwnProperty','trim','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','utcOffset','firstName','replace','itemTypeId','SystemRow','appendFileSync','emit','contact:import:','SystemError','step','duplicates','cm_contacts_','campaigns_','voice_queues_','CREATE\x20TABLE\x20','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','contactTypeId','orderBy','VoiceQueueId','campaigns_has_cm_lists','CampaignId','campaigns','voice_queues_has_cm_blacklists','finish','affectedRows','unlink','exit','complete','argv','arguments\x20\x20\x20','server/files/tmp','existsSync','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','ioredis','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','defaults','redis','localhost','socket.io-emitter','format','test','select','field','from','join','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','length','push','all','then','AdditionalPhones','split','isNil','CmContactHasItem','findOne','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','phone','scheduledat','ContactId','ListId','createdAt','UserId','recallme','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.id','cm_hopper_black','updatedAt','cm_contacts','.CmListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','priority','fields','cm_hopper.id','cm_contact_has_items.item','cm_hopper_additional_phones','OrderBy','cm_contact_has_items','cm_hopper.ListId\x20=\x20?','concat','CompanyId',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','Received\x20SIGINT','error','message','errors','code','info','query','spread','catch','campaigns.id','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','sequelize','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','set','offset','main','stringify','send','start','binding','root','.csv','keys','includes','header','ContactItemType','name','writeFileSync','parse'];(function(_0x3b90ab,_0x174a22){var _0x206e92=function(_0x21fbd3){while(--_0x21fbd3){_0x3b90ab['push'](_0x3b90ab['shift']());}};_0x206e92(++_0x174a22);}(_0x20d9,0xef));var _0x920d=function(_0x19fab8,_0x2113a0){_0x19fab8=_0x19fab8-0x0;var _0xae9119=_0x20d9[_0x19fab8];return _0xae9119;};'use strict';var fs=require('fs');var path=require(_0x920d('0x0'));var _=require(_0x920d('0x1'));var Papa=require(_0x920d('0x2'));var util=require('util');var BPromise=require('bluebird');var moment=require('moment');var squel=require('squel');var Redis=require(_0x920d('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x920d('0x4'));var shared=require(_0x920d('0x5'));var logger=require(_0x920d('0x6'))(_0x920d('0x7'));config['redis']=_[_0x920d('0x8')](config[_0x920d('0x9')],{'host':_0x920d('0xa'),'port':0x18eb});var socket=require(_0x920d('0xb'))(new Redis(config[_0x920d('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x920d('0xc')]('YYYY-MM-DD\x20HH:mm:ss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x920d('0xc')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x168d5a){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))*$/[_0x920d('0xd')](_0x168d5a);}function selectNotIn(_0x5544b5,_0x5e2d06,_0x5b6a6d,_0x416add,_0x4dfeca){return squel[_0x920d('0xe')]()[_0x920d('0xf')]('phone')[_0x920d('0x10')](_0x416add)[_0x920d('0x11')](_0x5e2d06,null,_0x5e2d06+_0x920d('0x12')+_0x416add+'.'+_0x5b6a6d)['where'](_0x416add+'.'+_0x5b6a6d+_0x920d('0x13')+_0x5544b5+'.'+_0x5b6a6d)[_0x920d('0x14')](_0x5e2d06+_0x920d('0x15')+_0x4dfeca[_0x920d('0x11')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x596908,_0x3a4ef0){promisesAdditionalPhones=[];return db[_0x920d('0x16')][_0x920d('0x17')]({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0x847b71){if(_0x847b71!==null){var _0x4bb33f=[];for(var _0x3ce135=0x0;_0x3ce135<_0x847b71[_0x920d('0x18')];_0x3ce135++){var _0x517721=_0x847b71[_0x3ce135];_0x4bb33f[_0x920d('0x19')](insertAdditionalPhones(_0x517721));}}Promise[_0x920d('0x1a')](_0x4bb33f)[_0x920d('0x1b')](function(){_0x596908({'val':0x1});});});});}function insertAdditionalPhones(_0x3eac9c){return new Promise(function(_0x59bfe1,_0x38f3b2){var _0x531a3f=_0x3eac9c[_0x920d('0x1c')];var _0x470ddb=_0x531a3f['split'](';');var _0x45be07=[];orderBy=0x0;for(var _0x5cfbd5=0x0;_0x5cfbd5<_0x470ddb[_0x920d('0x18')];_0x5cfbd5++){_0x45be07['push'](splitAdditionalPhone(_0x3eac9c['id'],_0x470ddb[_0x5cfbd5]));}Promise[_0x920d('0x1a')](_0x45be07)[_0x920d('0x1b')](function(){_0x59bfe1({'val':_0x470ddb[_0x920d('0x18')]});});});}function splitAdditionalPhone(_0x243f97,_0x2d4ae9){return new Promise(function(_0x477bc1,_0x31e164){var _0x35a67f=_0x2d4ae9[_0x920d('0x1d')](':');var _0x2b8198=_0x35a67f[0x0];var _0x3af874=_0x35a67f[0x1];if(!_[_0x920d('0x1e')](_0x3af874)){var _0x62c8f4=_0x3af874[_0x920d('0x1d')]('|');var _0x4f7317=[];for(var _0x5e38db=0x0;_0x5e38db<_0x62c8f4[_0x920d('0x18')];_0x5e38db++){if(_0x62c8f4[_0x5e38db]!==''){var _0x5a77be=_['filter'](promisesAdditionalPhones,{'contactId':_0x243f97,'phone':_0x62c8f4[_0x5e38db]});if(_0x5a77be['length']==0x0){orderBy++;promisesAdditionalPhones[_0x920d('0x19')]({'contactId':_0x243f97,'contactTypeId':_0x2b8198,'phone':_0x62c8f4[_0x5e38db],'orderBy':orderBy});}}}_0x477bc1({'ok':0x1});}else _0x477bc1({'res':0x0});});}function createAdditionalPhone(_0x3f2425,_0x3bdf3e,_0xaf2d01,_0x349d6a){var _0x1a1ef5='';var _0x452831='';var _0x2e5fff=_0xaf2d01[_0x920d('0x1d')]('§');_0x1a1ef5=_0x2e5fff[0x0];if(_0x2e5fff['length']==0x2)_0x452831=_0x2e5fff[0x1];return new Promise(function(_0x4285c8,_0x19ad34){return db[_0x920d('0x1f')][_0x920d('0x20')]({'where':{'CmContactId':_0x3f2425,'item':_0x1a1ef5}})[_0x920d('0x1b')](function(_0x5c45c9){if(_0x5c45c9){return db['CmContactHasItem']['update']({'ItemTypeId':_0x3bdf3e,'description':_0x452831,'OrderBy':_0x349d6a},{'where':{'CmContactId':_0x3f2425,'item':_0x1a1ef5}})[_0x920d('0x1b')](function(_0x2270d1){_0x4285c8({'res':_0x920d('0x21')});});}else{return db[_0x920d('0x1f')][_0x920d('0x22')]({'CmContactId':_0x3f2425,'item':_0x1a1ef5,'description':_0x452831,'ItemTypeId':_0x3bdf3e,'OrderBy':_0x349d6a,'ItemClass':_0x920d('0x23')})[_0x920d('0x1b')](function(_0x2e504c){_0x4285c8({'res':_0x920d('0x24')});});}});});}function insertCmHopper(_0x4335d6,_0x3b8147,_0x3e3a59,_0x218e13,_0x2b391b){var _0x58f6fd=[_0x920d('0x25'),_0x920d('0x26'),'cm_contacts.id',_0x920d('0x27'),_0x3b8147+'.'+_0x218e13,_0x920d('0x28'),_0x920d('0x29'),_0x920d('0x2a'),_0x920d('0x2b'),'\x22'+_0x2b391b+'\x22'];return squel[_0x920d('0x2c')]()[_0x920d('0x2d')](_0x920d('0x2e'))[_0x920d('0x2f')]([_0x920d('0x30'),_0x920d('0x31'),_0x920d('0x32'),_0x920d('0x33'),_0x218e13,_0x920d('0x34'),'updatedAt','priority',_0x920d('0x35'),_0x920d('0x36')],squel[_0x920d('0xe')]()['fields'](_0x58f6fd)[_0x920d('0x10')](_0x3b8147)[_0x920d('0x11')]('cm_contacts',null,_0x920d('0x37')+_0x3b8147+_0x920d('0x38'))['join'](_0x3e3a59,null,_0x3e3a59+_0x920d('0x12')+_0x3b8147+'.'+_0x218e13)[_0x920d('0x14')](_0x3b8147+'.CmListId\x20=\x20?',_0x4335d6)[_0x920d('0x14')](_0x920d('0x39'),NOW)[_0x920d('0x14')](_0x920d('0x3a'),selectNotIn(_0x3b8147,_0x3e3a59,_0x218e13,'cm_hopper',[_0x920d('0x3b'),_0x920d('0x3c')]))['where'](_0x920d('0x3a'),selectNotIn(_0x3b8147,_0x3e3a59,_0x218e13,_0x920d('0x2e'),['\x22always\x22'])))[_0x920d('0x3d')]();}function insertCmHopperBlack(_0x47c0a8,_0x35b681,_0x321a67,_0x12bb1c){var _0x2615a6=[_0x920d('0x25'),_0x920d('0x3e'),_0x920d('0x27'),_0x35b681+'.'+_0x12bb1c,_0x920d('0x28'),_0x920d('0x29')];return squel[_0x920d('0x2c')]()['into'](_0x920d('0x3f'))[_0x920d('0x2f')]([_0x920d('0x30'),_0x920d('0x32'),_0x920d('0x33'),_0x12bb1c,_0x920d('0x34'),_0x920d('0x40')],squel['select']()['fields'](_0x2615a6)[_0x920d('0x10')](_0x35b681)[_0x920d('0x11')](_0x920d('0x41'),null,'cm_contacts.ListId\x20=\x20'+_0x35b681+'.CmListId')[_0x920d('0x11')](_0x321a67,null,_0x321a67+_0x920d('0x12')+_0x35b681+'.'+_0x12bb1c)[_0x920d('0x14')](_0x35b681+_0x920d('0x42'),_0x47c0a8)[_0x920d('0x14')](_0x920d('0x39'),NOW)[_0x920d('0x14')](_0x920d('0x3a'),squel[_0x920d('0xe')]()[_0x920d('0xf')](_0x920d('0x30'))[_0x920d('0x10')](_0x920d('0x3f'))[_0x920d('0x14')]('ListId\x20=\x20?',_0x47c0a8)[_0x920d('0x14')](_0x12bb1c+_0x920d('0x13')+_0x35b681+'.'+_0x12bb1c)))[_0x920d('0x3d')]();}function insertTzCmHopper(_0x240c74,_0x568336,_0x5a8371,_0x29714c,_0x435d7c,_0x234244){var _0x56bd29=[_0x920d('0x25'),_0x920d('0x43')+_0x234244+'.offset-cm_contacts.utcOffset\x20minute)',_0x920d('0x3e'),_0x920d('0x27'),_0x568336+'.'+_0x29714c,_0x920d('0x28'),'cm_contacts.updatedAt',_0x920d('0x2a'),_0x920d('0x2b'),'\x22'+_0x435d7c+'\x22'];var _0x169d85=squel[_0x920d('0x2c')]()['into'](_0x920d('0x2e'))[_0x920d('0x2f')]([_0x920d('0x30'),_0x920d('0x31'),_0x920d('0x32'),_0x920d('0x33'),_0x29714c,'createdAt','updatedAt',_0x920d('0x44'),_0x920d('0x35'),'recallme'],squel[_0x920d('0xe')]()[_0x920d('0x45')](_0x56bd29)['from'](_0x568336)['join'](_0x920d('0x41'),null,_0x920d('0x37')+_0x568336+_0x920d('0x38'))[_0x920d('0x11')](_0x5a8371,null,_0x5a8371+'.id\x20=\x20'+_0x568336+'.'+_0x29714c)[_0x920d('0x11')](_0x234244,null,_0x234244+'.id\x20=\x20'+_0x568336+'.'+_0x29714c)['where'](_0x568336+_0x920d('0x42'),_0x240c74)[_0x920d('0x14')](_0x920d('0x39'),NOW)[_0x920d('0x14')](_0x920d('0x3a'),selectNotIn(_0x568336,_0x5a8371,_0x29714c,_0x920d('0x2e'),['\x22always\x22',_0x920d('0x3c')]))[_0x920d('0x14')](_0x920d('0x3a'),selectNotIn(_0x568336,_0x5a8371,_0x29714c,'cm_hopper',[_0x920d('0x3b')])))['toString']();return _0x169d85;}function insertTzCmHopperBlack(_0x5ea3ce,_0x49f9f0,_0x500cd4,_0x244752){var _0x5653ab=['cm_contacts.phone',_0x920d('0x3e'),_0x920d('0x27'),_0x49f9f0+'.'+_0x244752,_0x920d('0x28'),_0x920d('0x29')];return squel[_0x920d('0x2c')]()[_0x920d('0x2d')](_0x920d('0x3f'))[_0x920d('0x2f')]([_0x920d('0x30'),_0x920d('0x32'),_0x920d('0x33'),_0x244752,_0x920d('0x34'),_0x920d('0x40')],squel[_0x920d('0xe')]()[_0x920d('0x45')](_0x5653ab)[_0x920d('0x10')](_0x49f9f0)[_0x920d('0x11')](_0x920d('0x41'),null,_0x920d('0x37')+_0x49f9f0+'.CmListId')[_0x920d('0x11')](_0x500cd4,null,_0x500cd4+_0x920d('0x12')+_0x49f9f0+'.'+_0x244752)[_0x920d('0x14')](_0x49f9f0+_0x920d('0x42'),_0x5ea3ce)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x920d('0x14')](_0x920d('0x3a'),squel[_0x920d('0xe')]()[_0x920d('0xf')](_0x920d('0x30'))[_0x920d('0x10')](_0x920d('0x3f'))['where']('ListId\x20=\x20?',_0x5ea3ce)[_0x920d('0x14')](_0x244752+_0x920d('0x13')+_0x49f9f0+'.'+_0x244752)))[_0x920d('0x3d')]();}function insertCmHopperAdditionalPhones(_0x399ff4){var _0x214ee8=[_0x920d('0x46'),_0x920d('0x47'),'cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt'];return squel[_0x920d('0x2c')]()[_0x920d('0x2d')](_0x920d('0x48'))[_0x920d('0x2f')](['CmHopperId',_0x920d('0x30'),_0x920d('0x49'),_0x920d('0x34'),_0x920d('0x40')],squel[_0x920d('0xe')]()[_0x920d('0x45')](_0x214ee8)['from']('cm_hopper')[_0x920d('0x11')](_0x920d('0x41'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x920d('0x11')](_0x920d('0x4a'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0x920d('0x14')](_0x920d('0x4b'),_0x399ff4)['where']('cm_contacts.createdAt\x20=\x20?',NOW))['toString']();}function insertCmContact(_0x5aae9e,_0x2e7743,_0xc9c64f,_0x422155){var _0x3b2454=_[_0x920d('0x4c')](_['keys'](_0x422155),['ListId',_0x920d('0x4d'),'createdAt','updatedAt']);return squel[_0x920d('0x2c')]()[_0x920d('0x2d')](_0x920d('0x41'))[_0x920d('0x2f')](_0x3b2454,squel[_0x920d('0xe')]()['fields'](_0x3b2454)[_0x920d('0x10')](_0x2e7743)[_0x920d('0x14')]('('+_0xc9c64f[_0x920d('0x11')](',')+_0x920d('0x4e'),squel['select']()[_0x920d('0x45')](_0xc9c64f)[_0x920d('0x10')](_0x920d('0x41'))[_0x920d('0x14')](_0x920d('0x4f'),_0x5aae9e)[_0x920d('0x14')](_0x920d('0x50')))[_0x920d('0x14')](_0x920d('0x51'),squel[_0x920d('0xe')]()['field']('MIN(id)','min_id')[_0x920d('0x10')](_0x2e7743)['group'](_0xc9c64f[_0x920d('0x11')](','))))['toString']();}function handleStop(){logger['info'](_0x920d('0x52'));stopped=!![];}function handleUncaughtException(_0x30f988){logger[_0x920d('0x53')](_0x30f988[_0x920d('0x54')]);process['exit'](0x1);}function handleError(_0x3a7d40,_0x2f9b81){stats[_0x920d('0x55')][_0x920d('0x19')]({'name':_0x2f9b81[_0x920d('0x56')],'message':_0x2f9b81[_0x920d('0x54')],'row':_0x3a7d40});}function handleQuery(_0x33d171){logger[_0x920d('0x57')](_0x33d171);return db['sequelize'][_0x920d('0x58')](_0x33d171)[_0x920d('0x59')](function(_0x1ff6de){results[_0x920d('0x19')](_0x1ff6de);})[_0x920d('0x5a')](function(_0x34e00b){logger[_0x920d('0x53')](_0x34e00b[_0x920d('0x54')]);});}function updateTzCampaigns(_0x3d794c){return new Promise(function(_0x88393d,_0x3a6c02){var _0x35b8cb=squel[_0x920d('0xe')]()['fields']([_0x920d('0x5b'),'campaigns.dialTimezone'])[_0x920d('0x10')]('campaigns')['join']('campaigns_has_cm_lists',null,_0x920d('0x5c'))['where'](_0x920d('0x5d')+_0x3d794c);db[_0x920d('0x5e')]['query'](_0x35b8cb[_0x920d('0x3d')]())[_0x920d('0x59')](function(_0x1116fb){var _0x1fa3a3=[];for(var _0x50f1b8=0x0;_0x50f1b8<_0x1116fb['length'];_0x50f1b8++){_0x1fa3a3[_0x920d('0x19')](getTimezoneData(_0x1116fb[_0x50f1b8],tmp_campaigns));}BPromise['all'](_0x1fa3a3)['then'](function(){_0x88393d({'val':0x1});});})['catch'](function(_0x424796){logger[_0x920d('0x53')](_0x424796[_0x920d('0x54')]);_0x88393d({'val':0x0});});});}function updateTzVoiceQueues(_0x6562a7){return new Promise(function(_0x1590a2,_0x3b803e){var _0x2171c9=squel[_0x920d('0xe')]()[_0x920d('0x45')]([_0x920d('0x5f'),_0x920d('0x60')])[_0x920d('0x10')](_0x920d('0x61'))[_0x920d('0x11')](_0x920d('0x62'),null,_0x920d('0x63'))[_0x920d('0x14')](_0x920d('0x64')+_0x6562a7);db[_0x920d('0x5e')]['query'](_0x2171c9[_0x920d('0x3d')]())[_0x920d('0x59')](function(_0x5ed89e){var _0x541b31=[];for(var _0x4c909c=0x0;_0x4c909c<_0x5ed89e['length'];_0x4c909c++){_0x541b31[_0x920d('0x19')](getTimezoneData(_0x5ed89e[_0x4c909c],tmp_voice_queues));}BPromise[_0x920d('0x1a')](_0x541b31)['then'](function(){_0x1590a2({'val':0x1});});})[_0x920d('0x5a')](function(_0x24c379){logger['error'](_0x24c379[_0x920d('0x54')]);_0x1590a2({'val':0x0});});});}function getTimezoneData(_0xa64524,_0x288912){return new Promise(function(_0x199c0c,_0xf494a5){var _0x593fc4=shared[_0x920d('0x65')];var _0x4fd23f=_0x593fc4[_0xa64524[_0x920d('0x66')]];if(_[_0x920d('0x1e')](_0x4fd23f)){_0x199c0c({'ret':0x1});}else{var _0x5d162c=_0x4fd23f['utcOffset'];var _0x3a04b8=squel[_0x920d('0x2c')]()['into'](_0x288912)['set']('id',_0xa64524['id'])[_0x920d('0x67')](_0x920d('0x68'),_0x5d162c)[_0x920d('0x67')](_0x920d('0x66'),_0xa64524[_0x920d('0x66')])['toString']();return db['sequelize'][_0x920d('0x58')](_0x3a04b8)[_0x920d('0x59')](function(_0x3fe847){_0x199c0c({'ret':0x1});})[_0x920d('0x5a')](function(_0x593f8c){logger[_0x920d('0x53')](_0x593f8c[_0x920d('0x54')]);_0xf494a5({'ret':0x1});});}});}function handleTZQuery(_0x3ee1b2){logger[_0x920d('0x57')](_0x3ee1b2);return db[_0x920d('0x5e')][_0x920d('0x58')](_0x3ee1b2)[_0x920d('0x59')](function(_0x5eb5a0){})[_0x920d('0x5a')](function(_0x32837b){logger['error'](_0x32837b[_0x920d('0x54')]);});}function main(_0x4cd306,_0x51fd52,_0x32f5fa,_0x4c781d){logger[_0x920d('0x57')](_0x920d('0x69'),_0x4cd306,JSON[_0x920d('0x6a')](_0x51fd52));process[_0x920d('0x6b')](_0x920d('0x6c'));var _0x319a92=_0x51fd52[_0x920d('0x6d')];var _0x2137d3=_['clone'](_0x319a92);var _0x1df43a=_0x51fd52['socket_timestamp'];var _0x12f4b5=path['join'](config[_0x920d('0x6e')],'server/files/tmp',_0x1df43a+_0x920d('0x6f'));hasTZ=_[_0x920d('0x70')](_0x319a92)[_0x920d('0x71')]('dialTimezone');var _0x4eb03e=_[_0x920d('0x70')](_0x319a92)[_0x920d('0x11')]();logger[_0x920d('0x57')](_0x920d('0x72'),_0x4eb03e);db[_0x920d('0x73')][_0x920d('0x17')]({'raw':!![],'attributes':['id',_0x920d('0x74')]})['then'](function(_0x35521d){for(var _0x4ab1c4=0x0;_0x4ab1c4<_0x35521d['length'];_0x4ab1c4++){if(_0x35521d[_0x4ab1c4][_0x920d('0x74')]in _0x319a92){contactItemTypes[_0x920d('0x19')](_0x35521d[_0x4ab1c4]);delete _0x2137d3[_0x35521d[_0x4ab1c4]['name']];hasAdditionalPhones=!![];}for(var _0x497a63 in _0x319a92){if(_0x35521d[_0x4ab1c4][_0x920d('0x74')]+'_description'===_0x497a63){phoneDescriptions['push']({'itemTypeId':_0x35521d[_0x4ab1c4]['id'],'description':_0x497a63});delete _0x2137d3[_0x497a63];}}}if(hasAdditionalPhones)_0x2137d3[_0x920d('0x1c')]='';var _0x53be7c=_[_0x920d('0x70')](_0x2137d3)[_0x920d('0x11')]();logger[_0x920d('0x57')]('header',_0x53be7c);fs[_0x920d('0x75')](_0x12f4b5,_0x53be7c+'\x0a');Papa[_0x920d('0x76')](fs['createReadStream'](_0x4cd306),{'header':!![],'skipEmptyLines':!![],'step':function(_0x330b61,_0x397bc3){try{for(var _0x124dea=0x0,_0x18e57e=[];_0x124dea<_0x330b61[_0x920d('0x77')][_0x920d('0x18')];_0x124dea++){stats[_0x920d('0x78')]+=0x1;if(_0x330b61[_0x920d('0x55')][_0x124dea]){handleError(_0x330b61['data'][_0x124dea],_0x330b61[_0x920d('0x55')][_0x124dea]);}else{var _0x1bbedb=[];var _0x4dd968=[];var _0x3ac114={};for(var _0x59cf8e in _0x319a92){let _0xa12fad=contactItemTypes[_0x920d('0x79')](_0x208ae0=>_0x208ae0['name']===_0x59cf8e);let _0xa5ba80=contactItemTypes['find'](_0x325a80=>_0x325a80['name']+'_description'===_0x59cf8e);if(_['isNil'](_0xa12fad)&&_[_0x920d('0x1e')](_0xa5ba80)){if(_0x319a92[_0x920d('0x7a')](_0x59cf8e)){if(_0x330b61[_0x920d('0x77')][_0x124dea][_0x319a92[_0x59cf8e]]){var _0x457e73=_[_0x920d('0x7b')](_0x330b61[_0x920d('0x77')][_0x124dea][_0x319a92[_0x59cf8e]]['replace'](/"/g,'\x27'));switch(_0x59cf8e){case _0x920d('0x31'):var _0x53fc37=moment(_0x457e73,_0x920d('0x7c'),!![]);if(_0x53fc37[_0x920d('0x7d')]()){_0x18e57e[_0x920d('0x19')]('\x22'+_0x457e73+'\x22');}else{_0x1bbedb['push'](_0x920d('0x7e'));}break;case _0x920d('0x44'):var _0x51dcf7=parseInt(_0x457e73);_0x457e73=_['isNaN'](_0x51dcf7)||_0x51dcf7<0x0||_0x51dcf7>0x4?_0x4c781d?0x3:0x2:_0x51dcf7;_0x18e57e[_0x920d('0x19')]('\x22'+_0x457e73+'\x22');break;case'UserId':var _0xfbd3e1=parseInt(_0x457e73);if(_[_0x920d('0x7f')](_0xfbd3e1)&&_[_0x920d('0x71')](_0x32f5fa,_0xfbd3e1)){_0x18e57e[_0x920d('0x19')]('\x22'+_0xfbd3e1+'\x22');}else{_0x1bbedb[_0x920d('0x19')](_0x920d('0x80'));}break;case _0x920d('0x81'):if(isEmail(_0x457e73)){_0x18e57e['push']('\x22'+_0x457e73+'\x22');}else{_0x1bbedb[_0x920d('0x19')](_0x920d('0x82'));}break;case _0x920d('0x83'):var _0x31ed5a=moment(_0x457e73,'YYYY-MM-DD',!![]);if(_0x31ed5a[_0x920d('0x7d')]()){_0x18e57e[_0x920d('0x19')]('\x22'+_0x457e73+'\x22');}else{_0x1bbedb[_0x920d('0x19')](_0x920d('0x84'));}break;case _0x920d('0x66'):var _0x51648b=shared[_0x920d('0x65')];var _0x2f7638=_0x51648b[_0x457e73];if(!_[_0x920d('0x1e')](_0x2f7638)){var _0x54d506=_0x2f7638[_0x920d('0x85')];_0x18e57e[_0x920d('0x19')]('\x22'+_0x457e73+'\x22');_0x18e57e[_0x920d('0x19')]('\x22'+_0x54d506+'\x22');}break;default:_0x18e57e[_0x920d('0x19')]('\x22'+_0x457e73+'\x22');}}else{switch(_0x59cf8e){case _0x920d('0x86'):case'phone':_0x1bbedb['push'](_0x59cf8e+'\x20not\x20specified');break;default:_0x18e57e['push']('\x22\x22');}}}}else{var _0x35599b='';if(!_[_0x920d('0x1e')](_0xa12fad)){if(!_0x3ac114['hasOwnProperty'](_0xa12fad['id'])){if(!_['isNil'](_0x330b61[_0x920d('0x77')][_0x124dea][_0x319a92[_0x59cf8e]])){var _0x457e73=_[_0x920d('0x7b')](_0x330b61['data'][_0x124dea][_0x319a92[_0x59cf8e]][_0x920d('0x87')](/"/g,'\x27'));var _0x5e5291=phoneDescriptions['find'](_0x4ac3fc=>_0x4ac3fc[_0x920d('0x88')]===_0xa12fad['id']);if(!_[_0x920d('0x1e')](_0x5e5291)){var _0x16fc08=_[_0x920d('0x7b')](_0x330b61[_0x920d('0x77')][_0x124dea][_0x319a92[_0x5e5291['description']]][_0x920d('0x87')](/"/g,'\x27'));if(!_['isNil'](_0x16fc08))_0x457e73=_0x457e73+'§'+_0x16fc08;}if(_0x35599b=='')_0x35599b=_0x457e73;else _0x35599b+='|'+_0x457e73;}_0x4dd968['push'](_0xa12fad['id']+':'+_0x35599b);_0x3ac114[_0xa12fad['id']]=0x1;}}}}if(hasAdditionalPhones){_0x18e57e[_0x920d('0x19')]('\x22'+_0x4dd968[_0x920d('0x11')](';')+'\x22');}if(_0x1bbedb[_0x920d('0x18')]){handleError(_0x330b61['data'][_0x124dea],{'code':_0x920d('0x89'),'message':_0x1bbedb[_0x920d('0x11')]()});}else{fs[_0x920d('0x8a')](_0x12f4b5,_0x18e57e['join']()+'\x0a');}_0x18e57e=[];}if(!(stats[_0x920d('0x78')]%0xc8)){socket[_0x920d('0x8b')](_0x920d('0x8c')+_0x1df43a,stats);stats[_0x920d('0x55')]=[];}}if(stopped){logger[_0x920d('0x57')]('Abort\x20parser');_0x397bc3['abort']();}}catch(_0x5b542f){handleError(_0x330b61[_0x920d('0x77')][_0x124dea],{'code':_0x920d('0x8d'),'message':_0x5b542f['message']});logger[_0x920d('0x53')](_0x920d('0x8e'),_0x5b542f['message']);}},'complete':function(){try{var _0x48d526=[];var _0x42f906=[];var _0x49aef2=_0x920d('0x41');if(_0x51fd52[_0x920d('0x8f')]&&_0x51fd52['duplicates'][_0x920d('0x18')]){_0x49aef2=_0x920d('0x90')+_0x1df43a;_0x48d526[_0x920d('0x19')]('CREATE\x20TABLE\x20'+_0x49aef2+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0x920d('0x91')+_0x1df43a;tmp_voice_queues=_0x920d('0x92')+_0x1df43a;_0x42f906[_0x920d('0x19')](_0x920d('0x93')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x42f906[_0x920d('0x19')]('CREATE\x20TABLE\x20'+tmp_voice_queues+_0x920d('0x94'));BPromise[_0x920d('0x95')](_0x42f906,handleTZQuery)[_0x920d('0x1b')](function(_0x569bae){updateTzCampaigns(_0x51fd52[_0x920d('0x33')])[_0x920d('0x1b')](function(_0x2a5bfc){updateTzVoiceQueues(_0x51fd52[_0x920d('0x33')])[_0x920d('0x1b')](function(_0x3a2db0){if(hasTZ)_0x53be7c=_0x53be7c[_0x920d('0x87')](_0x920d('0x66'),_0x920d('0x96'));var _0x2014df=util['format'](_0x920d('0x97'),_0x12f4b5,_0x49aef2,_0x53be7c,_0x51fd52[_0x920d('0x33')],_0x51fd52[_0x920d('0x4d')]||null,NOW,NOW);if(_[_0x920d('0x1e')](_0x319a92[_0x920d('0x31')])){_0x2014df+=_0x920d('0x98');}_0x48d526['push'](_0x2014df);if(_0x51fd52[_0x920d('0x8f')]&&_0x51fd52[_0x920d('0x8f')][_0x920d('0x18')]){_0x48d526['push'](insertCmContact(_0x51fd52[_0x920d('0x33')],_0x49aef2,_0x51fd52[_0x920d('0x8f')],_0x319a92));_0x48d526[_0x920d('0x19')](_0x920d('0x99')+_0x49aef2+';');}BPromise[_0x920d('0x95')](_0x48d526,handleQuery)['then'](function(_0x3dd8e8){BPromise[_0x920d('0x1a')]([handleAdditionalPhones()])['then'](function(){_0x48d526=[];for(var _0x3be1c6=0x0;_0x3be1c6\x20\x20','server/files/tmp','file\x20doesn\x27t\x20exists','binding','phone\x20is\x20mandatory','firstName','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','No\x20agent\x20available','SIGINT','lodash','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment/shared','../../../config/logger','import','redis','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','format','select','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','then','push','all','AdditionalPhones','length','split','isNil','filter','findOne','CmContactHasItem','updated','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_hopper','fromQuery','scheduledat','ContactId','createdAt','updatedAt','priority','recallme','fields','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','insert','cm_hopper_black','phone','ListId','field','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','UserId','into','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_hopper.ListId\x20=\x20?','keys',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','group','info','Received\x20SIGINT','error','message','exit','errors','code','sequelize','query','spread','catch','campaigns.id','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','dialTimezone','utcOffset','set','offset','main','stringify','send','start','clone','socket_timestamp','root','includes','header','name','_description','parse','data','rows','find','hasOwnProperty','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','email','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','description','SystemRow','appendFileSync','contact:import:','Abort\x20parser','abort','SystemError','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','CREATE\x20TABLE\x20','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId','contactId'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb786,0xc1));var _0x6b78=function(_0x3fe6df,_0x5a04d4){_0x3fe6df=_0x3fe6df-0x0;var _0x372a0e=_0xb786[_0x3fe6df];return _0x372a0e;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x6b78('0x0'));var Papa=require('papaparse');var util=require('util');var BPromise=require(_0x6b78('0x1'));var moment=require(_0x6b78('0x2'));var squel=require('squel');var Redis=require(_0x6b78('0x3'));var db=require(_0x6b78('0x4'))['db'];var config=require('../../../config/environment');var shared=require(_0x6b78('0x5'));var logger=require(_0x6b78('0x6'))(_0x6b78('0x7'));config[_0x6b78('0x8')]=_['defaults'](config[_0x6b78('0x8')],{'host':_0x6b78('0x9'),'port':0x18eb});var socket=require(_0x6b78('0xa'))(new Redis(config[_0x6b78('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format'](_0x6b78('0xb'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x6b78('0xc')](_0x6b78('0xb'));function isEmail(_0x33b7d0){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'](_0x33b7d0);}function selectNotIn(_0x4cedf7,_0x34feca,_0x57dea6,_0xd6ba8a,_0x3b8171){return squel[_0x6b78('0xd')]()['field']('phone')['from'](_0xd6ba8a)[_0x6b78('0xe')](_0x34feca,null,_0x34feca+_0x6b78('0xf')+_0xd6ba8a+'.'+_0x57dea6)[_0x6b78('0x10')](_0xd6ba8a+'.'+_0x57dea6+_0x6b78('0x11')+_0x4cedf7+'.'+_0x57dea6)[_0x6b78('0x10')](_0x34feca+_0x6b78('0x12')+_0x3b8171['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x2387d6,_0x5ba7b1){promisesAdditionalPhones=[];return db['CmContact']['findAll']({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x6b78('0x13')](function(_0x4a6912){if(_0x4a6912!==null){var _0x4c8803=[];for(var _0x38469b=0x0;_0x38469b<_0x4a6912['length'];_0x38469b++){var _0x38a15f=_0x4a6912[_0x38469b];_0x4c8803[_0x6b78('0x14')](insertAdditionalPhones(_0x38a15f));}}Promise[_0x6b78('0x15')](_0x4c8803)[_0x6b78('0x13')](function(){_0x2387d6({'val':0x1});});});});}function insertAdditionalPhones(_0x4d1d2d){return new Promise(function(_0x9ffd17,_0x1ed603){var _0x3a2d31=_0x4d1d2d[_0x6b78('0x16')];var _0x513111=_0x3a2d31['split'](';');var _0x1bb3f0=[];orderBy=0x0;for(var _0x13d044=0x0;_0x13d044<_0x513111[_0x6b78('0x17')];_0x13d044++){_0x1bb3f0[_0x6b78('0x14')](splitAdditionalPhone(_0x4d1d2d['id'],_0x513111[_0x13d044]));}Promise[_0x6b78('0x15')](_0x1bb3f0)[_0x6b78('0x13')](function(){_0x9ffd17({'val':_0x513111[_0x6b78('0x17')]});});});}function splitAdditionalPhone(_0x5be07a,_0x4cf78d){return new Promise(function(_0x43897f,_0x265d84){var _0x353ee9=_0x4cf78d[_0x6b78('0x18')](':');var _0x2fb749=_0x353ee9[0x0];var _0x187ae6=_0x353ee9[0x1];if(!_[_0x6b78('0x19')](_0x187ae6)){var _0x108843=_0x187ae6[_0x6b78('0x18')]('|');var _0x151241=[];for(var _0x4d83e4=0x0;_0x4d83e4<_0x108843['length'];_0x4d83e4++){if(_0x108843[_0x4d83e4]!==''){var _0x211362=_[_0x6b78('0x1a')](promisesAdditionalPhones,{'contactId':_0x5be07a,'phone':_0x108843[_0x4d83e4]});if(_0x211362['length']==0x0){orderBy++;promisesAdditionalPhones[_0x6b78('0x14')]({'contactId':_0x5be07a,'contactTypeId':_0x2fb749,'phone':_0x108843[_0x4d83e4],'orderBy':orderBy});}}}_0x43897f({'ok':0x1});}else _0x43897f({'res':0x0});});}function createAdditionalPhone(_0x277d7a,_0x57d493,_0x2b45c5,_0x413f1b){var _0x417ff7='';var _0x5abc52='';var _0x4c8e1e=_0x2b45c5[_0x6b78('0x18')]('§');_0x417ff7=_0x4c8e1e[0x0];if(_0x4c8e1e['length']==0x2)_0x5abc52=_0x4c8e1e[0x1];return new Promise(function(_0xae414c,_0x5b6318){return db['CmContactHasItem'][_0x6b78('0x1b')]({'where':{'CmContactId':_0x277d7a,'item':_0x417ff7}})[_0x6b78('0x13')](function(_0x4c150f){if(_0x4c150f){return db[_0x6b78('0x1c')]['update']({'ItemTypeId':_0x57d493,'description':_0x5abc52,'OrderBy':_0x413f1b},{'where':{'CmContactId':_0x277d7a,'item':_0x417ff7}})['then'](function(_0x27c0c1){_0xae414c({'res':_0x6b78('0x1d')});});}else{return db[_0x6b78('0x1c')]['create']({'CmContactId':_0x277d7a,'item':_0x417ff7,'description':_0x5abc52,'ItemTypeId':_0x57d493,'OrderBy':_0x413f1b,'ItemClass':'PHONE'})['then'](function(_0x4c29ae){_0xae414c({'res':_0x6b78('0x1e')});});}});});}function insertCmHopper(_0x16c9af,_0x552489,_0x2304bf,_0x44a346,_0x17492c){var _0x3f6fb0=[_0x6b78('0x1f'),_0x6b78('0x20'),_0x6b78('0x21'),_0x6b78('0x22'),_0x552489+'.'+_0x44a346,_0x6b78('0x23'),_0x6b78('0x24'),_0x6b78('0x25'),'cm_contacts.UserId','\x22'+_0x17492c+'\x22'];return squel['insert']()['into'](_0x6b78('0x26'))[_0x6b78('0x27')](['phone',_0x6b78('0x28'),_0x6b78('0x29'),'ListId',_0x44a346,_0x6b78('0x2a'),_0x6b78('0x2b'),_0x6b78('0x2c'),'UserId',_0x6b78('0x2d')],squel[_0x6b78('0xd')]()[_0x6b78('0x2e')](_0x3f6fb0)[_0x6b78('0x2f')](_0x552489)[_0x6b78('0xe')](_0x6b78('0x30'),null,_0x6b78('0x31')+_0x552489+_0x6b78('0x32'))[_0x6b78('0xe')](_0x2304bf,null,_0x2304bf+_0x6b78('0xf')+_0x552489+'.'+_0x44a346)['where'](_0x552489+_0x6b78('0x33'),_0x16c9af)[_0x6b78('0x10')](_0x6b78('0x34'),NOW)[_0x6b78('0x10')](_0x6b78('0x35'),selectNotIn(_0x552489,_0x2304bf,_0x44a346,_0x6b78('0x26'),[_0x6b78('0x36'),'\x22onlyIfOpen\x22']))[_0x6b78('0x10')](_0x6b78('0x35'),selectNotIn(_0x552489,_0x2304bf,_0x44a346,_0x6b78('0x26'),['\x22always\x22'])))[_0x6b78('0x37')]();}function insertCmHopperBlack(_0x26767e,_0x220939,_0x2bc06b,_0x55ea4a){var _0x2a0779=['cm_contacts.phone',_0x6b78('0x21'),_0x6b78('0x22'),_0x220939+'.'+_0x55ea4a,'cm_contacts.createdAt',_0x6b78('0x24')];return squel[_0x6b78('0x38')]()['into'](_0x6b78('0x39'))[_0x6b78('0x27')]([_0x6b78('0x3a'),_0x6b78('0x29'),_0x6b78('0x3b'),_0x55ea4a,'createdAt',_0x6b78('0x2b')],squel[_0x6b78('0xd')]()[_0x6b78('0x2e')](_0x2a0779)['from'](_0x220939)[_0x6b78('0xe')](_0x6b78('0x30'),null,_0x6b78('0x31')+_0x220939+_0x6b78('0x32'))[_0x6b78('0xe')](_0x2bc06b,null,_0x2bc06b+_0x6b78('0xf')+_0x220939+'.'+_0x55ea4a)['where'](_0x220939+_0x6b78('0x33'),_0x26767e)['where'](_0x6b78('0x34'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x6b78('0xd')]()[_0x6b78('0x3c')](_0x6b78('0x3a'))[_0x6b78('0x2f')](_0x6b78('0x39'))['where']('ListId\x20=\x20?',_0x26767e)[_0x6b78('0x10')](_0x55ea4a+_0x6b78('0x11')+_0x220939+'.'+_0x55ea4a)))[_0x6b78('0x37')]();}function insertTzCmHopper(_0x24a587,_0x5d54a0,_0x192575,_0x1e6091,_0x37c7c4,_0x5416e9){var _0x2d714f=[_0x6b78('0x1f'),_0x6b78('0x3d')+_0x5416e9+_0x6b78('0x3e'),_0x6b78('0x21'),_0x6b78('0x22'),_0x5d54a0+'.'+_0x1e6091,'cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','\x22'+_0x37c7c4+'\x22'];var _0x40aea6=squel[_0x6b78('0x38')]()['into']('cm_hopper')[_0x6b78('0x27')]([_0x6b78('0x3a'),_0x6b78('0x28'),'ContactId',_0x6b78('0x3b'),_0x1e6091,_0x6b78('0x2a'),_0x6b78('0x2b'),_0x6b78('0x2c'),_0x6b78('0x3f'),_0x6b78('0x2d')],squel[_0x6b78('0xd')]()[_0x6b78('0x2e')](_0x2d714f)[_0x6b78('0x2f')](_0x5d54a0)[_0x6b78('0xe')](_0x6b78('0x30'),null,_0x6b78('0x31')+_0x5d54a0+_0x6b78('0x32'))[_0x6b78('0xe')](_0x192575,null,_0x192575+_0x6b78('0xf')+_0x5d54a0+'.'+_0x1e6091)[_0x6b78('0xe')](_0x5416e9,null,_0x5416e9+_0x6b78('0xf')+_0x5d54a0+'.'+_0x1e6091)[_0x6b78('0x10')](_0x5d54a0+_0x6b78('0x33'),_0x24a587)[_0x6b78('0x10')](_0x6b78('0x34'),NOW)[_0x6b78('0x10')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x5d54a0,_0x192575,_0x1e6091,_0x6b78('0x26'),[_0x6b78('0x36'),'\x22onlyIfOpen\x22']))['where'](_0x6b78('0x35'),selectNotIn(_0x5d54a0,_0x192575,_0x1e6091,_0x6b78('0x26'),[_0x6b78('0x36')])))['toString']();return _0x40aea6;}function insertTzCmHopperBlack(_0x11f556,_0x219f09,_0x520c9c,_0x5523df){var _0x36b474=[_0x6b78('0x1f'),_0x6b78('0x21'),'cm_contacts.ListId',_0x219f09+'.'+_0x5523df,_0x6b78('0x23'),_0x6b78('0x24')];return squel[_0x6b78('0x38')]()[_0x6b78('0x40')](_0x6b78('0x39'))['fromQuery']([_0x6b78('0x3a'),_0x6b78('0x29'),_0x6b78('0x3b'),_0x5523df,_0x6b78('0x2a'),_0x6b78('0x2b')],squel[_0x6b78('0xd')]()['fields'](_0x36b474)[_0x6b78('0x2f')](_0x219f09)[_0x6b78('0xe')](_0x6b78('0x30'),null,_0x6b78('0x31')+_0x219f09+_0x6b78('0x32'))['join'](_0x520c9c,null,_0x520c9c+_0x6b78('0xf')+_0x219f09+'.'+_0x5523df)[_0x6b78('0x10')](_0x219f09+'.CmListId\x20=\x20?',_0x11f556)[_0x6b78('0x10')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x6b78('0x10')](_0x6b78('0x35'),squel[_0x6b78('0xd')]()[_0x6b78('0x3c')](_0x6b78('0x3a'))[_0x6b78('0x2f')](_0x6b78('0x39'))[_0x6b78('0x10')]('ListId\x20=\x20?',_0x11f556)[_0x6b78('0x10')](_0x5523df+_0x6b78('0x11')+_0x219f09+'.'+_0x5523df)))[_0x6b78('0x37')]();}function insertCmHopperAdditionalPhones(_0x2d4b49){var _0x3f0b92=[_0x6b78('0x41'),_0x6b78('0x42'),_0x6b78('0x43'),_0x6b78('0x44'),_0x6b78('0x45')];return squel[_0x6b78('0x38')]()[_0x6b78('0x40')]('cm_hopper_additional_phones')[_0x6b78('0x27')]([_0x6b78('0x46'),_0x6b78('0x3a'),_0x6b78('0x47'),_0x6b78('0x2a'),_0x6b78('0x2b')],squel[_0x6b78('0xd')]()['fields'](_0x3f0b92)[_0x6b78('0x2f')]('cm_hopper')[_0x6b78('0xe')](_0x6b78('0x30'),null,_0x6b78('0x48'))[_0x6b78('0xe')](_0x6b78('0x49'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0x6b78('0x10')](_0x6b78('0x4a'),_0x2d4b49)[_0x6b78('0x10')](_0x6b78('0x34'),NOW))[_0x6b78('0x37')]();}function insertCmContact(_0x13c3e5,_0x1f308c,_0x4d7af4,_0x41f4d6){var _0x1ee6df=_['concat'](_[_0x6b78('0x4b')](_0x41f4d6),[_0x6b78('0x3b'),'CompanyId',_0x6b78('0x2a'),_0x6b78('0x2b')]);return squel[_0x6b78('0x38')]()[_0x6b78('0x40')](_0x6b78('0x30'))['fromQuery'](_0x1ee6df,squel['select']()[_0x6b78('0x2e')](_0x1ee6df)[_0x6b78('0x2f')](_0x1f308c)[_0x6b78('0x10')]('('+_0x4d7af4['join'](',')+_0x6b78('0x4c'),squel[_0x6b78('0xd')]()[_0x6b78('0x2e')](_0x4d7af4)['from'](_0x6b78('0x30'))[_0x6b78('0x10')](_0x6b78('0x4d'),_0x13c3e5)[_0x6b78('0x10')](_0x6b78('0x4e')))[_0x6b78('0x10')](_0x6b78('0x4f'),squel['select']()['field'](_0x6b78('0x50'),'min_id')[_0x6b78('0x2f')](_0x1f308c)[_0x6b78('0x51')](_0x4d7af4[_0x6b78('0xe')](','))))[_0x6b78('0x37')]();}function handleStop(){logger[_0x6b78('0x52')](_0x6b78('0x53'));stopped=!![];}function handleUncaughtException(_0x37780f){logger[_0x6b78('0x54')](_0x37780f[_0x6b78('0x55')]);process[_0x6b78('0x56')](0x1);}function handleError(_0x319927,_0x58ec3f){stats[_0x6b78('0x57')][_0x6b78('0x14')]({'name':_0x58ec3f[_0x6b78('0x58')],'message':_0x58ec3f['message'],'row':_0x319927});}function handleQuery(_0x2d67f9){logger[_0x6b78('0x52')](_0x2d67f9);return db[_0x6b78('0x59')][_0x6b78('0x5a')](_0x2d67f9)[_0x6b78('0x5b')](function(_0x5d5d7f){results[_0x6b78('0x14')](_0x5d5d7f);})[_0x6b78('0x5c')](function(_0x3b882c){logger[_0x6b78('0x54')](_0x3b882c[_0x6b78('0x55')]);});}function updateTzCampaigns(_0x37b658){return new Promise(function(_0x2dac8c,_0x4c4c57){var _0x3a0479=squel[_0x6b78('0xd')]()[_0x6b78('0x2e')]([_0x6b78('0x5d'),'campaigns.dialTimezone'])[_0x6b78('0x2f')](_0x6b78('0x5e'))['join']('campaigns_has_cm_lists',null,_0x6b78('0x5f'))[_0x6b78('0x10')]('campaigns_has_cm_lists.CmListId='+_0x37b658);db[_0x6b78('0x59')][_0x6b78('0x5a')](_0x3a0479[_0x6b78('0x37')]())[_0x6b78('0x5b')](function(_0x34d4a9){var _0x5f53e0=[];for(var _0x3944a3=0x0;_0x3944a3<_0x34d4a9[_0x6b78('0x17')];_0x3944a3++){_0x5f53e0[_0x6b78('0x14')](getTimezoneData(_0x34d4a9[_0x3944a3],tmp_campaigns));}BPromise[_0x6b78('0x15')](_0x5f53e0)[_0x6b78('0x13')](function(){_0x2dac8c({'val':0x1});});})['catch'](function(_0x5d633e){logger['error'](_0x5d633e[_0x6b78('0x55')]);_0x2dac8c({'val':0x0});});});}function updateTzVoiceQueues(_0xe54310){return new Promise(function(_0x29b577,_0x22bf22){var _0x360e47=squel['select']()[_0x6b78('0x2e')](['voice_queues.id',_0x6b78('0x60')])['from'](_0x6b78('0x61'))[_0x6b78('0xe')](_0x6b78('0x62'),null,_0x6b78('0x63'))[_0x6b78('0x10')]('voice_queues_has_cm_lists.CmListId='+_0xe54310);db['sequelize'][_0x6b78('0x5a')](_0x360e47['toString']())[_0x6b78('0x5b')](function(_0xd21b79){var _0x2791ac=[];for(var _0x41f153=0x0;_0x41f153<_0xd21b79[_0x6b78('0x17')];_0x41f153++){_0x2791ac[_0x6b78('0x14')](getTimezoneData(_0xd21b79[_0x41f153],tmp_voice_queues));}BPromise[_0x6b78('0x15')](_0x2791ac)[_0x6b78('0x13')](function(){_0x29b577({'val':0x1});});})[_0x6b78('0x5c')](function(_0x361cc7){logger[_0x6b78('0x54')](_0x361cc7['message']);_0x29b577({'val':0x0});});});}function getTimezoneData(_0x43ec27,_0x305ac3){return new Promise(function(_0xd12edb,_0x231e89){var _0x360799=shared['timezones'];var _0x9a6c93=_0x360799[_0x43ec27[_0x6b78('0x64')]];if(_[_0x6b78('0x19')](_0x9a6c93)){_0xd12edb({'ret':0x1});}else{var _0x18e1f4=_0x9a6c93[_0x6b78('0x65')];var _0x86fb10=squel[_0x6b78('0x38')]()[_0x6b78('0x40')](_0x305ac3)[_0x6b78('0x66')]('id',_0x43ec27['id'])[_0x6b78('0x66')](_0x6b78('0x67'),_0x18e1f4)['set']('dialTimezone',_0x43ec27[_0x6b78('0x64')])[_0x6b78('0x37')]();return db[_0x6b78('0x59')][_0x6b78('0x5a')](_0x86fb10)[_0x6b78('0x5b')](function(_0x5a9d17){_0xd12edb({'ret':0x1});})['catch'](function(_0x79dd8a){logger[_0x6b78('0x54')](_0x79dd8a[_0x6b78('0x55')]);_0x231e89({'ret':0x1});});}});}function handleTZQuery(_0x371bf3){logger[_0x6b78('0x52')](_0x371bf3);return db[_0x6b78('0x59')][_0x6b78('0x5a')](_0x371bf3)[_0x6b78('0x5b')](function(_0x29486a){})[_0x6b78('0x5c')](function(_0x2485dc){logger[_0x6b78('0x54')](_0x2485dc['message']);});}function main(_0x5eecf1,_0x1dee20,_0xa40c90,_0x4912e1){logger[_0x6b78('0x52')](_0x6b78('0x68'),_0x5eecf1,JSON[_0x6b78('0x69')](_0x1dee20));process[_0x6b78('0x6a')](_0x6b78('0x6b'));var _0x10b932=_0x1dee20['binding'];var _0x20e904=_[_0x6b78('0x6c')](_0x10b932);var _0xbe0fcc=_0x1dee20[_0x6b78('0x6d')];var _0x162027=path[_0x6b78('0xe')](config[_0x6b78('0x6e')],'server/files/tmp',_0xbe0fcc+'.csv');hasTZ=_[_0x6b78('0x4b')](_0x10b932)[_0x6b78('0x6f')]('dialTimezone');var _0x4177f2=_[_0x6b78('0x4b')](_0x10b932)[_0x6b78('0xe')]();logger[_0x6b78('0x52')](_0x6b78('0x70'),_0x4177f2);db['ContactItemType']['findAll']({'raw':!![],'attributes':['id',_0x6b78('0x71')]})['then'](function(_0x30d17d){for(var _0x205486=0x0;_0x205486<_0x30d17d[_0x6b78('0x17')];_0x205486++){if(_0x30d17d[_0x205486]['name']in _0x10b932){contactItemTypes[_0x6b78('0x14')](_0x30d17d[_0x205486]);delete _0x20e904[_0x30d17d[_0x205486][_0x6b78('0x71')]];hasAdditionalPhones=!![];}for(var _0x2bfd96 in _0x10b932){if(_0x30d17d[_0x205486]['name']+_0x6b78('0x72')===_0x2bfd96){phoneDescriptions[_0x6b78('0x14')]({'itemTypeId':_0x30d17d[_0x205486]['id'],'description':_0x2bfd96});delete _0x20e904[_0x2bfd96];}}}if(hasAdditionalPhones)_0x20e904['AdditionalPhones']='';var _0x4fd3ef=_[_0x6b78('0x4b')](_0x20e904)[_0x6b78('0xe')]();logger[_0x6b78('0x52')](_0x6b78('0x70'),_0x4fd3ef);fs['writeFileSync'](_0x162027,_0x4fd3ef+'\x0a');Papa[_0x6b78('0x73')](fs['createReadStream'](_0x5eecf1),{'header':!![],'skipEmptyLines':!![],'step':function(_0x52d6ea,_0x14cbe6){try{for(var _0x4cd798=0x0,_0x2b069f=[];_0x4cd798<_0x52d6ea[_0x6b78('0x74')][_0x6b78('0x17')];_0x4cd798++){stats[_0x6b78('0x75')]+=0x1;if(_0x52d6ea[_0x6b78('0x57')][_0x4cd798]){handleError(_0x52d6ea[_0x6b78('0x74')][_0x4cd798],_0x52d6ea[_0x6b78('0x57')][_0x4cd798]);}else{var _0x2b025a=[];var _0x1cafe9=[];var _0x14f82a={};for(var _0x33ad97 in _0x10b932){let _0xf562ae=contactItemTypes[_0x6b78('0x76')](_0x2b321f=>_0x2b321f[_0x6b78('0x71')]===_0x33ad97);let _0x2fa673=contactItemTypes[_0x6b78('0x76')](_0x1911a4=>_0x1911a4[_0x6b78('0x71')]+_0x6b78('0x72')===_0x33ad97);if(_['isNil'](_0xf562ae)&&_[_0x6b78('0x19')](_0x2fa673)){if(_0x10b932[_0x6b78('0x77')](_0x33ad97)){if(_0x52d6ea['data'][_0x4cd798][_0x10b932[_0x33ad97]]){var _0x493bb4=_[_0x6b78('0x78')](_0x52d6ea[_0x6b78('0x74')][_0x4cd798][_0x10b932[_0x33ad97]][_0x6b78('0x79')](/"/g,'\x27'));switch(_0x33ad97){case _0x6b78('0x28'):var _0x286a55=moment(_0x493bb4,_0x6b78('0xb'),!![]);if(_0x286a55['isValid']()){_0x2b069f[_0x6b78('0x14')]('\x22'+_0x493bb4+'\x22');}else{_0x2b025a[_0x6b78('0x14')](_0x6b78('0x7a'));}break;case'priority':var _0x469569=parseInt(_0x493bb4);_0x493bb4=_[_0x6b78('0x7b')](_0x469569)||_0x469569<0x0||_0x469569>0x4?_0x4912e1?0x3:0x2:_0x469569;_0x2b069f[_0x6b78('0x14')]('\x22'+_0x493bb4+'\x22');break;case _0x6b78('0x3f'):var _0x5b9ecd=parseInt(_0x493bb4);if(_[_0x6b78('0x7c')](_0x5b9ecd)&&_[_0x6b78('0x6f')](_0xa40c90,_0x5b9ecd)){_0x2b069f[_0x6b78('0x14')]('\x22'+_0x5b9ecd+'\x22');}else{_0x2b025a[_0x6b78('0x14')]('agent\x20not\x20exists');}break;case _0x6b78('0x7d'):if(isEmail(_0x493bb4)){_0x2b069f['push']('\x22'+_0x493bb4+'\x22');}else{_0x2b025a[_0x6b78('0x14')]('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x3127c6=moment(_0x493bb4,_0x6b78('0x7e'),!![]);if(_0x3127c6[_0x6b78('0x7f')]()){_0x2b069f[_0x6b78('0x14')]('\x22'+_0x493bb4+'\x22');}else{_0x2b025a[_0x6b78('0x14')](_0x6b78('0x80'));}break;case _0x6b78('0x64'):var _0x583927=shared['timezones'];var _0x19df06=_0x583927[_0x493bb4];if(!_['isNil'](_0x19df06)){var _0x49ded4=_0x19df06['utcOffset'];_0x2b069f[_0x6b78('0x14')]('\x22'+_0x493bb4+'\x22');_0x2b069f['push']('\x22'+_0x49ded4+'\x22');}break;default:_0x2b069f[_0x6b78('0x14')]('\x22'+_0x493bb4+'\x22');}}else{switch(_0x33ad97){case'firstName':case _0x6b78('0x3a'):_0x2b025a[_0x6b78('0x14')](_0x33ad97+_0x6b78('0x81'));break;default:_0x2b069f[_0x6b78('0x14')]('\x22\x22');}}}}else{var _0x43155c='';if(!_['isNil'](_0xf562ae)){if(!_0x14f82a[_0x6b78('0x77')](_0xf562ae['id'])){if(!_['isNil'](_0x52d6ea['data'][_0x4cd798][_0x10b932[_0x33ad97]])){var _0x493bb4=_['trim'](_0x52d6ea['data'][_0x4cd798][_0x10b932[_0x33ad97]][_0x6b78('0x79')](/"/g,'\x27'));var _0x12eab1=phoneDescriptions[_0x6b78('0x76')](_0x563b05=>_0x563b05['itemTypeId']===_0xf562ae['id']);if(!_[_0x6b78('0x19')](_0x12eab1)){var _0x53f9b6=_[_0x6b78('0x78')](_0x52d6ea['data'][_0x4cd798][_0x10b932[_0x12eab1[_0x6b78('0x82')]]][_0x6b78('0x79')](/"/g,'\x27'));if(!_[_0x6b78('0x19')](_0x53f9b6))_0x493bb4=_0x493bb4+'§'+_0x53f9b6;}if(_0x43155c=='')_0x43155c=_0x493bb4;else _0x43155c+='|'+_0x493bb4;}_0x1cafe9[_0x6b78('0x14')](_0xf562ae['id']+':'+_0x43155c);_0x14f82a[_0xf562ae['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2b069f[_0x6b78('0x14')]('\x22'+_0x1cafe9[_0x6b78('0xe')](';')+'\x22');}if(_0x2b025a[_0x6b78('0x17')]){handleError(_0x52d6ea[_0x6b78('0x74')][_0x4cd798],{'code':_0x6b78('0x83'),'message':_0x2b025a[_0x6b78('0xe')]()});}else{fs[_0x6b78('0x84')](_0x162027,_0x2b069f[_0x6b78('0xe')]()+'\x0a');}_0x2b069f=[];}if(!(stats[_0x6b78('0x75')]%0xc8)){socket['emit'](_0x6b78('0x85')+_0xbe0fcc,stats);stats['errors']=[];}}if(stopped){logger[_0x6b78('0x52')](_0x6b78('0x86'));_0x14cbe6[_0x6b78('0x87')]();}}catch(_0x262a52){handleError(_0x52d6ea[_0x6b78('0x74')][_0x4cd798],{'code':_0x6b78('0x88'),'message':_0x262a52['message']});logger['error']('step',_0x262a52[_0x6b78('0x55')]);}},'complete':function(){try{var _0x5d552e=[];var _0x1d61e8=[];var _0x61197f=_0x6b78('0x30');if(_0x1dee20[_0x6b78('0x89')]&&_0x1dee20[_0x6b78('0x89')][_0x6b78('0x17')]){_0x61197f=_0x6b78('0x8a')+_0xbe0fcc;_0x5d552e[_0x6b78('0x14')]('CREATE\x20TABLE\x20'+_0x61197f+_0x6b78('0x8b'));}tmp_campaigns=_0x6b78('0x8c')+_0xbe0fcc;tmp_voice_queues=_0x6b78('0x8d')+_0xbe0fcc;_0x1d61e8[_0x6b78('0x14')](_0x6b78('0x8e')+tmp_campaigns+_0x6b78('0x8f'));_0x1d61e8[_0x6b78('0x14')]('CREATE\x20TABLE\x20'+tmp_voice_queues+_0x6b78('0x8f'));BPromise[_0x6b78('0x90')](_0x1d61e8,handleTZQuery)['then'](function(_0x11ef18){updateTzCampaigns(_0x1dee20['ListId'])[_0x6b78('0x13')](function(_0x24fbcd){updateTzVoiceQueues(_0x1dee20[_0x6b78('0x3b')])[_0x6b78('0x13')](function(_0x1dd6b7){if(hasTZ)_0x4fd3ef=_0x4fd3ef[_0x6b78('0x79')](_0x6b78('0x64'),_0x6b78('0x91'));var _0xa55523=util['format'](_0x6b78('0x92'),_0x162027,_0x61197f,_0x4fd3ef,_0x1dee20[_0x6b78('0x3b')],_0x1dee20[_0x6b78('0x93')]||null,NOW,NOW);if(_[_0x6b78('0x19')](_0x10b932[_0x6b78('0x28')])){_0xa55523+=',\x20scheduledAt\x20=\x20NOW()';}_0x5d552e[_0x6b78('0x14')](_0xa55523);if(_0x1dee20[_0x6b78('0x89')]&&_0x1dee20[_0x6b78('0x89')][_0x6b78('0x17')]){_0x5d552e['push'](insertCmContact(_0x1dee20[_0x6b78('0x3b')],_0x61197f,_0x1dee20[_0x6b78('0x89')],_0x10b932));_0x5d552e[_0x6b78('0x14')]('DROP\x20TABLE\x20'+_0x61197f+';');}BPromise['each'](_0x5d552e,handleQuery)[_0x6b78('0x13')](function(_0x4915de){BPromise[_0x6b78('0x15')]([handleAdditionalPhones()])[_0x6b78('0x13')](function(){_0x5d552e=[];for(var _0xa637b3=0x0;_0xa637b3\x20\x20','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','UserId','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','phone','from','join','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','select\x20*\x20from\x20','spread','isNil','push','then','catch','error','message','AdditionalPhones','split','length','filter','CmContactHasItem','findOne','update','updated','create','PHONE','inserted','CmContact','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','ContactId'];(function(_0x2767c6,_0x2af3d0){var _0x4b1268=function(_0x48361f){while(--_0x48361f){_0x2767c6['push'](_0x2767c6['shift']());}};_0x4b1268(++_0x2af3d0);}(_0x7292,0x107));var _0x2729=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x7292[_0x126558];return _0x1f6d14;};'use strict';var fs=require('fs');var path=require(_0x2729('0x0'));var _=require(_0x2729('0x1'));var Papa=require(_0x2729('0x2'));var util=require(_0x2729('0x3'));var BPromise=require(_0x2729('0x4'));var moment=require(_0x2729('0x5'));var squel=require(_0x2729('0x6'));var Redis=require('ioredis');var db=require(_0x2729('0x7'))['db'];var config=require(_0x2729('0x8'));var logger=require(_0x2729('0x9'))(_0x2729('0xa'));config[_0x2729('0xb')]=_[_0x2729('0xc')](config[_0x2729('0xb')],{'host':_0x2729('0xd'),'port':0x18eb});var socket=require(_0x2729('0xe'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format'](_0x2729('0xf'));var tempTableName=_0x2729('0x10')+moment()['format'](_0x2729('0x11'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x2562a5){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))*$/[_0x2729('0x12')](_0x2562a5);}function selectNotIn(_0x1d3cd9,_0x13de9a,_0x2d4ae0,_0x24b4c8,_0x197386){return squel[_0x2729('0x13')]()['field'](_0x2729('0x14'))[_0x2729('0x15')](_0x24b4c8)[_0x2729('0x16')](_0x13de9a,null,_0x13de9a+'.id\x20=\x20'+_0x24b4c8+'.'+_0x2d4ae0)[_0x2729('0x17')](_0x24b4c8+'.'+_0x2d4ae0+_0x2729('0x18')+_0x1d3cd9+'.'+_0x2d4ae0)[_0x2729('0x17')](_0x13de9a+_0x2729('0x19')+_0x197386[_0x2729('0x16')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x3b1e17,_0x3d3d37){promisesAdditionalPhones=[];promisesContact=[];return db[_0x2729('0x1a')]['query'](_0x2729('0x1b')+tempTableName)[_0x2729('0x1c')](function(_0x235e71){if(_0x235e71!==null){var _0x5d7e36=[];for(var _0x17090d=0x0;_0x17090d<_0x235e71['length'];_0x17090d++){var _0x5e472a=_0x235e71[_0x17090d];if(!_[_0x2729('0x1d')](_0x5e472a['phone'])){if(!_[_0x2729('0x1d')](_0x5e472a['AdditionalPhones']))_0x5d7e36[_0x2729('0x1e')](insertAdditionalPhones(_0x5e472a));promisesContact['push']({'contact':_0x5e472a});}}}Promise['all'](_0x5d7e36)[_0x2729('0x1f')](function(){_0x3b1e17({'val':0x1});});})[_0x2729('0x20')](function(_0x1da478){logger[_0x2729('0x21')](_0x1da478[_0x2729('0x22')]);});});}function insertAdditionalPhones(_0x2f73b2){return new Promise(function(_0x2c473c,_0xed35d4){var _0x52da3a=_0x2f73b2[_0x2729('0x23')];if(_[_0x2729('0x1d')](_0x52da3a))_0xed35d4({'val':0x0});else{var _0x3a855d=_0x52da3a[_0x2729('0x24')](';');var _0x492753=[];orderBy=0x0;for(var _0x193ca3=0x0;_0x193ca3<_0x3a855d[_0x2729('0x25')];_0x193ca3++){_0x492753[_0x2729('0x1e')](splitAdditionalPhone(_0x2f73b2['id'],_0x3a855d[_0x193ca3]));}Promise['all'](_0x492753)['then'](function(){_0x2c473c({'val':_0x3a855d[_0x2729('0x25')]});});}});}function splitAdditionalPhone(_0x18bd4f,_0x598770){return new Promise(function(_0x20e906,_0x72bdd2){var _0x401c2d=_0x598770[_0x2729('0x24')](':');var _0x37ab53=_0x401c2d[0x0];var _0x3c7df0=_0x401c2d[0x1];if(_0x3c7df0!==''){var _0x3cb1c8=_0x3c7df0[_0x2729('0x24')]('|');var _0x54a528=[];for(var _0x3f8da4=0x0;_0x3f8da4<_0x3cb1c8[_0x2729('0x25')];_0x3f8da4++){if(_0x3cb1c8[_0x3f8da4]!==''){var _0x51cfe5=_[_0x2729('0x26')](promisesAdditionalPhones,{'contactId':_0x18bd4f,'phone':_0x3cb1c8[_0x3f8da4]});if(_0x51cfe5['length']==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x18bd4f,'contactTypeId':_0x37ab53,'phone':_0x3cb1c8[_0x3f8da4],'orderBy':orderBy});}}}_0x20e906({'ok':0x1});}else _0x20e906({'res':0x0});});}function createAdditionalPhone(_0x5de957,_0x4843d0,_0x521d90,_0x888b66){var _0x4625fb='';var _0x4806e3='';var _0x466e90=_0x521d90[_0x2729('0x24')]('§');_0x4625fb=_0x466e90[0x0];if(_0x466e90[_0x2729('0x25')]==0x2)_0x4806e3=_0x466e90[0x1];return new Promise(function(_0x3547f8,_0x578a94){return db[_0x2729('0x27')][_0x2729('0x28')]({'where':{'CmContactId':_0x5de957,'item':_0x4625fb}})[_0x2729('0x1f')](function(_0x5073bb){if(_0x5073bb){return db['CmContactHasItem'][_0x2729('0x29')]({'ItemTypeId':_0x4843d0,'description':_0x4806e3,'OrderBy':_0x888b66},{'where':{'CmContactId':_0x5de957,'item':_0x4625fb}})[_0x2729('0x1f')](function(_0x390145){_0x3547f8({'res':_0x2729('0x2a')});});}else{return db['CmContactHasItem'][_0x2729('0x2b')]({'CmContactId':_0x5de957,'item':_0x4625fb,'ItemTypeId':_0x4843d0,'description':_0x4806e3,'OrderBy':_0x888b66,'ItemClass':_0x2729('0x2c')})['then'](function(_0xc45fd9){_0x3547f8({'res':_0x2729('0x2d')});});}});});}function updateContact(_0x48fbc7){return new Promise(function(_0x435492,_0x269186){var _0x523ba1=_0x48fbc7['id'];delete _0x48fbc7['id'];return db[_0x2729('0x2e')][_0x2729('0x29')](_0x48fbc7,{'where':{'id':_0x523ba1}})[_0x2729('0x1f')](function(_0x298c2a){updatedRows+=0x1;return db[_0x2729('0x2f')][_0x2729('0x29')]({'phone':_0x48fbc7[_0x2729('0x14')]},{'where':{'ContactId':_0x523ba1}})['then'](function(_0x38020b){_0x435492({'ret':'OK'});});});});}function insertCmHopper(_0x16a9fa,_0x4acc56,_0x1ae773,_0x5c04af,_0x5eaa93){var _0x8710c8=[_0x2729('0x30'),_0x2729('0x31'),'cm_contacts.id',_0x2729('0x32'),_0x4acc56+'.'+_0x5c04af,_0x2729('0x33'),'cm_contacts.updatedAt',_0x2729('0x34'),_0x2729('0x35'),'\x22'+_0x5eaa93+'\x22'];return squel[_0x2729('0x36')]()[_0x2729('0x37')](_0x2729('0x38'))[_0x2729('0x39')](['phone','scheduledat',_0x2729('0x3a'),'ListId',_0x5c04af,_0x2729('0x3b'),'updatedAt',_0x2729('0x3c'),'UserId',_0x2729('0x3d')],squel['select']()[_0x2729('0x3e')](_0x8710c8)[_0x2729('0x15')](_0x4acc56)[_0x2729('0x16')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x4acc56+_0x2729('0x3f'))['join'](_0x1ae773,null,_0x1ae773+_0x2729('0x40')+_0x4acc56+'.'+_0x5c04af)['where'](_0x4acc56+'.CmListId\x20=\x20?',_0x16a9fa)[_0x2729('0x17')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x2729('0x17')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x4acc56,_0x1ae773,_0x5c04af,_0x2729('0x38'),[_0x2729('0x41'),_0x2729('0x42')]))[_0x2729('0x17')](_0x2729('0x43'),selectNotIn(_0x4acc56,_0x1ae773,_0x5c04af,'cm_hopper',[_0x2729('0x41')])))[_0x2729('0x44')]();}function insertCmHopperBlack(_0x5a43ab,_0x5e2692,_0x290d45,_0x45acf3){var _0x1e852f=[_0x2729('0x30'),_0x2729('0x45'),_0x2729('0x32'),_0x5e2692+'.'+_0x45acf3,_0x2729('0x33'),_0x2729('0x46')];return squel[_0x2729('0x36')]()[_0x2729('0x37')](_0x2729('0x47'))[_0x2729('0x39')]([_0x2729('0x14'),_0x2729('0x3a'),'ListId',_0x45acf3,_0x2729('0x3b'),_0x2729('0x48')],squel[_0x2729('0x13')]()[_0x2729('0x3e')](_0x1e852f)['from'](_0x5e2692)[_0x2729('0x16')](_0x2729('0x49'),null,_0x2729('0x4a')+_0x5e2692+'.CmListId')['join'](_0x290d45,null,_0x290d45+_0x2729('0x40')+_0x5e2692+'.'+_0x45acf3)[_0x2729('0x17')](_0x5e2692+'.CmListId\x20=\x20?',_0x5a43ab)['where'](_0x2729('0x4b'),NOW)[_0x2729('0x17')](_0x2729('0x43'),squel[_0x2729('0x13')]()['field'](_0x2729('0x14'))[_0x2729('0x15')]('cm_hopper_black')[_0x2729('0x17')]('ListId\x20=\x20?',_0x5a43ab)[_0x2729('0x17')](_0x45acf3+_0x2729('0x4c'),_0x5e2692+'.'+_0x45acf3)))['toString']();}function insertCmHopperAdditionalPhones(_0xced9f6){var _0x4aa8cf=['cm_hopper.id',_0x2729('0x4d'),'cm_contact_has_items.OrderBy',_0x2729('0x4e'),_0x2729('0x4f')];return squel[_0x2729('0x36')]()[_0x2729('0x37')](_0x2729('0x50'))[_0x2729('0x39')](['CmHopperId',_0x2729('0x14'),'OrderBy',_0x2729('0x3b'),_0x2729('0x48')],squel[_0x2729('0x13')]()['fields'](_0x4aa8cf)[_0x2729('0x15')](_0x2729('0x38'))[_0x2729('0x16')](_0x2729('0x49'),null,_0x2729('0x51'))[_0x2729('0x16')](_0x2729('0x52'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0x2729('0x17')]('cm_hopper.ListId\x20=\x20?',_0xced9f6)[_0x2729('0x17')]('cm_contacts.createdAt\x20=\x20?',NOW))['toString']();}function insertCmContact(_0x4f7b04,_0x1a2c95,_0x375ff9,_0x19418e){var _0x233ca5=_[_0x2729('0x53')](_[_0x2729('0x54')](_0x19418e),[_0x2729('0x55'),_0x2729('0x56'),'createdAt',_0x2729('0x48')]);return squel[_0x2729('0x36')]()['into'](_0x2729('0x49'))[_0x2729('0x39')](_0x233ca5,squel[_0x2729('0x13')]()[_0x2729('0x3e')](_0x233ca5)[_0x2729('0x15')](_0x1a2c95)['where']('('+_0x375ff9[_0x2729('0x16')](',')+_0x2729('0x57'),squel['select']()[_0x2729('0x3e')](_0x375ff9)[_0x2729('0x15')]('cm_contacts')['where'](_0x2729('0x58'),_0x4f7b04))[_0x2729('0x17')](_0x2729('0x59'),squel[_0x2729('0x13')]()['field'](_0x2729('0x5a'),_0x2729('0x5b'))[_0x2729('0x15')](_0x1a2c95)[_0x2729('0x5c')](_0x375ff9[_0x2729('0x16')](','))))['toString']();}function handleStop(){logger[_0x2729('0x5d')](_0x2729('0x5e'));stopped=!![];}function handleUncaughtException(_0x114b82){logger['error'](_0x114b82[_0x2729('0x22')]);process[_0x2729('0x5f')](0x1);}function handleError(_0x499deb,_0x4768b0){stats[_0x2729('0x60')][_0x2729('0x1e')]({'name':_0x4768b0[_0x2729('0x61')],'message':_0x4768b0['message'],'row':_0x499deb});}function handleQuery(_0x53453b){logger['info'](_0x53453b);return db['sequelize']['query'](_0x53453b)[_0x2729('0x1c')](function(_0x37d94e){results['push'](_0x37d94e);})[_0x2729('0x20')](function(_0x136dad){logger[_0x2729('0x21')](_0x136dad[_0x2729('0x22')]);});}function main(_0x5c3724,_0x2007a7,_0x4549e9,_0x222988){logger[_0x2729('0x5d')]('main',_0x5c3724,JSON[_0x2729('0x62')](_0x2007a7));process[_0x2729('0x63')]('start');var _0x444d45=_0x2007a7['binding'];var _0x5457da=_[_0x2729('0x64')](_0x444d45);var _0x487ab0=_0x2007a7[_0x2729('0x65')];var _0x581616=path[_0x2729('0x16')](config[_0x2729('0x66')],_0x2729('0x67'),_0x487ab0+_0x2729('0x68'));logger[_0x2729('0x5d')]('body',_0x2007a7);db[_0x2729('0x69')][_0x2729('0x6a')]({'raw':!![],'attributes':['id',_0x2729('0x6b')]})[_0x2729('0x1f')](function(_0x2af323){for(var _0x4f3941=0x0;_0x4f3941<_0x2af323['length'];_0x4f3941++){if(_0x2af323[_0x4f3941][_0x2729('0x6b')]in _0x444d45){contactItemTypes[_0x2729('0x1e')](_0x2af323[_0x4f3941]);delete _0x5457da[_0x2af323[_0x4f3941]['name']];hasAdditionalPhones=!![];}for(var _0x526b05 in _0x444d45){if(_0x2af323[_0x4f3941][_0x2729('0x6b')]+'_description'===_0x526b05){phoneDescriptions[_0x2729('0x1e')]({'itemTypeId':_0x2af323[_0x4f3941]['id'],'description':_0x526b05});delete _0x5457da[_0x526b05];}}}if(hasAdditionalPhones)_0x5457da[_0x2729('0x23')]='';var _0x2309eb=_[_0x2729('0x54')](_0x5457da)[_0x2729('0x16')]();logger[_0x2729('0x5d')](_0x2729('0x6c'),_0x2309eb);fs[_0x2729('0x6d')](_0x581616,_0x2309eb+'\x0a');Papa[_0x2729('0x6e')](fs[_0x2729('0x6f')](_0x5c3724),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1df04a,_0x38cccc){try{for(var _0xbe409a=0x0,_0x399986=[];_0xbe409a<_0x1df04a[_0x2729('0x70')][_0x2729('0x25')];_0xbe409a++){stats['rows']+=0x1;if(_0x1df04a['errors'][_0xbe409a]){handleError(_0x1df04a[_0x2729('0x70')][_0xbe409a],_0x1df04a['errors'][_0xbe409a]);}else{var _0x532540=[];var _0x339df6=[];var _0x12120c={};for(var _0x398e80 in _0x444d45){let _0x3541cd=contactItemTypes[_0x2729('0x71')](_0x37fcc4=>_0x37fcc4[_0x2729('0x6b')]===_0x398e80);let _0x3104a4=contactItemTypes[_0x2729('0x71')](_0x2c055f=>_0x2c055f[_0x2729('0x6b')]+_0x2729('0x72')===_0x398e80);if(_[_0x2729('0x1d')](_0x3541cd)&&_[_0x2729('0x1d')](_0x3104a4)){if(_0x444d45[_0x2729('0x73')](_0x398e80)){if(_0x1df04a['data'][_0xbe409a][_0x444d45[_0x398e80]]){var _0x593914=_[_0x2729('0x74')](_0x1df04a[_0x2729('0x70')][_0xbe409a][_0x444d45[_0x398e80]][_0x2729('0x75')](/"/g,'\x27'));switch(_0x398e80){case _0x2729('0x76'):var _0x494b4e=moment(_0x593914,_0x2729('0xf'),!![]);if(_0x494b4e[_0x2729('0x77')]()){_0x399986['push']('\x22'+_0x593914+'\x22');}else{_0x532540[_0x2729('0x1e')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x2729('0x3c'):var _0x18e5bd=parseInt(_0x593914);_0x593914=_['isNaN'](_0x18e5bd)||_0x18e5bd<0x0||_0x18e5bd>0x4?_0x222988?0x3:0x2:_0x18e5bd;_0x399986[_0x2729('0x1e')]('\x22'+_0x593914+'\x22');break;case'UserId':var _0x49b8e0=parseInt(_0x593914);if(_[_0x2729('0x78')](_0x49b8e0)&&_[_0x2729('0x79')](_0x4549e9,_0x49b8e0)){_0x399986[_0x2729('0x1e')]('\x22'+_0x49b8e0+'\x22');}else{_0x532540[_0x2729('0x1e')]('agent\x20not\x20exists');}break;case _0x2729('0x7a'):if(isEmail(_0x593914)){_0x399986[_0x2729('0x1e')]('\x22'+_0x593914+'\x22');}else{_0x532540['push'](_0x2729('0x7b'));}break;case _0x2729('0x7c'):var _0xf86f9e=moment(_0x593914,_0x2729('0x7d'),!![]);if(_0xf86f9e[_0x2729('0x77')]()){_0x399986[_0x2729('0x1e')]('\x22'+_0x593914+'\x22');}else{_0x532540[_0x2729('0x1e')](_0x2729('0x7e'));}break;default:_0x399986[_0x2729('0x1e')]('\x22'+_0x593914+'\x22');}}else{switch(_0x398e80){case _0x2729('0x7f'):case _0x2729('0x14'):_0x532540['push'](_0x398e80+'\x20not\x20specified');break;default:_0x399986[_0x2729('0x1e')]('\x22\x22');}}}}else{var _0x48a8f1='';if(!_[_0x2729('0x1d')](_0x3541cd)){if(!_0x12120c[_0x2729('0x73')](_0x3541cd['id'])){for(var _0x3965a3=0x0;_0x3965a3<_0x444d45[_0x398e80][_0x2729('0x25')];_0x3965a3++){var _0x593914=_[_0x2729('0x74')](_0x1df04a[_0x2729('0x70')][_0xbe409a][_0x444d45[_0x398e80][_0x3965a3]][_0x2729('0x75')](/"/g,'\x27'));var _0x4ee98a=phoneDescriptions[_0x2729('0x71')](_0xed8bc5=>_0xed8bc5[_0x2729('0x80')]===_0x3541cd['id']);if(!_[_0x2729('0x1d')](_0x4ee98a)){var _0x17d36d=_['trim'](_0x1df04a[_0x2729('0x70')][_0xbe409a][_0x444d45[_0x4ee98a[_0x2729('0x81')]][0x0]][_0x2729('0x75')](/"/g,'\x27'));if(!_[_0x2729('0x1d')](_0x17d36d))_0x593914=_0x593914+'§'+_0x17d36d;}if(_0x48a8f1=='')_0x48a8f1=_0x593914;else _0x48a8f1+='|'+_0x593914;}_0x339df6[_0x2729('0x1e')](_0x3541cd['id']+':'+_0x48a8f1);_0x12120c[_0x3541cd['id']]=0x1;}}}}if(hasAdditionalPhones){_0x399986[_0x2729('0x1e')]('\x22'+_0x339df6['join'](';')+'\x22');}if(_0x532540[_0x2729('0x25')]){handleError(_0x1df04a[_0x2729('0x70')][_0xbe409a],{'code':_0x2729('0x82'),'message':_0x532540['join']()});}else{fs[_0x2729('0x83')](_0x581616,_0x399986[_0x2729('0x16')]()+'\x0a');}_0x399986=[];}if(!(stats[_0x2729('0x84')]%0xc8)){socket['emit'](_0x2729('0x85')+_0x487ab0,stats);stats[_0x2729('0x60')]=[];}}if(stopped){logger[_0x2729('0x5d')]('Abort\x20parser');_0x38cccc['abort']();}}catch(_0x16ab80){handleError(_0x1df04a[_0x2729('0x70')][_0xbe409a],{'code':_0x2729('0x86'),'message':_0x16ab80[_0x2729('0x22')]});logger[_0x2729('0x21')](_0x2729('0x87'),_0x16ab80[_0x2729('0x22')]);}},'complete':function(){try{var _0x3b7076=[];var _0x24ff4f=tempTableName;_0x3b7076[_0x2729('0x1e')](_0x2729('0x88')+_0x24ff4f+'\x20LIKE\x20cm_contacts;');logger[_0x2729('0x5d')](_0x2729('0x89'),contactItemTypes[_0x2729('0x25')]);var _0x5f3494=util['format'](_0x2729('0x8a'),_0x581616,_0x24ff4f,_0x2309eb,_0x2007a7['ListId'],_0x2007a7['CompanyId']||null,NOW,NOW);if(_[_0x2729('0x1d')](_0x444d45['scheduledat'])){_0x5f3494+=_0x2729('0x8b');}_0x3b7076[_0x2729('0x1e')](_0x5f3494);BPromise[_0x2729('0x8c')](_0x3b7076,handleQuery)[_0x2729('0x1f')](function(_0x1fb205){BPromise[_0x2729('0x8d')]([handleAdditionalPhones()])[_0x2729('0x1f')](function(){_0x3b7076=[];for(var _0x111846=0x0;_0x111846\x20\x20','existsSync','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','../../../config/logger','defaults','redis','localhost','format','cm_contacts_temp_','YYYYMMDDHHmmss','select','field','phone','join','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','select\x20*\x20from\x20','length','isNil','push','all','catch','error','message','AdditionalPhones','then','split','filter','CmContactHasItem','findOne','update','updated','create','PHONE','CmContact','CmHopper','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','scheduledat','ListId','createdAt','updatedAt','UserId','recallme','fields','from','cm_contacts.ListId\x20=\x20','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_contacts','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_hopper_additional_phones','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','concat',')\x20NOT\x20IN\x20?','id\x20IN\x20?','min_id','group','info','Received\x20SIGINT','exit','errors','code','query','spread','main','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','.csv','body','ContactItemType','findAll','name','_description','writeFileSync','parse','createReadStream','data','rows','find','hasOwnProperty','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','priority','isNaN','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','firstName','\x20not\x20specified','itemTypeId','trim','description','SystemRow','emit','abort','SystemError','step','CREATE\x20TABLE\x20'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd7ab,0x14e));var _0xbd7a=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xd7ab[_0x3947c9];return _0x2e7871;};'use strict';var fs=require('fs');var path=require(_0xbd7a('0x0'));var _=require(_0xbd7a('0x1'));var Papa=require(_0xbd7a('0x2'));var util=require(_0xbd7a('0x3'));var BPromise=require(_0xbd7a('0x4'));var moment=require(_0xbd7a('0x5'));var squel=require(_0xbd7a('0x6'));var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require(_0xbd7a('0x7'))('import');config['redis']=_[_0xbd7a('0x8')](config[_0xbd7a('0x9')],{'host':_0xbd7a('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbd7a('0x9')]));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()[_0xbd7a('0xb')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0xbd7a('0xc')+moment()['format'](_0xbd7a('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x4dfbd9){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'](_0x4dfbd9);}function selectNotIn(_0x2b6a14,_0x4a4006,_0x559cde,_0x1ad26f,_0x281a59){return squel[_0xbd7a('0xe')]()[_0xbd7a('0xf')](_0xbd7a('0x10'))['from'](_0x1ad26f)[_0xbd7a('0x11')](_0x4a4006,null,_0x4a4006+'.id\x20=\x20'+_0x1ad26f+'.'+_0x559cde)[_0xbd7a('0x12')](_0x1ad26f+'.'+_0x559cde+_0xbd7a('0x13')+_0x2b6a14+'.'+_0x559cde)[_0xbd7a('0x12')](_0x4a4006+_0xbd7a('0x14')+_0x281a59[_0xbd7a('0x11')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x427a93,_0x52ffe0){promisesAdditionalPhones=[];promisesContact=[];return db[_0xbd7a('0x15')]['query'](_0xbd7a('0x16')+tempTableName)['spread'](function(_0x3fb8f4){if(_0x3fb8f4!==null){var _0x70b55b=[];for(var _0x2029c1=0x0;_0x2029c1<_0x3fb8f4[_0xbd7a('0x17')];_0x2029c1++){var _0x238d36=_0x3fb8f4[_0x2029c1];if(!_[_0xbd7a('0x18')](_0x238d36[_0xbd7a('0x10')])){if(!_['isNil'](_0x238d36['AdditionalPhones']))_0x70b55b['push'](insertAdditionalPhones(_0x238d36));promisesContact[_0xbd7a('0x19')]({'contact':_0x238d36});}}}Promise[_0xbd7a('0x1a')](_0x70b55b)['then'](function(){_0x427a93({'val':0x1});});})[_0xbd7a('0x1b')](function(_0x3869d3){logger[_0xbd7a('0x1c')](_0x3869d3[_0xbd7a('0x1d')]);});});}function insertAdditionalPhones(_0x37b210){return new Promise(function(_0x2d6e2f,_0x16bbb5){var _0x3553f0=_0x37b210[_0xbd7a('0x1e')];if(_['isNil'](_0x3553f0))_0x16bbb5({'val':0x0});else{var _0x3d46fb=_0x3553f0['split'](';');var _0x4b2842=[];orderBy=0x0;for(var _0x5d5918=0x0;_0x5d5918<_0x3d46fb['length'];_0x5d5918++){_0x4b2842[_0xbd7a('0x19')](splitAdditionalPhone(_0x37b210['id'],_0x3d46fb[_0x5d5918]));}Promise[_0xbd7a('0x1a')](_0x4b2842)[_0xbd7a('0x1f')](function(){_0x2d6e2f({'val':_0x3d46fb[_0xbd7a('0x17')]});});}});}function splitAdditionalPhone(_0x16a97b,_0x2b7e86){return new Promise(function(_0x5c6ba6,_0x1e5ad6){var _0x54f251=_0x2b7e86[_0xbd7a('0x20')](':');var _0x573913=_0x54f251[0x0];var _0xbd6398=_0x54f251[0x1];if(_0xbd6398!==''){var _0x4bb83f=_0xbd6398[_0xbd7a('0x20')]('|');var _0x4d6123=[];for(var _0x43b306=0x0;_0x43b306<_0x4bb83f[_0xbd7a('0x17')];_0x43b306++){if(_0x4bb83f[_0x43b306]!==''){var _0x5d4558=_[_0xbd7a('0x21')](promisesAdditionalPhones,{'contactId':_0x16a97b,'phone':_0x4bb83f[_0x43b306]});if(_0x5d4558[_0xbd7a('0x17')]==0x0){orderBy++;promisesAdditionalPhones[_0xbd7a('0x19')]({'contactId':_0x16a97b,'contactTypeId':_0x573913,'phone':_0x4bb83f[_0x43b306],'orderBy':orderBy});}}}_0x5c6ba6({'ok':0x1});}else _0x5c6ba6({'res':0x0});});}function createAdditionalPhone(_0x4e551d,_0x335520,_0x33f0b7,_0x350005){var _0x57f7a9='';var _0x3bfda5='';var _0x457446=_0x33f0b7['split']('§');_0x57f7a9=_0x457446[0x0];if(_0x457446[_0xbd7a('0x17')]==0x2)_0x3bfda5=_0x457446[0x1];return new Promise(function(_0x400b68,_0x269c15){return db[_0xbd7a('0x22')][_0xbd7a('0x23')]({'where':{'CmContactId':_0x4e551d,'item':_0x57f7a9}})[_0xbd7a('0x1f')](function(_0x31ae4e){if(_0x31ae4e){return db[_0xbd7a('0x22')][_0xbd7a('0x24')]({'ItemTypeId':_0x335520,'description':_0x3bfda5,'OrderBy':_0x350005},{'where':{'CmContactId':_0x4e551d,'item':_0x57f7a9}})[_0xbd7a('0x1f')](function(_0x32b095){_0x400b68({'res':_0xbd7a('0x25')});});}else{return db[_0xbd7a('0x22')][_0xbd7a('0x26')]({'CmContactId':_0x4e551d,'item':_0x57f7a9,'ItemTypeId':_0x335520,'description':_0x3bfda5,'OrderBy':_0x350005,'ItemClass':_0xbd7a('0x27')})[_0xbd7a('0x1f')](function(_0x439d26){_0x400b68({'res':'inserted'});});}});});}function updateContact(_0x222025){return new Promise(function(_0x4553b2,_0x365435){var _0x3b6fd6=_0x222025['id'];delete _0x222025['id'];return db[_0xbd7a('0x28')]['update'](_0x222025,{'where':{'id':_0x3b6fd6}})[_0xbd7a('0x1f')](function(_0x41b527){updatedRows+=0x1;return db[_0xbd7a('0x29')]['update']({'phone':_0x222025[_0xbd7a('0x10')]},{'where':{'ContactId':_0x3b6fd6}})['then'](function(_0x3daef1){_0x4553b2({'ret':'OK'});});});});}function insertCmHopper(_0xd23175,_0x1da085,_0x4bf7f1,_0x4dbc18,_0x2c1638){var _0x154833=[_0xbd7a('0x2a'),_0xbd7a('0x2b'),_0xbd7a('0x2c'),_0xbd7a('0x2d'),_0x1da085+'.'+_0x4dbc18,_0xbd7a('0x2e'),_0xbd7a('0x2f'),_0xbd7a('0x30'),_0xbd7a('0x31'),'\x22'+_0x2c1638+'\x22'];return squel[_0xbd7a('0x32')]()[_0xbd7a('0x33')](_0xbd7a('0x34'))[_0xbd7a('0x35')]([_0xbd7a('0x10'),_0xbd7a('0x36'),'ContactId',_0xbd7a('0x37'),_0x4dbc18,_0xbd7a('0x38'),_0xbd7a('0x39'),'priority',_0xbd7a('0x3a'),_0xbd7a('0x3b')],squel['select']()[_0xbd7a('0x3c')](_0x154833)[_0xbd7a('0x3d')](_0x1da085)[_0xbd7a('0x11')]('cm_contacts',null,_0xbd7a('0x3e')+_0x1da085+'.CmListId')[_0xbd7a('0x11')](_0x4bf7f1,null,_0x4bf7f1+_0xbd7a('0x3f')+_0x1da085+'.'+_0x4dbc18)[_0xbd7a('0x12')](_0x1da085+_0xbd7a('0x40'),_0xd23175)[_0xbd7a('0x12')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xbd7a('0x12')](_0xbd7a('0x41'),selectNotIn(_0x1da085,_0x4bf7f1,_0x4dbc18,_0xbd7a('0x34'),['\x22always\x22','\x22onlyIfOpen\x22']))['where'](_0xbd7a('0x41'),selectNotIn(_0x1da085,_0x4bf7f1,_0x4dbc18,_0xbd7a('0x34'),['\x22always\x22'])))[_0xbd7a('0x42')]();}function insertCmHopperBlack(_0xb248f2,_0x223e48,_0xe048e3,_0x4748d1){var _0x4df0a7=[_0xbd7a('0x2a'),_0xbd7a('0x2c'),'cm_contacts.ListId',_0x223e48+'.'+_0x4748d1,_0xbd7a('0x2e'),_0xbd7a('0x2f')];return squel[_0xbd7a('0x32')]()[_0xbd7a('0x33')]('cm_hopper_black')[_0xbd7a('0x35')](['phone','ContactId','ListId',_0x4748d1,_0xbd7a('0x38'),_0xbd7a('0x39')],squel['select']()[_0xbd7a('0x3c')](_0x4df0a7)['from'](_0x223e48)[_0xbd7a('0x11')](_0xbd7a('0x43'),null,_0xbd7a('0x3e')+_0x223e48+_0xbd7a('0x44'))[_0xbd7a('0x11')](_0xe048e3,null,_0xe048e3+_0xbd7a('0x3f')+_0x223e48+'.'+_0x4748d1)[_0xbd7a('0x12')](_0x223e48+_0xbd7a('0x40'),_0xb248f2)[_0xbd7a('0x12')](_0xbd7a('0x45'),NOW)['where'](_0xbd7a('0x41'),squel[_0xbd7a('0xe')]()['field']('phone')[_0xbd7a('0x3d')](_0xbd7a('0x46'))[_0xbd7a('0x12')](_0xbd7a('0x47'),_0xb248f2)[_0xbd7a('0x12')](_0x4748d1+_0xbd7a('0x48'),_0x223e48+'.'+_0x4748d1)))[_0xbd7a('0x42')]();}function insertCmHopperAdditionalPhones(_0x2e3672){var _0x2ba9e7=[_0xbd7a('0x49'),_0xbd7a('0x4a'),'cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt'];return squel[_0xbd7a('0x32')]()['into'](_0xbd7a('0x4b'))[_0xbd7a('0x35')](['CmHopperId',_0xbd7a('0x10'),_0xbd7a('0x4c'),'createdAt',_0xbd7a('0x39')],squel[_0xbd7a('0xe')]()['fields'](_0x2ba9e7)['from'](_0xbd7a('0x34'))['join']('cm_contacts',null,_0xbd7a('0x4d'))[_0xbd7a('0x11')](_0xbd7a('0x4e'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')['where']('cm_hopper.ListId\x20=\x20?',_0x2e3672)[_0xbd7a('0x12')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0xbd7a('0x42')]();}function insertCmContact(_0x2af4cd,_0x2818ae,_0x17431f,_0x3e617e){var _0x30afbf=_[_0xbd7a('0x4f')](_['keys'](_0x3e617e),['ListId','CompanyId',_0xbd7a('0x38'),_0xbd7a('0x39')]);return squel['insert']()[_0xbd7a('0x33')]('cm_contacts')['fromQuery'](_0x30afbf,squel['select']()['fields'](_0x30afbf)[_0xbd7a('0x3d')](_0x2818ae)[_0xbd7a('0x12')]('('+_0x17431f[_0xbd7a('0x11')](',')+_0xbd7a('0x50'),squel[_0xbd7a('0xe')]()['fields'](_0x17431f)[_0xbd7a('0x3d')]('cm_contacts')[_0xbd7a('0x12')](_0xbd7a('0x47'),_0x2af4cd))[_0xbd7a('0x12')](_0xbd7a('0x51'),squel[_0xbd7a('0xe')]()[_0xbd7a('0xf')]('MIN(id)',_0xbd7a('0x52'))[_0xbd7a('0x3d')](_0x2818ae)[_0xbd7a('0x53')](_0x17431f['join'](','))))[_0xbd7a('0x42')]();}function handleStop(){logger[_0xbd7a('0x54')](_0xbd7a('0x55'));stopped=!![];}function handleUncaughtException(_0x5f4b5d){logger[_0xbd7a('0x1c')](_0x5f4b5d['message']);process[_0xbd7a('0x56')](0x1);}function handleError(_0x3435d7,_0x12efc5){stats[_0xbd7a('0x57')]['push']({'name':_0x12efc5[_0xbd7a('0x58')],'message':_0x12efc5['message'],'row':_0x3435d7});}function handleQuery(_0x1354c5){logger['info'](_0x1354c5);return db[_0xbd7a('0x15')][_0xbd7a('0x59')](_0x1354c5)[_0xbd7a('0x5a')](function(_0x416bb0){results[_0xbd7a('0x19')](_0x416bb0);})[_0xbd7a('0x1b')](function(_0x39e5d7){logger['error'](_0x39e5d7[_0xbd7a('0x1d')]);});}function main(_0x9d764e,_0xaaa789,_0x24d507,_0x4e12b2){logger['info'](_0xbd7a('0x5b'),_0x9d764e,JSON[_0xbd7a('0x5c')](_0xaaa789));process[_0xbd7a('0x5d')](_0xbd7a('0x5e'));var _0x1847b4=_0xaaa789[_0xbd7a('0x5f')];var _0x2ddd5f=_['clone'](_0x1847b4);var _0x4fc0fb=_0xaaa789[_0xbd7a('0x60')];var _0x3e6d58=path['join'](config[_0xbd7a('0x61')],_0xbd7a('0x62'),_0x4fc0fb+_0xbd7a('0x63'));logger['info'](_0xbd7a('0x64'),_0xaaa789);db[_0xbd7a('0x65')][_0xbd7a('0x66')]({'raw':!![],'attributes':['id',_0xbd7a('0x67')]})[_0xbd7a('0x1f')](function(_0x5dbe84){for(var _0x58707=0x0;_0x58707<_0x5dbe84[_0xbd7a('0x17')];_0x58707++){if(_0x5dbe84[_0x58707][_0xbd7a('0x67')]in _0x1847b4){contactItemTypes['push'](_0x5dbe84[_0x58707]);delete _0x2ddd5f[_0x5dbe84[_0x58707]['name']];hasAdditionalPhones=!![];}for(var _0x4e9faf in _0x1847b4){if(_0x5dbe84[_0x58707][_0xbd7a('0x67')]+_0xbd7a('0x68')===_0x4e9faf){phoneDescriptions[_0xbd7a('0x19')]({'itemTypeId':_0x5dbe84[_0x58707]['id'],'description':_0x4e9faf});delete _0x2ddd5f[_0x4e9faf];}}}if(hasAdditionalPhones)_0x2ddd5f[_0xbd7a('0x1e')]='';var _0x5cd66a=_['keys'](_0x2ddd5f)[_0xbd7a('0x11')]();logger[_0xbd7a('0x54')]('header',_0x5cd66a);fs[_0xbd7a('0x69')](_0x3e6d58,_0x5cd66a+'\x0a');Papa[_0xbd7a('0x6a')](fs[_0xbd7a('0x6b')](_0x9d764e),{'header':!![],'skipEmptyLines':!![],'step':function(_0x296984,_0x38621a){try{for(var _0x448505=0x0,_0x39c2d1=[];_0x448505<_0x296984[_0xbd7a('0x6c')]['length'];_0x448505++){stats[_0xbd7a('0x6d')]+=0x1;if(_0x296984[_0xbd7a('0x57')][_0x448505]){handleError(_0x296984[_0xbd7a('0x6c')][_0x448505],_0x296984[_0xbd7a('0x57')][_0x448505]);}else{var _0x21c38b=[];var _0xae2cd0=[];var _0x7a7cf1={};for(var _0x3f6c74 in _0x1847b4){let _0x4bb522=contactItemTypes['find'](_0x4f944b=>_0x4f944b[_0xbd7a('0x67')]===_0x3f6c74);let _0x567378=contactItemTypes[_0xbd7a('0x6e')](_0x43393b=>_0x43393b[_0xbd7a('0x67')]+'_description'===_0x3f6c74);if(_[_0xbd7a('0x18')](_0x4bb522)&&_[_0xbd7a('0x18')](_0x567378)){if(_0x1847b4[_0xbd7a('0x6f')](_0x3f6c74)){if(_0x296984[_0xbd7a('0x6c')][_0x448505][_0x1847b4[_0x3f6c74]]){var _0xa60272=_['trim'](_0x296984[_0xbd7a('0x6c')][_0x448505][_0x1847b4[_0x3f6c74]][_0xbd7a('0x70')](/"/g,'\x27'));switch(_0x3f6c74){case _0xbd7a('0x36'):var _0x4cc5dd=moment(_0xa60272,_0xbd7a('0x71'),!![]);if(_0x4cc5dd[_0xbd7a('0x72')]()){_0x39c2d1['push']('\x22'+_0xa60272+'\x22');}else{_0x21c38b[_0xbd7a('0x19')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xbd7a('0x73'):var _0x47e3f6=parseInt(_0xa60272);_0xa60272=_[_0xbd7a('0x74')](_0x47e3f6)||_0x47e3f6<0x0||_0x47e3f6>0x4?_0x4e12b2?0x3:0x2:_0x47e3f6;_0x39c2d1[_0xbd7a('0x19')]('\x22'+_0xa60272+'\x22');break;case _0xbd7a('0x3a'):var _0x441475=parseInt(_0xa60272);if(_['isNumber'](_0x441475)&&_[_0xbd7a('0x75')](_0x24d507,_0x441475)){_0x39c2d1[_0xbd7a('0x19')]('\x22'+_0x441475+'\x22');}else{_0x21c38b[_0xbd7a('0x19')](_0xbd7a('0x76'));}break;case _0xbd7a('0x77'):if(isEmail(_0xa60272)){_0x39c2d1[_0xbd7a('0x19')]('\x22'+_0xa60272+'\x22');}else{_0x21c38b['push'](_0xbd7a('0x78'));}break;case _0xbd7a('0x79'):var _0x576324=moment(_0xa60272,_0xbd7a('0x7a'),!![]);if(_0x576324[_0xbd7a('0x72')]()){_0x39c2d1[_0xbd7a('0x19')]('\x22'+_0xa60272+'\x22');}else{_0x21c38b[_0xbd7a('0x19')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x39c2d1[_0xbd7a('0x19')]('\x22'+_0xa60272+'\x22');}}else{switch(_0x3f6c74){case _0xbd7a('0x7b'):case _0xbd7a('0x10'):_0x21c38b['push'](_0x3f6c74+_0xbd7a('0x7c'));break;default:_0x39c2d1[_0xbd7a('0x19')]('\x22\x22');}}}}else{var _0x3e73e3='';if(!_[_0xbd7a('0x18')](_0x4bb522)){if(!_0x7a7cf1[_0xbd7a('0x6f')](_0x4bb522['id'])){for(var _0x5ad8c1=0x0;_0x5ad8c1<_0x1847b4[_0x3f6c74][_0xbd7a('0x17')];_0x5ad8c1++){var _0xa60272=_['trim'](_0x296984[_0xbd7a('0x6c')][_0x448505][_0x1847b4[_0x3f6c74][_0x5ad8c1]][_0xbd7a('0x70')](/"/g,'\x27'));var _0x33bd90=phoneDescriptions[_0xbd7a('0x6e')](_0x320e14=>_0x320e14[_0xbd7a('0x7d')]===_0x4bb522['id']);if(!_[_0xbd7a('0x18')](_0x33bd90)){var _0xecba26=_[_0xbd7a('0x7e')](_0x296984['data'][_0x448505][_0x1847b4[_0x33bd90[_0xbd7a('0x7f')]][0x0]]['replace'](/"/g,'\x27'));if(!_['isNil'](_0xecba26))_0xa60272=_0xa60272+'§'+_0xecba26;}if(_0x3e73e3=='')_0x3e73e3=_0xa60272;else _0x3e73e3+='|'+_0xa60272;}_0xae2cd0[_0xbd7a('0x19')](_0x4bb522['id']+':'+_0x3e73e3);_0x7a7cf1[_0x4bb522['id']]=0x1;}}}}if(hasAdditionalPhones){_0x39c2d1[_0xbd7a('0x19')]('\x22'+_0xae2cd0[_0xbd7a('0x11')](';')+'\x22');}if(_0x21c38b[_0xbd7a('0x17')]){handleError(_0x296984[_0xbd7a('0x6c')][_0x448505],{'code':_0xbd7a('0x80'),'message':_0x21c38b[_0xbd7a('0x11')]()});}else{fs['appendFileSync'](_0x3e6d58,_0x39c2d1[_0xbd7a('0x11')]()+'\x0a');}_0x39c2d1=[];}if(!(stats[_0xbd7a('0x6d')]%0xc8)){socket[_0xbd7a('0x81')]('contact:import:'+_0x4fc0fb,stats);stats['errors']=[];}}if(stopped){logger[_0xbd7a('0x54')]('Abort\x20parser');_0x38621a[_0xbd7a('0x82')]();}}catch(_0x5bb3ed){handleError(_0x296984['data'][_0x448505],{'code':_0xbd7a('0x83'),'message':_0x5bb3ed[_0xbd7a('0x1d')]});logger[_0xbd7a('0x1c')](_0xbd7a('0x84'),_0x5bb3ed[_0xbd7a('0x1d')]);}},'complete':function(){try{var _0x238267=[];var _0x20cf3d=tempTableName;_0x238267[_0xbd7a('0x19')](_0xbd7a('0x85')+_0x20cf3d+_0xbd7a('0x86'));logger[_0xbd7a('0x54')](_0xbd7a('0x87'),contactItemTypes['length']);var _0x106aa4=util[_0xbd7a('0xb')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x3e6d58,_0x20cf3d,_0x5cd66a,_0xaaa789[_0xbd7a('0x37')],_0xaaa789[_0xbd7a('0x88')]||null,NOW,NOW);if(_[_0xbd7a('0x18')](_0x1847b4[_0xbd7a('0x36')])){_0x106aa4+=_0xbd7a('0x89');}_0x238267[_0xbd7a('0x19')](_0x106aa4);BPromise[_0xbd7a('0x8a')](_0x238267,handleQuery)[_0xbd7a('0x1f')](function(_0x575fd9){BPromise[_0xbd7a('0x1a')]([handleAdditionalPhones()])['then'](function(){_0x238267=[];for(var _0x1b2892=0x0;_0x1b2892\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','Contact.phone','Contact.mobile','c.fax','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','toString','groupBy','enableEmailPreview','COUNT(*)','getSelectedTags','isEmpty','t.id\x20IN\x20?','Sequelize','SELECT','exports','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','agent','search','select','field','from','tools_tags','getInteractionFK','user_has_','u.id','u.fullname','ui.','left_join','users','u.id\x20=\x20ui.UserId'];(function(_0xe565a0,_0x2b34a5){var _0x533ee0=function(_0x4ae9c9){while(--_0x4ae9c9){_0xe565a0['push'](_0xe565a0['shift']());}};_0x533ee0(++_0x2b34a5);}(_0x2547,0x1cd));var _0x7254=function(_0x50d1a9,_0x392df9){_0x50d1a9=_0x50d1a9-0x0;var _0xa32d98=_0x2547[_0x50d1a9];return _0xa32d98;};'use strict';var _=require('lodash');var squel=require(_0x7254('0x0'));var as=require(_0x7254('0x1'));var qs=require(_0x7254('0x2'));var updateInteraction=require(_0x7254('0x3'))[_0x7254('0x4')];var utils=require(_0x7254('0x5'));var db=require(_0x7254('0x6'))['db'];function skipInteractionsQuery(_0x265ebf,_0x53a02f,_0x2ddeae){var _0x59705f=![];var _0x67f427=utils[_0x7254('0x7')](_0x265ebf);if(_0x53a02f['role']===_0x7254('0x8')&&!_0x2ddeae[_0x7254('0x9')]&&!_0x2ddeae[_0x67f427]){_0x59705f=!![];}return _0x59705f;}function getTagsQuery(){return squel[_0x7254('0xa')]()['field']('id')[_0x7254('0xb')]('name')['field']('color')[_0x7254('0xc')](_0x7254('0xd'));}function getUsersQuery(_0x31d5a5,_0x310c21){var _0x6828b6=utils[_0x7254('0xe')](_0x31d5a5);var _0x4d19e8=_0x7254('0xf')+_0x31d5a5+'_interactions';var _0x1be372=squel['select']()[_0x7254('0xb')](_0x7254('0x10'))[_0x7254('0xb')](_0x7254('0x11'))[_0x7254('0xb')](_0x7254('0x12')+_0x6828b6)[_0x7254('0xc')](_0x4d19e8,'ui')[_0x7254('0x13')](_0x7254('0x14'),'u',_0x7254('0x15'));if(_0x310c21[_0x7254('0x16')]>0x0){_0x1be372[_0x7254('0x17')](_0x7254('0x12')+_0x6828b6+'\x20IN\x20?',_[_0x7254('0x18')](_0x310c21,'id'));}return _0x1be372;}function getInteractionsQuery(_0x4395fb){var _0xf47255=utils[_0x7254('0x19')](_0x4395fb);var _0x3b5f06=utils[_0x7254('0x7')](_0x4395fb);var _0x2737e0=utils['getInteractionFK'](_0x4395fb);return squel[_0x7254('0xa')]()[_0x7254('0xc')](_0xf47255[_0x7254('0x1a')],'i')[_0x7254('0x13')](_0x7254('0x1b'),'c',_0x7254('0x1c'))[_0x7254('0x13')](_0x7254('0x14'),'o',_0x7254('0x1d'))[_0x7254('0x13')](_0xf47255[_0x7254('0x1e')],'a',_0x7254('0x1f')+_0x3b5f06)[_0x7254('0x13')](_0xf47255[_0x7254('0x20')],'me',_0x7254('0x21')+_0x2737e0+_0x7254('0x22'))[_0x7254('0x13')](_0xf47255[_0x7254('0x23')],'it',_0x7254('0x24')+_0x2737e0+_0x7254('0x22'))[_0x7254('0x13')]('tools_tags','t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x136ea3={'body':squel[_0x7254('0x25')](),'contact':squel[_0x7254('0x25')](),'default':squel[_0x7254('0x25')](),'fields':squel[_0x7254('0x25')](),'filter':squel[_0x7254('0x25')](),'read':squel[_0x7254('0x25')](),'tags':{'clause':squel['expr'](),'ids':null},'user':squel[_0x7254('0x25')]()};return _0x136ea3;}function parseTagParameter(_0x21a579){var _0x2b4f46=squel['expr']();if(_0x21a579){var _0x3c22d0=utils['getSelectedTags'](_0x21a579);_0x3c22d0[_0x7254('0x26')](function(_0x134a9e){_0x2b4f46['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x134a9e+',%');});}return _0x2b4f46;}function parseReadParameter(_0x17bb46){var _0x158356='';if(_0x17bb46){_0x158356='unreadMessages\x20{OPERATOR}\x200';if(_0x17bb46==='1'){_0x158356=_0x158356[_0x7254('0x27')](_0x7254('0x28'),'=');}else{_0x158356=_0x158356[_0x7254('0x27')](_0x7254('0x28'),'>');}}return _0x158356;}function parseSearchFilter(_0x43bf02,_0xfe02ea){var _0x4bba3f=squel[_0x7254('0x25')]();if(_0xfe02ea){var _0x2dba3f=_0xfe02ea['replace']('\x5c','\x5c\x5c')[_0x7254('0x27')](/'/g,'\x27\x27');if(qs[_0x7254('0x29')](_0x2dba3f)){_0x4bba3f['or'](_0x7254('0x2a'),_0x2dba3f+'%');if(['sms',_0x7254('0x2b')][_0x7254('0x2c')](_0x43bf02)){_0x4bba3f['or'](_0x7254('0x2d'),_0x2dba3f+'%');}else if(_0x43bf02===_0x7254('0x2e')){_0x4bba3f['or'](_0x7254('0x2f'),_0x2dba3f+'%');}else if(_0x43bf02===_0x7254('0x30')){_0x4bba3f['or'](_0x7254('0x31'),_0x2dba3f+'%');}}else if(_0x43bf02==='mail'&&qs[_0x7254('0x32')](_0x2dba3f)){_0x4bba3f['or']('c.email\x20LIKE\x20?',_0x2dba3f+'%');}else{if(_0x43bf02==='mail'){_0x4bba3f['or'](_0x7254('0x33'),qs[_0x7254('0x34')](_0x2dba3f,!![]))['or'](_0x7254('0x35'),qs[_0x7254('0x34')](_0x2dba3f));}else{if(_0x43bf02!==_0x7254('0x2e')){_0x4bba3f['or'](_0x7254('0x36'),qs[_0x7254('0x34')](_0x2dba3f));}_0x4bba3f['or'](_0x7254('0x37'),_0x2dba3f+'%');}}}return _0x4bba3f;}function parseAdvancedSearchFilter(_0x447515,_0x24b629){var _0x235822=getSqlClauses();var _0x3b0abd=as[_0x7254('0x38')](_0x447515);var _0x46cecb=_0x3b0abd['sqlOperator'];for(var _0x1fd417=0x0;_0x1fd417<_0x3b0abd[_0x7254('0x39')][_0x7254('0x16')];_0x1fd417++){var _0x3a6cf7=_0x3b0abd[_0x7254('0x39')][_0x1fd417];var _0x5e100e='i';var _0x140bb2=_['find'](_0x24b629,[_0x7254('0x3a'),_0x3a6cf7[_0x7254('0xb')]]);if(_0x140bb2){var _0x3bb517=as[_0x7254('0x3b')](_0x5e100e,_0x140bb2[_0x7254('0x3c')],_0x3a6cf7);_0x235822['default'][_0x46cecb](_0x3bb517[_0x7254('0x3d')],_0x3bb517['value'][_0x7254('0x3e')],_0x3bb517[_0x7254('0x3f')]['end']);}else{switch(_0x3a6cf7[_0x7254('0xb')]){case _0x7254('0x40'):var _0x20ea94=parseReadParameter(_0x3a6cf7[_0x7254('0x3f')]);_0x235822[_0x7254('0x41')][_0x7254('0x42')](_0x20ea94);break;case'Contact':if(_0x3a6cf7[_0x7254('0x43')]===_0x7254('0x44')){if(_0x3a6cf7[_0x7254('0x3f')]['split']('\x20')[_0x7254('0x16')]>0x1){_0x235822[_0x7254('0x45')][_0x46cecb](_0x7254('0x46'),qs['getFullTextValue'](_0x3a6cf7[_0x7254('0x3f')],!![]),null);}else{var _0x20ada9='%'+_0x3a6cf7[_0x7254('0x3f')]+'%';_0x235822[_0x7254('0x45')][_0x46cecb](_0x7254('0x47'),_0x20ada9,_0x20ada9,_0x20ada9);}}else{_0x140bb2=_['find'](_0x24b629,['name',_0x7254('0x48')]);_0x3a6cf7[_0x7254('0xb')]=_0x7254('0x48');_0x3bb517=as[_0x7254('0x3b')](_0x5e100e,_0x140bb2['type'],_0x3a6cf7);_0x235822['contact'][_0x46cecb](_0x3bb517[_0x7254('0x3d')],_0x3bb517['value'][_0x7254('0x3e')],_0x3bb517[_0x7254('0x3f')][_0x7254('0x49')]);}break;case _0x7254('0x4a'):var _0x5e75e9=_0x3a6cf7['value'][_0x7254('0x4b')](',')[_0x7254('0x18')](function(_0x29b90c){return Number(_0x29b90c);});var _0x2435c9=parseTagParameter(_0x5e75e9);_0x235822[_0x7254('0x4c')]['clause']['and'](_0x2435c9);_0x235822[_0x7254('0x4c')][_0x7254('0x4d')]=_0x5e75e9;break;case _0x7254('0x4e'):if(_0x3a6cf7['operator']===_0x7254('0x44')){_0x235822[_0x7254('0x4f')][_0x46cecb]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x3a6cf7[_0x7254('0x3f')]+'%',null);}else{_0x140bb2=_[_0x7254('0x50')](_0x24b629,[_0x7254('0x3a'),_0x7254('0x51')]);_0x3a6cf7['field']=_0x7254('0x51');_0x3bb517=as[_0x7254('0x3b')](_0x5e100e,_0x140bb2['type'],_0x3a6cf7);_0x235822[_0x7254('0x4f')][_0x46cecb](_0x3bb517[_0x7254('0x3d')],_0x3bb517[_0x7254('0x3f')]['start'],_0x3bb517[_0x7254('0x3f')][_0x7254('0x49')]);}break;case'body':case'plainBody':_0x3bb517=as[_0x7254('0x3b')]('me',null,_0x3a6cf7);_0x235822['body'][_0x46cecb](_0x3bb517[_0x7254('0x3d')],_0x3bb517[_0x7254('0x3f')]['start'],_0x3bb517['value'][_0x7254('0x49')]);break;}}}return _0x235822;}function parseModelFields(_0xc40bc5,_0x38bcd5,_0x104d98){var _0x200e5c=utils[_0x7254('0x7')](_0xc40bc5);var _0x4fe2ae=squel[_0x7254('0x25')]();var _0x5ef7f9=_(_0x38bcd5)[_0x7254('0x52')]()[_0x7254('0x18')](function(_0x450d24){return _['some'](_0x104d98,[_0x7254('0x3a'),_0x450d24])?_0x450d24:undefined;})[_0x7254('0x53')]()[_0x7254('0x3f')]();if(_0x5ef7f9['length']>0x0){_0x5ef7f9[_0x7254('0x26')](function(_0x3269b5){if(_0x3269b5===_0x200e5c){_0x4fe2ae[_0x7254('0x42')]('i.'+_0x200e5c+_0x7254('0x54'),[][_0x7254('0x55')](_0x38bcd5[_0x3269b5]));}else if(_0x3269b5==='createdAt'){var _0x5e66c6=JSON[_0x7254('0x56')](_0x38bcd5[_0x3269b5])[_0x7254('0x57')];var _0x441d23=JSON[_0x7254('0x56')](_0x38bcd5[_0x3269b5])[_0x7254('0x58')];_0x4fe2ae['and']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5e66c6,_0x441d23);}else{if(_0x38bcd5[_0x3269b5]===_0x7254('0x59')){_0x4fe2ae[_0x7254('0x42')]('i.'+_0x3269b5+_0x7254('0x5a'));}else{_0x4fe2ae[_0x7254('0x42')]('i.'+_0x3269b5+'\x20=\x20?',_0x38bcd5[_0x3269b5]);}}});}return _0x4fe2ae;}function parseQueryParameters(_0xaf6d3d,_0x3e3d09,_0x5d54e4){var _0x460766=getSqlClauses();return Promise['resolve']()[_0x7254('0x5b')](function(){return parseModelFields(_0xaf6d3d,_0x3e3d09,_0x5d54e4);})['then'](function(_0x15fc0e){_0x460766['fields']['and'](_0x15fc0e);return parseReadParameter(_0x3e3d09[_0x7254('0x41')]);})[_0x7254('0x5b')](function(_0xc56bea){_0x460766[_0x7254('0x41')]['and'](_0xc56bea);return parseTagParameter(_0x3e3d09[_0x7254('0x5c')]);})['then'](function(_0x3ffc71){_0x460766[_0x7254('0x4c')][_0x7254('0x5d')][_0x7254('0x42')](_0x3ffc71);return parseSearchFilter(_0xaf6d3d,_0x3e3d09[_0x7254('0x5e')]);})[_0x7254('0x5b')](function(_0x48b69a){_0x460766[_0x7254('0x5e')]=_0x48b69a;return _0x460766;});}function checkAccountsRestrictions(_0x2d62c2,_0x9bf8f0,_0x24a6a5){var _0x281436=utils[_0x7254('0x7')](_0x2d62c2);var _0x556cad=_0x7254('0x5f')+_[_0x7254('0x60')](_0x2d62c2)+(_0x2d62c2===_0x7254('0x61')?_0x7254('0x62'):_0x7254('0x63'));var _0x2396ce=squel[_0x7254('0x25')]();return Promise['resolve']()['then'](function(){if(_0x24a6a5[_0x7254('0x9')]&&_0x9bf8f0['role']==='agent'){return _0x9bf8f0[_0x556cad]({'attributes':['id'],'raw':!![]});}})[_0x7254('0x5b')](function(_0xbddcbb){if(_0xbddcbb){if(_0xbddcbb[_0x7254('0x16')]===0x0){_0x2396ce['and']('i.'+_0x281436+_0x7254('0x5a'));}else{_0x2396ce['and']('i.'+_0x281436+_0x7254('0x54'),_[_0x7254('0x18')](_0xbddcbb,'id'));}}else if(!_0x24a6a5[_0x281436]){_0x2396ce[_0x7254('0x42')]('i.'+_0x281436+_0x7254('0x64'));}})[_0x7254('0x5b')](function(){return _0x2396ce;});}function getClosedOrderClause(_0x5a356d,_0x35882b){var _0x3ab117='';var _0x178353=[_0x7254('0x65'),'i.secondDisposition','i.disposition'];if(_0x5a356d===_0x7254('0x66')){_0x178353[_0x7254('0x67')](_0x7254('0x68'));}if(_0x35882b[_0x7254('0x69')]==='0'&&_0x5a356d===_0x7254('0x66')){_0x3ab117=_0x7254('0x68');}else{if(_0x35882b[_0x7254('0x69')]==='1'){_0x178353[_0x7254('0x6a')]();}_0x3ab117=_0x7254('0x6b')+_0x178353[_0x7254('0x6c')](',\x20')+')';}return _0x3ab117;}function getFilteredInteractions(_0x109b74,_0x1395d6,_0xf924a3,_0x5647dd){var _0x476787=utils[_0x7254('0xe')](_0x109b74);var _0xf08ba7=_['capitalize'](_0x109b74)+_0x7254('0x6d');var _0x2aa248=[];var _0x2df8fa=getTagsQuery();var _0xc37d5e={'type':db['Sequelize'][_0x7254('0x6e')]['SELECT'],'raw':!![]};var _0x3d262f=[];var _0x4b86ba=[];return db[_0x7254('0x6f')][_0x7254('0x70')](_0x2df8fa['toString'](),_0xc37d5e)[_0x7254('0x5b')](function(_0x5ccade){_0x2aa248=_[_0x7254('0x71')](_0x5ccade,'id');_0xc37d5e=_['merge'](_0xc37d5e,{'model':db[_0xf08ba7],'mapToModel':!![],'nest':!![]});if(_0xf924a3[_0x7254('0x72')]){_0x5647dd[_0x7254('0x73')][_0x7254('0x26')](function(_0x24619f){_0x1395d6[_0x7254('0xb')]('i.'+_0x24619f);});}else{_0x1395d6[_0x7254('0xb')](_0x7254('0x74'),_0x7254('0x40'));_0x1395d6['field'](_0x7254('0x75'),'Account.key');_0x1395d6[_0x7254('0xb')](_0x7254('0x76'),_0x7254('0x77'));if(_0x109b74===_0x7254('0x66')){_0x1395d6[_0x7254('0xb')](_0x7254('0x78'),_0x7254('0x79'));_0x1395d6[_0x7254('0xb')]('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x7254('0x7a'));_0x1395d6['field'](_0x7254('0x7b'));_0x1395d6[_0x7254('0xb')](_0x7254('0x7c'));_0x1395d6[_0x7254('0xb')](_0x7254('0x7d'));_0x1395d6[_0x7254('0xb')](_0x7254('0x7e'));_0x1395d6[_0x7254('0xb')](_0x7254('0x7f'));_0x1395d6[_0x7254('0xb')](_0x7254('0x80'));_0x1395d6[_0x7254('0xb')](_0x7254('0x81'));_0x1395d6[_0x7254('0xb')](_0x7254('0x82'));_0x1395d6[_0x7254('0xb')](_0x7254('0x83'));_0x1395d6['field']('i.disposition');_0x1395d6[_0x7254('0xb')](_0x7254('0x84'));_0x1395d6['field']('i.thirdDisposition');_0x1395d6['field'](_0x7254('0x68'));_0x1395d6[_0x7254('0xb')](_0x7254('0x85'));_0x1395d6[_0x7254('0xb')]('i.ContactId');_0x1395d6[_0x7254('0xb')](_0x7254('0x86'));_0x1395d6['field'](_0x7254('0x87'));}else if(_0x109b74===_0x7254('0x30')){_0x1395d6[_0x7254('0xb')]('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','contactName');}else{_0x1395d6[_0x7254('0xb')](_0x7254('0x88'),'contactName');}if(_0x109b74!==_0x7254('0x66')){_0x1395d6[_0x7254('0xb')](_0x7254('0x89'));}_0x1395d6[_0x7254('0xb')](_0x7254('0x8a'),'Contact.firstName');_0x1395d6[_0x7254('0xb')](_0x7254('0x8b'),_0x7254('0x8c'));_0x1395d6['field'](_0x7254('0x8d'),'Contact.email');_0x1395d6['field']('c.phone',_0x7254('0x8e'));_0x1395d6['field']('c.mobile',_0x7254('0x8f'));_0x1395d6[_0x7254('0xb')](_0x7254('0x90'),'Contact.fax');_0x1395d6[_0x7254('0xb')]('o.fullname',_0x7254('0x91'));_0x1395d6[_0x7254('0xb')]('o.internal',_0x7254('0x92'));_0x1395d6[_0x7254('0xb')](_0x7254('0x93'),_0x7254('0x94'));}if(_0x5647dd[_0x7254('0x95')]){_0x1395d6[_0x7254('0x95')](_0x5647dd[_0x7254('0x95')]);}if(_0x5647dd['offset']){_0x1395d6[_0x7254('0x96')](_0x5647dd['offset']);}return db['sequelize'][_0x7254('0x70')](_0x1395d6[_0x7254('0x97')](),_0xc37d5e);})[_0x7254('0x5b')](function(_0x5dea8e){_0x3d262f=_0x5dea8e;var _0x54c7d5=getUsersQuery(_0x109b74,_0x3d262f);return db[_0x7254('0x6f')][_0x7254('0x70')](_0x54c7d5[_0x7254('0x97')](),_0xc37d5e);})[_0x7254('0x5b')](function(_0x503d37){_0x4b86ba=_[_0x7254('0x98')](_0x503d37,_0x476787);if(_0x109b74==='mail'){return db['Setting']['findOne']({'attributes':[_0x7254('0x99')],'raw':!![]});}})[_0x7254('0x5b')](function(_0x4f0bac){var _0x48480d=_0x4f0bac?_0x4f0bac[_0x7254('0x99')]:undefined;var _0x536677=_0x3d262f['map'](function(_0x5c8769){return updateInteraction(_0x5c8769,_0x2aa248,_0x4b86ba,_0x48480d);});return Promise['all'](_0x536677);});}function countFilteredInteractions(_0x1fdbf4,_0x12188d){var _0x4c965f=_0x1fdbf4['clone']();_0x4c965f[_0x7254('0xb')](_0x7254('0x9a'));_0x4c965f[_0x7254('0xb')](_0x7254('0x74'),_0x7254('0x40'));var _0x4b2cc6=utils[_0x7254('0x9b')](_0x12188d);if(!_[_0x7254('0x9c')](_0x4b2cc6)){_0x4c965f[_0x7254('0x17')](_0x7254('0x9d'),_0x4b2cc6);}var _0x3beea2={'type':db[_0x7254('0x9e')][_0x7254('0x6e')][_0x7254('0x9f')],'raw':!![]};return db['sequelize']['query'](_0x4c965f[_0x7254('0x97')](),_0x3beea2);}module[_0x7254('0xa0')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0xb28a=['i.lastMsgDirection','i.to','i.ContactId','i.MailAccountId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','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','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','sequelize','groupBy','Setting','enableEmailPreview','all','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','QueryTypes','exports','squel','../parsers/advancedSearch','./update-interaction','getAccountFK','role','agent','field','name','color','from','getInteractionFK','user_has_','_interactions','select','u.fullname','ui.','left_join','length','where','\x20IN\x20?','getInteractionsTables','interactions','cm_contacts','users','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','me.','interactionsTags','\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','getSelectedTags','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','includes','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','mail','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','fax','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','buildExpression','default','text','start','value','unreadMessages','read','and','Contact','$substring','contact','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','ContactId','end','Tag','split','map','tags','ids','UserId','user','body','plainBody','compact','forEach','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','tag','clause','filter','get','capitalize','chat','Websites','Accounts','search','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','unshift','i.substatus','closed','shift','join','Interaction','Sequelize','SELECT','query','toString','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','a.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.createdAt','i.closed','i.closedAt','i.attach','i.lastMsgAt'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb28a,0x166));var _0xab28=function(_0xa87a5b,_0x50a101){_0xa87a5b=_0xa87a5b-0x0;var _0x293c4=_0xb28a[_0xa87a5b];return _0x293c4;};'use strict';var _=require('lodash');var squel=require(_0xab28('0x0'));var as=require(_0xab28('0x1'));var qs=require('../parsers/qs');var updateInteraction=require(_0xab28('0x2'))['updateInteraction'];var utils=require('./utils');var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x451fc9,_0x1cdc41,_0x17b2a5){var _0x3b6103=![];var _0x133169=utils[_0xab28('0x3')](_0x451fc9);if(_0x1cdc41[_0xab28('0x4')]===_0xab28('0x5')&&!_0x17b2a5['search']&&!_0x17b2a5[_0x133169]){_0x3b6103=!![];}return _0x3b6103;}function getTagsQuery(){return squel['select']()[_0xab28('0x6')]('id')[_0xab28('0x6')](_0xab28('0x7'))[_0xab28('0x6')](_0xab28('0x8'))[_0xab28('0x9')]('tools_tags');}function getUsersQuery(_0x2291dc,_0x49771b){var _0x3e5b85=utils[_0xab28('0xa')](_0x2291dc);var _0x387e2c=_0xab28('0xb')+_0x2291dc+_0xab28('0xc');var _0x3c53a2=squel[_0xab28('0xd')]()[_0xab28('0x6')]('u.id')[_0xab28('0x6')](_0xab28('0xe'))[_0xab28('0x6')](_0xab28('0xf')+_0x3e5b85)[_0xab28('0x9')](_0x387e2c,'ui')[_0xab28('0x10')]('users','u','u.id\x20=\x20ui.UserId');if(_0x49771b[_0xab28('0x11')]>0x0){_0x3c53a2[_0xab28('0x12')](_0xab28('0xf')+_0x3e5b85+_0xab28('0x13'),_['map'](_0x49771b,'id'));}return _0x3c53a2;}function getInteractionsQuery(_0x28ebe2){var _0x4912fa=utils[_0xab28('0x14')](_0x28ebe2);var _0x54f79b=utils[_0xab28('0x3')](_0x28ebe2);var _0x2b0b5c=utils[_0xab28('0xa')](_0x28ebe2);return squel[_0xab28('0xd')]()[_0xab28('0x9')](_0x4912fa[_0xab28('0x15')],'i')[_0xab28('0x10')](_0xab28('0x16'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xab28('0x10')](_0xab28('0x17'),'o',_0xab28('0x18'))[_0xab28('0x10')](_0x4912fa[_0xab28('0x19')],'a',_0xab28('0x1a')+_0x54f79b)[_0xab28('0x10')](_0x4912fa['messages'],'me',_0xab28('0x1b')+_0x2b0b5c+'\x20=\x20i.id')[_0xab28('0x10')](_0x4912fa[_0xab28('0x1c')],'it','it.'+_0x2b0b5c+_0xab28('0x1d'))[_0xab28('0x10')](_0xab28('0x1e'),'t',_0xab28('0x1f'));}function getSqlClauses(){var _0x4549e6={'body':squel[_0xab28('0x20')](),'contact':squel[_0xab28('0x20')](),'default':squel['expr'](),'fields':squel[_0xab28('0x20')](),'filter':squel['expr'](),'read':squel[_0xab28('0x20')](),'tags':{'clause':squel[_0xab28('0x20')](),'ids':null},'user':squel['expr']()};return _0x4549e6;}function parseTagParameter(_0x3928f0){var _0x5e0099=squel[_0xab28('0x20')]();if(_0x3928f0){var _0x2a3405=utils[_0xab28('0x21')](_0x3928f0);_0x2a3405['forEach'](function(_0x24a692){_0x5e0099['or'](_0xab28('0x22'),'%,'+_0x24a692+',%');});}return _0x5e0099;}function parseReadParameter(_0x4a6435){var _0x6a494e='';if(_0x4a6435){_0x6a494e=_0xab28('0x23');if(_0x4a6435==='1'){_0x6a494e=_0x6a494e[_0xab28('0x24')](_0xab28('0x25'),'=');}else{_0x6a494e=_0x6a494e['replace'](_0xab28('0x25'),'>');}}return _0x6a494e;}function parseSearchFilter(_0x299da7,_0x33e5ce){var _0xb6aa4e=squel[_0xab28('0x20')]();if(_0x33e5ce){var _0x4114fd=_0x33e5ce[_0xab28('0x24')]('\x5c','\x5c\x5c')[_0xab28('0x24')](/'/g,'\x27\x27');if(qs[_0xab28('0x26')](_0x4114fd)){_0xb6aa4e['or'](_0xab28('0x27'),_0x4114fd+'%');if(['sms','whatsapp'][_0xab28('0x28')](_0x299da7)){_0xb6aa4e['or']('i.phone\x20LIKE\x20?',_0x4114fd+'%');}else if(_0x299da7==='fax'){_0xb6aa4e['or'](_0xab28('0x29'),_0x4114fd+'%');}else if(_0x299da7===_0xab28('0x2a')){_0xb6aa4e['or'](_0xab28('0x2b'),_0x4114fd+'%');}}else if(_0x299da7===_0xab28('0x2c')&&qs[_0xab28('0x2d')](_0x4114fd)){_0xb6aa4e['or'](_0xab28('0x2e'),_0x4114fd+'%');}else{if(_0x299da7==='mail'){_0xb6aa4e['or'](_0xab28('0x2f'),qs[_0xab28('0x30')](_0x4114fd))['or'](_0xab28('0x31'),qs['getFullTextValue'](_0x4114fd));}else{if(_0x299da7!==_0xab28('0x32')){_0xb6aa4e['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xab28('0x30')](_0x4114fd));}_0xb6aa4e['or'](_0xab28('0x33'),_0x4114fd+'%');}}}return _0xb6aa4e;}function parseAdvancedSearchFilter(_0x518202,_0x3dd7d6){var _0x12b5df=getSqlClauses();var _0x215e25=as[_0xab28('0x34')](_0x518202);var _0x64b7ef=_0x215e25[_0xab28('0x35')];for(var _0x4f5e45=0x0;_0x4f5e45<_0x215e25[_0xab28('0x36')][_0xab28('0x11')];_0x4f5e45++){var _0x5869ba=_0x215e25[_0xab28('0x36')][_0x4f5e45];var _0x288260='i';var _0x22cb03=_[_0xab28('0x37')](_0x3dd7d6,[_0xab28('0x7'),_0x5869ba[_0xab28('0x6')]]);if(_0x22cb03){var _0x2d3ba7=as[_0xab28('0x38')](_0x288260,_0x22cb03['type'],_0x5869ba);_0x12b5df[_0xab28('0x39')][_0x64b7ef](_0x2d3ba7[_0xab28('0x3a')],_0x2d3ba7['value'][_0xab28('0x3b')],_0x2d3ba7[_0xab28('0x3c')]['end']);}else{switch(_0x5869ba[_0xab28('0x6')]){case _0xab28('0x3d'):var _0x93d634=parseReadParameter(_0x5869ba[_0xab28('0x3c')]);_0x12b5df[_0xab28('0x3e')][_0xab28('0x3f')](_0x93d634);break;case _0xab28('0x40'):if(_0x5869ba['operator']===_0xab28('0x41')){if(_0x5869ba[_0xab28('0x3c')]['split']('\x20')[_0xab28('0x11')]>0x1){_0x12b5df[_0xab28('0x42')][_0x64b7ef](_0xab28('0x43'),qs[_0xab28('0x30')](_0x5869ba[_0xab28('0x3c')]),null);}else{var _0x5b77c1='%'+_0x5869ba[_0xab28('0x3c')]+'%';_0x12b5df['contact'][_0x64b7ef]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x5b77c1,_0x5b77c1,_0x5b77c1);}}else{_0x22cb03=_[_0xab28('0x37')](_0x3dd7d6,[_0xab28('0x7'),_0xab28('0x44')]);_0x5869ba[_0xab28('0x6')]=_0xab28('0x44');_0x2d3ba7=as['buildExpression'](_0x288260,_0x22cb03['type'],_0x5869ba);_0x12b5df[_0xab28('0x42')][_0x64b7ef](_0x2d3ba7['text'],_0x2d3ba7[_0xab28('0x3c')]['start'],_0x2d3ba7['value'][_0xab28('0x45')]);}break;case _0xab28('0x46'):var _0x12d90f=_0x5869ba[_0xab28('0x3c')][_0xab28('0x47')](',')[_0xab28('0x48')](function(_0x53c232){return Number(_0x53c232);});var _0x4dd187=parseTagParameter(_0x12d90f);_0x12b5df[_0xab28('0x49')]['clause'][_0xab28('0x3f')](_0x4dd187);_0x12b5df['tags'][_0xab28('0x4a')]=_0x12d90f;break;case'User':if(_0x5869ba['operator']===_0xab28('0x41')){_0x12b5df['user'][_0x64b7ef]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x5869ba['value']+'%',null);}else{_0x22cb03=_[_0xab28('0x37')](_0x3dd7d6,['name',_0xab28('0x4b')]);_0x5869ba[_0xab28('0x6')]=_0xab28('0x4b');_0x2d3ba7=as[_0xab28('0x38')](_0x288260,_0x22cb03['type'],_0x5869ba);_0x12b5df[_0xab28('0x4c')][_0x64b7ef](_0x2d3ba7[_0xab28('0x3a')],_0x2d3ba7[_0xab28('0x3c')][_0xab28('0x3b')],_0x2d3ba7[_0xab28('0x3c')]['end']);}break;case _0xab28('0x4d'):case _0xab28('0x4e'):_0x2d3ba7=as['buildExpression']('me',null,_0x5869ba);_0x12b5df[_0xab28('0x4d')][_0x64b7ef](_0x2d3ba7['text'],_0x2d3ba7['value'][_0xab28('0x3b')],_0x2d3ba7[_0xab28('0x3c')]['end']);break;}}}return _0x12b5df;}function parseModelFields(_0x39a4ef,_0x52fa3a,_0x1d1407){var _0x46c0dd=utils[_0xab28('0x3')](_0x39a4ef);var _0x387b71=squel['expr']();var _0x1e6513=_(_0x52fa3a)['keys']()['map'](function(_0xc22db9){return _['some'](_0x1d1407,[_0xab28('0x7'),_0xc22db9])?_0xc22db9:undefined;})[_0xab28('0x4f')]()['value']();if(_0x1e6513[_0xab28('0x11')]>0x0){_0x1e6513[_0xab28('0x50')](function(_0x49bc36){if(_0x49bc36===_0x46c0dd){_0x387b71[_0xab28('0x3f')]('i.'+_0x46c0dd+'\x20IN\x20?',[][_0xab28('0x51')](_0x52fa3a[_0x49bc36]));}else if(_0x49bc36===_0xab28('0x52')){var _0x41c0b8=JSON[_0xab28('0x53')](_0x52fa3a[_0x49bc36])[_0xab28('0x54')];var _0x237be6=JSON[_0xab28('0x53')](_0x52fa3a[_0x49bc36])[_0xab28('0x55')];_0x387b71['and'](_0xab28('0x56'),_0x41c0b8,_0x237be6);}else{if(_0x52fa3a[_0x49bc36]===_0xab28('0x57')){_0x387b71[_0xab28('0x3f')]('i.'+_0x49bc36+_0xab28('0x58'));}else{_0x387b71[_0xab28('0x3f')]('i.'+_0x49bc36+_0xab28('0x59'),_0x52fa3a[_0x49bc36]);}}});}return _0x387b71;}function parseQueryParameters(_0x9bae23,_0x1f2a25,_0x441dc9){var _0x1cca9b=getSqlClauses();return Promise[_0xab28('0x5a')]()['then'](function(){return parseModelFields(_0x9bae23,_0x1f2a25,_0x441dc9);})[_0xab28('0x5b')](function(_0x534bfc){_0x1cca9b['fields'][_0xab28('0x3f')](_0x534bfc);return parseReadParameter(_0x1f2a25[_0xab28('0x3e')]);})[_0xab28('0x5b')](function(_0x51ba1f){_0x1cca9b['read'][_0xab28('0x3f')](_0x51ba1f);return parseTagParameter(_0x1f2a25[_0xab28('0x5c')]);})[_0xab28('0x5b')](function(_0x701e80){_0x1cca9b[_0xab28('0x49')][_0xab28('0x5d')][_0xab28('0x3f')](_0x701e80);return parseSearchFilter(_0x9bae23,_0x1f2a25[_0xab28('0x5e')]);})[_0xab28('0x5b')](function(_0x2c52e8){_0x1cca9b[_0xab28('0x5e')]=_0x2c52e8;return _0x1cca9b;});}function checkAccountsRestrictions(_0x311261,_0x263fa6,_0x150ee2){var _0x1937cb=utils[_0xab28('0x3')](_0x311261);var _0x74479d=_0xab28('0x5f')+_[_0xab28('0x60')](_0x311261)+(_0x311261===_0xab28('0x61')?_0xab28('0x62'):_0xab28('0x63'));var _0x23b50c=squel[_0xab28('0x20')]();return Promise[_0xab28('0x5a')]()[_0xab28('0x5b')](function(){if(_0x150ee2[_0xab28('0x64')]&&_0x263fa6['role']===_0xab28('0x5')){return _0x263fa6[_0x74479d]({'attributes':['id'],'raw':!![]});}})[_0xab28('0x5b')](function(_0x124e62){if(_0x124e62){if(_0x124e62['length']===0x0){_0x23b50c[_0xab28('0x3f')]('i.'+_0x1937cb+'\x20IS\x20NULL');}else{_0x23b50c[_0xab28('0x3f')]('i.'+_0x1937cb+_0xab28('0x13'),_['map'](_0x124e62,'id'));}}else if(!_0x150ee2[_0x1937cb]){_0x23b50c['and']('i.'+_0x1937cb+_0xab28('0x65'));}})[_0xab28('0x5b')](function(){return _0x23b50c;});}function getClosedOrderClause(_0x59422a,_0x63f569){var _0x58ab41='';var _0x5142fc=[_0xab28('0x66'),_0xab28('0x67'),_0xab28('0x68')];if(_0x59422a==='mail'){_0x5142fc[_0xab28('0x69')](_0xab28('0x6a'));}if(_0x63f569[_0xab28('0x6b')]==='0'&&_0x59422a===_0xab28('0x2c')){_0x58ab41=_0xab28('0x6a');}else{if(_0x63f569[_0xab28('0x6b')]==='1'){_0x5142fc[_0xab28('0x6c')]();}_0x58ab41='CONCAT_WS(\x27\x27,\x20'+_0x5142fc[_0xab28('0x6d')](',\x20')+')';}return _0x58ab41;}function getFilteredInteractions(_0x20cf57,_0x8b9fa3,_0x7c046d,_0x21b1a6){var _0xa7b19a=utils[_0xab28('0xa')](_0x20cf57);var _0x4d19f9=_[_0xab28('0x60')](_0x20cf57)+_0xab28('0x6e');var _0x4e1176=[];var _0x68159a=getTagsQuery();var _0x48ee9b={'type':db[_0xab28('0x6f')]['QueryTypes'][_0xab28('0x70')],'raw':!![]};var _0x283f1c=[];var _0x2a2f69=[];return db['sequelize'][_0xab28('0x71')](_0x68159a[_0xab28('0x72')](),_0x48ee9b)[_0xab28('0x5b')](function(_0x5ea19b){_0x4e1176=_['keyBy'](_0x5ea19b,'id');_0x48ee9b=_['merge'](_0x48ee9b,{'model':db[_0x4d19f9],'mapToModel':!![],'nest':!![]});if(_0x7c046d['fields']){_0x21b1a6['attributes'][_0xab28('0x50')](function(_0x25f342){_0x8b9fa3[_0xab28('0x6')]('i.'+_0x25f342);});}else{_0x8b9fa3[_0xab28('0x6')](_0xab28('0x73'),'unreadMessages');_0x8b9fa3[_0xab28('0x6')](_0xab28('0x74'),_0xab28('0x75'));_0x8b9fa3[_0xab28('0x6')](_0xab28('0x76'),'Account.mandatoryDisposition');if(_0x20cf57===_0xab28('0x2c')){_0x8b9fa3['field'](_0xab28('0x77'),'Account.email');_0x8b9fa3[_0xab28('0x6')](_0xab28('0x78'),_0xab28('0x79'));_0x8b9fa3[_0xab28('0x6')](_0xab28('0x7a'));_0x8b9fa3[_0xab28('0x6')](_0xab28('0x7b'));_0x8b9fa3[_0xab28('0x6')]('i.updatedAt');_0x8b9fa3[_0xab28('0x6')](_0xab28('0x7c'));_0x8b9fa3['field'](_0xab28('0x7d'));_0x8b9fa3[_0xab28('0x6')](_0xab28('0x7e'));_0x8b9fa3[_0xab28('0x6')](_0xab28('0x7f'));_0x8b9fa3[_0xab28('0x6')](_0xab28('0x80'));_0x8b9fa3[_0xab28('0x6')]('i.subject');_0x8b9fa3['field']('i.disposition');_0x8b9fa3[_0xab28('0x6')]('i.secondDisposition');_0x8b9fa3['field'](_0xab28('0x66'));_0x8b9fa3[_0xab28('0x6')](_0xab28('0x6a'));_0x8b9fa3[_0xab28('0x6')](_0xab28('0x81'));_0x8b9fa3[_0xab28('0x6')](_0xab28('0x82'));_0x8b9fa3[_0xab28('0x6')](_0xab28('0x83'));_0x8b9fa3[_0xab28('0x6')](_0xab28('0x84'));}else if(_0x20cf57===_0xab28('0x2a')){_0x8b9fa3[_0xab28('0x6')](_0xab28('0x85'),_0xab28('0x79'));}else{_0x8b9fa3['field'](_0xab28('0x86'),_0xab28('0x79'));}if(_0x20cf57!==_0xab28('0x2c')){_0x8b9fa3[_0xab28('0x6')]('i.*');}_0x8b9fa3['field'](_0xab28('0x87'),_0xab28('0x88'));_0x8b9fa3['field'](_0xab28('0x89'),_0xab28('0x8a'));_0x8b9fa3[_0xab28('0x6')]('c.email','Contact.email');_0x8b9fa3['field'](_0xab28('0x8b'),_0xab28('0x8c'));_0x8b9fa3['field']('c.mobile',_0xab28('0x8d'));_0x8b9fa3[_0xab28('0x6')](_0xab28('0x8e'),_0xab28('0x8f'));_0x8b9fa3[_0xab28('0x6')](_0xab28('0x90'),'Owner.fullname');_0x8b9fa3[_0xab28('0x6')](_0xab28('0x91'),_0xab28('0x92'));_0x8b9fa3[_0xab28('0x6')](_0xab28('0x93'),_0xab28('0x94'));}if(_0x21b1a6[_0xab28('0x95')]){_0x8b9fa3['limit'](_0x21b1a6[_0xab28('0x95')]);}if(_0x21b1a6['offset']){_0x8b9fa3[_0xab28('0x96')](_0x21b1a6['offset']);}return db[_0xab28('0x97')][_0xab28('0x71')](_0x8b9fa3[_0xab28('0x72')](),_0x48ee9b);})[_0xab28('0x5b')](function(_0x50aea7){_0x283f1c=_0x50aea7;var _0x5a78e8=getUsersQuery(_0x20cf57,_0x283f1c);return db['sequelize']['query'](_0x5a78e8[_0xab28('0x72')](),_0x48ee9b);})[_0xab28('0x5b')](function(_0x2455e6){_0x2a2f69=_[_0xab28('0x98')](_0x2455e6,_0xa7b19a);if(_0x20cf57===_0xab28('0x2c')){return db[_0xab28('0x99')]['findOne']({'attributes':[_0xab28('0x9a')],'raw':!![]});}})[_0xab28('0x5b')](function(_0x1d504b){var _0x154167=_0x1d504b?_0x1d504b[_0xab28('0x9a')]:undefined;var _0x219250=_0x283f1c[_0xab28('0x48')](function(_0x3f783a){return updateInteraction(_0x3f783a,_0x4e1176,_0x2a2f69,_0x154167);});return Promise[_0xab28('0x9b')](_0x219250);});}function countFilteredInteractions(_0x310bc5,_0x2a71c3){var _0x100a35=_0x310bc5[_0xab28('0x9c')]();_0x100a35[_0xab28('0x6')](_0xab28('0x9d'));_0x100a35[_0xab28('0x6')](_0xab28('0x73'),'unreadMessages');var _0x2a1088=utils['getSelectedTags'](_0x2a71c3);if(!_[_0xab28('0x9e')](_0x2a1088)){_0x100a35[_0xab28('0x12')](_0xab28('0x9f'),_0x2a1088);}var _0x3fa57e={'type':db['Sequelize'][_0xab28('0xa0')][_0xab28('0x70')],'raw':!![]};return db[_0xab28('0x97')][_0xab28('0x71')](_0x100a35[_0xab28('0x72')](),_0x3fa57e);}module[_0xab28('0xa1')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index 6dac733..ae3dbc2 100644 --- a/server/components/interaction/update-interaction.js +++ b/server/components/interaction/update-interaction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6ab5=['Tags','lodash','map','fullname','forEach','push','waiting','talking','answered','unmanaged','abandoned','disposition','UserId','total','MailMessage','findOne','out','plainBody','-id','then','lastMsgText','trimStart','catch','Users','TagIds'];(function(_0x2223e1,_0x2f5701){var _0x41e671=function(_0x10715f){while(--_0x10715f){_0x2223e1['push'](_0x2223e1['shift']());}};_0x41e671(++_0x2f5701);}(_0x6ab5,0x12d));var _0x56ab=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0x6ab5[_0x397cfb];return _0x15fed9;};'use strict';var _=require(_0x56ab('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x5172fb,_0x38c847){return new Promise(function(_0x3f563f,_0x41de75){try{var _0x119c79=[];if(_0x38c847[_0x5172fb]){_0x119c79=_0x38c847[_0x5172fb][_0x56ab('0x1')](function(_0xd36727){return{'id':_0xd36727['id'],'fullname':_0xd36727[_0x56ab('0x2')]};});}return _0x3f563f(_0x119c79);}catch(_0x29d9bc){_0x41de75(_0x29d9bc);}});}function getInteractionTags(_0x484762,_0xa11589){var _0x4c8443=[];if(_0x484762){_0x484762['split'](',')[_0x56ab('0x3')](function(_0x44ab9e){_0x4c8443[_0x56ab('0x4')](_0xa11589[_0x44ab9e]);});}return _0x4c8443;}function updateWaitingCounter(_0x3626c7){if(_0x3626c7[_0x56ab('0x5')]){_0x3626c7[_0x56ab('0x5')]-=0x1;}}function updateInteractionCounters(_0x2ac49a){_0x2ac49a[_0x56ab('0x5')]=0x0;_0x2ac49a[_0x56ab('0x6')]=0x0;_0x2ac49a[_0x56ab('0x7')]=0x0;_0x2ac49a[_0x56ab('0x8')]=0x0;_0x2ac49a[_0x56ab('0x9')]=0x0;_0x2ac49a['total']=0x0;if(_0x2ac49a['closed']){if(_0x2ac49a[_0x56ab('0xa')]==='abandoned'){_0x2ac49a[_0x56ab('0x9')]+=0x1;updateWaitingCounter(_0x2ac49a);}if(_0x2ac49a[_0x56ab('0xb')]){_0x2ac49a[_0x56ab('0x7')]+=0x1;if(_0x2ac49a[_0x56ab('0x6')]){_0x2ac49a['talking']-=0x1;}}else{if(_0x2ac49a['disposition']){_0x2ac49a['unmanaged']+=0x1;updateWaitingCounter(_0x2ac49a);}}}else{if(!_0x2ac49a[_0x56ab('0xb')]){_0x2ac49a[_0x56ab('0x5')]+=0x1;}if(_0x2ac49a[_0x56ab('0xb')]){_0x2ac49a[_0x56ab('0x6')]+=0x1;updateWaitingCounter(_0x2ac49a);}}_0x2ac49a[_0x56ab('0xc')]+=0x1;return _0x2ac49a;}function getLastMessageText(_0x2046fd){return db[_0x56ab('0xd')][_0x56ab('0xe')]({'where':{'$and':[{'MailInteractionId':_0x2046fd['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x56ab('0xf')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x56ab('0x10')],'order':_0x56ab('0x11'),'raw':!![]})[_0x56ab('0x12')](function(_0x1a615a){if(_0x1a615a&&_0x1a615a[_0x56ab('0x10')]){_0x2046fd[_0x56ab('0x13')]=_[_0x56ab('0x14')](_0x1a615a['plainBody']);}return _0x2046fd;})[_0x56ab('0x15')](function(_0x38dddc){throw _0x38dddc;});}exports['updateInteraction']=function(_0x1cc55f,_0x382498,_0x168962,_0x12c864){return new Promise(function(_0x11e686,_0x5d53f6){return getInteractionUsers(_0x1cc55f['id'],_0x168962)[_0x56ab('0x12')](function(_0x1b2559){_0x1cc55f[_0x56ab('0x16')]=_0x1b2559;return getInteractionTags(_0x1cc55f[_0x56ab('0x17')],_0x382498);})[_0x56ab('0x12')](function(_0x14db09){_0x1cc55f[_0x56ab('0x18')]=_0x14db09;delete _0x1cc55f[_0x56ab('0x17')];return updateInteractionCounters(_0x1cc55f);})[_0x56ab('0x12')](function(_0x40faab){if(_0x12c864){return getLastMessageText(_0x40faab);}else{return _0x40faab;}})[_0x56ab('0x12')](function(_0x57af05){_0x11e686(_0x57af05);})[_0x56ab('0x15')](function(_0x52deee){_0x5d53f6(_0x52deee);});});}; \ No newline at end of file +var _0xd152=['catch','updateInteraction','then','../../mysqldb','map','fullname','split','waiting','talking','answered','unmanaged','abandoned','closed','UserId','disposition','total','MailMessage','findOne','plainBody','-id','lastMsgText'];(function(_0x21369f,_0x290d79){var _0x1ea990=function(_0x561fa6){while(--_0x561fa6){_0x21369f['push'](_0x21369f['shift']());}};_0x1ea990(++_0x290d79);}(_0xd152,0xc0));var _0x2d15=function(_0x3da157,_0x2be24f){_0x3da157=_0x3da157-0x0;var _0x1166d3=_0xd152[_0x3da157];return _0x1166d3;};'use strict';var _=require('lodash');var db=require(_0x2d15('0x0'))['db'];function getInteractionUsers(_0x4075da,_0x48e1d7){return new Promise(function(_0x1c78d9,_0x5326b7){try{var _0x290a6=[];if(_0x48e1d7[_0x4075da]){_0x290a6=_0x48e1d7[_0x4075da][_0x2d15('0x1')](function(_0x7f29a0){return{'id':_0x7f29a0['id'],'fullname':_0x7f29a0[_0x2d15('0x2')]};});}return _0x1c78d9(_0x290a6);}catch(_0x117a2a){_0x5326b7(_0x117a2a);}});}function getInteractionTags(_0xa0f3e8,_0x53a4a7){var _0x31a803=[];if(_0xa0f3e8){_0xa0f3e8[_0x2d15('0x3')](',')['forEach'](function(_0x3571cb){_0x31a803['push'](_0x53a4a7[_0x3571cb]);});}return _0x31a803;}function updateWaitingCounter(_0x358c25){if(_0x358c25['waiting']){_0x358c25[_0x2d15('0x4')]-=0x1;}}function updateInteractionCounters(_0x296504){_0x296504[_0x2d15('0x4')]=0x0;_0x296504[_0x2d15('0x5')]=0x0;_0x296504[_0x2d15('0x6')]=0x0;_0x296504[_0x2d15('0x7')]=0x0;_0x296504[_0x2d15('0x8')]=0x0;_0x296504['total']=0x0;if(_0x296504[_0x2d15('0x9')]){if(_0x296504['disposition']===_0x2d15('0x8')){_0x296504[_0x2d15('0x8')]+=0x1;updateWaitingCounter(_0x296504);}if(_0x296504[_0x2d15('0xa')]){_0x296504[_0x2d15('0x6')]+=0x1;if(_0x296504[_0x2d15('0x5')]){_0x296504['talking']-=0x1;}}else{if(_0x296504[_0x2d15('0xb')]){_0x296504['unmanaged']+=0x1;updateWaitingCounter(_0x296504);}}}else{if(!_0x296504['UserId']){_0x296504[_0x2d15('0x4')]+=0x1;}if(_0x296504[_0x2d15('0xa')]){_0x296504['talking']+=0x1;updateWaitingCounter(_0x296504);}}_0x296504[_0x2d15('0xc')]+=0x1;return _0x296504;}function getLastMessageText(_0x3e66e6){return db[_0x2d15('0xd')][_0x2d15('0xe')]({'where':{'$and':[{'MailInteractionId':_0x3e66e6['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x2d15('0xf')],'order':_0x2d15('0x10'),'raw':!![]})['then'](function(_0x269918){if(_0x269918&&_0x269918[_0x2d15('0xf')]){_0x3e66e6[_0x2d15('0x11')]=_['trimStart'](_0x269918[_0x2d15('0xf')]);}return _0x3e66e6;})[_0x2d15('0x12')](function(_0x48bbdd){throw _0x48bbdd;});}exports[_0x2d15('0x13')]=function(_0x1eab36,_0x1937b8,_0x584fa8,_0x916943){return new Promise(function(_0x3c367f,_0x3e6701){return getInteractionUsers(_0x1eab36['id'],_0x584fa8)[_0x2d15('0x14')](function(_0x50a764){_0x1eab36['Users']=_0x50a764;return getInteractionTags(_0x1eab36['TagIds'],_0x1937b8);})['then'](function(_0x5cbb0f){_0x1eab36['Tags']=_0x5cbb0f;delete _0x1eab36['TagIds'];return updateInteractionCounters(_0x1eab36);})['then'](function(_0x4e503b){if(_0x916943){return getLastMessageText(_0x4e503b);}else{return _0x4e503b;}})[_0x2d15('0x14')](function(_0x20a947){_0x3c367f(_0x20a947);})['catch'](function(_0x2f73da){_0x3e6701(_0x2f73da);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 7c5a26f..ea48103 100644 --- a/server/components/interaction/utils.js +++ b/server/components/interaction/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x555e=['exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','fax-interactions','sms-interactions','Website','Account','capitalize','InteractionId','upperFirst','unknown','websites','accounts','_interactions','_messages','user_has_','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','null','findOne','then','info','catch','error'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0x555e,0x75));var _0xe555=function(_0x22fb54,_0x1ce8a0){_0x22fb54=_0x22fb54-0x0;var _0x492c76=_0x555e[_0x22fb54];return _0x492c76;};'use strict';var _=require(_0xe555('0x0'));var db=require(_0xe555('0x1'))['db'];var loggers={'openchannel':require(_0xe555('0x2'))(_0xe555('0x3')),'mail':require(_0xe555('0x2'))('mail-interactions'),'fax':require(_0xe555('0x2'))(_0xe555('0x4')),'sms':require(_0xe555('0x2'))(_0xe555('0x5')),'chat':require(_0xe555('0x2'))('chat-interactions'),'whatsapp':require(_0xe555('0x2'))('whatsapp-interactions')};function getAccountFK(_0x4cf859){return _['capitalize'](_0x4cf859)+(_0x4cf859==='chat'?_0xe555('0x6'):_0xe555('0x7'))+'Id';}function getInteractionFK(_0xda70df){return _[_0xe555('0x8')](_0xda70df)+_0xe555('0x9');}function getInteractionId(_0x129e24,_0x48cffe,_0x5bb701){if(_0x129e24&&_0x129e24[_[_0xe555('0xa')](_0x5bb701)+_0xe555('0x9')]){return _0x129e24[_[_0xe555('0xa')](_0x5bb701)+_0xe555('0x9')];}else if(_0x129e24&&_0x129e24['id']){return _0x129e24['id'];}else if(_0x48cffe&&_0x48cffe['id']){return _0x48cffe['id'];}else{return _0xe555('0xb');}}function getInteractionsTables(_0x58aa09){return{'accounts':_0x58aa09+'_'+(_0x58aa09==='chat'?_0xe555('0xc'):_0xe555('0xd')),'interactions':_0x58aa09+_0xe555('0xe'),'interactionsTags':_0x58aa09+'_interaction_has_tags','messages':_0x58aa09+_0xe555('0xf'),'userInteractions':_0xe555('0x10')+_0x58aa09+_0xe555('0xe')};}function getSelectedTags(_0x10f2a6){var _0x331b96=[];if(_0x10f2a6){_0x331b96=Array['isArray'](_0x10f2a6)?_0x10f2a6:[_0x10f2a6];}return _0x331b96;}function log(_0x3979c2,_0x33f0f6,_0xdda77b,_0x32557f,_0x6b3d43,_0x2339de){loggers[_0x6b3d43[_0xe555('0x11')]()][_0x3979c2](_0xe555('0x12'),_0x2339de[_0xe555('0x13')](),_0x33f0f6?_0x33f0f6['id']:null,_0x33f0f6?_0x33f0f6[_0xe555('0x14')]:null,_0x33f0f6?_0x33f0f6[_0xe555('0x15')]:null,getInteractionId(_0xdda77b,_0x32557f,_0x6b3d43),_0xdda77b?JSON['stringify'](_0xdda77b):_0xe555('0x16'));}function updateUser(_0xe218a6,_0x4fe1a0,_0x49cd82,_0x3db228,_0x428dc2){db[_[_0xe555('0xa')](_0x3db228)+'Interaction'][_0xe555('0x17')]({'where':{'id':getInteractionId(_0x4fe1a0,_0x49cd82,_0x3db228)}})[_0xe555('0x18')](function(_0xaa6a7e){if(_0xaa6a7e){return _0xaa6a7e['update']({'UserId':_0xe218a6?_0xe218a6['id']:null});}})[_0xe555('0x18')](function(_0x2b447b){if(_0x2b447b){log(_0xe555('0x19'),_0xe218a6,_0x4fe1a0,_0x49cd82,_0x3db228,_0x428dc2);}})[_0xe555('0x1a')](function(){log(_0xe555('0x1b'),_0xe218a6,_0x4fe1a0,_0x49cd82,_0x3db228,_0x428dc2);});}module[_0xe555('0x1c')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0xb20e=['chat-interactions','whatsapp-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst','unknown','accounts','_interactions','_messages','user_has_','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','stringify','null','Interaction','findOne','then','info','catch','exports','lodash','../../mysqldb','openchannel-interactions','fax-interactions','../../config/logger'];(function(_0x46c15b,_0x1677db){var _0x40e2da=function(_0x97c389){while(--_0x97c389){_0x46c15b['push'](_0x46c15b['shift']());}};_0x40e2da(++_0x1677db);}(_0xb20e,0xeb));var _0xeb20=function(_0x16133f,_0x3dd76b){_0x16133f=_0x16133f-0x0;var _0x2252b2=_0xb20e[_0x16133f];return _0x2252b2;};'use strict';var _=require(_0xeb20('0x0'));var db=require(_0xeb20('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0xeb20('0x2')),'mail':require('../../config/logger')('mail-interactions'),'fax':require('../../config/logger')(_0xeb20('0x3')),'sms':require(_0xeb20('0x4'))('sms-interactions'),'chat':require(_0xeb20('0x4'))(_0xeb20('0x5')),'whatsapp':require(_0xeb20('0x4'))(_0xeb20('0x6'))};function getAccountFK(_0x22a7cb){return _[_0xeb20('0x7')](_0x22a7cb)+(_0x22a7cb===_0xeb20('0x8')?_0xeb20('0x9'):_0xeb20('0xa'))+'Id';}function getInteractionFK(_0x4d5483){return _[_0xeb20('0x7')](_0x4d5483)+_0xeb20('0xb');}function getInteractionId(_0x379e6d,_0x2dcbd4,_0x2dea39){if(_0x379e6d&&_0x379e6d[_['upperFirst'](_0x2dea39)+_0xeb20('0xb')]){return _0x379e6d[_[_0xeb20('0xc')](_0x2dea39)+_0xeb20('0xb')];}else if(_0x379e6d&&_0x379e6d['id']){return _0x379e6d['id'];}else if(_0x2dcbd4&&_0x2dcbd4['id']){return _0x2dcbd4['id'];}else{return _0xeb20('0xd');}}function getInteractionsTables(_0x4b364d){return{'accounts':_0x4b364d+'_'+(_0x4b364d===_0xeb20('0x8')?'websites':_0xeb20('0xe')),'interactions':_0x4b364d+_0xeb20('0xf'),'interactionsTags':_0x4b364d+'_interaction_has_tags','messages':_0x4b364d+_0xeb20('0x10'),'userInteractions':_0xeb20('0x11')+_0x4b364d+'_interactions'};}function getSelectedTags(_0x534249){var _0x1db9a8=[];if(_0x534249){_0x1db9a8=Array['isArray'](_0x534249)?_0x534249:[_0x534249];}return _0x1db9a8;}function log(_0x5d9b68,_0x49f50f,_0x4700b2,_0x4fc381,_0x41dfdb,_0x485206){loggers[_0x41dfdb[_0xeb20('0x12')]()][_0x5d9b68](_0xeb20('0x13'),_0x485206[_0xeb20('0x14')](),_0x49f50f?_0x49f50f['id']:null,_0x49f50f?_0x49f50f[_0xeb20('0x15')]:null,_0x49f50f?_0x49f50f['role']:null,getInteractionId(_0x4700b2,_0x4fc381,_0x41dfdb),_0x4700b2?JSON[_0xeb20('0x16')](_0x4700b2):_0xeb20('0x17'));}function updateUser(_0x27642c,_0x50ebfd,_0x7dc897,_0x4e683c,_0x3b5b80){db[_[_0xeb20('0xc')](_0x4e683c)+_0xeb20('0x18')][_0xeb20('0x19')]({'where':{'id':getInteractionId(_0x50ebfd,_0x7dc897,_0x4e683c)}})['then'](function(_0x19d769){if(_0x19d769){return _0x19d769['update']({'UserId':_0x27642c?_0x27642c['id']:null});}})[_0xeb20('0x1a')](function(_0x1fe25b){if(_0x1fe25b){log(_0xeb20('0x1b'),_0x27642c,_0x50ebfd,_0x7dc897,_0x4e683c,_0x3b5b80);}})[_0xeb20('0x1c')](function(){log('error',_0x27642c,_0x50ebfd,_0x7dc897,_0x4e683c,_0x3b5b80);});}module[_0xeb20('0x1d')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index f8c4d26..26efd69 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 _0xf489=['final','hasOwnProperty','use','License','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','aes-256-ctr','format','update','base64','utf8'];(function(_0x4860dd,_0x55a776){var _0x494242=function(_0x37985c){while(--_0x37985c){_0x4860dd['push'](_0x4860dd['shift']());}};_0x494242(++_0x55a776);}(_0xf489,0x144));var _0x9f48=function(_0x401acb,_0x2d2bb8){_0x401acb=_0x401acb-0x0;var _0x3f6ba4=_0xf489[_0x401acb];return _0x3f6ba4;};'use strict';var crypto=require('crypto');var util=require(_0x9f48('0x0'));var compose=require(_0x9f48('0x1'));var db=require(_0x9f48('0x2'))['db'];var config=require(_0x9f48('0x3'));function getValueFromLicense(_0x460a0b,_0x1668d7){if(_0x460a0b&&_0x1668d7){if(_0x1668d7[_0x9f48('0x4')]&&_0x1668d7['license']){var _0x572b18=_0x1668d7[_0x9f48('0x4')];var _0x5514ba=_0x1668d7[_0x9f48('0x5')];var _0x44a347=_0x572b18['split']('-')[0x4];var _0x1d2c0d=_0x572b18[_0x9f48('0x6')]('-')[0x0];var _0x2b37cd=crypto['createDecipher'](_0x9f48('0x7'),util[_0x9f48('0x8')]('%s:%s:%s',_0x44a347,_0x572b18,_0x1d2c0d));var _0xe7c9fc=_0x2b37cd[_0x9f48('0x9')](_0x5514ba,_0x9f48('0xa'),_0x9f48('0xb'));_0xe7c9fc+=_0x2b37cd[_0x9f48('0xc')]('utf8');var _0xbde250=JSON['parse'](_0xe7c9fc);return _0xbde250[_0x9f48('0xd')](_0x460a0b)?_0xbde250[_0x460a0b]:null;}}return null;}function isLimit(_0x561835,_0x635fb,_0xd11a4,_0x3dc969){var _0x301fbb=_0x635fb;return compose()[_0x9f48('0xe')](function(_0x1e7708,_0x5e81fa,_0x269e56){return db[_0x9f48('0xf')][_0x9f48('0x10')]({'where':{'id':0x1},'raw':!![]})[_0x9f48('0x11')](function(_0xf58677){var _0x651ff0=getValueFromLicense(_0x561835,_0xf58677);return _0x651ff0?_0x651ff0:_0x301fbb;})[_0x9f48('0x11')](function(_0x2cb2ea){_0x301fbb=_0x2cb2ea;return _0xd11a4[_0x9f48('0x12')](_0x3dc969);})[_0x9f48('0x11')](function(_0x5b5096){if(_0x5b5096>=_0x301fbb){return _0x5e81fa[_0x9f48('0x13')](0x193)[_0x9f48('0x14')]({'message':util['format'](_0x9f48('0x15'),_0x561835)});}_0x269e56();})[_0x9f48('0x16')](function(_0x407210){_0x269e56(_0x407210);});});}function isUserLimit(){return isLimit(_0x9f48('0x17'),0x1,db[_0x9f48('0x18')],{'where':{'$or':[{'role':_0x9f48('0x19')},{'role':_0x9f48('0x1a')}]}});}exports[_0x9f48('0x1b')]=isUserLimit; \ No newline at end of file +var _0x95b5=['use','License','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','admin','user','isUserLimit','crypto','util','../../mysqldb','../../config/environment','data1','license','createDecipher','aes-256-ctr','format','%s:%s:%s','base64','utf8','final'];(function(_0x32b86,_0x1624fc){var _0x37cda4=function(_0x43042e){while(--_0x43042e){_0x32b86['push'](_0x32b86['shift']());}};_0x37cda4(++_0x1624fc);}(_0x95b5,0x12b));var _0x595b=function(_0xa7470c,_0x486789){_0xa7470c=_0xa7470c-0x0;var _0x2fd345=_0x95b5[_0xa7470c];return _0x2fd345;};'use strict';var crypto=require(_0x595b('0x0'));var util=require(_0x595b('0x1'));var compose=require('composable-middleware');var db=require(_0x595b('0x2'))['db'];var config=require(_0x595b('0x3'));function getValueFromLicense(_0x193454,_0x45ea5b){if(_0x193454&&_0x45ea5b){if(_0x45ea5b[_0x595b('0x4')]&&_0x45ea5b[_0x595b('0x5')]){var _0x25c37e=_0x45ea5b[_0x595b('0x4')];var _0x2b4883=_0x45ea5b[_0x595b('0x5')];var _0x449bf5=_0x25c37e['split']('-')[0x4];var _0x20f589=_0x25c37e['split']('-')[0x0];var _0x18ac35=crypto[_0x595b('0x6')](_0x595b('0x7'),util[_0x595b('0x8')](_0x595b('0x9'),_0x449bf5,_0x25c37e,_0x20f589));var _0x4028c5=_0x18ac35['update'](_0x2b4883,_0x595b('0xa'),_0x595b('0xb'));_0x4028c5+=_0x18ac35[_0x595b('0xc')](_0x595b('0xb'));var _0x310b55=JSON['parse'](_0x4028c5);return _0x310b55['hasOwnProperty'](_0x193454)?_0x310b55[_0x193454]:null;}}return null;}function isLimit(_0xc0a1de,_0xb2b8a1,_0x4750ff,_0x1dd7f2){var _0x44b028=_0xb2b8a1;return compose()[_0x595b('0xd')](function(_0x57a763,_0x1804f9,_0x44d21d){return db[_0x595b('0xe')][_0x595b('0xf')]({'where':{'id':0x1},'raw':!![]})[_0x595b('0x10')](function(_0x4443ab){var _0x5472ce=getValueFromLicense(_0xc0a1de,_0x4443ab);return _0x5472ce?_0x5472ce:_0x44b028;})[_0x595b('0x10')](function(_0x521db9){_0x44b028=_0x521db9;return _0x4750ff[_0x595b('0x11')](_0x1dd7f2);})['then'](function(_0x1cf0ed){if(_0x1cf0ed>=_0x44b028){return _0x1804f9[_0x595b('0x12')](0x193)[_0x595b('0x13')]({'message':util['format'](_0x595b('0x14'),_0xc0a1de)});}_0x44d21d();})[_0x595b('0x15')](function(_0x48d90b){_0x44d21d(_0x48d90b);});});}function isUserLimit(){return isLimit(_0x595b('0x16'),0x1,db['User'],{'where':{'$or':[{'role':_0x595b('0x17')},{'role':_0x595b('0x18')}]}});}exports[_0x595b('0x19')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 150a8de..9bbfd43 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 _0x6730=['$notIn','text','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$startsWith','$endsWith','$lt','>\x20?','<=\x20?','$gte','>=\x20?','$between','BETWEEN\x20?\x20AND\x20?','start','$substring','pop','utcOffset','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','and','replace','split','length','slice','shift','match','filter','map','buildExpression','DATE','$eq','operator','value','includes','$gt','$lte','add','format','castTo','CAST(','\x20AS\x20','field','$ne'];(function(_0x57cd16,_0x4fb6ba){var _0x1ed0d6=function(_0x5dc88c){while(--_0x5dc88c){_0x57cd16['push'](_0x57cd16['shift']());}};_0x1ed0d6(++_0x4fb6ba);}(_0x6730,0xf1));var _0x0673=function(_0x2b6235,_0xadfbcf){_0x2b6235=_0x2b6235-0x0;var _0x4cee7f=_0x6730[_0x2b6235];return _0x4cee7f;};'use strict';var _=require(_0x0673('0x0'));var moment=require(_0x0673('0x1'));exports[_0x0673('0x2')]=function(_0x36f7eb){var _0x2fffaa={'conditions':[]};_0x2fffaa[_0x0673('0x3')]=_[_0x0673('0x4')](_0x36f7eb,'[$or]')?'or':_0x0673('0x5');var _0x3dd6e0=_0x36f7eb[_0x0673('0x6')]('[$and]','')[_0x0673('0x6')]('[$or]','')[_0x0673('0x7')]('||');for(var _0x3a7ad0=0x0;_0x3a7ad0<_0x3dd6e0[_0x0673('0x8')];_0x3a7ad0++){var _0x5892f1=_0x3dd6e0[_0x3a7ad0][_0x0673('0x7')](':=');var _0x437fb1=_0x5892f1[0x0];var _0x136070=_0x5892f1[_0x0673('0x9')](0x1);_0x136070['forEach'](function(_0x282d8b){var _0x213684=_0x282d8b[_0x0673('0x7')]('[')[_0x0673('0xa')]();var _0x124f88=_0x282d8b[_0x0673('0xb')](/\[(.*?)\]/g);_0x124f88['forEach'](function(_0x505297){var _0x292bed=_0x505297[_0x0673('0x7')]('[')[_0x0673('0xc')](function(_0x56220f){return _0x56220f['indexOf'](']')>-0x1;})[_0x0673('0xd')](function(_0x110728){return _0x110728[_0x0673('0x7')](']')[0x0];})[0x0];_0x2fffaa['conditions']['push']({'field':_0x437fb1,'operator':_0x213684,'value':_0x292bed});});});}return _0x2fffaa;};exports[_0x0673('0xe')]=function(_0x5247d4,_0x50fc51,_0x3d4355){var _0x3bb51d={};if(_0x50fc51===_0x0673('0xf')){if(_0x3d4355['operator']===_0x0673('0x10')){_0x3d4355[_0x0673('0x11')]='$between';_0x3d4355[_0x0673('0x12')]+=','+_0x3d4355['value'];}else if(_[_0x0673('0x13')]([_0x0673('0x14'),_0x0673('0x15')],_0x3d4355[_0x0673('0x11')])){_0x3d4355[_0x0673('0x12')]=moment(_0x3d4355[_0x0673('0x12')])[_0x0673('0x16')](0x1,'days')[_0x0673('0x17')]('YYYY-MM-DD');}}if(_0x3d4355[_0x0673('0x18')]){_0x50fc51=_0x3d4355[_0x0673('0x18')];_0x3bb51d['text']=_0x0673('0x19')+_0x5247d4+'.'+_0x3d4355['field']+_0x0673('0x1a')+_0x3d4355['castTo']+')\x20'+parseOperator(_0x3d4355['operator']);}else{_0x3bb51d['text']=_0x5247d4+'.'+_0x3d4355[_0x0673('0x1b')]+'\x20'+parseOperator(_0x3d4355['operator']);}if(_[_0x0673('0x13')]([_0x0673('0x1c'),_0x0673('0x1d')],_0x3d4355[_0x0673('0x11')]))_0x3bb51d[_0x0673('0x1e')]='('+_0x3bb51d['text']+_0x0673('0x1f')+_0x5247d4+'.'+_0x3d4355[_0x0673('0x1b')]+_0x0673('0x20');_0x3bb51d['value']=parseValue(_0x50fc51,_0x3d4355[_0x0673('0x11')],_0x3d4355[_0x0673('0x12')]);return _0x3bb51d;};function parseOperator(_0x5669d9){var _0x474096;switch(_0x5669d9){case _0x0673('0x21'):_0x474096=_0x0673('0x22');break;case _0x0673('0x1d'):_0x474096=_0x0673('0x23');break;case _0x0673('0x10'):_0x474096=_0x0673('0x24');break;case _0x0673('0x1c'):_0x474096=_0x0673('0x25');break;case'$substring':case _0x0673('0x26'):case _0x0673('0x27'):_0x474096='LIKE\x20?';break;case _0x0673('0x28'):_0x474096='<\x20?';break;case _0x0673('0x14'):_0x474096=_0x0673('0x29');break;case _0x0673('0x15'):_0x474096=_0x0673('0x2a');break;case _0x0673('0x2b'):_0x474096=_0x0673('0x2c');break;case _0x0673('0x2d'):_0x474096=_0x0673('0x2e');break;}return _0x474096;}function parseValue(_0x4c38c9,_0x1c1514,_0x350c10){var _0x25cd1b={'start':undefined,'end':undefined};switch(_0x1c1514){case _0x0673('0x21'):case _0x0673('0x1d'):_0x25cd1b[_0x0673('0x2f')]=_0x350c10['split'](',');break;case _0x0673('0x30'):_0x25cd1b[_0x0673('0x2f')]='%'+_0x350c10+'%';break;case'$startsWith':_0x25cd1b[_0x0673('0x2f')]=_0x350c10+'%';break;case'$endsWith':_0x25cd1b[_0x0673('0x2f')]='%'+_0x350c10;break;case'$between':var _0x6c2776=_0x350c10[_0x0673('0x7')](',');var _0x350c10=_0x6c2776[_0x0673('0xa')]();var _0x2f02b1=_0x6c2776[_0x0673('0x31')]();if(_0x4c38c9===_0x0673('0xf')){_0x350c10=moment(_0x350c10)['utcOffset'](0x0,!![])['format']();_0x2f02b1=moment(_0x2f02b1)[_0x0673('0x32')](0x0,!![])['add'](0x17,_0x0673('0x33'))[_0x0673('0x16')](0x3b,_0x0673('0x34'))[_0x0673('0x16')](0x3b,_0x0673('0x35'))[_0x0673('0x17')]();}_0x25cd1b={'start':_0x350c10,'end':_0x2f02b1};break;default:_0x25cd1b[_0x0673('0x2f')]=_0x350c10;break;}return _0x25cd1b;} \ No newline at end of file +var _0x52ee=['lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','[$and]','replace','split','length','forEach','shift','match','filter','map','conditions','push','DATE','$eq','operator','value','includes','$gt','$lte','add','format','castTo','CAST(','field','\x20AS\x20','text','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','<>\x20?','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','$between','BETWEEN\x20?\x20AND\x20?','start','$substring','pop','utcOffset','hours','minutes'];(function(_0x28655c,_0x2e737a){var _0x383242=function(_0x195f00){while(--_0x195f00){_0x28655c['push'](_0x28655c['shift']());}};_0x383242(++_0x2e737a);}(_0x52ee,0x14a));var _0xe52e=function(_0x150cc4,_0x15e9f1){_0x150cc4=_0x150cc4-0x0;var _0x22a995=_0x52ee[_0x150cc4];return _0x22a995;};'use strict';var _=require(_0xe52e('0x0'));var moment=require(_0xe52e('0x1'));exports[_0xe52e('0x2')]=function(_0x3cee82){var _0x203069={'conditions':[]};_0x203069[_0xe52e('0x3')]=_[_0xe52e('0x4')](_0x3cee82,_0xe52e('0x5'))?'or':_0xe52e('0x6');var _0x186a7a=_0x3cee82['replace'](_0xe52e('0x7'),'')[_0xe52e('0x8')](_0xe52e('0x5'),'')[_0xe52e('0x9')]('||');for(var _0x19c644=0x0;_0x19c644<_0x186a7a[_0xe52e('0xa')];_0x19c644++){var _0x10dba1=_0x186a7a[_0x19c644][_0xe52e('0x9')](':=');var _0x105b5a=_0x10dba1[0x0];var _0x46efe4=_0x10dba1['slice'](0x1);_0x46efe4[_0xe52e('0xb')](function(_0x553554){var _0xeb05be=_0x553554['split']('[')[_0xe52e('0xc')]();var _0x109dc5=_0x553554[_0xe52e('0xd')](/\[(.*?)\]/g);_0x109dc5[_0xe52e('0xb')](function(_0xbfcd47){var _0x3e89f0=_0xbfcd47[_0xe52e('0x9')]('[')[_0xe52e('0xe')](function(_0xaba09c){return _0xaba09c['indexOf'](']')>-0x1;})[_0xe52e('0xf')](function(_0x384162){return _0x384162[_0xe52e('0x9')](']')[0x0];})[0x0];_0x203069[_0xe52e('0x10')][_0xe52e('0x11')]({'field':_0x105b5a,'operator':_0xeb05be,'value':_0x3e89f0});});});}return _0x203069;};exports['buildExpression']=function(_0x41798a,_0x293056,_0x2e4939){var _0x5886a2={};if(_0x293056===_0xe52e('0x12')){if(_0x2e4939['operator']===_0xe52e('0x13')){_0x2e4939[_0xe52e('0x14')]='$between';_0x2e4939[_0xe52e('0x15')]+=','+_0x2e4939[_0xe52e('0x15')];}else if(_[_0xe52e('0x16')]([_0xe52e('0x17'),_0xe52e('0x18')],_0x2e4939['operator'])){_0x2e4939[_0xe52e('0x15')]=moment(_0x2e4939[_0xe52e('0x15')])[_0xe52e('0x19')](0x1,'days')[_0xe52e('0x1a')]('YYYY-MM-DD');}}if(_0x2e4939[_0xe52e('0x1b')]){_0x293056=_0x2e4939['castTo'];_0x5886a2['text']=_0xe52e('0x1c')+_0x41798a+'.'+_0x2e4939[_0xe52e('0x1d')]+_0xe52e('0x1e')+_0x2e4939['castTo']+')\x20'+parseOperator(_0x2e4939[_0xe52e('0x14')]);}else{_0x5886a2[_0xe52e('0x1f')]=_0x41798a+'.'+_0x2e4939['field']+'\x20'+parseOperator(_0x2e4939['operator']);}if(_[_0xe52e('0x16')]([_0xe52e('0x20'),_0xe52e('0x21')],_0x2e4939['operator']))_0x5886a2[_0xe52e('0x1f')]='('+_0x5886a2[_0xe52e('0x1f')]+_0xe52e('0x22')+_0x41798a+'.'+_0x2e4939[_0xe52e('0x1d')]+_0xe52e('0x23');_0x5886a2[_0xe52e('0x15')]=parseValue(_0x293056,_0x2e4939[_0xe52e('0x14')],_0x2e4939['value']);return _0x5886a2;};function parseOperator(_0x441905){var _0x1d2644;switch(_0x441905){case _0xe52e('0x24'):_0x1d2644=_0xe52e('0x25');break;case _0xe52e('0x21'):_0x1d2644='NOT\x20IN\x20?';break;case _0xe52e('0x13'):_0x1d2644='=\x20?';break;case'$ne':_0x1d2644=_0xe52e('0x26');break;case'$substring':case'$startsWith':case _0xe52e('0x27'):_0x1d2644=_0xe52e('0x28');break;case _0xe52e('0x29'):_0x1d2644=_0xe52e('0x2a');break;case _0xe52e('0x17'):_0x1d2644=_0xe52e('0x2b');break;case _0xe52e('0x18'):_0x1d2644=_0xe52e('0x2c');break;case _0xe52e('0x2d'):_0x1d2644=_0xe52e('0x2e');break;case _0xe52e('0x2f'):_0x1d2644=_0xe52e('0x30');break;}return _0x1d2644;}function parseValue(_0x39b653,_0x38847b,_0x364e09){var _0x15e4c1={'start':undefined,'end':undefined};switch(_0x38847b){case _0xe52e('0x24'):case _0xe52e('0x21'):_0x15e4c1[_0xe52e('0x31')]=_0x364e09[_0xe52e('0x9')](',');break;case _0xe52e('0x32'):_0x15e4c1[_0xe52e('0x31')]='%'+_0x364e09+'%';break;case'$startsWith':_0x15e4c1[_0xe52e('0x31')]=_0x364e09+'%';break;case _0xe52e('0x27'):_0x15e4c1['start']='%'+_0x364e09;break;case'$between':var _0x446f29=_0x364e09[_0xe52e('0x9')](',');var _0x364e09=_0x446f29[_0xe52e('0xc')]();var _0x1c9064=_0x446f29[_0xe52e('0x33')]();if(_0x39b653===_0xe52e('0x12')){_0x364e09=moment(_0x364e09)[_0xe52e('0x34')](0x0,!![])[_0xe52e('0x1a')]();_0x1c9064=moment(_0x1c9064)['utcOffset'](0x0,!![])[_0xe52e('0x19')](0x17,_0xe52e('0x35'))[_0xe52e('0x19')](0x3b,_0xe52e('0x36'))['add'](0x3b,'seconds')[_0xe52e('0x1a')]();}_0x15e4c1={'start':_0x364e09,'end':_0x1c9064};break;default:_0x15e4c1[_0xe52e('0x31')]=_0x364e09;break;}return _0x15e4c1;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index c28fdd2..68943d6 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 _0x9141=['$gte','format','utc','$lte','subtract','name','isArray','offset','sort','map','indexOf','col','priority','unsigned','substr','DESC','cast','ASC','omit','length','isString','unset','isNumeric','match','^[+]?[0-9]*$','isEmail','\x22{EXPR}\x22','{EXPR}','replace','push','join','getOptions','query','$id','intersection','model','attributes','hasOwnProperty','nolimit','limit','order','pick','filter','columns','value','where','VIRTUAL','lower','merge','options','sequelize','moment','parse','keys','includes','fields','split','filters','isEmpty','type','DATE'];(function(_0x2dfd28,_0x153b3c){var _0x49c016=function(_0x1cfb4d){while(--_0x1cfb4d){_0x2dfd28['push'](_0x2dfd28['shift']());}};_0x49c016(++_0x153b3c);}(_0x9141,0xac));var _0x1914=function(_0x35e0cc,_0xb32943){_0x35e0cc=_0x35e0cc-0x0;var _0x34d515=_0x9141[_0x35e0cc];return _0x34d515;};'use strict';var _=require('lodash');var sequelize=require(_0x1914('0x0'));var moment=require(_0x1914('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x39e692){var _0x3ff951=['ne'];try{var _0x381813=JSON[_0x1914('0x2')](_0x39e692);var _0xc256ba=Object[_0x1914('0x3')](_0x381813)[0x0];return _0x3ff951[_0x1914('0x4')](_0xc256ba);}catch(_0x2975ed){return![];}}function getOperatorValue(_0xbaf4b6){var _0x26a404=JSON[_0x1914('0x2')](_0xbaf4b6);var _0x3ed77f=Object[_0x1914('0x3')](_0x26a404)[0x0];var _0x1d4c1d=_0x26a404[_0x3ed77f];return{['$'+_0x3ed77f]:_0x1d4c1d};}exports[_0x1914('0x5')]=function(_0x26e548){var _0x4aecba=null;if(_0x26e548){_0x4aecba=_0x26e548[_0x1914('0x6')](',');}return _0x4aecba;};exports[_0x1914('0x7')]=function(_0x68e5d5,_0x3aaf29){var _0x4a14e0={};if(!_[_0x1914('0x8')](_0x68e5d5)){_['forOwn'](_0x68e5d5,function(_0x3bad55,_0xe35367){try{if(_0x3aaf29){var _0x88068d=_['find'](_0x3aaf29,{'name':_0xe35367})||{};if(hasSequelizeOperator(_0x3bad55)){_0x4a14e0[_0xe35367]=getOperatorValue(_0x3bad55);}else if(_0x88068d[_0x1914('0x9')]===_0x1914('0xa')&&_['isPlainObject'](_0x3bad55)){var _0x3a9065=JSON[_0x1914('0x2')](_0x3bad55);var _0x25c178={'$gte':moment(moment(_0x3a9065[_0x1914('0xb')])[_0x1914('0xc')]('YYYY-MM-DD'))[_0x1914('0xd')]()[_0x1914('0xc')](),'$lte':moment(moment(_0x3a9065[_0x1914('0xe')])[_0x1914('0xc')]('YYYY-MM-DD'))[_0x1914('0xd')]()[_0x1914('0xf')](0x1,'s')['format']()};_0x4a14e0[_0xe35367]=_0x25c178;}else if(_0x88068d[_0x1914('0x10')]==='uniqueid'){_0x4a14e0[_0xe35367]=_0x3bad55;}else{_0x4a14e0[_0xe35367]=_['isArray'](_0x3bad55)?_0x3bad55:JSON[_0x1914('0x2')](_0x3bad55);}}else{_0x4a14e0[_0xe35367]=_[_0x1914('0x11')](_0x3bad55)?_0x3bad55:JSON[_0x1914('0x2')](_0x3bad55);}}catch(_0xa774e){_0x4a14e0[_0xe35367]=_0x3bad55[_0x1914('0x6')](',');}});}return _0x4a14e0;};exports['limit']=function(_0x9d004f){_0x9d004f=parseInt(_0x9d004f,0xa);if(!_0x9d004f||_0x9d004f<0x0){_0x9d004f=LIMIT_VALUE;}return _0x9d004f;};exports[_0x1914('0x12')]=function(_0x441337){_0x441337=parseInt(_0x441337,0xa);if(!_0x441337||_0x441337<0x0){_0x441337=0x0;}return _0x441337;};exports[_0x1914('0x13')]=function(_0x19b407){var _0x323b9,_0x341336=null;if(_0x19b407){_0x323b9=_0x19b407[_0x1914('0x6')](',');_0x341336=_[_0x1914('0x14')](_0x323b9,function(_0x4e385c){if(_0x4e385c[_0x1914('0x15')]('-')===0x0){return[_0x4e385c==='priority'?sequelize['cast'](sequelize[_0x1914('0x16')](_0x1914('0x17')),_0x1914('0x18')):_0x4e385c[_0x1914('0x19')](0x1),_0x1914('0x1a')];}else{return[_0x4e385c===_0x1914('0x17')?sequelize[_0x1914('0x1b')](sequelize['col'](_0x1914('0x17')),_0x1914('0x18')):_0x4e385c,_0x1914('0x1c')];}});}return _0x341336;};exports[_0x1914('0x1d')]=function(_0x446bb7,_0x207f0a){if(_[_0x1914('0x8')](_0x446bb7)){return _0x446bb7;}if(_[_0x1914('0x11')](_0x446bb7)){for(var _0x585b9f=0x0;_0x585b9f<_0x446bb7[_0x1914('0x1e')];_0x585b9f+=0x1){_0x446bb7[_0x585b9f]=this[_0x1914('0x1d')](_0x446bb7[_0x585b9f],_0x207f0a);}return _0x446bb7;}if(!_['isObject'](_0x446bb7)){return _0x446bb7;}if(_[_0x1914('0x1f')](_0x207f0a)){_0x207f0a=[_0x207f0a];}if(!_['isArray'](_0x207f0a)){return _0x446bb7;}for(var _0x4b07e8=0x0;_0x4b07e8<_0x207f0a[_0x1914('0x1e')];_0x4b07e8+=0x1){_[_0x1914('0x20')](_0x446bb7,_0x207f0a[_0x4b07e8]);}for(var _0x6acb7d in _0x446bb7){if(_0x446bb7['hasOwnProperty'](_0x6acb7d)){_0x446bb7[_0x6acb7d]=this['omit'](_0x446bb7[_0x6acb7d],_0x207f0a);}}return _0x446bb7;};exports[_0x1914('0x21')]=function(_0x446656){return _0x446656[_0x1914('0x22')](RegExp(_0x1914('0x23')))?!![]:![];};exports[_0x1914('0x24')]=function(_0x8994b1){return _0x8994b1[_0x1914('0x22')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x533f88,_0x46c318){var _0x5b4749=[];var _0x49fc8b=/[ `!@#$%^&*()_\-?~]/;var _0x2bdfcd=_0x46c318?_0x1914('0x25'):_0x1914('0x26');_0x533f88[_0x1914('0x6')](/[ ,]+/)['forEach'](function(_0x20368e){_0x20368e=_0x20368e[_0x1914('0x27')](/([^:]")"+/g,'$1');_0x20368e='+'+_0x20368e+'*';var _0x5685c5=_0x20368e[_0x1914('0x22')](_0x49fc8b);if(_0x5685c5){_0x20368e='\x22'+_0x20368e+'\x22';}_0x5b4749[_0x1914('0x28')](_0x20368e);});_0x2bdfcd=_0x2bdfcd['replace'](_0x1914('0x26'),_0x5b4749[_0x1914('0x29')]('\x20'));return _0x2bdfcd;};exports[_0x1914('0x2a')]=function(_0xb16412,_0x5d93c1,_0x4ef941){var _0x2572a7={},_0x5ee0ef={};if(_0x5d93c1[_0x1914('0x2b')][_0x1914('0x2c')]){_0x5d93c1[_0x1914('0x2b')]['id']=_0x5d93c1[_0x1914('0x2b')][_0x1914('0x2c')];delete _0x5d93c1[_0x1914('0x2b')][_0x1914('0x2c')];}_0x2572a7['model']=_[_0x1914('0x14')](_0xb16412,_0x1914('0x10'));_0x2572a7[_0x1914('0x2b')]=_['keys'](_0x5d93c1[_0x1914('0x2b')]);_0x2572a7['filters']=_[_0x1914('0x2d')](_0x2572a7[_0x1914('0x2e')],_0x2572a7[_0x1914('0x2b')]);_0x5ee0ef[_0x1914('0x2f')]=_[_0x1914('0x2d')](_0x2572a7['model'],this[_0x1914('0x5')](_0x5d93c1[_0x1914('0x2b')][_0x1914('0x5')]));_0x5ee0ef[_0x1914('0x2f')]=_0x5ee0ef[_0x1914('0x2f')][_0x1914('0x1e')]?_0x5ee0ef['attributes']:_0x2572a7['model'];if(!_0x5d93c1[_0x1914('0x2b')][_0x1914('0x30')](_0x1914('0x31'))){_0x5ee0ef[_0x1914('0x32')]=this[_0x1914('0x32')](_0x5d93c1[_0x1914('0x2b')][_0x1914('0x32')]);_0x5ee0ef['offset']=this[_0x1914('0x12')](_0x5d93c1['query']['offset']);}_0x5ee0ef[_0x1914('0x33')]=this[_0x1914('0x13')](_0x5d93c1[_0x1914('0x2b')][_0x1914('0x13')]);_0x5ee0ef['where']=this[_0x1914('0x7')](_[_0x1914('0x34')](_0x5d93c1[_0x1914('0x2b')],_0x2572a7[_0x1914('0x7')]),_0xb16412);if(_0x5d93c1['query'][_0x1914('0x35')]){var _0xfe4728=_0xb16412;var _0x531789=_0x5d93c1[_0x1914('0x2b')][_0x1914('0x35')];if(typeof _0x531789==='object'){_0xfe4728=_[_0x1914('0x35')](_0xb16412,function(_0x353543){return _[_0x1914('0x4')](_0x531789[_0x1914('0x36')],_0x353543[_0x1914('0x10')]);});_0x531789=_0x531789[_0x1914('0x37')];}_0x5ee0ef['where']=_['merge'](_0x5ee0ef[_0x1914('0x38')],{'$or':_[_0x1914('0x14')](_0xfe4728,function(_0x3e228a){if(_0x3e228a[_0x1914('0x9')]!==_0x1914('0x39')){if(_0x4ef941){return sequelize[_0x1914('0x38')](sequelize['fn'](_0x1914('0x3a'),sequelize[_0x1914('0x16')](_0x3e228a['name'])),{'$like':sequelize['fn']('lower','%'+_0x5d93c1[_0x1914('0x2b')][_0x1914('0x35')]+'%')});}else{var _0x1c9b3d={};_0x1c9b3d[_0x3e228a[_0x1914('0x10')]]={'$like':'%'+_0x5d93c1[_0x1914('0x2b')][_0x1914('0x35')]+'%'};return _0x1c9b3d;}}})});}_0x5ee0ef=_[_0x1914('0x3b')]({},_0x5ee0ef,_0x5d93c1[_0x1914('0x3c')]);return _0x5ee0ef;}; \ No newline at end of file +var _0x24ca=['format','YYYY-MM-DD','utc','$lte','subtract','isArray','limit','offset','sort','indexOf','priority','cast','col','unsigned','DESC','ASC','omit','length','isObject','isString','unset','isNumeric','match','isEmail','push','getOptions','query','$id','model','map','name','filters','intersection','attributes','fields','hasOwnProperty','order','where','filter','columns','merge','type','VIRTUAL','lower','options','lodash','moment','parse','keys','includes','split','isEmpty','forOwn','find','DATE','isPlainObject','$gte'];(function(_0x147ade,_0xf6137d){var _0x4b26d0=function(_0x37da0d){while(--_0x37da0d){_0x147ade['push'](_0x147ade['shift']());}};_0x4b26d0(++_0xf6137d);}(_0x24ca,0x1bc));var _0xa24c=function(_0x2e9187,_0x3763f6){_0x2e9187=_0x2e9187-0x0;var _0x1fc3a8=_0x24ca[_0x2e9187];return _0x1fc3a8;};'use strict';var _=require(_0xa24c('0x0'));var sequelize=require('sequelize');var moment=require(_0xa24c('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x4ebab4){var _0x4defb1=['ne'];try{var _0x5876d6=JSON[_0xa24c('0x2')](_0x4ebab4);var _0x8a54a0=Object[_0xa24c('0x3')](_0x5876d6)[0x0];return _0x4defb1[_0xa24c('0x4')](_0x8a54a0);}catch(_0xe76a30){return![];}}function getOperatorValue(_0x15a5cd){var _0xf0511=JSON[_0xa24c('0x2')](_0x15a5cd);var _0x2dd348=Object[_0xa24c('0x3')](_0xf0511)[0x0];var _0x9a5013=_0xf0511[_0x2dd348];return{['$'+_0x2dd348]:_0x9a5013};}exports['fields']=function(_0x42d89c){var _0x3a5727=null;if(_0x42d89c){_0x3a5727=_0x42d89c[_0xa24c('0x5')](',');}return _0x3a5727;};exports['filters']=function(_0x399f32,_0x325c6d){var _0x288f76={};if(!_[_0xa24c('0x6')](_0x399f32)){_[_0xa24c('0x7')](_0x399f32,function(_0x43aa5a,_0x1a71a8){try{if(_0x325c6d){var _0xc82af0=_[_0xa24c('0x8')](_0x325c6d,{'name':_0x1a71a8})||{};if(hasSequelizeOperator(_0x43aa5a)){_0x288f76[_0x1a71a8]=getOperatorValue(_0x43aa5a);}else if(_0xc82af0['type']===_0xa24c('0x9')&&_[_0xa24c('0xa')](_0x43aa5a)){var _0xcee4fe=JSON[_0xa24c('0x2')](_0x43aa5a);var _0x5a9486={'$gte':moment(moment(_0xcee4fe[_0xa24c('0xb')])[_0xa24c('0xc')](_0xa24c('0xd')))[_0xa24c('0xe')]()[_0xa24c('0xc')](),'$lte':moment(moment(_0xcee4fe[_0xa24c('0xf')])[_0xa24c('0xc')]('YYYY-MM-DD'))['utc']()[_0xa24c('0x10')](0x1,'s')[_0xa24c('0xc')]()};_0x288f76[_0x1a71a8]=_0x5a9486;}else if(_0xc82af0['name']==='uniqueid'){_0x288f76[_0x1a71a8]=_0x43aa5a;}else{_0x288f76[_0x1a71a8]=_[_0xa24c('0x11')](_0x43aa5a)?_0x43aa5a:JSON[_0xa24c('0x2')](_0x43aa5a);}}else{_0x288f76[_0x1a71a8]=_['isArray'](_0x43aa5a)?_0x43aa5a:JSON[_0xa24c('0x2')](_0x43aa5a);}}catch(_0x5de3e6){_0x288f76[_0x1a71a8]=_0x43aa5a[_0xa24c('0x5')](',');}});}return _0x288f76;};exports[_0xa24c('0x12')]=function(_0x1fcd4b){_0x1fcd4b=parseInt(_0x1fcd4b,0xa);if(!_0x1fcd4b||_0x1fcd4b<0x0){_0x1fcd4b=LIMIT_VALUE;}return _0x1fcd4b;};exports[_0xa24c('0x13')]=function(_0x4ff97c){_0x4ff97c=parseInt(_0x4ff97c,0xa);if(!_0x4ff97c||_0x4ff97c<0x0){_0x4ff97c=0x0;}return _0x4ff97c;};exports[_0xa24c('0x14')]=function(_0x18b7e0){var _0x773f70,_0x4d4bab=null;if(_0x18b7e0){_0x773f70=_0x18b7e0['split'](',');_0x4d4bab=_['map'](_0x773f70,function(_0x4cd77e){if(_0x4cd77e[_0xa24c('0x15')]('-')===0x0){return[_0x4cd77e===_0xa24c('0x16')?sequelize[_0xa24c('0x17')](sequelize[_0xa24c('0x18')]('priority'),_0xa24c('0x19')):_0x4cd77e['substr'](0x1),_0xa24c('0x1a')];}else{return[_0x4cd77e===_0xa24c('0x16')?sequelize['cast'](sequelize[_0xa24c('0x18')](_0xa24c('0x16')),_0xa24c('0x19')):_0x4cd77e,_0xa24c('0x1b')];}});}return _0x4d4bab;};exports[_0xa24c('0x1c')]=function(_0x47e0eb,_0xec9167){if(_['isEmpty'](_0x47e0eb)){return _0x47e0eb;}if(_[_0xa24c('0x11')](_0x47e0eb)){for(var _0x3951ae=0x0;_0x3951ae<_0x47e0eb[_0xa24c('0x1d')];_0x3951ae+=0x1){_0x47e0eb[_0x3951ae]=this['omit'](_0x47e0eb[_0x3951ae],_0xec9167);}return _0x47e0eb;}if(!_[_0xa24c('0x1e')](_0x47e0eb)){return _0x47e0eb;}if(_[_0xa24c('0x1f')](_0xec9167)){_0xec9167=[_0xec9167];}if(!_[_0xa24c('0x11')](_0xec9167)){return _0x47e0eb;}for(var _0x314121=0x0;_0x314121<_0xec9167[_0xa24c('0x1d')];_0x314121+=0x1){_[_0xa24c('0x20')](_0x47e0eb,_0xec9167[_0x314121]);}for(var _0x39609a in _0x47e0eb){if(_0x47e0eb['hasOwnProperty'](_0x39609a)){_0x47e0eb[_0x39609a]=this[_0xa24c('0x1c')](_0x47e0eb[_0x39609a],_0xec9167);}}return _0x47e0eb;};exports[_0xa24c('0x21')]=function(_0x152120){return _0x152120[_0xa24c('0x22')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0xa24c('0x23')]=function(_0xc96ce7){return _0xc96ce7[_0xa24c('0x22')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x15eaaf){var _0x3dcb1b=[];_0x15eaaf[_0xa24c('0x5')](/[ ,]+/)['forEach'](function(_0x245fb2){_0x245fb2=_0x245fb2['replace'](/([^:]")"+/g,'$1');_0x245fb2='+'+_0x245fb2+'*';var _0x1102ab=/[ `!@#$%^&*()_\-?~]/;if(_0x245fb2[_0xa24c('0x22')](_0x1102ab))_0x245fb2='\x22'+_0x245fb2+'\x22';_0x3dcb1b[_0xa24c('0x24')](_0x245fb2);});return _0x3dcb1b['join']('\x20');};exports[_0xa24c('0x25')]=function(_0x53f90,_0x1d0379,_0x52572f){var _0x1c1ed3={},_0x57c340={};if(_0x1d0379[_0xa24c('0x26')][_0xa24c('0x27')]){_0x1d0379['query']['id']=_0x1d0379['query'][_0xa24c('0x27')];delete _0x1d0379[_0xa24c('0x26')][_0xa24c('0x27')];}_0x1c1ed3[_0xa24c('0x28')]=_[_0xa24c('0x29')](_0x53f90,_0xa24c('0x2a'));_0x1c1ed3[_0xa24c('0x26')]=_['keys'](_0x1d0379[_0xa24c('0x26')]);_0x1c1ed3[_0xa24c('0x2b')]=_[_0xa24c('0x2c')](_0x1c1ed3[_0xa24c('0x28')],_0x1c1ed3[_0xa24c('0x26')]);_0x57c340[_0xa24c('0x2d')]=_[_0xa24c('0x2c')](_0x1c1ed3[_0xa24c('0x28')],this[_0xa24c('0x2e')](_0x1d0379[_0xa24c('0x26')]['fields']));_0x57c340[_0xa24c('0x2d')]=_0x57c340[_0xa24c('0x2d')][_0xa24c('0x1d')]?_0x57c340[_0xa24c('0x2d')]:_0x1c1ed3['model'];if(!_0x1d0379['query'][_0xa24c('0x2f')]('nolimit')){_0x57c340[_0xa24c('0x12')]=this[_0xa24c('0x12')](_0x1d0379[_0xa24c('0x26')][_0xa24c('0x12')]);_0x57c340[_0xa24c('0x13')]=this['offset'](_0x1d0379['query'][_0xa24c('0x13')]);}_0x57c340[_0xa24c('0x30')]=this[_0xa24c('0x14')](_0x1d0379[_0xa24c('0x26')][_0xa24c('0x14')]);_0x57c340[_0xa24c('0x31')]=this['filters'](_['pick'](_0x1d0379[_0xa24c('0x26')],_0x1c1ed3[_0xa24c('0x2b')]),_0x53f90);if(_0x1d0379[_0xa24c('0x26')][_0xa24c('0x32')]){var _0x43beff=_0x53f90;var _0x4c5b7e=_0x1d0379[_0xa24c('0x26')][_0xa24c('0x32')];if(typeof _0x4c5b7e==='object'){_0x43beff=_['filter'](_0x53f90,function(_0xba7407){return _[_0xa24c('0x4')](_0x4c5b7e[_0xa24c('0x33')],_0xba7407['name']);});_0x4c5b7e=_0x4c5b7e['value'];}_0x57c340[_0xa24c('0x31')]=_[_0xa24c('0x34')](_0x57c340[_0xa24c('0x31')],{'$or':_[_0xa24c('0x29')](_0x43beff,function(_0x3f640e){if(_0x3f640e[_0xa24c('0x35')]!==_0xa24c('0x36')){if(_0x52572f){return sequelize[_0xa24c('0x31')](sequelize['fn']('lower',sequelize['col'](_0x3f640e[_0xa24c('0x2a')])),{'$like':sequelize['fn'](_0xa24c('0x37'),'%'+_0x1d0379[_0xa24c('0x26')]['filter']+'%')});}else{var _0x472c1e={};_0x472c1e[_0x3f640e[_0xa24c('0x2a')]]={'$like':'%'+_0x1d0379[_0xa24c('0x26')][_0xa24c('0x32')]+'%'};return _0x472c1e;}}})});}_0x57c340=_[_0xa24c('0x34')]({},_0x57c340,_0x1d0379[_0xa24c('0x38')]);return _0x57c340;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 8acaba8..3db1756 100644 --- a/server/components/realtime/agents.js +++ b/server/components/realtime/agents.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9121=['includes','findAll','name','fullname','smsPause','pauseType','find','catch','getSortedAgentsIdsByStatus','split','fields','globalStatus','DESC','getUpdatedSortOptions','internal','substring','indexOf','validateSortParameter','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','address','chatCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','smsStatus','whatsappStatus','chatStatusTime','mailStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','omit','pick','filterAgentAttributes','jayson/promise','../../mysqldb','http','chatPause','faxPause','mailPause','openchannelPause','voicePause','whatsappPause','length','unknown','unavailable','ringing','isNil','idle','voiceStatus','pause','every','chatStatus','faxStatus','openchannelStatus','request','then','result','Agents','error','*pause','busy','getAgentStatus','isArray','startCase','Queue','map','getAgents','all','uniq','value','filter'];(function(_0xf2628e,_0x521bf7){var _0x13863a=function(_0x2b04ab){while(--_0x2b04ab){_0xf2628e['push'](_0xf2628e['shift']());}};_0x13863a(++_0x521bf7);}(_0x9121,0x84));var _0x1912=function(_0x44e07f,_0x2b1e46){_0x44e07f=_0x44e07f-0x0;var _0x4bdf0d=_0x9121[_0x44e07f];return _0x4bdf0d;};'use strict';var _=require('lodash');var jayson=require(_0x1912('0x0'));var db=require(_0x1912('0x1'))['db'];var amiClient=jayson['client'][_0x1912('0x2')]({'port':0x232a});var routingClient=jayson['client'][_0x1912('0x2')]({'port':0x232c});function isAgentPaused(_0x436f11,_0xd8623){var _0x150d25=[_0x436f11[_0x1912('0x3')],_0x436f11[_0x1912('0x4')],_0x436f11[_0x1912('0x5')],_0x436f11[_0x1912('0x6')],_0x436f11['smsPause'],_0x436f11[_0x1912('0x7')],_0x436f11[_0x1912('0x8')]];if(!_0xd8623)return _['every'](_0x150d25);var _0x1b69b3=_['filter'](_0x150d25);return _0x1b69b3[_0x1912('0x9')]>0x0&&_0x1b69b3[_0x1912('0x9')]<_0x150d25['length']?!![]:![];}function isIdle(_0x2847ad){return _0x2847ad==='idle'||_0x2847ad===_0x1912('0xa')||_0x2847ad===_0x1912('0xb')||_0x2847ad===_0x1912('0xc')||_[_0x1912('0xd')](_0x2847ad);}function isAgentIdle(_0x344779){if(_0x344779['voiceStatus']!==_0x1912('0xe')&&_0x344779[_0x1912('0x7')]){_0x344779[_0x1912('0xf')]=_0x1912('0x10');return![];}return _[_0x1912('0x11')]([_0x344779[_0x1912('0x12')],_0x344779[_0x1912('0x13')],_0x344779['mailStatus'],_0x344779[_0x1912('0x14')],_0x344779['smsStatus'],_0x344779['voiceStatus'],_0x344779['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient[_0x1912('0x15')]('Agents',{})[_0x1912('0x16')](function(_0x1cca6c){if(_0x1cca6c['error']){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x53a9a3=_0x1cca6c[_0x1912('0x17')];return routingClient['request'](_0x1912('0x18'),{})[_0x1912('0x16')](function(_0x1e218d){if(_0x1e218d[_0x1912('0x19')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x435fee=_0x1e218d[_0x1912('0x17')];return _['merge']({},_0x53a9a3,_0x435fee);});})['catch'](function(_0x29998c){throw _0x29998c;});}exports['getRealtimeAgents']=getRealtimeAgents;function getAgentStatus(_0xf8e11b){var _0x1a687f=_0x1912('0xa');if(isAgentPaused(_0xf8e11b))_0x1a687f=_0x1912('0x10');else if(isAgentPaused(_0xf8e11b,!![]))_0x1a687f=_0x1912('0x1a');else if(isAgentIdle(_0xf8e11b))_0x1a687f=_0x1912('0xe');else _0x1a687f=_0x1912('0x1b');return _0x1a687f;}exports[_0x1912('0x1c')]=getAgentStatus;function getAgentIdsByQueues(_0x2fa56f,_0x1ac125){var _0x338d5f=_[_0x1912('0x1d')](_0x2fa56f)?_0x2fa56f:[_0x2fa56f];var _0x146361=_[_0x1912('0x1e')](_0x1ac125)+_0x1912('0x1f');var _0x404fcd=_[_0x1912('0x20')](_0x338d5f,function(_0x92fa36){return db[_0x146361]['findOne']({'where':{'id':_0x92fa36}})['then'](function(_0x3ad1d1){if(!_0x3ad1d1)return[];return _0x3ad1d1[_0x1912('0x21')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x1912('0x22')](_0x404fcd)['then'](function(_0x2e034b){var _0x4abcff=_(_0x2e034b)['flatten']()[_0x1912('0x20')]('id')[_0x1912('0x23')]()[_0x1912('0x24')]();return _0x4abcff;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x2233b7,_0x47f4e0,_0x2db670){try{if(_0x47f4e0[_0x1912('0x9')]>0x0){_0x2233b7=_0x2233b7[_0x1912('0x25')](function(_0x116d14){return _0x47f4e0['includes'](_0x116d14['id']);});}var _0x1265bf=_0x2233b7[_0x1912('0x25')](function(_0x19f03d){var _0x154b4a=_0x1912('0x1b');if(isAgentIdle(_0x19f03d)){_0x154b4a=_0x1912('0xe');}return _0x154b4a===_0x2db670;});return _[_0x1912('0x20')](_0x1265bf,'id');}catch(_0x75423f){throw _0x75423f;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x218be3,_0x1189ee,_0x4f3e83){return Promise['resolve']()['then'](function(){if(_0x1189ee[_0x1912('0x9')]>0x0){_0x218be3=_0x218be3[_0x1912('0x25')](function(_0x3b6b7d){return _0x1189ee[_0x1912('0x26')](_0x3b6b7d['id']);});}return _0x218be3;})['then'](function(){return db['User'][_0x1912('0x27')]({'attributes':['id',_0x1912('0x28'),_0x1912('0x29'),'chatPause',_0x1912('0x4'),_0x1912('0x5'),_0x1912('0x6'),_0x1912('0x2a'),_0x1912('0x7'),_0x1912('0x8'),_0x1912('0x2b')],'where':{'id':{'$in':_[_0x1912('0x20')](_0x218be3,'id')}},'raw':!![]});})[_0x1912('0x16')](function(_0x41ec01){return _0x41ec01[_0x1912('0x20')](function(_0x1266f0){var _0xae9b8f=_[_0x1912('0x2c')](_0x218be3,['id',_0x1266f0['id']]);var _0x5f8cb1=filterAgentAttributes(_0xae9b8f);_['merge'](_0x1266f0,_0x5f8cb1);_0x1266f0['globalStatus']=getAgentStatus(_0x1266f0);return _0x1266f0;});})[_0x1912('0x16')](function(_0x46cc17){var _0x3b828b=sortAgentsByStatus(_0x46cc17,_0x4f3e83);return _['map'](_0x3b828b,'id');})[_0x1912('0x2d')](function(_0x47f095){throw _0x47f095;});}exports[_0x1912('0x2e')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x373a7a){var _0x5e23ea={'fields':[],'order':null};var _0x599866=_0x373a7a[_0x1912('0x2f')](',');_0x5e23ea[_0x1912('0x30')]=_[_0x1912('0x25')](_0x599866,function(_0x523746){if(!_0x523746['includes'](_0x1912('0x31'))){return!![];}_0x5e23ea['order']=_['startsWith'](_0x523746,'-')?_0x1912('0x32'):'ASC';return![];});return _0x5e23ea;}exports[_0x1912('0x33')]=getUpdatedSortOptions;function validateSortParameter(_0x24a8e8){if(_0x24a8e8['includes'](_0x1912('0x29'))&&!_0x24a8e8[_0x1912('0x26')](_0x1912('0x34'))){var _0x51d143=_0x24a8e8[_0x1912('0x35')](0x0,_0x24a8e8[_0x1912('0x36')](_0x1912('0x29')));_0x24a8e8+=','+_0x51d143+_0x1912('0x34');}return _0x24a8e8;}exports[_0x1912('0x37')]=validateSortParameter;function sortAgentsByStatus(_0x3ae920,_0x38d0ce){var _0x4c6604=_0x3ae920['sort'](function(_0x38e06e,_0x7e0589){if(_0x38e06e['globalStatus']===_0x7e0589[_0x1912('0x31')]){if(_0x38e06e[_0x1912('0x31')]===_0x1912('0x10')){if(_0x38d0ce===_0x1912('0x32')){return(_0x38e06e[_0x1912('0x2b')]||'')<(_0x7e0589[_0x1912('0x2b')]||'')||_0x38e06e[_0x1912('0x29')][_0x1912('0x38')]()>_0x7e0589[_0x1912('0x29')][_0x1912('0x38')]()?0x1:-0x1;}else{return(_0x38e06e['pauseType']||'')<(_0x7e0589[_0x1912('0x2b')]||'')||_0x38e06e['fullname']['toLowerCase']()>_0x7e0589[_0x1912('0x29')]['toLowerCase']()?-0x1:0x1;}}else{if(_0x38d0ce===_0x1912('0x32')){return _0x38e06e[_0x1912('0x29')]['toLowerCase']()<_0x7e0589[_0x1912('0x29')]['toLowerCase']()?0x1:-0x1;}else{return _0x38e06e[_0x1912('0x29')][_0x1912('0x38')]()<_0x7e0589[_0x1912('0x29')][_0x1912('0x38')]()?-0x1:0x1;}}}else{if(_0x38d0ce===_0x1912('0x32')){return _0x38e06e[_0x1912('0x31')]<_0x7e0589[_0x1912('0x31')]?0x1:-0x1;}else{return _0x38e06e['globalStatus']<_0x7e0589[_0x1912('0x31')]?-0x1:0x1;}}});return _0x4c6604;}exports[_0x1912('0x39')]=sortAgentsByStatus;function filterAgentAttributes(_0x14410d){var _0x334758=[_0x1912('0x3a'),_0x1912('0x3b'),_0x1912('0x3c'),_0x1912('0x3d'),_0x1912('0x2b'),'lastPauseAt',_0x1912('0x34'),_0x1912('0x3e'),_0x1912('0x3'),_0x1912('0x6'),_0x1912('0x5'),_0x1912('0x2a'),_0x1912('0x8'),_0x1912('0x4'),_0x1912('0x7'),_0x1912('0x3f'),'openchannelCapacity','mailCapacity','smsCapacity',_0x1912('0x40'),_0x1912('0x41'),_0x1912('0x42'),'openchannelCurrentCapacity','mailCurrentCapacity',_0x1912('0x43'),_0x1912('0x44'),_0x1912('0x45'),_0x1912('0x12'),_0x1912('0x14'),'mailStatus',_0x1912('0x46'),_0x1912('0x47'),'faxStatus',_0x1912('0xf'),_0x1912('0x48'),'openchannelStatusTime',_0x1912('0x49'),'smsStatusTime',_0x1912('0x4a'),_0x1912('0x4b'),_0x1912('0x4c'),'queue',_0x1912('0x4d'),_0x1912('0x4e'),_0x1912('0x4f'),_0x1912('0x50'),_0x1912('0x51')];var _0x4fda58=['chatPause',_0x1912('0x6'),'mailPause','smsPause',_0x1912('0x8'),_0x1912('0x4'),_0x1912('0x7'),'online'];var _0x4a9aee=_(_0x14410d)[_0x1912('0x52')](_0x4fda58)[_0x1912('0x53')](_0x334758)[_0x1912('0x24')]();return _0x4a9aee;}exports[_0x1912('0x54')]=filterAgentAttributes; \ No newline at end of file +var _0xfbb4=['whatsappStatusTime','voiceStatusTime','queue','destconnectedlinenum','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','pick','lodash','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','mailPause','openchannelPause','voicePause','whatsappPause','every','filter','length','idle','unavailable','ringing','voiceStatus','pause','smsStatus','whatsappStatus','request','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Agents','merge','catch','getRealtimeAgents','unknown','*pause','busy','getAgentStatus','isArray','Queue','map','findOne','getAgents','flatten','value','getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','User','findAll','name','fullname','pauseType','globalStatus','getSortedAgentsIdsByStatus','split','fields','order','startsWith','DESC','ASC','getUpdatedSortOptions','internal','substring','indexOf','validateSortParameter','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','address','smsPause','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatus','openchannelStatus','mailStatus','faxStatus','chatStatusTime','openchannelStatusTime','mailStatusTime'];(function(_0x3c0dcc,_0x18c419){var _0x1a224c=function(_0x238ae7){while(--_0x238ae7){_0x3c0dcc['push'](_0x3c0dcc['shift']());}};_0x1a224c(++_0x18c419);}(_0xfbb4,0xcc));var _0x4fbb=function(_0x141e16,_0x1f5689){_0x141e16=_0x141e16-0x0;var _0x254287=_0xfbb4[_0x141e16];return _0x254287;};'use strict';var _=require(_0x4fbb('0x0'));var jayson=require(_0x4fbb('0x1'));var db=require(_0x4fbb('0x2'))['db'];var amiClient=jayson[_0x4fbb('0x3')][_0x4fbb('0x4')]({'port':0x232a});var routingClient=jayson[_0x4fbb('0x3')][_0x4fbb('0x4')]({'port':0x232c});function isAgentPaused(_0x2752e1,_0x411b3f){var _0x1021f6=[_0x2752e1[_0x4fbb('0x5')],_0x2752e1[_0x4fbb('0x6')],_0x2752e1[_0x4fbb('0x7')],_0x2752e1[_0x4fbb('0x8')],_0x2752e1['smsPause'],_0x2752e1[_0x4fbb('0x9')],_0x2752e1[_0x4fbb('0xa')]];if(!_0x411b3f)return _[_0x4fbb('0xb')](_0x1021f6);var _0x445360=_[_0x4fbb('0xc')](_0x1021f6);return _0x445360[_0x4fbb('0xd')]>0x0&&_0x445360[_0x4fbb('0xd')]<_0x1021f6[_0x4fbb('0xd')]?!![]:![];}function isIdle(_0x369888){return _0x369888===_0x4fbb('0xe')||_0x369888==='unknown'||_0x369888===_0x4fbb('0xf')||_0x369888===_0x4fbb('0x10')||_['isNil'](_0x369888);}function isAgentIdle(_0xea4a44){if(_0xea4a44[_0x4fbb('0x11')]!==_0x4fbb('0xe')&&_0xea4a44[_0x4fbb('0x9')]){_0xea4a44[_0x4fbb('0x11')]=_0x4fbb('0x12');return![];}return _[_0x4fbb('0xb')]([_0xea4a44['chatStatus'],_0xea4a44['faxStatus'],_0xea4a44['mailStatus'],_0xea4a44['openchannelStatus'],_0xea4a44[_0x4fbb('0x13')],_0xea4a44['voiceStatus'],_0xea4a44[_0x4fbb('0x14')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x4fbb('0x15')]('Agents',{})[_0x4fbb('0x16')](function(_0x9001d1){if(_0x9001d1[_0x4fbb('0x17')]){throw new Error(_0x4fbb('0x18'));}var _0xde4621=_0x9001d1[_0x4fbb('0x19')];return routingClient['request'](_0x4fbb('0x1a'),{})[_0x4fbb('0x16')](function(_0xc976f2){if(_0xc976f2[_0x4fbb('0x17')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x1ae968=_0xc976f2[_0x4fbb('0x19')];return _[_0x4fbb('0x1b')]({},_0xde4621,_0x1ae968);});})[_0x4fbb('0x1c')](function(_0x2296eb){throw _0x2296eb;});}exports[_0x4fbb('0x1d')]=getRealtimeAgents;function getAgentStatus(_0x3dda93){var _0x9f3814=_0x4fbb('0x1e');if(isAgentPaused(_0x3dda93))_0x9f3814=_0x4fbb('0x12');else if(isAgentPaused(_0x3dda93,!![]))_0x9f3814=_0x4fbb('0x1f');else if(isAgentIdle(_0x3dda93))_0x9f3814=_0x4fbb('0xe');else _0x9f3814=_0x4fbb('0x20');return _0x9f3814;}exports[_0x4fbb('0x21')]=getAgentStatus;function getAgentIdsByQueues(_0x4277fb,_0xf87847){var _0x12fd2a=_[_0x4fbb('0x22')](_0x4277fb)?_0x4277fb:[_0x4277fb];var _0x51e06e=_['startCase'](_0xf87847)+_0x4fbb('0x23');var _0x44281a=_[_0x4fbb('0x24')](_0x12fd2a,function(_0x5c4d18){return db[_0x51e06e][_0x4fbb('0x25')]({'where':{'id':_0x5c4d18}})[_0x4fbb('0x16')](function(_0xf90e7a){if(!_0xf90e7a)return[];return _0xf90e7a[_0x4fbb('0x26')]({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0x44281a)['then'](function(_0x10cb28){var _0x328546=_(_0x10cb28)[_0x4fbb('0x27')]()[_0x4fbb('0x24')]('id')['uniq']()[_0x4fbb('0x28')]();return _0x328546;});}exports[_0x4fbb('0x29')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x170f35,_0x34d68e,_0x540c3d){try{if(_0x34d68e[_0x4fbb('0xd')]>0x0){_0x170f35=_0x170f35[_0x4fbb('0xc')](function(_0x10335b){return _0x34d68e[_0x4fbb('0x2a')](_0x10335b['id']);});}var _0x2a6dcb=_0x170f35[_0x4fbb('0xc')](function(_0x235785){var _0x5dd325='busy';if(isAgentIdle(_0x235785)){_0x5dd325=_0x4fbb('0xe');}return _0x5dd325===_0x540c3d;});return _[_0x4fbb('0x24')](_0x2a6dcb,'id');}catch(_0x142eda){throw _0x142eda;}}exports[_0x4fbb('0x2b')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x48b835,_0x48e4bf,_0xedece0){return Promise[_0x4fbb('0x2c')]()[_0x4fbb('0x16')](function(){if(_0x48e4bf['length']>0x0){_0x48b835=_0x48b835[_0x4fbb('0xc')](function(_0x3489ff){return _0x48e4bf[_0x4fbb('0x2a')](_0x3489ff['id']);});}return _0x48b835;})[_0x4fbb('0x16')](function(){return db[_0x4fbb('0x2d')][_0x4fbb('0x2e')]({'attributes':['id',_0x4fbb('0x2f'),_0x4fbb('0x30'),_0x4fbb('0x5'),_0x4fbb('0x6'),_0x4fbb('0x7'),'openchannelPause','smsPause','voicePause',_0x4fbb('0xa'),_0x4fbb('0x31')],'where':{'id':{'$in':_['map'](_0x48b835,'id')}},'raw':!![]});})[_0x4fbb('0x16')](function(_0x4e8b72){return _0x4e8b72[_0x4fbb('0x24')](function(_0x1ffd4a){var _0xf442ba=_['find'](_0x48b835,['id',_0x1ffd4a['id']]);var _0x23cd3a=filterAgentAttributes(_0xf442ba);_['merge'](_0x1ffd4a,_0x23cd3a);_0x1ffd4a[_0x4fbb('0x32')]=getAgentStatus(_0x1ffd4a);return _0x1ffd4a;});})[_0x4fbb('0x16')](function(_0x4204bd){var _0x9c6e03=sortAgentsByStatus(_0x4204bd,_0xedece0);return _[_0x4fbb('0x24')](_0x9c6e03,'id');})[_0x4fbb('0x1c')](function(_0x29a1ec){throw _0x29a1ec;});}exports[_0x4fbb('0x33')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x5affec){var _0x129289={'fields':[],'order':null};var _0x3f560a=_0x5affec[_0x4fbb('0x34')](',');_0x129289[_0x4fbb('0x35')]=_[_0x4fbb('0xc')](_0x3f560a,function(_0x40bcca){if(!_0x40bcca['includes'](_0x4fbb('0x32'))){return!![];}_0x129289[_0x4fbb('0x36')]=_[_0x4fbb('0x37')](_0x40bcca,'-')?_0x4fbb('0x38'):_0x4fbb('0x39');return![];});return _0x129289;}exports[_0x4fbb('0x3a')]=getUpdatedSortOptions;function validateSortParameter(_0xda0afa){if(_0xda0afa['includes']('fullname')&&!_0xda0afa['includes'](_0x4fbb('0x3b'))){var _0x2d463e=_0xda0afa[_0x4fbb('0x3c')](0x0,_0xda0afa[_0x4fbb('0x3d')](_0x4fbb('0x30')));_0xda0afa+=','+_0x2d463e+'internal';}return _0xda0afa;}exports[_0x4fbb('0x3e')]=validateSortParameter;function sortAgentsByStatus(_0x1dd666,_0x4a5cda){var _0x4720ab=_0x1dd666['sort'](function(_0x527e18,_0x504966){if(_0x527e18['globalStatus']===_0x504966[_0x4fbb('0x32')]){if(_0x527e18['globalStatus']===_0x4fbb('0x12')){if(_0x4a5cda===_0x4fbb('0x38')){return(_0x527e18['pauseType']||'')<(_0x504966[_0x4fbb('0x31')]||'')||_0x527e18[_0x4fbb('0x30')][_0x4fbb('0x3f')]()>_0x504966[_0x4fbb('0x30')][_0x4fbb('0x3f')]()?0x1:-0x1;}else{return(_0x527e18[_0x4fbb('0x31')]||'')<(_0x504966[_0x4fbb('0x31')]||'')||_0x527e18[_0x4fbb('0x30')][_0x4fbb('0x3f')]()>_0x504966[_0x4fbb('0x30')]['toLowerCase']()?-0x1:0x1;}}else{if(_0x4a5cda===_0x4fbb('0x38')){return _0x527e18['fullname'][_0x4fbb('0x3f')]()<_0x504966[_0x4fbb('0x30')][_0x4fbb('0x3f')]()?0x1:-0x1;}else{return _0x527e18[_0x4fbb('0x30')]['toLowerCase']()<_0x504966[_0x4fbb('0x30')][_0x4fbb('0x3f')]()?-0x1:0x1;}}}else{if(_0x4a5cda==='DESC'){return _0x527e18[_0x4fbb('0x32')]<_0x504966[_0x4fbb('0x32')]?0x1:-0x1;}else{return _0x527e18[_0x4fbb('0x32')]<_0x504966[_0x4fbb('0x32')]?-0x1:0x1;}}});return _0x4720ab;}exports[_0x4fbb('0x40')]=sortAgentsByStatus;function filterAgentAttributes(_0x23904e){var _0x467989=[_0x4fbb('0x41'),_0x4fbb('0x42'),_0x4fbb('0x43'),_0x4fbb('0x44'),_0x4fbb('0x31'),_0x4fbb('0x44'),_0x4fbb('0x3b'),_0x4fbb('0x45'),_0x4fbb('0x5'),_0x4fbb('0x8'),'mailPause',_0x4fbb('0x46'),_0x4fbb('0xa'),_0x4fbb('0x6'),_0x4fbb('0x9'),_0x4fbb('0x47'),_0x4fbb('0x48'),_0x4fbb('0x49'),_0x4fbb('0x4a'),_0x4fbb('0x4b'),_0x4fbb('0x4c'),_0x4fbb('0x4d'),_0x4fbb('0x4e'),_0x4fbb('0x4f'),_0x4fbb('0x50'),_0x4fbb('0x51'),_0x4fbb('0x52'),_0x4fbb('0x53'),_0x4fbb('0x54'),_0x4fbb('0x55'),_0x4fbb('0x13'),_0x4fbb('0x14'),_0x4fbb('0x56'),'voiceStatus',_0x4fbb('0x57'),_0x4fbb('0x58'),_0x4fbb('0x59'),'smsStatusTime',_0x4fbb('0x5a'),'faxStatusTime',_0x4fbb('0x5b'),_0x4fbb('0x5c'),_0x4fbb('0x5d'),'screenrecording',_0x4fbb('0x5e'),_0x4fbb('0x5f'),_0x4fbb('0x60')];var _0x11c1ed=['chatPause',_0x4fbb('0x8'),'mailPause',_0x4fbb('0x46'),_0x4fbb('0xa'),_0x4fbb('0x6'),_0x4fbb('0x9'),_0x4fbb('0x42')];var _0x5afb88=_(_0x23904e)['omit'](_0x11c1ed)[_0x4fbb('0x61')](_0x467989)[_0x4fbb('0x28')]();return _0x5afb88;}exports['filterAgentAttributes']=filterAgentAttributes; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 00487ac..09404ca 100644 --- a/server/components/realtime/queues.js +++ b/server/components/realtime/queues.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x28cb=['dialActive','dialMethod','Trunk','startProgressive','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','Queues','format','result','catch','inbound','concat','map','get','loggedIn','outbound','find','pick','initializeQueues','lodash','util','client','http','paused','waiting','busy','inUse','invalid','loggedInDb','notInUse','onHold','ringing','talking','unavailable','unknown','pTalking','originated','message','statusMessage'];(function(_0x41582d,_0x291b1c){var _0x59c504=function(_0x4d967e){while(--_0x4d967e){_0x41582d['push'](_0x41582d['shift']());}};_0x59c504(++_0x291b1c);}(_0x28cb,0x8b));var _0xb28c=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x28cb[_0x21549c];return _0x426cbd;};'use strict';var _=require(_0xb28c('0x0'));var jayson=require('jayson/promise');var util=require(_0xb28c('0x1'));var amiClient=jayson[_0xb28c('0x2')][_0xb28c('0x3')]({'port':0x232a});var routingClient=jayson[_0xb28c('0x2')][_0xb28c('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available','loggedIn',_0xb28c('0x4'),_0xb28c('0x5')];var VOICE_QUEUE_ATTRIBUTES=[_0xb28c('0x6'),_0xb28c('0x7'),_0xb28c('0x8'),_0xb28c('0x9'),_0xb28c('0xa'),_0xb28c('0xb'),_0xb28c('0xc'),'ringInUse',_0xb28c('0xd'),_0xb28c('0xe'),_0xb28c('0xf')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xb28c('0x10'),_0xb28c('0x11'),_0xb28c('0x12'),_0xb28c('0x13'),_0xb28c('0x14'),_0xb28c('0x15'),_0xb28c('0x16'),'startPredictive',_0xb28c('0x17'),_0xb28c('0x18'),'erlangCallToSecond',_0xb28c('0x19'),_0xb28c('0x1a'),_0xb28c('0x1b'),_0xb28c('0x1c'),_0xb28c('0x1d'),_0xb28c('0x1e'),_0xb28c('0x1f'),_0xb28c('0x20'),_0xb28c('0x21'),_0xb28c('0x22'),_0xb28c('0x23'),_0xb28c('0x24')];function getRealtimeQueues(_0x17a866,_0xe00a27){var _0x2d29e0=_0xe00a27===_0xb28c('0x25')?amiClient:routingClient;return _0x2d29e0[_0xb28c('0x26')](_[_0xb28c('0x27')](_0xe00a27)+_0xb28c('0x28'),_0x17a866)['then'](function(_0xb9a124){if(_0xb9a124['error'])throw new Error(util[_0xb28c('0x29')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0xe00a27));return _0xb9a124[_0xb28c('0x2a')];})[_0xb28c('0x2b')](function(_0x526617){throw _0x526617;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x555fdb,_0x392162,_0x14212c,_0x474f63){var _0x5c8332=DEFAULT_QUEUE_ATTRIBUTES;if(_0x14212c==='voice'){if(_0x474f63===_0xb28c('0x2c')){_0x5c8332=_0x5c8332[_0xb28c('0x2d')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x474f63==='outbound'){_0x5c8332=_0x5c8332[_0xb28c('0x2d')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x555fdb[_0xb28c('0x2e')](function(_0x40e73a){var _0x461e97=_0x40e73a[_0xb28c('0x2f')]({'plain':!![]});_0x461e97[_0xb28c('0x4')]=0x0;_0x461e97['loggedInDb']=0x0;_0x461e97[_0xb28c('0x30')]=0x0;_0x461e97['available']=0x0;_0x461e97[_0xb28c('0x5')]=0x0;if(_0x14212c==='voice'){_0x461e97[_0xb28c('0xd')]=0x0;_0x461e97['busy']=0x0;if(_0x474f63===_0xb28c('0x31')){_0x461e97[_0xb28c('0x10')]=0x0;_0x461e97['originated']=0x0;}}var _0x13d49f=_[_0xb28c('0x32')](_0x392162,['id',_0x461e97['id']]);if(_0x13d49f){_['merge'](_0x461e97,_[_0xb28c('0x33')](_0x13d49f,_0x5c8332));}return _0x461e97;});}exports[_0xb28c('0x34')]=initializeQueues; \ No newline at end of file +var _0xc63d=['ringing','ringInUse','unavailable','unknown','pTalking','originated','message','statusMessage','dialMethod','Trunk','startPredictive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','Queues','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','inbound','concat','outbound','get','waiting','talking','find','initializeQueues','lodash','jayson/promise','util','client','http','available','loggedIn','paused','inUse','invalid','loggedInDb','notInUse','onHold'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xc63d,0x18b));var _0xdc63=function(_0x1b89db,_0x305aa1){_0x1b89db=_0x1b89db-0x0;var _0x22649e=_0xc63d[_0x1b89db];return _0x22649e;};'use strict';var _=require(_0xdc63('0x0'));var jayson=require(_0xdc63('0x1'));var util=require(_0xdc63('0x2'));var amiClient=jayson[_0xdc63('0x3')][_0xdc63('0x4')]({'port':0x232a});var routingClient=jayson['client'][_0xdc63('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xdc63('0x5'),_0xdc63('0x6'),_0xdc63('0x7'),'waiting'];var VOICE_QUEUE_ATTRIBUTES=['busy',_0xdc63('0x8'),_0xdc63('0x9'),_0xdc63('0xa'),_0xdc63('0xb'),_0xdc63('0xc'),_0xdc63('0xd'),_0xdc63('0xe'),'talking',_0xdc63('0xf'),_0xdc63('0x10')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xdc63('0x11'),_0xdc63('0x12'),_0xdc63('0x13'),_0xdc63('0x14'),'dialActive',_0xdc63('0x15'),_0xdc63('0x16'),_0xdc63('0x17'),'startProgressive',_0xdc63('0x18'),_0xdc63('0x19'),_0xdc63('0x1a'),_0xdc63('0x1b'),_0xdc63('0x1c'),_0xdc63('0x1d'),_0xdc63('0x1e'),_0xdc63('0x1f'),_0xdc63('0x20'),_0xdc63('0x21'),_0xdc63('0x22'),_0xdc63('0x23'),_0xdc63('0x24'),_0xdc63('0x25')];function getRealtimeQueues(_0x461938,_0x27def8){var _0xbfdb2f=_0x27def8===_0xdc63('0x26')?amiClient:routingClient;return _0xbfdb2f['request'](_['startCase'](_0x27def8)+_0xdc63('0x27'),_0x461938)['then'](function(_0x2a5810){if(_0x2a5810['error'])throw new Error(util['format'](_0xdc63('0x28'),_0x27def8));return _0x2a5810[_0xdc63('0x29')];})[_0xdc63('0x2a')](function(_0x2f05b3){throw _0x2f05b3;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x93697e,_0x338575,_0x1996e3,_0x380b8c){var _0x1395ca=DEFAULT_QUEUE_ATTRIBUTES;if(_0x1996e3===_0xdc63('0x26')){if(_0x380b8c===_0xdc63('0x2b')){_0x1395ca=_0x1395ca[_0xdc63('0x2c')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x380b8c===_0xdc63('0x2d')){_0x1395ca=_0x1395ca[_0xdc63('0x2c')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x93697e['map'](function(_0x2f5b87){var _0x150c24=_0x2f5b87[_0xdc63('0x2e')]({'plain':!![]});_0x150c24[_0xdc63('0x7')]=0x0;_0x150c24[_0xdc63('0xa')]=0x0;_0x150c24[_0xdc63('0x6')]=0x0;_0x150c24['available']=0x0;_0x150c24[_0xdc63('0x2f')]=0x0;if(_0x1996e3===_0xdc63('0x26')){_0x150c24[_0xdc63('0x30')]=0x0;_0x150c24['busy']=0x0;if(_0x380b8c===_0xdc63('0x2d')){_0x150c24['pTalking']=0x0;_0x150c24[_0xdc63('0x12')]=0x0;}}var _0x5812d1=_[_0xdc63('0x31')](_0x338575,['id',_0x150c24['id']]);if(_0x5812d1){_['merge'](_0x150c24,_['pick'](_0x5812d1,_0x1395ca));}return _0x150c24;});}exports[_0xdc63('0x32')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 0b2cd45..ae84d67 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x3cb465,_0x36d920){var _0x4e197b=function(_0x25fd7d){while(--_0x25fd7d){_0x3cb465['push'](_0x3cb465['shift']());}};_0x4e197b(++_0x36d920);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x2a5864,_0x2b9396){var _0x490ab6=function(_0x3bcd16){while(--_0x3bcd16){_0x2a5864['push'](_0x2a5864['shift']());}};_0x490ab6(++_0x2b9396);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index ccf640b..0310d1e 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 _0xebaa=['replace','hostname','macAddress','ipAddress','substring','lodash','crypto','child_process','execSync','../environment','networkInterfaces','orderBy','keys','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','127.0.0.1','getFirstInterface','cpus','map','model','join','createHash','md5','update','digest','hex','platform','test','licenseToken','win32','dmidecode\x20--string\x20system-uuid'];(function(_0x330ebf,_0x57f43b){var _0x2cf943=function(_0x456a97){while(--_0x456a97){_0x330ebf['push'](_0x330ebf['shift']());}};_0x2cf943(++_0x57f43b);}(_0xebaa,0x1d9));var _0xaeba=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xebaa[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0xaeba('0x0'));var os=require('os');var crypto=require(_0xaeba('0x1'));var machine=require('bimedia-machine-uuid');var exec=require(_0xaeba('0x2'))[_0xaeba('0x3')];var config=require(_0xaeba('0x4'));function getInterfaces(){var _0x485ca5=[];var _0x2f60b6=os[_0xaeba('0x5')]();var _0x1bd975=_[_0xaeba('0x6')](_[_0xaeba('0x7')](_0x2f60b6));for(var _0x38c887=0x0;_0x38c887<_0x1bd975['length'];_0x38c887++){var _0x37f65e=_0x2f60b6[_0x1bd975[_0x38c887]]['filter'](function(_0x1f5a73){return _0x1f5a73[_0xaeba('0x8')]===_0xaeba('0x9')&&_0x1f5a73[_0xaeba('0xa')]===![];});_0x485ca5=_0x485ca5[_0xaeba('0xb')](_0x37f65e);}return _0x485ca5;}function getFirstInterface(){var _0x2952e3=_[_0xaeba('0xc')](getInterfaces());return{'macAddress':_0x2952e3&&_0x2952e3['mac']?_0x2952e3[_0xaeba('0xd')]:_0xaeba('0xe'),'ipAddress':_0x2952e3&&_0x2952e3['address']?_0x2952e3['address']:_0xaeba('0xf')};}exports[_0xaeba('0x10')]=getFirstInterface;function getCPUhash(){var _0x29b12c=_['orderBy'](os[_0xaeba('0x11')]()[_0xaeba('0x12')](function(_0x457da4){return _0x457da4[_0xaeba('0x13')];}))[_0xaeba('0x14')](':');return crypto[_0xaeba('0x15')](_0xaeba('0x16'))[_0xaeba('0x17')](_0x29b12c)[_0xaeba('0x18')](_0xaeba('0x19'));}exports['getUuid']=function(){var _0x4cf4a1=os[_0xaeba('0x1a')]();var _0x437dad=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x437dad[_0xaeba('0x1b')](config[_0xaeba('0x1c')])){return config[_0xaeba('0x1c')];}else if(_0x4cf4a1===_0xaeba('0x1d')){return exec(_0xaeba('0x1e'),{'encoding':'utf8'})[_0xaeba('0x1f')]('\x0d\x0a','');}else{var _0x459dd2=getFirstInterface();var _0x2e9899=getCPUhash();var _0x505e34=_0x2e9899+'|'+os[_0xaeba('0x20')]()+'|'+_0x459dd2[_0xaeba('0x21')]+'|'+_0x459dd2[_0xaeba('0x22')];var _0x21e5ce=crypto[_0xaeba('0x15')](_0xaeba('0x16'))['update'](_0x505e34)[_0xaeba('0x18')](_0xaeba('0x19'));return _0x21e5ce[_0xaeba('0x23')](0x0,0x8)+'-'+_0x21e5ce[_0xaeba('0x23')](0x8,0xc)+'-'+_0x21e5ce[_0xaeba('0x23')](0xc,0x10)+'-'+_0x21e5ce[_0xaeba('0x23')](0x10,0x14)+'-'+_0x21e5ce[_0xaeba('0x23')](0x14);}}; \ No newline at end of file +var _0x9b82=['getFirstInterface','orderBy','cpus','map','model','createHash','md5','update','digest','getUuid','platform','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','hex','substring','lodash','crypto','bimedia-machine-uuid','execSync','../environment','networkInterfaces','keys','length','filter','family','internal','mac','address','127.0.0.1'];(function(_0xf363f0,_0x3b5eeb){var _0x55a386=function(_0x548349){while(--_0x548349){_0xf363f0['push'](_0xf363f0['shift']());}};_0x55a386(++_0x3b5eeb);}(_0x9b82,0x150));var _0x29b8=function(_0x2232c6,_0x4030bf){_0x2232c6=_0x2232c6-0x0;var _0x4334f1=_0x9b82[_0x2232c6];return _0x4334f1;};'use strict';var _=require(_0x29b8('0x0'));var os=require('os');var crypto=require(_0x29b8('0x1'));var machine=require(_0x29b8('0x2'));var exec=require('child_process')[_0x29b8('0x3')];var config=require(_0x29b8('0x4'));function getInterfaces(){var _0xf3c718=[];var _0x13a3ba=os[_0x29b8('0x5')]();var _0x496974=_['orderBy'](_[_0x29b8('0x6')](_0x13a3ba));for(var _0xcaa2cf=0x0;_0xcaa2cf<_0x496974[_0x29b8('0x7')];_0xcaa2cf++){var _0x1f4d00=_0x13a3ba[_0x496974[_0xcaa2cf]][_0x29b8('0x8')](function(_0x133f89){return _0x133f89[_0x29b8('0x9')]==='IPv4'&&_0x133f89[_0x29b8('0xa')]===![];});_0xf3c718=_0xf3c718['concat'](_0x1f4d00);}return _0xf3c718;}function getFirstInterface(){var _0xa7529a=_['head'](getInterfaces());return{'macAddress':_0xa7529a&&_0xa7529a['mac']?_0xa7529a[_0x29b8('0xb')]:'00:00:00:00:00:00','ipAddress':_0xa7529a&&_0xa7529a[_0x29b8('0xc')]?_0xa7529a[_0x29b8('0xc')]:_0x29b8('0xd')};}exports[_0x29b8('0xe')]=getFirstInterface;function getCPUhash(){var _0x32a1b4=_[_0x29b8('0xf')](os[_0x29b8('0x10')]()[_0x29b8('0x11')](function(_0x522d69){return _0x522d69[_0x29b8('0x12')];}))['join'](':');return crypto[_0x29b8('0x13')](_0x29b8('0x14'))[_0x29b8('0x15')](_0x32a1b4)[_0x29b8('0x16')]('hex');}exports[_0x29b8('0x17')]=function(){var _0x58a87a=os[_0x29b8('0x18')]();var _0x5bded1=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x5bded1[_0x29b8('0x19')](config['licenseToken'])){return config['licenseToken'];}else if(_0x58a87a===_0x29b8('0x1a')){return exec(_0x29b8('0x1b'),{'encoding':_0x29b8('0x1c')})[_0x29b8('0x1d')]('\x0d\x0a','');}else{var _0x50b99c=getFirstInterface();var _0x44b32d=getCPUhash();var _0x4e2323=_0x44b32d+'|'+os[_0x29b8('0x1e')]()+'|'+_0x50b99c[_0x29b8('0x1f')]+'|'+_0x50b99c[_0x29b8('0x20')];var _0x4da5cf=crypto[_0x29b8('0x13')](_0x29b8('0x14'))[_0x29b8('0x15')](_0x4e2323)[_0x29b8('0x16')](_0x29b8('0x21'));return _0x4da5cf[_0x29b8('0x22')](0x0,0x8)+'-'+_0x4da5cf[_0x29b8('0x22')](0x8,0xc)+'-'+_0x4da5cf[_0x29b8('0x22')](0xc,0x10)+'-'+_0x4da5cf[_0x29b8('0x22')](0x10,0x14)+'-'+_0x4da5cf['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 4963752..8b421f3 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 _0x75a5=['info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','Changed','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','DEMO\x20START\x20AT\x20%s','update','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','message','default','util','moment','request-promise','bluebird','pkginfo','version','./hardware','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','catch','data1','data2','then','active'];(function(_0x186264,_0x483c0b){var _0x31ff70=function(_0x216069){while(--_0x216069){_0x186264['push'](_0x186264['shift']());}};_0x31ff70(++_0x483c0b);}(_0x75a5,0x1c1));var _0x575a=function(_0x218e7d,_0x34bd99){_0x218e7d=_0x218e7d-0x0;var _0x5239b9=_0x75a5[_0x218e7d];return _0x5239b9;};'use strict';var util=require(_0x575a('0x0'));var moment=require(_0x575a('0x1'));var rp=require(_0x575a('0x2'));var BPromise=require(_0x575a('0x3'));var pkginfo=require(_0x575a('0x4'))(module,_0x575a('0x5'));var db=require('../../mysqldb')['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0x575a('0x6'));var logger=require('../logger')(_0x575a('0x7'));var HOST=_0x575a('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x69845e){return new BPromise(function(_0x252667,_0x572c90){var _0x3a6e34=util[_0x575a('0x9')](_0x575a('0xa'),HOST,_0x69845e,module[_0x575a('0xb')][_0x575a('0x5')]);if(oldToken){_0x3a6e34=util[_0x575a('0x9')](_0x575a('0xc'),HOST,_0x69845e,module[_0x575a('0xb')][_0x575a('0x5')],oldToken);}var _0x10e248={'uri':_0x3a6e34,'method':_0x575a('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x10e248)['then'](function(_0x12be34){_0x252667(_0x12be34);})[_0x575a('0xe')](function(_0x47fb27){_0x572c90(_0x47fb27);});});}function manageLicense(_0x10448e,_0xda9354){var _0x253963=_0xda9354['get']({'plain':!![]});if(!isOldTokenSent&&_0x253963[_0x575a('0xf')]!==_0x10448e&&!_0x253963[_0x575a('0x10')]){oldToken=_0x253963[_0x575a('0xf')];}httpRequest(_0x10448e)[_0x575a('0x11')](function(_0x4164b0){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x4164b0[_0x575a('0x12')]){isOldTokenSent=![];if(!_0x253963[_0x575a('0x7')]&&_0x253963[_0x575a('0x7')]!=_0x4164b0[_0x575a('0x7')]||_0x253963[_0x575a('0x7')]&&_0x253963[_0x575a('0x10')]){logger[_0x575a('0x13')](_0x575a('0x14'));}if(_0x253963[_0x575a('0x7')]&&!_0x253963[_0x575a('0x10')]&&_0x253963[_0x575a('0x7')]!=_0x4164b0[_0x575a('0x7')]){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x253963['license']&&!_0x253963[_0x575a('0x10')]&&_0x253963[_0x575a('0x7')]==_0x4164b0[_0x575a('0x7')]){return _0xda9354;}return _0xda9354['update']({'data1':_0x10448e,'data2':null,'license':_0x4164b0['license']});}else{if(_0x4164b0[_0x575a('0x7')]||_0x253963[_0x575a('0x7')]){if(!_0x253963[_0x575a('0x10')]){if(_0x253963['data1']==_0x10448e){GRAY_PERIOD_REASON='Disabled';logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x575a('0x15');logger[_0x575a('0x13')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x253963[_0x575a('0xf')],_0x10448e);}logger[_0x575a('0x13')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x575a('0x16')](),moment()[_0x575a('0x9')](_0x575a('0x17')));return _0xda9354['update']({'data2':encryptor[_0x575a('0x18')](moment()['format'](_0x575a('0x17')))});}else{if(moment()[_0x575a('0x19')](encryptor[_0x575a('0x1a')](_0x253963[_0x575a('0x10')]),'days')>DAYS){logger[_0x575a('0x13')](_0x575a('0x1b'),moment()[_0x575a('0x9')](_0x575a('0x17')));isOldTokenSent=![];return _0xda9354[_0x575a('0x1c')]({'data1':_0x10448e,'data2':null,'license':null});}}}else{if(_0x253963[_0x575a('0xf')]!=_0x10448e){logger[_0x575a('0x13')](_0x575a('0x1d'),_0x253963[_0x575a('0xf')],_0x10448e);return _0xda9354['update']({'data1':_0x10448e,'data2':null,'license':null});}}}return _0xda9354;})['then'](function(_0x525240){_0xda9354=_0x525240;})[_0x575a('0xe')](function(_0x33633e){logger['error'](_0x33633e['message']);})[_0x575a('0x1e')](function(){setTimeout(function(){manageLicense(hardware[_0x575a('0x1f')](),_0xda9354);},TIME);});}function defaultLicense(){var _0x1c0c50=hardware['getUuid']();if(_0x1c0c50){return db[_0x575a('0x20')][_0x575a('0x21')]({'where':{'id':0x1},'defaults':{'data1':_0x1c0c50}})[_0x575a('0x22')](function(_0x52e18a,_0x2a005e){logger[_0x575a('0x13')](_0x575a('0x23'),_0x1c0c50);manageLicense(_0x1c0c50,_0x52e18a);})[_0x575a('0xe')](function(_0x11e47f){logger[_0x575a('0x24')](_0x11e47f[_0x575a('0x25')]);});}}exports[_0x575a('0x26')]=defaultLicense; \ No newline at end of file +var _0x94a0=['findOrCreate','default','util','moment','request-promise','pkginfo','version','../../components/encryptor','./hardware','../logger','license','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','then','catch','get','data1','active','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','encryptString','YYYY-MM-DD\x20HH:mm','diff','days','error','message','getUuid','License'];(function(_0x53ca64,_0x3a8013){var _0x26ba46=function(_0x5a8995){while(--_0x5a8995){_0x53ca64['push'](_0x53ca64['shift']());}};_0x26ba46(++_0x3a8013);}(_0x94a0,0x1c9));var _0x094a=function(_0x16eb6d,_0x5625cf){_0x16eb6d=_0x16eb6d-0x0;var _0x50614c=_0x94a0[_0x16eb6d];return _0x50614c;};'use strict';var util=require(_0x094a('0x0'));var moment=require(_0x094a('0x1'));var rp=require(_0x094a('0x2'));var BPromise=require('bluebird');var pkginfo=require(_0x094a('0x3'))(module,_0x094a('0x4'));var db=require('../../mysqldb')['db'];var encryptor=require(_0x094a('0x5'));var hardware=require(_0x094a('0x6'));var logger=require(_0x094a('0x7'))(_0x094a('0x8'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x10ae73){return new BPromise(function(_0x231744,_0x3ce722){var _0x43e0d9=util['format']('%s/api/servers/%s/check?version=%s',HOST,_0x10ae73,module['exports']['version']);if(oldToken){_0x43e0d9=util[_0x094a('0x9')](_0x094a('0xa'),HOST,_0x10ae73,module[_0x094a('0xb')][_0x094a('0x4')],oldToken);}var _0x289301={'uri':_0x43e0d9,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x289301)[_0x094a('0xc')](function(_0x37eb43){_0x231744(_0x37eb43);})[_0x094a('0xd')](function(_0x227e44){_0x3ce722(_0x227e44);});});}function manageLicense(_0x16cde4,_0x323064){var _0x516fc9=_0x323064[_0x094a('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x516fc9[_0x094a('0xf')]!==_0x16cde4&&!_0x516fc9['data2']){oldToken=_0x516fc9[_0x094a('0xf')];}httpRequest(_0x16cde4)['then'](function(_0xc67be6){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0xc67be6[_0x094a('0x10')]){isOldTokenSent=![];if(!_0x516fc9['license']&&_0x516fc9[_0x094a('0x8')]!=_0xc67be6['license']||_0x516fc9['license']&&_0x516fc9[_0x094a('0x11')]){logger['info'](_0x094a('0x12'));}if(_0x516fc9['license']&&!_0x516fc9[_0x094a('0x11')]&&_0x516fc9[_0x094a('0x8')]!=_0xc67be6[_0x094a('0x8')]){logger[_0x094a('0x13')](_0x094a('0x14'));}if(_0x516fc9[_0x094a('0x8')]&&!_0x516fc9[_0x094a('0x11')]&&_0x516fc9[_0x094a('0x8')]==_0xc67be6['license']){return _0x323064;}return _0x323064[_0x094a('0x15')]({'data1':_0x16cde4,'data2':null,'license':_0xc67be6[_0x094a('0x8')]});}else{if(_0xc67be6[_0x094a('0x8')]||_0x516fc9[_0x094a('0x8')]){if(!_0x516fc9[_0x094a('0x11')]){if(_0x516fc9[_0x094a('0xf')]==_0x16cde4){GRAY_PERIOD_REASON='Disabled';logger[_0x094a('0x13')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON='Changed';logger[_0x094a('0x13')](_0x094a('0x16'),_0x516fc9[_0x094a('0xf')],_0x16cde4);}logger[_0x094a('0x13')](_0x094a('0x17'),GRAY_PERIOD_REASON[_0x094a('0x18')](),moment()['format']('YYYY-MM-DD\x20HH:mm'));return _0x323064[_0x094a('0x15')]({'data2':encryptor[_0x094a('0x19')](moment()['format'](_0x094a('0x1a')))});}else{if(moment()[_0x094a('0x1b')](encryptor['decryptString'](_0x516fc9['data2']),_0x094a('0x1c'))>DAYS){logger[_0x094a('0x13')]('DEMO\x20START\x20AT\x20%s',moment()[_0x094a('0x9')](_0x094a('0x1a')));isOldTokenSent=![];return _0x323064[_0x094a('0x15')]({'data1':_0x16cde4,'data2':null,'license':null});}}}else{if(_0x516fc9[_0x094a('0xf')]!=_0x16cde4){logger[_0x094a('0x13')](_0x094a('0x16'),_0x516fc9[_0x094a('0xf')],_0x16cde4);return _0x323064['update']({'data1':_0x16cde4,'data2':null,'license':null});}}}return _0x323064;})[_0x094a('0xc')](function(_0x4f1718){_0x323064=_0x4f1718;})[_0x094a('0xd')](function(_0x12a245){logger[_0x094a('0x1d')](_0x12a245[_0x094a('0x1e')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x094a('0x1f')](),_0x323064);},TIME);});}function defaultLicense(){var _0x3d16a1=hardware[_0x094a('0x1f')]();if(_0x3d16a1){return db[_0x094a('0x20')][_0x094a('0x21')]({'where':{'id':0x1},'defaults':{'data1':_0x3d16a1}})['spread'](function(_0x366006,_0x1b9b4a){logger[_0x094a('0x13')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x3d16a1);manageLicense(_0x3d16a1,_0x366006);})[_0x094a('0xd')](function(_0x296316){logger['error'](_0x296316['message']);});}}exports[_0x094a('0x22')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index c03f710..bfd0c7a 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 _0xcf4a=['exports','util','moment','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','find','then','catch','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','decryptString','parse','demo','add','days','grayReason','uuid','disabled','message','User','findAll','role','sequelize','col','count','admin','user','users','telephones','pick','telephone','License\x20limit\x20reached\x20for\x20users'];(function(_0xb43ffc,_0x184028){var _0x2d9add=function(_0x182ea7){while(--_0x182ea7){_0xb43ffc['push'](_0xb43ffc['shift']());}};_0x2d9add(++_0x184028);}(_0xcf4a,0x1e1));var _0xacf4=function(_0x383a8e,_0x230549){_0x383a8e=_0x383a8e-0x0;var _0x1ed582=_0xcf4a[_0x383a8e];return _0x1ed582;};'use strict';var util=require(_0xacf4('0x0'));var _=require('lodash');var moment=require(_0xacf4('0x1'));var BPromise=require('bluebird');var hardware=require(_0xacf4('0x2'));var encryptor=require(_0xacf4('0x3'));var db=require(_0xacf4('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xacf4('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xacf4('0x6'),'machineUuid':hardware[_0xacf4('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xacf4('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0xacf4('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x3996fb){return new BPromise(function(_0x1fed02,_0x37f4fe){return db['License'][_0xacf4('0x8')](_['defaults'](_0x3996fb,{'raw':!![],'where':{'id':0x1}}))[_0xacf4('0x9')](function(_0x107c88){return checkLicense(_0x107c88,null);})[_0xacf4('0x9')](function(_0xd9beba){_0x1fed02(_0xd9beba);return;})[_0xacf4('0xa')](function(_0x74d4f5){_0x37f4fe(_0x74d4f5);});});}function checkLicense(_0x4326f2,_0xfef47e){if(!_0x4326f2){demoLicense['uuid']=_0x4326f2['data1'];return demoLicense;}try{var _0x3ad3b6=_0xfef47e||_0x4326f2[_0xacf4('0xb')];if(_[_0xacf4('0xc')](_0x3ad3b6)){throw new Error(_0xacf4('0xd'));}var _0x4bf266=_0x4326f2[_0xacf4('0xe')];var _0x7c2d21=_0x4326f2[_0xacf4('0xf')];var _0x4e41bf=_0x4bf266[_0xacf4('0x10')]('-')[0x4];var _0x51a6cb=_0x4bf266['split']('-')[0x0];var _0x522f53=encryptor[_0xacf4('0x11')](_0x3ad3b6,util['format']('%s:%s:%s',_0x4e41bf,_0x4bf266,_0x51a6cb));var _0x58d6=JSON[_0xacf4('0x12')](_0x522f53);_0x58d6[_0xacf4('0x13')]=![];_0x58d6['uuid']=_0x4bf266;_0x58d6['machineUuid']=hardware[_0xacf4('0x7')]();if(_0x7c2d21){var _0x4ce760=encryptor[_0xacf4('0x11')](_0x7c2d21);_0x58d6['gray']=_0x4ce760;_0x58d6['deadline']=moment(_0x4ce760)[_0xacf4('0x14')](0x7,_0xacf4('0x15'))['format']();_0x58d6[_0xacf4('0x16')]=_0x58d6[_0xacf4('0x17')]!=_0x58d6['machineUuid']?'changed':_0xacf4('0x18');}return _0x58d6;}catch(_0x392f8d){breakingLicense[_0xacf4('0x17')]=_0x4326f2[_0xacf4('0xe')];breakingLicense[_0xacf4('0x19')]=_0x392f8d[_0xacf4('0x19')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x467c1c,_0x4a57f3){getLicense()[_0xacf4('0x9')](function(_0x5a57b0){return db[_0xacf4('0x1a')][_0xacf4('0x1b')]({'attributes':[_0xacf4('0x1c'),[db[_0xacf4('0x1d')]['fn']('COUNT',db['sequelize'][_0xacf4('0x1e')](_0xacf4('0x1c'))),_0xacf4('0x1f')]],'group':_0xacf4('0x1c'),'where':{'role':{'$or':[_0xacf4('0x20'),_0xacf4('0x21'),'telephone']}},'raw':!![]})[_0xacf4('0x9')](function(_0x177b22){var _0x35e4a2={'user':_0x5a57b0[_0xacf4('0x22')]||0x0,'telephone':_0x5a57b0[_0xacf4('0x23')]||0x0};_0x177b22['forEach'](function(_0x44e4b9){var _0x57cf6a=_0x44e4b9[_0xacf4('0x1c')]===_0xacf4('0x20')?'user':_0x44e4b9[_0xacf4('0x1c')];_0x35e4a2[_0x57cf6a]-=_0x44e4b9['count'];if(_0x35e4a2[_0x57cf6a]<0x0)_0x35e4a2[_0x57cf6a]=0x0;});_0x467c1c(_0x35e4a2);return;});})['catch'](function(_0x387949){_0x4a57f3(_0x387949);});});}function checkUserLimits(_0x3b3291){return new BPromise(function(_0xaa89e,_0x5e251b){getLimits()[_0xacf4('0x9')](function(_0x2147fa){var _0x184f15=_[_0xacf4('0x24')](_['countBy'](_0x3b3291,'role'),['admin',_0xacf4('0x21'),_0xacf4('0x25')]);var _0x26b7ce=(_0x184f15[_0xacf4('0x20')]||0x0)+(_0x184f15[_0xacf4('0x21')]||0x0);var _0x51ffaa=_0x184f15[_0xacf4('0x25')]||0x0;if(_0x26b7ce>_0x2147fa[_0xacf4('0x21')])return _0x5e251b(_0xacf4('0x26'));if(_0x51ffaa>_0x2147fa[_0xacf4('0x25')])return _0x5e251b('License\x20limit\x20reached\x20for\x20telephones');return _0xaa89e();})[_0xacf4('0xa')](function(_0x1847eb){_0x5e251b(_0x1847eb);});});}module[_0xacf4('0x27')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xe440=['add','days','grayReason','changed','disabled','message','User','findAll','role','sequelize','COUNT','col','count','admin','user','telephone','users','telephones','forEach','catch','pick','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','then','uuid','license','isEmpty','data1','data2','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','gray','deadline'];(function(_0x2d05d9,_0x5c5602){var _0x205e59=function(_0x5d7354){while(--_0x5d7354){_0x2d05d9['push'](_0x2d05d9['shift']());}};_0x205e59(++_0x5c5602);}(_0xe440,0x17d));var _0x0e44=function(_0x22b24e,_0x988c76){_0x22b24e=_0x22b24e-0x0;var _0x504ef5=_0xe440[_0x22b24e];return _0x504ef5;};'use strict';var util=require(_0x0e44('0x0'));var _=require(_0x0e44('0x1'));var moment=require(_0x0e44('0x2'));var BPromise=require('bluebird');var hardware=require(_0x0e44('0x3'));var encryptor=require(_0x0e44('0x4'));var db=require(_0x0e44('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x0e44('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x0e44('0x7'),'machineUuid':hardware[_0x0e44('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x0e44('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x0e44('0x9'),'machineUuid':hardware[_0x0e44('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x26cfb9){return new BPromise(function(_0x80fb58,_0x2203f2){return db[_0x0e44('0xa')][_0x0e44('0xb')](_['defaults'](_0x26cfb9,{'raw':!![],'where':{'id':0x1}}))[_0x0e44('0xc')](function(_0x3aa9b1){return checkLicense(_0x3aa9b1,null);})[_0x0e44('0xc')](function(_0x5a5455){_0x80fb58(_0x5a5455);return;})['catch'](function(_0x45abb7){_0x2203f2(_0x45abb7);});});}function checkLicense(_0x5e44a5,_0xba3c01){if(!_0x5e44a5){demoLicense[_0x0e44('0xd')]=_0x5e44a5['data1'];return demoLicense;}try{var _0x5e9bd7=_0xba3c01||_0x5e44a5[_0x0e44('0xe')];if(_[_0x0e44('0xf')](_0x5e9bd7)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x538a2b=_0x5e44a5[_0x0e44('0x10')];var _0x1e9d9d=_0x5e44a5[_0x0e44('0x11')];var _0x4aa839=_0x538a2b[_0x0e44('0x12')]('-')[0x4];var _0x10e885=_0x538a2b[_0x0e44('0x12')]('-')[0x0];var _0x3ad5d3=encryptor[_0x0e44('0x13')](_0x5e9bd7,util[_0x0e44('0x14')](_0x0e44('0x15'),_0x4aa839,_0x538a2b,_0x10e885));var _0x3f57cf=JSON[_0x0e44('0x16')](_0x3ad5d3);_0x3f57cf[_0x0e44('0x17')]=![];_0x3f57cf[_0x0e44('0xd')]=_0x538a2b;_0x3f57cf[_0x0e44('0x18')]=hardware[_0x0e44('0x8')]();if(_0x1e9d9d){var _0xc288=encryptor['decryptString'](_0x1e9d9d);_0x3f57cf[_0x0e44('0x19')]=_0xc288;_0x3f57cf[_0x0e44('0x1a')]=moment(_0xc288)[_0x0e44('0x1b')](0x7,_0x0e44('0x1c'))['format']();_0x3f57cf[_0x0e44('0x1d')]=_0x3f57cf['uuid']!=_0x3f57cf[_0x0e44('0x18')]?_0x0e44('0x1e'):_0x0e44('0x1f');}return _0x3f57cf;}catch(_0x52893d){breakingLicense[_0x0e44('0xd')]=_0x5e44a5['data1'];breakingLicense[_0x0e44('0x20')]=_0x52893d[_0x0e44('0x20')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x2eabfc,_0x4ff3e6){getLicense()[_0x0e44('0xc')](function(_0x33fb35){return db[_0x0e44('0x21')][_0x0e44('0x22')]({'attributes':[_0x0e44('0x23'),[db[_0x0e44('0x24')]['fn'](_0x0e44('0x25'),db[_0x0e44('0x24')][_0x0e44('0x26')](_0x0e44('0x23'))),_0x0e44('0x27')]],'group':_0x0e44('0x23'),'where':{'role':{'$or':[_0x0e44('0x28'),_0x0e44('0x29'),_0x0e44('0x2a')]}},'raw':!![]})[_0x0e44('0xc')](function(_0x3396c9){var _0xefcf17={'user':_0x33fb35[_0x0e44('0x2b')]||0x0,'telephone':_0x33fb35[_0x0e44('0x2c')]||0x0};_0x3396c9[_0x0e44('0x2d')](function(_0x54b8d1){var _0x3235a8=_0x54b8d1[_0x0e44('0x23')]===_0x0e44('0x28')?_0x0e44('0x29'):_0x54b8d1[_0x0e44('0x23')];_0xefcf17[_0x3235a8]-=_0x54b8d1['count'];if(_0xefcf17[_0x3235a8]<0x0)_0xefcf17[_0x3235a8]=0x0;});_0x2eabfc(_0xefcf17);return;});})[_0x0e44('0x2e')](function(_0x3bf7ca){_0x4ff3e6(_0x3bf7ca);});});}function checkUserLimits(_0x46d158){return new BPromise(function(_0xb0f1de,_0x52be55){getLimits()[_0x0e44('0xc')](function(_0xc89fe){var _0x2ba2f6=_[_0x0e44('0x2f')](_['countBy'](_0x46d158,_0x0e44('0x23')),[_0x0e44('0x28'),_0x0e44('0x29'),_0x0e44('0x2a')]);var _0x5eb645=(_0x2ba2f6[_0x0e44('0x28')]||0x0)+(_0x2ba2f6[_0x0e44('0x29')]||0x0);var _0x3887a9=_0x2ba2f6[_0x0e44('0x2a')]||0x0;if(_0x5eb645>_0xc89fe[_0x0e44('0x29')])return _0x52be55(_0x0e44('0x30'));if(_0x3887a9>_0xc89fe[_0x0e44('0x2a')])return _0x52be55(_0x0e44('0x31'));return _0xb0f1de();})['catch'](function(_0x3b2d71){_0x52be55(_0x3b2d71);});});}module[_0x0e44('0x32')]={'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 ccee559..1d538b9 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 _0x430c=['exports','app-id','secret'];(function(_0x38d796,_0x28b58e){var _0x452ce3=function(_0x42996a){while(--_0x42996a){_0x38d796['push'](_0x38d796['shift']());}};_0x452ce3(++_0x28b58e);}(_0x430c,0x1a1));var _0xc430=function(_0x5a2d95,_0xb362e5){_0x5a2d95=_0x5a2d95-0x0;var _0x2c3986=_0x430c[_0x5a2d95];return _0x2c3986;};'use strict';module[_0xc430('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0xc430('0x1'),'GOOGLE_SECRET':_0xc430('0x2'),'DEBUG':''}; \ No newline at end of file +var _0x3266=['secret','exports','http://localhost:9000','myappanuglar-secret','app-id'];(function(_0x390f0d,_0x19dd94){var _0x4c2060=function(_0x2c468a){while(--_0x2c468a){_0x390f0d['push'](_0x390f0d['shift']());}};_0x4c2060(++_0x19dd94);}(_0x3266,0x6a));var _0x6326=function(_0x56ba92,_0xb3c986){_0x56ba92=_0x56ba92-0x0;var _0x8fe94d=_0x3266[_0x56ba92];return _0x8fe94d;};'use strict';module[_0x6326('0x0')]={'DOMAIN':_0x6326('0x1'),'SESSION_SECRET':_0x6326('0x2'),'GOOGLE_ID':_0x6326('0x3'),'GOOGLE_SECRET':_0x6326('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 26b4117..bf2caf7 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53e9=['fileLogger','exports','../utils/loggers'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x53e9,0x6e));var _0x953e=function(_0xf14bd4,_0x3a8097){_0xf14bd4=_0xf14bd4-0x0;var _0x3bf99b=_0x53e9[_0xf14bd4];return _0x3bf99b;};'use strict';var fileLogger=require(_0x953e('0x0'))[_0x953e('0x1')];module[_0x953e('0x2')]=fileLogger; \ No newline at end of file +var _0x8d14=['fileLogger','exports','../utils/loggers'];(function(_0x2093ea,_0x5e2cba){var _0x244257=function(_0x435349){while(--_0x435349){_0x2093ea['push'](_0x2093ea['shift']());}};_0x244257(++_0x5e2cba);}(_0x8d14,0x1d3));var _0x48d1=function(_0x3a6171,_0x1985e3){_0x3a6171=_0x3a6171-0x0;var _0x215d6a=_0x8d14[_0x3a6171];return _0x215d6a;};'use strict';var fileLogger=require(_0x48d1('0x0'))[_0x48d1('0x1')];module[_0x48d1('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index c983fad..4d52249 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 _0x2241=['exports','path','../../config/environment','resolve','join','root','express','../../services/express/index.js','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing'];(function(_0x28ad96,_0x12e4dd){var _0x6080a=function(_0x51f6b7){while(--_0x51f6b7){_0x28ad96['push'](_0x28ad96['shift']());}};_0x6080a(++_0x12e4dd);}(_0x2241,0x189));var _0x1224=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x2241[_0x5b644e];return _0x49c6bf;};'use strict';var path=require(_0x1224('0x0'));var cfg=require(_0x1224('0x1'));var env={'NODE_PATH':path[_0x1224('0x2')](path[_0x1224('0x3')](cfg[_0x1224('0x4')],'legacy-libs'))};var pm2config={'apps':[{'name':_0x1224('0x5'),'script':path[_0x1224('0x3')](__dirname,_0x1224('0x6')),'env':env},{'name':'ami','script':path[_0x1224('0x3')](__dirname,_0x1224('0x7')),'env':env},{'name':_0x1224('0x8'),'script':path[_0x1224('0x3')](__dirname,_0x1224('0x9')),'env':env},{'name':_0x1224('0xa'),'script':path[_0x1224('0x3')](__dirname,_0x1224('0xb')),'env':env},{'name':_0x1224('0xc'),'script':path[_0x1224('0x3')](__dirname,'../../services/routing/index.js'),'env':env},{'name':'xdr','script':path['join'](__dirname,'../../services/xdr/index.js'),'env':env}]};module[_0x1224('0xd')]=pm2config; \ No newline at end of file +var _0x2bf5=['../../services/ami/index.js','agi','../../services/agi/index.js','../../services/email/index.js','routing','../../services/routing/index.js','xdr','exports','path','../../config/environment','resolve','join','root','legacy-libs','express','../../services/express/index.js','ami'];(function(_0x304c48,_0x347cbe){var _0xb2528=function(_0x467b24){while(--_0x467b24){_0x304c48['push'](_0x304c48['shift']());}};_0xb2528(++_0x347cbe);}(_0x2bf5,0xb2));var _0x52bf=function(_0x42210b,_0xf05a86){_0x42210b=_0x42210b-0x0;var _0x31353b=_0x2bf5[_0x42210b];return _0x31353b;};'use strict';var path=require(_0x52bf('0x0'));var cfg=require(_0x52bf('0x1'));var env={'NODE_PATH':path[_0x52bf('0x2')](path[_0x52bf('0x3')](cfg[_0x52bf('0x4')],_0x52bf('0x5')))};var pm2config={'apps':[{'name':_0x52bf('0x6'),'script':path[_0x52bf('0x3')](__dirname,_0x52bf('0x7')),'env':env},{'name':_0x52bf('0x8'),'script':path[_0x52bf('0x3')](__dirname,_0x52bf('0x9')),'env':env},{'name':_0x52bf('0xa'),'script':path[_0x52bf('0x3')](__dirname,_0x52bf('0xb')),'env':env},{'name':'email','script':path['join'](__dirname,_0x52bf('0xc')),'env':env},{'name':_0x52bf('0xd'),'script':path[_0x52bf('0x3')](__dirname,_0x52bf('0xe')),'env':env},{'name':_0x52bf('0xf'),'script':path[_0x52bf('0x3')](__dirname,'../../services/xdr/index.js'),'env':env}]};module[_0x52bf('0x10')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index c214b20..e6a599f 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 _0x16ed=['bluebird','./config','connect','connected','start','then','disconnect','stop','restart','describe','dump','saved','pm2'];(function(_0x46c325,_0x31b248){var _0xe6f0fe=function(_0x577124){while(--_0x577124){_0x46c325['push'](_0x46c325['shift']());}};_0xe6f0fe(++_0x31b248);}(_0x16ed,0x74));var _0xd16e=function(_0x9516c6,_0x217446){_0x9516c6=_0x9516c6-0x0;var _0x5a9a4d=_0x16ed[_0x9516c6];return _0x5a9a4d;};'use strict';var pm2=require(_0xd16e('0x0'));var BPromise=require(_0xd16e('0x1'));var config=require(_0xd16e('0x2'));function connect(){return new BPromise(function(_0x3d103e,_0x39fb70){return pm2[_0xd16e('0x3')](function(_0x5e5351){if(_0x5e5351){return _0x39fb70(_0x5e5351);}return _0x3d103e(_0xd16e('0x4'));});});};exports[_0xd16e('0x5')]=function(_0x4781dd){return connect()[_0xd16e('0x6')](function(){return new BPromise(function(_0xa4e9ea,_0x34b45c){return pm2[_0xd16e('0x5')](_0x4781dd,function(_0x36529b,_0x4a6090){if(_0x36529b){return _0x34b45c(_0x36529b);}pm2[_0xd16e('0x7')]();return _0xa4e9ea(_0x4a6090);});});});};exports[_0xd16e('0x8')]=function(_0x285d68){return connect()['then'](function(){return new BPromise(function(_0x3a284a,_0x503421){return pm2[_0xd16e('0x8')](_0x285d68,function(_0x5d147b,_0xedfb5a){if(_0x5d147b){return _0x503421(_0x5d147b);}pm2[_0xd16e('0x7')]();return _0x3a284a(_0xedfb5a);});});});};exports['restart']=function(_0x2c4673){return connect()[_0xd16e('0x6')](function(){return new BPromise(function(_0x18a623,_0x43390a){return pm2[_0xd16e('0x9')](_0x2c4673,function(_0x4f1091,_0x1761bb){if(_0x4f1091){return _0x43390a(_0x4f1091);}pm2[_0xd16e('0x7')]();return _0x18a623(_0x1761bb);});});});};exports['list']=function(){return connect()[_0xd16e('0x6')](function(){return new BPromise(function(_0x4fccb2,_0x18f134){return pm2['list'](function(_0x324b83,_0x137547){if(_0x324b83){return _0x18f134(_0x324b83);}pm2[_0xd16e('0x7')]();return _0x4fccb2(_0x137547);});});});};exports[_0xd16e('0xa')]=function(_0x3d3b69){return connect()[_0xd16e('0x6')](function(){return new BPromise(function(_0x285b9f,_0xde07ca){return pm2['describe'](_0x3d3b69,function(_0x4c3064,_0x191de9){if(_0x4c3064){return _0xde07ca(_0x4c3064);}pm2['disconnect']();return _0x285b9f(_0x191de9);});});});};exports['delete']=function(_0xa43c22){return connect()['then'](function(){return new BPromise(function(_0x171d3e,_0x1dc42e){return pm2['delete'](_0xa43c22,function(_0x3b2084,_0x2b9383){if(_0x3b2084){return _0x1dc42e(_0x3b2084);}pm2[_0xd16e('0x7')]();return _0x171d3e(_0x2b9383);});});});};exports[_0xd16e('0xb')]=function(){return connect()[_0xd16e('0x6')](function(){return new BPromise(function(_0x9c3ee9,_0x19d63e){return pm2[_0xd16e('0xb')](function(_0x4312d8){if(_0x4312d8){return _0x19d63e(_0x4312d8);}return _0x9c3ee9(_0xd16e('0xc'));});});});}; \ No newline at end of file +var _0x9d98=['start','then','disconnect','stop','restart','list','describe','delete','dump','saved','pm2','bluebird','./config','connect','connected'];(function(_0x1d71a6,_0x1ce1a0){var _0x3444f2=function(_0x317181){while(--_0x317181){_0x1d71a6['push'](_0x1d71a6['shift']());}};_0x3444f2(++_0x1ce1a0);}(_0x9d98,0x1ae));var _0x89d9=function(_0x301066,_0x349f8b){_0x301066=_0x301066-0x0;var _0x220ff1=_0x9d98[_0x301066];return _0x220ff1;};'use strict';var pm2=require(_0x89d9('0x0'));var BPromise=require(_0x89d9('0x1'));var config=require(_0x89d9('0x2'));function connect(){return new BPromise(function(_0x40828c,_0x9c2faa){return pm2[_0x89d9('0x3')](function(_0x4ec85b){if(_0x4ec85b){return _0x9c2faa(_0x4ec85b);}return _0x40828c(_0x89d9('0x4'));});});};exports[_0x89d9('0x5')]=function(_0x329502){return connect()[_0x89d9('0x6')](function(){return new BPromise(function(_0x22542c,_0x32ecd1){return pm2[_0x89d9('0x5')](_0x329502,function(_0x500a2f,_0x4275af){if(_0x500a2f){return _0x32ecd1(_0x500a2f);}pm2[_0x89d9('0x7')]();return _0x22542c(_0x4275af);});});});};exports[_0x89d9('0x8')]=function(_0x1e2abc){return connect()[_0x89d9('0x6')](function(){return new BPromise(function(_0x46b2cf,_0x53ab91){return pm2[_0x89d9('0x8')](_0x1e2abc,function(_0x55592d,_0x4b4bc4){if(_0x55592d){return _0x53ab91(_0x55592d);}pm2['disconnect']();return _0x46b2cf(_0x4b4bc4);});});});};exports[_0x89d9('0x9')]=function(_0x541f16){return connect()[_0x89d9('0x6')](function(){return new BPromise(function(_0x3e7f1b,_0xd48b0e){return pm2[_0x89d9('0x9')](_0x541f16,function(_0x50ddb9,_0x18a5bc){if(_0x50ddb9){return _0xd48b0e(_0x50ddb9);}pm2['disconnect']();return _0x3e7f1b(_0x18a5bc);});});});};exports[_0x89d9('0xa')]=function(){return connect()['then'](function(){return new BPromise(function(_0x104e09,_0x32dcee){return pm2[_0x89d9('0xa')](function(_0x576fa7,_0x2fa39f){if(_0x576fa7){return _0x32dcee(_0x576fa7);}pm2[_0x89d9('0x7')]();return _0x104e09(_0x2fa39f);});});});};exports['describe']=function(_0xcb9fa9){return connect()[_0x89d9('0x6')](function(){return new BPromise(function(_0x5124f4,_0x14e02d){return pm2[_0x89d9('0xb')](_0xcb9fa9,function(_0x5ad5ec,_0x40e0aa){if(_0x5ad5ec){return _0x14e02d(_0x5ad5ec);}pm2[_0x89d9('0x7')]();return _0x5124f4(_0x40e0aa);});});});};exports[_0x89d9('0xc')]=function(_0x4e1bd){return connect()[_0x89d9('0x6')](function(){return new BPromise(function(_0x37b235,_0x141427){return pm2['delete'](_0x4e1bd,function(_0x4c9cbf,_0x52e04d){if(_0x4c9cbf){return _0x141427(_0x4c9cbf);}pm2[_0x89d9('0x7')]();return _0x37b235(_0x52e04d);});});});};exports[_0x89d9('0xd')]=function(){return connect()[_0x89d9('0x6')](function(){return new BPromise(function(_0x300986,_0x49c74d){return pm2[_0x89d9('0xd')](function(_0x537aed){if(_0x537aed){return _0x49c74d(_0x537aed);}return _0x300986(_0x89d9('0xe'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 6452afc..a5c5ec0 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 _0x5857=['join','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','emit','catch','[CHAT]\x20Error\x20closing\x20interactions','inspect','lodash','ioredis','util','../../mysqldb','../logger','schedule','defaults','redis','socket.io-emitter','Setting','chatTimeout','then','ChatInteraction','lastMsgAt','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:'];(function(_0x119cd8,_0x556b73){var _0x7072a3=function(_0x5908d1){while(--_0x5908d1){_0x119cd8['push'](_0x119cd8['shift']());}};_0x7072a3(++_0x556b73);}(_0x5857,0x12b));var _0x7585=function(_0xbd1758,_0x16e5cb){_0xbd1758=_0xbd1758-0x0;var _0x1ee75b=_0x5857[_0xbd1758];return _0x1ee75b;};'use strict';var _=require(_0x7585('0x0'));var moment=require('moment');var Redis=require(_0x7585('0x1'));var util=require(_0x7585('0x2'));var config=require('../../config/environment');var db=require(_0x7585('0x3'))['db'];var logger=require(_0x7585('0x4'))(_0x7585('0x5'));config['redis']=_[_0x7585('0x6')](config[_0x7585('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x7585('0x8'))(new Redis(config[_0x7585('0x7')]));function closeInteractions(){var _0x5649c6=0x0;var _0x3910f9=[];return db[_0x7585('0x9')]['find']({'raw':!![],'attributes':['id',_0x7585('0xa')],'where':{'id':0x1}})[_0x7585('0xb')](function(_0x34d550){_0x5649c6=_0x34d550[_0x7585('0xa')];if(_0x5649c6){return db[_0x7585('0xc')]['findAll']({'raw':!![],'attributes':['id',_0x7585('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x7585('0xe')](_0x34d550[_0x7585('0xa')],_0x7585('0xf'))}}});}else{return[];}})[_0x7585('0xb')](function(_0x531fbd){if(_0x531fbd&&_0x531fbd[_0x7585('0x10')]){_0x3910f9=_[_0x7585('0x11')](_0x531fbd||[],'id');logger[_0x7585('0x12')](_0x7585('0x13'),_0x3910f9[_0x7585('0x14')]());return db['ChatInteraction'][_0x7585('0x15')]({'closeReason':'system','disposition':_0x7585('0x16'),'closed':!![],'closedAt':moment()[_0x7585('0x17')](_0x7585('0x18'))},{'where':{'id':_0x3910f9}});}})['then'](function(){if(_0x3910f9&&_0x3910f9[_0x7585('0x10')]){logger[_0x7585('0x12')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x3910f9[_0x7585('0x14')]());for(var _0x4f8415=0x0;_0x4f8415<_0x3910f9[_0x7585('0x10')];_0x4f8415++){io[_0x7585('0x19')]('chatInteraction:update',{'id':_0x3910f9[_0x4f8415],'closed':!![]});}}})[_0x7585('0x1a')](function(_0x4e1c8b){logger['error'](_0x7585('0x1b'),_0x4e1c8b?util[_0x7585('0x1c')](_0x4e1c8b,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x80a4=['join','timeout','format','YYYY-MM-DD\x20HH:mm:ss','emit','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','Setting','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','then','length','info','[CHAT]\x20Interactions\x20to\x20close:'];(function(_0x310b90,_0x5bb38c){var _0x3726ee=function(_0x4f60e4){while(--_0x4f60e4){_0x310b90['push'](_0x310b90['shift']());}};_0x3726ee(++_0x5bb38c);}(_0x80a4,0x165));var _0x480a=function(_0x35dadd,_0x3ed50f){_0x35dadd=_0x35dadd-0x0;var _0x2728ed=_0x80a4[_0x35dadd];return _0x2728ed;};'use strict';var _=require('lodash');var moment=require(_0x480a('0x0'));var Redis=require(_0x480a('0x1'));var util=require(_0x480a('0x2'));var config=require(_0x480a('0x3'));var db=require(_0x480a('0x4'))['db'];var logger=require(_0x480a('0x5'))(_0x480a('0x6'));config[_0x480a('0x7')]=_[_0x480a('0x8')](config[_0x480a('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x383c2a=0x0;var _0x32ba74=[];return db[_0x480a('0x9')]['find']({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})['then'](function(_0x2f5a47){_0x383c2a=_0x2f5a47[_0x480a('0xa')];if(_0x383c2a){return db[_0x480a('0xb')][_0x480a('0xc')]({'raw':!![],'attributes':['id',_0x480a('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x480a('0xe')](_0x2f5a47[_0x480a('0xa')],_0x480a('0xf'))}}});}else{return[];}})[_0x480a('0x10')](function(_0x37512a){if(_0x37512a&&_0x37512a[_0x480a('0x11')]){_0x32ba74=_['map'](_0x37512a||[],'id');logger[_0x480a('0x12')](_0x480a('0x13'),_0x32ba74[_0x480a('0x14')]());return db['ChatInteraction']['update']({'closeReason':'system','disposition':_0x480a('0x15'),'closed':!![],'closedAt':moment()[_0x480a('0x16')](_0x480a('0x17'))},{'where':{'id':_0x32ba74}});}})[_0x480a('0x10')](function(){if(_0x32ba74&&_0x32ba74[_0x480a('0x11')]){logger[_0x480a('0x12')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x32ba74[_0x480a('0x14')]());for(var _0x33173c=0x0;_0x33173c<_0x32ba74[_0x480a('0x11')];_0x33173c++){io[_0x480a('0x18')]('chatInteraction:update',{'id':_0x32ba74[_0x33173c],'closed':!![]});}}})['catch'](function(_0x27a101){logger[_0x480a('0x19')](_0x480a('0x1a'),_0x27a101?util[_0x480a('0x1b')](_0x27a101,{'showHidden':![],'depth':null}):'');});}exports[_0x480a('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index 672d3ed..fed10b0 100644 --- a/server/config/schedule/cloud-provider.js +++ b/server/config/schedule/cloud-provider.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb8e1=['exports','../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x2ea087,_0x17f324){var _0x23ebac=function(_0x5575d8){while(--_0x5575d8){_0x2ea087['push'](_0x2ea087['shift']());}};_0x23ebac(++_0x17f324);}(_0xb8e1,0x19c));var _0x1b8e=function(_0x22d69c,_0x159422){_0x22d69c=_0x22d69c-0x0;var _0x5ebf18=_0xb8e1[_0x22d69c];return _0x5ebf18;};'use strict';function start(){var _0x4928ad=require(_0x1b8e('0x0'));return _0x4928ad[_0x1b8e('0x1')]();}module[_0x1b8e('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0xdce4=['../../api/cloudProvider/cloudProvider.oauth.js','exports'];(function(_0x55a1da,_0x8aa038){var _0x55c4bf=function(_0x45c8a7){while(--_0x45c8a7){_0x55a1da['push'](_0x55a1da['shift']());}};_0x55c4bf(++_0x8aa038);}(_0xdce4,0xae));var _0x4dce=function(_0x29110d,_0x54bd86){_0x29110d=_0x29110d-0x0;var _0xb4fcd6=_0xdce4[_0x29110d];return _0xb4fcd6;};'use strict';function start(){var _0x2b70b0=require(_0x4dce('0x0'));return _0x2b70b0['startAllRefreshIntervals']();}module[_0x4dce('0x1')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 9be2bef..e63a80f 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 _0xbc1a=['keys','jobs','map','toString','difference','length','exists','stop','delete\x20cron','index','my\x20id','run\x20job','cron','active','isBetween','startAt','endAt','add','start','deleteJob','stop\x20cron','update\x20cron','run','util','path','lodash','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','MailAccount','format','name','email','Smtp','bcc','Report\x20%s\x20last\x20%s\x20%s','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','Sent','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','status','message','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','error','data','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','subtractUnit','scheduled','DefaultReportId','runReport','then','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','Schedule','findAll','MailServerOut','CloudProvider'];(function(_0x214023,_0x65e22b){var _0x10cf15=function(_0x3a05df){while(--_0x3a05df){_0x214023['push'](_0x214023['shift']());}};_0x10cf15(++_0x65e22b);}(_0xbc1a,0x1e5));var _0xabc1=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xbc1a[_0x2dadb9];return _0x2f0097;};'use strict';var fs=require('fs');var util=require(_0xabc1('0x0'));var path=require(_0xabc1('0x1'));var _=require(_0xabc1('0x2'));var moment=require('moment');var CronJobManager=require('cron-job-manager');var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require('../logger')(_0xabc1('0x3'));var db=require(_0xabc1('0x4'))['db'];var analyticCustomReportController=require(_0xabc1('0x5'));var analyticDefaultReportController=require(_0xabc1('0x6'));var client=jayson[_0xabc1('0x7')][_0xabc1('0x8')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x30344f,_0x2968ad){return function(){logger[_0xabc1('0x9')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x30344f['email']);var _0x48fc4a=!![];var _0x32f436=_0x30344f[_0xabc1('0xa')]['getSmtpOptions']();var _0x3b3701={'account':_0x32f436,'message':{'from':util[_0xabc1('0xb')]('\x22%s\x22\x20<%s>',_0x30344f['MailAccount'][_0xabc1('0xc')],_0x30344f[_0xabc1('0xa')][_0xabc1('0xd')]||_0x30344f['MailAccount'][_0xabc1('0xe')]['user']),'to':_0x30344f[_0xabc1('0xd')],'cc':_0x30344f['cc'],'bcc':_0x30344f[_0xabc1('0xf')],'subject':util[_0xabc1('0xb')](_0xabc1('0x10'),_0x2968ad[_0xabc1('0xc')],_0x30344f['subtractNumber'],_0x30344f['subtractUnit'])}};var _0x3efd65=path[_0xabc1('0x11')](__dirname,_0xabc1('0x12'));var _0x56862b=_0x2968ad[_0xabc1('0x13')];var _0x37ae47=util[_0xabc1('0xb')](_0xabc1('0x14'),path[_0xabc1('0x15')](_0x2968ad[_0xabc1('0x13')],path[_0xabc1('0x16')](_0x2968ad[_0xabc1('0x13')])),_0xabc1('0x17'));var _0x42d847=path[_0xabc1('0x11')](_0x3efd65,_0x56862b);var _0x41393d=path['join'](_0x3efd65,_0x37ae47);if(fs[_0xabc1('0x18')](_0x42d847)){_0x2968ad['status']=_0xabc1('0x19');_0x3b3701['message'][_0xabc1('0x1a')]=[{'filename':_0x56862b,'path':_0x42d847}];_0x3b3701['message'][_0xabc1('0x1b')]=util[_0xabc1('0xb')](_0xabc1('0x1c'),JSON[_0xabc1('0x1d')](_0x2968ad,null,0x2));}else if(fs['existsSync'](_0x41393d)){_0x2968ad[_0xabc1('0x1e')]=_0xabc1('0x19');_0x3b3701[_0xabc1('0x1f')][_0xabc1('0x1a')]=[{'filename':_0x37ae47,'path':_0x41393d}];}else{_0x3b3701[_0xabc1('0x1f')][_0xabc1('0x1b')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x30344f[_0xabc1('0x20')]){_0x48fc4a=![];logger['info'](_0xabc1('0x21'));}}if(_0x48fc4a){return client[_0xabc1('0x22')]('SendMail',_0x3b3701)['then'](function(_0x2ac637){if(_0x2ac637['error']){return logger['error']('error\x20mail',JSON['stringify'](_0x2ac637));}return logger[_0xabc1('0x9')]('email\x20sent');})['catch'](function(_0x2e4b8f){return logger['error']('error\x20mail',JSON[_0xabc1('0x1d')](_0x2e4b8f));});}};}function handleError(){return function(_0x48a960){return logger[_0xabc1('0x23')](JSON[_0xabc1('0x1d')](_0x48a960));};}function handleResult(_0x50c76b){return function(_0x467cc5){logger[_0xabc1('0x9')](_0xabc1('0x24'),JSON[_0xabc1('0x1d')](_0x467cc5));if(_0x50c76b['MailAccount']&&_0x50c76b['MailAccount'][_0xabc1('0xe')]&&!_[_0xabc1('0x25')](_0x50c76b[_0xabc1('0xd')])){setTimeout(handleSendEmail(_0x50c76b,_0x467cc5),0x3c*0x3e8);}};}function handleJob(_0x44dd7d){return function(){try{if(_[_0xabc1('0x25')](_0x44dd7d[_0xabc1('0x26')])){return logger[_0xabc1('0x9')](_0xabc1('0x27'));}if(_[_0xabc1('0x25')](_0x44dd7d['subtractUnit'])){return logger[_0xabc1('0x9')](_0xabc1('0x28'));}var _0x4afb6d={'startDate':moment()[_0xabc1('0x29')](_0x44dd7d['subtractNumber'],_0x44dd7d[_0xabc1('0x2a')])[_0xabc1('0xb')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0xabc1('0xb')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0xabc1('0x2b'),'output':_0x44dd7d['output'],'name':_0x44dd7d['name']};if(!_[_0xabc1('0x25')](_0x44dd7d[_0xabc1('0x2c')])){logger[_0xabc1('0x9')]('exec\x20defaul\x20report\x20id:%s',_0x44dd7d['DefaultReportId']);return analyticDefaultReportController[_0xabc1('0x2d')]({'id':_0x44dd7d[_0xabc1('0x2c')]},_0x4afb6d)[_0xabc1('0x2e')](handleResult(_0x44dd7d))[_0xabc1('0x2f')](handleError());}if(!_['isNil'](_0x44dd7d[_0xabc1('0x30')])){logger[_0xabc1('0x9')](_0xabc1('0x31'),_0x44dd7d[_0xabc1('0x30')]);return analyticCustomReportController['runReport']({'id':_0x44dd7d[_0xabc1('0x30')]},_0x4afb6d)[_0xabc1('0x2e')](handleResult(_0x44dd7d))[_0xabc1('0x2f')](handleError());}}catch(_0x1ca818){logger[_0xabc1('0x23')](JSON['stringify'](_0x1ca818));}return logger[_0xabc1('0x9')]('no\x20report\x20id');};}function getJobs(_0x495b4a){var _0x5f0742={};if(_0x495b4a){_0x5f0742['id']=_0x495b4a;}return db[_0xabc1('0x32')][_0xabc1('0x33')]({'where':_0x5f0742,'include':[{'model':db[_0xabc1('0xa')],'attributes':['id',_0xabc1('0xc'),_0xabc1('0xd')],'include':[{'model':db[_0xabc1('0x34')],'as':'Smtp','include':[{'model':db[_0xabc1('0x35')],'as':'CloudProvider'}]}]}]})[_0xabc1('0x2e')](function(_0x2c205){var _0x354dcf=_[_0xabc1('0x36')](manager[_0xabc1('0x37')]);var _0x112c40=_[_0xabc1('0x38')](_0x2c205,function(_0x286866){return _0x286866['id'][_0xabc1('0x39')]();});var _0xce94b=_['keyBy'](_0x2c205,function(_0x37efc3){return _0x37efc3['id'][_0xabc1('0x39')]();});var _0x183d6b=_0x495b4a?_0x112c40:_[_0xabc1('0x3a')](_0x112c40,_0x354dcf);var _0x346590=_['intersection'](_0x112c40,_0x354dcf);var _0x10e45e=_[_0xabc1('0x3a')](_0x354dcf,_0x112c40);var _0x5ada01;var _0x28c5cb;for(_0x5ada01=0x0;_0x5ada01<_0x10e45e[_0xabc1('0x3b')]&&!_0x495b4a;_0x5ada01+=0x1){_0x28c5cb=_0x10e45e[_0x5ada01][_0xabc1('0x39')]();if(manager[_0xabc1('0x3c')](_0x28c5cb)){manager[_0xabc1('0x3d')](_0x28c5cb);manager['deleteJob'](_0x28c5cb);logger[_0xabc1('0x9')](_0xabc1('0x3e'),_0x28c5cb);}}logger[_0xabc1('0x9')]('toRun',JSON[_0xabc1('0x1d')](_0x183d6b));for(_0x5ada01=0x0;_0x5ada01<_0x183d6b['length'];_0x5ada01+=0x1){_0x28c5cb=_0x183d6b[_0x5ada01]['toString']();logger['info'](_0xabc1('0x3f'),_0x28c5cb);if(_0x495b4a){logger[_0xabc1('0x9')](_0xabc1('0x40'),_0x495b4a);logger[_0xabc1('0x9')](JSON[_0xabc1('0x1d')](_0xce94b[_0x28c5cb]));BPromise['resolve']()[_0xabc1('0x2e')](handleJob(_0xce94b[_0x28c5cb]));logger[_0xabc1('0x9')](_0xabc1('0x41'),_0xce94b[_0x28c5cb]['name'],_0xce94b[_0x28c5cb][_0xabc1('0x42')]);}else if(_0xce94b[_0x28c5cb]['cron']&&_0xce94b[_0x28c5cb][_0xabc1('0x43')]&&moment()[_0xabc1('0x44')](_0xce94b[_0x28c5cb][_0xabc1('0x45')],_0xce94b[_0x28c5cb][_0xabc1('0x46')])){manager[_0xabc1('0x47')](_0x28c5cb,_0xce94b[_0x28c5cb][_0xabc1('0x42')],handleJob(_0xce94b[_0x28c5cb]));manager[_0xabc1('0x48')](_0x28c5cb);logger[_0xabc1('0x9')]('add\x20cron',_0xce94b[_0x28c5cb][_0xabc1('0xc')],_0xce94b[_0x28c5cb][_0xabc1('0x42')]);}else if(manager['exists'](_0x28c5cb)){manager[_0xabc1('0x3d')](_0x28c5cb);manager[_0xabc1('0x49')](_0x28c5cb);logger['info'](_0xabc1('0x4a'),_0xce94b[_0x28c5cb][_0xabc1('0xc')],_0xce94b[_0x28c5cb][_0xabc1('0x42')]);}}for(_0x5ada01=0x0,_0x28c5cb;_0x5ada01<_0x346590[_0xabc1('0x3b')]&&!_0x495b4a;_0x5ada01+=0x1){_0x28c5cb=_0x346590[_0x5ada01]['toString']();if(manager[_0xabc1('0x3c')](_0x28c5cb)){if(_0xce94b[_0x28c5cb][_0xabc1('0x42')]&&_0xce94b[_0x28c5cb][_0xabc1('0x43')]&&moment()['isBetween'](_0xce94b[_0x28c5cb][_0xabc1('0x45')],_0xce94b[_0x28c5cb][_0xabc1('0x46')])){manager['update'](_0x28c5cb,_0xce94b[_0x28c5cb][_0xabc1('0x42')],handleJob(_0xce94b[_0x28c5cb]));logger[_0xabc1('0x9')](_0xabc1('0x4b'),_0xce94b[_0x28c5cb][_0xabc1('0xc')],_0xce94b[_0x28c5cb]['cron']);}else{manager[_0xabc1('0x3d')](_0x28c5cb);manager[_0xabc1('0x49')](_0x28c5cb);logger['info'](_0xabc1('0x4a'),_0xce94b[_0x28c5cb][_0xabc1('0xc')],_0xce94b[_0x28c5cb][_0xabc1('0x42')]);}}}})[_0xabc1('0x2f')](function(_0x4cfe90){logger[_0xabc1('0x23')](JSON[_0xabc1('0x1d')](_0x4cfe90));});}exports[_0xabc1('0x4c')]=function(_0x3df534){return getJobs(_0x3df534);};exports[_0xabc1('0x48')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xd95f=['start','add\x20cron','stop\x20cron','endAt','update','update\x20cron','run','util','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','client','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','\x22%s\x22\x20<%s>','Smtp','user','bcc','format','../../files/reports','%s.%s','savename','extname','zip','join','existsSync','status','Sent','message','attachments','text','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','SendMail','error\x20mail','catch','error','data','isNil','subtractNumber','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','name','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','exec\x20custom\x20report\x20id:%s','then','no\x20report\x20id','findAll','MailServerOut','CloudProvider','keys','jobs','keyBy','toString','difference','intersection','length','stop','deleteJob','delete\x20cron','toRun','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt'];(function(_0x5e8b8e,_0x1616f2){var _0x3e7b88=function(_0x5b1282){while(--_0x5b1282){_0x5e8b8e['push'](_0x5e8b8e['shift']());}};_0x3e7b88(++_0x1616f2);}(_0xd95f,0x1a6));var _0xfd95=function(_0x12f48a,_0x6ad7b4){_0x12f48a=_0x12f48a-0x0;var _0x1196d9=_0xd95f[_0x12f48a];return _0x1196d9;};'use strict';var fs=require('fs');var util=require(_0xfd95('0x0'));var path=require(_0xfd95('0x1'));var _=require(_0xfd95('0x2'));var moment=require(_0xfd95('0x3'));var CronJobManager=require(_0xfd95('0x4'));var jayson=require(_0xfd95('0x5'));var BPromise=require(_0xfd95('0x6'));var logger=require('../logger')(_0xfd95('0x7'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0xfd95('0x8'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0xfd95('0x9')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x579104,_0x53ae32){return function(){logger[_0xfd95('0xa')](_0xfd95('0xb'),_0x579104[_0xfd95('0xc')]);var _0x2c7815=!![];var _0x23027c=_0x579104[_0xfd95('0xd')][_0xfd95('0xe')]();var _0x20f474={'account':_0x23027c,'message':{'from':util['format'](_0xfd95('0xf'),_0x579104[_0xfd95('0xd')]['name'],_0x579104[_0xfd95('0xd')][_0xfd95('0xc')]||_0x579104[_0xfd95('0xd')][_0xfd95('0x10')][_0xfd95('0x11')]),'to':_0x579104[_0xfd95('0xc')],'cc':_0x579104['cc'],'bcc':_0x579104[_0xfd95('0x12')],'subject':util[_0xfd95('0x13')]('Report\x20%s\x20last\x20%s\x20%s',_0x53ae32['name'],_0x579104['subtractNumber'],_0x579104['subtractUnit'])}};var _0x159c74=path['join'](__dirname,_0xfd95('0x14'));var _0x336c43=_0x53ae32['savename'];var _0x1ebb32=util[_0xfd95('0x13')](_0xfd95('0x15'),path['basename'](_0x53ae32[_0xfd95('0x16')],path[_0xfd95('0x17')](_0x53ae32[_0xfd95('0x16')])),_0xfd95('0x18'));var _0x1cf36e=path['join'](_0x159c74,_0x336c43);var _0x13ea2c=path[_0xfd95('0x19')](_0x159c74,_0x1ebb32);if(fs[_0xfd95('0x1a')](_0x1cf36e)){_0x53ae32[_0xfd95('0x1b')]=_0xfd95('0x1c');_0x20f474[_0xfd95('0x1d')][_0xfd95('0x1e')]=[{'filename':_0x336c43,'path':_0x1cf36e}];_0x20f474[_0xfd95('0x1d')][_0xfd95('0x1f')]=util[_0xfd95('0x13')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0xfd95('0x20')](_0x53ae32,null,0x2));}else if(fs[_0xfd95('0x1a')](_0x13ea2c)){_0x53ae32['status']=_0xfd95('0x1c');_0x20f474[_0xfd95('0x1d')]['attachments']=[{'filename':_0x1ebb32,'path':_0x13ea2c}];}else{_0x20f474[_0xfd95('0x1d')][_0xfd95('0x1f')]=_0xfd95('0x21');if(!_0x579104[_0xfd95('0x22')]){_0x2c7815=![];logger[_0xfd95('0xa')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x2c7815){return client['request'](_0xfd95('0x23'),_0x20f474)['then'](function(_0x4aafdc){if(_0x4aafdc['error']){return logger['error'](_0xfd95('0x24'),JSON[_0xfd95('0x20')](_0x4aafdc));}return logger[_0xfd95('0xa')]('email\x20sent');})[_0xfd95('0x25')](function(_0x4fc3d9){return logger['error'](_0xfd95('0x24'),JSON[_0xfd95('0x20')](_0x4fc3d9));});}};}function handleError(){return function(_0x5ed471){return logger[_0xfd95('0x26')](JSON[_0xfd95('0x20')](_0x5ed471));};}function handleResult(_0x22a379){return function(_0x2fa9a5){logger[_0xfd95('0xa')](_0xfd95('0x27'),JSON[_0xfd95('0x20')](_0x2fa9a5));if(_0x22a379[_0xfd95('0xd')]&&_0x22a379[_0xfd95('0xd')][_0xfd95('0x10')]&&!_[_0xfd95('0x28')](_0x22a379[_0xfd95('0xc')])){setTimeout(handleSendEmail(_0x22a379,_0x2fa9a5),0x3c*0x3e8);}};}function handleJob(_0x42d466){return function(){try{if(_['isNil'](_0x42d466[_0xfd95('0x29')])){return logger[_0xfd95('0xa')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0xfd95('0x28')](_0x42d466[_0xfd95('0x2a')])){return logger[_0xfd95('0xa')](_0xfd95('0x2b'));}var _0x1d0751={'startDate':moment()[_0xfd95('0x2c')](_0x42d466[_0xfd95('0x29')],_0x42d466['subtractUnit'])[_0xfd95('0x13')](_0xfd95('0x2d')),'endDate':moment()['format'](_0xfd95('0x2d')),'type':_0xfd95('0x2e'),'output':_0x42d466[_0xfd95('0x2f')],'name':_0x42d466[_0xfd95('0x30')]};if(!_['isNil'](_0x42d466[_0xfd95('0x31')])){logger[_0xfd95('0xa')](_0xfd95('0x32'),_0x42d466[_0xfd95('0x31')]);return analyticDefaultReportController[_0xfd95('0x33')]({'id':_0x42d466['DefaultReportId']},_0x1d0751)['then'](handleResult(_0x42d466))[_0xfd95('0x25')](handleError());}if(!_[_0xfd95('0x28')](_0x42d466['CustomReportId'])){logger[_0xfd95('0xa')](_0xfd95('0x34'),_0x42d466['CustomReportId']);return analyticCustomReportController[_0xfd95('0x33')]({'id':_0x42d466['CustomReportId']},_0x1d0751)[_0xfd95('0x35')](handleResult(_0x42d466))['catch'](handleError());}}catch(_0x5c9b72){logger[_0xfd95('0x26')](JSON[_0xfd95('0x20')](_0x5c9b72));}return logger[_0xfd95('0xa')](_0xfd95('0x36'));};}function getJobs(_0x572fcc){var _0x178ea8={};if(_0x572fcc){_0x178ea8['id']=_0x572fcc;}return db['Schedule'][_0xfd95('0x37')]({'where':_0x178ea8,'include':[{'model':db[_0xfd95('0xd')],'attributes':['id','name',_0xfd95('0xc')],'include':[{'model':db[_0xfd95('0x38')],'as':_0xfd95('0x10'),'include':[{'model':db[_0xfd95('0x39')],'as':_0xfd95('0x39')}]}]}]})[_0xfd95('0x35')](function(_0x3d31c5){var _0x59ad7e=_[_0xfd95('0x3a')](manager[_0xfd95('0x3b')]);var _0x24248e=_['map'](_0x3d31c5,function(_0x151b49){return _0x151b49['id']['toString']();});var _0x4442f5=_[_0xfd95('0x3c')](_0x3d31c5,function(_0x33e292){return _0x33e292['id'][_0xfd95('0x3d')]();});var _0x4731c9=_0x572fcc?_0x24248e:_[_0xfd95('0x3e')](_0x24248e,_0x59ad7e);var _0x1c64bd=_[_0xfd95('0x3f')](_0x24248e,_0x59ad7e);var _0x526aba=_['difference'](_0x59ad7e,_0x24248e);var _0x3ede04;var _0x12fac5;for(_0x3ede04=0x0;_0x3ede04<_0x526aba[_0xfd95('0x40')]&&!_0x572fcc;_0x3ede04+=0x1){_0x12fac5=_0x526aba[_0x3ede04][_0xfd95('0x3d')]();if(manager['exists'](_0x12fac5)){manager[_0xfd95('0x41')](_0x12fac5);manager[_0xfd95('0x42')](_0x12fac5);logger['info'](_0xfd95('0x43'),_0x12fac5);}}logger[_0xfd95('0xa')](_0xfd95('0x44'),JSON['stringify'](_0x4731c9));for(_0x3ede04=0x0;_0x3ede04<_0x4731c9[_0xfd95('0x40')];_0x3ede04+=0x1){_0x12fac5=_0x4731c9[_0x3ede04][_0xfd95('0x3d')]();logger[_0xfd95('0xa')]('index',_0x12fac5);if(_0x572fcc){logger[_0xfd95('0xa')](_0xfd95('0x45'),_0x572fcc);logger[_0xfd95('0xa')](JSON[_0xfd95('0x20')](_0x4442f5[_0x12fac5]));BPromise[_0xfd95('0x46')]()[_0xfd95('0x35')](handleJob(_0x4442f5[_0x12fac5]));logger[_0xfd95('0xa')](_0xfd95('0x47'),_0x4442f5[_0x12fac5][_0xfd95('0x30')],_0x4442f5[_0x12fac5][_0xfd95('0x48')]);}else if(_0x4442f5[_0x12fac5][_0xfd95('0x48')]&&_0x4442f5[_0x12fac5][_0xfd95('0x49')]&&moment()[_0xfd95('0x4a')](_0x4442f5[_0x12fac5][_0xfd95('0x4b')],_0x4442f5[_0x12fac5]['endAt'])){manager['add'](_0x12fac5,_0x4442f5[_0x12fac5][_0xfd95('0x48')],handleJob(_0x4442f5[_0x12fac5]));manager[_0xfd95('0x4c')](_0x12fac5);logger[_0xfd95('0xa')](_0xfd95('0x4d'),_0x4442f5[_0x12fac5][_0xfd95('0x30')],_0x4442f5[_0x12fac5][_0xfd95('0x48')]);}else if(manager['exists'](_0x12fac5)){manager['stop'](_0x12fac5);manager[_0xfd95('0x42')](_0x12fac5);logger[_0xfd95('0xa')](_0xfd95('0x4e'),_0x4442f5[_0x12fac5][_0xfd95('0x30')],_0x4442f5[_0x12fac5][_0xfd95('0x48')]);}}for(_0x3ede04=0x0,_0x12fac5;_0x3ede04<_0x1c64bd[_0xfd95('0x40')]&&!_0x572fcc;_0x3ede04+=0x1){_0x12fac5=_0x1c64bd[_0x3ede04][_0xfd95('0x3d')]();if(manager['exists'](_0x12fac5)){if(_0x4442f5[_0x12fac5][_0xfd95('0x48')]&&_0x4442f5[_0x12fac5]['active']&&moment()[_0xfd95('0x4a')](_0x4442f5[_0x12fac5]['startAt'],_0x4442f5[_0x12fac5][_0xfd95('0x4f')])){manager[_0xfd95('0x50')](_0x12fac5,_0x4442f5[_0x12fac5]['cron'],handleJob(_0x4442f5[_0x12fac5]));logger['info'](_0xfd95('0x51'),_0x4442f5[_0x12fac5]['name'],_0x4442f5[_0x12fac5]['cron']);}else{manager['stop'](_0x12fac5);manager['deleteJob'](_0x12fac5);logger[_0xfd95('0xa')]('stop\x20cron',_0x4442f5[_0x12fac5][_0xfd95('0x30')],_0x4442f5[_0x12fac5][_0xfd95('0x48')]);}}}})[_0xfd95('0x25')](function(_0x3066e6){logger[_0xfd95('0x26')](JSON['stringify'](_0x3066e6));});}exports[_0xfd95('0x52')]=function(_0x4948b4){return getJobs(_0x4948b4);};exports[_0xfd95('0x4c')]=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 45cd5fb..3a50a14 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 _0x263f=['data1','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Negative','Mixed','FAILED','FailureReason','resolve','tempSentiment','CloudProvider','Cloud\x20Provider\x20not\x20configured','COMPLETED','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','Transcribe\x20not\x20configured','transcribeAccountId','forEach','push','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','transcribe','TranscribeService','getTranscriptionJob','detectSentiment','info','format','transcribeName','data2','transcribeRegion','then','TranscriptionJob','TranscriptionJobStatus','fileText','Transcript','[RECORDING:%d]\x20Get\x20transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','language','bucket','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','findOne','Cloud\x20Provider\x20not\x20available'];(function(_0x4646e9,_0x5894da){var _0x45f945=function(_0x2cab37){while(--_0x2cab37){_0x4646e9['push'](_0x4646e9['shift']());}};_0x45f945(++_0x5894da);}(_0x263f,0x182));var _0xf263=function(_0x1d7beb,_0x1b5d4d){_0x1d7beb=_0x1d7beb-0x0;var _0x459c48=_0x263f[_0x1d7beb];return _0x459c48;};var _=require(_0xf263('0x0'));var AWS=require(_0xf263('0x1'));var rp=require(_0xf263('0x2'));var util=require(_0xf263('0x3'));var BPromise=require(_0xf263('0x4'));var db=require(_0xf263('0x5'))['db'];var logger=require('../../config/logger')(_0xf263('0x6'));function getTranscriptionJob(_0x3c76e4,_0x453b6e,_0x528b98,_0xbd1369){return new Promise(function(_0xdb2fc1,_0x4c7ab2){var _0x4fded6=new AWS[(_0xf263('0x7'))]({'accessKeyId':_0x453b6e,'secretAccessKey':_0x3c76e4,'region':_0x528b98});_0x4fded6[_0xf263('0x8')]({'TranscriptionJobName':_0xbd1369},function(_0xa2e77e,_0x16ff53){if(_0xa2e77e){return _0x4c7ab2(_0xa2e77e);}else{return _0xdb2fc1(_0x16ff53);}});});}function sentiment(_0x5dcaa0,_0x3bde50,_0x26504c,_0x3d8092,_0x34c634){return new Promise(function(_0xb9fb31,_0x4fc090){var _0x1e9057=new AWS['Comprehend']({'accessKeyId':_0x3bde50,'secretAccessKey':_0x5dcaa0,'region':_0x26504c});_0x1e9057[_0xf263('0x9')]({'Text':_0x3d8092,'LanguageCode':_0x34c634['substring'](0x0,0x2)},function(_0x254c66,_0x5cf56d){if(_0x254c66){return _0x4fc090(_0x254c66);}else{return _0xb9fb31(_0x5cf56d);}});});}function checkTranscribeJob(_0x5e46a6,_0x2fc9f0,_0x2b1145){var _0x17471d;return new BPromise(function(_0xd7a907,_0x1037a4){logger[_0xf263('0xa')](util[_0xf263('0xb')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x5e46a6['id'],_0x5e46a6[_0xf263('0xc')]));return getTranscriptionJob(_0x2b1145['data1'],_0x2b1145[_0xf263('0xd')],_0x2fc9f0[_0xf263('0xe')],_0x5e46a6[_0xf263('0xc')])[_0xf263('0xf')](function(_0x16b4dd){logger[_0xf263('0xa')](util[_0xf263('0xb')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x5e46a6['id'],_0x5e46a6['transcribeName'],_0x16b4dd[_0xf263('0x10')][_0xf263('0x11')]));if(!_0x5e46a6[_0xf263('0x12')]){switch(_0x16b4dd[_0xf263('0x10')][_0xf263('0x11')]){case'COMPLETED':var _0x1adb66={'transcribeStatus':_0x16b4dd['TranscriptionJob'][_0xf263('0x11')],'fileUri':_0x16b4dd[_0xf263('0x10')][_0xf263('0x13')]['TranscriptFileUri']};logger[_0xf263('0xa')](util[_0xf263('0xb')](_0xf263('0x14'),_0x5e46a6['id']));return rp({'uri':_0x16b4dd['TranscriptionJob'][_0xf263('0x13')][_0xf263('0x15')],'json':!![]})[_0xf263('0xf')](function(_0x426667){logger[_0xf263('0xa')](util[_0xf263('0xb')](_0xf263('0x16'),_0x5e46a6['id']));if(_0x426667&&_0x426667[_0xf263('0x17')]&&_0x426667[_0xf263('0x17')][_0xf263('0x18')]&&_0x426667[_0xf263('0x17')]['transcripts']['length']){_0x1adb66['fileText']='';for(var _0x2de7aa=0x0;_0x2de7aa<_0x426667[_0xf263('0x17')][_0xf263('0x18')][_0xf263('0x19')];_0x2de7aa++){_0x1adb66[_0xf263('0x12')]+=_0x426667[_0xf263('0x17')][_0xf263('0x18')][_0x2de7aa][_0xf263('0x1a')]+'';}}return _0x5e46a6[_0xf263('0x1b')](_0x1adb66);})[_0xf263('0xf')](function(){logger[_0xf263('0xa')](util['format'](_0xf263('0x1c'),_0x5e46a6['id']));if(!_0x5e46a6['tempSentiment']){throw new db[(_0xf263('0x1d'))]['ValidationError'](_0xf263('0x1e'));}if(!_0x2fc9f0[_0xf263('0x1f')]||!_0x2fc9f0['sentimentAccountId']||!_0x2fc9f0['sentimentRegion']||!_0x2fc9f0[_0xf263('0x20')]||!_0x2fc9f0[_0xf263('0x21')]){throw new db[(_0xf263('0x1d'))][(_0xf263('0x22'))](_0xf263('0x23'));}if(!_0x1adb66[_0xf263('0x12')]){throw new Error(_0xf263('0x24'));}if(_0x2fc9f0[_0xf263('0x25')]===_0x2b1145['id']){return _0x2b1145;}else{return db['CloudProvider'][_0xf263('0x26')]({'where':{'id':_settings[_0xf263('0x25')]}});}})[_0xf263('0xf')](function(_0x43d78e){if(!_0x43d78e){throw new db[(_0xf263('0x1d'))][(_0xf263('0x22'))](_0xf263('0x27'));}if(!_0x43d78e[_0xf263('0x28')]||!_0x43d78e[_0xf263('0xd')]){throw new db['Sequelize'][(_0xf263('0x22'))]('Cloud\x20Provider\x20not\x20configured');}_0x17471d=_0x43d78e;logger['info'](util[_0xf263('0xb')](_0xf263('0x29'),_0x5e46a6['id']));return sentiment(_0x17471d['data1'],_0x17471d[_0xf263('0xd')],_0x2fc9f0[_0xf263('0x2a')],_0x1adb66['fileText'],_0x2fc9f0[_0xf263('0x20')]);})[_0xf263('0xf')](function(_0x37a475){logger[_0xf263('0xa')](util[_0xf263('0xb')](_0xf263('0x2b'),_0x5e46a6['id']));return _0x5e46a6['update']({'sentiment':_0x37a475[_0xf263('0x2c')],'sPositive':_0x37a475[_0xf263('0x2d')]['Positive'],'sNegative':_0x37a475['SentimentScore'][_0xf263('0x2e')],'sMixed':_0x37a475[_0xf263('0x2d')][_0xf263('0x2f')],'sNeutral':_0x37a475[_0xf263('0x2d')]['Neutral']});})[_0xf263('0xf')](function(){logger[_0xf263('0xa')](util[_0xf263('0xb')](_0xf263('0x1c'),_0x5e46a6['id']));_0xd7a907();});case _0xf263('0x30'):return _0x5e46a6['update']({'transcribeStatus':_0xf263('0x30'),'failureReason':_0x16b4dd[_0xf263('0x10')][_0xf263('0x31')]})['then'](function(){logger[_0xf263('0xa')](util[_0xf263('0xb')](_0xf263('0x1c'),_0x5e46a6['id']));_0xd7a907();});default:logger[_0xf263('0xa')](util[_0xf263('0xb')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x5e46a6['id']));break;}}else{return BPromise[_0xf263('0x32')]()[_0xf263('0xf')](function(){if(!_0x5e46a6[_0xf263('0x33')]){throw new db['Sequelize'][(_0xf263('0x22'))](_0xf263('0x1e'));}if(!_0x2fc9f0[_0xf263('0x1f')]||!_0x2fc9f0['sentimentAccountId']||!_0x2fc9f0[_0xf263('0x2a')]||!_0x2fc9f0['language']||!_0x2fc9f0[_0xf263('0x21')]){throw new db[(_0xf263('0x1d'))][(_0xf263('0x22'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x5e46a6['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x2fc9f0[_0xf263('0x25')]===_0x2b1145['id']){return _0x2b1145;}else{return db[_0xf263('0x34')]['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})[_0xf263('0xf')](function(_0x1e1dbf){if(!_0x1e1dbf){throw new db[(_0xf263('0x1d'))][(_0xf263('0x22'))](_0xf263('0x27'));}if(!_0x1e1dbf['data1']||!_0x1e1dbf[_0xf263('0xd')]){throw new db[(_0xf263('0x1d'))][(_0xf263('0x22'))](_0xf263('0x35'));}_0x17471d=_0x1e1dbf;logger[_0xf263('0xa')](util['format'](_0xf263('0x29'),_0x5e46a6['id']));return sentiment(_0x17471d[_0xf263('0x28')],_0x17471d[_0xf263('0xd')],_0x2fc9f0['sentimentRegion'],_0x5e46a6['fileText'],_0x2fc9f0[_0xf263('0x20')]);})['then'](function(_0x4c7283){logger[_0xf263('0xa')](util[_0xf263('0xb')](_0xf263('0x2b'),_0x5e46a6['id']));return _0x5e46a6['update']({'sentiment':_0x4c7283[_0xf263('0x2c')],'sPositive':_0x4c7283[_0xf263('0x2d')]['Positive'],'sNegative':_0x4c7283[_0xf263('0x2d')][_0xf263('0x2e')],'sMixed':_0x4c7283['SentimentScore'][_0xf263('0x2f')],'sNeutral':_0x4c7283[_0xf263('0x2d')]['Neutral'],'transcribeStatus':_0xf263('0x36')});})[_0xf263('0xf')](function(){logger[_0xf263('0xa')](util[_0xf263('0xb')](_0xf263('0x1c'),_0x5e46a6['id']));_0xd7a907();});}})[_0xf263('0x37')](function(_0xd5f916){if(_0xd5f916){if(!_0xd5f916['name']||_0xd5f916[_0xf263('0x38')]!==_0xf263('0x39')){logger[_0xf263('0x3a')](util[_0xf263('0xb')](_0xf263('0x3b'),_0x5e46a6['id']),util[_0xf263('0x3c')](_0xd5f916,{'showHidden':![],'depth':null}));}}_0xd7a907();});});}function checkTranscribe(){var _0x24da59;var _0x1505a9;var _0x5da8ba;return db[_0xf263('0x3d')][_0xf263('0x3e')]({'where':{'transcribeStatus':_0xf263('0x3f')}})[_0xf263('0xf')](function(_0x54ddf8){if(!_0x54ddf8||!_0x54ddf8[_0xf263('0x19')]){throw new db['Sequelize'][(_0xf263('0x22'))](_0xf263('0x40'));}_0x24da59=_0x54ddf8;return db[_0xf263('0x41')]['findOne']({'where':{'id':0x1}});})['then'](function(_0x5b5585){if(!_0x5b5585){throw new db['Sequelize']['ValidationError'](_0xf263('0x42'));}_0x1505a9=_0x5b5585;if(!_0x1505a9[_0xf263('0x6')]||!_0x1505a9['transcribeAccountId']||!_0x1505a9[_0xf263('0xe')]||!_0x1505a9[_0xf263('0x20')]||!_0x1505a9[_0xf263('0x21')]){throw new db[(_0xf263('0x1d'))][(_0xf263('0x22'))](_0xf263('0x43'));}return db[_0xf263('0x34')][_0xf263('0x26')]({'where':{'id':_0x1505a9[_0xf263('0x44')]}});})[_0xf263('0xf')](function(_0x12c84f){if(!_0x12c84f){throw new db[(_0xf263('0x1d'))]['ValidationError'](_0xf263('0x27'));}if(!_0x12c84f['data1']||!_0x12c84f['data2']){throw new db[(_0xf263('0x1d'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x5da8ba=_0x12c84f;var _0x382460=[];_0x24da59[_0xf263('0x45')](function(_0x499859){_0x382460[_0xf263('0x46')](checkTranscribeJob(_0x499859,_0x1505a9,_0x5da8ba));});return BPromise['all'](_0x382460);})[_0xf263('0x37')](function(_0x2c4b20){if(_0x2c4b20){if(!_0x2c4b20['name']||_0x2c4b20[_0xf263('0x38')]!==_0xf263('0x39')){logger['error'](util[_0xf263('0x3c')](_0x2c4b20,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x0f42=['No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','Transcribe\x20not\x20configured','transcribeAccountId','forEach','all','name','SequelizeValidationError','start','lodash','aws-sdk','request-promise','util','../../mysqldb','transcribe','getTranscriptionJob','Comprehend','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','fileText','TranscriptionJob','COMPLETED','Transcript','TranscriptFileUri','then','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Sentiment','Negative','SentimentScore','Mixed','FAILED','FailureReason','resolve','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Positive','Neutral','catch','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll'];(function(_0x2ae3e5,_0x299328){var _0x32e028=function(_0x19265b){while(--_0x19265b){_0x2ae3e5['push'](_0x2ae3e5['shift']());}};_0x32e028(++_0x299328);}(_0x0f42,0x126));var _0x20f4=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x0f42[_0x21a9d9];return _0x46adce;};var _=require(_0x20f4('0x0'));var AWS=require(_0x20f4('0x1'));var rp=require(_0x20f4('0x2'));var util=require(_0x20f4('0x3'));var BPromise=require('bluebird');var db=require(_0x20f4('0x4'))['db'];var logger=require('../../config/logger')(_0x20f4('0x5'));function getTranscriptionJob(_0x4a2add,_0x1b1f1a,_0x30ee00,_0x42d4d9){return new Promise(function(_0x4c3214,_0x435359){var _0x1519fe=new AWS['TranscribeService']({'accessKeyId':_0x1b1f1a,'secretAccessKey':_0x4a2add,'region':_0x30ee00});_0x1519fe[_0x20f4('0x6')]({'TranscriptionJobName':_0x42d4d9},function(_0x553d5d,_0x4a452d){if(_0x553d5d){return _0x435359(_0x553d5d);}else{return _0x4c3214(_0x4a452d);}});});}function sentiment(_0x4a9fd1,_0x1f42a2,_0x4f3d95,_0x41c1bb,_0x30f2ef){return new Promise(function(_0x395fda,_0x1ee8c6){var _0x51ab58=new AWS[(_0x20f4('0x7'))]({'accessKeyId':_0x1f42a2,'secretAccessKey':_0x4a9fd1,'region':_0x4f3d95});_0x51ab58['detectSentiment']({'Text':_0x41c1bb,'LanguageCode':_0x30f2ef[_0x20f4('0x8')](0x0,0x2)},function(_0x3002b3,_0x2fce02){if(_0x3002b3){return _0x1ee8c6(_0x3002b3);}else{return _0x395fda(_0x2fce02);}});});}function checkTranscribeJob(_0x35be6e,_0x4b893b,_0x1135e7){var _0x122f9e;return new BPromise(function(_0x166e79,_0x45fb73){logger[_0x20f4('0x9')](util[_0x20f4('0xa')](_0x20f4('0xb'),_0x35be6e['id'],_0x35be6e[_0x20f4('0xc')]));return getTranscriptionJob(_0x1135e7[_0x20f4('0xd')],_0x1135e7[_0x20f4('0xe')],_0x4b893b[_0x20f4('0xf')],_0x35be6e['transcribeName'])['then'](function(_0x29ef31){logger[_0x20f4('0x9')](util[_0x20f4('0xa')](_0x20f4('0x10'),_0x35be6e['id'],_0x35be6e[_0x20f4('0xc')],_0x29ef31['TranscriptionJob'][_0x20f4('0x11')]));if(!_0x35be6e[_0x20f4('0x12')]){switch(_0x29ef31[_0x20f4('0x13')]['TranscriptionJobStatus']){case _0x20f4('0x14'):var _0xd8de3b={'transcribeStatus':_0x29ef31[_0x20f4('0x13')]['TranscriptionJobStatus'],'fileUri':_0x29ef31['TranscriptionJob'][_0x20f4('0x15')]['TranscriptFileUri']};logger['info'](util[_0x20f4('0xa')]('[RECORDING:%d]\x20Get\x20transcript',_0x35be6e['id']));return rp({'uri':_0x29ef31[_0x20f4('0x13')][_0x20f4('0x15')][_0x20f4('0x16')],'json':!![]})[_0x20f4('0x17')](function(_0x214bf2){logger[_0x20f4('0x9')](util['format'](_0x20f4('0x18'),_0x35be6e['id']));if(_0x214bf2&&_0x214bf2[_0x20f4('0x19')]&&_0x214bf2[_0x20f4('0x19')][_0x20f4('0x1a')]&&_0x214bf2[_0x20f4('0x19')]['transcripts']['length']){_0xd8de3b[_0x20f4('0x12')]='';for(var _0x328bb8=0x0;_0x328bb8<_0x214bf2['results'][_0x20f4('0x1a')][_0x20f4('0x1b')];_0x328bb8++){_0xd8de3b['fileText']+=_0x214bf2[_0x20f4('0x19')][_0x20f4('0x1a')][_0x328bb8]['transcript']+'';}}return _0x35be6e[_0x20f4('0x1c')](_0xd8de3b);})[_0x20f4('0x17')](function(){logger[_0x20f4('0x9')](util[_0x20f4('0xa')](_0x20f4('0x1d'),_0x35be6e['id']));if(!_0x35be6e[_0x20f4('0x1e')]){throw new db[(_0x20f4('0x1f'))][(_0x20f4('0x20'))](_0x20f4('0x21'));}if(!_0x4b893b[_0x20f4('0x22')]||!_0x4b893b[_0x20f4('0x23')]||!_0x4b893b[_0x20f4('0x24')]||!_0x4b893b[_0x20f4('0x25')]||!_0x4b893b[_0x20f4('0x26')]){throw new db[(_0x20f4('0x1f'))][(_0x20f4('0x20'))](_0x20f4('0x27'));}if(!_0xd8de3b['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x4b893b['sentimentAccountId']===_0x1135e7['id']){return _0x1135e7;}else{return db[_0x20f4('0x28')][_0x20f4('0x29')]({'where':{'id':_settings[_0x20f4('0x23')]}});}})['then'](function(_0x5d95f3){if(!_0x5d95f3){throw new db[(_0x20f4('0x1f'))][(_0x20f4('0x20'))](_0x20f4('0x2a'));}if(!_0x5d95f3[_0x20f4('0xd')]||!_0x5d95f3['data2']){throw new db[(_0x20f4('0x1f'))]['ValidationError'](_0x20f4('0x2b'));}_0x122f9e=_0x5d95f3;logger[_0x20f4('0x9')](util[_0x20f4('0xa')](_0x20f4('0x2c'),_0x35be6e['id']));return sentiment(_0x122f9e[_0x20f4('0xd')],_0x122f9e[_0x20f4('0xe')],_0x4b893b[_0x20f4('0x24')],_0xd8de3b[_0x20f4('0x12')],_0x4b893b[_0x20f4('0x25')]);})['then'](function(_0x176e21){logger[_0x20f4('0x9')](util[_0x20f4('0xa')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x35be6e['id']));return _0x35be6e['update']({'sentiment':_0x176e21[_0x20f4('0x2d')],'sPositive':_0x176e21['SentimentScore']['Positive'],'sNegative':_0x176e21['SentimentScore'][_0x20f4('0x2e')],'sMixed':_0x176e21[_0x20f4('0x2f')][_0x20f4('0x30')],'sNeutral':_0x176e21[_0x20f4('0x2f')]['Neutral']});})['then'](function(){logger[_0x20f4('0x9')](util[_0x20f4('0xa')](_0x20f4('0x1d'),_0x35be6e['id']));_0x166e79();});case'FAILED':return _0x35be6e[_0x20f4('0x1c')]({'transcribeStatus':_0x20f4('0x31'),'failureReason':_0x29ef31[_0x20f4('0x13')][_0x20f4('0x32')]})[_0x20f4('0x17')](function(){logger[_0x20f4('0x9')](util[_0x20f4('0xa')](_0x20f4('0x1d'),_0x35be6e['id']));_0x166e79();});default:logger[_0x20f4('0x9')](util[_0x20f4('0xa')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x35be6e['id']));break;}}else{return BPromise[_0x20f4('0x33')]()[_0x20f4('0x17')](function(){if(!_0x35be6e[_0x20f4('0x1e')]){throw new db[(_0x20f4('0x1f'))]['ValidationError'](_0x20f4('0x21'));}if(!_0x4b893b[_0x20f4('0x22')]||!_0x4b893b['sentimentAccountId']||!_0x4b893b[_0x20f4('0x24')]||!_0x4b893b[_0x20f4('0x25')]||!_0x4b893b[_0x20f4('0x26')]){throw new db['Sequelize'][(_0x20f4('0x20'))](_0x20f4('0x27'));}if(!_0x35be6e[_0x20f4('0x12')]){throw new Error('Transcript\x20not\x20available');}if(_0x4b893b[_0x20f4('0x23')]===_0x1135e7['id']){return _0x1135e7;}else{return db[_0x20f4('0x28')][_0x20f4('0x29')]({'where':{'id':_settings[_0x20f4('0x23')]}});}})[_0x20f4('0x17')](function(_0x4bee91){if(!_0x4bee91){throw new db[(_0x20f4('0x1f'))][(_0x20f4('0x20'))](_0x20f4('0x2a'));}if(!_0x4bee91['data1']||!_0x4bee91[_0x20f4('0xe')]){throw new db['Sequelize'][(_0x20f4('0x20'))](_0x20f4('0x2b'));}_0x122f9e=_0x4bee91;logger['info'](util['format'](_0x20f4('0x2c'),_0x35be6e['id']));return sentiment(_0x122f9e['data1'],_0x122f9e[_0x20f4('0xe')],_0x4b893b[_0x20f4('0x24')],_0x35be6e[_0x20f4('0x12')],_0x4b893b[_0x20f4('0x25')]);})['then'](function(_0x1fc9c5){logger[_0x20f4('0x9')](util[_0x20f4('0xa')](_0x20f4('0x34'),_0x35be6e['id']));return _0x35be6e[_0x20f4('0x1c')]({'sentiment':_0x1fc9c5[_0x20f4('0x2d')],'sPositive':_0x1fc9c5['SentimentScore'][_0x20f4('0x35')],'sNegative':_0x1fc9c5[_0x20f4('0x2f')]['Negative'],'sMixed':_0x1fc9c5[_0x20f4('0x2f')]['Mixed'],'sNeutral':_0x1fc9c5[_0x20f4('0x2f')][_0x20f4('0x36')],'transcribeStatus':'COMPLETED'});})['then'](function(){logger[_0x20f4('0x9')](util[_0x20f4('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x35be6e['id']));_0x166e79();});}})[_0x20f4('0x37')](function(_0x568584){if(_0x568584){if(!_0x568584['name']||_0x568584['name']!=='SequelizeValidationError'){logger[_0x20f4('0x38')](util[_0x20f4('0xa')](_0x20f4('0x39'),_0x35be6e['id']),util[_0x20f4('0x3a')](_0x568584,{'showHidden':![],'depth':null}));}}_0x166e79();});});}function checkTranscribe(){var _0xc49c10;var _0x1e3f2c;var _0x3838db;return db[_0x20f4('0x3b')][_0x20f4('0x3c')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x20f4('0x17')](function(_0x20f1ad){if(!_0x20f1ad||!_0x20f1ad[_0x20f4('0x1b')]){throw new db[(_0x20f4('0x1f'))][(_0x20f4('0x20'))](_0x20f4('0x3d'));}_0xc49c10=_0x20f1ad;return db[_0x20f4('0x3e')][_0x20f4('0x29')]({'where':{'id':0x1}});})[_0x20f4('0x17')](function(_0x408d68){if(!_0x408d68){throw new db[(_0x20f4('0x1f'))][(_0x20f4('0x20'))](_0x20f4('0x3f'));}_0x1e3f2c=_0x408d68;if(!_0x1e3f2c[_0x20f4('0x5')]||!_0x1e3f2c['transcribeAccountId']||!_0x1e3f2c['transcribeRegion']||!_0x1e3f2c[_0x20f4('0x25')]||!_0x1e3f2c[_0x20f4('0x26')]){throw new db[(_0x20f4('0x1f'))][(_0x20f4('0x20'))](_0x20f4('0x40'));}return db[_0x20f4('0x28')][_0x20f4('0x29')]({'where':{'id':_0x1e3f2c[_0x20f4('0x41')]}});})['then'](function(_0x375460){if(!_0x375460){throw new db[(_0x20f4('0x1f'))][(_0x20f4('0x20'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x375460['data1']||!_0x375460[_0x20f4('0xe')]){throw new db[(_0x20f4('0x1f'))][(_0x20f4('0x20'))](_0x20f4('0x2b'));}_0x3838db=_0x375460;var _0x20b38b=[];_0xc49c10[_0x20f4('0x42')](function(_0x2ad2aa){_0x20b38b['push'](checkTranscribeJob(_0x2ad2aa,_0x1e3f2c,_0x3838db));});return BPromise[_0x20f4('0x43')](_0x20b38b);})['catch'](function(_0x13df74){if(_0x13df74){if(!_0x13df74['name']||_0x13df74[_0x20f4('0x44')]!==_0x20f4('0x45')){logger[_0x20f4('0x38')](util[_0x20f4('0x3a')](_0x13df74,{'showHidden':![],'depth':null}));}}});}exports[_0x20f4('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 d8ab691..6b5859d 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 _0x4d20=['map','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis','util','../logger','schedule','redis','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','then','length'];(function(_0x3d8ca8,_0x1a9764){var _0x517e45=function(_0x641ad9){while(--_0x641ad9){_0x3d8ca8['push'](_0x3d8ca8['shift']());}};_0x517e45(++_0x1a9764);}(_0x4d20,0x187));var _0x04d2=function(_0x4a0d75,_0x7e8760){_0x4a0d75=_0x4a0d75-0x0;var _0x53477e=_0x4d20[_0x4a0d75];return _0x53477e;};'use strict';var _=require(_0x04d2('0x0'));var moment=require(_0x04d2('0x1'));var Redis=require(_0x04d2('0x2'));var util=require(_0x04d2('0x3'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require(_0x04d2('0x4'))(_0x04d2('0x5'));config[_0x04d2('0x6')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x04d2('0x7'))(new Redis(config[_0x04d2('0x6')]));function closeInteractions(){var _0x3d63e5=[];return db[_0x04d2('0x8')][_0x04d2('0x9')]({'raw':!![],'attributes':['id',_0x04d2('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x04d2('0xb')](0x18,'hours')}}})[_0x04d2('0xc')](function(_0x29b882){if(_0x29b882&&_0x29b882[_0x04d2('0xd')]){_0x3d63e5=_[_0x04d2('0xe')](_0x29b882||[],'id');logger['info'](_0x04d2('0xf'),_0x3d63e5[_0x04d2('0x10')]());return db[_0x04d2('0x8')][_0x04d2('0x11')]({'closeReason':_0x04d2('0x12'),'disposition':_0x04d2('0x13'),'closed':!![],'closedAt':moment()[_0x04d2('0x14')](_0x04d2('0x15'))},{'where':{'id':_0x3d63e5}});}})[_0x04d2('0xc')](function(){if(_0x3d63e5&&_0x3d63e5[_0x04d2('0xd')]){logger[_0x04d2('0x16')](_0x04d2('0x17'),_0x3d63e5[_0x04d2('0x10')]());for(var _0x300af2=0x0;_0x300af2<_0x3d63e5[_0x04d2('0xd')];_0x300af2++){io['emit']('whatsappInteraction:update',{'id':_0x3d63e5[_0x300af2],'closed':!![]});}}})[_0x04d2('0x18')](function(_0x5b0f2a){logger['error'](_0x04d2('0x19'),_0x5b0f2a?util[_0x04d2('0x1a')](_0x5b0f2a,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xe37f=['[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','ioredis','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','then','length','map','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error'];(function(_0x11fb47,_0x50fbf8){var _0xa0d270=function(_0x2d6c3e){while(--_0x2d6c3e){_0x11fb47['push'](_0x11fb47['shift']());}};_0xa0d270(++_0x50fbf8);}(_0xe37f,0x9e));var _0xfe37=function(_0x10d0f0,_0x1eba3d){_0x10d0f0=_0x10d0f0-0x0;var _0x93e308=_0xe37f[_0x10d0f0];return _0x93e308;};'use strict';var _=require(_0xfe37('0x0'));var moment=require('moment');var Redis=require(_0xfe37('0x1'));var util=require('util');var config=require('../../config/environment');var db=require(_0xfe37('0x2'))['db'];var logger=require(_0xfe37('0x3'))(_0xfe37('0x4'));config[_0xfe37('0x5')]=_[_0xfe37('0x6')](config[_0xfe37('0x5')],{'host':_0xfe37('0x7'),'port':0x18eb});var io=require(_0xfe37('0x8'))(new Redis(config['redis']));function closeInteractions(){var _0x14b09a=[];return db[_0xfe37('0x9')][_0xfe37('0xa')]({'raw':!![],'attributes':['id',_0xfe37('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xfe37('0xc')](0x18,'hours')}}})[_0xfe37('0xd')](function(_0x1e676e){if(_0x1e676e&&_0x1e676e[_0xfe37('0xe')]){_0x14b09a=_[_0xfe37('0xf')](_0x1e676e||[],'id');logger['info'](_0xfe37('0x10'),_0x14b09a[_0xfe37('0x11')]());return db[_0xfe37('0x9')][_0xfe37('0x12')]({'closeReason':_0xfe37('0x13'),'disposition':_0xfe37('0x14'),'closed':!![],'closedAt':moment()['format'](_0xfe37('0x15'))},{'where':{'id':_0x14b09a}});}})[_0xfe37('0xd')](function(){if(_0x14b09a&&_0x14b09a[_0xfe37('0xe')]){logger[_0xfe37('0x16')](_0xfe37('0x17'),_0x14b09a[_0xfe37('0x11')]());for(var _0x50b4c4=0x0;_0x50b4c4<_0x14b09a[_0xfe37('0xe')];_0x50b4c4++){io[_0xfe37('0x18')](_0xfe37('0x19'),{'id':_0x14b09a[_0x50b4c4],'closed':!![]});}}})[_0xfe37('0x1a')](function(_0xcd222f){logger[_0xfe37('0x1b')](_0xfe37('0x1c'),_0xcd222f?util[_0xfe37('0x1d')](_0xcd222f,{'showHidden':![],'depth':null}):'');});}exports[_0xfe37('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 ecfe450..4c0ae56 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x860e=['now','destroy','then','CmContact','bulkCreate','finished\x20populating','contacts1','CmHopper','log','hopper1','contacts2','hopper2','catch','util','../mysqldb','push','Biondo','innocenzo.biondo','@xcally.com'];(function(_0x396a54,_0x1d0f41){var _0x4130dd=function(_0x337a6d){while(--_0x337a6d){_0x396a54['push'](_0x396a54['shift']());}};_0x4130dd(++_0x1d0f41);}(_0x860e,0x12a));var _0xe860=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x860e[_0x334841];return _0x5beb4b;};'use strict';var util=require(_0xe860('0x0'));var db=require(_0xe860('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xe860('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xe860('0x3')+i,'phone':0xf879fb460+i,'email':_0xe860('0x4')+i+_0xe860('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xe860('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xe860('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xe860('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xe860('0x4')+i+_0xe860('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xe860('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xe860('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xe860('0x6')]()});}db['CmContact'][_0xe860('0x7')]({'where':{}})[_0xe860('0x8')](function(){return db[_0xe860('0x9')][_0xe860('0xa')](contacts);})[_0xe860('0x8')](function(){console['log'](_0xe860('0xb'),_0xe860('0xc'));return db[_0xe860('0xd')]['destroy']({'where':{}});})[_0xe860('0x8')](function(){return db['CmHopper'][_0xe860('0xa')](hopper);})['then'](function(){console[_0xe860('0xe')](_0xe860('0xb'),_0xe860('0xf'));return db[_0xe860('0x9')][_0xe860('0xa')](contacts2);})[_0xe860('0x8')](function(){console[_0xe860('0xe')]('finished\x20populating',_0xe860('0x10'));return db['CmHopper'][_0xe860('0xa')](hopper2);})['then'](function(){console[_0xe860('0xe')](_0xe860('0xb'),_0xe860('0x11'));})[_0xe860('0x12')](function(_0x5054b0){console[_0xe860('0xe')](_0x5054b0);}); \ No newline at end of file +var _0x786f=['../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','now','@xcally.com','then','CmContact','bulkCreate','log','finished\x20populating','CmHopper','destroy','hopper1','contacts2','hopper2','catch','util'];(function(_0xae2431,_0x47d0ce){var _0x502482=function(_0x58e460){while(--_0x58e460){_0xae2431['push'](_0xae2431['shift']());}};_0x502482(++_0x47d0ce);}(_0x786f,0x1da));var _0xf786=function(_0x40f9a0,_0x3458cc){_0x40f9a0=_0x40f9a0-0x0;var _0x3e3144=_0x786f[_0x40f9a0];return _0x3e3144;};'use strict';var util=require(_0xf786('0x0'));var db=require(_0xf786('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xf786('0x2')]({'id':i,'firstName':_0xf786('0x3')+i,'lastName':_0xf786('0x4')+i,'phone':0xf879fb460+i,'email':_0xf786('0x5')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xf786('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xf786('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xf786('0x6')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xf786('0x2')]({'id':i,'firstName':_0xf786('0x3')+i,'lastName':_0xf786('0x4')+i,'phone':0xf879fb460+i,'email':_0xf786('0x5')+i+_0xf786('0x7')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xf786('0x2')]({'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[_0xf786('0x6')]()});}db['CmContact']['destroy']({'where':{}})[_0xf786('0x8')](function(){return db[_0xf786('0x9')][_0xf786('0xa')](contacts);})[_0xf786('0x8')](function(){console[_0xf786('0xb')](_0xf786('0xc'),'contacts1');return db[_0xf786('0xd')][_0xf786('0xe')]({'where':{}});})[_0xf786('0x8')](function(){return db['CmHopper'][_0xf786('0xa')](hopper);})['then'](function(){console['log'](_0xf786('0xc'),_0xf786('0xf'));return db['CmContact'][_0xf786('0xa')](contacts2);})[_0xf786('0x8')](function(){console[_0xf786('0xb')](_0xf786('0xc'),_0xf786('0x10'));return db[_0xf786('0xd')][_0xf786('0xa')](hopper2);})[_0xf786('0x8')](function(){console[_0xf786('0xb')](_0xf786('0xc'),_0xf786('0x11'));})[_0xf786('0x12')](function(_0x32bc52){console['log'](_0x32bc52);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 37ea3e9..9db6390 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8712=['ulaw','%s%s','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','bulkCreate','log','add\x20user','catch','../mysqldb','push','format','%s%s@xcally.com','agent','password','friend','wss'];(function(_0x3bbca7,_0xfd6f0){var _0xf16da4=function(_0x2de0a2){while(--_0x2de0a2){_0x3bbca7['push'](_0x3bbca7['shift']());}};_0xf16da4(++_0xfd6f0);}(_0x8712,0x161));var _0x2871=function(_0x4dc585,_0x13c7dd){_0x4dc585=_0x4dc585-0x0;var _0x302e39=_0x8712[_0x4dc585];return _0x302e39;};'use strict';var util=require('util');var db=require(_0x2871('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x2871('0x1')]({'name':util[_0x2871('0x2')]('%s%s','agent',i),'fullname':util[_0x2871('0x2')]('%s%s','agent',i),'email':util[_0x2871('0x2')](_0x2871('0x3'),'agent',i),'role':_0x2871('0x4'),'password':_0x2871('0x5'),'internal':0xfa0+i,'type':_0x2871('0x6'),'transport':['udp','ws',_0x2871('0x7')],'disallow':['all'],'allow':[_0x2871('0x8')],'defaultuser':util[_0x2871('0x2')](_0x2871('0x9'),_0x2871('0x4'),i),'encryption':_0x2871('0xa'),'avpf':_0x2871('0xa'),'force_avp':_0x2871('0xa'),'icesupport':_0x2871('0xa'),'dtlsenable':_0x2871('0xa'),'dtlsverify':'no','dtlscertfile':_0x2871('0xb'),'dtlsprivatekey':_0x2871('0xc'),'dtlssetup':_0x2871('0xd'),'callerid':util[_0x2871('0x2')](_0x2871('0xe'),util['format'](_0x2871('0x9'),_0x2871('0x4'),i),0xfa0+i)});}db['User'][_0x2871('0xf')](users)['then'](function(){console[_0x2871('0x10')](_0x2871('0x11'));})[_0x2871('0x12')](function(_0x177568){console[_0x2871('0x10')](_0x177568);}); \ No newline at end of file +var _0x0bd9=['%s%s@xcally.com','udp','wss','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','format','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','util','push','%s%s','agent'];(function(_0x3353a9,_0x96bd0a){var _0x3b7cab=function(_0x712caa){while(--_0x712caa){_0x3353a9['push'](_0x3353a9['shift']());}};_0x3b7cab(++_0x96bd0a);}(_0x0bd9,0x1b4));var _0x90bd=function(_0x344a92,_0x586f5e){_0x344a92=_0x344a92-0x0;var _0x966d72=_0x0bd9[_0x344a92];return _0x966d72;};'use strict';var util=require(_0x90bd('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x90bd('0x1')]({'name':util['format'](_0x90bd('0x2'),_0x90bd('0x3'),i),'fullname':util['format']('%s%s',_0x90bd('0x3'),i),'email':util['format'](_0x90bd('0x4'),_0x90bd('0x3'),i),'role':_0x90bd('0x3'),'password':'password','internal':0xfa0+i,'type':'friend','transport':[_0x90bd('0x5'),'ws',_0x90bd('0x6')],'disallow':['all'],'allow':[_0x90bd('0x7')],'defaultuser':util['format'](_0x90bd('0x2'),_0x90bd('0x3'),i),'encryption':_0x90bd('0x8'),'avpf':_0x90bd('0x8'),'force_avp':'yes','icesupport':'yes','dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x90bd('0x9'),'dtlsprivatekey':_0x90bd('0xa'),'dtlssetup':_0x90bd('0xb'),'callerid':util[_0x90bd('0xc')](_0x90bd('0xd'),util[_0x90bd('0xc')](_0x90bd('0x2'),_0x90bd('0x3'),i),0xfa0+i)});}db[_0x90bd('0xe')][_0x90bd('0xf')](users)[_0x90bd('0x10')](function(){console[_0x90bd('0x11')](_0x90bd('0x12'));})[_0x90bd('0x13')](function(_0x4ebfbc){console[_0x90bd('0x11')](_0x4ebfbc);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index a095cfd..61c6d32 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa017=['DISCONNECTED','CONNECTED','lodash','util','bluebird','name','Agents','User','role','agent','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','FaxQueues','MailQueues','OpenchannelQueues','WhatsappQueues','Telephones','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','where','telephone','Campaign','ivr','format','%s:queue:%s','length','user:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','admin','voice:outbound','include','push','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','voice:inbound','ChatQueues','ChatQueue','SmsQueues','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getWhatsappQueues','chat','fax','sms','mail','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','type','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','map','FaxInteractions','removeFaxInteractions','removeSmsInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','log','join','default','connection','address','request','remoteAddress','connectedAt','SocketIO\x20','nsp','disconnect'];(function(_0x5a5c45,_0x5b1795){var _0x416b6=function(_0x5220d1){while(--_0x5220d1){_0x5a5c45['push'](_0x5a5c45['shift']());}};_0x416b6(++_0x5b1795);}(_0xa017,0x1f1));var _0x7a01=function(_0x3bdf48,_0x1979a2){_0x3bdf48=_0x3bdf48-0x0;var _0x8b4812=_0xa017[_0x3bdf48];return _0x8b4812;};'use strict';var _=require(_0x7a01('0x0'));var util=require(_0x7a01('0x1'));var BPromise=require(_0x7a01('0x2'));var db=require('../mysqldb')['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x7a01('0x3')],'include':[{'as':_0x7a01('0x4'),'model':db[_0x7a01('0x5')],'attributes':['id',_0x7a01('0x3'),_0x7a01('0x6')],'raw':!![],'where':{'role':_0x7a01('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x7a01('0x3')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x7a01('0x3')],'where':{'role':_0x7a01('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id','name','type'],'where':{'type':'ivr'}};function getAssociatedResources(_0x37010a,_0x5a11d8,_0x12fd3c){return db[_0x7a01('0x8')][_0x7a01('0x9')]({'where':{'name':_0x37010a,'userProfileId':_0x5a11d8},'raw':!![]})[_0x7a01('0xa')](function(_0x1cedf4){if(_0x1cedf4){if(_0x1cedf4[_0x7a01('0xb')]){switch(_0x37010a){case _0x7a01('0xc'):case'ChatQueues':case _0x7a01('0xd'):case'SmsQueues':case _0x7a01('0xe'):case _0x7a01('0xf'):case _0x7a01('0x10'):return db[_0x12fd3c]['findAll'](queryQueues);case _0x7a01('0x11'):return db[_0x12fd3c][_0x7a01('0x12')](queryTelephones);case _0x7a01('0x13'):return db[_0x12fd3c][_0x7a01('0x12')](queryTrunks);case _0x7a01('0x14'):return db[_0x12fd3c][_0x7a01('0x12')](queryCampaigns);}}else{return db[_0x7a01('0x15')][_0x7a01('0x12')]({'attributes':[_0x7a01('0x16')],'where':{'sectionId':_0x1cedf4['id']},'raw':!![]})[_0x7a01('0xa')](function(_0x4416ab){if(_0x4416ab){var _0x26c0b2={'where':{'id':_['map'](_0x4416ab,'resourceId')},'raw':!![]};switch(_0x12fd3c){case'User':_0x26c0b2[_0x7a01('0x17')]['role']=_0x7a01('0x18');break;case _0x7a01('0x19'):_0x26c0b2[_0x7a01('0x17')]['type']=_0x7a01('0x1a');break;}return db[_0x12fd3c][_0x7a01('0x12')](_0x26c0b2);}else{return[];}});}}else{return[];}})[_0x7a01('0xa')](function(_0x51cec3){return _0x51cec3;});}function joinOrLeaveQueues(_0x3f87a5,_0x43ce2e,_0x3e1842,_0x16a940){_0x3f87a5[_0x43ce2e](util[_0x7a01('0x1b')](_0x7a01('0x1c'),_0x3e1842,_0x16a940[_0x7a01('0x3')]));if(_0x16a940[_0x7a01('0x4')]){for(var _0x4717d5=0x0;_0x4717d5<_0x16a940[_0x7a01('0x4')][_0x7a01('0x1d')];_0x4717d5+=0x1){_0x3f87a5[_0x43ce2e](util[_0x7a01('0x1b')](_0x7a01('0x1e'),_0x16a940[_0x7a01('0x4')][_0x4717d5][_0x7a01('0x3')]));}}}function joinOrLeave(_0x40998d,_0x52bcfc,_0x2005bf){var _0x5f04bd;if(_0x40998d[_0x7a01('0x1f')][_0x7a01('0x20')]['id']){db[_0x7a01('0x5')][_0x7a01('0x21')]({'attributes':['id','name',_0x7a01('0x6'),_0x7a01('0x22')],'where':{'id':_0x40998d[_0x7a01('0x1f')][_0x7a01('0x20')]['id']},'include':[{'model':db[_0x7a01('0x23')],'as':_0x7a01('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x7a01('0x25')],'as':_0x7a01('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x7a01('0x27')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x7a01('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x7a01('0x29')],'as':_0x7a01('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x7a01('0x2b')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x7a01('0xa')](function(_0xaf8c9b){if(_0xaf8c9b){_0x5f04bd=_0xaf8c9b;_0x40998d[_0x52bcfc](util[_0x7a01('0x1b')](_0x7a01('0x1e'),_0xaf8c9b[_0x7a01('0x3')]));var _0x1f5767=[];switch(_0xaf8c9b['role']){case _0x7a01('0x2c'):_0x40998d[_0x52bcfc]('voice:inbound');_0x40998d[_0x52bcfc](_0x7a01('0x2d'));if(queryQueues['hasOwnProperty'](_0x7a01('0x2e'))){delete queryQueues['include'];}_0x1f5767[_0x7a01('0x2f')](db['VoiceQueue'][_0x7a01('0x12')](queryQueues));_0x1f5767['push'](db['ChatQueue'][_0x7a01('0x12')](queryQueues));_0x1f5767[_0x7a01('0x2f')](db[_0x7a01('0x30')][_0x7a01('0x12')](queryQueues));_0x1f5767['push'](db[_0x7a01('0x31')][_0x7a01('0x12')](queryQueues));_0x1f5767[_0x7a01('0x2f')](db[_0x7a01('0x32')][_0x7a01('0x12')](queryQueues));_0x1f5767[_0x7a01('0x2f')](db[_0x7a01('0x33')][_0x7a01('0x12')](queryQueues));_0x1f5767[_0x7a01('0x2f')](db[_0x7a01('0x34')][_0x7a01('0x12')](queryQueues));_0x1f5767[_0x7a01('0x2f')](db['User'][_0x7a01('0x12')](queryTelephones));_0x1f5767[_0x7a01('0x2f')](db[_0x7a01('0x35')][_0x7a01('0x12')](queryTrunks));_0x1f5767[_0x7a01('0x2f')](db['Campaign'][_0x7a01('0x12')](queryCampaigns));_0x1f5767[_0x7a01('0x2f')](db[_0x7a01('0x5')][_0x7a01('0x12')](queryAgents));break;case _0x7a01('0x36'):_0x40998d[_0x52bcfc](_0x7a01('0x37'));_0x40998d[_0x52bcfc](_0x7a01('0x2d'));_0x1f5767[_0x7a01('0x2f')](getAssociatedResources('VoiceQueues',_0xaf8c9b[_0x7a01('0x22')],'VoiceQueue'));_0x1f5767[_0x7a01('0x2f')](getAssociatedResources(_0x7a01('0x38'),_0xaf8c9b['userProfileId'],_0x7a01('0x39')));_0x1f5767[_0x7a01('0x2f')](getAssociatedResources('FaxQueues',_0xaf8c9b[_0x7a01('0x22')],_0x7a01('0x30')));_0x1f5767[_0x7a01('0x2f')](getAssociatedResources(_0x7a01('0x3a'),_0xaf8c9b[_0x7a01('0x22')],_0x7a01('0x31')));_0x1f5767[_0x7a01('0x2f')](getAssociatedResources('MailQueues',_0xaf8c9b[_0x7a01('0x22')],_0x7a01('0x32')));_0x1f5767[_0x7a01('0x2f')](getAssociatedResources(_0x7a01('0xf'),_0xaf8c9b[_0x7a01('0x22')],_0x7a01('0x33')));_0x1f5767['push'](getAssociatedResources(_0x7a01('0x10'),_0xaf8c9b[_0x7a01('0x22')],'WhatsappQueue'));_0x1f5767['push'](getAssociatedResources('Telephones',_0xaf8c9b[_0x7a01('0x22')],_0x7a01('0x5')));_0x1f5767[_0x7a01('0x2f')](getAssociatedResources('Trunks',_0xaf8c9b[_0x7a01('0x22')],_0x7a01('0x35')));_0x1f5767['push'](getAssociatedResources(_0x7a01('0x14'),_0xaf8c9b[_0x7a01('0x22')],_0x7a01('0x19')));_0x1f5767[_0x7a01('0x2f')](db[_0x7a01('0x5')][_0x7a01('0x12')](queryAgents));break;case _0x7a01('0x7'):_0x40998d[_0x52bcfc](_0x7a01('0x37'));_0x40998d[_0x52bcfc](_0x7a01('0x2d'));_0x1f5767[_0x7a01('0x2f')](_0xaf8c9b[_0x7a01('0x3b')]({'attributes':['id',_0x7a01('0x3')]}));_0x1f5767[_0x7a01('0x2f')](_0xaf8c9b[_0x7a01('0x3c')]({'attributes':['id',_0x7a01('0x3')]}));_0x1f5767['push'](_0xaf8c9b[_0x7a01('0x3d')]({'attributes':['id','name']}));_0x1f5767[_0x7a01('0x2f')](_0xaf8c9b[_0x7a01('0x3e')]({'attributes':['id',_0x7a01('0x3')]}));_0x1f5767[_0x7a01('0x2f')](_0xaf8c9b[_0x7a01('0x3f')]({'attributes':['id',_0x7a01('0x3')]}));_0x1f5767['push'](_0xaf8c9b['getOpenchannelQueues']({'attributes':['id',_0x7a01('0x3')]}));_0x1f5767[_0x7a01('0x2f')](_0xaf8c9b[_0x7a01('0x40')]({'attributes':['id','name']}));break;}return BPromise['all'](_0x1f5767);}})[_0x7a01('0xa')](function(_0x3931c6){if(_0x3931c6&&_0x3931c6[_0x7a01('0x1d')]){for(var _0x219e73=0x0;_0x219e73<_0x3931c6[_0x7a01('0x1d')];_0x219e73+=0x1){for(var _0x5d99f5=0x0;_0x5d99f5<_0x3931c6[_0x219e73][_0x7a01('0x1d')];_0x5d99f5+=0x1){switch(_0x219e73){case 0x0:joinOrLeaveQueues(_0x40998d,_0x52bcfc,'voice',_0x3931c6[_0x219e73][_0x5d99f5]);break;case 0x1:joinOrLeaveQueues(_0x40998d,_0x52bcfc,_0x7a01('0x41'),_0x3931c6[_0x219e73][_0x5d99f5]);break;case 0x2:joinOrLeaveQueues(_0x40998d,_0x52bcfc,_0x7a01('0x42'),_0x3931c6[_0x219e73][_0x5d99f5]);break;case 0x3:joinOrLeaveQueues(_0x40998d,_0x52bcfc,_0x7a01('0x43'),_0x3931c6[_0x219e73][_0x5d99f5]);break;case 0x4:joinOrLeaveQueues(_0x40998d,_0x52bcfc,_0x7a01('0x44'),_0x3931c6[_0x219e73][_0x5d99f5]);break;case 0x5:joinOrLeaveQueues(_0x40998d,_0x52bcfc,'openchannel',_0x3931c6[_0x219e73][_0x5d99f5]);break;case 0x6:joinOrLeaveQueues(_0x40998d,_0x52bcfc,_0x7a01('0x45'),_0x3931c6[_0x219e73][_0x5d99f5]);break;case 0x7:if(_0x5f04bd[_0x7a01('0x6')]!==_0x7a01('0x7'))_0x40998d[_0x52bcfc](util[_0x7a01('0x1b')](_0x7a01('0x46'),_0x3931c6[_0x219e73][_0x5d99f5][_0x7a01('0x3')]));break;case 0x8:if(_0x5f04bd['role']!=='agent')_0x40998d[_0x52bcfc](util['format'](_0x7a01('0x47'),_0x3931c6[_0x219e73][_0x5d99f5]['name']));break;case 0x9:if(_0x5f04bd[_0x7a01('0x6')]!==_0x7a01('0x7'))_0x40998d[_0x52bcfc](util[_0x7a01('0x1b')](_0x7a01('0x48'),_0x3931c6[_0x219e73][_0x5d99f5][_0x7a01('0x49')],_0x3931c6[_0x219e73][_0x5d99f5]['name']));break;case 0xa:_0x40998d[_0x52bcfc](util[_0x7a01('0x1b')](_0x7a01('0x1e'),_0x3931c6[_0x219e73][_0x5d99f5][_0x7a01('0x3')]));break;}}}}})['then'](function(){if(_0x52bcfc===_0x7a01('0x4a')){var _0x1f3b5f=_['map'](_0x5f04bd[_0x7a01('0x24')],'id');return _0x5f04bd[_0x7a01('0x4b')](_0x1f3b5f)[_0x7a01('0xa')](function(){for(var _0x136c3f=0x0;_0x136c3f<_0x1f3b5f[_0x7a01('0x1d')];_0x136c3f+=0x1){_0x2005bf[_0x7a01('0x4c')](_0x7a01('0x4d'),{'ChatInteractionId':Number(_0x1f3b5f[_0x136c3f]),'UserId':Number(_0x5f04bd['id'])});}});}})[_0x7a01('0xa')](function(){if(_0x52bcfc===_0x7a01('0x4a')){var _0x1acea3=_['map'](_0x5f04bd[_0x7a01('0x26')],'id');return _0x5f04bd[_0x7a01('0x4e')](_0x1acea3)['then'](function(){for(var _0x5b6b1b=0x0;_0x5b6b1b<_0x1acea3[_0x7a01('0x1d')];_0x5b6b1b+=0x1){_0x2005bf['emit'](_0x7a01('0x4f'),{'MailInteractionId':Number(_0x1acea3[_0x5b6b1b]),'UserId':Number(_0x5f04bd['id'])});}});}})[_0x7a01('0xa')](function(){if(_0x52bcfc==='leave'){var _0x4dd3b4=_[_0x7a01('0x50')](_0x5f04bd[_0x7a01('0x51')],'id');return _0x5f04bd[_0x7a01('0x52')](_0x4dd3b4)[_0x7a01('0xa')](function(){for(var _0xbd2e52=0x0;_0xbd2e52<_0x4dd3b4[_0x7a01('0x1d')];_0xbd2e52+=0x1){_0x2005bf[_0x7a01('0x4c')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x4dd3b4[_0xbd2e52]),'UserId':Number(_0x5f04bd['id'])});}});}})[_0x7a01('0xa')](function(){if(_0x52bcfc===_0x7a01('0x4a')){var _0x4b1e3c=_['map'](_0x5f04bd[_0x7a01('0x28')],'id');return _0x5f04bd[_0x7a01('0x53')](_0x4b1e3c)[_0x7a01('0xa')](function(){for(var _0x1537b2=0x0;_0x1537b2<_0x4b1e3c[_0x7a01('0x1d')];_0x1537b2+=0x1){_0x2005bf['emit']('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x4b1e3c[_0x1537b2]),'UserId':Number(_0x5f04bd['id'])});}});}})[_0x7a01('0xa')](function(){if(_0x52bcfc===_0x7a01('0x4a')){var _0x4615a5=_[_0x7a01('0x50')](_0x5f04bd[_0x7a01('0x2a')],'id');return _0x5f04bd['removeOpenchannelInteractions'](_0x4615a5)[_0x7a01('0xa')](function(){for(var _0x4e2284=0x0;_0x4e2284<_0x4615a5['length'];_0x4e2284+=0x1){_0x2005bf[_0x7a01('0x4c')](_0x7a01('0x54'),{'OpenchannelInteractionId':Number(_0x4615a5[_0x4e2284]),'UserId':Number(_0x5f04bd['id'])});}});}})['then'](function(){if(_0x52bcfc===_0x7a01('0x4a')){var _0x40dc7f=_[_0x7a01('0x50')](_0x5f04bd['WhatsappInteractions'],'id');return _0x5f04bd[_0x7a01('0x55')](_0x40dc7f)[_0x7a01('0xa')](function(){for(var _0x238303=0x0;_0x238303<_0x40dc7f[_0x7a01('0x1d')];_0x238303+=0x1){_0x2005bf[_0x7a01('0x4c')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x40dc7f[_0x238303]),'UserId':Number(_0x5f04bd['id'])});}});}})['catch'](function(_0x18a0f0){_0x40998d[_0x7a01('0x56')](_0x18a0f0);});}}function onDisconnect(_0x316450,_0x30b6df){joinOrLeave(_0x316450,_0x7a01('0x4a'),_0x30b6df);}function onConnect(_0x20b0f9){joinOrLeave(_0x20b0f9,_0x7a01('0x57'));}exports[_0x7a01('0x58')]=function(_0xac31d9){_0xac31d9['on'](_0x7a01('0x59'),function(_0x37c140){_0x37c140['setMaxListeners'](0x0);_0x37c140[_0x7a01('0x5a')]=_0x37c140[_0x7a01('0x5b')][_0x7a01('0x59')][_0x7a01('0x5c')]+':'+_0x37c140[_0x7a01('0x5b')]['connection']['remotePort'];_0x37c140[_0x7a01('0x5d')]=new Date();_0x37c140[_0x7a01('0x56')]=function(_0x484d77){console[_0x7a01('0x56')](_0x7a01('0x5e')+_0x37c140[_0x7a01('0x5f')][_0x7a01('0x3')]+'['+_0x37c140[_0x7a01('0x5a')]+']',_0x484d77);};_0x37c140['on'](_0x7a01('0x60'),function(){onDisconnect(_0x37c140,_0xac31d9);_0x37c140[_0x7a01('0x56')](_0x7a01('0x61'));});onConnect(_0x37c140);_0x37c140[_0x7a01('0x56')](_0x7a01('0x62'));});}; \ No newline at end of file +var _0x414f=['ChatInteractions','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','emit','user_has_mail_interactions:remove','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','log','join','default','connection','setMaxListeners','address','request','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','CONNECTED','lodash','bluebird','../mysqldb','name','Agents','User','role','agent','type','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Trunks','IvrCampaigns','resourceId','map','telephone','Campaign','where','%s:queue:%s','length','format','user:%s','handshake','query','find','userProfileId','ChatInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteractions','admin','voice:inbound','include','push','VoiceQueue','SmsQueue','MailQueue','WhatsappQueue','Trunk','voice:outbound','ChatQueues','ChatQueue','FaxQueues','FaxQueue','OpenchannelQueue','Telephones','getVoiceQueues','getChatQueues','getFaxQueues','getMailQueues','all','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','leave'];(function(_0x21f21b,_0x471748){var _0x360d1e=function(_0x4399aa){while(--_0x4399aa){_0x21f21b['push'](_0x21f21b['shift']());}};_0x360d1e(++_0x471748);}(_0x414f,0x13f));var _0xf414=function(_0x5bed28,_0x3069b3){_0x5bed28=_0x5bed28-0x0;var _0x44fe9f=_0x414f[_0x5bed28];return _0x44fe9f;};'use strict';var _=require(_0xf414('0x0'));var util=require('util');var BPromise=require(_0xf414('0x1'));var db=require(_0xf414('0x2'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0xf414('0x3')],'include':[{'as':_0xf414('0x4'),'model':db[_0xf414('0x5')],'attributes':['id',_0xf414('0x3'),_0xf414('0x6')],'raw':!![],'where':{'role':_0xf414('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xf414('0x3')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0xf414('0x3')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0xf414('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xf414('0x3'),_0xf414('0x8')],'where':{'type':'ivr'}};function getAssociatedResources(_0x4e69bd,_0x26a409,_0x2bbf01){return db[_0xf414('0x9')][_0xf414('0xa')]({'where':{'name':_0x4e69bd,'userProfileId':_0x26a409},'raw':!![]})[_0xf414('0xb')](function(_0x44648f){if(_0x44648f){if(_0x44648f[_0xf414('0xc')]){switch(_0x4e69bd){case _0xf414('0xd'):case'ChatQueues':case'FaxQueues':case _0xf414('0xe'):case _0xf414('0xf'):case _0xf414('0x10'):case _0xf414('0x11'):return db[_0x2bbf01][_0xf414('0x12')](queryQueues);case'Telephones':return db[_0x2bbf01][_0xf414('0x12')](queryTelephones);case _0xf414('0x13'):return db[_0x2bbf01][_0xf414('0x12')](queryTrunks);case _0xf414('0x14'):return db[_0x2bbf01][_0xf414('0x12')](queryCampaigns);}}else{return db['UserProfileResource'][_0xf414('0x12')]({'attributes':[_0xf414('0x15')],'where':{'sectionId':_0x44648f['id']},'raw':!![]})[_0xf414('0xb')](function(_0x706d2e){if(_0x706d2e){var _0x4d3021={'where':{'id':_[_0xf414('0x16')](_0x706d2e,_0xf414('0x15'))},'raw':!![]};switch(_0x2bbf01){case _0xf414('0x5'):_0x4d3021['where'][_0xf414('0x6')]=_0xf414('0x17');break;case _0xf414('0x18'):_0x4d3021[_0xf414('0x19')][_0xf414('0x8')]='ivr';break;}return db[_0x2bbf01][_0xf414('0x12')](_0x4d3021);}else{return[];}});}}else{return[];}})['then'](function(_0x5ede89){return _0x5ede89;});}function joinOrLeaveQueues(_0x24b65e,_0x44b829,_0x572605,_0x49249b){_0x24b65e[_0x44b829](util['format'](_0xf414('0x1a'),_0x572605,_0x49249b[_0xf414('0x3')]));if(_0x49249b[_0xf414('0x4')]){for(var _0x417af1=0x0;_0x417af1<_0x49249b[_0xf414('0x4')][_0xf414('0x1b')];_0x417af1+=0x1){_0x24b65e[_0x44b829](util[_0xf414('0x1c')](_0xf414('0x1d'),_0x49249b[_0xf414('0x4')][_0x417af1]['name']));}}}function joinOrLeave(_0xcde327,_0x3ae2a0,_0x236504){var _0x4999e4;if(_0xcde327[_0xf414('0x1e')][_0xf414('0x1f')]['id']){db[_0xf414('0x5')][_0xf414('0x20')]({'attributes':['id',_0xf414('0x3'),_0xf414('0x6'),_0xf414('0x21')],'where':{'id':_0xcde327[_0xf414('0x1e')]['query']['id']},'include':[{'model':db[_0xf414('0x22')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0xf414('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0xf414('0x24')],'as':_0xf414('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xf414('0x26')],'as':_0xf414('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xf414('0x28')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0xf414('0x29'),'attributes':['id'],'raw':!![]}]})[_0xf414('0xb')](function(_0x209790){if(_0x209790){_0x4999e4=_0x209790;_0xcde327[_0x3ae2a0](util['format'](_0xf414('0x1d'),_0x209790['name']));var _0x485afe=[];switch(_0x209790[_0xf414('0x6')]){case _0xf414('0x2a'):_0xcde327[_0x3ae2a0](_0xf414('0x2b'));_0xcde327[_0x3ae2a0]('voice:outbound');if(queryQueues['hasOwnProperty'](_0xf414('0x2c'))){delete queryQueues['include'];}_0x485afe[_0xf414('0x2d')](db[_0xf414('0x2e')][_0xf414('0x12')](queryQueues));_0x485afe[_0xf414('0x2d')](db['ChatQueue'][_0xf414('0x12')](queryQueues));_0x485afe['push'](db['FaxQueue'][_0xf414('0x12')](queryQueues));_0x485afe[_0xf414('0x2d')](db[_0xf414('0x2f')][_0xf414('0x12')](queryQueues));_0x485afe[_0xf414('0x2d')](db[_0xf414('0x30')][_0xf414('0x12')](queryQueues));_0x485afe[_0xf414('0x2d')](db['OpenchannelQueue']['findAll'](queryQueues));_0x485afe[_0xf414('0x2d')](db[_0xf414('0x31')][_0xf414('0x12')](queryQueues));_0x485afe['push'](db['User'][_0xf414('0x12')](queryTelephones));_0x485afe['push'](db[_0xf414('0x32')]['findAll'](queryTrunks));_0x485afe[_0xf414('0x2d')](db[_0xf414('0x18')]['findAll'](queryCampaigns));_0x485afe[_0xf414('0x2d')](db[_0xf414('0x5')][_0xf414('0x12')](queryAgents));break;case'user':_0xcde327[_0x3ae2a0](_0xf414('0x2b'));_0xcde327[_0x3ae2a0](_0xf414('0x33'));_0x485afe[_0xf414('0x2d')](getAssociatedResources(_0xf414('0xd'),_0x209790[_0xf414('0x21')],_0xf414('0x2e')));_0x485afe['push'](getAssociatedResources(_0xf414('0x34'),_0x209790[_0xf414('0x21')],_0xf414('0x35')));_0x485afe[_0xf414('0x2d')](getAssociatedResources(_0xf414('0x36'),_0x209790[_0xf414('0x21')],_0xf414('0x37')));_0x485afe[_0xf414('0x2d')](getAssociatedResources(_0xf414('0xe'),_0x209790['userProfileId'],_0xf414('0x2f')));_0x485afe[_0xf414('0x2d')](getAssociatedResources(_0xf414('0xf'),_0x209790[_0xf414('0x21')],_0xf414('0x30')));_0x485afe[_0xf414('0x2d')](getAssociatedResources(_0xf414('0x10'),_0x209790[_0xf414('0x21')],_0xf414('0x38')));_0x485afe[_0xf414('0x2d')](getAssociatedResources(_0xf414('0x11'),_0x209790[_0xf414('0x21')],_0xf414('0x31')));_0x485afe[_0xf414('0x2d')](getAssociatedResources(_0xf414('0x39'),_0x209790[_0xf414('0x21')],_0xf414('0x5')));_0x485afe['push'](getAssociatedResources(_0xf414('0x13'),_0x209790[_0xf414('0x21')],'Trunk'));_0x485afe[_0xf414('0x2d')](getAssociatedResources(_0xf414('0x14'),_0x209790['userProfileId'],_0xf414('0x18')));_0x485afe[_0xf414('0x2d')](db[_0xf414('0x5')][_0xf414('0x12')](queryAgents));break;case _0xf414('0x7'):_0xcde327[_0x3ae2a0](_0xf414('0x2b'));_0xcde327[_0x3ae2a0](_0xf414('0x33'));_0x485afe['push'](_0x209790[_0xf414('0x3a')]({'attributes':['id',_0xf414('0x3')]}));_0x485afe[_0xf414('0x2d')](_0x209790[_0xf414('0x3b')]({'attributes':['id',_0xf414('0x3')]}));_0x485afe[_0xf414('0x2d')](_0x209790[_0xf414('0x3c')]({'attributes':['id',_0xf414('0x3')]}));_0x485afe[_0xf414('0x2d')](_0x209790['getSmsQueues']({'attributes':['id',_0xf414('0x3')]}));_0x485afe[_0xf414('0x2d')](_0x209790[_0xf414('0x3d')]({'attributes':['id',_0xf414('0x3')]}));_0x485afe['push'](_0x209790['getOpenchannelQueues']({'attributes':['id',_0xf414('0x3')]}));_0x485afe[_0xf414('0x2d')](_0x209790['getWhatsappQueues']({'attributes':['id','name']}));break;}return BPromise[_0xf414('0x3e')](_0x485afe);}})[_0xf414('0xb')](function(_0x33c42d){if(_0x33c42d&&_0x33c42d[_0xf414('0x1b')]){for(var _0x1e7e28=0x0;_0x1e7e28<_0x33c42d[_0xf414('0x1b')];_0x1e7e28+=0x1){for(var _0x8754a1=0x0;_0x8754a1<_0x33c42d[_0x1e7e28][_0xf414('0x1b')];_0x8754a1+=0x1){switch(_0x1e7e28){case 0x0:joinOrLeaveQueues(_0xcde327,_0x3ae2a0,_0xf414('0x3f'),_0x33c42d[_0x1e7e28][_0x8754a1]);break;case 0x1:joinOrLeaveQueues(_0xcde327,_0x3ae2a0,_0xf414('0x40'),_0x33c42d[_0x1e7e28][_0x8754a1]);break;case 0x2:joinOrLeaveQueues(_0xcde327,_0x3ae2a0,_0xf414('0x41'),_0x33c42d[_0x1e7e28][_0x8754a1]);break;case 0x3:joinOrLeaveQueues(_0xcde327,_0x3ae2a0,_0xf414('0x42'),_0x33c42d[_0x1e7e28][_0x8754a1]);break;case 0x4:joinOrLeaveQueues(_0xcde327,_0x3ae2a0,_0xf414('0x43'),_0x33c42d[_0x1e7e28][_0x8754a1]);break;case 0x5:joinOrLeaveQueues(_0xcde327,_0x3ae2a0,_0xf414('0x44'),_0x33c42d[_0x1e7e28][_0x8754a1]);break;case 0x6:joinOrLeaveQueues(_0xcde327,_0x3ae2a0,_0xf414('0x45'),_0x33c42d[_0x1e7e28][_0x8754a1]);break;case 0x7:if(_0x4999e4[_0xf414('0x6')]!=='agent')_0xcde327[_0x3ae2a0](util[_0xf414('0x1c')](_0xf414('0x46'),_0x33c42d[_0x1e7e28][_0x8754a1]['name']));break;case 0x8:if(_0x4999e4[_0xf414('0x6')]!==_0xf414('0x7'))_0xcde327[_0x3ae2a0](util[_0xf414('0x1c')](_0xf414('0x47'),_0x33c42d[_0x1e7e28][_0x8754a1][_0xf414('0x3')]));break;case 0x9:if(_0x4999e4[_0xf414('0x6')]!=='agent')_0xcde327[_0x3ae2a0](util[_0xf414('0x1c')]('campaign:%s:%s',_0x33c42d[_0x1e7e28][_0x8754a1]['type'],_0x33c42d[_0x1e7e28][_0x8754a1][_0xf414('0x3')]));break;case 0xa:_0xcde327[_0x3ae2a0](util[_0xf414('0x1c')](_0xf414('0x1d'),_0x33c42d[_0x1e7e28][_0x8754a1]['name']));break;}}}}})[_0xf414('0xb')](function(){if(_0x3ae2a0===_0xf414('0x48')){var _0x20319f=_[_0xf414('0x16')](_0x4999e4[_0xf414('0x49')],'id');return _0x4999e4[_0xf414('0x4a')](_0x20319f)['then'](function(){for(var _0x1f0324=0x0;_0x1f0324<_0x20319f['length'];_0x1f0324+=0x1){_0x236504['emit'](_0xf414('0x4b'),{'ChatInteractionId':Number(_0x20319f[_0x1f0324]),'UserId':Number(_0x4999e4['id'])});}});}})[_0xf414('0xb')](function(){if(_0x3ae2a0==='leave'){var _0x5ceccb=_['map'](_0x4999e4['MailInteractions'],'id');return _0x4999e4[_0xf414('0x4c')](_0x5ceccb)[_0xf414('0xb')](function(){for(var _0x22d341=0x0;_0x22d341<_0x5ceccb['length'];_0x22d341+=0x1){_0x236504[_0xf414('0x4d')](_0xf414('0x4e'),{'MailInteractionId':Number(_0x5ceccb[_0x22d341]),'UserId':Number(_0x4999e4['id'])});}});}})[_0xf414('0xb')](function(){if(_0x3ae2a0===_0xf414('0x48')){var _0x5061cc=_[_0xf414('0x16')](_0x4999e4[_0xf414('0x25')],'id');return _0x4999e4['removeFaxInteractions'](_0x5061cc)[_0xf414('0xb')](function(){for(var _0x3f1555=0x0;_0x3f1555<_0x5061cc['length'];_0x3f1555+=0x1){_0x236504[_0xf414('0x4d')](_0xf414('0x4f'),{'FaxInteractionId':Number(_0x5061cc[_0x3f1555]),'UserId':Number(_0x4999e4['id'])});}});}})['then'](function(){if(_0x3ae2a0===_0xf414('0x48')){var _0x54d909=_[_0xf414('0x16')](_0x4999e4['SmsInteractions'],'id');return _0x4999e4[_0xf414('0x50')](_0x54d909)['then'](function(){for(var _0x1d17bf=0x0;_0x1d17bf<_0x54d909[_0xf414('0x1b')];_0x1d17bf+=0x1){_0x236504[_0xf414('0x4d')](_0xf414('0x51'),{'SmsInteractionId':Number(_0x54d909[_0x1d17bf]),'UserId':Number(_0x4999e4['id'])});}});}})[_0xf414('0xb')](function(){if(_0x3ae2a0==='leave'){var _0x375493=_[_0xf414('0x16')](_0x4999e4[_0xf414('0x52')],'id');return _0x4999e4['removeOpenchannelInteractions'](_0x375493)[_0xf414('0xb')](function(){for(var _0x30b335=0x0;_0x30b335<_0x375493[_0xf414('0x1b')];_0x30b335+=0x1){_0x236504[_0xf414('0x4d')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x375493[_0x30b335]),'UserId':Number(_0x4999e4['id'])});}});}})[_0xf414('0xb')](function(){if(_0x3ae2a0==='leave'){var _0x59ad77=_['map'](_0x4999e4[_0xf414('0x29')],'id');return _0x4999e4[_0xf414('0x53')](_0x59ad77)['then'](function(){for(var _0x169835=0x0;_0x169835<_0x59ad77[_0xf414('0x1b')];_0x169835+=0x1){_0x236504[_0xf414('0x4d')](_0xf414('0x54'),{'WhatsappInteractionId':Number(_0x59ad77[_0x169835]),'UserId':Number(_0x4999e4['id'])});}});}})['catch'](function(_0x4d30f0){_0xcde327[_0xf414('0x55')](_0x4d30f0);});}}function onDisconnect(_0x40762d,_0x20caaf){joinOrLeave(_0x40762d,_0xf414('0x48'),_0x20caaf);}function onConnect(_0x6380d0){joinOrLeave(_0x6380d0,_0xf414('0x56'));}exports[_0xf414('0x57')]=function(_0x31c305){_0x31c305['on'](_0xf414('0x58'),function(_0x2827fd){_0x2827fd[_0xf414('0x59')](0x0);_0x2827fd[_0xf414('0x5a')]=_0x2827fd[_0xf414('0x5b')][_0xf414('0x58')]['remoteAddress']+':'+_0x2827fd[_0xf414('0x5b')][_0xf414('0x58')][_0xf414('0x5c')];_0x2827fd[_0xf414('0x5d')]=new Date();_0x2827fd[_0xf414('0x55')]=function(_0xb9b892){console[_0xf414('0x55')](_0xf414('0x5e')+_0x2827fd[_0xf414('0x5f')]['name']+'['+_0x2827fd[_0xf414('0x5a')]+']',_0xb9b892);};_0x2827fd['on'](_0xf414('0x60'),function(){onDisconnect(_0x2827fd,_0x31c305);_0x2827fd[_0xf414('0x55')]('DISCONNECTED');});onConnect(_0x2827fd);_0x2827fd[_0xf414('0x55')](_0xf414('0x61'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 2e91dcc..a61bd5b 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 _0x14d4=['changed','substatus','Sequelize','User','find','fullname','email','internal','default','length','model','hook','toLowerCase','condition','util','../../mysqldb','jayson/promise','../logger','triggers','client','Chat','ChatInteraction','newinteraction','closedinteraction','ChatMessage','newmessage','ChatOfflineMessage','afterCreate','Sms','SmsInteraction','afterUpdate','SmsMessage','WhatsappInteraction','Whatsapp','Fax','FaxInteraction','FaxMessage','MailInteraction','Mail','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info','Trigger,\x20%s','error','code','catch','get','channel','event','direction','resolve','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','SELECT','contact','UserId','format','SIP/%s','name','agent','outgoingmessage','AfterCreateMessage','motionChannel','offlineMessage','QueryTypes','interface','AfterCreate','closed'];(function(_0x102826,_0x35f7b9){var _0x57556e=function(_0x469edd){while(--_0x469edd){_0x102826['push'](_0x102826['shift']());}};_0x57556e(++_0x35f7b9);}(_0x14d4,0xa6));var _0x414d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x14d4[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x414d('0x0'));var db=require(_0x414d('0x1'))['db'];var jayson=require(_0x414d('0x2'));var logger=require(_0x414d('0x3'))(_0x414d('0x4'));var client=jayson[_0x414d('0x5')]['http']({'port':0x232a});var triggers=[{'channel':_0x414d('0x6'),'model':_0x414d('0x7'),'event':'afterCreate','condition':_0x414d('0x8'),'callback':afterCreate},{'channel':'Chat','model':_0x414d('0x7'),'event':'afterUpdate','condition':_0x414d('0x9'),'callback':afterUpdate},{'channel':_0x414d('0x6'),'model':_0x414d('0xa'),'event':'afterCreate','condition':_0x414d('0xb'),'callback':afterCreateMessage},{'channel':_0x414d('0x6'),'model':_0x414d('0xc'),'event':_0x414d('0xd'),'condition':'newmessage','callback':afterCreateOfflineMessage},{'channel':_0x414d('0xe'),'model':_0x414d('0xf'),'event':_0x414d('0xd'),'condition':_0x414d('0x8'),'callback':afterCreate},{'channel':'Sms','model':_0x414d('0xf'),'event':_0x414d('0x10'),'condition':_0x414d('0x9'),'callback':afterUpdate},{'channel':_0x414d('0xe'),'model':_0x414d('0x11'),'event':_0x414d('0xd'),'condition':_0x414d('0xb'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':_0x414d('0x12'),'event':_0x414d('0xd'),'condition':_0x414d('0x8'),'callback':afterCreate},{'channel':_0x414d('0x13'),'model':_0x414d('0x12'),'event':_0x414d('0x10'),'condition':_0x414d('0x9'),'callback':afterUpdate},{'channel':'Whatsapp','model':'WhatsappMessage','event':_0x414d('0xd'),'condition':_0x414d('0xb'),'callback':afterCreateMessage},{'channel':_0x414d('0x14'),'model':_0x414d('0x15'),'event':_0x414d('0xd'),'condition':_0x414d('0x8'),'callback':afterCreate},{'channel':_0x414d('0x14'),'model':_0x414d('0x15'),'event':_0x414d('0x10'),'condition':_0x414d('0x9'),'callback':afterUpdate},{'channel':_0x414d('0x14'),'model':_0x414d('0x16'),'event':'afterCreate','condition':_0x414d('0xb'),'callback':afterCreateMessage},{'channel':'Mail','model':_0x414d('0x17'),'event':'afterCreate','condition':_0x414d('0x8'),'callback':afterCreate},{'channel':_0x414d('0x18'),'model':_0x414d('0x17'),'event':'afterUpdate','condition':_0x414d('0x9'),'callback':afterUpdate},{'channel':_0x414d('0x18'),'model':_0x414d('0x19'),'event':_0x414d('0xd'),'condition':_0x414d('0xb'),'callback':afterCreateMessage},{'channel':_0x414d('0x1a'),'model':'OpenchannelInteraction','event':_0x414d('0xd'),'condition':_0x414d('0x8'),'callback':afterCreate},{'channel':_0x414d('0x1a'),'model':_0x414d('0x1b'),'event':_0x414d('0x10'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x414d('0x1a'),'model':_0x414d('0x1c'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage}];function request(_0x517cfa){return client[_0x414d('0x1d')](_0x414d('0x1e'),_0x517cfa)[_0x414d('0x1f')](function(_0x5dd7fe){logger[_0x414d('0x20')](_0x414d('0x21'),_0x414d('0x1e'),_0x5dd7fe);if(_0x5dd7fe[_0x414d('0x22')]){if(_0x5dd7fe[_0x414d('0x22')][_0x414d('0x23')]===0x1f4){logger[_0x414d('0x22')](_0x414d('0x21'),_0x414d('0x1e'),_0x5dd7fe[_0x414d('0x22')]);}}})[_0x414d('0x24')](function(_0x56aa2e){logger[_0x414d('0x22')](_0x414d('0x21'),_0x414d('0x1e'),_0x56aa2e);});}function afterCreateMessage(_0x2c7cf1){return function(_0x41d833){_0x41d833=_0x41d833[_0x414d('0x25')]({'plain':!![]});_0x41d833[_0x414d('0x26')]=_0x2c7cf1;_0x41d833['motionChannel']=_0x2c7cf1;_0x41d833[_0x414d('0x27')]=_0x41d833[_0x414d('0x28')];Promise[_0x414d('0x29')]()[_0x414d('0x1f')](function(){if(typeof _0x41d833[_0x414d('0x2a')]===_0x414d('0x2b'))return null;var _0x26b8ab=_0x414d('0x2c')+_0x41d833[_0x414d('0x2a')];return db[_0x414d('0x2d')][_0x414d('0x2e')](_0x26b8ab,{'type':db['Sequelize']['QueryTypes'][_0x414d('0x2f')],'raw':!![]});})[_0x414d('0x1f')](function(_0x3c5dac){if(_0x3c5dac){_0x41d833[_0x414d('0x30')]=_0x3c5dac[0x0];}if(typeof _0x41d833[_0x414d('0x31')]===_0x414d('0x2b'))return;return getAgent(_0x41d833[_0x414d('0x31')]);})[_0x414d('0x1f')](function(_0x391b8c){if(_0x391b8c){_0x41d833['interface']=util[_0x414d('0x32')](_0x414d('0x33'),_0x391b8c[_0x414d('0x34')]);_0x41d833[_0x414d('0x35')]=_0x391b8c;_0x41d833['channel']=_0x2c7cf1;return request({'event':'incomingmessage','message':_0x41d833});}else{return request({'event':_0x414d('0x36'),'message':_0x41d833});}})[_0x414d('0x24')](function(_0x2fa9e3){logger[_0x414d('0x22')](_0x414d('0x21'),_0x414d('0x37'),_0x2fa9e3);});};}function afterCreateOfflineMessage(_0x10319d){return function(_0x5cd275){_0x5cd275=_0x5cd275[_0x414d('0x25')]({'plain':!![]});_0x5cd275['channel']=_0x10319d;_0x5cd275[_0x414d('0x38')]=_0x10319d;_0x5cd275[_0x414d('0x27')]=_0x414d('0x39');return request({'event':_0x5cd275[_0x414d('0x27')],'message':_0x5cd275});};}function afterCreate(_0x5518b9,_0x41fa1e){return function(_0x3d2291){_0x3d2291=_0x3d2291[_0x414d('0x25')]({'plain':!![]});_0x3d2291[_0x414d('0x26')]=_0x5518b9;_0x3d2291[_0x414d('0x38')]=_0x5518b9;_0x3d2291[_0x414d('0x27')]='opened';Promise[_0x414d('0x29')]()['then'](function(){var _0x5d2548=_0x414d('0x2c')+_0x3d2291['ContactId'];return db[_0x414d('0x2d')][_0x414d('0x2e')](_0x5d2548,{'type':db['Sequelize'][_0x414d('0x3a')][_0x414d('0x2f')],'raw':!![]});})['then'](function(_0x5d01e5){if(_0x5d01e5){_0x3d2291[_0x414d('0x30')]=_0x5d01e5[0x0];}if(typeof _0x3d2291['UserId']===_0x414d('0x2b'))return;return getAgent(_0x3d2291[_0x414d('0x31')]);})[_0x414d('0x1f')](function(_0x37b750){if(_0x37b750){_0x3d2291[_0x414d('0x3b')]=util['format'](_0x414d('0x33'),_0x37b750['name']);_0x3d2291[_0x414d('0x35')]=_0x37b750;}return request({'event':_0x41fa1e,'message':_0x3d2291});})[_0x414d('0x24')](function(_0x3ee5c0){logger['error'](_0x414d('0x21'),_0x414d('0x3c'),_0x3ee5c0);});};}function afterUpdate(_0x4da81c){return function(_0x9b5d39){var _0xdb4405=_0x9b5d39['changed'](_0x414d('0x3d'))&&_0x9b5d39[_0x414d('0x3d')];var _0x130e9b=_0x9b5d39[_0x414d('0x3e')](_0x414d('0x3f'));if(_0xdb4405||_0x130e9b){var _0x1b21c4=_0xdb4405?_0x414d('0x9'):_0x414d('0x3f');var _0x5d7f53=_0x9b5d39[_0x414d('0x25')]({'plain':!![]});_0x5d7f53[_0x414d('0x26')]=_0x4da81c;_0x5d7f53[_0x414d('0x38')]=_0x4da81c;_0x5d7f53[_0x414d('0x27')]=_0xdb4405?_0x414d('0x3d'):'substatus';var _0x149dc0=_0x414d('0x2c')+_0x5d7f53['ContactId'];return db[_0x414d('0x2d')][_0x414d('0x2e')](_0x149dc0,{'type':db[_0x414d('0x40')]['QueryTypes'][_0x414d('0x2f')],'raw':!![]})[_0x414d('0x1f')](function(_0x4451bb){if(_0x4451bb){_0x5d7f53[_0x414d('0x30')]=_0x4451bb[0x0];}if(typeof _0x5d7f53[_0x414d('0x31')]==='undefined')return;return getAgent(_0x5d7f53[_0x414d('0x31')]);})[_0x414d('0x1f')](function(_0x43fc80){if(_0x43fc80){_0x5d7f53[_0x414d('0x3b')]=util[_0x414d('0x32')](_0x414d('0x33'),_0x43fc80['name']);_0x5d7f53[_0x414d('0x35')]=_0x43fc80;}return request({'event':_0x1b21c4,'message':_0x5d7f53});})[_0x414d('0x24')](function(_0x3adf10){logger['error']('Trigger,\x20%s','AfterUpdate',_0x3adf10);});}};}function getAgent(_0x884f03){return db[_0x414d('0x41')][_0x414d('0x42')]({'where':{'id':_0x884f03},'attributes':['id',_0x414d('0x34'),_0x414d('0x43'),_0x414d('0x44'),_0x414d('0x45')],'raw':!![]})[_0x414d('0x1f')](function(_0x3267bb){return _0x3267bb;});}exports[_0x414d('0x46')]=function(){for(var _0x50ffc5=0x0;_0x50ffc5=_0x4db2d8[_0x17e3('0x14')]){throw Error(_0x17e3('0x15'));}_0x559ad6(_0x20cc6e);})[_0x17e3('0x16')](function(_0x3c52f5){_0x3ac698(_0x3c52f5);});});}; \ No newline at end of file +var _0xae69=['updateAttributes','User','count','agent','then','agents','catch','lodash','bluebird','../mysqldb','./license/util','voice','mail','chat','sms','isValidChannel','toLowerCase','includes','clearBlockUser'];(function(_0x581000,_0xe4f284){var _0x22c623=function(_0x31c90d){while(--_0x31c90d){_0x581000['push'](_0x581000['shift']());}};_0x22c623(++_0xe4f284);}(_0xae69,0x79));var _0x9ae6=function(_0x447997,_0x289e30){_0x447997=_0x447997-0x0;var _0x109bb6=_0xae69[_0x447997];return _0x109bb6;};'use strict';var _=require(_0x9ae6('0x0'));var BPromise=require(_0x9ae6('0x1'));var db=require(_0x9ae6('0x2'))['db'];var util=require(_0x9ae6('0x3'));var channels=[_0x9ae6('0x4'),_0x9ae6('0x5'),_0x9ae6('0x6'),'fax',_0x9ae6('0x7'),'whatsapp','openchannel'];exports['getChannels']=function(){return channels;};exports[_0x9ae6('0x8')]=function(_0x5c34e4){_0x5c34e4=_0x5c34e4[_0x9ae6('0x9')]();return _[_0x9ae6('0xa')](channels,_0x5c34e4);};exports[_0x9ae6('0xb')]=function(_0x1ac096,_0x1a9d2c,_0x4a0e5f,_0x265ed2){var _0x5de505={'loginAttempts':_0x1a9d2c,'blocked':_0x4a0e5f};if(!_['isUndefined'](_0x265ed2)){_0x5de505['blockedAt']=_0x265ed2;}return _0x1ac096[_0x9ae6('0xc')](_0x5de505);};exports['getLicense']=function(_0x1784a8){return new BPromise(function(_0x5b8de2,_0x3947da){var _0x2ddae1=0x0;if(_0x1784a8['role']!=='agent'){_0x5b8de2(_0x1784a8);}db[_0x9ae6('0xd')][_0x9ae6('0xe')]({'where':{'role':_0x9ae6('0xf'),'online':!![],'id':{'$ne':_0x1784a8['id']}}})[_0x9ae6('0x10')](function(_0x14e7dd){_0x2ddae1=_0x14e7dd;return util['getLicense']();})['then'](function(_0x388f1b){if(_0x388f1b&&_0x388f1b[_0x9ae6('0x11')]&&_0x2ddae1>=_0x388f1b[_0x9ae6('0x11')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x5b8de2(_0x1784a8);})[_0x9ae6('0x12')](function(_0x54e62a){_0x3947da(_0x54e62a);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 46d548c..81091f9 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0bb5=['message','Internal\x20Server\x20Error','name','Error','inherits','Bad\x20Request','Not\x20Found','OutOfInterval','error','stack','status','send','exports','util','../config/logger'];(function(_0x65959d,_0x4dd888){var _0x2d71aa=function(_0x51c2ae){while(--_0x51c2ae){_0x65959d['push'](_0x65959d['shift']());}};_0x2d71aa(++_0x4dd888);}(_0x0bb5,0x148));var _0x50bb=function(_0x4aee1d,_0x16647c){_0x4aee1d=_0x4aee1d-0x0;var _0x21fdc7=_0x0bb5[_0x4aee1d];return _0x21fdc7;};'use strict';var util=require(_0x50bb('0x0'));var logger=require(_0x50bb('0x1'))('api');var APIError=function(_0x5a12b6,_0x348380){this[_0x50bb('0x2')]=_0x5a12b6||_0x50bb('0x3');this[_0x50bb('0x4')]=_0x348380||_0x50bb('0x5');util[_0x50bb('0x6')](APIError,Error);};var APIBadRequestError=function(_0x451b4c){this[_0x50bb('0x2')]=_0x451b4c||'Bad\x20Request';this['name']=_0x50bb('0x7');util[_0x50bb('0x6')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x2e5463){this[_0x50bb('0x2')]=_0x2e5463||'Entity\x20not\x20found';this['name']=_0x50bb('0x8');util[_0x50bb('0x6')](APINotFoundError,APIError);};function getStatusCode(_0x3ae598){switch(_0x3ae598){case _0x50bb('0x7'):return 0x190;case'Forbidden',_0x50bb('0x9'):return 0x193;case _0x50bb('0x8'):return 0x194;default:return 0x1f4;}}function handleError(_0x184d06){return function(_0x41055d){logger[_0x50bb('0xa')](_0x41055d[_0x50bb('0xb')]);var _0x38d3b6=getStatusCode(_0x41055d['name']);if(_0x41055d[_0x50bb('0x4')])delete _0x41055d['name'];return _0x184d06[_0x50bb('0xc')](_0x38d3b6)[_0x50bb('0xd')](_0x41055d);};}module[_0x50bb('0xe')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0xac4a=['Bad\x20Request','Not\x20Found','OutOfInterval','error','name','send','exports','util','../config/logger','api','message','Error','inherits'];(function(_0x2f75b0,_0x18a7a2){var _0x1c082e=function(_0x1ed0d4){while(--_0x1ed0d4){_0x2f75b0['push'](_0x2f75b0['shift']());}};_0x1c082e(++_0x18a7a2);}(_0xac4a,0x13f));var _0xaac4=function(_0x6ee76e,_0x3cf35c){_0x6ee76e=_0x6ee76e-0x0;var _0x347a38=_0xac4a[_0x6ee76e];return _0x347a38;};'use strict';var util=require(_0xaac4('0x0'));var logger=require(_0xaac4('0x1'))(_0xaac4('0x2'));var APIError=function(_0x132fc3,_0x38f4f4){this[_0xaac4('0x3')]=_0x132fc3||'Internal\x20Server\x20Error';this['name']=_0x38f4f4||_0xaac4('0x4');util[_0xaac4('0x5')](APIError,Error);};var APIBadRequestError=function(_0x32d34c){this['message']=_0x32d34c||_0xaac4('0x6');this['name']=_0xaac4('0x6');util['inherits'](APIBadRequestError,APIError);};var APINotFoundError=function(_0x1e4283){this[_0xaac4('0x3')]=_0x1e4283||'Entity\x20not\x20found';this['name']=_0xaac4('0x7');util['inherits'](APINotFoundError,APIError);};function getStatusCode(_0x452573){switch(_0x452573){case'Bad\x20Request':return 0x190;case'Forbidden',_0xaac4('0x8'):return 0x193;case _0xaac4('0x7'):return 0x194;default:return 0x1f4;}}function handleError(_0x38d1d0){return function(_0x5f393e){logger[_0xaac4('0x9')](_0x5f393e['stack']);var _0x508e14=getStatusCode(_0x5f393e[_0xaac4('0xa')]);if(_0x5f393e[_0xaac4('0xa')])delete _0x5f393e[_0xaac4('0xa')];return _0x38d1d0['status'](_0x508e14)[_0xaac4('0xb')](_0x5f393e);};}module[_0xaac4('0xc')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index c13f68a..e70a470 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0e39=['send','exports','404','status','render','json'];(function(_0x11407c,_0x1d4209){var _0x5326b0=function(_0x423be8){while(--_0x423be8){_0x11407c['push'](_0x11407c['shift']());}};_0x5326b0(++_0x1d4209);}(_0x0e39,0x1f3));var _0x90e3=function(_0x1b943f,_0x6f6e83){_0x1b943f=_0x1b943f-0x0;var _0x8b7549=_0x0e39[_0x1b943f];return _0x8b7549;};'use strict';module[_0x90e3('0x0')][0x194]=function pageNotFound(_0x53976f,_0x36d4f1){var _0x29da36=_0x90e3('0x1');var _0x2d7635=0x194;var _0x456a75={'status':_0x2d7635};_0x36d4f1['status'](_0x456a75[_0x90e3('0x2')]);_0x36d4f1[_0x90e3('0x3')](_0x29da36,{},function(_0x286cb7,_0xa11770){if(_0x286cb7){return _0x36d4f1[_0x90e3('0x2')](_0x456a75[_0x90e3('0x2')])[_0x90e3('0x4')](_0x456a75);}_0x36d4f1[_0x90e3('0x5')](_0xa11770);});}; \ No newline at end of file +var _0x675e=['render','json','404','status'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x675e,0x18a));var _0xe675=function(_0x44c768,_0x552a5e){_0x44c768=_0x44c768-0x0;var _0x55daf5=_0x675e[_0x44c768];return _0x55daf5;};'use strict';module['exports'][0x194]=function pageNotFound(_0x214c62,_0x39f142){var _0x1e0d10=_0xe675('0x0');var _0x4a7210=0x194;var _0x1d05ce={'status':_0x4a7210};_0x39f142[_0xe675('0x1')](_0x1d05ce[_0xe675('0x1')]);_0x39f142[_0xe675('0x2')](_0x1e0d10,{},function(_0x2c46e7,_0x49e9dd){if(_0x2c46e7){return _0x39f142[_0xe675('0x1')](_0x1d05ce[_0xe675('0x1')])[_0xe675('0x3')](_0x1d05ce);}_0x39f142['send'](_0x49e9dd);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 2a4547a..a22dff9 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5009=['AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','../api/userVoicePrefix/userVoicePrefix.model','VoiceMail','cascade','UserId','hasOne','hasMany','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteraction','ChatInteractions','FaxInteractions','MailInteractions','WhatsappInteraction','WhatsappInteractions','SenderId','belongsTo','belongsToMany','Groups','Contacts','CmList','Lists','cm_user_has_lists','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','SmsInteractions','user_has_sms_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','UserVoicePrefix','UserMailQueue','ChatQueues','FaxQueues','UserFaxQueue','SmsQueue','SmsQueues','OpenchannelQueues','WhatsappQueue','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','OpenchannelAccount','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','VoiceChanSpy','SpiedAgents','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','JscriptySessionReport','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','Pause','mandatoryDispositionPause','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','VoiceMailMessage','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','VoiceCallReport','AgentReports','Contact','ContactId','MailAccountId','MailServerIn','CloudProviderId','restrict','Imap','Smtp','Dispositions','Answers','Interactions','List','TemplateId','mandatoryDispositionPauseId','team_has_mail_queues','MailInteractionId','Account','Owner','mail_interaction_has_tags','ThroughTags','Users','Attachments','ChatWebsiteId','ChatOfflineMessageId','TagId','MailQueueReport','ListId','DashboardItem','FaxAccountId','Exntensions','FaxInteractionId','fax_interaction_has_tags','Tags','Interaction','AttachmentId','team_has_fax_queues','SmsAccountId','SmsApplication','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','chat_group_has_users','CompanyId','Phones','CmContactId','Company','cm_user_has_contacts','cm_contact_has_tags','AdditionalPhones','CampaignId','OwnerId','All','AutomationAllId','Any','OneAny','AutomationAnyId','Action','Actions','AutomationId','ParentId','Intervals','MailApplications','FaxApplications','Mohs','whatsapp_interaction_has_tags','ItemTypeId','CmHopperId','CmContactHasItem','Trigger','AllConditions','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','DefaultReportId','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','Subject','Description','Field','FieldId','VariableId','SugarcrmField','ZohoAccount','ZohoField','ServicenowField','Dynamics365Field','SessionId','JscriptyAnswerReport','ProjectId','user_has_teams','MailQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromAccount','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','userProfileId','UserProfileSection','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','WhatsappQueueId','UserSetting','exports','../config/environment','sequelize','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','mysql','database','username','options','User','import','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceDialReport','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','../api/action/action.model','Automation','CannedAnswer','Disposition','../api/disposition/disposition.model','Condition','Interval','../api/interval/interval.model','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x5009,0x16c));var _0x9500=function(_0x20384b,_0x3a307c){_0x20384b=_0x20384b-0x0;var _0x19fe0a=_0x5009[_0x20384b];return _0x19fe0a;};'use strict';var config=require(_0x9500('0x0'));var Sequelize=require(_0x9500('0x1'));var _=require('lodash');var jstz=require(_0x9500('0x2'));var timezone=jstz[_0x9500('0x3')]();config[_0x9500('0x1')]=_[_0x9500('0x4')](config[_0x9500('0x1')],{'database':_0x9500('0x5'),'username':_0x9500('0x6'),'password':_0x9500('0x7'),'options':{'host':_0x9500('0x8'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x9500('0x9')},'logging':![],'timezone':timezone[_0x9500('0xa')](),'define':{'charset':_0x9500('0xb'),'collate':_0x9500('0xc')}}});config[_0x9500('0xd')]=_[_0x9500('0x4')](config[_0x9500('0xd')],{'database':_0x9500('0x5'),'username':'xcall','password':_0x9500('0x7'),'options':{'host':_0x9500('0x8'),'port':0xcea,'dialect':_0x9500('0xe'),'dialectOptions':{'charset':_0x9500('0x9')},'logging':![],'timezone':timezone[_0x9500('0xa')](),'define':{'charset':'utf8','collate':_0x9500('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x9500('0x1')][_0x9500('0xf')],config['sequelize']['username'],config['sequelize']['password'],config[_0x9500('0x1')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory']['database'],config['sequelizeHistory'][_0x9500('0x10')],config[_0x9500('0xd')]['password'],config[_0x9500('0xd')][_0x9500('0x11')])};db[_0x9500('0x12')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0x14'));db['VoiceChanSpy']=db['sequelize']['import'](_0x9500('0x15'));db['VoiceContext']=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0x16'));db[_0x9500('0x17')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0x18'));db[_0x9500('0x19')]=db[_0x9500('0x1')]['import'](_0x9500('0x1a'));db[_0x9500('0x1b')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0x1c'));db[_0x9500('0x1d')]=db[_0x9500('0x1')][_0x9500('0x13')]('../api/voiceRecording/voiceRecording.model');db[_0x9500('0x1e')]=db[_0x9500('0x1')]['import'](_0x9500('0x1f'));db['VoiceMail']=db[_0x9500('0x1')][_0x9500('0x13')]('../api/voiceMail/voiceMail.model');db['VoiceMailMessage']=db[_0x9500('0x1')][_0x9500('0x13')]('../api/voiceMailMessage/voiceMailMessage.model');db['VoiceCallReport']=db[_0x9500('0x1')][_0x9500('0x13')]('../api/voiceCallReport/voiceCallReport.model');db[_0x9500('0x20')]=db[_0x9500('0x1')]['import']('../api/voiceDialReport/voiceDialReport.model');db[_0x9500('0x21')]=db[_0x9500('0x1')]['import'](_0x9500('0x22'));db[_0x9500('0x23')]=db[_0x9500('0x1')][_0x9500('0x13')]('../api/voiceQueueReport/voiceQueueReport.model');db['MemberReport']=db['sequelize']['import'](_0x9500('0x24'));db[_0x9500('0x25')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0x26'));db[_0x9500('0x27')]=db['sequelize'][_0x9500('0x13')](_0x9500('0x28'));db[_0x9500('0x29')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0x2a'));db[_0x9500('0x2b')]=db['sequelize']['import'](_0x9500('0x2c'));db[_0x9500('0x2d')]=db['sequelize']['import'](_0x9500('0x2e'));db['UserMailQueue']=db[_0x9500('0x1')][_0x9500('0x13')]('../api/userMailQueue/userMailQueue.model');db['UserFaxQueue']=db['sequelize'][_0x9500('0x13')](_0x9500('0x2f'));db[_0x9500('0x30')]=db['sequelize'][_0x9500('0x13')](_0x9500('0x31'));db[_0x9500('0x32')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0x33'));db[_0x9500('0x34')]=db[_0x9500('0x1')][_0x9500('0x13')]('../api/userWhatsappQueue/userWhatsappQueue.model');db['MailServerIn']=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0x35'));db[_0x9500('0x36')]=db['sequelize']['import'](_0x9500('0x37'));db[_0x9500('0x38')]=db[_0x9500('0x1')][_0x9500('0x13')]('../api/mailAccount/mailAccount.model');db[_0x9500('0x39')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0x3a'));db[_0x9500('0x3b')]=db[_0x9500('0x1')][_0x9500('0x13')]('../api/mailSubstatus/mailSubstatus.model');db[_0x9500('0x3c')]=db[_0x9500('0x1')]['import'](_0x9500('0x3d'));db[_0x9500('0x3e')]=db[_0x9500('0x1')][_0x9500('0x13')]('../api/mailMessage/mailMessage.model');db[_0x9500('0x3f')]=db[_0x9500('0x1')][_0x9500('0x13')]('../api/mailApplication/mailApplication.model');db['MailQueueReport']=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0x40'));db[_0x9500('0x41')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0x42'));db['DashboardItem']=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0x43'));db[_0x9500('0x44')]=db[_0x9500('0x1')]['import']('../api/faxAccount/faxAccount.model');db[_0x9500('0x45')]=db['sequelize'][_0x9500('0x13')](_0x9500('0x46'));db[_0x9500('0x47')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0x48'));db[_0x9500('0x49')]=db[_0x9500('0x1')]['import'](_0x9500('0x4a'));db[_0x9500('0x4b')]=db[_0x9500('0x1')]['import'](_0x9500('0x4c'));db[_0x9500('0x4d')]=db[_0x9500('0x1')]['import'](_0x9500('0x4e'));db[_0x9500('0x4f')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0x50'));db['SmsApplication']=db[_0x9500('0x1')][_0x9500('0x13')]('../api/smsApplication/smsApplication.model');db[_0x9500('0x51')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0x52'));db[_0x9500('0x53')]=db['sequelize'][_0x9500('0x13')]('../api/smsMessage/smsMessage.model');db['SmsQueue']=db[_0x9500('0x1')][_0x9500('0x13')]('../api/smsQueue/smsQueue.model');db['OpenchannelAccount']=db[_0x9500('0x1')]['import'](_0x9500('0x54'));db['OpenchannelApplication']=db['sequelize'][_0x9500('0x13')](_0x9500('0x55'));db[_0x9500('0x56')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0x57'));db[_0x9500('0x58')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0x59'));db[_0x9500('0x5a')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0x5b'));db[_0x9500('0x5c')]=db[_0x9500('0x1')]['import'](_0x9500('0x5d'));db[_0x9500('0x5e')]=db[_0x9500('0x1')][_0x9500('0x13')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x9500('0x5f')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0x60'));db['ChatInteraction']=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0x61'));db[_0x9500('0x62')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0x63'));db[_0x9500('0x64')]=db[_0x9500('0x1')]['import'](_0x9500('0x65'));db[_0x9500('0x66')]=db[_0x9500('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x9500('0x67')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0x68'));db['ChatProactiveAction']=db['sequelize'][_0x9500('0x13')](_0x9500('0x69'));db[_0x9500('0x6a')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0x6b'));db[_0x9500('0x6c')]=db['sequelize'][_0x9500('0x13')](_0x9500('0x6d'));db[_0x9500('0x6e')]=db[_0x9500('0x1')]['import'](_0x9500('0x6f'));db[_0x9500('0x70')]=db[_0x9500('0x1')][_0x9500('0x13')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0x9500('0x71')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0x72'));db[_0x9500('0x73')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0x74'));db[_0x9500('0x75')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0x76'));db['CmCustomField']=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0x77'));db['Action']=db['sequelize']['import'](_0x9500('0x78'));db[_0x9500('0x79')]=db[_0x9500('0x1')][_0x9500('0x13')]('../api/automation/automation.model');db[_0x9500('0x7a')]=db[_0x9500('0x1')][_0x9500('0x13')]('../api/cannedAnswer/cannedAnswer.model');db[_0x9500('0x7b')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0x7c'));db[_0x9500('0x7d')]=db['sequelize'][_0x9500('0x13')]('../api/condition/condition.model');db[_0x9500('0x7e')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0x7f'));db['Pause']=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0x80'));db[_0x9500('0x81')]=db[_0x9500('0x1')]['import'](_0x9500('0x82'));db[_0x9500('0x83')]=db['sequelize']['import'](_0x9500('0x84'));db[_0x9500('0x85')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0x86'));db[_0x9500('0x87')]=db['sequelize'][_0x9500('0x13')](_0x9500('0x88'));db[_0x9500('0x89')]=db['sequelize'][_0x9500('0x13')](_0x9500('0x8a'));db[_0x9500('0x8b')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0x8c'));db['CmContactHasItem']=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0x8d'));db[_0x9500('0x8e')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0x8f'));db[_0x9500('0x90')]=db[_0x9500('0x1')][_0x9500('0x13')]('../api/template/template.model');db['Trigger']=db['sequelize'][_0x9500('0x13')](_0x9500('0x91'));db[_0x9500('0x92')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0x93'));db[_0x9500('0x94')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0x95'));db[_0x9500('0x96')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0x97'));db[_0x9500('0x98')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0x99'));db[_0x9500('0x9a')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0x9b'));db[_0x9500('0x9c')]=db['sequelize'][_0x9500('0x13')]('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0x9500('0x9d')]=db[_0x9500('0x1')]['import'](_0x9500('0x9e'));db[_0x9500('0x9f')]=db[_0x9500('0x1')]['import'](_0x9500('0xa0'));db[_0x9500('0xa1')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0xa2'));db[_0x9500('0xa3')]=db[_0x9500('0x1')]['import'](_0x9500('0xa4'));db[_0x9500('0xa5')]=db['sequelize'][_0x9500('0x13')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0x9500('0xa6')]=db[_0x9500('0x1')][_0x9500('0x13')]('../api/intSalesforceField/intSalesforceField.model');db[_0x9500('0xa7')]=db['sequelize'][_0x9500('0x13')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x9500('0xa8')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0xa9'));db['SugarcrmField']=db[_0x9500('0x1')]['import']('../api/intSugarcrmField/intSugarcrmField.model');db[_0x9500('0xaa')]=db['sequelize'][_0x9500('0x13')](_0x9500('0xab'));db[_0x9500('0xac')]=db['sequelize'][_0x9500('0x13')](_0x9500('0xad'));db[_0x9500('0xae')]=db[_0x9500('0x1')][_0x9500('0x13')]('../api/intDeskField/intDeskField.model');db['ZohoAccount']=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0xaf'));db[_0x9500('0xb0')]=db[_0x9500('0x1')][_0x9500('0x13')]('../api/intZohoConfiguration/intZohoConfiguration.model');db['ZohoField']=db['sequelize'][_0x9500('0x13')]('../api/intZohoField/intZohoField.model');db[_0x9500('0xb1')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0xb2'));db[_0x9500('0xb3')]=db[_0x9500('0x1')]['import'](_0x9500('0xb4'));db[_0x9500('0xb5')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0xb6'));db[_0x9500('0xb7')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0xb8'));db[_0x9500('0xb9')]=db[_0x9500('0x1')]['import'](_0x9500('0xba'));db[_0x9500('0xbb')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0xbc'));db[_0x9500('0xbd')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0xbe'));db[_0x9500('0xbf')]=db['sequelize']['import']('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x9500('0xc0')]=db[_0x9500('0x1')][_0x9500('0x13')]('../api/intVtigerField/intVtigerField.model');db[_0x9500('0xc1')]=db['sequelize'][_0x9500('0x13')](_0x9500('0xc2'));db[_0x9500('0xc3')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0xc4'));db['ServicenowField']=db[_0x9500('0x1')]['import']('../api/intServicenowField/intServicenowField.model');db[_0x9500('0xc5')]=db[_0x9500('0x1')]['import'](_0x9500('0xc6'));db[_0x9500('0xc7')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0xc8'));db['Dynamics365Field']=db['sequelize'][_0x9500('0x13')](_0x9500('0xc9'));db[_0x9500('0xca')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0xcb'));db[_0x9500('0xcc')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0xcd'));db[_0x9500('0xce')]=db['sequelize']['import'](_0x9500('0xcf'));db[_0x9500('0x94')]=db[_0x9500('0x1')]['import'](_0x9500('0x95'));db['Network']=db[_0x9500('0x1')]['import'](_0x9500('0xd0'));db[_0x9500('0xd1')]=db['sequelize'][_0x9500('0x13')]('../api/chatQueueReport/chatQueueReport.model');db[_0x9500('0xd2')]=db['sequelize'][_0x9500('0x13')](_0x9500('0xd3'));db['JscriptyAnswerReport']=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0xd4'));db[_0x9500('0xd5')]=db[_0x9500('0x1')][_0x9500('0x13')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db['JscriptySessionReport']=db[_0x9500('0x1')]['import']('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x9500('0xd6')]=db['sequelize'][_0x9500('0x13')](_0x9500('0xd7'));db[_0x9500('0xd8')]=db[_0x9500('0x1')]['import'](_0x9500('0xd9'));db[_0x9500('0xda')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0xdb'));db[_0x9500('0xdc')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0xdd'));db['Setting']=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0xde'));db[_0x9500('0xdf')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0xe0'));db[_0x9500('0xe1')]=db['sequelize']['import'](_0x9500('0xe2'));db[_0x9500('0xe3')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0xe4'));db[_0x9500('0xe5')]=db['sequelize'][_0x9500('0x13')](_0x9500('0xe6'));db[_0x9500('0xe7')]=db['sequelize'][_0x9500('0x13')](_0x9500('0xe8'));db[_0x9500('0xe9')]=db['sequelize'][_0x9500('0x13')](_0x9500('0xea'));db[_0x9500('0xeb')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0xec'));db[_0x9500('0xed')]=db[_0x9500('0x1')][_0x9500('0x13')]('../api/migration/migration.model');db[_0x9500('0xee')]=db['sequelize']['import'](_0x9500('0xef'));db[_0x9500('0xf0')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0xf1'));db[_0x9500('0xf2')]=db['sequelize'][_0x9500('0x13')](_0x9500('0xf3'));db[_0x9500('0xf4')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0xf5'));db[_0x9500('0xf6')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0xf7'));db[_0x9500('0xf8')]=db[_0x9500('0x1')]['import'](_0x9500('0xf9'));db[_0x9500('0xfa')]=db[_0x9500('0x1')]['import'](_0x9500('0xfb'));db['CmList']=db['sequelize']['import'](_0x9500('0xfc'));db[_0x9500('0xfd')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0xfe'));db[_0x9500('0xff')]=db[_0x9500('0x1')][_0x9500('0x13')]('../api/userProfile/userProfile.model');db['UserProfileSection']=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0x100'));db[_0x9500('0x101')]=db[_0x9500('0x1')]['import'](_0x9500('0x102'));db[_0x9500('0x103')]=db[_0x9500('0x1')][_0x9500('0x13')]('../api/userNotification/userNotification.model');db[_0x9500('0x104')]=db[_0x9500('0x1')]['import'](_0x9500('0x105'));db['WhatsappApplication']=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0x106'));db['WhatsappInteraction']=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0x107'));db[_0x9500('0x108')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0x109'));db[_0x9500('0x10a')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0x10b'));db[_0x9500('0x10c')]=db['sequelize'][_0x9500('0x13')]('../api/whatsappTransferReport/whatsappTransferReport.model');db['WhatsappQueue']=db['sequelize'][_0x9500('0x13')](_0x9500('0x10d'));db[_0x9500('0x10e')]=db[_0x9500('0x1')]['import'](_0x9500('0x10f'));db[_0x9500('0x110')]=db[_0x9500('0x1')][_0x9500('0x13')]('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0x9500('0x111')]=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0x112'));db['UserVoicePrefix']=db[_0x9500('0x1')][_0x9500('0x13')](_0x9500('0x113'));db['UserSetting']=db[_0x9500('0x1')][_0x9500('0x13')]('../api/user-setting/user-setting.model');db[_0x9500('0x12')]['hasOne'](db[_0x9500('0x114')],{'as':'VoiceMail','onDelete':_0x9500('0x115'),'foreignKey':_0x9500('0x116')});db['User'][_0x9500('0x117')](db['UserSetting'],{'as':'userSetting','onDelete':_0x9500('0x115'),'foreignKey':'UserId'});db[_0x9500('0x12')][_0x9500('0x118')](db[_0x9500('0x1d')],{'as':'Recordings','foreignKey':_0x9500('0x116')});db[_0x9500('0x12')]['hasMany'](db[_0x9500('0x29')],{'as':_0x9500('0x119'),'foreignKey':_0x9500('0x116')});db[_0x9500('0x12')][_0x9500('0x118')](db[_0x9500('0x17')],{'as':_0x9500('0x11a'),'onDelete':_0x9500('0x115'),'hooks':!![]});db[_0x9500('0x12')]['hasMany'](db[_0x9500('0x71')],{'as':_0x9500('0x11b'),'foreignKey':_0x9500('0x116')});db[_0x9500('0x12')]['hasMany'](db['CmHopperHistory'],{'as':_0x9500('0x11c'),'foreignKey':_0x9500('0x116')});db['User']['hasMany'](db[_0x9500('0x75')],{'as':_0x9500('0x75'),'foreignKey':_0x9500('0x116')});db[_0x9500('0x12')][_0x9500('0x118')](db[_0x9500('0x56')],{'as':_0x9500('0x11d'),'foreignKey':_0x9500('0x116')});db['User'][_0x9500('0x118')](db[_0x9500('0x11e')],{'as':_0x9500('0x11f'),'foreignKey':_0x9500('0x116')});db[_0x9500('0x12')][_0x9500('0x118')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x9500('0x116')});db[_0x9500('0x12')]['hasMany'](db[_0x9500('0x47')],{'as':_0x9500('0x120'),'foreignKey':_0x9500('0x116')});db[_0x9500('0x12')][_0x9500('0x118')](db['MailInteraction'],{'as':_0x9500('0x121'),'foreignKey':'UserId'});db[_0x9500('0x12')][_0x9500('0x118')](db[_0x9500('0x122')],{'as':_0x9500('0x123'),'foreignKey':_0x9500('0x116')});db[_0x9500('0x12')][_0x9500('0x118')](db[_0x9500('0x103')],{'as':'UserNotifications','foreignKey':_0x9500('0x124')});db[_0x9500('0x12')][_0x9500('0x125')](db[_0x9500('0xff')],{'as':_0x9500('0xff'),'foreignKey':'userProfileId'});db['User'][_0x9500('0x126')](db[_0x9500('0x67')],{'as':_0x9500('0x127'),'through':'chat_group_has_users'});db['User'][_0x9500('0x126')](db[_0x9500('0x6c')],{'as':_0x9500('0x128'),'through':'cm_user_has_contacts'});db['User'][_0x9500('0x126')](db[_0x9500('0x129')],{'as':_0x9500('0x12a'),'through':_0x9500('0x12b')});db[_0x9500('0x12')][_0x9500('0x126')](db[_0x9500('0xe7')],{'through':'user_has_teams'});db['User'][_0x9500('0x126')](db[_0x9500('0x3c')],{'as':_0x9500('0x121'),'through':_0x9500('0x12c')});db[_0x9500('0x12')][_0x9500('0x126')](db[_0x9500('0x11e')],{'as':_0x9500('0x11f'),'through':_0x9500('0x12d')});db['User'][_0x9500('0x126')](db[_0x9500('0x47')],{'as':_0x9500('0x120'),'through':_0x9500('0x12e')});db['User'][_0x9500('0x126')](db['SmsInteraction'],{'as':_0x9500('0x12f'),'through':_0x9500('0x130')});db[_0x9500('0x12')][_0x9500('0x126')](db[_0x9500('0x56')],{'as':'OpenchannelInteractions','through':'user_has_openchannel_interactions'});db[_0x9500('0x12')][_0x9500('0x126')](db[_0x9500('0x122')],{'as':_0x9500('0x123'),'through':_0x9500('0x131')});db[_0x9500('0x12')][_0x9500('0x126')](db[_0x9500('0x1b')],{'as':_0x9500('0x132'),'through':_0x9500('0x2b'),'required':![]});db[_0x9500('0x12')][_0x9500('0x126')](db[_0x9500('0xfd')],{'as':_0x9500('0x133'),'through':_0x9500('0x134'),'required':![]});db[_0x9500('0x12')]['belongsToMany'](db[_0x9500('0x39')],{'as':'MailQueues','through':_0x9500('0x135'),'required':![]});db[_0x9500('0x12')][_0x9500('0x126')](db[_0x9500('0x66')],{'as':_0x9500('0x136'),'through':_0x9500('0x2d'),'required':![],'hooks':!![]});db[_0x9500('0x12')][_0x9500('0x126')](db[_0x9500('0x4b')],{'as':_0x9500('0x137'),'through':_0x9500('0x138'),'required':![]});db[_0x9500('0x12')][_0x9500('0x126')](db[_0x9500('0x139')],{'as':_0x9500('0x13a'),'through':_0x9500('0x30'),'required':![]});db['User'][_0x9500('0x126')](db[_0x9500('0x5a')],{'as':_0x9500('0x13b'),'through':_0x9500('0x32'),'required':![]});db[_0x9500('0x12')][_0x9500('0x126')](db[_0x9500('0x13c')],{'as':_0x9500('0x13d'),'through':_0x9500('0x34'),'required':![]});db[_0x9500('0x12')][_0x9500('0x126')](db['CmList'],{'through':_0x9500('0x12b')});db[_0x9500('0x12')][_0x9500('0x126')](db[_0x9500('0x5c')],{'as':_0x9500('0x13e'),'through':_0x9500('0x13f')});db[_0x9500('0x12')][_0x9500('0x126')](db[_0x9500('0x44')],{'as':_0x9500('0x140'),'through':_0x9500('0x141')});db[_0x9500('0x12')][_0x9500('0x126')](db[_0x9500('0x38')],{'as':_0x9500('0x142'),'through':'user_has_mail_accounts'});db['User'][_0x9500('0x126')](db[_0x9500('0x143')],{'as':_0x9500('0x144'),'through':_0x9500('0x145')});db[_0x9500('0x12')]['belongsToMany'](db[_0x9500('0x4f')],{'as':_0x9500('0x146'),'through':_0x9500('0x147')});db['User'][_0x9500('0x126')](db[_0x9500('0x104')],{'as':'WhatsappAccounts','through':'user_has_whatsapp_accounts'});db[_0x9500('0x148')][_0x9500('0x118')](db['VoiceExtension'],{'as':_0x9500('0x149'),'onDelete':_0x9500('0x115'),'foreignKey':'ChanSpyId'});db[_0x9500('0x14a')][_0x9500('0x118')](db[_0x9500('0x17')],{'onDelete':_0x9500('0x115')});db[_0x9500('0x17')][_0x9500('0x118')](db[_0x9500('0x17')],{'as':_0x9500('0x14b'),'onDelete':_0x9500('0x115')});db['VoiceMusicOnHold'][_0x9500('0x126')](db[_0x9500('0x87')],{'as':_0x9500('0x14c'),'through':_0x9500('0x14d')});db['VoiceQueue']['hasMany'](db[_0x9500('0x29')],{'as':_0x9500('0x14e'),'foreignKey':_0x9500('0x14f')});db[_0x9500('0x1b')][_0x9500('0x118')](db[_0x9500('0x6e')],{'as':_0x9500('0x150'),'foreignKey':_0x9500('0x14f')});db[_0x9500('0x1b')][_0x9500('0x118')](db[_0x9500('0x71')],{'as':_0x9500('0x11b'),'foreignKey':_0x9500('0x14f')});db['VoiceQueue']['hasMany'](db['CmHopperHistory'],{'as':_0x9500('0x151'),'foreignKey':_0x9500('0x14f')});db[_0x9500('0x1b')][_0x9500('0x118')](db[_0x9500('0x75')],{'as':_0x9500('0x75'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x9500('0x118')](db[_0x9500('0x70')],{'as':'HopperBlacks','foreignKey':_0x9500('0x14f')});db[_0x9500('0x1b')][_0x9500('0x118')](db[_0x9500('0x152')],{'as':_0x9500('0x153'),'foreignKey':_0x9500('0x14f')});db[_0x9500('0x1b')]['belongsTo'](db[_0x9500('0x25')],{'as':'Trunk','foreignKey':_0x9500('0x154')});db[_0x9500('0x1b')]['belongsTo'](db[_0x9500('0x25')],{'as':_0x9500('0x155'),'foreignKey':_0x9500('0x156')});db[_0x9500('0x1b')]['belongsTo'](db[_0x9500('0x7e')],{'as':'Interval','foreignKey':_0x9500('0x157')});db['VoiceQueue'][_0x9500('0x125')](db[_0x9500('0x158')],{'as':_0x9500('0x159'),'foreignKey':'mandatoryDispositionPauseId'});db['VoiceQueue'][_0x9500('0x126')](db['CmList'],{'as':_0x9500('0x12a'),'through':_0x9500('0x15a')});db[_0x9500('0x1b')][_0x9500('0x126')](db[_0x9500('0x12')],{'as':_0x9500('0x15b'),'through':_0x9500('0x2b')});db[_0x9500('0x1b')]['belongsToMany'](db[_0x9500('0xe7')],{'as':_0x9500('0x15c'),'through':_0x9500('0x110')});db['VoiceQueue'][_0x9500('0x126')](db[_0x9500('0x129')],{'as':_0x9500('0x15d'),'through':_0x9500('0x15e')});db[_0x9500('0x1d')]['belongsTo'](db[_0x9500('0x12')],{'as':_0x9500('0x12'),'foreignKey':_0x9500('0x116')});db[_0x9500('0x1e')][_0x9500('0x125')](db[_0x9500('0x12')],{'as':'User','foreignKey':'UserId'});db['VoiceMail'][_0x9500('0x118')](db[_0x9500('0x15f')],{'as':_0x9500('0x160'),'onDelete':_0x9500('0x115'),'foreignKey':_0x9500('0x161'),'sourceKey':_0x9500('0x162')});db[_0x9500('0x15f')]['belongsTo'](db[_0x9500('0x114')],{'foreignKey':'mailboxuser','targetKey':'mailbox'});db['VoiceCallReport'][_0x9500('0x118')](db['VoiceQueueReport'],{'as':_0x9500('0x163'),'foreignKey':_0x9500('0x164'),'constraints':![]});db[_0x9500('0x165')][_0x9500('0x118')](db[_0x9500('0x21')],{'as':_0x9500('0x166'),'foreignKey':'uniqueid','constraints':![]});db[_0x9500('0x165')][_0x9500('0x125')](db[_0x9500('0x12')],{'as':_0x9500('0x12'),'foreignKey':_0x9500('0x116')});db[_0x9500('0x165')]['belongsTo'](db[_0x9500('0x6c')],{'as':_0x9500('0x167'),'foreignKey':_0x9500('0x168')});db['MailServerIn'][_0x9500('0x125')](db['MailAccount'],{'as':_0x9500('0x38'),'foreignKey':_0x9500('0x169')});db[_0x9500('0x16a')][_0x9500('0x125')](db[_0x9500('0x10e')],{'as':'CloudProvider','foreignKey':_0x9500('0x16b'),'onDelete':_0x9500('0x16c')});db[_0x9500('0x36')][_0x9500('0x125')](db[_0x9500('0x38')],{'as':_0x9500('0x38'),'foreignKey':_0x9500('0x169')});db[_0x9500('0x36')][_0x9500('0x125')](db[_0x9500('0x10e')],{'as':'CloudProvider','foreignKey':'CloudProviderId','onDelete':_0x9500('0x16c')});db[_0x9500('0x38')]['hasOne'](db[_0x9500('0x16a')],{'as':_0x9500('0x16d'),'onDelete':'cascade'});db[_0x9500('0x38')][_0x9500('0x117')](db[_0x9500('0x36')],{'as':_0x9500('0x16e'),'onDelete':_0x9500('0x115')});db[_0x9500('0x38')]['hasMany'](db[_0x9500('0x7b')],{'as':_0x9500('0x16f'),'foreignKey':'MailAccountId','onDelete':_0x9500('0x115')});db['MailAccount']['hasMany'](db[_0x9500('0x7a')],{'as':_0x9500('0x170'),'foreignKey':_0x9500('0x169')});db[_0x9500('0x38')][_0x9500('0x118')](db[_0x9500('0x3e')],{'as':_0x9500('0x160'),'foreignKey':_0x9500('0x169')});db[_0x9500('0x38')][_0x9500('0x118')](db[_0x9500('0x3c')],{'as':_0x9500('0x171')});db[_0x9500('0x38')][_0x9500('0x118')](db['MailApplication'],{'as':_0x9500('0x14b')});db[_0x9500('0x38')][_0x9500('0x125')](db[_0x9500('0x129')],{'as':_0x9500('0x172'),'foreignKey':'ListId'});db['MailAccount'][_0x9500('0x125')](db[_0x9500('0x90')],{'as':_0x9500('0x90'),'foreignKey':_0x9500('0x173')});db[_0x9500('0x38')][_0x9500('0x125')](db[_0x9500('0x158')],{'as':_0x9500('0x159'),'foreignKey':_0x9500('0x174')});db[_0x9500('0x38')][_0x9500('0x126')](db['User'],{'as':_0x9500('0x15b'),'through':'user_has_mail_accounts'});db[_0x9500('0x39')][_0x9500('0x126')](db[_0x9500('0x12')],{'as':_0x9500('0x15b'),'through':'UserMailQueue'});db[_0x9500('0x39')][_0x9500('0x126')](db['Team'],{'through':_0x9500('0x175'),'as':'Teams'});db['MailInteraction'][_0x9500('0x118')](db['MailMessage'],{'as':_0x9500('0x160'),'onDelete':_0x9500('0x115'),'foreignKey':_0x9500('0x176')});db[_0x9500('0x3c')][_0x9500('0x125')](db[_0x9500('0x38')],{'as':_0x9500('0x177'),'foreignKey':_0x9500('0x169')});db[_0x9500('0x3c')]['belongsTo'](db[_0x9500('0x6c')],{'as':_0x9500('0x167'),'foreignKey':_0x9500('0x168')});db[_0x9500('0x3c')][_0x9500('0x125')](db[_0x9500('0x12')],{'as':_0x9500('0x178'),'foreignKey':_0x9500('0x116')});db['MailInteraction'][_0x9500('0x126')](db[_0x9500('0x89')],{'through':'mail_interaction_has_tags','as':'Tags'});db[_0x9500('0x3c')][_0x9500('0x126')](db['Tag'],{'through':_0x9500('0x179'),'as':_0x9500('0x17a')});db['MailInteraction'][_0x9500('0x126')](db[_0x9500('0x12')],{'as':_0x9500('0x17b'),'through':_0x9500('0x12c'),'foreignKey':_0x9500('0x176')});db[_0x9500('0x3e')]['hasMany'](db[_0x9500('0xee')],{'as':_0x9500('0x17c'),'onDelete':'cascade'});db['MailMessage'][_0x9500('0x125')](db[_0x9500('0x12')],{'as':'User'});db['MailMessage'][_0x9500('0x125')](db[_0x9500('0x6c')],{'onDelete':_0x9500('0x115'),'as':_0x9500('0x167')});db['MailMessage'][_0x9500('0x125')](db[_0x9500('0x3c')],{'as':'Interaction','foreignKey':_0x9500('0x176')});db[_0x9500('0x3e')][_0x9500('0x125')](db['MailAccount'],{'as':'Account','foreignKey':_0x9500('0x169')});db[_0x9500('0x3e')][_0x9500('0x125')](db[_0x9500('0x5c')],{'as':_0x9500('0x5c'),'foreignKey':_0x9500('0x17d')});db['MailMessage'][_0x9500('0x125')](db[_0x9500('0x64')],{'as':'ChatOfflineMessage','foreignKey':_0x9500('0x17e')});db[_0x9500('0x3f')]['belongsTo'](db[_0x9500('0x12')],{'onDelete':_0x9500('0x16c')});db[_0x9500('0x3f')][_0x9500('0x125')](db['MailQueue'],{'onDelete':'restrict'});db[_0x9500('0x3f')][_0x9500('0x125')](db[_0x9500('0x38')],{'onDelete':_0x9500('0x16c')});db[_0x9500('0x3f')][_0x9500('0x125')](db[_0x9500('0x7e')],{'onDelete':_0x9500('0x16c'),'foreignKey':_0x9500('0x157')});db[_0x9500('0x3f')][_0x9500('0x125')](db[_0x9500('0x89')],{'onDelete':'restrict','foreignKey':_0x9500('0x17f')});db[_0x9500('0x180')][_0x9500('0x125')](db[_0x9500('0x38')],{});db[_0x9500('0x180')]['belongsTo'](db[_0x9500('0x129')],{'as':'List','foreignKey':_0x9500('0x181')});db['MailQueueReport'][_0x9500('0x125')](db[_0x9500('0x6c')],{'as':_0x9500('0x167'),'foreignKey':_0x9500('0x168')});db[_0x9500('0x180')][_0x9500('0x125')](db[_0x9500('0x3c')],{});db['MailQueueReport'][_0x9500('0x125')](db[_0x9500('0x3e')],{});db[_0x9500('0x180')]['belongsTo'](db[_0x9500('0x12')],{});db[_0x9500('0x180')]['belongsTo'](db[_0x9500('0x39')],{});db[_0x9500('0x41')][_0x9500('0x118')](db[_0x9500('0x182')],{'as':'Items','onDelete':_0x9500('0x115')});db[_0x9500('0x44')][_0x9500('0x118')](db[_0x9500('0x7b')],{'as':_0x9500('0x16f'),'foreignKey':_0x9500('0x183'),'onDelete':_0x9500('0x115')});db[_0x9500('0x44')][_0x9500('0x118')](db[_0x9500('0x7a')],{'as':'Answers','foreignKey':'FaxAccountId'});db[_0x9500('0x44')]['hasMany'](db['FaxInteraction'],{'as':_0x9500('0x171')});db[_0x9500('0x44')][_0x9500('0x118')](db[_0x9500('0x45')],{'as':_0x9500('0x14b')});db[_0x9500('0x44')]['hasMany'](db[_0x9500('0x17')],{'as':_0x9500('0x184'),'onDelete':_0x9500('0x115')});db[_0x9500('0x44')][_0x9500('0x118')](db[_0x9500('0x49')],{'as':'Messages'});db[_0x9500('0x44')][_0x9500('0x125')](db['Trunk'],{'as':_0x9500('0x25')});db[_0x9500('0x44')][_0x9500('0x125')](db[_0x9500('0x129')],{'as':_0x9500('0x172'),'foreignKey':_0x9500('0x181')});db['FaxAccount']['belongsTo'](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x9500('0x44')]['belongsToMany'](db[_0x9500('0x12')],{'as':'Agents','through':'user_has_fax_accounts'});db[_0x9500('0x45')][_0x9500('0x125')](db[_0x9500('0x12')],{'onDelete':_0x9500('0x16c')});db[_0x9500('0x45')][_0x9500('0x125')](db['FaxQueue'],{'onDelete':_0x9500('0x16c')});db[_0x9500('0x45')][_0x9500('0x125')](db[_0x9500('0x44')],{'onDelete':'restrict'});db[_0x9500('0x45')][_0x9500('0x125')](db[_0x9500('0x89')],{'onDelete':_0x9500('0x16c'),'foreignKey':_0x9500('0x17f')});db[_0x9500('0x47')]['hasMany'](db[_0x9500('0x49')],{'as':_0x9500('0x160'),'onDelete':_0x9500('0x115'),'foreignKey':_0x9500('0x185')});db[_0x9500('0x47')][_0x9500('0x125')](db[_0x9500('0x44')],{'as':_0x9500('0x177'),'foreignKey':_0x9500('0x183')});db['FaxInteraction']['belongsTo'](db[_0x9500('0x6c')],{'as':'Contact','foreignKey':_0x9500('0x168')});db[_0x9500('0x47')][_0x9500('0x125')](db['User'],{'as':_0x9500('0x178'),'foreignKey':_0x9500('0x116')});db['FaxInteraction'][_0x9500('0x126')](db[_0x9500('0x89')],{'through':_0x9500('0x186'),'as':_0x9500('0x187')});db[_0x9500('0x47')][_0x9500('0x126')](db[_0x9500('0x89')],{'through':_0x9500('0x186'),'as':_0x9500('0x17a')});db[_0x9500('0x47')][_0x9500('0x126')](db[_0x9500('0x12')],{'as':_0x9500('0x17b'),'through':_0x9500('0x12e'),'foreignKey':_0x9500('0x185')});db[_0x9500('0x49')]['belongsTo'](db['User'],{'onDelete':'cascade','as':_0x9500('0x12')});db[_0x9500('0x49')][_0x9500('0x125')](db[_0x9500('0x47')],{'as':_0x9500('0x188'),'foreignKey':_0x9500('0x185')});db['FaxMessage'][_0x9500('0x125')](db[_0x9500('0x6c')],{'onDelete':_0x9500('0x115'),'as':_0x9500('0x167')});db[_0x9500('0x49')][_0x9500('0x125')](db[_0x9500('0xee')],{'as':'Attachment','foreignKey':_0x9500('0x189')});db['FaxMessage'][_0x9500('0x125')](db['FaxAccount'],{'as':_0x9500('0x177'),'foreignKey':_0x9500('0x183')});db['FaxQueue'][_0x9500('0x126')](db['User'],{'as':_0x9500('0x15b'),'through':_0x9500('0x138')});db[_0x9500('0x4b')][_0x9500('0x126')](db['Team'],{'through':_0x9500('0x18a'),'as':'Teams'});db[_0x9500('0x4d')][_0x9500('0x125')](db[_0x9500('0x44')],{});db[_0x9500('0x4d')][_0x9500('0x125')](db[_0x9500('0x129')],{'as':_0x9500('0x172'),'foreignKey':_0x9500('0x181')});db[_0x9500('0x4d')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0x9500('0x168')});db['FaxQueueReport']['belongsTo'](db['FaxInteraction'],{});db[_0x9500('0x4d')][_0x9500('0x125')](db[_0x9500('0x49')],{});db[_0x9500('0x4d')][_0x9500('0x125')](db[_0x9500('0x12')],{});db[_0x9500('0x4d')][_0x9500('0x125')](db[_0x9500('0x4b')],{});db[_0x9500('0x4f')][_0x9500('0x118')](db[_0x9500('0x7b')],{'as':_0x9500('0x16f'),'foreignKey':_0x9500('0x18b'),'onDelete':_0x9500('0x115')});db['SmsAccount'][_0x9500('0x118')](db[_0x9500('0x7a')],{'as':_0x9500('0x170'),'foreignKey':_0x9500('0x18b')});db['SmsAccount'][_0x9500('0x118')](db[_0x9500('0x53')],{'as':_0x9500('0x160'),'foreignKey':_0x9500('0x18b')});db[_0x9500('0x4f')]['hasMany'](db[_0x9500('0x51')],{'as':_0x9500('0x171')});db[_0x9500('0x4f')][_0x9500('0x118')](db[_0x9500('0x18c')],{'as':'Applications'});db[_0x9500('0x4f')][_0x9500('0x125')](db[_0x9500('0x129')],{'as':'List','foreignKey':_0x9500('0x181')});db[_0x9500('0x4f')][_0x9500('0x125')](db[_0x9500('0x158')],{'as':_0x9500('0x159'),'foreignKey':_0x9500('0x174')});db[_0x9500('0x4f')][_0x9500('0x126')](db[_0x9500('0x12')],{'as':_0x9500('0x15b'),'through':'user_has_sms_accounts'});db['SmsApplication']['belongsTo'](db[_0x9500('0x12')],{'onDelete':_0x9500('0x16c')});db[_0x9500('0x18c')][_0x9500('0x125')](db[_0x9500('0x139')],{'onDelete':'restrict'});db[_0x9500('0x18c')][_0x9500('0x125')](db[_0x9500('0x4f')],{'onDelete':'restrict'});db[_0x9500('0x18c')]['belongsTo'](db[_0x9500('0x7e')],{'onDelete':_0x9500('0x16c'),'foreignKey':_0x9500('0x157')});db['SmsApplication']['belongsTo'](db[_0x9500('0x89')],{'onDelete':_0x9500('0x16c'),'foreignKey':_0x9500('0x17f')});db[_0x9500('0x51')][_0x9500('0x118')](db[_0x9500('0x53')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x9500('0x18d')});db[_0x9500('0x51')]['belongsTo'](db[_0x9500('0x4f')],{'as':_0x9500('0x177'),'foreignKey':_0x9500('0x18b')});db[_0x9500('0x51')][_0x9500('0x125')](db[_0x9500('0x6c')],{'as':_0x9500('0x167'),'foreignKey':'ContactId'});db[_0x9500('0x51')][_0x9500('0x125')](db[_0x9500('0x12')],{'as':_0x9500('0x178'),'foreignKey':'UserId'});db[_0x9500('0x51')][_0x9500('0x126')](db['Tag'],{'through':_0x9500('0x18e'),'as':'Tags'});db[_0x9500('0x51')]['belongsToMany'](db[_0x9500('0x89')],{'through':_0x9500('0x18e'),'as':_0x9500('0x17a')});db['SmsInteraction']['belongsToMany'](db['User'],{'as':_0x9500('0x17b'),'through':_0x9500('0x130'),'foreignKey':_0x9500('0x18d')});db[_0x9500('0x53')]['belongsTo'](db[_0x9500('0x12')],{'as':_0x9500('0x12')});db[_0x9500('0x53')][_0x9500('0x125')](db[_0x9500('0x6c')],{'onDelete':_0x9500('0x115'),'as':'Contact'});db[_0x9500('0x53')][_0x9500('0x125')](db[_0x9500('0x51')],{'onDelete':_0x9500('0x115'),'as':'Interaction','foreignKey':_0x9500('0x18d')});db[_0x9500('0x53')][_0x9500('0x125')](db['SmsAccount'],{'as':'Account','foreignKey':_0x9500('0x18b')});db[_0x9500('0x139')][_0x9500('0x126')](db[_0x9500('0x12')],{'as':_0x9500('0x15b'),'through':_0x9500('0x30'),'foreignKey':_0x9500('0x18f')});db[_0x9500('0x139')][_0x9500('0x126')](db[_0x9500('0xe7')],{'through':_0x9500('0x190'),'as':_0x9500('0x15c')});db['OpenchannelAccount'][_0x9500('0x118')](db[_0x9500('0x7b')],{'as':_0x9500('0x16f'),'foreignKey':'OpenchannelAccountId','onDelete':_0x9500('0x115')});db[_0x9500('0x143')][_0x9500('0x118')](db[_0x9500('0x7a')],{'as':_0x9500('0x170'),'foreignKey':_0x9500('0x191')});db[_0x9500('0x143')][_0x9500('0x118')](db[_0x9500('0x56')],{'as':_0x9500('0x171'),'foreignKey':_0x9500('0x191')});db[_0x9500('0x143')][_0x9500('0x118')](db['OpenchannelMessage'],{'as':_0x9500('0x160'),'foreignKey':_0x9500('0x191')});db[_0x9500('0x143')][_0x9500('0x118')](db[_0x9500('0x192')],{'as':_0x9500('0x14b'),'foreignKey':_0x9500('0x191')});db[_0x9500('0x143')][_0x9500('0x125')](db[_0x9500('0x129')],{'as':_0x9500('0x172'),'foreignKey':_0x9500('0x181')});db[_0x9500('0x143')][_0x9500('0x125')](db[_0x9500('0x158')],{'as':_0x9500('0x159'),'foreignKey':_0x9500('0x174')});db[_0x9500('0x143')][_0x9500('0x126')](db['User'],{'as':_0x9500('0x15b'),'through':_0x9500('0x145')});db[_0x9500('0x192')]['belongsTo'](db[_0x9500('0x12')],{'onDelete':'restrict'});db['OpenchannelApplication'][_0x9500('0x125')](db[_0x9500('0x5a')],{'onDelete':_0x9500('0x16c'),'foreignKey':_0x9500('0x193')});db['OpenchannelApplication'][_0x9500('0x125')](db['OpenchannelAccount'],{'onDelete':_0x9500('0x16c'),'foreignKey':_0x9500('0x191')});db[_0x9500('0x192')]['belongsTo'](db[_0x9500('0x7e')],{'onDelete':_0x9500('0x16c'),'foreignKey':_0x9500('0x157')});db['OpenchannelApplication'][_0x9500('0x125')](db[_0x9500('0x89')],{'onDelete':_0x9500('0x16c'),'foreignKey':_0x9500('0x17f')});db[_0x9500('0x56')][_0x9500('0x118')](db['OpenchannelMessage'],{'as':_0x9500('0x160'),'onDelete':_0x9500('0x115'),'foreignKey':_0x9500('0x194')});db[_0x9500('0x56')][_0x9500('0x125')](db['OpenchannelAccount'],{'as':_0x9500('0x177'),'foreignKey':_0x9500('0x191')});db['OpenchannelInteraction'][_0x9500('0x125')](db[_0x9500('0x6c')],{'as':'Contact','foreignKey':_0x9500('0x168')});db[_0x9500('0x56')][_0x9500('0x125')](db[_0x9500('0x12')],{'as':_0x9500('0x178'),'foreignKey':'UserId'});db[_0x9500('0x56')][_0x9500('0x126')](db[_0x9500('0x89')],{'through':_0x9500('0x195'),'as':_0x9500('0x187')});db['OpenchannelInteraction']['belongsToMany'](db[_0x9500('0x89')],{'through':'openchannel_interaction_has_tags','as':_0x9500('0x17a')});db['OpenchannelInteraction'][_0x9500('0x126')](db['User'],{'as':'Users','through':_0x9500('0x196'),'foreignKey':_0x9500('0x194')});db[_0x9500('0x58')][_0x9500('0x125')](db[_0x9500('0x12')],{'onDelete':_0x9500('0x115'),'as':_0x9500('0x12')});db[_0x9500('0x58')]['belongsTo'](db[_0x9500('0x6c')],{'onDelete':_0x9500('0x115'),'as':'Contact'});db[_0x9500('0x58')][_0x9500('0x125')](db[_0x9500('0x56')],{'onDelete':_0x9500('0x115'),'as':_0x9500('0x188'),'foreignKey':_0x9500('0x194')});db[_0x9500('0x58')][_0x9500('0x125')](db['Attachment'],{'as':_0x9500('0xee'),'foreignKey':'AttachmentId'});db[_0x9500('0x58')][_0x9500('0x125')](db[_0x9500('0x143')],{'as':_0x9500('0x177'),'foreignKey':_0x9500('0x191')});db[_0x9500('0x5a')]['belongsToMany'](db[_0x9500('0x12')],{'as':_0x9500('0x15b'),'through':'UserOpenchannelQueue','foreignKey':'OpenchannelQueueId'});db[_0x9500('0x5a')]['belongsToMany'](db['Team'],{'through':_0x9500('0x197'),'as':_0x9500('0x15c')});db['ChatWebsite'][_0x9500('0x118')](db[_0x9500('0x7b')],{'as':_0x9500('0x16f'),'foreignKey':_0x9500('0x17d'),'onDelete':_0x9500('0x115')});db[_0x9500('0x5c')][_0x9500('0x118')](db[_0x9500('0x7a')],{'as':_0x9500('0x170'),'foreignKey':_0x9500('0x17d')});db[_0x9500('0x5c')][_0x9500('0x118')](db[_0x9500('0x198')],{'as':_0x9500('0x199')});db['ChatWebsite']['hasMany'](db[_0x9500('0x11e')],{'as':_0x9500('0x171')});db[_0x9500('0x5c')][_0x9500('0x118')](db[_0x9500('0x5f')],{'as':_0x9500('0x14b')});db[_0x9500('0x5c')][_0x9500('0x118')](db[_0x9500('0x62')],{'as':'Messages'});db[_0x9500('0x5c')]['belongsTo'](db[_0x9500('0x129')],{'as':'List','foreignKey':_0x9500('0x181')});db['ChatWebsite'][_0x9500('0x125')](db[_0x9500('0x7e')],{'as':_0x9500('0x7e'),'foreignKey':'IntervalId'});db['ChatWebsite'][_0x9500('0x125')](db[_0x9500('0x38')],{'as':_0x9500('0x38'),'foreignKey':_0x9500('0x169')});db[_0x9500('0x5c')][_0x9500('0x125')](db[_0x9500('0x158')],{'as':_0x9500('0x159'),'foreignKey':_0x9500('0x174')});db[_0x9500('0x5c')]['belongsToMany'](db[_0x9500('0x12')],{'as':_0x9500('0x15b'),'through':_0x9500('0x13f')});db[_0x9500('0x5e')][_0x9500('0x125')](db[_0x9500('0x143')],{});db[_0x9500('0x5e')][_0x9500('0x125')](db[_0x9500('0x129')],{'as':_0x9500('0x172'),'foreignKey':_0x9500('0x181')});db[_0x9500('0x5e')]['belongsTo'](db[_0x9500('0x6c')],{'as':'Contact','foreignKey':_0x9500('0x168')});db[_0x9500('0x5e')][_0x9500('0x125')](db[_0x9500('0x56')],{});db[_0x9500('0x5e')][_0x9500('0x125')](db[_0x9500('0x58')],{});db[_0x9500('0x5e')][_0x9500('0x125')](db['User'],{});db[_0x9500('0x5e')][_0x9500('0x125')](db[_0x9500('0x5a')],{});db[_0x9500('0x5f')][_0x9500('0x125')](db[_0x9500('0x12')],{'as':_0x9500('0x19a'),'foreignKey':_0x9500('0x116'),'onDelete':_0x9500('0x16c')});db['ChatApplication']['belongsTo'](db[_0x9500('0x66')],{'as':_0x9500('0x19b'),'foreignKey':_0x9500('0x19c'),'onDelete':_0x9500('0x16c')});db[_0x9500('0x5f')]['belongsTo'](db[_0x9500('0x5c')],{'as':_0x9500('0x19d'),'foreignKey':_0x9500('0x17d'),'onDelete':'restrict'});db['ChatApplication'][_0x9500('0x125')](db[_0x9500('0x89')],{'onDelete':'restrict','foreignKey':_0x9500('0x17f')});db[_0x9500('0x11e')][_0x9500('0x118')](db['ChatMessage'],{'as':_0x9500('0x160'),'onDelete':'cascade','foreignKey':_0x9500('0x19e')});db[_0x9500('0x11e')][_0x9500('0x125')](db[_0x9500('0x5c')],{'as':_0x9500('0x177'),'foreignKey':_0x9500('0x17d')});db[_0x9500('0x11e')]['belongsTo'](db[_0x9500('0x6c')],{'as':_0x9500('0x167'),'foreignKey':_0x9500('0x168')});db['ChatInteraction'][_0x9500('0x125')](db[_0x9500('0x12')],{'as':_0x9500('0x178'),'foreignKey':'UserId'});db[_0x9500('0x11e')]['belongsToMany'](db['Tag'],{'through':_0x9500('0x19f'),'as':_0x9500('0x187')});db[_0x9500('0x11e')][_0x9500('0x126')](db[_0x9500('0x89')],{'through':_0x9500('0x19f'),'as':_0x9500('0x17a')});db[_0x9500('0x11e')][_0x9500('0x126')](db[_0x9500('0x12')],{'as':_0x9500('0x17b'),'through':_0x9500('0x12d'),'foreignKey':_0x9500('0x19e')});db[_0x9500('0x62')]['belongsTo'](db[_0x9500('0x12')],{'onDelete':'cascade','as':_0x9500('0x12')});db[_0x9500('0x62')]['belongsTo'](db['CmContact'],{'onDelete':_0x9500('0x115'),'as':'Contact','foreignKey':_0x9500('0x168')});db['ChatMessage'][_0x9500('0x125')](db[_0x9500('0x11e')],{'onDelete':'cascade','as':_0x9500('0x188'),'foreignKey':_0x9500('0x19e')});db[_0x9500('0x62')]['belongsTo'](db[_0x9500('0xee')],{'as':_0x9500('0xee'),'foreignKey':_0x9500('0x189')});db[_0x9500('0x62')][_0x9500('0x125')](db['ChatWebsite'],{'as':'Account','foreignKey':_0x9500('0x17d')});db[_0x9500('0x64')][_0x9500('0x118')](db[_0x9500('0xee')],{'as':_0x9500('0x17c'),'foreignKey':_0x9500('0x17e'),'onDelete':_0x9500('0x115'),'hooks':!![]});db[_0x9500('0x64')][_0x9500('0x125')](db[_0x9500('0x6c')],{'onDelete':_0x9500('0x115'),'as':_0x9500('0x167'),'foreignKey':'ContactId'});db[_0x9500('0x64')]['belongsTo'](db['ChatWebsite'],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x9500('0x66')][_0x9500('0x126')](db['User'],{'as':_0x9500('0x15b'),'through':_0x9500('0x2d'),'hooks':!![]});db[_0x9500('0x66')][_0x9500('0x126')](db['Team'],{'through':_0x9500('0x1a0'),'as':'Teams'});db[_0x9500('0x67')]['hasMany'](db[_0x9500('0xd2')],{'as':_0x9500('0x160'),'foreignKey':_0x9500('0x1a1'),'onDelete':'cascade'});db[_0x9500('0x67')]['belongsToMany'](db[_0x9500('0x12')],{'as':_0x9500('0x14e'),'through':_0x9500('0x1a2')});db['ChatProactiveAction']['belongsTo'](db['ChatWebsite'],{'as':_0x9500('0x19d'),'foreignKey':_0x9500('0x17d')});db[_0x9500('0x6a')][_0x9500('0x118')](db[_0x9500('0x6c')],{'as':_0x9500('0x128'),'foreignKey':_0x9500('0x1a3')});db[_0x9500('0x6c')][_0x9500('0x118')](db['CmContactHasItem'],{'as':_0x9500('0x1a4'),'foreignKey':_0x9500('0x1a5')});db[_0x9500('0x6c')][_0x9500('0x118')](db[_0x9500('0x6e')],{'as':_0x9500('0x150'),'foreignKey':'ContactId'});db[_0x9500('0x6c')][_0x9500('0x118')](db[_0x9500('0x71')],{'as':_0x9500('0x11b'),'foreignKey':_0x9500('0x168')});db[_0x9500('0x6c')][_0x9500('0x118')](db['CmHopperHistory'],{'as':_0x9500('0x151'),'foreignKey':_0x9500('0x168')});db[_0x9500('0x6c')][_0x9500('0x118')](db['ReportAgentPreview'],{'as':_0x9500('0x75'),'foreignKey':_0x9500('0x168')});db[_0x9500('0x6c')][_0x9500('0x118')](db[_0x9500('0x152')],{'as':_0x9500('0x153'),'foreignKey':'ContactId'});db[_0x9500('0x6c')]['hasMany'](db[_0x9500('0x56')],{'as':_0x9500('0x11d'),'foreignKey':_0x9500('0x168'),'onDelete':_0x9500('0x16c')});db[_0x9500('0x6c')][_0x9500('0x118')](db[_0x9500('0x11e')],{'as':'ChatInteractions','foreignKey':_0x9500('0x168'),'onDelete':'restrict'});db[_0x9500('0x6c')][_0x9500('0x118')](db[_0x9500('0x51')],{'as':'SmsInteractions','foreignKey':_0x9500('0x168'),'onDelete':_0x9500('0x16c')});db[_0x9500('0x6c')][_0x9500('0x118')](db[_0x9500('0x47')],{'as':'FaxInteractions','foreignKey':_0x9500('0x168'),'onDelete':_0x9500('0x16c')});db['CmContact'][_0x9500('0x118')](db[_0x9500('0x3c')],{'as':_0x9500('0x121'),'foreignKey':_0x9500('0x168'),'onDelete':'restrict'});db['CmContact'][_0x9500('0x125')](db[_0x9500('0x6a')],{'as':_0x9500('0x1a6'),'foreignKey':_0x9500('0x1a3')});db['CmContact'][_0x9500('0x125')](db['CmList'],{'as':_0x9500('0x172'),'foreignKey':_0x9500('0x181'),'onDelete':'cascade'});db[_0x9500('0x6c')][_0x9500('0x126')](db['User'],{'as':_0x9500('0x17b'),'through':_0x9500('0x1a7')});db['CmContact'][_0x9500('0x126')](db['Tag'],{'as':_0x9500('0x187'),'through':'cm_contact_has_tags'});db[_0x9500('0x6c')][_0x9500('0x126')](db[_0x9500('0x89')],{'through':_0x9500('0x1a8'),'as':_0x9500('0x17a')});db[_0x9500('0x6e')][_0x9500('0x118')](db[_0x9500('0x8e')],{'as':_0x9500('0x1a9'),'foreignKey':'CmHopperId'});db[_0x9500('0x6e')][_0x9500('0x125')](db[_0x9500('0x6c')],{'as':_0x9500('0x167'),'foreignKey':'ContactId','onDelete':_0x9500('0x115')});db[_0x9500('0x6e')][_0x9500('0x125')](db[_0x9500('0x129')],{'as':_0x9500('0x172'),'foreignKey':_0x9500('0x181'),'onDelete':_0x9500('0x115')});db[_0x9500('0x6e')][_0x9500('0x125')](db[_0x9500('0x12')],{'as':'Agent','foreignKey':_0x9500('0x116')});db['CmHopper'][_0x9500('0x125')](db[_0x9500('0x1b')],{'as':_0x9500('0x19b'),'foreignKey':'VoiceQueueId','onDelete':_0x9500('0x115')});db[_0x9500('0x6e')][_0x9500('0x125')](db[_0x9500('0xeb')],{'as':_0x9500('0xeb'),'foreignKey':_0x9500('0x1aa'),'onDelete':_0x9500('0x115')});db[_0x9500('0x6e')][_0x9500('0x125')](db[_0x9500('0x12')],{'as':_0x9500('0x178'),'foreignKey':_0x9500('0x1ab')});db['CmHopperBlack'][_0x9500('0x125')](db[_0x9500('0x6c')],{'as':'Contact','foreignKey':_0x9500('0x168'),'onDelete':'cascade'});db[_0x9500('0x70')][_0x9500('0x125')](db[_0x9500('0x129')],{'as':'List','foreignKey':_0x9500('0x181'),'onDelete':_0x9500('0x115')});db[_0x9500('0x70')][_0x9500('0x125')](db[_0x9500('0x1b')],{'as':_0x9500('0x19b'),'foreignKey':_0x9500('0x14f'),'onDelete':_0x9500('0x115')});db[_0x9500('0x70')][_0x9500('0x125')](db[_0x9500('0xeb')],{'as':_0x9500('0xeb'),'foreignKey':'CampaignId','onDelete':_0x9500('0x115')});db[_0x9500('0x79')][_0x9500('0x118')](db['Condition'],{'as':{'plural':_0x9500('0x1ac'),'singular':'OneAll'},'foreignKey':_0x9500('0x1ad'),'onDelete':_0x9500('0x115'),'hooks':!![]});db[_0x9500('0x79')][_0x9500('0x118')](db[_0x9500('0x7d')],{'as':{'plural':_0x9500('0x1ae'),'singular':_0x9500('0x1af')},'foreignKey':_0x9500('0x1b0'),'onDelete':_0x9500('0x115'),'hooks':!![]});db[_0x9500('0x79')][_0x9500('0x118')](db[_0x9500('0x1b1')],{'as':_0x9500('0x1b2'),'foreignKey':_0x9500('0x1b3'),'onDelete':'cascade','hooks':!![]});db[_0x9500('0x7b')][_0x9500('0x118')](db['Disposition'],{'as':_0x9500('0x16f'),'foreignKey':_0x9500('0x1b4'),'onDelete':_0x9500('0x115')});db[_0x9500('0x7e')][_0x9500('0x118')](db[_0x9500('0x7e')],{'as':_0x9500('0x1b5'),'foreignKey':'IntervalId','onDelete':_0x9500('0x115'),'hooks':!![],'required':![]});db['Interval'][_0x9500('0x118')](db['VoiceExtension'],{'as':_0x9500('0x11a'),'foreignKey':_0x9500('0x157'),'onDelete':'restrict'});db[_0x9500('0x7e')]['hasMany'](db[_0x9500('0x3f')],{'as':_0x9500('0x1b6'),'foreignKey':_0x9500('0x157')});db[_0x9500('0x7e')][_0x9500('0x118')](db['ChatApplication'],{'as':'ChatApplications','foreignKey':_0x9500('0x157')});db[_0x9500('0x7e')][_0x9500('0x118')](db[_0x9500('0x45')],{'as':_0x9500('0x1b7'),'foreignKey':_0x9500('0x157')});db[_0x9500('0x7e')][_0x9500('0x118')](db[_0x9500('0x18c')],{'as':'SmsApplications','foreignKey':_0x9500('0x157')});db[_0x9500('0x85')][_0x9500('0x125')](db[_0x9500('0x38')],{});db[_0x9500('0x85')]['belongsTo'](db[_0x9500('0x9a')],{'foreignKey':'DefaultReportId'});db['Schedule'][_0x9500('0x125')](db[_0x9500('0x98')],{'foreignKey':'CustomReportId'});db[_0x9500('0x87')][_0x9500('0x126')](db['VoiceMusicOnHold'],{'as':_0x9500('0x1b8'),'through':_0x9500('0x14d'),'onDelete':_0x9500('0x16c')});db['Tag'][_0x9500('0x126')](db['CmContact'],{'through':_0x9500('0x1a8')});db['Tag'][_0x9500('0x126')](db[_0x9500('0x11e')],{'through':_0x9500('0x19f')});db[_0x9500('0x89')][_0x9500('0x126')](db[_0x9500('0x3c')],{'through':_0x9500('0x179')});db[_0x9500('0x89')]['belongsToMany'](db['SmsInteraction'],{'through':_0x9500('0x18e')});db[_0x9500('0x89')]['belongsToMany'](db[_0x9500('0x47')],{'through':_0x9500('0x186')});db[_0x9500('0x89')][_0x9500('0x126')](db[_0x9500('0x56')],{'through':'openchannel_interaction_has_tags'});db[_0x9500('0x89')][_0x9500('0x126')](db[_0x9500('0x122')],{'through':_0x9500('0x1b9')});db['CmContactHasItem'][_0x9500('0x125')](db[_0x9500('0x8b')],{'as':'ItemType','foreignKey':_0x9500('0x1ba')});db[_0x9500('0x8e')][_0x9500('0x125')](db[_0x9500('0x6e')],{'as':'Hopper','foreignKey':_0x9500('0x1bb')});db[_0x9500('0x1bc')][_0x9500('0x125')](db[_0x9500('0x6c')],{'as':'Contact','foreignKey':'CmContactId'});db[_0x9500('0x1bd')][_0x9500('0x118')](db[_0x9500('0x7d')],{'as':{'plural':_0x9500('0x1be'),'singular':'AllCondition'},'foreignKey':_0x9500('0x1bf'),'onDelete':_0x9500('0x115'),'hooks':!![]});db['Trigger'][_0x9500('0x118')](db['Condition'],{'as':{'plural':_0x9500('0x1c0'),'singular':_0x9500('0x1c1')},'foreignKey':_0x9500('0x1c2'),'onDelete':_0x9500('0x115'),'hooks':!![]});db[_0x9500('0x1bd')][_0x9500('0x118')](db[_0x9500('0x1b1')],{'as':_0x9500('0x1b2'),'foreignKey':_0x9500('0x1c3'),'onDelete':'cascade','hooks':!![]});db['AnalyticCustomReport'][_0x9500('0x118')](db[_0x9500('0x9f')],{'as':_0x9500('0x1c4'),'onDelete':_0x9500('0x115'),'foreignKey':'CustomReportId','hooks':!![]});db[_0x9500('0x9a')][_0x9500('0x118')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0x9500('0x115'),'foreignKey':_0x9500('0x1c5')});db[_0x9500('0x9d')][_0x9500('0x118')](db[_0x9500('0x9f')],{'as':_0x9500('0x1c4'),'onDelete':_0x9500('0x115'),'foreignKey':_0x9500('0x1c6')});db[_0x9500('0x9f')][_0x9500('0x125')](db[_0x9500('0x9d')],{'foreignKey':'MetricId'});db[_0x9500('0xa3')]['hasMany'](db[_0x9500('0xa5')],{'as':_0x9500('0x1c7'),'onDelete':_0x9500('0x115'),'foreignKey':_0x9500('0x1c8')});db[_0x9500('0xa5')][_0x9500('0x118')](db[_0x9500('0xa6')],{'as':_0x9500('0x1c9'),'onDelete':_0x9500('0x115'),'foreignKey':_0x9500('0x1ca')});db[_0x9500('0xa5')]['hasMany'](db[_0x9500('0xa6')],{'as':_0x9500('0x1cb'),'onDelete':_0x9500('0x115'),'foreignKey':_0x9500('0x1cc')});db[_0x9500('0xa5')][_0x9500('0x118')](db[_0x9500('0xa6')],{'as':'Fields','onDelete':_0x9500('0x115'),'foreignKey':'FieldId'});db[_0x9500('0xa5')][_0x9500('0x125')](db['SalesforceAccount'],{'as':_0x9500('0x177'),'foreignKey':'AccountId'});db[_0x9500('0xa6')][_0x9500('0x118')](db['SalesforceField'],{'as':_0x9500('0x1cd'),'foreignKey':_0x9500('0x1ca')});db[_0x9500('0xa6')][_0x9500('0x118')](db[_0x9500('0xa6')],{'as':_0x9500('0x1ce'),'foreignKey':_0x9500('0x1cc')});db[_0x9500('0xa6')][_0x9500('0x118')](db['SalesforceField'],{'as':_0x9500('0x1cf'),'foreignKey':_0x9500('0x1d0')});db['SalesforceField'][_0x9500('0x125')](db[_0x9500('0x92')],{'as':'Variable','foreignKey':_0x9500('0x1d1')});db['SugarcrmAccount']['hasMany'](db[_0x9500('0xa8')],{'as':'Configurations','onDelete':_0x9500('0x115'),'foreignKey':'AccountId'});db['SugarcrmConfiguration'][_0x9500('0x118')](db[_0x9500('0x1d2')],{'as':_0x9500('0x1c9'),'onDelete':_0x9500('0x115'),'foreignKey':_0x9500('0x1ca')});db[_0x9500('0xa8')][_0x9500('0x118')](db[_0x9500('0x1d2')],{'as':_0x9500('0x1cb'),'onDelete':_0x9500('0x115'),'foreignKey':'DescriptionId'});db[_0x9500('0xa8')]['hasMany'](db[_0x9500('0x1d2')],{'as':_0x9500('0x1c4'),'onDelete':_0x9500('0x115'),'foreignKey':_0x9500('0x1d0')});db['SugarcrmConfiguration']['belongsTo'](db[_0x9500('0xa7')],{'as':_0x9500('0x177'),'foreignKey':_0x9500('0x1c8')});db[_0x9500('0x1d2')][_0x9500('0x118')](db[_0x9500('0x1d2')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x9500('0x1d2')]['hasMany'](db[_0x9500('0x1d2')],{'as':_0x9500('0x1ce'),'foreignKey':_0x9500('0x1cc')});db['SugarcrmField']['hasMany'](db[_0x9500('0x1d2')],{'as':_0x9500('0x1cf'),'foreignKey':_0x9500('0x1d0')});db[_0x9500('0x1d2')][_0x9500('0x125')](db[_0x9500('0x92')],{'as':_0x9500('0x92'),'foreignKey':'VariableId'});db[_0x9500('0xaa')][_0x9500('0x118')](db[_0x9500('0xac')],{'as':_0x9500('0x1c7'),'onDelete':_0x9500('0x115'),'foreignKey':'AccountId'});db[_0x9500('0xac')][_0x9500('0x118')](db[_0x9500('0xae')],{'as':_0x9500('0x1c9'),'onDelete':_0x9500('0x115'),'foreignKey':_0x9500('0x1ca')});db[_0x9500('0xac')]['hasMany'](db[_0x9500('0xae')],{'as':_0x9500('0x1cb'),'onDelete':_0x9500('0x115'),'foreignKey':'DescriptionId'});db[_0x9500('0xac')][_0x9500('0x118')](db[_0x9500('0xae')],{'as':_0x9500('0x1c4'),'onDelete':'cascade','foreignKey':_0x9500('0x1d0')});db[_0x9500('0xac')]['belongsTo'](db[_0x9500('0xaa')],{'as':'Account','foreignKey':'AccountId'});db[_0x9500('0xac')][_0x9500('0x126')](db[_0x9500('0x89')],{'through':'int_desk_configuration_has_tags'});db['DeskField']['hasMany'](db[_0x9500('0xae')],{'as':_0x9500('0x1cd'),'foreignKey':_0x9500('0x1ca')});db['DeskField'][_0x9500('0x118')](db['DeskField'],{'as':_0x9500('0x1ce'),'foreignKey':_0x9500('0x1cc')});db[_0x9500('0xae')]['hasMany'](db['DeskField'],{'as':'Field','foreignKey':_0x9500('0x1d0')});db[_0x9500('0xae')][_0x9500('0x125')](db[_0x9500('0x92')],{'as':_0x9500('0x92'),'foreignKey':_0x9500('0x1d1')});db[_0x9500('0x1d3')][_0x9500('0x118')](db['ZohoConfiguration'],{'as':_0x9500('0x1c7'),'onDelete':_0x9500('0x115'),'foreignKey':'AccountId'});db[_0x9500('0xb0')][_0x9500('0x118')](db[_0x9500('0x1d4')],{'as':'Subjects','onDelete':_0x9500('0x115'),'foreignKey':_0x9500('0x1ca')});db['ZohoConfiguration'][_0x9500('0x118')](db['ZohoField'],{'as':_0x9500('0x1cb'),'onDelete':_0x9500('0x115'),'foreignKey':'DescriptionId'});db[_0x9500('0xb0')][_0x9500('0x118')](db[_0x9500('0x1d4')],{'as':_0x9500('0x1c4'),'onDelete':_0x9500('0x115'),'foreignKey':'FieldId'});db[_0x9500('0xb0')]['belongsTo'](db[_0x9500('0x1d3')],{'as':_0x9500('0x177'),'foreignKey':_0x9500('0x1c8')});db['ZohoField']['hasMany'](db[_0x9500('0x1d4')],{'as':'Subject','foreignKey':'SubjectId'});db['ZohoField'][_0x9500('0x118')](db[_0x9500('0x1d4')],{'as':_0x9500('0x1ce'),'foreignKey':'DescriptionId'});db[_0x9500('0x1d4')][_0x9500('0x118')](db[_0x9500('0x1d4')],{'as':_0x9500('0x1cf'),'foreignKey':'FieldId'});db['ZohoField'][_0x9500('0x125')](db[_0x9500('0x92')],{'as':'Variable','foreignKey':_0x9500('0x1d1')});db[_0x9500('0xb1')][_0x9500('0x118')](db[_0x9500('0xb3')],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db[_0x9500('0xb3')][_0x9500('0x118')](db[_0x9500('0xb5')],{'as':_0x9500('0x1c9'),'foreignKey':'SubjectId'});db[_0x9500('0xb3')]['hasMany'](db['ZendeskField'],{'as':_0x9500('0x1cb'),'foreignKey':_0x9500('0x1cc')});db[_0x9500('0xb3')][_0x9500('0x118')](db['ZendeskField'],{'as':_0x9500('0x1c4'),'foreignKey':_0x9500('0x1d0')});db[_0x9500('0xb3')]['belongsTo'](db['ZendeskAccount'],{'as':_0x9500('0x177'),'foreignKey':'AccountId'});db[_0x9500('0xb3')][_0x9500('0x126')](db[_0x9500('0x89')],{'through':'int_zendesk_configuration_has_tags'});db[_0x9500('0xb5')]['hasMany'](db[_0x9500('0xb5')],{'as':_0x9500('0x1cd'),'foreignKey':'SubjectId'});db[_0x9500('0xb5')][_0x9500('0x118')](db['ZendeskField'],{'as':_0x9500('0x1ce'),'foreignKey':_0x9500('0x1cc')});db[_0x9500('0xb5')][_0x9500('0x118')](db[_0x9500('0xb5')],{'as':_0x9500('0x1cf'),'foreignKey':'FieldId'});db['ZendeskField'][_0x9500('0x125')](db[_0x9500('0x92')],{'as':'Variable','foreignKey':_0x9500('0x1d1')});db[_0x9500('0xb7')][_0x9500('0x118')](db[_0x9500('0xb9')],{'as':_0x9500('0x1c7'),'onDelete':_0x9500('0x115'),'foreignKey':'AccountId'});db[_0x9500('0xb9')][_0x9500('0x118')](db[_0x9500('0xbb')],{'as':_0x9500('0x1c9'),'onDelete':_0x9500('0x115'),'foreignKey':_0x9500('0x1ca')});db[_0x9500('0xb9')][_0x9500('0x118')](db[_0x9500('0xbb')],{'as':_0x9500('0x1cb'),'onDelete':_0x9500('0x115'),'foreignKey':_0x9500('0x1cc')});db[_0x9500('0xb9')][_0x9500('0x118')](db[_0x9500('0xbb')],{'as':_0x9500('0x1c4'),'onDelete':_0x9500('0x115'),'foreignKey':_0x9500('0x1d0')});db[_0x9500('0xb9')]['belongsTo'](db[_0x9500('0xb7')],{'as':_0x9500('0x177'),'foreignKey':_0x9500('0x1c8')});db[_0x9500('0xb9')]['belongsToMany'](db[_0x9500('0x89')],{'through':'int_freshdesk_configuration_has_tags'});db[_0x9500('0xbb')]['hasMany'](db['FreshdeskField'],{'as':_0x9500('0x1cd'),'foreignKey':_0x9500('0x1ca')});db['FreshdeskField'][_0x9500('0x118')](db[_0x9500('0xbb')],{'as':'Description','foreignKey':_0x9500('0x1cc')});db[_0x9500('0xbb')][_0x9500('0x118')](db[_0x9500('0xbb')],{'as':_0x9500('0x1cf'),'foreignKey':'FieldId'});db[_0x9500('0xbb')]['belongsTo'](db[_0x9500('0x92')],{'as':_0x9500('0x92'),'foreignKey':'VariableId'});db['VtigerAccount'][_0x9500('0x118')](db['VtigerConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x9500('0x1c8')});db['VtigerConfiguration'][_0x9500('0x118')](db[_0x9500('0xc0')],{'as':'Subjects','foreignKey':_0x9500('0x1ca')});db[_0x9500('0xbf')][_0x9500('0x118')](db['VtigerField'],{'as':_0x9500('0x1cb'),'foreignKey':'DescriptionId'});db[_0x9500('0xbf')]['hasMany'](db[_0x9500('0xc0')],{'as':'Fields','foreignKey':'FieldId'});db[_0x9500('0xbf')][_0x9500('0x125')](db[_0x9500('0xbd')],{'as':_0x9500('0x177'),'foreignKey':'AccountId'});db['VtigerField'][_0x9500('0x118')](db[_0x9500('0xc0')],{'as':_0x9500('0x1cd'),'foreignKey':_0x9500('0x1ca')});db[_0x9500('0xc0')][_0x9500('0x118')](db[_0x9500('0xc0')],{'as':_0x9500('0x1ce'),'foreignKey':_0x9500('0x1cc')});db[_0x9500('0xc0')]['hasMany'](db[_0x9500('0xc0')],{'as':_0x9500('0x1cf'),'foreignKey':_0x9500('0x1d0')});db['VtigerField']['belongsTo'](db[_0x9500('0x92')],{'as':_0x9500('0x92'),'foreignKey':_0x9500('0x1d1')});db[_0x9500('0xc1')][_0x9500('0x118')](db[_0x9500('0xc3')],{'as':_0x9500('0x1c7'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x9500('0xc3')]['hasMany'](db['ServicenowField'],{'as':_0x9500('0x1c9'),'foreignKey':_0x9500('0x1ca')});db['ServicenowConfiguration'][_0x9500('0x118')](db[_0x9500('0x1d5')],{'as':_0x9500('0x1cb'),'foreignKey':_0x9500('0x1cc')});db[_0x9500('0xc3')][_0x9500('0x118')](db[_0x9500('0x1d5')],{'as':_0x9500('0x1c4'),'foreignKey':'FieldId'});db[_0x9500('0xc3')][_0x9500('0x125')](db['ServicenowAccount'],{'as':_0x9500('0x177'),'foreignKey':_0x9500('0x1c8')});db[_0x9500('0x1d5')][_0x9500('0x118')](db[_0x9500('0x1d5')],{'as':_0x9500('0x1cd'),'foreignKey':_0x9500('0x1ca')});db[_0x9500('0x1d5')][_0x9500('0x118')](db[_0x9500('0x1d5')],{'as':_0x9500('0x1ce'),'foreignKey':'DescriptionId'});db['ServicenowField'][_0x9500('0x118')](db['ServicenowField'],{'as':_0x9500('0x1cf'),'foreignKey':'FieldId'});db['ServicenowField'][_0x9500('0x125')](db[_0x9500('0x92')],{'as':_0x9500('0x92'),'foreignKey':_0x9500('0x1d1')});db[_0x9500('0xc5')][_0x9500('0x118')](db[_0x9500('0xc7')],{'as':_0x9500('0x1c7'),'onDelete':_0x9500('0x115'),'foreignKey':'AccountId'});db[_0x9500('0xc5')]['belongsTo'](db[_0x9500('0x10e')],{'as':_0x9500('0x10e'),'foreignKey':_0x9500('0x16b')});db[_0x9500('0xc7')]['hasMany'](db[_0x9500('0x1d6')],{'as':_0x9500('0x1c9'),'onDelete':_0x9500('0x115'),'foreignKey':_0x9500('0x1ca')});db[_0x9500('0xc7')][_0x9500('0x118')](db[_0x9500('0x1d6')],{'as':_0x9500('0x1cb'),'onDelete':'cascade','foreignKey':_0x9500('0x1cc')});db['Dynamics365Configuration']['hasMany'](db[_0x9500('0x1d6')],{'as':_0x9500('0x1c4'),'onDelete':'cascade','foreignKey':_0x9500('0x1d0')});db[_0x9500('0xc7')][_0x9500('0x125')](db[_0x9500('0xc5')],{'as':_0x9500('0x177'),'foreignKey':_0x9500('0x1c8')});db[_0x9500('0x1d6')][_0x9500('0x118')](db[_0x9500('0x1d6')],{'as':'Subject','foreignKey':_0x9500('0x1ca')});db[_0x9500('0x1d6')][_0x9500('0x118')](db['Dynamics365Field'],{'as':_0x9500('0x1ce'),'foreignKey':'DescriptionId'});db[_0x9500('0x1d6')][_0x9500('0x118')](db[_0x9500('0x1d6')],{'as':'Field','foreignKey':_0x9500('0x1d0')});db[_0x9500('0x1d6')]['belongsTo'](db['Variable'],{'as':_0x9500('0x92'),'foreignKey':'VariableId'});db[_0x9500('0xca')]['hasMany'](db[_0x9500('0xcc')],{'as':'Configurations','onDelete':_0x9500('0x115'),'foreignKey':'AccountId'});db[_0x9500('0xcc')][_0x9500('0x118')](db['FreshsalesField'],{'as':_0x9500('0x1c9'),'foreignKey':_0x9500('0x1ca')});db[_0x9500('0xcc')][_0x9500('0x118')](db[_0x9500('0xce')],{'as':_0x9500('0x1cb'),'foreignKey':_0x9500('0x1cc')});db[_0x9500('0xcc')][_0x9500('0x118')](db[_0x9500('0xce')],{'as':_0x9500('0x1c4'),'foreignKey':_0x9500('0x1d0')});db['FreshsalesConfiguration']['belongsTo'](db['FreshsalesAccount'],{'as':_0x9500('0x177'),'foreignKey':_0x9500('0x1c8')});db[_0x9500('0xce')][_0x9500('0x118')](db[_0x9500('0xce')],{'as':_0x9500('0x1cd'),'foreignKey':'SubjectId'});db[_0x9500('0xce')][_0x9500('0x118')](db[_0x9500('0xce')],{'as':_0x9500('0x1ce'),'foreignKey':_0x9500('0x1cc')});db[_0x9500('0xce')][_0x9500('0x118')](db[_0x9500('0xce')],{'as':_0x9500('0x1cf'),'foreignKey':_0x9500('0x1d0')});db['FreshsalesField']['belongsTo'](db[_0x9500('0x92')],{'as':_0x9500('0x92'),'foreignKey':'VariableId'});db[_0x9500('0xd1')][_0x9500('0x125')](db[_0x9500('0x5c')],{});db[_0x9500('0xd1')][_0x9500('0x125')](db[_0x9500('0x129')],{'as':_0x9500('0x172'),'foreignKey':'ListId'});db[_0x9500('0xd1')][_0x9500('0x125')](db[_0x9500('0x6c')],{'as':'Contact','foreignKey':_0x9500('0x168')});db[_0x9500('0xd1')]['belongsTo'](db[_0x9500('0x11e')],{});db[_0x9500('0xd1')]['belongsTo'](db[_0x9500('0x62')],{});db[_0x9500('0xd1')][_0x9500('0x125')](db[_0x9500('0x12')],{});db[_0x9500('0xd1')]['belongsTo'](db[_0x9500('0x66')],{});db[_0x9500('0xd2')]['belongsTo'](db[_0x9500('0x12')],{'onDelete':_0x9500('0x115'),'foreignKey':'FromId'});db[_0x9500('0xd2')][_0x9500('0x125')](db[_0x9500('0x12')],{'onDelete':_0x9500('0x115'),'foreignKey':'ToId'});db[_0x9500('0x152')][_0x9500('0x118')](db[_0x9500('0xd5')],{'foreignKey':_0x9500('0x1d7'),'onDelete':_0x9500('0x115')});db[_0x9500('0x152')][_0x9500('0x118')](db[_0x9500('0x1d8')],{'foreignKey':_0x9500('0x1d7'),'onDelete':_0x9500('0x115')});db[_0x9500('0xd6')][_0x9500('0x125')](db['SmsAccount'],{});db[_0x9500('0xd6')][_0x9500('0x125')](db[_0x9500('0x129')],{'as':_0x9500('0x172'),'foreignKey':_0x9500('0x181')});db['SmsQueueReport'][_0x9500('0x125')](db[_0x9500('0x6c')],{'as':_0x9500('0x167'),'foreignKey':'ContactId'});db[_0x9500('0xd6')][_0x9500('0x125')](db['SmsInteraction'],{});db['SmsQueueReport'][_0x9500('0x125')](db[_0x9500('0x53')],{});db[_0x9500('0xd6')][_0x9500('0x125')](db['User'],{});db[_0x9500('0xd6')][_0x9500('0x125')](db[_0x9500('0x139')],{});db[_0x9500('0xdc')]['hasMany'](db[_0x9500('0x152')],{'foreignKey':_0x9500('0x1d9')});db[_0x9500('0xdc')]['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':_0x9500('0x1d9')});db['JscriptyProject'][_0x9500('0x118')](db[_0x9500('0x1d8')],{'foreignKey':_0x9500('0x1d9')});db[_0x9500('0xe7')][_0x9500('0x126')](db[_0x9500('0x12')],{'as':'Agents','through':_0x9500('0x1da')});db[_0x9500('0xe7')][_0x9500('0x126')](db['VoiceQueue'],{'through':_0x9500('0x110'),'as':_0x9500('0x132')});db[_0x9500('0xe7')]['belongsToMany'](db[_0x9500('0x39')],{'through':'team_has_mail_queues','as':_0x9500('0x1db')});db['Team'][_0x9500('0x126')](db[_0x9500('0x66')],{'through':_0x9500('0x1a0'),'as':_0x9500('0x136')});db[_0x9500('0xe7')][_0x9500('0x126')](db[_0x9500('0x4b')],{'through':'team_has_fax_queues','as':_0x9500('0x137')});db[_0x9500('0xe7')][_0x9500('0x126')](db[_0x9500('0x139')],{'through':_0x9500('0x190'),'as':_0x9500('0x13a')});db[_0x9500('0xe7')][_0x9500('0x126')](db['OpenchannelQueue'],{'through':'team_has_openchannel_queues','as':_0x9500('0x13b')});db[_0x9500('0xe7')][_0x9500('0x126')](db[_0x9500('0x13c')],{'through':_0x9500('0x1dc'),'as':'WhatsappQueues'});db['Team'][_0x9500('0x126')](db['VoicePrefix'],{'through':'TeamVoicePrefix','as':'VoicePrefixes'});db[_0x9500('0xeb')][_0x9500('0x118')](db['CmHopper'],{'as':_0x9500('0x150'),'foreignKey':_0x9500('0x1aa')});db[_0x9500('0xeb')][_0x9500('0x118')](db[_0x9500('0x71')],{'as':_0x9500('0x11b'),'foreignKey':_0x9500('0x1aa')});db[_0x9500('0xeb')][_0x9500('0x118')](db['CmHopperHistory'],{'as':_0x9500('0x151'),'foreignKey':_0x9500('0x1aa')});db[_0x9500('0xeb')][_0x9500('0x118')](db[_0x9500('0x70')],{'as':'HopperBlacks','foreignKey':_0x9500('0x1aa')});db[_0x9500('0xeb')][_0x9500('0x125')](db[_0x9500('0x25')],{'as':_0x9500('0x25'),'foreignKey':'TrunkId'});db[_0x9500('0xeb')]['belongsTo'](db[_0x9500('0x25')],{'as':_0x9500('0x155'),'foreignKey':'TrunkBackupId'});db[_0x9500('0xeb')][_0x9500('0x125')](db['Interval'],{'as':_0x9500('0x7e'),'foreignKey':'IntervalId'});db[_0x9500('0xeb')]['belongsTo'](db[_0x9500('0xe1')],{'as':_0x9500('0xe1'),'foreignKey':_0x9500('0x1dd')});db[_0x9500('0xeb')][_0x9500('0x126')](db[_0x9500('0x129')],{'as':_0x9500('0x12a'),'through':_0x9500('0x1de')});db['Campaign'][_0x9500('0x126')](db[_0x9500('0x129')],{'as':'BlackLists','through':_0x9500('0x1df')});db['Attachment'][_0x9500('0x125')](db[_0x9500('0x64')],{'as':_0x9500('0x64'),'foreignKey':_0x9500('0x17e')});db[_0x9500('0xf2')][_0x9500('0x125')](db[_0x9500('0x3e')],{});db[_0x9500('0xf2')]['belongsTo'](db['MailInteraction'],{});db['MailTransferReport'][_0x9500('0x125')](db[_0x9500('0x38')],{'foreignKey':_0x9500('0x1e0'),'as':'FromAccount'});db['MailTransferReport'][_0x9500('0x125')](db[_0x9500('0x12')],{'foreignKey':'FromUserId','as':_0x9500('0x1e1')});db[_0x9500('0xf2')][_0x9500('0x125')](db[_0x9500('0x12')],{'foreignKey':_0x9500('0x1e2'),'as':_0x9500('0x1e3')});db[_0x9500('0xf2')]['belongsTo'](db[_0x9500('0x39')],{'foreignKey':_0x9500('0x1e4'),'as':_0x9500('0x1e5')});db['MailTransferReport'][_0x9500('0x125')](db['MailAccount'],{'foreignKey':_0x9500('0x1e6'),'as':_0x9500('0x1e7')});db[_0x9500('0xf4')]['belongsTo'](db[_0x9500('0x62')],{});db[_0x9500('0xf4')][_0x9500('0x125')](db[_0x9500('0x11e')],{});db[_0x9500('0xf4')][_0x9500('0x125')](db[_0x9500('0x5c')],{'foreignKey':'FromChatWebsiteId','as':_0x9500('0x1e8')});db['ChatTransferReport'][_0x9500('0x125')](db[_0x9500('0x12')],{'foreignKey':_0x9500('0x1e9'),'as':_0x9500('0x1e1')});db['ChatTransferReport']['belongsTo'](db[_0x9500('0x12')],{'foreignKey':_0x9500('0x1e2'),'as':_0x9500('0x1e3')});db[_0x9500('0xf4')]['belongsTo'](db['ChatQueue'],{'foreignKey':_0x9500('0x1ea'),'as':_0x9500('0x1e5')});db[_0x9500('0xf4')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x9500('0x1eb'),'as':_0x9500('0x1e7')});db[_0x9500('0xf6')][_0x9500('0x125')](db[_0x9500('0x49')],{});db[_0x9500('0xf6')][_0x9500('0x125')](db[_0x9500('0x47')],{});db[_0x9500('0xf6')][_0x9500('0x125')](db[_0x9500('0x44')],{'foreignKey':_0x9500('0x1ec'),'as':_0x9500('0x1e8')});db['FaxTransferReport'][_0x9500('0x125')](db['User'],{'foreignKey':_0x9500('0x1e9'),'as':_0x9500('0x1e1')});db['FaxTransferReport'][_0x9500('0x125')](db['User'],{'foreignKey':'ToUserId','as':_0x9500('0x1e3')});db[_0x9500('0xf6')]['belongsTo'](db[_0x9500('0x4b')],{'foreignKey':_0x9500('0x1ed'),'as':_0x9500('0x1e5')});db[_0x9500('0xf6')][_0x9500('0x125')](db['FaxAccount'],{'foreignKey':_0x9500('0x1ee'),'as':'ToAccount'});db[_0x9500('0xf8')][_0x9500('0x125')](db[_0x9500('0x58')],{});db[_0x9500('0xf8')]['belongsTo'](db['OpenchannelInteraction'],{});db[_0x9500('0xf8')]['belongsTo'](db['OpenchannelAccount'],{'foreignKey':_0x9500('0x1ef'),'as':'FromAccount'});db['OpenchannelTransferReport'][_0x9500('0x125')](db[_0x9500('0x12')],{'foreignKey':'FromUserId','as':_0x9500('0x1e1')});db[_0x9500('0xf8')][_0x9500('0x125')](db[_0x9500('0x12')],{'foreignKey':'ToUserId','as':_0x9500('0x1e3')});db[_0x9500('0xf8')][_0x9500('0x125')](db[_0x9500('0x5a')],{'foreignKey':_0x9500('0x1f0'),'as':_0x9500('0x1e5')});db[_0x9500('0xf8')]['belongsTo'](db['OpenchannelAccount'],{'foreignKey':_0x9500('0x1f1'),'as':_0x9500('0x1e7')});db['SmsTransferReport']['belongsTo'](db['SmsMessage'],{});db[_0x9500('0xfa')]['belongsTo'](db[_0x9500('0x51')],{});db[_0x9500('0xfa')][_0x9500('0x125')](db['SmsAccount'],{'foreignKey':_0x9500('0x1f2'),'as':_0x9500('0x1e8')});db[_0x9500('0xfa')]['belongsTo'](db['User'],{'foreignKey':_0x9500('0x1e9'),'as':_0x9500('0x1e1')});db['SmsTransferReport'][_0x9500('0x125')](db[_0x9500('0x12')],{'foreignKey':_0x9500('0x1e2'),'as':_0x9500('0x1e3')});db[_0x9500('0xfa')]['belongsTo'](db[_0x9500('0x139')],{'foreignKey':_0x9500('0x1f3'),'as':_0x9500('0x1e5')});db[_0x9500('0xfa')]['belongsTo'](db[_0x9500('0x4f')],{'foreignKey':_0x9500('0x1f4'),'as':_0x9500('0x1e7')});db['CmList'][_0x9500('0x118')](db['Disposition'],{'as':_0x9500('0x16f'),'foreignKey':_0x9500('0x181'),'onDelete':_0x9500('0x115')});db[_0x9500('0x129')][_0x9500('0x118')](db['CmCustomField'],{'as':_0x9500('0x1f5'),'foreignKey':_0x9500('0x181')});db[_0x9500('0x129')][_0x9500('0x118')](db[_0x9500('0x6c')],{'as':_0x9500('0x128'),'onDelete':_0x9500('0x115'),'foreignKey':_0x9500('0x181')});db['CmList'][_0x9500('0x118')](db[_0x9500('0x71')],{'as':_0x9500('0x11b'),'foreignKey':_0x9500('0x181')});db['CmList']['hasMany'](db[_0x9500('0x73')],{'as':_0x9500('0x11c'),'foreignKey':_0x9500('0x181')});db['CmList'][_0x9500('0x118')](db[_0x9500('0x75')],{'as':_0x9500('0x75'),'foreignKey':_0x9500('0x181')});db[_0x9500('0x129')][_0x9500('0x126')](db[_0x9500('0x1b')],{'as':_0x9500('0x1f6'),'through':'voice_queues_has_cm_lists'});db[_0x9500('0x129')][_0x9500('0x126')](db[_0x9500('0x12')],{'as':_0x9500('0x15b'),'through':_0x9500('0x12b')});db[_0x9500('0xfd')][_0x9500('0x118')](db[_0x9500('0x17')],{'as':'Extensions','onDelete':_0x9500('0x115')});db[_0x9500('0xfd')][_0x9500('0x126')](db[_0x9500('0x12')],{'as':_0x9500('0x15b'),'through':_0x9500('0x134')});db[_0x9500('0xfd')]['belongsToMany'](db[_0x9500('0xe7')],{'through':_0x9500('0x111'),'as':'Teams'});db[_0x9500('0xff')][_0x9500('0x118')](db[_0x9500('0x12')],{'as':_0x9500('0x17b'),'foreignKey':_0x9500('0x1f7')});db['UserProfile'][_0x9500('0x118')](db[_0x9500('0x1f8')],{'as':_0x9500('0x1f9'),'foreignKey':_0x9500('0x1f7'),'onDelete':_0x9500('0x115')});db[_0x9500('0x1f8')]['hasMany'](db[_0x9500('0x101')],{'as':_0x9500('0x1fa'),'foreignKey':_0x9500('0x1fb'),'onDelete':'cascade'});db['WhatsappAccount'][_0x9500('0x118')](db[_0x9500('0x7b')],{'as':_0x9500('0x16f'),'foreignKey':_0x9500('0x1fc'),'onDelete':'cascade'});db[_0x9500('0x104')]['hasMany'](db[_0x9500('0x7a')],{'as':_0x9500('0x170'),'foreignKey':'WhatsappAccountId'});db[_0x9500('0x104')][_0x9500('0x118')](db[_0x9500('0x108')],{'as':_0x9500('0x160'),'foreignKey':_0x9500('0x1fc')});db[_0x9500('0x104')][_0x9500('0x118')](db['WhatsappInteraction'],{'as':'Interactions'});db[_0x9500('0x104')][_0x9500('0x118')](db[_0x9500('0x1fd')],{'as':_0x9500('0x14b')});db[_0x9500('0x104')][_0x9500('0x125')](db['CmList'],{'as':_0x9500('0x172'),'foreignKey':_0x9500('0x181')});db[_0x9500('0x104')][_0x9500('0x125')](db[_0x9500('0x158')],{'as':_0x9500('0x159'),'foreignKey':_0x9500('0x174')});db['WhatsappAccount'][_0x9500('0x126')](db[_0x9500('0x12')],{'as':_0x9500('0x15b'),'through':'user_has_whatsapp_accounts'});db[_0x9500('0x1fd')]['belongsTo'](db[_0x9500('0x12')],{'onDelete':_0x9500('0x16c')});db[_0x9500('0x1fd')][_0x9500('0x125')](db[_0x9500('0x13c')],{'onDelete':_0x9500('0x16c')});db[_0x9500('0x1fd')][_0x9500('0x125')](db[_0x9500('0x104')],{'onDelete':_0x9500('0x16c')});db[_0x9500('0x1fd')][_0x9500('0x125')](db[_0x9500('0x7e')],{'onDelete':_0x9500('0x16c'),'foreignKey':_0x9500('0x157')});db[_0x9500('0x1fd')][_0x9500('0x125')](db[_0x9500('0x89')],{'onDelete':_0x9500('0x16c'),'foreignKey':_0x9500('0x17f')});db['WhatsappInteraction'][_0x9500('0x118')](db['WhatsappMessage'],{'as':_0x9500('0x160'),'onDelete':_0x9500('0x115'),'foreignKey':_0x9500('0x1fe')});db[_0x9500('0x122')]['belongsTo'](db[_0x9500('0x104')],{'as':_0x9500('0x177'),'foreignKey':_0x9500('0x1fc')});db[_0x9500('0x122')][_0x9500('0x125')](db[_0x9500('0x6c')],{'as':'Contact','foreignKey':'ContactId'});db[_0x9500('0x122')]['belongsTo'](db[_0x9500('0x12')],{'as':_0x9500('0x178'),'foreignKey':_0x9500('0x116')});db[_0x9500('0x122')][_0x9500('0x126')](db[_0x9500('0x89')],{'through':_0x9500('0x1b9'),'as':_0x9500('0x187')});db[_0x9500('0x122')][_0x9500('0x126')](db[_0x9500('0x89')],{'through':'whatsapp_interaction_has_tags','as':_0x9500('0x17a')});db[_0x9500('0x122')]['belongsToMany'](db['User'],{'as':_0x9500('0x17b'),'through':'user_has_whatsapp_interactions','foreignKey':'WhatsappInteractionId'});db[_0x9500('0x108')]['belongsTo'](db['User'],{'as':'User'});db[_0x9500('0x108')][_0x9500('0x125')](db[_0x9500('0x6c')],{'onDelete':'cascade','as':_0x9500('0x167')});db[_0x9500('0x108')][_0x9500('0x125')](db[_0x9500('0x122')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x9500('0x1fe')});db[_0x9500('0x108')]['belongsTo'](db['WhatsappAccount'],{'as':_0x9500('0x177'),'foreignKey':_0x9500('0x1fc')});db['WhatsappQueueReport'][_0x9500('0x125')](db[_0x9500('0x104')],{});db[_0x9500('0x10a')][_0x9500('0x125')](db[_0x9500('0x129')],{'as':_0x9500('0x172'),'foreignKey':_0x9500('0x181')});db[_0x9500('0x10a')][_0x9500('0x125')](db['CmContact'],{'as':_0x9500('0x167'),'foreignKey':_0x9500('0x168')});db[_0x9500('0x10a')][_0x9500('0x125')](db['WhatsappInteraction'],{});db[_0x9500('0x10a')]['belongsTo'](db['WhatsappQueue'],{});db[_0x9500('0x10a')][_0x9500('0x125')](db[_0x9500('0x108')],{});db[_0x9500('0x10a')][_0x9500('0x125')](db[_0x9500('0x12')],{});db[_0x9500('0x10c')][_0x9500('0x125')](db[_0x9500('0x108')],{});db['WhatsappTransferReport']['belongsTo'](db['WhatsappInteraction'],{});db['WhatsappTransferReport'][_0x9500('0x125')](db[_0x9500('0x104')],{'foreignKey':_0x9500('0x1ff'),'as':'FromAccount'});db[_0x9500('0x10c')][_0x9500('0x125')](db[_0x9500('0x104')],{'foreignKey':_0x9500('0x200'),'as':_0x9500('0x1e7')});db[_0x9500('0x10c')]['belongsTo'](db[_0x9500('0x13c')],{'foreignKey':'ToQueueId','as':'ToQueue'});db[_0x9500('0x10c')][_0x9500('0x125')](db[_0x9500('0x12')],{'foreignKey':_0x9500('0x1e9'),'as':_0x9500('0x1e1')});db[_0x9500('0x10c')][_0x9500('0x125')](db[_0x9500('0x12')],{'foreignKey':_0x9500('0x1e2'),'as':_0x9500('0x1e3')});db['WhatsappQueue'][_0x9500('0x126')](db['User'],{'as':_0x9500('0x15b'),'through':_0x9500('0x34'),'foreignKey':_0x9500('0x201')});db[_0x9500('0x13c')][_0x9500('0x126')](db['Team'],{'through':_0x9500('0x1dc'),'as':_0x9500('0x15c')});db[_0x9500('0x202')][_0x9500('0x125')](db[_0x9500('0x12')],{'as':'user','foreignKey':'UserId','onDelete':'cascade','hooks':!![]});db[_0x9500('0x10e')][_0x9500('0x117')](db['Dynamics365Account'],{'as':_0x9500('0xc5'),'onDelete':_0x9500('0x16c')});db['CloudProvider'][_0x9500('0x117')](db[_0x9500('0x16a')],{'as':_0x9500('0x16d'),'onDelete':'restrict'});db[_0x9500('0x10e')][_0x9500('0x117')](db[_0x9500('0x36')],{'as':_0x9500('0x16e'),'onDelete':_0x9500('0x16c')});module[_0x9500('0x203')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xa071=['Company','cm_user_has_contacts','cm_contact_has_tags','AdditionalPhones','CmHopperId','CampaignId','Condition','OneAll','AutomationAllId','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Sound','Mohs','moh_has_sounds','whatsapp_interaction_has_tags','ItemType','ItemTypeId','CmContactId','AllCondition','AnyCondition','TriggerAnyId','Fields','MetricId','Configurations','AccountId','Subjects','Descriptions','DescriptionId','FieldId','Subject','SubjectId','Description','Field','Variable','SugarcrmField','VariableId','int_desk_configuration_has_tags','ZohoConfiguration','ZendeskAccount','int_freshdesk_configuration_has_tags','VtigerConfiguration','ServicenowConfiguration','FromId','ToId','JscriptyQuestionReport','SessionId','ProjectId','VoiceQueues','team_has_whatsapp_queues','VoicePrefix','HopperBlacks','SquareProjectId','campaigns_has_cm_lists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToMailAccountId','ChatTransferReport','FromChatWebsiteId','ToQueue','ToChatWebsiteId','ToAccount','FromFaxAccountId','FromUserId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','FromSmsAccountId','ToSmsAccountId','CustomFields','HopperHistory','Queues','voice_queues_has_cm_lists','UserProfileSections','userProfileId','UserProfileSection','Resources','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','exports','../config/environment','sequelize','lodash','jstz','xcall','127.0.0.1','mysql','utf8mb4','name','utf8_general_ci','sequelizeHistory','motion2','xC@LL1234','utf8','database','username','options','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','import','../api/voiceContext/voiceContext.model','VoiceExtension','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceQueueReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboardItem/dashboardItem.model','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','Disposition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/sound/sound.model','Tag','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Trigger','../api/variable/variable.model','Integration','../api/integration/integration.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','Network','../api/network/network.model','ChatQueueReport','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','Setting','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','User','hasOne','VoiceMail','cascade','UserId','userSetting','hasMany','VoiceQueuesRt','Extensions','HopperFinals','OpenchannelInteractions','ChatInteraction','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteraction','WhatsappInteractions','SenderId','Groups','chat_group_has_users','belongsToMany','Contacts','CmList','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','UserVoiceQueue','VoicePrefixes','MailQueues','ChatQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','user_has_chat_websites','FaxAccount','MailAccounts','user_has_mail_accounts','user_has_openchannel_accounts','user_has_sms_accounts','WhatsappAccounts','SpiedAgents','ChanSpyId','Applications','Sounds','Members','VoiceQueueId','Hoppers','HopperHistories','JscriptySessionReport','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','belongsTo','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','TeamVoiceQueue','BlackLists','voice_queues_has_cm_blacklists','VoiceMailMessage','Messages','mailbox','mailboxuser','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','ContactId','restrict','MailAccountId','CloudProviderId','Smtp','Dispositions','Interactions','ListId','Agents','team_has_mail_queues','MailInteractionId','Account','Owner','mail_interaction_has_tags','ThroughTags','Users','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','MailApplication','TagId','List','DashboardItem','Items','FaxAccountId','Answers','user_has_fax_accounts','fax_interaction_has_tags','Tags','FaxInteractionId','AttachmentId','Teams','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ProactiveActions','ChatApplication','ChatMessage','OpenchannelQueueReport','Agent','Queue','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatInternalMessage','ChatGroupId','Website','CompanyId','Phones'];(function(_0xa4fb42,_0x2dd073){var _0x22c1c8=function(_0x417b50){while(--_0x417b50){_0xa4fb42['push'](_0xa4fb42['shift']());}};_0x22c1c8(++_0x2dd073);}(_0xa071,0x64));var _0x1a07=function(_0x1dc37e,_0x1d8642){_0x1dc37e=_0x1dc37e-0x0;var _0x5e7988=_0xa071[_0x1dc37e];return _0x5e7988;};'use strict';var config=require(_0x1a07('0x0'));var Sequelize=require(_0x1a07('0x1'));var _=require(_0x1a07('0x2'));var jstz=require(_0x1a07('0x3'));var timezone=jstz['determine']();config['sequelize']=_['defaultsDeep'](config[_0x1a07('0x1')],{'database':'motion2','username':_0x1a07('0x4'),'password':'xC@LL1234','options':{'host':_0x1a07('0x5'),'port':0xcea,'dialect':_0x1a07('0x6'),'dialectOptions':{'charset':_0x1a07('0x7')},'logging':![],'timezone':timezone[_0x1a07('0x8')](),'define':{'charset':'utf8','collate':_0x1a07('0x9')}}});config[_0x1a07('0xa')]=_['defaultsDeep'](config[_0x1a07('0xa')],{'database':_0x1a07('0xb'),'username':'xcall','password':_0x1a07('0xc'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x1a07('0x6'),'dialectOptions':{'charset':_0x1a07('0x7')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x1a07('0xd'),'collate':_0x1a07('0x9')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x1a07('0x1')][_0x1a07('0xe')],config[_0x1a07('0x1')][_0x1a07('0xf')],config[_0x1a07('0x1')]['password'],config['sequelize'][_0x1a07('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x1a07('0xa')]['database'],config['sequelizeHistory'][_0x1a07('0xf')],config[_0x1a07('0xa')]['password'],config[_0x1a07('0xa')]['options'])};db['User']=db[_0x1a07('0x1')]['import']('../api/user/user.model');db[_0x1a07('0x11')]=db[_0x1a07('0x1')]['import'](_0x1a07('0x12'));db[_0x1a07('0x13')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x15'));db[_0x1a07('0x16')]=db[_0x1a07('0x1')][_0x1a07('0x14')]('../api/voiceExtension/voiceExtension.model');db[_0x1a07('0x17')]=db[_0x1a07('0x1')]['import'](_0x1a07('0x18'));db[_0x1a07('0x19')]=db[_0x1a07('0x1')]['import'](_0x1a07('0x1a'));db[_0x1a07('0x1b')]=db['sequelize'][_0x1a07('0x14')](_0x1a07('0x1c'));db[_0x1a07('0x1d')]=db['sequelize']['import']('../api/screenRecording/screenRecording.model');db['VoiceMail']=db[_0x1a07('0x1')]['import'](_0x1a07('0x1e'));db['VoiceMailMessage']=db[_0x1a07('0x1')]['import'](_0x1a07('0x1f'));db[_0x1a07('0x20')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x21'));db[_0x1a07('0x22')]=db[_0x1a07('0x1')]['import'](_0x1a07('0x23'));db['VoiceAgentReport']=db[_0x1a07('0x1')][_0x1a07('0x14')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0x1a07('0x24')]=db[_0x1a07('0x1')]['import']('../api/voiceQueueReport/voiceQueueReport.model');db['MemberReport']=db['sequelize']['import'](_0x1a07('0x25'));db[_0x1a07('0x26')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x27'));db['VoiceTransferReport']=db[_0x1a07('0x1')]['import'](_0x1a07('0x28'));db[_0x1a07('0x29')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x2a'));db['UserVoiceQueue']=db[_0x1a07('0x1')]['import'](_0x1a07('0x2b'));db[_0x1a07('0x2c')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x2d'));db[_0x1a07('0x2e')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x2f'));db[_0x1a07('0x30')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x31'));db[_0x1a07('0x32')]=db['sequelize'][_0x1a07('0x14')]('../api/userSmsQueue/userSmsQueue.model');db[_0x1a07('0x33')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x34'));db[_0x1a07('0x35')]=db['sequelize'][_0x1a07('0x14')](_0x1a07('0x36'));db[_0x1a07('0x37')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x38'));db[_0x1a07('0x39')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x3a'));db[_0x1a07('0x3b')]=db['sequelize'][_0x1a07('0x14')](_0x1a07('0x3c'));db[_0x1a07('0x3d')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x3e'));db[_0x1a07('0x3f')]=db[_0x1a07('0x1')][_0x1a07('0x14')]('../api/mailSubstatus/mailSubstatus.model');db[_0x1a07('0x40')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x41'));db[_0x1a07('0x42')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x43'));db['MailApplication']=db['sequelize']['import'](_0x1a07('0x44'));db[_0x1a07('0x45')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x46'));db[_0x1a07('0x47')]=db[_0x1a07('0x1')][_0x1a07('0x14')]('../api/dashboard/dashboard.model');db['DashboardItem']=db[_0x1a07('0x1')]['import'](_0x1a07('0x48'));db['FaxAccount']=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x49'));db[_0x1a07('0x4a')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x4b'));db[_0x1a07('0x4c')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x4d'));db[_0x1a07('0x4e')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x4f'));db[_0x1a07('0x50')]=db[_0x1a07('0x1')]['import'](_0x1a07('0x51'));db[_0x1a07('0x52')]=db[_0x1a07('0x1')]['import'](_0x1a07('0x53'));db[_0x1a07('0x54')]=db[_0x1a07('0x1')]['import']('../api/smsAccount/smsAccount.model');db[_0x1a07('0x55')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x56'));db[_0x1a07('0x57')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x58'));db[_0x1a07('0x59')]=db[_0x1a07('0x1')]['import'](_0x1a07('0x5a'));db[_0x1a07('0x5b')]=db[_0x1a07('0x1')][_0x1a07('0x14')]('../api/smsQueue/smsQueue.model');db[_0x1a07('0x5c')]=db[_0x1a07('0x1')]['import'](_0x1a07('0x5d'));db[_0x1a07('0x5e')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x5f'));db[_0x1a07('0x60')]=db[_0x1a07('0x1')]['import'](_0x1a07('0x61'));db[_0x1a07('0x62')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x63'));db[_0x1a07('0x64')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x65'));db[_0x1a07('0x66')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x67'));db['OpenchannelQueueReport']=db['sequelize'][_0x1a07('0x14')](_0x1a07('0x68'));db['ChatApplication']=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x69'));db['ChatInteraction']=db[_0x1a07('0x1')][_0x1a07('0x14')]('../api/chatInteraction/chatInteraction.model');db['ChatMessage']=db['sequelize'][_0x1a07('0x14')]('../api/chatMessage/chatMessage.model');db[_0x1a07('0x6a')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x6b'));db[_0x1a07('0x6c')]=db[_0x1a07('0x1')][_0x1a07('0x14')]('../api/chatQueue/chatQueue.model');db[_0x1a07('0x6d')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x6e'));db[_0x1a07('0x6f')]=db[_0x1a07('0x1')]['import'](_0x1a07('0x70'));db['CmCompany']=db[_0x1a07('0x1')]['import']('../api/cmCompany/cmCompany.model');db[_0x1a07('0x71')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x72'));db[_0x1a07('0x73')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x74'));db[_0x1a07('0x75')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x76'));db[_0x1a07('0x77')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x78'));db[_0x1a07('0x79')]=db[_0x1a07('0x1')][_0x1a07('0x14')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x1a07('0x7a')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x7b'));db[_0x1a07('0x7c')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x7d'));db[_0x1a07('0x7e')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x7f'));db[_0x1a07('0x80')]=db['sequelize'][_0x1a07('0x14')](_0x1a07('0x81'));db[_0x1a07('0x82')]=db[_0x1a07('0x1')][_0x1a07('0x14')]('../api/cannedAnswer/cannedAnswer.model');db[_0x1a07('0x83')]=db[_0x1a07('0x1')][_0x1a07('0x14')]('../api/disposition/disposition.model');db['Condition']=db['sequelize'][_0x1a07('0x14')](_0x1a07('0x84'));db[_0x1a07('0x85')]=db['sequelize']['import'](_0x1a07('0x86'));db[_0x1a07('0x87')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x88'));db[_0x1a07('0x89')]=db[_0x1a07('0x1')]['import'](_0x1a07('0x8a'));db['VoiceQueuesLog']=db['sequelize']['import'](_0x1a07('0x8b'));db[_0x1a07('0x8c')]=db[_0x1a07('0x1')][_0x1a07('0x14')]('../api/schedule/schedule.model');db['Sound']=db['sequelize']['import'](_0x1a07('0x8d'));db[_0x1a07('0x8e')]=db[_0x1a07('0x1')]['import']('../api/tag/tag.model');db[_0x1a07('0x8f')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x90'));db[_0x1a07('0x91')]=db[_0x1a07('0x1')][_0x1a07('0x14')]('../api/cmContactHasItem/cmContactHasItem.model');db[_0x1a07('0x92')]=db[_0x1a07('0x1')]['import'](_0x1a07('0x93'));db[_0x1a07('0x94')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x95'));db[_0x1a07('0x96')]=db[_0x1a07('0x1')][_0x1a07('0x14')]('../api/trigger/trigger.model');db['Variable']=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x97'));db[_0x1a07('0x98')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x99'));db['IntegrationReport']=db[_0x1a07('0x1')][_0x1a07('0x14')]('../api/integrationReport/integrationReport.model');db[_0x1a07('0x9a')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x9b'));db[_0x1a07('0x9c')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x9d'));db[_0x1a07('0x9e')]=db[_0x1a07('0x1')]['import'](_0x1a07('0x9f'));db[_0x1a07('0xa0')]=db[_0x1a07('0x1')]['import']('../api/analyticMetric/analyticMetric.model');db[_0x1a07('0xa1')]=db['sequelize'][_0x1a07('0x14')](_0x1a07('0xa2'));db[_0x1a07('0xa3')]=db['sequelize'][_0x1a07('0x14')](_0x1a07('0xa4'));db[_0x1a07('0xa5')]=db[_0x1a07('0x1')]['import'](_0x1a07('0xa6'));db[_0x1a07('0xa7')]=db[_0x1a07('0x1')]['import'](_0x1a07('0xa8'));db[_0x1a07('0xa9')]=db[_0x1a07('0x1')][_0x1a07('0x14')]('../api/intSalesforceField/intSalesforceField.model');db[_0x1a07('0xaa')]=db[_0x1a07('0x1')][_0x1a07('0x14')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x1a07('0xab')]=db[_0x1a07('0x1')][_0x1a07('0x14')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db['SugarcrmField']=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0xac'));db[_0x1a07('0xad')]=db[_0x1a07('0x1')]['import'](_0x1a07('0xae'));db[_0x1a07('0xaf')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0xb0'));db[_0x1a07('0xb1')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0xb2'));db[_0x1a07('0xb3')]=db[_0x1a07('0x1')]['import']('../api/intZohoAccount/intZohoAccount.model');db['ZohoConfiguration']=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0xb4'));db[_0x1a07('0xb5')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0xb6'));db['ZendeskAccount']=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0xb7'));db[_0x1a07('0xb8')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0xb9'));db[_0x1a07('0xba')]=db[_0x1a07('0x1')]['import'](_0x1a07('0xbb'));db[_0x1a07('0xbc')]=db['sequelize'][_0x1a07('0x14')](_0x1a07('0xbd'));db[_0x1a07('0xbe')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0xbf'));db[_0x1a07('0xc0')]=db['sequelize'][_0x1a07('0x14')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0x1a07('0xc1')]=db['sequelize'][_0x1a07('0x14')](_0x1a07('0xc2'));db['VtigerConfiguration']=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0xc3'));db[_0x1a07('0xc4')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0xc5'));db[_0x1a07('0xc6')]=db['sequelize'][_0x1a07('0x14')](_0x1a07('0xc7'));db['ServicenowConfiguration']=db['sequelize'][_0x1a07('0x14')](_0x1a07('0xc8'));db[_0x1a07('0xc9')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0xca'));db[_0x1a07('0xcb')]=db[_0x1a07('0x1')][_0x1a07('0x14')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x1a07('0xcc')]=db[_0x1a07('0x1')]['import'](_0x1a07('0xcd'));db[_0x1a07('0xce')]=db['sequelize'][_0x1a07('0x14')](_0x1a07('0xcf'));db[_0x1a07('0xd0')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0xd1'));db[_0x1a07('0xd2')]=db['sequelize']['import'](_0x1a07('0xd3'));db[_0x1a07('0xd4')]=db[_0x1a07('0x1')][_0x1a07('0x14')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0x1a07('0x98')]=db[_0x1a07('0x1')]['import'](_0x1a07('0x99'));db[_0x1a07('0xd5')]=db[_0x1a07('0x1')]['import'](_0x1a07('0xd6'));db[_0x1a07('0xd7')]=db[_0x1a07('0x1')][_0x1a07('0x14')]('../api/chatQueueReport/chatQueueReport.model');db['ChatInternalMessage']=db[_0x1a07('0x1')][_0x1a07('0x14')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x1a07('0xd8')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0xd9'));db['JscriptyQuestionReport']=db[_0x1a07('0x1')]['import'](_0x1a07('0xda'));db['JscriptySessionReport']=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0xdb'));db[_0x1a07('0xdc')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0xdd'));db['SquareReport']=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0xde'));db['SquareDetailsReport']=db['sequelize']['import'](_0x1a07('0xdf'));db[_0x1a07('0xe0')]=db['sequelize'][_0x1a07('0x14')]('../api/jscriptyProject/jscriptyProject.model');db[_0x1a07('0xe1')]=db[_0x1a07('0x1')][_0x1a07('0x14')]('../api/setting/setting.model');db['SquareOdbc']=db['sequelize'][_0x1a07('0x14')](_0x1a07('0xe2'));db[_0x1a07('0xe3')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0xe4'));db[_0x1a07('0xe5')]=db[_0x1a07('0x1')][_0x1a07('0x14')]('../api/squareRecording/squareRecording.model');db[_0x1a07('0xe6')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0xe7'));db[_0x1a07('0xe8')]=db['sequelize'][_0x1a07('0x14')](_0x1a07('0xe9'));db[_0x1a07('0xea')]=db[_0x1a07('0x1')]['import'](_0x1a07('0xeb'));db[_0x1a07('0xec')]=db[_0x1a07('0x1')]['import'](_0x1a07('0xed'));db[_0x1a07('0xee')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0xef'));db[_0x1a07('0xf0')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0xf1'));db[_0x1a07('0xf2')]=db[_0x1a07('0x1')][_0x1a07('0x14')]('../api/plugin/plugin.model');db['MailTransferReport']=db[_0x1a07('0x1')]['import'](_0x1a07('0xf3'));db['ChatTransferReport']=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0xf4'));db[_0x1a07('0xf5')]=db['sequelize'][_0x1a07('0x14')]('../api/faxTransferReport/faxTransferReport.model');db[_0x1a07('0xf6')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0xf7'));db[_0x1a07('0xf8')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0xf9'));db['CmList']=db[_0x1a07('0x1')]['import'](_0x1a07('0xfa'));db['VoicePrefix']=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0xfb'));db[_0x1a07('0xfc')]=db['sequelize'][_0x1a07('0x14')](_0x1a07('0xfd'));db['UserProfileSection']=db[_0x1a07('0x1')]['import'](_0x1a07('0xfe'));db[_0x1a07('0xff')]=db[_0x1a07('0x1')]['import'](_0x1a07('0x100'));db[_0x1a07('0x101')]=db['sequelize'][_0x1a07('0x14')]('../api/userNotification/userNotification.model');db[_0x1a07('0x102')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x103'));db[_0x1a07('0x104')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x105'));db['WhatsappInteraction']=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x106'));db[_0x1a07('0x107')]=db[_0x1a07('0x1')][_0x1a07('0x14')]('../api/whatsappMessage/whatsappMessage.model');db[_0x1a07('0x108')]=db[_0x1a07('0x1')]['import']('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x1a07('0x109')]=db[_0x1a07('0x1')]['import'](_0x1a07('0x10a'));db[_0x1a07('0x10b')]=db['sequelize'][_0x1a07('0x14')](_0x1a07('0x10c'));db[_0x1a07('0x10d')]=db['sequelize']['import'](_0x1a07('0x10e'));db['TeamVoiceQueue']=db['sequelize'][_0x1a07('0x14')]('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0x1a07('0x10f')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x110'));db[_0x1a07('0x111')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x112'));db[_0x1a07('0x113')]=db['sequelize'][_0x1a07('0x14')](_0x1a07('0x114'));db[_0x1a07('0x115')][_0x1a07('0x116')](db[_0x1a07('0x117')],{'as':'VoiceMail','onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x119')});db['User'][_0x1a07('0x116')](db['UserSetting'],{'as':_0x1a07('0x11a'),'onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x119')});db[_0x1a07('0x115')][_0x1a07('0x11b')](db[_0x1a07('0x1b')],{'as':'Recordings','foreignKey':'UserId'});db[_0x1a07('0x115')][_0x1a07('0x11b')](db[_0x1a07('0x29')],{'as':_0x1a07('0x11c'),'foreignKey':_0x1a07('0x119')});db[_0x1a07('0x115')][_0x1a07('0x11b')](db['VoiceExtension'],{'as':_0x1a07('0x11d'),'onDelete':_0x1a07('0x118'),'hooks':!![]});db[_0x1a07('0x115')]['hasMany'](db['CmHopperFinal'],{'as':_0x1a07('0x11e'),'foreignKey':_0x1a07('0x119')});db[_0x1a07('0x115')]['hasMany'](db[_0x1a07('0x79')],{'as':'HopperHistory','foreignKey':_0x1a07('0x119')});db[_0x1a07('0x115')]['hasMany'](db[_0x1a07('0x7a')],{'as':_0x1a07('0x7a'),'foreignKey':_0x1a07('0x119')});db['User']['hasMany'](db[_0x1a07('0x60')],{'as':_0x1a07('0x11f'),'foreignKey':_0x1a07('0x119')});db[_0x1a07('0x115')]['hasMany'](db[_0x1a07('0x120')],{'as':_0x1a07('0x121'),'foreignKey':_0x1a07('0x119')});db[_0x1a07('0x115')][_0x1a07('0x11b')](db[_0x1a07('0x57')],{'as':_0x1a07('0x122'),'foreignKey':_0x1a07('0x119')});db[_0x1a07('0x115')][_0x1a07('0x11b')](db[_0x1a07('0x4c')],{'as':_0x1a07('0x123'),'foreignKey':'UserId'});db[_0x1a07('0x115')][_0x1a07('0x11b')](db[_0x1a07('0x40')],{'as':_0x1a07('0x124'),'foreignKey':_0x1a07('0x119')});db['User']['hasMany'](db[_0x1a07('0x125')],{'as':_0x1a07('0x126'),'foreignKey':_0x1a07('0x119')});db['User'][_0x1a07('0x11b')](db[_0x1a07('0x101')],{'as':'UserNotifications','foreignKey':_0x1a07('0x127')});db[_0x1a07('0x115')]['belongsTo'](db['UserProfile'],{'as':'UserProfile','foreignKey':'userProfileId'});db[_0x1a07('0x115')]['belongsToMany'](db['ChatGroup'],{'as':_0x1a07('0x128'),'through':_0x1a07('0x129')});db[_0x1a07('0x115')][_0x1a07('0x12a')](db[_0x1a07('0x71')],{'as':_0x1a07('0x12b'),'through':'cm_user_has_contacts'});db['User']['belongsToMany'](db[_0x1a07('0x12c')],{'as':'Lists','through':_0x1a07('0x12d')});db[_0x1a07('0x115')]['belongsToMany'](db[_0x1a07('0xe8')],{'through':_0x1a07('0x12e')});db[_0x1a07('0x115')][_0x1a07('0x12a')](db[_0x1a07('0x40')],{'as':'MailInteractions','through':_0x1a07('0x12f')});db['User'][_0x1a07('0x12a')](db[_0x1a07('0x120')],{'as':_0x1a07('0x121'),'through':_0x1a07('0x130')});db['User'][_0x1a07('0x12a')](db[_0x1a07('0x4c')],{'as':_0x1a07('0x123'),'through':_0x1a07('0x131')});db['User'][_0x1a07('0x12a')](db['SmsInteraction'],{'as':_0x1a07('0x122'),'through':_0x1a07('0x132')});db[_0x1a07('0x115')]['belongsToMany'](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','through':_0x1a07('0x133')});db['User'][_0x1a07('0x12a')](db[_0x1a07('0x125')],{'as':_0x1a07('0x126'),'through':_0x1a07('0x134')});db[_0x1a07('0x115')]['belongsToMany'](db[_0x1a07('0x19')],{'as':'VoiceQueues','through':_0x1a07('0x135'),'required':![]});db[_0x1a07('0x115')][_0x1a07('0x12a')](db['VoicePrefix'],{'as':_0x1a07('0x136'),'through':'UserVoicePrefix','required':![]});db[_0x1a07('0x115')][_0x1a07('0x12a')](db[_0x1a07('0x3d')],{'as':_0x1a07('0x137'),'through':'UserMailQueue','required':![]});db['User']['belongsToMany'](db[_0x1a07('0x6c')],{'as':_0x1a07('0x138'),'through':_0x1a07('0x2c'),'required':![],'hooks':!![]});db[_0x1a07('0x115')][_0x1a07('0x12a')](db['FaxQueue'],{'as':'FaxQueues','through':_0x1a07('0x30'),'required':![]});db[_0x1a07('0x115')][_0x1a07('0x12a')](db[_0x1a07('0x5b')],{'as':_0x1a07('0x139'),'through':'UserSmsQueue','required':![]});db[_0x1a07('0x115')][_0x1a07('0x12a')](db[_0x1a07('0x64')],{'as':_0x1a07('0x13a'),'through':'UserOpenchannelQueue','required':![]});db[_0x1a07('0x115')][_0x1a07('0x12a')](db[_0x1a07('0x10b')],{'as':_0x1a07('0x13b'),'through':_0x1a07('0x35'),'required':![]});db[_0x1a07('0x115')][_0x1a07('0x12a')](db[_0x1a07('0x12c')],{'through':'cm_user_has_lists'});db['User']['belongsToMany'](db[_0x1a07('0x66')],{'as':'ChatWebsites','through':_0x1a07('0x13c')});db['User'][_0x1a07('0x12a')](db[_0x1a07('0x13d')],{'as':'FaxAccounts','through':'user_has_fax_accounts'});db[_0x1a07('0x115')][_0x1a07('0x12a')](db[_0x1a07('0x3b')],{'as':_0x1a07('0x13e'),'through':_0x1a07('0x13f')});db[_0x1a07('0x115')][_0x1a07('0x12a')](db[_0x1a07('0x5c')],{'as':'OpenchannelAccounts','through':_0x1a07('0x140')});db[_0x1a07('0x115')][_0x1a07('0x12a')](db['SmsAccount'],{'as':'SmsAccounts','through':_0x1a07('0x141')});db[_0x1a07('0x115')][_0x1a07('0x12a')](db['WhatsappAccount'],{'as':_0x1a07('0x142'),'through':'user_has_whatsapp_accounts'});db['VoiceChanSpy']['hasMany'](db[_0x1a07('0x16')],{'as':_0x1a07('0x143'),'onDelete':'cascade','foreignKey':_0x1a07('0x144')});db[_0x1a07('0x13')][_0x1a07('0x11b')](db[_0x1a07('0x16')],{'onDelete':'cascade'});db[_0x1a07('0x16')]['hasMany'](db[_0x1a07('0x16')],{'as':_0x1a07('0x145'),'onDelete':_0x1a07('0x118')});db[_0x1a07('0x17')][_0x1a07('0x12a')](db['Sound'],{'as':_0x1a07('0x146'),'through':'moh_has_sounds'});db[_0x1a07('0x19')]['hasMany'](db[_0x1a07('0x29')],{'as':_0x1a07('0x147'),'foreignKey':_0x1a07('0x148')});db[_0x1a07('0x19')][_0x1a07('0x11b')](db[_0x1a07('0x73')],{'as':_0x1a07('0x149'),'foreignKey':'VoiceQueueId'});db[_0x1a07('0x19')][_0x1a07('0x11b')](db[_0x1a07('0x77')],{'as':'HopperFinals','foreignKey':_0x1a07('0x148')});db[_0x1a07('0x19')][_0x1a07('0x11b')](db['CmHopperHistory'],{'as':_0x1a07('0x14a'),'foreignKey':'VoiceQueueId'});db[_0x1a07('0x19')][_0x1a07('0x11b')](db[_0x1a07('0x7a')],{'as':_0x1a07('0x7a'),'foreignKey':_0x1a07('0x148')});db[_0x1a07('0x19')][_0x1a07('0x11b')](db[_0x1a07('0x75')],{'as':'HopperBlacks','foreignKey':'VoiceQueueId'});db[_0x1a07('0x19')][_0x1a07('0x11b')](db[_0x1a07('0x14b')],{'as':_0x1a07('0x14c'),'foreignKey':_0x1a07('0x148')});db[_0x1a07('0x19')]['belongsTo'](db[_0x1a07('0x26')],{'as':_0x1a07('0x26'),'foreignKey':_0x1a07('0x14d')});db[_0x1a07('0x19')]['belongsTo'](db[_0x1a07('0x26')],{'as':_0x1a07('0x14e'),'foreignKey':_0x1a07('0x14f')});db['VoiceQueue'][_0x1a07('0x150')](db['Interval'],{'as':_0x1a07('0x85'),'foreignKey':_0x1a07('0x151')});db[_0x1a07('0x19')][_0x1a07('0x150')](db[_0x1a07('0x87')],{'as':_0x1a07('0x152'),'foreignKey':_0x1a07('0x153')});db[_0x1a07('0x19')]['belongsToMany'](db[_0x1a07('0x12c')],{'as':_0x1a07('0x154'),'through':'voice_queues_has_cm_lists'});db[_0x1a07('0x19')][_0x1a07('0x12a')](db[_0x1a07('0x115')],{'as':'Agents','through':_0x1a07('0x135')});db[_0x1a07('0x19')][_0x1a07('0x12a')](db[_0x1a07('0xe8')],{'as':'Teams','through':_0x1a07('0x155')});db[_0x1a07('0x19')][_0x1a07('0x12a')](db[_0x1a07('0x12c')],{'as':_0x1a07('0x156'),'through':_0x1a07('0x157')});db[_0x1a07('0x1b')][_0x1a07('0x150')](db['User'],{'as':_0x1a07('0x115'),'foreignKey':'UserId'});db[_0x1a07('0x1d')]['belongsTo'](db[_0x1a07('0x115')],{'as':_0x1a07('0x115'),'foreignKey':'UserId'});db[_0x1a07('0x117')][_0x1a07('0x11b')](db[_0x1a07('0x158')],{'as':_0x1a07('0x159'),'onDelete':_0x1a07('0x118'),'foreignKey':'mailboxuser','sourceKey':_0x1a07('0x15a')});db[_0x1a07('0x158')][_0x1a07('0x150')](db[_0x1a07('0x117')],{'foreignKey':_0x1a07('0x15b'),'targetKey':_0x1a07('0x15a')});db[_0x1a07('0x20')][_0x1a07('0x11b')](db[_0x1a07('0x24')],{'as':_0x1a07('0x15c'),'foreignKey':_0x1a07('0x15d'),'constraints':![]});db[_0x1a07('0x20')][_0x1a07('0x11b')](db[_0x1a07('0x15e')],{'as':_0x1a07('0x15f'),'foreignKey':_0x1a07('0x15d'),'constraints':![]});db[_0x1a07('0x20')][_0x1a07('0x150')](db[_0x1a07('0x115')],{'as':'User','foreignKey':_0x1a07('0x119')});db[_0x1a07('0x20')][_0x1a07('0x150')](db['CmContact'],{'as':_0x1a07('0x160'),'foreignKey':_0x1a07('0x161')});db[_0x1a07('0x37')][_0x1a07('0x150')](db[_0x1a07('0x3b')],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0x1a07('0x37')][_0x1a07('0x150')](db[_0x1a07('0x10d')],{'as':_0x1a07('0x10d'),'foreignKey':'CloudProviderId','onDelete':_0x1a07('0x162')});db[_0x1a07('0x39')][_0x1a07('0x150')](db['MailAccount'],{'as':_0x1a07('0x3b'),'foreignKey':_0x1a07('0x163')});db[_0x1a07('0x39')]['belongsTo'](db['CloudProvider'],{'as':'CloudProvider','foreignKey':_0x1a07('0x164'),'onDelete':_0x1a07('0x162')});db[_0x1a07('0x3b')][_0x1a07('0x116')](db[_0x1a07('0x37')],{'as':'Imap','onDelete':_0x1a07('0x118')});db[_0x1a07('0x3b')][_0x1a07('0x116')](db[_0x1a07('0x39')],{'as':_0x1a07('0x165'),'onDelete':'cascade'});db[_0x1a07('0x3b')]['hasMany'](db['Disposition'],{'as':_0x1a07('0x166'),'foreignKey':'MailAccountId','onDelete':_0x1a07('0x118')});db['MailAccount']['hasMany'](db[_0x1a07('0x82')],{'as':'Answers','foreignKey':_0x1a07('0x163')});db[_0x1a07('0x3b')][_0x1a07('0x11b')](db[_0x1a07('0x42')],{'as':_0x1a07('0x159'),'foreignKey':'MailAccountId'});db[_0x1a07('0x3b')][_0x1a07('0x11b')](db[_0x1a07('0x40')],{'as':_0x1a07('0x167')});db[_0x1a07('0x3b')][_0x1a07('0x11b')](db['MailApplication'],{'as':_0x1a07('0x145')});db[_0x1a07('0x3b')][_0x1a07('0x150')](db[_0x1a07('0x12c')],{'as':'List','foreignKey':_0x1a07('0x168')});db['MailAccount'][_0x1a07('0x150')](db[_0x1a07('0x94')],{'as':'Template','foreignKey':'TemplateId'});db['MailAccount'][_0x1a07('0x150')](db[_0x1a07('0x87')],{'as':_0x1a07('0x152'),'foreignKey':_0x1a07('0x153')});db[_0x1a07('0x3b')][_0x1a07('0x12a')](db[_0x1a07('0x115')],{'as':_0x1a07('0x169'),'through':_0x1a07('0x13f')});db[_0x1a07('0x3d')]['belongsToMany'](db[_0x1a07('0x115')],{'as':'Agents','through':_0x1a07('0x2e')});db[_0x1a07('0x3d')][_0x1a07('0x12a')](db['Team'],{'through':_0x1a07('0x16a'),'as':'Teams'});db[_0x1a07('0x40')]['hasMany'](db[_0x1a07('0x42')],{'as':_0x1a07('0x159'),'onDelete':'cascade','foreignKey':_0x1a07('0x16b')});db[_0x1a07('0x40')][_0x1a07('0x150')](db[_0x1a07('0x3b')],{'as':_0x1a07('0x16c'),'foreignKey':_0x1a07('0x163')});db[_0x1a07('0x40')][_0x1a07('0x150')](db['CmContact'],{'as':_0x1a07('0x160'),'foreignKey':_0x1a07('0x161')});db[_0x1a07('0x40')][_0x1a07('0x150')](db['User'],{'as':_0x1a07('0x16d'),'foreignKey':'UserId'});db['MailInteraction'][_0x1a07('0x12a')](db[_0x1a07('0x8e')],{'through':_0x1a07('0x16e'),'as':'Tags'});db['MailInteraction'][_0x1a07('0x12a')](db['Tag'],{'through':'mail_interaction_has_tags','as':_0x1a07('0x16f')});db[_0x1a07('0x40')][_0x1a07('0x12a')](db[_0x1a07('0x115')],{'as':_0x1a07('0x170'),'through':_0x1a07('0x12f'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x1a07('0x11b')](db[_0x1a07('0xf0')],{'as':_0x1a07('0x171'),'onDelete':_0x1a07('0x118')});db[_0x1a07('0x42')][_0x1a07('0x150')](db['User'],{'as':_0x1a07('0x115')});db['MailMessage'][_0x1a07('0x150')](db['CmContact'],{'onDelete':'cascade','as':_0x1a07('0x160')});db[_0x1a07('0x42')][_0x1a07('0x150')](db[_0x1a07('0x40')],{'as':_0x1a07('0x172'),'foreignKey':_0x1a07('0x16b')});db['MailMessage'][_0x1a07('0x150')](db[_0x1a07('0x3b')],{'as':_0x1a07('0x16c'),'foreignKey':'MailAccountId'});db[_0x1a07('0x42')]['belongsTo'](db[_0x1a07('0x66')],{'as':_0x1a07('0x66'),'foreignKey':_0x1a07('0x173')});db[_0x1a07('0x42')][_0x1a07('0x150')](db['ChatOfflineMessage'],{'as':_0x1a07('0x6a'),'foreignKey':_0x1a07('0x174')});db['MailApplication']['belongsTo'](db[_0x1a07('0x115')],{'onDelete':_0x1a07('0x162')});db[_0x1a07('0x175')][_0x1a07('0x150')](db[_0x1a07('0x3d')],{'onDelete':'restrict'});db['MailApplication'][_0x1a07('0x150')](db[_0x1a07('0x3b')],{'onDelete':'restrict'});db[_0x1a07('0x175')][_0x1a07('0x150')](db[_0x1a07('0x85')],{'onDelete':_0x1a07('0x162'),'foreignKey':_0x1a07('0x151')});db[_0x1a07('0x175')][_0x1a07('0x150')](db['Tag'],{'onDelete':_0x1a07('0x162'),'foreignKey':_0x1a07('0x176')});db[_0x1a07('0x45')]['belongsTo'](db[_0x1a07('0x3b')],{});db[_0x1a07('0x45')][_0x1a07('0x150')](db['CmList'],{'as':_0x1a07('0x177'),'foreignKey':_0x1a07('0x168')});db['MailQueueReport']['belongsTo'](db['CmContact'],{'as':_0x1a07('0x160'),'foreignKey':_0x1a07('0x161')});db[_0x1a07('0x45')][_0x1a07('0x150')](db[_0x1a07('0x40')],{});db[_0x1a07('0x45')]['belongsTo'](db['MailMessage'],{});db[_0x1a07('0x45')][_0x1a07('0x150')](db['User'],{});db[_0x1a07('0x45')]['belongsTo'](db[_0x1a07('0x3d')],{});db['Dashboard'][_0x1a07('0x11b')](db[_0x1a07('0x178')],{'as':_0x1a07('0x179'),'onDelete':'cascade'});db[_0x1a07('0x13d')][_0x1a07('0x11b')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x1a07('0x17a'),'onDelete':_0x1a07('0x118')});db['FaxAccount'][_0x1a07('0x11b')](db['CannedAnswer'],{'as':_0x1a07('0x17b'),'foreignKey':_0x1a07('0x17a')});db[_0x1a07('0x13d')][_0x1a07('0x11b')](db[_0x1a07('0x4c')],{'as':_0x1a07('0x167')});db[_0x1a07('0x13d')][_0x1a07('0x11b')](db[_0x1a07('0x4a')],{'as':_0x1a07('0x145')});db[_0x1a07('0x13d')]['hasMany'](db[_0x1a07('0x16')],{'as':'Exntensions','onDelete':_0x1a07('0x118')});db[_0x1a07('0x13d')]['hasMany'](db[_0x1a07('0x4e')],{'as':'Messages'});db['FaxAccount'][_0x1a07('0x150')](db[_0x1a07('0x26')],{'as':'Trunk'});db[_0x1a07('0x13d')][_0x1a07('0x150')](db['CmList'],{'as':_0x1a07('0x177'),'foreignKey':_0x1a07('0x168')});db[_0x1a07('0x13d')][_0x1a07('0x150')](db['Pause'],{'as':_0x1a07('0x152'),'foreignKey':_0x1a07('0x153')});db[_0x1a07('0x13d')]['belongsToMany'](db['User'],{'as':_0x1a07('0x169'),'through':_0x1a07('0x17c')});db[_0x1a07('0x4a')][_0x1a07('0x150')](db[_0x1a07('0x115')],{'onDelete':_0x1a07('0x162')});db[_0x1a07('0x4a')]['belongsTo'](db[_0x1a07('0x50')],{'onDelete':_0x1a07('0x162')});db['FaxApplication']['belongsTo'](db[_0x1a07('0x13d')],{'onDelete':_0x1a07('0x162')});db['FaxApplication'][_0x1a07('0x150')](db[_0x1a07('0x8e')],{'onDelete':_0x1a07('0x162'),'foreignKey':_0x1a07('0x176')});db['FaxInteraction'][_0x1a07('0x11b')](db['FaxMessage'],{'as':_0x1a07('0x159'),'onDelete':_0x1a07('0x118'),'foreignKey':'FaxInteractionId'});db[_0x1a07('0x4c')]['belongsTo'](db[_0x1a07('0x13d')],{'as':_0x1a07('0x16c'),'foreignKey':_0x1a07('0x17a')});db[_0x1a07('0x4c')][_0x1a07('0x150')](db['CmContact'],{'as':_0x1a07('0x160'),'foreignKey':'ContactId'});db['FaxInteraction'][_0x1a07('0x150')](db['User'],{'as':_0x1a07('0x16d'),'foreignKey':_0x1a07('0x119')});db[_0x1a07('0x4c')][_0x1a07('0x12a')](db[_0x1a07('0x8e')],{'through':_0x1a07('0x17d'),'as':_0x1a07('0x17e')});db[_0x1a07('0x4c')][_0x1a07('0x12a')](db[_0x1a07('0x8e')],{'through':'fax_interaction_has_tags','as':_0x1a07('0x16f')});db[_0x1a07('0x4c')][_0x1a07('0x12a')](db[_0x1a07('0x115')],{'as':_0x1a07('0x170'),'through':_0x1a07('0x131'),'foreignKey':_0x1a07('0x17f')});db[_0x1a07('0x4e')][_0x1a07('0x150')](db['User'],{'onDelete':_0x1a07('0x118'),'as':_0x1a07('0x115')});db[_0x1a07('0x4e')]['belongsTo'](db[_0x1a07('0x4c')],{'as':_0x1a07('0x172'),'foreignKey':_0x1a07('0x17f')});db[_0x1a07('0x4e')]['belongsTo'](db[_0x1a07('0x71')],{'onDelete':'cascade','as':_0x1a07('0x160')});db['FaxMessage']['belongsTo'](db[_0x1a07('0xf0')],{'as':'Attachment','foreignKey':_0x1a07('0x180')});db[_0x1a07('0x4e')][_0x1a07('0x150')](db['FaxAccount'],{'as':_0x1a07('0x16c'),'foreignKey':_0x1a07('0x17a')});db[_0x1a07('0x50')][_0x1a07('0x12a')](db[_0x1a07('0x115')],{'as':_0x1a07('0x169'),'through':'UserFaxQueue'});db[_0x1a07('0x50')][_0x1a07('0x12a')](db[_0x1a07('0xe8')],{'through':'team_has_fax_queues','as':_0x1a07('0x181')});db[_0x1a07('0x52')][_0x1a07('0x150')](db[_0x1a07('0x13d')],{});db[_0x1a07('0x52')][_0x1a07('0x150')](db[_0x1a07('0x12c')],{'as':_0x1a07('0x177'),'foreignKey':_0x1a07('0x168')});db[_0x1a07('0x52')][_0x1a07('0x150')](db[_0x1a07('0x71')],{'as':'Contact','foreignKey':_0x1a07('0x161')});db[_0x1a07('0x52')][_0x1a07('0x150')](db[_0x1a07('0x4c')],{});db[_0x1a07('0x52')][_0x1a07('0x150')](db['FaxMessage'],{});db[_0x1a07('0x52')][_0x1a07('0x150')](db[_0x1a07('0x115')],{});db[_0x1a07('0x52')][_0x1a07('0x150')](db[_0x1a07('0x50')],{});db[_0x1a07('0x54')][_0x1a07('0x11b')](db[_0x1a07('0x83')],{'as':_0x1a07('0x166'),'foreignKey':_0x1a07('0x182'),'onDelete':_0x1a07('0x118')});db[_0x1a07('0x54')]['hasMany'](db[_0x1a07('0x82')],{'as':_0x1a07('0x17b'),'foreignKey':_0x1a07('0x182')});db[_0x1a07('0x54')]['hasMany'](db[_0x1a07('0x59')],{'as':_0x1a07('0x159'),'foreignKey':_0x1a07('0x182')});db[_0x1a07('0x54')]['hasMany'](db[_0x1a07('0x57')],{'as':_0x1a07('0x167')});db[_0x1a07('0x54')][_0x1a07('0x11b')](db[_0x1a07('0x55')],{'as':_0x1a07('0x145')});db['SmsAccount'][_0x1a07('0x150')](db[_0x1a07('0x12c')],{'as':'List','foreignKey':_0x1a07('0x168')});db['SmsAccount'][_0x1a07('0x150')](db[_0x1a07('0x87')],{'as':_0x1a07('0x152'),'foreignKey':_0x1a07('0x153')});db[_0x1a07('0x54')][_0x1a07('0x12a')](db[_0x1a07('0x115')],{'as':_0x1a07('0x169'),'through':_0x1a07('0x141')});db[_0x1a07('0x55')][_0x1a07('0x150')](db[_0x1a07('0x115')],{'onDelete':_0x1a07('0x162')});db[_0x1a07('0x55')][_0x1a07('0x150')](db[_0x1a07('0x5b')],{'onDelete':_0x1a07('0x162')});db[_0x1a07('0x55')][_0x1a07('0x150')](db[_0x1a07('0x54')],{'onDelete':_0x1a07('0x162')});db[_0x1a07('0x55')][_0x1a07('0x150')](db['Interval'],{'onDelete':_0x1a07('0x162'),'foreignKey':_0x1a07('0x151')});db['SmsApplication'][_0x1a07('0x150')](db[_0x1a07('0x8e')],{'onDelete':_0x1a07('0x162'),'foreignKey':_0x1a07('0x176')});db['SmsInteraction'][_0x1a07('0x11b')](db[_0x1a07('0x59')],{'as':_0x1a07('0x159'),'onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x183')});db[_0x1a07('0x57')][_0x1a07('0x150')](db[_0x1a07('0x54')],{'as':'Account','foreignKey':_0x1a07('0x182')});db[_0x1a07('0x57')][_0x1a07('0x150')](db['CmContact'],{'as':_0x1a07('0x160'),'foreignKey':_0x1a07('0x161')});db['SmsInteraction'][_0x1a07('0x150')](db['User'],{'as':_0x1a07('0x16d'),'foreignKey':_0x1a07('0x119')});db[_0x1a07('0x57')]['belongsToMany'](db['Tag'],{'through':_0x1a07('0x184'),'as':_0x1a07('0x17e')});db[_0x1a07('0x57')][_0x1a07('0x12a')](db[_0x1a07('0x8e')],{'through':_0x1a07('0x184'),'as':'ThroughTags'});db[_0x1a07('0x57')][_0x1a07('0x12a')](db[_0x1a07('0x115')],{'as':_0x1a07('0x170'),'through':'user_has_sms_interactions','foreignKey':_0x1a07('0x183')});db[_0x1a07('0x59')][_0x1a07('0x150')](db[_0x1a07('0x115')],{'as':_0x1a07('0x115')});db[_0x1a07('0x59')][_0x1a07('0x150')](db[_0x1a07('0x71')],{'onDelete':'cascade','as':_0x1a07('0x160')});db[_0x1a07('0x59')][_0x1a07('0x150')](db[_0x1a07('0x57')],{'onDelete':_0x1a07('0x118'),'as':'Interaction','foreignKey':_0x1a07('0x183')});db[_0x1a07('0x59')][_0x1a07('0x150')](db['SmsAccount'],{'as':'Account','foreignKey':_0x1a07('0x182')});db[_0x1a07('0x5b')][_0x1a07('0x12a')](db[_0x1a07('0x115')],{'as':_0x1a07('0x169'),'through':_0x1a07('0x32'),'foreignKey':_0x1a07('0x185')});db['SmsQueue']['belongsToMany'](db[_0x1a07('0xe8')],{'through':_0x1a07('0x186'),'as':'Teams'});db[_0x1a07('0x5c')][_0x1a07('0x11b')](db[_0x1a07('0x83')],{'as':_0x1a07('0x166'),'foreignKey':_0x1a07('0x187'),'onDelete':_0x1a07('0x118')});db[_0x1a07('0x5c')][_0x1a07('0x11b')](db[_0x1a07('0x82')],{'as':_0x1a07('0x17b'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x1a07('0x11b')](db['OpenchannelInteraction'],{'as':_0x1a07('0x167'),'foreignKey':_0x1a07('0x187')});db[_0x1a07('0x5c')][_0x1a07('0x11b')](db[_0x1a07('0x62')],{'as':_0x1a07('0x159'),'foreignKey':'OpenchannelAccountId'});db[_0x1a07('0x5c')]['hasMany'](db[_0x1a07('0x5e')],{'as':'Applications','foreignKey':_0x1a07('0x187')});db['OpenchannelAccount']['belongsTo'](db[_0x1a07('0x12c')],{'as':'List','foreignKey':'ListId'});db[_0x1a07('0x5c')][_0x1a07('0x150')](db['Pause'],{'as':_0x1a07('0x152'),'foreignKey':_0x1a07('0x153')});db[_0x1a07('0x5c')][_0x1a07('0x12a')](db[_0x1a07('0x115')],{'as':_0x1a07('0x169'),'through':_0x1a07('0x140')});db[_0x1a07('0x5e')]['belongsTo'](db[_0x1a07('0x115')],{'onDelete':'restrict'});db['OpenchannelApplication']['belongsTo'](db[_0x1a07('0x64')],{'onDelete':_0x1a07('0x162'),'foreignKey':'OpenchannelQueueId'});db[_0x1a07('0x5e')][_0x1a07('0x150')](db[_0x1a07('0x5c')],{'onDelete':_0x1a07('0x162'),'foreignKey':_0x1a07('0x187')});db[_0x1a07('0x5e')]['belongsTo'](db[_0x1a07('0x85')],{'onDelete':'restrict','foreignKey':_0x1a07('0x151')});db[_0x1a07('0x5e')]['belongsTo'](db['Tag'],{'onDelete':_0x1a07('0x162'),'foreignKey':_0x1a07('0x176')});db[_0x1a07('0x60')][_0x1a07('0x11b')](db[_0x1a07('0x62')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x1a07('0x188')});db[_0x1a07('0x60')]['belongsTo'](db[_0x1a07('0x5c')],{'as':'Account','foreignKey':'OpenchannelAccountId'});db[_0x1a07('0x60')][_0x1a07('0x150')](db[_0x1a07('0x71')],{'as':_0x1a07('0x160'),'foreignKey':'ContactId'});db['OpenchannelInteraction']['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x1a07('0x119')});db['OpenchannelInteraction'][_0x1a07('0x12a')](db[_0x1a07('0x8e')],{'through':_0x1a07('0x189'),'as':_0x1a07('0x17e')});db['OpenchannelInteraction'][_0x1a07('0x12a')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x1a07('0x16f')});db['OpenchannelInteraction'][_0x1a07('0x12a')](db['User'],{'as':_0x1a07('0x170'),'through':_0x1a07('0x133'),'foreignKey':_0x1a07('0x188')});db[_0x1a07('0x62')][_0x1a07('0x150')](db['User'],{'onDelete':_0x1a07('0x118'),'as':_0x1a07('0x115')});db[_0x1a07('0x62')][_0x1a07('0x150')](db[_0x1a07('0x71')],{'onDelete':_0x1a07('0x118'),'as':_0x1a07('0x160')});db[_0x1a07('0x62')][_0x1a07('0x150')](db['OpenchannelInteraction'],{'onDelete':_0x1a07('0x118'),'as':'Interaction','foreignKey':_0x1a07('0x188')});db[_0x1a07('0x62')][_0x1a07('0x150')](db[_0x1a07('0xf0')],{'as':_0x1a07('0xf0'),'foreignKey':'AttachmentId'});db['OpenchannelMessage'][_0x1a07('0x150')](db['OpenchannelAccount'],{'as':'Account','foreignKey':_0x1a07('0x187')});db['OpenchannelQueue'][_0x1a07('0x12a')](db[_0x1a07('0x115')],{'as':'Agents','through':_0x1a07('0x33'),'foreignKey':'OpenchannelQueueId'});db[_0x1a07('0x64')][_0x1a07('0x12a')](db[_0x1a07('0xe8')],{'through':_0x1a07('0x18a'),'as':_0x1a07('0x181')});db[_0x1a07('0x66')]['hasMany'](db[_0x1a07('0x83')],{'as':'Dispositions','foreignKey':'ChatWebsiteId','onDelete':_0x1a07('0x118')});db[_0x1a07('0x66')][_0x1a07('0x11b')](db['CannedAnswer'],{'as':_0x1a07('0x17b'),'foreignKey':'ChatWebsiteId'});db['ChatWebsite'][_0x1a07('0x11b')](db[_0x1a07('0x6f')],{'as':_0x1a07('0x18b')});db['ChatWebsite'][_0x1a07('0x11b')](db[_0x1a07('0x120')],{'as':_0x1a07('0x167')});db[_0x1a07('0x66')][_0x1a07('0x11b')](db[_0x1a07('0x18c')],{'as':_0x1a07('0x145')});db['ChatWebsite']['hasMany'](db[_0x1a07('0x18d')],{'as':'Messages'});db[_0x1a07('0x66')][_0x1a07('0x150')](db['CmList'],{'as':_0x1a07('0x177'),'foreignKey':'ListId'});db[_0x1a07('0x66')]['belongsTo'](db[_0x1a07('0x85')],{'as':_0x1a07('0x85'),'foreignKey':_0x1a07('0x151')});db['ChatWebsite'][_0x1a07('0x150')](db['MailAccount'],{'as':_0x1a07('0x3b'),'foreignKey':_0x1a07('0x163')});db[_0x1a07('0x66')][_0x1a07('0x150')](db[_0x1a07('0x87')],{'as':'mandatoryDispositionPause','foreignKey':_0x1a07('0x153')});db[_0x1a07('0x66')][_0x1a07('0x12a')](db['User'],{'as':_0x1a07('0x169'),'through':'user_has_chat_websites'});db[_0x1a07('0x18e')][_0x1a07('0x150')](db['OpenchannelAccount'],{});db[_0x1a07('0x18e')][_0x1a07('0x150')](db[_0x1a07('0x12c')],{'as':_0x1a07('0x177'),'foreignKey':_0x1a07('0x168')});db[_0x1a07('0x18e')][_0x1a07('0x150')](db[_0x1a07('0x71')],{'as':_0x1a07('0x160'),'foreignKey':_0x1a07('0x161')});db[_0x1a07('0x18e')]['belongsTo'](db[_0x1a07('0x60')],{});db[_0x1a07('0x18e')]['belongsTo'](db['OpenchannelMessage'],{});db[_0x1a07('0x18e')][_0x1a07('0x150')](db[_0x1a07('0x115')],{});db[_0x1a07('0x18e')][_0x1a07('0x150')](db[_0x1a07('0x64')],{});db['ChatApplication'][_0x1a07('0x150')](db[_0x1a07('0x115')],{'as':_0x1a07('0x18f'),'foreignKey':_0x1a07('0x119'),'onDelete':_0x1a07('0x162')});db[_0x1a07('0x18c')][_0x1a07('0x150')](db[_0x1a07('0x6c')],{'as':_0x1a07('0x190'),'foreignKey':_0x1a07('0x191'),'onDelete':_0x1a07('0x162')});db['ChatApplication']['belongsTo'](db['ChatWebsite'],{'as':'Website','foreignKey':_0x1a07('0x173'),'onDelete':'restrict'});db[_0x1a07('0x18c')][_0x1a07('0x150')](db[_0x1a07('0x8e')],{'onDelete':_0x1a07('0x162'),'foreignKey':_0x1a07('0x176')});db[_0x1a07('0x120')][_0x1a07('0x11b')](db[_0x1a07('0x18d')],{'as':_0x1a07('0x159'),'onDelete':'cascade','foreignKey':_0x1a07('0x192')});db[_0x1a07('0x120')][_0x1a07('0x150')](db[_0x1a07('0x66')],{'as':_0x1a07('0x16c'),'foreignKey':_0x1a07('0x173')});db[_0x1a07('0x120')]['belongsTo'](db[_0x1a07('0x71')],{'as':_0x1a07('0x160'),'foreignKey':_0x1a07('0x161')});db[_0x1a07('0x120')]['belongsTo'](db[_0x1a07('0x115')],{'as':_0x1a07('0x16d'),'foreignKey':_0x1a07('0x119')});db[_0x1a07('0x120')][_0x1a07('0x12a')](db[_0x1a07('0x8e')],{'through':_0x1a07('0x193'),'as':_0x1a07('0x17e')});db[_0x1a07('0x120')][_0x1a07('0x12a')](db['Tag'],{'through':'chat_interaction_has_tags','as':_0x1a07('0x16f')});db[_0x1a07('0x120')][_0x1a07('0x12a')](db['User'],{'as':'Users','through':'user_has_chat_interactions','foreignKey':'ChatInteractionId'});db[_0x1a07('0x18d')][_0x1a07('0x150')](db[_0x1a07('0x115')],{'onDelete':_0x1a07('0x118'),'as':_0x1a07('0x115')});db['ChatMessage'][_0x1a07('0x150')](db[_0x1a07('0x71')],{'onDelete':_0x1a07('0x118'),'as':_0x1a07('0x160'),'foreignKey':_0x1a07('0x161')});db[_0x1a07('0x18d')]['belongsTo'](db['ChatInteraction'],{'onDelete':_0x1a07('0x118'),'as':_0x1a07('0x172'),'foreignKey':'ChatInteractionId'});db[_0x1a07('0x18d')][_0x1a07('0x150')](db[_0x1a07('0xf0')],{'as':_0x1a07('0xf0'),'foreignKey':_0x1a07('0x180')});db['ChatMessage']['belongsTo'](db[_0x1a07('0x66')],{'as':_0x1a07('0x16c'),'foreignKey':'ChatWebsiteId'});db[_0x1a07('0x6a')][_0x1a07('0x11b')](db[_0x1a07('0xf0')],{'as':_0x1a07('0x171'),'foreignKey':_0x1a07('0x174'),'onDelete':'cascade','hooks':!![]});db[_0x1a07('0x6a')][_0x1a07('0x150')](db[_0x1a07('0x71')],{'onDelete':_0x1a07('0x118'),'as':_0x1a07('0x160'),'foreignKey':_0x1a07('0x161')});db[_0x1a07('0x6a')][_0x1a07('0x150')](db[_0x1a07('0x66')],{'as':_0x1a07('0x16c'),'foreignKey':_0x1a07('0x173')});db[_0x1a07('0x6c')][_0x1a07('0x12a')](db['User'],{'as':_0x1a07('0x169'),'through':_0x1a07('0x2c'),'hooks':!![]});db[_0x1a07('0x6c')]['belongsToMany'](db[_0x1a07('0xe8')],{'through':_0x1a07('0x194'),'as':_0x1a07('0x181')});db[_0x1a07('0x6d')][_0x1a07('0x11b')](db[_0x1a07('0x195')],{'as':'Messages','foreignKey':_0x1a07('0x196'),'onDelete':_0x1a07('0x118')});db[_0x1a07('0x6d')][_0x1a07('0x12a')](db[_0x1a07('0x115')],{'as':_0x1a07('0x147'),'through':'chat_group_has_users'});db[_0x1a07('0x6f')][_0x1a07('0x150')](db['ChatWebsite'],{'as':_0x1a07('0x197'),'foreignKey':_0x1a07('0x173')});db['CmCompany'][_0x1a07('0x11b')](db['CmContact'],{'as':_0x1a07('0x12b'),'foreignKey':_0x1a07('0x198')});db[_0x1a07('0x71')][_0x1a07('0x11b')](db['CmContactHasItem'],{'as':_0x1a07('0x199'),'foreignKey':'CmContactId'});db[_0x1a07('0x71')][_0x1a07('0x11b')](db[_0x1a07('0x73')],{'as':'Hoppers','foreignKey':_0x1a07('0x161')});db[_0x1a07('0x71')][_0x1a07('0x11b')](db['CmHopperFinal'],{'as':_0x1a07('0x11e'),'foreignKey':'ContactId'});db[_0x1a07('0x71')][_0x1a07('0x11b')](db[_0x1a07('0x79')],{'as':_0x1a07('0x14a'),'foreignKey':'ContactId'});db[_0x1a07('0x71')][_0x1a07('0x11b')](db['ReportAgentPreview'],{'as':_0x1a07('0x7a'),'foreignKey':_0x1a07('0x161')});db[_0x1a07('0x71')][_0x1a07('0x11b')](db[_0x1a07('0x14b')],{'as':'JscriptySessions','foreignKey':'ContactId'});db[_0x1a07('0x71')][_0x1a07('0x11b')](db['OpenchannelInteraction'],{'as':_0x1a07('0x11f'),'foreignKey':'ContactId','onDelete':_0x1a07('0x162')});db[_0x1a07('0x71')][_0x1a07('0x11b')](db[_0x1a07('0x120')],{'as':_0x1a07('0x121'),'foreignKey':_0x1a07('0x161'),'onDelete':_0x1a07('0x162')});db['CmContact'][_0x1a07('0x11b')](db['SmsInteraction'],{'as':_0x1a07('0x122'),'foreignKey':_0x1a07('0x161'),'onDelete':_0x1a07('0x162')});db[_0x1a07('0x71')][_0x1a07('0x11b')](db[_0x1a07('0x4c')],{'as':_0x1a07('0x123'),'foreignKey':_0x1a07('0x161'),'onDelete':'restrict'});db[_0x1a07('0x71')][_0x1a07('0x11b')](db[_0x1a07('0x40')],{'as':_0x1a07('0x124'),'foreignKey':_0x1a07('0x161'),'onDelete':_0x1a07('0x162')});db[_0x1a07('0x71')][_0x1a07('0x150')](db['CmCompany'],{'as':_0x1a07('0x19a'),'foreignKey':_0x1a07('0x198')});db[_0x1a07('0x71')][_0x1a07('0x150')](db[_0x1a07('0x12c')],{'as':_0x1a07('0x177'),'foreignKey':_0x1a07('0x168'),'onDelete':_0x1a07('0x118')});db[_0x1a07('0x71')][_0x1a07('0x12a')](db['User'],{'as':_0x1a07('0x170'),'through':_0x1a07('0x19b')});db[_0x1a07('0x71')]['belongsToMany'](db['Tag'],{'as':_0x1a07('0x17e'),'through':'cm_contact_has_tags'});db[_0x1a07('0x71')][_0x1a07('0x12a')](db[_0x1a07('0x8e')],{'through':_0x1a07('0x19c'),'as':_0x1a07('0x16f')});db[_0x1a07('0x73')]['hasMany'](db[_0x1a07('0x92')],{'as':_0x1a07('0x19d'),'foreignKey':_0x1a07('0x19e')});db[_0x1a07('0x73')][_0x1a07('0x150')](db[_0x1a07('0x71')],{'as':_0x1a07('0x160'),'foreignKey':_0x1a07('0x161'),'onDelete':_0x1a07('0x118')});db[_0x1a07('0x73')]['belongsTo'](db[_0x1a07('0x12c')],{'as':_0x1a07('0x177'),'foreignKey':_0x1a07('0x168'),'onDelete':_0x1a07('0x118')});db[_0x1a07('0x73')][_0x1a07('0x150')](db[_0x1a07('0x115')],{'as':_0x1a07('0x18f'),'foreignKey':_0x1a07('0x119')});db[_0x1a07('0x73')][_0x1a07('0x150')](db[_0x1a07('0x19')],{'as':_0x1a07('0x190'),'foreignKey':'VoiceQueueId','onDelete':_0x1a07('0x118')});db[_0x1a07('0x73')][_0x1a07('0x150')](db['Campaign'],{'as':_0x1a07('0xec'),'foreignKey':_0x1a07('0x19f'),'onDelete':_0x1a07('0x118')});db[_0x1a07('0x73')]['belongsTo'](db[_0x1a07('0x115')],{'as':'Owner','foreignKey':'OwnerId'});db['CmHopperBlack'][_0x1a07('0x150')](db[_0x1a07('0x71')],{'as':_0x1a07('0x160'),'foreignKey':_0x1a07('0x161'),'onDelete':_0x1a07('0x118')});db[_0x1a07('0x75')][_0x1a07('0x150')](db['CmList'],{'as':_0x1a07('0x177'),'foreignKey':_0x1a07('0x168'),'onDelete':_0x1a07('0x118')});db[_0x1a07('0x75')][_0x1a07('0x150')](db[_0x1a07('0x19')],{'as':'Queue','foreignKey':_0x1a07('0x148'),'onDelete':'cascade'});db[_0x1a07('0x75')][_0x1a07('0x150')](db[_0x1a07('0xec')],{'as':_0x1a07('0xec'),'foreignKey':_0x1a07('0x19f'),'onDelete':_0x1a07('0x118')});db[_0x1a07('0x80')][_0x1a07('0x11b')](db[_0x1a07('0x1a0')],{'as':{'plural':'All','singular':_0x1a07('0x1a1')},'foreignKey':_0x1a07('0x1a2'),'onDelete':'cascade','hooks':!![]});db[_0x1a07('0x80')][_0x1a07('0x11b')](db[_0x1a07('0x1a0')],{'as':{'plural':'Any','singular':_0x1a07('0x1a3')},'foreignKey':_0x1a07('0x1a4'),'onDelete':_0x1a07('0x118'),'hooks':!![]});db[_0x1a07('0x80')]['hasMany'](db[_0x1a07('0x7e')],{'as':_0x1a07('0x1a5'),'foreignKey':_0x1a07('0x1a6'),'onDelete':_0x1a07('0x118'),'hooks':!![]});db[_0x1a07('0x83')][_0x1a07('0x11b')](db[_0x1a07('0x83')],{'as':_0x1a07('0x166'),'foreignKey':_0x1a07('0x1a7'),'onDelete':_0x1a07('0x118')});db['Interval'][_0x1a07('0x11b')](db['Interval'],{'as':_0x1a07('0x1a8'),'foreignKey':_0x1a07('0x151'),'onDelete':_0x1a07('0x118'),'hooks':!![],'required':![]});db['Interval'][_0x1a07('0x11b')](db[_0x1a07('0x16')],{'as':'Extensions','foreignKey':'IntervalId','onDelete':_0x1a07('0x162')});db[_0x1a07('0x85')][_0x1a07('0x11b')](db['MailApplication'],{'as':'MailApplications','foreignKey':_0x1a07('0x151')});db[_0x1a07('0x85')][_0x1a07('0x11b')](db[_0x1a07('0x18c')],{'as':_0x1a07('0x1a9'),'foreignKey':'IntervalId'});db[_0x1a07('0x85')][_0x1a07('0x11b')](db[_0x1a07('0x4a')],{'as':_0x1a07('0x1aa'),'foreignKey':_0x1a07('0x151')});db[_0x1a07('0x85')][_0x1a07('0x11b')](db[_0x1a07('0x55')],{'as':_0x1a07('0x1ab'),'foreignKey':_0x1a07('0x151')});db['Schedule'][_0x1a07('0x150')](db[_0x1a07('0x3b')],{});db[_0x1a07('0x8c')][_0x1a07('0x150')](db[_0x1a07('0x9c')],{'foreignKey':_0x1a07('0x1ac')});db[_0x1a07('0x8c')][_0x1a07('0x150')](db[_0x1a07('0x9a')],{'foreignKey':_0x1a07('0x1ad')});db[_0x1a07('0x1ae')][_0x1a07('0x12a')](db[_0x1a07('0x17')],{'as':_0x1a07('0x1af'),'through':_0x1a07('0x1b0'),'onDelete':'restrict'});db[_0x1a07('0x8e')][_0x1a07('0x12a')](db[_0x1a07('0x71')],{'through':_0x1a07('0x19c')});db[_0x1a07('0x8e')][_0x1a07('0x12a')](db[_0x1a07('0x120')],{'through':_0x1a07('0x193')});db[_0x1a07('0x8e')][_0x1a07('0x12a')](db[_0x1a07('0x40')],{'through':'mail_interaction_has_tags'});db['Tag'][_0x1a07('0x12a')](db[_0x1a07('0x57')],{'through':_0x1a07('0x184')});db[_0x1a07('0x8e')][_0x1a07('0x12a')](db[_0x1a07('0x4c')],{'through':_0x1a07('0x17d')});db[_0x1a07('0x8e')][_0x1a07('0x12a')](db['OpenchannelInteraction'],{'through':_0x1a07('0x189')});db[_0x1a07('0x8e')]['belongsToMany'](db[_0x1a07('0x125')],{'through':_0x1a07('0x1b1')});db[_0x1a07('0x91')][_0x1a07('0x150')](db[_0x1a07('0x8f')],{'as':_0x1a07('0x1b2'),'foreignKey':_0x1a07('0x1b3')});db[_0x1a07('0x92')][_0x1a07('0x150')](db['CmHopper'],{'as':'Hopper','foreignKey':'CmHopperId'});db[_0x1a07('0x91')][_0x1a07('0x150')](db['CmContact'],{'as':_0x1a07('0x160'),'foreignKey':_0x1a07('0x1b4')});db[_0x1a07('0x96')]['hasMany'](db[_0x1a07('0x1a0')],{'as':{'plural':'AllConditions','singular':_0x1a07('0x1b5')},'foreignKey':'TriggerAllId','onDelete':_0x1a07('0x118'),'hooks':!![]});db[_0x1a07('0x96')]['hasMany'](db[_0x1a07('0x1a0')],{'as':{'plural':'AnyConditions','singular':_0x1a07('0x1b6')},'foreignKey':_0x1a07('0x1b7'),'onDelete':_0x1a07('0x118'),'hooks':!![]});db[_0x1a07('0x96')][_0x1a07('0x11b')](db[_0x1a07('0x7e')],{'as':'Actions','foreignKey':'TriggerId','onDelete':'cascade','hooks':!![]});db[_0x1a07('0x9a')][_0x1a07('0x11b')](db[_0x1a07('0xa1')],{'as':_0x1a07('0x1b8'),'onDelete':'cascade','foreignKey':_0x1a07('0x1ad'),'hooks':!![]});db[_0x1a07('0x9c')]['hasMany'](db[_0x1a07('0xa1')],{'as':_0x1a07('0x1b8'),'onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x1ac')});db[_0x1a07('0xa0')][_0x1a07('0x11b')](db[_0x1a07('0xa1')],{'as':_0x1a07('0x1b8'),'onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x1b9')});db[_0x1a07('0xa1')]['belongsTo'](db[_0x1a07('0xa0')],{'foreignKey':_0x1a07('0x1b9')});db['SalesforceAccount'][_0x1a07('0x11b')](db[_0x1a07('0xa7')],{'as':_0x1a07('0x1ba'),'onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x1bb')});db[_0x1a07('0xa7')][_0x1a07('0x11b')](db[_0x1a07('0xa9')],{'as':_0x1a07('0x1bc'),'onDelete':_0x1a07('0x118'),'foreignKey':'SubjectId'});db['SalesforceConfiguration'][_0x1a07('0x11b')](db[_0x1a07('0xa9')],{'as':_0x1a07('0x1bd'),'onDelete':'cascade','foreignKey':_0x1a07('0x1be')});db[_0x1a07('0xa7')]['hasMany'](db[_0x1a07('0xa9')],{'as':_0x1a07('0x1b8'),'onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x1bf')});db['SalesforceConfiguration'][_0x1a07('0x150')](db[_0x1a07('0xa5')],{'as':_0x1a07('0x16c'),'foreignKey':'AccountId'});db['SalesforceField'][_0x1a07('0x11b')](db[_0x1a07('0xa9')],{'as':_0x1a07('0x1c0'),'foreignKey':_0x1a07('0x1c1')});db[_0x1a07('0xa9')]['hasMany'](db[_0x1a07('0xa9')],{'as':_0x1a07('0x1c2'),'foreignKey':_0x1a07('0x1be')});db['SalesforceField']['hasMany'](db[_0x1a07('0xa9')],{'as':_0x1a07('0x1c3'),'foreignKey':_0x1a07('0x1bf')});db['SalesforceField'][_0x1a07('0x150')](db[_0x1a07('0x1c4')],{'as':_0x1a07('0x1c4'),'foreignKey':'VariableId'});db['SugarcrmAccount'][_0x1a07('0x11b')](db[_0x1a07('0xab')],{'as':_0x1a07('0x1ba'),'onDelete':_0x1a07('0x118'),'foreignKey':'AccountId'});db[_0x1a07('0xab')]['hasMany'](db[_0x1a07('0x1c5')],{'as':'Subjects','onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x1c1')});db[_0x1a07('0xab')][_0x1a07('0x11b')](db['SugarcrmField'],{'as':_0x1a07('0x1bd'),'onDelete':_0x1a07('0x118'),'foreignKey':'DescriptionId'});db['SugarcrmConfiguration'][_0x1a07('0x11b')](db[_0x1a07('0x1c5')],{'as':_0x1a07('0x1b8'),'onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x1bf')});db[_0x1a07('0xab')][_0x1a07('0x150')](db['SugarcrmAccount'],{'as':_0x1a07('0x16c'),'foreignKey':_0x1a07('0x1bb')});db[_0x1a07('0x1c5')]['hasMany'](db[_0x1a07('0x1c5')],{'as':_0x1a07('0x1c0'),'foreignKey':_0x1a07('0x1c1')});db[_0x1a07('0x1c5')]['hasMany'](db[_0x1a07('0x1c5')],{'as':'Description','foreignKey':_0x1a07('0x1be')});db['SugarcrmField'][_0x1a07('0x11b')](db[_0x1a07('0x1c5')],{'as':_0x1a07('0x1c3'),'foreignKey':_0x1a07('0x1bf')});db[_0x1a07('0x1c5')][_0x1a07('0x150')](db[_0x1a07('0x1c4')],{'as':_0x1a07('0x1c4'),'foreignKey':_0x1a07('0x1c6')});db[_0x1a07('0xad')][_0x1a07('0x11b')](db[_0x1a07('0xaf')],{'as':_0x1a07('0x1ba'),'onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x1bb')});db['DeskConfiguration'][_0x1a07('0x11b')](db[_0x1a07('0xb1')],{'as':_0x1a07('0x1bc'),'onDelete':_0x1a07('0x118'),'foreignKey':'SubjectId'});db[_0x1a07('0xaf')][_0x1a07('0x11b')](db[_0x1a07('0xb1')],{'as':_0x1a07('0x1bd'),'onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x1be')});db[_0x1a07('0xaf')][_0x1a07('0x11b')](db[_0x1a07('0xb1')],{'as':_0x1a07('0x1b8'),'onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x1bf')});db[_0x1a07('0xaf')][_0x1a07('0x150')](db[_0x1a07('0xad')],{'as':'Account','foreignKey':_0x1a07('0x1bb')});db[_0x1a07('0xaf')][_0x1a07('0x12a')](db[_0x1a07('0x8e')],{'through':_0x1a07('0x1c7')});db['DeskField']['hasMany'](db[_0x1a07('0xb1')],{'as':_0x1a07('0x1c0'),'foreignKey':'SubjectId'});db[_0x1a07('0xb1')][_0x1a07('0x11b')](db[_0x1a07('0xb1')],{'as':_0x1a07('0x1c2'),'foreignKey':_0x1a07('0x1be')});db[_0x1a07('0xb1')][_0x1a07('0x11b')](db[_0x1a07('0xb1')],{'as':_0x1a07('0x1c3'),'foreignKey':'FieldId'});db['DeskField']['belongsTo'](db[_0x1a07('0x1c4')],{'as':'Variable','foreignKey':'VariableId'});db[_0x1a07('0xb3')][_0x1a07('0x11b')](db[_0x1a07('0x1c8')],{'as':'Configurations','onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x1bb')});db[_0x1a07('0x1c8')][_0x1a07('0x11b')](db['ZohoField'],{'as':'Subjects','onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x1c1')});db[_0x1a07('0x1c8')][_0x1a07('0x11b')](db[_0x1a07('0xb5')],{'as':'Descriptions','onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x1be')});db['ZohoConfiguration'][_0x1a07('0x11b')](db['ZohoField'],{'as':_0x1a07('0x1b8'),'onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x1bf')});db['ZohoConfiguration'][_0x1a07('0x150')](db['ZohoAccount'],{'as':'Account','foreignKey':_0x1a07('0x1bb')});db[_0x1a07('0xb5')][_0x1a07('0x11b')](db[_0x1a07('0xb5')],{'as':_0x1a07('0x1c0'),'foreignKey':'SubjectId'});db[_0x1a07('0xb5')][_0x1a07('0x11b')](db[_0x1a07('0xb5')],{'as':_0x1a07('0x1c2'),'foreignKey':_0x1a07('0x1be')});db[_0x1a07('0xb5')][_0x1a07('0x11b')](db[_0x1a07('0xb5')],{'as':'Field','foreignKey':_0x1a07('0x1bf')});db[_0x1a07('0xb5')][_0x1a07('0x150')](db['Variable'],{'as':_0x1a07('0x1c4'),'foreignKey':_0x1a07('0x1c6')});db[_0x1a07('0x1c9')]['hasMany'](db[_0x1a07('0xb8')],{'as':_0x1a07('0x1ba'),'onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x1bb')});db[_0x1a07('0xb8')][_0x1a07('0x11b')](db[_0x1a07('0xba')],{'as':_0x1a07('0x1bc'),'foreignKey':'SubjectId'});db[_0x1a07('0xb8')][_0x1a07('0x11b')](db[_0x1a07('0xba')],{'as':_0x1a07('0x1bd'),'foreignKey':'DescriptionId'});db[_0x1a07('0xb8')]['hasMany'](db['ZendeskField'],{'as':_0x1a07('0x1b8'),'foreignKey':_0x1a07('0x1bf')});db['ZendeskConfiguration'][_0x1a07('0x150')](db[_0x1a07('0x1c9')],{'as':_0x1a07('0x16c'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x1a07('0x12a')](db[_0x1a07('0x8e')],{'through':'int_zendesk_configuration_has_tags'});db['ZendeskField'][_0x1a07('0x11b')](db[_0x1a07('0xba')],{'as':_0x1a07('0x1c0'),'foreignKey':_0x1a07('0x1c1')});db[_0x1a07('0xba')][_0x1a07('0x11b')](db[_0x1a07('0xba')],{'as':_0x1a07('0x1c2'),'foreignKey':_0x1a07('0x1be')});db[_0x1a07('0xba')][_0x1a07('0x11b')](db[_0x1a07('0xba')],{'as':_0x1a07('0x1c3'),'foreignKey':'FieldId'});db[_0x1a07('0xba')][_0x1a07('0x150')](db[_0x1a07('0x1c4')],{'as':'Variable','foreignKey':_0x1a07('0x1c6')});db[_0x1a07('0xbc')][_0x1a07('0x11b')](db[_0x1a07('0xbe')],{'as':'Configurations','onDelete':_0x1a07('0x118'),'foreignKey':'AccountId'});db[_0x1a07('0xbe')][_0x1a07('0x11b')](db[_0x1a07('0xc0')],{'as':_0x1a07('0x1bc'),'onDelete':'cascade','foreignKey':_0x1a07('0x1c1')});db[_0x1a07('0xbe')][_0x1a07('0x11b')](db[_0x1a07('0xc0')],{'as':_0x1a07('0x1bd'),'onDelete':_0x1a07('0x118'),'foreignKey':'DescriptionId'});db[_0x1a07('0xbe')][_0x1a07('0x11b')](db['FreshdeskField'],{'as':_0x1a07('0x1b8'),'onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x1bf')});db[_0x1a07('0xbe')]['belongsTo'](db[_0x1a07('0xbc')],{'as':'Account','foreignKey':'AccountId'});db[_0x1a07('0xbe')]['belongsToMany'](db[_0x1a07('0x8e')],{'through':_0x1a07('0x1ca')});db[_0x1a07('0xc0')][_0x1a07('0x11b')](db[_0x1a07('0xc0')],{'as':_0x1a07('0x1c0'),'foreignKey':_0x1a07('0x1c1')});db[_0x1a07('0xc0')][_0x1a07('0x11b')](db[_0x1a07('0xc0')],{'as':'Description','foreignKey':_0x1a07('0x1be')});db[_0x1a07('0xc0')][_0x1a07('0x11b')](db[_0x1a07('0xc0')],{'as':'Field','foreignKey':'FieldId'});db[_0x1a07('0xc0')][_0x1a07('0x150')](db['Variable'],{'as':'Variable','foreignKey':_0x1a07('0x1c6')});db['VtigerAccount']['hasMany'](db['VtigerConfiguration'],{'as':_0x1a07('0x1ba'),'onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x1bb')});db[_0x1a07('0x1cb')][_0x1a07('0x11b')](db[_0x1a07('0xc4')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x1a07('0x1cb')]['hasMany'](db[_0x1a07('0xc4')],{'as':_0x1a07('0x1bd'),'foreignKey':_0x1a07('0x1be')});db[_0x1a07('0x1cb')][_0x1a07('0x11b')](db['VtigerField'],{'as':_0x1a07('0x1b8'),'foreignKey':_0x1a07('0x1bf')});db[_0x1a07('0x1cb')][_0x1a07('0x150')](db[_0x1a07('0xc1')],{'as':_0x1a07('0x16c'),'foreignKey':_0x1a07('0x1bb')});db[_0x1a07('0xc4')][_0x1a07('0x11b')](db[_0x1a07('0xc4')],{'as':_0x1a07('0x1c0'),'foreignKey':'SubjectId'});db['VtigerField'][_0x1a07('0x11b')](db['VtigerField'],{'as':_0x1a07('0x1c2'),'foreignKey':_0x1a07('0x1be')});db[_0x1a07('0xc4')]['hasMany'](db['VtigerField'],{'as':_0x1a07('0x1c3'),'foreignKey':_0x1a07('0x1bf')});db[_0x1a07('0xc4')][_0x1a07('0x150')](db['Variable'],{'as':'Variable','foreignKey':_0x1a07('0x1c6')});db[_0x1a07('0xc6')]['hasMany'](db[_0x1a07('0x1cc')],{'as':'Configurations','onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x1bb')});db[_0x1a07('0x1cc')][_0x1a07('0x11b')](db[_0x1a07('0xc9')],{'as':_0x1a07('0x1bc'),'foreignKey':_0x1a07('0x1c1')});db[_0x1a07('0x1cc')][_0x1a07('0x11b')](db[_0x1a07('0xc9')],{'as':_0x1a07('0x1bd'),'foreignKey':'DescriptionId'});db['ServicenowConfiguration']['hasMany'](db[_0x1a07('0xc9')],{'as':'Fields','foreignKey':_0x1a07('0x1bf')});db[_0x1a07('0x1cc')][_0x1a07('0x150')](db[_0x1a07('0xc6')],{'as':'Account','foreignKey':'AccountId'});db[_0x1a07('0xc9')][_0x1a07('0x11b')](db[_0x1a07('0xc9')],{'as':_0x1a07('0x1c0'),'foreignKey':_0x1a07('0x1c1')});db[_0x1a07('0xc9')]['hasMany'](db['ServicenowField'],{'as':'Description','foreignKey':'DescriptionId'});db[_0x1a07('0xc9')][_0x1a07('0x11b')](db[_0x1a07('0xc9')],{'as':'Field','foreignKey':'FieldId'});db['ServicenowField']['belongsTo'](db[_0x1a07('0x1c4')],{'as':_0x1a07('0x1c4'),'foreignKey':'VariableId'});db[_0x1a07('0xcb')][_0x1a07('0x11b')](db[_0x1a07('0xcc')],{'as':_0x1a07('0x1ba'),'onDelete':'cascade','foreignKey':_0x1a07('0x1bb')});db['Dynamics365Account'][_0x1a07('0x150')](db[_0x1a07('0x10d')],{'as':_0x1a07('0x10d'),'foreignKey':_0x1a07('0x164')});db[_0x1a07('0xcc')][_0x1a07('0x11b')](db['Dynamics365Field'],{'as':_0x1a07('0x1bc'),'onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x1c1')});db[_0x1a07('0xcc')][_0x1a07('0x11b')](db[_0x1a07('0xce')],{'as':_0x1a07('0x1bd'),'onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x1be')});db[_0x1a07('0xcc')][_0x1a07('0x11b')](db[_0x1a07('0xce')],{'as':_0x1a07('0x1b8'),'onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x1bf')});db[_0x1a07('0xcc')][_0x1a07('0x150')](db['Dynamics365Account'],{'as':_0x1a07('0x16c'),'foreignKey':_0x1a07('0x1bb')});db['Dynamics365Field'][_0x1a07('0x11b')](db[_0x1a07('0xce')],{'as':_0x1a07('0x1c0'),'foreignKey':'SubjectId'});db[_0x1a07('0xce')][_0x1a07('0x11b')](db['Dynamics365Field'],{'as':_0x1a07('0x1c2'),'foreignKey':_0x1a07('0x1be')});db[_0x1a07('0xce')][_0x1a07('0x11b')](db[_0x1a07('0xce')],{'as':'Field','foreignKey':'FieldId'});db[_0x1a07('0xce')][_0x1a07('0x150')](db[_0x1a07('0x1c4')],{'as':_0x1a07('0x1c4'),'foreignKey':_0x1a07('0x1c6')});db[_0x1a07('0xd0')][_0x1a07('0x11b')](db['FreshsalesConfiguration'],{'as':_0x1a07('0x1ba'),'onDelete':_0x1a07('0x118'),'foreignKey':'AccountId'});db['FreshsalesConfiguration'][_0x1a07('0x11b')](db[_0x1a07('0xd4')],{'as':_0x1a07('0x1bc'),'foreignKey':_0x1a07('0x1c1')});db[_0x1a07('0xd2')][_0x1a07('0x11b')](db['FreshsalesField'],{'as':'Descriptions','foreignKey':_0x1a07('0x1be')});db['FreshsalesConfiguration'][_0x1a07('0x11b')](db[_0x1a07('0xd4')],{'as':_0x1a07('0x1b8'),'foreignKey':_0x1a07('0x1bf')});db[_0x1a07('0xd2')][_0x1a07('0x150')](db[_0x1a07('0xd0')],{'as':_0x1a07('0x16c'),'foreignKey':_0x1a07('0x1bb')});db[_0x1a07('0xd4')]['hasMany'](db[_0x1a07('0xd4')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x1a07('0xd4')][_0x1a07('0x11b')](db['FreshsalesField'],{'as':'Description','foreignKey':_0x1a07('0x1be')});db[_0x1a07('0xd4')][_0x1a07('0x11b')](db[_0x1a07('0xd4')],{'as':'Field','foreignKey':_0x1a07('0x1bf')});db['FreshsalesField'][_0x1a07('0x150')](db['Variable'],{'as':_0x1a07('0x1c4'),'foreignKey':_0x1a07('0x1c6')});db[_0x1a07('0xd7')][_0x1a07('0x150')](db[_0x1a07('0x66')],{});db[_0x1a07('0xd7')][_0x1a07('0x150')](db[_0x1a07('0x12c')],{'as':_0x1a07('0x177'),'foreignKey':_0x1a07('0x168')});db[_0x1a07('0xd7')][_0x1a07('0x150')](db[_0x1a07('0x71')],{'as':_0x1a07('0x160'),'foreignKey':'ContactId'});db[_0x1a07('0xd7')][_0x1a07('0x150')](db['ChatInteraction'],{});db[_0x1a07('0xd7')][_0x1a07('0x150')](db[_0x1a07('0x18d')],{});db[_0x1a07('0xd7')]['belongsTo'](db['User'],{});db[_0x1a07('0xd7')][_0x1a07('0x150')](db[_0x1a07('0x6c')],{});db[_0x1a07('0x195')][_0x1a07('0x150')](db[_0x1a07('0x115')],{'onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x1cd')});db[_0x1a07('0x195')][_0x1a07('0x150')](db[_0x1a07('0x115')],{'onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x1ce')});db[_0x1a07('0x14b')][_0x1a07('0x11b')](db[_0x1a07('0x1cf')],{'foreignKey':_0x1a07('0x1d0'),'onDelete':'cascade'});db[_0x1a07('0x14b')][_0x1a07('0x11b')](db[_0x1a07('0xd8')],{'foreignKey':_0x1a07('0x1d0'),'onDelete':_0x1a07('0x118')});db[_0x1a07('0xdc')][_0x1a07('0x150')](db['SmsAccount'],{});db[_0x1a07('0xdc')][_0x1a07('0x150')](db['CmList'],{'as':_0x1a07('0x177'),'foreignKey':_0x1a07('0x168')});db[_0x1a07('0xdc')][_0x1a07('0x150')](db['CmContact'],{'as':_0x1a07('0x160'),'foreignKey':_0x1a07('0x161')});db[_0x1a07('0xdc')][_0x1a07('0x150')](db[_0x1a07('0x57')],{});db['SmsQueueReport'][_0x1a07('0x150')](db[_0x1a07('0x59')],{});db[_0x1a07('0xdc')][_0x1a07('0x150')](db['User'],{});db[_0x1a07('0xdc')][_0x1a07('0x150')](db[_0x1a07('0x5b')],{});db[_0x1a07('0xe0')]['hasMany'](db[_0x1a07('0x14b')],{'foreignKey':_0x1a07('0x1d1')});db[_0x1a07('0xe0')][_0x1a07('0x11b')](db[_0x1a07('0x1cf')],{'foreignKey':_0x1a07('0x1d1')});db[_0x1a07('0xe0')]['hasMany'](db[_0x1a07('0xd8')],{'foreignKey':_0x1a07('0x1d1')});db[_0x1a07('0xe8')]['belongsToMany'](db['User'],{'as':_0x1a07('0x169'),'through':_0x1a07('0x12e')});db[_0x1a07('0xe8')][_0x1a07('0x12a')](db[_0x1a07('0x19')],{'through':'TeamVoiceQueue','as':_0x1a07('0x1d2')});db[_0x1a07('0xe8')]['belongsToMany'](db[_0x1a07('0x3d')],{'through':'team_has_mail_queues','as':'MailQueues'});db[_0x1a07('0xe8')]['belongsToMany'](db['ChatQueue'],{'through':_0x1a07('0x194'),'as':_0x1a07('0x138')});db[_0x1a07('0xe8')]['belongsToMany'](db[_0x1a07('0x50')],{'through':'team_has_fax_queues','as':'FaxQueues'});db[_0x1a07('0xe8')]['belongsToMany'](db[_0x1a07('0x5b')],{'through':_0x1a07('0x186'),'as':_0x1a07('0x139')});db['Team'][_0x1a07('0x12a')](db[_0x1a07('0x64')],{'through':_0x1a07('0x18a'),'as':_0x1a07('0x13a')});db[_0x1a07('0xe8')][_0x1a07('0x12a')](db[_0x1a07('0x10b')],{'through':_0x1a07('0x1d3'),'as':'WhatsappQueues'});db['Team']['belongsToMany'](db[_0x1a07('0x1d4')],{'through':'TeamVoicePrefix','as':_0x1a07('0x136')});db[_0x1a07('0xec')][_0x1a07('0x11b')](db[_0x1a07('0x73')],{'as':'Hoppers','foreignKey':'CampaignId'});db[_0x1a07('0xec')][_0x1a07('0x11b')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x1a07('0x19f')});db[_0x1a07('0xec')][_0x1a07('0x11b')](db[_0x1a07('0x79')],{'as':_0x1a07('0x14a'),'foreignKey':_0x1a07('0x19f')});db[_0x1a07('0xec')][_0x1a07('0x11b')](db[_0x1a07('0x75')],{'as':_0x1a07('0x1d5'),'foreignKey':'CampaignId'});db[_0x1a07('0xec')]['belongsTo'](db['Trunk'],{'as':'Trunk','foreignKey':'TrunkId'});db[_0x1a07('0xec')]['belongsTo'](db['Trunk'],{'as':_0x1a07('0x14e'),'foreignKey':_0x1a07('0x14f')});db[_0x1a07('0xec')][_0x1a07('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x1a07('0x151')});db[_0x1a07('0xec')][_0x1a07('0x150')](db[_0x1a07('0xe3')],{'as':_0x1a07('0xe3'),'foreignKey':_0x1a07('0x1d6')});db[_0x1a07('0xec')][_0x1a07('0x12a')](db['CmList'],{'as':_0x1a07('0x154'),'through':_0x1a07('0x1d7')});db[_0x1a07('0xec')][_0x1a07('0x12a')](db[_0x1a07('0x12c')],{'as':_0x1a07('0x156'),'through':'campaigns_has_cm_blacklists'});db[_0x1a07('0xf0')][_0x1a07('0x150')](db[_0x1a07('0x6a')],{'as':'ChatOfflineMessage','foreignKey':_0x1a07('0x174')});db['MailTransferReport'][_0x1a07('0x150')](db[_0x1a07('0x42')],{});db[_0x1a07('0x1d8')][_0x1a07('0x150')](db[_0x1a07('0x40')],{});db['MailTransferReport'][_0x1a07('0x150')](db[_0x1a07('0x3b')],{'foreignKey':_0x1a07('0x1d9'),'as':_0x1a07('0x1da')});db[_0x1a07('0x1d8')][_0x1a07('0x150')](db['User'],{'foreignKey':'FromUserId','as':_0x1a07('0x1db')});db[_0x1a07('0x1d8')]['belongsTo'](db[_0x1a07('0x115')],{'foreignKey':_0x1a07('0x1dc'),'as':_0x1a07('0x1dd')});db[_0x1a07('0x1d8')][_0x1a07('0x150')](db[_0x1a07('0x3d')],{'foreignKey':_0x1a07('0x1de'),'as':'ToQueue'});db[_0x1a07('0x1d8')][_0x1a07('0x150')](db[_0x1a07('0x3b')],{'foreignKey':_0x1a07('0x1df'),'as':'ToAccount'});db[_0x1a07('0x1e0')][_0x1a07('0x150')](db[_0x1a07('0x18d')],{});db[_0x1a07('0x1e0')][_0x1a07('0x150')](db[_0x1a07('0x120')],{});db[_0x1a07('0x1e0')][_0x1a07('0x150')](db['ChatWebsite'],{'foreignKey':_0x1a07('0x1e1'),'as':_0x1a07('0x1da')});db['ChatTransferReport'][_0x1a07('0x150')](db[_0x1a07('0x115')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x1a07('0x1e0')][_0x1a07('0x150')](db[_0x1a07('0x115')],{'foreignKey':_0x1a07('0x1dc'),'as':'ToAgent'});db[_0x1a07('0x1e0')][_0x1a07('0x150')](db['ChatQueue'],{'foreignKey':'ToChatQueueId','as':_0x1a07('0x1e2')});db[_0x1a07('0x1e0')][_0x1a07('0x150')](db['ChatWebsite'],{'foreignKey':_0x1a07('0x1e3'),'as':_0x1a07('0x1e4')});db[_0x1a07('0xf5')]['belongsTo'](db[_0x1a07('0x4e')],{});db[_0x1a07('0xf5')][_0x1a07('0x150')](db[_0x1a07('0x4c')],{});db[_0x1a07('0xf5')]['belongsTo'](db['FaxAccount'],{'foreignKey':_0x1a07('0x1e5'),'as':_0x1a07('0x1da')});db['FaxTransferReport'][_0x1a07('0x150')](db['User'],{'foreignKey':_0x1a07('0x1e6'),'as':'FromAgent'});db[_0x1a07('0xf5')][_0x1a07('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x1a07('0x1dd')});db[_0x1a07('0xf5')][_0x1a07('0x150')](db[_0x1a07('0x50')],{'foreignKey':_0x1a07('0x1e7'),'as':_0x1a07('0x1e2')});db['FaxTransferReport'][_0x1a07('0x150')](db['FaxAccount'],{'foreignKey':_0x1a07('0x1e8'),'as':_0x1a07('0x1e4')});db[_0x1a07('0xf6')]['belongsTo'](db[_0x1a07('0x62')],{});db[_0x1a07('0xf6')][_0x1a07('0x150')](db[_0x1a07('0x60')],{});db[_0x1a07('0xf6')][_0x1a07('0x150')](db[_0x1a07('0x5c')],{'foreignKey':_0x1a07('0x1e9'),'as':_0x1a07('0x1da')});db[_0x1a07('0xf6')]['belongsTo'](db[_0x1a07('0x115')],{'foreignKey':_0x1a07('0x1e6'),'as':_0x1a07('0x1db')});db[_0x1a07('0xf6')][_0x1a07('0x150')](db[_0x1a07('0x115')],{'foreignKey':_0x1a07('0x1dc'),'as':_0x1a07('0x1dd')});db[_0x1a07('0xf6')][_0x1a07('0x150')](db[_0x1a07('0x64')],{'foreignKey':_0x1a07('0x1ea'),'as':_0x1a07('0x1e2')});db[_0x1a07('0xf6')][_0x1a07('0x150')](db[_0x1a07('0x5c')],{'foreignKey':'ToOpenchannelAccountId','as':_0x1a07('0x1e4')});db[_0x1a07('0xf8')]['belongsTo'](db[_0x1a07('0x59')],{});db[_0x1a07('0xf8')][_0x1a07('0x150')](db[_0x1a07('0x57')],{});db[_0x1a07('0xf8')][_0x1a07('0x150')](db['SmsAccount'],{'foreignKey':_0x1a07('0x1eb'),'as':'FromAccount'});db[_0x1a07('0xf8')]['belongsTo'](db['User'],{'foreignKey':_0x1a07('0x1e6'),'as':_0x1a07('0x1db')});db[_0x1a07('0xf8')][_0x1a07('0x150')](db['User'],{'foreignKey':_0x1a07('0x1dc'),'as':_0x1a07('0x1dd')});db[_0x1a07('0xf8')]['belongsTo'](db[_0x1a07('0x5b')],{'foreignKey':'ToSmsQueueId','as':_0x1a07('0x1e2')});db[_0x1a07('0xf8')][_0x1a07('0x150')](db[_0x1a07('0x54')],{'foreignKey':_0x1a07('0x1ec'),'as':'ToAccount'});db[_0x1a07('0x12c')]['hasMany'](db[_0x1a07('0x83')],{'as':_0x1a07('0x166'),'foreignKey':_0x1a07('0x168'),'onDelete':_0x1a07('0x118')});db['CmList']['hasMany'](db[_0x1a07('0x7c')],{'as':_0x1a07('0x1ed'),'foreignKey':_0x1a07('0x168')});db[_0x1a07('0x12c')]['hasMany'](db['CmContact'],{'as':_0x1a07('0x12b'),'onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x168')});db[_0x1a07('0x12c')][_0x1a07('0x11b')](db[_0x1a07('0x77')],{'as':'HopperFinals','foreignKey':'ListId'});db[_0x1a07('0x12c')][_0x1a07('0x11b')](db[_0x1a07('0x79')],{'as':_0x1a07('0x1ee'),'foreignKey':'ListId'});db[_0x1a07('0x12c')][_0x1a07('0x11b')](db[_0x1a07('0x7a')],{'as':_0x1a07('0x7a'),'foreignKey':_0x1a07('0x168')});db[_0x1a07('0x12c')]['belongsToMany'](db[_0x1a07('0x19')],{'as':_0x1a07('0x1ef'),'through':_0x1a07('0x1f0')});db[_0x1a07('0x12c')][_0x1a07('0x12a')](db[_0x1a07('0x115')],{'as':_0x1a07('0x169'),'through':_0x1a07('0x12d')});db[_0x1a07('0x1d4')][_0x1a07('0x11b')](db[_0x1a07('0x16')],{'as':_0x1a07('0x11d'),'onDelete':'cascade'});db[_0x1a07('0x1d4')][_0x1a07('0x12a')](db[_0x1a07('0x115')],{'as':_0x1a07('0x169'),'through':_0x1a07('0x111')});db[_0x1a07('0x1d4')][_0x1a07('0x12a')](db[_0x1a07('0xe8')],{'through':_0x1a07('0x10f'),'as':_0x1a07('0x181')});db[_0x1a07('0xfc')][_0x1a07('0x11b')](db['User'],{'as':'Users','foreignKey':'userProfileId'});db[_0x1a07('0xfc')][_0x1a07('0x11b')](db['UserProfileSection'],{'as':_0x1a07('0x1f1'),'foreignKey':_0x1a07('0x1f2'),'onDelete':_0x1a07('0x118')});db[_0x1a07('0x1f3')]['hasMany'](db[_0x1a07('0xff')],{'as':_0x1a07('0x1f4'),'foreignKey':'sectionId','onDelete':'cascade'});db[_0x1a07('0x102')][_0x1a07('0x11b')](db[_0x1a07('0x83')],{'as':_0x1a07('0x166'),'foreignKey':_0x1a07('0x1f5'),'onDelete':_0x1a07('0x118')});db[_0x1a07('0x102')][_0x1a07('0x11b')](db[_0x1a07('0x82')],{'as':_0x1a07('0x17b'),'foreignKey':_0x1a07('0x1f5')});db[_0x1a07('0x102')][_0x1a07('0x11b')](db[_0x1a07('0x107')],{'as':_0x1a07('0x159'),'foreignKey':_0x1a07('0x1f5')});db[_0x1a07('0x102')][_0x1a07('0x11b')](db[_0x1a07('0x125')],{'as':_0x1a07('0x167')});db[_0x1a07('0x102')][_0x1a07('0x11b')](db[_0x1a07('0x104')],{'as':_0x1a07('0x145')});db[_0x1a07('0x102')][_0x1a07('0x150')](db[_0x1a07('0x12c')],{'as':_0x1a07('0x177'),'foreignKey':_0x1a07('0x168')});db[_0x1a07('0x102')][_0x1a07('0x150')](db[_0x1a07('0x87')],{'as':_0x1a07('0x152'),'foreignKey':_0x1a07('0x153')});db[_0x1a07('0x102')][_0x1a07('0x12a')](db[_0x1a07('0x115')],{'as':_0x1a07('0x169'),'through':_0x1a07('0x1f6')});db[_0x1a07('0x104')][_0x1a07('0x150')](db[_0x1a07('0x115')],{'onDelete':_0x1a07('0x162')});db['WhatsappApplication'][_0x1a07('0x150')](db[_0x1a07('0x10b')],{'onDelete':_0x1a07('0x162')});db[_0x1a07('0x104')][_0x1a07('0x150')](db[_0x1a07('0x102')],{'onDelete':'restrict'});db[_0x1a07('0x104')][_0x1a07('0x150')](db['Interval'],{'onDelete':_0x1a07('0x162'),'foreignKey':'IntervalId'});db[_0x1a07('0x104')][_0x1a07('0x150')](db['Tag'],{'onDelete':_0x1a07('0x162'),'foreignKey':_0x1a07('0x176')});db[_0x1a07('0x125')][_0x1a07('0x11b')](db[_0x1a07('0x107')],{'as':_0x1a07('0x159'),'onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x1f7')});db['WhatsappInteraction']['belongsTo'](db[_0x1a07('0x102')],{'as':'Account','foreignKey':'WhatsappAccountId'});db['WhatsappInteraction'][_0x1a07('0x150')](db[_0x1a07('0x71')],{'as':'Contact','foreignKey':_0x1a07('0x161')});db[_0x1a07('0x125')][_0x1a07('0x150')](db[_0x1a07('0x115')],{'as':'Owner','foreignKey':_0x1a07('0x119')});db[_0x1a07('0x125')][_0x1a07('0x12a')](db[_0x1a07('0x8e')],{'through':'whatsapp_interaction_has_tags','as':'Tags'});db[_0x1a07('0x125')]['belongsToMany'](db['Tag'],{'through':_0x1a07('0x1b1'),'as':'ThroughTags'});db[_0x1a07('0x125')][_0x1a07('0x12a')](db[_0x1a07('0x115')],{'as':_0x1a07('0x170'),'through':_0x1a07('0x134'),'foreignKey':_0x1a07('0x1f7')});db[_0x1a07('0x107')]['belongsTo'](db[_0x1a07('0x115')],{'as':'User'});db['WhatsappMessage']['belongsTo'](db[_0x1a07('0x71')],{'onDelete':'cascade','as':_0x1a07('0x160')});db['WhatsappMessage'][_0x1a07('0x150')](db['WhatsappInteraction'],{'onDelete':_0x1a07('0x118'),'as':_0x1a07('0x172'),'foreignKey':_0x1a07('0x1f7')});db[_0x1a07('0x107')][_0x1a07('0x150')](db[_0x1a07('0x102')],{'as':_0x1a07('0x16c'),'foreignKey':_0x1a07('0x1f5')});db['WhatsappQueueReport'][_0x1a07('0x150')](db['WhatsappAccount'],{});db[_0x1a07('0x108')][_0x1a07('0x150')](db['CmList'],{'as':_0x1a07('0x177'),'foreignKey':_0x1a07('0x168')});db['WhatsappQueueReport']['belongsTo'](db[_0x1a07('0x71')],{'as':_0x1a07('0x160'),'foreignKey':_0x1a07('0x161')});db[_0x1a07('0x108')][_0x1a07('0x150')](db[_0x1a07('0x125')],{});db['WhatsappQueueReport'][_0x1a07('0x150')](db[_0x1a07('0x10b')],{});db[_0x1a07('0x108')][_0x1a07('0x150')](db['WhatsappMessage'],{});db[_0x1a07('0x108')][_0x1a07('0x150')](db[_0x1a07('0x115')],{});db['WhatsappTransferReport']['belongsTo'](db['WhatsappMessage'],{});db[_0x1a07('0x109')][_0x1a07('0x150')](db['WhatsappInteraction'],{});db[_0x1a07('0x109')][_0x1a07('0x150')](db[_0x1a07('0x102')],{'foreignKey':_0x1a07('0x1f8'),'as':_0x1a07('0x1da')});db[_0x1a07('0x109')][_0x1a07('0x150')](db[_0x1a07('0x102')],{'foreignKey':_0x1a07('0x1f9'),'as':_0x1a07('0x1e4')});db[_0x1a07('0x109')]['belongsTo'](db[_0x1a07('0x10b')],{'foreignKey':_0x1a07('0x1fa'),'as':'ToQueue'});db[_0x1a07('0x109')][_0x1a07('0x150')](db['User'],{'foreignKey':_0x1a07('0x1e6'),'as':_0x1a07('0x1db')});db[_0x1a07('0x109')][_0x1a07('0x150')](db[_0x1a07('0x115')],{'foreignKey':_0x1a07('0x1dc'),'as':_0x1a07('0x1dd')});db['WhatsappQueue'][_0x1a07('0x12a')](db[_0x1a07('0x115')],{'as':_0x1a07('0x169'),'through':'UserWhatsappQueue','foreignKey':_0x1a07('0x1fb')});db[_0x1a07('0x10b')]['belongsToMany'](db['Team'],{'through':_0x1a07('0x1d3'),'as':_0x1a07('0x181')});db['UserSetting'][_0x1a07('0x150')](db[_0x1a07('0x115')],{'as':_0x1a07('0x1fc'),'foreignKey':_0x1a07('0x119'),'onDelete':_0x1a07('0x118'),'hooks':!![]});db[_0x1a07('0x10d')]['hasOne'](db['Dynamics365Account'],{'as':_0x1a07('0xcb'),'onDelete':_0x1a07('0x162')});db[_0x1a07('0x10d')]['hasOne'](db[_0x1a07('0x37')],{'as':'Imap','onDelete':_0x1a07('0x162')});db[_0x1a07('0x10d')]['hasOne'](db[_0x1a07('0x39')],{'as':'Smtp','onDelete':_0x1a07('0x162')});module[_0x1a07('0x1fd')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index a28d1f7..6d751cb 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3ee4=['/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','/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/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/questions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','./api/squareReportDetail','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','/api/square/projects','./api/squareRecording','/api/square/messages','/api/teams','./api/team','/api/license','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','./api/plugin','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','/api/pm2','./api/pm2','./api/webbar','/api/logs','/apidoc','static','join','/www','root','/demo','3.1.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','sendFile','resolve','get','appPath','/index.html','./errors','./config/environment','setupLoggers','default','then','use','/api/users','./api/user','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceDialReport','/api/voice/agents/reports','/api/voice/queues/reports','./api/memberReport','/api/trunks','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','./api/smsApplication','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/groups','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','/api/canned_answers','/api/dispositions','/api/conditions','./api/condition','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/sounds','./api/sound','/api/tags','/api/contact_item_types','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskAccount'];(function(_0x506bf5,_0x933a4a){var _0x4bdeab=function(_0x330251){while(--_0x330251){_0x506bf5['push'](_0x506bf5['shift']());}};_0x4bdeab(++_0x933a4a);}(_0x3ee4,0x7c));var _0x43ee=function(_0x30caa,_0x1d4e11){_0x30caa=_0x30caa-0x0;var _0x284f32=_0x3ee4[_0x30caa];return _0x284f32;};'use strict';var path=require('path');var express=require('express');var errors=require(_0x43ee('0x0'));var config=require(_0x43ee('0x1'));var setupLoggers=require('./utils/client-side-logger')[_0x43ee('0x2')];var clientSideLogs=require('./api/client-side-logs');exports[_0x43ee('0x3')]=function(_0xd8618f){return setupLoggers(_0xd8618f)[_0x43ee('0x4')](function(){_0xd8618f[_0x43ee('0x5')](_0x43ee('0x6'),require(_0x43ee('0x7')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x8'),require('./api/voiceChanSpy'));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x9'),require(_0x43ee('0xa')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0xb'),require('./api/voiceExtension'));_0xd8618f[_0x43ee('0x5')](_0x43ee('0xc'),require(_0x43ee('0xd')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0xe'),require(_0x43ee('0xf')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x10'),require(_0x43ee('0x11')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x12'),require(_0x43ee('0x13')));_0xd8618f[_0x43ee('0x5')]('/api/voice/mails',require(_0x43ee('0x14')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x15'),require(_0x43ee('0x16')));_0xd8618f[_0x43ee('0x5')]('/api/voice/calls/reports',require('./api/voiceCallReport'));_0xd8618f[_0x43ee('0x5')]('/api/voice/dials/reports',require(_0x43ee('0x17')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x18'),require('./api/voiceAgentReport'));_0xd8618f['use'](_0x43ee('0x19'),require('./api/voiceQueueReport'));_0xd8618f[_0x43ee('0x5')]('/api/members/reports',require(_0x43ee('0x1a')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x1b'),require('./api/trunk'));_0xd8618f[_0x43ee('0x5')]('/api/voice/transfers/reports',require('./api/voiceTransferReport'));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x1c'),require(_0x43ee('0x1d')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x1e'),require(_0x43ee('0x1f')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x20'),require(_0x43ee('0x21')));_0xd8618f[_0x43ee('0x5')]('/api/mail/substatuses',require(_0x43ee('0x22')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x23'),require(_0x43ee('0x24')));_0xd8618f[_0x43ee('0x5')]('/api/mail/messages',require(_0x43ee('0x25')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x26'),require(_0x43ee('0x27')));_0xd8618f[_0x43ee('0x5')]('/api/mail/reports/queue',require(_0x43ee('0x28')));_0xd8618f['use'](_0x43ee('0x29'),require(_0x43ee('0x2a')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x2b'),require(_0x43ee('0x2c')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x2d'),require('./api/faxAccount'));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x2e'),require(_0x43ee('0x2f')));_0xd8618f['use'](_0x43ee('0x30'),require(_0x43ee('0x31')));_0xd8618f[_0x43ee('0x5')]('/api/fax/messages',require('./api/faxMessage'));_0xd8618f['use'](_0x43ee('0x32'),require(_0x43ee('0x33')));_0xd8618f[_0x43ee('0x5')]('/api/fax/reports/queue',require(_0x43ee('0x34')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x35'),require(_0x43ee('0x36')));_0xd8618f[_0x43ee('0x5')]('/api/sms/applications',require(_0x43ee('0x37')));_0xd8618f[_0x43ee('0x5')]('/api/sms/interactions',require(_0x43ee('0x38')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x39'),require(_0x43ee('0x3a')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x3b'),require('./api/smsQueue'));_0xd8618f['use'](_0x43ee('0x3c'),require(_0x43ee('0x3d')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x3e'),require(_0x43ee('0x3f')));_0xd8618f[_0x43ee('0x5')]('/api/openchannel/interactions',require('./api/openchannelInteraction'));_0xd8618f['use'](_0x43ee('0x40'),require(_0x43ee('0x41')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x42'),require(_0x43ee('0x43')));_0xd8618f['use'](_0x43ee('0x44'),require(_0x43ee('0x45')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x46'),require(_0x43ee('0x47')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x48'),require(_0x43ee('0x49')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x4a'),require(_0x43ee('0x4b')));_0xd8618f['use']('/api/chat/messages',require(_0x43ee('0x4c')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x4d'),require(_0x43ee('0x4e')));_0xd8618f[_0x43ee('0x5')]('/api/chat/queues',require('./api/chatQueue'));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x4f'),require('./api/chatGroup'));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x50'),require(_0x43ee('0x51')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x52'),require(_0x43ee('0x53')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x54'),require(_0x43ee('0x55')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x56'),require(_0x43ee('0x57')));_0xd8618f[_0x43ee('0x5')]('/api/cm/hopper_black',require(_0x43ee('0x58')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x59'),require(_0x43ee('0x5a')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x5b'),require('./api/cmHopperHistory'));_0xd8618f['use'](_0x43ee('0x5c'),require(_0x43ee('0x5d')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x5e'),require(_0x43ee('0x5f')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x60'),require('./api/automation'));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x61'),require('./api/cannedAnswer'));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x62'),require('./api/disposition'));_0xd8618f['use'](_0x43ee('0x63'),require(_0x43ee('0x64')));_0xd8618f['use']('/api/intervals',require(_0x43ee('0x65')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x66'),require(_0x43ee('0x67')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x68'),require(_0x43ee('0x69')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x6a'),require(_0x43ee('0x6b')));_0xd8618f['use']('/api/schedules',require('./api/schedule'));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x6c'),require(_0x43ee('0x6d')));_0xd8618f['use'](_0x43ee('0x6e'),require('./api/tag'));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x6f'),require('./api/contactItemType'));_0xd8618f['use'](_0x43ee('0x70'),require(_0x43ee('0x71')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x72'),require(_0x43ee('0x73')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x74'),require(_0x43ee('0x75')));_0xd8618f[_0x43ee('0x5')]('/api/triggers',require('./api/trigger'));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x76'),require(_0x43ee('0x77')));_0xd8618f['use'](_0x43ee('0x78'),require(_0x43ee('0x79')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x7a'),require('./api/integrationReport'));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x7b'),require(_0x43ee('0x7c')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x7d'),require('./api/analyticDefaultReport'));_0xd8618f[_0x43ee('0x5')]('/api/analytics/extracted_reports',require('./api/analyticExtractedReport'));_0xd8618f['use']('/api/analytics/metrics',require(_0x43ee('0x7e')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x7f'),require('./api/analyticFieldReport'));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x80'),require(_0x43ee('0x81')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x82'),require(_0x43ee('0x83')));_0xd8618f[_0x43ee('0x5')]('/api/integrations/salesforce/configurations',require(_0x43ee('0x84')));_0xd8618f['use'](_0x43ee('0x85'),require(_0x43ee('0x86')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x87'),require(_0x43ee('0x88')));_0xd8618f['use'](_0x43ee('0x89'),require(_0x43ee('0x8a')));_0xd8618f['use'](_0x43ee('0x8b'),require(_0x43ee('0x8c')));_0xd8618f[_0x43ee('0x5')]('/api/integrations/desk/accounts',require(_0x43ee('0x8d')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x8e'),require(_0x43ee('0x8f')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x90'),require('./api/intDeskField'));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x91'),require(_0x43ee('0x92')));_0xd8618f['use']('/api/integrations/zoho/configurations',require(_0x43ee('0x93')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x94'),require(_0x43ee('0x95')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x96'),require(_0x43ee('0x97')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x98'),require(_0x43ee('0x99')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x9a'),require('./api/intZendeskField'));_0xd8618f[_0x43ee('0x5')]('/api/integrations/freshdesk/accounts',require(_0x43ee('0x9b')));_0xd8618f[_0x43ee('0x5')]('/api/integrations/freshdesk/configurations',require(_0x43ee('0x9c')));_0xd8618f['use'](_0x43ee('0x9d'),require(_0x43ee('0x9e')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x9f'),require('./api/intVtigerAccount'));_0xd8618f[_0x43ee('0x5')]('/api/integrations/vtiger/configurations',require(_0x43ee('0xa0')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0xa1'),require(_0x43ee('0xa2')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0xa3'),require(_0x43ee('0xa4')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0xa5'),require('./api/intServicenowConfiguration'));_0xd8618f[_0x43ee('0x5')](_0x43ee('0xa6'),require(_0x43ee('0xa7')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0xa8'),require(_0x43ee('0xa9')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0xaa'),require(_0x43ee('0xab')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0xac'),require(_0x43ee('0xad')));_0xd8618f['use'](_0x43ee('0xae'),require('./api/intFreshsalesAccount'));_0xd8618f[_0x43ee('0x5')](_0x43ee('0xaf'),require(_0x43ee('0xb0')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0xb1'),require(_0x43ee('0xb2')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0xb3'),require(_0x43ee('0xb4')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0xb5'),require(_0x43ee('0xb6')));_0xd8618f[_0x43ee('0x5')]('/api/chat/internal/messages',require(_0x43ee('0xb7')));_0xd8618f['use']('/api/jscripty/answers/reports',require('./api/jscriptyAnswerReport'));_0xd8618f['use'](_0x43ee('0xb8'),require('./api/jscriptyQuestionReport'));_0xd8618f[_0x43ee('0x5')]('/api/jscripty/sessions/reports',require(_0x43ee('0xb9')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0xba'),require(_0x43ee('0xbb')));_0xd8618f[_0x43ee('0x5')]('/api/square/reports',require(_0x43ee('0xbc')));_0xd8618f[_0x43ee('0x5')]('/api/square/details/reports',require(_0x43ee('0xbd')));_0xd8618f[_0x43ee('0x5')]('/api/jscripty/projects',require(_0x43ee('0xbe')));_0xd8618f['use'](_0x43ee('0xbf'),require(_0x43ee('0xc0')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0xc1'),require('./api/squareOdbc'));_0xd8618f[_0x43ee('0x5')](_0x43ee('0xc2'),require('./api/squareProject'));_0xd8618f[_0x43ee('0x5')]('/api/square/recordings',require(_0x43ee('0xc3')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0xc4'),require('./api/squareMessage'));_0xd8618f[_0x43ee('0x5')](_0x43ee('0xc5'),require(_0x43ee('0xc6')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0xc7'),require('./api/license'));_0xd8618f['use']('/api/campaigns',require(_0x43ee('0xc8')));_0xd8618f['use'](_0x43ee('0xc9'),require(_0x43ee('0xca')));_0xd8618f['use'](_0x43ee('0xcb'),require(_0x43ee('0xcc')));_0xd8618f[_0x43ee('0x5')]('/api/plugins',require(_0x43ee('0xcd')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0xce'),require('./api/mailTransferReport'));_0xd8618f['use'](_0x43ee('0xcf'),require(_0x43ee('0xd0')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0xd1'),require(_0x43ee('0xd2')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0xd3'),require(_0x43ee('0xd4')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0xd5'),require(_0x43ee('0xd6')));_0xd8618f['use']('/api/cm/lists',require('./api/cmList'));_0xd8618f['use'](_0x43ee('0xd7'),require(_0x43ee('0xd8')));_0xd8618f['use'](_0x43ee('0xd9'),require(_0x43ee('0xda')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0xdb'),require(_0x43ee('0xdc')));_0xd8618f[_0x43ee('0x5')]('/api/userProfile/resources',require(_0x43ee('0xdd')));_0xd8618f[_0x43ee('0x5')]('/api/userNotifications',require('./api/userNotification'));_0xd8618f[_0x43ee('0x5')](_0x43ee('0xde'),require(_0x43ee('0xdf')));_0xd8618f[_0x43ee('0x5')]('/api/whatsapp/applications',require(_0x43ee('0xe0')));_0xd8618f['use']('/api/whatsapp/interactions',require('./api/whatsappInteraction'));_0xd8618f[_0x43ee('0x5')]('/api/whatsapp/messages',require(_0x43ee('0xe1')));_0xd8618f['use']('/api/whatsapp/reports/queue',require(_0x43ee('0xe2')));_0xd8618f['use'](_0x43ee('0xe3'),require(_0x43ee('0xe4')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0xe5'),require(_0x43ee('0xe6')));_0xd8618f['use'](_0x43ee('0xe7'),require(_0x43ee('0xe8')));_0xd8618f[_0x43ee('0x5')]('/api/realtime',require('./api/realtime'));_0xd8618f[_0x43ee('0x5')](_0x43ee('0xe9'),require(_0x43ee('0xea')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0xeb'),require(_0x43ee('0xec')));_0xd8618f[_0x43ee('0x5')]('/api/auth/google',require('./api/authGoogle'));_0xd8618f[_0x43ee('0x5')](_0x43ee('0xed'),require(_0x43ee('0xee')));_0xd8618f['use'](_0x43ee('0xef'),require(_0x43ee('0xf0')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0xf1'),require(_0x43ee('0xf2')));_0xd8618f['use'](_0x43ee('0xf3'),require(_0x43ee('0xf4')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0xf5'),require('./api/system'));_0xd8618f[_0x43ee('0x5')](_0x43ee('0xf6'),require(_0x43ee('0xf7')));_0xd8618f[_0x43ee('0x5')]('/api/webbar',require(_0x43ee('0xf8')));_0xd8618f['use'](_0x43ee('0xf9'),clientSideLogs);_0xd8618f[_0x43ee('0x5')](_0x43ee('0xfa'),express[_0x43ee('0xfb')](path[_0x43ee('0xfc')](config['root'],'/apidoc')));_0xd8618f[_0x43ee('0x5')](_0x43ee('0xfd'),express[_0x43ee('0xfb')](path[_0x43ee('0xfc')](config[_0x43ee('0xfe')],_0x43ee('0xfd'))));_0xd8618f[_0x43ee('0x5')]('/demo',express[_0x43ee('0xfb')](path[_0x43ee('0xfc')](config[_0x43ee('0xfe')],_0x43ee('0xff'))));_0xd8618f[_0x43ee('0x5')]('/snippet',express[_0x43ee('0xfb')](path[_0x43ee('0xfc')](config['root'],'snippet',_0x43ee('0x100'))));_0xd8618f[_0x43ee('0x5')](_0x43ee('0x101'),express[_0x43ee('0xfb')](path[_0x43ee('0xfc')](config[_0x43ee('0xfe')],_0x43ee('0x102'))));_0xd8618f[_0x43ee('0x103')](_0x43ee('0x104'))['get'](errors[0x194]);_0xd8618f[_0x43ee('0x103')]('/*')['get'](function(_0x1f468d,_0x1e2e51){_0x1e2e51[_0x43ee('0x105')](path[_0x43ee('0x106')](_0xd8618f[_0x43ee('0x107')](_0x43ee('0x108'))+_0x43ee('0x109')));});return _0xd8618f;});}; \ No newline at end of file +var _0xcebf=['/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','/api/settings','./api/setting','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','/api/campaigns','./api/campaign','/api/migrations','/api/attachments','./api/plugin','./api/mailTransferReport','./api/chatTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','/api/voice/prefixes','./api/userProfile','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./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/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/jira','./api/rpc','./api/version','/api/system','./api/system','/api/webbar','/api/logs','/apidoc','join','root','/demo','static','/snippet','3.1.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','appPath','/index.html','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','/api/voice/queues','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/actions','/api/automations','./api/automation','/api/canned_answers','/api/dispositions','./api/condition','/api/intervals','/api/pauses','./api/pause','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/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/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/sugarcrm/accounts','./api/intSugarcrmConfiguration','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration'];(function(_0x535d17,_0x50a2a2){var _0x56cb1d=function(_0x4e0f8d){while(--_0x4e0f8d){_0x535d17['push'](_0x535d17['shift']());}};_0x56cb1d(++_0x50a2a2);}(_0xcebf,0x7d));var _0xfceb=function(_0x3495a0,_0x3b9a3f){_0x3495a0=_0x3495a0-0x0;var _0x4c0c69=_0xcebf[_0x3495a0];return _0x4c0c69;};'use strict';var path=require('path');var express=require(_0xfceb('0x0'));var errors=require(_0xfceb('0x1'));var config=require(_0xfceb('0x2'));var setupLoggers=require(_0xfceb('0x3'))[_0xfceb('0x4')];var clientSideLogs=require(_0xfceb('0x5'));exports[_0xfceb('0x6')]=function(_0x1d81b6){return setupLoggers(_0x1d81b6)[_0xfceb('0x7')](function(){_0x1d81b6[_0xfceb('0x8')]('/api/users',require(_0xfceb('0x9')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xa'),require(_0xfceb('0xb')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xc'),require(_0xfceb('0xd')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xe'),require('./api/voiceExtension'));_0x1d81b6['use']('/api/voice/mohs',require('./api/voiceMusicOnHold'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xf'),require('./api/voiceQueue'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x10'),require(_0xfceb('0x11')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x12'),require(_0xfceb('0x13')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x14'),require('./api/voiceMail'));_0x1d81b6['use'](_0xfceb('0x15'),require(_0xfceb('0x16')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x17'),require(_0xfceb('0x18')));_0x1d81b6['use'](_0xfceb('0x19'),require(_0xfceb('0x1a')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x1b'),require(_0xfceb('0x1c')));_0x1d81b6[_0xfceb('0x8')]('/api/voice/queues/reports',require(_0xfceb('0x1d')));_0x1d81b6[_0xfceb('0x8')]('/api/members/reports',require('./api/memberReport'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x1e'),require('./api/trunk'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x1f'),require(_0xfceb('0x20')));_0x1d81b6['use'](_0xfceb('0x21'),require(_0xfceb('0x22')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x23'),require('./api/mailAccount'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x24'),require('./api/mailQueue'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x25'),require(_0xfceb('0x26')));_0x1d81b6['use'](_0xfceb('0x27'),require(_0xfceb('0x28')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x29'),require('./api/mailMessage'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x2a'),require('./api/mailApplication'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x2b'),require(_0xfceb('0x2c')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x2d'),require(_0xfceb('0x2e')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x2f'),require(_0xfceb('0x30')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x31'),require(_0xfceb('0x32')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x33'),require(_0xfceb('0x34')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x35'),require(_0xfceb('0x36')));_0x1d81b6['use'](_0xfceb('0x37'),require(_0xfceb('0x38')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x39'),require(_0xfceb('0x3a')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x3b'),require(_0xfceb('0x3c')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x3d'),require('./api/smsAccount'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x3e'),require(_0xfceb('0x3f')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x40'),require(_0xfceb('0x41')));_0x1d81b6[_0xfceb('0x8')]('/api/sms/messages',require(_0xfceb('0x42')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x43'),require(_0xfceb('0x44')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x45'),require(_0xfceb('0x46')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x47'),require(_0xfceb('0x48')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x49'),require('./api/openchannelInteraction'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x4a'),require(_0xfceb('0x4b')));_0x1d81b6['use'](_0xfceb('0x4c'),require('./api/openchannelQueue'));_0x1d81b6['use']('/api/chat/websites',require(_0xfceb('0x4d')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x4e'),require('./api/openchannelQueueReport'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x4f'),require(_0xfceb('0x50')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x51'),require(_0xfceb('0x52')));_0x1d81b6[_0xfceb('0x8')]('/api/chat/messages',require('./api/chatMessage'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x53'),require(_0xfceb('0x54')));_0x1d81b6[_0xfceb('0x8')]('/api/chat/queues',require('./api/chatQueue'));_0x1d81b6['use'](_0xfceb('0x55'),require(_0xfceb('0x56')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x57'),require(_0xfceb('0x58')));_0x1d81b6['use'](_0xfceb('0x59'),require(_0xfceb('0x5a')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x5b'),require('./api/cmContact'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x5c'),require(_0xfceb('0x5d')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x5e'),require(_0xfceb('0x5f')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x60'),require(_0xfceb('0x61')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x62'),require(_0xfceb('0x63')));_0x1d81b6[_0xfceb('0x8')]('/api/cm/custom_fields',require('./api/cmCustomField'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x64'),require('./api/action'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x65'),require(_0xfceb('0x66')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x67'),require('./api/cannedAnswer'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x68'),require('./api/disposition'));_0x1d81b6[_0xfceb('0x8')]('/api/conditions',require(_0xfceb('0x69')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x6a'),require('./api/interval'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x6b'),require(_0xfceb('0x6c')));_0x1d81b6['use'](_0xfceb('0x6d'),require('./api/cdr'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x6e'),require(_0xfceb('0x6f')));_0x1d81b6['use'](_0xfceb('0x70'),require(_0xfceb('0x71')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x72'),require(_0xfceb('0x73')));_0x1d81b6[_0xfceb('0x8')]('/api/tags',require(_0xfceb('0x74')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x75'),require('./api/contactItemType'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x76'),require(_0xfceb('0x77')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x78'),require(_0xfceb('0x79')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x7a'),require(_0xfceb('0x7b')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x7c'),require(_0xfceb('0x7d')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x7e'),require('./api/variable'));_0x1d81b6[_0xfceb('0x8')]('/api/integrations',require('./api/integration'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x7f'),require(_0xfceb('0x80')));_0x1d81b6['use'](_0xfceb('0x81'),require(_0xfceb('0x82')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x83'),require(_0xfceb('0x84')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x85'),require(_0xfceb('0x86')));_0x1d81b6['use'](_0xfceb('0x87'),require(_0xfceb('0x88')));_0x1d81b6['use'](_0xfceb('0x89'),require(_0xfceb('0x8a')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x8b'),require(_0xfceb('0x8c')));_0x1d81b6['use'](_0xfceb('0x8d'),require(_0xfceb('0x8e')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x8f'),require(_0xfceb('0x90')));_0x1d81b6['use']('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0x1d81b6['use'](_0xfceb('0x91'),require('./api/intSugarcrmAccount'));_0x1d81b6[_0xfceb('0x8')]('/api/integrations/sugarcrm/configurations',require(_0xfceb('0x92')));_0x1d81b6[_0xfceb('0x8')]('/api/integrations/sugarcrm/fields',require('./api/intSugarcrmField'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x93'),require(_0xfceb('0x94')));_0x1d81b6[_0xfceb('0x8')]('/api/integrations/desk/configurations',require(_0xfceb('0x95')));_0x1d81b6['use'](_0xfceb('0x96'),require(_0xfceb('0x97')));_0x1d81b6[_0xfceb('0x8')]('/api/integrations/zoho/accounts',require(_0xfceb('0x98')));_0x1d81b6['use'](_0xfceb('0x99'),require(_0xfceb('0x9a')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x9b'),require(_0xfceb('0x9c')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x9d'),require(_0xfceb('0x9e')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x9f'),require(_0xfceb('0xa0')));_0x1d81b6[_0xfceb('0x8')]('/api/integrations/zendesk/fields',require('./api/intZendeskField'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xa1'),require(_0xfceb('0xa2')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xa3'),require(_0xfceb('0xa4')));_0x1d81b6['use'](_0xfceb('0xa5'),require(_0xfceb('0xa6')));_0x1d81b6['use'](_0xfceb('0xa7'),require(_0xfceb('0xa8')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xa9'),require('./api/intVtigerConfiguration'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xaa'),require(_0xfceb('0xab')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xac'),require(_0xfceb('0xad')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xae'),require(_0xfceb('0xaf')));_0x1d81b6['use'](_0xfceb('0xb0'),require(_0xfceb('0xb1')));_0x1d81b6[_0xfceb('0x8')]('/api/integrations/dynamics365/accounts',require(_0xfceb('0xb2')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xb3'),require(_0xfceb('0xb4')));_0x1d81b6['use'](_0xfceb('0xb5'),require('./api/intDynamics365Field'));_0x1d81b6[_0xfceb('0x8')]('/api/integrations/freshsales/accounts',require('./api/intFreshsalesAccount'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xb6'),require(_0xfceb('0xb7')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xb8'),require(_0xfceb('0xb9')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xba'),require(_0xfceb('0xbb')));_0x1d81b6['use'](_0xfceb('0xbc'),require('./api/chatQueueReport'));_0x1d81b6[_0xfceb('0x8')]('/api/chat/internal/messages',require(_0xfceb('0xbd')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xbe'),require(_0xfceb('0xbf')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xc0'),require('./api/jscriptyQuestionReport'));_0x1d81b6[_0xfceb('0x8')]('/api/jscripty/sessions/reports',require(_0xfceb('0xc1')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xc2'),require(_0xfceb('0xc3')));_0x1d81b6[_0xfceb('0x8')]('/api/square/reports',require(_0xfceb('0xc4')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xc5'),require(_0xfceb('0xc6')));_0x1d81b6[_0xfceb('0x8')]('/api/jscripty/projects',require(_0xfceb('0xc7')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xc8'),require(_0xfceb('0xc9')));_0x1d81b6[_0xfceb('0x8')]('/api/square/odbc',require(_0xfceb('0xca')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xcb'),require(_0xfceb('0xcc')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xcd'),require('./api/squareRecording'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xce'),require(_0xfceb('0xcf')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xd0'),require(_0xfceb('0xd1')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xd2'),require('./api/license'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xd3'),require(_0xfceb('0xd4')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xd5'),require('./api/migration'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xd6'),require('./api/attachment'));_0x1d81b6[_0xfceb('0x8')]('/api/plugins',require(_0xfceb('0xd7')));_0x1d81b6['use']('/api/mail/reports/transfer',require(_0xfceb('0xd8')));_0x1d81b6[_0xfceb('0x8')]('/api/chat/reports/transfer',require(_0xfceb('0xd9')));_0x1d81b6['use']('/api/fax/reports/transfer',require('./api/faxTransferReport'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xda'),require(_0xfceb('0xdb')));_0x1d81b6['use'](_0xfceb('0xdc'),require(_0xfceb('0xdd')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xde'),require('./api/cmList'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xdf'),require('./api/voicePrefix'));_0x1d81b6[_0xfceb('0x8')]('/api/userProfiles',require(_0xfceb('0xe0')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xe1'),require('./api/userProfileSection'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xe2'),require(_0xfceb('0xe3')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xe4'),require(_0xfceb('0xe5')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xe6'),require('./api/whatsappAccount'));_0x1d81b6[_0xfceb('0x8')]('/api/whatsapp/applications',require(_0xfceb('0xe7')));_0x1d81b6['use'](_0xfceb('0xe8'),require(_0xfceb('0xe9')));_0x1d81b6['use'](_0xfceb('0xea'),require(_0xfceb('0xeb')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xec'),require(_0xfceb('0xed')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xee'),require(_0xfceb('0xef')));_0x1d81b6['use'](_0xfceb('0xf0'),require(_0xfceb('0xf1')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xf2'),require(_0xfceb('0xf3')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xf4'),require(_0xfceb('0xf5')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xf6'),require(_0xfceb('0xf7')));_0x1d81b6['use'](_0xfceb('0xf8'),require(_0xfceb('0xf9')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xfa'),require(_0xfceb('0xfb')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xfc'),require('./api/authActiveDirectory'));_0x1d81b6[_0xfceb('0x8')]('/api/jira',require(_0xfceb('0xfd')));_0x1d81b6[_0xfceb('0x8')]('/api/rpc',require(_0xfceb('0xfe')));_0x1d81b6[_0xfceb('0x8')]('/api/version',require(_0xfceb('0xff')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x100'),require(_0xfceb('0x101')));_0x1d81b6['use']('/api/pm2',require('./api/pm2'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x102'),require('./api/webbar'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x103'),clientSideLogs);_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x104'),express['static'](path[_0xfceb('0x105')](config[_0xfceb('0x106')],'/apidoc')));_0x1d81b6[_0xfceb('0x8')]('/www',express['static'](path['join'](config['root'],'/www')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x107'),express[_0xfceb('0x108')](path[_0xfceb('0x105')](config[_0xfceb('0x106')],_0xfceb('0x107'))));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x109'),express[_0xfceb('0x108')](path[_0xfceb('0x105')](config[_0xfceb('0x106')],'snippet',_0xfceb('0x10a'))));_0x1d81b6['use'](_0xfceb('0x10b'),express[_0xfceb('0x108')](path[_0xfceb('0x105')](config[_0xfceb('0x106')],_0xfceb('0x10c'))));_0x1d81b6[_0xfceb('0x10d')](_0xfceb('0x10e'))[_0xfceb('0x10f')](errors[0x194]);_0x1d81b6[_0xfceb('0x10d')]('/*')[_0xfceb('0x10f')](function(_0x385b70,_0x38ed79){_0x38ed79['sendFile'](path[_0xfceb('0x110')](_0x1d81b6[_0xfceb('0x10f')](_0xfceb('0x111'))+_0xfceb('0x112')));});return _0x1d81b6;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 85b5f3a..daf5189 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb381=['../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.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/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','error','listen','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','jayson/promise','lodash','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.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/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc'];(function(_0x585ed8,_0x3e44ac){var _0x9d5f3a=function(_0x2dd721){while(--_0x2dd721){_0x585ed8['push'](_0x585ed8['shift']());}};_0x9d5f3a(++_0x3e44ac);}(_0xb381,0x177));var _0x1b38=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xb381[_0x9df060];return _0x338dfe;};'use strict';var jayson=require(_0x1b38('0x0'));var _=require(_0x1b38('0x1'));var config=require('../config/environment');exports['listen']=function(){return new Promise(function(_0x5dabc5,_0x2f0ae5){var _0x5a931a={};_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require(_0x1b38('0x3')));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require(_0x1b38('0x4')));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require(_0x1b38('0x5')));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require(_0x1b38('0x6')));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require(_0x1b38('0x7')));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require(_0x1b38('0x8')));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require(_0x1b38('0x9')));_0x5a931a=_['merge'](_0x5a931a,require(_0x1b38('0xa')));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require(_0x1b38('0xb')));_0x5a931a=_['merge'](_0x5a931a,require(_0x1b38('0xc')));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x5a931a=_['merge'](_0x5a931a,require(_0x1b38('0xd')));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require(_0x1b38('0xe')));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require(_0x1b38('0xf')));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require('../api/mailInteraction/mailInteraction.rpc'));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require(_0x1b38('0x10')));_0x5a931a=_['merge'](_0x5a931a,require(_0x1b38('0x11')));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require(_0x1b38('0x12')));_0x5a931a=_['merge'](_0x5a931a,require(_0x1b38('0x13')));_0x5a931a=_['merge'](_0x5a931a,require(_0x1b38('0x14')));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require(_0x1b38('0x15')));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require('../api/faxMessage/faxMessage.rpc'));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require(_0x1b38('0x16')));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require(_0x1b38('0x17')));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require(_0x1b38('0x18')));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require('../api/smsInteraction/smsInteraction.rpc'));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require(_0x1b38('0x19')));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require('../api/smsQueue/smsQueue.rpc'));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require(_0x1b38('0x1a')));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require(_0x1b38('0x1b')));_0x5a931a=_['merge'](_0x5a931a,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require(_0x1b38('0x1c')));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x5a931a=_['merge'](_0x5a931a,require(_0x1b38('0x1d')));_0x5a931a=_['merge'](_0x5a931a,require(_0x1b38('0x1e')));_0x5a931a=_['merge'](_0x5a931a,require(_0x1b38('0x1f')));_0x5a931a=_['merge'](_0x5a931a,require(_0x1b38('0x20')));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require('../api/cmHopper/cmHopper.rpc'));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require(_0x1b38('0x21')));_0x5a931a=_['merge'](_0x5a931a,require(_0x1b38('0x22')));_0x5a931a=_['merge'](_0x5a931a,require(_0x1b38('0x23')));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require(_0x1b38('0x24')));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require(_0x1b38('0x25')));_0x5a931a=_['merge'](_0x5a931a,require(_0x1b38('0x26')));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require(_0x1b38('0x27')));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x5a931a=_['merge'](_0x5a931a,require(_0x1b38('0x28')));_0x5a931a=_['merge'](_0x5a931a,require('../api/trigger/trigger.rpc'));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require('../api/variable/variable.rpc'));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require(_0x1b38('0x29')));_0x5a931a=_['merge'](_0x5a931a,require(_0x1b38('0x2a')));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require(_0x1b38('0x2b')));_0x5a931a=_['merge'](_0x5a931a,require(_0x1b38('0x2c')));_0x5a931a=_['merge'](_0x5a931a,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require(_0x1b38('0x2d')));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require(_0x1b38('0x2e')));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require(_0x1b38('0x2f')));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require(_0x1b38('0x30')));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require(_0x1b38('0x31')));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require(_0x1b38('0x32')));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require(_0x1b38('0x33')));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require('../api/squareOdbc/squareOdbc.rpc'));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require('../api/squareProject/squareProject.rpc'));_0x5a931a=_['merge'](_0x5a931a,require(_0x1b38('0x34')));_0x5a931a=_['merge'](_0x5a931a,require(_0x1b38('0x35')));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require(_0x1b38('0x36')));_0x5a931a=_['merge'](_0x5a931a,require(_0x1b38('0x37')));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require(_0x1b38('0x38')));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require(_0x1b38('0x39')));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require(_0x1b38('0x3a')));_0x5a931a=_[_0x1b38('0x2')](_0x5a931a,require(_0x1b38('0x3b')));_0x5a931a=_['merge'](_0x5a931a,require(_0x1b38('0x3c')));var _0x22b65d=jayson[_0x1b38('0x3d')](_0x5a931a)[_0x1b38('0x3e')]();var _0x2a4949=config[_0x1b38('0x3f')]['port']||config[_0x1b38('0x40')]+0x1;var _0xce82b6=config[_0x1b38('0x3f')]['ip']||'localhost';_0x22b65d['on'](_0x1b38('0x41'),function(_0xc370fc){return _0x2f0ae5(_0xc370fc);});_0x22b65d[_0x1b38('0x42')](_0x2a4949,_0xce82b6,function(){console['log'](_0x1b38('0x43'),_0xce82b6,_0x2a4949);require(_0x1b38('0x44'))[_0x1b38('0x45')]();return _0x5dabc5('RPC\x20listening\x20on\x20'+_0xce82b6+':'+_0x2a4949);});});}; \ No newline at end of file +var _0x15f8=['../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.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/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/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/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.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/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','port','rpc','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','RPC\x20listening\x20on\x20','jayson/promise','../config/environment','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc'];(function(_0x4b8fc7,_0x5022fc){var _0x249f4a=function(_0x1b25d4){while(--_0x1b25d4){_0x4b8fc7['push'](_0x4b8fc7['shift']());}};_0x249f4a(++_0x5022fc);}(_0x15f8,0x149));var _0x815f=function(_0x3a39b1,_0x2b6222){_0x3a39b1=_0x3a39b1-0x0;var _0x49aecb=_0x15f8[_0x3a39b1];return _0x49aecb;};'use strict';var jayson=require(_0x815f('0x0'));var _=require('lodash');var config=require(_0x815f('0x1'));exports['listen']=function(){return new Promise(function(_0x1f9a17,_0x5030cc){var _0xdbfa57={};_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x3')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x4')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x5')));_0xdbfa57=_['merge'](_0xdbfa57,require(_0x815f('0x6')));_0xdbfa57=_['merge'](_0xdbfa57,require('../api/voiceCallReport/voiceCallReport.rpc'));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x7')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x8')));_0xdbfa57=_['merge'](_0xdbfa57,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x9')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0xa')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0xdbfa57=_['merge'](_0xdbfa57,require(_0x815f('0xb')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0xc')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require('../api/mailAccount/mailAccount.rpc'));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0xd')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require('../api/mailInteraction/mailInteraction.rpc'));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0xe')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0xf')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x10')));_0xdbfa57=_['merge'](_0xdbfa57,require(_0x815f('0x11')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require('../api/faxApplication/faxApplication.rpc'));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x12')));_0xdbfa57=_['merge'](_0xdbfa57,require(_0x815f('0x13')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x14')));_0xdbfa57=_['merge'](_0xdbfa57,require('../api/faxQueueReport/faxQueueReport.rpc'));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require('../api/smsAccount/smsAccount.rpc'));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x15')));_0xdbfa57=_['merge'](_0xdbfa57,require(_0x815f('0x16')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require('../api/smsQueue/smsQueue.rpc'));_0xdbfa57=_['merge'](_0xdbfa57,require(_0x815f('0x17')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x18')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x19')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x1a')));_0xdbfa57=_['merge'](_0xdbfa57,require(_0x815f('0x1b')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x1c')));_0xdbfa57=_['merge'](_0xdbfa57,require('../api/chatMessage/chatMessage.rpc'));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x1d')));_0xdbfa57=_['merge'](_0xdbfa57,require('../api/cmContact/cmContact.rpc'));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x1e')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x1f')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x20')));_0xdbfa57=_['merge'](_0xdbfa57,require(_0x815f('0x21')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x22')));_0xdbfa57=_['merge'](_0xdbfa57,require(_0x815f('0x23')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x24')));_0xdbfa57=_['merge'](_0xdbfa57,require(_0x815f('0x25')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x26')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x27')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x28')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x29')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x2a')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x2b')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x2c')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0xdbfa57=_['merge'](_0xdbfa57,require(_0x815f('0x2d')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x2e')));_0xdbfa57=_['merge'](_0xdbfa57,require(_0x815f('0x2f')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x30')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x31')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x32')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require('../api/smsQueueReport/smsQueueReport.rpc'));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require('../api/squareReport/squareReport.rpc'));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x33')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x34')));_0xdbfa57=_['merge'](_0xdbfa57,require('../api/squareOdbc/squareOdbc.rpc'));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x35')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x36')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x37')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x38')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require('../api/attachment/attachment.rpc'));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require('../api/plugin/plugin.rpc'));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x39')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x3a')));_0xdbfa57=_['merge'](_0xdbfa57,require(_0x815f('0x3b')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0xdbfa57=_['merge'](_0xdbfa57,require(_0x815f('0x3c')));var _0x4763fa=jayson[_0x815f('0x3d')](_0xdbfa57)[_0x815f('0x3e')]();var _0x549a1b=config['rpc'][_0x815f('0x3f')]||config[_0x815f('0x3f')]+0x1;var _0x5e8c18=config[_0x815f('0x40')]['ip']||'localhost';_0x4763fa['on']('error',function(_0x3681ed){return _0x5030cc(_0x3681ed);});_0x4763fa[_0x815f('0x41')](_0x549a1b,_0x5e8c18,function(){console[_0x815f('0x42')](_0x815f('0x43'),_0x5e8c18,_0x549a1b);require('../config/triggers')['default']();return _0x1f9a17(_0x815f('0x44')+_0x5e8c18+':'+_0x549a1b);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 1c4a096..99c8ff6 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 _0x6a52=['sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','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','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','util','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','ready','line','toLowerCase','hangup','substring','520-Invalid','function','replace','result=','indexOf','split','length','match','error','emit','E_AGI_SOCKET_ERROR','code','close','timeout','E_AGI_SOCKET_TIMEOUT','command','write','destroy','inherits','prototype','sync','answer','sendRequest','ANSWER','getData','beep','format','noop','VERBOSE\x20\x22%s\x22','exec','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','isBoolean','isNumber','toString'];(function(_0x4e2732,_0x308a89){var _0x21ac42=function(_0x45f78b){while(--_0x45f78b){_0x4e2732['push'](_0x4e2732['shift']());}};_0x21ac42(++_0x308a89);}(_0x6a52,0x189));var _0x26a5=function(_0x999b85,_0x1edc2b){_0x999b85=_0x999b85-0x0;var _0x1d7124=_0x6a52[_0x999b85];return _0x1d7124;};'use strict';var util=require(_0x26a5('0x0'));var _=require(_0x26a5('0x1'));var EventEmitter=require(_0x26a5('0x2'))[_0x26a5('0x3')];var AGIReply=require(_0x26a5('0x4'));var AGIError=require(_0x26a5('0x5'));function AGIChannel(_0x1d0c5f){var _0x2895b5=this,_0x1b0ae6=new AGIReply(),_0x448413=![],_0x4ba3e3={};EventEmitter[_0x26a5('0x6')](_0x2895b5);_0x1d0c5f[_0x26a5('0x7')](_0x26a5('0x8'));_0x1d0c5f[_0x26a5('0x9')](0x8*0x3c*0x3c*0x3e8);_0x1b0ae6[_0x26a5('0x7')]('utf8');_0x1b0ae6['on'](_0x26a5('0xa'),function(_0xfdc447){for(var _0xfdf2a3 in _0xfdc447){_0x2895b5[_0xfdf2a3]=_0xfdc447[_0xfdf2a3];}_0x2895b5['emit'](_0x26a5('0xb'));});_0x1b0ae6['on'](_0x26a5('0xc'),function(_0x52cd47){if(_0x52cd47[_0x26a5('0xd')]()==_0x26a5('0xe')){_0x2895b5['emit'](_0x26a5('0xe'));return;}if(_0x52cd47[_0x26a5('0xf')](0x0,0xb)==_0x26a5('0x10')){_0x448413=!![];}if(_0x448413){_0x4ba3e3['rx']+=_0x52cd47+'\x0a';if(_0x52cd47['search']('520\x20End\x20of\x20proper')!=-0x1){_0x448413=![];}}else{_0x4ba3e3['rx']=_0x52cd47;}if(_0x448413){return;}if(typeof _0x4ba3e3['cb']==_0x26a5('0x11')){var _0x84763a=_0x4ba3e3['rx'][_0x26a5('0xf')](0x0,0x3),_0x44bd0f=null,_0x395dd7=null;_0x84763a=parseInt(_0x84763a);if(isNaN(_0x84763a)){_0x4ba3e3['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x84763a!=0xc8){_0x4ba3e3['cb'](null,{'code':_0x84763a,'result':-0x1,'extra':'KO'});return;}_0x44bd0f=_0x4ba3e3['rx'][_0x26a5('0xf')](0x4)[_0x26a5('0x12')](_0x26a5('0x13'),'');if(_0x44bd0f['indexOf']('\x20')!=-0x1){_0x44bd0f=_0x44bd0f['substr'](0x0,_0x44bd0f[_0x26a5('0x14')]('\x20'));}if(_['startsWith'](_0x44bd0f,'-1')){_0x44bd0f=parseInt(_0x44bd0f);}_0x395dd7=_0x4ba3e3['rx'][_0x26a5('0x15')]('\x20');if(_0x395dd7[_0x26a5('0x16')]==0x3){_0x395dd7=_0x395dd7[0x2][_0x26a5('0xf')](0x1,_0x395dd7[0x2][_0x26a5('0x16')]-0x1);}else if(_0x395dd7[_0x26a5('0x16')]>0x3){var _0x9e88b9=/\((.+)\)/;var _0x152868=_0x4ba3e3['rx'][_0x26a5('0x17')](_0x9e88b9);if(_0x152868){_0x395dd7=_0x152868[0x1];}else{_0x395dd7=null;}}else{_0x395dd7=null;}_0x4ba3e3['cb'](null,{'code':_0x84763a,'result':_0x44bd0f,'extra':_0x395dd7});}});_0x1d0c5f['on'](_0x26a5('0x18'),function(_0x32e99f){_0x2895b5[_0x26a5('0x19')](_0x26a5('0x18'),new AGIError(_0x26a5('0x1a'),_0x32e99f[_0x26a5('0x1b')]));});_0x1d0c5f['on']('close',function(){_0x2895b5[_0x26a5('0x19')](_0x26a5('0x1c'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x1d0c5f['on'](_0x26a5('0x1d'),function(){_0x2895b5[_0x26a5('0x19')](_0x26a5('0x1d'),new AGIError(_0x26a5('0x1e')));_0x1d0c5f['destroy']();});_0x1d0c5f['pipe'](_0x1b0ae6);this[_0x26a5('0x1f')]=function(_0x43964a,_0x58b3ed){var _0x43964a=_0x43964a||'',_0x58b3ed=typeof _0x58b3ed=='function'?_0x58b3ed:new Function();_0x4ba3e3={'tx':_0x43964a,'rx':'','cb':_0x58b3ed};_0x1d0c5f[_0x26a5('0x20')](_0x43964a+'\x0a');},this[_0x26a5('0x1c')]=function(){_0x1d0c5f[_0x26a5('0x21')]();};}util[_0x26a5('0x22')](AGIChannel,EventEmitter);AGIChannel[_0x26a5('0x23')]['sendRequest']=function(_0x13a807){return this['command'][_0x26a5('0x24')](this,_0x13a807);};AGIChannel[_0x26a5('0x23')][_0x26a5('0x25')]=function(){return this[_0x26a5('0x26')](_0x26a5('0x27'));};AGIChannel[_0x26a5('0x23')][_0x26a5('0x28')]=function(_0x3713d7,_0x1e4296,_0x48c0d4){_0x3713d7=_0x3713d7===undefined?_0x26a5('0x29'):_0x3713d7;_0x1e4296=_0x1e4296===undefined?'5':_0x1e4296;_0x48c0d4=_0x48c0d4===undefined?'1':_0x48c0d4;return this['sendRequest'](util[_0x26a5('0x2a')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x3713d7,_0x1e4296*0x3e8,_0x48c0d4));};AGIChannel[_0x26a5('0x23')][_0x26a5('0x2b')]=function(_0x25c3d6){_0x25c3d6=_0x25c3d6||'NO\x20MESSAGE';return this['sendRequest'](util[_0x26a5('0x2a')](_0x26a5('0x2c'),_0x25c3d6));};AGIChannel[_0x26a5('0x23')][_0x26a5('0x2d')]=function(_0x4bd187,_0x17509c){if(_['isArray'](_0x17509c)){return this[_0x26a5('0x26')](util[_0x26a5('0x2a')](_0x26a5('0x2e'),_0x4bd187,_0x17509c[_0x26a5('0x2f')](',')));}return this['sendRequest'](util[_0x26a5('0x2a')]('EXEC\x20%s\x20%s',_0x4bd187,_0x17509c));};AGIChannel[_0x26a5('0x23')][_0x26a5('0x30')]=function(_0x5b62b3){return this['sendRequest'](util[_0x26a5('0x2a')](_0x26a5('0x31'),_0x5b62b3));};AGIChannel[_0x26a5('0x23')][_0x26a5('0x32')]=function(_0x4aef7a){return this['sendRequest'](util['format'](_0x26a5('0x33'),_0x4aef7a));};AGIChannel[_0x26a5('0x23')][_0x26a5('0x34')]=function(_0x508c2c){return this[_0x26a5('0x26')](util[_0x26a5('0x2a')](_0x26a5('0x35'),_0x508c2c));};AGIChannel['prototype'][_0x26a5('0xe')]=function(){return this[_0x26a5('0x26')]('HANGUP');};AGIChannel['prototype']['setVariable']=function(_0x24b702,_0x190edc){var _0x563521=_[_0x26a5('0x36')](_0x190edc)||_[_0x26a5('0x37')](_0x190edc)?_0x190edc['toString']():_0x190edc;return this[_0x26a5('0x26')](util['format']('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x24b702,_0x563521?_0x563521[_0x26a5('0x38')]()[_0x26a5('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x26a5('0x39')]=function(_0x4d9445,_0x1b8370){return this[_0x26a5('0x26')](util[_0x26a5('0x2a')](_0x26a5('0x3a'),_0x4d9445,_0x1b8370));};AGIChannel[_0x26a5('0x23')][_0x26a5('0x3b')]=function(_0x17263f,_0x2380d1){return this[_0x26a5('0x26')](util[_0x26a5('0x2a')](_0x26a5('0x3c'),_0x17263f,_0x2380d1));};AGIChannel[_0x26a5('0x23')][_0x26a5('0x3d')]=function(_0x5469e7,_0x502cb8){return this[_0x26a5('0x26')](util['format'](_0x26a5('0x3e'),_0x5469e7,_0x502cb8));};AGIChannel[_0x26a5('0x23')]['continueAt']=function(_0x4b8bfb,_0x1c647a,_0xace646){_0x1c647a=_0x1c647a||this[_0x26a5('0x3f')];_0xace646=_0xace646||0x1;this[_0x26a5('0x30')](_0x4b8bfb);this[_0x26a5('0x32')](_0x1c647a);this['setPriority'](_0xace646);return this[_0x26a5('0x2b')](util[_0x26a5('0x2a')]('GOTO\x20%s\x20%s\x20%s',_0x4b8bfb,_0x1c647a,_0xace646));};AGIChannel[_0x26a5('0x23')][_0x26a5('0x40')]=function(_0xda4b84){return this[_0x26a5('0x26')](util['format'](_0x26a5('0x41'),_0xda4b84));};AGIChannel[_0x26a5('0x23')]['recordFile']=function(_0x507ce6,_0x5931de,_0x1a36b2,_0x393e8b,_0x43556f,_0x175b74){_0x5931de=_0x5931de||_0x26a5('0x42');_0x1a36b2=_0x1a36b2||'';_0x393e8b=_0x393e8b===undefined?-0x1:_0x393e8b==='-1'?-0x1:_0x393e8b*0x3e8;_0x43556f=_0x43556f===undefined?'':'s='+_0x43556f;_0x175b74=_0x175b74?_0x26a5('0x43'):'';return this[_0x26a5('0x26')](util[_0x26a5('0x2a')](_0x26a5('0x44'),_0x507ce6,_0x5931de,_0x1a36b2,_0x393e8b,_0x175b74,_0x43556f));};AGIChannel[_0x26a5('0x23')]['streamFile']=function(_0x2188fb,_0x5216ef){_0x5216ef=_0x5216ef||'';return this[_0x26a5('0x26')](util[_0x26a5('0x2a')](_0x26a5('0x45'),_0x2188fb,_0x5216ef));};AGIChannel[_0x26a5('0x23')][_0x26a5('0x46')]=function(_0x312ee5){return this[_0x26a5('0x2d')](_0x26a5('0x47'),_0x312ee5);};AGIChannel[_0x26a5('0x23')][_0x26a5('0x48')]=function(_0x1cc23c){return this['exec']('WAIT',_0x1cc23c);};AGIChannel[_0x26a5('0x23')][_0x26a5('0x18')]=function(_0x454e4e,_0x50aaeb){this['noop'](util[_0x26a5('0x2a')](_0x26a5('0x49'),_0x454e4e['id'],_0x454e4e[_0x26a5('0x4a')],_0x50aaeb));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0x3408=['indexOf','substr','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','sync','prototype','ANSWER','sendRequest','format','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setPriority','noop','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','WAIT','label','exports','util','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','line','toLowerCase','hangup','emit','520-Invalid','function','substring','no\x20code','replace','result='];(function(_0x323a91,_0x21a26a){var _0x24a511=function(_0x4c2c68){while(--_0x4c2c68){_0x323a91['push'](_0x323a91['shift']());}};_0x24a511(++_0x21a26a);}(_0x3408,0x177));var _0x8340=function(_0x9022d,_0x3208db){_0x9022d=_0x9022d-0x0;var _0x5badee=_0x3408[_0x9022d];return _0x5badee;};'use strict';var util=require(_0x8340('0x0'));var _=require(_0x8340('0x1'));var EventEmitter=require(_0x8340('0x2'))[_0x8340('0x3')];var AGIReply=require(_0x8340('0x4'));var AGIError=require(_0x8340('0x5'));function AGIChannel(_0x34cb8a){var _0x3c8360=this,_0x1ca22c=new AGIReply(),_0x33ee17=![],_0x67180={};EventEmitter[_0x8340('0x6')](_0x3c8360);_0x34cb8a[_0x8340('0x7')](_0x8340('0x8'));_0x34cb8a[_0x8340('0x9')](0x8*0x3c*0x3c*0x3e8);_0x1ca22c[_0x8340('0x7')](_0x8340('0x8'));_0x1ca22c['on']('headers',function(_0x1da6f3){for(var _0x5b1a7b in _0x1da6f3){_0x3c8360[_0x5b1a7b]=_0x1da6f3[_0x5b1a7b];}_0x3c8360['emit']('ready');});_0x1ca22c['on'](_0x8340('0xa'),function(_0x1fb81d){if(_0x1fb81d[_0x8340('0xb')]()==_0x8340('0xc')){_0x3c8360[_0x8340('0xd')](_0x8340('0xc'));return;}if(_0x1fb81d['substring'](0x0,0xb)==_0x8340('0xe')){_0x33ee17=!![];}if(_0x33ee17){_0x67180['rx']+=_0x1fb81d+'\x0a';if(_0x1fb81d['search']('520\x20End\x20of\x20proper')!=-0x1){_0x33ee17=![];}}else{_0x67180['rx']=_0x1fb81d;}if(_0x33ee17){return;}if(typeof _0x67180['cb']==_0x8340('0xf')){var _0x3d3e91=_0x67180['rx'][_0x8340('0x10')](0x0,0x3),_0x4e5e02=null,_0x30836e=null;_0x3d3e91=parseInt(_0x3d3e91);if(isNaN(_0x3d3e91)){_0x67180['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x8340('0x11')});return;}if(_0x3d3e91!=0xc8){_0x67180['cb'](null,{'code':_0x3d3e91,'result':-0x1,'extra':'KO'});return;}_0x4e5e02=_0x67180['rx'][_0x8340('0x10')](0x4)[_0x8340('0x12')](_0x8340('0x13'),'');if(_0x4e5e02[_0x8340('0x14')]('\x20')!=-0x1){_0x4e5e02=_0x4e5e02[_0x8340('0x15')](0x0,_0x4e5e02[_0x8340('0x14')]('\x20'));}if(_['startsWith'](_0x4e5e02,'-1')){_0x4e5e02=parseInt(_0x4e5e02);}_0x30836e=_0x67180['rx']['split']('\x20');if(_0x30836e[_0x8340('0x16')]==0x3){_0x30836e=_0x30836e[0x2]['substring'](0x1,_0x30836e[0x2][_0x8340('0x16')]-0x1);}else if(_0x30836e[_0x8340('0x16')]>0x3){var _0x7e80dc=/\((.+)\)/;var _0x4d6d65=_0x67180['rx'][_0x8340('0x17')](_0x7e80dc);if(_0x4d6d65){_0x30836e=_0x4d6d65[0x1];}else{_0x30836e=null;}}else{_0x30836e=null;}_0x67180['cb'](null,{'code':_0x3d3e91,'result':_0x4e5e02,'extra':_0x30836e});}});_0x34cb8a['on']('error',function(_0x30febd){_0x3c8360[_0x8340('0xd')](_0x8340('0x18'),new AGIError(_0x8340('0x19'),_0x30febd[_0x8340('0x1a')]));});_0x34cb8a['on']('close',function(){_0x3c8360[_0x8340('0xd')](_0x8340('0x1b'),new AGIError(_0x8340('0x1c')));});_0x34cb8a['on'](_0x8340('0x1d'),function(){_0x3c8360[_0x8340('0xd')](_0x8340('0x1d'),new AGIError(_0x8340('0x1e')));_0x34cb8a[_0x8340('0x1f')]();});_0x34cb8a[_0x8340('0x20')](_0x1ca22c);this[_0x8340('0x21')]=function(_0x33e2d6,_0x15c4e0){var _0x33e2d6=_0x33e2d6||'',_0x15c4e0=typeof _0x15c4e0=='function'?_0x15c4e0:new Function();_0x67180={'tx':_0x33e2d6,'rx':'','cb':_0x15c4e0};_0x34cb8a[_0x8340('0x22')](_0x33e2d6+'\x0a');},this[_0x8340('0x1b')]=function(){_0x34cb8a[_0x8340('0x1f')]();};}util[_0x8340('0x23')](AGIChannel,EventEmitter);AGIChannel['prototype']['sendRequest']=function(_0xbdc721){return this['command'][_0x8340('0x24')](this,_0xbdc721);};AGIChannel[_0x8340('0x25')]['answer']=function(){return this['sendRequest'](_0x8340('0x26'));};AGIChannel[_0x8340('0x25')]['getData']=function(_0xd51905,_0x4cbd0c,_0x3496e5){_0xd51905=_0xd51905===undefined?'beep':_0xd51905;_0x4cbd0c=_0x4cbd0c===undefined?'5':_0x4cbd0c;_0x3496e5=_0x3496e5===undefined?'1':_0x3496e5;return this[_0x8340('0x27')](util[_0x8340('0x28')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0xd51905,_0x4cbd0c*0x3e8,_0x3496e5));};AGIChannel[_0x8340('0x25')]['noop']=function(_0x2f57c7){_0x2f57c7=_0x2f57c7||_0x8340('0x29');return this[_0x8340('0x27')](util[_0x8340('0x28')](_0x8340('0x2a'),_0x2f57c7));};AGIChannel[_0x8340('0x25')][_0x8340('0x2b')]=function(_0x3e6e9d,_0x3d7ca4){if(_[_0x8340('0x2c')](_0x3d7ca4)){return this[_0x8340('0x27')](util[_0x8340('0x28')](_0x8340('0x2d'),_0x3e6e9d,_0x3d7ca4[_0x8340('0x2e')](',')));}return this[_0x8340('0x27')](util[_0x8340('0x28')](_0x8340('0x2d'),_0x3e6e9d,_0x3d7ca4));};AGIChannel[_0x8340('0x25')]['setContext']=function(_0x1ff5d3){return this['sendRequest'](util['format'](_0x8340('0x2f'),_0x1ff5d3));};AGIChannel[_0x8340('0x25')][_0x8340('0x30')]=function(_0x3faed2){return this['sendRequest'](util[_0x8340('0x28')](_0x8340('0x31'),_0x3faed2));};AGIChannel['prototype']['setPriority']=function(_0x5e008a){return this[_0x8340('0x27')](util[_0x8340('0x28')](_0x8340('0x32'),_0x5e008a));};AGIChannel[_0x8340('0x25')]['hangup']=function(){return this[_0x8340('0x27')](_0x8340('0x33'));};AGIChannel[_0x8340('0x25')][_0x8340('0x34')]=function(_0x4f5344,_0x328862){var _0x3149b4=_[_0x8340('0x35')](_0x328862)||_[_0x8340('0x36')](_0x328862)?_0x328862[_0x8340('0x37')]():_0x328862;return this[_0x8340('0x27')](util['format'](_0x8340('0x38'),_0x4f5344,_0x3149b4?_0x3149b4[_0x8340('0x37')]()[_0x8340('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x8340('0x25')][_0x8340('0x39')]=function(_0x2fefea,_0xa9a5ab){return this[_0x8340('0x27')](util['format'](_0x8340('0x3a'),_0x2fefea,_0xa9a5ab));};AGIChannel[_0x8340('0x25')][_0x8340('0x3b')]=function(_0x4c3018,_0x5893a2){return this[_0x8340('0x27')](util[_0x8340('0x28')]('SAY\x20DIGITS\x20%s\x20%s',_0x4c3018,_0x5893a2));};AGIChannel[_0x8340('0x25')][_0x8340('0x3c')]=function(_0xbe63d7,_0x1c0b93){return this['sendRequest'](util[_0x8340('0x28')](_0x8340('0x3d'),_0xbe63d7,_0x1c0b93));};AGIChannel[_0x8340('0x25')][_0x8340('0x3e')]=function(_0x4ea6ca,_0x115b40,_0x1ef321){_0x115b40=_0x115b40||this[_0x8340('0x3f')];_0x1ef321=_0x1ef321||0x1;this['setContext'](_0x4ea6ca);this[_0x8340('0x30')](_0x115b40);this[_0x8340('0x40')](_0x1ef321);return this[_0x8340('0x41')](util[_0x8340('0x28')](_0x8340('0x42'),_0x4ea6ca,_0x115b40,_0x1ef321));};AGIChannel[_0x8340('0x25')]['getVariable']=function(_0x5ac6f9){return this[_0x8340('0x27')](util['format'](_0x8340('0x43'),_0x5ac6f9));};AGIChannel[_0x8340('0x25')][_0x8340('0x44')]=function(_0x3b4b20,_0x32b258,_0x50523b,_0x8e0b13,_0x4e89a0,_0x5cc854){_0x32b258=_0x32b258||_0x8340('0x45');_0x50523b=_0x50523b||'';_0x8e0b13=_0x8e0b13===undefined?-0x1:_0x8e0b13==='-1'?-0x1:_0x8e0b13*0x3e8;_0x4e89a0=_0x4e89a0===undefined?'':'s='+_0x4e89a0;_0x5cc854=_0x5cc854?_0x8340('0x46'):'';return this[_0x8340('0x27')](util['format'](_0x8340('0x47'),_0x3b4b20,_0x32b258,_0x50523b,_0x8e0b13,_0x5cc854,_0x4e89a0));};AGIChannel['prototype'][_0x8340('0x48')]=function(_0x1543e8,_0xa7d56c){_0xa7d56c=_0xa7d56c||'';return this['sendRequest'](util[_0x8340('0x28')](_0x8340('0x49'),_0x1543e8,_0xa7d56c));};AGIChannel[_0x8340('0x25')][_0x8340('0x4a')]=function(_0x110d09){return this[_0x8340('0x2b')](_0x8340('0x4b'),_0x110d09);};AGIChannel[_0x8340('0x25')]['wait']=function(_0x31d1ba){return this[_0x8340('0x2b')](_0x8340('0x4c'),_0x31d1ba);};AGIChannel[_0x8340('0x25')][_0x8340('0x18')]=function(_0x537018,_0x457f3a){this[_0x8340('0x41')](util['format']('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x537018['id'],_0x537018[_0x8340('0x4d')],_0x457f3a));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x8340('0x4e')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index edd7e6c..b6382bc 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 _0xde5b=['message','name','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','format'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xde5b,0xc5));var _0xbde5=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0xde5b[_0x1a36a5];return _0x746243;};'use strict';var util=require(_0xbde5('0x0'));var error={'E_AGI_UNDEFINED':_0xbde5('0x1'),'E_AGI_ARGUMENT_PORT':_0xbde5('0x2'),'E_AGI_SERVER_ERROR':_0xbde5('0x3'),'E_AGI_SERVER_CLOSE':_0xbde5('0x4'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0xbde5('0x5'),'E_AGI_SOCKET_ERROR':_0xbde5('0x6'),'E_AGI_SOCKET_CLOSE':_0xbde5('0x7'),'E_AGI_SOCKET_TIMEOUT':_0xbde5('0x8'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xbde5('0x9'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x4dfc09){var _0x4dfc09=_0x4dfc09||null,_0x5e3cc6=_0x5e3cc6||[],_0x190be2=0x1,_0x26c267='';if(!error[_0x4dfc09]){_0x4dfc09=_0xbde5('0xa');}_0x5e3cc6[_0xbde5('0xb')](error[_0x4dfc09]);while(arguments[_0x190be2]){_0x5e3cc6[_0xbde5('0xb')](arguments[_0x190be2]);_0x190be2++;}_0x26c267=util[_0xbde5('0xc')]['apply'](util,_0x5e3cc6);this[_0xbde5('0xd')]=_0x26c267;this[_0xbde5('0xe')]=_0x4dfc09;}module['exports']=AGIError; \ No newline at end of file +var _0x92ee=['[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','apply','message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.'];(function(_0x2c2980,_0x34282a){var _0x2a20a9=function(_0x537b18){while(--_0x537b18){_0x2c2980['push'](_0x2c2980['shift']());}};_0x2a20a9(++_0x34282a);}(_0x92ee,0x1ca));var _0xe92e=function(_0x31ce94,_0x246777){_0x31ce94=_0x31ce94-0x0;var _0x16ca31=_0x92ee[_0x31ce94];return _0x16ca31;};'use strict';var util=require(_0xe92e('0x0'));var error={'E_AGI_UNDEFINED':_0xe92e('0x1'),'E_AGI_ARGUMENT_PORT':_0xe92e('0x2'),'E_AGI_SERVER_ERROR':_0xe92e('0x3'),'E_AGI_SERVER_CLOSE':_0xe92e('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0xe92e('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0xe92e('0x6'),'E_AGI_SOCKET_ERROR':_0xe92e('0x7'),'E_AGI_SOCKET_CLOSE':_0xe92e('0x8'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xe92e('0x9'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x435314){var _0x435314=_0x435314||null,_0x463788=_0x463788||[],_0x1d6c7c=0x1,_0xa01599='';if(!error[_0x435314]){_0x435314=_0xe92e('0xa');}_0x463788[_0xe92e('0xb')](error[_0x435314]);while(arguments[_0x1d6c7c]){_0x463788[_0xe92e('0xb')](arguments[_0x1d6c7c]);_0x1d6c7c++;}_0xa01599=util['format'][_0xe92e('0xc')](util,_0x463788);this[_0xe92e('0xd')]=_0xa01599;this[_0xe92e('0xe')]=_0x435314;}module[_0xe92e('0xf')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 051409a..a86f6f6 100644 --- a/server/services/agi/events.js +++ b/server/services/agi/events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5de9=['E_AGI_SERVER_ERROR','message','projectUpdate','lodash','EventEmitter','ioredis','../../config/environment','redis','defaults','localhost','subscribe','agi','emit','error'];(function(_0x5d824f,_0x145b0f){var _0x5de0f5=function(_0x475502){while(--_0x475502){_0x5d824f['push'](_0x5d824f['shift']());}};_0x5de0f5(++_0x145b0f);}(_0x5de9,0xc7));var _0x95de=function(_0x1a6007,_0x350755){_0x1a6007=_0x1a6007-0x0;var _0x120665=_0x5de9[_0x1a6007];return _0x120665;};'use strict';var _=require(_0x95de('0x0'));var EventEmitter=require('events')[_0x95de('0x1')];var Redis=require(_0x95de('0x2'));var AGIError=require('./error');var config=require(_0x95de('0x3'));config[_0x95de('0x4')]=_[_0x95de('0x5')](config[_0x95de('0x4')],{'host':_0x95de('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x95de('0x4')]);sub[_0x95de('0x7')](_0x95de('0x8'),function(_0x206780){if(_0x206780)return eventEmitter[_0x95de('0x9')](_0x95de('0xa'),new AGIError(_0x95de('0xb'),_0x206780));});sub['on'](_0x95de('0xc'),function(_0x2307f0,_0x514f0d){if(_0x2307f0!==_0x95de('0x8'))return;try{var _0x30957c=JSON['parse'](_0x514f0d);eventEmitter[_0x95de('0x9')](_0x95de('0xd'),_0x30957c);}catch(_0x39d996){eventEmitter[_0x95de('0x9')](_0x95de('0xa'),new AGIError(_0x95de('0xb'),_0x39d996));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x335c=['error','E_AGI_SERVER_ERROR','message','agi','parse','lodash','../../config/environment','redis','defaults','localhost','emit'];(function(_0x153a86,_0x5c521d){var _0x205dbb=function(_0x16355e){while(--_0x16355e){_0x153a86['push'](_0x153a86['shift']());}};_0x205dbb(++_0x5c521d);}(_0x335c,0x17b));var _0xc335=function(_0x1d090a,_0x5b1696){_0x1d090a=_0x1d090a-0x0;var _0x51ebb3=_0x335c[_0x1d090a];return _0x51ebb3;};'use strict';var _=require(_0xc335('0x0'));var EventEmitter=require('events')['EventEmitter'];var Redis=require('ioredis');var AGIError=require('./error');var config=require(_0xc335('0x1'));config[_0xc335('0x2')]=_[_0xc335('0x3')](config['redis'],{'host':_0xc335('0x4'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xc335('0x2')]);sub['subscribe']('agi',function(_0x26b7d8){if(_0x26b7d8)return eventEmitter[_0xc335('0x5')](_0xc335('0x6'),new AGIError(_0xc335('0x7'),_0x26b7d8));});sub['on'](_0xc335('0x8'),function(_0x43575c,_0x351fe4){if(_0x43575c!==_0xc335('0x9'))return;try{var _0x43e42c=JSON[_0xc335('0xa')](_0x351fe4);eventEmitter[_0xc335('0x5')]('projectUpdate',_0x43e42c);}catch(_0x48a21c){eventEmitter[_0xc335('0x5')]('error',new AGIError(_0xc335('0x7'),_0x48a21c));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index c456df2..968582e 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 _0x51dd=['default','invalid','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices','edges','prototype','addVertex','addEdge','push','numberOfEdges','size','getVertex','traverseBFS','info','no\x20vertex\x20found','length','condition','split','agicommand','vswitch','target'];(function(_0x5b8496,_0x1678b5){var _0xcc1eab=function(_0x165947){while(--_0x165947){_0x5b8496['push'](_0x5b8496['shift']());}};_0xcc1eab(++_0x1678b5);}(_0x51dd,0x1d5));var _0xd51d=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x51dd[_0x5f309e];return _0x487b5e;};'use strict';var _=require(_0xd51d('0x0'));var logger=require(_0xd51d('0x1'))(_0xd51d('0x2'));var verticesWithRetry=[_0xd51d('0x3'),_0xd51d('0x4'),_0xd51d('0x5')];var Graph=function(){this[_0xd51d('0x6')]={};this[_0xd51d('0x7')]={};this['numberOfEdges']=0x0;};Graph[_0xd51d('0x8')][_0xd51d('0x9')]=function(_0x91881b){this[_0xd51d('0x6')][_0x91881b['id']]=_0x91881b;this[_0xd51d('0x7')][_0x91881b['id']]=[];};Graph[_0xd51d('0x8')][_0xd51d('0xa')]=function(_0xf498dc,_0x5bf2bb,_0x4eb12c){this[_0xd51d('0x7')][_0xf498dc][_0xd51d('0xb')]({'target':_0x5bf2bb,'condition':_0x4eb12c});this[_0xd51d('0xc')]+=0x1;};Graph[_0xd51d('0x8')][_0xd51d('0xd')]=function(){return _[_0xd51d('0xd')](this['vertices']);};Graph[_0xd51d('0x8')]['relations']=function(){return this[_0xd51d('0xc')];};Graph[_0xd51d('0x8')][_0xd51d('0xe')]=function(_0x4bbd08){return this[_0xd51d('0x6')][_0x4bbd08];};Graph[_0xd51d('0x8')][_0xd51d('0xf')]=function(_0x558db7,_0x5ea729){if(!this[_0xd51d('0x6')][_0x558db7]){return logger[_0xd51d('0x10')](_0xd51d('0x11'));}var _0x78615b=_0x5ea729(this['vertices'][_0x558db7]);if(!_0x78615b){return logger[_0xd51d('0x10')]('stop\x20traverse');}if(this[_0xd51d('0x7')][_0x558db7]['length']===0x0){return logger[_0xd51d('0x10')]('no\x20edge/s\x20available');}for(var _0x354e63=0x0,_0x327cbd=[],_0x1a34d9=![];_0x354e63\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','createSquareReport','catch','hasOwnProperty','indexOf','agi_','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','find','production','handleUnpublished','initialize','then','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','getAll','[LICENSE]','./server','listening','connection','close','syncho','util','../../config/environment','../../config/logger','../../config/license/util','./rpc','./events','EventEmitter','agi','127.0.0.1','projectUpdate','nextTick','error','stack','findIndex','deleted','splice','push','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x8def,0x9b));var _0xf8de=function(_0x4a0244,_0x31a012){_0x4a0244=_0x4a0244-0x0;var _0x2c8f45=_0x8def[_0x4a0244];return _0x2c8f45;};'use strict';var _=require('lodash');var syncho=require(_0xf8de('0x0'));var util=require(_0xf8de('0x1'));var config=require(_0xf8de('0x2'));var logger=require(_0xf8de('0x3'))('agi');var utilLicense=require(_0xf8de('0x4'));var rpc=require(_0xf8de('0x5'));var Project=require('./project');var AGIEmitter=require(_0xf8de('0x6'))[_0xf8de('0x7')];var projects=[];config[_0xf8de('0x8')]=_['defaults'](config[_0xf8de('0x8')],{'ip':_0xf8de('0x9'),'port':0x11dd});AGIEmitter['on'](_0xf8de('0xa'),projectUpdateHandler);function connectionHandler(_0x29a3e3){process[_0xf8de('0xb')](function(){syncho(function(){try{setChannelVariables(_0x29a3e3);agiHandler(_0x29a3e3);}catch(_0x5dddd6){logger[_0xf8de('0xc')](_0x5dddd6[_0xf8de('0xd')]);}});});}function projectUpdateHandler(_0x4a7402){try{var _0x554f3a=_[_0xf8de('0xe')](projects,['id',_0x4a7402['id']]);if(_0x554f3a>-0x1){if(_0x4a7402[_0xf8de('0xf')]===!![]){projects[_0xf8de('0x10')](_0x554f3a,0x1);}else{projects[_0x554f3a]=_0x4a7402;}}else{projects[_0xf8de('0x11')](_0x4a7402);}}catch(_0x1ca87e){logger[_0xf8de('0xc')](_0x1ca87e[_0xf8de('0xd')]);}}function listeningHandler(){console[_0xf8de('0x12')](_0xf8de('0x13'),config[_0xf8de('0x8')][_0xf8de('0x14')]);logger[_0xf8de('0x15')](util[_0xf8de('0x16')](_0xf8de('0x17'),config['agi']['ip'],config[_0xf8de('0x8')][_0xf8de('0x14')]));}function errorHandler(_0x4649ad){if(_0x4649ad&&_0x4649ad[_0xf8de('0x18')]&&_0x4649ad[_0xf8de('0x19')]){logger[_0xf8de('0xc')](util[_0xf8de('0x16')](_0xf8de('0x1a'),_0x4649ad['name'],_0x4649ad[_0xf8de('0x19')]));}else{logger[_0xf8de('0xc')](util[_0xf8de('0x16')](_0xf8de('0x1b'),_0x4649ad[_0xf8de('0xd')]));}}function closeHandler(){logger[_0xf8de('0x15')](util['format'](_0xf8de('0x1c'),this[_0xf8de('0x1d')],this['calleridname'],this['callerid'],this[_0xf8de('0x1e')],this[_0xf8de('0x1f')]));try{createSquareReport(this);}catch(_0x3da7c6){logger[_0xf8de('0xc')](_0x3da7c6[_0xf8de('0xd')]);}}function timeoutHandler(){logger[_0xf8de('0x15')](util[_0xf8de('0x16')](_0xf8de('0x20'),this[_0xf8de('0x1d')],this[_0xf8de('0x21')],this[_0xf8de('0x22')],this[_0xf8de('0x1e')],this[_0xf8de('0x1f')]));}function hangupHandler(){logger[_0xf8de('0x15')](util[_0xf8de('0x16')](_0xf8de('0x23'),this[_0xf8de('0x1d')],this[_0xf8de('0x21')],this[_0xf8de('0x22')],this[_0xf8de('0x1e')],this[_0xf8de('0x1f')]));this['evtHangup']=!![];}function createSquareReport(_0x19ff61,_0x1d5ac4){rpc[_0xf8de('0x24')](_0x19ff61)['then'](function(_0x5c1b4c){if(_0x1d5ac4){_0x1d5ac4(null,_0x5c1b4c);}})[_0xf8de('0x25')](function(_0x59e15d){if(_0x1d5ac4){_0x1d5ac4(null,_0x59e15d);}});}function setChannelVariables(_0x4b593e){for(var _0x531499 in _0x4b593e){if(_0x4b593e[_0xf8de('0x26')](_0x531499)){if(_0x531499[_0xf8de('0x27')](_0xf8de('0x28'))===0x0){_0x4b593e[_0x531499[_0xf8de('0x29')](0x4)]=_0x4b593e[_0x531499];delete _0x4b593e[_0x531499];}}}}function agiHandler(_0x446a1){logger[_0xf8de('0x2a')](_0xf8de('0x2b'),JSON[_0xf8de('0x2c')](_0x446a1,null,0x2));logger[_0xf8de('0x15')](util['format'](_0xf8de('0x2d'),_0x446a1['arg_1'],_0x446a1[_0xf8de('0x21')],_0x446a1['callerid'],_0x446a1[_0xf8de('0x1e')],_0x446a1[_0xf8de('0x1f')]));_0x446a1['on'](_0xf8de('0xc'),errorHandler);_0x446a1['on']('close',closeHandler);_0x446a1['on']('timeout',timeoutHandler);_0x446a1['evtHangup']=![];_0x446a1['on']('hangup',hangupHandler);var _0x578dac=_[_0xf8de('0x2e')](projects,['name',_0x446a1[_0xf8de('0x1d')]]);if(!_0x578dac)return Project['handleNotFound'](_0x446a1);if(!_0x578dac[_0xf8de('0x2f')])return Project[_0xf8de('0x30')](_0x446a1);return Project[_0xf8de('0x31')](_0x578dac,_0x446a1);}function main(){var _0x4749fb;return utilLicense['getLicense']()[_0xf8de('0x32')](function(_0x5b77f2){if(!_0x5b77f2)return;if(_0x5b77f2[_0xf8de('0x33')]){if(_0x5b77f2[_0xf8de('0x34')]&&_0x5b77f2[_0xf8de('0x34')]>0x0){logger[_0xf8de('0x15')](util[_0xf8de('0x16')](_0xf8de('0x35'),_0x5b77f2[_0xf8de('0x34')]));_0x4749fb=_0x5b77f2[_0xf8de('0x34')];}else{logger[_0xf8de('0x15')](_0xf8de('0x36'));}}else{logger[_0xf8de('0x15')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x4749fb=-0x1;}})['then'](function(){return Project[_0xf8de('0x37')]();})[_0xf8de('0x32')](function(_0x34b689){projects=_0x34b689;return;})[_0xf8de('0x25')](function(_0x185d18){logger[_0xf8de('0xc')](_0xf8de('0x38'),_0x185d18[_0xf8de('0xd')]);})['finally'](function(){var _0x3c7024=require(_0xf8de('0x39'))(config[_0xf8de('0x8')]['port'],config['agi']['ip'],_0x4749fb);_0x3c7024['on']('error',errorHandler);_0x3c7024['on'](_0xf8de('0x3a'),listeningHandler);_0x3c7024['on'](_0xf8de('0x3b'),connectionHandler);_0x3c7024['on'](_0xf8de('0x3c'),closeHandler);});}main(); \ No newline at end of file +var _0xb2a8=['createSquareReport','then','catch','hasOwnProperty','indexOf','agi_','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','handleNotFound','production','handleUnpublished','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','finally','./server','syncho','util','../../config/environment','../../config/logger','../../config/license/util','./project','./events','EventEmitter','agi','127.0.0.1','projectUpdate','nextTick','stack','findIndex','deleted','splice','push','error','port','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[ERROR]\x20%s','info','arg_1','calleridname','dnid','uniqueid','callerid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup'];(function(_0x274a23,_0xba9cbb){var _0x39be73=function(_0x1dd0ab){while(--_0x1dd0ab){_0x274a23['push'](_0x274a23['shift']());}};_0x39be73(++_0xba9cbb);}(_0xb2a8,0x16f));var _0x8b2a=function(_0x329485,_0x4f7e0d){_0x329485=_0x329485-0x0;var _0x3dd0bb=_0xb2a8[_0x329485];return _0x3dd0bb;};'use strict';var _=require('lodash');var syncho=require(_0x8b2a('0x0'));var util=require(_0x8b2a('0x1'));var config=require(_0x8b2a('0x2'));var logger=require(_0x8b2a('0x3'))('agi');var utilLicense=require(_0x8b2a('0x4'));var rpc=require('./rpc');var Project=require(_0x8b2a('0x5'));var AGIEmitter=require(_0x8b2a('0x6'))[_0x8b2a('0x7')];var projects=[];config[_0x8b2a('0x8')]=_['defaults'](config['agi'],{'ip':_0x8b2a('0x9'),'port':0x11dd});AGIEmitter['on'](_0x8b2a('0xa'),projectUpdateHandler);function connectionHandler(_0x491184){process[_0x8b2a('0xb')](function(){syncho(function(){try{setChannelVariables(_0x491184);agiHandler(_0x491184);}catch(_0x446d21){logger['error'](_0x446d21[_0x8b2a('0xc')]);}});});}function projectUpdateHandler(_0x1a3da0){try{var _0x2b8266=_[_0x8b2a('0xd')](projects,['id',_0x1a3da0['id']]);if(_0x2b8266>-0x1){if(_0x1a3da0[_0x8b2a('0xe')]===!![]){projects[_0x8b2a('0xf')](_0x2b8266,0x1);}else{projects[_0x2b8266]=_0x1a3da0;}}else{projects[_0x8b2a('0x10')](_0x1a3da0);}}catch(_0x266fc7){logger[_0x8b2a('0x11')](_0x266fc7[_0x8b2a('0xc')]);}}function listeningHandler(){console['log']('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config['agi'][_0x8b2a('0x12')]);logger['info'](util[_0x8b2a('0x13')](_0x8b2a('0x14'),config['agi']['ip'],config[_0x8b2a('0x8')][_0x8b2a('0x12')]));}function errorHandler(_0x3c873b){if(_0x3c873b&&_0x3c873b[_0x8b2a('0x15')]&&_0x3c873b[_0x8b2a('0x16')]){logger[_0x8b2a('0x11')](util[_0x8b2a('0x13')]('[%s]\x20%s',_0x3c873b[_0x8b2a('0x15')],_0x3c873b[_0x8b2a('0x16')]));}else{logger['error'](util[_0x8b2a('0x13')](_0x8b2a('0x17'),_0x3c873b[_0x8b2a('0xc')]));}}function closeHandler(){logger[_0x8b2a('0x18')](util[_0x8b2a('0x13')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x8b2a('0x19')],this[_0x8b2a('0x1a')],this['callerid'],this[_0x8b2a('0x1b')],this[_0x8b2a('0x1c')]));try{createSquareReport(this);}catch(_0x1a9178){logger['error'](_0x1a9178[_0x8b2a('0xc')]);}}function timeoutHandler(){logger[_0x8b2a('0x18')](util['format']('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x8b2a('0x19')],this['calleridname'],this[_0x8b2a('0x1d')],this[_0x8b2a('0x1b')],this[_0x8b2a('0x1c')]));}function hangupHandler(){logger[_0x8b2a('0x18')](util['format'](_0x8b2a('0x1e'),this[_0x8b2a('0x19')],this[_0x8b2a('0x1a')],this[_0x8b2a('0x1d')],this[_0x8b2a('0x1b')],this[_0x8b2a('0x1c')]));this[_0x8b2a('0x1f')]=!![];}function createSquareReport(_0x2c3776,_0x2fae35){rpc[_0x8b2a('0x20')](_0x2c3776)[_0x8b2a('0x21')](function(_0x258a2d){if(_0x2fae35){_0x2fae35(null,_0x258a2d);}})[_0x8b2a('0x22')](function(_0x20f84c){if(_0x2fae35){_0x2fae35(null,_0x20f84c);}});}function setChannelVariables(_0x3a494b){for(var _0x4554ac in _0x3a494b){if(_0x3a494b[_0x8b2a('0x23')](_0x4554ac)){if(_0x4554ac[_0x8b2a('0x24')](_0x8b2a('0x25'))===0x0){_0x3a494b[_0x4554ac['substring'](0x4)]=_0x3a494b[_0x4554ac];delete _0x3a494b[_0x4554ac];}}}}function agiHandler(_0x7da768){logger[_0x8b2a('0x26')](_0x8b2a('0x27'),JSON[_0x8b2a('0x28')](_0x7da768,null,0x2));logger[_0x8b2a('0x18')](util['format'](_0x8b2a('0x29'),_0x7da768['arg_1'],_0x7da768['calleridname'],_0x7da768['callerid'],_0x7da768[_0x8b2a('0x1b')],_0x7da768['uniqueid']));_0x7da768['on'](_0x8b2a('0x11'),errorHandler);_0x7da768['on'](_0x8b2a('0x2a'),closeHandler);_0x7da768['on'](_0x8b2a('0x2b'),timeoutHandler);_0x7da768[_0x8b2a('0x1f')]=![];_0x7da768['on'](_0x8b2a('0x2c'),hangupHandler);var _0x32a977=_['find'](projects,[_0x8b2a('0x15'),_0x7da768[_0x8b2a('0x19')]]);if(!_0x32a977)return Project[_0x8b2a('0x2d')](_0x7da768);if(!_0x32a977[_0x8b2a('0x2e')])return Project[_0x8b2a('0x2f')](_0x7da768);return Project['initialize'](_0x32a977,_0x7da768);}function main(){var _0x37d852;return utilLicense[_0x8b2a('0x30')]()[_0x8b2a('0x21')](function(_0x44b8bb){if(!_0x44b8bb)return;if(_0x44b8bb[_0x8b2a('0x31')]){if(_0x44b8bb[_0x8b2a('0x32')]&&_0x44b8bb[_0x8b2a('0x32')]>0x0){logger[_0x8b2a('0x18')](util[_0x8b2a('0x13')]('[LICENSE]\x20CHANNELS:\x20%s',_0x44b8bb[_0x8b2a('0x32')]));_0x37d852=_0x44b8bb[_0x8b2a('0x32')];}else{logger[_0x8b2a('0x18')](_0x8b2a('0x33'));}}else{logger['info'](_0x8b2a('0x34'));_0x37d852=-0x1;}})[_0x8b2a('0x21')](function(){return Project[_0x8b2a('0x35')]();})[_0x8b2a('0x21')](function(_0x5dc671){projects=_0x5dc671;return;})[_0x8b2a('0x22')](function(_0x16e945){logger['error'](_0x8b2a('0x36'),_0x16e945['stack']);})[_0x8b2a('0x37')](function(){var _0x410c55=require(_0x8b2a('0x38'))(config['agi'][_0x8b2a('0x12')],config['agi']['ip'],_0x37d852);_0x410c55['on']('error',errorHandler);_0x410c55['on']('listening',listeningHandler);_0x410c55['on']('connection',connectionHandler);_0x410c55['on'](_0x8b2a('0x2a'),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 c346c52..ef5f9d1 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 _0x9a77=['http','request','then','error','catch','client'];(function(_0x5021f7,_0x53fe34){var _0x29f8a2=function(_0x135612){while(--_0x135612){_0x5021f7['push'](_0x5021f7['shift']());}};_0x29f8a2(++_0x53fe34);}(_0x9a77,0x1df));var _0x79a7=function(_0x8aa296,_0x396efb){_0x8aa296=_0x8aa296-0x0;var _0x2191ce=_0x9a77[_0x8aa296];return _0x2191ce;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var client=jayson[_0x79a7('0x0')][_0x79a7('0x1')]({'port':0x232b});function request(_0x988d90,_0x11341b){return new BPromise(function(_0x150a81,_0x5206a5){return client[_0x79a7('0x2')](_0x988d90,_0x11341b)[_0x79a7('0x3')](function(_0x3450aa){if(_0x3450aa['error']){return _0x5206a5(_0x3450aa[_0x79a7('0x4')]['message']);}else{return _0x150a81(_0x3450aa['result']);}})[_0x79a7('0x5')](function(_0x4bba25){return _0x5206a5(_0x4bba25);});});}exports['sendMailMessage']=function(_0x223496,_0x187c07){return request('SendMail',{'account':_0x223496,'message':_0x187c07});}; \ No newline at end of file +var _0xf056=['then','error','result','catch','sendMailMessage','bluebird','jayson/promise','http','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf056,0x125));var _0x6f05=function(_0x2009cd,_0x542bfa){_0x2009cd=_0x2009cd-0x0;var _0x4723e8=_0xf056[_0x2009cd];return _0x4723e8;};'use strict';var BPromise=require(_0x6f05('0x0'));var jayson=require(_0x6f05('0x1'));var client=jayson['client'][_0x6f05('0x2')]({'port':0x232b});function request(_0x47b818,_0x2e9bcc){return new BPromise(function(_0x8cfb95,_0x18adb4){return client[_0x6f05('0x3')](_0x47b818,_0x2e9bcc)[_0x6f05('0x4')](function(_0x54bc7a){if(_0x54bc7a['error']){return _0x18adb4(_0x54bc7a[_0x6f05('0x5')]['message']);}else{return _0x8cfb95(_0x54bc7a[_0x6f05('0x6')]);}})[_0x6f05('0x7')](function(_0x5168ce){return _0x18adb4(_0x5168ce);});});}exports[_0x6f05('0x8')]=function(_0xa691b5,_0xf49790){return request('SendMail',{'account':_0xa691b5,'message':_0xf49790});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 3f71b8d..8c1b06c 100644 --- a/server/services/agi/project.js +++ b/server/services/agi/project.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6576=['util','agi','./rpc','./graph','./vertices','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','retry','addVertex','omit','mxCell','isArray','length','source','target','value','toJson','root','inspect','production','start','debug','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','info','format','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','traverseBFS','clear','vertex','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','evtHangup','isUndefined','toString','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','agicommand\x20not\x20found','[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','close','Project\x20%s\x20not\x20found','exports','lodash','moment','xml2json'];(function(_0x48e5ef,_0x31c8a5){var _0x54b39b=function(_0x2e8ffe){while(--_0x2e8ffe){_0x48e5ef['push'](_0x48e5ef['shift']());}};_0x54b39b(++_0x31c8a5);}(_0x6576,0x1a8));var _0x6657=function(_0x34f701,_0x37e407){_0x34f701=_0x34f701-0x0;var _0x3e2429=_0x6576[_0x34f701];return _0x3e2429;};'use strict';var _=require(_0x6657('0x0'));var moment=require(_0x6657('0x1'));var parser=require(_0x6657('0x2'));var util=require(_0x6657('0x3'));var logger=require('../../config/logger')(_0x6657('0x4'));var rpc=require(_0x6657('0x5'));var mailRpc=require('./mailRpc');var Graph=require(_0x6657('0x6'));var Vertices=require(_0x6657('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()[_0x6657('0x8')](function(_0x5ceb19){logger[_0x6657('0x9')](_0x6657('0xa'),_0x5ceb19[_0x6657('0xb')]);return[];});}function addVertex(_0x517b39,_0x342a61,_0x2a7494){_0x342a61[_0x6657('0xc')]=_0x2a7494;if(_0x342a61['hasOwnProperty']('retry')){_0x342a61['maxRetry']=parseInt(_0x342a61[_0x6657('0xd')],0xa);}_0x517b39[_0x6657('0xe')](_[_0x6657('0xf')](_0x342a61,_0x6657('0x10')));}function initGraph(_0x358600,_0x55bd4b){var _0x492dd8=new Graph();for(var _0x2c202b in _0x358600){if(_0x358600['hasOwnProperty'](_0x2c202b)){if(_[_0x6657('0x11')](_0x358600[_0x2c202b])){for(var _0x4400e3=0x0;_0x4400e3<_0x358600[_0x2c202b][_0x6657('0x12')];_0x4400e3+=0x1){addVertex(_0x492dd8,_0x358600[_0x2c202b][_0x4400e3],_0x2c202b);}}else{addVertex(_0x492dd8,_0x358600[_0x2c202b],_0x2c202b);}}}for(var _0x253410=0x0;_0x253410<_0x55bd4b['length'];_0x253410+=0x1){if(_0x55bd4b[_0x253410][_0x6657('0x13')]&&_0x55bd4b[_0x253410]['target']){_0x492dd8['addEdge'](_0x55bd4b[_0x253410][_0x6657('0x13')],_0x55bd4b[_0x253410][_0x6657('0x14')],_0x55bd4b[_0x253410][_0x6657('0x15')]);}}return _0x492dd8;}function getRoot(_0x39ec96){return parser[_0x6657('0x16')](_0x39ec96,{'object':!![]})['mxGraphModel'][_0x6657('0x17')];}function inspect(_0x429a07){return util[_0x6657('0x18')](_0x429a07,{'showHidden':![],'depth':null});}function initialize(_0x2ade55,_0x1706c0){var _0x3cde1c=getRoot(_0x2ade55[_0x6657('0x19')]);if(!_0x3cde1c||!_0x3cde1c[_0x6657('0x1a')])return;var _0x20f850,_0xa39422,_0x1c7819;logger[_0x6657('0x1b')](_0x6657('0x17'),JSON[_0x6657('0x1c')](_0x3cde1c,null,0x2));_0x1706c0[_0x6657('0x1d')]=moment()['format'](_0x6657('0x1e'));_0x20f850=initGraph(_['omit'](_0x3cde1c,_0x6657('0x10')),_0x3cde1c['mxCell']);_0xa39422=new Vertices(_0x1706c0,rpc,mailRpc);logger[_0x6657('0x1f')](util[_0x6657('0x20')](_0x6657('0x21'),_0x1706c0[_0x6657('0x22')],_0x1706c0[_0x6657('0x23')],_0x1706c0[_0x6657('0x24')],_0x1706c0[_0x6657('0x25')],_0x1706c0[_0x6657('0x26')]));_0x20f850[_0x6657('0x27')](_0x3cde1c[_0x6657('0x1a')]['id'],function(_0x5bcc2c){try{_0x5bcc2c=_0xa39422[_0x6657('0x28')](_0x5bcc2c);logger[_0x6657('0x1b')](_0x6657('0x29'),JSON[_0x6657('0x1c')](_0x5bcc2c,null,0x2));if(_0x5bcc2c[_0x6657('0xc')]==='gotoc'){logger[_0x6657('0x1f')](_0x6657('0x2a'));_0x1706c0[_0x6657('0x2b')]=_0x5bcc2c[_0x6657('0x2b')]||_0x1706c0[_0x6657('0x2b')];_0x1706c0[_0x6657('0x2c')]=_0x5bcc2c[_0x6657('0x2c')];_0x1706c0[_0x6657('0x2d')]=_0x5bcc2c[_0x6657('0x2d')]?_0x5bcc2c[_0x6657('0x2d')]-0x1:0x1;return null;}else if(_0x5bcc2c&&_0xa39422[_0x5bcc2c[_0x6657('0xc')]]){_0x1c7819=_0xa39422[_0x5bcc2c['agicommand']](_0x5bcc2c);logger['info'](_0x6657('0x2e'),JSON['stringify'](_0x1c7819,null,0x2));if(_0x1c7819&&_0x1c7819[_0x6657('0x2f')]===AGI_CODE_SUCCESS&&_0x1c7819[_0x6657('0x30')]!==AGI_RESULT_ERROR&&!_0x1706c0[_0x6657('0x31')]){logger[_0x6657('0x1b')](_0x6657('0x2e'),inspect(_0x1c7819));return _[_0x6657('0x32')](_0x1c7819['result'])?null:_0x1c7819['result'][_0x6657('0x33')]();}else{logger[_0x6657('0x9')](_0x6657('0x2e'),inspect(_0x1c7819));return null;}}else{logger[_0x6657('0x9')]('agicommand\x20not\x20found');return null;}}catch(_0x13b07d){logger[_0x6657('0x9')](_0x13b07d[_0x6657('0xb')]);return null;}});if(_0x3cde1c[_0x6657('0x34')]){logger[_0x6657('0x1f')](util[_0x6657('0x20')](_0x6657('0x35'),_0x1706c0[_0x6657('0x22')],_0x1706c0[_0x6657('0x23')],_0x1706c0[_0x6657('0x24')],_0x1706c0[_0x6657('0x25')],_0x1706c0[_0x6657('0x26')]));_0x20f850[_0x6657('0x27')](_0x3cde1c[_0x6657('0x34')]['id'],function(_0x2ef74a){try{_0x2ef74a=_0xa39422[_0x6657('0x28')](_0x2ef74a);logger[_0x6657('0x1b')](_0x6657('0x29'),JSON[_0x6657('0x1c')](_0x2ef74a,null,0x2));if(_0x2ef74a&&_0xa39422[_0x2ef74a['agicommand']]){_0x1c7819=_0xa39422[_0x2ef74a[_0x6657('0xc')]](_0x2ef74a);if(_0x1c7819){logger[_0x6657('0x1b')](_0x6657('0x2e'),inspect(_0x1c7819));return _[_0x6657('0x32')](_0x1c7819['result'])?null:_0x1c7819[_0x6657('0x30')][_0x6657('0x33')]();}else{logger[_0x6657('0x9')](_0x6657('0x2e'),inspect(_0x1c7819));return null;}}else{logger[_0x6657('0x9')](_0x6657('0x36'));return null;}}catch(_0x200c35){logger[_0x6657('0x9')](_0x200c35[_0x6657('0xb')]);return null;}});}logger['info'](util[_0x6657('0x20')](_0x6657('0x37'),_0x1706c0[_0x6657('0x22')],_0x1706c0[_0x6657('0x23')],_0x1706c0[_0x6657('0x24')],_0x1706c0[_0x6657('0x25')],_0x1706c0[_0x6657('0x26')]));logger[_0x6657('0x1f')](util[_0x6657('0x20')](_0x6657('0x38'),_0x1706c0[_0x6657('0x2b')],_0x1706c0['extension'],parseInt(_0x1706c0[_0x6657('0x2d')],0xa)+0x1));_0x1706c0[_0x6657('0x39')](_0x1706c0['context'],_0x1706c0['extension'],parseInt(_0x1706c0['priority'],0xa)+0x1);_0x1706c0[_0x6657('0x3a')]();}function handleNotFound(_0x190f18){logger['error'](util[_0x6657('0x20')](_0x6657('0x3b'),_0x190f18['arg_1']));_0x190f18[_0x6657('0x39')](_0x190f18[_0x6657('0x2b')],_0x190f18[_0x6657('0x2c')],parseInt(_0x190f18[_0x6657('0x2d')],0xa)+0x1);_0x190f18[_0x6657('0x3a')]();}function handleUnpublished(_0x5c4094){logger[_0x6657('0x9')](util[_0x6657('0x20')]('Project\x20%s\x20not\x20published',_0x5c4094[_0x6657('0x22')]));_0x5c4094[_0x6657('0x39')](_0x5c4094[_0x6657('0x2b')],_0x5c4094[_0x6657('0x2c')],parseInt(_0x5c4094['priority'],0xa)+0x1);_0x5c4094[_0x6657('0x3a')]();}module[_0x6657('0x3c')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x8234=['xml2json','util','../../config/logger','agi','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','maxRetry','retry','addVertex','omit','mxCell','length','source','target','value','toJson','mxGraphModel','root','inspect','production','stringify','joinAt','format','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','uniqueid','traverseBFS','start','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','evtHangup','result','toString','agicommand\x20not\x20found','finally','calleridname','debug','isUndefined','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','continueAt','exports','lodash','moment'];(function(_0x47a5bd,_0x508329){var _0x5c2184=function(_0x40ddea){while(--_0x40ddea){_0x47a5bd['push'](_0x47a5bd['shift']());}};_0x5c2184(++_0x508329);}(_0x8234,0x80));var _0x4823=function(_0xd3fb91,_0xfc54c0){_0xd3fb91=_0xd3fb91-0x0;var _0x33438c=_0x8234[_0xd3fb91];return _0x33438c;};'use strict';var _=require(_0x4823('0x0'));var moment=require(_0x4823('0x1'));var parser=require(_0x4823('0x2'));var util=require(_0x4823('0x3'));var logger=require(_0x4823('0x4'))(_0x4823('0x5'));var rpc=require(_0x4823('0x6'));var mailRpc=require(_0x4823('0x7'));var Graph=require(_0x4823('0x8'));var Vertices=require(_0x4823('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x4823('0xa')]()[_0x4823('0xb')](function(_0x25beb){logger[_0x4823('0xc')](_0x4823('0xd'),_0x25beb[_0x4823('0xe')]);return[];});}function addVertex(_0x4e7029,_0x2e889c,_0x25fb87){_0x2e889c[_0x4823('0xf')]=_0x25fb87;if(_0x2e889c[_0x4823('0x10')]('retry')){_0x2e889c[_0x4823('0x11')]=parseInt(_0x2e889c[_0x4823('0x12')],0xa);}_0x4e7029[_0x4823('0x13')](_[_0x4823('0x14')](_0x2e889c,_0x4823('0x15')));}function initGraph(_0x408e99,_0x4c7da5){var _0x1a8511=new Graph();for(var _0x5d39ab in _0x408e99){if(_0x408e99[_0x4823('0x10')](_0x5d39ab)){if(_['isArray'](_0x408e99[_0x5d39ab])){for(var _0x3fa8d0=0x0;_0x3fa8d0<_0x408e99[_0x5d39ab][_0x4823('0x16')];_0x3fa8d0+=0x1){addVertex(_0x1a8511,_0x408e99[_0x5d39ab][_0x3fa8d0],_0x5d39ab);}}else{addVertex(_0x1a8511,_0x408e99[_0x5d39ab],_0x5d39ab);}}}for(var _0x5131bd=0x0;_0x5131bd<_0x4c7da5['length'];_0x5131bd+=0x1){if(_0x4c7da5[_0x5131bd][_0x4823('0x17')]&&_0x4c7da5[_0x5131bd][_0x4823('0x18')]){_0x1a8511['addEdge'](_0x4c7da5[_0x5131bd]['source'],_0x4c7da5[_0x5131bd][_0x4823('0x18')],_0x4c7da5[_0x5131bd][_0x4823('0x19')]);}}return _0x1a8511;}function getRoot(_0x4e8068){return parser[_0x4823('0x1a')](_0x4e8068,{'object':!![]})[_0x4823('0x1b')][_0x4823('0x1c')];}function inspect(_0x4d74a7){return util[_0x4823('0x1d')](_0x4d74a7,{'showHidden':![],'depth':null});}function initialize(_0x394d7b,_0x511e23){var _0x12afe9=getRoot(_0x394d7b[_0x4823('0x1e')]);if(!_0x12afe9||!_0x12afe9['start'])return;var _0x1d07a3,_0x2bb2c4,_0xee270c;logger['debug'](_0x4823('0x1c'),JSON[_0x4823('0x1f')](_0x12afe9,null,0x2));_0x511e23[_0x4823('0x20')]=moment()[_0x4823('0x21')]('YYYY-MM-DD\x20HH:mm:ss');_0x1d07a3=initGraph(_[_0x4823('0x14')](_0x12afe9,_0x4823('0x15')),_0x12afe9[_0x4823('0x15')]);_0x2bb2c4=new Vertices(_0x511e23,rpc,mailRpc);logger[_0x4823('0x22')](util['format'](_0x4823('0x23'),_0x511e23[_0x4823('0x24')],_0x511e23['calleridname'],_0x511e23[_0x4823('0x25')],_0x511e23[_0x4823('0x26')],_0x511e23[_0x4823('0x27')]));_0x1d07a3[_0x4823('0x28')](_0x12afe9[_0x4823('0x29')]['id'],function(_0x2bbb12){try{_0x2bbb12=_0x2bb2c4[_0x4823('0x2a')](_0x2bbb12);logger['debug'](_0x4823('0x2b'),JSON[_0x4823('0x1f')](_0x2bbb12,null,0x2));if(_0x2bbb12[_0x4823('0xf')]===_0x4823('0x2c')){logger[_0x4823('0x22')](_0x4823('0x2d'));_0x511e23[_0x4823('0x2e')]=_0x2bbb12[_0x4823('0x2e')]||_0x511e23[_0x4823('0x2e')];_0x511e23[_0x4823('0x2f')]=_0x2bbb12[_0x4823('0x2f')];_0x511e23[_0x4823('0x30')]=_0x2bbb12[_0x4823('0x30')]?_0x2bbb12['priority']-0x1:0x1;return null;}else if(_0x2bbb12&&_0x2bb2c4[_0x2bbb12[_0x4823('0xf')]]){_0xee270c=_0x2bb2c4[_0x2bbb12[_0x4823('0xf')]](_0x2bbb12);logger[_0x4823('0x22')](_0x4823('0x31'),JSON[_0x4823('0x1f')](_0xee270c,null,0x2));if(_0xee270c&&_0xee270c[_0x4823('0x32')]===AGI_CODE_SUCCESS&&_0xee270c['result']!==AGI_RESULT_ERROR&&!_0x511e23[_0x4823('0x33')]){logger['debug'](_0x4823('0x31'),inspect(_0xee270c));return _['isUndefined'](_0xee270c['result'])?null:_0xee270c[_0x4823('0x34')][_0x4823('0x35')]();}else{logger['error'](_0x4823('0x31'),inspect(_0xee270c));return null;}}else{logger['error'](_0x4823('0x36'));return null;}}catch(_0x977146){logger[_0x4823('0xc')](_0x977146['stack']);return null;}});if(_0x12afe9[_0x4823('0x37')]){logger[_0x4823('0x22')](util[_0x4823('0x21')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x511e23['arg_1'],_0x511e23[_0x4823('0x38')],_0x511e23[_0x4823('0x25')],_0x511e23[_0x4823('0x26')],_0x511e23[_0x4823('0x27')]));_0x1d07a3['traverseBFS'](_0x12afe9[_0x4823('0x37')]['id'],function(_0x19a7e3){try{_0x19a7e3=_0x2bb2c4[_0x4823('0x2a')](_0x19a7e3);logger['debug'](_0x4823('0x2b'),JSON['stringify'](_0x19a7e3,null,0x2));if(_0x19a7e3&&_0x2bb2c4[_0x19a7e3['agicommand']]){_0xee270c=_0x2bb2c4[_0x19a7e3['agicommand']](_0x19a7e3);if(_0xee270c){logger[_0x4823('0x39')](_0x4823('0x31'),inspect(_0xee270c));return _[_0x4823('0x3a')](_0xee270c['result'])?null:_0xee270c[_0x4823('0x34')][_0x4823('0x35')]();}else{logger['error']('response',inspect(_0xee270c));return null;}}else{logger[_0x4823('0xc')](_0x4823('0x36'));return null;}}catch(_0x4afb8d){logger[_0x4823('0xc')](_0x4afb8d[_0x4823('0xe')]);return null;}});}logger[_0x4823('0x22')](util[_0x4823('0x21')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x511e23[_0x4823('0x24')],_0x511e23[_0x4823('0x38')],_0x511e23[_0x4823('0x25')],_0x511e23[_0x4823('0x26')],_0x511e23[_0x4823('0x27')]));logger[_0x4823('0x22')](util['format'](_0x4823('0x3b'),_0x511e23['context'],_0x511e23[_0x4823('0x2f')],parseInt(_0x511e23[_0x4823('0x30')],0xa)+0x1));_0x511e23['continueAt'](_0x511e23[_0x4823('0x2e')],_0x511e23[_0x4823('0x2f')],parseInt(_0x511e23['priority'],0xa)+0x1);_0x511e23[_0x4823('0x3c')]();}function handleNotFound(_0x4678d0){logger[_0x4823('0xc')](util[_0x4823('0x21')](_0x4823('0x3d'),_0x4678d0[_0x4823('0x24')]));_0x4678d0['continueAt'](_0x4678d0['context'],_0x4678d0[_0x4823('0x2f')],parseInt(_0x4678d0['priority'],0xa)+0x1);_0x4678d0['close']();}function handleUnpublished(_0x1bda33){logger[_0x4823('0xc')](util['format'](_0x4823('0x3e'),_0x1bda33['arg_1']));_0x1bda33[_0x4823('0x3f')](_0x1bda33['context'],_0x1bda33['extension'],parseInt(_0x1bda33[_0x4823('0x30')],0xa)+0x1);_0x1bda33['close']();}module[_0x4823('0x40')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 9001164..11f1dd9 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 _0xcaa3=['trim','slice','emit','line','exports','util','stream','Transform','call','_localBuffer','prototype','_transform','\x0d\x0a\x0d\x0a','toString','_inBody','indexOf','substring','length'];(function(_0x250121,_0x385a7b){var _0x3ba01f=function(_0x2dc7e0){while(--_0x2dc7e0){_0x250121['push'](_0x250121['shift']());}};_0x3ba01f(++_0x385a7b);}(_0xcaa3,0xcb));var _0x3caa=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0xcaa3[_0x39d544];return _0x5a5ff2;};'use strict';var util=require(_0x3caa('0x0'));var Transform=require(_0x3caa('0x1'))[_0x3caa('0x2')];function AGIReply(_0x41093d){Transform[_0x3caa('0x3')](this,_0x41093d);this[_0x3caa('0x4')]='';this['_inBody']=![];}util['inherits'](AGIReply,Transform);AGIReply[_0x3caa('0x5')][_0x3caa('0x6')]=function(_0x2484a9,_0x44c37b,_0x171c56){var _0x54ba79='\x0a',_0x3b2a1a=['\x0a\x0a',_0x3caa('0x7')],_0x4450cb=-0x1,_0x45c12f=-0x1,_0x4c7b84='',_0x1f1661=0x0,_0x175d16='',_0x5cff82='';this[_0x3caa('0x4')]+=_0x2484a9[_0x3caa('0x8')]();_0x175d16=this[_0x3caa('0x4')];if(!this[_0x3caa('0x9')]){_0x1f1661=0x0;while(_0x3b2a1a[_0x1f1661]){while((_0x45c12f=_0x175d16[_0x3caa('0xa')](_0x3b2a1a[_0x1f1661]))!=-0x1){_0x4c7b84=_0x3b2a1a[_0x1f1661];_0x5cff82=_0x175d16[_0x3caa('0xb')](0x0,_0x45c12f);_0x175d16=_0x175d16[_0x3caa('0xb')](_0x45c12f+_0x4c7b84[_0x3caa('0xc')]);var _0x554ca4=_0x5cff82['split'](_0x54ba79),_0x5c5a23=0x0,_0x256f6e={},_0xe1df65='',_0x47da19='',_0x1ec89c=-0x1;while(_0x554ca4[_0x5c5a23]){_0x1ec89c=_0x554ca4[_0x5c5a23][_0x3caa('0xa')](':');if(_0x1ec89c!=-0x1){_0xe1df65=_0x554ca4[_0x5c5a23]['slice'](0x0,_0x1ec89c)[_0x3caa('0xd')]();_0x47da19=_0x554ca4[_0x5c5a23][_0x3caa('0xe')](_0x1ec89c+0x1)[_0x3caa('0xd')]();if(_0xe1df65['length']>0x0){_0x256f6e[_0xe1df65]=_0x47da19;}}else{}_0x5c5a23++;}this[_0x3caa('0xf')]('headers',_0x256f6e);this[_0x3caa('0x9')]=!![];}_0x1f1661++;}this[_0x3caa('0x4')]=_0x175d16;}else{while((_0x4450cb=_0x175d16['indexOf'](_0x54ba79))!=-0x1){_0x5cff82=_0x175d16[_0x3caa('0xb')](0x0,_0x4450cb);this[_0x3caa('0xf')](_0x3caa('0x10'),_0x5cff82);_0x175d16=_0x175d16['substring'](_0x4450cb+_0x54ba79[_0x3caa('0xc')]);}this[_0x3caa('0x4')]=_0x175d16;}_0x171c56();};module[_0x3caa('0x11')]=AGIReply; \ No newline at end of file +var _0x8b0c=['headers','substring','emit','line','exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','length','split','slice','trim'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x8b0c,0xec));var _0xc8b0=function(_0xc5f804,_0x2f3ea2){_0xc5f804=_0xc5f804-0x0;var _0x10412e=_0x8b0c[_0xc5f804];return _0x10412e;};'use strict';var util=require(_0xc8b0('0x0'));var Transform=require(_0xc8b0('0x1'))[_0xc8b0('0x2')];function AGIReply(_0x508c7d){Transform[_0xc8b0('0x3')](this,_0x508c7d);this[_0xc8b0('0x4')]='';this[_0xc8b0('0x5')]=![];}util[_0xc8b0('0x6')](AGIReply,Transform);AGIReply[_0xc8b0('0x7')][_0xc8b0('0x8')]=function(_0x2f0cea,_0x4f8ce5,_0x396e58){var _0x358de8='\x0a',_0x480e5e=['\x0a\x0a',_0xc8b0('0x9')],_0x2b4494=-0x1,_0x44a4b3=-0x1,_0x707783='',_0x562159=0x0,_0x311417='',_0x58ed3f='';this[_0xc8b0('0x4')]+=_0x2f0cea[_0xc8b0('0xa')]();_0x311417=this['_localBuffer'];if(!this['_inBody']){_0x562159=0x0;while(_0x480e5e[_0x562159]){while((_0x44a4b3=_0x311417[_0xc8b0('0xb')](_0x480e5e[_0x562159]))!=-0x1){_0x707783=_0x480e5e[_0x562159];_0x58ed3f=_0x311417['substring'](0x0,_0x44a4b3);_0x311417=_0x311417['substring'](_0x44a4b3+_0x707783[_0xc8b0('0xc')]);var _0x50cefc=_0x58ed3f[_0xc8b0('0xd')](_0x358de8),_0x5dde5f=0x0,_0x5116fc={},_0x3a295e='',_0x44a16e='',_0x2917cf=-0x1;while(_0x50cefc[_0x5dde5f]){_0x2917cf=_0x50cefc[_0x5dde5f]['indexOf'](':');if(_0x2917cf!=-0x1){_0x3a295e=_0x50cefc[_0x5dde5f][_0xc8b0('0xe')](0x0,_0x2917cf)['trim']();_0x44a16e=_0x50cefc[_0x5dde5f]['slice'](_0x2917cf+0x1)[_0xc8b0('0xf')]();if(_0x3a295e[_0xc8b0('0xc')]>0x0){_0x5116fc[_0x3a295e]=_0x44a16e;}}else{}_0x5dde5f++;}this['emit'](_0xc8b0('0x10'),_0x5116fc);this[_0xc8b0('0x5')]=!![];}_0x562159++;}this[_0xc8b0('0x4')]=_0x311417;}else{while((_0x2b4494=_0x311417[_0xc8b0('0xb')](_0x358de8))!=-0x1){_0x58ed3f=_0x311417[_0xc8b0('0x11')](0x0,_0x2b4494);this[_0xc8b0('0x12')](_0xc8b0('0x13'),_0x58ed3f);_0x311417=_0x311417['substring'](_0x2b4494+_0x358de8[_0xc8b0('0xc')]);}this['_localBuffer']=_0x311417;}_0x396e58();};module[_0xc8b0('0x14')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index bf2e98b..02c1555 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 _0xa4de=['message','catch','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','CloudProvider','email','getSquareProjectById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser','getContactByPhone','phone','getSoundById','ShowSound','save_name','ShowInterval','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','agentPause','PauseUser','agentUnpause','agentLogout','LogoutUser','lodash','client','http','request','then','error'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa4de,0x10d));var _0xea4d=function(_0x1c0d3a,_0x5917c1){_0x1c0d3a=_0x1c0d3a-0x0;var _0x115215=_0xa4de[_0x1c0d3a];return _0x115215;};'use strict';var _=require(_0xea4d('0x0'));var moment=require('moment');var jayson=require('jayson/promise');var client=jayson[_0xea4d('0x1')][_0xea4d('0x2')]({'port':0x2329});function request(_0xf1af92,_0x3ee016){return new Promise(function(_0x380244,_0x111a9e){return client[_0xea4d('0x3')](_0xf1af92,_0x3ee016)[_0xea4d('0x4')](function(_0x128f9b){if(_0x128f9b[_0xea4d('0x5')]){return _0x111a9e(_0x128f9b[_0xea4d('0x5')][_0xea4d('0x6')]);}else{return _0x380244(_0x128f9b['result']);}})[_0xea4d('0x7')](function(_0x4f98e8){return _0x111a9e(_0x4f98e8);});});}exports[_0xea4d('0x8')]=function(){return request(_0xea4d('0x9'),{'options':{'raw':![],'attributes':['id',_0xea4d('0xa'),_0xea4d('0xb')]}});};exports[_0xea4d('0xc')]=function(_0x42127b){return request(_0xea4d('0xd'),{'options':{'raw':![],'where':{'name':_0x42127b},'attributes':[_0xea4d('0xb')]}});};exports[_0xea4d('0xe')]=function(_0x422d32){return request(_0xea4d('0xf'),{'options':{'raw':![],'where':{'id':_0x422d32},'include':[{'model':_0xea4d('0x10'),'as':'Smtp','include':[{'model':_0xea4d('0x11'),'as':_0xea4d('0x11')}]}],'attributes':['id',_0xea4d('0xa'),_0xea4d('0x12')],'smtp':!![]}});};exports[_0xea4d('0x13')]=function(_0x4a0ade){return request(_0xea4d('0xd'),{'options':{'where':{'id':_0x4a0ade},'attributes':[_0xea4d('0xa')]}});};exports['getVoiceQueueById']=function(_0x597c50){return request(_0xea4d('0x14'),{'options':{'where':{'id':_0x597c50},'attributes':[_0xea4d('0xa')]}});};exports[_0xea4d('0x15')]=function(_0x3726c6){return request(_0xea4d('0x16'),{'options':{'where':{'id':_0x3726c6},'attributes':[_0xea4d('0xa')]}});};exports[_0xea4d('0x17')]=function(_0x540814){return request(_0xea4d('0x18'),{'options':{'where':{'id':_0x540814},'attributes':['dsn']}});};exports[_0xea4d('0x19')]=function(_0xe9925d){return request(_0xea4d('0x1a'),{'options':{'where':{'id':_0xe9925d},'attributes':[_0xea4d('0xa')]}});};exports[_0xea4d('0x1b')]=function(_0x5d2912){return request('GetContactByPhone',{'options':{'where':{'phone':_0x5d2912[_0xea4d('0x1c')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x2d13f4){return request('ShowTrunk',{'options':{'where':{'id':_0x2d13f4},'attributes':[_0xea4d('0xa')]}});};exports[_0xea4d('0x1d')]=function(_0x573170){return request(_0xea4d('0x1e'),{'options':{'where':{'id':_0x573170},'attributes':[_0xea4d('0x1f')]}});};exports['getIntervalById']=function(_0x5c3d72){return request(_0xea4d('0x20'),{'options':{'raw':![],'where':{'id':_0x5c3d72},'include':[{'model':'Interval','as':'Intervals'}]}});};exports[_0xea4d('0x21')]=function(_0x3c686d){return request(_0xea4d('0x22'),{'options':{'where':{'id':_0x3c686d},'attributes':['id','name']}});};exports['createSmsMessage']=function(_0x110768){return request(_0xea4d('0x23'),{'body':_0x110768});};exports[_0xea4d('0x24')]=function(_0x53f919){return request(_0xea4d('0x25'),{'body':_0x53f919});};exports[_0xea4d('0x26')]=function(_0xc0b75b){return request(_0xea4d('0x27'),{'body':_[_0xea4d('0x28')](_0xc0b75b,{'project_name':_0xc0b75b['arg_1'],'prev_project_name':_0xc0b75b['arg_2']||'','is_subproject':_0xc0b75b[_0xea4d('0x29')]?!![]:![],'leaveAt':moment()['format'](_0xea4d('0x2a'))})});};exports['createSquareRecording']=function(_0xe01672){return request(_0xea4d('0x2b'),{'body':_0xe01672});};exports[_0xea4d('0x2c')]=function(_0x4cbbd2){return request('CreateSquareMessage',{'body':_0x4cbbd2});};exports['createCmContact']=function(_0x540b0c){return request(_0xea4d('0x2d'),{'options':{'raw':![],'where':{'phone':_0x540b0c[_0xea4d('0x1c')],'ListId':_0x540b0c[_0xea4d('0x2e')]}}})[_0xea4d('0x4')](function(_0x2c75f7){if(_0x2c75f7){return _0x2c75f7;}return request(_0xea4d('0x2f'),{'body':_0x540b0c});});};exports[_0xea4d('0x30')]=function(_0x563706){return request(_0xea4d('0x31'),{'options':{'where':{'id':_0x563706},'attributes':[_0xea4d('0xa')]}});};exports['agentLogin']=function(_0x4ad958,_0x289bba){return request('LoginUser',{'body':{'interface':_0x289bba},'options':{'where':_0x4ad958}});};exports[_0xea4d('0x32')]=function(_0x1285ce,_0x4db0e3,_0x5a0127){return request(_0xea4d('0x33'),{'body':{'type':_0x4db0e3,'uniqueid':_0x5a0127},'options':{'where':_0x1285ce}});};exports[_0xea4d('0x34')]=function(_0x745d44){return request('UnpauseUser',{'body':{},'options':{'where':_0x745d44}});};exports[_0xea4d('0x35')]=function(_0x31230b){return request(_0xea4d('0x36'),{'body':{},'options':{'where':_0x31230b}});}; \ No newline at end of file +var _0x0834=['CreateSquareReport','merge','arg_2','format','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','UnpauseUser','agentLogout','LogoutUser','jayson/promise','client','then','error','result','catch','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','CloudProvider','getSquareProjectById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','GetContactByPhone','getTrunkById','ShowTrunk','getSoundById','save_name','ShowInterval','Interval','Intervals','createSmsMessage','createSquareDetailsReport'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0x0834,0x18e));var _0x4083=function(_0x53dccc,_0xad9fb1){_0x53dccc=_0x53dccc-0x0;var _0x17241e=_0x0834[_0x53dccc];return _0x17241e;};'use strict';var _=require('lodash');var moment=require('moment');var jayson=require(_0x4083('0x0'));var client=jayson[_0x4083('0x1')]['http']({'port':0x2329});function request(_0x491147,_0x5e1812){return new Promise(function(_0x14d004,_0x14b7c6){return client['request'](_0x491147,_0x5e1812)[_0x4083('0x2')](function(_0x32ea06){if(_0x32ea06['error']){return _0x14b7c6(_0x32ea06[_0x4083('0x3')]['message']);}else{return _0x14d004(_0x32ea06[_0x4083('0x4')]);}})[_0x4083('0x5')](function(_0x2c42bb){return _0x14b7c6(_0x2c42bb);});});}exports[_0x4083('0x6')]=function(){return request(_0x4083('0x7'),{'options':{'raw':![],'attributes':['id',_0x4083('0x8'),_0x4083('0x9')]}});};exports[_0x4083('0xa')]=function(_0x2a5093){return request(_0x4083('0xb'),{'options':{'raw':![],'where':{'name':_0x2a5093},'attributes':[_0x4083('0x9')]}});};exports[_0x4083('0xc')]=function(_0x1da687){return request(_0x4083('0xd'),{'options':{'raw':![],'where':{'id':_0x1da687},'include':[{'model':_0x4083('0xe'),'as':'Smtp','include':[{'model':'CloudProvider','as':_0x4083('0xf')}]}],'attributes':['id',_0x4083('0x8'),'email'],'smtp':!![]}});};exports[_0x4083('0x10')]=function(_0x136077){return request(_0x4083('0xb'),{'options':{'where':{'id':_0x136077},'attributes':['name']}});};exports['getVoiceQueueById']=function(_0xb5badb){return request(_0x4083('0x11'),{'options':{'where':{'id':_0xb5badb},'attributes':['name']}});};exports[_0x4083('0x12')]=function(_0x316e54){return request(_0x4083('0x13'),{'options':{'where':{'id':_0x316e54},'attributes':[_0x4083('0x8')]}});};exports[_0x4083('0x14')]=function(_0x4d59c7){return request(_0x4083('0x15'),{'options':{'where':{'id':_0x4d59c7},'attributes':[_0x4083('0x16')]}});};exports[_0x4083('0x17')]=function(_0x2658b0){return request('ShowUser',{'options':{'where':{'id':_0x2658b0},'attributes':['name']}});};exports['getContactByPhone']=function(_0xafda0c){return request(_0x4083('0x18'),{'options':{'where':{'phone':_0xafda0c['phone']},'attributes':['id']}});};exports[_0x4083('0x19')]=function(_0x4a16dc){return request(_0x4083('0x1a'),{'options':{'where':{'id':_0x4a16dc},'attributes':[_0x4083('0x8')]}});};exports[_0x4083('0x1b')]=function(_0xa18842){return request('ShowSound',{'options':{'where':{'id':_0xa18842},'attributes':[_0x4083('0x1c')]}});};exports['getIntervalById']=function(_0x3d8045){return request(_0x4083('0x1d'),{'options':{'raw':![],'where':{'id':_0x3d8045},'include':[{'model':_0x4083('0x1e'),'as':_0x4083('0x1f')}]}});};exports['getSmsAccountById']=function(_0x328efe){return request('ShowSmsAccount',{'options':{'where':{'id':_0x328efe},'attributes':['id',_0x4083('0x8')]}});};exports[_0x4083('0x20')]=function(_0x577a80){return request('CreateSmsMessage',{'body':_0x577a80});};exports[_0x4083('0x21')]=function(_0x5b1f8a){return request('CreateSquareDetailsReport',{'body':_0x5b1f8a});};exports['createSquareReport']=function(_0x14e274){return request(_0x4083('0x22'),{'body':_[_0x4083('0x23')](_0x14e274,{'project_name':_0x14e274['arg_1'],'prev_project_name':_0x14e274[_0x4083('0x24')]||'','is_subproject':_0x14e274[_0x4083('0x24')]?!![]:![],'leaveAt':moment()[_0x4083('0x25')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x4083('0x26')]=function(_0x323736){return request('CreateSquareRecording',{'body':_0x323736});};exports[_0x4083('0x27')]=function(_0x467c01){return request(_0x4083('0x28'),{'body':_0x467c01});};exports[_0x4083('0x29')]=function(_0xdf4d9e){return request(_0x4083('0x2a'),{'options':{'raw':![],'where':{'phone':_0xdf4d9e[_0x4083('0x2b')],'ListId':_0xdf4d9e[_0x4083('0x2c')]}}})[_0x4083('0x2')](function(_0x5dc9c6){if(_0x5dc9c6){return _0x5dc9c6;}return request('CreateCmContact',{'body':_0xdf4d9e});});};exports[_0x4083('0x2d')]=function(_0x189e4d){return request(_0x4083('0x2e'),{'options':{'where':{'id':_0x189e4d},'attributes':[_0x4083('0x8')]}});};exports[_0x4083('0x2f')]=function(_0x191f79,_0x55832a){return request(_0x4083('0x30'),{'body':{'interface':_0x55832a},'options':{'where':_0x191f79}});};exports[_0x4083('0x31')]=function(_0x2a1eda,_0x414ac9,_0x16fa65){return request(_0x4083('0x32'),{'body':{'type':_0x414ac9,'uniqueid':_0x16fa65},'options':{'where':_0x2a1eda}});};exports['agentUnpause']=function(_0x36feac){return request(_0x4083('0x33'),{'body':{},'options':{'where':_0x36feac}});};exports[_0x4083('0x34')]=function(_0x452bae){return request(_0x4083('0x35'),{'body':{},'options':{'where':_0x452bae}});}; \ 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 d8dcfcd..676855e 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 _0x5d95=['./lex','./polly'];(function(_0x1559a5,_0x41924e){var _0x17a783=function(_0x152c63){while(--_0x152c63){_0x1559a5['push'](_0x1559a5['shift']());}};_0x17a783(++_0x41924e);}(_0x5d95,0x77));var _0x55d9=function(_0x307970,_0x37320d){_0x307970=_0x307970-0x0;var _0x50aa60=_0x5d95[_0x307970];return _0x50aa60;};var polly=require(_0x55d9('0x0'));var lex=require(_0x55d9('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xe574=['./polly','exports'];(function(_0x5288e2,_0x65ca08){var _0x9088d9=function(_0x1ab7ab){while(--_0x1ab7ab){_0x5288e2['push'](_0x5288e2['shift']());}};_0x9088d9(++_0x65ca08);}(_0xe574,0x100));var _0x4e57=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xe574[_0x42cae2];return _0x5f256f;};var polly=require(_0x4e57('0x0'));var lex=require('./lex');module[_0x4e57('0x1')]={'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 1ce2420..119be18 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 _0x5b02=['exports','./lib/api'];(function(_0x5ebe58,_0xbae076){var _0x2b952e=function(_0x5e86b1){while(--_0x5e86b1){_0x5ebe58['push'](_0x5ebe58['shift']());}};_0x2b952e(++_0xbae076);}(_0x5b02,0xe9));var _0x25b0=function(_0x1a2300,_0x56a81f){_0x1a2300=_0x1a2300-0x0;var _0x14ae51=_0x5b02[_0x1a2300];return _0x14ae51;};'use strict';var lex=require(_0x25b0('0x0'));module[_0x25b0('0x1')]=function(_0x428458,_0x1c3295,_0x4ef71c,_0x4cb227,_0x2b5f2d,_0x53493e){return lex(_0x428458,_0x1c3295,_0x4ef71c,_0x4cb227,_0x2b5f2d,_0x53493e);}; \ No newline at end of file +var _0x5c00=['./lib/api','exports'];(function(_0x548c1d,_0x4e2101){var _0x52d761=function(_0xd7d080){while(--_0xd7d080){_0x548c1d['push'](_0x548c1d['shift']());}};_0x52d761(++_0x4e2101);}(_0x5c00,0x17e));var _0x05c0=function(_0x2a87fc,_0x30a039){_0x2a87fc=_0x2a87fc-0x0;var _0x32d9f5=_0x5c00[_0x2a87fc];return _0x32d9f5;};'use strict';var lex=require(_0x05c0('0x0'));module[_0x05c0('0x1')]=function(_0x1c3b79,_0x4e54ec,_0x1e76da,_0x5859bc,_0x41c4b4,_0x25c3a9){return lex(_0x1c3b79,_0x4e54ec,_0x1e76da,_0x5859bc,_0x41c4b4,_0x25c3a9);}; \ 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 29e94ce..31582a0 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(_0x5f3303,_0x43f316){var _0x52d975=function(_0x4e36c7){while(--_0x4e36c7){_0x5f3303['push'](_0x5f3303['shift']());}};_0x52d975(++_0x43f316);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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(_0x44f719,_0x273c9e){var _0x324299=function(_0x281e5c){while(--_0x281e5c){_0x44f719['push'](_0x44f719['shift']());}};_0x324299(++_0x273c9e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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 7d92c30..830f99d 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 _0x6b18=['./lib/api','exports'];(function(_0x55c4af,_0x1693ca){var _0x422974=function(_0x81714b){while(--_0x81714b){_0x55c4af['push'](_0x55c4af['shift']());}};_0x422974(++_0x1693ca);}(_0x6b18,0x192));var _0x86b1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6b18[_0x20a584];return _0x4b41a8;};'use strict';var polly=require(_0x86b1('0x0'));module[_0x86b1('0x1')]=function(_0x2a3e2d,_0x25fafc,_0xd63a84,_0x4109ab,_0x17602b,_0x1f7e9e,_0x347a90){return polly(_0x2a3e2d,_0x25fafc,_0xd63a84,_0x4109ab,_0x17602b,_0x1f7e9e,_0x347a90);}; \ No newline at end of file +var _0x25cf=['exports'];(function(_0x425e60,_0x14e7b6){var _0x356e1a=function(_0x37650c){while(--_0x37650c){_0x425e60['push'](_0x425e60['shift']());}};_0x356e1a(++_0x14e7b6);}(_0x25cf,0x148));var _0xf25c=function(_0x72bc68,_0x394332){_0x72bc68=_0x72bc68-0x0;var _0x1b61d7=_0x25cf[_0x72bc68];return _0x1b61d7;};'use strict';var polly=require('./lib/api');module[_0xf25c('0x0')]=function(_0x9a0663,_0x1addcd,_0x331fa7,_0x1acd26,_0x573e57,_0x3905ad,_0x545eb8){return polly(_0x9a0663,_0x1addcd,_0x331fa7,_0x1acd26,_0x573e57,_0x3905ad,_0x545eb8);}; \ 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 e7407a5..4679393 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 _0x7c06=['synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','path','bluebird','randomstring','aws-sdk'];(function(_0x3df1dd,_0x1e086e){var _0x36a2d8=function(_0x4de45e){while(--_0x4de45e){_0x3df1dd['push'](_0x3df1dd['shift']());}};_0x36a2d8(++_0x1e086e);}(_0x7c06,0x172));var _0x67c0=function(_0x36f271,_0x2bbe64){_0x36f271=_0x36f271-0x0;var _0x2de58b=_0x7c06[_0x36f271];return _0x2de58b;};'use strict';var fs=require('fs');var path=require(_0x67c0('0x0'));var BPromise=require(_0x67c0('0x1'));var rs=require(_0x67c0('0x2'));var AWS=require(_0x67c0('0x3'));function pollyResult(_0x142c27,_0x533d27,_0x5ee221){return new BPromise(function(_0x491ca8,_0x37dc01){_0x142c27[_0x67c0('0x4')](_0x533d27,function(_0x2cd502,_0x5becc2){if(_0x2cd502){_0x37dc01(_0x2cd502);}else if(_0x5becc2){if(_0x5becc2[_0x67c0('0x5')]instanceof Buffer){fs['writeFile'](_0x5ee221,_0x5becc2['AudioStream'],function(_0x227848){if(_0x227848){_0x37dc01(_0x227848);}else{_0x491ca8();}});}else{_0x37dc01(new Error(_0x67c0('0x6')));}}else{_0x37dc01(new Error(_0x67c0('0x7')));}});});}module[_0x67c0('0x8')]=function(_0x2b4630,_0x3af207,_0x1235c6,_0x8e06ff,_0x58e67c,_0x2d52ce,_0x451316){var _0x38ec7d=new AWS[(_0x67c0('0x9'))]({'accessKeyId':_0x2b4630,'secretAccessKey':_0x3af207,'region':_0x1235c6});var _0xe1049f={'Text':_0x58e67c,'TextType':_0x2d52ce||_0x67c0('0xa'),'OutputFormat':'mp3','VoiceId':_0x8e06ff};return pollyResult(_0x38ec7d,_0xe1049f,_0x451316);}; \ No newline at end of file +var _0x71f9=['text','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x71f9,0x6e));var _0x971f=function(_0x576ad5,_0x10ac33){_0x576ad5=_0x576ad5-0x0;var _0x52d4c5=_0x71f9[_0x576ad5];return _0x52d4c5;};'use strict';var fs=require('fs');var path=require(_0x971f('0x0'));var BPromise=require(_0x971f('0x1'));var rs=require(_0x971f('0x2'));var AWS=require(_0x971f('0x3'));function pollyResult(_0x56ebdb,_0x1ca39d,_0x319103){return new BPromise(function(_0x149255,_0x9dd8ef){_0x56ebdb[_0x971f('0x4')](_0x1ca39d,function(_0x485617,_0x321f41){if(_0x485617){_0x9dd8ef(_0x485617);}else if(_0x321f41){if(_0x321f41['AudioStream']instanceof Buffer){fs[_0x971f('0x5')](_0x319103,_0x321f41['AudioStream'],function(_0x36c65f){if(_0x36c65f){_0x9dd8ef(_0x36c65f);}else{_0x149255();}});}else{_0x9dd8ef(new Error(_0x971f('0x6')));}}else{_0x9dd8ef(new Error(_0x971f('0x7')));}});});}module[_0x971f('0x8')]=function(_0xa64009,_0x116711,_0x1079c5,_0x39018d,_0x386916,_0x217806,_0x43ca91){var _0x20e5c2=new AWS[(_0x971f('0x9'))]({'accessKeyId':_0xa64009,'secretAccessKey':_0x116711,'region':_0x1079c5});var _0x2054dc={'Text':_0x386916,'TextType':_0x217806||_0x971f('0xa'),'OutputFormat':_0x971f('0xb'),'VoiceId':_0x39018d};return pollyResult(_0x20e5c2,_0x2054dc,_0x43ca91);}; \ 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 a712c6c..17797bb 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 _0x3bfa=['exports','./lib/api'];(function(_0x10ee7c,_0xb6faad){var _0x213ad0=function(_0x1e9c8d){while(--_0x1e9c8d){_0x10ee7c['push'](_0x10ee7c['shift']());}};_0x213ad0(++_0xb6faad);}(_0x3bfa,0x1e3));var _0xa3bf=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x3bfa[_0x160c73];return _0xd9302;};'use strict';var asr=require(_0xa3bf('0x0'));module[_0xa3bf('0x1')]=function(_0x31c281,_0x886fff,_0x5a06cf,_0x2bc919){return asr(_0x31c281,_0x886fff,_0x5a06cf);}; \ No newline at end of file +'use strict';var asr=require('./lib/api');module['exports']=function(_0x216635,_0x42e4ea,_0x40d112,_0x3a20c0){return asr(_0x216635,_0x42e4ea,_0x40d112);}; \ 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 1be84db..6e0ca36 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(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x78f0,0x15d));var _0x078f=function(_0x41b376,_0xeca178){_0x41b376=_0x41b376-0x0;var _0xb510a8=_0x78f0[_0x41b376];return _0xb510a8;};'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 _0x644a=['8000','url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16'];(function(_0xaca276,_0x6f6f35){var _0x54a633=function(_0x2b0772){while(--_0x2b0772){_0xaca276['push'](_0xaca276['shift']());}};_0x54a633(++_0x6f6f35);}(_0x644a,0xfd));var _0xa644=function(_0x4ec42,_0x36177b){_0x4ec42=_0x4ec42-0x0;var _0x385e11=_0x644a[_0x4ec42];return _0x385e11;};'use strict';var url=require(_0xa644('0x0'));var BPromise=require(_0xa644('0x1'));var fs=require('fs');var host=_0xa644('0x2');module[_0xa644('0x3')]=function(_0x3a3218,_0x48801b,_0x1423b7){return new BPromise(function(_0x704008,_0x526de6){var _0x4f6ed9;if(typeof _0x3a3218!==_0xa644('0x4')||_0x3a3218[_0xa644('0x5')]===0x0){return _0x526de6(_0xa644('0x6'));}if(typeof _0x48801b!=='string'||_0x48801b[_0xa644('0x5')]===0x0){return _0x526de6(_0xa644('0x7'));}if(typeof _0x1423b7!=='undefined'&&(typeof _0x1423b7!==_0xa644('0x4')||_0x1423b7[_0xa644('0x5')]===0x0)){return _0x526de6('lang\x20should\x20be\x20a\x20string');}try{_0x4f6ed9=fs['readFileSync'](_0x3a3218)[_0xa644('0x8')](_0xa644('0x9'));}catch(_0x55415d){return _0x526de6(_0x55415d);}return _0x704008({'method':_0xa644('0xa'),'uri':host+_0xa644('0xb')+_0x48801b,'body':{'config':{'encoding':_0xa644('0xc'),'sampleRateHertz':_0xa644('0xd'),'languageCode':_0x1423b7},'audio':{'content':_0x4f6ed9}},'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 da28144..bced0f9 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 _0x8483=['exports','./asr'];(function(_0x490be3,_0xf0fca3){var _0x3f5140=function(_0x15fa80){while(--_0x15fa80){_0x490be3['push'](_0x490be3['shift']());}};_0x3f5140(++_0xf0fca3);}(_0x8483,0x1dd));var _0x3848=function(_0x13623f,_0x6042a3){_0x13623f=_0x13623f-0x0;var _0x4c3667=_0x8483[_0x13623f];return _0x4c3667;};var asr=require(_0x3848('0x0'));module[_0x3848('0x1')]={'asr':asr}; \ No newline at end of file +var _0xbe8c=['exports','./asr'];(function(_0x25b1f8,_0x5a41af){var _0x2e8005=function(_0x1e2836){while(--_0x1e2836){_0x25b1f8['push'](_0x25b1f8['shift']());}};_0x2e8005(++_0x5a41af);}(_0xbe8c,0xeb));var _0xcbe8=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xbe8c[_0xfae23b];return _0x200640;};var asr=require(_0xcbe8('0x0'));module[_0xcbe8('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 462cc9f..6e2b065 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 _0x623e=['error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','pipe','end','protocol','https:','host','get','data','wav','resolve','tmp','generate','writeFileSync','base64','chmodSync','777','split','readFileSync','toString','?key=','ssml','input','voice','MP3','text:synthesize','POST','.mp3','from','writeFile','then','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','googleASR','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','catch','[%s]\x20%s:%s','name','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','code','metadata','endConversation','isFallbackIntent','SessionsClient','detectIntent','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','awsPolly','polly','awsLex','lex','ispeechTTS','format','.wav','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','apiai-promise','https','path','randomstring','google-tts-api','url','parse','util','./sestek','./tilde','agi','https://api.ispeech.org/api/rest','WHAT_EVER'];(function(_0x477086,_0x3ac0f9){var _0x519aab=function(_0x4406d5){while(--_0x4406d5){_0x477086['push'](_0x477086['shift']());}};_0x519aab(++_0x3ac0f9);}(_0x623e,0x16d));var _0xe623=function(_0x3c416c,_0x1bc80b){_0x3c416c=_0x3c416c-0x0;var _0x4d34a6=_0x623e[_0x3c416c];return _0x4d34a6;};'use strict';var apiai=require(_0xe623('0x0'));var BPromise=require('bluebird');var dialogflow=require('dialogflow');var fs=require('fs');var http=require('http');var https=require(_0xe623('0x1'));var md5=require('md5');var path=require(_0xe623('0x2'));var querystring=require('querystring');var rp=require('request-promise');var rs=require(_0xe623('0x3'));var sox=require('sox');var tts=require(_0xe623('0x4'));var urlParse=require(_0xe623('0x5'))[_0xe623('0x6')];var util=require(_0xe623('0x7'));var aws=require('./aws');var google=require('./google');var sestek=require(_0xe623('0x8'));var tilde=require(_0xe623('0x9'));var logger=require('../../../config/logger')(_0xe623('0xa'));var ISPEECH_API=_0xe623('0xb');function downloadFile(_0x1b0e40,_0x4d527c){return new BPromise(function(_0x5eaa56,_0x418ac1){var _0xaf9e3f=urlParse(_0x1b0e40);var _0x57b1ee=_0xaf9e3f['protocol']==='https:'?https:http;var _0x49bb7b={'host':_0xaf9e3f['host'],'path':_0xaf9e3f['path'],'headers':{'user-agent':_0xe623('0xc')}};_0x57b1ee['get'](_0x49bb7b,function(_0x105527){if(_0x105527['statusCode']!==0xc8){logger[_0xe623('0xd')](_0xe623('0xe')+_0x1b0e40+_0xe623('0xf')+_0x105527[_0xe623('0x10')]+'\x20('+_0x105527[_0xe623('0x11')]+')');_0x418ac1(new Error(_0xe623('0xe')+_0x1b0e40+'\x20failed,\x20status\x20code\x20=\x20'+_0x105527[_0xe623('0x10')]+'\x20('+_0x105527[_0xe623('0x11')]+')'));return;}var _0x4ed1ad=fs[_0xe623('0x12')](_0x4d527c);_0x4ed1ad['on'](_0xe623('0x13'),function(){logger[_0xe623('0x14')](_0xe623('0x15'));_0x4ed1ad[_0xe623('0x16')](_0x5eaa56);});_0x4ed1ad['on'](_0xe623('0xd'),function(_0x492a39){fs[_0xe623('0x17')](_0x4d527c);logger[_0xe623('0xd')]('download\x20error',_0x492a39);_0x418ac1(_0x492a39);});_0x105527[_0xe623('0x18')](_0x4ed1ad);})['on'](_0xe623('0xd'),function(_0x3ecea4){logger[_0xe623('0xd')](_0x3ecea4);_0x418ac1(_0x3ecea4);})[_0xe623('0x19')]();});}function uploadFile(_0x298364){return new BPromise(function(_0x1fc58a,_0x36bae8){var _0x17857e=urlParse(_0x298364);var _0x58b8ea=_0x17857e[_0xe623('0x1a')]===_0xe623('0x1b')?https:http;var _0x3ce7ec={'host':_0x17857e[_0xe623('0x1c')],'path':_0x17857e[_0xe623('0x2')],'headers':{'user-agent':_0xe623('0xc')}};_0x58b8ea[_0xe623('0x1d')](_0x3ce7ec,function(_0x9715ef){if(_0x9715ef[_0xe623('0x10')]!==0xc8){_0x36bae8(new Error(_0xe623('0xe')+_0x298364+_0xe623('0xf')+_0x9715ef['statusCode']+'\x20('+_0x9715ef[_0xe623('0x11')]+')'));return;}var _0xb39d8c='';_0x9715ef['on'](_0xe623('0x1e'),function(_0x1bf05c){_0xb39d8c+=_0x1bf05c;});_0x9715ef['on'](_0xe623('0x19'),function(){_0x1fc58a(_0xb39d8c);});})['on'](_0xe623('0xd'),function(_0xcb1776){_0x36bae8(_0xcb1776);})['end']();});}function convertFile(_0x3ef133,_0x3e377d){return new BPromise(function(_0x1ca8f9,_0x34a706){var _0x43fc24=sox['transcode'](_0x3ef133,_0x3e377d,{'sampleRate':0x1f40,'format':_0xe623('0x1f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x43fc24['on']('error',function(_0x4e68a6){logger[_0xe623('0xd')]('error\x20convert',_0x4e68a6);_0x34a706(_0x4e68a6);});_0x43fc24['on'](_0xe623('0x19'),function(){logger[_0xe623('0x14')]('finish\x20to\x20convert');_0x1ca8f9();});_0x43fc24['start']();});}function base64Decode(_0x401409,_0x55c87f){var _0x2ac03c=path[_0xe623('0x20')](__dirname,_0xe623('0x21'),rs[_0xe623('0x22')](0x4)+'.wav');fs[_0xe623('0x23')](_0x2ac03c,_0x401409,_0xe623('0x24'));return convertFile(_0x2ac03c,_0x55c87f)['then'](function(){try{fs[_0xe623('0x17')](_0x2ac03c);fs[_0xe623('0x25')](_0x55c87f,_0xe623('0x26'));}catch(_0x41d22c){logger[_0xe623('0xd')](_0x41d22c);}return _0x55c87f[_0xe623('0x27')]('.')[0x0];});}function base64Encode(_0x5a5c0d){var _0x55c5b8=fs[_0xe623('0x28')](_0x5a5c0d);return new Buffer(_0x55c5b8)[_0xe623('0x29')](_0xe623('0x24'));}exports['googleCloudTTS']=function(_0x4d005b,_0x18bcf7,_0x20f35d,_0x141ada,_0x52424e,_0x9c72ee){var _0x50be3d,_0x857747;var _0x55050a='https://texttospeech.googleapis.com/v1/';var _0x5a4fd1=_0xe623('0x2a')+_0x4d005b;var _0x2c9c1b={};if(_0x18bcf7===_0xe623('0x2b')){_0x2c9c1b[_0xe623('0x2c')]={'ssml':_0x20f35d};}else{_0x2c9c1b['input']={'text':_0x20f35d};};_0x2c9c1b[_0xe623('0x2d')]={'languageCode':_0x141ada,'ssmlGender':_0x52424e};_0x2c9c1b['audioConfig']={'audioEncoding':_0xe623('0x2e'),'sampleRateHertz':0x1f40};var _0x26d27b={'url':_0x55050a+_0xe623('0x2f')+_0x5a4fd1,'method':_0xe623('0x30'),'json':!![],'body':_0x2c9c1b};return rp(_0x26d27b)['then'](function(_0x196f1a){return new BPromise(function(_0x4b139e,_0x490469){_0x50be3d=path[_0xe623('0x20')](__dirname,'tmp',rs['generate'](0x4)+_0xe623('0x31'));var _0x44cc86=Buffer[_0xe623('0x32')](_0x196f1a['audioContent'],'base64');return fs[_0xe623('0x33')](_0x50be3d,_0x44cc86,function(_0x462346){_0x490469(_0x462346);},function(_0x259fb1){fs[_0xe623('0x25')](_0x50be3d,_0xe623('0x26'));_0x4b139e(_0x259fb1);});});})[_0xe623('0x34')](function(_0xf0db99){_0x857747=path[_0xe623('0x20')](__dirname,_0xe623('0x21'),rs['generate'](0x4)+'.wav');return convertFile(_0x50be3d,_0x857747);})[_0xe623('0x34')](function(){try{fs['unlink'](_0x50be3d);fs[_0xe623('0x25')](_0x857747,_0xe623('0x26'));}catch(_0x341260){logger[_0xe623('0xd')](_0x341260);}logger[_0xe623('0x14')](_0xe623('0x35'),_0x857747[_0xe623('0x27')]('.')[0x0]);return _0x857747[_0xe623('0x27')]('.')[0x0];});};exports['googleTTS']=function(_0x27ccdd,_0x3fe22a){var _0x27831b=_0xe623('0x36');var _0x2a2d3c,_0x4dbf34;var _0x576320;var _0x4d3299={'encoding':'utf8','method':_0xe623('0x30'),'timeout':0x2710,'url':_0x27831b,'headers':{'Content-Type':_0xe623('0x37')},'body':_0xe623('0x38')+encodeURIComponent(JSON[_0xe623('0x39')]([[[_0xe623('0x3a'),JSON['stringify']([_0x27ccdd,_0x3fe22a||'en',![],_0xe623('0x3b')]),null,'generic']]]))};return rp(_0x4d3299)['then'](function(_0x2c1096){try{_0x576320=eval(_0x2c1096['slice'](0x5))[0x0][0x2];}catch(_0x5a9c4a){throw new Error(_0xe623('0x3c')+_0x2c1096[_0xe623('0x1e')]);}if(!_0x576320){if(_0x27ccdd[_0xe623('0x3d')]>0xc8){throw new Error(_0xe623('0x3e'));}else{throw new Error(_0xe623('0x3f')+_0x3fe22a+_0xe623('0x40'));}}try{_0x576320=eval(_0x576320)[0x0];}catch(_0x1b0641){throw new Error('parse\x20response\x20failed:\x0a'+res['data']);}const _0x219a7f=_0x576320;_0x2a2d3c=path[_0xe623('0x20')](__dirname,_0xe623('0x21'),rs[_0xe623('0x22')](0x4)+_0xe623('0x31'));fs[_0xe623('0x23')](_0x2a2d3c,_0x576320,{'encoding':_0xe623('0x24')});_0x4dbf34=path[_0xe623('0x20')](__dirname,'tmp',rs[_0xe623('0x22')](0x4)+'.wav');return convertFile(_0x2a2d3c,_0x4dbf34);})[_0xe623('0x34')](function(){try{fs[_0xe623('0x17')](_0x2a2d3c);fs[_0xe623('0x25')](_0x4dbf34,_0xe623('0x26'));}catch(_0x40eb34){logger[_0xe623('0xd')](_0x40eb34);}logger['info']('goggleTTS\x20path',_0x4dbf34['split']('.')[0x0]);return _0x4dbf34[_0xe623('0x27')]('.')[0x0];});};exports[_0xe623('0x41')]=function(_0x14613d,_0x12e656,_0x50ae5){return google['asr'](_0x14613d,_0x12e656,_0x50ae5)[_0xe623('0x34')](function(_0x15fffd){logger['info'](_0x15fffd[_0xe623('0x42')]);return rp(_0x15fffd);})[_0xe623('0x34')](function(_0x17daa3){var _0x5ed88e='';var _0x41f33c=0x0;try{fs[_0xe623('0x17')](_0x14613d);}catch(_0x3e154d){logger[_0xe623('0xd')](_0x3e154d);}if(_0x17daa3&&_0x17daa3[_0xe623('0x43')]){_0x5ed88e=_0x17daa3[_0xe623('0x43')][_0xe623('0x44')](function(_0x3e4e03){return _0x3e4e03&&_0x3e4e03[_0xe623('0x45')][0x0]&&_0x3e4e03[_0xe623('0x45')][0x0]['transcript']?_0x3e4e03[_0xe623('0x45')][0x0][_0xe623('0x46')]:'';})[_0xe623('0x47')]('\x0a');_0x41f33c=_0x17daa3[_0xe623('0x43')][_0xe623('0x44')](function(_0x5f0c87){return _0x5f0c87&&_0x5f0c87[_0xe623('0x45')][0x0]&&_0x5f0c87['alternatives'][0x0]['confidence']?_0x5f0c87[_0xe623('0x45')][0x0][_0xe623('0x48')]:0x0;})['join']('\x0a');}logger[_0xe623('0x14')](_0xe623('0x49'),_0x5ed88e);logger[_0xe623('0x14')]('googleASR\x20confidence',_0x41f33c);return{'transcript':_0x5ed88e,'confidence':_0x41f33c};})[_0xe623('0x4a')](function(_0x2dfb94){logger['error'](_0xe623('0x4b'),_0x2dfb94[_0xe623('0x10')],_0x2dfb94[_0xe623('0x4c')],_0x2dfb94['message']);});};exports['googleDialogflow']=function(_0x906855,_0x2d5d0c,_0x4664ed,_0x25dcda){var _0x1e429c=apiai(_0x2d5d0c,{'language':_0x25dcda||'en'});return _0x1e429c[_0xe623('0x4d')](_0x4664ed,{'sessionId':md5(_0x906855)})['then'](function(_0xc87bfe){logger[_0xe623('0x14')](JSON['stringify'](_0xc87bfe));return{'source':_0xc87bfe[_0xe623('0x4e')][_0xe623('0x4f')],'resolvedQuery':_0xc87bfe[_0xe623('0x4e')][_0xe623('0x50')],'action':_0xc87bfe[_0xe623('0x4e')][_0xe623('0x51')],'actionIncomplete':_0xc87bfe['result'][_0xe623('0x52')],'speech':_0xc87bfe['result'][_0xe623('0x53')][_0xe623('0x54')],'score':_0xc87bfe['result'][_0xe623('0x55')],'statusCode':_0xc87bfe['status'][_0xe623('0x56')],'endConversation':_0xc87bfe[_0xe623('0x4e')][_0xe623('0x57')][_0xe623('0x58')]||![],'isFallbackIntent':_0xc87bfe[_0xe623('0x4e')]['metadata'][_0xe623('0x59')]};});};exports['googleDialogflowV2']=function(_0x41d478,_0x3d0539,_0x338162,_0x3010bd,_0x3eefb3,_0x3e0195){var _0x3cabfc=_0x3010bd['replace'](/\\n/g,'\x0a');var _0x517f59={'credentials':{'private_key':_0x3cabfc,'client_email':_0x338162}};var _0x7e0c78=new dialogflow[(_0xe623('0x5a'))](_0x517f59);var _0x32305e=_0x7e0c78['sessionPath'](_0x3d0539,md5(_0x41d478));var _0x9c91d6={'session':_0x32305e,'queryInput':{'text':{'text':_0x3eefb3,'languageCode':_0x3e0195}}};return _0x7e0c78[_0xe623('0x5b')](_0x9c91d6)['then'](function(_0x392bcb){if(_0x392bcb&&_0x392bcb[_0xe623('0x3d')]){logger['info']('Dialogflow\x20V2\x20response:',JSON[_0xe623('0x39')](_0x392bcb));var _0x3434ef=_0x392bcb[0x0];if(_0x3434ef){var _0x12fdd9={'action':_0x3434ef[_0xe623('0x5c')][_0xe623('0x51')],'allRequiredParamsPresent':_0x3434ef[_0xe623('0x5c')][_0xe623('0x5d')],'endConversation':_0x3434ef[_0xe623('0x5c')][_0xe623('0x5e')]&&_0x3434ef[_0xe623('0x5c')][_0xe623('0x5e')][_0xe623('0x5f')]?_0x3434ef[_0xe623('0x5c')]['diagnosticInfo'][_0xe623('0x5f')][_0xe623('0x60')]['boolValue']:![],'fulfillmentText':_0x3434ef[_0xe623('0x5c')][_0xe623('0x61')],'intentName':_0x3434ef['queryResult'][_0xe623('0x62')][_0xe623('0x4c')],'intentDisplayName':_0x3434ef[_0xe623('0x5c')]['intent'][_0xe623('0x63')],'isFallbackIntent':_0x3434ef[_0xe623('0x5c')][_0xe623('0x62')][_0xe623('0x64')],'languageCode':_0x3434ef[_0xe623('0x5c')][_0xe623('0x65')],'queryText':_0x3434ef[_0xe623('0x5c')][_0xe623('0x66')],'responseId':_0x3434ef[_0xe623('0x67')],'score':_0x3434ef[_0xe623('0x5c')][_0xe623('0x68')],'speech':_0x3434ef['queryResult'][_0xe623('0x61')],'providerResponse':JSON[_0xe623('0x39')](_0x392bcb)};return _0x12fdd9;}}});};exports[_0xe623('0x69')]=function(_0x1e759e,_0x4ccdd5,_0x37c01b,_0x31b618){return tilde['asr'](_0x1e759e,_0x4ccdd5,_0x37c01b,_0x31b618)[_0xe623('0x34')](function(_0x525481){try{fs[_0xe623('0x17')](_0x1e759e);}catch(_0x4ebf96){logger[_0xe623('0xd')](_0x4ebf96);}logger[_0xe623('0x14')](_0xe623('0x6a'),_0x525481[_0xe623('0x46')]);logger[_0xe623('0x14')]('Tilde\x20ASR\x20confidence',_0x525481[_0xe623('0x48')]);return _0x525481;});};exports[_0xe623('0x6b')]=function(_0x5bd615,_0x190572,_0x4e7712,_0x59eadc,_0x1896a6,_0x1d7e79){var _0x306c94=path[_0xe623('0x20')](__dirname,_0xe623('0x21'),rs[_0xe623('0x22')](0x4)+_0xe623('0x31'));var _0x5adc62;return aws[_0xe623('0x6c')](_0x5bd615,_0x190572,_0x4e7712,_0x59eadc,_0x1896a6,_0x1d7e79,_0x306c94)['then'](function(){_0x5adc62=path['resolve'](__dirname,_0xe623('0x21'),rs[_0xe623('0x22')](0x4)+'.wav');return convertFile(_0x306c94,_0x5adc62);})['then'](function(){try{fs[_0xe623('0x17')](_0x306c94);fs['chmodSync'](_0x5adc62,_0xe623('0x26'));}catch(_0x412a29){logger[_0xe623('0xd')](_0x412a29);}return _0x5adc62['split']('.')[0x0];});};exports[_0xe623('0x6d')]=function(_0x459598,_0x584739,_0xd6cbae,_0x1d6186,_0x237eb8,_0x243fa8){return aws[_0xe623('0x6e')](_0x459598,_0x584739,_0xd6cbae,_0x1d6186,_0x237eb8,_0x243fa8)[_0xe623('0x34')](function(_0x5b17b6){logger['info'](JSON['stringify'](_0x5b17b6));return _0x5b17b6;});};exports[_0xe623('0x6f')]=function(_0x49a0ff,_0x3d08fb,_0x57760b,_0x1fd080){var _0xa064ae=util[_0xe623('0x70')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x49a0ff,encodeURIComponent(_0x3d08fb),_0x57760b,_0x1fd080);var _0x2be427=path[_0xe623('0x20')](__dirname,_0xe623('0x21'),rs[_0xe623('0x22')](0x4)+_0xe623('0x31'));var _0x375d2b;return downloadFile(_0xa064ae,_0x2be427)[_0xe623('0x34')](function(){_0x375d2b=path[_0xe623('0x20')](__dirname,_0xe623('0x21'),rs[_0xe623('0x22')](0x4)+_0xe623('0x71'));return convertFile(_0x2be427,_0x375d2b);})[_0xe623('0x34')](function(){try{fs[_0xe623('0x17')](_0x2be427);fs[_0xe623('0x25')](_0x375d2b,_0xe623('0x26'));}catch(_0x4a2484){logger[_0xe623('0xd')](_0x4a2484);}return _0x375d2b[_0xe623('0x27')]('.')[0x0];});};exports[_0xe623('0x72')]=function(_0x5a0515,_0x4140dd,_0x4a6123,_0x4b7489){var _0x4106c4=util[_0xe623('0x70')](_0xe623('0x73'),ISPEECH_API,_0x4140dd,_0x4a6123,base64Encode(_0x5a0515),_0x4b7489?util[_0xe623('0x70')](_0xe623('0x74'),encodeURIComponent(_0x4b7489)):'freeform=3');return uploadFile(_0x4106c4)['then'](function(_0x17e7e3){return querystring['parse'](_0x17e7e3);});};exports[_0xe623('0x75')]=function(_0x3bc144,_0x37f018){return sestek[_0xe623('0x76')](_0x3bc144,_0x37f018)[_0xe623('0x34')](function(_0x1239c){logger[_0xe623('0x14')](JSON[_0xe623('0x39')](_0x1239c));var _0x286fbb={'speech':_0x1239c[_0xe623('0x77')],'action':_0x1239c[_0xe623('0x78')]?_0x1239c['channelData'][_0xe623('0x79')]:undefined,'actiondata':_0x1239c['channelData']?_0x1239c[_0xe623('0x78')][_0xe623('0x7a')]:undefined};if(_0x1239c[_0xe623('0x78')]&&_0x1239c[_0xe623('0x78')]['AudioFromTts']){return base64Decode(_0x1239c[_0xe623('0x78')][_0xe623('0x7b')][_0xe623('0x7c')],path[_0xe623('0x20')](__dirname,_0xe623('0x21'),rs[_0xe623('0x22')](0x4)+'.wav'))[_0xe623('0x34')](function(_0x15da8d){_0x286fbb[_0xe623('0x7d')]=_0x15da8d;return _0x286fbb;});}return _0x286fbb;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0x2d0b=['awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','model=%s','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','https','md5','path','querystring','request-promise','google-tts-api','url','parse','util','./aws','./google','./sestek','../../../config/logger','https://api.ispeech.org/api/rest','WHAT_EVER','get','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','close','error','download\x20error','pipe','end','host','wav','error\x20convert','finish\x20to\x20convert','start','resolve','generate','.wav','writeFileSync','base64','then','chmodSync','777','split','toString','googleCloudTTS','?key=','ssml','input','audioConfig','MP3','text:synthesize','POST','.mp3','from','tmp','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','data','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','unlink','info','goggleTTS\x20path','googleASR','asr','results','alternatives','transcript','join','map','confidence','googleASR\x20transcription','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','actionIncomplete','fulfillment','speech','score','status','metadata','isFallbackIntent','replace','SessionsClient','sessionPath','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','tildeASR','Tilde\x20ASR\x20confidence'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2d0b,0x115));var _0xb2d0=function(_0x2e5482,_0x2055df){_0x2e5482=_0x2e5482-0x0;var _0x300046=_0x2d0b[_0x2e5482];return _0x300046;};'use strict';var apiai=require(_0xb2d0('0x0'));var BPromise=require(_0xb2d0('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require('http');var https=require(_0xb2d0('0x2'));var md5=require(_0xb2d0('0x3'));var path=require(_0xb2d0('0x4'));var querystring=require(_0xb2d0('0x5'));var rp=require(_0xb2d0('0x6'));var rs=require('randomstring');var sox=require('sox');var tts=require(_0xb2d0('0x7'));var urlParse=require(_0xb2d0('0x8'))[_0xb2d0('0x9')];var util=require(_0xb2d0('0xa'));var aws=require(_0xb2d0('0xb'));var google=require(_0xb2d0('0xc'));var sestek=require(_0xb2d0('0xd'));var tilde=require('./tilde');var logger=require(_0xb2d0('0xe'))('agi');var ISPEECH_API=_0xb2d0('0xf');function downloadFile(_0x53e57f,_0x4459cf){return new BPromise(function(_0x48eefa,_0x25228a){var _0xc7a00c=urlParse(_0x53e57f);var _0x479c78=_0xc7a00c['protocol']==='https:'?https:http;var _0x3e8031={'host':_0xc7a00c['host'],'path':_0xc7a00c[_0xb2d0('0x4')],'headers':{'user-agent':_0xb2d0('0x10')}};_0x479c78[_0xb2d0('0x11')](_0x3e8031,function(_0x7412ef){if(_0x7412ef['statusCode']!==0xc8){logger['error'](_0xb2d0('0x12')+_0x53e57f+_0xb2d0('0x13')+_0x7412ef[_0xb2d0('0x14')]+'\x20('+_0x7412ef['statusMessage']+')');_0x25228a(new Error('request\x20to\x20'+_0x53e57f+_0xb2d0('0x13')+_0x7412ef[_0xb2d0('0x14')]+'\x20('+_0x7412ef[_0xb2d0('0x15')]+')'));return;}var _0xd9f331=fs[_0xb2d0('0x16')](_0x4459cf);_0xd9f331['on']('finish',function(){logger['info']('finish\x20download\x20file');_0xd9f331[_0xb2d0('0x17')](_0x48eefa);});_0xd9f331['on'](_0xb2d0('0x18'),function(_0x1df459){fs['unlink'](_0x4459cf);logger[_0xb2d0('0x18')](_0xb2d0('0x19'),_0x1df459);_0x25228a(_0x1df459);});_0x7412ef[_0xb2d0('0x1a')](_0xd9f331);})['on'](_0xb2d0('0x18'),function(_0x1d97a3){logger[_0xb2d0('0x18')](_0x1d97a3);_0x25228a(_0x1d97a3);})[_0xb2d0('0x1b')]();});}function uploadFile(_0x3572aa){return new BPromise(function(_0x32cfe9,_0x2616af){var _0x2a464d=urlParse(_0x3572aa);var _0x45e0d4=_0x2a464d['protocol']==='https:'?https:http;var _0x521f19={'host':_0x2a464d[_0xb2d0('0x1c')],'path':_0x2a464d[_0xb2d0('0x4')],'headers':{'user-agent':_0xb2d0('0x10')}};_0x45e0d4[_0xb2d0('0x11')](_0x521f19,function(_0x4bd8bf){if(_0x4bd8bf[_0xb2d0('0x14')]!==0xc8){_0x2616af(new Error(_0xb2d0('0x12')+_0x3572aa+_0xb2d0('0x13')+_0x4bd8bf[_0xb2d0('0x14')]+'\x20('+_0x4bd8bf[_0xb2d0('0x15')]+')'));return;}var _0x3806d6='';_0x4bd8bf['on']('data',function(_0x160584){_0x3806d6+=_0x160584;});_0x4bd8bf['on'](_0xb2d0('0x1b'),function(){_0x32cfe9(_0x3806d6);});})['on']('error',function(_0x5d5add){_0x2616af(_0x5d5add);})[_0xb2d0('0x1b')]();});}function convertFile(_0x11c09a,_0x408cdb){return new BPromise(function(_0x572c08,_0x2f2a61){var _0x542b84=sox['transcode'](_0x11c09a,_0x408cdb,{'sampleRate':0x1f40,'format':_0xb2d0('0x1d'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x542b84['on'](_0xb2d0('0x18'),function(_0x299743){logger['error'](_0xb2d0('0x1e'),_0x299743);_0x2f2a61(_0x299743);});_0x542b84['on']('end',function(){logger['info'](_0xb2d0('0x1f'));_0x572c08();});_0x542b84[_0xb2d0('0x20')]();});}function base64Decode(_0x383ed7,_0x4d33c5){var _0x4a2135=path[_0xb2d0('0x21')](__dirname,'tmp',rs[_0xb2d0('0x22')](0x4)+_0xb2d0('0x23'));fs[_0xb2d0('0x24')](_0x4a2135,_0x383ed7,_0xb2d0('0x25'));return convertFile(_0x4a2135,_0x4d33c5)[_0xb2d0('0x26')](function(){try{fs['unlink'](_0x4a2135);fs[_0xb2d0('0x27')](_0x4d33c5,_0xb2d0('0x28'));}catch(_0x135548){logger[_0xb2d0('0x18')](_0x135548);}return _0x4d33c5[_0xb2d0('0x29')]('.')[0x0];});}function base64Encode(_0x39ac11){var _0x279416=fs['readFileSync'](_0x39ac11);return new Buffer(_0x279416)[_0xb2d0('0x2a')]('base64');}exports[_0xb2d0('0x2b')]=function(_0x54752e,_0x545b99,_0x5eeb3d,_0x53528e,_0x4896ed,_0x5efdf4){var _0x131fe5,_0x20f876;var _0x3007bc='https://texttospeech.googleapis.com/v1/';var _0x1cecc0=_0xb2d0('0x2c')+_0x54752e;var _0x23c1e7={};if(_0x545b99===_0xb2d0('0x2d')){_0x23c1e7[_0xb2d0('0x2e')]={'ssml':_0x5eeb3d};}else{_0x23c1e7[_0xb2d0('0x2e')]={'text':_0x5eeb3d};};_0x23c1e7['voice']={'languageCode':_0x53528e,'ssmlGender':_0x4896ed};_0x23c1e7[_0xb2d0('0x2f')]={'audioEncoding':_0xb2d0('0x30'),'sampleRateHertz':0x1f40};var _0x2f3a2a={'url':_0x3007bc+_0xb2d0('0x31')+_0x1cecc0,'method':_0xb2d0('0x32'),'json':!![],'body':_0x23c1e7};return rp(_0x2f3a2a)[_0xb2d0('0x26')](function(_0x2f2c01){return new BPromise(function(_0x429fdc,_0x446f79){_0x131fe5=path[_0xb2d0('0x21')](__dirname,'tmp',rs[_0xb2d0('0x22')](0x4)+_0xb2d0('0x33'));var _0x583abe=Buffer[_0xb2d0('0x34')](_0x2f2c01['audioContent'],'base64');return fs['writeFile'](_0x131fe5,_0x583abe,function(_0x275b88){_0x446f79(_0x275b88);},function(_0x398616){fs['chmodSync'](_0x131fe5,_0xb2d0('0x28'));_0x429fdc(_0x398616);});});})[_0xb2d0('0x26')](function(_0x6cc86e){_0x20f876=path[_0xb2d0('0x21')](__dirname,_0xb2d0('0x35'),rs['generate'](0x4)+'.wav');return convertFile(_0x131fe5,_0x20f876);})[_0xb2d0('0x26')](function(){try{fs['unlink'](_0x131fe5);fs['chmodSync'](_0x20f876,_0xb2d0('0x28'));}catch(_0x43157a){logger['error'](_0x43157a);}logger['info']('googleCloudTTS\x20path',_0x20f876[_0xb2d0('0x29')]('.')[0x0]);return _0x20f876[_0xb2d0('0x29')]('.')[0x0];});};exports['googleTTS']=function(_0x2292cf,_0x345c06){var _0x4e6026=_0xb2d0('0x36');var _0x446bfb,_0xe4fd1f;var _0x341ceb;var _0x52df23={'encoding':_0xb2d0('0x37'),'method':_0xb2d0('0x32'),'timeout':0x2710,'url':_0x4e6026,'headers':{'Content-Type':_0xb2d0('0x38')},'body':_0xb2d0('0x39')+encodeURIComponent(JSON[_0xb2d0('0x3a')]([[[_0xb2d0('0x3b'),JSON[_0xb2d0('0x3a')]([_0x2292cf,_0x345c06||'en',![],_0xb2d0('0x3c')]),null,_0xb2d0('0x3d')]]]))};return rp(_0x52df23)[_0xb2d0('0x26')](function(_0x32723a){try{_0x341ceb=eval(_0x32723a[_0xb2d0('0x3e')](0x5))[0x0][0x2];}catch(_0x41b342){throw new Error(_0xb2d0('0x3f')+_0x32723a[_0xb2d0('0x40')]);}if(!_0x341ceb){if(_0x2292cf['length']>0xc8){throw new Error(_0xb2d0('0x41'));}else{throw new Error('lang\x20\x22'+_0x345c06+_0xb2d0('0x42'));}}try{_0x341ceb=eval(_0x341ceb)[0x0];}catch(_0x1eda12){throw new Error(_0xb2d0('0x3f')+res['data']);}const _0x3d1eb4=_0x341ceb;_0x446bfb=path[_0xb2d0('0x21')](__dirname,'tmp',rs[_0xb2d0('0x22')](0x4)+'.mp3');fs[_0xb2d0('0x24')](_0x446bfb,_0x341ceb,{'encoding':'base64'});_0xe4fd1f=path['resolve'](__dirname,'tmp',rs[_0xb2d0('0x22')](0x4)+_0xb2d0('0x23'));return convertFile(_0x446bfb,_0xe4fd1f);})[_0xb2d0('0x26')](function(){try{fs[_0xb2d0('0x43')](_0x446bfb);fs['chmodSync'](_0xe4fd1f,_0xb2d0('0x28'));}catch(_0x602a1f){logger[_0xb2d0('0x18')](_0x602a1f);}logger[_0xb2d0('0x44')](_0xb2d0('0x45'),_0xe4fd1f['split']('.')[0x0]);return _0xe4fd1f['split']('.')[0x0];});};exports[_0xb2d0('0x46')]=function(_0x4d5df9,_0x17b922,_0x182e01){return google[_0xb2d0('0x47')](_0x4d5df9,_0x17b922,_0x182e01)[_0xb2d0('0x26')](function(_0x3ccd30){logger[_0xb2d0('0x44')](_0x3ccd30['uri']);return rp(_0x3ccd30);})['then'](function(_0x3bd363){var _0x176ef6='';var _0x21d643=0x0;try{fs[_0xb2d0('0x43')](_0x4d5df9);}catch(_0x112a75){logger[_0xb2d0('0x18')](_0x112a75);}if(_0x3bd363&&_0x3bd363['results']){_0x176ef6=_0x3bd363[_0xb2d0('0x48')]['map'](function(_0x84d863){return _0x84d863&&_0x84d863[_0xb2d0('0x49')][0x0]&&_0x84d863[_0xb2d0('0x49')][0x0][_0xb2d0('0x4a')]?_0x84d863[_0xb2d0('0x49')][0x0][_0xb2d0('0x4a')]:'';})[_0xb2d0('0x4b')]('\x0a');_0x21d643=_0x3bd363[_0xb2d0('0x48')][_0xb2d0('0x4c')](function(_0x31d839){return _0x31d839&&_0x31d839[_0xb2d0('0x49')][0x0]&&_0x31d839[_0xb2d0('0x49')][0x0][_0xb2d0('0x4d')]?_0x31d839[_0xb2d0('0x49')][0x0][_0xb2d0('0x4d')]:0x0;})[_0xb2d0('0x4b')]('\x0a');}logger[_0xb2d0('0x44')](_0xb2d0('0x4e'),_0x176ef6);logger[_0xb2d0('0x44')]('googleASR\x20confidence',_0x21d643);return{'transcript':_0x176ef6,'confidence':_0x21d643};})[_0xb2d0('0x4f')](function(_0x4a355e){logger['error'](_0xb2d0('0x50'),_0x4a355e['statusCode'],_0x4a355e[_0xb2d0('0x51')],_0x4a355e[_0xb2d0('0x52')]);});};exports[_0xb2d0('0x53')]=function(_0x10c87a,_0x4cee3c,_0x27d208,_0xd7e028){var _0x27b8a3=apiai(_0x4cee3c,{'language':_0xd7e028||'en'});return _0x27b8a3[_0xb2d0('0x54')](_0x27d208,{'sessionId':md5(_0x10c87a)})[_0xb2d0('0x26')](function(_0x5eb18f){logger[_0xb2d0('0x44')](JSON[_0xb2d0('0x3a')](_0x5eb18f));return{'source':_0x5eb18f[_0xb2d0('0x55')]['source'],'resolvedQuery':_0x5eb18f['result']['resolvedQuery'],'action':_0x5eb18f[_0xb2d0('0x55')]['action'],'actionIncomplete':_0x5eb18f[_0xb2d0('0x55')][_0xb2d0('0x56')],'speech':_0x5eb18f[_0xb2d0('0x55')][_0xb2d0('0x57')][_0xb2d0('0x58')],'score':_0x5eb18f[_0xb2d0('0x55')][_0xb2d0('0x59')],'statusCode':_0x5eb18f[_0xb2d0('0x5a')]['code'],'endConversation':_0x5eb18f[_0xb2d0('0x55')][_0xb2d0('0x5b')]['endConversation']||![],'isFallbackIntent':_0x5eb18f[_0xb2d0('0x55')][_0xb2d0('0x5b')][_0xb2d0('0x5c')]};});};exports['googleDialogflowV2']=function(_0x5d42f2,_0x243b25,_0x6bf9c7,_0x4b7986,_0x4d6382,_0x51ae24){var _0xf15853=_0x4b7986[_0xb2d0('0x5d')](/\\n/g,'\x0a');var _0x1aa2bd={'credentials':{'private_key':_0xf15853,'client_email':_0x6bf9c7}};var _0x557a27=new dialogflow[(_0xb2d0('0x5e'))](_0x1aa2bd);var _0x2abac1=_0x557a27[_0xb2d0('0x5f')](_0x243b25,md5(_0x5d42f2));var _0x36347f={'session':_0x2abac1,'queryInput':{'text':{'text':_0x4d6382,'languageCode':_0x51ae24}}};return _0x557a27['detectIntent'](_0x36347f)[_0xb2d0('0x26')](function(_0x1ea018){if(_0x1ea018&&_0x1ea018['length']){logger['info'](_0xb2d0('0x60'),JSON[_0xb2d0('0x3a')](_0x1ea018));var _0x356540=_0x1ea018[0x0];if(_0x356540){var _0x58e6a9={'action':_0x356540[_0xb2d0('0x61')]['action'],'allRequiredParamsPresent':_0x356540['queryResult'][_0xb2d0('0x62')],'endConversation':_0x356540['queryResult'][_0xb2d0('0x63')]&&_0x356540[_0xb2d0('0x61')][_0xb2d0('0x63')][_0xb2d0('0x64')]?_0x356540[_0xb2d0('0x61')]['diagnosticInfo']['fields']['end_conversation']['boolValue']:![],'fulfillmentText':_0x356540[_0xb2d0('0x61')][_0xb2d0('0x65')],'intentName':_0x356540['queryResult'][_0xb2d0('0x66')][_0xb2d0('0x51')],'intentDisplayName':_0x356540[_0xb2d0('0x61')][_0xb2d0('0x66')][_0xb2d0('0x67')],'isFallbackIntent':_0x356540['queryResult'][_0xb2d0('0x66')][_0xb2d0('0x68')],'languageCode':_0x356540[_0xb2d0('0x61')][_0xb2d0('0x69')],'queryText':_0x356540[_0xb2d0('0x61')][_0xb2d0('0x6a')],'responseId':_0x356540[_0xb2d0('0x6b')],'score':_0x356540[_0xb2d0('0x61')]['intentDetectionConfidence'],'speech':_0x356540[_0xb2d0('0x61')][_0xb2d0('0x65')],'providerResponse':JSON[_0xb2d0('0x3a')](_0x1ea018)};return _0x58e6a9;}}});};exports[_0xb2d0('0x6c')]=function(_0x5c3fbe,_0x3a6799,_0x1273ca,_0x9efe11){return tilde[_0xb2d0('0x47')](_0x5c3fbe,_0x3a6799,_0x1273ca,_0x9efe11)[_0xb2d0('0x26')](function(_0x4ea79c){try{fs[_0xb2d0('0x43')](_0x5c3fbe);}catch(_0x2ae1ea){logger[_0xb2d0('0x18')](_0x2ae1ea);}logger['info']('Tilde\x20ASR\x20transcription',_0x4ea79c[_0xb2d0('0x4a')]);logger[_0xb2d0('0x44')](_0xb2d0('0x6d'),_0x4ea79c[_0xb2d0('0x4d')]);return _0x4ea79c;});};exports[_0xb2d0('0x6e')]=function(_0x58a80a,_0x5e1e97,_0x443f0d,_0xddb124,_0x141822,_0x7c4b28){var _0xaa2ac5=path[_0xb2d0('0x21')](__dirname,_0xb2d0('0x35'),rs[_0xb2d0('0x22')](0x4)+_0xb2d0('0x33'));var _0x312238;return aws[_0xb2d0('0x6f')](_0x58a80a,_0x5e1e97,_0x443f0d,_0xddb124,_0x141822,_0x7c4b28,_0xaa2ac5)[_0xb2d0('0x26')](function(){_0x312238=path[_0xb2d0('0x21')](__dirname,_0xb2d0('0x35'),rs[_0xb2d0('0x22')](0x4)+_0xb2d0('0x23'));return convertFile(_0xaa2ac5,_0x312238);})[_0xb2d0('0x26')](function(){try{fs[_0xb2d0('0x43')](_0xaa2ac5);fs[_0xb2d0('0x27')](_0x312238,_0xb2d0('0x28'));}catch(_0x553bcd){logger['error'](_0x553bcd);}return _0x312238['split']('.')[0x0];});};exports[_0xb2d0('0x70')]=function(_0x52e03f,_0x52f08a,_0x8b35b7,_0x4f8991,_0x56c53f,_0x59e873){return aws[_0xb2d0('0x71')](_0x52e03f,_0x52f08a,_0x8b35b7,_0x4f8991,_0x56c53f,_0x59e873)[_0xb2d0('0x26')](function(_0x29ef39){logger[_0xb2d0('0x44')](JSON['stringify'](_0x29ef39));return _0x29ef39;});};exports[_0xb2d0('0x72')]=function(_0x42c23a,_0x14ef54,_0x312a78,_0x5a383c){var _0x1fe693=util[_0xb2d0('0x73')](_0xb2d0('0x74'),ISPEECH_API,_0x42c23a,encodeURIComponent(_0x14ef54),_0x312a78,_0x5a383c);var _0x27aa2d=path[_0xb2d0('0x21')](__dirname,'tmp',rs[_0xb2d0('0x22')](0x4)+'.mp3');var _0x449be4;return downloadFile(_0x1fe693,_0x27aa2d)['then'](function(){_0x449be4=path[_0xb2d0('0x21')](__dirname,_0xb2d0('0x35'),rs[_0xb2d0('0x22')](0x4)+'.wav');return convertFile(_0x27aa2d,_0x449be4);})[_0xb2d0('0x26')](function(){try{fs[_0xb2d0('0x43')](_0x27aa2d);fs[_0xb2d0('0x27')](_0x449be4,_0xb2d0('0x28'));}catch(_0x367f64){logger[_0xb2d0('0x18')](_0x367f64);}return _0x449be4[_0xb2d0('0x29')]('.')[0x0];});};exports[_0xb2d0('0x75')]=function(_0x3dce19,_0x7b18c6,_0x503533,_0x5c57b0){var _0x15a2af=util[_0xb2d0('0x73')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x7b18c6,_0x503533,base64Encode(_0x3dce19),_0x5c57b0?util[_0xb2d0('0x73')](_0xb2d0('0x76'),encodeURIComponent(_0x5c57b0)):'freeform=3');return uploadFile(_0x15a2af)['then'](function(_0x11f6d4){return querystring[_0xb2d0('0x9')](_0x11f6d4);});};exports[_0xb2d0('0x77')]=function(_0x599b40,_0x17aa82){return sestek[_0xb2d0('0x78')](_0x599b40,_0x17aa82)[_0xb2d0('0x26')](function(_0x379ff5){logger[_0xb2d0('0x44')](JSON['stringify'](_0x379ff5));var _0x1f5cb7={'speech':_0x379ff5[_0xb2d0('0x79')],'action':_0x379ff5[_0xb2d0('0x7a')]?_0x379ff5['channelData'][_0xb2d0('0x7b')]:undefined,'actiondata':_0x379ff5[_0xb2d0('0x7a')]?_0x379ff5[_0xb2d0('0x7a')][_0xb2d0('0x7c')]:undefined};if(_0x379ff5[_0xb2d0('0x7a')]&&_0x379ff5[_0xb2d0('0x7a')][_0xb2d0('0x7d')]){return base64Decode(_0x379ff5['channelData'][_0xb2d0('0x7d')][_0xb2d0('0x7e')],path['resolve'](__dirname,'tmp',rs[_0xb2d0('0x22')](0x4)+_0xb2d0('0x23')))['then'](function(_0x2697ec){_0x1f5cb7[_0xb2d0('0x7f')]=_0x2697ec;return _0x1f5cb7;});}return _0x1f5cb7;});};exports[_0xb2d0('0x80')]=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 080d588..968d04c 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 _0xd32e=['exports','./nda'];(function(_0x438d56,_0x14c6f6){var _0xd16970=function(_0x23021a){while(--_0x23021a){_0x438d56['push'](_0x438d56['shift']());}};_0xd16970(++_0x14c6f6);}(_0xd32e,0x1b7));var _0xed32=function(_0x317e88,_0x1f88d9){_0x317e88=_0x317e88-0x0;var _0x4919aa=_0xd32e[_0x317e88];return _0x4919aa;};var nda=require(_0xed32('0x0'));module[_0xed32('0x1')]={'nda':nda}; \ No newline at end of file +var _0x95ee=['./nda','exports'];(function(_0x3c5e54,_0x2b991b){var _0x3ae1f3=function(_0x43f80f){while(--_0x43f80f){_0x3c5e54['push'](_0x3c5e54['shift']());}};_0x3ae1f3(++_0x2b991b);}(_0x95ee,0xec));var _0xe95e=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x95ee[_0x263a74];return _0x2aa86c;};var nda=require(_0xe95e('0x0'));module[_0xe95e('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 ce14d68..cb4cab7 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 _0x0e0f=['custom_action','CustomActionData','custom_action_data','stringify','request-promise','agi','exports','resolve','ndauth_url','password','username','then','POST','ndassistant_url','ndaactivity_type','Nda','uniqueid','callerid','Bearer\x20','body','ProjectName','project','channelData','audio/wav','CustomAction'];(function(_0x3e9426,_0x394a74){var _0x575482=function(_0x3a14ae){while(--_0x3a14ae){_0x3e9426['push'](_0x3e9426['shift']());}};_0x575482(++_0x394a74);}(_0x0e0f,0xe5));var _0xf0e0=function(_0x3b5f02,_0x511606){_0x3b5f02=_0x3b5f02-0x0;var _0x150e5f=_0x0e0f[_0x3b5f02];return _0x150e5f;};'use strict';var rp=require(_0xf0e0('0x0'));var url=require('url');var logger=require('../../../../../config/logger')(_0xf0e0('0x1'));module[_0xf0e0('0x2')]=function(_0x21d817,_0x22cc9f){var _0x2cf351={'method':'POST','uri':url[_0xf0e0('0x3')](_0x22cc9f[_0xf0e0('0x4')],'/token'),'form':{'grant_type':_0xf0e0('0x5'),'username':_0x22cc9f[_0xf0e0('0x6')],'password':_0x22cc9f[_0xf0e0('0x5')]},'json':!![]};return rp(_0x2cf351)[_0xf0e0('0x7')](function(_0x2f02a1){var _0xd26614={'method':_0xf0e0('0x8'),'uri':url[_0xf0e0('0x3')](_0x22cc9f[_0xf0e0('0x9')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x22cc9f[_0xf0e0('0xa')]||'message','channelId':_0xf0e0('0xb'),'conversation':{'id':_0x21d817[_0xf0e0('0xc')]},'from':{'id':_0x21d817[_0xf0e0('0xd')],'name':_0x21d817['calleridname']},'recipient':{'id':_0x21d817['dnid'],'name':_0x21d817['extension']},'text':_0x22cc9f['text'],'channelData':{}},'headers':{'Authorization':_0xf0e0('0xe')+_0x2f02a1['access_token']},'json':!![]};if(_0x22cc9f['project']){_0xd26614[_0xf0e0('0xf')]['channelData'][_0xf0e0('0x10')]=_0x22cc9f[_0xf0e0('0x11')];}if(_0x22cc9f['ndagenerate_audio']=='1'){_0xd26614['body'][_0xf0e0('0x12')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xf0e0('0x13')};}if(_0x22cc9f['custom_action']){_0xd26614[_0xf0e0('0xf')]['channelData'][_0xf0e0('0x14')]=_0x22cc9f[_0xf0e0('0x15')];if(_0x22cc9f['custom_action_data']){_0xd26614[_0xf0e0('0xf')][_0xf0e0('0x12')][_0xf0e0('0x16')]=_0x22cc9f[_0xf0e0('0x17')];}}logger['info'](JSON[_0xf0e0('0x18')](_0xd26614));return rp(_0xd26614);});}; \ No newline at end of file +var _0x49e9=['text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','CustomAction','custom_action','custom_action_data','info','stringify','request-promise','url','agi','exports','POST','ndauth_url','/token','password','then','resolve','ndassistant_url','ndaactivity_type','Nda','uniqueid','callerid','dnid','extension'];(function(_0xf16016,_0x209c97){var _0x23b444=function(_0x39d106){while(--_0x39d106){_0xf16016['push'](_0xf16016['shift']());}};_0x23b444(++_0x209c97);}(_0x49e9,0x10f));var _0x949e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x49e9[_0x20a584];return _0x4b41a8;};'use strict';var rp=require(_0x949e('0x0'));var url=require(_0x949e('0x1'));var logger=require('../../../../../config/logger')(_0x949e('0x2'));module[_0x949e('0x3')]=function(_0x259795,_0x5c303a){var _0x4f1295={'method':_0x949e('0x4'),'uri':url['resolve'](_0x5c303a[_0x949e('0x5')],_0x949e('0x6')),'form':{'grant_type':_0x949e('0x7'),'username':_0x5c303a['username'],'password':_0x5c303a[_0x949e('0x7')]},'json':!![]};return rp(_0x4f1295)[_0x949e('0x8')](function(_0xfc4f8a){var _0x34ee57={'method':_0x949e('0x4'),'uri':url[_0x949e('0x9')](_0x5c303a[_0x949e('0xa')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x5c303a[_0x949e('0xb')]||'message','channelId':_0x949e('0xc'),'conversation':{'id':_0x259795[_0x949e('0xd')]},'from':{'id':_0x259795[_0x949e('0xe')],'name':_0x259795['calleridname']},'recipient':{'id':_0x259795[_0x949e('0xf')],'name':_0x259795[_0x949e('0x10')]},'text':_0x5c303a[_0x949e('0x11')],'channelData':{}},'headers':{'Authorization':_0x949e('0x12')+_0xfc4f8a[_0x949e('0x13')]},'json':!![]};if(_0x5c303a[_0x949e('0x14')]){_0x34ee57[_0x949e('0x15')][_0x949e('0x16')][_0x949e('0x17')]=_0x5c303a[_0x949e('0x14')];}if(_0x5c303a[_0x949e('0x18')]=='1'){_0x34ee57[_0x949e('0x15')][_0x949e('0x16')][_0x949e('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x949e('0x1a')};}if(_0x5c303a['custom_action']){_0x34ee57[_0x949e('0x15')][_0x949e('0x16')][_0x949e('0x1b')]=_0x5c303a[_0x949e('0x1c')];if(_0x5c303a['custom_action_data']){_0x34ee57[_0x949e('0x15')][_0x949e('0x16')]['CustomActionData']=_0x5c303a[_0x949e('0x1d')];}}logger[_0x949e('0x1e')](JSON[_0x949e('0x1f')](_0x34ee57));return rp(_0x34ee57);});}; \ 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 35293a4..5ca20e6 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 _0xf110=['exports'];(function(_0x5d4db8,_0x4ad01b){var _0x415548=function(_0x7ae456){while(--_0x7ae456){_0x5d4db8['push'](_0x5d4db8['shift']());}};_0x415548(++_0x4ad01b);}(_0xf110,0x1b7));var _0x0f11=function(_0x9ff51,_0x4c951f){_0x9ff51=_0x9ff51-0x0;var _0x31959b=_0xf110[_0x9ff51];return _0x31959b;};'use strict';var asr=require('./lib/api');module[_0x0f11('0x0')]=function(_0x356f6a,_0x414773,_0x2dfc78,_0x65cc69){return asr(_0x356f6a,_0x414773,_0x2dfc78,_0x65cc69);}; \ No newline at end of file +var _0xc106=['exports'];(function(_0x1f5873,_0x1497be){var _0x2a75d9=function(_0x16c497){while(--_0x16c497){_0x1f5873['push'](_0x1f5873['shift']());}};_0x2a75d9(++_0x1497be);}(_0xc106,0x112));var _0x6c10=function(_0x1d8ce4,_0x45fbb4){_0x1d8ce4=_0x1d8ce4-0x0;var _0x48e3bc=_0xc106[_0x1d8ce4];return _0x48e3bc;};'use strict';var asr=require('./lib/api');module[_0x6c10('0x0')]=function(_0x12c5cf,_0x4f171e,_0x3c5476,_0x4b54d0){return asr(_0x12c5cf,_0x4f171e,_0x3c5476,_0x4b54d0);}; \ 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 da98c39..48874cb 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 _0x2d23=['info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','update','hex','Open\x20Tilde\x20ASR\x20socket','send','stringify','createReadStream','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil','open','message','bluebird','moment','crypto','../../../../../../config/logger','agi','exports'];(function(_0x5cb97e,_0x132a39){var _0x1714b4=function(_0x384210){while(--_0x384210){_0x5cb97e['push'](_0x5cb97e['shift']());}};_0x1714b4(++_0x132a39);}(_0x2d23,0xd8));var _0x32d2=function(_0xa40219,_0x21027e){_0xa40219=_0xa40219-0x0;var _0x391974=_0x2d23[_0xa40219];return _0x391974;};'use strict';var BPromise=require(_0x32d2('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x32d2('0x1'));var crypto=require(_0x32d2('0x2'));var logger=require(_0x32d2('0x3'))(_0x32d2('0x4'));module[_0x32d2('0x5')]=function(_0x2a6836,_0x2976ad,_0x982f35,_0x3b5a21){return new BPromise(function(_0x209c7f,_0x3eccb9){logger[_0x32d2('0x6')](_0x32d2('0x7'),_0x3b5a21||_0x32d2('0x8'));var _0x253831=new WebSocket(_0x3b5a21||_0x32d2('0x8'),{'perMessageDeflate':![]});var _0x5bc15e='';var _0x3e902a='0';var _0x14223c='1';var _0x5c18ba='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x1d78be(_0x414842){var _0x3b79f0=crypto[_0x32d2('0x9')]('sha1');_0x3b79f0[_0x32d2('0xa')](_0x414842);return _0x3b79f0['digest'](_0x32d2('0xb'));}function _0x221ab9(){try{logger['info'](_0x32d2('0xc'));var _0x23994a=moment()['unix']();var _0x16696e=_0x1d78be(_0x23994a+_0x2976ad+_0x982f35);_0x253831[_0x32d2('0xd')](JSON[_0x32d2('0xe')]({'appID':_0x2976ad,'timestamp':_0x23994a,'appKey':_0x16696e}));var _0x49861e=fs[_0x32d2('0xf')](_0x2a6836);_0x49861e['on']('data',function(_0x3fcf68){_0x253831[_0x32d2('0xd')](_0x3fcf68);});_0x49861e['on'](_0x32d2('0x10'),function(){_0x253831[_0x32d2('0xd')](_0x32d2('0x11'));});}catch(_0x47d4d0){logger[_0x32d2('0x12')](_0x32d2('0x13'),JSON['stringify'](_0x47d4d0));_0x253831[_0x32d2('0x14')]();}}function _0x1aa951(_0x35309e){try{if(_0x35309e){var _0x5a465f=JSON[_0x32d2('0x15')](_0x35309e);switch(_0x5a465f[_0x32d2('0x16')]){case 0x0:if(_0x5a465f[_0x32d2('0x17')]){if(_0x5a465f['result'][_0x32d2('0x18')]){logger[_0x32d2('0x6')](_0x32d2('0x19'),JSON['stringify'](_0x5a465f[_0x32d2('0x17')][_0x32d2('0x1a')]));_0x5bc15e=_0x5a465f[_0x32d2('0x17')]['hypotheses'][0x0][_0x32d2('0x1b')];_0x3e902a=_0x5a465f[_0x32d2('0x17')][_0x32d2('0x1a')][0x0][_0x32d2('0x1c')];_0x14223c='0';_0x5c18ba='Success.';_0x253831['terminate']();}}break;case 0x1:logger[_0x32d2('0x6')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x14223c='1';_0x5c18ba='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x32d2('0x6')](_0x32d2('0x1d'));_0x14223c='2';_0x5c18ba=_0x32d2('0x1d');break;case 0x9:logger[_0x32d2('0x6')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x14223c='9';_0x5c18ba='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x32d2('0x6')](_0x32d2('0x1e'));_0x14223c='10';_0x5c18ba=_0x32d2('0x1e');break;case 0xb:logger[_0x32d2('0x6')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x14223c='11';_0x5c18ba=_0x32d2('0x1f');}}}catch(_0x3821e3){logger['error'](_0x32d2('0x20'),JSON['stringify'](_0x3821e3));_0x253831['terminate']();}}function _0x35bc3d(){logger['info']('Close\x20Tilde\x20ASR\x20socket');_0x209c7f({'transcript':_0x5bc15e,'confidence':_0x3e902a,'status':_0x14223c,'status_message':_0x5c18ba});}function _0x1219df(_0x558f7f){logger['error'](_0x32d2('0x21'));if(!_[_0x32d2('0x22')](_0x558f7f)){logger[_0x32d2('0x12')](_['isObject'](_0x558f7f)?JSON[_0x32d2('0xe')](_0x558f7f):_0x558f7f);}}_0x253831['on'](_0x32d2('0x23'),_0x221ab9);_0x253831['on'](_0x32d2('0x24'),_0x1aa951);_0x253831['on']('close',_0x35bc3d);_0x253831['on'](_0x32d2('0x12'),_0x1219df);});}; \ No newline at end of file +var _0xfb0b=['stringify','createReadStream','data','send','EOS','error','terminate','status','result','final','info','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','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','open','message','bluebird','lodash','moment','crypto','agi','exports','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','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfb0b,0x13f));var _0xbfb0=function(_0xf44777,_0x419161){_0xf44777=_0xf44777-0x0;var _0x4a38cc=_0xfb0b[_0xf44777];return _0x4a38cc;};'use strict';var BPromise=require(_0xbfb0('0x0'));var _=require(_0xbfb0('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xbfb0('0x2'));var crypto=require(_0xbfb0('0x3'));var logger=require('../../../../../../config/logger')(_0xbfb0('0x4'));module[_0xbfb0('0x5')]=function(_0x55275d,_0x2451bd,_0x2d5375,_0x429106){return new BPromise(function(_0xe0360f,_0x43d514){logger['info']('Tilde\x20URI',_0x429106||_0xbfb0('0x6'));var _0xec90b6=new WebSocket(_0x429106||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x56841c='';var _0x22493c='0';var _0x20433b='1';var _0x2cc41c=_0xbfb0('0x7');function _0x5efdbe(_0x1720b5){var _0x35247a=crypto[_0xbfb0('0x8')](_0xbfb0('0x9'));_0x35247a[_0xbfb0('0xa')](_0x1720b5);return _0x35247a[_0xbfb0('0xb')](_0xbfb0('0xc'));}function _0xb802ea(){try{logger['info'](_0xbfb0('0xd'));var _0x20ff32=moment()['unix']();var _0x2fb91d=_0x5efdbe(_0x20ff32+_0x2451bd+_0x2d5375);_0xec90b6['send'](JSON[_0xbfb0('0xe')]({'appID':_0x2451bd,'timestamp':_0x20ff32,'appKey':_0x2fb91d}));var _0xf62695=fs[_0xbfb0('0xf')](_0x55275d);_0xf62695['on'](_0xbfb0('0x10'),function(_0x478b92){_0xec90b6[_0xbfb0('0x11')](_0x478b92);});_0xf62695['on']('close',function(){_0xec90b6[_0xbfb0('0x11')](_0xbfb0('0x12'));});}catch(_0x1f1832){logger[_0xbfb0('0x13')]('Tilde\x20ASR\x20send\x20error',JSON['stringify'](_0x1f1832));_0xec90b6[_0xbfb0('0x14')]();}}function _0x3d3702(_0x4e4bc2){try{if(_0x4e4bc2){var _0x492fb7=JSON['parse'](_0x4e4bc2);switch(_0x492fb7[_0xbfb0('0x15')]){case 0x0:if(_0x492fb7[_0xbfb0('0x16')]){if(_0x492fb7[_0xbfb0('0x16')][_0xbfb0('0x17')]){logger[_0xbfb0('0x18')](_0xbfb0('0x19'),JSON[_0xbfb0('0xe')](_0x492fb7['result'][_0xbfb0('0x1a')]));_0x56841c=_0x492fb7['result'][_0xbfb0('0x1a')][0x0][_0xbfb0('0x1b')];_0x22493c=_0x492fb7['result'][_0xbfb0('0x1a')][0x0]['likelihood'];_0x20433b='0';_0x2cc41c=_0xbfb0('0x1c');_0xec90b6[_0xbfb0('0x14')]();}}break;case 0x1:logger['info'](_0xbfb0('0x7'));_0x20433b='1';_0x2cc41c=_0xbfb0('0x7');break;case 0x2:logger[_0xbfb0('0x18')](_0xbfb0('0x1d'));_0x20433b='2';_0x2cc41c=_0xbfb0('0x1d');break;case 0x9:logger['info'](_0xbfb0('0x1e'));_0x20433b='9';_0x2cc41c=_0xbfb0('0x1e');break;case 0xa:logger[_0xbfb0('0x18')](_0xbfb0('0x1f'));_0x20433b='10';_0x2cc41c=_0xbfb0('0x1f');break;case 0xb:logger['info'](_0xbfb0('0x20'));_0x20433b='11';_0x2cc41c=_0xbfb0('0x20');}}}catch(_0xd46e69){logger[_0xbfb0('0x13')]('Tilde\x20ASR\x20parse\x20error',JSON['stringify'](_0xd46e69));_0xec90b6[_0xbfb0('0x14')]();}}function _0x254b39(){logger[_0xbfb0('0x18')](_0xbfb0('0x21'));_0xe0360f({'transcript':_0x56841c,'confidence':_0x22493c,'status':_0x20433b,'status_message':_0x2cc41c});}function _0x11df3c(_0xef84c9){logger[_0xbfb0('0x13')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0xbfb0('0x22')](_0xef84c9)){logger['error'](_['isObject'](_0xef84c9)?JSON[_0xbfb0('0xe')](_0xef84c9):_0xef84c9);}}_0xec90b6['on'](_0xbfb0('0x23'),_0xb802ea);_0xec90b6['on'](_0xbfb0('0x24'),_0x3d3702);_0xec90b6['on']('close',_0x254b39);_0xec90b6['on']('error',_0x11df3c);});}; \ 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 70f077a..aff9795 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 _0x73b3=['exports'];(function(_0x39caaa,_0x1f37bc){var _0x9b9c7d=function(_0x2da02c){while(--_0x2da02c){_0x39caaa['push'](_0x39caaa['shift']());}};_0x9b9c7d(++_0x1f37bc);}(_0x73b3,0x106));var _0x373b=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0x73b3[_0x373dee];return _0x46798f;};var asr=require('./asr');module[_0x373b('0x0')]={'asr':asr}; \ No newline at end of file +var _0x5212=['exports','./asr'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x5212,0x1a9));var _0x2521=function(_0xa60623,_0x2d4e4f){_0xa60623=_0xa60623-0x0;var _0x4a6487=_0x5212[_0xa60623];return _0x4a6487;};var asr=require(_0x2521('0x0'));module[_0x2521('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index a703dfe..c238ef7 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 _0x34e8=['E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','inherits','exports','util','net','events','EventEmitter','./channel','call','emit','error'];(function(_0x2353fe,_0x4b0bca){var _0x4d43f6=function(_0x5d0bd9){while(--_0x5d0bd9){_0x2353fe['push'](_0x2353fe['shift']());}};_0x4d43f6(++_0x4b0bca);}(_0x34e8,0x12c));var _0x834e=function(_0x24732a,_0x5b4b3a){_0x24732a=_0x24732a-0x0;var _0x4b0a5e=_0x34e8[_0x24732a];return _0x4b0a5e;};'use strict';var util=require(_0x834e('0x0'));var net=require(_0x834e('0x1'));var EventEmitter=require(_0x834e('0x2'))[_0x834e('0x3')];var AGIError=require('./error');var AGIChannel=require(_0x834e('0x4'));var AGIServer=function(_0x21e2e0,_0x472111,_0x31bf20){var _0x289ef2=this;var _0x19a3e0=null;var _0x398bee=0x0;if(!_0x21e2e0)_0x21e2e0=0x11dd;if(!_0x472111)_0x472111='127.0.0.1';EventEmitter[_0x834e('0x5')](_0x289ef2);function _0x52056d(){if(!_0x21e2e0){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0x8')));return![];}_0x19a3e0=net[_0x834e('0x9')]();_0x19a3e0[_0x834e('0xa')](_0x21e2e0,_0x472111);_0x19a3e0['on'](_0x834e('0xb'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xb'));});_0x19a3e0['on'](_0x834e('0xc'),function(_0x186b3b){_0x19a3e0[_0x834e('0xd')](function(_0x36e124,_0x14038b){if(_0x36e124){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x36e124));}else if(_0x31bf20&&_0x31bf20<0x0){_0x289ef2[_0x834e('0x6')]('error',new AGIError(_0x834e('0xf')));_0x186b3b[_0x834e('0x10')]();}else if(_0x31bf20&&_0x31bf20>0x0&&_0x31bf20<_0x14038b){_0x398bee+=0x1;_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0x11'),_0x398bee));_0x186b3b[_0x834e('0x10')]();}else{var _0x21cc0a=new AGIChannel(_0x186b3b);_0x21cc0a['on']('ready',function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xc'),_0x21cc0a);});}});});_0x19a3e0['on']('error',function(_0x316205){_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x316205['code']));});_0x19a3e0['on'](_0x834e('0x12'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0x12'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x834e('0x13')](function(){_0x52056d();});};util[_0x834e('0x14')](AGIServer,EventEmitter);module[_0x834e('0x15')]=function(_0xb993a1,_0x237947,_0x254677){return new AGIServer(_0xb993a1,_0x237947,_0x254677);}; \ No newline at end of file +var _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x9c44[_0x279d37];return _0x530173;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index a97d010..21de7ea 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 _0xa03c=['NOBEEP','recordFile','intKey','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','%s/recordings/%s','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','failure','logout','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20NOT\x20FOUND\x20BY','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','%s[%s]','variable\x20%s[key]\x20set','getData','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','macro','position','QUEUE','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','%s_STATUS_MESSAGE','statusMessage','variable\x20%s\x20set','saydigits','sayDigits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','\x22%s\x22\x20<%s>','email','bcc','template_id','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','SENDFAX\x20block\x20not\x20implemented','sms_account_id','no\x20sms\x20account\x20configured','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','join','exports','util','shelljs','odbc','randomstring','mustache','request-promise','../../config/logger','../../config/environment','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','interval','map','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','agicommand','arg_1','callerid','createSquareRecording','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','phone','scheduledAt','callback','toString','getPause','agent','agentPause','agentUnpause','agentLogout','agentLogin','internal','format','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','googleCloudTTS','apiKey','text','languageCode','ssmlGender','MP3','googleTTS','google_tts_language','restAPI','method','timeout','includes','POST','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','url','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','model','awsPolly','aws_access_key_id','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','clear','clone','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','saveRestApiResult','%s.%s','isArray','length','setVariable','split','replaceAll','extra','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','isConfigured','maxRetry','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','grammar','no\x20grammar\x20configured','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','getAndSetVariable','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','agi','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','Wait\x20%s\x20seconds\x20before\x20answer','wait','answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','no\x20list\x20selected','delay','add','minutes','sync','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','getSquareOdbc','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','replace','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','private_key','no\x20private_key\x20configured','no\x20anguage\x20configured','bot','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','response','maxdigit','test','mindigit','hiddendigitsnum','generate','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','GOAL\x20%s','awspolly','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','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','message','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','beep'];(function(_0x32c106,_0x3ff8a4){var _0x24a05c=function(_0x1c7a97){while(--_0x1c7a97){_0x32c106['push'](_0x32c106['shift']());}};_0x24a05c(++_0x3ff8a4);}(_0xa03c,0x94));var _0xca03=function(_0x553b66,_0x219366){_0x553b66=_0x553b66-0x0;var _0x2880d5=_0xa03c[_0x553b66];return _0x2880d5;};'use strict';var fs=require('fs');var util=require(_0xca03('0x0'));var _=require('lodash');var sh=require(_0xca03('0x1'));var odbc=require(_0xca03('0x2'))();var rs=require(_0xca03('0x3'));var moment=require('moment');var Mustache=require(_0xca03('0x4'));var rp=require(_0xca03('0x5'));var logger=require(_0xca03('0x6'))('agi');var config=require(_0xca03('0x7'));var shared=require(_0xca03('0x8'));var scripts=require(_0xca03('0x9'));var FILES_PATH=_0xca03('0xa');var recursiveMapAttributes=[_0xca03('0xb'),_0xca03('0xc')];var verticesWithRetry=['menu',_0xca03('0xd'),_0xca03('0xe')];var AGIVertices=function(_0x2e9c92,_0x51cdb4,_0x31e7be){this[_0xca03('0xf')]=_0x2e9c92;this[_0xca03('0x10')]=_0x51cdb4;this[_0xca03('0x11')]=_0x31e7be;};AGIVertices[_0xca03('0x12')][_0xca03('0x13')]=function(_0x4cc804,_0x23eaf5){this[_0xca03('0x10')][_0xca03('0x14')](_0x4cc804)[_0xca03('0x15')](function(_0x1a6abb){_0x23eaf5(null,_0x1a6abb?_0x1a6abb[_0xca03('0x16')]:![]);})[_0xca03('0x17')](function(_0x2623bb){_0x23eaf5(_0x2623bb);});};AGIVertices[_0xca03('0x12')][_0xca03('0x18')]=function(_0x3b76d7,_0x3fe390){this[_0xca03('0x10')][_0xca03('0x19')](_0x3b76d7)[_0xca03('0x15')](function(_0x451232){_0x3fe390(null,_0x451232?_0x451232[_0xca03('0x16')]:![]);})[_0xca03('0x17')](function(_0x177571){_0x3fe390(_0x177571);});};AGIVertices['prototype'][_0xca03('0x1a')]=function(_0x108af3,_0x184313){this[_0xca03('0x10')][_0xca03('0x1b')](_0x108af3)[_0xca03('0x15')](function(_0x35573d){_0x184313(null,_0x35573d?_0x35573d[_0xca03('0x16')]:![]);})['catch'](function(_0x3eb6d0){_0x184313(_0x3eb6d0);});};AGIVertices['prototype']['getSquareOdbc']=function(_0x4b5a11,_0x17ce6c){this[_0xca03('0x10')][_0xca03('0x1c')](_0x4b5a11)[_0xca03('0x15')](function(_0x540b13){_0x17ce6c(null,_0x540b13?_0x540b13[_0xca03('0x1d')]:![]);})['catch'](function(_0x36ecaf){_0x17ce6c(_0x36ecaf);});};AGIVertices[_0xca03('0x12')][_0xca03('0x1e')]=function(_0x20e22a,_0x7a39f3){this[_0xca03('0x10')][_0xca03('0x1f')](_0x20e22a)[_0xca03('0x15')](function(_0x265b6d){_0x7a39f3(null,_0x265b6d?_0x265b6d[_0xca03('0x16')]:![]);})['catch'](function(_0x3b564d){_0x7a39f3(_0x3b564d);});};AGIVertices[_0xca03('0x12')][_0xca03('0x20')]=function(_0x2d05cb,_0x53b11f){this[_0xca03('0x10')][_0xca03('0x21')](_0x2d05cb)[_0xca03('0x15')](function(_0x4f9248){_0x53b11f(null,_0x4f9248?_0x4f9248[_0xca03('0x16')]:![]);})['catch'](function(_0x1e8586){_0x53b11f(_0x1e8586);});};AGIVertices['prototype'][_0xca03('0x22')]=function(_0x4bb184,_0xeafeb0){var _0x175640=this;this[_0xca03('0x10')][_0xca03('0x23')](_0x4bb184)[_0xca03('0x15')](function(_0x44e135){_0xeafeb0(null,_0x44e135?_0x175640['getSoundPath'](_0x44e135['save_name']):![]);})['catch'](function(_0xcba7d3){_0xeafeb0(_0xcba7d3);});};AGIVertices[_0xca03('0x12')][_0xca03('0x24')]=function(_0x3ab9cd,_0x3b5868){this[_0xca03('0x10')][_0xca03('0x25')](_0x3ab9cd)[_0xca03('0x15')](function(_0x33d881){_0x3b5868(null,_0x33d881?_0x33d881:![]);})[_0xca03('0x17')](function(_0x5d97fe){_0x3b5868(_0x5d97fe);});};AGIVertices[_0xca03('0x12')][_0xca03('0x26')]=function(_0x2058f7,_0x5f3d8b,_0x4cd6f0){this[_0xca03('0x11')][_0xca03('0x26')](_0x2058f7,_0x5f3d8b)[_0xca03('0x15')](function(){_0x4cd6f0(null);})[_0xca03('0x17')](function(_0x3ca818){_0x4cd6f0(_0x3ca818);});};AGIVertices[_0xca03('0x12')][_0xca03('0x27')]=function(_0x3773f7,_0x5e7d56){this[_0xca03('0x10')]['getIntervalById'](_0x3773f7)[_0xca03('0x15')](function(_0x2f0529){if(_0x2f0529){if(_0x2f0529['IntervalId']){_0x5e7d56(null,[_0x2f0529[_0xca03('0x28')]]);}else{_0x5e7d56(null,_[_0xca03('0x29')](_0x2f0529['Intervals'],_0xca03('0x28')));}}else{_0x5e7d56(null,![]);}})['catch'](function(_0x5eac3e){_0x5e7d56(_0x5eac3e);});};AGIVertices['prototype']['getSoundPath']=function(_0x5b529a){return util['format'](_0xca03('0x2a'),FILES_PATH,_0x5b529a);};AGIVertices[_0xca03('0x12')][_0xca03('0x2b')]=function(_0x3a347c,_0x1beef3,_0x2c4ac6){odbc[_0xca03('0x2c')](_0x3a347c,function(_0x32b91c){if(_0x32b91c){logger[_0xca03('0x2d')](_0xca03('0x2e'),_0x32b91c);_0x2c4ac6(_0x32b91c);}else{logger['info']('ODBC\x20connection\x20successfully');odbc['query'](_0x1beef3,function(_0x5be212,_0x3c4cd1){if(_0x5be212){logger[_0xca03('0x2f')](_0xca03('0x30'),_0x1beef3);_0x2c4ac6(_0x5be212);}else{logger[_0xca03('0x2f')](_0xca03('0x31'),_0x1beef3);odbc[_0xca03('0x32')](function(_0x3922ba){if(_0x3922ba){logger[_0xca03('0x2d')](_0xca03('0x33'),_0x3922ba);}_0x2c4ac6(null,_0x3c4cd1);});}});}});};AGIVertices[_0xca03('0x12')][_0xca03('0x34')]=function(_0x41c4a5,_0x374a05){this[_0xca03('0x10')][_0xca03('0x35')](_0x41c4a5)['then'](function(_0x3f2f97){_0x374a05(null,_0x3f2f97?_0x3f2f97:![]);})[_0xca03('0x17')](function(_0x4eaa5a){_0x374a05(_0x4eaa5a);});};AGIVertices[_0xca03('0x12')][_0xca03('0x36')]=function(_0x47c386,_0xa210af){this[_0xca03('0x10')]['createSmsMessage'](_0x47c386)['then'](function(_0x584747){_0xa210af(null,_0x584747);})['catch'](function(_0x5971a7){_0xa210af(_0x5971a7);});};AGIVertices[_0xca03('0x12')][_0xca03('0x37')]=function(_0x5b5fc7,_0xfd0b5,_0x8951f7){this[_0xca03('0x10')]['createSquareDetailsReport']({'uniqueid':this['channel'][_0xca03('0x38')],'node':_0x5b5fc7['label'],'application':_0x5b5fc7[_0xca03('0x39')],'data':_0xfd0b5||null,'project_name':this[_0xca03('0xf')][_0xca03('0x3a')],'callerid':this[_0xca03('0xf')][_0xca03('0x3b')]})[_0xca03('0x15')](function(_0xe663f1){if(_0x8951f7){_0x8951f7(null,_0xe663f1);}})['catch'](function(_0x479b17){if(_0x8951f7){_0x8951f7(_0x479b17);}});};AGIVertices[_0xca03('0x12')][_0xca03('0x3c')]=function(_0x460fa7,_0x37e750,_0x33534c,_0x2de1fe){this[_0xca03('0x10')][_0xca03('0x3c')]({'uniqueid':this['channel'][_0xca03('0x38')],'callerid':this[_0xca03('0xf')]['callerid'],'calleridname':this[_0xca03('0xf')]['calleridname'],'context':this[_0xca03('0xf')][_0xca03('0x3d')],'extension':this[_0xca03('0xf')][_0xca03('0x3e')],'priority':this[_0xca03('0xf')][_0xca03('0x3f')],'accountcode':this['channel'][_0xca03('0x40')],'dnid':this[_0xca03('0xf')][_0xca03('0x41')],'projectName':this[_0xca03('0xf')][_0xca03('0x3a')],'saveName':_0x37e750,'filename':_0x460fa7[_0xca03('0x42')]||_0x37e750,'savePath':_0x33534c})[_0xca03('0x15')](function(_0x454d13){_0x2de1fe(null,_0x454d13);})[_0xca03('0x17')](function(_0x4adcbb){_0x2de1fe(_0x4adcbb);});};AGIVertices[_0xca03('0x12')][_0xca03('0x43')]=function(_0x1d3b43,_0x3abc09,_0x2d8523,_0x5ac771,_0x392f67){this['rpc']['createSquareMessage']({'uniqueid':this['channel'][_0xca03('0x38')],'body':_0x1d3b43,'direction':_0x3abc09,'providerName':_0x2d8523,'providerResponse':_0x5ac771})[_0xca03('0x15')](function(_0x185bbc){if(_0x392f67){_0x392f67(null,_0x185bbc);}})[_0xca03('0x17')](function(_0x538fd2){if(_0x392f67){_0x392f67(_0x538fd2);}});};AGIVertices[_0xca03('0x12')]['createCmContact']=function(_0x29745b,_0x154c12){this['rpc'][_0xca03('0x44')]({'firstName':_[_0xca03('0x45')](_0x29745b[_0xca03('0x16')])||_[_0xca03('0x46')](_0x29745b[_0xca03('0x16')])?'callback_'+Math[_0xca03('0x47')]():_0x29745b['name'],'lastName':_[_0xca03('0x45')](_0x29745b['lastName'])||_['isNil'](_0x29745b[_0xca03('0x48')])?null:_0x29745b[_0xca03('0x48')],'phone':_0x29745b[_0xca03('0x49')],'ListId':_0x29745b['list_id'],'scheduledat':_0x29745b[_0xca03('0x4a')],'callbackUniqueid':this[_0xca03('0xf')]['uniqueid'],'tags':_0xca03('0x4b'),'description':'Callback\x20scheduled\x20at\x20'+_0x29745b['scheduledAt'][_0xca03('0x4c')](),'priority':_0x29745b['callback_priority']})['then'](function(_0x552e74){_0x154c12(null,_0x552e74);})[_0xca03('0x17')](function(_0x548da3){_0x154c12(_0x548da3);});};AGIVertices[_0xca03('0x12')][_0xca03('0x4d')]=function(_0x5c502c,_0x379833){this[_0xca03('0x10')]['getPauseById'](_0x5c502c)[_0xca03('0x15')](function(_0x3739a9){_0x379833(null,_0x3739a9?_0x3739a9[_0xca03('0x16')]:![]);})[_0xca03('0x17')](function(_0x1d64be){_0x379833(_0x1d64be);});};AGIVertices[_0xca03('0x12')]['agentPause']=function(_0xdf844e,_0x51ba85,_0x3c6b25){var _0x16d996={'role':_0xca03('0x4e')};_0x16d996[_0xdf844e]=this[_0xca03('0xf')][_0xca03('0x3b')];this[_0xca03('0x10')][_0xca03('0x4f')](_0x16d996,_0x51ba85,this[_0xca03('0xf')][_0xca03('0x38')])[_0xca03('0x15')](function(_0x345ac3){_0x3c6b25(null,_['isNil'](_0x345ac3)?![]:!![]);})[_0xca03('0x17')](function(_0x19199e){logger[_0xca03('0x2d')](_0x19199e);_0x3c6b25(null,![]);});};AGIVertices['prototype'][_0xca03('0x50')]=function(_0x2e3830,_0x580a39){var _0x2e5e7d={'role':_0xca03('0x4e')};_0x2e5e7d[_0x2e3830]=this['channel'][_0xca03('0x3b')];this[_0xca03('0x10')][_0xca03('0x50')](_0x2e5e7d)[_0xca03('0x15')](function(_0x23b45e){_0x580a39(null,_[_0xca03('0x46')](_0x23b45e)?![]:!![]);})[_0xca03('0x17')](function(_0x1e8d39){logger[_0xca03('0x2d')](_0x1e8d39);_0x580a39(null,![]);});};AGIVertices[_0xca03('0x12')][_0xca03('0x51')]=function(_0x6db314,_0x2d3f5b){var _0x5809a8={'role':_0xca03('0x4e')};_0x5809a8[_0x6db314]=this[_0xca03('0xf')]['callerid'];this['rpc'][_0xca03('0x51')](_0x5809a8)[_0xca03('0x15')](function(_0xadd5b9){_0x2d3f5b(null,_['isNil'](_0xadd5b9)?![]:!![]);})[_0xca03('0x17')](function(_0x5c775d){logger[_0xca03('0x2d')](_0x5c775d);_0x2d3f5b(null,![]);});};AGIVertices[_0xca03('0x12')][_0xca03('0x52')]=function(_0xaaa0bd,_0x5383ea){var _0x271181={'role':'agent'};_0x271181[_0xaaa0bd]=this['channel'][_0xca03('0x3b')];var _0x43feca=_0xaaa0bd!=_0xca03('0x53')?util[_0xca03('0x54')](_0xca03('0x55'),_0xca03('0x56'),this[_0xca03('0xf')][_0xca03('0x3b')]):undefined;this[_0xca03('0x10')][_0xca03('0x52')](_0x271181,_0x43feca)['then'](function(_0x387f7b){_0x5383ea(null,_['isNil'](_0x387f7b)?![]:!![]);})[_0xca03('0x17')](function(_0x25a8d7){logger[_0xca03('0x2d')](_0x25a8d7);_0x5383ea(null,![]);});};AGIVertices['prototype'][_0xca03('0x57')]=function(_0x1d2b18,_0x5b6e72){sh[_0xca03('0x58')](_[_0xca03('0x59')](_0x1d2b18),function(_0x3f03e8,_0x2b83a8){var _0x45adbd=_0x2b83a8['replace'](/(\r\n|\n|\r)/gm,'');_0x5b6e72(null,_0x45adbd);});};AGIVertices[_0xca03('0x12')][_0xca03('0x5a')]=function(_0x5b0731,_0x5bf012){scripts[_0xca03('0x5a')](_0x5b0731[_0xca03('0x5b')],_0x5b0731['google_cloud_tts_text_type']||_0xca03('0x5c'),_0x5b0731[_0xca03('0x5c')],_0x5b0731[_0xca03('0x5d')]||'en-US',_0x5b0731[_0xca03('0x5e')]||'MALE',_0x5b0731['audioEncoding']||_0xca03('0x5f'))[_0xca03('0x15')](function(_0x17bbdb){_0x5bf012(null,_0x17bbdb);})[_0xca03('0x17')](function(_0x303bc4){_0x5bf012(_0x303bc4);});};AGIVertices[_0xca03('0x12')][_0xca03('0x60')]=function(_0x137a1a,_0x5d5d57){scripts['googleTTS'](_0x137a1a[_0xca03('0x5c')],_0x137a1a[_0xca03('0x61')]||'en',0x1)[_0xca03('0x15')](function(_0xd3124a){_0x5d5d57(null,_0xd3124a);})[_0xca03('0x17')](function(_0x12bc0a){_0x5d5d57(_0x12bc0a);});};AGIVertices[_0xca03('0x12')][_0xca03('0x62')]=function(_0x6f7977,_0x578c43){var _0x274257={'uri':_0x6f7977['url'],'method':_0x6f7977[_0xca03('0x63')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x6f7977[_0xca03('0x64')])==='number'&&parseInt(_0x6f7977[_0xca03('0x64')])>=0x1?parseInt(_0x6f7977[_0xca03('0x64')])*0x3e8:0x5*0x3e8};if(_[_0xca03('0x65')]([_0xca03('0x66'),'PUT'],_0x274257['method'][_0xca03('0x67')]())){try{_0x274257[_0xca03('0x68')]=_0x6f7977[_0xca03('0xc')]?JSON[_0xca03('0x69')](_0x6f7977[_0xca03('0xc')]):{};}catch(_0x289f69){logger[_0xca03('0x2d')](_0xca03('0x6a'),_0x289f69);}}try{_0x274257[_0xca03('0x6b')]=_0x6f7977[_0xca03('0xb')]?JSON['parse'](_0x6f7977[_0xca03('0xb')]):{};}catch(_0x3fcf40){logger['error'](_0xca03('0x6c'),_0x3fcf40);}if(_0x6f7977[_0xca03('0x6d')]){try{var _0x32e710=require(_0x6f7977[_0xca03('0x6d')])['sync'](this,_0x274257);_0x274257[_0xca03('0x6e')]=Mustache[_0xca03('0x6f')](_0x6f7977[_0xca03('0x70')],_0x32e710,{},['$$','$$']);if(_0x274257[_0xca03('0x6b')]){_0x274257[_0xca03('0x6b')]=JSON[_0xca03('0x69')](Mustache[_0xca03('0x6f')](JSON[_0xca03('0x71')](_0x274257[_0xca03('0x6b')]),_0x32e710,{},['$$','$$']));}if(_0x274257['body']){_0x274257[_0xca03('0x68')]=JSON[_0xca03('0x69')](Mustache[_0xca03('0x6f')](JSON['stringify'](_0x274257[_0xca03('0x68')]),_0x32e710,{},['$$','$$']));}}catch(_0x4e238a){logger['error'](_0xca03('0x72'),_0x4e238a);}}rp(_0x274257)[_0xca03('0x15')](function(_0x429b26){var _0x32266d={'statusCode':_0x429b26[_0xca03('0x73')]||0xc8,'statusMessage':_0x429b26['statusMessage']||'OK','headers':_0x429b26[_0xca03('0x6b')]||{},'body':_0x429b26[_0xca03('0x68')]||{}};_0x578c43(null,_0x32266d);})[_0xca03('0x17')](function(_0x135770){var _0x36424b={'statusCode':_0x135770[_0xca03('0x73')]||0x1f4,'statusMessage':_0x135770['message']||_0xca03('0x74'),'headers':_0x135770[_0xca03('0x75')][_0xca03('0x6b')]||{},'body':_0x135770['options'][_0xca03('0x68')]||{}};_0x578c43(null,_0x36424b);});};AGIVertices['prototype']['googleDialogflow']=function(_0x1df62e,_0x725175){scripts[_0xca03('0x76')](this[_0xca03('0xf')]['uniqueid'],_0x1df62e[_0xca03('0x77')],_0x1df62e['text'],_0x1df62e['dialogflow_language']||'en')[_0xca03('0x15')](function(_0x2e6b37){_0x725175(null,_0x2e6b37);})[_0xca03('0x17')](function(_0x491be9){_0x725175(_0x491be9);});};AGIVertices[_0xca03('0x12')]['googleDialogflowV2']=function(_0xc99a09,_0x77cf2f){scripts[_0xca03('0x78')](this['channel'][_0xca03('0x38')],_0xc99a09[_0xca03('0x79')],_0xc99a09[_0xca03('0x7a')],_0xc99a09['private_key'],_0xc99a09[_0xca03('0x5c')],_0xc99a09[_0xca03('0x7b')]||'en')[_0xca03('0x15')](function(_0x313b73){_0x77cf2f(null,_0x313b73);})[_0xca03('0x17')](function(_0x8299d8){_0x77cf2f(_0x8299d8);});};AGIVertices['prototype']['sestekNDA']=function(_0x5e95ee,_0x9506bf){scripts[_0xca03('0x7c')](this['channel'],_0x5e95ee)[_0xca03('0x15')](function(_0xf1af30){_0x9506bf(null,_0xf1af30);})[_0xca03('0x17')](function(_0x2c3e5c){_0x9506bf(_0x2c3e5c);});};AGIVertices[_0xca03('0x12')][_0xca03('0x7d')]=function(_0xc10e8f,_0x4fec5e){scripts[_0xca03('0x7d')](_0xc10e8f[_0xca03('0x77')],_0xc10e8f[_0xca03('0x5c')],_0xc10e8f[_0xca03('0x7e')]||_0xca03('0x7f'),_0xc10e8f[_0xca03('0x80')])['then'](function(_0x5e57b6){_0x4fec5e(null,_0x5e57b6);})[_0xca03('0x17')](function(_0x417b1e){_0x4fec5e(_0x417b1e);});};AGIVertices[_0xca03('0x12')][_0xca03('0x81')]=function(_0x5d95ec,_0x4e4e44,_0x3e16c8){scripts['ispeechASR'](_0x4e4e44,_0x5d95ec[_0xca03('0x77')],_0x5d95ec['ispeech_asr_language']||'en-US',this['isConfigured'](_0x5d95ec[_0xca03('0x82')])?_0x5d95ec[_0xca03('0x82')]:undefined)['then'](function(_0x5c5a8a){_0x3e16c8(null,_0x5c5a8a);})[_0xca03('0x17')](function(_0x39ccdd){_0x3e16c8(_0x39ccdd);});};AGIVertices[_0xca03('0x12')][_0xca03('0x83')]=function(_0x53b484,_0x37837b){scripts[_0xca03('0x83')](_0x53b484[_0xca03('0x84')],_0x53b484['aws_secret_access_key'],_0x53b484['aws_polly_region'],_0x53b484['aws_polly_voice']||'Amy',_0x53b484[_0xca03('0x5c')],_0x53b484['aws_text_type']||'text')[_0xca03('0x15')](function(_0x2e7f2c){_0x37837b(null,_0x2e7f2c);})[_0xca03('0x17')](function(_0x5e899e){_0x37837b(_0x5e899e);});};AGIVertices['prototype'][_0xca03('0x85')]=function(_0x54a889,_0x59e48b){scripts[_0xca03('0x85')](this[_0xca03('0xf')][_0xca03('0x38')],_0x54a889['aws_access_key_id'],_0x54a889['aws_secret_access_key'],_0x54a889[_0xca03('0x86')],_0x54a889['text'],_0x54a889[_0xca03('0x87')])[_0xca03('0x15')](function(_0x2bbb85){_0x59e48b(null,_0x2bbb85);})[_0xca03('0x17')](function(_0x39915f){_0x59e48b(_0x39915f);});};AGIVertices['prototype'][_0xca03('0x88')]=function(_0x4d6c34,_0x14357d,_0xccb60e){scripts['googleASR'](_0x14357d,_0x4d6c34[_0xca03('0x77')],_0x4d6c34[_0xca03('0x89')]||_0xca03('0x7f'))[_0xca03('0x15')](function(_0x290aff){_0xccb60e(null,_0x290aff);})[_0xca03('0x17')](function(_0x5c653d){_0xccb60e(_0x5c653d);});};AGIVertices[_0xca03('0x12')][_0xca03('0x8a')]=function(_0x4c5897,_0xf3ccc0,_0x160f8f){scripts[_0xca03('0x8a')](_0xf3ccc0,_0x4c5897[_0xca03('0x8b')],_0x4c5897['appsecret'],_0x4c5897['uri'])[_0xca03('0x15')](function(_0x492de3){_0x160f8f(null,_0x492de3);})[_0xca03('0x17')](function(_0x11936a){_0x160f8f(_0x11936a);});};AGIVertices['prototype'][_0xca03('0x8c')]=function(_0x169f2e){var _0x5d5710=_[_0xca03('0x65')](verticesWithRetry,_0x169f2e[_0xca03('0x39')])?_0x169f2e:_[_0xca03('0x8d')](_0x169f2e);for(var _0x549484 in _0x5d5710){if(_0x5d5710['hasOwnProperty'](_0x549484)){if(_0x5d5710[_0x549484]&&_[_0xca03('0x8e')](_0x5d5710[_0x549484])){if(_[_0xca03('0x65')](recursiveMapAttributes,_0x549484)){_0x5d5710[_0x549484]=this[_0xca03('0x8f')](_0x5d5710[_0x549484]);}else{_0x5d5710[_0x549484]=this[_0xca03('0x90')](_0x5d5710[_0x549484]);}}}}return _0x5d5710;};AGIVertices['prototype'][_0xca03('0x91')]=function(_0x5b31ea){for(var _0x5f23c6 in _0x5b31ea){if(_0x5b31ea[_0xca03('0x92')](_0x5f23c6)){if(_['isPlainObject'](_0x5b31ea[_0x5f23c6])){this[_0xca03('0x91')](_0x5b31ea[_0x5f23c6]);}else if(_['isArray'](_0x5b31ea[_0x5f23c6])){for(var _0x1db194=0x0;_0x1db194<_0x5b31ea[_0x5f23c6]['length'];_0x1db194++){this[_0xca03('0x91')](_0x5b31ea[_0x5f23c6][_0x1db194]);}}else if(_[_0xca03('0x8e')](_0x5b31ea[_0x5f23c6])){_0x5b31ea[_0x5f23c6]=this[_0xca03('0x90')](_0x5b31ea[_0x5f23c6]);}}}};AGIVertices[_0xca03('0x12')]['saveRestApiResult']=function(_0x2a948b,_0x4d89ff){for(var _0x1ab24c in _0x2a948b){if(_0x2a948b[_0xca03('0x92')](_0x1ab24c)){if(_[_0xca03('0x93')](_0x2a948b[_0x1ab24c])){if(!_[_0xca03('0x45')](_0x2a948b[_0x1ab24c])){this[_0xca03('0x94')](_0x2a948b[_0x1ab24c],util['format'](_0xca03('0x95'),_0x4d89ff,_0x1ab24c));}}else if(_[_0xca03('0x96')](_0x2a948b[_0x1ab24c])){for(var _0x13592b=0x0;_0x13592b<_0x2a948b[_0x1ab24c][_0xca03('0x97')];_0x13592b++){this[_0xca03('0x94')](_0x2a948b[_0x1ab24c][_0x13592b],util['format'](_0xca03('0x95'),_0x4d89ff,_0x1ab24c+'['+_0x13592b+']'));}}else{if(!_[_0xca03('0x46')](_0x2a948b[_0x1ab24c])){this['channel'][_0xca03('0x98')](util[_0xca03('0x54')](_0xca03('0x95'),_0x4d89ff,_0x1ab24c),_0x2a948b[_0x1ab24c]);}}}}};AGIVertices[_0xca03('0x12')][_0xca03('0x8f')]=function(_0x387b24){try{var _0x177ab2=JSON[_0xca03('0x69')](_0x387b24);this[_0xca03('0x91')](_0x177ab2);return JSON[_0xca03('0x71')](_0x177ab2);}catch(_0x8fe0b){return this[_0xca03('0x90')](_0x387b24);}};AGIVertices[_0xca03('0x12')][_0xca03('0x90')]=function(_0x2a1b4f){var _0x36938e=_0x2a1b4f[_0xca03('0x99')]('{');for(var _0x33affd=0x1;_0x33affd<_0x36938e['length'];_0x33affd+=0x1){var _0x45de94=_0x36938e[_0x33affd]['split']('}');if(_0x45de94[_0xca03('0x97')]>0x1){_0x2a1b4f=_0x2a1b4f[_0xca03('0x9a')]('{'+_0x45de94[0x0]+'}',this[_0xca03('0xf')]['getVariable'](_0x45de94[0x0])[_0xca03('0x9b')]||_0x45de94[0x0]);}}if(_0x36938e[_0xca03('0x97')]===0x1){return _0x2a1b4f[_0xca03('0x4c')]();}return this[_0xca03('0x90')](_0x2a1b4f);};AGIVertices[_0xca03('0x12')]['getAndSetVariable']=function(_0x56ca9d,_0x547c42){var _0x58e318=this[_0xca03('0xf')][_0xca03('0x13')](_0x56ca9d);if(_0x58e318[_0xca03('0x9c')]===-0x1){return _0x58e318;}logger[_0xca03('0x2f')](util[_0xca03('0x54')](_0xca03('0x9d'),_0x547c42,_0x58e318['extra']));return this[_0xca03('0xf')][_0xca03('0x98')](_0x547c42,_0x58e318[_0xca03('0x9b')]);};AGIVertices['prototype'][_0xca03('0x9e')]=function(_0x3ea927){return _0x3ea927&&_0x3ea927!=='0'&&_0x3ea927!=='-1'&&_0x3ea927!=='';};AGIVertices['prototype'][_0xca03('0x9f')]=function(_0x2f5f56){this[_0xca03('0x37')]['sync'](this,_0x2f5f56,'-');_0x2f5f56[_0xca03('0xa0')]=_0x2f5f56[_0xca03('0x9f')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xca03('0x12')]['mrcpsynth']=function(_0x444ba1){logger['info'](util[_0xca03('0x54')](_0xca03('0xa1'),_0x444ba1[_0xca03('0xa2')]));if(!this['isConfigured'](_0x444ba1[_0xca03('0x5c')])){return this['channel'][_0xca03('0xa3')](_0xca03('0xa4'));}var _0x2a7de0='\x22'+_0x444ba1[_0xca03('0x5c')]+'\x22';if(this[_0xca03('0x9e')](_0x444ba1['options'])){_0x2a7de0+=','+_0x444ba1[_0xca03('0x75')];}var _0x2f6d75=this['channel'][_0xca03('0x58')](_0xca03('0xa5'),_0x2a7de0);if(_0x2f6d75[_0xca03('0x9c')]===-0x1){return _0x2f6d75;}return this[_0xca03('0xf')][_0xca03('0xa3')](util[_0xca03('0x54')](_0xca03('0xa6'),_0x2a7de0));};AGIVertices['prototype'][_0xca03('0xa7')]=function(_0x591559){logger[_0xca03('0x2f')](util[_0xca03('0x54')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x591559[_0xca03('0xa2')]));if(!this['isConfigured'](_0x591559[_0xca03('0xa8')])){return this['channel']['noop'](_0xca03('0xa9'));}var _0x2af13e=_0x591559[_0xca03('0xa8')];if(this[_0xca03('0x9e')](_0x591559[_0xca03('0x75')])){_0x2af13e+=','+_0x591559[_0xca03('0x75')];}var _0x49231c=this['channel']['exec']('MRCPRecog',_0x2af13e);if(_0x49231c[_0xca03('0x9c')]===-0x1){return _0x49231c;}var _0x567285=this['getAndSetVariable'](_0xca03('0xaa'),_0xca03('0xab'));if(_0x567285['result']===-0x1){return _0x567285;}var _0x33e7ad=this[_0xca03('0xac')](_0xca03('0xad'),_0xca03('0xae'));if(_0x33e7ad[_0xca03('0x9c')]===-0x1){return _0x33e7ad;}var _0x2588d5=this[_0xca03('0xac')](_0xca03('0xaf'),_0xca03('0xb0'));if(_0x2588d5[_0xca03('0x9c')]===-0x1){return _0x2588d5;}return this[_0xca03('0xf')][_0xca03('0xa3')](util[_0xca03('0x54')](_0xca03('0xb1'),_0x2af13e));};AGIVertices[_0xca03('0x12')][_0xca03('0xb2')]=function(_0x13e023){logger[_0xca03('0x2f')](util['format'](_0xca03('0xb3'),_0x13e023[_0xca03('0xa2')]));return this[_0xca03('0xf')][_0xca03('0xb2')]([_0x13e023[_0xca03('0xb4')],_0x13e023[_0xca03('0xb5')]]);};AGIVertices['prototype']['answer']=function(_0x164b52){logger[_0xca03('0x2f')](util['format']('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x164b52[_0xca03('0xa2')]));if(this[_0xca03('0x9e')](_0x164b52['timeout'])){logger['info'](util[_0xca03('0x54')](_0xca03('0xb6'),_0x164b52[_0xca03('0x64')]));var _0x1f4a21=this[_0xca03('0xf')][_0xca03('0xb7')](_0x164b52[_0xca03('0x64')]);if(_0x1f4a21[_0xca03('0x9c')]===-0x1){return _0x1f4a21;}}return this[_0xca03('0xf')][_0xca03('0xb8')]();};AGIVertices[_0xca03('0x12')][_0xca03('0x4b')]=function(_0x3b3535){logger[_0xca03('0x2f')](util[_0xca03('0x54')](_0xca03('0xb9'),_0x3b3535[_0xca03('0xa2')]));if(!this['isConfigured'](_0x3b3535[_0xca03('0xba')])){return this['channel'][_0xca03('0x2d')](_0x3b3535,_0xca03('0xbb'));}_0x3b3535[_0xca03('0x4a')]=moment();if(this[_0xca03('0x9e')](_0x3b3535[_0xca03('0xbc')])){_0x3b3535[_0xca03('0x4a')]=moment()[_0xca03('0xbd')](_0x3b3535['delay'],_0xca03('0xbe'));}if(!this[_0xca03('0x9e')](_0x3b3535['callback_priority'])){_0x3b3535['callback_priority']=0x2;}this['createCmContact'][_0xca03('0xbf')](this,_0x3b3535);return this[_0xca03('0xf')]['noop'](util['format'](_0xca03('0xc0'),_0x3b3535[_0xca03('0x49')],_0x3b3535[_0xca03('0xba')],_0x3b3535[_0xca03('0x4a')]));};AGIVertices['prototype'][_0xca03('0xc1')]=function(_0x3a2f26){logger['info'](util[_0xca03('0x54')](_0xca03('0xc2'),_0x3a2f26[_0xca03('0xa2')]));var _0x5cbbf7=this['channel'][_0xca03('0x58')](_0x3a2f26[_0xca03('0xc3')],_0x3a2f26[_0xca03('0x75')]);if(_0x5cbbf7[_0xca03('0x9c')]===-0x1){return _0x5cbbf7;}return this['channel'][_0xca03('0xa3')](util['format'](_0xca03('0xc4'),_0x3a2f26['application'],_0x3a2f26['options']));};AGIVertices[_0xca03('0x12')][_0xca03('0xc5')]=function(_0x27815a){logger['info'](util['format'](_0xca03('0xc6'),_0x27815a['label']));if(!this[_0xca03('0x9e')](_0x27815a[_0xca03('0x5c')])){return this[_0xca03('0xf')][_0xca03('0xa3')](_0xca03('0xa4'));}var _0x39cd64='\x22'+_0x27815a[_0xca03('0x5c')]+'\x22';if(this[_0xca03('0x9e')](_0x27815a[_0xca03('0x75')])){_0x39cd64+=','+_0x27815a['options'];}var _0x3d2d4a=this[_0xca03('0xf')][_0xca03('0x58')](_0xca03('0xa5'),_0x39cd64);if(_0x3d2d4a[_0xca03('0x9c')]===-0x1){return _0x3d2d4a;}return this[_0xca03('0xf')][_0xca03('0xa3')](util['format'](_0xca03('0xa6'),_0x39cd64));};AGIVertices[_0xca03('0x12')][_0xca03('0xc7')]=function(_0x735f48){logger['info'](util[_0xca03('0x54')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x735f48[_0xca03('0xa2')]));if(!this[_0xca03('0x9e')](_0x735f48[_0xca03('0x5c')])){return this['channel'][_0xca03('0xa3')]('no\x20text\x20configured');}var _0x5200a0='\x22'+_0x735f48[_0xca03('0x5c')]+'\x22';if(this[_0xca03('0x9e')](_0x735f48[_0xca03('0x75')])){_0x5200a0+=','+_0x735f48[_0xca03('0x75')];}var _0x5d705a=this[_0xca03('0xf')][_0xca03('0x58')](_0xca03('0xa5'),_0x5200a0);if(_0x5d705a[_0xca03('0x9c')]===-0x1){return _0x5d705a;}return this[_0xca03('0xf')][_0xca03('0xa3')](util[_0xca03('0x54')]('Executed\x20command\x20MRCPSynth\x20%s',_0x5200a0));};AGIVertices[_0xca03('0x12')][_0xca03('0xc8')]=function(_0x2f3bef){logger[_0xca03('0x2f')](util[_0xca03('0x54')](_0xca03('0xc9'),_0x2f3bef['label']));if(!this['isConfigured'](_0x2f3bef[_0xca03('0xa8')])){return this['channel']['noop'](_0xca03('0xa9'));}var _0x31c99c=_0x2f3bef[_0xca03('0xa8')];if(this[_0xca03('0x9e')](_0x2f3bef[_0xca03('0x75')])){_0x31c99c+=','+_0x2f3bef[_0xca03('0x75')];}var _0x1023d6=this['channel'][_0xca03('0x58')](_0xca03('0xca'),_0x31c99c);if(_0x1023d6['result']===-0x1){return _0x1023d6;}var _0x358560=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0xca03('0xcb'));if(_0x358560[_0xca03('0x9c')]===-0x1){return _0x358560;}var _0x3fc64c=this[_0xca03('0xac')](_0xca03('0xad'),_0xca03('0xcc'));if(_0x3fc64c[_0xca03('0x9c')]===-0x1){return _0x3fc64c;}var _0x1a4c60=this['getAndSetVariable'](_0xca03('0xaf'),_0xca03('0xcd'));if(_0x1a4c60[_0xca03('0x9c')]===-0x1){return _0x1a4c60;}return this[_0xca03('0xf')][_0xca03('0xa3')](util[_0xca03('0x54')](_0xca03('0xb1'),_0x31c99c));};AGIVertices[_0xca03('0x12')][_0xca03('0xce')]=function(_0x41f87c){logger['info'](util[_0xca03('0x54')](_0xca03('0xcf'),_0x41f87c[_0xca03('0xa2')]));if(!this[_0xca03('0x9e')](_0x41f87c[_0xca03('0xa8')])){return this[_0xca03('0xf')][_0xca03('0xa3')](_0xca03('0xa9'));}var _0x2d4040=_0x41f87c[_0xca03('0xa8')];if(this[_0xca03('0x9e')](_0x41f87c[_0xca03('0x75')])){_0x2d4040+=','+_0x41f87c[_0xca03('0x75')];}var _0xe3a842=this[_0xca03('0xf')][_0xca03('0x58')](_0xca03('0xca'),_0x2d4040);if(_0xe3a842['result']===-0x1){return _0xe3a842;}var _0x1aadca=this[_0xca03('0xac')](_0xca03('0xaa'),_0xca03('0xd0'));if(_0x1aadca['result']===-0x1){return _0x1aadca;}var _0x52dbeb=this['getAndSetVariable'](_0xca03('0xad'),_0xca03('0xd1'));if(_0x52dbeb['result']===-0x1){return _0x52dbeb;}var _0x3aa16e=this[_0xca03('0xac')](_0xca03('0xaf'),'SESTEK_ASR_INSTANCE');if(_0x3aa16e[_0xca03('0x9c')]===-0x1){return _0x3aa16e;}return this[_0xca03('0xf')][_0xca03('0xa3')](util[_0xca03('0x54')](_0xca03('0xb1'),_0x2d4040));};AGIVertices['prototype'][_0xca03('0xd2')]=function(_0x287515){logger[_0xca03('0x2f')](util['format'](_0xca03('0xd3'),_0x287515[_0xca03('0xa2')]));if(!this['isConfigured'](_0x287515['odbc_id'])){return this[_0xca03('0xf')][_0xca03('0x2d')](_0x287515,_0xca03('0xd4'));}var _0x6017ac=this[_0xca03('0xd5')][_0xca03('0xbf')](this,_0x287515['odbc_id']);if(!_0x6017ac){return this[_0xca03('0xf')][_0xca03('0x2d')](_0x287515,_0xca03('0xd6'));}if(!this[_0xca03('0x9e')](_0x287515[_0xca03('0xd7')])){return this[_0xca03('0xf')]['error'](_0x287515,_0xca03('0xd8'));}var _0x190f4f=_0x287515['query'][_0xca03('0xd9')](/(\r\n|\n|\r)/gm,'\x20');this[_0xca03('0xf')][_0xca03('0xa3')](util[_0xca03('0x54')]('query:\x20%s',_0x190f4f));var _0x5caea2=this[_0xca03('0x2b')][_0xca03('0xbf')](this,_0x6017ac,_0x190f4f);this[_0xca03('0x37')][_0xca03('0xbf')](this,_0x287515,_0x190f4f);if(!this[_0xca03('0x9e')](_0x287515[_0xca03('0xda')])){return this[_0xca03('0xf')][_0xca03('0xa3')](_0xca03('0xdb'));}var _0x597c50=this[_0xca03('0x13')][_0xca03('0xbf')](this,_0x287515[_0xca03('0xda')]);if(!_0x597c50){return this[_0xca03('0xf')]['error'](_0x287515,_0xca03('0xdc'));}var _0x759704=this;_0x5caea2[_0xca03('0xdd')](function(_0x1b84b0,_0x42bd49){Object[_0xca03('0xde')](_0x1b84b0)[_0xca03('0xdd')](function(_0x130e64){_0x759704[_0xca03('0xf')][_0xca03('0x98')](util[_0xca03('0x54')](_0xca03('0xdf'),_0x597c50,_0x42bd49,_0x130e64),_0x1b84b0[_0x130e64]);});});this[_0xca03('0xf')][_0xca03('0x98')](util[_0xca03('0x54')](_0xca03('0xe0'),_0x597c50),_0x5caea2[_0xca03('0x97')]);return this['channel']['noop'](util['format']('variable\x20%s\x20set',_0x597c50));};AGIVertices[_0xca03('0x12')][_0xca03('0xe1')]=function(_0x490115){logger['debug'](util[_0xca03('0x54')](_0xca03('0xe2'),_0x490115[_0xca03('0xa2')]));if(!this['isConfigured'](_0x490115[_0xca03('0xe3')])){return this[_0xca03('0xf')][_0xca03('0x2d')](_0x490115,_0xca03('0xe4'));}var _0x1b2c6c=this[_0xca03('0x1e')][_0xca03('0xbf')](this,_0x490115[_0xca03('0xe3')]);if(!_0x1b2c6c){return this[_0xca03('0xf')][_0xca03('0x2d')](_0x490115,_0xca03('0xe5'));}var _0x207f33=this[_0xca03('0xf')]['exec'](_0xca03('0xe6'),[util[_0xca03('0x54')](_0xca03('0xe7'),_0x1b2c6c),_0x490115['timeout'],_0x490115[_0xca03('0xe8')],_0x490115[_0xca03('0x70')]]);if(_0x207f33['result']===-0x1){return _0x207f33;}return this[_0xca03('0xf')][_0xca03('0xa3')](util[_0xca03('0x54')]('Executed\x20command\x20%s',_0xca03('0xe6')));};AGIVertices[_0xca03('0x12')]['dialogflow']=function(_0x400a8a){logger[_0xca03('0x2f')](util['format']('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x400a8a[_0xca03('0xa2')]));if(!this[_0xca03('0x9e')](_0x400a8a[_0xca03('0x77')])){return this[_0xca03('0xf')][_0xca03('0xa3')](_0xca03('0xe9'));}if(!this[_0xca03('0x9e')](_0x400a8a[_0xca03('0x5c')])){return this[_0xca03('0xf')][_0xca03('0xa3')](_0xca03('0xa4'));}this[_0xca03('0xf')]['bot']=!![];this[_0xca03('0x37')](_0x400a8a);this['createSquareMessage'](_0x400a8a['text'],'in','','');this[_0xca03('0xf')]['noop'](util[_0xca03('0x54')](_0xca03('0xea'),_0x400a8a[_0xca03('0x5c')]));var _0x46c2cf=this[_0xca03('0x76')][_0xca03('0xbf')](this,_0x400a8a);if(_0x46c2cf){for(var _0x2f163d in _0x46c2cf){if(_0x46c2cf[_0xca03('0x92')](_0x2f163d)){this[_0xca03('0xf')][_0xca03('0x98')](util[_0xca03('0x54')](_0xca03('0xeb'),_0x2f163d[_0xca03('0x67')]()),_0x46c2cf[_0x2f163d]);}}this['createSquareMessage'](_0x46c2cf['speech'],'out','dialogflow','');return this[_0xca03('0xf')][_0xca03('0xa3')](util[_0xca03('0x54')]('Dialogflow\x20Result\x20%s',_0x46c2cf[_0xca03('0xec')]));}return this[_0xca03('0xf')][_0xca03('0x2d')](_0x400a8a,_0xca03('0xed'));};AGIVertices[_0xca03('0x12')][_0xca03('0xee')]=function(_0x159c47){logger[_0xca03('0x2f')](util[_0xca03('0x54')](_0xca03('0xef'),_0x159c47[_0xca03('0xa2')]));if(!this[_0xca03('0x9e')](_0x159c47[_0xca03('0x79')])){return this[_0xca03('0xf')]['noop'](_0xca03('0xf0'));}if(!this[_0xca03('0x9e')](_0x159c47[_0xca03('0x7a')])){return this['channel'][_0xca03('0xa3')](_0xca03('0xf1'));}if(!this[_0xca03('0x9e')](_0x159c47[_0xca03('0xf2')])){return this[_0xca03('0xf')][_0xca03('0xa3')](_0xca03('0xf3'));}if(!this[_0xca03('0x9e')](_0x159c47[_0xca03('0x7b')])){return this[_0xca03('0xf')][_0xca03('0xa3')](_0xca03('0xf4'));}if(!this[_0xca03('0x9e')](_0x159c47[_0xca03('0x5c')])){return this['channel'][_0xca03('0xa3')](_0xca03('0xa4'));}this[_0xca03('0xf')][_0xca03('0xf5')]=!![];this['createSquareDetailsReport'](_0x159c47);this[_0xca03('0x43')](_0x159c47['text'],'in','','');this[_0xca03('0xf')][_0xca03('0xa3')](util[_0xca03('0x54')](_0xca03('0xf6'),_0x159c47['text']));var _0x5f369c=this['googleDialogflowV2'][_0xca03('0xbf')](this,_0x159c47);if(_0x5f369c){for(var _0x1c622e in _0x5f369c){if(_0x5f369c['hasOwnProperty'](_0x1c622e)){if(_0x1c622e!==_0xca03('0xf7')){this[_0xca03('0xf')][_0xca03('0x98')](util[_0xca03('0x54')](_0xca03('0xeb'),_0x1c622e['toUpperCase']()),_0x5f369c[_0x1c622e]);}}}this[_0xca03('0x43')](_0x5f369c[_0xca03('0xec')],'out',_0xca03('0xee'),_0x5f369c['providerResponse']);return this[_0xca03('0xf')][_0xca03('0xa3')](util[_0xca03('0x54')](_0xca03('0xf8'),_0x5f369c[_0xca03('0xec')]));}return this[_0xca03('0xf')][_0xca03('0x2d')](_0x159c47,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0xca03('0x12')][_0xca03('0xf9')]=function(_0x47d8c9){logger[_0xca03('0x2f')](util['format'](_0xca03('0xfa'),_0x47d8c9[_0xca03('0xa2')]));if(!this[_0xca03('0x9e')](_0x47d8c9[_0xca03('0xfb')])){return this[_0xca03('0xf')][_0xca03('0xa3')](_0xca03('0xfc'));}if(!this[_0xca03('0x9e')](_0x47d8c9[_0xca03('0xfd')])){return this[_0xca03('0xf')][_0xca03('0xa3')](_0xca03('0xfe'));}if(!this[_0xca03('0x9e')](_0x47d8c9[_0xca03('0xff')])){return this['channel'][_0xca03('0xa3')]('no\x20password\x20configured');}if(!this[_0xca03('0x9e')](_0x47d8c9[_0xca03('0x100')])){return this[_0xca03('0xf')]['noop'](_0xca03('0xa4'));}this[_0xca03('0xf')]['bot']=!![];this['createSquareDetailsReport'](_0x47d8c9);this[_0xca03('0x43')](_0x47d8c9[_0xca03('0x5c')],'in','','');this[_0xca03('0xf')][_0xca03('0xa3')](util['format'](_0xca03('0x101'),_0x47d8c9['text']));var _0x1fd4b0=this[_0xca03('0x7c')][_0xca03('0xbf')](this,_0x47d8c9);if(_0x1fd4b0){for(var _0x1c0183 in _0x1fd4b0){if(_0x1fd4b0[_0xca03('0x92')](_0x1c0183)){this[_0xca03('0xf')][_0xca03('0x98')](util['format'](_0xca03('0x102'),_0x1c0183[_0xca03('0x67')]()),_0x1fd4b0[_0x1c0183]);}}this[_0xca03('0x43')](_0x1fd4b0[_0xca03('0xec')],'out',_0xca03('0xf9'),'');if(_0x1fd4b0['audiofile']){this['channel']['noop'](util[_0xca03('0x54')](_0xca03('0x103'),_0x1fd4b0[_0xca03('0x104')]));var _0x423861=this[_0xca03('0xf')][_0xca03('0x105')](_0x1fd4b0[_0xca03('0x104')]);try{fs[_0xca03('0x106')](_0x1fd4b0[_0xca03('0x104')]+_0xca03('0x107'));}catch(_0x34e46b){logger[_0xca03('0x2d')](_0x34e46b);}return _0x423861;}else{return this[_0xca03('0xf')][_0xca03('0xa3')](util[_0xca03('0x54')](_0xca03('0x108'),_0x1fd4b0['speech']));}}return this[_0xca03('0xf')]['error'](_0x47d8c9,_0xca03('0x109'));};AGIVertices[_0xca03('0x12')][_0xca03('0x10a')]=function(_0x59f3e6){logger[_0xca03('0x2f')](util[_0xca03('0x54')](_0xca03('0x10b'),_0x59f3e6['label']));return this[_0xca03('0xf')]['noop'](_0xca03('0x10a'));};AGIVertices[_0xca03('0x12')][_0xca03('0x10c')]=function(_0x4a9a45){logger['info'](util[_0xca03('0x54')](_0xca03('0x10d'),_0x4a9a45[_0xca03('0xa2')]));var _0x506c5d='';if(_0x4a9a45[_0xca03('0x10e')]){if(!this[_0xca03('0x9e')](_0x4a9a45['trunk_id'])){return this[_0xca03('0xf')][_0xca03('0x2d')](_0x4a9a45,_0xca03('0x10f'));}else{var _0x23b044=parseInt(_0x4a9a45[_0xca03('0x10e')],0xa);if(isNaN(_0x23b044)){_0x506c5d=_0x4a9a45['trunk_id'];}else{_0x506c5d=this[_0xca03('0x20')][_0xca03('0xbf')](this,_0x4a9a45['trunk_id']);if(!_0x506c5d){return this[_0xca03('0xf')][_0xca03('0x2d')](_0x4a9a45,'no\x20trunk\x20found');}}}}else if(_0x4a9a45[_0xca03('0x110')]){_0x506c5d=_0x4a9a45['trunk_name'];}else{return this[_0xca03('0xf')][_0xca03('0x2d')](_0x4a9a45,_0xca03('0x10f'));}var _0x44c889=this[_0xca03('0xf')][_0xca03('0x58')](_0xca03('0xe6'),[util[_0xca03('0x54')]('SIP/%s/%s',_0x506c5d,_0x4a9a45[_0xca03('0x49')]),_0x4a9a45[_0xca03('0x64')],_0x4a9a45[_0xca03('0xe8')],_0x4a9a45[_0xca03('0x70')]]);if(_0x44c889[_0xca03('0x9c')]===-0x1){return _0x44c889;}return this[_0xca03('0xf')][_0xca03('0xa3')](util[_0xca03('0x54')]('Executed\x20command\x20%s',_0xca03('0xe6')));};AGIVertices['prototype'][_0xca03('0x111')]=function(_0x49228e){logger[_0xca03('0x2f')](util[_0xca03('0x54')](_0xca03('0x112'),_0x49228e[_0xca03('0xa2')]));return this['channel'][_0xca03('0xa3')](_0xca03('0x111'));};AGIVertices[_0xca03('0x12')][_0xca03('0xd')]=function(_0x1bbe5c){logger['info'](util[_0xca03('0x54')](_0xca03('0x113'),_0x1bbe5c['label']));if(_0x1bbe5c['retry']===0x0){return this[_0xca03('0x9f')](_0x1bbe5c);}_0x1bbe5c['retry']-=0x1;if(!this[_0xca03('0x9e')](_0x1bbe5c[_0xca03('0x114')])){return this[_0xca03('0xf')]['error'](_0x1bbe5c,_0xca03('0x115'));}var _0x58c344=this[_0xca03('0x22')][_0xca03('0xbf')](this,_0x1bbe5c[_0xca03('0x114')]);if(!_0x58c344){return this[_0xca03('0xf')][_0xca03('0x2d')](_0x1bbe5c,_0xca03('0x116'));}if(!this[_0xca03('0x9e')](_0x1bbe5c[_0xca03('0xda')])){return this['channel'][_0xca03('0x2d')](_0xca03('0xdb'));}var _0x32a946=this['channel']['getData'](_0x58c344,_0x1bbe5c[_0xca03('0x117')],_0x1bbe5c[_0xca03('0x118')]);var _0x53263d=_0x32a946[_0xca03('0x9c')]?_0x32a946[_0xca03('0x9c')][_0xca03('0x4c')]():'';logger[_0xca03('0x2f')](_0xca03('0x119'),JSON[_0xca03('0x71')](_0x32a946));if(_0x32a946[_0xca03('0x9c')]===-0x1){this[_0xca03('0x37')][_0xca03('0xbf')](this,_0x1bbe5c,_0x53263d);return _0x32a946;}else if(_0x32a946[_0xca03('0x9b')]===_0xca03('0x64')){_0x32a946[_0xca03('0x9c')]=_0x53263d[_0xca03('0x97')]>=parseInt(_0x1bbe5c[_0xca03('0x11a')])?'x':'i';}else{_0x32a946[_0xca03('0x9c')]=_0x53263d['length']>=parseInt(_0x1bbe5c[_0xca03('0x11a')])&&_0x53263d[_0xca03('0x97')]<=parseInt(_0x1bbe5c['maxdigit'])?'x':'i';}var _0x210558=this[_0xca03('0x13')][_0xca03('0xbf')](this,_0x1bbe5c[_0xca03('0xda')]);if(!_0x210558){return this[_0xca03('0xf')][_0xca03('0x2d')](_0x1bbe5c,_0xca03('0xdc'));}this[_0xca03('0xf')]['setVariable'](_0x210558,_0x53263d);if(this[_0xca03('0x9e')](_0x1bbe5c[_0xca03('0x11b')])){var _0x2fe494=parseInt(_0x1bbe5c['hiddendigitsnum'],0xa);var _0x551ed0=rs[_0xca03('0x11c')]({'charset':'*','length':_0x2fe494});var _0x140dec=_0x53263d[_0xca03('0x97')];if(_0x140dec>0x0){if(_0x140dec>_0x2fe494){this[_0xca03('0x37')][_0xca03('0xbf')](this,_0x1bbe5c,_0x1bbe5c['hiddendigitspos']==='first'?_0x551ed0+_0x53263d[_0xca03('0x11d')](_0x2fe494):_0x53263d[_0xca03('0x11d')](0x0,_0x140dec-_0x2fe494)+_0x551ed0);}else{this[_0xca03('0x37')][_0xca03('0xbf')](this,_0x1bbe5c,rs['generate']({'charset':'*','length':_0x140dec}));}}else{this[_0xca03('0x37')][_0xca03('0xbf')](this,_0x1bbe5c,'');}}else{this['createSquareDetailsReport']['sync'](this,_0x1bbe5c,_0x53263d);}return _0x32a946;};AGIVertices[_0xca03('0x12')][_0xca03('0xe')]=function(_0x134ea8){logger['info'](util[_0xca03('0x54')](_0xca03('0x11e'),_0x134ea8['label']));return this[_0xca03('0xd')](_0x134ea8);};AGIVertices[_0xca03('0x12')][_0xca03('0x11f')]=function(_0x3847fb){logger[_0xca03('0x2f')](util[_0xca03('0x54')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x3847fb[_0xca03('0xa2')]));this[_0xca03('0x37')]['sync'](this,_0x3847fb,_0x3847fb[_0xca03('0x120')]);return this[_0xca03('0xf')]['noop'](util['format'](_0xca03('0x121'),_0x3847fb['goalname']));};AGIVertices[_0xca03('0x12')][_0xca03('0x122')]=function(_0x39de90){logger['info'](util[_0xca03('0x54')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x39de90['label']));if(!this[_0xca03('0x9e')](_0x39de90[_0xca03('0x84')])||!this[_0xca03('0x9e')](_0x39de90['aws_secret_access_key'])){return this[_0xca03('0xf')][_0xca03('0xa3')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x39de90[_0xca03('0x5c')])){return this[_0xca03('0xf')][_0xca03('0xa3')](_0xca03('0xa4'));}this[_0xca03('0xf')][_0xca03('0xa3')](util[_0xca03('0x54')](_0xca03('0x123'),_0x39de90[_0xca03('0x5c')]));var _0x5c5c8c=this[_0xca03('0x83')][_0xca03('0xbf')](this,_0x39de90);if(_0x5c5c8c){this[_0xca03('0xf')][_0xca03('0xa3')](util['format'](_0xca03('0x124'),_0x5c5c8c));var _0x59ecd5=this[_0xca03('0xf')][_0xca03('0x105')](_0x5c5c8c);try{fs[_0xca03('0x106')](_0x5c5c8c+_0xca03('0x107'));}catch(_0x3aa921){logger[_0xca03('0x2d')](_0x3aa921);}return _0x59ecd5;}return this[_0xca03('0xf')][_0xca03('0x2d')](_0x39de90,_0xca03('0x125'));};AGIVertices[_0xca03('0x12')][_0xca03('0x126')]=function(_0x1c59bc){logger[_0xca03('0x2f')](util['format'](_0xca03('0x127'),_0x1c59bc[_0xca03('0xa2')]));if(!this[_0xca03('0x9e')](_0x1c59bc[_0xca03('0x84')])||!this[_0xca03('0x9e')](_0x1c59bc['aws_secret_access_key'])){return this[_0xca03('0xf')][_0xca03('0xa3')](_0xca03('0x128'));}if(!this['isConfigured'](_0x1c59bc[_0xca03('0x87')])){return this[_0xca03('0xf')][_0xca03('0xa3')](_0xca03('0x129'));}if(!this[_0xca03('0x9e')](_0x1c59bc[_0xca03('0x5c')])){return this[_0xca03('0xf')]['noop']('no\x20text\x20configured');}this[_0xca03('0xf')]['bot']=!![];this[_0xca03('0x37')](_0x1c59bc);this[_0xca03('0x43')](_0x1c59bc[_0xca03('0x5c')],'in','','');this[_0xca03('0xf')][_0xca03('0xa3')](util[_0xca03('0x54')](_0xca03('0x12a'),_0x1c59bc[_0xca03('0x5c')]));var _0x4b5cbe=this['awsLex']['sync'](this,_0x1c59bc);if(_0x4b5cbe){for(var _0x520275 in _0x4b5cbe){if(_0x4b5cbe[_0xca03('0x92')](_0x520275)&&_[_0xca03('0x8e')](_0x4b5cbe[_0x520275])){this[_0xca03('0xf')]['setVariable'](util[_0xca03('0x54')](_0xca03('0x12b'),_0x520275[_0xca03('0x67')]()),_0x4b5cbe[_0x520275]);}}if(_[_0xca03('0x46')](_0x4b5cbe['message'])){return this[_0xca03('0xf')][_0xca03('0xa3')](_0xca03('0x12c'));}else{this[_0xca03('0x43')](_0x4b5cbe[_0xca03('0x12d')],'out',_0xca03('0x12e'),'');return this[_0xca03('0xf')]['noop'](util[_0xca03('0x54')](_0xca03('0x12f'),_0x4b5cbe[_0xca03('0x12d')]));}}return this['channel']['error'](_0x1c59bc,_0xca03('0x130'));};AGIVertices[_0xca03('0x12')][_0xca03('0x131')]=function(_0x5c4f63){logger[_0xca03('0x2f')](util[_0xca03('0x54')](_0xca03('0x132'),_0x5c4f63['label'],_0x5c4f63[_0xca03('0x64')]));if(!this[_0xca03('0x9e')](_0x5c4f63['key'])){return this[_0xca03('0xf')]['noop'](_0xca03('0xe9'));}var _0x31812d=_0xca03('0x133');var _0x14f6d8=util[_0xca03('0x54')]('%s/recordings/%s',FILES_PATH,rs[_0xca03('0x11c')](0x4));var _0x1a2d57=util[_0xca03('0x54')]('%s.%s',_0x14f6d8,_0x31812d);var _0x258431=!![];if(_0x5c4f63[_0xca03('0x134')]===_0xca03('0x135')){_0x258431=![];}var _0x1e564d=this[_0xca03('0xf')][_0xca03('0x136')](_0x14f6d8,_0x31812d,_0x5c4f63[_0xca03('0x137')],_0x5c4f63['timeout'],undefined,_0x258431);if(_0x1e564d['result']!==-0x1){this[_0xca03('0xf')][_0xca03('0xa3')](util[_0xca03('0x54')]('google\x20%s\x20file\x20created',_0x1a2d57));var _0x20c631=this['googleASR']['sync'](this,_0x5c4f63,_0x1a2d57);if(_0x20c631){for(var _0x2c5da6 in _0x20c631){if(_0x20c631[_0xca03('0x92')](_0x2c5da6)){this[_0xca03('0xf')]['setVariable'](util[_0xca03('0x54')]('GOOGLE_ASR_%s',_0x2c5da6[_0xca03('0x67')]()),_0x20c631[_0x2c5da6]);}}return this[_0xca03('0xf')][_0xca03('0xa3')](util[_0xca03('0x54')](_0xca03('0x138'),JSON[_0xca03('0x71')](_0x20c631)));}}return _0x1e564d;};AGIVertices[_0xca03('0x12')][_0xca03('0x139')]=function(_0x363168){logger['info'](util[_0xca03('0x54')](_0xca03('0x13a'),_0x363168[_0xca03('0xa2')]));if(!this[_0xca03('0x9e')](_0x363168[_0xca03('0x8b')])){return this['channel'][_0xca03('0xa3')](_0xca03('0x13b'));}if(!this[_0xca03('0x9e')](_0x363168['appsecret'])){return this[_0xca03('0xf')][_0xca03('0xa3')](_0xca03('0x13c'));}var _0x254685='wav';var _0x5dd1f9=util[_0xca03('0x54')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x1d577e=util[_0xca03('0x54')](_0xca03('0x95'),_0x5dd1f9,_0x254685);var _0x32c4d3=!![];if(_0x363168[_0xca03('0x134')]===_0xca03('0x135')){_0x32c4d3=![];}var _0x36ea8c=this[_0xca03('0xf')][_0xca03('0x136')](_0x5dd1f9,_0x254685,_0x363168[_0xca03('0x137')],_0x363168[_0xca03('0x64')],undefined,_0x32c4d3);if(_0x36ea8c[_0xca03('0x9c')]!==-0x1){this[_0xca03('0xf')][_0xca03('0xa3')](util[_0xca03('0x54')]('tilde\x20%s\x20file\x20created',_0x1d577e));var _0x13e7e1=this[_0xca03('0x8a')][_0xca03('0xbf')](this,_0x363168,_0x1d577e);if(_0x13e7e1){for(var _0x1a9d1c in _0x13e7e1){if(_0x13e7e1[_0xca03('0x92')](_0x1a9d1c)){this[_0xca03('0xf')]['setVariable'](util[_0xca03('0x54')](_0xca03('0x13d'),_0x1a9d1c[_0xca03('0x67')]()),_0x13e7e1[_0x1a9d1c]);}}return this[_0xca03('0xf')][_0xca03('0xa3')](util[_0xca03('0x54')](_0xca03('0x13e'),JSON[_0xca03('0x71')](_0x13e7e1)));}}return _0x36ea8c;};AGIVertices[_0xca03('0x12')][_0xca03('0x13f')]=function(_0x21faca){logger[_0xca03('0x2f')](util[_0xca03('0x54')](_0xca03('0x140'),_0x21faca['label']));return this[_0xca03('0xf')][_0xca03('0x141')](_0x21faca[_0xca03('0x3d')],_0x21faca[_0xca03('0x3e')],_0x21faca['priority']);};AGIVertices[_0xca03('0x12')]['gotoif']=function(_0x386e7f){logger[_0xca03('0x2f')](util[_0xca03('0x54')](_0xca03('0x142'),_0x386e7f['label']));if(!this['isConfigured'](_0x386e7f[_0xca03('0x143')])){return this[_0xca03('0xf')][_0xca03('0x2d')](_0x386e7f,_0xca03('0x144'));}try{var _0x38cb25=eval(_0x386e7f['condition'])?_0xca03('0x145'):_0xca03('0x146');this['channel']['noop'](util[_0xca03('0x54')](_0xca03('0x147'),_0x386e7f[_0xca03('0x143')],_0x38cb25));return{'code':0xc8,'result':_0x38cb25};}catch(_0x5c860a){return{'code':0xc8,'result':_0xca03('0x146')};}};AGIVertices['prototype'][_0xca03('0x148')]=function(_0x4fe639){logger[_0xca03('0x2f')](util[_0xca03('0x54')](_0xca03('0x149'),_0x4fe639[_0xca03('0xa2')]));if(!this[_0xca03('0x9e')](_0x4fe639[_0xca03('0x14a')])){return this[_0xca03('0xf')][_0xca03('0x2d')](_0x4fe639,'no\x20interval\x20configured');}var _0x2c544d=this[_0xca03('0x27')][_0xca03('0xbf')](this,_0x4fe639[_0xca03('0x14a')]);if(!_0x2c544d){return this[_0xca03('0xf')]['error'](_0x4fe639,'no\x20intervals\x20found');}for(var _0x1d328d=0x0;_0x1d328d<_0x2c544d[_0xca03('0x97')];_0x1d328d+=0x1){var _0x287b0f=this[_0xca03('0xf')][_0xca03('0x13')](util[_0xca03('0x54')](_0xca03('0x14b'),_0x2c544d[_0x1d328d]));if(_0x287b0f[_0xca03('0x9c')]===-0x1){return _0x287b0f;}logger[_0xca03('0x2f')](util[_0xca03('0x54')](_0xca03('0x14c'),_0x2c544d[_0x1d328d],_0x287b0f[_0xca03('0x9b')]));if(_0x287b0f[_0xca03('0x9b')]===_0xca03('0x145')){logger[_0xca03('0x2f')](util[_0xca03('0x54')](_0xca03('0x14c'),_0x2c544d[_0x1d328d],_0xca03('0x145')));this['channel'][_0xca03('0xa3')](util[_0xca03('0x54')]('IFTIME\x20%s\x20%s',_0x2c544d[_0x1d328d],'true'));return{'code':0xc8,'result':_0xca03('0x145')};}else{logger[_0xca03('0x2f')](util[_0xca03('0x54')](_0xca03('0x14c'),_0x2c544d[_0x1d328d],_0xca03('0x146')));this[_0xca03('0xf')]['noop'](util[_0xca03('0x54')](_0xca03('0x14c'),_0x2c544d[_0x1d328d],_0xca03('0x146')));}}return{'code':0xc8,'result':_0xca03('0x146')};};AGIVertices[_0xca03('0x12')]['hangup']=function(_0x2d7066){logger[_0xca03('0x2f')](util[_0xca03('0x54')](_0xca03('0x14d'),_0x2d7066[_0xca03('0xa2')]));return this[_0xca03('0xf')][_0xca03('0x14e')]();};AGIVertices[_0xca03('0x12')][_0xca03('0x14f')]=function(_0x42896f){logger[_0xca03('0x2f')](util['format'](_0xca03('0x150'),_0x42896f[_0xca03('0xa2')]));if(!this[_0xca03('0x9e')](_0x42896f[_0xca03('0x77')])){return this[_0xca03('0xf')]['noop'](_0xca03('0xe9'));}var _0x49e8ac='wav';var _0x4b95ab=util[_0xca03('0x54')](_0xca03('0x151'),FILES_PATH,rs[_0xca03('0x11c')](0x4));var _0x2d220e=util[_0xca03('0x54')](_0xca03('0x95'),_0x4b95ab,_0x49e8ac);var _0x30924d=!![];if(_0x42896f[_0xca03('0x134')]===_0xca03('0x135')){_0x30924d=![];}var _0x468d2e=this[_0xca03('0xf')][_0xca03('0x136')](_0x4b95ab,_0x49e8ac,_0x42896f[_0xca03('0x137')],_0x42896f[_0xca03('0x64')],undefined,_0x30924d);if(_0x468d2e[_0xca03('0x9c')]!==-0x1){this[_0xca03('0xf')]['noop'](util[_0xca03('0x54')](_0xca03('0x152'),_0x2d220e));var _0x83e3a2=this['ispeechASR']['sync'](this,_0x42896f,_0x2d220e);if(_0x83e3a2){for(var _0x3d1c66 in _0x83e3a2){if(_0x83e3a2[_0xca03('0x92')](_0x3d1c66)){this[_0xca03('0xf')][_0xca03('0x98')](util[_0xca03('0x54')](_0xca03('0x153'),_0x3d1c66[_0xca03('0x67')]()),_0x83e3a2[_0x3d1c66]);}}return this['channel'][_0xca03('0xa3')](util['format'](_0xca03('0x154'),JSON['stringify'](_0x83e3a2)));}}return _0x468d2e;};AGIVertices['prototype'][_0xca03('0x155')]=function(_0x29cc7e){logger['info'](util[_0xca03('0x54')](_0xca03('0x156'),_0x29cc7e[_0xca03('0xa2')]));if(!this[_0xca03('0x9e')](_0x29cc7e[_0xca03('0x77')])){return this[_0xca03('0xf')][_0xca03('0xa3')](_0xca03('0xe9'));}if(!this[_0xca03('0x9e')](_0x29cc7e['text'])){return this['channel'][_0xca03('0xa3')]('no\x20text\x20configured');}this['channel'][_0xca03('0xa3')](util[_0xca03('0x54')](_0xca03('0x157'),_0x29cc7e['text']));var _0x1db2ca=this[_0xca03('0x7d')][_0xca03('0xbf')](this,_0x29cc7e);if(_0x1db2ca){this[_0xca03('0xf')][_0xca03('0xa3')](util['format'](_0xca03('0x152'),_0x1db2ca));var _0x230627=this[_0xca03('0xf')][_0xca03('0x105')](_0x1db2ca,_0x29cc7e[_0xca03('0x137')]);try{fs[_0xca03('0x106')](_0x1db2ca+_0xca03('0x107'));}catch(_0x55c506){logger['error'](_0x55c506);}return _0x230627;}return this[_0xca03('0xf')][_0xca03('0x2d')](_0x29cc7e,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0xca03('0x12')]['login']=function(_0x1892fe){logger['info'](util['format']('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x1892fe[_0xca03('0xa2')]));if(!this[_0xca03('0x9e')](_0x1892fe[_0xca03('0x158')])){return this[_0xca03('0xf')][_0xca03('0x2d')](_0x1892fe,'no\x20find\x20by\x20configured');}logger[_0xca03('0x2f')](util[_0xca03('0x54')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xca03('0xf')]['callerid'],_0x1892fe['findBy']));var _0x443870=this[_0xca03('0x52')][_0xca03('0xbf')](this,_0x1892fe[_0xca03('0x158')]);if(_0x443870){logger[_0xca03('0x2f')](util[_0xca03('0x54')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xca03('0xf')][_0xca03('0x3b')],_0x1892fe[_0xca03('0x158')]));this[_0xca03('0xf')][_0xca03('0xa3')](util[_0xca03('0x54')](_0xca03('0x159'),this[_0xca03('0xf')][_0xca03('0x3b')],_0x1892fe['findBy']));return{'code':0xc8,'result':_0xca03('0x15a')};}else{logger['info'](util[_0xca03('0x54')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xca03('0x3b')],_0x1892fe[_0xca03('0x158')]));this[_0xca03('0xf')][_0xca03('0xa3')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xca03('0x3b')],_0x1892fe[_0xca03('0x158')]));return{'code':0xc8,'result':_0xca03('0x15b')};}};AGIVertices[_0xca03('0x12')][_0xca03('0x15c')]=function(_0x3eb812){logger[_0xca03('0x2f')](util[_0xca03('0x54')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x3eb812[_0xca03('0xa2')]));if(!this['isConfigured'](_0x3eb812[_0xca03('0x158')])){return this[_0xca03('0xf')][_0xca03('0x2d')](_0x3eb812,_0xca03('0x15d'));}logger['info'](util[_0xca03('0x54')](_0xca03('0x15e'),this['channel'][_0xca03('0x3b')],_0x3eb812[_0xca03('0x158')]));var _0x52f037=this[_0xca03('0x51')][_0xca03('0xbf')](this,_0x3eb812[_0xca03('0x158')]);if(_0x52f037){logger[_0xca03('0x2f')](util['format'](_0xca03('0x159'),this[_0xca03('0xf')][_0xca03('0x3b')],_0x3eb812[_0xca03('0x158')]));this[_0xca03('0xf')]['noop'](util[_0xca03('0x54')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xca03('0x3b')],_0x3eb812[_0xca03('0x158')]));return{'code':0xc8,'result':_0xca03('0x15a')};}else{logger[_0xca03('0x2f')](util[_0xca03('0x54')](_0xca03('0x15f'),this[_0xca03('0xf')][_0xca03('0x3b')],_0x3eb812[_0xca03('0x158')]));this[_0xca03('0xf')][_0xca03('0xa3')](util[_0xca03('0x54')](_0xca03('0x15f'),this[_0xca03('0xf')][_0xca03('0x3b')],_0x3eb812[_0xca03('0x158')]));return{'code':0xc8,'result':_0xca03('0x15b')};}};AGIVertices['prototype'][_0xca03('0x160')]=function(_0x3c650d){logger[_0xca03('0x2f')](util[_0xca03('0x54')](_0xca03('0x161'),_0x3c650d[_0xca03('0xa2')]));if(!this[_0xca03('0x9e')](_0x3c650d['operation'])){return this['channel'][_0xca03('0x2d')](_0x3c650d,'no\x20operation\x20configured');}this[_0xca03('0xf')][_0xca03('0xa3')](util[_0xca03('0x54')]('math\x20%s',_0x3c650d[_0xca03('0x162')]));var _0x42671e=eval(_0x3c650d['operation']);if(!this[_0xca03('0x9e')](_0x3c650d[_0xca03('0xda')])){return this['channel']['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x1e7e5b=this['getVariable'][_0xca03('0xbf')](this,_0x3c650d[_0xca03('0xda')]);if(!_0x1e7e5b){return this[_0xca03('0xf')][_0xca03('0x2d')](_0x3c650d,_0xca03('0xdc'));}if(_['isArray'](_0x42671e)){var _0x1ffddb=this;_0x42671e['forEach'](function(_0x437fa5,_0x805886){_0x1ffddb[_0xca03('0xf')][_0xca03('0x98')](util[_0xca03('0x54')](_0xca03('0x163'),_0x1e7e5b,_0x805886),_0x437fa5);});return this[_0xca03('0xf')][_0xca03('0xa3')](util['format'](_0xca03('0x164'),_0x1e7e5b));}else{return this['channel'][_0xca03('0x98')](_0x1e7e5b,_0x42671e);}};AGIVertices[_0xca03('0x12')]['menu']=function(_0x53b254){logger['info'](util['format']('Enter\x20in\x20MENU\x20(%s)\x20block',_0x53b254[_0xca03('0xa2')]));if(_0x53b254[_0xca03('0xa0')]===0x0){return this[_0xca03('0x9f')](_0x53b254);}_0x53b254[_0xca03('0xa0')]-=0x1;if(!this[_0xca03('0x9e')](_0x53b254[_0xca03('0x114')])){return this['channel'][_0xca03('0x2d')](_0x53b254,'no\x20file\x20audio\x20selected');}var _0x4a5a51=this[_0xca03('0x22')][_0xca03('0xbf')](this,_0x53b254[_0xca03('0x114')]);if(!_0x4a5a51){return this[_0xca03('0xf')][_0xca03('0x2d')](_0x53b254,_0xca03('0x116'));}var _0x58cf7a=this[_0xca03('0xf')][_0xca03('0x165')](_0x4a5a51,_0x53b254[_0xca03('0x117')],_0x53b254['digit']);var _0xe7b0d6=_0x58cf7a['result'];if(_0x58cf7a[_0xca03('0x9c')]===-0x1){this[_0xca03('0x37')][_0xca03('0xbf')](this,_0x53b254,'-1');return _0x58cf7a;}else if(_0x58cf7a[_0xca03('0x9b')]===_0xca03('0x64')){_0x58cf7a[_0xca03('0x9c')]=_0x58cf7a[_0xca03('0x9c')][_0xca03('0x97')]>0x0?_0x58cf7a[_0xca03('0x9c')]:'t';}else if(_[_0xca03('0x45')](_0x58cf7a[_0xca03('0x9c')])){_0x58cf7a[_0xca03('0x9c')]='#';_0xe7b0d6='#';}if(!this['isConfigured'](_0x53b254[_0xca03('0xda')])){this['channel']['noop'](_0xca03('0xdb'));}else{var _0xf9420e=this[_0xca03('0x13')]['sync'](this,_0x53b254[_0xca03('0xda')]);if(!_0xf9420e){return this[_0xca03('0xf')][_0xca03('0x2d')](_0x53b254,'no\x20variable\x20found');}this[_0xca03('0xf')][_0xca03('0x98')](_0xf9420e,_0xe7b0d6);}this[_0xca03('0x37')][_0xca03('0xbf')](this,_0x53b254,_0xe7b0d6);return _0x58cf7a;};AGIVertices[_0xca03('0x12')][_0xca03('0xa3')]=function(_0x5767f3){logger[_0xca03('0x2f')](util[_0xca03('0x54')](_0xca03('0x166'),_0x5767f3[_0xca03('0xa2')]));return this[_0xca03('0xf')][_0xca03('0xa3')](_0x5767f3[_0xca03('0x167')]||_0x5767f3[_0xca03('0xa2')]);};AGIVertices[_0xca03('0x12')][_0xca03('0x168')]=function(_0x442609){logger['info'](util[_0xca03('0x54')](_0xca03('0x169'),_0x442609['label']));if(!this[_0xca03('0x9e')](_0x442609[_0xca03('0x158')])){return this[_0xca03('0xf')]['error'](_0x442609,_0xca03('0x15d'));}logger[_0xca03('0x2f')](util['format'](_0xca03('0x15e'),this['channel'][_0xca03('0x3b')],_0x442609[_0xca03('0x158')]));var _0x1cf13c=this['getPause'][_0xca03('0xbf')](this,_0x442609[_0xca03('0x16a')]);var _0x284d03=this['agentPause'][_0xca03('0xbf')](this,_0x442609[_0xca03('0x158')],_0x1cf13c);if(_0x284d03){logger[_0xca03('0x2f')](util[_0xca03('0x54')](_0xca03('0x159'),this['channel'][_0xca03('0x3b')],_0x442609[_0xca03('0x158')]));this[_0xca03('0xf')][_0xca03('0xa3')](util[_0xca03('0x54')](_0xca03('0x159'),this[_0xca03('0xf')][_0xca03('0x3b')],_0x442609[_0xca03('0x158')]));return{'code':0xc8,'result':_0xca03('0x15a')};}else{logger['info'](util[_0xca03('0x54')](_0xca03('0x15f'),this['channel'][_0xca03('0x3b')],_0x442609['findBy']));this[_0xca03('0xf')]['noop'](util[_0xca03('0x54')](_0xca03('0x159'),this['channel'][_0xca03('0x3b')],_0x442609[_0xca03('0x158')]));return{'code':0xc8,'result':_0xca03('0x15b')};}};AGIVertices[_0xca03('0x12')][_0xca03('0x16b')]=function(_0x52f18a){logger[_0xca03('0x2f')](util['format'](_0xca03('0x16c'),_0x52f18a[_0xca03('0xa2')]));if(!this[_0xca03('0x9e')](_0x52f18a['file_id'])){return this[_0xca03('0xf')][_0xca03('0x2d')](_0x52f18a,_0xca03('0x115'));}var _0x187e4d=this['getSound']['sync'](this,_0x52f18a[_0xca03('0x114')]);if(!_0x187e4d){return this['channel'][_0xca03('0x2d')](_0x52f18a,_0xca03('0x116'));}var _0x52de68=this[_0xca03('0xf')][_0xca03('0x58')]('PLAYBACK',[_0x187e4d,_0x52f18a[_0xca03('0xe8')]]);if(_0x52de68[_0xca03('0x9c')]===-0x1){return _0x52de68;}return this['channel'][_0xca03('0xa3')](util[_0xca03('0x54')](_0xca03('0xc4'),_0xca03('0x16d'),_0x187e4d));};AGIVertices[_0xca03('0x12')][_0xca03('0x16e')]=function(_0x4f7b55){logger[_0xca03('0x2f')](util[_0xca03('0x54')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x4f7b55[_0xca03('0xa2')]));if(!this[_0xca03('0x9e')](_0x4f7b55[_0xca03('0x16f')])){return this[_0xca03('0xf')][_0xca03('0x2d')](_0x4f7b55,_0xca03('0x170'));}var _0x5635fd='';var _0x27b3c8=parseInt(_0x4f7b55['queue_id'],0xa);if(isNaN(_0x27b3c8)){_0x5635fd=_0x4f7b55[_0xca03('0x16f')];}else{_0x5635fd=this[_0xca03('0x18')][_0xca03('0xbf')](this,_0x4f7b55[_0xca03('0x16f')]);if(!_0x5635fd){return this[_0xca03('0xf')][_0xca03('0x2d')](_0x4f7b55,_0xca03('0x171'));}}var _0x55a635='';if(this[_0xca03('0x9e')](_0x4f7b55[_0xca03('0x114')])){var _0x579a01=this[_0xca03('0x22')][_0xca03('0xbf')](this,_0x4f7b55[_0xca03('0x114')]);if(_0x579a01){_0x55a635=_0x579a01;}}this[_0xca03('0x37')][_0xca03('0xbf')](this,_0x4f7b55,_0x5635fd);if(_0x4f7b55['opts'][_0xca03('0x172')]('x')<0x0){_0x4f7b55[_0xca03('0xe8')]+='x';}if(_0x4f7b55[_0xca03('0xe8')][_0xca03('0x172')]('X')<0x0){_0x4f7b55['opts']+='X';}this[_0xca03('0xf')][_0xca03('0x98')](_0xca03('0x173'),_0x5635fd?_0x5635fd['toLowerCase']():'');var _0x25aaae=this['channel'][_0xca03('0x58')]('QUEUE',[_0x5635fd,_0x4f7b55[_0xca03('0xe8')],_0x4f7b55['url'],_0x55a635,_0x4f7b55['timeout'],_0x4f7b55[_0xca03('0xb2')],_0x4f7b55[_0xca03('0x174')],_0x4f7b55['gosub'],'',_0x4f7b55[_0xca03('0x175')]]);if(_0x25aaae[_0xca03('0x9c')]===-0x1){return _0x25aaae;}return this[_0xca03('0xf')]['noop'](util[_0xca03('0x54')](_0xca03('0xc4'),_0xca03('0x176'),_0x5635fd));};AGIVertices[_0xca03('0x12')]['record']=function(_0x3ba2ba){logger[_0xca03('0x2f')](util[_0xca03('0x54')](_0xca03('0x177'),_0x3ba2ba['label']));var _0x573a2c=_0x3ba2ba['recordingFormat']||_0xca03('0x133');var _0x33a90b=util[_0xca03('0x54')](_0xca03('0x178'),this[_0xca03('0xf')][_0xca03('0x38')],rs[_0xca03('0x11c')](0x5));var _0x20d49a=util[_0xca03('0x54')](_0xca03('0x179'),FILES_PATH,_0x33a90b,_0x573a2c);var _0x589afc=util[_0xca03('0x54')](_0xca03('0x151'),FILES_PATH,_0x33a90b);this[_0xca03('0x3c')]['sync'](this,_0x3ba2ba,_0x33a90b,_0x20d49a);this['channel']['setVariable'](_0xca03('0x17a'),_0x33a90b);logger[_0xca03('0x2f')](_0xca03('0x17b'),_0x589afc,_0x573a2c,_0x3ba2ba[_0xca03('0x17c')],_0x3ba2ba[_0xca03('0x64')]);return this[_0xca03('0xf')][_0xca03('0x136')](_0x589afc,_0x573a2c,_0x3ba2ba['escape_digits'],_0x3ba2ba['timeout'],undefined,!![]);};AGIVertices['prototype'][_0xca03('0x17d')]=function(_0x54798e){logger['info'](util['format'](_0xca03('0x17e'),_0x54798e[_0xca03('0xa2')]));if(!this['isConfigured'](_0x54798e[_0xca03('0x70')])){return this[_0xca03('0xf')][_0xca03('0xa3')](_0xca03('0x17f'));}var _0x1ba8fd=this[_0xca03('0x62')]['sync'](this,_0x54798e);logger['info'](util['format'](_0xca03('0x180'),util[_0xca03('0x181')](_0x1ba8fd,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x54798e['variable_id'])){return this[_0xca03('0xf')]['noop'](_0xca03('0x182'));}var _0x45083d=this[_0xca03('0x13')][_0xca03('0xbf')](this,_0x54798e[_0xca03('0xda')]);if(!_0x45083d){return this[_0xca03('0xf')][_0xca03('0x2d')](_0x54798e,_0xca03('0xdc'));}this['channel'][_0xca03('0x98')](util['format']('%s_STATUS_CODE',_0x45083d),_0x1ba8fd[_0xca03('0x73')]?_0x1ba8fd[_0xca03('0x73')]:_0xca03('0x183'));this[_0xca03('0xf')][_0xca03('0x98')](util[_0xca03('0x54')](_0xca03('0x184'),_0x45083d),_0x1ba8fd[_0xca03('0x185')]?_0x1ba8fd[_0xca03('0x185')]:'OK');if(_0x1ba8fd[_0xca03('0x68')]){try{this['saveRestApiResult'](_0x1ba8fd[_0xca03('0x68')],_0x45083d);}catch(_0x1fc018){logger[_0xca03('0x2d')](util[_0xca03('0x54')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x45083d));}}return this[_0xca03('0xf')][_0xca03('0xa3')](util[_0xca03('0x54')](_0xca03('0x186'),_0x45083d));};AGIVertices['prototype'][_0xca03('0x187')]=function(_0x38d674){logger['info'](util[_0xca03('0x54')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x38d674[_0xca03('0xa2')]));return this[_0xca03('0xf')][_0xca03('0x188')](_0x38d674['digits']['replace'](/\s+/g,''),_0x38d674[_0xca03('0x17c')]);};AGIVertices['prototype'][_0xca03('0x189')]=function(_0x236591){logger[_0xca03('0x2f')](util[_0xca03('0x54')](_0xca03('0x18a'),_0x236591[_0xca03('0xa2')]));return this[_0xca03('0xf')][_0xca03('0x18b')](_0x236591[_0xca03('0x18c')]['replace'](/\s+/g,''),_0x236591['escape_digits']);};AGIVertices[_0xca03('0x12')][_0xca03('0x18d')]=function(_0x9f7f7f){logger[_0xca03('0x2f')](util[_0xca03('0x54')](_0xca03('0x18e'),_0x9f7f7f[_0xca03('0xa2')]));return this['channel'][_0xca03('0x18f')](_0x9f7f7f[_0xca03('0x5c')],_0x9f7f7f['escape_digits']);};AGIVertices[_0xca03('0x12')][_0xca03('0x190')]=function(_0x4c20aa){logger[_0xca03('0x2f')](util[_0xca03('0x54')](_0xca03('0x191'),_0x4c20aa[_0xca03('0xa2')]));if(!this[_0xca03('0x9e')](_0x4c20aa[_0xca03('0x192')])){return this[_0xca03('0xf')][_0xca03('0xa3')](_0xca03('0x193'));}var _0x2e125e=this['getMailAccount'][_0xca03('0xbf')](this,_0x4c20aa[_0xca03('0x192')]);if(!_0x2e125e||!_0x2e125e[_0xca03('0x194')]){return this[_0xca03('0xf')]['error'](_0x4c20aa,'no\x20mail\x20account\x20found');}var _0x355a80={'from':util[_0xca03('0x54')](_0xca03('0x195'),_0x2e125e[_0xca03('0x16')],_0x2e125e[_0xca03('0x196')]||_0x2e125e[_0xca03('0x194')]['user']),'to':_0x4c20aa['to']||'','cc':_0x4c20aa['cc']||'','bcc':_0x4c20aa[_0xca03('0x197')]||'','subject':_0x4c20aa['subject'],'html':_0x4c20aa[_0xca03('0x5c')],'text':_0x4c20aa[_0xca03('0x5c')]};if(this['isConfigured'](_0x4c20aa[_0xca03('0x198')])){}logger[_0xca03('0x199')](_0xca03('0x19a'),JSON[_0xca03('0x71')](_0x355a80));this[_0xca03('0x37')][_0xca03('0xbf')](this,_0x4c20aa,_0x4c20aa[_0xca03('0x192')]);this[_0xca03('0xf')]['noop'](util['format'](_0xca03('0x19b'),_0x2e125e[_0xca03('0x16')]));this['sendMailMessage'][_0xca03('0xbf')](this,_0x2e125e[_0xca03('0x19c')],_0x355a80);return this['channel'][_0xca03('0xa3')](_0xca03('0x19d'));};AGIVertices[_0xca03('0x12')]['sendFax']=function(_0x5b0c87){logger[_0xca03('0x2f')](util[_0xca03('0x54')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x5b0c87[_0xca03('0xa2')]));return this[_0xca03('0xf')][_0xca03('0xa3')](_0xca03('0x19e'));};AGIVertices[_0xca03('0x12')]['sendSMS']=function(_0x5a74a0){logger[_0xca03('0x2f')](util['format']('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x5a74a0[_0xca03('0xa2')]));if(!this[_0xca03('0x9e')](_0x5a74a0[_0xca03('0x19f')])){return this[_0xca03('0xf')][_0xca03('0xa3')](_0xca03('0x1a0'));}var _0x4a70ac=this[_0xca03('0x34')][_0xca03('0xbf')](this,_0x5a74a0['sms_account_id']);if(!_0x4a70ac){return this[_0xca03('0xf')]['error'](_0x5a74a0,'no\x20sms\x20account\x20found');}var _0x2cc953={'body':_0x5a74a0['sms_text'],'phone':_0x5a74a0['to']||'','SmsAccountId':_0x4a70ac['id']};logger['debug'](_0xca03('0x1a1'),JSON[_0xca03('0x71')](_0x2cc953));this['createSquareDetailsReport'][_0xca03('0xbf')](this,_0x5a74a0,_0x5a74a0[_0xca03('0x19f')]);this[_0xca03('0xf')][_0xca03('0xa3')](util[_0xca03('0x54')](_0xca03('0x1a2'),_0x4a70ac[_0xca03('0x16')]));this[_0xca03('0x36')]['sync'](this,_0x2cc953);return this[_0xca03('0xf')][_0xca03('0xa3')](_0xca03('0x1a3'));};AGIVertices['prototype'][_0xca03('0x1a4')]=function(_0x28b827){logger[_0xca03('0x2f')](util[_0xca03('0x54')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x28b827[_0xca03('0xa2')]));if(!this[_0xca03('0x9e')](_0x28b827['variable_id'])){return this['channel'][_0xca03('0x2d')](_0x28b827,'no\x20variable\x20selected');}var _0x4695fd=this[_0xca03('0x13')][_0xca03('0xbf')](this,_0x28b827[_0xca03('0xda')]);if(!_0x4695fd){return this[_0xca03('0xf')]['error'](_0x28b827,_0xca03('0xdc'));}return this['channel']['setVariable'](_0x4695fd,_0x28b827['variable_value']);};AGIVertices[_0xca03('0x12')][_0xca03('0x1a5')]=function(_0x5624a9){logger[_0xca03('0x2f')](util['format'](_0xca03('0x1a6'),_0x5624a9[_0xca03('0xa2')]));this[_0xca03('0xf')][_0xca03('0xa3')](_0xca03('0x1a7'));if(_0x5624a9['answer']==='yes'){this[_0xca03('0xf')][_0xca03('0xa3')](_0xca03('0x1a8'));return this['channel'][_0xca03('0xb8')]();}return this[_0xca03('0xf')]['noop']('Skipped\x20Answer');};AGIVertices[_0xca03('0x12')][_0xca03('0x1a9')]=function(_0x469e13){logger['info'](util[_0xca03('0x54')](_0xca03('0x1aa'),_0x469e13[_0xca03('0xa2')]));if(!this[_0xca03('0x9e')](_0x469e13[_0xca03('0x1ab')])){return this['channel'][_0xca03('0x2d')](_0x469e13,_0xca03('0x1ac'));}var _0x32b351=this[_0xca03('0x1a')][_0xca03('0xbf')](this,_0x469e13[_0xca03('0x1ab')]);if(!this[_0xca03('0x9e')](_0x32b351)){return this[_0xca03('0xf')][_0xca03('0x2d')](_0x469e13,util['format']('no\x20subproject\x20found\x20with\x20id\x20%d',_0x469e13[_0xca03('0x1ab')]));}if(_0x32b351===this[_0xca03('0xf')][_0xca03('0x3a')]){return this[_0xca03('0xf')]['error'](_0x469e13,_0xca03('0x1ad'));}this[_0xca03('0x37')][_0xca03('0xbf')](this,_0x469e13,_0x32b351);var _0x1e78ad=this[_0xca03('0xf')][_0xca03('0x58')](_0xca03('0x1ae'),util[_0xca03('0x54')](_0xca03('0x1af'),config[_0xca03('0xb2')][_0xca03('0x1b0')]||_0xca03('0x1b1'),_0x32b351,this['channel'][_0xca03('0x3a')]));if(_0x1e78ad[_0xca03('0x9c')]===-0x1){return _0x1e78ad;}return this[_0xca03('0xf')]['noop'](util['format'](_0xca03('0xc4'),_0xca03('0x1ae'),_0x32b351));};AGIVertices['prototype'][_0xca03('0x1b2')]=function(_0x437d72){logger[_0xca03('0x2f')](util[_0xca03('0x54')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x437d72[_0xca03('0xa2')]));var _0x4ae4f9=this[_0xca03('0x57')][_0xca03('0xbf')](this,_0x437d72['command']);this[_0xca03('0x37')][_0xca03('0xbf')](this,_0x437d72,_0x437d72[_0xca03('0xb4')]);if(this[_0xca03('0x9e')](_0x437d72[_0xca03('0xda')])){var _0x936344=this['getVariable'][_0xca03('0xbf')](this,_0x437d72[_0xca03('0xda')]);if(_0x936344){this[_0xca03('0xf')][_0xca03('0x98')](_0x936344,_0x4ae4f9);return this[_0xca03('0xf')][_0xca03('0xa3')](util[_0xca03('0x54')](_0xca03('0x1b3'),_0x437d72['command'],_0x936344));}}return this[_0xca03('0xf')][_0xca03('0xa3')](util['format'](_0xca03('0x1b4'),_0x437d72[_0xca03('0xb4')]));};AGIVertices[_0xca03('0x12')][_0xca03('0x1b5')]=function(_0x5050ba){logger[_0xca03('0x2f')](util['format'](_0xca03('0x1b6'),_0x5050ba[_0xca03('0xa2')]));_0x5050ba['text']=_0x5050ba[_0xca03('0x5c')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xca03('0x9e')](_0x5050ba[_0xca03('0x5b')])){return this[_0xca03('0xf')]['noop'](_0xca03('0x1b7'));}if(!this[_0xca03('0x9e')](_0x5050ba[_0xca03('0x5c')])){return this[_0xca03('0xf')][_0xca03('0xa3')](_0xca03('0xa4'));}this[_0xca03('0xf')][_0xca03('0xa3')](util[_0xca03('0x54')](_0xca03('0x1b8'),_0x5050ba['text']));var _0x52c624=this[_0xca03('0x5a')][_0xca03('0xbf')](this,_0x5050ba);if(_0x52c624){this[_0xca03('0xf')][_0xca03('0xa3')](util[_0xca03('0x54')](_0xca03('0x1b9'),_0x52c624));var _0x76dd9=this[_0xca03('0xf')][_0xca03('0x105')](_0x52c624);try{fs[_0xca03('0x106')](_0x52c624+_0xca03('0x107'));}catch(_0x534c33){logger[_0xca03('0x2d')](_0x534c33);}return _0x76dd9;}return this[_0xca03('0xf')]['error'](_0x5050ba,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0xca03('0x12')][_0xca03('0x1ba')]=function(_0x15e450){logger[_0xca03('0x2f')](util['format'](_0xca03('0x1bb'),_0x15e450[_0xca03('0xa2')]));_0x15e450['text']=_0x15e450['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x15e450[_0xca03('0x5c')])){return this[_0xca03('0xf')][_0xca03('0xa3')](_0xca03('0xa4'));}this[_0xca03('0xf')]['noop'](util[_0xca03('0x54')](_0xca03('0x1bc'),_0x15e450[_0xca03('0x5c')]));var _0x5035d3=this[_0xca03('0x60')][_0xca03('0xbf')](this,_0x15e450);if(_0x5035d3){this[_0xca03('0xf')]['noop'](util[_0xca03('0x54')](_0xca03('0x1bd'),_0x5035d3));var _0x29ae71=this[_0xca03('0xf')][_0xca03('0x105')](_0x5035d3);try{fs[_0xca03('0x106')](_0x5035d3+_0xca03('0x107'));}catch(_0x171b5a){logger['error'](_0x171b5a);}return _0x29ae71;}return this[_0xca03('0xf')][_0xca03('0x2d')](_0x15e450,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0xca03('0x12')][_0xca03('0x1be')]=function(_0x446fe7){logger['info'](util[_0xca03('0x54')](_0xca03('0x1bf'),_0x446fe7[_0xca03('0xa2')]));if(!this[_0xca03('0x9e')](_0x446fe7[_0xca03('0x158')])){return this[_0xca03('0xf')][_0xca03('0x2d')](_0x446fe7,_0xca03('0x15d'));}logger[_0xca03('0x2f')](util[_0xca03('0x54')](_0xca03('0x15e'),this[_0xca03('0xf')]['callerid'],_0x446fe7['findBy']));var _0x35971a=this[_0xca03('0x50')][_0xca03('0xbf')](this,_0x446fe7['findBy']);if(_0x35971a){logger[_0xca03('0x2f')](util[_0xca03('0x54')](_0xca03('0x159'),this[_0xca03('0xf')][_0xca03('0x3b')],_0x446fe7[_0xca03('0x158')]));this['channel'][_0xca03('0xa3')](util[_0xca03('0x54')](_0xca03('0x159'),this['channel'][_0xca03('0x3b')],_0x446fe7[_0xca03('0x158')]));return{'code':0xc8,'result':'success'};}else{logger[_0xca03('0x2f')](util[_0xca03('0x54')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xca03('0xf')][_0xca03('0x3b')],_0x446fe7[_0xca03('0x158')]));this[_0xca03('0xf')]['noop'](util[_0xca03('0x54')](_0xca03('0x15f'),this[_0xca03('0xf')]['callerid'],_0x446fe7[_0xca03('0x158')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xca03('0x12')][_0xca03('0x1c0')]=function(_0x47d6cd){logger['info'](util[_0xca03('0x54')](_0xca03('0x1c1'),_0x47d6cd[_0xca03('0xa2')]));var _0x437f19=this[_0xca03('0xf')][_0xca03('0x58')](_0xca03('0x1c2'),[_0x47d6cd[_0xca03('0x1c3')],_0x47d6cd[_0xca03('0x75')]]);if(_0x437f19['result']===-0x1){return _0x437f19;}return this[_0xca03('0xf')][_0xca03('0xa3')](util['format'](_0xca03('0xc4'),_0xca03('0x1c2'),_0x47d6cd['mailbox']));};AGIVertices[_0xca03('0x12')][_0xca03('0x1c4')]=function(_0x5199f8){logger[_0xca03('0x2f')](util['format'](_0xca03('0x1c5'),_0x5199f8[_0xca03('0xa2')]));if(!this[_0xca03('0x9e')](_0x5199f8[_0xca03('0xda')])){return this[_0xca03('0xf')]['error'](_0x5199f8,_0xca03('0x1c6'));}var _0x41f481=this[_0xca03('0x13')][_0xca03('0xbf')](this,_0x5199f8[_0xca03('0xda')]);if(!_0x41f481){return this[_0xca03('0xf')]['error'](_0x5199f8,_0xca03('0xdc'));}var _0xed02c4=this[_0xca03('0xf')][_0xca03('0x13')](_0x41f481);return{'code':0xc8,'result':_0xed02c4[_0xca03('0x9b')]?_0xed02c4[_0xca03('0x9b')]:'-'};};String[_0xca03('0x12')][_0xca03('0x9a')]=function(_0x326dc1,_0x3eee22){return this[_0xca03('0x99')](_0x326dc1)[_0xca03('0x1c7')](_0x3eee22);};module[_0xca03('0x1c8')]=AGIVertices; \ No newline at end of file +var _0x4e81=['menu','getdigits','getsecretdigits','channel','mailRpc','prototype','getVariable','rpc','getVariableById','then','name','getVoiceQueue','getVoiceQueueById','catch','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUser','getTrunkById','getSound','getSoundById','getMailAccount','getIntervals','getIntervalById','IntervalId','interval','map','getSoundPath','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','dnid','arg_1','file','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','phone','list_id','callback','Callback\x20scheduled\x20at\x20','scheduledAt','toString','callback_priority','getPause','agentPause','agent','agentUnpause','agentLogout','internal','LOCAL','agentLogin','shellCommand','trim','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','googleTTS','google_tts_language','restAPI','url','method','timeout','number','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','speed','ispeechASR','model','awsPolly','aws_secret_access_key','aws_polly_voice','Amy','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','appid','appsecret','clear','clone','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','isArray','length','saveRestApiResult','%s.%s','split','replaceAll','extra','getAndSetVariable','result','maxRetry','sync','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','isConfigured','noop','no\x20text\x20configured','exec','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','add','delay','minutes','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20found','forEach','keys','setVariable','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20found','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','DIALOGFLOW_%s','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','speech','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','bot','Trying\x20SestekNDA:\x20%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','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','DIAL','SIP/%s/%s','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_access_key_id','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','unlink','awslex','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','%s/recordings/%s','beep','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','wav','NOBEEP','tilde\x20%s\x20file\x20created','tildeASR','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','ispeechasr','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','success','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','digit','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','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','toLowerCase','QUEUE','macro','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','replace','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','sms_text','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','START\x20CALLY\x20SQUARE','yes','Answer','subproject','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','agi://%s/square,\x22%s\x22,\x22%s\x22','host','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','join','exports','util','lodash','shelljs','mustache','request-promise','../../config/logger','agi','../../config/environment','../../config/environment/shared','rawHeaders','rawBody'];(function(_0x1f8053,_0x111077){var _0x174fd8=function(_0x2f92fc){while(--_0x2f92fc){_0x1f8053['push'](_0x1f8053['shift']());}};_0x174fd8(++_0x111077);}(_0x4e81,0x1bc));var _0x14e8=function(_0x2ef8f1,_0x1280a3){_0x2ef8f1=_0x2ef8f1-0x0;var _0x17498d=_0x4e81[_0x2ef8f1];return _0x17498d;};'use strict';var fs=require('fs');var util=require(_0x14e8('0x0'));var _=require(_0x14e8('0x1'));var sh=require(_0x14e8('0x2'));var odbc=require('odbc')();var rs=require('randomstring');var moment=require('moment');var Mustache=require(_0x14e8('0x3'));var rp=require(_0x14e8('0x4'));var logger=require(_0x14e8('0x5'))(_0x14e8('0x6'));var config=require(_0x14e8('0x7'));var shared=require(_0x14e8('0x8'));var scripts=require('./scripts');var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x14e8('0x9'),_0x14e8('0xa')];var verticesWithRetry=[_0x14e8('0xb'),_0x14e8('0xc'),_0x14e8('0xd')];var AGIVertices=function(_0x20f053,_0x39127a,_0x1d8402){this[_0x14e8('0xe')]=_0x20f053;this['rpc']=_0x39127a;this[_0x14e8('0xf')]=_0x1d8402;};AGIVertices[_0x14e8('0x10')][_0x14e8('0x11')]=function(_0x2906b3,_0x421fec){this[_0x14e8('0x12')][_0x14e8('0x13')](_0x2906b3)[_0x14e8('0x14')](function(_0x52d13c){_0x421fec(null,_0x52d13c?_0x52d13c[_0x14e8('0x15')]:![]);})['catch'](function(_0x2607ef){_0x421fec(_0x2607ef);});};AGIVertices[_0x14e8('0x10')][_0x14e8('0x16')]=function(_0x5a95b7,_0x22fa86){this['rpc'][_0x14e8('0x17')](_0x5a95b7)['then'](function(_0x347216){_0x22fa86(null,_0x347216?_0x347216[_0x14e8('0x15')]:![]);})[_0x14e8('0x18')](function(_0x135996){_0x22fa86(_0x135996);});};AGIVertices['prototype'][_0x14e8('0x19')]=function(_0x3793a0,_0x30581){this[_0x14e8('0x12')][_0x14e8('0x1a')](_0x3793a0)[_0x14e8('0x14')](function(_0x10dc8b){_0x30581(null,_0x10dc8b?_0x10dc8b[_0x14e8('0x15')]:![]);})['catch'](function(_0x328c5a){_0x30581(_0x328c5a);});};AGIVertices[_0x14e8('0x10')][_0x14e8('0x1b')]=function(_0x7b10f2,_0x246c5d){this['rpc'][_0x14e8('0x1c')](_0x7b10f2)[_0x14e8('0x14')](function(_0x2abfec){_0x246c5d(null,_0x2abfec?_0x2abfec['dsn']:![]);})[_0x14e8('0x18')](function(_0x47f060){_0x246c5d(_0x47f060);});};AGIVertices[_0x14e8('0x10')][_0x14e8('0x1d')]=function(_0x3e8d5c,_0x117b00){this[_0x14e8('0x12')]['getUserById'](_0x3e8d5c)[_0x14e8('0x14')](function(_0x5b11f9){_0x117b00(null,_0x5b11f9?_0x5b11f9[_0x14e8('0x15')]:![]);})[_0x14e8('0x18')](function(_0x4ffc8b){_0x117b00(_0x4ffc8b);});};AGIVertices['prototype']['getTrunk']=function(_0x4a758c,_0x271e5d){this[_0x14e8('0x12')][_0x14e8('0x1e')](_0x4a758c)[_0x14e8('0x14')](function(_0x57eb46){_0x271e5d(null,_0x57eb46?_0x57eb46[_0x14e8('0x15')]:![]);})[_0x14e8('0x18')](function(_0x3c09cb){_0x271e5d(_0x3c09cb);});};AGIVertices[_0x14e8('0x10')][_0x14e8('0x1f')]=function(_0xfc0545,_0x2813ae){var _0x4abc29=this;this[_0x14e8('0x12')][_0x14e8('0x20')](_0xfc0545)[_0x14e8('0x14')](function(_0x5f5abb){_0x2813ae(null,_0x5f5abb?_0x4abc29['getSoundPath'](_0x5f5abb['save_name']):![]);})[_0x14e8('0x18')](function(_0x2a408d){_0x2813ae(_0x2a408d);});};AGIVertices['prototype'][_0x14e8('0x21')]=function(_0x1d71ca,_0x176e8f){this[_0x14e8('0x12')]['getMailAccountById'](_0x1d71ca)[_0x14e8('0x14')](function(_0x260d51){_0x176e8f(null,_0x260d51?_0x260d51:![]);})[_0x14e8('0x18')](function(_0x37da89){_0x176e8f(_0x37da89);});};AGIVertices[_0x14e8('0x10')]['sendMailMessage']=function(_0x2f83c3,_0x29ee7a,_0xc398b6){this[_0x14e8('0xf')]['sendMailMessage'](_0x2f83c3,_0x29ee7a)[_0x14e8('0x14')](function(){_0xc398b6(null);})['catch'](function(_0x14a038){_0xc398b6(_0x14a038);});};AGIVertices[_0x14e8('0x10')][_0x14e8('0x22')]=function(_0x34a7c8,_0x17fc40){this[_0x14e8('0x12')][_0x14e8('0x23')](_0x34a7c8)[_0x14e8('0x14')](function(_0xd144b){if(_0xd144b){if(_0xd144b[_0x14e8('0x24')]){_0x17fc40(null,[_0xd144b[_0x14e8('0x25')]]);}else{_0x17fc40(null,_[_0x14e8('0x26')](_0xd144b['Intervals'],'interval'));}}else{_0x17fc40(null,![]);}})['catch'](function(_0x16ff09){_0x17fc40(_0x16ff09);});};AGIVertices['prototype'][_0x14e8('0x27')]=function(_0x5bdf42){return util[_0x14e8('0x28')](_0x14e8('0x29'),FILES_PATH,_0x5bdf42);};AGIVertices[_0x14e8('0x10')][_0x14e8('0x2a')]=function(_0x51a63d,_0x13b44e,_0x514415){odbc[_0x14e8('0x2b')](_0x51a63d,function(_0x3ae459){if(_0x3ae459){logger[_0x14e8('0x2c')](_0x14e8('0x2d'),_0x3ae459);_0x514415(_0x3ae459);}else{logger[_0x14e8('0x2e')](_0x14e8('0x2f'));odbc['query'](_0x13b44e,function(_0xd05faa,_0x5b9e6b){if(_0xd05faa){logger[_0x14e8('0x2e')](_0x14e8('0x30'),_0x13b44e);_0x514415(_0xd05faa);}else{logger[_0x14e8('0x2e')]('Query\x20executed\x20correctly\x20%s',_0x13b44e);odbc[_0x14e8('0x31')](function(_0x12c8ff){if(_0x12c8ff){logger['error'](_0x14e8('0x32'),_0x12c8ff);}_0x514415(null,_0x5b9e6b);});}});}});};AGIVertices[_0x14e8('0x10')][_0x14e8('0x33')]=function(_0x3a7aa7,_0x77e8a0){this[_0x14e8('0x12')][_0x14e8('0x34')](_0x3a7aa7)[_0x14e8('0x14')](function(_0x33743a){_0x77e8a0(null,_0x33743a?_0x33743a:![]);})[_0x14e8('0x18')](function(_0x11f0ee){_0x77e8a0(_0x11f0ee);});};AGIVertices[_0x14e8('0x10')][_0x14e8('0x35')]=function(_0x21e781,_0x3829f8){this['rpc'][_0x14e8('0x35')](_0x21e781)['then'](function(_0x555f70){_0x3829f8(null,_0x555f70);})['catch'](function(_0x3d2d95){_0x3829f8(_0x3d2d95);});};AGIVertices['prototype'][_0x14e8('0x36')]=function(_0x45bff0,_0x7907e8,_0x264cb7){this[_0x14e8('0x12')][_0x14e8('0x36')]({'uniqueid':this[_0x14e8('0xe')][_0x14e8('0x37')],'node':_0x45bff0[_0x14e8('0x38')],'application':_0x45bff0[_0x14e8('0x39')],'data':_0x7907e8||null,'project_name':this[_0x14e8('0xe')]['arg_1'],'callerid':this[_0x14e8('0xe')][_0x14e8('0x3a')]})[_0x14e8('0x14')](function(_0xae5d61){if(_0x264cb7){_0x264cb7(null,_0xae5d61);}})['catch'](function(_0x205848){if(_0x264cb7){_0x264cb7(_0x205848);}});};AGIVertices[_0x14e8('0x10')]['createSquareRecording']=function(_0x553002,_0x3a8b91,_0x485563,_0x58b609){this[_0x14e8('0x12')][_0x14e8('0x3b')]({'uniqueid':this['channel'][_0x14e8('0x37')],'callerid':this[_0x14e8('0xe')]['callerid'],'calleridname':this[_0x14e8('0xe')][_0x14e8('0x3c')],'context':this[_0x14e8('0xe')][_0x14e8('0x3d')],'extension':this[_0x14e8('0xe')][_0x14e8('0x3e')],'priority':this[_0x14e8('0xe')][_0x14e8('0x3f')],'accountcode':this[_0x14e8('0xe')][_0x14e8('0x40')],'dnid':this[_0x14e8('0xe')][_0x14e8('0x41')],'projectName':this[_0x14e8('0xe')][_0x14e8('0x42')],'saveName':_0x3a8b91,'filename':_0x553002[_0x14e8('0x43')]||_0x3a8b91,'savePath':_0x485563})[_0x14e8('0x14')](function(_0x59820f){_0x58b609(null,_0x59820f);})[_0x14e8('0x18')](function(_0x49324a){_0x58b609(_0x49324a);});};AGIVertices[_0x14e8('0x10')][_0x14e8('0x44')]=function(_0x403628,_0x297780,_0x5dcb68,_0x4d91df,_0x59b172){this[_0x14e8('0x12')]['createSquareMessage']({'uniqueid':this['channel'][_0x14e8('0x37')],'body':_0x403628,'direction':_0x297780,'providerName':_0x5dcb68,'providerResponse':_0x4d91df})[_0x14e8('0x14')](function(_0x590bcd){if(_0x59b172){_0x59b172(null,_0x590bcd);}})[_0x14e8('0x18')](function(_0x27e319){if(_0x59b172){_0x59b172(_0x27e319);}});};AGIVertices[_0x14e8('0x10')][_0x14e8('0x45')]=function(_0x4cc86a,_0x519c9c){this[_0x14e8('0x12')][_0x14e8('0x45')]({'firstName':_[_0x14e8('0x46')](_0x4cc86a[_0x14e8('0x15')])||_[_0x14e8('0x47')](_0x4cc86a[_0x14e8('0x15')])?'callback_'+Math[_0x14e8('0x48')]():_0x4cc86a[_0x14e8('0x15')],'lastName':_[_0x14e8('0x46')](_0x4cc86a[_0x14e8('0x49')])||_['isNil'](_0x4cc86a[_0x14e8('0x49')])?null:_0x4cc86a[_0x14e8('0x49')],'phone':_0x4cc86a[_0x14e8('0x4a')],'ListId':_0x4cc86a[_0x14e8('0x4b')],'scheduledat':_0x4cc86a['scheduledAt'],'callbackUniqueid':this[_0x14e8('0xe')][_0x14e8('0x37')],'tags':_0x14e8('0x4c'),'description':_0x14e8('0x4d')+_0x4cc86a[_0x14e8('0x4e')][_0x14e8('0x4f')](),'priority':_0x4cc86a[_0x14e8('0x50')]})[_0x14e8('0x14')](function(_0x5ab659){_0x519c9c(null,_0x5ab659);})['catch'](function(_0x2fcc63){_0x519c9c(_0x2fcc63);});};AGIVertices[_0x14e8('0x10')][_0x14e8('0x51')]=function(_0x4229a0,_0x3f0b2a){this['rpc']['getPauseById'](_0x4229a0)['then'](function(_0xf8a05d){_0x3f0b2a(null,_0xf8a05d?_0xf8a05d[_0x14e8('0x15')]:![]);})[_0x14e8('0x18')](function(_0x58e2a4){_0x3f0b2a(_0x58e2a4);});};AGIVertices[_0x14e8('0x10')][_0x14e8('0x52')]=function(_0x1d6683,_0x54e164,_0x274837){var _0x63b342={'role':_0x14e8('0x53')};_0x63b342[_0x1d6683]=this[_0x14e8('0xe')][_0x14e8('0x3a')];this[_0x14e8('0x12')][_0x14e8('0x52')](_0x63b342,_0x54e164,this[_0x14e8('0xe')][_0x14e8('0x37')])[_0x14e8('0x14')](function(_0x1b2007){_0x274837(null,_['isNil'](_0x1b2007)?![]:!![]);})[_0x14e8('0x18')](function(_0x25297b){logger[_0x14e8('0x2c')](_0x25297b);_0x274837(null,![]);});};AGIVertices[_0x14e8('0x10')][_0x14e8('0x54')]=function(_0xa6738d,_0x364344){var _0x12e0a8={'role':_0x14e8('0x53')};_0x12e0a8[_0xa6738d]=this[_0x14e8('0xe')][_0x14e8('0x3a')];this[_0x14e8('0x12')]['agentUnpause'](_0x12e0a8)[_0x14e8('0x14')](function(_0x93238a){_0x364344(null,_['isNil'](_0x93238a)?![]:!![]);})[_0x14e8('0x18')](function(_0x2c2630){logger[_0x14e8('0x2c')](_0x2c2630);_0x364344(null,![]);});};AGIVertices[_0x14e8('0x10')][_0x14e8('0x55')]=function(_0x271941,_0x139405){var _0x5b6e28={'role':'agent'};_0x5b6e28[_0x271941]=this['channel'][_0x14e8('0x3a')];this[_0x14e8('0x12')][_0x14e8('0x55')](_0x5b6e28)[_0x14e8('0x14')](function(_0x39de9d){_0x139405(null,_[_0x14e8('0x47')](_0x39de9d)?![]:!![]);})[_0x14e8('0x18')](function(_0x4c34d7){logger[_0x14e8('0x2c')](_0x4c34d7);_0x139405(null,![]);});};AGIVertices[_0x14e8('0x10')]['agentLogin']=function(_0x27afee,_0x3a5602){var _0x4c3ead={'role':'agent'};_0x4c3ead[_0x27afee]=this['channel'][_0x14e8('0x3a')];var _0xf0cae3=_0x27afee!=_0x14e8('0x56')?util[_0x14e8('0x28')]('%s/%s@from-sip/n',_0x14e8('0x57'),this[_0x14e8('0xe')][_0x14e8('0x3a')]):undefined;this[_0x14e8('0x12')][_0x14e8('0x58')](_0x4c3ead,_0xf0cae3)[_0x14e8('0x14')](function(_0x504c7c){_0x3a5602(null,_[_0x14e8('0x47')](_0x504c7c)?![]:!![]);})[_0x14e8('0x18')](function(_0x164414){logger['error'](_0x164414);_0x3a5602(null,![]);});};AGIVertices['prototype'][_0x14e8('0x59')]=function(_0x53d0c8,_0x25f63c){sh['exec'](_[_0x14e8('0x5a')](_0x53d0c8),function(_0x54b023,_0x28aac4){var _0x362bda=_0x28aac4['replace'](/(\r\n|\n|\r)/gm,'');_0x25f63c(null,_0x362bda);});};AGIVertices[_0x14e8('0x10')][_0x14e8('0x5b')]=function(_0x3c4679,_0xd1cd5e){scripts[_0x14e8('0x5b')](_0x3c4679[_0x14e8('0x5c')],_0x3c4679[_0x14e8('0x5d')]||_0x14e8('0x5e'),_0x3c4679[_0x14e8('0x5e')],_0x3c4679[_0x14e8('0x5f')]||_0x14e8('0x60'),_0x3c4679[_0x14e8('0x61')]||_0x14e8('0x62'),_0x3c4679['audioEncoding']||'MP3')['then'](function(_0xd7427f){_0xd1cd5e(null,_0xd7427f);})[_0x14e8('0x18')](function(_0x10e994){_0xd1cd5e(_0x10e994);});};AGIVertices['prototype'][_0x14e8('0x63')]=function(_0x557a0f,_0x50337a){scripts['googleTTS'](_0x557a0f[_0x14e8('0x5e')],_0x557a0f[_0x14e8('0x64')]||'en',0x1)[_0x14e8('0x14')](function(_0x4d29e3){_0x50337a(null,_0x4d29e3);})[_0x14e8('0x18')](function(_0x4f83e9){_0x50337a(_0x4f83e9);});};AGIVertices[_0x14e8('0x10')][_0x14e8('0x65')]=function(_0x12db6a,_0x30d7a1){var _0x3ab99d={'uri':_0x12db6a[_0x14e8('0x66')],'method':_0x12db6a[_0x14e8('0x67')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x12db6a[_0x14e8('0x68')])===_0x14e8('0x69')&&parseInt(_0x12db6a['timeout'])>=0x1?parseInt(_0x12db6a[_0x14e8('0x68')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x14e8('0x6a'),_0x14e8('0x6b')],_0x3ab99d[_0x14e8('0x67')][_0x14e8('0x6c')]())){try{_0x3ab99d[_0x14e8('0x6d')]=_0x12db6a[_0x14e8('0xa')]?JSON[_0x14e8('0x6e')](_0x12db6a[_0x14e8('0xa')]):{};}catch(_0x1b3f84){logger['error'](_0x14e8('0x6f'),_0x1b3f84);}}try{_0x3ab99d[_0x14e8('0x70')]=_0x12db6a[_0x14e8('0x9')]?JSON[_0x14e8('0x6e')](_0x12db6a['rawHeaders']):{};}catch(_0x361eb3){logger[_0x14e8('0x2c')](_0x14e8('0x71'),_0x361eb3);}if(_0x12db6a[_0x14e8('0x72')]){try{var _0x4af04b=require(_0x12db6a[_0x14e8('0x72')])['sync'](this,_0x3ab99d);_0x3ab99d[_0x14e8('0x73')]=Mustache['render'](_0x12db6a['url'],_0x4af04b,{},['$$','$$']);if(_0x3ab99d[_0x14e8('0x70')]){_0x3ab99d[_0x14e8('0x70')]=JSON[_0x14e8('0x6e')](Mustache[_0x14e8('0x74')](JSON[_0x14e8('0x75')](_0x3ab99d[_0x14e8('0x70')]),_0x4af04b,{},['$$','$$']));}if(_0x3ab99d[_0x14e8('0x6d')]){_0x3ab99d[_0x14e8('0x6d')]=JSON[_0x14e8('0x6e')](Mustache[_0x14e8('0x74')](JSON[_0x14e8('0x75')](_0x3ab99d['body']),_0x4af04b,{},['$$','$$']));}}catch(_0x43dbee){logger[_0x14e8('0x2c')](_0x14e8('0x76'),_0x43dbee);}}rp(_0x3ab99d)['then'](function(_0x5a9e57){var _0x2e24fa={'statusCode':_0x5a9e57[_0x14e8('0x77')]||0xc8,'statusMessage':_0x5a9e57[_0x14e8('0x78')]||'OK','headers':_0x5a9e57[_0x14e8('0x70')]||{},'body':_0x5a9e57[_0x14e8('0x6d')]||{}};_0x30d7a1(null,_0x2e24fa);})[_0x14e8('0x18')](function(_0x7ad347){var _0x196815={'statusCode':_0x7ad347[_0x14e8('0x77')]||0x1f4,'statusMessage':_0x7ad347[_0x14e8('0x79')]||_0x14e8('0x7a'),'headers':_0x7ad347[_0x14e8('0x7b')][_0x14e8('0x70')]||{},'body':_0x7ad347[_0x14e8('0x7b')]['body']||{}};_0x30d7a1(null,_0x196815);});};AGIVertices[_0x14e8('0x10')]['googleDialogflow']=function(_0x533006,_0x298f64){scripts[_0x14e8('0x7c')](this[_0x14e8('0xe')][_0x14e8('0x37')],_0x533006[_0x14e8('0x7d')],_0x533006['text'],_0x533006[_0x14e8('0x7e')]||'en')[_0x14e8('0x14')](function(_0x5f4fbf){_0x298f64(null,_0x5f4fbf);})[_0x14e8('0x18')](function(_0x32ef32){_0x298f64(_0x32ef32);});};AGIVertices[_0x14e8('0x10')]['googleDialogflowV2']=function(_0x2f05f7,_0x3f3dab){scripts[_0x14e8('0x7f')](this[_0x14e8('0xe')][_0x14e8('0x37')],_0x2f05f7[_0x14e8('0x80')],_0x2f05f7[_0x14e8('0x81')],_0x2f05f7[_0x14e8('0x82')],_0x2f05f7[_0x14e8('0x5e')],_0x2f05f7[_0x14e8('0x83')]||'en')[_0x14e8('0x14')](function(_0x2491f9){_0x3f3dab(null,_0x2491f9);})['catch'](function(_0x1eb0aa){_0x3f3dab(_0x1eb0aa);});};AGIVertices['prototype']['sestekNDA']=function(_0x26853c,_0x5d5c64){scripts[_0x14e8('0x84')](this[_0x14e8('0xe')],_0x26853c)[_0x14e8('0x14')](function(_0x28886b){_0x5d5c64(null,_0x28886b);})['catch'](function(_0x15dbd9){_0x5d5c64(_0x15dbd9);});};AGIVertices[_0x14e8('0x10')][_0x14e8('0x85')]=function(_0x509c76,_0x4aec7d){scripts[_0x14e8('0x85')](_0x509c76[_0x14e8('0x7d')],_0x509c76[_0x14e8('0x5e')],_0x509c76['ispeech_tts_language']||_0x14e8('0x60'),_0x509c76[_0x14e8('0x86')])['then'](function(_0x2c7c45){_0x4aec7d(null,_0x2c7c45);})[_0x14e8('0x18')](function(_0x18624f){_0x4aec7d(_0x18624f);});};AGIVertices[_0x14e8('0x10')][_0x14e8('0x87')]=function(_0x2015d3,_0x1627c0,_0x1fd8eb){scripts[_0x14e8('0x87')](_0x1627c0,_0x2015d3[_0x14e8('0x7d')],_0x2015d3['ispeech_asr_language']||_0x14e8('0x60'),this['isConfigured'](_0x2015d3[_0x14e8('0x88')])?_0x2015d3[_0x14e8('0x88')]:undefined)[_0x14e8('0x14')](function(_0x58fa79){_0x1fd8eb(null,_0x58fa79);})['catch'](function(_0x43489d){_0x1fd8eb(_0x43489d);});};AGIVertices[_0x14e8('0x10')][_0x14e8('0x89')]=function(_0x209e12,_0xb2bf5c){scripts[_0x14e8('0x89')](_0x209e12['aws_access_key_id'],_0x209e12[_0x14e8('0x8a')],_0x209e12['aws_polly_region'],_0x209e12[_0x14e8('0x8b')]||_0x14e8('0x8c'),_0x209e12[_0x14e8('0x5e')],_0x209e12['aws_text_type']||_0x14e8('0x5e'))[_0x14e8('0x14')](function(_0x2bd242){_0xb2bf5c(null,_0x2bd242);})[_0x14e8('0x18')](function(_0x2d148f){_0xb2bf5c(_0x2d148f);});};AGIVertices['prototype'][_0x14e8('0x8d')]=function(_0x2cb268,_0x5068f6){scripts['awsLex'](this['channel'][_0x14e8('0x37')],_0x2cb268['aws_access_key_id'],_0x2cb268[_0x14e8('0x8a')],_0x2cb268[_0x14e8('0x8e')],_0x2cb268[_0x14e8('0x5e')],_0x2cb268[_0x14e8('0x8f')])[_0x14e8('0x14')](function(_0x2b554f){_0x5068f6(null,_0x2b554f);})[_0x14e8('0x18')](function(_0x4b6a71){_0x5068f6(_0x4b6a71);});};AGIVertices[_0x14e8('0x10')]['googleASR']=function(_0x3578af,_0x5f123a,_0x351dd6){scripts[_0x14e8('0x90')](_0x5f123a,_0x3578af['key'],_0x3578af[_0x14e8('0x91')]||'en-US')[_0x14e8('0x14')](function(_0x15515b){_0x351dd6(null,_0x15515b);})[_0x14e8('0x18')](function(_0x5cd93d){_0x351dd6(_0x5cd93d);});};AGIVertices[_0x14e8('0x10')]['tildeASR']=function(_0xcb4d16,_0x53d846,_0x5f5283){scripts['tildeASR'](_0x53d846,_0xcb4d16[_0x14e8('0x92')],_0xcb4d16[_0x14e8('0x93')],_0xcb4d16[_0x14e8('0x73')])[_0x14e8('0x14')](function(_0x59f340){_0x5f5283(null,_0x59f340);})['catch'](function(_0x47238f){_0x5f5283(_0x47238f);});};AGIVertices['prototype'][_0x14e8('0x94')]=function(_0x2a5874){var _0x5157b2=_['includes'](verticesWithRetry,_0x2a5874[_0x14e8('0x39')])?_0x2a5874:_[_0x14e8('0x95')](_0x2a5874);for(var _0x21ab5b in _0x5157b2){if(_0x5157b2['hasOwnProperty'](_0x21ab5b)){if(_0x5157b2[_0x21ab5b]&&_[_0x14e8('0x96')](_0x5157b2[_0x21ab5b])){if(_['includes'](recursiveMapAttributes,_0x21ab5b)){_0x5157b2[_0x21ab5b]=this[_0x14e8('0x97')](_0x5157b2[_0x21ab5b]);}else{_0x5157b2[_0x21ab5b]=this[_0x14e8('0x98')](_0x5157b2[_0x21ab5b]);}}}}return _0x5157b2;};AGIVertices[_0x14e8('0x10')][_0x14e8('0x99')]=function(_0x253844){for(var _0x24c093 in _0x253844){if(_0x253844[_0x14e8('0x9a')](_0x24c093)){if(_[_0x14e8('0x9b')](_0x253844[_0x24c093])){this[_0x14e8('0x99')](_0x253844[_0x24c093]);}else if(_[_0x14e8('0x9c')](_0x253844[_0x24c093])){for(var _0x2c50a8=0x0;_0x2c50a8<_0x253844[_0x24c093][_0x14e8('0x9d')];_0x2c50a8++){this['recursiveNodeIndex'](_0x253844[_0x24c093][_0x2c50a8]);}}else if(_[_0x14e8('0x96')](_0x253844[_0x24c093])){_0x253844[_0x24c093]=this[_0x14e8('0x98')](_0x253844[_0x24c093]);}}}};AGIVertices[_0x14e8('0x10')][_0x14e8('0x9e')]=function(_0x54dd09,_0x2f342d){for(var _0x5ba50f in _0x54dd09){if(_0x54dd09[_0x14e8('0x9a')](_0x5ba50f)){if(_[_0x14e8('0x9b')](_0x54dd09[_0x5ba50f])){if(!_[_0x14e8('0x46')](_0x54dd09[_0x5ba50f])){this[_0x14e8('0x9e')](_0x54dd09[_0x5ba50f],util[_0x14e8('0x28')](_0x14e8('0x9f'),_0x2f342d,_0x5ba50f));}}else if(_[_0x14e8('0x9c')](_0x54dd09[_0x5ba50f])){for(var _0x3f38ea=0x0;_0x3f38ea<_0x54dd09[_0x5ba50f][_0x14e8('0x9d')];_0x3f38ea++){this[_0x14e8('0x9e')](_0x54dd09[_0x5ba50f][_0x3f38ea],util[_0x14e8('0x28')](_0x14e8('0x9f'),_0x2f342d,_0x5ba50f+'['+_0x3f38ea+']'));}}else{if(!_[_0x14e8('0x47')](_0x54dd09[_0x5ba50f])){this['channel']['setVariable'](util[_0x14e8('0x28')]('%s.%s',_0x2f342d,_0x5ba50f),_0x54dd09[_0x5ba50f]);}}}}};AGIVertices[_0x14e8('0x10')][_0x14e8('0x97')]=function(_0x4f9858){try{var _0x312ab0=JSON[_0x14e8('0x6e')](_0x4f9858);this[_0x14e8('0x99')](_0x312ab0);return JSON[_0x14e8('0x75')](_0x312ab0);}catch(_0x2d2a21){return this[_0x14e8('0x98')](_0x4f9858);}};AGIVertices['prototype'][_0x14e8('0x98')]=function(_0x3d2ec1){var _0x3e3f60=_0x3d2ec1[_0x14e8('0xa0')]('{');for(var _0x2e7cb9=0x1;_0x2e7cb9<_0x3e3f60['length'];_0x2e7cb9+=0x1){var _0x2c8d86=_0x3e3f60[_0x2e7cb9]['split']('}');if(_0x2c8d86['length']>0x1){_0x3d2ec1=_0x3d2ec1[_0x14e8('0xa1')]('{'+_0x2c8d86[0x0]+'}',this[_0x14e8('0xe')]['getVariable'](_0x2c8d86[0x0])[_0x14e8('0xa2')]||_0x2c8d86[0x0]);}}if(_0x3e3f60['length']===0x1){return _0x3d2ec1[_0x14e8('0x4f')]();}return this[_0x14e8('0x98')](_0x3d2ec1);};AGIVertices['prototype'][_0x14e8('0xa3')]=function(_0x40b6da,_0xb5c786){var _0x154ed0=this[_0x14e8('0xe')]['getVariable'](_0x40b6da);if(_0x154ed0[_0x14e8('0xa4')]===-0x1){return _0x154ed0;}logger[_0x14e8('0x2e')](util[_0x14e8('0x28')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0xb5c786,_0x154ed0['extra']));return this[_0x14e8('0xe')]['setVariable'](_0xb5c786,_0x154ed0['extra']);};AGIVertices[_0x14e8('0x10')]['isConfigured']=function(_0x47d5be){return _0x47d5be&&_0x47d5be!=='0'&&_0x47d5be!=='-1'&&_0x47d5be!=='';};AGIVertices[_0x14e8('0x10')][_0x14e8('0xa5')]=function(_0x7d515f){this['createSquareDetailsReport'][_0x14e8('0xa6')](this,_0x7d515f,'-');_0x7d515f['retry']=_0x7d515f['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x14e8('0xa7')]=function(_0x23fa20){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0xa8'),_0x23fa20['label']));if(!this[_0x14e8('0xa9')](_0x23fa20[_0x14e8('0x5e')])){return this[_0x14e8('0xe')][_0x14e8('0xaa')](_0x14e8('0xab'));}var _0x39edc6='\x22'+_0x23fa20[_0x14e8('0x5e')]+'\x22';if(this[_0x14e8('0xa9')](_0x23fa20[_0x14e8('0x7b')])){_0x39edc6+=','+_0x23fa20[_0x14e8('0x7b')];}var _0x2e61d3=this[_0x14e8('0xe')][_0x14e8('0xac')](_0x14e8('0xad'),_0x39edc6);if(_0x2e61d3[_0x14e8('0xa4')]===-0x1){return _0x2e61d3;}return this['channel'][_0x14e8('0xaa')](util[_0x14e8('0x28')](_0x14e8('0xae'),_0x39edc6));};AGIVertices[_0x14e8('0x10')]['mrcprecog']=function(_0x2f5465){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0xaf'),_0x2f5465['label']));if(!this[_0x14e8('0xa9')](_0x2f5465[_0x14e8('0xb0')])){return this[_0x14e8('0xe')][_0x14e8('0xaa')](_0x14e8('0xb1'));}var _0x28ce0b=_0x2f5465[_0x14e8('0xb0')];if(this[_0x14e8('0xa9')](_0x2f5465['options'])){_0x28ce0b+=','+_0x2f5465[_0x14e8('0x7b')];}var _0x1e8b93=this[_0x14e8('0xe')][_0x14e8('0xac')](_0x14e8('0xb2'),_0x28ce0b);if(_0x1e8b93[_0x14e8('0xa4')]===-0x1){return _0x1e8b93;}var _0x4874b0=this[_0x14e8('0xa3')](_0x14e8('0xb3'),_0x14e8('0xb4'));if(_0x4874b0[_0x14e8('0xa4')]===-0x1){return _0x4874b0;}var _0x647f1c=this['getAndSetVariable'](_0x14e8('0xb5'),_0x14e8('0xb6'));if(_0x647f1c[_0x14e8('0xa4')]===-0x1){return _0x647f1c;}var _0x278dfb=this[_0x14e8('0xa3')](_0x14e8('0xb7'),_0x14e8('0xb8'));if(_0x278dfb[_0x14e8('0xa4')]===-0x1){return _0x278dfb;}return this['channel'][_0x14e8('0xaa')](util[_0x14e8('0x28')](_0x14e8('0xb9'),_0x28ce0b));};AGIVertices['prototype'][_0x14e8('0x6')]=function(_0x547489){logger['info'](util[_0x14e8('0x28')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x547489[_0x14e8('0x38')]));return this[_0x14e8('0xe')][_0x14e8('0x6')]([_0x547489[_0x14e8('0xba')],_0x547489[_0x14e8('0xbb')]]);};AGIVertices[_0x14e8('0x10')][_0x14e8('0xbc')]=function(_0x143ae3){logger['info'](util[_0x14e8('0x28')](_0x14e8('0xbd'),_0x143ae3[_0x14e8('0x38')]));if(this[_0x14e8('0xa9')](_0x143ae3[_0x14e8('0x68')])){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x143ae3['timeout']));var _0x539785=this[_0x14e8('0xe')][_0x14e8('0xbe')](_0x143ae3['timeout']);if(_0x539785[_0x14e8('0xa4')]===-0x1){return _0x539785;}}return this['channel'][_0x14e8('0xbc')]();};AGIVertices[_0x14e8('0x10')][_0x14e8('0x4c')]=function(_0x5b0a99){logger['info'](util[_0x14e8('0x28')](_0x14e8('0xbf'),_0x5b0a99[_0x14e8('0x38')]));if(!this[_0x14e8('0xa9')](_0x5b0a99[_0x14e8('0x4b')])){return this['channel'][_0x14e8('0x2c')](_0x5b0a99,_0x14e8('0xc0'));}_0x5b0a99[_0x14e8('0x4e')]=moment();if(this['isConfigured'](_0x5b0a99['delay'])){_0x5b0a99[_0x14e8('0x4e')]=moment()[_0x14e8('0xc1')](_0x5b0a99[_0x14e8('0xc2')],_0x14e8('0xc3'));}if(!this[_0x14e8('0xa9')](_0x5b0a99['callback_priority'])){_0x5b0a99['callback_priority']=0x2;}this['createCmContact'][_0x14e8('0xa6')](this,_0x5b0a99);return this['channel'][_0x14e8('0xaa')](util[_0x14e8('0x28')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x5b0a99['phone'],_0x5b0a99[_0x14e8('0x4b')],_0x5b0a99[_0x14e8('0x4e')]));};AGIVertices['prototype'][_0x14e8('0xc4')]=function(_0x92e465){logger[_0x14e8('0x2e')](util['format'](_0x14e8('0xc5'),_0x92e465[_0x14e8('0x38')]));var _0x383f70=this[_0x14e8('0xe')]['exec'](_0x92e465[_0x14e8('0xc6')],_0x92e465[_0x14e8('0x7b')]);if(_0x383f70[_0x14e8('0xa4')]===-0x1){return _0x383f70;}return this[_0x14e8('0xe')][_0x14e8('0xaa')](util['format']('Executed\x20command\x20%s\x20%s',_0x92e465['application'],_0x92e465[_0x14e8('0x7b')]));};AGIVertices[_0x14e8('0x10')]['lumenvoxtts']=function(_0x4a77c5){logger['info'](util[_0x14e8('0x28')](_0x14e8('0xc7'),_0x4a77c5[_0x14e8('0x38')]));if(!this[_0x14e8('0xa9')](_0x4a77c5[_0x14e8('0x5e')])){return this[_0x14e8('0xe')][_0x14e8('0xaa')](_0x14e8('0xab'));}var _0x2be0b5='\x22'+_0x4a77c5[_0x14e8('0x5e')]+'\x22';if(this[_0x14e8('0xa9')](_0x4a77c5[_0x14e8('0x7b')])){_0x2be0b5+=','+_0x4a77c5[_0x14e8('0x7b')];}var _0x555704=this['channel'][_0x14e8('0xac')](_0x14e8('0xad'),_0x2be0b5);if(_0x555704[_0x14e8('0xa4')]===-0x1){return _0x555704;}return this['channel']['noop'](util[_0x14e8('0x28')](_0x14e8('0xae'),_0x2be0b5));};AGIVertices[_0x14e8('0x10')][_0x14e8('0xc8')]=function(_0x4caca6){logger[_0x14e8('0x2e')](util['format'](_0x14e8('0xc9'),_0x4caca6[_0x14e8('0x38')]));if(!this[_0x14e8('0xa9')](_0x4caca6['text'])){return this[_0x14e8('0xe')][_0x14e8('0xaa')](_0x14e8('0xab'));}var _0x3117a1='\x22'+_0x4caca6[_0x14e8('0x5e')]+'\x22';if(this[_0x14e8('0xa9')](_0x4caca6[_0x14e8('0x7b')])){_0x3117a1+=','+_0x4caca6['options'];}var _0x210cbc=this['channel']['exec'](_0x14e8('0xad'),_0x3117a1);if(_0x210cbc[_0x14e8('0xa4')]===-0x1){return _0x210cbc;}return this['channel'][_0x14e8('0xaa')](util['format'](_0x14e8('0xae'),_0x3117a1));};AGIVertices[_0x14e8('0x10')]['lumenvoxasr']=function(_0x5e961b){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0xca'),_0x5e961b[_0x14e8('0x38')]));if(!this[_0x14e8('0xa9')](_0x5e961b[_0x14e8('0xb0')])){return this[_0x14e8('0xe')][_0x14e8('0xaa')](_0x14e8('0xb1'));}var _0x356320=_0x5e961b[_0x14e8('0xb0')];if(this['isConfigured'](_0x5e961b[_0x14e8('0x7b')])){_0x356320+=','+_0x5e961b[_0x14e8('0x7b')];}var _0x344da8=this['channel'][_0x14e8('0xac')](_0x14e8('0xb2'),_0x356320);if(_0x344da8[_0x14e8('0xa4')]===-0x1){return _0x344da8;}var _0x567cfc=this[_0x14e8('0xa3')](_0x14e8('0xb3'),'LUMENVOX_ASR_CONFIDENCE');if(_0x567cfc[_0x14e8('0xa4')]===-0x1){return _0x567cfc;}var _0x30c593=this['getAndSetVariable']('RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT');if(_0x30c593['result']===-0x1){return _0x30c593;}var _0x4215ec=this[_0x14e8('0xa3')](_0x14e8('0xb7'),'LUMENVOX_ASR_INSTANCE');if(_0x4215ec[_0x14e8('0xa4')]===-0x1){return _0x4215ec;}return this[_0x14e8('0xe')]['noop'](util[_0x14e8('0x28')](_0x14e8('0xb9'),_0x356320));};AGIVertices[_0x14e8('0x10')][_0x14e8('0xcb')]=function(_0xe2c10e){logger[_0x14e8('0x2e')](util['format'](_0x14e8('0xcc'),_0xe2c10e[_0x14e8('0x38')]));if(!this['isConfigured'](_0xe2c10e[_0x14e8('0xb0')])){return this[_0x14e8('0xe')][_0x14e8('0xaa')](_0x14e8('0xb1'));}var _0x2d1b6a=_0xe2c10e[_0x14e8('0xb0')];if(this['isConfigured'](_0xe2c10e[_0x14e8('0x7b')])){_0x2d1b6a+=','+_0xe2c10e[_0x14e8('0x7b')];}var _0x596d7b=this['channel']['exec'](_0x14e8('0xb2'),_0x2d1b6a);if(_0x596d7b[_0x14e8('0xa4')]===-0x1){return _0x596d7b;}var _0x5c85ab=this[_0x14e8('0xa3')](_0x14e8('0xb3'),_0x14e8('0xcd'));if(_0x5c85ab[_0x14e8('0xa4')]===-0x1){return _0x5c85ab;}var _0x418ff2=this[_0x14e8('0xa3')](_0x14e8('0xb5'),_0x14e8('0xce'));if(_0x418ff2[_0x14e8('0xa4')]===-0x1){return _0x418ff2;}var _0x551ef3=this[_0x14e8('0xa3')]('RECOG_INSTANCE()',_0x14e8('0xcf'));if(_0x551ef3['result']===-0x1){return _0x551ef3;}return this[_0x14e8('0xe')][_0x14e8('0xaa')](util[_0x14e8('0x28')](_0x14e8('0xb9'),_0x2d1b6a));};AGIVertices['prototype'][_0x14e8('0xd0')]=function(_0x2d9891){logger['info'](util[_0x14e8('0x28')](_0x14e8('0xd1'),_0x2d9891[_0x14e8('0x38')]));if(!this[_0x14e8('0xa9')](_0x2d9891[_0x14e8('0xd2')])){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x2d9891,_0x14e8('0xd3'));}var _0x2d3d2c=this['getSquareOdbc'][_0x14e8('0xa6')](this,_0x2d9891[_0x14e8('0xd2')]);if(!_0x2d3d2c){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x2d9891,_0x14e8('0xd4'));}if(!this[_0x14e8('0xa9')](_0x2d9891[_0x14e8('0xd5')])){return this['channel'][_0x14e8('0x2c')](_0x2d9891,_0x14e8('0xd6'));}var _0x342aa9=_0x2d9891['query']['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x14e8('0xe')][_0x14e8('0xaa')](util[_0x14e8('0x28')](_0x14e8('0xd7'),_0x342aa9));var _0x5b739d=this[_0x14e8('0x2a')][_0x14e8('0xa6')](this,_0x2d3d2c,_0x342aa9);this[_0x14e8('0x36')]['sync'](this,_0x2d9891,_0x342aa9);if(!this[_0x14e8('0xa9')](_0x2d9891[_0x14e8('0xd8')])){return this[_0x14e8('0xe')][_0x14e8('0xaa')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x2f74ab=this[_0x14e8('0x11')][_0x14e8('0xa6')](this,_0x2d9891[_0x14e8('0xd8')]);if(!_0x2f74ab){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x2d9891,_0x14e8('0xd9'));}var _0x406525=this;_0x5b739d[_0x14e8('0xda')](function(_0x4aedb6,_0x2f2317){Object[_0x14e8('0xdb')](_0x4aedb6)[_0x14e8('0xda')](function(_0x17ce0c){_0x406525['channel'][_0x14e8('0xdc')](util[_0x14e8('0x28')](_0x14e8('0xdd'),_0x2f74ab,_0x2f2317,_0x17ce0c),_0x4aedb6[_0x17ce0c]);});});this['channel'][_0x14e8('0xdc')](util['format'](_0x14e8('0xde'),_0x2f74ab),_0x5b739d['length']);return this[_0x14e8('0xe')][_0x14e8('0xaa')](util[_0x14e8('0x28')](_0x14e8('0xdf'),_0x2f74ab));};AGIVertices[_0x14e8('0x10')][_0x14e8('0xe0')]=function(_0x38f311){logger[_0x14e8('0xe1')](util['format'](_0x14e8('0xe2'),_0x38f311[_0x14e8('0x38')]));if(!this[_0x14e8('0xa9')](_0x38f311['sip_id'])){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x38f311,'no\x20user\x20selected');}var _0x1a330f=this['getUser'][_0x14e8('0xa6')](this,_0x38f311['sip_id']);if(!_0x1a330f){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x38f311,_0x14e8('0xe3'));}var _0x21c129=this[_0x14e8('0xe')]['exec']('DIAL',[util[_0x14e8('0x28')]('SIP/%s',_0x1a330f),_0x38f311['timeout'],_0x38f311[_0x14e8('0xe4')],_0x38f311[_0x14e8('0x66')]]);if(_0x21c129['result']===-0x1){return _0x21c129;}return this['channel'][_0x14e8('0xaa')](util[_0x14e8('0x28')](_0x14e8('0xe5'),'DIAL'));};AGIVertices[_0x14e8('0x10')][_0x14e8('0xe6')]=function(_0x275fb0){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0xe7'),_0x275fb0['label']));if(!this['isConfigured'](_0x275fb0[_0x14e8('0x7d')])){return this[_0x14e8('0xe')]['noop'](_0x14e8('0xe8'));}if(!this['isConfigured'](_0x275fb0[_0x14e8('0x5e')])){return this[_0x14e8('0xe')][_0x14e8('0xaa')](_0x14e8('0xab'));}this[_0x14e8('0xe')]['bot']=!![];this[_0x14e8('0x36')](_0x275fb0);this[_0x14e8('0x44')](_0x275fb0[_0x14e8('0x5e')],'in','','');this[_0x14e8('0xe')][_0x14e8('0xaa')](util[_0x14e8('0x28')]('Trying\x20Dialogflow:\x20%s',_0x275fb0[_0x14e8('0x5e')]));var _0x400b86=this['googleDialogflow'][_0x14e8('0xa6')](this,_0x275fb0);if(_0x400b86){for(var _0x2b2e71 in _0x400b86){if(_0x400b86['hasOwnProperty'](_0x2b2e71)){this[_0x14e8('0xe')][_0x14e8('0xdc')](util[_0x14e8('0x28')](_0x14e8('0xe9'),_0x2b2e71[_0x14e8('0x6c')]()),_0x400b86[_0x2b2e71]);}}this[_0x14e8('0x44')](_0x400b86['speech'],_0x14e8('0xea'),_0x14e8('0xe6'),'');return this[_0x14e8('0xe')][_0x14e8('0xaa')](util[_0x14e8('0x28')](_0x14e8('0xeb'),_0x400b86['speech']));}return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x275fb0,_0x14e8('0xec'));};AGIVertices['prototype'][_0x14e8('0xed')]=function(_0x4650f6){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0xee'),_0x4650f6['label']));if(!this[_0x14e8('0xa9')](_0x4650f6[_0x14e8('0x80')])){return this[_0x14e8('0xe')][_0x14e8('0xaa')](_0x14e8('0xef'));}if(!this['isConfigured'](_0x4650f6[_0x14e8('0x81')])){return this[_0x14e8('0xe')][_0x14e8('0xaa')](_0x14e8('0xf0'));}if(!this[_0x14e8('0xa9')](_0x4650f6['private_key'])){return this[_0x14e8('0xe')][_0x14e8('0xaa')](_0x14e8('0xf1'));}if(!this[_0x14e8('0xa9')](_0x4650f6['dialogflowV2_language'])){return this[_0x14e8('0xe')][_0x14e8('0xaa')]('no\x20anguage\x20configured');}if(!this['isConfigured'](_0x4650f6['text'])){return this[_0x14e8('0xe')][_0x14e8('0xaa')]('no\x20text\x20configured');}this[_0x14e8('0xe')]['bot']=!![];this['createSquareDetailsReport'](_0x4650f6);this[_0x14e8('0x44')](_0x4650f6[_0x14e8('0x5e')],'in','','');this[_0x14e8('0xe')][_0x14e8('0xaa')](util['format'](_0x14e8('0xf2'),_0x4650f6[_0x14e8('0x5e')]));var _0x4ec5df=this[_0x14e8('0x7f')]['sync'](this,_0x4650f6);if(_0x4ec5df){for(var _0xfce0a7 in _0x4ec5df){if(_0x4ec5df[_0x14e8('0x9a')](_0xfce0a7)){if(_0xfce0a7!==_0x14e8('0xf3')){this[_0x14e8('0xe')][_0x14e8('0xdc')](util['format'](_0x14e8('0xe9'),_0xfce0a7['toUpperCase']()),_0x4ec5df[_0xfce0a7]);}}}this[_0x14e8('0x44')](_0x4ec5df[_0x14e8('0xf4')],_0x14e8('0xea'),_0x14e8('0xed'),_0x4ec5df[_0x14e8('0xf3')]);return this[_0x14e8('0xe')][_0x14e8('0xaa')](util['format'](_0x14e8('0xf5'),_0x4ec5df[_0x14e8('0xf4')]));}return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x4650f6,_0x14e8('0xf6'));};AGIVertices[_0x14e8('0x10')][_0x14e8('0xf7')]=function(_0x31049c){logger['info'](util[_0x14e8('0x28')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x31049c[_0x14e8('0x38')]));if(!this[_0x14e8('0xa9')](_0x31049c[_0x14e8('0xf8')])){return this[_0x14e8('0xe')]['noop'](_0x14e8('0xf9'));}if(!this[_0x14e8('0xa9')](_0x31049c[_0x14e8('0xfa')])){return this[_0x14e8('0xe')][_0x14e8('0xaa')](_0x14e8('0xfb'));}if(!this[_0x14e8('0xa9')](_0x31049c[_0x14e8('0xfc')])){return this['channel'][_0x14e8('0xaa')](_0x14e8('0xfd'));}if(!this[_0x14e8('0xa9')](_0x31049c[_0x14e8('0xfe')])){return this[_0x14e8('0xe')][_0x14e8('0xaa')](_0x14e8('0xab'));}this[_0x14e8('0xe')][_0x14e8('0xff')]=!![];this[_0x14e8('0x36')](_0x31049c);this[_0x14e8('0x44')](_0x31049c[_0x14e8('0x5e')],'in','','');this[_0x14e8('0xe')][_0x14e8('0xaa')](util[_0x14e8('0x28')](_0x14e8('0x100'),_0x31049c[_0x14e8('0x5e')]));var _0x34d140=this[_0x14e8('0x84')][_0x14e8('0xa6')](this,_0x31049c);if(_0x34d140){for(var _0x56cfed in _0x34d140){if(_0x34d140[_0x14e8('0x9a')](_0x56cfed)){this[_0x14e8('0xe')][_0x14e8('0xdc')](util[_0x14e8('0x28')]('SESTEK_NDA_%s',_0x56cfed[_0x14e8('0x6c')]()),_0x34d140[_0x56cfed]);}}this[_0x14e8('0x44')](_0x34d140[_0x14e8('0xf4')],_0x14e8('0xea'),'sesteknda','');if(_0x34d140[_0x14e8('0x101')]){this[_0x14e8('0xe')]['noop'](util[_0x14e8('0x28')](_0x14e8('0x102'),_0x34d140[_0x14e8('0x101')]));var _0x320761=this[_0x14e8('0xe')][_0x14e8('0x103')](_0x34d140[_0x14e8('0x101')]);try{fs['unlink'](_0x34d140[_0x14e8('0x101')]+_0x14e8('0x104'));}catch(_0x13b31b){logger['error'](_0x13b31b);}return _0x320761;}else{return this[_0x14e8('0xe')][_0x14e8('0xaa')](util['format'](_0x14e8('0x105'),_0x34d140[_0x14e8('0xf4')]));}}return this[_0x14e8('0xe')]['error'](_0x31049c,_0x14e8('0x106'));};AGIVertices['prototype'][_0x14e8('0x107')]=function(_0x121d1b){logger['info'](util[_0x14e8('0x28')](_0x14e8('0x108'),_0x121d1b[_0x14e8('0x38')]));return this['channel'][_0x14e8('0xaa')](_0x14e8('0x107'));};AGIVertices[_0x14e8('0x10')][_0x14e8('0x109')]=function(_0x277b37){logger['info'](util[_0x14e8('0x28')](_0x14e8('0x10a'),_0x277b37[_0x14e8('0x38')]));var _0x4c8810='';if(_0x277b37[_0x14e8('0x10b')]){if(!this[_0x14e8('0xa9')](_0x277b37[_0x14e8('0x10b')])){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x277b37,_0x14e8('0x10c'));}else{var _0x1c9e3b=parseInt(_0x277b37['trunk_id'],0xa);if(isNaN(_0x1c9e3b)){_0x4c8810=_0x277b37[_0x14e8('0x10b')];}else{_0x4c8810=this[_0x14e8('0x10d')][_0x14e8('0xa6')](this,_0x277b37[_0x14e8('0x10b')]);if(!_0x4c8810){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x277b37,_0x14e8('0x10e'));}}}}else if(_0x277b37[_0x14e8('0x10f')]){_0x4c8810=_0x277b37[_0x14e8('0x10f')];}else{return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x277b37,'no\x20trunk\x20selected');}var _0x49afd1=this[_0x14e8('0xe')][_0x14e8('0xac')](_0x14e8('0x110'),[util['format'](_0x14e8('0x111'),_0x4c8810,_0x277b37[_0x14e8('0x4a')]),_0x277b37[_0x14e8('0x68')],_0x277b37[_0x14e8('0xe4')],_0x277b37[_0x14e8('0x66')]]);if(_0x49afd1[_0x14e8('0xa4')]===-0x1){return _0x49afd1;}return this['channel'][_0x14e8('0xaa')](util['format'](_0x14e8('0xe5'),_0x14e8('0x110')));};AGIVertices[_0x14e8('0x10')][_0x14e8('0x112')]=function(_0x2816fd){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x2816fd[_0x14e8('0x38')]));return this[_0x14e8('0xe')][_0x14e8('0xaa')](_0x14e8('0x112'));};AGIVertices['prototype'][_0x14e8('0xc')]=function(_0x108efc){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x113'),_0x108efc[_0x14e8('0x38')]));if(_0x108efc['retry']===0x0){return this['maxRetry'](_0x108efc);}_0x108efc[_0x14e8('0x114')]-=0x1;if(!this['isConfigured'](_0x108efc[_0x14e8('0x115')])){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x108efc,'no\x20file\x20audio\x20selected');}var _0x333a9b=this[_0x14e8('0x1f')][_0x14e8('0xa6')](this,_0x108efc[_0x14e8('0x115')]);if(!_0x333a9b){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x108efc,_0x14e8('0x116'));}if(!this[_0x14e8('0xa9')](_0x108efc['variable_id'])){return this[_0x14e8('0xe')]['error'](_0x14e8('0x117'));}var _0x479498=this['channel'][_0x14e8('0x118')](_0x333a9b,_0x108efc[_0x14e8('0x119')],_0x108efc[_0x14e8('0x11a')]);var _0x449cd2=_0x479498[_0x14e8('0xa4')]?_0x479498[_0x14e8('0xa4')][_0x14e8('0x4f')]():'';logger[_0x14e8('0x2e')](_0x14e8('0x11b'),JSON['stringify'](_0x479498));if(_0x479498[_0x14e8('0xa4')]===-0x1){this[_0x14e8('0x36')][_0x14e8('0xa6')](this,_0x108efc,_0x449cd2);return _0x479498;}else if(_0x479498[_0x14e8('0xa2')]===_0x14e8('0x68')){_0x479498[_0x14e8('0xa4')]=_0x449cd2['length']>=parseInt(_0x108efc[_0x14e8('0x11c')])?'x':'i';}else{_0x479498[_0x14e8('0xa4')]=_0x449cd2[_0x14e8('0x9d')]>=parseInt(_0x108efc['mindigit'])&&_0x449cd2[_0x14e8('0x9d')]<=parseInt(_0x108efc['maxdigit'])?'x':'i';}var _0x24af11=this[_0x14e8('0x11')][_0x14e8('0xa6')](this,_0x108efc[_0x14e8('0xd8')]);if(!_0x24af11){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x108efc,_0x14e8('0xd9'));}this['channel'][_0x14e8('0xdc')](_0x24af11,_0x449cd2);if(this[_0x14e8('0xa9')](_0x108efc[_0x14e8('0x11d')])){var _0x4fb1bd=parseInt(_0x108efc[_0x14e8('0x11d')],0xa);var _0x314dfe=rs[_0x14e8('0x11e')]({'charset':'*','length':_0x4fb1bd});var _0x5caa1b=_0x449cd2[_0x14e8('0x9d')];if(_0x5caa1b>0x0){if(_0x5caa1b>_0x4fb1bd){this[_0x14e8('0x36')][_0x14e8('0xa6')](this,_0x108efc,_0x108efc[_0x14e8('0x11f')]==='first'?_0x314dfe+_0x449cd2['substr'](_0x4fb1bd):_0x449cd2[_0x14e8('0x120')](0x0,_0x5caa1b-_0x4fb1bd)+_0x314dfe);}else{this[_0x14e8('0x36')][_0x14e8('0xa6')](this,_0x108efc,rs['generate']({'charset':'*','length':_0x5caa1b}));}}else{this[_0x14e8('0x36')][_0x14e8('0xa6')](this,_0x108efc,'');}}else{this[_0x14e8('0x36')][_0x14e8('0xa6')](this,_0x108efc,_0x449cd2);}return _0x479498;};AGIVertices['prototype'][_0x14e8('0xd')]=function(_0x53ec26){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x121'),_0x53ec26[_0x14e8('0x38')]));return this[_0x14e8('0xc')](_0x53ec26);};AGIVertices['prototype']['goal']=function(_0xaa3049){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0xaa3049[_0x14e8('0x38')]));this[_0x14e8('0x36')]['sync'](this,_0xaa3049,_0xaa3049[_0x14e8('0x122')]);return this['channel'][_0x14e8('0xaa')](util[_0x14e8('0x28')](_0x14e8('0x123'),_0xaa3049[_0x14e8('0x122')]));};AGIVertices[_0x14e8('0x10')][_0x14e8('0x124')]=function(_0x2c33ca){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x125'),_0x2c33ca[_0x14e8('0x38')]));if(!this[_0x14e8('0xa9')](_0x2c33ca[_0x14e8('0x126')])||!this['isConfigured'](_0x2c33ca[_0x14e8('0x8a')])){return this['channel']['noop']('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x2c33ca[_0x14e8('0x5e')])){return this['channel'][_0x14e8('0xaa')](_0x14e8('0xab'));}this[_0x14e8('0xe')]['noop'](util[_0x14e8('0x28')](_0x14e8('0x127'),_0x2c33ca['text']));var _0x5a7dac=this[_0x14e8('0x89')][_0x14e8('0xa6')](this,_0x2c33ca);if(_0x5a7dac){this[_0x14e8('0xe')][_0x14e8('0xaa')](util['format'](_0x14e8('0x128'),_0x5a7dac));var _0x1b5cf8=this[_0x14e8('0xe')][_0x14e8('0x103')](_0x5a7dac);try{fs[_0x14e8('0x129')](_0x5a7dac+_0x14e8('0x104'));}catch(_0xd4c74f){logger[_0x14e8('0x2c')](_0xd4c74f);}return _0x1b5cf8;}return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x2c33ca,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x14e8('0x10')][_0x14e8('0x12a')]=function(_0x976315){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x976315[_0x14e8('0x38')]));if(!this[_0x14e8('0xa9')](_0x976315[_0x14e8('0x126')])||!this[_0x14e8('0xa9')](_0x976315['aws_secret_access_key'])){return this[_0x14e8('0xe')][_0x14e8('0xaa')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x14e8('0xa9')](_0x976315[_0x14e8('0x8f')])){return this[_0x14e8('0xe')][_0x14e8('0xaa')]('no\x20bot\x20name\x20configured');}if(!this[_0x14e8('0xa9')](_0x976315[_0x14e8('0x5e')])){return this['channel']['noop']('no\x20text\x20configured');}this[_0x14e8('0xe')][_0x14e8('0xff')]=!![];this[_0x14e8('0x36')](_0x976315);this[_0x14e8('0x44')](_0x976315[_0x14e8('0x5e')],'in','','');this[_0x14e8('0xe')][_0x14e8('0xaa')](util[_0x14e8('0x28')](_0x14e8('0x12b'),_0x976315[_0x14e8('0x5e')]));var _0x443357=this['awsLex'][_0x14e8('0xa6')](this,_0x976315);if(_0x443357){for(var _0x1f9b54 in _0x443357){if(_0x443357[_0x14e8('0x9a')](_0x1f9b54)&&_[_0x14e8('0x96')](_0x443357[_0x1f9b54])){this[_0x14e8('0xe')][_0x14e8('0xdc')](util['format'](_0x14e8('0x12c'),_0x1f9b54[_0x14e8('0x6c')]()),_0x443357[_0x1f9b54]);}}if(_[_0x14e8('0x47')](_0x443357[_0x14e8('0x79')])){return this[_0x14e8('0xe')][_0x14e8('0xaa')](_0x14e8('0x12d'));}else{this[_0x14e8('0x44')](_0x443357[_0x14e8('0x79')],_0x14e8('0xea'),_0x14e8('0x12e'),'');return this[_0x14e8('0xe')][_0x14e8('0xaa')](util[_0x14e8('0x28')](_0x14e8('0x12f'),_0x443357[_0x14e8('0x79')]));}}return this[_0x14e8('0xe')]['error'](_0x976315,_0x14e8('0x130'));};AGIVertices['prototype'][_0x14e8('0x131')]=function(_0x196a82){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x132'),_0x196a82[_0x14e8('0x38')],_0x196a82['timeout']));if(!this['isConfigured'](_0x196a82[_0x14e8('0x7d')])){return this['channel'][_0x14e8('0xaa')](_0x14e8('0xe8'));}var _0x34c03f='wav';var _0x5eb492=util[_0x14e8('0x28')](_0x14e8('0x133'),FILES_PATH,rs[_0x14e8('0x11e')](0x4));var _0x4f4da8=util[_0x14e8('0x28')](_0x14e8('0x9f'),_0x5eb492,_0x34c03f);var _0x1f2d35=!![];if(_0x196a82[_0x14e8('0x134')]==='NOBEEP'){_0x1f2d35=![];}var _0x4e0723=this['channel'][_0x14e8('0x135')](_0x5eb492,_0x34c03f,_0x196a82[_0x14e8('0x136')],_0x196a82[_0x14e8('0x68')],undefined,_0x1f2d35);if(_0x4e0723[_0x14e8('0xa4')]!==-0x1){this[_0x14e8('0xe')][_0x14e8('0xaa')](util[_0x14e8('0x28')](_0x14e8('0x137'),_0x4f4da8));var _0x1d2f1a=this[_0x14e8('0x90')][_0x14e8('0xa6')](this,_0x196a82,_0x4f4da8);if(_0x1d2f1a){for(var _0x3e67d4 in _0x1d2f1a){if(_0x1d2f1a[_0x14e8('0x9a')](_0x3e67d4)){this[_0x14e8('0xe')]['setVariable'](util['format'](_0x14e8('0x138'),_0x3e67d4[_0x14e8('0x6c')]()),_0x1d2f1a[_0x3e67d4]);}}return this[_0x14e8('0xe')][_0x14e8('0xaa')](util['format']('GoogleASR\x20Result\x20%s',JSON['stringify'](_0x1d2f1a)));}}return _0x4e0723;};AGIVertices[_0x14e8('0x10')][_0x14e8('0x139')]=function(_0xd9d0cd){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x13a'),_0xd9d0cd['label']));if(!this[_0x14e8('0xa9')](_0xd9d0cd[_0x14e8('0x92')])){return this[_0x14e8('0xe')][_0x14e8('0xaa')](_0x14e8('0x13b'));}if(!this[_0x14e8('0xa9')](_0xd9d0cd[_0x14e8('0x93')])){return this[_0x14e8('0xe')]['noop'](_0x14e8('0x13c'));}var _0x3f6a2f=_0x14e8('0x13d');var _0xd1bb9e=util[_0x14e8('0x28')](_0x14e8('0x133'),FILES_PATH,rs[_0x14e8('0x11e')](0x4));var _0x1f4157=util[_0x14e8('0x28')](_0x14e8('0x9f'),_0xd1bb9e,_0x3f6a2f);var _0x27a7d3=!![];if(_0xd9d0cd['beep']===_0x14e8('0x13e')){_0x27a7d3=![];}var _0x2db9f6=this[_0x14e8('0xe')][_0x14e8('0x135')](_0xd1bb9e,_0x3f6a2f,_0xd9d0cd[_0x14e8('0x136')],_0xd9d0cd[_0x14e8('0x68')],undefined,_0x27a7d3);if(_0x2db9f6['result']!==-0x1){this[_0x14e8('0xe')]['noop'](util[_0x14e8('0x28')](_0x14e8('0x13f'),_0x1f4157));var _0xc77233=this[_0x14e8('0x140')][_0x14e8('0xa6')](this,_0xd9d0cd,_0x1f4157);if(_0xc77233){for(var _0x24f5e5 in _0xc77233){if(_0xc77233['hasOwnProperty'](_0x24f5e5)){this[_0x14e8('0xe')][_0x14e8('0xdc')](util[_0x14e8('0x28')](_0x14e8('0x141'),_0x24f5e5[_0x14e8('0x6c')]()),_0xc77233[_0x24f5e5]);}}return this['channel'][_0x14e8('0xaa')](util['format'](_0x14e8('0x142'),JSON[_0x14e8('0x75')](_0xc77233)));}}return _0x2db9f6;};AGIVertices[_0x14e8('0x10')][_0x14e8('0x143')]=function(_0x59421d){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x144'),_0x59421d['label']));return this[_0x14e8('0xe')]['continueAt'](_0x59421d[_0x14e8('0x3d')],_0x59421d[_0x14e8('0x3e')],_0x59421d[_0x14e8('0x3f')]);};AGIVertices[_0x14e8('0x10')]['gotoif']=function(_0x122317){logger['info'](util['format'](_0x14e8('0x145'),_0x122317['label']));if(!this[_0x14e8('0xa9')](_0x122317[_0x14e8('0x146')])){return this[_0x14e8('0xe')]['error'](_0x122317,_0x14e8('0x147'));}try{var _0x3eb885=eval(_0x122317[_0x14e8('0x146')])?_0x14e8('0x148'):_0x14e8('0x149');this[_0x14e8('0xe')][_0x14e8('0xaa')](util['format'](_0x14e8('0x14a'),_0x122317['condition'],_0x3eb885));return{'code':0xc8,'result':_0x3eb885};}catch(_0x6f5bb8){return{'code':0xc8,'result':_0x14e8('0x149')};}};AGIVertices[_0x14e8('0x10')]['gotoiftime']=function(_0x560cbd){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x560cbd[_0x14e8('0x38')]));if(!this[_0x14e8('0xa9')](_0x560cbd['interval_id'])){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x560cbd,_0x14e8('0x14b'));}var _0x4d9871=this[_0x14e8('0x22')][_0x14e8('0xa6')](this,_0x560cbd['interval_id']);if(!_0x4d9871){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x560cbd,_0x14e8('0x14c'));}for(var _0x5adcd5=0x0;_0x5adcd5<_0x4d9871[_0x14e8('0x9d')];_0x5adcd5+=0x1){var _0x4a8df3=this['channel'][_0x14e8('0x11')](util[_0x14e8('0x28')]('IFTIME(%s?true:false)',_0x4d9871[_0x5adcd5]));if(_0x4a8df3['result']===-0x1){return _0x4a8df3;}logger['info'](util[_0x14e8('0x28')]('IFTIME\x20%s\x20%s',_0x4d9871[_0x5adcd5],_0x4a8df3[_0x14e8('0xa2')]));if(_0x4a8df3[_0x14e8('0xa2')]===_0x14e8('0x148')){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x14d'),_0x4d9871[_0x5adcd5],_0x14e8('0x148')));this[_0x14e8('0xe')]['noop'](util[_0x14e8('0x28')](_0x14e8('0x14d'),_0x4d9871[_0x5adcd5],_0x14e8('0x148')));return{'code':0xc8,'result':_0x14e8('0x148')};}else{logger[_0x14e8('0x2e')](util[_0x14e8('0x28')]('IFTIME\x20%s\x20%s',_0x4d9871[_0x5adcd5],_0x14e8('0x149')));this[_0x14e8('0xe')]['noop'](util[_0x14e8('0x28')](_0x14e8('0x14d'),_0x4d9871[_0x5adcd5],_0x14e8('0x149')));}}return{'code':0xc8,'result':_0x14e8('0x149')};};AGIVertices[_0x14e8('0x10')][_0x14e8('0x14e')]=function(_0x924cbe){logger['info'](util['format']('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x924cbe[_0x14e8('0x38')]));return this[_0x14e8('0xe')][_0x14e8('0x14e')]();};AGIVertices[_0x14e8('0x10')][_0x14e8('0x14f')]=function(_0x5addbb){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x5addbb[_0x14e8('0x38')]));if(!this[_0x14e8('0xa9')](_0x5addbb[_0x14e8('0x7d')])){return this[_0x14e8('0xe')][_0x14e8('0xaa')](_0x14e8('0xe8'));}var _0x3e08cb=_0x14e8('0x13d');var _0x51a472=util[_0x14e8('0x28')](_0x14e8('0x133'),FILES_PATH,rs['generate'](0x4));var _0x1fdc63=util[_0x14e8('0x28')](_0x14e8('0x9f'),_0x51a472,_0x3e08cb);var _0x3d625f=!![];if(_0x5addbb[_0x14e8('0x134')]===_0x14e8('0x13e')){_0x3d625f=![];}var _0x18338a=this[_0x14e8('0xe')][_0x14e8('0x135')](_0x51a472,_0x3e08cb,_0x5addbb[_0x14e8('0x136')],_0x5addbb[_0x14e8('0x68')],undefined,_0x3d625f);if(_0x18338a['result']!==-0x1){this[_0x14e8('0xe')][_0x14e8('0xaa')](util['format'](_0x14e8('0x150'),_0x1fdc63));var _0x209ddd=this[_0x14e8('0x87')]['sync'](this,_0x5addbb,_0x1fdc63);if(_0x209ddd){for(var _0x11619a in _0x209ddd){if(_0x209ddd['hasOwnProperty'](_0x11619a)){this[_0x14e8('0xe')][_0x14e8('0xdc')](util[_0x14e8('0x28')](_0x14e8('0x151'),_0x11619a[_0x14e8('0x6c')]()),_0x209ddd[_0x11619a]);}}return this[_0x14e8('0xe')]['noop'](util[_0x14e8('0x28')](_0x14e8('0x152'),JSON[_0x14e8('0x75')](_0x209ddd)));}}return _0x18338a;};AGIVertices[_0x14e8('0x10')][_0x14e8('0x153')]=function(_0x31a0ce){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x154'),_0x31a0ce[_0x14e8('0x38')]));if(!this['isConfigured'](_0x31a0ce[_0x14e8('0x7d')])){return this[_0x14e8('0xe')][_0x14e8('0xaa')](_0x14e8('0xe8'));}if(!this['isConfigured'](_0x31a0ce[_0x14e8('0x5e')])){return this['channel'][_0x14e8('0xaa')](_0x14e8('0xab'));}this[_0x14e8('0xe')]['noop'](util[_0x14e8('0x28')](_0x14e8('0x155'),_0x31a0ce['text']));var _0x2c412f=this[_0x14e8('0x85')][_0x14e8('0xa6')](this,_0x31a0ce);if(_0x2c412f){this[_0x14e8('0xe')]['noop'](util[_0x14e8('0x28')](_0x14e8('0x150'),_0x2c412f));var _0x5d077f=this['channel'][_0x14e8('0x103')](_0x2c412f,_0x31a0ce[_0x14e8('0x136')]);try{fs[_0x14e8('0x129')](_0x2c412f+_0x14e8('0x104'));}catch(_0x3dbdf9){logger[_0x14e8('0x2c')](_0x3dbdf9);}return _0x5d077f;}return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x31a0ce,_0x14e8('0x156'));};AGIVertices['prototype'][_0x14e8('0x157')]=function(_0x2aa24b){logger['info'](util[_0x14e8('0x28')](_0x14e8('0x158'),_0x2aa24b[_0x14e8('0x38')]));if(!this[_0x14e8('0xa9')](_0x2aa24b[_0x14e8('0x159')])){return this[_0x14e8('0xe')]['error'](_0x2aa24b,_0x14e8('0x15a'));}logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x15b'),this[_0x14e8('0xe')][_0x14e8('0x3a')],_0x2aa24b[_0x14e8('0x159')]));var _0x10de51=this['agentLogin'][_0x14e8('0xa6')](this,_0x2aa24b[_0x14e8('0x159')]);if(_0x10de51){logger[_0x14e8('0x2e')](util['format'](_0x14e8('0x15c'),this[_0x14e8('0xe')][_0x14e8('0x3a')],_0x2aa24b[_0x14e8('0x159')]));this['channel']['noop'](util[_0x14e8('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x14e8('0xe')][_0x14e8('0x3a')],_0x2aa24b[_0x14e8('0x159')]));return{'code':0xc8,'result':'success'};}else{logger[_0x14e8('0x2e')](util['format'](_0x14e8('0x15d'),this[_0x14e8('0xe')][_0x14e8('0x3a')],_0x2aa24b[_0x14e8('0x159')]));this['channel'][_0x14e8('0xaa')](util[_0x14e8('0x28')](_0x14e8('0x15d'),this[_0x14e8('0xe')][_0x14e8('0x3a')],_0x2aa24b[_0x14e8('0x159')]));return{'code':0xc8,'result':_0x14e8('0x15e')};}};AGIVertices[_0x14e8('0x10')][_0x14e8('0x15f')]=function(_0x28c73a){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x28c73a[_0x14e8('0x38')]));if(!this['isConfigured'](_0x28c73a[_0x14e8('0x159')])){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x28c73a,'no\x20find\x20by\x20configured');}logger[_0x14e8('0x2e')](util[_0x14e8('0x28')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x14e8('0x3a')],_0x28c73a[_0x14e8('0x159')]));var _0x2be58f=this[_0x14e8('0x55')]['sync'](this,_0x28c73a[_0x14e8('0x159')]);if(_0x2be58f){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x15c'),this['channel']['callerid'],_0x28c73a[_0x14e8('0x159')]));this['channel'][_0x14e8('0xaa')](util[_0x14e8('0x28')](_0x14e8('0x15c'),this[_0x14e8('0xe')][_0x14e8('0x3a')],_0x28c73a['findBy']));return{'code':0xc8,'result':_0x14e8('0x160')};}else{logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x15d'),this[_0x14e8('0xe')][_0x14e8('0x3a')],_0x28c73a['findBy']));this['channel'][_0x14e8('0xaa')](util[_0x14e8('0x28')](_0x14e8('0x15d'),this[_0x14e8('0xe')][_0x14e8('0x3a')],_0x28c73a[_0x14e8('0x159')]));return{'code':0xc8,'result':_0x14e8('0x15e')};}};AGIVertices[_0x14e8('0x10')][_0x14e8('0x161')]=function(_0x11cfe6){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x162'),_0x11cfe6[_0x14e8('0x38')]));if(!this['isConfigured'](_0x11cfe6['operation'])){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x11cfe6,_0x14e8('0x163'));}this['channel']['noop'](util[_0x14e8('0x28')](_0x14e8('0x164'),_0x11cfe6[_0x14e8('0x165')]));var _0x9893f4=eval(_0x11cfe6[_0x14e8('0x165')]);if(!this[_0x14e8('0xa9')](_0x11cfe6[_0x14e8('0xd8')])){return this[_0x14e8('0xe')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x8eb1d0=this[_0x14e8('0x11')][_0x14e8('0xa6')](this,_0x11cfe6[_0x14e8('0xd8')]);if(!_0x8eb1d0){return this[_0x14e8('0xe')]['error'](_0x11cfe6,_0x14e8('0xd9'));}if(_[_0x14e8('0x9c')](_0x9893f4)){var _0x2a5238=this;_0x9893f4['forEach'](function(_0x4d433c,_0x3519aa){_0x2a5238['channel'][_0x14e8('0xdc')](util[_0x14e8('0x28')]('%s[%s]',_0x8eb1d0,_0x3519aa),_0x4d433c);});return this['channel'][_0x14e8('0xaa')](util[_0x14e8('0x28')]('variable\x20%s[key]\x20set',_0x8eb1d0));}else{return this['channel'][_0x14e8('0xdc')](_0x8eb1d0,_0x9893f4);}};AGIVertices[_0x14e8('0x10')][_0x14e8('0xb')]=function(_0x22e74d){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x166'),_0x22e74d[_0x14e8('0x38')]));if(_0x22e74d[_0x14e8('0x114')]===0x0){return this[_0x14e8('0xa5')](_0x22e74d);}_0x22e74d['retry']-=0x1;if(!this['isConfigured'](_0x22e74d[_0x14e8('0x115')])){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x22e74d,_0x14e8('0x167'));}var _0x259e7d=this['getSound'][_0x14e8('0xa6')](this,_0x22e74d[_0x14e8('0x115')]);if(!_0x259e7d){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x22e74d,_0x14e8('0x116'));}var _0x2fc5bb=this['channel'][_0x14e8('0x118')](_0x259e7d,_0x22e74d['response'],_0x22e74d[_0x14e8('0x168')]);var _0x7426d8=_0x2fc5bb['result'];if(_0x2fc5bb['result']===-0x1){this[_0x14e8('0x36')]['sync'](this,_0x22e74d,'-1');return _0x2fc5bb;}else if(_0x2fc5bb[_0x14e8('0xa2')]===_0x14e8('0x68')){_0x2fc5bb[_0x14e8('0xa4')]=_0x2fc5bb['result'][_0x14e8('0x9d')]>0x0?_0x2fc5bb[_0x14e8('0xa4')]:'t';}else if(_[_0x14e8('0x46')](_0x2fc5bb[_0x14e8('0xa4')])){_0x2fc5bb[_0x14e8('0xa4')]='#';_0x7426d8='#';}if(!this[_0x14e8('0xa9')](_0x22e74d[_0x14e8('0xd8')])){this[_0x14e8('0xe')]['noop'](_0x14e8('0x117'));}else{var _0x93ff4c=this[_0x14e8('0x11')][_0x14e8('0xa6')](this,_0x22e74d[_0x14e8('0xd8')]);if(!_0x93ff4c){return this[_0x14e8('0xe')]['error'](_0x22e74d,_0x14e8('0xd9'));}this[_0x14e8('0xe')]['setVariable'](_0x93ff4c,_0x7426d8);}this[_0x14e8('0x36')]['sync'](this,_0x22e74d,_0x7426d8);return _0x2fc5bb;};AGIVertices[_0x14e8('0x10')][_0x14e8('0xaa')]=function(_0x16caac){logger[_0x14e8('0x2e')](util['format']('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x16caac[_0x14e8('0x38')]));return this[_0x14e8('0xe')]['noop'](_0x16caac[_0x14e8('0x169')]||_0x16caac[_0x14e8('0x38')]);};AGIVertices[_0x14e8('0x10')][_0x14e8('0x16a')]=function(_0x1cf410){logger[_0x14e8('0x2e')](util['format'](_0x14e8('0x16b'),_0x1cf410[_0x14e8('0x38')]));if(!this[_0x14e8('0xa9')](_0x1cf410[_0x14e8('0x159')])){return this['channel'][_0x14e8('0x2c')](_0x1cf410,_0x14e8('0x15a'));}logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x15b'),this[_0x14e8('0xe')][_0x14e8('0x3a')],_0x1cf410['findBy']));var _0x30bdae=this['getPause'][_0x14e8('0xa6')](this,_0x1cf410['pause_id']);var _0x4ed356=this[_0x14e8('0x52')][_0x14e8('0xa6')](this,_0x1cf410['findBy'],_0x30bdae);if(_0x4ed356){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x15c'),this[_0x14e8('0xe')][_0x14e8('0x3a')],_0x1cf410[_0x14e8('0x159')]));this[_0x14e8('0xe')][_0x14e8('0xaa')](util[_0x14e8('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x14e8('0xe')][_0x14e8('0x3a')],_0x1cf410['findBy']));return{'code':0xc8,'result':_0x14e8('0x160')};}else{logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x15d'),this[_0x14e8('0xe')][_0x14e8('0x3a')],_0x1cf410[_0x14e8('0x159')]));this[_0x14e8('0xe')]['noop'](util[_0x14e8('0x28')](_0x14e8('0x15c'),this['channel']['callerid'],_0x1cf410['findBy']));return{'code':0xc8,'result':_0x14e8('0x15e')};}};AGIVertices[_0x14e8('0x10')]['playback']=function(_0x33a55c){logger[_0x14e8('0x2e')](util['format'](_0x14e8('0x16c'),_0x33a55c[_0x14e8('0x38')]));if(!this[_0x14e8('0xa9')](_0x33a55c[_0x14e8('0x115')])){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x33a55c,_0x14e8('0x167'));}var _0x233b99=this[_0x14e8('0x1f')][_0x14e8('0xa6')](this,_0x33a55c[_0x14e8('0x115')]);if(!_0x233b99){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x33a55c,'no\x20file\x20audio\x20found');}var _0x1be21b=this[_0x14e8('0xe')][_0x14e8('0xac')](_0x14e8('0x16d'),[_0x233b99,_0x33a55c[_0x14e8('0xe4')]]);if(_0x1be21b[_0x14e8('0xa4')]===-0x1){return _0x1be21b;}return this[_0x14e8('0xe')]['noop'](util['format']('Executed\x20command\x20%s\x20%s',_0x14e8('0x16d'),_0x233b99));};AGIVertices[_0x14e8('0x10')][_0x14e8('0x16e')]=function(_0x5868b0){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x16f'),_0x5868b0[_0x14e8('0x38')]));if(!this[_0x14e8('0xa9')](_0x5868b0[_0x14e8('0x170')])){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x5868b0,_0x14e8('0x171'));}var _0x35bfaa='';var _0x3047cd=parseInt(_0x5868b0['queue_id'],0xa);if(isNaN(_0x3047cd)){_0x35bfaa=_0x5868b0[_0x14e8('0x170')];}else{_0x35bfaa=this[_0x14e8('0x16')][_0x14e8('0xa6')](this,_0x5868b0[_0x14e8('0x170')]);if(!_0x35bfaa){return this[_0x14e8('0xe')]['error'](_0x5868b0,_0x14e8('0x172'));}}var _0x3cb51e='';if(this['isConfigured'](_0x5868b0[_0x14e8('0x115')])){var _0x388a64=this[_0x14e8('0x1f')][_0x14e8('0xa6')](this,_0x5868b0[_0x14e8('0x115')]);if(_0x388a64){_0x3cb51e=_0x388a64;}}this[_0x14e8('0x36')][_0x14e8('0xa6')](this,_0x5868b0,_0x35bfaa);if(_0x5868b0['opts'][_0x14e8('0x173')]('x')<0x0){_0x5868b0[_0x14e8('0xe4')]+='x';}if(_0x5868b0[_0x14e8('0xe4')]['indexOf']('X')<0x0){_0x5868b0['opts']+='X';}this[_0x14e8('0xe')][_0x14e8('0xdc')](_0x14e8('0x174'),_0x35bfaa?_0x35bfaa[_0x14e8('0x175')]():'');var _0x1bb77b=this['channel'][_0x14e8('0xac')](_0x14e8('0x176'),[_0x35bfaa,_0x5868b0[_0x14e8('0xe4')],_0x5868b0['url'],_0x3cb51e,_0x5868b0[_0x14e8('0x68')],_0x5868b0[_0x14e8('0x6')],_0x5868b0[_0x14e8('0x177')],_0x5868b0['gosub'],'',_0x5868b0[_0x14e8('0x178')]]);if(_0x1bb77b[_0x14e8('0xa4')]===-0x1){return _0x1bb77b;}return this[_0x14e8('0xe')][_0x14e8('0xaa')](util[_0x14e8('0x28')]('Executed\x20command\x20%s\x20%s','QUEUE',_0x35bfaa));};AGIVertices[_0x14e8('0x10')][_0x14e8('0x179')]=function(_0x1c7de2){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x17a'),_0x1c7de2[_0x14e8('0x38')]));var _0x2bd29b=_0x1c7de2['recordingFormat']||'wav';var _0x3f8988=util[_0x14e8('0x28')](_0x14e8('0x17b'),this[_0x14e8('0xe')][_0x14e8('0x37')],rs['generate'](0x5));var _0x21fd26=util[_0x14e8('0x28')](_0x14e8('0x17c'),FILES_PATH,_0x3f8988,_0x2bd29b);var _0x5891b1=util['format'](_0x14e8('0x133'),FILES_PATH,_0x3f8988);this['createSquareRecording'][_0x14e8('0xa6')](this,_0x1c7de2,_0x3f8988,_0x21fd26);this['channel']['setVariable']('RECORDING_SAVENAME',_0x3f8988);logger[_0x14e8('0x2e')](_0x14e8('0x17d'),_0x5891b1,_0x2bd29b,_0x1c7de2[_0x14e8('0x17e')],_0x1c7de2[_0x14e8('0x68')]);return this['channel']['recordFile'](_0x5891b1,_0x2bd29b,_0x1c7de2[_0x14e8('0x17e')],_0x1c7de2[_0x14e8('0x68')],undefined,!![]);};AGIVertices[_0x14e8('0x10')][_0x14e8('0x17f')]=function(_0x20bdd8){logger['info'](util['format'](_0x14e8('0x180'),_0x20bdd8[_0x14e8('0x38')]));if(!this[_0x14e8('0xa9')](_0x20bdd8[_0x14e8('0x66')])){return this[_0x14e8('0xe')][_0x14e8('0xaa')](_0x14e8('0x181'));}var _0x479327=this[_0x14e8('0x65')][_0x14e8('0xa6')](this,_0x20bdd8);logger['info'](util[_0x14e8('0x28')](_0x14e8('0x182'),util[_0x14e8('0x183')](_0x479327,{'showHidden':![],'depth':null})));if(!this[_0x14e8('0xa9')](_0x20bdd8['variable_id'])){return this['channel'][_0x14e8('0xaa')](_0x14e8('0x184'));}var _0x3c5f54=this[_0x14e8('0x11')][_0x14e8('0xa6')](this,_0x20bdd8['variable_id']);if(!_0x3c5f54){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x20bdd8,_0x14e8('0xd9'));}this[_0x14e8('0xe')][_0x14e8('0xdc')](util['format'](_0x14e8('0x185'),_0x3c5f54),_0x479327[_0x14e8('0x77')]?_0x479327['statusCode']:_0x14e8('0x186'));this[_0x14e8('0xe')][_0x14e8('0xdc')](util['format'](_0x14e8('0x187'),_0x3c5f54),_0x479327[_0x14e8('0x78')]?_0x479327['statusMessage']:'OK');if(_0x479327[_0x14e8('0x6d')]){try{this[_0x14e8('0x9e')](_0x479327['body'],_0x3c5f54);}catch(_0x3486e1){logger[_0x14e8('0x2c')](util[_0x14e8('0x28')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x3c5f54));}}return this[_0x14e8('0xe')][_0x14e8('0xaa')](util[_0x14e8('0x28')](_0x14e8('0xdf'),_0x3c5f54));};AGIVertices[_0x14e8('0x10')][_0x14e8('0x188')]=function(_0x2f3e94){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x189'),_0x2f3e94[_0x14e8('0x38')]));return this['channel'][_0x14e8('0x18a')](_0x2f3e94['digits'][_0x14e8('0x18b')](/\s+/g,''),_0x2f3e94[_0x14e8('0x17e')]);};AGIVertices['prototype'][_0x14e8('0x18c')]=function(_0x5ceb09){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x18d'),_0x5ceb09[_0x14e8('0x38')]));return this['channel']['sayNumber'](_0x5ceb09[_0x14e8('0x69')][_0x14e8('0x18b')](/\s+/g,''),_0x5ceb09[_0x14e8('0x17e')]);};AGIVertices[_0x14e8('0x10')][_0x14e8('0x18e')]=function(_0x4b37d4){logger[_0x14e8('0x2e')](util['format'](_0x14e8('0x18f'),_0x4b37d4[_0x14e8('0x38')]));return this[_0x14e8('0xe')][_0x14e8('0x190')](_0x4b37d4[_0x14e8('0x5e')],_0x4b37d4['escape_digits']);};AGIVertices['prototype'][_0x14e8('0x191')]=function(_0x3430f6){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x192'),_0x3430f6[_0x14e8('0x38')]));if(!this[_0x14e8('0xa9')](_0x3430f6[_0x14e8('0x193')])){return this['channel']['noop']('no\x20mail\x20account\x20configured');}var _0x668dda=this[_0x14e8('0x21')][_0x14e8('0xa6')](this,_0x3430f6['account_id']);if(!_0x668dda||!_0x668dda[_0x14e8('0x194')]){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x3430f6,_0x14e8('0x195'));}var _0x24a0f8={'from':util['format'](_0x14e8('0x196'),_0x668dda[_0x14e8('0x15')],_0x668dda[_0x14e8('0x197')]||_0x668dda[_0x14e8('0x194')][_0x14e8('0x198')]),'to':_0x3430f6['to']||'','cc':_0x3430f6['cc']||'','bcc':_0x3430f6[_0x14e8('0x199')]||'','subject':_0x3430f6[_0x14e8('0x19a')],'html':_0x3430f6[_0x14e8('0x5e')],'text':_0x3430f6['text']};if(this['isConfigured'](_0x3430f6['template_id'])){}logger[_0x14e8('0xe1')](_0x14e8('0x19b'),JSON[_0x14e8('0x75')](_0x24a0f8));this[_0x14e8('0x36')]['sync'](this,_0x3430f6,_0x3430f6[_0x14e8('0x193')]);this['channel']['noop'](util[_0x14e8('0x28')](_0x14e8('0x19c'),_0x668dda[_0x14e8('0x15')]));this['sendMailMessage']['sync'](this,_0x668dda['smtpOptions'],_0x24a0f8);return this[_0x14e8('0xe')][_0x14e8('0xaa')](_0x14e8('0x19d'));};AGIVertices[_0x14e8('0x10')]['sendFax']=function(_0x169203){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x19e'),_0x169203[_0x14e8('0x38')]));return this[_0x14e8('0xe')][_0x14e8('0xaa')](_0x14e8('0x19f'));};AGIVertices[_0x14e8('0x10')][_0x14e8('0x1a0')]=function(_0x2956e9){logger['info'](util['format'](_0x14e8('0x1a1'),_0x2956e9[_0x14e8('0x38')]));if(!this['isConfigured'](_0x2956e9[_0x14e8('0x1a2')])){return this[_0x14e8('0xe')][_0x14e8('0xaa')]('no\x20sms\x20account\x20configured');}var _0x22b94c=this[_0x14e8('0x33')][_0x14e8('0xa6')](this,_0x2956e9[_0x14e8('0x1a2')]);if(!_0x22b94c){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x2956e9,'no\x20sms\x20account\x20found');}var _0x50218f={'body':_0x2956e9[_0x14e8('0x1a3')],'phone':_0x2956e9['to']||'','SmsAccountId':_0x22b94c['id']};logger['debug'](_0x14e8('0x1a4'),JSON[_0x14e8('0x75')](_0x50218f));this[_0x14e8('0x36')][_0x14e8('0xa6')](this,_0x2956e9,_0x2956e9[_0x14e8('0x1a2')]);this[_0x14e8('0xe')][_0x14e8('0xaa')](util[_0x14e8('0x28')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x22b94c[_0x14e8('0x15')]));this['createSmsMessage'][_0x14e8('0xa6')](this,_0x50218f);return this['channel'][_0x14e8('0xaa')](_0x14e8('0x1a5'));};AGIVertices[_0x14e8('0x10')][_0x14e8('0x1a6')]=function(_0x4f7ff9){logger['info'](util[_0x14e8('0x28')](_0x14e8('0x1a7'),_0x4f7ff9[_0x14e8('0x38')]));if(!this['isConfigured'](_0x4f7ff9[_0x14e8('0xd8')])){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x4f7ff9,_0x14e8('0x1a8'));}var _0x2f5b09=this[_0x14e8('0x11')][_0x14e8('0xa6')](this,_0x4f7ff9[_0x14e8('0xd8')]);if(!_0x2f5b09){return this['channel'][_0x14e8('0x2c')](_0x4f7ff9,_0x14e8('0xd9'));}return this[_0x14e8('0xe')][_0x14e8('0xdc')](_0x2f5b09,_0x4f7ff9[_0x14e8('0x1a9')]);};AGIVertices[_0x14e8('0x10')][_0x14e8('0x1aa')]=function(_0xc8ab66){logger['info'](util['format']('Enter\x20in\x20START\x20(%s)\x20block',_0xc8ab66[_0x14e8('0x38')]));this[_0x14e8('0xe')][_0x14e8('0xaa')](_0x14e8('0x1ab'));if(_0xc8ab66[_0x14e8('0xbc')]===_0x14e8('0x1ac')){this[_0x14e8('0xe')][_0x14e8('0xaa')](_0x14e8('0x1ad'));return this[_0x14e8('0xe')]['answer']();}return this['channel']['noop']('Skipped\x20Answer');};AGIVertices[_0x14e8('0x10')][_0x14e8('0x1ae')]=function(_0x3176cf){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x3176cf[_0x14e8('0x38')]));if(!this['isConfigured'](_0x3176cf[_0x14e8('0x1af')])){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x3176cf,_0x14e8('0x1b0'));}var _0x2d9e61=this['getSquareProject'][_0x14e8('0xa6')](this,_0x3176cf['project_id']);if(!this[_0x14e8('0xa9')](_0x2d9e61)){return this['channel']['error'](_0x3176cf,util[_0x14e8('0x28')](_0x14e8('0x1b1'),_0x3176cf[_0x14e8('0x1af')]));}if(_0x2d9e61===this[_0x14e8('0xe')]['arg_1']){return this['channel'][_0x14e8('0x2c')](_0x3176cf,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x14e8('0x36')]['sync'](this,_0x3176cf,_0x2d9e61);var _0x3085c5=this[_0x14e8('0xe')]['exec']('AGI',util['format'](_0x14e8('0x1b2'),config[_0x14e8('0x6')][_0x14e8('0x1b3')]||'127.0.0.1',_0x2d9e61,this['channel'][_0x14e8('0x42')]));if(_0x3085c5[_0x14e8('0xa4')]===-0x1){return _0x3085c5;}return this[_0x14e8('0xe')][_0x14e8('0xaa')](util[_0x14e8('0x28')]('Executed\x20command\x20%s\x20%s','AGI',_0x2d9e61));};AGIVertices[_0x14e8('0x10')][_0x14e8('0x1b4')]=function(_0x30f849){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x1b5'),_0x30f849[_0x14e8('0x38')]));var _0x292fdd=this[_0x14e8('0x59')]['sync'](this,_0x30f849['command']);this[_0x14e8('0x36')][_0x14e8('0xa6')](this,_0x30f849,_0x30f849[_0x14e8('0xba')]);if(this[_0x14e8('0xa9')](_0x30f849[_0x14e8('0xd8')])){var _0x33cfb2=this[_0x14e8('0x11')][_0x14e8('0xa6')](this,_0x30f849['variable_id']);if(_0x33cfb2){this['channel'][_0x14e8('0xdc')](_0x33cfb2,_0x292fdd);return this['channel'][_0x14e8('0xaa')](util[_0x14e8('0x28')](_0x14e8('0x1b6'),_0x30f849[_0x14e8('0xba')],_0x33cfb2));}}return this['channel'][_0x14e8('0xaa')](util['format']('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x30f849['command']));};AGIVertices[_0x14e8('0x10')][_0x14e8('0x1b7')]=function(_0x3c1011){logger['info'](util['format'](_0x14e8('0x1b8'),_0x3c1011[_0x14e8('0x38')]));_0x3c1011[_0x14e8('0x5e')]=_0x3c1011[_0x14e8('0x5e')][_0x14e8('0x18b')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x14e8('0xa9')](_0x3c1011[_0x14e8('0x5c')])){return this[_0x14e8('0xe')][_0x14e8('0xaa')](_0x14e8('0x1b9'));}if(!this['isConfigured'](_0x3c1011[_0x14e8('0x5e')])){return this[_0x14e8('0xe')][_0x14e8('0xaa')](_0x14e8('0xab'));}this[_0x14e8('0xe')]['noop'](util[_0x14e8('0x28')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x3c1011[_0x14e8('0x5e')]));var _0x35f35e=this['googleCloudTTS']['sync'](this,_0x3c1011);if(_0x35f35e){this[_0x14e8('0xe')][_0x14e8('0xaa')](util[_0x14e8('0x28')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x35f35e));var _0x5ed0be=this[_0x14e8('0xe')]['streamFile'](_0x35f35e);try{fs[_0x14e8('0x129')](_0x35f35e+'.wav');}catch(_0x2f08f4){logger[_0x14e8('0x2c')](_0x2f08f4);}return _0x5ed0be;}return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x3c1011,_0x14e8('0x1ba'));};AGIVertices[_0x14e8('0x10')][_0x14e8('0x1bb')]=function(_0x194c99){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x1bc'),_0x194c99[_0x14e8('0x38')]));_0x194c99[_0x14e8('0x5e')]=_0x194c99[_0x14e8('0x5e')][_0x14e8('0x18b')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x14e8('0xa9')](_0x194c99[_0x14e8('0x5e')])){return this[_0x14e8('0xe')][_0x14e8('0xaa')](_0x14e8('0xab'));}this['channel'][_0x14e8('0xaa')](util['format'](_0x14e8('0x1bd'),_0x194c99[_0x14e8('0x5e')]));var _0x42ad42=this['googleTTS'][_0x14e8('0xa6')](this,_0x194c99);if(_0x42ad42){this[_0x14e8('0xe')]['noop'](util[_0x14e8('0x28')]('Google\x20TTS\x20%s\x20file\x20created',_0x42ad42));var _0x1f2108=this[_0x14e8('0xe')]['streamFile'](_0x42ad42);try{fs[_0x14e8('0x129')](_0x42ad42+_0x14e8('0x104'));}catch(_0x36ac40){logger['error'](_0x36ac40);}return _0x1f2108;}return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x194c99,_0x14e8('0x1be'));};AGIVertices[_0x14e8('0x10')][_0x14e8('0x1bf')]=function(_0x543ce7){logger[_0x14e8('0x2e')](util['format']('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x543ce7['label']));if(!this['isConfigured'](_0x543ce7[_0x14e8('0x159')])){return this['channel'][_0x14e8('0x2c')](_0x543ce7,_0x14e8('0x15a'));}logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x15b'),this['channel'][_0x14e8('0x3a')],_0x543ce7[_0x14e8('0x159')]));var _0x1d1800=this['agentUnpause']['sync'](this,_0x543ce7[_0x14e8('0x159')]);if(_0x1d1800){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x15c'),this[_0x14e8('0xe')][_0x14e8('0x3a')],_0x543ce7['findBy']));this['channel'][_0x14e8('0xaa')](util['format'](_0x14e8('0x15c'),this[_0x14e8('0xe')]['callerid'],_0x543ce7[_0x14e8('0x159')]));return{'code':0xc8,'result':'success'};}else{logger[_0x14e8('0x2e')](util['format'](_0x14e8('0x15d'),this[_0x14e8('0xe')][_0x14e8('0x3a')],_0x543ce7['findBy']));this['channel'][_0x14e8('0xaa')](util[_0x14e8('0x28')](_0x14e8('0x15d'),this[_0x14e8('0xe')]['callerid'],_0x543ce7[_0x14e8('0x159')]));return{'code':0xc8,'result':_0x14e8('0x15e')};}};AGIVertices[_0x14e8('0x10')][_0x14e8('0x1c0')]=function(_0x15dacf){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x1c1'),_0x15dacf[_0x14e8('0x38')]));var _0x319e27=this[_0x14e8('0xe')][_0x14e8('0xac')](_0x14e8('0x1c2'),[_0x15dacf[_0x14e8('0x1c3')],_0x15dacf['options']]);if(_0x319e27[_0x14e8('0xa4')]===-0x1){return _0x319e27;}return this[_0x14e8('0xe')][_0x14e8('0xaa')](util[_0x14e8('0x28')]('Executed\x20command\x20%s\x20%s',_0x14e8('0x1c2'),_0x15dacf['mailbox']));};AGIVertices[_0x14e8('0x10')][_0x14e8('0x1c4')]=function(_0x572928){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x572928[_0x14e8('0x38')]));if(!this[_0x14e8('0xa9')](_0x572928['variable_id'])){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x572928,_0x14e8('0x1a8'));}var _0x3e4ca5=this[_0x14e8('0x11')]['sync'](this,_0x572928[_0x14e8('0xd8')]);if(!_0x3e4ca5){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x572928,_0x14e8('0xd9'));}var _0xe607ab=this[_0x14e8('0xe')][_0x14e8('0x11')](_0x3e4ca5);return{'code':0xc8,'result':_0xe607ab[_0x14e8('0xa2')]?_0xe607ab[_0x14e8('0xa2')]:'-'};};String[_0x14e8('0x10')][_0x14e8('0xa1')]=function(_0x59b5ff,_0x21d388){return this[_0x14e8('0xa0')](_0x59b5ff)[_0x14e8('0x1c5')](_0x21d388);};module[_0x14e8('0x1c6')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 5b08fc5..3b69945 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 _0xaa31=['interface','queue','mandatoryDispositionPause','name','Action','QueuePause','getAgent','then','info','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','uniqueid','updateAcw','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','message','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][STOP]\x20%s','mandatoryDisposition','[ACW][syncAgentConnect]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','stringify','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw'];(function(_0x1476aa,_0x24ad0c){var _0x52262f=function(_0x5563e9){while(--_0x5563e9){_0x1476aa['push'](_0x1476aa['shift']());}};_0x52262f(++_0x24ad0c);}(_0xaa31,0x191));var _0x1aa3=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0xaa31[_0x176329];return _0x31997c;};'use strict';var _=require(_0x1aa3('0x0'));var moment=require(_0x1aa3('0x1'));var ami=require('../ami');var logger=require(_0x1aa3('0x2'))(_0x1aa3('0x3'));var RpcUser=require(_0x1aa3('0x4'));var RpcVoiceAgentReport=require(_0x1aa3('0x5'));function Acw(_0x5edb51){this[_0x1aa3('0x6')]=_0x5edb51[_0x1aa3('0x6')];this['agents']=_0x5edb51[_0x1aa3('0x7')];this[_0x1aa3('0x8')]=_0x5edb51['timers'];this[_0x1aa3('0x9')]={};ami['on'](_0x1aa3('0xa'),this[_0x1aa3('0xb')][_0x1aa3('0xc')](this));ami['on'](_0x1aa3('0xd'),this[_0x1aa3('0xe')][_0x1aa3('0xc')](this));ami['on'](_0x1aa3('0xf'),this[_0x1aa3('0x10')][_0x1aa3('0xc')](this));ami['on'](_0x1aa3('0x11'),this[_0x1aa3('0x12')][_0x1aa3('0xc')](this));ami['on']('attendedtransfer',this[_0x1aa3('0x13')]['bind'](this));ami['on'](_0x1aa3('0x14'),this[_0x1aa3('0x15')][_0x1aa3('0xc')](this));ami['on'](_0x1aa3('0x16'),this[_0x1aa3('0x17')][_0x1aa3('0xc')](this));}function getDiff(_0x5f0129){var _0x61e84f=moment()[_0x1aa3('0x18')](0x0);var _0x566e36=moment(_0x5f0129)[_0x1aa3('0x18')](0x0);return _0x61e84f[_0x1aa3('0x19')](_0x566e36,_0x1aa3('0x1a'));}Acw[_0x1aa3('0x1b')][_0x1aa3('0x1c')]=function(_0x35dc3c){try{var _0x5cbcac=this;var _0x5cb407=this[_0x1aa3('0x9')][_0x35dc3c][_0x1aa3('0x1d')];var _0x2c1dd1=this[_0x1aa3('0x9')][_0x35dc3c][_0x1aa3('0x1e')];var _0x1af868=this[_0x1aa3('0x6')][_0x2c1dd1];var _0x2f3cb9=![];var _0x26c0f5='ACW';if(_0x1af868['mandatoryDisposition']){if(_0x1af868[_0x1aa3('0x1f')]['name']){_0x2f3cb9=!![];_0x26c0f5=_0x1af868[_0x1aa3('0x1f')][_0x1aa3('0x20')];}}return ami[_0x1aa3('0x21')]({'action':_0x1aa3('0x22'),'interface':_0x5cb407,'paused':!![],'reason':_0x26c0f5})['then'](function(){if(_0x5cbcac[_0x1aa3('0x7')][_0x5cb407]){return RpcUser[_0x1aa3('0x23')](_0x5cbcac['agents'][_0x5cb407]['id'])[_0x1aa3('0x24')](function(_0x5e8593){if(_0x5e8593&&!_0x5e8593['voicePause']){logger[_0x1aa3('0x25')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x35dc3c,_0x5cb407,_0x2c1dd1);var _0x4cec82=_0x5cbcac[_0x1aa3('0x9')][_0x35dc3c][_0x1aa3('0x26')]&&_0x5cbcac[_0x1aa3('0x9')][_0x35dc3c]['destlinkedid']?_0x5cbcac[_0x1aa3('0x9')][_0x35dc3c][_0x1aa3('0x27')]:_0x35dc3c;return RpcUser[_0x1aa3('0x28')](_0x5cbcac['agents'][_0x5cb407],_0x26c0f5,_0x4cec82)[_0x1aa3('0x24')](function(){if(!_0x2f3cb9){_0x5cbcac[_0x1aa3('0x8')][_0x5cb407]={};logger[_0x1aa3('0x25')](_0x1aa3('0x29'),_0x35dc3c,_0x5cbcac[_0x1aa3('0x6')][_0x2c1dd1][_0x1aa3('0x2a')],_0x5cb407,_0x2c1dd1);_0x5cbcac[_0x1aa3('0x8')][_0x5cb407][_0x1aa3('0x2b')]=setTimeout(_0x5cbcac[_0x1aa3('0x2c')][_0x1aa3('0xc')](_0x5cbcac,_0x5cb407),_0x5cbcac[_0x1aa3('0x6')][_0x2c1dd1][_0x1aa3('0x2a')]*0x3e8);_0x5cbcac[_0x1aa3('0x8')][_0x5cb407][_0x1aa3('0x2d')]=moment()[_0x1aa3('0x2e')]('YYYY-MM-DD\x20HH:mm:ss');_0x5cbcac[_0x1aa3('0x8')][_0x5cb407][_0x1aa3('0x2f')]=_0x35dc3c;_0x5cbcac[_0x1aa3('0x8')][_0x5cb407]['queue']=_0x2c1dd1;_0x5cbcac['timers'][_0x5cb407][_0x1aa3('0x30')]=function(){var _0x43d80e=getDiff(_0x5cbcac[_0x1aa3('0x8')][_0x5cb407]['lastPauseAt']);clearTimeout(_0x5cbcac[_0x1aa3('0x8')][_0x5cb407][_0x1aa3('0x2b')]);_0x5cbcac['timers'][_0x5cb407]['timer']=![];RpcVoiceAgentReport['update']({'acwtime':_0x43d80e},_0x5cbcac['timers'][_0x5cb407]['uniqueid'],_0x5cb407)[_0x1aa3('0x24')](function(_0x5f0d8f){logger[_0x1aa3('0x25')](_0x1aa3('0x31'),_0x35dc3c,_0x43d80e,_0x5f0d8f);})[_0x1aa3('0x32')](function(_0x20206b){logger[_0x1aa3('0x33')](_0x1aa3('0x34'),_0x35dc3c,_0x20206b);});delete _0x5cbcac['timers'][_0x5cb407];};}});}else{logger[_0x1aa3('0x25')](_0x1aa3('0x35'),_0x35dc3c,_0x5cb407,_0x2c1dd1);}});}})[_0x1aa3('0x32')](function(){logger[_0x1aa3('0x33')](_0x1aa3('0x29'),_0x35dc3c,_0x5cbcac[_0x1aa3('0x6')][_0x2c1dd1][_0x1aa3('0x2a')],_0x5cb407,_0x2c1dd1);})[_0x1aa3('0x36')](function(){delete _0x5cbcac['channels'][_0x35dc3c];});}catch(_0x24f060){logger['error']('[ACW][START]\x20%s',_0x24f060[_0x1aa3('0x37')]);}};Acw[_0x1aa3('0x1b')]['stopAcw']=function(_0x5bc98b){try{var _0x28480b=this;if(_0x28480b[_0x1aa3('0x8')][_0x5bc98b]){_0x28480b[_0x1aa3('0x8')][_0x5bc98b][_0x1aa3('0x2b')]=![];var _0x3ad375=_0x28480b[_0x1aa3('0x8')][_0x5bc98b]['uniqueid'];var _0x1fdc7a=_0x28480b[_0x1aa3('0x8')][_0x5bc98b][_0x1aa3('0x1e')];var _0x31c3c3=_0x28480b[_0x1aa3('0x6')][_0x1fdc7a][_0x1aa3('0x2a')];logger[_0x1aa3('0x25')]('[%s][TIMER][STOP][AGENT:%s]',_0x3ad375,_0x5bc98b);RpcUser[_0x1aa3('0x38')](this['agents'][_0x5bc98b]);RpcVoiceAgentReport['update']({'acwtime':_0x31c3c3,'agentacw':!![]},_0x3ad375,_0x5bc98b)[_0x1aa3('0x24')](function(_0x8f1827){logger[_0x1aa3('0x25')]('[%s][UPDATE][ACWTIME:%s]',_0x3ad375,_0x31c3c3,_0x8f1827);})[_0x1aa3('0x32')](function(_0x2427ff){logger[_0x1aa3('0x33')]('[%s][UPDATE][ERRORS:%s]',_0x3ad375,_0x2427ff);});}else{logger[_0x1aa3('0x33')](_0x1aa3('0x39'),_0x5bc98b);if(_0x28480b['timers']){logger[_0x1aa3('0x25')](_0x1aa3('0x3a'),JSON['stringify'](_0x28480b[_0x1aa3('0x8')]));}}}catch(_0x5b2a2a){logger['error'](_0x1aa3('0x3b'),_0x5b2a2a[_0x1aa3('0x37')]);}};Acw[_0x1aa3('0x1b')][_0x1aa3('0xb')]=function(_0xd6f5c9){try{if(this['voiceQueues'][_0xd6f5c9[_0x1aa3('0x1e')]]&&(this[_0x1aa3('0x6')][_0xd6f5c9[_0x1aa3('0x1e')]][_0x1aa3('0x3')]||this[_0x1aa3('0x6')][_0xd6f5c9['queue']][_0x1aa3('0x3c')])){if(this['agents'][_0xd6f5c9['interface']]){this[_0x1aa3('0x9')][_0xd6f5c9[_0x1aa3('0x2f')]]={'queue':_0xd6f5c9[_0x1aa3('0x1e')],'interface':_0xd6f5c9[_0x1aa3('0x1d')],'destlinkedid':_0xd6f5c9[_0x1aa3('0x27')]};}}}catch(_0x1dcbb0){logger[_0x1aa3('0x33')](_0x1aa3('0x3d'),_0x1dcbb0[_0x1aa3('0x37')]);}};Acw[_0x1aa3('0x1b')][_0x1aa3('0x17')]=function(_0x510f37){try{if(this[_0x1aa3('0x6')][_0x510f37[_0x1aa3('0x1e')]]&&(this[_0x1aa3('0x6')][_0x510f37[_0x1aa3('0x1e')]]['acw']||this[_0x1aa3('0x6')][_0x510f37[_0x1aa3('0x1e')]][_0x1aa3('0x3c')])){if(this[_0x1aa3('0x7')][_0x510f37[_0x1aa3('0x1d')]]){this[_0x1aa3('0x9')][_0x510f37['uniqueid']]={'queue':_0x510f37['queue'],'interface':_0x510f37['interface']};}}}catch(_0x4369df){logger[_0x1aa3('0x33')]('[ACW][syncAgentConnectPreview]\x20%s',_0x4369df[_0x1aa3('0x37')]);}};Acw[_0x1aa3('0x1b')][_0x1aa3('0xe')]=function(_0xbfaf32){try{if(this[_0x1aa3('0x9')][_0xbfaf32['uniqueid']]&&_[_0x1aa3('0x3e')](this[_0x1aa3('0x9')][_0xbfaf32[_0x1aa3('0x2f')]][_0x1aa3('0x26')])){logger['info'](_0x1aa3('0x3f'),_0xbfaf32[_0x1aa3('0x2f')]);this['startAcw'](_0xbfaf32['uniqueid']);}else if(this['channels'][_0xbfaf32[_0x1aa3('0x40')]]&&_['isUndefined'](this[_0x1aa3('0x9')][_0xbfaf32[_0x1aa3('0x40')]]['attended'])){logger[_0x1aa3('0x25')](_0x1aa3('0x41'),_0xbfaf32['linkedid']);this[_0x1aa3('0x1c')](_0xbfaf32[_0x1aa3('0x40')]);}}catch(_0xee1b33){logger['error'](_0x1aa3('0x42'),_0xee1b33[_0x1aa3('0x37')]);}};Acw[_0x1aa3('0x1b')]['syncHangup']=function(_0x5a8152){try{if(this[_0x1aa3('0x9')][_0x5a8152[_0x1aa3('0x2f')]]&&this[_0x1aa3('0x9')][_0x5a8152[_0x1aa3('0x2f')]]['attended']){logger[_0x1aa3('0x25')](_0x1aa3('0x43'),_0x5a8152[_0x1aa3('0x2f')]);this[_0x1aa3('0x1c')](_0x5a8152[_0x1aa3('0x2f')]);}else if(this[_0x1aa3('0x9')][_0x5a8152[_0x1aa3('0x40')]]&&this[_0x1aa3('0x9')][_0x5a8152[_0x1aa3('0x40')]][_0x1aa3('0x26')]){logger[_0x1aa3('0x25')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x5a8152[_0x1aa3('0x40')]);this['startAcw'](_0x5a8152[_0x1aa3('0x40')]);}}catch(_0x7da2d7){logger[_0x1aa3('0x33')]('[ACW][syncHangup]\x20%s',_0x7da2d7['message']);}};Acw[_0x1aa3('0x1b')]['syncAttendedTransfer']=function(_0x4d202d){try{if(!_[_0x1aa3('0x44')](this[_0x1aa3('0x9')][_0x4d202d[_0x1aa3('0x45')]])){this[_0x1aa3('0x1c')](_0x4d202d[_0x1aa3('0x45')]);if(this[_0x1aa3('0x9')][_0x4d202d[_0x1aa3('0x46')]]){this[_0x1aa3('0x9')][_0x4d202d[_0x1aa3('0x46')]][_0x1aa3('0x26')]=!![];this[_0x1aa3('0x9')][_0x4d202d[_0x1aa3('0x47')]]=this[_0x1aa3('0x9')][_0x4d202d[_0x1aa3('0x46')]];delete this[_0x1aa3('0x9')][_0x4d202d[_0x1aa3('0x46')]];}}else if(!_[_0x1aa3('0x44')](this[_0x1aa3('0x9')][_0x4d202d[_0x1aa3('0x47')]])){this[_0x1aa3('0x1c')](_0x4d202d['transfertargetuniqueid']);if(this[_0x1aa3('0x9')][_0x4d202d[_0x1aa3('0x48')]]){this[_0x1aa3('0x9')][_0x4d202d['origtransfereruniqueid']][_0x1aa3('0x26')]=!![];this[_0x1aa3('0x9')][_0x4d202d[_0x1aa3('0x45')]]=this[_0x1aa3('0x9')][_0x4d202d[_0x1aa3('0x48')]];delete this[_0x1aa3('0x9')][_0x4d202d[_0x1aa3('0x48')]];}}}catch(_0x4a518b){logger[_0x1aa3('0x33')](_0x1aa3('0x49'),_0x4a518b['message']);}};Acw[_0x1aa3('0x1b')][_0x1aa3('0x15')]=function(_0x418ed7){try{if(this[_0x1aa3('0x9')][_0x418ed7['transfereruniqueid']]){logger[_0x1aa3('0x25')](_0x1aa3('0x4a'),JSON['stringify'](_0x418ed7[_0x1aa3('0x4b')]));this['startAcw'](_0x418ed7[_0x1aa3('0x4b')]);}else if(this['channels'][_0x418ed7[_0x1aa3('0x4c')]]){logger[_0x1aa3('0x25')](_0x1aa3('0x4d'),JSON[_0x1aa3('0x4e')](_0x418ed7[_0x1aa3('0x4c')]));this['startAcw'](_0x418ed7[_0x1aa3('0x4c')]);}}catch(_0x47d22c){logger[_0x1aa3('0x33')](_0x1aa3('0x4f'),_0x47d22c[_0x1aa3('0x37')]);}};Acw[_0x1aa3('0x1b')]['syncAgentRingNoAnswer']=function(_0x58a70f){try{if(this[_0x1aa3('0x6')][_0x58a70f[_0x1aa3('0x1e')]]&&this['voiceQueues'][_0x58a70f[_0x1aa3('0x1e')]][_0x1aa3('0x50')]===_0x1aa3('0x51')){if(this[_0x1aa3('0x7')][_0x58a70f[_0x1aa3('0x1d')]]){logger[_0x1aa3('0x25')](_0x1aa3('0x52'),_0x58a70f[_0x1aa3('0x2f')],_0x58a70f[_0x1aa3('0x1d')],_0x58a70f[_0x1aa3('0x1e')]);return RpcUser[_0x1aa3('0x28')](this[_0x1aa3('0x7')][_0x58a70f[_0x1aa3('0x1d')]],_0x1aa3('0x53'),_0x58a70f[_0x1aa3('0x2f')]);}}}catch(_0x2aacca){logger['error'](_0x1aa3('0x54'),_0x2aacca[_0x1aa3('0x37')]);}};module[_0x1aa3('0x55')]=Acw; \ No newline at end of file +var _0x7c53=['mandatoryDispositionPause','name','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','[%s][UPDATE][ACWTIME:%s]','[%s][UPDATE][ERRORS:%s]','catch','error','finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','prototype','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','startAcw','interface','ACW','mandatoryDisposition'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7c53,0x1e7));var _0x37c5=function(_0x373ac2,_0x146652){_0x373ac2=_0x373ac2-0x0;var _0x3fcdf5=_0x7c53[_0x373ac2];return _0x3fcdf5;};'use strict';var _=require(_0x37c5('0x0'));var moment=require(_0x37c5('0x1'));var ami=require(_0x37c5('0x2'));var logger=require('../../../config/logger')(_0x37c5('0x3'));var RpcUser=require(_0x37c5('0x4'));var RpcVoiceAgentReport=require(_0x37c5('0x5'));function Acw(_0x3c447f){this[_0x37c5('0x6')]=_0x3c447f[_0x37c5('0x6')];this[_0x37c5('0x7')]=_0x3c447f[_0x37c5('0x7')];this[_0x37c5('0x8')]=_0x3c447f[_0x37c5('0x8')];this[_0x37c5('0x9')]={};ami['on']('agentconnect',this[_0x37c5('0xa')][_0x37c5('0xb')](this));ami['on'](_0x37c5('0xc'),this[_0x37c5('0xd')][_0x37c5('0xb')](this));ami['on'](_0x37c5('0xe'),this[_0x37c5('0xf')]['bind'](this));ami['on'](_0x37c5('0x10'),this[_0x37c5('0x11')]['bind'](this));ami['on'](_0x37c5('0x12'),this['syncAttendedTransfer'][_0x37c5('0xb')](this));ami['on'](_0x37c5('0x13'),this['syncBlindTransfer']['bind'](this));ami['on'](_0x37c5('0x14'),this[_0x37c5('0x15')][_0x37c5('0xb')](this));}function getDiff(_0x4796e7){var _0x4020b0=moment()[_0x37c5('0x16')](0x0);var _0x2eb72a=moment(_0x4796e7)[_0x37c5('0x16')](0x0);return _0x4020b0[_0x37c5('0x17')](_0x2eb72a,_0x37c5('0x18'));}Acw['prototype'][_0x37c5('0x19')]=function(_0x12924b){try{var _0x471e09=this;var _0x3999ca=this[_0x37c5('0x9')][_0x12924b][_0x37c5('0x1a')];var _0x35068f=this[_0x37c5('0x9')][_0x12924b]['queue'];var _0xf0696c=this['voiceQueues'][_0x35068f];var _0x5e28ec=![];var _0x2563a3=_0x37c5('0x1b');if(_0xf0696c[_0x37c5('0x1c')]){if(_0xf0696c[_0x37c5('0x1d')]['name']){_0x5e28ec=!![];_0x2563a3=_0xf0696c[_0x37c5('0x1d')][_0x37c5('0x1e')];}}return ami['Action']({'action':'QueuePause','interface':_0x3999ca,'paused':!![],'reason':_0x2563a3})[_0x37c5('0x1f')](function(){if(_0x471e09[_0x37c5('0x7')][_0x3999ca]){return RpcUser[_0x37c5('0x20')](_0x471e09['agents'][_0x3999ca]['id'])[_0x37c5('0x1f')](function(_0x22ae84){if(_0x22ae84&&!_0x22ae84[_0x37c5('0x21')]){logger[_0x37c5('0x22')](_0x37c5('0x23'),_0x12924b,_0x3999ca,_0x35068f);var _0x15ecea=_0x471e09[_0x37c5('0x9')][_0x12924b][_0x37c5('0x24')]&&_0x471e09[_0x37c5('0x9')][_0x12924b][_0x37c5('0x25')]?_0x471e09[_0x37c5('0x9')][_0x12924b][_0x37c5('0x25')]:_0x12924b;return RpcUser[_0x37c5('0x26')](_0x471e09[_0x37c5('0x7')][_0x3999ca],_0x2563a3,_0x15ecea)[_0x37c5('0x1f')](function(){if(!_0x5e28ec){_0x471e09[_0x37c5('0x8')][_0x3999ca]={};logger[_0x37c5('0x22')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x12924b,_0x471e09[_0x37c5('0x6')][_0x35068f][_0x37c5('0x27')],_0x3999ca,_0x35068f);_0x471e09[_0x37c5('0x8')][_0x3999ca][_0x37c5('0x28')]=setTimeout(_0x471e09[_0x37c5('0x29')]['bind'](_0x471e09,_0x3999ca),_0x471e09['voiceQueues'][_0x35068f][_0x37c5('0x27')]*0x3e8);_0x471e09[_0x37c5('0x8')][_0x3999ca][_0x37c5('0x2a')]=moment()[_0x37c5('0x2b')](_0x37c5('0x2c'));_0x471e09[_0x37c5('0x8')][_0x3999ca][_0x37c5('0x2d')]=_0x12924b;_0x471e09['timers'][_0x3999ca][_0x37c5('0x2e')]=_0x35068f;_0x471e09['timers'][_0x3999ca][_0x37c5('0x2f')]=function(){var _0x1d7867=getDiff(_0x471e09['timers'][_0x3999ca][_0x37c5('0x2a')]);clearTimeout(_0x471e09['timers'][_0x3999ca][_0x37c5('0x28')]);_0x471e09[_0x37c5('0x8')][_0x3999ca][_0x37c5('0x28')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x1d7867},_0x471e09[_0x37c5('0x8')][_0x3999ca][_0x37c5('0x2d')],_0x3999ca)[_0x37c5('0x1f')](function(_0x37e427){logger['info'](_0x37c5('0x30'),_0x12924b,_0x1d7867,_0x37e427);})['catch'](function(_0x1d2cba){logger['error'](_0x37c5('0x31'),_0x12924b,_0x1d2cba);});delete _0x471e09[_0x37c5('0x8')][_0x3999ca];};}});}else{logger['info']('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x12924b,_0x3999ca,_0x35068f);}});}})[_0x37c5('0x32')](function(){logger[_0x37c5('0x33')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x12924b,_0x471e09['voiceQueues'][_0x35068f][_0x37c5('0x27')],_0x3999ca,_0x35068f);})[_0x37c5('0x34')](function(){delete _0x471e09['channels'][_0x12924b];});}catch(_0x12b444){logger[_0x37c5('0x33')](_0x37c5('0x35'),_0x12b444[_0x37c5('0x36')]);}};Acw['prototype']['stopAcw']=function(_0x49b5f1){try{var _0x479b30=this;if(_0x479b30[_0x37c5('0x8')][_0x49b5f1]){_0x479b30[_0x37c5('0x8')][_0x49b5f1][_0x37c5('0x28')]=![];var _0x2adafc=_0x479b30[_0x37c5('0x8')][_0x49b5f1][_0x37c5('0x2d')];var _0xdf316f=_0x479b30[_0x37c5('0x8')][_0x49b5f1][_0x37c5('0x2e')];var _0x24d842=_0x479b30[_0x37c5('0x6')][_0xdf316f][_0x37c5('0x27')];logger[_0x37c5('0x22')](_0x37c5('0x37'),_0x2adafc,_0x49b5f1);RpcUser['saveUnpause'](this[_0x37c5('0x7')][_0x49b5f1]);RpcVoiceAgentReport['update']({'acwtime':_0x24d842,'agentacw':!![]},_0x2adafc,_0x49b5f1)[_0x37c5('0x1f')](function(_0x12bf2c){logger[_0x37c5('0x22')](_0x37c5('0x30'),_0x2adafc,_0x24d842,_0x12bf2c);})[_0x37c5('0x32')](function(_0x2fa42a){logger[_0x37c5('0x33')](_0x37c5('0x31'),_0x2adafc,_0x2fa42a);});}else{logger[_0x37c5('0x33')](_0x37c5('0x38'),_0x49b5f1);if(_0x479b30[_0x37c5('0x8')]){logger[_0x37c5('0x22')](_0x37c5('0x39'),JSON[_0x37c5('0x3a')](_0x479b30[_0x37c5('0x8')]));}}}catch(_0x221f4e){logger[_0x37c5('0x33')](_0x37c5('0x3b'),_0x221f4e['message']);}};Acw['prototype']['syncAgentConnect']=function(_0x1c8b0d){try{if(this[_0x37c5('0x6')][_0x1c8b0d[_0x37c5('0x2e')]]&&(this[_0x37c5('0x6')][_0x1c8b0d['queue']]['acw']||this[_0x37c5('0x6')][_0x1c8b0d[_0x37c5('0x2e')]][_0x37c5('0x1c')])){if(this['agents'][_0x1c8b0d[_0x37c5('0x1a')]]){this[_0x37c5('0x9')][_0x1c8b0d['uniqueid']]={'queue':_0x1c8b0d['queue'],'interface':_0x1c8b0d[_0x37c5('0x1a')],'destlinkedid':_0x1c8b0d[_0x37c5('0x25')]};}}}catch(_0x390e1a){logger[_0x37c5('0x33')]('[ACW][syncAgentConnect]\x20%s',_0x390e1a[_0x37c5('0x36')]);}};Acw[_0x37c5('0x3c')][_0x37c5('0x15')]=function(_0x4d1059){try{if(this[_0x37c5('0x6')][_0x4d1059[_0x37c5('0x2e')]]&&(this[_0x37c5('0x6')][_0x4d1059[_0x37c5('0x2e')]]['acw']||this['voiceQueues'][_0x4d1059[_0x37c5('0x2e')]][_0x37c5('0x1c')])){if(this[_0x37c5('0x7')][_0x4d1059['interface']]){this[_0x37c5('0x9')][_0x4d1059[_0x37c5('0x2d')]]={'queue':_0x4d1059['queue'],'interface':_0x4d1059['interface']};}}}catch(_0x8ae6e9){logger[_0x37c5('0x33')](_0x37c5('0x3d'),_0x8ae6e9['message']);}};Acw[_0x37c5('0x3c')]['syncHangupRequest']=function(_0xc2d9b1){try{if(this[_0x37c5('0x9')][_0xc2d9b1['uniqueid']]&&_[_0x37c5('0x3e')](this[_0x37c5('0x9')][_0xc2d9b1[_0x37c5('0x2d')]][_0x37c5('0x24')])){logger[_0x37c5('0x22')](_0x37c5('0x3f'),_0xc2d9b1[_0x37c5('0x2d')]);this[_0x37c5('0x19')](_0xc2d9b1[_0x37c5('0x2d')]);}else if(this[_0x37c5('0x9')][_0xc2d9b1[_0x37c5('0x40')]]&&_[_0x37c5('0x3e')](this[_0x37c5('0x9')][_0xc2d9b1[_0x37c5('0x40')]][_0x37c5('0x24')])){logger[_0x37c5('0x22')](_0x37c5('0x41'),_0xc2d9b1[_0x37c5('0x40')]);this[_0x37c5('0x19')](_0xc2d9b1[_0x37c5('0x40')]);}}catch(_0x27f3ad){logger[_0x37c5('0x33')](_0x37c5('0x42'),_0x27f3ad[_0x37c5('0x36')]);}};Acw[_0x37c5('0x3c')][_0x37c5('0xf')]=function(_0x510b97){try{if(this[_0x37c5('0x9')][_0x510b97[_0x37c5('0x2d')]]&&this[_0x37c5('0x9')][_0x510b97[_0x37c5('0x2d')]]['attended']){logger[_0x37c5('0x22')](_0x37c5('0x43'),_0x510b97['uniqueid']);this[_0x37c5('0x19')](_0x510b97['uniqueid']);}else if(this[_0x37c5('0x9')][_0x510b97[_0x37c5('0x40')]]&&this[_0x37c5('0x9')][_0x510b97[_0x37c5('0x40')]][_0x37c5('0x24')]){logger[_0x37c5('0x22')](_0x37c5('0x44'),_0x510b97[_0x37c5('0x40')]);this[_0x37c5('0x19')](_0x510b97['linkedid']);}}catch(_0x19e56){logger[_0x37c5('0x33')](_0x37c5('0x45'),_0x19e56[_0x37c5('0x36')]);}};Acw[_0x37c5('0x3c')][_0x37c5('0x46')]=function(_0x52a82a){try{if(!_[_0x37c5('0x47')](this[_0x37c5('0x9')][_0x52a82a['transfereeuniqueid']])){this[_0x37c5('0x19')](_0x52a82a[_0x37c5('0x48')]);if(this[_0x37c5('0x9')][_0x52a82a[_0x37c5('0x49')]]){this[_0x37c5('0x9')][_0x52a82a[_0x37c5('0x49')]][_0x37c5('0x24')]=!![];this[_0x37c5('0x9')][_0x52a82a[_0x37c5('0x4a')]]=this[_0x37c5('0x9')][_0x52a82a['secondtransfereruniqueid']];delete this[_0x37c5('0x9')][_0x52a82a[_0x37c5('0x49')]];}}else if(!_['isNil'](this[_0x37c5('0x9')][_0x52a82a[_0x37c5('0x4a')]])){this[_0x37c5('0x19')](_0x52a82a[_0x37c5('0x4a')]);if(this['channels'][_0x52a82a[_0x37c5('0x4b')]]){this[_0x37c5('0x9')][_0x52a82a[_0x37c5('0x4b')]][_0x37c5('0x24')]=!![];this[_0x37c5('0x9')][_0x52a82a[_0x37c5('0x48')]]=this[_0x37c5('0x9')][_0x52a82a[_0x37c5('0x4b')]];delete this[_0x37c5('0x9')][_0x52a82a[_0x37c5('0x4b')]];}}}catch(_0x2339fb){logger['error'](_0x37c5('0x4c'),_0x2339fb[_0x37c5('0x36')]);}};Acw['prototype'][_0x37c5('0x4d')]=function(_0x193bc5){try{if(this[_0x37c5('0x9')][_0x193bc5[_0x37c5('0x4e')]]){logger[_0x37c5('0x22')](_0x37c5('0x4f'),JSON[_0x37c5('0x3a')](_0x193bc5[_0x37c5('0x4e')]));this[_0x37c5('0x19')](_0x193bc5[_0x37c5('0x4e')]);}else if(this[_0x37c5('0x9')][_0x193bc5['transfererlinkedid']]){logger[_0x37c5('0x22')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x37c5('0x3a')](_0x193bc5['transfererlinkedid']));this[_0x37c5('0x19')](_0x193bc5['transfererlinkedid']);}}catch(_0x48926e){logger['error']('[ACW][syncBlindTransfer]\x20%s',_0x48926e[_0x37c5('0x36')]);}};Acw[_0x37c5('0x3c')][_0x37c5('0x11')]=function(_0x2d6de7){try{if(this[_0x37c5('0x6')][_0x2d6de7[_0x37c5('0x2e')]]&&this[_0x37c5('0x6')][_0x2d6de7['queue']][_0x37c5('0x50')]===_0x37c5('0x51')){if(this[_0x37c5('0x7')][_0x2d6de7[_0x37c5('0x1a')]]){logger[_0x37c5('0x22')](_0x37c5('0x52'),_0x2d6de7[_0x37c5('0x2d')],_0x2d6de7['interface'],_0x2d6de7[_0x37c5('0x2e')]);return RpcUser[_0x37c5('0x26')](this[_0x37c5('0x7')][_0x2d6de7['interface']],_0x37c5('0x53'),_0x2d6de7[_0x37c5('0x2d')]);}}}catch(_0x5c55dd){logger[_0x37c5('0x33')](_0x37c5('0x54'),_0x5c55dd['message']);}};module[_0x37c5('0x55')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index b1a7c83..d1dc9f8 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 _0x553e=['[ami.js][fullybooted]','once','close','exports','asterisk-manager','bluebird','../../config/logger','ami','../../config/environment','asterisk','port','username','password','Action','promisify','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','shutdown','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','actionSipShowRegistry','catch'];(function(_0x3bf925,_0x4dd8e4){var _0x2128a1=function(_0x4d2049){while(--_0x4d2049){_0x3bf925['push'](_0x3bf925['shift']());}};_0x2128a1(++_0x4dd8e4);}(_0x553e,0x90));var _0xe553=function(_0x85d68,_0x30d93e){_0x85d68=_0x85d68-0x0;var _0x10161e=_0x553e[_0x85d68];return _0x10161e;};'use strict';var Manager=require(_0xe553('0x0'));var BPromise=require(_0xe553('0x1'));var util=require('util');var logger=require(_0xe553('0x2'))(_0xe553('0x3'));var config=require(_0xe553('0x4'));var ami=new Manager(config[_0xe553('0x5')][_0xe553('0x6')],config[_0xe553('0x5')]['ip'],config[_0xe553('0x5')][_0xe553('0x7')],config[_0xe553('0x5')][_0xe553('0x8')],!![]);ami['keepConnected']();ami[_0xe553('0x9')]=BPromise[_0xe553('0xa')](ami['action']);function error(_0x52dabd){logger[_0xe553('0xb')](util[_0xe553('0xc')](_0xe553('0xd'),config[_0xe553('0x5')][_0xe553('0x7')],config[_0xe553('0x5')]['ip'],config['asterisk'][_0xe553('0x6')],util[_0xe553('0xe')](_0x52dabd,![],null)));}function close(){logger[_0xe553('0xb')](util[_0xe553('0xc')](_0xe553('0xf'),config[_0xe553('0x5')]['username'],config[_0xe553('0x5')]['ip'],config['asterisk'][_0xe553('0x6')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0xe553('0x9')]({'action':_0xe553('0x10')});};};ami[_0xe553('0x11')]=function(){return function(){return ami['Action']({'action':_0xe553('0x12')});};};ami[_0xe553('0x13')]=function(){return function(){return ami[_0xe553('0x9')]({'action':_0xe553('0x14')});};};ami[_0xe553('0x15')]=function(){return function(){return ami[_0xe553('0x9')]({'action':_0xe553('0x16')});};};ami[_0xe553('0x17')]=function(){return function(){return ami[_0xe553('0x9')]({'action':_0xe553('0x18')});};};function connect(){logger[_0xe553('0x19')](util['format']('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0xe553('0x5')]['username'],config[_0xe553('0x5')]['ip'],config['asterisk'][_0xe553('0x6')]));ami['once'](_0xe553('0xb'),error);ami['once']('close',close);}ami['on']('connect',connect);ami['on'](_0xe553('0x1a'),function(_0x3f864a){logger['info'](util[_0xe553('0xc')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0xe553('0x5')]['username'],config[_0xe553('0x5')]['ip'],config[_0xe553('0x5')]['port'],util[_0xe553('0xe')](_0x3f864a,![],null)));});ami['on']('fullybooted',function(){logger[_0xe553('0x19')](util['format'](_0xe553('0x1b'),config[_0xe553('0x5')][_0xe553('0x7')],config[_0xe553('0x5')]['ip'],config[_0xe553('0x5')][_0xe553('0x6')]));return Promise['resolve']()[_0xe553('0x1c')](ami[_0xe553('0x1d')]())['then'](ami[_0xe553('0x11')]())[_0xe553('0x1c')](ami[_0xe553('0x13')]())[_0xe553('0x1c')](ami['actionQueueSummary']())['then'](ami['actionCoreShowChannels']())[_0xe553('0x1e')](function(_0x46777f){logger['error'](_0xe553('0x1f'),util[_0xe553('0xe')](_0x46777f,{'showHidden':![],'depth':null}));});});ami[_0xe553('0x20')](_0xe553('0xb'),error);ami[_0xe553('0x20')](_0xe553('0x21'),close);module[_0xe553('0x22')]=ami; \ No newline at end of file +var _0x95ba=['username','password','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','Action','sipshowregistry','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionDeviceStateList','actionQueueSummary','catch','[ami.js][fullybooted]','util','../../config/logger','ami','asterisk','port'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x95ba,0xf7));var _0xa95b=function(_0xc1d6f8,_0x2354a2){_0xc1d6f8=_0xc1d6f8-0x0;var _0x14a730=_0x95ba[_0xc1d6f8];return _0x14a730;};'use strict';var Manager=require('asterisk-manager');var BPromise=require('bluebird');var util=require(_0xa95b('0x0'));var logger=require(_0xa95b('0x1'))(_0xa95b('0x2'));var config=require('../../config/environment');var ami=new Manager(config[_0xa95b('0x3')][_0xa95b('0x4')],config['asterisk']['ip'],config['asterisk'][_0xa95b('0x5')],config['asterisk'][_0xa95b('0x6')],!![]);ami['keepConnected']();ami['Action']=BPromise['promisify'](ami[_0xa95b('0x7')]);function error(_0x4abe84){logger[_0xa95b('0x8')](util[_0xa95b('0x9')](_0xa95b('0xa'),config[_0xa95b('0x3')][_0xa95b('0x5')],config['asterisk']['ip'],config['asterisk'][_0xa95b('0x4')],util[_0xa95b('0xb')](_0x4abe84,![],null)));}function close(){logger[_0xa95b('0x8')](util['format'](_0xa95b('0xc'),config['asterisk']['username'],config[_0xa95b('0x3')]['ip'],config['asterisk']['port']));}ami[_0xa95b('0xd')]=function(){return function(){return ami[_0xa95b('0xe')]({'action':_0xa95b('0xf')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0xa95b('0xe')]({'action':_0xa95b('0x10')});};};ami[_0xa95b('0x11')]=function(){return function(){return ami[_0xa95b('0xe')]({'action':_0xa95b('0x12')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0xa95b('0xe')]({'action':_0xa95b('0x13')});};};ami[_0xa95b('0x14')]=function(){return function(){return ami[_0xa95b('0xe')]({'action':_0xa95b('0x15')});};};function connect(){logger[_0xa95b('0x16')](util[_0xa95b('0x9')](_0xa95b('0x17'),config[_0xa95b('0x3')][_0xa95b('0x5')],config['asterisk']['ip'],config['asterisk'][_0xa95b('0x4')]));ami[_0xa95b('0x18')](_0xa95b('0x8'),error);ami[_0xa95b('0x18')](_0xa95b('0x19'),close);}ami['on']('connect',connect);ami['on'](_0xa95b('0x1a'),function(_0x241d57){logger[_0xa95b('0x16')](util['format'](_0xa95b('0x1b'),config[_0xa95b('0x3')]['username'],config[_0xa95b('0x3')]['ip'],config['asterisk'][_0xa95b('0x4')],util[_0xa95b('0xb')](_0x241d57,![],null)));});ami['on'](_0xa95b('0x1c'),function(){logger[_0xa95b('0x16')](util[_0xa95b('0x9')](_0xa95b('0x1d'),config['asterisk'][_0xa95b('0x5')],config[_0xa95b('0x3')]['ip'],config['asterisk'][_0xa95b('0x4')]));return Promise[_0xa95b('0x1e')]()['then'](ami[_0xa95b('0xd')]())[_0xa95b('0x1f')](ami[_0xa95b('0x20')]())[_0xa95b('0x1f')](ami[_0xa95b('0x11')]())['then'](ami[_0xa95b('0x21')]())[_0xa95b('0x1f')](ami['actionCoreShowChannels']())[_0xa95b('0x22')](function(_0x17b737){logger[_0xa95b('0x8')](_0xa95b('0x23'),util['inspect'](_0x17b737,{'showHidden':![],'depth':null}));});});ami[_0xa95b('0x18')](_0xa95b('0x8'),error);ami[_0xa95b('0x18')](_0xa95b('0x19'),close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 440ed85..9892161 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 _0x70e0=['catch','exports','jayson/promise','bluebird','../../config/logger','http','Request','then','memberReport','error','rpc','message','result'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x70e0,0x17b));var _0x070e=function(_0x4eb744,_0x45921e){_0x4eb744=_0x4eb744-0x0;var _0x226e15=_0x70e0[_0x4eb744];return _0x226e15;};'use strict';var jayson=require(_0x070e('0x0'));var BPromise=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('ami');var client=jayson['client'][_0x070e('0x3')]({'port':0x2329});client[_0x070e('0x4')]=function(_0x277d32,_0x2593e5){return new BPromise(function(_0x5c90fc,_0x7bce9b){return client['request'](_0x277d32,_0x2593e5)[_0x070e('0x5')](function(_0x4b041d){logger['debug']('rpc',_0x070e('0x6'),_0x277d32,_0x2593e5,_0x4b041d);if(_0x4b041d[_0x070e('0x7')]){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x4b041d[_0x070e('0x7')][_0x070e('0x9')],_0x2593e5);return _0x7bce9b(_0x4b041d['error']['message']);}else{return _0x5c90fc(_0x4b041d[_0x070e('0xa')]);}})[_0x070e('0xb')](function(_0x12bb37){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x12bb37,_0x2593e5);return _0x7bce9b(_0x12bb37);});});};module[_0x070e('0xc')]=client; \ No newline at end of file +var _0x0713=['rpc','memberReport','error','message','result','catch','exports','../../config/logger','ami','client','http','Request','request','then','debug'];(function(_0x1602c3,_0x250007){var _0x4808ef=function(_0x361463){while(--_0x361463){_0x1602c3['push'](_0x1602c3['shift']());}};_0x4808ef(++_0x250007);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var client=jayson[_0x3071('0x2')][_0x3071('0x3')]({'port':0x2329});client[_0x3071('0x4')]=function(_0x52b5fb,_0x2c547f){return new BPromise(function(_0x7b18a4,_0x33a70c){return client[_0x3071('0x5')](_0x52b5fb,_0x2c547f)[_0x3071('0x6')](function(_0x41cf76){logger[_0x3071('0x7')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x2c547f,_0x41cf76);if(_0x41cf76[_0x3071('0xa')]){logger[_0x3071('0xa')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x41cf76['error'][_0x3071('0xb')],_0x2c547f);return _0x33a70c(_0x41cf76[_0x3071('0xa')][_0x3071('0xb')]);}else{return _0x7b18a4(_0x41cf76[_0x3071('0xc')]);}})[_0x3071('0xd')](function(_0x4a470a){logger[_0x3071('0xa')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x4a470a,_0x2c547f);return _0x33a70c(_0x4a470a);});});};module[_0x3071('0xe')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index e15ef10..9cba823 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 _0x0ef0=['Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','loopCampaigns','resetActiveCalls','syncCampaigns','undefined','resolve','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','power','dialPowerLevel','booked','Queue','method\x20not\x20recognized','dialGlobalInterval','Voice\x20Queue\x20%s\x20$s','intervalIftime','OVERTIME_INTERVAL','silly','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','Error','queue','uniqueId','uniqueid','ivr','updateOriginated','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete]','getSeconds','droptime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','countdropretry','dialDropMaxRetry','queueCallerAbandonCreateState','add','minutes','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','endtime','calleridname','calleridnum','swapAdditionalPhones','outboundDropCallsDayCallersExit','CALLEREXIT','countabandonedretry','dialAbandonedMaxRetry','rescheduleContact','Abandoned','channel','actionid','strategy','roundrobin','isNil','locked','paused','stateinterface','rrmemory','push','idHopper','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','responsetime','getQueue','Success','callProgressDetecting','[callProgressDetecting]\x20','syncVarSet','variable','exten','xcally-motion-dialer','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','buildObj','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','MACHINE','Machine','AMD','countmachineretry','amd','custom:amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countagentrejectretry','dialMachineRetryFrequency','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','moveContactManagedDialer','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','outboundUnknownCallsDay','cause-txt','running','isPreviewCampaign','getQueueCampaignStatusMessage','statusMessage','available','inUse','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','throttle','filter','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','Agent','user:dialPreviewRecallReminder','[uniqueid]','clearZombieChannels','enqueue','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','emptyContact','notFound','UserId','[emptyContact][createHistory]','[syncAgentComplete][createHistory]','user:%s','handleIvr','object','voiceQueue\x20is\x20undefine','phone','originate','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','dialQueueOptions','getCaller','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','createdAt','updatedAt','XMD-','getCallerId','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','callerid','getCallerIdRandom','XMD-ORIGINATECALLERIDNAME','originatecalleridname','variables','SIP/%s/%s%s','dialPrefix','trim','substring','dialCutDigit','from-sip','dialOriginateTimeout','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[rescheduleContact][AgentReject]','entity\x20is\x20undefine','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','custom:agentcongestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','dialAgentRejectRetryFrequency','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','outboundDropCallsDayTimeout','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','round','predictiveIntervalMinThreshold','talking','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','avgHandleTime','startMethodPredictive','getDataPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','dialPredictiveOptimizationPercentage','busyFactor','[getDataPredictive]','Unknown\x20Predictive','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','predictiveIntervalHitRate','[CatchErlangB]','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','voicePause','unlockContact','outboundReCallsDay','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','Blacklist','inBlackList','temp','getContactDialerIvr','checkContactEmpty','NO_AVAILABLE_CONTACTS','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','loggerHandler','[actionOriginateIvr]\x20','dialLimitQueue','pTalking','getContactDialer','countReScheduled','[countReScheduled]\x20','[actionOriginate]\x20','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','checkContactLowerLimitOriginate','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','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','Amax\x20=\x20','erlangb','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','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','predictive','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/setting','./models/action','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','optionPredictive','startPredictive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','syncQueueCallerAbandon','bind','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','then','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','debug','inspect','format','voice_queue:save','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','erlangAbandonmentRate','merge','startProgressive','startProgressive\x20value\x20cleared','handlePredictive','name','handlePredictive\x20interval\x20cleared','error','stack','contactsRescheduled','CAMPAIGN_STATUS','[getContactDialer2][ReScheduled]','contacts','message','[getContactDialer2][Empty]','state','statedesc','starttime','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','stringify','pick','Interval','\x20INTERVAL_IS_NULL','Intervals','NULL_INTERVAL','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','originated','sendMessageOneNotActive','DISACTIVED','is\x20disactive','[ifTime][Action]','prototype','isTrunkReachable','active','SIP/%s','reachable','status','Trunk','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','isEmpty','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','Action','command','iftime\x20%s,%s','interval','indexOf','true','catch','content','all','some','OVERTIME_GLOBAL_INTERVAL','[ifTime][promiseAll]'];(function(_0x251c85,_0x60b1ec){var _0x2886eb=function(_0x142837){while(--_0x142837){_0x251c85['push'](_0x251c85['shift']());}};_0x2886eb(++_0x60b1ec);}(_0x0ef0,0x186));var _0x00ef=function(_0x2c6af3,_0x3ce442){_0x2c6af3=_0x2c6af3-0x0;var _0x4895bf=_0x0ef0[_0x2c6af3];return _0x4895bf;};'use strict';var util=require('util');var _=require('lodash');var uuid=require('uuid');var moment=require('moment');var rr=require('rr');var Redis=require(_0x00ef('0x0'));var utils=require(_0x00ef('0x1'));var hopperUtils=require(_0x00ef('0x2'));var ut=require(_0x00ef('0x3'));var config=require(_0x00ef('0x4'));var logger=require(_0x00ef('0x5'))(_0x00ef('0x6'));var loggerBooked=require('../../../config/logger')('booked');var loggerPredictive=require(_0x00ef('0x5'))(_0x00ef('0x7'));var loggerPredictiveCalls=require(_0x00ef('0x5'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x00ef('0x5'))(_0x00ef('0x8'));var ami=require(_0x00ef('0x9'));config[_0x00ef('0xa')]=_[_0x00ef('0xb')](config['redis'],{'host':_0x00ef('0xc'),'port':0x18eb});var io=require(_0x00ef('0xd'))(new Redis(config[_0x00ef('0xa')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0x00ef('0xe'));var Interval=require('../rpc/interval');var Action=require(_0x00ef('0xf'));var History=require(_0x00ef('0x10'));var Final=require(_0x00ef('0x11'));var AgentComplete=require(_0x00ef('0x12'));var QueueCallerAbandon=require(_0x00ef('0x13'));var Hangup=require(_0x00ef('0x14'));var ipAgi=process[_0x00ef('0x15')][_0x00ef('0x16')]||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x13ff24){this[_0x00ef('0x17')]=this[_0x00ef('0x17')]?this['tail'][_0x00ef('0x18')](_0x13ff24):_0x13ff24();};function Dialer(_0x345183,_0x414157){this[_0x00ef('0x19')]=new Sequence();this[_0x00ef('0x1a')]=_0x414157;this['voiceQueues']=_0x345183[_0x00ef('0x1b')];this[_0x00ef('0x1c')]=_0x345183[_0x00ef('0x1c')];this[_0x00ef('0x1d')]=_0x345183['agents'];this[_0x00ef('0x1e')]=_0x345183['trunks'];this['maxNumberOriginate']=config[_0x00ef('0x1f')]||0x2;this[_0x00ef('0x20')]={};this[_0x00ef('0x21')]={};this['contactsId']={};this['uniqueId']={};this[_0x00ef('0x22')]={};this[_0x00ef('0x23')]={};this['startProgressive']={};this[_0x00ef('0x24')]={};this[_0x00ef('0x25')]={};this[_0x00ef('0x26')]={};this[_0x00ef('0x27')]={};ami['on'](_0x00ef('0x28'),this[_0x00ef('0x29')]['bind'](this));ami['on']('queuecallerabandon',this[_0x00ef('0x2a')][_0x00ef('0x2b')](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0x00ef('0x2b')](this));ami['on'](_0x00ef('0x2c'),this[_0x00ef('0x2d')][_0x00ef('0x2b')](this));ami['on'](_0x00ef('0x2e'),this[_0x00ef('0x8')][_0x00ef('0x2b')](this));ami['on'](_0x00ef('0x2f'),this[_0x00ef('0x30')]['bind'](this));ami['on'](_0x00ef('0x31'),this[_0x00ef('0x32')][_0x00ef('0x2b')](this));ami['on'](_0x00ef('0x33'),this[_0x00ef('0x34')][_0x00ef('0x2b')](this));ami['on']('varset',this['syncVarSet'][_0x00ef('0x2b')](this));ami['on']('queuemember',this[_0x00ef('0x35')][_0x00ef('0x2b')](this));ami['on'](_0x00ef('0x36'),this[_0x00ef('0x37')][_0x00ef('0x2b')](this));this['loopCampaigns']();this[_0x00ef('0x38')]();RpcSetting['getSettings']()[_0x00ef('0x39')](function(_0x4e6fce){previewRecallmeReminderInterval=_0x4e6fce[_0x00ef('0x3a')];});}function isNotNull(_0x675299){return _0x675299!==null&&!_[_0x00ef('0x3b')](_0x675299);}function msgResponse(_0x370866,_0x3cf184,_0x218aaa){return{'action':_0x370866,'response':_0x3cf184,'message':_0x218aaa,'stack':_0x218aaa};}function emit(_0x105f39,_0xa12c2e,_0xde9058){io['to'](_0x105f39)[_0x00ef('0x3c')](_0xa12c2e,_0xde9058);}function emitOutboundVoiceQueueSummary(_0x5b89bd){if(_0x5b89bd[_0x00ef('0x3d')]===_0x00ef('0x3e')){logger[_0x00ef('0x3f')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0x00ef('0x40')](_0x5b89bd,{'showHidden':![],'depth':null}));emit(util[_0x00ef('0x41')]('voice:queue:%s',_0x5b89bd['name']),_0x00ef('0x42'),_0x5b89bd);}}function checkGetDataPredictive(_0x3d877f){if(isNotNull(_0x3d877f)&&!_['isEmpty'](_0x3d877f)){loggerPredictive[_0x00ef('0x43')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x00ef('0x43')](_0x00ef('0x44'),_0x3d877f[_0x00ef('0x45')]);loggerPredictive[_0x00ef('0x43')](_0x00ef('0x46'),_0x3d877f[_0x00ef('0x47')]);loggerPredictive['info'](_0x00ef('0x48'),_0x3d877f[_0x00ef('0x49')]);loggerPredictive[_0x00ef('0x43')](_0x00ef('0x4a'),_0x3d877f[_0x00ef('0x4b')]);loggerPredictive[_0x00ef('0x43')](_0x00ef('0x4c'),_0x3d877f[_0x00ef('0x4d')]);loggerPredictive[_0x00ef('0x43')](_0x00ef('0x4e'),_0x3d877f[_0x00ef('0x4f')]);loggerPredictive[_0x00ef('0x43')](_0x00ef('0x50'));if(_0x3d877f['predictiveIntervalTotalCalls']>0x0){if(!_[_0x00ef('0x3b')](_0x3d877f[_0x00ef('0x4f')])&&_0x3d877f[_0x00ef('0x4f')]>0x0){return!![];}loggerPredictive[_0x00ef('0x43')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x00ef('0x3b')](_0x3d877f[_0x00ef('0x4d')])&&_0x3d877f[_0x00ef('0x4d')]>0x0){return!![];}loggerPredictive[_0x00ef('0x43')](_0x00ef('0x51'));}else{loggerPredictive[_0x00ef('0x43')](_0x00ef('0x52'));}}else{loggerPredictive['info']('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x1f074e){return function(_0xa4800){loggerPredictive[_0x00ef('0x43')](_0x00ef('0x53'));loggerPredictive['info'](_0x00ef('0x54'),_0xa4800[_0x00ef('0x55')]);loggerPredictive['info'](_0x00ef('0x56'),_0xa4800[_0x00ef('0x57')]);loggerPredictive['info'](_0x00ef('0x58'),_0xa4800['erlangAbandonmentRate']);loggerPredictive[_0x00ef('0x43')](_0x00ef('0x59'),_0xa4800[_0x00ef('0x5a')]);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xa4800[_0x00ef('0x5b')]);loggerPredictive['info']('---------------------------');_[_0x00ef('0x5c')](_0x1f074e,_0xa4800);};}function ifInterval(_0x48c73c,_0x4d45f9){if(_[_0x00ef('0x3b')](_0x4d45f9)){return![];}return utils['getSeconds'](undefined,_0x4d45f9)<_0x48c73c*0x3c;}function clearPredictiveAttributes(_0x41a708){if(_0x41a708[_0x00ef('0x5d')]){_0x41a708[_0x00ef('0x5d')]=undefined;loggerPredictive['debug'](_0x41a708['name'],_0x00ef('0x5e'));}if(_0x41a708[_0x00ef('0x23')]){_0x41a708[_0x00ef('0x23')]=undefined;loggerPredictive[_0x00ef('0x3f')](_0x41a708['name'],'startPredictive\x20value\x20cleared');}if(_0x41a708[_0x00ef('0x5f')]){clearInterval(_0x41a708[_0x00ef('0x5f')]);_0x41a708[_0x00ef('0x5f')]=undefined;loggerPredictive[_0x00ef('0x3f')](_0x41a708[_0x00ef('0x60')],_0x00ef('0x61'));}}function loggerCatchPredictive(_0x36fe19,_0x6867f7){return function(_0x3f54ed){loggerPredictive[_0x00ef('0x62')](_0x6867f7[_0x00ef('0x60')],_0x36fe19);loggerPredictive[_0x00ef('0x62')](_0x3f54ed[_0x00ef('0x63')]);clearPredictiveAttributes(_0x6867f7);};}function loggerCatch(_0x4cee28){return function(_0x10da91){logger[_0x00ef('0x62')](_0x4cee28,util[_0x00ef('0x40')](_0x10da91,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x218bf6,_0x1afbb9,_0x35b648){return function(_0x47073b){utils['checkContactLowerLimitOriginate'](_0x1afbb9,_0x35b648,0x0);logger[_0x00ef('0x62')](_0x218bf6,util[_0x00ef('0x40')](_0x47073b,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x171c60){return function(_0x45e495){if(isNotNull(_0x45e495)&&isNotNull(_0x45e495[0x0])){if(_0x45e495[0x0][_0x00ef('0x64')]>0x0){_0x171c60['message']=utils[_0x00ef('0x65')]['CONTACTS_RESCHEDULED'];logger[_0x00ef('0x43')](_0x00ef('0x66')+_0x171c60[_0x00ef('0x60')],_0x45e495[0x0][_0x00ef('0x64')],_0x00ef('0x67'));}else{_0x171c60[_0x00ef('0x68')]=utils[_0x00ef('0x65')]['NO_AVAILABLE_CONTACTS'];logger['info'](_0x00ef('0x69')+_0x171c60['name']);}}};}function createObjHistory(_0x4fa93e,_0x4edd07,_0xddfb50,_0x2fb80b,_0x13315b){_0x4fa93e[_0x00ef('0x68')]=_0xddfb50;var _0x4a98b7=new Action(_0x4fa93e,_0x4edd07);var _0x78d0ac=new History(_0x4a98b7);_0x78d0ac[_0x00ef('0x6a')]=_0x2fb80b;_0x78d0ac[_0x00ef('0x6b')]=_0x13315b;_0x78d0ac['endtime']=_0x4a98b7[_0x00ef('0x6c')];return _0x78d0ac;}function unlockQueueStatus(_0x2be19c,_0x4749b1){setTimeout(function(){if(_[_0x00ef('0x3b')](_0x2be19c['queueStatusComplete'])){loggerBooked[_0x00ef('0x62')](_0x00ef('0x6d'),_0x4749b1);}_0x2be19c[_0x00ef('0x6e')]=!![];loggerBooked[_0x00ef('0x43')](_0x00ef('0x6f'),_0x4749b1,JSON[_0x00ef('0x70')](_[_0x00ef('0x71')](_0x2be19c,[_0x00ef('0x60'),'queueStatusComplete'])));},0x1f3);}function checkInterval(_0x226690){return function(){if(!isNotNull(_0x226690[_0x00ef('0x72')])){_0x226690['message']=utils[_0x00ef('0x65')]['NULL_INTERVAL'];throw _0x226690['name']+_0x00ef('0x73');}if(!isNotNull(_0x226690[_0x00ef('0x72')][_0x00ef('0x74')])){_0x226690[_0x00ef('0x68')]=utils[_0x00ef('0x65')][_0x00ef('0x75')];throw _0x226690[_0x00ef('0x60')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_['isEmpty'](_0x226690[_0x00ef('0x72')]['Intervals']))){_0x226690['message']=utils['CAMPAIGN_STATUS'][_0x00ef('0x75')];throw _0x226690[_0x00ef('0x60')]+_0x00ef('0x73');}};}function checkIsIVRCampaignActive(_0xa73dbf){return function(){if(!utils[_0x00ef('0x76')](_0xa73dbf)){_0xa73dbf[_0x00ef('0x68')]=utils[_0x00ef('0x65')][_0x00ef('0x77')];throw _0xa73dbf[_0x00ef('0x60')]+_0x00ef('0x78');}};}function emitCampaignSummary(_0x41633c){if(utils[_0x00ef('0x79')](_0x41633c)){emit(util[_0x00ef('0x41')](_0x00ef('0x7a'),_0x41633c[_0x00ef('0x60')]),_0x00ef('0x7b'),_0x41633c);}}function loggerCatchQueueSummary(_0x12a426,_0x102723){return function(_0x1c1416){clearPredictiveAttributes(_0x102723);emitCampaignSummary(_0x102723);loggerSyncQueueSummary[_0x00ef('0x3f')](_0x12a426,util[_0x00ef('0x40')](_0x1c1416,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x5b7399){if(_0x5b7399['sendMessageOneNotActive']){if(_0x5b7399[_0x00ef('0x7c')]===0x0){_0x5b7399[_0x00ef('0x7d')]=![];_0x5b7399[_0x00ef('0x68')]=utils[_0x00ef('0x65')][_0x00ef('0x77')];loggerSyncQueueSummary['debug']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x5b7399[_0x00ef('0x60')],'is\x20not\x20active');}else{_0x5b7399['message']=utils[_0x00ef('0x65')][_0x00ef('0x7e')];loggerSyncQueueSummary['debug']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x5b7399['name'],_0x00ef('0x7f'));}emitCampaignSummary(_0x5b7399);}}function myreject(_0x395b0b){return function(_0x26b7c2){return _0x395b0b(msgResponse(_0x00ef('0x80'),'Error',JSON[_0x00ef('0x70')](_0x26b7c2)));};}Dialer[_0x00ef('0x81')][_0x00ef('0x82')]=function(_0x1ac225){return!_['isUndefined'](_0x1ac225)&&_0x1ac225&&!_[_0x00ef('0x3b')](_0x1ac225[_0x00ef('0x60')])&&!_[_0x00ef('0x3b')](_0x1ac225[_0x00ef('0x83')])&&_0x1ac225[_0x00ef('0x83')]&&(this[_0x00ef('0x1e')][util['format'](_0x00ef('0x84'),_0x1ac225[_0x00ef('0x60')])]['status']===_0x00ef('0x85')||this[_0x00ef('0x1e')][util[_0x00ef('0x41')]('SIP/%s',_0x1ac225['name'])][_0x00ef('0x86')]==='unmonitored');};Dialer['prototype']['checkIsTrunkReachable']=function(_0x2f51b9){var _0x3b11a7=this;return function(){if(!_0x3b11a7[_0x00ef('0x82')](_0x2f51b9[_0x00ef('0x87')])){if(!_0x3b11a7[_0x00ef('0x82')](_0x2f51b9[_0x00ef('0x88')])){_0x2f51b9['message']=utils[_0x00ef('0x65')]['TRUNK_NOT_REACHABLE'];throw _0x2f51b9[_0x00ef('0x60')]+_0x00ef('0x89');}}};};Dialer[_0x00ef('0x81')][_0x00ef('0x8a')]=function(_0x10def8,_0xdbfe3a,_0x153a47,_0x3fd096){var _0x4c7a8b=this;return function(){var _0x3a95bf=!![];return _0x4c7a8b[_0x00ef('0x8b')](_0x10def8,_0xdbfe3a,_0x153a47,_0x3fd096,_0x3a95bf);};};Dialer[_0x00ef('0x81')][_0x00ef('0x8c')]=function(_0x286577,_0x4ebbc8,_0x2fbb56,_0x5e1d4a){var _0x4b2fb8=this;return function(){var _0xc9dbb7=![];return _0x4b2fb8['ifTimeIvr'](_0x286577[_0x00ef('0x74')],_0x4ebbc8,_0x2fbb56,_0x5e1d4a,_0xc9dbb7);};};Dialer[_0x00ef('0x81')][_0x00ef('0x8b')]=function(_0x5b1fe8,_0x49f258,_0x1bc843,_0x2890be,_0x20de00){var _0x1312a1=[];return new Promise(function(_0x41ece9,_0x51242c){if(!isNotNull(_0x5b1fe8)){_0x2890be[_0x00ef('0x68')]=utils[_0x00ef('0x65')][_0x00ef('0x75')];return _0x51242c(msgResponse(_0x00ef('0x8d'),_0x00ef('0x8e'),_0x1bc843+_0x00ef('0x8f')));}if(_[_0x00ef('0x90')](_0x5b1fe8)){_0x2890be[_0x00ef('0x68')]=utils['CAMPAIGN_STATUS'][_0x00ef('0x91')];return _0x51242c(msgResponse(_0x00ef('0x8d'),'Failure',_0x1bc843+_0x00ef('0x92')));}if(_0x49f258&&_[_0x00ef('0x3b')](config[_0x00ef('0x93')][_0x49f258])){_0x2890be[_0x00ef('0x68')]=utils[_0x00ef('0x65')][_0x00ef('0x94')];return _0x51242c(msgResponse('ifTime',_0x00ef('0x8e'),_0x1bc843+_0x00ef('0x95')+_0x49f258));}if(_[_0x00ef('0x96')](_0x5b1fe8)){for(var _0x3034c9=0x0;_0x3034c9<_0x5b1fe8[_0x00ef('0x97')];_0x3034c9+=0x1){_0x1312a1['push'](ami[_0x00ef('0x98')]({'action':_0x00ef('0x99'),'command':util[_0x00ef('0x41')](_0x00ef('0x9a'),_0x5b1fe8[_0x3034c9][_0x00ef('0x9b')],!_[_0x00ef('0x3b')](config[_0x00ef('0x93')][_0x49f258])?_0x49f258:'')})[_0x00ef('0x39')](function(_0x248f44){return _0x248f44['content'][_0x00ef('0x9c')](_0x00ef('0x9d'))>=0x0;})[_0x00ef('0x9e')](myreject(_0x51242c)));}}else{_0x1312a1['push'](ami[_0x00ef('0x98')]({'action':'command','command':util[_0x00ef('0x41')](_0x00ef('0x9a'),_0x5b1fe8,!_[_0x00ef('0x3b')](config[_0x00ef('0x93')][_0x49f258])?_0x49f258:'')})[_0x00ef('0x39')](function(_0x51efa8){return _0x51efa8[_0x00ef('0x9f')][_0x00ef('0x9c')](_0x00ef('0x9d'))>=0x0;})[_0x00ef('0x9e')](myreject(_0x51242c)));}Promise[_0x00ef('0xa0')](_0x1312a1)[_0x00ef('0x39')](function(_0x681fa2){var _0x3ff4ab=_[_0x00ef('0xa1')](_0x681fa2);if(_0x3ff4ab){return _0x41ece9(_0x3ff4ab);}else{_0x2890be[_0x00ef('0x68')]=_0x20de00?utils[_0x00ef('0x65')][_0x00ef('0xa2')]:utils[_0x00ef('0x65')]['OVERTIME_INTERVAL'];return _0x51242c(msgResponse(_0x00ef('0xa3'),_0x00ef('0x8e'),_0x00ef('0xa4')+_0x20de00+'\x20'+_0x1bc843+_0x00ef('0xa5')+util[_0x00ef('0x40')](_0x5b1fe8,{'showHidden':![],'depth':null})+_0x00ef('0xa6')+_0x49f258));}})[_0x00ef('0x9e')](function(_0x5c7d9f){return _0x51242c(msgResponse('ifTime',_0x00ef('0x8e'),JSON[_0x00ef('0x70')](_0x5c7d9f)));});});};Dialer[_0x00ef('0x81')][_0x00ef('0xa7')]=function(){var _0x1535e1=this;return cmHopper[_0x00ef('0xa8')]({'active':![]},{'where':{'active':!![]}})['then'](function(){setInterval(function(){_0x1535e1[_0x00ef('0xa9')]();},0x3e8);});};Dialer[_0x00ef('0x81')]['syncCampaigns']=function(){var _0x5c5dd0=this;var _0x36ccf0;for(var _0x2fa7cf in this[_0x00ef('0x1c')]){if(typeof this[_0x00ef('0x1c')][_0x2fa7cf]!==_0x00ef('0xaa')){_0x36ccf0=this[_0x00ef('0x1c')][_0x2fa7cf];if(utils[_0x00ef('0x79')](_0x36ccf0)&&utils[_0x00ef('0x76')](_0x36ccf0)){_0x36ccf0[_0x00ef('0x7d')]=!![];Promise[_0x00ef('0xab')]()['then'](checkIsIVRCampaignActive(_0x36ccf0))[_0x00ef('0x39')](checkInterval(_0x36ccf0))[_0x00ef('0x39')](_0x5c5dd0['checkIsTrunkReachable'](_0x36ccf0))[_0x00ef('0x39')](_0x5c5dd0[_0x00ef('0x8a')](_0x36ccf0['dialGlobalInterval'],_0x36ccf0[_0x00ef('0xac')],_0x36ccf0[_0x00ef('0x60')],_0x36ccf0))[_0x00ef('0x39')](_0x5c5dd0['checkIfTimeIntervals'](_0x36ccf0[_0x00ef('0x72')],_0x36ccf0[_0x00ef('0xac')],_0x36ccf0[_0x00ef('0x60')],_0x36ccf0))[_0x00ef('0x39')](_0x5c5dd0[_0x00ef('0xad')](_0x36ccf0))[_0x00ef('0x9e')](loggerCatchQueueSummary(_0x00ef('0xae'),_0x36ccf0));}else{notSendMessagesCampaign(_0x36ccf0);}}}};Dialer[_0x00ef('0x81')][_0x00ef('0xaf')]=function(_0x1a0100){if(_0x1a0100[_0x00ef('0xb0')]!==_0x00ef('0x7')){clearPredictiveAttributes(_0x1a0100);}switch(_0x1a0100[_0x00ef('0xb0')]){case _0x00ef('0xb1'):this[_0x00ef('0xb2')](_0x1a0100,0x1);break;case _0x00ef('0xb3'):this[_0x00ef('0xb2')](_0x1a0100,_0x1a0100[_0x00ef('0xb4')]);break;case _0x00ef('0x7'):this[_0x00ef('0x7')](_0x1a0100);break;case _0x00ef('0xb5'):this[_0x00ef('0xb2')](_0x1a0100,0x1);break;default:logger[_0x00ef('0x62')](_0x00ef('0xb6'),_0x1a0100[_0x00ef('0x60')],_0x00ef('0xb7'));}};Dialer[_0x00ef('0x81')][_0x00ef('0x8d')]=function(_0x19e06c,_0x2bc1e8){var _0x4d4a05=_0x19e06c['dialTimezone'];var _0x10af63=_0x2bc1e8?_0x19e06c[_0x00ef('0xb8')]:_0x19e06c['Interval']['Intervals'];logger['silly']('Dialer::ifTime()',_0x10af63,_0x4d4a05,_0x19e06c['name'],util['format'](_0x00ef('0xb9'),_0x19e06c['name'],_0x19e06c['id']));var _0x132d89=null;return Interval[_0x00ef('0xba')](_0x10af63,_0x4d4a05)['then'](function(_0x265f66){if(_0x265f66===!![]){return _0x265f66;}else{_0x19e06c['message']=_0x2bc1e8?utils[_0x00ef('0x65')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0x00ef('0x65')][_0x00ef('0xbb')];_0x132d89=msgResponse(_0x00ef('0xa3'),_0x00ef('0x8e'),_0x00ef('0xa4')+_0x2bc1e8+'\x20'+_0x19e06c[_0x00ef('0x60')]+_0x00ef('0xa5')+util[_0x00ef('0x40')](_0x10af63,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x4d4a05);}if(_0x132d89!==null){logger[_0x00ef('0xbc')](_0x00ef('0xbd'),_0x132d89);_0x132d89[_0x00ef('0xbe')]=_0x2bc1e8;throw _0x132d89;}})[_0x00ef('0x9e')](function(_0x38ddc6){logger['error']('AMI\x20IfTime',_0x38ddc6);throw msgResponse(_0x00ef('0x80'),_0x00ef('0xbf'),util[_0x00ef('0x40')](_0x38ddc6,{'showHidden':![],'depth':null}));});};Dialer['prototype'][_0x00ef('0x29')]=function(_0x176fd1){if(this[_0x00ef('0x1b')][_0x176fd1[_0x00ef('0xc0')]]){if(this[_0x00ef('0xc1')][_0x176fd1['uniqueid']]&&this[_0x00ef('0xc1')][_0x176fd1[_0x00ef('0xc2')]]['type']!==_0x00ef('0xc3')){this[_0x00ef('0xc4')](this[_0x00ef('0x1b')][_0x176fd1[_0x00ef('0xc0')]]);this[_0x00ef('0xc1')][_0x176fd1[_0x00ef('0xc2')]][_0x00ef('0xc5')]=moment()['format'](_0x00ef('0xc6'));}}};Dialer['prototype']['syncAgentComplete']=function(_0x252699){var _0x4f6d34=this[_0x00ef('0xc1')][_0x252699['uniqueid']];if(this[_0x00ef('0x1b')][_0x252699[_0x00ef('0xc0')]]){if(_0x4f6d34&&_0x4f6d34['type']!==_0x00ef('0xc3')){delete this[_0x00ef('0xc1')][_0x252699[_0x00ef('0xc2')]];this[_0x00ef('0x1b')][_0x252699['queue']][_0x00ef('0xc7')]+=0x1;var _0x890bc2=new AgentComplete(_0x4f6d34,_0x252699);if(_0x252699[_0x00ef('0xc8')]===_0x00ef('0xc9')){_0x890bc2[_0x00ef('0xca')]=this[_0x00ef('0x1b')][_0x252699[_0x00ef('0xc0')]][_0x00ef('0xcb')]&&this[_0x00ef('0x1b')][_0x252699[_0x00ef('0xc0')]][_0x00ef('0xcc')]?moment()['format'](_0x00ef('0xc6')):undefined;}hopperUtils[_0x00ef('0xcd')](_0x890bc2)[_0x00ef('0x9e')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x890bc2)[_0x00ef('0x9e')](loggerCatch(_0x00ef('0xce')));}}};Dialer['prototype'][_0x00ef('0x2a')]=function(_0xee78e7){var _0x232c6a=this[_0x00ef('0xc1')][_0xee78e7[_0x00ef('0xc2')]];var _0x5a127c=this;var _0x5eaa09=![];var _0x9fc109;var _0x476dd9;if(this[_0x00ef('0x1b')][_0xee78e7['queue']]){if(_0x232c6a&&_0x232c6a[_0x00ef('0x3d')]!==_0x00ef('0xc3')){delete this[_0x00ef('0xc1')][_0xee78e7[_0x00ef('0xc2')]];this[_0x00ef('0xc4')](this[_0x00ef('0x1b')][_0xee78e7[_0x00ef('0xc0')]]);_0x232c6a['droptime']=moment()[_0x00ef('0x41')]('YYYY-MM-DD\x20HH:mm:ss');var _0x107cb7=new QueueCallerAbandon(_0x232c6a,_0xee78e7);if(utils[_0x00ef('0xcf')](_0x232c6a[_0x00ef('0xd0')],_0x232c6a['responsetime'])>=_0x232c6a[_0x00ef('0xd1')]){this[_0x00ef('0x1b')][_0xee78e7[_0x00ef('0xc0')]][_0x00ef('0x49')]+=0x1;this['voiceQueues'][_0xee78e7[_0x00ef('0xc0')]]['outboundDropCallsDayTimeout']+=0x1;this[_0x00ef('0x1b')][_0xee78e7['queue']][_0x00ef('0xd2')]+=0x1;_0x107cb7[_0x00ef('0x6a')]=0xa;_0x107cb7['statedesc']=_0x00ef('0xd3');_0x107cb7[_0x00ef('0xd4')]=_0x00ef('0xd5');_0x107cb7[_0x00ef('0xca')]=this[_0x00ef('0x1b')][_0xee78e7[_0x00ef('0xc0')]][_0x00ef('0xcb')]?moment()[_0x00ef('0x41')](_0x00ef('0xc6')):undefined;_0x107cb7['countdropretry']+=0x1;_0x107cb7[_0x00ef('0xd6')]+=0x1;_0x9fc109=this[_0x00ef('0x1b')][_0xee78e7[_0x00ef('0xc0')]][_0x00ef('0xd7')];_0x476dd9=this[_0x00ef('0x1b')][_0xee78e7[_0x00ef('0xc0')]][_0x00ef('0xd8')];hopperUtils[_0x00ef('0xd9')](_0x107cb7,_0x107cb7['state'],_0x232c6a[_0x00ef('0xda')])['then'](function(_0x3ccb74){_0x5eaa09=_0x3ccb74[_0x00ef('0xdb')]==0x1;if(_0x107cb7[_0x00ef('0xdc')]>=_0x5a127c[_0x00ef('0x1b')][_0xee78e7[_0x00ef('0xc0')]][_0x00ef('0xdd')]){_0x5a127c[_0x00ef('0xde')](_0x107cb7,_0x3ccb74[_0x00ef('0xdb')]);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x107cb7[_0x00ef('0xdc')],'scheduledat':moment()[_0x00ef('0xdf')](_0x5a127c[_0x00ef('0x1b')][_0xee78e7[_0x00ef('0xc0')]][_0x00ef('0xd7')],_0x00ef('0xe0'))['format'](_0x00ef('0xc6')),'ContactId':_0x232c6a[_0x00ef('0xe1')],'ListId':_0x232c6a[_0x00ef('0xe2')],'VoiceQueueId':_0x232c6a[_0x00ef('0xe3')]||undefined,'CampaignId':_0x232c6a[_0x00ef('0xe4')]||undefined})[_0x00ef('0x9e')](loggerCatch(_0x00ef('0xe5')));var _0x23039a=new History(_0x107cb7);_0x23039a[_0x00ef('0x6a')]=0xa;_0x23039a[_0x00ef('0x6b')]=_0x00ef('0xd3');_0x23039a[_0x00ef('0x6c')]=moment()[_0x00ef('0x41')](_0x00ef('0xc6'));_0x23039a[_0x00ef('0xe6')]=_0x23039a['starttime'];_0x23039a[_0x00ef('0xe7')]=_0x107cb7[_0x00ef('0xe7')];_0x23039a['calleridnum']=_0x107cb7[_0x00ef('0xe8')];hopperUtils[_0x00ef('0xcd')](_0x23039a)[_0x00ef('0x9e')](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0x00ef('0x39')](function(){if(_0x5eaa09)hopperUtils[_0x00ef('0xe9')](_0x107cb7,_0x9fc109,_0x476dd9)[_0x00ef('0x39')](function(){return 0x1;});});}else{this['voiceQueues'][_0xee78e7['queue']][_0x00ef('0x4b')]+=0x1;this['voiceQueues'][_0xee78e7[_0x00ef('0xc0')]][_0x00ef('0xea')]+=0x1;_0x107cb7[_0x00ef('0x6a')]=0xb;_0x107cb7[_0x00ef('0x6b')]='Abandoned';_0x107cb7['dropreason']=_0x00ef('0xeb');_0x107cb7[_0x00ef('0xec')]+=0x1;_0x107cb7['countglobal']+=0x1;_0x9fc109=this[_0x00ef('0x1b')][_0xee78e7[_0x00ef('0xc0')]]['dialAbandonedRetryFrequency'];_0x476dd9=this[_0x00ef('0x1b')][_0xee78e7[_0x00ef('0xc0')]][_0x00ef('0xd8')];hopperUtils[_0x00ef('0xd9')](_0x107cb7,_0x107cb7[_0x00ef('0x6a')],_0x232c6a['voiceQueue'])[_0x00ef('0x39')](function(_0x52df19){if(_0x107cb7[_0x00ef('0xec')]>=_0x5a127c[_0x00ef('0x1b')][_0xee78e7[_0x00ef('0xc0')]][_0x00ef('0xed')]){_0x5a127c[_0x00ef('0xde')](_0x107cb7,_0x52df19[_0x00ef('0xdb')]);}else{hopperUtils[_0x00ef('0xee')]({'active':![],'countabandonedretry':_0x107cb7[_0x00ef('0xec')],'scheduledat':moment()[_0x00ef('0xdf')](_0x5a127c[_0x00ef('0x1b')][_0xee78e7[_0x00ef('0xc0')]]['dialAbandonedRetryFrequency'],_0x00ef('0xe0'))[_0x00ef('0x41')](_0x00ef('0xc6')),'ContactId':_0x232c6a[_0x00ef('0xe1')],'ListId':_0x232c6a[_0x00ef('0xe2')],'VoiceQueueId':_0x232c6a[_0x00ef('0xe3')]||undefined,'CampaignId':_0x232c6a[_0x00ef('0xe4')]||undefined})[_0x00ef('0x9e')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x31d329=new History(_0x107cb7);_0x31d329[_0x00ef('0x6a')]=0xb;_0x31d329[_0x00ef('0x6b')]=_0x00ef('0xef');_0x31d329['starttime']=moment()[_0x00ef('0x41')](_0x00ef('0xc6'));_0x31d329['endtime']=_0x31d329[_0x00ef('0x6c')];_0x31d329[_0x00ef('0xe7')]=_0x107cb7[_0x00ef('0xe7')];_0x31d329[_0x00ef('0xe8')]=_0x107cb7['calleridnum'];hopperUtils[_0x00ef('0xcd')](_0x31d329)[_0x00ef('0x9e')](loggerCatch('[syncAgentComplete][createHistory][11]'));}})['then'](function(){if(_0x5eaa09)hopperUtils[_0x00ef('0xe9')](_0x107cb7,_0x9fc109,_0x476dd9)[_0x00ef('0x39')](function(){return 0x1;});});}}}};Dialer[_0x00ef('0x81')][_0x00ef('0x34')]=function(_0x5c0e7b){if(this[_0x00ef('0x21')][_0x5c0e7b['uniqueid']]){this[_0x00ef('0x21')][_0x5c0e7b[_0x00ef('0xc2')]][_0x00ef('0xf0')]=_0x5c0e7b['channel'];}if(this[_0x00ef('0xc1')][_0x5c0e7b[_0x00ef('0xc2')]]){this[_0x00ef('0xc1')][_0x5c0e7b[_0x00ef('0xc2')]][_0x00ef('0xf0')]=_0x5c0e7b['channel'];}};Dialer[_0x00ef('0x81')][_0x00ef('0x35')]=function(_0x3afa88){if(!this[_0x00ef('0x21')][_0x3afa88[_0x00ef('0xf1')]]){return;}var _0x4787fe=this[_0x00ef('0x1b')][this[_0x00ef('0x21')][_0x3afa88[_0x00ef('0xf1')]][_0x00ef('0xc0')]][_0x00ef('0xf2')]||'rrmemory';if(_0x4787fe===_0x00ef('0xf3')){if(this[_0x00ef('0x21')][_0x3afa88[_0x00ef('0xf1')]]&&_[_0x00ef('0xf4')](this[_0x00ef('0x21')][_0x3afa88[_0x00ef('0xf1')]][_0x00ef('0xf5')])&&_0x3afa88[_0x00ef('0x86')]==='1'&&_0x3afa88[_0x00ef('0xf6')]==='0'){if(this[_0x00ef('0x1d')][_0x3afa88['stateinterface']]){if(!this['agents'][_0x3afa88[_0x00ef('0xf7')]][_0x00ef('0xf5')]){this[_0x00ef('0x1d')][_0x3afa88['stateinterface']][_0x00ef('0xf5')]=!![];this[_0x00ef('0x21')][_0x3afa88[_0x00ef('0xf1')]]['locked']=!![];this[_0x00ef('0x21')][_0x3afa88['actionid']][_0x00ef('0xf7')]=_0x3afa88[_0x00ef('0xf7')];}}}}else if(_0x4787fe===_0x00ef('0xf8')){if(this[_0x00ef('0x21')][_0x3afa88['actionid']]){if(this[_0x00ef('0x1d')][_0x3afa88[_0x00ef('0xf7')]]){this[_0x00ef('0x21')][_0x3afa88[_0x00ef('0xf1')]][_0x00ef('0xf7')]=_0x3afa88[_0x00ef('0xf7')];if(_['isNil'](this[_0x00ef('0x25')][this[_0x00ef('0x21')][_0x3afa88['actionid']]['queue']])){this[_0x00ef('0x25')][this[_0x00ef('0x21')][_0x3afa88[_0x00ef('0xf1')]][_0x00ef('0xc0')]]=[];}this[_0x00ef('0x25')][this[_0x00ef('0x21')][_0x3afa88[_0x00ef('0xf1')]][_0x00ef('0xc0')]][_0x00ef('0xf9')](_[_0x00ef('0x5c')](_[_0x00ef('0x71')](this[_0x00ef('0x21')][_0x3afa88[_0x00ef('0xf1')]],[_0x00ef('0xfa'),_0x00ef('0xf7')]),{'status':_0x3afa88['status'],'paused':_0x3afa88[_0x00ef('0xf6')]}));}}}};Dialer['prototype'][_0x00ef('0x37')]=function(_0x9a2157){if(!this[_0x00ef('0x21')][_0x9a2157['actionid']]){return;}var _0x3cc919=this;var _0x3c6a77=this[_0x00ef('0x1b')][this[_0x00ef('0x21')][_0x9a2157[_0x00ef('0xf1')]][_0x00ef('0xc0')]];var _0x48141c=_0x3c6a77[_0x00ef('0xf2')]||'rrmemory';if(_0x48141c===_0x00ef('0xf3')){if(this['actions'][_0x9a2157['actionid']]&&this[_0x00ef('0x21')][_0x9a2157[_0x00ef('0xf1')]]['stateinterface']){this[_0x00ef('0x1a')][_0x00ef('0xfb')](this[_0x00ef('0x21')][_0x9a2157[_0x00ef('0xf1')]][_0x00ef('0xfa')],this[_0x00ef('0x21')][_0x9a2157[_0x00ef('0xf1')]]['stateinterface'])[_0x00ef('0x9e')](function(_0x5c02a4){logger[_0x00ef('0x62')](_0x00ef('0xfc'),util[_0x00ef('0x40')](_0x5c02a4,{'showHidden':![],'depth':null}));})[_0x00ef('0x18')](function(){_0x3cc919[_0x00ef('0xc4')](_0x3cc919[_0x00ef('0x1b')][_0x3cc919[_0x00ef('0x21')][_0x9a2157['actionid']][_0x00ef('0xc0')]]);_0x3cc919['agents'][_0x3cc919['actions'][_0x9a2157[_0x00ef('0xf1')]][_0x00ef('0xf7')]][_0x00ef('0xf5')]=![];delete _0x3cc919[_0x00ef('0x21')][_0x9a2157['actionid']];unlockQueueStatus(_0x3c6a77);});}else{this[_0x00ef('0xc4')](this[_0x00ef('0x1b')][this[_0x00ef('0x21')][_0x9a2157[_0x00ef('0xf1')]][_0x00ef('0xc0')]]);hopperUtils['rescheduleContact']({'active':![],'ContactId':this[_0x00ef('0x21')][_0x9a2157[_0x00ef('0xf1')]][_0x00ef('0xe1')],'ListId':this[_0x00ef('0x21')][_0x9a2157[_0x00ef('0xf1')]][_0x00ef('0xe2')],'VoiceQueueId':this[_0x00ef('0x21')][_0x9a2157['actionid']][_0x00ef('0xe3')]||undefined,'CampaignId':this[_0x00ef('0x21')][_0x9a2157[_0x00ef('0xf1')]]['CampaignId']||undefined})[_0x00ef('0x9e')](loggerCatch(_0x00ef('0xfd')));delete this[_0x00ef('0x21')][_0x9a2157['actionid']];unlockQueueStatus(_0x3c6a77);}}else if(_0x48141c==='rrmemory'){var _0x455e27;if(this[_0x00ef('0x21')][_0x9a2157[_0x00ef('0xf1')]]&&!_[_0x00ef('0x90')](this[_0x00ef('0x25')][this[_0x00ef('0x21')][_0x9a2157[_0x00ef('0xf1')]][_0x00ef('0xc0')]])){if(this[_0x00ef('0x26')][_0x3cc919['actions'][_0x9a2157[_0x00ef('0xf1')]][_0x00ef('0xc0')]]){this[_0x00ef('0x26')][_0x3cc919['actions'][_0x9a2157[_0x00ef('0xf1')]][_0x00ef('0xc0')]]=this['queueBookedRR'][this['actions'][_0x9a2157[_0x00ef('0xf1')]]['queue']]?this['queueBookedRR'][this[_0x00ef('0x21')][_0x9a2157[_0x00ef('0xf1')]][_0x00ef('0xc0')]]:this[_0x00ef('0x25')][this[_0x00ef('0x21')][_0x9a2157[_0x00ef('0xf1')]][_0x00ef('0xc0')]]?this[_0x00ef('0x25')][this['actions'][_0x9a2157[_0x00ef('0xf1')]][_0x00ef('0xc0')]][_0x00ef('0xfe')]||0x0:0x0;}this[_0x00ef('0x25')][this[_0x00ef('0x21')][_0x9a2157[_0x00ef('0xf1')]]['queue']][_0x00ef('0xfe')]=this[_0x00ef('0x26')][this[_0x00ef('0x21')][_0x9a2157['actionid']][_0x00ef('0xc0')]];for(var _0x7cd8f6=0x0;_0x7cd8f6=_0x1cdd65[_0x00ef('0x126')]){_0x412956[_0x00ef('0x127')](_0x318d0b,_0x39bab6,_0x1c5fe1,_0x00ef('0x128'));}else{if(_0x318d0b[_0x00ef('0x11e')]>=_0x1cdd65[_0x00ef('0x129')]){_0x412956[_0x00ef('0x12a')](_0x318d0b,_0x39bab6,_0x1c5fe1,_0x00ef('0x12b'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x318d0b['countmachineretry'],'scheduledat':moment()[_0x00ef('0xdf')](_0x1cdd65['dialMachineRetryFrequency'],'minutes')[_0x00ef('0x41')](_0x00ef('0xc6')),'ContactId':_0x318d0b[_0x00ef('0xe1')],'ListId':_0x318d0b[_0x00ef('0xe2')],'VoiceQueueId':_0x318d0b[_0x00ef('0xe3')]||undefined,'CampaignId':_0x318d0b[_0x00ef('0xe4')]||undefined})[_0x00ef('0x9e')](loggerCatch(_0x00ef('0x12c')));_0x39bab6({'reschedule':0x1});}}});}if(_0x3b4aac[_0x00ef('0x3d')]===_0x00ef('0xc3')&&this[_0x00ef('0x1c')][_0x3b4aac[_0x00ef('0xc0')]][_0x00ef('0x11a')]&&_0x35dad8[_0x00ef('0x111')]===_0x00ef('0x112')){delete this[_0x00ef('0xc1')][_0x35dad8['uniqueid']];this[_0x00ef('0xc4')](this['campaigns'][_0x3b4aac['queue']]);_0x2f2a3a=new Hangup(_0x3b4aac,_0x35dad8);_0x2f2a3a['state']=0x12;_0x2f2a3a[_0x00ef('0x6b')]='HangupInAMD';_0x2f2a3a[_0x00ef('0x115')]=_0x00ef('0x11d');ami[_0x00ef('0x3c')](_0x00ef('0x120'),ut[_0x00ef('0x116')](_0x2f2a3a,_0x00ef('0x11f')));this[_0x00ef('0x117')](_0x2f2a3a,_0x00ef('0x12d'),_0x00ef('0x12e'));}if(_0x3b4aac[_0x00ef('0x3d')]===_0x00ef('0xc3')&&this[_0x00ef('0x1c')][_0x3b4aac[_0x00ef('0xc0')]][_0x00ef('0x11a')]&&_0x35dad8['value']===_0x00ef('0x11b')){return new Promise(function(_0x5c9c21,_0x5b0171){delete _0x412956[_0x00ef('0xc1')][_0x35dad8[_0x00ef('0xc2')]];_0x412956[_0x00ef('0xc4')](_0x412956[_0x00ef('0x1c')][_0x3b4aac[_0x00ef('0xc0')]]);_0x412956[_0x00ef('0x1c')][_0x3b4aac[_0x00ef('0xc0')]][_0x00ef('0xc7')]+=0x1;_0x412956[_0x00ef('0x1c')][_0x3b4aac['queue']][_0x00ef('0x113')]+=0x1;var _0x4da351=_0x412956[_0x00ef('0x1c')][_0x3b4aac[_0x00ef('0xc0')]];var _0x54906f=new Hangup(_0x3b4aac,_0x35dad8);_0x54906f[_0x00ef('0x6a')]=0x13;_0x54906f['statedesc']=_0x00ef('0x11c');_0x54906f['membername']='AMD';_0x54906f[_0x00ef('0x11e')]+=0x1;_0x54906f[_0x00ef('0xd6')]+=0x1;_0x54906f[_0x00ef('0x11f')]=!![];ami['emit']('custom:amd',ut[_0x00ef('0x116')](_0x54906f,_0x00ef('0x11f')));hopperUtils[_0x00ef('0xcd')](_0x54906f)[_0x00ef('0x9e')](loggerCatch(_0x00ef('0x121')));if(_0x54906f[_0x00ef('0x122')]+_0x54906f[_0x00ef('0x123')]+_0x54906f[_0x00ef('0x124')]+_0x54906f[_0x00ef('0x125')]+_0x54906f[_0x00ef('0xdc')]+_0x54906f['countabandonedretry']+_0x54906f[_0x00ef('0x11e')]+_0x54906f[_0x00ef('0x12f')]>=_0x4da351[_0x00ef('0x126')]){_0x412956[_0x00ef('0x127')](_0x54906f,_0x5c9c21,_0x5b0171,_0x00ef('0x128'));}else{if(_0x54906f[_0x00ef('0x11e')]>=_0x4da351[_0x00ef('0x129')]){_0x412956[_0x00ef('0x12a')](_0x54906f,_0x5c9c21,_0x5b0171,'reason\x2019\x20machine....');}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x54906f[_0x00ef('0x11e')],'scheduledat':moment()[_0x00ef('0xdf')](_0x4da351[_0x00ef('0x130')],_0x00ef('0xe0'))['format'](_0x00ef('0xc6')),'ContactId':_0x54906f[_0x00ef('0xe1')],'ListId':_0x54906f['ListId'],'VoiceQueueId':_0x54906f['VoiceQueueId']||undefined,'CampaignId':_0x54906f['CampaignId']||undefined})[_0x00ef('0x9e')](loggerCatch('[rescheduleContact][Machine]'));_0x5c9c21({'reschedule':0x1});}}});}}};Dialer[_0x00ef('0x81')][_0x00ef('0x32')]=function(_0x2c4aa5){var _0x1d28ad=this[_0x00ef('0xc1')][_0x2c4aa5[_0x00ef('0xc2')]];var _0x5bc2cf;if(_0x1d28ad&&_0x1d28ad[_0x00ef('0x3d')]==='ivr'){delete this[_0x00ef('0xc1')][_0x2c4aa5[_0x00ef('0xc2')]];this[_0x00ef('0xc4')](this[_0x00ef('0x1c')][_0x1d28ad['queue']]);this['campaigns'][_0x1d28ad[_0x00ef('0xc0')]][_0x00ef('0x131')]+=0x1;_0x5bc2cf=new Hangup(_0x1d28ad,_0x2c4aa5);hopperUtils[_0x00ef('0xcd')](_0x5bc2cf)[_0x00ef('0x9e')](loggerCatch(_0x00ef('0x132')));hopperUtils[_0x00ef('0x133')](_0x5bc2cf)[_0x00ef('0x9e')](loggerCatch(_0x00ef('0x134')));}if(_0x1d28ad&&_0x1d28ad[_0x00ef('0x3d')]!=='ivr'&&isNotNull(this['voiceQueues'][_0x1d28ad[_0x00ef('0xc0')]][_0x00ef('0x135')])){delete this[_0x00ef('0xc1')][_0x2c4aa5[_0x00ef('0xc2')]];this['updateOriginated'](this[_0x00ef('0x1b')][_0x1d28ad[_0x00ef('0xc0')]]);this[_0x00ef('0x1b')][_0x1d28ad[_0x00ef('0xc0')]][_0x00ef('0xc7')]+=0x1;this[_0x00ef('0x1b')][_0x1d28ad['queue']]['outboundAnswerAgiCallsDay']+=0x1;_0x5bc2cf=new Hangup(_0x1d28ad,_0x2c4aa5);_0x5bc2cf[_0x00ef('0x6a')]=0x10;_0x5bc2cf[_0x00ef('0x6b')]=_0x00ef('0x136');_0x5bc2cf[_0x00ef('0x115')]=_0x00ef('0x137');hopperUtils[_0x00ef('0xcd')](_0x5bc2cf)[_0x00ef('0x9e')](loggerCatch(_0x00ef('0x132')));hopperUtils[_0x00ef('0x133')](_0x5bc2cf)[_0x00ef('0x9e')](loggerCatch(_0x00ef('0x134')));}if(_0x1d28ad&&_0x1d28ad['type']!==_0x00ef('0xc3')&&!isNotNull(this[_0x00ef('0x1b')][_0x1d28ad[_0x00ef('0xc0')]][_0x00ef('0x135')])){delete this[_0x00ef('0xc1')][_0x2c4aa5[_0x00ef('0xc2')]];this[_0x00ef('0xc4')](this['voiceQueues'][_0x1d28ad[_0x00ef('0xc0')]]);this[_0x00ef('0x1b')][_0x1d28ad[_0x00ef('0xc0')]][_0x00ef('0x138')]+=0x1;_0x5bc2cf=new Hangup(_0x1d28ad,_0x2c4aa5);_0x5bc2cf[_0x00ef('0x6a')]=0xc;_0x5bc2cf[_0x00ef('0x6b')]=_0x2c4aa5[_0x00ef('0x139')];_0x5bc2cf[_0x00ef('0x115')]='Unknow';hopperUtils[_0x00ef('0xcd')](_0x5bc2cf)[_0x00ef('0x9e')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x00ef('0x133')](_0x5bc2cf)[_0x00ef('0x9e')](loggerCatch(_0x00ef('0x134')));}};Dialer[_0x00ef('0x81')]['syncQueueSummary']=function(_0x25ae92){var _0x4e2771=this;if(!_0x4e2771[_0x00ef('0x27')][_0x25ae92[_0x00ef('0x60')]]){_0x4e2771[_0x00ef('0x27')][_0x25ae92['name']]={'running':![]};}else if(_0x4e2771[_0x00ef('0x27')][_0x25ae92[_0x00ef('0x60')]][_0x00ef('0x13a')]===!![]){return;}else if(_0x4e2771[_0x00ef('0x27')][_0x25ae92[_0x00ef('0x60')]][_0x00ef('0x13a')]===![]){_0x4e2771[_0x00ef('0x27')][_0x25ae92[_0x00ef('0x60')]][_0x00ef('0x13a')]=!![];}var _0x19b327=_0x4e2771[_0x00ef('0x1b')][_0x25ae92['name']];var _0x321278=_0x19b327[_0x00ef('0x68')]!==utils[_0x00ef('0x65')][_0x00ef('0x77')];var _0x150615=utils[_0x00ef('0x13b')](_0x19b327);_0x19b327['statusMessage']=utils[_0x00ef('0x13c')](_0x19b327,_0x4e2771[_0x00ef('0x1e')]);Promise[_0x00ef('0xab')]()[_0x00ef('0x39')](function(){if(_0x19b327[_0x00ef('0x13d')]===utils[_0x00ef('0x65')][_0x00ef('0x77')]){if(_0x321278){clearPredictiveAttributes(_0x19b327);_0x25ae92['startPredictive']=undefined;_0x25ae92[_0x00ef('0x5d')]=undefined;}if(_0x19b327[_0x00ef('0x13d')]===utils['CAMPAIGN_STATUS']['INACTIVE']){_0x25ae92[_0x00ef('0x13e')]=0x0;_0x25ae92[_0x00ef('0xf6')]=0x0;_0x25ae92[_0x00ef('0x13f')]=0x0;_0x25ae92['talking']=0x0;_0x25ae92['pTalking']=0x0;}}else if(_0x19b327[_0x00ef('0x13d')]===utils[_0x00ef('0x65')][_0x00ef('0x140')]&&!_0x150615){return _0x4e2771[_0x00ef('0x8d')](_0x19b327,!![])['then'](function(){return _0x4e2771[_0x00ef('0x8d')](_0x19b327,![]);})[_0x00ef('0x39')](function(){return _0x4e2771[_0x00ef('0xaf')](_0x19b327);})['catch'](function(_0x33b22b){loggerSyncQueueSummary[_0x00ef('0x3f')](_0x00ef('0x141'),util[_0x00ef('0x40')](_0x33b22b,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x19b327);});}else{clearPredictiveAttributes(_0x19b327);}})[_0x00ef('0x39')](function(){var _0x5493d3=_0x25ae92[_0x00ef('0x142')](_0x19b327);if(_0x5493d3||_0x19b327[_0x00ef('0x143')]){_0x19b327[_0x00ef('0x143')]=![];_0x25ae92[_0x00ef('0x144')](_0x19b327);Object['assign'](_0x19b327,_0x25ae92);emitOutboundVoiceQueueSummary(_0x25ae92);}_0x4e2771['queuesSummary'][_0x19b327[_0x00ef('0x60')]]['running']=![];})[_0x00ef('0x9e')](function(_0x243fad){logger['error'](_0x00ef('0x141'),util[_0x00ef('0x40')](_0x243fad,{'showHidden':![],'depth':null}));_0x4e2771['queuesSummary'][_0x19b327['name']]['running']=![];});};Dialer[_0x00ef('0x81')][_0x00ef('0x30')]=_[_0x00ef('0x145')](function(){var _0x11d6cb=_[_0x00ef('0x146')](this[_0x00ef('0x1b')],function(_0x1b9b12){return _0x1b9b12[_0x00ef('0x147')];});var _0x11b180=_['filter'](this[_0x00ef('0x1d')],function(_0xd6038e){return _0xd6038e[_0x00ef('0x148')]&&_0xd6038e[_0x00ef('0x86')]===_0x00ef('0x85');});if(_0x11d6cb[_0x00ef('0x97')]>0x0&&_0x11b180[_0x00ef('0x97')]>0x0){return Promise[_0x00ef('0xab')]()['then'](cmHopper[_0x00ef('0x149')](_[_0x00ef('0x14a')](_0x11d6cb,'id'),previewRecallmeReminderInterval,_[_0x00ef('0x14a')](_0x11b180,'id')))[_0x00ef('0x39')](function(_0x2b051e){for(var _0x2f4126=0x0;_0x2f4126<_0x2b051e['length'];_0x2f4126++){var _0xe7dd5d=_0x2b051e[_0x2f4126][_0x00ef('0x14b')][_0x00ef('0x60')];if(_0xe7dd5d)io['to'](util[_0x00ef('0x41')]('user:%s',_0xe7dd5d))['emit'](_0x00ef('0x14c'),{'hopper':_0x2b051e[_0x2f4126]});}})['catch'](function(_0x152ec2){logger['error']('checkPreviewRecallReminder',_0x152ec2);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x00ef('0x81')][_0x00ef('0x38')]=function(){var _0x4b587c=this;setInterval(function(){_0x4b587c['clearZombieChannels'](_0x4b587c[_0x00ef('0xc1')],_0x00ef('0x14d'));_0x4b587c[_0x00ef('0x14e')](_0x4b587c[_0x00ef('0x21')],'[actions]');},0x32c8);};Dialer[_0x00ef('0x81')]['clearZombieChannels']=function(_0x24099f,_0x407f86){var _0x5ce298=this;for(var _0x1661c5 in _0x24099f){if(typeof _0x24099f[_0x1661c5]!==_0x00ef('0xaa')){this[_0x00ef('0x19')][_0x00ef('0x14f')](function(){if(!_[_0x00ef('0xf4')](_0x24099f[_0x1661c5])){return ami['Action']({'action':_0x00ef('0x86'),'channel':_0x24099f[_0x1661c5][_0x00ef('0xf0')]})[_0x00ef('0x9e')](function(_0x591c21){if(_0x591c21[_0x00ef('0x68')]===_0x00ef('0x150')){setTimeout(function(){if(_0x24099f[_0x1661c5]&&_0x24099f[_0x1661c5]['type']!==_0x00ef('0xc3')){_0x5ce298['updateOriginated'](_0x5ce298[_0x00ef('0x1b')][_0x24099f[_0x1661c5][_0x00ef('0xc0')]]);logger[_0x00ef('0x62')](_0x00ef('0x151'),_0x407f86,_0x1661c5,_0x24099f[_0x1661c5]['queue']);delete _0x24099f[_0x1661c5];}if(_0x24099f[_0x1661c5]&&_0x24099f[_0x1661c5]['type']===_0x00ef('0xc3')){_0x5ce298['updateOriginated'](_0x5ce298[_0x00ef('0x1c')][_0x24099f[_0x1661c5]['queue']]);logger['error'](_0x00ef('0x152'),_0x407f86,_0x1661c5,_0x24099f[_0x1661c5][_0x00ef('0xc0')]);delete _0x24099f[_0x1661c5];}},0x2328);}});}});}}};Dialer[_0x00ef('0x81')][_0x00ef('0x153')]=function(_0x5e8722){return Promise[_0x00ef('0xab')]()['then'](voiceQueueRt[_0x00ef('0x153')](_0x5e8722))[_0x00ef('0x9e')](loggerCatch(_0x00ef('0x154')));};Dialer[_0x00ef('0x81')][_0x00ef('0xc4')]=function(_0x412d04){if(!_[_0x00ef('0x3b')](_0x412d04)&&_0x412d04!==null){if(typeof _0x412d04['originated']!==_0x00ef('0xaa')){if(_0x412d04['originated']>0x0){_0x412d04[_0x00ef('0x7c')]-=0x1;}else{logger['error'](_0x00ef('0x155'));}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer['prototype']['loggerHandler']=function(_0x343045,_0x45ea02){var _0xf646a=this;return function(_0x110f73){_0xf646a[_0x00ef('0xc4')](_0x45ea02);logger[_0x00ef('0x62')](_0x343045,util['inspect'](_0x110f73,{'showHidden':![],'depth':null}));};};Dialer[_0x00ef('0x81')][_0x00ef('0x156')]=function(_0x3b1f40,_0x319e21,_0x4aec24){var _0x3b36a8={'state':0x19,'statedesc':_0x00ef('0x157')};this['updateOriginated'](_0x319e21);this[_0x00ef('0x117')](_[_0x00ef('0x5c')](_0x3b36a8,_[_0x00ef('0x71')](_0x4aec24,[_0x00ef('0xe1'),_0x00ef('0xe2'),_0x00ef('0x158'),_0x00ef('0xe3'),_0x00ef('0xe4')])),_0x00ef('0x159'),'[emptyContact]');logger[_0x00ef('0x62')](_0x3b1f40);};Dialer[_0x00ef('0x81')][_0x00ef('0x117')]=function(_0x322d33,_0x5b8587,_0xf8c4ba){hopperUtils['createHistory'](_0x322d33)['catch'](loggerCatch(_0x5b8587));hopperUtils[_0x00ef('0x133')](_0x322d33)[_0x00ef('0x9e')](loggerCatch(_0xf8c4ba));};Dialer[_0x00ef('0x81')][_0x00ef('0xde')]=function(_0x114ff9,_0x113b6f){hopperUtils[_0x00ef('0xcd')](_0x114ff9)['catch'](loggerCatch(_0x00ef('0x15a')));if(_0x113b6f==0x0){hopperUtils[_0x00ef('0x133')](_0x114ff9)[_0x00ef('0x9e')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer[_0x00ef('0x81')]['checkPreviewRecallReminder']=function(_0x36d538){return Promise[_0x00ef('0xab')]()['then'](cmHopper['handlePreviewRecallNotifications'](_0x36d538['id'],previewRecallmeReminderInterval))['then'](function(_0x4b173d){for(var _0x568667=0x0;_0x568667<_0x4b173d[_0x00ef('0x97')];_0x568667++){var _0x3aebd4=_0x4b173d[_0x568667][_0x00ef('0x14b')][_0x00ef('0x60')];if(_0x3aebd4)io['to'](util['format'](_0x00ef('0x15b'),_0x3aebd4))[_0x00ef('0x3c')](_0x00ef('0x14c'),{'hopper':_0x4b173d[_0x568667]});}})['catch'](function(){});};Dialer[_0x00ef('0x81')][_0x00ef('0xad')]=function(_0x17fbb0){var _0x644088=this;return function(){_0x644088[_0x00ef('0x15c')](_0x17fbb0);};};Dialer['prototype']['actionOriginate']=function(_0x4bf2a3,_0x58d300){var _0x509f86=this;var _0x5c46cf=uuid['v4']();this['actions'][_0x5c46cf]=new Action(_0x4bf2a3,_0x58d300,_0x5c46cf);return new Promise(function(_0xd2fae4,_0x59b42f){if(_[_0x00ef('0x3b')](_0x4bf2a3)&&typeof _0x4bf2a3!==_0x00ef('0x15d')){return _0x59b42f(msgResponse('originate','Failure',_0x00ef('0x15e')));}if(_[_0x00ef('0x3b')](_0x58d300[_0x00ef('0x15f')])||_0x58d300[_0x00ef('0x15f')]===null){return _0x59b42f(msgResponse(_0x00ef('0x160'),'Failure',_0x00ef('0x161')));}var _0x20cbda={'XMD-CALLERID':_0x509f86['actions'][_0x5c46cf]['getCaller'](),'XMD-AGI':_0x4bf2a3[_0x00ef('0x135')]?util['format'](_0x00ef('0x162'),ipAgi,_0x4bf2a3[_0x00ef('0x135')]):_0x00ef('0x163'),'XMD-AGIAFTER':_0x4bf2a3['dialQueueProject2']?util[_0x00ef('0x41')]('\x22agi://%s/square,%s\x22',ipAgi,_0x4bf2a3[_0x00ef('0xcb')]):_0x00ef('0x163'),'XMD-QUEUE':utils[_0x00ef('0x164')](_0x4bf2a3)?util[_0x00ef('0x41')]('\x22%s,%s%s,,,%s\x22',_0x4bf2a3[_0x00ef('0x60')],_0x4bf2a3[_0x00ef('0x165')]||'',_0x4bf2a3['dialAgiAfterHangupAgent']?'c':'',_0x4bf2a3[_0x00ef('0xd1')]||0x3):'NONE','XMD-CONTACTID':_0x58d300[_0x00ef('0xe1')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x509f86['actions'][_0x5c46cf][_0x00ef('0x166')](),'XMD-AMD':_0x4bf2a3[_0x00ef('0x11a')]?_0x00ef('0x140'):_0x00ef('0x163'),'XMD-DESTINATION':_0x00ef('0x110')};if(_0x4bf2a3['dialAMDActive']){_0x20cbda['XMD-AMDINITIALSILENCE']=_0x4bf2a3[_0x00ef('0x167')]||0x9c4;_0x20cbda[_0x00ef('0x168')]=_0x4bf2a3[_0x00ef('0x169')]||0x5dc;_0x20cbda[_0x00ef('0x16a')]=_0x4bf2a3[_0x00ef('0x16b')]||0x320;_0x20cbda[_0x00ef('0x16c')]=_0x4bf2a3[_0x00ef('0x16d')]||0x1388;_0x20cbda[_0x00ef('0x16e')]=_0x4bf2a3[_0x00ef('0x16f')]||0x64;_0x20cbda[_0x00ef('0x170')]=_0x4bf2a3[_0x00ef('0x171')]||0x32;_0x20cbda[_0x00ef('0x172')]=_0x4bf2a3[_0x00ef('0x173')]||0x3;_0x20cbda[_0x00ef('0x174')]=_0x4bf2a3[_0x00ef('0x175')]||0x100;_0x20cbda[_0x00ef('0x176')]=_0x4bf2a3[_0x00ef('0x177')]||0x1388;}if(utils[_0x00ef('0x164')](_0x4bf2a3)){_0x20cbda[_0x00ef('0x178')]=_0x58d300[_0x00ef('0xe3')];}else{_0x20cbda[_0x00ef('0x179')]=_0x58d300[_0x00ef('0xe4')];}for(var _0x95daf4 in _0x58d300[_0x00ef('0x17a')]){if(typeof _0x58d300[_0x00ef('0x17a')][_0x95daf4]!==_0x00ef('0xaa')){if(isNotNull(_0x58d300[_0x00ef('0x17a')][_0x95daf4])&&_0x95daf4!=='id'&&_0x95daf4!==_0x00ef('0x17b')&&_0x95daf4!==_0x00ef('0x17c')&&_0x95daf4!==_0x00ef('0x17d')){_0x20cbda[util[_0x00ef('0x41')]('%s%s',_0x00ef('0x17e'),_['toUpper'](_0x95daf4))]=_0x58d300[_0x00ef('0x17a')][_0x95daf4];}}}var _0x254b91=_0x509f86['isTrunkReachable'](_0x4bf2a3[_0x00ef('0x87')])?utils[_0x00ef('0x17f')](_0x4bf2a3[_0x00ef('0x87')]['callerid'],_0x4bf2a3[_0x00ef('0x180')],_0x4bf2a3['dialRandomLastDigitCallerIdNumber']>0x0?utils['getCallerIdRandom'](_0x4bf2a3[_0x00ef('0x181')],_0x4bf2a3[_0x00ef('0x182')]):_0x4bf2a3[_0x00ef('0x181')]):utils[_0x00ef('0x17f')](_['isNil'](_0x4bf2a3['TrunkBackup'])?_0x4bf2a3[_0x00ef('0x87')][_0x00ef('0x183')]:_0x4bf2a3[_0x00ef('0x88')]['callerid'],_0x4bf2a3[_0x00ef('0x180')],_0x4bf2a3[_0x00ef('0x182')]>0x0?utils[_0x00ef('0x184')](_0x4bf2a3[_0x00ef('0x181')],_0x4bf2a3[_0x00ef('0x182')]):_0x4bf2a3[_0x00ef('0x181')]);if(_0x254b91){_0x20cbda[_0x00ef('0x185')]=_0x509f86[_0x00ef('0x21')][_0x5c46cf][_0x00ef('0x186')]=utils['extractCalleridName'](_0x254b91);_0x20cbda['XMD-ORIGINATECALLERIDNUM']=_0x58d300[_0x00ef('0x15f')];}_0x4bf2a3[_0x00ef('0x187')]=_0x20cbda;return ami['Action']({'actionid':_0x5c46cf,'action':'originate','channel':_0x509f86[_0x00ef('0x82')](_0x4bf2a3['Trunk'])?util[_0x00ef('0x41')](_0x00ef('0x188'),_0x4bf2a3[_0x00ef('0x87')][_0x00ef('0x60')],isNotNull(_0x4bf2a3[_0x00ef('0x189')])?_0x4bf2a3[_0x00ef('0x189')][_0x00ef('0x18a')]()||'':'',_0x4bf2a3['dialCutDigit']>0x0?_0x58d300[_0x00ef('0x15f')][_0x00ef('0x18b')](_0x4bf2a3[_0x00ef('0x18c')]):_0x58d300['phone']):util['format']('SIP/%s/%s%s',_[_0x00ef('0xf4')](_0x4bf2a3[_0x00ef('0x88')])?_0x4bf2a3[_0x00ef('0x87')][_0x00ef('0x60')]:_0x4bf2a3['TrunkBackup'][_0x00ef('0x60')],isNotNull(_0x4bf2a3[_0x00ef('0x189')])?_0x4bf2a3[_0x00ef('0x189')][_0x00ef('0x18a')]()||'':'',_0x4bf2a3[_0x00ef('0x18c')]>0x0?_0x58d300['phone'][_0x00ef('0x18b')](_0x4bf2a3['dialCutDigit']):_0x58d300['phone']),'callerid':_0x254b91,'Exten':_0x00ef('0x110'),'Context':_0x00ef('0x18d'),'Priority':'1','variable':_0x20cbda,'timeout':(_0x4bf2a3[_0x00ef('0x18e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5c46cf})[_0x00ef('0x39')](function(_0x4b5c91){return _0xd2fae4(_0x4b5c91);})[_0x00ef('0x9e')](function(_0x44a254){_0x4bf2a3['outboundOriginateFailureCallsDay']+=0x1;var _0x405a0d=new History(_0x509f86['actions'][_0x5c46cf]);logger[_0x00ef('0x62')](util[_0x00ef('0x41')](_0x00ef('0x18f'),JSON[_0x00ef('0x70')](_0x44a254)));_0x405a0d[_0x00ef('0x6a')]=0xe;_0x405a0d[_0x00ef('0x6b')]=_0x00ef('0x190');_0x405a0d[_0x00ef('0x6c')]=moment()[_0x00ef('0x41')]('YYYY-MM-DD\x20HH:mm:ss');_0x405a0d['endtime']=_0x405a0d[_0x00ef('0x6c')];hopperUtils[_0x00ef('0xcd')](_0x405a0d)['catch'](loggerCatch(_0x00ef('0x191')));_0x509f86['moveContactManagedDialer'](_0x405a0d)['catch'](loggerCatch(_0x00ef('0x191')))['finally'](function(){delete _0x509f86[_0x00ef('0x21')][_0x5c46cf];return _0x59b42f(msgResponse(_0x00ef('0x160'),_0x00ef('0xbf'),_0x00ef('0x192')));});});});};Dialer[_0x00ef('0x81')][_0x00ef('0x193')]=function(_0x2de0fa,_0x1ddd4c,_0x75b00){var _0x297e53=new History(_0x1ddd4c);if(_0x297e53[_0x00ef('0x122')]+_0x297e53[_0x00ef('0x123')]+_0x297e53['countnoanswerretry']+_0x297e53[_0x00ef('0x125')]+_0x297e53[_0x00ef('0xdc')]+_0x297e53[_0x00ef('0xec')]+_0x297e53[_0x00ef('0x11e')]+_0x297e53[_0x00ef('0x12f')]>=_0x75b00[_0x00ef('0x126')]-0x1){return!![];}switch(_0x2de0fa){case 0x3:if(_0x297e53[_0x00ef('0x124')]>=_0x75b00['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils[_0x00ef('0xee')]({'active':![],'countnoanswerretry':_0x297e53[_0x00ef('0x124')]+=0x1,'scheduledat':moment()['add'](_0x75b00[_0x00ef('0x194')],_0x00ef('0xe0'))['format'](_0x00ef('0xc6')),'ContactId':_0x297e53[_0x00ef('0xe1')],'ListId':_0x297e53['ListId'],'VoiceQueueId':_0x297e53[_0x00ef('0xe3')]||undefined,'CampaignId':_0x297e53[_0x00ef('0xe4')]||undefined})[_0x00ef('0x9e')](loggerCatch(_0x00ef('0x195')));break;case 0x5:if(_0x297e53['countbusyretry']>=_0x75b00[_0x00ef('0x196')]-0x1){return!![];}hopperUtils[_0x00ef('0xee')]({'active':![],'countbusyretry':_0x297e53['countbusyretry']+=0x1,'scheduledat':moment()[_0x00ef('0xdf')](_0x75b00[_0x00ef('0x197')],'minutes')[_0x00ef('0x41')](_0x00ef('0xc6')),'ContactId':_0x297e53['ContactId'],'ListId':_0x297e53[_0x00ef('0xe2')],'VoiceQueueId':_0x297e53[_0x00ef('0xe3')]||undefined,'CampaignId':_0x297e53[_0x00ef('0xe4')]||undefined})[_0x00ef('0x9e')](loggerCatch(_0x00ef('0x198')));break;case 0x8:if(_0x297e53['countcongestionretry']>=_0x75b00[_0x00ef('0x199')]-0x1){return!![];}hopperUtils[_0x00ef('0xee')]({'active':![],'countcongestionretry':_0x297e53['countcongestionretry']+=0x1,'scheduledat':moment()[_0x00ef('0xdf')](_0x75b00[_0x00ef('0x19a')],_0x00ef('0xe0'))['format'](_0x00ef('0xc6')),'ContactId':_0x297e53['ContactId'],'ListId':_0x297e53[_0x00ef('0xe2')],'VoiceQueueId':_0x297e53[_0x00ef('0xe3')]||undefined,'CampaignId':_0x297e53['CampaignId']||undefined})[_0x00ef('0x9e')](loggerCatch(_0x00ef('0x19b')));break;case 0x0:if(_0x297e53[_0x00ef('0x125')]>=_0x75b00[_0x00ef('0x19c')]-0x1){return!![];}else{hopperUtils[_0x00ef('0xee')]({'active':![],'countnosuchnumberretry':_0x297e53[_0x00ef('0x125')]+=0x1,'scheduledat':moment()[_0x00ef('0xdf')](_0x75b00[_0x00ef('0x19d')],_0x00ef('0xe0'))[_0x00ef('0x41')](_0x00ef('0xc6')),'ContactId':_0x297e53['ContactId'],'ListId':_0x297e53[_0x00ef('0xe2')],'VoiceQueueId':_0x297e53['VoiceQueueId']||undefined,'CampaignId':_0x297e53[_0x00ef('0xe4')]||undefined})[_0x00ef('0x9e')](loggerCatch(_0x00ef('0x19e')));}break;case 0xa:if(_0x297e53[_0x00ef('0xdc')]>=_0x75b00[_0x00ef('0xdd')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x297e53[_0x00ef('0xdc')]+=0x1,'scheduledat':moment()['add'](_0x75b00[_0x00ef('0xd7')],_0x00ef('0xe0'))['format'](_0x00ef('0xc6')),'ContactId':_0x297e53[_0x00ef('0xe1')],'ListId':_0x297e53[_0x00ef('0xe2')],'VoiceQueueId':_0x297e53['VoiceQueueId']||undefined,'CampaignId':_0x297e53[_0x00ef('0xe4')]||undefined})[_0x00ef('0x9e')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x297e53['countabandonedretry']>=_0x75b00[_0x00ef('0xed')]-0x1){return!![];}hopperUtils[_0x00ef('0xee')]({'active':![],'countabandonedretry':_0x297e53['countabandonedretry']+=0x1,'scheduledat':moment()[_0x00ef('0xdf')](_0x75b00[_0x00ef('0x19f')],_0x00ef('0xe0'))['format'](_0x00ef('0xc6')),'ContactId':_0x297e53[_0x00ef('0xe1')],'ListId':_0x297e53['ListId'],'VoiceQueueId':_0x297e53[_0x00ef('0xe3')]||undefined,'CampaignId':_0x297e53[_0x00ef('0xe4')]||undefined})[_0x00ef('0x9e')](loggerCatch(_0x00ef('0x1a0')));break;case 0x13:if(_0x297e53[_0x00ef('0x11e')]>=_0x75b00[_0x00ef('0x129')]-0x1){return!![];}hopperUtils[_0x00ef('0xee')]({'active':![],'countmachineretry':_0x297e53['countmachineretry']+=0x1,'scheduledat':moment()[_0x00ef('0xdf')](_0x75b00[_0x00ef('0x130')],_0x00ef('0xe0'))['format'](_0x00ef('0xc6')),'ContactId':_0x297e53[_0x00ef('0xe1')],'ListId':_0x297e53['ListId'],'VoiceQueueId':_0x297e53[_0x00ef('0xe3')]||undefined,'CampaignId':_0x297e53[_0x00ef('0xe4')]||undefined})[_0x00ef('0x9e')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x297e53['countagentrejectretry']>=_0x75b00['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0x00ef('0xee')]({'active':![],'countagentrejectretry':_0x297e53['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x00ef('0xdf')](_0x75b00['dialAgentRejectRetryFrequency'],'minutes')[_0x00ef('0x41')](_0x00ef('0xc6')),'ContactId':_0x297e53[_0x00ef('0xe1')],'ListId':_0x297e53[_0x00ef('0xe2')],'VoiceQueueId':_0x297e53[_0x00ef('0xe3')]||undefined,'CampaignId':_0x297e53[_0x00ef('0xe4')]||undefined})['catch'](loggerCatch(_0x00ef('0x1a1')));break;default:return!![];}};Dialer[_0x00ef('0x81')]['callProgressDetecting']=function(_0x2d85a3,_0x5e69f9,_0x47fe1a){var _0x3d9dc5=this;var _0x381b8d=new History(_0x2d85a3);var _0x4dbfa5=![];var _0x201f01;var _0x5da399;return new Promise(function(_0x3ffd75,_0x22d115){if(_['isUndefined'](_0x5e69f9)&&typeof _0x5e69f9!=='object'){return _0x22d115(msgResponse('[callProgressDetecting]','Failure',_0x00ef('0x1a2')));}if(_[_0x00ef('0x3b')](_0x47fe1a)&&typeof _0x47fe1a!==_0x00ef('0x15d')){return _0x22d115(msgResponse(_0x00ef('0x1a3'),_0x00ef('0x8e'),_0x00ef('0x1a4')));}hopperUtils['verifyAdditionalPhones'](_0x381b8d,_0x47fe1a[_0x00ef('0xc8')],_0x5e69f9)[_0x00ef('0x39')](function(_0x4e61e6){if(_0x4e61e6[_0x00ef('0xdb')]==0x1)_0x4dbfa5=!![];switch(_0x47fe1a[_0x00ef('0xc8')]){case'0':_0x5e69f9[_0x00ef('0x1a5')]+=0x1;_0x381b8d[_0x00ef('0x6a')]=0x0;_0x381b8d[_0x00ef('0x6b')]=_0x00ef('0x1a6');_0x381b8d[_0x00ef('0x125')]+=0x1;_0x381b8d['countglobal']+=0x1;ami[_0x00ef('0x3c')](_0x00ef('0x1a7'),ut[_0x00ef('0x116')](_0x2d85a3,_0x00ef('0x1a8')));_0x201f01=_0x5e69f9[_0x00ef('0x19d')];_0x5da399=_0x5e69f9[_0x00ef('0xd8')];hopperUtils[_0x00ef('0xcd')](_0x381b8d)['catch'](loggerCatch(_0x00ef('0x121')));if(_0x3d9dc5[_0x00ef('0x193')](0x0,_0x2d85a3,_0x5e69f9)&&!_0x4dbfa5){if(_0x381b8d[_0x00ef('0x125')]>=_0x5e69f9[_0x00ef('0x19c')]){_0x3d9dc5[_0x00ef('0x12a')](_0x381b8d,_0x3ffd75,_0x22d115,_0x00ef('0x1a9'));}else{_0x3d9dc5['stateGlobal'](_0x381b8d,_0x3ffd75,_0x22d115,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x5e69f9[_0x00ef('0x1aa')]+=0x1;_0x381b8d[_0x00ef('0x6a')]=0x3;_0x381b8d[_0x00ef('0x6b')]=_0x00ef('0x1ab');_0x381b8d[_0x00ef('0x124')]+=0x1;_0x381b8d[_0x00ef('0xd6')]+=0x1;var _0x723649=ut[_0x00ef('0x1ac')](_0x2d85a3,_0x5e69f9);ami[_0x00ef('0x3c')](_0x00ef('0x1ad'),_0x723649);_0x201f01=_0x5e69f9['dialNoAnswerRetryFrequency'];_0x5da399=_0x5e69f9[_0x00ef('0xd8')];hopperUtils[_0x00ef('0xcd')](_0x381b8d)['catch'](loggerCatch(_0x00ef('0x1ae')));if(_0x3d9dc5[_0x00ef('0x193')](0x3,_0x2d85a3,_0x5e69f9)&&!_0x4dbfa5){if(_0x381b8d['countnoanswerretry']>=_0x5e69f9[_0x00ef('0x1af')]){_0x3d9dc5[_0x00ef('0x12a')](_0x381b8d,_0x3ffd75,_0x22d115,'reason\x203\x20ringing\x20no\x20answer');}else{_0x3d9dc5[_0x00ef('0x127')](_0x381b8d,_0x3ffd75,_0x22d115,_0x00ef('0x1b0'));}}break;case'5':_0x5e69f9[_0x00ef('0x1b1')]+=0x1;_0x381b8d[_0x00ef('0x6a')]=0x5;_0x381b8d[_0x00ef('0x6b')]=_0x00ef('0x1b2');_0x381b8d[_0x00ef('0x122')]+=0x1;_0x381b8d[_0x00ef('0xd6')]+=0x1;ami[_0x00ef('0x3c')](_0x00ef('0x1b3'),ut[_0x00ef('0x116')](_0x2d85a3,_0x00ef('0x1b4')));_0x201f01=_0x5e69f9[_0x00ef('0x197')];_0x5da399=_0x5e69f9['callAdditionalPhoneAfterMin'];hopperUtils[_0x00ef('0xcd')](_0x381b8d)['catch'](loggerCatch(_0x00ef('0x1b5')));if(_0x3d9dc5[_0x00ef('0x193')](0x5,_0x2d85a3,_0x5e69f9)&&!_0x4dbfa5){if(_0x381b8d[_0x00ef('0x122')]>=_0x5e69f9[_0x00ef('0x196')]){_0x3d9dc5[_0x00ef('0x12a')](_0x381b8d,_0x3ffd75,_0x22d115,_0x00ef('0x1b6'));}else{_0x3d9dc5[_0x00ef('0x127')](_0x381b8d,_0x3ffd75,_0x22d115,_0x00ef('0x1b6'));}}break;case'8':_0x5e69f9[_0x00ef('0x1b7')]+=0x1;_0x381b8d[_0x00ef('0x6a')]=0x8;_0x381b8d[_0x00ef('0x6b')]='Congestion';_0x381b8d[_0x00ef('0x123')]+=0x1;_0x381b8d[_0x00ef('0xd6')]+=0x1;_0x201f01=_0x5e69f9[_0x00ef('0x19a')];_0x5da399=_0x5e69f9[_0x00ef('0xd8')];ami[_0x00ef('0x3c')](_0x00ef('0x1b8'),ut[_0x00ef('0x116')](_0x2d85a3,'congestion'));hopperUtils[_0x00ef('0xcd')](_0x381b8d)[_0x00ef('0x9e')](loggerCatch(_0x00ef('0x1b9')));if(_0x3d9dc5[_0x00ef('0x193')](0x8,_0x2d85a3,_0x5e69f9)&&!_0x4dbfa5){if(_0x381b8d[_0x00ef('0x123')]>=_0x5e69f9[_0x00ef('0x199')]){_0x3d9dc5[_0x00ef('0x12a')](_0x381b8d,_0x3ffd75,_0x22d115,_0x00ef('0x1ba'));}else{_0x3d9dc5[_0x00ef('0x127')](_0x381b8d,_0x3ffd75,_0x22d115,'reason\x208\x20congestion');}}break;case'11':_0x5e69f9['outboundAbandonedCallsDay']+=0x1;_0x381b8d[_0x00ef('0x6a')]=0xb;_0x381b8d['statedesc']=_0x00ef('0xef');_0x381b8d[_0x00ef('0xec')]+=0x1;_0x381b8d[_0x00ef('0xd6')]+=0x1;_0x201f01=_0x5e69f9['dialAbandonedRetryFrequency'];_0x5da399=_0x5e69f9['callAdditionalPhoneAfterMin'];hopperUtils[_0x00ef('0xcd')](_0x381b8d)[_0x00ef('0x9e')](loggerCatch(_0x00ef('0x1bb')));if(_0x3d9dc5[_0x00ef('0x193')](0xb,_0x2d85a3,_0x5e69f9)&&!_0x4dbfa5){if(_0x381b8d[_0x00ef('0xec')]>=_0x5e69f9[_0x00ef('0xed')]){_0x3d9dc5[_0x00ef('0x12a')](_0x381b8d,_0x3ffd75,_0x22d115,_0x00ef('0x1bc'));}else{_0x3d9dc5['stateGlobal'](_0x381b8d,_0x3ffd75,_0x22d115,_0x00ef('0x1bc'));}}break;case'20':_0x5e69f9[_0x00ef('0x1bd')]+=0x1;_0x381b8d[_0x00ef('0x6a')]=0x14;_0x381b8d[_0x00ef('0x6b')]=_0x00ef('0x1be');_0x381b8d[_0x00ef('0x12f')]+=0x1;_0x381b8d[_0x00ef('0xd6')]+=0x1;_0x201f01=_0x5e69f9['dialAgentRejectRetryFrequency'];_0x5da399=_0x5e69f9['callAdditionalPhoneAfterMin'];ami[_0x00ef('0x3c')](_0x00ef('0x1bf'),ut[_0x00ef('0x116')](_0x2d85a3,'agentreject'));hopperUtils[_0x00ef('0xcd')](_0x381b8d)[_0x00ef('0x9e')](loggerCatch(_0x00ef('0x1c0')));if(_0x3d9dc5[_0x00ef('0x193')](0x14,_0x2d85a3,_0x5e69f9)&&!_0x4dbfa5){if(_0x381b8d[_0x00ef('0x12f')]>=_0x5e69f9[_0x00ef('0x1c1')]){_0x3d9dc5[_0x00ef('0x12a')](_0x381b8d,_0x3ffd75,_0x22d115,_0x00ef('0x1c2'));}else{_0x3d9dc5[_0x00ef('0x127')](_0x381b8d,_0x3ffd75,_0x22d115,_0x00ef('0x1c2'));}}break;default:_0x5e69f9['outboundUnknownCallsDay']+=0x1;_0x381b8d[_0x00ef('0x6a')]=0xc;_0x381b8d[_0x00ef('0x6b')]=_0x47fe1a[_0x00ef('0xc8')];_0x201f01=_0x5e69f9[_0x00ef('0x1c3')];_0x5da399=_0x5e69f9[_0x00ef('0xd8')];hopperUtils['createHistory'](_0x381b8d)['catch'](loggerCatch(_0x00ef('0x1c4')));if(_0x3d9dc5[_0x00ef('0x193')](_0x47fe1a[_0x00ef('0xc8')],_0x2d85a3,_0x5e69f9)&&!_0x4dbfa5){if(_0x381b8d['countbusyretry']+_0x381b8d[_0x00ef('0x123')]+_0x381b8d[_0x00ef('0x124')]+_0x381b8d[_0x00ef('0x125')]+_0x381b8d[_0x00ef('0xdc')]+_0x381b8d[_0x00ef('0xec')]+_0x381b8d[_0x00ef('0x11e')]+_0x381b8d[_0x00ef('0x12f')]>=_0x5e69f9[_0x00ef('0x126')]){_0x3d9dc5[_0x00ef('0x127')](_0x381b8d,_0x3ffd75,_0x22d115,_0x47fe1a['reason']);}else{_0x3d9dc5[_0x00ef('0x12a')](_0x381b8d,_0x3ffd75,_0x22d115,_0x47fe1a[_0x00ef('0xc8')]);}}}})[_0x00ef('0x39')](function(){if(_0x4dbfa5){hopperUtils[_0x00ef('0xe9')](_0x381b8d,_0x201f01,_0x5da399)[_0x00ef('0x39')](function(){return _0x3ffd75(0x1);});}});});};Dialer[_0x00ef('0x81')]['stateGlobal']=function(_0x292e6b,_0x17f925,_0x4da8b2,_0x5f3dc2){var _0x2ba198=new Final(_0x292e6b);_0x2ba198[_0x00ef('0x6a')]=0xf;_0x2ba198[_0x00ef('0x6b')]=_0x00ef('0x1c5');this[_0x00ef('0x12a')](_0x2ba198,_0x17f925,_0x4da8b2,_0x5f3dc2);};Dialer['prototype'][_0x00ef('0x12a')]=function(_0x18b687,_0x3e0b09,_0x3a71ee,_0x5a878d){hopperUtils[_0x00ef('0x133')](_0x18b687)[_0x00ef('0x39')](function(){return _0x3e0b09(msgResponse('[callProgressDetecting]',_0x00ef('0x10a'),_0x5a878d));})[_0x00ef('0x9e')](function(){return _0x3a71ee(msgResponse(_0x00ef('0x1c6'),_0x00ef('0x8e'),_0x00ef('0x1c7')));});};Dialer[_0x00ef('0x81')]['predictive']=function(_0x5911d6){var _0x2c5def=_0x5911d6['dialPredictiveOptimizationPercentage']/0x64;var _0x243bce=_0x5911d6[_0x00ef('0x1c8')]/(_0x5911d6[_0x00ef('0x1c8')]+_0x5911d6[_0x00ef('0xc7')]);var _0x1ec1bc=Math['round'](_0x5911d6[_0x00ef('0x1c9')]*(_0x5911d6[_0x00ef('0x1ca')]/0x64));var _0x44e46e=Math[_0x00ef('0x1cb')](_0x5911d6[_0x00ef('0x1c9')]*(_0x5911d6[_0x00ef('0x1cc')]/0x64));var _0x4f9c58=_0x5911d6[_0x00ef('0x13e')]+_0x5911d6[_0x00ef('0x1cd')];var _0x1d10ef=Math[_0x00ef('0x1ce')](_0x5911d6[_0x00ef('0x55')]*_0x5911d6[_0x00ef('0x5b')]*_0x5911d6['predictiveIntervalHitRate']*_0x5911d6['predictiveIntervalMultiplicativeFactor']);if(_['isUndefined'](_0x5911d6[_0x00ef('0x5d')])){if(!_[_0x00ef('0x3b')](_0x5911d6[_0x00ef('0x23')])){_0x5911d6['startPredictive']=undefined;loggerPredictive['error'](_0x00ef('0x1cf'),_0x00ef('0x1d0'));}if(!_[_0x00ef('0x3b')](_0x5911d6[_0x00ef('0x5f')])){loggerPredictive[_0x00ef('0x62')](_0x00ef('0x1cf'),_0x00ef('0x1d1'));clearInterval(_0x5911d6['handlePredictive']);_0x5911d6[_0x00ef('0x5f')]=undefined;}_0x5911d6[_0x00ef('0x5d')]=moment()[_0x00ef('0x41')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x00ef('0x43')](_0x5911d6['name'],'collection\x20data\x20in\x20progressive\x20at',_0x5911d6['startProgressive']);this[_0x00ef('0xb2')](_0x5911d6,0x1);}else if(ifInterval(_0x5911d6[_0x00ef('0x1d2')],_0x5911d6[_0x00ef('0x5d')])){this[_0x00ef('0xb2')](_0x5911d6,0x1);loggerPredictiveCalls[_0x00ef('0x43')](_0x00ef('0x1d3'),_0x5911d6[_0x00ef('0x5d')],_0x5911d6[_0x00ef('0x60')]);_0x5911d6[_0x00ef('0x55')]=0x0;_0x5911d6['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x2c5def<_0x243bce&&_0x5911d6[_0x00ef('0x1d4')]===_0x00ef('0x1d5')){clearPredictiveAttributes(_0x5911d6);loggerPredictive[_0x00ef('0x43')](_0x00ef('0x1d6'),_0x00ef('0x1d7'),_0x243bce,_0x00ef('0x5d'),_0x5911d6['name']);}else if(_0x1d10ef<_0x5911d6[_0x00ef('0xd2')]&&_0x5911d6['dialPredictiveOptimization']==='dropRate'){clearPredictiveAttributes(_0x5911d6);loggerPredictive[_0x00ef('0x43')](_0x00ef('0x1d8'),_0x00ef('0x1d9'),_0x1d10ef,'Drop\x20in\x20this\x20interval',_0x5911d6[_0x00ef('0xd2')],'startProgressive',_0x5911d6[_0x00ef('0x60')]);}else if(!ifInterval(_0x5911d6[_0x00ef('0x1d2')],_0x5911d6[_0x00ef('0x5d')])&&_[_0x00ef('0x3b')](_0x5911d6['startPredictive'])&&!_[_0x00ef('0x3b')](_0x5911d6[_0x00ef('0x5d')])){_0x5911d6['startPredictive']=moment()[_0x00ef('0x41')](_0x00ef('0xc6'));loggerPredictive[_0x00ef('0x43')](_0x5911d6['name'],_0x00ef('0x1da'),_0x5911d6[_0x00ef('0x23')]);hopperUtils[_0x00ef('0x1db')](_0x5911d6[_0x00ef('0x1d2')])[_0x00ef('0x39')](this['getDataPredictive'](_0x5911d6))['then'](mergeDataErlangB(_0x5911d6))[_0x00ef('0x39')](this[_0x00ef('0x1dc')](_0x5911d6))[_0x00ef('0x9e')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x5911d6));}else if(!ifInterval(_0x5911d6[_0x00ef('0x1d2')],_0x5911d6[_0x00ef('0x23')])){_0x5911d6[_0x00ef('0xd2')]=0x0;_0x5911d6[_0x00ef('0x23')]=moment()['format'](_0x00ef('0xc6'));loggerPredictive['info'](_0x5911d6[_0x00ef('0x60')],'recalculate\x20predictive\x20at',_0x5911d6['startPredictive']);clearInterval(_0x5911d6[_0x00ef('0x5f')]);_0x5911d6[_0x00ef('0x5f')]=undefined;hopperUtils['avgHandleTime'](_0x5911d6['dialPredictiveInterval'])[_0x00ef('0x39')](this[_0x00ef('0x1dd')](_0x5911d6))[_0x00ef('0x39')](mergeDataErlangB(_0x5911d6))[_0x00ef('0x39')](this['startMethodPredictive'](_0x5911d6))[_0x00ef('0x9e')](loggerCatchPredictive(_0x00ef('0x1de'),_0x5911d6));}else if(_0x5911d6[_0x00ef('0x1c9')]&&_0x4f9c58<_0x5911d6[_0x00ef('0x1c9')]-_0x44e46e){clearPredictiveAttributes(_0x5911d6);loggerPredictive[_0x00ef('0x43')](_0x5911d6[_0x00ef('0x60')],_0x00ef('0x1df'),_0x4f9c58,')\x20are\x20less\x20than\x20threshold\x20(',_0x5911d6[_0x00ef('0x1c9')],'-',_0x44e46e,'=',_0x5911d6[_0x00ef('0x1c9')]-_0x44e46e,')');}else if(_0x5911d6['predictiveIntervalAvailable']&&_0x4f9c58>_0x5911d6['predictiveIntervalAvailable']+_0x1ec1bc){clearPredictiveAttributes(_0x5911d6);loggerPredictive[_0x00ef('0x43')](_0x5911d6[_0x00ef('0x60')],_0x00ef('0x1df'),_0x4f9c58,_0x00ef('0x1e0'),_0x5911d6['predictiveIntervalAvailable'],'+',_0x1ec1bc,'=',_0x5911d6[_0x00ef('0x1c9')]+_0x1ec1bc,')');}};Dialer['prototype']['getDataPredictive']=function(_0x4411eb){var _0x36db39=this;return function(_0x21786d){return new Promise(function(_0x2eeca5,_0x13e757){_['merge'](_0x4411eb,_0x21786d[0x0]);if(checkGetDataPredictive(_0x21786d[0x0])){var _0x1a34a4=_0x4411eb[_0x00ef('0x1c9')]=_0x4411eb[_0x00ef('0x1cd')]+_0x4411eb[_0x00ef('0x13e')];var _0x57b493=_0x4411eb[_0x00ef('0x1d2')]*0x3c;var _0x147a62=_0x21786d[0x0][_0x00ef('0x4f')]+_0x21786d[0x0]['predictiveIntervalAvgHoldtime'];var _0x283b06=(_0x21786d[0x0][_0x00ef('0x47')]+_0x21786d[0x0][_0x00ef('0x49')]+_0x21786d[0x0][_0x00ef('0x4b')])/_0x21786d[0x0][_0x00ef('0x45')];_0x4411eb['predictiveIntervalHitRate']=_0x283b06>0x0?_0x283b06:0x1;switch(_0x4411eb[_0x00ef('0x1d4')]){case _0x00ef('0x1d5'):var _0x33f6d8=_0x4411eb['dialPredictiveOptimizationPercentage']/0x64;return _0x36db39[_0x00ef('0x1e1')](_0x1a34a4,_0x57b493,_0x147a62,_0x283b06,_0x33f6d8)[_0x00ef('0x39')](function(_0x2e90b1){return _0x2eeca5(_0x2e90b1);});case _0x00ef('0x1e2'):var _0x2e359a=_0x4411eb[_0x00ef('0x1e3')]/0x64;return _0x36db39[_0x00ef('0x1e4')](_0x1a34a4,_0x57b493,_0x147a62,_0x283b06,_0x2e359a)[_0x00ef('0x39')](function(_0x323fe6){return _0x2eeca5(_0x323fe6);});default:return _0x13e757(msgResponse(_0x00ef('0x1e5'),'Failure',_0x00ef('0x1e6')));}}else{return _0x13e757(msgResponse('[getDataPredictive]','Failure','check\x20failure'));}});};};Dialer[_0x00ef('0x81')][_0x00ef('0x1e7')]=function(_0x3f43a8){var _0x5a0f8f=this;return function(_0x53369f){return new Promise(function(_0x3c0d70,_0x2daebc){_[_0x00ef('0x5c')](_0x3f43a8,_0x53369f[0x0]);if(checkGetDataPredictive(_0x53369f[0x0])){loggerPredictive[_0x00ef('0x43')](JSON[_0x00ef('0x70')](_0x53369f[0x0]));if(_0x3f43a8['dialPredictiveOptimization']===_0x00ef('0x1d5')){return _0x5a0f8f[_0x00ef('0x153')](_0x3f43a8['id'])[_0x00ef('0x39')](function(_0x46295a){var _0x4eefe=_0x3f43a8['loggedIn']-_0x46295a[0x0][_0x00ef('0x1e8')];var _0x4211cf=_0x3f43a8[_0x00ef('0x1d2')]*0x3c;var _0x32a97c=_0x53369f[0x0]['predictiveIntervalAvgTalktime']+_0x53369f[0x0][_0x00ef('0x4d')];var _0x7bf880=(_0x53369f[0x0][_0x00ef('0x47')]+_0x53369f[0x0][_0x00ef('0x49')]+_0x53369f[0x0][_0x00ef('0x4b')])/_0x53369f[0x0][_0x00ef('0x45')];var _0x139fdc=_0x3f43a8[_0x00ef('0x1e3')]/0x64;_0x3f43a8[_0x00ef('0x1e9')]=_0x46295a[0x0]['outboundQueuePauses']||0x0;_0x3f43a8['predictiveIntervalHitRate']=_0x7bf880>0x0?_0x7bf880:0x1;return _0x5a0f8f['abandonmentRate'](_0x4eefe,_0x4211cf,_0x32a97c,_0x7bf880,_0x139fdc);})['then'](function(_0x55a1e9){return _0x3c0d70(_0x55a1e9);})[_0x00ef('0x9e')](function(_0x39562f){return _0x2daebc(msgResponse('[CatchErlangB]','Failure',JSON['stringify'](_0x39562f)));});}if(_0x3f43a8['dialPredictiveOptimization']==='agentBusyFactor'){return _0x5a0f8f[_0x00ef('0x153')](_0x3f43a8['id'])[_0x00ef('0x39')](function(_0x4ff970){var _0x5b0b41=_0x3f43a8['loggedIn']-_0x4ff970[0x0][_0x00ef('0x1e8')];var _0x1be149=_0x3f43a8[_0x00ef('0x1d2')]*0x3c;var _0x40dcc1=_0x53369f[0x0][_0x00ef('0x4f')]+_0x53369f[0x0][_0x00ef('0x4d')];var _0x4f6caf=(_0x53369f[0x0][_0x00ef('0x47')]+_0x53369f[0x0][_0x00ef('0x49')]+_0x53369f[0x0][_0x00ef('0x4b')])/_0x53369f[0x0]['predictiveIntervalTotalCalls'];var _0x5a8de6=_0x3f43a8['dialPredictiveOptimizationPercentage']/0x64;_0x3f43a8[_0x00ef('0x1e9')]=_0x4ff970[0x0][_0x00ef('0x1e8')]||0x0;_0x3f43a8[_0x00ef('0x1ea')]=_0x4f6caf>0x0?_0x4f6caf:0x1;return _0x5a0f8f[_0x00ef('0x1e4')](_0x5b0b41,_0x1be149,_0x40dcc1,_0x4f6caf,_0x5a8de6);})[_0x00ef('0x39')](function(_0x121157){return _0x3c0d70(_0x121157);})['catch'](function(_0x923cf2){return _0x2daebc(msgResponse(_0x00ef('0x1eb'),'Failure',JSON[_0x00ef('0x70')](_0x923cf2)));});}}else{return _0x2daebc(msgResponse('[getDataPredictive]','Failure','check\x20failure'));}});};};Dialer[_0x00ef('0x81')][_0x00ef('0x1dc')]=function(_0x1b2f41){var _0x33a429=this;return function(){var _0x1301a0=0x0;var _0xec8deb=Math['floor'](_0x1b2f41[_0x00ef('0x57')]*0x3e8);if(_0xec8deb>0x0){_0xec8deb=_0xec8deb<0x64?0x64:_0xec8deb;loggerPredictive[_0x00ef('0x43')](_0x1b2f41['name'],_0x00ef('0x1ec'),_0xec8deb,_0x00ef('0x1ed'));_0x1b2f41[_0x00ef('0x5f')]=setInterval(function(){_0x33a429[_0x00ef('0x5f')](_0x1b2f41);loggerPredictiveCalls['info'](_0x00ef('0x1ee'),_0x1301a0+=0x1);},_0xec8deb);}else{loggerPredictive[_0x00ef('0x43')](_0x1b2f41[_0x00ef('0x60')],_0x00ef('0x1ef'));}};};Dialer['prototype'][_0x00ef('0x1f0')]=function(_0x4343bd,_0x5c8825){var _0x364208=this;return function(_0x21c1e8){if(_[_0x00ef('0x90')](_0x21c1e8)){if(_[_0x00ef('0xf4')](_0x5c8825[_0x00ef('0x158')])||!_0x5c8825[_0x00ef('0x1f1')]){if(_0x4343bd['dialMethod']==='booked'){_0x4343bd[_0x00ef('0x6e')]=_[_0x00ef('0x3b')](_0x4343bd[_0x00ef('0x6e')])?!![]:_0x4343bd[_0x00ef('0x6e')];var _0x56eeb0=uuid['v4']();_0x364208[_0x00ef('0x21')][_0x56eeb0]=new Action(_0x4343bd,_0x5c8825,_0x56eeb0);loggerBooked['info']('[booked][checkContactBlack]',_0x56eeb0,_0x00ef('0x1f2'),JSON['stringify'](_0x4343bd[_0x00ef('0x6e')]),_0x00ef('0x1f3'),_0x4343bd['name']);if(_0x4343bd[_0x00ef('0x6e')]){_0x4343bd['queueStatusComplete']=![];_0x364208[_0x00ef('0x25')][_0x364208[_0x00ef('0x21')][_0x56eeb0][_0x00ef('0xc0')]]=[];ami['Action']({'actionid':_0x56eeb0,'action':_0x00ef('0x1f4'),'queue':_0x4343bd[_0x00ef('0x60')]})['catch'](function(){_0x364208[_0x00ef('0xc4')](_0x4343bd);hopperUtils[_0x00ef('0xee')]({'active':![],'ContactId':_0x364208[_0x00ef('0x21')][_0x56eeb0][_0x00ef('0xe1')],'ListId':_0x364208['actions'][_0x56eeb0][_0x00ef('0xe2')],'VoiceQueueId':_0x364208[_0x00ef('0x21')][_0x56eeb0][_0x00ef('0xe3')]||undefined,'CampaignId':_0x364208[_0x00ef('0x21')][_0x56eeb0][_0x00ef('0xe4')]||undefined})[_0x00ef('0x9e')](loggerCatch(_0x00ef('0x1f5')));delete _0x364208[_0x00ef('0x21')][_0x56eeb0];});}else{loggerBooked[_0x00ef('0x43')](_0x00ef('0x1f6'),JSON['stringify'](_0x4343bd[_0x00ef('0x6e')]),'Queue:\x20',_0x4343bd[_0x00ef('0x60')]);_0x364208[_0x00ef('0xc4')](_0x4343bd);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x364208[_0x00ef('0x21')][_0x56eeb0][_0x00ef('0xe1')],'ListId':_0x364208[_0x00ef('0x21')][_0x56eeb0][_0x00ef('0xe2')],'VoiceQueueId':_0x364208[_0x00ef('0x21')][_0x56eeb0]['VoiceQueueId']||undefined,'CampaignId':_0x364208[_0x00ef('0x21')][_0x56eeb0][_0x00ef('0xe4')]||undefined})[_0x00ef('0x9e')](loggerCatch(_0x00ef('0x1f5')));delete _0x364208[_0x00ef('0x21')][_0x56eeb0];}}else{return _0x364208['actionOriginate'](_0x4343bd,_0x5c8825);}}else{if(utils[_0x00ef('0xcf')](undefined,_0x5c8825[_0x00ef('0x1f7')])<_0x4343bd['dialRecallMeTimeout']*0x3c){if(_0x5c8825['Agent']&&!_0x5c8825[_0x00ef('0x14b')][_0x00ef('0x1f8')]){_0x364208[_0x00ef('0x1a')][_0x00ef('0xfb')](_0x5c8825['id'])[_0x00ef('0x18')](function(){_0x364208[_0x00ef('0xc4')](_0x4343bd);});}else{hopperUtils[_0x00ef('0x1f9')]({'active':![]},_0x5c8825['id'],0x1)[_0x00ef('0x18')](function(){_0x364208[_0x00ef('0xc4')](_0x4343bd);});}}else{_0x4343bd[_0x00ef('0x1fa')]+=0x1;_0x364208[_0x00ef('0xc4')](_0x4343bd);if(_0x4343bd['dialRecallInQueue']){hopperUtils[_0x00ef('0xee')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x5c8825['ContactId'],'ListId':_0x5c8825[_0x00ef('0xe2')],'VoiceQueueId':_0x5c8825['VoiceQueueId']||undefined,'CampaignId':_0x5c8825[_0x00ef('0xe4')]||undefined})['catch'](loggerCatch(_0x00ef('0x1fb')));hopperUtils['createHistory'](createObjHistory(_0x4343bd,_0x5c8825,utils[_0x00ef('0x65')]['QUEUE_RECALL'],0x17,_0x00ef('0x1fc')))[_0x00ef('0x9e')](loggerCatch(_0x00ef('0x1fd')));}else{_0x364208[_0x00ef('0x117')](createObjHistory(_0x4343bd,_0x5c8825,utils['CAMPAIGN_STATUS'][_0x00ef('0x1fe')],0x16,'RecallFailedTimeout'),_0x00ef('0x1ff'),_0x00ef('0x200'));}}}}else{_0x4343bd['outboundBlacklistCallsDay']+=0x1;_0x364208[_0x00ef('0x117')](createObjHistory(_0x4343bd,_0x5c8825,utils[_0x00ef('0x65')]['BLACKLIST'],0xd,_0x00ef('0x201')),'[Originate][historyBlacklist]','[Originate][MoveBlacklist]');throw _0x00ef('0x202');}};};Dialer[_0x00ef('0x81')][_0x00ef('0x15c')]=function(_0x3db764){var _0x5eda25=this;var _0x504b15=_0x3db764['limitCalls']-_0x3db764[_0x00ef('0x7c')]-_0x3db764[_0x00ef('0x203')];emitCampaignSummary(_0x3db764);if(_0x504b15>0x0){if(_0x504b15>this[_0x00ef('0x1f')]){_0x504b15=this[_0x00ef('0x1f')];}_0x3db764['temp']+=_0x504b15;hopperUtils[_0x00ef('0x204')](_0x3db764['id'],_0x504b15,_0x3db764['dialOrderByScheduledAt'],_0x3db764)[_0x00ef('0x39')](function(_0x5f5082){_0x3db764['temp']-=_0x504b15;_0x3db764[_0x00ef('0x203')]=_0x3db764[_0x00ef('0x203')]>0x0?_0x3db764['temp']:0x0;if(!utils[_0x00ef('0x205')](_0x5f5082)){_0x3db764[_0x00ef('0x68')]=utils['CAMPAIGN_STATUS'][_0x00ef('0x206')];logger[_0x00ef('0x43')](_0x00ef('0x207')+_0x3db764['name']);}else{_0x3db764[_0x00ef('0x7c')]+=_0x5f5082[_0x00ef('0x97')];_0x3db764[_0x00ef('0x68')]=utils[_0x00ef('0x65')][_0x00ef('0x208')];for(var _0x3513c8=0x0;_0x3513c8<_0x5f5082['length'];_0x3513c8+=0x1){_0x3db764[_0x00ef('0x209')]+=0x1;if(_[_0x00ef('0xf4')](_0x5f5082[_0x3513c8])||_[_0x00ef('0xf4')](_0x5f5082[_0x3513c8][_0x00ef('0x17a')])||_['isNil'](_0x5f5082[_0x3513c8][_0x00ef('0x15f')])){_0x5eda25['emptyContact']('[actionOriginate]\x20',_0x3db764,_0x5f5082[_0x3513c8]);}else{hopperUtils['checkIsBlackListIvr'](_[_0x00ef('0x71')](_0x5f5082[_0x3513c8],[_0x00ef('0xe4'),_0x00ef('0x15f')]))[_0x00ef('0x39')](_0x5eda25[_0x00ef('0x1f0')](_0x3db764,_0x5f5082[_0x3513c8]))['catch'](_0x5eda25[_0x00ef('0x20a')](_0x00ef('0x20b'),_0x3db764));}}}})[_0x00ef('0x9e')](loggerGetContactDialer('[getContactCampaign2]',_0x3db764,_0x504b15));}};Dialer[_0x00ef('0x81')][_0x00ef('0xb2')]=function(_0x327608,_0x3ae7dd){var _0x3b0622=this;var _0x5317cd=[];if(_0x3ae7dd<0x1||_0x327608[_0x00ef('0xb0')]===_0x00ef('0xb5')){_0x3ae7dd=0x1;}var _0x1dcd55=Math[_0x00ef('0x1ce')](_0x327608['available']*_0x3ae7dd)-_0x327608['originated']-_0x327608[_0x00ef('0x203')];if(_0x327608['dialLimitQueue']>0x0){var _0x47e75f=_0x327608[_0x00ef('0x20c')]-_0x327608['originated']-_0x327608[_0x00ef('0x1cd')]-_0x327608[_0x00ef('0x203')]-_0x327608[_0x00ef('0x20d')];if(_0x1dcd55>_0x47e75f){_0x1dcd55=_0x47e75f;}}if(_0x1dcd55>0x0){if(_0x327608[_0x00ef('0xb0')]===_0x00ef('0xb5')){_0x1dcd55=0x1;}if(_0x1dcd55>this[_0x00ef('0x1f')]){_0x1dcd55=this[_0x00ef('0x1f')];}_0x327608[_0x00ef('0x203')]+=_0x1dcd55;for(var _0x707375 in this[_0x00ef('0x1d')]){if(typeof this['agents'][_0x707375]!==_0x00ef('0xaa')){if(this[_0x00ef('0x1d')][_0x707375][_0x00ef('0x6a')]==='not_inuse'&&this[_0x00ef('0x1d')][_0x707375]['status']===_0x00ef('0x85')){_0x5317cd[_0x00ef('0xf9')](this[_0x00ef('0x1d')][_0x707375]['id']);}}}hopperUtils[_0x00ef('0x20e')](_0x327608,_0x5317cd,_0x1dcd55)[_0x00ef('0x39')](function(_0x2a3a7a){_0x327608[_0x00ef('0x203')]-=_0x1dcd55;_0x327608[_0x00ef('0x203')]=_0x327608[_0x00ef('0x203')]>0x0?_0x327608['temp']:0x0;if(!utils[_0x00ef('0x205')](_0x2a3a7a)){hopperUtils[_0x00ef('0x20f')](_0x327608)[_0x00ef('0x39')](sendMessageReschedule(_0x327608))[_0x00ef('0x9e')](loggerCatch(_0x00ef('0x210')));}else{_0x327608['originated']+=_0x2a3a7a[_0x00ef('0x97')];_0x327608[_0x00ef('0x68')]=_0x327608[_0x00ef('0xb0')]===_0x00ef('0xb5')?utils['CAMPAIGN_STATUS'][_0x00ef('0x140')]:utils[_0x00ef('0x65')][_0x00ef('0x208')];for(var _0x4ad416=0x0;_0x4ad416<_0x2a3a7a['length'];_0x4ad416+=0x1){if(_['isNil'](_0x2a3a7a[_0x4ad416])||_[_0x00ef('0xf4')](_0x2a3a7a[_0x4ad416]['Contact'])||_[_0x00ef('0xf4')](_0x2a3a7a[_0x4ad416][_0x00ef('0x15f')])){_0x3b0622['emptyContact'](_0x00ef('0x211'),_0x327608,_0x2a3a7a[_0x4ad416]);}else{hopperUtils[_0x00ef('0x212')](_[_0x00ef('0x71')](_0x2a3a7a[_0x4ad416],[_0x00ef('0xe3'),'phone']))[_0x00ef('0x39')](_0x3b0622['checkContactBlack'](_0x327608,_0x2a3a7a[_0x4ad416]))['catch'](_0x3b0622[_0x00ef('0x20a')]('[actionOriginate]\x20',_0x327608));}}}})[_0x00ef('0x9e')](loggerGetContactDialer(_0x00ef('0x213'),_0x327608,_0x1dcd55));}};Dialer['prototype'][_0x00ef('0x5f')]=function(_0x2920d9){if(_0x2920d9['dialLimitQueue']>0x0){var _0x4f2190=_0x2920d9['dialLimitQueue']-_0x2920d9[_0x00ef('0x7c')]-_0x2920d9[_0x00ef('0x1cd')];if(_0x4f2190>0x0){this[_0x00ef('0x214')](_0x2920d9);}else{loggerPredictiveCalls[_0x00ef('0x43')](_0x00ef('0x215'));}}else{this[_0x00ef('0x214')](_0x2920d9);}};Dialer['prototype']['tryOriginatePredictive']=function(_0x179b80){var _0x3cf8b9=this;var _0x5a8105=[];_0x179b80['originated']+=0x1;for(var _0x1f9c42 in this[_0x00ef('0x1d')]){if(typeof this[_0x00ef('0x1d')][_0x1f9c42]!==_0x00ef('0xaa')){if(this['agents'][_0x1f9c42][_0x00ef('0x6a')]===_0x00ef('0x216')&&this['agents'][_0x1f9c42][_0x00ef('0x86')]===_0x00ef('0x85')){_0x5a8105[_0x00ef('0xf9')](this[_0x00ef('0x1d')][_0x1f9c42]['id']);}}}return this['getContactDialer'](_0x179b80['id'],_0x5a8105,0x1,_0x179b80['dialOrderByScheduledAt'],_0x179b80)[_0x00ef('0x39')](function(_0x526195){if(!utils[_0x00ef('0x205')](_0x526195)){utils[_0x00ef('0x217')](_0x179b80,0x1,0x0);return hopperUtils[_0x00ef('0x20f')](_0x179b80)[_0x00ef('0x39')](sendMessageReschedule(_0x179b80))[_0x00ef('0x9e')](loggerCatch('[countReScheduled]\x20'));}else{_0x179b80[_0x00ef('0x68')]=utils[_0x00ef('0x65')]['RUNNING'];if(_[_0x00ef('0xf4')](_0x526195[0x0])||_[_0x00ef('0xf4')](_0x526195[0x0][_0x00ef('0x17a')])||_[_0x00ef('0xf4')](_0x526195[0x0][_0x00ef('0x15f')])){_0x3cf8b9[_0x00ef('0x156')]('[actionOriginate]\x20',_0x179b80,_0x526195[0x0]);}else{return hopperUtils[_0x00ef('0x212')](_[_0x00ef('0x71')](_0x526195[0x0],[_0x00ef('0xe3'),'phone']))[_0x00ef('0x39')](_0x3cf8b9[_0x00ef('0x1f0')](_0x179b80,_0x526195[0x0]))[_0x00ef('0x9e')](_0x3cf8b9[_0x00ef('0x20a')](_0x00ef('0x218'),_0x179b80));}}})[_0x00ef('0x9e')](loggerGetContactDialer(_0x00ef('0x219'),_0x179b80,0x1));};Dialer[_0x00ef('0x81')][_0x00ef('0x1e1')]=function(_0xf712a4,_0x1428c4,_0x2ebee8,_0x3b65d2,_0x2be8ac,_0xd6bb36){loggerPredictive[_0x00ef('0x43')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x00ef('0x43')](_0x00ef('0x21a'),_0xf712a4);loggerPredictive[_0x00ef('0x43')](_0x00ef('0x21b'),_0x1428c4);loggerPredictive[_0x00ef('0x43')]('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',_0x2ebee8);loggerPredictive[_0x00ef('0x43')](_0x00ef('0x21c'),_0x3b65d2);loggerPredictive[_0x00ef('0x43')](_0x00ef('0x21d'),_0x2be8ac);loggerPredictive[_0x00ef('0x43')](_0x00ef('0x50'));return new Promise(function(_0x54c27a,_0x506256){if(_0xf712a4<=0x0||isNaN(_0xf712a4)){return _0x506256(msgResponse('[abandonmentRate]',_0x00ef('0xbf'),_0x00ef('0x21e')+_0xf712a4));}if(_0x2ebee8<=0x0||isNaN(_0x2ebee8)){return _0x506256(msgResponse(_0x00ef('0x21f'),_0x00ef('0xbf'),_0x00ef('0x220')+_0x2ebee8));}if(_0x3b65d2<=0x0||isNaN(_0x3b65d2)){return _0x506256(msgResponse(_0x00ef('0x21f'),_0x00ef('0xbf'),_0x00ef('0x221')+_0x3b65d2));}if(_0x1428c4<=0x0||isNaN(_0x1428c4)){return _0x506256(msgResponse(_0x00ef('0x21f'),_0x00ef('0xbf'),_0x00ef('0x222')+_0x1428c4));}if(_0x2be8ac<=0x0||isNaN(_0x2be8ac)){return _0x506256(msgResponse('[abandonmentRate]',_0x00ef('0xbf'),_0x00ef('0x223')+_0x2be8ac));}_0xd6bb36=_0xd6bb36||0x0;var _0x2d67b4=0x1/_0x2ebee8;var _0x5bceb2=0x0;var _0x2ad6b4=0x0;var _0x4b3131=0x0;var _0x5e910d=0x0;for(var _0x103c0d=0x0;_0x4b3131<_0x2be8ac;_0x103c0d+=0x1){_0x2ad6b4=_0x103c0d/_0x1428c4;_0x5bceb2=(_0x3b65d2*_0x2ad6b4+_0xd6bb36)/_0x2d67b4;_0x4b3131=utils[_0x00ef('0x224')](_0x5bceb2,_0xf712a4);_0x5e910d=_0x5bceb2/_0xf712a4*(0x1-utils[_0x00ef('0x224')](_0x5bceb2,_0xf712a4));}return _0x54c27a({'erlangCalls':_0x103c0d,'erlangCallToSecond':_0x1428c4/_0x103c0d,'erlangAbandonmentRate':_0x4b3131,'erlangBusyFactor':_0x5e910d});});};Dialer[_0x00ef('0x81')][_0x00ef('0x1e4')]=function(_0xc80ce4,_0x5064b8,_0x4e268e,_0xf58b38,_0x1c030a,_0x29d1bb){loggerPredictive[_0x00ef('0x43')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x00ef('0x43')](_0x00ef('0x21a'),_0xc80ce4);loggerPredictive[_0x00ef('0x43')](_0x00ef('0x21b'),_0x5064b8);loggerPredictive[_0x00ef('0x43')](_0x00ef('0x225'),_0x4e268e);loggerPredictive[_0x00ef('0x43')](_0x00ef('0x21c'),_0xf58b38);loggerPredictive[_0x00ef('0x43')](_0x00ef('0x226'),_0x1c030a);loggerPredictive[_0x00ef('0x43')](_0x00ef('0x50'));return new Promise(function(_0x516863,_0x21679a){if(_0xc80ce4<=0x0||isNaN(_0xc80ce4)){return _0x21679a(msgResponse(_0x00ef('0x227'),_0x00ef('0xbf'),_0x00ef('0x21e')+_0xc80ce4));}if(_0x4e268e<=0x0||isNaN(_0x4e268e)){return _0x21679a(msgResponse(_0x00ef('0x227'),_0x00ef('0xbf'),_0x00ef('0x220')+_0x4e268e));}if(_0xf58b38<=0x0||isNaN(_0xf58b38)){return _0x21679a(msgResponse(_0x00ef('0x227'),_0x00ef('0xbf'),_0x00ef('0x221')+_0xf58b38));}if(_0x5064b8<=0x0||isNaN(_0x5064b8)){return _0x21679a(msgResponse(_0x00ef('0x227'),_0x00ef('0xbf'),_0x00ef('0x222')+_0x5064b8));}if(_0x1c030a<=0x0||isNaN(_0x1c030a)){return _0x21679a(msgResponse(_0x00ef('0x227'),_0x00ef('0xbf'),_0x00ef('0x228')+_0x1c030a));}_0x29d1bb=_0x29d1bb||0x0;var _0x59b32c=0x1/_0x4e268e;var _0x14a41d=0x0;var _0x3c0f43=0x0;var _0x4a5a06=0x0;var _0x51b840=0x0;for(var _0x298dda=0x0;_0x51b840<_0x1c030a;_0x298dda+=0x1){_0x3c0f43=_0x298dda/_0x5064b8;_0x14a41d=(_0xf58b38*_0x3c0f43+_0x29d1bb)/_0x59b32c;_0x4a5a06=utils[_0x00ef('0x224')](_0x14a41d,_0xc80ce4);_0x51b840=_0x14a41d/_0xc80ce4*(0x1-utils[_0x00ef('0x224')](_0x14a41d,_0xc80ce4));}return _0x516863({'erlangCalls':_0x298dda,'erlangCallToSecond':_0x5064b8/_0x298dda,'erlangAbandonmentRate':_0x4a5a06,'erlangBusyFactor':_0x51b840});});};module[_0x00ef('0x229')]=Dialer; \ No newline at end of file +var _0xc648=['---------------------------','Avg\x20Talk\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','erlangCalls','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','erlangBusyFactor','getSeconds','name','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','contactsRescheduled','message','CAMPAIGN_STATUS','[getContactDialer2][ReScheduled]','NO_AVAILABLE_CONTACTS','statedesc','endtime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20disactive','[ifTime][Action]','Error','isTrunkReachable','active','SIP/%s','status','reachable','unmonitored','checkIsTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','Failure','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','interval','indexOf','true','catch','iftime\x20%s,%s','content','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','resetActiveCalls','syncCampaigns','undefined','dialTimezone','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','dialGlobalInterval','silly','Dialer::ifTime()','intervalIftime','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','queue','uniqueid','ivr','updateOriginated','answertime','YYYY-MM-DD\x20HH:mm:ss','type','reason','agent','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','state','Drop','dropreason','TIMEOUT','agiafterat','countdropretry','countglobal','dialDropRetryFrequency','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','add','minutes','ContactId','ListId','VoiceQueueId','CampaignId','starttime','calleridnum','createHistory','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','dialAbandonedRetryFrequency','callAdditionalPhoneAfterMin','dialAbandonedMaxRetry','countabandonedretry','[rescheduleContact][Abandoned]','calleridname','[syncAgentComplete][createHistory][11]','syncNewExten','channel','actionid','strategy','rrmemory','roundrobin','locked','paused','stateinterface','isNil','merge','idHopper','preview','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','run','[booked][RR][finaly]','[booked][unlock]','rescheduleContact','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','response','Success','[callProgressDetecting]\x20','syncVarSet','variable','amdstatus','exten','xcally-motion-dialer','value','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','emit','custom:amd','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','MACHINE','Machine','countmachineretry','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','stateGlobal','dialMachineMaxRetry','reason\x2019\x20machine....','HANGUP','buildObj','[syncHangupInAMDIvr][createHistory]','[syncAgentComplete][createHistory][0]','countagentrejectretry','dialGlobalMaxRetry','reason19\x20machine....','createStateFinal','[rescheduleContact][Machine]','syncHangup','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','cause-txt','running','isPreviewCampaign','statusMessage','resolve','available','inUse','talking','pTalking','ACTIVE','[syncQueueSummary]','updateReportFromOutboundQueue','assign','syncQueueSummaryComplete','filter','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','loopClearZombieChannels','clearZombieChannels','[uniqueid]','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','loggerHandler','emptyContact','notFound','UserId','[emptyContact][createHistory]','[emptyContact]','launchHandleIvr','handleIvr','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','createdAt','updatedAt','XMD-','toUpper','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerIdRandom','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','phone','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','[originate][error]','checkRetriveMax','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','[rescheduleContact][Drop]','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','NoSuchNumber','nosuchnumber','dialNoSuchNumberMaxRetry','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','dialNoAnswerRetryFrequency','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','custom:agentbusy','busy','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','outboundUnknownCallsDay','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','avgHandleTime','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dropRate','abandonmentRate','agentBusyFactor','busyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','getDataPredictiveOld','loggedIn','predictiveIntervalPauses','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','dialRecallMeTimeout','Agent','voicePause','unlockContact','outboundReCallsDay','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','limitCalls','temp','getContactDialerIvr','dialOrderByScheduledAt','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','checkContactBlack','dialLimitQueue','not_inuse','getContactDialer','countReScheduled','[actionOriginate]\x20','[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','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','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Interval:\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','util','lodash','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','queueBooked','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','getSettings','then','previewRecallmeReminderInterval','isUndefined','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','voice_queue:save','isEmpty','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime'];(function(_0x2382b7,_0x271ef2){var _0x4ea157=function(_0x13209c){while(--_0x13209c){_0x2382b7['push'](_0x2382b7['shift']());}};_0x4ea157(++_0x271ef2);}(_0xc648,0x1c9));var _0x8c64=function(_0x2999a2,_0x165ee0){_0x2999a2=_0x2999a2-0x0;var _0x48e984=_0xc648[_0x2999a2];return _0x48e984;};'use strict';var util=require(_0x8c64('0x0'));var _=require(_0x8c64('0x1'));var uuid=require('uuid');var moment=require('moment');var rr=require('rr');var Redis=require('ioredis');var utils=require(_0x8c64('0x2'));var hopperUtils=require(_0x8c64('0x3'));var ut=require(_0x8c64('0x4'));var config=require(_0x8c64('0x5'));var logger=require(_0x8c64('0x6'))(_0x8c64('0x7'));var loggerBooked=require(_0x8c64('0x6'))(_0x8c64('0x8'));var loggerPredictive=require(_0x8c64('0x6'))(_0x8c64('0x9'));var loggerPredictiveCalls=require(_0x8c64('0x6'))(_0x8c64('0xa'));var loggerSyncQueueSummary=require(_0x8c64('0x6'))(_0x8c64('0xb'));var ami=require(_0x8c64('0xc'));config[_0x8c64('0xd')]=_[_0x8c64('0xe')](config[_0x8c64('0xd')],{'host':_0x8c64('0xf'),'port':0x18eb});var io=require(_0x8c64('0x10'))(new Redis(config[_0x8c64('0xd')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0x8c64('0x11'));var Interval=require(_0x8c64('0x12'));var Action=require(_0x8c64('0x13'));var History=require(_0x8c64('0x14'));var Final=require(_0x8c64('0x15'));var AgentComplete=require(_0x8c64('0x16'));var QueueCallerAbandon=require(_0x8c64('0x17'));var Hangup=require('./models/hangup');var ipAgi=process['env'][_0x8c64('0x18')]||_0x8c64('0x19');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x8c64('0x1a')][_0x8c64('0x1b')]=function(_0x384419){this[_0x8c64('0x1c')]=this['tail']?this[_0x8c64('0x1c')][_0x8c64('0x1d')](_0x384419):_0x384419();};function Dialer(_0x511e2e,_0x365a4b){this[_0x8c64('0x1e')]=new Sequence();this['preview']=_0x365a4b;this[_0x8c64('0x1f')]=_0x511e2e[_0x8c64('0x1f')];this[_0x8c64('0x20')]=_0x511e2e[_0x8c64('0x20')];this[_0x8c64('0x21')]=_0x511e2e['agents'];this[_0x8c64('0x22')]=_0x511e2e[_0x8c64('0x22')];this[_0x8c64('0x23')]=config[_0x8c64('0x23')]||0x2;this[_0x8c64('0x24')]={};this[_0x8c64('0x25')]={};this[_0x8c64('0x26')]={};this[_0x8c64('0x27')]={};this[_0x8c64('0x28')]={};this[_0x8c64('0x29')]={};this[_0x8c64('0x2a')]={};this['ivrOriginated']={};this[_0x8c64('0x2b')]={};this[_0x8c64('0x2c')]={};this[_0x8c64('0x2d')]={};ami['on'](_0x8c64('0x2e'),this[_0x8c64('0x2f')][_0x8c64('0x30')](this));ami['on'](_0x8c64('0x31'),this[_0x8c64('0x32')][_0x8c64('0x30')](this));ami['on'](_0x8c64('0x33'),this[_0x8c64('0x34')][_0x8c64('0x30')](this));ami['on']('agentcomplete',this[_0x8c64('0x35')][_0x8c64('0x30')](this));ami['on'](_0x8c64('0x36'),this[_0x8c64('0xb')]['bind'](this));ami['on']('custom:queuesummarycomplete',this['syncQueueSummaryComplete'][_0x8c64('0x30')](this));ami['on']('hangup',this['syncHangup'][_0x8c64('0x30')](this));ami['on']('newexten',this['syncNewExten'][_0x8c64('0x30')](this));ami['on']('varset',this['syncVarSet']['bind'](this));ami['on'](_0x8c64('0x37'),this[_0x8c64('0x38')][_0x8c64('0x30')](this));ami['on'](_0x8c64('0x39'),this[_0x8c64('0x3a')][_0x8c64('0x30')](this));this[_0x8c64('0x3b')]();this['loopClearZombieChannels']();RpcSetting[_0x8c64('0x3c')]()[_0x8c64('0x3d')](function(_0x3b14b8){previewRecallmeReminderInterval=_0x3b14b8[_0x8c64('0x3e')];});}function isNotNull(_0x104a61){return _0x104a61!==null&&!_[_0x8c64('0x3f')](_0x104a61);}function msgResponse(_0x2cd133,_0x2800f0,_0x4d134e){return{'action':_0x2cd133,'response':_0x2800f0,'message':_0x4d134e,'stack':_0x4d134e};}function emit(_0x427404,_0x502b2e,_0x596c34){io['to'](_0x427404)['emit'](_0x502b2e,_0x596c34);}function emitOutboundVoiceQueueSummary(_0x5a976f){if(_0x5a976f['type']===_0x8c64('0x40')){logger[_0x8c64('0x41')](_0x8c64('0x42'),util[_0x8c64('0x43')](_0x5a976f,{'showHidden':![],'depth':null}));emit(util[_0x8c64('0x44')](_0x8c64('0x45'),_0x5a976f['name']),_0x8c64('0x46'),_0x5a976f);}}function checkGetDataPredictive(_0x54693b){if(isNotNull(_0x54693b)&&!_[_0x8c64('0x47')](_0x54693b)){loggerPredictive[_0x8c64('0x48')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x8c64('0x48')](_0x8c64('0x49'),_0x54693b[_0x8c64('0x4a')]);loggerPredictive[_0x8c64('0x48')](_0x8c64('0x4b'),_0x54693b[_0x8c64('0x4c')]);loggerPredictive[_0x8c64('0x48')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x54693b[_0x8c64('0x4d')]);loggerPredictive[_0x8c64('0x48')](_0x8c64('0x4e'),_0x54693b[_0x8c64('0x4f')]);loggerPredictive[_0x8c64('0x48')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x54693b[_0x8c64('0x50')]);loggerPredictive[_0x8c64('0x48')](_0x8c64('0x51'),_0x54693b[_0x8c64('0x52')]);loggerPredictive['info'](_0x8c64('0x53'));if(_0x54693b[_0x8c64('0x4a')]>0x0){if(!_['isUndefined'](_0x54693b[_0x8c64('0x52')])&&_0x54693b['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x8c64('0x48')](_0x8c64('0x54'));if(!_[_0x8c64('0x3f')](_0x54693b[_0x8c64('0x50')])&&_0x54693b[_0x8c64('0x50')]>0x0){return!![];}loggerPredictive[_0x8c64('0x48')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x8c64('0x48')](_0x8c64('0x55'));}}else{loggerPredictive[_0x8c64('0x48')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x2a5449){return function(_0x560cbd){loggerPredictive[_0x8c64('0x48')]('---------\x20ErlangB\x20---------');loggerPredictive[_0x8c64('0x48')](_0x8c64('0x56'),_0x560cbd[_0x8c64('0x57')]);loggerPredictive[_0x8c64('0x48')](_0x8c64('0x58'),_0x560cbd['erlangCallToSecond']);loggerPredictive[_0x8c64('0x48')](_0x8c64('0x59'),_0x560cbd[_0x8c64('0x5a')]);loggerPredictive[_0x8c64('0x48')](_0x8c64('0x5b'),_0x560cbd[_0x8c64('0x5c')]);loggerPredictive[_0x8c64('0x48')](_0x8c64('0x59'),_0x560cbd['erlangAbandonmentRate']);loggerPredictive[_0x8c64('0x48')](_0x8c64('0x53'));_['merge'](_0x2a5449,_0x560cbd);};}function ifInterval(_0x49ac13,_0x475d10){if(_[_0x8c64('0x3f')](_0x475d10)){return![];}return utils[_0x8c64('0x5d')](undefined,_0x475d10)<_0x49ac13*0x3c;}function clearPredictiveAttributes(_0x1783eb){if(_0x1783eb['startProgressive']){_0x1783eb['startProgressive']=undefined;loggerPredictive[_0x8c64('0x41')](_0x1783eb[_0x8c64('0x5e')],'startProgressive\x20value\x20cleared');}if(_0x1783eb[_0x8c64('0x29')]){_0x1783eb[_0x8c64('0x29')]=undefined;loggerPredictive[_0x8c64('0x41')](_0x1783eb[_0x8c64('0x5e')],_0x8c64('0x5f'));}if(_0x1783eb[_0x8c64('0x60')]){clearInterval(_0x1783eb[_0x8c64('0x60')]);_0x1783eb[_0x8c64('0x60')]=undefined;loggerPredictive['debug'](_0x1783eb[_0x8c64('0x5e')],_0x8c64('0x61'));}}function loggerCatchPredictive(_0x3cc58a,_0xfbaaed){return function(_0x3a8b17){loggerPredictive[_0x8c64('0x62')](_0xfbaaed[_0x8c64('0x5e')],_0x3cc58a);loggerPredictive[_0x8c64('0x62')](_0x3a8b17[_0x8c64('0x63')]);clearPredictiveAttributes(_0xfbaaed);};}function loggerCatch(_0x4a1780){return function(_0x5d39fd){logger[_0x8c64('0x62')](_0x4a1780,util[_0x8c64('0x43')](_0x5d39fd,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x162f3c,_0x3e6a83,_0xf1ad6b){return function(_0x414283){utils[_0x8c64('0x64')](_0x3e6a83,_0xf1ad6b,0x0);logger[_0x8c64('0x62')](_0x162f3c,util[_0x8c64('0x43')](_0x414283,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x37082f){return function(_0xa76d5a){if(isNotNull(_0xa76d5a)&&isNotNull(_0xa76d5a[0x0])){if(_0xa76d5a[0x0][_0x8c64('0x65')]>0x0){_0x37082f[_0x8c64('0x66')]=utils[_0x8c64('0x67')]['CONTACTS_RESCHEDULED'];logger[_0x8c64('0x48')](_0x8c64('0x68')+_0x37082f['name'],_0xa76d5a[0x0][_0x8c64('0x65')],'contacts');}else{_0x37082f['message']=utils[_0x8c64('0x67')][_0x8c64('0x69')];logger[_0x8c64('0x48')]('[getContactDialer2][Empty]'+_0x37082f[_0x8c64('0x5e')]);}}};}function createObjHistory(_0x14e1b3,_0x46521f,_0x5eddfb,_0x3a17d4,_0x4ac1fb){_0x14e1b3[_0x8c64('0x66')]=_0x5eddfb;var _0x506910=new Action(_0x14e1b3,_0x46521f);var _0x5e1137=new History(_0x506910);_0x5e1137['state']=_0x3a17d4;_0x5e1137[_0x8c64('0x6a')]=_0x4ac1fb;_0x5e1137[_0x8c64('0x6b')]=_0x506910['starttime'];return _0x5e1137;}function unlockQueueStatus(_0x265a30,_0x3a6c3d){setTimeout(function(){if(_[_0x8c64('0x3f')](_0x265a30[_0x8c64('0x6c')])){loggerBooked['error'](_0x8c64('0x6d'),_0x3a6c3d);}_0x265a30[_0x8c64('0x6c')]=!![];loggerBooked['info'](_0x8c64('0x6e'),_0x3a6c3d,JSON[_0x8c64('0x6f')](_[_0x8c64('0x70')](_0x265a30,[_0x8c64('0x5e'),_0x8c64('0x6c')])));},0x1f3);}function checkInterval(_0x49b16d){return function(){if(!isNotNull(_0x49b16d[_0x8c64('0x71')])){_0x49b16d[_0x8c64('0x66')]=utils[_0x8c64('0x67')][_0x8c64('0x72')];throw _0x49b16d[_0x8c64('0x5e')]+_0x8c64('0x73');}if(!isNotNull(_0x49b16d[_0x8c64('0x71')][_0x8c64('0x74')])){_0x49b16d[_0x8c64('0x66')]=utils[_0x8c64('0x67')][_0x8c64('0x72')];throw _0x49b16d[_0x8c64('0x5e')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x8c64('0x47')](_0x49b16d['Interval'][_0x8c64('0x74')]))){_0x49b16d['message']=utils['CAMPAIGN_STATUS'][_0x8c64('0x72')];throw _0x49b16d[_0x8c64('0x5e')]+_0x8c64('0x73');}};}function checkIsIVRCampaignActive(_0x3a52b6){return function(){if(!utils[_0x8c64('0x75')](_0x3a52b6)){_0x3a52b6[_0x8c64('0x66')]=utils['CAMPAIGN_STATUS'][_0x8c64('0x76')];throw _0x3a52b6['name']+_0x8c64('0x77');}};}function emitCampaignSummary(_0x161423){if(utils[_0x8c64('0x78')](_0x161423)){emit(util[_0x8c64('0x44')](_0x8c64('0x79'),_0x161423['name']),_0x8c64('0x7a'),_0x161423);}}function loggerCatchQueueSummary(_0x3bfdbd,_0x4b378f){return function(_0x251647){clearPredictiveAttributes(_0x4b378f);emitCampaignSummary(_0x4b378f);loggerSyncQueueSummary['debug'](_0x3bfdbd,util['inspect'](_0x251647,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x94541c){if(_0x94541c[_0x8c64('0x7b')]){if(_0x94541c[_0x8c64('0x7c')]===0x0){_0x94541c[_0x8c64('0x7b')]=![];_0x94541c[_0x8c64('0x66')]=utils[_0x8c64('0x67')]['INACTIVE'];loggerSyncQueueSummary[_0x8c64('0x41')](_0x8c64('0x7d'),_0x94541c['name'],_0x8c64('0x7e'));}else{_0x94541c[_0x8c64('0x66')]=utils['CAMPAIGN_STATUS'][_0x8c64('0x7f')];loggerSyncQueueSummary['debug'](_0x8c64('0x7d'),_0x94541c[_0x8c64('0x5e')],_0x8c64('0x80'));}emitCampaignSummary(_0x94541c);}}function myreject(_0x96ab57){return function(_0x2c521c){return _0x96ab57(msgResponse(_0x8c64('0x81'),_0x8c64('0x82'),JSON[_0x8c64('0x6f')](_0x2c521c)));};}Dialer[_0x8c64('0x1a')][_0x8c64('0x83')]=function(_0x262aab){return!_[_0x8c64('0x3f')](_0x262aab)&&_0x262aab&&!_[_0x8c64('0x3f')](_0x262aab[_0x8c64('0x5e')])&&!_[_0x8c64('0x3f')](_0x262aab[_0x8c64('0x84')])&&_0x262aab[_0x8c64('0x84')]&&(this['trunks'][util[_0x8c64('0x44')](_0x8c64('0x85'),_0x262aab[_0x8c64('0x5e')])][_0x8c64('0x86')]===_0x8c64('0x87')||this['trunks'][util['format'](_0x8c64('0x85'),_0x262aab[_0x8c64('0x5e')])]['status']===_0x8c64('0x88'));};Dialer['prototype'][_0x8c64('0x89')]=function(_0x575fd5){var _0x30ec49=this;return function(){if(!_0x30ec49[_0x8c64('0x83')](_0x575fd5[_0x8c64('0x8a')])){if(!_0x30ec49[_0x8c64('0x83')](_0x575fd5[_0x8c64('0x8b')])){_0x575fd5[_0x8c64('0x66')]=utils[_0x8c64('0x67')][_0x8c64('0x8c')];throw _0x575fd5['name']+_0x8c64('0x8d');}}};};Dialer[_0x8c64('0x1a')][_0x8c64('0x8e')]=function(_0x2f66d0,_0x2bf0c4,_0x28e36f,_0x2ad279){var _0x1ca2f2=this;return function(){var _0x4291d0=!![];return _0x1ca2f2[_0x8c64('0x8f')](_0x2f66d0,_0x2bf0c4,_0x28e36f,_0x2ad279,_0x4291d0);};};Dialer[_0x8c64('0x1a')][_0x8c64('0x90')]=function(_0xf6e1e0,_0x6d0022,_0x5c1138,_0x3405bd){var _0x47b7cf=this;return function(){var _0x3991f4=![];return _0x47b7cf['ifTimeIvr'](_0xf6e1e0[_0x8c64('0x74')],_0x6d0022,_0x5c1138,_0x3405bd,_0x3991f4);};};Dialer[_0x8c64('0x1a')][_0x8c64('0x8f')]=function(_0x299d82,_0x1764b4,_0x3f2a86,_0x2b74c4,_0x412a54){var _0x1fddca=[];return new Promise(function(_0x1befb9,_0x436a67){if(!isNotNull(_0x299d82)){_0x2b74c4[_0x8c64('0x66')]=utils[_0x8c64('0x67')][_0x8c64('0x72')];return _0x436a67(msgResponse(_0x8c64('0x91'),'Failure',_0x3f2a86+_0x8c64('0x92')));}if(_[_0x8c64('0x47')](_0x299d82)){_0x2b74c4[_0x8c64('0x66')]=utils[_0x8c64('0x67')][_0x8c64('0x93')];return _0x436a67(msgResponse(_0x8c64('0x91'),'Failure',_0x3f2a86+_0x8c64('0x94')));}if(_0x1764b4&&_[_0x8c64('0x3f')](config[_0x8c64('0x95')][_0x1764b4])){_0x2b74c4[_0x8c64('0x66')]=utils[_0x8c64('0x67')][_0x8c64('0x96')];return _0x436a67(msgResponse(_0x8c64('0x91'),_0x8c64('0x97'),_0x3f2a86+_0x8c64('0x98')+_0x1764b4));}if(_[_0x8c64('0x99')](_0x299d82)){for(var _0xfbfa3d=0x0;_0xfbfa3d<_0x299d82[_0x8c64('0x9a')];_0xfbfa3d+=0x1){_0x1fddca[_0x8c64('0x9b')](ami[_0x8c64('0x9c')]({'action':_0x8c64('0x9d'),'command':util['format']('iftime\x20%s,%s',_0x299d82[_0xfbfa3d][_0x8c64('0x9e')],!_['isUndefined'](config[_0x8c64('0x95')][_0x1764b4])?_0x1764b4:'')})[_0x8c64('0x3d')](function(_0x3ada21){return _0x3ada21['content'][_0x8c64('0x9f')](_0x8c64('0xa0'))>=0x0;})[_0x8c64('0xa1')](myreject(_0x436a67)));}}else{_0x1fddca[_0x8c64('0x9b')](ami['Action']({'action':_0x8c64('0x9d'),'command':util[_0x8c64('0x44')](_0x8c64('0xa2'),_0x299d82,!_[_0x8c64('0x3f')](config[_0x8c64('0x95')][_0x1764b4])?_0x1764b4:'')})[_0x8c64('0x3d')](function(_0x577fbb){return _0x577fbb[_0x8c64('0xa3')]['indexOf'](_0x8c64('0xa0'))>=0x0;})[_0x8c64('0xa1')](myreject(_0x436a67)));}Promise[_0x8c64('0xa4')](_0x1fddca)['then'](function(_0x2eb798){var _0x34956a=_[_0x8c64('0xa5')](_0x2eb798);if(_0x34956a){return _0x1befb9(_0x34956a);}else{_0x2b74c4[_0x8c64('0x66')]=_0x412a54?utils[_0x8c64('0x67')][_0x8c64('0xa6')]:utils[_0x8c64('0x67')][_0x8c64('0xa7')];return _0x436a67(msgResponse(_0x8c64('0xa8'),_0x8c64('0x97'),_0x8c64('0xa9')+_0x412a54+'\x20'+_0x3f2a86+_0x8c64('0xaa')+util[_0x8c64('0x43')](_0x299d82,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x1764b4));}})[_0x8c64('0xa1')](function(_0x37d15){return _0x436a67(msgResponse(_0x8c64('0x91'),'Failure',JSON['stringify'](_0x37d15)));});});};Dialer[_0x8c64('0x1a')][_0x8c64('0x3b')]=function(){var _0x509b3b=this;return cmHopper[_0x8c64('0xab')]({'active':![]},{'where':{'active':!![]}})[_0x8c64('0x3d')](function(){setInterval(function(){_0x509b3b[_0x8c64('0xac')]();},0x3e8);});};Dialer[_0x8c64('0x1a')][_0x8c64('0xac')]=function(){var _0x34c11f=this;var _0x4d8610;for(var _0x5d4098 in this[_0x8c64('0x20')]){if(typeof this[_0x8c64('0x20')][_0x5d4098]!==_0x8c64('0xad')){_0x4d8610=this[_0x8c64('0x20')][_0x5d4098];if(utils[_0x8c64('0x78')](_0x4d8610)&&utils['isIVRCampaignActive'](_0x4d8610)){_0x4d8610[_0x8c64('0x7b')]=!![];Promise['resolve']()[_0x8c64('0x3d')](checkIsIVRCampaignActive(_0x4d8610))['then'](checkInterval(_0x4d8610))[_0x8c64('0x3d')](_0x34c11f[_0x8c64('0x89')](_0x4d8610))[_0x8c64('0x3d')](_0x34c11f[_0x8c64('0x8e')](_0x4d8610['dialGlobalInterval'],_0x4d8610[_0x8c64('0xae')],_0x4d8610[_0x8c64('0x5e')],_0x4d8610))[_0x8c64('0x3d')](_0x34c11f['checkIfTimeIntervals'](_0x4d8610[_0x8c64('0x71')],_0x4d8610['dialTimezone'],_0x4d8610[_0x8c64('0x5e')],_0x4d8610))[_0x8c64('0x3d')](_0x34c11f['launchHandleIvr'](_0x4d8610))[_0x8c64('0xa1')](loggerCatchQueueSummary(_0x8c64('0xaf'),_0x4d8610));}else{notSendMessagesCampaign(_0x4d8610);}}}};Dialer['prototype'][_0x8c64('0xb0')]=function(_0x368873){if(_0x368873[_0x8c64('0xb1')]!==_0x8c64('0x9')){clearPredictiveAttributes(_0x368873);}switch(_0x368873['dialMethod']){case _0x8c64('0xb2'):this[_0x8c64('0xb3')](_0x368873,0x1);break;case _0x8c64('0xb4'):this['handlePower'](_0x368873,_0x368873[_0x8c64('0xb5')]);break;case'predictive':this[_0x8c64('0x9')](_0x368873);break;case _0x8c64('0x8'):this['handlePower'](_0x368873,0x1);break;default:logger[_0x8c64('0x62')](_0x8c64('0xb6'),_0x368873[_0x8c64('0x5e')],_0x8c64('0xb7'));}};Dialer[_0x8c64('0x1a')][_0x8c64('0x91')]=function(_0x19b57e,_0x4337e3){var _0x1bfe71=_0x19b57e[_0x8c64('0xae')];var _0x27d9c6=_0x4337e3?_0x19b57e[_0x8c64('0xb8')]:_0x19b57e[_0x8c64('0x71')][_0x8c64('0x74')];logger[_0x8c64('0xb9')](_0x8c64('0xba'),_0x27d9c6,_0x1bfe71,_0x19b57e['name'],util['format']('Voice\x20Queue\x20%s\x20$s',_0x19b57e[_0x8c64('0x5e')],_0x19b57e['id']));var _0x42b147=null;return Interval[_0x8c64('0xbb')](_0x27d9c6,_0x1bfe71)[_0x8c64('0x3d')](function(_0x5b9e47){if(_0x5b9e47===!![]){return _0x5b9e47;}else{_0x19b57e[_0x8c64('0x66')]=_0x4337e3?utils[_0x8c64('0x67')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0x8c64('0x67')][_0x8c64('0xa7')];_0x42b147=msgResponse(_0x8c64('0xa8'),_0x8c64('0x97'),_0x8c64('0xa9')+_0x4337e3+'\x20'+_0x19b57e[_0x8c64('0x5e')]+'\x20Interval\x20is\x20overtime:\x20'+util['inspect'](_0x27d9c6,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x1bfe71);}if(_0x42b147!==null){logger[_0x8c64('0xb9')](_0x8c64('0xbc'),_0x42b147);_0x42b147[_0x8c64('0xbd')]=_0x4337e3;throw _0x42b147;}})[_0x8c64('0xa1')](function(_0xcd2cc0){logger['error'](_0x8c64('0xbe'),_0xcd2cc0);throw msgResponse(_0x8c64('0x81'),'Error',util[_0x8c64('0x43')](_0xcd2cc0,{'showHidden':![],'depth':null}));});};Dialer['prototype'][_0x8c64('0x2f')]=function(_0x1112d9){if(this[_0x8c64('0x1f')][_0x1112d9[_0x8c64('0xbf')]]){if(this['uniqueId'][_0x1112d9[_0x8c64('0xc0')]]&&this['uniqueId'][_0x1112d9[_0x8c64('0xc0')]]['type']!==_0x8c64('0xc1')){this[_0x8c64('0xc2')](this[_0x8c64('0x1f')][_0x1112d9['queue']]);this[_0x8c64('0x27')][_0x1112d9[_0x8c64('0xc0')]][_0x8c64('0xc3')]=moment()[_0x8c64('0x44')](_0x8c64('0xc4'));}}};Dialer['prototype'][_0x8c64('0x35')]=function(_0x48d7d5){var _0xb9d6e1=this[_0x8c64('0x27')][_0x48d7d5['uniqueid']];if(this[_0x8c64('0x1f')][_0x48d7d5[_0x8c64('0xbf')]]){if(_0xb9d6e1&&_0xb9d6e1[_0x8c64('0xc5')]!=='ivr'){delete this[_0x8c64('0x27')][_0x48d7d5['uniqueid']];this[_0x8c64('0x1f')][_0x48d7d5[_0x8c64('0xbf')]]['outboundAnswerCallsDay']+=0x1;var _0x5dba8a=new AgentComplete(_0xb9d6e1,_0x48d7d5);if(_0x48d7d5[_0x8c64('0xc6')]===_0x8c64('0xc7')){_0x5dba8a['agiafterat']=this[_0x8c64('0x1f')][_0x48d7d5[_0x8c64('0xbf')]][_0x8c64('0xc8')]&&this['voiceQueues'][_0x48d7d5[_0x8c64('0xbf')]][_0x8c64('0xc9')]?moment()[_0x8c64('0x44')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}hopperUtils['createHistory'](_0x5dba8a)['catch'](loggerCatch(_0x8c64('0xca')));hopperUtils[_0x8c64('0xcb')](_0x5dba8a)[_0x8c64('0xa1')](loggerCatch(_0x8c64('0xcc')));}}};Dialer[_0x8c64('0x1a')][_0x8c64('0x32')]=function(_0x242bae){var _0x42efaa=this[_0x8c64('0x27')][_0x242bae[_0x8c64('0xc0')]];var _0x4224b7=this;var _0x21dbf7=![];var _0x526646;var _0x56d214;if(this['voiceQueues'][_0x242bae[_0x8c64('0xbf')]]){if(_0x42efaa&&_0x42efaa[_0x8c64('0xc5')]!=='ivr'){delete this[_0x8c64('0x27')][_0x242bae[_0x8c64('0xc0')]];this[_0x8c64('0xc2')](this[_0x8c64('0x1f')][_0x242bae['queue']]);_0x42efaa[_0x8c64('0xcd')]=moment()[_0x8c64('0x44')](_0x8c64('0xc4'));var _0x3d34f2=new QueueCallerAbandon(_0x42efaa,_0x242bae);if(utils[_0x8c64('0x5d')](_0x42efaa[_0x8c64('0xcd')],_0x42efaa[_0x8c64('0xce')])>=_0x42efaa[_0x8c64('0xcf')]){this[_0x8c64('0x1f')][_0x242bae['queue']][_0x8c64('0x4d')]+=0x1;this[_0x8c64('0x1f')][_0x242bae[_0x8c64('0xbf')]][_0x8c64('0xd0')]+=0x1;this[_0x8c64('0x1f')][_0x242bae[_0x8c64('0xbf')]][_0x8c64('0xd1')]+=0x1;_0x3d34f2[_0x8c64('0xd2')]=0xa;_0x3d34f2[_0x8c64('0x6a')]=_0x8c64('0xd3');_0x3d34f2[_0x8c64('0xd4')]=_0x8c64('0xd5');_0x3d34f2[_0x8c64('0xd6')]=this[_0x8c64('0x1f')][_0x242bae[_0x8c64('0xbf')]]['dialQueueProject2']?moment()[_0x8c64('0x44')](_0x8c64('0xc4')):undefined;_0x3d34f2[_0x8c64('0xd7')]+=0x1;_0x3d34f2[_0x8c64('0xd8')]+=0x1;_0x526646=this[_0x8c64('0x1f')][_0x242bae[_0x8c64('0xbf')]][_0x8c64('0xd9')];_0x56d214=this[_0x8c64('0x1f')][_0x242bae[_0x8c64('0xbf')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x8c64('0xda')](_0x3d34f2,_0x3d34f2[_0x8c64('0xd2')],_0x42efaa[_0x8c64('0xdb')])[_0x8c64('0x3d')](function(_0x163147){_0x21dbf7=_0x163147[_0x8c64('0xdc')]==0x1;if(_0x3d34f2[_0x8c64('0xd7')]>=_0x4224b7[_0x8c64('0x1f')][_0x242bae[_0x8c64('0xbf')]][_0x8c64('0xdd')]){_0x4224b7[_0x8c64('0xde')](_0x3d34f2,_0x163147[_0x8c64('0xdc')]);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x3d34f2['countdropretry'],'scheduledat':moment()[_0x8c64('0xdf')](_0x4224b7[_0x8c64('0x1f')][_0x242bae[_0x8c64('0xbf')]][_0x8c64('0xd9')],_0x8c64('0xe0'))[_0x8c64('0x44')](_0x8c64('0xc4')),'ContactId':_0x42efaa[_0x8c64('0xe1')],'ListId':_0x42efaa[_0x8c64('0xe2')],'VoiceQueueId':_0x42efaa[_0x8c64('0xe3')]||undefined,'CampaignId':_0x42efaa[_0x8c64('0xe4')]||undefined})[_0x8c64('0xa1')](loggerCatch('[rescheduleContact][Drop]'));var _0x448837=new History(_0x3d34f2);_0x448837[_0x8c64('0xd2')]=0xa;_0x448837[_0x8c64('0x6a')]=_0x8c64('0xd3');_0x448837['starttime']=moment()[_0x8c64('0x44')](_0x8c64('0xc4'));_0x448837[_0x8c64('0x6b')]=_0x448837[_0x8c64('0xe5')];_0x448837['calleridname']=_0x3d34f2['calleridname'];_0x448837['calleridnum']=_0x3d34f2[_0x8c64('0xe6')];hopperUtils[_0x8c64('0xe7')](_0x448837)[_0x8c64('0xa1')](loggerCatch(_0x8c64('0xe8')));}})[_0x8c64('0x3d')](function(){if(_0x21dbf7)hopperUtils[_0x8c64('0xe9')](_0x3d34f2,_0x526646,_0x56d214)[_0x8c64('0x3d')](function(){return 0x1;});});}else{this['voiceQueues'][_0x242bae[_0x8c64('0xbf')]][_0x8c64('0x4f')]+=0x1;this[_0x8c64('0x1f')][_0x242bae[_0x8c64('0xbf')]][_0x8c64('0xea')]+=0x1;_0x3d34f2['state']=0xb;_0x3d34f2[_0x8c64('0x6a')]=_0x8c64('0xeb');_0x3d34f2[_0x8c64('0xd4')]='CALLEREXIT';_0x3d34f2['countabandonedretry']+=0x1;_0x3d34f2['countglobal']+=0x1;_0x526646=this['voiceQueues'][_0x242bae['queue']][_0x8c64('0xec')];_0x56d214=this[_0x8c64('0x1f')][_0x242bae[_0x8c64('0xbf')]][_0x8c64('0xed')];hopperUtils['verifyAdditionalPhones'](_0x3d34f2,_0x3d34f2[_0x8c64('0xd2')],_0x42efaa[_0x8c64('0xdb')])[_0x8c64('0x3d')](function(_0x28942c){if(_0x3d34f2['countabandonedretry']>=_0x4224b7[_0x8c64('0x1f')][_0x242bae[_0x8c64('0xbf')]][_0x8c64('0xee')]){_0x4224b7[_0x8c64('0xde')](_0x3d34f2,_0x28942c[_0x8c64('0xdc')]);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x3d34f2[_0x8c64('0xef')],'scheduledat':moment()[_0x8c64('0xdf')](_0x4224b7[_0x8c64('0x1f')][_0x242bae[_0x8c64('0xbf')]]['dialAbandonedRetryFrequency'],_0x8c64('0xe0'))[_0x8c64('0x44')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x42efaa[_0x8c64('0xe1')],'ListId':_0x42efaa[_0x8c64('0xe2')],'VoiceQueueId':_0x42efaa[_0x8c64('0xe3')]||undefined,'CampaignId':_0x42efaa[_0x8c64('0xe4')]||undefined})[_0x8c64('0xa1')](loggerCatch(_0x8c64('0xf0')));var _0xb95155=new History(_0x3d34f2);_0xb95155[_0x8c64('0xd2')]=0xb;_0xb95155[_0x8c64('0x6a')]=_0x8c64('0xeb');_0xb95155[_0x8c64('0xe5')]=moment()['format'](_0x8c64('0xc4'));_0xb95155[_0x8c64('0x6b')]=_0xb95155[_0x8c64('0xe5')];_0xb95155[_0x8c64('0xf1')]=_0x3d34f2[_0x8c64('0xf1')];_0xb95155[_0x8c64('0xe6')]=_0x3d34f2[_0x8c64('0xe6')];hopperUtils['createHistory'](_0xb95155)[_0x8c64('0xa1')](loggerCatch(_0x8c64('0xf2')));}})[_0x8c64('0x3d')](function(){if(_0x21dbf7)hopperUtils['swapAdditionalPhones'](_0x3d34f2,_0x526646,_0x56d214)[_0x8c64('0x3d')](function(){return 0x1;});});}}}};Dialer['prototype'][_0x8c64('0xf3')]=function(_0x543e57){if(this[_0x8c64('0x25')][_0x543e57[_0x8c64('0xc0')]]){this[_0x8c64('0x25')][_0x543e57[_0x8c64('0xc0')]][_0x8c64('0xf4')]=_0x543e57[_0x8c64('0xf4')];}if(this[_0x8c64('0x27')][_0x543e57[_0x8c64('0xc0')]]){this['uniqueId'][_0x543e57[_0x8c64('0xc0')]][_0x8c64('0xf4')]=_0x543e57[_0x8c64('0xf4')];}};Dialer[_0x8c64('0x1a')][_0x8c64('0x38')]=function(_0x12f551){if(!this[_0x8c64('0x25')][_0x12f551[_0x8c64('0xf5')]]){return;}var _0x42e8e7=this[_0x8c64('0x1f')][this[_0x8c64('0x25')][_0x12f551[_0x8c64('0xf5')]]['queue']][_0x8c64('0xf6')]||_0x8c64('0xf7');if(_0x42e8e7===_0x8c64('0xf8')){if(this[_0x8c64('0x25')][_0x12f551[_0x8c64('0xf5')]]&&_['isNil'](this[_0x8c64('0x25')][_0x12f551[_0x8c64('0xf5')]][_0x8c64('0xf9')])&&_0x12f551[_0x8c64('0x86')]==='1'&&_0x12f551[_0x8c64('0xfa')]==='0'){if(this[_0x8c64('0x21')][_0x12f551[_0x8c64('0xfb')]]){if(!this[_0x8c64('0x21')][_0x12f551[_0x8c64('0xfb')]][_0x8c64('0xf9')]){this[_0x8c64('0x21')][_0x12f551[_0x8c64('0xfb')]]['locked']=!![];this['actions'][_0x12f551['actionid']][_0x8c64('0xf9')]=!![];this[_0x8c64('0x25')][_0x12f551[_0x8c64('0xf5')]][_0x8c64('0xfb')]=_0x12f551[_0x8c64('0xfb')];}}}}else if(_0x42e8e7===_0x8c64('0xf7')){if(this[_0x8c64('0x25')][_0x12f551[_0x8c64('0xf5')]]){if(this['agents'][_0x12f551[_0x8c64('0xfb')]]){this[_0x8c64('0x25')][_0x12f551['actionid']][_0x8c64('0xfb')]=_0x12f551[_0x8c64('0xfb')];if(_[_0x8c64('0xfc')](this[_0x8c64('0x2b')][this[_0x8c64('0x25')][_0x12f551['actionid']]['queue']])){this['queueBooked'][this[_0x8c64('0x25')][_0x12f551[_0x8c64('0xf5')]][_0x8c64('0xbf')]]=[];}this[_0x8c64('0x2b')][this[_0x8c64('0x25')][_0x12f551[_0x8c64('0xf5')]][_0x8c64('0xbf')]][_0x8c64('0x9b')](_[_0x8c64('0xfd')](_[_0x8c64('0x70')](this[_0x8c64('0x25')][_0x12f551['actionid']],[_0x8c64('0xfe'),_0x8c64('0xfb')]),{'status':_0x12f551[_0x8c64('0x86')],'paused':_0x12f551['paused']}));}}}};Dialer[_0x8c64('0x1a')]['syncQueueStatusComplete']=function(_0x457648){if(!this[_0x8c64('0x25')][_0x457648[_0x8c64('0xf5')]]){return;}var _0x4520b9=this;var _0x204a8f=this[_0x8c64('0x1f')][this[_0x8c64('0x25')][_0x457648[_0x8c64('0xf5')]][_0x8c64('0xbf')]];var _0x35bfea=_0x204a8f[_0x8c64('0xf6')]||_0x8c64('0xf7');if(_0x35bfea==='roundrobin'){if(this[_0x8c64('0x25')][_0x457648[_0x8c64('0xf5')]]&&this['actions'][_0x457648[_0x8c64('0xf5')]][_0x8c64('0xfb')]){this[_0x8c64('0xff')]['run'](this['actions'][_0x457648[_0x8c64('0xf5')]][_0x8c64('0xfe')],this[_0x8c64('0x25')][_0x457648[_0x8c64('0xf5')]][_0x8c64('0xfb')])['catch'](function(_0x23ca65){logger[_0x8c64('0x62')](_0x8c64('0x100'),util[_0x8c64('0x43')](_0x23ca65,{'showHidden':![],'depth':null}));})[_0x8c64('0x1d')](function(){_0x4520b9['updateOriginated'](_0x4520b9['voiceQueues'][_0x4520b9[_0x8c64('0x25')][_0x457648[_0x8c64('0xf5')]][_0x8c64('0xbf')]]);_0x4520b9[_0x8c64('0x21')][_0x4520b9[_0x8c64('0x25')][_0x457648[_0x8c64('0xf5')]][_0x8c64('0xfb')]]['locked']=![];delete _0x4520b9[_0x8c64('0x25')][_0x457648[_0x8c64('0xf5')]];unlockQueueStatus(_0x204a8f);});}else{this[_0x8c64('0xc2')](this[_0x8c64('0x1f')][this[_0x8c64('0x25')][_0x457648[_0x8c64('0xf5')]][_0x8c64('0xbf')]]);hopperUtils['rescheduleContact']({'active':![],'ContactId':this['actions'][_0x457648[_0x8c64('0xf5')]][_0x8c64('0xe1')],'ListId':this[_0x8c64('0x25')][_0x457648[_0x8c64('0xf5')]][_0x8c64('0xe2')],'VoiceQueueId':this['actions'][_0x457648[_0x8c64('0xf5')]][_0x8c64('0xe3')]||undefined,'CampaignId':this[_0x8c64('0x25')][_0x457648[_0x8c64('0xf5')]][_0x8c64('0xe4')]||undefined})[_0x8c64('0xa1')](loggerCatch(_0x8c64('0x101')));delete this[_0x8c64('0x25')][_0x457648[_0x8c64('0xf5')]];unlockQueueStatus(_0x204a8f);}}else if(_0x35bfea===_0x8c64('0xf7')){var _0x55a197;if(this[_0x8c64('0x25')][_0x457648[_0x8c64('0xf5')]]&&!_[_0x8c64('0x47')](this['queueBooked'][this[_0x8c64('0x25')][_0x457648[_0x8c64('0xf5')]]['queue']])){if(this[_0x8c64('0x2c')][_0x4520b9['actions'][_0x457648[_0x8c64('0xf5')]]['queue']]){this[_0x8c64('0x2c')][_0x4520b9[_0x8c64('0x25')][_0x457648[_0x8c64('0xf5')]]['queue']]=this['queueBookedRR'][this[_0x8c64('0x25')][_0x457648['actionid']][_0x8c64('0xbf')]]?this[_0x8c64('0x2c')][this['actions'][_0x457648[_0x8c64('0xf5')]][_0x8c64('0xbf')]]:this[_0x8c64('0x2b')][this[_0x8c64('0x25')][_0x457648[_0x8c64('0xf5')]][_0x8c64('0xbf')]]?this[_0x8c64('0x2b')][this[_0x8c64('0x25')][_0x457648[_0x8c64('0xf5')]][_0x8c64('0xbf')]]['_rr']||0x0:0x0;}this[_0x8c64('0x2b')][this['actions'][_0x457648[_0x8c64('0xf5')]][_0x8c64('0xbf')]]['_rr']=this[_0x8c64('0x2c')][this['actions'][_0x457648[_0x8c64('0xf5')]][_0x8c64('0xbf')]];for(var _0x547f85=0x0;_0x547f85=_0x1cbe98['dialGlobalMaxRetry']){_0x5958fb[_0x8c64('0x12a')](_0x97dc29,_0xd854db,_0x1f98e5,'reason19\x20machine....');}else{if(_0x97dc29['countmachineretry']>=_0x1cbe98[_0x8c64('0x12b')]){_0x5958fb['createStateFinal'](_0x97dc29,_0xd854db,_0x1f98e5,_0x8c64('0x12c'));}else{hopperUtils[_0x8c64('0x108')]({'active':![],'countmachineretry':_0x97dc29['countmachineretry'],'scheduledat':moment()[_0x8c64('0xdf')](_0x1cbe98['dialMachineRetryFrequency'],_0x8c64('0xe0'))['format'](_0x8c64('0xc4')),'ContactId':_0x97dc29['ContactId'],'ListId':_0x97dc29[_0x8c64('0xe2')],'VoiceQueueId':_0x97dc29[_0x8c64('0xe3')]||undefined,'CampaignId':_0x97dc29['CampaignId']||undefined})[_0x8c64('0xa1')](loggerCatch('[rescheduleContact][Machine]'));_0xd854db({'reschedule':0x1});}}});}if(_0x5ca938[_0x8c64('0xc5')]===_0x8c64('0xc1')&&this[_0x8c64('0x20')][_0x5ca938[_0x8c64('0xbf')]]['dialAMDActive']&&_0x3c786e[_0x8c64('0x116')]===_0x8c64('0x12d')){delete this[_0x8c64('0x27')][_0x3c786e['uniqueid']];this['updateOriginated'](this[_0x8c64('0x20')][_0x5ca938[_0x8c64('0xbf')]]);_0x41a721=new Hangup(_0x5ca938,_0x3c786e);_0x41a721[_0x8c64('0xd2')]=0x12;_0x41a721['statedesc']=_0x8c64('0x119');_0x41a721[_0x8c64('0x11a')]=_0x8c64('0x11b');ami[_0x8c64('0x11c')]('custom:amd',ut[_0x8c64('0x12e')](_0x41a721,'amd'));this['saveInDb'](_0x41a721,_0x8c64('0x12f'),'[syncHangupInAMDIvr]');}if(_0x5ca938['type']===_0x8c64('0xc1')&&this['campaigns'][_0x5ca938[_0x8c64('0xbf')]][_0x8c64('0x122')]&&_0x3c786e['value']==='MACHINE'){return new Promise(function(_0x42ed4d,_0x102a53){delete _0x5958fb[_0x8c64('0x27')][_0x3c786e[_0x8c64('0xc0')]];_0x5958fb['updateOriginated'](_0x5958fb['campaigns'][_0x5ca938['queue']]);_0x5958fb['campaigns'][_0x5ca938[_0x8c64('0xbf')]][_0x8c64('0x117')]+=0x1;_0x5958fb['campaigns'][_0x5ca938[_0x8c64('0xbf')]][_0x8c64('0x118')]+=0x1;var _0x5b5cb0=_0x5958fb['campaigns'][_0x5ca938[_0x8c64('0xbf')]];var _0x51c71f=new Hangup(_0x5ca938,_0x3c786e);_0x51c71f[_0x8c64('0xd2')]=0x13;_0x51c71f[_0x8c64('0x6a')]=_0x8c64('0x124');_0x51c71f[_0x8c64('0x11a')]=_0x8c64('0x11b');_0x51c71f[_0x8c64('0x125')]+=0x1;_0x51c71f[_0x8c64('0xd8')]+=0x1;_0x51c71f[_0x8c64('0x11e')]=!![];ami[_0x8c64('0x11c')](_0x8c64('0x11d'),ut[_0x8c64('0x12e')](_0x51c71f,'amd'));hopperUtils[_0x8c64('0xe7')](_0x51c71f)[_0x8c64('0xa1')](loggerCatch(_0x8c64('0x130')));if(_0x51c71f[_0x8c64('0x126')]+_0x51c71f['countcongestionretry']+_0x51c71f[_0x8c64('0x128')]+_0x51c71f[_0x8c64('0x129')]+_0x51c71f[_0x8c64('0xd7')]+_0x51c71f[_0x8c64('0xef')]+_0x51c71f[_0x8c64('0x125')]+_0x51c71f[_0x8c64('0x131')]>=_0x5b5cb0[_0x8c64('0x132')]){_0x5958fb[_0x8c64('0x12a')](_0x51c71f,_0x42ed4d,_0x102a53,_0x8c64('0x133'));}else{if(_0x51c71f[_0x8c64('0x125')]>=_0x5b5cb0[_0x8c64('0x12b')]){_0x5958fb[_0x8c64('0x134')](_0x51c71f,_0x42ed4d,_0x102a53,_0x8c64('0x12c'));}else{hopperUtils[_0x8c64('0x108')]({'active':![],'countmachineretry':_0x51c71f['countmachineretry'],'scheduledat':moment()[_0x8c64('0xdf')](_0x5b5cb0['dialMachineRetryFrequency'],_0x8c64('0xe0'))[_0x8c64('0x44')](_0x8c64('0xc4')),'ContactId':_0x51c71f[_0x8c64('0xe1')],'ListId':_0x51c71f[_0x8c64('0xe2')],'VoiceQueueId':_0x51c71f[_0x8c64('0xe3')]||undefined,'CampaignId':_0x51c71f[_0x8c64('0xe4')]||undefined})['catch'](loggerCatch(_0x8c64('0x135')));_0x42ed4d({'reschedule':0x1});}}});}}};Dialer[_0x8c64('0x1a')][_0x8c64('0x136')]=function(_0x14f871){var _0x4eb323=this['uniqueId'][_0x14f871[_0x8c64('0xc0')]];var _0x5624e7;if(_0x4eb323&&_0x4eb323['type']===_0x8c64('0xc1')){delete this[_0x8c64('0x27')][_0x14f871[_0x8c64('0xc0')]];this[_0x8c64('0xc2')](this['campaigns'][_0x4eb323[_0x8c64('0xbf')]]);this[_0x8c64('0x20')][_0x4eb323['queue']][_0x8c64('0x137')]+=0x1;_0x5624e7=new Hangup(_0x4eb323,_0x14f871);hopperUtils[_0x8c64('0xe7')](_0x5624e7)[_0x8c64('0xa1')](loggerCatch(_0x8c64('0x138')));hopperUtils['moveContactManagedDialer'](_0x5624e7)['catch'](loggerCatch(_0x8c64('0x139')));}if(_0x4eb323&&_0x4eb323['type']!==_0x8c64('0xc1')&&isNotNull(this['voiceQueues'][_0x4eb323[_0x8c64('0xbf')]][_0x8c64('0x13a')])){delete this[_0x8c64('0x27')][_0x14f871['uniqueid']];this[_0x8c64('0xc2')](this['voiceQueues'][_0x4eb323['queue']]);this[_0x8c64('0x1f')][_0x4eb323[_0x8c64('0xbf')]]['outboundAnswerCallsDay']+=0x1;this[_0x8c64('0x1f')][_0x4eb323['queue']][_0x8c64('0x118')]+=0x1;_0x5624e7=new Hangup(_0x4eb323,_0x14f871);_0x5624e7[_0x8c64('0xd2')]=0x10;_0x5624e7[_0x8c64('0x6a')]='AnswerAGI';_0x5624e7[_0x8c64('0x11a')]='AGI';hopperUtils['createHistory'](_0x5624e7)[_0x8c64('0xa1')](loggerCatch(_0x8c64('0x138')));hopperUtils[_0x8c64('0xcb')](_0x5624e7)[_0x8c64('0xa1')](loggerCatch('[syncHangupIvr]'));}if(_0x4eb323&&_0x4eb323[_0x8c64('0xc5')]!==_0x8c64('0xc1')&&!isNotNull(this[_0x8c64('0x1f')][_0x4eb323[_0x8c64('0xbf')]][_0x8c64('0x13a')])){delete this['uniqueId'][_0x14f871[_0x8c64('0xc0')]];this[_0x8c64('0xc2')](this['voiceQueues'][_0x4eb323['queue']]);this[_0x8c64('0x1f')][_0x4eb323[_0x8c64('0xbf')]]['outboundUnknownCallsDay']+=0x1;_0x5624e7=new Hangup(_0x4eb323,_0x14f871);_0x5624e7[_0x8c64('0xd2')]=0xc;_0x5624e7[_0x8c64('0x6a')]=_0x14f871[_0x8c64('0x13b')];_0x5624e7[_0x8c64('0x11a')]='Unknow';hopperUtils[_0x8c64('0xe7')](_0x5624e7)[_0x8c64('0xa1')](loggerCatch(_0x8c64('0x138')));hopperUtils['moveContactManagedDialer'](_0x5624e7)[_0x8c64('0xa1')](loggerCatch(_0x8c64('0x139')));}};Dialer['prototype'][_0x8c64('0xb')]=function(_0x3ce689){var _0x8a6459=this;if(!_0x8a6459[_0x8c64('0x2d')][_0x3ce689[_0x8c64('0x5e')]]){_0x8a6459[_0x8c64('0x2d')][_0x3ce689['name']]={'running':![]};}else if(_0x8a6459['queuesSummary'][_0x3ce689[_0x8c64('0x5e')]][_0x8c64('0x13c')]===!![]){return;}else if(_0x8a6459[_0x8c64('0x2d')][_0x3ce689[_0x8c64('0x5e')]][_0x8c64('0x13c')]===![]){_0x8a6459[_0x8c64('0x2d')][_0x3ce689[_0x8c64('0x5e')]][_0x8c64('0x13c')]=!![];}var _0x48ee22=_0x8a6459['voiceQueues'][_0x3ce689[_0x8c64('0x5e')]];var _0x395a88=_0x48ee22[_0x8c64('0x66')]!==utils[_0x8c64('0x67')][_0x8c64('0x76')];var _0x36acf8=utils[_0x8c64('0x13d')](_0x48ee22);_0x48ee22[_0x8c64('0x13e')]=utils['getQueueCampaignStatusMessage'](_0x48ee22,_0x8a6459[_0x8c64('0x22')]);Promise[_0x8c64('0x13f')]()['then'](function(){if(_0x48ee22[_0x8c64('0x13e')]===utils[_0x8c64('0x67')][_0x8c64('0x76')]){if(_0x395a88){clearPredictiveAttributes(_0x48ee22);_0x3ce689['startPredictive']=undefined;_0x3ce689['startProgressive']=undefined;}if(_0x48ee22['statusMessage']===utils[_0x8c64('0x67')]['INACTIVE']){_0x3ce689[_0x8c64('0x140')]=0x0;_0x3ce689[_0x8c64('0xfa')]=0x0;_0x3ce689[_0x8c64('0x141')]=0x0;_0x3ce689[_0x8c64('0x142')]=0x0;_0x3ce689[_0x8c64('0x143')]=0x0;}}else if(_0x48ee22['statusMessage']===utils[_0x8c64('0x67')][_0x8c64('0x144')]&&!_0x36acf8){return _0x8a6459[_0x8c64('0x91')](_0x48ee22,!![])[_0x8c64('0x3d')](function(){return _0x8a6459[_0x8c64('0x91')](_0x48ee22,![]);})['then'](function(){return _0x8a6459[_0x8c64('0xb0')](_0x48ee22);})[_0x8c64('0xa1')](function(_0x3b782b){loggerSyncQueueSummary[_0x8c64('0x41')](_0x8c64('0x145'),util[_0x8c64('0x43')](_0x3b782b,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x48ee22);});}else{clearPredictiveAttributes(_0x48ee22);}})[_0x8c64('0x3d')](function(){var _0x37a6a6=_0x3ce689['compareToOutboundQueue'](_0x48ee22);if(_0x37a6a6||_0x48ee22['queueSummaryCountersUpdated']){_0x48ee22['queueSummaryCountersUpdated']=![];_0x3ce689[_0x8c64('0x146')](_0x48ee22);Object[_0x8c64('0x147')](_0x48ee22,_0x3ce689);emitOutboundVoiceQueueSummary(_0x3ce689);}_0x8a6459[_0x8c64('0x2d')][_0x48ee22[_0x8c64('0x5e')]][_0x8c64('0x13c')]=![];})['catch'](function(_0x20d282){logger[_0x8c64('0x62')](_0x8c64('0x145'),util[_0x8c64('0x43')](_0x20d282,{'showHidden':![],'depth':null}));_0x8a6459[_0x8c64('0x2d')][_0x48ee22[_0x8c64('0x5e')]][_0x8c64('0x13c')]=![];});};Dialer[_0x8c64('0x1a')][_0x8c64('0x148')]=_['throttle'](function(){var _0x2dd137=_[_0x8c64('0x149')](this[_0x8c64('0x1f')],function(_0x5d22b4){return _0x5d22b4[_0x8c64('0x14a')];});var _0x3492a5=_[_0x8c64('0x149')](this['agents'],function(_0xd9f6cc){return _0xd9f6cc[_0x8c64('0x14b')]&&_0xd9f6cc['status']===_0x8c64('0x87');});if(_0x2dd137['length']>0x0&&_0x3492a5[_0x8c64('0x9a')]>0x0){return Promise[_0x8c64('0x13f')]()[_0x8c64('0x3d')](cmHopper[_0x8c64('0x14c')](_['map'](_0x2dd137,'id'),previewRecallmeReminderInterval,_['map'](_0x3492a5,'id')))[_0x8c64('0x3d')](function(_0x36a02c){for(var _0xbd5b4b=0x0;_0xbd5b4b<_0x36a02c[_0x8c64('0x9a')];_0xbd5b4b++){var _0x35c52b=_0x36a02c[_0xbd5b4b]['Agent']['name'];if(_0x35c52b)io['to'](util[_0x8c64('0x44')](_0x8c64('0x14d'),_0x35c52b))[_0x8c64('0x11c')](_0x8c64('0x14e'),{'hopper':_0x36a02c[_0xbd5b4b]});}})[_0x8c64('0xa1')](function(_0xfc2888){logger[_0x8c64('0x62')](_0x8c64('0x14f'),_0xfc2888);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x8c64('0x1a')][_0x8c64('0x150')]=function(){var _0x2dfd79=this;setInterval(function(){_0x2dfd79[_0x8c64('0x151')](_0x2dfd79[_0x8c64('0x27')],_0x8c64('0x152'));_0x2dfd79[_0x8c64('0x151')](_0x2dfd79[_0x8c64('0x25')],'[actions]');},0x32c8);};Dialer[_0x8c64('0x1a')][_0x8c64('0x151')]=function(_0x42b3e8,_0x4409fb){var _0x4cacc9=this;for(var _0x23bddf in _0x42b3e8){if(typeof _0x42b3e8[_0x23bddf]!=='undefined'){this[_0x8c64('0x1e')][_0x8c64('0x1b')](function(){if(!_[_0x8c64('0xfc')](_0x42b3e8[_0x23bddf])){return ami[_0x8c64('0x9c')]({'action':_0x8c64('0x86'),'channel':_0x42b3e8[_0x23bddf][_0x8c64('0xf4')]})[_0x8c64('0xa1')](function(_0x41a0f1){if(_0x41a0f1[_0x8c64('0x66')]===_0x8c64('0x153')){setTimeout(function(){if(_0x42b3e8[_0x23bddf]&&_0x42b3e8[_0x23bddf]['type']!==_0x8c64('0xc1')){_0x4cacc9[_0x8c64('0xc2')](_0x4cacc9[_0x8c64('0x1f')][_0x42b3e8[_0x23bddf][_0x8c64('0xbf')]]);logger['error'](_0x8c64('0x154'),_0x4409fb,_0x23bddf,_0x42b3e8[_0x23bddf][_0x8c64('0xbf')]);delete _0x42b3e8[_0x23bddf];}if(_0x42b3e8[_0x23bddf]&&_0x42b3e8[_0x23bddf][_0x8c64('0xc5')]===_0x8c64('0xc1')){_0x4cacc9['updateOriginated'](_0x4cacc9[_0x8c64('0x20')][_0x42b3e8[_0x23bddf][_0x8c64('0xbf')]]);logger[_0x8c64('0x62')](_0x8c64('0x155'),_0x4409fb,_0x23bddf,_0x42b3e8[_0x23bddf][_0x8c64('0xbf')]);delete _0x42b3e8[_0x23bddf];}},0x2328);}});}});}}};Dialer['prototype']['getVoiceQueueRtPauses']=function(_0x560df1){return Promise[_0x8c64('0x13f')]()['then'](voiceQueueRt[_0x8c64('0x156')](_0x560df1))['catch'](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x8c64('0x1a')][_0x8c64('0xc2')]=function(_0x1b734a){if(!_[_0x8c64('0x3f')](_0x1b734a)&&_0x1b734a!==null){if(typeof _0x1b734a['originated']!=='undefined'){if(_0x1b734a[_0x8c64('0x7c')]>0x0){_0x1b734a[_0x8c64('0x7c')]-=0x1;}else{logger[_0x8c64('0x62')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x8c64('0x62')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x8c64('0x1a')][_0x8c64('0x157')]=function(_0x3a45ef,_0x5788ee){var _0x14b581=this;return function(_0x5b9bbf){_0x14b581[_0x8c64('0xc2')](_0x5788ee);logger[_0x8c64('0x62')](_0x3a45ef,util[_0x8c64('0x43')](_0x5b9bbf,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x8c64('0x158')]=function(_0x24499f,_0x21ab21,_0x1d45a6){var _0x5d44d8={'state':0x19,'statedesc':_0x8c64('0x159')};this[_0x8c64('0xc2')](_0x21ab21);this['saveInDb'](_['merge'](_0x5d44d8,_[_0x8c64('0x70')](_0x1d45a6,['ContactId',_0x8c64('0xe2'),_0x8c64('0x15a'),_0x8c64('0xe3'),'CampaignId'])),_0x8c64('0x15b'),_0x8c64('0x15c'));logger[_0x8c64('0x62')](_0x24499f);};Dialer[_0x8c64('0x1a')]['saveInDb']=function(_0x37eed1,_0x16aeca,_0x4fbc17){hopperUtils['createHistory'](_0x37eed1)[_0x8c64('0xa1')](loggerCatch(_0x16aeca));hopperUtils[_0x8c64('0xcb')](_0x37eed1)[_0x8c64('0xa1')](loggerCatch(_0x4fbc17));};Dialer['prototype']['queueCallerAbandonCreateState']=function(_0x4037bd,_0x42eebe){hopperUtils['createHistory'](_0x4037bd)[_0x8c64('0xa1')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x42eebe==0x0){hopperUtils[_0x8c64('0xcb')](_0x4037bd)[_0x8c64('0xa1')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer[_0x8c64('0x1a')][_0x8c64('0x14f')]=function(_0x4a9755){return Promise[_0x8c64('0x13f')]()['then'](cmHopper[_0x8c64('0x14c')](_0x4a9755['id'],previewRecallmeReminderInterval))[_0x8c64('0x3d')](function(_0x4804eb){for(var _0x4c4914=0x0;_0x4c4914<_0x4804eb[_0x8c64('0x9a')];_0x4c4914++){var _0xb1ecbd=_0x4804eb[_0x4c4914]['Agent'][_0x8c64('0x5e')];if(_0xb1ecbd)io['to'](util[_0x8c64('0x44')](_0x8c64('0x14d'),_0xb1ecbd))['emit'](_0x8c64('0x14e'),{'hopper':_0x4804eb[_0x4c4914]});}})[_0x8c64('0xa1')](function(){});};Dialer['prototype'][_0x8c64('0x15d')]=function(_0x424bd2){var _0x204e24=this;return function(){_0x204e24[_0x8c64('0x15e')](_0x424bd2);};};Dialer['prototype'][_0x8c64('0x15f')]=function(_0x31f97c,_0x57936f){var _0xea9319=this;var _0x58c48c=uuid['v4']();this[_0x8c64('0x25')][_0x58c48c]=new Action(_0x31f97c,_0x57936f,_0x58c48c);return new Promise(function(_0x4e8ae6,_0x1b7b16){if(_[_0x8c64('0x3f')](_0x31f97c)&&typeof _0x31f97c!==_0x8c64('0x160')){return _0x1b7b16(msgResponse(_0x8c64('0x161'),_0x8c64('0x97'),_0x8c64('0x162')));}if(_[_0x8c64('0x3f')](_0x57936f['phone'])||_0x57936f['phone']===null){return _0x1b7b16(msgResponse('originate',_0x8c64('0x97'),_0x8c64('0x163')));}var _0x572a73={'XMD-CALLERID':_0xea9319[_0x8c64('0x25')][_0x58c48c][_0x8c64('0x164')](),'XMD-AGI':_0x31f97c[_0x8c64('0x13a')]?util[_0x8c64('0x44')](_0x8c64('0x165'),ipAgi,_0x31f97c['dialQueueProject']):_0x8c64('0x166'),'XMD-AGIAFTER':_0x31f97c[_0x8c64('0xc8')]?util[_0x8c64('0x44')](_0x8c64('0x165'),ipAgi,_0x31f97c[_0x8c64('0xc8')]):_0x8c64('0x166'),'XMD-QUEUE':utils[_0x8c64('0x167')](_0x31f97c)?util[_0x8c64('0x44')](_0x8c64('0x168'),_0x31f97c[_0x8c64('0x5e')],_0x31f97c[_0x8c64('0x169')]||'',_0x31f97c[_0x8c64('0xc9')]?'c':'',_0x31f97c[_0x8c64('0xcf')]||0x3):_0x8c64('0x166'),'XMD-CONTACTID':_0x57936f[_0x8c64('0xe1')],'XMD-CDRTYPE':_0x8c64('0x7'),'CALLERID(all)':_0xea9319['actions'][_0x58c48c]['getCaller'](),'XMD-AMD':_0x31f97c[_0x8c64('0x122')]?_0x8c64('0x144'):_0x8c64('0x166'),'XMD-DESTINATION':_0x8c64('0x115')};if(_0x31f97c['dialAMDActive']){_0x572a73[_0x8c64('0x16a')]=_0x31f97c[_0x8c64('0x16b')]||0x9c4;_0x572a73['XMD-AMDGREETING']=_0x31f97c[_0x8c64('0x16c')]||0x5dc;_0x572a73['XMD-AMDAFTERGREETINGSILENCE']=_0x31f97c[_0x8c64('0x16d')]||0x320;_0x572a73['XMD-AMDTOTALANALYSISTIME']=_0x31f97c[_0x8c64('0x16e')]||0x1388;_0x572a73[_0x8c64('0x16f')]=_0x31f97c[_0x8c64('0x170')]||0x64;_0x572a73['XMD-AMDBETWEENWORDSSILENCE']=_0x31f97c[_0x8c64('0x171')]||0x32;_0x572a73[_0x8c64('0x172')]=_0x31f97c['dialAMDMaximumNumberOfWords']||0x3;_0x572a73[_0x8c64('0x173')]=_0x31f97c[_0x8c64('0x174')]||0x100;_0x572a73[_0x8c64('0x175')]=_0x31f97c[_0x8c64('0x176')]||0x1388;}if(utils[_0x8c64('0x167')](_0x31f97c)){_0x572a73[_0x8c64('0x177')]=_0x57936f[_0x8c64('0xe3')];}else{_0x572a73[_0x8c64('0x178')]=_0x57936f[_0x8c64('0xe4')];}for(var _0x20a667 in _0x57936f[_0x8c64('0x179')]){if(typeof _0x57936f[_0x8c64('0x179')][_0x20a667]!==_0x8c64('0xad')){if(isNotNull(_0x57936f[_0x8c64('0x179')][_0x20a667])&&_0x20a667!=='id'&&_0x20a667!==_0x8c64('0x17a')&&_0x20a667!==_0x8c64('0x17b')&&_0x20a667!==_0x8c64('0x17c')){_0x572a73[util[_0x8c64('0x44')]('%s%s',_0x8c64('0x17d'),_[_0x8c64('0x17e')](_0x20a667))]=_0x57936f[_0x8c64('0x179')][_0x20a667];}}}var _0x9c6d9c=_0xea9319[_0x8c64('0x83')](_0x31f97c[_0x8c64('0x8a')])?utils[_0x8c64('0x17f')](_0x31f97c[_0x8c64('0x8a')][_0x8c64('0x180')],_0x31f97c[_0x8c64('0x181')],_0x31f97c[_0x8c64('0x182')]>0x0?utils['getCallerIdRandom'](_0x31f97c[_0x8c64('0x183')],_0x31f97c['dialRandomLastDigitCallerIdNumber']):_0x31f97c['dialOriginateCallerIdNumber']):utils[_0x8c64('0x17f')](_['isNil'](_0x31f97c['TrunkBackup'])?_0x31f97c['Trunk']['callerid']:_0x31f97c[_0x8c64('0x8b')]['callerid'],_0x31f97c[_0x8c64('0x181')],_0x31f97c[_0x8c64('0x182')]>0x0?utils[_0x8c64('0x184')](_0x31f97c[_0x8c64('0x183')],_0x31f97c[_0x8c64('0x182')]):_0x31f97c[_0x8c64('0x183')]);if(_0x9c6d9c){_0x572a73[_0x8c64('0x185')]=_0xea9319[_0x8c64('0x25')][_0x58c48c][_0x8c64('0x186')]=utils[_0x8c64('0x187')](_0x9c6d9c);_0x572a73[_0x8c64('0x188')]=_0x57936f[_0x8c64('0x189')];}_0x31f97c[_0x8c64('0x18a')]=_0x572a73;return ami[_0x8c64('0x9c')]({'actionid':_0x58c48c,'action':_0x8c64('0x161'),'channel':_0xea9319[_0x8c64('0x83')](_0x31f97c[_0x8c64('0x8a')])?util[_0x8c64('0x44')](_0x8c64('0x18b'),_0x31f97c['Trunk'][_0x8c64('0x5e')],isNotNull(_0x31f97c[_0x8c64('0x18c')])?_0x31f97c['dialPrefix'][_0x8c64('0x18d')]()||'':'',_0x31f97c[_0x8c64('0x18e')]>0x0?_0x57936f[_0x8c64('0x189')][_0x8c64('0x18f')](_0x31f97c['dialCutDigit']):_0x57936f[_0x8c64('0x189')]):util['format']('SIP/%s/%s%s',_['isNil'](_0x31f97c[_0x8c64('0x8b')])?_0x31f97c[_0x8c64('0x8a')][_0x8c64('0x5e')]:_0x31f97c[_0x8c64('0x8b')][_0x8c64('0x5e')],isNotNull(_0x31f97c['dialPrefix'])?_0x31f97c[_0x8c64('0x18c')]['trim']()||'':'',_0x31f97c['dialCutDigit']>0x0?_0x57936f['phone'][_0x8c64('0x18f')](_0x31f97c[_0x8c64('0x18e')]):_0x57936f[_0x8c64('0x189')]),'callerid':_0x9c6d9c,'Exten':'xcally-motion-dialer','Context':_0x8c64('0x190'),'Priority':'1','variable':_0x572a73,'timeout':(_0x31f97c[_0x8c64('0x191')]||0x1e)*0x3e8,'async':!![],'channelid':_0x58c48c})['then'](function(_0xb74621){return _0x4e8ae6(_0xb74621);})[_0x8c64('0xa1')](function(_0x1e08dc){_0x31f97c['outboundOriginateFailureCallsDay']+=0x1;var _0x53e314=new History(_0xea9319['actions'][_0x58c48c]);logger[_0x8c64('0x62')](util[_0x8c64('0x44')]('[originateError]:\x20%s',JSON['stringify'](_0x1e08dc)));_0x53e314['state']=0xe;_0x53e314[_0x8c64('0x6a')]='OriginateError';_0x53e314[_0x8c64('0xe5')]=moment()['format'](_0x8c64('0xc4'));_0x53e314['endtime']=_0x53e314[_0x8c64('0xe5')];hopperUtils[_0x8c64('0xe7')](_0x53e314)[_0x8c64('0xa1')](loggerCatch(_0x8c64('0x192')));_0xea9319[_0x8c64('0xcb')](_0x53e314)['catch'](loggerCatch('[originate][error]'))[_0x8c64('0x1d')](function(){delete _0xea9319[_0x8c64('0x25')][_0x58c48c];return _0x1b7b16(msgResponse('originate',_0x8c64('0x82'),'originate\x20action\x20Error'));});});});};Dialer[_0x8c64('0x1a')][_0x8c64('0x193')]=function(_0x464495,_0x4ad3fd,_0x2644e6){var _0x1aa476=new History(_0x4ad3fd);if(_0x1aa476[_0x8c64('0x126')]+_0x1aa476[_0x8c64('0x127')]+_0x1aa476[_0x8c64('0x128')]+_0x1aa476[_0x8c64('0x129')]+_0x1aa476[_0x8c64('0xd7')]+_0x1aa476[_0x8c64('0xef')]+_0x1aa476[_0x8c64('0x125')]+_0x1aa476[_0x8c64('0x131')]>=_0x2644e6[_0x8c64('0x132')]-0x1){return!![];}switch(_0x464495){case 0x3:if(_0x1aa476[_0x8c64('0x128')]>=_0x2644e6['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils[_0x8c64('0x108')]({'active':![],'countnoanswerretry':_0x1aa476[_0x8c64('0x128')]+=0x1,'scheduledat':moment()[_0x8c64('0xdf')](_0x2644e6['dialNoAnswerRetryFrequency'],'minutes')['format'](_0x8c64('0xc4')),'ContactId':_0x1aa476['ContactId'],'ListId':_0x1aa476[_0x8c64('0xe2')],'VoiceQueueId':_0x1aa476['VoiceQueueId']||undefined,'CampaignId':_0x1aa476[_0x8c64('0xe4')]||undefined})[_0x8c64('0xa1')](loggerCatch(_0x8c64('0x194')));break;case 0x5:if(_0x1aa476[_0x8c64('0x126')]>=_0x2644e6[_0x8c64('0x195')]-0x1){return!![];}hopperUtils[_0x8c64('0x108')]({'active':![],'countbusyretry':_0x1aa476[_0x8c64('0x126')]+=0x1,'scheduledat':moment()[_0x8c64('0xdf')](_0x2644e6['dialBusyRetryFrequency'],_0x8c64('0xe0'))[_0x8c64('0x44')](_0x8c64('0xc4')),'ContactId':_0x1aa476[_0x8c64('0xe1')],'ListId':_0x1aa476[_0x8c64('0xe2')],'VoiceQueueId':_0x1aa476[_0x8c64('0xe3')]||undefined,'CampaignId':_0x1aa476['CampaignId']||undefined})[_0x8c64('0xa1')](loggerCatch(_0x8c64('0x196')));break;case 0x8:if(_0x1aa476[_0x8c64('0x127')]>=_0x2644e6['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countcongestionretry':_0x1aa476[_0x8c64('0x127')]+=0x1,'scheduledat':moment()[_0x8c64('0xdf')](_0x2644e6[_0x8c64('0x197')],'minutes')['format'](_0x8c64('0xc4')),'ContactId':_0x1aa476[_0x8c64('0xe1')],'ListId':_0x1aa476['ListId'],'VoiceQueueId':_0x1aa476[_0x8c64('0xe3')]||undefined,'CampaignId':_0x1aa476[_0x8c64('0xe4')]||undefined})[_0x8c64('0xa1')](loggerCatch(_0x8c64('0x198')));break;case 0x0:if(_0x1aa476[_0x8c64('0x129')]>=_0x2644e6['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{hopperUtils[_0x8c64('0x108')]({'active':![],'countnosuchnumberretry':_0x1aa476[_0x8c64('0x129')]+=0x1,'scheduledat':moment()['add'](_0x2644e6['dialNoSuchNumberRetryFrequency'],_0x8c64('0xe0'))['format'](_0x8c64('0xc4')),'ContactId':_0x1aa476['ContactId'],'ListId':_0x1aa476[_0x8c64('0xe2')],'VoiceQueueId':_0x1aa476[_0x8c64('0xe3')]||undefined,'CampaignId':_0x1aa476[_0x8c64('0xe4')]||undefined})[_0x8c64('0xa1')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x1aa476[_0x8c64('0xd7')]>=_0x2644e6[_0x8c64('0xdd')]-0x1){return!![];}hopperUtils[_0x8c64('0x108')]({'active':![],'countdropretry':_0x1aa476[_0x8c64('0xd7')]+=0x1,'scheduledat':moment()[_0x8c64('0xdf')](_0x2644e6[_0x8c64('0xd9')],_0x8c64('0xe0'))[_0x8c64('0x44')](_0x8c64('0xc4')),'ContactId':_0x1aa476[_0x8c64('0xe1')],'ListId':_0x1aa476[_0x8c64('0xe2')],'VoiceQueueId':_0x1aa476[_0x8c64('0xe3')]||undefined,'CampaignId':_0x1aa476[_0x8c64('0xe4')]||undefined})['catch'](loggerCatch(_0x8c64('0x199')));break;case 0xb:if(_0x1aa476[_0x8c64('0xef')]>=_0x2644e6[_0x8c64('0xee')]-0x1){return!![];}hopperUtils[_0x8c64('0x108')]({'active':![],'countabandonedretry':_0x1aa476[_0x8c64('0xef')]+=0x1,'scheduledat':moment()['add'](_0x2644e6[_0x8c64('0xec')],_0x8c64('0xe0'))[_0x8c64('0x44')](_0x8c64('0xc4')),'ContactId':_0x1aa476[_0x8c64('0xe1')],'ListId':_0x1aa476[_0x8c64('0xe2')],'VoiceQueueId':_0x1aa476['VoiceQueueId']||undefined,'CampaignId':_0x1aa476['CampaignId']||undefined})[_0x8c64('0xa1')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x1aa476[_0x8c64('0x125')]>=_0x2644e6['dialMachineMaxRetry']-0x1){return!![];}hopperUtils[_0x8c64('0x108')]({'active':![],'countmachineretry':_0x1aa476['countmachineretry']+=0x1,'scheduledat':moment()['add'](_0x2644e6['dialMachineRetryFrequency'],_0x8c64('0xe0'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1aa476[_0x8c64('0xe1')],'ListId':_0x1aa476[_0x8c64('0xe2')],'VoiceQueueId':_0x1aa476[_0x8c64('0xe3')]||undefined,'CampaignId':_0x1aa476[_0x8c64('0xe4')]||undefined})[_0x8c64('0xa1')](loggerCatch(_0x8c64('0x135')));break;case 0x14:if(_0x1aa476[_0x8c64('0x131')]>=_0x2644e6['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0x8c64('0x108')]({'active':![],'countagentrejectretry':_0x1aa476[_0x8c64('0x131')]+=0x1,'scheduledat':moment()[_0x8c64('0xdf')](_0x2644e6[_0x8c64('0x19a')],'minutes')[_0x8c64('0x44')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1aa476[_0x8c64('0xe1')],'ListId':_0x1aa476[_0x8c64('0xe2')],'VoiceQueueId':_0x1aa476[_0x8c64('0xe3')]||undefined,'CampaignId':_0x1aa476[_0x8c64('0xe4')]||undefined})[_0x8c64('0xa1')](loggerCatch(_0x8c64('0x19b')));break;default:return!![];}};Dialer[_0x8c64('0x1a')]['callProgressDetecting']=function(_0x29dce5,_0x1d6695,_0x182f6f){var _0x252b00=this;var _0x1fb487=new History(_0x29dce5);var _0x4410bd=![];var _0x21e96f;var _0x426df7;return new Promise(function(_0x416caf,_0x178851){if(_[_0x8c64('0x3f')](_0x1d6695)&&typeof _0x1d6695!==_0x8c64('0x160')){return _0x178851(msgResponse(_0x8c64('0x19c'),_0x8c64('0x97'),_0x8c64('0x19d')));}if(_[_0x8c64('0x3f')](_0x182f6f)&&typeof _0x182f6f!==_0x8c64('0x160')){return _0x178851(msgResponse(_0x8c64('0x19c'),_0x8c64('0x97'),'evt\x20is\x20undefine'));}hopperUtils[_0x8c64('0xda')](_0x1fb487,_0x182f6f[_0x8c64('0xc6')],_0x1d6695)['then'](function(_0x4334b2){if(_0x4334b2[_0x8c64('0xdc')]==0x1)_0x4410bd=!![];switch(_0x182f6f[_0x8c64('0xc6')]){case'0':_0x1d6695['outboundNoSuchCallsDay']+=0x1;_0x1fb487[_0x8c64('0xd2')]=0x0;_0x1fb487[_0x8c64('0x6a')]=_0x8c64('0x19e');_0x1fb487[_0x8c64('0x129')]+=0x1;_0x1fb487[_0x8c64('0xd8')]+=0x1;ami[_0x8c64('0x11c')]('custom:agentnosuchnumber',ut[_0x8c64('0x12e')](_0x29dce5,_0x8c64('0x19f')));_0x21e96f=_0x1d6695['dialNoSuchNumberRetryFrequency'];_0x426df7=_0x1d6695[_0x8c64('0xed')];hopperUtils[_0x8c64('0xe7')](_0x1fb487)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x252b00[_0x8c64('0x193')](0x0,_0x29dce5,_0x1d6695)&&!_0x4410bd){if(_0x1fb487[_0x8c64('0x129')]>=_0x1d6695[_0x8c64('0x1a0')]){_0x252b00['createStateFinal'](_0x1fb487,_0x416caf,_0x178851,'reason\x200\x20no\x20such\x20number....');}else{_0x252b00[_0x8c64('0x12a')](_0x1fb487,_0x416caf,_0x178851,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x1d6695[_0x8c64('0x1a1')]+=0x1;_0x1fb487[_0x8c64('0xd2')]=0x3;_0x1fb487[_0x8c64('0x6a')]=_0x8c64('0x1a2');_0x1fb487[_0x8c64('0x128')]+=0x1;_0x1fb487[_0x8c64('0xd8')]+=0x1;var _0x2f1a51=ut[_0x8c64('0x1a3')](_0x29dce5,_0x1d6695);ami['emit']('custom:agentnoanswer',_0x2f1a51);_0x21e96f=_0x1d6695[_0x8c64('0x1a4')];_0x426df7=_0x1d6695[_0x8c64('0xed')];hopperUtils[_0x8c64('0xe7')](_0x1fb487)[_0x8c64('0xa1')](loggerCatch(_0x8c64('0x1a5')));if(_0x252b00['checkRetriveMax'](0x3,_0x29dce5,_0x1d6695)&&!_0x4410bd){if(_0x1fb487[_0x8c64('0x128')]>=_0x1d6695['dialNoAnswerMaxRetry']){_0x252b00[_0x8c64('0x134')](_0x1fb487,_0x416caf,_0x178851,_0x8c64('0x1a6'));}else{_0x252b00[_0x8c64('0x12a')](_0x1fb487,_0x416caf,_0x178851,_0x8c64('0x1a6'));}}break;case'5':_0x1d6695[_0x8c64('0x1a7')]+=0x1;_0x1fb487[_0x8c64('0xd2')]=0x5;_0x1fb487['statedesc']='Busy';_0x1fb487[_0x8c64('0x126')]+=0x1;_0x1fb487[_0x8c64('0xd8')]+=0x1;ami[_0x8c64('0x11c')](_0x8c64('0x1a8'),ut[_0x8c64('0x12e')](_0x29dce5,_0x8c64('0x1a9')));_0x21e96f=_0x1d6695['dialBusyRetryFrequency'];_0x426df7=_0x1d6695[_0x8c64('0xed')];hopperUtils[_0x8c64('0xe7')](_0x1fb487)[_0x8c64('0xa1')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x252b00[_0x8c64('0x193')](0x5,_0x29dce5,_0x1d6695)&&!_0x4410bd){if(_0x1fb487[_0x8c64('0x126')]>=_0x1d6695['dialBusyMaxRetry']){_0x252b00[_0x8c64('0x134')](_0x1fb487,_0x416caf,_0x178851,_0x8c64('0x1aa'));}else{_0x252b00[_0x8c64('0x12a')](_0x1fb487,_0x416caf,_0x178851,'reason\x205\x20busy');}}break;case'8':_0x1d6695[_0x8c64('0x1ab')]+=0x1;_0x1fb487[_0x8c64('0xd2')]=0x8;_0x1fb487[_0x8c64('0x6a')]=_0x8c64('0x1ac');_0x1fb487[_0x8c64('0x127')]+=0x1;_0x1fb487[_0x8c64('0xd8')]+=0x1;_0x21e96f=_0x1d6695[_0x8c64('0x197')];_0x426df7=_0x1d6695['callAdditionalPhoneAfterMin'];ami[_0x8c64('0x11c')](_0x8c64('0x1ad'),ut[_0x8c64('0x12e')](_0x29dce5,_0x8c64('0x1ae')));hopperUtils[_0x8c64('0xe7')](_0x1fb487)['catch'](loggerCatch(_0x8c64('0x1af')));if(_0x252b00['checkRetriveMax'](0x8,_0x29dce5,_0x1d6695)&&!_0x4410bd){if(_0x1fb487[_0x8c64('0x127')]>=_0x1d6695[_0x8c64('0x1b0')]){_0x252b00['createStateFinal'](_0x1fb487,_0x416caf,_0x178851,_0x8c64('0x1b1'));}else{_0x252b00[_0x8c64('0x12a')](_0x1fb487,_0x416caf,_0x178851,_0x8c64('0x1b1'));}}break;case'11':_0x1d6695[_0x8c64('0x1b2')]+=0x1;_0x1fb487['state']=0xb;_0x1fb487['statedesc']=_0x8c64('0xeb');_0x1fb487[_0x8c64('0xef')]+=0x1;_0x1fb487[_0x8c64('0xd8')]+=0x1;_0x21e96f=_0x1d6695[_0x8c64('0xec')];_0x426df7=_0x1d6695['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x1fb487)[_0x8c64('0xa1')](loggerCatch(_0x8c64('0xf2')));if(_0x252b00[_0x8c64('0x193')](0xb,_0x29dce5,_0x1d6695)&&!_0x4410bd){if(_0x1fb487[_0x8c64('0xef')]>=_0x1d6695[_0x8c64('0xee')]){_0x252b00['createStateFinal'](_0x1fb487,_0x416caf,_0x178851,_0x8c64('0x1b3'));}else{_0x252b00[_0x8c64('0x12a')](_0x1fb487,_0x416caf,_0x178851,'reason\x2011\x20abandoned');}}break;case'20':_0x1d6695[_0x8c64('0x1b4')]+=0x1;_0x1fb487[_0x8c64('0xd2')]=0x14;_0x1fb487[_0x8c64('0x6a')]=_0x8c64('0x1b5');_0x1fb487[_0x8c64('0x131')]+=0x1;_0x1fb487[_0x8c64('0xd8')]+=0x1;_0x21e96f=_0x1d6695['dialAgentRejectRetryFrequency'];_0x426df7=_0x1d6695[_0x8c64('0xed')];ami[_0x8c64('0x11c')](_0x8c64('0x1b6'),ut[_0x8c64('0x12e')](_0x29dce5,_0x8c64('0x1b7')));hopperUtils[_0x8c64('0xe7')](_0x1fb487)['catch'](loggerCatch(_0x8c64('0x1b8')));if(_0x252b00['checkRetriveMax'](0x14,_0x29dce5,_0x1d6695)&&!_0x4410bd){if(_0x1fb487[_0x8c64('0x131')]>=_0x1d6695['dialAgentRejectMaxRetry']){_0x252b00[_0x8c64('0x134')](_0x1fb487,_0x416caf,_0x178851,'reason\x2020\x20agentreject');}else{_0x252b00[_0x8c64('0x12a')](_0x1fb487,_0x416caf,_0x178851,_0x8c64('0x1b9'));}}break;default:_0x1d6695[_0x8c64('0x1ba')]+=0x1;_0x1fb487['state']=0xc;_0x1fb487['statedesc']=_0x182f6f[_0x8c64('0xc6')];_0x21e96f=_0x1d6695[_0x8c64('0x19a')];_0x426df7=_0x1d6695[_0x8c64('0xed')];hopperUtils['createHistory'](_0x1fb487)['catch'](loggerCatch(_0x8c64('0x1bb')));if(_0x252b00[_0x8c64('0x193')](_0x182f6f[_0x8c64('0xc6')],_0x29dce5,_0x1d6695)&&!_0x4410bd){if(_0x1fb487[_0x8c64('0x126')]+_0x1fb487['countcongestionretry']+_0x1fb487[_0x8c64('0x128')]+_0x1fb487[_0x8c64('0x129')]+_0x1fb487[_0x8c64('0xd7')]+_0x1fb487[_0x8c64('0xef')]+_0x1fb487[_0x8c64('0x125')]+_0x1fb487[_0x8c64('0x131')]>=_0x1d6695['dialGlobalMaxRetry']){_0x252b00[_0x8c64('0x12a')](_0x1fb487,_0x416caf,_0x178851,_0x182f6f['reason']);}else{_0x252b00[_0x8c64('0x134')](_0x1fb487,_0x416caf,_0x178851,_0x182f6f[_0x8c64('0xc6')]);}}}})[_0x8c64('0x3d')](function(){if(_0x4410bd){hopperUtils[_0x8c64('0xe9')](_0x1fb487,_0x21e96f,_0x426df7)['then'](function(){return _0x416caf(0x1);});}});});};Dialer[_0x8c64('0x1a')][_0x8c64('0x12a')]=function(_0x4c07ee,_0x1936a2,_0x5808f5,_0x4a41f9){var _0x18dbed=new Final(_0x4c07ee);_0x18dbed[_0x8c64('0xd2')]=0xf;_0x18dbed['statedesc']=_0x8c64('0x1bc');this[_0x8c64('0x134')](_0x18dbed,_0x1936a2,_0x5808f5,_0x4a41f9);};Dialer[_0x8c64('0x1a')]['createStateFinal']=function(_0x4b57d2,_0x5ce168,_0x19cb73,_0x3bc9eb){hopperUtils[_0x8c64('0xcb')](_0x4b57d2)[_0x8c64('0x3d')](function(){return _0x5ce168(msgResponse(_0x8c64('0x19c'),_0x8c64('0x10f'),_0x3bc9eb));})[_0x8c64('0xa1')](function(){return _0x19cb73(msgResponse(_0x8c64('0x1bd'),_0x8c64('0x97'),_0x8c64('0x1be')));});};Dialer['prototype'][_0x8c64('0x9')]=function(_0x4b10c7){var _0xa7a68f=_0x4b10c7[_0x8c64('0x1bf')]/0x64;var _0x3ffa6a=_0x4b10c7[_0x8c64('0xd0')]/(_0x4b10c7[_0x8c64('0xd0')]+_0x4b10c7[_0x8c64('0x117')]);var _0x50f88b=Math['round'](_0x4b10c7[_0x8c64('0x1c0')]*(_0x4b10c7[_0x8c64('0x1c1')]/0x64));var _0x5bb68f=Math['round'](_0x4b10c7[_0x8c64('0x1c0')]*(_0x4b10c7[_0x8c64('0x1c2')]/0x64));var _0x115ce3=_0x4b10c7[_0x8c64('0x140')]+_0x4b10c7['talking'];var _0x1d6136=Math[_0x8c64('0x1c3')](_0x4b10c7['erlangCalls']*_0x4b10c7['erlangAbandonmentRate']*_0x4b10c7[_0x8c64('0x1c4')]*_0x4b10c7[_0x8c64('0x1c5')]);if(_[_0x8c64('0x3f')](_0x4b10c7[_0x8c64('0x2a')])){if(!_['isUndefined'](_0x4b10c7[_0x8c64('0x29')])){_0x4b10c7[_0x8c64('0x29')]=undefined;loggerPredictive[_0x8c64('0x62')](_0x8c64('0x1c6'),_0x8c64('0x1c7'));}if(!_[_0x8c64('0x3f')](_0x4b10c7[_0x8c64('0x60')])){loggerPredictive['error']('[startMethodPredictive][StartProgressive]',_0x8c64('0x1c8'));clearInterval(_0x4b10c7[_0x8c64('0x60')]);_0x4b10c7[_0x8c64('0x60')]=undefined;}_0x4b10c7[_0x8c64('0x2a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x8c64('0x48')](_0x4b10c7['name'],'collection\x20data\x20in\x20progressive\x20at',_0x4b10c7[_0x8c64('0x2a')]);this[_0x8c64('0xb3')](_0x4b10c7,0x1);}else if(ifInterval(_0x4b10c7[_0x8c64('0x1c9')],_0x4b10c7['startProgressive'])){this['handlePower'](_0x4b10c7,0x1);loggerPredictiveCalls['info'](_0x8c64('0x1ca'),_0x4b10c7[_0x8c64('0x2a')],_0x4b10c7[_0x8c64('0x5e')]);_0x4b10c7[_0x8c64('0x57')]=0x0;_0x4b10c7[_0x8c64('0xd1')]=0x0;}else if(_0xa7a68f<_0x3ffa6a&&_0x4b10c7['dialPredictiveOptimization']==='dropRate'){clearPredictiveAttributes(_0x4b10c7);loggerPredictive[_0x8c64('0x48')](_0x8c64('0x1cb'),_0x8c64('0x1cc'),_0x3ffa6a,_0x8c64('0x2a'),_0x4b10c7[_0x8c64('0x5e')]);}else if(_0x1d6136<_0x4b10c7[_0x8c64('0xd1')]&&_0x4b10c7[_0x8c64('0x1cd')]==='dropRate'){clearPredictiveAttributes(_0x4b10c7);loggerPredictive[_0x8c64('0x48')](_0x8c64('0x1ce'),_0x8c64('0x1cf'),_0x1d6136,_0x8c64('0x1d0'),_0x4b10c7[_0x8c64('0xd1')],_0x8c64('0x2a'),_0x4b10c7[_0x8c64('0x5e')]);}else if(!ifInterval(_0x4b10c7[_0x8c64('0x1c9')],_0x4b10c7[_0x8c64('0x2a')])&&_[_0x8c64('0x3f')](_0x4b10c7[_0x8c64('0x29')])&&!_[_0x8c64('0x3f')](_0x4b10c7[_0x8c64('0x2a')])){_0x4b10c7['startPredictive']=moment()[_0x8c64('0x44')](_0x8c64('0xc4'));loggerPredictive[_0x8c64('0x48')](_0x4b10c7[_0x8c64('0x5e')],_0x8c64('0x1d1'),_0x4b10c7['startPredictive']);hopperUtils['avgHandleTime'](_0x4b10c7[_0x8c64('0x1c9')])[_0x8c64('0x3d')](this[_0x8c64('0x1d2')](_0x4b10c7))[_0x8c64('0x3d')](mergeDataErlangB(_0x4b10c7))['then'](this[_0x8c64('0x1d3')](_0x4b10c7))[_0x8c64('0xa1')](loggerCatchPredictive(_0x8c64('0x1d4'),_0x4b10c7));}else if(!ifInterval(_0x4b10c7[_0x8c64('0x1c9')],_0x4b10c7[_0x8c64('0x29')])){_0x4b10c7[_0x8c64('0xd1')]=0x0;_0x4b10c7[_0x8c64('0x29')]=moment()[_0x8c64('0x44')](_0x8c64('0xc4'));loggerPredictive[_0x8c64('0x48')](_0x4b10c7[_0x8c64('0x5e')],_0x8c64('0x1d5'),_0x4b10c7[_0x8c64('0x29')]);clearInterval(_0x4b10c7[_0x8c64('0x60')]);_0x4b10c7[_0x8c64('0x60')]=undefined;hopperUtils[_0x8c64('0x1d6')](_0x4b10c7[_0x8c64('0x1c9')])['then'](this['getDataPredictive'](_0x4b10c7))[_0x8c64('0x3d')](mergeDataErlangB(_0x4b10c7))[_0x8c64('0x3d')](this['startMethodPredictive'](_0x4b10c7))[_0x8c64('0xa1')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x4b10c7));}else if(_0x4b10c7[_0x8c64('0x1c0')]&&_0x115ce3<_0x4b10c7['predictiveIntervalAvailable']-_0x5bb68f){clearPredictiveAttributes(_0x4b10c7);loggerPredictive[_0x8c64('0x48')](_0x4b10c7[_0x8c64('0x5e')],_0x8c64('0x1d7'),_0x115ce3,_0x8c64('0x1d8'),_0x4b10c7['predictiveIntervalAvailable'],'-',_0x5bb68f,'=',_0x4b10c7[_0x8c64('0x1c0')]-_0x5bb68f,')');}else if(_0x4b10c7[_0x8c64('0x1c0')]&&_0x115ce3>_0x4b10c7[_0x8c64('0x1c0')]+_0x50f88b){clearPredictiveAttributes(_0x4b10c7);loggerPredictive[_0x8c64('0x48')](_0x4b10c7[_0x8c64('0x5e')],_0x8c64('0x1d7'),_0x115ce3,_0x8c64('0x1d9'),_0x4b10c7[_0x8c64('0x1c0')],'+',_0x50f88b,'=',_0x4b10c7[_0x8c64('0x1c0')]+_0x50f88b,')');}};Dialer['prototype'][_0x8c64('0x1d2')]=function(_0x31752f){var _0x4efd8c=this;return function(_0x4964c6){return new Promise(function(_0x280656,_0xb89f0b){_[_0x8c64('0xfd')](_0x31752f,_0x4964c6[0x0]);if(checkGetDataPredictive(_0x4964c6[0x0])){var _0x52d204=_0x31752f['predictiveIntervalAvailable']=_0x31752f['talking']+_0x31752f[_0x8c64('0x140')];var _0x28e154=_0x31752f['dialPredictiveInterval']*0x3c;var _0x57a820=_0x4964c6[0x0][_0x8c64('0x52')]+_0x4964c6[0x0][_0x8c64('0x50')];var _0x353d95=(_0x4964c6[0x0][_0x8c64('0x4c')]+_0x4964c6[0x0][_0x8c64('0x4d')]+_0x4964c6[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x4964c6[0x0][_0x8c64('0x4a')];_0x31752f[_0x8c64('0x1c4')]=_0x353d95>0x0?_0x353d95:0x1;switch(_0x31752f[_0x8c64('0x1cd')]){case _0x8c64('0x1da'):var _0x3cf63=_0x31752f[_0x8c64('0x1bf')]/0x64;return _0x4efd8c[_0x8c64('0x1db')](_0x52d204,_0x28e154,_0x57a820,_0x353d95,_0x3cf63)[_0x8c64('0x3d')](function(_0x146682){return _0x280656(_0x146682);});case _0x8c64('0x1dc'):var _0x3a9dc6=_0x31752f['dialPredictiveOptimizationPercentage']/0x64;return _0x4efd8c[_0x8c64('0x1dd')](_0x52d204,_0x28e154,_0x57a820,_0x353d95,_0x3a9dc6)[_0x8c64('0x3d')](function(_0x200042){return _0x280656(_0x200042);});default:return _0xb89f0b(msgResponse('[getDataPredictive]','Failure',_0x8c64('0x1de')));}}else{return _0xb89f0b(msgResponse(_0x8c64('0x1df'),_0x8c64('0x97'),_0x8c64('0x1e0')));}});};};Dialer[_0x8c64('0x1a')][_0x8c64('0x1e1')]=function(_0xd0329d){var _0x55f2d0=this;return function(_0xbd19e7){return new Promise(function(_0x5d7f12,_0x57df02){_[_0x8c64('0xfd')](_0xd0329d,_0xbd19e7[0x0]);if(checkGetDataPredictive(_0xbd19e7[0x0])){loggerPredictive['info'](JSON[_0x8c64('0x6f')](_0xbd19e7[0x0]));if(_0xd0329d[_0x8c64('0x1cd')]===_0x8c64('0x1da')){return _0x55f2d0[_0x8c64('0x156')](_0xd0329d['id'])[_0x8c64('0x3d')](function(_0x3f69ee){var _0x238e4e=_0xd0329d[_0x8c64('0x1e2')]-_0x3f69ee[0x0]['outboundQueuePauses'];var _0x70a27a=_0xd0329d[_0x8c64('0x1c9')]*0x3c;var _0x56e2a4=_0xbd19e7[0x0][_0x8c64('0x52')]+_0xbd19e7[0x0][_0x8c64('0x50')];var _0x1f4a2e=(_0xbd19e7[0x0]['predictiveIntervalAnsweredCalls']+_0xbd19e7[0x0][_0x8c64('0x4d')]+_0xbd19e7[0x0][_0x8c64('0x4f')])/_0xbd19e7[0x0][_0x8c64('0x4a')];var _0x1d2af2=_0xd0329d[_0x8c64('0x1bf')]/0x64;_0xd0329d[_0x8c64('0x1e3')]=_0x3f69ee[0x0][_0x8c64('0x1e4')]||0x0;_0xd0329d['predictiveIntervalHitRate']=_0x1f4a2e>0x0?_0x1f4a2e:0x1;return _0x55f2d0['abandonmentRate'](_0x238e4e,_0x70a27a,_0x56e2a4,_0x1f4a2e,_0x1d2af2);})[_0x8c64('0x3d')](function(_0x3537f5){return _0x5d7f12(_0x3537f5);})[_0x8c64('0xa1')](function(_0x415612){return _0x57df02(msgResponse('[CatchErlangB]',_0x8c64('0x97'),JSON[_0x8c64('0x6f')](_0x415612)));});}if(_0xd0329d[_0x8c64('0x1cd')]===_0x8c64('0x1dc')){return _0x55f2d0[_0x8c64('0x156')](_0xd0329d['id'])[_0x8c64('0x3d')](function(_0x425031){var _0x35fb73=_0xd0329d[_0x8c64('0x1e2')]-_0x425031[0x0][_0x8c64('0x1e4')];var _0x292c2f=_0xd0329d[_0x8c64('0x1c9')]*0x3c;var _0x3b3b02=_0xbd19e7[0x0][_0x8c64('0x52')]+_0xbd19e7[0x0][_0x8c64('0x50')];var _0x2b7836=(_0xbd19e7[0x0][_0x8c64('0x4c')]+_0xbd19e7[0x0][_0x8c64('0x4d')]+_0xbd19e7[0x0][_0x8c64('0x4f')])/_0xbd19e7[0x0][_0x8c64('0x4a')];var _0x371765=_0xd0329d[_0x8c64('0x1bf')]/0x64;_0xd0329d['predictiveIntervalPauses']=_0x425031[0x0][_0x8c64('0x1e4')]||0x0;_0xd0329d[_0x8c64('0x1c4')]=_0x2b7836>0x0?_0x2b7836:0x1;return _0x55f2d0['busyFactor'](_0x35fb73,_0x292c2f,_0x3b3b02,_0x2b7836,_0x371765);})[_0x8c64('0x3d')](function(_0x43247e){return _0x5d7f12(_0x43247e);})[_0x8c64('0xa1')](function(_0xa5414){return _0x57df02(msgResponse(_0x8c64('0x1e5'),_0x8c64('0x97'),JSON[_0x8c64('0x6f')](_0xa5414)));});}}else{return _0x57df02(msgResponse(_0x8c64('0x1df'),'Failure',_0x8c64('0x1e0')));}});};};Dialer['prototype'][_0x8c64('0x1d3')]=function(_0x26842e){var _0x52eead=this;return function(){var _0x2f7213=0x0;var _0xb43513=Math[_0x8c64('0x1c3')](_0x26842e['erlangCallToSecond']*0x3e8);if(_0xb43513>0x0){_0xb43513=_0xb43513<0x64?0x64:_0xb43513;loggerPredictive[_0x8c64('0x48')](_0x26842e[_0x8c64('0x5e')],_0x8c64('0x1e6'),_0xb43513,'milliseconds');_0x26842e[_0x8c64('0x60')]=setInterval(function(){_0x52eead['handlePredictive'](_0x26842e);loggerPredictiveCalls[_0x8c64('0x48')](_0x8c64('0x1e7'),_0x2f7213+=0x1);},_0xb43513);}else{loggerPredictive[_0x8c64('0x48')](_0x26842e['name'],_0x8c64('0x1e8'));}};};Dialer[_0x8c64('0x1a')]['checkContactBlack']=function(_0x339c2b,_0x5e9c69){var _0x49696e=this;return function(_0x39f6e4){if(_['isEmpty'](_0x39f6e4)){if(_[_0x8c64('0xfc')](_0x5e9c69[_0x8c64('0x15a')])||!_0x5e9c69[_0x8c64('0x1e9')]){if(_0x339c2b[_0x8c64('0xb1')]===_0x8c64('0x8')){_0x339c2b[_0x8c64('0x6c')]=_['isUndefined'](_0x339c2b[_0x8c64('0x6c')])?!![]:_0x339c2b['queueStatusComplete'];var _0x2cbdcd=uuid['v4']();_0x49696e[_0x8c64('0x25')][_0x2cbdcd]=new Action(_0x339c2b,_0x5e9c69,_0x2cbdcd);loggerBooked[_0x8c64('0x48')](_0x8c64('0x1ea'),_0x2cbdcd,_0x8c64('0x1eb'),JSON[_0x8c64('0x6f')](_0x339c2b[_0x8c64('0x6c')]),_0x8c64('0x1ec'),_0x339c2b[_0x8c64('0x5e')]);if(_0x339c2b[_0x8c64('0x6c')]){_0x339c2b['queueStatusComplete']=![];_0x49696e[_0x8c64('0x2b')][_0x49696e[_0x8c64('0x25')][_0x2cbdcd]['queue']]=[];ami[_0x8c64('0x9c')]({'actionid':_0x2cbdcd,'action':'queuestatus','queue':_0x339c2b[_0x8c64('0x5e')]})[_0x8c64('0xa1')](function(){_0x49696e[_0x8c64('0xc2')](_0x339c2b);hopperUtils[_0x8c64('0x108')]({'active':![],'ContactId':_0x49696e['actions'][_0x2cbdcd]['ContactId'],'ListId':_0x49696e[_0x8c64('0x25')][_0x2cbdcd]['ListId'],'VoiceQueueId':_0x49696e[_0x8c64('0x25')][_0x2cbdcd][_0x8c64('0xe3')]||undefined,'CampaignId':_0x49696e[_0x8c64('0x25')][_0x2cbdcd]['CampaignId']||undefined})[_0x8c64('0xa1')](loggerCatch(_0x8c64('0x1ed')));delete _0x49696e[_0x8c64('0x25')][_0x2cbdcd];});}else{loggerBooked['info'](_0x8c64('0x1ee'),JSON[_0x8c64('0x6f')](_0x339c2b['queueStatusComplete']),_0x8c64('0x1ec'),_0x339c2b['name']);_0x49696e['updateOriginated'](_0x339c2b);hopperUtils[_0x8c64('0x108')]({'active':![],'ContactId':_0x49696e['actions'][_0x2cbdcd][_0x8c64('0xe1')],'ListId':_0x49696e[_0x8c64('0x25')][_0x2cbdcd][_0x8c64('0xe2')],'VoiceQueueId':_0x49696e[_0x8c64('0x25')][_0x2cbdcd][_0x8c64('0xe3')]||undefined,'CampaignId':_0x49696e[_0x8c64('0x25')][_0x2cbdcd][_0x8c64('0xe4')]||undefined})[_0x8c64('0xa1')](loggerCatch(_0x8c64('0x1ed')));delete _0x49696e[_0x8c64('0x25')][_0x2cbdcd];}}else{return _0x49696e[_0x8c64('0x15f')](_0x339c2b,_0x5e9c69);}}else{if(utils['getSeconds'](undefined,_0x5e9c69['scheduledat'])<_0x339c2b[_0x8c64('0x1ef')]*0x3c){if(_0x5e9c69[_0x8c64('0x1f0')]&&!_0x5e9c69[_0x8c64('0x1f0')][_0x8c64('0x1f1')]){_0x49696e['preview'][_0x8c64('0x105')](_0x5e9c69['id'])[_0x8c64('0x1d')](function(){_0x49696e[_0x8c64('0xc2')](_0x339c2b);});}else{hopperUtils[_0x8c64('0x1f2')]({'active':![]},_0x5e9c69['id'],0x1)[_0x8c64('0x1d')](function(){_0x49696e[_0x8c64('0xc2')](_0x339c2b);});}}else{_0x339c2b[_0x8c64('0x1f3')]+=0x1;_0x49696e[_0x8c64('0xc2')](_0x339c2b);if(_0x339c2b['dialRecallInQueue']){hopperUtils[_0x8c64('0x108')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x5e9c69[_0x8c64('0xe1')],'ListId':_0x5e9c69[_0x8c64('0xe2')],'VoiceQueueId':_0x5e9c69[_0x8c64('0xe3')]||undefined,'CampaignId':_0x5e9c69[_0x8c64('0xe4')]||undefined})['catch'](loggerCatch(_0x8c64('0x1f4')));hopperUtils['createHistory'](createObjHistory(_0x339c2b,_0x5e9c69,utils[_0x8c64('0x67')][_0x8c64('0x1f5')],0x17,_0x8c64('0x1f6')))[_0x8c64('0xa1')](loggerCatch(_0x8c64('0x1f7')));}else{_0x49696e['saveInDb'](createObjHistory(_0x339c2b,_0x5e9c69,utils['CAMPAIGN_STATUS'][_0x8c64('0x1f8')],0x16,'RecallFailedTimeout'),_0x8c64('0x1f9'),_0x8c64('0x1fa'));}}}}else{_0x339c2b['outboundBlacklistCallsDay']+=0x1;_0x49696e[_0x8c64('0x11f')](createObjHistory(_0x339c2b,_0x5e9c69,utils[_0x8c64('0x67')][_0x8c64('0x1fb')],0xd,_0x8c64('0x1fc')),'[Originate][historyBlacklist]',_0x8c64('0x1fd'));throw'inBlackList';}};};Dialer[_0x8c64('0x1a')][_0x8c64('0x15e')]=function(_0x2211bb){var _0x8744e0=this;var _0x54ecdd=_0x2211bb[_0x8c64('0x1fe')]-_0x2211bb['originated']-_0x2211bb[_0x8c64('0x1ff')];emitCampaignSummary(_0x2211bb);if(_0x54ecdd>0x0){if(_0x54ecdd>this[_0x8c64('0x23')]){_0x54ecdd=this[_0x8c64('0x23')];}_0x2211bb[_0x8c64('0x1ff')]+=_0x54ecdd;hopperUtils[_0x8c64('0x200')](_0x2211bb['id'],_0x54ecdd,_0x2211bb[_0x8c64('0x201')],_0x2211bb)[_0x8c64('0x3d')](function(_0x1ae46a){_0x2211bb[_0x8c64('0x1ff')]-=_0x54ecdd;_0x2211bb['temp']=_0x2211bb[_0x8c64('0x1ff')]>0x0?_0x2211bb['temp']:0x0;if(!utils[_0x8c64('0x202')](_0x1ae46a)){_0x2211bb[_0x8c64('0x66')]=utils[_0x8c64('0x67')][_0x8c64('0x69')];logger[_0x8c64('0x48')](_0x8c64('0x203')+_0x2211bb[_0x8c64('0x5e')]);}else{_0x2211bb[_0x8c64('0x7c')]+=_0x1ae46a[_0x8c64('0x9a')];_0x2211bb['message']=utils[_0x8c64('0x67')][_0x8c64('0x204')];for(var _0x154b87=0x0;_0x154b87<_0x1ae46a['length'];_0x154b87+=0x1){_0x2211bb[_0x8c64('0x205')]+=0x1;if(_[_0x8c64('0xfc')](_0x1ae46a[_0x154b87])||_['isNil'](_0x1ae46a[_0x154b87][_0x8c64('0x179')])||_[_0x8c64('0xfc')](_0x1ae46a[_0x154b87][_0x8c64('0x189')])){_0x8744e0[_0x8c64('0x158')]('[actionOriginate]\x20',_0x2211bb,_0x1ae46a[_0x154b87]);}else{hopperUtils['checkIsBlackListIvr'](_[_0x8c64('0x70')](_0x1ae46a[_0x154b87],[_0x8c64('0xe4'),'phone']))[_0x8c64('0x3d')](_0x8744e0[_0x8c64('0x206')](_0x2211bb,_0x1ae46a[_0x154b87]))['catch'](_0x8744e0[_0x8c64('0x157')]('[actionOriginateIvr]\x20',_0x2211bb));}}}})[_0x8c64('0xa1')](loggerGetContactDialer('[getContactCampaign2]',_0x2211bb,_0x54ecdd));}};Dialer[_0x8c64('0x1a')][_0x8c64('0xb3')]=function(_0x3d6042,_0x6584ce){var _0x4d05b3=this;var _0x535f7d=[];if(_0x6584ce<0x1||_0x3d6042[_0x8c64('0xb1')]===_0x8c64('0x8')){_0x6584ce=0x1;}var _0x4a121c=Math[_0x8c64('0x1c3')](_0x3d6042[_0x8c64('0x140')]*_0x6584ce)-_0x3d6042[_0x8c64('0x7c')]-_0x3d6042[_0x8c64('0x1ff')];if(_0x3d6042[_0x8c64('0x207')]>0x0){var _0x1a715f=_0x3d6042[_0x8c64('0x207')]-_0x3d6042[_0x8c64('0x7c')]-_0x3d6042['talking']-_0x3d6042[_0x8c64('0x1ff')]-_0x3d6042[_0x8c64('0x143')];if(_0x4a121c>_0x1a715f){_0x4a121c=_0x1a715f;}}if(_0x4a121c>0x0){if(_0x3d6042[_0x8c64('0xb1')]===_0x8c64('0x8')){_0x4a121c=0x1;}if(_0x4a121c>this[_0x8c64('0x23')]){_0x4a121c=this[_0x8c64('0x23')];}_0x3d6042[_0x8c64('0x1ff')]+=_0x4a121c;for(var _0x576998 in this[_0x8c64('0x21')]){if(typeof this[_0x8c64('0x21')][_0x576998]!=='undefined'){if(this[_0x8c64('0x21')][_0x576998][_0x8c64('0xd2')]===_0x8c64('0x208')&&this['agents'][_0x576998]['status']==='reachable'){_0x535f7d[_0x8c64('0x9b')](this[_0x8c64('0x21')][_0x576998]['id']);}}}hopperUtils[_0x8c64('0x209')](_0x3d6042,_0x535f7d,_0x4a121c)[_0x8c64('0x3d')](function(_0x27ddca){_0x3d6042['temp']-=_0x4a121c;_0x3d6042['temp']=_0x3d6042[_0x8c64('0x1ff')]>0x0?_0x3d6042['temp']:0x0;if(!utils[_0x8c64('0x202')](_0x27ddca)){hopperUtils[_0x8c64('0x20a')](_0x3d6042)['then'](sendMessageReschedule(_0x3d6042))[_0x8c64('0xa1')](loggerCatch('[countReScheduled]\x20'));}else{_0x3d6042[_0x8c64('0x7c')]+=_0x27ddca[_0x8c64('0x9a')];_0x3d6042[_0x8c64('0x66')]=_0x3d6042['dialMethod']==='booked'?utils[_0x8c64('0x67')][_0x8c64('0x144')]:utils[_0x8c64('0x67')][_0x8c64('0x204')];for(var _0x322b24=0x0;_0x322b24<_0x27ddca['length'];_0x322b24+=0x1){if(_['isNil'](_0x27ddca[_0x322b24])||_[_0x8c64('0xfc')](_0x27ddca[_0x322b24][_0x8c64('0x179')])||_[_0x8c64('0xfc')](_0x27ddca[_0x322b24]['phone'])){_0x4d05b3[_0x8c64('0x158')](_0x8c64('0x20b'),_0x3d6042,_0x27ddca[_0x322b24]);}else{hopperUtils['checkIsBlackList'](_[_0x8c64('0x70')](_0x27ddca[_0x322b24],[_0x8c64('0xe3'),_0x8c64('0x189')]))[_0x8c64('0x3d')](_0x4d05b3['checkContactBlack'](_0x3d6042,_0x27ddca[_0x322b24]))[_0x8c64('0xa1')](_0x4d05b3[_0x8c64('0x157')](_0x8c64('0x20b'),_0x3d6042));}}}})[_0x8c64('0xa1')](loggerGetContactDialer('[getContactDialer2]',_0x3d6042,_0x4a121c));}};Dialer[_0x8c64('0x1a')][_0x8c64('0x60')]=function(_0x1747f7){if(_0x1747f7[_0x8c64('0x207')]>0x0){var _0x4ace64=_0x1747f7[_0x8c64('0x207')]-_0x1747f7['originated']-_0x1747f7[_0x8c64('0x142')];if(_0x4ace64>0x0){this['tryOriginatePredictive'](_0x1747f7);}else{loggerPredictiveCalls['info']('[handlePredictive][limitChannel]');}}else{this['tryOriginatePredictive'](_0x1747f7);}};Dialer[_0x8c64('0x1a')]['tryOriginatePredictive']=function(_0x5564fa){var _0x3bd91f=this;var _0x48453a=[];_0x5564fa[_0x8c64('0x7c')]+=0x1;for(var _0x4f52d8 in this['agents']){if(typeof this[_0x8c64('0x21')][_0x4f52d8]!==_0x8c64('0xad')){if(this['agents'][_0x4f52d8][_0x8c64('0xd2')]===_0x8c64('0x208')&&this[_0x8c64('0x21')][_0x4f52d8]['status']===_0x8c64('0x87')){_0x48453a[_0x8c64('0x9b')](this[_0x8c64('0x21')][_0x4f52d8]['id']);}}}return this[_0x8c64('0x209')](_0x5564fa['id'],_0x48453a,0x1,_0x5564fa['dialOrderByScheduledAt'],_0x5564fa)[_0x8c64('0x3d')](function(_0x2e2d26){if(!utils[_0x8c64('0x202')](_0x2e2d26)){utils[_0x8c64('0x64')](_0x5564fa,0x1,0x0);return hopperUtils[_0x8c64('0x20a')](_0x5564fa)[_0x8c64('0x3d')](sendMessageReschedule(_0x5564fa))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x5564fa[_0x8c64('0x66')]=utils['CAMPAIGN_STATUS']['RUNNING'];if(_['isNil'](_0x2e2d26[0x0])||_['isNil'](_0x2e2d26[0x0][_0x8c64('0x179')])||_['isNil'](_0x2e2d26[0x0][_0x8c64('0x189')])){_0x3bd91f[_0x8c64('0x158')](_0x8c64('0x20b'),_0x5564fa,_0x2e2d26[0x0]);}else{return hopperUtils['checkIsBlackList'](_[_0x8c64('0x70')](_0x2e2d26[0x0],['VoiceQueueId',_0x8c64('0x189')]))[_0x8c64('0x3d')](_0x3bd91f[_0x8c64('0x206')](_0x5564fa,_0x2e2d26[0x0]))[_0x8c64('0xa1')](_0x3bd91f[_0x8c64('0x157')](_0x8c64('0x20c'),_0x5564fa));}}})[_0x8c64('0xa1')](loggerGetContactDialer('[getContactDialerPredictive]',_0x5564fa,0x1));};Dialer['prototype'][_0x8c64('0x1db')]=function(_0x4bd55e,_0x3dc5a9,_0x483b51,_0x1b99ee,_0x2dd838,_0x309303){loggerPredictive['info'](_0x8c64('0x20d'));loggerPredictive['info'](_0x8c64('0x20e'),_0x4bd55e);loggerPredictive[_0x8c64('0x48')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3dc5a9);loggerPredictive[_0x8c64('0x48')](_0x8c64('0x20f'),_0x483b51);loggerPredictive[_0x8c64('0x48')](_0x8c64('0x210'),_0x1b99ee);loggerPredictive['info'](_0x8c64('0x211'),_0x2dd838);loggerPredictive[_0x8c64('0x48')]('---------------------------');return new Promise(function(_0x30ea3e,_0x49309e){if(_0x4bd55e<=0x0||isNaN(_0x4bd55e)){return _0x49309e(msgResponse(_0x8c64('0x212'),_0x8c64('0x82'),_0x8c64('0x213')+_0x4bd55e));}if(_0x483b51<=0x0||isNaN(_0x483b51)){return _0x49309e(msgResponse(_0x8c64('0x212'),'Error',_0x8c64('0x214')+_0x483b51));}if(_0x1b99ee<=0x0||isNaN(_0x1b99ee)){return _0x49309e(msgResponse(_0x8c64('0x212'),'Error',_0x8c64('0x215')+_0x1b99ee));}if(_0x3dc5a9<=0x0||isNaN(_0x3dc5a9)){return _0x49309e(msgResponse(_0x8c64('0x212'),'Error','interval\x20=\x20'+_0x3dc5a9));}if(_0x2dd838<=0x0||isNaN(_0x2dd838)){return _0x49309e(msgResponse(_0x8c64('0x212'),'Error','Amax\x20=\x20'+_0x2dd838));}_0x309303=_0x309303||0x0;var _0x42d38a=0x1/_0x483b51;var _0x17f49d=0x0;var _0x4a362e=0x0;var _0x5e7bc3=0x0;var _0x1afdeb=0x0;for(var _0x49ba3b=0x0;_0x5e7bc3<_0x2dd838;_0x49ba3b+=0x1){_0x4a362e=_0x49ba3b/_0x3dc5a9;_0x17f49d=(_0x1b99ee*_0x4a362e+_0x309303)/_0x42d38a;_0x5e7bc3=utils[_0x8c64('0x216')](_0x17f49d,_0x4bd55e);_0x1afdeb=_0x17f49d/_0x4bd55e*(0x1-utils[_0x8c64('0x216')](_0x17f49d,_0x4bd55e));}return _0x30ea3e({'erlangCalls':_0x49ba3b,'erlangCallToSecond':_0x3dc5a9/_0x49ba3b,'erlangAbandonmentRate':_0x5e7bc3,'erlangBusyFactor':_0x1afdeb});});};Dialer[_0x8c64('0x1a')][_0x8c64('0x1dd')]=function(_0x305039,_0x1b3f32,_0x2db6f1,_0x3cb536,_0x915332,_0x1a8fa8){loggerPredictive['info'](_0x8c64('0x217'));loggerPredictive[_0x8c64('0x48')](_0x8c64('0x20e'),_0x305039);loggerPredictive[_0x8c64('0x48')](_0x8c64('0x218'),_0x1b3f32);loggerPredictive[_0x8c64('0x48')]('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',_0x2db6f1);loggerPredictive[_0x8c64('0x48')](_0x8c64('0x210'),_0x3cb536);loggerPredictive[_0x8c64('0x48')](_0x8c64('0x219'),_0x915332);loggerPredictive['info'](_0x8c64('0x53'));return new Promise(function(_0x2e2401,_0x301022){if(_0x305039<=0x0||isNaN(_0x305039)){return _0x301022(msgResponse('[busyFactor]','Error','m\x20=\x20'+_0x305039));}if(_0x2db6f1<=0x0||isNaN(_0x2db6f1)){return _0x301022(msgResponse('[busyFactor]',_0x8c64('0x82'),_0x8c64('0x214')+_0x2db6f1));}if(_0x3cb536<=0x0||isNaN(_0x3cb536)){return _0x301022(msgResponse(_0x8c64('0x21a'),_0x8c64('0x82'),'p\x20=\x20'+_0x3cb536));}if(_0x1b3f32<=0x0||isNaN(_0x1b3f32)){return _0x301022(msgResponse('[busyFactor]','Error','interval\x20=\x20'+_0x1b3f32));}if(_0x915332<=0x0||isNaN(_0x915332)){return _0x301022(msgResponse(_0x8c64('0x21a'),_0x8c64('0x82'),_0x8c64('0x21b')+_0x915332));}_0x1a8fa8=_0x1a8fa8||0x0;var _0x2b2247=0x1/_0x2db6f1;var _0x354f57=0x0;var _0xea2e81=0x0;var _0x5da1c4=0x0;var _0x4cdc5b=0x0;for(var _0x23fc29=0x0;_0x4cdc5b<_0x915332;_0x23fc29+=0x1){_0xea2e81=_0x23fc29/_0x1b3f32;_0x354f57=(_0x3cb536*_0xea2e81+_0x1a8fa8)/_0x2b2247;_0x5da1c4=utils[_0x8c64('0x216')](_0x354f57,_0x305039);_0x4cdc5b=_0x354f57/_0x305039*(0x1-utils[_0x8c64('0x216')](_0x354f57,_0x305039));}return _0x2e2401({'erlangCalls':_0x23fc29,'erlangCallToSecond':_0x1b3f32/_0x23fc29,'erlangAbandonmentRate':_0x5da1c4,'erlangBusyFactor':_0x4cdc5b});});};module['exports']=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index 78b6849..7f05fad 100644 --- a/server/services/ami/dialer/models/action.js +++ b/server/services/ami/dialer/models/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb4c2=['scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','substring','dialCutDigit','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','Contact','phone','firstName','lastName','number','queue','active','type','dialQueueTimeout'];(function(_0x4cc61f,_0x212f64){var _0x42571a=function(_0x5aec6f){while(--_0x5aec6f){_0x4cc61f['push'](_0x4cc61f['shift']());}};_0x42571a(++_0x212f64);}(_0xb4c2,0xa8));var _0x2b4c=function(_0x1964f6,_0x4914c8){_0x1964f6=_0x1964f6-0x0;var _0x582779=_0xb4c2[_0x1964f6];return _0x582779;};'use strict';var util=require(_0x2b4c('0x0'));var _=require(_0x2b4c('0x1'));var moment=require(_0x2b4c('0x2'));function checkNameSurname(_0x12cc2f,_0x39e4e8,_0x483d95){var _0x4826eb='';if(!_[_0x2b4c('0x3')](_0x39e4e8)&&_0x2b4c('0x4')===typeof _0x39e4e8){_0x4826eb+=_0x39e4e8;}if(!_[_0x2b4c('0x3')](_0x483d95)&&_0x2b4c('0x4')===typeof _0x483d95){_0x4826eb+='\x20'+_0x483d95;}if(_0x4826eb!==''){return _0x4826eb;}return _0x12cc2f;}function Action(_0x103c57,_0x225d71,_0x11be1c){this[_0x2b4c('0x5')]=_0x103c57;this[_0x2b4c('0x6')]=_0x11be1c||undefined;this['name']=checkNameSurname(_0x225d71[_0x2b4c('0x7')][_0x2b4c('0x8')],_0x225d71['Contact'][_0x2b4c('0x9')],_0x225d71[_0x2b4c('0x7')][_0x2b4c('0xa')]);this[_0x2b4c('0xb')]=_0x225d71['phone'];this[_0x2b4c('0xc')]=_0x103c57['name'];this[_0x2b4c('0xd')]=_0x225d71[_0x2b4c('0xd')]||![];this[_0x2b4c('0xe')]=_0x103c57[_0x2b4c('0xe')];this[_0x2b4c('0xf')]=_0x103c57['dialQueueTimeout']||0x3;this[_0x2b4c('0x10')]=_0x225d71[_0x2b4c('0x10')];this[_0x2b4c('0x11')]=_0x225d71[_0x2b4c('0x11')];this[_0x2b4c('0x12')]=_0x225d71[_0x2b4c('0x12')];this[_0x2b4c('0x13')]=_0x225d71[_0x2b4c('0x13')];this[_0x2b4c('0x14')]=_0x225d71[_0x2b4c('0x14')];this[_0x2b4c('0x15')]=_0x225d71[_0x2b4c('0x15')];this[_0x2b4c('0x16')]=_0x225d71[_0x2b4c('0x16')];this['countmachineretry']=_0x225d71[_0x2b4c('0x17')];this['countagentrejectretry']=_0x225d71[_0x2b4c('0x18')];this[_0x2b4c('0x19')]=_0x225d71[_0x2b4c('0x19')];this[_0x2b4c('0x1a')]=_0x225d71[_0x2b4c('0x1a')];this['UserId']=_0x225d71[_0x2b4c('0x1b')];this[_0x2b4c('0x1c')]=_0x225d71['VoiceQueueId'];this[_0x2b4c('0x1d')]=_0x225d71[_0x2b4c('0x1d')];this[_0x2b4c('0x1e')]=_0x225d71['id'];this['ContactFirstName']=_0x225d71[_0x2b4c('0x7')][_0x2b4c('0x9')]||'';this[_0x2b4c('0x1f')]=moment()[_0x2b4c('0x20')](_0x2b4c('0x21'));this[_0x2b4c('0x22')]=_0x225d71[_0x2b4c('0x22')];this['callbackuniqueid']=_0x225d71[_0x2b4c('0x23')];this[_0x2b4c('0x24')]=_0x225d71[_0x2b4c('0x24')];this[_0x2b4c('0x25')]=_0x225d71[_0x2b4c('0x25')];this[_0x2b4c('0x26')]='';this[_0x2b4c('0x27')]='';}Action[_0x2b4c('0x28')][_0x2b4c('0x29')]=function(){return util[_0x2b4c('0x20')](_0x2b4c('0x2a'),this['name'],this[_0x2b4c('0x5')]['dialCutDigit']>0x0?this[_0x2b4c('0xb')][_0x2b4c('0x2b')](this[_0x2b4c('0x5')][_0x2b4c('0x2c')]):this[_0x2b4c('0xb')]);};Action[_0x2b4c('0x28')]['getQueue']=function(){return this['queue'];};module[_0x2b4c('0x2d')]=Action; \ No newline at end of file +var _0x1940=['getCaller','\x22%s\x22\x20<%s>','dialCutDigit','getQueue','exports','util','lodash','isNil','string','voiceQueue','name','Contact','phone','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','VoiceQueueId','CampaignId','idHopper','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','prototype'];(function(_0x309f95,_0x1f5165){var _0x3b2c3a=function(_0x43064e){while(--_0x43064e){_0x309f95['push'](_0x309f95['shift']());}};_0x3b2c3a(++_0x1f5165);}(_0x1940,0x132));var _0x0194=function(_0x3c6b7d,_0x5f0d90){_0x3c6b7d=_0x3c6b7d-0x0;var _0x1d3ed2=_0x1940[_0x3c6b7d];return _0x1d3ed2;};'use strict';var util=require(_0x0194('0x0'));var _=require(_0x0194('0x1'));var moment=require('moment');function checkNameSurname(_0x588409,_0x11b0b1,_0x497c9f){var _0x53f419='';if(!_[_0x0194('0x2')](_0x11b0b1)&&_0x0194('0x3')===typeof _0x11b0b1){_0x53f419+=_0x11b0b1;}if(!_['isNil'](_0x497c9f)&&_0x0194('0x3')===typeof _0x497c9f){_0x53f419+='\x20'+_0x497c9f;}if(_0x53f419!==''){return _0x53f419;}return _0x588409;}function Action(_0xafd920,_0x339759,_0x1b691d){this[_0x0194('0x4')]=_0xafd920;this['uniqueid']=_0x1b691d||undefined;this[_0x0194('0x5')]=checkNameSurname(_0x339759[_0x0194('0x6')][_0x0194('0x7')],_0x339759[_0x0194('0x6')][_0x0194('0x8')],_0x339759[_0x0194('0x6')][_0x0194('0x9')]);this[_0x0194('0xa')]=_0x339759[_0x0194('0x7')];this[_0x0194('0xb')]=_0xafd920[_0x0194('0x5')];this['active']=_0x339759[_0x0194('0xc')]||![];this[_0x0194('0xd')]=_0xafd920[_0x0194('0xd')];this[_0x0194('0xe')]=_0xafd920[_0x0194('0xe')]||0x3;this[_0x0194('0xf')]=_0x339759[_0x0194('0xf')];this['countbusyretry']=_0x339759[_0x0194('0x10')];this[_0x0194('0x11')]=_0x339759[_0x0194('0x11')];this[_0x0194('0x12')]=_0x339759[_0x0194('0x12')];this['countnosuchnumberretry']=_0x339759[_0x0194('0x13')];this[_0x0194('0x14')]=_0x339759['countdropretry'];this[_0x0194('0x15')]=_0x339759['countabandonedretry'];this['countmachineretry']=_0x339759[_0x0194('0x16')];this['countagentrejectretry']=_0x339759[_0x0194('0x17')];this[_0x0194('0x18')]=_0x339759['ContactId'];this[_0x0194('0x19')]=_0x339759[_0x0194('0x19')];this['UserId']=_0x339759['UserId'];this[_0x0194('0x1a')]=_0x339759[_0x0194('0x1a')];this['CampaignId']=_0x339759[_0x0194('0x1b')];this[_0x0194('0x1c')]=_0x339759['id'];this['ContactFirstName']=_0x339759[_0x0194('0x6')][_0x0194('0x8')]||'';this[_0x0194('0x1d')]=moment()[_0x0194('0x1e')](_0x0194('0x1f'));this['callback']=_0x339759[_0x0194('0x20')];this[_0x0194('0x21')]=_0x339759[_0x0194('0x21')];this[_0x0194('0x22')]=_0x339759[_0x0194('0x22')];this['recallme']=_0x339759[_0x0194('0x23')];this['originatecalleridnum']='';this[_0x0194('0x24')]='';}Action[_0x0194('0x25')][_0x0194('0x26')]=function(){return util[_0x0194('0x1e')](_0x0194('0x27'),this[_0x0194('0x5')],this[_0x0194('0x4')][_0x0194('0x28')]>0x0?this[_0x0194('0xa')]['substring'](this[_0x0194('0x4')][_0x0194('0x28')]):this[_0x0194('0xa')]);};Action[_0x0194('0x25')][_0x0194('0x29')]=function(){return this[_0x0194('0xb')];};module[_0x0194('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index f4a8b74..555e946 100644 --- a/server/services/ami/dialer/models/agentComplete.js +++ b/server/services/ami/dialer/models/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x460b=['callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','statedesc','Answer','scheduledat','type','queue','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','membername'];(function(_0x513b5d,_0x56dd90){var _0x3668a8=function(_0x4e1593){while(--_0x4e1593){_0x513b5d['push'](_0x513b5d['shift']());}};_0x3668a8(++_0x56dd90);}(_0x460b,0x17d));var _0xb460=function(_0xbd201,_0x2d26d0){_0xbd201=_0xbd201-0x0;var _0x103c69=_0x460b[_0xbd201];return _0x103c69;};'use strict';var moment=require(_0xb460('0x0'));var utils=require(_0xb460('0x1'));function AgentComplete(_0x209c83,_0x1d09f0){this['state']=0x4;this[_0xb460('0x2')]=_0xb460('0x3');this[_0xb460('0x4')]=_0x209c83[_0xb460('0x4')];this[_0xb460('0x5')]=_0x209c83['type'];this['campaigntype']=_0x209c83[_0xb460('0x5')]==='outbound'?_0xb460('0x6'):_0x209c83[_0xb460('0x5')];this['countbusyretry']=_0x209c83['countbusyretry'];this[_0xb460('0x7')]=_0x209c83['countcongestionretry'];this['countnoanswerretry']=_0x209c83[_0xb460('0x8')];this['countglobal']=_0x209c83['countbusyretry']+_0x209c83[_0xb460('0x7')]+_0x209c83[_0xb460('0x8')]+_0x209c83[_0xb460('0x9')]+_0x209c83['countdropretry']+_0x209c83[_0xb460('0xa')]+_0x209c83[_0xb460('0xb')]+_0x209c83[_0xb460('0xc')];this[_0xb460('0x9')]=_0x209c83[_0xb460('0x9')];this['countdropretry']=_0x209c83[_0xb460('0xd')];this[_0xb460('0xa')]=_0x209c83[_0xb460('0xa')];this[_0xb460('0xb')]=_0x209c83[_0xb460('0xb')];this['countagentrejectretry']=_0x209c83[_0xb460('0xc')];this[_0xb460('0xe')]=_0x1d09f0[_0xb460('0xe')];this['calleridname']=_0x209c83[_0xb460('0xf')];this[_0xb460('0x10')]=_0x209c83[_0xb460('0x11')];this[_0xb460('0x12')]=_0x209c83[_0xb460('0x12')];this[_0xb460('0x13')]=_0x209c83[_0xb460('0x13')];this['answertime']=_0x209c83[_0xb460('0x14')];this[_0xb460('0x15')]=moment()[_0xb460('0x16')](_0xb460('0x17'));this[_0xb460('0x18')]=utils[_0xb460('0x19')](_0x209c83['responsetime'],_0x209c83[_0xb460('0x12')]);this[_0xb460('0x1a')]=utils[_0xb460('0x19')](_0x209c83[_0xb460('0x14')],_0x209c83[_0xb460('0x13')]);this[_0xb460('0x1b')]=utils[_0xb460('0x19')](this['endtime'],_0x209c83[_0xb460('0x14')]);this[_0xb460('0x6')]=_0x1d09f0[_0xb460('0x6')];this['membername']=_0x1d09f0[_0xb460('0x1c')];this['reason']=_0x1d09f0['reason'];this[_0xb460('0x1d')]=_0x209c83[_0xb460('0x1d')];this[_0xb460('0x1e')]=_0x209c83[_0xb460('0x1e')];this[_0xb460('0x1f')]=_0x209c83['callbackat'];this[_0xb460('0x20')]=_0x209c83[_0xb460('0x20')];this['ContactId']=_0x209c83[_0xb460('0x21')];this['ListId']=_0x209c83['ListId'];this[_0xb460('0x22')]=_0x209c83[_0xb460('0x22')];this[_0xb460('0x23')]=_0x209c83[_0xb460('0x23')];this[_0xb460('0x24')]=_0x209c83[_0xb460('0x24')];this[_0xb460('0x25')]=_0x209c83[_0xb460('0x25')]||'';this['originatecalleridname']=_0x209c83[_0xb460('0x26')]||'';this[_0xb460('0x27')]=_0x209c83[_0xb460('0x27')];}module[_0xb460('0x28')]=AgentComplete; \ No newline at end of file +var _0x6ff1=['ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','talktime','getSeconds','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x5c16a4,_0x834eff){var _0x291451=function(_0x41f650){while(--_0x41f650){_0x5c16a4['push'](_0x5c16a4['shift']());}};_0x291451(++_0x834eff);}(_0x6ff1,0x1eb));var _0x16ff=function(_0x5a319a,_0x27cd74){_0x5a319a=_0x5a319a-0x0;var _0x59f6d8=_0x6ff1[_0x5a319a];return _0x59f6d8;};'use strict';var moment=require(_0x16ff('0x0'));var utils=require(_0x16ff('0x1'));function AgentComplete(_0x159828,_0x3e03b6){this[_0x16ff('0x2')]=0x4;this[_0x16ff('0x3')]=_0x16ff('0x4');this[_0x16ff('0x5')]=_0x159828[_0x16ff('0x5')];this['type']=_0x159828[_0x16ff('0x6')];this[_0x16ff('0x7')]=_0x159828[_0x16ff('0x6')]==='outbound'?'queue':_0x159828[_0x16ff('0x6')];this[_0x16ff('0x8')]=_0x159828['countbusyretry'];this[_0x16ff('0x9')]=_0x159828['countcongestionretry'];this[_0x16ff('0xa')]=_0x159828[_0x16ff('0xa')];this['countglobal']=_0x159828[_0x16ff('0x8')]+_0x159828['countcongestionretry']+_0x159828[_0x16ff('0xa')]+_0x159828[_0x16ff('0xb')]+_0x159828['countdropretry']+_0x159828[_0x16ff('0xc')]+_0x159828['countmachineretry']+_0x159828[_0x16ff('0xd')];this[_0x16ff('0xb')]=_0x159828[_0x16ff('0xb')];this[_0x16ff('0xe')]=_0x159828['countdropretry'];this[_0x16ff('0xc')]=_0x159828[_0x16ff('0xc')];this[_0x16ff('0xf')]=_0x159828[_0x16ff('0xf')];this['countagentrejectretry']=_0x159828[_0x16ff('0xd')];this['uniqueid']=_0x3e03b6[_0x16ff('0x10')];this[_0x16ff('0x11')]=_0x159828[_0x16ff('0x12')];this[_0x16ff('0x13')]=_0x159828[_0x16ff('0x14')];this[_0x16ff('0x15')]=_0x159828[_0x16ff('0x15')];this['responsetime']=_0x159828[_0x16ff('0x16')];this[_0x16ff('0x17')]=_0x159828[_0x16ff('0x17')];this[_0x16ff('0x18')]=moment()[_0x16ff('0x19')](_0x16ff('0x1a'));this['ringtime']=utils['getSeconds'](_0x159828[_0x16ff('0x16')],_0x159828[_0x16ff('0x15')]);this['holdtime']=utils['getSeconds'](_0x159828[_0x16ff('0x17')],_0x159828[_0x16ff('0x16')]);this[_0x16ff('0x1b')]=utils[_0x16ff('0x1c')](this[_0x16ff('0x18')],_0x159828[_0x16ff('0x17')]);this[_0x16ff('0x1d')]=_0x3e03b6[_0x16ff('0x1d')];this[_0x16ff('0x1e')]=_0x3e03b6['membername'];this[_0x16ff('0x1f')]=_0x3e03b6['reason'];this[_0x16ff('0x20')]=_0x159828[_0x16ff('0x20')];this[_0x16ff('0x21')]=_0x159828['callbackuniqueid'];this[_0x16ff('0x22')]=_0x159828[_0x16ff('0x22')];this[_0x16ff('0x23')]=_0x159828[_0x16ff('0x23')];this[_0x16ff('0x24')]=_0x159828[_0x16ff('0x24')];this[_0x16ff('0x25')]=_0x159828[_0x16ff('0x25')];this[_0x16ff('0x26')]=_0x159828[_0x16ff('0x26')];this[_0x16ff('0x27')]=_0x159828[_0x16ff('0x27')];this[_0x16ff('0x28')]=_0x159828[_0x16ff('0x28')];this[_0x16ff('0x29')]=_0x159828[_0x16ff('0x29')]||'';this['originatecalleridname']=_0x159828[_0x16ff('0x2a')]||'';this['agiafterat']=_0x159828[_0x16ff('0x2b')];}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index eb598c2..45eb186 100644 --- a/server/services/ami/dialer/models/final.js +++ b/server/services/ami/dialer/models/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4d34=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback'];(function(_0x25247c,_0x326e82){var _0x3cb325=function(_0x1a42fc){while(--_0x1a42fc){_0x25247c['push'](_0x25247c['shift']());}};_0x3cb325(++_0x326e82);}(_0x4d34,0x1ec));var _0x44d3=function(_0x42d67c,_0x4a2ef5){_0x42d67c=_0x42d67c-0x0;var _0x5e9a81=_0x4d34[_0x42d67c];return _0x5e9a81;};'use strict';function Final(_0xa36784){this[_0x44d3('0x0')]=_0xa36784[_0x44d3('0x0')];this['scheduledat']=_0xa36784['scheduledat'];this['type']=_0xa36784[_0x44d3('0x1')];this[_0x44d3('0x2')]=_0xa36784[_0x44d3('0x1')]==='outbound'?'queue':_0xa36784[_0x44d3('0x1')];this[_0x44d3('0x3')]=_0xa36784[_0x44d3('0x3')];this[_0x44d3('0x4')]=_0xa36784['countcongestionretry'];this[_0x44d3('0x5')]=_0xa36784[_0x44d3('0x5')];this[_0x44d3('0x6')]=_0xa36784[_0x44d3('0x3')]+_0xa36784[_0x44d3('0x4')]+_0xa36784[_0x44d3('0x5')]+_0xa36784[_0x44d3('0x7')]+_0xa36784[_0x44d3('0x8')]+_0xa36784[_0x44d3('0x9')]+_0xa36784[_0x44d3('0xa')]+_0xa36784[_0x44d3('0xb')];this[_0x44d3('0x7')]=_0xa36784[_0x44d3('0x7')];this[_0x44d3('0x8')]=_0xa36784[_0x44d3('0x8')];this[_0x44d3('0x9')]=_0xa36784[_0x44d3('0x9')];this[_0x44d3('0xa')]=_0xa36784[_0x44d3('0xa')];this[_0x44d3('0xb')]=_0xa36784['countagentrejectretry'];this[_0x44d3('0xc')]=_0xa36784[_0x44d3('0xc')];this['calleridname']=_0xa36784['calleridname'];this[_0x44d3('0xd')]=_0xa36784['calleridnum'];this['starttime']=_0xa36784[_0x44d3('0xe')];this[_0x44d3('0xf')]=_0xa36784[_0x44d3('0xf')];this['endtime']=_0xa36784[_0x44d3('0xf')];this[_0x44d3('0x10')]=_0xa36784[_0x44d3('0x10')]||0x0;this[_0x44d3('0x11')]=_0xa36784[_0x44d3('0x11')]||0x0;this[_0x44d3('0x12')]=_0xa36784[_0x44d3('0x12')]||0x0;this[_0x44d3('0x13')]=_0xa36784['callback'];this[_0x44d3('0x14')]=_0xa36784[_0x44d3('0x14')];this[_0x44d3('0x15')]=_0xa36784['callbackat'];this[_0x44d3('0x16')]=_0xa36784[_0x44d3('0x16')];this['ContactId']=_0xa36784[_0x44d3('0x17')];this[_0x44d3('0x18')]=_0xa36784['ListId'];this[_0x44d3('0x19')]=_0xa36784['UserId'];this['VoiceQueueId']=_0xa36784[_0x44d3('0x1a')];this['CampaignId']=_0xa36784['CampaignId'];this[_0x44d3('0x1b')]=_0xa36784[_0x44d3('0x1b')]||'';this[_0x44d3('0x1c')]=_0xa36784[_0x44d3('0x1c')]||'';this[_0x44d3('0x1d')]=_0xa36784[_0x44d3('0x1d')];this[_0x44d3('0x1e')]=_0xa36784[_0x44d3('0x1e')];}module[_0x44d3('0x1f')]=Final; \ No newline at end of file +var _0xb5b8=['countagentrejectretry','queue','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry'];(function(_0x386b6b,_0x489623){var _0x39969e=function(_0x36c740){while(--_0x36c740){_0x386b6b['push'](_0x386b6b['shift']());}};_0x39969e(++_0x489623);}(_0xb5b8,0x1de));var _0x8b5b=function(_0x16f9a2,_0x31123a){_0x16f9a2=_0x16f9a2-0x0;var _0x4bf956=_0xb5b8[_0x16f9a2];return _0x4bf956;};'use strict';function Final(_0x48b588){this[_0x8b5b('0x0')]=_0x48b588['uniqueid'];this[_0x8b5b('0x1')]=_0x48b588[_0x8b5b('0x1')];this[_0x8b5b('0x2')]=_0x48b588[_0x8b5b('0x2')];this['campaigntype']=_0x48b588[_0x8b5b('0x2')]===_0x8b5b('0x3')?'queue':_0x48b588[_0x8b5b('0x2')];this[_0x8b5b('0x4')]=_0x48b588['countbusyretry'];this[_0x8b5b('0x5')]=_0x48b588[_0x8b5b('0x5')];this[_0x8b5b('0x6')]=_0x48b588[_0x8b5b('0x6')];this[_0x8b5b('0x7')]=_0x48b588['countbusyretry']+_0x48b588[_0x8b5b('0x5')]+_0x48b588[_0x8b5b('0x6')]+_0x48b588[_0x8b5b('0x8')]+_0x48b588[_0x8b5b('0x9')]+_0x48b588['countabandonedretry']+_0x48b588['countmachineretry']+_0x48b588['countagentrejectretry'];this['countnosuchnumberretry']=_0x48b588[_0x8b5b('0x8')];this[_0x8b5b('0x9')]=_0x48b588[_0x8b5b('0x9')];this[_0x8b5b('0xa')]=_0x48b588[_0x8b5b('0xa')];this[_0x8b5b('0xb')]=_0x48b588[_0x8b5b('0xb')];this[_0x8b5b('0xc')]=_0x48b588[_0x8b5b('0xc')];this[_0x8b5b('0xd')]=_0x48b588[_0x8b5b('0xd')];this['calleridname']=_0x48b588['calleridname'];this[_0x8b5b('0xe')]=_0x48b588[_0x8b5b('0xe')];this[_0x8b5b('0xf')]=_0x48b588['starttime'];this[_0x8b5b('0x10')]=_0x48b588[_0x8b5b('0x10')];this[_0x8b5b('0x11')]=_0x48b588['responsetime'];this[_0x8b5b('0x12')]=_0x48b588[_0x8b5b('0x12')]||0x0;this[_0x8b5b('0x13')]=_0x48b588[_0x8b5b('0x13')]||0x0;this[_0x8b5b('0x14')]=_0x48b588['talktime']||0x0;this[_0x8b5b('0x15')]=_0x48b588[_0x8b5b('0x15')];this['callbackuniqueid']=_0x48b588[_0x8b5b('0x16')];this['callbackat']=_0x48b588[_0x8b5b('0x17')];this[_0x8b5b('0x18')]=_0x48b588[_0x8b5b('0x18')];this[_0x8b5b('0x19')]=_0x48b588[_0x8b5b('0x19')];this['ListId']=_0x48b588[_0x8b5b('0x1a')];this[_0x8b5b('0x1b')]=_0x48b588[_0x8b5b('0x1b')];this[_0x8b5b('0x1c')]=_0x48b588[_0x8b5b('0x1c')];this['CampaignId']=_0x48b588[_0x8b5b('0x1d')];this['originatecalleridnum']=_0x48b588[_0x8b5b('0x1e')]||'';this['originatecalleridname']=_0x48b588[_0x8b5b('0x1f')]||'';this[_0x8b5b('0x20')]=_0x48b588[_0x8b5b('0x20')];this['statedesc']=_0x48b588[_0x8b5b('0x21')];}module[_0x8b5b('0x22')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index 82f63ba..1455ccb 100644 --- a/server/services/ami/dialer/models/hangup.js +++ b/server/services/ami/dialer/models/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdfd4=['reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','statedesc','scheduledat','type','campaigntype','outbound','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','ringtime','getSeconds','holdtime','queue','membername','IVR'];(function(_0x4df96e,_0x3013cc){var _0x1fb256=function(_0x3a71fe){while(--_0x3a71fe){_0x4df96e['push'](_0x4df96e['shift']());}};_0x1fb256(++_0x3013cc);}(_0xdfd4,0x163));var _0x4dfd=function(_0x245327,_0x2bbe5f){_0x245327=_0x245327-0x0;var _0x4d441c=_0xdfd4[_0x245327];return _0x4d441c;};'use strict';var moment=require(_0x4dfd('0x0'));var utils=require(_0x4dfd('0x1'));function Hangup(_0x559302,_0x2bce86){this['state']=0x4;this[_0x4dfd('0x2')]='Answer';this[_0x4dfd('0x3')]=_0x559302['scheduledat'];this[_0x4dfd('0x4')]=_0x559302[_0x4dfd('0x4')];this[_0x4dfd('0x5')]=_0x559302[_0x4dfd('0x4')]===_0x4dfd('0x6')?'queue':_0x559302['type'];this[_0x4dfd('0x7')]=_0x559302['amd']||![];this['countbusyretry']=_0x559302[_0x4dfd('0x8')];this[_0x4dfd('0x9')]=_0x559302['countcongestionretry'];this['countnoanswerretry']=_0x559302[_0x4dfd('0xa')];this[_0x4dfd('0xb')]=_0x559302['countbusyretry']+_0x559302['countcongestionretry']+_0x559302['countnoanswerretry']+_0x559302[_0x4dfd('0xc')]+_0x559302['countdropretry']+_0x559302[_0x4dfd('0xd')]+_0x559302[_0x4dfd('0xe')]+_0x559302[_0x4dfd('0xf')];this[_0x4dfd('0xc')]=_0x559302[_0x4dfd('0xc')];this['countdropretry']=_0x559302[_0x4dfd('0x10')];this[_0x4dfd('0xd')]=_0x559302[_0x4dfd('0xd')];this['countmachineretry']=_0x559302[_0x4dfd('0xe')];this[_0x4dfd('0xf')]=_0x559302['countagentrejectretry'];this[_0x4dfd('0x11')]=_0x2bce86[_0x4dfd('0x11')];this[_0x4dfd('0x12')]=_0x559302[_0x4dfd('0x13')];this[_0x4dfd('0x14')]=_0x559302[_0x4dfd('0x15')];this[_0x4dfd('0x16')]=_0x559302[_0x4dfd('0x16')];this[_0x4dfd('0x17')]=_0x559302['responsetime'];this[_0x4dfd('0x18')]=moment()[_0x4dfd('0x19')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x4dfd('0x1a')]=utils[_0x4dfd('0x1b')](_0x559302[_0x4dfd('0x17')],_0x559302[_0x4dfd('0x16')]);this[_0x4dfd('0x1c')]=0x0;this['talktime']=utils[_0x4dfd('0x1b')](this[_0x4dfd('0x18')],_0x559302['responsetime']);this[_0x4dfd('0x1d')]=_0x559302['queue'];this[_0x4dfd('0x1e')]=_0x4dfd('0x1f');this[_0x4dfd('0x20')]=_0x2bce86[_0x4dfd('0x21')];this[_0x4dfd('0x22')]=_0x559302[_0x4dfd('0x22')];this[_0x4dfd('0x23')]=_0x559302[_0x4dfd('0x23')];this[_0x4dfd('0x24')]=_0x559302[_0x4dfd('0x24')];this[_0x4dfd('0x25')]=_0x559302[_0x4dfd('0x25')];this[_0x4dfd('0x26')]=_0x559302['ContactId'];this['ListId']=_0x559302['ListId'];this[_0x4dfd('0x27')]=_0x559302[_0x4dfd('0x27')];this[_0x4dfd('0x28')]=_0x559302[_0x4dfd('0x28')];this['CampaignId']=_0x559302[_0x4dfd('0x29')];}module[_0x4dfd('0x2a')]=Hangup; \ No newline at end of file +var _0xd236=['endtime','format','YYYY-MM-DD\x20HH:mm:ss','getSeconds','holdtime','queue','membername','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','statedesc','Answer','scheduledat','type','campaigntype','outbound','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countdropretry','countagentrejectretry','uniqueid','name','number','starttime','responsetime'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd236,0x1d6));var _0x6d23=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0xd236[_0x500419];return _0x241c1a;};'use strict';var moment=require(_0x6d23('0x0'));var utils=require(_0x6d23('0x1'));function Hangup(_0x16c55c,_0x10c489){this['state']=0x4;this[_0x6d23('0x2')]=_0x6d23('0x3');this[_0x6d23('0x4')]=_0x16c55c['scheduledat'];this[_0x6d23('0x5')]=_0x16c55c[_0x6d23('0x5')];this[_0x6d23('0x6')]=_0x16c55c['type']===_0x6d23('0x7')?'queue':_0x16c55c[_0x6d23('0x5')];this[_0x6d23('0x8')]=_0x16c55c[_0x6d23('0x8')]||![];this[_0x6d23('0x9')]=_0x16c55c['countbusyretry'];this[_0x6d23('0xa')]=_0x16c55c[_0x6d23('0xa')];this[_0x6d23('0xb')]=_0x16c55c[_0x6d23('0xb')];this[_0x6d23('0xc')]=_0x16c55c['countbusyretry']+_0x16c55c[_0x6d23('0xa')]+_0x16c55c[_0x6d23('0xb')]+_0x16c55c[_0x6d23('0xd')]+_0x16c55c['countdropretry']+_0x16c55c[_0x6d23('0xe')]+_0x16c55c['countmachineretry']+_0x16c55c['countagentrejectretry'];this[_0x6d23('0xd')]=_0x16c55c[_0x6d23('0xd')];this[_0x6d23('0xf')]=_0x16c55c[_0x6d23('0xf')];this['countabandonedretry']=_0x16c55c[_0x6d23('0xe')];this['countmachineretry']=_0x16c55c['countmachineretry'];this[_0x6d23('0x10')]=_0x16c55c[_0x6d23('0x10')];this[_0x6d23('0x11')]=_0x10c489[_0x6d23('0x11')];this['calleridname']=_0x16c55c[_0x6d23('0x12')];this['calleridnum']=_0x16c55c[_0x6d23('0x13')];this[_0x6d23('0x14')]=_0x16c55c[_0x6d23('0x14')];this[_0x6d23('0x15')]=_0x16c55c[_0x6d23('0x15')];this[_0x6d23('0x16')]=moment()[_0x6d23('0x17')](_0x6d23('0x18'));this['ringtime']=utils[_0x6d23('0x19')](_0x16c55c['responsetime'],_0x16c55c[_0x6d23('0x14')]);this[_0x6d23('0x1a')]=0x0;this['talktime']=utils[_0x6d23('0x19')](this[_0x6d23('0x16')],_0x16c55c['responsetime']);this[_0x6d23('0x1b')]=_0x16c55c[_0x6d23('0x1b')];this[_0x6d23('0x1c')]='IVR';this[_0x6d23('0x1d')]=_0x10c489[_0x6d23('0x1e')];this[_0x6d23('0x1f')]=_0x16c55c['callback'];this[_0x6d23('0x20')]=_0x16c55c[_0x6d23('0x20')];this['callbackat']=_0x16c55c[_0x6d23('0x21')];this[_0x6d23('0x22')]=_0x16c55c[_0x6d23('0x22')];this[_0x6d23('0x23')]=_0x16c55c[_0x6d23('0x23')];this[_0x6d23('0x24')]=_0x16c55c[_0x6d23('0x24')];this[_0x6d23('0x25')]=_0x16c55c[_0x6d23('0x25')];this['VoiceQueueId']=_0x16c55c[_0x6d23('0x26')];this[_0x6d23('0x27')]=_0x16c55c[_0x6d23('0x27')];}module[_0x6d23('0x28')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index 2ec5f73..c3275a0 100644 --- a/server/services/ami/dialer/models/history.js +++ b/server/services/ami/dialer/models/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x750f=['countabandonedretry','queue','name','calleridnum','number','starttime','responsetime','endtime','ringtime','getSeconds','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry'];(function(_0x3b3f50,_0x46a5dd){var _0x30b489=function(_0x132dad){while(--_0x132dad){_0x3b3f50['push'](_0x3b3f50['shift']());}};_0x30b489(++_0x46a5dd);}(_0x750f,0xd6));var _0xf750=function(_0xa8aa93,_0x48fba5){_0xa8aa93=_0xa8aa93-0x0;var _0x5af739=_0x750f[_0xa8aa93];return _0x5af739;};'use strict';var utils=require(_0xf750('0x0'));function History(_0x3c905f){this[_0xf750('0x1')]=_0x3c905f[_0xf750('0x1')];this[_0xf750('0x2')]=_0x3c905f[_0xf750('0x2')]||undefined;this[_0xf750('0x3')]=_0x3c905f['type'];this[_0xf750('0x4')]=_0x3c905f['type']===_0xf750('0x5')?'queue':_0x3c905f['type'];this[_0xf750('0x6')]=_0x3c905f[_0xf750('0x6')];this[_0xf750('0x7')]=_0x3c905f['countcongestionretry'];this[_0xf750('0x8')]=_0x3c905f['countnoanswerretry'];this[_0xf750('0x9')]=_0x3c905f[_0xf750('0x6')]+_0x3c905f['countcongestionretry']+_0x3c905f[_0xf750('0x8')]+_0x3c905f[_0xf750('0xa')]+_0x3c905f[_0xf750('0xb')]+_0x3c905f['countabandonedretry']+_0x3c905f[_0xf750('0xc')]+_0x3c905f[_0xf750('0xd')];this[_0xf750('0xa')]=_0x3c905f[_0xf750('0xa')];this[_0xf750('0xb')]=_0x3c905f[_0xf750('0xb')];this[_0xf750('0xe')]=_0x3c905f[_0xf750('0xe')];this[_0xf750('0xc')]=_0x3c905f['countmachineretry'];this[_0xf750('0xd')]=_0x3c905f[_0xf750('0xd')];this['queue']=_0x3c905f[_0xf750('0xf')];this['calleridname']=_0x3c905f[_0xf750('0x10')];this[_0xf750('0x11')]=_0x3c905f[_0xf750('0x12')];this[_0xf750('0x13')]=_0x3c905f[_0xf750('0x13')];this[_0xf750('0x14')]=_0x3c905f[_0xf750('0x14')];this[_0xf750('0x15')]=_0x3c905f[_0xf750('0x14')];this[_0xf750('0x16')]=utils[_0xf750('0x17')](_0x3c905f[_0xf750('0x14')],_0x3c905f[_0xf750('0x13')]);this[_0xf750('0x18')]=0x0;this['talktime']=0x0;this[_0xf750('0x19')]=_0x3c905f[_0xf750('0x19')];this[_0xf750('0x1a')]=_0x3c905f[_0xf750('0x1a')];this[_0xf750('0x1b')]=_0x3c905f['callbackat'];this[_0xf750('0x1c')]=_0x3c905f[_0xf750('0x1c')];this[_0xf750('0x1d')]=_0x3c905f['ContactId'];this[_0xf750('0x1e')]=_0x3c905f[_0xf750('0x1e')];this['UserId']=_0x3c905f[_0xf750('0x1f')];this['VoiceQueueId']=_0x3c905f['VoiceQueueId'];this[_0xf750('0x20')]=_0x3c905f[_0xf750('0x20')];this[_0xf750('0x21')]=_0x3c905f['originatecalleridnum']||'';this[_0xf750('0x22')]=_0x3c905f['originatecalleridname']||'';this[_0xf750('0x23')]=_0x3c905f[_0xf750('0x23')];this[_0xf750('0x24')]=_0x3c905f[_0xf750('0x24')];}module[_0xf750('0x25')]=History; \ No newline at end of file +var _0xf847=['countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','exports','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue'];(function(_0xc943d4,_0x134dc7){var _0x25e636=function(_0x3f6017){while(--_0x3f6017){_0xc943d4['push'](_0xc943d4['shift']());}};_0x25e636(++_0x134dc7);}(_0xf847,0x10a));var _0x7f84=function(_0x459922,_0x47c03e){_0x459922=_0x459922-0x0;var _0x5ca995=_0xf847[_0x459922];return _0x5ca995;};'use strict';var utils=require(_0x7f84('0x0'));function History(_0x31988e){this[_0x7f84('0x1')]=_0x31988e['uniqueid'];this[_0x7f84('0x2')]=_0x31988e[_0x7f84('0x2')]||undefined;this[_0x7f84('0x3')]=_0x31988e['type'];this[_0x7f84('0x4')]=_0x31988e[_0x7f84('0x3')]===_0x7f84('0x5')?_0x7f84('0x6'):_0x31988e[_0x7f84('0x3')];this[_0x7f84('0x7')]=_0x31988e[_0x7f84('0x7')];this[_0x7f84('0x8')]=_0x31988e['countcongestionretry'];this[_0x7f84('0x9')]=_0x31988e['countnoanswerretry'];this[_0x7f84('0xa')]=_0x31988e[_0x7f84('0x7')]+_0x31988e[_0x7f84('0x8')]+_0x31988e['countnoanswerretry']+_0x31988e['countnosuchnumberretry']+_0x31988e[_0x7f84('0xb')]+_0x31988e[_0x7f84('0xc')]+_0x31988e[_0x7f84('0xd')]+_0x31988e[_0x7f84('0xe')];this[_0x7f84('0xf')]=_0x31988e['countnosuchnumberretry'];this[_0x7f84('0xb')]=_0x31988e[_0x7f84('0xb')];this[_0x7f84('0xc')]=_0x31988e[_0x7f84('0xc')];this[_0x7f84('0xd')]=_0x31988e['countmachineretry'];this[_0x7f84('0xe')]=_0x31988e[_0x7f84('0xe')];this[_0x7f84('0x6')]=_0x31988e[_0x7f84('0x6')];this[_0x7f84('0x10')]=_0x31988e[_0x7f84('0x11')];this[_0x7f84('0x12')]=_0x31988e[_0x7f84('0x13')];this[_0x7f84('0x14')]=_0x31988e[_0x7f84('0x14')];this[_0x7f84('0x15')]=_0x31988e[_0x7f84('0x15')];this[_0x7f84('0x16')]=_0x31988e[_0x7f84('0x15')];this[_0x7f84('0x17')]=utils['getSeconds'](_0x31988e['responsetime'],_0x31988e['starttime']);this[_0x7f84('0x18')]=0x0;this[_0x7f84('0x19')]=0x0;this[_0x7f84('0x1a')]=_0x31988e['callback'];this['callbackuniqueid']=_0x31988e[_0x7f84('0x1b')];this[_0x7f84('0x1c')]=_0x31988e['callbackat'];this[_0x7f84('0x1d')]=_0x31988e[_0x7f84('0x1d')];this[_0x7f84('0x1e')]=_0x31988e['ContactId'];this['ListId']=_0x31988e[_0x7f84('0x1f')];this[_0x7f84('0x20')]=_0x31988e[_0x7f84('0x20')];this[_0x7f84('0x21')]=_0x31988e[_0x7f84('0x21')];this['CampaignId']=_0x31988e[_0x7f84('0x22')];this[_0x7f84('0x23')]=_0x31988e[_0x7f84('0x23')]||'';this['originatecalleridname']=_0x31988e[_0x7f84('0x24')]||'';this['state']=_0x31988e[_0x7f84('0x25')];this['statedesc']=_0x31988e['statedesc'];}module[_0x7f84('0x26')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index 7412273..2374afa 100644 --- a/server/services/ami/dialer/models/queueCallerAbandon.js +++ b/server/services/ami/dialer/models/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x488a=['ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','number','starttime','responsetime','dropreason','endtime','droptime','getSeconds','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x53e3de,_0x13da7b){var _0x7b905b=function(_0x29b56a){while(--_0x29b56a){_0x53e3de['push'](_0x53e3de['shift']());}};_0x7b905b(++_0x13da7b);}(_0x488a,0x1a3));var _0xa488=function(_0x375a57,_0x3175ee){_0x375a57=_0x375a57-0x0;var _0xeaa3e0=_0x488a[_0x375a57];return _0xeaa3e0;};'use strict';var utils=require(_0xa488('0x0'));function QueueCallerAbandon(_0x18165c,_0x1de537){this[_0xa488('0x1')]=_0x18165c['scheduledat'];this['type']=_0x18165c[_0xa488('0x2')];this['campaigntype']=_0x18165c['type']===_0xa488('0x3')?_0xa488('0x4'):_0x18165c[_0xa488('0x2')];this['countbusyretry']=_0x18165c[_0xa488('0x5')];this[_0xa488('0x6')]=_0x18165c['countcongestionretry'];this[_0xa488('0x7')]=_0x18165c[_0xa488('0x7')];this[_0xa488('0x8')]=_0x18165c[_0xa488('0x5')]+_0x18165c['countcongestionretry']+_0x18165c['countnoanswerretry']+_0x18165c[_0xa488('0x9')]+_0x18165c[_0xa488('0xa')]+_0x18165c[_0xa488('0xb')]+_0x18165c[_0xa488('0xc')]+_0x18165c[_0xa488('0xd')];this['countnosuchnumberretry']=_0x18165c[_0xa488('0x9')];this[_0xa488('0xa')]=_0x18165c[_0xa488('0xa')];this['countabandonedretry']=_0x18165c['countabandonedretry'];this[_0xa488('0xc')]=_0x18165c[_0xa488('0xc')];this['countagentrejectretry']=_0x18165c[_0xa488('0xd')];this['uniqueid']=_0x1de537['uniqueid'];this[_0xa488('0xe')]=_0x18165c['name'];this[_0xa488('0xf')]=_0x18165c[_0xa488('0x10')];this[_0xa488('0x11')]=_0x18165c['starttime'];this[_0xa488('0x12')]=_0x18165c[_0xa488('0x12')];this['droptime']=_0x18165c['droptime'];this[_0xa488('0x13')]=_0x18165c['dropreason'];this[_0xa488('0x14')]=this[_0xa488('0x15')];this['ringtime']=utils[_0xa488('0x16')](_0x18165c['responsetime'],_0x18165c['starttime']);this['holdtime']=utils[_0xa488('0x16')](this[_0xa488('0x15')],_0x18165c[_0xa488('0x12')]);this[_0xa488('0x17')]=0x0;this[_0xa488('0x4')]=_0x1de537[_0xa488('0x4')];this[_0xa488('0x18')]=_0x1de537[_0xa488('0x19')];this[_0xa488('0x1a')]=_0x1de537[_0xa488('0x1a')];this[_0xa488('0x1b')]=_0x18165c['callback'];this[_0xa488('0x1c')]=_0x18165c['callbackuniqueid'];this[_0xa488('0x1d')]=_0x18165c['callbackat'];this[_0xa488('0x1e')]=_0x18165c[_0xa488('0x1e')];this[_0xa488('0x1f')]=_0x18165c[_0xa488('0x1f')];this[_0xa488('0x20')]=_0x18165c[_0xa488('0x20')];this['UserId']=_0x18165c['UserId'];this[_0xa488('0x21')]=_0x18165c[_0xa488('0x21')];this[_0xa488('0x22')]=_0x18165c[_0xa488('0x22')];this[_0xa488('0x23')]=_0x18165c[_0xa488('0x23')]||'';this[_0xa488('0x24')]=_0x18165c[_0xa488('0x24')]||'';this[_0xa488('0x25')]=_0x18165c['agiafterat'];this[_0xa488('0x26')]=_0x18165c[_0xa488('0x26')];this[_0xa488('0x27')]=_0x18165c['statedesc'];}module[_0xa488('0x28')]=QueueCallerAbandon; \ No newline at end of file +var _0xde19=['talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','state','statedesc','exports','../utils','scheduledat','campaigntype','type','outbound','queue','countbusyretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countnosuchnumberretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','holdtime'];(function(_0x1b273b,_0x8169b){var _0x585ff4=function(_0xc6a38){while(--_0xc6a38){_0x1b273b['push'](_0x1b273b['shift']());}};_0x585ff4(++_0x8169b);}(_0xde19,0x88));var _0x9de1=function(_0x287234,_0x4b9e28){_0x287234=_0x287234-0x0;var _0x4bfc27=_0xde19[_0x287234];return _0x4bfc27;};'use strict';var utils=require(_0x9de1('0x0'));function QueueCallerAbandon(_0x2168fe,_0x1c5a51){this[_0x9de1('0x1')]=_0x2168fe['scheduledat'];this['type']=_0x2168fe['type'];this[_0x9de1('0x2')]=_0x2168fe[_0x9de1('0x3')]===_0x9de1('0x4')?_0x9de1('0x5'):_0x2168fe[_0x9de1('0x3')];this[_0x9de1('0x6')]=_0x2168fe[_0x9de1('0x6')];this['countcongestionretry']=_0x2168fe['countcongestionretry'];this[_0x9de1('0x7')]=_0x2168fe[_0x9de1('0x7')];this[_0x9de1('0x8')]=_0x2168fe['countbusyretry']+_0x2168fe['countcongestionretry']+_0x2168fe[_0x9de1('0x7')]+_0x2168fe['countnosuchnumberretry']+_0x2168fe[_0x9de1('0x9')]+_0x2168fe[_0x9de1('0xa')]+_0x2168fe['countmachineretry']+_0x2168fe['countagentrejectretry'];this[_0x9de1('0xb')]=_0x2168fe[_0x9de1('0xb')];this[_0x9de1('0x9')]=_0x2168fe[_0x9de1('0x9')];this['countabandonedretry']=_0x2168fe[_0x9de1('0xa')];this['countmachineretry']=_0x2168fe['countmachineretry'];this['countagentrejectretry']=_0x2168fe['countagentrejectretry'];this['uniqueid']=_0x1c5a51[_0x9de1('0xc')];this[_0x9de1('0xd')]=_0x2168fe['name'];this[_0x9de1('0xe')]=_0x2168fe[_0x9de1('0xf')];this[_0x9de1('0x10')]=_0x2168fe[_0x9de1('0x10')];this[_0x9de1('0x11')]=_0x2168fe[_0x9de1('0x11')];this[_0x9de1('0x12')]=_0x2168fe[_0x9de1('0x12')];this[_0x9de1('0x13')]=_0x2168fe[_0x9de1('0x13')];this[_0x9de1('0x14')]=this[_0x9de1('0x12')];this[_0x9de1('0x15')]=utils[_0x9de1('0x16')](_0x2168fe[_0x9de1('0x11')],_0x2168fe[_0x9de1('0x10')]);this[_0x9de1('0x17')]=utils['getSeconds'](this['droptime'],_0x2168fe['responsetime']);this[_0x9de1('0x18')]=0x0;this['queue']=_0x1c5a51[_0x9de1('0x5')];this['membername']=_0x1c5a51[_0x9de1('0x19')];this[_0x9de1('0x1a')]=_0x1c5a51[_0x9de1('0x1a')];this[_0x9de1('0x1b')]=_0x2168fe[_0x9de1('0x1b')];this[_0x9de1('0x1c')]=_0x2168fe[_0x9de1('0x1c')];this[_0x9de1('0x1d')]=_0x2168fe['callbackat'];this[_0x9de1('0x1e')]=_0x2168fe[_0x9de1('0x1e')];this[_0x9de1('0x1f')]=_0x2168fe[_0x9de1('0x1f')];this[_0x9de1('0x20')]=_0x2168fe[_0x9de1('0x20')];this[_0x9de1('0x21')]=_0x2168fe[_0x9de1('0x21')];this[_0x9de1('0x22')]=_0x2168fe['VoiceQueueId'];this[_0x9de1('0x23')]=_0x2168fe[_0x9de1('0x23')];this[_0x9de1('0x24')]=_0x2168fe[_0x9de1('0x24')]||'';this['originatecalleridname']=_0x2168fe['originatecalleridname']||'';this['agiafterat']=_0x2168fe['agiafterat'];this[_0x9de1('0x25')]=_0x2168fe[_0x9de1('0x25')];this[_0x9de1('0x26')]=_0x2168fe[_0x9de1('0x26')];}module[_0x9de1('0x27')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index f370e89..d2793da 100644 --- a/server/services/ami/dialer/utils/hopper.js +++ b/server/services/ami/dialer/utils/hopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackListIvr]','checkIsBlackListIvr','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','[createHistory]','createHistory','util','../../../../config/logger','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]'];(function(_0x51f434,_0x5f1f68){var _0xc72148=function(_0x592879){while(--_0x592879){_0x51f434['push'](_0x51f434['shift']());}};_0xc72148(++_0x5f1f68);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x0d8b('0x0'));var logger=require(_0x0d8b('0x1'))('dialer');var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x0d8b('0x2'));var cmHopperHistory=require(_0x0d8b('0x3'));function inspectError(_0x43bca1){return util[_0x0d8b('0x4')](_0x43bca1,{'showHidden':![],'depth':null});}function getContactDialer(_0x8196ed,_0x577834,_0x5e15e6){return cmHopper[_0x0d8b('0x5')](_0x8196ed['id'],_0x577834,_0x5e15e6,_0x8196ed[_0x0d8b('0x6')])[_0x0d8b('0x7')](function(_0x4a4470){_0x8196ed[_0x0d8b('0x8')]-=_0x5e15e6;if(_0x8196ed[_0x0d8b('0x8')]<0x0){_0x8196ed['temp']=0x0;}logger[_0x0d8b('0x9')](_0x0d8b('0xa'),inspectError(_0x4a4470));});}exports[_0x0d8b('0x5')]=getContactDialer;function getContactDialerIvr(_0x1f4800,_0x28ff7f){return cmHopper[_0x0d8b('0xb')](_0x1f4800['id'],_0x28ff7f,_0x1f4800[_0x0d8b('0x6')])[_0x0d8b('0x7')](function(_0x48fa16){_0x1f4800[_0x0d8b('0x8')]-=_0x28ff7f;if(_0x1f4800['temp']<0x0){_0x1f4800[_0x0d8b('0x8')]=0x0;}logger[_0x0d8b('0x9')](_0x0d8b('0xc'),inspectError(_0x48fa16));});}exports[_0x0d8b('0xb')]=getContactDialerIvr;function countReScheduled(_0x35a07b){return cmHopper[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0x7')](function(_0x31a8cc){logger[_0x0d8b('0x9')](_0x0d8b('0xe'),inspectError(_0x31a8cc));});}exports[_0x0d8b('0xd')]=countReScheduled;function rescheduleContact(_0xe65334){return cmHopper[_0x0d8b('0xf')](_0xe65334)[_0x0d8b('0x7')](function(_0x4f6f21){logger[_0x0d8b('0x9')](_0x0d8b('0x10'),inspectError(_0x4f6f21));});}exports[_0x0d8b('0xf')]=rescheduleContact;function unlockContact(_0xe2e167,_0x2cb03c,_0x5cd485){return cmHopper[_0x0d8b('0x11')](_0xe2e167,_0x2cb03c,_0x5cd485)[_0x0d8b('0x7')](function(_0x2fd0fc){logger[_0x0d8b('0x9')](_0x0d8b('0x12'),inspectError(_0x2fd0fc));});}exports[_0x0d8b('0x11')]=unlockContact;function moveContactManagedDialer(_0x264b39){return cmHopper[_0x0d8b('0x13')](_0x264b39)['catch'](function(_0x27512e){logger[_0x0d8b('0x9')](_0x0d8b('0x14'),inspectError(_0x27512e));});}exports[_0x0d8b('0x13')]=moveContactManagedDialer;function checkIsBlackList(_0x24e8ed){return cmHopperBlack[_0x0d8b('0x15')](_0x24e8ed)[_0x0d8b('0x7')](function(_0x352c17){logger['error']('[checkIsBlackList]',inspectError(_0x352c17));});}exports[_0x0d8b('0x15')]=checkIsBlackList;function checkIsBlackListIvr(_0x54a9a7){return cmHopperBlack['checkIsBlackListIvr'](_0x54a9a7)['catch'](function(_0x238728){logger[_0x0d8b('0x9')](_0x0d8b('0x16'),inspectError(_0x238728));});}exports[_0x0d8b('0x17')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x221071,_0x2c64e2,_0x30980c){return cmHopperAdditionalPhone[_0x0d8b('0x18')](_0x221071,_0x2c64e2,_0x30980c)[_0x0d8b('0x7')](function(_0x5e5bc3){logger[_0x0d8b('0x9')](_0x0d8b('0x19'),inspectError(_0x5e5bc3));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0xe1ef20,_0x4a0ae4,_0x3dd149){return cmHopperAdditionalPhone[_0x0d8b('0x1a')](_0xe1ef20,_0x4a0ae4,_0x3dd149)[_0x0d8b('0x7')](function(_0x4fe6f9){logger['error'](_0x0d8b('0x1b'),inspectError(_0x4fe6f9));});}exports[_0x0d8b('0x1a')]=swapAdditionalPhones;function avgHandleTime(_0x4c05ee){return cmHopperHistory[_0x0d8b('0x1c')](_0x4c05ee)['catch'](function(_0x1b2b59){logger['error'](_0x0d8b('0x1d'),inspectError(_0x1b2b59));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x2ab00d){return cmHopperHistory['createHistory'](_0x2ab00d)[_0x0d8b('0x7')](function(_0x544735){logger[_0x0d8b('0x9')](_0x0d8b('0x1e'),inspectError(_0x544735));});}exports[_0x0d8b('0x1f')]=createHistory; \ No newline at end of file +var _0xd8b0=['moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackListIvr]','checkIsBlackListIvr','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','[createHistory]','createHistory','util','../../../../config/logger','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]'];(function(_0x462e55,_0x460798){var _0x183cb0=function(_0x5577a8){while(--_0x5577a8){_0x462e55['push'](_0x462e55['shift']());}};_0x183cb0(++_0x460798);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var util=require(_0x0d8b('0x0'));var logger=require(_0x0d8b('0x1'))('dialer');var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x0d8b('0x2'));var cmHopperHistory=require(_0x0d8b('0x3'));function inspectError(_0x43bca1){return util[_0x0d8b('0x4')](_0x43bca1,{'showHidden':![],'depth':null});}function getContactDialer(_0x8196ed,_0x577834,_0x5e15e6){return cmHopper[_0x0d8b('0x5')](_0x8196ed['id'],_0x577834,_0x5e15e6,_0x8196ed[_0x0d8b('0x6')])[_0x0d8b('0x7')](function(_0x4a4470){_0x8196ed[_0x0d8b('0x8')]-=_0x5e15e6;if(_0x8196ed[_0x0d8b('0x8')]<0x0){_0x8196ed['temp']=0x0;}logger[_0x0d8b('0x9')](_0x0d8b('0xa'),inspectError(_0x4a4470));});}exports[_0x0d8b('0x5')]=getContactDialer;function getContactDialerIvr(_0x1f4800,_0x28ff7f){return cmHopper[_0x0d8b('0xb')](_0x1f4800['id'],_0x28ff7f,_0x1f4800[_0x0d8b('0x6')])[_0x0d8b('0x7')](function(_0x48fa16){_0x1f4800[_0x0d8b('0x8')]-=_0x28ff7f;if(_0x1f4800['temp']<0x0){_0x1f4800[_0x0d8b('0x8')]=0x0;}logger[_0x0d8b('0x9')](_0x0d8b('0xc'),inspectError(_0x48fa16));});}exports[_0x0d8b('0xb')]=getContactDialerIvr;function countReScheduled(_0x35a07b){return cmHopper[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0x7')](function(_0x31a8cc){logger[_0x0d8b('0x9')](_0x0d8b('0xe'),inspectError(_0x31a8cc));});}exports[_0x0d8b('0xd')]=countReScheduled;function rescheduleContact(_0xe65334){return cmHopper[_0x0d8b('0xf')](_0xe65334)[_0x0d8b('0x7')](function(_0x4f6f21){logger[_0x0d8b('0x9')](_0x0d8b('0x10'),inspectError(_0x4f6f21));});}exports[_0x0d8b('0xf')]=rescheduleContact;function unlockContact(_0xe2e167,_0x2cb03c,_0x5cd485){return cmHopper[_0x0d8b('0x11')](_0xe2e167,_0x2cb03c,_0x5cd485)[_0x0d8b('0x7')](function(_0x2fd0fc){logger[_0x0d8b('0x9')](_0x0d8b('0x12'),inspectError(_0x2fd0fc));});}exports[_0x0d8b('0x11')]=unlockContact;function moveContactManagedDialer(_0x264b39){return cmHopper[_0x0d8b('0x13')](_0x264b39)['catch'](function(_0x27512e){logger[_0x0d8b('0x9')](_0x0d8b('0x14'),inspectError(_0x27512e));});}exports[_0x0d8b('0x13')]=moveContactManagedDialer;function checkIsBlackList(_0x24e8ed){return cmHopperBlack[_0x0d8b('0x15')](_0x24e8ed)[_0x0d8b('0x7')](function(_0x352c17){logger['error']('[checkIsBlackList]',inspectError(_0x352c17));});}exports[_0x0d8b('0x15')]=checkIsBlackList;function checkIsBlackListIvr(_0x54a9a7){return cmHopperBlack['checkIsBlackListIvr'](_0x54a9a7)['catch'](function(_0x238728){logger[_0x0d8b('0x9')](_0x0d8b('0x16'),inspectError(_0x238728));});}exports[_0x0d8b('0x17')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x221071,_0x2c64e2,_0x30980c){return cmHopperAdditionalPhone[_0x0d8b('0x18')](_0x221071,_0x2c64e2,_0x30980c)[_0x0d8b('0x7')](function(_0x5e5bc3){logger[_0x0d8b('0x9')](_0x0d8b('0x19'),inspectError(_0x5e5bc3));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0xe1ef20,_0x4a0ae4,_0x3dd149){return cmHopperAdditionalPhone[_0x0d8b('0x1a')](_0xe1ef20,_0x4a0ae4,_0x3dd149)[_0x0d8b('0x7')](function(_0x4fe6f9){logger['error'](_0x0d8b('0x1b'),inspectError(_0x4fe6f9));});}exports[_0x0d8b('0x1a')]=swapAdditionalPhones;function avgHandleTime(_0x4c05ee){return cmHopperHistory[_0x0d8b('0x1c')](_0x4c05ee)['catch'](function(_0x1b2b59){logger['error'](_0x0d8b('0x1d'),inspectError(_0x1b2b59));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x2ab00d){return cmHopperHistory['createHistory'](_0x2ab00d)[_0x0d8b('0x7')](function(_0x544735){logger[_0x0d8b('0x9')](_0x0d8b('0x1e'),inspectError(_0x544735));});}exports[_0x0d8b('0x1f')]=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index db9d4a7..aef6052 100644 --- a/server/services/ami/dialer/utils/index.js +++ b/server/services/ami/dialer/utils/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbd94=['string','isUndefined','format','\x22\x22\x20<>','getCallerId','pow','replace','toString','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','lodash','moment','util','../../../../config/logger','dialer','timezones','DEACTIVATED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','TRUNK_IS_NOT_REACHABLE','dialMethod','preview','isPreviewCampaign','ivr','isIVRCampaign','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','name','Trunk','active','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','includes','status','TrunkBackup','ACTIVE','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','extractCalleridName'];(function(_0x32b6ac,_0x2e81e9){var _0x1bbb25=function(_0x2815d4){while(--_0x2815d4){_0x32b6ac['push'](_0x32b6ac['shift']());}};_0x1bbb25(++_0x2e81e9);}(_0xbd94,0x14e));var _0x4bd9=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xbd94[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require(_0x4bd9('0x0'));var moment=require(_0x4bd9('0x1'));var util=require(_0x4bd9('0x2'));var logger=require(_0x4bd9('0x3'))(_0x4bd9('0x4'));var timezones=require('../../../../config/environment/shared')[_0x4bd9('0x5')];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':_0x4bd9('0x6'),'DISACTIVED':'IS_DISACTIVED','EMPTY_INTERVAL':_0x4bd9('0x7'),'INACTIVE':_0x4bd9('0x8'),'NO_AGENTS_LOGGED':_0x4bd9('0x9'),'NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':_0x4bd9('0xa'),'OVERTIME_INTERVAL':_0x4bd9('0xb'),'OVERTIME_GLOBAL_INTERVAL':'GLOBAL_INTERVAL_IS_OVERTIME','QUEUE_RECALL':_0x4bd9('0xc'),'RECALL_TIMEOUT':_0x4bd9('0xd'),'RUNNING':'RUNNING','UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':_0x4bd9('0xe')};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x18a94d){return _0x18a94d[_0x4bd9('0xf')]===_0x4bd9('0x10');}exports[_0x4bd9('0x11')]=isPreviewCampaign;function isIVRCampaign(_0x53b6c6){return _0x53b6c6['type']===_0x4bd9('0x12');}exports[_0x4bd9('0x13')]=isIVRCampaign;function isOutboundQueue(_0x2f75d8){return _0x2f75d8['type']===_0x4bd9('0x14');}exports[_0x4bd9('0x15')]=isOutboundQueue;function isQueueCampaignActive(_0x16ac53){return _0x16ac53[_0x4bd9('0x16')];}exports[_0x4bd9('0x17')]=isQueueCampaignActive;function isIVRCampaignActive(_0x200b7c){return _0x200b7c['active'];}exports[_0x4bd9('0x18')]=isIVRCampaignActive;function getSeconds(_0x5226a6,_0x4dcd8c){var _0x12ded5=moment(_0x5226a6)[_0x4bd9('0x19')](0x0);var _0x79bf23=moment(_0x4dcd8c)[_0x4bd9('0x19')](0x0);return _0x12ded5[_0x4bd9('0x1a')](_0x79bf23,_0x4bd9('0x1b'));}exports[_0x4bd9('0x1c')]=getSeconds;function hasQueueCampaignDataChanged(_0x20b392,_0xfd8d55){var _0x19619c=![];var _0x42bc8c=_0x20b392[_0x4bd9('0xf')]!==_0xfd8d55[_0x4bd9('0xf')]||_0x20b392[_0x4bd9('0x16')]!==_0xfd8d55[_0x4bd9('0x16')]||_0x20b392[_0x4bd9('0x1d')]!==_0xfd8d55[_0x4bd9('0x1d')];var _0x30ad17=_0x20b392['available']!==_0xfd8d55[_0x4bd9('0x1e')]||_0x20b392[_0x4bd9('0x1f')]!==_0xfd8d55[_0x4bd9('0x1f')]||_0x20b392[_0x4bd9('0x20')]!==_0xfd8d55['loggedInDb']||_0x20b392[_0x4bd9('0x21')]!==_0xfd8d55['paused']||_0x20b392['talking']!==_0xfd8d55[_0x4bd9('0x22')]||_0x20b392[_0x4bd9('0x23')]!==_0xfd8d55[_0x4bd9('0x23')]||_0x20b392['waiting']!==_0xfd8d55[_0x4bd9('0x24')]||_0x20b392[_0x4bd9('0x25')]!==_0xfd8d55[_0x4bd9('0x25')]||_0x20b392[_0x4bd9('0x26')]!==_0xfd8d55['originated'];if(_0x20b392['Trunk']&&_0xfd8d55['Trunk']){_0x19619c=_0x20b392['Trunk'][_0x4bd9('0x27')]!==_0xfd8d55[_0x4bd9('0x28')][_0x4bd9('0x27')]||_0x20b392[_0x4bd9('0x28')][_0x4bd9('0x29')]!==_0xfd8d55[_0x4bd9('0x28')][_0x4bd9('0x29')];}return _0x42bc8c||_0x30ad17||_0x19619c;}exports[_0x4bd9('0x2a')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x29b96f){var _0x26d97a=null;var _0x62a2b5=_0x29b96f[_0x4bd9('0x2b')];if(_[_0x4bd9('0x2c')](_0x29b96f[_0x4bd9('0x2d')])||_['isNil'](_0x29b96f['Interval'])||_[_0x4bd9('0x2c')](_0x29b96f[_0x4bd9('0x2e')][_0x4bd9('0x2f')])){_0x26d97a=CAMPAIGN_STATUS[_0x4bd9('0x30')];}else if(_['isEmpty'](_0x29b96f[_0x4bd9('0x2d')])||_[_0x4bd9('0x31')](_0x29b96f[_0x4bd9('0x2e')][_0x4bd9('0x2f')])){_0x26d97a=CAMPAIGN_STATUS[_0x4bd9('0x32')];}else if(_0x62a2b5&&!timezones[_0x62a2b5]){_0x26d97a=CAMPAIGN_STATUS[_0x4bd9('0x33')];}return _0x26d97a;}function checkAnyValidTrunk(_0x32701f,_0x4700b6){var _0x36f805=null;var _0x1c12c4=_0x4bd9('0x34');var _0xae9f04=[_0x4bd9('0x35'),_0x4bd9('0x36')];var _0x90db0e=!![];if(_0x32701f[_0x4bd9('0x28')]&&_0x32701f[_0x4bd9('0x28')][_0x4bd9('0x29')]){_0x1c12c4+=_0x32701f['Trunk'][_0x4bd9('0x27')];_0x36f805=_0x4700b6[_0x1c12c4];_0x90db0e=_0xae9f04[_0x4bd9('0x37')](_0x36f805[_0x4bd9('0x38')]);}else if(_0x32701f[_0x4bd9('0x39')]&&_0x32701f[_0x4bd9('0x39')][_0x4bd9('0x29')]){_0x1c12c4+=_0x32701f[_0x4bd9('0x39')][_0x4bd9('0x27')];_0x36f805=_0x4700b6[_0x1c12c4];_0x90db0e=_0xae9f04[_0x4bd9('0x37')](_0x36f805[_0x4bd9('0x38')]);}return _0x90db0e;}function getQueueCampaignStatusMessage(_0x5d3638,_0x466238){var _0x29b907=CAMPAIGN_STATUS[_0x4bd9('0x3a')];var _0x413f48=isPreviewCampaign(_0x5d3638);if(!isQueueCampaignActive(_0x5d3638)){if(_0x413f48){_0x29b907=CAMPAIGN_STATUS[_0x4bd9('0x3b')];}else{if(_0x5d3638[_0x4bd9('0x26')]===0x0&&_0x5d3638['talking']===0x0&&_0x5d3638[_0x4bd9('0x24')]===0x0&&(_0x5d3638[_0x4bd9('0x23')]||0x0)===0x0){_0x29b907=CAMPAIGN_STATUS[_0x4bd9('0x3b')];}else{_0x29b907=CAMPAIGN_STATUS[_0x4bd9('0x3c')];}}}else if(_0x5d3638[_0x4bd9('0x1f')]===0x0){_0x29b907=CAMPAIGN_STATUS[_0x4bd9('0x3d')];}else if(!checkAnyValidTrunk(_0x5d3638,_0x466238)){_0x29b907=CAMPAIGN_STATUS['UNREACHABLE_TRUNK'];}else if(!isPreviewCampaign(_0x5d3638)){var _0x267638=checkAnyValidQueueCampaignInterval(_0x5d3638);if(_0x267638){_0x29b907=_0x267638;}}return _0x29b907;}exports[_0x4bd9('0x3e')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x316907){var _0x371768=CAMPAIGN_STATUS[_0x4bd9('0x3c')];if(_0x316907[_0x4bd9('0x26')]===0x0&&_0x316907[_0x4bd9('0x22')]===0x0&&_0x316907[_0x4bd9('0x24')]===0x0&&(_0x316907[_0x4bd9('0x23')]||0x0)===0x0){_0x371768=CAMPAIGN_STATUS[_0x4bd9('0x3b')];}return _0x371768;}exports[_0x4bd9('0x3f')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0xed8194){var _0x41e565=_0xed8194[_0x4bd9('0x40')](/"(.*?)"/);return _0x41e565?_0x41e565[0x1]:_0xed8194;}exports[_0x4bd9('0x41')]=extractCalleridName;function getCallerId(_0x160260,_0x5dd106,_0x2461e4){if(!_['isUndefined'](_0x2461e4)&&typeof _0x2461e4===_0x4bd9('0x42')&&!_[_0x4bd9('0x31')](_0x2461e4)){if(!_[_0x4bd9('0x43')](_0x5dd106)&&typeof _0x5dd106===_0x4bd9('0x42')&&!_[_0x4bd9('0x31')](_0x5dd106)){return util[_0x4bd9('0x44')]('\x22%s\x22\x20<%s>',_0x5dd106,_0x2461e4);}return util[_0x4bd9('0x44')]('\x22%s\x22\x20<%s>',_0x2461e4,_0x2461e4);}if(!_[_0x4bd9('0x43')](_0x160260)&&typeof _0x160260===_0x4bd9('0x42')&&!_[_0x4bd9('0x31')](_0x160260)){return _0x160260;}return _0x4bd9('0x45');}exports[_0x4bd9('0x46')]=getCallerId;function getCallerIdRandom(_0x75fea8,_0x4dd072){var _0x2e794d;var _0x368ee1;var _0x53a0b0;if(_0x4dd072<=0x0){_0x4dd072=0x1;}_0x2e794d=new RegExp('\x5cw{0,'+_0x4dd072+'}$');_0x368ee1=Math[_0x4bd9('0x47')](0xa,_0x4dd072-0x1);_0x53a0b0=Math[_0x4bd9('0x47')](0xa,_0x4dd072)-0x1;return util[_0x4bd9('0x44')]('%s',_[_0x4bd9('0x48')](_0x75fea8,_0x2e794d,_['random'](_0x368ee1,_0x53a0b0)[_0x4bd9('0x49')]()));}exports['getCallerIdRandom']=getCallerIdRandom;function decrementOriginate(_0x5dcb43){if(_0x5dcb43[_0x4bd9('0x26')]&&_0x5dcb43[_0x4bd9('0x26')]>0x0){_0x5dcb43[_0x4bd9('0x26')]-=0x1;}else{logger[_0x4bd9('0x4a')](_0x4bd9('0x4b'));}}exports[_0x4bd9('0x4c')]=decrementOriginate;function checkContactEmpty(_0x5b4576){return _0x5b4576&&_0x5b4576['length']>0x0;}exports[_0x4bd9('0x4d')]=checkContactEmpty;function erlangb(_0x37825b,_0x244a9f){if(_0x244a9f===0x0){return 0x0;}var _0x45d957=0x1;for(var _0x417310=0x1;_0x417310<=_0x244a9f;_0x417310+=0x1){_0x45d957=0x1+_0x45d957*_0x417310/_0x37825b;}return 0x1/_0x45d957;}exports[_0x4bd9('0x4e')]=erlangb;function checkContactLowerLimitOriginate(_0x400a37,_0x21f08e,_0x3a1075){if(_0x21f08e>_0x3a1075){for(var _0x306b13=0x0;_0x306b13<_0x21f08e-_0x3a1075;_0x306b13+=0x1){decrementOriginate(_0x400a37);}}}exports[_0x4bd9('0x4f')]=checkContactLowerLimitOriginate; \ No newline at end of file +var _0x0f6a=['pTalking','waiting','inUse','originated','Trunk','name','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','includes','status','TrunkBackup','INACTIVE','talking','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','match','extractCalleridName','string','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','checkContactEmpty','erlangb','lodash','moment','util','../../../../config/logger','dialer','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','INTERVAL_IS_EMPTY','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','type','ivr','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','active','milliseconds','seconds','getSeconds','message','available','loggedIn','loggedInDb','paused'];(function(_0x5ae771,_0x40b184){var _0x410044=function(_0x4501d7){while(--_0x4501d7){_0x5ae771['push'](_0x5ae771['shift']());}};_0x410044(++_0x40b184);}(_0x0f6a,0x16a));var _0xa0f6=function(_0x83b5b,_0x5537c2){_0x83b5b=_0x83b5b-0x0;var _0x5617f1=_0x0f6a[_0x83b5b];return _0x5617f1;};'use strict';var _=require(_0xa0f6('0x0'));var moment=require(_0xa0f6('0x1'));var util=require(_0xa0f6('0x2'));var logger=require(_0xa0f6('0x3'))(_0xa0f6('0x4'));var timezones=require('../../../../config/environment/shared')['timezones'];var CAMPAIGN_STATUS={'ACTIVE':_0xa0f6('0x5'),'BLACKLIST':_0xa0f6('0x6'),'CONTACTS_RESCHEDULED':_0xa0f6('0x7'),'DEACTIVATED':_0xa0f6('0x8'),'DISACTIVED':'IS_DISACTIVED','EMPTY_INTERVAL':_0xa0f6('0x9'),'INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':_0xa0f6('0xa'),'NO_AVAILABLE_CONTACTS':_0xa0f6('0xb'),'NULL_INTERVAL':_0xa0f6('0xc'),'OVERTIME_INTERVAL':_0xa0f6('0xd'),'OVERTIME_GLOBAL_INTERVAL':_0xa0f6('0xe'),'QUEUE_RECALL':_0xa0f6('0xf'),'RECALL_TIMEOUT':_0xa0f6('0x10'),'RUNNING':_0xa0f6('0x11'),'UNKNOWN_TIMEZONE':_0xa0f6('0x12'),'UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0xa0f6('0x13')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x376731){return _0x376731[_0xa0f6('0x14')]===_0xa0f6('0x15');}exports[_0xa0f6('0x16')]=isPreviewCampaign;function isIVRCampaign(_0x3da427){return _0x3da427[_0xa0f6('0x17')]===_0xa0f6('0x18');}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x46d4b2){return _0x46d4b2['type']===_0xa0f6('0x19');}exports[_0xa0f6('0x1a')]=isOutboundQueue;function isQueueCampaignActive(_0x19e1bf){return _0x19e1bf[_0xa0f6('0x1b')];}exports[_0xa0f6('0x1c')]=isQueueCampaignActive;function isIVRCampaignActive(_0x4a874e){return _0x4a874e[_0xa0f6('0x1d')];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0x167cc4,_0x2b079e){var _0x550592=moment(_0x167cc4)[_0xa0f6('0x1e')](0x0);var _0x492a9e=moment(_0x2b079e)[_0xa0f6('0x1e')](0x0);return _0x550592['diff'](_0x492a9e,_0xa0f6('0x1f'));}exports[_0xa0f6('0x20')]=getSeconds;function hasQueueCampaignDataChanged(_0x49453b,_0x645d73){var _0x430233=![];var _0x953f32=_0x49453b[_0xa0f6('0x14')]!==_0x645d73[_0xa0f6('0x14')]||_0x49453b['dialActive']!==_0x645d73['dialActive']||_0x49453b[_0xa0f6('0x21')]!==_0x645d73['message'];var _0x5d37c5=_0x49453b[_0xa0f6('0x22')]!==_0x645d73[_0xa0f6('0x22')]||_0x49453b[_0xa0f6('0x23')]!==_0x645d73[_0xa0f6('0x23')]||_0x49453b[_0xa0f6('0x24')]!==_0x645d73[_0xa0f6('0x24')]||_0x49453b['paused']!==_0x645d73[_0xa0f6('0x25')]||_0x49453b['talking']!==_0x645d73['talking']||_0x49453b[_0xa0f6('0x26')]!==_0x645d73[_0xa0f6('0x26')]||_0x49453b[_0xa0f6('0x27')]!==_0x645d73[_0xa0f6('0x27')]||_0x49453b[_0xa0f6('0x28')]!==_0x645d73[_0xa0f6('0x28')]||_0x49453b[_0xa0f6('0x29')]!==_0x645d73['originated'];if(_0x49453b[_0xa0f6('0x2a')]&&_0x645d73[_0xa0f6('0x2a')]){_0x430233=_0x49453b[_0xa0f6('0x2a')]['name']!==_0x645d73[_0xa0f6('0x2a')][_0xa0f6('0x2b')]||_0x49453b[_0xa0f6('0x2a')][_0xa0f6('0x1d')]!==_0x645d73[_0xa0f6('0x2a')][_0xa0f6('0x1d')];}return _0x953f32||_0x5d37c5||_0x430233;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x5bce4f){var _0x46b3fe=null;var _0x214df4=_0x5bce4f[_0xa0f6('0x2c')];if(_[_0xa0f6('0x2d')](_0x5bce4f[_0xa0f6('0x2e')])||_[_0xa0f6('0x2d')](_0x5bce4f[_0xa0f6('0x2f')])||_[_0xa0f6('0x2d')](_0x5bce4f[_0xa0f6('0x2f')][_0xa0f6('0x30')])){_0x46b3fe=CAMPAIGN_STATUS[_0xa0f6('0x31')];}else if(_[_0xa0f6('0x32')](_0x5bce4f[_0xa0f6('0x2e')])||_['isEmpty'](_0x5bce4f[_0xa0f6('0x2f')]['Intervals'])){_0x46b3fe=CAMPAIGN_STATUS[_0xa0f6('0x33')];}else if(_0x214df4&&!timezones[_0x214df4]){_0x46b3fe=CAMPAIGN_STATUS[_0xa0f6('0x34')];}return _0x46b3fe;}function checkAnyValidTrunk(_0x2e48b4,_0x367517){var _0x15ac2b=null;var _0x4c24e4=_0xa0f6('0x35');var _0x4f6818=[_0xa0f6('0x36'),_0xa0f6('0x37')];var _0x113aaf=!![];if(_0x2e48b4[_0xa0f6('0x2a')]&&_0x2e48b4['Trunk'][_0xa0f6('0x1d')]){_0x4c24e4+=_0x2e48b4[_0xa0f6('0x2a')]['name'];_0x15ac2b=_0x367517[_0x4c24e4];_0x113aaf=_0x4f6818[_0xa0f6('0x38')](_0x15ac2b[_0xa0f6('0x39')]);}else if(_0x2e48b4[_0xa0f6('0x3a')]&&_0x2e48b4[_0xa0f6('0x3a')]['active']){_0x4c24e4+=_0x2e48b4['TrunkBackup'][_0xa0f6('0x2b')];_0x15ac2b=_0x367517[_0x4c24e4];_0x113aaf=_0x4f6818[_0xa0f6('0x38')](_0x15ac2b[_0xa0f6('0x39')]);}return _0x113aaf;}function getQueueCampaignStatusMessage(_0x552778,_0xb4e9e6){var _0x288221=CAMPAIGN_STATUS[_0xa0f6('0x5')];var _0x501bdc=isPreviewCampaign(_0x552778);if(!isQueueCampaignActive(_0x552778)){if(_0x501bdc){_0x288221=CAMPAIGN_STATUS[_0xa0f6('0x3b')];}else{if(_0x552778[_0xa0f6('0x29')]===0x0&&_0x552778[_0xa0f6('0x3c')]===0x0&&_0x552778[_0xa0f6('0x27')]===0x0&&(_0x552778[_0xa0f6('0x26')]||0x0)===0x0){_0x288221=CAMPAIGN_STATUS[_0xa0f6('0x3b')];}else{_0x288221=CAMPAIGN_STATUS[_0xa0f6('0x3d')];}}}else if(_0x552778['loggedIn']===0x0){_0x288221=CAMPAIGN_STATUS[_0xa0f6('0x3e')];}else if(!checkAnyValidTrunk(_0x552778,_0xb4e9e6)){_0x288221=CAMPAIGN_STATUS[_0xa0f6('0x3f')];}else if(!isPreviewCampaign(_0x552778)){var _0x51298b=checkAnyValidQueueCampaignInterval(_0x552778);if(_0x51298b){_0x288221=_0x51298b;}}return _0x288221;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0xa02d93){var _0x322f4e=CAMPAIGN_STATUS[_0xa0f6('0x3d')];if(_0xa02d93[_0xa0f6('0x29')]===0x0&&_0xa02d93['talking']===0x0&&_0xa02d93['waiting']===0x0&&(_0xa02d93[_0xa0f6('0x26')]||0x0)===0x0){_0x322f4e=CAMPAIGN_STATUS[_0xa0f6('0x3b')];}return _0x322f4e;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x2e90aa){var _0x29fe38=_0x2e90aa[_0xa0f6('0x40')](/"(.*?)"/);return _0x29fe38?_0x29fe38[0x1]:_0x2e90aa;}exports[_0xa0f6('0x41')]=extractCalleridName;function getCallerId(_0x427f44,_0x394c3d,_0x468373){if(!_['isUndefined'](_0x468373)&&typeof _0x468373===_0xa0f6('0x42')&&!_['isEmpty'](_0x468373)){if(!_[_0xa0f6('0x43')](_0x394c3d)&&typeof _0x394c3d===_0xa0f6('0x42')&&!_['isEmpty'](_0x394c3d)){return util[_0xa0f6('0x44')](_0xa0f6('0x45'),_0x394c3d,_0x468373);}return util[_0xa0f6('0x44')]('\x22%s\x22\x20<%s>',_0x468373,_0x468373);}if(!_['isUndefined'](_0x427f44)&&typeof _0x427f44===_0xa0f6('0x42')&&!_['isEmpty'](_0x427f44)){return _0x427f44;}return _0xa0f6('0x46');}exports[_0xa0f6('0x47')]=getCallerId;function getCallerIdRandom(_0x44f217,_0x1371c2){var _0x2ec85a;var _0x2c9a2f;var _0x2a0be2;if(_0x1371c2<=0x0){_0x1371c2=0x1;}_0x2ec85a=new RegExp(_0xa0f6('0x48')+_0x1371c2+'}$');_0x2c9a2f=Math[_0xa0f6('0x49')](0xa,_0x1371c2-0x1);_0x2a0be2=Math[_0xa0f6('0x49')](0xa,_0x1371c2)-0x1;return util[_0xa0f6('0x44')]('%s',_[_0xa0f6('0x4a')](_0x44f217,_0x2ec85a,_['random'](_0x2c9a2f,_0x2a0be2)['toString']()));}exports[_0xa0f6('0x4b')]=getCallerIdRandom;function decrementOriginate(_0x47cfa0){if(_0x47cfa0[_0xa0f6('0x29')]&&_0x47cfa0['originated']>0x0){_0x47cfa0[_0xa0f6('0x29')]-=0x1;}else{logger[_0xa0f6('0x4c')](_0xa0f6('0x4d'));}}exports['decrementOriginate']=decrementOriginate;function checkContactEmpty(_0x169f11){return _0x169f11&&_0x169f11['length']>0x0;}exports[_0xa0f6('0x4e')]=checkContactEmpty;function erlangb(_0x1c78ec,_0x1dc0db){if(_0x1dc0db===0x0){return 0x0;}var _0x2b6e8a=0x1;for(var _0x2148aa=0x1;_0x2148aa<=_0x1dc0db;_0x2148aa+=0x1){_0x2b6e8a=0x1+_0x2b6e8a*_0x2148aa/_0x1c78ec;}return 0x1/_0x2b6e8a;}exports[_0xa0f6('0x4f')]=erlangb;function checkContactLowerLimitOriginate(_0x478f29,_0x41919d,_0x415414){if(_0x41919d>_0x415414){for(var _0x4faffb=0x0;_0x4faffb<_0x41919d-_0x415414;_0x4faffb+=0x1){decrementOriginate(_0x478f29);}}}exports['checkContactLowerLimitOriginate']=checkContactLowerLimitOriginate; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index e9f8811..cfac40e 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(_0x5b58d4,_0x1e063a){var _0x3e3850=function(_0x807bf){while(--_0x807bf){_0x5b58d4['push'](_0x5b58d4['shift']());}};_0x3e3850(++_0x1e063a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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(_0x9b1e58,_0x275770){var _0x50d9d4=function(_0x392e6e){while(--_0x392e6e){_0x9b1e58['push'](_0x9b1e58['shift']());}};_0x50d9d4(++_0x275770);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'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 f6dc1b6..2c1053c 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 _0x0db6=['info','\x20syncNewchannel\x20','prototype','syncVarSet','variable','value','channelstate','channelstatedesc','syncNewExten','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','create','parse','.pdf','application/pdf','then','notify','error','\x20notify\x20','stringify','catch','\x20receiveFax\x20','merge','pick','reason','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','update','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','syncHangup','\x20hangup\x20faxRiceive\x20','faxpages','updateStatus','SENDING\x20FAILED:\x20','faxstatusstring','SENDING\x20FAILED','FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','message','Fax\x20failed','checkTrunk','Trunk','Trunk\x20Reachable','format','path','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','variablesAction','Action','execOriginate','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','util','uuid','moment','tiff2pdf','../../../config/logger','fax','../ami','./channel','./util/util','../rpc/faxAccount','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','newstate','syncNewState','newexten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','originateresponse','syncOriginateResponse','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name'];(function(_0x17e1e3,_0x3a4912){var _0x3a4c97=function(_0x10f064){while(--_0x10f064){_0x17e1e3['push'](_0x17e1e3['shift']());}};_0x3a4c97(++_0x3a4912);}(_0x0db6,0xbf));var _0x60db=function(_0x552804,_0x3c3d1e){_0x552804=_0x552804-0x0;var _0x32be66=_0x0db6[_0x552804];return _0x32be66;};'use strict';var util=require(_0x60db('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0x60db('0x1'));var moment=require(_0x60db('0x2'));var path=require('path');var tiff2pdf=require(_0x60db('0x3'));var gs=require('./util/gs');var logger=require(_0x60db('0x4'))(_0x60db('0x5'));var ami=require(_0x60db('0x6'));var rpcDb=require('./rpcDb');var Channel=require(_0x60db('0x7'));var ut=require(_0x60db('0x8'));var Action=require('./action');var faxAccount=require(_0x60db('0x9'));var attachment=require('../rpc/attachment');var faxMessage=require('../rpc/faxMessage');function Fax(_0x401afa){this[_0x60db('0xa')]={};this[_0x60db('0xb')]=_0x401afa[_0x60db('0xb')];this['trunks']=_0x401afa[_0x60db('0xc')];this[_0x60db('0xd')]={};ami['on'](_0x60db('0xe'),this[_0x60db('0xf')][_0x60db('0x10')](this));ami['on'](_0x60db('0x11'),this['syncVarSet']['bind'](this));ami['on'](_0x60db('0x12'),this[_0x60db('0x13')]['bind'](this));ami['on'](_0x60db('0x14'),this['syncNewExten'][_0x60db('0x10')](this));ami['on'](_0x60db('0x15'),this[_0x60db('0x16')][_0x60db('0x10')](this));ami['on'](_0x60db('0x17'),this[_0x60db('0x18')][_0x60db('0x10')](this));ami['on'](_0x60db('0x19'),this['syncHangup'][_0x60db('0x10')](this));ami['on'](_0x60db('0x1a'),this[_0x60db('0x1b')][_0x60db('0x10')](this));}Fax['prototype'][_0x60db('0xf')]=function(_0x54103d){if(_0x54103d['context']===_0x60db('0x1c')){for(var _0x4fa318 in this[_0x60db('0xb')]){if(this[_0x60db('0xb')][_0x60db('0x1d')](_0x4fa318)){if(_0x54103d[_0x60db('0x1e')]===this['faxAccounts'][_0x4fa318][_0x60db('0x1f')]){this[_0x60db('0xa')][_0x54103d['uniqueid']]={};this[_0x60db('0xa')][_0x54103d[_0x60db('0x20')]][_0x60db('0x21')]=_0x54103d[_0x60db('0x21')];this['channels'][_0x54103d['uniqueid']]['id']=this['faxAccounts'][_0x4fa318]['id'];this[_0x60db('0xa')][_0x54103d[_0x60db('0x20')]][_0x60db('0x22')]=this['faxAccounts'][_0x4fa318]['name'];logger[_0x60db('0x23')](_0x54103d[_0x60db('0x20')],_0x60db('0x24'));}}}}if(this[_0x60db('0xd')][_0x54103d['uniqueid']]){this['channels'][_0x54103d[_0x60db('0x20')]]={};this['channels'][_0x54103d[_0x60db('0x20')]][_0x60db('0x21')]=_0x54103d[_0x60db('0x21')];logger[_0x60db('0x23')](_0x54103d[_0x60db('0x20')],_0x60db('0x24'));}};Fax[_0x60db('0x25')][_0x60db('0x26')]=function(_0x2ce7d6){if(this[_0x60db('0xa')][_0x2ce7d6[_0x60db('0x20')]]){for(var _0x3ff59d in _0x2ce7d6[_0x60db('0x27')]){if(_0x2ce7d6[_0x60db('0x27')][_0x60db('0x1d')](_0x3ff59d)){this[_0x60db('0xa')][_0x2ce7d6[_0x60db('0x20')]][_0x3ff59d]=_0x2ce7d6[_0x60db('0x28')];}}}};Fax[_0x60db('0x25')]['syncNewState']=function(_0x16a9c6){if(this[_0x60db('0xa')][_0x16a9c6[_0x60db('0x20')]]){this[_0x60db('0xa')][_0x16a9c6[_0x60db('0x20')]][_0x60db('0x29')]=_0x16a9c6[_0x60db('0x29')];this[_0x60db('0xa')][_0x16a9c6['uniqueid']][_0x60db('0x2a')]=_0x16a9c6[_0x60db('0x2a')];}};Fax[_0x60db('0x25')][_0x60db('0x2b')]=function(_0x5007ea){if(this[_0x60db('0xa')][_0x5007ea[_0x60db('0x20')]]){for(var _0x16fc94 in _0x5007ea[_0x60db('0x27')]){if(_0x5007ea[_0x60db('0x27')][_0x60db('0x1d')](_0x16fc94)){this[_0x60db('0xa')][_0x5007ea[_0x60db('0x20')]][_0x16fc94]=_0x5007ea['value'];}}}};Fax[_0x60db('0x25')][_0x60db('0x16')]=function(_0x1966f4){if(this['channels'][_0x1966f4['uniqueid']]){this['channels'][_0x1966f4['uniqueid']][_0x60db('0x2c')]=_0x1966f4['operation'];this[_0x60db('0xa')][_0x1966f4[_0x60db('0x20')]][_0x60db('0x2d')]=_0x1966f4['status'];this[_0x60db('0xa')][_0x1966f4[_0x60db('0x20')]][_0x60db('0x1f')]=_0x1966f4[_0x60db('0x1f')];this[_0x60db('0xa')][_0x1966f4[_0x60db('0x20')]][_0x60db('0x2e')]=_0x1966f4[_0x60db('0x2e')];logger[_0x60db('0x23')](_0x1966f4['uniqueid'],_0x60db('0x2f'));}};Fax[_0x60db('0x25')][_0x60db('0x18')]=function(_0x2eaa1a){var _0xaf4a30=this;if(this['channels'][_0x2eaa1a[_0x60db('0x20')]]){var _0x542d09=this[_0x60db('0xa')][_0x2eaa1a[_0x60db('0x20')]]['id'];this['channels'][_0x2eaa1a[_0x60db('0x20')]][_0x60db('0x30')]=_0x2eaa1a[_0x60db('0x30')];this[_0x60db('0xa')][_0x2eaa1a[_0x60db('0x20')]][_0x60db('0x31')]=_0x2eaa1a[_0x60db('0x31')];this[_0x60db('0xa')][_0x2eaa1a[_0x60db('0x20')]][_0x60db('0x1f')]=_0x2eaa1a[_0x60db('0x1f')];this[_0x60db('0xa')][_0x2eaa1a[_0x60db('0x20')]][_0x60db('0x32')]=_0x2eaa1a[_0x60db('0x32')];this[_0x60db('0xa')][_0x2eaa1a[_0x60db('0x20')]]['transferrate']=_0x2eaa1a[_0x60db('0x33')];this[_0x60db('0xa')][_0x2eaa1a[_0x60db('0x20')]][_0x60db('0x2e')]=_0x2eaa1a[_0x60db('0x2e')];this[_0x60db('0xa')][_0x2eaa1a[_0x60db('0x20')]]['calleridnum']=_0x2eaa1a[_0x60db('0x34')];if(this[_0x60db('0xa')][_0x2eaa1a[_0x60db('0x20')]][_0x60db('0x31')]>0x0){tiff2pdf(_0x2eaa1a[_0x60db('0x2e')],_0x60db('0x35'),function(_0x18a9fd){logger['info'](_0x2eaa1a[_0x60db('0x20')],'\x20result\x20conversion\x20file\x20',_0x18a9fd['message']);attachment[_0x60db('0x36')]({'name':path[_0x60db('0x37')](_0x2eaa1a['filename'])['name'],'basename':path['parse'](_0x2eaa1a[_0x60db('0x2e')])[_0x60db('0x22')]+_0x60db('0x38'),'type':_0x60db('0x39')})[_0x60db('0x3a')](function(_0x8b1f31){faxAccount[_0x60db('0x3b')](_0x542d09,{'from':_0x2eaa1a['calleridnum'],'mapKey':_0x60db('0x5'),'body':path[_0x60db('0x37')](_0x2eaa1a[_0x60db('0x2e')])[_0x60db('0x22')]+_0x60db('0x38'),'AttachmentId':_0x8b1f31['id']})['catch'](function(_0x3854ef){logger[_0x60db('0x3c')](_0x2eaa1a['uniqueid'],_0x60db('0x3d'),JSON[_0x60db('0x3e')](_0x3854ef));});})[_0x60db('0x3f')](function(_0x212bd1){logger[_0x60db('0x3c')](_0x2eaa1a[_0x60db('0x20')],_0x60db('0x40'),JSON[_0x60db('0x3e')](_0x212bd1));});});}logger[_0x60db('0x23')](_0x2eaa1a[_0x60db('0x20')],_0x60db('0x40'));}};Fax['prototype'][_0x60db('0x1b')]=function(_0x248190){if(this['actions'][_0x248190[_0x60db('0x20')]]){_[_0x60db('0x41')](this[_0x60db('0xa')][_0x248190[_0x60db('0x20')]],_[_0x60db('0x42')](_0x248190,['response',_0x60db('0x43')]));}};function updateStatus(_0x3fd527){if(_0x3fd527[_0x60db('0x44')]){faxMessage['update'](_0x3fd527['AttachmentId'],{'failMessage':_0x60db('0x45')})[_0x60db('0x3a')](function(_0xfc7d31){ut[_0x60db('0x46')](_0x60db('0x47'),_0xfc7d31);})[_0x60db('0x3f')](function(_0x1e6e84){ut[_0x60db('0x46')](_0x60db('0x48'),_0x1e6e84);});}else{ut['logger'](_0x60db('0x49'));}}Fax[_0x60db('0x25')]['updateStatus']=function(_0x43dd9e,_0xe87a07,_0x239e3e){var _0x473130=this;var _0x4049b7={};if(_0xe87a07){_0x4049b7={'read':_0xe87a07};}else{_0x4049b7={'failMessage':_0x239e3e};}if(this[_0x60db('0xd')][_0x43dd9e][_0x60db('0x44')]){faxMessage[_0x60db('0x4a')](this[_0x60db('0xd')][_0x43dd9e][_0x60db('0x44')],_0x4049b7)['then'](function(_0x5600d9){ut[_0x60db('0x46')](_0x60db('0x4b'),_0x5600d9);})[_0x60db('0x3f')](function(_0x5ec1e0){ut[_0x60db('0x46')](_0x60db('0x4c'),_0x5ec1e0);})[_0x60db('0x4d')](function(){delete _0x473130['channels'][_0x43dd9e];delete _0x473130[_0x60db('0xd')][_0x43dd9e];});}else{ut[_0x60db('0x46')]('[Fax][Message][NoUpdate2]');delete this[_0x60db('0xa')][_0x43dd9e];delete this[_0x60db('0xd')][_0x43dd9e];}};Fax[_0x60db('0x25')][_0x60db('0x4e')]=function(_0x2843ce){var _0x47125f=this;if(this[_0x60db('0xa')][_0x2843ce[_0x60db('0x20')]]){if(this[_0x60db('0xd')][_0x2843ce[_0x60db('0x20')]]){this[_0x60db('0xa')][_0x2843ce['uniqueid']]['id']=this[_0x60db('0xd')][_0x2843ce[_0x60db('0x20')]]['id'];this[_0x60db('0xa')][_0x2843ce[_0x60db('0x20')]][_0x60db('0x22')]=this[_0x60db('0xd')][_0x2843ce[_0x60db('0x20')]]['name'];}logger[_0x60db('0x23')](_0x2843ce[_0x60db('0x20')],this[_0x60db('0xd')][_0x2843ce['uniqueid']]?'\x20hangup\x20sendFile\x20':_0x60db('0x4f'),JSON[_0x60db('0x3e')](this[_0x60db('0xa')][_0x2843ce[_0x60db('0x20')]]));if(this[_0x60db('0xd')][_0x2843ce[_0x60db('0x20')]]){if(this[_0x60db('0xa')][_0x2843ce['uniqueid']][_0x60db('0x50')]>0x0&&this['channels'][_0x2843ce['uniqueid']][_0x60db('0x15')]==='SUCCESS'){this[_0x60db('0x51')](_0x2843ce[_0x60db('0x20')],!![]);}else{this[_0x60db('0x51')](_0x2843ce[_0x60db('0x20')],![],this[_0x60db('0xa')][_0x2843ce[_0x60db('0x20')]]['faxstatusstring']?_0x60db('0x52')+this[_0x60db('0xa')][_0x2843ce[_0x60db('0x20')]][_0x60db('0x53')]:_0x60db('0x54'));}}}};Fax[_0x60db('0x25')]['send']=function(_0x578da6){var _0x818962=this;return new BPromise(function(_0x4fe3e4,_0x593030){_0x818962['execOriginate'](_0x578da6,_0x818962[_0x60db('0xb')][_0x578da6[_0x60db('0x55')]])['then'](function(_0x27fad0){ut[_0x60db('0x46')]('[Fax][execOriginate][success]',_0x27fad0);_0x4fe3e4(ut['message'](_0x60db('0x56')));})[_0x60db('0x3f')](function(_0x2bfe30){ut[_0x60db('0x46')](_0x60db('0x57'),_0x2bfe30);updateStatus(_0x578da6);_0x593030(ut[_0x60db('0x58')](_0x60db('0x59')));});});};Fax[_0x60db('0x25')]['checkAfterSend']=function(_0x535236){var _0x5d0c1b=this;return new BPromise(function(_0x403bda,_0xff757a){var _0x533cc0=_0x5d0c1b[_0x60db('0x5a')](_0x5d0c1b[_0x60db('0xb')][_0x535236[_0x60db('0x55')]][_0x60db('0x5b')],_0x535236);if(_0x533cc0['isValid']){_0x403bda(ut[_0x60db('0x58')](_0x60db('0x5c')));}else{_0xff757a(ut[_0x60db('0x58')](_0x533cc0['message']));}});};function originate(_0x67c78c,_0x43a603,_0x54ce26){return new BPromise(function(_0x4d8aff,_0x1d6b96){if(_0x54ce26){var _0x431ff4=util[_0x60db('0x5d')]('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0x60db('0x37')](_0x67c78c[_0x60db('0x5e')])['name'],_0x67c78c[_0x60db('0x5e')]);gs['execute'](_0x431ff4)['then'](function(){_0x67c78c[_0x60db('0x5e')]=util[_0x60db('0x5d')](_0x60db('0x5f'),path[_0x60db('0x37')](_0x67c78c[_0x60db('0x5e')])[_0x60db('0x60')],path[_0x60db('0x37')](_0x67c78c[_0x60db('0x5e')])[_0x60db('0x22')]);_0x43a603['XMF-PATH']=_0x67c78c[_0x60db('0x5e')];ut[_0x60db('0x46')](_0x60db('0x61'),'');ami['Action'](ut[_0x60db('0x62')](_0x67c78c,_0x43a603))[_0x60db('0x3a')](function(_0x429f82){_0x4d8aff(_0x429f82);})['catch'](function(_0xa1f1a5){_0x1d6b96(_0xa1f1a5);});})['catch'](function(_0x1cb5fd){_0x1d6b96(_0x1cb5fd);});}else{ami[_0x60db('0x63')](ut[_0x60db('0x62')](_0x67c78c,_0x43a603))[_0x60db('0x3a')](function(_0x2b1ae8){_0x4d8aff(_0x2b1ae8);})[_0x60db('0x3f')](function(_0x1f598f){_0x1d6b96(_0x1f598f);});}});}Fax[_0x60db('0x25')][_0x60db('0x64')]=function(_0x53949c,_0x499a90){var _0x31a60f=this;return new BPromise(function(_0x415b0e,_0x37e485){var _0x18f53c=uuid['v4']();var _0xe9d614=ut['addVariables'](_0x53949c,_0x499a90);_0x31a60f[_0x60db('0xd')][_0x18f53c]=new Action(_0x18f53c,_0x499a90,_0x53949c);var _0xfd9165=_0x31a60f[_0x60db('0xd')][_0x18f53c];if(path[_0x60db('0x37')](_0x53949c[_0x60db('0x5e')])[_0x60db('0x65')]===_0x60db('0x38')){originate(_0xfd9165,_0xe9d614,!![])[_0x60db('0x3a')](function(_0x5929a7){_0x415b0e(_0x5929a7);})[_0x60db('0x3f')](function(_0x3e1b57){_0x37e485(_0x3e1b57);});}else{originate(_0xfd9165,_0xe9d614,![])['then'](function(_0x12dcb0){_0x415b0e(_0x12dcb0);})[_0x60db('0x3f')](function(_0x5a4ad4){_0x37e485(_0x5a4ad4);});}});};Fax[_0x60db('0x25')][_0x60db('0x66')]=function(_0x200f64){return!_[_0x60db('0x67')](_0x200f64)&&!_[_0x60db('0x67')](_0x200f64[_0x60db('0x22')])&&!_[_0x60db('0x67')](_0x200f64[_0x60db('0x68')])&&_0x200f64[_0x60db('0x68')]&&!_[_0x60db('0x67')](this[_0x60db('0xc')][util[_0x60db('0x5d')](_0x60db('0x69'),_0x200f64[_0x60db('0x22')])])&&!_[_0x60db('0x67')](this[_0x60db('0xc')][util[_0x60db('0x5d')](_0x60db('0x69'),_0x200f64[_0x60db('0x22')])][_0x60db('0x2d')])&&(this['trunks'][util[_0x60db('0x5d')](_0x60db('0x69'),_0x200f64[_0x60db('0x22')])][_0x60db('0x2d')]===_0x60db('0x6a')||this['trunks'][util[_0x60db('0x5d')](_0x60db('0x69'),_0x200f64['name'])][_0x60db('0x2d')]===_0x60db('0x6b'));};Fax[_0x60db('0x25')][_0x60db('0x5a')]=function(_0x577cbe,_0x27633f){if(!this[_0x60db('0x66')](_0x577cbe)){ut[_0x60db('0x46')]('[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]',_['isNil'](_0x577cbe)?'':_0x577cbe[_0x60db('0x22')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0x60db('0x67')](_0x27633f[_0x60db('0x5')])){ut[_0x60db('0x46')](_0x60db('0x6c'),JSON['stringify'](_0x27633f));return{'isValid':![],'message':_0x60db('0x6d')};}if(_[_0x60db('0x67')](_0x27633f['path'])){ut[_0x60db('0x46')](_0x60db('0x6e'),JSON[_0x60db('0x3e')](_0x27633f));return{'isValid':![],'message':_0x60db('0x6f')};}return{'isValid':!![],'message':_0x60db('0x70')};};module['exports']=Fax; \ No newline at end of file +var _0x4de1=['newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','from-voip-provider','faxAccounts','hasOwnProperty','localstationid','uniqueid','channels','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','status','\x20syncFaxStatus\x20','pagestransferred','resolution','transferrate','filename','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','then','catch','error','stringify','\x20receiveFax\x20','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','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','dir','XMF-PATH','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','util','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','../rpc/faxAccount','../rpc/attachment','trunks','actions','syncNewchannel','bind','syncVarSet','newstate','syncNewState'];(function(_0x31f69b,_0x577037){var _0x88237=function(_0x4e646a){while(--_0x4e646a){_0x31f69b['push'](_0x31f69b['shift']());}};_0x88237(++_0x577037);}(_0x4de1,0x1b9));var _0x14de=function(_0x1d558c,_0x1e497c){_0x1d558c=_0x1d558c-0x0;var _0x15767d=_0x4de1[_0x1d558c];return _0x15767d;};'use strict';var util=require(_0x14de('0x0'));var _=require(_0x14de('0x1'));var BPromise=require(_0x14de('0x2'));var uuid=require(_0x14de('0x3'));var moment=require(_0x14de('0x4'));var path=require(_0x14de('0x5'));var tiff2pdf=require(_0x14de('0x6'));var gs=require(_0x14de('0x7'));var logger=require(_0x14de('0x8'))(_0x14de('0x9'));var ami=require(_0x14de('0xa'));var rpcDb=require(_0x14de('0xb'));var Channel=require(_0x14de('0xc'));var ut=require(_0x14de('0xd'));var Action=require('./action');var faxAccount=require(_0x14de('0xe'));var attachment=require(_0x14de('0xf'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x55e506){this['channels']={};this['faxAccounts']=_0x55e506['faxAccounts'];this[_0x14de('0x10')]=_0x55e506['trunks'];this[_0x14de('0x11')]={};ami['on']('newchannel',this[_0x14de('0x12')][_0x14de('0x13')](this));ami['on']('varset',this[_0x14de('0x14')]['bind'](this));ami['on'](_0x14de('0x15'),this[_0x14de('0x16')][_0x14de('0x13')](this));ami['on'](_0x14de('0x17'),this[_0x14de('0x18')][_0x14de('0x13')](this));ami['on'](_0x14de('0x19'),this[_0x14de('0x1a')]['bind'](this));ami['on'](_0x14de('0x1b'),this[_0x14de('0x1c')][_0x14de('0x13')](this));ami['on'](_0x14de('0x1d'),this[_0x14de('0x1e')][_0x14de('0x13')](this));ami['on'](_0x14de('0x1f'),this[_0x14de('0x20')][_0x14de('0x13')](this));}Fax[_0x14de('0x21')][_0x14de('0x12')]=function(_0x53501f){if(_0x53501f['context']===_0x14de('0x22')){for(var _0x5847e8 in this[_0x14de('0x23')]){if(this[_0x14de('0x23')][_0x14de('0x24')](_0x5847e8)){if(_0x53501f['exten']===this[_0x14de('0x23')][_0x5847e8][_0x14de('0x25')]){this['channels'][_0x53501f[_0x14de('0x26')]]={};this[_0x14de('0x27')][_0x53501f[_0x14de('0x26')]][_0x14de('0x28')]=_0x53501f[_0x14de('0x28')];this[_0x14de('0x27')][_0x53501f['uniqueid']]['id']=this[_0x14de('0x23')][_0x5847e8]['id'];this[_0x14de('0x27')][_0x53501f[_0x14de('0x26')]]['name']=this['faxAccounts'][_0x5847e8][_0x14de('0x29')];logger[_0x14de('0x2a')](_0x53501f[_0x14de('0x26')],_0x14de('0x2b'));}}}}if(this[_0x14de('0x11')][_0x53501f[_0x14de('0x26')]]){this['channels'][_0x53501f['uniqueid']]={};this['channels'][_0x53501f[_0x14de('0x26')]][_0x14de('0x28')]=_0x53501f[_0x14de('0x28')];logger['info'](_0x53501f[_0x14de('0x26')],_0x14de('0x2b'));}};Fax[_0x14de('0x21')][_0x14de('0x14')]=function(_0x456396){if(this[_0x14de('0x27')][_0x456396['uniqueid']]){for(var _0x26237d in _0x456396[_0x14de('0x2c')]){if(_0x456396['variable']['hasOwnProperty'](_0x26237d)){this[_0x14de('0x27')][_0x456396[_0x14de('0x26')]][_0x26237d]=_0x456396[_0x14de('0x2d')];}}}};Fax[_0x14de('0x21')][_0x14de('0x16')]=function(_0x3a5f59){if(this[_0x14de('0x27')][_0x3a5f59[_0x14de('0x26')]]){this[_0x14de('0x27')][_0x3a5f59[_0x14de('0x26')]][_0x14de('0x2e')]=_0x3a5f59[_0x14de('0x2e')];this[_0x14de('0x27')][_0x3a5f59[_0x14de('0x26')]][_0x14de('0x2f')]=_0x3a5f59[_0x14de('0x2f')];}};Fax[_0x14de('0x21')][_0x14de('0x18')]=function(_0x1f8209){if(this[_0x14de('0x27')][_0x1f8209[_0x14de('0x26')]]){for(var _0x319919 in _0x1f8209[_0x14de('0x2c')]){if(_0x1f8209['variable']['hasOwnProperty'](_0x319919)){this[_0x14de('0x27')][_0x1f8209[_0x14de('0x26')]][_0x319919]=_0x1f8209[_0x14de('0x2d')];}}}};Fax[_0x14de('0x21')]['syncFaxStatus']=function(_0x309167){if(this['channels'][_0x309167['uniqueid']]){this[_0x14de('0x27')][_0x309167[_0x14de('0x26')]][_0x14de('0x30')]=_0x309167['operation'];this[_0x14de('0x27')][_0x309167[_0x14de('0x26')]][_0x14de('0x31')]=_0x309167[_0x14de('0x31')];this[_0x14de('0x27')][_0x309167[_0x14de('0x26')]][_0x14de('0x25')]=_0x309167[_0x14de('0x25')];this['channels'][_0x309167['uniqueid']]['filename']=_0x309167['filename'];logger[_0x14de('0x2a')](_0x309167[_0x14de('0x26')],_0x14de('0x32'));}};Fax[_0x14de('0x21')][_0x14de('0x1c')]=function(_0x566d62){var _0x433e45=this;if(this[_0x14de('0x27')][_0x566d62[_0x14de('0x26')]]){var _0x1e13a=this[_0x14de('0x27')][_0x566d62[_0x14de('0x26')]]['id'];this[_0x14de('0x27')][_0x566d62[_0x14de('0x26')]]['remotestationid']=_0x566d62['remotestationid'];this[_0x14de('0x27')][_0x566d62[_0x14de('0x26')]][_0x14de('0x33')]=_0x566d62[_0x14de('0x33')];this[_0x14de('0x27')][_0x566d62['uniqueid']][_0x14de('0x25')]=_0x566d62[_0x14de('0x25')];this[_0x14de('0x27')][_0x566d62[_0x14de('0x26')]]['resolution']=_0x566d62[_0x14de('0x34')];this[_0x14de('0x27')][_0x566d62[_0x14de('0x26')]][_0x14de('0x35')]=_0x566d62[_0x14de('0x35')];this[_0x14de('0x27')][_0x566d62[_0x14de('0x26')]][_0x14de('0x36')]=_0x566d62[_0x14de('0x36')];this['channels'][_0x566d62[_0x14de('0x26')]][_0x14de('0x37')]=_0x566d62['calleridnum'];if(this[_0x14de('0x27')][_0x566d62['uniqueid']][_0x14de('0x33')]>0x0){tiff2pdf(_0x566d62[_0x14de('0x36')],_0x14de('0x38'),function(_0x551989){logger['info'](_0x566d62['uniqueid'],_0x14de('0x39'),_0x551989[_0x14de('0x3a')]);attachment[_0x14de('0x3b')]({'name':path[_0x14de('0x3c')](_0x566d62[_0x14de('0x36')])[_0x14de('0x29')],'basename':path['parse'](_0x566d62[_0x14de('0x36')])[_0x14de('0x29')]+_0x14de('0x3d'),'type':'application/pdf'})[_0x14de('0x3e')](function(_0x4be546){faxAccount['notify'](_0x1e13a,{'from':_0x566d62[_0x14de('0x37')],'mapKey':'fax','body':path['parse'](_0x566d62[_0x14de('0x36')])[_0x14de('0x29')]+'.pdf','AttachmentId':_0x4be546['id']})[_0x14de('0x3f')](function(_0x75f6cd){logger[_0x14de('0x40')](_0x566d62[_0x14de('0x26')],'\x20notify\x20',JSON[_0x14de('0x41')](_0x75f6cd));});})[_0x14de('0x3f')](function(_0x11bdc0){logger[_0x14de('0x40')](_0x566d62[_0x14de('0x26')],_0x14de('0x42'),JSON[_0x14de('0x41')](_0x11bdc0));});});}logger[_0x14de('0x2a')](_0x566d62['uniqueid'],_0x14de('0x42'));}};Fax[_0x14de('0x21')]['syncOriginateResponse']=function(_0x468d6a){if(this[_0x14de('0x11')][_0x468d6a[_0x14de('0x26')]]){_['merge'](this[_0x14de('0x27')][_0x468d6a[_0x14de('0x26')]],_[_0x14de('0x43')](_0x468d6a,[_0x14de('0x44'),_0x14de('0x45')]));}};function updateStatus(_0x23f48e){if(_0x23f48e[_0x14de('0x46')]){faxMessage[_0x14de('0x47')](_0x23f48e[_0x14de('0x46')],{'failMessage':_0x14de('0x48')})[_0x14de('0x3e')](function(_0x33a309){ut[_0x14de('0x49')](_0x14de('0x4a'),_0x33a309);})[_0x14de('0x3f')](function(_0x438df0){ut[_0x14de('0x49')](_0x14de('0x4b'),_0x438df0);});}else{ut['logger'](_0x14de('0x4c'));}}Fax[_0x14de('0x21')][_0x14de('0x4d')]=function(_0x3a12d9,_0x3a6329,_0x367f83){var _0x2b2b86=this;var _0x3cb725={};if(_0x3a6329){_0x3cb725={'read':_0x3a6329};}else{_0x3cb725={'failMessage':_0x367f83};}if(this[_0x14de('0x11')][_0x3a12d9][_0x14de('0x46')]){faxMessage[_0x14de('0x47')](this[_0x14de('0x11')][_0x3a12d9][_0x14de('0x46')],_0x3cb725)[_0x14de('0x3e')](function(_0x2c9e4f){ut[_0x14de('0x49')]('[Fax][Message][Updated]',_0x2c9e4f);})[_0x14de('0x3f')](function(_0x1d9221){ut[_0x14de('0x49')](_0x14de('0x4e'),_0x1d9221);})[_0x14de('0x4f')](function(){delete _0x2b2b86[_0x14de('0x27')][_0x3a12d9];delete _0x2b2b86[_0x14de('0x11')][_0x3a12d9];});}else{ut[_0x14de('0x49')](_0x14de('0x50'));delete this[_0x14de('0x27')][_0x3a12d9];delete this[_0x14de('0x11')][_0x3a12d9];}};Fax[_0x14de('0x21')][_0x14de('0x1e')]=function(_0x3c2d3c){var _0x1d2555=this;if(this[_0x14de('0x27')][_0x3c2d3c[_0x14de('0x26')]]){if(this['actions'][_0x3c2d3c[_0x14de('0x26')]]){this[_0x14de('0x27')][_0x3c2d3c['uniqueid']]['id']=this['actions'][_0x3c2d3c[_0x14de('0x26')]]['id'];this[_0x14de('0x27')][_0x3c2d3c[_0x14de('0x26')]][_0x14de('0x29')]=this['actions'][_0x3c2d3c[_0x14de('0x26')]][_0x14de('0x29')];}logger['info'](_0x3c2d3c[_0x14de('0x26')],this['actions'][_0x3c2d3c[_0x14de('0x26')]]?_0x14de('0x51'):_0x14de('0x52'),JSON[_0x14de('0x41')](this[_0x14de('0x27')][_0x3c2d3c[_0x14de('0x26')]]));if(this[_0x14de('0x11')][_0x3c2d3c[_0x14de('0x26')]]){if(this[_0x14de('0x27')][_0x3c2d3c[_0x14de('0x26')]][_0x14de('0x53')]>0x0&&this['channels'][_0x3c2d3c[_0x14de('0x26')]][_0x14de('0x19')]===_0x14de('0x54')){this['updateStatus'](_0x3c2d3c[_0x14de('0x26')],!![]);}else{this['updateStatus'](_0x3c2d3c['uniqueid'],![],this['channels'][_0x3c2d3c[_0x14de('0x26')]][_0x14de('0x55')]?_0x14de('0x56')+this[_0x14de('0x27')][_0x3c2d3c[_0x14de('0x26')]][_0x14de('0x55')]:_0x14de('0x57'));}}}};Fax[_0x14de('0x21')]['send']=function(_0x340996){var _0x34af1e=this;return new BPromise(function(_0x5dc910,_0x2c29fb){_0x34af1e[_0x14de('0x58')](_0x340996,_0x34af1e[_0x14de('0x23')][_0x340996[_0x14de('0x59')]])[_0x14de('0x3e')](function(_0x34abb5){ut[_0x14de('0x49')]('[Fax][execOriginate][success]',_0x34abb5);_0x5dc910(ut[_0x14de('0x3a')](_0x14de('0x5a')));})[_0x14de('0x3f')](function(_0x49f74b){ut[_0x14de('0x49')](_0x14de('0x5b'),_0x49f74b);updateStatus(_0x340996);_0x2c29fb(ut[_0x14de('0x3a')](_0x14de('0x5c')));});});};Fax[_0x14de('0x21')]['checkAfterSend']=function(_0x1d30af){var _0x4999cf=this;return new BPromise(function(_0x673e59,_0x105423){var _0x4ca1d4=_0x4999cf[_0x14de('0x5d')](_0x4999cf[_0x14de('0x23')][_0x1d30af['FaxAccountId']][_0x14de('0x5e')],_0x1d30af);if(_0x4ca1d4[_0x14de('0x5f')]){_0x673e59(ut[_0x14de('0x3a')](_0x14de('0x60')));}else{_0x105423(ut['message'](_0x4ca1d4[_0x14de('0x3a')]));}});};function originate(_0x2c3301,_0x5519c9,_0x31c02e){return new BPromise(function(_0x390f26,_0x37aa70){if(_0x31c02e){var _0x5dd2ba=util[_0x14de('0x61')](_0x14de('0x62'),path[_0x14de('0x3c')](_0x2c3301[_0x14de('0x5')])['name'],_0x2c3301[_0x14de('0x5')]);gs[_0x14de('0x63')](_0x5dd2ba)[_0x14de('0x3e')](function(){_0x2c3301[_0x14de('0x5')]=util[_0x14de('0x61')]('%s/%s.tif',path[_0x14de('0x3c')](_0x2c3301[_0x14de('0x5')])[_0x14de('0x64')],path[_0x14de('0x3c')](_0x2c3301[_0x14de('0x5')])[_0x14de('0x29')]);_0x5519c9[_0x14de('0x65')]=_0x2c3301[_0x14de('0x5')];ut[_0x14de('0x49')]('Convert\x20pdf\x20to\x20tif','');ami[_0x14de('0x66')](ut[_0x14de('0x67')](_0x2c3301,_0x5519c9))[_0x14de('0x3e')](function(_0xa8ba59){_0x390f26(_0xa8ba59);})[_0x14de('0x3f')](function(_0x45b310){_0x37aa70(_0x45b310);});})[_0x14de('0x3f')](function(_0xceb6b7){_0x37aa70(_0xceb6b7);});}else{ami[_0x14de('0x66')](ut[_0x14de('0x67')](_0x2c3301,_0x5519c9))[_0x14de('0x3e')](function(_0x1bd017){_0x390f26(_0x1bd017);})[_0x14de('0x3f')](function(_0x5d1e87){_0x37aa70(_0x5d1e87);});}});}Fax[_0x14de('0x21')][_0x14de('0x58')]=function(_0x9e4341,_0x3626f4){var _0x4a16cc=this;return new BPromise(function(_0x3a27d5,_0xb9672e){var _0x180922=uuid['v4']();var _0x15a54f=ut[_0x14de('0x68')](_0x9e4341,_0x3626f4);_0x4a16cc[_0x14de('0x11')][_0x180922]=new Action(_0x180922,_0x3626f4,_0x9e4341);var _0x4da41b=_0x4a16cc[_0x14de('0x11')][_0x180922];if(path['parse'](_0x9e4341[_0x14de('0x5')])[_0x14de('0x69')]==='.pdf'){originate(_0x4da41b,_0x15a54f,!![])[_0x14de('0x3e')](function(_0xb148fa){_0x3a27d5(_0xb148fa);})[_0x14de('0x3f')](function(_0x367792){_0xb9672e(_0x367792);});}else{originate(_0x4da41b,_0x15a54f,![])['then'](function(_0x6286d1){_0x3a27d5(_0x6286d1);})['catch'](function(_0x5ca41a){_0xb9672e(_0x5ca41a);});}});};Fax[_0x14de('0x21')][_0x14de('0x6a')]=function(_0x513e33){return!_[_0x14de('0x6b')](_0x513e33)&&!_[_0x14de('0x6b')](_0x513e33[_0x14de('0x29')])&&!_[_0x14de('0x6b')](_0x513e33['active'])&&_0x513e33[_0x14de('0x6c')]&&!_[_0x14de('0x6b')](this[_0x14de('0x10')][util[_0x14de('0x61')](_0x14de('0x6d'),_0x513e33['name'])])&&!_['isNil'](this['trunks'][util[_0x14de('0x61')](_0x14de('0x6d'),_0x513e33['name'])][_0x14de('0x31')])&&(this[_0x14de('0x10')][util[_0x14de('0x61')]('SIP/%s',_0x513e33[_0x14de('0x29')])]['status']==='reachable'||this[_0x14de('0x10')][util[_0x14de('0x61')](_0x14de('0x6d'),_0x513e33[_0x14de('0x29')])][_0x14de('0x31')]==='unmonitored');};Fax['prototype'][_0x14de('0x5d')]=function(_0x5322b2,_0x5c6b7b){if(!this[_0x14de('0x6a')](_0x5322b2)){ut[_0x14de('0x49')](_0x14de('0x6e'),_[_0x14de('0x6b')](_0x5322b2)?'':_0x5322b2[_0x14de('0x29')]+_0x14de('0x6f'));return{'isValid':![],'message':_0x14de('0x70')};}if(_[_0x14de('0x6b')](_0x5c6b7b[_0x14de('0x9')])){ut[_0x14de('0x49')](_0x14de('0x71'),JSON[_0x14de('0x41')](_0x5c6b7b));return{'isValid':![],'message':_0x14de('0x72')};}if(_[_0x14de('0x6b')](_0x5c6b7b[_0x14de('0x5')])){ut[_0x14de('0x49')](_0x14de('0x73'),JSON[_0x14de('0x41')](_0x5c6b7b));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':'Is\x20Valid'};};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 049cc3e..2e5ad88 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 _0x73d3=['notify','resolve','then','catch','[Notify]\x20','util','bluebird','../../../config/logger','preview','../rpc/faxAccount','inspect'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x73d3,0xb5));var _0x373d=function(_0x48aae4,_0x461608){_0x48aae4=_0x48aae4-0x0;var _0x51a05b=_0x73d3[_0x48aae4];return _0x51a05b;};'use strict';var util=require(_0x373d('0x0'));var BPromise=require(_0x373d('0x1'));var logger=require(_0x373d('0x2'))(_0x373d('0x3'));var _=require('lodash');var faxAccount=require(_0x373d('0x4'));function loggerCatch(_0x599617){return function(_0x5d91cf){logger['error'](_0x599617,util[_0x373d('0x5')](_0x5d91cf,{'showHidden':![],'depth':null}));};}exports[_0x373d('0x6')]=function(_0x4bc5f9,_0x212b6f){return BPromise[_0x373d('0x7')]()[_0x373d('0x8')](faxAccount[_0x373d('0x6')](_0x4bc5f9,_0x212b6f))[_0x373d('0x9')](loggerCatch(_0x373d('0xa')));}; \ No newline at end of file +var _0x95cc=['../../../config/logger','../rpc/faxAccount','error','inspect','notify','resolve','then','catch','[Notify]\x20','util','bluebird'];(function(_0x4e822d,_0x4f74eb){var _0x1194e0=function(_0x4feb08){while(--_0x4feb08){_0x4e822d['push'](_0x4e822d['shift']());}};_0x1194e0(++_0x4f74eb);}(_0x95cc,0x1c1));var _0xc95c=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0x95cc[_0x1c8c28];return _0x1f59b4;};'use strict';var util=require(_0xc95c('0x0'));var BPromise=require(_0xc95c('0x1'));var logger=require(_0xc95c('0x2'))('preview');var _=require('lodash');var faxAccount=require(_0xc95c('0x3'));function loggerCatch(_0x163f1b){return function(_0x4a4132){logger[_0xc95c('0x4')](_0x163f1b,util[_0xc95c('0x5')](_0x4a4132,{'showHidden':![],'depth':null}));};}exports[_0xc95c('0x6')]=function(_0xe95a7a,_0x250136){return BPromise[_0xc95c('0x7')]()[_0xc95c('0x8')](faxAccount['notify'](_0xe95a7a,_0x250136))[_0xc95c('0x9')](loggerCatch(_0xc95c('0xa')));}; \ 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 b9fb91f..f0716f4 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 _0x0e49=['\x20Error\x20:','util','../../../../config/logger','fax','bluebird','child_process','exec','execute','info','Exec\x20gs'];(function(_0x316efa,_0x20a1e1){var _0x4d96cc=function(_0x4a0648){while(--_0x4a0648){_0x316efa['push'](_0x316efa['shift']());}};_0x4d96cc(++_0x20a1e1);}(_0x0e49,0x173));var _0x90e4=function(_0x5b46be,_0x1b24f1){_0x5b46be=_0x5b46be-0x0;var _0xb01664=_0x0e49[_0x5b46be];return _0xb01664;};'use strict';var util=require(_0x90e4('0x0'));var logger=require(_0x90e4('0x1'))(_0x90e4('0x2'));var BPromise=require(_0x90e4('0x3'));var exec=require(_0x90e4('0x4'))[_0x90e4('0x5')];exports[_0x90e4('0x6')]=function(_0x171948){return new BPromise(function(_0x6c75dd,_0x324a41){exec(_0x171948,function(_0x3b143b,_0x921027,_0x5aa690){logger['info']('Exec\x20gs',_0x921027);if(_0x3b143b){logger[_0x90e4('0x7')](_0x90e4('0x8'),_0x90e4('0x9'),util['inspect'](_0x3b143b,{'showHidden':![],'depth':null}),_0x921027,_0x5aa690);_0x324a41(_0x3b143b);}_0x6c75dd(_0x921027);});});}; \ No newline at end of file +var _0x6330=['exec','execute','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','bluebird','child_process'];(function(_0x2aadeb,_0x149a61){var _0x22cb44=function(_0x59c028){while(--_0x59c028){_0x2aadeb['push'](_0x2aadeb['shift']());}};_0x22cb44(++_0x149a61);}(_0x6330,0x188));var _0x0633=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0x6330[_0x4d07cc];return _0x42de3b;};'use strict';var util=require(_0x0633('0x0'));var logger=require(_0x0633('0x1'))('fax');var BPromise=require(_0x0633('0x2'));var exec=require(_0x0633('0x3'))[_0x0633('0x4')];exports[_0x0633('0x5')]=function(_0x34418f){return new BPromise(function(_0x1b404a,_0x7c9bbd){exec(_0x34418f,function(_0xe69d55,_0x15e2e9,_0x254ae1){logger['info'](_0x0633('0x6'),_0x15e2e9);if(_0xe69d55){logger['info'](_0x0633('0x6'),_0x0633('0x7'),util[_0x0633('0x8')](_0xe69d55,{'showHidden':![],'depth':null}),_0x15e2e9,_0x254ae1);_0x7c9bbd(_0xe69d55);}_0x1b404a(_0x15e2e9);});});}; \ 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 01fccff..ca27efe 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 _0x4375=['inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','gateway','t38timeout','localstationid','path','variablesAction','uniqueid','channel','xcally-motion-fax','util','lodash','moment','fax','message','info'];(function(_0x4f9fb5,_0x2b541e){var _0x38ab96=function(_0x524d06){while(--_0x524d06){_0x4f9fb5['push'](_0x4f9fb5['shift']());}};_0x38ab96(++_0x2b541e);}(_0x4375,0x198));var _0x5437=function(_0xf54765,_0x5c8b85){_0xf54765=_0xf54765-0x0;var _0x1e683a=_0x4375[_0xf54765];return _0x1e683a;};'use strict';var util=require(_0x5437('0x0'));var _=require(_0x5437('0x1'));var moment=require(_0x5437('0x2'));var logger=require('../../../../config/logger')(_0x5437('0x3'));exports[_0x5437('0x4')]=function(_0x25a5be){return{'message':_0x25a5be};};exports['logger']=function(_0x13e726,_0x4314f1){logger[_0x5437('0x5')](_0x13e726,util[_0x5437('0x6')](_0x4314f1,{'showHidden':![],'depth':null}));};exports[_0x5437('0x7')]=function(_0x5668b3,_0x4604a5){var _0x35bf95={'XMF-ECM':_0x4604a5[_0x5437('0x8')],'XMF-HEADERINFO':_0x4604a5[_0x5437('0x9')],'XMF-MINRATE':_0x4604a5[_0x5437('0xa')],'XMF-MAXRATE':_0x4604a5[_0x5437('0xb')],'XMF-MODEM':util[_0x5437('0xc')](_0x5437('0xd'),_0x4604a5[_0x5437('0xe')]),'XMF-GATEWAY':_0x4604a5[_0x5437('0xf')],'XMF-FAXDETECT':_0x4604a5['faxdetect'],'XMF-T38TIMEOUT':_0x4604a5[_0x5437('0x10')],'XMF-LOCALSTATIONID':_0x4604a5[_0x5437('0x11')],'XMF-PATH':_0x5668b3[_0x5437('0x12')]};return _0x35bf95;};exports[_0x5437('0x13')]=function(_0x1dfcda,_0x14a25c){return{'actionid':_0x1dfcda[_0x5437('0x14')],'action':'originate','channel':_0x1dfcda[_0x5437('0x15')],'Exten':_0x5437('0x16'),'Context':'from-sip','Priority':'1','callerid':util[_0x5437('0xc')]('\x22%s\x22\x20<%s>',_0x1dfcda[_0x5437('0x9')]?_0x1dfcda[_0x5437('0x9')]:'',_0x1dfcda[_0x5437('0x11')]),'variable':_0x14a25c,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1dfcda[_0x5437('0x14')]};}; \ No newline at end of file +var _0xfe92=['path','variablesAction','originate','xcally-motion-fax','format','headerinfo','util','lodash','../../../../config/logger','fax','logger','addVariables','ecm','\x22%s\x22','t38timeout','localstationid'];(function(_0x38b575,_0x1f33cf){var _0x53f0c8=function(_0x2bf959){while(--_0x2bf959){_0x38b575['push'](_0x38b575['shift']());}};_0x53f0c8(++_0x1f33cf);}(_0xfe92,0x86));var _0x2fe9=function(_0x216327,_0x5482e3){_0x216327=_0x216327-0x0;var _0x4f152b=_0xfe92[_0x216327];return _0x4f152b;};'use strict';var util=require(_0x2fe9('0x0'));var _=require(_0x2fe9('0x1'));var moment=require('moment');var logger=require(_0x2fe9('0x2'))(_0x2fe9('0x3'));exports['message']=function(_0x577cb5){return{'message':_0x577cb5};};exports[_0x2fe9('0x4')]=function(_0x45a085,_0x1f3829){logger['info'](_0x45a085,util['inspect'](_0x1f3829,{'showHidden':![],'depth':null}));};exports[_0x2fe9('0x5')]=function(_0x1828f9,_0x4de12c){var _0x41cf2e={'XMF-ECM':_0x4de12c[_0x2fe9('0x6')],'XMF-HEADERINFO':_0x4de12c['headerinfo'],'XMF-MINRATE':_0x4de12c['minrate'],'XMF-MAXRATE':_0x4de12c['maxrate'],'XMF-MODEM':util['format'](_0x2fe9('0x7'),_0x4de12c['modem']),'XMF-GATEWAY':_0x4de12c['gateway'],'XMF-FAXDETECT':_0x4de12c['faxdetect'],'XMF-T38TIMEOUT':_0x4de12c[_0x2fe9('0x8')],'XMF-LOCALSTATIONID':_0x4de12c[_0x2fe9('0x9')],'XMF-PATH':_0x1828f9[_0x2fe9('0xa')]};return _0x41cf2e;};exports[_0x2fe9('0xb')]=function(_0x10883e,_0x37e64b){return{'actionid':_0x10883e['uniqueid'],'action':_0x2fe9('0xc'),'channel':_0x10883e['channel'],'Exten':_0x2fe9('0xd'),'Context':'from-sip','Priority':'1','callerid':util[_0x2fe9('0xe')]('\x22%s\x22\x20<%s>',_0x10883e['headerinfo']?_0x10883e[_0x2fe9('0xf')]:'',_0x10883e[_0x2fe9('0x9')]),'variable':_0x37e64b,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x10883e['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 89f5ae3..62ecd88 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 _0x119e=['./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getAgents','getTelephones','initTelephones','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','inspect','listen','error','[index.js][main]','util','moment','./server','./realtime','./report','./acw','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign'];(function(_0x2bda14,_0x4fab1b){var _0xb5dd49=function(_0x1da71e){while(--_0x1da71e){_0x2bda14['push'](_0x2bda14['shift']());}};_0xb5dd49(++_0x4fab1b);}(_0x119e,0x106));var _0xe119=function(_0xdbe226,_0x408c56){_0xdbe226=_0xdbe226-0x0;var _0x33648d=_0x119e[_0xdbe226];return _0x33648d;};'use strict';var util=require(_0xe119('0x0'));var moment=require(_0xe119('0x1'));var server=require(_0xe119('0x2'));var Realtime=require(_0xe119('0x3'));var Report=require(_0xe119('0x4'));var Acw=require(_0xe119('0x5'));var Trigger=require('./trigger');var Dialer=require(_0xe119('0x6'));var Preview=require(_0xe119('0x7'));var Fax=require(_0xe119('0x8'));var user=require(_0xe119('0x9'));var voiceQueue=require(_0xe119('0xa'));var voiceQueueReport=require(_0xe119('0xb'));var voiceCallReport=require(_0xe119('0xc'));var trunk=require(_0xe119('0xd'));var trigger=require(_0xe119('0xe'));var template=require(_0xe119('0xf'));var cmHopperHistory=require(_0xe119('0x10'));var campaign=require(_0xe119('0x11'));var voiceExtension=require(_0xe119('0x12'));var faxAccount=require(_0xe119('0x13'));var zendesk=require(_0xe119('0x14'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xe119('0x15'));var freshdesk=require(_0xe119('0x16'));var desk=require('./rpc/integrations/desk');var zoho=require(_0xe119('0x17'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0xe119('0x18'));var servicenow=require(_0xe119('0x19'));var dynamics365=require(_0xe119('0x1a'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0xe119('0x1b'))(_0xe119('0x1c'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xe119('0x1d')](_0xe119('0x1e'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0xe119('0x1e'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0xe119('0x1f')]()[_0xe119('0x20')](user[_0xe119('0x21')]())[_0xe119('0x20')](realtime['initAgents']())[_0xe119('0x20')](user[_0xe119('0x22')]())[_0xe119('0x20')](realtime[_0xe119('0x23')]())[_0xe119('0x20')](trunk['getTrunks']())[_0xe119('0x20')](realtime[_0xe119('0x24')]())[_0xe119('0x20')](voiceQueue[_0xe119('0x25')]())['then'](realtime[_0xe119('0x26')]())[_0xe119('0x20')](trigger[_0xe119('0x27')]())[_0xe119('0x20')](realtime[_0xe119('0x28')]())[_0xe119('0x20')](template['getTemplates']())[_0xe119('0x20')](realtime['initTemplates']())[_0xe119('0x20')](zendesk[_0xe119('0x29')]())['then'](realtime[_0xe119('0x2a')]())[_0xe119('0x20')](salesforce[_0xe119('0x2b')]())[_0xe119('0x20')](realtime[_0xe119('0x2c')]())['then'](sugarcrm[_0xe119('0x2d')]())[_0xe119('0x20')](realtime[_0xe119('0x2e')]())['then'](freshdesk['getFreshdeskAccounts']())[_0xe119('0x20')](realtime[_0xe119('0x2f')]())['then'](desk[_0xe119('0x30')]())[_0xe119('0x20')](realtime[_0xe119('0x31')]())['then'](zoho['getZohoAccounts']())[_0xe119('0x20')](realtime[_0xe119('0x32')]())['then'](vtiger['getVtigerAccounts']())['then'](realtime[_0xe119('0x33')]())[_0xe119('0x20')](freshsales[_0xe119('0x34')]())['then'](realtime['initFreshsalesAccounts']())['then'](servicenow['getServicenowAccounts']())[_0xe119('0x20')](realtime[_0xe119('0x35')]())[_0xe119('0x20')](dynamics365[_0xe119('0x36')]())['then'](realtime[_0xe119('0x37')]())['then'](campaign[_0xe119('0x38')]())[_0xe119('0x20')](realtime['initCampaigns']())[_0xe119('0x20')](voiceExtension[_0xe119('0x39')]())[_0xe119('0x20')](realtime[_0xe119('0x3a')]())['then'](faxAccount['getFaxAccounts']())[_0xe119('0x20')](realtime[_0xe119('0x3b')]())['then'](function(){return realtime;});}function initParams(){return Promise[_0xe119('0x1f')]()[_0xe119('0x20')](voiceQueueReport['getVoiceQueueReports']())[_0xe119('0x20')](realtime['initVoiceQueueReports']())[_0xe119('0x20')](cmHopperHistory['getVoiceQueueHopperHistory']())['then'](realtime[_0xe119('0x3c')]())[_0xe119('0x20')](cmHopperHistory[_0xe119('0x3d')]())[_0xe119('0x20')](realtime[_0xe119('0x3e')]())[_0xe119('0x20')](voiceCallReport[_0xe119('0x3f')]())['then'](realtime[_0xe119('0x40')]())[_0xe119('0x41')](function(_0x12fc6c){logger['error']('[index.js][initParams]',util[_0xe119('0x42')](_0x12fc6c,{'showHidden':![],'depth':null}));});}function main(){return server[_0xe119('0x43')](realtime,preview,fax)[_0xe119('0x20')](function(){return initRealtime();})[_0xe119('0x20')](function(){return initParams();})[_0xe119('0x20')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0xe119('0x41')](function(_0x3b55db){logger[_0xe119('0x44')](_0xe119('0x45'),util[_0xe119('0x42')](_0x3b55db,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x1e53=['initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','inspect','listen','sync','[index.js][main]','moment','./server','./report','./acw','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initVoiceQueueReports'];(function(_0x229be5,_0x9156f6){var _0x326189=function(_0x2cca17){while(--_0x2cca17){_0x229be5['push'](_0x229be5['shift']());}};_0x326189(++_0x9156f6);}(_0x1e53,0x177));var _0x31e5=function(_0x4d26af,_0x2f07e6){_0x4d26af=_0x4d26af-0x0;var _0x4d6d3c=_0x1e53[_0x4d26af];return _0x4d6d3c;};'use strict';var util=require('util');var moment=require(_0x31e5('0x0'));var server=require(_0x31e5('0x1'));var Realtime=require('./realtime');var Report=require(_0x31e5('0x2'));var Acw=require(_0x31e5('0x3'));var Trigger=require('./trigger');var Dialer=require(_0x31e5('0x4'));var Preview=require(_0x31e5('0x5'));var Fax=require(_0x31e5('0x6'));var user=require(_0x31e5('0x7'));var voiceQueue=require(_0x31e5('0x8'));var voiceQueueReport=require(_0x31e5('0x9'));var voiceCallReport=require(_0x31e5('0xa'));var trunk=require(_0x31e5('0xb'));var trigger=require(_0x31e5('0xc'));var template=require(_0x31e5('0xd'));var cmHopperHistory=require(_0x31e5('0xe'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0x31e5('0xf'));var faxAccount=require(_0x31e5('0x10'));var zendesk=require(_0x31e5('0x11'));var salesforce=require(_0x31e5('0x12'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x31e5('0x13'));var desk=require(_0x31e5('0x14'));var zoho=require(_0x31e5('0x15'));var vtiger=require(_0x31e5('0x16'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x31e5('0x17'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x31e5('0x18'))(_0x31e5('0x19'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x31e5('0x1a')](_0x31e5('0x1b'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x31e5('0x1a')](_0x31e5('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x31e5('0x1c')]()[_0x31e5('0x1d')](user[_0x31e5('0x1e')]())['then'](realtime[_0x31e5('0x1f')]())['then'](user[_0x31e5('0x20')]())[_0x31e5('0x1d')](realtime[_0x31e5('0x21')]())[_0x31e5('0x1d')](trunk[_0x31e5('0x22')]())['then'](realtime[_0x31e5('0x23')]())['then'](voiceQueue['getVoiceQueues']())[_0x31e5('0x1d')](realtime['initVoiceQueues']())[_0x31e5('0x1d')](trigger[_0x31e5('0x24')]())[_0x31e5('0x1d')](realtime[_0x31e5('0x25')]())[_0x31e5('0x1d')](template[_0x31e5('0x26')]())['then'](realtime[_0x31e5('0x27')]())[_0x31e5('0x1d')](zendesk[_0x31e5('0x28')]())[_0x31e5('0x1d')](realtime[_0x31e5('0x29')]())[_0x31e5('0x1d')](salesforce[_0x31e5('0x2a')]())[_0x31e5('0x1d')](realtime['initSalesforceAccounts']())[_0x31e5('0x1d')](sugarcrm['getSugarcrmAccounts']())[_0x31e5('0x1d')](realtime[_0x31e5('0x2b')]())[_0x31e5('0x1d')](freshdesk[_0x31e5('0x2c')]())['then'](realtime[_0x31e5('0x2d')]())[_0x31e5('0x1d')](desk[_0x31e5('0x2e')]())[_0x31e5('0x1d')](realtime[_0x31e5('0x2f')]())['then'](zoho[_0x31e5('0x30')]())[_0x31e5('0x1d')](realtime[_0x31e5('0x31')]())[_0x31e5('0x1d')](vtiger[_0x31e5('0x32')]())[_0x31e5('0x1d')](realtime['initVtigerAccounts']())[_0x31e5('0x1d')](freshsales[_0x31e5('0x33')]())[_0x31e5('0x1d')](realtime[_0x31e5('0x34')]())[_0x31e5('0x1d')](servicenow[_0x31e5('0x35')]())[_0x31e5('0x1d')](realtime[_0x31e5('0x36')]())[_0x31e5('0x1d')](dynamics365[_0x31e5('0x37')]())[_0x31e5('0x1d')](realtime[_0x31e5('0x38')]())['then'](campaign[_0x31e5('0x39')]())[_0x31e5('0x1d')](realtime[_0x31e5('0x3a')]())[_0x31e5('0x1d')](voiceExtension[_0x31e5('0x3b')]())['then'](realtime[_0x31e5('0x3c')]())[_0x31e5('0x1d')](faxAccount[_0x31e5('0x3d')]())['then'](realtime['initFaxAccounts']())[_0x31e5('0x1d')](function(){return realtime;});}function initParams(){return Promise['resolve']()['then'](voiceQueueReport['getVoiceQueueReports']())[_0x31e5('0x1d')](realtime[_0x31e5('0x3e')]())[_0x31e5('0x1d')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x31e5('0x1d')](realtime[_0x31e5('0x3f')]())[_0x31e5('0x1d')](cmHopperHistory['getCampaignHopperHistory']())[_0x31e5('0x1d')](realtime[_0x31e5('0x40')]())['then'](voiceCallReport[_0x31e5('0x41')]())['then'](realtime[_0x31e5('0x42')]())[_0x31e5('0x43')](function(_0x1c89c3){logger[_0x31e5('0x44')]('[index.js][initParams]',util[_0x31e5('0x45')](_0x1c89c3,{'showHidden':![],'depth':null}));});}function main(){return server[_0x31e5('0x46')](realtime,preview,fax)[_0x31e5('0x1d')](function(){return initRealtime();})[_0x31e5('0x1d')](function(){return initParams();})[_0x31e5('0x1d')](function(){report[_0x31e5('0x47')]();setInterval(initRealtime,0x1388);})[_0x31e5('0x43')](function(_0x2b4fd9){logger[_0x31e5('0x44')](_0x31e5('0x48'),util['inspect'](_0x2b4fd9,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 753d878..9bb32e7 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 _0x8b0e=['voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','updateStatusRealtime','inuse','talking','statePause','toNumber','format','voiceStatus','stringify','user:%s','emit','user:save','user:presence','lodash','util','moment','md5','ioredis','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','email','accountcode','fullname','state','unknown','stateTime','status','address','interface','online','voiceStatusTime'];(function(_0x3a8261,_0x3fd02d){var _0x3a5246=function(_0x300b02){while(--_0x300b02){_0x3a8261['push'](_0x3a8261['shift']());}};_0x3a5246(++_0x3fd02d);}(_0x8b0e,0x166));var _0xe8b0=function(_0x2b0875,_0x21ff12){_0x2b0875=_0x2b0875-0x0;var _0xedb8d7=_0x8b0e[_0x2b0875];return _0xedb8d7;};'use strict';var _=require(_0xe8b0('0x0'));var util=require(_0xe8b0('0x1'));var moment=require(_0xe8b0('0x2'));var md5=require(_0xe8b0('0x3'));var Redis=require(_0xe8b0('0x4'));var config=require(_0xe8b0('0x5'));config['redis']=_[_0xe8b0('0x6')](config['redis'],{'host':_0xe8b0('0x7'),'port':0x18eb});var io=require(_0xe8b0('0x8'))(new Redis(config[_0xe8b0('0x9')]));function Agent(_0x3cb6bc){this['id']=_0x3cb6bc['id']||0x0;this[_0xe8b0('0xa')]=_0x3cb6bc[_0xe8b0('0xa')]||'';this[_0xe8b0('0xb')]=_0x3cb6bc[_0xe8b0('0xb')]||'';this['accountcode']=_0x3cb6bc[_0xe8b0('0xc')]||'';this[_0xe8b0('0xd')]=_0x3cb6bc[_0xe8b0('0xd')]||'';this[_0xe8b0('0xe')]=_0xe8b0('0xf');this[_0xe8b0('0x10')]=0x0;this[_0xe8b0('0x11')]=_0xe8b0('0xf');this[_0xe8b0('0x12')]='';this['phone']='';this['mobile']='';this[_0xe8b0('0x13')]='';this[_0xe8b0('0x14')]=_0x3cb6bc[_0xe8b0('0x14')]||![];this['voiceStatus']=_0xe8b0('0xf');this[_0xe8b0('0x15')]=0x0;this[_0xe8b0('0x16')]='';this[_0xe8b0('0x17')]='';this[_0xe8b0('0x18')]=![];this[_0xe8b0('0x19')]=![];this[_0xe8b0('0x3')]='';}Agent['prototype'][_0xe8b0('0x1a')]=function(_0x4211a2){var _0x2d8758;if(_0x4211a2&&_0x4211a2['state']){_0x2d8758=_0x4211a2[_0xe8b0('0xe')]['toLowerCase']();switch(_0x2d8758){case'not_inuse':_0x2d8758='idle';break;case _0xe8b0('0x1b'):_0x2d8758=_0xe8b0('0x1c');break;}}if(_0x2d8758&&this['voiceStatus']!==_0x2d8758||_0x4211a2[_0xe8b0('0x1d')]){this[_0xe8b0('0x15')]=_[_0xe8b0('0x1e')](moment()[_0xe8b0('0x1f')]('x'));}if(_0x2d8758){this[_0xe8b0('0x20')]=_0x2d8758;}var _0x17af0c={'id':this['id'],'name':this['name'],'email':this['email'],'accountcode':this[_0xe8b0('0xc')],'fullname':this[_0xe8b0('0xd')],'state':this[_0xe8b0('0xe')],'stateTime':this[_0xe8b0('0x10')],'status':this[_0xe8b0('0x11')],'address':this[_0xe8b0('0x12')],'online':this[_0xe8b0('0x14')],'voiceStatus':this[_0xe8b0('0x20')],'voiceStatusTime':this[_0xe8b0('0x15')],'voiceStatusCallerIdNumber':this[_0xe8b0('0x16')],'voiceStatusQueue':this[_0xe8b0('0x17')],'interface':this['interface'],'onhold':this[_0xe8b0('0x18')]};var _0x30655d=md5(JSON[_0xe8b0('0x21')](_0x17af0c));if(this[_0xe8b0('0x3')]!==_0x30655d){this['md5']=_0x30655d;io['to'](util[_0xe8b0('0x1f')](_0xe8b0('0x22'),_0x17af0c['name']))[_0xe8b0('0x23')](_0xe8b0('0x24'),_0x17af0c);io[_0xe8b0('0x23')](_0xe8b0('0x25'),_0x17af0c);}};module['exports']=Agent; \ No newline at end of file +var _0xadcf=['socket.io-emitter','name','email','accountcode','fullname','unknown','stateTime','status','address','phone','mobile','online','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','state','toLowerCase','not_inuse','inuse','talking','voiceStatus','statePause','toNumber','format','stringify','user:%s','emit','user:save','user:presence','lodash','util','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost'];(function(_0x1f983d,_0x38ea41){var _0x470773=function(_0x1acb3a){while(--_0x1acb3a){_0x1f983d['push'](_0x1f983d['shift']());}};_0x470773(++_0x38ea41);}(_0xadcf,0xbf));var _0xfadc=function(_0x28a55a,_0x1490bb){_0x28a55a=_0x28a55a-0x0;var _0x176d8c=_0xadcf[_0x28a55a];return _0x176d8c;};'use strict';var _=require(_0xfadc('0x0'));var util=require(_0xfadc('0x1'));var moment=require(_0xfadc('0x2'));var md5=require(_0xfadc('0x3'));var Redis=require(_0xfadc('0x4'));var config=require(_0xfadc('0x5'));config[_0xfadc('0x6')]=_[_0xfadc('0x7')](config[_0xfadc('0x6')],{'host':_0xfadc('0x8'),'port':0x18eb});var io=require(_0xfadc('0x9'))(new Redis(config[_0xfadc('0x6')]));function Agent(_0x35274f){this['id']=_0x35274f['id']||0x0;this[_0xfadc('0xa')]=_0x35274f[_0xfadc('0xa')]||'';this[_0xfadc('0xb')]=_0x35274f['email']||'';this[_0xfadc('0xc')]=_0x35274f[_0xfadc('0xc')]||'';this[_0xfadc('0xd')]=_0x35274f[_0xfadc('0xd')]||'';this['state']=_0xfadc('0xe');this[_0xfadc('0xf')]=0x0;this[_0xfadc('0x10')]=_0xfadc('0xe');this[_0xfadc('0x11')]='';this[_0xfadc('0x12')]='';this[_0xfadc('0x13')]='';this['interface']='';this[_0xfadc('0x14')]=_0x35274f[_0xfadc('0x14')]||![];this['voiceStatus']=_0xfadc('0xe');this['voiceStatusTime']=0x0;this[_0xfadc('0x15')]='';this[_0xfadc('0x16')]='';this[_0xfadc('0x17')]=![];this[_0xfadc('0x18')]=![];this[_0xfadc('0x3')]='';}Agent[_0xfadc('0x19')]['updateStatusRealtime']=function(_0x249c26){var _0x285549;if(_0x249c26&&_0x249c26[_0xfadc('0x1a')]){_0x285549=_0x249c26[_0xfadc('0x1a')][_0xfadc('0x1b')]();switch(_0x285549){case _0xfadc('0x1c'):_0x285549='idle';break;case _0xfadc('0x1d'):_0x285549=_0xfadc('0x1e');break;}}if(_0x285549&&this[_0xfadc('0x1f')]!==_0x285549||_0x249c26[_0xfadc('0x20')]){this['voiceStatusTime']=_[_0xfadc('0x21')](moment()[_0xfadc('0x22')]('x'));}if(_0x285549){this['voiceStatus']=_0x285549;}var _0x2d67b4={'id':this['id'],'name':this[_0xfadc('0xa')],'email':this['email'],'accountcode':this['accountcode'],'fullname':this[_0xfadc('0xd')],'state':this['state'],'stateTime':this[_0xfadc('0xf')],'status':this[_0xfadc('0x10')],'address':this[_0xfadc('0x11')],'online':this[_0xfadc('0x14')],'voiceStatus':this[_0xfadc('0x1f')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0xfadc('0x15')],'voiceStatusQueue':this[_0xfadc('0x16')],'interface':this['interface'],'onhold':this['onhold']};var _0x343d8c=md5(JSON[_0xfadc('0x23')](_0x2d67b4));if(this['md5']!==_0x343d8c){this[_0xfadc('0x3')]=_0x343d8c;io['to'](util[_0xfadc('0x22')](_0xfadc('0x24'),_0x2d67b4['name']))[_0xfadc('0x25')](_0xfadc('0x26'),_0x2d67b4);io[_0xfadc('0x25')](_0xfadc('0x27'),_0x2d67b4);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index ff4b190..ed6f0e0 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 _0xb5e3=['dialNoSuchNumberRetryFrequency','dialDropMaxRetry','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','originated','ivrAnswerCallsDay','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry'];(function(_0x4e1a60,_0x233ed1){var _0x19277a=function(_0x168124){while(--_0x168124){_0x4e1a60['push'](_0x4e1a60['shift']());}};_0x19277a(++_0x233ed1);}(_0xb5e3,0x1ac));var _0x3b5e=function(_0x1bc0ae,_0x439dfe){_0x1bc0ae=_0x1bc0ae-0x0;var _0x501104=_0xb5e3[_0x1bc0ae];return _0x501104;};'use strict';function Campaign(_0x287291){this['id']=_0x287291['id']||0x0;this['name']=_0x287291[_0x3b5e('0x0')]||'';this[_0x3b5e('0x1')]=_0x287291['type']||_0x3b5e('0x2');this[_0x3b5e('0x3')]=0x0;this['temp']=0x0;this[_0x3b5e('0x4')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x3b5e('0x5')]='';this[_0x3b5e('0x6')]=!![];this[_0x3b5e('0x7')]=_0x287291[_0x3b5e('0x7')];this['limitCalls']=_0x287291[_0x3b5e('0x8')];this[_0x3b5e('0x9')]=_0x287291[_0x3b5e('0x9')]||null;this['dialGlobalInterval']=_0x287291['dialGlobalInterval']?_0x287291[_0x3b5e('0xa')]:null;this['dialOriginateCallerIdName']=_0x287291[_0x3b5e('0xb')];this['dialOriginateCallerIdNumber']=_0x287291[_0x3b5e('0xc')];this[_0x3b5e('0xd')]=_0x287291['dialOriginateTimeout']||0x1e;this[_0x3b5e('0xe')]=_0x287291[_0x3b5e('0xe')];this[_0x3b5e('0xf')]=_0x287291[_0x3b5e('0xf')];this[_0x3b5e('0x10')]=_0x287291[_0x3b5e('0x10')];this[_0x3b5e('0x11')]=_0x287291[_0x3b5e('0x11')];this[_0x3b5e('0x12')]=_0x287291['dialNoAnswerMaxRetry'];this[_0x3b5e('0x13')]=_0x287291[_0x3b5e('0x13')];this[_0x3b5e('0x14')]=_0x287291[_0x3b5e('0x14')];this[_0x3b5e('0x15')]=_0x287291[_0x3b5e('0x15')]||0x3;this[_0x3b5e('0x16')]=_0x287291[_0x3b5e('0x16')]||0x96;this['dialDropMaxRetry']=_0x287291[_0x3b5e('0x17')]||0x3;this['dialDropRetryFrequency']=_0x287291['dialDropRetryFrequency']||0x96;this[_0x3b5e('0x18')]=_0x287291[_0x3b5e('0x18')]||0x3;this[_0x3b5e('0x19')]=_0x287291[_0x3b5e('0x19')]||0x96;this['dialMachineMaxRetry']=_0x287291[_0x3b5e('0x1a')]||0x3;this[_0x3b5e('0x1b')]=_0x287291['dialMachineRetryFrequency']||0x96;this[_0x3b5e('0x1c')]=_0x287291[_0x3b5e('0x1c')]||0x3;this[_0x3b5e('0x1d')]=_0x287291['dialAgentRejectRetryFrequency']||0x96;this['dialOrderByScheduledAt']=_0x287291[_0x3b5e('0x1e')]||_0x3b5e('0x1f');this[_0x3b5e('0x20')]=_0x287291[_0x3b5e('0x20')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x287291[_0x3b5e('0x21')]||undefined;this[_0x3b5e('0x22')]=_0x287291[_0x3b5e('0x22')]||undefined;this[_0x3b5e('0x23')]=_0x287291['TrunkBackup']?_0x287291[_0x3b5e('0x23')]:undefined;this['Trunk']=_0x287291[_0x3b5e('0x24')]?_0x287291[_0x3b5e('0x24')]:undefined;this[_0x3b5e('0x25')]=_0x287291['Interval']?_0x287291[_0x3b5e('0x25')]:undefined;this['SquareProject']=_0x287291[_0x3b5e('0x26')]?_0x287291[_0x3b5e('0x26')]:undefined;this['dialQueueProject']=_0x287291[_0x3b5e('0x26')]?_0x287291[_0x3b5e('0x26')][_0x3b5e('0x0')]:undefined;this['dialAMDActive']=_0x287291[_0x3b5e('0x27')]||![];this[_0x3b5e('0x28')]=_0x287291['dialAMDInitialSilence'];this[_0x3b5e('0x29')]=_0x287291[_0x3b5e('0x29')];this[_0x3b5e('0x2a')]=_0x287291[_0x3b5e('0x2a')];this[_0x3b5e('0x2b')]=_0x287291[_0x3b5e('0x2b')];this[_0x3b5e('0x2c')]=_0x287291[_0x3b5e('0x2c')];this['dialAMDBetweenWordsSilence']=_0x287291[_0x3b5e('0x2d')];this[_0x3b5e('0x2e')]=_0x287291['dialAMDMaximumNumberOfWords'];this[_0x3b5e('0x2f')]=_0x287291[_0x3b5e('0x2f')];this[_0x3b5e('0x30')]=_0x287291[_0x3b5e('0x30')];}module[_0x3b5e('0x31')]=Campaign; \ No newline at end of file +var _0x0586=['dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','type','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','name','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting'];(function(_0x3164dd,_0x2f2f42){var _0xa93942=function(_0x47f07d){while(--_0x47f07d){_0x3164dd['push'](_0x3164dd['shift']());}};_0xa93942(++_0x2f2f42);}(_0x0586,0x9b));var _0x6058=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0586[_0x3dd15e];return _0x231fd0;};'use strict';function Campaign(_0x275fe4){this['id']=_0x275fe4['id']||0x0;this['name']=_0x275fe4['name']||'';this[_0x6058('0x0')]=_0x275fe4[_0x6058('0x0')]||'campaign';this['originated']=0x0;this[_0x6058('0x1')]=0x0;this[_0x6058('0x2')]=0x0;this[_0x6058('0x3')]=0x0;this[_0x6058('0x4')]='';this[_0x6058('0x5')]=!![];this['active']=_0x275fe4[_0x6058('0x6')];this[_0x6058('0x7')]=_0x275fe4['limitCalls'];this[_0x6058('0x8')]=_0x275fe4[_0x6058('0x8')]||null;this['dialGlobalInterval']=_0x275fe4[_0x6058('0x9')]?_0x275fe4['dialGlobalInterval']:null;this[_0x6058('0xa')]=_0x275fe4[_0x6058('0xa')];this[_0x6058('0xb')]=_0x275fe4['dialOriginateCallerIdNumber'];this[_0x6058('0xc')]=_0x275fe4[_0x6058('0xc')]||0x1e;this[_0x6058('0xd')]=_0x275fe4[_0x6058('0xd')];this['dialCongestionRetryFrequency']=_0x275fe4[_0x6058('0xe')];this['dialBusyMaxRetry']=_0x275fe4[_0x6058('0xf')];this['dialBusyRetryFrequency']=_0x275fe4['dialBusyRetryFrequency'];this[_0x6058('0x10')]=_0x275fe4[_0x6058('0x10')];this[_0x6058('0x11')]=_0x275fe4[_0x6058('0x11')];this['dialGlobalMaxRetry']=_0x275fe4[_0x6058('0x12')];this[_0x6058('0x13')]=_0x275fe4[_0x6058('0x13')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x275fe4['dialNoSuchNumberRetryFrequency']||0x96;this[_0x6058('0x14')]=_0x275fe4[_0x6058('0x14')]||0x3;this[_0x6058('0x15')]=_0x275fe4[_0x6058('0x15')]||0x96;this[_0x6058('0x16')]=_0x275fe4['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x275fe4['dialAbandonedRetryFrequency']||0x96;this[_0x6058('0x17')]=_0x275fe4[_0x6058('0x17')]||0x3;this[_0x6058('0x18')]=_0x275fe4[_0x6058('0x18')]||0x96;this['dialAgentRejectMaxRetry']=_0x275fe4[_0x6058('0x19')]||0x3;this[_0x6058('0x1a')]=_0x275fe4[_0x6058('0x1a')]||0x96;this[_0x6058('0x1b')]=_0x275fe4['dialOrderByScheduledAt']||_0x6058('0x1c');this[_0x6058('0x1d')]=_0x275fe4['dialPrefix']||undefined;this[_0x6058('0x1e')]=_0x275fe4['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x6058('0x1f')]=_0x275fe4['dialCutDigit']||undefined;this[_0x6058('0x20')]=_0x275fe4[_0x6058('0x20')]?_0x275fe4['TrunkBackup']:undefined;this[_0x6058('0x21')]=_0x275fe4['Trunk']?_0x275fe4[_0x6058('0x21')]:undefined;this['Interval']=_0x275fe4['Interval']?_0x275fe4[_0x6058('0x22')]:undefined;this[_0x6058('0x23')]=_0x275fe4[_0x6058('0x23')]?_0x275fe4['SquareProject']:undefined;this[_0x6058('0x24')]=_0x275fe4[_0x6058('0x23')]?_0x275fe4[_0x6058('0x23')][_0x6058('0x25')]:undefined;this[_0x6058('0x26')]=_0x275fe4[_0x6058('0x26')]||![];this[_0x6058('0x27')]=_0x275fe4[_0x6058('0x27')];this[_0x6058('0x28')]=_0x275fe4['dialAMDGreeting'];this[_0x6058('0x29')]=_0x275fe4[_0x6058('0x29')];this['dialAMDTotalAnalysisTime']=_0x275fe4[_0x6058('0x2a')];this[_0x6058('0x2b')]=_0x275fe4[_0x6058('0x2b')];this['dialAMDBetweenWordsSilence']=_0x275fe4[_0x6058('0x2c')];this[_0x6058('0x2d')]=_0x275fe4[_0x6058('0x2d')];this['dialAMDSilenceThreshold']=_0x275fe4[_0x6058('0x2e')];this[_0x6058('0x2f')]=_0x275fe4[_0x6058('0x2f')];}module[_0x6058('0x30')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 9eaf5a6..3333c5b 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 _0x86dc=['monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','calleridnum','calleridname','connectedlinenum','connectedlinename','context','linkedid','answered','answertime','endtime','abandoned','lastdata','duration','type','tag','monitor','monitorFilename','queue'];(function(_0x444a8b,_0x526b10){var _0x2cebf5=function(_0x499494){while(--_0x499494){_0x444a8b['push'](_0x444a8b['shift']());}};_0x2cebf5(++_0x526b10);}(_0x86dc,0x13e));var _0xc86d=function(_0x2911c4,_0x191ac0){_0x2911c4=_0x2911c4-0x0;var _0x25aa16=_0x86dc[_0x2911c4];return _0x25aa16;};'use strict';function Channel(){this[_0xc86d('0x0')]=null;this['channel']='';this['destinationchannel']='';this[_0xc86d('0x1')]=0x0;this[_0xc86d('0x2')]='';this[_0xc86d('0x3')]=undefined;this[_0xc86d('0x4')]=undefined;this['accountcode']=0x0;this[_0xc86d('0x5')]='';this['uniqueid']=0x0;this[_0xc86d('0x6')]=0x0;this['exten']=0x0;this[_0xc86d('0x7')]=![];this[_0xc86d('0x8')]=null;this[_0xc86d('0x9')]=null;this['unmanaged']=![];this[_0xc86d('0xa')]=![];this['lastapplication']='';this[_0xc86d('0xb')]='';this[_0xc86d('0xc')]=0x0;this['billableseconds']=0x0;this['holdtime']=0x0;this[_0xc86d('0xd')]=null;this[_0xc86d('0xe')]=null;this['disposition']=null;this[_0xc86d('0xf')]=![];this[_0xc86d('0x10')]=null;this[_0xc86d('0x11')]=null;this[_0xc86d('0x12')]=[];this[_0xc86d('0x13')]=undefined;this[_0xc86d('0x14')]=undefined;this[_0xc86d('0x15')]=undefined;this[_0xc86d('0x16')]=0x0;}module[_0xc86d('0x17')]=Channel; \ No newline at end of file +var _0x6629=['disposition','monitor','monitorFilename','queue','monitors','transferconnectedlinenum','mohtime','exports','starttime','calleridnum','calleridname','connectedlinenum','connectedlinename','context','uniqueid','linkedid','answered','answertime','endtime','abandoned','lastdata','duration','billableseconds','holdtime','type','tag'];(function(_0x5f0cb3,_0x1812d4){var _0x31ea89=function(_0x4be075){while(--_0x4be075){_0x5f0cb3['push'](_0x5f0cb3['shift']());}};_0x31ea89(++_0x1812d4);}(_0x6629,0x1c2));var _0x9662=function(_0x2520af,_0x217d68){_0x2520af=_0x2520af-0x0;var _0x2a39fb=_0x6629[_0x2520af];return _0x2a39fb;};'use strict';function Channel(){this[_0x9662('0x0')]=null;this['channel']='';this['destinationchannel']='';this[_0x9662('0x1')]=0x0;this[_0x9662('0x2')]='';this[_0x9662('0x3')]=undefined;this[_0x9662('0x4')]=undefined;this['accountcode']=0x0;this[_0x9662('0x5')]='';this[_0x9662('0x6')]=0x0;this[_0x9662('0x7')]=0x0;this['exten']=0x0;this[_0x9662('0x8')]=![];this[_0x9662('0x9')]=null;this[_0x9662('0xa')]=null;this['unmanaged']=![];this[_0x9662('0xb')]=![];this['lastapplication']='';this[_0x9662('0xc')]='';this[_0x9662('0xd')]=0x0;this[_0x9662('0xe')]=0x0;this[_0x9662('0xf')]=0x0;this[_0x9662('0x10')]=null;this[_0x9662('0x11')]=null;this[_0x9662('0x12')]=null;this[_0x9662('0x13')]=![];this[_0x9662('0x14')]=null;this[_0x9662('0x15')]=null;this[_0x9662('0x16')]=[];this['transfercalleridnum']=undefined;this[_0x9662('0x17')]=undefined;this['transferType']=undefined;this[_0x9662('0x18')]=0x0;}module[_0x9662('0x19')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index c1c7440..5c17e6c 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 _0xf2cf=['password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType'];(function(_0x2e966f,_0x1a1650){var _0x2e84ed=function(_0x2191bd){while(--_0x2191bd){_0x2e966f['push'](_0x2e966f['shift']());}};_0x2e84ed(++_0x1a1650);}(_0xf2cf,0x175));var _0xff2c=function(_0x49c0e5,_0x316a97){_0x49c0e5=_0x49c0e5-0x0;var _0x4d166b=_0xf2cf[_0x49c0e5];return _0x4d166b;};'use strict';function DeskAccount(_0x20b12b){this['id']=_0x20b12b['id']||0x0;this[_0xff2c('0x0')]=_0x20b12b[_0xff2c('0x0')]||'';this[_0xff2c('0x1')]=_0x20b12b[_0xff2c('0x1')]||'';this[_0xff2c('0x2')]=_0x20b12b[_0xff2c('0x2')]||'';this[_0xff2c('0x3')]=_0x20b12b['authType']||'';this[_0xff2c('0x4')]=_0x20b12b[_0xff2c('0x4')]||'';this[_0xff2c('0x5')]=_0x20b12b[_0xff2c('0x5')]||'';this[_0xff2c('0x6')]=_0x20b12b[_0xff2c('0x6')]||'';this[_0xff2c('0x7')]=_0x20b12b['token']||'';this[_0xff2c('0x8')]=_0x20b12b[_0xff2c('0x8')]||'';this[_0xff2c('0x9')]=_0x20b12b['type']||'';this[_0xff2c('0xa')]=_0x20b12b[_0xff2c('0xa')]||'';this[_0xff2c('0xb')]=_0x20b12b[_0xff2c('0xb')]||{};}module[_0xff2c('0xc')]=DeskAccount; \ No newline at end of file +var _0xf008=['Configurations','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl'];(function(_0x59befa,_0x4af99b){var _0x1dd63d=function(_0x4c1df4){while(--_0x4c1df4){_0x59befa['push'](_0x59befa['shift']());}};_0x1dd63d(++_0x4af99b);}(_0xf008,0x79));var _0x8f00=function(_0xeff96,_0x11afb6){_0xeff96=_0xeff96-0x0;var _0x3a14a0=_0xf008[_0xeff96];return _0x3a14a0;};'use strict';function DeskAccount(_0xf10853){this['id']=_0xf10853['id']||0x0;this[_0x8f00('0x0')]=_0xf10853[_0x8f00('0x0')]||'';this[_0x8f00('0x1')]=_0xf10853[_0x8f00('0x1')]||'';this[_0x8f00('0x2')]=_0xf10853[_0x8f00('0x2')]||'';this[_0x8f00('0x3')]=_0xf10853['authType']||'';this[_0x8f00('0x4')]=_0xf10853['password']||'';this['consumerKey']=_0xf10853[_0x8f00('0x5')]||'';this[_0x8f00('0x6')]=_0xf10853[_0x8f00('0x6')]||'';this[_0x8f00('0x7')]=_0xf10853[_0x8f00('0x7')]||'';this[_0x8f00('0x8')]=_0xf10853[_0x8f00('0x8')]||'';this['type']=_0xf10853[_0x8f00('0x9')]||'';this[_0x8f00('0xa')]=_0xf10853[_0x8f00('0xa')]||'';this['Configurations']=_0xf10853[_0x8f00('0xb')]||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index f74ebd3..6765943 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 _0xb4d5=['tenantId','clientId','clientSecret','serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x12247e,_0x1249bf){var _0x1915b4=function(_0x278c27){while(--_0x278c27){_0x12247e['push'](_0x12247e['shift']());}};_0x1915b4(++_0x1249bf);}(_0xb4d5,0x1aa));var _0x5b4d=function(_0x4a6d54,_0x4f7ed3){_0x4a6d54=_0x4a6d54-0x0;var _0x221bab=_0xb4d5[_0x4a6d54];return _0x221bab;};'use strict';function Dynamics365Account(_0x4e9f7b){this['id']=_0x4e9f7b['id']||0x0;this[_0x5b4d('0x0')]=_0x4e9f7b[_0x5b4d('0x0')]||'';this['username']=_0x4e9f7b[_0x5b4d('0x1')]||'';this[_0x5b4d('0x2')]=_0x4e9f7b[_0x5b4d('0x2')]||'';this[_0x5b4d('0x3')]=_0x4e9f7b[_0x5b4d('0x3')]||'';this[_0x5b4d('0x4')]=_0x4e9f7b['tenantId']||'';this[_0x5b4d('0x5')]=_0x4e9f7b[_0x5b4d('0x5')]||'';this[_0x5b4d('0x6')]=_0x4e9f7b['clientSecret']||{};this[_0x5b4d('0x7')]=_0x4e9f7b[_0x5b4d('0x7')]||'';this['modernAuthentication']=_0x4e9f7b['modernAuthentication']||![];this[_0x5b4d('0x8')]=_0x4e9f7b['Configurations']||{};this['CloudProvider']=_0x4e9f7b['CloudProvider']||{};}module[_0x5b4d('0x9')]=Dynamics365Account; \ No newline at end of file +var _0x0375=['Configurations','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication'];(function(_0xb0de07,_0x3ca2a0){var _0x4633d8=function(_0x2368e0){while(--_0x2368e0){_0xb0de07['push'](_0xb0de07['shift']());}};_0x4633d8(++_0x3ca2a0);}(_0x0375,0x115));var _0x5037=function(_0x364bce,_0x22a82d){_0x364bce=_0x364bce-0x0;var _0x40d1db=_0x0375[_0x364bce];return _0x40d1db;};'use strict';function Dynamics365Account(_0x2a9a42){this['id']=_0x2a9a42['id']||0x0;this['name']=_0x2a9a42[_0x5037('0x0')]||'';this[_0x5037('0x1')]=_0x2a9a42[_0x5037('0x1')]||'';this['password']=_0x2a9a42[_0x5037('0x2')]||'';this['remoteUri']=_0x2a9a42[_0x5037('0x3')]||'';this['tenantId']=_0x2a9a42[_0x5037('0x4')]||'';this[_0x5037('0x5')]=_0x2a9a42['clientId']||'';this[_0x5037('0x6')]=_0x2a9a42[_0x5037('0x6')]||{};this['serverUrl']=_0x2a9a42[_0x5037('0x7')]||'';this[_0x5037('0x8')]=_0x2a9a42['modernAuthentication']||![];this[_0x5037('0x9')]=_0x2a9a42['Configurations']||{};this['CloudProvider']=_0x2a9a42['CloudProvider']||{};}module[_0x5037('0xa')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 33bb241..49c82b5 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 _0x791f=['maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','name','description','ecm','headerinfo','localstationid','minrate'];(function(_0x29a0fb,_0x395468){var _0x3e8006=function(_0x32d56a){while(--_0x32d56a){_0x29a0fb['push'](_0x29a0fb['shift']());}};_0x3e8006(++_0x395468);}(_0x791f,0xca));var _0xf791=function(_0x22ffbf,_0x16f31e){_0x22ffbf=_0x22ffbf-0x0;var _0x360c17=_0x791f[_0x22ffbf];return _0x360c17;};'use strict';function FaxAccount(_0x5a4d2c){this['id']=_0x5a4d2c['id']||0x0;this[_0xf791('0x0')]=_0x5a4d2c[_0xf791('0x0')]||'';this[_0xf791('0x1')]=_0x5a4d2c[_0xf791('0x1')];this['ecm']=_0x5a4d2c[_0xf791('0x2')];this[_0xf791('0x3')]=_0x5a4d2c[_0xf791('0x3')];this[_0xf791('0x4')]=_0x5a4d2c[_0xf791('0x4')];this['minrate']=_0x5a4d2c[_0xf791('0x5')]||0x960;this['maxrate']=_0x5a4d2c[_0xf791('0x6')]||0x3840;this['modem']=_0x5a4d2c[_0xf791('0x7')]||_0xf791('0x8');this[_0xf791('0x9')]=_0x5a4d2c['gateway']||'no';this[_0xf791('0xa')]=_0x5a4d2c[_0xf791('0xa')]||'no';this[_0xf791('0xb')]=_0x5a4d2c['t38timeout']||0x1388;this[_0xf791('0xc')]=_0x5a4d2c[_0xf791('0xc')]||'SIP';this[_0xf791('0xd')]=_0x5a4d2c['Trunk']?_0x5a4d2c[_0xf791('0xd')]:undefined;this[_0xf791('0xe')]=_0x5a4d2c[_0xf791('0xe')];this[_0xf791('0xf')]=_0x5a4d2c['key'];}module['exports']=FaxAccount; \ No newline at end of file +var _0x56b9=['v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem'];(function(_0x37756b,_0x24db76){var _0x46efec=function(_0x319807){while(--_0x319807){_0x37756b['push'](_0x37756b['shift']());}};_0x46efec(++_0x24db76);}(_0x56b9,0x196));var _0x956b=function(_0x5f159a,_0x22553f){_0x5f159a=_0x5f159a-0x0;var _0x38945c=_0x56b9[_0x5f159a];return _0x38945c;};'use strict';function FaxAccount(_0x1189ae){this['id']=_0x1189ae['id']||0x0;this[_0x956b('0x0')]=_0x1189ae[_0x956b('0x0')]||'';this[_0x956b('0x1')]=_0x1189ae[_0x956b('0x1')];this[_0x956b('0x2')]=_0x1189ae['ecm'];this[_0x956b('0x3')]=_0x1189ae['headerinfo'];this[_0x956b('0x4')]=_0x1189ae[_0x956b('0x4')];this[_0x956b('0x5')]=_0x1189ae['minrate']||0x960;this[_0x956b('0x6')]=_0x1189ae[_0x956b('0x6')]||0x3840;this[_0x956b('0x7')]=_0x1189ae[_0x956b('0x7')]||_0x956b('0x8');this[_0x956b('0x9')]=_0x1189ae[_0x956b('0x9')]||'no';this[_0x956b('0xa')]=_0x1189ae['faxdetect']||'no';this[_0x956b('0xb')]=_0x1189ae[_0x956b('0xb')]||0x1388;this['tech']=_0x1189ae[_0x956b('0xc')]||_0x956b('0xd');this[_0x956b('0xe')]=_0x1189ae[_0x956b('0xe')]?_0x1189ae[_0x956b('0xe')]:undefined;this['ListId']=_0x1189ae[_0x956b('0xf')];this[_0x956b('0x10')]=_0x1189ae[_0x956b('0x10')];}module[_0x956b('0x11')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index efa0799..d839fc4 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 _0xc6a4=['remoteUri','serverUrl','Configurations','exports','name','apiKey','token'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc6a4,0xd6));var _0x4c6a=function(_0x24ede4,_0x1ad200){_0x24ede4=_0x24ede4-0x0;var _0x3c6c81=_0xc6a4[_0x24ede4];return _0x3c6c81;};'use strict';function FreshdeskAccount(_0x4f8748){this['id']=_0x4f8748['id']||0x0;this['name']=_0x4f8748[_0x4c6a('0x0')]||'';this['username']=_0x4f8748['username']||'';this[_0x4c6a('0x1')]=_0x4f8748[_0x4c6a('0x2')]||'';this[_0x4c6a('0x3')]=_0x4f8748[_0x4c6a('0x3')]||'';this[_0x4c6a('0x4')]=_0x4f8748['serverUrl']||'';this[_0x4c6a('0x5')]=_0x4f8748[_0x4c6a('0x5')]||{};}module[_0x4c6a('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x45e7=['username','apiKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x45e7,0xd1));var _0x745e=function(_0xbd3a05,_0xe6c6b7){_0xbd3a05=_0xbd3a05-0x0;var _0x101f90=_0x45e7[_0xbd3a05];return _0x101f90;};'use strict';function FreshdeskAccount(_0x48f113){this['id']=_0x48f113['id']||0x0;this[_0x745e('0x0')]=_0x48f113[_0x745e('0x0')]||'';this[_0x745e('0x1')]=_0x48f113[_0x745e('0x1')]||'';this[_0x745e('0x2')]=_0x48f113['token']||'';this[_0x745e('0x3')]=_0x48f113[_0x745e('0x3')]||'';this[_0x745e('0x4')]=_0x48f113[_0x745e('0x4')]||'';this[_0x745e('0x5')]=_0x48f113[_0x745e('0x5')]||{};}module[_0x745e('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index b331faf..31470f0 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 _0xbcba=['Configurations','name','username','apiKey','token','remoteUri'];(function(_0x1b63e9,_0x52b74c){var _0xb174a0=function(_0xdee805){while(--_0xdee805){_0x1b63e9['push'](_0x1b63e9['shift']());}};_0xb174a0(++_0x52b74c);}(_0xbcba,0x6d));var _0xabcb=function(_0x249bb1,_0x570527){_0x249bb1=_0x249bb1-0x0;var _0x314c3c=_0xbcba[_0x249bb1];return _0x314c3c;};'use strict';function FreshsalesAccount(_0x4cba6b){this['id']=_0x4cba6b['id']||0x0;this[_0xabcb('0x0')]=_0x4cba6b['name']||'';this[_0xabcb('0x1')]=_0x4cba6b[_0xabcb('0x1')]||'';this[_0xabcb('0x2')]=_0x4cba6b[_0xabcb('0x3')]||'';this[_0xabcb('0x4')]=_0x4cba6b[_0xabcb('0x4')]||'';this['serverUrl']=_0x4cba6b['serverUrl']||'';this[_0xabcb('0x5')]=_0x4cba6b[_0xabcb('0x5')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0x6dfa=['remoteUri','Configurations','exports','name','username','token'];(function(_0xcdac3b,_0xa8b0c3){var _0xabe044=function(_0x1d7197){while(--_0x1d7197){_0xcdac3b['push'](_0xcdac3b['shift']());}};_0xabe044(++_0xa8b0c3);}(_0x6dfa,0x7b));var _0xa6df=function(_0x160767,_0x1a10c8){_0x160767=_0x160767-0x0;var _0x327818=_0x6dfa[_0x160767];return _0x327818;};'use strict';function FreshsalesAccount(_0x21c653){this['id']=_0x21c653['id']||0x0;this[_0xa6df('0x0')]=_0x21c653[_0xa6df('0x0')]||'';this[_0xa6df('0x1')]=_0x21c653[_0xa6df('0x1')]||'';this['apiKey']=_0x21c653[_0xa6df('0x2')]||'';this['remoteUri']=_0x21c653[_0xa6df('0x3')]||'';this['serverUrl']=_0x21c653['serverUrl']||'';this[_0xa6df('0x4')]=_0x21c653[_0xa6df('0x4')]||{};}module[_0xa6df('0x5')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 31ac247..c258854 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 _0x0a86=['context','exten','priority','lastAssignedTo','motionChannel','voice','routealias','variables','type','calleridnum','calleridname','queuecallerjoinAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','connectedlinename','accountcode'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0a86,0xfa));var _0x60a8=function(_0x1d211b,_0x475f3b){_0x1d211b=_0x1d211b-0x0;var _0x47c88b=_0x0a86[_0x1d211b];return _0x47c88b;};'use strict';function QueueReport(){this[_0x60a8('0x0')]='inbound';this['uniqueid']='';this[_0x60a8('0x1')]='';this[_0x60a8('0x2')]='';this['queue']='';this[_0x60a8('0x3')]=null;this['queuecallerleaveAt']=null;this[_0x60a8('0x4')]=0x1;this[_0x60a8('0x5')]=0x1;this[_0x60a8('0x6')]=![];this[_0x60a8('0x7')]=null;this['queuecallercomplete']=![];this[_0x60a8('0x8')]=null;this[_0x60a8('0x9')]=![];this[_0x60a8('0xa')]=null;this[_0x60a8('0xb')]=0x1;this['channel']='';this['connectedlinenum']='';this[_0x60a8('0xc')]='';this[_0x60a8('0xd')]='';this[_0x60a8('0xe')]='';this[_0x60a8('0xf')]='';this[_0x60a8('0x10')]='';this['holdtime']=0x0;this['assigned']=![];this[_0x60a8('0x11')]='';this[_0x60a8('0x12')]=_0x60a8('0x13');this[_0x60a8('0x14')]=null;this['mohtime']=0x0;this[_0x60a8('0x15')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0x4869=['connectedlinenum','connectedlinename','accountcode','context','priority','holdtime','assigned','lastAssignedTo','motionChannel','voice','routealias','mohtime','exports','type','inbound','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','channel'];(function(_0x9516f,_0x28069a){var _0x596bb9=function(_0x127531){while(--_0x127531){_0x9516f['push'](_0x9516f['shift']());}};_0x596bb9(++_0x28069a);}(_0x4869,0x125));var _0x9486=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x4869[_0x3ab51d];return _0x29a04e;};'use strict';function QueueReport(){this[_0x9486('0x0')]=_0x9486('0x1');this['uniqueid']='';this[_0x9486('0x2')]='';this[_0x9486('0x3')]='';this[_0x9486('0x4')]='';this[_0x9486('0x5')]=null;this[_0x9486('0x6')]=null;this[_0x9486('0x7')]=0x1;this['count']=0x1;this[_0x9486('0x8')]=![];this[_0x9486('0x9')]=null;this[_0x9486('0xa')]=![];this[_0x9486('0xb')]=null;this[_0x9486('0xc')]=![];this[_0x9486('0xd')]=null;this['originalposition']=0x1;this[_0x9486('0xe')]='';this[_0x9486('0xf')]='';this[_0x9486('0x10')]='';this[_0x9486('0x11')]='';this[_0x9486('0x12')]='';this['exten']='';this[_0x9486('0x13')]='';this[_0x9486('0x14')]=0x0;this[_0x9486('0x15')]=![];this[_0x9486('0x16')]='';this[_0x9486('0x17')]=_0x9486('0x18');this[_0x9486('0x19')]=null;this[_0x9486('0x1a')]=0x0;this['variables']={};}module[_0x9486('0x1b')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index c4057ad..42a64a8 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 _0x7200=['integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type'];(function(_0x1292c7,_0x1b8bc9){var _0x4258cc=function(_0x5e8e3e){while(--_0x5e8e3e){_0x1292c7['push'](_0x1292c7['shift']());}};_0x4258cc(++_0x1b8bc9);}(_0x7200,0x1a8));var _0x0720=function(_0x1f5fff,_0x3e99b4){_0x1f5fff=_0x1f5fff-0x0;var _0x167f6f=_0x7200[_0x1f5fff];return _0x167f6f;};'use strict';function SalesforceAccount(_0x34b200){this['id']=_0x34b200['id']||0x0;this['name']=_0x34b200[_0x0720('0x0')]||'';this['username']=_0x34b200[_0x0720('0x1')]||'';this[_0x0720('0x2')]=_0x34b200[_0x0720('0x2')]||'';this[_0x0720('0x3')]=_0x34b200['password']||'';this[_0x0720('0x4')]=_0x34b200[_0x0720('0x4')]||'';this[_0x0720('0x5')]=_0x34b200[_0x0720('0x5')]||'';this[_0x0720('0x6')]=_0x34b200[_0x0720('0x6')]||'';this['type']=_0x34b200[_0x0720('0x7')]||_0x0720('0x8');this[_0x0720('0x9')]=_0x34b200[_0x0720('0x9')]||'';this[_0x0720('0xa')]=_0x34b200[_0x0720('0xa')]||{};}module[_0x0720('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x0c8d=['name','username','remoteUri','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports'];(function(_0x1fe2b7,_0x46f1d8){var _0x549911=function(_0x3160bb){while(--_0x3160bb){_0x1fe2b7['push'](_0x1fe2b7['shift']());}};_0x549911(++_0x46f1d8);}(_0x0c8d,0x79));var _0xd0c8=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x0c8d[_0x2e4e19];return _0x9ba20b;};'use strict';function SalesforceAccount(_0x58354d){this['id']=_0x58354d['id']||0x0;this[_0xd0c8('0x0')]=_0x58354d[_0xd0c8('0x0')]||'';this[_0xd0c8('0x1')]=_0x58354d[_0xd0c8('0x1')]||'';this[_0xd0c8('0x2')]=_0x58354d['remoteUri']||'';this['password']=_0x58354d['password']||'';this['clientId']=_0x58354d[_0xd0c8('0x3')]||'';this[_0xd0c8('0x4')]=_0x58354d[_0xd0c8('0x4')]||'';this['securityToken']=_0x58354d[_0xd0c8('0x5')]||'';this['type']=_0x58354d[_0xd0c8('0x6')]||_0xd0c8('0x7');this[_0xd0c8('0x8')]=_0x58354d[_0xd0c8('0x8')]||'';this[_0xd0c8('0x9')]=_0x58354d['Configurations']||{};}module[_0xd0c8('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 636aa79..96c408b 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 _0x0cd1=['password','remoteUri','serverUrl','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0cd1,0x17f));var _0x10cd=function(_0x4d0bca,_0x4711aa){_0x4d0bca=_0x4d0bca-0x0;var _0x3a1dbd=_0x0cd1[_0x4d0bca];return _0x3a1dbd;};'use strict';function ServicenowAccount(_0xa7d3e4){this['id']=_0xa7d3e4['id']||0x0;this['name']=_0xa7d3e4[_0x10cd('0x0')]||'';this['username']=_0xa7d3e4['username']||'';this[_0x10cd('0x1')]=_0xa7d3e4['password']||'';this[_0x10cd('0x2')]=_0xa7d3e4[_0x10cd('0x2')]||'';this[_0x10cd('0x3')]=_0xa7d3e4[_0x10cd('0x3')]||'';this['Configurations']=_0xa7d3e4['Configurations']||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0x67a7=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x4d452c,_0x1e69be){var _0x4bed65=function(_0x32291f){while(--_0x32291f){_0x4d452c['push'](_0x4d452c['shift']());}};_0x4bed65(++_0x1e69be);}(_0x67a7,0x175));var _0x767a=function(_0x502c6e,_0x1f3a40){_0x502c6e=_0x502c6e-0x0;var _0x5b2123=_0x67a7[_0x502c6e];return _0x5b2123;};'use strict';function ServicenowAccount(_0x1878d0){this['id']=_0x1878d0['id']||0x0;this[_0x767a('0x0')]=_0x1878d0[_0x767a('0x0')]||'';this[_0x767a('0x1')]=_0x1878d0['username']||'';this['password']=_0x1878d0[_0x767a('0x2')]||'';this[_0x767a('0x3')]=_0x1878d0[_0x767a('0x3')]||'';this['serverUrl']=_0x1878d0[_0x767a('0x4')]||'';this[_0x767a('0x5')]=_0x1878d0[_0x767a('0x5')]||{};}module[_0x767a('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 a3d2248..2751ba6 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 _0xe15a=['serverUrl','Configurations','name','username','password','remoteUri'];(function(_0x3225b0,_0x144090){var _0x3943ec=function(_0x5743f4){while(--_0x5743f4){_0x3225b0['push'](_0x3225b0['shift']());}};_0x3943ec(++_0x144090);}(_0xe15a,0x80));var _0xae15=function(_0x38622b,_0x3cfdf7){_0x38622b=_0x38622b-0x0;var _0x2c1a7a=_0xe15a[_0x38622b];return _0x2c1a7a;};'use strict';function SugarcrmAccount(_0x3cf2c3){this['id']=_0x3cf2c3['id']||0x0;this[_0xae15('0x0')]=_0x3cf2c3[_0xae15('0x0')]||'';this['username']=_0x3cf2c3[_0xae15('0x1')]||'';this[_0xae15('0x2')]=_0x3cf2c3['password']||'';this[_0xae15('0x3')]=_0x3cf2c3[_0xae15('0x3')]||'';this[_0xae15('0x4')]=_0x3cf2c3['serverUrl']||'';this['Configurations']=_0x3cf2c3[_0xae15('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0xa2d7=['Configurations','name','username','password','remoteUri','serverUrl'];(function(_0xe687b3,_0x468b9f){var _0x1b765d=function(_0x443767){while(--_0x443767){_0xe687b3['push'](_0xe687b3['shift']());}};_0x1b765d(++_0x468b9f);}(_0xa2d7,0xbb));var _0x7a2d=function(_0x5590fd,_0x58b8b9){_0x5590fd=_0x5590fd-0x0;var _0x54e3e2=_0xa2d7[_0x5590fd];return _0x54e3e2;};'use strict';function SugarcrmAccount(_0x370cd6){this['id']=_0x370cd6['id']||0x0;this[_0x7a2d('0x0')]=_0x370cd6[_0x7a2d('0x0')]||'';this[_0x7a2d('0x1')]=_0x370cd6['username']||'';this[_0x7a2d('0x2')]=_0x370cd6[_0x7a2d('0x2')]||'';this[_0x7a2d('0x3')]=_0x370cd6[_0x7a2d('0x3')]||'';this['serverUrl']=_0x370cd6[_0x7a2d('0x4')]||'';this[_0x7a2d('0x5')]=_0x370cd6[_0x7a2d('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 360fdb3..543f773 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 _0xcabe=['unknown','status','address','name','accountcode','state'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0xcabe,0x1ef));var _0xecab=function(_0x44fdd2,_0x5e0bd6){_0x44fdd2=_0x44fdd2-0x0;var _0x5de143=_0xcabe[_0x44fdd2];return _0x5de143;};'use strict';function Telephone(_0x1e6b6f){this['id']=_0x1e6b6f['id']||0x0;this['name']=_0x1e6b6f[_0xecab('0x0')]||'';this[_0xecab('0x1')]=_0x1e6b6f['accountcode']||'';this[_0xecab('0x2')]=_0xecab('0x3');this['stateTime']=0x0;this[_0xecab('0x4')]=_0xecab('0x3');this[_0xecab('0x5')]='';}module['exports']=Telephone; \ No newline at end of file +var _0x84fd=['address','exports','name','accountcode','state','stateTime','status','unknown'];(function(_0x3e6ead,_0x61f91a){var _0x28f590=function(_0x1e2242){while(--_0x1e2242){_0x3e6ead['push'](_0x3e6ead['shift']());}};_0x28f590(++_0x61f91a);}(_0x84fd,0xda));var _0xd84f=function(_0xfc59b1,_0x4721d8){_0xfc59b1=_0xfc59b1-0x0;var _0x12d428=_0x84fd[_0xfc59b1];return _0x12d428;};'use strict';function Telephone(_0xea478d){this['id']=_0xea478d['id']||0x0;this[_0xd84f('0x0')]=_0xea478d[_0xd84f('0x0')]||'';this[_0xd84f('0x1')]=_0xea478d[_0xd84f('0x1')]||'';this[_0xd84f('0x2')]='unknown';this[_0xd84f('0x3')]=0x0;this[_0xd84f('0x4')]=_0xd84f('0x5');this[_0xd84f('0x6')]='';}module[_0xd84f('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 b3be1cd..fe779e1 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','html'];(function(_0x266ee3,_0x56fc12){var _0x1620c9=function(_0x469b1f){while(--_0x469b1f){_0x266ee3['push'](_0x266ee3['shift']());}};_0x1620c9(++_0x56fc12);}(_0xb10b,0x12a));var _0xbb10=function(_0x3af392,_0xe5e91f){_0x3af392=_0x3af392-0x0;var _0x33be9f=_0xb10b[_0x3af392];return _0x33be9f;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x1ae2f7,_0x129974){var _0x4e9446=function(_0x23cdcc){while(--_0x23cdcc){_0x1ae2f7['push'](_0x1ae2f7['shift']());}};_0x4e9446(++_0x129974);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index ba06078..cd8c8c5 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 _0x8603=['exports','name','channel','status','AllConditions','AnyConditions','Actions'];(function(_0x35513f,_0x4edbda){var _0x1e2a39=function(_0x7ee404){while(--_0x7ee404){_0x35513f['push'](_0x35513f['shift']());}};_0x1e2a39(++_0x4edbda);}(_0x8603,0x190));var _0x3860=function(_0x81b83f,_0x4728d0){_0x81b83f=_0x81b83f-0x0;var _0x2cf50d=_0x8603[_0x81b83f];return _0x2cf50d;};'use strict';function Trigger(_0xba4b79){this['id']=_0xba4b79['id']||0x0;this[_0x3860('0x0')]=_0xba4b79[_0x3860('0x0')]||'';this[_0x3860('0x1')]=_0xba4b79['channel']||'voice';this[_0x3860('0x2')]=_0xba4b79[_0x3860('0x2')]||![];this[_0x3860('0x3')]=_0xba4b79['AllConditions']||[];this[_0x3860('0x4')]=_0xba4b79['AnyConditions']||[];this[_0x3860('0x5')]=_0xba4b79[_0x3860('0x5')]||[];}module[_0x3860('0x6')]=Trigger; \ No newline at end of file +var _0xb10b=['AllConditions','AnyConditions','Actions','exports','name','channel','status'];(function(_0x3d0bb2,_0x55345c){var _0xbdcd28=function(_0x114d0b){while(--_0x114d0b){_0x3d0bb2['push'](_0x3d0bb2['shift']());}};_0xbdcd28(++_0x55345c);}(_0xb10b,0x12a));var _0xbb10=function(_0x1ccee3,_0x462810){_0x1ccee3=_0x1ccee3-0x0;var _0xd975d8=_0xb10b[_0x1ccee3];return _0xd975d8;};'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 92ab018..bf13434 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 _0x7bb5=['exports','active','name','state','unknown','stateTime','registry','split','host','port','domain','domainport','refresh','stateRegistry','registrationtime','address','defaultuser'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x7bb5,0xef));var _0x57bb=function(_0xd96472,_0x26c48d){_0xd96472=_0xd96472-0x0;var _0x120725=_0x7bb5[_0xd96472];return _0x120725;};'use strict';function Trunk(_0x1fea13){this['id']=_0x1fea13['id']||0x0;this[_0x57bb('0x0')]=_0x1fea13[_0x57bb('0x0')]||![];this[_0x57bb('0x1')]=_0x1fea13[_0x57bb('0x1')]||'';this[_0x57bb('0x2')]=_0x57bb('0x3');this[_0x57bb('0x4')]=0x0;this['status']='unknown';this[_0x57bb('0x5')]=_0x1fea13['registry']&&_0x1fea13['registry']['indexOf'](':')?_0x1fea13[_0x57bb('0x5')][_0x57bb('0x6')](':')[0x0]:'';this[_0x57bb('0x7')]='';this[_0x57bb('0x8')]='';this[_0x57bb('0x9')]='';this[_0x57bb('0xa')]='';this[_0x57bb('0xb')]='';this[_0x57bb('0xc')]=_0x57bb('0x3');this[_0x57bb('0xd')]='';this[_0x57bb('0xe')]='';this['defaultuser']=_0x1fea13[_0x57bb('0xf')]||'';}module[_0x57bb('0x10')]=Trunk; \ No newline at end of file +var _0xb5ca=['split','host','port','domainport','stateRegistry','defaultuser','active','name','state','unknown','stateTime','registry'];(function(_0x4c05da,_0x414720){var _0x1614db=function(_0xa19cf6){while(--_0xa19cf6){_0x4c05da['push'](_0x4c05da['shift']());}};_0x1614db(++_0x414720);}(_0xb5ca,0x16e));var _0xab5c=function(_0x3e8a0a,_0x32413c){_0x3e8a0a=_0x3e8a0a-0x0;var _0x3596ca=_0xb5ca[_0x3e8a0a];return _0x3596ca;};'use strict';function Trunk(_0x247f1f){this['id']=_0x247f1f['id']||0x0;this[_0xab5c('0x0')]=_0x247f1f[_0xab5c('0x0')]||![];this[_0xab5c('0x1')]=_0x247f1f['name']||'';this[_0xab5c('0x2')]=_0xab5c('0x3');this[_0xab5c('0x4')]=0x0;this['status']=_0xab5c('0x3');this[_0xab5c('0x5')]=_0x247f1f['registry']&&_0x247f1f['registry']['indexOf'](':')?_0x247f1f['registry'][_0xab5c('0x6')](':')[0x0]:'';this[_0xab5c('0x7')]='';this[_0xab5c('0x8')]='';this['domain']='';this[_0xab5c('0x9')]='';this['refresh']='';this[_0xab5c('0xa')]=_0xab5c('0x3');this['registrationtime']='';this['address']='';this[_0xab5c('0xb')]=_0x247f1f[_0xab5c('0xb')]||'';}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 fe22743..34cb996 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 _0xa26c=['recordingFormat','none','mandatoryDisposition','exten'];(function(_0xfbdff6,_0x2af690){var _0x4cb9be=function(_0x4022d8){while(--_0x4022d8){_0xfbdff6['push'](_0xfbdff6['shift']());}};_0x4cb9be(++_0x2af690);}(_0xa26c,0x10f));var _0xca26=function(_0x188327,_0x139674){_0x188327=_0x188327-0x0;var _0x51fe39=_0xa26c[_0x188327];return _0x51fe39;};'use strict';function voiceExtension(_0x3ce0e3){this['id']=_0x3ce0e3['id']||0x0;this[_0xca26('0x0')]=_0x3ce0e3['exten']||'';this[_0xca26('0x1')]=_0x3ce0e3[_0xca26('0x1')]||_0xca26('0x2');this[_0xca26('0x3')]=_0x3ce0e3[_0xca26('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0x2c39=['none','mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x21e4ac,_0x1dc8fb){var _0x59bff6=function(_0x486775){while(--_0x486775){_0x21e4ac['push'](_0x21e4ac['shift']());}};_0x59bff6(++_0x1dc8fb);}(_0x2c39,0x10c));var _0x92c3=function(_0x1809c5,_0x46cabc){_0x1809c5=_0x1809c5-0x0;var _0x5254a4=_0x2c39[_0x1809c5];return _0x5254a4;};'use strict';function voiceExtension(_0x254ce6){this['id']=_0x254ce6['id']||0x0;this[_0x92c3('0x0')]=_0x254ce6[_0x92c3('0x0')]||'';this[_0x92c3('0x1')]=_0x254ce6[_0x92c3('0x1')]||_0x92c3('0x2');this['mandatoryDisposition']=_0x254ce6[_0x92c3('0x3')]||![];}module[_0x92c3('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index f14c617..26693e9 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 _0x4d76=['predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','fewestcalls','linear','ringall','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','inbound','waiting','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','busy','invalid','loggedIn','notInUse','paused','ringing','ringInUse','talking','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls'];(function(_0x50f392,_0x1d8441){var _0x5926f2=function(_0x17df32){while(--_0x17df32){_0x50f392['push'](_0x50f392['shift']());}};_0x5926f2(++_0x1d8441);}(_0x4d76,0x98));var _0x64d7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4d76[_0x3dd15e];return _0x231fd0;};'use strict';var monitorFormat={'wav':_0x64d7('0x0'),'wav49':_0x64d7('0x1'),'gsm':'gsm'};var strategy={'fewestcalls':_0x64d7('0x2'),'leastrecent':'leastrecent','linear':_0x64d7('0x3'),'random':'random','ringall':_0x64d7('0x4'),'rr':_0x64d7('0x5'),'rrmemory':_0x64d7('0x6'),'rrordered':_0x64d7('0x7'),'wrandom':_0x64d7('0x8')};function VoiceQueue(_0x51fe6b){this['id']=_0x51fe6b['id']||0x0;this[_0x64d7('0x9')]=_0x51fe6b[_0x64d7('0x9')]||'';this[_0x64d7('0xa')]=_0x51fe6b['monitor_format']||'';this['type']=_0x51fe6b['type']||_0x64d7('0xb');this[_0x64d7('0xc')]=0x0;this[_0x64d7('0xd')]=0x0;this[_0x64d7('0xe')]=0x0;this[_0x64d7('0xf')]=0x0;this[_0x64d7('0x10')]=0x0;this[_0x64d7('0x11')]=0x0;this[_0x64d7('0x12')]=0x0;this[_0x64d7('0x13')]=0x0;this['available']=0x0;this[_0x64d7('0x14')]=0x0;this['inUse']=0x0;this[_0x64d7('0x15')]=0x0;this[_0x64d7('0x16')]=0x0;this[_0x64d7('0x17')]=0x0;this['onHold']=0x0;this[_0x64d7('0x18')]=0x0;this[_0x64d7('0x19')]=0x0;this[_0x64d7('0x1a')]=0x0;this[_0x64d7('0x1b')]=0x0;this['unavailable']=0x0;this['unknown']=0x0;this['acw']=_0x51fe6b['acw']||![];this[_0x64d7('0x1c')]=_0x51fe6b['acwTimeout']||0xa;this['autopause']=_0x51fe6b[_0x64d7('0x1d')]||'no';this[_0x64d7('0x1e')]=!![];this[_0x64d7('0x1f')]='';this[_0x64d7('0x20')]='';this[_0x64d7('0x21')]=0x0;this[_0x64d7('0x22')]=0x0;this['dialTimezone']=_0x51fe6b['dialTimezone']||null;this[_0x64d7('0x23')]=_0x51fe6b[_0x64d7('0x23')]?_0x51fe6b[_0x64d7('0x23')]:null;this[_0x64d7('0x24')]=_0x51fe6b[_0x64d7('0x24')];this[_0x64d7('0x25')]=_0x51fe6b['dialMethod']||'progressive';this[_0x64d7('0x26')]=_0x51fe6b['dialLimitChannel']||0x0;this[_0x64d7('0x27')]=_0x51fe6b[_0x64d7('0x27')]||0x0;this[_0x64d7('0x28')]=_0x51fe6b[_0x64d7('0x28')]||0x1;this[_0x64d7('0x29')]=_0x51fe6b[_0x64d7('0x29')]||_0x64d7('0x2a');this[_0x64d7('0x2b')]=_0x51fe6b[_0x64d7('0x2b')]||0.03;this[_0x64d7('0x2c')]=_0x51fe6b[_0x64d7('0x2c')]||0x258;this['dialOriginateCallerIdName']=_0x51fe6b['dialOriginateCallerIdName']||_0x64d7('0x2d');this[_0x64d7('0x2e')]=_0x51fe6b[_0x64d7('0x2e')]||_0x64d7('0x2d');this[_0x64d7('0x2f')]=_0x51fe6b[_0x64d7('0x2f')]||0x1e;this[_0x64d7('0x30')]=_0x51fe6b[_0x64d7('0x30')]||'tTxX';this[_0x64d7('0x31')]=_0x51fe6b['dialQueueTimeout']||0x3;this[_0x64d7('0x32')]=_0x51fe6b['dialQueueProject']||undefined;this[_0x64d7('0x33')]=_0x51fe6b['dialCongestionMaxRetry']||0x3;this[_0x64d7('0x34')]=_0x51fe6b['dialCongestionRetryFrequency']||0x96;this[_0x64d7('0x35')]=_0x51fe6b['dialBusyMaxRetry']||0x3;this[_0x64d7('0x36')]=_0x51fe6b[_0x64d7('0x36')]||0x96;this[_0x64d7('0x37')]=_0x51fe6b[_0x64d7('0x37')]||0x3;this['dialNoAnswerRetryFrequency']=_0x51fe6b[_0x64d7('0x38')]||0x96;this[_0x64d7('0x39')]=_0x51fe6b[_0x64d7('0x39')]||0x3;this[_0x64d7('0x3a')]=_0x51fe6b['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x51fe6b[_0x64d7('0x3b')]||0x3;this['dialDropRetryFrequency']=_0x51fe6b['dialDropRetryFrequency']||0x96;this[_0x64d7('0x3c')]=_0x51fe6b[_0x64d7('0x3c')]||0x3;this[_0x64d7('0x3d')]=_0x51fe6b[_0x64d7('0x3d')]||0x96;this[_0x64d7('0x3e')]=_0x51fe6b[_0x64d7('0x3e')]||0x3;this[_0x64d7('0x3f')]=_0x51fe6b[_0x64d7('0x3f')]||0x96;this[_0x64d7('0x40')]=_0x51fe6b[_0x64d7('0x40')]||0x3;this[_0x64d7('0x41')]=_0x51fe6b[_0x64d7('0x41')]||0x96;this[_0x64d7('0x42')]=_0x51fe6b['callAdditionalPhoneAfterMin']||0x3;this[_0x64d7('0x43')]=_0x51fe6b[_0x64d7('0x43')]||0x4;this[_0x64d7('0x44')]=_0x51fe6b[_0x64d7('0x44')]?_0x51fe6b['Trunk']:undefined;this[_0x64d7('0x45')]=_0x51fe6b[_0x64d7('0x45')]?_0x51fe6b[_0x64d7('0x45')]:undefined;this['dialPrefix']=_0x51fe6b[_0x64d7('0x46')]||undefined;this['Interval']=_0x51fe6b['Interval']?_0x51fe6b['Interval']:undefined;this['dialOrderByScheduledAt']=_0x51fe6b[_0x64d7('0x47')]||_0x64d7('0x48');this[_0x64d7('0x49')]=_0x51fe6b[_0x64d7('0x49')]||undefined;this[_0x64d7('0x4a')]=_0x51fe6b[_0x64d7('0x4a')]||undefined;this['strategy']=strategy[_0x51fe6b[_0x64d7('0x4b')]];this[_0x64d7('0x4c')]=!![];this[_0x64d7('0x4d')]=_0x51fe6b[_0x64d7('0x4d')]||![];this['dialAMDInitialSilence']=_0x51fe6b[_0x64d7('0x4e')];this['dialAMDGreeting']=_0x51fe6b[_0x64d7('0x4f')];this[_0x64d7('0x50')]=_0x51fe6b[_0x64d7('0x50')];this[_0x64d7('0x51')]=_0x51fe6b[_0x64d7('0x51')];this[_0x64d7('0x52')]=_0x51fe6b[_0x64d7('0x52')];this[_0x64d7('0x53')]=_0x51fe6b[_0x64d7('0x53')];this[_0x64d7('0x54')]=_0x51fe6b[_0x64d7('0x54')];this[_0x64d7('0x55')]=_0x51fe6b[_0x64d7('0x55')];this[_0x64d7('0x56')]=_0x51fe6b[_0x64d7('0x56')];this['outboundRejectCallsDay']=0x0;this['pTalking']=0x0;this[_0x64d7('0x57')]=_0x51fe6b[_0x64d7('0x57')];this[_0x64d7('0x58')]=0x0;this[_0x64d7('0x59')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x64d7('0x5a')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x64d7('0x5b')]=0x0;this[_0x64d7('0x5c')]=0x0;this[_0x64d7('0x5d')]=0x0;this[_0x64d7('0x5e')]=0x0;this[_0x64d7('0x5f')]=0x0;this[_0x64d7('0x60')]=0x0;this[_0x64d7('0x61')]=0x0;this[_0x64d7('0x62')]=0x0;this[_0x64d7('0x63')]=0x0;this[_0x64d7('0x64')]=undefined;this[_0x64d7('0x65')]=undefined;this[_0x64d7('0x66')]=undefined;this[_0x64d7('0x67')]=1.05;this[_0x64d7('0x68')]=0x0;this[_0x64d7('0x69')]=0x0;this[_0x64d7('0x6a')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x64d7('0x6b')]=0x0;this[_0x64d7('0x6c')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0x64d7('0x6d')]=0x0;this[_0x64d7('0x6e')]=_0x51fe6b['dialPredictiveIntervalMaxThreshold']||0x14;this[_0x64d7('0x6f')]=_0x51fe6b[_0x64d7('0x70')]||0xa;this[_0x64d7('0x71')]=0x0;this[_0x64d7('0x72')]=0x0;this[_0x64d7('0x73')]=0x1;this[_0x64d7('0x74')]=0x0;this[_0x64d7('0x75')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x64d7('0x76')]=0x0;this['dialRecallMeTimeout']=_0x51fe6b[_0x64d7('0x77')]||0x1e;this[_0x64d7('0x78')]=_0x51fe6b[_0x64d7('0x78')]||![];this[_0x64d7('0x79')]=!!_0x51fe6b[_0x64d7('0x79')]||![];this[_0x64d7('0x7a')]=!!_0x51fe6b[_0x64d7('0x7a')]||![];this['dialQueueProject2']=_0x51fe6b[_0x64d7('0x7b')]||undefined;this[_0x64d7('0x7c')]=_0x51fe6b[_0x64d7('0x7c')]||![];this['dialAgiAfterHangupAgent']=_0x51fe6b['dialAgiAfterHangupAgent']||![];this[_0x64d7('0xa')]=monitorFormat[_0x51fe6b[_0x64d7('0xa')]]?monitorFormat[_0x51fe6b['monitor_format']]:undefined;this[_0x64d7('0x7d')]=_0x51fe6b[_0x64d7('0x7d')]||![];this['mandatoryDispositionPause']=_0x51fe6b[_0x64d7('0x7e')]?_0x51fe6b[_0x64d7('0x7e')]:undefined;this[_0x64d7('0x7f')]=![];}module[_0x64d7('0x80')]=VoiceQueue; \ No newline at end of file +var _0x026b=['predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','gsm','leastrecent','linear','ringall','rrmemory','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','available','busy','invalid','loggedIn','notInUse','ringing','ringInUse','unavailable','unknown','acw','acwTimeout','autopause','message','temp','dialTimezone','dialGlobalInterval','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundReCallsDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls'];(function(_0x34ab1f,_0x47b5cd){var _0x159921=function(_0x595ea5){while(--_0x595ea5){_0x34ab1f['push'](_0x34ab1f['shift']());}};_0x159921(++_0x47b5cd);}(_0x026b,0x98));var _0xb026=function(_0x5581ba,_0x268887){_0x5581ba=_0x5581ba-0x0;var _0x1e927f=_0x026b[_0x5581ba];return _0x1e927f;};'use strict';var monitorFormat={'wav':_0xb026('0x0'),'wav49':_0xb026('0x1'),'gsm':_0xb026('0x2')};var strategy={'fewestcalls':'fewestcalls','leastrecent':_0xb026('0x3'),'linear':_0xb026('0x4'),'random':'random','ringall':_0xb026('0x5'),'rr':'roundrobin','rrmemory':_0xb026('0x6'),'rrordered':'rrordered','wrandom':'wrandom'};function VoiceQueue(_0x7fb731){this['id']=_0x7fb731['id']||0x0;this[_0xb026('0x7')]=_0x7fb731['name']||'';this[_0xb026('0x8')]=_0x7fb731[_0xb026('0x8')]||'';this['type']=_0x7fb731[_0xb026('0x9')]||_0xb026('0xa');this[_0xb026('0xb')]=0x0;this[_0xb026('0xc')]=0x0;this[_0xb026('0xd')]=0x0;this[_0xb026('0xe')]=0x0;this[_0xb026('0xf')]=0x0;this[_0xb026('0x10')]=0x0;this[_0xb026('0x11')]=0x0;this[_0xb026('0x12')]=0x0;this[_0xb026('0x13')]=0x0;this[_0xb026('0x14')]=0x0;this['inUse']=0x0;this[_0xb026('0x15')]=0x0;this[_0xb026('0x16')]=0x0;this[_0xb026('0x17')]=0x0;this['onHold']=0x0;this['paused']=0x0;this[_0xb026('0x18')]=0x0;this[_0xb026('0x19')]=0x0;this['talking']=0x0;this[_0xb026('0x1a')]=0x0;this[_0xb026('0x1b')]=0x0;this[_0xb026('0x1c')]=_0x7fb731[_0xb026('0x1c')]||![];this[_0xb026('0x1d')]=_0x7fb731['acwTimeout']||0xa;this[_0xb026('0x1e')]=_0x7fb731['autopause']||'no';this['sendMessageOneNotActive']=!![];this[_0xb026('0x1f')]='';this['statusMessage']='';this['originated']=0x0;this[_0xb026('0x20')]=0x0;this[_0xb026('0x21')]=_0x7fb731['dialTimezone']||null;this[_0xb026('0x22')]=_0x7fb731[_0xb026('0x22')]?_0x7fb731['dialGlobalInterval']:null;this['dialActive']=_0x7fb731['dialActive'];this[_0xb026('0x23')]=_0x7fb731[_0xb026('0x23')]||'progressive';this['dialLimitChannel']=_0x7fb731[_0xb026('0x24')]||0x0;this['dialLimitQueue']=_0x7fb731['dialLimitQueue']||0x0;this[_0xb026('0x25')]=_0x7fb731[_0xb026('0x25')]||0x1;this[_0xb026('0x26')]=_0x7fb731[_0xb026('0x26')]||_0xb026('0x27');this[_0xb026('0x28')]=_0x7fb731[_0xb026('0x28')]||0.03;this[_0xb026('0x29')]=_0x7fb731[_0xb026('0x29')]||0x258;this['dialOriginateCallerIdName']=_0x7fb731[_0xb026('0x2a')]||_0xb026('0x2b');this[_0xb026('0x2c')]=_0x7fb731[_0xb026('0x2c')]||_0xb026('0x2b');this[_0xb026('0x2d')]=_0x7fb731['dialOriginateTimeout']||0x1e;this[_0xb026('0x2e')]=_0x7fb731['dialQueueOptions']||_0xb026('0x2f');this[_0xb026('0x30')]=_0x7fb731['dialQueueTimeout']||0x3;this[_0xb026('0x31')]=_0x7fb731[_0xb026('0x31')]||undefined;this[_0xb026('0x32')]=_0x7fb731[_0xb026('0x32')]||0x3;this[_0xb026('0x33')]=_0x7fb731['dialCongestionRetryFrequency']||0x96;this[_0xb026('0x34')]=_0x7fb731[_0xb026('0x34')]||0x3;this[_0xb026('0x35')]=_0x7fb731['dialBusyRetryFrequency']||0x96;this[_0xb026('0x36')]=_0x7fb731[_0xb026('0x36')]||0x3;this[_0xb026('0x37')]=_0x7fb731['dialNoAnswerRetryFrequency']||0x96;this['dialNoSuchNumberMaxRetry']=_0x7fb731[_0xb026('0x38')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x7fb731[_0xb026('0x39')]||0x96;this['dialDropMaxRetry']=_0x7fb731[_0xb026('0x3a')]||0x3;this[_0xb026('0x3b')]=_0x7fb731[_0xb026('0x3b')]||0x96;this[_0xb026('0x3c')]=_0x7fb731[_0xb026('0x3c')]||0x3;this[_0xb026('0x3d')]=_0x7fb731[_0xb026('0x3d')]||0x96;this['dialMachineMaxRetry']=_0x7fb731[_0xb026('0x3e')]||0x3;this[_0xb026('0x3f')]=_0x7fb731['dialMachineRetryFrequency']||0x96;this[_0xb026('0x40')]=_0x7fb731['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x7fb731[_0xb026('0x41')]||0x96;this[_0xb026('0x42')]=_0x7fb731['callAdditionalPhoneAfterMin']||0x3;this[_0xb026('0x43')]=_0x7fb731[_0xb026('0x43')]||0x4;this['Trunk']=_0x7fb731[_0xb026('0x44')]?_0x7fb731[_0xb026('0x44')]:undefined;this[_0xb026('0x45')]=_0x7fb731[_0xb026('0x45')]?_0x7fb731[_0xb026('0x45')]:undefined;this[_0xb026('0x46')]=_0x7fb731[_0xb026('0x46')]||undefined;this[_0xb026('0x47')]=_0x7fb731[_0xb026('0x47')]?_0x7fb731[_0xb026('0x47')]:undefined;this['dialOrderByScheduledAt']=_0x7fb731[_0xb026('0x48')]||_0xb026('0x49');this[_0xb026('0x4a')]=_0x7fb731[_0xb026('0x4a')]||undefined;this[_0xb026('0x4b')]=_0x7fb731[_0xb026('0x4b')]||undefined;this['strategy']=strategy[_0x7fb731[_0xb026('0x4c')]];this[_0xb026('0x4d')]=!![];this[_0xb026('0x4e')]=_0x7fb731[_0xb026('0x4e')]||![];this[_0xb026('0x4f')]=_0x7fb731[_0xb026('0x4f')];this[_0xb026('0x50')]=_0x7fb731[_0xb026('0x50')];this[_0xb026('0x51')]=_0x7fb731[_0xb026('0x51')];this[_0xb026('0x52')]=_0x7fb731['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x7fb731['dialAMDMinWordLength'];this[_0xb026('0x53')]=_0x7fb731['dialAMDBetweenWordsSilence'];this[_0xb026('0x54')]=_0x7fb731['dialAMDMaximumNumberOfWords'];this[_0xb026('0x55')]=_0x7fb731[_0xb026('0x55')];this[_0xb026('0x56')]=_0x7fb731['dialAMDMaximumWordLength'];this['outboundRejectCallsDay']=0x0;this[_0xb026('0x57')]=0x0;this[_0xb026('0x58')]=_0x7fb731[_0xb026('0x58')];this[_0xb026('0x59')]=0x0;this[_0xb026('0x5a')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0xb026('0x5b')]=0x0;this[_0xb026('0x5c')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0xb026('0x5d')]=0x0;this[_0xb026('0x5e')]=0x0;this[_0xb026('0x5f')]=0x0;this[_0xb026('0x60')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this['outboundDropCallsDayACS']=0x0;this[_0xb026('0x61')]=0x0;this['outboundAbandonedDay']=0x0;this[_0xb026('0x62')]=undefined;this[_0xb026('0x63')]=undefined;this[_0xb026('0x64')]=undefined;this[_0xb026('0x65')]=1.05;this[_0xb026('0x66')]=0x0;this[_0xb026('0x67')]=0x0;this[_0xb026('0x68')]=0x0;this[_0xb026('0x69')]=0x0;this[_0xb026('0x6a')]=0x0;this[_0xb026('0x6b')]=0x0;this[_0xb026('0x6c')]=0x0;this[_0xb026('0x6d')]=0x0;this[_0xb026('0x6e')]=_0x7fb731[_0xb026('0x6f')]||0x14;this[_0xb026('0x70')]=_0x7fb731[_0xb026('0x6f')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0xb026('0x71')]=0x0;this[_0xb026('0x72')]=0x1;this[_0xb026('0x73')]=0x0;this['erlangCallToSecond']=0x0;this['erlangAbandonmentRate']=0x0;this[_0xb026('0x74')]=0x0;this[_0xb026('0x75')]=_0x7fb731['dialRecallMeTimeout']||0x1e;this[_0xb026('0x76')]=_0x7fb731[_0xb026('0x76')]||![];this[_0xb026('0x77')]=!!_0x7fb731[_0xb026('0x77')]||![];this[_0xb026('0x78')]=!!_0x7fb731[_0xb026('0x78')]||![];this[_0xb026('0x79')]=_0x7fb731['dialQueueProject2']||undefined;this[_0xb026('0x7a')]=_0x7fb731[_0xb026('0x7a')]||![];this[_0xb026('0x7b')]=_0x7fb731['dialAgiAfterHangupAgent']||![];this[_0xb026('0x8')]=monitorFormat[_0x7fb731[_0xb026('0x8')]]?monitorFormat[_0x7fb731[_0xb026('0x8')]]:undefined;this['mandatoryDisposition']=_0x7fb731[_0xb026('0x7c')]||![];this[_0xb026('0x7d')]=_0x7fb731['mandatoryDispositionPause']?_0x7fb731['mandatoryDispositionPause']:undefined;this[_0xb026('0x7e')]=![];}module[_0xb026('0x7f')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 47849a0..c807880 100644 --- a/server/services/ami/model/voiceQueueSummary.js +++ b/server/services/ami/model/voiceQueueSummary.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3a5e=['type','unavailable','unknown','unmanaged','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','callerid','prototype','createReport','loggedin','callers','length','SIP/','online','incall','includes','status','invalid','ringInUse','booked','queue','dialer','exten','compareToInboundQueue','some','compareToOutboundQueue','active','outboundAbandonedCallsDay','preview','exports','available','loggedIn','loggedInDb','paused','ringing','talking','answered','inUse','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','waiting','name','strategy','abandoned','busy','onHold','notInUse','sumHoldTime','total'];(function(_0x11a4a8,_0x4eb10f){var _0x30dc6c=function(_0x59e1d4){while(--_0x59e1d4){_0x11a4a8['push'](_0x11a4a8['shift']());}};_0x30dc6c(++_0x4eb10f);}(_0x3a5e,0x14c));var _0xe3a5=function(_0x4310f2,_0x1ea065){_0x4310f2=_0x4310f2-0x0;var _0x47623b=_0x3a5e[_0x4310f2];return _0x47623b;};'use strict';var INBOUND_COUNTERS=[_0xe3a5('0x0'),_0xe3a5('0x1'),_0xe3a5('0x2'),_0xe3a5('0x3'),_0xe3a5('0x4'),_0xe3a5('0x5'),'waiting'];var OUTBOUND_COUNTERS=[_0xe3a5('0x0'),_0xe3a5('0x6'),_0xe3a5('0x7'),_0xe3a5('0x1'),_0xe3a5('0x2'),'originated','outboundAbandonedCallsDay',_0xe3a5('0x8'),'outboundBlacklistCallsDay',_0xe3a5('0x9'),_0xe3a5('0xa'),_0xe3a5('0xb'),_0xe3a5('0xc'),_0xe3a5('0xd'),_0xe3a5('0xe'),_0xe3a5('0xf'),'paused',_0xe3a5('0x10'),_0xe3a5('0x5'),_0xe3a5('0x11'),_0xe3a5('0x12'),'total',_0xe3a5('0x13')];function VoiceQueueSummary(_0x1bf6dc){this['id']=_0x1bf6dc['id'];this[_0xe3a5('0x14')]=_0x1bf6dc[_0xe3a5('0x14')];this[_0xe3a5('0x15')]=_0x1bf6dc[_0xe3a5('0x15')];this['abandoned']=_0x1bf6dc[_0xe3a5('0x16')]||0x0;this[_0xe3a5('0x6')]=_0x1bf6dc[_0xe3a5('0x6')]||0x0;this[_0xe3a5('0x0')]=_0x1bf6dc[_0xe3a5('0x0')]||0x0;this[_0xe3a5('0x17')]=_0x1bf6dc[_0xe3a5('0x17')]||0x0;this[_0xe3a5('0x7')]=_0x1bf6dc[_0xe3a5('0x7')]||0x0;this['invalid']=_0x1bf6dc['invalid']||0x0;this[_0xe3a5('0x1')]=_0x1bf6dc[_0xe3a5('0x1')]||0x0;this['loggedInDb']=_0x1bf6dc[_0xe3a5('0x2')]||0x0;this[_0xe3a5('0x18')]=_0x1bf6dc[_0xe3a5('0x18')]||0x0;this[_0xe3a5('0x19')]=_0x1bf6dc[_0xe3a5('0x19')]||0x0;this[_0xe3a5('0x3')]=_0x1bf6dc[_0xe3a5('0x3')]||0x0;this[_0xe3a5('0x4')]=_0x1bf6dc['ringing']||0x0;this['ringInUse']=_0x1bf6dc['ringInUse'];this[_0xe3a5('0x11')]=_0x1bf6dc[_0xe3a5('0x11')];this[_0xe3a5('0x12')]=_0x1bf6dc[_0xe3a5('0x12')];this[_0xe3a5('0x1a')]=_0x1bf6dc['sumHoldTime']||0x0;this['talking']=_0x1bf6dc['talking']||0x0;this[_0xe3a5('0x1b')]=_0x1bf6dc[_0xe3a5('0x1b')]||0x0;this[_0xe3a5('0x1c')]=_0x1bf6dc[_0xe3a5('0x1c')];this[_0xe3a5('0x1d')]=_0x1bf6dc[_0xe3a5('0x1d')]||0x0;this[_0xe3a5('0x1e')]=_0x1bf6dc[_0xe3a5('0x1e')]||0x0;this[_0xe3a5('0x1f')]=_0x1bf6dc[_0xe3a5('0x1f')]||0x0;this[_0xe3a5('0x13')]=_0x1bf6dc[_0xe3a5('0x13')]||0x0;if(_0x1bf6dc[_0xe3a5('0x1c')]==='outbound'){this[_0xe3a5('0x10')]=_0x1bf6dc[_0xe3a5('0x10')]||0x0;this[_0xe3a5('0x20')]=_0x1bf6dc[_0xe3a5('0x20')];this['dialMethod']=_0x1bf6dc[_0xe3a5('0x21')];this[_0xe3a5('0x22')]=_0x1bf6dc[_0xe3a5('0x22')];this['dialOriginateCallerIdNumber']=_0x1bf6dc[_0xe3a5('0x23')];this['dialOriginateTimeout']=_0x1bf6dc[_0xe3a5('0x24')];this[_0xe3a5('0x25')]=_0x1bf6dc['dialPrefix'];this[_0xe3a5('0x26')]=_0x1bf6dc[_0xe3a5('0x26')];this[_0xe3a5('0x27')]=_0x1bf6dc[_0xe3a5('0x27')];this[_0xe3a5('0x8')]=_0x1bf6dc[_0xe3a5('0x8')];this[_0xe3a5('0x28')]=_0x1bf6dc[_0xe3a5('0x28')];this[_0xe3a5('0x9')]=_0x1bf6dc[_0xe3a5('0x9')];this[_0xe3a5('0xa')]=_0x1bf6dc[_0xe3a5('0xa')];this[_0xe3a5('0x29')]=_0x1bf6dc[_0xe3a5('0x29')];this[_0xe3a5('0x2a')]=_0x1bf6dc[_0xe3a5('0x2a')];this[_0xe3a5('0x2b')]=_0x1bf6dc[_0xe3a5('0x2b')];this['outboundNoAnswerCallsDay']=_0x1bf6dc['outboundNoAnswerCallsDay'];this['outboundNoSuchCallsDay']=_0x1bf6dc[_0xe3a5('0xc')];this['outboundOriginateFailureCallsDay']=_0x1bf6dc[_0xe3a5('0x2c')];this[_0xe3a5('0xd')]=_0x1bf6dc[_0xe3a5('0xd')];this[_0xe3a5('0xe')]=_0x1bf6dc[_0xe3a5('0xe')];this[_0xe3a5('0xf')]=_0x1bf6dc[_0xe3a5('0xf')];this[_0xe3a5('0x2d')]=_0x1bf6dc[_0xe3a5('0x2d')];this[_0xe3a5('0x2e')]=_0x1bf6dc['predictiveIntervalAvgHoldtime'];this[_0xe3a5('0x2f')]=_0x1bf6dc[_0xe3a5('0x2f')];this[_0xe3a5('0x30')]=_0x1bf6dc[_0xe3a5('0x30')];this[_0xe3a5('0x31')]=_0x1bf6dc['predictiveIntervalDroppedCallsTimeout'];this[_0xe3a5('0x32')]=_0x1bf6dc[_0xe3a5('0x32')];this['predictiveIntervalErlangCallsDroppedCalls']=_0x1bf6dc[_0xe3a5('0x33')];this[_0xe3a5('0x34')]=_0x1bf6dc[_0xe3a5('0x34')];this[_0xe3a5('0x35')]=_0x1bf6dc['predictiveIntervalMultiplicativeFactor'];this[_0xe3a5('0x36')]=_0x1bf6dc[_0xe3a5('0x36')];this[_0xe3a5('0x37')]=_0x1bf6dc[_0xe3a5('0x37')];this[_0xe3a5('0x38')]=_0x1bf6dc[_0xe3a5('0x38')];this[_0xe3a5('0x39')]=_0x1bf6dc[_0xe3a5('0x39')];this['erlangCalls']=_0x1bf6dc['erlangCalls'];this[_0xe3a5('0x3a')]=_0x1bf6dc[_0xe3a5('0x3a')];this[_0xe3a5('0x3b')]=_0x1bf6dc[_0xe3a5('0x3b')];this[_0xe3a5('0x3c')]=_0x1bf6dc['erlangBusyFactor'];this[_0xe3a5('0x3d')]=_0x1bf6dc[_0xe3a5('0x3d')];this[_0xe3a5('0x3e')]=_0x1bf6dc[_0xe3a5('0x3e')];this[_0xe3a5('0x3f')]=_0x1bf6dc[_0xe3a5('0x3f')];this[_0xe3a5('0x40')]=_0x1bf6dc[_0xe3a5('0x40')];}if(_0x1bf6dc[_0xe3a5('0x41')]){this[_0xe3a5('0x41')]={'id':_0x1bf6dc[_0xe3a5('0x41')]['id'],'name':_0x1bf6dc[_0xe3a5('0x41')][_0xe3a5('0x14')],'active':_0x1bf6dc[_0xe3a5('0x41')]['active'],'callerid':_0x1bf6dc['Trunk'][_0xe3a5('0x42')]};}}VoiceQueueSummary[_0xe3a5('0x43')][_0xe3a5('0x44')]=function(_0xaacd4c,_0x2a524c,_0x524561,_0x27f9a4){this[_0xe3a5('0x2')]=0x0;this[_0xe3a5('0x5')]=0x0;this[_0xe3a5('0x3')]=0x0;this[_0xe3a5('0x1e')]=0x0;this[_0xe3a5('0x19')]=0x0;this[_0xe3a5('0x7')]=0x0;this[_0xe3a5('0x17')]=0x0;this['invalid']=0x0;this[_0xe3a5('0x1d')]=0x0;this[_0xe3a5('0x4')]=0x0;this['ringInUse']=0x0;this[_0xe3a5('0x18')]=0x0;if(_0x524561){if(_0x524561[_0xe3a5('0x0')]){this[_0xe3a5('0x0')]=Number(_0x524561['available']);}if(_0x524561[_0xe3a5('0x45')]){this[_0xe3a5('0x1')]=Number(_0x524561[_0xe3a5('0x45')]);}if(_0x524561['callers']){this[_0xe3a5('0x13')]=Number(_0x524561[_0xe3a5('0x46')]);}}for(var _0x28ef74=0x0;_0x28ef74<_0xaacd4c[_0xe3a5('0x47')];_0x28ef74++){var _0x54be15=_0x2a524c[_0xe3a5('0x48')+_0xaacd4c[_0x28ef74][_0xe3a5('0x14')]];if(_0x54be15&&_0x54be15[_0xe3a5('0x49')]){this[_0xe3a5('0x2')]+=0x1;}if(_0xaacd4c[_0x28ef74][_0xe3a5('0x4a')]==='1'){this['talking']+=0x1;}if(_0xaacd4c[_0x28ef74]['paused']==='1'&&!['2','7','8'][_0xe3a5('0x4b')](_0xaacd4c[_0x28ef74][_0xe3a5('0x4c')])){this['paused']+=0x1;}switch(_0xaacd4c[_0x28ef74][_0xe3a5('0x4c')]){case'0':this['unknown']+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this[_0xe3a5('0x7')]+=0x1;break;case'3':this[_0xe3a5('0x17')]+=0x1;break;case'4':this[_0xe3a5('0x4d')]+=0x1;break;case'5':this[_0xe3a5('0x1d')]+=0x1;break;case'6':this[_0xe3a5('0x4')]+=0x1;break;case'7':this[_0xe3a5('0x4e')]+=0x1;break;case'8':this[_0xe3a5('0x18')]+=0x1;break;}}if(this[_0xe3a5('0x21')]===_0xe3a5('0x4f')){var _0x5da7c5=Object['keys'](_0x27f9a4);for(var _0x44d4fb=0x0;_0x44d4fb<_0x5da7c5[_0xe3a5('0x47')];_0x44d4fb++){var _0x449e79=_0x5da7c5[_0x44d4fb];var _0x72ffd2=_0x27f9a4[_0x449e79];if(_0x72ffd2[_0xe3a5('0x50')]===this[_0xe3a5('0x14')]&&_0x72ffd2[_0xe3a5('0x1c')]===_0xe3a5('0x51')&&_0x72ffd2[_0xe3a5('0x52')]==='xcally-motion-preview'){this[_0xe3a5('0x5')]+=0x1;}}if(this[_0xe3a5('0x5')]>this[_0xe3a5('0x7')]){this[_0xe3a5('0x5')]=this[_0xe3a5('0x7')];}this[_0xe3a5('0x10')]=0x0;}return this;};VoiceQueueSummary[_0xe3a5('0x43')][_0xe3a5('0x53')]=function(_0x1f576e){var _0x1dad61=![];if(_0x1f576e){_0x1dad61=INBOUND_COUNTERS[_0xe3a5('0x54')](function(_0x1c5c86){return this[_0x1c5c86]!==_0x1f576e[_0x1c5c86];},this);}return _0x1dad61;};VoiceQueueSummary[_0xe3a5('0x43')][_0xe3a5('0x55')]=function(_0x56d26c){var _0x53d2de=![];var _0x4cd15d=![];var _0x58ca8e=![];if(_0x56d26c){_0x53d2de=this[_0xe3a5('0x21')]!==_0x56d26c[_0xe3a5('0x21')]||this[_0xe3a5('0x20')]!==_0x56d26c[_0xe3a5('0x20')]||this[_0xe3a5('0x3f')]!==_0x56d26c[_0xe3a5('0x3f')]||this['statusMessage']!==_0x56d26c['statusMessage'];_0x4cd15d=OUTBOUND_COUNTERS[_0xe3a5('0x54')](function(_0x446786){return this[_0x446786]!==_0x56d26c[_0x446786];},this);if(this[_0xe3a5('0x41')]&&_0x56d26c[_0xe3a5('0x41')]){_0x58ca8e=this['Trunk'][_0xe3a5('0x14')]!==_0x56d26c[_0xe3a5('0x41')][_0xe3a5('0x14')]||this['Trunk'][_0xe3a5('0x56')]!==_0x56d26c[_0xe3a5('0x41')][_0xe3a5('0x56')];}}return _0x53d2de||_0x4cd15d||_0x58ca8e;};VoiceQueueSummary[_0xe3a5('0x43')]['updateReportFromOutboundQueue']=function(_0x1ac332){this['answered']=_0x1ac332['answered'];this[_0xe3a5('0x3f')]=_0x1ac332[_0xe3a5('0x3f')];this['statusMessage']=_0x1ac332['statusMessage'];this[_0xe3a5('0x39')]=_0x1ac332['originated'];this[_0xe3a5('0x57')]=_0x1ac332[_0xe3a5('0x57')];this['outboundAnswerCallsDay']=_0x1ac332[_0xe3a5('0x8')];this[_0xe3a5('0x28')]=_0x1ac332['outboundBlacklistCallsDay'];this['outboundBusyCallsDay']=_0x1ac332[_0xe3a5('0x9')];this[_0xe3a5('0xa')]=_0x1ac332[_0xe3a5('0xa')];this[_0xe3a5('0xb')]=_0x1ac332[_0xe3a5('0xb')];this[_0xe3a5('0xc')]=_0x1ac332[_0xe3a5('0xc')];this[_0xe3a5('0xd')]=_0x1ac332[_0xe3a5('0xd')];this[_0xe3a5('0xe')]=_0x1ac332['outboundRejectCallsDay'];this['outboundUnknownCallsDay']=_0x1ac332[_0xe3a5('0xf')];this['sumBillable']=_0x1ac332[_0xe3a5('0x11')];this['sumDuration']=_0x1ac332[_0xe3a5('0x12')];this[_0xe3a5('0x1b')]=_0x1ac332[_0xe3a5('0x1b')];if(this['dialMethod']===_0xe3a5('0x58')){this[_0xe3a5('0x10')]=_0x1ac332[_0xe3a5('0x10')];}};module[_0xe3a5('0x59')]=VoiceQueueSummary; \ No newline at end of file +var _0x16a6=['available','loggedIn','paused','ringing','talking','waiting','answered','loggedInDb','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundNoAnswerCallsDay','outboundReCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','total','name','strategy','abandoned','busy','inUse','invalid','onHold','notInUse','ringInUse','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','createReport','loggedin','callers','SIP/','incall','includes','status','booked','keys','length','queue','dialer','exten','compareToInboundQueue','some','updateReportFromOutboundQueue','outboundAbandonedCallsDay','exports'];(function(_0x287517,_0x1c3b71){var _0x2306f1=function(_0x138f6e){while(--_0x138f6e){_0x287517['push'](_0x287517['shift']());}};_0x2306f1(++_0x1c3b71);}(_0x16a6,0x15c));var _0x616a=function(_0x4907de,_0x5bbdc6){_0x4907de=_0x4907de-0x0;var _0x482054=_0x16a6[_0x4907de];return _0x482054;};'use strict';var INBOUND_COUNTERS=[_0x616a('0x0'),_0x616a('0x1'),'loggedInDb',_0x616a('0x2'),_0x616a('0x3'),_0x616a('0x4'),_0x616a('0x5')];var OUTBOUND_COUNTERS=[_0x616a('0x0'),_0x616a('0x6'),'inUse',_0x616a('0x1'),_0x616a('0x7'),'originated','outboundAbandonedCallsDay',_0x616a('0x8'),_0x616a('0x9'),'outboundBusyCallsDay','outboundCongestionCallsDay',_0x616a('0xa'),'outboundNoSuchCallsDay',_0x616a('0xb'),'outboundRejectCallsDay',_0x616a('0xc'),_0x616a('0x2'),_0x616a('0xd'),'talking',_0x616a('0xe'),_0x616a('0xf'),_0x616a('0x10'),_0x616a('0x5')];function VoiceQueueSummary(_0x34562a){this['id']=_0x34562a['id'];this[_0x616a('0x11')]=_0x34562a[_0x616a('0x11')];this[_0x616a('0x12')]=_0x34562a['strategy'];this[_0x616a('0x13')]=_0x34562a[_0x616a('0x13')]||0x0;this[_0x616a('0x6')]=_0x34562a[_0x616a('0x6')]||0x0;this[_0x616a('0x0')]=_0x34562a['available']||0x0;this[_0x616a('0x14')]=_0x34562a[_0x616a('0x14')]||0x0;this[_0x616a('0x15')]=_0x34562a[_0x616a('0x15')]||0x0;this[_0x616a('0x16')]=_0x34562a['invalid']||0x0;this[_0x616a('0x1')]=_0x34562a[_0x616a('0x1')]||0x0;this['loggedInDb']=_0x34562a['loggedInDb']||0x0;this[_0x616a('0x17')]=_0x34562a[_0x616a('0x17')]||0x0;this[_0x616a('0x18')]=_0x34562a['notInUse']||0x0;this[_0x616a('0x2')]=_0x34562a[_0x616a('0x2')]||0x0;this['ringing']=_0x34562a['ringing']||0x0;this[_0x616a('0x19')]=_0x34562a[_0x616a('0x19')];this[_0x616a('0xe')]=_0x34562a[_0x616a('0xe')];this['sumDuration']=_0x34562a['sumDuration'];this['sumHoldTime']=_0x34562a['sumHoldTime']||0x0;this['talking']=_0x34562a['talking']||0x0;this[_0x616a('0x10')]=_0x34562a['total']||0x0;this[_0x616a('0x1a')]=_0x34562a[_0x616a('0x1a')];this['unavailable']=_0x34562a[_0x616a('0x1b')]||0x0;this[_0x616a('0x1c')]=_0x34562a[_0x616a('0x1c')]||0x0;this[_0x616a('0x1d')]=_0x34562a['unmanaged']||0x0;this[_0x616a('0x5')]=_0x34562a[_0x616a('0x5')]||0x0;if(_0x34562a[_0x616a('0x1a')]===_0x616a('0x1e')){this['pTalking']=_0x34562a[_0x616a('0xd')]||0x0;this['dialActive']=_0x34562a[_0x616a('0x1f')];this[_0x616a('0x20')]=_0x34562a['dialMethod'];this['dialOriginateCallerIdName']=_0x34562a['dialOriginateCallerIdName'];this[_0x616a('0x21')]=_0x34562a[_0x616a('0x21')];this[_0x616a('0x22')]=_0x34562a[_0x616a('0x22')];this['dialPrefix']=_0x34562a[_0x616a('0x23')];this[_0x616a('0x24')]=_0x34562a[_0x616a('0x24')];this[_0x616a('0x25')]=_0x34562a[_0x616a('0x25')];this[_0x616a('0x8')]=_0x34562a[_0x616a('0x8')];this['outboundBlacklistCallsDay']=_0x34562a[_0x616a('0x9')];this[_0x616a('0x26')]=_0x34562a['outboundBusyCallsDay'];this[_0x616a('0x27')]=_0x34562a['outboundCongestionCallsDay'];this['outboundDropCallsDayACS']=_0x34562a[_0x616a('0x28')];this[_0x616a('0x29')]=_0x34562a[_0x616a('0x29')];this['outboundDropCallsDayTimeout']=_0x34562a[_0x616a('0x2a')];this[_0x616a('0xa')]=_0x34562a[_0x616a('0xa')];this[_0x616a('0x2b')]=_0x34562a[_0x616a('0x2b')];this[_0x616a('0x2c')]=_0x34562a['outboundOriginateFailureCallsDay'];this[_0x616a('0xb')]=_0x34562a['outboundReCallsDay'];this[_0x616a('0x2d')]=_0x34562a[_0x616a('0x2d')];this[_0x616a('0xc')]=_0x34562a['outboundUnknownCallsDay'];this[_0x616a('0x2e')]=_0x34562a[_0x616a('0x2e')];this['predictiveIntervalAvgHoldtime']=_0x34562a['predictiveIntervalAvgHoldtime'];this[_0x616a('0x2f')]=_0x34562a[_0x616a('0x2f')];this[_0x616a('0x30')]=_0x34562a[_0x616a('0x30')];this['predictiveIntervalDroppedCallsTimeout']=_0x34562a['predictiveIntervalDroppedCallsTimeout'];this['predictiveIntervalErlangCalls']=_0x34562a[_0x616a('0x31')];this[_0x616a('0x32')]=_0x34562a[_0x616a('0x32')];this[_0x616a('0x33')]=_0x34562a[_0x616a('0x33')];this[_0x616a('0x34')]=_0x34562a[_0x616a('0x34')];this[_0x616a('0x35')]=_0x34562a[_0x616a('0x35')];this[_0x616a('0x36')]=_0x34562a['predictiveIntervalAvailable'];this[_0x616a('0x37')]=_0x34562a['predictiveIntervalTotalCalls'];this[_0x616a('0x38')]=_0x34562a[_0x616a('0x38')];this[_0x616a('0x39')]=_0x34562a[_0x616a('0x39')];this[_0x616a('0x3a')]=_0x34562a[_0x616a('0x3a')];this[_0x616a('0x3b')]=_0x34562a[_0x616a('0x3b')];this[_0x616a('0x3c')]=_0x34562a['erlangBusyFactor'];this[_0x616a('0x3d')]=_0x34562a[_0x616a('0x3d')];this[_0x616a('0x3e')]=_0x34562a[_0x616a('0x3e')];this['message']=_0x34562a[_0x616a('0x3f')];this['statusMessage']=_0x34562a[_0x616a('0x40')];}if(_0x34562a['Trunk']){this[_0x616a('0x41')]={'id':_0x34562a[_0x616a('0x41')]['id'],'name':_0x34562a['Trunk'][_0x616a('0x11')],'active':_0x34562a['Trunk'][_0x616a('0x42')],'callerid':_0x34562a[_0x616a('0x41')][_0x616a('0x43')]};}}VoiceQueueSummary[_0x616a('0x44')][_0x616a('0x45')]=function(_0x21fd2b,_0x3719b,_0x54cad0,_0x3a4ef5){this['loggedInDb']=0x0;this[_0x616a('0x4')]=0x0;this[_0x616a('0x2')]=0x0;this[_0x616a('0x1c')]=0x0;this['notInUse']=0x0;this[_0x616a('0x15')]=0x0;this[_0x616a('0x14')]=0x0;this[_0x616a('0x16')]=0x0;this[_0x616a('0x1b')]=0x0;this[_0x616a('0x3')]=0x0;this['ringInUse']=0x0;this[_0x616a('0x17')]=0x0;if(_0x54cad0){if(_0x54cad0[_0x616a('0x0')]){this[_0x616a('0x0')]=Number(_0x54cad0['available']);}if(_0x54cad0[_0x616a('0x46')]){this[_0x616a('0x1')]=Number(_0x54cad0[_0x616a('0x46')]);}if(_0x54cad0[_0x616a('0x47')]){this[_0x616a('0x5')]=Number(_0x54cad0[_0x616a('0x47')]);}}for(var _0x7052ba=0x0;_0x7052ba<_0x21fd2b['length'];_0x7052ba++){var _0x19059c=_0x3719b[_0x616a('0x48')+_0x21fd2b[_0x7052ba]['name']];if(_0x19059c&&_0x19059c['online']){this[_0x616a('0x7')]+=0x1;}if(_0x21fd2b[_0x7052ba][_0x616a('0x49')]==='1'){this[_0x616a('0x4')]+=0x1;}if(_0x21fd2b[_0x7052ba][_0x616a('0x2')]==='1'&&!['2','7','8'][_0x616a('0x4a')](_0x21fd2b[_0x7052ba][_0x616a('0x4b')])){this['paused']+=0x1;}switch(_0x21fd2b[_0x7052ba][_0x616a('0x4b')]){case'0':this[_0x616a('0x1c')]+=0x1;break;case'1':this[_0x616a('0x18')]+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0x616a('0x14')]+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this[_0x616a('0x1b')]+=0x1;break;case'6':this[_0x616a('0x3')]+=0x1;break;case'7':this[_0x616a('0x19')]+=0x1;break;case'8':this[_0x616a('0x17')]+=0x1;break;}}if(this['dialMethod']===_0x616a('0x4c')){var _0x3976b4=Object[_0x616a('0x4d')](_0x3a4ef5);for(var _0x3d42fc=0x0;_0x3d42fc<_0x3976b4[_0x616a('0x4e')];_0x3d42fc++){var _0x588090=_0x3976b4[_0x3d42fc];var _0x35281b=_0x3a4ef5[_0x588090];if(_0x35281b[_0x616a('0x4f')]===this[_0x616a('0x11')]&&_0x35281b[_0x616a('0x1a')]===_0x616a('0x50')&&_0x35281b[_0x616a('0x51')]==='xcally-motion-preview'){this[_0x616a('0x4')]+=0x1;}}if(this[_0x616a('0x4')]>this[_0x616a('0x15')]){this[_0x616a('0x4')]=this['inUse'];}this[_0x616a('0xd')]=0x0;}return this;};VoiceQueueSummary['prototype'][_0x616a('0x52')]=function(_0x3f015c){var _0x515419=![];if(_0x3f015c){_0x515419=INBOUND_COUNTERS[_0x616a('0x53')](function(_0x1ea086){return this[_0x1ea086]!==_0x3f015c[_0x1ea086];},this);}return _0x515419;};VoiceQueueSummary[_0x616a('0x44')]['compareToOutboundQueue']=function(_0x32749f){var _0x37fb4d=![];var _0x21c462=![];var _0x3c78f0=![];if(_0x32749f){_0x37fb4d=this['dialMethod']!==_0x32749f['dialMethod']||this[_0x616a('0x1f')]!==_0x32749f[_0x616a('0x1f')]||this[_0x616a('0x3f')]!==_0x32749f[_0x616a('0x3f')]||this['statusMessage']!==_0x32749f[_0x616a('0x40')];_0x21c462=OUTBOUND_COUNTERS[_0x616a('0x53')](function(_0x1b8c83){return this[_0x1b8c83]!==_0x32749f[_0x1b8c83];},this);if(this['Trunk']&&_0x32749f['Trunk']){_0x3c78f0=this[_0x616a('0x41')][_0x616a('0x11')]!==_0x32749f[_0x616a('0x41')][_0x616a('0x11')]||this[_0x616a('0x41')][_0x616a('0x42')]!==_0x32749f[_0x616a('0x41')][_0x616a('0x42')];}}return _0x37fb4d||_0x21c462||_0x3c78f0;};VoiceQueueSummary[_0x616a('0x44')][_0x616a('0x54')]=function(_0x1e8029){this['answered']=_0x1e8029['answered'];this[_0x616a('0x3f')]=_0x1e8029[_0x616a('0x3f')];this[_0x616a('0x40')]=_0x1e8029[_0x616a('0x40')];this['originated']=_0x1e8029['originated'];this[_0x616a('0x55')]=_0x1e8029['outboundAbandonedCallsDay'];this[_0x616a('0x8')]=_0x1e8029[_0x616a('0x8')];this[_0x616a('0x9')]=_0x1e8029[_0x616a('0x9')];this['outboundBusyCallsDay']=_0x1e8029[_0x616a('0x26')];this[_0x616a('0x27')]=_0x1e8029[_0x616a('0x27')];this[_0x616a('0xa')]=_0x1e8029[_0x616a('0xa')];this['outboundNoSuchCallsDay']=_0x1e8029['outboundNoSuchCallsDay'];this['outboundReCallsDay']=_0x1e8029[_0x616a('0xb')];this['outboundRejectCallsDay']=_0x1e8029[_0x616a('0x2d')];this[_0x616a('0xc')]=_0x1e8029['outboundUnknownCallsDay'];this[_0x616a('0xe')]=_0x1e8029['sumBillable'];this['sumDuration']=_0x1e8029[_0x616a('0xf')];this['total']=_0x1e8029['total'];if(this[_0x616a('0x20')]==='preview'){this[_0x616a('0xd')]=_0x1e8029[_0x616a('0xd')];}};module[_0x616a('0x56')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 51f9f7a..1aac995 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 _0xa31b=['remoteUri','serverUrl','Configurations','exports','name','username','accessKey'];(function(_0x343d36,_0x5f248a){var _0x3bd305=function(_0x611a1e){while(--_0x611a1e){_0x343d36['push'](_0x343d36['shift']());}};_0x3bd305(++_0x5f248a);}(_0xa31b,0xf9));var _0xba31=function(_0x13b6fc,_0x1a2d73){_0x13b6fc=_0x13b6fc-0x0;var _0x3f8687=_0xa31b[_0x13b6fc];return _0x3f8687;};'use strict';function VtigerAccount(_0x1abb16){this['id']=_0x1abb16['id']||0x0;this[_0xba31('0x0')]=_0x1abb16[_0xba31('0x0')]||'';this[_0xba31('0x1')]=_0x1abb16[_0xba31('0x1')]||'';this['accessKey']=_0x1abb16[_0xba31('0x2')]||'';this[_0xba31('0x3')]=_0x1abb16[_0xba31('0x3')]||'';this[_0xba31('0x4')]=_0x1abb16[_0xba31('0x4')]||'';this['Configurations']=_0x1abb16[_0xba31('0x5')]||{};}module[_0xba31('0x6')]=VtigerAccount; \ No newline at end of file +var _0xbaa5=['Configurations','name','username','accessKey','remoteUri','serverUrl'];(function(_0x5b7d6a,_0x63e6a2){var _0x992adf=function(_0x4511ae){while(--_0x4511ae){_0x5b7d6a['push'](_0x5b7d6a['shift']());}};_0x992adf(++_0x63e6a2);}(_0xbaa5,0x1d5));var _0x5baa=function(_0x3e6f3a,_0xac6434){_0x3e6f3a=_0x3e6f3a-0x0;var _0x50ed3b=_0xbaa5[_0x3e6f3a];return _0x50ed3b;};'use strict';function VtigerAccount(_0x5e55b3){this['id']=_0x5e55b3['id']||0x0;this[_0x5baa('0x0')]=_0x5e55b3[_0x5baa('0x0')]||'';this[_0x5baa('0x1')]=_0x5e55b3[_0x5baa('0x1')]||'';this[_0x5baa('0x2')]=_0x5e55b3[_0x5baa('0x2')]||'';this[_0x5baa('0x3')]=_0x5e55b3[_0x5baa('0x3')]||'';this[_0x5baa('0x4')]=_0x5e55b3['serverUrl']||'';this[_0x5baa('0x5')]=_0x5e55b3[_0x5baa('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 cbe173b..c75ddd2 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 _0x30f2=['integrationTab','serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType','type'];(function(_0x3e438f,_0x4439e7){var _0x35f7ff=function(_0x5c643a){while(--_0x5c643a){_0x3e438f['push'](_0x3e438f['shift']());}};_0x35f7ff(++_0x4439e7);}(_0x30f2,0x10c));var _0x230f=function(_0x42c622,_0x165d13){_0x42c622=_0x42c622-0x0;var _0x420531=_0x30f2[_0x42c622];return _0x420531;};'use strict';function ZendeskAccount(_0x2a8165){this['id']=_0x2a8165['id']||0x0;this[_0x230f('0x0')]=_0x2a8165[_0x230f('0x0')]||'';this[_0x230f('0x1')]=_0x2a8165[_0x230f('0x1')]||'';this[_0x230f('0x2')]=_0x2a8165['password']||'';this[_0x230f('0x3')]=_0x2a8165[_0x230f('0x3')]||'';this[_0x230f('0x4')]=_0x2a8165[_0x230f('0x4')]||'';this[_0x230f('0x5')]=_0x2a8165[_0x230f('0x5')]||'';this['type']=_0x2a8165[_0x230f('0x6')]||_0x230f('0x7');this[_0x230f('0x8')]=_0x2a8165['serverUrl']||'';this['Configurations']=_0x2a8165[_0x230f('0x9')]||{};}module[_0x230f('0xa')]=ZendeskAccount; \ No newline at end of file +var _0x01a2=['integrationTab','serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType'];(function(_0x58e747,_0x2d0476){var _0x31163b=function(_0x99d628){while(--_0x99d628){_0x58e747['push'](_0x58e747['shift']());}};_0x31163b(++_0x2d0476);}(_0x01a2,0xb8));var _0x201a=function(_0x4f2520,_0x2e8b63){_0x4f2520=_0x4f2520-0x0;var _0x417d13=_0x01a2[_0x4f2520];return _0x417d13;};'use strict';function ZendeskAccount(_0x3d4fb1){this['id']=_0x3d4fb1['id']||0x0;this[_0x201a('0x0')]=_0x3d4fb1[_0x201a('0x0')]||'';this[_0x201a('0x1')]=_0x3d4fb1[_0x201a('0x1')]||'';this['password']=_0x3d4fb1[_0x201a('0x2')]||'';this[_0x201a('0x3')]=_0x3d4fb1[_0x201a('0x3')]||'';this['remoteUri']=_0x3d4fb1[_0x201a('0x4')]||'';this[_0x201a('0x5')]=_0x3d4fb1['authType']||'';this['type']=_0x3d4fb1['type']||_0x201a('0x6');this[_0x201a('0x7')]=_0x3d4fb1[_0x201a('0x7')]||'';this[_0x201a('0x8')]=_0x3d4fb1[_0x201a('0x8')]||{};}module[_0x201a('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index fa971cf..e0fe98d 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 _0x7247=['Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl','code'];(function(_0x512396,_0x23ad68){var _0x665c5c=function(_0x400438){while(--_0x400438){_0x512396['push'](_0x512396['shift']());}};_0x665c5c(++_0x23ad68);}(_0x7247,0x8e));var _0x7724=function(_0x2b5d31,_0x32c154){_0x2b5d31=_0x2b5d31-0x0;var _0x3a637a=_0x7247[_0x2b5d31];return _0x3a637a;};'use strict';function ZohoAccount(_0x123ad1){this['id']=_0x123ad1['id']||0x0;this[_0x7724('0x0')]=_0x123ad1[_0x7724('0x0')]||'';this[_0x7724('0x1')]=_0x123ad1[_0x7724('0x1')]||'';this['host']=_0x123ad1[_0x7724('0x2')]||'';this[_0x7724('0x3')]=_0x123ad1['zone']||'';this[_0x7724('0x4')]=_0x123ad1[_0x7724('0x4')]||'';this['clientSecret']=_0x123ad1[_0x7724('0x5')]||'';this[_0x7724('0x6')]=_0x123ad1[_0x7724('0x6')]||'';this[_0x7724('0x7')]=_0x123ad1['code']||'';this['refreshToken']=_0x123ad1['refreshToken']||'';this[_0x7724('0x8')]=_0x123ad1['Configurations']||{};}module[_0x7724('0x9')]=ZohoAccount; \ No newline at end of file +var _0x2f89=['host','zone','clientId','clientSecret','code','refreshToken','Configurations','exports','name','description'];(function(_0x897090,_0x113ad9){var _0x37b9c3=function(_0x1f27cf){while(--_0x1f27cf){_0x897090['push'](_0x897090['shift']());}};_0x37b9c3(++_0x113ad9);}(_0x2f89,0x13e));var _0x92f8=function(_0x2908d7,_0x1eb380){_0x2908d7=_0x2908d7-0x0;var _0x30c2c4=_0x2f89[_0x2908d7];return _0x30c2c4;};'use strict';function ZohoAccount(_0x472c5a){this['id']=_0x472c5a['id']||0x0;this[_0x92f8('0x0')]=_0x472c5a[_0x92f8('0x0')]||'';this[_0x92f8('0x1')]=_0x472c5a[_0x92f8('0x1')]||'';this['host']=_0x472c5a[_0x92f8('0x2')]||'';this[_0x92f8('0x3')]=_0x472c5a[_0x92f8('0x3')]||'';this[_0x92f8('0x4')]=_0x472c5a['clientId']||'';this[_0x92f8('0x5')]=_0x472c5a[_0x92f8('0x5')]||'';this['serverUrl']=_0x472c5a['serverUrl']||'';this[_0x92f8('0x6')]=_0x472c5a['code']||'';this[_0x92f8('0x7')]=_0x472c5a[_0x92f8('0x7')]||'';this[_0x92f8('0x8')]=_0x472c5a[_0x92f8('0x8')]||{};}module[_0x92f8('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index c0bcb20..23596c6 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 _0x896e=['Contact','phone','firstName','lastName','calleridnum','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','name','type','queue','membername','Agent','format','SIP/%s','calleridname'];(function(_0x3b10bf,_0x10ecf7){var _0x53a0fd=function(_0x186a0b){while(--_0x186a0b){_0x3b10bf['push'](_0x3b10bf['shift']());}};_0x53a0fd(++_0x10ecf7);}(_0x896e,0x1e9));var _0xe896=function(_0x416d58,_0x50d969){_0x416d58=_0x416d58-0x0;var _0x84b502=_0x896e[_0x416d58];return _0x84b502;};'use strict';var util=require(_0xe896('0x0'));var _=require(_0xe896('0x1'));var moment=require(_0xe896('0x2'));function checkNameSurname(_0x229b59,_0x36085e,_0x26d296){var _0x2af995='';if(!_[_0xe896('0x3')](_0x36085e)&&_0xe896('0x4')===typeof _0x36085e){_0x2af995+=_0x36085e;}if(!_[_0xe896('0x3')](_0x26d296)&&_0xe896('0x4')===typeof _0x26d296){_0x2af995+='\x20'+_0x26d296;}if(_0x2af995!==''){return _0x2af995;}return _0x229b59;}function Action(_0x318a7b,_0x52ac80,_0x24c430,_0x7a0721,_0x3b902c){this[_0xe896('0x5')]=_0x24c430||undefined;this[_0xe896('0x6')]=_0x318a7b['id'];this['queue']=_0x52ac80[_0xe896('0x7')];this[_0xe896('0x8')]=_0x52ac80[_0xe896('0x8')];this['campaigntype']=_0xe896('0x9');this['dialAnswer']=![];this[_0xe896('0xa')]=_['isNil'](_0x318a7b[_0xe896('0xb')])?undefined:_0x318a7b[_0xe896('0xb')][_0xe896('0x7')];this['channelAgent']=this[_0xe896('0xa')]?util[_0xe896('0xc')](_0xe896('0xd'),this['membername']):_0x7a0721||undefined;this[_0xe896('0xe')]=checkNameSurname(_0x318a7b[_0xe896('0xf')][_0xe896('0x10')],_0x318a7b['Contact'][_0xe896('0x11')],_0x318a7b[_0xe896('0xf')][_0xe896('0x12')]);this['active']=_0x318a7b['active']||![];this[_0xe896('0x13')]=_0x318a7b[_0xe896('0x10')];this['scheduledat']=_0x318a7b['scheduledat'];this[_0xe896('0x14')]=_0x318a7b[_0xe896('0x14')]||0x0;this['countcongestionretry']=_0x318a7b[_0xe896('0x15')]||0x0;this['countnoanswerretry']=_0x318a7b[_0xe896('0x16')]||0x0;this[_0xe896('0x17')]=(_0x318a7b[_0xe896('0x14')]||0x0)+(_0x318a7b['countcongestionretry']||0x0)+(_0x318a7b[_0xe896('0x16')]||0x0)+(_0x318a7b[_0xe896('0x18')]||0x0)+(_0x318a7b[_0xe896('0x19')]||0x0)+(_0x318a7b[_0xe896('0x1a')]||0x0)+(_0x318a7b[_0xe896('0x1b')]||0x0)+(_0x318a7b[_0xe896('0x1c')]||0x0);this[_0xe896('0x18')]=_0x318a7b[_0xe896('0x18')]||0x0;this['countdropretry']=_0x318a7b[_0xe896('0x19')]||0x0;this['countabandonedretry']=_0x318a7b['countabandonedretry']||0x0;this[_0xe896('0x1b')]=_0x318a7b[_0xe896('0x1b')]||0x0;this[_0xe896('0x1c')]=_0x318a7b[_0xe896('0x1c')]||0x0;this['callback']=_0x318a7b[_0xe896('0x1d')];this['callbackuniqueid']=_0x318a7b['callbackuniqueid'];this[_0xe896('0x1e')]=_0x318a7b[_0xe896('0x1e')];this[_0xe896('0x1f')]=_0x318a7b[_0xe896('0x1f')];this[_0xe896('0x20')]=_0x318a7b[_0xe896('0x20')];this[_0xe896('0x21')]=_0x318a7b['ListId'];this[_0xe896('0x22')]=_[_0xe896('0x3')](_0x318a7b[_0xe896('0xb')])?_0x318a7b['UserId']:_0x318a7b[_0xe896('0xb')]['id'];this[_0xe896('0x23')]=_0x318a7b[_0xe896('0x23')];this[_0xe896('0x24')]='';this[_0xe896('0x25')]='';}Action[_0xe896('0x26')]['getCaller']=function(){return util[_0xe896('0xc')](_0xe896('0x27'),this[_0xe896('0xe')],this[_0xe896('0x28')]);};module[_0xe896('0x29')]=Action; \ No newline at end of file +var _0xe820=['calleridname','Contact','lastName','phone','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','exports','util','moment','isNil','idContact','queue','name','type','dialAnswer','membername','Agent','format','SIP/%s'];(function(_0x2e77ed,_0x368892){var _0x34f1db=function(_0x389934){while(--_0x389934){_0x2e77ed['push'](_0x2e77ed['shift']());}};_0x34f1db(++_0x368892);}(_0xe820,0xd2));var _0x0e82=function(_0x8025b0,_0xa09308){_0x8025b0=_0x8025b0-0x0;var _0x68ae30=_0xe820[_0x8025b0];return _0x68ae30;};'use strict';var util=require(_0x0e82('0x0'));var _=require('lodash');var moment=require(_0x0e82('0x1'));function checkNameSurname(_0x4e6b50,_0x55bbeb,_0x2d4a09){var _0x7b2e95='';if(!_[_0x0e82('0x2')](_0x55bbeb)&&'string'===typeof _0x55bbeb){_0x7b2e95+=_0x55bbeb;}if(!_[_0x0e82('0x2')](_0x2d4a09)&&'string'===typeof _0x2d4a09){_0x7b2e95+='\x20'+_0x2d4a09;}if(_0x7b2e95!==''){return _0x7b2e95;}return _0x4e6b50;}function Action(_0x2cb88f,_0x105e3c,_0x69e27f,_0x328b32,_0x2a0f9b){this['uniqueid']=_0x69e27f||undefined;this[_0x0e82('0x3')]=_0x2cb88f['id'];this[_0x0e82('0x4')]=_0x105e3c[_0x0e82('0x5')];this[_0x0e82('0x6')]=_0x105e3c[_0x0e82('0x6')];this['campaigntype']=_0x0e82('0x4');this[_0x0e82('0x7')]=![];this[_0x0e82('0x8')]=_[_0x0e82('0x2')](_0x2cb88f[_0x0e82('0x9')])?undefined:_0x2cb88f[_0x0e82('0x9')][_0x0e82('0x5')];this['channelAgent']=this[_0x0e82('0x8')]?util[_0x0e82('0xa')](_0x0e82('0xb'),this[_0x0e82('0x8')]):_0x328b32||undefined;this[_0x0e82('0xc')]=checkNameSurname(_0x2cb88f[_0x0e82('0xd')]['phone'],_0x2cb88f[_0x0e82('0xd')]['firstName'],_0x2cb88f['Contact'][_0x0e82('0xe')]);this['active']=_0x2cb88f['active']||![];this['calleridnum']=_0x2cb88f[_0x0e82('0xf')];this['scheduledat']=_0x2cb88f['scheduledat'];this[_0x0e82('0x10')]=_0x2cb88f['countbusyretry']||0x0;this[_0x0e82('0x11')]=_0x2cb88f[_0x0e82('0x11')]||0x0;this[_0x0e82('0x12')]=_0x2cb88f[_0x0e82('0x12')]||0x0;this['countglobal']=(_0x2cb88f[_0x0e82('0x10')]||0x0)+(_0x2cb88f[_0x0e82('0x11')]||0x0)+(_0x2cb88f[_0x0e82('0x12')]||0x0)+(_0x2cb88f[_0x0e82('0x13')]||0x0)+(_0x2cb88f[_0x0e82('0x14')]||0x0)+(_0x2cb88f[_0x0e82('0x15')]||0x0)+(_0x2cb88f[_0x0e82('0x16')]||0x0)+(_0x2cb88f[_0x0e82('0x17')]||0x0);this[_0x0e82('0x13')]=_0x2cb88f[_0x0e82('0x13')]||0x0;this[_0x0e82('0x14')]=_0x2cb88f['countdropretry']||0x0;this['countabandonedretry']=_0x2cb88f[_0x0e82('0x15')]||0x0;this[_0x0e82('0x16')]=_0x2cb88f[_0x0e82('0x16')]||0x0;this[_0x0e82('0x17')]=_0x2cb88f[_0x0e82('0x17')]||0x0;this[_0x0e82('0x18')]=_0x2cb88f[_0x0e82('0x18')];this[_0x0e82('0x19')]=_0x2cb88f['callbackuniqueid'];this[_0x0e82('0x1a')]=_0x2cb88f[_0x0e82('0x1a')];this[_0x0e82('0x1b')]=_0x2cb88f[_0x0e82('0x1b')];this['ContactId']=_0x2cb88f[_0x0e82('0x1c')];this[_0x0e82('0x1d')]=_0x2cb88f[_0x0e82('0x1d')];this[_0x0e82('0x1e')]=_['isNil'](_0x2cb88f[_0x0e82('0x9')])?_0x2cb88f['UserId']:_0x2cb88f['Agent']['id'];this[_0x0e82('0x1f')]=_0x2cb88f[_0x0e82('0x1f')];this['originatecalleridnum']='';this[_0x0e82('0x20')]='';}Action[_0x0e82('0x21')][_0x0e82('0x22')]=function(){return util['format'](_0x0e82('0x23'),this[_0x0e82('0xc')],this['number']);};module[_0x0e82('0x24')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 2ebcaa8..4aef958 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 _0xa41a=['logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','resolve','checkInBlack','phone','Contact\x20is\x20undefined','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','logger','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','pick','unlock','unlockContact','disableContact','execRun','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','isEmpty','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','dialActive','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridNumber','merge','toLowerVariables','starttime','variablesAction','Action','OriginateError','[originateFailure][logOriginateFailure]','channel','actionid','lookAgent','logLookAgent','clone','responsetime','isFailure','response','custom:agentringnoanswer','rejected','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','cause','statedesc','dialQueueProject','transfer','destlinkedid','destuniqueid','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','moment','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','../rpc/cmHopperAdditionalPhone','./action','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','sequence','trunks','actions','agents','clockClearZombieChannels','originateresponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','blindtransfer','syncBlindTransfer','campaignsPreview','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','available','CAMPAIGN_STATUS','[CampaignPreview]\x20Campaign\x20Queue:\x20','name','\x20is\x20not\x20active','message','DEACTIVATED','\x20is\x20deactivated','loopCampaigns','syncCampaigns','hasOwnProperty','dialMethod','clearZombieChannels','type','outbound','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','Queue','queue','pTalking:\x20','pTalking','dialAnswer','contactId','UserId','VoiceQueueId','status','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','getContactRecallMe','agentReadyId','then','length','getDiff','dialRecallMeTimeout','Agent','voicePause','run','[RecallMe]','logger2','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','isActive','INACTIVE','Trunk','isTrunkReachable','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','additional','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','answertime','[syncHangup][talking][increment]','uniqueid','connect','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','total','[16]','countglobal','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','Busy','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','verifyAdditionalPhones','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','rescheduleContact','scheduledAt','countbusyretry','unlockAgent','NOANSWER','outboundNoAnswerCallsDay','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','countnoanswerretry','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','originated:\x20','isUndefined','object','reason'];(function(_0xc2f6f0,_0x37b2b1){var _0x1b4125=function(_0x53a4dd){while(--_0x53a4dd){_0xc2f6f0['push'](_0xc2f6f0['shift']());}};_0x1b4125(++_0x37b2b1);}(_0xa41a,0x6b));var _0xaa41=function(_0x9d35cb,_0xa66f14){_0x9d35cb=_0x9d35cb-0x0;var _0x7c1125=_0xa41a[_0x9d35cb];return _0x7c1125;};'use strict';var util=require(_0xaa41('0x0'));var _=require(_0xaa41('0x1'));var uuid=require('uuid');var moment=require(_0xaa41('0x2'));var Redis=require(_0xaa41('0x3'));var config=require(_0xaa41('0x4'));var logger=require(_0xaa41('0x5'))(_0xaa41('0x6'));var loggerAction=require(_0xaa41('0x5'))(_0xaa41('0x7'));var ami=require(_0xaa41('0x8'));var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0xaa41('0x9'));var Action=require(_0xaa41('0xa'));var ut=require('./util/util');var utils=require('../dialer/utils');config[_0xaa41('0xb')]=_[_0xaa41('0xc')](config['redis'],{'host':_0xaa41('0xd'),'port':0x18eb});var io=require(_0xaa41('0xe'))(new Redis(config[_0xaa41('0xb')]));var Sequence=function(){};Sequence[_0xaa41('0xf')][_0xaa41('0x10')]=function(_0x38d930){this[_0xaa41('0x11')]=this[_0xaa41('0x11')]?this[_0xaa41('0x11')]['finally'](_0x38d930):_0x38d930();};function Preview(_0x1d3aac){this[_0xaa41('0x12')]=new Sequence();this['campaignsPreview']=_0x1d3aac['voiceQueues'];this[_0xaa41('0x13')]=_0x1d3aac['trunks'];this[_0xaa41('0x14')]={};this[_0xaa41('0x15')]=_0x1d3aac[_0xaa41('0x15')];this[_0xaa41('0x16')]=0x0;ami['on'](_0xaa41('0x17'),this['syncOriginateResponse'][_0xaa41('0x18')](this));ami['on'](_0xaa41('0x19'),this[_0xaa41('0x1a')][_0xaa41('0x18')](this));ami['on'](_0xaa41('0x1b'),this[_0xaa41('0x1c')][_0xaa41('0x18')](this));ami['on']('dialend',this[_0xaa41('0x1d')][_0xaa41('0x18')](this));ami['on'](_0xaa41('0x1e'),this[_0xaa41('0x1f')][_0xaa41('0x18')](this));ami['on'](_0xaa41('0x20'),this[_0xaa41('0x21')][_0xaa41('0x18')](this));ami['on'](_0xaa41('0x22'),this['syncAttendedTransfer']['bind'](this));ami['on'](_0xaa41('0x23'),this[_0xaa41('0x24')][_0xaa41('0x18')](this));this['loopCampaigns'](this[_0xaa41('0x25')]);}function emit(_0x1f692b,_0x4e768e,_0x513c61){io['to'](_0x1f692b)[_0xaa41('0x26')](_0x4e768e,_0x513c61);}function emitVoiceQueueChannelRemove(_0x5d4374){logger[_0xaa41('0x27')](_0xaa41('0x28'),JSON[_0xaa41('0x29')](_0x5d4374));emit(util[_0xaa41('0x2a')](_0xaa41('0x2b'),_0x5d4374['name']),_0xaa41('0x2c'),_0x5d4374);io[_0xaa41('0x26')](_0xaa41('0x2d'),_0x5d4374);}function notSendMessagesQueue(_0x21f596){if(_0x21f596[_0xaa41('0x2e')]){if(_0x21f596[_0xaa41('0x2f')]===0x0&&_0x21f596['pTalking']===0x0){_0x21f596['sendMessageOneNotActive']=![];_0x21f596[_0xaa41('0x30')]=0x0;_0x21f596['paused']=0x0;_0x21f596['message']=utils[_0xaa41('0x31')]['INACTIVE'];ut['logger'](_0xaa41('0x32'),_0x21f596[_0xaa41('0x33')]+_0xaa41('0x34'));}else{_0x21f596[_0xaa41('0x35')]=utils[_0xaa41('0x31')][_0xaa41('0x36')];ut['logger'](_0xaa41('0x32'),_0x21f596[_0xaa41('0x33')]+_0xaa41('0x37'));}}}Preview[_0xaa41('0xf')][_0xaa41('0x38')]=function(){var _0x4466a3=this;setInterval(function(){_0x4466a3[_0xaa41('0x39')]();},0x7cf);};Preview[_0xaa41('0xf')]['syncCampaigns']=function(){var _0x377add=this['campaignsPreview'];this['clockClearZombieChannels']+=0x1;for(var _0x714537 in _0x377add){if(_0x377add[_0xaa41('0x3a')](_0x714537)&&(_0x377add[_0x714537]['dialMethod']===_0xaa41('0x6')||_0x377add[_0x714537][_0xaa41('0x3b')]==='booked')&&_0x377add[_0x714537]['type']==='outbound'){if(this[_0xaa41('0x16')]>0x7){this[_0xaa41('0x16')]=0x0;this[_0xaa41('0x3c')]();}}if(_0x377add[_0xaa41('0x3a')](_0x714537)&&_0x377add[_0x714537]['dialMethod']===_0xaa41('0x6')&&_0x377add[_0x714537][_0xaa41('0x3d')]===_0xaa41('0x3e')){if(_0x377add[_0x714537]['dialActive']){this[_0xaa41('0x3f')](_0x377add[_0x714537]);if(_0x377add[_0x714537][_0xaa41('0x40')])this[_0xaa41('0x41')](_0x377add[_0x714537]);}else{notSendMessagesQueue(_0x377add[_0x714537]);}}}};Preview['prototype'][_0xaa41('0x42')]=function(_0x374117){var _0x57fe1d=this;this[_0xaa41('0x12')][_0xaa41('0x10')](function(){if(!_[_0xaa41('0x43')](_0x57fe1d['actions'][_0x374117])){loggerAction[_0xaa41('0x27')]('[clearZombieChannels][talking]',_0x374117,_0xaa41('0x44'),_0x57fe1d[_0xaa41('0x14')][_0x374117][_0xaa41('0x45')],'originated:\x20',JSON['stringify'](_0x57fe1d['campaignsPreview'][_0x57fe1d[_0xaa41('0x14')][_0x374117][_0xaa41('0x45')]][_0xaa41('0x2f')]),_0xaa41('0x46'),JSON['stringify'](_0x57fe1d['campaignsPreview'][_0x57fe1d[_0xaa41('0x14')][_0x374117][_0xaa41('0x45')]][_0xaa41('0x47')]),JSON[_0xaa41('0x29')](_0x57fe1d[_0xaa41('0x14')][_0x374117][_0xaa41('0x48')]),JSON[_0xaa41('0x29')](_['pick'](_0x57fe1d[_0xaa41('0x14')][_0x374117],[_0xaa41('0x49'),_0xaa41('0x4a'),_0xaa41('0x4b'),'ListId'])));return ami['Action']({'action':_0xaa41('0x4c'),'channel':_0x57fe1d[_0xaa41('0x14')][_0x374117]['channel']})[_0xaa41('0x4d')](function(_0x563687){if(_0x563687[_0xaa41('0x35')]===_0xaa41('0x4e')){setTimeout(function(){if(_0x57fe1d[_0xaa41('0x14')][_0x374117]){ut[_0xaa41('0x4f')](_0x57fe1d[_0xaa41('0x25')][_0x57fe1d[_0xaa41('0x14')][_0x374117][_0xaa41('0x45')]],_0xaa41('0x50'));if(_0x57fe1d['actions'][_0x374117][_0xaa41('0x48')]===!![]){ut[_0xaa41('0x51')](_0x57fe1d[_0xaa41('0x25')][_0x57fe1d[_0xaa41('0x14')][_0x374117][_0xaa41('0x45')]],_0xaa41('0x50'));ut['loggerError']('[Dialer][checkChannel][pTalking][Preview]'+_0x374117,_0x57fe1d[_0xaa41('0x14')][_0x374117]['queue']);}ut[_0xaa41('0x52')](_0xaa41('0x53')+_0x374117,_0x57fe1d[_0xaa41('0x14')][_0x374117][_0xaa41('0x45')]);delete _0x57fe1d[_0xaa41('0x14')][_0x374117];}},0x2328);}});}});};Preview[_0xaa41('0xf')][_0xaa41('0x3c')]=function(){var _0x5ee74c=this;loggerAction[_0xaa41('0x27')]('[action]',_['size'](this[_0xaa41('0x14')]));for(var _0x5ee127 in this['actions']){if(_0x5ee74c['actions'][_0xaa41('0x3a')](_0x5ee127)){_0x5ee74c['clearZombieChannel'](_0x5ee127);}}};Preview[_0xaa41('0xf')][_0xaa41('0x41')]=function(_0x4a6882){var _0x576f81=this;rpcDb[_0xaa41('0x54')](_0x4a6882['id'],ut[_0xaa41('0x55')](this[_0xaa41('0x15')]))[_0xaa41('0x56')](function(_0x3fe1a9){if(!_[_0xaa41('0x43')](_0x3fe1a9)){for(var _0x258096=0x0;_0x258096<_0x3fe1a9[_0xaa41('0x57')];_0x258096+=0x1){if(ut[_0xaa41('0x58')](_0x3fe1a9[_0x258096]['scheduledat'])<_0x4a6882[_0xaa41('0x59')]*0x3c){if(_0x3fe1a9[_0x258096][_0xaa41('0x5a')]&&!_0x3fe1a9[_0x258096][_0xaa41('0x5a')][_0xaa41('0x5b')]){_0x576f81[_0xaa41('0x5c')](_0x3fe1a9[_0x258096]['id'])[_0xaa41('0x56')](ut['logger2'](_0xaa41('0x5d')))[_0xaa41('0x4d')](ut[_0xaa41('0x5e')](_0xaa41('0x5d')));}else{rpcDb['disableContact'](_0x3fe1a9[_0x258096]['id']);}}else{var _0x23bc61=new Action(_0x3fe1a9[_0x258096],_0x4a6882);_0x23bc61['starttime']=moment()['format'](_0xaa41('0x5f'));_0x4a6882[_0xaa41('0x60')]+=0x1;ut[_0xaa41('0x61')](_0x23bc61,0x17,'RecallInQueue');if(_0x4a6882[_0xaa41('0x62')]){rpcDb[_0xaa41('0x63')](ut[_0xaa41('0x64')](_0x3fe1a9[_0x258096]));rpcDb['createCustomerHistory'](_0x23bc61,_0xaa41('0x65'));}else{ut[_0xaa41('0x61')](_0x23bc61,0x16,_0xaa41('0x66'));rpcDb[_0xaa41('0x67')](_0x23bc61,_0xaa41('0x68'));rpcDb[_0xaa41('0x69')](_0x23bc61,_0xaa41('0x68'));}}}}})[_0xaa41('0x4d')](ut['logger2'](_0xaa41('0x6a')));};Preview['prototype']['setMessage']=function(_0x1bdcd6){_0x1bdcd6[_0xaa41('0x2e')]=!![];if(ut[_0xaa41('0x6b')](_0x1bdcd6[_0xaa41('0x6c')])){_0x1bdcd6[_0xaa41('0x35')]=utils[_0xaa41('0x31')][_0xaa41('0x6d')];}else if(!ut[_0xaa41('0x6e')](_0x1bdcd6['dialActive'])){_0x1bdcd6[_0xaa41('0x35')]=utils[_0xaa41('0x31')][_0xaa41('0x6f')];}else if(!this['isTrunkReachable'](_0x1bdcd6[_0xaa41('0x70')])){if(!this[_0xaa41('0x71')](_0x1bdcd6['TrunkBackup'])){_0x1bdcd6[_0xaa41('0x35')]=utils[_0xaa41('0x31')][_0xaa41('0x72')];}else{_0x1bdcd6['message']=utils[_0xaa41('0x31')][_0xaa41('0x73')];}}else{_0x1bdcd6['message']=utils['CAMPAIGN_STATUS'][_0xaa41('0x73')];}};Preview[_0xaa41('0xf')][_0xaa41('0x74')]=function(_0x4d20c6,_0x5a76b9,_0x137f3f){var _0x1746b4=this;var _0x32f2b4=this[_0xaa41('0x14')][_0x5a76b9];var _0x5ccdc5=this[_0xaa41('0x25')][_0x32f2b4['queue']];var _0x555186;var _0x3ba305=![];var _0x52ae7f=0x2;var _0x3621c0=0x3;if(_0x5ccdc5){switch(_0x137f3f){case'1':_0x5ccdc5[_0xaa41('0x75')]+=0x1;_0x32f2b4[_0xaa41('0x76')]+=0x1;_0x32f2b4['countglobal']=ut[_0xaa41('0x77')](_0x32f2b4);ut[_0xaa41('0x61')](_0x32f2b4,0x0,_0xaa41('0x78'));ami[_0xaa41('0x26')](_0xaa41('0x79'),ut[_0xaa41('0x7a')](_0x32f2b4,_0xaa41('0x7b')));rpcDb[_0xaa41('0x67')](_0x32f2b4,_0xaa41('0x7c'));_0x1746b4['verifyAdditionalPhones'](_0x32f2b4,'0',_0x5ccdc5)[_0xaa41('0x56')](function(_0x40cdfc){_0x3ba305=_0x40cdfc[_0xaa41('0x7d')]==0x1;_0x52ae7f=_0x5ccdc5['dialNoSuchNumberRetryFrequency'];_0x3621c0=_0x5ccdc5[_0xaa41('0x7e')];if(!_0x3ba305){if(ut[_0xaa41('0x77')](_0x32f2b4)>=_0x5ccdc5[_0xaa41('0x7f')]){_0x555186=ut[_0xaa41('0x80')](_0x32f2b4,0xf,_0xaa41('0x81'));rpcDb[_0xaa41('0x69')](_0x555186,_0xaa41('0x82'));}else{if(_0x32f2b4['countnosuchnumberretry']>=_0x5ccdc5['dialNoSuchNumberMaxRetry']){rpcDb['createCustomerFinal'](_0x32f2b4,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x32f2b4,_0xaa41('0x76'),_0x5ccdc5['dialNoSuchNumberRetryFrequency']),_0x32f2b4['unlockAgent'],_0x32f2b4[_0xaa41('0x83')]);}}delete this[_0xaa41('0x14')][_0x4d20c6[_0xaa41('0x84')]];}else{_0x32f2b4[_0xaa41('0x76')]++;logger['info'](_0xaa41('0x85'),_0x32f2b4[_0xaa41('0x76')]);logger[_0xaa41('0x27')]('id',_0x32f2b4[_0xaa41('0x86')]);_0x1746b4[_0xaa41('0x87')]({'id':_0x32f2b4[_0xaa41('0x86')],'field':{'countnosuchnumberretry':_0x32f2b4[_0xaa41('0x76')]}})[_0xaa41('0x56')](function(){_0x1746b4[_0xaa41('0x88')](_0x32f2b4,_0x52ae7f,_0x3621c0)['then'](function(){});});}});break;case _0xaa41('0x89'):var _0x2d2af8=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x32f2b4['responsetime']=_0x2d2af8;_0x32f2b4[_0xaa41('0x8a')]=_0x2d2af8;_0x32f2b4['dialAnswer']=!![];_0x5ccdc5[_0xaa41('0x47')]+=0x1;logger['info'](_0xaa41('0x8b'),_0x32f2b4[_0xaa41('0x8c')],'\x20Queue',_0x5ccdc5[_0xaa41('0x33')],_0xaa41('0x46'),_0x5ccdc5[_0xaa41('0x47')]);ami[_0xaa41('0x26')]('custom:agentconnect',ut['buildObj'](_0x32f2b4,_0xaa41('0x8d'),this[_0xaa41('0x25')][_0x32f2b4['queue']]));if(_0x5ccdc5['acw']){ami[_0xaa41('0x26')](_0xaa41('0x8e'),ut[_0xaa41('0x8f')](_0x32f2b4));}break;case'16':ami[_0xaa41('0x26')](_0xaa41('0x90'),ut['buildObj'](_0x32f2b4,_0xaa41('0x91'),this['campaignsPreview'][_0x32f2b4['queue']]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x32f2b4,_0xaa41('0x91')));_0x5ccdc5[_0xaa41('0x92')]+=0x1;_0x5ccdc5[_0xaa41('0x93')]+=0x1;_0x5ccdc5['answered']+=0x1;ut[_0xaa41('0x51')](_0x5ccdc5,_0xaa41('0x94'));_0x32f2b4[_0xaa41('0x95')]=ut[_0xaa41('0x77')](_0x32f2b4);ut[_0xaa41('0x61')](_0x32f2b4,0x4,_0xaa41('0x96'));rpcDb[_0xaa41('0x67')](_0x32f2b4,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0xaa41('0x69')](_0x32f2b4,_0xaa41('0x97'));rpcDb[_0xaa41('0x98')](_0x32f2b4);_0x5ccdc5[_0xaa41('0x99')]+=_0x32f2b4['talktime'];_0x5ccdc5[_0xaa41('0x9a')]+=_0x32f2b4['talktime'];logger[_0xaa41('0x27')](_0xaa41('0x9b'),_0x32f2b4[_0xaa41('0x8c')],_0xaa41('0x9c'),_0x5ccdc5['name'],_0xaa41('0x46'),_0x5ccdc5[_0xaa41('0x47')]);delete this[_0xaa41('0x14')][_0x4d20c6[_0xaa41('0x84')]];break;case'BUSY':_0x5ccdc5[_0xaa41('0x9d')]+=0x1;_0x32f2b4['countbusyretry']+=0x1;_0x32f2b4[_0xaa41('0x95')]=ut[_0xaa41('0x77')](_0x32f2b4);ut['logCustomer'](_0x32f2b4,0x5,_0xaa41('0x9e'));_0x52ae7f=_0x5ccdc5[_0xaa41('0x9f')];_0x3621c0=_0x5ccdc5[_0xaa41('0x7e')];ami[_0xaa41('0x26')](_0xaa41('0xa0'),ut[_0xaa41('0x7a')](_0x32f2b4,_0xaa41('0xa1')));rpcDb[_0xaa41('0x67')](_0x32f2b4,_0xaa41('0xa2'));_0x1746b4[_0xaa41('0xa3')](_0x32f2b4,'5',_0x5ccdc5)[_0xaa41('0x56')](function(_0x59a30b){_0x3ba305=_0x59a30b[_0xaa41('0x7d')]==0x1;if(!_0x3ba305){if(ut[_0xaa41('0x77')](_0x32f2b4)>=_0x5ccdc5[_0xaa41('0x7f')]){_0x555186=ut['cloneAction'](_0x32f2b4,0xf,'Global');rpcDb[_0xaa41('0x69')](_0x555186,_0xaa41('0xa4'));}else{if(_0x32f2b4['countbusyretry']>=_0x5ccdc5[_0xaa41('0xa5')]){rpcDb[_0xaa41('0x69')](_0x32f2b4,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0xaa41('0xa6')](ut[_0xaa41('0xa7')](_0x32f2b4,_0xaa41('0xa8'),_0x5ccdc5[_0xaa41('0x9f')]),_0x32f2b4[_0xaa41('0xa9')],_0x32f2b4[_0xaa41('0x83')]);}}}else{_0x32f2b4[_0xaa41('0xa8')]++;_0x1746b4[_0xaa41('0x87')]({'id':_0x32f2b4['idContact'],'field':{'countbusyretry':_0x32f2b4['countbusyretry']}})[_0xaa41('0x56')](function(){_0x1746b4['swapAdditionalPhones'](_0x32f2b4,_0x52ae7f,_0x3621c0)[_0xaa41('0x56')](function(){});});}});break;case _0xaa41('0xaa'):_0x5ccdc5[_0xaa41('0xab')]+=0x1;_0x32f2b4['countnoanswerretry']+=0x1;_0x32f2b4[_0xaa41('0x95')]=ut[_0xaa41('0x77')](_0x32f2b4);ut[_0xaa41('0x61')](_0x32f2b4,0x3,'NoAnswer');_0x52ae7f=_0x5ccdc5[_0xaa41('0xac')];_0x3621c0=_0x5ccdc5[_0xaa41('0x7e')];var _0x5bd574=ut[_0xaa41('0xad')](_0x32f2b4,_0x5ccdc5);ami['emit']('custom:agentnoanswer',_0x5bd574);rpcDb[_0xaa41('0x67')](_0x32f2b4,_0xaa41('0xae'));_0x1746b4['verifyAdditionalPhones'](_0x32f2b4,'3',_0x5ccdc5)['then'](function(_0x241e1a){_0x3ba305=_0x241e1a[_0xaa41('0x7d')]==0x1;if(!_0x3ba305){if(ut[_0xaa41('0x77')](_0x32f2b4)>=_0x5ccdc5[_0xaa41('0x7f')]){_0x555186=ut['cloneAction'](_0x32f2b4,0xf,_0xaa41('0x81'));rpcDb[_0xaa41('0x69')](_0x555186,_0xaa41('0xaf'));}else{if(_0x32f2b4['countnoanswerretry']>=_0x5ccdc5[_0xaa41('0xb0')]){rpcDb[_0xaa41('0x69')](_0x32f2b4,_0xaa41('0xae'));}else{rpcDb['rescheduleContact'](ut[_0xaa41('0xa7')](_0x32f2b4,'countnoanswerretry',_0x5ccdc5['dialNoAnswerRetryFrequency']),_0x32f2b4[_0xaa41('0xa9')],_0x32f2b4[_0xaa41('0x83')]);}}}else{_0x32f2b4['countnoanswerretry']++;_0x1746b4[_0xaa41('0x87')]({'id':_0x32f2b4[_0xaa41('0x86')],'field':{'countnoanswerretry':_0x32f2b4[_0xaa41('0xb1')]}})['then'](function(){_0x1746b4[_0xaa41('0x88')](_0x32f2b4,_0x52ae7f,_0x3621c0)[_0xaa41('0x56')](function(){});});}});break;case _0xaa41('0xb2'):_0x5ccdc5[_0xaa41('0xb3')]+=0x1;_0x32f2b4[_0xaa41('0xb4')]+=0x1;_0x32f2b4['countglobal']=ut[_0xaa41('0x77')](_0x32f2b4);ut['logCustomer'](_0x32f2b4,0x8,_0xaa41('0xb5'));_0x52ae7f=_0x5ccdc5[_0xaa41('0xb6')];_0x3621c0=_0x5ccdc5[_0xaa41('0x7e')];ami[_0xaa41('0x26')](_0xaa41('0xb7'),ut[_0xaa41('0x7a')](_0x32f2b4,_0xaa41('0xb8')));rpcDb[_0xaa41('0x67')](_0x32f2b4,_0xaa41('0xb9'));_0x1746b4[_0xaa41('0xa3')](_0x32f2b4,'8',_0x5ccdc5)[_0xaa41('0x56')](function(_0x58ad21){_0x3ba305=_0x58ad21[_0xaa41('0x7d')]==0x1;if(!_0x3ba305){if(ut[_0xaa41('0x77')](_0x32f2b4)>=_0x5ccdc5['dialGlobalMaxRetry']){_0x555186=ut[_0xaa41('0x80')](_0x32f2b4,0xf,'Global');rpcDb[_0xaa41('0x69')](_0x555186,_0xaa41('0xba'));}else{if(_0x32f2b4[_0xaa41('0xb4')]>=_0x5ccdc5[_0xaa41('0xbb')]){rpcDb[_0xaa41('0x69')](_0x32f2b4,_0xaa41('0xb9'));}else{rpcDb[_0xaa41('0xa6')](ut['scheduledAt'](_0x32f2b4,_0xaa41('0xb4'),_0x5ccdc5[_0xaa41('0x9f')]),_0x32f2b4[_0xaa41('0xa9')],_0x32f2b4[_0xaa41('0x83')]);}}}else{_0x32f2b4['countcongestionretry']++;_0x1746b4[_0xaa41('0x87')]({'id':_0x32f2b4['idContact'],'field':{'countcongestionretry':_0x32f2b4[_0xaa41('0xb4')]}})[_0xaa41('0x56')](function(){_0x1746b4[_0xaa41('0x88')](_0x32f2b4,_0x52ae7f,_0x3621c0)[_0xaa41('0x56')](function(){});});}});break;case _0xaa41('0xbc'):_0x5ccdc5['outboundRejectCallsDay']+=0x1;_0x32f2b4[_0xaa41('0xbd')]+=0x1;_0x32f2b4[_0xaa41('0x95')]=ut['totalGlobal'](_0x32f2b4);ut[_0xaa41('0x61')](_0x32f2b4,0x14,_0xaa41('0xbe'));_0x52ae7f=_0x5ccdc5[_0xaa41('0xbf')];_0x3621c0=_0x5ccdc5[_0xaa41('0x7e')];ami[_0xaa41('0x26')](_0xaa41('0xc0'),ut[_0xaa41('0x7a')](_0x32f2b4,_0xaa41('0xc1')));rpcDb['createCustomerHistory'](_0x32f2b4,_0xaa41('0xc2'));_0x1746b4[_0xaa41('0xa3')](_0x32f2b4,'20',_0x5ccdc5)[_0xaa41('0x56')](function(_0x78265){_0x3ba305=_0x78265[_0xaa41('0x7d')]==0x1;if(!_0x3ba305){if(ut[_0xaa41('0x77')](_0x32f2b4)>=_0x5ccdc5['dialGlobalMaxRetry']){_0x555186=ut['cloneAction'](_0x32f2b4,0x14,'AgentReject');rpcDb[_0xaa41('0x69')](_0x555186,_0xaa41('0xc3'));}else{if(_0x32f2b4['countagentrejectretry']>=_0x5ccdc5[_0xaa41('0xc4')]){rpcDb[_0xaa41('0x69')](_0x32f2b4,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0xaa41('0xa6')](ut[_0xaa41('0xa7')](_0x32f2b4,_0xaa41('0xbd'),_0x5ccdc5[_0xaa41('0xbf')]),_0x32f2b4['unlockAgent'],_0x32f2b4[_0xaa41('0x83')]);}}}else{_0x32f2b4['countnoanswerretry']++;_0x1746b4[_0xaa41('0x87')]({'id':_0x32f2b4[_0xaa41('0x86')],'field':{'countnoanswerretry':_0x32f2b4[_0xaa41('0xb1')]}})[_0xaa41('0x56')](function(){_0x1746b4[_0xaa41('0x88')](_0x32f2b4,_0x52ae7f,_0x3621c0)[_0xaa41('0x56')](function(){});});}});break;case _0xaa41('0xc5'):_0x5ccdc5[_0xaa41('0xc6')]+=0x1;_0x32f2b4[_0xaa41('0xc7')]+=0x1;_0x32f2b4['countglobal']=ut[_0xaa41('0x77')](_0x32f2b4);ut[_0xaa41('0x61')](_0x32f2b4,0xb,_0xaa41('0xc8'));rpcDb['createCustomerHistory'](_0x32f2b4,_0xaa41('0xc9'));_0x1746b4[_0xaa41('0xa3')](_0x32f2b4,'11',_0x5ccdc5)[_0xaa41('0x56')](function(_0x408d95){_0x3ba305=_0x408d95[_0xaa41('0x7d')]==0x1;if(!_0x3ba305){if(ut[_0xaa41('0x77')](_0x32f2b4)>=_0x5ccdc5[_0xaa41('0x7f')]){_0x555186=ut[_0xaa41('0x80')](_0x32f2b4,0xf,_0xaa41('0x81'));rpcDb[_0xaa41('0x69')](_0x555186,_0xaa41('0xc9'));}else{if(_0x32f2b4['countabandonedetry']>=_0x5ccdc5[_0xaa41('0xca')]){rpcDb[_0xaa41('0x69')](_0x32f2b4,_0xaa41('0xc9'));}else{rpcDb[_0xaa41('0xa6')](ut[_0xaa41('0xa7')](_0x32f2b4,'countabandonedretry',_0x5ccdc5['dialAbandonedRetryFrequency']),_0x32f2b4[_0xaa41('0xa9')],_0x32f2b4[_0xaa41('0x83')]);}}}else{_0x32f2b4['countnoanswerretry']++;_0x1746b4[_0xaa41('0x87')]({'id':_0x32f2b4[_0xaa41('0x86')],'field':{'countnoanswerretry':_0x32f2b4['countnoanswerretry']}})['then'](function(){_0x1746b4['swapAdditionalPhones'](_0x32f2b4,_0x52ae7f,_0x3621c0)[_0xaa41('0x56')](function(){});});}});break;case'18':_0x5ccdc5[_0xaa41('0xcb')]+=0x1;_0x32f2b4[_0xaa41('0xcc')]+=0x1;_0x32f2b4[_0xaa41('0x95')]=ut[_0xaa41('0x77')](_0x32f2b4);ut[_0xaa41('0x61')](_0x32f2b4,0x12,_0x4d20c6[_0xaa41('0xcd')]||_0x4d20c6[_0xaa41('0xce')]);ami[_0xaa41('0x26')](_0xaa41('0xcf'),ut[_0xaa41('0x7a')](_0x32f2b4,'amd'));rpcDb['createCustomerHistory'](_0x32f2b4,_0xaa41('0xd0'));_0x1746b4[_0xaa41('0xa3')](_0x32f2b4,'18',_0x5ccdc5)['then'](function(_0x30e8cb){_0x3ba305=_0x30e8cb['additional']==0x1;if(!_0x3ba305){if(ut[_0xaa41('0x77')](_0x32f2b4)>=_0x5ccdc5[_0xaa41('0x7f')]){_0x555186=ut[_0xaa41('0x80')](_0x32f2b4,0x12,_0xaa41('0x81'));rpcDb[_0xaa41('0x69')](_0x555186,_0xaa41('0xd0'));}else{rpcDb[_0xaa41('0x69')](_0x32f2b4,_0xaa41('0xd0'));}}else{_0x32f2b4[_0xaa41('0xb1')]++;_0x1746b4['incrementPreviewCounters']({'id':_0x32f2b4['idContact'],'field':{'countnoanswerretry':_0x32f2b4['countnoanswerretry']}})[_0xaa41('0x56')](function(){_0x1746b4[_0xaa41('0x88')](_0x32f2b4,_0x52ae7f,_0x3621c0)['then'](function(){});});}});delete this['actions'][_0x4d20c6[_0xaa41('0x84')]];break;case'19':_0x5ccdc5[_0xaa41('0xcb')]+=0x1;_0x32f2b4['countglobal']=ut['totalGlobal'](_0x32f2b4);ut[_0xaa41('0x61')](_0x32f2b4,0x13,_0x4d20c6['cause-txt']||_0x4d20c6[_0xaa41('0xce')]);ami[_0xaa41('0x26')](_0xaa41('0xcf'),ut[_0xaa41('0x7a')](_0x32f2b4,_0xaa41('0xd1')));rpcDb[_0xaa41('0x67')](_0x32f2b4,_0xaa41('0xd2'));_0x1746b4[_0xaa41('0xa3')](_0x32f2b4,'18',_0x5ccdc5)[_0xaa41('0x56')](function(_0x573889){_0x3ba305=_0x573889['additional']==0x1;if(!_0x3ba305){if(ut[_0xaa41('0x77')](_0x32f2b4)>=_0x5ccdc5[_0xaa41('0x7f')]){_0x555186=ut[_0xaa41('0x80')](_0x32f2b4,0xf,_0xaa41('0x81'));rpcDb[_0xaa41('0x69')](_0x555186,_0xaa41('0xd2'));}else{rpcDb[_0xaa41('0x69')](_0x32f2b4,_0xaa41('0xd2'));}}else{_0x32f2b4[_0xaa41('0xb1')]++;_0x1746b4[_0xaa41('0x87')]({'id':_0x32f2b4[_0xaa41('0x86')],'field':{'countnoanswerretry':_0x32f2b4[_0xaa41('0xb1')]}})[_0xaa41('0x56')](function(){_0x1746b4[_0xaa41('0x88')](_0x32f2b4,_0x52ae7f,_0x3621c0)[_0xaa41('0x56')](function(){});});}});delete this['actions'][_0x4d20c6[_0xaa41('0x84')]];break;default:if(_0x32f2b4['dialAnswer']){ut[_0xaa41('0x51')](_0x5ccdc5,_0xaa41('0xd3'));ut[_0xaa41('0x52')](_0xaa41('0xd4')+_0x5ccdc5[_0xaa41('0x33')],_0x4d20c6);}_0x5ccdc5[_0xaa41('0xcb')]+=0x1;_0x32f2b4[_0xaa41('0x95')]=ut[_0xaa41('0x77')](_0x32f2b4);ut['logCustomer'](_0x32f2b4,0xc,_0x4d20c6[_0xaa41('0xcd')]||_0x4d20c6[_0xaa41('0xce')]);_0x52ae7f=_0x5ccdc5[_0xaa41('0xbf')];_0x3621c0=_0x5ccdc5[_0xaa41('0x7e')];rpcDb[_0xaa41('0x67')](_0x32f2b4,_0xaa41('0xd5'));_0x1746b4[_0xaa41('0xa3')](_0x32f2b4,'20',_0x5ccdc5)[_0xaa41('0x56')](function(_0x1b5933){_0x3ba305=_0x1b5933[_0xaa41('0x7d')]==0x1;if(!_0x3ba305){if(ut['totalGlobal'](_0x32f2b4)>=_0x5ccdc5['dialGlobalMaxRetry']){_0x555186=ut[_0xaa41('0x80')](_0x32f2b4,0xf,_0xaa41('0x81'));rpcDb[_0xaa41('0x69')](_0x555186,_0xaa41('0xd6'));}else{rpcDb[_0xaa41('0x69')](_0x32f2b4,_0xaa41('0xd6'));}delete this[_0xaa41('0x14')][_0x4d20c6[_0xaa41('0x84')]];}else{_0x1746b4[_0xaa41('0x88')](_0x32f2b4,_0x52ae7f,_0x3621c0)[_0xaa41('0x56')](function(){});}});}if(!(_0x32f2b4['dialAnswer']&&_0x137f3f==='16')){ut['updateOriginated'](_0x5ccdc5,_0xaa41('0xd7'));logger[_0xaa41('0x27')]('[originated][decrement][callProgressDetectingCustomer]',_0x32f2b4[_0xaa41('0x8c')],'\x20Queue',_0x5ccdc5[_0xaa41('0x33')],_0xaa41('0xd8'),_0x5ccdc5['originated']);}if(_0x137f3f!=='ANSWER'){delete this[_0xaa41('0x14')][_0x4d20c6[_0xaa41('0x84')]];delete this[_0xaa41('0x14')][_0x4d20c6['destlinkedid']];}_0x5ccdc5['queueSummaryCountersUpdated']=!![];}};Preview[_0xaa41('0xf')]['callProgressDetectingAgent']=function(_0x94423a,_0x59d6cf,_0x37dc6f){if(_[_0xaa41('0xd9')](_0x59d6cf)&&_0xaa41('0xda')!==typeof _0x59d6cf){return;}if(_[_0xaa41('0xd9')](_0x37dc6f)&&_0xaa41('0xda')!==typeof _0x37dc6f){return;}switch(_0x37dc6f[_0xaa41('0xdb')]){case'0':ut[_0xaa41('0xdc')](_0x94423a,0x0,'NoSuchNumber');rpcDb[_0xaa41('0xdd')](_0x94423a,_0xaa41('0xde'));break;case'3':ut['logAgent'](_0x94423a,0x3,_0xaa41('0xdf'));rpcDb[_0xaa41('0xdd')](_0x94423a,_0xaa41('0xe0'));break;case'5':ut[_0xaa41('0xdc')](_0x94423a,0x5,'Busy');rpcDb[_0xaa41('0xdd')](_0x94423a,_0xaa41('0xe1'));break;case'8':ut[_0xaa41('0xdc')](_0x94423a,0x8,_0xaa41('0xb5'));rpcDb[_0xaa41('0xdd')](_0x94423a,_0xaa41('0xe2'));break;case'22':ut[_0xaa41('0xdc')](_0x94423a,0x16,_0xaa41('0xe3'));rpcDb[_0xaa41('0xdd')](_0x94423a,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut['logAgent'](_0x94423a,0xc,_0x37dc6f[_0xaa41('0xdb')]);rpcDb[_0xaa41('0xdd')](_0x94423a,_0xaa41('0xe2'));}ut[_0xaa41('0x4f')](_0x59d6cf,_0xaa41('0xe4'));logger[_0xaa41('0x27')]('[originated][decrement][callProgressDetectingAgent]',_0x94423a[_0xaa41('0x8c')],_0xaa41('0x9c'),_0x59d6cf[_0xaa41('0x33')],_0xaa41('0xd8'),_0x59d6cf[_0xaa41('0x2f')]);delete this[_0xaa41('0x14')][_0x94423a['uniqueid']];};Preview[_0xaa41('0xf')][_0xaa41('0xa3')]=function(_0x13ddbe,_0x4cf0c5,_0x1ddfe5){return cmHopperAdditionalPhone[_0xaa41('0xa3')](_0x13ddbe,_0x4cf0c5,_0x1ddfe5)[_0xaa41('0x4d')](logger[_0xaa41('0x27')](_0xaa41('0xe5')));};Preview[_0xaa41('0xf')][_0xaa41('0x88')]=function(_0x943973,_0xe17579,_0x1a6de8){return cmHopperAdditionalPhone[_0xaa41('0x88')](_0x943973,_0xe17579,_0x1a6de8)[_0xaa41('0x4d')](logger[_0xaa41('0x27')]('[swapAdditionalPhone]\x20'));};Preview['prototype'][_0xaa41('0x87')]=function(_0xb9d685){return Promise[_0xaa41('0xe6')]()[_0xaa41('0x56')](cmHopperAdditionalPhone[_0xaa41('0x87')](_0xb9d685))[_0xaa41('0x4d')](logger[_0xaa41('0x27')]('[incrementPreviewCounters]\x20'));};Preview[_0xaa41('0xf')][_0xaa41('0xe7')]=function(_0xa3687e,_0x7e0e69,_0x361819,_0x377e17,_0x1e879d){var _0x1a7527=this;return new Promise(function(_0x1aac0c,_0x1a5a7a){if(_[_0xaa41('0x43')](_0x7e0e69)||_[_0xaa41('0x43')](_0x7e0e69['Contact'])||_[_0xaa41('0x43')](_0x7e0e69[_0xaa41('0xe8')])||_['isNil'](_0x7e0e69[_0xaa41('0x4b')])){_0x1a5a7a(ut[_0xaa41('0x35')](_0xaa41('0xe9'),_0x377e17,_0x1e879d));return;}var _0x400fb7=uuid['v4']();var _0x5c0c5c=_0x1a7527[_0xaa41('0x25')][_0x7e0e69[_0xaa41('0x44')][_0xaa41('0x33')]];var _0x3a223c=_0x361819?_0x1a7527[_0xaa41('0x15')][_0x361819]['id']:undefined;_0x1a7527['actions'][_0x400fb7]=new Action(_0x7e0e69,_0x5c0c5c,_0x400fb7,_0x361819,_0x3a223c);var _0xc59a12=_0x1a7527['actions'][_0x400fb7];_0xc59a12['unlockAgent']=_0x377e17;_0xc59a12[_0xaa41('0x83')]=_0x1e879d;_0xc59a12['lookAgent']=_0x361819;if(_['isEmpty'](_0xa3687e)){_0x1a7527[_0xaa41('0xea')](_0xc59a12,_0x5c0c5c,_0x7e0e69,_0x361819)[_0xaa41('0x56')](function(_0x5b241e){logger['info'](_0xaa41('0xeb'),_0xaa41('0xec')+_0xc59a12[_0xaa41('0x45')]+_0xaa41('0xed')+_0xc59a12[_0xaa41('0x86')],JSON[_0xaa41('0x29')](_0x5b241e));ami[_0xaa41('0x26')](_0xaa41('0xee'),ut['buildObj'](_0xc59a12,_0xaa41('0xef'),_0x1a7527[_0xaa41('0x25')][_0xc59a12[_0xaa41('0x45')]]));_0x1aac0c(ut[_0xaa41('0x35')](_0xaa41('0xf0')));})['catch'](function(_0x519843){ut[_0xaa41('0xf1')](_0xaa41('0xf2'),_0x519843);_0x1a5a7a(ut[_0xaa41('0x35')](_0xaa41('0xf3'),_0x377e17,_0x1e879d));});}else{_0x5c0c5c[_0xaa41('0xf4')]+=0x1;ut[_0xaa41('0xf5')](_0xc59a12);rpcDb['createHistory'](_0xc59a12,_0xaa41('0xf6'));delete _0x1a7527[_0xaa41('0x14')][_0x400fb7];_0x1a5a7a(ut['message'](_0xaa41('0xf7'),_0x377e17,_0x1e879d));}});};Preview[_0xaa41('0xf')][_0xaa41('0x71')]=function(_0x27149e){return!_[_0xaa41('0x43')](_0x27149e)&&!_[_0xaa41('0x43')](_0x27149e[_0xaa41('0x33')])&&!_['isNil'](_0x27149e[_0xaa41('0xf8')])&&_0x27149e[_0xaa41('0xf8')]&&!_['isNil'](this[_0xaa41('0x13')][util[_0xaa41('0x2a')](_0xaa41('0xf9'),_0x27149e[_0xaa41('0x33')])])&&!_['isNil'](this[_0xaa41('0x13')][util[_0xaa41('0x2a')](_0xaa41('0xf9'),_0x27149e[_0xaa41('0x33')])][_0xaa41('0x4c')])&&(this['trunks'][util[_0xaa41('0x2a')](_0xaa41('0xf9'),_0x27149e['name'])]['status']===_0xaa41('0xfa')||this[_0xaa41('0x13')][util[_0xaa41('0x2a')](_0xaa41('0xf9'),_0x27149e[_0xaa41('0x33')])][_0xaa41('0x4c')]==='unmonitored');};Preview['prototype'][_0xaa41('0x5c')]=function(_0x2ff3fb,_0x566832){return this['execRun'](_0x2ff3fb,_0x566832)[_0xaa41('0x56')](function(_0x44dea3){return _[_0xaa41('0xfb')](_0x44dea3,['message']);})['catch'](function(_0x1d609e){if(_0x1d609e[_0xaa41('0xfc')]){rpcDb[_0xaa41('0xfd')](_0x2ff3fb);}if(_0x1d609e['active']){rpcDb[_0xaa41('0xfe')](_0x2ff3fb);}throw _[_0xaa41('0xfb')](_0x1d609e,['message']);});};Preview['prototype'][_0xaa41('0xff')]=function(_0x561447,_0x4679e5){var _0x3fb6f0=this;var _0xdf9297,_0x10252a;return rpcDb[_0xaa41('0x100')](_0x561447)[_0xaa41('0x56')](function(_0x2b083a){if(!_['isNil'](_0x2b083a[0x0])){_0x10252a=_0x2b083a[0x0][_0xaa41('0x101')]?![]:!![];_0xdf9297=_0x2b083a[0x0][_0xaa41('0x101')]?!![]:![];_0xdf9297=_0x4679e5?!![]:_0xdf9297;}var _0x5534ef=_0x3fb6f0[_0xaa41('0x102')](_0x2b083a);if(_0x5534ef[_0xaa41('0x103')]){rpcDb[_0xaa41('0x104')](_[_0xaa41('0xfb')](_0x2b083a[0x0],[_0xaa41('0x4b'),_0xaa41('0xe8')]))['then'](function(_0xa2d55d){_0x3fb6f0[_0xaa41('0xe7')](_0xa2d55d,_0x2b083a[0x0],_0x4679e5,_0x10252a,_0xdf9297)[_0xaa41('0x56')](function(_0x2fa831){return _0x2fa831;})[_0xaa41('0x4d')](function(_0xf8f3e1){throw _0xf8f3e1;});})[_0xaa41('0x4d')](function(_0x5083ff){ut[_0xaa41('0xf1')](_0xaa41('0x105'),_0x5083ff);throw ut[_0xaa41('0x35')]('Call\x20unsuccessful',_0x10252a,_0xdf9297);});}else{throw ut['message'](_0x5534ef['message'],_0x10252a,_0xdf9297);}})[_0xaa41('0x4d')](function(_0x1331f8){ut[_0xaa41('0xf1')](_0xaa41('0x106'),_0x1331f8);throw ut[_0xaa41('0x35')]('Call\x20unsuccessful',![],!![]);});};Preview[_0xaa41('0xf')][_0xaa41('0x102')]=function(_0x1fe1e3){if(_[_0xaa41('0x43')](_0x1fe1e3)||_[_0xaa41('0x107')](_0x1fe1e3)||!_[_0xaa41('0x43')](_0x1fe1e3[0x0][_0xaa41('0x5a')])&&_['isNil'](_0x1fe1e3[0x0][_0xaa41('0x5a')][_0xaa41('0x33')])){ut[_0xaa41('0xf1')]('[Preview][validateContact][Empty\x20Contact]',_0x1fe1e3);return{'isValid':![],'message':_0xaa41('0x108')};}var _0x53a519=this['campaignsPreview'][_0x1fe1e3[0x0][_0xaa41('0x44')]['name']];_0x53a519[_0xaa41('0x35')]=utils[_0xaa41('0x31')][_0xaa41('0x73')];if(_[_0xaa41('0x43')](_0x53a519)){ut[_0xaa41('0xf1')](_0xaa41('0x109'),_0x53a519);return{'isValid':![],'message':_0xaa41('0x10a')};}if(!this['isTrunkReachable'](_0x53a519[_0xaa41('0x70')])){ut[_0xaa41('0xf1')](_0xaa41('0x10b'),_0xaa41('0x10c')+_0x53a519[_0xaa41('0x33')]+_0xaa41('0x10d'));if(!this[_0xaa41('0x71')](_0x53a519[_0xaa41('0x10e')])){ut[_0xaa41('0xf1')](_0xaa41('0x10b'),_0x53a519[_0xaa41('0x33')]+_0xaa41('0x10f'));return{'isValid':![],'message':_0xaa41('0x110')};}}if(!ut[_0xaa41('0x6e')](_0x53a519[_0xaa41('0x111')])){ut[_0xaa41('0xf1')]('[Preview][validateContact][Campaign\x20Active]',_0x53a519[_0xaa41('0x33')]+'\x20Not\x20Active');return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x53a519['name']+_0xaa41('0x112')};}return{'isValid':!![],'message':_0xaa41('0x113')};};Preview['prototype'][_0xaa41('0xea')]=function(_0x356256,_0x1e86cc,_0x15bb60,_0x232732){var _0x34d857=this;return new Promise(function(_0x239f1b,_0x445925){var _0x1e8591=_0x356256[_0xaa41('0x8c')];var _0x347d0c=_0x34d857[_0xaa41('0x71')](_0x1e86cc[_0xaa41('0x70')])?util[_0xaa41('0x2a')](_0xaa41('0x114'),_0x1e86cc[_0xaa41('0x70')][_0xaa41('0x33')],_['isNil'](_0x1e86cc[_0xaa41('0x115')])?'':_0x1e86cc[_0xaa41('0x115')][_0xaa41('0x116')]()||'',_0x1e86cc[_0xaa41('0x117')]>0x0?_0x15bb60['phone'][_0xaa41('0x118')](_0x1e86cc[_0xaa41('0x117')]):_0x15bb60['phone']):util[_0xaa41('0x2a')](_0xaa41('0x114'),_[_0xaa41('0x43')](_0x1e86cc[_0xaa41('0x10e')])?_0x1e86cc[_0xaa41('0x70')][_0xaa41('0x33')]:_0x1e86cc[_0xaa41('0x10e')][_0xaa41('0x33')],_[_0xaa41('0x43')](_0x1e86cc[_0xaa41('0x115')])?'':_0x1e86cc['dialPrefix'][_0xaa41('0x116')]()||'',_0x1e86cc[_0xaa41('0x117')]>0x0?_0x15bb60[_0xaa41('0xe8')][_0xaa41('0x118')](_0x1e86cc[_0xaa41('0x117')]):_0x15bb60[_0xaa41('0xe8')]);var _0x53dea3=_0x34d857[_0xaa41('0x71')](_0x1e86cc['Trunk'])?ut[_0xaa41('0x119')](_0x1e86cc[_0xaa41('0x70')][_0xaa41('0x11a')],_0x1e86cc[_0xaa41('0x11b')],_0x1e86cc[_0xaa41('0x11c')]>0x0?ut['getCallerIdRandom'](_0x1e86cc[_0xaa41('0x11d')],_0x1e86cc[_0xaa41('0x11c')]):_0x1e86cc['dialOriginateCallerIdNumber']):ut[_0xaa41('0x119')](_[_0xaa41('0x43')](_0x1e86cc[_0xaa41('0x10e')])?_0x1e86cc[_0xaa41('0x70')][_0xaa41('0x11a')]:_0x1e86cc[_0xaa41('0x10e')][_0xaa41('0x11a')],_0x1e86cc[_0xaa41('0x11b')],_0x1e86cc[_0xaa41('0x11c')]>0x0?ut[_0xaa41('0x11e')](_0x1e86cc['dialOriginateCallerIdNumber'],_0x1e86cc[_0xaa41('0x11c')]):_0x1e86cc[_0xaa41('0x11d')]);if(_0x53dea3){_0x356256[_0xaa41('0x11f')]=ut['extractCalleridName'](_0x53dea3);_0x356256['originatecalleridnum']=ut[_0xaa41('0x120')](_0x53dea3);}var _0x5aee9b=ut['addVariables'](_0x1e86cc,_0x15bb60,_0x347d0c,_0x53dea3,_0x1e8591,_0x356256);_[_0xaa41('0x121')](_0x356256,ut[_0xaa41('0x122')](_0x5aee9b));_0x356256[_0xaa41('0x123')]=moment()[_0xaa41('0x2a')]('YYYY-MM-DD\x20HH:mm:ss');_0x1e86cc['variables']=_0x5aee9b;var _0xa63e60=ut[_0xaa41('0x124')](_0x356256,_0x1e86cc,_0x5aee9b,_0x356256[_0xaa41('0x83')],_0x232732);return ami[_0xaa41('0x125')](_0xa63e60)[_0xaa41('0x56')](function(_0x5e3bb2){_0x1e86cc[_0xaa41('0x2f')]+=0x1;logger[_0xaa41('0x27')]('[originated][increment]',_0x1e8591,_0xaa41('0x9c'),_0x1e86cc[_0xaa41('0x33')],'originated:\x20',_0x1e86cc[_0xaa41('0x2f')]);_0x239f1b(_0x5e3bb2);})[_0xaa41('0x4d')](function(_0x58a5e5){ut[_0xaa41('0xdc')](_0x356256,0xe,_0xaa41('0x126'));rpcDb['createAgentHistory'](_0x356256,_0xaa41('0x127'));_0x445925(_0x58a5e5);});});};Preview['prototype']['syncNewExten']=function(_0x1ffee2){if(this[_0xaa41('0x14')][_0x1ffee2[_0xaa41('0x84')]]){this[_0xaa41('0x14')][_0x1ffee2[_0xaa41('0x84')]]['channel']=_0x1ffee2[_0xaa41('0x128')];}};Preview['prototype']['syncOriginateResponse']=function(_0x25548d){var _0x28685a=this;var _0x2f62f6=this[_0xaa41('0x14')][_0x25548d[_0xaa41('0x129')]];if(_0x2f62f6){if(_0x2f62f6[_0xaa41('0x12a')]&&this[_0xaa41('0x15')][_0x2f62f6['lookAgent']]){ut[_0xaa41('0x12b')](_0x2f62f6,this[_0xaa41('0x15')][_0x2f62f6[_0xaa41('0x12a')]][_0xaa41('0x33')],this[_0xaa41('0x15')][_0x2f62f6[_0xaa41('0x12a')]]['id']);}var _0x3aafe6=_[_0xaa41('0x12c')](_0x2f62f6);_0x3aafe6[_0xaa41('0x12d')]=moment()[_0xaa41('0x2a')](_0xaa41('0x5f'));var _0x2e8c8f=_0x28685a['campaignsPreview'][_0x2f62f6['queue']];if(ut[_0xaa41('0x12e')](_0x25548d[_0xaa41('0x12f')])){if(_0x2f62f6[_0xaa41('0xa9')]){rpcDb['unlockContact'](_0x2f62f6[_0xaa41('0x86')]);}if(_0x2f62f6[_0xaa41('0x83')]){rpcDb[_0xaa41('0xfe')](_0x2f62f6[_0xaa41('0x86')]);}ami[_0xaa41('0x26')](_0xaa41('0x130'),ut[_0xaa41('0x7a')](_0x2f62f6,_0xaa41('0x131'),this[_0xaa41('0x25')][_0x2f62f6[_0xaa41('0x45')]]));this[_0xaa41('0x132')](_0x3aafe6,_0x2e8c8f,_0x25548d);}else{_0x2f62f6[_0xaa41('0x123')]=moment()[_0xaa41('0x2a')](_0xaa41('0x5f'));ut[_0xaa41('0xdc')](_0x3aafe6,0x4,'Answer');rpcDb[_0xaa41('0xdd')](_0x3aafe6,_0xaa41('0x133'));}}};Preview[_0xaa41('0xf')]['syncHangup']=function(_0x125efb){var _0xfc1e24=this[_0xaa41('0x14')][_0x125efb[_0xaa41('0x84')]];var _0x21c0c6;if(_0xfc1e24){_0x21c0c6=this[_0xaa41('0x25')][_0xfc1e24[_0xaa41('0x45')]];logger[_0xaa41('0x27')]('[syncHangup][talking]',_0x125efb[_0xaa41('0x84')],_0xaa41('0x9c'),_0x21c0c6[_0xaa41('0x33')],_0xaa41('0x46'),_0x21c0c6[_0xaa41('0x47')]);}if(this['actions'][_0x125efb[_0xaa41('0x84')]]&&_0x125efb['linkedid']!==_0x125efb[_0xaa41('0x8c')]){if(_0x125efb[_0xaa41('0x134')]==='16'&&this[_0xaa41('0x14')][_0x125efb[_0xaa41('0x84')]][_0xaa41('0x48')]){this[_0xaa41('0x74')](_0x125efb,_0x125efb[_0xaa41('0x84')],_0x125efb[_0xaa41('0x134')]);}else if(this[_0xaa41('0x14')][_0x125efb[_0xaa41('0x84')]][_0xaa41('0x48')]){logger[_0xaa41('0x27')]('[syncHangup][talking][cause]',_0x125efb['linkedid'],_0x125efb[_0xaa41('0x134')],_0xaa41('0x9c'),_0x21c0c6[_0xaa41('0x33')],_0xaa41('0x46'),_0x21c0c6[_0xaa41('0x47')]);this[_0xaa41('0x74')](_0x125efb,_0x125efb['linkedid'],_0x125efb[_0xaa41('0x134')]);}}else if(_0xfc1e24&&_['isNil'](_0xfc1e24[_0xaa41('0x135')])&&_0x21c0c6[_0xaa41('0x136')]&&_0x125efb[_0xaa41('0x84')]===_0x125efb[_0xaa41('0x8c')]&&_[_0xaa41('0x43')](_0x125efb[_0xaa41('0xdb')])&&_0x125efb['cause']==='16'&&_0x125efb['channelstate']==='6'&&_[_0xaa41('0xd9')](_0xfc1e24['transfer'])){if(_0xfc1e24[_0xaa41('0xa9')]){rpcDb[_0xaa41('0xfd')](_0xfc1e24[_0xaa41('0x86')]);}if(_0xfc1e24[_0xaa41('0x83')]){rpcDb[_0xaa41('0xfe')](_0xfc1e24[_0xaa41('0x86')]);}_0x125efb[_0xaa41('0xdb')]='22';this[_0xaa41('0x132')](_0xfc1e24,_0x21c0c6,_0x125efb);}else if(_0xfc1e24&&_0xfc1e24[_0xaa41('0x137')]){if(_0x125efb[_0xaa41('0x134')]==='16'&&this[_0xaa41('0x14')][_0x125efb[_0xaa41('0x84')]][_0xaa41('0x48')]){logger[_0xaa41('0x27')]('[syncHangup][talking][transfer]',_0x125efb[_0xaa41('0x84')],_0x125efb['cause'],_0xaa41('0x9c'),_0x21c0c6['name'],_0xaa41('0x46'),_0x21c0c6[_0xaa41('0x47')]);this[_0xaa41('0x74')](_0x125efb,_0x125efb[_0xaa41('0x84')],_0x125efb[_0xaa41('0x134')]);}else if(this[_0xaa41('0x14')][_0x125efb[_0xaa41('0x84')]]['dialAnswer']){logger[_0xaa41('0x27')]('[syncHangup][talking][cause]',_0x125efb['linkedid'],_0x125efb[_0xaa41('0x134')],_0xaa41('0x9c'),_0x21c0c6['name'],_0xaa41('0x46'),_0x21c0c6[_0xaa41('0x47')]);this['callProgressDetectingCustomer'](_0x125efb,_0x125efb[_0xaa41('0x84')],_0x125efb[_0xaa41('0x134')]);}}};Preview[_0xaa41('0xf')]['syncDialEnd']=function(_0x3ecde6){if(this['actions'][_0x3ecde6[_0xaa41('0x138')]]&&_0x3ecde6[_0xaa41('0x138')]!==_0x3ecde6[_0xaa41('0x139')]){this[_0xaa41('0x74')](_0x3ecde6,_0x3ecde6['destlinkedid'],_0x3ecde6[_0xaa41('0xce')]);}};Preview[_0xaa41('0xf')][_0xaa41('0x1c')]=function(_0x49e4a5){if(this[_0xaa41('0x14')][_0x49e4a5[_0xaa41('0x84')]]&&_0x49e4a5[_0xaa41('0x84')]!==_0x49e4a5[_0xaa41('0x8c')]&&!this[_0xaa41('0x14')][_0x49e4a5[_0xaa41('0x84')]][_0xaa41('0x48')]){if(_0x49e4a5[_0xaa41('0x134')]==='1'){this['callProgressDetectingCustomer'](_0x49e4a5,_0x49e4a5[_0xaa41('0x84')],_0x49e4a5['cause']);}}};Preview[_0xaa41('0xf')][_0xaa41('0x13a')]=function(_0x1fa855,_0x272f3f,_0x36cdd2){if(this[_0xaa41('0x14')][_0x1fa855]){if(_[_0xaa41('0x43')](this[_0xaa41('0x14')][_0x1fa855][_0xaa41('0x13b')])){this[_0xaa41('0x14')][_0x1fa855][_0xaa41('0x13b')]={};}this[_0xaa41('0x14')][_0x1fa855][_0xaa41('0x13b')][_0x272f3f]=_0x36cdd2;}};Preview['prototype'][_0xaa41('0x21')]=function(_0x366b1c){try{if(!_[_0xaa41('0x43')](_0x366b1c)){if(ut[_0xaa41('0x13c')](_[_0xaa41('0x13d')](_0x366b1c[_0xaa41('0x13e')])[0x0])){this[_0xaa41('0x13a')](_0x366b1c[_0xaa41('0x8c')],_[_0xaa41('0x13d')](_0x366b1c['variable'])[0x0],_0x366b1c[_0xaa41('0x13f')]);}}}catch(_0x30a438){logger[_0xaa41('0x140')](_0xaa41('0x141'),util[_0xaa41('0x142')](_0x30a438,{'showHidden':![],'depth':null}));}};Preview[_0xaa41('0xf')][_0xaa41('0x143')]=function(_0x3f1b1a){if(_0x3f1b1a){if(this[_0xaa41('0x14')][_0x3f1b1a[_0xaa41('0x144')]]){this['actions'][_0x3f1b1a['transfertargetlinkedid']]['transfer']=!![];}}};Preview[_0xaa41('0xf')][_0xaa41('0x24')]=function(_0x5ccba6){if(_0x5ccba6){if(this[_0xaa41('0x14')][_0x5ccba6[_0xaa41('0x145')]]){this['actions'][_0x5ccba6[_0xaa41('0x145')]]['transfer']=!![];}}};module[_0xaa41('0x146')]=Preview; \ No newline at end of file +var _0xa41a=['logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','resolve','checkInBlack','phone','Contact\x20is\x20undefined','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','logger','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','pick','unlock','unlockContact','disableContact','execRun','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','isEmpty','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','dialActive','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridNumber','merge','toLowerVariables','starttime','variablesAction','Action','OriginateError','[originateFailure][logOriginateFailure]','channel','actionid','lookAgent','logLookAgent','clone','responsetime','isFailure','response','custom:agentringnoanswer','rejected','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','cause','statedesc','dialQueueProject','transfer','destlinkedid','destuniqueid','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','moment','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','../rpc/cmHopperAdditionalPhone','./action','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','sequence','trunks','actions','agents','clockClearZombieChannels','originateresponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','blindtransfer','syncBlindTransfer','campaignsPreview','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','available','CAMPAIGN_STATUS','[CampaignPreview]\x20Campaign\x20Queue:\x20','name','\x20is\x20not\x20active','message','DEACTIVATED','\x20is\x20deactivated','loopCampaigns','syncCampaigns','hasOwnProperty','dialMethod','clearZombieChannels','type','outbound','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','Queue','queue','pTalking:\x20','pTalking','dialAnswer','contactId','UserId','VoiceQueueId','status','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','getContactRecallMe','agentReadyId','then','length','getDiff','dialRecallMeTimeout','Agent','voicePause','run','[RecallMe]','logger2','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','isActive','INACTIVE','Trunk','isTrunkReachable','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','additional','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','answertime','[syncHangup][talking][increment]','uniqueid','connect','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','total','[16]','countglobal','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','Busy','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','verifyAdditionalPhones','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','rescheduleContact','scheduledAt','countbusyretry','unlockAgent','NOANSWER','outboundNoAnswerCallsDay','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','countnoanswerretry','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','originated:\x20','isUndefined','object','reason'];(function(_0x5e7c52,_0x52f168){var _0x3d92cc=function(_0x423870){while(--_0x423870){_0x5e7c52['push'](_0x5e7c52['shift']());}};_0x3d92cc(++_0x52f168);}(_0xa41a,0x6b));var _0xaa41=function(_0x5ab509,_0x42b2b2){_0x5ab509=_0x5ab509-0x0;var _0x1bd8af=_0xa41a[_0x5ab509];return _0x1bd8af;};'use strict';var util=require(_0xaa41('0x0'));var _=require(_0xaa41('0x1'));var uuid=require('uuid');var moment=require(_0xaa41('0x2'));var Redis=require(_0xaa41('0x3'));var config=require(_0xaa41('0x4'));var logger=require(_0xaa41('0x5'))(_0xaa41('0x6'));var loggerAction=require(_0xaa41('0x5'))(_0xaa41('0x7'));var ami=require(_0xaa41('0x8'));var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0xaa41('0x9'));var Action=require(_0xaa41('0xa'));var ut=require('./util/util');var utils=require('../dialer/utils');config[_0xaa41('0xb')]=_[_0xaa41('0xc')](config['redis'],{'host':_0xaa41('0xd'),'port':0x18eb});var io=require(_0xaa41('0xe'))(new Redis(config[_0xaa41('0xb')]));var Sequence=function(){};Sequence[_0xaa41('0xf')][_0xaa41('0x10')]=function(_0x38d930){this[_0xaa41('0x11')]=this[_0xaa41('0x11')]?this[_0xaa41('0x11')]['finally'](_0x38d930):_0x38d930();};function Preview(_0x1d3aac){this[_0xaa41('0x12')]=new Sequence();this['campaignsPreview']=_0x1d3aac['voiceQueues'];this[_0xaa41('0x13')]=_0x1d3aac['trunks'];this[_0xaa41('0x14')]={};this[_0xaa41('0x15')]=_0x1d3aac[_0xaa41('0x15')];this[_0xaa41('0x16')]=0x0;ami['on'](_0xaa41('0x17'),this['syncOriginateResponse'][_0xaa41('0x18')](this));ami['on'](_0xaa41('0x19'),this[_0xaa41('0x1a')][_0xaa41('0x18')](this));ami['on'](_0xaa41('0x1b'),this[_0xaa41('0x1c')][_0xaa41('0x18')](this));ami['on']('dialend',this[_0xaa41('0x1d')][_0xaa41('0x18')](this));ami['on'](_0xaa41('0x1e'),this[_0xaa41('0x1f')][_0xaa41('0x18')](this));ami['on'](_0xaa41('0x20'),this[_0xaa41('0x21')][_0xaa41('0x18')](this));ami['on'](_0xaa41('0x22'),this['syncAttendedTransfer']['bind'](this));ami['on'](_0xaa41('0x23'),this[_0xaa41('0x24')][_0xaa41('0x18')](this));this['loopCampaigns'](this[_0xaa41('0x25')]);}function emit(_0x1f692b,_0x4e768e,_0x513c61){io['to'](_0x1f692b)[_0xaa41('0x26')](_0x4e768e,_0x513c61);}function emitVoiceQueueChannelRemove(_0x5d4374){logger[_0xaa41('0x27')](_0xaa41('0x28'),JSON[_0xaa41('0x29')](_0x5d4374));emit(util[_0xaa41('0x2a')](_0xaa41('0x2b'),_0x5d4374['name']),_0xaa41('0x2c'),_0x5d4374);io[_0xaa41('0x26')](_0xaa41('0x2d'),_0x5d4374);}function notSendMessagesQueue(_0x21f596){if(_0x21f596[_0xaa41('0x2e')]){if(_0x21f596[_0xaa41('0x2f')]===0x0&&_0x21f596['pTalking']===0x0){_0x21f596['sendMessageOneNotActive']=![];_0x21f596[_0xaa41('0x30')]=0x0;_0x21f596['paused']=0x0;_0x21f596['message']=utils[_0xaa41('0x31')]['INACTIVE'];ut['logger'](_0xaa41('0x32'),_0x21f596[_0xaa41('0x33')]+_0xaa41('0x34'));}else{_0x21f596[_0xaa41('0x35')]=utils[_0xaa41('0x31')][_0xaa41('0x36')];ut['logger'](_0xaa41('0x32'),_0x21f596[_0xaa41('0x33')]+_0xaa41('0x37'));}}}Preview[_0xaa41('0xf')][_0xaa41('0x38')]=function(){var _0x4466a3=this;setInterval(function(){_0x4466a3[_0xaa41('0x39')]();},0x7cf);};Preview[_0xaa41('0xf')]['syncCampaigns']=function(){var _0x377add=this['campaignsPreview'];this['clockClearZombieChannels']+=0x1;for(var _0x714537 in _0x377add){if(_0x377add[_0xaa41('0x3a')](_0x714537)&&(_0x377add[_0x714537]['dialMethod']===_0xaa41('0x6')||_0x377add[_0x714537][_0xaa41('0x3b')]==='booked')&&_0x377add[_0x714537]['type']==='outbound'){if(this[_0xaa41('0x16')]>0x7){this[_0xaa41('0x16')]=0x0;this[_0xaa41('0x3c')]();}}if(_0x377add[_0xaa41('0x3a')](_0x714537)&&_0x377add[_0x714537]['dialMethod']===_0xaa41('0x6')&&_0x377add[_0x714537][_0xaa41('0x3d')]===_0xaa41('0x3e')){if(_0x377add[_0x714537]['dialActive']){this[_0xaa41('0x3f')](_0x377add[_0x714537]);if(_0x377add[_0x714537][_0xaa41('0x40')])this[_0xaa41('0x41')](_0x377add[_0x714537]);}else{notSendMessagesQueue(_0x377add[_0x714537]);}}}};Preview['prototype'][_0xaa41('0x42')]=function(_0x374117){var _0x57fe1d=this;this[_0xaa41('0x12')][_0xaa41('0x10')](function(){if(!_[_0xaa41('0x43')](_0x57fe1d['actions'][_0x374117])){loggerAction[_0xaa41('0x27')]('[clearZombieChannels][talking]',_0x374117,_0xaa41('0x44'),_0x57fe1d[_0xaa41('0x14')][_0x374117][_0xaa41('0x45')],'originated:\x20',JSON['stringify'](_0x57fe1d['campaignsPreview'][_0x57fe1d[_0xaa41('0x14')][_0x374117][_0xaa41('0x45')]][_0xaa41('0x2f')]),_0xaa41('0x46'),JSON['stringify'](_0x57fe1d['campaignsPreview'][_0x57fe1d[_0xaa41('0x14')][_0x374117][_0xaa41('0x45')]][_0xaa41('0x47')]),JSON[_0xaa41('0x29')](_0x57fe1d[_0xaa41('0x14')][_0x374117][_0xaa41('0x48')]),JSON[_0xaa41('0x29')](_['pick'](_0x57fe1d[_0xaa41('0x14')][_0x374117],[_0xaa41('0x49'),_0xaa41('0x4a'),_0xaa41('0x4b'),'ListId'])));return ami['Action']({'action':_0xaa41('0x4c'),'channel':_0x57fe1d[_0xaa41('0x14')][_0x374117]['channel']})[_0xaa41('0x4d')](function(_0x563687){if(_0x563687[_0xaa41('0x35')]===_0xaa41('0x4e')){setTimeout(function(){if(_0x57fe1d[_0xaa41('0x14')][_0x374117]){ut[_0xaa41('0x4f')](_0x57fe1d[_0xaa41('0x25')][_0x57fe1d[_0xaa41('0x14')][_0x374117][_0xaa41('0x45')]],_0xaa41('0x50'));if(_0x57fe1d['actions'][_0x374117][_0xaa41('0x48')]===!![]){ut[_0xaa41('0x51')](_0x57fe1d[_0xaa41('0x25')][_0x57fe1d[_0xaa41('0x14')][_0x374117][_0xaa41('0x45')]],_0xaa41('0x50'));ut['loggerError']('[Dialer][checkChannel][pTalking][Preview]'+_0x374117,_0x57fe1d[_0xaa41('0x14')][_0x374117]['queue']);}ut[_0xaa41('0x52')](_0xaa41('0x53')+_0x374117,_0x57fe1d[_0xaa41('0x14')][_0x374117][_0xaa41('0x45')]);delete _0x57fe1d[_0xaa41('0x14')][_0x374117];}},0x2328);}});}});};Preview[_0xaa41('0xf')][_0xaa41('0x3c')]=function(){var _0x5ee74c=this;loggerAction[_0xaa41('0x27')]('[action]',_['size'](this[_0xaa41('0x14')]));for(var _0x5ee127 in this['actions']){if(_0x5ee74c['actions'][_0xaa41('0x3a')](_0x5ee127)){_0x5ee74c['clearZombieChannel'](_0x5ee127);}}};Preview[_0xaa41('0xf')][_0xaa41('0x41')]=function(_0x4a6882){var _0x576f81=this;rpcDb[_0xaa41('0x54')](_0x4a6882['id'],ut[_0xaa41('0x55')](this[_0xaa41('0x15')]))[_0xaa41('0x56')](function(_0x3fe1a9){if(!_[_0xaa41('0x43')](_0x3fe1a9)){for(var _0x258096=0x0;_0x258096<_0x3fe1a9[_0xaa41('0x57')];_0x258096+=0x1){if(ut[_0xaa41('0x58')](_0x3fe1a9[_0x258096]['scheduledat'])<_0x4a6882[_0xaa41('0x59')]*0x3c){if(_0x3fe1a9[_0x258096][_0xaa41('0x5a')]&&!_0x3fe1a9[_0x258096][_0xaa41('0x5a')][_0xaa41('0x5b')]){_0x576f81[_0xaa41('0x5c')](_0x3fe1a9[_0x258096]['id'])[_0xaa41('0x56')](ut['logger2'](_0xaa41('0x5d')))[_0xaa41('0x4d')](ut[_0xaa41('0x5e')](_0xaa41('0x5d')));}else{rpcDb['disableContact'](_0x3fe1a9[_0x258096]['id']);}}else{var _0x23bc61=new Action(_0x3fe1a9[_0x258096],_0x4a6882);_0x23bc61['starttime']=moment()['format'](_0xaa41('0x5f'));_0x4a6882[_0xaa41('0x60')]+=0x1;ut[_0xaa41('0x61')](_0x23bc61,0x17,'RecallInQueue');if(_0x4a6882[_0xaa41('0x62')]){rpcDb[_0xaa41('0x63')](ut[_0xaa41('0x64')](_0x3fe1a9[_0x258096]));rpcDb['createCustomerHistory'](_0x23bc61,_0xaa41('0x65'));}else{ut[_0xaa41('0x61')](_0x23bc61,0x16,_0xaa41('0x66'));rpcDb[_0xaa41('0x67')](_0x23bc61,_0xaa41('0x68'));rpcDb[_0xaa41('0x69')](_0x23bc61,_0xaa41('0x68'));}}}}})[_0xaa41('0x4d')](ut['logger2'](_0xaa41('0x6a')));};Preview['prototype']['setMessage']=function(_0x1bdcd6){_0x1bdcd6[_0xaa41('0x2e')]=!![];if(ut[_0xaa41('0x6b')](_0x1bdcd6[_0xaa41('0x6c')])){_0x1bdcd6[_0xaa41('0x35')]=utils[_0xaa41('0x31')][_0xaa41('0x6d')];}else if(!ut[_0xaa41('0x6e')](_0x1bdcd6['dialActive'])){_0x1bdcd6[_0xaa41('0x35')]=utils[_0xaa41('0x31')][_0xaa41('0x6f')];}else if(!this['isTrunkReachable'](_0x1bdcd6[_0xaa41('0x70')])){if(!this[_0xaa41('0x71')](_0x1bdcd6['TrunkBackup'])){_0x1bdcd6[_0xaa41('0x35')]=utils[_0xaa41('0x31')][_0xaa41('0x72')];}else{_0x1bdcd6['message']=utils[_0xaa41('0x31')][_0xaa41('0x73')];}}else{_0x1bdcd6['message']=utils['CAMPAIGN_STATUS'][_0xaa41('0x73')];}};Preview[_0xaa41('0xf')][_0xaa41('0x74')]=function(_0x4d20c6,_0x5a76b9,_0x137f3f){var _0x1746b4=this;var _0x32f2b4=this[_0xaa41('0x14')][_0x5a76b9];var _0x5ccdc5=this[_0xaa41('0x25')][_0x32f2b4['queue']];var _0x555186;var _0x3ba305=![];var _0x52ae7f=0x2;var _0x3621c0=0x3;if(_0x5ccdc5){switch(_0x137f3f){case'1':_0x5ccdc5[_0xaa41('0x75')]+=0x1;_0x32f2b4[_0xaa41('0x76')]+=0x1;_0x32f2b4['countglobal']=ut[_0xaa41('0x77')](_0x32f2b4);ut[_0xaa41('0x61')](_0x32f2b4,0x0,_0xaa41('0x78'));ami[_0xaa41('0x26')](_0xaa41('0x79'),ut[_0xaa41('0x7a')](_0x32f2b4,_0xaa41('0x7b')));rpcDb[_0xaa41('0x67')](_0x32f2b4,_0xaa41('0x7c'));_0x1746b4['verifyAdditionalPhones'](_0x32f2b4,'0',_0x5ccdc5)[_0xaa41('0x56')](function(_0x40cdfc){_0x3ba305=_0x40cdfc[_0xaa41('0x7d')]==0x1;_0x52ae7f=_0x5ccdc5['dialNoSuchNumberRetryFrequency'];_0x3621c0=_0x5ccdc5[_0xaa41('0x7e')];if(!_0x3ba305){if(ut[_0xaa41('0x77')](_0x32f2b4)>=_0x5ccdc5[_0xaa41('0x7f')]){_0x555186=ut[_0xaa41('0x80')](_0x32f2b4,0xf,_0xaa41('0x81'));rpcDb[_0xaa41('0x69')](_0x555186,_0xaa41('0x82'));}else{if(_0x32f2b4['countnosuchnumberretry']>=_0x5ccdc5['dialNoSuchNumberMaxRetry']){rpcDb['createCustomerFinal'](_0x32f2b4,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x32f2b4,_0xaa41('0x76'),_0x5ccdc5['dialNoSuchNumberRetryFrequency']),_0x32f2b4['unlockAgent'],_0x32f2b4[_0xaa41('0x83')]);}}delete this[_0xaa41('0x14')][_0x4d20c6[_0xaa41('0x84')]];}else{_0x32f2b4[_0xaa41('0x76')]++;logger['info'](_0xaa41('0x85'),_0x32f2b4[_0xaa41('0x76')]);logger[_0xaa41('0x27')]('id',_0x32f2b4[_0xaa41('0x86')]);_0x1746b4[_0xaa41('0x87')]({'id':_0x32f2b4[_0xaa41('0x86')],'field':{'countnosuchnumberretry':_0x32f2b4[_0xaa41('0x76')]}})[_0xaa41('0x56')](function(){_0x1746b4[_0xaa41('0x88')](_0x32f2b4,_0x52ae7f,_0x3621c0)['then'](function(){});});}});break;case _0xaa41('0x89'):var _0x2d2af8=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x32f2b4['responsetime']=_0x2d2af8;_0x32f2b4[_0xaa41('0x8a')]=_0x2d2af8;_0x32f2b4['dialAnswer']=!![];_0x5ccdc5[_0xaa41('0x47')]+=0x1;logger['info'](_0xaa41('0x8b'),_0x32f2b4[_0xaa41('0x8c')],'\x20Queue',_0x5ccdc5[_0xaa41('0x33')],_0xaa41('0x46'),_0x5ccdc5[_0xaa41('0x47')]);ami[_0xaa41('0x26')]('custom:agentconnect',ut['buildObj'](_0x32f2b4,_0xaa41('0x8d'),this[_0xaa41('0x25')][_0x32f2b4['queue']]));if(_0x5ccdc5['acw']){ami[_0xaa41('0x26')](_0xaa41('0x8e'),ut[_0xaa41('0x8f')](_0x32f2b4));}break;case'16':ami[_0xaa41('0x26')](_0xaa41('0x90'),ut['buildObj'](_0x32f2b4,_0xaa41('0x91'),this['campaignsPreview'][_0x32f2b4['queue']]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x32f2b4,_0xaa41('0x91')));_0x5ccdc5[_0xaa41('0x92')]+=0x1;_0x5ccdc5[_0xaa41('0x93')]+=0x1;_0x5ccdc5['answered']+=0x1;ut[_0xaa41('0x51')](_0x5ccdc5,_0xaa41('0x94'));_0x32f2b4[_0xaa41('0x95')]=ut[_0xaa41('0x77')](_0x32f2b4);ut[_0xaa41('0x61')](_0x32f2b4,0x4,_0xaa41('0x96'));rpcDb[_0xaa41('0x67')](_0x32f2b4,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0xaa41('0x69')](_0x32f2b4,_0xaa41('0x97'));rpcDb[_0xaa41('0x98')](_0x32f2b4);_0x5ccdc5[_0xaa41('0x99')]+=_0x32f2b4['talktime'];_0x5ccdc5[_0xaa41('0x9a')]+=_0x32f2b4['talktime'];logger[_0xaa41('0x27')](_0xaa41('0x9b'),_0x32f2b4[_0xaa41('0x8c')],_0xaa41('0x9c'),_0x5ccdc5['name'],_0xaa41('0x46'),_0x5ccdc5[_0xaa41('0x47')]);delete this[_0xaa41('0x14')][_0x4d20c6[_0xaa41('0x84')]];break;case'BUSY':_0x5ccdc5[_0xaa41('0x9d')]+=0x1;_0x32f2b4['countbusyretry']+=0x1;_0x32f2b4[_0xaa41('0x95')]=ut[_0xaa41('0x77')](_0x32f2b4);ut['logCustomer'](_0x32f2b4,0x5,_0xaa41('0x9e'));_0x52ae7f=_0x5ccdc5[_0xaa41('0x9f')];_0x3621c0=_0x5ccdc5[_0xaa41('0x7e')];ami[_0xaa41('0x26')](_0xaa41('0xa0'),ut[_0xaa41('0x7a')](_0x32f2b4,_0xaa41('0xa1')));rpcDb[_0xaa41('0x67')](_0x32f2b4,_0xaa41('0xa2'));_0x1746b4[_0xaa41('0xa3')](_0x32f2b4,'5',_0x5ccdc5)[_0xaa41('0x56')](function(_0x59a30b){_0x3ba305=_0x59a30b[_0xaa41('0x7d')]==0x1;if(!_0x3ba305){if(ut[_0xaa41('0x77')](_0x32f2b4)>=_0x5ccdc5[_0xaa41('0x7f')]){_0x555186=ut['cloneAction'](_0x32f2b4,0xf,'Global');rpcDb[_0xaa41('0x69')](_0x555186,_0xaa41('0xa4'));}else{if(_0x32f2b4['countbusyretry']>=_0x5ccdc5[_0xaa41('0xa5')]){rpcDb[_0xaa41('0x69')](_0x32f2b4,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0xaa41('0xa6')](ut[_0xaa41('0xa7')](_0x32f2b4,_0xaa41('0xa8'),_0x5ccdc5[_0xaa41('0x9f')]),_0x32f2b4[_0xaa41('0xa9')],_0x32f2b4[_0xaa41('0x83')]);}}}else{_0x32f2b4[_0xaa41('0xa8')]++;_0x1746b4[_0xaa41('0x87')]({'id':_0x32f2b4['idContact'],'field':{'countbusyretry':_0x32f2b4['countbusyretry']}})[_0xaa41('0x56')](function(){_0x1746b4['swapAdditionalPhones'](_0x32f2b4,_0x52ae7f,_0x3621c0)[_0xaa41('0x56')](function(){});});}});break;case _0xaa41('0xaa'):_0x5ccdc5[_0xaa41('0xab')]+=0x1;_0x32f2b4['countnoanswerretry']+=0x1;_0x32f2b4[_0xaa41('0x95')]=ut[_0xaa41('0x77')](_0x32f2b4);ut[_0xaa41('0x61')](_0x32f2b4,0x3,'NoAnswer');_0x52ae7f=_0x5ccdc5[_0xaa41('0xac')];_0x3621c0=_0x5ccdc5[_0xaa41('0x7e')];var _0x5bd574=ut[_0xaa41('0xad')](_0x32f2b4,_0x5ccdc5);ami['emit']('custom:agentnoanswer',_0x5bd574);rpcDb[_0xaa41('0x67')](_0x32f2b4,_0xaa41('0xae'));_0x1746b4['verifyAdditionalPhones'](_0x32f2b4,'3',_0x5ccdc5)['then'](function(_0x241e1a){_0x3ba305=_0x241e1a[_0xaa41('0x7d')]==0x1;if(!_0x3ba305){if(ut[_0xaa41('0x77')](_0x32f2b4)>=_0x5ccdc5[_0xaa41('0x7f')]){_0x555186=ut['cloneAction'](_0x32f2b4,0xf,_0xaa41('0x81'));rpcDb[_0xaa41('0x69')](_0x555186,_0xaa41('0xaf'));}else{if(_0x32f2b4['countnoanswerretry']>=_0x5ccdc5[_0xaa41('0xb0')]){rpcDb[_0xaa41('0x69')](_0x32f2b4,_0xaa41('0xae'));}else{rpcDb['rescheduleContact'](ut[_0xaa41('0xa7')](_0x32f2b4,'countnoanswerretry',_0x5ccdc5['dialNoAnswerRetryFrequency']),_0x32f2b4[_0xaa41('0xa9')],_0x32f2b4[_0xaa41('0x83')]);}}}else{_0x32f2b4['countnoanswerretry']++;_0x1746b4[_0xaa41('0x87')]({'id':_0x32f2b4[_0xaa41('0x86')],'field':{'countnoanswerretry':_0x32f2b4[_0xaa41('0xb1')]}})['then'](function(){_0x1746b4[_0xaa41('0x88')](_0x32f2b4,_0x52ae7f,_0x3621c0)[_0xaa41('0x56')](function(){});});}});break;case _0xaa41('0xb2'):_0x5ccdc5[_0xaa41('0xb3')]+=0x1;_0x32f2b4[_0xaa41('0xb4')]+=0x1;_0x32f2b4['countglobal']=ut[_0xaa41('0x77')](_0x32f2b4);ut['logCustomer'](_0x32f2b4,0x8,_0xaa41('0xb5'));_0x52ae7f=_0x5ccdc5[_0xaa41('0xb6')];_0x3621c0=_0x5ccdc5[_0xaa41('0x7e')];ami[_0xaa41('0x26')](_0xaa41('0xb7'),ut[_0xaa41('0x7a')](_0x32f2b4,_0xaa41('0xb8')));rpcDb[_0xaa41('0x67')](_0x32f2b4,_0xaa41('0xb9'));_0x1746b4[_0xaa41('0xa3')](_0x32f2b4,'8',_0x5ccdc5)[_0xaa41('0x56')](function(_0x58ad21){_0x3ba305=_0x58ad21[_0xaa41('0x7d')]==0x1;if(!_0x3ba305){if(ut[_0xaa41('0x77')](_0x32f2b4)>=_0x5ccdc5['dialGlobalMaxRetry']){_0x555186=ut[_0xaa41('0x80')](_0x32f2b4,0xf,'Global');rpcDb[_0xaa41('0x69')](_0x555186,_0xaa41('0xba'));}else{if(_0x32f2b4[_0xaa41('0xb4')]>=_0x5ccdc5[_0xaa41('0xbb')]){rpcDb[_0xaa41('0x69')](_0x32f2b4,_0xaa41('0xb9'));}else{rpcDb[_0xaa41('0xa6')](ut['scheduledAt'](_0x32f2b4,_0xaa41('0xb4'),_0x5ccdc5[_0xaa41('0x9f')]),_0x32f2b4[_0xaa41('0xa9')],_0x32f2b4[_0xaa41('0x83')]);}}}else{_0x32f2b4['countcongestionretry']++;_0x1746b4[_0xaa41('0x87')]({'id':_0x32f2b4['idContact'],'field':{'countcongestionretry':_0x32f2b4[_0xaa41('0xb4')]}})[_0xaa41('0x56')](function(){_0x1746b4[_0xaa41('0x88')](_0x32f2b4,_0x52ae7f,_0x3621c0)[_0xaa41('0x56')](function(){});});}});break;case _0xaa41('0xbc'):_0x5ccdc5['outboundRejectCallsDay']+=0x1;_0x32f2b4[_0xaa41('0xbd')]+=0x1;_0x32f2b4[_0xaa41('0x95')]=ut['totalGlobal'](_0x32f2b4);ut[_0xaa41('0x61')](_0x32f2b4,0x14,_0xaa41('0xbe'));_0x52ae7f=_0x5ccdc5[_0xaa41('0xbf')];_0x3621c0=_0x5ccdc5[_0xaa41('0x7e')];ami[_0xaa41('0x26')](_0xaa41('0xc0'),ut[_0xaa41('0x7a')](_0x32f2b4,_0xaa41('0xc1')));rpcDb['createCustomerHistory'](_0x32f2b4,_0xaa41('0xc2'));_0x1746b4[_0xaa41('0xa3')](_0x32f2b4,'20',_0x5ccdc5)[_0xaa41('0x56')](function(_0x78265){_0x3ba305=_0x78265[_0xaa41('0x7d')]==0x1;if(!_0x3ba305){if(ut[_0xaa41('0x77')](_0x32f2b4)>=_0x5ccdc5['dialGlobalMaxRetry']){_0x555186=ut['cloneAction'](_0x32f2b4,0x14,'AgentReject');rpcDb[_0xaa41('0x69')](_0x555186,_0xaa41('0xc3'));}else{if(_0x32f2b4['countagentrejectretry']>=_0x5ccdc5[_0xaa41('0xc4')]){rpcDb[_0xaa41('0x69')](_0x32f2b4,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0xaa41('0xa6')](ut[_0xaa41('0xa7')](_0x32f2b4,_0xaa41('0xbd'),_0x5ccdc5[_0xaa41('0xbf')]),_0x32f2b4['unlockAgent'],_0x32f2b4[_0xaa41('0x83')]);}}}else{_0x32f2b4['countnoanswerretry']++;_0x1746b4[_0xaa41('0x87')]({'id':_0x32f2b4[_0xaa41('0x86')],'field':{'countnoanswerretry':_0x32f2b4[_0xaa41('0xb1')]}})[_0xaa41('0x56')](function(){_0x1746b4[_0xaa41('0x88')](_0x32f2b4,_0x52ae7f,_0x3621c0)[_0xaa41('0x56')](function(){});});}});break;case _0xaa41('0xc5'):_0x5ccdc5[_0xaa41('0xc6')]+=0x1;_0x32f2b4[_0xaa41('0xc7')]+=0x1;_0x32f2b4['countglobal']=ut[_0xaa41('0x77')](_0x32f2b4);ut[_0xaa41('0x61')](_0x32f2b4,0xb,_0xaa41('0xc8'));rpcDb['createCustomerHistory'](_0x32f2b4,_0xaa41('0xc9'));_0x1746b4[_0xaa41('0xa3')](_0x32f2b4,'11',_0x5ccdc5)[_0xaa41('0x56')](function(_0x408d95){_0x3ba305=_0x408d95[_0xaa41('0x7d')]==0x1;if(!_0x3ba305){if(ut[_0xaa41('0x77')](_0x32f2b4)>=_0x5ccdc5[_0xaa41('0x7f')]){_0x555186=ut[_0xaa41('0x80')](_0x32f2b4,0xf,_0xaa41('0x81'));rpcDb[_0xaa41('0x69')](_0x555186,_0xaa41('0xc9'));}else{if(_0x32f2b4['countabandonedetry']>=_0x5ccdc5[_0xaa41('0xca')]){rpcDb[_0xaa41('0x69')](_0x32f2b4,_0xaa41('0xc9'));}else{rpcDb[_0xaa41('0xa6')](ut[_0xaa41('0xa7')](_0x32f2b4,'countabandonedretry',_0x5ccdc5['dialAbandonedRetryFrequency']),_0x32f2b4[_0xaa41('0xa9')],_0x32f2b4[_0xaa41('0x83')]);}}}else{_0x32f2b4['countnoanswerretry']++;_0x1746b4[_0xaa41('0x87')]({'id':_0x32f2b4[_0xaa41('0x86')],'field':{'countnoanswerretry':_0x32f2b4['countnoanswerretry']}})['then'](function(){_0x1746b4['swapAdditionalPhones'](_0x32f2b4,_0x52ae7f,_0x3621c0)[_0xaa41('0x56')](function(){});});}});break;case'18':_0x5ccdc5[_0xaa41('0xcb')]+=0x1;_0x32f2b4[_0xaa41('0xcc')]+=0x1;_0x32f2b4[_0xaa41('0x95')]=ut[_0xaa41('0x77')](_0x32f2b4);ut[_0xaa41('0x61')](_0x32f2b4,0x12,_0x4d20c6[_0xaa41('0xcd')]||_0x4d20c6[_0xaa41('0xce')]);ami[_0xaa41('0x26')](_0xaa41('0xcf'),ut[_0xaa41('0x7a')](_0x32f2b4,'amd'));rpcDb['createCustomerHistory'](_0x32f2b4,_0xaa41('0xd0'));_0x1746b4[_0xaa41('0xa3')](_0x32f2b4,'18',_0x5ccdc5)['then'](function(_0x30e8cb){_0x3ba305=_0x30e8cb['additional']==0x1;if(!_0x3ba305){if(ut[_0xaa41('0x77')](_0x32f2b4)>=_0x5ccdc5[_0xaa41('0x7f')]){_0x555186=ut[_0xaa41('0x80')](_0x32f2b4,0x12,_0xaa41('0x81'));rpcDb[_0xaa41('0x69')](_0x555186,_0xaa41('0xd0'));}else{rpcDb[_0xaa41('0x69')](_0x32f2b4,_0xaa41('0xd0'));}}else{_0x32f2b4[_0xaa41('0xb1')]++;_0x1746b4['incrementPreviewCounters']({'id':_0x32f2b4['idContact'],'field':{'countnoanswerretry':_0x32f2b4['countnoanswerretry']}})[_0xaa41('0x56')](function(){_0x1746b4[_0xaa41('0x88')](_0x32f2b4,_0x52ae7f,_0x3621c0)['then'](function(){});});}});delete this['actions'][_0x4d20c6[_0xaa41('0x84')]];break;case'19':_0x5ccdc5[_0xaa41('0xcb')]+=0x1;_0x32f2b4['countglobal']=ut['totalGlobal'](_0x32f2b4);ut[_0xaa41('0x61')](_0x32f2b4,0x13,_0x4d20c6['cause-txt']||_0x4d20c6[_0xaa41('0xce')]);ami[_0xaa41('0x26')](_0xaa41('0xcf'),ut[_0xaa41('0x7a')](_0x32f2b4,_0xaa41('0xd1')));rpcDb[_0xaa41('0x67')](_0x32f2b4,_0xaa41('0xd2'));_0x1746b4[_0xaa41('0xa3')](_0x32f2b4,'18',_0x5ccdc5)[_0xaa41('0x56')](function(_0x573889){_0x3ba305=_0x573889['additional']==0x1;if(!_0x3ba305){if(ut[_0xaa41('0x77')](_0x32f2b4)>=_0x5ccdc5[_0xaa41('0x7f')]){_0x555186=ut[_0xaa41('0x80')](_0x32f2b4,0xf,_0xaa41('0x81'));rpcDb[_0xaa41('0x69')](_0x555186,_0xaa41('0xd2'));}else{rpcDb[_0xaa41('0x69')](_0x32f2b4,_0xaa41('0xd2'));}}else{_0x32f2b4[_0xaa41('0xb1')]++;_0x1746b4[_0xaa41('0x87')]({'id':_0x32f2b4[_0xaa41('0x86')],'field':{'countnoanswerretry':_0x32f2b4[_0xaa41('0xb1')]}})[_0xaa41('0x56')](function(){_0x1746b4[_0xaa41('0x88')](_0x32f2b4,_0x52ae7f,_0x3621c0)[_0xaa41('0x56')](function(){});});}});delete this['actions'][_0x4d20c6[_0xaa41('0x84')]];break;default:if(_0x32f2b4['dialAnswer']){ut[_0xaa41('0x51')](_0x5ccdc5,_0xaa41('0xd3'));ut[_0xaa41('0x52')](_0xaa41('0xd4')+_0x5ccdc5[_0xaa41('0x33')],_0x4d20c6);}_0x5ccdc5[_0xaa41('0xcb')]+=0x1;_0x32f2b4[_0xaa41('0x95')]=ut[_0xaa41('0x77')](_0x32f2b4);ut['logCustomer'](_0x32f2b4,0xc,_0x4d20c6[_0xaa41('0xcd')]||_0x4d20c6[_0xaa41('0xce')]);_0x52ae7f=_0x5ccdc5[_0xaa41('0xbf')];_0x3621c0=_0x5ccdc5[_0xaa41('0x7e')];rpcDb[_0xaa41('0x67')](_0x32f2b4,_0xaa41('0xd5'));_0x1746b4[_0xaa41('0xa3')](_0x32f2b4,'20',_0x5ccdc5)[_0xaa41('0x56')](function(_0x1b5933){_0x3ba305=_0x1b5933[_0xaa41('0x7d')]==0x1;if(!_0x3ba305){if(ut['totalGlobal'](_0x32f2b4)>=_0x5ccdc5['dialGlobalMaxRetry']){_0x555186=ut[_0xaa41('0x80')](_0x32f2b4,0xf,_0xaa41('0x81'));rpcDb[_0xaa41('0x69')](_0x555186,_0xaa41('0xd6'));}else{rpcDb[_0xaa41('0x69')](_0x32f2b4,_0xaa41('0xd6'));}delete this[_0xaa41('0x14')][_0x4d20c6[_0xaa41('0x84')]];}else{_0x1746b4[_0xaa41('0x88')](_0x32f2b4,_0x52ae7f,_0x3621c0)[_0xaa41('0x56')](function(){});}});}if(!(_0x32f2b4['dialAnswer']&&_0x137f3f==='16')){ut['updateOriginated'](_0x5ccdc5,_0xaa41('0xd7'));logger[_0xaa41('0x27')]('[originated][decrement][callProgressDetectingCustomer]',_0x32f2b4[_0xaa41('0x8c')],'\x20Queue',_0x5ccdc5[_0xaa41('0x33')],_0xaa41('0xd8'),_0x5ccdc5['originated']);}if(_0x137f3f!=='ANSWER'){delete this[_0xaa41('0x14')][_0x4d20c6[_0xaa41('0x84')]];delete this[_0xaa41('0x14')][_0x4d20c6['destlinkedid']];}_0x5ccdc5['queueSummaryCountersUpdated']=!![];}};Preview[_0xaa41('0xf')]['callProgressDetectingAgent']=function(_0x94423a,_0x59d6cf,_0x37dc6f){if(_[_0xaa41('0xd9')](_0x59d6cf)&&_0xaa41('0xda')!==typeof _0x59d6cf){return;}if(_[_0xaa41('0xd9')](_0x37dc6f)&&_0xaa41('0xda')!==typeof _0x37dc6f){return;}switch(_0x37dc6f[_0xaa41('0xdb')]){case'0':ut[_0xaa41('0xdc')](_0x94423a,0x0,'NoSuchNumber');rpcDb[_0xaa41('0xdd')](_0x94423a,_0xaa41('0xde'));break;case'3':ut['logAgent'](_0x94423a,0x3,_0xaa41('0xdf'));rpcDb[_0xaa41('0xdd')](_0x94423a,_0xaa41('0xe0'));break;case'5':ut[_0xaa41('0xdc')](_0x94423a,0x5,'Busy');rpcDb[_0xaa41('0xdd')](_0x94423a,_0xaa41('0xe1'));break;case'8':ut[_0xaa41('0xdc')](_0x94423a,0x8,_0xaa41('0xb5'));rpcDb[_0xaa41('0xdd')](_0x94423a,_0xaa41('0xe2'));break;case'22':ut[_0xaa41('0xdc')](_0x94423a,0x16,_0xaa41('0xe3'));rpcDb[_0xaa41('0xdd')](_0x94423a,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut['logAgent'](_0x94423a,0xc,_0x37dc6f[_0xaa41('0xdb')]);rpcDb[_0xaa41('0xdd')](_0x94423a,_0xaa41('0xe2'));}ut[_0xaa41('0x4f')](_0x59d6cf,_0xaa41('0xe4'));logger[_0xaa41('0x27')]('[originated][decrement][callProgressDetectingAgent]',_0x94423a[_0xaa41('0x8c')],_0xaa41('0x9c'),_0x59d6cf[_0xaa41('0x33')],_0xaa41('0xd8'),_0x59d6cf[_0xaa41('0x2f')]);delete this[_0xaa41('0x14')][_0x94423a['uniqueid']];};Preview[_0xaa41('0xf')][_0xaa41('0xa3')]=function(_0x13ddbe,_0x4cf0c5,_0x1ddfe5){return cmHopperAdditionalPhone[_0xaa41('0xa3')](_0x13ddbe,_0x4cf0c5,_0x1ddfe5)[_0xaa41('0x4d')](logger[_0xaa41('0x27')](_0xaa41('0xe5')));};Preview[_0xaa41('0xf')][_0xaa41('0x88')]=function(_0x943973,_0xe17579,_0x1a6de8){return cmHopperAdditionalPhone[_0xaa41('0x88')](_0x943973,_0xe17579,_0x1a6de8)[_0xaa41('0x4d')](logger[_0xaa41('0x27')]('[swapAdditionalPhone]\x20'));};Preview['prototype'][_0xaa41('0x87')]=function(_0xb9d685){return Promise[_0xaa41('0xe6')]()[_0xaa41('0x56')](cmHopperAdditionalPhone[_0xaa41('0x87')](_0xb9d685))[_0xaa41('0x4d')](logger[_0xaa41('0x27')]('[incrementPreviewCounters]\x20'));};Preview[_0xaa41('0xf')][_0xaa41('0xe7')]=function(_0xa3687e,_0x7e0e69,_0x361819,_0x377e17,_0x1e879d){var _0x1a7527=this;return new Promise(function(_0x1aac0c,_0x1a5a7a){if(_[_0xaa41('0x43')](_0x7e0e69)||_[_0xaa41('0x43')](_0x7e0e69['Contact'])||_[_0xaa41('0x43')](_0x7e0e69[_0xaa41('0xe8')])||_['isNil'](_0x7e0e69[_0xaa41('0x4b')])){_0x1a5a7a(ut[_0xaa41('0x35')](_0xaa41('0xe9'),_0x377e17,_0x1e879d));return;}var _0x400fb7=uuid['v4']();var _0x5c0c5c=_0x1a7527[_0xaa41('0x25')][_0x7e0e69[_0xaa41('0x44')][_0xaa41('0x33')]];var _0x3a223c=_0x361819?_0x1a7527[_0xaa41('0x15')][_0x361819]['id']:undefined;_0x1a7527['actions'][_0x400fb7]=new Action(_0x7e0e69,_0x5c0c5c,_0x400fb7,_0x361819,_0x3a223c);var _0xc59a12=_0x1a7527['actions'][_0x400fb7];_0xc59a12['unlockAgent']=_0x377e17;_0xc59a12[_0xaa41('0x83')]=_0x1e879d;_0xc59a12['lookAgent']=_0x361819;if(_['isEmpty'](_0xa3687e)){_0x1a7527[_0xaa41('0xea')](_0xc59a12,_0x5c0c5c,_0x7e0e69,_0x361819)[_0xaa41('0x56')](function(_0x5b241e){logger['info'](_0xaa41('0xeb'),_0xaa41('0xec')+_0xc59a12[_0xaa41('0x45')]+_0xaa41('0xed')+_0xc59a12[_0xaa41('0x86')],JSON[_0xaa41('0x29')](_0x5b241e));ami[_0xaa41('0x26')](_0xaa41('0xee'),ut['buildObj'](_0xc59a12,_0xaa41('0xef'),_0x1a7527[_0xaa41('0x25')][_0xc59a12[_0xaa41('0x45')]]));_0x1aac0c(ut[_0xaa41('0x35')](_0xaa41('0xf0')));})['catch'](function(_0x519843){ut[_0xaa41('0xf1')](_0xaa41('0xf2'),_0x519843);_0x1a5a7a(ut[_0xaa41('0x35')](_0xaa41('0xf3'),_0x377e17,_0x1e879d));});}else{_0x5c0c5c[_0xaa41('0xf4')]+=0x1;ut[_0xaa41('0xf5')](_0xc59a12);rpcDb['createHistory'](_0xc59a12,_0xaa41('0xf6'));delete _0x1a7527[_0xaa41('0x14')][_0x400fb7];_0x1a5a7a(ut['message'](_0xaa41('0xf7'),_0x377e17,_0x1e879d));}});};Preview[_0xaa41('0xf')][_0xaa41('0x71')]=function(_0x27149e){return!_[_0xaa41('0x43')](_0x27149e)&&!_[_0xaa41('0x43')](_0x27149e[_0xaa41('0x33')])&&!_['isNil'](_0x27149e[_0xaa41('0xf8')])&&_0x27149e[_0xaa41('0xf8')]&&!_['isNil'](this[_0xaa41('0x13')][util[_0xaa41('0x2a')](_0xaa41('0xf9'),_0x27149e[_0xaa41('0x33')])])&&!_['isNil'](this[_0xaa41('0x13')][util[_0xaa41('0x2a')](_0xaa41('0xf9'),_0x27149e[_0xaa41('0x33')])][_0xaa41('0x4c')])&&(this['trunks'][util[_0xaa41('0x2a')](_0xaa41('0xf9'),_0x27149e['name'])]['status']===_0xaa41('0xfa')||this[_0xaa41('0x13')][util[_0xaa41('0x2a')](_0xaa41('0xf9'),_0x27149e[_0xaa41('0x33')])][_0xaa41('0x4c')]==='unmonitored');};Preview['prototype'][_0xaa41('0x5c')]=function(_0x2ff3fb,_0x566832){return this['execRun'](_0x2ff3fb,_0x566832)[_0xaa41('0x56')](function(_0x44dea3){return _[_0xaa41('0xfb')](_0x44dea3,['message']);})['catch'](function(_0x1d609e){if(_0x1d609e[_0xaa41('0xfc')]){rpcDb[_0xaa41('0xfd')](_0x2ff3fb);}if(_0x1d609e['active']){rpcDb[_0xaa41('0xfe')](_0x2ff3fb);}throw _[_0xaa41('0xfb')](_0x1d609e,['message']);});};Preview['prototype'][_0xaa41('0xff')]=function(_0x561447,_0x4679e5){var _0x3fb6f0=this;var _0xdf9297,_0x10252a;return rpcDb[_0xaa41('0x100')](_0x561447)[_0xaa41('0x56')](function(_0x2b083a){if(!_['isNil'](_0x2b083a[0x0])){_0x10252a=_0x2b083a[0x0][_0xaa41('0x101')]?![]:!![];_0xdf9297=_0x2b083a[0x0][_0xaa41('0x101')]?!![]:![];_0xdf9297=_0x4679e5?!![]:_0xdf9297;}var _0x5534ef=_0x3fb6f0[_0xaa41('0x102')](_0x2b083a);if(_0x5534ef[_0xaa41('0x103')]){rpcDb[_0xaa41('0x104')](_[_0xaa41('0xfb')](_0x2b083a[0x0],[_0xaa41('0x4b'),_0xaa41('0xe8')]))['then'](function(_0xa2d55d){_0x3fb6f0[_0xaa41('0xe7')](_0xa2d55d,_0x2b083a[0x0],_0x4679e5,_0x10252a,_0xdf9297)[_0xaa41('0x56')](function(_0x2fa831){return _0x2fa831;})[_0xaa41('0x4d')](function(_0xf8f3e1){throw _0xf8f3e1;});})[_0xaa41('0x4d')](function(_0x5083ff){ut[_0xaa41('0xf1')](_0xaa41('0x105'),_0x5083ff);throw ut[_0xaa41('0x35')]('Call\x20unsuccessful',_0x10252a,_0xdf9297);});}else{throw ut['message'](_0x5534ef['message'],_0x10252a,_0xdf9297);}})[_0xaa41('0x4d')](function(_0x1331f8){ut[_0xaa41('0xf1')](_0xaa41('0x106'),_0x1331f8);throw ut[_0xaa41('0x35')]('Call\x20unsuccessful',![],!![]);});};Preview[_0xaa41('0xf')][_0xaa41('0x102')]=function(_0x1fe1e3){if(_[_0xaa41('0x43')](_0x1fe1e3)||_[_0xaa41('0x107')](_0x1fe1e3)||!_[_0xaa41('0x43')](_0x1fe1e3[0x0][_0xaa41('0x5a')])&&_['isNil'](_0x1fe1e3[0x0][_0xaa41('0x5a')][_0xaa41('0x33')])){ut[_0xaa41('0xf1')]('[Preview][validateContact][Empty\x20Contact]',_0x1fe1e3);return{'isValid':![],'message':_0xaa41('0x108')};}var _0x53a519=this['campaignsPreview'][_0x1fe1e3[0x0][_0xaa41('0x44')]['name']];_0x53a519[_0xaa41('0x35')]=utils[_0xaa41('0x31')][_0xaa41('0x73')];if(_[_0xaa41('0x43')](_0x53a519)){ut[_0xaa41('0xf1')](_0xaa41('0x109'),_0x53a519);return{'isValid':![],'message':_0xaa41('0x10a')};}if(!this['isTrunkReachable'](_0x53a519[_0xaa41('0x70')])){ut[_0xaa41('0xf1')](_0xaa41('0x10b'),_0xaa41('0x10c')+_0x53a519[_0xaa41('0x33')]+_0xaa41('0x10d'));if(!this[_0xaa41('0x71')](_0x53a519[_0xaa41('0x10e')])){ut[_0xaa41('0xf1')](_0xaa41('0x10b'),_0x53a519[_0xaa41('0x33')]+_0xaa41('0x10f'));return{'isValid':![],'message':_0xaa41('0x110')};}}if(!ut[_0xaa41('0x6e')](_0x53a519[_0xaa41('0x111')])){ut[_0xaa41('0xf1')]('[Preview][validateContact][Campaign\x20Active]',_0x53a519[_0xaa41('0x33')]+'\x20Not\x20Active');return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x53a519['name']+_0xaa41('0x112')};}return{'isValid':!![],'message':_0xaa41('0x113')};};Preview['prototype'][_0xaa41('0xea')]=function(_0x356256,_0x1e86cc,_0x15bb60,_0x232732){var _0x34d857=this;return new Promise(function(_0x239f1b,_0x445925){var _0x1e8591=_0x356256[_0xaa41('0x8c')];var _0x347d0c=_0x34d857[_0xaa41('0x71')](_0x1e86cc[_0xaa41('0x70')])?util[_0xaa41('0x2a')](_0xaa41('0x114'),_0x1e86cc[_0xaa41('0x70')][_0xaa41('0x33')],_['isNil'](_0x1e86cc[_0xaa41('0x115')])?'':_0x1e86cc[_0xaa41('0x115')][_0xaa41('0x116')]()||'',_0x1e86cc[_0xaa41('0x117')]>0x0?_0x15bb60['phone'][_0xaa41('0x118')](_0x1e86cc[_0xaa41('0x117')]):_0x15bb60['phone']):util[_0xaa41('0x2a')](_0xaa41('0x114'),_[_0xaa41('0x43')](_0x1e86cc[_0xaa41('0x10e')])?_0x1e86cc[_0xaa41('0x70')][_0xaa41('0x33')]:_0x1e86cc[_0xaa41('0x10e')][_0xaa41('0x33')],_[_0xaa41('0x43')](_0x1e86cc[_0xaa41('0x115')])?'':_0x1e86cc['dialPrefix'][_0xaa41('0x116')]()||'',_0x1e86cc[_0xaa41('0x117')]>0x0?_0x15bb60[_0xaa41('0xe8')][_0xaa41('0x118')](_0x1e86cc[_0xaa41('0x117')]):_0x15bb60[_0xaa41('0xe8')]);var _0x53dea3=_0x34d857[_0xaa41('0x71')](_0x1e86cc['Trunk'])?ut[_0xaa41('0x119')](_0x1e86cc[_0xaa41('0x70')][_0xaa41('0x11a')],_0x1e86cc[_0xaa41('0x11b')],_0x1e86cc[_0xaa41('0x11c')]>0x0?ut['getCallerIdRandom'](_0x1e86cc[_0xaa41('0x11d')],_0x1e86cc[_0xaa41('0x11c')]):_0x1e86cc['dialOriginateCallerIdNumber']):ut[_0xaa41('0x119')](_[_0xaa41('0x43')](_0x1e86cc[_0xaa41('0x10e')])?_0x1e86cc[_0xaa41('0x70')][_0xaa41('0x11a')]:_0x1e86cc[_0xaa41('0x10e')][_0xaa41('0x11a')],_0x1e86cc[_0xaa41('0x11b')],_0x1e86cc[_0xaa41('0x11c')]>0x0?ut[_0xaa41('0x11e')](_0x1e86cc['dialOriginateCallerIdNumber'],_0x1e86cc[_0xaa41('0x11c')]):_0x1e86cc[_0xaa41('0x11d')]);if(_0x53dea3){_0x356256[_0xaa41('0x11f')]=ut['extractCalleridName'](_0x53dea3);_0x356256['originatecalleridnum']=ut[_0xaa41('0x120')](_0x53dea3);}var _0x5aee9b=ut['addVariables'](_0x1e86cc,_0x15bb60,_0x347d0c,_0x53dea3,_0x1e8591,_0x356256);_[_0xaa41('0x121')](_0x356256,ut[_0xaa41('0x122')](_0x5aee9b));_0x356256[_0xaa41('0x123')]=moment()[_0xaa41('0x2a')]('YYYY-MM-DD\x20HH:mm:ss');_0x1e86cc['variables']=_0x5aee9b;var _0xa63e60=ut[_0xaa41('0x124')](_0x356256,_0x1e86cc,_0x5aee9b,_0x356256[_0xaa41('0x83')],_0x232732);return ami[_0xaa41('0x125')](_0xa63e60)[_0xaa41('0x56')](function(_0x5e3bb2){_0x1e86cc[_0xaa41('0x2f')]+=0x1;logger[_0xaa41('0x27')]('[originated][increment]',_0x1e8591,_0xaa41('0x9c'),_0x1e86cc[_0xaa41('0x33')],'originated:\x20',_0x1e86cc[_0xaa41('0x2f')]);_0x239f1b(_0x5e3bb2);})[_0xaa41('0x4d')](function(_0x58a5e5){ut[_0xaa41('0xdc')](_0x356256,0xe,_0xaa41('0x126'));rpcDb['createAgentHistory'](_0x356256,_0xaa41('0x127'));_0x445925(_0x58a5e5);});});};Preview['prototype']['syncNewExten']=function(_0x1ffee2){if(this[_0xaa41('0x14')][_0x1ffee2[_0xaa41('0x84')]]){this[_0xaa41('0x14')][_0x1ffee2[_0xaa41('0x84')]]['channel']=_0x1ffee2[_0xaa41('0x128')];}};Preview['prototype']['syncOriginateResponse']=function(_0x25548d){var _0x28685a=this;var _0x2f62f6=this[_0xaa41('0x14')][_0x25548d[_0xaa41('0x129')]];if(_0x2f62f6){if(_0x2f62f6[_0xaa41('0x12a')]&&this[_0xaa41('0x15')][_0x2f62f6['lookAgent']]){ut[_0xaa41('0x12b')](_0x2f62f6,this[_0xaa41('0x15')][_0x2f62f6[_0xaa41('0x12a')]][_0xaa41('0x33')],this[_0xaa41('0x15')][_0x2f62f6[_0xaa41('0x12a')]]['id']);}var _0x3aafe6=_[_0xaa41('0x12c')](_0x2f62f6);_0x3aafe6[_0xaa41('0x12d')]=moment()[_0xaa41('0x2a')](_0xaa41('0x5f'));var _0x2e8c8f=_0x28685a['campaignsPreview'][_0x2f62f6['queue']];if(ut[_0xaa41('0x12e')](_0x25548d[_0xaa41('0x12f')])){if(_0x2f62f6[_0xaa41('0xa9')]){rpcDb['unlockContact'](_0x2f62f6[_0xaa41('0x86')]);}if(_0x2f62f6[_0xaa41('0x83')]){rpcDb[_0xaa41('0xfe')](_0x2f62f6[_0xaa41('0x86')]);}ami[_0xaa41('0x26')](_0xaa41('0x130'),ut[_0xaa41('0x7a')](_0x2f62f6,_0xaa41('0x131'),this[_0xaa41('0x25')][_0x2f62f6[_0xaa41('0x45')]]));this[_0xaa41('0x132')](_0x3aafe6,_0x2e8c8f,_0x25548d);}else{_0x2f62f6[_0xaa41('0x123')]=moment()[_0xaa41('0x2a')](_0xaa41('0x5f'));ut[_0xaa41('0xdc')](_0x3aafe6,0x4,'Answer');rpcDb[_0xaa41('0xdd')](_0x3aafe6,_0xaa41('0x133'));}}};Preview[_0xaa41('0xf')]['syncHangup']=function(_0x125efb){var _0xfc1e24=this[_0xaa41('0x14')][_0x125efb[_0xaa41('0x84')]];var _0x21c0c6;if(_0xfc1e24){_0x21c0c6=this[_0xaa41('0x25')][_0xfc1e24[_0xaa41('0x45')]];logger[_0xaa41('0x27')]('[syncHangup][talking]',_0x125efb[_0xaa41('0x84')],_0xaa41('0x9c'),_0x21c0c6[_0xaa41('0x33')],_0xaa41('0x46'),_0x21c0c6[_0xaa41('0x47')]);}if(this['actions'][_0x125efb[_0xaa41('0x84')]]&&_0x125efb['linkedid']!==_0x125efb[_0xaa41('0x8c')]){if(_0x125efb[_0xaa41('0x134')]==='16'&&this[_0xaa41('0x14')][_0x125efb[_0xaa41('0x84')]][_0xaa41('0x48')]){this[_0xaa41('0x74')](_0x125efb,_0x125efb[_0xaa41('0x84')],_0x125efb[_0xaa41('0x134')]);}else if(this[_0xaa41('0x14')][_0x125efb[_0xaa41('0x84')]][_0xaa41('0x48')]){logger[_0xaa41('0x27')]('[syncHangup][talking][cause]',_0x125efb['linkedid'],_0x125efb[_0xaa41('0x134')],_0xaa41('0x9c'),_0x21c0c6[_0xaa41('0x33')],_0xaa41('0x46'),_0x21c0c6[_0xaa41('0x47')]);this[_0xaa41('0x74')](_0x125efb,_0x125efb['linkedid'],_0x125efb[_0xaa41('0x134')]);}}else if(_0xfc1e24&&_['isNil'](_0xfc1e24[_0xaa41('0x135')])&&_0x21c0c6[_0xaa41('0x136')]&&_0x125efb[_0xaa41('0x84')]===_0x125efb[_0xaa41('0x8c')]&&_[_0xaa41('0x43')](_0x125efb[_0xaa41('0xdb')])&&_0x125efb['cause']==='16'&&_0x125efb['channelstate']==='6'&&_[_0xaa41('0xd9')](_0xfc1e24['transfer'])){if(_0xfc1e24[_0xaa41('0xa9')]){rpcDb[_0xaa41('0xfd')](_0xfc1e24[_0xaa41('0x86')]);}if(_0xfc1e24[_0xaa41('0x83')]){rpcDb[_0xaa41('0xfe')](_0xfc1e24[_0xaa41('0x86')]);}_0x125efb[_0xaa41('0xdb')]='22';this[_0xaa41('0x132')](_0xfc1e24,_0x21c0c6,_0x125efb);}else if(_0xfc1e24&&_0xfc1e24[_0xaa41('0x137')]){if(_0x125efb[_0xaa41('0x134')]==='16'&&this[_0xaa41('0x14')][_0x125efb[_0xaa41('0x84')]][_0xaa41('0x48')]){logger[_0xaa41('0x27')]('[syncHangup][talking][transfer]',_0x125efb[_0xaa41('0x84')],_0x125efb['cause'],_0xaa41('0x9c'),_0x21c0c6['name'],_0xaa41('0x46'),_0x21c0c6[_0xaa41('0x47')]);this[_0xaa41('0x74')](_0x125efb,_0x125efb[_0xaa41('0x84')],_0x125efb[_0xaa41('0x134')]);}else if(this[_0xaa41('0x14')][_0x125efb[_0xaa41('0x84')]]['dialAnswer']){logger[_0xaa41('0x27')]('[syncHangup][talking][cause]',_0x125efb['linkedid'],_0x125efb[_0xaa41('0x134')],_0xaa41('0x9c'),_0x21c0c6['name'],_0xaa41('0x46'),_0x21c0c6[_0xaa41('0x47')]);this['callProgressDetectingCustomer'](_0x125efb,_0x125efb[_0xaa41('0x84')],_0x125efb[_0xaa41('0x134')]);}}};Preview[_0xaa41('0xf')]['syncDialEnd']=function(_0x3ecde6){if(this['actions'][_0x3ecde6[_0xaa41('0x138')]]&&_0x3ecde6[_0xaa41('0x138')]!==_0x3ecde6[_0xaa41('0x139')]){this[_0xaa41('0x74')](_0x3ecde6,_0x3ecde6['destlinkedid'],_0x3ecde6[_0xaa41('0xce')]);}};Preview[_0xaa41('0xf')][_0xaa41('0x1c')]=function(_0x49e4a5){if(this[_0xaa41('0x14')][_0x49e4a5[_0xaa41('0x84')]]&&_0x49e4a5[_0xaa41('0x84')]!==_0x49e4a5[_0xaa41('0x8c')]&&!this[_0xaa41('0x14')][_0x49e4a5[_0xaa41('0x84')]][_0xaa41('0x48')]){if(_0x49e4a5[_0xaa41('0x134')]==='1'){this['callProgressDetectingCustomer'](_0x49e4a5,_0x49e4a5[_0xaa41('0x84')],_0x49e4a5['cause']);}}};Preview[_0xaa41('0xf')][_0xaa41('0x13a')]=function(_0x1fa855,_0x272f3f,_0x36cdd2){if(this[_0xaa41('0x14')][_0x1fa855]){if(_[_0xaa41('0x43')](this[_0xaa41('0x14')][_0x1fa855][_0xaa41('0x13b')])){this[_0xaa41('0x14')][_0x1fa855][_0xaa41('0x13b')]={};}this[_0xaa41('0x14')][_0x1fa855][_0xaa41('0x13b')][_0x272f3f]=_0x36cdd2;}};Preview['prototype'][_0xaa41('0x21')]=function(_0x366b1c){try{if(!_[_0xaa41('0x43')](_0x366b1c)){if(ut[_0xaa41('0x13c')](_[_0xaa41('0x13d')](_0x366b1c[_0xaa41('0x13e')])[0x0])){this[_0xaa41('0x13a')](_0x366b1c[_0xaa41('0x8c')],_[_0xaa41('0x13d')](_0x366b1c['variable'])[0x0],_0x366b1c[_0xaa41('0x13f')]);}}}catch(_0x30a438){logger[_0xaa41('0x140')](_0xaa41('0x141'),util[_0xaa41('0x142')](_0x30a438,{'showHidden':![],'depth':null}));}};Preview[_0xaa41('0xf')][_0xaa41('0x143')]=function(_0x3f1b1a){if(_0x3f1b1a){if(this[_0xaa41('0x14')][_0x3f1b1a[_0xaa41('0x144')]]){this['actions'][_0x3f1b1a['transfertargetlinkedid']]['transfer']=!![];}}};Preview[_0xaa41('0xf')][_0xaa41('0x24')]=function(_0x5ccba6){if(_0x5ccba6){if(this[_0xaa41('0x14')][_0x5ccba6[_0xaa41('0x145')]]){this['actions'][_0x5ccba6[_0xaa41('0x145')]]['transfer']=!![];}}};module[_0xaa41('0x146')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 58fdd6b..007074d 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 _0x2834=['then','[createHistory]\x20','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','createAgentHistory','createCustomerHistory','rescheduleContact','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','calleridnum','answertime','queuecallerleaveAt','endtime','connectedlinename','membername','context','from-sip','exten','lastAssignedTo','queuecallerexitreason','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','bluebird','../../../config/logger','preview','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','catch','resolve'];(function(_0x31e534,_0x22bace){var _0x39f5ff=function(_0x314271){while(--_0x314271){_0x31e534['push'](_0x31e534['shift']());}};_0x39f5ff(++_0x22bace);}(_0x2834,0x1e3));var _0x4283=function(_0x434e04,_0x3786d5){_0x434e04=_0x434e04-0x0;var _0x3067b4=_0x2834[_0x434e04];return _0x3067b4;};'use strict';var util=require('util');var BPromise=require(_0x4283('0x0'));var logger=require(_0x4283('0x1'))(_0x4283('0x2'));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0x4283('0x3'));var cmHopperBlack=require(_0x4283('0x4'));var agentReportPreview=require(_0x4283('0x5'));var voiceQueueReport=require(_0x4283('0x6'));function loggerCatch(_0x1e017d){return function(_0x2b3f91){logger[_0x4283('0x7')](_0x1e017d,util[_0x4283('0x8')](_0x2b3f91,{'showHidden':![],'depth':null}));};}function create(_0x3e6831){return cmHopperHistory[_0x4283('0x9')](_0x3e6831)[_0x4283('0xa')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x468bd1){return BPromise[_0x4283('0xb')]()[_0x4283('0xc')](agentReportPreview[_0x4283('0x9')](_0x468bd1))[_0x4283('0xa')](loggerCatch(_0x4283('0xd')));}function moveContact(_0x2ec6d9){return cmHopper['moveContactManagedDialer'](_0x2ec6d9,!![])['catch'](loggerCatch(_0x4283('0xe')));}exports[_0x4283('0xf')]=function(_0x26a7eb){return cmHopperBlack[_0x4283('0xf')](_0x26a7eb)['catch'](loggerCatch(_0x4283('0x10')));};exports['getContactPreview']=function(_0x2dd02e){return BPromise['resolve']()[_0x4283('0xc')](cmHopper['getContactPreview'](_0x2dd02e))[_0x4283('0xa')](loggerCatch('[getContactPreview]\x20'));};exports[_0x4283('0x9')]=function(_0x24bdc6,_0x3fee18){create(_0x24bdc6)[_0x4283('0xa')](loggerCatch(_0x3fee18));moveContact(_0x24bdc6)['catch'](loggerCatch(_0x3fee18));};exports[_0x4283('0x11')]=function(_0x52c603,_0x172aab){createAgent(_0x52c603)['catch'](loggerCatch(_0x172aab));};exports[_0x4283('0x12')]=function(_0xf7bf2e,_0x19ae39){create(_0xf7bf2e)['catch'](loggerCatch(_0x19ae39));};exports['createCustomerFinal']=function(_0x12af32,_0x4765b0){moveContact(_0x12af32)[_0x4283('0xa')](loggerCatch(_0x4765b0));};exports[_0x4283('0x13')]=function(_0x271eb8,_0x276d1b,_0x25e170){if(_0x276d1b){_0x271eb8['UserId']=null;}if(_0x25e170){_0x271eb8['active']=![];}return cmHopper[_0x4283('0x13')](_0x271eb8)['catch'](loggerCatch(_0x4283('0x14')));};exports[_0x4283('0x15')]=function(_0x2a249f){return cmHopper[_0x4283('0x15')](_0x2a249f)['catch'](loggerCatch(_0x4283('0x16')));};exports['unlockContact']=function(_0x208040){return cmHopper[_0x4283('0x17')]({'UserId':null},_0x208040,0x1)[_0x4283('0xa')](loggerCatch(_0x4283('0x18')));};exports[_0x4283('0x19')]=function(_0x23a130){return cmHopper[_0x4283('0x17')]({'active':![]},_0x23a130,0x1)[_0x4283('0xa')](loggerCatch(_0x4283('0x1a')));};exports[_0x4283('0x1b')]=function(_0x598136){var _0x1d4c09={};_0x1d4c09[_0x4283('0x1c')]=_0x598136[_0x4283('0x1c')];_0x1d4c09['uniqueid']=_0x598136['uniqueid'];_0x1d4c09[_0x4283('0x1d')]=_0x598136['calleridnum'];_0x1d4c09['calleridname']=_0x598136['calleridname'];_0x1d4c09['queue']=_0x598136['queue'];_0x1d4c09['queuecallerjoinAt']=_0x598136[_0x4283('0x1e')];_0x1d4c09[_0x4283('0x1f')]=_0x598136[_0x4283('0x1e')];_0x1d4c09['queuecallercomplete']=0x1;_0x1d4c09['queuecallercompleteAt']=_0x598136[_0x4283('0x20')];_0x1d4c09[_0x4283('0x21')]=_0x598136[_0x4283('0x22')];_0x1d4c09[_0x4283('0x23')]=_0x4283('0x24');_0x1d4c09[_0x4283('0x25')]='xcally-motion-preview';_0x1d4c09['holdtime']=0x0;_0x1d4c09['assigned']=0x1;_0x1d4c09[_0x4283('0x26')]=_0x598136['membername'];_0x1d4c09[_0x4283('0x27')]='COMPLETED';return BPromise[_0x4283('0xb')]()[_0x4283('0xc')](voiceQueueReport['create'](_0x1d4c09))[_0x4283('0xa')](loggerCatch(_0x4283('0x28')));};exports[_0x4283('0x29')]=function(_0x7297a1,_0x34090a){return BPromise[_0x4283('0xb')]()[_0x4283('0xc')](cmHopper[_0x4283('0x29')](_0x7297a1,_0x34090a))[_0x4283('0xa')](loggerCatch(_0x4283('0x2a')));};exports[_0x4283('0x2b')]=function(_0x1071b5){return cmHopper[_0x4283('0x13')](_0x1071b5,!![],!![])[_0x4283('0xa')](loggerCatch(_0x4283('0x2c')));}; \ No newline at end of file +var _0x1956=['[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','then','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','active','[rescheduleContact]\x20','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','from-sip','exten','holdtime','assigned','queuecallerexitreason','COMPLETED','create','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','bluebird','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueReport','error','inspect','createHistory','catch','[createHistory]\x20','resolve'];(function(_0x4288de,_0x12e9a0){var _0x27c707=function(_0x540205){while(--_0x540205){_0x4288de['push'](_0x4288de['shift']());}};_0x27c707(++_0x12e9a0);}(_0x1956,0x1c8));var _0x6195=function(_0x57975f,_0x388556){_0x57975f=_0x57975f-0x0;var _0x4793b8=_0x1956[_0x57975f];return _0x4793b8;};'use strict';var util=require('util');var BPromise=require(_0x6195('0x0'));var logger=require('../../../config/logger')(_0x6195('0x1'));var cmHopper=require(_0x6195('0x2'));var cmHopperHistory=require(_0x6195('0x3'));var cmHopperBlack=require(_0x6195('0x4'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x6195('0x5'));function loggerCatch(_0x5caf09){return function(_0x5a0b21){logger[_0x6195('0x6')](_0x5caf09,util[_0x6195('0x7')](_0x5a0b21,{'showHidden':![],'depth':null}));};}function create(_0x56c5d6){return cmHopperHistory[_0x6195('0x8')](_0x56c5d6)[_0x6195('0x9')](loggerCatch(_0x6195('0xa')));}function createAgent(_0x15a119){return BPromise[_0x6195('0xb')]()['then'](agentReportPreview[_0x6195('0x8')](_0x15a119))['catch'](loggerCatch(_0x6195('0xa')));}function moveContact(_0x1218da){return cmHopper['moveContactManagedDialer'](_0x1218da,!![])['catch'](loggerCatch(_0x6195('0xc')));}exports[_0x6195('0xd')]=function(_0x26ef5b){return cmHopperBlack[_0x6195('0xd')](_0x26ef5b)['catch'](loggerCatch(_0x6195('0xe')));};exports[_0x6195('0xf')]=function(_0xab5fc0){return BPromise[_0x6195('0xb')]()[_0x6195('0x10')](cmHopper[_0x6195('0xf')](_0xab5fc0))[_0x6195('0x9')](loggerCatch('[getContactPreview]\x20'));};exports[_0x6195('0x8')]=function(_0x366c27,_0x4b3128){create(_0x366c27)[_0x6195('0x9')](loggerCatch(_0x4b3128));moveContact(_0x366c27)[_0x6195('0x9')](loggerCatch(_0x4b3128));};exports[_0x6195('0x11')]=function(_0x3ddfe8,_0x3208c9){createAgent(_0x3ddfe8)[_0x6195('0x9')](loggerCatch(_0x3208c9));};exports[_0x6195('0x12')]=function(_0x60b95c,_0x916626){create(_0x60b95c)[_0x6195('0x9')](loggerCatch(_0x916626));};exports[_0x6195('0x13')]=function(_0x3d02a1,_0x223c4c){moveContact(_0x3d02a1)['catch'](loggerCatch(_0x223c4c));};exports[_0x6195('0x14')]=function(_0x3d934e,_0x13f6cc,_0x96b43a){if(_0x13f6cc){_0x3d934e['UserId']=null;}if(_0x96b43a){_0x3d934e[_0x6195('0x15')]=![];}return cmHopper[_0x6195('0x14')](_0x3d934e)['catch'](loggerCatch(_0x6195('0x16')));};exports['countReScheduled']=function(_0x19b1e6){return cmHopper['countReScheduled'](_0x19b1e6)[_0x6195('0x9')](loggerCatch(_0x6195('0x17')));};exports[_0x6195('0x18')]=function(_0x1da453){return cmHopper['unlockContact']({'UserId':null},_0x1da453,0x1)[_0x6195('0x9')](loggerCatch(_0x6195('0x19')));};exports[_0x6195('0x1a')]=function(_0x414c63){return cmHopper['unlockContact']({'active':![]},_0x414c63,0x1)['catch'](loggerCatch(_0x6195('0x1b')));};exports[_0x6195('0x1c')]=function(_0x346285){var _0x2face6={};_0x2face6[_0x6195('0x1d')]=_0x346285[_0x6195('0x1d')];_0x2face6[_0x6195('0x1e')]=_0x346285[_0x6195('0x1e')];_0x2face6['calleridnum']=_0x346285['calleridnum'];_0x2face6[_0x6195('0x1f')]=_0x346285[_0x6195('0x1f')];_0x2face6[_0x6195('0x20')]=_0x346285[_0x6195('0x20')];_0x2face6[_0x6195('0x21')]=_0x346285[_0x6195('0x22')];_0x2face6[_0x6195('0x23')]=_0x346285[_0x6195('0x22')];_0x2face6[_0x6195('0x24')]=0x1;_0x2face6[_0x6195('0x25')]=_0x346285[_0x6195('0x26')];_0x2face6[_0x6195('0x27')]=_0x346285[_0x6195('0x28')];_0x2face6['context']=_0x6195('0x29');_0x2face6[_0x6195('0x2a')]='xcally-motion-preview';_0x2face6[_0x6195('0x2b')]=0x0;_0x2face6[_0x6195('0x2c')]=0x1;_0x2face6['lastAssignedTo']=_0x346285[_0x6195('0x28')];_0x2face6[_0x6195('0x2d')]=_0x6195('0x2e');return BPromise[_0x6195('0xb')]()[_0x6195('0x10')](voiceQueueReport[_0x6195('0x2f')](_0x2face6))[_0x6195('0x9')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x6195('0x30')]=function(_0x604c4e,_0x99661b){return BPromise[_0x6195('0xb')]()[_0x6195('0x10')](cmHopper[_0x6195('0x30')](_0x604c4e,_0x99661b))[_0x6195('0x9')](loggerCatch(_0x6195('0x31')));};exports[_0x6195('0x32')]=function(_0x23cb90){return cmHopper[_0x6195('0x14')](_0x23cb90,!![],!![])[_0x6195('0x9')](loggerCatch(_0x6195('0x33')));}; \ 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 2acfc51..3b64138 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 _0x0159=['message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','calleridname','calleridnum','ContactId','dialer','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','starttime','responsetime','endtime','statedesc','ringtime','getSeconds','logLookAgent','membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','RECALL','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','minutes','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','name','queue','motionChannel','voice','buildObj','interface','not_inuse','status','reachable','push','getDiff','milliseconds','diff','seconds','createBody','filterKey','idContact','dialAnswer','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-queue','xmd-listid','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-callerid','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','bridgepvtcallid','getCallerIdRandom','pow','replace','random','match','extractCalleridNumber','noanswer','variables','toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','preview','env','../../dialer/utils','error','logger','inspect','loggerError','logger2','info'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x0159,0x11f));var _0x9015=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0159[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x9015('0x0'));var _=require(_0x9015('0x1'));var moment=require(_0x9015('0x2'));var logger=require(_0x9015('0x3'))(_0x9015('0x4'));var ipAgi=process[_0x9015('0x5')]['XCALLY_IP_AGI']||'127.0.0.1';var utils=require(_0x9015('0x6'));exports['loggerCatch']=function(_0x5207f9){return function(_0x223715){logger[_0x9015('0x7')](_0x5207f9,util['inspect'](_0x223715,{'showHidden':![],'depth':null}));};};exports[_0x9015('0x8')]=function(_0x38aeb0,_0x2c4fd7){logger['info'](_0x38aeb0,util[_0x9015('0x9')](_0x2c4fd7,{'showHidden':![],'depth':null}));};exports[_0x9015('0xa')]=function(_0x1e288b,_0x1dd5c1){logger[_0x9015('0x7')](_0x1e288b,util[_0x9015('0x9')](_0x1dd5c1,{'showHidden':![],'depth':null}));};exports[_0x9015('0xb')]=function(_0x1146b6){return function(_0x49ea57){logger[_0x9015('0xc')](_0x1146b6,util[_0x9015('0x9')](_0x49ea57,{'showHidden':![],'depth':null}));};};exports[_0x9015('0xd')]=function(_0x235f9f,_0x47f769,_0x50eee1){return{'message':_0x235f9f,'unlock':_0x47f769,'active':_0x50eee1};};exports[_0x9015('0xe')]=function(_0x4d8cce,_0x2306e8,_0x385f7c){if(!_['isUndefined'](_0x385f7c)&&'string'===typeof _0x385f7c&&!_['isEmpty'](_0x385f7c)){if(!_[_0x9015('0xf')](_0x2306e8)&&_0x9015('0x10')===typeof _0x2306e8&&!_[_0x9015('0x11')](_0x2306e8)){return util['format'](_0x9015('0x12'),_0x2306e8,_0x385f7c);}return util[_0x9015('0x13')](_0x9015('0x12'),_0x385f7c,_0x385f7c);}if(!_['isUndefined'](_0x4d8cce)&&_0x9015('0x10')===typeof _0x4d8cce&&!_['isEmpty'](_0x4d8cce)){return _0x4d8cce;}return _0x9015('0x14');};exports[_0x9015('0x15')]=function(_0x391fc3){if(_[_0x9015('0x16')](_0x391fc3)){return![];}return _0x391fc3;};exports[_0x9015('0x17')]=function(_0xe5caca,_0x4162d9,_0x29f81e,_0x56feac,_0x10994f,_0x1b30f4){var _0x5d9403={'XMD-QUEUE':_0x4162d9[_0x9015('0x18')]?_0x4162d9[_0x9015('0x18')]['name']:'','XMD-CALLERID':_0x56feac,'XMD-CALLERID-PREVIEW':_0x1b30f4?util[_0x9015('0x13')](_0x9015('0x12'),_0x1b30f4[_0x9015('0x19')],_0x1b30f4[_0x9015('0x1a')]):_0x56feac,'XMD-DIALID':_0x10994f,'XMD-CONTACTID':_0x4162d9[_0x9015('0x1b')],'XMD-CDRTYPE':_0x9015('0x1c'),'CALLERID(all)':_0x56feac,'XMD-VOICEQUEUEID':_0x4162d9['VoiceQueueId'],'XMD-DIALCHANNEL':_0x29f81e,'XMD-DIALTIMEOUT':_0xe5caca['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x9015('0x13')](_0x9015('0x1d'),_0xe5caca[_0x9015('0x1e')]?'g':'',_['isEmpty'](_0xe5caca[_0x9015('0x1f')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0xe5caca[_0x9015('0x20')]||'','XMD-AGI':_0xe5caca[_0x9015('0x21')]?util['format'](_0x9015('0x22'),ipAgi,_0xe5caca[_0x9015('0x21')]):_0x9015('0x23'),'XMD-AGIAFTER':_0xe5caca['dialQueueProject2']?util[_0x9015('0x13')]('\x22agi://%s/square,%s\x22',ipAgi,_0xe5caca[_0x9015('0x1e')]):_0x9015('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x1b30f4?_0x1b30f4[_0x9015('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x1b30f4?_0x1b30f4[_0x9015('0x25')]:'','XMD-DESTINATION':_0x9015('0x26'),'SIPADDHEADER':_0x9015('0x27')};if(!_[_0x9015('0x11')](_0xe5caca[_0x9015('0x1f')])){_0x5d9403[util[_0x9015('0x13')]('%s',_0x9015('0x28'))]=_0xe5caca[_0x9015('0x1f')];_0x5d9403[util[_0x9015('0x13')]('%s',_0x9015('0x29'))]=_0x10994f;}if(_0x4162d9&&_0x4162d9['Contact']){for(var _0x4de75d in _0x4162d9[_0x9015('0x2a')]){if(_0x4162d9[_0x9015('0x2a')][_0x9015('0x2b')](_0x4de75d)){if(!_['isNil'](_0x4162d9[_0x9015('0x2a')][_0x4de75d])&&_0x4de75d!=='id'&&_0x4de75d!==_0x9015('0x2c')&&_0x4de75d!==_0x9015('0x2d')&&_0x4de75d!==_0x9015('0x2e')){_0x5d9403[util['format'](_0x9015('0x2f'),'XMD-',_[_0x9015('0x30')](_0x4de75d))]=_0x4162d9['Contact'][_0x4de75d];}}}}return _0x5d9403;};exports[_0x9015('0x31')]=function(_0x49fdba){var _0x3bb939={};for(var _0x42c1a2 in _0x49fdba){if(_0x49fdba[_0x9015('0x2b')](_0x42c1a2)){_0x3bb939[util[_0x9015('0x13')]('%s',_[_0x9015('0x32')](_0x42c1a2))]=_0x49fdba[_0x42c1a2];}}return{'variables':_0x3bb939};};exports[_0x9015('0x33')]=function(_0x4442e2,_0x42a32f){if(!_[_0x9015('0x16')](_0x4442e2)){if(_0x4442e2['hasOwnProperty']('originated')){if(_0x4442e2[_0x9015('0x34')]>0x0){_0x4442e2['originated']-=0x1;}else{logger[_0x9015('0x7')](_0x9015('0x35'),_0x42a32f);}}}else{logger[_0x9015('0x7')](_0x9015('0x36'),_0x42a32f);}};exports[_0x9015('0x37')]=function(_0x158242){var _0x3165bf=moment()['format'](_0x9015('0x38'));_0x158242[_0x9015('0x39')]=0xd;_0x158242['statedesc']=_0x9015('0x3a');_0x158242[_0x9015('0x3b')]=_0x3165bf;_0x158242[_0x9015('0x3c')]=_0x3165bf;_0x158242[_0x9015('0x3d')]=_0x3165bf;};exports['logAgent']=function(_0x3c13c1,_0x4470cb,_0x26f289){var _0x44cef6=moment()[_0x9015('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x3c13c1[_0x9015('0x39')]=_0x4470cb;_0x3c13c1[_0x9015('0x3e')]=_0x26f289;_0x3c13c1[_0x9015('0x3c')]=_0x44cef6;_0x3c13c1[_0x9015('0x3f')]=utils[_0x9015('0x40')](_0x3c13c1['responsetime'],_0x3c13c1[_0x9015('0x3b')]);};exports[_0x9015('0x41')]=function(_0x4ab2c3,_0x1edca8,_0x764e13){_0x4ab2c3[_0x9015('0x42')]=_0x1edca8;_0x4ab2c3[_0x9015('0x43')]=_0x764e13;};exports[_0x9015('0x44')]=function(_0x32d608,_0x2cff18,_0x288270){var _0x3af308=moment()[_0x9015('0x13')](_0x9015('0x38'));_0x32d608[_0x9015('0x39')]=_0x2cff18;_0x32d608[_0x9015('0x3e')]=_0x288270;_0x32d608['responsetime']=_0x32d608[_0x9015('0x3c')]?_0x32d608['responsetime']:_0x3af308;_0x32d608[_0x9015('0x3d')]=_0x32d608[_0x9015('0x3d')]?_0x32d608[_0x9015('0x3d')]:_0x3af308;_0x32d608[_0x9015('0x3f')]=utils[_0x9015('0x40')](_0x32d608[_0x9015('0x3c')]||0x0,_0x32d608[_0x9015('0x3b')]||0x0);_0x32d608[_0x9015('0x45')]=_0x32d608[_0x9015('0x46')]?utils[_0x9015('0x40')](_0x32d608[_0x9015('0x3d')],_0x32d608[_0x9015('0x46')]):0x0;};exports[_0x9015('0x47')]=function(_0x3a27bc){return _0x3a27bc===_0x9015('0x48');};exports[_0x9015('0x49')]=function(_0x398a61,_0x341f17,_0x5f5d53,_0x125c8b,_0x4fcfe0){var _0x1c07c5=_0x125c8b?_0x9015('0x4a'):_0x398a61[_0x9015('0x19')];_0x1c07c5=_0x4fcfe0?'BOOKED':_0x1c07c5;return{'actionid':_0x398a61[_0x9015('0x4b')],'action':_0x9015('0x4c'),'channel':_0x398a61[_0x9015('0x4d')],'callerid':util['format'](_0x9015('0x12'),_0x1c07c5,_0x398a61[_0x9015('0x1a')]),'Exten':_0x9015('0x26'),'Context':_0x9015('0x4e'),'Priority':'1','variable':_0x5f5d53,'timeout':(_0x341f17[_0x9015('0x4f')]||0x1e)*0x3e8,'async':!![],'channelid':_0x398a61['uniqueid']};};exports[_0x9015('0x50')]=function(_0x102017){return _0x102017[_0x9015('0x51')]+_0x102017[_0x9015('0x52')]+_0x102017[_0x9015('0x53')]+_0x102017[_0x9015('0x54')]+_0x102017[_0x9015('0x55')];};exports[_0x9015('0x56')]=function(_0x5ee1a7){var _0x510c84=_[_0x9015('0x57')](_0x5ee1a7);_0x510c84['state']=0xf;_0x510c84['statedesc']=_0x9015('0x58');return _0x510c84;};exports[_0x9015('0x59')]=function(_0x2a4197,_0x519396,_0x121fd8){var _0x90e766={};_0x90e766[_0x519396]=_0x2a4197[_0x519396];_0x90e766[_0x9015('0x5a')]=![];_0x90e766[_0x9015('0x5b')]=moment()['add'](_0x121fd8,_0x9015('0x5c'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x90e766['ContactId']=_0x2a4197[_0x9015('0x1b')];_0x90e766[_0x9015('0x5d')]=_0x2a4197[_0x9015('0x5d')];_0x90e766[_0x9015('0x5e')]=_0x2a4197[_0x9015('0x5e')]||undefined;return _0x90e766;};exports[_0x9015('0x5f')]=function(_0x4b2a3b,_0x59ba4f){if(!_[_0x9015('0x16')](_0x4b2a3b)){if(_0x4b2a3b['pTalking']>0x0){_0x4b2a3b[_0x9015('0x60')]-=0x1;}else{logger[_0x9015('0x7')](_0x59ba4f,_0x9015('0x61'));}}else{logger[_0x9015('0x7')](_0x59ba4f,_0x9015('0x62'));}};exports[_0x9015('0x63')]=function(_0x59271e){if(_0x59271e<=0x0){return!![];}return![];};function buildObj(_0x1e164c,_0x2cea5b,_0xe6830f){_0x1e164c[_0x9015('0x64')]=_0x2cea5b;_0x1e164c[_0x9015('0x65')]=_0x1e164c[_0x9015('0x66')];_0x1e164c['interface']=_0x1e164c[_0x9015('0x4d')];_0x1e164c[_0x9015('0x67')]=_0x9015('0x68');if(_0xe6830f){_0x1e164c['mandatoryDisposition']=_0xe6830f['mandatoryDisposition'];}return _0x1e164c;}exports[_0x9015('0x69')]=buildObj;exports['buildAcw']=function(_0x35f85b){var _0x58e6da={};_0x58e6da[_0x9015('0x66')]=_0x35f85b['queue'];_0x58e6da[_0x9015('0x6a')]=_0x35f85b[_0x9015('0x4d')];_0x58e6da[_0x9015('0x4b')]=_0x35f85b['uniqueid'];return _0x58e6da;};exports['agentReadyId']=function(_0x2c8ce4){var _0x505e47=[];for(var _0x56574b in _0x2c8ce4){if(_0x2c8ce4['hasOwnProperty'](_0x56574b)){if(!_['isNil'](_0x2c8ce4[_0x56574b])&&_0x2c8ce4[_0x56574b]['state']===_0x9015('0x6b')&&_0x2c8ce4[_0x56574b][_0x9015('0x6c')]===_0x9015('0x6d')){_0x505e47[_0x9015('0x6e')](_0x2c8ce4[_0x56574b]['id']);}}}return _0x505e47;};exports[_0x9015('0x6f')]=function(_0x504792){var _0x16afdb=moment()['milliseconds'](0x0);var _0x4be8cd=moment(_0x504792)[_0x9015('0x70')](0x0);return _0x16afdb[_0x9015('0x71')](_0x4be8cd,_0x9015('0x72'));};exports[_0x9015('0x73')]=function(_0xad35a6){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0xad35a6[_0x9015('0x1b')],'ListId':_0xad35a6['ListId'],'VoiceQueueId':_0xad35a6['VoiceQueueId']||undefined,'CampaignId':_0xad35a6['CampaignId']||undefined};};exports[_0x9015('0x74')]=function(_0x27b2da){if(_0x27b2da===_0x9015('0x4b')||_0x27b2da===_0x9015('0x75')||_0x27b2da==='queue'||_0x27b2da==='type'||_0x27b2da==='campaigntype'||_0x27b2da===_0x9015('0x76')||_0x27b2da===_0x9015('0x42')||_0x27b2da===_0x9015('0x4d')||_0x27b2da===_0x9015('0x19')||_0x27b2da==='active'||_0x27b2da===_0x9015('0x1a')||_0x27b2da==='scheduledat'||_0x27b2da==='countbusyretry'||_0x27b2da==='countcongestionretry'||_0x27b2da==='countnoanswerretry'||_0x27b2da==='countglobal'||_0x27b2da===_0x9015('0x77')||_0x27b2da===_0x9015('0x78')||_0x27b2da===_0x9015('0x79')||_0x27b2da===_0x9015('0x7a')||_0x27b2da===_0x9015('0x1b')||_0x27b2da===_0x9015('0x5d')||_0x27b2da===_0x9015('0x43')||_0x27b2da===_0x9015('0x5e')||_0x27b2da===_0x9015('0x7b')||_0x27b2da==='xmd-voicequeueid'||_0x27b2da===_0x9015('0x7c')||_0x27b2da==='xmd-phone'||_0x27b2da===_0x9015('0x7d')||_0x27b2da==='xmd-dialurl'||_0x27b2da===_0x9015('0x7e')||_0x27b2da===_0x9015('0x7f')||_0x27b2da===_0x9015('0x80')||_0x27b2da===_0x9015('0x81')||_0x27b2da==='xmd-contactid'||_0x27b2da==='xmd-cdrtype'||_0x27b2da===_0x9015('0x82')||_0x27b2da==='xmd-agiafter'||_0x27b2da===_0x9015('0x83')||_0x27b2da===_0x9015('0x84')||_0x27b2da===_0x9015('0x85')||_0x27b2da===_0x9015('0x86')||_0x27b2da===_0x9015('0x87')||_0x27b2da===_0x9015('0x88')||_0x27b2da===_0x9015('0x89')||_0x27b2da===_0x9015('0x8a')||_0x27b2da==='rtpaudioqosrttbridged'||_0x27b2da==='rtpaudioqos'||_0x27b2da==='rtpaudioqosbridged'||_0x27b2da===_0x9015('0x86')||_0x27b2da===_0x9015('0x87')||_0x27b2da===_0x9015('0x88')||_0x27b2da===_0x9015('0x89')||_0x27b2da===_0x9015('0x8a')||_0x27b2da==='rtpaudioqosrttbridged'||_0x27b2da==='bridgepeer'||_0x27b2da===_0x9015('0x8b')||_0x27b2da===_0x9015('0x39')||_0x27b2da===_0x9015('0x3e')){return![];}return!![];};exports[_0x9015('0x8c')]=function(_0x3776b3,_0x52b910){var _0x2e751a,_0x2ffdd3,_0x27d6ab;if(_0x52b910<=0x0){_0x52b910=0x1;}_0x2e751a=new RegExp('\x5cw{0,'+_0x52b910+'}$');_0x2ffdd3=Math[_0x9015('0x8d')](0xa,_0x52b910-0x1);_0x27d6ab=Math[_0x9015('0x8d')](0xa,_0x52b910)-0x1;return util['format']('%s',_[_0x9015('0x8e')](_0x3776b3,_0x2e751a,_[_0x9015('0x8f')](_0x2ffdd3,_0x27d6ab)));};exports['extractCalleridName']=function(_0x5bded0){var _0x3ebb7f=_0x5bded0[_0x9015('0x90')](/"(.*?)"/);return _0x3ebb7f?_0x3ebb7f[0x1]:_0x5bded0;};exports[_0x9015('0x91')]=function(_0x19648f){var _0xf76756=_0x19648f['match'](/<(.*?)>/);return _0xf76756?_0xf76756[0x1]:_0x19648f;};function buildNoAnswerEventPayload(_0x5c5d5a,_0x430569){var _0xdcb038=buildObj(_0x5c5d5a,_0x9015('0x92'));if(!_[_0x9015('0x11')](_0x430569[_0x9015('0x93')])){Object['keys'](_0x430569[_0x9015('0x93')])['forEach'](function(_0x3e8852){_0xdcb038[_0x3e8852[_0x9015('0x94')]()]=_0x430569['variables'][_0x3e8852];});}return _0xdcb038;}exports[_0x9015('0x95')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x0116=['calleridnum','ContactId','dialer','dialOriginateTimeout','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','XMD-','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','state','Blacklist','starttime','logAgent','YYYY-MM-DD\x20HH:mm:ss','statedesc','ringtime','logLookAgent','membername','UserId','logCustomer','responsetime','endtime','getSeconds','talktime','isFailure','variablesAction','RECALL','BOOKED','uniqueid','channelAgent','from-sip','timeout','countbusyretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','add','minutes','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','interface','motionChannel','voice','mandatoryDisposition','buildObj','queue','status','push','getDiff','milliseconds','CampaignId','idContact','type','campaigntype','dialAnswer','scheduledat','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','noanswer','variables','keys','forEach','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','loggerCatch','error','inspect','logger','loggerError','logger2','info','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname'];(function(_0x7275e9,_0x321fa5){var _0x17b99d=function(_0x54af41){while(--_0x54af41){_0x7275e9['push'](_0x7275e9['shift']());}};_0x17b99d(++_0x321fa5);}(_0x0116,0x10b));var _0x6011=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x0116[_0x49b207];return _0x2dc8fa;};'use strict';var util=require(_0x6011('0x0'));var _=require(_0x6011('0x1'));var moment=require(_0x6011('0x2'));var logger=require(_0x6011('0x3'))(_0x6011('0x4'));var ipAgi=process[_0x6011('0x5')][_0x6011('0x6')]||_0x6011('0x7');var utils=require('../../dialer/utils');exports[_0x6011('0x8')]=function(_0x5693d2){return function(_0x369c10){logger[_0x6011('0x9')](_0x5693d2,util[_0x6011('0xa')](_0x369c10,{'showHidden':![],'depth':null}));};};exports[_0x6011('0xb')]=function(_0x583d76,_0x403dc0){logger['info'](_0x583d76,util[_0x6011('0xa')](_0x403dc0,{'showHidden':![],'depth':null}));};exports[_0x6011('0xc')]=function(_0x39d855,_0x49b41a){logger[_0x6011('0x9')](_0x39d855,util['inspect'](_0x49b41a,{'showHidden':![],'depth':null}));};exports[_0x6011('0xd')]=function(_0x3eaa50){return function(_0x35c2ec){logger[_0x6011('0xe')](_0x3eaa50,util[_0x6011('0xa')](_0x35c2ec,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x21fa75,_0x37b7c3,_0x24a26d){return{'message':_0x21fa75,'unlock':_0x37b7c3,'active':_0x24a26d};};exports['getCallerId']=function(_0x5a44ce,_0x1bf106,_0x5c421c){if(!_[_0x6011('0xf')](_0x5c421c)&&_0x6011('0x10')===typeof _0x5c421c&&!_['isEmpty'](_0x5c421c)){if(!_[_0x6011('0xf')](_0x1bf106)&&'string'===typeof _0x1bf106&&!_[_0x6011('0x11')](_0x1bf106)){return util[_0x6011('0x12')](_0x6011('0x13'),_0x1bf106,_0x5c421c);}return util[_0x6011('0x12')](_0x6011('0x13'),_0x5c421c,_0x5c421c);}if(!_[_0x6011('0xf')](_0x5a44ce)&&_0x6011('0x10')===typeof _0x5a44ce&&!_[_0x6011('0x11')](_0x5a44ce)){return _0x5a44ce;}return _0x6011('0x14');};exports[_0x6011('0x15')]=function(_0x57e8f6){if(_[_0x6011('0x16')](_0x57e8f6)){return![];}return _0x57e8f6;};exports[_0x6011('0x17')]=function(_0x974523,_0x3331b1,_0x29c2ff,_0x1b5629,_0x108637,_0x4eae58){var _0x277156={'XMD-QUEUE':_0x3331b1['Queue']?_0x3331b1[_0x6011('0x18')][_0x6011('0x19')]:'','XMD-CALLERID':_0x1b5629,'XMD-CALLERID-PREVIEW':_0x4eae58?util['format']('\x22%s\x22\x20<%s>',_0x4eae58[_0x6011('0x1a')],_0x4eae58[_0x6011('0x1b')]):_0x1b5629,'XMD-DIALID':_0x108637,'XMD-CONTACTID':_0x3331b1[_0x6011('0x1c')],'XMD-CDRTYPE':_0x6011('0x1d'),'CALLERID(all)':_0x1b5629,'XMD-VOICEQUEUEID':_0x3331b1['VoiceQueueId'],'XMD-DIALCHANNEL':_0x29c2ff,'XMD-DIALTIMEOUT':_0x974523[_0x6011('0x1e')]||0x1e,'XMD-DIALOPTIONS':util[_0x6011('0x12')]('\x22rtTxX%s%s\x22',_0x974523[_0x6011('0x1f')]?'g':'',_[_0x6011('0x11')](_0x974523[_0x6011('0x20')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x974523[_0x6011('0x21')]||'','XMD-AGI':_0x974523['dialQueueProject']?util[_0x6011('0x12')]('\x22agi://%s/square,%s\x22',ipAgi,_0x974523[_0x6011('0x22')]):_0x6011('0x23'),'XMD-AGIAFTER':_0x974523['dialQueueProject2']?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x974523['dialQueueProject2']):_0x6011('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x4eae58?_0x4eae58[_0x6011('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x4eae58?_0x4eae58[_0x6011('0x25')]:'','XMD-DESTINATION':_0x6011('0x26'),'SIPADDHEADER':_0x6011('0x27')};if(!_['isEmpty'](_0x974523[_0x6011('0x20')])){_0x277156[util[_0x6011('0x12')]('%s',_0x6011('0x28'))]=_0x974523[_0x6011('0x20')];_0x277156[util[_0x6011('0x12')]('%s',_0x6011('0x29'))]=_0x108637;}if(_0x3331b1&&_0x3331b1['Contact']){for(var _0x5df31f in _0x3331b1[_0x6011('0x2a')]){if(_0x3331b1[_0x6011('0x2a')][_0x6011('0x2b')](_0x5df31f)){if(!_['isNil'](_0x3331b1[_0x6011('0x2a')][_0x5df31f])&&_0x5df31f!=='id'&&_0x5df31f!==_0x6011('0x2c')&&_0x5df31f!==_0x6011('0x2d')&&_0x5df31f!==_0x6011('0x2e')){_0x277156[util[_0x6011('0x12')](_0x6011('0x2f'),_0x6011('0x30'),_['toUpper'](_0x5df31f))]=_0x3331b1[_0x6011('0x2a')][_0x5df31f];}}}}return _0x277156;};exports[_0x6011('0x31')]=function(_0x2e6272){var _0x85f1a7={};for(var _0x4b4165 in _0x2e6272){if(_0x2e6272[_0x6011('0x2b')](_0x4b4165)){_0x85f1a7[util[_0x6011('0x12')]('%s',_[_0x6011('0x32')](_0x4b4165))]=_0x2e6272[_0x4b4165];}}return{'variables':_0x85f1a7};};exports[_0x6011('0x33')]=function(_0x59b4e8,_0x3542b5){if(!_[_0x6011('0x16')](_0x59b4e8)){if(_0x59b4e8[_0x6011('0x2b')](_0x6011('0x34'))){if(_0x59b4e8[_0x6011('0x34')]>0x0){_0x59b4e8[_0x6011('0x34')]-=0x1;}else{logger[_0x6011('0x9')](_0x6011('0x35'),_0x3542b5);}}}else{logger[_0x6011('0x9')](_0x6011('0x36'),_0x3542b5);}};exports[_0x6011('0x37')]=function(_0x559cd9){var _0x30b0d8=moment()[_0x6011('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x559cd9[_0x6011('0x38')]=0xd;_0x559cd9['statedesc']=_0x6011('0x39');_0x559cd9[_0x6011('0x3a')]=_0x30b0d8;_0x559cd9['responsetime']=_0x30b0d8;_0x559cd9['endtime']=_0x30b0d8;};exports[_0x6011('0x3b')]=function(_0x5c0c2f,_0x1f5a86,_0x27ea28){var _0x33b918=moment()[_0x6011('0x12')](_0x6011('0x3c'));_0x5c0c2f[_0x6011('0x38')]=_0x1f5a86;_0x5c0c2f[_0x6011('0x3d')]=_0x27ea28;_0x5c0c2f['responsetime']=_0x33b918;_0x5c0c2f[_0x6011('0x3e')]=utils['getSeconds'](_0x5c0c2f['responsetime'],_0x5c0c2f['starttime']);};exports[_0x6011('0x3f')]=function(_0x48387a,_0x5c4eef,_0x3a11f4){_0x48387a[_0x6011('0x40')]=_0x5c4eef;_0x48387a[_0x6011('0x41')]=_0x3a11f4;};exports[_0x6011('0x42')]=function(_0x54739a,_0x3e6bd4,_0x5ee57a){var _0x123ed5=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x54739a[_0x6011('0x38')]=_0x3e6bd4;_0x54739a[_0x6011('0x3d')]=_0x5ee57a;_0x54739a[_0x6011('0x43')]=_0x54739a[_0x6011('0x43')]?_0x54739a[_0x6011('0x43')]:_0x123ed5;_0x54739a[_0x6011('0x44')]=_0x54739a['endtime']?_0x54739a[_0x6011('0x44')]:_0x123ed5;_0x54739a['ringtime']=utils[_0x6011('0x45')](_0x54739a[_0x6011('0x43')]||0x0,_0x54739a[_0x6011('0x3a')]||0x0);_0x54739a[_0x6011('0x46')]=_0x54739a['answertime']?utils[_0x6011('0x45')](_0x54739a[_0x6011('0x44')],_0x54739a['answertime']):0x0;};exports[_0x6011('0x47')]=function(_0x453ca8){return _0x453ca8==='Failure';};exports[_0x6011('0x48')]=function(_0x6f6ae7,_0x2f07d1,_0x917230,_0x986384,_0x5b647b){var _0x5393a1=_0x986384?_0x6011('0x49'):_0x6f6ae7['calleridname'];_0x5393a1=_0x5b647b?_0x6011('0x4a'):_0x5393a1;return{'actionid':_0x6f6ae7[_0x6011('0x4b')],'action':'originate','channel':_0x6f6ae7[_0x6011('0x4c')],'callerid':util[_0x6011('0x12')](_0x6011('0x13'),_0x5393a1,_0x6f6ae7[_0x6011('0x1b')]),'Exten':_0x6011('0x26'),'Context':_0x6011('0x4d'),'Priority':'1','variable':_0x917230,'timeout':(_0x2f07d1[_0x6011('0x4e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x6f6ae7['uniqueid']};};exports['totalGlobal']=function(_0x104f94){return _0x104f94[_0x6011('0x4f')]+_0x104f94['countcongestionretry']+_0x104f94[_0x6011('0x50')]+_0x104f94[_0x6011('0x51')]+_0x104f94[_0x6011('0x52')];};exports[_0x6011('0x53')]=function(_0x4dde2f){var _0x39739c=_[_0x6011('0x54')](_0x4dde2f);_0x39739c['state']=0xf;_0x39739c[_0x6011('0x3d')]=_0x6011('0x55');return _0x39739c;};exports[_0x6011('0x56')]=function(_0x9dec6c,_0x540867,_0x14f7c2){var _0x58e6c8={};_0x58e6c8[_0x540867]=_0x9dec6c[_0x540867];_0x58e6c8[_0x6011('0x57')]=![];_0x58e6c8['scheduledat']=moment()[_0x6011('0x58')](_0x14f7c2,_0x6011('0x59'))[_0x6011('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x58e6c8['ContactId']=_0x9dec6c[_0x6011('0x1c')];_0x58e6c8['ListId']=_0x9dec6c[_0x6011('0x5a')];_0x58e6c8[_0x6011('0x5b')]=_0x9dec6c[_0x6011('0x5b')]||undefined;return _0x58e6c8;};exports[_0x6011('0x5c')]=function(_0x30ba65,_0x504653){if(!_['isNil'](_0x30ba65)){if(_0x30ba65[_0x6011('0x5d')]>0x0){_0x30ba65['pTalking']-=0x1;}else{logger[_0x6011('0x9')](_0x504653,_0x6011('0x5e'));}}else{logger['error'](_0x504653,_0x6011('0x5f'));}};exports[_0x6011('0x60')]=function(_0x3df8a5){if(_0x3df8a5<=0x0){return!![];}return![];};function buildObj(_0x77c159,_0x16b761,_0x4e1cdc){_0x77c159[_0x6011('0x61')]=_0x16b761;_0x77c159['name']=_0x77c159['queue'];_0x77c159[_0x6011('0x62')]=_0x77c159[_0x6011('0x4c')];_0x77c159[_0x6011('0x63')]=_0x6011('0x64');if(_0x4e1cdc){_0x77c159[_0x6011('0x65')]=_0x4e1cdc['mandatoryDisposition'];}return _0x77c159;}exports[_0x6011('0x66')]=buildObj;exports['buildAcw']=function(_0x36a297){var _0x127a02={};_0x127a02['queue']=_0x36a297[_0x6011('0x67')];_0x127a02[_0x6011('0x62')]=_0x36a297[_0x6011('0x4c')];_0x127a02[_0x6011('0x4b')]=_0x36a297[_0x6011('0x4b')];return _0x127a02;};exports['agentReadyId']=function(_0x1dec12){var _0x39a811=[];for(var _0x3e0741 in _0x1dec12){if(_0x1dec12[_0x6011('0x2b')](_0x3e0741)){if(!_[_0x6011('0x16')](_0x1dec12[_0x3e0741])&&_0x1dec12[_0x3e0741][_0x6011('0x38')]==='not_inuse'&&_0x1dec12[_0x3e0741][_0x6011('0x68')]==='reachable'){_0x39a811[_0x6011('0x69')](_0x1dec12[_0x3e0741]['id']);}}}return _0x39a811;};exports[_0x6011('0x6a')]=function(_0x3714aa){var _0x20ceac=moment()[_0x6011('0x6b')](0x0);var _0x2efa4b=moment(_0x3714aa)[_0x6011('0x6b')](0x0);return _0x20ceac['diff'](_0x2efa4b,'seconds');};exports['createBody']=function(_0x72343a){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x72343a['ContactId'],'ListId':_0x72343a[_0x6011('0x5a')],'VoiceQueueId':_0x72343a[_0x6011('0x5b')]||undefined,'CampaignId':_0x72343a[_0x6011('0x6c')]||undefined};};exports['filterKey']=function(_0x210d62){if(_0x210d62==='uniqueid'||_0x210d62===_0x6011('0x6d')||_0x210d62===_0x6011('0x67')||_0x210d62===_0x6011('0x6e')||_0x210d62===_0x6011('0x6f')||_0x210d62===_0x6011('0x70')||_0x210d62===_0x6011('0x40')||_0x210d62==='channelAgent'||_0x210d62===_0x6011('0x1a')||_0x210d62===_0x6011('0x57')||_0x210d62===_0x6011('0x1b')||_0x210d62===_0x6011('0x71')||_0x210d62==='countbusyretry'||_0x210d62==='countcongestionretry'||_0x210d62===_0x6011('0x50')||_0x210d62===_0x6011('0x72')||_0x210d62===_0x6011('0x73')||_0x210d62===_0x6011('0x74')||_0x210d62===_0x6011('0x75')||_0x210d62===_0x6011('0x76')||_0x210d62===_0x6011('0x1c')||_0x210d62===_0x6011('0x5a')||_0x210d62===_0x6011('0x41')||_0x210d62===_0x6011('0x5b')||_0x210d62===_0x6011('0x77')||_0x210d62===_0x6011('0x78')||_0x210d62==='xmd-queue'||_0x210d62==='xmd-phone'||_0x210d62==='xmd-listid'||_0x210d62===_0x6011('0x79')||_0x210d62==='xmd-dialtimeout'||_0x210d62===_0x6011('0x7a')||_0x210d62===_0x6011('0x7b')||_0x210d62===_0x6011('0x7c')||_0x210d62===_0x6011('0x7d')||_0x210d62==='xmd-cdrtype'||_0x210d62==='xmd-callerid'||_0x210d62===_0x6011('0x7e')||_0x210d62==='xmd-agi'||_0x210d62===_0x6011('0x7f')||_0x210d62===_0x6011('0x80')||_0x210d62===_0x6011('0x81')||_0x210d62==='rtpaudioqosjitterbridged'||_0x210d62===_0x6011('0x82')||_0x210d62==='rtpaudioqoslossbridged'||_0x210d62===_0x6011('0x83')||_0x210d62===_0x6011('0x84')||_0x210d62===_0x6011('0x7f')||_0x210d62===_0x6011('0x80')||_0x210d62===_0x6011('0x81')||_0x210d62===_0x6011('0x85')||_0x210d62===_0x6011('0x82')||_0x210d62===_0x6011('0x86')||_0x210d62==='rtpaudioqosrtt'||_0x210d62===_0x6011('0x84')||_0x210d62===_0x6011('0x87')||_0x210d62==='bridgepvtcallid'||_0x210d62===_0x6011('0x38')||_0x210d62==='statedesc'){return![];}return!![];};exports[_0x6011('0x88')]=function(_0x3abe4d,_0x579755){var _0x2a3c8f,_0x3f55a7,_0x19e695;if(_0x579755<=0x0){_0x579755=0x1;}_0x2a3c8f=new RegExp(_0x6011('0x89')+_0x579755+'}$');_0x3f55a7=Math['pow'](0xa,_0x579755-0x1);_0x19e695=Math[_0x6011('0x8a')](0xa,_0x579755)-0x1;return util[_0x6011('0x12')]('%s',_[_0x6011('0x8b')](_0x3abe4d,_0x2a3c8f,_[_0x6011('0x8c')](_0x3f55a7,_0x19e695)));};exports[_0x6011('0x8d')]=function(_0xc3752d){var _0x1bff48=_0xc3752d['match'](/"(.*?)"/);return _0x1bff48?_0x1bff48[0x1]:_0xc3752d;};exports['extractCalleridNumber']=function(_0x2acd95){var _0x13dbe9=_0x2acd95['match'](/<(.*?)>/);return _0x13dbe9?_0x13dbe9[0x1]:_0x2acd95;};function buildNoAnswerEventPayload(_0x30516f,_0x2882f4){var _0x46ca29=buildObj(_0x30516f,_0x6011('0x8e'));if(!_[_0x6011('0x11')](_0x2882f4[_0x6011('0x8f')])){Object[_0x6011('0x90')](_0x2882f4['variables'])[_0x6011('0x91')](function(_0x28eadd){_0x46ca29[_0x28eadd['toLowerCase']()]=_0x2882f4[_0x6011('0x8f')][_0x28eadd];});}return _0x46ca29;}exports[_0x6011('0x92')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index cfbe7e3..36ab947 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 _0x6fca=['queueremove','queuepause','boolean','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string','number'];(function(_0x2d9c22,_0x1bba87){var _0x24ab58=function(_0x207198){while(--_0x207198){_0x2d9c22['push'](_0x2d9c22['shift']());}};_0x24ab58(++_0x1bba87);}(_0x6fca,0x165));var _0xa6fc=function(_0x2ff1eb,_0x3039fc){_0x2ff1eb=_0x2ff1eb-0x0;var _0x3ff97b=_0x6fca[_0x2ff1eb];return _0x3ff97b;};'use strict';exports[_0xa6fc('0x0')]={'queue':{'type':_0xa6fc('0x1'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0xa6fc('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xa6fc('0x3')]={'queue':{'type':_0xa6fc('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0xa6fc('0x4')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0xa6fc('0x5')},'reason':{'type':'string','required':![]}};exports[_0xa6fc('0x6')]={'module':{'type':_0xa6fc('0x1'),'required':![]}};exports[_0xa6fc('0x7')]={'uniqueid':{'type':_0xa6fc('0x1'),'required':!![]}};exports[_0xa6fc('0x8')]={'uniqueid':{'type':_0xa6fc('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0xa6fc('0x1')},'mixmonitorid':{'type':_0xa6fc('0x1')}};exports[_0xa6fc('0x9')]={'uniqueid':{'type':'string','required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xa6fc('0x1'),'required':!![]},'exten':{'type':_0xa6fc('0x1'),'required':!![]},'context':{'type':_0xa6fc('0x1')}}; \ No newline at end of file +var _0x62c8=['number','boolean','queueremove','string','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelredirect','queueadd'];(function(_0x39947f,_0x5787a6){var _0x415d92=function(_0x148fcd){while(--_0x148fcd){_0x39947f['push'](_0x39947f['shift']());}};_0x415d92(++_0x5787a6);}(_0x62c8,0x153));var _0x862c=function(_0x139893,_0x170faa){_0x139893=_0x139893-0x0;var _0xa4885b=_0x62c8[_0x139893];return _0xa4885b;};'use strict';exports[_0x862c('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x862c('0x1'),'required':![]},'paused':{'type':_0x862c('0x2'),'required':![]}};exports[_0x862c('0x3')]={'queue':{'type':_0x862c('0x4'),'required':!![]},'interface':{'type':_0x862c('0x4'),'required':!![]}};exports[_0x862c('0x5')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0x862c('0x2')},'reason':{'type':'string','required':![]}};exports[_0x862c('0x6')]={'module':{'type':_0x862c('0x4'),'required':![]}};exports[_0x862c('0x7')]={'uniqueid':{'type':_0x862c('0x4'),'required':!![]}};exports[_0x862c('0x8')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x862c('0x4')},'format':{'type':_0x862c('0x4')},'mixmonitorid':{'type':_0x862c('0x4')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0x862c('0x4'),'required':!![]}};exports[_0x862c('0x9')]={'uniqueid':{'type':_0x862c('0x4'),'required':!![]},'exten':{'type':_0x862c('0x4'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index a6980f8..5421c18 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 _0xb10b=['../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','triggers','campaigns','templates','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','SIP/%s','name','interface','format','total','answered','sumHoldTime','sumDuration','ivrTotalCallsDays','isEmpty','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isNil','isUndefined','initTelephones','trunks','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initVoiceQueueHopperHistory','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','outbound','duration','billableseconds','initCampaigns','dialQueueProject','initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','lodash','util','../model/agent','../model/telephone','../model/voiceQueue','../model/trigger','../model/template','../model/campaign'];(function(_0x49347a,_0xd116a0){var _0x158715=function(_0x424c7f){while(--_0x424c7f){_0x49347a['push'](_0x49347a['shift']());}};_0x158715(++_0xd116a0);}(_0xb10b,0x12a));var _0xbb10=function(_0x1d8005,_0x272160){_0x1d8005=_0x1d8005-0x0;var _0x237dc6=_0xb10b[_0x1d8005];return _0x237dc6;};'use strict';var _=require(_0xbb10('0x0'));var moment=require('moment');var util=require(_0xbb10('0x1'));var Agent=require(_0xbb10('0x2'));var Telephone=require(_0xbb10('0x3'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0xbb10('0x4'));var Trigger=require(_0xbb10('0x5'));var Template=require(_0xbb10('0x6'));var Campaign=require(_0xbb10('0x7'));var VoiceExtension=require(_0xbb10('0x8'));var ZendeskAccount=require(_0xbb10('0x9'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xbb10('0xa'));var SugarcrmAccount=require(_0xbb10('0xb'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xbb10('0xc'));var VtigerAccount=require(_0xbb10('0xd'));var ServicenowAccount=require(_0xbb10('0xe'));var Dynamics365Account=require(_0xbb10('0xf'));var FreshsalesAccount=require(_0xbb10('0x10'));var FaxAccount=require(_0xbb10('0x11'));function Realtime(){this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['trunks']={};this['voiceQueues']={};this[_0xbb10('0x14')]={};this[_0xbb10('0x15')]={};this[_0xbb10('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xbb10('0x17')]={};this['channels']={};this[_0xbb10('0x18')]={};this[_0xbb10('0x19')]={};this[_0xbb10('0x1a')]={};this[_0xbb10('0x1b')]={};this[_0xbb10('0x1c')]={};this[_0xbb10('0x1d')]={};this['sugarcrmAccounts']={};this[_0xbb10('0x1e')]={};this[_0xbb10('0x1f')]={};this[_0xbb10('0x20')]={};this[_0xbb10('0x21')]={};this[_0xbb10('0x22')]={};this[_0xbb10('0x23')]={};this[_0xbb10('0x24')]={};this[_0xbb10('0x25')]={};}function freeIsNotKey(_0x3e26f4,_0x2b184e,_0x4a2bfc){var _0x2eca0f=_[_0xbb10('0x26')](_0x3e26f4,function(_0x133ac2){return _0x133ac2[_0x4a2bfc];});for(var _0x42db98 in _0x2b184e){if(_0x2b184e[_0xbb10('0x27')](_0x42db98)){if(!_0x2eca0f[_0x42db98]){delete _0x2b184e[_0x42db98];}}}}function freeIsNotKeySip(_0x1682a4,_0x575cca){var _0x30efc6=_[_0xbb10('0x26')](_0x1682a4,function(_0xe1c665){return util['format'](_0xbb10('0x28'),_0xe1c665[_0xbb10('0x29')]);});for(var _0x388fab in _0x575cca){if(_0x575cca[_0xbb10('0x27')](_0x388fab)){if(!_0x30efc6[_0x388fab]){delete _0x575cca[_0x388fab];}}}}function freeIsNotKeyAgent(_0xdf237d,_0x44e563){var _0x4deb49=_[_0xbb10('0x26')](_0xdf237d,function(_0x12ef77){var _0x50aea1=_['isNil'](_0x12ef77[_0xbb10('0x2a')])?util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x12ef77[_0xbb10('0x29')]):_0x12ef77[_0xbb10('0x2a')];return _0x50aea1;});for(var _0x1824b7 in _0x44e563){if(_0x44e563[_0xbb10('0x27')](_0x1824b7)){if(!_0x4deb49[_0x1824b7]){delete _0x44e563[_0x1824b7];}}}}function clearVoiceCallReports(_0x436104){_0x436104[_0xbb10('0x2c')]=0x0;_0x436104[_0xbb10('0x2d')]=0x0;_0x436104[_0xbb10('0x2e')]=0x0;_0x436104[_0xbb10('0x2f')]=0x0;_0x436104['sumBillable']=0x0;}function clearCampaigns(_0x4fedac){if(!_['isEmpty'](_0x4fedac)){for(var _0xc93a04 in _0x4fedac){if(_0x4fedac[_0xbb10('0x27')](_0xc93a04)){_0x4fedac[_0xc93a04][_0xbb10('0x30')]=0x0;_0x4fedac[_0xc93a04]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x2fdde9){if(!_[_0xbb10('0x31')](_0x2fdde9)){for(var _0x6ed43b in _0x2fdde9){if(_0x2fdde9[_0xbb10('0x27')](_0x6ed43b)){_0x2fdde9[_0x6ed43b][_0xbb10('0x2c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2d')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x32')]=0x0;_0x2fdde9[_0x6ed43b]['abandoned']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2e')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2f')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x33')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x34')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x35')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x36')]=0x0;_0x2fdde9[_0x6ed43b]['outboundCongestionCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x37')]=0x0;_0x2fdde9[_0x6ed43b]['outboundUnknownCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x38')]=0x0;_0x2fdde9[_0x6ed43b]['outboundDropCallsDayCallersExit']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x39')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3a')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3b')]=0x0;_0x2fdde9[_0x6ed43b]['outboundReCallsDay']=0x0;_0x2fdde9[_0x6ed43b]['outboundAnswerAgiCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3d')]=!![];}}}}Realtime['prototype'][_0xbb10('0x3e')]=function(_0x37dde7,_0x2f653f){for(var _0x1c0b57 in _0x2f653f){if(_0x37dde7[_0xbb10('0x27')](_0x1c0b57)){_0x37dde7[_0x1c0b57]=_0x2f653f[_0x1c0b57];}}};Realtime[_0xbb10('0x3f')][_0xbb10('0x40')]=function(){var _0x4975f5=this;return function(_0x25acb3){if(_0x25acb3){freeIsNotKeyAgent(_0x25acb3,_0x4975f5[_0xbb10('0x12')]);for(var _0x441d15=0x0,_0x8c1ce6={};_0x441d15<_0x25acb3[_0xbb10('0x41')];_0x441d15+=0x1){_0x8c1ce6=_0x25acb3[_0x441d15];var _0x9de708=_[_0xbb10('0x42')](_0x8c1ce6[_0xbb10('0x2a')])?util[_0xbb10('0x2b')]('SIP/%s',_0x8c1ce6[_0xbb10('0x29')]):_0x8c1ce6[_0xbb10('0x2a')];if(_[_0xbb10('0x43')](_0x4975f5[_0xbb10('0x12')][_0x9de708])){_0x4975f5['agents'][_0x9de708]=new Agent(_0x8c1ce6);}else{_0x4975f5[_0xbb10('0x3e')](_0x4975f5['agents'][_0x9de708],_0x8c1ce6);}}}return _0x4975f5['agents'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x44')]=function(){var _0x26e76a=this;return function(_0x120d21){if(_0x120d21){freeIsNotKeySip(_0x120d21,_0x26e76a[_0xbb10('0x13')]);for(var _0x29d11a=0x0,_0x547062={};_0x29d11a<_0x120d21[_0xbb10('0x41')];_0x29d11a+=0x1){_0x547062=_0x120d21[_0x29d11a];if(_[_0xbb10('0x43')](_0x26e76a['telephones'][util['format']('SIP/%s',_0x547062[_0xbb10('0x29')])])){_0x26e76a[_0xbb10('0x13')][util[_0xbb10('0x2b')]('SIP/%s',_0x547062[_0xbb10('0x29')])]=new Telephone(_0x547062);}else{_0x26e76a[_0xbb10('0x3e')](_0x26e76a[_0xbb10('0x13')][util['format'](_0xbb10('0x28'),_0x547062[_0xbb10('0x29')])],_0x547062);}}}return _0x26e76a[_0xbb10('0x13')];};};Realtime[_0xbb10('0x3f')]['initTrunks']=function(){var _0xd238e9=this;return function(_0x110eb5){if(_0x110eb5){freeIsNotKeySip(_0x110eb5,_0xd238e9['trunks']);for(var _0xe2040f=0x0,_0x2e3214={};_0xe2040f<_0x110eb5[_0xbb10('0x41')];_0xe2040f+=0x1){_0x2e3214=_0x110eb5[_0xe2040f];if(_[_0xbb10('0x43')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')]('SIP/%s',_0x2e3214[_0xbb10('0x29')])])){_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])]=new Trunk(_0x2e3214);}else{_0xd238e9[_0xbb10('0x3e')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])],_0x2e3214);}}}return _0xd238e9[_0xbb10('0x45')];};};Realtime[_0xbb10('0x3f')]['initTriggers']=function(){var _0x5d9a4f=this;return function(_0x38d78f){if(_0x38d78f){freeIsNotKey(_0x38d78f,_0x5d9a4f['triggers'],'id');for(var _0x318984=0x0,_0x180933={};_0x318984<_0x38d78f['length'];_0x318984+=0x1){_0x180933=_0x38d78f[_0x318984];if(_[_0xbb10('0x43')](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']])){_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']]=new Trigger(_0x180933);}else{_0x5d9a4f['mergeFromDatabase'](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']],_0x180933);}}}return _0x5d9a4f[_0xbb10('0x14')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x46')]=function(){var _0x36e1fa=this;return function(_0x19f94d){if(_0x19f94d){freeIsNotKey(_0x19f94d,_0x36e1fa[_0xbb10('0x16')],'id');for(var _0x3efa96=0x0,_0x205bb4={};_0x3efa96<_0x19f94d[_0xbb10('0x41')];_0x3efa96+=0x1){_0x205bb4=_0x19f94d[_0x3efa96];if(_[_0xbb10('0x43')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']])){_0x36e1fa['templates'][_0x205bb4['id']]=new Template(_0x205bb4);}else{_0x36e1fa[_0xbb10('0x3e')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']],_0x205bb4);}}}return _0x36e1fa['templates'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x47')]=function(){var _0x1a7df6=this;return function(_0x5a5226){if(_0x5a5226){freeIsNotKey(_0x5a5226,_0x1a7df6[_0xbb10('0x1c')],'id');for(var _0x39f0de=0x0,_0x3e06b0={};_0x39f0de<_0x5a5226['length'];_0x39f0de+=0x1){_0x3e06b0=_0x5a5226[_0x39f0de];if(_['isUndefined'](_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']])){_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']]=new ZendeskAccount(_0x3e06b0);}else{_0x1a7df6[_0xbb10('0x3e')](_0x1a7df6['zendeskAccounts'][_0x3e06b0['id']],_0x3e06b0);}}}return _0x1a7df6['zendeskAccounts'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x48')]=function(){var _0x1bd054=this;return function(_0xf820fe){if(_0xf820fe){freeIsNotKey(_0xf820fe,_0x1bd054[_0xbb10('0x1d')],'id');for(var _0x22b315=0x0,_0x2f2552={};_0x22b315<_0xf820fe[_0xbb10('0x41')];_0x22b315+=0x1){_0x2f2552=_0xf820fe[_0x22b315];if(_[_0xbb10('0x43')](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']])){_0x1bd054['salesforceAccounts'][_0x2f2552['id']]=new SalesforceAccount(_0x2f2552);}else{_0x1bd054['mergeFromDatabase'](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']],_0x2f2552);}}}return _0x1bd054[_0xbb10('0x1d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x49')]=function(){var _0x36aa7d=this;return function(_0x440f9e){if(_0x440f9e){freeIsNotKey(_0x440f9e,_0x36aa7d[_0xbb10('0x1e')],'id');for(var _0x445870=0x0,_0x1c0d8f={};_0x445870<_0x440f9e[_0xbb10('0x41')];_0x445870+=0x1){_0x1c0d8f=_0x440f9e[_0x445870];if(_[_0xbb10('0x43')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']])){_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']]=new FreshdeskAccount(_0x1c0d8f);}else{_0x36aa7d[_0xbb10('0x3e')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']],_0x1c0d8f);}}}return _0x36aa7d['freshdeskAccounts'];};};Realtime[_0xbb10('0x3f')]['initZohoAccounts']=function(){var _0x33d60a=this;return function(_0x2e21a0){if(_0x2e21a0){freeIsNotKey(_0x2e21a0,_0x33d60a[_0xbb10('0x1f')],'id');for(var _0x3f27ce=0x0,_0x26e66e={};_0x3f27ce<_0x2e21a0[_0xbb10('0x41')];_0x3f27ce+=0x1){_0x26e66e=_0x2e21a0[_0x3f27ce];if(_[_0xbb10('0x43')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']])){_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']]=new ZohoAccount(_0x26e66e);}else{_0x33d60a[_0xbb10('0x3e')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']],_0x26e66e);}}}return _0x33d60a[_0xbb10('0x1f')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4a')]=function(){var _0x4475e1=this;return function(_0x5de0cc){if(_0x5de0cc){freeIsNotKey(_0x5de0cc,_0x4475e1[_0xbb10('0x20')],'id');for(var _0x466eb7=0x0,_0x1b83a9={};_0x466eb7<_0x5de0cc[_0xbb10('0x41')];_0x466eb7+=0x1){_0x1b83a9=_0x5de0cc[_0x466eb7];if(_[_0xbb10('0x43')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']])){_0x4475e1['deskAccounts'][_0x1b83a9['id']]=new DeskAccount(_0x1b83a9);}else{_0x4475e1[_0xbb10('0x3e')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']],_0x1b83a9);}}}return _0x4475e1[_0xbb10('0x20')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4b')]=function(){var _0x22de7f=this;return function(_0x175872){if(_0x175872){freeIsNotKey(_0x175872,_0x22de7f[_0xbb10('0x4c')],'id');for(var _0x205e01=0x0,_0x40c4fb={};_0x205e01<_0x175872[_0xbb10('0x41')];_0x205e01+=0x1){_0x40c4fb=_0x175872[_0x205e01];if(_[_0xbb10('0x43')](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']])){_0x22de7f['sugarcrmAccounts'][_0x40c4fb['id']]=new SugarcrmAccount(_0x40c4fb);}else{_0x22de7f['mergeFromDatabase'](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']],_0x40c4fb);}}}return _0x22de7f[_0xbb10('0x4c')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4d')]=function(){var _0x5573bb=this;return function(_0x506498){if(_0x506498){freeIsNotKey(_0x506498,_0x5573bb[_0xbb10('0x21')],'id');for(var _0xaf2cc3=0x0,_0x410bef={};_0xaf2cc3<_0x506498[_0xbb10('0x41')];_0xaf2cc3+=0x1){_0x410bef=_0x506498[_0xaf2cc3];if(_[_0xbb10('0x43')](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']])){_0x5573bb[_0xbb10('0x21')][_0x410bef['id']]=new VtigerAccount(_0x410bef);}else{_0x5573bb['mergeFromDatabase'](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']],_0x410bef);}}}return _0x5573bb[_0xbb10('0x21')];};};Realtime['prototype']['initServicenowAccounts']=function(){var _0x5a231f=this;return function(_0x32c1e8){if(_0x32c1e8){freeIsNotKey(_0x32c1e8,_0x5a231f[_0xbb10('0x22')],'id');for(var _0x155dc5=0x0,_0x5bd1c0={};_0x155dc5<_0x32c1e8['length'];_0x155dc5+=0x1){_0x5bd1c0=_0x32c1e8[_0x155dc5];if(_['isUndefined'](_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']])){_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']]=new ServicenowAccount(_0x5bd1c0);}else{_0x5a231f[_0xbb10('0x3e')](_0x5a231f['servicenowAccounts'][_0x5bd1c0['id']],_0x5bd1c0);}}}return _0x5a231f[_0xbb10('0x22')];};};Realtime[_0xbb10('0x3f')]['initDynamics365Accounts']=function(){var _0x4a560c=this;return function(_0x27d7b9){if(_0x27d7b9){freeIsNotKey(_0x27d7b9,_0x4a560c[_0xbb10('0x23')],'id');for(var _0xd77753=0x0,_0x237246={};_0xd77753<_0x27d7b9['length'];_0xd77753+=0x1){_0x237246=_0x27d7b9[_0xd77753];if(_[_0xbb10('0x43')](_0x4a560c[_0xbb10('0x23')][_0x237246['id']])){_0x4a560c[_0xbb10('0x23')][_0x237246['id']]=new Dynamics365Account(_0x237246);}else{_0x4a560c['mergeFromDatabase'](_0x4a560c[_0xbb10('0x23')][_0x237246['id']],_0x237246);}}}return _0x4a560c[_0xbb10('0x23')];};};Realtime[_0xbb10('0x3f')]['initFreshsalesAccounts']=function(){var _0x2ca491=this;return function(_0x31e85e){if(_0x31e85e){freeIsNotKey(_0x31e85e,_0x2ca491[_0xbb10('0x24')],'id');for(var _0x37b65f=0x0,_0x5e4a6e={};_0x37b65f<_0x31e85e[_0xbb10('0x41')];_0x37b65f+=0x1){_0x5e4a6e=_0x31e85e[_0x37b65f];if(_[_0xbb10('0x43')](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']])){_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']]=new FreshsalesAccount(_0x5e4a6e);}else{_0x2ca491['mergeFromDatabase'](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']],_0x5e4a6e);}}}return _0x2ca491[_0xbb10('0x24')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4e')]=function(){var _0x12f750=this;return function(_0x17807e){for(var _0x1e4694=0x0;_0x1e4694<_0x17807e['length'];_0x1e4694+=0x1){_['merge'](_0x12f750['voiceQueues'][_0x17807e[_0x1e4694][_0xbb10('0x29')]],_0x17807e[_0x1e4694]);}return _0x12f750[_0xbb10('0x4f')];};};Realtime[_0xbb10('0x3f')]['initVoiceQueueReports']=function(){var _0x5cd089=this;return function(_0x46f462){clearVoiceQueues(_0x5cd089[_0xbb10('0x4f')]);if(_0x46f462){_0x46f462=_[_0xbb10('0x50')](_0x46f462,_0xbb10('0x51'));for(var _0x260e06 in _0x46f462){if(_0x46f462[_0xbb10('0x27')](_0x260e06)){for(var _0x4cf2f3=0x0;_0x4cf2f3<_0x46f462[_0x260e06][_0xbb10('0x41')];_0x4cf2f3+=0x1){var _0x15fae2=_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x52')];if(_0x5cd089[_0xbb10('0x4f')][_0x15fae2]){if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x53')]){_0x5cd089['voiceQueues'][_0x15fae2]['unmanaged']+=0x1;}if(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerabandon']){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x54')]+=0x1;}_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;if(_0x4cf2f3===_0x46f462[_0x260e06]['length']-0x1){_0x5cd089['voiceQueues'][_0x15fae2]['sumDuration']+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x58')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x59')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5a')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;_0x5cd089['voiceQueues'][_0x15fae2]['total']+=0x1;if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5b')]){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2d')]+=0x1;_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x33')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallercompleteAt'])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')]),_0xbb10('0x57'))||0x0;}}else{_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2f')]+=_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]||0x0;}}}}}}return _0x5cd089['voiceQueues'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x5c')]=function(){var _0x30f3ea=this;return function(_0x322b41){clearVoiceCallReports(_0x30f3ea[_0xbb10('0x5d')]);if(_0x322b41){for(var _0x172be3=0x0;_0x172be3<_0x322b41[_0xbb10('0x41')];_0x172be3+=0x1){_0x30f3ea[_0xbb10('0x5d')]['total']+=0x1;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x2f')]+=_0x322b41[_0x172be3][_0xbb10('0x5e')];if(_0x322b41[_0x172be3]['disposition']==='ANSWERED'){_0x30f3ea['outbound'][_0xbb10('0x2d')]+=0x1;_0x30f3ea['outbound']['sumHoldTime']+=_0x322b41[_0x172be3][_0xbb10('0x5e')]-_0x322b41[_0x172be3][_0xbb10('0x5f')]||0x0;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x33')]+=_0x322b41[_0x172be3][_0xbb10('0x5f')];}}}return _0x30f3ea[_0xbb10('0x5d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x60')]=function(){var _0x188b97=this;return function(_0x5206e1){if(_0x5206e1){freeIsNotKey(_0x5206e1,_0x188b97[_0xbb10('0x15')],_0xbb10('0x29'));for(var _0x46b6d2=0x0,_0x35b811={};_0x46b6d2<_0x5206e1['length'];_0x46b6d2+=0x1){_0x35b811=_0x5206e1[_0x46b6d2];if(_['isUndefined'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]])){_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]]=new Campaign(_0x35b811);}else{_0x188b97['mergeFromDatabase'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]],_0x35b811);_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]][_0xbb10('0x61')]=_0x35b811['SquareProject']?_0x35b811['SquareProject'][_0xbb10('0x29')]:undefined;}}}return _0x188b97[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')]['initVoiceExtensions']=function(){var _0x256b35=this;return function(_0x13e2ab){if(_0x13e2ab){freeIsNotKey(_0x13e2ab,_0x256b35['voiceExtensions'],'id');for(var _0x5caa06=0x0,_0x2f667f={};_0x5caa06<_0x13e2ab[_0xbb10('0x41')];_0x5caa06+=0x1){_0x2f667f=_0x13e2ab[_0x5caa06];if(_[_0xbb10('0x43')](_0x256b35['voiceExtensions'][_0x2f667f['id']])){_0x256b35[_0xbb10('0x17')][_0x2f667f['id']]=new VoiceExtension(_0x2f667f);}else{_0x256b35[_0xbb10('0x3e')](_0x256b35[_0xbb10('0x17')][_0x2f667f['id']],_0x2f667f);}}}return _0x256b35[_0xbb10('0x17')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x62')]=function(){var _0x45bd4e=this;return function(_0x226363){clearCampaigns(_0x45bd4e[_0xbb10('0x15')]);for(var _0x479d51=0x0;_0x479d51<_0x226363[_0xbb10('0x41')];_0x479d51+=0x1){_[_0xbb10('0x63')](_0x45bd4e[_0xbb10('0x15')][_0x226363[_0x479d51][_0xbb10('0x29')]],_0x226363[_0x479d51]);}return _0x45bd4e[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x64')]=function(){var _0x305d52=this;return function(_0x17ed20){if(_0x17ed20){freeIsNotKey(_0x17ed20,_0x305d52[_0xbb10('0x25')],'id');for(var _0x15e043=0x0,_0x2a4278={};_0x15e043<_0x17ed20['length'];_0x15e043+=0x1){_0x2a4278=_0x17ed20[_0x15e043];if(_['isUndefined'](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']])){_0x305d52[_0xbb10('0x25')][_0x2a4278['id']]=new FaxAccount(_0x2a4278);}else{_0x305d52[_0xbb10('0x3e')](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']],_0x2a4278);}}}return _0x305d52[_0xbb10('0x25')];};};Realtime['prototype'][_0xbb10('0x65')]=function(){var _0x332fbe=this;return function(_0x3b4d0b){if(_0x3b4d0b){freeIsNotKey(_0x3b4d0b,_0x332fbe[_0xbb10('0x4f')],_0xbb10('0x29'));for(var _0x379d49=0x0,_0x546db5={};_0x379d49<_0x3b4d0b[_0xbb10('0x41')];_0x379d49+=0x1){_0x546db5=_0x3b4d0b[_0x379d49];if(_[_0xbb10('0x43')](_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]])){_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]]=new VoiceQueue(_0x546db5);}else{_0x332fbe[_0xbb10('0x3e')](_0x332fbe[_0xbb10('0x4f')][_0x546db5[_0xbb10('0x29')]],_0x546db5);}}}return _0x332fbe[_0xbb10('0x4f')];};};module['exports']=Realtime; \ No newline at end of file +var _0xadb5=['ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','initTelephones','length','isUndefined','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','queuecallerleaveAt','diff','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','queuecallercompleteAt','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','moment','../model/agent','../model/telephone','../model/trunk','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','campaigns','templates','outbound','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','mapKeys','name','hasOwnProperty','isNil','interface','format','SIP/%s','total','answered','sumHoldTime','sumDuration','isEmpty'];(function(_0x2b8474,_0x290408){var _0x4bcfad=function(_0x448832){while(--_0x448832){_0x2b8474['push'](_0x2b8474['shift']());}};_0x4bcfad(++_0x290408);}(_0xadb5,0xad));var _0x5adb=function(_0x15cbcb,_0x33fc3d){_0x15cbcb=_0x15cbcb-0x0;var _0x565622=_0xadb5[_0x15cbcb];return _0x565622;};'use strict';var _=require('lodash');var moment=require(_0x5adb('0x0'));var util=require('util');var Agent=require(_0x5adb('0x1'));var Telephone=require(_0x5adb('0x2'));var Trunk=require(_0x5adb('0x3'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x5adb('0x4'));var Template=require(_0x5adb('0x5'));var Campaign=require(_0x5adb('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x5adb('0x7'));var SalesforceAccount=require(_0x5adb('0x8'));var FreshdeskAccount=require(_0x5adb('0x9'));var SugarcrmAccount=require(_0x5adb('0xa'));var ZohoAccount=require(_0x5adb('0xb'));var DeskAccount=require(_0x5adb('0xc'));var VtigerAccount=require(_0x5adb('0xd'));var ServicenowAccount=require(_0x5adb('0xe'));var Dynamics365Account=require(_0x5adb('0xf'));var FreshsalesAccount=require(_0x5adb('0x10'));var FaxAccount=require(_0x5adb('0x11'));function Realtime(){this[_0x5adb('0x12')]={};this[_0x5adb('0x13')]={};this[_0x5adb('0x14')]={};this['voiceQueues']={};this['triggers']={};this[_0x5adb('0x15')]={};this[_0x5adb('0x16')]={};this[_0x5adb('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x5adb('0x18')]={};this['queueChannels']={};this[_0x5adb('0x19')]={};this['timers']={};this[_0x5adb('0x1a')]={};this[_0x5adb('0x1b')]={};this[_0x5adb('0x1c')]={};this['sugarcrmAccounts']={};this[_0x5adb('0x1d')]={};this[_0x5adb('0x1e')]={};this[_0x5adb('0x1f')]={};this['vtigerAccounts']={};this[_0x5adb('0x20')]={};this['dynamics365Accounts']={};this[_0x5adb('0x21')]={};this[_0x5adb('0x22')]={};}function freeIsNotKey(_0x30614e,_0x304784,_0x1c0f97){var _0x39d24d=_[_0x5adb('0x23')](_0x30614e,function(_0x42f4c6){return _0x42f4c6[_0x1c0f97];});for(var _0xb953a6 in _0x304784){if(_0x304784['hasOwnProperty'](_0xb953a6)){if(!_0x39d24d[_0xb953a6]){delete _0x304784[_0xb953a6];}}}}function freeIsNotKeySip(_0x3fff62,_0x5de028){var _0x1d9e86=_['mapKeys'](_0x3fff62,function(_0x3ef465){return util['format']('SIP/%s',_0x3ef465[_0x5adb('0x24')]);});for(var _0x1bed20 in _0x5de028){if(_0x5de028[_0x5adb('0x25')](_0x1bed20)){if(!_0x1d9e86[_0x1bed20]){delete _0x5de028[_0x1bed20];}}}}function freeIsNotKeyAgent(_0x1fd4a7,_0x99bc6c){var _0x5af69d=_[_0x5adb('0x23')](_0x1fd4a7,function(_0x5c296e){var _0x4e9f16=_[_0x5adb('0x26')](_0x5c296e[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x5c296e[_0x5adb('0x24')]):_0x5c296e[_0x5adb('0x27')];return _0x4e9f16;});for(var _0xfd9bb9 in _0x99bc6c){if(_0x99bc6c['hasOwnProperty'](_0xfd9bb9)){if(!_0x5af69d[_0xfd9bb9]){delete _0x99bc6c[_0xfd9bb9];}}}}function clearVoiceCallReports(_0x4b1957){_0x4b1957[_0x5adb('0x2a')]=0x0;_0x4b1957[_0x5adb('0x2b')]=0x0;_0x4b1957[_0x5adb('0x2c')]=0x0;_0x4b1957[_0x5adb('0x2d')]=0x0;_0x4b1957['sumBillable']=0x0;}function clearCampaigns(_0x2fee18){if(!_[_0x5adb('0x2e')](_0x2fee18)){for(var _0x5aed76 in _0x2fee18){if(_0x2fee18[_0x5adb('0x25')](_0x5aed76)){_0x2fee18[_0x5aed76][_0x5adb('0x2f')]=0x0;_0x2fee18[_0x5aed76][_0x5adb('0x30')]=0x0;}}}}function clearVoiceQueues(_0x55b40a){if(!_[_0x5adb('0x2e')](_0x55b40a)){for(var _0xbe21b1 in _0x55b40a){if(_0x55b40a[_0x5adb('0x25')](_0xbe21b1)){_0x55b40a[_0xbe21b1][_0x5adb('0x2a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x2b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x31')]=0x0;_0x55b40a[_0xbe21b1]['abandoned']=0x0;_0x55b40a[_0xbe21b1]['sumHoldTime']=0x0;_0x55b40a[_0xbe21b1]['sumDuration']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x32')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x34')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x35')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x36')]=0x0;_0x55b40a[_0xbe21b1]['outboundNoSuchCallsDay']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x37')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x38')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x39')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3c')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3d')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3e')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3f')]=!![];}}}}Realtime['prototype'][_0x5adb('0x40')]=function(_0x4c8b2e,_0x12424d){for(var _0x20cde6 in _0x12424d){if(_0x4c8b2e['hasOwnProperty'](_0x20cde6)){_0x4c8b2e[_0x20cde6]=_0x12424d[_0x20cde6];}}};Realtime[_0x5adb('0x41')][_0x5adb('0x42')]=function(){var _0x461a39=this;return function(_0x4a3661){if(_0x4a3661){freeIsNotKeyAgent(_0x4a3661,_0x461a39[_0x5adb('0x12')]);for(var _0x14cf00=0x0,_0x4b5887={};_0x14cf00<_0x4a3661['length'];_0x14cf00+=0x1){_0x4b5887=_0x4a3661[_0x14cf00];var _0x1ed9ea=_['isNil'](_0x4b5887[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x4b5887[_0x5adb('0x24')]):_0x4b5887[_0x5adb('0x27')];if(_['isUndefined'](_0x461a39[_0x5adb('0x12')][_0x1ed9ea])){_0x461a39[_0x5adb('0x12')][_0x1ed9ea]=new Agent(_0x4b5887);}else{_0x461a39[_0x5adb('0x40')](_0x461a39['agents'][_0x1ed9ea],_0x4b5887);}}}return _0x461a39['agents'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x43')]=function(){var _0x586820=this;return function(_0x2355bc){if(_0x2355bc){freeIsNotKeySip(_0x2355bc,_0x586820['telephones']);for(var _0x199d3b=0x0,_0x58cc5d={};_0x199d3b<_0x2355bc[_0x5adb('0x44')];_0x199d3b+=0x1){_0x58cc5d=_0x2355bc[_0x199d3b];if(_['isUndefined'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')]('SIP/%s',_0x58cc5d[_0x5adb('0x24')])])){_0x586820['telephones'][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])]=new Telephone(_0x58cc5d);}else{_0x586820['mergeFromDatabase'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])],_0x58cc5d);}}}return _0x586820[_0x5adb('0x13')];};};Realtime['prototype']['initTrunks']=function(){var _0x4f491a=this;return function(_0x599999){if(_0x599999){freeIsNotKeySip(_0x599999,_0x4f491a[_0x5adb('0x14')]);for(var _0x2fbe14=0x0,_0x3a104a={};_0x2fbe14<_0x599999[_0x5adb('0x44')];_0x2fbe14+=0x1){_0x3a104a=_0x599999[_0x2fbe14];if(_[_0x5adb('0x45')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])])){_0x4f491a['trunks'][util[_0x5adb('0x28')]('SIP/%s',_0x3a104a[_0x5adb('0x24')])]=new Trunk(_0x3a104a);}else{_0x4f491a[_0x5adb('0x40')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])],_0x3a104a);}}}return _0x4f491a[_0x5adb('0x14')];};};Realtime[_0x5adb('0x41')]['initTriggers']=function(){var _0x4160ad=this;return function(_0x1a256c){if(_0x1a256c){freeIsNotKey(_0x1a256c,_0x4160ad['triggers'],'id');for(var _0x120497=0x0,_0x407a4c={};_0x120497<_0x1a256c[_0x5adb('0x44')];_0x120497+=0x1){_0x407a4c=_0x1a256c[_0x120497];if(_[_0x5adb('0x45')](_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']])){_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']]=new Trigger(_0x407a4c);}else{_0x4160ad[_0x5adb('0x40')](_0x4160ad['triggers'][_0x407a4c['id']],_0x407a4c);}}}return _0x4160ad['triggers'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x47')]=function(){var _0x1cd0a3=this;return function(_0xb79d85){if(_0xb79d85){freeIsNotKey(_0xb79d85,_0x1cd0a3['templates'],'id');for(var _0x507e48=0x0,_0xaa32e4={};_0x507e48<_0xb79d85[_0x5adb('0x44')];_0x507e48+=0x1){_0xaa32e4=_0xb79d85[_0x507e48];if(_[_0x5adb('0x45')](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']])){_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']]=new Template(_0xaa32e4);}else{_0x1cd0a3['mergeFromDatabase'](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']],_0xaa32e4);}}}return _0x1cd0a3[_0x5adb('0x16')];};};Realtime['prototype'][_0x5adb('0x48')]=function(){var _0x251f45=this;return function(_0x1cdb03){if(_0x1cdb03){freeIsNotKey(_0x1cdb03,_0x251f45[_0x5adb('0x1b')],'id');for(var _0x186bd2=0x0,_0x3a5409={};_0x186bd2<_0x1cdb03[_0x5adb('0x44')];_0x186bd2+=0x1){_0x3a5409=_0x1cdb03[_0x186bd2];if(_[_0x5adb('0x45')](_0x251f45['zendeskAccounts'][_0x3a5409['id']])){_0x251f45[_0x5adb('0x1b')][_0x3a5409['id']]=new ZendeskAccount(_0x3a5409);}else{_0x251f45['mergeFromDatabase'](_0x251f45['zendeskAccounts'][_0x3a5409['id']],_0x3a5409);}}}return _0x251f45['zendeskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x49')]=function(){var _0x207a81=this;return function(_0x4ba0b5){if(_0x4ba0b5){freeIsNotKey(_0x4ba0b5,_0x207a81[_0x5adb('0x1c')],'id');for(var _0x5cbab5=0x0,_0x177a81={};_0x5cbab5<_0x4ba0b5[_0x5adb('0x44')];_0x5cbab5+=0x1){_0x177a81=_0x4ba0b5[_0x5cbab5];if(_[_0x5adb('0x45')](_0x207a81['salesforceAccounts'][_0x177a81['id']])){_0x207a81[_0x5adb('0x1c')][_0x177a81['id']]=new SalesforceAccount(_0x177a81);}else{_0x207a81['mergeFromDatabase'](_0x207a81[_0x5adb('0x1c')][_0x177a81['id']],_0x177a81);}}}return _0x207a81[_0x5adb('0x1c')];};};Realtime['prototype'][_0x5adb('0x4a')]=function(){var _0x1ab97b=this;return function(_0x3594e3){if(_0x3594e3){freeIsNotKey(_0x3594e3,_0x1ab97b[_0x5adb('0x1d')],'id');for(var _0x372734=0x0,_0x4cb36c={};_0x372734<_0x3594e3[_0x5adb('0x44')];_0x372734+=0x1){_0x4cb36c=_0x3594e3[_0x372734];if(_[_0x5adb('0x45')](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']])){_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']]=new FreshdeskAccount(_0x4cb36c);}else{_0x1ab97b['mergeFromDatabase'](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']],_0x4cb36c);}}}return _0x1ab97b[_0x5adb('0x1d')];};};Realtime[_0x5adb('0x41')]['initZohoAccounts']=function(){var _0x2b34a8=this;return function(_0xd0e5b7){if(_0xd0e5b7){freeIsNotKey(_0xd0e5b7,_0x2b34a8[_0x5adb('0x1e')],'id');for(var _0xfd3471=0x0,_0x4f2da9={};_0xfd3471<_0xd0e5b7[_0x5adb('0x44')];_0xfd3471+=0x1){_0x4f2da9=_0xd0e5b7[_0xfd3471];if(_[_0x5adb('0x45')](_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']])){_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']]=new ZohoAccount(_0x4f2da9);}else{_0x2b34a8[_0x5adb('0x40')](_0x2b34a8['zohoAccounts'][_0x4f2da9['id']],_0x4f2da9);}}}return _0x2b34a8[_0x5adb('0x1e')];};};Realtime['prototype'][_0x5adb('0x4b')]=function(){var _0x4f7227=this;return function(_0x31ae72){if(_0x31ae72){freeIsNotKey(_0x31ae72,_0x4f7227[_0x5adb('0x1f')],'id');for(var _0x1a9358=0x0,_0x42f6d9={};_0x1a9358<_0x31ae72['length'];_0x1a9358+=0x1){_0x42f6d9=_0x31ae72[_0x1a9358];if(_[_0x5adb('0x45')](_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']])){_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']]=new DeskAccount(_0x42f6d9);}else{_0x4f7227['mergeFromDatabase'](_0x4f7227['deskAccounts'][_0x42f6d9['id']],_0x42f6d9);}}}return _0x4f7227['deskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x4c')]=function(){var _0xa5ecc0=this;return function(_0x12a146){if(_0x12a146){freeIsNotKey(_0x12a146,_0xa5ecc0[_0x5adb('0x4d')],'id');for(var _0xb06bee=0x0,_0x204b9b={};_0xb06bee<_0x12a146[_0x5adb('0x44')];_0xb06bee+=0x1){_0x204b9b=_0x12a146[_0xb06bee];if(_[_0x5adb('0x45')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']])){_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']]=new SugarcrmAccount(_0x204b9b);}else{_0xa5ecc0[_0x5adb('0x40')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']],_0x204b9b);}}}return _0xa5ecc0['sugarcrmAccounts'];};};Realtime['prototype'][_0x5adb('0x4e')]=function(){var _0x27a8e4=this;return function(_0x43cde9){if(_0x43cde9){freeIsNotKey(_0x43cde9,_0x27a8e4[_0x5adb('0x4f')],'id');for(var _0x5d7a9f=0x0,_0xfba0d5={};_0x5d7a9f<_0x43cde9[_0x5adb('0x44')];_0x5d7a9f+=0x1){_0xfba0d5=_0x43cde9[_0x5d7a9f];if(_['isUndefined'](_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']])){_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']]=new VtigerAccount(_0xfba0d5);}else{_0x27a8e4[_0x5adb('0x40')](_0x27a8e4['vtigerAccounts'][_0xfba0d5['id']],_0xfba0d5);}}}return _0x27a8e4[_0x5adb('0x4f')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x50')]=function(){var _0x30c92c=this;return function(_0x330290){if(_0x330290){freeIsNotKey(_0x330290,_0x30c92c[_0x5adb('0x20')],'id');for(var _0x513f26=0x0,_0x836b91={};_0x513f26<_0x330290[_0x5adb('0x44')];_0x513f26+=0x1){_0x836b91=_0x330290[_0x513f26];if(_[_0x5adb('0x45')](_0x30c92c['servicenowAccounts'][_0x836b91['id']])){_0x30c92c[_0x5adb('0x20')][_0x836b91['id']]=new ServicenowAccount(_0x836b91);}else{_0x30c92c[_0x5adb('0x40')](_0x30c92c[_0x5adb('0x20')][_0x836b91['id']],_0x836b91);}}}return _0x30c92c['servicenowAccounts'];};};Realtime[_0x5adb('0x41')]['initDynamics365Accounts']=function(){var _0xa8ff64=this;return function(_0x1e7e3a){if(_0x1e7e3a){freeIsNotKey(_0x1e7e3a,_0xa8ff64[_0x5adb('0x51')],'id');for(var _0x57f0a4=0x0,_0x192b1f={};_0x57f0a4<_0x1e7e3a[_0x5adb('0x44')];_0x57f0a4+=0x1){_0x192b1f=_0x1e7e3a[_0x57f0a4];if(_['isUndefined'](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']])){_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']]=new Dynamics365Account(_0x192b1f);}else{_0xa8ff64[_0x5adb('0x40')](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']],_0x192b1f);}}}return _0xa8ff64['dynamics365Accounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x52')]=function(){var _0x307f07=this;return function(_0x16716e){if(_0x16716e){freeIsNotKey(_0x16716e,_0x307f07['freshsalesAccounts'],'id');for(var _0x53a4bc=0x0,_0x304512={};_0x53a4bc<_0x16716e['length'];_0x53a4bc+=0x1){_0x304512=_0x16716e[_0x53a4bc];if(_['isUndefined'](_0x307f07['freshsalesAccounts'][_0x304512['id']])){_0x307f07[_0x5adb('0x21')][_0x304512['id']]=new FreshsalesAccount(_0x304512);}else{_0x307f07[_0x5adb('0x40')](_0x307f07['freshsalesAccounts'][_0x304512['id']],_0x304512);}}}return _0x307f07[_0x5adb('0x21')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x53')]=function(){var _0xf6ef8a=this;return function(_0x358a23){for(var _0x126e38=0x0;_0x126e38<_0x358a23[_0x5adb('0x44')];_0x126e38+=0x1){_[_0x5adb('0x54')](_0xf6ef8a['voiceQueues'][_0x358a23[_0x126e38]['name']],_0x358a23[_0x126e38]);}return _0xf6ef8a['voiceQueues'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x55')]=function(){var _0x3a0d1b=this;return function(_0x2a55a3){clearVoiceQueues(_0x3a0d1b[_0x5adb('0x56')]);if(_0x2a55a3){_0x2a55a3=_[_0x5adb('0x57')](_0x2a55a3,_0x5adb('0x58'));for(var _0x25f761 in _0x2a55a3){if(_0x2a55a3['hasOwnProperty'](_0x25f761)){for(var _0x5e55c2=0x0;_0x5e55c2<_0x2a55a3[_0x25f761][_0x5adb('0x44')];_0x5e55c2+=0x1){var _0x56df90=_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x59')];if(_0x3a0d1b[_0x5adb('0x56')][_0x56df90]){if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5a')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x31')]+=0x1;}if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5b')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x5c')]+=0x1;}_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallerjoinAt']),_0x5adb('0x5f'))||0x0;if(_0x5e55c2===_0x2a55a3[_0x25f761][_0x5adb('0x44')]-0x1){_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallercompleteAt']||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x60')]||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x61')])['diff'](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x62')]),_0x5adb('0x5f'))||0x0;_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2a')]+=0x1;if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x63')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2b')]+=0x1;_0x3a0d1b[_0x5adb('0x56')][_0x56df90]['sumBillable']+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x64')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')]),'seconds')||0x0;}}else{_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]||0x0;}}}}}}return _0x3a0d1b[_0x5adb('0x56')];};};Realtime[_0x5adb('0x41')]['initVoiceCallReports']=function(){var _0x3a9735=this;return function(_0x288e4f){clearVoiceCallReports(_0x3a9735[_0x5adb('0x17')]);if(_0x288e4f){for(var _0x3ecc56=0x0;_0x3ecc56<_0x288e4f[_0x5adb('0x44')];_0x3ecc56+=0x1){_0x3a9735['outbound'][_0x5adb('0x2a')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2d')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')];if(_0x288e4f[_0x3ecc56]['disposition']===_0x5adb('0x66')){_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2b')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2c')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')]-_0x288e4f[_0x3ecc56][_0x5adb('0x67')]||0x0;_0x3a9735['outbound'][_0x5adb('0x32')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x67')];}}}return _0x3a9735['outbound'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x68')]=function(){var _0x4fc0d5=this;return function(_0x462fa0){if(_0x462fa0){freeIsNotKey(_0x462fa0,_0x4fc0d5['campaigns'],_0x5adb('0x24'));for(var _0x268df2=0x0,_0x4a2ebc={};_0x268df2<_0x462fa0[_0x5adb('0x44')];_0x268df2+=0x1){_0x4a2ebc=_0x462fa0[_0x268df2];if(_['isUndefined'](_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]])){_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]]=new Campaign(_0x4a2ebc);}else{_0x4fc0d5[_0x5adb('0x40')](_0x4fc0d5['campaigns'][_0x4a2ebc[_0x5adb('0x24')]],_0x4a2ebc);_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]][_0x5adb('0x69')]=_0x4a2ebc['SquareProject']?_0x4a2ebc['SquareProject'][_0x5adb('0x24')]:undefined;}}}return _0x4fc0d5[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6a')]=function(){var _0x277668=this;return function(_0xc74e86){if(_0xc74e86){freeIsNotKey(_0xc74e86,_0x277668[_0x5adb('0x6b')],'id');for(var _0x514833=0x0,_0xda26cc={};_0x514833<_0xc74e86[_0x5adb('0x44')];_0x514833+=0x1){_0xda26cc=_0xc74e86[_0x514833];if(_[_0x5adb('0x45')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']])){_0x277668['voiceExtensions'][_0xda26cc['id']]=new VoiceExtension(_0xda26cc);}else{_0x277668[_0x5adb('0x40')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']],_0xda26cc);}}}return _0x277668[_0x5adb('0x6b')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6c')]=function(){var _0x188cbd=this;return function(_0x315ac6){clearCampaigns(_0x188cbd[_0x5adb('0x15')]);for(var _0x1f753e=0x0;_0x1f753e<_0x315ac6['length'];_0x1f753e+=0x1){_[_0x5adb('0x54')](_0x188cbd[_0x5adb('0x15')][_0x315ac6[_0x1f753e]['name']],_0x315ac6[_0x1f753e]);}return _0x188cbd[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6d')]=function(){var _0x3bb3fc=this;return function(_0x200221){if(_0x200221){freeIsNotKey(_0x200221,_0x3bb3fc[_0x5adb('0x22')],'id');for(var _0x450516=0x0,_0x350bb1={};_0x450516<_0x200221['length'];_0x450516+=0x1){_0x350bb1=_0x200221[_0x450516];if(_[_0x5adb('0x45')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']])){_0x3bb3fc['faxAccounts'][_0x350bb1['id']]=new FaxAccount(_0x350bb1);}else{_0x3bb3fc[_0x5adb('0x40')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']],_0x350bb1);}}}return _0x3bb3fc[_0x5adb('0x22')];};};Realtime['prototype']['initVoiceQueues']=function(){var _0x2d7a9f=this;return function(_0x328851){if(_0x328851){freeIsNotKey(_0x328851,_0x2d7a9f[_0x5adb('0x56')],'name');for(var _0x14b36f=0x0,_0x321c3a={};_0x14b36f<_0x328851[_0x5adb('0x44')];_0x14b36f+=0x1){_0x321c3a=_0x328851[_0x14b36f];if(_[_0x5adb('0x45')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]])){_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]]=new VoiceQueue(_0x321c3a);}else{_0x2d7a9f[_0x5adb('0x40')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]],_0x321c3a);}}}return _0x2d7a9f[_0x5adb('0x56')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 42571ca..e787288 100644 --- a/server/services/ami/realtime/utils.js +++ b/server/services/ami/realtime/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0be4=['assign','hasOwnProperty'];(function(_0x3efe95,_0x23e0a1){var _0x48fc44=function(_0x283330){while(--_0x283330){_0x3efe95['push'](_0x3efe95['shift']());}};_0x48fc44(++_0x23e0a1);}(_0x0be4,0x68));var _0x40be=function(_0x5a6885,_0x498a45){_0x5a6885=_0x5a6885-0x0;var _0x12090a=_0x0be4[_0x5a6885];return _0x12090a;};'use strict';function mergeDBDataToRealtime(_0x28c80c,_0x453b4){var _0x224a39=Object[_0x40be('0x0')]({},_0x28c80c);for(var _0x18b71f in _0x453b4){if(_0x224a39[_0x40be('0x1')](_0x18b71f)){_0x224a39[_0x18b71f]=_0x453b4[_0x18b71f];}}return _0x224a39;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime; \ No newline at end of file +var _0xb174=['hasOwnProperty','mergeDBDataToRealtime','assign'];(function(_0x3b3007,_0x4c455a){var _0x45e5fa=function(_0xe9a1e5){while(--_0xe9a1e5){_0x3b3007['push'](_0x3b3007['shift']());}};_0x45e5fa(++_0x4c455a);}(_0xb174,0x1b8));var _0x4b17=function(_0x525fb5,_0x564b51){_0x525fb5=_0x525fb5-0x0;var _0xa92b01=_0xb174[_0x525fb5];return _0xa92b01;};'use strict';function mergeDBDataToRealtime(_0x2897ea,_0x4684c3){var _0x19afad=Object[_0x4b17('0x0')]({},_0x2897ea);for(var _0x20f894 in _0x4684c3){if(_0x19afad[_0x4b17('0x1')](_0x20f894)){_0x19afad[_0x20f894]=_0x4684c3[_0x20f894];}}return _0x19afad;}exports[_0x4b17('0x2')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 06aa05f..f3f8bd6 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 _0xe9fe=['./voiceDialReport','./userReport','realtime','agents','telephones','prototype','disabled','voiceQueueReport','bind','custom:voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','accountcode','name','isNil','find','format','SIP/%s','connectedlinenum','assigned','interface','queuecallercomplete','queuecallercompleteAt','queuecallerexit','YYYY-MM-DD\x20HH:mm:ss','create','match','length','keys','getCallType','channel','split','getAgentByInternal','calleridnum','internal','voiceCallReport','destination','exten','dialer','lastapplication','lastdata','queue','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','disposition','linkedid','uniqueid','transfers','type','UserId','monitors','monitorFilename','filename','createdAt','calleridname','connectedlinename','xcally-motion-dialer','voiceAgentReport','isArray','forEach','Local','substring','indexOf','mobile','phone','transfererlinkedid','exports','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport'];(function(_0x4b6dfa,_0x526975){var _0x10ae06=function(_0x5a084f){while(--_0x5a084f){_0x4b6dfa['push'](_0x4b6dfa['shift']());}};_0x10ae06(++_0x526975);}(_0xe9fe,0x1ba));var _0xee9f=function(_0x4fc702,_0x590060){_0x4fc702=_0x4fc702-0x0;var _0x1357d3=_0xe9fe[_0x4fc702];return _0x1357d3;};'use strict';var _=require('lodash');var moment=require(_0xee9f('0x0'));var util=require(_0xee9f('0x1'));var config=require(_0xee9f('0x2'));var ami=require(_0xee9f('0x3'));var RpcVoiceAgentReport=require(_0xee9f('0x4'));var RpcVoiceCallReport=require(_0xee9f('0x5'));var RpcVoiceDialReport=require(_0xee9f('0x6'));var RpcMemberReport=require(_0xee9f('0x7'));var RpcVoiceQueueReport=require(_0xee9f('0x8'));var RpcVoiceRecording=require(_0xee9f('0x9'));var RpcVoiceTransferReport=require(_0xee9f('0xa'));var VoiceQueueReport=require(_0xee9f('0xb'));var VoiceCallReport=require(_0xee9f('0xc'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0xee9f('0xd'));var UserReport=require(_0xee9f('0xe'));function Report(_0x50eea9){this[_0xee9f('0xf')]=_0x50eea9;this[_0xee9f('0x10')]=_0x50eea9[_0xee9f('0x10')];this[_0xee9f('0x11')]=_0x50eea9[_0xee9f('0x11')];}Report[_0xee9f('0x12')]['sync']=function(_0x14c84f){var _0x19c5f9=new VoiceQueueReport(this['realtime']);var _0x50dafe=new VoiceAgentReport(this['realtime']);var _0x1ae795=new VoiceDialReport(this[_0xee9f('0xf')]);var _0x2951e7=new VoiceCallReport(this[_0xee9f('0xf')]);var _0x5e91ea=new UserReport(this[_0xee9f('0xf')]);if(config['xdr']&&config['xdr'][_0xee9f('0x13')]){ami['on']('custom:voiceQueueReport',this[_0xee9f('0x14')][_0xee9f('0x15')](this));ami['on']('custom:voiceCallReport',this['voiceCallReport'][_0xee9f('0x15')](this));ami['on'](_0xee9f('0x16'),this['voiceAgentReport'][_0xee9f('0x15')](this));ami['on'](_0xee9f('0x17'),this[_0xee9f('0x18')][_0xee9f('0x15')](this));ami['on'](_0xee9f('0x19'),this[_0xee9f('0x1a')][_0xee9f('0x15')](this));ami['on'](_0xee9f('0x1b'),this[_0xee9f('0x1c')][_0xee9f('0x15')](this));}};Report[_0xee9f('0x12')][_0xee9f('0x1d')]=function(_0x3ece6a){var _0x53a28f;_0x53a28f=_['find'](this[_0xee9f('0x10')],function(_0x4bac8e){return _0x4bac8e[_0xee9f('0x1e')]==_0x3ece6a||_0x4bac8e[_0xee9f('0x1f')]==_0x3ece6a;});if(_[_0xee9f('0x20')](_0x53a28f)){var _0x514bdd=_[_0xee9f('0x21')](this[_0xee9f('0x11')],function(_0xcea9a5){return _0xcea9a5[_0xee9f('0x1e')]==_0x3ece6a||_0xcea9a5['name']==_0x3ece6a;});if(_0x514bdd){_0x53a28f=_[_0xee9f('0x21')](this[_0xee9f('0x10')],function(_0x4496d3){return _0x4496d3['interface']==util[_0xee9f('0x22')](_0xee9f('0x23'),_0x514bdd[_0xee9f('0x1f')]);});}}return _0x53a28f;};Report[_0xee9f('0x12')][_0xee9f('0x14')]=function(_0x52528e){for(var _0x21c14c=0x0;_0x21c14c<_0x52528e['length'];_0x21c14c+=0x1){var _0x2e249e=this[_0xee9f('0x1d')](_0x52528e[_0x21c14c][_0xee9f('0x24')]);if(_0x2e249e){_0x52528e[_0x21c14c][_0xee9f('0x1e')]=_0x2e249e[_0xee9f('0x1e')];_0x52528e[_0x21c14c][_0xee9f('0x25')]=!![];_0x52528e[_0x21c14c]['lastAssignedTo']=_0x2e249e[_0xee9f('0x1f')];_0x52528e[_0x21c14c][_0xee9f('0x26')]=_[_0xee9f('0x20')](_0x2e249e['interface'])?util[_0xee9f('0x22')](_0xee9f('0x23'),_0x2e249e['name']):_0x2e249e[_0xee9f('0x26')];if(_0x52528e[_0x21c14c][_0xee9f('0x27')]){_0x52528e[_0x21c14c][_0xee9f('0x28')]=moment()[_0xee9f('0x22')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x52528e[_0x21c14c][_0xee9f('0x29')]){_0x52528e[_0x21c14c]['queuecallerexitAt']=moment()[_0xee9f('0x22')](_0xee9f('0x2a'));}RpcMemberReport[_0xee9f('0x14')](_0x52528e[_0x21c14c]);}RpcVoiceQueueReport[_0xee9f('0x2b')](_0x52528e[_0x21c14c]);}};function extractCalleridNumber(_0x1cfda1){var _0x442e3d=_0x1cfda1[_0xee9f('0x2c')](/<(.*?)>/);return _0x442e3d?_0x442e3d[0x1]:_0x1cfda1;}Report[_0xee9f('0x12')]['getAgentByInternal']=function(_0x5736c4){for(var _0x568793=0x0;_0x568793',_0xab05a2['calleridname'],_0xab05a2[_0xee9f('0x33')]);}if(RpcVoiceTransferReport['transfers'][_0xab05a2['linkedid']]){var _0xc8d14d=RpcVoiceTransferReport['transfers'][_0xab05a2[_0xee9f('0x45')]];_0xc8d14d['transfereelinkedid']=_0xab05a2[_0xee9f('0x46')];RpcVoiceTransferReport[_0xee9f('0x1a')](_0xc8d14d);delete RpcVoiceTransferReport[_0xee9f('0x47')][_0xab05a2[_0xee9f('0x45')]];}if(_['isNil'](_0xab05a2[_0xee9f('0x48')])){_0xab05a2[_0xee9f('0x48')]=this[_0xee9f('0x2f')](_0xab05a2);}if(_[_0xee9f('0x20')](_0xab05a2[_0xee9f('0x49')])){var _0x3de8ae=_0xab05a2[_0xee9f('0x30')]['split']('-')[0x0];var _0x72ffb=this[_0xee9f('0x10')][_0x3de8ae];if(!_0x72ffb)_0x72ffb=this[_0xee9f('0x32')](_0xab05a2[_0xee9f('0x1e')]);if(_0x72ffb){_0xab05a2[_0xee9f('0x49')]=_0x72ffb['id'];_0xab05a2['membername']=_0x72ffb[_0xee9f('0x1f')];}}RpcVoiceCallReport['create'](_0xab05a2);if(_0xab05a2['monitor']){for(var _0x53e188=0x0;_0x53e188<_0xab05a2[_0xee9f('0x4a')][_0xee9f('0x2d')];_0x53e188+=0x1){_0xab05a2[_0xee9f('0x4b')]=_0xab05a2[_0xee9f('0x4a')][_0x53e188][_0xee9f('0x4c')];_0xab05a2[_0xee9f('0x4d')]=_0xab05a2['monitors'][_0x53e188][_0xee9f('0x4d')];if(_0xab05a2['exten']=='xcally-motion-preview'){_0xab05a2[_0xee9f('0x33')]=_0xab05a2[_0xee9f('0x24')];_0xab05a2[_0xee9f('0x4e')]=_0xab05a2[_0xee9f('0x4f')];_0xab05a2[_0xee9f('0x24')]=_0xab05a2['accountcode'];_0xab05a2[_0xee9f('0x4f')]=_0xab05a2['membername'];_0xab05a2['exten']=_0xab05a2[_0xee9f('0x42')];}else if(_0xab05a2['exten']==_0xee9f('0x50')){_0xab05a2['calleridnum']=_0xab05a2['destination'];_0xab05a2[_0xee9f('0x37')]=_0xab05a2[_0xee9f('0x42')];}RpcVoiceRecording[_0xee9f('0x2b')](_0xab05a2);}}};Report[_0xee9f('0x12')][_0xee9f('0x51')]=function(_0x4a58ef){if(_[_0xee9f('0x52')](_0x4a58ef)){_0x4a58ef[_0xee9f('0x53')](function(_0x1e6a87){RpcVoiceAgentReport['create'](_0x1e6a87);});}else{RpcVoiceAgentReport[_0xee9f('0x2b')](_0x4a58ef);}};Report[_0xee9f('0x12')][_0xee9f('0x18')]=function(_0x507957){RpcVoiceDialReport[_0xee9f('0x2b')](_0x507957);var _0x1a4a5b;var _0x2b860c;var _0x4c5d8d=_0x507957[_0xee9f('0x30')];if(_['startsWith'](_0x4c5d8d,_0xee9f('0x54'))){_0x2b860c=_0x4c5d8d[_0xee9f('0x55')](_0x4c5d8d['indexOf']('/')+0x1,_0x4c5d8d[_0xee9f('0x56')]('@'));_0x1a4a5b=_[_0xee9f('0x21')](this[_0xee9f('0x10')],function(_0x22be91){return _0x22be91[_0xee9f('0x57')]==_0x2b860c||_0x22be91[_0xee9f('0x58')]==_0x2b860c||_0x22be91[_0xee9f('0x1e')]==_0x2b860c;});}else{_0x2b860c=_0x4c5d8d['substring'](_0x4c5d8d['indexOf']('/')+0x1,_0x4c5d8d['lastIndexOf']('-'));_0x1a4a5b=this[_0xee9f('0x1d')](_0x2b860c);}if(_0x1a4a5b){_0x507957[_0xee9f('0x26')]=_[_0xee9f('0x20')](_0x1a4a5b[_0xee9f('0x26')])?util['format']('SIP/%s',_0x1a4a5b[_0xee9f('0x1f')]):_0x1a4a5b[_0xee9f('0x26')];_0x507957['membername']=_0x1a4a5b[_0xee9f('0x1f')];_0x507957['accountcode']=_0x1a4a5b[_0xee9f('0x1e')];RpcMemberReport['voiceDialReport'](_0x507957);}};Report['prototype'][_0xee9f('0x1a')]=function(_0x40116c){RpcVoiceTransferReport[_0xee9f('0x47')][_0x40116c[_0xee9f('0x59')]]=_0x40116c;};Report[_0xee9f('0x12')]['attendedTransfer']=function(_0x1af811){RpcVoiceTransferReport['attendedTransfer'](_0x1af811);};module[_0xee9f('0x5a')]=Report; \ No newline at end of file +var _0x84a9=['forEach','startsWith','Local','substring','mobile','phone','indexOf','lastIndexOf','transfererlinkedid','attendedTransfer','exports','lodash','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/memberReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','voiceCallReport','voiceAgentReport','bind','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','findAgent','find','accountcode','name','isNil','interface','format','length','assigned','lastAssignedTo','SIP/%s','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','getAgentByInternal','keys','split','internal','destination','exten','type','queue','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','originatecalleridnum','destinationchannel','channel','calleridnum','disposition','connectedlinenum','\x22%s\x22\x20<%s>','calleridname','linkedid','transfereelinkedid','uniqueid','transfers','getCallType','UserId','monitor','monitorFilename','filename','monitors','connectedlinename','membername','xcally-motion-dialer'];(function(_0x3e9f00,_0x50e9e6){var _0x14afb4=function(_0x4f5126){while(--_0x4f5126){_0x3e9f00['push'](_0x3e9f00['shift']());}};_0x14afb4(++_0x50e9e6);}(_0x84a9,0x119));var _0x984a=function(_0x95d36,_0x339cbd){_0x95d36=_0x95d36-0x0;var _0x324f84=_0x84a9[_0x95d36];return _0x324f84;};'use strict';var _=require(_0x984a('0x0'));var moment=require('moment');var util=require('util');var config=require(_0x984a('0x1'));var ami=require(_0x984a('0x2'));var RpcVoiceAgentReport=require(_0x984a('0x3'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x984a('0x4'));var RpcMemberReport=require(_0x984a('0x5'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x984a('0x6'));var VoiceCallReport=require(_0x984a('0x7'));var VoiceAgentReport=require(_0x984a('0x8'));var VoiceDialReport=require(_0x984a('0x9'));var UserReport=require('./userReport');function Report(_0x7ff41f){this[_0x984a('0xa')]=_0x7ff41f;this[_0x984a('0xb')]=_0x7ff41f['agents'];this['telephones']=_0x7ff41f[_0x984a('0xc')];}Report[_0x984a('0xd')][_0x984a('0xe')]=function(_0x204794){var _0x5b0d34=new VoiceQueueReport(this[_0x984a('0xa')]);var _0x52e111=new VoiceAgentReport(this[_0x984a('0xa')]);var _0x1acf02=new VoiceDialReport(this['realtime']);var _0xeedaf1=new VoiceCallReport(this[_0x984a('0xa')]);var _0x268e8a=new UserReport(this[_0x984a('0xa')]);if(config[_0x984a('0xf')]&&config[_0x984a('0xf')][_0x984a('0x10')]){ami['on'](_0x984a('0x11'),this[_0x984a('0x12')]['bind'](this));ami['on'](_0x984a('0x13'),this[_0x984a('0x14')]['bind'](this));ami['on']('custom:voiceAgentReport',this[_0x984a('0x15')][_0x984a('0x16')](this));ami['on'](_0x984a('0x17'),this[_0x984a('0x18')][_0x984a('0x16')](this));ami['on'](_0x984a('0x19'),this[_0x984a('0x1a')][_0x984a('0x16')](this));ami['on'](_0x984a('0x1b'),this['attendedTransfer'][_0x984a('0x16')](this));}};Report[_0x984a('0xd')][_0x984a('0x1c')]=function(_0x592004){var _0xaa195a;_0xaa195a=_[_0x984a('0x1d')](this[_0x984a('0xb')],function(_0x2f9a92){return _0x2f9a92[_0x984a('0x1e')]==_0x592004||_0x2f9a92[_0x984a('0x1f')]==_0x592004;});if(_[_0x984a('0x20')](_0xaa195a)){var _0x34b7b7=_[_0x984a('0x1d')](this['telephones'],function(_0x74bd1d){return _0x74bd1d[_0x984a('0x1e')]==_0x592004||_0x74bd1d['name']==_0x592004;});if(_0x34b7b7){_0xaa195a=_[_0x984a('0x1d')](this[_0x984a('0xb')],function(_0x492bb1){return _0x492bb1[_0x984a('0x21')]==util[_0x984a('0x22')]('SIP/%s',_0x34b7b7[_0x984a('0x1f')]);});}}return _0xaa195a;};Report[_0x984a('0xd')][_0x984a('0x12')]=function(_0x4c3c8){for(var _0x523893=0x0;_0x523893<_0x4c3c8[_0x984a('0x23')];_0x523893+=0x1){var _0xef002f=this[_0x984a('0x1c')](_0x4c3c8[_0x523893]['connectedlinenum']);if(_0xef002f){_0x4c3c8[_0x523893][_0x984a('0x1e')]=_0xef002f[_0x984a('0x1e')];_0x4c3c8[_0x523893][_0x984a('0x24')]=!![];_0x4c3c8[_0x523893][_0x984a('0x25')]=_0xef002f[_0x984a('0x1f')];_0x4c3c8[_0x523893]['interface']=_[_0x984a('0x20')](_0xef002f[_0x984a('0x21')])?util[_0x984a('0x22')](_0x984a('0x26'),_0xef002f[_0x984a('0x1f')]):_0xef002f['interface'];if(_0x4c3c8[_0x523893]['queuecallercomplete']){_0x4c3c8[_0x523893][_0x984a('0x27')]=moment()['format'](_0x984a('0x28'));}if(_0x4c3c8[_0x523893][_0x984a('0x29')]){_0x4c3c8[_0x523893][_0x984a('0x2a')]=moment()[_0x984a('0x22')](_0x984a('0x28'));}RpcMemberReport[_0x984a('0x12')](_0x4c3c8[_0x523893]);}RpcVoiceQueueReport[_0x984a('0x2b')](_0x4c3c8[_0x523893]);}};function extractCalleridNumber(_0x4fd4e9){var _0x351b7a=_0x4fd4e9['match'](/<(.*?)>/);return _0x351b7a?_0x351b7a[0x1]:_0x4fd4e9;}Report[_0x984a('0xd')][_0x984a('0x2c')]=function(_0x4cab76){for(var _0x3cdfa9=0x0;_0x3cdfa90x0?!![]:![];if(!_0x45c87b){return this[_0x0b7f('0x18')](this[_0x0b7f('0x42')][_0x0b7f('0x6a')]);}};VoiceQueueReport[_0x0b7f('0x35')][_0x0b7f('0x1a')]=function(_0x23372b){var _0xc779b4=this['summary']['id'];if(this[_0x0b7f('0x42')][_0x0b7f('0x66')][_0xc779b4]&&this['summary'][_0x0b7f('0x66')][_0xc779b4][_0x23372b['actionid']]){this['summary'][_0x0b7f('0x66')][_0xc779b4][_0x23372b[_0x0b7f('0x5f')]][_0x0b7f('0x11')]['push'](_0x23372b);}};VoiceQueueReport[_0x0b7f('0x35')][_0x0b7f('0x17')]=function(_0x90095d){var _0x5de05a=this;try{if(this['isNotNull'](_0x90095d)&&this[_0x0b7f('0x6b')](_0x90095d[_0x0b7f('0x52')])){logger[_0x0b7f('0x4e')]('[voiceQueueReport][queuesummary]\x20event:',util[_0x0b7f('0x3f')](_0x90095d,{'showHidden':![],'depth':null}));var _0x26c0f7=this[_0x0b7f('0x13')][_0x90095d[_0x0b7f('0x52')]];if(_0x26c0f7){logger['info'](_0x0b7f('0x6c'),_0x26c0f7[_0x0b7f('0x58')]);this[_0x0b7f('0x42')][_0x0b7f('0x61')][_0x26c0f7[_0x0b7f('0x58')]]={'summaryEvent':_0x90095d};this[_0x0b7f('0x42')][_0x0b7f('0x69')]+=0x1;return ami[_0x0b7f('0x5d')]({'action':_0x0b7f('0x66'),'queue':_0x26c0f7[_0x0b7f('0x58')]})['then'](function(_0x215ba9){if(!_0x5de05a['summary']['queuestatus'][_0x90095d[_0x0b7f('0x5f')]]){_0x5de05a['summary'][_0x0b7f('0x66')][_0x90095d[_0x0b7f('0x5f')]]={};}_0x5de05a[_0x0b7f('0x42')][_0x0b7f('0x66')][_0x90095d['actionid']][_0x215ba9[_0x0b7f('0x5f')]]={'queue':_0x26c0f7[_0x0b7f('0x58')],'agents':[]};})[_0x0b7f('0x5a')](function(_0x596020){throw _0x596020;});}}}catch(_0x399651){logger['error']('[voiceQueueReport][queuesummary]',util[_0x0b7f('0x3f')](_0x399651,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0b7f('0x35')][_0x0b7f('0x18')]=function(_0x3389b9){if(this[_0x0b7f('0x42')][_0x0b7f('0x69')]>0x0){this[_0x0b7f('0x42')][_0x0b7f('0x6a')]=_0x3389b9;return;}logger[_0x0b7f('0x4e')](_0x0b7f('0x6d'),util[_0x0b7f('0x3f')](_0x3389b9,{'showHidden':![],'depth':null}));this[_0x0b7f('0x42')]=initializeSummary();ami['emit'](_0x0b7f('0x6e'),{});};VoiceQueueReport[_0x0b7f('0x35')]['syncQueueCallerJoin']=function(_0x5c1468){try{if(this[_0x0b7f('0x6b')](_0x5c1468)){logger['debug']('[%s][voiceQueueReport][queuecallerjoin]',_0x5c1468['uniqueid'],util[_0x0b7f('0x3f')](_0x5c1468,{'showHidden':![],'depth':null}));if(_[_0x0b7f('0x59')](this[_0x0b7f('0xf')][_0x5c1468[_0x0b7f('0x4f')]])){this[_0x0b7f('0xf')][_0x5c1468['uniqueid']]=[];}if(_[_0x0b7f('0x59')](this[_0x0b7f('0x37')][_0x5c1468[_0x0b7f('0x4f')]])){this[_0x0b7f('0x37')][_0x5c1468['uniqueid']]={};}var _0x5027bf=new QueueReport();_0x5027bf[_0x0b7f('0x52')]=_0x5c1468[_0x0b7f('0x52')];_0x5027bf[_0x0b7f('0x56')]=this[_0x0b7f('0x13')][_0x5027bf[_0x0b7f('0x52')]]&&this[_0x0b7f('0x13')][_0x5027bf[_0x0b7f('0x52')]]['type']?this[_0x0b7f('0x13')][_0x5027bf[_0x0b7f('0x52')]][_0x0b7f('0x56')]||'inbound':'inbound';_0x5027bf[_0x0b7f('0x6f')]=moment()['format'](_0x0b7f('0x70'));_0x5027bf['position']=_0x5c1468[_0x0b7f('0x71')];_0x5027bf['count']=_0x5c1468[_0x0b7f('0x72')];_0x5027bf[_0x0b7f('0x4f')]=_0x5c1468[_0x0b7f('0x4f')];_0x5027bf[_0x0b7f('0x73')]=this[_0x0b7f('0x37')][_0x5c1468[_0x0b7f('0x4f')]][_0x0b7f('0x73')];logger['info'](_0x0b7f('0x74'),_0x5027bf[_0x0b7f('0x52')],_0x5027bf['type']);_['merge'](_0x5027bf,_[_0x0b7f('0x75')](_0x5c1468,_[_0x0b7f('0x76')](_0x5027bf)));this[_0x0b7f('0xf')][_0x5c1468['uniqueid']]['push'](_0x5027bf);this[_0x0b7f('0x37')][_0x5c1468[_0x0b7f('0x4f')]]=_0x5027bf;this[_0x0b7f('0x47')](_0x5027bf,_0x0b7f('0x77'));}}catch(_0x2798e4){logger[_0x0b7f('0x3d')](_0x0b7f('0x78'),_0x5c1468[_0x0b7f('0x4f')],util[_0x0b7f('0x3f')](_0x2798e4,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x0b7f('0x79')]=function(_0x31f3be){try{if(this[_0x0b7f('0x6b')](_0x31f3be)){logger['debug'](_0x0b7f('0x7a'),_0x31f3be['uniqueid'],util[_0x0b7f('0x3f')](_0x31f3be,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x31f3be[_0x0b7f('0x4f')]]){var _0xaaaed4=_[_0x0b7f('0x7b')](this['queueReports'][_0x31f3be[_0x0b7f('0x4f')]]);_0xaaaed4[_0x0b7f('0x7c')]=![];_0xaaaed4[_0x0b7f('0x7d')]=null;_0xaaaed4['holdtime']=_0x31f3be[_0x0b7f('0x7e')];_0xaaaed4[_0x0b7f('0x7f')]=_0x31f3be[_0x0b7f('0x7f')];_0xaaaed4[_0x0b7f('0x1d')]=!![];_0xaaaed4[_0x0b7f('0x80')]=moment()[_0x0b7f('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');_0xaaaed4[_0x0b7f('0x50')]=_0x0b7f('0x81');_0xaaaed4[_0x0b7f('0x82')]=null;logger[_0x0b7f('0x83')](_0x0b7f('0x84'),_0xaaaed4[_0x0b7f('0x52')],_0xaaaed4[_0x0b7f('0x56')]);this[_0x0b7f('0x37')][_0x31f3be[_0x0b7f('0x4f')]]=_0xaaaed4;this[_0x0b7f('0x44')](_0xaaaed4,'queuecallerabandon');}}}catch(_0x33d217){logger[_0x0b7f('0x3d')](_0x0b7f('0x7a'),_0x31f3be['uniqueid'],util['inspect'](_0x33d217,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0b7f('0x35')][_0x0b7f('0x1f')]=function(_0x4ad68b){try{if(this[_0x0b7f('0x6b')](_0x4ad68b)){logger['debug'](_0x0b7f('0x85'),_0x4ad68b[_0x0b7f('0x4f')],util[_0x0b7f('0x3f')](_0x4ad68b,{'showHidden':![],'depth':null}));if(this[_0x0b7f('0xf')][_0x4ad68b[_0x0b7f('0x4f')]]){var _0x4e0f84=_[_0x0b7f('0x7b')](this[_0x0b7f('0xf')][_0x4ad68b['uniqueid']]);_0x4e0f84[_0x0b7f('0x86')]=moment()[_0x0b7f('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');_0x4e0f84[_0x0b7f('0x87')]=_0x4ad68b[_0x0b7f('0x87')];_0x4e0f84['connectedlinename']=_0x4ad68b[_0x0b7f('0x88')];logger['info']('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x4e0f84['queue'],_0x4e0f84[_0x0b7f('0x56')],_0x4ad68b[_0x0b7f('0x87')],_0x4ad68b[_0x0b7f('0x88')]);this[_0x0b7f('0x37')][_0x4ad68b[_0x0b7f('0x4f')]]=_0x4e0f84;this['emitVoiceQueueChannelSave'](_0x4e0f84,'queuecallerleave');}}}catch(_0x383e19){logger[_0x0b7f('0x3d')](_0x0b7f('0x85'),_0x4ad68b['uniqueid'],util[_0x0b7f('0x3f')](_0x383e19,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x0b7f('0x22')]=function(_0x1eac02){try{if(this[_0x0b7f('0x6b')](_0x1eac02)){logger[_0x0b7f('0x4e')](_0x0b7f('0x89'),_0x1eac02[_0x0b7f('0x4f')],util[_0x0b7f('0x3f')](_0x1eac02,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x1eac02['uniqueid']]){var _0xccc6a7=_[_0x0b7f('0x7b')](this[_0x0b7f('0xf')][_0x1eac02[_0x0b7f('0x4f')]]);_0xccc6a7[_0x0b7f('0x7c')]=!![];_0xccc6a7[_0x0b7f('0x50')]=_0x0b7f('0x8a');logger[_0x0b7f('0x83')](_0x0b7f('0x8b'),_0xccc6a7[_0x0b7f('0x52')],_0xccc6a7[_0x0b7f('0x56')]);}}}catch(_0x2db693){logger[_0x0b7f('0x3d')](_0x0b7f('0x89'),_0x1eac02[_0x0b7f('0x4f')],util[_0x0b7f('0x3f')](_0x2db693,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentComplete']=function(_0x30a078){try{if(this[_0x0b7f('0x6b')](_0x30a078)){logger[_0x0b7f('0x4e')]('[%s][voiceQueueReport][agentcomplete]',_0x30a078[_0x0b7f('0x4f')],util[_0x0b7f('0x3f')](_0x30a078,{'showHidden':![],'depth':null}));if(this[_0x0b7f('0xf')][_0x30a078[_0x0b7f('0x4f')]]){var _0x3123ca=_[_0x0b7f('0x7b')](this['queueReports'][_0x30a078['uniqueid']]);_0x3123ca[_0x0b7f('0x1d')]=![];_0x3123ca[_0x0b7f('0x80')]=null;_0x3123ca[_0x0b7f('0x8c')]=!![];_0x3123ca['lastAssignedTo']=_0x30a078[_0x0b7f('0x8d')];_0x3123ca['holdtime']=_0x30a078[_0x0b7f('0x7e')];_0x3123ca[_0x0b7f('0x7c')]=!![];_0x3123ca[_0x0b7f('0x8e')]=![];_0x3123ca['queuecallerexitAt']=null;if(!_0x3123ca[_0x0b7f('0x8f')]){if(_0x30a078[_0x0b7f('0x90')]==_0x0b7f('0x8f')){_0x3123ca[_0x0b7f('0x50')]=_0x0b7f('0x91');logger[_0x0b7f('0x83')](_0x0b7f('0x92'),_0x3123ca[_0x0b7f('0x52')],_0x3123ca[_0x0b7f('0x56')]);}else{if(_[_0x0b7f('0x93')](_0x30a078['channel'][_0x0b7f('0x94')](),_0x0b7f('0x95'))){if(this[_0x0b7f('0xf')][_0x30a078[_0x0b7f('0x96')]]){var _0x24b9e7=_[_0x0b7f('0x7b')](this['queueReports'][_0x30a078[_0x0b7f('0x96')]]);_0x24b9e7[_0x0b7f('0x7c')]=![];_0x24b9e7['queuecallerexit']=!![];_0x24b9e7[_0x0b7f('0x97')]=moment(_0x3123ca['queuecallerjoinAt'])[_0x0b7f('0x98')](_0x30a078['holdtime'],_0x0b7f('0x99'))[_0x0b7f('0x4a')](_0x0b7f('0x70'));_0x24b9e7[_0x0b7f('0x50')]='FORWARDTRANSFER';_0x24b9e7['transfer']=!![];_0x24b9e7[_0x0b7f('0x9a')]='FORWARD';_0x24b9e7['transferexten']=_0x30a078[_0x0b7f('0x9b')];_0x24b9e7[_0x0b7f('0x9c')]=_0x30a078[_0x0b7f('0x4f')];logger[_0x0b7f('0x83')](_0x0b7f('0x9d'),_0x24b9e7[_0x0b7f('0x52')],_0x24b9e7[_0x0b7f('0x56')]);var _0x125986=this[_0x0b7f('0xf')][_0x30a078[_0x0b7f('0x96')]];this[_0x0b7f('0xf')][_0x30a078[_0x0b7f('0x96')]]=this['queueReports'][_0x30a078['uniqueid']];this['queueReports'][_0x30a078[_0x0b7f('0x4f')]]=_0x125986;}}else{_0x3123ca[_0x0b7f('0x50')]=_0x0b7f('0x9e')+_0x30a078['reason'][_0x0b7f('0x9f')]();logger[_0x0b7f('0x83')](_0x0b7f('0xa0'),_0x3123ca['queue'],_0x3123ca[_0x0b7f('0x56')],_0x3123ca[_0x0b7f('0x50')]);}}}this[_0x0b7f('0x37')][_0x30a078[_0x0b7f('0x4f')]]=_0x3123ca;this[_0x0b7f('0x44')](_0x3123ca,_0x0b7f('0x20'));}}}catch(_0x40f279){logger[_0x0b7f('0x3d')]('[%s][voiceQueueReport][agentcomplete]',_0x30a078['uniqueid'],util[_0x0b7f('0x3f')](_0x40f279,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x0b7f('0x24')]=function(_0x20e7b5){try{if(this[_0x0b7f('0x6b')](_0x20e7b5)){logger[_0x0b7f('0x4e')](_0x0b7f('0xa1'),_0x20e7b5[_0x0b7f('0x4f')],util[_0x0b7f('0x3f')](_0x20e7b5,{'showHidden':![],'depth':null}));this['addVariable'](_0x20e7b5[_0x0b7f('0x4f')],_['keys'](_0x20e7b5[_0x0b7f('0xa2')])[0x0],_0x20e7b5['value']);if(this['queueReports'][_0x20e7b5[_0x0b7f('0x4f')]]){var _0x12f0cb=_[_0x0b7f('0x7b')](this[_0x0b7f('0xf')][_0x20e7b5['uniqueid']]);if(_0x12f0cb){if(this['isNotNull'](_0x20e7b5[_0x0b7f('0xa2')])&&this[_0x0b7f('0x6b')](_0x20e7b5[_0x0b7f('0xa2')][_0x0b7f('0x66')])){switch(_0x20e7b5['value']){case _0x0b7f('0xa3'):_0x12f0cb[_0x0b7f('0x8e')]=![];_0x12f0cb[_0x0b7f('0x97')]=null;break;case _0x0b7f('0xa4'):_0x12f0cb[_0x0b7f('0xa5')]=_0x0b7f('0xa6');_0x12f0cb['queuecallerexit']=!![];_0x12f0cb[_0x0b7f('0x97')]=moment()[_0x0b7f('0x4a')](_0x0b7f('0x70'));_0x12f0cb[_0x0b7f('0x86')]=moment()[_0x0b7f('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0x0b7f('0x4e')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x20e7b5['uniqueid'],util['inspect'](_0x12f0cb,{'showHidden':![],'depth':null}));ami['emit'](_0x0b7f('0xa7'),_0x12f0cb);break;default:_0x12f0cb[_0x0b7f('0x8e')]=!![];_0x12f0cb['queuecallerexitAt']=moment()['format'](_0x0b7f('0x70'));_0x12f0cb[_0x0b7f('0x86')]=moment()[_0x0b7f('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');}_0x12f0cb[_0x0b7f('0x1d')]=![];_0x12f0cb[_0x0b7f('0x80')]=null;_0x12f0cb['queuecallerexitreason']=_0x20e7b5[_0x0b7f('0xa8')];this[_0x0b7f('0x37')][_0x20e7b5[_0x0b7f('0x4f')]]=_0x12f0cb;this[_0x0b7f('0x44')](_0x12f0cb,'varset');}else if(this[_0x0b7f('0x6b')](_0x20e7b5['variable'])&&this[_0x0b7f('0x6b')](_0x20e7b5[_0x0b7f('0xa2')][_0x0b7f('0xa9')])){if(!_0x12f0cb[_0x0b7f('0x1d')]){_0x12f0cb[_0x0b7f('0x8e')]=!![];_0x12f0cb[_0x0b7f('0x97')]=moment()['format'](_0x0b7f('0x70'));_0x12f0cb[_0x0b7f('0x50')]=_0x0b7f('0xaa');_0x12f0cb['queuecallerleaveAt']=moment()[_0x0b7f('0x4a')](_0x0b7f('0x70'));this[_0x0b7f('0x37')][_0x20e7b5[_0x0b7f('0x4f')]]=_0x12f0cb;}}logger[_0x0b7f('0x83')](_0x0b7f('0xab'),_0x20e7b5[_0x0b7f('0x4f')],_0x12f0cb[_0x0b7f('0x52')],_0x12f0cb[_0x0b7f('0x56')],_[_0x0b7f('0x76')](_0x20e7b5[_0x0b7f('0xa2')])[0x0],_0x20e7b5[_0x0b7f('0xa8')]);_0x12f0cb[_0x0b7f('0x15')]=this[_0x0b7f('0x15')][_0x20e7b5[_0x0b7f('0x4f')]];}}}}catch(_0x322270){logger['error'](_0x0b7f('0xa1'),_0x20e7b5[_0x0b7f('0x4f')],util[_0x0b7f('0x3f')](_0x322270,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0b7f('0x35')][_0x0b7f('0xac')]=function(_0x49732d,_0x35a029,_0x69393){var _0x5bd9df=[_0x0b7f('0xad'),_0x0b7f('0xae'),_0x0b7f('0xaf'),_0x0b7f('0xb0'),'rtpaudioqosloss',_0x0b7f('0xb1'),_0x0b7f('0xb2'),_0x0b7f('0xb3'),_0x0b7f('0xb4'),_0x0b7f('0xb5'),_0x0b7f('0xb6'),_0x0b7f('0xb7'),'membercalls',_0x0b7f('0xb8'),_0x0b7f('0xb9'),_0x0b7f('0xba'),_0x0b7f('0x8d'),_0x0b7f('0xbb'),_0x0b7f('0xbc')];if(!_['isNil'](_0x35a029)&&!_[_0x0b7f('0xbd')](_0x5bd9df,_0x35a029)){if(_[_0x0b7f('0x59')](this['variables'][_0x49732d])){this[_0x0b7f('0x15')][_0x49732d]={};}this['variables'][_0x49732d][_0x35a029]=_0x69393;}};VoiceQueueReport[_0x0b7f('0x35')][_0x0b7f('0xbe')]=function(_0x1f2e84,_0x544dc5,_0x48bb82){var _0xc3b502={};for(var _0x5399d8=0x0;_0x5399d80x0?!![]:![];if(!_0x50064e){return this[_0xe8fe('0x6e')](this[_0xe8fe('0x49')][_0xe8fe('0x6f')]);}};VoiceQueueReport['prototype'][_0xe8fe('0x1c')]=function(_0x26ae06){var _0x2157d1=this[_0xe8fe('0x49')]['id'];if(this['summary'][_0xe8fe('0x62')][_0x2157d1]&&this[_0xe8fe('0x49')][_0xe8fe('0x62')][_0x2157d1][_0x26ae06['actionid']]){this['summary'][_0xe8fe('0x62')][_0x2157d1][_0x26ae06['actionid']][_0xe8fe('0x13')][_0xe8fe('0x70')](_0x26ae06);}};VoiceQueueReport[_0xe8fe('0xc')]['syncQueueSummary']=function(_0x423108){var _0x3d7c64=this;try{if(this[_0xe8fe('0x71')](_0x423108)&&this['isNotNull'](_0x423108[_0xe8fe('0x52')])){logger[_0xe8fe('0x54')](_0xe8fe('0x72'),util[_0xe8fe('0x46')](_0x423108,{'showHidden':![],'depth':null}));var _0x30005f=this[_0xe8fe('0x15')][_0x423108[_0xe8fe('0x52')]];if(_0x30005f){logger[_0xe8fe('0x54')]('[voiceQueueReport][queuesummary]\x20name:%s',_0x30005f[_0xe8fe('0x5c')]);this['summary']['queues'][_0x30005f[_0xe8fe('0x5c')]]={'summaryEvent':_0x423108};this['summary'][_0xe8fe('0x6d')]+=0x1;return ami[_0xe8fe('0x41')]({'action':_0xe8fe('0x62'),'queue':_0x30005f[_0xe8fe('0x5c')]})['then'](function(_0x2f5a66){if(!_0x3d7c64[_0xe8fe('0x49')]['queuestatus'][_0x423108[_0xe8fe('0x61')]]){_0x3d7c64['summary'][_0xe8fe('0x62')][_0x423108[_0xe8fe('0x61')]]={};}_0x3d7c64[_0xe8fe('0x49')][_0xe8fe('0x62')][_0x423108[_0xe8fe('0x61')]][_0x2f5a66[_0xe8fe('0x61')]]={'queue':_0x30005f[_0xe8fe('0x5c')],'agents':[]};})[_0xe8fe('0x43')](function(_0x2df4d5){throw _0x2df4d5;});}}}catch(_0x57c236){logger[_0xe8fe('0x47')](_0xe8fe('0x63'),util[_0xe8fe('0x46')](_0x57c236,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xe8fe('0x6e')]=function(_0x302448){if(this['summary'][_0xe8fe('0x6d')]>0x0){this[_0xe8fe('0x49')][_0xe8fe('0x6f')]=_0x302448;return;}logger['debug'](_0xe8fe('0x73'),util[_0xe8fe('0x46')](_0x302448,{'showHidden':![],'depth':null}));this[_0xe8fe('0x49')]=initializeSummary();ami[_0xe8fe('0x4d')](_0xe8fe('0x74'),{});};VoiceQueueReport[_0xe8fe('0xc')]['syncQueueCallerJoin']=function(_0x4cf91b){try{if(this['isNotNull'](_0x4cf91b)){logger[_0xe8fe('0x54')](_0xe8fe('0x75'),_0x4cf91b[_0xe8fe('0x50')],util[_0xe8fe('0x46')](_0x4cf91b,{'showHidden':![],'depth':null}));if(_[_0xe8fe('0x5d')](this[_0xe8fe('0x11')][_0x4cf91b['uniqueid']])){this[_0xe8fe('0x11')][_0x4cf91b[_0xe8fe('0x50')]]=[];}if(_['isUndefined'](this['channels'][_0x4cf91b['uniqueid']])){this[_0xe8fe('0x3e')][_0x4cf91b['uniqueid']]={};}var _0x58d632=new QueueReport();_0x58d632[_0xe8fe('0x52')]=_0x4cf91b[_0xe8fe('0x52')];_0x58d632['type']=this['voiceQueues'][_0x58d632[_0xe8fe('0x52')]]&&this[_0xe8fe('0x15')][_0x58d632[_0xe8fe('0x52')]]['type']?this[_0xe8fe('0x15')][_0x58d632[_0xe8fe('0x52')]][_0xe8fe('0x6a')]||'inbound':_0xe8fe('0x5a');_0x58d632[_0xe8fe('0x76')]=moment()[_0xe8fe('0x57')](_0xe8fe('0x77'));_0x58d632['position']=_0x4cf91b[_0xe8fe('0x78')];_0x58d632['count']=_0x4cf91b[_0xe8fe('0x79')];_0x58d632['uniqueid']=_0x4cf91b['uniqueid'];_0x58d632[_0xe8fe('0x7a')]=this[_0xe8fe('0x3e')][_0x4cf91b[_0xe8fe('0x50')]][_0xe8fe('0x7a')];logger[_0xe8fe('0x7b')](_0xe8fe('0x7c'),_0x58d632[_0xe8fe('0x52')],_0x58d632[_0xe8fe('0x6a')]);Object[_0xe8fe('0x68')](_0x58d632,_[_0xe8fe('0x7d')](_0x4cf91b,_[_0xe8fe('0x7e')](_0x58d632)));this['queueReports'][_0x4cf91b['uniqueid']][_0xe8fe('0x70')](_0x58d632);this[_0xe8fe('0x3e')][_0x4cf91b[_0xe8fe('0x50')]]=_0x58d632;this['emitVoiceQueueChannelSave'](_0x58d632,'queuecallerjoin');}}catch(_0x47f976){logger[_0xe8fe('0x47')](_0xe8fe('0x75'),_0x4cf91b[_0xe8fe('0x50')],util[_0xe8fe('0x46')](_0x47f976,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe8fe('0xc')][_0xe8fe('0x21')]=function(_0x4ccdd7){try{if(this[_0xe8fe('0x71')](_0x4ccdd7)){logger[_0xe8fe('0x54')](_0xe8fe('0x7f'),_0x4ccdd7['uniqueid'],util[_0xe8fe('0x46')](_0x4ccdd7,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4ccdd7[_0xe8fe('0x50')]]){var _0x4f3883=_[_0xe8fe('0x80')](this[_0xe8fe('0x11')][_0x4ccdd7[_0xe8fe('0x50')]]);_0x4f3883[_0xe8fe('0x3c')]=![];_0x4f3883[_0xe8fe('0x81')]=null;_0x4f3883[_0xe8fe('0x82')]=_0x4ccdd7['holdtime'];_0x4f3883[_0xe8fe('0x83')]=_0x4ccdd7[_0xe8fe('0x83')];_0x4f3883['queuecallerabandon']=!![];_0x4f3883[_0xe8fe('0x84')]=moment()[_0xe8fe('0x57')](_0xe8fe('0x77'));_0x4f3883[_0xe8fe('0x85')]=_0xe8fe('0x86');_0x4f3883[_0xe8fe('0x87')]=null;logger['info'](_0xe8fe('0x88'),_0x4f3883[_0xe8fe('0x52')],_0x4f3883[_0xe8fe('0x6a')]);this[_0xe8fe('0x3e')][_0x4ccdd7['uniqueid']]=_0x4f3883;this[_0xe8fe('0x4b')](_0x4f3883,_0xe8fe('0x20'));}}}catch(_0x1b4f6b){logger['error']('[%s][voiceQueueReport][queuecallerabandon]',_0x4ccdd7['uniqueid'],util['inspect'](_0x1b4f6b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe8fe('0xc')]['syncQueueCallerLeave']=function(_0x5d5c66){try{if(this[_0xe8fe('0x71')](_0x5d5c66)){logger[_0xe8fe('0x54')]('[%s][voiceQueueReport][queuecallerleave]',_0x5d5c66[_0xe8fe('0x50')],util['inspect'](_0x5d5c66,{'showHidden':![],'depth':null}));if(this[_0xe8fe('0x11')][_0x5d5c66[_0xe8fe('0x50')]]){var _0x5ef964=_[_0xe8fe('0x80')](this[_0xe8fe('0x11')][_0x5d5c66[_0xe8fe('0x50')]]);_0x5ef964[_0xe8fe('0x89')]=moment()[_0xe8fe('0x57')](_0xe8fe('0x77'));_0x5ef964[_0xe8fe('0x8a')]=_0x5d5c66['connectedlinenum'];_0x5ef964['connectedlinename']=_0x5d5c66[_0xe8fe('0x8b')];logger[_0xe8fe('0x7b')](_0xe8fe('0x8c'),_0x5ef964['queue'],_0x5ef964[_0xe8fe('0x6a')],_0x5d5c66[_0xe8fe('0x8a')],_0x5d5c66[_0xe8fe('0x8b')]);this[_0xe8fe('0x3e')][_0x5d5c66[_0xe8fe('0x50')]]=_0x5ef964;this[_0xe8fe('0x8d')](_0x5ef964,_0xe8fe('0x22'));}}}catch(_0x2b272d){logger[_0xe8fe('0x47')](_0xe8fe('0x8e'),_0x5d5c66[_0xe8fe('0x50')],util['inspect'](_0x2b272d,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xe8fe('0x26')]=function(_0x2b7cb1){try{if(this[_0xe8fe('0x71')](_0x2b7cb1)){logger[_0xe8fe('0x54')](_0xe8fe('0x8f'),_0x2b7cb1[_0xe8fe('0x50')],util[_0xe8fe('0x46')](_0x2b7cb1,{'showHidden':![],'depth':null}));if(this[_0xe8fe('0x11')][_0x2b7cb1[_0xe8fe('0x50')]]){var _0x8c3983=_['last'](this['queueReports'][_0x2b7cb1[_0xe8fe('0x50')]]);_0x8c3983[_0xe8fe('0x3c')]=!![];_0x8c3983[_0xe8fe('0x85')]='COMPLETEDBYAGENT';logger[_0xe8fe('0x7b')](_0xe8fe('0x90'),_0x8c3983[_0xe8fe('0x52')],_0x8c3983[_0xe8fe('0x6a')]);}}}catch(_0x2a5fe4){logger['error'](_0xe8fe('0x8f'),_0x2b7cb1[_0xe8fe('0x50')],util[_0xe8fe('0x46')](_0x2a5fe4,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xe8fe('0x25')]=function(_0x9f1ff9){try{if(this['isNotNull'](_0x9f1ff9)){logger['debug']('[%s][voiceQueueReport][agentcomplete]',_0x9f1ff9['uniqueid'],util[_0xe8fe('0x46')](_0x9f1ff9,{'showHidden':![],'depth':null}));if(this[_0xe8fe('0x11')][_0x9f1ff9[_0xe8fe('0x50')]]){var _0x8e958c=_[_0xe8fe('0x80')](this[_0xe8fe('0x11')][_0x9f1ff9[_0xe8fe('0x50')]]);_0x8e958c[_0xe8fe('0x20')]=![];_0x8e958c[_0xe8fe('0x84')]=null;_0x8e958c[_0xe8fe('0x91')]=!![];_0x8e958c[_0xe8fe('0x87')]=_0x9f1ff9[_0xe8fe('0x92')];_0x8e958c[_0xe8fe('0x82')]=_0x9f1ff9[_0xe8fe('0x82')];_0x8e958c[_0xe8fe('0x3c')]=!![];_0x8e958c[_0xe8fe('0x3b')]=![];_0x8e958c[_0xe8fe('0x93')]=null;if(!_0x8e958c[_0xe8fe('0x94')]){if(_0x9f1ff9[_0xe8fe('0x95')]==_0xe8fe('0x94')){_0x8e958c[_0xe8fe('0x85')]=_0xe8fe('0x96');logger[_0xe8fe('0x7b')](_0xe8fe('0x97'),_0x8e958c[_0xe8fe('0x52')],_0x8e958c['type']);}else{if(_['startsWith'](_0x9f1ff9[_0xe8fe('0x42')][_0xe8fe('0x98')](),_0xe8fe('0x99'))){if(this[_0xe8fe('0x11')][_0x9f1ff9[_0xe8fe('0x9a')]]){var _0x5307d8=_['last'](this['queueReports'][_0x9f1ff9[_0xe8fe('0x9a')]]);_0x5307d8[_0xe8fe('0x3c')]=![];_0x5307d8[_0xe8fe('0x3b')]=!![];_0x5307d8['queuecallerexitAt']=moment(_0x8e958c[_0xe8fe('0x76')])[_0xe8fe('0x9b')](_0x9f1ff9['holdtime'],_0xe8fe('0x9c'))[_0xe8fe('0x57')](_0xe8fe('0x77'));_0x5307d8[_0xe8fe('0x85')]='FORWARDTRANSFER';_0x5307d8['transfer']=!![];_0x5307d8[_0xe8fe('0x9d')]=_0xe8fe('0x9e');_0x5307d8[_0xe8fe('0x9f')]=_0x9f1ff9[_0xe8fe('0xa0')];_0x5307d8[_0xe8fe('0xa1')]=_0x9f1ff9['uniqueid'];logger[_0xe8fe('0x7b')](_0xe8fe('0xa2'),_0x5307d8[_0xe8fe('0x52')],_0x5307d8[_0xe8fe('0x6a')]);var _0x1da70b=this[_0xe8fe('0x11')][_0x9f1ff9['linkedid']];this['queueReports'][_0x9f1ff9[_0xe8fe('0x9a')]]=this[_0xe8fe('0x11')][_0x9f1ff9[_0xe8fe('0x50')]];this[_0xe8fe('0x11')][_0x9f1ff9['uniqueid']]=_0x1da70b;}}else{_0x8e958c['queuecallerexitreason']=_0xe8fe('0xa3')+_0x9f1ff9[_0xe8fe('0x95')][_0xe8fe('0xa4')]();logger[_0xe8fe('0x7b')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x8e958c[_0xe8fe('0x52')],_0x8e958c[_0xe8fe('0x6a')],_0x8e958c['queuecallerexitreason']);}}}this['channels'][_0x9f1ff9[_0xe8fe('0x50')]]=_0x8e958c;this['emitVoiceQueueChannelRemove'](_0x8e958c,_0xe8fe('0x24'));}}}catch(_0x113a5c){logger['error'](_0xe8fe('0xa5'),_0x9f1ff9[_0xe8fe('0x50')],util[_0xe8fe('0x46')](_0x113a5c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe8fe('0xc')][_0xe8fe('0x28')]=function(_0x492e41){try{if(this[_0xe8fe('0x71')](_0x492e41)){logger[_0xe8fe('0x54')](_0xe8fe('0xa6'),_0x492e41[_0xe8fe('0x50')],util[_0xe8fe('0x46')](_0x492e41,{'showHidden':![],'depth':null}));this[_0xe8fe('0xa7')](_0x492e41[_0xe8fe('0x50')],_[_0xe8fe('0x7e')](_0x492e41['variable'])[0x0],_0x492e41[_0xe8fe('0xa8')]);if(this[_0xe8fe('0x11')][_0x492e41['uniqueid']]){var _0x2aeec4=_[_0xe8fe('0x80')](this[_0xe8fe('0x11')][_0x492e41['uniqueid']]);if(_0x2aeec4){if(this[_0xe8fe('0x71')](_0x492e41[_0xe8fe('0xa9')])&&this[_0xe8fe('0x71')](_0x492e41[_0xe8fe('0xa9')][_0xe8fe('0x62')])){switch(_0x492e41['value']){case'CONTINUE':_0x2aeec4[_0xe8fe('0x3b')]=![];_0x2aeec4['queuecallerexitAt']=null;break;case _0xe8fe('0xaa'):_0x2aeec4[_0xe8fe('0xab')]='timeout';_0x2aeec4[_0xe8fe('0x3b')]=!![];_0x2aeec4['queuecallerexitAt']=moment()[_0xe8fe('0x57')]('YYYY-MM-DD\x20HH:mm:ss');_0x2aeec4['queuecallerleaveAt']=moment()[_0xe8fe('0x57')](_0xe8fe('0x77'));logger[_0xe8fe('0x54')](_0xe8fe('0xac'),_0x492e41[_0xe8fe('0x50')],util[_0xe8fe('0x46')](_0x2aeec4,{'showHidden':![],'depth':null}));ami['emit'](_0xe8fe('0xad'),_0x2aeec4);break;default:_0x2aeec4[_0xe8fe('0x3b')]=!![];_0x2aeec4[_0xe8fe('0x93')]=moment()['format'](_0xe8fe('0x77'));_0x2aeec4[_0xe8fe('0x89')]=moment()[_0xe8fe('0x57')](_0xe8fe('0x77'));}_0x2aeec4[_0xe8fe('0x20')]=![];_0x2aeec4['queuecallerabandonAt']=null;_0x2aeec4[_0xe8fe('0x85')]=_0x492e41[_0xe8fe('0xa8')];this[_0xe8fe('0x3e')][_0x492e41[_0xe8fe('0x50')]]=_0x2aeec4;this['emitVoiceQueueChannelRemove'](_0x2aeec4,_0xe8fe('0x27'));}else if(this[_0xe8fe('0x71')](_0x492e41[_0xe8fe('0xa9')])&&this[_0xe8fe('0x71')](_0x492e41[_0xe8fe('0xa9')]['queueposition'])){if(!_0x2aeec4[_0xe8fe('0x20')]){_0x2aeec4['queuecallerexit']=!![];_0x2aeec4['queuecallerexitAt']=moment()[_0xe8fe('0x57')]('YYYY-MM-DD\x20HH:mm:ss');_0x2aeec4[_0xe8fe('0x85')]=_0xe8fe('0xae');_0x2aeec4[_0xe8fe('0x89')]=moment()[_0xe8fe('0x57')](_0xe8fe('0x77'));this[_0xe8fe('0x3e')][_0x492e41[_0xe8fe('0x50')]]=_0x2aeec4;}}logger['info'](_0xe8fe('0xaf'),_0x492e41[_0xe8fe('0x50')],_0x2aeec4[_0xe8fe('0x52')],_0x2aeec4[_0xe8fe('0x6a')],_[_0xe8fe('0x7e')](_0x492e41[_0xe8fe('0xa9')])[0x0],_0x492e41[_0xe8fe('0xa8')]);_0x2aeec4[_0xe8fe('0x17')]=this[_0xe8fe('0x17')][_0x492e41[_0xe8fe('0x50')]];}}}}catch(_0xc6b7c1){logger[_0xe8fe('0x47')](_0xe8fe('0xa6'),_0x492e41[_0xe8fe('0x50')],util[_0xe8fe('0x46')](_0xc6b7c1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe8fe('0xc')][_0xe8fe('0xa7')]=function(_0x1830c3,_0x2c1ec2,_0x38a613){var _0x43f9f9=[_0xe8fe('0xb0'),_0xe8fe('0xb1'),_0xe8fe('0xb2'),_0xe8fe('0xb3'),_0xe8fe('0xb4'),'rtpaudioqoslossbridged','rtpaudioqosrtt',_0xe8fe('0xb5'),_0xe8fe('0xb6'),_0xe8fe('0xb7'),'bridgepeer',_0xe8fe('0xb8'),_0xe8fe('0xb9'),_0xe8fe('0xba'),_0xe8fe('0xbb'),_0xe8fe('0xbc'),_0xe8fe('0x92'),'memberpenalty',_0xe8fe('0xbd')];if(!_['isNil'](_0x2c1ec2)&&!_[_0xe8fe('0xbe')](_0x43f9f9,_0x2c1ec2)){if(_[_0xe8fe('0x5d')](this['variables'][_0x1830c3])){this['variables'][_0x1830c3]={};}this[_0xe8fe('0x17')][_0x1830c3][_0x2c1ec2]=_0x38a613;}};VoiceQueueReport[_0xe8fe('0xc')][_0xe8fe('0xbf')]=function(_0x55f455,_0x2bc300,_0x660820){var _0x38d0ce={};for(var _0x5ed23a=0x0;_0x5ed23a=0x0?moment(_0x6cd013[_0xae29('0x14')])[_0xae29('0xb')](_0x6cd013[_0xae29('0x15')],_0xae29('0xc')):null,'data1':'outbound','data2':_0x6cd013[_0xae29('0x11')],'data3':_0x6cd013['exten'],'data4':_0x6cd013[_0xae29('0x16')]||null,'role':_0xae29('0x10'),'internal':_0x6cd013[_0xae29('0x11')]?_[_0xae29('0x17')](_0x6cd013[_0xae29('0x11')]):undefined,'uniqueid':_0x6cd013[_0xae29('0x18')]},'log':_0xae29('0x4')});}; \ No newline at end of file +var _0xeb33=['lodash','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','isNil','interface','TALKING','queuecallerleaveAt','diff','inbound','calleridnum','exten','queue','agent','accountcode','toNumber','uniqueid','CreateMemberReport','Request','voice','membername','starttime','endtime','seconds','outbound','dialstring','moment'];(function(_0x13b7fd,_0x4eaf7f){var _0x32a74a=function(_0x2c5d80){while(--_0x2c5d80){_0x13b7fd['push'](_0x13b7fd['shift']());}};_0x32a74a(++_0x4eaf7f);}(_0xeb33,0x73));var _0x3eb3=function(_0x4062c8,_0x17e6df){_0x4062c8=_0x4062c8-0x0;var _0xce2127=_0xeb33[_0x4062c8];return _0xce2127;};'use strict';var moment=require(_0x3eb3('0x0'));var _=require(_0x3eb3('0x1'));var util=require(_0x3eb3('0x2'));var client=require(_0x3eb3('0x3'));exports[_0x3eb3('0x4')]=function(_0x2f7de8){var _0x242832=_0x2f7de8[_0x3eb3('0x5')]||_0x2f7de8[_0x3eb3('0x6')];return client['Request']('CreateMemberReport',{'body':{'channel':'voice','membername':_0x2f7de8['lastAssignedTo'],'interface':_[_0x3eb3('0x7')](_0x2f7de8[_0x3eb3('0x8')])?util['format']('SIP/%s',_0x2f7de8['lastAssignedTo']):_0x2f7de8[_0x3eb3('0x8')],'type':_0x3eb3('0x9'),'enterAt':_0x2f7de8[_0x3eb3('0xa')],'exitAt':_0x242832,'duration':moment(_0x242832)[_0x3eb3('0xb')](_0x2f7de8[_0x3eb3('0xa')],'seconds'),'data1':_0x3eb3('0xc'),'data2':_0x2f7de8[_0x3eb3('0xd')],'data3':_0x2f7de8[_0x3eb3('0xe')],'data4':null,'data5':_0x2f7de8[_0x3eb3('0xf')],'role':_0x3eb3('0x10'),'internal':_0x2f7de8[_0x3eb3('0x11')]?_[_0x3eb3('0x12')](_0x2f7de8[_0x3eb3('0x11')]):undefined,'uniqueid':_0x2f7de8[_0x3eb3('0x13')]},'log':_0x3eb3('0x14')});};exports['voiceDialReport']=function(_0x2f0563){return client[_0x3eb3('0x15')](_0x3eb3('0x14'),{'body':{'channel':_0x3eb3('0x16'),'membername':_0x2f0563[_0x3eb3('0x17')],'interface':_0x2f0563[_0x3eb3('0x8')],'type':_0x3eb3('0x9'),'enterAt':_0x2f0563[_0x3eb3('0x18')],'exitAt':_0x2f0563[_0x3eb3('0x19')],'duration':moment(_0x2f0563['endtime'])[_0x3eb3('0xb')](_0x2f0563[_0x3eb3('0x18')],_0x3eb3('0x1a'))>=0x0?moment(_0x2f0563[_0x3eb3('0x19')])[_0x3eb3('0xb')](_0x2f0563[_0x3eb3('0x18')],_0x3eb3('0x1a')):null,'data1':_0x3eb3('0x1b'),'data2':_0x2f0563['accountcode'],'data3':_0x2f0563['exten'],'data4':_0x2f0563[_0x3eb3('0x1c')]||null,'role':'agent','internal':_0x2f0563[_0x3eb3('0x11')]?_['toNumber'](_0x2f0563['accountcode']):undefined,'uniqueid':_0x2f0563['uniqueid']},'log':_0x3eb3('0x14')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index cf8a0bf..a92b7da 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 _0x2a84=['ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','../client','getSettings'];(function(_0x51948f,_0x29dc22){var _0x5e8d81=function(_0x3ff9f1){while(--_0x3ff9f1){_0x51948f['push'](_0x51948f['shift']());}};_0x5e8d81(++_0x29dc22);}(_0x2a84,0x170));var _0x42a8=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x2a84[_0x501510];return _0x1e6ee5;};'use strict';var client=require(_0x42a8('0x0'));exports[_0x42a8('0x1')]=function(){return client['Request'](_0x42a8('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x42a8('0x3'),_0x42a8('0x4')]},'log':'GetSettings'});}; \ No newline at end of file +var _0x0833=['../client','getSettings','Request','ShowSetting','stopRecordingOnTransfer'];(function(_0x16a69f,_0xe4f30f){var _0x55728e=function(_0x75d573){while(--_0x75d573){_0x16a69f['push'](_0x16a69f['shift']());}};_0x55728e(++_0xe4f30f);}(_0x0833,0x1bd));var _0x3083=function(_0x338bbe,_0x59d53d){_0x338bbe=_0x338bbe-0x0;var _0xdbf323=_0x0833[_0x338bbe];return _0xdbf323;};'use strict';var client=require(_0x3083('0x0'));exports[_0x3083('0x1')]=function(){return client[_0x3083('0x2')](_0x3083('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x3083('0x4'),'previewRecallmeReminderInterval']},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index ce77b1d..16775e3 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 _0xcddb=['getTemplates','Request','GetTemplate','name','html','../client'];(function(_0x22cbb6,_0x39a4b3){var _0x34aa10=function(_0x4529c6){while(--_0x4529c6){_0x22cbb6['push'](_0x22cbb6['shift']());}};_0x34aa10(++_0x39a4b3);}(_0xcddb,0x155));var _0xbcdd=function(_0x308ce9,_0x9f5688){_0x308ce9=_0x308ce9-0x0;var _0x47623e=_0xcddb[_0x308ce9];return _0x47623e;};'use strict';var client=require(_0xbcdd('0x0'));exports[_0xbcdd('0x1')]=function(_0x201e63){return function(_0x122c5c){return client[_0xbcdd('0x2')](_0xbcdd('0x3'),{'options':{'raw':!![],'attributes':['id',_0xbcdd('0x4'),_0xbcdd('0x5')]},'log':_0xbcdd('0x3')});};}; \ No newline at end of file +var _0xe44d=['name','html','../client','Request','GetTemplate'];(function(_0x3fbc08,_0x3b8845){var _0x42299e=function(_0x1a130d){while(--_0x1a130d){_0x3fbc08['push'](_0x3fbc08['shift']());}};_0x42299e(++_0x3b8845);}(_0xe44d,0xc0));var _0xde44=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xe44d[_0x29d94e];return _0x106237;};'use strict';var client=require(_0xde44('0x0'));exports['getTemplates']=function(_0x34973f){return function(_0xc56c8f){return client[_0xde44('0x1')](_0xde44('0x2'),{'options':{'raw':!![],'attributes':['id',_0xde44('0x3'),_0xde44('0x4')]},'log':_0xde44('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index f6dc4d0..d2d0342 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 _0x002d=['Actions','data1','data3','data4','data5','data6','data7','GetTrigger','../client','getTriggers','Request','status','Condition','operator','value','AnyConditions','field','Action'];(function(_0x4c263e,_0x52c2cf){var _0x1ebd1d=function(_0x5b9151){while(--_0x5b9151){_0x4c263e['push'](_0x4c263e['shift']());}};_0x1ebd1d(++_0x52c2cf);}(_0x002d,0x182));var _0xd002=function(_0x34266e,_0xe8c6c7){_0x34266e=_0x34266e-0x0;var _0x41eefd=_0x002d[_0x34266e];return _0x41eefd;};'use strict';var client=require(_0xd002('0x0'));exports[_0xd002('0x1')]=function(_0x99a839){return function(_0x5d4ff5){return client[_0xd002('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id','name','channel',_0xd002('0x3')],'include':[{'model':_0xd002('0x4'),'as':'AllConditions','attributes':['id','field',_0xd002('0x5'),_0xd002('0x6')]},{'model':'Condition','as':_0xd002('0x7'),'attributes':['id',_0xd002('0x8'),_0xd002('0x5'),_0xd002('0x6')]},{'model':_0xd002('0x9'),'as':_0xd002('0xa'),'attributes':['id','action',_0xd002('0xb'),'data2',_0xd002('0xc'),_0xd002('0xd'),_0xd002('0xe'),_0xd002('0xf'),_0xd002('0x10')]}]},'log':_0xd002('0x11')});};}; \ No newline at end of file +var _0xf833=['field','Action','Actions','action','data1','data2','data3','data4','data7','GetTrigger','Request','Condition','AllConditions','operator','value','AnyConditions'];(function(_0x12767f,_0x41b198){var _0x29b55f=function(_0x1b3a8a){while(--_0x1b3a8a){_0x12767f['push'](_0x12767f['shift']());}};_0x29b55f(++_0x41b198);}(_0xf833,0x1aa));var _0x3f83=function(_0x5bfc44,_0x319a4f){_0x5bfc44=_0x5bfc44-0x0;var _0x3cddc1=_0xf833[_0x5bfc44];return _0x3cddc1;};'use strict';var client=require('../client');exports['getTriggers']=function(_0x2641c2){return function(_0x4bf777){return client[_0x3f83('0x0')]('GetTrigger',{'options':{'raw':![],'attributes':['id','name','channel','status'],'include':[{'model':_0x3f83('0x1'),'as':_0x3f83('0x2'),'attributes':['id','field',_0x3f83('0x3'),_0x3f83('0x4')]},{'model':_0x3f83('0x1'),'as':_0x3f83('0x5'),'attributes':['id',_0x3f83('0x6'),'operator',_0x3f83('0x4')]},{'model':_0x3f83('0x7'),'as':_0x3f83('0x8'),'attributes':['id',_0x3f83('0x9'),_0x3f83('0xa'),_0x3f83('0xb'),_0x3f83('0xc'),_0x3f83('0xd'),'data5','data6',_0x3f83('0xe')]}]},'log':_0x3f83('0xf')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 87cfd21..7093f4c 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 _0x62c8=['defaultuser','GetTrunk','name','registry'];(function(_0x1b06f0,_0x311860){var _0x42f076=function(_0x1b3b2e){while(--_0x1b3b2e){_0x1b06f0['push'](_0x1b06f0['shift']());}};_0x42f076(++_0x311860);}(_0x62c8,0x1ad));var _0x862c=function(_0x31146a,_0x3e505e){_0x31146a=_0x31146a-0x0;var _0x79ddf1=_0x62c8[_0x31146a];return _0x79ddf1;};'use strict';var client=require('../client');exports['getTrunks']=function(_0x365036){return function(_0x5f1e0f){return client['Request'](_0x862c('0x0'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x862c('0x1'),_0x862c('0x2'),_0x862c('0x3')]},'log':_0x862c('0x0')});};}; \ No newline at end of file +var _0x493b=['../client','GetTrunk','name'];(function(_0x20dd60,_0x33d1dd){var _0x303ece=function(_0x2248fb){while(--_0x2248fb){_0x20dd60['push'](_0x20dd60['shift']());}};_0x303ece(++_0x33d1dd);}(_0x493b,0x1b9));var _0xb493=function(_0xf31403,_0xfa2757){_0xf31403=_0xf31403-0x0;var _0x47d7b8=_0x493b[_0xf31403];return _0x47d7b8;};'use strict';var client=require(_0xb493('0x0'));exports['getTrunks']=function(_0xc8cc3a){return function(_0x173aa3){return client['Request'](_0xb493('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xb493('0x2'),'registry','defaultuser']},'log':_0xb493('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index be89ff8..0fd9e27 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 _0xcb91=['UnpauseUser','getAgent','ShowUser','email','lastPauseAt','Request','GetUser','agent','name','accountcode','fullname','lastLoginAt','pauseType','voicePause','phone','interface','getAgents','internal','getTelephones','savePause','PauseUser'];(function(_0x3a203e,_0x54d253){var _0x3c7db2=function(_0xad192e){while(--_0xad192e){_0x3a203e['push'](_0x3a203e['shift']());}};_0x3c7db2(++_0x54d253);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x16539a,_0x31409a){_0x16539a=_0x16539a-0x0;var _0x200796=_0xcb91[_0x16539a];return _0x200796;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2')},'attributes':['id',_0x1cb9('0x3'),'email',_0x1cb9('0x4'),_0x1cb9('0x5'),'online',_0x1cb9('0x6'),_0x1cb9('0x7'),'lastPauseAt',_0x1cb9('0x8'),_0x1cb9('0x9'),'mobile',_0x1cb9('0xa')]},'log':_0x1cb9('0xb')});};};exports['getTelephones']=function(){return function(){return client[_0x1cb9('0x0')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x4'),_0x1cb9('0xc')]},'log':_0x1cb9('0xd')});};};exports[_0x1cb9('0xe')]=function(_0x50ce71,_0x9b58f1,_0x44a6b4){return client[_0x1cb9('0x0')](_0x1cb9('0xf'),{'body':{'type':_0x9b58f1,'uniqueid':_0x44a6b4},'options':{'where':{'id':_0x50ce71['id']}},'log':_0x1cb9('0xe')});};exports['saveUnpause']=function(_0x5e3c19){return client['Request'](_0x1cb9('0x10'),{'body':{},'options':{'where':{'id':_0x5e3c19['id']}},'log':_0x1cb9('0xe')});};exports[_0x1cb9('0x11')]=function(_0x1c714f){return client['Request'](_0x1cb9('0x12'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2'),'id':_0x1c714f},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x13'),_0x1cb9('0x4'),'fullname','online',_0x1cb9('0x6'),_0x1cb9('0x7'),_0x1cb9('0x14'),_0x1cb9('0x8'),_0x1cb9('0xa')]},'log':_0x1cb9('0x11')});}; \ No newline at end of file +var _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x4de995,_0xf56718){var _0x3d7a14=function(_0x1c9d79){while(--_0x1c9d79){_0x4de995['push'](_0x4de995['shift']());}};_0x3d7a14(++_0xf56718);}(_0x9c44,0x178));var _0x49c4=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x9c44[_0x3d42d8];return _0x27fc41;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2')},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5'),'fullname','online',_0x49c4('0x6'),'pauseType',_0x49c4('0x7'),_0x49c4('0x8'),_0x49c4('0x9'),_0x49c4('0xa'),_0x49c4('0xb')]},'log':'getAgents'});};};exports[_0x49c4('0xc')]=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'where':{'role':_0x49c4('0xd')},'attributes':['id','name','accountcode',_0x49c4('0xe')]},'log':_0x49c4('0xc')});};};exports['savePause']=function(_0xb611a1,_0x459d09,_0x4adb3c){return client['Request'](_0x49c4('0xf'),{'body':{'type':_0x459d09,'uniqueid':_0x4adb3c},'options':{'where':{'id':_0xb611a1['id']}},'log':_0x49c4('0x10')});};exports['saveUnpause']=function(_0x7df3a9){return client[_0x49c4('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x7df3a9['id']}},'log':_0x49c4('0x10')});};exports[_0x49c4('0x11')]=function(_0x21f15a){return client[_0x49c4('0x0')](_0x49c4('0x12'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2'),'id':_0x21f15a},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),'accountcode',_0x49c4('0x13'),_0x49c4('0x14'),_0x49c4('0x6'),_0x49c4('0x15'),_0x49c4('0x7'),'voicePause',_0x49c4('0xb')]},'log':_0x49c4('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index eb302e1..d621c6b 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 _0x7040=['CreateVoiceAgentReport','UpdateVoiceAgentReport','create','Request'];(function(_0x14f959,_0x47f64d){var _0x31de4c=function(_0x3d2dc3){while(--_0x3d2dc3){_0x14f959['push'](_0x14f959['shift']());}};_0x31de4c(++_0x47f64d);}(_0x7040,0x66));var _0x0704=function(_0x476968,_0x173cd3){_0x476968=_0x476968-0x0;var _0x3ceb10=_0x7040[_0x476968];return _0x3ceb10;};'use strict';var client=require('../client');exports[_0x0704('0x0')]=function(_0x360ec7){return client[_0x0704('0x1')](_0x0704('0x2'),{'body':_0x360ec7,'log':_0x0704('0x2')});};exports['update']=function(_0x41fcb6,_0x39786a,_0x2e8f87){return client['Request'](_0x0704('0x3'),{'body':_0x41fcb6,'options':{'where':{'uniqueid':_0x39786a,'interface':_0x2e8f87,'agentcomplete':!![]}},'log':_0x0704('0x3')});}; \ No newline at end of file +var _0xdf7f=['Request','CreateVoiceAgentReport','update','../client','create'];(function(_0x3e4e06,_0x577430){var _0x58e857=function(_0x19dc70){while(--_0x19dc70){_0x3e4e06['push'](_0x3e4e06['shift']());}};_0x58e857(++_0x577430);}(_0xdf7f,0x7b));var _0xfdf7=function(_0x117643,_0x2b3351){_0x117643=_0x117643-0x0;var _0x4f9ce1=_0xdf7f[_0x117643];return _0x4f9ce1;};'use strict';var client=require(_0xfdf7('0x0'));exports[_0xfdf7('0x1')]=function(_0x1a5708){return client[_0xfdf7('0x2')]('CreateVoiceAgentReport',{'body':_0x1a5708,'log':_0xfdf7('0x3')});};exports[_0xfdf7('0x4')]=function(_0x3e49c7,_0x1f46c1,_0x3235d7){return client['Request']('UpdateVoiceAgentReport',{'body':_0x3e49c7,'options':{'where':{'uniqueid':_0x1f46c1,'interface':_0x3235d7,'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 ea58806..3a3cb09 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 _0xea8c=['endOf','type','disposition','duration','GetVoiceCallReports','moment','util','lodash','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','getVoiceCallReports','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x227eaa,_0x4f083d){var _0x224a4c=function(_0x40b87f){while(--_0x40b87f){_0x227eaa['push'](_0x227eaa['shift']());}};_0x224a4c(++_0x4f083d);}(_0xea8c,0x1e5));var _0xcea8=function(_0x19f7ab,_0x5b0dc9){_0x19f7ab=_0x19f7ab-0x0;var _0x6b42e=_0xea8c[_0x19f7ab];return _0x6b42e;};'use strict';var moment=require(_0xcea8('0x0'));var util=require(_0xcea8('0x1'));var _=require(_0xcea8('0x2'));var client=require('../client');exports['create']=function(_0x2312d3){return client[_0xcea8('0x3')](_0xcea8('0x4'),{'body':_[_0xcea8('0x5')](_0x2312d3,{'source':_0x2312d3[_0xcea8('0x6')],'destinationcontext':_0x2312d3[_0xcea8('0x7')],'callerid':_0x2312d3[_0xcea8('0x8')],'amaflags':'DOCUMENTATION'}),'log':_0xcea8('0x4')});};exports[_0xcea8('0x9')]=function(){return function(){return client['Request']('GetVoiceCallReport',{'options':{'where':{'type':[_0xcea8('0xa')],'createdAt':{'$between':[moment()[_0xcea8('0xb')](_0xcea8('0xc'))[_0xcea8('0xd')](_0xcea8('0xe')),moment()[_0xcea8('0xf')](_0xcea8('0xc'))[_0xcea8('0xd')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0xcea8('0x10'),_0xcea8('0x11'),_0xcea8('0x12'),'billableseconds']},'log':_0xcea8('0x13')});};}; \ No newline at end of file +var _0xd581=['context','callerid','DOCUMENTATION','CreateVoiceCallReport','getVoiceCallReports','Request','GetVoiceCallReport','outbound','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','duration','GetVoiceCallReports','util','../client','merge','calleridnum'];(function(_0x1cfca1,_0x165c1f){var _0x2ab941=function(_0x2ce9f0){while(--_0x2ce9f0){_0x1cfca1['push'](_0x1cfca1['shift']());}};_0x2ab941(++_0x165c1f);}(_0xd581,0x81));var _0x1d58=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xd581[_0x35885a];return _0xe86249;};'use strict';var moment=require('moment');var util=require(_0x1d58('0x0'));var _=require('lodash');var client=require(_0x1d58('0x1'));exports['create']=function(_0x2f8a4f){return client['Request']('CreateVoiceCallReport',{'body':_[_0x1d58('0x2')](_0x2f8a4f,{'source':_0x2f8a4f[_0x1d58('0x3')],'destinationcontext':_0x2f8a4f[_0x1d58('0x4')],'callerid':_0x2f8a4f[_0x1d58('0x5')],'amaflags':_0x1d58('0x6')}),'log':_0x1d58('0x7')});};exports[_0x1d58('0x8')]=function(){return function(){return client[_0x1d58('0x9')](_0x1d58('0xa'),{'options':{'where':{'type':[_0x1d58('0xb')],'createdAt':{'$between':[moment()['startOf'](_0x1d58('0xc'))[_0x1d58('0xd')](_0x1d58('0xe')),moment()[_0x1d58('0xf')](_0x1d58('0xc'))[_0x1d58('0xd')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x1d58('0x10'),'disposition',_0x1d58('0x11'),'billableseconds']},'log':_0x1d58('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 1a26298..817c040 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 _0xfd6e=['../client','create','Request','CreateVoiceDialReport'];(function(_0x574617,_0x42eccc){var _0x29de90=function(_0x367aff){while(--_0x367aff){_0x574617['push'](_0x574617['shift']());}};_0x29de90(++_0x42eccc);}(_0xfd6e,0x11c));var _0xefd6=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xfd6e[_0x2641f9];return _0x585741;};'use strict';var client=require(_0xefd6('0x0'));exports[_0xefd6('0x1')]=function(_0x5e8276){return client[_0xefd6('0x2')]('CreateVoiceDialReport',{'body':_0x5e8276,'log':_0xefd6('0x3')});}; \ No newline at end of file +var _0x5b20=['CreateVoiceDialReport','Request'];(function(_0x118561,_0x3bd7cb){var _0x4b614a=function(_0xe68c26){while(--_0xe68c26){_0x118561['push'](_0x118561['shift']());}};_0x4b614a(++_0x3bd7cb);}(_0x5b20,0x1b5));var _0x05b2=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x5b20[_0x178e48];return _0x440d7e;};'use strict';var client=require('../client');exports['create']=function(_0x5a97f9){return client[_0x05b2('0x0')](_0x05b2('0x1'),{'body':_0x5a97f9,'log':_0x05b2('0x1')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 182b1f7..1fd5753 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 _0xc6fe=['GetVoiceExtension','exten','recordingFormat','../client','getVoiceExtensions'];(function(_0x330447,_0x11d721){var _0x58a935=function(_0x2edbac){while(--_0x2edbac){_0x330447['push'](_0x330447['shift']());}};_0x58a935(++_0x11d721);}(_0xc6fe,0xbc));var _0xec6f=function(_0x5d280c,_0x29ae94){_0x5d280c=_0x5d280c-0x0;var _0xf767af=_0xc6fe[_0x5d280c];return _0xf767af;};'use strict';var client=require(_0xec6f('0x0'));exports[_0xec6f('0x1')]=function(){return function(){return client['Request'](_0xec6f('0x2'),{'options':{'raw':!![],'attributes':['id',_0xec6f('0x3'),_0xec6f('0x4')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0x6b24=['GetVoiceExtension','exten','getVoiceExtensions','Request'];(function(_0x2cfd49,_0x3cb610){var _0x1d0cd7=function(_0x4ced7a){while(--_0x4ced7a){_0x2cfd49['push'](_0x2cfd49['shift']());}};_0x1d0cd7(++_0x3cb610);}(_0x6b24,0x1ce));var _0x46b2=function(_0x200af4,_0x8416e8){_0x200af4=_0x200af4-0x0;var _0x3831b6=_0x6b24[_0x200af4];return _0x3831b6;};'use strict';var client=require('../client');exports[_0x46b2('0x0')]=function(){return function(){return client[_0x46b2('0x1')](_0x46b2('0x2'),{'options':{'raw':!![],'attributes':['id',_0x46b2('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 9260e1a..6a4401c 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 _0x642a=['dialPreviewRecallmeReminder','Trunk','callerid','active','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialGlobalMaxRetry','dialTimezone','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe'];(function(_0x53afdb,_0x2e743a){var _0x1cb9f3=function(_0x50213d){while(--_0x50213d){_0x53afdb['push'](_0x53afdb['shift']());}};_0x1cb9f3(++_0x2e743a);}(_0x642a,0x1f0));var _0xa642=function(_0x1b5d53,_0x2f6d1c){_0x1b5d53=_0x1b5d53-0x0;var _0x2e968=_0x642a[_0x1b5d53];return _0x2e968;};'use strict';var client=require(_0xa642('0x0'));exports[_0xa642('0x1')]=function(){return function(){return client[_0xa642('0x2')](_0xa642('0x3'),{'options':{'raw':![],'attributes':['id',_0xa642('0x4'),_0xa642('0x5'),_0xa642('0x6'),_0xa642('0x7'),_0xa642('0x8'),_0xa642('0x9'),_0xa642('0xa'),_0xa642('0xb'),_0xa642('0xc'),_0xa642('0xd'),_0xa642('0xe'),'dialPredictiveOptimization',_0xa642('0xf'),_0xa642('0x10'),_0xa642('0x11'),_0xa642('0x12'),'dialOriginateTimeout',_0xa642('0x13'),_0xa642('0x14'),_0xa642('0x15'),_0xa642('0x16'),'dialCongestionRetryFrequency',_0xa642('0x17'),'dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency',_0xa642('0x18'),_0xa642('0x19'),'dialGlobalInterval',_0xa642('0x1a'),'dialCheckDuplicateType',_0xa642('0x1b'),_0xa642('0x1c'),'dialAMDGreeting',_0xa642('0x1d'),_0xa642('0x1e'),_0xa642('0x1f'),_0xa642('0x20'),_0xa642('0x21'),_0xa642('0x22'),'dialAMDMaximumWordLength',_0xa642('0x23'),_0xa642('0x24'),_0xa642('0x25'),_0xa642('0x26'),_0xa642('0x27'),_0xa642('0x28'),_0xa642('0x29'),_0xa642('0x8'),'strategy','dialRandomLastDigitCallerIdNumber',_0xa642('0x2a'),'dialNoSuchNumberMaxRetry',_0xa642('0x2b'),_0xa642('0x2c'),_0xa642('0x2d'),'dialAbandonedMaxRetry',_0xa642('0x2e'),'dialMachineMaxRetry','dialMachineRetryFrequency',_0xa642('0x2f'),_0xa642('0x30'),_0xa642('0x31'),_0xa642('0x32'),_0xa642('0x33'),_0xa642('0x34'),_0xa642('0x35')],'include':[{'model':_0xa642('0x36'),'as':_0xa642('0x36'),'attributes':['id',_0xa642('0x4'),_0xa642('0x37'),_0xa642('0x38')]},{'model':'Pause','as':_0xa642('0x39'),'attributes':['id',_0xa642('0x4')]},{'model':_0xa642('0x36'),'as':_0xa642('0x3a'),'attributes':['id',_0xa642('0x4'),'callerid',_0xa642('0x38')]},{'model':_0xa642('0x3b'),'as':'Interval','attributes':['id',_0xa642('0x4')],'include':[{'model':_0xa642('0x3b'),'as':_0xa642('0x3c'),'attributes':['id',_0xa642('0x4'),'interval']}]}]},'log':_0xa642('0x1')});};}; \ No newline at end of file +var _0xd4b3=['dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','name','acw','acwTimeout','autopause','monitor_format','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence'];(function(_0x1e2f72,_0x4ecd3d){var _0x2f00a8=function(_0xf1ee63){while(--_0xf1ee63){_0x1e2f72['push'](_0x1e2f72['shift']());}};_0x2f00a8(++_0x4ecd3d);}(_0xd4b3,0xa8));var _0x3d4b=function(_0x14c948,_0xd8f51e){_0x14c948=_0x14c948-0x0;var _0x1c1f69=_0xd4b3[_0x14c948];return _0x1c1f69;};'use strict';var client=require(_0x3d4b('0x0'));exports[_0x3d4b('0x1')]=function(){return function(){return client[_0x3d4b('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x3d4b('0x3'),_0x3d4b('0x4'),_0x3d4b('0x5'),_0x3d4b('0x6'),_0x3d4b('0x7'),'type','dialActive','dialMethod',_0x3d4b('0x8'),_0x3d4b('0x9'),_0x3d4b('0xa'),_0x3d4b('0xb'),_0x3d4b('0xc'),_0x3d4b('0xd'),_0x3d4b('0xe'),_0x3d4b('0xf'),'dialOriginateTimeout',_0x3d4b('0x10'),_0x3d4b('0x11'),_0x3d4b('0x12'),'dialCongestionMaxRetry',_0x3d4b('0x13'),'dialBusyMaxRetry',_0x3d4b('0x14'),_0x3d4b('0x15'),_0x3d4b('0x16'),_0x3d4b('0x17'),'dialTimezone','dialGlobalInterval','dialPrefix',_0x3d4b('0x18'),_0x3d4b('0x19'),_0x3d4b('0x1a'),_0x3d4b('0x1b'),_0x3d4b('0x1c'),_0x3d4b('0x1d'),_0x3d4b('0x1e'),_0x3d4b('0x1f'),_0x3d4b('0x20'),_0x3d4b('0x21'),_0x3d4b('0x22'),_0x3d4b('0x23'),_0x3d4b('0x24'),'dialRecallInQueue',_0x3d4b('0x25'),_0x3d4b('0x26'),_0x3d4b('0x27'),_0x3d4b('0x28'),_0x3d4b('0x7'),_0x3d4b('0x29'),_0x3d4b('0x2a'),_0x3d4b('0x2b'),_0x3d4b('0x2c'),_0x3d4b('0x2d'),_0x3d4b('0x2e'),'dialDropRetryFrequency',_0x3d4b('0x2f'),'dialAbandonedRetryFrequency',_0x3d4b('0x30'),_0x3d4b('0x31'),_0x3d4b('0x32'),_0x3d4b('0x33'),_0x3d4b('0x34'),'dialPredictiveIntervalMaxThreshold',_0x3d4b('0x35'),_0x3d4b('0x36'),_0x3d4b('0x37')],'include':[{'model':'Trunk','as':_0x3d4b('0x38'),'attributes':['id',_0x3d4b('0x3'),_0x3d4b('0x39'),_0x3d4b('0x3a')]},{'model':_0x3d4b('0x3b'),'as':_0x3d4b('0x3c'),'attributes':['id',_0x3d4b('0x3')]},{'model':'Trunk','as':_0x3d4b('0x3d'),'attributes':['id',_0x3d4b('0x3'),_0x3d4b('0x39'),_0x3d4b('0x3a')]},{'model':_0x3d4b('0x3e'),'as':_0x3d4b('0x3e'),'attributes':['id',_0x3d4b('0x3')],'include':[{'model':'Interval','as':_0x3d4b('0x3f'),'attributes':['id',_0x3d4b('0x3'),_0x3d4b('0x40')]}]}]},'log':_0x3d4b('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index f3765e4..1761a5e 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(_0x5e187d,_0x3dcb52){var _0x43ce7a=function(_0x1fc5dd){while(--_0x1fc5dd){_0x5e187d['push'](_0x5e187d['shift']());}};_0x43ce7a(++_0x3dcb52);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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(_0x4d4e35,_0x3ad9e0){var _0x26031d=function(_0x58d68f){while(--_0x58d68f){_0x4d4e35['push'](_0x4d4e35['shift']());}};_0x26031d(++_0x3ad9e0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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 1309d3a..e4ea60d 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 _0xdb9a=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x5786eb,_0x39cd03){var _0x32cc8b=function(_0x1411a9){while(--_0x1411a9){_0x5786eb['push'](_0x5786eb['shift']());}};_0x32cc8b(++_0x39cd03);}(_0xdb9a,0x18f));var _0xadb9=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xdb9a[_0x1facfa];return _0x9ec701;};'use strict';var client=require(_0xadb9('0x0'));exports[_0xadb9('0x1')]=function(_0x430386){return function(){return client[_0xadb9('0x2')](_0xadb9('0x3'),{'options':{'where':{'VoiceQueueId':_0x430386,'paused':!![]},'raw':!![]},'log':_0xadb9('0x1')});};}; \ No newline at end of file +var _0xd175=['getVoiceQueueRtPauses','../client','Request'];(function(_0x51dd27,_0x5b6f42){var _0x379561=function(_0x2eab99){while(--_0x2eab99){_0x51dd27['push'](_0x51dd27['shift']());}};_0x379561(++_0x5b6f42);}(_0xd175,0x1b1));var _0x5d17=function(_0x488cb6,_0xfb31a8){_0x488cb6=_0x488cb6-0x0;var _0x20c533=_0xd175[_0x488cb6];return _0x20c533;};'use strict';var client=require(_0x5d17('0x0'));exports['getVoiceQueueRtPauses']=function(_0x5b9b9){return function(){return client[_0x5d17('0x1')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x5b9b9,'paused':!![]},'raw':!![]},'log':_0x5d17('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index e25b4d0..7c4fad4 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 _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x332066,_0x2937d1){var _0x1b52e2=function(_0x6380f5){while(--_0x6380f5){_0x332066['push'](_0x332066['shift']());}};_0x1b52e2(++_0x2937d1);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x244a81,_0x48a444){var _0x3493bb=function(_0x39efcf){while(--_0x39efcf){_0x244a81['push'](_0x244a81['shift']());}};_0x3493bb(++_0x48a444);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 7245129..e008539 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 _0x8b46=['transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','transfereeexten','isexternal','context','attendedTransfer','Request','origtransfererchannel','origtransferercalleridname','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','origtransfererexten','attended','../client','transfers','blindTransfer','CreateVoiceTransferReport','result','transfererchannel','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid'];(function(_0x204498,_0x3ba5b3){var _0x5adad1=function(_0x13852d){while(--_0x13852d){_0x204498['push'](_0x204498['shift']());}};_0x5adad1(++_0x3ba5b3);}(_0x8b46,0x115));var _0x68b4=function(_0x2e9cf7,_0x39e8a4){_0x2e9cf7=_0x2e9cf7-0x0;var _0x39cd4a=_0x8b46[_0x2e9cf7];return _0x39cd4a;};'use strict';var client=require(_0x68b4('0x0'));exports[_0x68b4('0x1')]={};exports[_0x68b4('0x2')]=function(_0x135d39){return client['Request'](_0x68b4('0x3'),{'body':{'result':_0x135d39[_0x68b4('0x4')],'transfererchannel':_0x135d39[_0x68b4('0x5')],'transferercalleridnum':_0x135d39['transferercalleridnum'],'transferercalleridname':_0x135d39['transferercalleridname'],'transfererconnectedlinenum':_0x135d39[_0x68b4('0x6')],'transfererconnectedlinename':_0x135d39['transfererconnectedlinename'],'transfereraccountcode':_0x135d39[_0x68b4('0x7')],'transferercontext':_0x135d39[_0x68b4('0x8')],'transfererexten':_0x135d39[_0x68b4('0x9')],'transfererlinkedid':_0x135d39[_0x68b4('0xa')],'transfereechannel':_0x135d39[_0x68b4('0xb')],'transfereecalleridnum':_0x135d39[_0x68b4('0xc')],'transfereecalleridname':_0x135d39[_0x68b4('0xd')],'transfereeconnectedlinenum':_0x135d39[_0x68b4('0xe')],'transfereeconnectedlinename':_0x135d39['transfereeconnectedlinename'],'transfereeaccountcode':_0x135d39[_0x68b4('0xf')],'transfereecontext':_0x135d39[_0x68b4('0x10')],'transfereeexten':_0x135d39[_0x68b4('0x11')],'transfereelinkedid':_0x135d39['transfereelinkedid'],'isexternal':_0x135d39[_0x68b4('0x12')],'context':_0x135d39[_0x68b4('0x13')],'extension':_0x135d39['extension'],'type':'blind'},'log':_0x68b4('0x3')});};exports[_0x68b4('0x14')]=function(_0x52aba5){return client[_0x68b4('0x15')](_0x68b4('0x3'),{'body':{'result':_0x52aba5['result'],'transfererchannel':_0x52aba5[_0x68b4('0x16')],'transferercalleridnum':_0x52aba5['origtransferercalleridnum'],'transferercalleridname':_0x52aba5[_0x68b4('0x17')],'transfererconnectedlinenum':_0x52aba5['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x52aba5['secondtransfererconnectedlinename'],'transfereraccountcode':_0x52aba5[_0x68b4('0x18')],'transferercontext':_0x52aba5[_0x68b4('0x19')],'transfererexten':_0x52aba5[_0x68b4('0x1a')],'transfererlinkedid':_0x52aba5['origtransfererlinkedid'],'transfereechannel':_0x52aba5[_0x68b4('0x1b')],'transfereecalleridnum':_0x52aba5[_0x68b4('0x1c')],'transfereecalleridname':_0x52aba5[_0x68b4('0x1d')],'transfereeconnectedlinenum':_0x52aba5[_0x68b4('0x1e')],'transfereeconnectedlinename':_0x52aba5['transfertargetconnectedlinename'],'transfereeaccountcode':_0x52aba5[_0x68b4('0x1f')],'transfereecontext':_0x52aba5['transfertargetcontext'],'transfereeexten':_0x52aba5[_0x68b4('0x20')],'transfereelinkedid':_0x52aba5[_0x68b4('0x21')],'isexternal':_0x52aba5[_0x68b4('0x12')],'context':_0x52aba5['origtransferercontext'],'extension':_0x52aba5[_0x68b4('0x22')],'type':_0x68b4('0x23')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0x2dbd=['origtransfererlinkedid','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','context','extension','blind','attendedTransfer','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten'];(function(_0x23b655,_0x4feb2b){var _0x364b32=function(_0x4e41ac){while(--_0x4e41ac){_0x23b655['push'](_0x23b655['shift']());}};_0x364b32(++_0x4feb2b);}(_0x2dbd,0x148));var _0xd2db=function(_0x7ff42c,_0x2a77cb){_0x7ff42c=_0x7ff42c-0x0;var _0x305d45=_0x2dbd[_0x7ff42c];return _0x305d45;};'use strict';var client=require(_0xd2db('0x0'));exports[_0xd2db('0x1')]={};exports[_0xd2db('0x2')]=function(_0x3caa93){return client[_0xd2db('0x3')](_0xd2db('0x4'),{'body':{'result':_0x3caa93[_0xd2db('0x5')],'transfererchannel':_0x3caa93[_0xd2db('0x6')],'transferercalleridnum':_0x3caa93[_0xd2db('0x7')],'transferercalleridname':_0x3caa93['transferercalleridname'],'transfererconnectedlinenum':_0x3caa93[_0xd2db('0x8')],'transfererconnectedlinename':_0x3caa93[_0xd2db('0x9')],'transfereraccountcode':_0x3caa93[_0xd2db('0xa')],'transferercontext':_0x3caa93[_0xd2db('0xb')],'transfererexten':_0x3caa93[_0xd2db('0xc')],'transfererlinkedid':_0x3caa93[_0xd2db('0xd')],'transfereechannel':_0x3caa93[_0xd2db('0xe')],'transfereecalleridnum':_0x3caa93[_0xd2db('0xf')],'transfereecalleridname':_0x3caa93[_0xd2db('0x10')],'transfereeconnectedlinenum':_0x3caa93[_0xd2db('0x11')],'transfereeconnectedlinename':_0x3caa93['transfereeconnectedlinename'],'transfereeaccountcode':_0x3caa93[_0xd2db('0x12')],'transfereecontext':_0x3caa93[_0xd2db('0x13')],'transfereeexten':_0x3caa93[_0xd2db('0x14')],'transfereelinkedid':_0x3caa93[_0xd2db('0x15')],'isexternal':_0x3caa93['isexternal'],'context':_0x3caa93[_0xd2db('0x16')],'extension':_0x3caa93[_0xd2db('0x17')],'type':_0xd2db('0x18')},'log':_0xd2db('0x4')});};exports[_0xd2db('0x19')]=function(_0x3232af){return client[_0xd2db('0x3')](_0xd2db('0x4'),{'body':{'result':_0x3232af[_0xd2db('0x5')],'transfererchannel':_0x3232af['origtransfererchannel'],'transferercalleridnum':_0x3232af['origtransferercalleridnum'],'transferercalleridname':_0x3232af[_0xd2db('0x1a')],'transfererconnectedlinenum':_0x3232af[_0xd2db('0x1b')],'transfererconnectedlinename':_0x3232af[_0xd2db('0x1c')],'transfereraccountcode':_0x3232af[_0xd2db('0x1d')],'transferercontext':_0x3232af[_0xd2db('0x1e')],'transfererexten':_0x3232af[_0xd2db('0x1f')],'transfererlinkedid':_0x3232af[_0xd2db('0x20')],'transfereechannel':_0x3232af['transfertargetchannel'],'transfereecalleridnum':_0x3232af['transfertargetcalleridnum'],'transfereecalleridname':_0x3232af['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x3232af[_0xd2db('0x21')],'transfereeconnectedlinename':_0x3232af['transfertargetconnectedlinename'],'transfereeaccountcode':_0x3232af[_0xd2db('0x22')],'transfereecontext':_0x3232af[_0xd2db('0x23')],'transfereeexten':_0x3232af['transfertargetexten'],'transfereelinkedid':_0x3232af[_0xd2db('0x24')],'isexternal':_0x3232af['isexternal'],'context':_0x3232af[_0xd2db('0x25')],'extension':_0x3232af[_0xd2db('0x26')],'type':_0xd2db('0x27')},'log':_0xd2db('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 649f1d0..f01120d 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 _0xd8fb=['join','pick','keys','module','action','Action','then','message','catch','username','command','Command','content','voiceQueues','hasOwnProperty','push','find','omit','undefined','values','channels','length','voicechannel','map','uniqueid','%s.%s','filename','format','wav','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','channel','StopMixMonitor','destinationchannel','status','stop','StopMixMonitor\x20Success','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','Hangup','exten','context','telephones','trunks','outboundChannels','campaigns','event','Event\x20name\x20mandatory','emit','faxAccounts','send','checkAfterSend','http','listen','127.0.0.1','lodash','util','jayson/promise','validate','../ami','../model/voiceQueueSummary','SIP','name','timers','timer','agents','updateStatusRealtime','QueuePause','isConnected','error','asterisk','ami\x20disconnected'];(function(_0x4a27a9,_0x3e6a4d){var _0x58dc91=function(_0x375002){while(--_0x375002){_0x4a27a9['push'](_0x4a27a9['shift']());}};_0x58dc91(++_0x3e6a4d);}(_0xd8fb,0x99));var _0xbd8f=function(_0x501cd4,_0x564328){_0x501cd4=_0x501cd4-0x0;var _0x47a96d=_0xd8fb[_0x501cd4];return _0x47a96d;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var jayson=require(_0xbd8f('0x2'));var schema=require(_0xbd8f('0x3'));var moment=require('moment');var config=require('../../../config/environment');var properties=require('../properties');var ami=require(_0xbd8f('0x4'));var VoiceQueueSummary=require(_0xbd8f('0x5'));exports['listen']=function(_0x400dfb,_0x2343bf,_0x5543b2){return new Promise(function(_0x33d541,_0x4e97cf){var _0xf503c4={'QueuePause':function(_0x578499){return new Promise(function(_0x197827){var _0x403edc=util['format']('%s/%s',_0xbd8f('0x6'),_0x578499[_0xbd8f('0x7')]);if(_0x400dfb[_0xbd8f('0x8')]&&_0x400dfb['timers'][_0x403edc]&&_0x400dfb[_0xbd8f('0x8')][_0x403edc][_0xbd8f('0x9')]){_0x400dfb['timers'][_0x403edc]['updateAcw']();}if(_0x400dfb[_0xbd8f('0xa')][_0x403edc]){_0x400dfb[_0xbd8f('0xa')][_0x403edc][_0xbd8f('0xb')]({'statePause':_0x578499['pause']?!![]:![]});}_0x197827({'code':0xc8,'message':_0xbd8f('0xc')});});},'Reload':function(_0x159f09){var _0x39be16=this;return new Promise(function(_0x43ca5d,_0x8bc054){if(ami[_0xbd8f('0xd')]()==![]){return _0x8bc054(_0x39be16[_0xbd8f('0xe')](0x1f4,[config[_0xbd8f('0xf')]['ip'],config[_0xbd8f('0xf')]['username'],_0xbd8f('0x10')][_0xbd8f('0x11')]('\x20')));}_0x159f09=_[_0xbd8f('0x12')](_0x159f09,_[_0xbd8f('0x13')](properties['reload'][_0xbd8f('0x14')]));_0x159f09[_0xbd8f('0x15')]='Reload';return ami[_0xbd8f('0x16')](_0x159f09)[_0xbd8f('0x17')](function(_0x504adb){_0x43ca5d({'code':0xc8,'message':_0x504adb[_0xbd8f('0x18')]});})[_0xbd8f('0x19')](function(_0x47d317){_0x8bc054(_0x39be16['error'](0x1f5,_0x47d317[_0xbd8f('0x18')]));});});},'Command':function(_0x5d2fdb){var _0x5705c5=this;return new Promise(function(_0x159c7b,_0x4b5fac){if(ami[_0xbd8f('0xd')]()==![]){return _0x4b5fac(_0x5705c5[_0xbd8f('0xe')](0x1f4,[config[_0xbd8f('0xf')]['ip'],config[_0xbd8f('0xf')][_0xbd8f('0x1a')],_0xbd8f('0x10')][_0xbd8f('0x11')]('\x20')));}_0x5d2fdb=_[_0xbd8f('0x12')](_0x5d2fdb,_0xbd8f('0x1b'));_0x5d2fdb[_0xbd8f('0x15')]=_0xbd8f('0x1c');return ami[_0xbd8f('0x16')](_0x5d2fdb)[_0xbd8f('0x17')](function(_0x15c4a9){_0x159c7b({'code':0xc8,'message':_0x15c4a9[_0xbd8f('0x1d')]});})[_0xbd8f('0x19')](function(_0x395b1b){_0x4b5fac(_0x5705c5['error'](0x1f5,_0x395b1b[_0xbd8f('0x18')]));});});},'VoiceQueues':function(){return new Promise(function(_0x9fa3b1){var _0x1f9fcc=[];for(var _0x2f3df7 in _0x400dfb[_0xbd8f('0x1e')]){if(_0x400dfb[_0xbd8f('0x1e')][_0xbd8f('0x1f')](_0x2f3df7)){var _0x264e62=_0x400dfb['voiceQueues'][_0x2f3df7];var _0x40cb43=new VoiceQueueSummary(_0x264e62);_0x1f9fcc[_0xbd8f('0x20')](_0x40cb43);}}_0x9fa3b1({'count':_0x1f9fcc['length'],'rows':_0x1f9fcc});});},'UpdateVoiceQueue':function(_0x339df7){return new Promise(function(_0x557daa,_0x41b2a6){var _0x30d62e=_[_0xbd8f('0x21')](_0x400dfb[_0xbd8f('0x1e')],{'id':parseInt(_0x339df7['id'])});var _0x2aefa2=_[_0xbd8f('0x22')](_0x339df7,['id']);if(_0x30d62e){for(var _0x4c4431 in _0x2aefa2){if(typeof _0x2aefa2[_0x4c4431]!==_0xbd8f('0x23')&&typeof _0x30d62e[_0x4c4431]!==_0xbd8f('0x23')){_0x30d62e[_0x4c4431]=_0x2aefa2[_0x4c4431];}}_0x557daa(_0x30d62e);}else{_0x41b2a6();}});},'VoiceChannels':function(){return new Promise(function(_0x39714d){var _0x3ee851=_[_0xbd8f('0x24')](_0x400dfb[_0xbd8f('0x25')]);_0x39714d({'count':_0x3ee851[_0xbd8f('0x26')],'rows':_0x3ee851});});},'VoiceChannelMixMonitor':function(_0x479a0c){var _0x6c7345=this;return new Promise(function(_0x302771,_0xb9214c){if(ami[_0xbd8f('0xd')]()==![]){return _0xb9214c(_0x6c7345['error'](0x1f4,[config['asterisk']['ip'],config[_0xbd8f('0xf')][_0xbd8f('0x1a')],_0xbd8f('0x10')][_0xbd8f('0x11')]('\x20')));}var _0x57c0cc=schema(properties[_0xbd8f('0x27')])[_0xbd8f('0x3')](_0x479a0c);if(_0x57c0cc[_0xbd8f('0x26')]>0x0){return _0xb9214c(_0x6c7345[_0xbd8f('0xe')](0x1f4,_[_0xbd8f('0x28')](_0x57c0cc,'message')[_0xbd8f('0x11')](',\x20')));}var _0x407785=_[_0xbd8f('0x21')](_0x400dfb[_0xbd8f('0x25')],{'uniqueid':_0x479a0c[_0xbd8f('0x29')]});if(_0x407785&&_0x407785['channel']){var _0x24e5f4=util['format'](_0xbd8f('0x2a'),_0x479a0c[_0xbd8f('0x2b')]||_0x479a0c[_0xbd8f('0x29')],_0x479a0c[_0xbd8f('0x2c')]||_0xbd8f('0x2d'));return ami[_0xbd8f('0x16')]({'action':'MixMonitor','channel':_0x407785['channel'],'file':_0x24e5f4,'options':'ai(mixmonitorid)'})[_0xbd8f('0x17')](function(_0x46c84d){var _0x24fba6=_[_0xbd8f('0x21')](_0x407785[_0xbd8f('0x2e')],{'filename':_0xbd8f('0x2f')+_0x24e5f4[_0xbd8f('0x30')]()});if(_[_0xbd8f('0x31')](_0x24fba6)){_0x407785[_0xbd8f('0x2e')][_0xbd8f('0x20')]({'filename':_0xbd8f('0x2f')+_0x24e5f4[_0xbd8f('0x30')](),'createdAt':moment()[_0xbd8f('0x2c')](_0xbd8f('0x32')),'mixmonitorid':_0x46c84d[_0xbd8f('0x33')],'status':'rec'});}else{_0x24fba6[_0xbd8f('0x33')]=_0x46c84d[_0xbd8f('0x33')];_0x24fba6['status']=_0xbd8f('0x34');}_0x302771({'code':0xc8,'message':[_0x479a0c[_0xbd8f('0x29')],_0xbd8f('0x35'),_0x46c84d['mixmonitorid']][_0xbd8f('0x11')]('\x20'),'mixmonitorid':_0x46c84d['mixmonitorid']});})[_0xbd8f('0x19')](function(_0x32f7d5){_0xb9214c(_0x6c7345[_0xbd8f('0xe')](0x1f5,[_0x479a0c['uniqueid'],_0x32f7d5[_0xbd8f('0x18')][_0xbd8f('0x30')]()][_0xbd8f('0x11')]('\x20')));});}else{return _0xb9214c(_0x6c7345['error'](0x1f5,_0xbd8f('0x36')));}});},'VoiceChannelStopMixMonitor':function(_0x3d82ef){var _0x2c1397=this;return new Promise(function(_0x351027,_0x280d95){if(ami[_0xbd8f('0xd')]()==![]){return _0x280d95(_0x2c1397[_0xbd8f('0xe')](0x1f4,[config[_0xbd8f('0xf')]['ip'],config[_0xbd8f('0xf')]['username'],'ami\x20disconnected'][_0xbd8f('0x11')]('\x20')));}var _0x1070cb=schema(properties[_0xbd8f('0x27')])[_0xbd8f('0x3')](_0x3d82ef);if(_0x1070cb['length']>0x0){return _0x280d95(_0x2c1397[_0xbd8f('0xe')](0x1f4,_[_0xbd8f('0x28')](_0x1070cb,_0xbd8f('0x18'))[_0xbd8f('0x11')](',\x20')));}var _0x753f0=_['find'](_0x400dfb['channels'],{'uniqueid':_0x3d82ef[_0xbd8f('0x29')]});if(_0x753f0){return Promise['resolve']()[_0xbd8f('0x17')](function(){if(_0x753f0[_0xbd8f('0x37')]){return ami[_0xbd8f('0x16')]({'action':_0xbd8f('0x38'),'channel':_0x753f0[_0xbd8f('0x37')],'mixmonitorid':_0x3d82ef[_0xbd8f('0x33')]})[_0xbd8f('0x19')](function(){});}})[_0xbd8f('0x17')](function(){if(_0x753f0['destinationchannel']){return ami[_0xbd8f('0x16')]({'action':_0xbd8f('0x38'),'channel':_0x753f0[_0xbd8f('0x39')],'mixmonitorid':_0x3d82ef[_0xbd8f('0x33')]})[_0xbd8f('0x19')](function(){});}})[_0xbd8f('0x17')](function(){var _0x272f70=_[_0xbd8f('0x21')](_0x753f0['monitors'],{'mixmonitorid':_0x3d82ef[_0xbd8f('0x33')]});if(_0x272f70){_0x272f70[_0xbd8f('0x3a')]=_0xbd8f('0x3b');}})[_0xbd8f('0x17')](function(){var _0x2fdbd0=util[_0xbd8f('0x2c')](_0xbd8f('0x2a'),_0x3d82ef[_0xbd8f('0x2b')]||_0x3d82ef[_0xbd8f('0x29')],_0x3d82ef[_0xbd8f('0x2c')]||_0xbd8f('0x2d'));var _0x255c59=_[_0xbd8f('0x21')](_0x753f0[_0xbd8f('0x2e')],{'filename':_0xbd8f('0x2f')+_0x2fdbd0[_0xbd8f('0x30')]()});if(_0x255c59){_0x255c59[_0xbd8f('0x3a')]=_0xbd8f('0x3b');}})[_0xbd8f('0x17')](function(){_0x351027({'code':0xc8,'message':[_0x3d82ef['uniqueid'],_0xbd8f('0x3c')][_0xbd8f('0x11')]('\x20')});})[_0xbd8f('0x19')](function(_0x1f6abb){_0x280d95(_0x2c1397['error'](0x1f5,[_0x3d82ef[_0xbd8f('0x29')],_0x1f6abb['message'][_0xbd8f('0x30')]()][_0xbd8f('0x11')]('\x20')));});}else{return _0x280d95(_0x2c1397[_0xbd8f('0xe')](0x1f5,_0xbd8f('0x36')));}});},'VoiceQueuesChannels':function(_0x5434e8){var _0x3964f5=this;return new Promise(function(_0x35b814){var _0x3b67ac=_[_0xbd8f('0x24')](_0x400dfb[_0xbd8f('0x3d')]);var _0x2faad0={'count':_0x3b67ac['length'],'rows':_0x3b67ac};if(_0x5434e8&&_0x5434e8[_0xbd8f('0x3e')]){if(!['inbound',_0xbd8f('0x3f')][_0xbd8f('0x40')](_0x5434e8[_0xbd8f('0x3e')])){return _0x4e97cf(_0x3964f5[_0xbd8f('0xe')](0x190,_0xbd8f('0x41')));}var _0x358424=_[_0xbd8f('0x42')](_0x3b67ac,function(_0x1b253a){return _0x1b253a[_0xbd8f('0x3e')]===_0x5434e8['type'];});_0x2faad0[_0xbd8f('0x43')]=_0x358424['length'];_0x2faad0[_0xbd8f('0x44')]=_0x358424;}_0x35b814(_0x2faad0);});},'VoiceQueuesChannel':function(_0xb04dae){var _0x594e8c=this;return new Promise(function(_0x309677,_0x517c01){var _0x58d891=schema(properties['voicequeuechannel'])['validate'](_0xb04dae);if(_0x58d891[_0xbd8f('0x26')]>0x0){return _0x517c01(_0x594e8c[_0xbd8f('0xe')](0x1f4,_[_0xbd8f('0x28')](_0x58d891,_0xbd8f('0x18'))[_0xbd8f('0x11')](',\x20')));}var _0x531f2b=_['find'](_0x400dfb[_0xbd8f('0x3d')],{'uniqueid':_0xb04dae[_0xbd8f('0x29')]});if(_0x531f2b){_0x309677(_0x531f2b);}else{return _0x517c01(_0x594e8c[_0xbd8f('0xe')](0x1f5,_0xbd8f('0x36')));}});},'VoiceQueuesChannelHangup':function(_0x29e20a){var _0x576970=this;return new Promise(function(_0x4d2b28,_0x55a99b){if(ami[_0xbd8f('0xd')]()==![]){return _0x55a99b(_0x576970[_0xbd8f('0xe')](0x1f4,[config[_0xbd8f('0xf')]['ip'],config['asterisk'][_0xbd8f('0x1a')],_0xbd8f('0x10')][_0xbd8f('0x11')]('\x20')));}var _0x3090de=schema(properties['voicequeuechannelhangup'])['validate'](_0x29e20a);if(_0x3090de[_0xbd8f('0x26')]>0x0){return _0x55a99b(_0x576970['error'](0x1f4,_[_0xbd8f('0x28')](_0x3090de,_0xbd8f('0x18'))[_0xbd8f('0x11')](',\x20')));}var _0x93452d=_['find'](_0x400dfb['queueChannels'],{'uniqueid':_0x29e20a[_0xbd8f('0x29')]});if(_0x93452d&&_0x93452d[_0xbd8f('0x37')]){return ami[_0xbd8f('0x16')]({'action':_0xbd8f('0x45'),'channel':_0x93452d[_0xbd8f('0x37')]})[_0xbd8f('0x17')](function(_0x31adfb){_0x4d2b28({'code':0xc8,'message':[_0x29e20a[_0xbd8f('0x29')],_0x31adfb[_0xbd8f('0x18')][_0xbd8f('0x30')]()][_0xbd8f('0x11')]('\x20')});})['catch'](function(_0x3ebdcb){_0x55a99b(_0x576970[_0xbd8f('0xe')](0x1f5,[_0x29e20a[_0xbd8f('0x29')],_0x3ebdcb[_0xbd8f('0x18')][_0xbd8f('0x30')]()][_0xbd8f('0x11')]('\x20')));});}else{return _0x55a99b(_0x576970['error'](0x1f5,_0xbd8f('0x36')));}});},'VoiceQueuesChannelRedirect':function(_0x469c83){var _0x538fd7=this;return new Promise(function(_0x5e18fc,_0x44a891){if(ami[_0xbd8f('0xd')]()==![]){return _0x44a891(_0x538fd7[_0xbd8f('0xe')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0xbd8f('0x1a')],'ami\x20disconnected']['join']('\x20')));}var _0x5b5bd8=schema(properties['voicequeuechannelredirect'])['validate'](_0x469c83);if(_0x5b5bd8[_0xbd8f('0x26')]>0x0){return _0x44a891(_0x538fd7['error'](0x1f4,_[_0xbd8f('0x28')](_0x5b5bd8,_0xbd8f('0x18'))['join'](',\x20')));}var _0x1fcb28=_[_0xbd8f('0x21')](_0x400dfb[_0xbd8f('0x3d')],{'uniqueid':_0x469c83[_0xbd8f('0x29')]});if(_0x1fcb28&&_0x1fcb28[_0xbd8f('0x37')]){return ami['Action']({'action':'Redirect','channel':_0x1fcb28[_0xbd8f('0x37')],'exten':_0x469c83[_0xbd8f('0x46')],'context':_0x469c83[_0xbd8f('0x47')]||_0x1fcb28[_0xbd8f('0x47')],'priority':0x1})[_0xbd8f('0x17')](function(_0x105d2d){_0x5e18fc({'code':0xc8,'message':[_0x469c83['uniqueid'],_0x105d2d['message'][_0xbd8f('0x30')]()][_0xbd8f('0x11')]('\x20')});})['catch'](function(_0x31ce0d){_0x44a891(_0x538fd7[_0xbd8f('0xe')](0x1f5,[_0x469c83['uniqueid'],_0x31ce0d[_0xbd8f('0x18')][_0xbd8f('0x30')]()][_0xbd8f('0x11')]('\x20')));});}else{return _0x44a891(_0x538fd7['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x2407e7){return new Promise(function(_0x222cae){var _0x13e321=_[_0xbd8f('0x24')](_0x400dfb[_0xbd8f('0xa')]);if(_0x2407e7&&_0x2407e7['id']){var _0x5b900c=_[_0xbd8f('0x21')](_0x13e321,function(_0x27ec14){return _0x27ec14['id']===_0x2407e7['id'];});_0x222cae(_0x5b900c);}else{_0x222cae({'count':_0x13e321[_0xbd8f('0x26')],'rows':_0x13e321});}});},'Telephones':function(){return new Promise(function(_0x16c11d){var _0x1efdf4=_[_0xbd8f('0x24')](_0x400dfb[_0xbd8f('0x48')]);_0x16c11d({'count':_0x1efdf4[_0xbd8f('0x26')],'rows':_0x1efdf4});});},'Trunks':function(){return new Promise(function(_0x2c6066){var _0xf86e03=_[_0xbd8f('0x24')](_0x400dfb[_0xbd8f('0x49')]);_0x2c6066({'count':_0xf86e03[_0xbd8f('0x26')],'rows':_0xf86e03});});},'OutboundChannels':function(){return new Promise(function(_0x40fc53){var _0x3fdecd=_[_0xbd8f('0x24')](_0x400dfb[_0xbd8f('0x4a')]);_0x40fc53({'count':_0x3fdecd[_0xbd8f('0x26')],'rows':_0x3fdecd});});},'Outbound':function(){return new Promise(function(_0x5bec22){_0x5bec22(_0x400dfb[_0xbd8f('0x3f')]);});},'Campaigns':function(){return new Promise(function(_0x2957fd){var _0xffcbed=_[_0xbd8f('0x24')](_0x400dfb[_0xbd8f('0x4b')]);_0x2957fd({'count':_0xffcbed[_0xbd8f('0x26')],'rows':_0xffcbed});});},'VoiceQueuesPreview':function(_0x4e13d4){var _0x572ce4=this;return new Promise(function(_0x2a3982,_0x3e798f){_0x2343bf['run'](_0x4e13d4['id'])[_0xbd8f('0x17')](function(_0x4c2a24){_0x2a3982({'code':0xc8,'message':_0x4c2a24[_0xbd8f('0x18')]});})[_0xbd8f('0x19')](function(_0x1a8b71){_0x3e798f(_0x572ce4[_0xbd8f('0xe')](0x1f4,_0x1a8b71['message']));});});},'EventManager':function(_0x451e8a){var _0x21f3fc=this;return new Promise(function(_0x84e98d,_0x56f497){if(!_0x451e8a[_0xbd8f('0x4c')]){return _0x56f497(_0x21f3fc[_0xbd8f('0xe')](0x1f4,_0xbd8f('0x4d')));}ami[_0xbd8f('0x4e')]('custom:'+_0x451e8a[_0xbd8f('0x4c')],_0x451e8a[_0xbd8f('0x18')]);_0x84e98d({'code':0xc8,'message':_0x451e8a});});},'FaxAccounts':function(){return new Promise(function(_0x1d4e14){var _0x10fcc9=_[_0xbd8f('0x24')](_0x400dfb[_0xbd8f('0x4f')]);_0x1d4e14({'count':_0x10fcc9[_0xbd8f('0x26')],'rows':_0x10fcc9});});},'SendFax':function(_0x3a320c){var _0x52a616=this;return new Promise(function(_0xf8efe6,_0x5a5f8a){_0x5543b2[_0xbd8f('0x50')](_0x3a320c)['then'](function(_0x107f9e){_0xf8efe6({'code':0xc8,'message':_0x107f9e[_0xbd8f('0x18')]});})['catch'](function(_0x3d015f){_0x5a5f8a(_0x52a616[_0xbd8f('0xe')](0x1f4,_0x3d015f[_0xbd8f('0x18')]));});});},'CheckAfterSend':function(_0x2ab853){var _0x4972ea=this;return new Promise(function(_0x45e7e6,_0x752bba){_0x5543b2[_0xbd8f('0x51')](_0x2ab853)[_0xbd8f('0x17')](function(_0x58651d){_0x45e7e6({'code':0xc8,'message':_0x58651d['message']});})[_0xbd8f('0x19')](function(_0x3641e9){_0x752bba(_0x4972ea[_0xbd8f('0xe')](0x1f4,_0x3641e9[_0xbd8f('0x18')]));});});}};var _0x24a567=jayson['server'](_0xf503c4)[_0xbd8f('0x52')]();_0x24a567['on'](_0xbd8f('0xe'),function(_0x328bd6){return _0x4e97cf(_0x328bd6);});_0x24a567[_0xbd8f('0x53')](0x232a,_0xbd8f('0x54'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x33d541('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0x9957=['content','error','voiceQueues','hasOwnProperty','push','find','undefined','channels','length','voicechannel','uniqueid','format','%s.%s','MixMonitor','channel','monitors','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','map','resolve','destinationchannel','stop','/var/spool/asterisk/monitor/','values','queueChannels','inbound','includes','type','count','rows','voicequeuechannel','Hangup','voicequeuechannelredirect','exten','context','telephones','outboundChannels','outbound','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','../../../config/environment','../properties','../ami','../model/voiceQueueSummary','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','asterisk','username','ami\x20disconnected','join','pick','keys','reload','action','Action','then','message','catch','isConnected','command','Command'];(function(_0x22498b,_0xf605c8){var _0x9c0dfb=function(_0x2ba715){while(--_0x2ba715){_0x22498b['push'](_0x22498b['shift']());}};_0x9c0dfb(++_0xf605c8);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var jayson=require(_0x7995('0x2'));var schema=require(_0x7995('0x3'));var moment=require('moment');var config=require(_0x7995('0x4'));var properties=require(_0x7995('0x5'));var ami=require(_0x7995('0x6'));var VoiceQueueSummary=require(_0x7995('0x7'));exports['listen']=function(_0x744bea,_0x1a36d8,_0x137b6b){return new Promise(function(_0x219534,_0xbda126){var _0x326741={'QueuePause':function(_0x4996ca){return new Promise(function(_0x465276){var _0x1cad37=util['format'](_0x7995('0x8'),_0x7995('0x9'),_0x4996ca[_0x7995('0xa')]);if(_0x744bea[_0x7995('0xb')]&&_0x744bea[_0x7995('0xb')][_0x1cad37]&&_0x744bea[_0x7995('0xb')][_0x1cad37][_0x7995('0xc')]){_0x744bea['timers'][_0x1cad37][_0x7995('0xd')]();}if(_0x744bea[_0x7995('0xe')][_0x1cad37]){_0x744bea['agents'][_0x1cad37][_0x7995('0xf')]({'statePause':_0x4996ca[_0x7995('0x10')]?!![]:![]});}_0x465276({'code':0xc8,'message':_0x7995('0x11')});});},'Reload':function(_0x385f00){var _0x281576=this;return new Promise(function(_0x23999f,_0x2bbe7a){if(ami['isConnected']()==![]){return _0x2bbe7a(_0x281576['error'](0x1f4,[config[_0x7995('0x12')]['ip'],config[_0x7995('0x12')][_0x7995('0x13')],_0x7995('0x14')][_0x7995('0x15')]('\x20')));}_0x385f00=_[_0x7995('0x16')](_0x385f00,_[_0x7995('0x17')](properties[_0x7995('0x18')]['module']));_0x385f00[_0x7995('0x19')]='Reload';return ami[_0x7995('0x1a')](_0x385f00)[_0x7995('0x1b')](function(_0x43d4b8){_0x23999f({'code':0xc8,'message':_0x43d4b8[_0x7995('0x1c')]});})[_0x7995('0x1d')](function(_0x37a7d4){_0x2bbe7a(_0x281576['error'](0x1f5,_0x37a7d4['message']));});});},'Command':function(_0x2536c8){var _0x5e6f90=this;return new Promise(function(_0x555f74,_0x3ec178){if(ami[_0x7995('0x1e')]()==![]){return _0x3ec178(_0x5e6f90['error'](0x1f4,[config[_0x7995('0x12')]['ip'],config['asterisk']['username'],_0x7995('0x14')][_0x7995('0x15')]('\x20')));}_0x2536c8=_[_0x7995('0x16')](_0x2536c8,_0x7995('0x1f'));_0x2536c8[_0x7995('0x19')]=_0x7995('0x20');return ami['Action'](_0x2536c8)[_0x7995('0x1b')](function(_0x46ee4b){_0x555f74({'code':0xc8,'message':_0x46ee4b[_0x7995('0x21')]});})[_0x7995('0x1d')](function(_0x563799){_0x3ec178(_0x5e6f90[_0x7995('0x22')](0x1f5,_0x563799[_0x7995('0x1c')]));});});},'VoiceQueues':function(){return new Promise(function(_0x472195){var _0x59405a=[];for(var _0x39df42 in _0x744bea[_0x7995('0x23')]){if(_0x744bea[_0x7995('0x23')][_0x7995('0x24')](_0x39df42)){var _0x3a3fcf=_0x744bea[_0x7995('0x23')][_0x39df42];var _0x56691a=new VoiceQueueSummary(_0x3a3fcf);_0x59405a[_0x7995('0x25')](_0x56691a);}}_0x472195({'count':_0x59405a['length'],'rows':_0x59405a});});},'UpdateVoiceQueue':function(_0x229742){return new Promise(function(_0x49bc7e,_0xf16cc2){var _0x132a42=_[_0x7995('0x26')](_0x744bea['voiceQueues'],{'id':parseInt(_0x229742['id'])});var _0x9b2a15=_['omit'](_0x229742,['id']);if(_0x132a42){for(var _0x456a28 in _0x9b2a15){if(typeof _0x9b2a15[_0x456a28]!==_0x7995('0x27')&&typeof _0x132a42[_0x456a28]!==_0x7995('0x27')){_0x132a42[_0x456a28]=_0x9b2a15[_0x456a28];}}_0x49bc7e(_0x132a42);}else{_0xf16cc2();}});},'VoiceChannels':function(){return new Promise(function(_0x574574){var _0x530611=_['values'](_0x744bea[_0x7995('0x28')]);_0x574574({'count':_0x530611[_0x7995('0x29')],'rows':_0x530611});});},'VoiceChannelMixMonitor':function(_0x327a81){var _0x2b874d=this;return new Promise(function(_0x2e3493,_0x1ca460){if(ami['isConnected']()==![]){return _0x1ca460(_0x2b874d['error'](0x1f4,[config[_0x7995('0x12')]['ip'],config['asterisk'][_0x7995('0x13')],_0x7995('0x14')][_0x7995('0x15')]('\x20')));}var _0x1e9fa4=schema(properties[_0x7995('0x2a')])['validate'](_0x327a81);if(_0x1e9fa4[_0x7995('0x29')]>0x0){return _0x1ca460(_0x2b874d[_0x7995('0x22')](0x1f4,_['map'](_0x1e9fa4,'message')['join'](',\x20')));}var _0x45bc5e=_[_0x7995('0x26')](_0x744bea['channels'],{'uniqueid':_0x327a81[_0x7995('0x2b')]});if(_0x45bc5e&&_0x45bc5e['channel']){var _0x37917b=util[_0x7995('0x2c')](_0x7995('0x2d'),_0x327a81['filename']||_0x327a81['uniqueid'],_0x327a81[_0x7995('0x2c')]||'wav');return ami['Action']({'action':_0x7995('0x2e'),'channel':_0x45bc5e[_0x7995('0x2f')],'file':_0x37917b,'options':'ai(mixmonitorid)'})[_0x7995('0x1b')](function(_0x1922b4){var _0x2b772f=_[_0x7995('0x26')](_0x45bc5e[_0x7995('0x30')],{'filename':'/var/spool/asterisk/monitor/'+_0x37917b[_0x7995('0x31')]()});if(_[_0x7995('0x32')](_0x2b772f)){_0x45bc5e[_0x7995('0x30')][_0x7995('0x25')]({'filename':'/var/spool/asterisk/monitor/'+_0x37917b[_0x7995('0x31')](),'createdAt':moment()[_0x7995('0x2c')](_0x7995('0x33')),'mixmonitorid':_0x1922b4[_0x7995('0x34')],'status':_0x7995('0x35')});}else{_0x2b772f[_0x7995('0x34')]=_0x1922b4['mixmonitorid'];_0x2b772f[_0x7995('0x36')]=_0x7995('0x35');}_0x2e3493({'code':0xc8,'message':[_0x327a81[_0x7995('0x2b')],_0x7995('0x37'),_0x1922b4[_0x7995('0x34')]][_0x7995('0x15')]('\x20'),'mixmonitorid':_0x1922b4[_0x7995('0x34')]});})[_0x7995('0x1d')](function(_0x1234e1){_0x1ca460(_0x2b874d[_0x7995('0x22')](0x1f5,[_0x327a81[_0x7995('0x2b')],_0x1234e1[_0x7995('0x1c')][_0x7995('0x31')]()]['join']('\x20')));});}else{return _0x1ca460(_0x2b874d['error'](0x1f5,_0x7995('0x38')));}});},'VoiceChannelStopMixMonitor':function(_0x7325e8){var _0x58523e=this;return new Promise(function(_0x4b0855,_0x3f8522){if(ami['isConnected']()==![]){return _0x3f8522(_0x58523e['error'](0x1f4,[config[_0x7995('0x12')]['ip'],config[_0x7995('0x12')][_0x7995('0x13')],'ami\x20disconnected'][_0x7995('0x15')]('\x20')));}var _0x5e85b9=schema(properties[_0x7995('0x2a')])['validate'](_0x7325e8);if(_0x5e85b9['length']>0x0){return _0x3f8522(_0x58523e[_0x7995('0x22')](0x1f4,_[_0x7995('0x39')](_0x5e85b9,_0x7995('0x1c'))[_0x7995('0x15')](',\x20')));}var _0x599ecb=_[_0x7995('0x26')](_0x744bea[_0x7995('0x28')],{'uniqueid':_0x7325e8[_0x7995('0x2b')]});if(_0x599ecb){return Promise[_0x7995('0x3a')]()['then'](function(){if(_0x599ecb['channel']){return ami[_0x7995('0x1a')]({'action':'StopMixMonitor','channel':_0x599ecb[_0x7995('0x2f')],'mixmonitorid':_0x7325e8['mixmonitorid']})[_0x7995('0x1d')](function(){});}})['then'](function(){if(_0x599ecb[_0x7995('0x3b')]){return ami[_0x7995('0x1a')]({'action':'StopMixMonitor','channel':_0x599ecb[_0x7995('0x3b')],'mixmonitorid':_0x7325e8[_0x7995('0x34')]})[_0x7995('0x1d')](function(){});}})[_0x7995('0x1b')](function(){var _0x4c6837=_[_0x7995('0x26')](_0x599ecb[_0x7995('0x30')],{'mixmonitorid':_0x7325e8[_0x7995('0x34')]});if(_0x4c6837){_0x4c6837['status']=_0x7995('0x3c');}})[_0x7995('0x1b')](function(){var _0x511567=util[_0x7995('0x2c')](_0x7995('0x2d'),_0x7325e8['filename']||_0x7325e8[_0x7995('0x2b')],_0x7325e8[_0x7995('0x2c')]||'wav');var _0x3d1dbb=_['find'](_0x599ecb[_0x7995('0x30')],{'filename':_0x7995('0x3d')+_0x511567[_0x7995('0x31')]()});if(_0x3d1dbb){_0x3d1dbb[_0x7995('0x36')]=_0x7995('0x3c');}})[_0x7995('0x1b')](function(){_0x4b0855({'code':0xc8,'message':[_0x7325e8[_0x7995('0x2b')],'StopMixMonitor\x20Success'][_0x7995('0x15')]('\x20')});})[_0x7995('0x1d')](function(_0x418eb9){_0x3f8522(_0x58523e['error'](0x1f5,[_0x7325e8[_0x7995('0x2b')],_0x418eb9[_0x7995('0x1c')][_0x7995('0x31')]()]['join']('\x20')));});}else{return _0x3f8522(_0x58523e['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0xb70620){var _0x1fd1ca=this;return new Promise(function(_0x4cf5db){var _0x1cd85=_[_0x7995('0x3e')](_0x744bea[_0x7995('0x3f')]);var _0x1a9bd7={'count':_0x1cd85[_0x7995('0x29')],'rows':_0x1cd85};if(_0xb70620&&_0xb70620['type']){if(![_0x7995('0x40'),'outbound'][_0x7995('0x41')](_0xb70620[_0x7995('0x42')])){return _0xbda126(_0x1fd1ca[_0x7995('0x22')](0x190,'Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound'));}var _0x5e1f34=_['filter'](_0x1cd85,function(_0x563f8e){return _0x563f8e[_0x7995('0x42')]===_0xb70620[_0x7995('0x42')];});_0x1a9bd7[_0x7995('0x43')]=_0x5e1f34[_0x7995('0x29')];_0x1a9bd7[_0x7995('0x44')]=_0x5e1f34;}_0x4cf5db(_0x1a9bd7);});},'VoiceQueuesChannel':function(_0x357e60){var _0x1f4270=this;return new Promise(function(_0xda6ce8,_0x328671){var _0x17ecd3=schema(properties[_0x7995('0x45')])[_0x7995('0x3')](_0x357e60);if(_0x17ecd3[_0x7995('0x29')]>0x0){return _0x328671(_0x1f4270[_0x7995('0x22')](0x1f4,_[_0x7995('0x39')](_0x17ecd3,_0x7995('0x1c'))[_0x7995('0x15')](',\x20')));}var _0x223e08=_[_0x7995('0x26')](_0x744bea['queueChannels'],{'uniqueid':_0x357e60[_0x7995('0x2b')]});if(_0x223e08){_0xda6ce8(_0x223e08);}else{return _0x328671(_0x1f4270[_0x7995('0x22')](0x1f5,_0x7995('0x38')));}});},'VoiceQueuesChannelHangup':function(_0x32c0d3){var _0x5d160d=this;return new Promise(function(_0x53125a,_0x402fa0){if(ami[_0x7995('0x1e')]()==![]){return _0x402fa0(_0x5d160d[_0x7995('0x22')](0x1f4,[config[_0x7995('0x12')]['ip'],config['asterisk'][_0x7995('0x13')],_0x7995('0x14')][_0x7995('0x15')]('\x20')));}var _0x33c49c=schema(properties['voicequeuechannelhangup'])['validate'](_0x32c0d3);if(_0x33c49c[_0x7995('0x29')]>0x0){return _0x402fa0(_0x5d160d[_0x7995('0x22')](0x1f4,_[_0x7995('0x39')](_0x33c49c,_0x7995('0x1c'))[_0x7995('0x15')](',\x20')));}var _0x27c5cd=_[_0x7995('0x26')](_0x744bea[_0x7995('0x3f')],{'uniqueid':_0x32c0d3[_0x7995('0x2b')]});if(_0x27c5cd&&_0x27c5cd['channel']){return ami[_0x7995('0x1a')]({'action':_0x7995('0x46'),'channel':_0x27c5cd[_0x7995('0x2f')]})[_0x7995('0x1b')](function(_0x59c5aa){_0x53125a({'code':0xc8,'message':[_0x32c0d3['uniqueid'],_0x59c5aa[_0x7995('0x1c')][_0x7995('0x31')]()]['join']('\x20')});})[_0x7995('0x1d')](function(_0x375fc9){_0x402fa0(_0x5d160d[_0x7995('0x22')](0x1f5,[_0x32c0d3[_0x7995('0x2b')],_0x375fc9[_0x7995('0x1c')]['toLowerCase']()][_0x7995('0x15')]('\x20')));});}else{return _0x402fa0(_0x5d160d['error'](0x1f5,_0x7995('0x38')));}});},'VoiceQueuesChannelRedirect':function(_0xe31dcb){var _0x1722e2=this;return new Promise(function(_0x25b534,_0x4388c1){if(ami[_0x7995('0x1e')]()==![]){return _0x4388c1(_0x1722e2[_0x7995('0x22')](0x1f4,[config[_0x7995('0x12')]['ip'],config[_0x7995('0x12')][_0x7995('0x13')],_0x7995('0x14')][_0x7995('0x15')]('\x20')));}var _0x56eb85=schema(properties[_0x7995('0x47')])[_0x7995('0x3')](_0xe31dcb);if(_0x56eb85[_0x7995('0x29')]>0x0){return _0x4388c1(_0x1722e2[_0x7995('0x22')](0x1f4,_[_0x7995('0x39')](_0x56eb85,'message')['join'](',\x20')));}var _0x268fde=_[_0x7995('0x26')](_0x744bea[_0x7995('0x3f')],{'uniqueid':_0xe31dcb[_0x7995('0x2b')]});if(_0x268fde&&_0x268fde['channel']){return ami[_0x7995('0x1a')]({'action':'Redirect','channel':_0x268fde['channel'],'exten':_0xe31dcb[_0x7995('0x48')],'context':_0xe31dcb[_0x7995('0x49')]||_0x268fde[_0x7995('0x49')],'priority':0x1})[_0x7995('0x1b')](function(_0x290eae){_0x25b534({'code':0xc8,'message':[_0xe31dcb[_0x7995('0x2b')],_0x290eae[_0x7995('0x1c')][_0x7995('0x31')]()][_0x7995('0x15')]('\x20')});})[_0x7995('0x1d')](function(_0x560b0a){_0x4388c1(_0x1722e2[_0x7995('0x22')](0x1f5,[_0xe31dcb[_0x7995('0x2b')],_0x560b0a[_0x7995('0x1c')]['toLowerCase']()][_0x7995('0x15')]('\x20')));});}else{return _0x4388c1(_0x1722e2[_0x7995('0x22')](0x1f5,_0x7995('0x38')));}});},'Agents':function(_0x3a7d9d){return new Promise(function(_0x3b0d30){var _0x51ab1e=_[_0x7995('0x3e')](_0x744bea[_0x7995('0xe')]);if(_0x3a7d9d&&_0x3a7d9d['id']){var _0x2f94c4=_[_0x7995('0x26')](_0x51ab1e,function(_0x435a1b){return _0x435a1b['id']===_0x3a7d9d['id'];});_0x3b0d30(_0x2f94c4);}else{_0x3b0d30({'count':_0x51ab1e['length'],'rows':_0x51ab1e});}});},'Telephones':function(){return new Promise(function(_0x5e8b4c){var _0xd07c1c=_[_0x7995('0x3e')](_0x744bea[_0x7995('0x4a')]);_0x5e8b4c({'count':_0xd07c1c[_0x7995('0x29')],'rows':_0xd07c1c});});},'Trunks':function(){return new Promise(function(_0x4dbab8){var _0x3b45e8=_[_0x7995('0x3e')](_0x744bea['trunks']);_0x4dbab8({'count':_0x3b45e8['length'],'rows':_0x3b45e8});});},'OutboundChannels':function(){return new Promise(function(_0x3253b5){var _0x305b5a=_['values'](_0x744bea[_0x7995('0x4b')]);_0x3253b5({'count':_0x305b5a['length'],'rows':_0x305b5a});});},'Outbound':function(){return new Promise(function(_0x3758f9){_0x3758f9(_0x744bea[_0x7995('0x4c')]);});},'Campaigns':function(){return new Promise(function(_0x4ff9ff){var _0x5d9d33=_[_0x7995('0x3e')](_0x744bea['campaigns']);_0x4ff9ff({'count':_0x5d9d33[_0x7995('0x29')],'rows':_0x5d9d33});});},'VoiceQueuesPreview':function(_0xa41fff){var _0x3dd197=this;return new Promise(function(_0x45bd8a,_0x1a1873){_0x1a36d8[_0x7995('0x4d')](_0xa41fff['id'])[_0x7995('0x1b')](function(_0x14cb17){_0x45bd8a({'code':0xc8,'message':_0x14cb17[_0x7995('0x1c')]});})[_0x7995('0x1d')](function(_0x1ab590){_0x1a1873(_0x3dd197[_0x7995('0x22')](0x1f4,_0x1ab590[_0x7995('0x1c')]));});});},'EventManager':function(_0x1ff436){var _0x36e3a7=this;return new Promise(function(_0x3773de,_0x6ad274){if(!_0x1ff436[_0x7995('0x4e')]){return _0x6ad274(_0x36e3a7[_0x7995('0x22')](0x1f4,_0x7995('0x4f')));}ami[_0x7995('0x50')](_0x7995('0x51')+_0x1ff436[_0x7995('0x4e')],_0x1ff436[_0x7995('0x1c')]);_0x3773de({'code':0xc8,'message':_0x1ff436});});},'FaxAccounts':function(){return new Promise(function(_0x260ef1){var _0x33479a=_[_0x7995('0x3e')](_0x744bea[_0x7995('0x52')]);_0x260ef1({'count':_0x33479a['length'],'rows':_0x33479a});});},'SendFax':function(_0x3fdb4b){var _0x10f4ca=this;return new Promise(function(_0x5683b2,_0x4c85cb){_0x137b6b[_0x7995('0x53')](_0x3fdb4b)[_0x7995('0x1b')](function(_0x2d45d5){_0x5683b2({'code':0xc8,'message':_0x2d45d5[_0x7995('0x1c')]});})[_0x7995('0x1d')](function(_0x2491fe){_0x4c85cb(_0x10f4ca['error'](0x1f4,_0x2491fe[_0x7995('0x1c')]));});});},'CheckAfterSend':function(_0xb68962){var _0x3fea6a=this;return new Promise(function(_0x77b03f,_0x7d9c6e){_0x137b6b[_0x7995('0x54')](_0xb68962)[_0x7995('0x1b')](function(_0xc93dcb){_0x77b03f({'code':0xc8,'message':_0xc93dcb['message']});})[_0x7995('0x1d')](function(_0x2b8217){_0x7d9c6e(_0x3fea6a['error'](0x1f4,_0x2b8217['message']));});});}};var _0xd24c64=jayson[_0x7995('0x55')](_0x326741)[_0x7995('0x56')]();_0xd24c64['on'](_0x7995('0x22'),function(_0xe42797){return _0xbda126(_0xe42797);});_0xd24c64['listen'](0x232a,_0x7995('0x57'),function(){console[_0x7995('0x58')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x219534(_0x7995('0x59')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 290e494..b5c0717 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 _0x7e1a=['socket.io-emitter','info','[CM][%s][%s]','emit','data1','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','fax','createdAt','union','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','destcalleridname','Unknown','resolve','createContact','push','format','user:%s','name','trigger:%s','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','defaults','redis','localhost'];(function(_0xa913e6,_0x27a5a0){var _0x6ba4e4=function(_0x42bcb9){while(--_0x42bcb9){_0xa913e6['push'](_0xa913e6['shift']());}};_0x6ba4e4(++_0x27a5a0);}(_0x7e1a,0x1c5));var _0xa7e1=function(_0x5b369f,_0x2e5613){_0x5b369f=_0x5b369f-0x0;var _0x597062=_0x7e1a[_0x5b369f];return _0x597062;};'use strict';var _=require(_0xa7e1('0x0'));var BPromise=require(_0xa7e1('0x1'));var Redis=require(_0xa7e1('0x2'));var util=require(_0xa7e1('0x3'));var config=require(_0xa7e1('0x4'));var logger=require(_0xa7e1('0x5'))(_0xa7e1('0x6'));var cmContactRpc=require(_0xa7e1('0x7'));config['redis']=_[_0xa7e1('0x8')](config[_0xa7e1('0x9')],{'host':_0xa7e1('0xa'),'port':0x18eb});var io=require(_0xa7e1('0xb'))(new Redis(config['redis']));function emit(_0x22d066,_0x9383d,_0x19635f,_0x4623f5,_0x21fdb8){logger[_0xa7e1('0xc')](_0xa7e1('0xd'),_0x22d066,_0x9383d['id'],_0x19635f,_0x4623f5,JSON['stringify'](_0x21fdb8));io['to'](_0x19635f)[_0xa7e1('0xe')](_0x4623f5,_0x21fdb8);}exports['exec']=function(_0x4de430,_0x2bb21f,_0x30d736,_0x41a4f4){var _0xba4578,_0x50a6f3;var _0x3a268d={};var _0x29f7e8;var _0x10fc8e=Number(_0x30d736[_0xa7e1('0xf')]);var _0x2b9a42=_0x30d736['data2']?Boolean(Number(_0x30d736['data2'])):![];var _0x11f5f9;var _0x4663e8=![];if(!_[_0xa7e1('0x10')](_0x30d736[_0xa7e1('0x11')])){if(_0x30d736[_0xa7e1('0x11')]=='1')_0x4663e8=!![];}if(!_0x4663e8){if(_0x41a4f4[_0xa7e1('0x12')]){_0x3a268d['id']=_0x41a4f4[_0xa7e1('0x12')];}}if(!_0x3a268d['id']){_0x3a268d[_0xa7e1('0x13')]=_0x10fc8e;_0x11f5f9=_0x30d736[_0xa7e1('0x14')]&&_0x30d736['data3']!=='0'?_0x30d736[_0xa7e1('0x14')][_0xa7e1('0x15')](','):[_0xa7e1('0x16')];_0x3a268d[_0xa7e1('0x17')]=_[_0xa7e1('0x18')](_0x11f5f9,function(_0x351f61){var _0xee5fe4={};_0xee5fe4[_0x351f61]=_0x41a4f4[_0xa7e1('0x19')]?_0x41a4f4[_0xa7e1('0x1a')]:_0x41a4f4[_0xa7e1('0x1b')];return _0xee5fe4;});_0x29f7e8=_0x41a4f4['routeId']?_0x41a4f4[_0xa7e1('0x1a')]:_0x41a4f4['calleridnum'];}var _0xbd158b=['id',_0xa7e1('0x1c'),_0xa7e1('0x1d'),_0xa7e1('0x16'),_0xa7e1('0x1e'),_0xa7e1('0x1f'),_0xa7e1('0x13'),_0xa7e1('0x20'),'scheduledAt','updatedAt'];var _0x3309cc=_[_0xa7e1('0x21')](_0xbd158b,_0x11f5f9);BPromise['resolve']()[_0xa7e1('0x22')](cmContactRpc[_0xa7e1('0x23')]({'attributes':_0x3309cc,'where':_0x3a268d,'phone':_0x29f7e8}))['then'](function(_0x264b50){_0x50a6f3=_0x264b50;if(!_[_0xa7e1('0x24')](_0x50a6f3)){if(_0x50a6f3[_0xa7e1('0x25')]===0x1){_0xba4578=_0x50a6f3[0x0];logger[_0xa7e1('0xc')](_0xa7e1('0x26'),_0x41a4f4[_0xa7e1('0x27')],_0x2bb21f['id'],_0xba4578['id']);}else{logger['info'](_0xa7e1('0x28'),_0x41a4f4[_0xa7e1('0x27')],_0x2bb21f['id'],_[_0xa7e1('0x18')](_0x50a6f3,'id')[_0xa7e1('0x29')](','));}return;}else{logger[_0xa7e1('0xc')](_0xa7e1('0x2a'),_0x41a4f4[_0xa7e1('0x27')],_0x2bb21f['id']);var _0x26657d={'ListId':_0x10fc8e};var _0x33bb14=_0x30d736[_0xa7e1('0x2b')]&&_0x30d736[_0xa7e1('0x2b')]!=='0'?_0x30d736['data4']:_0xa7e1('0x16');if(_0x2b9a42){logger[_0xa7e1('0xc')](_0xa7e1('0x2c'),_0x41a4f4[_0xa7e1('0x27')],_0x2bb21f['id']);_0x26657d[_0x33bb14]=_['isNil'](_0x41a4f4[_0xa7e1('0x19')])?_0x41a4f4[_0xa7e1('0x1b')]:_0x41a4f4['destcalleridnum'];if(_[_0xa7e1('0x10')](_0x41a4f4[_0xa7e1('0x19')])){_0x26657d[_0xa7e1('0x1c')]=_0x41a4f4[_0xa7e1('0x2d')]&&_0x41a4f4[_0xa7e1('0x2d')]!==_0xa7e1('0x2e')?_0x41a4f4[_0xa7e1('0x2d')]:'Unknown';}else{_0x26657d[_0xa7e1('0x1c')]=_0x41a4f4[_0xa7e1('0x2f')]&&_0x41a4f4[_0xa7e1('0x2f')]!==_0xa7e1('0x2e')?_0x41a4f4[_0xa7e1('0x2f')]:_0xa7e1('0x30');}return BPromise[_0xa7e1('0x31')]()[_0xa7e1('0x22')](cmContactRpc[_0xa7e1('0x32')](_0x26657d))['then'](function(_0x5bc7f2){_0xba4578=_0x5bc7f2;_0x50a6f3['push'](_0x5bc7f2);if(_0xba4578){logger[_0xa7e1('0xc')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x41a4f4['uniqueid'],_0x2bb21f['id'],_0xba4578['id']);}return;});}else{logger[_0xa7e1('0xc')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x41a4f4[_0xa7e1('0x27')],_0x2bb21f['id']);_0x26657d[_0x33bb14]=_[_0xa7e1('0x10')](_0x41a4f4[_0xa7e1('0x19')])?_0x41a4f4[_0xa7e1('0x1b')]:_0x41a4f4[_0xa7e1('0x1a')];if(_['isNil'](_0x41a4f4[_0xa7e1('0x19')])){_0x26657d[_0xa7e1('0x1c')]=_0x41a4f4[_0xa7e1('0x2d')]&&_0x41a4f4[_0xa7e1('0x2d')]!==_0xa7e1('0x2e')?_0x41a4f4['calleridname']:_0xa7e1('0x30');}else{_0x26657d[_0xa7e1('0x1c')]=_0x41a4f4[_0xa7e1('0x2f')]&&_0x41a4f4[_0xa7e1('0x2f')]!==_0xa7e1('0x2e')?_0x41a4f4[_0xa7e1('0x2f')]:_0xa7e1('0x30');}_0xba4578=_0x26657d;_0x50a6f3[_0xa7e1('0x33')](_0x26657d);return;}}})[_0xa7e1('0x22')](function(){if(_0x4de430){emit(_0x41a4f4[_0xa7e1('0x27')],_0x2bb21f,util[_0xa7e1('0x34')](_0xa7e1('0x35'),_0x4de430[_0xa7e1('0x36')]),util['format'](_0xa7e1('0x37'),_0x30d736['action'][_0xa7e1('0x38')]()),{'evt':_[_0xa7e1('0x39')](_0x41a4f4,{'autoCreate':_0x2b9a42}),'contact':_0xba4578===undefined?{}:_0xba4578,'contacts':_0x50a6f3['length']===0x0?undefined:_0x50a6f3});}});}; \ No newline at end of file +var _0x5205=['data4','isNil','calleridname','','destcalleridname','Unknown','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','name','action','toLowerCase','lodash','bluebird','util','../../../../config/environment','trigger','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','emit','exec','data2','data5','xmd-contactid','ListId','data3','split','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','phone','createdAt','scheduledAt','updatedAt','resolve','getContacts','then','isEmpty','length','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found'];(function(_0x2bf03b,_0x1f8ca0){var _0x1a7d5d=function(_0x24972c){while(--_0x24972c){_0x2bf03b['push'](_0x2bf03b['shift']());}};_0x1a7d5d(++_0x1f8ca0);}(_0x5205,0x1e1));var _0x5520=function(_0x5a7314,_0x38678c){_0x5a7314=_0x5a7314-0x0;var _0x21037f=_0x5205[_0x5a7314];return _0x21037f;};'use strict';var _=require(_0x5520('0x0'));var BPromise=require(_0x5520('0x1'));var Redis=require('ioredis');var util=require(_0x5520('0x2'));var config=require(_0x5520('0x3'));var logger=require('../../../../config/logger')(_0x5520('0x4'));var cmContactRpc=require('../../rpc/cmContact');config[_0x5520('0x5')]=_[_0x5520('0x6')](config['redis'],{'host':_0x5520('0x7'),'port':0x18eb});var io=require(_0x5520('0x8'))(new Redis(config[_0x5520('0x5')]));function emit(_0x42a8df,_0x1d8fab,_0x50b0d2,_0x40fa21,_0x1220d7){logger[_0x5520('0x9')](_0x5520('0xa'),_0x42a8df,_0x1d8fab['id'],_0x50b0d2,_0x40fa21,JSON['stringify'](_0x1220d7));io['to'](_0x50b0d2)[_0x5520('0xb')](_0x40fa21,_0x1220d7);}exports[_0x5520('0xc')]=function(_0x20fe9a,_0x2937d9,_0x3a648b,_0x32c5c9){var _0x3941d7,_0x4520f0;var _0x5d8540={};var _0x781663;var _0x39941f=Number(_0x3a648b['data1']);var _0x3e7a9a=_0x3a648b['data2']?Boolean(Number(_0x3a648b[_0x5520('0xd')])):![];var _0x418773;var _0x36ec57=![];if(!_['isNil'](_0x3a648b['data5'])){if(_0x3a648b[_0x5520('0xe')]=='1')_0x36ec57=!![];}if(!_0x36ec57){if(_0x32c5c9[_0x5520('0xf')]){_0x5d8540['id']=_0x32c5c9[_0x5520('0xf')];}}if(!_0x5d8540['id']){_0x5d8540[_0x5520('0x10')]=_0x39941f;_0x418773=_0x3a648b[_0x5520('0x11')]&&_0x3a648b[_0x5520('0x11')]!=='0'?_0x3a648b['data3'][_0x5520('0x12')](','):['phone'];_0x5d8540[_0x5520('0x13')]=_[_0x5520('0x14')](_0x418773,function(_0xb9cf21){var _0x146b0a={};_0x146b0a[_0xb9cf21]=_0x32c5c9[_0x5520('0x15')]?_0x32c5c9[_0x5520('0x16')]:_0x32c5c9[_0x5520('0x17')];return _0x146b0a;});_0x781663=_0x32c5c9[_0x5520('0x15')]?_0x32c5c9[_0x5520('0x16')]:_0x32c5c9[_0x5520('0x17')];}var _0x410024=['id',_0x5520('0x18'),_0x5520('0x19'),_0x5520('0x1a'),'mobile','fax',_0x5520('0x10'),_0x5520('0x1b'),_0x5520('0x1c'),_0x5520('0x1d')];var _0x2805a7=_['union'](_0x410024,_0x418773);BPromise[_0x5520('0x1e')]()['then'](cmContactRpc[_0x5520('0x1f')]({'attributes':_0x2805a7,'where':_0x5d8540,'phone':_0x781663}))[_0x5520('0x20')](function(_0x1bf55a){_0x4520f0=_0x1bf55a;if(!_[_0x5520('0x21')](_0x4520f0)){if(_0x4520f0[_0x5520('0x22')]===0x1){_0x3941d7=_0x4520f0[0x0];logger[_0x5520('0x9')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x32c5c9[_0x5520('0x23')],_0x2937d9['id'],_0x3941d7['id']);}else{logger[_0x5520('0x9')](_0x5520('0x24'),_0x32c5c9[_0x5520('0x23')],_0x2937d9['id'],_['map'](_0x4520f0,'id')[_0x5520('0x25')](','));}return;}else{logger['info'](_0x5520('0x26'),_0x32c5c9[_0x5520('0x23')],_0x2937d9['id']);var _0x20955a={'ListId':_0x39941f};var _0xfd36ec=_0x3a648b[_0x5520('0x27')]&&_0x3a648b[_0x5520('0x27')]!=='0'?_0x3a648b['data4']:'phone';if(_0x3e7a9a){logger[_0x5520('0x9')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x32c5c9[_0x5520('0x23')],_0x2937d9['id']);_0x20955a[_0xfd36ec]=_[_0x5520('0x28')](_0x32c5c9[_0x5520('0x15')])?_0x32c5c9[_0x5520('0x17')]:_0x32c5c9[_0x5520('0x16')];if(_['isNil'](_0x32c5c9[_0x5520('0x15')])){_0x20955a[_0x5520('0x18')]=_0x32c5c9[_0x5520('0x29')]&&_0x32c5c9[_0x5520('0x29')]!==_0x5520('0x2a')?_0x32c5c9[_0x5520('0x29')]:'Unknown';}else{_0x20955a[_0x5520('0x18')]=_0x32c5c9[_0x5520('0x2b')]&&_0x32c5c9[_0x5520('0x2b')]!==_0x5520('0x2a')?_0x32c5c9[_0x5520('0x2b')]:_0x5520('0x2c');}return BPromise['resolve']()['then'](cmContactRpc['createContact'](_0x20955a))[_0x5520('0x20')](function(_0x1df36b){_0x3941d7=_0x1df36b;_0x4520f0[_0x5520('0x2d')](_0x1df36b);if(_0x3941d7){logger[_0x5520('0x9')](_0x5520('0x2e'),_0x32c5c9[_0x5520('0x23')],_0x2937d9['id'],_0x3941d7['id']);}return;});}else{logger[_0x5520('0x9')](_0x5520('0x2f'),_0x32c5c9[_0x5520('0x23')],_0x2937d9['id']);_0x20955a[_0xfd36ec]=_['isNil'](_0x32c5c9[_0x5520('0x15')])?_0x32c5c9[_0x5520('0x17')]:_0x32c5c9[_0x5520('0x16')];if(_[_0x5520('0x28')](_0x32c5c9[_0x5520('0x15')])){_0x20955a['firstName']=_0x32c5c9[_0x5520('0x29')]&&_0x32c5c9[_0x5520('0x29')]!==_0x5520('0x2a')?_0x32c5c9[_0x5520('0x29')]:_0x5520('0x2c');}else{_0x20955a['firstName']=_0x32c5c9[_0x5520('0x2b')]&&_0x32c5c9[_0x5520('0x2b')]!==_0x5520('0x2a')?_0x32c5c9[_0x5520('0x2b')]:_0x5520('0x2c');}_0x3941d7=_0x20955a;_0x4520f0[_0x5520('0x2d')](_0x20955a);return;}}})[_0x5520('0x20')](function(){if(_0x20fe9a){emit(_0x32c5c9[_0x5520('0x23')],_0x2937d9,util[_0x5520('0x30')]('user:%s',_0x20fe9a[_0x5520('0x31')]),util[_0x5520('0x30')]('trigger:%s',_0x3a648b[_0x5520('0x32')][_0x5520('0x33')]()),{'evt':_['merge'](_0x32c5c9,{'autoCreate':_0x3e7a9a}),'contact':_0x3941d7===undefined?{}:_0x3941d7,'contacts':_0x4520f0[_0x5520('0x22')]===0x0?undefined:_0x4520f0});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 8ab7477..6740fdd 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 _0x5fe0=['deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','custom:agentcalled','syncCustomEvent','custom:agentconnect','custom:agentringnoanswer','bind','custom:agentcomplete','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:rejectmessage','custom:offlineMessage','prototype','info','stringify','emit','clone','motionChannel','undefined','voice','checkTriggers','interface','status','checkTrigger','merge','variables','Actions','length','action','toLowerCase','contactmanager','motionbar','data1','TemplateId','html','template\x20not\x20found','buildUri','data2','isNil','data3','data4','location','uriLocation','data5','windowHeight','data6','600','winapp','winApplication','render','winArguments','format','user:%s','name','trigger:%s:%s','trigger:%s','exec','integration','queue','routeId','urlforward','script','query','search','replace','AllConditions','every','checkConditions','channel','some','AnyConditions','chat','ChatWebsiteId','operator','value','AccountId','upperFirst','interaction','event','agent','membername','lastevent','mailSubstatus','null','substatus','offlineMessage','created','equals','exports','util','lodash','url','ioredis','./urlforward','./script','../../../config/environment','../../../config/logger','trigger','defaults','localhost','redis','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts'];(function(_0x3e86f1,_0x18b838){var _0x420592=function(_0x2e1188){while(--_0x2e1188){_0x3e86f1['push'](_0x3e86f1['shift']());}};_0x420592(++_0x18b838);}(_0x5fe0,0xe8));var _0x05fe=function(_0xa11b98,_0x40cd60){_0xa11b98=_0xa11b98-0x0;var _0x31b864=_0x5fe0[_0xa11b98];return _0x31b864;};'use strict';var util=require(_0x05fe('0x0'));var _=require(_0x05fe('0x1'));var url=require(_0x05fe('0x2'));var Mustache=require('mustache');var Redis=require(_0x05fe('0x3'));var urlforward=require(_0x05fe('0x4'));var integration=require('./integration');var cmContact=require('./cmContact');var script=require(_0x05fe('0x5'));var config=require(_0x05fe('0x6'));var logger=require(_0x05fe('0x7'))(_0x05fe('0x8'));var ami=require('../ami');config['redis']=_[_0x05fe('0x9')](config['redis'],{'host':_0x05fe('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x05fe('0xb')]));var operators={'equals':function(_0x81c5d8,_0xa33d60){return _0x81c5d8==_0xa33d60;},'not_equals':function(_0x2fdc96,_0x371896){return _0x2fdc96!=_0x371896;}};var barAndWebActions=['popup',_0x05fe('0x2'),'winapp'];function Trigger(_0x57b24a){this[_0x05fe('0xc')]=_0x57b24a[_0x05fe('0xc')];this[_0x05fe('0xd')]=_0x57b24a[_0x05fe('0xd')];this['voiceQueues']=_0x57b24a[_0x05fe('0xe')];this['templates']=_0x57b24a[_0x05fe('0xf')];this[_0x05fe('0x10')]=_0x57b24a['voiceExtensions'];this[_0x05fe('0x11')]=_0x57b24a['zendeskAccounts'];this[_0x05fe('0x12')]=_0x57b24a[_0x05fe('0x12')];this[_0x05fe('0x13')]=_0x57b24a['salesforceAccounts'];this[_0x05fe('0x14')]=_0x57b24a[_0x05fe('0x14')];this[_0x05fe('0x15')]=_0x57b24a[_0x05fe('0x15')];this['deskAccounts']=_0x57b24a[_0x05fe('0x16')];this[_0x05fe('0x17')]=_0x57b24a[_0x05fe('0x17')];this['servicenowAccounts']=_0x57b24a[_0x05fe('0x18')];this['dynamics365Accounts']=_0x57b24a[_0x05fe('0x19')];this[_0x05fe('0x1a')]=_0x57b24a[_0x05fe('0x1a')];this['accounts']={'zendesk':this[_0x05fe('0x11')],'salesforce':this[_0x05fe('0x13')],'freshdesk':this[_0x05fe('0x12')],'sugarcrm':this[_0x05fe('0x14')],'zoho':this['zohoAccounts'],'desk':this[_0x05fe('0x16')],'vtiger':this['vtigerAccounts'],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0x05fe('0x1a')],'servicenow':this[_0x05fe('0x18')]};ami['on'](_0x05fe('0x1b'),this[_0x05fe('0x1c')]['bind'](this));ami['on'](_0x05fe('0x1d'),this[_0x05fe('0x1c')]['bind'](this));ami['on'](_0x05fe('0x1e'),this['syncCustomEvent'][_0x05fe('0x1f')](this));ami['on'](_0x05fe('0x20'),this[_0x05fe('0x1c')][_0x05fe('0x1f')](this));ami['on']('custom:agentnosuchnumber',this[_0x05fe('0x1c')][_0x05fe('0x1f')](this));ami['on'](_0x05fe('0x21'),this['syncCustomEvent'][_0x05fe('0x1f')](this));ami['on'](_0x05fe('0x22'),this[_0x05fe('0x1c')]['bind'](this));ami['on'](_0x05fe('0x23'),this['syncCustomEvent'][_0x05fe('0x1f')](this));ami['on'](_0x05fe('0x24'),this[_0x05fe('0x1c')][_0x05fe('0x1f')](this));ami['on'](_0x05fe('0x25'),this[_0x05fe('0x1c')][_0x05fe('0x1f')](this));ami['on'](_0x05fe('0x26'),this[_0x05fe('0x1c')][_0x05fe('0x1f')](this));ami['on'](_0x05fe('0x27'),this['syncCustomEvent'][_0x05fe('0x1f')](this));ami['on'](_0x05fe('0x28'),this[_0x05fe('0x29')]['bind'](this));ami['on'](_0x05fe('0x2a'),this[_0x05fe('0x29')][_0x05fe('0x1f')](this));ami['on'](_0x05fe('0x2b'),this[_0x05fe('0x29')]['bind'](this));ami['on'](_0x05fe('0x2c'),this[_0x05fe('0x1c')]['bind'](this));ami['on']('custom:closedinteraction',this[_0x05fe('0x1c')]['bind'](this));ami['on'](_0x05fe('0x2d'),this['syncCustomEvent']['bind'](this));ami['on'](_0x05fe('0x2e'),this[_0x05fe('0x1c')]['bind'](this));ami['on'](_0x05fe('0x2f'),this[_0x05fe('0x1c')][_0x05fe('0x1f')](this));ami['on']('custom:acceptmessage',this[_0x05fe('0x1c')]['bind'](this));ami['on'](_0x05fe('0x30'),this[_0x05fe('0x1c')][_0x05fe('0x1f')](this));ami['on'](_0x05fe('0x31'),this[_0x05fe('0x1c')][_0x05fe('0x1f')](this));}Trigger[_0x05fe('0x32')]['emit']=function(_0x31cbb6,_0x394d49,_0x2ccae6){logger[_0x05fe('0x33')](_0x31cbb6,_0x394d49,JSON[_0x05fe('0x34')](_0x2ccae6));io['to'](_0x31cbb6)[_0x05fe('0x35')](_0x394d49,_0x2ccae6);};Trigger[_0x05fe('0x32')]['syncCustomEvent']=function(_0x43978f){var _0x253962=_[_0x05fe('0x36')](_0x43978f);if(typeof _0x253962[_0x05fe('0x37')]===_0x05fe('0x38')){_0x253962[_0x05fe('0x37')]=_0x05fe('0x39');}this[_0x05fe('0x3a')](_0x253962);};Trigger[_0x05fe('0x32')][_0x05fe('0x29')]=function(_0xfd2887){if(this['agents'][_0xfd2887[_0x05fe('0x3b')]]){this['syncCustomEvent'](_0xfd2887);}};Trigger[_0x05fe('0x32')][_0x05fe('0x3a')]=function(_0x3aa437){var _0x4bfbcf;for(var _0x134c5c in this[_0x05fe('0xc')]){if(this[_0x05fe('0xc')]['hasOwnProperty'](_0x134c5c)){if(this[_0x05fe('0xc')][_0x134c5c][_0x05fe('0x3c')]){_0x4bfbcf=this[_0x05fe('0x3d')](this[_0x05fe('0xc')][_0x134c5c],_0x3aa437);if(_0x4bfbcf){_[_0x05fe('0x3e')](_0x3aa437,_0x3aa437[_0x05fe('0x3f')]);for(var _0x1002be=0x0,_0x3dcfe7,_0x5f7ec4,_0x860fec;_0x1002be0x0){_0x328a08=_[_0xb814('0x2c')](_0x5a6291,_0x271aa8);}return _0x328a08;}function getCustomFields(_0x37d24d,_0x530744){var _0x499f22=[];var _0x20577b={'custom_fields':{}};if(_0x37d24d[_0xb814('0x2d')]>0x0){_['forEach'](_0x37d24d,function(_0x338a28){if(_['includes']([_0xb814('0x2e'),'picklist'],_0x338a28['type'])&&_0x338a28[_0xb814('0x2f')]&&!_0x338a28['customField']){_0x20577b[_0x338a28[_0xb814('0x2f')][_0xb814('0x30')]()]=_0x338a28[_0xb814('0x31')]['toString']();}else if(_['includes']([_0xb814('0x2e'),_0xb814('0x32')],_0x338a28['type'])&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x338a28[_0xb814('0x31')][_0xb814('0x23')]();}else if(_0x338a28[_0xb814('0x36')]==='variable'&&_0x338a28[_0xb814('0x37')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x530744[_0x338a28[_0xb814('0x37')]]&&(_0x20577b[_0xb814('0x35')][_0x338a28['idField']]=_0x530744[_0x338a28[_0xb814('0x37')]]['toString']());}else if(_0x338a28[_0xb814('0x36')]===_0xb814('0x38')&&_0x338a28[_0xb814('0x39')]&&_0x338a28['Variable'][_0xb814('0x3a')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28['customField']){_0x530744[_0x338a28[_0xb814('0x39')][_0xb814('0x3a')][_0xb814('0x30')]()]&&(_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x530744[_0x338a28[_0xb814('0x39')]['name'][_0xb814('0x30')]()]['toString']());}});}if(_0x20577b[_0xb814('0x3b')]){_0x20577b['priority']=Number(_0x20577b[_0xb814('0x3b')]);}return _0x20577b;}function getTicket(_0x4b9233,_0x2f8a2e,_0x26675a,_0x54a7fb,_0x4d308a){logger['info']('Creating\x20new\x20ticket...');var _0x17549e=_[_0xb814('0x3c')]({'subject':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x3e')],_0x4d308a,'\x20'),'type':'phone','status':'new','labels':[_0xb814('0x3f'),'Motion',_0xb814('0x40')][_0xb814('0x41')](getTags(_0x54a7fb[_0xb814('0x42')],_0xb814('0x3a'))),'description':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x43')],_0x4d308a,'\x0a'),'_links':{'assigned_user':{'href':util[_0xb814('0x10')](_0xb814('0x44'),_0x2f8a2e['id']),'class':_0xb814('0x45')}},'message':{'direction':'in','body':intUtil['getString'](_0x54a7fb['Descriptions'],_0x4d308a,'\x0a')}},getCustomFields(_0x54a7fb['Fields'],_0x4d308a));return request({'uri':util[_0xb814('0x10')]('%s/customers/%d/cases',_0x4b9233[_0xb814('0x1a')],_0x26675a['id']),'method':'POST','body':_0x17549e});}exports[_0xb814('0x46')]=function(_0x44ff56,_0x9ef639,_0x2e97cc,_0x4fae23,_0x30fc57,_0x15f01a){var _0x2b23c7,_0x22cf27;_0x15f01a[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x15f01a['remoteUri']);_0x15f01a[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x15f01a[_0xb814('0x48')]);if(_0x30fc57&&_0x30fc57[_0xb814('0x49')]){logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x4b'));_0x9ef639['recordingURL']=util['format'](_0xb814('0x4c'),_0x15f01a[_0xb814('0x48')],_0x9ef639[_0xb814('0x4d')],md5(_0x9ef639[_0xb814('0x4d')]));}else{_0x9ef639[_0xb814('0x4e')]='';}headers[_0xb814('0x4f')]=getAuth(_0x15f01a);return getUser(_0x15f01a,_0x4fae23[_0xb814('0x50')])[_0xb814('0x12')](function(_0x2eb9b6){_0x2b23c7=_0x2eb9b6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x2b23c7['id']);return getEndUser(_0x15f01a,_0x9ef639['calleridname'],_0x9ef639[_0xb814('0x52')]);})[_0xb814('0x12')](function(_0x4a76bb){_0x22cf27=_0x4a76bb;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x22cf27['id']);return getTicket(_0x15f01a,_0x2b23c7,_0x22cf27,_0x2e97cc,_0x9ef639);})[_0xb814('0x12')](function(_0x37866f){if(_0x37866f){logger[_0xb814('0xe')](_0xb814('0x53'));logger[_0xb814('0xe')](_0xb814('0x54'),_0x37866f['id']);switch(_0x15f01a[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0x37866f['id']});break;case _0xb814('0x58'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x5a'),{'uri':util['format'](_0xb814('0x5b'),_0x37866f['id'])});break;default:logger['error'](_0xb814('0x4a'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x3cf8f8){console['error'](_0x3cf8f8);logger[_0xb814('0x5d')](_0xb814('0x4a'),JSON[_0xb814('0x5e')](_0x3cf8f8));});};exports['outbound']=function(_0x3da050,_0x5f0e58,_0x13bdcf,_0x158893,_0x4aed78,_0x39952d,_0x4a3f84){var _0x539be7,_0x3b9709;_0x39952d[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x39952d['remoteUri']);_0x39952d[_0xb814('0x48')]=intUtil['stripTrailingSlash'](_0x39952d[_0xb814('0x48')]);if(_0x4a3f84&&_0x4a3f84[_0xb814('0x5f')]&&_0x4a3f84['recordingFormat']!==_0xb814('0x60')){logger['info'](_0xb814('0x61'),_0xb814('0x4b'));_0x5f0e58[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x39952d[_0xb814('0x48')],_0x5f0e58[_0xb814('0x4d')],md5(_0x5f0e58[_0xb814('0x4d')]));}headers['Authorization']=getAuth(_0x39952d);return getUser(_0x39952d,_0x158893[_0xb814('0x50')])[_0xb814('0x12')](function(_0x5d71d5){_0x539be7=_0x5d71d5;logger[_0xb814('0xe')](_0xb814('0x51'),_0x539be7['id']);return getEndUser(_0x39952d,_0x5f0e58['destcalleridname'],_0x5f0e58[_0xb814('0x62')]);})['then'](function(_0x48362c){_0x3b9709=_0x48362c;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x3b9709['id']);return getTicket(_0x39952d,_0x539be7,_0x3b9709,_0x13bdcf,_0x5f0e58);})[_0xb814('0x12')](function(_0xd1cd8b){if(_0xd1cd8b){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')]('The\x20Ticket\x20ID\x20is:',_0xd1cd8b['id']);switch(_0x39952d[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x63'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0xd1cd8b['id']});break;case'newTab':logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),'trigger:browser:url',{'uri':util[_0xb814('0x10')]('%s/agent/tickets/%s',_0x39952d[_0xb814('0x1a')],_0xd1cd8b['id'])});break;default:logger[_0xb814('0x5d')](_0xb814('0x61'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x579351){logger[_0xb814('0x5d')]('[OUTBOUND]',JSON[_0xb814('0x5e')](_0x579351));});};exports[_0xb814('0x64')]=function(_0xa03cd2,_0x1b024f,_0x3377d4,_0x167d82,_0x143518,_0x4d44e3){var _0x44088d,_0x51ca51;_0x4d44e3[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x1a')]);_0x4d44e3[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x48')]);if(_0x143518&&_0x143518['monitor_format']){logger[_0xb814('0xe')]('['+_0x1b024f[_0xb814('0x65')]['toUpperCase']()+']',_0xb814('0x4b'));_0x1b024f[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x4d44e3[_0xb814('0x48')],_0x1b024f['uniqueid'],md5(_0x1b024f[_0xb814('0x4d')]));}else{_0x1b024f['recordingURL']='';}headers[_0xb814('0x4f')]=getAuth(_0x4d44e3);return getUser(_0x4d44e3)[_0xb814('0x12')](function(_0x2645f6){_0x44088d=_0x2645f6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x44088d['id']);return getEndUser(_0x4d44e3,_0x1b024f[_0xb814('0x66')],_0x1b024f['calleridnum']);})['then'](function(_0x5d064b){_0x51ca51=_0x5d064b;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x51ca51['id']);return getTicket(_0x4d44e3,_0x44088d,_0x51ca51,_0x3377d4,_0x1b024f);})[_0xb814('0x12')](function(_0x1d3954){if(_0x1d3954){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')](_0xb814('0x54'),_0x1d3954['id']);}})[_0xb814('0x5c')](function(_0x5aabbe){logger[_0xb814('0x5d')]('['+_0x1b024f[_0xb814('0x65')][_0xb814('0x67')]()+']',JSON[_0xb814('0x5e')](_0x5aabbe));});}; \ 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(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x326f,0xd1));var _0xf326=function(_0xa508f2,_0x10ccca){_0xa508f2=_0xa508f2-0x0;var _0x36f8f5=_0x326f[_0xa508f2];return _0x36f8f5;};'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 2c9ab99..ce22f44 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 _0x3669=['uniqueid','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','./util','ioredis','../../../../config/logger','redis','defaults','localhost','remoteUri','data7','tenantId','CloudProvider','data2','data5','POST','username','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','Bearer\x20','4.0','value','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info','systemuserid','userId','contacts','/systemusers(','body','headers','lastIndexOf','toLowerCase','outbound','destcalleridnum','calleridnum','telephone1','\x20eq\x20\x27','replace','%2b','enduserId','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','type','customField','idField','substring','content','ticketType','incident','assign','Subjects','getString','Descriptions','Fields','phonecall','callDirection','queue','/contacts(','phonecalls','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','modernAuthentication','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s'];(function(_0x479c68,_0x4f2415){var _0x5215b1=function(_0x293c65){while(--_0x293c65){_0x479c68['push'](_0x479c68['shift']());}};_0x5215b1(++_0x4f2415);}(_0x3669,0xdd));var _0x9366=function(_0x2a4561,_0x2f9333){_0x2a4561=_0x2a4561-0x0;var _0x54c911=_0x3669[_0x2a4561];return _0x54c911;};'use strict';var _=require(_0x9366('0x0'));var rp=require(_0x9366('0x1'));var util=require('util');var intUtil=require(_0x9366('0x2'));var md5=require('md5');var Redis=require(_0x9366('0x3'));var logger=require(_0x9366('0x4'))('dynamics365');var config=require('../../../../config/environment');config[_0x9366('0x5')]=_[_0x9366('0x6')](config['redis'],{'host':_0x9366('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9366('0x5')]));function getAuthToken(_0x5a8053,_0x400847,_0x27d5f7){if(_0x5a8053['modernAuthentication']){_0x5a8053[_0x9366('0x8')]=_0x5a8053['CloudProvider'][_0x9366('0x9')];_0x5a8053[_0x9366('0xa')]=_0x5a8053[_0x9366('0xb')][_0x9366('0xc')];return Promise['resolve'](_0x5a8053[_0x9366('0xb')][_0x9366('0xd')]);}var _0x391224={'method':_0x9366('0xe'),'uri':_0x400847,'form':{'client_id':_0x5a8053['clientId'],'resource':_0x5a8053[_0x9366('0x8')],'username':_0x5a8053[_0x9366('0xf')],'password':_0x5a8053[_0x9366('0x10')],'grant_type':_0x9366('0x10'),'client_secret':_0x5a8053[_0x9366('0x11')]},'json':!![]};return rp(_0x391224)[_0x9366('0x12')](function(_0x3331ed){return _0x3331ed[_0x9366('0x13')];})[_0x9366('0x14')](function(_0x38a47c){logger[_0x9366('0x15')]('['+[_0x27d5f7[_0x9366('0x16')]()]+_0x9366('0x17'));return _0x38a47c[_0x9366('0x18')];});}function getUser(_0x6ea9c4,_0x1c80a2,_0x117848,_0x5863c6,_0x324ec1,_0x3f802c){return new Promise(function(_0x132c42,_0x32ef20){return getAuthToken(_0x1c80a2,_0x5863c6,_0x3f802c)[_0x9366('0x12')](function(_0x2807e3){var _0x43ca5a={'method':_0x9366('0x19'),'uri':_0x324ec1+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x9366('0x1a')+_0x2807e3,'OData-Version':_0x9366('0x1b')},'json':!![]};return rp(_0x43ca5a);})[_0x9366('0x12')](function(_0x2256f7){var _0x401696=_0x2256f7[_0x9366('0x1c')];var _0x14edc3=![];var _0x41d8e6=null;if(!_['isNil'](_0x117848)){if(intUtil[_0x9366('0x1d')](_0x117848[_0x9366('0x1e')])){_0x6ea9c4[_0x9366('0x1f')]=_0x117848[_0x9366('0x1e')];for(_0x41d8e6=0x0;_0x41d8e6<_0x401696[_0x9366('0x20')];_0x41d8e6++){if(_0x401696[_0x41d8e6][_0x9366('0x21')]===_0x117848[_0x9366('0x1e')]&&!_0x401696[_0x41d8e6][_0x9366('0x22')]){_0x14edc3=!![];logger[_0x9366('0x23')]('['+[_0x3f802c[_0x9366('0x16')]()]+']\x20Agent\x20found\x20'+_0x401696[_0x41d8e6][_0x9366('0x24')]+'!');_0x6ea9c4[_0x9366('0x25')]=_0x401696[_0x41d8e6]['systemuserid'];}}}}if(!_0x14edc3){logger['info']('['+[_0x3f802c[_0x9366('0x16')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x6ea9c4['userEmail']=_0x1c80a2[_0x9366('0xf')];for(_0x41d8e6=0x0;_0x41d8e6<_0x401696[_0x9366('0x20')];_0x41d8e6++){if(_0x401696[_0x41d8e6][_0x9366('0x21')]===_0x1c80a2[_0x9366('0xf')]){_0x6ea9c4[_0x9366('0x25')]=_0x401696[_0x41d8e6][_0x9366('0x24')];}}}_0x132c42(_0x6ea9c4);})[_0x9366('0x14')](function(_0x4ea0ed){_0x32ef20(_0x4ea0ed['message']);});});}function createEndUser(_0x1eb978,_0x3a4006,_0x497aed,_0x310331,_0x27685f,_0x2ad043,_0x3cbfd1){return new Promise(function(_0x239e2c,_0x4c4730){return getAuthToken(_0x3a4006,_0x497aed,_0x2ad043)[_0x9366('0x12')](function(_0x4b21e8){var _0xe2a25f=_0x2ad043['toLowerCase']()==='outbound'?_0x27685f['destcalleridnum']:_0x27685f['calleridnum'];var _0x5d207c={'method':'POST','uri':_0x310331+_0x9366('0x26'),'body':{'fullname':_0xe2a25f,'firstname':_0xe2a25f,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x9366('0x27')+_0x1eb978[_0x9366('0x25')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x4b21e8,'OData-Version':_0x9366('0x1b')},'json':!![],'resolveWithFullResponse':!![]};_0x5d207c[_0x9366('0x28')][_0x3cbfd1]=_0xe2a25f;return rp(_0x5d207c);})['then'](function(_0x447133){var _0x59a1a7=_0x447133[_0x9366('0x29')]['odata-entityid'];var _0x50dc2a=_0x59a1a7['substring'](_0x59a1a7[_0x9366('0x2a')]('(')+0x1,_0x59a1a7[_0x9366('0x2a')](')'));_0x1eb978['enduserId']=_0x50dc2a;_0x239e2c(_0x1eb978);})[_0x9366('0x14')](function(_0x1fc522){_0x4c4730(_0x1fc522[_0x9366('0x18')]);});});}function getEndUser(_0x33d4b1,_0x439367,_0x3e2c62,_0x1665b2,_0x40d1fb,_0x20ca90,_0x3c43ed,_0xbb6424){var _0xb80886=_0x20ca90[_0x9366('0x2b')]()===_0x9366('0x2c')?_0x40d1fb[_0x9366('0x2d')]:_0x40d1fb[_0x9366('0x2e')];return getAuthToken(_0x439367,_0x3e2c62,_0x20ca90)[_0x9366('0x12')](function(_0x62ae6d){_0xbb6424=_0xbb6424?_0xbb6424:_0x9366('0x2f');var _0x1cf57f={'method':_0x9366('0x19'),'uri':_0x1665b2+'contacts?$select='+_0xbb6424+'&$filter='+_0xbb6424+_0x9366('0x30')+_0xb80886[_0x9366('0x31')]('+',_0x9366('0x32'))+'\x27','headers':{'Authorization':_0x9366('0x1a')+_0x62ae6d,'If-None-Match':null,'OData-Version':_0x9366('0x1b')},'json':!![]};return rp(_0x1cf57f);})[_0x9366('0x12')](function(_0x31dd1b){var _0x743db3=![];if(!_0x31dd1b)return _0x743db3;var _0x1789e3=_0x31dd1b[_0x9366('0x1c')];for(var _0x4b94fb=0x0;_0x4b94fb<_0x1789e3[_0x9366('0x20')];_0x4b94fb++){if(_0x1789e3[_0x4b94fb][_0xbb6424]===_0xb80886){_0x743db3=!![];_0x33d4b1[_0x9366('0x33')]=_0x1789e3[_0x4b94fb][_0x9366('0x34')];}}return _0x743db3;})[_0x9366('0x12')](function(_0x2a50d2){if(_0x2a50d2)return _0x33d4b1;if(_0x3c43ed===_0x9366('0x35')){logger[_0x9366('0x23')]('['+[_0x20ca90['toUpperCase']()]+_0x9366('0x36'));return _0x33d4b1;}return createEndUser(_0x33d4b1,_0x439367,_0x3e2c62,_0x1665b2,_0x40d1fb,_0x20ca90,_0xbb6424)[_0x9366('0x12')](function(_0x52d312){logger[_0x9366('0x23')]('['+[_0x20ca90['toUpperCase']()]+_0x9366('0x37'),_0x52d312[_0x9366('0x33')]);return _0x52d312;});});}function getCustomFields(_0x28661f,_0x5a951a,_0x42c65b){var _0x3717e6={};if(_0x28661f[_0x9366('0x20')]>0x0){_[_0x9366('0x38')](_0x28661f,function(_0x21f22a){if(_[_0x9366('0x39')]([_0x9366('0x3a'),'picklist'],_0x21f22a[_0x9366('0x3b')])&&_0x21f22a['nameField']&&!_0x21f22a[_0x9366('0x3c')]){var _0xd0f069=_0x21f22a[_0x9366('0x3d')][_0x9366('0x2b')]();var _0x69c540=_0xd0f069[_0x9366('0x3e')](0x0,_0xd0f069['indexOf']('_'));var _0x2807ac=_0xd0f069[_0x9366('0x3e')](_0xd0f069['indexOf']('_')+0x1);if(_0x69c540===_0x42c65b){_0x3717e6[_0x2807ac]=_0x21f22a[_0x9366('0x3f')];}}});}return _0x3717e6;}function getTicket(_0x2f22ab,_0x216e87,_0x5ee775,_0x3454c2,_0x2be28d,_0x50a630,_0x21f4a8){return new Promise(function(_0x3f50cd,_0x557f7b){var _0x26da79;return getAuthToken(_0x216e87,_0x5ee775,_0x21f4a8)[_0x9366('0x12')](function(_0xf5204e){if(_0x50a630[_0x9366('0x40')]===_0x9366('0x41')){_0x26da79={'method':_0x9366('0xe'),'uri':_0x3454c2+'incidents','body':Object[_0x9366('0x42')]({},{'title':intUtil['getString'](_0x50a630[_0x9366('0x43')],_0x2be28d,'\x20'),'description':intUtil[_0x9366('0x44')](_0x50a630[_0x9366('0x45')],_0x2be28d,'\x0a'),'customerid_contact@odata.bind':_0x2f22ab[_0x9366('0x33')]?'/contacts('+_0x2f22ab[_0x9366('0x33')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x2f22ab['userId']+')','caseorigincode':'1'},getCustomFields(_0x50a630[_0x9366('0x46')],_0x2be28d,_0x50a630['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0xf5204e,'OData-Version':_0x9366('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x50a630[_0x9366('0x40')]===_0x9366('0x47')){var _0x4ea3d4=_0x2f22ab[_0x9366('0x33')]?[{'partyid_systemuser@odata.bind':_0x9366('0x27')+_0x2f22ab[_0x9366('0x25')]+')','participationtypemask':_0x2f22ab[_0x9366('0x48')]===_0x9366('0x49')?0x2:0x1},{'partyid_contact@odata.bind':_0x9366('0x4a')+_0x2f22ab['enduserId']+')','participationtypemask':_0x2f22ab[_0x9366('0x48')]===_0x9366('0x49')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x9366('0x27')+_0x2f22ab[_0x9366('0x25')]+')','participationtypemask':_0x2f22ab[_0x9366('0x48')]===_0x9366('0x49')?0x2:0x1}];_0x26da79={'method':_0x9366('0xe'),'uri':_0x3454c2+_0x9366('0x4b'),'body':Object[_0x9366('0x42')]({},{'subject':intUtil[_0x9366('0x44')](_0x50a630[_0x9366('0x43')],_0x2be28d,'\x20'),'phonenumber':String(_0x2be28d[_0x9366('0x2e')]),'description':intUtil[_0x9366('0x44')](_0x50a630[_0x9366('0x45')],_0x2be28d,'\x0a'),'regardingobjectid_contact@odata.bind':_0x2f22ab[_0x9366('0x33')]?_0x9366('0x4a')+_0x2f22ab[_0x9366('0x33')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x2f22ab[_0x9366('0x25')]+')','directioncode':_0x2f22ab['callDirection']==='queue'?![]:!![],'phonecall_activity_parties':_0x4ea3d4},getCustomFields(_0x50a630[_0x9366('0x46')],_0x2be28d,_0x50a630[_0x9366('0x40')])),'headers':{'Authorization':_0x9366('0x1a')+_0xf5204e,'OData-Version':_0x9366('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x26da79);})['then'](function(_0x2533b4){var _0x54365a=_0x2533b4['headers']['odata-entityid'];var _0x229bdb=_0x54365a[_0x9366('0x3e')](_0x54365a[_0x9366('0x2a')]('(')+0x1,_0x54365a['lastIndexOf'](')'));_0x2f22ab[_0x9366('0x4c')]=_0x229bdb;_0x3f50cd(_0x2f22ab);})[_0x9366('0x14')](function(_0x5dc8cb){_0x557f7b(_0x5dc8cb[_0x9366('0x18')]);});});}function emit(_0x306379,_0x2d461a,_0x1cebd9,_0x16a2dc){var _0x43dbc3={'uri':util[_0x9366('0x4d')](_0x9366('0x4e'),_0x306379,_0x1cebd9,_0x16a2dc)};io['to'](util[_0x9366('0x4d')]('user:%s',_0x2d461a))[_0x9366('0x4f')]('trigger:browser:url',_0x43dbc3);}exports['cs']=function(_0xc367c,_0x90fc80,_0x564ee7,_0x5e5013,_0x5f27f8,_0x19e140,_0x5a6bc6,_0x5bac42){var _0x30b01b={};_0x19e140[_0x9366('0x8')]=_0x19e140[_0x9366('0x50')]?intUtil['stripTrailingSlash'](_0x19e140[_0x9366('0xb')][_0x9366('0x9')]):intUtil[_0x9366('0x51')](_0x19e140[_0x9366('0x8')]);_0x19e140['serverUrl']=intUtil[_0x9366('0x51')](_0x19e140[_0x9366('0x52')]);_0x30b01b[_0x9366('0x48')]=_0x5bac42===_0x9366('0x49')||_0x5bac42==='unmanaged'?_0x9366('0x49'):_0x9366('0x2c');var _0x5813f8=_0x19e140[_0x9366('0x50')]?util[_0x9366('0x4d')](_0x9366('0x53'),_0x19e140[_0x9366('0xb')][_0x9366('0x9')]):util[_0x9366('0x4d')]('%s/api/data/v9.0/',_0x19e140[_0x9366('0x8')]);var _0x4ea10d=util[_0x9366('0x4d')]('https://login.microsoftonline.com/%s/oauth2/token',_0x19e140[_0x9366('0xa')]);var _0xf3cf1c=util['format'](_0x9366('0x54'),_0x19e140['serverUrl'],_0x90fc80[_0x9366('0x55')],md5(_0x90fc80[_0x9366('0x55')]));if(_0x5f27f8&&_0x5f27f8['monitor_format']){logger['info']('[QUEUE]',_0x9366('0x56'));_0x90fc80['recordingURL']=_0xf3cf1c;}else if(_0x5a6bc6&&_0x5a6bc6[_0x9366('0x57')]&&_0x5a6bc6['recordingFormat']!==_0x9366('0x58')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x90fc80['recordingURL']=_0xf3cf1c;}else{_0x90fc80[_0x9366('0x59')]='';}return getUser(_0x30b01b,_0x19e140,_0x5e5013,_0x4ea10d,_0x5813f8,_0x5bac42)['then'](function(_0x585804){logger[_0x9366('0x23')]('['+_0x5bac42[_0x9366('0x16')]()+_0x9366('0x5a'),_0x585804['userId']);logger[_0x9366('0x23')]('['+_0x5bac42[_0x9366('0x16')]()+_0x9366('0x5b'),_0x585804[_0x9366('0x1f')]);return getEndUser(_0x585804,_0x19e140,_0x4ea10d,_0x5813f8,_0x90fc80,_0x5bac42,_0x564ee7[_0x9366('0x5c')],_0x564ee7[_0x9366('0x5d')]);})[_0x9366('0x12')](function(_0x5b1610){logger[_0x9366('0x23')]('['+_0x5bac42[_0x9366('0x16')]()+_0x9366('0x5e'),_0x5b1610[_0x9366('0x33')]);logger[_0x9366('0x23')]('['+_0x5bac42[_0x9366('0x16')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x90fc80['calleridnum']);return getTicket(_0x5b1610,_0x19e140,_0x4ea10d,_0x5813f8,_0x90fc80,_0x564ee7,_0x5bac42);})['then'](function(_0x5ddf81){logger[_0x9366('0x23')](util['format']('['+_0x5bac42[_0x9366('0x16')]()+_0x9366('0x5f'),_0x564ee7[_0x9366('0x40')],_0x5ddf81[_0x9366('0x4c')]));logger['info'](util[_0x9366('0x4d')]('['+_0x5bac42[_0x9366('0x16')]()+_0x9366('0x60'),_0x5bac42));if(_0x5bac42!==_0x9366('0x61')&&_0x564ee7['openNewTab']){logger[_0x9366('0x23')]('['+_0x5bac42[_0x9366('0x16')]()+']',_0x9366('0x62'));emit(_0x19e140[_0x9366('0x8')],_0x5e5013[_0x9366('0x63')],_0x564ee7[_0x9366('0x40')],_0x5ddf81['ticketId']);}})[_0x9366('0x14')](function(_0x40161c){logger[_0x9366('0x15')]('['+_0x5bac42[_0x9366('0x16')]()+_0x9366('0x64'),_0x40161c[_0x9366('0x18')]);console[_0x9366('0x15')](_0x9366('0x65'),_0x40161c);});}; \ No newline at end of file +var _0x17c0=['length','internalemailaddress','isdisabled',']\x20Agent\x20found\x20','systemuserid','userId','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','message','destcalleridnum','calleridnum','contacts','/systemusers(','body','odata-entityid','lastIndexOf','outbound','telephone1','GET','&$filter=','\x20eq\x20\x27','replace','%2b','value','enduserId','contactid',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','string','type','nameField','customField','idField','toLowerCase','substring','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','callDirection','queue','phonecalls','headers','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','stripTrailingSlash','data7','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','additionalSearchContact',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','tenantId','data2','resolve','data5','POST','clientId','password','clientSecret','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','then','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','isNil','userEmail','email'];(function(_0x5b76ad,_0x52efae){var _0x347b4a=function(_0x2c3e3b){while(--_0x2c3e3b){_0x5b76ad['push'](_0x5b76ad['shift']());}};_0x347b4a(++_0x52efae);}(_0x17c0,0x19a));var _0x017c=function(_0x163040,_0x38a58c){_0x163040=_0x163040-0x0;var _0x364667=_0x17c0[_0x163040];return _0x364667;};'use strict';var _=require(_0x017c('0x0'));var rp=require(_0x017c('0x1'));var util=require(_0x017c('0x2'));var intUtil=require(_0x017c('0x3'));var md5=require('md5');var Redis=require(_0x017c('0x4'));var logger=require(_0x017c('0x5'))(_0x017c('0x6'));var config=require(_0x017c('0x7'));config[_0x017c('0x8')]=_['defaults'](config[_0x017c('0x8')],{'host':_0x017c('0x9'),'port':0x18eb});var io=require(_0x017c('0xa'))(new Redis(config['redis']));function getAuthToken(_0x137c5a,_0x50bb08,_0x58c83a){if(_0x137c5a[_0x017c('0xb')]){_0x137c5a[_0x017c('0xc')]=_0x137c5a[_0x017c('0xd')]['data7'];_0x137c5a[_0x017c('0xe')]=_0x137c5a[_0x017c('0xd')][_0x017c('0xf')];return Promise[_0x017c('0x10')](_0x137c5a[_0x017c('0xd')][_0x017c('0x11')]);}var _0x1c7ece={'method':_0x017c('0x12'),'uri':_0x50bb08,'form':{'client_id':_0x137c5a[_0x017c('0x13')],'resource':_0x137c5a[_0x017c('0xc')],'username':_0x137c5a['username'],'password':_0x137c5a['password'],'grant_type':_0x017c('0x14'),'client_secret':_0x137c5a[_0x017c('0x15')]},'json':!![]};return rp(_0x1c7ece)['then'](function(_0x4229d2){return _0x4229d2[_0x017c('0x16')];})[_0x017c('0x17')](function(_0x3a93f7){logger[_0x017c('0x18')]('['+[_0x58c83a[_0x017c('0x19')]()]+_0x017c('0x1a'));return _0x3a93f7['message'];});}function getUser(_0xb1fc0,_0x7747fc,_0x27f111,_0x123bce,_0xc645c8,_0x3cdcec){return new Promise(function(_0x5f3920,_0x15ad7c){return getAuthToken(_0x7747fc,_0x123bce,_0x3cdcec)[_0x017c('0x1b')](function(_0x297ca2){var _0x13a0da={'method':'GET','uri':_0xc645c8+_0x017c('0x1c'),'headers':{'Authorization':_0x017c('0x1d')+_0x297ca2,'OData-Version':_0x017c('0x1e')},'json':!![]};return rp(_0x13a0da);})[_0x017c('0x1b')](function(_0x3b2f1c){var _0x376bc2=_0x3b2f1c['value'];var _0x3c54f8=![];var _0x5d068c=null;if(!_[_0x017c('0x1f')](_0x27f111)){if(intUtil['validateEmail'](_0x27f111['email'])){_0xb1fc0[_0x017c('0x20')]=_0x27f111[_0x017c('0x21')];for(_0x5d068c=0x0;_0x5d068c<_0x376bc2[_0x017c('0x22')];_0x5d068c++){if(_0x376bc2[_0x5d068c][_0x017c('0x23')]===_0x27f111[_0x017c('0x21')]&&!_0x376bc2[_0x5d068c][_0x017c('0x24')]){_0x3c54f8=!![];logger['info']('['+[_0x3cdcec[_0x017c('0x19')]()]+_0x017c('0x25')+_0x376bc2[_0x5d068c][_0x017c('0x26')]+'!');_0xb1fc0[_0x017c('0x27')]=_0x376bc2[_0x5d068c]['systemuserid'];}}}}if(!_0x3c54f8){logger[_0x017c('0x28')]('['+[_0x3cdcec['toUpperCase']()]+_0x017c('0x29'));_0xb1fc0['userEmail']=_0x7747fc['username'];for(_0x5d068c=0x0;_0x5d068c<_0x376bc2[_0x017c('0x22')];_0x5d068c++){if(_0x376bc2[_0x5d068c][_0x017c('0x23')]===_0x7747fc['username']){_0xb1fc0['userId']=_0x376bc2[_0x5d068c][_0x017c('0x26')];}}}_0x5f3920(_0xb1fc0);})[_0x017c('0x17')](function(_0x4f02e3){_0x15ad7c(_0x4f02e3[_0x017c('0x2a')]);});});}function createEndUser(_0x394743,_0x1b9385,_0x4f5fe1,_0x45f69d,_0x411977,_0x381f53,_0x4b8be3){return new Promise(function(_0x34a944,_0x52b835){return getAuthToken(_0x1b9385,_0x4f5fe1,_0x381f53)[_0x017c('0x1b')](function(_0x25fc82){var _0x2c2f94=_0x381f53['toLowerCase']()==='outbound'?_0x411977[_0x017c('0x2b')]:_0x411977[_0x017c('0x2c')];var _0x2acf17={'method':_0x017c('0x12'),'uri':_0x45f69d+_0x017c('0x2d'),'body':{'fullname':_0x2c2f94,'firstname':_0x2c2f94,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x017c('0x2e')+_0x394743[_0x017c('0x27')]+')'},'headers':{'Authorization':_0x017c('0x1d')+_0x25fc82,'OData-Version':_0x017c('0x1e')},'json':!![],'resolveWithFullResponse':!![]};_0x2acf17[_0x017c('0x2f')][_0x4b8be3]=_0x2c2f94;return rp(_0x2acf17);})['then'](function(_0x74422c){var _0x27bc1f=_0x74422c['headers'][_0x017c('0x30')];var _0x4efcbd=_0x27bc1f['substring'](_0x27bc1f[_0x017c('0x31')]('(')+0x1,_0x27bc1f[_0x017c('0x31')](')'));_0x394743['enduserId']=_0x4efcbd;_0x34a944(_0x394743);})[_0x017c('0x17')](function(_0x35e133){_0x52b835(_0x35e133['message']);});});}function getEndUser(_0x280197,_0x4946ad,_0x56d298,_0x51f04c,_0x1f0f50,_0x364072,_0x24cf72,_0x4bff4c){var _0x2e9a97=_0x364072['toLowerCase']()===_0x017c('0x32')?_0x1f0f50[_0x017c('0x2b')]:_0x1f0f50[_0x017c('0x2c')];return getAuthToken(_0x4946ad,_0x56d298,_0x364072)['then'](function(_0x4075ba){_0x4bff4c=_0x4bff4c?_0x4bff4c:_0x017c('0x33');var _0x37bd11={'method':_0x017c('0x34'),'uri':_0x51f04c+'contacts?$select='+_0x4bff4c+_0x017c('0x35')+_0x4bff4c+_0x017c('0x36')+_0x2e9a97[_0x017c('0x37')]('+',_0x017c('0x38'))+'\x27','headers':{'Authorization':_0x017c('0x1d')+_0x4075ba,'If-None-Match':null,'OData-Version':_0x017c('0x1e')},'json':!![]};return rp(_0x37bd11);})[_0x017c('0x1b')](function(_0x55fc01){var _0x517bf1=![];if(!_0x55fc01)return _0x517bf1;var _0x5d784b=_0x55fc01[_0x017c('0x39')];for(var _0x3cfab6=0x0;_0x3cfab6<_0x5d784b[_0x017c('0x22')];_0x3cfab6++){if(_0x5d784b[_0x3cfab6][_0x4bff4c]===_0x2e9a97){_0x517bf1=!![];_0x280197[_0x017c('0x3a')]=_0x5d784b[_0x3cfab6][_0x017c('0x3b')];}}return _0x517bf1;})[_0x017c('0x1b')](function(_0x107222){if(_0x107222)return _0x280197;if(_0x24cf72==='nothing'){logger[_0x017c('0x28')]('['+[_0x364072[_0x017c('0x19')]()]+_0x017c('0x3c'));return _0x280197;}return createEndUser(_0x280197,_0x4946ad,_0x56d298,_0x51f04c,_0x1f0f50,_0x364072,_0x4bff4c)[_0x017c('0x1b')](function(_0x4f0490){logger[_0x017c('0x28')]('['+[_0x364072[_0x017c('0x19')]()]+_0x017c('0x3d'),_0x4f0490[_0x017c('0x3a')]);return _0x4f0490;});});}function getCustomFields(_0x1711f8,_0x22ebd3,_0x2a0e82){var _0x25daed={};if(_0x1711f8['length']>0x0){_[_0x017c('0x3e')](_0x1711f8,function(_0x48e1dc){if(_['includes']([_0x017c('0x3f'),'picklist'],_0x48e1dc[_0x017c('0x40')])&&_0x48e1dc[_0x017c('0x41')]&&!_0x48e1dc[_0x017c('0x42')]){var _0x2a2318=_0x48e1dc[_0x017c('0x43')][_0x017c('0x44')]();var _0x37a861=_0x2a2318[_0x017c('0x45')](0x0,_0x2a2318[_0x017c('0x46')]('_'));var _0x29a25e=_0x2a2318[_0x017c('0x45')](_0x2a2318[_0x017c('0x46')]('_')+0x1);if(_0x37a861===_0x2a0e82){_0x25daed[_0x29a25e]=_0x48e1dc[_0x017c('0x47')];}}});}return _0x25daed;}function getTicket(_0x47eea4,_0x6766b7,_0x2def3b,_0x1a7bb3,_0x19185a,_0x472ec1,_0x1a4b91){return new Promise(function(_0x5600e1,_0x106e81){var _0x3f2162;return getAuthToken(_0x6766b7,_0x2def3b,_0x1a4b91)[_0x017c('0x1b')](function(_0xd6710f){if(_0x472ec1[_0x017c('0x48')]===_0x017c('0x49')){_0x3f2162={'method':_0x017c('0x12'),'uri':_0x1a7bb3+_0x017c('0x4a'),'body':Object[_0x017c('0x4b')]({},{'title':intUtil[_0x017c('0x4c')](_0x472ec1[_0x017c('0x4d')],_0x19185a,'\x20'),'description':intUtil[_0x017c('0x4c')](_0x472ec1[_0x017c('0x4e')],_0x19185a,'\x0a'),'customerid_contact@odata.bind':_0x47eea4[_0x017c('0x3a')]?_0x017c('0x4f')+_0x47eea4['enduserId']+')':undefined,'ownerid@odata.bind':_0x017c('0x2e')+_0x47eea4[_0x017c('0x27')]+')','caseorigincode':'1'},getCustomFields(_0x472ec1[_0x017c('0x50')],_0x19185a,_0x472ec1[_0x017c('0x48')])),'headers':{'Authorization':_0x017c('0x1d')+_0xd6710f,'OData-Version':_0x017c('0x1e')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x472ec1[_0x017c('0x48')]==='phonecall'){var _0x4d7523=_0x47eea4['enduserId']?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x47eea4[_0x017c('0x27')]+')','participationtypemask':_0x47eea4[_0x017c('0x51')]===_0x017c('0x52')?0x2:0x1},{'partyid_contact@odata.bind':_0x017c('0x4f')+_0x47eea4['enduserId']+')','participationtypemask':_0x47eea4[_0x017c('0x51')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x017c('0x2e')+_0x47eea4[_0x017c('0x27')]+')','participationtypemask':_0x47eea4[_0x017c('0x51')]===_0x017c('0x52')?0x2:0x1}];_0x3f2162={'method':_0x017c('0x12'),'uri':_0x1a7bb3+_0x017c('0x53'),'body':Object[_0x017c('0x4b')]({},{'subject':intUtil[_0x017c('0x4c')](_0x472ec1[_0x017c('0x4d')],_0x19185a,'\x20'),'phonenumber':String(_0x19185a['calleridnum']),'description':intUtil[_0x017c('0x4c')](_0x472ec1['Descriptions'],_0x19185a,'\x0a'),'regardingobjectid_contact@odata.bind':_0x47eea4[_0x017c('0x3a')]?'/contacts('+_0x47eea4[_0x017c('0x3a')]+')':undefined,'ownerid@odata.bind':_0x017c('0x2e')+_0x47eea4[_0x017c('0x27')]+')','directioncode':_0x47eea4[_0x017c('0x51')]===_0x017c('0x52')?![]:!![],'phonecall_activity_parties':_0x4d7523},getCustomFields(_0x472ec1[_0x017c('0x50')],_0x19185a,_0x472ec1[_0x017c('0x48')])),'headers':{'Authorization':_0x017c('0x1d')+_0xd6710f,'OData-Version':_0x017c('0x1e')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x3f2162);})[_0x017c('0x1b')](function(_0x3534d1){var _0x5b8da1=_0x3534d1[_0x017c('0x54')][_0x017c('0x30')];var _0xab3355=_0x5b8da1['substring'](_0x5b8da1['lastIndexOf']('(')+0x1,_0x5b8da1[_0x017c('0x31')](')'));_0x47eea4[_0x017c('0x55')]=_0xab3355;_0x5600e1(_0x47eea4);})[_0x017c('0x17')](function(_0x64e87){_0x106e81(_0x64e87[_0x017c('0x2a')]);});});}function emit(_0x2b9702,_0x35b7aa,_0x5bc685,_0x3a8968){var _0x7fd261={'uri':util[_0x017c('0x56')](_0x017c('0x57'),_0x2b9702,_0x5bc685,_0x3a8968)};io['to'](util['format'](_0x017c('0x58'),_0x35b7aa))[_0x017c('0x59')]('trigger:browser:url',_0x7fd261);}exports['cs']=function(_0x5b873c,_0x3cbc35,_0x456e55,_0x54c7b7,_0xa88881,_0x70b7cf,_0x41d041,_0xefd3a0){var _0x38b196={};_0x70b7cf[_0x017c('0xc')]=_0x70b7cf[_0x017c('0xb')]?intUtil[_0x017c('0x5a')](_0x70b7cf['CloudProvider'][_0x017c('0x5b')]):intUtil[_0x017c('0x5a')](_0x70b7cf[_0x017c('0xc')]);_0x70b7cf[_0x017c('0x5c')]=intUtil[_0x017c('0x5a')](_0x70b7cf[_0x017c('0x5c')]);_0x38b196[_0x017c('0x51')]=_0xefd3a0===_0x017c('0x52')||_0xefd3a0===_0x017c('0x5d')?_0x017c('0x52'):_0x017c('0x32');var _0x2fa182=_0x70b7cf[_0x017c('0xb')]?util[_0x017c('0x56')](_0x017c('0x5e'),_0x70b7cf[_0x017c('0xd')][_0x017c('0x5b')]):util[_0x017c('0x56')](_0x017c('0x5e'),_0x70b7cf[_0x017c('0xc')]);var _0x1d6fec=util[_0x017c('0x56')](_0x017c('0x5f'),_0x70b7cf[_0x017c('0xe')]);var _0x327a3f=util[_0x017c('0x56')](_0x017c('0x60'),_0x70b7cf['serverUrl'],_0x3cbc35['uniqueid'],md5(_0x3cbc35[_0x017c('0x61')]));if(_0xa88881&&_0xa88881[_0x017c('0x62')]){logger['info']('[QUEUE]',_0x017c('0x63'));_0x3cbc35[_0x017c('0x64')]=_0x327a3f;}else if(_0x41d041&&_0x41d041[_0x017c('0x65')]&&_0x41d041['recordingFormat']!==_0x017c('0x66')){logger[_0x017c('0x28')](_0x017c('0x67'),_0x017c('0x63'));_0x3cbc35[_0x017c('0x64')]=_0x327a3f;}else{_0x3cbc35['recordingURL']='';}return getUser(_0x38b196,_0x70b7cf,_0x54c7b7,_0x1d6fec,_0x2fa182,_0xefd3a0)[_0x017c('0x1b')](function(_0x13392d){logger['info']('['+_0xefd3a0[_0x017c('0x19')]()+_0x017c('0x68'),_0x13392d[_0x017c('0x27')]);logger['info']('['+_0xefd3a0[_0x017c('0x19')]()+_0x017c('0x69'),_0x13392d['userEmail']);return getEndUser(_0x13392d,_0x70b7cf,_0x1d6fec,_0x2fa182,_0x3cbc35,_0xefd3a0,_0x456e55['moduleCreate'],_0x456e55[_0x017c('0x6a')]);})['then'](function(_0x3b42b6){logger[_0x017c('0x28')]('['+_0xefd3a0[_0x017c('0x19')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x3b42b6[_0x017c('0x3a')]);logger['info']('['+_0xefd3a0[_0x017c('0x19')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x3cbc35[_0x017c('0x2c')]);return getTicket(_0x3b42b6,_0x70b7cf,_0x1d6fec,_0x2fa182,_0x3cbc35,_0x456e55,_0xefd3a0);})[_0x017c('0x1b')](function(_0x3301aa){logger['info'](util[_0x017c('0x56')]('['+_0xefd3a0[_0x017c('0x19')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x456e55[_0x017c('0x48')],_0x3301aa[_0x017c('0x55')]));logger['info'](util[_0x017c('0x56')]('['+_0xefd3a0[_0x017c('0x19')]()+_0x017c('0x6b'),_0xefd3a0));if(_0xefd3a0!=='unmanaged'&&_0x456e55['openNewTab']){logger[_0x017c('0x28')]('['+_0xefd3a0[_0x017c('0x19')]()+']',_0x017c('0x6c'));emit(_0x70b7cf[_0x017c('0xc')],_0x54c7b7[_0x017c('0x6d')],_0x456e55[_0x017c('0x48')],_0x3301aa[_0x017c('0x55')]);}})[_0x017c('0x17')](function(_0x256dce){logger['error']('['+_0xefd3a0[_0x017c('0x19')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x256dce[_0x017c('0x2a')]);console[_0x017c('0x18')](_0x017c('0x6e'),_0x256dce);});}; \ 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 b0f390f..6462443 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 _0xfb78=['toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Ticket\x20ID\x20is:','user:%s','%s/helpdesk/tickets/%d','error','outbound','none','[OUTBOUND]','Recording\x20is\x20enabled!','Authorization','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','trigger:browser:url','unmanaged','lastevent','toUpperCase','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','localhost','socket.io-emitter','application/json','Creating\x20new\x20ticket...','merge','calleridname','getString','Descriptions','name','Fields','custom_fields','mapValues','keyBy','value','format','%s/api/v2/tickets','remoteUri','POST','info','validateEmail','then','length','Agent\x20found!','find','email','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','apiKey','toString','base64','debug','stringify','defaults','GET','map','forEach','includes','picklist','customField','nameField','content','string','type','idField','variable','variableName','push','Variable'];(function(_0x94a896,_0x356da2){var _0x1aee9c=function(_0xb00178){while(--_0xb00178){_0x94a896['push'](_0x94a896['shift']());}};_0x1aee9c(++_0x356da2);}(_0xfb78,0x1c8));var _0x8fb7=function(_0x44c325,_0x19c625){_0x44c325=_0x44c325-0x0;var _0x55f09e=_0xfb78[_0x44c325];return _0x55f09e;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require('md5');var util=require(_0x8fb7('0x0'));var Redis=require(_0x8fb7('0x1'));var intUtil=require(_0x8fb7('0x2'));var config=require(_0x8fb7('0x3'));var logger=require(_0x8fb7('0x4'))(_0x8fb7('0x5'));config[_0x8fb7('0x6')]=_['defaults'](config[_0x8fb7('0x6')],{'host':_0x8fb7('0x7'),'port':0x18eb});var io=require(_0x8fb7('0x8'))(new Redis(config['redis']));var headers={'Content-Type':_0x8fb7('0x9'),'Accept':_0x8fb7('0x9')};function emit(_0x29adf6,_0x4804ae,_0x490019){io['to'](_0x29adf6)['emit'](_0x4804ae,_0x490019);}function getTicket(_0x298f6f,_0x34d8ea,_0x109840,_0x5e19c8,_0x4f15e9){logger['info'](_0x8fb7('0xa'));var _0x6d6442=_[_0x8fb7('0xb')]({'responder_id':_0x34d8ea['id'],'requester_id':_0x109840['id'],'name':util['format']('Caller\x20-\x20%s',_0x4f15e9[_0x8fb7('0xc')]),'phone':_0x4f15e9['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x8fb7('0xd')](_0x5e19c8['Subjects'],_0x4f15e9,'\x20'),'description':intUtil['getString'](_0x5e19c8[_0x8fb7('0xe')],_0x4f15e9,'
'),'tags':getTags(_0x5e19c8['Tags'],_0x8fb7('0xf'))},getCustomFields(_0x5e19c8[_0x8fb7('0x10')],_0x4f15e9));_0x6d6442[_0x8fb7('0x11')]=_[_0x8fb7('0x12')](_[_0x8fb7('0x13')](_0x6d6442['custom_fields'],'id'),_0x8fb7('0x14'));return request({'uri':util[_0x8fb7('0x15')](_0x8fb7('0x16'),_0x298f6f[_0x8fb7('0x17')]),'method':_0x8fb7('0x18'),'body':_0x6d6442})['then'](function(_0x4e2954){logger[_0x8fb7('0x19')]('Ticket\x20created!');return _0x4e2954;});}function getUser(_0x48f1f9,_0x44a379){if(intUtil[_0x8fb7('0x1a')](_0x44a379)){return request({'uri':util[_0x8fb7('0x15')]('%s/api/v2/agents',_0x48f1f9[_0x8fb7('0x17')]),'qs':{'email':_0x44a379}})[_0x8fb7('0x1b')](function(_0x567fb7){if(_0x567fb7[_0x8fb7('0x1c')]){logger[_0x8fb7('0x19')](_0x8fb7('0x1d'));return _[_0x8fb7('0x1e')](_0x567fb7,function(_0x4c6fb6){return _0x4c6fb6['contact'][_0x8fb7('0x1f')]===_0x44a379;});}else{logger[_0x8fb7('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x8fb7('0x15')](_0x8fb7('0x20'),_0x48f1f9['remoteUri'])})[_0x8fb7('0x1b')](function(_0xd7e9cc){logger[_0x8fb7('0x19')](_0x8fb7('0x21'));return _0xd7e9cc;});}});}else{logger['info'](_0x8fb7('0x22'));return request({'uri':util[_0x8fb7('0x15')](_0x8fb7('0x20'),_0x48f1f9[_0x8fb7('0x17')])})[_0x8fb7('0x1b')](function(_0x5cc0c4){logger[_0x8fb7('0x19')]('Admin\x20account\x20selected.');return _0x5cc0c4;});}}function getEndUser(_0x2b2957,_0x3cc084,_0x455679){logger['info']('Searching\x20enduser\x20with\x20phone',_0x455679);return request({'uri':util[_0x8fb7('0x15')](_0x8fb7('0x23'),_0x2b2957[_0x8fb7('0x17')]),'qs':{'phone':_0x455679}})['then'](function(_0x3946e2){if(_0x3946e2['length']){logger['info'](_0x8fb7('0x24'));return _['find'](_0x3946e2,{'phone':_0x455679});}else{logger[_0x8fb7('0x19')](_0x8fb7('0x25'));return request({'uri':util[_0x8fb7('0x15')](_0x8fb7('0x23'),_0x2b2957['remoteUri']),'method':_0x8fb7('0x18'),'body':{'name':_0x3cc084,'phone':_0x455679}})[_0x8fb7('0x1b')](function(_0x185f91){logger['info'](_0x8fb7('0x26'));return _0x185f91;});}});}function getAuth(_0x4e30d9){return util[_0x8fb7('0x15')]('Basic\x20%s',new Buffer(_0x4e30d9[_0x8fb7('0x27')]+':X')[_0x8fb7('0x28')](_0x8fb7('0x29')));}function request(_0x5c7735){logger[_0x8fb7('0x2a')]('[HTTP]',JSON[_0x8fb7('0x2b')](_0x5c7735));return rp(_[_0x8fb7('0x2c')](_0x5c7735,{'method':_0x8fb7('0x2d'),'headers':headers,'json':!![]}));}function getTags(_0x86450b,_0x1eb15e){var _0x4f7c26=[];if(_0x86450b&&_0x86450b['length']>0x0){_0x4f7c26=_[_0x8fb7('0x2e')](_0x86450b,_0x1eb15e);}return _0x4f7c26;}function getCustomFields(_0x17163c,_0x332ff6){var _0xc1cb4c=[];var _0x549f39={'custom_fields':[]};if(_0x17163c[_0x8fb7('0x1c')]>0x0){_[_0x8fb7('0x2f')](_0x17163c,function(_0x48397c){if(_[_0x8fb7('0x30')](['string',_0x8fb7('0x31')],_0x48397c['type'])&&_0x48397c['nameField']&&!_0x48397c[_0x8fb7('0x32')]){_0x549f39[_0x48397c[_0x8fb7('0x33')]['toLowerCase']()]=_0x48397c[_0x8fb7('0x34')][_0x8fb7('0x28')]();}else if(_[_0x8fb7('0x30')]([_0x8fb7('0x35'),'picklist'],_0x48397c[_0x8fb7('0x36')])&&_0x48397c[_0x8fb7('0x37')]&&_0x48397c[_0x8fb7('0x32')]){_0x549f39[_0x8fb7('0x11')]['push']({'id':_0x48397c['idField'],'value':_0x48397c[_0x8fb7('0x34')][_0x8fb7('0x28')]()});}else if(_0x48397c[_0x8fb7('0x36')]===_0x8fb7('0x38')&&_0x48397c[_0x8fb7('0x39')]&&_0x48397c[_0x8fb7('0x37')]&&_0x48397c[_0x8fb7('0x32')]){_0x332ff6[_0x48397c['variableName']]&&_0x549f39[_0x8fb7('0x11')][_0x8fb7('0x3a')]({'id':_0x48397c[_0x8fb7('0x37')],'value':_0x332ff6[_0x48397c[_0x8fb7('0x39')]]['toString']()});}else if(_0x48397c[_0x8fb7('0x36')]==='customVariable'&&_0x48397c[_0x8fb7('0x3b')]&&_0x48397c[_0x8fb7('0x3b')][_0x8fb7('0xf')]&&_0x48397c[_0x8fb7('0x37')]&&_0x48397c[_0x8fb7('0x32')]){_0x332ff6[_0x48397c[_0x8fb7('0x3b')][_0x8fb7('0xf')][_0x8fb7('0x3c')]()]&&_0x549f39['custom_fields']['push']({'id':_0x48397c[_0x8fb7('0x37')],'value':_0x332ff6[_0x48397c['Variable'][_0x8fb7('0xf')][_0x8fb7('0x3c')]()][_0x8fb7('0x28')]()});}});}return _0x549f39;}exports[_0x8fb7('0x3d')]=function(_0x4ec3db,_0x5c5383,_0x214d53,_0x2e0576,_0x4a82de,_0x279437){var _0x317fc0,_0x346b11;_0x279437['remoteUri']=intUtil[_0x8fb7('0x3e')](_0x279437[_0x8fb7('0x17')]);_0x279437[_0x8fb7('0x3f')]=intUtil['stripTrailingSlash'](_0x279437['serverUrl']);if(_0x4a82de&&_0x4a82de[_0x8fb7('0x40')]){logger[_0x8fb7('0x19')](_0x8fb7('0x41'),'Recording\x20is\x20enabled!');_0x5c5383[_0x8fb7('0x42')]=util[_0x8fb7('0x15')](_0x8fb7('0x43'),_0x279437[_0x8fb7('0x3f')],_0x5c5383[_0x8fb7('0x44')],md5(_0x5c5383[_0x8fb7('0x44')]));}else{_0x5c5383[_0x8fb7('0x42')]='';}headers['Authorization']=getAuth(_0x279437);return getUser(_0x279437,_0x2e0576[_0x8fb7('0x1f')])['then'](function(_0x5c89f3){_0x317fc0=_0x5c89f3;logger[_0x8fb7('0x19')](_0x8fb7('0x45'),_0x317fc0['id']);return getEndUser(_0x279437,_0x5c5383[_0x8fb7('0xc')],_0x5c5383[_0x8fb7('0x46')]);})[_0x8fb7('0x1b')](function(_0x185d65){_0x346b11=_0x185d65;logger['info']('The\x20Enduser\x20ID\x20is:',_0x346b11['id']);return getTicket(_0x279437,_0x317fc0,_0x346b11,_0x214d53,_0x5c5383);})[_0x8fb7('0x1b')](function(_0x4b3288){if(_0x4b3288&&_0x4b3288['id']){logger['info']('Ticket\x20created!');logger[_0x8fb7('0x19')](_0x8fb7('0x47'),_0x4b3288['id']);logger[_0x8fb7('0x19')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x8fb7('0x15')](_0x8fb7('0x48'),_0x2e0576[_0x8fb7('0xf')]),'trigger:browser:url',{'uri':util[_0x8fb7('0x15')](_0x8fb7('0x49'),_0x279437[_0x8fb7('0x17')],_0x4b3288['id'])});}})['catch'](function(_0x515b7d){logger[_0x8fb7('0x4a')](_0x8fb7('0x41'),JSON['stringify'](_0x515b7d));});};exports[_0x8fb7('0x4b')]=function(_0x3edb2b,_0x59b547,_0x30e6b5,_0x149f07,_0x4533d8,_0x20d3a3,_0x53f7f6){var _0x3c2e3a,_0x177ecb;_0x20d3a3[_0x8fb7('0x17')]=intUtil[_0x8fb7('0x3e')](_0x20d3a3[_0x8fb7('0x17')]);_0x20d3a3[_0x8fb7('0x3f')]=intUtil[_0x8fb7('0x3e')](_0x20d3a3[_0x8fb7('0x3f')]);if(_0x53f7f6&&_0x53f7f6['recordingFormat']&&_0x53f7f6['recordingFormat']!==_0x8fb7('0x4c')){logger[_0x8fb7('0x19')](_0x8fb7('0x4d'),_0x8fb7('0x4e'));_0x59b547[_0x8fb7('0x42')]=util[_0x8fb7('0x15')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x20d3a3[_0x8fb7('0x3f')],_0x59b547[_0x8fb7('0x44')],md5(_0x59b547[_0x8fb7('0x44')]));}headers[_0x8fb7('0x4f')]=getAuth(_0x20d3a3);return getUser(_0x20d3a3,_0x149f07[_0x8fb7('0x1f')])[_0x8fb7('0x1b')](function(_0x9ee642){_0x3c2e3a=_0x9ee642;logger[_0x8fb7('0x19')](_0x8fb7('0x45'),_0x3c2e3a['id']);return getEndUser(_0x20d3a3,_0x59b547['destcalleridname'],_0x59b547['destcalleridnum']);})[_0x8fb7('0x1b')](function(_0x10cd54){_0x177ecb=_0x10cd54;logger['info'](_0x8fb7('0x50'),_0x177ecb['id']);return getTicket(_0x20d3a3,_0x3c2e3a,_0x177ecb,_0x30e6b5,_0x59b547);})[_0x8fb7('0x1b')](function(_0x5970c0){if(_0x5970c0&&_0x5970c0['id']){logger[_0x8fb7('0x19')](_0x8fb7('0x51'));logger[_0x8fb7('0x19')]('The\x20Ticket\x20ID\x20is:',_0x5970c0['id']);logger[_0x8fb7('0x19')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x8fb7('0x15')](_0x8fb7('0x48'),_0x149f07[_0x8fb7('0xf')]),_0x8fb7('0x52'),{'uri':util[_0x8fb7('0x15')](_0x8fb7('0x49'),_0x20d3a3['remoteUri'],_0x5970c0['id'])});}})['catch'](function(_0x35761e){logger[_0x8fb7('0x4a')]('[OUTBOUND]',JSON[_0x8fb7('0x2b')](_0x35761e));});};exports[_0x8fb7('0x53')]=function(_0x407249,_0x4965f1,_0x123c1c,_0x2f5035,_0x427e79,_0x4e90a4){var _0x23d1ec,_0x5df13e;_0x4e90a4[_0x8fb7('0x17')]=intUtil[_0x8fb7('0x3e')](_0x4e90a4['remoteUri']);_0x4e90a4[_0x8fb7('0x3f')]=intUtil['stripTrailingSlash'](_0x4e90a4[_0x8fb7('0x3f')]);if(_0x427e79&&_0x427e79[_0x8fb7('0x40')]){logger[_0x8fb7('0x19')]('['+_0x4965f1[_0x8fb7('0x54')][_0x8fb7('0x55')]()+']','Recording\x20is\x20enabled!');_0x4965f1[_0x8fb7('0x42')]=util[_0x8fb7('0x15')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4e90a4[_0x8fb7('0x3f')],_0x4965f1[_0x8fb7('0x44')],md5(_0x4965f1[_0x8fb7('0x44')]));}else{_0x4965f1[_0x8fb7('0x42')]='';}headers[_0x8fb7('0x4f')]=getAuth(_0x4e90a4);return getUser(_0x4e90a4,'')['then'](function(_0x51ad3d){_0x23d1ec=_0x51ad3d;logger[_0x8fb7('0x19')](_0x8fb7('0x45'),_0x23d1ec['id']);return getEndUser(_0x4e90a4,_0x4965f1[_0x8fb7('0xc')],_0x4965f1['calleridnum']);})[_0x8fb7('0x1b')](function(_0x27dfea){_0x5df13e=_0x27dfea;logger[_0x8fb7('0x19')](_0x8fb7('0x50'),_0x5df13e['id']);return getTicket(_0x4e90a4,_0x23d1ec,_0x5df13e,_0x123c1c,_0x4965f1);})[_0x8fb7('0x1b')](function(_0x257f13){if(_0x257f13){logger[_0x8fb7('0x19')](_0x8fb7('0x51'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x257f13['id']);}})['catch'](function(_0x2005e1){logger[_0x8fb7('0x4a')]('['+_0x4965f1['lastevent'][_0x8fb7('0x55')]()+']',JSON['stringify'](_0x2005e1));});}; \ No newline at end of file +var _0x9aae=['socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Tags','name','custom_fields','mapValues','keyBy','value','remoteUri','then','validateEmail','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','apiKey','toString','base64','debug','[HTTP]','stringify','GET','map','includes','string','picklist','nameField','customField','toLowerCase','content','idField','type','variable','variableName','push','customVariable','Variable','queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','serverUrl','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','freshdesk','redis','defaults','localhost'];(function(_0x588faa,_0x387b78){var _0x2809aa=function(_0x26264a){while(--_0x26264a){_0x588faa['push'](_0x588faa['shift']());}};_0x2809aa(++_0x387b78);}(_0x9aae,0x1d0));var _0xe9aa=function(_0x1fce40,_0x14da33){_0x1fce40=_0x1fce40-0x0;var _0x24a31c=_0x9aae[_0x1fce40];return _0x24a31c;};'use strict';var _=require(_0xe9aa('0x0'));var rp=require(_0xe9aa('0x1'));var md5=require(_0xe9aa('0x2'));var util=require(_0xe9aa('0x3'));var Redis=require(_0xe9aa('0x4'));var intUtil=require(_0xe9aa('0x5'));var config=require(_0xe9aa('0x6'));var logger=require('../../../../config/logger')(_0xe9aa('0x7'));config[_0xe9aa('0x8')]=_[_0xe9aa('0x9')](config[_0xe9aa('0x8')],{'host':_0xe9aa('0xa'),'port':0x18eb});var io=require(_0xe9aa('0xb'))(new Redis(config[_0xe9aa('0x8')]));var headers={'Content-Type':_0xe9aa('0xc'),'Accept':_0xe9aa('0xc')};function emit(_0x1e3662,_0x10389c,_0x267090){io['to'](_0x1e3662)[_0xe9aa('0xd')](_0x10389c,_0x267090);}function getTicket(_0x456f6c,_0x3e1246,_0x5441e9,_0x379ce2,_0x24f496){logger[_0xe9aa('0xe')](_0xe9aa('0xf'));var _0x48cf1d=_[_0xe9aa('0x10')]({'responder_id':_0x3e1246['id'],'requester_id':_0x5441e9['id'],'name':util[_0xe9aa('0x11')](_0xe9aa('0x12'),_0x24f496[_0xe9aa('0x13')]),'phone':_0x24f496[_0xe9aa('0x14')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xe9aa('0x15')](_0x379ce2[_0xe9aa('0x16')],_0x24f496,'\x20'),'description':intUtil[_0xe9aa('0x15')](_0x379ce2['Descriptions'],_0x24f496,'
'),'tags':getTags(_0x379ce2[_0xe9aa('0x17')],_0xe9aa('0x18'))},getCustomFields(_0x379ce2['Fields'],_0x24f496));_0x48cf1d[_0xe9aa('0x19')]=_[_0xe9aa('0x1a')](_[_0xe9aa('0x1b')](_0x48cf1d['custom_fields'],'id'),_0xe9aa('0x1c'));return request({'uri':util[_0xe9aa('0x11')]('%s/api/v2/tickets',_0x456f6c[_0xe9aa('0x1d')]),'method':'POST','body':_0x48cf1d})[_0xe9aa('0x1e')](function(_0xe5fe13){logger[_0xe9aa('0xe')]('Ticket\x20created!');return _0xe5fe13;});}function getUser(_0x53520e,_0x33a481){if(intUtil[_0xe9aa('0x1f')](_0x33a481)){return request({'uri':util[_0xe9aa('0x11')]('%s/api/v2/agents',_0x53520e['remoteUri']),'qs':{'email':_0x33a481}})[_0xe9aa('0x1e')](function(_0x3d265c){if(_0x3d265c[_0xe9aa('0x20')]){logger[_0xe9aa('0xe')](_0xe9aa('0x21'));return _[_0xe9aa('0x22')](_0x3d265c,function(_0x225392){return _0x225392[_0xe9aa('0x23')][_0xe9aa('0x24')]===_0x33a481;});}else{logger[_0xe9aa('0xe')](_0xe9aa('0x25'));return request({'uri':util[_0xe9aa('0x11')](_0xe9aa('0x26'),_0x53520e['remoteUri'])})[_0xe9aa('0x1e')](function(_0x553821){logger[_0xe9aa('0xe')](_0xe9aa('0x27'));return _0x553821;});}});}else{logger['info'](_0xe9aa('0x28'));return request({'uri':util[_0xe9aa('0x11')](_0xe9aa('0x26'),_0x53520e[_0xe9aa('0x1d')])})['then'](function(_0x5116fb){logger[_0xe9aa('0xe')](_0xe9aa('0x27'));return _0x5116fb;});}}function getEndUser(_0x227689,_0xf72678,_0xa4c0ac){logger[_0xe9aa('0xe')]('Searching\x20enduser\x20with\x20phone',_0xa4c0ac);return request({'uri':util[_0xe9aa('0x11')](_0xe9aa('0x29'),_0x227689['remoteUri']),'qs':{'phone':_0xa4c0ac}})[_0xe9aa('0x1e')](function(_0x5a2f11){if(_0x5a2f11['length']){logger[_0xe9aa('0xe')](_0xe9aa('0x2a'));return _[_0xe9aa('0x22')](_0x5a2f11,{'phone':_0xa4c0ac});}else{logger[_0xe9aa('0xe')](_0xe9aa('0x2b'));return request({'uri':util[_0xe9aa('0x11')]('%s/api/v2/contacts',_0x227689[_0xe9aa('0x1d')]),'method':_0xe9aa('0x2c'),'body':{'name':_0xf72678,'phone':_0xa4c0ac}})[_0xe9aa('0x1e')](function(_0x55f81a){logger['info'](_0xe9aa('0x2d'));return _0x55f81a;});}});}function getAuth(_0x46e4e7){return util[_0xe9aa('0x11')]('Basic\x20%s',new Buffer(_0x46e4e7[_0xe9aa('0x2e')]+':X')[_0xe9aa('0x2f')](_0xe9aa('0x30')));}function request(_0x3cabb0){logger[_0xe9aa('0x31')](_0xe9aa('0x32'),JSON[_0xe9aa('0x33')](_0x3cabb0));return rp(_[_0xe9aa('0x9')](_0x3cabb0,{'method':_0xe9aa('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x4813e3,_0x1be4b9){var _0x375977=[];if(_0x4813e3&&_0x4813e3[_0xe9aa('0x20')]>0x0){_0x375977=_[_0xe9aa('0x35')](_0x4813e3,_0x1be4b9);}return _0x375977;}function getCustomFields(_0x5aae33,_0x136f13){var _0x2bf4b7=[];var _0x137700={'custom_fields':[]};if(_0x5aae33['length']>0x0){_['forEach'](_0x5aae33,function(_0x4be669){if(_[_0xe9aa('0x36')]([_0xe9aa('0x37'),_0xe9aa('0x38')],_0x4be669['type'])&&_0x4be669[_0xe9aa('0x39')]&&!_0x4be669[_0xe9aa('0x3a')]){_0x137700[_0x4be669[_0xe9aa('0x39')][_0xe9aa('0x3b')]()]=_0x4be669[_0xe9aa('0x3c')]['toString']();}else if(_[_0xe9aa('0x36')]([_0xe9aa('0x37'),_0xe9aa('0x38')],_0x4be669['type'])&&_0x4be669[_0xe9aa('0x3d')]&&_0x4be669['customField']){_0x137700[_0xe9aa('0x19')]['push']({'id':_0x4be669[_0xe9aa('0x3d')],'value':_0x4be669['content'][_0xe9aa('0x2f')]()});}else if(_0x4be669[_0xe9aa('0x3e')]===_0xe9aa('0x3f')&&_0x4be669['variableName']&&_0x4be669[_0xe9aa('0x3d')]&&_0x4be669[_0xe9aa('0x3a')]){_0x136f13[_0x4be669[_0xe9aa('0x40')]]&&_0x137700[_0xe9aa('0x19')][_0xe9aa('0x41')]({'id':_0x4be669[_0xe9aa('0x3d')],'value':_0x136f13[_0x4be669[_0xe9aa('0x40')]][_0xe9aa('0x2f')]()});}else if(_0x4be669[_0xe9aa('0x3e')]===_0xe9aa('0x42')&&_0x4be669[_0xe9aa('0x43')]&&_0x4be669[_0xe9aa('0x43')][_0xe9aa('0x18')]&&_0x4be669['idField']&&_0x4be669['customField']){_0x136f13[_0x4be669[_0xe9aa('0x43')][_0xe9aa('0x18')][_0xe9aa('0x3b')]()]&&_0x137700[_0xe9aa('0x19')]['push']({'id':_0x4be669[_0xe9aa('0x3d')],'value':_0x136f13[_0x4be669['Variable'][_0xe9aa('0x18')]['toLowerCase']()][_0xe9aa('0x2f')]()});}});}return _0x137700;}exports[_0xe9aa('0x44')]=function(_0xedfd09,_0x469411,_0x34d9cf,_0x361286,_0xa44d5a,_0x522089){var _0x3acc9d,_0x34ff86;_0x522089['remoteUri']=intUtil[_0xe9aa('0x45')](_0x522089[_0xe9aa('0x1d')]);_0x522089['serverUrl']=intUtil['stripTrailingSlash'](_0x522089['serverUrl']);if(_0xa44d5a&&_0xa44d5a[_0xe9aa('0x46')]){logger['info'](_0xe9aa('0x47'),_0xe9aa('0x48'));_0x469411[_0xe9aa('0x49')]=util[_0xe9aa('0x11')](_0xe9aa('0x4a'),_0x522089['serverUrl'],_0x469411[_0xe9aa('0x4b')],md5(_0x469411[_0xe9aa('0x4b')]));}else{_0x469411[_0xe9aa('0x49')]='';}headers[_0xe9aa('0x4c')]=getAuth(_0x522089);return getUser(_0x522089,_0x361286[_0xe9aa('0x24')])[_0xe9aa('0x1e')](function(_0x1ec301){_0x3acc9d=_0x1ec301;logger[_0xe9aa('0xe')](_0xe9aa('0x4d'),_0x3acc9d['id']);return getEndUser(_0x522089,_0x469411['calleridname'],_0x469411[_0xe9aa('0x14')]);})['then'](function(_0x154468){_0x34ff86=_0x154468;logger['info']('The\x20Enduser\x20ID\x20is:',_0x34ff86['id']);return getTicket(_0x522089,_0x3acc9d,_0x34ff86,_0x34d9cf,_0x469411);})[_0xe9aa('0x1e')](function(_0x542f61){if(_0x542f61&&_0x542f61['id']){logger[_0xe9aa('0xe')](_0xe9aa('0x4e'));logger[_0xe9aa('0xe')](_0xe9aa('0x4f'),_0x542f61['id']);logger[_0xe9aa('0xe')](_0xe9aa('0x47'),_0xe9aa('0x50'));emit(util[_0xe9aa('0x11')](_0xe9aa('0x51'),_0x361286['name']),_0xe9aa('0x52'),{'uri':util[_0xe9aa('0x11')](_0xe9aa('0x53'),_0x522089[_0xe9aa('0x1d')],_0x542f61['id'])});}})[_0xe9aa('0x54')](function(_0x1ef583){logger[_0xe9aa('0x55')](_0xe9aa('0x47'),JSON[_0xe9aa('0x33')](_0x1ef583));});};exports['outbound']=function(_0x44efeb,_0x296b8a,_0x5397a4,_0x1a68ed,_0x24c35d,_0x3b7460,_0xad1189){var _0x27f7e2,_0x1db1e2;_0x3b7460[_0xe9aa('0x1d')]=intUtil[_0xe9aa('0x45')](_0x3b7460[_0xe9aa('0x1d')]);_0x3b7460[_0xe9aa('0x56')]=intUtil[_0xe9aa('0x45')](_0x3b7460['serverUrl']);if(_0xad1189&&_0xad1189[_0xe9aa('0x57')]&&_0xad1189[_0xe9aa('0x57')]!=='none'){logger[_0xe9aa('0xe')](_0xe9aa('0x58'),_0xe9aa('0x48'));_0x296b8a[_0xe9aa('0x49')]=util[_0xe9aa('0x11')](_0xe9aa('0x4a'),_0x3b7460[_0xe9aa('0x56')],_0x296b8a[_0xe9aa('0x4b')],md5(_0x296b8a[_0xe9aa('0x4b')]));}headers[_0xe9aa('0x4c')]=getAuth(_0x3b7460);return getUser(_0x3b7460,_0x1a68ed['email'])[_0xe9aa('0x1e')](function(_0x60c944){_0x27f7e2=_0x60c944;logger[_0xe9aa('0xe')]('The\x20User\x20ID\x20is:',_0x27f7e2['id']);return getEndUser(_0x3b7460,_0x296b8a[_0xe9aa('0x59')],_0x296b8a[_0xe9aa('0x5a')]);})[_0xe9aa('0x1e')](function(_0x379c53){_0x1db1e2=_0x379c53;logger['info'](_0xe9aa('0x5b'),_0x1db1e2['id']);return getTicket(_0x3b7460,_0x27f7e2,_0x1db1e2,_0x5397a4,_0x296b8a);})['then'](function(_0x5864bb){if(_0x5864bb&&_0x5864bb['id']){logger[_0xe9aa('0xe')](_0xe9aa('0x4e'));logger[_0xe9aa('0xe')]('The\x20Ticket\x20ID\x20is:',_0x5864bb['id']);logger[_0xe9aa('0xe')](_0xe9aa('0x58'),_0xe9aa('0x50'));emit(util[_0xe9aa('0x11')](_0xe9aa('0x51'),_0x1a68ed[_0xe9aa('0x18')]),_0xe9aa('0x52'),{'uri':util[_0xe9aa('0x11')](_0xe9aa('0x53'),_0x3b7460[_0xe9aa('0x1d')],_0x5864bb['id'])});}})[_0xe9aa('0x54')](function(_0x53d89f){logger[_0xe9aa('0x55')](_0xe9aa('0x58'),JSON[_0xe9aa('0x33')](_0x53d89f));});};exports[_0xe9aa('0x5c')]=function(_0x19b465,_0x3f7fa8,_0x104571,_0x144001,_0x450a96,_0x23afc4){var _0x4cc620,_0x392a85;_0x23afc4[_0xe9aa('0x1d')]=intUtil['stripTrailingSlash'](_0x23afc4[_0xe9aa('0x1d')]);_0x23afc4[_0xe9aa('0x56')]=intUtil[_0xe9aa('0x45')](_0x23afc4[_0xe9aa('0x56')]);if(_0x450a96&&_0x450a96[_0xe9aa('0x46')]){logger['info']('['+_0x3f7fa8[_0xe9aa('0x5d')][_0xe9aa('0x5e')]()+']',_0xe9aa('0x48'));_0x3f7fa8['recordingURL']=util['format'](_0xe9aa('0x4a'),_0x23afc4['serverUrl'],_0x3f7fa8['uniqueid'],md5(_0x3f7fa8['uniqueid']));}else{_0x3f7fa8[_0xe9aa('0x49')]='';}headers[_0xe9aa('0x4c')]=getAuth(_0x23afc4);return getUser(_0x23afc4,'')[_0xe9aa('0x1e')](function(_0x16f629){_0x4cc620=_0x16f629;logger['info'](_0xe9aa('0x4d'),_0x4cc620['id']);return getEndUser(_0x23afc4,_0x3f7fa8[_0xe9aa('0x13')],_0x3f7fa8['calleridnum']);})[_0xe9aa('0x1e')](function(_0x4009cd){_0x392a85=_0x4009cd;logger['info'](_0xe9aa('0x5b'),_0x392a85['id']);return getTicket(_0x23afc4,_0x4cc620,_0x392a85,_0x104571,_0x3f7fa8);})[_0xe9aa('0x1e')](function(_0x229092){if(_0x229092){logger[_0xe9aa('0xe')](_0xe9aa('0x4e'));logger[_0xe9aa('0xe')](_0xe9aa('0x4f'),_0x229092['id']);}})[_0xe9aa('0x54')](function(_0x34d897){logger['error']('['+_0x3f7fa8['lastevent'][_0xe9aa('0x5e')]()+']',JSON[_0xe9aa('0x33')](_0x34d897));});}; \ 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 22ede5c..dc3a987 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 _0x4b86=['Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','add','ticketId','Task\x20created:','/contacts/','trigger:browser:url','remoteUri','stripTrailingSlash','serverUrl','adminEmail','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','unmanaged','agentEmail','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','recordingURL','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','md5','util','moment','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','then','users','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','length','email','userId','User\x20found:','userEmail','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','mobile_number','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','/api/contacts','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','Creating\x20new\x20task','/api/tasks','Subjects'];(function(_0x5e8880,_0x1f2424){var _0x585d41=function(_0x183309){while(--_0x183309){_0x5e8880['push'](_0x5e8880['shift']());}};_0x585d41(++_0x1f2424);}(_0x4b86,0xbb));var _0x64b8=function(_0x4c19a1,_0x15197f){_0x4c19a1=_0x4c19a1-0x0;var _0x58ac50=_0x4b86[_0x4c19a1];return _0x58ac50;};'use strict';var _=require(_0x64b8('0x0'));var rp=require('request-promise');var md5=require(_0x64b8('0x1'));var util=require(_0x64b8('0x2'));var moment=require(_0x64b8('0x3'));var Promise=require('bluebird');var Redis=require('ioredis');var intUtil=require(_0x64b8('0x4'));var config=require(_0x64b8('0x5'));var logger=require(_0x64b8('0x6'))(_0x64b8('0x7'));config[_0x64b8('0x8')]=_['defaults'](config[_0x64b8('0x8')],{'host':_0x64b8('0x9'),'port':0x18eb});var io=require(_0x64b8('0xa'))(new Redis(config['redis']));function getAdminId(_0x267729,_0x410d1c,_0x30e223,_0x49d951){return new Promise(function(_0x1e4a3a,_0xeb10d7){var _0x4d68c8=![];var _0x3e0897={'method':_0x64b8('0xb'),'uri':_0x49d951+_0x64b8('0xc'),'json':!![]};_0x3e0897[_0x64b8('0xd')]=_0x30e223;logger[_0x64b8('0xe')]('Getting\x20admin\x20information');return rp(_0x3e0897)[_0x64b8('0xf')](function(_0x206218){if(_0x206218){var _0x3bc899=_0x206218[_0x64b8('0x10')];var _0x425cde=null;for(_0x425cde=0x0;_0x425cde<_0x3bc899['length'];_0x425cde++){if(_0x3bc899[_0x425cde]['email']===_0x267729['adminEmail']){_0x267729['adminId']=_0x3bc899[_0x425cde]['id'];_0x4d68c8=!![];}}if(_0x4d68c8){logger[_0x64b8('0xe')](_0x64b8('0x11'),_0x267729[_0x64b8('0x12')]);_0x1e4a3a(_0x267729);}else{_0xeb10d7({'statusCode':0x194,'message':_0x64b8('0x13')});}}else{_0xeb10d7({'statusCode':0x194,'message':_0x64b8('0x13')});}})[_0x64b8('0x14')](function(_0x5c462b){logger[_0x64b8('0x15')]('['+[_0x410d1c[_0x64b8('0x16')]()]+']',_0x5c462b[_0x64b8('0x17')]);_0xeb10d7(_0x5c462b);});});}function getUser(_0x5d56f3,_0x4b3179,_0x1dabce){return function(_0x45fa2d){return new Promise(function(_0x33095e,_0x91322a){var _0x5f58a6={'method':_0x64b8('0xb'),'uri':_0x1dabce+_0x64b8('0xc'),'json':!![]};_0x5f58a6['headers']=_0x4b3179;logger[_0x64b8('0xe')]('Getting\x20user\x20list');return rp(_0x5f58a6)[_0x64b8('0xf')](function(_0x43caf5){if(_0x43caf5){var _0x5e35e4=_0x43caf5[_0x64b8('0x10')];var _0x115973=![];var _0x128b4f=null;if(_0x45fa2d['agentEmail']!==null){logger['info']('Getting\x20user\x20with\x20email',_0x45fa2d['agentEmail']);_0x45fa2d['userEmail']=_0x45fa2d['agentEmail'];for(_0x128b4f=0x0;_0x128b4f<_0x5e35e4[_0x64b8('0x18')];_0x128b4f++){if(_0x5e35e4[_0x128b4f][_0x64b8('0x19')]===_0x45fa2d['agentEmail']){_0x115973=!![];_0x45fa2d[_0x64b8('0x1a')]=_0x5e35e4[_0x128b4f]['id'];logger['info'](_0x64b8('0x1b'),_0x45fa2d[_0x64b8('0x1a')]);}}}if(!_0x115973){logger[_0x64b8('0xe')]('Admin\x20selected');_0x45fa2d[_0x64b8('0x1c')]=_0x45fa2d['adminEmail'];_0x45fa2d[_0x64b8('0x1a')]=_0x45fa2d[_0x64b8('0x12')];_0x115973=!![];}if(_0x115973){_0x33095e(_0x45fa2d);}else{_0x91322a({'statusCode':0x194,'message':_0x64b8('0x13')});}}else{_0x91322a({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0x36209d){logger['error']('['+[_0x5d56f3['toUpperCase']()]+']',_0x36209d['message']);_0x91322a(_0x36209d);});});};}function searchContact(_0x36902b,_0x34079a,_0x3315cf,_0x51194d){return new Promise(function(_0x52c99c,_0x56ca80){var _0x2d4cf6={'method':_0x64b8('0xb'),'headers':_0x34079a,'uri':_0x36902b+_0x64b8('0x1d')+_0x51194d+_0x64b8('0x1e')+_0x3315cf+_0x64b8('0x1f'),'json':!![]};rp(_0x2d4cf6)[_0x64b8('0xf')](function(_0x1eeb1a){var _0x236423=_[_0x64b8('0x20')](_0x1eeb1a[_0x64b8('0x21')][_0x64b8('0x21')],[_0x3315cf,_0x51194d]);_0x52c99c(_0x236423);})['catch'](function(_0x57912f){_0x56ca80(_0x57912f);});});}function getEndUser(_0x47651e,_0x2ffb77,_0x205f62){return function(_0x168aaf){return new Promise(function(_0xd6b3fb,_0x5e056e){logger[_0x64b8('0xe')](util[_0x64b8('0x22')]('Searching\x20contact\x20with\x20phone\x20%s',_0x168aaf['contactNumber']));searchContact(_0x205f62,_0x2ffb77,_0x64b8('0x23'),_0x168aaf[_0x64b8('0x24')])['then'](function(_0x2edc1c){if(_0x2edc1c){_0x168aaf[_0x64b8('0x25')]=_0x2edc1c['id'];logger[_0x64b8('0xe')](_0x64b8('0x26'),_0x168aaf[_0x64b8('0x25')]);return _0xd6b3fb(_0x168aaf);}searchContact(_0x205f62,_0x2ffb77,_0x64b8('0x27'),_0x168aaf[_0x64b8('0x24')])[_0x64b8('0xf')](function(_0x9852fd){if(_0x9852fd){_0x168aaf[_0x64b8('0x25')]=_0x9852fd['id'];logger[_0x64b8('0xe')](_0x64b8('0x28'),_0x168aaf[_0x64b8('0x25')]);return _0xd6b3fb(_0x168aaf);}createEndUser(_0x168aaf,_0x47651e,_0x2ffb77,_0x205f62)[_0x64b8('0xf')](function(_0x4f9c46){logger[_0x64b8('0xe')](_0x64b8('0x29'),_0x4f9c46[_0x64b8('0x25')]);return _0xd6b3fb(_0x4f9c46);});});})['catch'](function(_0x457e44){_0x5e056e(_0x457e44);});});};}function createEndUser(_0x4e0fb0,_0x6c44ac,_0x7cdd4d,_0x2b0cd8){return new Promise(function(_0x3f415c,_0x4759b0){var _0x1e021b=moment();var _0x3b3d97={'method':'POST','uri':_0x2b0cd8+_0x64b8('0x2a'),'body':{'contact':{'last_name':_0x4e0fb0['contactNumber'],'work_number':_0x4e0fb0['contactNumber'],'mobile_number':_0x4e0fb0[_0x64b8('0x24')],'owner_id':_0x4e0fb0['userId'],'created_at':_0x1e021b[_0x64b8('0x22')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x3b3d97[_0x64b8('0xd')]=_0x7cdd4d;logger['info'](_0x64b8('0x2b'));return rp(_0x3b3d97)[_0x64b8('0xf')](function(_0x539a28){_0x4e0fb0['endUserId']=_0x539a28['contact']['id'];_0x3f415c(_0x4e0fb0);})[_0x64b8('0x14')](function(_0x2479eb){logger[_0x64b8('0x15')]('['+[_0x6c44ac[_0x64b8('0x16')]()]+']',_0x2479eb[_0x64b8('0x17')]);_0x4759b0(_0x2479eb[_0x64b8('0x17')]);});});}function getTicket(_0x1801e8,_0x682590,_0x525064,_0x3acbd8,_0x2aac60){return function(_0x52db40){logger[_0x64b8('0xe')](_0x64b8('0x2c'));return new Promise(function(_0x20e484,_0x509f6d){var _0x4f182d=moment();var _0x275f07={'method':'POST','uri':_0x525064+_0x64b8('0x2d'),'body':{'title':intUtil['getString'](_0x3acbd8[_0x64b8('0x2e')],_0x2aac60,'\x20'),'description':intUtil['getString'](_0x3acbd8[_0x64b8('0x2f')],_0x2aac60,'\x0a'),'owner_id':_0x52db40[_0x64b8('0x1a')],'creater_id':_0x52db40[_0x64b8('0x12')],'targetable_id':_0x52db40[_0x64b8('0x25')],'targetable_type':_0x64b8('0x30'),'created_at':_0x4f182d[_0x64b8('0x22')](_0x64b8('0x31')),'due_date':_0x4f182d[_0x64b8('0x32')](0x1e,'m')[_0x64b8('0x22')](_0x64b8('0x31'))},'json':!![]};_0x275f07[_0x64b8('0xd')]=_0x682590;return rp(_0x275f07)[_0x64b8('0xf')](function(_0x4dc4cc){_0x52db40[_0x64b8('0x33')]=_0x4dc4cc['task']['id'];logger['info'](_0x64b8('0x34'),_0x52db40[_0x64b8('0x33')]);_0x20e484(_0x52db40);})['catch'](function(_0xb42799){logger[_0x64b8('0x15')]('['+[_0x1801e8[_0x64b8('0x16')]()]+']',_0xb42799[_0x64b8('0x17')]);_0x509f6d(_0xb42799[_0x64b8('0x17')]);});});};}function emit(_0x17c1b9,_0x282df0,_0x13774d){var _0xe8dae7={'uri':_0x17c1b9+_0x64b8('0x35')+_0x13774d};io['to'](util[_0x64b8('0x22')]('user:%s',_0x282df0))['emit'](_0x64b8('0x36'),_0xe8dae7);}exports['cs']=function(_0xe9f6,_0x5484f2,_0x1ae06a,_0x541e8e,_0x473668,_0x3fdf1b,_0x115253,_0x5ab397){var _0x49ab3c={};var _0x4c9b58={'Authorization':'Token\x20token='+_0x3fdf1b['apiKey']};_0x3fdf1b[_0x64b8('0x37')]=intUtil[_0x64b8('0x38')](_0x3fdf1b['remoteUri']);_0x3fdf1b['serverUrl']=intUtil[_0x64b8('0x38')](_0x3fdf1b[_0x64b8('0x39')]);var _0x433ca4=_0x3fdf1b[_0x64b8('0x37')];_0x49ab3c[_0x64b8('0x3a')]=_0x3fdf1b[_0x64b8('0x3b')];_0x49ab3c[_0x64b8('0x24')]=_0x5ab397[_0x64b8('0x3c')]()===_0x64b8('0x3d')?_0x5484f2[_0x64b8('0x3e')]:_0x5484f2[_0x64b8('0x3f')];_0x49ab3c[_0x64b8('0x40')]=_0x5ab397==='queue'||_0x5ab397===_0x64b8('0x41')?'queue':_0x64b8('0x3d');if(_0x541e8e){_0x49ab3c[_0x64b8('0x42')]=_0x541e8e[_0x64b8('0x19')];}var _0x53cef5=util[_0x64b8('0x22')](_0x64b8('0x43'),_0x3fdf1b['serverUrl'],_0x5484f2[_0x64b8('0x44')],md5(_0x5484f2[_0x64b8('0x44')]));if(_0x473668&&_0x473668[_0x64b8('0x45')]){logger[_0x64b8('0xe')](_0x64b8('0x46'),_0x64b8('0x47'));_0x5484f2['recordingURL']=_0x53cef5;}else if(_0x115253&&_0x115253[_0x64b8('0x48')]&&_0x115253[_0x64b8('0x48')]!=='none'){logger['info']('[OUTBOUND]',_0x64b8('0x47'));_0x5484f2[_0x64b8('0x49')]=_0x53cef5;}else{_0x5484f2[_0x64b8('0x49')]='';}return getAdminId(_0x49ab3c,_0x5ab397,_0x4c9b58,_0x433ca4)[_0x64b8('0xf')](getUser(_0x5ab397,_0x4c9b58,_0x433ca4))[_0x64b8('0xf')](getEndUser(_0x5ab397,_0x4c9b58,_0x433ca4))['then'](getTicket(_0x5ab397,_0x4c9b58,_0x433ca4,_0x1ae06a,_0x5484f2))[_0x64b8('0xf')](function(_0x18695){logger[_0x64b8('0xe')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x18695[_0x64b8('0x33')]));if(_0x5ab397!==_0x64b8('0x41')){logger[_0x64b8('0xe')]('['+[_0x5ab397[_0x64b8('0x16')]()]+']',_0x64b8('0x4a'));emit(_0x433ca4,_0x541e8e[_0x64b8('0x4b')],_0x18695['endUserId']);}})[_0x64b8('0x14')](function(_0x5bd77e){logger[_0x64b8('0x15')]('['+[_0x5ab397['toUpperCase']()]+_0x64b8('0x4c'),util[_0x64b8('0x4d')](_0x5bd77e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xbf9b=['contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','endUserId','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','Creating\x20new\x20task','/api/tasks','getString','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','add','ticketId','task','Task\x20created:','user:%s','emit','trigger:browser:url','apiKey','remoteUri','serverUrl','stripTrailingSlash','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','moment','bluebird','ioredis','freshsales','redis','localhost','GET','/api/selector/owners','info','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','headers','Getting\x20user\x20list','agentEmail','userId','User\x20found:','userEmail','/api/lookup?q=','&f=','&entities=contact','find'];(function(_0x23aeaa,_0x18e477){var _0x5758bb=function(_0x5651ad){while(--_0x5651ad){_0x23aeaa['push'](_0x23aeaa['shift']());}};_0x5758bb(++_0x18e477);}(_0xbf9b,0xd8));var _0xbbf9=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xbf9b[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xbbf9('0x0'));var rp=require(_0xbbf9('0x1'));var md5=require('md5');var util=require('util');var moment=require(_0xbbf9('0x2'));var Promise=require(_0xbbf9('0x3'));var Redis=require(_0xbbf9('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xbbf9('0x5'));config[_0xbbf9('0x6')]=_['defaults'](config[_0xbbf9('0x6')],{'host':_0xbbf9('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbbf9('0x6')]));function getAdminId(_0x6d6161,_0x37f2f1,_0x213d2d,_0x11d096){return new Promise(function(_0x120799,_0x162805){var _0x5430e3=![];var _0x32528e={'method':_0xbbf9('0x8'),'uri':_0x11d096+_0xbbf9('0x9'),'json':!![]};_0x32528e['headers']=_0x213d2d;logger[_0xbbf9('0xa')]('Getting\x20admin\x20information');return rp(_0x32528e)[_0xbbf9('0xb')](function(_0x1cfadf){if(_0x1cfadf){var _0x37ebbd=_0x1cfadf[_0xbbf9('0xc')];var _0x4cb265=null;for(_0x4cb265=0x0;_0x4cb265<_0x37ebbd[_0xbbf9('0xd')];_0x4cb265++){if(_0x37ebbd[_0x4cb265][_0xbbf9('0xe')]===_0x6d6161[_0xbbf9('0xf')]){_0x6d6161[_0xbbf9('0x10')]=_0x37ebbd[_0x4cb265]['id'];_0x5430e3=!![];}}if(_0x5430e3){logger[_0xbbf9('0xa')](_0xbbf9('0x11'),_0x6d6161[_0xbbf9('0x10')]);_0x120799(_0x6d6161);}else{_0x162805({'statusCode':0x194,'message':_0xbbf9('0x12')});}}else{_0x162805({'statusCode':0x194,'message':_0xbbf9('0x12')});}})[_0xbbf9('0x13')](function(_0x458b7a){logger[_0xbbf9('0x14')]('['+[_0x37f2f1[_0xbbf9('0x15')]()]+']',_0x458b7a[_0xbbf9('0x16')]);_0x162805(_0x458b7a);});});}function getUser(_0x1fa116,_0x9b862e,_0x13b485){return function(_0x3d03c0){return new Promise(function(_0x2ee8a2,_0x229434){var _0x1b2637={'method':_0xbbf9('0x8'),'uri':_0x13b485+_0xbbf9('0x9'),'json':!![]};_0x1b2637[_0xbbf9('0x17')]=_0x9b862e;logger['info'](_0xbbf9('0x18'));return rp(_0x1b2637)[_0xbbf9('0xb')](function(_0x173c25){if(_0x173c25){var _0x58a158=_0x173c25[_0xbbf9('0xc')];var _0x459ba3=![];var _0x532757=null;if(_0x3d03c0[_0xbbf9('0x19')]!==null){logger['info']('Getting\x20user\x20with\x20email',_0x3d03c0['agentEmail']);_0x3d03c0['userEmail']=_0x3d03c0[_0xbbf9('0x19')];for(_0x532757=0x0;_0x532757<_0x58a158[_0xbbf9('0xd')];_0x532757++){if(_0x58a158[_0x532757]['email']===_0x3d03c0[_0xbbf9('0x19')]){_0x459ba3=!![];_0x3d03c0[_0xbbf9('0x1a')]=_0x58a158[_0x532757]['id'];logger['info'](_0xbbf9('0x1b'),_0x3d03c0[_0xbbf9('0x1a')]);}}}if(!_0x459ba3){logger[_0xbbf9('0xa')]('Admin\x20selected');_0x3d03c0[_0xbbf9('0x1c')]=_0x3d03c0[_0xbbf9('0xf')];_0x3d03c0['userId']=_0x3d03c0[_0xbbf9('0x10')];_0x459ba3=!![];}if(_0x459ba3){_0x2ee8a2(_0x3d03c0);}else{_0x229434({'statusCode':0x194,'message':_0xbbf9('0x12')});}}else{_0x229434({'statusCode':0x194,'message':_0xbbf9('0x12')});}})['catch'](function(_0x41f844){logger[_0xbbf9('0x14')]('['+[_0x1fa116['toUpperCase']()]+']',_0x41f844[_0xbbf9('0x16')]);_0x229434(_0x41f844);});});};}function searchContact(_0x3ce6d5,_0x1046e7,_0x29d501,_0x57c198){return new Promise(function(_0x54cc15,_0xcbb3e6){var _0x4ffde6={'method':_0xbbf9('0x8'),'headers':_0x1046e7,'uri':_0x3ce6d5+_0xbbf9('0x1d')+_0x57c198+_0xbbf9('0x1e')+_0x29d501+_0xbbf9('0x1f'),'json':!![]};rp(_0x4ffde6)['then'](function(_0x54cc69){var _0x2c2ece=_[_0xbbf9('0x20')](_0x54cc69[_0xbbf9('0x21')][_0xbbf9('0x21')],[_0x29d501,_0x57c198]);_0x54cc15(_0x2c2ece);})[_0xbbf9('0x13')](function(_0x2e2bd3){_0xcbb3e6(_0x2e2bd3);});});}function getEndUser(_0x335be8,_0x186045,_0x41825c){return function(_0x2974d6){return new Promise(function(_0x45afb7,_0x71ee2d){logger['info'](util[_0xbbf9('0x22')](_0xbbf9('0x23'),_0x2974d6[_0xbbf9('0x24')]));searchContact(_0x41825c,_0x186045,_0xbbf9('0x25'),_0x2974d6[_0xbbf9('0x24')])['then'](function(_0x2fd05e){if(_0x2fd05e){_0x2974d6['endUserId']=_0x2fd05e['id'];logger[_0xbbf9('0xa')](_0xbbf9('0x26'),_0x2974d6[_0xbbf9('0x27')]);return _0x45afb7(_0x2974d6);}searchContact(_0x41825c,_0x186045,_0xbbf9('0x28'),_0x2974d6[_0xbbf9('0x24')])[_0xbbf9('0xb')](function(_0x1efe65){if(_0x1efe65){_0x2974d6['endUserId']=_0x1efe65['id'];logger[_0xbbf9('0xa')](_0xbbf9('0x29'),_0x2974d6[_0xbbf9('0x27')]);return _0x45afb7(_0x2974d6);}createEndUser(_0x2974d6,_0x335be8,_0x186045,_0x41825c)[_0xbbf9('0xb')](function(_0x138f56){logger[_0xbbf9('0xa')](_0xbbf9('0x2a'),_0x138f56[_0xbbf9('0x27')]);return _0x45afb7(_0x138f56);});});})[_0xbbf9('0x13')](function(_0x27b2d6){_0x71ee2d(_0x27b2d6);});});};}function createEndUser(_0x21a2c1,_0x545490,_0x5b1a66,_0x6a974a){return new Promise(function(_0x476ed7,_0x1258b3){var _0x3bded2=moment();var _0x42495e={'method':_0xbbf9('0x2b'),'uri':_0x6a974a+_0xbbf9('0x2c'),'body':{'contact':{'last_name':_0x21a2c1[_0xbbf9('0x24')],'work_number':_0x21a2c1['contactNumber'],'mobile_number':_0x21a2c1['contactNumber'],'owner_id':_0x21a2c1[_0xbbf9('0x1a')],'created_at':_0x3bded2['format']('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x42495e[_0xbbf9('0x17')]=_0x5b1a66;logger[_0xbbf9('0xa')](_0xbbf9('0x2d'));return rp(_0x42495e)[_0xbbf9('0xb')](function(_0xe9c656){_0x21a2c1[_0xbbf9('0x27')]=_0xe9c656['contact']['id'];_0x476ed7(_0x21a2c1);})['catch'](function(_0x37aa50){logger['error']('['+[_0x545490[_0xbbf9('0x15')]()]+']',_0x37aa50['message']);_0x1258b3(_0x37aa50[_0xbbf9('0x16')]);});});}function getTicket(_0x1a3a26,_0x3a135f,_0x5802f3,_0x3aaec5,_0x52ae8d){return function(_0x43ec06){logger[_0xbbf9('0xa')](_0xbbf9('0x2e'));return new Promise(function(_0x530a4b,_0x24338c){var _0xa2024a=moment();var _0xb296d={'method':'POST','uri':_0x5802f3+_0xbbf9('0x2f'),'body':{'title':intUtil[_0xbbf9('0x30')](_0x3aaec5['Subjects'],_0x52ae8d,'\x20'),'description':intUtil[_0xbbf9('0x30')](_0x3aaec5[_0xbbf9('0x31')],_0x52ae8d,'\x0a'),'owner_id':_0x43ec06[_0xbbf9('0x1a')],'creater_id':_0x43ec06[_0xbbf9('0x10')],'targetable_id':_0x43ec06[_0xbbf9('0x27')],'targetable_type':_0xbbf9('0x32'),'created_at':_0xa2024a[_0xbbf9('0x22')](_0xbbf9('0x33')),'due_date':_0xa2024a[_0xbbf9('0x34')](0x1e,'m')['format'](_0xbbf9('0x33'))},'json':!![]};_0xb296d[_0xbbf9('0x17')]=_0x3a135f;return rp(_0xb296d)[_0xbbf9('0xb')](function(_0x3c50b6){_0x43ec06[_0xbbf9('0x35')]=_0x3c50b6[_0xbbf9('0x36')]['id'];logger['info'](_0xbbf9('0x37'),_0x43ec06[_0xbbf9('0x35')]);_0x530a4b(_0x43ec06);})[_0xbbf9('0x13')](function(_0x196093){logger[_0xbbf9('0x14')]('['+[_0x1a3a26[_0xbbf9('0x15')]()]+']',_0x196093['message']);_0x24338c(_0x196093['message']);});});};}function emit(_0xbffa8a,_0x424ebc,_0x2dcbe3){var _0x28eeca={'uri':_0xbffa8a+'/contacts/'+_0x2dcbe3};io['to'](util[_0xbbf9('0x22')](_0xbbf9('0x38'),_0x424ebc))[_0xbbf9('0x39')](_0xbbf9('0x3a'),_0x28eeca);}exports['cs']=function(_0x45d19e,_0x56e426,_0x22b861,_0x2888fd,_0x101210,_0x3c285d,_0xc917d7,_0x5f16af){var _0x1cc4d3={};var _0x225afd={'Authorization':'Token\x20token='+_0x3c285d[_0xbbf9('0x3b')]};_0x3c285d[_0xbbf9('0x3c')]=intUtil['stripTrailingSlash'](_0x3c285d[_0xbbf9('0x3c')]);_0x3c285d[_0xbbf9('0x3d')]=intUtil[_0xbbf9('0x3e')](_0x3c285d[_0xbbf9('0x3d')]);var _0x434538=_0x3c285d[_0xbbf9('0x3c')];_0x1cc4d3[_0xbbf9('0xf')]=_0x3c285d[_0xbbf9('0x3f')];_0x1cc4d3[_0xbbf9('0x24')]=_0x5f16af[_0xbbf9('0x40')]()===_0xbbf9('0x41')?_0x56e426[_0xbbf9('0x42')]:_0x56e426[_0xbbf9('0x43')];_0x1cc4d3[_0xbbf9('0x44')]=_0x5f16af==='queue'||_0x5f16af==='unmanaged'?_0xbbf9('0x45'):'outbound';if(_0x2888fd){_0x1cc4d3['agentEmail']=_0x2888fd[_0xbbf9('0xe')];}var _0x4e120c=util[_0xbbf9('0x22')](_0xbbf9('0x46'),_0x3c285d[_0xbbf9('0x3d')],_0x56e426[_0xbbf9('0x47')],md5(_0x56e426[_0xbbf9('0x47')]));if(_0x101210&&_0x101210[_0xbbf9('0x48')]){logger['info'](_0xbbf9('0x49'),_0xbbf9('0x4a'));_0x56e426['recordingURL']=_0x4e120c;}else if(_0xc917d7&&_0xc917d7[_0xbbf9('0x4b')]&&_0xc917d7[_0xbbf9('0x4b')]!==_0xbbf9('0x4c')){logger[_0xbbf9('0xa')](_0xbbf9('0x4d'),_0xbbf9('0x4a'));_0x56e426['recordingURL']=_0x4e120c;}else{_0x56e426[_0xbbf9('0x4e')]='';}return getAdminId(_0x1cc4d3,_0x5f16af,_0x225afd,_0x434538)[_0xbbf9('0xb')](getUser(_0x5f16af,_0x225afd,_0x434538))[_0xbbf9('0xb')](getEndUser(_0x5f16af,_0x225afd,_0x434538))[_0xbbf9('0xb')](getTicket(_0x5f16af,_0x225afd,_0x434538,_0x22b861,_0x56e426))[_0xbbf9('0xb')](function(_0x1d9334){logger[_0xbbf9('0xa')](util[_0xbbf9('0x22')]('The\x20ticket\x20ID\x20is:\x20%s',_0x1d9334['ticketId']));if(_0x5f16af!==_0xbbf9('0x4f')){logger[_0xbbf9('0xa')]('['+[_0x5f16af[_0xbbf9('0x15')]()]+']',_0xbbf9('0x50'));emit(_0x434538,_0x2888fd['name'],_0x1d9334['endUserId']);}})[_0xbbf9('0x13')](function(_0x209816){logger[_0xbbf9('0x14')]('['+[_0x5f16af[_0xbbf9('0x15')]()]+_0xbbf9('0x51'),util[_0xbbf9('0x52')](_0x209816,{'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 a413cc6..450bd66 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 _0x74f3=['routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','freshdesk','unknown\x20integration','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','error','format','./zendesk','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','zoho','desk','vtiger','dynamics365','freshsales','servicenow','includes','data1','toLowerCase','data2','Configurations','data3','queue'];(function(_0x5e2751,_0x518a55){var _0x139a39=function(_0x4802db){while(--_0x4802db){_0x5e2751['push'](_0x5e2751['shift']());}};_0x139a39(++_0x518a55);}(_0x74f3,0x12b));var _0x374f=function(_0x443d35,_0x5a72b0){_0x443d35=_0x443d35-0x0;var _0x533e06=_0x74f3[_0x443d35];return _0x533e06;};'use strict';var _=require('lodash');var util=require('util');var zendesk=require(_0x374f('0x0'));var salesforce=require('./salesforce');var sugarcrm=require(_0x374f('0x1'));var freshdesk=require(_0x374f('0x2'));var zoho=require(_0x374f('0x3'));var desk=require(_0x374f('0x4'));var vtiger=require(_0x374f('0x5'));var servicenow=require(_0x374f('0x6'));var dynamics365=require(_0x374f('0x7'));var freshsales=require(_0x374f('0x8'));var integrations=[_0x374f('0x9'),_0x374f('0xa'),_0x374f('0xb'),'freshdesk',_0x374f('0xc'),_0x374f('0xd'),_0x374f('0xe'),_0x374f('0xf'),_0x374f('0x10'),_0x374f('0x11')];exports['exec']=function(_0x24f5e9,_0x47dfed,_0x36e5a3,_0x555182,_0x23efe7,_0x391627){if(_0x36e5a3){if(_[_0x374f('0x12')](integrations,_0x24f5e9[_0x374f('0x13')]['toLowerCase']())){try{var _0x16a067=null;var _0x5af06d='';var _0x274009=_0x36e5a3[_0x24f5e9[_0x374f('0x13')][_0x374f('0x14')]()];if(_0x274009){var _0x468bdf=_0x274009[_0x24f5e9[_0x374f('0x15')]];if(_0x468bdf){var _0x1ddf20=_['find'](_0x468bdf[_0x374f('0x16')],{'id':parseInt(_0x24f5e9[_0x374f('0x17')],0xa)});if(_0x1ddf20){if(_0x555182){if(_0x23efe7&&_0x47dfed[_0x374f('0x18')]){_0x5af06d='queue';}else if(_0x47dfed[_0x374f('0x19')]){_0x5af06d=_0x374f('0x1a');}else{console[_0x374f('0x1b')](_0x374f('0x1c'),_0x47dfed);}}else{_0x5af06d=_0x374f('0x1d');}switch(_0x24f5e9[_0x374f('0x13')][_0x374f('0x14')]()){case _0x374f('0x9'):zendesk[_0x5af06d](_0x24f5e9,_0x47dfed,_0x1ddf20,_0x555182,_0x23efe7,_0x468bdf,_0x391627);break;case _0x374f('0xa'):salesforce[_0x5af06d](_0x24f5e9,_0x47dfed,_0x1ddf20,_0x555182,_0x23efe7,_0x468bdf,_0x391627);break;case _0x374f('0xb'):sugarcrm[_0x5af06d](_0x24f5e9,_0x47dfed,_0x1ddf20,_0x555182,_0x23efe7,_0x468bdf,_0x391627);break;case _0x374f('0x1e'):freshdesk[_0x5af06d](_0x24f5e9,_0x47dfed,_0x1ddf20,_0x555182,_0x23efe7,_0x468bdf,_0x391627);break;case _0x374f('0xc'):zoho[_0x5af06d](_0x24f5e9,_0x47dfed,_0x1ddf20,_0x555182,_0x23efe7,_0x468bdf,_0x391627);break;case _0x374f('0xd'):desk[_0x5af06d](_0x24f5e9,_0x47dfed,_0x1ddf20,_0x555182,_0x23efe7,_0x468bdf,_0x391627);break;case _0x374f('0xe'):vtiger[_0x5af06d](_0x24f5e9,_0x47dfed,_0x1ddf20,_0x555182,_0x23efe7,_0x468bdf,_0x391627);break;case _0x374f('0x10'):freshsales['cs'](_0x24f5e9,_0x47dfed,_0x1ddf20,_0x555182,_0x23efe7,_0x468bdf,_0x391627,_0x5af06d);break;case _0x374f('0x11'):servicenow['cs'](_0x24f5e9,_0x47dfed,_0x1ddf20,_0x555182,_0x23efe7,_0x468bdf,_0x391627,_0x5af06d);break;case'dynamics365':dynamics365['cs'](_0x24f5e9,_0x47dfed,_0x1ddf20,_0x555182,_0x23efe7,_0x468bdf,_0x391627,_0x5af06d);break;default:console[_0x374f('0x1b')](_0x374f('0x1f'));}}else{_0x16a067=require('../../../../config/logger')(_0x24f5e9[_0x374f('0x13')]['toLowerCase']());_0x16a067['error'](_0x374f('0x20'),util['format'](_0x374f('0x21'),_0x24f5e9[_0x374f('0x13')]['toLowerCase'](),_0x24f5e9[_0x374f('0x17')]));}}else{_0x16a067=require('../../../../config/logger')(_0x24f5e9[_0x374f('0x13')][_0x374f('0x14')]());_0x16a067[_0x374f('0x22')](_0x374f('0x20'),util[_0x374f('0x23')]('%s\x20account\x20#%s\x20not\x20found',_0x24f5e9[_0x374f('0x13')]['toLowerCase'](),_0x24f5e9[_0x374f('0x15')]));}}else{}}catch(_0x38bc06){console[_0x374f('0x22')](_0x38bc06);}}}}; \ No newline at end of file +var _0xa659=['./dynamics365','./freshsales','zendesk','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','exec','includes','data1','toLowerCase','find','Configurations','data3','queue','routeId','outbound','EVENT\x20UNKNOWN','unmanaged','salesforce','freshsales','servicenow','log','unknown\x20integration','../../../../config/logger','error','format','[EXEC]','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./zoho','./desk','./vtiger','./servicenow'];(function(_0x31c201,_0x2f0396){var _0xe880b4=function(_0xc17602){while(--_0xc17602){_0x31c201['push'](_0x31c201['shift']());}};_0xe880b4(++_0x2f0396);}(_0xa659,0xe7));var _0x9a65=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa659[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9a65('0x0'));var util=require(_0x9a65('0x1'));var zendesk=require(_0x9a65('0x2'));var salesforce=require(_0x9a65('0x3'));var sugarcrm=require(_0x9a65('0x4'));var freshdesk=require('./freshdesk');var zoho=require(_0x9a65('0x5'));var desk=require(_0x9a65('0x6'));var vtiger=require(_0x9a65('0x7'));var servicenow=require(_0x9a65('0x8'));var dynamics365=require(_0x9a65('0x9'));var freshsales=require(_0x9a65('0xa'));var integrations=[_0x9a65('0xb'),'salesforce',_0x9a65('0xc'),_0x9a65('0xd'),_0x9a65('0xe'),_0x9a65('0xf'),_0x9a65('0x10'),_0x9a65('0x11'),'freshsales','servicenow'];exports[_0x9a65('0x12')]=function(_0x43f38a,_0x250098,_0x2b23c2,_0x30082d,_0x156fc6,_0x59a918){if(_0x2b23c2){if(_[_0x9a65('0x13')](integrations,_0x43f38a[_0x9a65('0x14')][_0x9a65('0x15')]())){try{var _0x2f8dc4=null;var _0xb723dc='';var _0x4a4a31=_0x2b23c2[_0x43f38a[_0x9a65('0x14')]['toLowerCase']()];if(_0x4a4a31){var _0x264fca=_0x4a4a31[_0x43f38a['data2']];if(_0x264fca){var _0x3362db=_[_0x9a65('0x16')](_0x264fca[_0x9a65('0x17')],{'id':parseInt(_0x43f38a[_0x9a65('0x18')],0xa)});if(_0x3362db){if(_0x30082d){if(_0x156fc6&&_0x250098[_0x9a65('0x19')]){_0xb723dc='queue';}else if(_0x250098[_0x9a65('0x1a')]){_0xb723dc=_0x9a65('0x1b');}else{console['log'](_0x9a65('0x1c'),_0x250098);}}else{_0xb723dc=_0x9a65('0x1d');}switch(_0x43f38a[_0x9a65('0x14')][_0x9a65('0x15')]()){case'zendesk':zendesk[_0xb723dc](_0x43f38a,_0x250098,_0x3362db,_0x30082d,_0x156fc6,_0x264fca,_0x59a918);break;case _0x9a65('0x1e'):salesforce[_0xb723dc](_0x43f38a,_0x250098,_0x3362db,_0x30082d,_0x156fc6,_0x264fca,_0x59a918);break;case _0x9a65('0xc'):sugarcrm[_0xb723dc](_0x43f38a,_0x250098,_0x3362db,_0x30082d,_0x156fc6,_0x264fca,_0x59a918);break;case _0x9a65('0xd'):freshdesk[_0xb723dc](_0x43f38a,_0x250098,_0x3362db,_0x30082d,_0x156fc6,_0x264fca,_0x59a918);break;case'zoho':zoho[_0xb723dc](_0x43f38a,_0x250098,_0x3362db,_0x30082d,_0x156fc6,_0x264fca,_0x59a918);break;case _0x9a65('0xf'):desk[_0xb723dc](_0x43f38a,_0x250098,_0x3362db,_0x30082d,_0x156fc6,_0x264fca,_0x59a918);break;case _0x9a65('0x10'):vtiger[_0xb723dc](_0x43f38a,_0x250098,_0x3362db,_0x30082d,_0x156fc6,_0x264fca,_0x59a918);break;case _0x9a65('0x1f'):freshsales['cs'](_0x43f38a,_0x250098,_0x3362db,_0x30082d,_0x156fc6,_0x264fca,_0x59a918,_0xb723dc);break;case _0x9a65('0x20'):servicenow['cs'](_0x43f38a,_0x250098,_0x3362db,_0x30082d,_0x156fc6,_0x264fca,_0x59a918,_0xb723dc);break;case _0x9a65('0x11'):dynamics365['cs'](_0x43f38a,_0x250098,_0x3362db,_0x30082d,_0x156fc6,_0x264fca,_0x59a918,_0xb723dc);break;default:console[_0x9a65('0x21')](_0x9a65('0x22'));}}else{_0x2f8dc4=require(_0x9a65('0x23'))(_0x43f38a[_0x9a65('0x14')][_0x9a65('0x15')]());_0x2f8dc4[_0x9a65('0x24')]('[EXEC]',util[_0x9a65('0x25')]('%s\x20configuration\x20#%s\x20not\x20found',_0x43f38a[_0x9a65('0x14')][_0x9a65('0x15')](),_0x43f38a[_0x9a65('0x18')]));}}else{_0x2f8dc4=require(_0x9a65('0x23'))(_0x43f38a['data1'][_0x9a65('0x15')]());_0x2f8dc4[_0x9a65('0x24')](_0x9a65('0x26'),util['format'](_0x9a65('0x27'),_0x43f38a[_0x9a65('0x14')][_0x9a65('0x15')](),_0x43f38a['data2']));}}else{}}catch(_0x4c03b9){console[_0x9a65('0x24')](_0x4c03b9);}}}}; \ 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 834b0f5..521063e 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 _0xbd1d=['trigger:browser:url','error','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','instanceUrl','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','toUpperCase','isNil',']\x20Ticket\x20%s\x20created.','lastevent',']\x20Integration\x20account\x20type\x20%s.','lodash','moment','bluebird','jsforce','util','ioredis','./util','../../../../config/environment','salesforce','redis','defaults','localhost','emit','assign','getString','ticketType','Task','utc','IsReminderSet','IsRecurrence','endUserType','lead','WhoId','account','WhatId','Case','contact','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','User','find','then','length','Email','Agent\x20%s\x20found.','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','user_id','display_name','identity','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','Contact','execute','additionalSearchLead','$or','Lead','account_contact_lead','additionalSearchAccount','Account','first','Name','Phone','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','forEach','string','picklist','idField','content','toString','variable','variableName','Variable','name','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientSecret','login','username','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','integrationTab','user:%s','trigger:salesforce:display','newTab'];(function(_0x271bf9,_0x9860d){var _0x40d274=function(_0x3f2918){while(--_0x3f2918){_0x271bf9['push'](_0x271bf9['shift']());}};_0x40d274(++_0x9860d);}(_0xbd1d,0x113));var _0xdbd1=function(_0x3b9d5f,_0x2e9039){_0x3b9d5f=_0x3b9d5f-0x0;var _0x39924e=_0xbd1d[_0x3b9d5f];return _0x39924e;};'use strict';var _=require(_0xdbd1('0x0'));var rp=require('request-promise');var moment=require(_0xdbd1('0x1'));var BPromise=require(_0xdbd1('0x2'));var md5=require('md5');var jsforce=require(_0xdbd1('0x3'));var util=require(_0xdbd1('0x4'));var Redis=require(_0xdbd1('0x5'));var intUtil=require(_0xdbd1('0x6'));var config=require(_0xdbd1('0x7'));var logger=require('../../../../config/logger')(_0xdbd1('0x8'));config[_0xdbd1('0x9')]=_[_0xdbd1('0xa')](config[_0xdbd1('0x9')],{'host':_0xdbd1('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xdbd1('0x9')]));function emit(_0x221959,_0x1d7749,_0x32b9ca){io['to'](_0x221959)[_0xdbd1('0xc')](_0x1d7749,_0x32b9ca);}function getTicket(_0x521303,_0x4fce2f,_0x2d4fac,_0x38a0db,_0x48f98f,_0xaf6a7f,_0x516354,_0x437d02){var _0x3c6c27=Object[_0xdbd1('0xd')]({},{'OwnerId':_0x4fce2f['id'],'Subject':intUtil[_0xdbd1('0xe')](_0x38a0db['Subjects'],_0x48f98f,'\x20'),'Description':intUtil[_0xdbd1('0xe')](_0x38a0db['Descriptions'],_0x48f98f,'\x0a')},getCustomFields(_0xaf6a7f,_0x48f98f));if(_0x2d4fac){if(_0x38a0db[_0xdbd1('0xf')]===_0xdbd1('0x10')){_0x3c6c27['ActivityDate']=moment[_0xdbd1('0x11')]();_0x3c6c27[_0xdbd1('0x12')]=![];_0x3c6c27[_0xdbd1('0x13')]=![];if(_0x2d4fac[_0xdbd1('0x14')]==='contact'||_0x2d4fac[_0xdbd1('0x14')]===_0xdbd1('0x15')){_0x3c6c27[_0xdbd1('0x16')]=_0x2d4fac['id'];}else if(_0x2d4fac[_0xdbd1('0x14')]===_0xdbd1('0x17')){_0x3c6c27[_0xdbd1('0x18')]=_0x2d4fac['id'];}}else if(_0x38a0db[_0xdbd1('0xf')]===_0xdbd1('0x19')){if(_0x2d4fac[_0xdbd1('0x14')]===_0xdbd1('0x1a')){_0x3c6c27[_0xdbd1('0x1b')]=_0x2d4fac['id'];}else if(_0x2d4fac[_0xdbd1('0x14')]===_0xdbd1('0x17')){_0x3c6c27[_0xdbd1('0x1c')]=_0x2d4fac['id'];}else if(_0x2d4fac[_0xdbd1('0x14')]===_0xdbd1('0x15')&&_0x38a0db[_0xdbd1('0x1d')]){_0x3c6c27[_0x38a0db[_0xdbd1('0x1d')]]=_0x2d4fac['id'];}else{logger[_0xdbd1('0x1e')](_0xdbd1('0x1f'));}}}return _0x516354[_0xdbd1('0x20')](_0x38a0db[_0xdbd1('0xf')])[_0xdbd1('0x21')](_0x3c6c27);}function getUser(_0x234728,_0x543794,_0x2c4359){if(!_['isNil'](_0x543794)&&intUtil['validateEmail'](_0x543794)){var _0x1bf1af={'Email':_0x543794};var _0x282320={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2c4359[_0xdbd1('0x20')](_0xdbd1('0x22'))[_0xdbd1('0x23')](_0x1bf1af,_0x282320)['execute']()[_0xdbd1('0x24')](function(_0x5d233b){if(_0x5d233b[_0xdbd1('0x25')]){var _0x4adcaf=_['find'](_0x5d233b,function(_0x1ca2ec){return _0x1ca2ec[_0xdbd1('0x26')]===_0x543794;});if(_0x4adcaf){logger[_0xdbd1('0x1e')](_0xdbd1('0x27'),_0x543794);return BPromise[_0xdbd1('0x28')]({'id':_0x4adcaf['Id'],'name':_0x4adcaf['Name']});}}else{logger[_0xdbd1('0x1e')](_0xdbd1('0x29'),_0x543794);return _0x2c4359['identity']()[_0xdbd1('0x24')](function(_0x39e185){return BPromise[_0xdbd1('0x28')]({'id':_0x39e185[_0xdbd1('0x2a')],'name':_0x39e185[_0xdbd1('0x2b')]});});}});}else{logger[_0xdbd1('0x1e')](_0xdbd1('0x29'),_0x543794);return _0x2c4359[_0xdbd1('0x2c')]()['then'](function(_0x49ecee){return BPromise[_0xdbd1('0x28')]({'id':_0x49ecee[_0xdbd1('0x2a')],'name':_0x49ecee['display_name']});});}}function getEndUser(_0x3891d4,_0x3d8c7d,_0x2bd5ea,_0x48a1f9,_0x214ffd){var _0x51b3a0={'$or':{'Phone':_0x48a1f9}};var _0x26c9c0={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xdbd1('0x28')]()[_0xdbd1('0x24')](function(){logger[_0xdbd1('0x1e')](_0xdbd1('0x2d'),_0x48a1f9,_0x3d8c7d['moduleSearch']);switch(_0x3d8c7d[_0xdbd1('0x2e')]){case _0xdbd1('0x2f'):var _0x1677c9=_[_0xdbd1('0x30')](_0x51b3a0);if(_0x3d8c7d[_0xdbd1('0x31')]){var _0x5ac705={};_0x5ac705[_0x3d8c7d[_0xdbd1('0x31')]]=_0x48a1f9;_[_0xdbd1('0x32')](_0x1677c9['$or'],_0x5ac705);}return _0x214ffd[_0xdbd1('0x20')](_0xdbd1('0x33'))[_0xdbd1('0x23')](_0x1677c9,_0x26c9c0)[_0xdbd1('0x34')]()[_0xdbd1('0x24')](function(_0x2d1519){if(_0x2d1519&&_0x2d1519[_0xdbd1('0x25')]){return _0x2d1519;}else{var _0x55a188=_['cloneDeep'](_0x51b3a0);if(_0x3d8c7d[_0xdbd1('0x35')]){var _0x2f4928={};_0x2f4928[_0x3d8c7d[_0xdbd1('0x35')]]=_0x48a1f9;_[_0xdbd1('0x32')](_0x55a188[_0xdbd1('0x36')],_0x2f4928);}return _0x214ffd[_0xdbd1('0x20')](_0xdbd1('0x37'))[_0xdbd1('0x23')](_0x55a188,_0x26c9c0);}});case _0xdbd1('0x38'):var _0x36f375=_['cloneDeep'](_0x51b3a0);if(_0x3d8c7d[_0xdbd1('0x39')]){var _0x5ac705={};_0x5ac705[_0x3d8c7d[_0xdbd1('0x39')]]=_0x48a1f9;_[_0xdbd1('0x32')](_0x36f375['$or'],_0x5ac705);}return _0x214ffd['sobject'](_0xdbd1('0x3a'))[_0xdbd1('0x23')](_0x36f375,_0x26c9c0)['execute']()[_0xdbd1('0x24')](function(_0xe76710){if(_0xe76710&&_0xe76710['length']){return _0xe76710;}else{var _0x2ead10=_[_0xdbd1('0x30')](_0x51b3a0);if(_0x3d8c7d['additionalSearchContact']){var _0x615560={};_0x615560[_0x3d8c7d['additionalSearchContact']]=_0x48a1f9;_[_0xdbd1('0x32')](_0x2ead10['$or'],_0x615560);}return _0x214ffd[_0xdbd1('0x20')](_0xdbd1('0x33'))[_0xdbd1('0x23')](_0x2ead10,_0x26c9c0)[_0xdbd1('0x24')](function(_0x18d028){if(_0x18d028&&_0x18d028[_0xdbd1('0x25')]){return _0x18d028;}else{var _0x174563=_[_0xdbd1('0x30')](_0x51b3a0);if(_0x3d8c7d[_0xdbd1('0x35')]){var _0xd7285a={};_0xd7285a[_0x3d8c7d[_0xdbd1('0x35')]]=_0x48a1f9;_[_0xdbd1('0x32')](_0x174563['$or'],_0xd7285a);}return _0x214ffd[_0xdbd1('0x20')](_0xdbd1('0x37'))[_0xdbd1('0x23')](_0x174563,_0x26c9c0);}});}});case'contact':var _0x1677c9=_[_0xdbd1('0x30')](_0x51b3a0);if(_0x3d8c7d[_0xdbd1('0x31')]){var _0x5ac705={};_0x5ac705[_0x3d8c7d[_0xdbd1('0x31')]]=_0x48a1f9;_['merge'](_0x1677c9[_0xdbd1('0x36')],_0x5ac705);}return _0x214ffd['sobject'](_0xdbd1('0x33'))['find'](_0x1677c9,_0x26c9c0)[_0xdbd1('0x34')]();case _0xdbd1('0x15'):var _0x5d7085=_['cloneDeep'](_0x51b3a0);if(_0x3d8c7d['additionalSearchLead']){var _0x5ac705={};_0x5ac705[_0x3d8c7d['additionalSearchLead']]=_0x48a1f9;_[_0xdbd1('0x32')](_0x5d7085[_0xdbd1('0x36')],_0x5ac705);}return _0x214ffd[_0xdbd1('0x20')](_0xdbd1('0x37'))[_0xdbd1('0x23')](_0x5d7085,_0x26c9c0);case _0xdbd1('0x17'):var _0x36f375=_['cloneDeep'](_0x51b3a0);if(_0x3d8c7d[_0xdbd1('0x39')]){var _0x5ac705={};_0x5ac705[_0x3d8c7d[_0xdbd1('0x39')]]=_0x48a1f9;_[_0xdbd1('0x32')](_0x36f375[_0xdbd1('0x36')],_0x5ac705);}return _0x214ffd[_0xdbd1('0x20')](_0xdbd1('0x3a'))[_0xdbd1('0x23')](_0x36f375,_0x26c9c0);default:return null;}})[_0xdbd1('0x24')](function(_0x18fa21){if(_0x18fa21&&_0x18fa21[_0xdbd1('0x25')]){var _0x40d1a3=_[_0xdbd1('0x3b')](_0x18fa21);if(_0x40d1a3){return BPromise['resolve']({'id':_0x40d1a3['Id'],'name':_0x40d1a3[_0xdbd1('0x3c')],'phone':_0x40d1a3[_0xdbd1('0x3d')],'endUserType':_0x40d1a3['attributes'][_0xdbd1('0x3e')][_0xdbd1('0x3f')]()});}}})[_0xdbd1('0x24')](function(_0x58a01b){if(_0x58a01b){logger[_0xdbd1('0x1e')](_0xdbd1('0x40'),_0x58a01b[_0xdbd1('0x14')],_0x48a1f9);return BPromise[_0xdbd1('0x28')](_0x58a01b);}else{logger[_0xdbd1('0x1e')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x48a1f9);var _0x112cbc={'Phone':_0x48a1f9};if(_0x3d8c7d['moduleCreate']){if(_0x3d8c7d[_0xdbd1('0x41')]===_0xdbd1('0x1a')){logger[_0xdbd1('0x1e')](_0xdbd1('0x42'),_0x48a1f9,_0x3d8c7d[_0xdbd1('0x41')]);_0x112cbc[_0xdbd1('0x43')]=_0x2bd5ea!==_0xdbd1('0x44')?_0x2bd5ea:util['format']('Caller\x20-\x20%s',_0x48a1f9);}else if(_0x3d8c7d['moduleCreate']===_0xdbd1('0x15')){logger['info'](_0xdbd1('0x42'),_0x48a1f9,_0x3d8c7d[_0xdbd1('0x41')]);_0x112cbc[_0xdbd1('0x43')]=_0x2bd5ea!==''?_0x2bd5ea:util[_0xdbd1('0x45')](_0xdbd1('0x46'),_0x48a1f9);_0x112cbc[_0xdbd1('0x47')]=_0xdbd1('0x48');}else if(_0x3d8c7d[_0xdbd1('0x41')]===_0xdbd1('0x17')){logger[_0xdbd1('0x1e')](_0xdbd1('0x42'),_0x48a1f9,_0x3d8c7d[_0xdbd1('0x41')]);_0x112cbc[_0xdbd1('0x3c')]=_0x2bd5ea!==''?_0x2bd5ea:util[_0xdbd1('0x45')](_0xdbd1('0x46'),_0x48a1f9);}else{return null;}}return _0x214ffd['sobject'](_[_0xdbd1('0x49')](_0x3d8c7d[_0xdbd1('0x41')]))['create'](_0x112cbc)[_0xdbd1('0x24')](function(_0x38cb43){return BPromise['resolve']({'id':_0x38cb43['id'],'endUserType':_0x3d8c7d[_0xdbd1('0x41')]});});}});}function getCustomFields(_0x18e6a5,_0x35072d){var _0x5a28ee={};if(_0x18e6a5[_0xdbd1('0x25')]>0x0){_[_0xdbd1('0x4a')](_0x18e6a5,function(_0x4d45de){if(_['includes']([_0xdbd1('0x4b'),_0xdbd1('0x4c')],_0x4d45de[_0xdbd1('0x3e')])&&_0x4d45de[_0xdbd1('0x4d')]){_0x5a28ee[_0x4d45de[_0xdbd1('0x4d')]]=_0x4d45de[_0xdbd1('0x4e')][_0xdbd1('0x4f')]();}else if(_0x4d45de[_0xdbd1('0x3e')]===_0xdbd1('0x50')&&_0x4d45de[_0xdbd1('0x51')]&&_0x4d45de[_0xdbd1('0x4d')]){_0x35072d[_0x4d45de[_0xdbd1('0x51')]]&&(_0x5a28ee[_0x4d45de['idField']]=_0x35072d[_0x4d45de[_0xdbd1('0x51')]]['toString']());}else if(_0x4d45de[_0xdbd1('0x3e')]==='customVariable'&&_0x4d45de[_0xdbd1('0x52')]&&_0x4d45de[_0xdbd1('0x52')][_0xdbd1('0x53')]&&_0x4d45de['idField']){_0x35072d[_0x4d45de[_0xdbd1('0x52')][_0xdbd1('0x53')][_0xdbd1('0x3f')]()]&&(_0x5a28ee[_0x4d45de[_0xdbd1('0x4d')]]=_0x35072d[_0x4d45de[_0xdbd1('0x52')]['name'][_0xdbd1('0x3f')]()]['toString']());}});}return _0x5a28ee;}function getConnection(_0x45b496){var _0x104073=_0x45b496['password'][_0xdbd1('0x54')](_0x45b496[_0xdbd1('0x55')]);var _0x30015b=new jsforce[(_0xdbd1('0x56'))]({'oauth2':{'loginUrl':_0x45b496[_0xdbd1('0x57')]||_0xdbd1('0x58'),'clientId':_0x45b496['clientId'],'clientSecret':_0x45b496[_0xdbd1('0x59')]}});return _0x30015b[_0xdbd1('0x5a')](_0x45b496[_0xdbd1('0x5b')],_0x104073)[_0xdbd1('0x24')](function(){logger['info']('Connection\x20established.');return _0x30015b;});}exports[_0xdbd1('0x5c')]=function(_0x3d71bb,_0x3d3c49,_0x12a7ea,_0x5b8800,_0x350210,_0x37f951){var _0x2eee7e,_0x4d3fa3,_0x146eaa,_0x3dd563;_0x37f951['serverUrl']=intUtil[_0xdbd1('0x5d')](_0x37f951[_0xdbd1('0x5e')]);_0x37f951['remoteUri']=intUtil[_0xdbd1('0x5d')](_0x37f951['remoteUri']);if(_0x350210&&_0x350210[_0xdbd1('0x5f')]){logger[_0xdbd1('0x1e')](_0xdbd1('0x60'),_0xdbd1('0x61'));_0x3d3c49[_0xdbd1('0x62')]=util['format'](_0xdbd1('0x63'),_0x37f951['serverUrl'],_0x3d3c49[_0xdbd1('0x64')],md5(_0x3d3c49[_0xdbd1('0x64')]));}else{_0x3d3c49[_0xdbd1('0x62')]='';}return getConnection(_0x37f951)[_0xdbd1('0x24')](function(_0x33ce1d){_0x3dd563=_0x33ce1d;return getUser(_0x37f951,_0x5b8800[_0xdbd1('0x65')],_0x3dd563);})[_0xdbd1('0x24')](function(_0x2255d6){_0x2eee7e=_0x2255d6;return getEndUser(_0x37f951,_0x12a7ea,_0x3d3c49[_0xdbd1('0x66')],_0x3d3c49[_0xdbd1('0x67')],_0x3dd563);})['then'](function(_0x400db6){_0x4d3fa3=_0x400db6;return getTicket(_0x37f951,_0x2eee7e,_0x4d3fa3,_0x12a7ea,_0x3d3c49,_0x12a7ea[_0xdbd1('0x68')],_0x3dd563,'queue');})['then'](function(_0x46a257){_0x146eaa=_0x46a257;logger[_0xdbd1('0x1e')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x146eaa['id']);logger[_0xdbd1('0x1e')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x146eaa['id'],_0x5b8800[_0xdbd1('0x53')],_0x37f951[_0xdbd1('0x3e')]);switch(_0x37f951['type']){case _0xdbd1('0x69'):emit(util[_0xdbd1('0x45')](_0xdbd1('0x6a'),_0x5b8800[_0xdbd1('0x53')]),_0xdbd1('0x6b'),{'recordId':_0x146eaa['id']});break;case _0xdbd1('0x6c'):emit(util[_0xdbd1('0x45')](_0xdbd1('0x6a'),_0x5b8800[_0xdbd1('0x53')]),_0xdbd1('0x6d'),{'uri':util['format']('%s/%s/e',_0x3dd563['instanceUrl'],_0x146eaa['id'])});break;default:logger[_0xdbd1('0x6e')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xdbd1('0x6f')](function(_0x2d4550){logger[_0xdbd1('0x6e')]('[QUEUE]',_0x2d4550);});};exports[_0xdbd1('0x70')]=function(_0x1b490e,_0x47c56f,_0x37b4a4,_0x1b0406,_0x45ce9e,_0x3fe9d8,_0x3c3335){var _0xef43d6,_0x507e57,_0x554d47,_0x36aad4;_0x3fe9d8[_0xdbd1('0x5e')]=intUtil[_0xdbd1('0x5d')](_0x3fe9d8['serverUrl']);_0x3fe9d8[_0xdbd1('0x57')]=intUtil[_0xdbd1('0x5d')](_0x3fe9d8[_0xdbd1('0x57')]);if(_0x3c3335&&_0x3c3335[_0xdbd1('0x71')]&&_0x3c3335[_0xdbd1('0x71')]!==_0xdbd1('0x72')){logger[_0xdbd1('0x1e')](_0xdbd1('0x73'),_0xdbd1('0x61'));_0x47c56f[_0xdbd1('0x62')]=util['format'](_0xdbd1('0x63'),_0x3fe9d8[_0xdbd1('0x5e')],_0x47c56f[_0xdbd1('0x64')],md5(_0x47c56f['uniqueid']));}return getConnection(_0x3fe9d8)['then'](function(_0x58fee5){_0x36aad4=_0x58fee5;return getUser(_0x3fe9d8,_0x1b0406[_0xdbd1('0x65')],_0x36aad4);})[_0xdbd1('0x24')](function(_0x1c6e08){_0xef43d6=_0x1c6e08;return getEndUser(_0x3fe9d8,_0x37b4a4,_0x47c56f[_0xdbd1('0x74')],_0x47c56f[_0xdbd1('0x75')],_0x36aad4);})['then'](function(_0x590a23){_0x507e57=_0x590a23;return getTicket(_0x3fe9d8,_0xef43d6,_0x507e57,_0x37b4a4,_0x47c56f,_0x37b4a4['Fields'],_0x36aad4,_0xdbd1('0x70'));})[_0xdbd1('0x24')](function(_0x274e2b){_0x554d47=_0x274e2b;logger[_0xdbd1('0x1e')](_0xdbd1('0x76'),_0x554d47['id']);logger[_0xdbd1('0x1e')](_0xdbd1('0x77'),_0x554d47['id'],_0x1b0406[_0xdbd1('0x53')],_0x3fe9d8[_0xdbd1('0x3e')]);switch(_0x3fe9d8[_0xdbd1('0x3e')]){case'integrationTab':emit(util['format']('user:%s',_0x1b0406['name']),_0xdbd1('0x6b'),{'recordId':_0x554d47['id']});break;case'newTab':emit(util[_0xdbd1('0x45')](_0xdbd1('0x6a'),_0x1b0406[_0xdbd1('0x53')]),'trigger:browser:url',{'uri':util['format']('%s/%s/e',_0x36aad4[_0xdbd1('0x78')],_0x554d47['id'])});break;default:logger[_0xdbd1('0x6e')](_0xdbd1('0x73'),_0xdbd1('0x79'));}})['catch'](function(_0x12cbcd){logger[_0xdbd1('0x6e')]('[OUTBOUND]',_0x12cbcd);});};exports[_0xdbd1('0x7a')]=function(_0x7e84a4,_0x4ebeb2,_0x38893a,_0x4b8f68,_0x342a4f,_0x3f3a6d){var _0x289d6d,_0x5b62ff,_0x30aca6,_0x5dc830;_0x3f3a6d[_0xdbd1('0x5e')]=intUtil['stripTrailingSlash'](_0x3f3a6d[_0xdbd1('0x5e')]);_0x3f3a6d[_0xdbd1('0x57')]=intUtil[_0xdbd1('0x5d')](_0x3f3a6d[_0xdbd1('0x57')]);if(_0x342a4f&&_0x342a4f[_0xdbd1('0x5f')]){logger[_0xdbd1('0x1e')]('['+_0x4ebeb2['lastevent'][_0xdbd1('0x7b')]()+']','Recording\x20is\x20enabled!');_0x4ebeb2[_0xdbd1('0x62')]=util[_0xdbd1('0x45')](_0xdbd1('0x63'),_0x3f3a6d[_0xdbd1('0x5e')],_0x4ebeb2[_0xdbd1('0x64')],md5(_0x4ebeb2[_0xdbd1('0x64')]));}else{_0x4ebeb2['recordingURL']='';}return getConnection(_0x3f3a6d)['then'](function(_0x13b5a5){_0x5dc830=_0x13b5a5;if(!_[_0xdbd1('0x7c')](_0x4b8f68)){return getUser(_0x3f3a6d,_0x4b8f68[_0xdbd1('0x53')],_0x5dc830);}else{return getUser(_0x3f3a6d,null,_0x5dc830);}})[_0xdbd1('0x24')](function(_0x5e282c){_0x289d6d=_0x5e282c;return getEndUser(_0x3f3a6d,_0x38893a,_0x4ebeb2[_0xdbd1('0x66')],_0x4ebeb2['calleridnum'],_0x5dc830);})[_0xdbd1('0x24')](function(_0x416acc){_0x5b62ff=_0x416acc;return getTicket(_0x3f3a6d,_0x289d6d,_0x5b62ff,_0x38893a,_0x4ebeb2,_0x38893a[_0xdbd1('0x68')],_0x5dc830);})[_0xdbd1('0x24')](function(_0x3e4d06){_0x30aca6=_0x3e4d06;logger['info']('['+_0x4ebeb2['lastevent'][_0xdbd1('0x7b')]()+_0xdbd1('0x7d'),_0x30aca6['id']);logger[_0xdbd1('0x1e')]('['+_0x4ebeb2[_0xdbd1('0x7e')][_0xdbd1('0x7b')]()+_0xdbd1('0x7f'),_0x3f3a6d[_0xdbd1('0x3e')]);})[_0xdbd1('0x6f')](function(_0x2d9faa){logger[_0xdbd1('0x6e')]('['+_0x4ebeb2[_0xdbd1('0x7e')]['toUpperCase']()+']',_0x2d9faa);});}; \ No newline at end of file +var _0x0dff=['newTab','trigger:browser:url','instanceUrl','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','catch','unmanaged','lastevent','toUpperCase','calleridnum',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','jsforce','ioredis','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','Task','ActivityDate','IsReminderSet','IsRecurrence','endUserType','lead','WhoId','account','WhatId','ticketType','Case','contact','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','validateEmail','User','find','then','length','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','$or','Contact','execute','additionalSearchLead','merge','Lead','additionalSearchAccount','Account','first','Phone','attributes','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','LastName','','Caller\x20-\x20%s','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','format','Company','No\x20Company','upperFirst','create','forEach','includes','string','picklist','idField','content','toString','type','variable','variableName','customVariable','Variable','name','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','login','username','Connection\x20established.','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s'];(function(_0x1a422a,_0x3468fd){var _0x4dcab4=function(_0x24b700){while(--_0x24b700){_0x1a422a['push'](_0x1a422a['shift']());}};_0x4dcab4(++_0x3468fd);}(_0x0dff,0x119));var _0xf0df=function(_0x3a164e,_0x390f0d){_0x3a164e=_0x3a164e-0x0;var _0x4274b6=_0x0dff[_0x3a164e];return _0x4274b6;};'use strict';var _=require(_0xf0df('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var md5=require('md5');var jsforce=require(_0xf0df('0x1'));var util=require('util');var Redis=require(_0xf0df('0x2'));var intUtil=require('./util');var config=require(_0xf0df('0x3'));var logger=require(_0xf0df('0x4'))(_0xf0df('0x5'));config[_0xf0df('0x6')]=_[_0xf0df('0x7')](config[_0xf0df('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xf0df('0x8'))(new Redis(config['redis']));function emit(_0x3d0dc4,_0x19591b,_0x36de15){io['to'](_0x3d0dc4)[_0xf0df('0x9')](_0x19591b,_0x36de15);}function getTicket(_0x4b65a5,_0x15c974,_0x1a87ce,_0x3d7d35,_0x2ebf6f,_0x1a5889,_0x4b88a7,_0x1157c9){var _0x26e013=Object[_0xf0df('0xa')]({},{'OwnerId':_0x15c974['id'],'Subject':intUtil[_0xf0df('0xb')](_0x3d7d35[_0xf0df('0xc')],_0x2ebf6f,'\x20'),'Description':intUtil['getString'](_0x3d7d35[_0xf0df('0xd')],_0x2ebf6f,'\x0a')},getCustomFields(_0x1a5889,_0x2ebf6f));if(_0x1a87ce){if(_0x3d7d35['ticketType']===_0xf0df('0xe')){_0x26e013[_0xf0df('0xf')]=moment['utc']();_0x26e013[_0xf0df('0x10')]=![];_0x26e013[_0xf0df('0x11')]=![];if(_0x1a87ce[_0xf0df('0x12')]==='contact'||_0x1a87ce[_0xf0df('0x12')]===_0xf0df('0x13')){_0x26e013[_0xf0df('0x14')]=_0x1a87ce['id'];}else if(_0x1a87ce[_0xf0df('0x12')]===_0xf0df('0x15')){_0x26e013[_0xf0df('0x16')]=_0x1a87ce['id'];}}else if(_0x3d7d35[_0xf0df('0x17')]===_0xf0df('0x18')){if(_0x1a87ce[_0xf0df('0x12')]===_0xf0df('0x19')){_0x26e013['ContactId']=_0x1a87ce['id'];}else if(_0x1a87ce[_0xf0df('0x12')]===_0xf0df('0x15')){_0x26e013[_0xf0df('0x1a')]=_0x1a87ce['id'];}else if(_0x1a87ce['endUserType']===_0xf0df('0x13')&&_0x3d7d35[_0xf0df('0x1b')]){_0x26e013[_0x3d7d35[_0xf0df('0x1b')]]=_0x1a87ce['id'];}else{logger[_0xf0df('0x1c')](_0xf0df('0x1d'));}}}return _0x4b88a7[_0xf0df('0x1e')](_0x3d7d35[_0xf0df('0x17')])['create'](_0x26e013);}function getUser(_0x29ac8f,_0x59ade7,_0x2e2be6){if(!_[_0xf0df('0x1f')](_0x59ade7)&&intUtil[_0xf0df('0x20')](_0x59ade7)){var _0x44a7e9={'Email':_0x59ade7};var _0xb17746={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2e2be6[_0xf0df('0x1e')](_0xf0df('0x21'))[_0xf0df('0x22')](_0x44a7e9,_0xb17746)['execute']()[_0xf0df('0x23')](function(_0xbb2bd0){if(_0xbb2bd0[_0xf0df('0x24')]){var _0x5c2a01=_['find'](_0xbb2bd0,function(_0x60ce5d){return _0x60ce5d[_0xf0df('0x25')]===_0x59ade7;});if(_0x5c2a01){logger[_0xf0df('0x1c')](_0xf0df('0x26'),_0x59ade7);return BPromise[_0xf0df('0x27')]({'id':_0x5c2a01['Id'],'name':_0x5c2a01[_0xf0df('0x28')]});}}else{logger[_0xf0df('0x1c')](_0xf0df('0x29'),_0x59ade7);return _0x2e2be6[_0xf0df('0x2a')]()[_0xf0df('0x23')](function(_0x3dd72b){return BPromise[_0xf0df('0x27')]({'id':_0x3dd72b[_0xf0df('0x2b')],'name':_0x3dd72b['display_name']});});}});}else{logger[_0xf0df('0x1c')](_0xf0df('0x29'),_0x59ade7);return _0x2e2be6[_0xf0df('0x2a')]()[_0xf0df('0x23')](function(_0x2e004a){return BPromise[_0xf0df('0x27')]({'id':_0x2e004a[_0xf0df('0x2b')],'name':_0x2e004a[_0xf0df('0x2c')]});});}}function getEndUser(_0x18964d,_0x46e0fb,_0x10fbbc,_0x47dd41,_0x43d589){var _0x39585f={'$or':{'Phone':_0x47dd41}};var _0x1d2c34={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xf0df('0x27')]()[_0xf0df('0x23')](function(){logger['info']('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x47dd41,_0x46e0fb[_0xf0df('0x2d')]);switch(_0x46e0fb[_0xf0df('0x2d')]){case _0xf0df('0x2e'):var _0xe387a8=_[_0xf0df('0x2f')](_0x39585f);if(_0x46e0fb['additionalSearchContact']){var _0x4378cb={};_0x4378cb[_0x46e0fb[_0xf0df('0x30')]]=_0x47dd41;_['merge'](_0xe387a8[_0xf0df('0x31')],_0x4378cb);}return _0x43d589[_0xf0df('0x1e')](_0xf0df('0x32'))['find'](_0xe387a8,_0x1d2c34)[_0xf0df('0x33')]()['then'](function(_0x46f8eb){if(_0x46f8eb&&_0x46f8eb['length']){return _0x46f8eb;}else{var _0x1a4663=_[_0xf0df('0x2f')](_0x39585f);if(_0x46e0fb['additionalSearchLead']){var _0xfe039b={};_0xfe039b[_0x46e0fb[_0xf0df('0x34')]]=_0x47dd41;_[_0xf0df('0x35')](_0x1a4663[_0xf0df('0x31')],_0xfe039b);}return _0x43d589[_0xf0df('0x1e')](_0xf0df('0x36'))[_0xf0df('0x22')](_0x1a4663,_0x1d2c34);}});case'account_contact_lead':var _0x381b5c=_[_0xf0df('0x2f')](_0x39585f);if(_0x46e0fb[_0xf0df('0x37')]){var _0x4378cb={};_0x4378cb[_0x46e0fb[_0xf0df('0x37')]]=_0x47dd41;_[_0xf0df('0x35')](_0x381b5c[_0xf0df('0x31')],_0x4378cb);}return _0x43d589[_0xf0df('0x1e')](_0xf0df('0x38'))[_0xf0df('0x22')](_0x381b5c,_0x1d2c34)[_0xf0df('0x33')]()[_0xf0df('0x23')](function(_0x3af400){if(_0x3af400&&_0x3af400[_0xf0df('0x24')]){return _0x3af400;}else{var _0x25bc4f=_['cloneDeep'](_0x39585f);if(_0x46e0fb[_0xf0df('0x30')]){var _0x2626cc={};_0x2626cc[_0x46e0fb[_0xf0df('0x30')]]=_0x47dd41;_['merge'](_0x25bc4f['$or'],_0x2626cc);}return _0x43d589[_0xf0df('0x1e')](_0xf0df('0x32'))[_0xf0df('0x22')](_0x25bc4f,_0x1d2c34)[_0xf0df('0x23')](function(_0x5cfa52){if(_0x5cfa52&&_0x5cfa52[_0xf0df('0x24')]){return _0x5cfa52;}else{var _0x3844c5=_[_0xf0df('0x2f')](_0x39585f);if(_0x46e0fb['additionalSearchLead']){var _0x1c104b={};_0x1c104b[_0x46e0fb[_0xf0df('0x34')]]=_0x47dd41;_[_0xf0df('0x35')](_0x3844c5[_0xf0df('0x31')],_0x1c104b);}return _0x43d589[_0xf0df('0x1e')](_0xf0df('0x36'))[_0xf0df('0x22')](_0x3844c5,_0x1d2c34);}});}});case _0xf0df('0x19'):var _0xe387a8=_[_0xf0df('0x2f')](_0x39585f);if(_0x46e0fb['additionalSearchContact']){var _0x4378cb={};_0x4378cb[_0x46e0fb['additionalSearchContact']]=_0x47dd41;_[_0xf0df('0x35')](_0xe387a8[_0xf0df('0x31')],_0x4378cb);}return _0x43d589['sobject'](_0xf0df('0x32'))[_0xf0df('0x22')](_0xe387a8,_0x1d2c34)[_0xf0df('0x33')]();case _0xf0df('0x13'):var _0x5c6730=_[_0xf0df('0x2f')](_0x39585f);if(_0x46e0fb[_0xf0df('0x34')]){var _0x4378cb={};_0x4378cb[_0x46e0fb[_0xf0df('0x34')]]=_0x47dd41;_[_0xf0df('0x35')](_0x5c6730['$or'],_0x4378cb);}return _0x43d589['sobject'](_0xf0df('0x36'))[_0xf0df('0x22')](_0x5c6730,_0x1d2c34);case _0xf0df('0x15'):var _0x381b5c=_[_0xf0df('0x2f')](_0x39585f);if(_0x46e0fb[_0xf0df('0x37')]){var _0x4378cb={};_0x4378cb[_0x46e0fb['additionalSearchAccount']]=_0x47dd41;_['merge'](_0x381b5c['$or'],_0x4378cb);}return _0x43d589[_0xf0df('0x1e')]('Account')['find'](_0x381b5c,_0x1d2c34);default:return null;}})[_0xf0df('0x23')](function(_0x48f747){if(_0x48f747&&_0x48f747[_0xf0df('0x24')]){var _0x53d3e2=_[_0xf0df('0x39')](_0x48f747);if(_0x53d3e2){return BPromise['resolve']({'id':_0x53d3e2['Id'],'name':_0x53d3e2[_0xf0df('0x28')],'phone':_0x53d3e2[_0xf0df('0x3a')],'endUserType':_0x53d3e2[_0xf0df('0x3b')]['type'][_0xf0df('0x3c')]()});}}})[_0xf0df('0x23')](function(_0x16f6e1){if(_0x16f6e1){logger[_0xf0df('0x1c')](_0xf0df('0x3d'),_0x16f6e1[_0xf0df('0x12')],_0x47dd41);return BPromise['resolve'](_0x16f6e1);}else{logger[_0xf0df('0x1c')](_0xf0df('0x3e'),_0x47dd41);var _0xabe077={'Phone':_0x47dd41};if(_0x46e0fb[_0xf0df('0x3f')]){if(_0x46e0fb[_0xf0df('0x3f')]===_0xf0df('0x19')){logger[_0xf0df('0x1c')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x47dd41,_0x46e0fb[_0xf0df('0x3f')]);_0xabe077[_0xf0df('0x40')]=_0x10fbbc!==_0xf0df('0x41')?_0x10fbbc:util['format'](_0xf0df('0x42'),_0x47dd41);}else if(_0x46e0fb[_0xf0df('0x3f')]==='lead'){logger[_0xf0df('0x1c')](_0xf0df('0x43'),_0x47dd41,_0x46e0fb[_0xf0df('0x3f')]);_0xabe077['LastName']=_0x10fbbc!==''?_0x10fbbc:util[_0xf0df('0x44')](_0xf0df('0x42'),_0x47dd41);_0xabe077[_0xf0df('0x45')]=_0xf0df('0x46');}else if(_0x46e0fb[_0xf0df('0x3f')]===_0xf0df('0x15')){logger[_0xf0df('0x1c')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x47dd41,_0x46e0fb[_0xf0df('0x3f')]);_0xabe077[_0xf0df('0x28')]=_0x10fbbc!==_0xf0df('0x41')?_0x10fbbc:util[_0xf0df('0x44')](_0xf0df('0x42'),_0x47dd41);}else{return null;}}return _0x43d589['sobject'](_[_0xf0df('0x47')](_0x46e0fb[_0xf0df('0x3f')]))[_0xf0df('0x48')](_0xabe077)[_0xf0df('0x23')](function(_0x1d39fe){return BPromise[_0xf0df('0x27')]({'id':_0x1d39fe['id'],'endUserType':_0x46e0fb[_0xf0df('0x3f')]});});}});}function getCustomFields(_0x1bdd45,_0x971c0f){var _0x1049b3={};if(_0x1bdd45['length']>0x0){_[_0xf0df('0x49')](_0x1bdd45,function(_0x3e8b31){if(_[_0xf0df('0x4a')]([_0xf0df('0x4b'),_0xf0df('0x4c')],_0x3e8b31['type'])&&_0x3e8b31[_0xf0df('0x4d')]){_0x1049b3[_0x3e8b31[_0xf0df('0x4d')]]=_0x3e8b31[_0xf0df('0x4e')][_0xf0df('0x4f')]();}else if(_0x3e8b31[_0xf0df('0x50')]===_0xf0df('0x51')&&_0x3e8b31['variableName']&&_0x3e8b31[_0xf0df('0x4d')]){_0x971c0f[_0x3e8b31[_0xf0df('0x52')]]&&(_0x1049b3[_0x3e8b31[_0xf0df('0x4d')]]=_0x971c0f[_0x3e8b31['variableName']]['toString']());}else if(_0x3e8b31['type']===_0xf0df('0x53')&&_0x3e8b31[_0xf0df('0x54')]&&_0x3e8b31[_0xf0df('0x54')][_0xf0df('0x55')]&&_0x3e8b31[_0xf0df('0x4d')]){_0x971c0f[_0x3e8b31[_0xf0df('0x54')][_0xf0df('0x55')]['toLowerCase']()]&&(_0x1049b3[_0x3e8b31[_0xf0df('0x4d')]]=_0x971c0f[_0x3e8b31['Variable'][_0xf0df('0x55')][_0xf0df('0x3c')]()][_0xf0df('0x4f')]());}});}return _0x1049b3;}function getConnection(_0x5e09d4){var _0x56731a=_0x5e09d4['password'][_0xf0df('0x56')](_0x5e09d4[_0xf0df('0x57')]);var _0x35fb52=new jsforce[(_0xf0df('0x58'))]({'oauth2':{'loginUrl':_0x5e09d4[_0xf0df('0x59')]||_0xf0df('0x5a'),'clientId':_0x5e09d4[_0xf0df('0x5b')],'clientSecret':_0x5e09d4['clientSecret']}});return _0x35fb52[_0xf0df('0x5c')](_0x5e09d4[_0xf0df('0x5d')],_0x56731a)[_0xf0df('0x23')](function(){logger[_0xf0df('0x1c')](_0xf0df('0x5e'));return _0x35fb52;});}exports[_0xf0df('0x5f')]=function(_0x738755,_0xec022f,_0x538848,_0x54427a,_0x415b55,_0x4345b5){var _0x46a16d,_0x5e4b0b,_0x29f501,_0x417998;_0x4345b5['serverUrl']=intUtil[_0xf0df('0x60')](_0x4345b5[_0xf0df('0x61')]);_0x4345b5[_0xf0df('0x59')]=intUtil[_0xf0df('0x60')](_0x4345b5[_0xf0df('0x59')]);if(_0x415b55&&_0x415b55[_0xf0df('0x62')]){logger[_0xf0df('0x1c')](_0xf0df('0x63'),_0xf0df('0x64'));_0xec022f[_0xf0df('0x65')]=util['format'](_0xf0df('0x66'),_0x4345b5[_0xf0df('0x61')],_0xec022f['uniqueid'],md5(_0xec022f[_0xf0df('0x67')]));}else{_0xec022f['recordingURL']='';}return getConnection(_0x4345b5)[_0xf0df('0x23')](function(_0x4fc596){_0x417998=_0x4fc596;return getUser(_0x4345b5,_0x54427a[_0xf0df('0x68')],_0x417998);})[_0xf0df('0x23')](function(_0x3bcd03){_0x46a16d=_0x3bcd03;return getEndUser(_0x4345b5,_0x538848,_0xec022f[_0xf0df('0x69')],_0xec022f['calleridnum'],_0x417998);})[_0xf0df('0x23')](function(_0x5bd3a4){_0x5e4b0b=_0x5bd3a4;return getTicket(_0x4345b5,_0x46a16d,_0x5e4b0b,_0x538848,_0xec022f,_0x538848[_0xf0df('0x6a')],_0x417998,'queue');})[_0xf0df('0x23')](function(_0x27d25c){_0x29f501=_0x27d25c;logger['info']('[QUEUE]\x20Ticket\x20%s\x20created',_0x29f501['id']);logger[_0xf0df('0x1c')](_0xf0df('0x6b'),_0x29f501['id'],_0x54427a[_0xf0df('0x55')],_0x4345b5['type']);switch(_0x4345b5['type']){case'integrationTab':emit(util[_0xf0df('0x44')](_0xf0df('0x6c'),_0x54427a[_0xf0df('0x55')]),'trigger:salesforce:display',{'recordId':_0x29f501['id']});break;case _0xf0df('0x6d'):emit(util[_0xf0df('0x44')]('user:%s',_0x54427a['name']),_0xf0df('0x6e'),{'uri':util[_0xf0df('0x44')]('%s/%s/e',_0x417998[_0xf0df('0x6f')],_0x29f501['id'])});break;default:logger[_0xf0df('0x70')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})['catch'](function(_0x595a40){logger[_0xf0df('0x70')]('[QUEUE]',_0x595a40);});};exports[_0xf0df('0x71')]=function(_0x278c20,_0x573a84,_0x4559a3,_0x30391b,_0x1080f7,_0x539c38,_0x2b370b){var _0x70b16f,_0x3af3f9,_0x5d2a5b,_0x12fb3e;_0x539c38['serverUrl']=intUtil[_0xf0df('0x60')](_0x539c38['serverUrl']);_0x539c38[_0xf0df('0x59')]=intUtil[_0xf0df('0x60')](_0x539c38[_0xf0df('0x59')]);if(_0x2b370b&&_0x2b370b[_0xf0df('0x72')]&&_0x2b370b[_0xf0df('0x72')]!==_0xf0df('0x73')){logger[_0xf0df('0x1c')](_0xf0df('0x74'),_0xf0df('0x64'));_0x573a84['recordingURL']=util[_0xf0df('0x44')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x539c38[_0xf0df('0x61')],_0x573a84[_0xf0df('0x67')],md5(_0x573a84['uniqueid']));}return getConnection(_0x539c38)[_0xf0df('0x23')](function(_0x235d5b){_0x12fb3e=_0x235d5b;return getUser(_0x539c38,_0x30391b['email'],_0x12fb3e);})[_0xf0df('0x23')](function(_0x300612){_0x70b16f=_0x300612;return getEndUser(_0x539c38,_0x4559a3,_0x573a84[_0xf0df('0x75')],_0x573a84[_0xf0df('0x76')],_0x12fb3e);})['then'](function(_0x1137b4){_0x3af3f9=_0x1137b4;return getTicket(_0x539c38,_0x70b16f,_0x3af3f9,_0x4559a3,_0x573a84,_0x4559a3[_0xf0df('0x6a')],_0x12fb3e,_0xf0df('0x71'));})[_0xf0df('0x23')](function(_0x3541cb){_0x5d2a5b=_0x3541cb;logger[_0xf0df('0x1c')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x5d2a5b['id']);logger[_0xf0df('0x1c')](_0xf0df('0x77'),_0x5d2a5b['id'],_0x30391b['name'],_0x539c38[_0xf0df('0x50')]);switch(_0x539c38[_0xf0df('0x50')]){case _0xf0df('0x78'):emit(util[_0xf0df('0x44')](_0xf0df('0x6c'),_0x30391b[_0xf0df('0x55')]),'trigger:salesforce:display',{'recordId':_0x5d2a5b['id']});break;case _0xf0df('0x6d'):emit(util[_0xf0df('0x44')](_0xf0df('0x6c'),_0x30391b[_0xf0df('0x55')]),_0xf0df('0x6e'),{'uri':util[_0xf0df('0x44')](_0xf0df('0x79'),_0x12fb3e[_0xf0df('0x6f')],_0x5d2a5b['id'])});break;default:logger[_0xf0df('0x70')]('[OUTBOUND]',_0xf0df('0x7a'));}})[_0xf0df('0x7b')](function(_0x29ecba){logger[_0xf0df('0x70')](_0xf0df('0x74'),_0x29ecba);});};exports[_0xf0df('0x7c')]=function(_0x4774d9,_0x36796d,_0x189026,_0x1c3692,_0x37ae12,_0x47c60c){var _0x2b4b10,_0x390edd,_0x46c40a,_0x3a546e;_0x47c60c[_0xf0df('0x61')]=intUtil[_0xf0df('0x60')](_0x47c60c[_0xf0df('0x61')]);_0x47c60c[_0xf0df('0x59')]=intUtil['stripTrailingSlash'](_0x47c60c[_0xf0df('0x59')]);if(_0x37ae12&&_0x37ae12['monitor_format']){logger[_0xf0df('0x1c')]('['+_0x36796d[_0xf0df('0x7d')][_0xf0df('0x7e')]()+']',_0xf0df('0x64'));_0x36796d[_0xf0df('0x65')]=util[_0xf0df('0x44')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x47c60c[_0xf0df('0x61')],_0x36796d[_0xf0df('0x67')],md5(_0x36796d[_0xf0df('0x67')]));}else{_0x36796d[_0xf0df('0x65')]='';}return getConnection(_0x47c60c)[_0xf0df('0x23')](function(_0x5a1730){_0x3a546e=_0x5a1730;if(!_[_0xf0df('0x1f')](_0x1c3692)){return getUser(_0x47c60c,_0x1c3692[_0xf0df('0x55')],_0x3a546e);}else{return getUser(_0x47c60c,null,_0x3a546e);}})[_0xf0df('0x23')](function(_0x3b0576){_0x2b4b10=_0x3b0576;return getEndUser(_0x47c60c,_0x189026,_0x36796d[_0xf0df('0x69')],_0x36796d[_0xf0df('0x7f')],_0x3a546e);})[_0xf0df('0x23')](function(_0x10988d){_0x390edd=_0x10988d;return getTicket(_0x47c60c,_0x2b4b10,_0x390edd,_0x189026,_0x36796d,_0x189026[_0xf0df('0x6a')],_0x3a546e);})['then'](function(_0x56ae23){_0x46c40a=_0x56ae23;logger[_0xf0df('0x1c')]('['+_0x36796d[_0xf0df('0x7d')]['toUpperCase']()+_0xf0df('0x80'),_0x46c40a['id']);logger[_0xf0df('0x1c')]('['+_0x36796d[_0xf0df('0x7d')][_0xf0df('0x7e')]()+_0xf0df('0x81'),_0x47c60c[_0xf0df('0x50')]);})[_0xf0df('0x7b')](function(_0x1421b4){logger['error']('['+_0x36796d['lastevent'][_0xf0df('0x7e')]()+']',_0x1421b4);});}; \ 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 16f3359..c427a6a 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 _0x40a9=['./util','../../../../config/environment','../../../../config/logger','servicenow','defaults','redis','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','then','length','adminId','result','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId',']\x20using\x20admin\x20profile','adminEmail','sys_user?','endUserNumber','user','System','endUserId','GET','],\x20createEndUser\x20crm','forEach','includes','string','type','nameField','customField','toLowerCase','content','picklist','idField','toString','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','POST','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','label_entry','Incident','Incident\x20-\x20','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','all','Tags','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','bluebird','request-promise','util','md5','ioredis'];(function(_0x20bc53,_0x3a8ec3){var _0x14a742=function(_0x502024){while(--_0x502024){_0x20bc53['push'](_0x20bc53['shift']());}};_0x14a742(++_0x3a8ec3);}(_0x40a9,0xd9));var _0x940a=function(_0x536ea,_0x516dfd){_0x536ea=_0x536ea-0x0;var _0x296d35=_0x40a9[_0x536ea];return _0x296d35;};'use strict';var _=require('lodash');var Promise=require(_0x940a('0x0'));var rp=require(_0x940a('0x1'));var util=require(_0x940a('0x2'));var md5=require(_0x940a('0x3'));var Redis=require(_0x940a('0x4'));var intUtil=require(_0x940a('0x5'));var config=require(_0x940a('0x6'));var logger=require(_0x940a('0x7'))(_0x940a('0x8'));config['redis']=_[_0x940a('0x9')](config[_0x940a('0xa')],{'host':_0x940a('0xb'),'port':0x18eb});var io=require(_0x940a('0xc'))(new Redis(config[_0x940a('0xa')]));function getAdminUser(_0x2223b8,_0x430783,_0x2b47ff,_0x4f289f,_0xc4cce8,_0x243360){return new Promise(function(_0x4d8ebc,_0x1f5c61){var _0x32d36d={'method':'GET','uri':_0x4f289f+_0x940a('0xd')+'&'+_0xc4cce8+'&'+_0x243360,'auth':_0x430783,'json':!![]};return rp(_0x32d36d)[_0x940a('0xe')](function(_0x2ebf27){if(_0x2ebf27['result'][_0x940a('0xf')]>0x0){_0x2b47ff[_0x940a('0x10')]=_0x2ebf27[_0x940a('0x11')][0x0][_0x940a('0x12')];}logger[_0x940a('0x13')]('['+[_0x2223b8[_0x940a('0x14')]()]+_0x940a('0x15'),_0x2b47ff);_0x4d8ebc(_0x2b47ff);})[_0x940a('0x16')](function(_0x4a5408){logger[_0x940a('0x17')]('['+[_0x2223b8[_0x940a('0x14')]()]+']',_0x4a5408[_0x940a('0x18')]);_0x1f5c61(_0x4a5408[_0x940a('0x18')]);});});}function getUser(_0x143467,_0x315962,_0x555711,_0xcc75e,_0xffc2cd){return function(_0xcef5f6){logger[_0x940a('0x13')]('['+[_0x143467['toUpperCase']()]+_0x940a('0x19'),_0xcef5f6);return new Promise(function(_0x1a79f4,_0x5b300c){if(intUtil[_0x940a('0x1a')](_0xcef5f6[_0x940a('0x1b')])){var _0x43c5ec={'method':'GET','uri':_0x555711+_0x940a('0x1c')+_0xcef5f6[_0x940a('0x1b')]+'&'+_0xcc75e+'&'+_0xffc2cd,'auth':_0x315962,'json':!![]};logger[_0x940a('0x13')]('['+[_0x143467['toUpperCase']()]+_0x940a('0x1d'),_0x43c5ec);return rp(_0x43c5ec)[_0x940a('0xe')](function(_0x51a945){logger['info']('['+[_0x143467[_0x940a('0x14')]()]+_0x940a('0x1e'),_0x51a945);if(_0x51a945[_0x940a('0x11')][_0x940a('0xf')]>0x0&&String(_0x51a945[_0x940a('0x11')][0x0][_0x940a('0x1f')])===_0x940a('0x20')){_0xcef5f6[_0x940a('0x21')]=_0x51a945[_0x940a('0x11')][0x0][_0x940a('0x12')];}else{_0xcef5f6[_0x940a('0x21')]=_0xcef5f6[_0x940a('0x10')];_0xcef5f6[_0x940a('0x1b')]=_0xcef5f6['adminEmail'];}logger[_0x940a('0x13')]('['+[_0x143467[_0x940a('0x14')]()]+'],\x20getUser\x20crm',_0xcef5f6);_0x1a79f4(_0xcef5f6);})['catch'](function(_0x326a43){logger['error']('['+[_0x143467[_0x940a('0x14')]()]+']',_0x326a43['message']);_0x5b300c(_0x326a43[_0x940a('0x18')]);});}else{logger['info']('['+[_0x143467[_0x940a('0x14')]()]+_0x940a('0x22'));_0xcef5f6['userId']=_0xcef5f6[_0x940a('0x10')];_0xcef5f6[_0x940a('0x1b')]=_0xcef5f6[_0x940a('0x23')];_0x1a79f4(_0xcef5f6);}});};}function createEndUser(_0x359b87,_0x177a72,_0x3fc20b,_0xb37492,_0x36f09d){logger['info']('['+[_0x359b87[_0x940a('0x14')]()]+'],\x20createEndUser\x20input\x20crm',_0x3fc20b);return new Promise(function(_0x1dc963,_0x2ae924){var _0x4ab80c={'method':'POST','uri':_0xb37492+_0x940a('0x24')+_0x36f09d,'body':{'user_name':_0x3fc20b[_0x940a('0x25')],'roles':_0x940a('0x26'),'first_name':_0x3fc20b['endUserNumber'],'active':'true','date_format':_0x940a('0x27'),'phone':_0x3fc20b[_0x940a('0x25')]},'auth':_0x177a72,'json':!![]};return rp(_0x4ab80c)['then'](function(_0x156aa7){logger[_0x940a('0x13')]('['+[_0x359b87[_0x940a('0x14')]()]+'],\x20EndUser\x20schema',_0x156aa7['result']);_0x3fc20b[_0x940a('0x28')]=_0x156aa7[_0x940a('0x11')][_0x940a('0x12')];_0x1dc963(_0x3fc20b);})[_0x940a('0x16')](function(_0x2536ca){logger[_0x940a('0x17')]('['+[_0x359b87[_0x940a('0x14')]()]+']',_0x2536ca[_0x940a('0x18')]);_0x2ae924(_0x2536ca[_0x940a('0x18')]);});});}function getEndUser(_0x2a2c65,_0x4c7386,_0x8c9f9e,_0x4af899,_0x27d532){return function(_0x53192a){logger[_0x940a('0x13')]('['+[_0x2a2c65[_0x940a('0x14')]()]+'],\x20getEndUser\x20input\x20crm',_0x53192a);return new Promise(function(_0x132ca9,_0x578cb4){var _0x1c1c8c={'method':_0x940a('0x29'),'uri':_0x8c9f9e+'sys_user?sysparm_query=phone%3D'+_0x53192a['endUserNumber']+'&'+_0x4af899+'&'+_0x27d532,'auth':_0x4c7386,'json':!![]};return rp(_0x1c1c8c)['then'](function(_0x27631e){if(_0x27631e[_0x940a('0x11')]['length']>0x0){_0x53192a[_0x940a('0x28')]=_0x27631e[_0x940a('0x11')][0x0][_0x940a('0x12')];logger['info']('['+[_0x2a2c65[_0x940a('0x14')]()]+'],\x20getEndUser\x20crm',_0x53192a);_0x132ca9(_0x53192a);}else{return createEndUser(_0x2a2c65,_0x4c7386,_0x53192a,_0x8c9f9e,_0x4af899)[_0x940a('0xe')](function(_0xfc877f){logger['info']('['+[_0x2a2c65['toUpperCase']()]+_0x940a('0x2a'),_0xfc877f);_0x132ca9(_0xfc877f);});}})[_0x940a('0x16')](function(_0x4294aa){logger[_0x940a('0x17')]('['+[_0x2a2c65[_0x940a('0x14')]()]+']',_0x4294aa['message']);_0x578cb4(_0x4294aa[_0x940a('0x18')]);});});};}function getCustomFields(_0x3cf01f,_0x386e7e){var _0x4941df={};if(_0x3cf01f[_0x940a('0xf')]>0x0){_[_0x940a('0x2b')](_0x3cf01f,function(_0x585ad6){if(_[_0x940a('0x2c')]([_0x940a('0x2d'),'picklist'],_0x585ad6[_0x940a('0x2e')])&&_0x585ad6[_0x940a('0x2f')]&&!_0x585ad6[_0x940a('0x30')]){_0x4941df[_0x585ad6[_0x940a('0x2f')][_0x940a('0x31')]()]=_0x585ad6[_0x940a('0x32')]['toString']();}else if(_['includes'](['string',_0x940a('0x33')],_0x585ad6[_0x940a('0x2e')])&&_0x585ad6[_0x940a('0x34')]&&_0x585ad6[_0x940a('0x30')]){_0x4941df[_0x585ad6[_0x940a('0x34')][_0x940a('0x31')]()]=_0x585ad6[_0x940a('0x32')][_0x940a('0x35')]();}else if(_0x585ad6[_0x940a('0x2e')]===_0x940a('0x36')&&_0x585ad6[_0x940a('0x37')]&&_0x585ad6[_0x940a('0x34')]&&_0x585ad6['customField']){_0x4941df[_0x585ad6[_0x940a('0x34')][_0x940a('0x31')]()]=_0x386e7e[_0x585ad6[_0x940a('0x37')]]['toString']();}else if(_0x585ad6[_0x940a('0x2e')]===_0x940a('0x38')&&_0x585ad6['Variable']&&_0x585ad6[_0x940a('0x39')]['name']&&_0x585ad6[_0x940a('0x34')]&&_0x585ad6[_0x940a('0x30')]){_0x4941df[_0x585ad6['idField'][_0x940a('0x31')]()]=_0x386e7e[_0x585ad6[_0x940a('0x39')][_0x940a('0x3a')][_0x940a('0x31')]()][_0x940a('0x35')]();}});}return _0x4941df;}function getTicket(_0x371c18,_0x3f3cbf,_0x286ce7,_0x7f00e8,_0x112e8f,_0x1728f9){return function(_0x4248d6){logger[_0x940a('0x13')]('['+[_0x371c18['toUpperCase']()]+_0x940a('0x3b'),_0x4248d6);return new Promise(function(_0x12dfd0,_0x2d4416){var _0x286201=_0x371c18[_0x940a('0x31')]()===_0x940a('0x3c')?_0x4248d6[_0x940a('0x21')]:_0x4248d6[_0x940a('0x28')];var _0x2c8986={'method':_0x940a('0x3d'),'uri':_0x286ce7+'incident'+'?'+_0x1728f9,'body':Object[_0x940a('0x3e')]({},{'active':_0x940a('0x20'),'caller_id':_0x286201,'assigned_to':_0x4248d6[_0x940a('0x21')],'short_description':intUtil[_0x940a('0x3f')](_0x7f00e8[_0x940a('0x40')],_0x112e8f,'\x20'),'description':intUtil['getString'](_0x7f00e8[_0x940a('0x41')],_0x112e8f,'\x0a')},getCustomFields(_0x7f00e8[_0x940a('0x42')],_0x112e8f)),'auth':_0x3f3cbf,'json':!![]};return rp(_0x2c8986)[_0x940a('0xe')](function(_0x274e8b){logger['info']('['+[_0x371c18[_0x940a('0x14')]()]+_0x940a('0x43'),_0x274e8b[_0x940a('0x11')]);_0x4248d6[_0x940a('0x44')]=_0x274e8b[_0x940a('0x11')][_0x940a('0x12')];_0x4248d6[_0x940a('0x45')]=_0x274e8b[_0x940a('0x11')][_0x940a('0x46')];logger['info']('['+[_0x371c18[_0x940a('0x14')]()]+_0x940a('0x47'),_0x4248d6);_0x12dfd0(_0x4248d6);})[_0x940a('0x16')](function(_0x10f940){logger[_0x940a('0x17')]('['+[_0x371c18[_0x940a('0x14')]()]+']',_0x10f940[_0x940a('0x18')]);_0x2d4416(_0x10f940[_0x940a('0x18')]);});});};}function createRemoteTag(_0x3d8c71,_0x45bb45,_0xc95e41,_0x4dff49){return new Promise(function(_0x1b2fbe,_0x38113b){var _0x1aca28={'method':_0x940a('0x3d'),'uri':_0xc95e41+_0x940a('0x48')+'?'+_0x4dff49,'body':{'short_description':_0x3d8c71,'global':!![],'active':!![],'name':_0x3d8c71},'auth':_0x45bb45,'json':!![]};return rp(_0x1aca28)[_0x940a('0xe')](function(_0x4e0b97){var _0x2e0ea3=_0x4e0b97['result'][_0x940a('0x12')];_0x1b2fbe(_0x2e0ea3);});});}function getRemoteTag(_0x5bb996,_0x362d32,_0x2f62dc,_0x2c0f8b,_0x547458){return new Promise(function(_0x33454b,_0x15cf1d){var _0x5378f6={'method':_0x940a('0x29'),'uri':_0x2f62dc+'label'+'?sysparm_query=name%3D'+_0x5bb996+'&'+_0x2c0f8b,'auth':_0x362d32,'json':!![]};return rp(_0x5378f6)['then'](function(_0x4edd1c){if(_0x4edd1c[_0x940a('0x11')][_0x940a('0xf')]>0x0){var _0x5d479f=_0x4edd1c[_0x940a('0x11')][0x0][_0x940a('0x12')];_0x33454b(_0x5d479f);}else{return createRemoteTag(_0x5bb996,_0x362d32,_0x2f62dc,_0x2c0f8b)[_0x940a('0xe')](function(_0x36a9f0){_0x33454b(_0x36a9f0);});}});});}function assignTagToIncident(_0x4d4115,_0x464f70,_0x48126d,_0x65be7,_0x13125d){return new Promise(function(_0x391f62,_0x207acd){var _0x13c4ad={'method':_0x940a('0x3d'),'uri':_0x48126d+_0x940a('0x49')+'?'+_0x13125d,'body':{'label':_0x4d4115,'table':'incident','id_type':_0x940a('0x4a'),'table_key':_0x65be7[_0x940a('0x44')],'title':_0x940a('0x4b')+_0x65be7['ticketNumber'],'id_display':_0x65be7[_0x940a('0x45')]},'auth':_0x464f70,'json':!![]};return rp(_0x13c4ad)[_0x940a('0xe')](function(_0x424cbc){_0x391f62();})[_0x940a('0x16')](function(){_0x391f62();});});}function manageTags(_0x1fa96f,_0x44e33d,_0x4cf092,_0x4efa0a,_0x32a849,_0x3adac0,_0x289b6f){return new Promise(function(_0x39bffc,_0x53a976){var _0x1fdc4b=[];_0x44e33d[_0x940a('0x2b')](function(_0x4e5e2c){_0x1fdc4b[_0x940a('0x4c')](getRemoteTag(_0x4e5e2c,_0x4cf092,_0x4efa0a,_0x3adac0,_0x289b6f));});return Promise['all'](_0x1fdc4b)[_0x940a('0xe')](function(_0x4fc6db){if(_0x4fc6db[_0x940a('0xf')]){logger[_0x940a('0x13')]('['+[_0x1fa96f[_0x940a('0x14')]()]+_0x940a('0x4d'),_0x4fc6db);var _0x136e79=[];_0x4fc6db[_0x940a('0x2b')](function(_0x4a500d){_0x136e79[_0x940a('0x4c')](assignTagToIncident(_0x4a500d,_0x4cf092,_0x4efa0a,_0x32a849,_0x3adac0));});return Promise[_0x940a('0x4e')](_0x136e79)[_0x940a('0xe')](function(){_0x39bffc();})[_0x940a('0x16')](function(){_0x39bffc();});}else{_0x39bffc();}});});}function getTags(_0x1c3208,_0x39bea4,_0x1f47f9,_0x515a5c,_0x384606,_0x2af111){return function(_0x33bff7){return new Promise(function(_0x4156a7,_0x18f504){var _0x319cfb=[];var _0x48978c=_0x515a5c[_0x940a('0x4f')];if(_0x48978c&&_0x48978c[_0x940a('0xf')]>0x0){_0x319cfb=_['map'](_0x48978c,'name');}if(_0x319cfb[_0x940a('0xf')]>0x0){return manageTags(_0x1c3208,_0x319cfb,_0x39bea4,_0x1f47f9,_0x33bff7,_0x384606,_0x2af111)[_0x940a('0xe')](function(){_0x4156a7(_0x33bff7);});}else{_0x4156a7(_0x33bff7);}});};}function emit(_0x4d22bd,_0x1f25a5,_0x30638b){var _0x5853e2='%26sysparm_record_target%3Dincident'+_0x940a('0x50')+'%26sysparm_record_list%3Dactive%253Dtrue'+'%255EORDERBYDESCnumber';var _0x19adc8={'uri':_0x4d22bd+_0x940a('0x51')+_0x30638b+_0x5853e2};io['to'](util[_0x940a('0x52')](_0x940a('0x53'),_0x1f25a5))[_0x940a('0x54')](_0x940a('0x55'),_0x19adc8);}exports['cs']=function(_0x35933a,_0x381ede,_0x2251cf,_0x7af817,_0x9b3521,_0x5e90ed,_0x370e61,_0x16bd3d){var _0xe6ea30={};var _0x1d622f={'user':_0x5e90ed[_0x940a('0x56')],'pass':_0x5e90ed[_0x940a('0x57')]};var _0x2c2be8='sysparm_limit=1';var _0xf68de7=_0x940a('0x58');_0x5e90ed[_0x940a('0x59')]=intUtil[_0x940a('0x5a')](_0x5e90ed['remoteUri']);_0x5e90ed[_0x940a('0x5b')]=intUtil[_0x940a('0x5a')](_0x5e90ed[_0x940a('0x5b')]);var _0x456b04=util['format'](_0x940a('0x5c'),_0x5e90ed[_0x940a('0x59')]);_0xe6ea30[_0x940a('0x1b')]=!_[_0x940a('0x5d')](_0x7af817)?_0x7af817[_0x940a('0x5e')]:null;_0xe6ea30['adminEmail']=_0x5e90ed[_0x940a('0x5e')];_0xe6ea30[_0x940a('0x25')]=_0x16bd3d[_0x940a('0x31')]()===_0x940a('0x3c')?_0x381ede[_0x940a('0x5f')]:_0x381ede[_0x940a('0x60')];_0xe6ea30[_0x940a('0x61')]=_0x16bd3d==='queue'||_0x16bd3d===_0x940a('0x62')?_0x940a('0x63'):_0x940a('0x3c');var _0x2c57a4=util[_0x940a('0x52')](_0x940a('0x64'),_0x5e90ed[_0x940a('0x5b')],_0x381ede[_0x940a('0x65')],md5(_0x381ede[_0x940a('0x65')]));if(_0x9b3521&&_0x9b3521[_0x940a('0x66')]){logger[_0x940a('0x13')](_0x940a('0x67'),_0x940a('0x68'));_0x381ede[_0x940a('0x69')]=_0x2c57a4;}else if(_0x370e61&&_0x370e61['recordingFormat']&&_0x370e61[_0x940a('0x6a')]!=='none'){logger['info'](_0x940a('0x6b'),'Recording\x20is\x20enabled!');_0x381ede[_0x940a('0x69')]=_0x2c57a4;}else{_0x381ede[_0x940a('0x69')]='';}return getAdminUser(_0x16bd3d,_0x1d622f,_0xe6ea30,_0x456b04,_0xf68de7,_0x2c2be8)[_0x940a('0xe')](getUser(_0x16bd3d,_0x1d622f,_0x456b04,_0xf68de7,_0x2c2be8))[_0x940a('0xe')](getEndUser(_0x16bd3d,_0x1d622f,_0x456b04,_0xf68de7,_0x2c2be8))[_0x940a('0xe')](getTicket(_0x16bd3d,_0x1d622f,_0x456b04,_0x2251cf,_0x381ede,_0xf68de7))['then'](function(_0x4afc4d){logger[_0x940a('0x13')](util['format'](_0x940a('0x6c'),_0x4afc4d[_0x940a('0x44')]));logger[_0x940a('0x13')](util[_0x940a('0x52')]('call\x20direction:\x20%s',_0x16bd3d));if(_0x16bd3d!==_0x940a('0x62')){logger[_0x940a('0x13')]('['+[_0x16bd3d[_0x940a('0x14')]()]+']',_0x940a('0x6d'));emit(_0x5e90ed[_0x940a('0x59')],_0x7af817['name'],_0x4afc4d['ticketId']);}})[_0x940a('0x16')](function(_0x3aa08e){logger[_0x940a('0x17')]('['+[_0x16bd3d[_0x940a('0x14')]()]+_0x940a('0x6e'),util['inspect'](_0x3aa08e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x6cda=['unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','bluebird','request-promise','util','md5','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','sys_id','info','],\x20getAdminUser\x20crm','catch','error','toUpperCase','message','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','active','true','adminEmail','userId','POST','sys_user?','System','],\x20EndUser\x20schema','endUserId','sys_user?sysparm_query=phone%3D','endUserNumber','],\x20getEndUser\x20crm','forEach','includes','string','picklist','type','nameField','customField','content','toString','idField','toLowerCase','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','Subjects','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection'];(function(_0x365b01,_0x4d1cb4){var _0x4235f5=function(_0x5927db){while(--_0x5927db){_0x365b01['push'](_0x365b01['shift']());}};_0x4235f5(++_0x4d1cb4);}(_0x6cda,0x151));var _0xa6cd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6cda[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var Promise=require(_0xa6cd('0x0'));var rp=require(_0xa6cd('0x1'));var util=require(_0xa6cd('0x2'));var md5=require(_0xa6cd('0x3'));var Redis=require('ioredis');var intUtil=require(_0xa6cd('0x4'));var config=require(_0xa6cd('0x5'));var logger=require(_0xa6cd('0x6'))(_0xa6cd('0x7'));config[_0xa6cd('0x8')]=_[_0xa6cd('0x9')](config['redis'],{'host':_0xa6cd('0xa'),'port':0x18eb});var io=require(_0xa6cd('0xb'))(new Redis(config['redis']));function getAdminUser(_0x359c1a,_0x1fddf0,_0x1389b0,_0x2ada0f,_0x429f8c,_0x9da37a){return new Promise(function(_0x1e1188,_0x179e10){var _0x46c056={'method':_0xa6cd('0xc'),'uri':_0x2ada0f+_0xa6cd('0xd')+'&'+_0x429f8c+'&'+_0x9da37a,'auth':_0x1fddf0,'json':!![]};return rp(_0x46c056)[_0xa6cd('0xe')](function(_0x5de242){if(_0x5de242[_0xa6cd('0xf')]['length']>0x0){_0x1389b0[_0xa6cd('0x10')]=_0x5de242[_0xa6cd('0xf')][0x0][_0xa6cd('0x11')];}logger[_0xa6cd('0x12')]('['+[_0x359c1a['toUpperCase']()]+_0xa6cd('0x13'),_0x1389b0);_0x1e1188(_0x1389b0);})[_0xa6cd('0x14')](function(_0x3312e0){logger[_0xa6cd('0x15')]('['+[_0x359c1a[_0xa6cd('0x16')]()]+']',_0x3312e0[_0xa6cd('0x17')]);_0x179e10(_0x3312e0[_0xa6cd('0x17')]);});});}function getUser(_0xfa2ceb,_0x885b97,_0x1b8fd1,_0x25eaee,_0x105e6d){return function(_0x351a2f){logger[_0xa6cd('0x12')]('['+[_0xfa2ceb[_0xa6cd('0x16')]()]+'],\x20getUser\x20input\x20crm',_0x351a2f);return new Promise(function(_0x7cb4af,_0xe3769a){if(intUtil[_0xa6cd('0x18')](_0x351a2f[_0xa6cd('0x19')])){var _0x89163f={'method':_0xa6cd('0xc'),'uri':_0x1b8fd1+_0xa6cd('0x1a')+_0x351a2f[_0xa6cd('0x19')]+'&'+_0x25eaee+'&'+_0x105e6d,'auth':_0x885b97,'json':!![]};logger['info']('['+[_0xfa2ceb[_0xa6cd('0x16')]()]+_0xa6cd('0x1b'),_0x89163f);return rp(_0x89163f)['then'](function(_0x2c9d81){logger['info']('['+[_0xfa2ceb['toUpperCase']()]+_0xa6cd('0x1c'),_0x2c9d81);if(_0x2c9d81[_0xa6cd('0xf')][_0xa6cd('0x1d')]>0x0&&String(_0x2c9d81[_0xa6cd('0xf')][0x0][_0xa6cd('0x1e')])===_0xa6cd('0x1f')){_0x351a2f['userId']=_0x2c9d81['result'][0x0][_0xa6cd('0x11')];}else{_0x351a2f['userId']=_0x351a2f[_0xa6cd('0x10')];_0x351a2f[_0xa6cd('0x19')]=_0x351a2f[_0xa6cd('0x20')];}logger[_0xa6cd('0x12')]('['+[_0xfa2ceb[_0xa6cd('0x16')]()]+'],\x20getUser\x20crm',_0x351a2f);_0x7cb4af(_0x351a2f);})[_0xa6cd('0x14')](function(_0xb9158c){logger[_0xa6cd('0x15')]('['+[_0xfa2ceb['toUpperCase']()]+']',_0xb9158c[_0xa6cd('0x17')]);_0xe3769a(_0xb9158c['message']);});}else{logger[_0xa6cd('0x12')]('['+[_0xfa2ceb[_0xa6cd('0x16')]()]+']\x20using\x20admin\x20profile');_0x351a2f[_0xa6cd('0x21')]=_0x351a2f[_0xa6cd('0x10')];_0x351a2f[_0xa6cd('0x19')]=_0x351a2f[_0xa6cd('0x20')];_0x7cb4af(_0x351a2f);}});};}function createEndUser(_0x352ecb,_0x4aafbc,_0x2f1d12,_0x493f65,_0x5ed0a2){logger[_0xa6cd('0x12')]('['+[_0x352ecb[_0xa6cd('0x16')]()]+'],\x20createEndUser\x20input\x20crm',_0x2f1d12);return new Promise(function(_0x5f4b9f,_0x205e64){var _0x4e366f={'method':_0xa6cd('0x22'),'uri':_0x493f65+_0xa6cd('0x23')+_0x5ed0a2,'body':{'user_name':_0x2f1d12['endUserNumber'],'roles':'user','first_name':_0x2f1d12['endUserNumber'],'active':_0xa6cd('0x1f'),'date_format':_0xa6cd('0x24'),'phone':_0x2f1d12['endUserNumber']},'auth':_0x4aafbc,'json':!![]};return rp(_0x4e366f)[_0xa6cd('0xe')](function(_0x2ec904){logger[_0xa6cd('0x12')]('['+[_0x352ecb[_0xa6cd('0x16')]()]+_0xa6cd('0x25'),_0x2ec904['result']);_0x2f1d12[_0xa6cd('0x26')]=_0x2ec904[_0xa6cd('0xf')]['sys_id'];_0x5f4b9f(_0x2f1d12);})[_0xa6cd('0x14')](function(_0x4ec462){logger['error']('['+[_0x352ecb[_0xa6cd('0x16')]()]+']',_0x4ec462['message']);_0x205e64(_0x4ec462['message']);});});}function getEndUser(_0x4b3999,_0x58969e,_0x28bc65,_0x5e5a8d,_0x18d329){return function(_0x3f9527){logger['info']('['+[_0x4b3999[_0xa6cd('0x16')]()]+'],\x20getEndUser\x20input\x20crm',_0x3f9527);return new Promise(function(_0x33ee47,_0x2bda27){var _0x244e18={'method':_0xa6cd('0xc'),'uri':_0x28bc65+_0xa6cd('0x27')+_0x3f9527[_0xa6cd('0x28')]+'&'+_0x5e5a8d+'&'+_0x18d329,'auth':_0x58969e,'json':!![]};return rp(_0x244e18)[_0xa6cd('0xe')](function(_0x41fa86){if(_0x41fa86[_0xa6cd('0xf')][_0xa6cd('0x1d')]>0x0){_0x3f9527[_0xa6cd('0x26')]=_0x41fa86['result'][0x0][_0xa6cd('0x11')];logger[_0xa6cd('0x12')]('['+[_0x4b3999[_0xa6cd('0x16')]()]+_0xa6cd('0x29'),_0x3f9527);_0x33ee47(_0x3f9527);}else{return createEndUser(_0x4b3999,_0x58969e,_0x3f9527,_0x28bc65,_0x5e5a8d)[_0xa6cd('0xe')](function(_0x19f39d){logger[_0xa6cd('0x12')]('['+[_0x4b3999[_0xa6cd('0x16')]()]+'],\x20createEndUser\x20crm',_0x19f39d);_0x33ee47(_0x19f39d);});}})['catch'](function(_0x2d6403){logger[_0xa6cd('0x15')]('['+[_0x4b3999['toUpperCase']()]+']',_0x2d6403[_0xa6cd('0x17')]);_0x2bda27(_0x2d6403[_0xa6cd('0x17')]);});});};}function getCustomFields(_0x4ca04c,_0x379805){var _0x2eee1d={};if(_0x4ca04c[_0xa6cd('0x1d')]>0x0){_[_0xa6cd('0x2a')](_0x4ca04c,function(_0x240323){if(_[_0xa6cd('0x2b')]([_0xa6cd('0x2c'),_0xa6cd('0x2d')],_0x240323[_0xa6cd('0x2e')])&&_0x240323[_0xa6cd('0x2f')]&&!_0x240323[_0xa6cd('0x30')]){_0x2eee1d[_0x240323[_0xa6cd('0x2f')]['toLowerCase']()]=_0x240323[_0xa6cd('0x31')][_0xa6cd('0x32')]();}else if(_[_0xa6cd('0x2b')]([_0xa6cd('0x2c'),_0xa6cd('0x2d')],_0x240323[_0xa6cd('0x2e')])&&_0x240323[_0xa6cd('0x33')]&&_0x240323[_0xa6cd('0x30')]){_0x2eee1d[_0x240323['idField'][_0xa6cd('0x34')]()]=_0x240323['content']['toString']();}else if(_0x240323[_0xa6cd('0x2e')]==='variable'&&_0x240323[_0xa6cd('0x35')]&&_0x240323[_0xa6cd('0x33')]&&_0x240323['customField']){_0x2eee1d[_0x240323[_0xa6cd('0x33')][_0xa6cd('0x34')]()]=_0x379805[_0x240323[_0xa6cd('0x35')]][_0xa6cd('0x32')]();}else if(_0x240323['type']===_0xa6cd('0x36')&&_0x240323[_0xa6cd('0x37')]&&_0x240323[_0xa6cd('0x37')][_0xa6cd('0x38')]&&_0x240323[_0xa6cd('0x33')]&&_0x240323[_0xa6cd('0x30')]){_0x2eee1d[_0x240323[_0xa6cd('0x33')][_0xa6cd('0x34')]()]=_0x379805[_0x240323['Variable']['name']['toLowerCase']()][_0xa6cd('0x32')]();}});}return _0x2eee1d;}function getTicket(_0x5bfb34,_0x4909c2,_0x5c6ba8,_0x19d3c0,_0x5973,_0x4bc839){return function(_0x2d7b78){logger['info']('['+[_0x5bfb34[_0xa6cd('0x16')]()]+_0xa6cd('0x39'),_0x2d7b78);return new Promise(function(_0x4e28fc,_0x36a72f){var _0x25e8f3=_0x5bfb34['toLowerCase']()===_0xa6cd('0x3a')?_0x2d7b78[_0xa6cd('0x21')]:_0x2d7b78[_0xa6cd('0x26')];var _0x4d71ad={'method':_0xa6cd('0x22'),'uri':_0x5c6ba8+'incident'+'?'+_0x4bc839,'body':Object['assign']({},{'active':_0xa6cd('0x1f'),'caller_id':_0x25e8f3,'assigned_to':_0x2d7b78[_0xa6cd('0x21')],'short_description':intUtil['getString'](_0x19d3c0[_0xa6cd('0x3b')],_0x5973,'\x20'),'description':intUtil[_0xa6cd('0x3c')](_0x19d3c0[_0xa6cd('0x3d')],_0x5973,'\x0a')},getCustomFields(_0x19d3c0[_0xa6cd('0x3e')],_0x5973)),'auth':_0x4909c2,'json':!![]};return rp(_0x4d71ad)[_0xa6cd('0xe')](function(_0x36518a){logger[_0xa6cd('0x12')]('['+[_0x5bfb34['toUpperCase']()]+_0xa6cd('0x3f'),_0x36518a[_0xa6cd('0xf')]);_0x2d7b78[_0xa6cd('0x40')]=_0x36518a[_0xa6cd('0xf')][_0xa6cd('0x11')];_0x2d7b78[_0xa6cd('0x41')]=_0x36518a['result'][_0xa6cd('0x42')];logger['info']('['+[_0x5bfb34[_0xa6cd('0x16')]()]+_0xa6cd('0x43'),_0x2d7b78);_0x4e28fc(_0x2d7b78);})[_0xa6cd('0x14')](function(_0x387c79){logger[_0xa6cd('0x15')]('['+[_0x5bfb34['toUpperCase']()]+']',_0x387c79[_0xa6cd('0x17')]);_0x36a72f(_0x387c79[_0xa6cd('0x17')]);});});};}function createRemoteTag(_0x1fd16a,_0x47d40f,_0x2d2189,_0x34e775){return new Promise(function(_0x33fdbf,_0x38c298){var _0x289aed={'method':'POST','uri':_0x2d2189+_0xa6cd('0x44')+'?'+_0x34e775,'body':{'short_description':_0x1fd16a,'global':!![],'active':!![],'name':_0x1fd16a},'auth':_0x47d40f,'json':!![]};return rp(_0x289aed)[_0xa6cd('0xe')](function(_0x17d784){var _0x41b172=_0x17d784[_0xa6cd('0xf')][_0xa6cd('0x11')];_0x33fdbf(_0x41b172);});});}function getRemoteTag(_0x4a6230,_0x4ae54b,_0x3fe771,_0x53e821,_0x1e1bca){return new Promise(function(_0x18e845,_0x548e33){var _0x154d0c={'method':_0xa6cd('0xc'),'uri':_0x3fe771+'label'+_0xa6cd('0x45')+_0x4a6230+'&'+_0x53e821,'auth':_0x4ae54b,'json':!![]};return rp(_0x154d0c)[_0xa6cd('0xe')](function(_0x2969ff){if(_0x2969ff[_0xa6cd('0xf')][_0xa6cd('0x1d')]>0x0){var _0x79754a=_0x2969ff['result'][0x0][_0xa6cd('0x11')];_0x18e845(_0x79754a);}else{return createRemoteTag(_0x4a6230,_0x4ae54b,_0x3fe771,_0x53e821)[_0xa6cd('0xe')](function(_0x21b797){_0x18e845(_0x21b797);});}});});}function assignTagToIncident(_0x11e1ae,_0x2735fa,_0x4ba59e,_0x1e16ae,_0x974089){return new Promise(function(_0x1444a9,_0x1826a6){var _0x334d2e={'method':'POST','uri':_0x4ba59e+_0xa6cd('0x46')+'?'+_0x974089,'body':{'label':_0x11e1ae,'table':'incident','id_type':'Incident','table_key':_0x1e16ae['ticketId'],'title':_0xa6cd('0x47')+_0x1e16ae[_0xa6cd('0x41')],'id_display':_0x1e16ae['ticketNumber']},'auth':_0x2735fa,'json':!![]};return rp(_0x334d2e)['then'](function(_0x2e79d2){_0x1444a9();})[_0xa6cd('0x14')](function(){_0x1444a9();});});}function manageTags(_0x281194,_0x247fdc,_0x529670,_0x135a3b,_0x315800,_0x9b674b,_0xd3b12f){return new Promise(function(_0x4aa59f,_0x418a9f){var _0x103cb6=[];_0x247fdc[_0xa6cd('0x2a')](function(_0x1e0a8a){_0x103cb6[_0xa6cd('0x48')](getRemoteTag(_0x1e0a8a,_0x529670,_0x135a3b,_0x9b674b,_0xd3b12f));});return Promise[_0xa6cd('0x49')](_0x103cb6)['then'](function(_0x4b616c){if(_0x4b616c[_0xa6cd('0x1d')]){logger[_0xa6cd('0x12')]('['+[_0x281194[_0xa6cd('0x16')]()]+_0xa6cd('0x4a'),_0x4b616c);var _0x415385=[];_0x4b616c[_0xa6cd('0x2a')](function(_0x1c7736){_0x415385[_0xa6cd('0x48')](assignTagToIncident(_0x1c7736,_0x529670,_0x135a3b,_0x315800,_0x9b674b));});return Promise[_0xa6cd('0x49')](_0x415385)[_0xa6cd('0xe')](function(){_0x4aa59f();})[_0xa6cd('0x14')](function(){_0x4aa59f();});}else{_0x4aa59f();}});});}function getTags(_0xdbd92,_0x38d4d6,_0x1ff067,_0x1f2103,_0x20bb41,_0x26f9e4){return function(_0x2b42c7){return new Promise(function(_0x2434ff,_0xfcec77){var _0x30c65a=[];var _0x6cd21a=_0x1f2103[_0xa6cd('0x4b')];if(_0x6cd21a&&_0x6cd21a[_0xa6cd('0x1d')]>0x0){_0x30c65a=_['map'](_0x6cd21a,_0xa6cd('0x38'));}if(_0x30c65a[_0xa6cd('0x1d')]>0x0){return manageTags(_0xdbd92,_0x30c65a,_0x38d4d6,_0x1ff067,_0x2b42c7,_0x20bb41,_0x26f9e4)[_0xa6cd('0xe')](function(){_0x2434ff(_0x2b42c7);});}else{_0x2434ff(_0x2b42c7);}});};}function emit(_0x334331,_0x2564a6,_0x5d685c){var _0x1f4d04='%26sysparm_record_target%3Dincident'+_0xa6cd('0x4c')+_0xa6cd('0x4d')+_0xa6cd('0x4e');var _0x205b84={'uri':_0x334331+_0xa6cd('0x4f')+_0x5d685c+_0x1f4d04};io['to'](util[_0xa6cd('0x50')](_0xa6cd('0x51'),_0x2564a6))[_0xa6cd('0x52')](_0xa6cd('0x53'),_0x205b84);}exports['cs']=function(_0x306547,_0x26901c,_0xcb2893,_0xa23dda,_0x47de80,_0x4cc773,_0x292fc2,_0x2c0327){var _0x5c6b26={};var _0x1938dc={'user':_0x4cc773[_0xa6cd('0x54')],'pass':_0x4cc773['password']};var _0x48d6f0=_0xa6cd('0x55');var _0x51d40b=_0xa6cd('0x56');_0x4cc773[_0xa6cd('0x57')]=intUtil[_0xa6cd('0x58')](_0x4cc773['remoteUri']);_0x4cc773['serverUrl']=intUtil[_0xa6cd('0x58')](_0x4cc773['serverUrl']);var _0xf5a95c=util['format'](_0xa6cd('0x59'),_0x4cc773[_0xa6cd('0x57')]);_0x5c6b26[_0xa6cd('0x19')]=!_[_0xa6cd('0x5a')](_0xa23dda)?_0xa23dda[_0xa6cd('0x5b')]:null;_0x5c6b26['adminEmail']=_0x4cc773[_0xa6cd('0x5b')];_0x5c6b26[_0xa6cd('0x28')]=_0x2c0327[_0xa6cd('0x34')]()===_0xa6cd('0x3a')?_0x26901c[_0xa6cd('0x5c')]:_0x26901c[_0xa6cd('0x5d')];_0x5c6b26[_0xa6cd('0x5e')]=_0x2c0327==='queue'||_0x2c0327===_0xa6cd('0x5f')?_0xa6cd('0x60'):'outbound';var _0x32bf65=util['format'](_0xa6cd('0x61'),_0x4cc773[_0xa6cd('0x62')],_0x26901c[_0xa6cd('0x63')],md5(_0x26901c[_0xa6cd('0x63')]));if(_0x47de80&&_0x47de80['monitor_format']){logger[_0xa6cd('0x12')](_0xa6cd('0x64'),_0xa6cd('0x65'));_0x26901c[_0xa6cd('0x66')]=_0x32bf65;}else if(_0x292fc2&&_0x292fc2[_0xa6cd('0x67')]&&_0x292fc2['recordingFormat']!==_0xa6cd('0x68')){logger[_0xa6cd('0x12')]('[OUTBOUND]',_0xa6cd('0x65'));_0x26901c['recordingURL']=_0x32bf65;}else{_0x26901c[_0xa6cd('0x66')]='';}return getAdminUser(_0x2c0327,_0x1938dc,_0x5c6b26,_0xf5a95c,_0x51d40b,_0x48d6f0)[_0xa6cd('0xe')](getUser(_0x2c0327,_0x1938dc,_0xf5a95c,_0x51d40b,_0x48d6f0))[_0xa6cd('0xe')](getEndUser(_0x2c0327,_0x1938dc,_0xf5a95c,_0x51d40b,_0x48d6f0))[_0xa6cd('0xe')](getTicket(_0x2c0327,_0x1938dc,_0xf5a95c,_0xcb2893,_0x26901c,_0x51d40b))[_0xa6cd('0xe')](function(_0x2c423d){logger[_0xa6cd('0x12')](util[_0xa6cd('0x50')](_0xa6cd('0x69'),_0x2c423d[_0xa6cd('0x40')]));logger['info'](util['format'](_0xa6cd('0x6a'),_0x2c0327));if(_0x2c0327!=='unmanaged'){logger[_0xa6cd('0x12')]('['+[_0x2c0327['toUpperCase']()]+']',_0xa6cd('0x6b'));emit(_0x4cc773[_0xa6cd('0x57')],_0xa23dda[_0xa6cd('0x38')],_0x2c423d[_0xa6cd('0x40')]);}})[_0xa6cd('0x14')](function(_0x210573){logger[_0xa6cd('0x15')]('['+[_0x2c0327[_0xa6cd('0x16')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util['inspect'](_0x210573,{'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 f9a3893..a316203 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 _0x7e00=['bluebird','md5','util','./util','../../../../config/environment','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','description','Descriptions','date_start','slice','replace','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','forEach','variableName','idField','set_entry','JSON','stringify','Calls','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','user_name','then','length','find','name_value_list','value','Agent\x20found!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','format','phone_home','entry_list','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','string','nameField','customField','toLowerCase','content','custom_fields','push','type','Variable','login','username','password','PLAIN','sessionID','set_relationship','queue','remoteUri','serverUrl','%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:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','users','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...','user:%s','trigger:browser:url','catch','error','outbound','stripTrailingSlash','uri','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Ticket\x20ID\x20is:','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','lastevent','toUpperCase','request-promise'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x7e00,0xef));var _0x07e0=function(_0x53e239,_0x2ade97){_0x53e239=_0x53e239-0x0;var _0x54ba4f=_0x7e00[_0x53e239];return _0x54ba4f;};'use strict';var _=require('lodash');var rp=require(_0x07e0('0x0'));var BPromise=require(_0x07e0('0x1'));var md5=require(_0x07e0('0x2'));var util=require(_0x07e0('0x3'));var Redis=require('ioredis');var intUtil=require(_0x07e0('0x4'));var config=require(_0x07e0('0x5'));var logger=require('../../../../config/logger')(_0x07e0('0x6'));config[_0x07e0('0x7')]=_[_0x07e0('0x8')](config[_0x07e0('0x7')],{'host':_0x07e0('0x9'),'port':0x18eb});var io=require(_0x07e0('0xa'))(new Redis(config[_0x07e0('0x7')]));var def={'method':_0x07e0('0xb'),'json':!![]};function emit(_0x251812,_0x421e8a,_0x3e31e5){io['to'](_0x251812)[_0x07e0('0xc')](_0x421e8a,_0x3e31e5);}function getTicket(_0x2c0295,_0x1b99c4,_0x214d62,_0x38d13b,_0x45fd59,_0x599bab,_0x478f42,_0x31ca0a){logger[_0x07e0('0xd')](_0x07e0('0xe'));var _0x30341d=new Date();var _0x56b0af=[{'name':_0x07e0('0xf'),'value':intUtil[_0x07e0('0x10')](_0x38d13b[_0x07e0('0x11')],_0x45fd59,'\x20')},{'name':_0x07e0('0x12'),'value':_0x1b99c4['id']},{'name':'created_by','value':_0x1b99c4['id']},{'name':_0x07e0('0x13'),'value':intUtil[_0x07e0('0x10')](_0x38d13b[_0x07e0('0x14')],_0x45fd59,'\x0a')},{'name':_0x07e0('0x15'),'value':_0x30341d['toISOString']()[_0x07e0('0x16')](0x0,0x13)[_0x07e0('0x17')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0x07e0('0x18'),'value':'15'},{'name':_0x07e0('0x19'),'value':_0x214d62['id']},{'name':_0x07e0('0x1a'),'value':_0x07e0('0x1b')},{'name':_0x07e0('0x1c'),'value':_0x214d62[_0x07e0('0xf')]},{'name':_0x07e0('0x1d'),'value':_0x31ca0a}];if(_0x599bab['length']){_[_0x07e0('0x1e')](_0x599bab,function(_0x310051){if(_0x45fd59[_0x310051[_0x07e0('0x1f')]]){_0x56b0af['push']({'name':_0x310051[_0x07e0('0x20')],'value':_0x45fd59[_0x310051[_0x07e0('0x1f')]]});}});}return request({'form':{'method':_0x07e0('0x21'),'input_type':_0x07e0('0x22'),'response_type':'JSON','rest_data':JSON[_0x07e0('0x23')]({'session':_0x478f42['id'],'module_name':_0x07e0('0x24'),'name_value_list':_0x56b0af})}});}function getAuth(_0x3fa745){return util['format'](_0x07e0('0x25'),new Buffer(_0x3fa745[_0x07e0('0x26')]+':X')[_0x07e0('0x27')](_0x07e0('0x28')));}function getServerInfo(_0x4ec7cc){return request({'form':{'method':_0x07e0('0x29'),'input_type':_0x07e0('0x22'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x4ec7cc['id']})}});}function getUser(_0x124e9f,_0x359216,_0x5f53d4){if(!_[_0x07e0('0x2a')](_0x359216)){logger[_0x07e0('0xd')]('Getting\x20agent\x20with\x20name',_0x359216);return request({'form':{'method':'get_entry_list','input_type':_0x07e0('0x22'),'response_type':_0x07e0('0x22'),'rest_data':JSON['stringify']({'session':_0x5f53d4['id'],'module_name':'Employees','query':util['format']('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x359216),'order_by':'','offset':'0','select_fields':['id','name',_0x07e0('0x2b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x07e0('0x2c')](function(_0x2c6f83){if(_0x2c6f83['entry_list'][_0x07e0('0x2d')]){var _0x3502ba=_[_0x07e0('0x2e')](_0x2c6f83['entry_list'],function(_0x224e28){return _0x224e28[_0x07e0('0x2f')][_0x07e0('0x2b')][_0x07e0('0x30')]===_0x359216;});if(_0x3502ba){logger[_0x07e0('0xd')](_0x07e0('0x31'));return BPromise['resolve']({'id':_0x3502ba['name_value_list']['id'][_0x07e0('0x30')],'name':_0x3502ba[_0x07e0('0x2f')][_0x07e0('0xf')][_0x07e0('0x30')]});}}logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x07e0('0x32')]({'id':_0x5f53d4[_0x07e0('0x2f')][_0x07e0('0x33')][_0x07e0('0x30')],'name':_0x5f53d4[_0x07e0('0x2f')][_0x07e0('0x2b')][_0x07e0('0x30')]});});}else{logger[_0x07e0('0xd')](_0x07e0('0x34'));return BPromise[_0x07e0('0x32')]({'id':_0x5f53d4[_0x07e0('0x2f')][_0x07e0('0x33')][_0x07e0('0x30')],'name':_0x5f53d4['name_value_list']['user_name'][_0x07e0('0x30')]});}}function getEndUser(_0x29f135,_0x164ba2,_0x4e4f57,_0x1b14d2){logger[_0x07e0('0xd')](_0x07e0('0x35'),_0x4e4f57);return request({'form':{'method':_0x07e0('0x36'),'input_type':'JSON','response_type':_0x07e0('0x22'),'rest_data':JSON['stringify']({'session':_0x1b14d2['id'],'module_name':_0x07e0('0x1b'),'query':util[_0x07e0('0x37')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x4e4f57),'order_by':'','offset':'0','select_fields':['id','name',_0x07e0('0x38')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x07e0('0x2c')](function(_0x2ce3ea){if(_0x2ce3ea[_0x07e0('0x39')][_0x07e0('0x2d')]){var _0x1c95a1=_[_0x07e0('0x2e')](_0x2ce3ea['entry_list'],function(_0x1f4dda){return _0x1f4dda[_0x07e0('0x2f')][_0x07e0('0x38')]['value']===_0x4e4f57;});if(_0x1c95a1){logger[_0x07e0('0xd')]('Enduser\x20found!');return BPromise[_0x07e0('0x32')]({'id':_0x1c95a1[_0x07e0('0x2f')]['id'][_0x07e0('0x30')],'name':_0x1c95a1[_0x07e0('0x2f')][_0x07e0('0xf')][_0x07e0('0x30')],'phone':_0x1c95a1[_0x07e0('0x2f')][_0x07e0('0x38')][_0x07e0('0x30')]});}}else{logger['info'](_0x07e0('0x3a'));return request({'form':{'method':_0x07e0('0x21'),'input_type':_0x07e0('0x22'),'response_type':'JSON','rest_data':JSON[_0x07e0('0x23')]({'session':_0x1b14d2['id'],'module_name':_0x07e0('0x1b'),'name_value_list':[{'name':_0x07e0('0x3b'),'value':_0x164ba2!==_0x07e0('0x3c')?_0x164ba2:util[_0x07e0('0x37')](_0x07e0('0x3d'),_0x4e4f57)},{'name':_0x07e0('0x38'),'value':_0x4e4f57}]})}})['then'](function(_0x5d3765){logger[_0x07e0('0xd')](_0x07e0('0x3e'));return BPromise[_0x07e0('0x32')]({'id':_0x5d3765['id'],'name':_0x5d3765['entry_list']['first_name'][_0x07e0('0x30')],'phone':_0x5d3765[_0x07e0('0x39')][_0x07e0('0x38')][_0x07e0('0x30')]});});}});}function request(_0x2443bf){logger[_0x07e0('0x3f')](_0x07e0('0x40'),JSON[_0x07e0('0x23')](_0x2443bf));return rp(_[_0x07e0('0x41')](def,_0x2443bf));}function getTags(_0xd4571b,_0x574f8a){var _0x2ce961=[];if(_0xd4571b&&_0xd4571b[_0x07e0('0x2d')]>0x0){_0x2ce961=_[_0x07e0('0x42')](_0xd4571b,_0x574f8a);}return _0x2ce961;}function getCustomFields(_0x192be6,_0x57f6a4){var _0x4b51bc=[];var _0x19e4eb={'custom_fields':[]};if(_0x192be6[_0x07e0('0x2d')]>0x0){_[_0x07e0('0x1e')](_0x192be6,function(_0x2d7d70){if(_0x2d7d70['type']===_0x07e0('0x43')&&_0x2d7d70[_0x07e0('0x44')]&&!_0x2d7d70[_0x07e0('0x45')]){_0x19e4eb[_0x2d7d70['nameField'][_0x07e0('0x46')]()]=_0x2d7d70[_0x07e0('0x47')][_0x07e0('0x27')]();}else if(_0x2d7d70['type']===_0x07e0('0x43')&&_0x2d7d70[_0x07e0('0x20')]&&_0x2d7d70[_0x07e0('0x45')]){_0x19e4eb[_0x07e0('0x48')][_0x07e0('0x49')]({'id':_0x2d7d70[_0x07e0('0x20')],'value':_0x2d7d70[_0x07e0('0x47')][_0x07e0('0x27')]()});}else if(_0x2d7d70[_0x07e0('0x4a')]==='variable'&&_0x2d7d70[_0x07e0('0x1f')]&&_0x2d7d70[_0x07e0('0x20')]&&_0x2d7d70[_0x07e0('0x45')]){_0x57f6a4[_0x2d7d70['variableName']]&&_0x19e4eb[_0x07e0('0x48')][_0x07e0('0x49')]({'id':_0x2d7d70[_0x07e0('0x20')],'value':_0x57f6a4[_0x2d7d70['variableName']][_0x07e0('0x27')]()});}else if(_0x2d7d70[_0x07e0('0x4a')]==='customVariable'&&_0x2d7d70[_0x07e0('0x4b')]&&_0x2d7d70[_0x07e0('0x4b')][_0x07e0('0xf')]&&_0x2d7d70[_0x07e0('0x20')]&&_0x2d7d70[_0x07e0('0x45')]){_0x57f6a4[_0x2d7d70['Variable']['name'][_0x07e0('0x46')]()]&&_0x19e4eb['custom_fields'][_0x07e0('0x49')]({'id':_0x2d7d70[_0x07e0('0x20')],'value':_0x57f6a4[_0x2d7d70[_0x07e0('0x4b')][_0x07e0('0xf')][_0x07e0('0x46')]()][_0x07e0('0x27')]()});}});}return _0x19e4eb;}function getConnection(_0x3e7128){return request({'method':_0x07e0('0xb'),'form':{'method':_0x07e0('0x4c'),'input_type':_0x07e0('0x22'),'response_type':_0x07e0('0x22'),'rest_data':JSON[_0x07e0('0x23')]({'user_auth':{'user_name':_0x3e7128[_0x07e0('0x4d')],'password':_0x3e7128[_0x07e0('0x4e')],'encryption':_0x07e0('0x4f')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x07e0('0x2c')](function(_0x22e12d){var _0x4c7aca=_0x22e12d;if(_0x4c7aca['id']){def[_0x07e0('0x50')]=_0x4c7aca['id'];return BPromise[_0x07e0('0x32')](_0x4c7aca);}else{throw new Error(util[_0x07e0('0x37')]('Account\x20%d\x20is\x20not\x20valid',_0x3e7128['id']));}});}function setRelationship(_0x1aebcd,_0x9b9c96,_0x2ea9e3,_0x47dcc3){return request({'form':{'method':_0x07e0('0x51'),'input_type':_0x07e0('0x22'),'response_type':_0x07e0('0x22'),'rest_data':JSON[_0x07e0('0x23')]({'session':_0x1aebcd['id'],'module_name':_0x07e0('0x24'),'module_id':_0x2ea9e3['id'],'link_field_name':_0x47dcc3,'related_ids':[_0x9b9c96['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x07e0('0x52')]=function(_0x5da40f,_0x1e7013,_0x2f22b8,_0x1452d5,_0x2970de,_0x36baaa){var _0x58014f,_0x59a4d7,_0x344adb,_0x4ea93c;_0x36baaa['remoteUri']=intUtil['stripTrailingSlash'](_0x36baaa[_0x07e0('0x53')]);_0x36baaa[_0x07e0('0x54')]=intUtil['stripTrailingSlash'](_0x36baaa[_0x07e0('0x54')]);def['uri']=util[_0x07e0('0x37')](_0x07e0('0x55'),_0x36baaa[_0x07e0('0x53')]);if(_0x2970de&&_0x2970de[_0x07e0('0x56')]){logger[_0x07e0('0xd')](_0x07e0('0x57'),_0x07e0('0x58'));_0x1e7013[_0x07e0('0x59')]=util[_0x07e0('0x37')](_0x07e0('0x5a'),_0x36baaa[_0x07e0('0x54')],_0x1e7013[_0x07e0('0x5b')],md5(_0x1e7013[_0x07e0('0x5b')]));}else{_0x1e7013[_0x07e0('0x59')]='';}return getConnection(_0x36baaa)[_0x07e0('0x2c')](function(_0x3ad93a){_0x4ea93c=_0x3ad93a;return getUser(_0x36baaa,_0x1452d5[_0x07e0('0xf')],_0x4ea93c);})[_0x07e0('0x2c')](function(_0x51c948){_0x58014f=_0x51c948;logger[_0x07e0('0xd')](_0x07e0('0x5c'),_0x58014f['id']);return getEndUser(_0x36baaa,_0x1e7013[_0x07e0('0x5d')],_0x1e7013[_0x07e0('0x5e')],_0x4ea93c);})['then'](function(_0x2d2d81){_0x59a4d7=_0x2d2d81;logger['info'](_0x07e0('0x5f'),_0x59a4d7['id']);return getTicket(_0x36baaa,_0x58014f,_0x59a4d7,_0x2f22b8,_0x1e7013,_0x2f22b8[_0x07e0('0x60')],_0x4ea93c,_0x07e0('0x61'));})['then'](function(_0x3203bf){_0x344adb=_0x3203bf;logger['info'](_0x07e0('0x62'));logger[_0x07e0('0xd')]('The\x20Ticket\x20ID\x20is:',_0x344adb['id']);return setRelationship(_0x4ea93c,_0x58014f,_0x344adb,_0x07e0('0x63'));})['then'](function(){return setRelationship(_0x4ea93c,_0x59a4d7,_0x344adb,_0x07e0('0x64'));})[_0x07e0('0x2c')](function(){return getServerInfo(_0x4ea93c);})[_0x07e0('0x2c')](function(_0x4d3080){var _0x4e9eac=parseInt(_0x4d3080[_0x07e0('0x65')][_0x07e0('0x66')](0x0));var _0x5b9154=util[_0x07e0('0x37')](_0x07e0('0x67'),_0x36baaa['remoteUri'],_0x344adb['id']);if(_0x4e9eac>0x6){_0x5b9154=util[_0x07e0('0x37')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x36baaa[_0x07e0('0x53')],_0x344adb['id']);}logger[_0x07e0('0xd')](_0x07e0('0x57'),_0x07e0('0x68'));emit(util[_0x07e0('0x37')](_0x07e0('0x69'),_0x1452d5[_0x07e0('0xf')]),_0x07e0('0x6a'),{'uri':_0x5b9154});})[_0x07e0('0x6b')](function(_0x1e81ac){logger[_0x07e0('0x6c')](_0x07e0('0x57'),JSON[_0x07e0('0x23')](_0x1e81ac));});};exports[_0x07e0('0x6d')]=function(_0x586536,_0x2a2566,_0x262c28,_0x80c141,_0x9eac35,_0x41a81b,_0x48c996){var _0xd4e685,_0x2da2c7,_0x54de0a,_0x177cfa;_0x41a81b[_0x07e0('0x53')]=intUtil[_0x07e0('0x6e')](_0x41a81b['remoteUri']);_0x41a81b['serverUrl']=intUtil['stripTrailingSlash'](_0x41a81b['serverUrl']);def[_0x07e0('0x6f')]=util[_0x07e0('0x37')](_0x07e0('0x55'),_0x41a81b[_0x07e0('0x53')]);if(_0x48c996&&_0x48c996['recordingFormat']&&_0x48c996[_0x07e0('0x70')]!==_0x07e0('0x71')){logger[_0x07e0('0xd')](_0x07e0('0x72'),_0x07e0('0x58'));_0x2a2566['recordingURL']=util['format'](_0x07e0('0x5a'),_0x41a81b[_0x07e0('0x54')],_0x2a2566['uniqueid'],md5(_0x2a2566[_0x07e0('0x5b')]));}return getConnection(_0x41a81b)[_0x07e0('0x2c')](function(_0xc5791){_0x177cfa=_0xc5791;return getUser(_0x41a81b,_0x80c141['name'],_0x177cfa);})['then'](function(_0x3cf790){_0xd4e685=_0x3cf790;logger['info'](_0x07e0('0x5c'),_0xd4e685['id']);return getEndUser(_0x41a81b,_0x2a2566[_0x07e0('0x73')],_0x2a2566['destcalleridnum'],_0x177cfa);})['then'](function(_0x5b850b){_0x2da2c7=_0x5b850b;logger[_0x07e0('0xd')]('The\x20Enduser\x20ID\x20is:',_0x2da2c7['id']);return getTicket(_0x41a81b,_0xd4e685,_0x2da2c7,_0x262c28,_0x2a2566,_0x262c28[_0x07e0('0x60')],_0x177cfa,'Outbound');})['then'](function(_0x3649b2){_0x54de0a=_0x3649b2;logger[_0x07e0('0xd')](_0x07e0('0x62'));logger[_0x07e0('0xd')](_0x07e0('0x74'),_0x54de0a['id']);return setRelationship(_0x177cfa,_0xd4e685,_0x54de0a,_0x07e0('0x63'));})[_0x07e0('0x2c')](function(){return setRelationship(_0x177cfa,_0x2da2c7,_0x54de0a,_0x07e0('0x64'));})[_0x07e0('0x2c')](function(){return getServerInfo(_0x177cfa);})[_0x07e0('0x2c')](function(_0x273501){var _0x420113=parseInt(_0x273501['version'][_0x07e0('0x66')](0x0));var _0x51b436=util['format'](_0x07e0('0x67'),_0x41a81b[_0x07e0('0x53')],_0x54de0a['id']);if(_0x420113>0x6){_0x51b436=util['format'](_0x07e0('0x75'),_0x41a81b['remoteUri'],_0x54de0a['id']);}logger[_0x07e0('0xd')](_0x07e0('0x72'),_0x07e0('0x68'));emit(util['format'](_0x07e0('0x69'),_0x80c141['name']),_0x07e0('0x6a'),{'uri':_0x51b436});})[_0x07e0('0x6b')](function(_0x46458a){logger[_0x07e0('0x6c')](_0x07e0('0x72'),JSON[_0x07e0('0x23')](_0x46458a));});};exports['unmanaged']=function(_0x29bbd3,_0x1941ab,_0x1f8b1f,_0x594f8d,_0x27560f,_0x2f1b77){var _0x1dd482,_0x4dfb35,_0xbcd075,_0xc9a939;_0x2f1b77[_0x07e0('0x53')]=intUtil[_0x07e0('0x6e')](_0x2f1b77[_0x07e0('0x53')]);_0x2f1b77['serverUrl']=intUtil[_0x07e0('0x6e')](_0x2f1b77[_0x07e0('0x54')]);def[_0x07e0('0x6f')]=util[_0x07e0('0x37')](_0x07e0('0x55'),_0x2f1b77['remoteUri']);if(_0x27560f&&_0x27560f[_0x07e0('0x56')]){logger[_0x07e0('0xd')]('['+_0x1941ab[_0x07e0('0x76')][_0x07e0('0x77')]()+']',_0x07e0('0x58'));_0x1941ab[_0x07e0('0x59')]=util[_0x07e0('0x37')](_0x07e0('0x5a'),_0x2f1b77[_0x07e0('0x54')],_0x1941ab[_0x07e0('0x5b')],md5(_0x1941ab[_0x07e0('0x5b')]));}else{_0x1941ab['recordingURL']='';}return getConnection(_0x2f1b77)[_0x07e0('0x2c')](function(_0x36365e){_0xc9a939=_0x36365e;if(!_[_0x07e0('0x2a')](_0x594f8d)){return getUser(_0x2f1b77,_0x594f8d[_0x07e0('0xf')],_0xc9a939);}else{return getUser(_0x2f1b77,null,_0xc9a939);}})[_0x07e0('0x2c')](function(_0x9c7844){_0x1dd482=_0x9c7844;logger['info']('The\x20User\x20ID\x20is:',_0x1dd482['id']);return getEndUser(_0x2f1b77,_0x1941ab[_0x07e0('0x5d')],_0x1941ab[_0x07e0('0x5e')],_0xc9a939);})[_0x07e0('0x2c')](function(_0x410379){_0x4dfb35=_0x410379;logger[_0x07e0('0xd')](_0x07e0('0x5f'),_0x4dfb35['id']);return getTicket(_0x2f1b77,_0x1dd482,_0x4dfb35,_0x1f8b1f,_0x1941ab,_0x1f8b1f['Fields'],_0xc9a939,'Inbound');})['then'](function(_0x69af7b){_0xbcd075=_0x69af7b;logger[_0x07e0('0xd')](_0x07e0('0x62'));logger['info'](_0x07e0('0x74'),_0xbcd075['id']);return setRelationship(_0xc9a939,_0x1dd482,_0xbcd075,_0x07e0('0x63'));})[_0x07e0('0x2c')](function(){return setRelationship(_0xc9a939,_0x4dfb35,_0xbcd075,'contacts');})[_0x07e0('0x2c')](function(){return getServerInfo(_0xc9a939);})[_0x07e0('0x6b')](function(_0x69e283){logger[_0x07e0('0x6c')]('['+_0x1941ab['lastevent']['toUpperCase']()+']',JSON[_0x07e0('0x23')](_0x69e283));});}; \ No newline at end of file +var _0xf04b=['base64','get_server_info','JSON','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','value','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','resolve','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','nameField','customField','toLowerCase','content','type','string','custom_fields','variable','variableName','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','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','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','outbound','uri','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','users','contacts','catch','unmanaged','lastevent','toUpperCase','Recording\x20is\x20enabled!','isNil','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','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','push','idField','stringify','Calls','format','Basic\x20%s','apiKey','toString'];(function(_0x2e74e0,_0x100308){var _0x47fe34=function(_0x3d44ab){while(--_0x3d44ab){_0x2e74e0['push'](_0x2e74e0['shift']());}};_0x47fe34(++_0x100308);}(_0xf04b,0x15c));var _0xbf04=function(_0xff0e1c,_0x445b2b){_0xff0e1c=_0xff0e1c-0x0;var _0x38fcc6=_0xf04b[_0xff0e1c];return _0x38fcc6;};'use strict';var _=require(_0xbf04('0x0'));var rp=require(_0xbf04('0x1'));var BPromise=require('bluebird');var md5=require(_0xbf04('0x2'));var util=require(_0xbf04('0x3'));var Redis=require('ioredis');var intUtil=require(_0xbf04('0x4'));var config=require(_0xbf04('0x5'));var logger=require(_0xbf04('0x6'))(_0xbf04('0x7'));config[_0xbf04('0x8')]=_['defaults'](config[_0xbf04('0x8')],{'host':_0xbf04('0x9'),'port':0x18eb});var io=require(_0xbf04('0xa'))(new Redis(config[_0xbf04('0x8')]));var def={'method':_0xbf04('0xb'),'json':!![]};function emit(_0x33bf22,_0xa045b8,_0x3890ad){io['to'](_0x33bf22)[_0xbf04('0xc')](_0xa045b8,_0x3890ad);}function getTicket(_0x557700,_0x45dd9e,_0x1890e3,_0x4988f4,_0x5be186,_0x433a18,_0x1b9536,_0x4b4ed7){logger[_0xbf04('0xd')](_0xbf04('0xe'));var _0x5f202a=new Date();var _0x568fd5=[{'name':_0xbf04('0xf'),'value':intUtil[_0xbf04('0x10')](_0x4988f4[_0xbf04('0x11')],_0x5be186,'\x20')},{'name':_0xbf04('0x12'),'value':_0x45dd9e['id']},{'name':_0xbf04('0x13'),'value':_0x45dd9e['id']},{'name':_0xbf04('0x14'),'value':intUtil[_0xbf04('0x10')](_0x4988f4[_0xbf04('0x15')],_0x5be186,'\x0a')},{'name':_0xbf04('0x16'),'value':_0x5f202a[_0xbf04('0x17')]()['slice'](0x0,0x13)[_0xbf04('0x18')]('T','\x20')},{'name':_0xbf04('0x19'),'value':'0'},{'name':_0xbf04('0x1a'),'value':'15'},{'name':_0xbf04('0x1b'),'value':_0x1890e3['id']},{'name':_0xbf04('0x1c'),'value':_0xbf04('0x1d')},{'name':_0xbf04('0x1e'),'value':_0x1890e3[_0xbf04('0xf')]},{'name':_0xbf04('0x1f'),'value':_0x4b4ed7}];if(_0x433a18[_0xbf04('0x20')]){_[_0xbf04('0x21')](_0x433a18,function(_0x243f3d){if(_0x5be186[_0x243f3d['variableName']]){_0x568fd5[_0xbf04('0x22')]({'name':_0x243f3d[_0xbf04('0x23')],'value':_0x5be186[_0x243f3d['variableName']]});}});}return request({'form':{'method':'set_entry','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xbf04('0x24')]({'session':_0x1b9536['id'],'module_name':_0xbf04('0x25'),'name_value_list':_0x568fd5})}});}function getAuth(_0x17b89c){return util[_0xbf04('0x26')](_0xbf04('0x27'),new Buffer(_0x17b89c[_0xbf04('0x28')]+':X')[_0xbf04('0x29')](_0xbf04('0x2a')));}function getServerInfo(_0x3ac8c8){return request({'form':{'method':_0xbf04('0x2b'),'input_type':_0xbf04('0x2c'),'response_type':'JSON','rest_data':JSON[_0xbf04('0x24')]({'session':_0x3ac8c8['id']})}});}function getUser(_0x580e1a,_0x55fb23,_0x15463d){if(!_['isNil'](_0x55fb23)){logger[_0xbf04('0xd')]('Getting\x20agent\x20with\x20name',_0x55fb23);return request({'form':{'method':_0xbf04('0x2d'),'input_type':'JSON','response_type':_0xbf04('0x2c'),'rest_data':JSON['stringify']({'session':_0x15463d['id'],'module_name':'Employees','query':util[_0xbf04('0x26')](_0xbf04('0x2e'),_0x55fb23),'order_by':'','offset':'0','select_fields':['id','name',_0xbf04('0x2f')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xbf04('0x30')](function(_0xe35f29){if(_0xe35f29[_0xbf04('0x31')][_0xbf04('0x20')]){var _0x43edfc=_[_0xbf04('0x32')](_0xe35f29[_0xbf04('0x31')],function(_0x831ef3){return _0x831ef3[_0xbf04('0x33')][_0xbf04('0x2f')][_0xbf04('0x34')]===_0x55fb23;});if(_0x43edfc){logger[_0xbf04('0xd')](_0xbf04('0x35'));return BPromise['resolve']({'id':_0x43edfc['name_value_list']['id']['value'],'name':_0x43edfc[_0xbf04('0x33')]['name'][_0xbf04('0x34')]});}}logger[_0xbf04('0xd')](_0xbf04('0x36'));return BPromise['resolve']({'id':_0x15463d['name_value_list'][_0xbf04('0x37')][_0xbf04('0x34')],'name':_0x15463d[_0xbf04('0x33')]['user_name']['value']});});}else{logger[_0xbf04('0xd')](_0xbf04('0x38'));return BPromise[_0xbf04('0x39')]({'id':_0x15463d[_0xbf04('0x33')]['user_id'][_0xbf04('0x34')],'name':_0x15463d[_0xbf04('0x33')][_0xbf04('0x2f')][_0xbf04('0x34')]});}}function getEndUser(_0x55a855,_0x2c9bbd,_0x4901d1,_0x26192c){logger[_0xbf04('0xd')](_0xbf04('0x3a'),_0x4901d1);return request({'form':{'method':_0xbf04('0x2d'),'input_type':_0xbf04('0x2c'),'response_type':_0xbf04('0x2c'),'rest_data':JSON[_0xbf04('0x24')]({'session':_0x26192c['id'],'module_name':_0xbf04('0x1d'),'query':util['format'](_0xbf04('0x3b'),_0x4901d1),'order_by':'','offset':'0','select_fields':['id',_0xbf04('0xf'),_0xbf04('0x3c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xbf04('0x30')](function(_0x2e15f6){if(_0x2e15f6[_0xbf04('0x31')][_0xbf04('0x20')]){var _0x5a59eb=_[_0xbf04('0x32')](_0x2e15f6[_0xbf04('0x31')],function(_0x562e9f){return _0x562e9f[_0xbf04('0x33')][_0xbf04('0x3c')][_0xbf04('0x34')]===_0x4901d1;});if(_0x5a59eb){logger[_0xbf04('0xd')](_0xbf04('0x3d'));return BPromise[_0xbf04('0x39')]({'id':_0x5a59eb[_0xbf04('0x33')]['id'][_0xbf04('0x34')],'name':_0x5a59eb['name_value_list'][_0xbf04('0xf')][_0xbf04('0x34')],'phone':_0x5a59eb[_0xbf04('0x33')]['phone_home'][_0xbf04('0x34')]});}}else{logger['info'](_0xbf04('0x3e'));return request({'form':{'method':_0xbf04('0x3f'),'input_type':'JSON','response_type':_0xbf04('0x2c'),'rest_data':JSON[_0xbf04('0x24')]({'session':_0x26192c['id'],'module_name':_0xbf04('0x1d'),'name_value_list':[{'name':_0xbf04('0x40'),'value':_0x2c9bbd!==_0xbf04('0x41')?_0x2c9bbd:util[_0xbf04('0x26')](_0xbf04('0x42'),_0x4901d1)},{'name':_0xbf04('0x3c'),'value':_0x4901d1}]})}})['then'](function(_0x3df977){logger[_0xbf04('0xd')](_0xbf04('0x43'));return BPromise['resolve']({'id':_0x3df977['id'],'name':_0x3df977[_0xbf04('0x31')][_0xbf04('0x40')][_0xbf04('0x34')],'phone':_0x3df977[_0xbf04('0x31')][_0xbf04('0x3c')][_0xbf04('0x34')]});});}});}function request(_0x3aba6d){logger[_0xbf04('0x44')](_0xbf04('0x45'),JSON['stringify'](_0x3aba6d));return rp(_[_0xbf04('0x46')](def,_0x3aba6d));}function getTags(_0x58bc40,_0x1d6292){var _0xe156c9=[];if(_0x58bc40&&_0x58bc40[_0xbf04('0x20')]>0x0){_0xe156c9=_[_0xbf04('0x47')](_0x58bc40,_0x1d6292);}return _0xe156c9;}function getCustomFields(_0x4ab00e,_0x3dba07){var _0x2c9647=[];var _0x284579={'custom_fields':[]};if(_0x4ab00e[_0xbf04('0x20')]>0x0){_[_0xbf04('0x21')](_0x4ab00e,function(_0x451342){if(_0x451342['type']==='string'&&_0x451342[_0xbf04('0x48')]&&!_0x451342[_0xbf04('0x49')]){_0x284579[_0x451342[_0xbf04('0x48')][_0xbf04('0x4a')]()]=_0x451342[_0xbf04('0x4b')][_0xbf04('0x29')]();}else if(_0x451342[_0xbf04('0x4c')]===_0xbf04('0x4d')&&_0x451342[_0xbf04('0x23')]&&_0x451342['customField']){_0x284579[_0xbf04('0x4e')][_0xbf04('0x22')]({'id':_0x451342[_0xbf04('0x23')],'value':_0x451342['content']['toString']()});}else if(_0x451342[_0xbf04('0x4c')]===_0xbf04('0x4f')&&_0x451342['variableName']&&_0x451342[_0xbf04('0x23')]&&_0x451342[_0xbf04('0x49')]){_0x3dba07[_0x451342[_0xbf04('0x50')]]&&_0x284579[_0xbf04('0x4e')][_0xbf04('0x22')]({'id':_0x451342[_0xbf04('0x23')],'value':_0x3dba07[_0x451342[_0xbf04('0x50')]][_0xbf04('0x29')]()});}else if(_0x451342[_0xbf04('0x4c')]===_0xbf04('0x51')&&_0x451342['Variable']&&_0x451342[_0xbf04('0x52')]['name']&&_0x451342[_0xbf04('0x23')]&&_0x451342[_0xbf04('0x49')]){_0x3dba07[_0x451342['Variable'][_0xbf04('0xf')][_0xbf04('0x4a')]()]&&_0x284579[_0xbf04('0x4e')][_0xbf04('0x22')]({'id':_0x451342['idField'],'value':_0x3dba07[_0x451342[_0xbf04('0x52')][_0xbf04('0xf')][_0xbf04('0x4a')]()]['toString']()});}});}return _0x284579;}function getConnection(_0x512b79){return request({'method':_0xbf04('0xb'),'form':{'method':_0xbf04('0x53'),'input_type':_0xbf04('0x2c'),'response_type':_0xbf04('0x2c'),'rest_data':JSON[_0xbf04('0x24')]({'user_auth':{'user_name':_0x512b79[_0xbf04('0x54')],'password':_0x512b79[_0xbf04('0x55')],'encryption':_0xbf04('0x56')},'application':_0xbf04('0x57')})}})[_0xbf04('0x30')](function(_0xacb340){var _0x1b6710=_0xacb340;if(_0x1b6710['id']){def[_0xbf04('0x58')]=_0x1b6710['id'];return BPromise[_0xbf04('0x39')](_0x1b6710);}else{throw new Error(util[_0xbf04('0x26')](_0xbf04('0x59'),_0x512b79['id']));}});}function setRelationship(_0x8e2a22,_0x4df133,_0x4731b8,_0x57460e){return request({'form':{'method':_0xbf04('0x5a'),'input_type':_0xbf04('0x2c'),'response_type':'JSON','rest_data':JSON[_0xbf04('0x24')]({'session':_0x8e2a22['id'],'module_name':_0xbf04('0x25'),'module_id':_0x4731b8['id'],'link_field_name':_0x57460e,'related_ids':[_0x4df133['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x3fde1b,_0x3b1e0e,_0x2b5a17,_0x57a315,_0xa32f0f,_0x5d0230){var _0x3b702d,_0x4bc663,_0x4e62a1,_0x2610d0;_0x5d0230[_0xbf04('0x5b')]=intUtil[_0xbf04('0x5c')](_0x5d0230[_0xbf04('0x5b')]);_0x5d0230[_0xbf04('0x5d')]=intUtil[_0xbf04('0x5c')](_0x5d0230[_0xbf04('0x5d')]);def['uri']=util[_0xbf04('0x26')](_0xbf04('0x5e'),_0x5d0230['remoteUri']);if(_0xa32f0f&&_0xa32f0f[_0xbf04('0x5f')]){logger[_0xbf04('0xd')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3b1e0e['recordingURL']=util[_0xbf04('0x26')](_0xbf04('0x60'),_0x5d0230[_0xbf04('0x5d')],_0x3b1e0e['uniqueid'],md5(_0x3b1e0e[_0xbf04('0x61')]));}else{_0x3b1e0e[_0xbf04('0x62')]='';}return getConnection(_0x5d0230)[_0xbf04('0x30')](function(_0x57cdbf){_0x2610d0=_0x57cdbf;return getUser(_0x5d0230,_0x57a315[_0xbf04('0xf')],_0x2610d0);})[_0xbf04('0x30')](function(_0x7b485a){_0x3b702d=_0x7b485a;logger[_0xbf04('0xd')](_0xbf04('0x63'),_0x3b702d['id']);return getEndUser(_0x5d0230,_0x3b1e0e[_0xbf04('0x64')],_0x3b1e0e[_0xbf04('0x65')],_0x2610d0);})[_0xbf04('0x30')](function(_0x47e566){_0x4bc663=_0x47e566;logger['info'](_0xbf04('0x66'),_0x4bc663['id']);return getTicket(_0x5d0230,_0x3b702d,_0x4bc663,_0x2b5a17,_0x3b1e0e,_0x2b5a17[_0xbf04('0x67')],_0x2610d0,_0xbf04('0x68'));})[_0xbf04('0x30')](function(_0x3ed482){_0x4e62a1=_0x3ed482;logger[_0xbf04('0xd')](_0xbf04('0x69'));logger[_0xbf04('0xd')]('The\x20Ticket\x20ID\x20is:',_0x4e62a1['id']);return setRelationship(_0x2610d0,_0x3b702d,_0x4e62a1,'users');})[_0xbf04('0x30')](function(){return setRelationship(_0x2610d0,_0x4bc663,_0x4e62a1,'contacts');})['then'](function(){return getServerInfo(_0x2610d0);})['then'](function(_0x11ce78){var _0x5e9128=parseInt(_0x11ce78[_0xbf04('0x6a')][_0xbf04('0x6b')](0x0));var _0xd09e9d=util['format'](_0xbf04('0x6c'),_0x5d0230[_0xbf04('0x5b')],_0x4e62a1['id']);if(_0x5e9128>0x6){_0xd09e9d=util[_0xbf04('0x26')](_0xbf04('0x6d'),_0x5d0230['remoteUri'],_0x4e62a1['id']);}logger['info'](_0xbf04('0x6e'),_0xbf04('0x6f'));emit(util['format'](_0xbf04('0x70'),_0x57a315[_0xbf04('0xf')]),_0xbf04('0x71'),{'uri':_0xd09e9d});})['catch'](function(_0x17febd){logger[_0xbf04('0x72')](_0xbf04('0x6e'),JSON[_0xbf04('0x24')](_0x17febd));});};exports[_0xbf04('0x73')]=function(_0x1a2c0c,_0x1e28b8,_0x378c85,_0x5e7634,_0x595607,_0x4dc7fc,_0x5a120c){var _0x4ddf70,_0x4657d5,_0xd75d41,_0x22adb8;_0x4dc7fc[_0xbf04('0x5b')]=intUtil['stripTrailingSlash'](_0x4dc7fc[_0xbf04('0x5b')]);_0x4dc7fc['serverUrl']=intUtil[_0xbf04('0x5c')](_0x4dc7fc[_0xbf04('0x5d')]);def[_0xbf04('0x74')]=util['format'](_0xbf04('0x5e'),_0x4dc7fc['remoteUri']);if(_0x5a120c&&_0x5a120c[_0xbf04('0x75')]&&_0x5a120c['recordingFormat']!=='none'){logger['info'](_0xbf04('0x76'),'Recording\x20is\x20enabled!');_0x1e28b8[_0xbf04('0x62')]=util[_0xbf04('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4dc7fc[_0xbf04('0x5d')],_0x1e28b8[_0xbf04('0x61')],md5(_0x1e28b8[_0xbf04('0x61')]));}return getConnection(_0x4dc7fc)[_0xbf04('0x30')](function(_0x55dfd3){_0x22adb8=_0x55dfd3;return getUser(_0x4dc7fc,_0x5e7634[_0xbf04('0xf')],_0x22adb8);})[_0xbf04('0x30')](function(_0x56667a){_0x4ddf70=_0x56667a;logger['info'](_0xbf04('0x63'),_0x4ddf70['id']);return getEndUser(_0x4dc7fc,_0x1e28b8[_0xbf04('0x77')],_0x1e28b8[_0xbf04('0x78')],_0x22adb8);})[_0xbf04('0x30')](function(_0x4fd13c){_0x4657d5=_0x4fd13c;logger[_0xbf04('0xd')](_0xbf04('0x66'),_0x4657d5['id']);return getTicket(_0x4dc7fc,_0x4ddf70,_0x4657d5,_0x378c85,_0x1e28b8,_0x378c85[_0xbf04('0x67')],_0x22adb8,_0xbf04('0x79'));})[_0xbf04('0x30')](function(_0x13f77d){_0xd75d41=_0x13f77d;logger[_0xbf04('0xd')](_0xbf04('0x69'));logger[_0xbf04('0xd')]('The\x20Ticket\x20ID\x20is:',_0xd75d41['id']);return setRelationship(_0x22adb8,_0x4ddf70,_0xd75d41,_0xbf04('0x7a'));})[_0xbf04('0x30')](function(){return setRelationship(_0x22adb8,_0x4657d5,_0xd75d41,_0xbf04('0x7b'));})[_0xbf04('0x30')](function(){return getServerInfo(_0x22adb8);})['then'](function(_0x1934aa){var _0x2803ce=parseInt(_0x1934aa[_0xbf04('0x6a')][_0xbf04('0x6b')](0x0));var _0x2bf923=util['format'](_0xbf04('0x6c'),_0x4dc7fc[_0xbf04('0x5b')],_0xd75d41['id']);if(_0x2803ce>0x6){_0x2bf923=util[_0xbf04('0x26')](_0xbf04('0x6d'),_0x4dc7fc['remoteUri'],_0xd75d41['id']);}logger[_0xbf04('0xd')](_0xbf04('0x76'),_0xbf04('0x6f'));emit(util[_0xbf04('0x26')](_0xbf04('0x70'),_0x5e7634[_0xbf04('0xf')]),_0xbf04('0x71'),{'uri':_0x2bf923});})[_0xbf04('0x7c')](function(_0x3c153e){logger[_0xbf04('0x72')](_0xbf04('0x76'),JSON[_0xbf04('0x24')](_0x3c153e));});};exports[_0xbf04('0x7d')]=function(_0x35a97e,_0x4ef81f,_0x25eebc,_0x27d657,_0x37fb56,_0x2b5e02){var _0x1b5693,_0x40fa2d,_0x4326ed,_0x2f4d94;_0x2b5e02['remoteUri']=intUtil[_0xbf04('0x5c')](_0x2b5e02[_0xbf04('0x5b')]);_0x2b5e02[_0xbf04('0x5d')]=intUtil[_0xbf04('0x5c')](_0x2b5e02[_0xbf04('0x5d')]);def['uri']=util[_0xbf04('0x26')]('%s/service/v4_1/rest.php',_0x2b5e02[_0xbf04('0x5b')]);if(_0x37fb56&&_0x37fb56[_0xbf04('0x5f')]){logger[_0xbf04('0xd')]('['+_0x4ef81f[_0xbf04('0x7e')][_0xbf04('0x7f')]()+']',_0xbf04('0x80'));_0x4ef81f[_0xbf04('0x62')]=util[_0xbf04('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2b5e02[_0xbf04('0x5d')],_0x4ef81f[_0xbf04('0x61')],md5(_0x4ef81f['uniqueid']));}else{_0x4ef81f[_0xbf04('0x62')]='';}return getConnection(_0x2b5e02)[_0xbf04('0x30')](function(_0x19ed5e){_0x2f4d94=_0x19ed5e;if(!_[_0xbf04('0x81')](_0x27d657)){return getUser(_0x2b5e02,_0x27d657['name'],_0x2f4d94);}else{return getUser(_0x2b5e02,null,_0x2f4d94);}})[_0xbf04('0x30')](function(_0xfbe2a1){_0x1b5693=_0xfbe2a1;logger[_0xbf04('0xd')](_0xbf04('0x63'),_0x1b5693['id']);return getEndUser(_0x2b5e02,_0x4ef81f['calleridname'],_0x4ef81f[_0xbf04('0x65')],_0x2f4d94);})[_0xbf04('0x30')](function(_0x405f87){_0x40fa2d=_0x405f87;logger[_0xbf04('0xd')](_0xbf04('0x66'),_0x40fa2d['id']);return getTicket(_0x2b5e02,_0x1b5693,_0x40fa2d,_0x25eebc,_0x4ef81f,_0x25eebc[_0xbf04('0x67')],_0x2f4d94,'Inbound');})[_0xbf04('0x30')](function(_0x5b379a){_0x4326ed=_0x5b379a;logger['info'](_0xbf04('0x69'));logger[_0xbf04('0xd')]('The\x20Ticket\x20ID\x20is:',_0x4326ed['id']);return setRelationship(_0x2f4d94,_0x1b5693,_0x4326ed,_0xbf04('0x7a'));})[_0xbf04('0x30')](function(){return setRelationship(_0x2f4d94,_0x40fa2d,_0x4326ed,_0xbf04('0x7b'));})['then'](function(){return getServerInfo(_0x2f4d94);})['catch'](function(_0x264c11){logger['error']('['+_0x4ef81f['lastevent'][_0xbf04('0x7f')]()+']',JSON[_0xbf04('0x24')](_0x264c11));});}; \ 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 4fd1e00..2dff77c 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 _0x9129=['slice','lodash','sortBy','length','type','string','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','key','format','%s:\x20%s','keyContent','keyType','stripTrailingSlash'];(function(_0x4b17de,_0x48e68b){var _0x53c87e=function(_0x428329){while(--_0x428329){_0x4b17de['push'](_0x4b17de['shift']());}};_0x53c87e(++_0x48e68b);}(_0x9129,0x6a));var _0x9912=function(_0x5e4563,_0x3ff918){_0x5e4563=_0x5e4563-0x0;var _0x8d1bf5=_0x9129[_0x5e4563];return _0x8d1bf5;};'use strict';var _=require(_0x9912('0x0'));var util=require('util');exports['getString']=function(_0x4b5822,_0x168cb2,_0x200f94){var _0x27d701=[];if(_0x4b5822['length']>0x0){var _0x5f5de4=_[_0x9912('0x1')](_0x4b5822,['id']);for(var _0x482073=0x0;_0x482073<_0x5f5de4[_0x9912('0x2')];_0x482073++){var _0x43e135=_0x5f5de4[_0x482073];if(_0x43e135[_0x9912('0x3')]===_0x9912('0x4')){_0x27d701[_0x9912('0x5')](_0x43e135[_0x9912('0x6')]);}else if(_0x43e135[_0x9912('0x3')]===_0x9912('0x7')&&_0x43e135[_0x9912('0x8')]){_0x168cb2[_0x43e135[_0x9912('0x8')]]&&_0x27d701[_0x9912('0x5')](_0x168cb2[_0x43e135[_0x9912('0x8')]][_0x9912('0x9')]());}else if(_0x43e135[_0x9912('0x3')]===_0x9912('0xa')&&_0x43e135[_0x9912('0xb')]&&_0x43e135[_0x9912('0xb')][_0x9912('0xc')]){_0x168cb2[_0x43e135[_0x9912('0xb')][_0x9912('0xc')][_0x9912('0xd')]()]&&_0x27d701[_0x9912('0x5')](_0x168cb2[_0x43e135[_0x9912('0xb')]['name'][_0x9912('0xd')]()]['toString']());}else if(_0x43e135[_0x9912('0x3')]==='keyValue'){if(_0x43e135['keyType']==='string'&&_0x43e135[_0x9912('0xe')]){_0x27d701[_0x9912('0x5')](util[_0x9912('0xf')](_0x9912('0x10'),_0x43e135[_0x9912('0xe')],_0x43e135[_0x9912('0x11')]));}else if(_0x43e135[_0x9912('0x12')]===_0x9912('0x7')&&_0x43e135[_0x9912('0x8')]&&_0x43e135[_0x9912('0xe')]){_0x168cb2[_0x43e135[_0x9912('0x8')]]&&_0x27d701[_0x9912('0x5')](util[_0x9912('0xf')](_0x9912('0x10'),_0x43e135[_0x9912('0xe')],_0x168cb2[_0x43e135['variableName']]));}else if(_0x43e135['keyType']===_0x9912('0xa')&&_0x43e135[_0x9912('0xb')]&&_0x43e135['Variable'][_0x9912('0xc')]&&_0x43e135['key']){_0x168cb2[_0x43e135['Variable'][_0x9912('0xc')]['toLowerCase']()]&&_0x27d701[_0x9912('0x5')](util[_0x9912('0xf')](_0x9912('0x10'),_0x43e135[_0x9912('0xe')],_0x168cb2[_0x43e135[_0x9912('0xb')][_0x9912('0xc')]['toLowerCase']()]));}}}}return _0x27d701['join'](_0x200f94);};exports[_0x9912('0x13')]=function(_0x2f2bea){var _0x2b38a4=_0x2f2bea[_0x9912('0x14')](-0x1);if(_0x2b38a4==='/'){_0x2f2bea=_0x2f2bea['substring'](0x0,_0x2f2bea['lastIndexOf'](_0x2b38a4));}return _0x2f2bea;};exports['validateEmail']=function(_0x2bf49a){if(!_['isNil'](_0x2bf49a)&&_0x2bf49a!==''){var _0x39f28d=/^(([^<>()\[\]\\.,;:\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 _0x39f28d['test'](String(_0x2bf49a)[_0x9912('0xd')]());}else{return![];}}; \ No newline at end of file +var _0x1c10=['key','%s:\x20%s','keyContent','customVariable','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','lodash','util','length','sortBy','type','string','push','content','variable','variableName','Variable','name','toLowerCase','toString','keyValue','keyType'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x1c10,0x185));var _0x01c1=function(_0x1daa7f,_0x190ab7){_0x1daa7f=_0x1daa7f-0x0;var _0x40acff=_0x1c10[_0x1daa7f];return _0x40acff;};'use strict';var _=require(_0x01c1('0x0'));var util=require(_0x01c1('0x1'));exports['getString']=function(_0x148404,_0x2a8600,_0x791c){var _0x26e669=[];if(_0x148404[_0x01c1('0x2')]>0x0){var _0x16bfd3=_[_0x01c1('0x3')](_0x148404,['id']);for(var _0x123edd=0x0;_0x123edd<_0x16bfd3[_0x01c1('0x2')];_0x123edd++){var _0x11070f=_0x16bfd3[_0x123edd];if(_0x11070f[_0x01c1('0x4')]===_0x01c1('0x5')){_0x26e669[_0x01c1('0x6')](_0x11070f[_0x01c1('0x7')]);}else if(_0x11070f[_0x01c1('0x4')]===_0x01c1('0x8')&&_0x11070f[_0x01c1('0x9')]){_0x2a8600[_0x11070f[_0x01c1('0x9')]]&&_0x26e669[_0x01c1('0x6')](_0x2a8600[_0x11070f['variableName']]['toString']());}else if(_0x11070f[_0x01c1('0x4')]==='customVariable'&&_0x11070f['Variable']&&_0x11070f[_0x01c1('0xa')]['name']){_0x2a8600[_0x11070f[_0x01c1('0xa')][_0x01c1('0xb')][_0x01c1('0xc')]()]&&_0x26e669[_0x01c1('0x6')](_0x2a8600[_0x11070f['Variable'][_0x01c1('0xb')][_0x01c1('0xc')]()][_0x01c1('0xd')]());}else if(_0x11070f[_0x01c1('0x4')]===_0x01c1('0xe')){if(_0x11070f[_0x01c1('0xf')]===_0x01c1('0x5')&&_0x11070f[_0x01c1('0x10')]){_0x26e669[_0x01c1('0x6')](util['format'](_0x01c1('0x11'),_0x11070f['key'],_0x11070f[_0x01c1('0x12')]));}else if(_0x11070f[_0x01c1('0xf')]==='variable'&&_0x11070f[_0x01c1('0x9')]&&_0x11070f[_0x01c1('0x10')]){_0x2a8600[_0x11070f[_0x01c1('0x9')]]&&_0x26e669['push'](util['format'](_0x01c1('0x11'),_0x11070f['key'],_0x2a8600[_0x11070f[_0x01c1('0x9')]]));}else if(_0x11070f[_0x01c1('0xf')]===_0x01c1('0x13')&&_0x11070f['Variable']&&_0x11070f['Variable'][_0x01c1('0xb')]&&_0x11070f[_0x01c1('0x10')]){_0x2a8600[_0x11070f[_0x01c1('0xa')][_0x01c1('0xb')]['toLowerCase']()]&&_0x26e669[_0x01c1('0x6')](util['format']('%s:\x20%s',_0x11070f[_0x01c1('0x10')],_0x2a8600[_0x11070f[_0x01c1('0xa')][_0x01c1('0xb')][_0x01c1('0xc')]()]));}}}}return _0x26e669[_0x01c1('0x14')](_0x791c);};exports[_0x01c1('0x15')]=function(_0x264f96){var _0x2cfd57=_0x264f96[_0x01c1('0x16')](-0x1);if(_0x2cfd57==='/'){_0x264f96=_0x264f96[_0x01c1('0x17')](0x0,_0x264f96[_0x01c1('0x18')](_0x2cfd57));}return _0x264f96;};exports[_0x01c1('0x19')]=function(_0x4497bb){if(!_[_0x01c1('0x1a')](_0x4497bb)&&_0x4497bb!==''){var _0x47ac96=/^(([^<>()\[\]\\.,;:\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 _0x47ac96['test'](String(_0x4497bb)[_0x01c1('0xc')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index cb694ab..b4d8c27 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 _0x34e8=['redis','defaults','localhost','emit','length','forEach','includes','string','picklist','type','idField','toString','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','getString','Subjects','POST','format','remoteUri','create','sessionName','HelpDesk','stringify','success','error','catch','statusCode','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','Agent\x20found!','resolve','email1','first_name','last_name','userId','[vTiger],\x20%s,\x20%s,\x20%s','getUser','admin','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!','phone','getEndUser','accessKey','getchallenge','then','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','The\x20User\x20ID\x20is:','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','split','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger'];(function(_0x26bc77,_0x29cd3e){var _0x4566fb=function(_0x500b6b){while(--_0x500b6b){_0x26bc77['push'](_0x26bc77['shift']());}};_0x4566fb(++_0x29cd3e);}(_0x34e8,0x12c));var _0x834e=function(_0x197255,_0x1ad9b8){_0x197255=_0x197255-0x0;var _0x433708=_0x34e8[_0x197255];return _0x433708;};'use strict';var _=require(_0x834e('0x0'));var rp=require(_0x834e('0x1'));var BPromise=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var util=require('util');var Redis=require(_0x834e('0x4'));var intUtil=require(_0x834e('0x5'));var config=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));function emit(_0x3cc2e3,_0x3a3ef6,_0x2e69e2){io['to'](_0x3cc2e3)[_0x834e('0xc')](_0x3a3ef6,_0x2e69e2);}function getCustomFields(_0x23501c,_0x363786){var _0x1af45a={};if(_0x23501c[_0x834e('0xd')]>0x0){_[_0x834e('0xe')](_0x23501c,function(_0x1e41fe){if(_[_0x834e('0xf')]([_0x834e('0x10'),_0x834e('0x11')],_0x1e41fe[_0x834e('0x12')])&&_0x1e41fe[_0x834e('0x13')]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x1e41fe['content'][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='variable'&&_0x1e41fe[_0x834e('0x15')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe[_0x834e('0x15')]]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['variableName']][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='customVariable'&&_0x1e41fe[_0x834e('0x16')]&&_0x1e41fe['Variable'][_0x834e('0x17')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()][_0x834e('0x14')]();}});}return _0x1af45a;}function createTicket(_0xb993a1,_0x237947,_0x254677,_0x1dd214,_0x595515,_0x2545b4,_0x1fd2c6){logger[_0x834e('0x19')](_0x834e('0x1a'));var _0x4ab05d=_[_0x834e('0x1b')]({'parent_id':'','assigned_user_id':_0x237947['id'],'ticketpriorities':_0x834e('0x1c'),'ticketstatus':'Open','ticket_title':intUtil[_0x834e('0x1d')](_0x1dd214[_0x834e('0x1e')],_0x595515,'\x20'),'description':intUtil[_0x834e('0x1d')](_0x1dd214['Descriptions'],_0x595515,'\x0a'),'contact_id':_0x254677['id']},getCustomFields(_0x2545b4,_0x595515));var _0x4e3f48={'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0xb993a1[_0x834e('0x21')]),'form':{'operation':_0x834e('0x22'),'username':_0xb993a1['username'],'sessionName':_0x1fd2c6[_0x834e('0x23')],'elementType':_0x834e('0x24'),'element':JSON[_0x834e('0x25')](_0x4ab05d)},'json':!![]};return request(_0x4e3f48)['then'](function(_0x24fcf7){if(_0x24fcf7[_0x834e('0x26')]){return BPromise['resolve']({'id':_0x24fcf7['result']['id']});}else{throw new Error(util[_0x834e('0x20')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x834e('0x25')](_0x24fcf7[_0x834e('0x27')])));}})[_0x834e('0x28')](function(_0x2cc2eb){var _0x3cd928=_0x2cc2eb[_0x834e('0x29')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','createTicket',_0x3cd928,JSON['stringify'](_0x2cc2eb));});}function getUser(_0x2c7a8d,_0x567cea,_0x106d6a){if(intUtil['validateEmail'](_0x567cea)){logger[_0x834e('0x19')](_0x834e('0x2a'),_0x567cea);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x2c7a8d[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x2c7a8d[_0x834e('0x2e')],'sessionName':_0x106d6a[_0x834e('0x23')],'query':util['format'](_0x834e('0x2f'),_0x567cea)},'json':!![]})['then'](function(_0x2c75c2){if(_0x2c75c2[_0x834e('0x26')]&&_0x2c75c2[_0x834e('0x30')][_0x834e('0xd')]){logger[_0x834e('0x19')](_0x834e('0x31'));return BPromise[_0x834e('0x32')]({'id':_0x2c75c2[_0x834e('0x30')][0x0]['id'],'email':_0x2c75c2[_0x834e('0x30')][0x0][_0x834e('0x33')],'name':_0x2c75c2['result'][0x0][_0x834e('0x34')]+'\x20'+_0x2c75c2[_0x834e('0x30')][_0x834e('0x35')]});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':'admin'});}})['catch'](function(_0x3e58fa){var _0x41bf4d=_0x3e58fa[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x41bf4d,JSON['stringify'](_0x3e58fa));});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':_0x834e('0x39')})[_0x834e('0x28')](function(_0x491c28){var _0x481f70=_0x491c28[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x481f70,JSON[_0x834e('0x25')](_0x491c28));});}}function getEndUser(_0x4ca43c,_0x1c5ed6,_0x548d1d,_0x50c243){logger[_0x834e('0x19')]('Searching\x20end\x20user\x20with\x20phone',_0x548d1d);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x4ca43c[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x4ca43c['username'],'sessionName':_0x50c243[_0x834e('0x23')],'query':util[_0x834e('0x20')](_0x834e('0x3a'),_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d)},'json':!![]})['then'](function(_0x35380e){if(_0x35380e[_0x834e('0x26')]&&_0x35380e['result'][_0x834e('0xd')]){logger['info'](_0x834e('0x3b'));return BPromise[_0x834e('0x32')]({'id':_0x35380e['result'][0x0]['id'],'name':_0x35380e['result'][0x0][_0x834e('0x3c')]+'\x20'+_0x35380e[_0x834e('0x30')][0x0][_0x834e('0x3d')],'phone':_0x548d1d});}else{logger[_0x834e('0x19')](_0x834e('0x3e'));return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0x4ca43c[_0x834e('0x21')]),'form':{'operation':'create','sessionName':_0x50c243[_0x834e('0x23')],'elementType':'Contacts','element':JSON[_0x834e('0x25')]({'lastname':_0x1c5ed6,'phone':_0x548d1d,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x361f60){logger[_0x834e('0x19')]('Enduser\x20created.');return BPromise[_0x834e('0x32')]({'id':_0x361f60[_0x834e('0x30')]['id'],'name':_0x361f60[_0x834e('0x30')][_0x834e('0x3d')],'phone':_0x361f60[_0x834e('0x30')][_0x834e('0x3f')]});})[_0x834e('0x28')](function(_0x3ccd8e){var _0x5dc63b=_0x3ccd8e[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x40'),_0x5dc63b,JSON['stringify'](_0x3ccd8e));});}});}function getConnection(_0x112306){var _0x42fd90=_0x112306[_0x834e('0x2e')];var _0x2112d5=_0x112306[_0x834e('0x41')];return request({'method':_0x834e('0x2b'),'uri':util['format']('%s/webservice.php',_0x112306[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x42'),'username':_0x42fd90},'json':!![]})[_0x834e('0x43')](function(_0x40ff5a){if(_0x40ff5a[_0x834e('0x26')]){return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x112306[_0x834e('0x21')]),'form':{'operation':_0x834e('0x44'),'username':_0x42fd90,'accessKey':md5(_0x40ff5a[_0x834e('0x30')][_0x834e('0x45')]+_0x2112d5)},'json':!![]});}})[_0x834e('0x43')](function(_0x1a3237){if(_0x1a3237[_0x834e('0x26')]){return BPromise[_0x834e('0x32')](_0x1a3237[_0x834e('0x30')]);}else{throw new Error(util[_0x834e('0x20')](_0x834e('0x46'),_0x112306['id']));}})[_0x834e('0x28')](function(_0x4cfacd){var _0x1cc0b8=_0x4cfacd[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x47'),_0x1cc0b8,JSON['stringify'](_0x4cfacd));});}function request(_0x3dcca3){logger[_0x834e('0x19')](_0x834e('0x48'),JSON[_0x834e('0x25')](_0x3dcca3));return rp(_0x3dcca3);}exports[_0x834e('0x49')]=function(_0xb77aab,_0x4549ba,_0x4a8b32,_0x1ad7fe,_0x8bc6c6,_0x3e0550){var _0x363675,_0x86ad2b,_0x396bbe,_0x344b51;_0x3e0550[_0x834e('0x21')]=intUtil['stripTrailingSlash'](_0x3e0550[_0x834e('0x21')]);if(_0x8bc6c6&&_0x8bc6c6['monitor_format']){logger[_0x834e('0x19')]('[QUEUE]',_0x834e('0x4a'));_0x4549ba['recordingURL']=util['format'](_0x834e('0x4b'),_0x3e0550[_0x834e('0x4c')],_0x4549ba['uniqueid'],md5(_0x4549ba['uniqueid']));}else{_0x4549ba[_0x834e('0x4d')]='';}return getConnection(_0x3e0550)[_0x834e('0x43')](function(_0x138ed2){_0x344b51=_0x138ed2;return getUser(_0x3e0550,_0x1ad7fe[_0x834e('0x4e')],_0x344b51);})[_0x834e('0x43')](function(_0x315858){_0x363675=_0x315858;logger[_0x834e('0x19')](_0x834e('0x4f'),_0x363675['id']);return getEndUser(_0x3e0550,_0x4549ba['calleridname'],_0x4549ba[_0x834e('0x50')],_0x344b51);})[_0x834e('0x43')](function(_0x5d5ac2){_0x86ad2b=_0x5d5ac2;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x86ad2b['id']);return createTicket(_0x3e0550,_0x363675,_0x86ad2b,_0x4a8b32,_0x4549ba,_0x4a8b32[_0x834e('0x51')],_0x344b51);})[_0x834e('0x43')](function(_0x5160c4){_0x396bbe=_0x5160c4;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x396bbe['id']);var _0x5a2924=util[_0x834e('0x20')](_0x834e('0x54'),_0x3e0550[_0x834e('0x21')],_['split'](_0x396bbe['id'],'x')[0x1]);logger[_0x834e('0x19')](_0x834e('0x55'),_0x834e('0x56'));emit(util[_0x834e('0x20')](_0x834e('0x57'),_0x1ad7fe[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5a2924});})[_0x834e('0x28')](function(_0x208c21){logger[_0x834e('0x27')](_0x834e('0x55'),JSON[_0x834e('0x25')](_0x208c21));});};exports[_0x834e('0x59')]=function(_0x1659c8,_0x460a7a,_0x17b8e3,_0x297cce,_0x14ed83,_0x193a15,_0x3e3467){var _0xed4081,_0x2cb233,_0x5c83eb,_0x2145cf;_0x193a15[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x193a15[_0x834e('0x21')]);_0x193a15['serverUrl']=intUtil[_0x834e('0x5a')](_0x193a15['serverUrl']);if(_0x3e3467&&_0x3e3467['recordingFormat']&&_0x3e3467[_0x834e('0x5b')]!==_0x834e('0x5c')){logger[_0x834e('0x19')](_0x834e('0x5d'),_0x834e('0x4a'));_0x460a7a[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x193a15['serverUrl'],_0x460a7a[_0x834e('0x5e')],md5(_0x460a7a['uniqueid']));}return getConnection(_0x193a15)[_0x834e('0x43')](function(_0xd35dda){_0x2145cf=_0xd35dda;return getUser(_0x193a15,_0x297cce['email'],_0x2145cf);})['then'](function(_0x4a4def){_0xed4081=_0x4a4def;logger[_0x834e('0x19')](_0x834e('0x4f'),_0xed4081['id']);return getEndUser(_0x193a15,_0x460a7a[_0x834e('0x5f')],_0x460a7a[_0x834e('0x60')],_0x2145cf);})['then'](function(_0x2b0d93){_0x2cb233=_0x2b0d93;logger[_0x834e('0x19')](_0x834e('0x61'),_0x2cb233['id']);return createTicket(_0x193a15,_0xed4081,_0x2cb233,_0x17b8e3,_0x460a7a,_0x17b8e3[_0x834e('0x51')],_0x2145cf);})[_0x834e('0x43')](function(_0x28b5c9){_0x5c83eb=_0x28b5c9;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x5c83eb['id']);var _0x5b2bf6=util[_0x834e('0x20')](_0x834e('0x54'),_0x193a15[_0x834e('0x21')],_[_0x834e('0x62')](_0x5c83eb['id'],'x')[0x1]);logger['info'](_0x834e('0x5d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x297cce[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5b2bf6});})['catch'](function(_0x2645df){logger[_0x834e('0x27')]('[OUTBOUND]',JSON[_0x834e('0x25')](_0x2645df));});};exports[_0x834e('0x63')]=function(_0x4b88e7,_0x5df169,_0x346be5,_0x2a42a3,_0x8bc7d9,_0x44c909){var _0x1d8e7,_0x493239,_0x264a6f,_0x520367;_0x44c909[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x21')]);_0x44c909['serverUrl']=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x4c')]);if(_0x8bc7d9&&_0x8bc7d9['monitor_format']){logger[_0x834e('0x19')]('['+_0x5df169[_0x834e('0x64')][_0x834e('0x65')]()+']','Recording\x20is\x20enabled!');_0x5df169[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x44c909[_0x834e('0x4c')],_0x5df169[_0x834e('0x5e')],md5(_0x5df169[_0x834e('0x5e')]));}else{_0x5df169[_0x834e('0x4d')]='';}return getConnection(_0x44c909)[_0x834e('0x43')](function(_0xd49002){_0x520367=_0xd49002;return getUser(_0x44c909,'',_0x520367);})[_0x834e('0x43')](function(_0x57d898){_0x1d8e7=_0x57d898;logger['info']('The\x20User\x20ID\x20is:',_0x1d8e7['id']);return getEndUser(_0x44c909,_0x5df169[_0x834e('0x66')],_0x5df169[_0x834e('0x50')],_0x520367);})[_0x834e('0x43')](function(_0x37fa2c){_0x493239=_0x37fa2c;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x493239['id']);return createTicket(_0x44c909,_0x1d8e7,_0x493239,_0x346be5,_0x5df169,_0x346be5['Fields'],_0x520367);})[_0x834e('0x43')](function(_0x1ad428){_0x264a6f=_0x1ad428;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')]('The\x20Ticket\x20ID\x20is:',_0x264a6f['id']);})[_0x834e('0x28')](function(_0x2b162a){logger[_0x834e('0x27')]('['+_0x5df169['lastevent'][_0x834e('0x65')]()+']',JSON[_0x834e('0x25')](_0x2b162a));});}; \ No newline at end of file +var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','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','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ 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 3125075..e8d20b7 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 _0xa812=['recordingFormat','none','Recording\x20is\x20enabled!','uniqueid','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','[OUTBOUND]','newTab','%s/agent/tickets/%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','calleridname','calleridnum','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','remoteUri','POST','Tags','name','getString','Descriptions','Fields','then','Ticket\x20created!','validateEmail','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','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','results','filter','end-user','length','first','Caller\x20-\x20%s','Enduser\x20created.','authType','%s:%s','username','password','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','map','string','picklist','type','customField','nameField','toLowerCase','content','includes','custom_fields','push','idField','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound'];(function(_0x413398,_0x3f09fd){var _0x477f77=function(_0x2dbfb5){while(--_0x2dbfb5){_0x413398['push'](_0x413398['shift']());}};_0x477f77(++_0x3f09fd);}(_0xa812,0x7e));var _0x2a81=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa812[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x2a81('0x0'));var rp=require('request-promise');var md5=require(_0x2a81('0x1'));var util=require(_0x2a81('0x2'));var Redis=require(_0x2a81('0x3'));var intUtil=require(_0x2a81('0x4'));var config=require(_0x2a81('0x5'));var logger=require(_0x2a81('0x6'))(_0x2a81('0x7'));config[_0x2a81('0x8')]=_[_0x2a81('0x9')](config[_0x2a81('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x2a81('0xa'))(new Redis(config[_0x2a81('0x8')]));function emit(_0x4a1d1c,_0x1c9f01,_0x4e7c6c){io['to'](_0x4a1d1c)[_0x2a81('0xb')](_0x1c9f01,_0x4e7c6c);}var headers={'Content-Type':_0x2a81('0xc'),'Accept':_0x2a81('0xc')};function getTicket(_0x395b17,_0x491bf1,_0x36b191,_0xa6323a,_0x61f1b){logger[_0x2a81('0xd')](_0x2a81('0xe'));return request({'uri':util[_0x2a81('0xf')]('%s/tickets.json',_0x395b17[_0x2a81('0x10')]),'method':_0x2a81('0x11'),'body':{'ticket':_['merge']({'requester_id':_0x36b191['id'],'submitter_id':_0x491bf1?_0x491bf1['id']:undefined,'assignee_id':_0x491bf1?_0x491bf1['id']:undefined,'tags':getTags(_0xa6323a[_0x2a81('0x12')],_0x2a81('0x13')),'subject':intUtil[_0x2a81('0x14')](_0xa6323a['Subjects'],_0x61f1b,'\x20'),'description':intUtil[_0x2a81('0x14')](_0xa6323a[_0x2a81('0x15')],_0x61f1b,'\x0a'),'comment':{'public':![],'body':intUtil[_0x2a81('0x14')](_0xa6323a['Descriptions'],_0x61f1b,'\x0a')}},getCustomFields(_0xa6323a[_0x2a81('0x16')],_0x61f1b))}})[_0x2a81('0x17')](function(_0x3f25f2){logger[_0x2a81('0xd')](_0x2a81('0x18'));return _0x3f25f2['ticket'];});}function getUser(_0x43bdfa,_0x5bf07e){if(intUtil[_0x2a81('0x19')](_0x5bf07e)){logger[_0x2a81('0xd')]('Getting\x20agent\x20with\x20email',_0x5bf07e);return request({'uri':util[_0x2a81('0xf')](_0x2a81('0x1a'),_0x43bdfa['remoteUri']),'qs':{'query':util['format'](_0x2a81('0x1b'),_0x5bf07e)}})[_0x2a81('0x17')](function(_0x30470d){if(_0x30470d[_0x2a81('0x1c')]){logger['info'](_0x2a81('0x1d'));return _['find'](_0x30470d['results'],{'email':_0x5bf07e,'role':_0x2a81('0x1e')});}else{logger[_0x2a81('0xd')](_0x2a81('0x1f'));return request({'uri':util[_0x2a81('0xf')](_0x2a81('0x20'),_0x43bdfa['remoteUri'])})[_0x2a81('0x17')](function(_0x3527f7){logger[_0x2a81('0xd')](_0x2a81('0x21'));return _0x3527f7[_0x2a81('0x22')];});}});}else{logger[_0x2a81('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x2a81('0x20'),_0x43bdfa['remoteUri'])})[_0x2a81('0x17')](function(_0x283bba){logger[_0x2a81('0xd')]('Admin\x20account\x20selected.');return _0x283bba[_0x2a81('0x22')];});}}function getEndUser(_0x7e2478,_0x5dc4af,_0x1399ef){logger[_0x2a81('0xd')](_0x2a81('0x23'),_0x1399ef);return request({'uri':util['format'](_0x2a81('0x1a'),_0x7e2478[_0x2a81('0x10')]),'qs':{'query':util[_0x2a81('0xf')](_0x2a81('0x24'),_0x1399ef)}})[_0x2a81('0x17')](function(_0x491997){var _0x59205e;if(_0x491997[_0x2a81('0x25')]['length']){_0x491997[_0x2a81('0x25')]=_[_0x2a81('0x26')](_0x491997[_0x2a81('0x25')],{'suspended':![],'role':_0x2a81('0x27')});if(_0x491997[_0x2a81('0x25')][_0x2a81('0x28')]){_0x59205e=_[_0x2a81('0x29')](_0x491997[_0x2a81('0x25')]);}}if(_0x59205e){logger[_0x2a81('0xd')]('Enduser\x20found!');return _0x59205e;}else{logger[_0x2a81('0xd')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format']('%s/users.json',_0x7e2478[_0x2a81('0x10')]),'method':'POST','body':{'user':{'role':_0x2a81('0x27'),'name':util[_0x2a81('0xf')](_0x2a81('0x2a'),_0x5dc4af||_0x1399ef),'phone':_0x1399ef}}})[_0x2a81('0x17')](function(_0x51a489){logger[_0x2a81('0xd')](_0x2a81('0x2b'));return _0x51a489[_0x2a81('0x22')];});}});}function getAuth(_0x56f2e2){var _0x666495;if(_0x56f2e2[_0x2a81('0x2c')]==='password'){_0x666495=util[_0x2a81('0xf')](_0x2a81('0x2d'),_0x56f2e2[_0x2a81('0x2e')],_0x56f2e2[_0x2a81('0x2f')]);}else if(_0x56f2e2[_0x2a81('0x2c')]==='token'){_0x666495=util[_0x2a81('0xf')](_0x2a81('0x30'),_0x56f2e2[_0x2a81('0x2e')],_0x56f2e2['token']);}return util['format'](_0x2a81('0x31'),new Buffer(_0x666495)[_0x2a81('0x32')](_0x2a81('0x33')));}function request(_0x3b7cfb){logger[_0x2a81('0x34')](_0x2a81('0x35'),JSON[_0x2a81('0x36')](_0x3b7cfb));return rp(_[_0x2a81('0x9')](_0x3b7cfb,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x5c3efc,_0x2798cc){var _0x1c84a4=[];if(_0x5c3efc&&_0x5c3efc[_0x2a81('0x28')]>0x0){_0x1c84a4=_[_0x2a81('0x37')](_0x5c3efc,_0x2798cc);}return _0x1c84a4;}function getCustomFields(_0x47e479,_0x2c5901){var _0x5b7fdc=[];var _0x133b87={'custom_fields':[]};if(_0x47e479[_0x2a81('0x28')]>0x0){_['forEach'](_0x47e479,function(_0x1f6bdc){if(_['includes']([_0x2a81('0x38'),_0x2a81('0x39')],_0x1f6bdc[_0x2a81('0x3a')])&&_0x1f6bdc['nameField']&&!_0x1f6bdc[_0x2a81('0x3b')]){_0x133b87[_0x1f6bdc[_0x2a81('0x3c')][_0x2a81('0x3d')]()]=_0x1f6bdc[_0x2a81('0x3e')]['toString']();}else if(_[_0x2a81('0x3f')]([_0x2a81('0x38'),_0x2a81('0x39')],_0x1f6bdc['type'])&&_0x1f6bdc['idField']&&_0x1f6bdc[_0x2a81('0x3b')]){_0x133b87[_0x2a81('0x40')][_0x2a81('0x41')]({'id':_0x1f6bdc[_0x2a81('0x42')],'value':_0x1f6bdc['content']['toString']()});}else if(_0x1f6bdc[_0x2a81('0x3a')]===_0x2a81('0x43')&&_0x1f6bdc[_0x2a81('0x44')]&&_0x1f6bdc[_0x2a81('0x42')]&&_0x1f6bdc['customField']){_0x2c5901[_0x1f6bdc[_0x2a81('0x44')]]&&_0x133b87['custom_fields'][_0x2a81('0x41')]({'id':_0x1f6bdc[_0x2a81('0x42')],'value':_0x2c5901[_0x1f6bdc[_0x2a81('0x44')]][_0x2a81('0x32')]()});}else if(_0x1f6bdc[_0x2a81('0x3a')]===_0x2a81('0x45')&&_0x1f6bdc[_0x2a81('0x46')]&&_0x1f6bdc['Variable'][_0x2a81('0x13')]&&_0x1f6bdc[_0x2a81('0x42')]&&_0x1f6bdc['customField']){_0x2c5901[_0x1f6bdc[_0x2a81('0x46')][_0x2a81('0x13')]['toLowerCase']()]&&_0x133b87[_0x2a81('0x40')]['push']({'id':_0x1f6bdc['idField'],'value':_0x2c5901[_0x1f6bdc[_0x2a81('0x46')][_0x2a81('0x13')][_0x2a81('0x3d')]()]['toString']()});}});}return _0x133b87;}exports[_0x2a81('0x47')]=function(_0x261a02,_0x1e33b5,_0x26ef87,_0x713689,_0x1d6e2e,_0x31a6b9){var _0x248119,_0x50ff02;_0x31a6b9['remoteUri']=intUtil[_0x2a81('0x48')](_0x31a6b9['remoteUri']);_0x31a6b9[_0x2a81('0x49')]=intUtil[_0x2a81('0x48')](_0x31a6b9[_0x2a81('0x49')]);if(_0x1d6e2e&&_0x1d6e2e[_0x2a81('0x4a')]){logger[_0x2a81('0xd')](_0x2a81('0x4b'),'Recording\x20is\x20enabled!');_0x1e33b5[_0x2a81('0x4c')]=util[_0x2a81('0xf')](_0x2a81('0x4d'),_0x31a6b9[_0x2a81('0x49')],_0x1e33b5['uniqueid'],md5(_0x1e33b5['uniqueid']));}else{_0x1e33b5[_0x2a81('0x4c')]='';}headers[_0x2a81('0x4e')]=getAuth(_0x31a6b9);return getUser(_0x31a6b9,_0x713689[_0x2a81('0x4f')])[_0x2a81('0x17')](function(_0x3f14e3){_0x248119=_0x3f14e3;logger[_0x2a81('0xd')]('The\x20User\x20ID\x20is:',_0x248119['id']);return getEndUser(_0x31a6b9,_0x1e33b5['calleridname'],_0x1e33b5['calleridnum']);})['then'](function(_0x464b47){_0x50ff02=_0x464b47;logger[_0x2a81('0xd')]('The\x20Enduser\x20ID\x20is:',_0x50ff02['id']);return getTicket(_0x31a6b9,_0x248119,_0x50ff02,_0x26ef87,_0x1e33b5);})['then'](function(_0x2ff888){if(_0x2ff888){logger[_0x2a81('0xd')](_0x2a81('0x50'),_0x2ff888['id']);switch(_0x31a6b9[_0x2a81('0x3a')]){case _0x2a81('0x51'):logger[_0x2a81('0xd')](_0x2a81('0x4b'),_0x2a81('0x52'));return request({'uri':util[_0x2a81('0xf')](_0x2a81('0x53'),_0x31a6b9[_0x2a81('0x10')],_0x248119['id'],_0x2ff888['id']),'method':_0x2a81('0x11')});case'newTab':logger[_0x2a81('0xd')](_0x2a81('0x4b'),_0x2a81('0x54'));emit(util[_0x2a81('0xf')](_0x2a81('0x55'),_0x713689[_0x2a81('0x13')]),_0x2a81('0x56'),{'uri':util[_0x2a81('0xf')]('%s/agent/tickets/%s',_0x31a6b9['remoteUri']['replace'](_0x2a81('0x57'),''),_0x2ff888['id'])});break;default:logger[_0x2a81('0x58')]('[QUEUE]',_0x2a81('0x59'));}}})[_0x2a81('0x5a')](function(_0x49d2a7){logger['error'](_0x2a81('0x5b'),util[_0x2a81('0x5c')](_0x49d2a7,{'showHidden':!![],'depth':null}));});};exports[_0x2a81('0x5d')]=function(_0x58c720,_0x544601,_0x5c38c9,_0x138aa9,_0x1fef90,_0x57f9fa,_0x1f6092){var _0x381cc7,_0x2763fb;_0x57f9fa[_0x2a81('0x10')]=intUtil[_0x2a81('0x48')](_0x57f9fa[_0x2a81('0x10')]);_0x57f9fa[_0x2a81('0x49')]=intUtil[_0x2a81('0x48')](_0x57f9fa[_0x2a81('0x49')]);if(_0x1f6092&&_0x1f6092['recordingFormat']&&_0x1f6092[_0x2a81('0x5e')]!==_0x2a81('0x5f')){logger['info']('[OUTBOUND]',_0x2a81('0x60'));_0x544601[_0x2a81('0x4c')]=util[_0x2a81('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x57f9fa[_0x2a81('0x49')],_0x544601[_0x2a81('0x61')],md5(_0x544601['uniqueid']));}headers['Authorization']=getAuth(_0x57f9fa);return getUser(_0x57f9fa,_0x138aa9['email'])['then'](function(_0x4c64c3){_0x381cc7=_0x4c64c3;logger[_0x2a81('0xd')](_0x2a81('0x62'),_0x381cc7['id']);return getEndUser(_0x57f9fa,_0x544601[_0x2a81('0x63')],_0x544601[_0x2a81('0x64')]);})[_0x2a81('0x17')](function(_0x1c1548){_0x2763fb=_0x1c1548;logger[_0x2a81('0xd')](_0x2a81('0x65'),_0x2763fb['id']);return getTicket(_0x57f9fa,_0x381cc7,_0x2763fb,_0x5c38c9,_0x544601);})[_0x2a81('0x17')](function(_0x3c93de){if(_0x3c93de){logger[_0x2a81('0xd')]('The\x20Ticket\x20ID\x20is:',_0x3c93de['id']);switch(_0x57f9fa[_0x2a81('0x3a')]){case'integrationTab':logger[_0x2a81('0xd')](_0x2a81('0x66'),_0x2a81('0x52'));return request({'uri':util[_0x2a81('0xf')](_0x2a81('0x53'),_0x57f9fa[_0x2a81('0x10')],_0x381cc7['id'],_0x3c93de['id']),'method':_0x2a81('0x11')});case _0x2a81('0x67'):logger[_0x2a81('0xd')]('[OUTBOUND]',_0x2a81('0x54'));emit(util['format'](_0x2a81('0x55'),_0x138aa9[_0x2a81('0x13')]),_0x2a81('0x56'),{'uri':util[_0x2a81('0xf')](_0x2a81('0x68'),_0x57f9fa[_0x2a81('0x10')]['replace'](_0x2a81('0x57'),''),_0x3c93de['id'])});break;default:logger[_0x2a81('0x58')]('[OUTBOUND]',_0x2a81('0x59'));}}})[_0x2a81('0x5a')](function(_0x27ef2f){logger[_0x2a81('0x58')](_0x2a81('0x69'),util['inspect'](_0x27ef2f,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x2557f9,_0x4315dd,_0x23d418,_0x101b72,_0x4f6f2e,_0x2d37d5){var _0x4e28ba,_0x33aff5;_0x2d37d5[_0x2a81('0x10')]=intUtil[_0x2a81('0x48')](_0x2d37d5[_0x2a81('0x10')]);_0x2d37d5[_0x2a81('0x49')]=intUtil[_0x2a81('0x48')](_0x2d37d5[_0x2a81('0x49')]);if(_0x4f6f2e&&_0x4f6f2e[_0x2a81('0x4a')]){logger[_0x2a81('0xd')]('['+_0x4315dd['lastevent']['toUpperCase']()+']',_0x2a81('0x60'));_0x4315dd[_0x2a81('0x4c')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2d37d5['serverUrl'],_0x4315dd[_0x2a81('0x61')],md5(_0x4315dd[_0x2a81('0x61')]));}else{_0x4315dd['recordingURL']='';}headers[_0x2a81('0x4e')]=getAuth(_0x2d37d5);return getUser(_0x2d37d5)[_0x2a81('0x17')](function(_0x425c15){_0x4e28ba=_0x425c15;logger[_0x2a81('0xd')](_0x2a81('0x62'),_0x4e28ba['id']);return getEndUser(_0x2d37d5,_0x4315dd[_0x2a81('0x6a')],_0x4315dd[_0x2a81('0x6b')]);})[_0x2a81('0x17')](function(_0x2fd9bf){_0x33aff5=_0x2fd9bf;logger[_0x2a81('0xd')](_0x2a81('0x65'),_0x33aff5['id']);return getTicket(_0x2d37d5,_0x4e28ba,_0x33aff5,_0x23d418,_0x4315dd);})[_0x2a81('0x17')](function(_0x198e8d){if(_0x198e8d){logger[_0x2a81('0xd')](_0x2a81('0x50'),_0x198e8d['id']);}})[_0x2a81('0x5a')](function(_0x2df5e4){logger[_0x2a81('0x58')]('['+_0x4315dd['lastevent'][_0x2a81('0x6c')]()+']'+_0x2a81('0x6d'),util[_0x2a81('0x5c')](_0x2df5e4,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xd187=['getString','Descriptions','Fields','then','ticket','Getting\x20agent\x20with\x20email','%s/search.json','Agent\x20found!','find','results','agent','user','%s/users/me.json','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','username','token','%s/token:%s','Basic\x20%s','base64','debug','stringify','GET','map','forEach','string','picklist','type','nameField','toLowerCase','toString','includes','customField','custom_fields','content','variableName','idField','push','customVariable','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridname','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','replace','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[OUTBOUND]','user:%s','%s/agent/tickets/%s','error','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','toUpperCase','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','application/json','info','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','Subjects'];(function(_0x421196,_0x1cbd94){var _0x2738af=function(_0xc956ff){while(--_0xc956ff){_0x421196['push'](_0x421196['shift']());}};_0x2738af(++_0x1cbd94);}(_0xd187,0xc6));var _0x7d18=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xd187[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0x7d18('0x0'));var rp=require('request-promise');var md5=require(_0x7d18('0x1'));var util=require(_0x7d18('0x2'));var Redis=require(_0x7d18('0x3'));var intUtil=require(_0x7d18('0x4'));var config=require(_0x7d18('0x5'));var logger=require(_0x7d18('0x6'))('zendesk');config[_0x7d18('0x7')]=_[_0x7d18('0x8')](config['redis'],{'host':_0x7d18('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x3c6995,_0x29b7ec,_0x446b1e){io['to'](_0x3c6995)['emit'](_0x29b7ec,_0x446b1e);}var headers={'Content-Type':_0x7d18('0xa'),'Accept':'application/json'};function getTicket(_0x1eeba5,_0x2c8dce,_0x393363,_0x5b9626,_0x166ae7){logger[_0x7d18('0xb')]('Creating\x20new\x20ticket...');return request({'uri':util[_0x7d18('0xc')](_0x7d18('0xd'),_0x1eeba5[_0x7d18('0xe')]),'method':_0x7d18('0xf'),'body':{'ticket':_[_0x7d18('0x10')]({'requester_id':_0x393363['id'],'submitter_id':_0x2c8dce?_0x2c8dce['id']:undefined,'assignee_id':_0x2c8dce?_0x2c8dce['id']:undefined,'tags':getTags(_0x5b9626[_0x7d18('0x11')],_0x7d18('0x12')),'subject':intUtil['getString'](_0x5b9626[_0x7d18('0x13')],_0x166ae7,'\x20'),'description':intUtil[_0x7d18('0x14')](_0x5b9626[_0x7d18('0x15')],_0x166ae7,'\x0a'),'comment':{'public':![],'body':intUtil[_0x7d18('0x14')](_0x5b9626[_0x7d18('0x15')],_0x166ae7,'\x0a')}},getCustomFields(_0x5b9626[_0x7d18('0x16')],_0x166ae7))}})[_0x7d18('0x17')](function(_0x4895f6){logger[_0x7d18('0xb')]('Ticket\x20created!');return _0x4895f6[_0x7d18('0x18')];});}function getUser(_0x4074c4,_0xf7c495){if(intUtil['validateEmail'](_0xf7c495)){logger[_0x7d18('0xb')](_0x7d18('0x19'),_0xf7c495);return request({'uri':util[_0x7d18('0xc')](_0x7d18('0x1a'),_0x4074c4[_0x7d18('0xe')]),'qs':{'query':util[_0x7d18('0xc')]('type:user\x20role:agent\x20email:%s',_0xf7c495)}})[_0x7d18('0x17')](function(_0x22611a){if(_0x22611a['count']){logger[_0x7d18('0xb')](_0x7d18('0x1b'));return _[_0x7d18('0x1c')](_0x22611a[_0x7d18('0x1d')],{'email':_0xf7c495,'role':_0x7d18('0x1e')});}else{logger[_0x7d18('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format']('%s/users/me.json',_0x4074c4['remoteUri'])})[_0x7d18('0x17')](function(_0x46ab04){logger[_0x7d18('0xb')]('Admin\x20account\x20selected.');return _0x46ab04[_0x7d18('0x1f')];});}});}else{logger[_0x7d18('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x7d18('0xc')](_0x7d18('0x20'),_0x4074c4['remoteUri'])})[_0x7d18('0x17')](function(_0x3d092e){logger[_0x7d18('0xb')](_0x7d18('0x21'));return _0x3d092e[_0x7d18('0x1f')];});}}function getEndUser(_0x182c38,_0x48df75,_0x8eec96){logger[_0x7d18('0xb')](_0x7d18('0x22'),_0x8eec96);return request({'uri':util[_0x7d18('0xc')]('%s/search.json',_0x182c38['remoteUri']),'qs':{'query':util['format'](_0x7d18('0x23'),_0x8eec96)}})[_0x7d18('0x17')](function(_0x363048){var _0x215b4a;if(_0x363048[_0x7d18('0x1d')][_0x7d18('0x24')]){_0x363048[_0x7d18('0x1d')]=_[_0x7d18('0x25')](_0x363048['results'],{'suspended':![],'role':_0x7d18('0x26')});if(_0x363048[_0x7d18('0x1d')][_0x7d18('0x24')]){_0x215b4a=_[_0x7d18('0x27')](_0x363048['results']);}}if(_0x215b4a){logger[_0x7d18('0xb')](_0x7d18('0x28'));return _0x215b4a;}else{logger[_0x7d18('0xb')](_0x7d18('0x29'));return request({'uri':util[_0x7d18('0xc')](_0x7d18('0x2a'),_0x182c38[_0x7d18('0xe')]),'method':_0x7d18('0xf'),'body':{'user':{'role':_0x7d18('0x26'),'name':util['format'](_0x7d18('0x2b'),_0x48df75||_0x8eec96),'phone':_0x8eec96}}})[_0x7d18('0x17')](function(_0x10dc78){logger[_0x7d18('0xb')](_0x7d18('0x2c'));return _0x10dc78[_0x7d18('0x1f')];});}});}function getAuth(_0x529321){var _0x56a419;if(_0x529321[_0x7d18('0x2d')]===_0x7d18('0x2e')){_0x56a419=util[_0x7d18('0xc')]('%s:%s',_0x529321[_0x7d18('0x2f')],_0x529321[_0x7d18('0x2e')]);}else if(_0x529321['authType']===_0x7d18('0x30')){_0x56a419=util[_0x7d18('0xc')](_0x7d18('0x31'),_0x529321['username'],_0x529321[_0x7d18('0x30')]);}return util[_0x7d18('0xc')](_0x7d18('0x32'),new Buffer(_0x56a419)['toString'](_0x7d18('0x33')));}function request(_0x961c51){logger[_0x7d18('0x34')]('[HTTP]',JSON[_0x7d18('0x35')](_0x961c51));return rp(_[_0x7d18('0x8')](_0x961c51,{'method':_0x7d18('0x36'),'headers':headers,'json':!![]}));}function getTags(_0x485951,_0xa0dfc8){var _0x5ec4e8=[];if(_0x485951&&_0x485951[_0x7d18('0x24')]>0x0){_0x5ec4e8=_[_0x7d18('0x37')](_0x485951,_0xa0dfc8);}return _0x5ec4e8;}function getCustomFields(_0x52d8e4,_0x5b87f2){var _0x3d81f8=[];var _0x3b50dd={'custom_fields':[]};if(_0x52d8e4['length']>0x0){_[_0x7d18('0x38')](_0x52d8e4,function(_0x5d7fcc){if(_['includes']([_0x7d18('0x39'),_0x7d18('0x3a')],_0x5d7fcc[_0x7d18('0x3b')])&&_0x5d7fcc[_0x7d18('0x3c')]&&!_0x5d7fcc['customField']){_0x3b50dd[_0x5d7fcc[_0x7d18('0x3c')][_0x7d18('0x3d')]()]=_0x5d7fcc['content'][_0x7d18('0x3e')]();}else if(_[_0x7d18('0x3f')](['string',_0x7d18('0x3a')],_0x5d7fcc[_0x7d18('0x3b')])&&_0x5d7fcc['idField']&&_0x5d7fcc[_0x7d18('0x40')]){_0x3b50dd[_0x7d18('0x41')]['push']({'id':_0x5d7fcc['idField'],'value':_0x5d7fcc[_0x7d18('0x42')][_0x7d18('0x3e')]()});}else if(_0x5d7fcc[_0x7d18('0x3b')]==='variable'&&_0x5d7fcc[_0x7d18('0x43')]&&_0x5d7fcc[_0x7d18('0x44')]&&_0x5d7fcc[_0x7d18('0x40')]){_0x5b87f2[_0x5d7fcc[_0x7d18('0x43')]]&&_0x3b50dd[_0x7d18('0x41')][_0x7d18('0x45')]({'id':_0x5d7fcc[_0x7d18('0x44')],'value':_0x5b87f2[_0x5d7fcc[_0x7d18('0x43')]][_0x7d18('0x3e')]()});}else if(_0x5d7fcc[_0x7d18('0x3b')]===_0x7d18('0x46')&&_0x5d7fcc['Variable']&&_0x5d7fcc['Variable'][_0x7d18('0x12')]&&_0x5d7fcc[_0x7d18('0x44')]&&_0x5d7fcc[_0x7d18('0x40')]){_0x5b87f2[_0x5d7fcc[_0x7d18('0x47')]['name'][_0x7d18('0x3d')]()]&&_0x3b50dd['custom_fields'][_0x7d18('0x45')]({'id':_0x5d7fcc['idField'],'value':_0x5b87f2[_0x5d7fcc[_0x7d18('0x47')][_0x7d18('0x12')][_0x7d18('0x3d')]()][_0x7d18('0x3e')]()});}});}return _0x3b50dd;}exports['queue']=function(_0x25ea49,_0x4e8440,_0x46138a,_0x2adc2a,_0x433255,_0x3c7389){var _0x2607ed,_0x5269ff;_0x3c7389['remoteUri']=intUtil[_0x7d18('0x48')](_0x3c7389['remoteUri']);_0x3c7389['serverUrl']=intUtil[_0x7d18('0x48')](_0x3c7389[_0x7d18('0x49')]);if(_0x433255&&_0x433255[_0x7d18('0x4a')]){logger['info'](_0x7d18('0x4b'),_0x7d18('0x4c'));_0x4e8440['recordingURL']=util['format'](_0x7d18('0x4d'),_0x3c7389[_0x7d18('0x49')],_0x4e8440['uniqueid'],md5(_0x4e8440[_0x7d18('0x4e')]));}else{_0x4e8440[_0x7d18('0x4f')]='';}headers[_0x7d18('0x50')]=getAuth(_0x3c7389);return getUser(_0x3c7389,_0x2adc2a[_0x7d18('0x51')])[_0x7d18('0x17')](function(_0x4cd500){_0x2607ed=_0x4cd500;logger['info'](_0x7d18('0x52'),_0x2607ed['id']);return getEndUser(_0x3c7389,_0x4e8440[_0x7d18('0x53')],_0x4e8440['calleridnum']);})[_0x7d18('0x17')](function(_0x2fe6fe){_0x5269ff=_0x2fe6fe;logger[_0x7d18('0xb')]('The\x20Enduser\x20ID\x20is:',_0x5269ff['id']);return getTicket(_0x3c7389,_0x2607ed,_0x5269ff,_0x46138a,_0x4e8440);})['then'](function(_0x690e){if(_0x690e){logger[_0x7d18('0xb')]('The\x20Ticket\x20ID\x20is:',_0x690e['id']);switch(_0x3c7389[_0x7d18('0x3b')]){case'integrationTab':logger[_0x7d18('0xb')](_0x7d18('0x4b'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x7d18('0xc')](_0x7d18('0x54'),_0x3c7389[_0x7d18('0xe')],_0x2607ed['id'],_0x690e['id']),'method':_0x7d18('0xf')});case _0x7d18('0x55'):logger[_0x7d18('0xb')]('[QUEUE]',_0x7d18('0x56'));emit(util[_0x7d18('0xc')]('user:%s',_0x2adc2a[_0x7d18('0x12')]),_0x7d18('0x57'),{'uri':util['format']('%s/agent/tickets/%s',_0x3c7389[_0x7d18('0xe')][_0x7d18('0x58')](_0x7d18('0x59'),''),_0x690e['id'])});break;default:logger['error'](_0x7d18('0x4b'),_0x7d18('0x5a'));}}})[_0x7d18('0x5b')](function(_0x2be7cd){logger['error'](_0x7d18('0x5c'),util[_0x7d18('0x5d')](_0x2be7cd,{'showHidden':!![],'depth':null}));});};exports[_0x7d18('0x5e')]=function(_0x3a25be,_0x364b7d,_0x416f91,_0x2f4b80,_0x252c8c,_0x122134,_0x1fb1b1){var _0x16a3d7,_0x37735e;_0x122134[_0x7d18('0xe')]=intUtil[_0x7d18('0x48')](_0x122134[_0x7d18('0xe')]);_0x122134[_0x7d18('0x49')]=intUtil['stripTrailingSlash'](_0x122134[_0x7d18('0x49')]);if(_0x1fb1b1&&_0x1fb1b1['recordingFormat']&&_0x1fb1b1[_0x7d18('0x5f')]!==_0x7d18('0x60')){logger['info']('[OUTBOUND]',_0x7d18('0x4c'));_0x364b7d[_0x7d18('0x4f')]=util[_0x7d18('0xc')](_0x7d18('0x4d'),_0x122134['serverUrl'],_0x364b7d[_0x7d18('0x4e')],md5(_0x364b7d[_0x7d18('0x4e')]));}headers[_0x7d18('0x50')]=getAuth(_0x122134);return getUser(_0x122134,_0x2f4b80['email'])[_0x7d18('0x17')](function(_0x5970b1){_0x16a3d7=_0x5970b1;logger['info']('The\x20User\x20ID\x20is:',_0x16a3d7['id']);return getEndUser(_0x122134,_0x364b7d['destcalleridname'],_0x364b7d['destcalleridnum']);})[_0x7d18('0x17')](function(_0x40aac8){_0x37735e=_0x40aac8;logger[_0x7d18('0xb')](_0x7d18('0x61'),_0x37735e['id']);return getTicket(_0x122134,_0x16a3d7,_0x37735e,_0x416f91,_0x364b7d);})[_0x7d18('0x17')](function(_0x2eda1c){if(_0x2eda1c){logger[_0x7d18('0xb')](_0x7d18('0x62'),_0x2eda1c['id']);switch(_0x122134[_0x7d18('0x3b')]){case _0x7d18('0x63'):logger[_0x7d18('0xb')](_0x7d18('0x64'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x7d18('0xc')](_0x7d18('0x54'),_0x122134[_0x7d18('0xe')],_0x16a3d7['id'],_0x2eda1c['id']),'method':_0x7d18('0xf')});case _0x7d18('0x55'):logger[_0x7d18('0xb')](_0x7d18('0x64'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x7d18('0xc')](_0x7d18('0x65'),_0x2f4b80[_0x7d18('0x12')]),_0x7d18('0x57'),{'uri':util['format'](_0x7d18('0x66'),_0x122134[_0x7d18('0xe')]['replace']('/api/v2',''),_0x2eda1c['id'])});break;default:logger[_0x7d18('0x67')](_0x7d18('0x64'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x7d18('0x5b')](function(_0x394958){logger[_0x7d18('0x67')](_0x7d18('0x68'),util[_0x7d18('0x5d')](_0x394958,{'showHidden':!![],'depth':null}));});};exports[_0x7d18('0x69')]=function(_0x38feba,_0x2cad73,_0x249cf2,_0x119c4a,_0x426297,_0x4eafa9){var _0x34d562,_0x26c1f8;_0x4eafa9[_0x7d18('0xe')]=intUtil[_0x7d18('0x48')](_0x4eafa9[_0x7d18('0xe')]);_0x4eafa9['serverUrl']=intUtil[_0x7d18('0x48')](_0x4eafa9[_0x7d18('0x49')]);if(_0x426297&&_0x426297['monitor_format']){logger[_0x7d18('0xb')]('['+_0x2cad73['lastevent'][_0x7d18('0x6a')]()+']',_0x7d18('0x4c'));_0x2cad73[_0x7d18('0x4f')]=util[_0x7d18('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4eafa9['serverUrl'],_0x2cad73[_0x7d18('0x4e')],md5(_0x2cad73[_0x7d18('0x4e')]));}else{_0x2cad73['recordingURL']='';}headers[_0x7d18('0x50')]=getAuth(_0x4eafa9);return getUser(_0x4eafa9)[_0x7d18('0x17')](function(_0x4c1f60){_0x34d562=_0x4c1f60;logger[_0x7d18('0xb')]('The\x20User\x20ID\x20is:',_0x34d562['id']);return getEndUser(_0x4eafa9,_0x2cad73[_0x7d18('0x53')],_0x2cad73['calleridnum']);})[_0x7d18('0x17')](function(_0x2c86a6){_0x26c1f8=_0x2c86a6;logger[_0x7d18('0xb')](_0x7d18('0x61'),_0x26c1f8['id']);return getTicket(_0x4eafa9,_0x34d562,_0x26c1f8,_0x249cf2,_0x2cad73);})[_0x7d18('0x17')](function(_0x5250c4){if(_0x5250c4){logger[_0x7d18('0xb')](_0x7d18('0x62'),_0x5250c4['id']);}})[_0x7d18('0x5b')](function(_0x4d0526){logger['error']('['+_0x2cad73[_0x7d18('0x6b')][_0x7d18('0x6a')]()+']'+_0x7d18('0x6c'),util[_0x7d18('0x5d')](_0x4d0526,{'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 a3321d1..1a7ac30 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 _0xb477=['https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','/downloads?type=uniqueid&token=','Outbound','The\x20Call\x20ID\x20is:','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','moment','bluebird','../../../../config/logger','zoho','defaults','localhost','socket.io-emitter','redis','emit','debug','[HTTP]','stringify','length','forEach','string','idField','content','toString','type','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','expires_in','zone','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','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','catch','error','info','Search\x20user','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','user','profile','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','GET','moduleSearch','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','contact','lead','Leads','nothing','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','utc','answertime','Call_Duration','endtime','YYYY-MM-DDTHH:mm:ss','diff','mm:ss','Call_Result','Called','complete','connect','Answered','Rejected','timeout','Timeout','Call_Start_Time','outbound','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','err','stack','queue','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url'];(function(_0x225915,_0x2eaa2f){var _0x3b8d10=function(_0x4c9dd5){while(--_0x4c9dd5){_0x225915['push'](_0x225915['shift']());}};_0x3b8d10(++_0x2eaa2f);}(_0xb477,0xac));var _0x7b47=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb477[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7b47('0x0'));var rp=require(_0x7b47('0x1'));var md5=require(_0x7b47('0x2'));var util=require(_0x7b47('0x3'));var intUtil=require('./util');var moment=require(_0x7b47('0x4'));var Redis=require('ioredis');var BPromise=require(_0x7b47('0x5'));var config=require('../../../../config/environment');var logger=require(_0x7b47('0x6'))(_0x7b47('0x7'));config['redis']=_[_0x7b47('0x8')](config['redis'],{'host':_0x7b47('0x9'),'port':0x18eb});var io=require(_0x7b47('0xa'))(new Redis(config[_0x7b47('0xb')]));function emit(_0x26d141,_0x78337d,_0x1873b0){io['to'](_0x26d141)[_0x7b47('0xc')](_0x78337d,_0x1873b0);}function request(_0xe949f8){logger[_0x7b47('0xd')](_0x7b47('0xe'),JSON[_0x7b47('0xf')](_0xe949f8));return rp(_0xe949f8);}function getCustomFields(_0x33d456,_0x4b839a){var _0x33f54c={};if(_0x33d456[_0x7b47('0x10')]>0x0){_[_0x7b47('0x11')](_0x33d456,function(_0x3b330e){if(_['includes']([_0x7b47('0x12'),'picklist'],_0x3b330e['type'])&&_0x3b330e[_0x7b47('0x13')]){_0x33f54c[_0x3b330e[_0x7b47('0x13')]]=_0x3b330e[_0x7b47('0x14')][_0x7b47('0x15')]();}else if(_0x3b330e[_0x7b47('0x16')]==='variable'&&_0x3b330e['variableName']&&_0x3b330e[_0x7b47('0x13')]&&_0x4b839a[_0x3b330e[_0x7b47('0x17')]]){_0x33f54c[_0x3b330e['idField']]=_0x4b839a[_0x3b330e[_0x7b47('0x17')]][_0x7b47('0x15')]();}else if(_0x3b330e[_0x7b47('0x16')]===_0x7b47('0x18')&&_0x3b330e['Variable']&&_0x3b330e[_0x7b47('0x19')]['name']&&_0x3b330e['idField']&&_0x4b839a[_0x3b330e[_0x7b47('0x19')][_0x7b47('0x1a')][_0x7b47('0x1b')]()]){_0x33f54c[_0x3b330e[_0x7b47('0x13')]]=_0x4b839a[_0x3b330e[_0x7b47('0x19')][_0x7b47('0x1a')][_0x7b47('0x1b')]()]['toString']();}});}return _0x33f54c;}function getName(_0x593fd3){if(_0x593fd3[_0x7b47('0x1c')]('\x20')>0x0){var _0x20c9a8=_0x593fd3[_0x7b47('0x1d')](/ (.+)/);if(_0x20c9a8[0x1]){return _0x20c9a8;}}return[_0x593fd3,_0x593fd3];}var accountsTokens={};function getAccessToken(_0x547e30){return new Promise(function(_0xcc5ad6,_0x37c336){if(!_['isNil'](accountsTokens[_0x547e30['id']])&&!_[_0x7b47('0x1e')](accountsTokens[_0x547e30['id']][_0x7b47('0x1f')])){if(moment()['isBefore'](accountsTokens[_0x547e30['id']][_0x7b47('0x20')])){_0xcc5ad6(accountsTokens[_0x547e30['id']]['access_token']);}}var _0x52bd76;switch(_0x547e30[_0x7b47('0x21')]){case'US':_0x52bd76=_0x7b47('0x22');break;case'AU':_0x52bd76=_0x7b47('0x23');break;case'EU':_0x52bd76='https://accounts.zoho.eu';break;case'IN':_0x52bd76=_0x7b47('0x24');break;case'CN':_0x52bd76=_0x7b47('0x25');break;default:_0x52bd76=_0x7b47('0x26');break;}var _0x57f1b5={'method':_0x7b47('0x27'),'uri':_0x52bd76+_0x7b47('0x28'),'qs':{'refresh_token':_0x547e30[_0x7b47('0x29')],'client_id':_0x547e30[_0x7b47('0x2a')],'client_secret':_0x547e30[_0x7b47('0x2b')],'grant_type':_0x7b47('0x2c')},'json':!![]};return rp(_0x57f1b5)[_0x7b47('0x2d')](function(_0x517ce3){accountsTokens[_0x547e30['id']]={'access_token':_0x517ce3[_0x7b47('0x1f')],'expires_in':moment()[_0x7b47('0x2e')](_0x517ce3[_0x7b47('0x20')],_0x7b47('0x2f'))};_0xcc5ad6(_0x517ce3['access_token']);})[_0x7b47('0x30')](function(_0x2875e){logger[_0x7b47('0x31')]('Failing\x20creating\x20the\x20access_token',_0x2875e['stack']);_0x37c336(_0x2875e);});});}function getUser(_0x3f9b4d,_0x5b4ac6,_0x1ce284,_0x51516c){logger[_0x7b47('0x32')](_0x7b47('0x33'));return request({'method':'GET','uri':util[_0x7b47('0x34')](_0x7b47('0x35'),_0x5b4ac6),'qs':{'type':_0x7b47('0x36')},'headers':{'Authorization':_0x7b47('0x37')+_0x3f9b4d},'json':!![]})[_0x7b47('0x2d')](function(_0x1a5fa6){if(_0x1a5fa6[_0x7b47('0x38')]){var _0x2525ba=-0x1;if(_[_0x7b47('0x39')](_0x1a5fa6['users'])){if(!_[_0x7b47('0x1e')](_0x51516c)){_0x2525ba=_[_0x7b47('0x3a')](_0x1a5fa6[_0x7b47('0x38')],function(_0x375096){return _0x375096[_0x7b47('0x3b')]===_0x51516c;});}if(_0x2525ba>=0x0){logger['info'](_0x7b47('0x3c'));}else{logger[_0x7b47('0x32')](_0x7b47('0x3d'));_0x2525ba=_[_0x7b47('0x3a')](_0x1a5fa6[_0x7b47('0x38')],function(_0x4c5028){return _0x4c5028['profile'][_0x7b47('0x1a')]===_0x7b47('0x3e');});}return _0x1a5fa6[_0x7b47('0x38')][_0x2525ba];}else{if(_0x1a5fa6[_0x7b47('0x3f')][_0x7b47('0x40')]['name']===_0x7b47('0x3e')){logger['info']('Using\x20the\x20admin\x20account!');user=_0x1a5fa6['user'];return user;}else{logger[_0x7b47('0x31')](_0x7b47('0x41'),JSON[_0x7b47('0xf')](_0x1a5fa6));throw new Error(_0x7b47('0x42')+JSON[_0x7b47('0xf')](_0x1a5fa6));}}}else{logger['error']('The\x20failing\x20result\x20is',JSON['stringify'](_0x1a5fa6));throw new Error(_0x7b47('0x42')+JSON[_0x7b47('0xf')](_0x1a5fa6));}})['catch'](function(_0x398332){console[_0x7b47('0x31')](_0x398332);});}function getZohoUser(_0x291afa,_0x3f9b71){return new BPromise(function(_0x1527b4,_0x1c9a1b){request(_0x291afa)['then'](function(_0x5cb7b5){var _0x4df6a1=null;if(_0x5cb7b5){_0x4df6a1=_0x5cb7b5[_0x7b47('0x43')][0x0];_0x4df6a1[_0x7b47('0x44')]=_0x3f9b71;}_0x1527b4(_0x4df6a1);})[_0x7b47('0x30')](function(_0x6c620f){_0x1c9a1b(_0x6c620f);});});}function createEndUser(_0x466417,_0x348032,_0x530e81,_0x570978,_0x581941,_0x35c14d){var _0x530e81=getName(_0x530e81);return request({'method':_0x7b47('0x27'),'uri':_0x7b47('0x45')+_0x348032+_0x7b47('0x46')+_[_0x7b47('0x47')](_0x35c14d[_0x7b47('0x48')])+'s','body':{'data':[{'Last_Name':_0x530e81[0x1],'First_Name':_0x530e81[0x0],'Phone':_0x570978,'Owner':{'name':!_[_0x7b47('0x1e')](_0x581941[_0x7b47('0x49')][_0x7b47('0x1a')])?_0x581941[_0x7b47('0x49')][_0x7b47('0x1a')]:!_[_0x7b47('0x1e')](_0x581941[_0x7b47('0x4a')])?_0x581941[_0x7b47('0x4a')]+'\x20'+_0x581941[_0x7b47('0x4b')]:_0x581941['last_name'],'id':_0x581941['id']}}]},'headers':{'Authorization':_0x7b47('0x37')+_0x466417},'json':!![]})[_0x7b47('0x2d')](function(_0x148e79){if(_0x148e79&&_0x148e79[_0x7b47('0x43')][0x0][_0x7b47('0x4c')]===_0x7b47('0x4d')){var _0x397ec8=_0x148e79[_0x7b47('0x43')][0x0][_0x7b47('0x4e')];_0x397ec8['enduserType']=_['startCase'](_0x35c14d['moduleCreate'])+'s';return _0x397ec8;}logger[_0x7b47('0x31')](_0x7b47('0x41'),JSON['stringify'](data));throw new Error(_0x7b47('0x4f')+JSON['stringify'](data));})[_0x7b47('0x30')](function(_0x1245ee){console[_0x7b47('0x50')](_0x7b47('0x51'),_0x1245ee);});}function getEndUser(_0x1f7d86,_0x17b335,_0x1bec41,_0x1a1a5b,_0x4ba973,_0x22325d,_0x17e35c){var _0x39d91f={'method':_0x7b47('0x52'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1f7d86},'json':!![]};switch(_0x17e35c[_0x7b47('0x53')]){case'contact_lead':_0x39d91f[_0x7b47('0x54')]=_0x7b47('0x45')+_0x17b335+_0x7b47('0x55')+_0x4ba973+'))';return getZohoUser(_0x39d91f,_0x7b47('0x56'))['then'](function(_0x14783f){if(_0x14783f)return _0x14783f;_0x39d91f[_0x7b47('0x54')]=_0x7b47('0x45')+_0x17b335+_0x7b47('0x57')+_0x4ba973+'))';return getZohoUser(_0x39d91f,'Leads')[_0x7b47('0x2d')](function(_0x2f59c3){if(_0x2f59c3)return _0x2f59c3;if(_0x17e35c[_0x7b47('0x48')]!='nothing'){return createEndUser(_0x1f7d86,_0x17b335,_0x1a1a5b,_0x4ba973,_0x22325d,_0x17e35c);}else{return{};}});});break;case _0x7b47('0x58'):_0x39d91f['uri']='https://www.zohoapis.'+_0x17b335+_0x7b47('0x55')+_0x4ba973+'))';return getZohoUser(_0x39d91f,_0x7b47('0x56'))[_0x7b47('0x2d')](function(_0x45e97b){if(_0x45e97b)return _0x45e97b;if(_0x17e35c[_0x7b47('0x48')]!='nothing'){return createEndUser(_0x1f7d86,_0x17b335,_0x1a1a5b,_0x4ba973,_0x22325d,_0x17e35c);}else{return{};}});break;case _0x7b47('0x59'):_0x39d91f['uri']='https://www.zohoapis.'+_0x17b335+_0x7b47('0x57')+_0x4ba973+'))';return getZohoUser(_0x39d91f,_0x7b47('0x5a'))[_0x7b47('0x2d')](function(_0x13099e){if(_0x13099e)return _0x13099e;if(_0x17e35c['moduleCreate']!=_0x7b47('0x5b')){return createEndUser(_0x1f7d86,_0x17b335,_0x1a1a5b,_0x4ba973,_0x22325d,_0x17e35c);}else{return{};}});break;}}function getCall(_0x7021a,_0x1801c2,_0x12fd33,_0x580bbc,_0x7abcef,_0x3f503f,_0x1c5f9f,_0x5abf09){logger[_0x7b47('0x32')](_0x7b47('0x5c'));var _0x2e4510={};_0x2e4510[_0x7b47('0x5d')]={'name':!_['isNil'](_0x580bbc[_0x7b47('0x49')][_0x7b47('0x1a')])&&!_[_0x7b47('0x1e')](_0x580bbc['profile'][_0x7b47('0x1a')])&&_0x580bbc[_0x7b47('0x40')]['name']===_0x7b47('0x5e')?_0x580bbc[_0x7b47('0x49')]['name']:!_[_0x7b47('0x1e')](_0x580bbc[_0x7b47('0x4a')])?_0x580bbc[_0x7b47('0x4a')]+'\x20'+_0x580bbc['last_name']:_0x580bbc[_0x7b47('0x4b')],'id':_0x580bbc['id']};_0x2e4510[_0x7b47('0x5f')]=intUtil[_0x7b47('0x60')](_0x3f503f[_0x7b47('0x61')],_0x1c5f9f,'\x20');_0x2e4510[_0x7b47('0x62')]=intUtil[_0x7b47('0x60')](_0x3f503f[_0x7b47('0x63')],_0x1c5f9f,'\x0a');if(_0x7abcef['enduserType']===_0x7b47('0x56')){_0x2e4510[_0x7b47('0x64')]={'name':!_[_0x7b47('0x1e')](_0x7abcef[_0x7b47('0x65')])?_0x7abcef[_0x7b47('0x65')]:!_[_0x7b47('0x1e')](_0x7abcef[_0x7b47('0x66')])?_0x7abcef[_0x7b47('0x66')]+'\x20'+_0x7abcef[_0x7b47('0x67')]:_0x7abcef[_0x7b47('0x67')],'id':_0x7abcef['id']};}if(_0x7abcef[_0x7b47('0x44')]===_0x7b47('0x5a')){_0x2e4510[_0x7b47('0x68')]={'name':!_[_0x7b47('0x1e')](_0x7abcef['Full_Name'])?_0x7abcef[_0x7b47('0x65')]:!_[_0x7b47('0x1e')](_0x7abcef['First_Name'])?_0x7abcef[_0x7b47('0x66')]+'\x20'+_0x7abcef[_0x7b47('0x67')]:_0x7abcef[_0x7b47('0x67')],'id':_0x7abcef['id']};_0x2e4510[_0x7b47('0x69')]=_[_0x7b47('0x47')](_0x7abcef['enduserType']);}if(_0x1c5f9f[_0x7b47('0x6a')]){_0x2e4510['Call_Duration']=moment[_0x7b47('0x6b')](parseInt(_0x1c5f9f['talktime'])*0x3e8)['format']('mm:ss');}else if(_0x1c5f9f[_0x7b47('0x6c')]&&_0x1c5f9f['endtime']){_0x2e4510[_0x7b47('0x6d')]=moment[_0x7b47('0x6b')](moment(_0x1c5f9f[_0x7b47('0x6e')],_0x7b47('0x6f'))[_0x7b47('0x70')](moment(_0x1c5f9f['starttime'],'YYYY-MM-DDTHH:mm:ss')))[_0x7b47('0x34')](_0x7b47('0x71'));}switch(_0x1c5f9f['lastevent']){case'called':_0x2e4510[_0x7b47('0x72')]=_0x7b47('0x73');break;case _0x7b47('0x74'):case _0x7b47('0x75'):_0x2e4510[_0x7b47('0x72')]=_0x7b47('0x76');break;case'rejected':_0x2e4510[_0x7b47('0x72')]=_0x7b47('0x77');break;case'abandoned':_0x2e4510[_0x7b47('0x72')]='Abandoned';break;case _0x7b47('0x78'):_0x2e4510[_0x7b47('0x72')]=_0x7b47('0x79');default:}_0x2e4510[_0x7b47('0x7a')]=(_0x5abf09===_0x7b47('0x7b')?moment(_0x1c5f9f['starttime'])[_0x7b47('0x34')](_0x7b47('0x6f')):moment(_0x1c5f9f['agentcalledAt'])[_0x7b47('0x34')](_0x7b47('0x6f')))||moment()[_0x7b47('0x34')](_0x7b47('0x6f'));_0x2e4510[_0x7b47('0x7c')]=_0x5abf09||_0x7b47('0x7d');_0x2e4510=_[_0x7b47('0x7e')](_0x2e4510,getCustomFields(_0x3f503f[_0x7b47('0x7f')],_0x1c5f9f));return request({'method':_0x7b47('0x27'),'uri':'https://www.zohoapis.'+_0x1801c2+_0x7b47('0x80'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x7021a},'body':{'data':[_0x2e4510]},'json':!![]})[_0x7b47('0x2d')](function(_0x358199){if(_0x358199&&_0x358199['data'][0x0]['code']==='SUCCESS'){logger[_0x7b47('0x32')](_0x7b47('0x81'));return{'id':_0x358199[_0x7b47('0x43')][0x0][_0x7b47('0x4e')]['id']};}})[_0x7b47('0x30')](function(_0x4eb37b){logger['info'](_0x7b47('0x82'),_0x4eb37b[_0x7b47('0x83')]);console[_0x7b47('0x50')]('err',_0x4eb37b);});}exports[_0x7b47('0x84')]=function(_0x2f25b8,_0x57a7ff,_0x5f3976,_0x2c0de6,_0x21173f,_0xa45d17){var _0xee912c,_0x50df93,_0x10fb55;_0xa45d17[_0x7b47('0x85')]=intUtil[_0x7b47('0x86')](_0xa45d17[_0x7b47('0x85')]);_0xa45d17[_0x7b47('0x87')]=intUtil[_0x7b47('0x86')](_0xa45d17['serverUrl']);if(_0x21173f&&_0x21173f[_0x7b47('0x88')]){logger[_0x7b47('0x32')]('[QUEUE]',_0x7b47('0x89'));_0x57a7ff[_0x7b47('0x8a')]=_0xa45d17[_0x7b47('0x87')]+_0x7b47('0x8b')+_0x57a7ff[_0x7b47('0x8c')]+'/downloads?type=uniqueid&token='+md5(_0x57a7ff[_0x7b47('0x8c')]);}else{_0x57a7ff[_0x7b47('0x8a')]='';}var _0x1bbae4=_0xa45d17[_0x7b47('0x85')]===_0x7b47('0x8d')?'eu':_0x7b47('0x8e');return getAccessToken(_0xa45d17)['then'](function(_0x1131ac){_0x10fb55=_0x1131ac;return getUser(_0x10fb55,_0x1bbae4,_0xa45d17,_0x2c0de6['email']);})['then'](function(_0xb81707){_0xee912c=_0xb81707;logger[_0x7b47('0x32')](_0x7b47('0x8f'),_0xee912c['id']);return getEndUser(_0x10fb55,_0x1bbae4,_0xa45d17,_0x57a7ff[_0x7b47('0x90')],_0x57a7ff[_0x7b47('0x91')],_0xee912c,_0x5f3976);})[_0x7b47('0x2d')](function(_0x571c1e){_0x50df93=_0x571c1e;return getCall(_0x10fb55,_0x1bbae4,_0xa45d17,_0xee912c,_0x50df93,_0x5f3976,_0x57a7ff,'Inbound');})[_0x7b47('0x2d')](function(_0x5a548a){if(_0x5a548a){logger[_0x7b47('0x32')]('The\x20Call\x20ID\x20is:',_0x5a548a['id']);logger[_0x7b47('0x32')](_0x7b47('0x92'),_0x7b47('0x93'));emit(util['format'](_0x7b47('0x94'),_0x2c0de6[_0x7b47('0x1a')]),_0x7b47('0x95'),{'uri':_0x7b47('0x96')+_0xa45d17['host']+_0x7b47('0x97')+_0x5a548a['id']});}})[_0x7b47('0x30')](function(_0x1ce883){logger[_0x7b47('0x31')](_0x7b47('0x92'),JSON[_0x7b47('0xf')](_0x1ce883));});};exports['outbound']=function(_0x4fbd93,_0x24a976,_0x2851e4,_0x1f9bd5,_0x546e04,_0x43463b,_0xe3e8a0){var _0xd384db,_0x4e42ca,_0x186182;_0x43463b['host']=intUtil[_0x7b47('0x86')](_0x43463b[_0x7b47('0x85')]);_0x43463b[_0x7b47('0x87')]=intUtil[_0x7b47('0x86')](_0x43463b[_0x7b47('0x87')]);if(_0xe3e8a0&&_0xe3e8a0[_0x7b47('0x98')]&&_0xe3e8a0['recordingFormat']!==_0x7b47('0x99')){logger['info'](_0x7b47('0x9a'),_0x7b47('0x89'));_0x24a976[_0x7b47('0x8a')]=_0x43463b[_0x7b47('0x87')]+'/api/voice/recordings/'+_0x24a976[_0x7b47('0x8c')]+_0x7b47('0x9b')+md5(_0x24a976[_0x7b47('0x8c')]);}var _0x14abf0=_0x43463b['host']===_0x7b47('0x8d')?'eu':_0x7b47('0x8e');return getAccessToken(_0x43463b)['then'](function(_0x44952b){_0x186182=_0x44952b;return getUser(_0x186182,_0x14abf0,_0x43463b,_0x1f9bd5['email']);})[_0x7b47('0x2d')](function(_0x2cfbbb){_0xd384db=_0x2cfbbb;logger['info'](_0x7b47('0x8f'),_0xd384db['id']);return getEndUser(_0x186182,_0x14abf0,_0x43463b,_0x24a976['destcalleridname'],_0x24a976['destcalleridnum'],_0xd384db,_0x2851e4);})['then'](function(_0x84b969){_0x4e42ca=_0x84b969;return getCall(_0x186182,_0x14abf0,_0x43463b,_0xd384db,_0x4e42ca,_0x2851e4,_0x24a976,_0x7b47('0x9c'));})[_0x7b47('0x2d')](function(_0x18b62b){if(_0x18b62b){logger[_0x7b47('0x32')](_0x7b47('0x9d'),_0x18b62b['id']);logger['info'](_0x7b47('0x9a'),_0x7b47('0x93'));emit(util['format'](_0x7b47('0x94'),_0x1f9bd5[_0x7b47('0x1a')]),_0x7b47('0x95'),{'uri':'https://crm.'+_0x43463b[_0x7b47('0x85')]+_0x7b47('0x97')+_0x18b62b['id']});}})[_0x7b47('0x30')](function(_0x22aced){logger[_0x7b47('0x31')](_0x7b47('0x9a'),JSON[_0x7b47('0xf')](_0x22aced));});};exports[_0x7b47('0x9e')]=function(_0x2ab898,_0x19ca4c,_0x1a237d,_0x536246,_0x2411ce,_0xa08710){var _0x31fa06,_0x4d4ced,_0x4b0165;_0xa08710['host']=intUtil[_0x7b47('0x86')](_0xa08710[_0x7b47('0x85')]);_0xa08710[_0x7b47('0x87')]=intUtil[_0x7b47('0x86')](_0xa08710[_0x7b47('0x87')]);if(_0x2411ce&&_0x2411ce['monitor_format']){logger['info']('['+_0x19ca4c[_0x7b47('0x9f')][_0x7b47('0xa0')]()+']','Recording\x20is\x20enabled!');_0x19ca4c[_0x7b47('0x8a')]=_0xa08710['serverUrl']+_0x7b47('0x8b')+_0x19ca4c[_0x7b47('0x8c')]+_0x7b47('0x9b')+md5(_0x19ca4c['uniqueid']);}else{_0x19ca4c[_0x7b47('0x8a')]='';}var _0x5a6329=_0xa08710['host']===_0x7b47('0x8d')?'eu':_0x7b47('0x8e');return getAccessToken(_0xa08710)[_0x7b47('0x2d')](function(_0x121328){_0x4b0165=_0x121328;return getUser(_0x4b0165,_0x5a6329,_0xa08710);})['then'](function(_0x34bf1f){_0x31fa06=_0x34bf1f;logger[_0x7b47('0x32')](_0x7b47('0x8f'),_0x31fa06['id']);return getEndUser(_0x4b0165,_0x5a6329,_0xa08710,_0x19ca4c[_0x7b47('0x90')],_0x19ca4c['calleridnum'],_0x31fa06,_0x1a237d);})['then'](function(_0x5a93cf){_0x4d4ced=_0x5a93cf;return getCall(_0x4b0165,_0x5a6329,_0xa08710,_0x31fa06,_0x4d4ced,_0x1a237d,_0x19ca4c,_0x7b47('0x7d'));})[_0x7b47('0x2d')](function(_0x27dce8){if(_0x27dce8){logger[_0x7b47('0x32')](_0x7b47('0x9d'),_0x27dce8['id']);}})['catch'](function(_0x494757){logger[_0x7b47('0x31')]('['+_0x19ca4c[_0x7b47('0x9f')]['toUpperCase']()+']',JSON['stringify'](_0x494757));});}; \ No newline at end of file +var _0x59e7=['user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','https://crm.','unmanaged','toUpperCase','/api/voice/recordings/','calleridname','calleridnum','The\x20Call\x20ID\x20is:','request-promise','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','defaults','localhost','socket.io-emitter','redis','[HTTP]','stringify','includes','type','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','isBefore','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','refresh_token','then','access_token','expires_in','seconds','Failing\x20creating\x20the\x20access_token','stack','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','findIndex','email','Agent\x20found!','info','profile','Administrator','user','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','enduserType','POST','https://www.zohoapis.','startCase','moduleCreate','role','first_name','last_name','data','code','SUCCESS','details','Error:\x20','CREATE\x20ERROR','moduleSearch','contact_lead','uri','Leads','nothing','Contacts','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','Subjects','Description','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','answertime','endtime','diff','YYYY-MM-DDTHH:mm:ss','lastevent','Call_Result','Called','connect','Answered','Rejected','abandoned','Abandoned','Timeout','outbound','agentcalledAt','Call_Type','merge','Fields','/crm/v2/Calls','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','/downloads?type=uniqueid&token=','recordingURL','zoho.eu','com','The\x20User\x20ID\x20is:','Inbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x59e7,0x1ce));var _0x759e=function(_0x442fee,_0x16b130){_0x442fee=_0x442fee-0x0;var _0xf1a85c=_0x59e7[_0x442fee];return _0xf1a85c;};'use strict';var _=require('lodash');var rp=require(_0x759e('0x0'));var md5=require('md5');var util=require(_0x759e('0x1'));var intUtil=require(_0x759e('0x2'));var moment=require(_0x759e('0x3'));var Redis=require(_0x759e('0x4'));var BPromise=require(_0x759e('0x5'));var config=require(_0x759e('0x6'));var logger=require(_0x759e('0x7'))(_0x759e('0x8'));config['redis']=_[_0x759e('0x9')](config['redis'],{'host':_0x759e('0xa'),'port':0x18eb});var io=require(_0x759e('0xb'))(new Redis(config[_0x759e('0xc')]));function emit(_0x572241,_0x390a69,_0x128724){io['to'](_0x572241)['emit'](_0x390a69,_0x128724);}function request(_0x25b360){logger['debug'](_0x759e('0xd'),JSON[_0x759e('0xe')](_0x25b360));return rp(_0x25b360);}function getCustomFields(_0x5b7a24,_0x1e0f52){var _0x332ff8={};if(_0x5b7a24['length']>0x0){_['forEach'](_0x5b7a24,function(_0x66f82f){if(_[_0x759e('0xf')](['string','picklist'],_0x66f82f[_0x759e('0x10')])&&_0x66f82f[_0x759e('0x11')]){_0x332ff8[_0x66f82f['idField']]=_0x66f82f['content'][_0x759e('0x12')]();}else if(_0x66f82f['type']===_0x759e('0x13')&&_0x66f82f[_0x759e('0x14')]&&_0x66f82f[_0x759e('0x11')]&&_0x1e0f52[_0x66f82f[_0x759e('0x14')]]){_0x332ff8[_0x66f82f[_0x759e('0x11')]]=_0x1e0f52[_0x66f82f['variableName']][_0x759e('0x12')]();}else if(_0x66f82f['type']===_0x759e('0x15')&&_0x66f82f['Variable']&&_0x66f82f[_0x759e('0x16')][_0x759e('0x17')]&&_0x66f82f[_0x759e('0x11')]&&_0x1e0f52[_0x66f82f[_0x759e('0x16')][_0x759e('0x17')][_0x759e('0x18')]()]){_0x332ff8[_0x66f82f['idField']]=_0x1e0f52[_0x66f82f[_0x759e('0x16')][_0x759e('0x17')][_0x759e('0x18')]()][_0x759e('0x12')]();}});}return _0x332ff8;}function getName(_0x56406d){if(_0x56406d[_0x759e('0x19')]('\x20')>0x0){var _0x3782b9=_0x56406d[_0x759e('0x1a')](/ (.+)/);if(_0x3782b9[0x1]){return _0x3782b9;}}return[_0x56406d,_0x56406d];}var accountsTokens={};function getAccessToken(_0x54060f){return new Promise(function(_0x47ca9d,_0x68d00f){if(!_[_0x759e('0x1b')](accountsTokens[_0x54060f['id']])&&!_['isNil'](accountsTokens[_0x54060f['id']]['access_token'])){if(moment()[_0x759e('0x1c')](accountsTokens[_0x54060f['id']]['expires_in'])){_0x47ca9d(accountsTokens[_0x54060f['id']]['access_token']);}}var _0x550120;switch(_0x54060f[_0x759e('0x1d')]){case'US':_0x550120=_0x759e('0x1e');break;case'AU':_0x550120=_0x759e('0x1f');break;case'EU':_0x550120=_0x759e('0x20');break;case'IN':_0x550120=_0x759e('0x21');break;case'CN':_0x550120=_0x759e('0x22');break;default:_0x550120=_0x759e('0x20');break;}var _0x266625={'method':'POST','uri':_0x550120+_0x759e('0x23'),'qs':{'refresh_token':_0x54060f[_0x759e('0x24')],'client_id':_0x54060f[_0x759e('0x25')],'client_secret':_0x54060f['clientSecret'],'grant_type':_0x759e('0x26')},'json':!![]};return rp(_0x266625)[_0x759e('0x27')](function(_0x3ef648){accountsTokens[_0x54060f['id']]={'access_token':_0x3ef648[_0x759e('0x28')],'expires_in':moment()['add'](_0x3ef648[_0x759e('0x29')],_0x759e('0x2a'))};_0x47ca9d(_0x3ef648['access_token']);})['catch'](function(_0x4f6508){logger['error'](_0x759e('0x2b'),_0x4f6508[_0x759e('0x2c')]);_0x68d00f(_0x4f6508);});});}function getUser(_0x4b0300,_0x23e1ed,_0x4fc1ed,_0x34b206){logger['info']('Search\x20user');return request({'method':_0x759e('0x2d'),'uri':util[_0x759e('0x2e')](_0x759e('0x2f'),_0x23e1ed),'qs':{'type':_0x759e('0x30')},'headers':{'Authorization':_0x759e('0x31')+_0x4b0300},'json':!![]})[_0x759e('0x27')](function(_0x19ef83){if(_0x19ef83[_0x759e('0x32')]){var _0x473e2a=-0x1;if(_['isArrayLikeObject'](_0x19ef83[_0x759e('0x32')])){if(!_['isNil'](_0x34b206)){_0x473e2a=_[_0x759e('0x33')](_0x19ef83[_0x759e('0x32')],function(_0x3d42d3){return _0x3d42d3[_0x759e('0x34')]===_0x34b206;});}if(_0x473e2a>=0x0){logger['info'](_0x759e('0x35'));}else{logger[_0x759e('0x36')]('Using\x20the\x20admin\x20account!');_0x473e2a=_['findIndex'](_0x19ef83[_0x759e('0x32')],function(_0xc2ba37){return _0xc2ba37[_0x759e('0x37')]['name']===_0x759e('0x38');});}return _0x19ef83[_0x759e('0x32')][_0x473e2a];}else{if(_0x19ef83['user'][_0x759e('0x37')][_0x759e('0x17')]===_0x759e('0x38')){logger['info']('Using\x20the\x20admin\x20account!');user=_0x19ef83[_0x759e('0x39')];return user;}else{logger[_0x759e('0x3a')](_0x759e('0x3b'),JSON[_0x759e('0xe')](_0x19ef83));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x759e('0xe')](_0x19ef83));}}}else{logger[_0x759e('0x3a')](_0x759e('0x3b'),JSON['stringify'](_0x19ef83));throw new Error(_0x759e('0x3c')+JSON[_0x759e('0xe')](_0x19ef83));}})[_0x759e('0x3d')](function(_0x4d17b1){console['error'](_0x4d17b1);});}function getZohoUser(_0x2d39e5,_0x427b21){return new BPromise(function(_0x4372b1,_0x50c6d0){request(_0x2d39e5)['then'](function(_0x110851){var _0x594fbe=null;if(_0x110851){_0x594fbe=_0x110851['data'][0x0];_0x594fbe[_0x759e('0x3e')]=_0x427b21;}_0x4372b1(_0x594fbe);})[_0x759e('0x3d')](function(_0x11292a){_0x50c6d0(_0x11292a);});});}function createEndUser(_0x19715f,_0x44d13f,_0x2d1a91,_0x53a0f6,_0x546fb4,_0x4008dd){var _0x2d1a91=getName(_0x2d1a91);return request({'method':_0x759e('0x3f'),'uri':_0x759e('0x40')+_0x44d13f+'/crm/v2/'+_[_0x759e('0x41')](_0x4008dd[_0x759e('0x42')])+'s','body':{'data':[{'Last_Name':_0x2d1a91[0x1],'First_Name':_0x2d1a91[0x0],'Phone':_0x53a0f6,'Owner':{'name':!_[_0x759e('0x1b')](_0x546fb4['role'][_0x759e('0x17')])?_0x546fb4[_0x759e('0x43')][_0x759e('0x17')]:!_['isNil'](_0x546fb4[_0x759e('0x44')])?_0x546fb4[_0x759e('0x44')]+'\x20'+_0x546fb4[_0x759e('0x45')]:_0x546fb4[_0x759e('0x45')],'id':_0x546fb4['id']}}]},'headers':{'Authorization':_0x759e('0x31')+_0x19715f},'json':!![]})[_0x759e('0x27')](function(_0x47dbe0){if(_0x47dbe0&&_0x47dbe0[_0x759e('0x46')][0x0][_0x759e('0x47')]===_0x759e('0x48')){var _0x1cdefd=_0x47dbe0[_0x759e('0x46')][0x0][_0x759e('0x49')];_0x1cdefd[_0x759e('0x3e')]=_[_0x759e('0x41')](_0x4008dd[_0x759e('0x42')])+'s';return _0x1cdefd;}logger[_0x759e('0x3a')](_0x759e('0x3b'),JSON['stringify'](data));throw new Error(_0x759e('0x4a')+JSON[_0x759e('0xe')](data));})['catch'](function(_0x4a19d4){console['log'](_0x759e('0x4b'),_0x4a19d4);});}function getEndUser(_0xa51ac5,_0x5045f5,_0x2f19e1,_0x40993b,_0x34d54a,_0x5a1841,_0x17aa06){var _0x1b76fa={'method':_0x759e('0x2d'),'uri':'','headers':{'Authorization':_0x759e('0x31')+_0xa51ac5},'json':!![]};switch(_0x17aa06[_0x759e('0x4c')]){case _0x759e('0x4d'):_0x1b76fa[_0x759e('0x4e')]='https://www.zohoapis.'+_0x5045f5+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x34d54a+'))';return getZohoUser(_0x1b76fa,'Contacts')[_0x759e('0x27')](function(_0xcc3af4){if(_0xcc3af4)return _0xcc3af4;_0x1b76fa['uri']='https://www.zohoapis.'+_0x5045f5+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x34d54a+'))';return getZohoUser(_0x1b76fa,_0x759e('0x4f'))['then'](function(_0x4f09b5){if(_0x4f09b5)return _0x4f09b5;if(_0x17aa06['moduleCreate']!=_0x759e('0x50')){return createEndUser(_0xa51ac5,_0x5045f5,_0x40993b,_0x34d54a,_0x5a1841,_0x17aa06);}else{return{};}});});break;case'contact':_0x1b76fa['uri']=_0x759e('0x40')+_0x5045f5+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x34d54a+'))';return getZohoUser(_0x1b76fa,_0x759e('0x51'))[_0x759e('0x27')](function(_0x4c9c7d){if(_0x4c9c7d)return _0x4c9c7d;if(_0x17aa06[_0x759e('0x42')]!='nothing'){return createEndUser(_0xa51ac5,_0x5045f5,_0x40993b,_0x34d54a,_0x5a1841,_0x17aa06);}else{return{};}});break;case _0x759e('0x52'):_0x1b76fa[_0x759e('0x4e')]=_0x759e('0x40')+_0x5045f5+_0x759e('0x53')+_0x34d54a+'))';return getZohoUser(_0x1b76fa,_0x759e('0x4f'))[_0x759e('0x27')](function(_0x325d3b){if(_0x325d3b)return _0x325d3b;if(_0x17aa06[_0x759e('0x42')]!=_0x759e('0x50')){return createEndUser(_0xa51ac5,_0x5045f5,_0x40993b,_0x34d54a,_0x5a1841,_0x17aa06);}else{return{};}});break;}}function getCall(_0x10a025,_0x35d3c2,_0x1c7d45,_0x586921,_0x5a3c9e,_0x52c2ac,_0xa117b8,_0x118875){logger[_0x759e('0x36')](_0x759e('0x54'));var _0x4f44fb={};_0x4f44fb[_0x759e('0x55')]={'name':!_[_0x759e('0x1b')](_0x586921[_0x759e('0x43')][_0x759e('0x17')])&&!_['isNil'](_0x586921['profile'][_0x759e('0x17')])&&_0x586921[_0x759e('0x37')][_0x759e('0x17')]===_0x759e('0x56')?_0x586921[_0x759e('0x43')]['name']:!_['isNil'](_0x586921[_0x759e('0x44')])?_0x586921[_0x759e('0x44')]+'\x20'+_0x586921[_0x759e('0x45')]:_0x586921['last_name'],'id':_0x586921['id']};_0x4f44fb['Subject']=intUtil['getString'](_0x52c2ac[_0x759e('0x57')],_0xa117b8,'\x20');_0x4f44fb[_0x759e('0x58')]=intUtil['getString'](_0x52c2ac['Descriptions'],_0xa117b8,'\x0a');if(_0x5a3c9e[_0x759e('0x3e')]===_0x759e('0x51')){_0x4f44fb[_0x759e('0x59')]={'name':!_[_0x759e('0x1b')](_0x5a3c9e[_0x759e('0x5a')])?_0x5a3c9e[_0x759e('0x5a')]:!_[_0x759e('0x1b')](_0x5a3c9e[_0x759e('0x5b')])?_0x5a3c9e['First_Name']+'\x20'+_0x5a3c9e['Last_Name']:_0x5a3c9e[_0x759e('0x5c')],'id':_0x5a3c9e['id']};}if(_0x5a3c9e['enduserType']===_0x759e('0x4f')){_0x4f44fb[_0x759e('0x5d')]={'name':!_[_0x759e('0x1b')](_0x5a3c9e[_0x759e('0x5a')])?_0x5a3c9e[_0x759e('0x5a')]:!_[_0x759e('0x1b')](_0x5a3c9e['First_Name'])?_0x5a3c9e[_0x759e('0x5b')]+'\x20'+_0x5a3c9e[_0x759e('0x5c')]:_0x5a3c9e['Last_Name'],'id':_0x5a3c9e['id']};_0x4f44fb[_0x759e('0x5e')]=_[_0x759e('0x41')](_0x5a3c9e[_0x759e('0x3e')]);}if(_0xa117b8[_0x759e('0x5f')]){_0x4f44fb[_0x759e('0x60')]=moment[_0x759e('0x61')](parseInt(_0xa117b8[_0x759e('0x5f')])*0x3e8)['format']('mm:ss');}else if(_0xa117b8[_0x759e('0x62')]&&_0xa117b8[_0x759e('0x63')]){_0x4f44fb[_0x759e('0x60')]=moment[_0x759e('0x61')](moment(_0xa117b8[_0x759e('0x63')],'YYYY-MM-DDTHH:mm:ss')[_0x759e('0x64')](moment(_0xa117b8['starttime'],_0x759e('0x65'))))['format']('mm:ss');}switch(_0xa117b8[_0x759e('0x66')]){case'called':_0x4f44fb[_0x759e('0x67')]=_0x759e('0x68');break;case'complete':case _0x759e('0x69'):_0x4f44fb['Call_Result']=_0x759e('0x6a');break;case'rejected':_0x4f44fb[_0x759e('0x67')]=_0x759e('0x6b');break;case _0x759e('0x6c'):_0x4f44fb[_0x759e('0x67')]=_0x759e('0x6d');break;case'timeout':_0x4f44fb[_0x759e('0x67')]=_0x759e('0x6e');default:}_0x4f44fb['Call_Start_Time']=(_0x118875===_0x759e('0x6f')?moment(_0xa117b8['starttime'])['format']('YYYY-MM-DDTHH:mm:ss'):moment(_0xa117b8[_0x759e('0x70')])[_0x759e('0x2e')](_0x759e('0x65')))||moment()[_0x759e('0x2e')](_0x759e('0x65'));_0x4f44fb[_0x759e('0x71')]=_0x118875||'Inbound';_0x4f44fb=_[_0x759e('0x72')](_0x4f44fb,getCustomFields(_0x52c2ac[_0x759e('0x73')],_0xa117b8));return request({'method':_0x759e('0x3f'),'uri':_0x759e('0x40')+_0x35d3c2+_0x759e('0x74'),'headers':{'Authorization':_0x759e('0x31')+_0x10a025},'body':{'data':[_0x4f44fb]},'json':!![]})[_0x759e('0x27')](function(_0x37d546){if(_0x37d546&&_0x37d546['data'][0x0]['code']===_0x759e('0x48')){logger[_0x759e('0x36')](_0x759e('0x75'));return{'id':_0x37d546[_0x759e('0x46')][0x0][_0x759e('0x49')]['id']};}})[_0x759e('0x3d')](function(_0x4ab4cf){logger['info'](_0x759e('0x76'),_0x4ab4cf['stack']);console['log'](_0x759e('0x76'),_0x4ab4cf);});}exports[_0x759e('0x77')]=function(_0x536096,_0x29bf0c,_0x18df0f,_0x4d22ea,_0x30e383,_0x4af518){var _0x282afd,_0x51de4c,_0x542332;_0x4af518[_0x759e('0x78')]=intUtil['stripTrailingSlash'](_0x4af518[_0x759e('0x78')]);_0x4af518['serverUrl']=intUtil[_0x759e('0x79')](_0x4af518[_0x759e('0x7a')]);if(_0x30e383&&_0x30e383[_0x759e('0x7b')]){logger[_0x759e('0x36')](_0x759e('0x7c'),_0x759e('0x7d'));_0x29bf0c['recordingURL']=_0x4af518[_0x759e('0x7a')]+'/api/voice/recordings/'+_0x29bf0c[_0x759e('0x7e')]+_0x759e('0x7f')+md5(_0x29bf0c[_0x759e('0x7e')]);}else{_0x29bf0c[_0x759e('0x80')]='';}var _0x45802f=_0x4af518[_0x759e('0x78')]===_0x759e('0x81')?'eu':_0x759e('0x82');return getAccessToken(_0x4af518)[_0x759e('0x27')](function(_0x4c90fe){_0x542332=_0x4c90fe;return getUser(_0x542332,_0x45802f,_0x4af518,_0x4d22ea[_0x759e('0x34')]);})[_0x759e('0x27')](function(_0x5b8171){_0x282afd=_0x5b8171;logger[_0x759e('0x36')](_0x759e('0x83'),_0x282afd['id']);return getEndUser(_0x542332,_0x45802f,_0x4af518,_0x29bf0c['calleridname'],_0x29bf0c['calleridnum'],_0x282afd,_0x18df0f);})['then'](function(_0xd9e917){_0x51de4c=_0xd9e917;return getCall(_0x542332,_0x45802f,_0x4af518,_0x282afd,_0x51de4c,_0x18df0f,_0x29bf0c,_0x759e('0x84'));})[_0x759e('0x27')](function(_0x1744ff){if(_0x1744ff){logger[_0x759e('0x36')]('The\x20Call\x20ID\x20is:',_0x1744ff['id']);logger[_0x759e('0x36')](_0x759e('0x7c'),_0x759e('0x85'));emit(util[_0x759e('0x2e')](_0x759e('0x86'),_0x4d22ea[_0x759e('0x17')]),_0x759e('0x87'),{'uri':'https://crm.'+_0x4af518[_0x759e('0x78')]+_0x759e('0x88')+_0x1744ff['id']});}})[_0x759e('0x3d')](function(_0x341bf5){logger[_0x759e('0x3a')](_0x759e('0x7c'),JSON[_0x759e('0xe')](_0x341bf5));});};exports[_0x759e('0x6f')]=function(_0x13b8f5,_0x56f8de,_0x5c0b99,_0x35966e,_0x3d9510,_0x303f59,_0x43b9e6){var _0x2a6b0f,_0x8c4ef7,_0x4dfc42;_0x303f59[_0x759e('0x78')]=intUtil[_0x759e('0x79')](_0x303f59[_0x759e('0x78')]);_0x303f59[_0x759e('0x7a')]=intUtil[_0x759e('0x79')](_0x303f59[_0x759e('0x7a')]);if(_0x43b9e6&&_0x43b9e6[_0x759e('0x89')]&&_0x43b9e6[_0x759e('0x89')]!==_0x759e('0x8a')){logger['info'](_0x759e('0x8b'),_0x759e('0x7d'));_0x56f8de[_0x759e('0x80')]=_0x303f59[_0x759e('0x7a')]+'/api/voice/recordings/'+_0x56f8de[_0x759e('0x7e')]+_0x759e('0x7f')+md5(_0x56f8de[_0x759e('0x7e')]);}var _0x3951be=_0x303f59[_0x759e('0x78')]==='zoho.eu'?'eu':_0x759e('0x82');return getAccessToken(_0x303f59)[_0x759e('0x27')](function(_0x16f1a2){_0x4dfc42=_0x16f1a2;return getUser(_0x4dfc42,_0x3951be,_0x303f59,_0x35966e['email']);})[_0x759e('0x27')](function(_0x356efc){_0x2a6b0f=_0x356efc;logger['info'](_0x759e('0x83'),_0x2a6b0f['id']);return getEndUser(_0x4dfc42,_0x3951be,_0x303f59,_0x56f8de[_0x759e('0x8c')],_0x56f8de[_0x759e('0x8d')],_0x2a6b0f,_0x5c0b99);})[_0x759e('0x27')](function(_0x4c8a25){_0x8c4ef7=_0x4c8a25;return getCall(_0x4dfc42,_0x3951be,_0x303f59,_0x2a6b0f,_0x8c4ef7,_0x5c0b99,_0x56f8de,'Outbound');})['then'](function(_0x5533fa){if(_0x5533fa){logger[_0x759e('0x36')]('The\x20Call\x20ID\x20is:',_0x5533fa['id']);logger['info']('[OUTBOUND]',_0x759e('0x85'));emit(util[_0x759e('0x2e')](_0x759e('0x86'),_0x35966e[_0x759e('0x17')]),_0x759e('0x87'),{'uri':_0x759e('0x8e')+_0x303f59['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x5533fa['id']});}})['catch'](function(_0x44080e){logger[_0x759e('0x3a')](_0x759e('0x8b'),JSON['stringify'](_0x44080e));});};exports[_0x759e('0x8f')]=function(_0x15283c,_0x163c43,_0x82eee4,_0x56336f,_0x51c019,_0x8295ab){var _0x36f564,_0x1478e6,_0x502a1a;_0x8295ab['host']=intUtil['stripTrailingSlash'](_0x8295ab[_0x759e('0x78')]);_0x8295ab['serverUrl']=intUtil[_0x759e('0x79')](_0x8295ab[_0x759e('0x7a')]);if(_0x51c019&&_0x51c019[_0x759e('0x7b')]){logger[_0x759e('0x36')]('['+_0x163c43[_0x759e('0x66')][_0x759e('0x90')]()+']',_0x759e('0x7d'));_0x163c43[_0x759e('0x80')]=_0x8295ab['serverUrl']+_0x759e('0x91')+_0x163c43[_0x759e('0x7e')]+_0x759e('0x7f')+md5(_0x163c43[_0x759e('0x7e')]);}else{_0x163c43[_0x759e('0x80')]='';}var _0x4fffbb=_0x8295ab['host']===_0x759e('0x81')?'eu':_0x759e('0x82');return getAccessToken(_0x8295ab)[_0x759e('0x27')](function(_0x52a070){_0x502a1a=_0x52a070;return getUser(_0x502a1a,_0x4fffbb,_0x8295ab);})[_0x759e('0x27')](function(_0xd0111b){_0x36f564=_0xd0111b;logger['info'](_0x759e('0x83'),_0x36f564['id']);return getEndUser(_0x502a1a,_0x4fffbb,_0x8295ab,_0x163c43[_0x759e('0x92')],_0x163c43[_0x759e('0x93')],_0x36f564,_0x82eee4);})[_0x759e('0x27')](function(_0x35b345){_0x1478e6=_0x35b345;return getCall(_0x502a1a,_0x4fffbb,_0x8295ab,_0x36f564,_0x1478e6,_0x82eee4,_0x163c43,'Inbound');})['then'](function(_0x51448a){if(_0x51448a){logger[_0x759e('0x36')](_0x759e('0x94'),_0x51448a['id']);}})[_0x759e('0x3d')](function(_0x2b219e){logger[_0x759e('0x3a')]('['+_0x163c43[_0x759e('0x66')][_0x759e('0x90')]()+']',JSON[_0x759e('0xe')](_0x2b219e));});}; \ 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 8574000..2e9b419 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 _0xf0cd=['data2','Script','render','data3','exec','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','mustache','../../../../config/logger'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0xf0cd,0x1d1));var _0xdf0c=function(_0x141243,_0x67cb7c){_0x141243=_0x141243-0x0;var _0x2f6390=_0xf0cd[_0x141243];return _0x2f6390;};'use strict';var util=require(_0xdf0c('0x0'));var sh=require('shelljs');var Mustache=require(_0xdf0c('0x1'));var logger=require(_0xdf0c('0x2'))('trigger');exports['exec']=function(_0x213745,_0x3298a7){var _0x5eccde=_0x213745[_0xdf0c('0x3')]?_0x213745[_0xdf0c('0x3')]:_0xdf0c('0x4');var _0x4e7083=_0x213745['data3']?Mustache[_0xdf0c('0x5')](_0x213745[_0xdf0c('0x6')],_0x3298a7):_0x3298a7;sh[_0xdf0c('0x7')](_0x4e7083,function(_0x12cfe3,_0x32960b,_0x3404b0){if(_0x12cfe3!==0x0){logger['error'](util['format'](_0xdf0c('0x8'),_0x5eccde,_0x4e7083,_0x12cfe3,_0x3404b0));}else{logger[_0xdf0c('0x9')](util[_0xdf0c('0xa')](_0xdf0c('0xb'),_0x5eccde,_0x4e7083,_0x32960b));}});}; \ No newline at end of file +var _0xe601=['../../../../config/logger','trigger','exec','data2','Script','data3','render','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','shelljs','mustache'];(function(_0x33011e,_0x3aec60){var _0x301452=function(_0x35a3a5){while(--_0x35a3a5){_0x33011e['push'](_0x33011e['shift']());}};_0x301452(++_0x3aec60);}(_0xe601,0x7c));var _0x1e60=function(_0x5bc8a7,_0x4fdaf2){_0x5bc8a7=_0x5bc8a7-0x0;var _0x1f518e=_0xe601[_0x5bc8a7];return _0x1f518e;};'use strict';var util=require('util');var sh=require(_0x1e60('0x0'));var Mustache=require(_0x1e60('0x1'));var logger=require(_0x1e60('0x2'))(_0x1e60('0x3'));exports[_0x1e60('0x4')]=function(_0x40c4a2,_0x3efc33){var _0x3d4d40=_0x40c4a2[_0x1e60('0x5')]?_0x40c4a2[_0x1e60('0x5')]:_0x1e60('0x6');var _0x485b78=_0x40c4a2[_0x1e60('0x7')]?Mustache[_0x1e60('0x8')](_0x40c4a2[_0x1e60('0x7')],_0x3efc33):_0x3efc33;sh[_0x1e60('0x4')](_0x485b78,function(_0x185098,_0x148e9e,_0x439d2e){if(_0x185098!==0x0){logger[_0x1e60('0x9')](util[_0x1e60('0xa')](_0x1e60('0xb'),_0x3d4d40,_0x485b78,_0x185098,_0x439d2e));}else{logger[_0x1e60('0xc')](util[_0x1e60('0xa')](_0x1e60('0xd'),_0x3d4d40,_0x485b78,_0x148e9e));}});}; \ 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 46df45b..078442a 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 _0x0f8c=['statusCode','name','message','request-promise','util','lodash','mustache','trigger','exec','data1','toUpperCase','render','data2','number','data5','data6','parse','error','stack','GET','DELETE','POST','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then','isNil',',\x20request\x20body:\x20','object','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x0f8c,0x1df));var _0xc0f8=function(_0x5f25b3,_0x35481a){_0x5f25b3=_0x5f25b3-0x0;var _0x4ab9bf=_0x0f8c[_0x5f25b3];return _0x4ab9bf;};'use strict';var rp=require(_0xc0f8('0x0'));var util=require(_0xc0f8('0x1'));var _=require(_0xc0f8('0x2'));var Mustache=require(_0xc0f8('0x3'));var logger=require('../../../../config/logger')(_0xc0f8('0x4'));exports[_0xc0f8('0x5')]=function(_0x164a61,_0x429fb2){var _0x490e03,_0x20ff55;var _0x2fd8e9={'method':_0x164a61[_0xc0f8('0x6')][_0xc0f8('0x7')](),'uri':Mustache[_0xc0f8('0x8')](_0x164a61[_0xc0f8('0x9')],_0x429fb2),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x164a61['data5'])===_0xc0f8('0xa')&&parseInt(_0x164a61['data5'])>=0x1&&parseInt(_0x164a61[_0xc0f8('0xb')])<=0xa?parseInt(_0x164a61[_0xc0f8('0xb')])*0x3e8:0x5*0x3e8};try{_0x2fd8e9['headers']=_0x164a61[_0xc0f8('0xc')]?JSON[_0xc0f8('0xd')](Mustache[_0xc0f8('0x8')](_0x164a61[_0xc0f8('0xc')],_0x429fb2)):{};}catch(_0x33325d){logger[_0xc0f8('0xe')](_0x33325d[_0xc0f8('0xf')]);}switch(_0x164a61['data1'][_0xc0f8('0x7')]()){case _0xc0f8('0x10'):case _0xc0f8('0x11'):_0x490e03=null;_0x2fd8e9['qs']=_0x429fb2;break;case _0xc0f8('0x12'):case'PUT':if(_0x164a61[_0xc0f8('0x13')]){try{_0x490e03=JSON[_0xc0f8('0xd')](Mustache[_0xc0f8('0x8')](_0x164a61[_0xc0f8('0x13')],_0x429fb2));_0x2fd8e9[_0xc0f8('0x14')]=_0x490e03;}catch(_0xddff6c){logger[_0xc0f8('0xe')](_0xddff6c[_0xc0f8('0xf')]);logger[_0xc0f8('0xe')](_0xc0f8('0x15'));}}else{_0x490e03=_0x429fb2;_0x2fd8e9[_0xc0f8('0x14')]=_0x490e03;}break;}logger[_0xc0f8('0x16')](util[_0xc0f8('0x17')](_0xc0f8('0x18'),_0x164a61['data1'],_0x164a61[_0xc0f8('0x9')],JSON['stringify'](_0x2fd8e9)));rp(_0x2fd8e9)[_0xc0f8('0x19')](function(_0x2ffb93){_0x490e03=!_[_0xc0f8('0x1a')](_0x490e03)?_0xc0f8('0x1b')+_0x490e03:'';_0x20ff55=typeof _0x2ffb93[_0xc0f8('0x14')]===_0xc0f8('0x1c')?JSON['stringify'](_0x2ffb93[_0xc0f8('0x14')]):_0x2ffb93[_0xc0f8('0x14')];logger['info'](util['format']('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x164a61['data1'],_0x164a61[_0xc0f8('0x9')],_0x2ffb93['statusCode'],_0x20ff55));})[_0xc0f8('0x1d')](function(_0x12de85){logger[_0xc0f8('0xe')](util[_0xc0f8('0x17')](_0xc0f8('0x1e'),_0x164a61['data1'],_0x164a61[_0xc0f8('0x9')],_0x12de85[_0xc0f8('0x1f')],_0x12de85[_0xc0f8('0x20')],_0x12de85[_0xc0f8('0x21')]));});}; \ No newline at end of file +var _0x0513=['body','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','isNil',',\x20request\x20body:\x20','object','info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','lodash','trigger','exec','data1','render','data2','number','data5','data6','error','stack','POST','PUT','data7','parse'];(function(_0x172ed7,_0x3d08fd){var _0xfa8f61=function(_0xe07a21){while(--_0xe07a21){_0x172ed7['push'](_0x172ed7['shift']());}};_0xfa8f61(++_0x3d08fd);}(_0x0513,0x1a4));var _0x3051=function(_0x318a06,_0x32c5ac){_0x318a06=_0x318a06-0x0;var _0x552d7b=_0x0513[_0x318a06];return _0x552d7b;};'use strict';var rp=require('request-promise');var util=require('util');var _=require(_0x3051('0x0'));var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0x3051('0x1'));exports[_0x3051('0x2')]=function(_0x17e284,_0x30f05c){var _0x41205c,_0xddc29;var _0x29300b={'method':_0x17e284[_0x3051('0x3')]['toUpperCase'](),'uri':Mustache[_0x3051('0x4')](_0x17e284[_0x3051('0x5')],_0x30f05c),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x17e284['data5'])===_0x3051('0x6')&&parseInt(_0x17e284[_0x3051('0x7')])>=0x1&&parseInt(_0x17e284['data5'])<=0xa?parseInt(_0x17e284[_0x3051('0x7')])*0x3e8:0x5*0x3e8};try{_0x29300b['headers']=_0x17e284[_0x3051('0x8')]?JSON['parse'](Mustache['render'](_0x17e284[_0x3051('0x8')],_0x30f05c)):{};}catch(_0x124fa5){logger[_0x3051('0x9')](_0x124fa5[_0x3051('0xa')]);}switch(_0x17e284[_0x3051('0x3')]['toUpperCase']()){case'GET':case'DELETE':_0x41205c=null;_0x29300b['qs']=_0x30f05c;break;case _0x3051('0xb'):case _0x3051('0xc'):if(_0x17e284[_0x3051('0xd')]){try{_0x41205c=JSON[_0x3051('0xe')](Mustache[_0x3051('0x4')](_0x17e284[_0x3051('0xd')],_0x30f05c));_0x29300b[_0x3051('0xf')]=_0x41205c;}catch(_0x465666){logger[_0x3051('0x9')](_0x465666[_0x3051('0xa')]);logger[_0x3051('0x9')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x41205c=_0x30f05c;_0x29300b[_0x3051('0xf')]=_0x41205c;}break;}logger['info'](util[_0x3051('0x10')](_0x3051('0x11'),_0x17e284[_0x3051('0x3')],_0x17e284[_0x3051('0x5')],JSON[_0x3051('0x12')](_0x29300b)));rp(_0x29300b)['then'](function(_0x49704b){_0x41205c=!_[_0x3051('0x13')](_0x41205c)?_0x3051('0x14')+_0x41205c:'';_0xddc29=typeof _0x49704b[_0x3051('0xf')]===_0x3051('0x15')?JSON[_0x3051('0x12')](_0x49704b['body']):_0x49704b[_0x3051('0xf')];logger[_0x3051('0x16')](util[_0x3051('0x10')](_0x3051('0x17'),_0x17e284[_0x3051('0x3')],_0x17e284[_0x3051('0x5')],_0x49704b[_0x3051('0x18')],_0xddc29));})[_0x3051('0x19')](function(_0x6082cd){logger[_0x3051('0x9')](util[_0x3051('0x10')](_0x3051('0x1a'),_0x17e284[_0x3051('0x3')],_0x17e284[_0x3051('0x5')],_0x6082cd[_0x3051('0x18')],_0x6082cd[_0x3051('0x1b')],_0x6082cd[_0x3051('0x1c')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 07ee7f7..333cc48 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 _0x6a1e=['routing','exports','jayson/promise','bluebird','../../config/logger','client','http','request','then','debug','rpc','error','message','catch'];(function(_0x2ca9d4,_0x51d5c6){var _0x258956=function(_0x47a0e5){while(--_0x47a0e5){_0x2ca9d4['push'](_0x2ca9d4['shift']());}};_0x258956(++_0x51d5c6);}(_0x6a1e,0x11a));var _0xe6a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6a1e[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require(_0xe6a1('0x0'));var BPromise=require(_0xe6a1('0x1'));var logger=require(_0xe6a1('0x2'))('routing');var client=jayson[_0xe6a1('0x3')][_0xe6a1('0x4')]({'port':0x2329});client['Request']=function(_0x5cdf15,_0x2257df){return new BPromise(function(_0x84538,_0xb9ec01){return client[_0xe6a1('0x5')](_0x5cdf15,_0x2257df)[_0xe6a1('0x6')](function(_0x51be8f){logger[_0xe6a1('0x7')](_0xe6a1('0x8'),'routing',_0x5cdf15,_0x2257df,_0x51be8f);if(_0x51be8f[_0xe6a1('0x9')]){logger[_0xe6a1('0x9')](_0xe6a1('0x8'),'routing',_0x5cdf15,_0x51be8f[_0xe6a1('0x9')][_0xe6a1('0xa')],_0x2257df);return _0xb9ec01(_0x51be8f[_0xe6a1('0x9')][_0xe6a1('0xa')]);}else{return _0x84538(_0x51be8f['result']);}})[_0xe6a1('0xb')](function(_0x224e7c){logger[_0xe6a1('0x9')](_0xe6a1('0x8'),_0xe6a1('0xc'),_0x5cdf15,_0x224e7c,_0x2257df);return _0xb9ec01(_0x224e7c);});});};module[_0xe6a1('0xd')]=client; \ No newline at end of file +var _0xff85=['client','http','then','debug','rpc','error','message','result','exports','jayson/promise','bluebird','../../config/logger','routing'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xff85,0x10d));var _0x5ff8=function(_0x131931,_0x4d5255){_0x131931=_0x131931-0x0;var _0x4083d4=_0xff85[_0x131931];return _0x4083d4;};'use strict';var jayson=require(_0x5ff8('0x0'));var BPromise=require(_0x5ff8('0x1'));var logger=require(_0x5ff8('0x2'))(_0x5ff8('0x3'));var client=jayson[_0x5ff8('0x4')][_0x5ff8('0x5')]({'port':0x2329});client['Request']=function(_0x51f598,_0x59d0b5){return new BPromise(function(_0x41db23,_0x4e8ce8){return client['request'](_0x51f598,_0x59d0b5)[_0x5ff8('0x6')](function(_0x5885ff){logger[_0x5ff8('0x7')](_0x5ff8('0x8'),_0x5ff8('0x3'),_0x51f598,_0x59d0b5,_0x5885ff);if(_0x5885ff[_0x5ff8('0x9')]){logger[_0x5ff8('0x9')]('rpc',_0x5ff8('0x3'),_0x51f598,_0x5885ff[_0x5ff8('0x9')]['message'],_0x59d0b5);return _0x4e8ce8(_0x5885ff[_0x5ff8('0x9')][_0x5ff8('0xa')]);}else{return _0x41db23(_0x5885ff[_0x5ff8('0xb')]);}})['catch'](function(_0x47da11){logger[_0x5ff8('0x9')](_0x5ff8('0x8'),'routing',_0x51f598,_0x47da11,_0x59d0b5);return _0x4e8ce8(_0x47da11);});});};module[_0x5ff8('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index a676348..dbf8e2e 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 _0xd138=['./rpc/mailAccount','email','resolve','then','getMailAccounts','initMailAccounts','refresh','getSettings','loginMailFrequency','catch','./server','./realtime','./lib/email'];(function(_0x555890,_0xd516c8){var _0x3e574b=function(_0x4fa027){while(--_0x4fa027){_0x555890['push'](_0x555890['shift']());}};_0x3e574b(++_0xd516c8);}(_0xd138,0x101));var _0x8d13=function(_0x49c4de,_0xac4172){_0x49c4de=_0x49c4de-0x0;var _0xdcc4d3=_0xd138[_0x49c4de];return _0xdcc4d3;};'use strict';var server=require(_0x8d13('0x0'));var Realtime=require(_0x8d13('0x1'));var EmailChannel=require(_0x8d13('0x2'));var mailAccount=require(_0x8d13('0x3'));var setting=require('./rpc/setting');var logger=require('../../config/logger')(_0x8d13('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x8d13('0x5')]()[_0x8d13('0x6')](mailAccount[_0x8d13('0x7')]())['then'](realtime[_0x8d13('0x8')]())[_0x8d13('0x6')](function(){email[_0x8d13('0x9')](realtime['mailAccounts']);return realtime;});}function main(){return server['listen'](realtime,email)[_0x8d13('0x6')](function(){return initRealtime();})[_0x8d13('0x6')](function(){return setting[_0x8d13('0xa')]();})[_0x8d13('0x6')](function(_0x24ad9c){return setInterval(initRealtime,_0x24ad9c[_0x8d13('0xb')]*0x3e8);})[_0x8d13('0xc')](function(_0x42bb09){logger['error']('Email\x20service\x20initialization',_0x42bb09);});}main(); \ No newline at end of file +var _0xaf8f=['loginMailFrequency','error','./server','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','getSettings'];(function(_0x3ef4a9,_0xd0d094){var _0x459339=function(_0x3a3fdb){while(--_0x3a3fdb){_0x3ef4a9['push'](_0x3ef4a9['shift']());}};_0x459339(++_0xd0d094);}(_0xaf8f,0xa7));var _0xfaf8=function(_0x1cc3eb,_0x1e26f9){_0x1cc3eb=_0x1cc3eb-0x0;var _0x3ac1c9=_0xaf8f[_0x1cc3eb];return _0x3ac1c9;};'use strict';var server=require(_0xfaf8('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0xfaf8('0x1'));var mailAccount=require(_0xfaf8('0x2'));var setting=require(_0xfaf8('0x3'));var logger=require(_0xfaf8('0x4'))(_0xfaf8('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0xfaf8('0x6')](mailAccount[_0xfaf8('0x7')]())[_0xfaf8('0x6')](realtime[_0xfaf8('0x8')]())[_0xfaf8('0x6')](function(){email[_0xfaf8('0x9')](realtime[_0xfaf8('0xa')]);return realtime;});}function main(){return server[_0xfaf8('0xb')](realtime,email)['then'](function(){return initRealtime();})[_0xfaf8('0x6')](function(){return setting[_0xfaf8('0xc')]();})['then'](function(_0x1f70ed){return setInterval(initRealtime,_0x1f70ed[_0xfaf8('0xd')]*0x3e8);})['catch'](function(_0x232fc6){logger[_0xfaf8('0xe')]('Email\x20service\x20initialization',_0x232fc6);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index c2b7958..37cdc73 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 _0xfa98=['verifySmtp','Smtp','verify','catch','lodash','moment','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','../rpc/mailAccount','start\x20email\x20channel','imapAccounts','smtp','prototype','emit','key','active','Imap','status','total','stringify','mailAccount:update','hasOwnProperty','service','provider','custom','box','handleImapEmail','bind','end','handleImapEnd','error','handleImapError','isNil','mailAccounts','disabled','messageStatus','handleImapBox','connected','name','messages','notify','then','info','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail','send'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xfa98,0x112));var _0x8fa9=function(_0x392e02,_0x4e14dc){_0x392e02=_0x392e02-0x0;var _0x5ca380=_0xfa98[_0x392e02];return _0x5ca380;};'use strict';var _=require(_0x8fa9('0x0'));var moment=require(_0x8fa9('0x1'));var BPromise=require('bluebird');var md5=require(_0x8fa9('0x2'));var Redis=require(_0x8fa9('0x3'));var config=require(_0x8fa9('0x4'));var logger=require(_0x8fa9('0x5'))(_0x8fa9('0x6'));config[_0x8fa9('0x7')]=_[_0x8fa9('0x8')](config['redis'],{'host':_0x8fa9('0x9'),'port':0x18eb});var io=require(_0x8fa9('0xa'))(new Redis(config['redis']));var EmailImap=require(_0x8fa9('0xb'));var EmailSmtp=require('./smtp');var mailAccount=require(_0x8fa9('0xc'));var md5Accounts={};function EmailChannel(_0x12f71a){logger['info'](_0x8fa9('0xd'));this['mailAccounts']=_0x12f71a['mailAccounts'];this[_0x8fa9('0xe')]={};this[_0x8fa9('0xf')]=new EmailSmtp();}EmailChannel[_0x8fa9('0x10')][_0x8fa9('0x11')]=function(_0x14f42a){var _0x5a0b40=this['mailAccounts'][_0x14f42a];var _0x54ba0a={'id':_0x5a0b40['id'],'name':_0x5a0b40['name'],'key':_0x5a0b40[_0x8fa9('0x12')],'active':_0x5a0b40[_0x8fa9('0x13')],'Imap':{'status':_0x5a0b40[_0x8fa9('0x14')][_0x8fa9('0x15')],'messageStatus':_0x5a0b40[_0x8fa9('0x14')]['messageStatus'],'total':_0x5a0b40[_0x8fa9('0x14')][_0x8fa9('0x16')]}};if(_['isNil'](md5Accounts[_0x14f42a])){md5Accounts[_0x14f42a]={};}var _0x1cbe11=md5(JSON[_0x8fa9('0x17')](_0x54ba0a));if(md5Accounts[_0x14f42a][_0x8fa9('0x2')]!==_0x1cbe11){md5Accounts[_0x14f42a][_0x8fa9('0x2')]=_0x1cbe11;io['emit'](_0x8fa9('0x18'),_0x54ba0a);}};EmailChannel[_0x8fa9('0x10')]['refresh']=function(_0x37e143){for(var _0xd5b740 in _0x37e143){if(_0x37e143[_0x8fa9('0x19')](_0xd5b740)){if(_0x37e143[_0xd5b740][_0x8fa9('0x14')]&&_0x37e143[_0xd5b740][_0x8fa9('0x13')]){var _0x2a8f9e=_0x37e143[_0xd5b740][_0x8fa9('0x14')];if(!_0x2a8f9e[_0x8fa9('0x1a')]&&_0x37e143[_0xd5b740][_0x8fa9('0x1b')]!==_0x8fa9('0x1c'))_0x2a8f9e[_0x8fa9('0x1a')]=_0x37e143[_0xd5b740][_0x8fa9('0x1b')];if(!this['imapAccounts']['hasOwnProperty'](_0x2a8f9e['id'])){this[_0x8fa9('0xe')][_0x2a8f9e['id']]=new EmailImap(_0x2a8f9e,_0x37e143[_0xd5b740][_0x8fa9('0x6')]);this[_0x8fa9('0xe')][_0x2a8f9e['id']]['on'](_0x8fa9('0x1d'),this['handleImapBox']['bind'](this,_0xd5b740));this['imapAccounts'][_0x2a8f9e['id']]['on'](_0x8fa9('0x6'),this[_0x8fa9('0x1e')][_0x8fa9('0x1f')](this,_0xd5b740));this['imapAccounts'][_0x2a8f9e['id']]['on'](_0x8fa9('0x20'),this[_0x8fa9('0x21')]['bind'](this,_0xd5b740));this[_0x8fa9('0xe')][_0x2a8f9e['id']]['on'](_0x8fa9('0x22'),this[_0x8fa9('0x23')][_0x8fa9('0x1f')](this,_0xd5b740));}}else{if(_[_0x8fa9('0x24')](this[_0x8fa9('0x25')][_0xd5b740]['Imap'])){this[_0x8fa9('0x25')][_0xd5b740]['Imap']={};}this['mailAccounts'][_0xd5b740][_0x8fa9('0x14')]['status']=_0x8fa9('0x26');this[_0x8fa9('0x25')][_0xd5b740][_0x8fa9('0x14')][_0x8fa9('0x27')]='';this['emit'](_0xd5b740);}}}};EmailChannel[_0x8fa9('0x10')][_0x8fa9('0x28')]=function(_0x31d9dc,_0x405e46){if(this[_0x8fa9('0x25')][_0x31d9dc]){this['mailAccounts'][_0x31d9dc][_0x8fa9('0x14')][_0x8fa9('0x15')]=_0x8fa9('0x29');this['mailAccounts'][_0x31d9dc]['Imap']['messageStatus']=_0x405e46[_0x8fa9('0x2a')];if(_0x405e46[_0x8fa9('0x2b')]){this['mailAccounts'][_0x31d9dc][_0x8fa9('0x14')][_0x8fa9('0x16')]=_0x405e46[_0x8fa9('0x2b')]['total'];}return this[_0x8fa9('0x11')](_0x31d9dc);}};EmailChannel[_0x8fa9('0x10')][_0x8fa9('0x1e')]=function(_0x1620cd,_0x12a611){logger['info']('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x12a611['firstName'],_0x12a611['lastName'],_0x12a611['from'],_0x1620cd);if(this[_0x8fa9('0x25')][_0x1620cd]){return mailAccount[_0x8fa9('0x2c')](_0x1620cd,_0x12a611)[_0x8fa9('0x2d')](function(_0x376f08){if(_0x376f08){logger[_0x8fa9('0x2e')]('Mail\x20accepted\x20from\x20routing');}})['catch'](function(_0x4d79bc){logger[_0x8fa9('0x22')](_0x8fa9('0x2f'),JSON[_0x8fa9('0x17')](_0x4d79bc));});}};EmailChannel[_0x8fa9('0x10')][_0x8fa9('0x21')]=function(_0x27bd2b){if(this[_0x8fa9('0x25')][_0x27bd2b]&&this[_0x8fa9('0x25')][_0x27bd2b]['Imap']){if(this[_0x8fa9('0xe')][this[_0x8fa9('0x25')][_0x27bd2b]['Imap']['id']]){delete this[_0x8fa9('0xe')][this[_0x8fa9('0x25')][_0x27bd2b][_0x8fa9('0x14')]['id']];}this[_0x8fa9('0x25')][_0x27bd2b][_0x8fa9('0x14')]['lastSync']=moment();this[_0x8fa9('0x11')](_0x27bd2b);}};EmailChannel[_0x8fa9('0x10')][_0x8fa9('0x23')]=function(_0x35adc0,_0x397e9f){if(this[_0x8fa9('0x25')][_0x35adc0]){this['mailAccounts'][_0x35adc0][_0x8fa9('0x14')]['status']=_0x8fa9('0x22');this[_0x8fa9('0x25')][_0x35adc0][_0x8fa9('0x14')][_0x8fa9('0x27')]=_0x397e9f;return this['emit'](_0x35adc0);}};EmailChannel[_0x8fa9('0x10')][_0x8fa9('0x30')]=function(_0x207f66,_0x19f0eb){return this['smtp'][_0x8fa9('0x31')](_0x207f66,_0x19f0eb);};EmailChannel['prototype'][_0x8fa9('0x32')]=function(_0x2072fb){var _0x47e215=this;if(this[_0x8fa9('0x25')][_0x2072fb['id']]){if(_[_0x8fa9('0x24')](this[_0x8fa9('0x25')][_0x2072fb['id']]['Smtp'])){this[_0x8fa9('0x25')][_0x2072fb['id']][_0x8fa9('0x33')]={};}this[_0x8fa9('0x25')][_0x2072fb['id']]['Smtp']['lastSync']=moment();return new BPromise(function(_0x1d2c5d,_0x43fcef){return _0x47e215['smtp'][_0x8fa9('0x34')](_0x2072fb)[_0x8fa9('0x2d')](function(_0x4c9371){_0x47e215[_0x8fa9('0x25')][_0x2072fb['id']]['Smtp'][_0x8fa9('0x15')]='verified';_0x47e215[_0x8fa9('0x25')][_0x2072fb['id']]['Smtp'][_0x8fa9('0x27')]='';_0x47e215['emit'](_0x2072fb['id']);_0x1d2c5d(_0x4c9371);})[_0x8fa9('0x35')](function(_0x2538e9){_0x47e215['mailAccounts'][_0x2072fb['id']][_0x8fa9('0x33')][_0x8fa9('0x15')]=_0x8fa9('0x22');_0x47e215[_0x8fa9('0x25')][_0x2072fb['id']]['Smtp'][_0x8fa9('0x27')]=_0x2538e9;_0x47e215['emit'](_0x2072fb['id']);_0x43fcef(_0x2538e9);});});}return this[_0x8fa9('0xf')][_0x8fa9('0x34')](_0x2072fb);};module['exports']=EmailChannel; \ No newline at end of file +var _0x2e1f=['then','Mail\x20accepted\x20from\x20routing','catch','lastSync','sendMail','smtp','verifySmtp','Smtp','verified','verify','exports','lodash','bluebird','md5','ioredis','redis','localhost','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','imapAccounts','prototype','emit','name','active','status','Imap','messageStatus','total','isNil','stringify','mailAccount:update','service','box','handleImapBox','bind','email','handleImapEnd','error','disabled','connected','messages','handleImapEmail','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','notify'];(function(_0x43379c,_0x271d36){var _0x495648=function(_0x3f4652){while(--_0x3f4652){_0x43379c['push'](_0x43379c['shift']());}};_0x495648(++_0x271d36);}(_0x2e1f,0x1e1));var _0xf2e1=function(_0x13187a,_0x2fcec4){_0x13187a=_0x13187a-0x0;var _0x65b85f=_0x2e1f[_0x13187a];return _0x65b85f;};'use strict';var _=require(_0xf2e1('0x0'));var moment=require('moment');var BPromise=require(_0xf2e1('0x1'));var md5=require(_0xf2e1('0x2'));var Redis=require(_0xf2e1('0x3'));var config=require('../../../config/environment');var logger=require('../../../config/logger')('email');config[_0xf2e1('0x4')]=_['defaults'](config[_0xf2e1('0x4')],{'host':_0xf2e1('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var EmailImap=require('./imap');var EmailSmtp=require('./smtp');var mailAccount=require(_0xf2e1('0x6'));var md5Accounts={};function EmailChannel(_0x2d5b74){logger['info'](_0xf2e1('0x7'));this['mailAccounts']=_0x2d5b74[_0xf2e1('0x8')];this[_0xf2e1('0x9')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0xf2e1('0xa')][_0xf2e1('0xb')]=function(_0x38ef48){var _0x2a7d9c=this['mailAccounts'][_0x38ef48];var _0x5e94d7={'id':_0x2a7d9c['id'],'name':_0x2a7d9c[_0xf2e1('0xc')],'key':_0x2a7d9c['key'],'active':_0x2a7d9c[_0xf2e1('0xd')],'Imap':{'status':_0x2a7d9c['Imap'][_0xf2e1('0xe')],'messageStatus':_0x2a7d9c[_0xf2e1('0xf')][_0xf2e1('0x10')],'total':_0x2a7d9c[_0xf2e1('0xf')][_0xf2e1('0x11')]}};if(_[_0xf2e1('0x12')](md5Accounts[_0x38ef48])){md5Accounts[_0x38ef48]={};}var _0x5d41ee=md5(JSON[_0xf2e1('0x13')](_0x5e94d7));if(md5Accounts[_0x38ef48][_0xf2e1('0x2')]!==_0x5d41ee){md5Accounts[_0x38ef48][_0xf2e1('0x2')]=_0x5d41ee;io['emit'](_0xf2e1('0x14'),_0x5e94d7);}};EmailChannel[_0xf2e1('0xa')]['refresh']=function(_0x4f707a){for(var _0x1bd5cd in _0x4f707a){if(_0x4f707a['hasOwnProperty'](_0x1bd5cd)){if(_0x4f707a[_0x1bd5cd][_0xf2e1('0xf')]&&_0x4f707a[_0x1bd5cd][_0xf2e1('0xd')]){var _0x11ea4d=_0x4f707a[_0x1bd5cd][_0xf2e1('0xf')];if(!_0x11ea4d['service']&&_0x4f707a[_0x1bd5cd]['provider']!=='custom')_0x11ea4d[_0xf2e1('0x15')]=_0x4f707a[_0x1bd5cd]['provider'];if(!this['imapAccounts']['hasOwnProperty'](_0x11ea4d['id'])){this[_0xf2e1('0x9')][_0x11ea4d['id']]=new EmailImap(_0x11ea4d,_0x4f707a[_0x1bd5cd]['email']);this[_0xf2e1('0x9')][_0x11ea4d['id']]['on'](_0xf2e1('0x16'),this[_0xf2e1('0x17')][_0xf2e1('0x18')](this,_0x1bd5cd));this[_0xf2e1('0x9')][_0x11ea4d['id']]['on'](_0xf2e1('0x19'),this['handleImapEmail'][_0xf2e1('0x18')](this,_0x1bd5cd));this['imapAccounts'][_0x11ea4d['id']]['on']('end',this[_0xf2e1('0x1a')][_0xf2e1('0x18')](this,_0x1bd5cd));this[_0xf2e1('0x9')][_0x11ea4d['id']]['on'](_0xf2e1('0x1b'),this['handleImapError']['bind'](this,_0x1bd5cd));}}else{if(_['isNil'](this[_0xf2e1('0x8')][_0x1bd5cd]['Imap'])){this[_0xf2e1('0x8')][_0x1bd5cd]['Imap']={};}this['mailAccounts'][_0x1bd5cd]['Imap']['status']=_0xf2e1('0x1c');this[_0xf2e1('0x8')][_0x1bd5cd]['Imap']['messageStatus']='';this['emit'](_0x1bd5cd);}}}};EmailChannel[_0xf2e1('0xa')][_0xf2e1('0x17')]=function(_0x19d478,_0x423115){if(this['mailAccounts'][_0x19d478]){this[_0xf2e1('0x8')][_0x19d478][_0xf2e1('0xf')]['status']=_0xf2e1('0x1d');this[_0xf2e1('0x8')][_0x19d478]['Imap']['messageStatus']=_0x423115['name'];if(_0x423115[_0xf2e1('0x1e')]){this['mailAccounts'][_0x19d478][_0xf2e1('0xf')]['total']=_0x423115['messages'][_0xf2e1('0x11')];}return this[_0xf2e1('0xb')](_0x19d478);}};EmailChannel['prototype'][_0xf2e1('0x1f')]=function(_0x3f83ca,_0x593024){logger[_0xf2e1('0x20')](_0xf2e1('0x21'),_0x593024[_0xf2e1('0x22')],_0x593024['lastName'],_0x593024['from'],_0x3f83ca);if(this[_0xf2e1('0x8')][_0x3f83ca]){return mailAccount[_0xf2e1('0x23')](_0x3f83ca,_0x593024)[_0xf2e1('0x24')](function(_0x3338ad){if(_0x3338ad){logger[_0xf2e1('0x20')](_0xf2e1('0x25'));}})[_0xf2e1('0x26')](function(_0x34da68){logger[_0xf2e1('0x1b')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON['stringify'](_0x34da68));});}};EmailChannel[_0xf2e1('0xa')][_0xf2e1('0x1a')]=function(_0xd2a57a){if(this['mailAccounts'][_0xd2a57a]&&this['mailAccounts'][_0xd2a57a][_0xf2e1('0xf')]){if(this[_0xf2e1('0x9')][this[_0xf2e1('0x8')][_0xd2a57a][_0xf2e1('0xf')]['id']]){delete this[_0xf2e1('0x9')][this[_0xf2e1('0x8')][_0xd2a57a][_0xf2e1('0xf')]['id']];}this[_0xf2e1('0x8')][_0xd2a57a]['Imap'][_0xf2e1('0x27')]=moment();this[_0xf2e1('0xb')](_0xd2a57a);}};EmailChannel[_0xf2e1('0xa')]['handleImapError']=function(_0xcb891c,_0x40ade2){if(this[_0xf2e1('0x8')][_0xcb891c]){this['mailAccounts'][_0xcb891c][_0xf2e1('0xf')][_0xf2e1('0xe')]=_0xf2e1('0x1b');this[_0xf2e1('0x8')][_0xcb891c][_0xf2e1('0xf')][_0xf2e1('0x10')]=_0x40ade2;return this[_0xf2e1('0xb')](_0xcb891c);}};EmailChannel[_0xf2e1('0xa')][_0xf2e1('0x28')]=function(_0x440553,_0x133af8){return this[_0xf2e1('0x29')]['send'](_0x440553,_0x133af8);};EmailChannel['prototype'][_0xf2e1('0x2a')]=function(_0x1f2439){var _0xc4a66f=this;if(this[_0xf2e1('0x8')][_0x1f2439['id']]){if(_[_0xf2e1('0x12')](this[_0xf2e1('0x8')][_0x1f2439['id']][_0xf2e1('0x2b')])){this['mailAccounts'][_0x1f2439['id']][_0xf2e1('0x2b')]={};}this[_0xf2e1('0x8')][_0x1f2439['id']][_0xf2e1('0x2b')][_0xf2e1('0x27')]=moment();return new BPromise(function(_0x4db16d,_0x397d01){return _0xc4a66f[_0xf2e1('0x29')]['verify'](_0x1f2439)[_0xf2e1('0x24')](function(_0x5b1875){_0xc4a66f[_0xf2e1('0x8')][_0x1f2439['id']][_0xf2e1('0x2b')][_0xf2e1('0xe')]=_0xf2e1('0x2c');_0xc4a66f[_0xf2e1('0x8')][_0x1f2439['id']][_0xf2e1('0x2b')][_0xf2e1('0x10')]='';_0xc4a66f['emit'](_0x1f2439['id']);_0x4db16d(_0x5b1875);})[_0xf2e1('0x26')](function(_0x1424e9){_0xc4a66f[_0xf2e1('0x8')][_0x1f2439['id']][_0xf2e1('0x2b')][_0xf2e1('0xe')]=_0xf2e1('0x1b');_0xc4a66f[_0xf2e1('0x8')][_0x1f2439['id']]['Smtp'][_0xf2e1('0x10')]=_0x1424e9;_0xc4a66f[_0xf2e1('0xb')](_0x1f2439['id']);_0x397d01(_0x1424e9);});});}return this['smtp'][_0xf2e1('0x2d')](_0x1f2439);};module[_0xf2e1('0x2e')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 1c110e5..43ee969 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 _0xc154=['getAccount','once','ready','handleReady','bind','handleEnd','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','password','authentication','anonymous@xcally.com','port','tls','autotls','required','handleOpenBox','emit','readUnseen','handleCloseBox','end','search','UNSEEN','handleReadUnseen','length','fetch','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageEnd','handleSimpleParser','parser','stringify','textCode','hasOwnProperty','exports','lodash','util','imap','mailparser','simpleParser','Iconv','./utils','../../../config/logger','email','mailbox','account'];(function(_0x5ae1af,_0x3a3c68){var _0x57769c=function(_0x31e76b){while(--_0x31e76b){_0x5ae1af['push'](_0x5ae1af['shift']());}};_0x57769c(++_0x3a3c68);}(_0xc154,0xa9));var _0x4c15=function(_0x303265,_0x5a39b5){_0x303265=_0x303265-0x0;var _0x36f876=_0xc154[_0x303265];return _0x36f876;};'use strict';var _=require(_0x4c15('0x0'));var util=require(_0x4c15('0x1'));var Imap=require(_0x4c15('0x2'));var simpleParser=require(_0x4c15('0x3'))[_0x4c15('0x4')];var Iconv=require('iconv')[_0x4c15('0x5')];var EventEmitter=require('events')['EventEmitter'];var utils=require(_0x4c15('0x6'));var logger=require(_0x4c15('0x7'))(_0x4c15('0x8'));function EmailImap(_0x47de8a,_0x29bac4){this['mailbox']=_0x47de8a[_0x4c15('0x9')];this[_0x4c15('0xa')]=this[_0x4c15('0xb')](_0x47de8a,_0x29bac4);this[_0x4c15('0x2')]=new Imap(this['account']);this[_0x4c15('0x2')][_0x4c15('0xc')](_0x4c15('0xd'),this[_0x4c15('0xe')][_0x4c15('0xf')](this));this[_0x4c15('0x2')]['once']('end',this[_0x4c15('0x10')][_0x4c15('0xf')](this));this['imap']['on'](_0x4c15('0x11'),this[_0x4c15('0x12')][_0x4c15('0xf')](this));this['imap'][_0x4c15('0x13')]();}util[_0x4c15('0x14')](EmailImap,EventEmitter);EmailImap[_0x4c15('0x15')][_0x4c15('0xb')]=function(_0x5b127b,_0x166f21){var _0x593feb={'connTimeout':_0x5b127b[_0x4c15('0x16')]?_0x5b127b['connTimeout']*0x3e8:0x2710,'authTimeout':_0x5b127b[_0x4c15('0x17')]?_0x5b127b[_0x4c15('0x17')]*0x3e8:0x1388};if(_0x5b127b[_0x4c15('0x18')]){_0x593feb['user']=_0x5b127b[_0x4c15('0x19')];if(_0x5b127b[_0x4c15('0x1a')]){_0x593feb[_0x4c15('0x1b')]=utils[_0x4c15('0x1c')](_0x5b127b['CloudProvider']['data5'],_0x5b127b[_0x4c15('0x19')]);}else{_0x593feb[_0x4c15('0x1d')]=_0x5b127b[_0x4c15('0x1d')];}}else{if(_0x5b127b[_0x4c15('0x1e')]){_0x593feb[_0x4c15('0x19')]=_0x5b127b[_0x4c15('0x19')];_0x593feb[_0x4c15('0x1d')]=_0x5b127b['password'];}}_0x593feb[_0x4c15('0x8')]=_0x166f21||_0x5b127b['user']||_0x4c15('0x1f');_0x593feb['host']=_0x5b127b['host'];_0x593feb[_0x4c15('0x20')]=_0x5b127b[_0x4c15('0x20')]||0x3e1;if(_0x5b127b[_0x4c15('0x21')]){_0x593feb['tls']=!![];}else{_0x593feb[_0x4c15('0x21')]=![];_0x593feb[_0x4c15('0x22')]=_0x4c15('0x23');}return _0x593feb;};EmailImap[_0x4c15('0x15')][_0x4c15('0xe')]=function(){this[_0x4c15('0x2')]['openBox'](this[_0x4c15('0x9')],![],this[_0x4c15('0x24')][_0x4c15('0xf')](this));};EmailImap[_0x4c15('0x15')][_0x4c15('0x24')]=function(_0x1585c2,_0x576da5){if(_0x1585c2){this[_0x4c15('0x12')](_0x1585c2,!![]);}else{this[_0x4c15('0x25')]('box',_0x576da5);this[_0x4c15('0x26')]();}};EmailImap['prototype'][_0x4c15('0x27')]=function(_0x447494){if(_0x447494){this[_0x4c15('0x12')](_0x447494,!![]);}else{this[_0x4c15('0x2')][_0x4c15('0x28')]();}};EmailImap['prototype'][_0x4c15('0x26')]=function(){this[_0x4c15('0x2')][_0x4c15('0x29')]([_0x4c15('0x2a')],this[_0x4c15('0x2b')]['bind'](this));};EmailImap[_0x4c15('0x15')][_0x4c15('0x2b')]=function(_0x3f9e0c,_0x3ebafc){if(_0x3f9e0c){this['handleError'](_0x3f9e0c,!![]);}else{if(_0x3ebafc[_0x4c15('0x2c')]){try{var _0x54b61c=this[_0x4c15('0x2')][_0x4c15('0x2d')](_0x3ebafc,{'bodies':'','markSeen':!![]});_0x54b61c['on']('message',this[_0x4c15('0x2e')][_0x4c15('0xf')](this));_0x54b61c['once'](_0x4c15('0x11'),this[_0x4c15('0x2f')][_0x4c15('0xf')](this));_0x54b61c[_0x4c15('0xc')]('end',this[_0x4c15('0x30')][_0x4c15('0xf')](this));}catch(_0x4dd00b){logger[_0x4c15('0x11')](_0x4dd00b);}}else{this[_0x4c15('0x2')][_0x4c15('0x31')](!![],this[_0x4c15('0x27')][_0x4c15('0xf')](this));}}};EmailImap[_0x4c15('0x15')][_0x4c15('0x2e')]=function(_0x21612b){_0x21612b['on'](_0x4c15('0x32'),this[_0x4c15('0x33')]['bind'](this));_0x21612b['once'](_0x4c15('0x34'),this['handleMessageAttributes']['bind'](this));_0x21612b[_0x4c15('0xc')](_0x4c15('0x28'),this[_0x4c15('0x35')][_0x4c15('0xf')](this));};EmailImap[_0x4c15('0x15')]['handleMessageBody']=function(_0xfaa76a){simpleParser(_0xfaa76a,{'Iconv':Iconv},this[_0x4c15('0x36')]['bind'](this));};EmailImap[_0x4c15('0x15')]['handleMessageAttributes']=function(){};EmailImap['prototype'][_0x4c15('0x35')]=function(){};EmailImap[_0x4c15('0x15')][_0x4c15('0x36')]=function(_0x4486c9,_0x4d45c7){if(_0x4486c9){logger[_0x4c15('0x11')](_0x4486c9);}else{var _0x332532=this;utils[_0x4c15('0x37')](this['account'],_0x4d45c7,function(_0x72eec6){_0x332532[_0x4c15('0x25')](_0x4c15('0x8'),_0x72eec6);});}};EmailImap[_0x4c15('0x15')][_0x4c15('0x30')]=function(){this[_0x4c15('0x2')]['closeBox'](!![],this[_0x4c15('0x27')]['bind'](this));};EmailImap[_0x4c15('0x15')][_0x4c15('0x2f')]=function(_0x365df8){this[_0x4c15('0x12')](_0x365df8);this['imap'][_0x4c15('0x31')](!![],this['handleCloseBox'][_0x4c15('0xf')](this));};EmailImap['prototype'][_0x4c15('0x10')]=function(){this[_0x4c15('0x25')](_0x4c15('0x28'));};EmailImap[_0x4c15('0x15')]['handleError']=function(_0x5d1681,_0x3ec171){logger[_0x4c15('0x11')](_0x4c15('0x12'),this[_0x4c15('0xa')][_0x4c15('0x8')],JSON[_0x4c15('0x38')](_0x5d1681));var _0x249450='';if(_0x5d1681){if(_0x5d1681[_0x4c15('0x39')]){_0x249450=_0x5d1681[_0x4c15('0x39')];}else{for(var _0x898e38 in _0x5d1681){if(_0x5d1681[_0x4c15('0x3a')](_0x898e38)){_0x249450+=_['upperFirst'](_0x898e38)+':\x20'+_0x5d1681[_0x898e38]+'\x0a';}}}}if(_0x3ec171){this[_0x4c15('0x2')][_0x4c15('0x28')]();}else{this[_0x4c15('0x25')](_0x4c15('0x11'),_0x249450);this[_0x4c15('0x25')](_0x4c15('0x28'));}};module[_0x4c15('0x3b')]=EmailImap; \ No newline at end of file +var _0x613f=['../../../config/logger','email','mailbox','account','once','ready','handleReady','bind','end','handleEnd','error','handleError','inherits','prototype','getAccount','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','anonymous@xcally.com','host','port','tls','autotls','handleOpenBox','emit','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','imap','mailparser','iconv','Iconv','./utils'];(function(_0xaa6fe5,_0x4d4520){var _0x2eeeb8=function(_0x2e3d8c){while(--_0x2e3d8c){_0xaa6fe5['push'](_0xaa6fe5['shift']());}};_0x2eeeb8(++_0x4d4520);}(_0x613f,0xea));var _0xf613=function(_0x1943fb,_0x3a8d99){_0x1943fb=_0x1943fb-0x0;var _0x3361bd=_0x613f[_0x1943fb];return _0x3361bd;};'use strict';var _=require(_0xf613('0x0'));var util=require('util');var Imap=require(_0xf613('0x1'));var simpleParser=require(_0xf613('0x2'))['simpleParser'];var Iconv=require(_0xf613('0x3'))[_0xf613('0x4')];var EventEmitter=require('events')['EventEmitter'];var utils=require(_0xf613('0x5'));var logger=require(_0xf613('0x6'))(_0xf613('0x7'));function EmailImap(_0x237fec,_0x486b66){this[_0xf613('0x8')]=_0x237fec[_0xf613('0x8')];this[_0xf613('0x9')]=this['getAccount'](_0x237fec,_0x486b66);this['imap']=new Imap(this[_0xf613('0x9')]);this['imap'][_0xf613('0xa')](_0xf613('0xb'),this[_0xf613('0xc')][_0xf613('0xd')](this));this[_0xf613('0x1')][_0xf613('0xa')](_0xf613('0xe'),this[_0xf613('0xf')]['bind'](this));this[_0xf613('0x1')]['on'](_0xf613('0x10'),this[_0xf613('0x11')]['bind'](this));this[_0xf613('0x1')]['connect']();}util[_0xf613('0x12')](EmailImap,EventEmitter);EmailImap[_0xf613('0x13')][_0xf613('0x14')]=function(_0x83c1ef,_0x749857){var _0x5da546={'connTimeout':_0x83c1ef[_0xf613('0x15')]?_0x83c1ef[_0xf613('0x15')]*0x3e8:0x2710,'authTimeout':_0x83c1ef[_0xf613('0x16')]?_0x83c1ef[_0xf613('0x16')]*0x3e8:0x1388};if(_0x83c1ef[_0xf613('0x17')]){_0x5da546[_0xf613('0x18')]=_0x83c1ef[_0xf613('0x18')];if(_0x83c1ef[_0xf613('0x19')]){_0x5da546[_0xf613('0x1a')]=utils[_0xf613('0x1b')](_0x83c1ef[_0xf613('0x1c')][_0xf613('0x1d')],_0x83c1ef[_0xf613('0x18')]);}else{_0x5da546['password']=_0x83c1ef[_0xf613('0x1e')];}}else{if(_0x83c1ef[_0xf613('0x1f')]){_0x5da546[_0xf613('0x18')]=_0x83c1ef[_0xf613('0x18')];_0x5da546[_0xf613('0x1e')]=_0x83c1ef[_0xf613('0x1e')];}}_0x5da546['email']=_0x749857||_0x83c1ef[_0xf613('0x18')]||_0xf613('0x20');_0x5da546[_0xf613('0x21')]=_0x83c1ef[_0xf613('0x21')];_0x5da546[_0xf613('0x22')]=_0x83c1ef[_0xf613('0x22')]||0x3e1;if(_0x83c1ef[_0xf613('0x23')]){_0x5da546[_0xf613('0x23')]=!![];}else{_0x5da546[_0xf613('0x23')]=![];_0x5da546[_0xf613('0x24')]='required';}return _0x5da546;};EmailImap['prototype'][_0xf613('0xc')]=function(){this[_0xf613('0x1')]['openBox'](this[_0xf613('0x8')],![],this[_0xf613('0x25')]['bind'](this));};EmailImap['prototype'][_0xf613('0x25')]=function(_0xa4123a,_0x35636b){if(_0xa4123a){this[_0xf613('0x11')](_0xa4123a,!![]);}else{this[_0xf613('0x26')]('box',_0x35636b);this[_0xf613('0x27')]();}};EmailImap[_0xf613('0x13')][_0xf613('0x28')]=function(_0x5d6425){if(_0x5d6425){this['handleError'](_0x5d6425,!![]);}else{this[_0xf613('0x1')]['end']();}};EmailImap[_0xf613('0x13')][_0xf613('0x27')]=function(){this['imap'][_0xf613('0x29')]([_0xf613('0x2a')],this[_0xf613('0x2b')][_0xf613('0xd')](this));};EmailImap[_0xf613('0x13')][_0xf613('0x2b')]=function(_0x286464,_0x207443){if(_0x286464){this[_0xf613('0x11')](_0x286464,!![]);}else{if(_0x207443['length']){try{var _0x41260b=this[_0xf613('0x1')][_0xf613('0x2c')](_0x207443,{'bodies':'','markSeen':!![]});_0x41260b['on'](_0xf613('0x2d'),this[_0xf613('0x2e')][_0xf613('0xd')](this));_0x41260b['once'](_0xf613('0x10'),this[_0xf613('0x2f')][_0xf613('0xd')](this));_0x41260b[_0xf613('0xa')]('end',this[_0xf613('0x30')][_0xf613('0xd')](this));}catch(_0xbd17bd){logger[_0xf613('0x10')](_0xbd17bd);}}else{this['imap'][_0xf613('0x31')](!![],this['handleCloseBox'][_0xf613('0xd')](this));}}};EmailImap[_0xf613('0x13')]['handleFetchMessage']=function(_0x45d1b3){_0x45d1b3['on'](_0xf613('0x32'),this[_0xf613('0x33')]['bind'](this));_0x45d1b3[_0xf613('0xa')]('attributes',this[_0xf613('0x34')]['bind'](this));_0x45d1b3[_0xf613('0xa')](_0xf613('0xe'),this[_0xf613('0x35')][_0xf613('0xd')](this));};EmailImap[_0xf613('0x13')][_0xf613('0x33')]=function(_0x38afcf){simpleParser(_0x38afcf,{'Iconv':Iconv},this[_0xf613('0x36')]['bind'](this));};EmailImap[_0xf613('0x13')][_0xf613('0x34')]=function(){};EmailImap[_0xf613('0x13')][_0xf613('0x35')]=function(){};EmailImap[_0xf613('0x13')][_0xf613('0x36')]=function(_0x1033c8,_0x2e97e1){if(_0x1033c8){logger[_0xf613('0x10')](_0x1033c8);}else{var _0x49ae20=this;utils['parser'](this[_0xf613('0x9')],_0x2e97e1,function(_0x5b560b){_0x49ae20[_0xf613('0x26')](_0xf613('0x7'),_0x5b560b);});}};EmailImap[_0xf613('0x13')][_0xf613('0x30')]=function(){this[_0xf613('0x1')][_0xf613('0x31')](!![],this[_0xf613('0x28')][_0xf613('0xd')](this));};EmailImap[_0xf613('0x13')][_0xf613('0x2f')]=function(_0x36c560){this[_0xf613('0x11')](_0x36c560);this[_0xf613('0x1')][_0xf613('0x31')](!![],this[_0xf613('0x28')][_0xf613('0xd')](this));};EmailImap[_0xf613('0x13')][_0xf613('0xf')]=function(){this[_0xf613('0x26')](_0xf613('0xe'));};EmailImap[_0xf613('0x13')][_0xf613('0x11')]=function(_0x1f442c,_0x12f25a){logger[_0xf613('0x10')]('handleError',this[_0xf613('0x9')][_0xf613('0x7')],JSON[_0xf613('0x37')](_0x1f442c));var _0x4ecc21='';if(_0x1f442c){if(_0x1f442c[_0xf613('0x38')]){_0x4ecc21=_0x1f442c['textCode'];}else{for(var _0x5324ad in _0x1f442c){if(_0x1f442c[_0xf613('0x39')](_0x5324ad)){_0x4ecc21+=_[_0xf613('0x3a')](_0x5324ad)+':\x20'+_0x1f442c[_0x5324ad]+'\x0a';}}}}if(_0x12f25a){this[_0xf613('0x1')][_0xf613('0xe')]();}else{this[_0xf613('0x26')](_0xf613('0x10'),_0x4ecc21);this[_0xf613('0x26')](_0xf613('0xe'));}};module[_0xf613('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 7e5aa92..15408b4 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 _0xcbe2=['nodemailer','prototype','createTransport','compile','sendMail','toString','verify','exports'];(function(_0x2806e0,_0xc69dad){var _0x356c7b=function(_0x13b322){while(--_0x13b322){_0x2806e0['push'](_0x2806e0['shift']());}};_0x356c7b(++_0xc69dad);}(_0xcbe2,0xb8));var _0x2cbe=function(_0x11dae7,_0xc5a4a9){_0x11dae7=_0x11dae7-0x0;var _0x35f704=_0xcbe2[_0x11dae7];return _0x35f704;};'use strict';var nodemailer=require(_0x2cbe('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x2cbe('0x1')]['send']=function(_0x15d532,_0x3041e7){return new Promise(function(_0x2dbdae,_0x2492d0){var _0x5ec01c=nodemailer[_0x2cbe('0x2')](_0x15d532);_0x5ec01c['use'](_0x2cbe('0x3'),inlineBase64());_0x5ec01c[_0x2cbe('0x4')](_0x3041e7,function(_0x1433a3,_0x426708){if(_0x1433a3){_0x2492d0(_0x1433a3[_0x2cbe('0x5')]());}else{_0x2dbdae(_0x426708);}});});};EmailSmtp[_0x2cbe('0x1')][_0x2cbe('0x6')]=function(_0x558a39){return new Promise(function(_0x2e89f7,_0x5dc45d){var _0x208d57=nodemailer[_0x2cbe('0x2')](_0x558a39);_0x208d57['verify'](function(_0x180a68,_0x2a6f85){if(_0x180a68){_0x5dc45d(_0x180a68[_0x2cbe('0x5')]());}else{if(_0x2a6f85){_0x2e89f7(_0x2a6f85);}else{_0x5dc45d('Not\x20verifired');}}});});};module[_0x2cbe('0x7')]=EmailSmtp; \ No newline at end of file +var _0x8893=['sendMail','toString','verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','send','createTransport','compile'];(function(_0x6335f1,_0x45bcb4){var _0x4fba6c=function(_0x32c86d){while(--_0x32c86d){_0x6335f1['push'](_0x6335f1['shift']());}};_0x4fba6c(++_0x45bcb4);}(_0x8893,0x19c));var _0x3889=function(_0x501777,_0x412680){_0x501777=_0x501777-0x0;var _0x2f2681=_0x8893[_0x501777];return _0x2f2681;};'use strict';var nodemailer=require(_0x3889('0x0'));var inlineBase64=require(_0x3889('0x1'));function EmailSmtp(){}EmailSmtp[_0x3889('0x2')][_0x3889('0x3')]=function(_0x2f1f7a,_0x48f00d){return new Promise(function(_0x406f64,_0x1dc04f){var _0x1d516c=nodemailer[_0x3889('0x4')](_0x2f1f7a);_0x1d516c['use'](_0x3889('0x5'),inlineBase64());_0x1d516c[_0x3889('0x6')](_0x48f00d,function(_0x5ee68c,_0x85d0f2){if(_0x5ee68c){_0x1dc04f(_0x5ee68c[_0x3889('0x7')]());}else{_0x406f64(_0x85d0f2);}});});};EmailSmtp['prototype']['verify']=function(_0x25c123){return new Promise(function(_0x233763,_0x37e60a){var _0x39c422=nodemailer[_0x3889('0x4')](_0x25c123);_0x39c422[_0x3889('0x8')](function(_0x44e403,_0x4a358a){if(_0x44e403){_0x37e60a(_0x44e403[_0x3889('0x7')]());}else{if(_0x4a358a){_0x233763(_0x4a358a);}else{_0x37e60a(_0x3889('0x9'));}}});});};module[_0x3889('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 d160bba..0557869 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 _0x335e=['../../../config/logger','email','../../../config/environment','value','address','generate','@xcally.com','head','name','indexOf','length','slice','join','split','isEmpty','anonymous','test','html','replace','includes','Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','randomstring','path','node-tnef'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0x335e,0x87));var _0xe335=function(_0x218df0,_0x257ad5){_0x218df0=_0x218df0-0x0;var _0x17b682=_0x335e[_0x218df0];return _0x17b682;};'use strict';var _=require(_0xe335('0x0'));var moment=require(_0xe335('0x1'));var random=require(_0xe335('0x2'));var fs=require('fs');var path=require(_0xe335('0x3'));var util=require('util');var tnef=require(_0xe335('0x4'));var logger=require(_0xe335('0x5'))(_0xe335('0x6'));var config=require(_0xe335('0x7'));function getAddress(_0x4f2e51){var _0x5d8d61=_['head'](_0x4f2e51[_0xe335('0x8')]);return _0x5d8d61&&_0x5d8d61[_0xe335('0x9')]?_0x5d8d61['address']:'anonymous'+random[_0xe335('0xa')](0x6)+_0xe335('0xb');}function getFirstName(_0x426272){var _0x3fec75=_[_0xe335('0xc')](_0x426272[_0xe335('0x8')]);if(_0x3fec75&&_0x3fec75[_0xe335('0xd')]){if(_0x3fec75['name']==_0x3fec75[_0xe335('0x9')]){return _0x3fec75[_0xe335('0xd')]['substring'](0x0,_0x3fec75['name'][_0xe335('0xe')]('@'));}var _0x24da7f=_0x3fec75[_0xe335('0xd')]['split'](/\s+/);return _0x24da7f[_0xe335('0xf')]>0x1?_0x24da7f[_0xe335('0x10')](0x0,-0x1)[_0xe335('0x11')]('\x20'):_0x3fec75['name'];}return'Anonymous';}function getLastName(_0xfe3142){var _0x17e364=_[_0xe335('0xc')](_0xfe3142['value']);if(_0x17e364&&_0x17e364[_0xe335('0xd')]){var _0x4f7b16=_0x17e364[_0xe335('0xd')][_0xe335('0x12')](/\s+/);return _0x4f7b16[_0xe335('0xf')]>0x1?_0x4f7b16['pop']():'';}return'';}function getMails(_0x4c212a,_0x4c94d4){var _0x239e61='';for(var _0x226995=0x0;_0x226995<_0x4c94d4[_0xe335('0x8')]['length'];_0x226995+=0x1){if(_0x4c94d4[_0xe335('0x8')][_0x226995]['address']!==_0x4c212a){if(!_[_0xe335('0x13')](_0x239e61)){_0x239e61+=',';}_0x239e61+=_0x4c94d4[_0xe335('0x8')][_0x226995][_0xe335('0xd')]||_0x4c94d4[_0xe335('0x8')][_0x226995][_0xe335('0x9')]||'';_0x239e61+='\x20<';_0x239e61+=_0x4c94d4[_0xe335('0x8')][_0x226995]['address']?_0x4c94d4[_0xe335('0x8')][_0x226995][_0xe335('0x9')]:_0xe335('0x14')+random['generate'](0x6)+_0xe335('0xb');_0x239e61+='>';}}return _0x239e61;}function parseEmail(_0x5136d9,_0x4acf5d,_0x347d7f){if(_0x4acf5d['html']){var _0xb5afb5=/)<[^<]*)*<\/script>/gi;while(_0xb5afb5[_0xe335('0x15')](_0x4acf5d[_0xe335('0x16')])){_0x4acf5d['html']=_0x4acf5d[_0xe335('0x16')][_0xe335('0x17')](_0xb5afb5,'');}if(_0x4acf5d['html'][_0xe335('0x18')](_0xe335('0x19'))){var _0x5a04d9=[];_0x4acf5d['attachments'][_0xe335('0x1a')](_0x92c42c=>{_0x5a04d9[_0xe335('0x1b')](_0x92c42c[_0xe335('0x1c')]);});var _0x2141fe=/]+>/g;var _0x2bffaf=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x49abb3=_0x4acf5d[_0xe335('0x16')][_0xe335('0x17')](_0x2bffaf,_0xe335('0x1d'));var _0x281a1d=_0x49abb3[_0xe335('0x17')](_0x2141fe,'_IMG');for(let _0xfe2ef2=0x0;_0xfe2ef2<_0x5a04d9['length'];_0xfe2ef2++){var _0x187856=_0x281a1d[_0xe335('0x17')](_0xe335('0x1e'),'\x20[Attachment:\x20'+_0x5a04d9[_0xfe2ef2]+'\x20]');_0x281a1d=_0x187856;}_0x4acf5d['html']=_0x281a1d;}_0x347d7f[_0xe335('0x1f')]=_0x4acf5d[_0xe335('0x16')];}else{_0x347d7f['body']=_0x4acf5d[_0xe335('0x20')];}if(_0x347d7f['body']){_0x347d7f[_0xe335('0x1f')]=_0x347d7f[_0xe335('0x1f')][_0xe335('0x17')](/0x0){var _0x2b1776=[_0xe335('0x2c'),_0xe335('0x2d'),'Precedence:\x20auto_reply'];for(var _0x3aeb72=0x0;_0x3aeb72<_0x4acf5d['headerLines'][_0xe335('0xf')];_0x3aeb72++){var _0x30d072=_[_0xe335('0xe')](_0x2b1776,_0x4acf5d[_0xe335('0x2b')][_0x3aeb72]['line']);if(_0x30d072>=0x0){_0x347d7f[_0xe335('0x2e')]=!![];}}}return _0x347d7f;}exports[_0xe335('0x2f')]=function(_0x563137,_0x2b81bc,_0x1e3e82){var _0x578ae4={'from':getAddress(_0x2b81bc[_0xe335('0x30')]),'firstName':getFirstName(_0x2b81bc['from']),'lastName':getLastName(_0x2b81bc[_0xe335('0x30')]),'mapKey':_0xe335('0x6'),'message':{'from':getMails(_0x563137[_0xe335('0x6')],_0x2b81bc[_0xe335('0x30')]),'to':_0x563137['email'],'cc':'','subject':_0x2b81bc['subject']||'','messageId':_0x2b81bc[_0xe335('0x31')],'inReplyTo':_0x2b81bc[_0xe335('0x32')],'sentAt':moment(_0x2b81bc[_0xe335('0x33')])[_0xe335('0x27')](_0xe335('0x34')),'attach':![],'attachments':[]}};if(!_0x2b81bc['html']&&!_0x2b81bc[_0xe335('0x20')]){var _0x11aa49=_[_0xe335('0x35')](_0x2b81bc['attachments'],{'contentType':'application/ms-tnef'});if(_0x11aa49[_0xe335('0xf')]){logger[_0xe335('0x36')](util['format'](_0xe335('0x37'),_0x2b81bc[_0xe335('0x31')]));tnef[_0xe335('0x38')](_[_0xe335('0x39')](_0x11aa49)[_0xe335('0x3a')],function(_0x23518b,_0x57a9d6){if(_0x57a9d6){_0x2b81bc[_0xe335('0x16')]=_0x57a9d6[_0xe335('0x3b')]||_0xe335('0x3c');if(_0x57a9d6[_0xe335('0x3d')]){for(var _0x45f936=0x0;_0x45f936<_0x57a9d6[_0xe335('0x3d')][_0xe335('0xf')];_0x45f936++){var _0xa63f32=_0x57a9d6[_0xe335('0x3d')][_0x45f936];_0x578ae4[_0xe335('0x21')][_0xe335('0x25')][_0xe335('0x1b')]({'filename':_0xa63f32[_0xe335('0x3e')],'content':Buffer['from'](_0xa63f32[_0xe335('0x3f')])});}}}_0x1e3e82(parseEmail(_0x563137,_0x2b81bc,_0x578ae4));});}else{_0x2b81bc['html']=_0xe335('0x3c');_0x1e3e82(parseEmail(_0x563137,_0x2b81bc,_0x578ae4));}}else{_0x1e3e82(parseEmail(_0x563137,_0x2b81bc,_0x578ae4));}};exports[_0xe335('0x40')]=function(_0x592595,_0x1a8aa9){var _0x1ef553=[_0xe335('0x41')+(_0x1a8aa9||''),_0xe335('0x42')+_0x592595,'',''];return Buffer['from'](_0x1ef553['join'](''),_0xe335('0x43'))[_0xe335('0x44')](_0xe335('0x45'));}; \ No newline at end of file +var _0x3162=['join','generate','html','test','replace','','body','textAsHtml','Empty\x20message

','generateXOAuth2Token','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','../../../config/environment','head','value','address','anonymous','@xcally.com','name','length','slice'];(function(_0x5ebda0,_0x385f04){var _0x4ec370=function(_0x16a040){while(--_0x16a040){_0x5ebda0['push'](_0x5ebda0['shift']());}};_0x4ec370(++_0x385f04);}(_0x3162,0x110));var _0x2316=function(_0x197b38,_0x394a4d){_0x197b38=_0x197b38-0x0;var _0x20a23a=_0x3162[_0x197b38];return _0x20a23a;};'use strict';var _=require(_0x2316('0x0'));var moment=require(_0x2316('0x1'));var random=require(_0x2316('0x2'));var fs=require('fs');var path=require(_0x2316('0x3'));var util=require(_0x2316('0x4'));var tnef=require(_0x2316('0x5'));var logger=require(_0x2316('0x6'))('email');var config=require(_0x2316('0x7'));function getAddress(_0x475439){var _0x5bdbbe=_[_0x2316('0x8')](_0x475439[_0x2316('0x9')]);return _0x5bdbbe&&_0x5bdbbe['address']?_0x5bdbbe[_0x2316('0xa')]:_0x2316('0xb')+random['generate'](0x6)+_0x2316('0xc');}function getFirstName(_0x428e23){var _0x420970=_[_0x2316('0x8')](_0x428e23[_0x2316('0x9')]);if(_0x420970&&_0x420970[_0x2316('0xd')]){if(_0x420970['name']==_0x420970[_0x2316('0xa')]){return _0x420970[_0x2316('0xd')]['substring'](0x0,_0x420970[_0x2316('0xd')]['indexOf']('@'));}var _0x5acbb7=_0x420970[_0x2316('0xd')]['split'](/\s+/);return _0x5acbb7[_0x2316('0xe')]>0x1?_0x5acbb7[_0x2316('0xf')](0x0,-0x1)[_0x2316('0x10')]('\x20'):_0x420970['name'];}return'Anonymous';}function getLastName(_0x4439d6){var _0x504995=_[_0x2316('0x8')](_0x4439d6[_0x2316('0x9')]);if(_0x504995&&_0x504995[_0x2316('0xd')]){var _0x5082ed=_0x504995[_0x2316('0xd')]['split'](/\s+/);return _0x5082ed[_0x2316('0xe')]>0x1?_0x5082ed['pop']():'';}return'';}function getMails(_0x29df36,_0x11e6d5){var _0x3798aa='';for(var _0x54ba47=0x0;_0x54ba47<_0x11e6d5['value']['length'];_0x54ba47+=0x1){if(_0x11e6d5[_0x2316('0x9')][_0x54ba47][_0x2316('0xa')]!==_0x29df36){if(!_['isEmpty'](_0x3798aa)){_0x3798aa+=',';}_0x3798aa+=_0x11e6d5[_0x2316('0x9')][_0x54ba47]['name']||_0x11e6d5[_0x2316('0x9')][_0x54ba47][_0x2316('0xa')]||'';_0x3798aa+='\x20<';_0x3798aa+=_0x11e6d5['value'][_0x54ba47]['address']?_0x11e6d5[_0x2316('0x9')][_0x54ba47][_0x2316('0xa')]:_0x2316('0xb')+random[_0x2316('0x11')](0x6)+_0x2316('0xc');_0x3798aa+='>';}}return _0x3798aa;}function parseEmail(_0x2a8474,_0x3064ca,_0x40a478){if(_0x3064ca[_0x2316('0x12')]){var _0x4bd7ad=/)<[^<]*)*<\/script>/gi;while(_0x4bd7ad[_0x2316('0x13')](_0x3064ca[_0x2316('0x12')])){_0x3064ca[_0x2316('0x12')]=_0x3064ca[_0x2316('0x12')][_0x2316('0x14')](_0x4bd7ad,'');}if(_0x3064ca['html']['includes'](_0x2316('0x15'))){var _0x4b68e3=[];_0x3064ca['attachments']['forEach'](_0x4d0079=>{_0x4b68e3[_0x2316('0x16')](_0x4d0079[_0x2316('0x17')]);});var _0x279fa7=/]+>/g;var _0x2876cf=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x5b6779=_0x3064ca[_0x2316('0x12')]['replace'](_0x2876cf,_0x2316('0x18'));var _0x559244=_0x5b6779[_0x2316('0x14')](_0x279fa7,_0x2316('0x19'));for(let _0x49274c=0x0;_0x49274c<_0x4b68e3[_0x2316('0xe')];_0x49274c++){var _0xac35a9=_0x559244[_0x2316('0x14')](_0x2316('0x19'),'\x20[Attachment:\x20'+_0x4b68e3[_0x49274c]+_0x2316('0x1a'));_0x559244=_0xac35a9;}_0x3064ca[_0x2316('0x12')]=_0x559244;}_0x40a478[_0x2316('0x1b')]=_0x3064ca['html'];}else{_0x40a478[_0x2316('0x1b')]=_0x3064ca[_0x2316('0x1c')];}if(_0x40a478[_0x2316('0x1b')]){_0x40a478[_0x2316('0x1b')]=_0x40a478[_0x2316('0x1b')][_0x2316('0x14')](/0x0){var _0xdff37e=[_0x2316('0x31'),'X-Auto-Response-Suppress:\x20All',_0x2316('0x32')];for(var _0x134e0f=0x0;_0x134e0f<_0x3064ca[_0x2316('0x30')][_0x2316('0xe')];_0x134e0f++){var _0x307a32=_[_0x2316('0x33')](_0xdff37e,_0x3064ca[_0x2316('0x30')][_0x134e0f]['line']);if(_0x307a32>=0x0){_0x40a478[_0x2316('0x34')]=!![];}}}return _0x40a478;}exports[_0x2316('0x35')]=function(_0x5ca3d0,_0xf82603,_0x574d68){var _0x185549={'from':getAddress(_0xf82603[_0x2316('0x36')]),'firstName':getFirstName(_0xf82603['from']),'lastName':getLastName(_0xf82603[_0x2316('0x36')]),'mapKey':_0x2316('0x1f'),'message':{'from':getMails(_0x5ca3d0['email'],_0xf82603[_0x2316('0x36')]),'to':_0x5ca3d0[_0x2316('0x1f')],'cc':'','subject':_0xf82603[_0x2316('0x37')]||'','messageId':_0xf82603['messageId'],'inReplyTo':_0xf82603['inReplyTo'],'sentAt':moment(_0xf82603['date'])[_0x2316('0x38')](_0x2316('0x39')),'attach':![],'attachments':[]}};if(!_0xf82603[_0x2316('0x12')]&&!_0xf82603[_0x2316('0x1c')]){var _0x244d6a=_['filter'](_0xf82603[_0x2316('0x26')],{'contentType':'application/ms-tnef'});if(_0x244d6a[_0x2316('0xe')]){logger[_0x2316('0x3a')](util[_0x2316('0x38')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0xf82603[_0x2316('0x3b')]));tnef[_0x2316('0x3c')](_[_0x2316('0x3d')](_0x244d6a)[_0x2316('0x2e')],function(_0x7165ae,_0x1bd5ca){if(_0x1bd5ca){_0xf82603[_0x2316('0x12')]=_0x1bd5ca[_0x2316('0x3e')]||'

Empty\x20message

';if(_0x1bd5ca[_0x2316('0x3f')]){for(var _0x4d9b9a=0x0;_0x4d9b9a<_0x1bd5ca[_0x2316('0x3f')][_0x2316('0xe')];_0x4d9b9a++){var _0x1c4018=_0x1bd5ca[_0x2316('0x3f')][_0x4d9b9a];_0x185549[_0x2316('0x21')][_0x2316('0x26')][_0x2316('0x16')]({'filename':_0x1c4018[_0x2316('0x40')],'content':Buffer[_0x2316('0x36')](_0x1c4018[_0x2316('0x41')])});}}}_0x574d68(parseEmail(_0x5ca3d0,_0xf82603,_0x185549));});}else{_0xf82603[_0x2316('0x12')]=_0x2316('0x42');_0x574d68(parseEmail(_0x5ca3d0,_0xf82603,_0x185549));}}else{_0x574d68(parseEmail(_0x5ca3d0,_0xf82603,_0x185549));}};exports[_0x2316('0x43')]=function(_0x19c1e6,_0x52995c){var _0x2291d5=['user='+(_0x52995c||''),_0x2316('0x44')+_0x19c1e6,'',''];return Buffer[_0x2316('0x36')](_0x2291d5[_0x2316('0x10')](''),_0x2316('0x45'))[_0x2316('0x46')](_0x2316('0x47'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 42f2a6e..f07e087 100644 --- a/server/services/email/model/mailAccount.js +++ b/server/services/email/model/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x19df=['Imap','Smtp','exports','lodash','name','Service','key','SERV'];(function(_0x56eb70,_0x2bd75c){var _0x47f1fe=function(_0x1fbb17){while(--_0x1fbb17){_0x56eb70['push'](_0x56eb70['shift']());}};_0x47f1fe(++_0x2bd75c);}(_0x19df,0x8b));var _0xf19d=function(_0x191154,_0x56f74c){_0x191154=_0x191154-0x0;var _0x3dcd73=_0x19df[_0x191154];return _0x3dcd73;};'use strict';var _=require(_0xf19d('0x0'));function MailAccount(_0xe6f248){this['id']=_0xe6f248['id']||0x0;this[_0xf19d('0x1')]=_0xe6f248[_0xf19d('0x1')]||_0xf19d('0x2');this[_0xf19d('0x3')]=_0xe6f248[_0xf19d('0x3')]||_0xf19d('0x4');this['active']=_0xe6f248['active']||![];this['Imap']=_0xe6f248[_0xf19d('0x5')]||[];this[_0xf19d('0x6')]=_0xe6f248['Smtp']||[];}module[_0xf19d('0x7')]=MailAccount; \ No newline at end of file +var _0x32e1=['Service','key','active','Imap','Smtp','name'];(function(_0x48481c,_0x1e2ce2){var _0x1781a9=function(_0x2d965f){while(--_0x2d965f){_0x48481c['push'](_0x48481c['shift']());}};_0x1781a9(++_0x1e2ce2);}(_0x32e1,0x1a9));var _0x132e=function(_0x17c1d0,_0x4b931a){_0x17c1d0=_0x17c1d0-0x0;var _0x336506=_0x32e1[_0x17c1d0];return _0x336506;};'use strict';var _=require('lodash');function MailAccount(_0x4e90bd){this['id']=_0x4e90bd['id']||0x0;this[_0x132e('0x0')]=_0x4e90bd[_0x132e('0x0')]||_0x132e('0x1');this[_0x132e('0x2')]=_0x4e90bd[_0x132e('0x2')]||'SERV';this[_0x132e('0x3')]=_0x4e90bd['active']||![];this[_0x132e('0x4')]=_0x4e90bd[_0x132e('0x4')]||[];this[_0x132e('0x5')]=_0x4e90bd[_0x132e('0x5')]||[];}module['exports']=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index ffc0f79..6d0d53b 100644 --- a/server/services/email/realtime/index.js +++ b/server/services/email/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x52f6=['../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','length','isUndefined','merge','exports','lodash'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0x52f6,0x6d));var _0x652f=function(_0x531756,_0x2eb1da){_0x531756=_0x531756-0x0;var _0x37d96a=_0x52f6[_0x531756];return _0x37d96a;};'use strict';var _=require(_0x652f('0x0'));var MailAccount=require(_0x652f('0x1'));var Realtime=function(){this[_0x652f('0x2')]={};};function freeIsNotKey(_0x46978f,_0x1d5e0b,_0x28e2d1){var _0x419e55=_[_0x652f('0x3')](_0x46978f,function(_0x54c489,_0x5ef557){return _0x54c489[_0x28e2d1];});for(var _0x4dd5fe in _0x1d5e0b){if(_0x1d5e0b[_0x652f('0x4')](_0x4dd5fe)){if(!_0x419e55[_0x4dd5fe]){delete _0x1d5e0b[_0x4dd5fe];}}}}Realtime[_0x652f('0x5')][_0x652f('0x6')]=function(_0x257d44,_0x58707e){for(var _0x10f34e in _0x58707e){if(_0x257d44[_0x652f('0x4')](_0x10f34e)){_0x257d44[_0x10f34e]=_0x58707e[_0x10f34e];}}};Realtime[_0x652f('0x5')]['initMailAccounts']=function(){var _0x5de2cf=this;return function(_0x4229ec){if(_0x4229ec){freeIsNotKey(_0x4229ec,_0x5de2cf[_0x652f('0x2')],'id');for(var _0xfa79a5=0x0,_0x577c21={},_0x39a60e={};_0xfa79a5<_0x4229ec[_0x652f('0x7')];_0xfa79a5+=0x1){_0x577c21=_0x4229ec[_0xfa79a5];if(_[_0x652f('0x8')](_0x5de2cf[_0x652f('0x2')][_0x577c21['id']])){_0x5de2cf[_0x652f('0x2')][_0x577c21['id']]=new MailAccount(_0x577c21);}else{_[_0x652f('0x9')](_0x5de2cf[_0x652f('0x2')][_0x577c21['id']],_0x577c21);}}}return _0x5de2cf[_0x652f('0x2')];};};module[_0x652f('0xa')]=Realtime; \ No newline at end of file +var _0xf409=['isUndefined','merge','exports','lodash','../model/mailAccount','mailAccounts','mapKeys','mergeFromDatabase','hasOwnProperty','length'];(function(_0x4953da,_0x5adaca){var _0x2d3780=function(_0x458f36){while(--_0x458f36){_0x4953da['push'](_0x4953da['shift']());}};_0x2d3780(++_0x5adaca);}(_0xf409,0x1cf));var _0x9f40=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xf409[_0x4709c0];return _0x13348b;};'use strict';var _=require(_0x9f40('0x0'));var MailAccount=require(_0x9f40('0x1'));var Realtime=function(){this[_0x9f40('0x2')]={};};function freeIsNotKey(_0x297a2c,_0x24f243,_0x303fc4){var _0x18da4f=_[_0x9f40('0x3')](_0x297a2c,function(_0x491473,_0x4c1655){return _0x491473[_0x303fc4];});for(var _0x50a2b2 in _0x24f243){if(_0x24f243['hasOwnProperty'](_0x50a2b2)){if(!_0x18da4f[_0x50a2b2]){delete _0x24f243[_0x50a2b2];}}}}Realtime['prototype'][_0x9f40('0x4')]=function(_0x355739,_0xac0e7d){for(var _0x16f95f in _0xac0e7d){if(_0x355739[_0x9f40('0x5')](_0x16f95f)){_0x355739[_0x16f95f]=_0xac0e7d[_0x16f95f];}}};Realtime['prototype']['initMailAccounts']=function(){var _0x417aa4=this;return function(_0x4ebb9b){if(_0x4ebb9b){freeIsNotKey(_0x4ebb9b,_0x417aa4[_0x9f40('0x2')],'id');for(var _0x966072=0x0,_0x3efcee={},_0x1f61f2={};_0x966072<_0x4ebb9b[_0x9f40('0x6')];_0x966072+=0x1){_0x3efcee=_0x4ebb9b[_0x966072];if(_[_0x9f40('0x7')](_0x417aa4[_0x9f40('0x2')][_0x3efcee['id']])){_0x417aa4['mailAccounts'][_0x3efcee['id']]=new MailAccount(_0x3efcee);}else{_[_0x9f40('0x8')](_0x417aa4['mailAccounts'][_0x3efcee['id']],_0x3efcee);}}}return _0x417aa4[_0x9f40('0x2')];};};module[_0x9f40('0x9')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index a04161f..d322c7f 100644 --- a/server/services/email/rpc/mailAccount.js +++ b/server/services/email/rpc/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1241=['Smtp','type','data5','getMailAccount','../client','Request','GetMailAccount','name','provider','service','active','key','ListId','MailServerIn','Imap','CloudProvider'];(function(_0x20434c,_0x27cb75){var _0x281fdf=function(_0x3cc48f){while(--_0x3cc48f){_0x20434c['push'](_0x20434c['shift']());}};_0x281fdf(++_0x27cb75);}(_0x1241,0xb4));var _0x1124=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1241[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x1124('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0x1124('0x1')](_0x1124('0x2'),{'options':{'attributes':['id',_0x1124('0x3'),_0x1124('0x4'),_0x1124('0x5'),'email',_0x1124('0x6'),_0x1124('0x7'),_0x1124('0x8'),'TemplateId'],'raw':![],'include':[{'model':_0x1124('0x9'),'as':_0x1124('0xa'),'include':[{'model':_0x1124('0xb'),'attributes':['id',_0x1124('0x3'),'service','type','data5'],'as':_0x1124('0xb')}]},{'model':'MailServerOut','as':_0x1124('0xc'),'include':[{'model':_0x1124('0xb'),'attributes':['id',_0x1124('0x3'),_0x1124('0x5'),_0x1124('0xd'),_0x1124('0xe')],'as':'CloudProvider'}]}]},'log':_0x1124('0xf')});};};exports['notify']=function(_0x50584c,_0x4c5ec2){return client[_0x1124('0x1')]('NotifyMailAccount',{'account':{'id':_0x50584c},'body':_0x4c5ec2,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0xe714=['GetMailAccount','name','provider','email','key','ListId','TemplateId','MailServerIn','Imap','CloudProvider','service','type','data5','MailServerOut','getMailAccount','notify','NotifyMailAccount','../client','Request'];(function(_0x16b691,_0x1d92eb){var _0x4c5dee=function(_0x5c6905){while(--_0x5c6905){_0x16b691['push'](_0x16b691['shift']());}};_0x4c5dee(++_0x1d92eb);}(_0xe714,0xe2));var _0x4e71=function(_0xf7248e,_0x326d62){_0xf7248e=_0xf7248e-0x0;var _0x1eac94=_0xe714[_0xf7248e];return _0x1eac94;};'use strict';var client=require(_0x4e71('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0x4e71('0x1')](_0x4e71('0x2'),{'options':{'attributes':['id',_0x4e71('0x3'),_0x4e71('0x4'),'service',_0x4e71('0x5'),'active',_0x4e71('0x6'),_0x4e71('0x7'),_0x4e71('0x8')],'raw':![],'include':[{'model':_0x4e71('0x9'),'as':_0x4e71('0xa'),'include':[{'model':_0x4e71('0xb'),'attributes':['id','name',_0x4e71('0xc'),_0x4e71('0xd'),_0x4e71('0xe')],'as':'CloudProvider'}]},{'model':_0x4e71('0xf'),'as':'Smtp','include':[{'model':_0x4e71('0xb'),'attributes':['id',_0x4e71('0x3'),_0x4e71('0xc'),_0x4e71('0xd'),_0x4e71('0xe')],'as':_0x4e71('0xb')}]}]},'log':_0x4e71('0x10')});};};exports[_0x4e71('0x11')]=function(_0x52d45f,_0x13c582){return client[_0x4e71('0x1')]('NotifyMailAccount',{'account':{'id':_0x52d45f},'body':_0x13c582,'log':_0x4e71('0x12')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 684f6b4..2ee86ba 100644 --- a/server/services/email/rpc/setting.js +++ b/server/services/email/rpc/setting.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e9a=['GetSettings','../client','getSettings','Request','ShowSetting','loginMailFrequency'];(function(_0x53210a,_0x4a49f1){var _0x82411c=function(_0x2208ef){while(--_0x2208ef){_0x53210a['push'](_0x53210a['shift']());}};_0x82411c(++_0x4a49f1);}(_0x3e9a,0x6d));var _0xa3e9=function(_0x26035d,_0xc68032){_0x26035d=_0x26035d-0x0;var _0x18de85=_0x3e9a[_0x26035d];return _0x18de85;};'use strict';var client=require(_0xa3e9('0x0'));exports[_0xa3e9('0x1')]=function(){return client[_0xa3e9('0x2')](_0xa3e9('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xa3e9('0x4')]},'log':_0xa3e9('0x5')});}; \ No newline at end of file +var _0x3e0c=['getSettings','Request','ShowSetting','loginMailFrequency','GetSettings','../client'];(function(_0x4c6bca,_0x3de390){var _0x29d58e=function(_0x1ac871){while(--_0x1ac871){_0x4c6bca['push'](_0x4c6bca['shift']());}};_0x29d58e(++_0x3de390);}(_0x3e0c,0x1cd));var _0xc3e0=function(_0x34434d,_0x5ad557){_0x34434d=_0x34434d-0x0;var _0x29b809=_0x3e0c[_0x34434d];return _0x29b809;};'use strict';var client=require(_0xc3e0('0x0'));exports[_0xc3e0('0x1')]=function(){return client[_0xc3e0('0x2')](_0xc3e0('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xc3e0('0x4')]},'log':_0xc3e0('0x5')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index d6a668a..729c9ce 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index 1399fe6..b4aed33 100644 --- a/server/services/express/index.js +++ b/server/services/express/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb0d1=['redis','defaults','localhost','socket.io-redis','default','../../config/socketio','../../config/express','../../routes','once','listening','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','express','sticky-session','ioredis','../../config/environment','createServer','timeout','port','websocket','polling'];(function(_0x59cef9,_0x46b467){var _0x49bc08=function(_0x45d117){while(--_0x45d117){_0x59cef9['push'](_0x59cef9['shift']());}};_0x49bc08(++_0x46b467);}(_0xb0d1,0x1f0));var _0x1b0d=function(_0x157d66,_0x2de3be){_0x157d66=_0x157d66-0x0;var _0x44113e=_0xb0d1[_0x157d66];return _0x44113e;};'use strict';var _=require(_0x1b0d('0x0'));var http=require('http');var express=require(_0x1b0d('0x1'));var sticky=require(_0x1b0d('0x2'));var Redis=require(_0x1b0d('0x3'));var config=require(_0x1b0d('0x4'));var app=express();var server=http[_0x1b0d('0x5')](app);server[_0x1b0d('0x6')]=0xdbba0;if(sticky['listen'](server,config[_0x1b0d('0x7')])){var socketio=require('socket.io')(server,{'transports':[_0x1b0d('0x8'),_0x1b0d('0x9')]});config[_0x1b0d('0xa')]=_[_0x1b0d('0xb')](config['redis'],{'host':_0x1b0d('0xc'),'port':0x18eb});socketio['adapter'](require(_0x1b0d('0xd'))({'pubClient':new Redis(config[_0x1b0d('0xa')]),'subClient':new Redis(config[_0x1b0d('0xa')])}));require('../../config/triggers')[_0x1b0d('0xe')]();require(_0x1b0d('0xf'))[_0x1b0d('0xe')](socketio);require(_0x1b0d('0x10'))[_0x1b0d('0xe')](app);require(_0x1b0d('0x11'))[_0x1b0d('0xe')](app);}else{server[_0x1b0d('0x12')](_0x1b0d('0x13'),function(){console['log'](_0x1b0d('0x14'),config['port']);});}exports=module[_0x1b0d('0x15')]=app; \ No newline at end of file +var _0x2234=['http','express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','socket.io','websocket','redis','defaults','localhost','adapter','socket.io-redis','default','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','port','exports'];(function(_0x5bab55,_0x28c54d){var _0x34ddc1=function(_0x22583e){while(--_0x22583e){_0x5bab55['push'](_0x5bab55['shift']());}};_0x34ddc1(++_0x28c54d);}(_0x2234,0x1b8));var _0x4223=function(_0x48fefe,_0x341c3f){_0x48fefe=_0x48fefe-0x0;var _0x5dd63b=_0x2234[_0x48fefe];return _0x5dd63b;};'use strict';var _=require('lodash');var http=require(_0x4223('0x0'));var express=require(_0x4223('0x1'));var sticky=require(_0x4223('0x2'));var Redis=require(_0x4223('0x3'));var config=require(_0x4223('0x4'));var app=express();var server=http[_0x4223('0x5')](app);server[_0x4223('0x6')]=0xdbba0;if(sticky[_0x4223('0x7')](server,config['port'])){var socketio=require(_0x4223('0x8'))(server,{'transports':[_0x4223('0x9'),'polling']});config[_0x4223('0xa')]=_[_0x4223('0xb')](config[_0x4223('0xa')],{'host':_0x4223('0xc'),'port':0x18eb});socketio[_0x4223('0xd')](require(_0x4223('0xe'))({'pubClient':new Redis(config[_0x4223('0xa')]),'subClient':new Redis(config['redis'])}));require('../../config/triggers')['default']();require('../../config/socketio')[_0x4223('0xf')](socketio);require('../../config/express')['default'](app);require('../../routes')[_0x4223('0xf')](app);}else{server[_0x4223('0x10')](_0x4223('0x11'),function(){console[_0x4223('0x12')](_0x4223('0x13'),config[_0x4223('0x14')]);});}exports=module[_0x4223('0x15')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 9c6491f..aa72a87 100644 --- a/server/services/routing/client.js +++ b/server/services/routing/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7f3d=['jayson/promise','bluebird','../../config/logger','routing','client','http','Request','request','then','debug','rpc','error','message','result','catch'];(function(_0x545a7a,_0x29d056){var _0x195196=function(_0x4fffd5){while(--_0x4fffd5){_0x545a7a['push'](_0x545a7a['shift']());}};_0x195196(++_0x29d056);}(_0x7f3d,0x10e));var _0xd7f3=function(_0x390a19,_0x5dd137){_0x390a19=_0x390a19-0x0;var _0x5d8230=_0x7f3d[_0x390a19];return _0x5d8230;};'use strict';var jayson=require(_0xd7f3('0x0'));var BPromise=require(_0xd7f3('0x1'));var logger=require(_0xd7f3('0x2'))(_0xd7f3('0x3'));var client=jayson[_0xd7f3('0x4')][_0xd7f3('0x5')]({'port':0x2329});client[_0xd7f3('0x6')]=function(_0x398e4b,_0x5c7034){return new BPromise(function(_0x31d7bb,_0x2009e2){return client[_0xd7f3('0x7')](_0x398e4b,_0x5c7034)[_0xd7f3('0x8')](function(_0x4a6794){logger[_0xd7f3('0x9')](_0xd7f3('0xa'),_0xd7f3('0x3'),_0x398e4b,_0x5c7034,_0x4a6794);if(_0x4a6794[_0xd7f3('0xb')]){logger['error'](_0xd7f3('0xa'),_0xd7f3('0x3'),_0x398e4b,_0x4a6794[_0xd7f3('0xb')][_0xd7f3('0xc')],_0x5c7034);return _0x2009e2(_0x4a6794[_0xd7f3('0xb')]['message']);}else{return _0x31d7bb(_0x4a6794[_0xd7f3('0xd')]);}})[_0xd7f3('0xe')](function(_0x101298){logger['error']('rpc','routing',_0x398e4b,_0x101298,_0x5c7034);return _0x2009e2(_0x101298);});});};module['exports']=client; \ No newline at end of file +var _0x733e=['exports','jayson/promise','bluebird','../../config/logger','http','Request','request','debug','rpc','routing','error','message','result','catch'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x733e,0x15f));var _0xe733=function(_0x171fdc,_0x16ae91){_0x171fdc=_0x171fdc-0x0;var _0x3782ea=_0x733e[_0x171fdc];return _0x3782ea;};'use strict';var jayson=require(_0xe733('0x0'));var BPromise=require(_0xe733('0x1'));var logger=require(_0xe733('0x2'))('routing');var client=jayson['client'][_0xe733('0x3')]({'port':0x2329});client[_0xe733('0x4')]=function(_0x3e6dda,_0x535393){return new BPromise(function(_0x19cc93,_0x2dbcf5){return client[_0xe733('0x5')](_0x3e6dda,_0x535393)['then'](function(_0x23fe1b){logger[_0xe733('0x6')](_0xe733('0x7'),_0xe733('0x8'),_0x3e6dda,_0x535393,_0x23fe1b);if(_0x23fe1b[_0xe733('0x9')]){logger[_0xe733('0x9')](_0xe733('0x7'),_0xe733('0x8'),_0x3e6dda,_0x23fe1b[_0xe733('0x9')]['message'],_0x535393);return _0x2dbcf5(_0x23fe1b[_0xe733('0x9')][_0xe733('0xa')]);}else{return _0x19cc93(_0x23fe1b[_0xe733('0xb')]);}})[_0xe733('0xc')](function(_0x1d7d7f){logger[_0xe733('0x9')](_0xe733('0x7'),_0xe733('0x8'),_0x3e6dda,_0x1d7d7f,_0x535393);return _0x2dbcf5(_0x1d7d7f);});});};module[_0xe733('0xd')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 3e838ce..c5aa4df 100644 --- a/server/services/routing/index.js +++ b/server/services/routing/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0ad2=['./rpc/smsQueue','./rpc/faxQueue','resolve','getAgents','then','initAgents','getIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','initSmsQueues','getMailQueues','initMailQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','./server','./realtime','./rpc/user','./rpc/openchannelQueue','./rpc/chatQueue'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x0ad2,0x103));var _0x20ad=function(_0x5c2d9e,_0x4d9364){_0x5c2d9e=_0x5c2d9e-0x0;var _0x43ea71=_0x0ad2[_0x5c2d9e];return _0x43ea71;};'use strict';var BPromise=require('bluebird');var server=require(_0x20ad('0x0'));var Realtime=require(_0x20ad('0x1'));var user=require(_0x20ad('0x2'));var interval=require('./rpc/interval');var openchannelQueue=require(_0x20ad('0x3'));var chatQueue=require(_0x20ad('0x4'));var smsQueue=require(_0x20ad('0x5'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0x20ad('0x6'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0x20ad('0x7')]()['then'](user[_0x20ad('0x8')]())[_0x20ad('0x9')](realtime[_0x20ad('0xa')]())[_0x20ad('0x9')](interval[_0x20ad('0xb')]())[_0x20ad('0x9')](realtime['initIntervals']())['then'](openchannelQueue[_0x20ad('0xc')]())[_0x20ad('0x9')](realtime[_0x20ad('0xd')]())[_0x20ad('0x9')](chatQueue[_0x20ad('0xe')]())[_0x20ad('0x9')](realtime[_0x20ad('0xf')]())[_0x20ad('0x9')](smsQueue['getSmsQueues']())[_0x20ad('0x9')](realtime[_0x20ad('0x10')]())['then'](mailQueue[_0x20ad('0x11')]())['then'](realtime[_0x20ad('0x12')]())[_0x20ad('0x9')](faxQueue['getFaxQueues']())['then'](realtime[_0x20ad('0x13')]())['then'](whatsappQueue[_0x20ad('0x14')]())['then'](realtime[_0x20ad('0x15')]())[_0x20ad('0x9')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x20ad('0x9')](function(_0xccf598){return initRealtime();})[_0x20ad('0x9')](function(_0x3c5d09){return setInterval(initRealtime,0x1388);})['catch'](function(_0xca2afc){console['log'](_0xca2afc);});}main(); \ No newline at end of file +var _0x9dcf=['initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','initSmsQueues','getMailQueues','initMailQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','getAgents','then'];(function(_0x4ea3b2,_0x4ed581){var _0x14a255=function(_0x4dfce6){while(--_0x4dfce6){_0x4ea3b2['push'](_0x4ea3b2['shift']());}};_0x14a255(++_0x4ed581);}(_0x9dcf,0x114));var _0xf9dc=function(_0xef841b,_0x4ee8b5){_0xef841b=_0xef841b-0x0;var _0x51adc2=_0x9dcf[_0xef841b];return _0x51adc2;};'use strict';var BPromise=require(_0xf9dc('0x0'));var server=require(_0xf9dc('0x1'));var Realtime=require(_0xf9dc('0x2'));var user=require(_0xf9dc('0x3'));var interval=require(_0xf9dc('0x4'));var openchannelQueue=require(_0xf9dc('0x5'));var chatQueue=require(_0xf9dc('0x6'));var smsQueue=require(_0xf9dc('0x7'));var mailQueue=require(_0xf9dc('0x8'));var faxQueue=require(_0xf9dc('0x9'));var whatsappQueue=require(_0xf9dc('0xa'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xf9dc('0xb')]()['then'](user[_0xf9dc('0xc')]())[_0xf9dc('0xd')](realtime[_0xf9dc('0xe')]())['then'](interval[_0xf9dc('0xf')]())[_0xf9dc('0xd')](realtime[_0xf9dc('0x10')]())['then'](openchannelQueue[_0xf9dc('0x11')]())[_0xf9dc('0xd')](realtime[_0xf9dc('0x12')]())[_0xf9dc('0xd')](chatQueue[_0xf9dc('0x13')]())[_0xf9dc('0xd')](realtime[_0xf9dc('0x14')]())[_0xf9dc('0xd')](smsQueue['getSmsQueues']())[_0xf9dc('0xd')](realtime[_0xf9dc('0x15')]())[_0xf9dc('0xd')](mailQueue[_0xf9dc('0x16')]())[_0xf9dc('0xd')](realtime[_0xf9dc('0x17')]())['then'](faxQueue['getFaxQueues']())[_0xf9dc('0xd')](realtime[_0xf9dc('0x18')]())[_0xf9dc('0xd')](whatsappQueue[_0xf9dc('0x19')]())['then'](realtime[_0xf9dc('0x1a')]())[_0xf9dc('0xd')](function(){return realtime;});}function main(){return server[_0xf9dc('0x1b')](realtime)[_0xf9dc('0xd')](function(_0x538e15){return initRealtime();})['then'](function(_0x3be1e3){return setInterval(initRealtime,0x1388);})[_0xf9dc('0x1c')](function(_0x356d01){console['log'](_0x356d01);});}main(); \ No newline at end of file diff --git a/server/services/routing/lib/rule-engine.js b/server/services/routing/lib/rule-engine.js index 284b883..c9e8d82 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['lodash','util','EventEmitter','init','isNil','ignoreFactChanges','inherits','activeRules','prototype','register','isArray','rules','isObject','sync','orderBy','asc','execute','clone','ruleRef','name','index_','push','call','nextTick','next','isEqual','restart','length','condition','matchPath','noop','findRules','filter','prioritize','priority','toJSON','map','consequence','toString','fromJSON','isString','parse'];(function(_0x5a6061,_0x3bd9ec){var _0x4aa6c9=function(_0x5d5e0f){while(--_0x5d5e0f){_0x5a6061['push'](_0x5a6061['shift']());}};_0x4aa6c9(++_0x3bd9ec);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5e2152,_0x172f3d){_0x5e2152=_0x5e2152-0x0;var _0x5ddcf6=_0x5fc3[_0x5e2152];return _0x5ddcf6;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var EventEmitter=require('events')[_0x35fc('0x2')];function RuleEngine(_0x2ac6da,_0x196bc2){this[_0x35fc('0x3')]();if(!_[_0x35fc('0x4')](_0x2ac6da)){this['register'](_0x2ac6da);}if(_0x196bc2){this[_0x35fc('0x5')]=_0x196bc2[_0x35fc('0x5')];}return this;}util[_0x35fc('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x19a0d1){this['rules']=[];this[_0x35fc('0x7')]=[];};RuleEngine[_0x35fc('0x8')][_0x35fc('0x9')]=function(_0x1e5f90){if(Array[_0x35fc('0xa')](_0x1e5f90)){this[_0x35fc('0xb')]=this[_0x35fc('0xb')]['concat'](_0x1e5f90);}else if(_0x1e5f90!==null&&_[_0x35fc('0xc')](_0x1e5f90)){this[_0x35fc('0xb')]['push'](_0x1e5f90);}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')]['sync']=function(){this[_0x35fc('0x7')]=this[_0x35fc('0xb')]['filter'](function(_0x4cbe74){if(_[_0x35fc('0x4')](_0x4cbe74['on'])){_0x4cbe74['on']=!![];}if(_0x4cbe74['on']===!![]){return _0x4cbe74;}});this['activeRules']=_[_0x35fc('0xe')](this[_0x35fc('0x7')],['p'],[_0x35fc('0xf')]);};RuleEngine[_0x35fc('0x8')][_0x35fc('0x10')]=function(_0x5cfe94,_0x59507a){var _0x5eac0f=![];_0x5cfe94['result']=!![];var _0x398b67=_[_0x35fc('0x11')](_0x5cfe94);var _0x53b898=_[_0x35fc('0x11')](_0x5cfe94);var _0x227a49=this[_0x35fc('0x7')];var _0x480851=[];var _0x26ba54=this[_0x35fc('0x5')];(function FnRuleLoop(_0x553677){var _0x41e165={'rules':function(){return _0x227a49;},'rule':function(){return _0x227a49[_0x553677];},'when':function(_0x363e47){if(_0x363e47){var _0x2e513b=_0x227a49[_0x553677]['consequence'];_0x2e513b[_0x35fc('0x12')]=_0x227a49[_0x553677]['id']||_0x227a49[_0x553677][_0x35fc('0x13')]||_0x35fc('0x14')+_0x553677;process['nextTick'](function(){_0x480851[_0x35fc('0x15')](_0x2e513b[_0x35fc('0x12')]);_0x2e513b[_0x35fc('0x16')](_0x398b67,_0x41e165);});}else{process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x5eac0f=!![];return FnRuleLoop(0x0);},'next':function(_0x21f1a9){if(!_0x26ba54&&!_[_0x35fc('0x19')](_0x53b898,_0x398b67)){_0x53b898=_[_0x35fc('0x11')](_0x398b67);process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x1a')]();});}else{process['nextTick'](function(){if(_[_0x35fc('0x4')](_0x21f1a9)){return FnRuleLoop(_0x553677+0x1);}else{return FnRuleLoop(_0x21f1a9);}});}}};if(_0x553677<_0x227a49[_0x35fc('0x1b')]&&_0x5eac0f===![]){var _0x257719=_0x227a49[_0x553677][_0x35fc('0x1c')];_0x257719[_0x35fc('0x16')](_0x398b67,_0x41e165);}else{process['nextTick'](function(){_0x398b67[_0x35fc('0x1d')]=_0x480851;return _0x59507a?_0x59507a(_0x398b67):_[_0x35fc('0x1e')]();});}}(0x0));};RuleEngine['prototype'][_0x35fc('0x1f')]=function(_0x5a93df){if(_[_0x35fc('0x4')](_0x5a93df)){return this['rules'];}else{var _0x4086e9=_['matches'](_0x5a93df);return _[_0x35fc('0x20')](this[_0x35fc('0xb')],_0x4086e9);}};RuleEngine['prototype']['turn']=function(_0x47774c,_0x58edb6){var _0x274208=_0x47774c==='on'||_0x47774c==='ON'?!![]:![];var _0x1a5d92=this['findRules'](_0x58edb6);for(var _0x26b7cb=0x0,_0x645eac=_0x1a5d92[_0x35fc('0x1b')];_0x26b7cb<_0x645eac;_0x26b7cb+=0x1){_0x1a5d92[_0x26b7cb]['on']=_0x274208;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x21')]=function(_0x11ccdb,_0x451f0c){_0x11ccdb=parseInt(_0x11ccdb,0xa);var _0x54aedc=this[_0x35fc('0x1f')](_0x451f0c);for(var _0x220931=0x0,_0x22af18=_0x54aedc['length'];_0x220931<_0x22af18;_0x220931+=0x1){_0x54aedc[_0x220931][_0x35fc('0x22')]=_0x11ccdb;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x23')]=function(){var _0xd8a4ca=this[_0x35fc('0xb')];if(_0xd8a4ca instanceof Array){_0xd8a4ca=_0xd8a4ca[_0x35fc('0x24')](function(_0x37b435){_0x37b435[_0x35fc('0x1c')]=_0x37b435[_0x35fc('0x1c')]['toString']();_0x37b435['consequence']=_0x37b435[_0x35fc('0x25')]['toString']();return _0x37b435;});}else if(!_[_0x35fc('0x4')](_0xd8a4ca)){_0xd8a4ca[_0x35fc('0x1c')]=_0xd8a4ca[_0x35fc('0x1c')][_0x35fc('0x26')]();_0xd8a4ca[_0x35fc('0x25')]=_0xd8a4ca[_0x35fc('0x25')]['toString']();}return _0xd8a4ca;};RuleEngine[_0x35fc('0x8')][_0x35fc('0x27')]=function(_0x46b9ef){this[_0x35fc('0x3')]();if(_[_0x35fc('0x28')](_0x46b9ef)){_0x46b9ef=JSON[_0x35fc('0x29')](_0x46b9ef);}if(_0x46b9ef instanceof Array){_0x46b9ef=_0x46b9ef['map'](function(_0x2483be){_0x2483be[_0x35fc('0x1c')]=eval('('+_0x2483be[_0x35fc('0x1c')]+')');_0x2483be['consequence']=eval('('+_0x2483be[_0x35fc('0x25')]+')');return _0x2483be;});}else if(_0x46b9ef!==null&&typeof _0x46b9ef=='object'){_0x46b9ef[_0x35fc('0x1c')]=eval('('+_0x46b9ef[_0x35fc('0x1c')]+')');_0x46b9ef[_0x35fc('0x25')]=eval('('+_0x46b9ef[_0x35fc('0x25')]+')');}this['register'](_0x46b9ef);};module['exports']=RuleEngine; \ No newline at end of file +var _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x272c2f,_0x46ff66){var _0x381941=function(_0x32e1cd){while(--_0x32e1cd){_0x272c2f['push'](_0x272c2f['shift']());}};_0x381941(++_0x46ff66);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xc4aa[_0x4d613c];return _0x301fe3;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 59d8aad..36073e0 100644 --- a/server/services/routing/mailRpc/index.js +++ b/server/services/routing/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf756=['result','sendMailMessage','SendMail','bluebird','jayson/promise','then','error','message'];(function(_0x4ca9e9,_0x1cc635){var _0xc60253=function(_0x89f5de){while(--_0x89f5de){_0x4ca9e9['push'](_0x4ca9e9['shift']());}};_0xc60253(++_0x1cc635);}(_0xf756,0x133));var _0x6f75=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xf756[_0x110c3d];return _0x226d67;};'use strict';var BPromise=require(_0x6f75('0x0'));var jayson=require(_0x6f75('0x1'));var client=jayson['client']['http']({'port':0x232b});function request(_0x470b98,_0x160e02){return new BPromise(function(_0x2b0259,_0x24975f){return client['request'](_0x470b98,_0x160e02)[_0x6f75('0x2')](function(_0x2738f2){if(_0x2738f2[_0x6f75('0x3')]){return _0x24975f(_0x2738f2[_0x6f75('0x3')][_0x6f75('0x4')]);}else{return _0x2b0259(_0x2738f2[_0x6f75('0x5')]);}})['catch'](function(_0x4abe6d){return _0x24975f(_0x4abe6d);});});}exports[_0x6f75('0x6')]=function(_0x434ddf,_0x8f1fd){return request(_0x6f75('0x7'),{'account':_0x434ddf,'message':_0x8f1fd});}; \ No newline at end of file +var _0x405f=['result','catch','sendMailMessage','bluebird','jayson/promise','client','http','request','then','error','message'];(function(_0x3d2efa,_0x4a2e5c){var _0x5f108e=function(_0x2b1ef9){while(--_0x2b1ef9){_0x3d2efa['push'](_0x3d2efa['shift']());}};_0x5f108e(++_0x4a2e5c);}(_0x405f,0xd4));var _0xf405=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0x405f[_0x59d89e];return _0x554e93;};'use strict';var BPromise=require(_0xf405('0x0'));var jayson=require(_0xf405('0x1'));var client=jayson[_0xf405('0x2')][_0xf405('0x3')]({'port':0x232b});function request(_0x50ad3d,_0x5d8658){return new BPromise(function(_0x298b79,_0x3b1b1c){return client[_0xf405('0x4')](_0x50ad3d,_0x5d8658)[_0xf405('0x5')](function(_0x547266){if(_0x547266['error']){return _0x3b1b1c(_0x547266[_0xf405('0x6')][_0xf405('0x7')]);}else{return _0x298b79(_0x547266[_0xf405('0x8')]);}})[_0xf405('0x9')](function(_0x187b17){return _0x3b1b1c(_0x187b17);});});}exports[_0xf405('0xa')]=function(_0x22ae3b,_0x122020){return request('SendMail',{'account':_0x22ae3b,'message':_0x122020});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 44debbf..5e6faad 100644 --- a/server/services/routing/model/agent.js +++ b/server/services/routing/model/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0bdf=['Status','StatusTime','toNumber','format','chatStatus','mailStatus','whatsappCurrentCapacity','busy','busyQueue','stringify','emit','moment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCurrentCapacity','md5','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','prototype','mail','chat','fax','whatsapp','length'];(function(_0x2879a4,_0x3b4979){var _0x361ed1=function(_0x533909){while(--_0x533909){_0x2879a4['push'](_0x2879a4['shift']());}};_0x361ed1(++_0x3b4979);}(_0x0bdf,0x103));var _0xf0bd=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x0bdf[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var moment=require(_0xf0bd('0x0'));var md5=require('md5');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xf0bd('0x1')]=_[_0xf0bd('0x2')](config['redis'],{'host':_0xf0bd('0x3'),'port':0x18eb});var io=require(_0xf0bd('0x4'))(new Redis(config[_0xf0bd('0x1')]));function Agent(_0x12a6dc){this['id']=_0x12a6dc['id']||0x0;this[_0xf0bd('0x5')]=_0x12a6dc[_0xf0bd('0x5')]||'';this['online']=_0x12a6dc[_0xf0bd('0x6')]||!![];this[_0xf0bd('0x7')]=_0x12a6dc[_0xf0bd('0x7')]||![];this[_0xf0bd('0x8')]=_0x12a6dc[_0xf0bd('0x8')]||![];this['mailPause']=_0x12a6dc[_0xf0bd('0x9')]||![];this['faxPause']=_0x12a6dc[_0xf0bd('0xa')]||![];this[_0xf0bd('0xb')]=_0x12a6dc[_0xf0bd('0xb')]||![];this[_0xf0bd('0xc')]=_0x12a6dc[_0xf0bd('0xc')]||![];this['chatStatus']=_0xf0bd('0xd');this[_0xf0bd('0xe')]=0x0;this[_0xf0bd('0xf')]=_0x12a6dc[_0xf0bd('0xf')]||0x0;this[_0xf0bd('0x10')]=0x0;this['mailStatus']='unknown';this[_0xf0bd('0x11')]=0x0;this[_0xf0bd('0x12')]=_0x12a6dc[_0xf0bd('0x12')]||0x0;this[_0xf0bd('0x13')]=0x0;this['faxStatus']=_0xf0bd('0xd');this[_0xf0bd('0x14')]=0x0;this[_0xf0bd('0x15')]=_0x12a6dc[_0xf0bd('0x15')]||0x0;this[_0xf0bd('0x16')]=0x0;this[_0xf0bd('0x17')]='unknown';this[_0xf0bd('0x18')]=0x0;this[_0xf0bd('0x19')]=_0x12a6dc['smsCapacity']||0x0;this[_0xf0bd('0x1a')]=0x0;this['whatsappStatus']=_0xf0bd('0xd');this[_0xf0bd('0x1b')]=0x0;this['whatsappCapacity']=_0x12a6dc[_0xf0bd('0x1c')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0xf0bd('0x1d')]=_0xf0bd('0xd');this[_0xf0bd('0x1e')]=0x0;this['openchannelCapacity']=_0x12a6dc['openchannelCapacity']||0x0;this[_0xf0bd('0x1f')]=0x0;this['busy']=![];this['busyQueue']=undefined;this[_0xf0bd('0x20')]='';this[_0xf0bd('0x21')]={};this[_0xf0bd('0x22')]={};this[_0xf0bd('0x23')]={};this[_0xf0bd('0x24')]={};this[_0xf0bd('0x25')]={};this['whatsappWaitingInteractions']={};this[_0xf0bd('0x26')]();}Agent['prototype'][_0xf0bd('0x27')]=function(_0x596c21){if(this[_0x596c21+_0xf0bd('0x28')]>0x0){if(this[_0x596c21+_0xf0bd('0x29')]>0x0&&this[_0x596c21+_0xf0bd('0x28')]>=this[_0x596c21+_0xf0bd('0x29')]){return _0xf0bd('0x2a');}else{return _0xf0bd('0x2b');}}else{return _0xf0bd('0x2c');}};Agent[_0xf0bd('0x2d')][_0xf0bd('0x26')]=function(){var _0x2abfc7=[_0xf0bd('0x2e'),_0xf0bd('0x2f'),'openchannel',_0xf0bd('0x30'),'sms',_0xf0bd('0x31')];for(var _0x1c962e=0x0;_0x1c962e<_0x2abfc7[_0xf0bd('0x32')];_0x1c962e+=0x1){var _0x3821e8=this[_0xf0bd('0x27')](_0x2abfc7[_0x1c962e]);if(this[_0x2abfc7[_0x1c962e]+_0xf0bd('0x33')]!==_0x3821e8){this[_0x2abfc7[_0x1c962e]+_0xf0bd('0x34')]=_[_0xf0bd('0x35')](moment()[_0xf0bd('0x36')]('x'));}this[_0x2abfc7[_0x1c962e]+_0xf0bd('0x33')]=_0x3821e8;}var _0x5275a6={'id':this['id'],'name':this[_0xf0bd('0x5')],'online':this[_0xf0bd('0x6')],'voicePause':this[_0xf0bd('0x7')],'chatPause':this[_0xf0bd('0x8')],'mailPause':this[_0xf0bd('0x9')],'smsPause':this['smsPause'],'faxPause':this[_0xf0bd('0xa')],'openchannelPause':this[_0xf0bd('0xc')],'chatStatus':this[_0xf0bd('0x37')],'chatStatusTime':this[_0xf0bd('0xe')],'chatCapacity':this[_0xf0bd('0xf')],'chatCurrentCapacity':this[_0xf0bd('0x10')],'mailStatus':this[_0xf0bd('0x38')],'mailStatusTime':this[_0xf0bd('0x11')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0xf0bd('0x14')],'faxCapacity':this[_0xf0bd('0x15')],'faxCurrentCapacity':this[_0xf0bd('0x16')],'smsStatus':this[_0xf0bd('0x17')],'smsStatusTime':this[_0xf0bd('0x18')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0xf0bd('0x1b')],'whatsappCapacity':this[_0xf0bd('0x1c')],'whatsappCurrentCapacity':this[_0xf0bd('0x39')],'openchannelStatus':this[_0xf0bd('0x1d')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xf0bd('0x1f')],'busy':this[_0xf0bd('0x3a')],'busyQueue':this[_0xf0bd('0x3b')],'chatWaitingInteractions':this[_0xf0bd('0x21')],'faxWaitingInteractions':this[_0xf0bd('0x22')],'mailWaitingInteractions':this[_0xf0bd('0x23')],'openchannelWaitingInteractions':this[_0xf0bd('0x24')],'smsWaitingInteractions':this[_0xf0bd('0x25')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x402ead=md5(JSON[_0xf0bd('0x3c')](_0x5275a6));if(this['md5']!==_0x402ead){this[_0xf0bd('0x20')]=_0x402ead;io[_0xf0bd('0x3d')]('user:save',_0x5275a6);}};module['exports']=Agent; \ No newline at end of file +var _0xc319=['updateRealtime','mail','chat','fax','sms','whatsapp','length','Status','StatusTime','toNumber','format','whatsappStatusTime','mailWaitingInteractions','emit','user:save','exports','lodash','moment','md5','ioredis','redis','defaults','localhost','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','prototype','getChannelStatus','CurrentCapacity','Capacity','working','idle'];(function(_0x4ca43f,_0x1b1897){var _0x20b24f=function(_0x140d9c){while(--_0x140d9c){_0x4ca43f['push'](_0x4ca43f['shift']());}};_0x20b24f(++_0x1b1897);}(_0xc319,0x155));var _0x9c31=function(_0x51f19f,_0x5f5ab9){_0x51f19f=_0x51f19f-0x0;var _0x3e2313=_0xc319[_0x51f19f];return _0x3e2313;};'use strict';var _=require(_0x9c31('0x0'));var moment=require(_0x9c31('0x1'));var md5=require(_0x9c31('0x2'));var Redis=require(_0x9c31('0x3'));var config=require('../../../config/environment');config[_0x9c31('0x4')]=_[_0x9c31('0x5')](config[_0x9c31('0x4')],{'host':_0x9c31('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9c31('0x4')]));function Agent(_0x3059c6){this['id']=_0x3059c6['id']||0x0;this[_0x9c31('0x7')]=_0x3059c6['name']||'';this['online']=_0x3059c6[_0x9c31('0x8')]||!![];this[_0x9c31('0x9')]=_0x3059c6[_0x9c31('0x9')]||![];this[_0x9c31('0xa')]=_0x3059c6['chatPause']||![];this[_0x9c31('0xb')]=_0x3059c6['mailPause']||![];this[_0x9c31('0xc')]=_0x3059c6[_0x9c31('0xc')]||![];this[_0x9c31('0xd')]=_0x3059c6[_0x9c31('0xd')]||![];this[_0x9c31('0xe')]=_0x3059c6[_0x9c31('0xe')]||![];this['chatStatus']=_0x9c31('0xf');this['chatStatusTime']=0x0;this[_0x9c31('0x10')]=_0x3059c6[_0x9c31('0x10')]||0x0;this[_0x9c31('0x11')]=0x0;this[_0x9c31('0x12')]='unknown';this[_0x9c31('0x13')]=0x0;this[_0x9c31('0x14')]=_0x3059c6['mailCapacity']||0x0;this[_0x9c31('0x15')]=0x0;this[_0x9c31('0x16')]=_0x9c31('0xf');this[_0x9c31('0x17')]=0x0;this[_0x9c31('0x18')]=_0x3059c6[_0x9c31('0x18')]||0x0;this[_0x9c31('0x19')]=0x0;this[_0x9c31('0x1a')]=_0x9c31('0xf');this[_0x9c31('0x1b')]=0x0;this[_0x9c31('0x1c')]=_0x3059c6['smsCapacity']||0x0;this[_0x9c31('0x1d')]=0x0;this[_0x9c31('0x1e')]=_0x9c31('0xf');this['whatsappStatusTime']=0x0;this[_0x9c31('0x1f')]=_0x3059c6['whatsappCapacity']||0x0;this[_0x9c31('0x20')]=0x0;this[_0x9c31('0x21')]=_0x9c31('0xf');this[_0x9c31('0x22')]=0x0;this[_0x9c31('0x23')]=_0x3059c6[_0x9c31('0x23')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x9c31('0x24')]=![];this[_0x9c31('0x25')]=undefined;this[_0x9c31('0x2')]='';this[_0x9c31('0x26')]={};this[_0x9c31('0x27')]={};this['mailWaitingInteractions']={};this[_0x9c31('0x28')]={};this[_0x9c31('0x29')]={};this[_0x9c31('0x2a')]={};this['updateRealtime']();}Agent[_0x9c31('0x2b')][_0x9c31('0x2c')]=function(_0x4bc774){if(this[_0x4bc774+_0x9c31('0x2d')]>0x0){if(this[_0x4bc774+_0x9c31('0x2e')]>0x0&&this[_0x4bc774+_0x9c31('0x2d')]>=this[_0x4bc774+'Capacity']){return'maxcapacity';}else{return _0x9c31('0x2f');}}else{return _0x9c31('0x30');}};Agent['prototype'][_0x9c31('0x31')]=function(){var _0x49d6a8=[_0x9c31('0x32'),_0x9c31('0x33'),'openchannel',_0x9c31('0x34'),_0x9c31('0x35'),_0x9c31('0x36')];for(var _0x5345ff=0x0;_0x5345ff<_0x49d6a8[_0x9c31('0x37')];_0x5345ff+=0x1){var _0x5043ac=this[_0x9c31('0x2c')](_0x49d6a8[_0x5345ff]);if(this[_0x49d6a8[_0x5345ff]+_0x9c31('0x38')]!==_0x5043ac){this[_0x49d6a8[_0x5345ff]+_0x9c31('0x39')]=_[_0x9c31('0x3a')](moment()[_0x9c31('0x3b')]('x'));}this[_0x49d6a8[_0x5345ff]+_0x9c31('0x38')]=_0x5043ac;}var _0x33197f={'id':this['id'],'name':this[_0x9c31('0x7')],'online':this[_0x9c31('0x8')],'voicePause':this[_0x9c31('0x9')],'chatPause':this[_0x9c31('0xa')],'mailPause':this['mailPause'],'smsPause':this[_0x9c31('0xd')],'faxPause':this[_0x9c31('0xc')],'openchannelPause':this[_0x9c31('0xe')],'chatStatus':this['chatStatus'],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x9c31('0x10')],'chatCurrentCapacity':this[_0x9c31('0x11')],'mailStatus':this[_0x9c31('0x12')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x9c31('0x14')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x9c31('0x16')],'faxStatusTime':this[_0x9c31('0x17')],'faxCapacity':this[_0x9c31('0x18')],'faxCurrentCapacity':this[_0x9c31('0x19')],'smsStatus':this[_0x9c31('0x1a')],'smsStatusTime':this[_0x9c31('0x1b')],'smsCapacity':this[_0x9c31('0x1c')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x9c31('0x1e')],'whatsappStatusTime':this[_0x9c31('0x3c')],'whatsappCapacity':this[_0x9c31('0x1f')],'whatsappCurrentCapacity':this[_0x9c31('0x20')],'openchannelStatus':this[_0x9c31('0x21')],'openchannelStatusTime':this[_0x9c31('0x22')],'openchannelCapacity':this[_0x9c31('0x23')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this['busy'],'busyQueue':this[_0x9c31('0x25')],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this[_0x9c31('0x27')],'mailWaitingInteractions':this[_0x9c31('0x3d')],'openchannelWaitingInteractions':this[_0x9c31('0x28')],'smsWaitingInteractions':this['smsWaitingInteractions'],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x50ba7e=md5(JSON['stringify'](_0x33197f));if(this[_0x9c31('0x2')]!==_0x50ba7e){this[_0x9c31('0x2')]=_0x50ba7e;io[_0x9c31('0x3e')](_0x9c31('0x3f'),_0x33197f);}};module[_0x9c31('0x40')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 5e88788..886fede 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 _0x5eea=['online','chatPause','available','stringify','md5','format','chat:queue:%s','emit','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','map','_rr','loggedIn','paused','length'];(function(_0x38b475,_0xa296cf){var _0x21880a=function(_0x5739d0){while(--_0x5739d0){_0x38b475['push'](_0x38b475['shift']());}};_0x21880a(++_0xa296cf);}(_0x5eea,0x1ca));var _0xa5ee=function(_0x392864,_0x4f089c){_0x392864=_0x392864-0x0;var _0x475459=_0x5eea[_0x392864];return _0x475459;};'use strict';var _=require(_0xa5ee('0x0'));var md5=require('md5');var util=require(_0xa5ee('0x1'));var Redis=require(_0xa5ee('0x2'));var config=require(_0xa5ee('0x3'));config[_0xa5ee('0x4')]=_[_0xa5ee('0x5')](config[_0xa5ee('0x4')],{'host':_0xa5ee('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function ChatQueue(_0x52826c){this['id']=_0x52826c['id']||0x0;this['name']=_0x52826c[_0xa5ee('0x7')]||'';this['timeout']=_0x52826c[_0xa5ee('0x8')]||0xa;this[_0xa5ee('0x9')]=_0x52826c[_0xa5ee('0x9')]||_0xa5ee('0xa');this[_0xa5ee('0xb')]=_0x52826c[_0xa5ee('0xb')];this['mapAgentsId']={};this[_0xa5ee('0xc')]=0x0;this['md5']='';this[_0xa5ee('0xd')]();this[_0xa5ee('0xe')]();}ChatQueue[_0xa5ee('0xf')]['updateRouting']=function(){var _0x347de7=this[_0xa5ee('0x10')]['_rr'];this[_0xa5ee('0x10')]=_[_0xa5ee('0x11')](this[_0xa5ee('0xb')],'id');this[_0xa5ee('0x10')][_0xa5ee('0x12')]=_0x347de7;};ChatQueue[_0xa5ee('0xf')][_0xa5ee('0xe')]=function(){this[_0xa5ee('0x13')]=0x0;this[_0xa5ee('0x14')]=0x0;for(var _0x42129c=0x0;_0x42129c=0x0?this['available']:0x0;var _0x8aa27c={'id':this['id'],'available':this[_0xa5ee('0x18')],'loggedIn':this[_0xa5ee('0x13')],'name':this[_0xa5ee('0x7')],'paused':this[_0xa5ee('0x14')],'waiting':this[_0xa5ee('0xc')]};var _0x576894=md5(JSON[_0xa5ee('0x19')](_0x8aa27c));if(this[_0xa5ee('0x1a')]!==_0x576894){this[_0xa5ee('0x1a')]=_0x576894;io['to'](util[_0xa5ee('0x1b')](_0xa5ee('0x1c'),_0x8aa27c[_0xa5ee('0x7')]))[_0xa5ee('0x1d')]('chat_queue:save',_0x8aa27c);}};module['exports']=ChatQueue; \ No newline at end of file +var _0x6c5a=['ioredis','../../../config/environment','redis','localhost','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','map','paused','length','online','available','loggedIn','format','chat:queue:%s','emit','chat_queue:save','lodash','md5'];(function(_0x13fd95,_0x1062c5){var _0xe3aa3d=function(_0xc48a64){while(--_0xc48a64){_0x13fd95['push'](_0x13fd95['shift']());}};_0xe3aa3d(++_0x1062c5);}(_0x6c5a,0xb4));var _0xa6c5=function(_0x15135a,_0x1c56b0){_0x15135a=_0x15135a-0x0;var _0x272512=_0x6c5a[_0x15135a];return _0x272512;};'use strict';var _=require(_0xa6c5('0x0'));var md5=require(_0xa6c5('0x1'));var util=require('util');var Redis=require(_0xa6c5('0x2'));var config=require(_0xa6c5('0x3'));config[_0xa6c5('0x4')]=_['defaults'](config[_0xa6c5('0x4')],{'host':_0xa6c5('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa6c5('0x4')]));function ChatQueue(_0x4fa4bc){this['id']=_0x4fa4bc['id']||0x0;this[_0xa6c5('0x6')]=_0x4fa4bc[_0xa6c5('0x6')]||'';this[_0xa6c5('0x7')]=_0x4fa4bc[_0xa6c5('0x7')]||0xa;this['strategy']=_0x4fa4bc[_0xa6c5('0x8')]||_0xa6c5('0x9');this[_0xa6c5('0xa')]=_0x4fa4bc[_0xa6c5('0xa')];this['mapAgentsId']={};this[_0xa6c5('0xb')]=0x0;this[_0xa6c5('0x1')]='';this[_0xa6c5('0xc')]();this[_0xa6c5('0xd')]();}ChatQueue[_0xa6c5('0xe')][_0xa6c5('0xc')]=function(){var _0x5133e6=this[_0xa6c5('0xf')]['_rr'];this[_0xa6c5('0xf')]=_[_0xa6c5('0x10')](this[_0xa6c5('0xa')],'id');this[_0xa6c5('0xf')]['_rr']=_0x5133e6;};ChatQueue[_0xa6c5('0xe')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0xa6c5('0x11')]=0x0;for(var _0x25fa83=0x0;_0x25fa83=0x0?this[_0xa6c5('0x14')]:0x0;var _0x272c1d={'id':this['id'],'available':this[_0xa6c5('0x14')],'loggedIn':this['loggedIn'],'name':this[_0xa6c5('0x6')],'paused':this['paused'],'waiting':this[_0xa6c5('0xb')]};var _0x1c78be=md5(JSON['stringify'](_0x272c1d));if(this['md5']!==_0x1c78be){this[_0xa6c5('0x1')]=_0x1c78be;io['to'](util[_0xa6c5('0x16')](_0xa6c5('0x17'),_0x272c1d[_0xa6c5('0x6')]))[_0xa6c5('0x18')](_0xa6c5('0x19'),_0x272c1d);}};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 c379bb8..ac33b3b 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 _0x460a=['name','timeout','strategy','beepall','mapAgentsId','updateRouting','map','_rr','prototype','loggedIn','paused','Agents','length','faxPause','available','waiting','stringify','emit','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter'];(function(_0x5f549e,_0x595e67){var _0x1428e0=function(_0x3989e0){while(--_0x3989e0){_0x5f549e['push'](_0x5f549e['shift']());}};_0x1428e0(++_0x595e67);}(_0x460a,0x9a));var _0xa460=function(_0x195c21,_0x332612){_0x195c21=_0x195c21-0x0;var _0x3576a8=_0x460a[_0x195c21];return _0x3576a8;};'use strict';var _=require('lodash');var md5=require(_0xa460('0x0'));var util=require(_0xa460('0x1'));var Redis=require(_0xa460('0x2'));var config=require(_0xa460('0x3'));config[_0xa460('0x4')]=_[_0xa460('0x5')](config[_0xa460('0x4')],{'host':_0xa460('0x6'),'port':0x18eb});var io=require(_0xa460('0x7'))(new Redis(config['redis']));function FaxQueue(_0x433a14){this['id']=_0x433a14['id']||0x0;this[_0xa460('0x8')]=_0x433a14[_0xa460('0x8')]||'';this[_0xa460('0x9')]=_0x433a14[_0xa460('0x9')]||0xa;this[_0xa460('0xa')]=_0x433a14['strategy']||_0xa460('0xb');this['Agents']=_0x433a14['Agents'];this[_0xa460('0xc')]={};this['waiting']=0x0;this[_0xa460('0x0')]='';this['updateRouting']();this['updateRealtime']();}FaxQueue['prototype'][_0xa460('0xd')]=function(){var _0x2e680d=this[_0xa460('0xc')]['_rr'];this[_0xa460('0xc')]=_[_0xa460('0xe')](this['Agents'],'id');this[_0xa460('0xc')][_0xa460('0xf')]=_0x2e680d;};FaxQueue[_0xa460('0x10')]['updateRealtime']=function(){this[_0xa460('0x11')]=0x0;this[_0xa460('0x12')]=0x0;for(var _0x585b58=0x0;_0x585b58=0x0?this[_0xa460('0x16')]:0x0;var _0x5b1e06={'id':this['id'],'available':this[_0xa460('0x16')],'loggedIn':this[_0xa460('0x11')],'name':this[_0xa460('0x8')],'paused':this['paused'],'waiting':this[_0xa460('0x17')]};var _0x5e5a47=md5(JSON[_0xa460('0x18')](_0x5b1e06));if(this['md5']!==_0x5e5a47){this['md5']=_0x5e5a47;io['to'](util['format']('fax:queue:%s',_0x5b1e06[_0xa460('0x8')]))[_0xa460('0x19')]('fax_queue:save',_0x5b1e06);}};module[_0xa460('0x1a')]=FaxQueue; \ No newline at end of file +var _0x48c8=['loggedIn','faxPause','available','stringify','format','emit','fax_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRealtime','updateRouting','_rr','map','paused','length','online'];(function(_0x5dfc68,_0x425216){var _0xb8e0a8=function(_0x3652ff){while(--_0x3652ff){_0x5dfc68['push'](_0x5dfc68['shift']());}};_0xb8e0a8(++_0x425216);}(_0x48c8,0xa9));var _0x848c=function(_0x2b152a,_0x3dd988){_0x2b152a=_0x2b152a-0x0;var _0x2ad4c7=_0x48c8[_0x2b152a];return _0x2ad4c7;};'use strict';var _=require(_0x848c('0x0'));var md5=require(_0x848c('0x1'));var util=require(_0x848c('0x2'));var Redis=require(_0x848c('0x3'));var config=require(_0x848c('0x4'));config['redis']=_['defaults'](config[_0x848c('0x5')],{'host':_0x848c('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x848c('0x5')]));function FaxQueue(_0x2dee0f){this['id']=_0x2dee0f['id']||0x0;this[_0x848c('0x7')]=_0x2dee0f[_0x848c('0x7')]||'';this[_0x848c('0x8')]=_0x2dee0f[_0x848c('0x8')]||0xa;this['strategy']=_0x2dee0f[_0x848c('0x9')]||'beepall';this['Agents']=_0x2dee0f[_0x848c('0xa')];this[_0x848c('0xb')]={};this[_0x848c('0xc')]=0x0;this[_0x848c('0x1')]='';this['updateRouting']();this[_0x848c('0xd')]();}FaxQueue['prototype'][_0x848c('0xe')]=function(){var _0x2e653a=this[_0x848c('0xb')][_0x848c('0xf')];this[_0x848c('0xb')]=_[_0x848c('0x10')](this[_0x848c('0xa')],'id');this[_0x848c('0xb')]['_rr']=_0x2e653a;};FaxQueue['prototype']['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x848c('0x11')]=0x0;for(var _0x243d0a=0x0;_0x243d0a=0x0?this['available']:0x0;var _0x2b6591={'id':this['id'],'available':this[_0x848c('0x16')],'loggedIn':this['loggedIn'],'name':this[_0x848c('0x7')],'paused':this[_0x848c('0x11')],'waiting':this[_0x848c('0xc')]};var _0x4e5bd2=md5(JSON[_0x848c('0x17')](_0x2b6591));if(this[_0x848c('0x1')]!==_0x4e5bd2){this['md5']=_0x4e5bd2;io['to'](util[_0x848c('0x18')]('fax:queue:%s',_0x2b6591['name']))[_0x848c('0x19')](_0x848c('0x1a'),_0x2b6591);}};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 6345921..6a445e4 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 _0x5502=['Intervals','exports','name'];(function(_0x12281c,_0xd15128){var _0x36a6c6=function(_0x48b152){while(--_0x48b152){_0x12281c['push'](_0x12281c['shift']());}};_0x36a6c6(++_0xd15128);}(_0x5502,0xf2));var _0x2550=function(_0x3ed233,_0x2f18de){_0x3ed233=_0x3ed233-0x0;var _0x2ea9f3=_0x5502[_0x3ed233];return _0x2ea9f3;};'use strict';function Interval(_0x1a1643){this['id']=_0x1a1643['id']||0x0;this[_0x2550('0x0')]=_0x1a1643['name']||'';this[_0x2550('0x1')]=_0x1a1643[_0x2550('0x1')]||{};}module[_0x2550('0x2')]=Interval; \ No newline at end of file +var _0x0a8a=['exports','name','Intervals'];(function(_0xc589ad,_0x456701){var _0x19eb9b=function(_0x326208){while(--_0x326208){_0xc589ad['push'](_0xc589ad['shift']());}};_0x19eb9b(++_0x456701);}(_0x0a8a,0x6a));var _0xa0a8=function(_0x10bf39,_0x3cd4bc){_0x10bf39=_0x10bf39-0x0;var _0x2ccd63=_0x0a8a[_0x10bf39];return _0x2ccd63;};'use strict';function Interval(_0x469ee4){this['id']=_0x469ee4['id']||0x0;this[_0xa0a8('0x0')]=_0x469ee4[_0xa0a8('0x0')]||'';this['Intervals']=_0x469ee4[_0xa0a8('0x1')]||{};}module[_0xa0a8('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index f134af9..2809a51 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 _0xa7ae=['util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRealtime','prototype','updateRouting','mapAgentsId','_rr','map','loggedIn','paused','online','mailPause','available','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5'];(function(_0x682b70,_0x14dcd1){var _0x244bb1=function(_0x1218ac){while(--_0x1218ac){_0x682b70['push'](_0x682b70['shift']());}};_0x244bb1(++_0x14dcd1);}(_0xa7ae,0x1cf));var _0xea7a=function(_0x1a2e7b,_0x57b0a9){_0x1a2e7b=_0x1a2e7b-0x0;var _0x29606b=_0xa7ae[_0x1a2e7b];return _0x29606b;};'use strict';var _=require(_0xea7a('0x0'));var md5=require(_0xea7a('0x1'));var util=require(_0xea7a('0x2'));var Redis=require(_0xea7a('0x3'));var config=require(_0xea7a('0x4'));config[_0xea7a('0x5')]=_[_0xea7a('0x6')](config[_0xea7a('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xea7a('0x7'))(new Redis(config['redis']));function MailQueue(_0x1e7847){this['id']=_0x1e7847['id']||0x0;this[_0xea7a('0x8')]=_0x1e7847[_0xea7a('0x8')]||'';this[_0xea7a('0x9')]=_0x1e7847['timeout']||0xa;this[_0xea7a('0xa')]=_0x1e7847[_0xea7a('0xa')]||_0xea7a('0xb');this[_0xea7a('0xc')]=_0x1e7847[_0xea7a('0xc')];this['mapAgentsId']={};this[_0xea7a('0xd')]=0x0;this[_0xea7a('0x1')]='';this['updateRouting']();this[_0xea7a('0xe')]();}MailQueue[_0xea7a('0xf')][_0xea7a('0x10')]=function(){var _0x78cdb6=this[_0xea7a('0x11')][_0xea7a('0x12')];this[_0xea7a('0x11')]=_[_0xea7a('0x13')](this['Agents'],'id');this['mapAgentsId'][_0xea7a('0x12')]=_0x78cdb6;};MailQueue[_0xea7a('0xf')][_0xea7a('0xe')]=function(){this[_0xea7a('0x14')]=0x0;this[_0xea7a('0x15')]=0x0;for(var _0x431ef2=0x0;_0x431ef2=0x0?this[_0xea7a('0x18')]:0x0;var _0x14a85b={'id':this['id'],'available':this['available'],'loggedIn':this[_0xea7a('0x14')],'name':this[_0xea7a('0x8')],'paused':this[_0xea7a('0x15')],'waiting':this[_0xea7a('0xd')]};var _0x552ee5=md5(JSON[_0xea7a('0x19')](_0x14a85b));if(this[_0xea7a('0x1')]!==_0x552ee5){this[_0xea7a('0x1')]=_0x552ee5;io['to'](util[_0xea7a('0x1a')](_0xea7a('0x1b'),_0x14a85b[_0xea7a('0x8')]))[_0xea7a('0x1c')](_0xea7a('0x1d'),_0x14a85b);}};module[_0xea7a('0x1e')]=MailQueue; \ No newline at end of file +var _0x312d=['paused','length','Agents','available','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','redis','defaults','localhost','name','timeout','strategy','beepall','waiting','updateRouting','prototype','_rr','mapAgentsId','map','updateRealtime','loggedIn'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x312d,0x14d));var _0xd312=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x312d[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0xd312('0x0'));var md5=require(_0xd312('0x1'));var util=require(_0xd312('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xd312('0x3')]=_[_0xd312('0x4')](config[_0xd312('0x3')],{'host':_0xd312('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd312('0x3')]));function MailQueue(_0x342e78){this['id']=_0x342e78['id']||0x0;this['name']=_0x342e78[_0xd312('0x6')]||'';this[_0xd312('0x7')]=_0x342e78['timeout']||0xa;this[_0xd312('0x8')]=_0x342e78[_0xd312('0x8')]||_0xd312('0x9');this['Agents']=_0x342e78['Agents'];this['mapAgentsId']={};this[_0xd312('0xa')]=0x0;this[_0xd312('0x1')]='';this[_0xd312('0xb')]();this['updateRealtime']();}MailQueue[_0xd312('0xc')][_0xd312('0xb')]=function(){var _0x357249=this['mapAgentsId'][_0xd312('0xd')];this[_0xd312('0xe')]=_[_0xd312('0xf')](this['Agents'],'id');this[_0xd312('0xe')][_0xd312('0xd')]=_0x357249;};MailQueue['prototype'][_0xd312('0x10')]=function(){this[_0xd312('0x11')]=0x0;this[_0xd312('0x12')]=0x0;for(var _0x1af3a9=0x0;_0x1af3a9=0x0?this[_0xd312('0x15')]:0x0;var _0xd31e7c={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xd312('0x6')],'paused':this[_0xd312('0x12')],'waiting':this[_0xd312('0xa')]};var _0x8ef79=md5(JSON['stringify'](_0xd31e7c));if(this['md5']!==_0x8ef79){this[_0xd312('0x1')]=_0x8ef79;io['to'](util[_0xd312('0x16')](_0xd312('0x17'),_0xd31e7c['name']))[_0xd312('0x18')](_0xd312('0x19'),_0xd31e7c);}};module[_0xd312('0x1a')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 240cd69..da27b3a 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(_0xec034,_0x16c358){var _0x2c5a19=function(_0xec401c){while(--_0xec401c){_0xec034['push'](_0xec034['shift']());}};_0x2c5a19(++_0x16c358);}(_0x2ef3,0xba));var _0x32ef=function(_0x508e42,_0xcc863f){_0x508e42=_0x508e42-0x0;var _0x54fec1=_0x2ef3[_0x508e42];return _0x54fec1;};'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 _0xc4aa=['strategy','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','available','waiting','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xc4aa[_0x32f7d7];return _0x133d09;};'use strict';var _=require(_0xac4a('0x0'));var md5=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var Redis=require(_0xac4a('0x3'));var config=require(_0xac4a('0x4'));config[_0xac4a('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xac4a('0x6'))(new Redis(config[_0xac4a('0x5')]));function OpenchannelQueue(_0x730a38){this['id']=_0x730a38['id']||0x0;this[_0xac4a('0x7')]=_0x730a38[_0xac4a('0x7')]||'';this[_0xac4a('0x8')]=_0x730a38[_0xac4a('0x8')]||0xa;this[_0xac4a('0x9')]=_0x730a38['strategy']||'beepall';this[_0xac4a('0xa')]=_0x730a38[_0xac4a('0xa')];this[_0xac4a('0xb')]={};this['waiting']=0x0;this[_0xac4a('0x1')]='';this[_0xac4a('0xc')]();this[_0xac4a('0xd')]();}OpenchannelQueue['prototype'][_0xac4a('0xc')]=function(){var _0x488e3c=this[_0xac4a('0xb')]['_rr'];this[_0xac4a('0xb')]=_[_0xac4a('0xe')](this[_0xac4a('0xa')],'id');this['mapAgentsId'][_0xac4a('0xf')]=_0x488e3c;};OpenchannelQueue[_0xac4a('0x10')][_0xac4a('0xd')]=function(){this[_0xac4a('0x11')]=0x0;this[_0xac4a('0x12')]=0x0;for(var _0x3b71c0=0x0;_0x3b71c0=0x0?this[_0xac4a('0x15')]:0x0;var _0x44ec59={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xac4a('0x7')],'paused':this[_0xac4a('0x12')],'waiting':this[_0xac4a('0x16')]};var _0x4d837c=md5(JSON[_0xac4a('0x17')](_0x44ec59));if(this[_0xac4a('0x1')]!==_0x4d837c){this[_0xac4a('0x1')]=_0x4d837c;io['to'](util[_0xac4a('0x18')](_0xac4a('0x19'),_0x44ec59[_0xac4a('0x7')]))[_0xac4a('0x1a')](_0xac4a('0x1b'),_0x44ec59);}};module['exports']=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index b73931f..72fcd9d 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 _0x2fed=['_rr','map','loggedIn','paused','online','smsPause','available','stringify','format','sms:queue:%s','emit','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype'];(function(_0x544c03,_0x558fe4){var _0x5e86ad=function(_0x3b2aaf){while(--_0x3b2aaf){_0x544c03['push'](_0x544c03['shift']());}};_0x5e86ad(++_0x558fe4);}(_0x2fed,0x7c));var _0xd2fe=function(_0x3adf14,_0x7a2013){_0x3adf14=_0x3adf14-0x0;var _0x9b1e3a=_0x2fed[_0x3adf14];return _0x9b1e3a;};'use strict';var _=require(_0xd2fe('0x0'));var md5=require(_0xd2fe('0x1'));var util=require(_0xd2fe('0x2'));var Redis=require(_0xd2fe('0x3'));var config=require(_0xd2fe('0x4'));config['redis']=_[_0xd2fe('0x5')](config[_0xd2fe('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd2fe('0x6')]));function SmsQueue(_0x24ba90){this['id']=_0x24ba90['id']||0x0;this[_0xd2fe('0x7')]=_0x24ba90['name']||'';this[_0xd2fe('0x8')]=_0x24ba90[_0xd2fe('0x8')]||0xa;this[_0xd2fe('0x9')]=_0x24ba90[_0xd2fe('0x9')]||'beepall';this[_0xd2fe('0xa')]=_0x24ba90[_0xd2fe('0xa')];this[_0xd2fe('0xb')]={};this[_0xd2fe('0xc')]=0x0;this[_0xd2fe('0x1')]='';this[_0xd2fe('0xd')]();this[_0xd2fe('0xe')]();}SmsQueue[_0xd2fe('0xf')][_0xd2fe('0xd')]=function(){var _0x13c68f=this[_0xd2fe('0xb')][_0xd2fe('0x10')];this[_0xd2fe('0xb')]=_[_0xd2fe('0x11')](this[_0xd2fe('0xa')],'id');this[_0xd2fe('0xb')][_0xd2fe('0x10')]=_0x13c68f;};SmsQueue[_0xd2fe('0xf')]['updateRealtime']=function(){this[_0xd2fe('0x12')]=0x0;this[_0xd2fe('0x13')]=0x0;for(var _0x2a9355=0x0;_0x2a9355=0x0?this[_0xd2fe('0x16')]:0x0;var _0x40162f={'id':this['id'],'available':this['available'],'loggedIn':this[_0xd2fe('0x12')],'name':this[_0xd2fe('0x7')],'paused':this[_0xd2fe('0x13')],'waiting':this[_0xd2fe('0xc')]};var _0x34c324=md5(JSON[_0xd2fe('0x17')](_0x40162f));if(this[_0xd2fe('0x1')]!==_0x34c324){this[_0xd2fe('0x1')]=_0x34c324;io['to'](util[_0xd2fe('0x18')](_0xd2fe('0x19'),_0x40162f['name']))[_0xd2fe('0x1a')]('sms_queue:save',_0x40162f);}};module[_0xd2fe('0x1b')]=SmsQueue; \ No newline at end of file +var _0x0269=['util','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','online','smsPause','available','paused','md5','format','sms:queue:%s','emit','sms_queue:save','exports','lodash'];(function(_0x2fbdcc,_0x1f73be){var _0x185d08=function(_0x297bf1){while(--_0x297bf1){_0x2fbdcc['push'](_0x2fbdcc['shift']());}};_0x185d08(++_0x1f73be);}(_0x0269,0x135));var _0x9026=function(_0x3c42ae,_0xfd8e90){_0x3c42ae=_0x3c42ae-0x0;var _0x58ea11=_0x0269[_0x3c42ae];return _0x58ea11;};'use strict';var _=require(_0x9026('0x0'));var md5=require('md5');var util=require(_0x9026('0x1'));var Redis=require('ioredis');var config=require(_0x9026('0x2'));config['redis']=_[_0x9026('0x3')](config[_0x9026('0x4')],{'host':_0x9026('0x5'),'port':0x18eb});var io=require(_0x9026('0x6'))(new Redis(config['redis']));function SmsQueue(_0x314458){this['id']=_0x314458['id']||0x0;this[_0x9026('0x7')]=_0x314458['name']||'';this['timeout']=_0x314458[_0x9026('0x8')]||0xa;this[_0x9026('0x9')]=_0x314458[_0x9026('0x9')]||_0x9026('0xa');this['Agents']=_0x314458[_0x9026('0xb')];this[_0x9026('0xc')]={};this[_0x9026('0xd')]=0x0;this['md5']='';this[_0x9026('0xe')]();this[_0x9026('0xf')]();}SmsQueue[_0x9026('0x10')]['updateRouting']=function(){var _0x2c1dd2=this['mapAgentsId'][_0x9026('0x11')];this[_0x9026('0xc')]=_[_0x9026('0x12')](this[_0x9026('0xb')],'id');this[_0x9026('0xc')][_0x9026('0x11')]=_0x2c1dd2;};SmsQueue[_0x9026('0x10')]['updateRealtime']=function(){this[_0x9026('0x13')]=0x0;this['paused']=0x0;for(var _0x385afc=0x0;_0x385afc=0x0?this[_0x9026('0x17')]:0x0;var _0x4e37d0={'id':this['id'],'available':this[_0x9026('0x17')],'loggedIn':this[_0x9026('0x13')],'name':this[_0x9026('0x7')],'paused':this[_0x9026('0x18')],'waiting':this['waiting']};var _0x7985=md5(JSON['stringify'](_0x4e37d0));if(this[_0x9026('0x19')]!==_0x7985){this['md5']=_0x7985;io['to'](util[_0x9026('0x1a')](_0x9026('0x1b'),_0x4e37d0[_0x9026('0x7')]))[_0x9026('0x1c')](_0x9026('0x1d'),_0x4e37d0);}};module[_0x9026('0x1e')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 3d54b3b..73dbfd7 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 _0x6f22=['redis','defaults','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','online','whatsappPause','available','format','whatsapp:queue:%s','emit','exports','lodash','md5','util','ioredis','../../../config/environment'];(function(_0x1889d2,_0x340dfc){var _0x43d542=function(_0xca5572){while(--_0xca5572){_0x1889d2['push'](_0x1889d2['shift']());}};_0x43d542(++_0x340dfc);}(_0x6f22,0x175));var _0x26f2=function(_0x31766c,_0x1cd917){_0x31766c=_0x31766c-0x0;var _0x4a19c5=_0x6f22[_0x31766c];return _0x4a19c5;};'use strict';var _=require(_0x26f2('0x0'));var md5=require(_0x26f2('0x1'));var util=require(_0x26f2('0x2'));var Redis=require(_0x26f2('0x3'));var config=require(_0x26f2('0x4'));config[_0x26f2('0x5')]=_[_0x26f2('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x26f2('0x5')]));function WhatsappQueue(_0x1f6f10){this['id']=_0x1f6f10['id']||0x0;this[_0x26f2('0x7')]=_0x1f6f10['name']||'';this[_0x26f2('0x8')]=_0x1f6f10[_0x26f2('0x8')]||0xa;this[_0x26f2('0x9')]=_0x1f6f10[_0x26f2('0x9')]||'beepall';this['Agents']=_0x1f6f10[_0x26f2('0xa')];this[_0x26f2('0xb')]={};this[_0x26f2('0xc')]=0x0;this[_0x26f2('0x1')]='';this[_0x26f2('0xd')]();this[_0x26f2('0xe')]();}WhatsappQueue[_0x26f2('0xf')][_0x26f2('0xd')]=function(){var _0x1baa6d=this[_0x26f2('0xb')][_0x26f2('0x10')];this['mapAgentsId']=_['map'](this[_0x26f2('0xa')],'id');this[_0x26f2('0xb')][_0x26f2('0x10')]=_0x1baa6d;};WhatsappQueue[_0x26f2('0xf')][_0x26f2('0xe')]=function(){this[_0x26f2('0x11')]=0x0;this[_0x26f2('0x12')]=0x0;for(var _0x29ab14=0x0;_0x29ab14=0x0?this[_0x26f2('0x16')]:0x0;var _0x452768={'id':this['id'],'available':this[_0x26f2('0x16')],'loggedIn':this[_0x26f2('0x11')],'name':this[_0x26f2('0x7')],'paused':this[_0x26f2('0x12')],'waiting':this[_0x26f2('0xc')]};var _0x26e034=md5(JSON['stringify'](_0x452768));if(this[_0x26f2('0x1')]!==_0x26e034){this[_0x26f2('0x1')]=_0x26e034;io['to'](util[_0x26f2('0x17')](_0x26f2('0x18'),_0x452768['name']))[_0x26f2('0x19')]('whatsapp_queue:save',_0x452768);}};module[_0x26f2('0x1a')]=WhatsappQueue; \ No newline at end of file +var _0xe78d=['socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','whatsappPause','available','waiting','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults'];(function(_0x520477,_0x5ea467){var _0x3856e1=function(_0xd78ba4){while(--_0xd78ba4){_0x520477['push'](_0x520477['shift']());}};_0x3856e1(++_0x5ea467);}(_0xe78d,0x162));var _0xde78=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xe78d[_0x178e48];return _0x440d7e;};'use strict';var _=require('lodash');var md5=require(_0xde78('0x0'));var util=require(_0xde78('0x1'));var Redis=require(_0xde78('0x2'));var config=require(_0xde78('0x3'));config[_0xde78('0x4')]=_[_0xde78('0x5')](config[_0xde78('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xde78('0x6'))(new Redis(config['redis']));function WhatsappQueue(_0x5495c3){this['id']=_0x5495c3['id']||0x0;this[_0xde78('0x7')]=_0x5495c3[_0xde78('0x7')]||'';this[_0xde78('0x8')]=_0x5495c3[_0xde78('0x8')]||0xa;this[_0xde78('0x9')]=_0x5495c3[_0xde78('0x9')]||_0xde78('0xa');this[_0xde78('0xb')]=_0x5495c3[_0xde78('0xb')];this[_0xde78('0xc')]={};this['waiting']=0x0;this['md5']='';this[_0xde78('0xd')]();this[_0xde78('0xe')]();}WhatsappQueue[_0xde78('0xf')][_0xde78('0xd')]=function(){var _0x2c11f7=this[_0xde78('0xc')][_0xde78('0x10')];this[_0xde78('0xc')]=_[_0xde78('0x11')](this['Agents'],'id');this[_0xde78('0xc')][_0xde78('0x10')]=_0x2c11f7;};WhatsappQueue[_0xde78('0xf')]['updateRealtime']=function(){this[_0xde78('0x12')]=0x0;this[_0xde78('0x13')]=0x0;for(var _0x483faf=0x0;_0x483faf=0x0?this[_0xde78('0x17')]:0x0;var _0x4fa454={'id':this['id'],'available':this['available'],'loggedIn':this[_0xde78('0x12')],'name':this[_0xde78('0x7')],'paused':this[_0xde78('0x13')],'waiting':this[_0xde78('0x18')]};var _0x3ea4ff=md5(JSON['stringify'](_0x4fa454));if(this[_0xde78('0x0')]!==_0x3ea4ff){this[_0xde78('0x0')]=_0x3ea4ff;io['to'](util[_0xde78('0x19')](_0xde78('0x1a'),_0x4fa454[_0xde78('0x7')]))[_0xde78('0x1b')](_0xde78('0x1c'),_0x4fa454);}};module[_0xde78('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 3ee9da0..c7e73bb 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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 342ed6a..1ed8fa5 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 _0x636a=['updateChatInteraction','addTagsToChatInteraction','update','Request','UpdateChatInteraction'];(function(_0x3665c3,_0x2c4851){var _0x48e059=function(_0x290dfc){while(--_0x290dfc){_0x3665c3['push'](_0x3665c3['shift']());}};_0x48e059(++_0x2c4851);}(_0x636a,0x93));var _0xa636=function(_0x8a2dae,_0x2a21a7){_0x8a2dae=_0x8a2dae-0x0;var _0x308f20=_0x636a[_0x8a2dae];return _0x308f20;};'use strict';var client=require('../client');exports[_0xa636('0x0')]=function(_0x31c21a,_0x6f5da){return client[_0xa636('0x1')](_0xa636('0x2'),{'body':_0x6f5da,'options':{'where':{'id':_0x31c21a}},'log':_0xa636('0x3')});};exports['addTags']=function(_0x259f9f,_0x2a2aeb){return client[_0xa636('0x1')]('AddTagsToChatInteraction',{'body':_0x2a2aeb,'options':{'where':{'id':_0x259f9f}},'log':_0xa636('0x4')});}; \ No newline at end of file +var _0xb097=['update','Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xb097,0x72));var _0x7b09=function(_0x4fc136,_0x69d1f4){_0x4fc136=_0x4fc136-0x0;var _0x1fbb3f=_0xb097[_0x4fc136];return _0x1fbb3f;};'use strict';var client=require('../client');exports[_0x7b09('0x0')]=function(_0x7615b5,_0x1551b6){return client[_0x7b09('0x1')](_0x7b09('0x2'),{'body':_0x1551b6,'options':{'where':{'id':_0x7615b5}},'log':_0x7b09('0x3')});};exports[_0x7b09('0x4')]=function(_0xa88835,_0x5b4e95){return client[_0x7b09('0x1')](_0x7b09('0x5'),{'body':_0x5b4e95,'options':{'where':{'id':_0xa88835}},'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 88ee332..4ac48aa 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 _0xd57d=['../client','Request'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xd57d,0xe8));var _0xdd57=function(_0x8b8e01,_0x1cca1f){_0x8b8e01=_0x8b8e01-0x0;var _0x43cb19=_0xd57d[_0x8b8e01];return _0x43cb19;};'use strict';var client=require(_0xdd57('0x0'));exports['create']=function(_0x42997b){return client[_0xdd57('0x1')]('CreateChatMessage',{'body':_0x42997b,'log':'createChatMessage'});}; \ No newline at end of file +var _0x8067=['create','../client'];(function(_0x52b24f,_0xca062d){var _0x46ea6b=function(_0x29f821){while(--_0x29f821){_0x52b24f['push'](_0x52b24f['shift']());}};_0x46ea6b(++_0xca062d);}(_0x8067,0xa5));var _0x7806=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x8067[_0xfae23b];return _0x200640;};'use strict';var client=require(_0x7806('0x0'));exports[_0x7806('0x1')]=function(_0x294e7c){return client['Request']('CreateChatMessage',{'body':_0x294e7c,'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 05e1774..413d70b 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 _0xb079=['name','timeout','strategy','User','Agents','online','chatPause','getChatQueues','Request','GetChatQueue'];(function(_0x5d2de3,_0x3f8a8a){var _0x5e63a7=function(_0x2ff2b2){while(--_0x2ff2b2){_0x5d2de3['push'](_0x5d2de3['shift']());}};_0x5e63a7(++_0x3f8a8a);}(_0xb079,0x1c9));var _0x9b07=function(_0x193203,_0x23c136){_0x193203=_0x193203-0x0;var _0x575f07=_0xb079[_0x193203];return _0x575f07;};'use strict';var client=require('../client');exports[_0x9b07('0x0')]=function(){return function(){return client[_0x9b07('0x1')](_0x9b07('0x2'),{'options':{'raw':![],'attributes':['id',_0x9b07('0x3'),_0x9b07('0x4'),_0x9b07('0x5')],'include':[{'model':_0x9b07('0x6'),'as':_0x9b07('0x7'),'attributes':['id',_0x9b07('0x3'),_0x9b07('0x8'),_0x9b07('0x9')]}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0x4944=['Request','GetChatQueue','name','timeout','strategy','Agents','online','chatPause','getChatQueues','../client'];(function(_0x421e3a,_0xd69d11){var _0x3f9abd=function(_0x4b9bb4){while(--_0x4b9bb4){_0x421e3a['push'](_0x421e3a['shift']());}};_0x3f9abd(++_0xd69d11);}(_0x4944,0x6d));var _0x4494=function(_0x155b4d,_0x369502){_0x155b4d=_0x155b4d-0x0;var _0x19f51d=_0x4944[_0x155b4d];return _0x19f51d;};'use strict';var client=require(_0x4494('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x4494('0x1')](_0x4494('0x2'),{'options':{'raw':![],'attributes':['id',_0x4494('0x3'),_0x4494('0x4'),_0x4494('0x5')],'include':[{'model':'User','as':_0x4494('0x6'),'attributes':['id','name',_0x4494('0x7'),_0x4494('0x8')]}]},'log':_0x4494('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index dfebdda..eb8b804 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 _0xeebe=['Request','UpdateChatQueueReport','DESC','../client','CreateChatQueueReport','update'];(function(_0x4b8bfd,_0x166eae){var _0x36e309=function(_0x3d2a23){while(--_0x3d2a23){_0x4b8bfd['push'](_0x4b8bfd['shift']());}};_0x36e309(++_0x166eae);}(_0xeebe,0xff));var _0xeeeb=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xeebe[_0x126558];return _0x1f6d14;};'use strict';var client=require(_0xeeeb('0x0'));exports['create']=function(_0x369435){return client['Request'](_0xeeeb('0x1'),{'body':_0x369435,'log':_0xeeeb('0x1')});};exports[_0xeeeb('0x2')]=function(_0x427b94,_0x147b13){return client[_0xeeeb('0x3')](_0xeeeb('0x4'),{'body':_0x147b13,'options':{'where':{'uniqueid':_0x427b94},'order':[['id',_0xeeeb('0x5')]],'limit':0x1},'log':_0xeeeb('0x4')});}; \ No newline at end of file +var _0x2ce1=['CreateChatQueueReport','update','DESC','UpdateChatQueueReport','Request'];(function(_0x3b70bb,_0x5c7950){var _0x32cd33=function(_0xbcd387){while(--_0xbcd387){_0x3b70bb['push'](_0x3b70bb['shift']());}};_0x32cd33(++_0x5c7950);}(_0x2ce1,0x8b));var _0x12ce=function(_0x49860c,_0x49237e){_0x49860c=_0x49860c-0x0;var _0x4e2361=_0x2ce1[_0x49860c];return _0x4e2361;};'use strict';var client=require('../client');exports['create']=function(_0x5cfde5){return client[_0x12ce('0x0')](_0x12ce('0x1'),{'body':_0x5cfde5,'log':_0x12ce('0x1')});};exports[_0x12ce('0x2')]=function(_0x4918dc,_0x37b568){return client[_0x12ce('0x0')]('UpdateChatQueueReport',{'body':_0x37b568,'options':{'where':{'uniqueid':_0x4918dc},'order':[['id',_0x12ce('0x3')]],'limit':0x1},'log':_0x12ce('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 4c72ce4..61ceeca 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(_0x27031e,_0x1eb8cd){var _0xfd46b3=function(_0x9fdcf8){while(--_0x9fdcf8){_0x27031e['push'](_0x27031e['shift']());}};_0xfd46b3(++_0x1eb8cd);}(_0x7a54,0x106));var _0x47a5=function(_0x5b1e80,_0x3d06e4){_0x5b1e80=_0x5b1e80-0x0;var _0x157b1b=_0x7a54[_0x5b1e80];return _0x157b1b;};'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(_0x280cc1,_0x5ea95b){var _0x1e3fcb=function(_0x413acf){while(--_0x413acf){_0x280cc1['push'](_0x280cc1['shift']());}};_0x1e3fcb(++_0x5ea95b);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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 96eafa7..0bc0f7b 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 _0x1451=['create','Request','createFaxMessage'];(function(_0x17cc7b,_0x21c8ec){var _0x4c9b70=function(_0x39e291){while(--_0x39e291){_0x17cc7b['push'](_0x17cc7b['shift']());}};_0x4c9b70(++_0x21c8ec);}(_0x1451,0xe7));var _0x1145=function(_0x375c0b,_0x567d67){_0x375c0b=_0x375c0b-0x0;var _0x4c4bec=_0x1451[_0x375c0b];return _0x4c4bec;};'use strict';var client=require('../client');exports[_0x1145('0x0')]=function(_0xf5684b){return client[_0x1145('0x1')]('CreateFaxMessage',{'body':_0xf5684b,'log':_0x1145('0x2')});}; \ No newline at end of file +var _0x1cdc=['CreateFaxMessage','createFaxMessage','../client','Request'];(function(_0x302d1a,_0x387081){var _0xd82ca=function(_0x24912b){while(--_0x24912b){_0x302d1a['push'](_0x302d1a['shift']());}};_0xd82ca(++_0x387081);}(_0x1cdc,0x182));var _0xc1cd=function(_0x9a9f46,_0x1d1e25){_0x9a9f46=_0x9a9f46-0x0;var _0x5dc8be=_0x1cdc[_0x9a9f46];return _0x5dc8be;};'use strict';var client=require(_0xc1cd('0x0'));exports['create']=function(_0x5b6e60){return client[_0xc1cd('0x1')](_0xc1cd('0x2'),{'body':_0x5b6e60,'log':_0xc1cd('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index eb72f6f..cf5544c 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 _0x3159=['Request','GetFaxQueue','name','timeout','strategy','User','Agents','online','faxPause','getFaxQueues'];(function(_0x5202a9,_0x52168b){var _0xc16203=function(_0x470ea7){while(--_0x470ea7){_0x5202a9['push'](_0x5202a9['shift']());}};_0xc16203(++_0x52168b);}(_0x3159,0xef));var _0x9315=function(_0x39f14a,_0x276c6f){_0x39f14a=_0x39f14a-0x0;var _0x5a8f86=_0x3159[_0x39f14a];return _0x5a8f86;};'use strict';var client=require('../client');exports[_0x9315('0x0')]=function(){return function(){return client[_0x9315('0x1')](_0x9315('0x2'),{'options':{'raw':![],'attributes':['id',_0x9315('0x3'),_0x9315('0x4'),_0x9315('0x5')],'include':[{'model':_0x9315('0x6'),'as':_0x9315('0x7'),'attributes':['id',_0x9315('0x3'),_0x9315('0x8'),_0x9315('0x9')]}]},'log':_0x9315('0x0')});};}; \ No newline at end of file +var _0x0554=['getFaxQueues','../client','Request','GetFaxQueue','name','timeout','Agents','online','faxPause'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0554,0x133));var _0x4055=function(_0x1ac120,_0x3e7e45){_0x1ac120=_0x1ac120-0x0;var _0x19b703=_0x0554[_0x1ac120];return _0x19b703;};'use strict';var client=require(_0x4055('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0x4055('0x1')](_0x4055('0x2'),{'options':{'raw':![],'attributes':['id',_0x4055('0x3'),_0x4055('0x4'),'strategy'],'include':[{'model':'User','as':_0x4055('0x5'),'attributes':['id','name',_0x4055('0x6'),_0x4055('0x7')]}]},'log':_0x4055('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 25e7496..a6197b8 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 _0x9a6b=['create','Request','CreateFaxQueueReport','update','DESC','UpdateFaxQueueReport','../client'];(function(_0x533e4e,_0x4eba54){var _0x1f14bb=function(_0x33a485){while(--_0x33a485){_0x533e4e['push'](_0x533e4e['shift']());}};_0x1f14bb(++_0x4eba54);}(_0x9a6b,0x14f));var _0xb9a6=function(_0x1f4295,_0x5d0590){_0x1f4295=_0x1f4295-0x0;var _0x39070e=_0x9a6b[_0x1f4295];return _0x39070e;};'use strict';var client=require(_0xb9a6('0x0'));exports[_0xb9a6('0x1')]=function(_0x2b412b){return client[_0xb9a6('0x2')](_0xb9a6('0x3'),{'body':_0x2b412b,'log':'CreateFaxQueueReport'});};exports[_0xb9a6('0x4')]=function(_0x4af51e,_0x148771){return client[_0xb9a6('0x2')]('UpdateFaxQueueReport',{'body':_0x148771,'options':{'where':{'uniqueid':_0x4af51e},'order':[['id',_0xb9a6('0x5')]],'limit':0x1},'log':_0xb9a6('0x6')});}; \ No newline at end of file +var _0xf802=['CreateFaxQueueReport','update','Request','UpdateFaxQueueReport','DESC','../client','create'];(function(_0x365be9,_0x3c88b9){var _0x185c12=function(_0xbadbbf){while(--_0xbadbbf){_0x365be9['push'](_0x365be9['shift']());}};_0x185c12(++_0x3c88b9);}(_0xf802,0x1b0));var _0x2f80=function(_0x176429,_0x1e6c5a){_0x176429=_0x176429-0x0;var _0x2be140=_0xf802[_0x176429];return _0x2be140;};'use strict';var client=require(_0x2f80('0x0'));exports[_0x2f80('0x1')]=function(_0x178d29){return client['Request'](_0x2f80('0x2'),{'body':_0x178d29,'log':'CreateFaxQueueReport'});};exports[_0x2f80('0x3')]=function(_0x2528af,_0x191f0b){return client[_0x2f80('0x4')](_0x2f80('0x5'),{'body':_0x191f0b,'options':{'where':{'uniqueid':_0x2528af},'order':[['id',_0x2f80('0x6')]],'limit':0x1},'log':_0x2f80('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index e92ff64..718211a 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 _0x74c3=['Intervals','interval','getIntervals','../client','Request','GetInterval','name','Interval'];(function(_0xb30a9,_0x5ad9a6){var _0x253c03=function(_0x158729){while(--_0x158729){_0xb30a9['push'](_0xb30a9['shift']());}};_0x253c03(++_0x5ad9a6);}(_0x74c3,0x113));var _0x374c=function(_0x4e1c7d,_0x1366bc){_0x4e1c7d=_0x4e1c7d-0x0;var _0x191a91=_0x74c3[_0x4e1c7d];return _0x191a91;};'use strict';var client=require(_0x374c('0x0'));exports['getIntervals']=function(){return function(){return client[_0x374c('0x1')](_0x374c('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x374c('0x3')],'include':[{'model':_0x374c('0x4'),'as':_0x374c('0x5'),'attributes':['id','name',_0x374c('0x6')]}]},'log':_0x374c('0x7')});};}; \ No newline at end of file +var _0x8793=['interval','../client','getIntervals','name','Interval','Intervals'];(function(_0x559e51,_0x2836f7){var _0x3d228c=function(_0x1f2a44){while(--_0x1f2a44){_0x559e51['push'](_0x559e51['shift']());}};_0x3d228c(++_0x2836f7);}(_0x8793,0xf7));var _0x3879=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0x8793[_0x4a3898];return _0x25ceb0;};'use strict';var client=require(_0x3879('0x0'));exports[_0x3879('0x1')]=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x3879('0x2')],'include':[{'model':_0x3879('0x3'),'as':_0x3879('0x4'),'attributes':['id',_0x3879('0x2'),_0x3879('0x5')]}]},'log':_0x3879('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index ecfc2c7..ea8b9fb 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 _0x4bd3=['../client','addTags','AddTagsToMailInteraction','addTagsToChatInteraction'];(function(_0xa961c5,_0xdd9ef0){var _0x33e6bf=function(_0x55f981){while(--_0x55f981){_0xa961c5['push'](_0xa961c5['shift']());}};_0x33e6bf(++_0xdd9ef0);}(_0x4bd3,0x174));var _0x34bd=function(_0xa9e81f,_0x22e636){_0xa9e81f=_0xa9e81f-0x0;var _0x5d48b2=_0x4bd3[_0xa9e81f];return _0x5d48b2;};'use strict';var client=require(_0x34bd('0x0'));exports['update']=function(_0x415bd3,_0x22a9f9){return client['Request']('UpdateMailInteraction',{'body':_0x22a9f9,'options':{'where':{'id':_0x415bd3}},'log':'updateMailInteraction'});};exports[_0x34bd('0x1')]=function(_0x44854a,_0x1fc8eb){return client['Request'](_0x34bd('0x2'),{'body':_0x1fc8eb,'options':{'where':{'id':_0x44854a}},'log':_0x34bd('0x3')});}; \ No newline at end of file +var _0x0120=['update','Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','../client'];(function(_0xa69dc2,_0x4394db){var _0x473981=function(_0x104a7f){while(--_0x104a7f){_0xa69dc2['push'](_0xa69dc2['shift']());}};_0x473981(++_0x4394db);}(_0x0120,0x6f));var _0x0012=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x0120[_0x311c35];return _0x5cc50c;};'use strict';var client=require(_0x0012('0x0'));exports[_0x0012('0x1')]=function(_0x3d23e7,_0xb8d57c){return client[_0x0012('0x2')](_0x0012('0x3'),{'body':_0xb8d57c,'options':{'where':{'id':_0x3d23e7}},'log':_0x0012('0x4')});};exports[_0x0012('0x5')]=function(_0x357f77,_0x302029){return client[_0x0012('0x2')](_0x0012('0x6'),{'body':_0x302029,'options':{'where':{'id':_0x357f77}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index e389948..ad1f2fc 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 _0x3767=['createMailMessage','create','Request','CreateMailMessage'];(function(_0x213518,_0x51e022){var _0x1baf75=function(_0x5c8444){while(--_0x5c8444){_0x213518['push'](_0x213518['shift']());}};_0x1baf75(++_0x51e022);}(_0x3767,0x1b1));var _0x7376=function(_0x2cf317,_0x409820){_0x2cf317=_0x2cf317-0x0;var _0xf128b=_0x3767[_0x2cf317];return _0xf128b;};'use strict';var client=require('../client');exports[_0x7376('0x0')]=function(_0x393a12){return client[_0x7376('0x1')](_0x7376('0x2'),{'body':_0x393a12,'log':_0x7376('0x3')});}; \ No newline at end of file +var _0x6daf=['create','Request','CreateMailMessage','createMailMessage','../client'];(function(_0xb0336d,_0x106a81){var _0x28e10e=function(_0x13c0a5){while(--_0x13c0a5){_0xb0336d['push'](_0xb0336d['shift']());}};_0x28e10e(++_0x106a81);}(_0x6daf,0x77));var _0xf6da=function(_0x151ffb,_0x504e4c){_0x151ffb=_0x151ffb-0x0;var _0x2f620f=_0x6daf[_0x151ffb];return _0x2f620f;};'use strict';var client=require(_0xf6da('0x0'));exports[_0xf6da('0x1')]=function(_0x5b294d){return client[_0xf6da('0x2')](_0xf6da('0x3'),{'body':_0x5b294d,'log':_0xf6da('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 467fdac..e06ebc6 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 _0x179f=['GetMailQueue','name','timeout','User','Agents','online','mailPause','getMailQueues','../client','Request'];(function(_0x5a7e3c,_0xdc9219){var _0x59252b=function(_0x29655c){while(--_0x29655c){_0x5a7e3c['push'](_0x5a7e3c['shift']());}};_0x59252b(++_0xdc9219);}(_0x179f,0x1e8));var _0xf179=function(_0x526f9d,_0x4add1d){_0x526f9d=_0x526f9d-0x0;var _0x1c03e0=_0x179f[_0x526f9d];return _0x1c03e0;};'use strict';var client=require(_0xf179('0x0'));exports['getMailQueues']=function(){return function(){return client[_0xf179('0x1')](_0xf179('0x2'),{'options':{'raw':![],'attributes':['id',_0xf179('0x3'),_0xf179('0x4'),'strategy'],'include':[{'model':_0xf179('0x5'),'as':_0xf179('0x6'),'attributes':['id',_0xf179('0x3'),_0xf179('0x7'),_0xf179('0x8')]}]},'log':_0xf179('0x9')});};}; \ No newline at end of file +var _0x0fbe=['timeout','strategy','User','Agents','online','mailPause','../client','getMailQueues','Request','GetMailQueue','name'];(function(_0x3750ff,_0x3c185d){var _0x483cce=function(_0x40c8d4){while(--_0x40c8d4){_0x3750ff['push'](_0x3750ff['shift']());}};_0x483cce(++_0x3c185d);}(_0x0fbe,0x8a));var _0xe0fb=function(_0x4318fb,_0x21dde4){_0x4318fb=_0x4318fb-0x0;var _0x461161=_0x0fbe[_0x4318fb];return _0x461161;};'use strict';var client=require(_0xe0fb('0x0'));exports[_0xe0fb('0x1')]=function(){return function(){return client[_0xe0fb('0x2')](_0xe0fb('0x3'),{'options':{'raw':![],'attributes':['id',_0xe0fb('0x4'),_0xe0fb('0x5'),_0xe0fb('0x6')],'include':[{'model':_0xe0fb('0x7'),'as':_0xe0fb('0x8'),'attributes':['id','name',_0xe0fb('0x9'),_0xe0fb('0xa')]}]},'log':_0xe0fb('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 6202b85..ba2f94c 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 _0x50fb=['Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC','create'];(function(_0x275173,_0x522d99){var _0x4b9ba0=function(_0x5c13cc){while(--_0x5c13cc){_0x275173['push'](_0x275173['shift']());}};_0x4b9ba0(++_0x522d99);}(_0x50fb,0x1df));var _0xb50f=function(_0x31a0a6,_0x31b85e){_0x31a0a6=_0x31a0a6-0x0;var _0x2c38ff=_0x50fb[_0x31a0a6];return _0x2c38ff;};'use strict';var client=require('../client');exports[_0xb50f('0x0')]=function(_0x127c0a){return client[_0xb50f('0x1')](_0xb50f('0x2'),{'body':_0x127c0a,'log':_0xb50f('0x2')});};exports[_0xb50f('0x3')]=function(_0x2d1804,_0x31fe46){return client['Request'](_0xb50f('0x4'),{'body':_0x31fe46,'options':{'where':{'uniqueid':_0x2d1804},'order':[['id',_0xb50f('0x5')]],'limit':0x1},'log':_0xb50f('0x4')});}; \ No newline at end of file +var _0x2db5=['create','CreateMailQueueReport','update','UpdateMailQueueReport'];(function(_0x249d7f,_0x1a8430){var _0xf7fed6=function(_0x23c18d){while(--_0x23c18d){_0x249d7f['push'](_0x249d7f['shift']());}};_0xf7fed6(++_0x1a8430);}(_0x2db5,0x168));var _0x52db=function(_0x50b651,_0x2ce0c5){_0x50b651=_0x50b651-0x0;var _0x1ec2b0=_0x2db5[_0x50b651];return _0x1ec2b0;};'use strict';var client=require('../client');exports[_0x52db('0x0')]=function(_0x479ac5){return client['Request'](_0x52db('0x1'),{'body':_0x479ac5,'log':'CreateMailQueueReport'});};exports[_0x52db('0x2')]=function(_0x522f80,_0x3db923){return client['Request'](_0x52db('0x3'),{'body':_0x3db923,'options':{'where':{'uniqueid':_0x522f80},'order':[['id','DESC']],'limit':0x1},'log':_0x52db('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index c1bc5e3..d5f3eb3 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 _0x35f9=['addTagsToChatInteraction','../client','Request','UpdateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x35f9,0x8b));var _0x935f=function(_0x537526,_0x44d019){_0x537526=_0x537526-0x0;var _0x46d4b4=_0x35f9[_0x537526];return _0x46d4b4;};'use strict';var client=require(_0x935f('0x0'));exports['update']=function(_0x1ad9da,_0x1eaa40){return client[_0x935f('0x1')](_0x935f('0x2'),{'body':_0x1eaa40,'options':{'where':{'id':_0x1ad9da}},'log':'updateOpenchannelInteraction'});};exports[_0x935f('0x3')]=function(_0x345ac9,_0x3cf09a){return client[_0x935f('0x1')](_0x935f('0x4'),{'body':_0x3cf09a,'options':{'where':{'id':_0x345ac9}},'log':_0x935f('0x5')});}; \ No newline at end of file +var _0xd970=['updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','Request','UpdateOpenchannelInteraction'];(function(_0x29a728,_0x352bf8){var _0x405405=function(_0x4555a4){while(--_0x4555a4){_0x29a728['push'](_0x29a728['shift']());}};_0x405405(++_0x352bf8);}(_0xd970,0x169));var _0x0d97=function(_0xe2c64,_0x5f28c5){_0xe2c64=_0xe2c64-0x0;var _0xccf2a4=_0xd970[_0xe2c64];return _0xccf2a4;};'use strict';var client=require(_0x0d97('0x0'));exports['update']=function(_0x2f96d0,_0x586aa3){return client[_0x0d97('0x1')](_0x0d97('0x2'),{'body':_0x586aa3,'options':{'where':{'id':_0x2f96d0}},'log':_0x0d97('0x3')});};exports[_0x0d97('0x4')]=function(_0x34ed27,_0x460378){return client[_0x0d97('0x1')](_0x0d97('0x5'),{'body':_0x460378,'options':{'where':{'id':_0x34ed27}},'log':_0x0d97('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 04a8cc5..70ef7b9 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 _0x6f2e=['Request','createOpenchannelMessage','../client','create'];(function(_0x256d6a,_0x2f002f){var _0x460058=function(_0x195be7){while(--_0x195be7){_0x256d6a['push'](_0x256d6a['shift']());}};_0x460058(++_0x2f002f);}(_0x6f2e,0xba));var _0xe6f2=function(_0x5cabde,_0x58abe6){_0x5cabde=_0x5cabde-0x0;var _0x54d117=_0x6f2e[_0x5cabde];return _0x54d117;};'use strict';var client=require(_0xe6f2('0x0'));exports[_0xe6f2('0x1')]=function(_0x491d3f){return client[_0xe6f2('0x2')]('CreateOpenchannelMessage',{'body':_0x491d3f,'log':_0xe6f2('0x3')});}; \ No newline at end of file +var _0x7ecc=['create','createOpenchannelMessage','../client'];(function(_0x53f47e,_0x16d729){var _0x240345=function(_0x4b3e9b){while(--_0x4b3e9b){_0x53f47e['push'](_0x53f47e['shift']());}};_0x240345(++_0x16d729);}(_0x7ecc,0xaa));var _0xc7ec=function(_0x284a19,_0x1b41cb){_0x284a19=_0x284a19-0x0;var _0x50f263=_0x7ecc[_0x284a19];return _0x50f263;};'use strict';var client=require(_0xc7ec('0x0'));exports[_0xc7ec('0x1')]=function(_0x3513ff){return client['Request']('CreateOpenchannelMessage',{'body':_0x3513ff,'log':_0xc7ec('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 7901fe1..0ffe219 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 _0x1d1b=['../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy','Agents'];(function(_0x42fe3e,_0x1ed782){var _0x7a76e0=function(_0x35b1a6){while(--_0x35b1a6){_0x42fe3e['push'](_0x42fe3e['shift']());}};_0x7a76e0(++_0x1ed782);}(_0x1d1b,0x110));var _0xb1d1=function(_0x191e6c,_0x3d41b9){_0x191e6c=_0x191e6c-0x0;var _0x22e7a8=_0x1d1b[_0x191e6c];return _0x22e7a8;};'use strict';var client=require(_0xb1d1('0x0'));exports[_0xb1d1('0x1')]=function(){return function(){return client[_0xb1d1('0x2')](_0xb1d1('0x3'),{'options':{'raw':![],'attributes':['id',_0xb1d1('0x4'),_0xb1d1('0x5'),_0xb1d1('0x6')],'include':[{'model':'User','as':_0xb1d1('0x7'),'attributes':['id',_0xb1d1('0x4'),'online','openchannelPause']}]},'log':_0xb1d1('0x1')});};}; \ No newline at end of file +var _0x1f45=['User','Agents','online','getOpenchannelQueues','../client','Request','GetOpenchannelQueue','strategy'];(function(_0x4471b3,_0x511a9f){var _0x386593=function(_0x1057e2){while(--_0x1057e2){_0x4471b3['push'](_0x4471b3['shift']());}};_0x386593(++_0x511a9f);}(_0x1f45,0x1d4));var _0x51f4=function(_0x30bb75,_0x1b58ec){_0x30bb75=_0x30bb75-0x0;var _0x1ea59b=_0x1f45[_0x30bb75];return _0x1ea59b;};'use strict';var client=require(_0x51f4('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0x51f4('0x1')](_0x51f4('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x51f4('0x3')],'include':[{'model':_0x51f4('0x4'),'as':_0x51f4('0x5'),'attributes':['id','name',_0x51f4('0x6'),'openchannelPause']}]},'log':_0x51f4('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 67d2013..a1142ee 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 _0xb0cb=['UpdateOpenchannelQueueReport','DESC','../client','Request','CreateOpenchannelQueueReport','update'];(function(_0x358d68,_0x229010){var _0x255242=function(_0x5bd780){while(--_0x5bd780){_0x358d68['push'](_0x358d68['shift']());}};_0x255242(++_0x229010);}(_0xb0cb,0x1d0));var _0xbb0c=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0xb0cb[_0x2261ce];return _0x524640;};'use strict';var client=require(_0xbb0c('0x0'));exports['create']=function(_0x6a9738){return client[_0xbb0c('0x1')](_0xbb0c('0x2'),{'body':_0x6a9738,'log':_0xbb0c('0x2')});};exports[_0xbb0c('0x3')]=function(_0x227661,_0x41f616){return client[_0xbb0c('0x1')](_0xbb0c('0x4'),{'body':_0x41f616,'options':{'where':{'uniqueid':_0x227661},'order':[['id',_0xbb0c('0x5')]],'limit':0x1},'log':_0xbb0c('0x4')});}; \ No newline at end of file +var _0x1a56=['update','UpdateOpenchannelQueueReport','../client','create','Request','CreateOpenchannelQueueReport'];(function(_0xf73c09,_0x4e424e){var _0xa8923c=function(_0x4831c1){while(--_0x4831c1){_0xf73c09['push'](_0xf73c09['shift']());}};_0xa8923c(++_0x4e424e);}(_0x1a56,0x13a));var _0x61a5=function(_0xe6e78c,_0x582369){_0xe6e78c=_0xe6e78c-0x0;var _0x2a09c8=_0x1a56[_0xe6e78c];return _0x2a09c8;};'use strict';var client=require(_0x61a5('0x0'));exports[_0x61a5('0x1')]=function(_0x28ff1a){return client[_0x61a5('0x2')](_0x61a5('0x3'),{'body':_0x28ff1a,'log':_0x61a5('0x3')});};exports[_0x61a5('0x4')]=function(_0x29a5c0,_0x524c8b){return client[_0x61a5('0x2')]('UpdateOpenchannelQueueReport',{'body':_0x524c8b,'options':{'where':{'uniqueid':_0x29a5c0},'order':[['id','DESC']],'limit':0x1},'log':_0x61a5('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index a48797d..abc2024 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 _0x94b1=['UpdateSmsInteraction','addTags','addTagsToSmsInteraction','update','Request'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x94b1,0x102));var _0x194b=function(_0xa9f037,_0x3c6cd4){_0xa9f037=_0xa9f037-0x0;var _0x15f5fa=_0x94b1[_0xa9f037];return _0x15f5fa;};'use strict';var client=require('../client');exports[_0x194b('0x0')]=function(_0x5525d4,_0x457a28){return client[_0x194b('0x1')](_0x194b('0x2'),{'body':_0x457a28,'options':{'where':{'id':_0x5525d4}},'log':'updateSmsInteraction'});};exports[_0x194b('0x3')]=function(_0x3a21be,_0x32586a){return client[_0x194b('0x1')]('AddTagsToSmsInteraction',{'body':_0x32586a,'options':{'where':{'id':_0x3a21be}},'log':_0x194b('0x4')});}; \ No newline at end of file +var _0xc9f5=['AddTagsToSmsInteraction','update','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x38c06b,_0xaa82f2){var _0x23d1a3=function(_0x3859de){while(--_0x3859de){_0x38c06b['push'](_0x38c06b['shift']());}};_0x23d1a3(++_0xaa82f2);}(_0xc9f5,0xc4));var _0x5c9f=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0xc9f5[_0x2555d0];return _0x3bb486;};'use strict';var client=require('../client');exports[_0x5c9f('0x0')]=function(_0x3bae7f,_0x52597d){return client[_0x5c9f('0x1')](_0x5c9f('0x2'),{'body':_0x52597d,'options':{'where':{'id':_0x3bae7f}},'log':_0x5c9f('0x3')});};exports['addTags']=function(_0x4a046a,_0x1af905){return client['Request'](_0x5c9f('0x4'),{'body':_0x1af905,'options':{'where':{'id':_0x4a046a}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 1e1727c..8965d41 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 _0xe220=['Request','CreateSmsMessage','create'];(function(_0x1fb03b,_0x3dfaac){var _0x3b6e4a=function(_0x54d3b9){while(--_0x54d3b9){_0x1fb03b['push'](_0x1fb03b['shift']());}};_0x3b6e4a(++_0x3dfaac);}(_0xe220,0x6e));var _0x0e22=function(_0x379596,_0x535be5){_0x379596=_0x379596-0x0;var _0x160313=_0xe220[_0x379596];return _0x160313;};'use strict';var client=require('../client');exports[_0x0e22('0x0')]=function(_0x3e540f){return client[_0x0e22('0x1')](_0x0e22('0x2'),{'body':_0x3e540f,'log':'createSmsMessage'});}; \ No newline at end of file +var _0xcc0c=['../client','create','Request'];(function(_0x3124f8,_0x1a8b23){var _0x5bab5f=function(_0x18b09b){while(--_0x18b09b){_0x3124f8['push'](_0x3124f8['shift']());}};_0x5bab5f(++_0x1a8b23);}(_0xcc0c,0xb7));var _0xccc0=function(_0x100682,_0x11afec){_0x100682=_0x100682-0x0;var _0xcb6e87=_0xcc0c[_0x100682];return _0xcb6e87;};'use strict';var client=require(_0xccc0('0x0'));exports[_0xccc0('0x1')]=function(_0x47e483){return client[_0xccc0('0x2')]('CreateSmsMessage',{'body':_0x47e483,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 1b69d3c..bd2c119 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 _0xcb91=['smsPause','Request','GetSmsQueue','name','timeout','User','Agents','online'];(function(_0x413a06,_0x468852){var _0x408e03=function(_0x408590){while(--_0x408590){_0x413a06['push'](_0x413a06['shift']());}};_0x408e03(++_0x468852);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5311a1,_0x304912){_0x5311a1=_0x5311a1-0x0;var _0x2acb9f=_0xcb91[_0x5311a1];return _0x2acb9f;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'attributes':['id',_0x1cb9('0x2'),_0x1cb9('0x3'),'strategy'],'include':[{'model':_0x1cb9('0x4'),'as':_0x1cb9('0x5'),'attributes':['id','name',_0x1cb9('0x6'),_0x1cb9('0x7')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x12d013,_0x286e4c){var _0x54220c=function(_0x31d518){while(--_0x31d518){_0x12d013['push'](_0x12d013['shift']());}};_0x54220c(++_0x286e4c);}(_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 diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index b2cdeac..c85cd68 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 _0xedd9=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x2d1971,_0x20b764){var _0x4d7759=function(_0x56a550){while(--_0x56a550){_0x2d1971['push'](_0x2d1971['shift']());}};_0x4d7759(++_0x20b764);}(_0xedd9,0xfc));var _0x9edd=function(_0x596019,_0x14be98){_0x596019=_0x596019-0x0;var _0x47d4fc=_0xedd9[_0x596019];return _0x47d4fc;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(_0x2d7989){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'body':_0x2d7989,'log':_0x9edd('0x2')});};exports[_0x9edd('0x3')]=function(_0x3e6d3a,_0x36b53f){return client['Request'](_0x9edd('0x4'),{'body':_0x36b53f,'options':{'where':{'uniqueid':_0x3e6d3a},'order':[['id',_0x9edd('0x5')]],'limit':0x1},'log':_0x9edd('0x4')});}; \ No newline at end of file +var _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x20270e,_0x4e03cc){var _0x515150=function(_0x361e78){while(--_0x361e78){_0x20270e['push'](_0x20270e['shift']());}};_0x515150(++_0x4e03cc);}(_0x70e0,0x17b));var _0x070e=function(_0x58b1e2,_0xd58a43){_0x58b1e2=_0x58b1e2-0x0;var _0x4dc64b=_0x70e0[_0x58b1e2];return _0x4dc64b;};'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 42dc5e2..3f1c36a 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(_0x375441,_0x92e3fa){var _0x1676c8=function(_0x1c77c6){while(--_0x1c77c6){_0x375441['push'](_0x375441['shift']());}};_0x1676c8(++_0x92e3fa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'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(_0x1c9bb3,_0x375f48){var _0x16c1dc=function(_0xa1087b){while(--_0xa1087b){_0x1c9bb3['push'](_0x1c9bb3['shift']());}};_0x16c1dc(++_0x375f48);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'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 9be7495..ebc6f70 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 _0x6363=['Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client'];(function(_0x7a2460,_0x158a55){var _0x573549=function(_0x21cd67){while(--_0x21cd67){_0x7a2460['push'](_0x7a2460['shift']());}};_0x573549(++_0x158a55);}(_0x6363,0x13a));var _0x3636=function(_0xbbdafa,_0x127b79){_0xbbdafa=_0xbbdafa-0x0;var _0x4a82df=_0x6363[_0xbbdafa];return _0x4a82df;};'use strict';var client=require(_0x3636('0x0'));exports['update']=function(_0x225b8a,_0x16d6df){return client[_0x3636('0x1')](_0x3636('0x2'),{'body':_0x16d6df,'options':{'where':{'id':_0x225b8a}},'log':_0x3636('0x3')});};exports[_0x3636('0x4')]=function(_0x1335a2,_0xdf836f){return client[_0x3636('0x1')](_0x3636('0x5'),{'body':_0xdf836f,'options':{'where':{'id':_0x1335a2}},'log':_0x3636('0x6')});}; \ No newline at end of file +var _0xfb65=['update','Request','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction'];(function(_0xd421a2,_0x25bb0a){var _0x3c8ccf=function(_0x253e80){while(--_0x253e80){_0xd421a2['push'](_0xd421a2['shift']());}};_0x3c8ccf(++_0x25bb0a);}(_0xfb65,0x82));var _0x5fb6=function(_0x1151fa,_0x2784a7){_0x1151fa=_0x1151fa-0x0;var _0x49da2b=_0xfb65[_0x1151fa];return _0x49da2b;};'use strict';var client=require('../client');exports[_0x5fb6('0x0')]=function(_0x50bb32,_0x5cc692){return client[_0x5fb6('0x1')]('UpdateWhatsappInteraction',{'body':_0x5cc692,'options':{'where':{'id':_0x50bb32}},'log':_0x5fb6('0x2')});};exports[_0x5fb6('0x3')]=function(_0xca6345,_0xb5f7c4){return client[_0x5fb6('0x1')](_0x5fb6('0x4'),{'body':_0xb5f7c4,'options':{'where':{'id':_0xca6345}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 51fb014..f761ddc 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 _0x5e4b=['../client','create','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x32e649,_0x228649){var _0x14d386=function(_0x3fb3ed){while(--_0x3fb3ed){_0x32e649['push'](_0x32e649['shift']());}};_0x14d386(++_0x228649);}(_0x5e4b,0x15c));var _0xb5e4=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x5e4b[_0x13ea00];return _0x1f7347;};'use strict';var client=require(_0xb5e4('0x0'));exports[_0xb5e4('0x1')]=function(_0x45590b){return client['Request'](_0xb5e4('0x2'),{'body':_0x45590b,'log':_0xb5e4('0x3')});}; \ No newline at end of file +var _0xd892=['CreateWhatsappMessage','createWhatsappMessage','../client','create','Request'];(function(_0x25b4cc,_0x1186ff){var _0x1b1bc9=function(_0x172525){while(--_0x172525){_0x25b4cc['push'](_0x25b4cc['shift']());}};_0x1b1bc9(++_0x1186ff);}(_0xd892,0x84));var _0x2d89=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xd892[_0x5ddb1c];return _0x354adc;};'use strict';var client=require(_0x2d89('0x0'));exports[_0x2d89('0x1')]=function(_0xfd6f51){return client[_0x2d89('0x2')](_0x2d89('0x3'),{'body':_0xfd6f51,'log':_0x2d89('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index ad7c52e..bbbde14 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 _0x15e9=['User','Agents','online','whatsappPause','../client','getWhatsappQueues','GetWhatsappQueue','name','timeout','strategy'];(function(_0xd8face,_0x4ef518){var _0x38d98d=function(_0x24fd54){while(--_0x24fd54){_0xd8face['push'](_0xd8face['shift']());}};_0x38d98d(++_0x4ef518);}(_0x15e9,0xd6));var _0x915e=function(_0x21d6c5,_0xeac338){_0x21d6c5=_0x21d6c5-0x0;var _0xe230b5=_0x15e9[_0x21d6c5];return _0xe230b5;};'use strict';var client=require(_0x915e('0x0'));exports[_0x915e('0x1')]=function(){return function(){return client['Request'](_0x915e('0x2'),{'options':{'raw':![],'attributes':['id',_0x915e('0x3'),_0x915e('0x4'),_0x915e('0x5')],'include':[{'model':_0x915e('0x6'),'as':_0x915e('0x7'),'attributes':['id','name',_0x915e('0x8'),_0x915e('0x9')]}]},'log':_0x915e('0x1')});};}; \ No newline at end of file +var _0x2c4c=['GetWhatsappQueue','name','timeout','strategy','User','online','whatsappPause','getWhatsappQueues','Request'];(function(_0x1005a7,_0x175ccb){var _0x1b381c=function(_0x3da76c){while(--_0x3da76c){_0x1005a7['push'](_0x1005a7['shift']());}};_0x1b381c(++_0x175ccb);}(_0x2c4c,0x10c));var _0xc2c4=function(_0x4f84c3,_0x6d094d){_0x4f84c3=_0x4f84c3-0x0;var _0x460f9f=_0x2c4c[_0x4f84c3];return _0x460f9f;};'use strict';var client=require('../client');exports[_0xc2c4('0x0')]=function(){return function(){return client[_0xc2c4('0x1')](_0xc2c4('0x2'),{'options':{'raw':![],'attributes':['id',_0xc2c4('0x3'),_0xc2c4('0x4'),_0xc2c4('0x5')],'include':[{'model':_0xc2c4('0x6'),'as':'Agents','attributes':['id','name',_0xc2c4('0x7'),_0xc2c4('0x8')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index fa4808b..0bec3ee 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 _0xf22d=['Request','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','DESC','../client','create'];(function(_0x272584,_0x36edca){var _0x7da42f=function(_0x2c895d){while(--_0x2c895d){_0x272584['push'](_0x272584['shift']());}};_0x7da42f(++_0x36edca);}(_0xf22d,0x106));var _0xdf22=function(_0x328b1c,_0xec0b4f){_0x328b1c=_0x328b1c-0x0;var _0x4dbeaa=_0xf22d[_0x328b1c];return _0x4dbeaa;};'use strict';var client=require(_0xdf22('0x0'));exports[_0xdf22('0x1')]=function(_0x1ff49f){return client[_0xdf22('0x2')](_0xdf22('0x3'),{'body':_0x1ff49f,'log':_0xdf22('0x3')});};exports['update']=function(_0x17c462,_0x203385){return client[_0xdf22('0x2')](_0xdf22('0x4'),{'body':_0x203385,'options':{'where':{'uniqueid':_0x17c462},'order':[['id',_0xdf22('0x5')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0x26a8=['update','UpdateWhatsappQueueReport','DESC','../client','create','Request','CreateWhatsappQueueReport'];(function(_0x9d7f95,_0x4fa273){var _0x8f9e78=function(_0x505a93){while(--_0x505a93){_0x9d7f95['push'](_0x9d7f95['shift']());}};_0x8f9e78(++_0x4fa273);}(_0x26a8,0x13e));var _0x826a=function(_0x4a2cf3,_0x22b1f7){_0x4a2cf3=_0x4a2cf3-0x0;var _0x36746c=_0x26a8[_0x4a2cf3];return _0x36746c;};'use strict';var client=require(_0x826a('0x0'));exports[_0x826a('0x1')]=function(_0x409a72){return client[_0x826a('0x2')](_0x826a('0x3'),{'body':_0x409a72,'log':_0x826a('0x3')});};exports[_0x826a('0x4')]=function(_0x187db0,_0x2cb959){return client[_0x826a('0x2')](_0x826a('0x5'),{'body':_0x2cb959,'options':{'where':{'uniqueid':_0x187db0},'order':[['id',_0x826a('0x6')]],'limit':0x1},'log':_0x826a('0x5')});}; \ 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 be74ec8..d7f168b 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 _0x7cb8=['stop','agents','timeout','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','lodash','util','../../../../config/logger','routing','./strategy','string','number','timeout\x20is\x20a\x20number','info','format','name','toLowerCase','consequence','validate','error','map'];(function(_0x363db8,_0x4f7dea){var _0x2c48a8=function(_0x2db1fd){while(--_0x2db1fd){_0x363db8['push'](_0x363db8['shift']());}};_0x2c48a8(++_0x4f7dea);}(_0x7cb8,0x150));var _0x87cb=function(_0x128feb,_0x20b638){_0x128feb=_0x128feb-0x0;var _0x2b9d62=_0x7cb8[_0x128feb];return _0x2b9d62;};'use strict';var schema=require('validate');var _=require(_0x87cb('0x0'));var util=require(_0x87cb('0x1'));var seqqueue=require('seq-queue');var logger=require(_0x87cb('0x2'))(_0x87cb('0x3'));var strategy=require(_0x87cb('0x4'));var queue=schema({'name':{'type':_0x87cb('0x5'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x87cb('0x6'),'message':_0x87cb('0x7')}});function writeLog(_0x143ac9,_0x3a07b5,_0x25ca68){return logger[_0x87cb('0x8')](util[_0x87cb('0x9')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x143ac9,_0x3a07b5[_0x87cb('0xa')],_0x25ca68));}function handleFindAgent(_0x37e381){return function(_0x5894fa){return _0x5894fa['name'][_0x87cb('0xb')]()===_0x37e381[_0x87cb('0xb')]();};}exports[_0x87cb('0xc')]=function(_0x196cea,_0x259f37,_0x3c5d0d,_0x33c6c1){return function(_0x1c9c8f){try{var _0x113889={'name':_0x259f37[0x0],'timeout':_0x259f37[0x1]};var _0x45728c=queue[_0x87cb('0xd')](_0x113889,{'typecast':!![]});if(_0x45728c['length']){logger[_0x87cb('0xe')]('[%s][AGENT]\x20%s',_0x196cea,_[_0x87cb('0xf')](_0x45728c,'message')['join'](',\x20'));_0x1c9c8f[_0x87cb('0x10')]();}else{var _0x19d3a6=_['find'](_0x3c5d0d[_0x87cb('0x11')],handleFindAgent(_0x113889['name']));if(_0x19d3a6){var _0x3924bd=(_0x113889[_0x87cb('0x12')]||0xa)*0x3e8;var _0x410cfc,_0x4f1236;var _0x34b0d9=seqqueue['createQueue'](_0x3924bd);_0x34b0d9['id']=_0x196cea;_0x34b0d9[_0x87cb('0x13')]=_0x3924bd;_0x34b0d9[_0x87cb('0x14')]=_0x33c6c1[_0x87cb('0x14')];writeLog(_0x196cea,_0x19d3a6,util[_0x87cb('0x9')](_0x87cb('0x15'),_0x3924bd));_0x3c5d0d[_0x87cb('0x16')][_0x196cea]['on'](_0x87cb('0x17'),function(){logger['info'](_0x87cb('0x18'),_0x196cea);clearTimeout(_0x4f1236);_0x4f1236=undefined;_0x34b0d9[_0x87cb('0x19')]();if(_0x3c5d0d[_0x87cb('0x16')][_0x196cea]){delete _0x3c5d0d[_0x87cb('0x16')][_0x196cea];}_0x1c9c8f['stop']();});_0x3c5d0d[_0x87cb('0x16')][_0x196cea]['on']('complete',function(){if(_0x3c5d0d[_0x87cb('0x16')][_0x196cea]){delete _0x3c5d0d[_0x87cb('0x16')][_0x196cea];}});_0x4f1236=setTimeout(function(){logger[_0x87cb('0x8')]('[%s][AGENT]\x20ROUTING\x20END',_0x196cea);clearTimeout(_0x4f1236);_0x34b0d9[_0x87cb('0x19')]();_0x1c9c8f[_0x87cb('0x1a')]();},_0x3924bd);strategy[_0x87cb('0x1b')](_0x34b0d9,_0x19d3a6,_0x3c5d0d,_0x33c6c1);}else{logger['error'](_0x87cb('0x1c'),_0x196cea,_0x113889[_0x87cb('0xa')]);_0x1c9c8f[_0x87cb('0x10')]();}}}catch(_0x3720e8){console[_0x87cb('0x1d')](_0x3720e8);logger[_0x87cb('0xe')](_0x87cb('0x1e'),_0x196cea,_0x3720e8[_0x87cb('0x1f')]);_0x1c9c8f['stop']();}};}; \ No newline at end of file +var _0x4313=['format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','map','message','join','stop','agents','timeout','createQueue','atimeout','channel','START:%s','rules','close','complete','info','[%s][AGENT]\x20ROUTING\x20END','next','agent','log','[%s][QUEUE]\x20%s','validate','util','seq-queue','../../../../config/logger','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number'];(function(_0x49ab20,_0xdd7290){var _0x347254=function(_0x246f6d){while(--_0x246f6d){_0x49ab20['push'](_0x49ab20['shift']());}};_0x347254(++_0xdd7290);}(_0x4313,0xe6));var _0x3431=function(_0x3895f4,_0x315ce5){_0x3895f4=_0x3895f4-0x0;var _0x1daba0=_0x4313[_0x3895f4];return _0x1daba0;};'use strict';var schema=require(_0x3431('0x0'));var _=require('lodash');var util=require(_0x3431('0x1'));var seqqueue=require(_0x3431('0x2'));var logger=require(_0x3431('0x3'))('routing');var strategy=require(_0x3431('0x4'));var queue=schema({'name':{'type':_0x3431('0x5'),'required':!![],'message':_0x3431('0x6')},'timeout':{'type':_0x3431('0x7'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x15d173,_0x38b945,_0x35e8ed){return logger['info'](util[_0x3431('0x8')](_0x3431('0x9'),_0x15d173,_0x38b945[_0x3431('0xa')],_0x35e8ed));}function handleFindAgent(_0x3b811b){return function(_0x141b72){return _0x141b72[_0x3431('0xa')]['toLowerCase']()===_0x3b811b[_0x3431('0xb')]();};}exports[_0x3431('0xc')]=function(_0xe486fe,_0x390ba8,_0x52df30,_0x101dcb){return function(_0x1601ee){try{var _0x356c69={'name':_0x390ba8[0x0],'timeout':_0x390ba8[0x1]};var _0x3f9a40=queue[_0x3431('0x0')](_0x356c69,{'typecast':!![]});if(_0x3f9a40[_0x3431('0xd')]){logger[_0x3431('0xe')]('[%s][AGENT]\x20%s',_0xe486fe,_[_0x3431('0xf')](_0x3f9a40,_0x3431('0x10'))[_0x3431('0x11')](',\x20'));_0x1601ee[_0x3431('0x12')]();}else{var _0x444f4e=_['find'](_0x52df30[_0x3431('0x13')],handleFindAgent(_0x356c69[_0x3431('0xa')]));if(_0x444f4e){var _0x56bd74=(_0x356c69[_0x3431('0x14')]||0xa)*0x3e8;var _0x4afa48,_0x5b2c17;var _0x28b087=seqqueue[_0x3431('0x15')](_0x56bd74);_0x28b087['id']=_0xe486fe;_0x28b087[_0x3431('0x16')]=_0x56bd74;_0x28b087['channel']=_0x101dcb[_0x3431('0x17')];writeLog(_0xe486fe,_0x444f4e,util[_0x3431('0x8')](_0x3431('0x18'),_0x56bd74));_0x52df30[_0x3431('0x19')][_0xe486fe]['on']('end',function(){logger['info']('[%s][AGENT]\x20ROUTING\x20STOPPED',_0xe486fe);clearTimeout(_0x5b2c17);_0x5b2c17=undefined;_0x28b087[_0x3431('0x1a')]();if(_0x52df30['rules'][_0xe486fe]){delete _0x52df30[_0x3431('0x19')][_0xe486fe];}_0x1601ee[_0x3431('0x12')]();});_0x52df30[_0x3431('0x19')][_0xe486fe]['on'](_0x3431('0x1b'),function(){if(_0x52df30[_0x3431('0x19')][_0xe486fe]){delete _0x52df30[_0x3431('0x19')][_0xe486fe];}});_0x5b2c17=setTimeout(function(){logger[_0x3431('0x1c')](_0x3431('0x1d'),_0xe486fe);clearTimeout(_0x5b2c17);_0x28b087[_0x3431('0x1a')]();_0x1601ee[_0x3431('0x1e')]();},_0x56bd74);strategy[_0x3431('0x1f')](_0x28b087,_0x444f4e,_0x52df30,_0x101dcb);}else{logger[_0x3431('0xe')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0xe486fe,_0x356c69[_0x3431('0xa')]);_0x1601ee[_0x3431('0x12')]();}}}catch(_0x370e29){console[_0x3431('0x20')](_0x370e29);logger[_0x3431('0xe')](_0x3431('0x21'),_0xe486fe,_0x370e29['stack']);_0x1601ee[_0x3431('0x12')]();}};}; \ 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 fcab084..7b079d2 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 _0x5ce8=['out','channel','sms','interaction','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','getMustacheRender','Message','create','then','body','catch','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','$LATEST','message','toString','postText','error','amazonlex','stringify','Failed','lodash','aws-sdk','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact'];(function(_0x46c01b,_0x23aa8c){var _0x44c601=function(_0x5478bb){while(--_0x5478bb){_0x46c01b['push'](_0x46c01b['shift']());}};_0x44c601(++_0x23aa8c);}(_0x5ce8,0xa6));var _0x85ce=function(_0x347b21,_0x34c802){_0x347b21=_0x347b21-0x0;var _0x28e4fb=_0x5ce8[_0x347b21];return _0x28e4fb;};'use strict';var _=require(_0x85ce('0x0'));var moment=require('moment');var AWS=require(_0x85ce('0x1'));var utils=require('./utils');var logger=require(_0x85ce('0x2'))('routing');var rpc={'chatMessage':require(_0x85ce('0x3')),'openchannelMessage':require(_0x85ce('0x4')),'mailMessage':require(_0x85ce('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x85ce('0x6')),'whatsappMessage':require(_0x85ce('0x7'))};exports['consequence']=function(_0x284073,_0x192dc2){return function(_0x4c5024){try{if(!_['isNil'](this['interaction'][_0x85ce('0x8')])){logger[_0x85ce('0x9')](_0x85ce('0xa'),_0x284073,_0x85ce('0xb'));return _0x4c5024[_0x85ce('0xc')]();}var _0xa91879={'ContactId':this[_0x85ce('0xd')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x85ce('0xe')};if(this[_0x85ce('0xf')]===_0x85ce('0x10')||this[_0x85ce('0xf')]==='whatsapp'){_0xa91879['phone']=this[_0x85ce('0x11')][_0x85ce('0x12')];}var _0x4dd298=this[_0x85ce('0xf')];if(_0x4dd298===_0x85ce('0x13')){_0xa91879[_0x85ce('0x14')]=this[_0x85ce('0x15')]['id'];}else{_0xa91879[_[_0x85ce('0x16')](_0x4dd298)+_0x85ce('0x17')]=this[_0x85ce('0x15')]['id'];}_0xa91879[_[_0x85ce('0x16')](_0x4dd298)+_0x85ce('0x18')]=this[_0x85ce('0x11')]['id'];if(this[_0x85ce('0x11')][_0x85ce('0x19')]){var _0x1e9f04=_0x192dc2[0x4];if(!_[_0x85ce('0x1a')](_0x1e9f04)){_0xa91879['body']=utils[_0x85ce('0x1b')](_0x1e9f04,this);return rpc[_0x4dd298+_0x85ce('0x1c')][_0x85ce('0x1d')](_0xa91879)[_0x85ce('0x1e')](function(_0x74ce5d){logger['info']('[%s][AMAZONLEX]\x20%s',_0x284073,_0xa91879[_0x85ce('0x1f')]);})[_0x85ce('0x20')](function(_0x31e78a){logger['error'](_0x85ce('0xa'),_0x284073,JSON['stringify'](_0x31e78a));})[_0x85ce('0x21')](function(){logger[_0x85ce('0x9')](_0x85ce('0x22'),_0x284073);_0x4c5024[_0x85ce('0x23')]();});}else{logger[_0x85ce('0x9')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x284073);_0x4c5024['stop']();}}else{var _0x44ac09=this;var _0x2d9574=new AWS[(_0x85ce('0x24'))]({'accessKeyId':_0x192dc2[0x0],'secretAccessKey':_0x192dc2[0x1],'region':_0x192dc2[0x2]});var _0x1a769e={'botAlias':_0x85ce('0x25'),'botName':_0x192dc2[0x3],'inputText':this[_0x85ce('0x26')]['body'],'userId':this[_0x85ce('0xf')]+':'+this['interaction']['id'][_0x85ce('0x27')]()};_0x2d9574[_0x85ce('0x28')](_0x1a769e,function(_0x59b651,_0x51119c){if(_0x59b651){logger[_0x85ce('0x29')](_0x85ce('0xa'),_0x284073,_0x59b651['message']);_0x4c5024['next']();}else if(_0x51119c&&_0x51119c['message']){_0x44ac09[_0x85ce('0x1f')][_0x85ce('0x2a')]=_0x51119c;_0xa91879[_0x85ce('0x1f')]=_0x51119c['message'];_0xa91879['providerName']=_0x85ce('0x2a');_0xa91879['providerResponse']=JSON[_0x85ce('0x2b')](_0x51119c);return rpc[_0x4dd298+'Message'][_0x85ce('0x1d')](_0xa91879)[_0x85ce('0x1e')](function(_0xec5674){logger[_0x85ce('0x9')](_0x85ce('0xa'),_0x284073,_0xa91879[_0x85ce('0x1f')]);if(_0x51119c['dialogState']==_0x85ce('0x2c')){_0x4c5024[_0x85ce('0xc')]();}else{_0x4c5024['stop']();}})[_0x85ce('0x20')](function(_0x43dbb9){logger[_0x85ce('0x29')]('[%s][AMAZONLEX]\x20%s',_0x284073,JSON[_0x85ce('0x2b')](_0x43dbb9));_0x4c5024[_0x85ce('0xc')]();});}else{_0x4c5024[_0x85ce('0xc')]();}});}}catch(_0x129e26){logger['error'](_0x85ce('0xa'),_0x284073,JSON[_0x85ce('0x2b')](_0x129e26));_0x4c5024[_0x85ce('0x23')]();}};}; \ No newline at end of file +var _0x3bf0=['../../rpc/whatsappMessage','consequence','UserId','info','[%s][AMAZONLEX]\x20%s','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','interaction','chat','account','AccountId','InteractionId','created','isEmpty','body','Message','then','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','$LATEST','message','toString','postText','providerName','amazonlex','providerResponse','create','dialogState','lodash','moment','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage'];(function(_0x311cf6,_0x270ded){var _0x39d8a1=function(_0x356441){while(--_0x356441){_0x311cf6['push'](_0x311cf6['shift']());}};_0x39d8a1(++_0x270ded);}(_0x3bf0,0xe7));var _0x03bf=function(_0xa0a18e,_0x2e79d2){_0xa0a18e=_0xa0a18e-0x0;var _0x553022=_0x3bf0[_0xa0a18e];return _0x553022;};'use strict';var _=require(_0x03bf('0x0'));var moment=require(_0x03bf('0x1'));var AWS=require('aws-sdk');var utils=require(_0x03bf('0x2'));var logger=require('../../../../config/logger')(_0x03bf('0x3'));var rpc={'chatMessage':require(_0x03bf('0x4')),'openchannelMessage':require(_0x03bf('0x5')),'mailMessage':require(_0x03bf('0x6')),'smsMessage':require(_0x03bf('0x7')),'faxMessage':require(_0x03bf('0x8')),'whatsappMessage':require(_0x03bf('0x9'))};exports[_0x03bf('0xa')]=function(_0x3b6e4c,_0x4d1c8f){return function(_0x4d2e69){try{if(!_['isNil'](this['interaction'][_0x03bf('0xb')])){logger[_0x03bf('0xc')](_0x03bf('0xd'),_0x3b6e4c,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x4d2e69[_0x03bf('0xe')]();}var _0x32b9fb={'ContactId':this[_0x03bf('0xf')]['id'],'sentAt':moment()['format'](_0x03bf('0x10')),'direction':_0x03bf('0x11')};if(this[_0x03bf('0x12')]===_0x03bf('0x13')||this[_0x03bf('0x12')]===_0x03bf('0x14')){_0x32b9fb[_0x03bf('0x15')]=this[_0x03bf('0x16')][_0x03bf('0x15')];}var _0x3bc08b=this[_0x03bf('0x12')];if(_0x3bc08b===_0x03bf('0x17')){_0x32b9fb['ChatWebsiteId']=this[_0x03bf('0x18')]['id'];}else{_0x32b9fb[_['upperFirst'](_0x3bc08b)+_0x03bf('0x19')]=this['account']['id'];}_0x32b9fb[_['upperFirst'](_0x3bc08b)+_0x03bf('0x1a')]=this['interaction']['id'];if(this[_0x03bf('0x16')][_0x03bf('0x1b')]){var _0xdd4819=_0x4d1c8f[0x4];if(!_[_0x03bf('0x1c')](_0xdd4819)){_0x32b9fb[_0x03bf('0x1d')]=utils['getMustacheRender'](_0xdd4819,this);return rpc[_0x3bc08b+_0x03bf('0x1e')]['create'](_0x32b9fb)[_0x03bf('0x1f')](function(_0x462952){logger[_0x03bf('0xc')](_0x03bf('0xd'),_0x3b6e4c,_0x32b9fb[_0x03bf('0x1d')]);})[_0x03bf('0x20')](function(_0x73fe24){logger[_0x03bf('0x21')](_0x03bf('0xd'),_0x3b6e4c,JSON[_0x03bf('0x22')](_0x73fe24));})[_0x03bf('0x23')](function(){logger[_0x03bf('0xc')](_0x03bf('0x24'),_0x3b6e4c);_0x4d2e69['stop']();});}else{logger[_0x03bf('0xc')](_0x03bf('0x25'),_0x3b6e4c);_0x4d2e69[_0x03bf('0x26')]();}}else{var _0x26ef0b=this;var _0x2dc4da=new AWS['LexRuntime']({'accessKeyId':_0x4d1c8f[0x0],'secretAccessKey':_0x4d1c8f[0x1],'region':_0x4d1c8f[0x2]});var _0xeda8dc={'botAlias':_0x03bf('0x27'),'botName':_0x4d1c8f[0x3],'inputText':this[_0x03bf('0x28')][_0x03bf('0x1d')],'userId':this[_0x03bf('0x12')]+':'+this[_0x03bf('0x16')]['id'][_0x03bf('0x29')]()};_0x2dc4da[_0x03bf('0x2a')](_0xeda8dc,function(_0x1b4077,_0xd4673d){if(_0x1b4077){logger['error'](_0x03bf('0xd'),_0x3b6e4c,_0x1b4077['message']);_0x4d2e69[_0x03bf('0xe')]();}else if(_0xd4673d&&_0xd4673d[_0x03bf('0x28')]){_0x26ef0b[_0x03bf('0x1d')]['amazonlex']=_0xd4673d;_0x32b9fb[_0x03bf('0x1d')]=_0xd4673d['message'];_0x32b9fb[_0x03bf('0x2b')]=_0x03bf('0x2c');_0x32b9fb[_0x03bf('0x2d')]=JSON[_0x03bf('0x22')](_0xd4673d);return rpc[_0x3bc08b+_0x03bf('0x1e')][_0x03bf('0x2e')](_0x32b9fb)[_0x03bf('0x1f')](function(_0x13ba3d){logger['info'](_0x03bf('0xd'),_0x3b6e4c,_0x32b9fb[_0x03bf('0x1d')]);if(_0xd4673d[_0x03bf('0x2f')]=='Failed'){_0x4d2e69[_0x03bf('0xe')]();}else{_0x4d2e69['stop']();}})['catch'](function(_0x5059e){logger[_0x03bf('0x21')](_0x03bf('0xd'),_0x3b6e4c,JSON[_0x03bf('0x22')](_0x5059e));_0x4d2e69[_0x03bf('0xe')]();});}else{_0x4d2e69[_0x03bf('0xe')]();}});}}catch(_0x16a420){logger['error'](_0x03bf('0xd'),_0x3b6e4c,JSON[_0x03bf('0x22')](_0x16a420));_0x4d2e69['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index ad0bbde..76d18bc 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 _0x581c=['../../mailRpc','consequence','body','isAutoreply','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','info','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','mail','getMustacheRender','message','from','phone','read','subject','Re:','Re:\x20','ChatWebsiteId','account','upperFirst','InteractionId','Message','inReplyTo','messageId','replace','','auto-replied','All','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','[%s][AUTOREPLY]\x20%s','stringify','error','[RPC][%s][AUTOREPLY]\x20%s','finally','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','resolve','catch','stop','lodash','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction'];(function(_0x175520,_0x5a47ef){var _0x1c3a5e=function(_0x3a37d2){while(--_0x3a37d2){_0x175520['push'](_0x175520['shift']());}};_0x1c3a5e(++_0x5a47ef);}(_0x581c,0x1ed));var _0xc581=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x581c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc581('0x0'));var moment=require('moment');var utils=require('./utils');var logger=require(_0xc581('0x1'))('routing');var rpc={'chatMessage':require(_0xc581('0x2')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xc581('0x3')),'smsMessage':require(_0xc581('0x4')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xc581('0x5')),'chatInteraction':require(_0xc581('0x6')),'openchannelInteraction':require(_0xc581('0x7')),'mailInteraction':require(_0xc581('0x8')),'smsInteraction':require(_0xc581('0x9')),'faxInteraction':require(_0xc581('0xa')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require(_0xc581('0xb'));exports[_0xc581('0xc')]=function(_0x82bdbd,_0x3467c2,_0x373a33,_0x3dcddc){return function(_0x4d9e72){try{var _0x44b6e9=this['channel'];if(_0x44b6e9==='mail'&&_0x3dcddc[_0xc581('0xd')][_0xc581('0xe')]){logger['info']('[%s][AUTOREPLY]\x20%s',_0x82bdbd,_0xc581('0xf'));return _0x4d9e72[_0xc581('0x10')]();}if(_0x3467c2[0x0]==='1'&&(_[_0xc581('0x11')](this[_0xc581('0x12')][_0xc581('0x13')])||!this['interaction'][_0xc581('0x13')])){logger['info']('[%s][AUTOREPLY]\x20%s',_0x82bdbd,_0xc581('0x14'));return _0x4d9e72['next']();}if(_0x3467c2[0x0]==='2'&&this[_0xc581('0x12')][_0xc581('0x15')]){logger[_0xc581('0x16')](_0xc581('0x17'),_0x82bdbd,_0xc581('0x18'));return _0x4d9e72[_0xc581('0x10')]();}var _0x4e8466={'ContactId':this[_0xc581('0x19')]['id'],'sentAt':moment()['format'](_0xc581('0x1a')),'direction':_0xc581('0x1b')};if(this[_0xc581('0x1c')]===_0xc581('0x1d')){_0x4e8466[_0xc581('0xd')]=utils[_0xc581('0x1e')](_0x3467c2[0x2],this);}else{_0x4e8466[_0xc581('0xd')]=utils[_0xc581('0x1e')](_0x3467c2[0x1],this);}if(this[_0xc581('0x1f')]){_0x4e8466['to']=this[_0xc581('0x1f')][_0xc581('0x20')]||'';if(this[_0xc581('0x1c')]==='mail'&&_0x3467c2[0x1]==='1'){_0x4e8466['cc']=this[_0xc581('0x1f')]['cc']||'';}_0x4e8466[_0xc581('0x20')]=this['message']['to']||'';_0x4e8466[_0xc581('0x21')]=this['message'][_0xc581('0x21')]||'';_0x4e8466[_0xc581('0x22')]=!![];if(this[_0xc581('0x1f')][_0xc581('0x23')]){_0x4e8466[_0xc581('0x23')]='';_0x4e8466[_0xc581('0x23')]+=_['startsWith'](this[_0xc581('0x1f')]['subject'],_0xc581('0x24'))?'':_0xc581('0x25');_0x4e8466['subject']+=this[_0xc581('0x1f')][_0xc581('0x23')];}}if(this['channel']==='chat'){_0x4e8466[_0xc581('0x26')]=this[_0xc581('0x27')]['id'];}else{_0x4e8466[_[_0xc581('0x28')](this[_0xc581('0x1c')])+'AccountId']=this[_0xc581('0x27')]['id'];}_0x4e8466[_[_0xc581('0x28')](this[_0xc581('0x1c')])+_0xc581('0x29')]=this[_0xc581('0x12')]['id'];var _0x2350b0=this[_0xc581('0x12')];if(rpc[this[_0xc581('0x1c')]+_0xc581('0x2a')]){if(this[_0xc581('0x1c')]===_0xc581('0x1d')){_0x4e8466[_0xc581('0x2b')]=this['message'][_0xc581('0x2c')];_0x4e8466['html']=''+_[_0xc581('0x2d')](_0x4e8466[_0xc581('0xd')],'','','headers','auto-replied','auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','catch','[RPC][%s][AUTOREPLY]\x20%s','stringify','resolve','Interaction','update','error','create','finally','stop','lodash','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x13f7,0x106));var _0x713f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x13f7[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x713f('0x0'));var moment=require(_0x713f('0x1'));var utils=require(_0x713f('0x2'));var logger=require('../../../../config/logger')(_0x713f('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x713f('0x4')),'mailMessage':require(_0x713f('0x5')),'smsMessage':require(_0x713f('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x713f('0x7')),'chatInteraction':require(_0x713f('0x8')),'openchannelInteraction':require(_0x713f('0x9')),'mailInteraction':require(_0x713f('0xa')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x713f('0xb'))};var mailRpc=require(_0x713f('0xc'));exports[_0x713f('0xd')]=function(_0x3d9939,_0x4a4581,_0x529c39,_0x5901a7){return function(_0xbec80a){try{var _0xe4dcdb=this['channel'];if(_0xe4dcdb===_0x713f('0xe')&&_0x5901a7[_0x713f('0xf')][_0x713f('0x10')]){logger[_0x713f('0x11')](_0x713f('0x12'),_0x3d9939,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0xbec80a[_0x713f('0x13')]();}if(_0x4a4581[0x0]==='1'&&(_['isNil'](this[_0x713f('0x14')][_0x713f('0x15')])||!this['interaction'][_0x713f('0x15')])){logger[_0x713f('0x11')](_0x713f('0x12'),_0x3d9939,_0x713f('0x16'));return _0xbec80a[_0x713f('0x13')]();}if(_0x4a4581[0x0]==='2'&&this[_0x713f('0x14')][_0x713f('0x17')]){logger[_0x713f('0x11')](_0x713f('0x18'),_0x3d9939,_0x713f('0x19'));return _0xbec80a[_0x713f('0x13')]();}var _0x56a98f={'ContactId':this[_0x713f('0x1a')]['id'],'sentAt':moment()[_0x713f('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x713f('0x1c')};if(this[_0x713f('0x1d')]===_0x713f('0xe')){_0x56a98f['body']=utils[_0x713f('0x1e')](_0x4a4581[0x2],this);}else{_0x56a98f[_0x713f('0xf')]=utils[_0x713f('0x1e')](_0x4a4581[0x1],this);}if(this[_0x713f('0x1f')]){_0x56a98f['to']=this[_0x713f('0x1f')][_0x713f('0x20')]||'';if(this['channel']==='mail'&&_0x4a4581[0x1]==='1'){_0x56a98f['cc']=this[_0x713f('0x1f')]['cc']||'';}_0x56a98f['from']=this[_0x713f('0x1f')]['to']||'';_0x56a98f['phone']=this[_0x713f('0x1f')][_0x713f('0x21')]||'';_0x56a98f['read']=!![];if(this[_0x713f('0x1f')]['subject']){_0x56a98f['subject']='';_0x56a98f['subject']+=_[_0x713f('0x22')](this['message'][_0x713f('0x23')],'Re:')?'':'Re:\x20';_0x56a98f[_0x713f('0x23')]+=this[_0x713f('0x1f')][_0x713f('0x23')];}}if(this[_0x713f('0x1d')]===_0x713f('0x24')){_0x56a98f[_0x713f('0x25')]=this['account']['id'];}else{_0x56a98f[_[_0x713f('0x26')](this['channel'])+_0x713f('0x27')]=this[_0x713f('0x28')]['id'];}_0x56a98f[_[_0x713f('0x26')](this[_0x713f('0x1d')])+_0x713f('0x29')]=this[_0x713f('0x14')]['id'];var _0x1fdfd0=this[_0x713f('0x14')];if(rpc[this['channel']+_0x713f('0x2a')]){if(this[_0x713f('0x1d')]===_0x713f('0xe')){_0x56a98f['inReplyTo']=this[_0x713f('0x1f')][_0x713f('0x2b')];_0x56a98f[_0x713f('0x2c')]=_0x713f('0x2d')+_['replace'](_0x56a98f[_0x713f('0xf')],_0x713f('0x2e'),_0x713f('0x2f'))+_0x713f('0x30');_0x56a98f[_0x713f('0x31')]={'Auto-Submitted':_0x713f('0x32'),'X-Auto-Response-Suppress':'All','Precedence':_0x713f('0x33')};return mailRpc[_0x713f('0x34')](this['account'][_0x713f('0x35')],_0x56a98f)[_0x713f('0x36')](function(_0x58d994){logger[_0x713f('0x11')](_0x713f('0x37'),_0x3d9939);_0x56a98f[_0x713f('0x2b')]=_0x58d994['message'][_0x713f('0x2b')];return rpc[_0xe4dcdb+_0x713f('0x2a')]['create'](_0x56a98f);})['then'](function(_0x425259){logger['info'](_0x713f('0x12'),_0x3d9939,JSON['stringify'](_0x425259));})[_0x713f('0x38')](function(_0x4c5d10){logger['error'](_0x713f('0x39'),_0x3d9939,JSON[_0x713f('0x3a')](_0x4c5d10));})['finally'](function(){Promise[_0x713f('0x3b')]()[_0x713f('0x36')](function(){if(_0x4a4581[0x0]!=='2'||_0x1fdfd0[_0x713f('0x17')])return;return rpc[_0xe4dcdb+_0x713f('0x3c')][_0x713f('0x3d')](_0x1fdfd0['id'],{'autoreplyExecuted':!![]})[_0x713f('0x36')](function(_0x1980a1){logger[_0x713f('0x11')](_0x713f('0x18'),_0x3d9939,JSON['stringify'](_0x1980a1));})[_0x713f('0x38')](function(_0xc6846){logger[_0x713f('0x3e')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x3d9939,JSON['stringify'](_0xc6846));});})['then'](function(){_0xbec80a['next']();});});}else{return rpc[this['channel']+_0x713f('0x2a')][_0x713f('0x3f')](_0x56a98f)['then'](function(){logger[_0x713f('0x11')]('[%s][AUTOREPLY]\x20%s',_0x3d9939,_0x56a98f['body']);})['catch'](function(_0x257303){logger['error']('[%s][AUTOREPLY]\x20%s',_0x3d9939,JSON[_0x713f('0x3a')](_0x257303));})[_0x713f('0x40')](function(){Promise[_0x713f('0x3b')]()['then'](function(){if(_0x4a4581[0x0]!=='2'||_0x1fdfd0['autoreplyExecuted'])return;return rpc[_0xe4dcdb+_0x713f('0x3c')][_0x713f('0x3d')](_0x1fdfd0['id'],{'autoreplyExecuted':!![]})['then'](function(_0x457545){logger['info'](_0x713f('0x18'),_0x3d9939,JSON[_0x713f('0x3a')](_0x457545));})[_0x713f('0x38')](function(_0xd20b70){logger['error']('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x3d9939,JSON[_0x713f('0x3a')](_0xd20b70));});})[_0x713f('0x36')](function(){_0xbec80a[_0x713f('0x13')]();});});}}}catch(_0x531e6e){logger[_0x713f('0x3e')]('[%s][AUTOREPLY]\x20%s',_0x3d9939,JSON['stringify'](_0x531e6e));_0xbec80a[_0x713f('0x41')]();}};}; \ 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 e1633f7..5227423 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 _0xfd46=['YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','interaction','error','stringify','finally','stop','moment','../../../../config/logger','routing','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','[%s][CLOSE]\x20reason\x20%s'];(function(_0x1797d2,_0x3193bc){var _0x7a54d4=function(_0x50a9f8){while(--_0x50a9f8){_0x1797d2['push'](_0x1797d2['shift']());}};_0x7a54d4(++_0x3193bc);}(_0xfd46,0x1e9));var _0x6fd4=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xfd46[_0x3bf83f];return _0x22c4a9;};'use strict';var moment=require(_0x6fd4('0x0'));var logger=require(_0x6fd4('0x1'))(_0x6fd4('0x2'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x6fd4('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x6fd4('0x4')),'faxInteraction':require(_0x6fd4('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports['consequence']=function(_0x44ab77,_0x456684,_0x268565,_0x57a957){return function(_0x34f60f){try{logger['info'](_0x6fd4('0x6'),_0x44ab77,_0x456684[0x0]);var _0x4fbfc4={'closed':0x1,'closedAt':moment()['format'](_0x6fd4('0x7')),'closeReason':_0x6fd4('0x8'),'disposition':_0x456684[0x0]};if(rpc[_0x57a957[_0x6fd4('0x9')]+_0x6fd4('0xa')]){rpc[_0x57a957['channel']+_0x6fd4('0xa')]['update'](_0x57a957[_0x6fd4('0xb')]['id'],_0x4fbfc4)['then'](function(_0x3aae3d){logger['info']('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x44ab77,_0x57a957[_0x6fd4('0xb')]['id']);})['catch'](function(_0x2cfc99){logger[_0x6fd4('0xc')]('[%s][CLOSE]\x20%s',_0x44ab77,JSON[_0x6fd4('0xd')](_0x2cfc99));})[_0x6fd4('0xe')](function(){_0x34f60f['stop']();});}}catch(_0x573460){logger[_0x6fd4('0xc')]('[%s][CLOSE]\x20%s',_0x44ab77,JSON[_0x6fd4('0xd')](_0x573460));_0x34f60f[_0x6fd4('0xf')]();}};}; \ No newline at end of file +var _0x33cb=['error','[%s][CLOSE]\x20%s','stop','moment','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','Interaction','channel','update','interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','stringify'];(function(_0x1812d1,_0x58ba47){var _0x2d31ff=function(_0x131909){while(--_0x131909){_0x1812d1['push'](_0x1812d1['shift']());}};_0x2d31ff(++_0x58ba47);}(_0x33cb,0xff));var _0xb33c=function(_0x4d0b5c,_0x53bdb9){_0x4d0b5c=_0x4d0b5c-0x0;var _0x1ae8ac=_0x33cb[_0x4d0b5c];return _0x1ae8ac;};'use strict';var moment=require(_0xb33c('0x0'));var logger=require('../../../../config/logger')('routing');var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xb33c('0x1')),'smsInteraction':require(_0xb33c('0x2')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xb33c('0x3')),'whatsappInteraction':require(_0xb33c('0x4'))};exports[_0xb33c('0x5')]=function(_0x4771bf,_0x4faa35,_0x3a422b,_0x238340){return function(_0x1458fe){try{logger[_0xb33c('0x6')](_0xb33c('0x7'),_0x4771bf,_0x4faa35[0x0]);var _0x359921={'closed':0x1,'closedAt':moment()[_0xb33c('0x8')](_0xb33c('0x9')),'closeReason':_0xb33c('0xa'),'disposition':_0x4faa35[0x0]};if(rpc[_0x238340['channel']+_0xb33c('0xb')]){rpc[_0x238340[_0xb33c('0xc')]+'Interaction'][_0xb33c('0xd')](_0x238340[_0xb33c('0xe')]['id'],_0x359921)['then'](function(_0x377428){logger[_0xb33c('0x6')](_0xb33c('0xf'),_0x4771bf,_0x238340[_0xb33c('0xe')]['id']);})[_0xb33c('0x10')](function(_0x491f1c){logger['error']('[%s][CLOSE]\x20%s',_0x4771bf,JSON[_0xb33c('0x11')](_0x491f1c));})['finally'](function(){_0x1458fe['stop']();});}}catch(_0x4ac44b){logger[_0xb33c('0x12')](_0xb33c('0x13'),_0x4771bf,JSON[_0xb33c('0x11')](_0x4ac44b));_0x1458fe[_0xb33c('0x14')]();}};}; \ 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 1fe70f5..017ee50 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 _0x30bc=['interaction','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','ChatWebsiteId','account','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','[%s][DIALOGFLOW]\x20%s','catch','error','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','dialogflow','result','fulfillment','speech','providerResponse','stringify','metadata','message','lodash','moment','apiai-promise','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil'];(function(_0x43fdf8,_0x8426b3){var _0x1160c6=function(_0x281fb6){while(--_0x281fb6){_0x43fdf8['push'](_0x43fdf8['shift']());}};_0x1160c6(++_0x8426b3);}(_0x30bc,0x149));var _0xc30b=function(_0xeb254a,_0x1c1fc9){_0xeb254a=_0xeb254a-0x0;var _0x78e431=_0x30bc[_0xeb254a];return _0x78e431;};'use strict';var _=require(_0xc30b('0x0'));var moment=require(_0xc30b('0x1'));var apiai=require(_0xc30b('0x2'));var md5=require('md5');var utils=require(_0xc30b('0x3'));var logger=require(_0xc30b('0x4'))(_0xc30b('0x5'));var rpc={'chatMessage':require(_0xc30b('0x6')),'openchannelMessage':require(_0xc30b('0x7')),'mailMessage':require(_0xc30b('0x8')),'smsMessage':require(_0xc30b('0x9')),'faxMessage':require(_0xc30b('0xa')),'whatsappMessage':require(_0xc30b('0xb'))};exports[_0xc30b('0xc')]=function(_0x5dff10,_0x2f7826){return function(_0x1aca07){try{if(!_[_0xc30b('0xd')](this[_0xc30b('0xe')]['UserId'])){logger[_0xc30b('0xf')]('[%s][DIALOGFLOW]\x20%s',_0x5dff10,_0xc30b('0x10'));return _0x1aca07[_0xc30b('0x11')]();}var _0x5384a2={'ContactId':this['contact']['id'],'sentAt':moment()[_0xc30b('0x12')](_0xc30b('0x13')),'direction':_0xc30b('0x14')};if(this[_0xc30b('0x15')]===_0xc30b('0x16')||this[_0xc30b('0x15')]==='whatsapp'){_0x5384a2[_0xc30b('0x17')]=this[_0xc30b('0xe')]['phone'];}var _0x15b529=this[_0xc30b('0x15')];if(_0x15b529==='chat'){_0x5384a2[_0xc30b('0x18')]=this['account']['id'];}else{_0x5384a2[_['upperFirst'](_0x15b529)+'AccountId']=this[_0xc30b('0x19')]['id'];}_0x5384a2[_['upperFirst'](_0x15b529)+_0xc30b('0x1a')]=this[_0xc30b('0xe')]['id'];if(this[_0xc30b('0xe')][_0xc30b('0x1b')]){var _0x4e5193=_0x2f7826[0x2];if(!_[_0xc30b('0x1c')](_0x4e5193)){_0x5384a2[_0xc30b('0x1d')]=utils[_0xc30b('0x1e')](_0x4e5193,this);return rpc[_0x15b529+_0xc30b('0x1f')][_0xc30b('0x20')](_0x5384a2)[_0xc30b('0x21')](function(_0x5b4345){logger[_0xc30b('0xf')](_0xc30b('0x22'),_0x5dff10,_0x5384a2[_0xc30b('0x1d')]);})[_0xc30b('0x23')](function(_0x44aa06){logger[_0xc30b('0x24')](_0xc30b('0x22'),_0x5dff10,JSON['stringify'](_0x44aa06));})[_0xc30b('0x25')](function(){logger['info'](_0xc30b('0x26'),_0x5dff10);_0x1aca07[_0xc30b('0x27')]();});}else{logger[_0xc30b('0xf')](_0xc30b('0x28'),_0x5dff10);_0x1aca07['stop']();}}else{var _0x1ed77f=this;var _0x34bc55=apiai(_0x2f7826[0x0],{'language':_0x2f7826[0x1]||'en'});return _0x34bc55['textRequest'](this['message'][_0xc30b('0x1d')],{'sessionId':md5(this['interaction']['id'])})['then'](function(_0x1f415a){_0x1ed77f[_0xc30b('0x1d')][_0xc30b('0x29')]=_0x1f415a;_0x5384a2['body']=_0x1f415a[_0xc30b('0x2a')][_0xc30b('0x2b')][_0xc30b('0x2c')];_0x5384a2['providerName']=_0xc30b('0x29');_0x5384a2[_0xc30b('0x2d')]=JSON[_0xc30b('0x2e')](_0x1f415a);return rpc[_0x15b529+_0xc30b('0x1f')][_0xc30b('0x20')](_0x5384a2)[_0xc30b('0x21')](function(_0x56c8fe){logger[_0xc30b('0xf')](_0xc30b('0x22'),_0x5dff10,_0x5384a2['body']);if(_0x1f415a['result'][_0xc30b('0x2f')]['endConversation']){_0x1aca07['next']();}else{_0x1aca07[_0xc30b('0x27')]();}})['catch'](function(_0x2392ab){logger[_0xc30b('0x24')](_0xc30b('0x22'),_0x5dff10,JSON[_0xc30b('0x2e')](_0x2392ab));_0x1aca07['next']();});})[_0xc30b('0x23')](function(_0x109693){logger[_0xc30b('0x24')](_0xc30b('0x22'),_0x5dff10,_0x109693[_0xc30b('0x30')]);_0x1aca07['next']();});}}catch(_0x3f621b){logger[_0xc30b('0x24')](_0xc30b('0x22'),_0x5dff10,JSON[_0xc30b('0x2e')](_0x3f621b));_0x1aca07[_0xc30b('0x27')]();}};}; \ No newline at end of file +var _0xee3c=['../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','upperFirst','AccountId','InteractionId','isEmpty','getMustacheRender','Message','create','then','body','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','result','providerName','providerResponse','endConversation','next','message','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger'];(function(_0x40dd74,_0x5c068c){var _0x38db0d=function(_0x5aa44f){while(--_0x5aa44f){_0x40dd74['push'](_0x40dd74['shift']());}};_0x38db0d(++_0x5c068c);}(_0xee3c,0x14a));var _0xcee3=function(_0x218e80,_0x2c74ca){_0x218e80=_0x218e80-0x0;var _0x3e7848=_0xee3c[_0x218e80];return _0x3e7848;};'use strict';var _=require(_0xcee3('0x0'));var moment=require(_0xcee3('0x1'));var apiai=require(_0xcee3('0x2'));var md5=require(_0xcee3('0x3'));var utils=require(_0xcee3('0x4'));var logger=require(_0xcee3('0x5'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xcee3('0x6')),'mailMessage':require(_0xcee3('0x7')),'smsMessage':require(_0xcee3('0x8')),'faxMessage':require(_0xcee3('0x9')),'whatsappMessage':require(_0xcee3('0xa'))};exports[_0xcee3('0xb')]=function(_0x3b8ffe,_0x97f00e){return function(_0x22953c){try{if(!_[_0xcee3('0xc')](this[_0xcee3('0xd')][_0xcee3('0xe')])){logger[_0xcee3('0xf')](_0xcee3('0x10'),_0x3b8ffe,_0xcee3('0x11'));return _0x22953c['next']();}var _0x1ed6a6={'ContactId':this[_0xcee3('0x12')]['id'],'sentAt':moment()[_0xcee3('0x13')](_0xcee3('0x14')),'direction':_0xcee3('0x15')};if(this[_0xcee3('0x16')]==='sms'||this[_0xcee3('0x16')]===_0xcee3('0x17')){_0x1ed6a6[_0xcee3('0x18')]=this[_0xcee3('0xd')][_0xcee3('0x18')];}var _0x520ac6=this[_0xcee3('0x16')];if(_0x520ac6==='chat'){_0x1ed6a6['ChatWebsiteId']=this['account']['id'];}else{_0x1ed6a6[_[_0xcee3('0x19')](_0x520ac6)+_0xcee3('0x1a')]=this['account']['id'];}_0x1ed6a6[_['upperFirst'](_0x520ac6)+_0xcee3('0x1b')]=this['interaction']['id'];if(this[_0xcee3('0xd')]['created']){var _0x3471d1=_0x97f00e[0x2];if(!_[_0xcee3('0x1c')](_0x3471d1)){_0x1ed6a6['body']=utils[_0xcee3('0x1d')](_0x3471d1,this);return rpc[_0x520ac6+_0xcee3('0x1e')][_0xcee3('0x1f')](_0x1ed6a6)[_0xcee3('0x20')](function(_0x50bf6e){logger[_0xcee3('0xf')](_0xcee3('0x10'),_0x3b8ffe,_0x1ed6a6[_0xcee3('0x21')]);})[_0xcee3('0x22')](function(_0x52f4d7){logger[_0xcee3('0x23')](_0xcee3('0x10'),_0x3b8ffe,JSON[_0xcee3('0x24')](_0x52f4d7));})[_0xcee3('0x25')](function(){logger[_0xcee3('0xf')](_0xcee3('0x26'),_0x3b8ffe);_0x22953c[_0xcee3('0x27')]();});}else{logger[_0xcee3('0xf')](_0xcee3('0x28'),_0x3b8ffe);_0x22953c[_0xcee3('0x27')]();}}else{var _0x40dd10=this;var _0xa1efbf=apiai(_0x97f00e[0x0],{'language':_0x97f00e[0x1]||'en'});return _0xa1efbf[_0xcee3('0x29')](this['message'][_0xcee3('0x21')],{'sessionId':md5(this[_0xcee3('0xd')]['id'])})[_0xcee3('0x20')](function(_0x1ee247){_0x40dd10[_0xcee3('0x21')]['dialogflow']=_0x1ee247;_0x1ed6a6['body']=_0x1ee247[_0xcee3('0x2a')]['fulfillment']['speech'];_0x1ed6a6[_0xcee3('0x2b')]='dialogflow';_0x1ed6a6[_0xcee3('0x2c')]=JSON[_0xcee3('0x24')](_0x1ee247);return rpc[_0x520ac6+_0xcee3('0x1e')]['create'](_0x1ed6a6)[_0xcee3('0x20')](function(_0x47f32c){logger[_0xcee3('0xf')]('[%s][DIALOGFLOW]\x20%s',_0x3b8ffe,_0x1ed6a6[_0xcee3('0x21')]);if(_0x1ee247[_0xcee3('0x2a')]['metadata'][_0xcee3('0x2d')]){_0x22953c[_0xcee3('0x2e')]();}else{_0x22953c['stop']();}})[_0xcee3('0x22')](function(_0x4ef9da){logger['error'](_0xcee3('0x10'),_0x3b8ffe,JSON['stringify'](_0x4ef9da));_0x22953c[_0xcee3('0x2e')]();});})[_0xcee3('0x22')](function(_0x375cab){logger[_0xcee3('0x23')](_0xcee3('0x10'),_0x3b8ffe,_0x375cab[_0xcee3('0x2f')]);_0x22953c[_0xcee3('0x2e')]();});}}catch(_0x5ce5be){logger[_0xcee3('0x23')]('[%s][DIALOGFLOW]\x20%s',_0x3b8ffe,JSON[_0xcee3('0x24')](_0x5ce5be));_0x22953c[_0xcee3('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 0949000..09e1695 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 _0xd9cb=['stop','replace','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','fulfillmentText','push','all','next','lodash','md5','moment','bluebird','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','clone','Message','info','[%s][DIALOGFLOWV2]\x20%s','body','catch','error','stringify','isNil','interaction','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','created','isEmpty','then','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!'];(function(_0x164df2,_0x4083ee){var _0x4abfa1=function(_0x226c9b){while(--_0x226c9b){_0x164df2['push'](_0x164df2['shift']());}};_0x4abfa1(++_0x4083ee);}(_0xd9cb,0x68));var _0xbd9c=function(_0x383322,_0x303b24){_0x383322=_0x383322-0x0;var _0x382150=_0xd9cb[_0x383322];return _0x382150;};'use strict';var _=require(_0xbd9c('0x0'));var dialogflow=require('dialogflow');var md5=require(_0xbd9c('0x1'));var moment=require(_0xbd9c('0x2'));var Promise=require(_0xbd9c('0x3'));var logger=require('../../../../config/logger')(_0xbd9c('0x4'));var utils=require('./utils');var rpc={'chatMessage':require(_0xbd9c('0x5')),'openchannelMessage':require(_0xbd9c('0x6')),'mailMessage':require(_0xbd9c('0x7')),'smsMessage':require(_0xbd9c('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xbd9c('0x9'))};function createMessage(_0x1741e8,_0x58bda4,_0x3f164d,_0x1d0814){return new Promise(function(_0x110721,_0x81d1fe){var _0x340ad0=_[_0xbd9c('0xa')](_0x3f164d);_0x340ad0['body']=_0x1d0814;return rpc[_0x58bda4+_0xbd9c('0xb')]['create'](_0x340ad0)['then'](function(){logger[_0xbd9c('0xc')](_0xbd9c('0xd'),_0x1741e8,_0x340ad0[_0xbd9c('0xe')]);_0x110721();})[_0xbd9c('0xf')](function(_0x298eee){logger[_0xbd9c('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x1741e8,JSON[_0xbd9c('0x11')](_0x298eee));_0x81d1fe(_0x298eee);});});}exports['consequence']=function(_0x5cdc22,_0x3a2015){return function(_0x5485fc){try{if(!_[_0xbd9c('0x12')](this[_0xbd9c('0x13')]['UserId'])){logger['info'](_0xbd9c('0xd'),_0x5cdc22,_0xbd9c('0x14'));return _0x5485fc['next']();}var _0x5754a0={'ContactId':this['contact']['id'],'sentAt':moment()[_0xbd9c('0x15')](_0xbd9c('0x16')),'direction':_0xbd9c('0x17')};if(this['channel']===_0xbd9c('0x18')||this[_0xbd9c('0x19')]==='whatsapp'){_0x5754a0[_0xbd9c('0x1a')]=this[_0xbd9c('0x13')][_0xbd9c('0x1a')];}var _0x70ff9a=this[_0xbd9c('0x19')];if(_0x70ff9a===_0xbd9c('0x1b')){_0x5754a0[_0xbd9c('0x1c')]=this[_0xbd9c('0x1d')]['id'];}else{_0x5754a0[_[_0xbd9c('0x1e')](_0x70ff9a)+_0xbd9c('0x1f')]=this['account']['id'];}_0x5754a0[_[_0xbd9c('0x1e')](_0x70ff9a)+'InteractionId']=this[_0xbd9c('0x13')]['id'];if(this[_0xbd9c('0x13')][_0xbd9c('0x20')]){var _0x58755f=_0x3a2015[0x4];if(!_[_0xbd9c('0x21')](_0x58755f)){_0x5754a0[_0xbd9c('0xe')]=utils['getMustacheRender'](_0x58755f,this);return rpc[_0x70ff9a+_0xbd9c('0xb')]['create'](_0x5754a0)[_0xbd9c('0x22')](function(_0x398d50){logger[_0xbd9c('0xc')](_0xbd9c('0xd'),_0x5cdc22,_0x5754a0[_0xbd9c('0xe')]);})[_0xbd9c('0xf')](function(_0x1a742c){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x5cdc22,JSON['stringify'](_0x1a742c));})[_0xbd9c('0x23')](function(){logger[_0xbd9c('0xc')](_0xbd9c('0x24'),_0x5cdc22);_0x5485fc['stop']();});}else{logger[_0xbd9c('0xc')](_0xbd9c('0x25'),_0x5cdc22);_0x5485fc[_0xbd9c('0x26')]();}}else{var _0x47a573=this;var _0x126e3b=_0x3a2015[0x2][_0xbd9c('0x27')](/\\n/g,'\x0a');var _0x554a4c={'credentials':{'private_key':_0x126e3b,'client_email':_0x3a2015[0x1]}};var _0x2f8020=new dialogflow['SessionsClient'](_0x554a4c);var _0x5d8863=_0x2f8020['sessionPath'](_0x3a2015[0x0],md5(_0x47a573[_0xbd9c('0x13')]['id']));var _0x2f685d={'session':_0x5d8863,'queryInput':{'text':{'text':_0x47a573[_0xbd9c('0x28')][_0xbd9c('0xe')],'languageCode':_0x3a2015[0x3]||'en'}}};return _0x2f8020[_0xbd9c('0x29')](_0x2f685d)[_0xbd9c('0x22')](function(_0x4ffe81){if(_0x4ffe81&&_0x4ffe81[_0xbd9c('0x2a')]){_0x47a573['body'][_0xbd9c('0x2b')]=_0x4ffe81;var _0x38fccb=_0x4ffe81[0x0];var _0x4ee247=_0x38fccb[_0xbd9c('0x2c')][_0xbd9c('0x2d')]&&_0x38fccb[_0xbd9c('0x2c')][_0xbd9c('0x2d')]['fields']?_0x38fccb[_0xbd9c('0x2c')]['diagnosticInfo'][_0xbd9c('0x2e')][_0xbd9c('0x2f')][_0xbd9c('0x30')]:![];_0x47a573[_0xbd9c('0xe')][_0xbd9c('0x31')]=_0x38fccb[_0xbd9c('0x2c')][_0xbd9c('0x32')];_0x47a573['body'][_0xbd9c('0x33')]=_0x38fccb[_0xbd9c('0x2c')][_0xbd9c('0x34')];_0x47a573[_0xbd9c('0xe')][_0xbd9c('0x35')]=_0x38fccb['queryResult']['diagnosticInfo']&&_0x38fccb[_0xbd9c('0x2c')][_0xbd9c('0x2d')]['fields']?_0x38fccb[_0xbd9c('0x2c')][_0xbd9c('0x2d')][_0xbd9c('0x2e')]['end_conversation']['boolValue']:![];_0x47a573[_0xbd9c('0xe')]['DIALOGFLOWV2_INTENTNAME']=_0x38fccb[_0xbd9c('0x2c')][_0xbd9c('0x36')][_0xbd9c('0x37')];_0x47a573[_0xbd9c('0xe')][_0xbd9c('0x38')]=_0x38fccb['queryResult'][_0xbd9c('0x36')][_0xbd9c('0x39')];_0x47a573[_0xbd9c('0xe')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x38fccb[_0xbd9c('0x2c')][_0xbd9c('0x36')][_0xbd9c('0x3a')];_0x47a573[_0xbd9c('0xe')][_0xbd9c('0x3b')]=_0x38fccb[_0xbd9c('0x2c')][_0xbd9c('0x3c')];_0x47a573['body'][_0xbd9c('0x3d')]=_0x38fccb['queryResult'][_0xbd9c('0x3e')];_0x47a573[_0xbd9c('0xe')][_0xbd9c('0x3f')]=_0x38fccb[_0xbd9c('0x2c')][_0xbd9c('0x40')];_0x5754a0[_0xbd9c('0x41')]=_0xbd9c('0x2b');_0x5754a0[_0xbd9c('0x42')]=JSON[_0xbd9c('0x11')](_0x4ffe81);var _0x14ac8c=[];for(var _0x33c4e3=0x0;_0x33c4e3<_0x4ffe81[_0xbd9c('0x2a')];_0x33c4e3++){var _0x3db4af=_0x4ffe81[_0x33c4e3];if(_0x3db4af&&_0x3db4af['queryResult']&&_0x3db4af[_0xbd9c('0x2c')][_0xbd9c('0x43')]){_0x14ac8c[_0xbd9c('0x44')](createMessage(_0x5cdc22,_0x70ff9a,_0x5754a0,_0x3db4af[_0xbd9c('0x2c')][_0xbd9c('0x43')]));}}return Promise[_0xbd9c('0x45')](_0x14ac8c)[_0xbd9c('0x22')](function(){if(_0x4ee247){_0x5485fc['next']();}else{_0x5485fc[_0xbd9c('0x26')]();}})['catch'](function(_0x3adc16){logger[_0xbd9c('0x10')](_0xbd9c('0xd'),_0x5cdc22,JSON[_0xbd9c('0x11')](_0x3adc16));_0x5485fc['next']();});}})[_0xbd9c('0xf')](function(_0x362077){logger[_0xbd9c('0x10')](_0xbd9c('0xd'),_0x5cdc22,_0x362077[_0xbd9c('0x28')],_0x362077['stack']);_0x5485fc[_0xbd9c('0x46')]();});}}catch(_0x1ca2a2){logger[_0xbd9c('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x5cdc22,JSON['stringify'](_0x1ca2a2));_0x5485fc[_0xbd9c('0x26')]();}};}; \ No newline at end of file +var _0xf347=['diagnosticInfo','queryResult','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','name','intent','displayName','isFallback','DIALOGFLOWV2_LANGUAGECODE','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerResponse','fulfillmentText','push','next','message','lodash','dialogflow','md5','moment','bluebird','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','stringify','consequence','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','error','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','sessionPath','detectIntent','length','dialogflowV2'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xf347,0xee));var _0x7f34=function(_0x2af935,_0x3a64ca){_0x2af935=_0x2af935-0x0;var _0xa1c210=_0xf347[_0x2af935];return _0xa1c210;};'use strict';var _=require(_0x7f34('0x0'));var dialogflow=require(_0x7f34('0x1'));var md5=require(_0x7f34('0x2'));var moment=require(_0x7f34('0x3'));var Promise=require(_0x7f34('0x4'));var logger=require(_0x7f34('0x5'))(_0x7f34('0x6'));var utils=require('./utils');var rpc={'chatMessage':require(_0x7f34('0x7')),'openchannelMessage':require(_0x7f34('0x8')),'mailMessage':require(_0x7f34('0x9')),'smsMessage':require(_0x7f34('0xa')),'faxMessage':require(_0x7f34('0xb')),'whatsappMessage':require(_0x7f34('0xc'))};function createMessage(_0x579bcd,_0x1524e8,_0x1290f4,_0x46e11e){return new Promise(function(_0x1a4d44,_0x39adf1){var _0xfa1092=_[_0x7f34('0xd')](_0x1290f4);_0xfa1092['body']=_0x46e11e;return rpc[_0x1524e8+_0x7f34('0xe')][_0x7f34('0xf')](_0xfa1092)[_0x7f34('0x10')](function(){logger[_0x7f34('0x11')](_0x7f34('0x12'),_0x579bcd,_0xfa1092['body']);_0x1a4d44();})[_0x7f34('0x13')](function(_0x4b6ebe){logger['error'](_0x7f34('0x12'),_0x579bcd,JSON[_0x7f34('0x14')](_0x4b6ebe));_0x39adf1(_0x4b6ebe);});});}exports[_0x7f34('0x15')]=function(_0x3ab27d,_0x519194){return function(_0x3111eb){try{if(!_['isNil'](this[_0x7f34('0x16')][_0x7f34('0x17')])){logger[_0x7f34('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x3ab27d,_0x7f34('0x18'));return _0x3111eb['next']();}var _0x253972={'ContactId':this[_0x7f34('0x19')]['id'],'sentAt':moment()['format'](_0x7f34('0x1a')),'direction':_0x7f34('0x1b')};if(this[_0x7f34('0x1c')]===_0x7f34('0x1d')||this[_0x7f34('0x1c')]===_0x7f34('0x1e')){_0x253972[_0x7f34('0x1f')]=this[_0x7f34('0x16')][_0x7f34('0x1f')];}var _0x2820a9=this[_0x7f34('0x1c')];if(_0x2820a9===_0x7f34('0x20')){_0x253972[_0x7f34('0x21')]=this[_0x7f34('0x22')]['id'];}else{_0x253972[_[_0x7f34('0x23')](_0x2820a9)+_0x7f34('0x24')]=this['account']['id'];}_0x253972[_[_0x7f34('0x23')](_0x2820a9)+_0x7f34('0x25')]=this[_0x7f34('0x16')]['id'];if(this['interaction'][_0x7f34('0x26')]){var _0x235370=_0x519194[0x4];if(!_[_0x7f34('0x27')](_0x235370)){_0x253972[_0x7f34('0x28')]=utils[_0x7f34('0x29')](_0x235370,this);return rpc[_0x2820a9+'Message'][_0x7f34('0xf')](_0x253972)[_0x7f34('0x10')](function(_0x1b69f7){logger[_0x7f34('0x11')](_0x7f34('0x12'),_0x3ab27d,_0x253972['body']);})[_0x7f34('0x13')](function(_0xb9c7a6){logger[_0x7f34('0x2a')]('[%s][DIALOGFLOWV2]\x20%s',_0x3ab27d,JSON[_0x7f34('0x14')](_0xb9c7a6));})['finally'](function(){logger[_0x7f34('0x11')](_0x7f34('0x2b'),_0x3ab27d);_0x3111eb[_0x7f34('0x2c')]();});}else{logger[_0x7f34('0x11')](_0x7f34('0x2d'),_0x3ab27d);_0x3111eb[_0x7f34('0x2c')]();}}else{var _0x4b82e5=this;var _0x20a57e=_0x519194[0x2]['replace'](/\\n/g,'\x0a');var _0x3a018a={'credentials':{'private_key':_0x20a57e,'client_email':_0x519194[0x1]}};var _0x2e6604=new dialogflow['SessionsClient'](_0x3a018a);var _0x3ed7a2=_0x2e6604[_0x7f34('0x2e')](_0x519194[0x0],md5(_0x4b82e5['interaction']['id']));var _0x41318c={'session':_0x3ed7a2,'queryInput':{'text':{'text':_0x4b82e5['message']['body'],'languageCode':_0x519194[0x3]||'en'}}};return _0x2e6604[_0x7f34('0x2f')](_0x41318c)[_0x7f34('0x10')](function(_0x1f1c12){if(_0x1f1c12&&_0x1f1c12[_0x7f34('0x30')]){_0x4b82e5[_0x7f34('0x28')][_0x7f34('0x31')]=_0x1f1c12;var _0x338e8c=_0x1f1c12[0x0];var _0x484308=_0x338e8c['queryResult'][_0x7f34('0x32')]&&_0x338e8c[_0x7f34('0x33')][_0x7f34('0x32')][_0x7f34('0x34')]?_0x338e8c[_0x7f34('0x33')]['diagnosticInfo'][_0x7f34('0x34')][_0x7f34('0x35')][_0x7f34('0x36')]:![];_0x4b82e5[_0x7f34('0x28')][_0x7f34('0x37')]=_0x338e8c[_0x7f34('0x33')][_0x7f34('0x38')];_0x4b82e5[_0x7f34('0x28')][_0x7f34('0x39')]=_0x338e8c[_0x7f34('0x33')][_0x7f34('0x3a')];_0x4b82e5[_0x7f34('0x28')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x338e8c[_0x7f34('0x33')][_0x7f34('0x32')]&&_0x338e8c[_0x7f34('0x33')][_0x7f34('0x32')][_0x7f34('0x34')]?_0x338e8c['queryResult']['diagnosticInfo']['fields'][_0x7f34('0x35')][_0x7f34('0x36')]:![];_0x4b82e5[_0x7f34('0x28')]['DIALOGFLOWV2_INTENTNAME']=_0x338e8c['queryResult']['intent'][_0x7f34('0x3b')];_0x4b82e5[_0x7f34('0x28')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x338e8c['queryResult'][_0x7f34('0x3c')][_0x7f34('0x3d')];_0x4b82e5[_0x7f34('0x28')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x338e8c['queryResult'][_0x7f34('0x3c')][_0x7f34('0x3e')];_0x4b82e5[_0x7f34('0x28')][_0x7f34('0x3f')]=_0x338e8c[_0x7f34('0x33')]['languageCode'];_0x4b82e5[_0x7f34('0x28')]['DIALOGFLOWV2_QUERYTEXT']=_0x338e8c[_0x7f34('0x33')][_0x7f34('0x40')];_0x4b82e5['body'][_0x7f34('0x41')]=_0x338e8c[_0x7f34('0x33')][_0x7f34('0x42')];_0x253972['providerName']=_0x7f34('0x31');_0x253972[_0x7f34('0x43')]=JSON[_0x7f34('0x14')](_0x1f1c12);var _0x35b9b1=[];for(var _0x1f2204=0x0;_0x1f2204<_0x1f1c12[_0x7f34('0x30')];_0x1f2204++){var _0x2e16fb=_0x1f1c12[_0x1f2204];if(_0x2e16fb&&_0x2e16fb[_0x7f34('0x33')]&&_0x2e16fb[_0x7f34('0x33')][_0x7f34('0x44')]){_0x35b9b1[_0x7f34('0x45')](createMessage(_0x3ab27d,_0x2820a9,_0x253972,_0x2e16fb['queryResult'][_0x7f34('0x44')]));}}return Promise['all'](_0x35b9b1)[_0x7f34('0x10')](function(){if(_0x484308){_0x3111eb[_0x7f34('0x46')]();}else{_0x3111eb[_0x7f34('0x2c')]();}})[_0x7f34('0x13')](function(_0xdce599){logger[_0x7f34('0x2a')](_0x7f34('0x12'),_0x3ab27d,JSON[_0x7f34('0x14')](_0xdce599));_0x3111eb[_0x7f34('0x46')]();});}})['catch'](function(_0x16eeeb){logger['error'](_0x7f34('0x12'),_0x3ab27d,_0x16eeeb[_0x7f34('0x47')],_0x16eeeb['stack']);_0x3111eb[_0x7f34('0x46')]();});}}catch(_0x156404){logger[_0x7f34('0x2a')](_0x7f34('0x12'),_0x3ab27d,JSON[_0x7f34('0x14')](_0x156404));_0x3111eb[_0x7f34('0x2c')]();}};}; \ 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 752456a..46dbadf 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 _0xcad0=['[%s][GOTOIF]\x20eval\x20error:\x20%s','message','stringify','validate','lodash','html-to-text','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','error','[%s][GOTOIF]\x20%s','stop','condition','priorityTrue','priorityFalse','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'];(function(_0x37a7c6,_0x3a84b6){var _0x539905=function(_0xa00c20){while(--_0xa00c20){_0x37a7c6['push'](_0x37a7c6['shift']());}};_0x539905(++_0x3a84b6);}(_0xcad0,0x18b));var _0x0cad=function(_0x2695ab,_0x3f4b39){_0x2695ab=_0x2695ab-0x0;var _0x3eaf50=_0xcad0[_0x2695ab];return _0x3eaf50;};'use strict';var schema=require(_0x0cad('0x0'));var _=require(_0x0cad('0x1'));var htmlToText=require(_0x0cad('0x2'));var utils=require('./utils');var logger=require(_0x0cad('0x3'))(_0x0cad('0x4'));var gotoif=schema({'condition':{'type':_0x0cad('0x5'),'required':!![],'message':_0x0cad('0x6')},'priorityTrue':{'type':_0x0cad('0x7'),'message':_0x0cad('0x8')},'priorityFalse':{'type':_0x0cad('0x7'),'message':_0x0cad('0x9')}});exports[_0x0cad('0xa')]=function(_0x1751cc,_0x376231){return function(_0x2b49ab){try{var _0x5cb837={'condition':htmlToText[_0x0cad('0xb')](utils[_0x0cad('0xc')](_0x376231[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x376231[0x1],'priorityFalse':_0x376231[0x2]};var _0x450a5a=gotoif[_0x0cad('0x0')](_0x5cb837,{'typecast':!![]});if(_0x450a5a['length']){logger[_0x0cad('0xd')](_0x0cad('0xe'),_0x1751cc,_['map'](_0x450a5a,'message')['join'](',\x20'));_0x2b49ab[_0x0cad('0xf')]();}else{try{var _0x237aa1=eval('('+_0x5cb837[_0x0cad('0x10')]+')');var _0x26e46b=_0x237aa1?_0x5cb837[_0x0cad('0x11')]:_0x5cb837[_0x0cad('0x12')];logger[_0x0cad('0x13')](_0x0cad('0x14'),_0x1751cc,_0x5cb837[_0x0cad('0x10')],_0x237aa1,_0x26e46b||_0x0cad('0x15'));if(_0x26e46b){var _0x5c934b=_[_0x0cad('0x16')](_0x2b49ab[_0x0cad('0x17')](),{'p':_0x26e46b});if(_0x5c934b>=0x0){logger[_0x0cad('0x13')](_0x0cad('0x18'),_0x1751cc,_0x26e46b||_0x0cad('0x15'),_0x5c934b);_0x2b49ab[_0x0cad('0x15')](_0x5c934b);}else{logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x1751cc,_0x26e46b||'next');_0x2b49ab[_0x0cad('0xf')]();}}else{_0x2b49ab['next']();}}catch(_0x2705bb){logger[_0x0cad('0xd')](_0x0cad('0x19'),_0x1751cc,_0x2705bb[_0x0cad('0x1a')]);_0x2b49ab[_0x0cad('0xf')]();}}}catch(_0xbf54f5){logger[_0x0cad('0xd')](_0x0cad('0xe'),_0x1751cc,JSON[_0x0cad('0x1b')](_0xbf54f5));_0x2b49ab[_0x0cad('0xf')]();}};}; \ No newline at end of file +var _0x37f8=['fromString','replace','length','error','map','message','join','stop','condition','priorityTrue','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','info','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20%s','stringify','lodash','html-to-text','./utils','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x37f8,0xb3));var _0x837f=function(_0x2a7ed6,_0x4afd3a){_0x2a7ed6=_0x2a7ed6-0x0;var _0x4570b5=_0x37f8[_0x2a7ed6];return _0x4570b5;};'use strict';var schema=require('validate');var _=require(_0x837f('0x0'));var htmlToText=require(_0x837f('0x1'));var utils=require(_0x837f('0x2'));var logger=require('../../../../config/logger')(_0x837f('0x3'));var gotoif=schema({'condition':{'type':_0x837f('0x4'),'required':!![],'message':_0x837f('0x5')},'priorityTrue':{'type':_0x837f('0x6'),'message':_0x837f('0x7')},'priorityFalse':{'type':'number','message':_0x837f('0x8')}});exports[_0x837f('0x9')]=function(_0x27db0f,_0x38632f){return function(_0x46bff6){try{var _0x5650b3={'condition':htmlToText[_0x837f('0xa')](utils['getMustacheRender'](_0x38632f[0x0],this),{'wordwrap':![]})[_0x837f('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x38632f[0x1],'priorityFalse':_0x38632f[0x2]};var _0x1ac89c=gotoif['validate'](_0x5650b3,{'typecast':!![]});if(_0x1ac89c[_0x837f('0xc')]){logger[_0x837f('0xd')]('[%s][GOTOIF]\x20%s',_0x27db0f,_[_0x837f('0xe')](_0x1ac89c,_0x837f('0xf'))[_0x837f('0x10')](',\x20'));_0x46bff6[_0x837f('0x11')]();}else{try{var _0x5caa5f=eval('('+_0x5650b3[_0x837f('0x12')]+')');var _0x43cb01=_0x5caa5f?_0x5650b3[_0x837f('0x13')]:_0x5650b3['priorityFalse'];logger['info'](_0x837f('0x14'),_0x27db0f,_0x5650b3[_0x837f('0x12')],_0x5caa5f,_0x43cb01||_0x837f('0x15'));if(_0x43cb01){var _0x112506=_[_0x837f('0x16')](_0x46bff6['rules'](),{'p':_0x43cb01});if(_0x112506>=0x0){logger[_0x837f('0x17')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x27db0f,_0x43cb01||'next',_0x112506);_0x46bff6['next'](_0x112506);}else{logger['info'](_0x837f('0x18'),_0x27db0f,_0x43cb01||_0x837f('0x15'));_0x46bff6['stop']();}}else{_0x46bff6['next']();}}catch(_0x1adc29){logger['error']('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x27db0f,_0x1adc29[_0x837f('0xf')]);_0x46bff6[_0x837f('0x11')]();}}}catch(_0x57dfa6){logger[_0x837f('0xd')](_0x837f('0x19'),_0x27db0f,JSON[_0x837f('0x1a')](_0x57dfa6));_0x46bff6[_0x837f('0x11')]();}};}; \ 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 522438f..4ee9278 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 _0x20fa=['[%s][GOTOP]\x20priority\x20%s','priority','rules','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','[%s][GOTOP]\x20%s','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','map','message','join','stop','info'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x20fa,0x1d2));var _0xa20f=function(_0x70fd53,_0x2a95a6){_0x70fd53=_0x70fd53-0x0;var _0x4b71c5=_0x20fa[_0x70fd53];return _0x4b71c5;};'use strict';var schema=require(_0xa20f('0x0'));var _=require(_0xa20f('0x1'));var logger=require(_0xa20f('0x2'))(_0xa20f('0x3'));var gotop=schema({'priority':{'type':_0xa20f('0x4'),'required':!![],'message':_0xa20f('0x5')}});exports[_0xa20f('0x6')]=function(_0x2b7bfa,_0x67ed1b){return function(_0x104cf5){try{var _0x197232={'priority':_0x67ed1b[0x0]};var _0x2c4abd=gotop[_0xa20f('0x0')](_0x197232,{'typecast':!![]});if(_0x2c4abd[_0xa20f('0x7')]){logger[_0xa20f('0x8')]('[%s][GOTOP]\x20%s',_0x2b7bfa,_[_0xa20f('0x9')](_0x2c4abd,_0xa20f('0xa'))[_0xa20f('0xb')](',\x20'));_0x104cf5[_0xa20f('0xc')]();}else{logger[_0xa20f('0xd')](_0xa20f('0xe'),_0x2b7bfa,_0x197232[_0xa20f('0xf')]);if(_0x197232[_0xa20f('0xf')]){var _0x31648c=_['findIndex'](_0x104cf5[_0xa20f('0x10')](),{'p':_0x197232['priority']});if(_0x31648c>=0x0){logger[_0xa20f('0xd')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x2b7bfa,_0x197232[_0xa20f('0xf')]||_0xa20f('0x11'),_0x31648c);_0x104cf5[_0xa20f('0x11')](_0x31648c);}else{logger['info'](_0xa20f('0x12'),_0x2b7bfa,_0x197232[_0xa20f('0xf')]||'next');_0x104cf5['stop']();}}else{_0x104cf5[_0xa20f('0x11')]();}}}catch(_0x57f810){logger['error'](_0xa20f('0x13'),_0x2b7bfa,JSON['stringify'](_0x57f810));_0x104cf5[_0xa20f('0xc')]();}};}; \ No newline at end of file +var _0x03c2=['validate','length','error','message','join','stop','info','priority','findIndex','rules','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','lodash','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'];(function(_0x3ba01c,_0x29e86e){var _0x3f883d=function(_0x4a1e97){while(--_0x4a1e97){_0x3ba01c['push'](_0x3ba01c['shift']());}};_0x3f883d(++_0x29e86e);}(_0x03c2,0x150));var _0x203c=function(_0x28d8da,_0x1d1ead){_0x28d8da=_0x28d8da-0x0;var _0x3a09e8=_0x03c2[_0x28d8da];return _0x3a09e8;};'use strict';var schema=require('validate');var _=require(_0x203c('0x0'));var logger=require(_0x203c('0x1'))('routing');var gotop=schema({'priority':{'type':_0x203c('0x2'),'required':!![],'message':_0x203c('0x3')}});exports['consequence']=function(_0x294d19,_0x14a00b){return function(_0xdfbf00){try{var _0x7e7589={'priority':_0x14a00b[0x0]};var _0x43e1a1=gotop[_0x203c('0x4')](_0x7e7589,{'typecast':!![]});if(_0x43e1a1[_0x203c('0x5')]){logger[_0x203c('0x6')]('[%s][GOTOP]\x20%s',_0x294d19,_['map'](_0x43e1a1,_0x203c('0x7'))[_0x203c('0x8')](',\x20'));_0xdfbf00[_0x203c('0x9')]();}else{logger[_0x203c('0xa')]('[%s][GOTOP]\x20priority\x20%s',_0x294d19,_0x7e7589[_0x203c('0xb')]);if(_0x7e7589[_0x203c('0xb')]){var _0x274942=_[_0x203c('0xc')](_0xdfbf00[_0x203c('0xd')](),{'p':_0x7e7589[_0x203c('0xb')]});if(_0x274942>=0x0){logger[_0x203c('0xa')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x294d19,_0x7e7589['priority']||_0x203c('0xe'),_0x274942);_0xdfbf00[_0x203c('0xe')](_0x274942);}else{logger['info'](_0x203c('0xf'),_0x294d19,_0x7e7589[_0x203c('0xb')]||_0x203c('0xe'));_0xdfbf00['stop']();}}else{_0xdfbf00['next']();}}}catch(_0x38b099){logger[_0x203c('0x6')]('[%s][GOTOP]\x20%s',_0x294d19,JSON[_0x203c('0x10')](_0x38b099));_0xdfbf00[_0x203c('0x9')]();}};}; \ 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 071a881..1070579 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 _0xb58b=['../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch','error','./utils','../../../../config/logger','routing'];(function(_0x37e25c,_0x52ce25){var _0x274359=function(_0x181b85){while(--_0x181b85){_0x37e25c['push'](_0x37e25c['shift']());}};_0x274359(++_0x52ce25);}(_0xb58b,0x1f1));var _0xbb58=function(_0xc20e81,_0x24c45e){_0xc20e81=_0xc20e81-0x0;var _0x4ecea0=_0xb58b[_0xc20e81];return _0x4ecea0;};'use strict';var _=require('lodash');var utils=require(_0xbb58('0x0'));var logger=require(_0xbb58('0x1'))(_0xbb58('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xbb58('0x3')),'mailMessage':require(_0xbb58('0x4')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xbb58('0x5')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xbb58('0x6')]=function(_0x367b4f,_0x33fe85){return function(_0x5cf8b1){try{var _0x27cbda={'body':utils[_0xbb58('0x7')](_0x33fe85[0x0],this),'ContactId':this[_0xbb58('0x8')]['id']};if(this[_0xbb58('0x9')]===_0xbb58('0xa')){_0x27cbda[_0xbb58('0xb')]=this[_0xbb58('0xc')]['id'];}else{_0x27cbda[_[_0xbb58('0xd')](this[_0xbb58('0x9')])+_0xbb58('0xe')]=this[_0xbb58('0xc')]['id'];}_0x27cbda[_['upperFirst'](this[_0xbb58('0x9')])+'InteractionId']=this[_0xbb58('0xf')]['id'];if(rpc[this[_0xbb58('0x9')]+_0xbb58('0x10')]){return rpc[this[_0xbb58('0x9')]+'Message'][_0xbb58('0x11')](_0x27cbda)[_0xbb58('0x12')](function(_0x4cda21){logger[_0xbb58('0x13')](_0xbb58('0x14'),_0x367b4f,_0x27cbda[_0xbb58('0x15')]);_0x5cf8b1[_0xbb58('0x16')]();})[_0xbb58('0x17')](function(_0x58245f){logger[_0xbb58('0x18')](_0xbb58('0x14'),_0x367b4f,JSON['stringify'](_0x58245f));_0x5cf8b1['stop']();});}}catch(_0x33c20f){logger[_0xbb58('0x18')](_0xbb58('0x14'),_0x367b4f,JSON['stringify'](_0x33c20f));_0x5cf8b1['stop']();}};}; \ No newline at end of file +var _0x6002=['Message','info','[%s][MESSAGE]\x20%s','body','error','stop','stringify','lodash','./utils','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','ChatWebsiteId','account','upperFirst','channel','AccountId','InteractionId','interaction'];(function(_0x4bf054,_0x34a7d4){var _0x299937=function(_0x3a27a4){while(--_0x3a27a4){_0x4bf054['push'](_0x4bf054['shift']());}};_0x299937(++_0x34a7d4);}(_0x6002,0x103));var _0x2600=function(_0x1385bd,_0x1e5841){_0x1385bd=_0x1385bd-0x0;var _0x2cb8a1=_0x6002[_0x1385bd];return _0x2cb8a1;};'use strict';var _=require(_0x2600('0x0'));var utils=require(_0x2600('0x1'));var logger=require('../../../../config/logger')(_0x2600('0x2'));var rpc={'chatMessage':require(_0x2600('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x2600('0x4')),'smsMessage':require(_0x2600('0x5')),'faxMessage':require(_0x2600('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x595a8d,_0x233a38){return function(_0x16fa0e){try{var _0x557d06={'body':utils['getMustacheRender'](_0x233a38[0x0],this),'ContactId':this['contact']['id']};if(this['channel']==='chat'){_0x557d06[_0x2600('0x7')]=this[_0x2600('0x8')]['id'];}else{_0x557d06[_[_0x2600('0x9')](this[_0x2600('0xa')])+_0x2600('0xb')]=this[_0x2600('0x8')]['id'];}_0x557d06[_['upperFirst'](this[_0x2600('0xa')])+_0x2600('0xc')]=this[_0x2600('0xd')]['id'];if(rpc[this[_0x2600('0xa')]+_0x2600('0xe')]){return rpc[this['channel']+_0x2600('0xe')]['create'](_0x557d06)['then'](function(_0x1bb53c){logger[_0x2600('0xf')](_0x2600('0x10'),_0x595a8d,_0x557d06[_0x2600('0x11')]);_0x16fa0e['next']();})['catch'](function(_0x567da0){logger[_0x2600('0x12')](_0x2600('0x10'),_0x595a8d,JSON['stringify'](_0x567da0));_0x16fa0e[_0x2600('0x13')]();});}}catch(_0x2a502c){logger['error'](_0x2600('0x10'),_0x595a8d,JSON[_0x2600('0x14')](_0x2a502c));_0x16fa0e[_0x2600('0x13')]();}};}; \ 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 12c963f..c83df90 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 _0x3ec3=['getMustacheRender','next','stringify','stop','./utils','../../../../config/logger','routing','info','[%s][NOOP]\x20%s'];(function(_0x18c454,_0x503202){var _0x17ebc0=function(_0x852512){while(--_0x852512){_0x18c454['push'](_0x18c454['shift']());}};_0x17ebc0(++_0x503202);}(_0x3ec3,0x148));var _0x33ec=function(_0x3bfe11,_0x573678){_0x3bfe11=_0x3bfe11-0x0;var _0x19f6b2=_0x3ec3[_0x3bfe11];return _0x19f6b2;};'use strict';var utils=require(_0x33ec('0x0'));var logger=require(_0x33ec('0x1'))(_0x33ec('0x2'));exports['consequence']=function(_0xdcbc72,_0x530fd3){return function(_0x3b2a81){try{logger[_0x33ec('0x3')](_0x33ec('0x4'),_0xdcbc72,utils[_0x33ec('0x5')](_0x530fd3[0x0],this));_0x3b2a81[_0x33ec('0x6')]();}catch(_0x459a2c){logger['error'](_0x33ec('0x4'),_0xdcbc72,JSON[_0x33ec('0x7')](_0x459a2c));_0x3b2a81[_0x33ec('0x8')]();}};}; \ No newline at end of file +var _0x58e9=['stringify','./utils','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next'];(function(_0xafdc22,_0x3982f9){var _0x54756a=function(_0x4edc7c){while(--_0x4edc7c){_0xafdc22['push'](_0xafdc22['shift']());}};_0x54756a(++_0x3982f9);}(_0x58e9,0x1a8));var _0x958e=function(_0x5655b8,_0x52e7d6){_0x5655b8=_0x5655b8-0x0;var _0x37b4b5=_0x58e9[_0x5655b8];return _0x37b4b5;};'use strict';var utils=require(_0x958e('0x0'));var logger=require(_0x958e('0x1'))(_0x958e('0x2'));exports[_0x958e('0x3')]=function(_0x23cb1a,_0x4e1373){return function(_0x566cb0){try{logger[_0x958e('0x4')](_0x958e('0x5'),_0x23cb1a,utils[_0x958e('0x6')](_0x4e1373[0x0],this));_0x566cb0[_0x958e('0x7')]();}catch(_0x4b7596){logger['error'](_0x958e('0x5'),_0x23cb1a,JSON[_0x958e('0x8')](_0x4b7596));_0x566cb0['stop']();}};}; \ 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 426e33b..1d8e845 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 _0xb16d=['complete','[%s][QUEUE]\x20APPLICATION\x20END','close','strategy','rrmemory','beepall','log','validate','lodash','util','moment','ioredis','../../../../config/environment','routing','./strategy','redis','defaults','localhost','queue_id','from','joinAt','emit','clone','queue','account','push','capitalize','InteractionId','format','%sQueuesWaitingInteractions','pick','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel','QueueId','upperFirst','interaction','message','chat','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','info','update','update\x20queue\x20report','waiting','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','join','stop','find','Queues','createQueue','atimeout','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','rules'];(function(_0x45d64d,_0x3a8673){var _0x3911b9=function(_0x132ff7){while(--_0x132ff7){_0x45d64d['push'](_0x45d64d['shift']());}};_0x3911b9(++_0x3a8673);}(_0xb16d,0x147));var _0xdb16=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb16d[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0xdb16('0x0'));var _=require(_0xdb16('0x1'));var util=require(_0xdb16('0x2'));var seqqueue=require('seq-queue');var moment=require(_0xdb16('0x3'));var Redis=require(_0xdb16('0x4'));var config=require(_0xdb16('0x5'));var logger=require('../../../../config/logger')(_0xdb16('0x6'));var strategy=require(_0xdb16('0x7'));config[_0xdb16('0x8')]=_[_0xdb16('0x9')](config[_0xdb16('0x8')],{'host':_0xdb16('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xdb16('0x8')]));var attributes=['id',_0xdb16('0xb'),'account','queue',_0xdb16('0xc'),_0xdb16('0xd')];function emit(_0x2607cf,_0x23f22d,_0x9515ad){io['to'](_0x2607cf)[_0xdb16('0xe')](_0x23f22d,_0x9515ad);}function emitChannelQueueInteraction(_0x32b418,_0x260031,_0x3ea26d,_0x4bab7a,_0x319f3c,_0x481626,_0x3260c8,_0x46e9cf){var _0x58cb56=_[_0xdb16('0xf')](_0x3ea26d);_0x58cb56[_0xdb16('0xb')]=_0x46e9cf;_0x58cb56[_0xdb16('0x10')]=_0x260031;_0x58cb56[_0xdb16('0x11')]=_0x4bab7a;_0x58cb56['id']=_0x319f3c;if(_0x481626){attributes[_0xdb16('0x12')](_[_0xdb16('0x13')](_0x32b418)+_0xdb16('0x14'));_0x3260c8[util[_0xdb16('0x15')](_0xdb16('0x16'),_0x32b418)][_0x319f3c]=_[_0xdb16('0x17')](_0x58cb56,attributes);}else{delete _0x3260c8[util[_0xdb16('0x15')](_0xdb16('0x16'),_0x32b418)][_0x319f3c];}emit(util[_0xdb16('0x15')]('%s:queue:%s',_0x32b418,_0x260031),util['format'](_0xdb16('0x18'),_0x32b418,_0x481626?_0xdb16('0x19'):_0xdb16('0x1a')),_[_0xdb16('0x17')](_0x58cb56,attributes));}var rpc={'openchannelQueueReport':require(_0xdb16('0x1b')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0xdb16('0x1c')),'smsQueueReport':require(_0xdb16('0x1d')),'faxQueueReport':require(_0xdb16('0x1e')),'whatsappQueueReport':require(_0xdb16('0x1f'))};var queue=schema({'name':{'type':_0xdb16('0x20'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0xdb16('0x21')}});function startRouting(_0x7a4158,_0x5a85af,_0x5341ec,_0x637c0a){if(_0x7a4158&&_0x5a85af&&_0x5341ec){_0x5a85af['waiting']+=0x1;var _0x5818b8={'uniqueid':_0x7a4158,'from':_0x5341ec[_0xdb16('0x22')]?_0x5341ec[_0xdb16('0x22')][_0xdb16('0xc')]:'','joinAt':moment()['format'](_0xdb16('0x23')),'ContactId':_0x5341ec[_0xdb16('0x24')]?_0x5341ec['contact']['id']:null,'ListId':_0x5341ec[_0xdb16('0x25')]?_0x5341ec[_0xdb16('0x25')]['id']:null};_0x5818b8[_['upperFirst'](_0x5341ec[_0xdb16('0x26')])+_0xdb16('0x27')]=_0x5a85af['id']||null;_0x5818b8[_[_0xdb16('0x28')](_0x5341ec[_0xdb16('0x26')])+_0xdb16('0x14')]=_0x5341ec[_0xdb16('0x29')]?_0x5341ec[_0xdb16('0x29')]['id']:null;_0x5818b8[_[_0xdb16('0x28')](_0x5341ec[_0xdb16('0x26')])+'MessageId']=_0x5341ec[_0xdb16('0x2a')]?_0x5341ec[_0xdb16('0x2a')]['id']:null;_0x5818b8[_['upperFirst'](_0x5341ec['channel'])+(_0x5341ec['channel']!==_0xdb16('0x2b')?'AccountId':_0xdb16('0x2c'))]=_0x5341ec[_0xdb16('0x11')]?_0x5341ec['account']['id']:null;logger['info'](util['format'](_0xdb16('0x2d'),_0x7a4158,_0x5a85af[_0xdb16('0x2e')]));emitChannelQueueInteraction(_0x5341ec[_0xdb16('0x26')],_0x5a85af[_0xdb16('0x2e')],_0x5818b8,_0x5341ec[_0xdb16('0x11')][_0xdb16('0x2e')],_0x5341ec[_0xdb16('0x2a')]['id'],!![],_0x637c0a,_0x5a85af['id']);if(rpc[_0x5341ec[_0xdb16('0x26')]+_0xdb16('0x2f')]){return rpc[_0x5341ec['channel']+_0xdb16('0x2f')][_0xdb16('0x30')](_0x5818b8)[_0xdb16('0x31')](function(_0x20004b){logger[_0xdb16('0x32')](_0xdb16('0x33'));});}}}function stopRouting(_0x31b005,_0x3cc0a1,_0x2f3b9a,_0x37f469){if(_0x31b005&&_0x3cc0a1){_0x3cc0a1['waiting']-=0x1;var _0x25ad07={'leaveAt':moment()[_0xdb16('0x15')](_0xdb16('0x23')),'acceptAt':moment()[_0xdb16('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xdb16('0x34')};logger[_0xdb16('0x35')](util[_0xdb16('0x15')]('[%s][STOP:QUEUE][NAME:%s]',_0x31b005,_0x3cc0a1[_0xdb16('0x2e')]));emitChannelQueueInteraction(_0x2f3b9a['channel'],_0x3cc0a1['name'],_0x2f3b9a['body'],_0x2f3b9a[_0xdb16('0x11')][_0xdb16('0x2e')],_0x2f3b9a[_0xdb16('0x2a')]['id'],![],_0x37f469,_0x3cc0a1['id']);if(rpc[_0x2f3b9a[_0xdb16('0x26')]+_0xdb16('0x2f')]){return rpc[_0x2f3b9a[_0xdb16('0x26')]+'QueueReport'][_0xdb16('0x36')](_0x31b005,_0x25ad07)[_0xdb16('0x31')](function(_0x5c476e){logger[_0xdb16('0x32')](_0xdb16('0x37'));});}}}function endRouting(_0x17fff3,_0xdd7b5e,_0x19a857,_0x2b7836){if(_0x17fff3&&_0xdd7b5e){_0xdd7b5e[_0xdb16('0x38')]-=0x1;var _0x37eb98={'leaveAt':moment()['format'](_0xdb16('0x23')),'exitAt':moment()[_0xdb16('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xdb16('0x39')};logger[_0xdb16('0x35')](util['format'](_0xdb16('0x3a'),_0x17fff3,_0xdd7b5e[_0xdb16('0x2e')]));emitChannelQueueInteraction(_0x19a857['channel'],_0xdd7b5e[_0xdb16('0x2e')],_0x19a857[_0xdb16('0x22')],_0x19a857[_0xdb16('0x11')]['name'],_0x19a857[_0xdb16('0x2a')]['id'],![],_0x2b7836);if(rpc[_0x19a857[_0xdb16('0x26')]+_0xdb16('0x2f')]){return rpc[_0x19a857[_0xdb16('0x26')]+_0xdb16('0x2f')][_0xdb16('0x36')](_0x17fff3,_0x37eb98)[_0xdb16('0x31')](function(_0x5e4610){logger[_0xdb16('0x32')](_0xdb16('0x37'));});}}}function handleFindQueue(_0x3625c4){return function(_0x2e246f){return _0x2e246f[_0xdb16('0x2e')][_0xdb16('0x3b')]()===_0x3625c4[_0xdb16('0x3b')]();};}exports[_0xdb16('0x3c')]=function(_0x4305cb,_0x3ba8c1,_0xda0cc,_0x5d7f37){return function(_0xc5f023){try{var _0x55e600={'name':_0x3ba8c1[0x0],'timeout':_0x3ba8c1[0x1]};var _0xc3321d=queue['validate'](_0x55e600,{'typecast':!![]});if(_0xc3321d[_0xdb16('0x3d')]){logger['error'](_0xdb16('0x3e'),_0x4305cb,_['map'](_0xc3321d,_0xdb16('0x2a'))[_0xdb16('0x3f')](',\x20'));_0xc5f023[_0xdb16('0x40')]();}else{var _0x2fc2c3=_[_0xdb16('0x41')](_0xda0cc[_0x5d7f37[_0xdb16('0x26')]+_0xdb16('0x42')],handleFindQueue(_0x55e600[_0xdb16('0x2e')]));if(_0x2fc2c3){startRouting(_0x4305cb,_0x2fc2c3,_0x5d7f37,_0xda0cc);var _0x18dc6b=(_0x2fc2c3[_0xdb16('0x39')]||0xa)*0x3e8;var _0x99b242=(_0x55e600['timeout']||0x14)*0x3e8;var _0x1fc7b4;if(_0x18dc6b>_0x99b242){_0x99b242=_0x18dc6b;}var _0x58304d=seqqueue[_0xdb16('0x43')](_0x18dc6b);_0x58304d['id']=_0x4305cb;_0x58304d[_0xdb16('0x44')]=_0x18dc6b;_0x58304d[_0xdb16('0x45')]=_0x99b242;_0x58304d[_0xdb16('0x26')]=_0x5d7f37[_0xdb16('0x26')];_0xda0cc['rules'][_0x4305cb]['on'](_0xdb16('0x46'),function(){logger[_0xdb16('0x35')](_0xdb16('0x47'),_0x4305cb);stopRouting(_0x4305cb,_0x2fc2c3,_0x5d7f37,_0xda0cc);clearTimeout(_0x1fc7b4);_0x1fc7b4=undefined;_0x58304d['close'](!![]);if(_0xda0cc['rules'][_0x4305cb]){delete _0xda0cc['rules'][_0x4305cb];}_0xc5f023[_0xdb16('0x40')]();});_0xda0cc[_0xdb16('0x48')][_0x4305cb]['on'](_0xdb16('0x49'),function(){if(_0xda0cc['rules'][_0x4305cb]){delete _0xda0cc[_0xdb16('0x48')][_0x4305cb];}});_0x1fc7b4=setTimeout(function(){logger['info'](_0xdb16('0x4a'),_0x4305cb);endRouting(_0x4305cb,_0x2fc2c3,_0x5d7f37,_0xda0cc);clearTimeout(_0x1fc7b4);_0x58304d[_0xdb16('0x4b')](!![]);_0xc5f023['next']();},_0x99b242);switch(_0x2fc2c3[_0xdb16('0x4c')]){case _0xdb16('0x4d'):strategy[_0xdb16('0x4d')](_0x58304d,_0x2fc2c3,_0xda0cc,_0x5d7f37);break;default:strategy[_0xdb16('0x4e')](_0x58304d,_0x2fc2c3,_0xda0cc,_0x5d7f37);}}else{logger[_0xdb16('0x32')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x4305cb,_0x55e600[_0xdb16('0x2e')]);_0xc5f023[_0xdb16('0x40')]();}}}catch(_0x4928ca){console[_0xdb16('0x4f')](_0x4928ca);logger[_0xdb16('0x32')](_0xdb16('0x3e'),_0x4305cb,_0x4928ca['stack']);_0xc5f023[_0xdb16('0x40')]();}};}; \ No newline at end of file +var _0x7590=['interaction','message','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create\x20queue\x20report','accepted','info','update','catch','error','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','validate','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue','qtimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','socket.io-emitter','queue_id','account','clone','queue','capitalize','InteractionId','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','channel'];(function(_0xc12ef6,_0x3f3852){var _0x242bd0=function(_0x104908){while(--_0x104908){_0xc12ef6['push'](_0xc12ef6['shift']());}};_0x242bd0(++_0x3f3852);}(_0x7590,0x15d));var _0x0759=function(_0x105e01,_0x199717){_0x105e01=_0x105e01-0x0;var _0x421f22=_0x7590[_0x105e01];return _0x421f22;};'use strict';var schema=require('validate');var _=require(_0x0759('0x0'));var util=require(_0x0759('0x1'));var seqqueue=require(_0x0759('0x2'));var moment=require(_0x0759('0x3'));var Redis=require(_0x0759('0x4'));var config=require(_0x0759('0x5'));var logger=require(_0x0759('0x6'))(_0x0759('0x7'));var strategy=require(_0x0759('0x8'));config[_0x0759('0x9')]=_[_0x0759('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x0759('0xb'))(new Redis(config[_0x0759('0x9')]));var attributes=['id',_0x0759('0xc'),_0x0759('0xd'),'queue','from','joinAt'];function emit(_0x314e0a,_0x318c18,_0x260061){io['to'](_0x314e0a)['emit'](_0x318c18,_0x260061);}function emitChannelQueueInteraction(_0x49be18,_0x1a1be6,_0x3da45a,_0x30d6ec,_0x863fc0,_0x2cf734,_0x2b399e,_0x5c2e73){var _0x254bdf=_[_0x0759('0xe')](_0x3da45a);_0x254bdf[_0x0759('0xc')]=_0x5c2e73;_0x254bdf[_0x0759('0xf')]=_0x1a1be6;_0x254bdf[_0x0759('0xd')]=_0x30d6ec;_0x254bdf['id']=_0x863fc0;if(_0x2cf734){attributes['push'](_[_0x0759('0x10')](_0x49be18)+_0x0759('0x11'));_0x2b399e[util['format']('%sQueuesWaitingInteractions',_0x49be18)][_0x863fc0]=_[_0x0759('0x12')](_0x254bdf,attributes);}else{delete _0x2b399e[util[_0x0759('0x13')]('%sQueuesWaitingInteractions',_0x49be18)][_0x863fc0];}emit(util[_0x0759('0x13')](_0x0759('0x14'),_0x49be18,_0x1a1be6),util[_0x0759('0x13')](_0x0759('0x15'),_0x49be18,_0x2cf734?_0x0759('0x16'):_0x0759('0x17')),_[_0x0759('0x12')](_0x254bdf,attributes));}var rpc={'openchannelQueueReport':require(_0x0759('0x18')),'mailQueueReport':require(_0x0759('0x19')),'chatQueueReport':require(_0x0759('0x1a')),'smsQueueReport':require(_0x0759('0x1b')),'faxQueueReport':require(_0x0759('0x1c')),'whatsappQueueReport':require(_0x0759('0x1d'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0x0759('0x1e')},'timeout':{'type':_0x0759('0x1f'),'message':_0x0759('0x20')}});function startRouting(_0x12d06e,_0x52c3ba,_0x5e0ff1,_0x47b638){if(_0x12d06e&&_0x52c3ba&&_0x5e0ff1){_0x52c3ba[_0x0759('0x21')]+=0x1;var _0x47e520={'uniqueid':_0x12d06e,'from':_0x5e0ff1[_0x0759('0x22')]?_0x5e0ff1['body']['from']:'','joinAt':moment()['format'](_0x0759('0x23')),'ContactId':_0x5e0ff1['contact']?_0x5e0ff1[_0x0759('0x24')]['id']:null,'ListId':_0x5e0ff1[_0x0759('0x25')]?_0x5e0ff1[_0x0759('0x25')]['id']:null};_0x47e520[_[_0x0759('0x26')](_0x5e0ff1['channel'])+_0x0759('0x27')]=_0x52c3ba['id']||null;_0x47e520[_[_0x0759('0x26')](_0x5e0ff1[_0x0759('0x28')])+'InteractionId']=_0x5e0ff1[_0x0759('0x29')]?_0x5e0ff1[_0x0759('0x29')]['id']:null;_0x47e520[_[_0x0759('0x26')](_0x5e0ff1[_0x0759('0x28')])+'MessageId']=_0x5e0ff1[_0x0759('0x2a')]?_0x5e0ff1['message']['id']:null;_0x47e520[_['upperFirst'](_0x5e0ff1[_0x0759('0x28')])+(_0x5e0ff1[_0x0759('0x28')]!=='chat'?'AccountId':_0x0759('0x2b'))]=_0x5e0ff1[_0x0759('0xd')]?_0x5e0ff1[_0x0759('0xd')]['id']:null;logger['info'](util[_0x0759('0x13')](_0x0759('0x2c'),_0x12d06e,_0x52c3ba[_0x0759('0x2d')]));emitChannelQueueInteraction(_0x5e0ff1[_0x0759('0x28')],_0x52c3ba['name'],_0x47e520,_0x5e0ff1[_0x0759('0xd')][_0x0759('0x2d')],_0x5e0ff1[_0x0759('0x2a')]['id'],!![],_0x47b638,_0x52c3ba['id']);if(rpc[_0x5e0ff1['channel']+_0x0759('0x2e')]){return rpc[_0x5e0ff1[_0x0759('0x28')]+'QueueReport']['create'](_0x47e520)['catch'](function(_0x27a6de){logger['error'](_0x0759('0x2f'));});}}}function stopRouting(_0xb943f5,_0x2d112d,_0x157a20,_0x124cd5){if(_0xb943f5&&_0x2d112d){_0x2d112d[_0x0759('0x21')]-=0x1;var _0x86d804={'leaveAt':moment()['format'](_0x0759('0x23')),'acceptAt':moment()[_0x0759('0x13')](_0x0759('0x23')),'reason':_0x0759('0x30')};logger[_0x0759('0x31')](util[_0x0759('0x13')]('[%s][STOP:QUEUE][NAME:%s]',_0xb943f5,_0x2d112d['name']));emitChannelQueueInteraction(_0x157a20[_0x0759('0x28')],_0x2d112d[_0x0759('0x2d')],_0x157a20['body'],_0x157a20[_0x0759('0xd')][_0x0759('0x2d')],_0x157a20[_0x0759('0x2a')]['id'],![],_0x124cd5,_0x2d112d['id']);if(rpc[_0x157a20[_0x0759('0x28')]+_0x0759('0x2e')]){return rpc[_0x157a20['channel']+'QueueReport'][_0x0759('0x32')](_0xb943f5,_0x86d804)[_0x0759('0x33')](function(_0x1cb535){logger[_0x0759('0x34')](_0x0759('0x35'));});}}}function endRouting(_0x36e9d0,_0x1ddd97,_0x509acd,_0x37b467){if(_0x36e9d0&&_0x1ddd97){_0x1ddd97[_0x0759('0x21')]-=0x1;var _0x525625={'leaveAt':moment()['format'](_0x0759('0x23')),'exitAt':moment()[_0x0759('0x13')](_0x0759('0x23')),'reason':_0x0759('0x36')};logger[_0x0759('0x31')](util['format'](_0x0759('0x37'),_0x36e9d0,_0x1ddd97[_0x0759('0x2d')]));emitChannelQueueInteraction(_0x509acd['channel'],_0x1ddd97[_0x0759('0x2d')],_0x509acd[_0x0759('0x22')],_0x509acd[_0x0759('0xd')]['name'],_0x509acd[_0x0759('0x2a')]['id'],![],_0x37b467);if(rpc[_0x509acd[_0x0759('0x28')]+'QueueReport']){return rpc[_0x509acd['channel']+_0x0759('0x2e')][_0x0759('0x32')](_0x36e9d0,_0x525625)[_0x0759('0x33')](function(_0x2c0cdd){logger[_0x0759('0x34')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x3cf210){return function(_0x403a91){return _0x403a91[_0x0759('0x2d')]['toLowerCase']()===_0x3cf210[_0x0759('0x38')]();};}exports[_0x0759('0x39')]=function(_0x1541ba,_0x5ce311,_0x2b6a48,_0x2190d7){return function(_0x447f5c){try{var _0x226794={'name':_0x5ce311[0x0],'timeout':_0x5ce311[0x1]};var _0x356a6d=queue[_0x0759('0x3a')](_0x226794,{'typecast':!![]});if(_0x356a6d[_0x0759('0x3b')]){logger[_0x0759('0x34')](_0x0759('0x3c'),_0x1541ba,_[_0x0759('0x3d')](_0x356a6d,_0x0759('0x2a'))[_0x0759('0x3e')](',\x20'));_0x447f5c[_0x0759('0x3f')]();}else{var _0x751c9c=_[_0x0759('0x40')](_0x2b6a48[_0x2190d7['channel']+_0x0759('0x41')],handleFindQueue(_0x226794[_0x0759('0x2d')]));if(_0x751c9c){startRouting(_0x1541ba,_0x751c9c,_0x2190d7,_0x2b6a48);var _0x88ac80=(_0x751c9c[_0x0759('0x36')]||0xa)*0x3e8;var _0x1a946b=(_0x226794['timeout']||0x14)*0x3e8;var _0x3e1f25;if(_0x88ac80>_0x1a946b){_0x1a946b=_0x88ac80;}var _0x5b36c0=seqqueue[_0x0759('0x42')](_0x88ac80);_0x5b36c0['id']=_0x1541ba;_0x5b36c0['atimeout']=_0x88ac80;_0x5b36c0[_0x0759('0x43')]=_0x1a946b;_0x5b36c0[_0x0759('0x28')]=_0x2190d7[_0x0759('0x28')];_0x2b6a48[_0x0759('0x44')][_0x1541ba]['on']('end',function(){logger['info'](_0x0759('0x45'),_0x1541ba);stopRouting(_0x1541ba,_0x751c9c,_0x2190d7,_0x2b6a48);clearTimeout(_0x3e1f25);_0x3e1f25=undefined;_0x5b36c0[_0x0759('0x46')](!![]);if(_0x2b6a48['rules'][_0x1541ba]){delete _0x2b6a48[_0x0759('0x44')][_0x1541ba];}_0x447f5c['stop']();});_0x2b6a48['rules'][_0x1541ba]['on'](_0x0759('0x47'),function(){if(_0x2b6a48[_0x0759('0x44')][_0x1541ba]){delete _0x2b6a48[_0x0759('0x44')][_0x1541ba];}});_0x3e1f25=setTimeout(function(){logger[_0x0759('0x31')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x1541ba);endRouting(_0x1541ba,_0x751c9c,_0x2190d7,_0x2b6a48);clearTimeout(_0x3e1f25);_0x5b36c0['close'](!![]);_0x447f5c[_0x0759('0x48')]();},_0x1a946b);switch(_0x751c9c[_0x0759('0x49')]){case _0x0759('0x4a'):strategy[_0x0759('0x4a')](_0x5b36c0,_0x751c9c,_0x2b6a48,_0x2190d7);break;default:strategy[_0x0759('0x4b')](_0x5b36c0,_0x751c9c,_0x2b6a48,_0x2190d7);}}else{logger['error'](_0x0759('0x4c'),_0x1541ba,_0x226794[_0x0759('0x2d')]);_0x447f5c['stop']();}}}catch(_0x11fc79){console[_0x0759('0x4d')](_0x11fc79);logger[_0x0759('0x34')](_0x0759('0x3c'),_0x1541ba,_0x11fc79['stack']);_0x447f5c[_0x0759('0x3f')]();}};}; \ 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 b0e107d..aa31703 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 _0x54ef=['[%s][AGENT]\x20try\x20with\x20%s','isNil','realtime','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','agent','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','saveWaitingNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','routing','notificationId','squeue','push','bind','handleTimeout','drained','prototype','handleRun','handleDrained','debug'];(function(_0x422e96,_0x14f2e3){var _0x5cca4f=function(_0x32a741){while(--_0x32a741){_0x422e96['push'](_0x422e96['shift']());}};_0x5cca4f(++_0x14f2e3);}(_0x54ef,0x112));var _0xf54e=function(_0x53e035,_0x403523){_0x53e035=_0x53e035-0x0;var _0x338f8a=_0x54ef[_0x53e035];return _0x338f8a;};'use strict';var _=require(_0xf54e('0x0'));var uuid=require(_0xf54e('0x1'));var util=require(_0xf54e('0x2'));var logger=require('../../../../../config/logger')(_0xf54e('0x3'));var Agent=function(_0x18b7d6,_0x18b1cf,_0x42b9b2,_0x8b6bb6){this[_0xf54e('0x4')]=uuid['v4']();this[_0xf54e('0x5')]=_0x18b7d6;this['agent']=_0x18b1cf;this['realtime']=_0x42b9b2;this[_0xf54e('0x3')]=_0x8b6bb6;this[_0xf54e('0x5')][_0xf54e('0x6')](this['handleRun'][_0xf54e('0x7')](this),this['handleTimeout'][_0xf54e('0x7')](this));this[_0xf54e('0x5')]['on']('timeout',this[_0xf54e('0x8')][_0xf54e('0x7')](this));this[_0xf54e('0x5')]['on'](_0xf54e('0x9'),this['handleDrained'][_0xf54e('0x7')](this));};Agent[_0xf54e('0xa')][_0xf54e('0x6')]=function(){this[_0xf54e('0x5')]['push'](this[_0xf54e('0xb')]['bind'](this),this['handleTimeout'][_0xf54e('0x7')](this));};Agent[_0xf54e('0xa')][_0xf54e('0xc')]=function(){this[_0xf54e('0x8')](!![]);};Agent['prototype'][_0xf54e('0xb')]=function(){logger[_0xf54e('0xd')](_0xf54e('0xe'),this[_0xf54e('0x5')]['id'],this['agent']['id']);if(_[_0xf54e('0xf')](this[_0xf54e('0x10')][_0xf54e('0x11')][this['agent']['id']])){logger['debug'](_0xf54e('0x12'),this[_0xf54e('0x5')]['id'],this[_0xf54e('0x13')]['id']);setTimeout(this[_0xf54e('0x6')][_0xf54e('0x7')](this),0x3e8);}else{if(this[_0xf54e('0x3')][_0xf54e('0x14')]||util[_0xf54e('0x15')](this[_0xf54e('0x5')]['id'],this[_0xf54e('0x10')][_0xf54e('0x11')][this['agent']['id']],this['squeue'][_0xf54e('0x16')],![])){this['realtime'][_0xf54e('0x11')][this[_0xf54e('0x13')]['id']][_0xf54e('0x17')]=!![];this[_0xf54e('0x10')][_0xf54e('0x11')][this[_0xf54e('0x13')]['id']][_0xf54e('0x18')]=undefined;util[_0xf54e('0x19')](this[_0xf54e('0x10')],this[_0xf54e('0x3')],this[_0xf54e('0x13')],this['squeue'][_0xf54e('0x16')]);util['showNotification'](this[_0xf54e('0x4')],this[_0xf54e('0x5')]['id'],this[_0xf54e('0x10')][_0xf54e('0x11')][this[_0xf54e('0x13')]['id']],null,this[_0xf54e('0x3')]);util[_0xf54e('0x1a')](this[_0xf54e('0x5')]['id'],this[_0xf54e('0x10')][_0xf54e('0x11')][this[_0xf54e('0x13')]['id']],_0xf54e('0x1b')+(this[_0xf54e('0x3')]['forcedOwnership']?_0xf54e('0x1c'):''));}else{logger['debug'](_0xf54e('0x1d'),this['squeue']['id'],this[_0xf54e('0x13')]['id']);setTimeout(this[_0xf54e('0x6')][_0xf54e('0x7')](this),0x3e8);}}};Agent[_0xf54e('0xa')][_0xf54e('0x8')]=function(_0x3993e4){if(_[_0xf54e('0xf')](this['realtime']['agents'][this[_0xf54e('0x13')]['id']])){return logger[_0xf54e('0xd')](_0xf54e('0x12'),this[_0xf54e('0x5')]['id'],this[_0xf54e('0x13')]['id']);}else{logger[_0xf54e('0xd')](_0xf54e('0x1e'),this[_0xf54e('0x5')]['id'],this[_0xf54e('0x13')]['id']);util[_0xf54e('0x1f')](this['notificationId'],this['squeue']['id'],this[_0xf54e('0x10')][_0xf54e('0x11')][this['agent']['id']],null,this[_0xf54e('0x3')]);this[_0xf54e('0x10')][_0xf54e('0x11')][this[_0xf54e('0x13')]['id']]['busy']=![];this['realtime']['agents'][this[_0xf54e('0x13')]['id']][_0xf54e('0x18')]=undefined;util[_0xf54e('0x20')](this[_0xf54e('0x10')],this[_0xf54e('0x3')],this[_0xf54e('0x13')],this['squeue']['channel']);util['writeLog'](this[_0xf54e('0x5')]['id'],this[_0xf54e('0x10')]['agents'][this['agent']['id']],_0x3993e4?_0xf54e('0x21'):_0xf54e('0x22'));}if(!_0x3993e4){setTimeout(this[_0xf54e('0x6')]['bind'](this),0x3e8);}};function agent(_0x14ecc8,_0x44a437,_0x50aeca,_0x38d7a0){return new Agent(_0x14ecc8,_0x44a437,_0x50aeca,_0x38d7a0);}module[_0xf54e('0x23')]=agent; \ No newline at end of file +var _0x5089=['uuid','../../../../../config/logger','routing','notificationId','agent','realtime','push','handleRun','handleTimeout','bind','timeout','squeue','drained','handleDrained','prototype','debug','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','busy','busyQueue','saveWaitingNotification','channel','showNotification','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','removeWaitingNotification','writeLog','STOP','TIMEOUT','exports','lodash'];(function(_0x3a7165,_0x42ae52){var _0x59b3a7=function(_0x4b5f7a){while(--_0x4b5f7a){_0x3a7165['push'](_0x3a7165['shift']());}};_0x59b3a7(++_0x42ae52);}(_0x5089,0x1bb));var _0x9508=function(_0x4bfade,_0xb26c0e){_0x4bfade=_0x4bfade-0x0;var _0x272465=_0x5089[_0x4bfade];return _0x272465;};'use strict';var _=require(_0x9508('0x0'));var uuid=require(_0x9508('0x1'));var util=require('./util');var logger=require(_0x9508('0x2'))(_0x9508('0x3'));var Agent=function(_0x7dd13d,_0x100d7e,_0x172549,_0x59d3ee){this[_0x9508('0x4')]=uuid['v4']();this['squeue']=_0x7dd13d;this[_0x9508('0x5')]=_0x100d7e;this[_0x9508('0x6')]=_0x172549;this[_0x9508('0x3')]=_0x59d3ee;this['squeue'][_0x9508('0x7')](this[_0x9508('0x8')]['bind'](this),this[_0x9508('0x9')][_0x9508('0xa')](this));this['squeue']['on'](_0x9508('0xb'),this['handleTimeout'][_0x9508('0xa')](this));this[_0x9508('0xc')]['on'](_0x9508('0xd'),this[_0x9508('0xe')][_0x9508('0xa')](this));};Agent[_0x9508('0xf')]['push']=function(){this[_0x9508('0xc')]['push'](this[_0x9508('0x8')][_0x9508('0xa')](this),this['handleTimeout'][_0x9508('0xa')](this));};Agent[_0x9508('0xf')][_0x9508('0xe')]=function(){this[_0x9508('0x9')](!![]);};Agent['prototype'][_0x9508('0x8')]=function(){logger[_0x9508('0x10')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0x9508('0xc')]['id'],this['agent']['id']);if(_[_0x9508('0x11')](this[_0x9508('0x6')][_0x9508('0x12')][this[_0x9508('0x5')]['id']])){logger[_0x9508('0x10')](_0x9508('0x13'),this[_0x9508('0xc')]['id'],this[_0x9508('0x5')]['id']);setTimeout(this['push'][_0x9508('0xa')](this),0x3e8);}else{if(this[_0x9508('0x3')][_0x9508('0x14')]||util[_0x9508('0x15')](this[_0x9508('0xc')]['id'],this[_0x9508('0x6')]['agents'][this['agent']['id']],this[_0x9508('0xc')]['channel'],![])){this[_0x9508('0x6')]['agents'][this[_0x9508('0x5')]['id']][_0x9508('0x16')]=!![];this[_0x9508('0x6')][_0x9508('0x12')][this[_0x9508('0x5')]['id']][_0x9508('0x17')]=undefined;util[_0x9508('0x18')](this['realtime'],this['routing'],this[_0x9508('0x5')],this[_0x9508('0xc')][_0x9508('0x19')]);util[_0x9508('0x1a')](this[_0x9508('0x4')],this[_0x9508('0xc')]['id'],this['realtime']['agents'][this[_0x9508('0x5')]['id']],null,this['routing']);util['writeLog'](this[_0x9508('0xc')]['id'],this['realtime']['agents'][this[_0x9508('0x5')]['id']],_0x9508('0x1b')+(this['routing'][_0x9508('0x14')]?_0x9508('0x1c'):''));}else{logger[_0x9508('0x10')](_0x9508('0x1d'),this[_0x9508('0xc')]['id'],this[_0x9508('0x5')]['id']);setTimeout(this[_0x9508('0x7')][_0x9508('0xa')](this),0x3e8);}}};Agent[_0x9508('0xf')][_0x9508('0x9')]=function(_0x19a984){if(_['isNil'](this[_0x9508('0x6')][_0x9508('0x12')][this[_0x9508('0x5')]['id']])){return logger['debug'](_0x9508('0x13'),this[_0x9508('0xc')]['id'],this['agent']['id']);}else{logger[_0x9508('0x10')](_0x9508('0x1e'),this['squeue']['id'],this[_0x9508('0x5')]['id']);util[_0x9508('0x1f')](this[_0x9508('0x4')],this[_0x9508('0xc')]['id'],this['realtime']['agents'][this[_0x9508('0x5')]['id']],null,this[_0x9508('0x3')]);this[_0x9508('0x6')]['agents'][this['agent']['id']][_0x9508('0x16')]=![];this[_0x9508('0x6')][_0x9508('0x12')][this[_0x9508('0x5')]['id']][_0x9508('0x17')]=undefined;util[_0x9508('0x20')](this[_0x9508('0x6')],this[_0x9508('0x3')],this[_0x9508('0x5')],this[_0x9508('0xc')]['channel']);util[_0x9508('0x21')](this[_0x9508('0xc')]['id'],this['realtime'][_0x9508('0x12')][this[_0x9508('0x5')]['id']],_0x19a984?_0x9508('0x22'):_0x9508('0x23'));}if(!_0x19a984){setTimeout(this[_0x9508('0x7')][_0x9508('0xa')](this),0x3e8);}};function agent(_0x33e17c,_0x3700f1,_0xfb6676,_0x98ff75){return new Agent(_0x33e17c,_0x3700f1,_0xfb6676,_0x98ff75);}module[_0x9508('0x24')]=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 941413a..333f551 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 _0xbe8e=['handleTimeout','handleDrained','prototype','isNil','Agents','length','agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','busy','busyQueue','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','STOP','TIMEOUT','removeWaitingNotification','exports','lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','queue','realtime','routing','push','handleRun','bind'];(function(_0x529a5c,_0x30471a){var _0x5aaa26=function(_0x1cfaf0){while(--_0x1cfaf0){_0x529a5c['push'](_0x529a5c['shift']());}};_0x5aaa26(++_0x30471a);}(_0xbe8e,0x99));var _0xebe8=function(_0x8f9be9,_0x200431){_0x8f9be9=_0x8f9be9-0x0;var _0x14a303=_0xbe8e[_0x8f9be9];return _0x14a303;};'use strict';var _=require(_0xebe8('0x0'));var uuid=require(_0xebe8('0x1'));var util=require(_0xebe8('0x2'));var logger=require(_0xebe8('0x3'))('routing');var Beepall=function(_0x95063c,_0x3e51a1,_0x3a42b9,_0x1a794c){this[_0xebe8('0x4')]=uuid['v4']();this[_0xebe8('0x5')]=_0x95063c;this[_0xebe8('0x6')]=_0x3e51a1;this[_0xebe8('0x7')]=_0x3a42b9;this[_0xebe8('0x8')]=_0x1a794c;this[_0xebe8('0x5')][_0xebe8('0x9')](this[_0xebe8('0xa')][_0xebe8('0xb')](this),this[_0xebe8('0xc')][_0xebe8('0xb')](this));this[_0xebe8('0x5')]['on']('timeout',this[_0xebe8('0xc')]['bind'](this));this[_0xebe8('0x5')]['on']('drained',this[_0xebe8('0xd')][_0xebe8('0xb')](this));};Beepall[_0xebe8('0xe')][_0xebe8('0x9')]=function(){this[_0xebe8('0x5')][_0xebe8('0x9')](this['handleRun'][_0xebe8('0xb')](this),this[_0xebe8('0xc')]['bind'](this));};Beepall[_0xebe8('0xe')]['handleDrained']=function(){this[_0xebe8('0xc')](!![]);};Beepall['prototype'][_0xebe8('0xa')]=function(){var _0x3cb911=!![];if(!_[_0xebe8('0xf')](this[_0xebe8('0x6')])&&!_[_0xebe8('0xf')](this['queue'][_0xebe8('0x10')])&&this[_0xebe8('0x6')][_0xebe8('0x10')][_0xebe8('0x11')]>0x0){for(var _0x30c0d6=0x0,_0x501db2;_0x30c0d60x0){for(var _0x57329b=0x0,_0x2438c6;_0x57329b0x0&&_0xc2958e[_0x222c9f+_0x42a0('0x21')]>=_0xc2958e[_0x222c9f+_0x42a0('0x22')]){writeLog(_0x25852e,_0xc2958e,_0x222c9f['toUpperCase']()+_0x42a0('0x23'));return![];}}return!![];};exports[_0x42a0('0x24')]=function(_0x1a7d38,_0x24dd68,_0x20420d,_0x52c511,_0x547408){return sendNotification(!![],_0x1a7d38,_0x24dd68,_0x20420d,_0x52c511,_0x547408);};exports[_0x42a0('0x25')]=function(_0x4d3528,_0x280f13,_0x2e1f0c,_0x11b73a,_0x1c8d7e){return sendNotification(![],_0x4d3528,_0x280f13,_0x2e1f0c,_0x11b73a,_0x1c8d7e);};exports[_0x42a0('0x26')]=function(_0x5bf144,_0x587151,_0x3721a8){var _0x4e32ab=_0x587151[_0x42a0('0x27')][_0x42a0('0x28')];if(!_0x4e32ab&&_0x3721a8){_0x4e32ab=_0x3721a8['id'];}var _0x462b30=_['some'](_0x5bf144[_0x587151[_0x42a0('0x29')]+'QueuesWaitingInteractions'],function(_0x400d8c){var _0x348b9b=_[_0x42a0('0x2a')](_0x587151[_0x42a0('0x29')])+_0x42a0('0x2b');return _0x400d8c[_0x348b9b]===_0x587151[_0x42a0('0x27')]['id'];});if(!_0x462b30&&_0x4e32ab){_0x462b30=_[_0x42a0('0x2c')](_0x5bf144['agents'][_0x4e32ab][_0x587151['channel']+'WaitingInteractions'],function(_0x53a145){return _0x53a145['id']===_0x587151['interaction']['id'];});}return _0x462b30;};exports['saveWaitingNotification']=function(_0x4ff00b,_0x20c763,_0x29d066,_0x22938d){_0x4ff00b['agents'][_0x29d066['id']][_0x22938d+_0x42a0('0x2d')][_0x20c763[_0x42a0('0x15')]['id']]={'id':_0x20c763['interaction']['id']};};exports['removeWaitingNotification']=function(_0x2ee8a4,_0x170b4b,_0x1c895c,_0x2adf49){delete _0x2ee8a4[_0x42a0('0x2e')][_0x1c895c['id']][_0x2adf49+_0x42a0('0x2d')][_0x170b4b[_0x42a0('0x15')]['id']];};exports[_0x42a0('0x2f')]=writeLog; \ No newline at end of file +var _0xcebb=['agents','removeWaitingNotification','writeLog','lodash','util','../utils','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','localhost','socket.io-emitter','format','user:%s','name','emit','split','\x20interaction','account','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','message','notification:%s','save','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','busy','online','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','interaction','some','channel','QueuesWaitingInteractions','capitalize','InteractionId','WaitingInteractions','saveWaitingNotification'];(function(_0x2c6120,_0x1f3e60){var _0x5fb114=function(_0x45a72d){while(--_0x45a72d){_0x2c6120['push'](_0x2c6120['shift']());}};_0x5fb114(++_0x1f3e60);}(_0xcebb,0x161));var _0xbceb=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0xcebb[_0x45783c];return _0x1161da;};'use strict';var _=require(_0xbceb('0x0'));var util=require(_0xbceb('0x1'));var utils=require(_0xbceb('0x2'));var Redis=require(_0xbceb('0x3'));var config=require(_0xbceb('0x4'));var logger=require(_0xbceb('0x5'))(_0xbceb('0x6'));config[_0xbceb('0x7')]=_['defaults'](config[_0xbceb('0x7')],{'host':_0xbceb('0x8'),'port':0x18eb});var io=require(_0xbceb('0x9'))(new Redis(config[_0xbceb('0x7')]));function sendNotification(_0x5af3c8,_0x21a69b,_0x3f295f,_0x58d9a6,_0x5f35f0,_0xf2294f){io['to'](util[_0xbceb('0xa')](_0xbceb('0xb'),_0x58d9a6[_0xbceb('0xc')]))[_0xbceb('0xd')]('user:save',_0x58d9a6);var _0x2999b0=_0xf2294f||{};var _0x28a251=_0x3f295f[_0xbceb('0xe')]('.');var _0xe5aa20={'uniqueid':_0x21a69b,'channel':_0x28a251[0x0],'id':_0x28a251[0x1],'title':_0x28a251[0x0]+_0xbceb('0xf'),'interactionId':_0x28a251[0x2],'queue':_0x5f35f0?_0x5f35f0[_0xbceb('0xc')]:null,'sound':_0x2999b0[_0xbceb('0x10')]['notificationSound'],'shake':_0x2999b0['account'][_0xbceb('0x11')]};try{if(!_0x2999b0[_0xbceb('0x12')]){_0x2999b0[_0xbceb('0x12')]={};}if(_0x5f35f0){_0x2999b0[_0xbceb('0x12')][_0xbceb('0x13')]=_0x5f35f0;}else if(_0x2999b0[_0xbceb('0x12')][_0xbceb('0x13')]){delete _0x2999b0[_0xbceb('0x12')][_0xbceb('0x13')];}_0xe5aa20[_0xbceb('0x14')]=utils[_0xbceb('0x15')](_0x2999b0[_0xbceb('0x10')][_0xbceb('0x16')],_0x2999b0);}catch(_0x2b8f2d){_0xe5aa20[_0xbceb('0x14')]=_0xbceb('0x17');logger[_0xbceb('0x18')](util[_0xbceb('0xa')]('[%s][QUEUE]\x20%s',_0x21a69b,_0x2b8f2d[_0xbceb('0x19')]));}io['to'](util[_0xbceb('0xa')](_0xbceb('0xb'),_0x58d9a6[_0xbceb('0xc')]))['emit'](util[_0xbceb('0xa')](_0xbceb('0x1a'),_0x5af3c8?_0xbceb('0x1b'):'remove'),_0xe5aa20);}function writeLog(_0x41812,_0x4e3188,_0xce705f){return logger[_0xbceb('0x1c')](util['format'](_0xbceb('0x1d'),_0x41812,_0x4e3188['name'],_0xce705f));}exports['isAgentAvailable']=function(_0x18d8e6,_0x211e21,_0x53a953,_0x341e13){if(_0x211e21[_0xbceb('0x1e')]){writeLog(_0x18d8e6,_0x211e21,'BUSY');return![];}if(!_0x211e21[_0xbceb('0x1f')]){writeLog(_0x18d8e6,_0x211e21,'OFFLINE');return![];}if(_0x211e21[_0x53a953+'Pause']){writeLog(_0x18d8e6,_0x211e21,_0xbceb('0x20'));return![];}if(_0x341e13&&_0x211e21[_0xbceb('0x21')](_0x53a953+_0xbceb('0x22'))&&_0x211e21[_0xbceb('0x21')](_0x53a953+_0xbceb('0x23'))){if(_0x211e21[_0x53a953+_0xbceb('0x22')]>0x0&&_0x211e21[_0x53a953+_0xbceb('0x23')]>=_0x211e21[_0x53a953+'Capacity']){writeLog(_0x18d8e6,_0x211e21,_0x53a953[_0xbceb('0x24')]()+_0xbceb('0x25'));return![];}}return!![];};exports[_0xbceb('0x26')]=function(_0x5dfb1c,_0x20174c,_0x53fa24,_0x4daf70,_0xb41de2){return sendNotification(!![],_0x5dfb1c,_0x20174c,_0x53fa24,_0x4daf70,_0xb41de2);};exports['hideNotification']=function(_0xb754aa,_0x33bf2e,_0x19abed,_0x3475ab,_0x42bcdd){return sendNotification(![],_0xb754aa,_0x33bf2e,_0x19abed,_0x3475ab,_0x42bcdd);};exports['checkWaitingNotifications']=function(_0x5b2569,_0x4173a3,_0x1e1073){var _0x269575=_0x4173a3[_0xbceb('0x27')]['UserId'];if(!_0x269575&&_0x1e1073){_0x269575=_0x1e1073['id'];}var _0x3771df=_[_0xbceb('0x28')](_0x5b2569[_0x4173a3[_0xbceb('0x29')]+_0xbceb('0x2a')],function(_0xc4130d){var _0x41dc8b=_[_0xbceb('0x2b')](_0x4173a3[_0xbceb('0x29')])+_0xbceb('0x2c');return _0xc4130d[_0x41dc8b]===_0x4173a3['interaction']['id'];});if(!_0x3771df&&_0x269575){_0x3771df=_[_0xbceb('0x28')](_0x5b2569['agents'][_0x269575][_0x4173a3[_0xbceb('0x29')]+_0xbceb('0x2d')],function(_0x26b532){return _0x26b532['id']===_0x4173a3['interaction']['id'];});}return _0x3771df;};exports[_0xbceb('0x2e')]=function(_0x49ddbf,_0x2b35e6,_0x39080e,_0x4c65e2){_0x49ddbf[_0xbceb('0x2f')][_0x39080e['id']][_0x4c65e2+_0xbceb('0x2d')][_0x2b35e6[_0xbceb('0x19')]['id']]={'id':_0x2b35e6[_0xbceb('0x27')]['id']};};exports[_0xbceb('0x30')]=function(_0x28f3b1,_0x4f458e,_0x13ec17,_0x5f08c9){delete _0x28f3b1['agents'][_0x13ec17['id']][_0x5f08c9+'WaitingInteractions'][_0x4f458e['message']['id']];};exports[_0xbceb('0x31')]=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 8333f21..3fd9c19 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 _0x349a=['map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','validate','lodash','./utils','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s'];(function(_0x50df3a,_0x5af91a){var _0xd03334=function(_0x12caf8){while(--_0x12caf8){_0x50df3a['push'](_0x50df3a['shift']());}};_0xd03334(++_0x5af91a);}(_0x349a,0xd8));var _0xa349=function(_0x3f3f75,_0x5e215f){_0x3f3f75=_0x3f3f75-0x0;var _0x322635=_0x349a[_0x3f3f75];return _0x322635;};'use strict';var schema=require(_0xa349('0x0'));var sh=require('shelljs');var _=require(_0xa349('0x1'));var utils=require(_0xa349('0x2'));var logger=require('../../../../config/logger')(_0xa349('0x3'));var system=schema({'command':{'type':'string','required':!![],'message':_0xa349('0x4')}});exports[_0xa349('0x5')]=function(_0x12348c,_0x180272){return function(_0x18d5cc){try{var _0x37bf46={'command':_0x180272[0x0]};var _0x390abe=system[_0xa349('0x0')](_0x37bf46,{'typecast':!![]});if(_0x390abe[_0xa349('0x6')]){logger[_0xa349('0x7')](_0xa349('0x8'),_0x12348c,_[_0xa349('0x9')](_0x390abe,_0xa349('0xa'))[_0xa349('0xb')](',\x20'));logger[_0xa349('0xc')](_0xa349('0xd'),_0x12348c);_0x18d5cc['next']();}else{var _0x1bb07d=this;var _0x21acaf=utils[_0xa349('0xe')](_0x180272[0x0],this);logger[_0xa349('0xc')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x12348c,_0x21acaf);sh[_0xa349('0xf')](_[_0xa349('0x10')](_0x21acaf),function(_0x22bf5b,_0x54829b){logger['info'](_0xa349('0x11'),_0x12348c,_0x22bf5b);if(_0x22bf5b==0x0){var _0x3e267e=_0x54829b[_0xa349('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0xa349('0x13')](_0x180272[0x1])||_[_0xa349('0x14')](_0x180272[0x1])){logger[_0xa349('0xc')](_0xa349('0x15'),_0x12348c);_0x1bb07d[_0xa349('0x16')][_0x180272[0x1]]=_0x3e267e;}else{logger[_0xa349('0xc')](_0xa349('0x17'),_0x12348c,_0x180272[0x1],_0x3e267e);_0x1bb07d['body'][_0x180272[0x1]]=_0x3e267e;}}_0x18d5cc[_0xa349('0x18')]();});}}catch(_0x14e285){logger['error']('[%s][SYSTEM]\x20%s',_0x12348c,_['isObject'](_0x14e285)?JSON['stringify'](_0x14e285):_0x14e285);logger[_0xa349('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x12348c);_0x18d5cc[_0xa349('0x18')]();}};}; \ No newline at end of file +var _0xb011=['../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','map','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','next','error','[%s][SYSTEM]\x20%s','isObject','validate','./utils'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xb011,0x19c));var _0x1b01=function(_0x2bc16e,_0x4f757e){_0x2bc16e=_0x2bc16e-0x0;var _0x3f3a65=_0xb011[_0x2bc16e];return _0x3f3a65;};'use strict';var schema=require(_0x1b01('0x0'));var sh=require('shelljs');var _=require('lodash');var utils=require(_0x1b01('0x1'));var logger=require(_0x1b01('0x2'))(_0x1b01('0x3'));var system=schema({'command':{'type':_0x1b01('0x4'),'required':!![],'message':_0x1b01('0x5')}});exports['consequence']=function(_0x3a90cb,_0x1fa5fb){return function(_0xda7090){try{var _0x54b415={'command':_0x1fa5fb[0x0]};var _0x521a1b=system[_0x1b01('0x0')](_0x54b415,{'typecast':!![]});if(_0x521a1b['length']){logger['error']('[%s][SYSTEM]\x20%s',_0x3a90cb,_[_0x1b01('0x6')](_0x521a1b,'message')[_0x1b01('0x7')](',\x20'));logger['info'](_0x1b01('0x8'),_0x3a90cb);_0xda7090['next']();}else{var _0x3da94d=this;var _0x4ee98a=utils[_0x1b01('0x9')](_0x1fa5fb[0x0],this);logger[_0x1b01('0xa')](_0x1b01('0xb'),_0x3a90cb,_0x4ee98a);sh[_0x1b01('0xc')](_[_0x1b01('0xd')](_0x4ee98a),function(_0x111260,_0x46a182){logger['info']('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x3a90cb,_0x111260);if(_0x111260==0x0){var _0x5e9ac0=_0x46a182[_0x1b01('0xe')](/(\r\n|\n|\r)/gm,'');if(_[_0x1b01('0xf')](_0x1fa5fb[0x1])||_[_0x1b01('0x10')](_0x1fa5fb[0x1])){logger[_0x1b01('0xa')](_0x1b01('0x11'),_0x3a90cb);_0x3da94d[_0x1b01('0x12')][_0x1fa5fb[0x1]]=_0x5e9ac0;}else{logger[_0x1b01('0xa')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x3a90cb,_0x1fa5fb[0x1],_0x5e9ac0);_0x3da94d[_0x1b01('0x12')][_0x1fa5fb[0x1]]=_0x5e9ac0;}}_0xda7090[_0x1b01('0x13')]();});}}catch(_0x52b9e3){logger[_0x1b01('0x14')](_0x1b01('0x15'),_0x3a90cb,_[_0x1b01('0x16')](_0x52b9e3)?JSON['stringify'](_0x52b9e3):_0x52b9e3);logger[_0x1b01('0xa')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x3a90cb);_0xda7090[_0x1b01('0x13')]();}};}; \ 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 27bea28..da10d2e 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 _0xa202=['lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','consequence','length','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','error','validate'];(function(_0x16f76a,_0x2f092c){var _0x5bf944=function(_0xde6c8){while(--_0xde6c8){_0x16f76a['push'](_0x16f76a['shift']());}};_0x5bf944(++_0x2f092c);}(_0xa202,0x10d));var _0x2a20=function(_0x5ee607,_0x3b5c56){_0x5ee607=_0x5ee607-0x0;var _0x1b64f1=_0xa202[_0x5ee607];return _0x1b64f1;};'use strict';var schema=require(_0x2a20('0x0'));var _=require(_0x2a20('0x1'));var rpc={'chatInteraction':require(_0x2a20('0x2')),'openchannelInteraction':require(_0x2a20('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x2a20('0x4')),'faxInteraction':require(_0x2a20('0x5')),'whatsappInteraction':require(_0x2a20('0x6'))};var logger=require('../../../../config/logger')(_0x2a20('0x7'));var tag=schema({'tag':{'type':'number','required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x2a20('0x8')]=function(_0x383e9d,_0xf17bf6,_0x28fa7f,_0x36497d){return function(_0x5204b5){try{var _0x339f00={'tag':_0xf17bf6[0x0]};var _0x16d718=tag[_0x2a20('0x0')](_0x339f00,{'typecast':!![]});if(_0x16d718[_0x2a20('0x9')]){logger['error'](_0x2a20('0xa'),_0x383e9d,_[_0x2a20('0xb')](_0x16d718,_0x2a20('0xc'))[_0x2a20('0xd')](',\x20'));logger[_0x2a20('0xe')](_0x2a20('0xf'),_0x383e9d);_0x5204b5[_0x2a20('0x10')]();}else{var _0x29fb55={'ids':[_0xf17bf6[0x0]]};if(rpc[_0x36497d[_0x2a20('0x11')]+_0x2a20('0x12')]){rpc[_0x36497d[_0x2a20('0x11')]+'Interaction'][_0x2a20('0x13')](_0x36497d[_0x2a20('0x14')]['id'],_0x29fb55)[_0x2a20('0x15')](function(_0x32870b){logger['info'](_0x2a20('0x16'),_0x383e9d,_0xf17bf6[0x1],_0x36497d[_0x2a20('0x11')],_0x36497d[_0x2a20('0x14')]['id']);})[_0x2a20('0x17')](function(_0x34d5ca){logger['error'](_0x2a20('0xa'),_0x383e9d,JSON[_0x2a20('0x18')](_0x34d5ca));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x383e9d);})[_0x2a20('0x19')](function(){_0x5204b5[_0x2a20('0x10')]();});}}}catch(_0x75799b){logger[_0x2a20('0x1a')]('[%s][TAG]\x20%s',_0x383e9d,_['isObject'](_0x75799b)?JSON[_0x2a20('0x18')](_0x75799b):_0x75799b);logger['info'](_0x2a20('0xf'),_0x383e9d);_0x5204b5[_0x2a20('0x10')]();}};}; \ No newline at end of file +var _0x3c0e=['number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','interaction','error','[%s][TAG]\x20%s','stringify','next','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger'];(function(_0x1a561c,_0x156a13){var _0x5541ae=function(_0x25c97d){while(--_0x25c97d){_0x1a561c['push'](_0x1a561c['shift']());}};_0x5541ae(++_0x156a13);}(_0x3c0e,0xb8));var _0xe3c0=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x3c0e[_0x59ee6f];return _0x4c0979;};'use strict';var schema=require(_0xe3c0('0x0'));var _=require(_0xe3c0('0x1'));var rpc={'chatInteraction':require(_0xe3c0('0x2')),'openchannelInteraction':require(_0xe3c0('0x3')),'smsInteraction':require(_0xe3c0('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xe3c0('0x5')),'whatsappInteraction':require(_0xe3c0('0x6'))};var logger=require(_0xe3c0('0x7'))('routing');var tag=schema({'tag':{'type':_0xe3c0('0x8'),'required':!![],'message':_0xe3c0('0x9')}});exports[_0xe3c0('0xa')]=function(_0x19f078,_0x2edb3f,_0x15e910,_0x524838){return function(_0x414835){try{var _0x45f95d={'tag':_0x2edb3f[0x0]};var _0x422b3a=tag[_0xe3c0('0x0')](_0x45f95d,{'typecast':!![]});if(_0x422b3a['length']){logger['error']('[%s][TAG]\x20%s',_0x19f078,_[_0xe3c0('0xb')](_0x422b3a,_0xe3c0('0xc'))[_0xe3c0('0xd')](',\x20'));logger[_0xe3c0('0xe')](_0xe3c0('0xf'),_0x19f078);_0x414835['next']();}else{var _0x26438a={'ids':[_0x2edb3f[0x0]]};if(rpc[_0x524838[_0xe3c0('0x10')]+'Interaction']){rpc[_0x524838['channel']+_0xe3c0('0x11')][_0xe3c0('0x12')](_0x524838[_0xe3c0('0x13')]['id'],_0x26438a)['then'](function(_0x1d9165){logger[_0xe3c0('0xe')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x19f078,_0x2edb3f[0x1],_0x524838[_0xe3c0('0x10')],_0x524838['interaction']['id']);})['catch'](function(_0x5612f3){logger[_0xe3c0('0x14')](_0xe3c0('0x15'),_0x19f078,JSON[_0xe3c0('0x16')](_0x5612f3));logger[_0xe3c0('0xe')](_0xe3c0('0xf'),_0x19f078);})['finally'](function(){_0x414835[_0xe3c0('0x17')]();});}}}catch(_0x530e01){logger[_0xe3c0('0x14')]('[%s][TAG]\x20%s',_0x19f078,_['isObject'](_0x530e01)?JSON[_0xe3c0('0x16')](_0x530e01):_0x530e01);logger[_0xe3c0('0xe')](_0xe3c0('0xf'),_0x19f078);_0x414835['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 152ed4c..1bb111d 100644 --- a/server/services/routing/server/applications/tvox.js +++ b/server/services/routing/server/applications/tvox.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ded=['lodash','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','2.0','method','params','utf8','POST','application/json-rpc','then','parse','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','stringify','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','../../../../config/logger','routing'];(function(_0x1a09f7,_0x273ebf){var _0x28d103=function(_0x378586){while(--_0x378586){_0x1a09f7['push'](_0x1a09f7['shift']());}};_0x28d103(++_0x273ebf);}(_0x2ded,0xd0));var _0xd2de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2ded[_0x3dd15e];return _0x231fd0;};'use strict';var rp=require('request-promise');var logger=require(_0xd2de('0x0'))(_0xd2de('0x1'));var _=require(_0xd2de('0x2'));var arr=[];exports[_0xd2de('0x3')]=function(_0x3ddfb5,_0x25c41c){return function(_0x5b226f){var _0x1da2cd=_0x25c41c[0xa];var _0x5cecd8=_0x25c41c[0xb];var _0x172199=_0x25c41c[0xc];var _0x574da1=_0x25c41c[0xd];var _0x4fa98c=_0x25c41c[0xe];var _0x3b4ccf=_0x25c41c[0xf][_0xd2de('0x4')](/\n/g,_0xd2de('0x5'));var _0x2da638=_0x25c41c[0x10][_0xd2de('0x4')](/\n/g,'\x20');if(!arr[_0xd2de('0x6')](_0x5cecd8)){arr[_0xd2de('0x7')](_0x5cecd8);var _0x31c08c=_0x25c41c[0x3];var _0x22340e=_0x25c41c[0x4];var _0x19ecc3=_0x25c41c[0x1];var _0x499fd2=_0x25c41c[0x0];var _0x55dd23={};_0x55dd23[_0xd2de('0x8')]=_0x25c41c[0x8]+_0xd2de('0x9')+_0x172199+'|'+_0x1da2cd+'|'+_0x574da1+'|'+_0x5cecd8+'|'+_0x4fa98c;_0x55dd23[_0xd2de('0xa')]=_0x25c41c[0x7]+_0xd2de('0x9')+_0x172199+'|'+_0x1da2cd+'|'+_0x574da1+'|'+_0x5cecd8+'|'+_0x4fa98c+'|'+_0x3b4ccf+'|'+_0x2da638;_0x55dd23[_0xd2de('0xb')]=_0x25c41c[0x9];var _0x3ca58d={};_0x3ca58d[_0xd2de('0xc')]=_0xd2de('0xd');_0x3ca58d[_0xd2de('0xe')]='login';var _0xe1219=[];_0xe1219['push'](_0x25c41c[0x2]);_0xe1219[_0xd2de('0x7')](_0x25c41c[0x5]);_0xe1219[_0xd2de('0x7')](_0x25c41c[0x6]);_0x3ca58d[_0xd2de('0xf')]=_0xe1219;_0x3ca58d['id']=0x1;var _0x329206=JSON['stringify'](_0x3ca58d);var _0x5f2631={'encoding':_0xd2de('0x10'),'method':_0xd2de('0x11'),'timeout':0x2710,'url':_0x31c08c,'headers':{'Content-Type':_0xd2de('0x12')},'body':_0x329206};return rp(_0x5f2631)[_0xd2de('0x13')](function(_0x4bc876){const _0x36074d=JSON[_0xd2de('0x14')](_0x4bc876);if(!_0x36074d['result'][_0xd2de('0x15')]){throw new Error(_0xd2de('0x16'));}var _0x286629=_0x5cecd8;var _0x470c6b=_0xd2de('0x17')+_0x19ecc3+_0xd2de('0x18')+_0x499fd2+_0xd2de('0x19')+_0x286629+'&data='+JSON[_0xd2de('0x1a')](_0x55dd23);var _0x2b24e9=_0x22340e+'?'+_0x470c6b;return rp(_0x2b24e9);})['then'](function(_0x5f5a79){logger[_0xd2de('0x1b')](_0xd2de('0x1c'),_0x3ddfb5,_0x5f5a79);_0x5b226f[_0xd2de('0x1d')]();})[_0xd2de('0x1e')](function(_0x4ebbcb){logger[_0xd2de('0x1f')](_0xd2de('0x20'),_0x3ddfb5,_[_0xd2de('0x21')](_0x4ebbcb)?JSON['stringify'](_0x4ebbcb):_0x4ebbcb);_0x5b226f[_0xd2de('0x1d')]();});}else{logger[_0xd2de('0x1b')](_0xd2de('0x22'),_0x3ddfb5);_0x5b226f['next']();}};}; \ No newline at end of file +var _0xa0e1=['includes','push','urlOnAnswer','?params=','jsonrpc','2.0','method','params','stringify','utf8','POST','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','info','stop','catch','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','routing','consequence','replace','\x20-\x20'];(function(_0x2e50a2,_0x27f31e){var _0x47e5de=function(_0x4e1f70){while(--_0x4e1f70){_0x2e50a2['push'](_0x2e50a2['shift']());}};_0x47e5de(++_0x27f31e);}(_0xa0e1,0x7b));var _0x1a0e=function(_0x4dda1e,_0x4fd5fe){_0x4dda1e=_0x4dda1e-0x0;var _0x1b2e29=_0xa0e1[_0x4dda1e];return _0x1b2e29;};'use strict';var rp=require(_0x1a0e('0x0'));var logger=require('../../../../config/logger')(_0x1a0e('0x1'));var _=require('lodash');var arr=[];exports[_0x1a0e('0x2')]=function(_0xcc433e,_0x165826){return function(_0x5b2f24){var _0x3ac624=_0x165826[0xa];var _0x5c7bc5=_0x165826[0xb];var _0xd69655=_0x165826[0xc];var _0x35c5ee=_0x165826[0xd];var _0x2562c3=_0x165826[0xe];var _0x37dd99=_0x165826[0xf][_0x1a0e('0x3')](/\n/g,_0x1a0e('0x4'));var _0x4aafc0=_0x165826[0x10][_0x1a0e('0x3')](/\n/g,'\x20');if(!arr[_0x1a0e('0x5')](_0x5c7bc5)){arr[_0x1a0e('0x6')](_0x5c7bc5);var _0x14d255=_0x165826[0x3];var _0x1ea5e6=_0x165826[0x4];var _0x2f2840=_0x165826[0x1];var _0x2ed194=_0x165826[0x0];var _0x2433ee={};_0x2433ee[_0x1a0e('0x7')]=_0x165826[0x8]+_0x1a0e('0x8')+_0xd69655+'|'+_0x3ac624+'|'+_0x35c5ee+'|'+_0x5c7bc5+'|'+_0x2562c3;_0x2433ee['urlOnRing']=_0x165826[0x7]+_0x1a0e('0x8')+_0xd69655+'|'+_0x3ac624+'|'+_0x35c5ee+'|'+_0x5c7bc5+'|'+_0x2562c3+'|'+_0x37dd99+'|'+_0x4aafc0;_0x2433ee['title']=_0x165826[0x9];var _0x30a465={};_0x30a465[_0x1a0e('0x9')]=_0x1a0e('0xa');_0x30a465[_0x1a0e('0xb')]='login';var _0x1f559c=[];_0x1f559c[_0x1a0e('0x6')](_0x165826[0x2]);_0x1f559c[_0x1a0e('0x6')](_0x165826[0x5]);_0x1f559c[_0x1a0e('0x6')](_0x165826[0x6]);_0x30a465[_0x1a0e('0xc')]=_0x1f559c;_0x30a465['id']=0x1;var _0x231cdd=JSON[_0x1a0e('0xd')](_0x30a465);var _0x402081={'encoding':_0x1a0e('0xe'),'method':_0x1a0e('0xf'),'timeout':0x2710,'url':_0x14d255,'headers':{'Content-Type':'application/json-rpc'},'body':_0x231cdd};return rp(_0x402081)[_0x1a0e('0x10')](function(_0xb376fa){const _0x91a1f6=JSON[_0x1a0e('0x11')](_0xb376fa);if(!_0x91a1f6[_0x1a0e('0x12')][_0x1a0e('0x13')]){throw new Error(_0x1a0e('0x14'));}var _0xc24360=_0x5c7bc5;var _0x2177fe=_0x1a0e('0x15')+_0x2f2840+_0x1a0e('0x16')+_0x2ed194+_0x1a0e('0x17')+_0xc24360+_0x1a0e('0x18')+JSON[_0x1a0e('0xd')](_0x2433ee);var _0x4531ce=_0x1ea5e6+'?'+_0x2177fe;return rp(_0x4531ce);})[_0x1a0e('0x10')](function(_0x30a86b){logger[_0x1a0e('0x19')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0xcc433e,_0x30a86b);_0x5b2f24[_0x1a0e('0x1a')]();})[_0x1a0e('0x1b')](function(_0x59b4d5){logger['error'](_0x1a0e('0x1c'),_0xcc433e,_[_0x1a0e('0x1d')](_0x59b4d5)?JSON[_0x1a0e('0xd')](_0x59b4d5):_0x59b4d5);_0x5b2f24['stop']();});}else{logger[_0x1a0e('0x19')](_0x1a0e('0x1e'),_0xcc433e);_0x5b2f24[_0x1a0e('0x1f')]();}};}; \ 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 ac81390..0156df5 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 _0xbaf0=['list','lodash','exports','render','merge','contact','message','account','interaction'];(function(_0x171ed5,_0x55f398){var _0x1b1478=function(_0x3b4f33){while(--_0x3b4f33){_0x171ed5['push'](_0x171ed5['shift']());}};_0x1b1478(++_0x55f398);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var Mustache=require('mustache');var _=require(_0x0baf('0x0'));module[_0x0baf('0x1')]={'getMustacheRender':function(_0x1e212d,_0x263f79){return Mustache[_0x0baf('0x2')](_0x1e212d,_[_0x0baf('0x3')](_0x263f79['body'],{'contact':_0x263f79[_0x0baf('0x4')],'message':_0x263f79[_0x0baf('0x5')],'account':_0x263f79[_0x0baf('0x6')],'interaction':_0x263f79[_0x0baf('0x7')],'list':_0x263f79[_0x0baf('0x8')]}))||'';}}; \ No newline at end of file +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x53d07d,_0x154ce0){var _0x4fc220=function(_0x374cb4){while(--_0x374cb4){_0x53d07d['push'](_0x53d07d['shift']());}};_0x4fc220(++_0x154ce0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 2e168c3..9d3611c 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 _0x15d6=['tag','TagId','tvox','getMustacheRender','account','ChatWebsiteId','ContactId','body','./interval','./applications/','consequence','info','Push\x20new\x20rule','on\x20interval','intervals','Please\x20create\x20a\x20new\x20file\x20under','.js','execute','Applications\x20executed','stringify','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','error','agent','agents','busyQueue','end','QueueReport','update','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','hasOwnProperty','CurrentCapacity','capacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','available','name','mailQueues','loggedIn','paused','openchannelQueues','waiting','smsQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','IntervalId','isNil','Intervals','map','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','applications','isArray','length','existsSync','app','toLowerCase','split','mail','push','slice','join','dialogflow','appdata','dialogflowv2','amazonlex'];(function(_0x3c5c96,_0x2fb2f4){var _0x4552b7=function(_0x55af80){while(--_0x55af80){_0x3c5c96['push'](_0x3c5c96['shift']());}};_0x4552b7(++_0x2fb2f4);}(_0x15d6,0x171));var _0x615d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x15d6[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x615d('0x0'));var util=require(_0x615d('0x1'));var path=require(_0x615d('0x2'));var fs=require('fs');var jayson=require(_0x615d('0x3'));var BPromise=require(_0x615d('0x4'));var utils=require(_0x615d('0x5'));var sUtils=require(_0x615d('0x6'));var logger=require(_0x615d('0x7'))(_0x615d('0x8'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x615d('0x9')),'chatQueueReport':require(_0x615d('0xa')),'smsQueueReport':require(_0x615d('0xb')),'faxQueueReport':require(_0x615d('0xc')),'whatsappQueueReport':require(_0x615d('0xd'))};var RuleEngine=require(_0x615d('0xe'));function getId(_0x4edd83,_0x424bf5,_0x46465){return util[_0x615d('0xf')](_0x615d('0x10'),_0x4edd83,_0x424bf5||0x0,_0x46465||0x0);}function getIntervals(_0x1faf98,_0x390418){var _0xdba87=[];if(!_['isNil'](_0x390418[_0x615d('0x11')])&&!_[_0x615d('0x12')](_0x1faf98[_0x390418['IntervalId']])&&!_['isNil'](_0x1faf98[_0x390418[_0x615d('0x11')]][_0x615d('0x13')])){_0xdba87=_[_0x615d('0x14')](_0x1faf98[_0x390418[_0x615d('0x11')]][_0x615d('0x13')],'interval');}else if(!_[_0x615d('0x12')](_0x390418[_0x615d('0x15')])){_0xdba87=[_0x390418[_0x615d('0x15')]];}return _0xdba87;}exports[_0x615d('0x16')]=function(_0x28bd78){_0x28bd78[_0x615d('0x17')]={};return new BPromise(function(_0x205fcd,_0x19dc46){var _0x3280b6={'Start':function(_0x724096){var _0x3a791e=this;return new Promise(function(_0x2336a2,_0x238194){if(_0x724096){try{var _0x133d27=[];var _0x30d6dd=getId(_0x724096[_0x615d('0x18')],_0x724096[_0x615d('0x19')]?_0x724096[_0x615d('0x19')]['id']:0x0,_0x724096[_0x615d('0x1a')]?_0x724096[_0x615d('0x1a')]['id']:0x0);var _0x28065d=sUtils[_0x615d('0x1b')](_0x28bd78,_0x724096);if(!_0x28065d&&_0x724096[_0x615d('0x1c')]&&_[_0x615d('0x1d')](_0x724096['applications'])&&_0x724096['applications'][_0x615d('0x1e')]){for(var _0xcd8d9e=0x0;_0xcd8d9e<_0x724096[_0x615d('0x1c')][_0x615d('0x1e')];_0xcd8d9e+=0x1){var _0x38a193=_0x724096[_0x615d('0x1c')][_0xcd8d9e];if(fs[_0x615d('0x1f')](path['join'](__dirname,'applications',_0x38a193[_0x615d('0x20')]+'.js'))){var _0x5cad2c=[];switch(_0x38a193['app'][_0x615d('0x21')]()){case'autoreply':var _0x54b338=_0x38a193['appdata'][_0x615d('0x22')](',');if(_0x724096['channel']===_0x615d('0x23')){_0x5cad2c[_0x615d('0x24')](_0x54b338[0x0]);_0x5cad2c[_0x615d('0x24')](_0x54b338[0x1]);_0x5cad2c['push'](_0x54b338[_0x615d('0x25')](0x2,_0x54b338[_0x615d('0x1e')])[_0x615d('0x26')](','));}else{_0x5cad2c['push'](_0x54b338[0x0]);_0x5cad2c[_0x615d('0x24')](_0x54b338[_0x615d('0x25')](0x1,_0x54b338[_0x615d('0x1e')])[_0x615d('0x26')](','));}break;case _0x615d('0x27'):var _0x279573=_0x38a193[_0x615d('0x28')][_0x615d('0x22')](',');_0x5cad2c[_0x615d('0x24')](_0x279573[0x0]);_0x5cad2c['push'](_0x279573[0x1]);_0x5cad2c[_0x615d('0x24')](_0x279573[_0x615d('0x25')](0x2,_0x279573[_0x615d('0x1e')])[_0x615d('0x26')](','));break;case _0x615d('0x29'):var _0x2f3fd1=_0x38a193[_0x615d('0x28')]['split'](',');_0x5cad2c[_0x615d('0x24')](_0x2f3fd1[0x0]);_0x5cad2c[_0x615d('0x24')](_0x2f3fd1[0x1]);_0x5cad2c[_0x615d('0x24')](_0x2f3fd1[0x2]);_0x5cad2c['push'](_0x2f3fd1[0x3]);_0x5cad2c[_0x615d('0x24')](_0x2f3fd1[_0x615d('0x25')](0x4,_0x2f3fd1['length'])['join'](','));break;case _0x615d('0x2a'):var _0x46e1d9=_0x38a193['appdata'][_0x615d('0x22')](',');_0x5cad2c[_0x615d('0x24')](_0x46e1d9[0x0]);_0x5cad2c['push'](_0x46e1d9[0x1]);_0x5cad2c[_0x615d('0x24')](_0x46e1d9[0x2]);_0x5cad2c['push'](_0x46e1d9[0x3]);_0x5cad2c[_0x615d('0x24')](_0x46e1d9[_0x615d('0x25')](0x4,_0x46e1d9[_0x615d('0x1e')])[_0x615d('0x26')](','));break;case _0x615d('0x19'):_0x5cad2c[_0x615d('0x24')](_0x38a193[_0x615d('0x28')]);break;case _0x615d('0x2b'):_0x5cad2c['push'](_0x38a193[_0x615d('0x2c')]);_0x5cad2c[_0x615d('0x24')](_0x38a193[_0x615d('0x28')]);break;case _0x615d('0x2d'):var _0x51352e=utils[_0x615d('0x2e')](_0x724096[_0x615d('0x2f')]['notificationTemplate'],_0x724096);var _0x4b26f4=_0x38a193[_0x615d('0x28')][_0x615d('0x22')](',');_0x5cad2c[_0x615d('0x24')](_0x4b26f4[0x0]);_0x5cad2c[_0x615d('0x24')](_0x4b26f4[0x1]);_0x5cad2c[_0x615d('0x24')](_0x4b26f4[0x2]);_0x5cad2c[_0x615d('0x24')](_0x4b26f4[0x3]);_0x5cad2c[_0x615d('0x24')](_0x4b26f4[0x4]);_0x5cad2c['push'](_0x4b26f4[0x5]);_0x5cad2c[_0x615d('0x24')](_0x4b26f4[0x6]);_0x5cad2c['push'](_0x4b26f4[0x7]);_0x5cad2c[_0x615d('0x24')](_0x4b26f4[0x8]);_0x5cad2c['push'](_0x4b26f4[0x9]);_0x5cad2c['push'](_0x4b26f4[0xa]);_0x5cad2c[_0x615d('0x24')](_0x724096['interaction']['id']);_0x5cad2c[_0x615d('0x24')](_0x724096[_0x615d('0x19')]['id']);_0x5cad2c[_0x615d('0x24')](_0x38a193[_0x615d('0x30')]);_0x5cad2c['push'](_0x724096[_0x615d('0x1a')][_0x615d('0x31')]);_0x5cad2c[_0x615d('0x24')](_0x724096['body'][_0x615d('0x32')]);_0x5cad2c[_0x615d('0x24')](_0x51352e);break;default:_0x5cad2c=_[_0x615d('0x12')](_0x38a193['appdata'])?[]:_0x38a193[_0x615d('0x28')][_0x615d('0x22')](',');}var _0x56e216={'id':util[_0x615d('0xf')]('%s:%s:%s',_0x30d6dd,_0x38a193['id'],_0x38a193['app']),'condition':require(_0x615d('0x33'))['condition'](_0x30d6dd,getIntervals(_0x28bd78['intervals'],_0x38a193),_0x28bd78),'consequence':require(_0x615d('0x34')+_0x38a193[_0x615d('0x20')])[_0x615d('0x35')](_0x30d6dd,_0x5cad2c,_0x28bd78,_0x724096),'p':_0x38a193['priority']||0x0};logger[_0x615d('0x36')](_0x615d('0x37'),_0x56e216['id'],_0x615d('0x38'),getIntervals(_0x28bd78[_0x615d('0x39')],_0x38a193)[_0x615d('0x26')]('\x20|\x20'));_0x133d27[_0x615d('0x24')](_0x56e216);}else{logger['error'](_0x615d('0x3a'),path[_0x615d('0x26')](__dirname,_0x615d('0x1c'),_0x38a193['app']+_0x615d('0x3b')));}}_0x28bd78[_0x615d('0x17')][_0x30d6dd]=new RuleEngine(_0x133d27);_0x28bd78[_0x615d('0x17')][_0x30d6dd][_0x615d('0x3c')](_0x724096,function(_0x113f12){logger[_0x615d('0x36')](_0x615d('0x3d'),JSON[_0x615d('0x3e')](_0x113f12[_0x615d('0x3f')]));if(_0x28bd78['rules'][_0x30d6dd]){_0x28bd78[_0x615d('0x17')][_0x30d6dd][_0x615d('0x40')](_0x615d('0x41'));}});return _0x2336a2({'code':0xc8,'message':_0x724096});}else{if(_0x28065d){logger['info'](util[_0x615d('0xf')](_0x615d('0x42'),_0x30d6dd));}else{logger['info'](_0x615d('0x43'));}return _0x2336a2({'code':0xc8,'message':_0x724096});}}catch(_0x1163b0){logger[_0x615d('0x44')](_0x1163b0['stack']);return _0x238194(_0x3a791e[_0x615d('0x44')](0x1f4,_0x1163b0));}}return _0x238194('routing\x20is\x20empty');});},'AcceptMessage':function(_0x10262f){var _0x5e9d7f=this;return new Promise(function(_0x38ef35,_0xc4acf2){if(_0x10262f[_0x615d('0x45')]&&_0x10262f[_0x615d('0x45')]['id']){if(_0x28bd78['agents'][_0x10262f['agent']['id']]){_0x28bd78[_0x615d('0x46')][_0x10262f[_0x615d('0x45')]['id']]['busy']=![];_0x28bd78[_0x615d('0x46')][_0x10262f[_0x615d('0x45')]['id']][_0x615d('0x47')]=undefined;}}if(_0x10262f[_0x615d('0x19')]&&_0x10262f[_0x615d('0x19')]['id']){try{var _0x177f01=getId(_0x10262f[_0x615d('0x18')],_0x10262f['message']?_0x10262f[_0x615d('0x19')]['id']:0x0,_0x10262f['interaction']?_0x10262f[_0x615d('0x1a')]['id']:0x0);if(_0x28bd78[_0x615d('0x17')][_0x177f01]){_0x28bd78[_0x615d('0x17')][_0x177f01][_0x615d('0x40')](_0x615d('0x48'));if(rpc[_0x10262f['channel']+_0x615d('0x49')]){rpc[_0x10262f[_0x615d('0x18')]+_0x615d('0x49')][_0x615d('0x4a')](_0x177f01,{'UserId':_0x10262f[_0x615d('0x19')]['UserId']})['catch'](function(){logger[_0x615d('0x44')](_0x615d('0x4b'));});}}return _0x38ef35({'code':0xc8,'message':_0x10262f});}catch(_0x3df729){logger[_0x615d('0x44')](_0x3df729[_0x615d('0x4c')]);return _0xc4acf2(_0x5e9d7f[_0x615d('0x44')](0x1f4,_0x3df729));}}logger[_0x615d('0x44')]('message\x20is\x20empty');return _0xc4acf2(_0x5e9d7f[_0x615d('0x44')](0x1f4,_0x615d('0x4d')));});},'RejectMessage':function(_0xab9015){var _0x1adca0=this;return new Promise(function(_0x26dc98,_0x28f26c){if(_0xab9015['agent']&&_0xab9015[_0x615d('0x45')]['id']){try{if(_0x28bd78[_0x615d('0x46')][_0xab9015[_0x615d('0x45')]['id']]){_0x28bd78[_0x615d('0x46')][_0xab9015['agent']['id']]['busy']=![];_0x28bd78['agents'][_0xab9015['agent']['id']]['busyQueue']=undefined;}return _0x26dc98({'code':0xc8,'message':_0xab9015});}catch(_0x3502b9){logger['error'](_0x3502b9[_0x615d('0x4c')]);return _0x28f26c(_0x1adca0[_0x615d('0x44')](0x1f4,_0x3502b9));}}logger['error'](_0x615d('0x4d'));return _0x28f26c(_0x1adca0[_0x615d('0x44')](0x1f4,_0x615d('0x4d')));});},'AbandonInteraction':function(_0x35d206){var _0x3f5a4d=this;return new Promise(function(_0x5ebff2,_0x1c7bd1){if(_0x35d206[_0x615d('0x18')]&&_0x35d206[_0x615d('0x1a')]&&_0x35d206[_0x615d('0x1a')]['id']){try{var _0x1d3add=getId(_0x35d206[_0x615d('0x18')],_0x35d206[_0x615d('0x19')]?_0x35d206['message']['id']:0x0,_0x35d206[_0x615d('0x1a')]?_0x35d206[_0x615d('0x1a')]['id']:0x0);if(_0x28bd78['rules'][_0x1d3add]){_0x28bd78[_0x615d('0x17')][_0x1d3add][_0x615d('0x40')](_0x615d('0x48'));}return _0x5ebff2({'code':0xc8,'message':_0x35d206});}catch(_0x446f2d){logger[_0x615d('0x44')](_0x446f2d[_0x615d('0x4c')]);return _0x1c7bd1(_0x3f5a4d[_0x615d('0x44')](0x1f4,_0x446f2d));}}logger[_0x615d('0x44')](_0x615d('0x4d'));return _0x1c7bd1(_0x3f5a4d['error'](0x1f4,_0x615d('0x4d')));});},'AgentCapacity':function(_0x631439){var _0x1f07e6=this;return new Promise(function(_0xadcd4b,_0x11e492){if(_0x28bd78[_0x615d('0x46')][_0x615d('0x4e')](_0x631439['id'])){for(var _0x2b6929 in _0x631439['capacity']){if(_0x631439['capacity'][_0x615d('0x4e')](_0x2b6929)){if(_0x28bd78[_0x615d('0x46')][_0x631439['id']][_0x615d('0x4e')](_0x2b6929+_0x615d('0x4f'))){_0x28bd78[_0x615d('0x46')][_0x631439['id']][_0x2b6929+'CurrentCapacity']=parseInt(_0x631439[_0x615d('0x50')][_0x2b6929],0xa);}}}_0x28bd78[_0x615d('0x46')][_0x631439['id']][_0x615d('0x51')]();return _0xadcd4b({'code':0xc8,'message':_0x28bd78[_0x615d('0x46')][_0x631439['id']]});}else{return _0x11e492(_0x1f07e6['error'](0x1f4,_0x615d('0x52')));}});},'Agents':function(_0x92ebd6){return new Promise(function(_0x1da9f3){var _0x8d5080=_[_0x615d('0x53')](_0x28bd78['agents']);if(_0x92ebd6&&_0x92ebd6['id']){var _0x1cde62=_[_0x615d('0x54')](_0x8d5080,function(_0x44e8a1){return _0x44e8a1['id']===_0x92ebd6['id'];});_0x1da9f3(_0x1cde62);}else{_0x1da9f3({'count':_0x8d5080['length'],'rows':_0x8d5080});}});},'ChatQueues':function(){return new Promise(function(_0x17cd22){var _0x478834=[];for(var _0x49f323 in _0x28bd78['chatQueues']){if(_0x28bd78[_0x615d('0x55')][_0x615d('0x4e')](_0x49f323)){var _0x3a95bd=_0x28bd78[_0x615d('0x55')][_0x49f323];var _0x5f2a6a={'id':_0x3a95bd['id'],'available':_0x3a95bd[_0x615d('0x56')],'loggedIn':_0x3a95bd['loggedIn'],'name':_0x3a95bd[_0x615d('0x57')],'paused':_0x3a95bd['paused'],'waiting':_0x3a95bd['waiting']};_0x478834[_0x615d('0x24')](_0x5f2a6a);}}_0x17cd22({'count':_0x478834[_0x615d('0x1e')],'rows':_0x478834});});},'MailQueues':function(){return new Promise(function(_0x37489c){var _0x2dec98=[];for(var _0x448236 in _0x28bd78[_0x615d('0x58')]){if(_0x28bd78['mailQueues'][_0x615d('0x4e')](_0x448236)){var _0xcf5290=_0x28bd78[_0x615d('0x58')][_0x448236];var _0x36e18e={'id':_0xcf5290['id'],'available':_0xcf5290[_0x615d('0x56')],'loggedIn':_0xcf5290[_0x615d('0x59')],'name':_0xcf5290[_0x615d('0x57')],'paused':_0xcf5290[_0x615d('0x5a')],'waiting':_0xcf5290['waiting']};_0x2dec98[_0x615d('0x24')](_0x36e18e);}}_0x37489c({'count':_0x2dec98[_0x615d('0x1e')],'rows':_0x2dec98});});},'OpenchannelQueues':function(){return new Promise(function(_0x1fe814){var _0x26eb4c=[];for(var _0x51777f in _0x28bd78[_0x615d('0x5b')]){if(_0x28bd78[_0x615d('0x5b')][_0x615d('0x4e')](_0x51777f)){var _0x308fd8=_0x28bd78[_0x615d('0x5b')][_0x51777f];var _0x310136={'id':_0x308fd8['id'],'available':_0x308fd8[_0x615d('0x56')],'loggedIn':_0x308fd8[_0x615d('0x59')],'name':_0x308fd8[_0x615d('0x57')],'paused':_0x308fd8['paused'],'waiting':_0x308fd8[_0x615d('0x5c')]};_0x26eb4c[_0x615d('0x24')](_0x310136);}}_0x1fe814({'count':_0x26eb4c['length'],'rows':_0x26eb4c});});},'SmsQueues':function(){return new Promise(function(_0x4f0c70){var _0x195f90=[];for(var _0x40f948 in _0x28bd78[_0x615d('0x5d')]){if(_0x28bd78[_0x615d('0x5d')][_0x615d('0x4e')](_0x40f948)){var _0x3b3d6f=_0x28bd78['smsQueues'][_0x40f948];var _0x1b459b={'id':_0x3b3d6f['id'],'available':_0x3b3d6f[_0x615d('0x56')],'loggedIn':_0x3b3d6f[_0x615d('0x59')],'name':_0x3b3d6f['name'],'paused':_0x3b3d6f[_0x615d('0x5a')],'waiting':_0x3b3d6f[_0x615d('0x5c')]};_0x195f90[_0x615d('0x24')](_0x1b459b);}}_0x4f0c70({'count':_0x195f90[_0x615d('0x1e')],'rows':_0x195f90});});},'FaxQueues':function(){return new Promise(function(_0x42c268){var _0xd81a50=[];for(var _0x1ef720 in _0x28bd78['faxQueues']){if(_0x28bd78['faxQueues'][_0x615d('0x4e')](_0x1ef720)){var _0x306fec=_0x28bd78['faxQueues'][_0x1ef720];var _0x1cab2e={'id':_0x306fec['id'],'available':_0x306fec[_0x615d('0x56')],'loggedIn':_0x306fec['loggedIn'],'name':_0x306fec[_0x615d('0x57')],'paused':_0x306fec['paused'],'waiting':_0x306fec[_0x615d('0x5c')]};_0xd81a50[_0x615d('0x24')](_0x1cab2e);}}_0x42c268({'count':_0xd81a50[_0x615d('0x1e')],'rows':_0xd81a50});});},'WhatsappQueues':function(){return new Promise(function(_0x9b1fd){var _0x1738af=[];for(var _0xa2122d in _0x28bd78[_0x615d('0x5e')]){if(_0x28bd78[_0x615d('0x5e')][_0x615d('0x4e')](_0xa2122d)){var _0x2d42ef=_0x28bd78[_0x615d('0x5e')][_0xa2122d];var _0x203063={'id':_0x2d42ef['id'],'available':_0x2d42ef['available'],'loggedIn':_0x2d42ef[_0x615d('0x59')],'name':_0x2d42ef[_0x615d('0x57')],'paused':_0x2d42ef[_0x615d('0x5a')],'waiting':_0x2d42ef[_0x615d('0x5c')]};_0x1738af[_0x615d('0x24')](_0x203063);}}_0x9b1fd({'count':_0x1738af[_0x615d('0x1e')],'rows':_0x1738af});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x143662){var _0x59526c=_[_0x615d('0x53')](_0x28bd78[_0x615d('0x5f')]);_0x143662({'count':_0x59526c[_0x615d('0x1e')],'rows':_0x59526c});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x56dfdb){var _0x5d76e4=_[_0x615d('0x53')](_0x28bd78[_0x615d('0x60')]);_0x56dfdb({'count':_0x5d76e4[_0x615d('0x1e')],'rows':_0x5d76e4});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x3e751e){var _0x478b82=_[_0x615d('0x53')](_0x28bd78[_0x615d('0x61')]);_0x3e751e({'count':_0x478b82['length'],'rows':_0x478b82});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x3b361a){var _0x20a921=_[_0x615d('0x53')](_0x28bd78[_0x615d('0x62')]);_0x3b361a({'count':_0x20a921[_0x615d('0x1e')],'rows':_0x20a921});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x525529){var _0xe77cb6=_[_0x615d('0x53')](_0x28bd78['faxQueuesWaitingInteractions']);_0x525529({'count':_0xe77cb6[_0x615d('0x1e')],'rows':_0xe77cb6});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x7bb53d){var _0x1d2927=_['values'](_0x28bd78['whatsappQueuesWaitingInteractions']);_0x7bb53d({'count':_0x1d2927[_0x615d('0x1e')],'rows':_0x1d2927});});}};var _0x59b362=jayson['server'](_0x3280b6)['http']();_0x59b362['on'](_0x615d('0x44'),function(_0x173edc){logger[_0x615d('0x44')](JSON[_0x615d('0x3e')](_0x173edc));return _0x19dc46(_0x173edc);});_0x59b362[_0x615d('0x16')](0x232c,_0x615d('0x63'),function(){console[_0x615d('0x64')](_0x615d('0x65'),0x232c);return _0x205fcd(_0x615d('0x66')+0x232c);});});}; \ No newline at end of file +var _0xf268=['format','%s.%s.%s','IntervalId','isNil','Intervals','interval','rules','channel','message','interaction','checkWaitingNotifications','applications','isArray','length','existsSync','join','app','.js','autoreply','appdata','split','mail','push','slice','dialogflow','amazonlex','TagId','tvox','getMustacheRender','account','notificationTemplate','body','%s:%s:%s','./interval','condition','intervals','./applications/','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Applications\x20executed','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busyQueue','end','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','chatQueues','available','paused','waiting','mailQueues','loggedIn','name','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','stringify','listen','log','util','jayson/promise','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport'];(function(_0x4baad3,_0x2d565f){var _0x3f5e90=function(_0x4d5edb){while(--_0x4d5edb){_0x4baad3['push'](_0x4baad3['shift']());}};_0x3f5e90(++_0x2d565f);}(_0xf268,0x17a));var _0x8f26=function(_0x2bc400,_0x27208f){_0x2bc400=_0x2bc400-0x0;var _0x36ab53=_0xf268[_0x2bc400];return _0x36ab53;};'use strict';var _=require('lodash');var util=require(_0x8f26('0x0'));var path=require('path');var fs=require('fs');var jayson=require(_0x8f26('0x1'));var BPromise=require('bluebird');var utils=require('./applications/utils');var sUtils=require(_0x8f26('0x2'));var logger=require(_0x8f26('0x3'))(_0x8f26('0x4'));var rpc={'openchannelQueueReport':require(_0x8f26('0x5')),'mailQueueReport':require(_0x8f26('0x6')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x8f26('0x7')),'faxQueueReport':require(_0x8f26('0x8')),'whatsappQueueReport':require(_0x8f26('0x9'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x17a937,_0x42f3ea,_0x3e5c97){return util[_0x8f26('0xa')](_0x8f26('0xb'),_0x17a937,_0x42f3ea||0x0,_0x3e5c97||0x0);}function getIntervals(_0x3b0be4,_0x386ca2){var _0x5783a2=[];if(!_['isNil'](_0x386ca2[_0x8f26('0xc')])&&!_[_0x8f26('0xd')](_0x3b0be4[_0x386ca2[_0x8f26('0xc')]])&&!_[_0x8f26('0xd')](_0x3b0be4[_0x386ca2['IntervalId']][_0x8f26('0xe')])){_0x5783a2=_['map'](_0x3b0be4[_0x386ca2[_0x8f26('0xc')]][_0x8f26('0xe')],_0x8f26('0xf'));}else if(!_[_0x8f26('0xd')](_0x386ca2[_0x8f26('0xf')])){_0x5783a2=[_0x386ca2[_0x8f26('0xf')]];}return _0x5783a2;}exports['listen']=function(_0x376073){_0x376073[_0x8f26('0x10')]={};return new BPromise(function(_0x42d655,_0x30644c){var _0x226d8b={'Start':function(_0x4c295a){var _0x707de6=this;return new Promise(function(_0x45430a,_0x31af70){if(_0x4c295a){try{var _0x396910=[];var _0x2ebc16=getId(_0x4c295a[_0x8f26('0x11')],_0x4c295a[_0x8f26('0x12')]?_0x4c295a['message']['id']:0x0,_0x4c295a[_0x8f26('0x13')]?_0x4c295a['interaction']['id']:0x0);var _0x391a0b=sUtils[_0x8f26('0x14')](_0x376073,_0x4c295a);if(!_0x391a0b&&_0x4c295a[_0x8f26('0x15')]&&_[_0x8f26('0x16')](_0x4c295a[_0x8f26('0x15')])&&_0x4c295a['applications'][_0x8f26('0x17')]){for(var _0x24fab1=0x0;_0x24fab1<_0x4c295a['applications'][_0x8f26('0x17')];_0x24fab1+=0x1){var _0x5c83bd=_0x4c295a[_0x8f26('0x15')][_0x24fab1];if(fs[_0x8f26('0x18')](path[_0x8f26('0x19')](__dirname,'applications',_0x5c83bd[_0x8f26('0x1a')]+_0x8f26('0x1b')))){var _0x4b4a88=[];switch(_0x5c83bd[_0x8f26('0x1a')]['toLowerCase']()){case _0x8f26('0x1c'):var _0x1bdc69=_0x5c83bd[_0x8f26('0x1d')][_0x8f26('0x1e')](',');if(_0x4c295a[_0x8f26('0x11')]===_0x8f26('0x1f')){_0x4b4a88[_0x8f26('0x20')](_0x1bdc69[0x0]);_0x4b4a88['push'](_0x1bdc69[0x1]);_0x4b4a88[_0x8f26('0x20')](_0x1bdc69['slice'](0x2,_0x1bdc69['length'])['join'](','));}else{_0x4b4a88[_0x8f26('0x20')](_0x1bdc69[0x0]);_0x4b4a88[_0x8f26('0x20')](_0x1bdc69[_0x8f26('0x21')](0x1,_0x1bdc69[_0x8f26('0x17')])[_0x8f26('0x19')](','));}break;case _0x8f26('0x22'):var _0x3161e8=_0x5c83bd[_0x8f26('0x1d')][_0x8f26('0x1e')](',');_0x4b4a88[_0x8f26('0x20')](_0x3161e8[0x0]);_0x4b4a88[_0x8f26('0x20')](_0x3161e8[0x1]);_0x4b4a88['push'](_0x3161e8['slice'](0x2,_0x3161e8[_0x8f26('0x17')])[_0x8f26('0x19')](','));break;case'dialogflowv2':var _0x36db58=_0x5c83bd[_0x8f26('0x1d')][_0x8f26('0x1e')](',');_0x4b4a88[_0x8f26('0x20')](_0x36db58[0x0]);_0x4b4a88[_0x8f26('0x20')](_0x36db58[0x1]);_0x4b4a88['push'](_0x36db58[0x2]);_0x4b4a88['push'](_0x36db58[0x3]);_0x4b4a88[_0x8f26('0x20')](_0x36db58['slice'](0x4,_0x36db58[_0x8f26('0x17')])['join'](','));break;case _0x8f26('0x23'):var _0x39149b=_0x5c83bd['appdata'][_0x8f26('0x1e')](',');_0x4b4a88[_0x8f26('0x20')](_0x39149b[0x0]);_0x4b4a88[_0x8f26('0x20')](_0x39149b[0x1]);_0x4b4a88[_0x8f26('0x20')](_0x39149b[0x2]);_0x4b4a88[_0x8f26('0x20')](_0x39149b[0x3]);_0x4b4a88['push'](_0x39149b[_0x8f26('0x21')](0x4,_0x39149b[_0x8f26('0x17')])[_0x8f26('0x19')](','));break;case'message':_0x4b4a88[_0x8f26('0x20')](_0x5c83bd[_0x8f26('0x1d')]);break;case'tag':_0x4b4a88[_0x8f26('0x20')](_0x5c83bd[_0x8f26('0x24')]);_0x4b4a88[_0x8f26('0x20')](_0x5c83bd[_0x8f26('0x1d')]);break;case _0x8f26('0x25'):var _0x346dfd=utils[_0x8f26('0x26')](_0x4c295a[_0x8f26('0x27')][_0x8f26('0x28')],_0x4c295a);var _0x3aaf24=_0x5c83bd[_0x8f26('0x1d')][_0x8f26('0x1e')](',');_0x4b4a88[_0x8f26('0x20')](_0x3aaf24[0x0]);_0x4b4a88['push'](_0x3aaf24[0x1]);_0x4b4a88[_0x8f26('0x20')](_0x3aaf24[0x2]);_0x4b4a88[_0x8f26('0x20')](_0x3aaf24[0x3]);_0x4b4a88[_0x8f26('0x20')](_0x3aaf24[0x4]);_0x4b4a88[_0x8f26('0x20')](_0x3aaf24[0x5]);_0x4b4a88[_0x8f26('0x20')](_0x3aaf24[0x6]);_0x4b4a88[_0x8f26('0x20')](_0x3aaf24[0x7]);_0x4b4a88['push'](_0x3aaf24[0x8]);_0x4b4a88['push'](_0x3aaf24[0x9]);_0x4b4a88['push'](_0x3aaf24[0xa]);_0x4b4a88[_0x8f26('0x20')](_0x4c295a[_0x8f26('0x13')]['id']);_0x4b4a88[_0x8f26('0x20')](_0x4c295a[_0x8f26('0x12')]['id']);_0x4b4a88[_0x8f26('0x20')](_0x5c83bd['ChatWebsiteId']);_0x4b4a88[_0x8f26('0x20')](_0x4c295a[_0x8f26('0x13')]['ContactId']);_0x4b4a88[_0x8f26('0x20')](_0x4c295a['body'][_0x8f26('0x29')]);_0x4b4a88[_0x8f26('0x20')](_0x346dfd);break;default:_0x4b4a88=_['isNil'](_0x5c83bd[_0x8f26('0x1d')])?[]:_0x5c83bd[_0x8f26('0x1d')]['split'](',');}var _0x3d2897={'id':util[_0x8f26('0xa')](_0x8f26('0x2a'),_0x2ebc16,_0x5c83bd['id'],_0x5c83bd[_0x8f26('0x1a')]),'condition':require(_0x8f26('0x2b'))[_0x8f26('0x2c')](_0x2ebc16,getIntervals(_0x376073[_0x8f26('0x2d')],_0x5c83bd),_0x376073),'consequence':require(_0x8f26('0x2e')+_0x5c83bd[_0x8f26('0x1a')])['consequence'](_0x2ebc16,_0x4b4a88,_0x376073,_0x4c295a),'p':_0x5c83bd[_0x8f26('0x2f')]||0x0};logger[_0x8f26('0x30')](_0x8f26('0x31'),_0x3d2897['id'],_0x8f26('0x32'),getIntervals(_0x376073['intervals'],_0x5c83bd)[_0x8f26('0x19')](_0x8f26('0x33')));_0x396910['push'](_0x3d2897);}else{logger[_0x8f26('0x34')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0x8f26('0x19')](__dirname,'applications',_0x5c83bd[_0x8f26('0x1a')]+_0x8f26('0x1b')));}}_0x376073[_0x8f26('0x10')][_0x2ebc16]=new RuleEngine(_0x396910);_0x376073[_0x8f26('0x10')][_0x2ebc16]['execute'](_0x4c295a,function(_0x3c0f1b){logger[_0x8f26('0x30')](_0x8f26('0x35'),JSON['stringify'](_0x3c0f1b['matchPath']));if(_0x376073['rules'][_0x2ebc16]){_0x376073[_0x8f26('0x10')][_0x2ebc16][_0x8f26('0x36')](_0x8f26('0x37'));}});return _0x45430a({'code':0xc8,'message':_0x4c295a});}else{if(_0x391a0b){logger[_0x8f26('0x30')](util[_0x8f26('0xa')](_0x8f26('0x38'),_0x2ebc16));}else{logger[_0x8f26('0x30')](_0x8f26('0x39'));}return _0x45430a({'code':0xc8,'message':_0x4c295a});}}catch(_0x518539){logger[_0x8f26('0x34')](_0x518539[_0x8f26('0x3a')]);return _0x31af70(_0x707de6['error'](0x1f4,_0x518539));}}return _0x31af70(_0x8f26('0x3b'));});},'AcceptMessage':function(_0x20d7ba){var _0x506dd3=this;return new Promise(function(_0x36ab65,_0x323795){if(_0x20d7ba[_0x8f26('0x3c')]&&_0x20d7ba['agent']['id']){if(_0x376073[_0x8f26('0x3d')][_0x20d7ba[_0x8f26('0x3c')]['id']]){_0x376073[_0x8f26('0x3d')][_0x20d7ba[_0x8f26('0x3c')]['id']]['busy']=![];_0x376073['agents'][_0x20d7ba[_0x8f26('0x3c')]['id']][_0x8f26('0x3e')]=undefined;}}if(_0x20d7ba['message']&&_0x20d7ba[_0x8f26('0x12')]['id']){try{var _0xf9b0f4=getId(_0x20d7ba[_0x8f26('0x11')],_0x20d7ba[_0x8f26('0x12')]?_0x20d7ba[_0x8f26('0x12')]['id']:0x0,_0x20d7ba[_0x8f26('0x13')]?_0x20d7ba[_0x8f26('0x13')]['id']:0x0);if(_0x376073['rules'][_0xf9b0f4]){_0x376073[_0x8f26('0x10')][_0xf9b0f4][_0x8f26('0x36')](_0x8f26('0x3f'));if(rpc[_0x20d7ba[_0x8f26('0x11')]+'QueueReport']){rpc[_0x20d7ba[_0x8f26('0x11')]+'QueueReport'][_0x8f26('0x40')](_0xf9b0f4,{'UserId':_0x20d7ba[_0x8f26('0x12')][_0x8f26('0x41')]})[_0x8f26('0x42')](function(){logger[_0x8f26('0x34')](_0x8f26('0x43'));});}}return _0x36ab65({'code':0xc8,'message':_0x20d7ba});}catch(_0x587cd6){logger['error'](_0x587cd6[_0x8f26('0x3a')]);return _0x323795(_0x506dd3[_0x8f26('0x34')](0x1f4,_0x587cd6));}}logger[_0x8f26('0x34')](_0x8f26('0x44'));return _0x323795(_0x506dd3['error'](0x1f4,_0x8f26('0x44')));});},'RejectMessage':function(_0x5aee2d){var _0x22b376=this;return new Promise(function(_0x177c10,_0x10481b){if(_0x5aee2d[_0x8f26('0x3c')]&&_0x5aee2d[_0x8f26('0x3c')]['id']){try{if(_0x376073[_0x8f26('0x3d')][_0x5aee2d[_0x8f26('0x3c')]['id']]){_0x376073[_0x8f26('0x3d')][_0x5aee2d[_0x8f26('0x3c')]['id']][_0x8f26('0x45')]=![];_0x376073[_0x8f26('0x3d')][_0x5aee2d[_0x8f26('0x3c')]['id']][_0x8f26('0x3e')]=undefined;}return _0x177c10({'code':0xc8,'message':_0x5aee2d});}catch(_0x46305c){logger['error'](_0x46305c[_0x8f26('0x3a')]);return _0x10481b(_0x22b376[_0x8f26('0x34')](0x1f4,_0x46305c));}}logger['error']('message\x20is\x20empty');return _0x10481b(_0x22b376['error'](0x1f4,_0x8f26('0x44')));});},'AbandonInteraction':function(_0x5ac65d){var _0x5a4ab9=this;return new Promise(function(_0xb6644b,_0x225e57){if(_0x5ac65d['channel']&&_0x5ac65d['interaction']&&_0x5ac65d['interaction']['id']){try{var _0x29aa3f=getId(_0x5ac65d[_0x8f26('0x11')],_0x5ac65d['message']?_0x5ac65d[_0x8f26('0x12')]['id']:0x0,_0x5ac65d[_0x8f26('0x13')]?_0x5ac65d['interaction']['id']:0x0);if(_0x376073[_0x8f26('0x10')][_0x29aa3f]){_0x376073[_0x8f26('0x10')][_0x29aa3f]['emit'](_0x8f26('0x3f'));}return _0xb6644b({'code':0xc8,'message':_0x5ac65d});}catch(_0x34981b){logger['error'](_0x34981b[_0x8f26('0x3a')]);return _0x225e57(_0x5a4ab9[_0x8f26('0x34')](0x1f4,_0x34981b));}}logger['error']('message\x20is\x20empty');return _0x225e57(_0x5a4ab9[_0x8f26('0x34')](0x1f4,_0x8f26('0x44')));});},'AgentCapacity':function(_0x411aa4){var _0x565189=this;return new Promise(function(_0x2ba201,_0x3651eb){if(_0x376073[_0x8f26('0x3d')][_0x8f26('0x46')](_0x411aa4['id'])){for(var _0x1f5f47 in _0x411aa4[_0x8f26('0x47')]){if(_0x411aa4['capacity'][_0x8f26('0x46')](_0x1f5f47)){if(_0x376073[_0x8f26('0x3d')][_0x411aa4['id']][_0x8f26('0x46')](_0x1f5f47+'CurrentCapacity')){_0x376073[_0x8f26('0x3d')][_0x411aa4['id']][_0x1f5f47+_0x8f26('0x48')]=parseInt(_0x411aa4[_0x8f26('0x47')][_0x1f5f47],0xa);}}}_0x376073[_0x8f26('0x3d')][_0x411aa4['id']][_0x8f26('0x49')]();return _0x2ba201({'code':0xc8,'message':_0x376073[_0x8f26('0x3d')][_0x411aa4['id']]});}else{return _0x3651eb(_0x565189[_0x8f26('0x34')](0x1f4,_0x8f26('0x4a')));}});},'Agents':function(_0x22b83c){return new Promise(function(_0xa470a9){var _0x1b53d3=_['values'](_0x376073[_0x8f26('0x3d')]);if(_0x22b83c&&_0x22b83c['id']){var _0x420c1a=_['find'](_0x1b53d3,function(_0x3d22c6){return _0x3d22c6['id']===_0x22b83c['id'];});_0xa470a9(_0x420c1a);}else{_0xa470a9({'count':_0x1b53d3[_0x8f26('0x17')],'rows':_0x1b53d3});}});},'ChatQueues':function(){return new Promise(function(_0x1b9f4a){var _0x38380f=[];for(var _0x3dd5ce in _0x376073[_0x8f26('0x4b')]){if(_0x376073[_0x8f26('0x4b')]['hasOwnProperty'](_0x3dd5ce)){var _0x218f9f=_0x376073['chatQueues'][_0x3dd5ce];var _0x98b600={'id':_0x218f9f['id'],'available':_0x218f9f[_0x8f26('0x4c')],'loggedIn':_0x218f9f['loggedIn'],'name':_0x218f9f['name'],'paused':_0x218f9f[_0x8f26('0x4d')],'waiting':_0x218f9f[_0x8f26('0x4e')]};_0x38380f[_0x8f26('0x20')](_0x98b600);}}_0x1b9f4a({'count':_0x38380f[_0x8f26('0x17')],'rows':_0x38380f});});},'MailQueues':function(){return new Promise(function(_0xe00e2b){var _0x5cc5df=[];for(var _0xb7ca92 in _0x376073[_0x8f26('0x4f')]){if(_0x376073[_0x8f26('0x4f')]['hasOwnProperty'](_0xb7ca92)){var _0x17e5d7=_0x376073[_0x8f26('0x4f')][_0xb7ca92];var _0x46f0cd={'id':_0x17e5d7['id'],'available':_0x17e5d7[_0x8f26('0x4c')],'loggedIn':_0x17e5d7[_0x8f26('0x50')],'name':_0x17e5d7[_0x8f26('0x51')],'paused':_0x17e5d7[_0x8f26('0x4d')],'waiting':_0x17e5d7[_0x8f26('0x4e')]};_0x5cc5df[_0x8f26('0x20')](_0x46f0cd);}}_0xe00e2b({'count':_0x5cc5df[_0x8f26('0x17')],'rows':_0x5cc5df});});},'OpenchannelQueues':function(){return new Promise(function(_0x3f9a4d){var _0x439bc6=[];for(var _0x1a7cde in _0x376073[_0x8f26('0x52')]){if(_0x376073[_0x8f26('0x52')][_0x8f26('0x46')](_0x1a7cde)){var _0x319fb7=_0x376073['openchannelQueues'][_0x1a7cde];var _0x57ed60={'id':_0x319fb7['id'],'available':_0x319fb7['available'],'loggedIn':_0x319fb7[_0x8f26('0x50')],'name':_0x319fb7[_0x8f26('0x51')],'paused':_0x319fb7['paused'],'waiting':_0x319fb7['waiting']};_0x439bc6[_0x8f26('0x20')](_0x57ed60);}}_0x3f9a4d({'count':_0x439bc6[_0x8f26('0x17')],'rows':_0x439bc6});});},'SmsQueues':function(){return new Promise(function(_0x41df58){var _0x4732bb=[];for(var _0x16f557 in _0x376073['smsQueues']){if(_0x376073[_0x8f26('0x53')][_0x8f26('0x46')](_0x16f557)){var _0x2f590d=_0x376073[_0x8f26('0x53')][_0x16f557];var _0x155e18={'id':_0x2f590d['id'],'available':_0x2f590d['available'],'loggedIn':_0x2f590d[_0x8f26('0x50')],'name':_0x2f590d['name'],'paused':_0x2f590d[_0x8f26('0x4d')],'waiting':_0x2f590d[_0x8f26('0x4e')]};_0x4732bb['push'](_0x155e18);}}_0x41df58({'count':_0x4732bb[_0x8f26('0x17')],'rows':_0x4732bb});});},'FaxQueues':function(){return new Promise(function(_0x2bb4a3){var _0x515236=[];for(var _0x33ee97 in _0x376073[_0x8f26('0x54')]){if(_0x376073[_0x8f26('0x54')][_0x8f26('0x46')](_0x33ee97)){var _0x2e993c=_0x376073[_0x8f26('0x54')][_0x33ee97];var _0x4c0a91={'id':_0x2e993c['id'],'available':_0x2e993c[_0x8f26('0x4c')],'loggedIn':_0x2e993c[_0x8f26('0x50')],'name':_0x2e993c[_0x8f26('0x51')],'paused':_0x2e993c[_0x8f26('0x4d')],'waiting':_0x2e993c['waiting']};_0x515236['push'](_0x4c0a91);}}_0x2bb4a3({'count':_0x515236[_0x8f26('0x17')],'rows':_0x515236});});},'WhatsappQueues':function(){return new Promise(function(_0x4317a1){var _0x31d1a6=[];for(var _0x468758 in _0x376073[_0x8f26('0x55')]){if(_0x376073[_0x8f26('0x55')][_0x8f26('0x46')](_0x468758)){var _0x392d37=_0x376073['whatsappQueues'][_0x468758];var _0x5859e0={'id':_0x392d37['id'],'available':_0x392d37[_0x8f26('0x4c')],'loggedIn':_0x392d37[_0x8f26('0x50')],'name':_0x392d37['name'],'paused':_0x392d37[_0x8f26('0x4d')],'waiting':_0x392d37['waiting']};_0x31d1a6[_0x8f26('0x20')](_0x5859e0);}}_0x4317a1({'count':_0x31d1a6['length'],'rows':_0x31d1a6});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x50debb){var _0x3001d2=_[_0x8f26('0x56')](_0x376073[_0x8f26('0x57')]);_0x50debb({'count':_0x3001d2[_0x8f26('0x17')],'rows':_0x3001d2});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x84bff0){var _0x407bdb=_[_0x8f26('0x56')](_0x376073[_0x8f26('0x58')]);_0x84bff0({'count':_0x407bdb['length'],'rows':_0x407bdb});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x4a1844){var _0x43c451=_[_0x8f26('0x56')](_0x376073[_0x8f26('0x59')]);_0x4a1844({'count':_0x43c451[_0x8f26('0x17')],'rows':_0x43c451});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x45d398){var _0x5d117f=_[_0x8f26('0x56')](_0x376073[_0x8f26('0x5a')]);_0x45d398({'count':_0x5d117f['length'],'rows':_0x5d117f});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0xc76185){var _0x1f8270=_[_0x8f26('0x56')](_0x376073[_0x8f26('0x5b')]);_0xc76185({'count':_0x1f8270[_0x8f26('0x17')],'rows':_0x1f8270});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x4ffa22){var _0x557e82=_[_0x8f26('0x56')](_0x376073[_0x8f26('0x5c')]);_0x4ffa22({'count':_0x557e82[_0x8f26('0x17')],'rows':_0x557e82});});}};var _0x2ef4db=jayson[_0x8f26('0x5d')](_0x226d8b)['http']();_0x2ef4db['on'](_0x8f26('0x34'),function(_0x54eea2){logger[_0x8f26('0x34')](JSON[_0x8f26('0x5e')](_0x54eea2));return _0x30644c(_0x54eea2);});_0x2ef4db[_0x8f26('0x5f')](0x232c,'127.0.0.1',function(){console[_0x8f26('0x60')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x42d655('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 aecfd4e..e7df919 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 _0x6554=['\x20|\x20','stop','bluebird','jayson/promise','../../../config/logger','routing','http','then','error','message','rules','info','length','push','Command','format','iftime\x20%s','indexOf','true','catch','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','log'];(function(_0x5053ff,_0x3fb835){var _0x2d4f6c=function(_0x5a6323){while(--_0x5a6323){_0x5053ff['push'](_0x5053ff['shift']());}};_0x2d4f6c(++_0x3fb835);}(_0x6554,0x120));var _0x4655=function(_0x45b374,_0x20dccb){_0x45b374=_0x45b374-0x0;var _0x24fc74=_0x6554[_0x45b374];return _0x24fc74;};'use strict';var util=require('util');var BPromise=require(_0x4655('0x0'));var jayson=require(_0x4655('0x1'));var _=require('lodash');var logger=require(_0x4655('0x2'))(_0x4655('0x3'));var client=jayson['client'][_0x4655('0x4')]({'port':0x232a});function request(_0x13ea49,_0x1363a2){return new BPromise(function(_0x4089f5,_0x189970){return client['request'](_0x13ea49,_0x1363a2)[_0x4655('0x5')](function(_0xf00b1){if(_0xf00b1['error']){return _0x189970(_0xf00b1[_0x4655('0x6')][_0x4655('0x7')]);}else{return _0x4089f5(_0xf00b1['result']);}})['catch'](function(_0x2dd764){return _0x189970(_0x2dd764);});});}exports['condition']=function(_0x56e10e,_0xd728db,_0xde65f1){return function(_0x45140c){if(_0xde65f1[_0x4655('0x8')]&&!_0xde65f1[_0x4655('0x8')][_0x56e10e]){logger[_0x4655('0x9')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x56e10e);return _0x45140c['stop']();}var _0x1cefbd=[];for(var _0x274dc4=0x0;_0x274dc4<_0xd728db[_0x4655('0xa')];_0x274dc4+=0x1){_0x1cefbd[_0x4655('0xb')](request(_0x4655('0xc'),{'command':util[_0x4655('0xd')](_0x4655('0xe'),_0xd728db[_0x274dc4])})[_0x4655('0x5')](function(_0xdf16d1){return _0xdf16d1&&_0xdf16d1[_0x4655('0x7')]&&_0xdf16d1[_0x4655('0x7')][_0x4655('0xf')](_0x4655('0x10'))>=0x0?!![]:![];})[_0x4655('0x11')](function(_0x16912c){logger['error'](_0x4655('0x12'),_0x56e10e,_0xd728db[_0x274dc4]);}));}BPromise[_0x4655('0x13')](_0x1cefbd)[_0x4655('0x5')](function(_0x26eee4){var _0x30c81b=_[_0x4655('0x14')](_0x26eee4);logger[_0x4655('0x9')](_0x4655('0x15'),_0x56e10e,_0xd728db[_0x4655('0x16')]('\x20|\x20'),_0x30c81b);_0x45140c['when'](_0x30c81b);})['catch'](function(_0xc38168){console[_0x4655('0x17')](_0xc38168);logger[_0x4655('0x6')](_0x4655('0x15'),_0x56e10e,_0xd728db[_0x4655('0x16')](_0x4655('0x18')),_0xc38168['stack']);_0x45140c[_0x4655('0x19')]();});};}; \ No newline at end of file +var _0x8ea6=['true','[%s][INTERVAL]\x20%s','then','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','client','http','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','format','iftime\x20%s'];(function(_0x11345e,_0x4e243a){var _0x40ac8c=function(_0x340273){while(--_0x340273){_0x11345e['push'](_0x11345e['shift']());}};_0x40ac8c(++_0x4e243a);}(_0x8ea6,0x7d));var _0x68ea=function(_0x20b3a6,_0x546e02){_0x20b3a6=_0x20b3a6-0x0;var _0x5a1b28=_0x8ea6[_0x20b3a6];return _0x5a1b28;};'use strict';var util=require(_0x68ea('0x0'));var BPromise=require(_0x68ea('0x1'));var jayson=require(_0x68ea('0x2'));var _=require(_0x68ea('0x3'));var logger=require(_0x68ea('0x4'))('routing');var client=jayson[_0x68ea('0x5')][_0x68ea('0x6')]({'port':0x232a});function request(_0x23ba04,_0x27670b){return new BPromise(function(_0x239a94,_0x268a08){return client['request'](_0x23ba04,_0x27670b)['then'](function(_0x527a5a){if(_0x527a5a['error']){return _0x268a08(_0x527a5a[_0x68ea('0x7')][_0x68ea('0x8')]);}else{return _0x239a94(_0x527a5a[_0x68ea('0x9')]);}})[_0x68ea('0xa')](function(_0x404850){return _0x268a08(_0x404850);});});}exports[_0x68ea('0xb')]=function(_0x289e5d,_0xb0e4c2,_0x5dd4b8){return function(_0x438335){if(_0x5dd4b8[_0x68ea('0xc')]&&!_0x5dd4b8[_0x68ea('0xc')][_0x289e5d]){logger[_0x68ea('0xd')](_0x68ea('0xe'),_0x289e5d);return _0x438335[_0x68ea('0xf')]();}var _0x356780=[];for(var _0x447253=0x0;_0x447253<_0xb0e4c2[_0x68ea('0x10')];_0x447253+=0x1){_0x356780[_0x68ea('0x11')](request('Command',{'command':util[_0x68ea('0x12')](_0x68ea('0x13'),_0xb0e4c2[_0x447253])})['then'](function(_0x1b4c0a){return _0x1b4c0a&&_0x1b4c0a[_0x68ea('0x8')]&&_0x1b4c0a[_0x68ea('0x8')]['indexOf'](_0x68ea('0x14'))>=0x0?!![]:![];})['catch'](function(_0x38d40a){logger[_0x68ea('0x7')](_0x68ea('0x15'),_0x289e5d,_0xb0e4c2[_0x447253]);}));}BPromise['all'](_0x356780)[_0x68ea('0x16')](function(_0xf2aabe){var _0x1d11c9=_['some'](_0xf2aabe);logger[_0x68ea('0xd')](_0x68ea('0x17'),_0x289e5d,_0xb0e4c2[_0x68ea('0x18')](_0x68ea('0x19')),_0x1d11c9);_0x438335[_0x68ea('0x1a')](_0x1d11c9);})[_0x68ea('0xa')](function(_0x5560c4){console[_0x68ea('0x1b')](_0x5560c4);logger[_0x68ea('0x7')](_0x68ea('0x17'),_0x289e5d,_0xb0e4c2[_0x68ea('0x18')](_0x68ea('0x19')),_0x5560c4[_0x68ea('0x1c')]);_0x438335[_0x68ea('0xf')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 1ec1601..71e9675 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 _0x5ff3=['ringtime','talktime','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheremembername','agentcompleteAt','complete','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfertype','blind','transferexten','extension','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','origtransfererexten','transfereeuniqueid','clone','calleridname','agententerreason','secondtransfererlinkedid','transfer','ATTENDED','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','diffTime','agent','util','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','membername','interface','calleridnum','connectedlinenum','then','type','agentcomplete','acw','acwTimeout','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','lastevent','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','reason','timeout','holdtime'];(function(_0x494477,_0x4ff203){var _0x2acdb3=function(_0x32c82b){while(--_0x32c82b){_0x494477['push'](_0x494477['shift']());}};_0x2acdb3(++_0x4ff203);}(_0x5ff3,0x17d));var _0x35ff=function(_0xcf32ad,_0x507fa6){_0xcf32ad=_0xcf32ad-0x0;var _0x1fab7b=_0x5ff3[_0xcf32ad];return _0x1fab7b;};'use strict';var _=require('lodash');var util=require(_0x35ff('0x0'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x1763a,_0x47c98d){utils[_0x35ff('0x1')](util[_0x35ff('0x2')](_0x35ff('0x3'),_0x1763a[_0x35ff('0x4')],_0x1763a['channel'],_0x1763a[_0x35ff('0x5')],_0x1763a[_0x35ff('0x6')],_0x1763a[_0x35ff('0x7')],_0x1763a[_0x35ff('0x8')],_0x1763a[_0x35ff('0x9')],_0x1763a['lastevent']));if(_0x1763a[_0x35ff('0x5')]){utils['getVoiceQueueByName'](_0x1763a[_0x35ff('0x5')])[_0x35ff('0xa')](function(_0x224ce5){if(_0x224ce5){_0x1763a['type']=_0x224ce5[_0x35ff('0xb')];_0x1763a['agentacw']=_0x1763a[_0x35ff('0xc')]?_0x224ce5[_0x35ff('0xd')]:![];_0x1763a['acwtime']=_0x1763a['agentacw']?_0x224ce5[_0x35ff('0xe')]:0x0;}utils['request']('CreateVoiceAgentReport',_0x1763a);});}else{utils['request'](_0x35ff('0xf'),_0x1763a);}if(_0x47c98d){delete transfers[_0x1763a[_0x35ff('0x4')]];}else{delete agents[_0x1763a[_0x35ff('0x10')]];}}exports[_0x35ff('0x11')]=function(_0x559e33){try{utils[_0x35ff('0x12')](util[_0x35ff('0x2')](_0x35ff('0x13'),_0x559e33['uniqueid']),_0x559e33);agents[_0x559e33[_0x35ff('0x10')]]=_0x559e33;agents[_0x559e33[_0x35ff('0x10')]][_0x35ff('0x14')]=utils[_0x35ff('0x15')]();agents[_0x559e33[_0x35ff('0x10')]][_0x35ff('0x16')]=_0x35ff('0x17');agents[_0x559e33[_0x35ff('0x10')]][_0x35ff('0x9')]=null;agents[_0x559e33[_0x35ff('0x10')]][_0x35ff('0x18')]=null;utils[_0x35ff('0x1')](util[_0x35ff('0x2')](_0x35ff('0x19'),_0x559e33[_0x35ff('0x4')],agents[_0x559e33['destuniqueid']][_0x35ff('0x6')],_0x559e33[_0x35ff('0x10')]));}catch(_0x350e71){utils[_0x35ff('0x1a')](util['format']('[%s][agents][agentcalled]',_0x559e33[_0x35ff('0x4')]),_0x350e71);}};exports[_0x35ff('0x1b')]=function(_0x4c8dd4){try{if(!_[_0x35ff('0x1c')](agents[_0x4c8dd4[_0x35ff('0x10')]])){utils[_0x35ff('0x12')](util[_0x35ff('0x2')]('[%s][agents][agentringnoanswer]',_0x4c8dd4[_0x35ff('0x4')]),_0x4c8dd4);utils['info'](util[_0x35ff('0x2')](_0x35ff('0x1d'),_0x4c8dd4[_0x35ff('0x4')],agents[_0x4c8dd4[_0x35ff('0x10')]][_0x35ff('0x6')],_0x4c8dd4[_0x35ff('0x10')]));agents[_0x4c8dd4[_0x35ff('0x10')]]['agentringnoanswer']=!![];agents[_0x4c8dd4[_0x35ff('0x10')]][_0x35ff('0x1e')]=utils['now']();agents[_0x4c8dd4[_0x35ff('0x10')]]['lastevent']='timeout';agents[_0x4c8dd4[_0x35ff('0x10')]][_0x35ff('0x1f')]=_0x35ff('0x20');agents[_0x4c8dd4[_0x35ff('0x10')]][_0x35ff('0x21')]=_0x4c8dd4['ringtime']?parseInt(_0x4c8dd4[_0x35ff('0x22')])/0x3e8:0x0;agents[_0x4c8dd4[_0x35ff('0x10')]][_0x35ff('0x23')]=0x0;unanswered['push'](_0x4c8dd4[_0x35ff('0x10')]);}}catch(_0x1f51c5){utils[_0x35ff('0x1a')](util[_0x35ff('0x2')](_0x35ff('0x24'),_0x4c8dd4[_0x35ff('0x4')]),_0x1f51c5);}};exports[_0x35ff('0x25')]=function(_0xdf6ff){try{_[_0x35ff('0x26')](agents,function(_0x47d8fa,_0x3f9440){if(_0x47d8fa['uniqueid']==_0xdf6ff[_0x35ff('0x4')]&&!_[_0x35ff('0x27')](unanswered,_0x47d8fa[_0x35ff('0x10')])){utils[_0x35ff('0x12')](util['format'](_0x35ff('0x28'),_0xdf6ff['uniqueid']),_0xdf6ff);utils[_0x35ff('0x1')](util[_0x35ff('0x2')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0xdf6ff['uniqueid'],_0x47d8fa[_0x35ff('0x6')],_0x47d8fa[_0x35ff('0x10')]));_0x47d8fa['agentringnoanswer']=!![];_0x47d8fa[_0x35ff('0x1e')]=utils[_0x35ff('0x15')]();_0x47d8fa['lastevent']=_0x35ff('0x29');_0x47d8fa[_0x35ff('0x1f')]=_0x35ff('0x29');_0x47d8fa[_0x35ff('0x21')]=_0xdf6ff[_0x35ff('0x21')];_0x47d8fa[_0x35ff('0x23')]=0x0;writeDB(_0x47d8fa);}});}catch(_0x293edc){utils[_0x35ff('0x1a')](util[_0x35ff('0x2')](_0x35ff('0x28'),_0xdf6ff[_0x35ff('0x4')]),_0x293edc);}};exports[_0x35ff('0x2a')]=function(_0x41b48d){try{if(agents[_0x41b48d['destuniqueid']]){utils[_0x35ff('0x12')](util['format'](_0x35ff('0x2b'),_0x41b48d[_0x35ff('0x4')]),_0x41b48d);utils[_0x35ff('0x1')](util[_0x35ff('0x2')](_0x35ff('0x2c'),_0x41b48d['uniqueid'],agents[_0x41b48d[_0x35ff('0x10')]][_0x35ff('0x6')],_0x41b48d[_0x35ff('0x10')]));agents[_0x41b48d[_0x35ff('0x10')]][_0x35ff('0x2d')]=utils['now']();agents[_0x41b48d[_0x35ff('0x10')]][_0x35ff('0x9')]=_0x41b48d[_0x35ff('0x9')];agents[_0x41b48d['destuniqueid']]['connectedlinename']=_0x41b48d[_0x35ff('0x18')];agents[_0x41b48d[_0x35ff('0x10')]][_0x35ff('0x21')]=_0x41b48d[_0x35ff('0x22')];agents[_0x41b48d[_0x35ff('0x10')]][_0x35ff('0x16')]=_0x35ff('0x2e');_[_0x35ff('0x26')](agents,function(_0x5dc229,_0x5dcc7c){if(_0x5dc229['destuniqueid']!=_0x41b48d[_0x35ff('0x10')]&&_0x5dc229[_0x35ff('0x4')]==_0x41b48d[_0x35ff('0x4')]){_0x5dc229[_0x35ff('0x23')]=0x0;_0x5dc229[_0x35ff('0x21')]=_0x41b48d['ringtime'];_0x5dc229[_0x35ff('0x1b')]=!![];_0x5dc229[_0x35ff('0x1e')]=utils[_0x35ff('0x15')]();_0x5dc229[_0x35ff('0x16')]=_0x35ff('0x2f');_0x5dc229[_0x35ff('0x1f')]='answered_elsewhere';_0x5dc229['answeredelsewheredestinationuniqueid']=_0x41b48d[_0x35ff('0x10')];_0x5dc229[_0x35ff('0x30')]=_0x41b48d[_0x35ff('0x6')];writeDB(_0x5dc229);}});}}catch(_0x21b123){utils['error'](util['format'](_0x35ff('0x2b'),_0x41b48d[_0x35ff('0x4')]),_0x21b123);}};exports[_0x35ff('0xc')]=function(_0x1cd2c8){try{if(!_[_0x35ff('0x1c')](agents[_0x1cd2c8[_0x35ff('0x10')]])){utils[_0x35ff('0x12')](util['format']('[%s][agents][agentcomplete]',_0x1cd2c8[_0x35ff('0x4')]),_0x1cd2c8);utils[_0x35ff('0x1')](util[_0x35ff('0x2')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x1cd2c8[_0x35ff('0x4')],agents[_0x1cd2c8[_0x35ff('0x10')]]['membername'],_0x1cd2c8['destuniqueid']));agents[_0x1cd2c8[_0x35ff('0x10')]]['agentcomplete']=!![];agents[_0x1cd2c8[_0x35ff('0x10')]][_0x35ff('0x31')]=utils['now']();agents[_0x1cd2c8[_0x35ff('0x10')]]['talktime']=utils['diffTime'](agents[_0x1cd2c8[_0x35ff('0x10')]][_0x35ff('0x31')],agents[_0x1cd2c8[_0x35ff('0x10')]][_0x35ff('0x2d')]);agents[_0x1cd2c8[_0x35ff('0x10')]][_0x35ff('0x1f')]=_0x1cd2c8[_0x35ff('0x1f')];agents[_0x1cd2c8[_0x35ff('0x10')]][_0x35ff('0x16')]=_0x35ff('0x32');writeDB(agents[_0x1cd2c8[_0x35ff('0x10')]]);}}catch(_0x2d3f46){utils['error'](util[_0x35ff('0x2')](_0x35ff('0x33'),_0x1cd2c8[_0x35ff('0x4')]),_0x2d3f46);}};exports[_0x35ff('0x34')]=function(_0x506def){try{if(!_['isNil'](agents[_0x506def[_0x35ff('0x35')]])){utils['debug'](util[_0x35ff('0x2')](_0x35ff('0x36'),_0x506def[_0x35ff('0x4')]),_0x506def);utils[_0x35ff('0x1')](util[_0x35ff('0x2')](_0x35ff('0x37'),_0x506def[_0x35ff('0x4')],agents[_0x506def[_0x35ff('0x35')]][_0x35ff('0x6')],agents[_0x506def['transfereruniqueid']]['uniqueid']));agents[_0x506def[_0x35ff('0x35')]]['transfer']=!![];agents[_0x506def[_0x35ff('0x35')]][_0x35ff('0x38')]=_0x35ff('0x39');agents[_0x506def[_0x35ff('0x35')]][_0x35ff('0x3a')]=_0x506def[_0x35ff('0x3b')];agents[_0x506def[_0x35ff('0x35')]][_0x35ff('0x3c')]=agents[_0x506def[_0x35ff('0x35')]]['uniqueid'];}}catch(_0x3aa649){utils[_0x35ff('0x1a')](util[_0x35ff('0x2')](_0x35ff('0x36'),_0x506def['uniqueid']),_0x3aa649);}};exports['attendedtransfer']=function(_0x591776){try{utils[_0x35ff('0x12')](util[_0x35ff('0x2')](_0x35ff('0x3d'),_0x591776['origtransfereruniqueid']),_0x591776);if(_0x591776[_0x35ff('0x3e')]==_0x591776['origtransfererlinkedid']){if(!_[_0x35ff('0x1c')](agents[_0x591776['secondtransfereruniqueid']])){utils[_0x35ff('0x1')](util[_0x35ff('0x2')](_0x35ff('0x3f'),_0x591776[_0x35ff('0x3e')],agents[_0x591776['secondtransfereruniqueid']]['membername']));agents[_0x591776[_0x35ff('0x40')]]['transfer']=!![];agents[_0x591776[_0x35ff('0x40')]][_0x35ff('0x38')]='ATTENDED';agents[_0x591776[_0x35ff('0x40')]]['transferexten']=_0x591776[_0x35ff('0x41')];agents[_0x591776[_0x35ff('0x40')]][_0x35ff('0x3c')]=_0x591776[_0x35ff('0x3e')];}if(_0x591776[_0x35ff('0x42')]&&agents[_0x591776[_0x35ff('0x42')]]){agents[_0x591776['transfereeuniqueid']]['agententerreason']=0x1;transfers[_0x591776[_0x35ff('0x42')]]=_[_0x35ff('0x43')](agents[_0x591776['transfereeuniqueid']]);transfers[_0x591776[_0x35ff('0x42')]][_0x35ff('0x8')]=agents[_0x591776['secondtransfereruniqueid']][_0x35ff('0x8')];transfers[_0x591776[_0x35ff('0x42')]][_0x35ff('0x44')]=agents[_0x591776[_0x35ff('0x40')]][_0x35ff('0x44')];transfers[_0x591776['transfereeuniqueid']]['agentcalledAt']=utils['now']();transfers[_0x591776[_0x35ff('0x42')]]['agentconnectAt']=utils[_0x35ff('0x15')]();transfers[_0x591776['transfereeuniqueid']][_0x35ff('0x21')]=0x0;transfers[_0x591776[_0x35ff('0x42')]][_0x35ff('0x45')]=0x2;}}else if(_0x591776[_0x35ff('0x40')]==_0x591776[_0x35ff('0x46')]){if(!_[_0x35ff('0x1c')](agents[_0x591776['origtransfereruniqueid']])){utils[_0x35ff('0x1')](util[_0x35ff('0x2')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x591776[_0x35ff('0x3e')],agents[_0x591776[_0x35ff('0x3e')]][_0x35ff('0x6')]));agents[_0x591776[_0x35ff('0x3e')]][_0x35ff('0x47')]=!![];agents[_0x591776[_0x35ff('0x3e')]][_0x35ff('0x38')]=_0x35ff('0x48');agents[_0x591776[_0x35ff('0x3e')]]['transferexten']=_0x591776[_0x35ff('0x49')];agents[_0x591776[_0x35ff('0x3e')]][_0x35ff('0x3c')]=_0x591776[_0x35ff('0x40')];}if(_0x591776[_0x35ff('0x4a')]&&agents[_0x591776[_0x35ff('0x4a')]]){agents[_0x591776['transfertargetuniqueid']][_0x35ff('0x45')]=0x1;transfers[_0x591776[_0x35ff('0x4a')]]=_[_0x35ff('0x43')](agents[_0x591776['transfertargetuniqueid']]);transfers[_0x591776[_0x35ff('0x4a')]]['calleridnum']=agents[_0x591776['origtransfereruniqueid']][_0x35ff('0x8')];transfers[_0x591776[_0x35ff('0x4a')]]['calleridname']=agents[_0x591776[_0x35ff('0x3e')]][_0x35ff('0x44')];transfers[_0x591776[_0x35ff('0x4a')]][_0x35ff('0x14')]=utils[_0x35ff('0x15')]();transfers[_0x591776[_0x35ff('0x4a')]][_0x35ff('0x2d')]=utils[_0x35ff('0x15')]();transfers[_0x591776[_0x35ff('0x4a')]][_0x35ff('0x21')]=0x0;transfers[_0x591776[_0x35ff('0x4a')]][_0x35ff('0x45')]=0x2;}}}catch(_0xbfda70){utils[_0x35ff('0x1a')](util[_0x35ff('0x2')](_0x35ff('0x3d'),_0x591776['origtransfereruniqueid']),_0xbfda70);}};exports[_0x35ff('0x4b')]=function(_0x229ca2){try{utils['debug'](util[_0x35ff('0x2')](_0x35ff('0x4c'),_0x229ca2['uniqueid']),_0x229ca2);if(agents[_0x229ca2['uniqueid']]&&agents[_0x229ca2[_0x35ff('0x4')]]['reason']===_0x35ff('0x20')){if(_0x229ca2[_0x35ff('0x4d')]==='21'){agents[_0x229ca2[_0x35ff('0x4')]][_0x35ff('0x1f')]=_0x35ff('0x4e');agents[_0x229ca2[_0x35ff('0x4')]][_0x35ff('0x16')]=_0x35ff('0x4e');}utils[_0x35ff('0x1')](util['format'](_0x35ff('0x4f'),_0x229ca2['uniqueid'],agents[_0x229ca2[_0x35ff('0x4')]]['membername'],agents[_0x229ca2[_0x35ff('0x4')]][_0x35ff('0x1f')],agents[_0x229ca2[_0x35ff('0x4')]][_0x35ff('0x16')]));writeDB(agents[_0x229ca2[_0x35ff('0x4')]]);var _0x4857d1=unanswered[_0x35ff('0x50')](_0x229ca2[_0x35ff('0x4')]);if(_0x4857d1>-0x1){unanswered['splice'](_0x4857d1,0x1);}}if(transfers[_0x229ca2['uniqueid']]){transfers[_0x229ca2[_0x35ff('0x4')]][_0x35ff('0xc')]=!![];transfers[_0x229ca2['uniqueid']][_0x35ff('0x31')]=utils[_0x35ff('0x15')]();transfers[_0x229ca2[_0x35ff('0x4')]]['talktime']=utils[_0x35ff('0x51')](transfers[_0x229ca2[_0x35ff('0x4')]][_0x35ff('0x31')],transfers[_0x229ca2['uniqueid']][_0x35ff('0x2d')]);transfers[_0x229ca2[_0x35ff('0x4')]][_0x35ff('0x1f')]=_0x35ff('0x52');transfers[_0x229ca2[_0x35ff('0x4')]]['lastevent']=_0x35ff('0x32');utils[_0x35ff('0x1')](util[_0x35ff('0x2')](_0x35ff('0x4f'),_0x229ca2[_0x35ff('0x4')],transfers[_0x229ca2[_0x35ff('0x4')]][_0x35ff('0x6')],transfers[_0x229ca2['uniqueid']][_0x35ff('0x1f')],transfers[_0x229ca2[_0x35ff('0x4')]][_0x35ff('0x16')]));writeDB(transfers[_0x229ca2[_0x35ff('0x4')]],!![]);}if(agents[_0x229ca2[_0x35ff('0x4')]]&&agents[_0x229ca2[_0x35ff('0x4')]][_0x35ff('0x2d')]){agents[_0x229ca2['uniqueid']][_0x35ff('0xc')]=!![];agents[_0x229ca2['uniqueid']][_0x35ff('0x31')]=utils[_0x35ff('0x15')]();agents[_0x229ca2[_0x35ff('0x4')]][_0x35ff('0x23')]=utils[_0x35ff('0x51')](agents[_0x229ca2['uniqueid']]['agentcompleteAt'],agents[_0x229ca2[_0x35ff('0x4')]]['agentconnectAt']);agents[_0x229ca2[_0x35ff('0x4')]][_0x35ff('0x1f')]=agents[_0x229ca2[_0x35ff('0x4')]][_0x35ff('0x47')]?_0x35ff('0x47'):_0x35ff('0x52');agents[_0x229ca2[_0x35ff('0x4')]]['lastevent']=_0x35ff('0x32');utils['info'](util[_0x35ff('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x229ca2[_0x35ff('0x4')],agents[_0x229ca2[_0x35ff('0x4')]][_0x35ff('0x6')],agents[_0x229ca2['uniqueid']]['reason'],agents[_0x229ca2[_0x35ff('0x4')]][_0x35ff('0x16')]));writeDB(agents[_0x229ca2['uniqueid']]);}}catch(_0xf9c766){utils[_0x35ff('0x1a')](util['format'](_0x35ff('0x4c'),_0x229ca2[_0x35ff('0x4')]),_0xf9c766);}}; \ No newline at end of file +var _0x0972=['clone','calleridname','[%s][agents][attendedtransfer]','hangup','[%s][agents][hangup]','timeout','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','util','info','format','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','isNil','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswer','agentringnoanswerAt','lastevent','reason','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','holdtime','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connect','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','agentconnectAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfertype','transferexten','extension','transferuniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfereruniqueid','secondtransfereruniqueid','transfer','origtransfererexten','transfereeuniqueid','agententerreason','secondtransfererlinkedid','ATTENDED','secondtransfererexten','transfertargetuniqueid'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0972,0x64));var _0x2097=function(_0x546f5f,_0x1c0a82){_0x546f5f=_0x546f5f-0x0;var _0x3bb416=_0x0972[_0x546f5f];return _0x3bb416;};'use strict';var _=require('lodash');var util=require(_0x2097('0x0'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x1c7a40,_0x4ec7aa){utils[_0x2097('0x1')](util[_0x2097('0x2')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x1c7a40[_0x2097('0x3')],_0x1c7a40[_0x2097('0x4')],_0x1c7a40[_0x2097('0x5')],_0x1c7a40[_0x2097('0x6')],_0x1c7a40[_0x2097('0x7')],_0x1c7a40[_0x2097('0x8')],_0x1c7a40[_0x2097('0x9')],_0x1c7a40['lastevent']));if(_0x1c7a40[_0x2097('0x5')]){utils[_0x2097('0xa')](_0x1c7a40[_0x2097('0x5')])[_0x2097('0xb')](function(_0x3b8fac){if(_0x3b8fac){_0x1c7a40['type']=_0x3b8fac[_0x2097('0xc')];_0x1c7a40[_0x2097('0xd')]=_0x1c7a40[_0x2097('0xe')]?_0x3b8fac[_0x2097('0xf')]:![];_0x1c7a40[_0x2097('0x10')]=_0x1c7a40[_0x2097('0xd')]?_0x3b8fac[_0x2097('0x11')]:0x0;}utils[_0x2097('0x12')](_0x2097('0x13'),_0x1c7a40);});}else{utils[_0x2097('0x12')](_0x2097('0x13'),_0x1c7a40);}if(_0x4ec7aa){delete transfers[_0x1c7a40[_0x2097('0x3')]];}else{delete agents[_0x1c7a40[_0x2097('0x14')]];}}exports[_0x2097('0x15')]=function(_0x24ca42){try{utils[_0x2097('0x16')](util[_0x2097('0x2')](_0x2097('0x17'),_0x24ca42[_0x2097('0x3')]),_0x24ca42);agents[_0x24ca42[_0x2097('0x14')]]=_0x24ca42;agents[_0x24ca42['destuniqueid']][_0x2097('0x18')]=utils[_0x2097('0x19')]();agents[_0x24ca42['destuniqueid']]['lastevent']='called';agents[_0x24ca42[_0x2097('0x14')]]['connectedlinenum']=null;agents[_0x24ca42[_0x2097('0x14')]][_0x2097('0x1a')]=null;utils[_0x2097('0x1')](util[_0x2097('0x2')](_0x2097('0x1b'),_0x24ca42['uniqueid'],agents[_0x24ca42[_0x2097('0x14')]][_0x2097('0x6')],_0x24ca42[_0x2097('0x14')]));}catch(_0x34654a){utils[_0x2097('0x1c')](util[_0x2097('0x2')](_0x2097('0x17'),_0x24ca42[_0x2097('0x3')]),_0x34654a);}};exports['agentringnoanswer']=function(_0x4d957e){try{if(!_[_0x2097('0x1d')](agents[_0x4d957e['destuniqueid']])){utils[_0x2097('0x16')](util[_0x2097('0x2')]('[%s][agents][agentringnoanswer]',_0x4d957e[_0x2097('0x3')]),_0x4d957e);utils['info'](util[_0x2097('0x2')](_0x2097('0x1e'),_0x4d957e[_0x2097('0x3')],agents[_0x4d957e[_0x2097('0x14')]][_0x2097('0x6')],_0x4d957e[_0x2097('0x14')]));agents[_0x4d957e['destuniqueid']][_0x2097('0x1f')]=!![];agents[_0x4d957e['destuniqueid']][_0x2097('0x20')]=utils[_0x2097('0x19')]();agents[_0x4d957e[_0x2097('0x14')]][_0x2097('0x21')]='timeout';agents[_0x4d957e[_0x2097('0x14')]][_0x2097('0x22')]='timeout';agents[_0x4d957e[_0x2097('0x14')]]['holdtime']=_0x4d957e[_0x2097('0x23')]?parseInt(_0x4d957e['ringtime'])/0x3e8:0x0;agents[_0x4d957e[_0x2097('0x14')]][_0x2097('0x24')]=0x0;unanswered[_0x2097('0x25')](_0x4d957e[_0x2097('0x14')]);}}catch(_0x410afa){utils[_0x2097('0x1c')](util[_0x2097('0x2')]('[%s][agents][agentringnoanswer]',_0x4d957e[_0x2097('0x3')]),_0x410afa);}};exports[_0x2097('0x26')]=function(_0x5cce55){try{_[_0x2097('0x27')](agents,function(_0x41487d,_0x59fb84){if(_0x41487d['uniqueid']==_0x5cce55[_0x2097('0x3')]&&!_[_0x2097('0x28')](unanswered,_0x41487d[_0x2097('0x14')])){utils[_0x2097('0x16')](util[_0x2097('0x2')](_0x2097('0x29'),_0x5cce55['uniqueid']),_0x5cce55);utils[_0x2097('0x1')](util['format'](_0x2097('0x2a'),_0x5cce55[_0x2097('0x3')],_0x41487d[_0x2097('0x6')],_0x41487d[_0x2097('0x14')]));_0x41487d[_0x2097('0x1f')]=!![];_0x41487d[_0x2097('0x20')]=utils[_0x2097('0x19')]();_0x41487d[_0x2097('0x21')]=_0x2097('0x2b');_0x41487d['reason']=_0x2097('0x2b');_0x41487d[_0x2097('0x2c')]=_0x5cce55[_0x2097('0x2c')];_0x41487d['talktime']=0x0;writeDB(_0x41487d);}});}catch(_0x3d97ee){utils[_0x2097('0x1c')](util[_0x2097('0x2')](_0x2097('0x29'),_0x5cce55['uniqueid']),_0x3d97ee);}};exports['agentconnect']=function(_0x5689f6){try{if(agents[_0x5689f6[_0x2097('0x14')]]){utils[_0x2097('0x16')](util[_0x2097('0x2')](_0x2097('0x2d'),_0x5689f6[_0x2097('0x3')]),_0x5689f6);utils[_0x2097('0x1')](util['format'](_0x2097('0x2e'),_0x5689f6[_0x2097('0x3')],agents[_0x5689f6[_0x2097('0x14')]][_0x2097('0x6')],_0x5689f6[_0x2097('0x14')]));agents[_0x5689f6[_0x2097('0x14')]]['agentconnectAt']=utils[_0x2097('0x19')]();agents[_0x5689f6[_0x2097('0x14')]][_0x2097('0x9')]=_0x5689f6['connectedlinenum'];agents[_0x5689f6['destuniqueid']][_0x2097('0x1a')]=_0x5689f6[_0x2097('0x1a')];agents[_0x5689f6[_0x2097('0x14')]][_0x2097('0x2c')]=_0x5689f6[_0x2097('0x23')];agents[_0x5689f6[_0x2097('0x14')]][_0x2097('0x21')]=_0x2097('0x2f');_[_0x2097('0x27')](agents,function(_0x3bfb5c,_0x337979){if(_0x3bfb5c[_0x2097('0x14')]!=_0x5689f6['destuniqueid']&&_0x3bfb5c[_0x2097('0x3')]==_0x5689f6[_0x2097('0x3')]){_0x3bfb5c[_0x2097('0x24')]=0x0;_0x3bfb5c['holdtime']=_0x5689f6[_0x2097('0x23')];_0x3bfb5c[_0x2097('0x1f')]=!![];_0x3bfb5c[_0x2097('0x20')]=utils[_0x2097('0x19')]();_0x3bfb5c[_0x2097('0x21')]=_0x2097('0x30');_0x3bfb5c[_0x2097('0x22')]=_0x2097('0x30');_0x3bfb5c['answeredelsewheredestinationuniqueid']=_0x5689f6[_0x2097('0x14')];_0x3bfb5c[_0x2097('0x31')]=_0x5689f6[_0x2097('0x6')];writeDB(_0x3bfb5c);}});}}catch(_0x3288ae){utils[_0x2097('0x1c')](util[_0x2097('0x2')](_0x2097('0x2d'),_0x5689f6[_0x2097('0x3')]),_0x3288ae);}};exports['agentcomplete']=function(_0x3fc3fe){try{if(!_['isNil'](agents[_0x3fc3fe[_0x2097('0x14')]])){utils[_0x2097('0x16')](util[_0x2097('0x2')](_0x2097('0x32'),_0x3fc3fe[_0x2097('0x3')]),_0x3fc3fe);utils['info'](util[_0x2097('0x2')](_0x2097('0x33'),_0x3fc3fe[_0x2097('0x3')],agents[_0x3fc3fe[_0x2097('0x14')]][_0x2097('0x6')],_0x3fc3fe['destuniqueid']));agents[_0x3fc3fe[_0x2097('0x14')]][_0x2097('0xe')]=!![];agents[_0x3fc3fe[_0x2097('0x14')]][_0x2097('0x34')]=utils[_0x2097('0x19')]();agents[_0x3fc3fe[_0x2097('0x14')]][_0x2097('0x24')]=utils[_0x2097('0x35')](agents[_0x3fc3fe['destuniqueid']][_0x2097('0x34')],agents[_0x3fc3fe[_0x2097('0x14')]][_0x2097('0x36')]);agents[_0x3fc3fe[_0x2097('0x14')]]['reason']=_0x3fc3fe['reason'];agents[_0x3fc3fe['destuniqueid']][_0x2097('0x21')]=_0x2097('0x37');writeDB(agents[_0x3fc3fe['destuniqueid']]);}}catch(_0x10577d){utils[_0x2097('0x1c')](util['format']('[%s][agents][agentcomplete]',_0x3fc3fe[_0x2097('0x3')]),_0x10577d);}};exports[_0x2097('0x38')]=function(_0x1b4de6){try{if(!_['isNil'](agents[_0x1b4de6[_0x2097('0x39')]])){utils[_0x2097('0x16')](util['format'](_0x2097('0x3a'),_0x1b4de6[_0x2097('0x3')]),_0x1b4de6);utils[_0x2097('0x1')](util[_0x2097('0x2')](_0x2097('0x3b'),_0x1b4de6['uniqueid'],agents[_0x1b4de6['transfereruniqueid']][_0x2097('0x6')],agents[_0x1b4de6[_0x2097('0x39')]][_0x2097('0x3')]));agents[_0x1b4de6['transfereruniqueid']]['transfer']=!![];agents[_0x1b4de6[_0x2097('0x39')]][_0x2097('0x3c')]='blind';agents[_0x1b4de6[_0x2097('0x39')]][_0x2097('0x3d')]=_0x1b4de6[_0x2097('0x3e')];agents[_0x1b4de6[_0x2097('0x39')]][_0x2097('0x3f')]=agents[_0x1b4de6['transfereruniqueid']][_0x2097('0x3')];}}catch(_0x228b60){utils[_0x2097('0x1c')](util['format'](_0x2097('0x3a'),_0x1b4de6[_0x2097('0x3')]),_0x228b60);}};exports['attendedtransfer']=function(_0x12ba76){try{utils['debug'](util[_0x2097('0x2')]('[%s][agents][attendedtransfer]',_0x12ba76['origtransfereruniqueid']),_0x12ba76);if(_0x12ba76['origtransfereruniqueid']==_0x12ba76[_0x2097('0x40')]){if(!_['isNil'](agents[_0x12ba76['secondtransfereruniqueid']])){utils[_0x2097('0x1')](util['format'](_0x2097('0x41'),_0x12ba76[_0x2097('0x42')],agents[_0x12ba76['secondtransfereruniqueid']][_0x2097('0x6')]));agents[_0x12ba76[_0x2097('0x43')]][_0x2097('0x44')]=!![];agents[_0x12ba76[_0x2097('0x43')]][_0x2097('0x3c')]='ATTENDED';agents[_0x12ba76[_0x2097('0x43')]]['transferexten']=_0x12ba76[_0x2097('0x45')];agents[_0x12ba76[_0x2097('0x43')]][_0x2097('0x3f')]=_0x12ba76['origtransfereruniqueid'];}if(_0x12ba76[_0x2097('0x46')]&&agents[_0x12ba76[_0x2097('0x46')]]){agents[_0x12ba76[_0x2097('0x46')]][_0x2097('0x47')]=0x1;transfers[_0x12ba76[_0x2097('0x46')]]=_['clone'](agents[_0x12ba76['transfereeuniqueid']]);transfers[_0x12ba76[_0x2097('0x46')]][_0x2097('0x8')]=agents[_0x12ba76['secondtransfereruniqueid']]['calleridnum'];transfers[_0x12ba76['transfereeuniqueid']]['calleridname']=agents[_0x12ba76[_0x2097('0x43')]]['calleridname'];transfers[_0x12ba76[_0x2097('0x46')]][_0x2097('0x18')]=utils['now']();transfers[_0x12ba76[_0x2097('0x46')]][_0x2097('0x36')]=utils[_0x2097('0x19')]();transfers[_0x12ba76[_0x2097('0x46')]][_0x2097('0x2c')]=0x0;transfers[_0x12ba76[_0x2097('0x46')]][_0x2097('0x47')]=0x2;}}else if(_0x12ba76[_0x2097('0x43')]==_0x12ba76[_0x2097('0x48')]){if(!_['isNil'](agents[_0x12ba76[_0x2097('0x42')]])){utils[_0x2097('0x1')](util[_0x2097('0x2')](_0x2097('0x41'),_0x12ba76[_0x2097('0x42')],agents[_0x12ba76[_0x2097('0x42')]]['membername']));agents[_0x12ba76[_0x2097('0x42')]][_0x2097('0x44')]=!![];agents[_0x12ba76[_0x2097('0x42')]][_0x2097('0x3c')]=_0x2097('0x49');agents[_0x12ba76['origtransfereruniqueid']][_0x2097('0x3d')]=_0x12ba76[_0x2097('0x4a')];agents[_0x12ba76['origtransfereruniqueid']]['transferuniqueid']=_0x12ba76['secondtransfereruniqueid'];}if(_0x12ba76[_0x2097('0x4b')]&&agents[_0x12ba76[_0x2097('0x4b')]]){agents[_0x12ba76[_0x2097('0x4b')]][_0x2097('0x47')]=0x1;transfers[_0x12ba76[_0x2097('0x4b')]]=_[_0x2097('0x4c')](agents[_0x12ba76[_0x2097('0x4b')]]);transfers[_0x12ba76[_0x2097('0x4b')]][_0x2097('0x8')]=agents[_0x12ba76['origtransfereruniqueid']]['calleridnum'];transfers[_0x12ba76[_0x2097('0x4b')]][_0x2097('0x4d')]=agents[_0x12ba76[_0x2097('0x42')]][_0x2097('0x4d')];transfers[_0x12ba76[_0x2097('0x4b')]][_0x2097('0x18')]=utils['now']();transfers[_0x12ba76[_0x2097('0x4b')]][_0x2097('0x36')]=utils[_0x2097('0x19')]();transfers[_0x12ba76[_0x2097('0x4b')]]['holdtime']=0x0;transfers[_0x12ba76['transfertargetuniqueid']][_0x2097('0x47')]=0x2;}}}catch(_0x345a12){utils['error'](util[_0x2097('0x2')](_0x2097('0x4e'),_0x12ba76[_0x2097('0x42')]),_0x345a12);}};exports[_0x2097('0x4f')]=function(_0x1f824f){try{utils[_0x2097('0x16')](util[_0x2097('0x2')](_0x2097('0x50'),_0x1f824f['uniqueid']),_0x1f824f);if(agents[_0x1f824f[_0x2097('0x3')]]&&agents[_0x1f824f[_0x2097('0x3')]]['reason']===_0x2097('0x51')){if(_0x1f824f[_0x2097('0x52')]==='21'){agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0x22')]=_0x2097('0x53');agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0x21')]=_0x2097('0x53');}utils[_0x2097('0x1')](util[_0x2097('0x2')](_0x2097('0x54'),_0x1f824f['uniqueid'],agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0x6')],agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0x22')],agents[_0x1f824f[_0x2097('0x3')]]['lastevent']));writeDB(agents[_0x1f824f[_0x2097('0x3')]]);var _0x2a950f=unanswered[_0x2097('0x55')](_0x1f824f['uniqueid']);if(_0x2a950f>-0x1){unanswered[_0x2097('0x56')](_0x2a950f,0x1);}}if(transfers[_0x1f824f['uniqueid']]){transfers[_0x1f824f[_0x2097('0x3')]]['agentcomplete']=!![];transfers[_0x1f824f[_0x2097('0x3')]]['agentcompleteAt']=utils[_0x2097('0x19')]();transfers[_0x1f824f['uniqueid']][_0x2097('0x24')]=utils[_0x2097('0x35')](transfers[_0x1f824f[_0x2097('0x3')]][_0x2097('0x34')],transfers[_0x1f824f[_0x2097('0x3')]]['agentconnectAt']);transfers[_0x1f824f[_0x2097('0x3')]][_0x2097('0x22')]=_0x2097('0x57');transfers[_0x1f824f[_0x2097('0x3')]][_0x2097('0x21')]=_0x2097('0x37');utils[_0x2097('0x1')](util[_0x2097('0x2')](_0x2097('0x54'),_0x1f824f[_0x2097('0x3')],transfers[_0x1f824f[_0x2097('0x3')]][_0x2097('0x6')],transfers[_0x1f824f[_0x2097('0x3')]][_0x2097('0x22')],transfers[_0x1f824f[_0x2097('0x3')]][_0x2097('0x21')]));writeDB(transfers[_0x1f824f['uniqueid']],!![]);}if(agents[_0x1f824f[_0x2097('0x3')]]&&agents[_0x1f824f['uniqueid']]['agentconnectAt']){agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0xe')]=!![];agents[_0x1f824f[_0x2097('0x3')]]['agentcompleteAt']=utils[_0x2097('0x19')]();agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0x24')]=utils[_0x2097('0x35')](agents[_0x1f824f['uniqueid']][_0x2097('0x34')],agents[_0x1f824f['uniqueid']][_0x2097('0x36')]);agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0x22')]=agents[_0x1f824f[_0x2097('0x3')]]['transfer']?_0x2097('0x44'):_0x2097('0x57');agents[_0x1f824f[_0x2097('0x3')]]['lastevent']=_0x2097('0x37');utils[_0x2097('0x1')](util[_0x2097('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x1f824f[_0x2097('0x3')],agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0x6')],agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0x22')],agents[_0x1f824f[_0x2097('0x3')]]['lastevent']));writeDB(agents[_0x1f824f['uniqueid']]);}}catch(_0xc7481d){utils[_0x2097('0x1c')](util[_0x2097('0x2')](_0x2097('0x50'),_0x1f824f[_0x2097('0x3')]),_0xc7481d);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index c42276a..dcb3142 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 _0x6691=['now','DOCUMENTATION','error','[%s][calls][newchannel]','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','disposition','toNumber','ANSWERED','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','starttime','billableseconds','answertime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','secondtransfererchannel','userfield','_attended','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','xmd-queue','xmcs-queue','Queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','type','outboundrouteid','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','newexten','[%s][calls][newexten]','application','appdata','toLowerCase','set','startsWith','cdr','split','lastIndexOf','noop','execif','lastapplication','lastdata','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','BUSY','uniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','recording','blinds','newchannel','debug','linkedid','OutgoingSpoolFailed','context','exten'];(function(_0x21aed4,_0x438e0b){var _0x35be4e=function(_0x5bd625){while(--_0x5bd625){_0x21aed4['push'](_0x21aed4['shift']());}};_0x35be4e(++_0x438e0b);}(_0x6691,0x12d));var _0x1669=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x6691[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x1669('0x0'));var util=require(_0x1669('0x1'));var utils=require(_0x1669('0x2'));var transfers=require(_0x1669('0x3'));var dispositions=[_0x1669('0x4'),_0x1669('0x5'),_0x1669('0x5'),_0x1669('0x4'),_0x1669('0x4'),_0x1669('0x4'),'ANSWERED',_0x1669('0x6'),_0x1669('0x5'),_0x1669('0x5'),_0x1669('0x5')];var channels={};function writeDB(_0x55393c){var _0x5d23fd;if(transfers['blinds'][_0x55393c[_0x1669('0x7')]]){_0x5d23fd=_0x55393c['uniqueid'];_0x55393c['uniqueid']=transfers['blinds'][_0x55393c[_0x1669('0x7')]]['transfereeuniqueid'];}utils[_0x1669('0x8')](util[_0x1669('0x9')](_0x1669('0xa'),_0x55393c[_0x1669('0x7')],_0x55393c[_0x1669('0xb')],_0x55393c[_0x1669('0xc')],_0x55393c[_0x1669('0xd')],_0x55393c[_0x1669('0xe')],_0x55393c[_0x1669('0xf')],_0x55393c[_0x1669('0x10')],_0x55393c[_0x1669('0x11')]));if(_0x55393c[_0x1669('0x12')]){utils[_0x1669('0x13')](_0x55393c[_0x1669('0x12')])[_0x1669('0x14')](function(_0x355ac3){if(_0x355ac3){_0x55393c[_0x1669('0x15')]=_0x355ac3['id'];}utils[_0x1669('0x16')](_0x1669('0x17'),_0x55393c);});}else{utils[_0x1669('0x16')](_0x1669('0x17'),_0x55393c);}if(channels[_0x55393c[_0x1669('0x7')]]){delete channels[_0x55393c[_0x1669('0x7')]];}else if(_0x5d23fd&&channels[_0x5d23fd]){if(!transfers['blinds'][_0x5d23fd][_0x1669('0x18')])delete transfers[_0x1669('0x19')][_0x5d23fd];delete channels[_0x5d23fd];}}exports[_0x1669('0x1a')]=function(_0x395e32){try{utils[_0x1669('0x1b')](util['format']('[%s][calls][newchannel]',_0x395e32[_0x1669('0x7')]),_0x395e32);if(_0x395e32[_0x1669('0x7')]==_0x395e32[_0x1669('0x1c')]&&_0x395e32[_0x1669('0xb')]!=_0x1669('0x1d')){utils[_0x1669('0x8')](util[_0x1669('0x9')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x395e32[_0x1669('0x7')],_0x395e32[_0x1669('0x1e')],_0x395e32['exten']));channels[_0x395e32[_0x1669('0x7')]]={'uniqueid':_0x395e32[_0x1669('0x7')],'accountcode':_0x395e32['accountcode'],'source':_0x395e32[_0x1669('0xf')],'destination':_0x395e32[_0x1669('0x1f')],'destinationcontext':_0x395e32[_0x1669('0x1e')],'channel':_0x395e32[_0x1669('0xb')],'starttime':utils[_0x1669('0x20')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x1669('0x21')};}}catch(_0x457973){utils[_0x1669('0x22')](util['format'](_0x1669('0x23'),_0x395e32['uniqueid']),_0x457973);}};exports['newstate']=function(_0x238ce2){try{utils['debug'](util[_0x1669('0x9')](_0x1669('0x24'),_0x238ce2[_0x1669('0x7')]),_0x238ce2);if(!_[_0x1669('0x25')](channels[_0x238ce2[_0x1669('0x7')]])&&_0x238ce2[_0x1669('0x26')]==0x6){utils[_0x1669('0x8')](util['format'](_0x1669('0x27'),_0x238ce2['uniqueid'],_0x238ce2[_0x1669('0x1e')],_0x238ce2[_0x1669('0xb')]));if(_['isNil'](channels[_0x238ce2[_0x1669('0x7')]]['systemanswertime'])){channels[_0x238ce2[_0x1669('0x7')]][_0x1669('0x28')]=utils[_0x1669('0x20')]();}}else if(!_[_0x1669('0x25')](channels[_0x238ce2['linkedid']])&&_0x238ce2['channelstate']==0x6&&_0x238ce2['context']!=_0x1669('0x29')){utils[_0x1669('0x8')](util[_0x1669('0x9')](_0x1669('0x2a'),_0x238ce2[_0x1669('0x7')],_0x238ce2['linkedid'],_0x238ce2[_0x1669('0x1e')],_0x238ce2[_0x1669('0xb')]));channels[_0x238ce2[_0x1669('0x1c')]][_0x1669('0x12')]=_0x238ce2[_0x1669('0x12')];channels[_0x238ce2[_0x1669('0x1c')]][_0x1669('0x2b')]=_0x238ce2[_0x1669('0xb')];if(_['isNil'](channels[_0x238ce2[_0x1669('0x1c')]]['answertime'])){channels[_0x238ce2[_0x1669('0x1c')]]['answertime']=utils['now']();}channels[_0x238ce2[_0x1669('0x1c')]][_0x1669('0x2c')]=dispositions[_[_0x1669('0x2d')](_0x238ce2[_0x1669('0x26')])]||_0x1669('0x2e');}}catch(_0x257ef0){utils[_0x1669('0x22')](util[_0x1669('0x9')](_0x1669('0x24'),_0x238ce2['uniqueid']),_0x257ef0);}};exports[_0x1669('0x2f')]=function(_0x40fc23){try{if(!_[_0x1669('0x25')](channels[_0x40fc23[_0x1669('0x7')]])){utils[_0x1669('0x1b')](util[_0x1669('0x9')](_0x1669('0x30'),_0x40fc23['uniqueid']),_0x40fc23);if(_[_0x1669('0x25')](channels[_0x40fc23[_0x1669('0x7')]][_0x1669('0x31')])){channels[_0x40fc23[_0x1669('0x7')]][_0x1669('0x31')]=_0x40fc23[_0x1669('0x32')]+'\x20<'+_0x40fc23['calleridnum']+'>';}utils['info'](util['format'](_0x1669('0x33'),_0x40fc23[_0x1669('0x7')],channels[_0x40fc23[_0x1669('0x7')]][_0x1669('0x31')],_0x40fc23[_0x1669('0x34')]));channels[_0x40fc23[_0x1669('0x7')]][_0x1669('0x35')]=utils['now']();channels[_0x40fc23[_0x1669('0x7')]][_0x1669('0x36')]=utils['diffTime'](channels[_0x40fc23['uniqueid']][_0x1669('0x35')],channels[_0x40fc23[_0x1669('0x7')]][_0x1669('0x37')]);channels[_0x40fc23[_0x1669('0x7')]][_0x1669('0x38')]=channels[_0x40fc23['uniqueid']][_0x1669('0x39')]?utils['diffTime'](channels[_0x40fc23['uniqueid']][_0x1669('0x35')],channels[_0x40fc23['uniqueid']][_0x1669('0x39')]):0x0;writeDB(channels[_0x40fc23[_0x1669('0x7')]]);}}catch(_0x374552){utils[_0x1669('0x22')](util['format'](_0x1669('0x30'),_0x40fc23[_0x1669('0x7')]),_0x374552);}};exports[_0x1669('0x3a')]=function(_0x528c48){try{if(!_[_0x1669('0x25')](channels[_0x528c48[_0x1669('0x3b')]])){utils[_0x1669('0x1b')](util[_0x1669('0x9')](_0x1669('0x3c'),_0x528c48[_0x1669('0x3d')]),_0x528c48);if(channels[_0x528c48[_0x1669('0x3b')]]['channel']==_0x528c48[_0x1669('0x3e')]){utils['info'](util[_0x1669('0x9')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x528c48[_0x1669('0x3d')],_0x528c48[_0x1669('0x3b')],_0x528c48[_0x1669('0x3f')]));channels[_0x528c48[_0x1669('0x3b')]][_0x1669('0x2b')]=_0x528c48[_0x1669('0x3f')];channels[_0x528c48['localtwolinkedid']][_0x1669('0x40')]=_0x1669('0x41');}else if(channels[_0x528c48[_0x1669('0x3b')]]['channel']=_0x528c48['transfertargetchannel']){utils['info'](util['format'](_0x1669('0x42'),_0x528c48[_0x1669('0x3d')],_0x528c48[_0x1669('0x3b')],_0x528c48['origtransfererchannel']));channels[_0x528c48['localtwolinkedid']][_0x1669('0x2b')]=_0x528c48['origtransfererchannel'];channels[_0x528c48[_0x1669('0x3b')]][_0x1669('0x40')]=_0x1669('0x41');}}}catch(_0x371542){utils[_0x1669('0x22')](util[_0x1669('0x9')](_0x1669('0x3c'),_0x528c48['origtransfereruniqueid']),_0x371542);}};exports[_0x1669('0x43')]=function(_0x5733e8){try{if(!_[_0x1669('0x25')](channels[_0x5733e8['uniqueid']])){utils['debug'](util[_0x1669('0x9')](_0x1669('0x44'),_0x5733e8[_0x1669('0x7')]),_0x5733e8);channels[_0x5733e8[_0x1669('0x7')]][_0x1669('0x45')]=utils[_0x1669('0x20')]();utils['info'](util[_0x1669('0x9')](_0x1669('0x46'),_0x5733e8['uniqueid'],channels[_0x5733e8[_0x1669('0x7')]][_0x1669('0x45')]));}}catch(_0x4b9e08){utils['error'](util[_0x1669('0x9')](_0x1669('0x44'),_0x5733e8[_0x1669('0x7')]),_0x4b9e08);}};exports[_0x1669('0x47')]=function(_0x590ea1){try{if(!_[_0x1669('0x25')](channels[_0x590ea1[_0x1669('0x7')]])){utils[_0x1669('0x1b')](util['format'](_0x1669('0x48'),_0x590ea1['uniqueid']),_0x590ea1);if(!_['isNil'](channels[_0x590ea1[_0x1669('0x7')]]['musiconholdstartAt'])){channels[_0x590ea1['uniqueid']][_0x1669('0x49')]+=utils['diffTime'](utils[_0x1669('0x20')](),channels[_0x590ea1[_0x1669('0x7')]][_0x1669('0x45')]);utils[_0x1669('0x8')](util['format'](_0x1669('0x4a'),_0x590ea1['uniqueid'],channels[_0x590ea1['uniqueid']]['mohtime']));delete channels[_0x590ea1[_0x1669('0x7')]][_0x1669('0x45')];}}}catch(_0x25385f){utils[_0x1669('0x22')](util[_0x1669('0x9')](_0x1669('0x48'),_0x590ea1[_0x1669('0x7')]),_0x25385f);}};exports[_0x1669('0x4b')]=function(_0x43636c){try{if(!_[_0x1669('0x25')](channels[_0x43636c[_0x1669('0x7')]])){utils[_0x1669('0x1b')](util['format'](_0x1669('0x4c'),_0x43636c['uniqueid']),_0x43636c);if(!_['isNil'](_0x43636c[_0x1669('0x4d')]['xmd-originatecalleridnum'])){utils[_0x1669('0x8')](util[_0x1669('0x9')](_0x1669('0x4e'),_0x43636c[_0x1669('0x7')],_0x43636c['value']));channels[_0x43636c['uniqueid']]['source']=_0x43636c[_0x1669('0x4f')];}if(!_[_0x1669('0x25')](_0x43636c[_0x1669('0x4d')]['xmd-phone'])){utils['info'](util[_0x1669('0x9')](_0x1669('0x50'),_0x43636c[_0x1669('0x7')],_0x43636c[_0x1669('0x4f')]));channels[_0x43636c['uniqueid']][_0x1669('0x51')]=_0x43636c[_0x1669('0x4f')];channels[_0x43636c[_0x1669('0x7')]][_0x1669('0x31')]='\x22'+_0x43636c[_0x1669('0x4f')]+'\x22\x20<'+_0x43636c['value']+'>';}if(!_['isNil'](_0x43636c[_0x1669('0x4d')][_0x1669('0x52')])||!_[_0x1669('0x25')](_0x43636c['variable']['xmd-callerid'])){utils['info'](util['format'](_0x1669('0x53'),_0x43636c[_0x1669('0x7')],!_[_0x1669('0x25')](_0x43636c[_0x1669('0x4d')]['xmd-callerid-preview'])?_0x1669('0x52'):_0x1669('0x54'),_0x43636c[_0x1669('0x4f')]));channels[_0x43636c[_0x1669('0x7')]][_0x1669('0x31')]=_0x43636c['value'];}if(!_['isNil'](_0x43636c[_0x1669('0x4d')][_0x1669('0x55')])||!_['isNil'](_0x43636c[_0x1669('0x4d')][_0x1669('0x56')])){utils[_0x1669('0x8')](util[_0x1669('0x9')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x43636c['uniqueid'],!_[_0x1669('0x25')](_0x43636c[_0x1669('0x4d')][_0x1669('0x55')])?_0x1669('0x55'):_0x1669('0x56'),_0x43636c[_0x1669('0x4f')]));channels[_0x43636c[_0x1669('0x7')]]['lastapplication']=_0x1669('0x57');channels[_0x43636c[_0x1669('0x7')]]['lastdata']=_0x43636c[_0x1669('0x4f')];channels[_0x43636c[_0x1669('0x7')]]['queue']=!![];}if(!_['isNil'](_0x43636c[_0x1669('0x4d')][_0x1669('0x58')])){utils[_0x1669('0x8')](util[_0x1669('0x9')](_0x1669('0x59'),_0x43636c[_0x1669('0x7')],_0x43636c[_0x1669('0x4f')]));channels[_0x43636c[_0x1669('0x7')]][_0x1669('0x5a')]=_0x43636c[_0x1669('0x4f')];}if(!_[_0x1669('0x25')](_0x43636c[_0x1669('0x4d')][_0x1669('0x5b')])){utils[_0x1669('0x8')](util[_0x1669('0x9')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x43636c[_0x1669('0x7')],_0x43636c[_0x1669('0x4f')]));channels[_0x43636c['uniqueid']][_0x1669('0x5c')]=_0x43636c[_0x1669('0x4f')];}if(!_['isNil'](_0x43636c['variable'][_0x1669('0x5d')])){utils[_0x1669('0x8')](util['format']('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x43636c[_0x1669('0x7')],_0x43636c[_0x1669('0x4f')]));channels[_0x43636c[_0x1669('0x7')]][_0x1669('0x5e')]=_0x43636c[_0x1669('0x4f')];}if(!_[_0x1669('0x25')](_0x43636c[_0x1669('0x4d')]['sipcallid'])){utils['info'](util[_0x1669('0x9')](_0x1669('0x5f'),_0x43636c[_0x1669('0x7')],_0x43636c[_0x1669('0x4f')]));channels[_0x43636c['uniqueid']][_0x1669('0x60')]=_0x43636c[_0x1669('0x4f')];}}}catch(_0x31bea0){utils[_0x1669('0x22')](util['format'](_0x1669('0x4c'),_0x43636c['uniqueid']),_0x31bea0);}};exports[_0x1669('0x61')]=function(_0x48ba40){try{if(!_['isNil'](channels[_0x48ba40[_0x1669('0x7')]])){utils[_0x1669('0x1b')](util[_0x1669('0x9')](_0x1669('0x62'),_0x48ba40[_0x1669('0x7')]),_0x48ba40);utils[_0x1669('0x8')](util[_0x1669('0x9')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x48ba40[_0x1669('0x7')],_0x48ba40[_0x1669('0x63')],_0x48ba40[_0x1669('0x64')]));if(_0x48ba40[_0x1669('0x63')][_0x1669('0x65')]()==_0x1669('0x66')&&_[_0x1669('0x67')](_0x48ba40[_0x1669('0x64')][_0x1669('0x65')](),_0x1669('0x68'))){var _0xaff011=_0x48ba40[_0x1669('0x64')][_0x1669('0x69')]('=');var _0x13ab44=_0xaff011[0x0]['substring'](_0xaff011[0x0][_0x1669('0x6a')]('(')+0x1,_0xaff011[0x0][_0x1669('0x6a')](')'));var _0x332ee7=_0xaff011[0x1];channels[_0x48ba40[_0x1669('0x7')]][_0x13ab44]=_0x332ee7;}if(!_['includes']([_0x1669('0x2f'),_0x1669('0x6b'),_0x1669('0x6c'),_0x1669('0x66'),'gotoif'],_0x48ba40[_0x1669('0x63')][_0x1669('0x65')]())){channels[_0x48ba40[_0x1669('0x7')]][_0x1669('0x6d')]=_0x48ba40[_0x1669('0x63')];channels[_0x48ba40[_0x1669('0x7')]][_0x1669('0x6e')]=_0x48ba40[_0x1669('0x64')];}}}catch(_0x44209d){utils[_0x1669('0x22')](util[_0x1669('0x9')](_0x1669('0x62'),_0x48ba40[_0x1669('0x7')]),_0x44209d);}}; \ No newline at end of file +var _0xf130=['gotoif','[%s][calls][newexten]','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','uniqueid','blinds','transfereeuniqueid','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','UserId','CreateVoiceCallReport','request','recording','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','DOCUMENTATION','error','format','newstate','channelstate','info','[%s][calls][newstate]\x20context:%s\x20channel:%s','now','isNil','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','[%s][calls][newstate]','hangup','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','origtransfereruniqueid','secondtransfererchannel','userfield','_attended','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr','split','substring','lastIndexOf','includes','execif','set'];(function(_0x19a11f,_0x6d8be7){var _0x51485f=function(_0x1394a1){while(--_0x1394a1){_0x19a11f['push'](_0x19a11f['shift']());}};_0x51485f(++_0x6d8be7);}(_0xf130,0x149));var _0x0f13=function(_0xbf293f,_0xb019b3){_0xbf293f=_0xbf293f-0x0;var _0x4cce37=_0xf130[_0xbf293f];return _0x4cce37;};'use strict';var _=require(_0x0f13('0x0'));var util=require(_0x0f13('0x1'));var utils=require(_0x0f13('0x2'));var transfers=require(_0x0f13('0x3'));var dispositions=[_0x0f13('0x4'),_0x0f13('0x5'),_0x0f13('0x5'),_0x0f13('0x4'),'NO\x20ANSWER',_0x0f13('0x4'),_0x0f13('0x6'),_0x0f13('0x7'),_0x0f13('0x5'),'FAILED',_0x0f13('0x5')];var channels={};function writeDB(_0x4d637f){var _0x40cade;if(transfers['blinds'][_0x4d637f[_0x0f13('0x8')]]){_0x40cade=_0x4d637f[_0x0f13('0x8')];_0x4d637f[_0x0f13('0x8')]=transfers[_0x0f13('0x9')][_0x4d637f[_0x0f13('0x8')]][_0x0f13('0xa')];}utils['info'](util['format'](_0x0f13('0xb'),_0x4d637f['uniqueid'],_0x4d637f[_0x0f13('0xc')],_0x4d637f[_0x0f13('0xd')],_0x4d637f[_0x0f13('0xe')],_0x4d637f['interface'],_0x4d637f[_0x0f13('0xf')],_0x4d637f[_0x0f13('0x10')],_0x4d637f[_0x0f13('0x11')]));if(_0x4d637f[_0x0f13('0x12')]){utils[_0x0f13('0x13')](_0x4d637f[_0x0f13('0x12')])['then'](function(_0x273e5f){if(_0x273e5f){_0x4d637f[_0x0f13('0x14')]=_0x273e5f['id'];}utils['request'](_0x0f13('0x15'),_0x4d637f);});}else{utils[_0x0f13('0x16')](_0x0f13('0x15'),_0x4d637f);}if(channels[_0x4d637f[_0x0f13('0x8')]]){delete channels[_0x4d637f[_0x0f13('0x8')]];}else if(_0x40cade&&channels[_0x40cade]){if(!transfers[_0x0f13('0x9')][_0x40cade][_0x0f13('0x17')])delete transfers[_0x0f13('0x9')][_0x40cade];delete channels[_0x40cade];}}exports['newchannel']=function(_0x2d3c7a){try{utils[_0x0f13('0x18')](util['format'](_0x0f13('0x19'),_0x2d3c7a['uniqueid']),_0x2d3c7a);if(_0x2d3c7a[_0x0f13('0x8')]==_0x2d3c7a[_0x0f13('0x1a')]&&_0x2d3c7a[_0x0f13('0xc')]!=_0x0f13('0x1b')){utils['info'](util['format'](_0x0f13('0x1c'),_0x2d3c7a[_0x0f13('0x8')],_0x2d3c7a[_0x0f13('0x1d')],_0x2d3c7a[_0x0f13('0x1e')]));channels[_0x2d3c7a[_0x0f13('0x8')]]={'uniqueid':_0x2d3c7a[_0x0f13('0x8')],'accountcode':_0x2d3c7a[_0x0f13('0x12')],'source':_0x2d3c7a[_0x0f13('0xf')],'destination':_0x2d3c7a[_0x0f13('0x1e')],'destinationcontext':_0x2d3c7a[_0x0f13('0x1d')],'channel':_0x2d3c7a['channel'],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x0f13('0x4'),'amaflags':_0x0f13('0x1f')};}}catch(_0x860f0c){utils[_0x0f13('0x20')](util[_0x0f13('0x21')](_0x0f13('0x19'),_0x2d3c7a['uniqueid']),_0x860f0c);}};exports[_0x0f13('0x22')]=function(_0x1fae09){try{utils[_0x0f13('0x18')](util[_0x0f13('0x21')]('[%s][calls][newstate]',_0x1fae09[_0x0f13('0x8')]),_0x1fae09);if(!_['isNil'](channels[_0x1fae09[_0x0f13('0x8')]])&&_0x1fae09[_0x0f13('0x23')]==0x6){utils[_0x0f13('0x24')](util['format'](_0x0f13('0x25'),_0x1fae09[_0x0f13('0x8')],_0x1fae09[_0x0f13('0x1d')],_0x1fae09[_0x0f13('0xc')]));if(_['isNil'](channels[_0x1fae09[_0x0f13('0x8')]]['systemanswertime'])){channels[_0x1fae09['uniqueid']]['systemanswertime']=utils[_0x0f13('0x26')]();}}else if(!_[_0x0f13('0x27')](channels[_0x1fae09[_0x0f13('0x1a')]])&&_0x1fae09['channelstate']==0x6&&_0x1fae09[_0x0f13('0x1d')]!=_0x0f13('0x28')){utils['info'](util['format'](_0x0f13('0x29'),_0x1fae09[_0x0f13('0x8')],_0x1fae09['linkedid'],_0x1fae09['context'],_0x1fae09[_0x0f13('0xc')]));channels[_0x1fae09[_0x0f13('0x1a')]][_0x0f13('0x12')]=_0x1fae09[_0x0f13('0x12')];channels[_0x1fae09['linkedid']][_0x0f13('0x2a')]=_0x1fae09[_0x0f13('0xc')];if(_['isNil'](channels[_0x1fae09[_0x0f13('0x1a')]][_0x0f13('0x2b')])){channels[_0x1fae09[_0x0f13('0x1a')]][_0x0f13('0x2b')]=utils[_0x0f13('0x26')]();}channels[_0x1fae09['linkedid']]['disposition']=dispositions[_['toNumber'](_0x1fae09[_0x0f13('0x23')])]||'ANSWERED';}}catch(_0x39c4db){utils[_0x0f13('0x20')](util[_0x0f13('0x21')](_0x0f13('0x2c'),_0x1fae09['uniqueid']),_0x39c4db);}};exports[_0x0f13('0x2d')]=function(_0x25d20f){try{if(!_[_0x0f13('0x27')](channels[_0x25d20f['uniqueid']])){utils[_0x0f13('0x18')](util[_0x0f13('0x21')](_0x0f13('0x2e'),_0x25d20f[_0x0f13('0x8')]),_0x25d20f);if(_[_0x0f13('0x27')](channels[_0x25d20f['uniqueid']][_0x0f13('0x2f')])){channels[_0x25d20f[_0x0f13('0x8')]]['callerid']=_0x25d20f['calleridname']+'\x20<'+_0x25d20f[_0x0f13('0xf')]+'>';}utils[_0x0f13('0x24')](util[_0x0f13('0x21')](_0x0f13('0x30'),_0x25d20f['uniqueid'],channels[_0x25d20f[_0x0f13('0x8')]]['callerid'],_0x25d20f[_0x0f13('0x31')]));channels[_0x25d20f[_0x0f13('0x8')]][_0x0f13('0x32')]=utils[_0x0f13('0x26')]();channels[_0x25d20f[_0x0f13('0x8')]][_0x0f13('0x33')]=utils[_0x0f13('0x34')](channels[_0x25d20f['uniqueid']]['endtime'],channels[_0x25d20f[_0x0f13('0x8')]]['starttime']);channels[_0x25d20f[_0x0f13('0x8')]]['billableseconds']=channels[_0x25d20f[_0x0f13('0x8')]][_0x0f13('0x2b')]?utils[_0x0f13('0x34')](channels[_0x25d20f[_0x0f13('0x8')]]['endtime'],channels[_0x25d20f[_0x0f13('0x8')]][_0x0f13('0x2b')]):0x0;writeDB(channels[_0x25d20f['uniqueid']]);}}catch(_0x1c9507){utils[_0x0f13('0x20')](util['format']('[%s][calls][hangup]',_0x25d20f[_0x0f13('0x8')]),_0x1c9507);}};exports[_0x0f13('0x35')]=function(_0x21ec9d){try{if(!_[_0x0f13('0x27')](channels[_0x21ec9d[_0x0f13('0x36')]])){utils['debug'](util[_0x0f13('0x21')](_0x0f13('0x37'),_0x21ec9d['origtransfereruniqueid']),_0x21ec9d);if(channels[_0x21ec9d[_0x0f13('0x36')]][_0x0f13('0xc')]==_0x21ec9d[_0x0f13('0x38')]){utils[_0x0f13('0x24')](util[_0x0f13('0x21')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x21ec9d[_0x0f13('0x39')],_0x21ec9d[_0x0f13('0x36')],_0x21ec9d[_0x0f13('0x3a')]));channels[_0x21ec9d[_0x0f13('0x36')]][_0x0f13('0x2a')]=_0x21ec9d[_0x0f13('0x3a')];channels[_0x21ec9d[_0x0f13('0x36')]][_0x0f13('0x3b')]=_0x0f13('0x3c');}else if(channels[_0x21ec9d[_0x0f13('0x36')]][_0x0f13('0xc')]=_0x21ec9d['transfertargetchannel']){utils[_0x0f13('0x24')](util[_0x0f13('0x21')](_0x0f13('0x3d'),_0x21ec9d[_0x0f13('0x39')],_0x21ec9d['localtwolinkedid'],_0x21ec9d[_0x0f13('0x3e')]));channels[_0x21ec9d[_0x0f13('0x36')]][_0x0f13('0x2a')]=_0x21ec9d[_0x0f13('0x3e')];channels[_0x21ec9d['localtwolinkedid']][_0x0f13('0x3b')]=_0x0f13('0x3c');}}}catch(_0x1609b5){utils[_0x0f13('0x20')](util['format'](_0x0f13('0x37'),_0x21ec9d[_0x0f13('0x39')]),_0x1609b5);}};exports['musiconholdstart']=function(_0x5cec9b){try{if(!_[_0x0f13('0x27')](channels[_0x5cec9b[_0x0f13('0x8')]])){utils[_0x0f13('0x18')](util[_0x0f13('0x21')](_0x0f13('0x3f'),_0x5cec9b[_0x0f13('0x8')]),_0x5cec9b);channels[_0x5cec9b[_0x0f13('0x8')]]['musiconholdstartAt']=utils[_0x0f13('0x26')]();utils[_0x0f13('0x24')](util[_0x0f13('0x21')](_0x0f13('0x40'),_0x5cec9b[_0x0f13('0x8')],channels[_0x5cec9b['uniqueid']][_0x0f13('0x41')]));}}catch(_0x57a20a){utils[_0x0f13('0x20')](util[_0x0f13('0x21')](_0x0f13('0x3f'),_0x5cec9b[_0x0f13('0x8')]),_0x57a20a);}};exports[_0x0f13('0x42')]=function(_0x15afc5){try{if(!_[_0x0f13('0x27')](channels[_0x15afc5['uniqueid']])){utils[_0x0f13('0x18')](util[_0x0f13('0x21')](_0x0f13('0x43'),_0x15afc5[_0x0f13('0x8')]),_0x15afc5);if(!_['isNil'](channels[_0x15afc5['uniqueid']][_0x0f13('0x41')])){channels[_0x15afc5['uniqueid']][_0x0f13('0x44')]+=utils[_0x0f13('0x34')](utils['now'](),channels[_0x15afc5[_0x0f13('0x8')]][_0x0f13('0x41')]);utils['info'](util[_0x0f13('0x21')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x15afc5[_0x0f13('0x8')],channels[_0x15afc5['uniqueid']][_0x0f13('0x44')]));delete channels[_0x15afc5[_0x0f13('0x8')]][_0x0f13('0x41')];}}}catch(_0x1597a0){utils['error'](util[_0x0f13('0x21')](_0x0f13('0x43'),_0x15afc5['uniqueid']),_0x1597a0);}};exports[_0x0f13('0x45')]=function(_0x1569c0){try{if(!_['isNil'](channels[_0x1569c0[_0x0f13('0x8')]])){utils[_0x0f13('0x18')](util[_0x0f13('0x21')](_0x0f13('0x46'),_0x1569c0[_0x0f13('0x8')]),_0x1569c0);if(!_[_0x0f13('0x27')](_0x1569c0[_0x0f13('0x47')][_0x0f13('0x48')])){utils[_0x0f13('0x24')](util['format'](_0x0f13('0x49'),_0x1569c0['uniqueid'],_0x1569c0[_0x0f13('0x4a')]));channels[_0x1569c0[_0x0f13('0x8')]][_0x0f13('0x4b')]=_0x1569c0['value'];}if(!_[_0x0f13('0x27')](_0x1569c0[_0x0f13('0x47')]['xmd-phone'])){utils['info'](util[_0x0f13('0x21')](_0x0f13('0x4c'),_0x1569c0[_0x0f13('0x8')],_0x1569c0[_0x0f13('0x4a')]));channels[_0x1569c0[_0x0f13('0x8')]]['destination']=_0x1569c0[_0x0f13('0x4a')];channels[_0x1569c0[_0x0f13('0x8')]][_0x0f13('0x2f')]='\x22'+_0x1569c0[_0x0f13('0x4a')]+_0x0f13('0x4d')+_0x1569c0[_0x0f13('0x4a')]+'>';}if(!_[_0x0f13('0x27')](_0x1569c0['variable']['xmd-callerid-preview'])||!_[_0x0f13('0x27')](_0x1569c0[_0x0f13('0x47')][_0x0f13('0x4e')])){utils[_0x0f13('0x24')](util['format'](_0x0f13('0x4f'),_0x1569c0[_0x0f13('0x8')],!_[_0x0f13('0x27')](_0x1569c0[_0x0f13('0x47')][_0x0f13('0x50')])?'xmd-callerid-preview':_0x0f13('0x4e'),_0x1569c0[_0x0f13('0x4a')]));channels[_0x1569c0['uniqueid']][_0x0f13('0x2f')]=_0x1569c0[_0x0f13('0x4a')];}if(!_['isNil'](_0x1569c0[_0x0f13('0x47')][_0x0f13('0x51')])||!_[_0x0f13('0x27')](_0x1569c0[_0x0f13('0x47')]['xmcs-queue'])){utils[_0x0f13('0x24')](util[_0x0f13('0x21')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x1569c0[_0x0f13('0x8')],!_[_0x0f13('0x27')](_0x1569c0['variable'][_0x0f13('0x51')])?_0x0f13('0x51'):_0x0f13('0x52'),_0x1569c0['value']));channels[_0x1569c0[_0x0f13('0x8')]][_0x0f13('0x53')]=_0x0f13('0x54');channels[_0x1569c0[_0x0f13('0x8')]][_0x0f13('0x55')]=_0x1569c0[_0x0f13('0x4a')];channels[_0x1569c0[_0x0f13('0x8')]]['queue']=!![];}if(!_[_0x0f13('0x27')](_0x1569c0[_0x0f13('0x47')][_0x0f13('0x56')])){utils['info'](util[_0x0f13('0x21')](_0x0f13('0x57'),_0x1569c0['uniqueid'],_0x1569c0['value']));channels[_0x1569c0[_0x0f13('0x8')]][_0x0f13('0x58')]=_0x1569c0[_0x0f13('0x4a')];}if(!_[_0x0f13('0x27')](_0x1569c0[_0x0f13('0x47')]['xmd-cdrtype'])){utils[_0x0f13('0x24')](util[_0x0f13('0x21')](_0x0f13('0x59'),_0x1569c0[_0x0f13('0x8')],_0x1569c0[_0x0f13('0x4a')]));channels[_0x1569c0[_0x0f13('0x8')]][_0x0f13('0x5a')]=_0x1569c0[_0x0f13('0x4a')];}if(!_['isNil'](_0x1569c0[_0x0f13('0x47')]['outboundrouteid'])){utils[_0x0f13('0x24')](util[_0x0f13('0x21')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x1569c0[_0x0f13('0x8')],_0x1569c0['value']));channels[_0x1569c0[_0x0f13('0x8')]][_0x0f13('0x5b')]=_0x1569c0[_0x0f13('0x4a')];}if(!_[_0x0f13('0x27')](_0x1569c0[_0x0f13('0x47')]['sipcallid'])){utils[_0x0f13('0x24')](util['format'](_0x0f13('0x5c'),_0x1569c0[_0x0f13('0x8')],_0x1569c0[_0x0f13('0x4a')]));channels[_0x1569c0[_0x0f13('0x8')]][_0x0f13('0x5d')]=_0x1569c0[_0x0f13('0x4a')];}}}catch(_0x14c221){utils[_0x0f13('0x20')](util['format']('[%s][calls][varset]',_0x1569c0['uniqueid']),_0x14c221);}};exports[_0x0f13('0x5e')]=function(_0x166ed4){try{if(!_[_0x0f13('0x27')](channels[_0x166ed4['uniqueid']])){utils[_0x0f13('0x18')](util[_0x0f13('0x21')]('[%s][calls][newexten]',_0x166ed4[_0x0f13('0x8')]),_0x166ed4);utils['info'](util['format'](_0x0f13('0x5f'),_0x166ed4[_0x0f13('0x8')],_0x166ed4[_0x0f13('0x60')],_0x166ed4[_0x0f13('0x61')]));if(_0x166ed4[_0x0f13('0x60')][_0x0f13('0x62')]()=='set'&&_[_0x0f13('0x63')](_0x166ed4[_0x0f13('0x61')][_0x0f13('0x62')](),_0x0f13('0x64'))){var _0x485c3b=_0x166ed4[_0x0f13('0x61')][_0x0f13('0x65')]('=');var _0xc28470=_0x485c3b[0x0][_0x0f13('0x66')](_0x485c3b[0x0][_0x0f13('0x67')]('(')+0x1,_0x485c3b[0x0][_0x0f13('0x67')](')'));var _0x1eb7f9=_0x485c3b[0x1];channels[_0x166ed4[_0x0f13('0x8')]][_0xc28470]=_0x1eb7f9;}if(!_[_0x0f13('0x68')]([_0x0f13('0x2d'),'noop',_0x0f13('0x69'),_0x0f13('0x6a'),_0x0f13('0x6b')],_0x166ed4['application'][_0x0f13('0x62')]())){channels[_0x166ed4['uniqueid']]['lastapplication']=_0x166ed4['application'];channels[_0x166ed4[_0x0f13('0x8')]]['lastdata']=_0x166ed4[_0x0f13('0x61')];}}}catch(_0x563933){utils[_0x0f13('0x20')](util['format'](_0x0f13('0x6c'),_0x166ed4[_0x0f13('0x8')]),_0x563933);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index d55247b..8b04818 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 _0xb8b2=['[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20close','managerevent','connect','[core]\x20connected','info'];(function(_0x3e0387,_0x5cdd6e){var _0x2de505=function(_0x40c9e4){while(--_0x40c9e4){_0x3e0387['push'](_0x3e0387['shift']());}};_0x2de505(++_0x5cdd6e);}(_0xb8b2,0x9f));var _0x2b8b=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xb8b2[_0x19e35c];return _0x3e1fe8;};'use strict';var utils=require('./utils');exports[_0x2b8b('0x0')]=function(){utils['info'](_0x2b8b('0x1'));};exports['shutdown']=function(){utils[_0x2b8b('0x2')](_0x2b8b('0x3'));};exports[_0x2b8b('0x4')]=function(){utils[_0x2b8b('0x2')](_0x2b8b('0x5'));};exports[_0x2b8b('0x6')]=function(_0x4dfe15){utils['error']('[core]\x20error',_0x4dfe15);};exports['close']=function(){utils[_0x2b8b('0x2')](_0x2b8b('0x7'));};exports[_0x2b8b('0x8')]=function(_0x42a5b2){}; \ No newline at end of file +var _0x3feb=['error','close','[core]\x20close','managerevent','info','[core]\x20connected','[core]\x20shutdown','[core]\x20fullybooted'];(function(_0x19da8c,_0x5c2246){var _0x51708b=function(_0x24276a){while(--_0x24276a){_0x19da8c['push'](_0x19da8c['shift']());}};_0x51708b(++_0x5c2246);}(_0x3feb,0xf4));var _0xb3fe=function(_0x963557,_0xcd95cb){_0x963557=_0x963557-0x0;var _0x3d07eb=_0x3feb[_0x963557];return _0x3d07eb;};'use strict';var utils=require('./utils');exports['connect']=function(){utils[_0xb3fe('0x0')](_0xb3fe('0x1'));};exports['shutdown']=function(){utils[_0xb3fe('0x0')](_0xb3fe('0x2'));};exports['fullybooted']=function(){utils['info'](_0xb3fe('0x3'));};exports[_0xb3fe('0x4')]=function(_0x2af11f){utils['error']('[core]\x20error',_0x2af11f);};exports[_0xb3fe('0x5')]=function(){utils['info'](_0xb3fe('0x6'));};exports[_0xb3fe('0x7')]=function(_0x322632){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index d1a245c..b57568c 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 _0x3756=['channel','dialstring','dialstatus','request','CreateVoiceDialReport','uniqueid','debug','format','info','application','appdata','toLowerCase','set','startsWith','split','error','[%s][dials][newexten]','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','lastevent','called','starttime','[%s][dials][dialend]','ANSWER','assign','answertime','now','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','cause-txt','duration','endtime','holdtime','diffTime','billableseconds','lodash','util','./utils','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x3756,0x153));var _0x6375=function(_0x669af0,_0x4ff3a9){_0x669af0=_0x669af0-0x0;var _0x8a756b=_0x3756[_0x669af0];return _0x8a756b;};'use strict';var _=require(_0x6375('0x0'));var util=require(_0x6375('0x1'));var utils=require(_0x6375('0x2'));var dials={};function writeDB(_0x43cbc8){utils['info'](util['format'](_0x6375('0x3'),_0x43cbc8['uniqueid'],_0x43cbc8[_0x6375('0x4')],_0x43cbc8[_0x6375('0x5')],_0x43cbc8['calleridnum'],_0x43cbc8['connectedlinenum'],_0x43cbc8[_0x6375('0x6')]));utils[_0x6375('0x7')](_0x6375('0x8'),_0x43cbc8);delete dials[_0x43cbc8[_0x6375('0x9')]];}exports['newexten']=function(_0x4d709a){try{utils[_0x6375('0xa')](util[_0x6375('0xb')]('[%s][dials][newexten]',_0x4d709a[_0x6375('0x9')]),_0x4d709a);utils[_0x6375('0xc')](util['format']('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x4d709a[_0x6375('0x9')],_0x4d709a[_0x6375('0xd')],_0x4d709a[_0x6375('0xe')]));if(_0x4d709a[_0x6375('0xd')][_0x6375('0xf')]()==_0x6375('0x10')&&_[_0x6375('0x11')](_0x4d709a[_0x6375('0xe')][_0x6375('0xf')](),'cdr(routeid)')){var _0x213c82=_0x4d709a[_0x6375('0xe')][_0x6375('0x12')]('=');dials[_0x4d709a[_0x6375('0x9')]]={'routeId':_0x213c82[0x1]};}}catch(_0x51d51a){utils[_0x6375('0x13')](util[_0x6375('0xb')](_0x6375('0x14'),_0x4d709a['uniqueid']),_0x51d51a);}};exports['varset']=function(_0x47b81b){try{utils['debug'](util[_0x6375('0xb')](_0x6375('0x15'),_0x47b81b[_0x6375('0x9')]),_0x47b81b);if(!_[_0x6375('0x16')](_0x47b81b[_0x6375('0x17')][_0x6375('0x18')])){utils[_0x6375('0xc')](util[_0x6375('0xb')](_0x6375('0x19'),_0x47b81b[_0x6375('0x9')],_0x47b81b['value']));dials[_0x47b81b[_0x6375('0x9')]]={'routeId':_0x47b81b[_0x6375('0x1a')]};}}catch(_0x3a6a90){utils[_0x6375('0x13')](util['format'](_0x6375('0x15'),_0x47b81b[_0x6375('0x9')]),_0x3a6a90);}};exports[_0x6375('0x1b')]=function(_0x539cc7){try{if(!_[_0x6375('0x16')](dials[_0x539cc7['uniqueid']])){utils[_0x6375('0xa')](util[_0x6375('0xb')](_0x6375('0x1c'),_0x539cc7[_0x6375('0x9')]),_0x539cc7);dials[_0x539cc7[_0x6375('0x9')]]=_['assign'](dials[_0x539cc7[_0x6375('0x9')]],_0x539cc7);dials[_0x539cc7[_0x6375('0x9')]]['starttime']=utils['now']();dials[_0x539cc7[_0x6375('0x9')]][_0x6375('0x1d')]=_0x6375('0x1e');utils['info'](util[_0x6375('0xb')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x539cc7['uniqueid'],dials[_0x539cc7[_0x6375('0x9')]][_0x6375('0x1f')]));}}catch(_0xff996a){utils['error'](util[_0x6375('0xb')]('[%s][dials][dialbegin]',_0x539cc7[_0x6375('0x9')]),_0xff996a);}};exports['dialend']=function(_0x5b8e4b){try{if(!_[_0x6375('0x16')](dials[_0x5b8e4b[_0x6375('0x9')]])){utils[_0x6375('0xa')](util[_0x6375('0xb')](_0x6375('0x20'),_0x5b8e4b[_0x6375('0x9')]),_0x5b8e4b);dials[_0x5b8e4b[_0x6375('0x9')]][_0x6375('0x6')]=_0x5b8e4b[_0x6375('0x6')];if(_0x5b8e4b[_0x6375('0x6')]==_0x6375('0x21')){dials[_0x5b8e4b[_0x6375('0x9')]]=_[_0x6375('0x22')](dials[_0x5b8e4b[_0x6375('0x9')]],_0x5b8e4b);dials[_0x5b8e4b['uniqueid']][_0x6375('0x23')]=utils[_0x6375('0x24')]();dials[_0x5b8e4b[_0x6375('0x9')]][_0x6375('0x1d')]=_0x6375('0x25');utils[_0x6375('0xc')](util[_0x6375('0xb')](_0x6375('0x26'),_0x5b8e4b[_0x6375('0x9')],_0x5b8e4b['dialstatus'],dials[_0x5b8e4b[_0x6375('0x9')]]['answertime']));}else{utils[_0x6375('0xc')](util[_0x6375('0xb')](_0x6375('0x27'),_0x5b8e4b[_0x6375('0x9')],_0x5b8e4b[_0x6375('0x6')]));}}}catch(_0x235cde){utils['error'](util[_0x6375('0xb')]('[%s][dials][dialend]',_0x5b8e4b['uniqueid']),_0x235cde);}};exports[_0x6375('0x28')]=function(_0x23e6c4){try{if(!_[_0x6375('0x16')](dials[_0x23e6c4[_0x6375('0x9')]])){utils[_0x6375('0xa')](util['format'](_0x6375('0x29'),_0x23e6c4[_0x6375('0x9')]),_0x23e6c4);utils[_0x6375('0xc')](util[_0x6375('0xb')](_0x6375('0x2a'),_0x23e6c4[_0x6375('0x9')],_0x23e6c4['calleridnum'],_0x23e6c4['calleridname'],_0x23e6c4[_0x6375('0x2b')]));dials[_0x23e6c4[_0x6375('0x9')]]=_[_0x6375('0x22')](dials[_0x23e6c4['uniqueid']],{'endtime':utils['now'](),'lastevent':'complete'});dials[_0x23e6c4['uniqueid']][_0x6375('0x2c')]=utils['diffTime'](dials[_0x23e6c4[_0x6375('0x9')]][_0x6375('0x2d')],dials[_0x23e6c4[_0x6375('0x9')]]['starttime']);dials[_0x23e6c4[_0x6375('0x9')]][_0x6375('0x2e')]=utils[_0x6375('0x2f')](dials[_0x23e6c4[_0x6375('0x9')]][_0x6375('0x23')]||dials[_0x23e6c4[_0x6375('0x9')]][_0x6375('0x2d')],dials[_0x23e6c4[_0x6375('0x9')]]['starttime']);dials[_0x23e6c4[_0x6375('0x9')]][_0x6375('0x30')]=dials[_0x23e6c4[_0x6375('0x9')]][_0x6375('0x23')]?utils[_0x6375('0x2f')](dials[_0x23e6c4[_0x6375('0x9')]]['endtime'],dials[_0x23e6c4[_0x6375('0x9')]][_0x6375('0x23')]):0x0;writeDB(dials[_0x23e6c4['uniqueid']]);}}catch(_0x5a339b){utils[_0x6375('0x13')](util[_0x6375('0xb')](_0x6375('0x29'),_0x23e6c4[_0x6375('0x9')]),_0x5a339b);}}; \ No newline at end of file +var _0x8bb1=['varset','[%s][dials][varset]','isNil','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%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','util','./utils','info','format','uniqueid','channel','dialstring','connectedlinenum','dialstatus','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','application','toLowerCase','set','startsWith','cdr(routeid)','split','error'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8bb1,0xeb));var _0x18bb=function(_0x55881e,_0x245b4d){_0x55881e=_0x55881e-0x0;var _0x5cc48e=_0x8bb1[_0x55881e];return _0x5cc48e;};'use strict';var _=require('lodash');var util=require(_0x18bb('0x0'));var utils=require(_0x18bb('0x1'));var dials={};function writeDB(_0x1a6b25){utils[_0x18bb('0x2')](util[_0x18bb('0x3')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x1a6b25[_0x18bb('0x4')],_0x1a6b25[_0x18bb('0x5')],_0x1a6b25[_0x18bb('0x6')],_0x1a6b25['calleridnum'],_0x1a6b25[_0x18bb('0x7')],_0x1a6b25[_0x18bb('0x8')]));utils['request'](_0x18bb('0x9'),_0x1a6b25);delete dials[_0x1a6b25[_0x18bb('0x4')]];}exports[_0x18bb('0xa')]=function(_0x2c8286){try{utils[_0x18bb('0xb')](util['format'](_0x18bb('0xc'),_0x2c8286[_0x18bb('0x4')]),_0x2c8286);utils[_0x18bb('0x2')](util[_0x18bb('0x3')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x2c8286[_0x18bb('0x4')],_0x2c8286[_0x18bb('0xd')],_0x2c8286['appdata']));if(_0x2c8286[_0x18bb('0xd')][_0x18bb('0xe')]()==_0x18bb('0xf')&&_[_0x18bb('0x10')](_0x2c8286['appdata'][_0x18bb('0xe')](),_0x18bb('0x11'))){var _0x5cbdfb=_0x2c8286['appdata'][_0x18bb('0x12')]('=');dials[_0x2c8286[_0x18bb('0x4')]]={'routeId':_0x5cbdfb[0x1]};}}catch(_0x5559f9){utils[_0x18bb('0x13')](util[_0x18bb('0x3')]('[%s][dials][newexten]',_0x2c8286[_0x18bb('0x4')]),_0x5559f9);}};exports[_0x18bb('0x14')]=function(_0x52828f){try{utils['debug'](util[_0x18bb('0x3')](_0x18bb('0x15'),_0x52828f[_0x18bb('0x4')]),_0x52828f);if(!_[_0x18bb('0x16')](_0x52828f[_0x18bb('0x17')]['outboundrouteid'])){utils[_0x18bb('0x2')](util[_0x18bb('0x3')](_0x18bb('0x18'),_0x52828f[_0x18bb('0x4')],_0x52828f[_0x18bb('0x19')]));dials[_0x52828f['uniqueid']]={'routeId':_0x52828f[_0x18bb('0x19')]};}}catch(_0x44d72c){utils[_0x18bb('0x13')](util[_0x18bb('0x3')](_0x18bb('0x15'),_0x52828f[_0x18bb('0x4')]),_0x44d72c);}};exports['dialbegin']=function(_0x1fdebf){try{if(!_[_0x18bb('0x16')](dials[_0x1fdebf[_0x18bb('0x4')]])){utils[_0x18bb('0xb')](util[_0x18bb('0x3')](_0x18bb('0x1a'),_0x1fdebf[_0x18bb('0x4')]),_0x1fdebf);dials[_0x1fdebf[_0x18bb('0x4')]]=_[_0x18bb('0x1b')](dials[_0x1fdebf[_0x18bb('0x4')]],_0x1fdebf);dials[_0x1fdebf[_0x18bb('0x4')]][_0x18bb('0x1c')]=utils[_0x18bb('0x1d')]();dials[_0x1fdebf[_0x18bb('0x4')]][_0x18bb('0x1e')]=_0x18bb('0x1f');utils[_0x18bb('0x2')](util[_0x18bb('0x3')](_0x18bb('0x20'),_0x1fdebf[_0x18bb('0x4')],dials[_0x1fdebf[_0x18bb('0x4')]][_0x18bb('0x1c')]));}}catch(_0x24d8f9){utils[_0x18bb('0x13')](util[_0x18bb('0x3')]('[%s][dials][dialbegin]',_0x1fdebf['uniqueid']),_0x24d8f9);}};exports[_0x18bb('0x21')]=function(_0x102bde){try{if(!_[_0x18bb('0x16')](dials[_0x102bde[_0x18bb('0x4')]])){utils['debug'](util['format'](_0x18bb('0x22'),_0x102bde[_0x18bb('0x4')]),_0x102bde);dials[_0x102bde[_0x18bb('0x4')]][_0x18bb('0x8')]=_0x102bde[_0x18bb('0x8')];if(_0x102bde[_0x18bb('0x8')]==_0x18bb('0x23')){dials[_0x102bde[_0x18bb('0x4')]]=_[_0x18bb('0x1b')](dials[_0x102bde[_0x18bb('0x4')]],_0x102bde);dials[_0x102bde['uniqueid']][_0x18bb('0x24')]=utils[_0x18bb('0x1d')]();dials[_0x102bde[_0x18bb('0x4')]][_0x18bb('0x1e')]=_0x18bb('0x25');utils['info'](util[_0x18bb('0x3')](_0x18bb('0x26'),_0x102bde[_0x18bb('0x4')],_0x102bde[_0x18bb('0x8')],dials[_0x102bde[_0x18bb('0x4')]][_0x18bb('0x24')]));}else{utils[_0x18bb('0x2')](util[_0x18bb('0x3')](_0x18bb('0x27'),_0x102bde[_0x18bb('0x4')],_0x102bde[_0x18bb('0x8')]));}}}catch(_0x362482){utils[_0x18bb('0x13')](util[_0x18bb('0x3')](_0x18bb('0x22'),_0x102bde[_0x18bb('0x4')]),_0x362482);}};exports[_0x18bb('0x28')]=function(_0x58742e){try{if(!_[_0x18bb('0x16')](dials[_0x58742e['uniqueid']])){utils['debug'](util['format'](_0x18bb('0x29'),_0x58742e['uniqueid']),_0x58742e);utils[_0x18bb('0x2')](util[_0x18bb('0x3')](_0x18bb('0x2a'),_0x58742e[_0x18bb('0x4')],_0x58742e[_0x18bb('0x2b')],_0x58742e[_0x18bb('0x2c')],_0x58742e[_0x18bb('0x2d')]));dials[_0x58742e[_0x18bb('0x4')]]=_[_0x18bb('0x1b')](dials[_0x58742e[_0x18bb('0x4')]],{'endtime':utils[_0x18bb('0x1d')](),'lastevent':_0x18bb('0x2e')});dials[_0x58742e['uniqueid']][_0x18bb('0x2f')]=utils[_0x18bb('0x30')](dials[_0x58742e['uniqueid']][_0x18bb('0x31')],dials[_0x58742e['uniqueid']]['starttime']);dials[_0x58742e['uniqueid']][_0x18bb('0x32')]=utils['diffTime'](dials[_0x58742e[_0x18bb('0x4')]]['answertime']||dials[_0x58742e['uniqueid']][_0x18bb('0x31')],dials[_0x58742e['uniqueid']][_0x18bb('0x1c')]);dials[_0x58742e[_0x18bb('0x4')]]['billableseconds']=dials[_0x58742e[_0x18bb('0x4')]]['answertime']?utils[_0x18bb('0x30')](dials[_0x58742e[_0x18bb('0x4')]][_0x18bb('0x31')],dials[_0x58742e['uniqueid']][_0x18bb('0x24')]):0x0;writeDB(dials[_0x58742e[_0x18bb('0x4')]]);}}catch(_0x4dbcc2){utils[_0x18bb('0x13')](util[_0x18bb('0x3')](_0x18bb('0x29'),_0x58742e[_0x18bb('0x4')]),_0x4dbcc2);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 1005167..a552782 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 _0xaa0d=['agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s]dialbegin','[%s][index][dialend]','asterisk-manager','../../config/environment','util','xdr','disabled','env','local','asterisk','port','username','password','keepConnected','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','format','[%s][index][devicestatechange]','agentcalled','debug','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect'];(function(_0x4e6bc3,_0x1376be){var _0x13e4bd=function(_0x4a6dd4){while(--_0x4a6dd4){_0x4e6bc3['push'](_0x4e6bc3['shift']());}};_0x13e4bd(++_0x1376be);}(_0xaa0d,0x12b));var _0xdaa0=function(_0xaad9f2,_0x1d6c16){_0xaad9f2=_0xaad9f2-0x0;var _0x4b0ba9=_0xaa0d[_0xaad9f2];return _0x4b0ba9;};var AsteriskManager=require(_0xdaa0('0x0'));var config=require(_0xdaa0('0x1'));var utils=require('./utils');var util=require(_0xdaa0('0x2'));var isXDREnabled=config['xdr']&&config[_0xdaa0('0x3')]['disabled']?!config[_0xdaa0('0x3')][_0xdaa0('0x4')]:!![];var isProduction=config[_0xdaa0('0x5')]==='production'||![];var isLocalAsterisk=config[_0xdaa0('0x3')]&&config[_0xdaa0('0x3')][_0xdaa0('0x6')]===!![]||![];var ami=new AsteriskManager(config[_0xdaa0('0x7')][_0xdaa0('0x8')],config[_0xdaa0('0x7')]['ip'],config[_0xdaa0('0x7')][_0xdaa0('0x9')],config[_0xdaa0('0x7')][_0xdaa0('0xa')],!![]);ami[_0xdaa0('0xb')]();if(!isXDREnabled){utils[_0xdaa0('0xc')](_0xdaa0('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils['info']('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0xdaa0('0xe'));var calls=require(_0xdaa0('0xf'));var queues=require(_0xdaa0('0x10'));var recordings=require(_0xdaa0('0x11'));var members=require(_0xdaa0('0x12'));var dials=require('./dials.controller');var transfers=require('./transfers.controller');var core=require(_0xdaa0('0x13'));ami['on'](_0xdaa0('0x14'),core[_0xdaa0('0x14')]);ami['on'](_0xdaa0('0x15'),core[_0xdaa0('0x15')]);ami['on'](_0xdaa0('0x16'),core[_0xdaa0('0x16')]);ami['on']('error',core[_0xdaa0('0x17')]);ami['on'](_0xdaa0('0x18'),core[_0xdaa0('0x18')]);ami['on'](_0xdaa0('0x19'),core[_0xdaa0('0x19')]);ami['on'](_0xdaa0('0x1a'),function(_0x304254){try{utils['debug'](util[_0xdaa0('0x1b')]('[%s][index][devicestatechange]',_0x304254['device']),_0x304254);members['devicestatechange'](_0x304254);}catch(_0x373550){utils[_0xdaa0('0x17')](util[_0xdaa0('0x1b')](_0xdaa0('0x1c'),_0x304254['device']),_0x373550);}});ami['on'](_0xdaa0('0x1d'),function(_0x1fa9a9){try{utils[_0xdaa0('0x1e')](util[_0xdaa0('0x1b')](_0xdaa0('0x1f'),_0x1fa9a9[_0xdaa0('0x20')]),_0x1fa9a9);agents[_0xdaa0('0x1d')](_0x1fa9a9);}catch(_0x1693e8){utils[_0xdaa0('0x17')](util['format'](_0xdaa0('0x1f'),_0x1fa9a9['uniqueid']),_0x1693e8);}});ami['on'](_0xdaa0('0x21'),function(_0x4f9b6c){try{utils[_0xdaa0('0x1e')](util[_0xdaa0('0x1b')](_0xdaa0('0x22'),_0x4f9b6c[_0xdaa0('0x20')]),_0x4f9b6c);agents[_0xdaa0('0x21')](_0x4f9b6c);}catch(_0x3d0059){utils[_0xdaa0('0x17')](util[_0xdaa0('0x1b')]('[%s][index][agentringnoanswer]',_0x4f9b6c[_0xdaa0('0x20')]),_0x3d0059);}});ami['on']('agentconnect',function(_0x42536b){try{utils[_0xdaa0('0x1e')](util[_0xdaa0('0x1b')]('[%s][index][agentconnect]',_0x42536b[_0xdaa0('0x20')]),_0x42536b);agents[_0xdaa0('0x23')](_0x42536b);queues['agentconnect'](_0x42536b);}catch(_0x7517f1){utils[_0xdaa0('0x17')](util['format']('[%s][index][agentconnect]',_0x42536b['uniqueid']),_0x7517f1);}});ami['on'](_0xdaa0('0x24'),function(_0x26301d){try{utils['debug'](util[_0xdaa0('0x1b')]('[%s][index][agentcomplete]',_0x26301d[_0xdaa0('0x20')]),_0x26301d);agents['agentcomplete'](_0x26301d);queues[_0xdaa0('0x24')](_0x26301d);members[_0xdaa0('0x24')](_0x26301d);}catch(_0x28ee93){utils[_0xdaa0('0x17')](util[_0xdaa0('0x1b')]('[%s][index][agentcomplete]',_0x26301d[_0xdaa0('0x20')]),_0x28ee93);}});ami['on'](_0xdaa0('0x25'),function(_0x23e49a){try{utils[_0xdaa0('0x1e')](util[_0xdaa0('0x1b')]('[%s][index][queuecallerabandon]',_0x23e49a['uniqueid']),_0x23e49a);agents[_0xdaa0('0x25')](_0x23e49a);queues['queuecallerabandon'](_0x23e49a);}catch(_0x58b416){utils['error'](util[_0xdaa0('0x1b')](_0xdaa0('0x26'),_0x23e49a[_0xdaa0('0x20')]),_0x58b416);}});ami['on']('queuecallerjoin',function(_0x2999f3){try{utils[_0xdaa0('0x1e')](util['format']('[%s][index][queuecallerjoin]',_0x2999f3['uniqueid']),_0x2999f3);queues[_0xdaa0('0x27')](_0x2999f3);recordings[_0xdaa0('0x27')](_0x2999f3);}catch(_0x306408){utils[_0xdaa0('0x17')](util[_0xdaa0('0x1b')](_0xdaa0('0x28'),_0x2999f3[_0xdaa0('0x20')]),_0x306408);}});ami['on']('queuecallerleave',function(_0xc4d558){try{utils[_0xdaa0('0x1e')](util[_0xdaa0('0x1b')](_0xdaa0('0x29'),_0xc4d558[_0xdaa0('0x20')]),_0xc4d558);queues[_0xdaa0('0x2a')](_0xc4d558);}catch(_0x48fe3b){utils[_0xdaa0('0x17')](util['format'](_0xdaa0('0x29'),_0xc4d558[_0xdaa0('0x20')]),_0x48fe3b);}});ami['on'](_0xdaa0('0x2b'),function(_0x41d994){try{utils[_0xdaa0('0x1e')](util[_0xdaa0('0x1b')]('[%s][index][musiconholdstart]',_0x41d994[_0xdaa0('0x20')]),_0x41d994);queues[_0xdaa0('0x2b')](_0x41d994);calls[_0xdaa0('0x2b')](_0x41d994);}catch(_0x200164){utils['error'](util[_0xdaa0('0x1b')](_0xdaa0('0x2c'),_0x41d994[_0xdaa0('0x20')]),_0x200164);}});ami['on'](_0xdaa0('0x2d'),function(_0x425c5e){try{utils['debug'](util[_0xdaa0('0x1b')](_0xdaa0('0x2e'),_0x425c5e[_0xdaa0('0x20')]),_0x425c5e);queues[_0xdaa0('0x2d')](_0x425c5e);calls[_0xdaa0('0x2d')](_0x425c5e);}catch(_0x4a480c){utils[_0xdaa0('0x17')](util[_0xdaa0('0x1b')](_0xdaa0('0x2e'),_0x425c5e[_0xdaa0('0x20')]),_0x4a480c);}});ami['on'](_0xdaa0('0x2f'),function(_0x1ca1f9){try{utils['debug'](util[_0xdaa0('0x1b')](_0xdaa0('0x30'),_0x1ca1f9[_0xdaa0('0x20')]),_0x1ca1f9);calls['newstate'](_0x1ca1f9);recordings['newstate'](_0x1ca1f9);}catch(_0x1434e4){utils['error'](util['format'](_0xdaa0('0x30'),_0x1ca1f9['uniqueid']),_0x1434e4);}});ami['on'](_0xdaa0('0x31'),function(_0x4c8a94){try{utils[_0xdaa0('0x1e')](util[_0xdaa0('0x1b')]('[%s][index][hangup]',_0x4c8a94[_0xdaa0('0x20')]),_0x4c8a94);calls['hangup'](_0x4c8a94);recordings[_0xdaa0('0x31')](_0x4c8a94);dials['hangup'](_0x4c8a94);agents[_0xdaa0('0x31')](_0x4c8a94);queues[_0xdaa0('0x31')](_0x4c8a94);}catch(_0x4ae22d){utils[_0xdaa0('0x17')](util[_0xdaa0('0x1b')](_0xdaa0('0x32'),_0x4c8a94['uniqueid']),_0x4ae22d);}});ami['on'](_0xdaa0('0x33'),function(_0x19dacb){try{utils['debug'](util[_0xdaa0('0x1b')](_0xdaa0('0x34'),_0x19dacb['uniqueid']),_0x19dacb);members[_0xdaa0('0x33')](_0x19dacb);}catch(_0x4bf121){utils['error'](util['format'](_0xdaa0('0x34'),_0x19dacb[_0xdaa0('0x20')]),_0x4bf121);}});ami['on'](_0xdaa0('0x35'),function(_0x50ae9c){try{utils[_0xdaa0('0x1e')](util[_0xdaa0('0x1b')](_0xdaa0('0x36'),_0x50ae9c[_0xdaa0('0x20')]),_0x50ae9c);queues['blindtransfer'](_0x50ae9c);agents['blindtransfer'](_0x50ae9c);transfers['blindtransfer'](_0x50ae9c);recordings[_0xdaa0('0x35')](_0x50ae9c);}catch(_0x24ea42){utils[_0xdaa0('0x17')](util[_0xdaa0('0x1b')](_0xdaa0('0x36'),_0x50ae9c[_0xdaa0('0x20')]),_0x24ea42);}});ami['on'](_0xdaa0('0x37'),function(_0x450ebb){try{utils['debug'](util[_0xdaa0('0x1b')](_0xdaa0('0x38'),_0x450ebb['origtransfereruniqueid']),_0x450ebb);queues['attendedtransfer'](_0x450ebb);transfers[_0xdaa0('0x37')](_0x450ebb);agents[_0xdaa0('0x37')](_0x450ebb);calls[_0xdaa0('0x37')](_0x450ebb);}catch(_0x4b331d){utils[_0xdaa0('0x17')](util[_0xdaa0('0x1b')](_0xdaa0('0x38'),_0x450ebb[_0xdaa0('0x39')]),_0x4b331d);}});ami['on'](_0xdaa0('0x3a'),function(_0x151367){try{utils[_0xdaa0('0x1e')](util[_0xdaa0('0x1b')](_0xdaa0('0x3b'),_0x151367[_0xdaa0('0x20')]),_0x151367);queues[_0xdaa0('0x3a')](_0x151367);recordings[_0xdaa0('0x3a')](_0x151367);calls['varset'](_0x151367);dials[_0xdaa0('0x3a')](_0x151367);}catch(_0x226243){utils['error'](util[_0xdaa0('0x1b')](_0xdaa0('0x3b'),_0x151367[_0xdaa0('0x20')]),_0x226243);}});ami['on'](_0xdaa0('0x3c'),function(_0x408fe7){try{utils[_0xdaa0('0x1e')](util[_0xdaa0('0x1b')](_0xdaa0('0x3d'),_0x408fe7[_0xdaa0('0x20')]),_0x408fe7);calls[_0xdaa0('0x3c')](_0x408fe7);recordings[_0xdaa0('0x3c')](_0x408fe7);dials[_0xdaa0('0x3c')](_0x408fe7);}catch(_0x17f7c7){utils['error'](util['format'](_0xdaa0('0x3d'),_0x408fe7[_0xdaa0('0x20')]),_0x17f7c7);}});ami['on'](_0xdaa0('0x3e'),function(_0x284914){try{utils[_0xdaa0('0x1e')](util[_0xdaa0('0x1b')](_0xdaa0('0x3f'),_0x284914[_0xdaa0('0x20')]),_0x284914);calls[_0xdaa0('0x3e')](_0x284914);recordings['newchannel'](_0x284914);}catch(_0x5dd9bb){utils['error'](util[_0xdaa0('0x1b')]('[%s][index][newchannel]',_0x284914[_0xdaa0('0x20')]),_0x5dd9bb);}});ami['on']('dialbegin',function(_0x45be21){try{utils[_0xdaa0('0x1e')](util[_0xdaa0('0x1b')]('[%s][index][dialbegin]',_0x45be21[_0xdaa0('0x20')]),_0x45be21);dials[_0xdaa0('0x40')](_0x45be21);}catch(_0x3430ef){utils[_0xdaa0('0x17')](util[_0xdaa0('0x1b')](_0xdaa0('0x41'),_0x45be21[_0xdaa0('0x20')]),_0x3430ef);}});ami['on']('dialend',function(_0x486a07){try{utils[_0xdaa0('0x1e')](util[_0xdaa0('0x1b')](_0xdaa0('0x42'),_0x486a07[_0xdaa0('0x20')]),_0x486a07);dials['dialend'](_0x486a07);}catch(_0x110ecf){utils[_0xdaa0('0x17')](util[_0xdaa0('0x1b')]('[%s][index][dialend]',_0x486a07[_0xdaa0('0x20')]),_0x110ecf);}});} \ No newline at end of file +var _0x1f51=['info','Asterisk\x20disabled\x20on\x20localhost','./calls.controller','./queues.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','managerevent','format','device','[%s][index][devicestatechange]','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]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','origtransfereruniqueid','[%s][index][attendedtransfer]','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','local','asterisk','port','password'];(function(_0x324cda,_0x399192){var _0x370f58=function(_0x466754){while(--_0x466754){_0x324cda['push'](_0x324cda['shift']());}};_0x370f58(++_0x399192);}(_0x1f51,0x14e));var _0x11f5=function(_0x3d494e,_0x332f20){_0x3d494e=_0x3d494e-0x0;var _0x2081bb=_0x1f51[_0x3d494e];return _0x2081bb;};var AsteriskManager=require(_0x11f5('0x0'));var config=require(_0x11f5('0x1'));var utils=require(_0x11f5('0x2'));var util=require(_0x11f5('0x3'));var isXDREnabled=config['xdr']&&config[_0x11f5('0x4')][_0x11f5('0x5')]?!config[_0x11f5('0x4')][_0x11f5('0x5')]:!![];var isProduction=config[_0x11f5('0x6')]==='production'||![];var isLocalAsterisk=config[_0x11f5('0x4')]&&config[_0x11f5('0x4')][_0x11f5('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0x11f5('0x8')][_0x11f5('0x9')],config['asterisk']['ip'],config['asterisk']['username'],config[_0x11f5('0x8')][_0x11f5('0xa')],!![]);ami['keepConnected']();if(!isXDREnabled){utils[_0x11f5('0xb')]('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0x11f5('0xb')](_0x11f5('0xc'));}else{var agents=require('./agents.controller');var calls=require(_0x11f5('0xd'));var queues=require(_0x11f5('0xe'));var recordings=require('./recordings.controller');var members=require(_0x11f5('0xf'));var dials=require(_0x11f5('0x10'));var transfers=require(_0x11f5('0x11'));var core=require(_0x11f5('0x12'));ami['on'](_0x11f5('0x13'),core['connect']);ami['on'](_0x11f5('0x14'),core[_0x11f5('0x14')]);ami['on'](_0x11f5('0x15'),core['fullybooted']);ami['on'](_0x11f5('0x16'),core[_0x11f5('0x16')]);ami['on']('close',core['close']);ami['on']('managerevent',core[_0x11f5('0x17')]);ami['on']('devicestatechange',function(_0x344a2e){try{utils['debug'](util[_0x11f5('0x18')]('[%s][index][devicestatechange]',_0x344a2e[_0x11f5('0x19')]),_0x344a2e);members['devicestatechange'](_0x344a2e);}catch(_0x2c2d7b){utils[_0x11f5('0x16')](util[_0x11f5('0x18')](_0x11f5('0x1a'),_0x344a2e[_0x11f5('0x19')]),_0x2c2d7b);}});ami['on'](_0x11f5('0x1b'),function(_0x28f5a4){try{utils[_0x11f5('0x1c')](util['format'](_0x11f5('0x1d'),_0x28f5a4[_0x11f5('0x1e')]),_0x28f5a4);agents[_0x11f5('0x1b')](_0x28f5a4);}catch(_0x2d26d9){utils['error'](util[_0x11f5('0x18')](_0x11f5('0x1d'),_0x28f5a4['uniqueid']),_0x2d26d9);}});ami['on']('agentringnoanswer',function(_0x2ee9e7){try{utils[_0x11f5('0x1c')](util['format']('[%s][index][agentringnoanswer]',_0x2ee9e7[_0x11f5('0x1e')]),_0x2ee9e7);agents[_0x11f5('0x1f')](_0x2ee9e7);}catch(_0x1ff45f){utils['error'](util['format'](_0x11f5('0x20'),_0x2ee9e7['uniqueid']),_0x1ff45f);}});ami['on'](_0x11f5('0x21'),function(_0x8e8602){try{utils['debug'](util['format']('[%s][index][agentconnect]',_0x8e8602['uniqueid']),_0x8e8602);agents[_0x11f5('0x21')](_0x8e8602);queues[_0x11f5('0x21')](_0x8e8602);}catch(_0x3b7a68){utils[_0x11f5('0x16')](util['format'](_0x11f5('0x22'),_0x8e8602[_0x11f5('0x1e')]),_0x3b7a68);}});ami['on'](_0x11f5('0x23'),function(_0x55dab8){try{utils['debug'](util[_0x11f5('0x18')]('[%s][index][agentcomplete]',_0x55dab8[_0x11f5('0x1e')]),_0x55dab8);agents[_0x11f5('0x23')](_0x55dab8);queues[_0x11f5('0x23')](_0x55dab8);members['agentcomplete'](_0x55dab8);}catch(_0x466477){utils[_0x11f5('0x16')](util['format'](_0x11f5('0x24'),_0x55dab8[_0x11f5('0x1e')]),_0x466477);}});ami['on'](_0x11f5('0x25'),function(_0x90cc65){try{utils[_0x11f5('0x1c')](util[_0x11f5('0x18')]('[%s][index][queuecallerabandon]',_0x90cc65[_0x11f5('0x1e')]),_0x90cc65);agents[_0x11f5('0x25')](_0x90cc65);queues['queuecallerabandon'](_0x90cc65);}catch(_0x8eba79){utils[_0x11f5('0x16')](util[_0x11f5('0x18')](_0x11f5('0x26'),_0x90cc65[_0x11f5('0x1e')]),_0x8eba79);}});ami['on'](_0x11f5('0x27'),function(_0x437f19){try{utils['debug'](util[_0x11f5('0x18')](_0x11f5('0x28'),_0x437f19[_0x11f5('0x1e')]),_0x437f19);queues[_0x11f5('0x27')](_0x437f19);recordings[_0x11f5('0x27')](_0x437f19);}catch(_0x467b03){utils[_0x11f5('0x16')](util[_0x11f5('0x18')]('[%s][index][queuecallerjoin]',_0x437f19[_0x11f5('0x1e')]),_0x467b03);}});ami['on'](_0x11f5('0x29'),function(_0x363393){try{utils['debug'](util[_0x11f5('0x18')](_0x11f5('0x2a'),_0x363393[_0x11f5('0x1e')]),_0x363393);queues[_0x11f5('0x29')](_0x363393);}catch(_0x28bcd8){utils['error'](util[_0x11f5('0x18')](_0x11f5('0x2a'),_0x363393[_0x11f5('0x1e')]),_0x28bcd8);}});ami['on'](_0x11f5('0x2b'),function(_0x58758c){try{utils[_0x11f5('0x1c')](util['format'](_0x11f5('0x2c'),_0x58758c[_0x11f5('0x1e')]),_0x58758c);queues[_0x11f5('0x2b')](_0x58758c);calls['musiconholdstart'](_0x58758c);}catch(_0x3b6367){utils[_0x11f5('0x16')](util[_0x11f5('0x18')](_0x11f5('0x2c'),_0x58758c[_0x11f5('0x1e')]),_0x3b6367);}});ami['on'](_0x11f5('0x2d'),function(_0x573301){try{utils[_0x11f5('0x1c')](util[_0x11f5('0x18')](_0x11f5('0x2e'),_0x573301[_0x11f5('0x1e')]),_0x573301);queues[_0x11f5('0x2d')](_0x573301);calls[_0x11f5('0x2d')](_0x573301);}catch(_0x51ce21){utils[_0x11f5('0x16')](util['format'](_0x11f5('0x2e'),_0x573301['uniqueid']),_0x51ce21);}});ami['on'](_0x11f5('0x2f'),function(_0x20cb1d){try{utils[_0x11f5('0x1c')](util['format']('[%s][index][newstate]',_0x20cb1d['uniqueid']),_0x20cb1d);calls[_0x11f5('0x2f')](_0x20cb1d);recordings['newstate'](_0x20cb1d);}catch(_0x5c0ecf){utils[_0x11f5('0x16')](util[_0x11f5('0x18')](_0x11f5('0x30'),_0x20cb1d[_0x11f5('0x1e')]),_0x5c0ecf);}});ami['on'](_0x11f5('0x31'),function(_0xe02d27){try{utils[_0x11f5('0x1c')](util['format'](_0x11f5('0x32'),_0xe02d27[_0x11f5('0x1e')]),_0xe02d27);calls['hangup'](_0xe02d27);recordings[_0x11f5('0x31')](_0xe02d27);dials['hangup'](_0xe02d27);agents[_0x11f5('0x31')](_0xe02d27);queues[_0x11f5('0x31')](_0xe02d27);}catch(_0x5346cf){utils[_0x11f5('0x16')](util[_0x11f5('0x18')](_0x11f5('0x32'),_0xe02d27['uniqueid']),_0x5346cf);}});ami['on'](_0x11f5('0x33'),function(_0x29673a){try{utils[_0x11f5('0x1c')](util['format'](_0x11f5('0x34'),_0x29673a['uniqueid']),_0x29673a);members[_0x11f5('0x33')](_0x29673a);}catch(_0x175277){utils[_0x11f5('0x16')](util[_0x11f5('0x18')](_0x11f5('0x34'),_0x29673a[_0x11f5('0x1e')]),_0x175277);}});ami['on'](_0x11f5('0x35'),function(_0x4ae500){try{utils[_0x11f5('0x1c')](util[_0x11f5('0x18')](_0x11f5('0x36'),_0x4ae500['uniqueid']),_0x4ae500);queues[_0x11f5('0x35')](_0x4ae500);agents[_0x11f5('0x35')](_0x4ae500);transfers[_0x11f5('0x35')](_0x4ae500);recordings[_0x11f5('0x35')](_0x4ae500);}catch(_0x95f00f){utils[_0x11f5('0x16')](util['format'](_0x11f5('0x36'),_0x4ae500['uniqueid']),_0x95f00f);}});ami['on'](_0x11f5('0x37'),function(_0x5b0a40){try{utils[_0x11f5('0x1c')](util[_0x11f5('0x18')]('[%s][index][attendedtransfer]',_0x5b0a40[_0x11f5('0x38')]),_0x5b0a40);queues['attendedtransfer'](_0x5b0a40);transfers['attendedtransfer'](_0x5b0a40);agents[_0x11f5('0x37')](_0x5b0a40);calls[_0x11f5('0x37')](_0x5b0a40);}catch(_0x3f1fca){utils[_0x11f5('0x16')](util['format'](_0x11f5('0x39'),_0x5b0a40[_0x11f5('0x38')]),_0x3f1fca);}});ami['on'](_0x11f5('0x3a'),function(_0x5a955f){try{utils[_0x11f5('0x1c')](util[_0x11f5('0x18')](_0x11f5('0x3b'),_0x5a955f[_0x11f5('0x1e')]),_0x5a955f);queues[_0x11f5('0x3a')](_0x5a955f);recordings[_0x11f5('0x3a')](_0x5a955f);calls[_0x11f5('0x3a')](_0x5a955f);dials[_0x11f5('0x3a')](_0x5a955f);}catch(_0x1c13a6){utils[_0x11f5('0x16')](util[_0x11f5('0x18')](_0x11f5('0x3b'),_0x5a955f['uniqueid']),_0x1c13a6);}});ami['on'](_0x11f5('0x3c'),function(_0x51c330){try{utils[_0x11f5('0x1c')](util[_0x11f5('0x18')](_0x11f5('0x3d'),_0x51c330['uniqueid']),_0x51c330);calls['newexten'](_0x51c330);recordings[_0x11f5('0x3c')](_0x51c330);dials[_0x11f5('0x3c')](_0x51c330);}catch(_0x6a047c){utils[_0x11f5('0x16')](util[_0x11f5('0x18')]('[%s][index][newexten]',_0x51c330[_0x11f5('0x1e')]),_0x6a047c);}});ami['on'](_0x11f5('0x3e'),function(_0x393955){try{utils[_0x11f5('0x1c')](util[_0x11f5('0x18')](_0x11f5('0x3f'),_0x393955['uniqueid']),_0x393955);calls[_0x11f5('0x3e')](_0x393955);recordings[_0x11f5('0x3e')](_0x393955);}catch(_0x56591c){utils[_0x11f5('0x16')](util[_0x11f5('0x18')](_0x11f5('0x3f'),_0x393955['uniqueid']),_0x56591c);}});ami['on'](_0x11f5('0x40'),function(_0xf23cd0){try{utils[_0x11f5('0x1c')](util['format'](_0x11f5('0x41'),_0xf23cd0[_0x11f5('0x1e')]),_0xf23cd0);dials[_0x11f5('0x40')](_0xf23cd0);}catch(_0x316b49){utils['error'](util['format'](_0x11f5('0x42'),_0xf23cd0[_0x11f5('0x1e')]),_0x316b49);}});ami['on'](_0x11f5('0x43'),function(_0x4146ad){try{utils[_0x11f5('0x1c')](util['format'](_0x11f5('0x44'),_0x4146ad[_0x11f5('0x1e')]),_0x4146ad);dials[_0x11f5('0x43')](_0x4146ad);}catch(_0x323caf){utils[_0x11f5('0x16')](util[_0x11f5('0x18')](_0x11f5('0x44'),_0x4146ad[_0x11f5('0x1e')]),_0x323caf);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index ccb097b..b8cf946 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 _0x8a30=['[%s][members][cdr]','lodash','util','Local/_attended@transfer','Queue:','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','data2','type','name','internal','CreateMemberReport','getUserByName','split','then','catch','error','format','[%s][members][writeDB]','some','startsWith','devicestatechange','[%s][members][devicestatechange]','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','device','state','INUSE','BUSY','voice','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','agentcomplete','debug','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','cdr','channel','data1','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','assign'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x8a30,0x1a1));var _0x08a3=function(_0x353d26,_0x422708){_0x353d26=_0x353d26-0x0;var _0xd34918=_0x8a30[_0x353d26];return _0xd34918;};'use strict';var _=require(_0x08a3('0x0'));var util=require(_0x08a3('0x1'));var utils=require('./utils');var members={};var exclude=[_0x08a3('0x2'),_0x08a3('0x3')];function writeDB(_0x2a3202){utils['info'](util['format'](_0x08a3('0x4'),_0x2a3202[_0x08a3('0x5')],_0x2a3202[_0x08a3('0x6')],_0x2a3202['channel'],_0x2a3202[_0x08a3('0x7')],_0x2a3202['membername'],_0x2a3202[_0x08a3('0x8')]));if(_0x2a3202[_0x08a3('0x6')]){utils['getUserByInterface'](_0x2a3202[_0x08a3('0x6')])['then'](function(_0x86f47a){if(_0x86f47a){_0x2a3202['membername']=_0x86f47a[_0x08a3('0x9')];_0x2a3202[_0x08a3('0xa')]=_0x86f47a[_0x08a3('0xa')];utils['request'](_0x08a3('0xb'),_0x2a3202);}else{utils[_0x08a3('0xc')](_0x2a3202[_0x08a3('0x6')][_0x08a3('0xd')]('/')[0x1])[_0x08a3('0xe')](function(_0x1369a6){if(_0x1369a6){_0x2a3202['membername']=_0x1369a6['name'];_0x2a3202[_0x08a3('0xa')]=_0x1369a6['internal'];utils['request'](_0x08a3('0xb'),_0x2a3202);}});}})[_0x08a3('0xf')](function(_0x51aea7){utils[_0x08a3('0x10')](util[_0x08a3('0x11')](_0x08a3('0x12'),_0x2a3202[_0x08a3('0x5')]),_0x51aea7);});}delete members[_0x2a3202[_0x08a3('0x6')]];}function startsWith(_0xa999eb,_0x1f839d){return _[_0x08a3('0x13')](_0xa999eb,function(_0x541851){return _[_0x08a3('0x14')](_0x1f839d,_0x541851);});}exports[_0x08a3('0x15')]=function(_0x16e3d5){try{utils['debug'](util[_0x08a3('0x11')](_0x08a3('0x16'),members[_0x16e3d5['device']]?members[_0x16e3d5['device']][_0x08a3('0x5')]:_0x16e3d5['device']),_0x16e3d5);utils[_0x08a3('0x17')](util[_0x08a3('0x11')](_0x08a3('0x18'),members[_0x16e3d5[_0x08a3('0x19')]]?members[_0x16e3d5[_0x08a3('0x19')]][_0x08a3('0x5')]:_0x16e3d5[_0x08a3('0x19')],_0x16e3d5[_0x08a3('0x1a')],_0x16e3d5[_0x08a3('0x19')]));switch(_0x16e3d5[_0x08a3('0x1a')]){case _0x08a3('0x1b'):case _0x08a3('0x1c'):if(!startsWith(exclude,_0x16e3d5['device'])){members[_0x16e3d5['device']]={'channel':_0x08a3('0x1d'),'interface':_0x16e3d5['device'],'type':'TALKING','enterAt':utils[_0x08a3('0x1e')](),'role':_0x08a3('0x1f')};}break;case _0x08a3('0x20'):if(!_[_0x08a3('0x21')](members[_0x16e3d5[_0x08a3('0x19')]])){members[_0x16e3d5[_0x08a3('0x19')]][_0x08a3('0x22')]=utils[_0x08a3('0x1e')]();members[_0x16e3d5[_0x08a3('0x19')]][_0x08a3('0x23')]=utils[_0x08a3('0x24')](members[_0x16e3d5['device']][_0x08a3('0x22')],members[_0x16e3d5[_0x08a3('0x19')]][_0x08a3('0x25')]);if(members[_0x16e3d5[_0x08a3('0x19')]]['uniqueid']){writeDB(members[_0x16e3d5[_0x08a3('0x19')]]);}}break;default:break;}}catch(_0x13f885){utils[_0x08a3('0x10')](util[_0x08a3('0x11')]('[%s][members][devicestatechange]',members[_0x16e3d5[_0x08a3('0x19')]]?members[_0x16e3d5[_0x08a3('0x19')]][_0x08a3('0x5')]:_0x16e3d5['device']),_0x13f885);}};exports[_0x08a3('0x26')]=function(_0x288d49){try{if(!_[_0x08a3('0x21')](members[_0x288d49[_0x08a3('0x6')]])){utils[_0x08a3('0x27')](util[_0x08a3('0x11')](_0x08a3('0x28'),_0x288d49[_0x08a3('0x5')]),_0x288d49);utils[_0x08a3('0x17')](util[_0x08a3('0x11')](_0x08a3('0x29'),_0x288d49['uniqueid'],_0x288d49['interface'],_0x288d49[_0x08a3('0x2a')]));members[_0x288d49[_0x08a3('0x6')]]=_['assign'](members[_0x288d49[_0x08a3('0x6')]],{'data4':_0x288d49[_0x08a3('0x2a')],'uniqueid':_0x288d49[_0x08a3('0x5')]});}}catch(_0x3cf705){utils[_0x08a3('0x10')](util[_0x08a3('0x11')](_0x08a3('0x28'),_0x288d49[_0x08a3('0x5')]),_0x3cf705);}};exports[_0x08a3('0x2b')]=function(_0x581c30){try{utils[_0x08a3('0x27')](util[_0x08a3('0x11')]('[%s][members][cdr]',_0x581c30[_0x08a3('0x5')]),_0x581c30);if(_0x581c30[_0x08a3('0x2c')]){var _0x3dd7ea=_0x581c30[_0x08a3('0x2c')][_0x08a3('0xd')]('-')[0x0];if(!_['isNil'](members[_0x3dd7ea])){members[_0x3dd7ea]=_['assign'](members[_0x3dd7ea],{'data1':members[_0x3dd7ea][_0x08a3('0x2d')]||_0x581c30['type'],'data2':members[_0x3dd7ea]['data2']||_0x581c30['source'],'data3':members[_0x3dd7ea][_0x08a3('0x2e')]||_0x581c30[_0x08a3('0x2f')],'uniqueid':members[_0x3dd7ea][_0x08a3('0x5')]||_0x581c30['uniqueid']});utils[_0x08a3('0x17')](util[_0x08a3('0x11')](_0x08a3('0x30'),_0x581c30[_0x08a3('0x5')],members[_0x3dd7ea][_0x08a3('0x2d')],members[_0x3dd7ea][_0x08a3('0x7')],members[_0x3dd7ea][_0x08a3('0x2e')]));if(members[_0x3dd7ea][_0x08a3('0x22')]){writeDB(members[_0x3dd7ea]);}}}if(_0x581c30[_0x08a3('0x31')]){var _0x1d7486=_0x581c30['destinationchannel']['split']('-')[0x0];if(!_[_0x08a3('0x21')](members[_0x1d7486])){members[_0x1d7486]=_[_0x08a3('0x32')](members[_0x1d7486],{'data1':members[_0x1d7486][_0x08a3('0x2d')]||_0x581c30[_0x08a3('0x8')],'data2':members[_0x1d7486][_0x08a3('0x7')]||_0x581c30['source'],'data3':members[_0x1d7486][_0x08a3('0x2e')]||_0x581c30[_0x08a3('0x2f')],'uniqueid':members[_0x1d7486][_0x08a3('0x5')]||_0x581c30['uniqueid']});utils[_0x08a3('0x17')](util[_0x08a3('0x11')](_0x08a3('0x30'),_0x581c30['uniqueid'],members[_0x1d7486][_0x08a3('0x2d')],members[_0x1d7486]['data2'],members[_0x1d7486][_0x08a3('0x2e')]));if(members[_0x1d7486]['exitAt']){writeDB(members[_0x1d7486]);}}}}catch(_0x17e73e){utils[_0x08a3('0x10')](util[_0x08a3('0x11')](_0x08a3('0x33'),_0x581c30['uniqueid']),_0x17e73e);}}; \ No newline at end of file +var _0xd73a=['./utils','Local/_attended@transfer','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','type','getUserByInterface','name','internal','CreateMemberReport','then','catch','error','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','device','info','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','[%s][members][devicestatechange]','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','split','assign','lodash','util'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0xd73a,0x171));var _0xad73=function(_0x5c6bc9,_0x4276f7){_0x5c6bc9=_0x5c6bc9-0x0;var _0x5b1fa5=_0xd73a[_0x5c6bc9];return _0x5b1fa5;};'use strict';var _=require(_0xad73('0x0'));var util=require(_0xad73('0x1'));var utils=require(_0xad73('0x2'));var members={};var exclude=[_0xad73('0x3'),_0xad73('0x4')];function writeDB(_0x59c24f){utils['info'](util[_0xad73('0x5')](_0xad73('0x6'),_0x59c24f[_0xad73('0x7')],_0x59c24f[_0xad73('0x8')],_0x59c24f[_0xad73('0x9')],_0x59c24f[_0xad73('0xa')],_0x59c24f[_0xad73('0xb')],_0x59c24f[_0xad73('0xc')]));if(_0x59c24f[_0xad73('0x8')]){utils[_0xad73('0xd')](_0x59c24f[_0xad73('0x8')])['then'](function(_0x39cd6d){if(_0x39cd6d){_0x59c24f['membername']=_0x39cd6d[_0xad73('0xe')];_0x59c24f[_0xad73('0xf')]=_0x39cd6d[_0xad73('0xf')];utils['request'](_0xad73('0x10'),_0x59c24f);}else{utils['getUserByName'](_0x59c24f[_0xad73('0x8')]['split']('/')[0x1])[_0xad73('0x11')](function(_0x32be55){if(_0x32be55){_0x59c24f[_0xad73('0xb')]=_0x32be55['name'];_0x59c24f[_0xad73('0xf')]=_0x32be55[_0xad73('0xf')];utils['request'](_0xad73('0x10'),_0x59c24f);}});}})[_0xad73('0x12')](function(_0x2ba4d5){utils[_0xad73('0x13')](util[_0xad73('0x5')](_0xad73('0x14'),_0x59c24f['uniqueid']),_0x2ba4d5);});}delete members[_0x59c24f[_0xad73('0x8')]];}function startsWith(_0x35c2c5,_0x4336fa){return _[_0xad73('0x15')](_0x35c2c5,function(_0x2f0dcd){return _[_0xad73('0x16')](_0x4336fa,_0x2f0dcd);});}exports[_0xad73('0x17')]=function(_0x367a5d){try{utils[_0xad73('0x18')](util[_0xad73('0x5')]('[%s][members][devicestatechange]',members[_0x367a5d[_0xad73('0x19')]]?members[_0x367a5d['device']]['uniqueid']:_0x367a5d[_0xad73('0x19')]),_0x367a5d);utils[_0xad73('0x1a')](util[_0xad73('0x5')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x367a5d[_0xad73('0x19')]]?members[_0x367a5d[_0xad73('0x19')]]['uniqueid']:_0x367a5d[_0xad73('0x19')],_0x367a5d[_0xad73('0x1b')],_0x367a5d[_0xad73('0x19')]));switch(_0x367a5d[_0xad73('0x1b')]){case _0xad73('0x1c'):case _0xad73('0x1d'):if(!startsWith(exclude,_0x367a5d[_0xad73('0x19')])){members[_0x367a5d['device']]={'channel':_0xad73('0x1e'),'interface':_0x367a5d[_0xad73('0x19')],'type':_0xad73('0x1f'),'enterAt':utils[_0xad73('0x20')](),'role':_0xad73('0x21')};}break;case _0xad73('0x22'):if(!_[_0xad73('0x23')](members[_0x367a5d[_0xad73('0x19')]])){members[_0x367a5d[_0xad73('0x19')]][_0xad73('0x24')]=utils[_0xad73('0x20')]();members[_0x367a5d[_0xad73('0x19')]][_0xad73('0x25')]=utils[_0xad73('0x26')](members[_0x367a5d[_0xad73('0x19')]][_0xad73('0x24')],members[_0x367a5d[_0xad73('0x19')]][_0xad73('0x27')]);if(members[_0x367a5d[_0xad73('0x19')]][_0xad73('0x7')]){writeDB(members[_0x367a5d['device']]);}}break;default:break;}}catch(_0x4e0855){utils['error'](util[_0xad73('0x5')](_0xad73('0x28'),members[_0x367a5d['device']]?members[_0x367a5d[_0xad73('0x19')]]['uniqueid']:_0x367a5d['device']),_0x4e0855);}};exports[_0xad73('0x29')]=function(_0x377273){try{if(!_[_0xad73('0x23')](members[_0x377273[_0xad73('0x8')]])){utils['debug'](util[_0xad73('0x5')](_0xad73('0x2a'),_0x377273[_0xad73('0x7')]),_0x377273);utils['info'](util[_0xad73('0x5')](_0xad73('0x2b'),_0x377273[_0xad73('0x7')],_0x377273[_0xad73('0x8')],_0x377273[_0xad73('0x2c')]));members[_0x377273['interface']]=_['assign'](members[_0x377273['interface']],{'data4':_0x377273[_0xad73('0x2c')],'uniqueid':_0x377273['uniqueid']});}}catch(_0x3f4a8a){utils['error'](util[_0xad73('0x5')](_0xad73('0x2a'),_0x377273['uniqueid']),_0x3f4a8a);}};exports['cdr']=function(_0x2f9b2b){try{utils[_0xad73('0x18')](util['format']('[%s][members][cdr]',_0x2f9b2b[_0xad73('0x7')]),_0x2f9b2b);if(_0x2f9b2b['channel']){var _0x4016ec=_0x2f9b2b[_0xad73('0x9')]['split']('-')[0x0];if(!_[_0xad73('0x23')](members[_0x4016ec])){members[_0x4016ec]=_['assign'](members[_0x4016ec],{'data1':members[_0x4016ec][_0xad73('0x2d')]||_0x2f9b2b[_0xad73('0xc')],'data2':members[_0x4016ec][_0xad73('0xa')]||_0x2f9b2b[_0xad73('0x2e')],'data3':members[_0x4016ec][_0xad73('0x2f')]||_0x2f9b2b[_0xad73('0x30')],'uniqueid':members[_0x4016ec][_0xad73('0x7')]||_0x2f9b2b[_0xad73('0x7')]});utils[_0xad73('0x1a')](util['format'](_0xad73('0x31'),_0x2f9b2b[_0xad73('0x7')],members[_0x4016ec]['data1'],members[_0x4016ec][_0xad73('0xa')],members[_0x4016ec][_0xad73('0x2f')]));if(members[_0x4016ec][_0xad73('0x24')]){writeDB(members[_0x4016ec]);}}}if(_0x2f9b2b[_0xad73('0x32')]){var _0x45210f=_0x2f9b2b[_0xad73('0x32')][_0xad73('0x33')]('-')[0x0];if(!_[_0xad73('0x23')](members[_0x45210f])){members[_0x45210f]=_[_0xad73('0x34')](members[_0x45210f],{'data1':members[_0x45210f]['data1']||_0x2f9b2b[_0xad73('0xc')],'data2':members[_0x45210f][_0xad73('0xa')]||_0x2f9b2b[_0xad73('0x2e')],'data3':members[_0x45210f]['data3']||_0x2f9b2b['destination'],'uniqueid':members[_0x45210f][_0xad73('0x7')]||_0x2f9b2b['uniqueid']});utils['info'](util[_0xad73('0x5')](_0xad73('0x31'),_0x2f9b2b[_0xad73('0x7')],members[_0x45210f][_0xad73('0x2d')],members[_0x45210f]['data2'],members[_0x45210f][_0xad73('0x2f')]));if(members[_0x45210f][_0xad73('0x24')]){writeDB(members[_0x45210f]);}}}}catch(_0x486961){utils[_0xad73('0x13')](util[_0xad73('0x5')]('[%s][members][cdr]',_0x2f9b2b[_0xad73('0x7')]),_0x486961);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index a5db15c..4651812 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 _0xc912=['CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','error','isNil','debug','[%s][queues][hangup]','queuecallerabandon','queuecallerexit','queuecallercomplete','now','queuecallerexitreason','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','holdtime','queuecallerleaveAt','connectedlinename','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','queuecallerabandonAt','assigned','lastAssignedTo','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','blindtransfer','transfereeuniqueid','transfertype','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transferexten','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','queuecallerjoinAt','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','calleridnum','getVoiceQueueByName','type','request'];(function(_0x317e57,_0x56894e){var _0x22cbcc=function(_0x776734){while(--_0x776734){_0x317e57['push'](_0x317e57['shift']());}};_0x22cbcc(++_0x56894e);}(_0xc912,0x188));var _0x2c91=function(_0x292b4d,_0x55fd3d){_0x292b4d=_0x292b4d-0x0;var _0x4c25a9=_0xc912[_0x292b4d];return _0x4c25a9;};'use strict';var _=require(_0x2c91('0x0'));var util=require(_0x2c91('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x401bc6){utils[_0x2c91('0x2')](util[_0x2c91('0x3')](_0x2c91('0x4'),_0x401bc6[_0x2c91('0x5')],_0x401bc6[_0x2c91('0x6')],_0x401bc6[_0x2c91('0x7')],_0x401bc6['lastAssignedTo'],_0x401bc6[_0x2c91('0x8')],_0x401bc6['accountcode'],_0x401bc6['queuecallerexitreason']));if(_0x401bc6[_0x2c91('0x7')]){utils[_0x2c91('0x9')](_0x401bc6[_0x2c91('0x7')])['then'](function(_0x2594c9){if(_0x2594c9){_0x401bc6['type']=_0x2594c9[_0x2c91('0xa')];}utils[_0x2c91('0xb')](_0x2c91('0xc'),_0x401bc6);});}else{utils[_0x2c91('0xb')](_0x2c91('0xc'),_0x401bc6);}if(_0x401bc6['transfereduniqueid']){delete queues[_0x401bc6[_0x2c91('0xd')]];}else{delete queues[_0x401bc6[_0x2c91('0x5')]];}}exports[_0x2c91('0xe')]=function(_0x135257){try{utils['debug'](util[_0x2c91('0x3')](_0x2c91('0xf'),_0x135257[_0x2c91('0x5')]),_0x135257);utils[_0x2c91('0x2')](util['format'](_0x2c91('0x10'),_0x135257[_0x2c91('0x5')],_0x135257[_0x2c91('0x7')],_0x135257[_0x2c91('0x11')]));queues[_0x135257['uniqueid']]=_[_0x2c91('0x12')](_0x135257,{'originalposition':_0x135257['position'],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x12d765){utils[_0x2c91('0x13')](util[_0x2c91('0x3')](_0x2c91('0xf'),_0x135257[_0x2c91('0x5')]),_0x12d765);}};exports['hangup']=function(_0x1906c8){try{if(!_[_0x2c91('0x14')](queues[_0x1906c8['uniqueid']])){utils[_0x2c91('0x15')](util[_0x2c91('0x3')](_0x2c91('0x16'),_0x1906c8['uniqueid']),_0x1906c8);if(queues[_0x1906c8[_0x2c91('0x5')]]['queuecallerleaveAt']){if(!queues[_0x1906c8['uniqueid']][_0x2c91('0x17')]&&!queues[_0x1906c8['uniqueid']][_0x2c91('0x18')]){queues[_0x1906c8[_0x2c91('0x5')]][_0x2c91('0x19')]=!![];queues[_0x1906c8['uniqueid']]['queuecallercompleteAt']=utils[_0x2c91('0x1a')]();queues[_0x1906c8[_0x2c91('0x5')]][_0x2c91('0x1b')]=_0x2c91('0x1c');}utils['info'](util[_0x2c91('0x3')](_0x2c91('0x1d'),_0x1906c8[_0x2c91('0x5')],queues[_0x1906c8['uniqueid']][_0x2c91('0x1e')],queues[_0x1906c8[_0x2c91('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x1906c8[_0x2c91('0x5')]]);}else if(queues[_0x1906c8[_0x2c91('0x5')]][_0x2c91('0xd')]){utils[_0x2c91('0x2')](util[_0x2c91('0x3')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x1906c8['uniqueid'],queues[_0x1906c8[_0x2c91('0x5')]][_0x2c91('0x1e')],queues[_0x1906c8[_0x2c91('0x5')]][_0x2c91('0xd')]));queues[queues[_0x1906c8[_0x2c91('0x5')]]['transfereduniqueid']]=queues[_0x1906c8['uniqueid']];queues[queues[_0x1906c8[_0x2c91('0x5')]][_0x2c91('0xd')]][_0x2c91('0x1f')]=0x2;delete queues[_0x1906c8[_0x2c91('0x5')]];}}}catch(_0xe74768){utils[_0x2c91('0x13')](util[_0x2c91('0x3')](_0x2c91('0x16'),_0x1906c8['uniqueid']),_0xe74768);}};exports[_0x2c91('0x20')]=function(_0x3184e6){try{utils[_0x2c91('0x15')](util[_0x2c91('0x3')](_0x2c91('0x21'),_0x3184e6[_0x2c91('0x5')]),_0x3184e6);if(!_['isNil'](_0x3184e6[_0x2c91('0x22')][_0x2c91('0x23')])&&_0x3184e6[_0x2c91('0x24')][_0x2c91('0x25')]()!==_0x2c91('0x26')){if(!_[_0x2c91('0x14')](queues[_0x3184e6[_0x2c91('0x5')]])){queues[_0x3184e6[_0x2c91('0x5')]]['queuecallerabandon']=![];queues[_0x3184e6[_0x2c91('0x5')]]['queuecallerabandonAt']=null;queues[_0x3184e6[_0x2c91('0x5')]]['queuecallerexit']=!![];queues[_0x3184e6['uniqueid']][_0x2c91('0x27')]=utils[_0x2c91('0x1a')]();queues[_0x3184e6[_0x2c91('0x5')]][_0x2c91('0x1b')]=_0x3184e6[_0x2c91('0x24')][_0x2c91('0x25')]();utils[_0x2c91('0x2')](util['format'](_0x2c91('0x28'),_0x3184e6[_0x2c91('0x5')],queues[_0x3184e6[_0x2c91('0x5')]][_0x2c91('0x1e')],_0x3184e6['value'],queues[_0x3184e6[_0x2c91('0x5')]][_0x2c91('0x1b')]));writeDB(queues[_0x3184e6['uniqueid']]);}}else if(!_[_0x2c91('0x14')](_0x3184e6['variable'][_0x2c91('0x29')])){if(!_[_0x2c91('0x14')](queues[_0x3184e6['uniqueid']])&&!queues[_0x3184e6[_0x2c91('0x5')]][_0x2c91('0x17')]){queues[_0x3184e6[_0x2c91('0x5')]]['queuecallerabandon']=![];queues[_0x3184e6[_0x2c91('0x5')]]['queuecallerabandonAt']=null;queues[_0x3184e6['uniqueid']][_0x2c91('0x18')]=!![];queues[_0x3184e6[_0x2c91('0x5')]][_0x2c91('0x27')]=utils['now']();queues[_0x3184e6[_0x2c91('0x5')]]['queuecallerexitreason']='EXITWITHKEY';utils[_0x2c91('0x2')](util[_0x2c91('0x3')](_0x2c91('0x2a'),_0x3184e6[_0x2c91('0x5')],queues[_0x3184e6[_0x2c91('0x5')]]['name'],_0x3184e6['value'],queues[_0x3184e6[_0x2c91('0x5')]]['queuecallerexitreason']));}}}catch(_0x5ba302){utils[_0x2c91('0x13')](util[_0x2c91('0x3')](_0x2c91('0x21'),_0x3184e6[_0x2c91('0x5')]),_0x5ba302);}};exports['queuecallerabandon']=function(_0x1a1de2){try{if(!_[_0x2c91('0x14')](queues[_0x1a1de2[_0x2c91('0x5')]])){utils[_0x2c91('0x15')](util[_0x2c91('0x3')](_0x2c91('0x2b'),_0x1a1de2['uniqueid']),_0x1a1de2);queues[_0x1a1de2[_0x2c91('0x5')]][_0x2c91('0x18')]=![];queues[_0x1a1de2[_0x2c91('0x5')]]['queuecallerexitAt']=null;queues[_0x1a1de2[_0x2c91('0x5')]][_0x2c91('0x17')]=!![];queues[_0x1a1de2[_0x2c91('0x5')]]['queuecallerabandonAt']=utils[_0x2c91('0x1a')]();queues[_0x1a1de2['uniqueid']]['queuecallerexitreason']=_0x2c91('0x2c');utils['info'](util[_0x2c91('0x3')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x1a1de2[_0x2c91('0x5')],queues[_0x1a1de2[_0x2c91('0x5')]][_0x2c91('0x1e')],queues[_0x1a1de2['uniqueid']]['queuecallerexitreason']));}}catch(_0x348902){utils[_0x2c91('0x13')](util[_0x2c91('0x3')](_0x2c91('0x2b'),_0x1a1de2['uniqueid']),_0x348902);}};exports['queuecallerleave']=function(_0x1adeaa){try{if(!_[_0x2c91('0x14')](queues[_0x1adeaa[_0x2c91('0x5')]])){utils[_0x2c91('0x15')](util[_0x2c91('0x3')](_0x2c91('0x2d'),_0x1adeaa[_0x2c91('0x5')]),_0x1adeaa);utils['info'](util['format'](_0x2c91('0x2e'),_0x1adeaa[_0x2c91('0x5')],queues[_0x1adeaa['uniqueid']][_0x2c91('0x1e')],_0x1adeaa[_0x2c91('0x2f')],_0x1adeaa['connectedlinename']));queues[_0x1adeaa[_0x2c91('0x5')]]['queuecallerleave']=!![];queues[_0x1adeaa[_0x2c91('0x5')]]['queuecallerleaveAt']=utils['now']();queues[_0x1adeaa['uniqueid']][_0x2c91('0x30')]=utils['diffTime'](queues[_0x1adeaa[_0x2c91('0x5')]][_0x2c91('0x31')],queues[_0x1adeaa[_0x2c91('0x5')]]['queuecallerjoinAt']);queues[_0x1adeaa[_0x2c91('0x5')]]['position']=_0x1adeaa[_0x2c91('0x11')];queues[_0x1adeaa[_0x2c91('0x5')]]['count']=_0x1adeaa['count'];queues[_0x1adeaa['uniqueid']][_0x2c91('0x2f')]=_0x1adeaa[_0x2c91('0x2f')];queues[_0x1adeaa['uniqueid']][_0x2c91('0x32')]=_0x1adeaa[_0x2c91('0x32')];}}catch(_0xa5a1e1){utils[_0x2c91('0x13')](util[_0x2c91('0x3')]('[%s][queues][queuecallerleave]',_0x1adeaa['uniqueid']),_0xa5a1e1);}};exports[_0x2c91('0x33')]=function(_0x2b58a5){try{if(!_[_0x2c91('0x14')](queues[_0x2b58a5[_0x2c91('0x5')]])){utils['debug'](util[_0x2c91('0x3')](_0x2c91('0x34'),_0x2b58a5[_0x2c91('0x5')]),_0x2b58a5);utils[_0x2c91('0x2')](util[_0x2c91('0x3')](_0x2c91('0x35'),_0x2b58a5[_0x2c91('0x5')],queues[_0x2b58a5[_0x2c91('0x5')]][_0x2c91('0x1e')],_0x2b58a5[_0x2c91('0x36')],_0x2b58a5[_0x2c91('0x37')]));queues[_0x2b58a5['uniqueid']][_0x2c91('0x17')]=![];queues[_0x2b58a5['uniqueid']][_0x2c91('0x17')]=![];queues[_0x2b58a5[_0x2c91('0x5')]][_0x2c91('0x38')]=null;queues[_0x2b58a5[_0x2c91('0x5')]][_0x2c91('0x18')]=![];queues[_0x2b58a5[_0x2c91('0x5')]][_0x2c91('0x1b')]=null;queues[_0x2b58a5[_0x2c91('0x5')]][_0x2c91('0x27')]=null;queues[_0x2b58a5['uniqueid']][_0x2c91('0x39')]=!![];queues[_0x2b58a5[_0x2c91('0x5')]]['accountcode']=_0x2b58a5[_0x2c91('0x37')];queues[_0x2b58a5['uniqueid']][_0x2c91('0x3a')]=_0x2b58a5[_0x2c91('0x36')];}}catch(_0x2784c0){utils['error'](util[_0x2c91('0x3')](_0x2c91('0x34'),_0x2b58a5['uniqueid']),_0x2784c0);}};exports[_0x2c91('0x3b')]=function(_0x3fd16d){try{if(!_[_0x2c91('0x14')](queues[_0x3fd16d[_0x2c91('0x5')]])){if(queues[_0x3fd16d['uniqueid']]['queuecallerleaveAt']){utils[_0x2c91('0x15')](util[_0x2c91('0x3')](_0x2c91('0x3c'),_0x3fd16d[_0x2c91('0x5')]),_0x3fd16d);queues[_0x3fd16d['uniqueid']][_0x2c91('0x17')]=![];queues[_0x3fd16d['uniqueid']][_0x2c91('0x17')]=![];queues[_0x3fd16d[_0x2c91('0x5')]][_0x2c91('0x38')]=null;queues[_0x3fd16d['uniqueid']][_0x2c91('0x18')]=![];queues[_0x3fd16d[_0x2c91('0x5')]][_0x2c91('0x27')]=null;queues[_0x3fd16d[_0x2c91('0x5')]]['assigned']=!![];queues[_0x3fd16d[_0x2c91('0x5')]]['lastAssignedTo']=_0x3fd16d[_0x2c91('0x36')];queues[_0x3fd16d[_0x2c91('0x5')]][_0x2c91('0x19')]=!![];queues[_0x3fd16d[_0x2c91('0x5')]]['queuecallercompleteAt']=utils['now']();if(_0x3fd16d[_0x2c91('0x3d')]==_0x2c91('0x3e')){if(!queues[_0x3fd16d[_0x2c91('0x5')]][_0x2c91('0x3e')]){queues[_0x3fd16d[_0x2c91('0x5')]][_0x2c91('0x1b')]=_0x2c91('0x3f');}}else{queues[_0x3fd16d['uniqueid']][_0x2c91('0x1b')]='COMPLETEDBY'+_0x3fd16d[_0x2c91('0x3d')][_0x2c91('0x25')]();}utils[_0x2c91('0x2')](util[_0x2c91('0x3')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x3fd16d[_0x2c91('0x5')],queues[_0x3fd16d[_0x2c91('0x5')]][_0x2c91('0x1e')],_0x3fd16d[_0x2c91('0x36')],queues[_0x3fd16d[_0x2c91('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x3fd16d['uniqueid']]);}}}catch(_0x5af1d6){utils[_0x2c91('0x13')](util[_0x2c91('0x3')](_0x2c91('0x3c'),_0x3fd16d[_0x2c91('0x5')]),_0x5af1d6);}};exports[_0x2c91('0x40')]=function(_0x1254f9){try{if(!_[_0x2c91('0x14')](queues[_0x1254f9[_0x2c91('0x41')]])){utils[_0x2c91('0x15')](util[_0x2c91('0x3')]('[%s][queues][blindtransfer]',_0x1254f9[_0x2c91('0x5')]),_0x1254f9);queues[_0x1254f9[_0x2c91('0x41')]][_0x2c91('0x3e')]=!![];queues[_0x1254f9['transfereeuniqueid']][_0x2c91('0x42')]='BLIND';queues[_0x1254f9[_0x2c91('0x41')]]['transferexten']=_0x1254f9[_0x2c91('0x43')];queues[_0x1254f9[_0x2c91('0x41')]][_0x2c91('0x44')]=_0x1254f9['transfereeuniqueid'];queues[_0x1254f9[_0x2c91('0x41')]][_0x2c91('0x1b')]=_0x2c91('0x45');utils['info'](util['format'](_0x2c91('0x46'),_0x1254f9['uniqueid'],queues[_0x1254f9[_0x2c91('0x41')]][_0x2c91('0x1e')],_0x1254f9[_0x2c91('0x41')],_0x1254f9[_0x2c91('0x43')]));}}catch(_0x1b277e){utils[_0x2c91('0x13')](util['format']('[%s][queues][blindtransfer]',_0x1254f9[_0x2c91('0x5')]),_0x1b277e);}};exports[_0x2c91('0x47')]=function(_0x5c6789){try{utils['debug'](util[_0x2c91('0x3')](_0x2c91('0x48'),_0x5c6789[_0x2c91('0x49')]),_0x5c6789);if(_0x5c6789[_0x2c91('0x49')]==_0x5c6789[_0x2c91('0x4a')]){if(!_['isNil'](queues[_0x5c6789[_0x2c91('0x4b')]])){utils[_0x2c91('0x2')](util['format'](_0x2c91('0x4c'),_0x5c6789['origtransfereruniqueid'],queues[_0x5c6789[_0x2c91('0x4b')]][_0x2c91('0x1e')],_0x5c6789[_0x2c91('0x4d')]));queues[_0x5c6789[_0x2c91('0x4b')]]['transfer']=!![];queues[_0x5c6789[_0x2c91('0x4b')]][_0x2c91('0x42')]=_0x2c91('0x4e');queues[_0x5c6789[_0x2c91('0x4b')]][_0x2c91('0x4f')]=_0x5c6789[_0x2c91('0x4d')];queues[_0x5c6789[_0x2c91('0x4b')]]['transferuniqueid']=_0x5c6789[_0x2c91('0x49')];queues[_0x5c6789[_0x2c91('0x4b')]][_0x2c91('0x1b')]=_0x2c91('0x50');}if(!_['isNil'](queues[_0x5c6789[_0x2c91('0x4a')]])){if(_0x5c6789[_0x2c91('0x51')]&&queues[_0x5c6789[_0x2c91('0x51')]]){queues[_0x5c6789['transfereelinkedid']]['queuecallerenterreason']=0x1;queues[_0x5c6789['transfereeuniqueid']]=_[_0x2c91('0x52')](queues[_0x5c6789[_0x2c91('0x51')]]);queues[_0x5c6789[_0x2c91('0x41')]][_0x2c91('0xd')]=_0x5c6789[_0x2c91('0x53')];queues[_0x5c6789[_0x2c91('0x41')]][_0x2c91('0x1f')]=0x2;queues[_0x5c6789[_0x2c91('0x41')]]['calleridnum']=queues[_0x5c6789['secondtransfererlinkedid']]['calleridnum'];queues[_0x5c6789[_0x2c91('0x41')]][_0x2c91('0x54')]=queues[_0x5c6789[_0x2c91('0x4b')]][_0x2c91('0x54')];queues[_0x5c6789[_0x2c91('0x41')]][_0x2c91('0x55')]=utils[_0x2c91('0x1a')]();queues[_0x5c6789[_0x2c91('0x41')]]['queuecallerleaveAt']=utils['now']();queues[_0x5c6789[_0x2c91('0x41')]]['holdtime']=0x0;queues[_0x5c6789['transfereeuniqueid']][_0x2c91('0x56')]=0x0;utils[_0x2c91('0x2')](util['format'](_0x2c91('0x57'),_0x5c6789[_0x2c91('0x49')],queues[_0x5c6789['transfereeuniqueid']][_0x2c91('0x1e')],queues[_0x5c6789[_0x2c91('0x41')]][_0x2c91('0x8')],queues[_0x5c6789[_0x2c91('0x41')]][_0x2c91('0x54')]));}else{utils['info'](util[_0x2c91('0x3')](_0x2c91('0x58'),_0x5c6789[_0x2c91('0x49')],queues[_0x5c6789['origtransfererlinkedid']]['name'],_0x5c6789['secondtransfererlinkedid']));queues[_0x5c6789['origtransfererlinkedid']][_0x2c91('0xd')]=_0x5c6789[_0x2c91('0x4b')];}}}else if(_0x5c6789[_0x2c91('0x59')]==_0x5c6789[_0x2c91('0x4b')]){if(!_[_0x2c91('0x14')](queues[_0x5c6789[_0x2c91('0x4a')]])){utils[_0x2c91('0x2')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x5c6789[_0x2c91('0x49')],queues[_0x5c6789[_0x2c91('0x4a')]][_0x2c91('0x1e')],_0x5c6789['secondtransfereruniqueid'],_0x5c6789[_0x2c91('0x5a')]));queues[_0x5c6789['origtransfererlinkedid']][_0x2c91('0x3e')]=!![];queues[_0x5c6789[_0x2c91('0x4a')]][_0x2c91('0x42')]='ATTENDED';queues[_0x5c6789[_0x2c91('0x4a')]][_0x2c91('0x4f')]=_0x5c6789['secondtransfererexten'];queues[_0x5c6789['origtransfererlinkedid']][_0x2c91('0x44')]=_0x5c6789[_0x2c91('0x59')];queues[_0x5c6789[_0x2c91('0x4a')]][_0x2c91('0x1b')]=_0x2c91('0x50');}if(!_[_0x2c91('0x14')](queues[_0x5c6789[_0x2c91('0x4b')]])){if(_0x5c6789[_0x2c91('0x5b')]&&queues[_0x5c6789['transfertargetlinkedid']]){queues[_0x5c6789[_0x2c91('0x5b')]]['queuecallerenterreason']=0x1;queues[_0x5c6789[_0x2c91('0x53')]]=_['clone'](queues[_0x5c6789[_0x2c91('0x5b')]]);queues[_0x5c6789[_0x2c91('0x53')]]['transfereduniqueid']=_0x5c6789[_0x2c91('0x53')];queues[_0x5c6789[_0x2c91('0x53')]][_0x2c91('0x1f')]=0x2;queues[_0x5c6789[_0x2c91('0x53')]][_0x2c91('0x8')]=queues[_0x5c6789[_0x2c91('0x4a')]][_0x2c91('0x8')];queues[_0x5c6789[_0x2c91('0x53')]][_0x2c91('0x54')]=queues[_0x5c6789[_0x2c91('0x4a')]][_0x2c91('0x54')];queues[_0x5c6789[_0x2c91('0x53')]][_0x2c91('0x55')]=utils[_0x2c91('0x1a')]();queues[_0x5c6789[_0x2c91('0x53')]][_0x2c91('0x31')]=utils[_0x2c91('0x1a')]();queues[_0x5c6789[_0x2c91('0x53')]][_0x2c91('0x30')]=0x0;queues[_0x5c6789[_0x2c91('0x53')]][_0x2c91('0x56')]=0x0;utils[_0x2c91('0x2')](util[_0x2c91('0x3')](_0x2c91('0x5c'),_0x5c6789[_0x2c91('0x49')],queues[_0x5c6789[_0x2c91('0x53')]][_0x2c91('0x1e')],queues[_0x5c6789[_0x2c91('0x53')]]['transfereduniqueid'],queues[_0x5c6789[_0x2c91('0x53')]][_0x2c91('0x8')],queues[_0x5c6789[_0x2c91('0x53')]]['calleridname']));}else{utils[_0x2c91('0x2')](util['format'](_0x2c91('0x58'),_0x5c6789[_0x2c91('0x49')],queues[_0x5c6789[_0x2c91('0x4b')]][_0x2c91('0x1e')],_0x5c6789[_0x2c91('0x4a')]));queues[_0x5c6789[_0x2c91('0x4b')]][_0x2c91('0xd')]=_0x5c6789['origtransfererlinkedid'];}}}}catch(_0x5627ee){utils[_0x2c91('0x13')](util[_0x2c91('0x3')](_0x2c91('0x48'),_0x5c6789[_0x2c91('0x49')]),_0x5627ee);}};exports[_0x2c91('0x5d')]=function(_0x2ee7df){try{if(!_[_0x2c91('0x14')](queues[_0x2ee7df[_0x2c91('0x5')]])){utils[_0x2c91('0x15')](util[_0x2c91('0x3')](_0x2c91('0x5e'),_0x2ee7df[_0x2c91('0x5')]),_0x2ee7df);queues[_0x2ee7df[_0x2c91('0x5')]]['musiconholdstartAt']=utils['now']();utils[_0x2c91('0x2')](util[_0x2c91('0x3')](_0x2c91('0x5f'),_0x2ee7df[_0x2c91('0x5')],queues[_0x2ee7df[_0x2c91('0x5')]][_0x2c91('0x1e')],queues[_0x2ee7df[_0x2c91('0x5')]][_0x2c91('0x60')]));}}catch(_0x155758){utils['error'](util['format'](_0x2c91('0x5e'),_0x2ee7df[_0x2c91('0x5')]),_0x155758);}};exports[_0x2c91('0x61')]=function(_0x3b1a28){try{if(!_[_0x2c91('0x14')](queues[_0x3b1a28['uniqueid']])){if(!_[_0x2c91('0x14')](queues[_0x3b1a28[_0x2c91('0x5')]][_0x2c91('0x60')])){utils['debug'](util[_0x2c91('0x3')](_0x2c91('0x62'),_0x3b1a28[_0x2c91('0x5')]),_0x3b1a28);queues[_0x3b1a28[_0x2c91('0x5')]][_0x2c91('0x56')]+=utils[_0x2c91('0x63')](utils[_0x2c91('0x1a')](),queues[_0x3b1a28[_0x2c91('0x5')]][_0x2c91('0x60')]);utils[_0x2c91('0x2')](util['format'](_0x2c91('0x64'),_0x3b1a28[_0x2c91('0x5')],queues[_0x3b1a28['uniqueid']]['name'],queues[_0x3b1a28[_0x2c91('0x5')]][_0x2c91('0x56')]));delete queues[_0x3b1a28['uniqueid']]['musiconholdstartAt'];}}}catch(_0x21d477){utils['error'](util[_0x2c91('0x3')](_0x2c91('0x62'),_0x3b1a28[_0x2c91('0x5')]),_0x21d477);}}; \ No newline at end of file +var _0x4627=['queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','CONTINUE','queuecallerabandonAt','queuecallerexitAt','value','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','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','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','agentcomplete','transfer','toUpperCase','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','transferexten','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','origtransfererexten','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','transfertargetuniqueid','calleridnum','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','ATTENDED','transfertargetlinkedid','clone','mohtime','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','format','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','now','error','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit'];(function(_0x44c742,_0x5d69a4){var _0x40fcf0=function(_0x453d3c){while(--_0x453d3c){_0x44c742['push'](_0x44c742['shift']());}};_0x40fcf0(++_0x5d69a4);}(_0x4627,0xb0));var _0x7462=function(_0x270adf,_0x1daaa3){_0x270adf=_0x270adf-0x0;var _0x29eda9=_0x4627[_0x270adf];return _0x29eda9;};'use strict';var _=require(_0x7462('0x0'));var util=require(_0x7462('0x1'));var utils=require(_0x7462('0x2'));var queues={};function writeDB(_0x24ee82){utils[_0x7462('0x3')](util['format'](_0x7462('0x4'),_0x24ee82[_0x7462('0x5')],_0x24ee82[_0x7462('0x6')],_0x24ee82[_0x7462('0x7')],_0x24ee82[_0x7462('0x8')],_0x24ee82['calleridnum'],_0x24ee82[_0x7462('0x9')],_0x24ee82[_0x7462('0xa')]));if(_0x24ee82[_0x7462('0x7')]){utils[_0x7462('0xb')](_0x24ee82[_0x7462('0x7')])[_0x7462('0xc')](function(_0x507c9c){if(_0x507c9c){_0x24ee82[_0x7462('0xd')]=_0x507c9c['type'];}utils[_0x7462('0xe')](_0x7462('0xf'),_0x24ee82);});}else{utils[_0x7462('0xe')](_0x7462('0xf'),_0x24ee82);}if(_0x24ee82[_0x7462('0x10')]){delete queues[_0x24ee82[_0x7462('0x10')]];}else{delete queues[_0x24ee82[_0x7462('0x5')]];}}exports[_0x7462('0x11')]=function(_0x522a87){try{utils[_0x7462('0x12')](util[_0x7462('0x13')](_0x7462('0x14'),_0x522a87[_0x7462('0x5')]),_0x522a87);utils[_0x7462('0x3')](util[_0x7462('0x13')](_0x7462('0x15'),_0x522a87['uniqueid'],_0x522a87[_0x7462('0x7')],_0x522a87[_0x7462('0x16')]));queues[_0x522a87['uniqueid']]=_['assign'](_0x522a87,{'originalposition':_0x522a87[_0x7462('0x16')],'queuecallerjoinAt':utils[_0x7462('0x17')](),'mohtime':0x0});}catch(_0xdc4446){utils[_0x7462('0x18')](util['format']('[%s][queues][queuecallerjoin]',_0x522a87['uniqueid']),_0xdc4446);}};exports['hangup']=function(_0x18ca75){try{if(!_[_0x7462('0x19')](queues[_0x18ca75[_0x7462('0x5')]])){utils[_0x7462('0x12')](util[_0x7462('0x13')](_0x7462('0x1a'),_0x18ca75['uniqueid']),_0x18ca75);if(queues[_0x18ca75[_0x7462('0x5')]][_0x7462('0x1b')]){if(!queues[_0x18ca75[_0x7462('0x5')]][_0x7462('0x1c')]&&!queues[_0x18ca75[_0x7462('0x5')]][_0x7462('0x1d')]){queues[_0x18ca75[_0x7462('0x5')]][_0x7462('0x1e')]=!![];queues[_0x18ca75[_0x7462('0x5')]][_0x7462('0x1f')]=utils[_0x7462('0x17')]();queues[_0x18ca75[_0x7462('0x5')]][_0x7462('0xa')]=_0x7462('0x20');}utils[_0x7462('0x3')](util[_0x7462('0x13')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x18ca75[_0x7462('0x5')],queues[_0x18ca75[_0x7462('0x5')]][_0x7462('0x21')],queues[_0x18ca75[_0x7462('0x5')]][_0x7462('0xa')]));writeDB(queues[_0x18ca75[_0x7462('0x5')]]);}else if(queues[_0x18ca75[_0x7462('0x5')]][_0x7462('0x10')]){utils['info'](util['format'](_0x7462('0x22'),_0x18ca75[_0x7462('0x5')],queues[_0x18ca75[_0x7462('0x5')]]['name'],queues[_0x18ca75[_0x7462('0x5')]][_0x7462('0x10')]));queues[queues[_0x18ca75[_0x7462('0x5')]]['transfereduniqueid']]=queues[_0x18ca75[_0x7462('0x5')]];queues[queues[_0x18ca75[_0x7462('0x5')]][_0x7462('0x10')]][_0x7462('0x23')]=0x2;delete queues[_0x18ca75['uniqueid']];}}}catch(_0x1c3b46){utils[_0x7462('0x18')](util['format'](_0x7462('0x1a'),_0x18ca75[_0x7462('0x5')]),_0x1c3b46);}};exports[_0x7462('0x24')]=function(_0x2a25f1){try{utils[_0x7462('0x12')](util[_0x7462('0x13')](_0x7462('0x25'),_0x2a25f1[_0x7462('0x5')]),_0x2a25f1);if(!_[_0x7462('0x19')](_0x2a25f1[_0x7462('0x26')][_0x7462('0x27')])&&_0x2a25f1['value']['toUpperCase']()!==_0x7462('0x28')){if(!_[_0x7462('0x19')](queues[_0x2a25f1[_0x7462('0x5')]])){queues[_0x2a25f1[_0x7462('0x5')]][_0x7462('0x1c')]=![];queues[_0x2a25f1[_0x7462('0x5')]][_0x7462('0x29')]=null;queues[_0x2a25f1[_0x7462('0x5')]]['queuecallerexit']=!![];queues[_0x2a25f1['uniqueid']][_0x7462('0x2a')]=utils[_0x7462('0x17')]();queues[_0x2a25f1[_0x7462('0x5')]][_0x7462('0xa')]=_0x2a25f1[_0x7462('0x2b')]['toUpperCase']();utils['info'](util[_0x7462('0x13')](_0x7462('0x2c'),_0x2a25f1[_0x7462('0x5')],queues[_0x2a25f1[_0x7462('0x5')]][_0x7462('0x21')],_0x2a25f1['value'],queues[_0x2a25f1[_0x7462('0x5')]][_0x7462('0xa')]));writeDB(queues[_0x2a25f1[_0x7462('0x5')]]);}}else if(!_[_0x7462('0x19')](_0x2a25f1[_0x7462('0x26')]['queueposition'])){if(!_['isNil'](queues[_0x2a25f1[_0x7462('0x5')]])&&!queues[_0x2a25f1[_0x7462('0x5')]][_0x7462('0x1c')]){queues[_0x2a25f1['uniqueid']][_0x7462('0x1c')]=![];queues[_0x2a25f1[_0x7462('0x5')]][_0x7462('0x29')]=null;queues[_0x2a25f1[_0x7462('0x5')]][_0x7462('0x1d')]=!![];queues[_0x2a25f1[_0x7462('0x5')]][_0x7462('0x2a')]=utils[_0x7462('0x17')]();queues[_0x2a25f1['uniqueid']][_0x7462('0xa')]=_0x7462('0x2d');utils[_0x7462('0x3')](util[_0x7462('0x13')](_0x7462('0x2e'),_0x2a25f1[_0x7462('0x5')],queues[_0x2a25f1[_0x7462('0x5')]][_0x7462('0x21')],_0x2a25f1[_0x7462('0x2b')],queues[_0x2a25f1[_0x7462('0x5')]][_0x7462('0xa')]));}}}catch(_0x66bb03){utils[_0x7462('0x18')](util[_0x7462('0x13')](_0x7462('0x25'),_0x2a25f1[_0x7462('0x5')]),_0x66bb03);}};exports['queuecallerabandon']=function(_0x27c12e){try{if(!_[_0x7462('0x19')](queues[_0x27c12e['uniqueid']])){utils[_0x7462('0x12')](util[_0x7462('0x13')](_0x7462('0x2f'),_0x27c12e[_0x7462('0x5')]),_0x27c12e);queues[_0x27c12e[_0x7462('0x5')]][_0x7462('0x1d')]=![];queues[_0x27c12e[_0x7462('0x5')]][_0x7462('0x2a')]=null;queues[_0x27c12e[_0x7462('0x5')]][_0x7462('0x1c')]=!![];queues[_0x27c12e[_0x7462('0x5')]][_0x7462('0x29')]=utils[_0x7462('0x17')]();queues[_0x27c12e[_0x7462('0x5')]][_0x7462('0xa')]=_0x7462('0x30');utils[_0x7462('0x3')](util[_0x7462('0x13')](_0x7462('0x31'),_0x27c12e[_0x7462('0x5')],queues[_0x27c12e[_0x7462('0x5')]][_0x7462('0x21')],queues[_0x27c12e['uniqueid']]['queuecallerexitreason']));}}catch(_0x27c4db){utils[_0x7462('0x18')](util[_0x7462('0x13')](_0x7462('0x2f'),_0x27c12e[_0x7462('0x5')]),_0x27c4db);}};exports[_0x7462('0x32')]=function(_0x557bac){try{if(!_[_0x7462('0x19')](queues[_0x557bac[_0x7462('0x5')]])){utils[_0x7462('0x12')](util[_0x7462('0x13')](_0x7462('0x33'),_0x557bac['uniqueid']),_0x557bac);utils[_0x7462('0x3')](util[_0x7462('0x13')](_0x7462('0x34'),_0x557bac[_0x7462('0x5')],queues[_0x557bac[_0x7462('0x5')]][_0x7462('0x21')],_0x557bac['connectedlinenum'],_0x557bac[_0x7462('0x35')]));queues[_0x557bac['uniqueid']][_0x7462('0x32')]=!![];queues[_0x557bac['uniqueid']]['queuecallerleaveAt']=utils[_0x7462('0x17')]();queues[_0x557bac[_0x7462('0x5')]][_0x7462('0x36')]=utils[_0x7462('0x37')](queues[_0x557bac['uniqueid']][_0x7462('0x1b')],queues[_0x557bac[_0x7462('0x5')]][_0x7462('0x38')]);queues[_0x557bac[_0x7462('0x5')]][_0x7462('0x16')]=_0x557bac[_0x7462('0x16')];queues[_0x557bac[_0x7462('0x5')]][_0x7462('0x39')]=_0x557bac[_0x7462('0x39')];queues[_0x557bac['uniqueid']]['connectedlinenum']=_0x557bac[_0x7462('0x3a')];queues[_0x557bac['uniqueid']]['connectedlinename']=_0x557bac[_0x7462('0x35')];}}catch(_0x97a3a3){utils[_0x7462('0x18')](util[_0x7462('0x13')]('[%s][queues][queuecallerleave]',_0x557bac[_0x7462('0x5')]),_0x97a3a3);}};exports[_0x7462('0x3b')]=function(_0x220557){try{if(!_[_0x7462('0x19')](queues[_0x220557['uniqueid']])){utils['debug'](util['format'](_0x7462('0x3c'),_0x220557['uniqueid']),_0x220557);utils[_0x7462('0x3')](util[_0x7462('0x13')](_0x7462('0x3d'),_0x220557['uniqueid'],queues[_0x220557['uniqueid']][_0x7462('0x21')],_0x220557[_0x7462('0x3e')],_0x220557[_0x7462('0x3f')]));queues[_0x220557[_0x7462('0x5')]][_0x7462('0x1c')]=![];queues[_0x220557[_0x7462('0x5')]][_0x7462('0x1c')]=![];queues[_0x220557[_0x7462('0x5')]][_0x7462('0x29')]=null;queues[_0x220557['uniqueid']]['queuecallerexit']=![];queues[_0x220557['uniqueid']][_0x7462('0xa')]=null;queues[_0x220557[_0x7462('0x5')]]['queuecallerexitAt']=null;queues[_0x220557[_0x7462('0x5')]][_0x7462('0x40')]=!![];queues[_0x220557[_0x7462('0x5')]]['accountcode']=_0x220557[_0x7462('0x3f')];queues[_0x220557['uniqueid']]['lastAssignedTo']=_0x220557[_0x7462('0x3e')];}}catch(_0x5665eb){utils[_0x7462('0x18')](util[_0x7462('0x13')](_0x7462('0x3c'),_0x220557[_0x7462('0x5')]),_0x5665eb);}};exports[_0x7462('0x41')]=function(_0x57e825){try{if(!_['isNil'](queues[_0x57e825[_0x7462('0x5')]])){if(queues[_0x57e825[_0x7462('0x5')]][_0x7462('0x1b')]){utils['debug'](util[_0x7462('0x13')]('[%s][queues][agentcomplete]',_0x57e825[_0x7462('0x5')]),_0x57e825);queues[_0x57e825['uniqueid']][_0x7462('0x1c')]=![];queues[_0x57e825[_0x7462('0x5')]][_0x7462('0x1c')]=![];queues[_0x57e825[_0x7462('0x5')]][_0x7462('0x29')]=null;queues[_0x57e825[_0x7462('0x5')]][_0x7462('0x1d')]=![];queues[_0x57e825[_0x7462('0x5')]][_0x7462('0x2a')]=null;queues[_0x57e825[_0x7462('0x5')]]['assigned']=!![];queues[_0x57e825['uniqueid']][_0x7462('0x8')]=_0x57e825[_0x7462('0x3e')];queues[_0x57e825[_0x7462('0x5')]]['queuecallercomplete']=!![];queues[_0x57e825[_0x7462('0x5')]]['queuecallercompleteAt']=utils['now']();if(_0x57e825['reason']==_0x7462('0x42')){if(!queues[_0x57e825[_0x7462('0x5')]]['transfer']){queues[_0x57e825[_0x7462('0x5')]][_0x7462('0xa')]='TRANSFER';}}else{queues[_0x57e825[_0x7462('0x5')]]['queuecallerexitreason']='COMPLETEDBY'+_0x57e825['reason'][_0x7462('0x43')]();}utils[_0x7462('0x3')](util[_0x7462('0x13')](_0x7462('0x44'),_0x57e825[_0x7462('0x5')],queues[_0x57e825[_0x7462('0x5')]]['name'],_0x57e825[_0x7462('0x3e')],queues[_0x57e825['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x57e825[_0x7462('0x5')]]);}}}catch(_0x1289e0){utils[_0x7462('0x18')](util[_0x7462('0x13')](_0x7462('0x45'),_0x57e825[_0x7462('0x5')]),_0x1289e0);}};exports['blindtransfer']=function(_0x1ead09){try{if(!_['isNil'](queues[_0x1ead09[_0x7462('0x46')]])){utils['debug'](util['format'](_0x7462('0x47'),_0x1ead09[_0x7462('0x5')]),_0x1ead09);queues[_0x1ead09[_0x7462('0x46')]][_0x7462('0x42')]=!![];queues[_0x1ead09[_0x7462('0x46')]][_0x7462('0x48')]='BLIND';queues[_0x1ead09[_0x7462('0x46')]][_0x7462('0x49')]=_0x1ead09['extension'];queues[_0x1ead09['transfereeuniqueid']][_0x7462('0x4a')]=_0x1ead09[_0x7462('0x46')];queues[_0x1ead09[_0x7462('0x46')]][_0x7462('0xa')]='BLINDTRANSFER';utils[_0x7462('0x3')](util[_0x7462('0x13')](_0x7462('0x4b'),_0x1ead09[_0x7462('0x5')],queues[_0x1ead09[_0x7462('0x46')]][_0x7462('0x21')],_0x1ead09['transfereeuniqueid'],_0x1ead09[_0x7462('0x4c')]));}}catch(_0x3f2623){utils[_0x7462('0x18')](util[_0x7462('0x13')](_0x7462('0x47'),_0x1ead09[_0x7462('0x5')]),_0x3f2623);}};exports[_0x7462('0x4d')]=function(_0x5241f7){try{utils[_0x7462('0x12')](util[_0x7462('0x13')](_0x7462('0x4e'),_0x5241f7[_0x7462('0x4f')]),_0x5241f7);if(_0x5241f7[_0x7462('0x4f')]==_0x5241f7['origtransfererlinkedid']){if(!_[_0x7462('0x19')](queues[_0x5241f7['secondtransfererlinkedid']])){utils[_0x7462('0x3')](util['format'](_0x7462('0x50'),_0x5241f7[_0x7462('0x4f')],queues[_0x5241f7[_0x7462('0x51')]][_0x7462('0x21')],_0x5241f7['origtransfererexten']));queues[_0x5241f7[_0x7462('0x51')]][_0x7462('0x42')]=!![];queues[_0x5241f7[_0x7462('0x51')]][_0x7462('0x48')]='ATTENDED';queues[_0x5241f7['secondtransfererlinkedid']][_0x7462('0x49')]=_0x5241f7[_0x7462('0x52')];queues[_0x5241f7[_0x7462('0x51')]][_0x7462('0x4a')]=_0x5241f7[_0x7462('0x4f')];queues[_0x5241f7[_0x7462('0x51')]]['queuecallerexitreason']=_0x7462('0x53');}if(!_[_0x7462('0x19')](queues[_0x5241f7[_0x7462('0x54')]])){if(_0x5241f7['transfereelinkedid']&&queues[_0x5241f7[_0x7462('0x55')]]){queues[_0x5241f7[_0x7462('0x55')]][_0x7462('0x23')]=0x1;queues[_0x5241f7[_0x7462('0x46')]]=_['clone'](queues[_0x5241f7['transfereelinkedid']]);queues[_0x5241f7[_0x7462('0x46')]][_0x7462('0x10')]=_0x5241f7[_0x7462('0x56')];queues[_0x5241f7[_0x7462('0x46')]][_0x7462('0x23')]=0x2;queues[_0x5241f7[_0x7462('0x46')]][_0x7462('0x57')]=queues[_0x5241f7[_0x7462('0x51')]][_0x7462('0x57')];queues[_0x5241f7[_0x7462('0x46')]][_0x7462('0x58')]=queues[_0x5241f7[_0x7462('0x51')]][_0x7462('0x58')];queues[_0x5241f7['transfereeuniqueid']][_0x7462('0x38')]=utils[_0x7462('0x17')]();queues[_0x5241f7[_0x7462('0x46')]][_0x7462('0x1b')]=utils[_0x7462('0x17')]();queues[_0x5241f7['transfereeuniqueid']][_0x7462('0x36')]=0x0;queues[_0x5241f7['transfereeuniqueid']]['mohtime']=0x0;utils[_0x7462('0x3')](util[_0x7462('0x13')](_0x7462('0x59'),_0x5241f7[_0x7462('0x4f')],queues[_0x5241f7['transfereeuniqueid']]['name'],queues[_0x5241f7['transfereeuniqueid']]['calleridnum'],queues[_0x5241f7['transfereeuniqueid']][_0x7462('0x58')]));}else{utils[_0x7462('0x3')](util[_0x7462('0x13')](_0x7462('0x5a'),_0x5241f7[_0x7462('0x4f')],queues[_0x5241f7[_0x7462('0x54')]][_0x7462('0x21')],_0x5241f7[_0x7462('0x51')]));queues[_0x5241f7[_0x7462('0x54')]]['transfereduniqueid']=_0x5241f7[_0x7462('0x51')];}}}else if(_0x5241f7[_0x7462('0x5b')]==_0x5241f7[_0x7462('0x51')]){if(!_[_0x7462('0x19')](queues[_0x5241f7['origtransfererlinkedid']])){utils[_0x7462('0x3')](util[_0x7462('0x13')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x5241f7[_0x7462('0x4f')],queues[_0x5241f7[_0x7462('0x54')]][_0x7462('0x21')],_0x5241f7[_0x7462('0x5b')],_0x5241f7[_0x7462('0x5c')]));queues[_0x5241f7[_0x7462('0x54')]][_0x7462('0x42')]=!![];queues[_0x5241f7[_0x7462('0x54')]][_0x7462('0x48')]=_0x7462('0x5d');queues[_0x5241f7[_0x7462('0x54')]]['transferexten']=_0x5241f7[_0x7462('0x5c')];queues[_0x5241f7[_0x7462('0x54')]][_0x7462('0x4a')]=_0x5241f7[_0x7462('0x5b')];queues[_0x5241f7[_0x7462('0x54')]]['queuecallerexitreason']=_0x7462('0x53');}if(!_['isNil'](queues[_0x5241f7[_0x7462('0x51')]])){if(_0x5241f7[_0x7462('0x5e')]&&queues[_0x5241f7[_0x7462('0x5e')]]){queues[_0x5241f7[_0x7462('0x5e')]]['queuecallerenterreason']=0x1;queues[_0x5241f7['transfertargetuniqueid']]=_[_0x7462('0x5f')](queues[_0x5241f7[_0x7462('0x5e')]]);queues[_0x5241f7[_0x7462('0x56')]][_0x7462('0x10')]=_0x5241f7[_0x7462('0x56')];queues[_0x5241f7[_0x7462('0x56')]][_0x7462('0x23')]=0x2;queues[_0x5241f7['transfertargetuniqueid']][_0x7462('0x57')]=queues[_0x5241f7[_0x7462('0x54')]][_0x7462('0x57')];queues[_0x5241f7[_0x7462('0x56')]][_0x7462('0x58')]=queues[_0x5241f7['origtransfererlinkedid']][_0x7462('0x58')];queues[_0x5241f7['transfertargetuniqueid']][_0x7462('0x38')]=utils[_0x7462('0x17')]();queues[_0x5241f7[_0x7462('0x56')]][_0x7462('0x1b')]=utils[_0x7462('0x17')]();queues[_0x5241f7[_0x7462('0x56')]]['holdtime']=0x0;queues[_0x5241f7['transfertargetuniqueid']][_0x7462('0x60')]=0x0;utils[_0x7462('0x3')](util[_0x7462('0x13')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x5241f7[_0x7462('0x4f')],queues[_0x5241f7['transfertargetuniqueid']][_0x7462('0x21')],queues[_0x5241f7[_0x7462('0x56')]][_0x7462('0x10')],queues[_0x5241f7[_0x7462('0x56')]][_0x7462('0x57')],queues[_0x5241f7[_0x7462('0x56')]][_0x7462('0x58')]));}else{utils[_0x7462('0x3')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x5241f7[_0x7462('0x4f')],queues[_0x5241f7[_0x7462('0x51')]][_0x7462('0x21')],_0x5241f7[_0x7462('0x54')]));queues[_0x5241f7[_0x7462('0x51')]][_0x7462('0x10')]=_0x5241f7[_0x7462('0x54')];}}}}catch(_0x4093d4){utils['error'](util[_0x7462('0x13')](_0x7462('0x4e'),_0x5241f7[_0x7462('0x4f')]),_0x4093d4);}};exports[_0x7462('0x61')]=function(_0xf4701f){try{if(!_[_0x7462('0x19')](queues[_0xf4701f[_0x7462('0x5')]])){utils[_0x7462('0x12')](util[_0x7462('0x13')](_0x7462('0x62'),_0xf4701f['uniqueid']),_0xf4701f);queues[_0xf4701f[_0x7462('0x5')]][_0x7462('0x63')]=utils[_0x7462('0x17')]();utils[_0x7462('0x3')](util[_0x7462('0x13')](_0x7462('0x64'),_0xf4701f[_0x7462('0x5')],queues[_0xf4701f[_0x7462('0x5')]][_0x7462('0x21')],queues[_0xf4701f[_0x7462('0x5')]][_0x7462('0x63')]));}}catch(_0x7c1152){utils[_0x7462('0x18')](util[_0x7462('0x13')](_0x7462('0x62'),_0xf4701f[_0x7462('0x5')]),_0x7c1152);}};exports['musiconholdstop']=function(_0x4eb151){try{if(!_[_0x7462('0x19')](queues[_0x4eb151[_0x7462('0x5')]])){if(!_[_0x7462('0x19')](queues[_0x4eb151[_0x7462('0x5')]]['musiconholdstartAt'])){utils[_0x7462('0x12')](util[_0x7462('0x13')](_0x7462('0x65'),_0x4eb151[_0x7462('0x5')]),_0x4eb151);queues[_0x4eb151[_0x7462('0x5')]]['mohtime']+=utils[_0x7462('0x37')](utils[_0x7462('0x17')](),queues[_0x4eb151[_0x7462('0x5')]][_0x7462('0x63')]);utils['info'](util[_0x7462('0x13')](_0x7462('0x66'),_0x4eb151[_0x7462('0x5')],queues[_0x4eb151[_0x7462('0x5')]][_0x7462('0x21')],queues[_0x4eb151[_0x7462('0x5')]][_0x7462('0x60')]));delete queues[_0x4eb151[_0x7462('0x5')]]['musiconholdstartAt'];}}}catch(_0x555783){utils['error'](util[_0x7462('0x13')](_0x7462('0x65'),_0x4eb151[_0x7462('0x5')]),_0x555783);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index a58ce55..8f59faa 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 _0x8df7=['connectedlinenum','connectedlinename','type','outbound','clone','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','util','./utils','./transfers.controller','info','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','getUserByInternal','then','membername','name','UserId','CreateVoiceRecording','request','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','accountcode','channel','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','variable','mixmonitor_filename','endsWith','value','.wav49','replace','.WAV','find','monitors','push','[%s][recordings][varset]','hangup','calleridname'];(function(_0x2df4cc,_0x1233c6){var _0x40af8d=function(_0x5e0f2a){while(--_0x5e0f2a){_0x2df4cc['push'](_0x2df4cc['shift']());}};_0x40af8d(++_0x1233c6);}(_0x8df7,0x68));var _0x78df=function(_0x375b46,_0x396921){_0x375b46=_0x375b46-0x0;var _0x126571=_0x8df7[_0x375b46];return _0x126571;};'use strict';var _=require('lodash');var util=require(_0x78df('0x0'));var utils=require(_0x78df('0x1'));var transfers=require(_0x78df('0x2'));var recordings={};function writeDB(_0x1ff532){var _0x184db9;utils[_0x78df('0x3')](util[_0x78df('0x4')](_0x78df('0x5'),_0x1ff532[_0x78df('0x6')]));if(transfers[_0x78df('0x7')][_0x1ff532[_0x78df('0x6')]]){_0x184db9=_0x1ff532[_0x78df('0x6')];_0x1ff532['uniqueid']=transfers['blinds'][_0x1ff532[_0x78df('0x6')]][_0x78df('0x8')];}if(_0x1ff532['accountcode']){utils[_0x78df('0x9')](_0x1ff532['accountcode'])[_0x78df('0xa')](function(_0x34ac90){if(_0x34ac90){_0x1ff532[_0x78df('0xb')]=_0x34ac90[_0x78df('0xc')];_0x1ff532[_0x78df('0xd')]=_0x34ac90['id'];}utils['request'](_0x78df('0xe'),_0x1ff532);});}else{utils[_0x78df('0xf')](_0x78df('0xe'),_0x1ff532);}if(_0x184db9)delete transfers[_0x78df('0x7')][_0x184db9];}exports['newchannel']=function(_0x4d15e4){try{utils[_0x78df('0x10')](util[_0x78df('0x4')](_0x78df('0x11'),_0x4d15e4[_0x78df('0x6')]),_0x4d15e4);if(_0x4d15e4[_0x78df('0x6')]==_0x4d15e4[_0x78df('0x12')]){utils[_0x78df('0x3')](util[_0x78df('0x4')](_0x78df('0x13'),_0x4d15e4[_0x78df('0x6')],_0x4d15e4[_0x78df('0x14')],_0x4d15e4[_0x78df('0x15')]));recordings[_0x4d15e4['uniqueid']]={'uniqueid':_0x4d15e4[_0x78df('0x6')],'accountcode':_0x4d15e4[_0x78df('0x16')],'exten':_0x4d15e4[_0x78df('0x15')],'context':_0x4d15e4['context'],'channel':_0x4d15e4[_0x78df('0x17')],'monitors':[]};}}catch(_0x32daea){utils['error'](util[_0x78df('0x4')](_0x78df('0x11'),_0x4d15e4[_0x78df('0x6')]),_0x32daea);}};exports[_0x78df('0x18')]=function(_0x2ab0d1){try{utils[_0x78df('0x10')](util[_0x78df('0x4')](_0x78df('0x19'),_0x2ab0d1[_0x78df('0x6')]),_0x2ab0d1);if(!_[_0x78df('0x1a')](recordings[_0x2ab0d1[_0x78df('0x6')]])&&_0x2ab0d1[_0x78df('0x1b')]==0x6){utils[_0x78df('0x3')](util['format'](_0x78df('0x1c'),_0x2ab0d1[_0x78df('0x6')],_0x2ab0d1['context'],_0x2ab0d1[_0x78df('0x17')]));}else if(!_[_0x78df('0x1a')](recordings[_0x2ab0d1[_0x78df('0x12')]])&&_0x2ab0d1[_0x78df('0x1b')]==0x6&&_0x2ab0d1[_0x78df('0x14')]!='transfer'){utils[_0x78df('0x3')](util[_0x78df('0x4')](_0x78df('0x1d'),_0x2ab0d1[_0x78df('0x6')],_0x2ab0d1[_0x78df('0x12')],_0x2ab0d1['context'],_0x2ab0d1[_0x78df('0x17')]));recordings[_0x2ab0d1[_0x78df('0x12')]]['accountcode']=_0x2ab0d1['accountcode'];}}catch(_0xcb435d){utils[_0x78df('0x1e')](util['format'](_0x78df('0x19'),_0x2ab0d1[_0x78df('0x6')]),_0xcb435d);}};exports['varset']=function(_0x5404f0){try{if(!_[_0x78df('0x1a')](_0x5404f0[_0x78df('0x1f')])&&!_[_0x78df('0x1a')](_0x5404f0[_0x78df('0x1f')][_0x78df('0x20')])){utils[_0x78df('0x10')](util[_0x78df('0x4')]('[%s][recordings][varset]',_0x5404f0['uniqueid']),_0x5404f0);utils[_0x78df('0x3')](util['format']('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x5404f0['uniqueid'],_0x5404f0[_0x78df('0x1f')],_0x5404f0['value']));if(_[_0x78df('0x21')](_0x5404f0[_0x78df('0x22')],_0x78df('0x23'))){_0x5404f0[_0x78df('0x22')]=_0x5404f0[_0x78df('0x22')][_0x78df('0x24')]('.wav49',_0x78df('0x25'));}if(recordings[_0x5404f0[_0x78df('0x12')]]){var _0xc8f71f=_[_0x78df('0x26')](recordings[_0x5404f0[_0x78df('0x12')]][_0x78df('0x27')],{'value':_0x5404f0['value']});if(_['isNil'](_0xc8f71f)){recordings[_0x5404f0['linkedid']][_0x78df('0x27')][_0x78df('0x28')]({'value':_0x5404f0[_0x78df('0x22')]});}}}}catch(_0x157f4a){utils[_0x78df('0x1e')](util[_0x78df('0x4')](_0x78df('0x29'),_0x5404f0[_0x78df('0x6')]),_0x157f4a);}};exports[_0x78df('0x2a')]=function(_0x4923ad){try{if(!_['isNil'](recordings[_0x4923ad['uniqueid']])){utils['debug'](util['format']('[%s][recordings][hangup]',_0x4923ad[_0x78df('0x6')]),_0x4923ad);utils[_0x78df('0x3')](util[_0x78df('0x4')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x4923ad[_0x78df('0x6')],_0x4923ad['calleridnum'],_0x4923ad[_0x78df('0x2b')],_0x4923ad['cause-txt']));recordings[_0x4923ad[_0x78df('0x6')]]['calleridnum']=_0x4923ad['calleridnum'];recordings[_0x4923ad[_0x78df('0x6')]]['calleridname']=_0x4923ad['calleridname'];recordings[_0x4923ad[_0x78df('0x6')]][_0x78df('0x2c')]=_0x4923ad[_0x78df('0x2c')];recordings[_0x4923ad[_0x78df('0x6')]]['connectedlinename']=_0x4923ad[_0x78df('0x2d')];if(recordings[_0x4923ad[_0x78df('0x6')]][_0x78df('0x2e')]==_0x78df('0x2f')&&recordings[_0x4923ad[_0x78df('0x6')]][_0x78df('0x16')]){recordings[_0x4923ad[_0x78df('0x6')]][_0x78df('0x2c')]=recordings[_0x4923ad['uniqueid']]['accountcode'];recordings[_0x4923ad['uniqueid']][_0x78df('0x2d')]='';}recordings[_0x4923ad[_0x78df('0x6')]]['monitors']['forEach'](function(_0x72073c){var _0x5cf60e=_[_0x78df('0x30')](recordings[_0x4923ad[_0x78df('0x6')]]);_0x5cf60e[_0x78df('0x22')]=_0x72073c[_0x78df('0x22')];writeDB(_0x5cf60e);});delete recordings[_0x4923ad[_0x78df('0x6')]];}}catch(_0x39adce){utils[_0x78df('0x1e')](util['format'](_0x78df('0x31'),_0x4923ad[_0x78df('0x6')]),_0x39adce);}};exports[_0x78df('0x32')]=function(_0x4b12b0){try{if(!_[_0x78df('0x1a')](recordings[_0x4b12b0[_0x78df('0x6')]])){utils[_0x78df('0x10')](util['format'](_0x78df('0x33'),_0x4b12b0[_0x78df('0x6')]),_0x4b12b0);utils['info'](util[_0x78df('0x4')](_0x78df('0x34'),_0x4b12b0[_0x78df('0x6')],_0x4b12b0[_0x78df('0x35')],_0x4b12b0[_0x78df('0x36')]));if(_0x4b12b0[_0x78df('0x35')][_0x78df('0x37')]()==_0x78df('0x38')&&_[_0x78df('0x39')](_0x4b12b0['appdata'][_0x78df('0x37')](),_0x78df('0x3a'))){var _0x162b75=_0x4b12b0[_0x78df('0x36')][_0x78df('0x3b')]('=');var _0x5597f1=_0x162b75[0x0][_0x78df('0x3c')](_0x162b75[0x0][_0x78df('0x3d')]('(')+0x1,_0x162b75[0x0][_0x78df('0x3d')](')'));var _0x28070f=_0x162b75[0x1];recordings[_0x4b12b0['uniqueid']][_0x5597f1]=_0x28070f;}}}catch(_0x34d833){utils[_0x78df('0x1e')](util[_0x78df('0x4')](_0x78df('0x33'),_0x4b12b0[_0x78df('0x6')]),_0x34d833);}};exports[_0x78df('0x3e')]=function(_0x539abf){try{if(!_[_0x78df('0x1a')](recordings[_0x539abf[_0x78df('0x6')]])){utils[_0x78df('0x10')](util[_0x78df('0x4')](_0x78df('0x3f'),_0x539abf[_0x78df('0x6')]),_0x539abf);utils[_0x78df('0x3')](util[_0x78df('0x4')](_0x78df('0x40'),_0x539abf[_0x78df('0x6')],_0x539abf['queue']));recordings[_0x539abf[_0x78df('0x6')]][_0x78df('0x41')]=_0x539abf[_0x78df('0x41')];}}catch(_0x20ee2a){utils['error'](util[_0x78df('0x4')](_0x78df('0x3f'),_0x539abf[_0x78df('0x6')]),_0x20ee2a);}};exports['blindtransfer']=function(_0x262415){try{utils[_0x78df('0x10')](util[_0x78df('0x4')](_0x78df('0x42'),_0x262415[_0x78df('0x6')]),_0x262415);utils['info'](util[_0x78df('0x4')](_0x78df('0x43'),_0x262415[_0x78df('0x6')],_0x262415[_0x78df('0x44')],_0x262415[_0x78df('0x45')],_0x262415[_0x78df('0x46')],_0x262415[_0x78df('0x47')]));if(recordings[_0x262415[_0x78df('0x48')]]&&transfers[_0x78df('0x7')][_0x262415[_0x78df('0x48')]]){transfers[_0x78df('0x7')][_0x262415[_0x78df('0x48')]][_0x78df('0x49')]=!![];}}catch(_0x3e16e2){utils[_0x78df('0x1e')](util[_0x78df('0x4')](_0x78df('0x42'),_0x262415[_0x78df('0x6')]),_0x3e16e2);}}; \ No newline at end of file +var _0x443b=['CreateVoiceRecording','request','newchannel','debug','[%s][recordings][newchannel]','context','exten','channel','newstate','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','linkedid','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','newexten','[%s][recordings][newexten]','application','appdata','toLowerCase','set','cdr','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','lodash','util','./utils','./transfers.controller','info','format','uniqueid','blinds','transfereeuniqueid','getUserByInternal','accountcode','then','name','UserId'];(function(_0x4c1951,_0x5db715){var _0x2534cc=function(_0xdd8b6e){while(--_0xdd8b6e){_0x4c1951['push'](_0x4c1951['shift']());}};_0x2534cc(++_0x5db715);}(_0x443b,0x1ae));var _0xb443=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x443b[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xb443('0x0'));var util=require(_0xb443('0x1'));var utils=require(_0xb443('0x2'));var transfers=require(_0xb443('0x3'));var recordings={};function writeDB(_0x338607){var _0x42bb4c;utils[_0xb443('0x4')](util[_0xb443('0x5')]('[%s][recordings][writeDB]',_0x338607[_0xb443('0x6')]));if(transfers[_0xb443('0x7')][_0x338607[_0xb443('0x6')]]){_0x42bb4c=_0x338607['uniqueid'];_0x338607[_0xb443('0x6')]=transfers['blinds'][_0x338607['uniqueid']][_0xb443('0x8')];}if(_0x338607['accountcode']){utils[_0xb443('0x9')](_0x338607[_0xb443('0xa')])[_0xb443('0xb')](function(_0x10df09){if(_0x10df09){_0x338607['membername']=_0x10df09[_0xb443('0xc')];_0x338607[_0xb443('0xd')]=_0x10df09['id'];}utils['request'](_0xb443('0xe'),_0x338607);});}else{utils[_0xb443('0xf')](_0xb443('0xe'),_0x338607);}if(_0x42bb4c)delete transfers[_0xb443('0x7')][_0x42bb4c];}exports[_0xb443('0x10')]=function(_0x2bbd2e){try{utils[_0xb443('0x11')](util[_0xb443('0x5')](_0xb443('0x12'),_0x2bbd2e['uniqueid']),_0x2bbd2e);if(_0x2bbd2e['uniqueid']==_0x2bbd2e['linkedid']){utils[_0xb443('0x4')](util['format']('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x2bbd2e[_0xb443('0x6')],_0x2bbd2e[_0xb443('0x13')],_0x2bbd2e[_0xb443('0x14')]));recordings[_0x2bbd2e[_0xb443('0x6')]]={'uniqueid':_0x2bbd2e[_0xb443('0x6')],'accountcode':_0x2bbd2e['accountcode'],'exten':_0x2bbd2e['exten'],'context':_0x2bbd2e[_0xb443('0x13')],'channel':_0x2bbd2e[_0xb443('0x15')],'monitors':[]};}}catch(_0x272da6){utils['error'](util['format'](_0xb443('0x12'),_0x2bbd2e[_0xb443('0x6')]),_0x272da6);}};exports[_0xb443('0x16')]=function(_0x22e7ab){try{utils[_0xb443('0x11')](util['format'](_0xb443('0x17'),_0x22e7ab[_0xb443('0x6')]),_0x22e7ab);if(!_[_0xb443('0x18')](recordings[_0x22e7ab[_0xb443('0x6')]])&&_0x22e7ab['channelstate']==0x6){utils[_0xb443('0x4')](util[_0xb443('0x5')](_0xb443('0x19'),_0x22e7ab[_0xb443('0x6')],_0x22e7ab[_0xb443('0x13')],_0x22e7ab[_0xb443('0x15')]));}else if(!_['isNil'](recordings[_0x22e7ab[_0xb443('0x1a')]])&&_0x22e7ab['channelstate']==0x6&&_0x22e7ab[_0xb443('0x13')]!=_0xb443('0x1b')){utils[_0xb443('0x4')](util[_0xb443('0x5')](_0xb443('0x1c'),_0x22e7ab[_0xb443('0x6')],_0x22e7ab[_0xb443('0x1a')],_0x22e7ab['context'],_0x22e7ab['channel']));recordings[_0x22e7ab['linkedid']][_0xb443('0xa')]=_0x22e7ab[_0xb443('0xa')];}}catch(_0x39b45e){utils[_0xb443('0x1d')](util[_0xb443('0x5')](_0xb443('0x17'),_0x22e7ab[_0xb443('0x6')]),_0x39b45e);}};exports[_0xb443('0x1e')]=function(_0x588410){try{if(!_[_0xb443('0x18')](_0x588410[_0xb443('0x1f')])&&!_[_0xb443('0x18')](_0x588410['variable'][_0xb443('0x20')])){utils[_0xb443('0x11')](util[_0xb443('0x5')](_0xb443('0x21'),_0x588410[_0xb443('0x6')]),_0x588410);utils[_0xb443('0x4')](util[_0xb443('0x5')](_0xb443('0x22'),_0x588410['uniqueid'],_0x588410['variable'],_0x588410[_0xb443('0x23')]));if(_[_0xb443('0x24')](_0x588410[_0xb443('0x23')],_0xb443('0x25'))){_0x588410[_0xb443('0x23')]=_0x588410['value'][_0xb443('0x26')]('.wav49',_0xb443('0x27'));}if(recordings[_0x588410['linkedid']]){var _0x2a696e=_[_0xb443('0x28')](recordings[_0x588410[_0xb443('0x1a')]]['monitors'],{'value':_0x588410[_0xb443('0x23')]});if(_[_0xb443('0x18')](_0x2a696e)){recordings[_0x588410[_0xb443('0x1a')]][_0xb443('0x29')][_0xb443('0x2a')]({'value':_0x588410[_0xb443('0x23')]});}}}}catch(_0x1826ca){utils['error'](util['format'](_0xb443('0x21'),_0x588410[_0xb443('0x6')]),_0x1826ca);}};exports[_0xb443('0x2b')]=function(_0x4df719){try{if(!_[_0xb443('0x18')](recordings[_0x4df719[_0xb443('0x6')]])){utils[_0xb443('0x11')](util[_0xb443('0x5')](_0xb443('0x2c'),_0x4df719['uniqueid']),_0x4df719);utils[_0xb443('0x4')](util['format']('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x4df719[_0xb443('0x6')],_0x4df719[_0xb443('0x2d')],_0x4df719[_0xb443('0x2e')],_0x4df719[_0xb443('0x2f')]));recordings[_0x4df719['uniqueid']][_0xb443('0x2d')]=_0x4df719[_0xb443('0x2d')];recordings[_0x4df719['uniqueid']][_0xb443('0x2e')]=_0x4df719[_0xb443('0x2e')];recordings[_0x4df719[_0xb443('0x6')]]['connectedlinenum']=_0x4df719[_0xb443('0x30')];recordings[_0x4df719[_0xb443('0x6')]][_0xb443('0x31')]=_0x4df719[_0xb443('0x31')];if(recordings[_0x4df719[_0xb443('0x6')]][_0xb443('0x32')]==_0xb443('0x33')&&recordings[_0x4df719[_0xb443('0x6')]][_0xb443('0xa')]){recordings[_0x4df719[_0xb443('0x6')]][_0xb443('0x30')]=recordings[_0x4df719['uniqueid']][_0xb443('0xa')];recordings[_0x4df719[_0xb443('0x6')]][_0xb443('0x31')]='';}recordings[_0x4df719[_0xb443('0x6')]]['monitors']['forEach'](function(_0x30ec43){var _0x42b04a=_['clone'](recordings[_0x4df719[_0xb443('0x6')]]);_0x42b04a[_0xb443('0x23')]=_0x30ec43[_0xb443('0x23')];writeDB(_0x42b04a);});delete recordings[_0x4df719['uniqueid']];}}catch(_0x3d11fc){utils[_0xb443('0x1d')](util['format']('[%s][recordings][hangup]',_0x4df719['uniqueid']),_0x3d11fc);}};exports[_0xb443('0x34')]=function(_0x48e563){try{if(!_[_0xb443('0x18')](recordings[_0x48e563[_0xb443('0x6')]])){utils[_0xb443('0x11')](util['format'](_0xb443('0x35'),_0x48e563['uniqueid']),_0x48e563);utils[_0xb443('0x4')](util[_0xb443('0x5')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x48e563[_0xb443('0x6')],_0x48e563[_0xb443('0x36')],_0x48e563[_0xb443('0x37')]));if(_0x48e563[_0xb443('0x36')][_0xb443('0x38')]()==_0xb443('0x39')&&_['startsWith'](_0x48e563[_0xb443('0x37')][_0xb443('0x38')](),_0xb443('0x3a'))){var _0x369b26=_0x48e563[_0xb443('0x37')]['split']('=');var _0xce10b2=_0x369b26[0x0][_0xb443('0x3b')](_0x369b26[0x0][_0xb443('0x3c')]('(')+0x1,_0x369b26[0x0][_0xb443('0x3c')](')'));var _0x33a81f=_0x369b26[0x1];recordings[_0x48e563[_0xb443('0x6')]][_0xce10b2]=_0x33a81f;}}}catch(_0x532b6d){utils[_0xb443('0x1d')](util[_0xb443('0x5')](_0xb443('0x35'),_0x48e563[_0xb443('0x6')]),_0x532b6d);}};exports[_0xb443('0x3d')]=function(_0x278f17){try{if(!_[_0xb443('0x18')](recordings[_0x278f17[_0xb443('0x6')]])){utils['debug'](util[_0xb443('0x5')](_0xb443('0x3e'),_0x278f17[_0xb443('0x6')]),_0x278f17);utils['info'](util['format'](_0xb443('0x3f'),_0x278f17[_0xb443('0x6')],_0x278f17[_0xb443('0x40')]));recordings[_0x278f17[_0xb443('0x6')]]['queue']=_0x278f17[_0xb443('0x40')];}}catch(_0x58a914){utils['error'](util[_0xb443('0x5')](_0xb443('0x3e'),_0x278f17[_0xb443('0x6')]),_0x58a914);}};exports[_0xb443('0x41')]=function(_0x5cbc2b){try{utils[_0xb443('0x11')](util[_0xb443('0x5')](_0xb443('0x42'),_0x5cbc2b['uniqueid']),_0x5cbc2b);utils[_0xb443('0x4')](util[_0xb443('0x5')](_0xb443('0x43'),_0x5cbc2b['uniqueid'],_0x5cbc2b[_0xb443('0x44')],_0x5cbc2b[_0xb443('0x45')],_0x5cbc2b[_0xb443('0x46')],_0x5cbc2b[_0xb443('0x47')]));if(recordings[_0x5cbc2b[_0xb443('0x48')]]&&transfers[_0xb443('0x7')][_0x5cbc2b[_0xb443('0x48')]]){transfers[_0xb443('0x7')][_0x5cbc2b['transfereruniqueid']][_0xb443('0x49')]=!![];}}catch(_0x41c633){utils[_0xb443('0x1d')](util[_0xb443('0x5')](_0xb443('0x42'),_0x5cbc2b[_0xb443('0x6')]),_0x41c633);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 05c294e..e2e94da 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 _0x9f14=['transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransfererexten','transfereechannel','transfertargetchannel','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','lodash','util','./utils','format','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','blind','blinds','transfereruniqueid','error','attendedtransfer','[%s][transfers][attendedtransfer]'];(function(_0x516a18,_0x1a615f){var _0x595140=function(_0x57a4af){while(--_0x57a4af){_0x516a18['push'](_0x516a18['shift']());}};_0x595140(++_0x1a615f);}(_0x9f14,0x166));var _0x49f1=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x9f14[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x49f1('0x0'));var util=require(_0x49f1('0x1'));var utils=require(_0x49f1('0x2'));function writeDB(_0x398247){utils['info'](util[_0x49f1('0x3')]('[%s][transfers][writeDB]\x20type:%s',_0x398247[_0x49f1('0x4')]===_0x49f1('0x5')?_0x398247[_0x49f1('0x6')]:_0x398247[_0x49f1('0x7')],_0x398247[_0x49f1('0x4')]));utils[_0x49f1('0x8')](_0x49f1('0x9'),_0x398247);}exports['blinds']={};exports[_0x49f1('0xa')]=function(_0x460255){try{utils[_0x49f1('0xb')](util[_0x49f1('0x3')](_0x49f1('0xc'),_0x460255[_0x49f1('0x7')]),_0x460255);utils[_0x49f1('0xd')](util[_0x49f1('0x3')](_0x49f1('0xe'),_0x460255[_0x49f1('0x7')],_0x460255['transferercalleridnum'],_0x460255[_0x49f1('0xf')],_0x460255['transfereecalleridnum'],_0x460255['transfereecalleridname']));_0x460255[_0x49f1('0x4')]=_0x49f1('0x10');exports[_0x49f1('0x11')][_0x460255[_0x49f1('0x12')]]=_0x460255;writeDB(_0x460255);}catch(_0x492c81){utils[_0x49f1('0x13')](util[_0x49f1('0x3')](_0x49f1('0xc'),_0x460255['uniqueid']),_0x492c81);}};exports[_0x49f1('0x14')]=function(_0x1ba877){try{utils[_0x49f1('0xb')](util[_0x49f1('0x3')](_0x49f1('0x15'),_0x1ba877[_0x49f1('0x6')]),_0x1ba877);utils['info'](util[_0x49f1('0x3')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x1ba877[_0x49f1('0x6')],_0x1ba877['origtransferercalleridnum'],_0x1ba877['origtransferercalleridname'],_0x1ba877[_0x49f1('0x16')],_0x1ba877[_0x49f1('0x17')]));_0x1ba877=_[_0x49f1('0x18')](_0x1ba877,{'transfererchannel':_0x1ba877[_0x49f1('0x19')],'transferercalleridnum':_0x1ba877[_0x49f1('0x1a')],'transferercalleridname':_0x1ba877['origtransferercalleridname'],'transfererconnectedlinenum':_0x1ba877['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x1ba877[_0x49f1('0x1b')],'transfereraccountcode':_0x1ba877['origtransfereraccountcode'],'transferercontext':_0x1ba877[_0x49f1('0x1c')],'transfererexten':_0x1ba877[_0x49f1('0x1d')],'transfererlinkedid':_0x1ba877[_0x49f1('0x1e')],'context':_0x1ba877['origtransferercontext'],'extension':_0x1ba877[_0x49f1('0x1f')],'type':_0x49f1('0x5')});if(_['isNil'](_0x1ba877[_0x49f1('0x20')])){_0x1ba877=_[_0x49f1('0x18')](_0x1ba877,{'transfereechannel':_0x1ba877[_0x49f1('0x21')],'transfereecalleridnum':_0x1ba877[_0x49f1('0x16')],'transfereecalleridname':_0x1ba877[_0x49f1('0x17')],'transfereeconnectedlinenum':_0x1ba877['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x1ba877[_0x49f1('0x22')],'transfereeaccountcode':_0x1ba877[_0x49f1('0x23')],'transfereecontext':_0x1ba877[_0x49f1('0x24')],'transfereeexten':_0x1ba877[_0x49f1('0x25')],'transfereelinkedid':_0x1ba877['transfertargetlinkedid']});}writeDB(_0x1ba877);}catch(_0x525272){utils['error'](util['format'](_0x49f1('0x15'),_0x1ba877[_0x49f1('0x6')]),_0x525272);}}; \ No newline at end of file +var _0x56d4=['util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','error','attendedtransfer','[%s][transfers][attendedtransfer]','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','transfereechannel','assign','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash'];(function(_0x1a41e1,_0x5b2099){var _0x2bbd3e=function(_0x38b92a){while(--_0x38b92a){_0x1a41e1['push'](_0x1a41e1['shift']());}};_0x2bbd3e(++_0x5b2099);}(_0x56d4,0x179));var _0x456d=function(_0x45aced,_0x2f6ba8){_0x45aced=_0x45aced-0x0;var _0x9b8720=_0x56d4[_0x45aced];return _0x9b8720;};'use strict';var _=require(_0x456d('0x0'));var util=require(_0x456d('0x1'));var utils=require(_0x456d('0x2'));function writeDB(_0x2f9239){utils[_0x456d('0x3')](util[_0x456d('0x4')](_0x456d('0x5'),_0x2f9239[_0x456d('0x6')]===_0x456d('0x7')?_0x2f9239[_0x456d('0x8')]:_0x2f9239[_0x456d('0x9')],_0x2f9239[_0x456d('0x6')]));utils[_0x456d('0xa')]('CreateVoiceTransferReport',_0x2f9239);}exports[_0x456d('0xb')]={};exports[_0x456d('0xc')]=function(_0x368b4e){try{utils[_0x456d('0xd')](util[_0x456d('0x4')](_0x456d('0xe'),_0x368b4e[_0x456d('0x9')]),_0x368b4e);utils[_0x456d('0x3')](util[_0x456d('0x4')](_0x456d('0xf'),_0x368b4e[_0x456d('0x9')],_0x368b4e[_0x456d('0x10')],_0x368b4e[_0x456d('0x11')],_0x368b4e[_0x456d('0x12')],_0x368b4e[_0x456d('0x13')]));_0x368b4e['type']=_0x456d('0x14');exports[_0x456d('0xb')][_0x368b4e[_0x456d('0x15')]]=_0x368b4e;writeDB(_0x368b4e);}catch(_0x38785c){utils[_0x456d('0x16')](util[_0x456d('0x4')](_0x456d('0xe'),_0x368b4e[_0x456d('0x9')]),_0x38785c);}};exports[_0x456d('0x17')]=function(_0x39583c){try{utils[_0x456d('0xd')](util[_0x456d('0x4')](_0x456d('0x18'),_0x39583c[_0x456d('0x8')]),_0x39583c);utils[_0x456d('0x3')](util[_0x456d('0x4')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x39583c['origtransfereruniqueid'],_0x39583c[_0x456d('0x19')],_0x39583c[_0x456d('0x1a')],_0x39583c[_0x456d('0x1b')],_0x39583c[_0x456d('0x1c')]));_0x39583c=_['assign'](_0x39583c,{'transfererchannel':_0x39583c[_0x456d('0x1d')],'transferercalleridnum':_0x39583c[_0x456d('0x19')],'transferercalleridname':_0x39583c[_0x456d('0x1a')],'transfererconnectedlinenum':_0x39583c[_0x456d('0x1e')],'transfererconnectedlinename':_0x39583c[_0x456d('0x1f')],'transfereraccountcode':_0x39583c[_0x456d('0x20')],'transferercontext':_0x39583c[_0x456d('0x21')],'transfererexten':_0x39583c[_0x456d('0x22')],'transfererlinkedid':_0x39583c[_0x456d('0x23')],'context':_0x39583c[_0x456d('0x24')],'extension':_0x39583c['origtransfererexten'],'type':_0x456d('0x7')});if(_['isNil'](_0x39583c[_0x456d('0x25')])){_0x39583c=_[_0x456d('0x26')](_0x39583c,{'transfereechannel':_0x39583c['transfertargetchannel'],'transfereecalleridnum':_0x39583c[_0x456d('0x1b')],'transfereecalleridname':_0x39583c[_0x456d('0x1c')],'transfereeconnectedlinenum':_0x39583c['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x39583c['transfertargetconnectedlinename'],'transfereeaccountcode':_0x39583c['transfertargetaccountcode'],'transfereecontext':_0x39583c[_0x456d('0x27')],'transfereeexten':_0x39583c[_0x456d('0x28')],'transfereelinkedid':_0x39583c[_0x456d('0x29')]});}writeDB(_0x39583c);}catch(_0x25b64f){utils['error'](util[_0x456d('0x4')](_0x456d('0x18'),_0x39583c[_0x456d('0x8')]),_0x25b64f);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index fa3179a..62cd52b 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 _0xd65f=['[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','then','found','notfound','catch','[utils][getUserByInternal]','getUserByInterface','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','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','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','util','client','http','../../config/logger','info','inspect','debug','error','request','[utils][request]\x20name:%s','GetUser','name','interface'];(function(_0x13486c,_0x139348){var _0x135738=function(_0x3e494a){while(--_0x3e494a){_0x13486c['push'](_0x13486c['shift']());}};_0x135738(++_0x139348);}(_0xd65f,0x171));var _0xfd65=function(_0x11fb47,_0x50fbf8){_0x11fb47=_0x11fb47-0x0;var _0xa0d270=_0xd65f[_0x11fb47];return _0xa0d270;};'use strict';var BPromise=require(_0xfd65('0x0'));var jayson=require(_0xfd65('0x1'));var moment=require('moment');var util=require(_0xfd65('0x2'));var client=jayson[_0xfd65('0x3')][_0xfd65('0x4')]({'port':0x2329});var logger=require(_0xfd65('0x5'))('xdr');exports[_0xfd65('0x6')]=function(_0x5f591f,_0xdf0f9c){logger['info'](_0x5f591f,_0xdf0f9c?util[_0xfd65('0x7')](_0xdf0f9c,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x34a06a,_0x156a7c){logger[_0xfd65('0x8')](_0x34a06a,_0x156a7c?util[_0xfd65('0x7')](_0x156a7c,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x1b75b7,_0x5f42e0){logger[_0xfd65('0x9')](_0x1b75b7,_0x5f42e0?util['inspect'](_0x5f42e0,{'showHidden':![],'depth':null}):'');};exports[_0xfd65('0xa')]=function(_0x48afb7,_0x9a206f){return client[_0xfd65('0xa')](_0x48afb7,{'body':_0x9a206f})['then'](function(_0x20bf91){logger[_0xfd65('0x8')](_0xfd65('0xb'),_0x48afb7,_0x20bf91?util[_0xfd65('0x7')](_0x20bf91,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x17a09b){logger[_0xfd65('0x9')](_0xfd65('0xb'),_0x48afb7,_0x17a09b?util[_0xfd65('0x7')](_0x17a09b,{'showHidden':![],'depth':null}):'');});};function getUser(_0x275064){return client[_0xfd65('0xa')](_0xfd65('0xc'),{'options':{'raw':!![],'attributes':['id','internal',_0xfd65('0xd'),_0xfd65('0xe')],'where':_0x275064,'limit':0x1}})['then'](function(_0x11e9e1){logger[_0xfd65('0x8')](_0xfd65('0xf'),JSON[_0xfd65('0x10')](_0x275064),_0x11e9e1?util[_0xfd65('0x7')](_0x11e9e1,{'showHidden':![],'depth':null}):'');return _0x11e9e1[_0xfd65('0x11')][_0xfd65('0x12')]?_0x11e9e1[_0xfd65('0x11')][0x0]:null;});}exports[_0xfd65('0x13')]=function(_0x50886c){return new BPromise(function(_0x12bc88,_0x3ce882){if(_0x50886c){return getUser({'internal':_0x50886c})[_0xfd65('0x14')](function(_0x17ce3e){logger[_0xfd65('0x6')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x50886c,_0x17ce3e?_0xfd65('0x15'):_0xfd65('0x16'));return _0x12bc88(_0x17ce3e);})[_0xfd65('0x17')](function(_0x4379ef){logger['error'](_0xfd65('0x18'),_0x4379ef?util[_0xfd65('0x7')](_0x4379ef,{'showHidden':![],'depth':null}):'');return _0x12bc88(null);});}return _0x12bc88(null);});};exports[_0xfd65('0x19')]=function(_0x366f6d){return new BPromise(function(_0x55971f,_0x5753cc){if(_0x366f6d){return getUser({'interface':_0x366f6d})['then'](function(_0x33e46d){logger[_0xfd65('0x6')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x366f6d,_0x33e46d?_0xfd65('0x15'):'notfound');return _0x55971f(_0x33e46d);})[_0xfd65('0x17')](function(_0x855a00){logger[_0xfd65('0x9')]('[utils][getUserByInterface]',_0x855a00?util[_0xfd65('0x7')](_0x855a00,{'showHidden':![],'depth':null}):'');return _0x55971f(null);});}return _0x55971f(null);});};exports[_0xfd65('0x1a')]=function(_0x334f1f){return new BPromise(function(_0x9db944,_0x5125eb){if(_0x334f1f){return getUser({'name':_0x334f1f})[_0xfd65('0x14')](function(_0x816b21){logger['info'](_0xfd65('0x1b'),_0x334f1f,_0x816b21?_0xfd65('0x15'):_0xfd65('0x16'));return _0x9db944(_0x816b21);})[_0xfd65('0x17')](function(_0x2847e8){logger[_0xfd65('0x9')](_0xfd65('0x1c'),_0x2847e8?util[_0xfd65('0x7')](_0x2847e8,{'showHidden':![],'depth':null}):'');return _0x9db944(null);});}return _0x9db944(null);});};exports[_0xfd65('0x1d')]=function(_0x3aea49){return new BPromise(function(_0x434fe5,_0x35bc94){if(_0x3aea49){return client['request']('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0xfd65('0xd'),_0xfd65('0x1e'),_0xfd65('0x1f'),_0xfd65('0x20')],'where':{'name':_0x3aea49},'limit':0x1}})[_0xfd65('0x14')](function(_0x3b6e97){logger['debug'](_0xfd65('0x21'),_0x3aea49,_0x3b6e97?util[_0xfd65('0x7')](_0x3b6e97,{'showHidden':![],'depth':null}):'');logger[_0xfd65('0x6')](_0xfd65('0x22'),_0x3aea49,_0x3b6e97?_0xfd65('0x15'):_0xfd65('0x16'));return _0x434fe5(_0x3b6e97['result'][_0xfd65('0x12')]?_0x3b6e97[_0xfd65('0x11')][0x0]:null);})[_0xfd65('0x17')](function(_0x3e05b8){logger[_0xfd65('0x9')](_0xfd65('0x23'),_0x3e05b8?util[_0xfd65('0x7')](_0x3e05b8,{'showHidden':![],'depth':null}):'');return _0x434fe5(null);});}return _0x434fe5(null);});};exports[_0xfd65('0x24')]=function(_0x19411f,_0x4854f8){return moment(_0x19411f)[_0xfd65('0x25')](_0x4854f8,'seconds')['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xfd65('0x26')]=function(_0x55adb2,_0x540c04){return moment(_0x55adb2)['subtract'](_0x540c04,_0xfd65('0x27'))[_0xfd65('0x28')](_0xfd65('0x29'));};exports[_0xfd65('0x2a')]=function(_0x27945c,_0x1fb33b){return moment(_0x27945c)[_0xfd65('0x2b')](moment(_0x1fb33b),_0xfd65('0x27'));};exports[_0xfd65('0x2c')]=function(_0x2148bf,_0x495589){return parseInt(_0x2148bf,0xa)+parseInt(_0x495589,0xa);};exports[_0xfd65('0x2d')]=function(){return moment()['format'](_0xfd65('0x29'));};exports[_0xfd65('0x2e')]=function(_0xb8b69b,_0x29b117){if(_0x29b117){return moment(_0xb8b69b)[_0xfd65('0x2e')](_0x29b117);}return!![];};exports[_0xfd65('0x2f')]=function(_0x4f710c,_0x49f641){if(_0x49f641){return moment(_0x4f710c)['isBefore'](_0x49f641);}else if(_0x4f710c){return!![];}return![];}; \ No newline at end of file +var _0x531a=['[utils][request]\x20name:%s','catch','GetUser','name','[utils][getUser]\x20where:%s','stringify','result','[utils][getUserByInternal]\x20internal:%s\x20%s','found','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','notfound','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','acw','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diff','sumTime','now','isAfter','isBefore','bluebird','moment','util','client','http','info','error','inspect','request','then','debug'];(function(_0x375cca,_0x407894){var _0x34f39c=function(_0x3fea86){while(--_0x3fea86){_0x375cca['push'](_0x375cca['shift']());}};_0x34f39c(++_0x407894);}(_0x531a,0x79));var _0xa531=function(_0x1f95f7,_0x361b99){_0x1f95f7=_0x1f95f7-0x0;var _0x1a0a51=_0x531a[_0x1f95f7];return _0x1a0a51;};'use strict';var BPromise=require(_0xa531('0x0'));var jayson=require('jayson/promise');var moment=require(_0xa531('0x1'));var util=require(_0xa531('0x2'));var client=jayson[_0xa531('0x3')][_0xa531('0x4')]({'port':0x2329});var logger=require('../../config/logger')('xdr');exports[_0xa531('0x5')]=function(_0x2f2b7a,_0x34dc3c){logger[_0xa531('0x5')](_0x2f2b7a,_0x34dc3c?util['inspect'](_0x34dc3c,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x3bf622,_0x19dae3){logger['debug'](_0x3bf622,_0x19dae3?util['inspect'](_0x19dae3,{'showHidden':![],'depth':null}):'');};exports[_0xa531('0x6')]=function(_0x31e630,_0x57dcf5){logger[_0xa531('0x6')](_0x31e630,_0x57dcf5?util[_0xa531('0x7')](_0x57dcf5,{'showHidden':![],'depth':null}):'');};exports[_0xa531('0x8')]=function(_0x1b080,_0x308c3c){return client[_0xa531('0x8')](_0x1b080,{'body':_0x308c3c})[_0xa531('0x9')](function(_0x280c3f){logger[_0xa531('0xa')](_0xa531('0xb'),_0x1b080,_0x280c3f?util[_0xa531('0x7')](_0x280c3f,{'showHidden':![],'depth':null}):'');})[_0xa531('0xc')](function(_0x46edae){logger[_0xa531('0x6')](_0xa531('0xb'),_0x1b080,_0x46edae?util[_0xa531('0x7')](_0x46edae,{'showHidden':![],'depth':null}):'');});};function getUser(_0x590c42){return client['request'](_0xa531('0xd'),{'options':{'raw':!![],'attributes':['id','internal',_0xa531('0xe'),'interface'],'where':_0x590c42,'limit':0x1}})[_0xa531('0x9')](function(_0x54ab07){logger['debug'](_0xa531('0xf'),JSON[_0xa531('0x10')](_0x590c42),_0x54ab07?util['inspect'](_0x54ab07,{'showHidden':![],'depth':null}):'');return _0x54ab07[_0xa531('0x11')]['length']?_0x54ab07[_0xa531('0x11')][0x0]:null;});}exports['getUserByInternal']=function(_0xa5e2d){return new BPromise(function(_0x4a750c,_0xd28bae){if(_0xa5e2d){return getUser({'internal':_0xa5e2d})[_0xa531('0x9')](function(_0x456482){logger[_0xa531('0x5')](_0xa531('0x12'),_0xa5e2d,_0x456482?_0xa531('0x13'):'notfound');return _0x4a750c(_0x456482);})['catch'](function(_0x6e50f6){logger[_0xa531('0x6')]('[utils][getUserByInternal]',_0x6e50f6?util[_0xa531('0x7')](_0x6e50f6,{'showHidden':![],'depth':null}):'');return _0x4a750c(null);});}return _0x4a750c(null);});};exports[_0xa531('0x14')]=function(_0x538b27){return new BPromise(function(_0x246df7,_0x2d0426){if(_0x538b27){return getUser({'interface':_0x538b27})[_0xa531('0x9')](function(_0x5af22e){logger[_0xa531('0x5')](_0xa531('0x15'),_0x538b27,_0x5af22e?_0xa531('0x13'):_0xa531('0x16'));return _0x246df7(_0x5af22e);})[_0xa531('0xc')](function(_0x1bed18){logger[_0xa531('0x6')](_0xa531('0x17'),_0x1bed18?util[_0xa531('0x7')](_0x1bed18,{'showHidden':![],'depth':null}):'');return _0x246df7(null);});}return _0x246df7(null);});};exports[_0xa531('0x18')]=function(_0x4c2bd2){return new BPromise(function(_0x2d59de,_0x5013b3){if(_0x4c2bd2){return getUser({'name':_0x4c2bd2})[_0xa531('0x9')](function(_0x501dd8){logger[_0xa531('0x5')](_0xa531('0x19'),_0x4c2bd2,_0x501dd8?_0xa531('0x13'):_0xa531('0x16'));return _0x2d59de(_0x501dd8);})[_0xa531('0xc')](function(_0x113f78){logger['error'](_0xa531('0x1a'),_0x113f78?util[_0xa531('0x7')](_0x113f78,{'showHidden':![],'depth':null}):'');return _0x2d59de(null);});}return _0x2d59de(null);});};exports[_0xa531('0x1b')]=function(_0x52761f){return new BPromise(function(_0x4d1a8b,_0x49cff6){if(_0x52761f){return client[_0xa531('0x8')](_0xa531('0x1c'),{'options':{'raw':!![],'attributes':['id','name','type',_0xa531('0x1d'),'acwTimeout'],'where':{'name':_0x52761f},'limit':0x1}})[_0xa531('0x9')](function(_0x4e4b26){logger['debug']('[utils][getVoiceQueueByName]\x20name:%s',_0x52761f,_0x4e4b26?util[_0xa531('0x7')](_0x4e4b26,{'showHidden':![],'depth':null}):'');logger[_0xa531('0x5')](_0xa531('0x1e'),_0x52761f,_0x4e4b26?_0xa531('0x13'):_0xa531('0x16'));return _0x4d1a8b(_0x4e4b26['result'][_0xa531('0x1f')]?_0x4e4b26[_0xa531('0x11')][0x0]:null);})['catch'](function(_0x2d9a3f){logger[_0xa531('0x6')](_0xa531('0x20'),_0x2d9a3f?util[_0xa531('0x7')](_0x2d9a3f,{'showHidden':![],'depth':null}):'');return _0x4d1a8b(null);});}return _0x4d1a8b(null);});};exports['addTime']=function(_0x9931a9,_0x576bf0){return moment(_0x9931a9)[_0xa531('0x21')](_0x576bf0,_0xa531('0x22'))[_0xa531('0x23')](_0xa531('0x24'));};exports[_0xa531('0x25')]=function(_0x113d29,_0x4e1a4b){return moment(_0x113d29)[_0xa531('0x26')](_0x4e1a4b,_0xa531('0x22'))[_0xa531('0x23')](_0xa531('0x24'));};exports['diffTime']=function(_0x2c2620,_0x34849b){return moment(_0x2c2620)[_0xa531('0x27')](moment(_0x34849b),'seconds');};exports[_0xa531('0x28')]=function(_0x17ba05,_0x249bcb){return parseInt(_0x17ba05,0xa)+parseInt(_0x249bcb,0xa);};exports[_0xa531('0x29')]=function(){return moment()[_0xa531('0x23')](_0xa531('0x24'));};exports[_0xa531('0x2a')]=function(_0x121d0e,_0x4ed68a){if(_0x4ed68a){return moment(_0x121d0e)['isAfter'](_0x4ed68a);}return!![];};exports[_0xa531('0x2b')]=function(_0x449ca5,_0x10b9cf){if(_0x10b9cf){return moment(_0x449ca5)[_0xa531('0x2b')](_0x10b9cf);}else if(_0x449ca5){return!![];}return![];}; \ No newline at end of file diff --git a/server/utils/client-side-logger.js b/server/utils/client-side-logger.js index 95551d7..7dee955 100644 --- a/server/utils/client-side-logger.js +++ b/server/utils/client-side-logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9652=['body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','statusCode','responseTime','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','url','device','agent_name','test','express-winston','path','./loggers','./safe-template','./mask-sensitive-data','maskSensitiveData','join','/var','xcally','client','role','name','ensureDir','then','catch','log','user','no-user','data','timestamp','auth','set','client-side-logger','use','isEmpty'];(function(_0x3f4dd9,_0xe0b819){var _0x31c54a=function(_0x25e6c6){while(--_0x25e6c6){_0x3f4dd9['push'](_0x3f4dd9['shift']());}};_0x31c54a(++_0xe0b819);}(_0x9652,0x181));var _0x2965=function(_0x10778c,_0x461571){_0x10778c=_0x10778c-0x0;var _0x38d5f2=_0x9652[_0x10778c];return _0x38d5f2;};var fs=require('fs-extra');var _=require('lodash');var ewinston=require(_0x2965('0x0'));var path=require(_0x2965('0x1'));var util=require('util');var fileLogger=require(_0x2965('0x2'))['fileLogger'];var safeTemplate=require(_0x2965('0x3'))['safeTemplate'];var maskSensitiveData=require(_0x2965('0x4'))[_0x2965('0x5')];function ClientSideLogger(){function _0x2922b1(_0x4a0989){var _0x1bae72=path[_0x2965('0x6')](_0x2965('0x7'),'log',_0x2965('0x8'));var _0x94906b=path[_0x2965('0x6')](_0x2965('0x9'),_0x4a0989[_0x2965('0xa')]+'-'+_0x4a0989[_0x2965('0xb')]);return fs[_0x2965('0xc')](path[_0x2965('0x6')](_0x1bae72,_0x94906b))[_0x2965('0xd')](function(){var _0x2ef718=fileLogger('client',path[_0x2965('0x6')](_0x1bae72,_0x94906b));return _0x2ef718;})[_0x2965('0xe')](function(_0x1c783c){throw _0x1c783c;});}this[_0x2965('0xf')]=function(_0x2204b8,_0x5d0bca,_0x16ba61,_0x17a7d7){return _0x2922b1(_0x2204b8[_0x2965('0x10')])[_0x2965('0xd')](function(_0x40c192){var _0x13dcf9=_0x40c192[_0x5d0bca];return _0x13dcf9;})[_0x2965('0xd')](function(_0xa65249){var _0xb755a3=_0x2204b8[_0x2965('0x10')]?_0x2204b8[_0x2965('0x10')]['id']:_0x2965('0x11');var _0x13d7b8=_0x17a7d7[_0x2965('0x12')];var _0x567402=_0x17a7d7[_0x2965('0x13')];var _0x28baa2=new Date(Number(_0x567402));return _0xa65249(_0xb755a3,_0x28baa2,_0x16ba61,_0x13d7b8);})[_0x2965('0xe')](function(_0x1e2bac){fileLogger(_0x2965('0x9'))['error'](_0x1e2bac);});};}function setupLoggers(_0x4a4d30){return new Promise(function(_0x125c8e){var _0x1917c7=new ClientSideLogger();var _0x3455cb=fileLogger('api');var _0x2fbf1a=fileLogger(_0x2965('0x14'));_0x4a4d30[_0x2965('0x15')](_0x2965('0x16'),_0x1917c7);_0x4a4d30[_0x2965('0x17')](ewinston['logger']({'winstonInstance':_0x3455cb,'meta':![],'statusLevels':!![],'msg':function(_0x2c2777,_0x2e7d8c){var _0x527eab='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x2965('0x18')](_0x2c2777[_0x2965('0x19')])){_0x527eab+=_0x2965('0x1a');var _0x13c80e=_0x2c2777[_0x2965('0x19')];maskSensitiveData(_0x13c80e);}return safeTemplate(util[_0x2965('0x1b')](_0x527eab,_0x2c2777[_0x2965('0x1c')],_0x2c2777[_0x2965('0x1d')]['x-forwarded-for']?_0x2c2777[_0x2965('0x1d')][_0x2965('0x1e')]:_0x2c2777[_0x2965('0x1f')][_0x2965('0x20')]||_0x2c2777['ip'],_0x2c2777['url'],_0x2e7d8c[_0x2965('0x21')],_0x2e7d8c[_0x2965('0x22')],_0x2c2777[_0x2965('0x10')]?_0x2c2777[_0x2965('0x10')]['id']:null,_0x2c2777[_0x2965('0x10')]?_0x2c2777[_0x2965('0x10')][_0x2965('0xb')]:null,_0x2c2777['user']?_0x2c2777[_0x2965('0x10')]['role']:null,_0x13c80e?util['inspect'](_0x13c80e,![],null):''));}}));_0x4a4d30[_0x2965('0x17')](ewinston['logger']({'winstonInstance':_0x2fbf1a,'meta':![],'statusLevels':!![],'msg':function(_0x1b77f9,_0x953321){var _0x15371a=_0x2965('0x23');if(_0x1b77f9[_0x2965('0x19')]&&_0x1b77f9['body']['device']&&_0x1b77f9[_0x2965('0x19')][_0x2965('0x24')]){_0x15371a='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x2965('0x1b')](_0x15371a,_0x1b77f9[_0x2965('0x1c')],_0x1b77f9[_0x2965('0x1d')][_0x2965('0x1e')]?_0x1b77f9['headers'][_0x2965('0x1e')]:_0x1b77f9[_0x2965('0x1f')][_0x2965('0x20')]||_0x1b77f9['ip'],_0x1b77f9[_0x2965('0x25')],_0x953321['statusCode'],_0x953321[_0x2965('0x22')],_0x1b77f9[_0x2965('0x10')]?_0x1b77f9[_0x2965('0x10')]['id']:null,_0x1b77f9[_0x2965('0x10')]?_0x1b77f9[_0x2965('0x10')][_0x2965('0xb')]:null,_0x1b77f9[_0x2965('0x10')]?_0x1b77f9['user'][_0x2965('0xa')]:null,_0x1b77f9[_0x2965('0x19')]&&_0x1b77f9[_0x2965('0x19')][_0x2965('0x26')]?_0x1b77f9[_0x2965('0x19')]['device']:'other',_0x1b77f9[_0x2965('0x19')]&&_0x1b77f9[_0x2965('0x19')]['agent_id']?_0x1b77f9[_0x2965('0x19')][_0x2965('0x24')]:'',_0x1b77f9[_0x2965('0x19')]&&_0x1b77f9[_0x2965('0x19')][_0x2965('0x27')]?_0x1b77f9[_0x2965('0x19')][_0x2965('0x27')]:'');},'ignoreRoute':function(_0x5800d3){var _0x6223d=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x6223d[_0x2965('0x28')](_0x5800d3[_0x2965('0x25')]);}}));return _0x125c8e();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file +var _0x8b1b=['util','./loggers','fileLogger','./safe-template','safeTemplate','maskSensitiveData','join','/var','log','xcally','role','name','client','catch','user','then','no-user','data','timestamp','error','api','auth','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','format','method','headers','x-forwarded-for','connection','url','statusCode','responseTime','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','remoteAddress','agent_id','agent_name','setupLoggers','fs-extra','lodash','express-winston','path'];(function(_0x40501d,_0x1011f2){var _0x5c53cf=function(_0x5eb05a){while(--_0x5eb05a){_0x40501d['push'](_0x40501d['shift']());}};_0x5c53cf(++_0x1011f2);}(_0x8b1b,0x1dc));var _0xb8b1=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0x8b1b[_0x44bcb0];return _0xfaf881;};var fs=require(_0xb8b1('0x0'));var _=require(_0xb8b1('0x1'));var ewinston=require(_0xb8b1('0x2'));var path=require(_0xb8b1('0x3'));var util=require(_0xb8b1('0x4'));var fileLogger=require(_0xb8b1('0x5'))[_0xb8b1('0x6')];var safeTemplate=require(_0xb8b1('0x7'))[_0xb8b1('0x8')];var maskSensitiveData=require('./mask-sensitive-data')[_0xb8b1('0x9')];function ClientSideLogger(){function _0x344488(_0x51e87e){var _0x44393d=path[_0xb8b1('0xa')](_0xb8b1('0xb'),_0xb8b1('0xc'),_0xb8b1('0xd'));var _0x351fca=path[_0xb8b1('0xa')]('client',_0x51e87e[_0xb8b1('0xe')]+'-'+_0x51e87e[_0xb8b1('0xf')]);return fs['ensureDir'](path[_0xb8b1('0xa')](_0x44393d,_0x351fca))['then'](function(){var _0x413430=fileLogger(_0xb8b1('0x10'),path['join'](_0x44393d,_0x351fca));return _0x413430;})[_0xb8b1('0x11')](function(_0x34f812){throw _0x34f812;});}this[_0xb8b1('0xc')]=function(_0x67938e,_0x226ebd,_0x547338,_0x3a2c16){return _0x344488(_0x67938e[_0xb8b1('0x12')])[_0xb8b1('0x13')](function(_0x2e36ba){var _0x6b29c3=_0x2e36ba[_0x226ebd];return _0x6b29c3;})[_0xb8b1('0x13')](function(_0x1b183b){var _0x475ba1=_0x67938e[_0xb8b1('0x12')]?_0x67938e[_0xb8b1('0x12')]['id']:_0xb8b1('0x14');var _0x920c3f=_0x3a2c16[_0xb8b1('0x15')];var _0x398092=_0x3a2c16[_0xb8b1('0x16')];var _0x4a9604=new Date(Number(_0x398092));return _0x1b183b(_0x475ba1,_0x4a9604,_0x547338,_0x920c3f);})[_0xb8b1('0x11')](function(_0x4fd38a){fileLogger(_0xb8b1('0x10'))[_0xb8b1('0x17')](_0x4fd38a);});};}function setupLoggers(_0xbb9a61){return new Promise(function(_0x59b96e){var _0x6f589b=new ClientSideLogger();var _0x4c4c31=fileLogger(_0xb8b1('0x18'));var _0x28f085=fileLogger(_0xb8b1('0x19'));_0xbb9a61[_0xb8b1('0x1a')](_0xb8b1('0x1b'),_0x6f589b);_0xbb9a61[_0xb8b1('0x1c')](ewinston[_0xb8b1('0x1d')]({'winstonInstance':_0x4c4c31,'meta':![],'statusLevels':!![],'msg':function(_0x4ba9bd,_0x250878){var _0x11c3a2=_0xb8b1('0x1e');if(!_['isEmpty'](_0x4ba9bd[_0xb8b1('0x1f')])){_0x11c3a2+='\x20body=%s';var _0x2307a0=_0x4ba9bd['body'];maskSensitiveData(_0x2307a0);}return safeTemplate(util[_0xb8b1('0x20')](_0x11c3a2,_0x4ba9bd[_0xb8b1('0x21')],_0x4ba9bd[_0xb8b1('0x22')][_0xb8b1('0x23')]?_0x4ba9bd['headers']['x-forwarded-for']:_0x4ba9bd[_0xb8b1('0x24')]['remoteAddress']||_0x4ba9bd['ip'],_0x4ba9bd[_0xb8b1('0x25')],_0x250878[_0xb8b1('0x26')],_0x250878[_0xb8b1('0x27')],_0x4ba9bd['user']?_0x4ba9bd[_0xb8b1('0x12')]['id']:null,_0x4ba9bd['user']?_0x4ba9bd[_0xb8b1('0x12')]['name']:null,_0x4ba9bd[_0xb8b1('0x12')]?_0x4ba9bd[_0xb8b1('0x12')][_0xb8b1('0xe')]:null,_0x2307a0?util[_0xb8b1('0x28')](_0x2307a0,![],null):''));}}));_0xbb9a61['use'](ewinston[_0xb8b1('0x1d')]({'winstonInstance':_0x28f085,'meta':![],'statusLevels':!![],'msg':function(_0x351823,_0x2a4c49){var _0xef671b=_0xb8b1('0x29');if(_0x351823[_0xb8b1('0x1f')]&&_0x351823[_0xb8b1('0x1f')][_0xb8b1('0x2a')]&&_0x351823[_0xb8b1('0x1f')]['agent_id']){_0xef671b=_0xb8b1('0x2b');}return util[_0xb8b1('0x20')](_0xef671b,_0x351823[_0xb8b1('0x21')],_0x351823[_0xb8b1('0x22')][_0xb8b1('0x23')]?_0x351823['headers'][_0xb8b1('0x23')]:_0x351823[_0xb8b1('0x24')][_0xb8b1('0x2c')]||_0x351823['ip'],_0x351823['url'],_0x2a4c49['statusCode'],_0x2a4c49[_0xb8b1('0x27')],_0x351823[_0xb8b1('0x12')]?_0x351823[_0xb8b1('0x12')]['id']:null,_0x351823[_0xb8b1('0x12')]?_0x351823[_0xb8b1('0x12')]['name']:null,_0x351823[_0xb8b1('0x12')]?_0x351823[_0xb8b1('0x12')][_0xb8b1('0xe')]:null,_0x351823[_0xb8b1('0x1f')]&&_0x351823['body'][_0xb8b1('0x2a')]?_0x351823[_0xb8b1('0x1f')][_0xb8b1('0x2a')]:'other',_0x351823[_0xb8b1('0x1f')]&&_0x351823[_0xb8b1('0x1f')][_0xb8b1('0x2d')]?_0x351823['body']['agent_id']:'',_0x351823[_0xb8b1('0x1f')]&&_0x351823[_0xb8b1('0x1f')][_0xb8b1('0x2e')]?_0x351823['body'][_0xb8b1('0x2e')]:'');},'ignoreRoute':function(_0x509581){var _0x4f4b5e=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x4f4b5e['test'](_0x509581[_0xb8b1('0x25')]);}}));return _0x59b96e();});}exports[_0xb8b1('0x2f')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index b503fda..6818381 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x29e3=['toLowerCase','circularMonthInterval','clone','hours','minutes','isBefore','endOf','day','isBetween','timeCompare','format','includes','dowCompare','date','max','min','domCompare','MMM','guess','test','isMoment','length','padStart','iftime','lodash','moment-timezone','map','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','locale','weekdaysShort','indexOf','slice','concat','exports','circularDoWInterval'];(function(_0x210baf,_0x447c17){var _0x49f464=function(_0x4012e2){while(--_0x4012e2){_0x210baf['push'](_0x210baf['shift']());}};_0x49f464(++_0x447c17);}(_0x29e3,0xb8));var _0x329e=function(_0x154bee,_0x550023){_0x154bee=_0x154bee-0x0;var _0x5cf921=_0x29e3[_0x154bee];return _0x5cf921;};var _=require(_0x329e('0x0'));var moment=require(_0x329e('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0x329e('0x2')](function(_0xbc4b26){return _0xbc4b26[_0x329e('0x3')];})[_0x329e('0x4')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x329e('0x5');var EINVALID_DATE=_0x329e('0x6');function throwIfDateNotValid(_0x547ee0){if(!_0x547ee0[_0x329e('0x7')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x15ba91){var _0x39871b=_0x15ba91[_0x329e('0x8')](':')[_0x329e('0x2')](function(_0x7f7fb7){return parseInt(_0x7f7fb7,0xa);});var _0xd9b96=_0x39871b[0x0];var _0x486e76=_0x39871b[0x1];if(_0xd9b96<0x0||_0xd9b96>0x17||_0x486e76<0x0||_0x486e76>0x3b){throw new Error(EINVALID_DATE);}return[_0xd9b96,_0x486e76];}function circularDoWInterval(_0x2dda5c,_0x380049){if(_0x2dda5c===_0x380049){return[_0x2dda5c];}else{var _0x2ead93=moment[_0x329e('0x9')]();moment[_0x329e('0x9')]('en');var _0x2603c8=moment[_0x329e('0xa')]()[_0x329e('0x2')](function(_0x258ff3){return _0x258ff3['toLowerCase']();});moment[_0x329e('0x9')](_0x2ead93);var _0xd8f767=_0x2603c8[_0x329e('0xb')](_0x2dda5c);var _0x30d749=_0x2603c8[_0x329e('0xb')](_0x380049);if(_0x30d749>_0xd8f767){return _0x2603c8[_0x329e('0xc')](_0xd8f767,_0x30d749+0x1);}else{var _0xf9be6e=_0x2603c8[_0x329e('0xc')](0x0,_0x30d749+0x1);var _0x1e8ec9=_0x2603c8['slice'](_0xd8f767);return _0x1e8ec9[_0x329e('0xd')](_0xf9be6e);}}}module[_0x329e('0xe')][_0x329e('0xf')]=circularDoWInterval;function circularMonthInterval(_0x4da68c,_0x3f0487){if(_0x4da68c===_0x3f0487){return[_0x4da68c];}else{var _0x5b92fd=moment[_0x329e('0x9')]();moment[_0x329e('0x9')]('en');var _0x33aa9d=moment['monthsShort']()['map'](function(_0x49bf68){return _0x49bf68[_0x329e('0x10')]();});moment['locale'](_0x5b92fd);var _0x43d480=_0x33aa9d[_0x329e('0xb')](_0x4da68c);var _0x4b5454=_0x33aa9d[_0x329e('0xb')](_0x3f0487);if(_0x4b5454>_0x43d480){return _0x33aa9d['slice'](_0x43d480,_0x4b5454+0x1);}else{var _0x2275d6=_0x33aa9d[_0x329e('0xc')](0x0,_0x4b5454+0x1);var _0x3d97d1=_0x33aa9d['slice'](_0x43d480);return _0x3d97d1[_0x329e('0xd')](_0x2275d6);}}}module[_0x329e('0xe')][_0x329e('0x11')]=circularMonthInterval;function parseDom(_0x115b17){var _0x52dba7=parseInt(_0x115b17,0xa);if(_0x52dba7<0x1||_0x52dba7>0x1f){throw new Error(EINVALID_DATE);}return _0x52dba7;}function timeCompare(_0x430820,_0x2286d8,_0x3fbf5){var _0x5a8e96=_0x430820[_0x329e('0x12')]();var _0x174eb7=extractTime(_0x2286d8);var _0x40324c=_0x174eb7[0x0];var _0x441049=_0x174eb7[0x1];var _0x2c3c8d=_0x430820['clone']()[_0x329e('0x13')](_0x40324c)[_0x329e('0x14')](_0x441049);throwIfDateNotValid(_0x2c3c8d);var _0x4ddda6=extractTime(_0x3fbf5);var _0x46e6ee=_0x4ddda6[0x0];var _0x5e1cc9=_0x4ddda6[0x1];var _0x1ecca4=_0x430820['clone']()[_0x329e('0x13')](_0x46e6ee)[_0x329e('0x14')](_0x5e1cc9);throwIfDateNotValid(_0x1ecca4);if(_0x1ecca4[_0x329e('0x15')](_0x2c3c8d)){var _0x891831=_0x5a8e96['clone']()['startOf']('day');var _0x4d3f70=_0x5a8e96['clone']()[_0x329e('0x16')](_0x329e('0x17'));return _0x5a8e96[_0x329e('0x18')](_0x2c3c8d,_0x4d3f70,undefined,'[]')||_0x5a8e96[_0x329e('0x18')](_0x891831,_0x1ecca4,undefined,'[]');}else{return _0x5a8e96[_0x329e('0x18')](_0x2c3c8d,_0x1ecca4,undefined,'[]');}}module[_0x329e('0xe')][_0x329e('0x19')]=timeCompare;function dowCompare(_0x22121b,_0xc7830b,_0x4691a4){var _0x205a72=_0x22121b[_0x329e('0x9')]('en')[_0x329e('0x1a')]('ddd')[_0x329e('0x10')]();return circularDoWInterval(_0xc7830b,_0x4691a4)[_0x329e('0x1b')](_0x205a72);}module[_0x329e('0xe')][_0x329e('0x1c')]=dowCompare;function domCompare(_0x4ea13d,_0x4023d8,_0x4555d6){var _0x16a9b2=_0x4ea13d[_0x329e('0x1d')]();if(_0x4023d8===_0x4555d6){return _0x16a9b2===_0x4023d8;}else{var _0x5878eb=_0x4ea13d['daysInMonth']();var _0x3523d6=_0x4023d8<_0x4555d6;let _0x202c10=![];var _0x508cb6=0x0;var _0x1960ff=0x0;if(_0x3523d6){_0x508cb6=Math[_0x329e('0x1e')](0x1,_0x4023d8);_0x1960ff=Math[_0x329e('0x1f')](_0x4555d6,_0x5878eb);_0x202c10=_0x16a9b2>=_0x508cb6&&_0x16a9b2<=_0x1960ff;}else{_0x508cb6=Math['min'](_0x4023d8,_0x5878eb);_0x1960ff=Math['max'](0x1,_0x4555d6);_0x202c10=_0x16a9b2>=_0x508cb6||_0x16a9b2<=_0x1960ff;}return _0x202c10;}}module[_0x329e('0xe')][_0x329e('0x20')]=domCompare;function monthCompare(_0x4abade,_0x11e1c6,_0x1eb24f){var _0x3e3485=_0x4abade[_0x329e('0x9')]('en')[_0x329e('0x1a')](_0x329e('0x21'))[_0x329e('0x10')]();return circularMonthInterval(_0x11e1c6,_0x1eb24f)['includes'](_0x3e3485);}module['exports']['monthCompare']=monthCompare;function iftime(_0x489185,_0x502f9e=moment['tz'][_0x329e('0x22')](),_0x24eef6=moment()){if(!validateRx[_0x329e('0x23')](_0x489185)){throw new Error(EINVALID_STRING);}else{var _0x4dcf28=(moment[_0x329e('0x24')](_0x24eef6)?_0x24eef6[_0x329e('0x12')]():moment(_0x24eef6))['tz'](_0x502f9e)['locale']('en');throwIfDateNotValid(_0x4dcf28);var _0x39926b=_0x489185[_0x329e('0x8')](',');var _0x527640=_0x39926b[0x0];var _0x365e47=_0x39926b[0x1];var _0x24ea4f=_0x39926b[0x2];var _0x66a3c2=_0x39926b[0x3];let _0x396623=!![];if(_0x527640!=='*'){var _0x4266c8=_0x527640[_0x329e('0x8')]('-');var _0xab3dcb=_['padStart'](_0x4266c8[0x0],0x5,'0');var _0xabe0c3=_0x4266c8[_0x329e('0x25')]===0x2?_[_0x329e('0x26')](_0x4266c8[0x1],0x5,'0'):_0xab3dcb;_0x396623=timeCompare(_0x4dcf28,_0xab3dcb,_0xabe0c3);}let _0x443fa0=!![];if(_0x365e47!=='*'){var _0x56d58f=_0x365e47[_0x329e('0x8')]('-');var _0x327fe3=_0x56d58f[0x0];var _0x3374bf=_0x56d58f[_0x329e('0x25')]===0x2?_0x56d58f[0x1]:_0x327fe3;_0x443fa0=dowCompare(_0x4dcf28,_0x327fe3,_0x3374bf);}let _0x14d358=!![];if(_0x24ea4f!=='*'){var _0xd302ff=_0x24ea4f['split']('-');var _0x5094bc=parseDom(_0xd302ff[0x0]);var _0x52d179=_0xd302ff[_0x329e('0x25')]===0x2?parseDom(_0xd302ff[0x1]):_0x5094bc;_0x14d358=domCompare(_0x4dcf28,_0x5094bc,_0x52d179);}let _0x564042=!![];if(_0x66a3c2!=='*'){var _0x1401cc=_0x66a3c2[_0x329e('0x8')]('-');var _0x174f65=_0x1401cc[0x0];var _0x209eb2=_0x1401cc[_0x329e('0x25')]===0x2?_0x1401cc[0x1]:_0x1401cc[0x0];_0x564042=monthCompare(_0x4dcf28,_0x174f65,_0x209eb2);}return _0x396623&&_0x443fa0&&_0x14d358&&_0x564042;}}module['exports'][_0x329e('0x27')]=iftime; \ No newline at end of file +var _0x0913=['isBetween','timeCompare','format','date','daysInMonth','max','min','domCompare','includes','guess','test','isMoment','padStart','length','iftime','lodash','moment-timezone','map','source','join','Interval\x20string\x20not\x20valid','split','locale','weekdaysShort','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','toLowerCase','circularMonthInterval','clone','hours','minutes','startOf','day','endOf'];(function(_0x2b9c5a,_0x52f3e7){var _0x2e0b2b=function(_0x51b225){while(--_0x51b225){_0x2b9c5a['push'](_0x2b9c5a['shift']());}};_0x2e0b2b(++_0x52f3e7);}(_0x0913,0xcd));var _0x3091=function(_0x1fb720,_0x4f4e7b){_0x1fb720=_0x1fb720-0x0;var _0x118a44=_0x0913[_0x1fb720];return _0x118a44;};var _=require(_0x3091('0x0'));var moment=require(_0x3091('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0x3091('0x2')](function(_0x3788f4){return _0x3788f4[_0x3091('0x3')];})[_0x3091('0x4')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x3091('0x5');var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x4f8bd9){if(!_0x4f8bd9['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x1406be){var _0x1be705=_0x1406be[_0x3091('0x6')](':')[_0x3091('0x2')](function(_0x2f69b4){return parseInt(_0x2f69b4,0xa);});var _0x361546=_0x1be705[0x0];var _0x326aca=_0x1be705[0x1];if(_0x361546<0x0||_0x361546>0x17||_0x326aca<0x0||_0x326aca>0x3b){throw new Error(EINVALID_DATE);}return[_0x361546,_0x326aca];}function circularDoWInterval(_0x3bcce5,_0x31e64a){if(_0x3bcce5===_0x31e64a){return[_0x3bcce5];}else{var _0x455b2b=moment[_0x3091('0x7')]();moment[_0x3091('0x7')]('en');var _0x7e7bcc=moment[_0x3091('0x8')]()['map'](function(_0x574f6b){return _0x574f6b['toLowerCase']();});moment[_0x3091('0x7')](_0x455b2b);var _0x2d441a=_0x7e7bcc[_0x3091('0x9')](_0x3bcce5);var _0x482f65=_0x7e7bcc[_0x3091('0x9')](_0x31e64a);if(_0x482f65>_0x2d441a){return _0x7e7bcc[_0x3091('0xa')](_0x2d441a,_0x482f65+0x1);}else{var _0x51f771=_0x7e7bcc[_0x3091('0xa')](0x0,_0x482f65+0x1);var _0x22e8e7=_0x7e7bcc['slice'](_0x2d441a);return _0x22e8e7[_0x3091('0xb')](_0x51f771);}}}module[_0x3091('0xc')][_0x3091('0xd')]=circularDoWInterval;function circularMonthInterval(_0x53bf8a,_0x35e873){if(_0x53bf8a===_0x35e873){return[_0x53bf8a];}else{var _0x58698e=moment['locale']();moment['locale']('en');var _0x50704d=moment[_0x3091('0xe')]()[_0x3091('0x2')](function(_0x5aae7e){return _0x5aae7e[_0x3091('0xf')]();});moment[_0x3091('0x7')](_0x58698e);var _0x3b8827=_0x50704d[_0x3091('0x9')](_0x53bf8a);var _0x87a56c=_0x50704d['indexOf'](_0x35e873);if(_0x87a56c>_0x3b8827){return _0x50704d[_0x3091('0xa')](_0x3b8827,_0x87a56c+0x1);}else{var _0x18aef6=_0x50704d[_0x3091('0xa')](0x0,_0x87a56c+0x1);var _0x58b364=_0x50704d[_0x3091('0xa')](_0x3b8827);return _0x58b364[_0x3091('0xb')](_0x18aef6);}}}module['exports'][_0x3091('0x10')]=circularMonthInterval;function parseDom(_0x29b542){var _0xf07348=parseInt(_0x29b542,0xa);if(_0xf07348<0x1||_0xf07348>0x1f){throw new Error(EINVALID_DATE);}return _0xf07348;}function timeCompare(_0xe385fa,_0x3b8190,_0x313da9){var _0x4aed34=_0xe385fa[_0x3091('0x11')]();var _0x1a53ec=extractTime(_0x3b8190);var _0x10d2aa=_0x1a53ec[0x0];var _0x30dfea=_0x1a53ec[0x1];var _0x51eca5=_0xe385fa['clone']()[_0x3091('0x12')](_0x10d2aa)[_0x3091('0x13')](_0x30dfea);throwIfDateNotValid(_0x51eca5);var _0x31be1b=extractTime(_0x313da9);var _0x142582=_0x31be1b[0x0];var _0x209b79=_0x31be1b[0x1];var _0x3c5dee=_0xe385fa['clone']()['hours'](_0x142582)[_0x3091('0x13')](_0x209b79);throwIfDateNotValid(_0x3c5dee);if(_0x3c5dee['isBefore'](_0x51eca5)){var _0x2b33e8=_0x4aed34[_0x3091('0x11')]()[_0x3091('0x14')](_0x3091('0x15'));var _0x59ec6d=_0x4aed34[_0x3091('0x11')]()[_0x3091('0x16')](_0x3091('0x15'));return _0x4aed34['isBetween'](_0x51eca5,_0x59ec6d,undefined,'[]')||_0x4aed34[_0x3091('0x17')](_0x2b33e8,_0x3c5dee,undefined,'[]');}else{return _0x4aed34[_0x3091('0x17')](_0x51eca5,_0x3c5dee,undefined,'[]');}}module[_0x3091('0xc')][_0x3091('0x18')]=timeCompare;function dowCompare(_0x51d028,_0x3117c3,_0x2b1720){var _0x32066c=_0x51d028[_0x3091('0x7')]('en')[_0x3091('0x19')]('ddd')['toLowerCase']();return circularDoWInterval(_0x3117c3,_0x2b1720)['includes'](_0x32066c);}module[_0x3091('0xc')]['dowCompare']=dowCompare;function domCompare(_0x23805f,_0x4b7c3e,_0x1c874f){var _0xdacdcc=_0x23805f[_0x3091('0x1a')]();if(_0x4b7c3e===_0x1c874f){return _0xdacdcc===_0x4b7c3e;}else{var _0x4d5a96=_0x23805f[_0x3091('0x1b')]();var _0x40e6b2=_0x4b7c3e<_0x1c874f;let _0x2c889a=![];var _0x422c3f=0x0;var _0x36fd60=0x0;if(_0x40e6b2){_0x422c3f=Math[_0x3091('0x1c')](0x1,_0x4b7c3e);_0x36fd60=Math[_0x3091('0x1d')](_0x1c874f,_0x4d5a96);_0x2c889a=_0xdacdcc>=_0x422c3f&&_0xdacdcc<=_0x36fd60;}else{_0x422c3f=Math[_0x3091('0x1d')](_0x4b7c3e,_0x4d5a96);_0x36fd60=Math[_0x3091('0x1c')](0x1,_0x1c874f);_0x2c889a=_0xdacdcc>=_0x422c3f||_0xdacdcc<=_0x36fd60;}return _0x2c889a;}}module[_0x3091('0xc')][_0x3091('0x1e')]=domCompare;function monthCompare(_0x54a619,_0x353cf1,_0x12de3d){var _0x4faf16=_0x54a619[_0x3091('0x7')]('en')[_0x3091('0x19')]('MMM')[_0x3091('0xf')]();return circularMonthInterval(_0x353cf1,_0x12de3d)[_0x3091('0x1f')](_0x4faf16);}module['exports']['monthCompare']=monthCompare;function iftime(_0x75282f,_0x4ac91c=moment['tz'][_0x3091('0x20')](),_0x2727e4=moment()){if(!validateRx[_0x3091('0x21')](_0x75282f)){throw new Error(EINVALID_STRING);}else{var _0x2d937a=(moment[_0x3091('0x22')](_0x2727e4)?_0x2727e4[_0x3091('0x11')]():moment(_0x2727e4))['tz'](_0x4ac91c)[_0x3091('0x7')]('en');throwIfDateNotValid(_0x2d937a);var _0x129f56=_0x75282f[_0x3091('0x6')](',');var _0x411e8c=_0x129f56[0x0];var _0x322485=_0x129f56[0x1];var _0x5636f0=_0x129f56[0x2];var _0x4cf024=_0x129f56[0x3];let _0x8d8fb8=!![];if(_0x411e8c!=='*'){var _0x65bd91=_0x411e8c[_0x3091('0x6')]('-');var _0xc49a00=_[_0x3091('0x23')](_0x65bd91[0x0],0x5,'0');var _0xcc1b0=_0x65bd91[_0x3091('0x24')]===0x2?_[_0x3091('0x23')](_0x65bd91[0x1],0x5,'0'):_0xc49a00;_0x8d8fb8=timeCompare(_0x2d937a,_0xc49a00,_0xcc1b0);}let _0x54dac3=!![];if(_0x322485!=='*'){var _0x21fe9a=_0x322485[_0x3091('0x6')]('-');var _0x557403=_0x21fe9a[0x0];var _0x1eb7aa=_0x21fe9a['length']===0x2?_0x21fe9a[0x1]:_0x557403;_0x54dac3=dowCompare(_0x2d937a,_0x557403,_0x1eb7aa);}let _0x248c77=!![];if(_0x5636f0!=='*'){var _0x334df3=_0x5636f0[_0x3091('0x6')]('-');var _0x36017e=parseDom(_0x334df3[0x0]);var _0x368220=_0x334df3[_0x3091('0x24')]===0x2?parseDom(_0x334df3[0x1]):_0x36017e;_0x248c77=domCompare(_0x2d937a,_0x36017e,_0x368220);}let _0x1bacdf=!![];if(_0x4cf024!=='*'){var _0x53aeef=_0x4cf024[_0x3091('0x6')]('-');var _0x2cb40f=_0x53aeef[0x0];var _0xce03b1=_0x53aeef['length']===0x2?_0x53aeef[0x1]:_0x53aeef[0x0];_0x1bacdf=monthCompare(_0x2d937a,_0x2cb40f,_0xce03b1);}return _0x8d8fb8&&_0x54dac3&&_0x248c77&&_0x1bacdf;}}module['exports'][_0x3091('0x25')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 148bb65..0d78cec 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6fcf=['join','format','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','meta','keys','length','stringify','toUpperCase','Logger','transports','Console','warn','File','%s-%s','error','path','util','winston','../config/environment','debugLevel','toLowerCase','red','bold\x20yellow','white','bold\x20green','gray','bold\x20magenta','bold\x20cyan','addColors'];(function(_0x1e25b2,_0x356fc9){var _0xf5ae1a=function(_0x111ae0){while(--_0x111ae0){_0x1e25b2['push'](_0x1e25b2['shift']());}};_0xf5ae1a(++_0x356fc9);}(_0x6fcf,0xa1));var _0xf6fc=function(_0x34a47b,_0x109857){_0x34a47b=_0x34a47b-0x0;var _0x3bd3d7=_0x6fcf[_0x34a47b];return _0x3bd3d7;};'use strict';var path=require(_0xf6fc('0x0'));var util=require(_0xf6fc('0x1'));var moment=require('moment');var winston=require(_0xf6fc('0x2'));var config=require(_0xf6fc('0x3'));var debugLevel=config[_0xf6fc('0x4')]?config['debugLevel'][_0xf6fc('0x5')]():'info';var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':'redBG\x20white','error':_0xf6fc('0x6'),'warn':_0xf6fc('0x7'),'info':_0xf6fc('0x8'),'print':'bold\x20white','success':_0xf6fc('0x9'),'http':_0xf6fc('0xa'),'verbose':_0xf6fc('0xb'),'debug':'bold\x20blue','silly':_0xf6fc('0xc')};winston[_0xf6fc('0xd')](XC_LOG_COLORS);function getLogFileName(_0x4ec25e,_0x5f3571,_0x54ecd3){var _0x6fe143=_0x4ec25e||'/var/log/xcally';return path[_0xf6fc('0xe')](_0x6fe143,util[_0xf6fc('0xf')]('%s-%s.log',_0x5f3571,_0x54ecd3));}function formatter(_0x527bff,_0x23c266){_0x23c266[_0xf6fc('0x10')]=_0x23c266['message'][_0xf6fc('0x11')](/@@{/g,_0xf6fc('0x12'))[_0xf6fc('0x11')](/}@@/g,_0xf6fc('0x13'))[_0xf6fc('0x11')](/@{/g,'{{')[_0xf6fc('0x11')](/}@/g,'}}');return util['format'](_0xf6fc('0x14'),moment()[_0xf6fc('0xf')](_0xf6fc('0x15')),_0x23c266[_0xf6fc('0x16')]['toUpperCase'](),_0x527bff,_0x23c266[_0xf6fc('0x10')]);}function fileFormat(_0x43223e,_0x15c70d){_0x15c70d[_0xf6fc('0x10')]=_0x15c70d[_0xf6fc('0x10')][_0xf6fc('0x11')](/@@{/g,'{{{')[_0xf6fc('0x11')](/}@@/g,'}}}')['replace'](/@{/g,'{{')[_0xf6fc('0x11')](/}@/g,'}}');var _0x44e1b3=_0x15c70d[_0xf6fc('0x17')]&&Object[_0xf6fc('0x18')](_0x15c70d[_0xf6fc('0x17')])[_0xf6fc('0x19')]?'\x0a\x09'+JSON[_0xf6fc('0x1a')](_0x15c70d[_0xf6fc('0x17')]):'';return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0xf6fc('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),_0x15c70d[_0xf6fc('0x16')][_0xf6fc('0x1b')](),_0x43223e,_0x15c70d[_0xf6fc('0x10')],_0x44e1b3);}function consoleLogger(){var _0x11d599=new winston[(_0xf6fc('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xf6fc('0x1d'))][(_0xf6fc('0x1e'))]({'level':_0xf6fc('0x1f'),'json':![],'formatter':function(_0x34a0af){return formatter('',_0x34a0af);}})]});return _0x11d599;}function fileLogger(_0x4da47e,_0x325e6f){var _0x4ee1b7=new winston[(_0xf6fc('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0xf6fc('0x20'))]({'name':util[_0xf6fc('0xf')](_0xf6fc('0x21'),_0x4da47e,_0xf6fc('0x22')),'filename':getLogFileName(_0x325e6f,_0x4da47e,_0xf6fc('0x22')),'level':_0xf6fc('0x22'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3cd9dd){return fileFormat(_0x4da47e,_0x3cd9dd);}}),new winston[(_0xf6fc('0x1d'))][(_0xf6fc('0x20'))]({'name':util['format']('%s-%s',_0x4da47e,debugLevel),'filename':getLogFileName(_0x325e6f,_0x4da47e,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5d6a69){return fileFormat(_0x4da47e,_0x5d6a69);}}),new winston[(_0xf6fc('0x1d'))][(_0xf6fc('0x1e'))]({'level':_0xf6fc('0x1f'),'json':![],'formatter':function(_0x11af19){return fileFormat(_0x4da47e,_0x11af19);}})]});return _0x4ee1b7;}exports['consoleLogger']=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file +var _0x7b64=['transports','Console','warn','Logger','File','%s-%s','error','consoleLogger','fileLogger','path','util','winston','../config/environment','debugLevel','info','redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20cyan','addColors','/var/log/xcally','format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','keys','meta','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s'];(function(_0x254639,_0x52d8b2){var _0x582063=function(_0x2e9c74){while(--_0x2e9c74){_0x254639['push'](_0x254639['shift']());}};_0x582063(++_0x52d8b2);}(_0x7b64,0x151));var _0x47b6=function(_0x3bdd0a,_0x5b3484){_0x3bdd0a=_0x3bdd0a-0x0;var _0x17f42e=_0x7b64[_0x3bdd0a];return _0x17f42e;};'use strict';var path=require(_0x47b6('0x0'));var util=require(_0x47b6('0x1'));var moment=require('moment');var winston=require(_0x47b6('0x2'));var config=require(_0x47b6('0x3'));var debugLevel=config['debugLevel']?config[_0x47b6('0x4')]['toLowerCase']():_0x47b6('0x5');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x47b6('0x6'),'error':_0x47b6('0x7'),'warn':_0x47b6('0x8'),'info':_0x47b6('0x9'),'print':_0x47b6('0xa'),'success':_0x47b6('0xb'),'http':_0x47b6('0xc'),'verbose':_0x47b6('0xd'),'debug':'bold\x20blue','silly':_0x47b6('0xe')};winston[_0x47b6('0xf')](XC_LOG_COLORS);function getLogFileName(_0x52c622,_0x5ac843,_0x414ad1){var _0x250355=_0x52c622||_0x47b6('0x10');return path['join'](_0x250355,util[_0x47b6('0x11')](_0x47b6('0x12'),_0x5ac843,_0x414ad1));}function formatter(_0x59c5bf,_0x5aac03){_0x5aac03['message']=_0x5aac03[_0x47b6('0x13')][_0x47b6('0x14')](/@@{/g,_0x47b6('0x15'))[_0x47b6('0x14')](/}@@/g,_0x47b6('0x16'))[_0x47b6('0x14')](/@{/g,'{{')[_0x47b6('0x14')](/}@/g,'}}');return util[_0x47b6('0x11')](_0x47b6('0x17'),moment()[_0x47b6('0x11')](_0x47b6('0x18')),_0x5aac03[_0x47b6('0x19')][_0x47b6('0x1a')](),_0x59c5bf,_0x5aac03[_0x47b6('0x13')]);}function fileFormat(_0x2f0c98,_0x5b92f8){_0x5b92f8[_0x47b6('0x13')]=_0x5b92f8[_0x47b6('0x13')][_0x47b6('0x14')](/@@{/g,_0x47b6('0x15'))[_0x47b6('0x14')](/}@@/g,_0x47b6('0x16'))[_0x47b6('0x14')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x4c030e=_0x5b92f8['meta']&&Object[_0x47b6('0x1b')](_0x5b92f8[_0x47b6('0x1c')])[_0x47b6('0x1d')]?'\x0a\x09'+JSON[_0x47b6('0x1e')](_0x5b92f8[_0x47b6('0x1c')]):'';return util[_0x47b6('0x11')](_0x47b6('0x1f'),moment()[_0x47b6('0x11')](_0x47b6('0x18')),_0x5b92f8['level']['toUpperCase'](),_0x2f0c98,_0x5b92f8[_0x47b6('0x13')],_0x4c030e);}function consoleLogger(){var _0x554a24=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x47b6('0x20'))][(_0x47b6('0x21'))]({'level':_0x47b6('0x22'),'json':![],'formatter':function(_0x5b7f1f){return formatter('',_0x5b7f1f);}})]});return _0x554a24;}function fileLogger(_0x592fdf,_0x3133fd){var _0x3cb2f6=new winston[(_0x47b6('0x23'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x47b6('0x24'))]({'name':util['format'](_0x47b6('0x25'),_0x592fdf,_0x47b6('0x26')),'filename':getLogFileName(_0x3133fd,_0x592fdf,_0x47b6('0x26')),'level':_0x47b6('0x26'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x363260){return fileFormat(_0x592fdf,_0x363260);}}),new winston[(_0x47b6('0x20'))][(_0x47b6('0x24'))]({'name':util['format'](_0x47b6('0x25'),_0x592fdf,debugLevel),'filename':getLogFileName(_0x3133fd,_0x592fdf,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xc1588b){return fileFormat(_0x592fdf,_0xc1588b);}}),new winston[(_0x47b6('0x20'))][(_0x47b6('0x21'))]({'level':_0x47b6('0x22'),'json':![],'formatter':function(_0x16ae39){return fileFormat(_0x592fdf,_0x16ae39);}})]});return _0x3cb2f6;}exports[_0x47b6('0x27')]=consoleLogger;exports[_0x47b6('0x28')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 4c8ca30..73fa70b 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0295=['length','isString','replace','}@@','includes','exports','lodash','newPassword','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','token','accessToken','authToken','consumerSecret','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray'];(function(_0xf48cce,_0x3531e4){var _0x2a5c38=function(_0x22a454){while(--_0x22a454){_0xf48cce['push'](_0xf48cce['shift']());}};_0x2a5c38(++_0x3531e4);}(_0x0295,0x1f0));var _0x5029=function(_0x3ca44a,_0x4bc76d){_0x3ca44a=_0x3ca44a-0x0;var _0x362653=_0x0295[_0x3ca44a];return _0x362653;};var _=require(_0x5029('0x0'));var sensitiveFields=['username','password',_0x5029('0x1'),'apiKey','firstName',_0x5029('0x2'),_0x5029('0x3'),_0x5029('0x4'),_0x5029('0x5'),_0x5029('0x6'),_0x5029('0x7'),_0x5029('0x8'),_0x5029('0x9'),_0x5029('0xa'),'code','accessKey','tenantId',_0x5029('0xb'),'channelSecret',_0x5029('0xc'),'accessTokenSecret',_0x5029('0xd'),'consumerKey',_0x5029('0xe'),_0x5029('0xf'),_0x5029('0x10'),'calleridnum',_0x5029('0x11'),_0x5029('0x12'),_0x5029('0x13'),'privateKey',_0x5029('0x14'),_0x5029('0x15'),'key','user','pass','accountSid',_0x5029('0x16'),_0x5029('0x17'),_0x5029('0x18'),_0x5029('0x19'),_0x5029('0x1a')];function maskSensitiveData(_0x11c24b){const _0xe278b7=/(?!^)[\s\S](?!$)/g;if(_[_0x5029('0x1b')](_0x11c24b)){for(const _0x10bf55 in _0x11c24b){if(_[_0x5029('0x1c')](_0x11c24b[_0x10bf55])){for(let _0x457c73=0x0;_0x457c73<_0x11c24b[_0x10bf55][_0x5029('0x1d')];_0x457c73++){maskSensitiveData(_0x11c24b[_0x10bf55][_0x457c73]);}}else if(_[_0x5029('0x1b')](_0x11c24b[_0x10bf55])){maskSensitiveData(_0x11c24b[_0x10bf55]);}else if(_[_0x5029('0x1e')](_0x11c24b[_0x10bf55])){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](/{{{/g,'@@{')[_0x5029('0x1f')](/}}}/g,_0x5029('0x20'))[_0x5029('0x1f')](/{{/g,'@{')[_0x5029('0x1f')](/}}/g,'}@');if(_[_0x5029('0x21')](sensitiveFields,_0x10bf55)){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](_0xe278b7,'*');}}}}}module[_0x5029('0x22')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x0b0e=['}@@','lodash','password','apiKey','firstName','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','tenantId','token','channelSecret','accessToken','authToken','consumerKey','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn','secret','registry','oldPassword','isArray','length','isString','replace'];(function(_0x2034f7,_0x52688c){var _0x5e85c2=function(_0x5c9a4f){while(--_0x5c9a4f){_0x2034f7['push'](_0x2034f7['shift']());}};_0x5e85c2(++_0x52688c);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1dae94,_0x239003){_0x1dae94=_0x1dae94-0x0;var _0x36ce2d=_0x0b0e[_0x1dae94];return _0x36ce2d;};var _=require(_0xe0b0('0x0'));var sensitiveFields=['username',_0xe0b0('0x1'),'newPassword',_0xe0b0('0x2'),_0xe0b0('0x3'),_0xe0b0('0x4'),_0xe0b0('0x5'),_0xe0b0('0x6'),_0xe0b0('0x7'),_0xe0b0('0x8'),_0xe0b0('0x9'),_0xe0b0('0xa'),_0xe0b0('0xb'),_0xe0b0('0xc'),'code','accessKey',_0xe0b0('0xd'),_0xe0b0('0xe'),_0xe0b0('0xf'),_0xe0b0('0x10'),'accessTokenSecret',_0xe0b0('0x11'),_0xe0b0('0x12'),'consumerSecret',_0xe0b0('0x13'),_0xe0b0('0x14'),'calleridnum',_0xe0b0('0x15'),_0xe0b0('0x16'),_0xe0b0('0x17'),'privateKey',_0xe0b0('0x18'),_0xe0b0('0x19'),_0xe0b0('0x1a'),_0xe0b0('0x1b'),_0xe0b0('0x1c'),'accountSid',_0xe0b0('0x1d'),_0xe0b0('0x1e'),_0xe0b0('0x1f'),_0xe0b0('0x20'),_0xe0b0('0x21')];function maskSensitiveData(_0x55d884){const _0x41a7e2=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x55d884)){for(const _0x35cb40 in _0x55d884){if(_[_0xe0b0('0x22')](_0x55d884[_0x35cb40])){for(let _0x519ae8=0x0;_0x519ae8<_0x55d884[_0x35cb40][_0xe0b0('0x23')];_0x519ae8++){maskSensitiveData(_0x55d884[_0x35cb40][_0x519ae8]);}}else if(_['isPlainObject'](_0x55d884[_0x35cb40])){maskSensitiveData(_0x55d884[_0x35cb40]);}else if(_[_0xe0b0('0x24')](_0x55d884[_0x35cb40])){_0x55d884[_0x35cb40]=_0x55d884[_0x35cb40][_0xe0b0('0x25')](/{{{/g,'@@{')['replace'](/}}}/g,_0xe0b0('0x26'))['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x35cb40)){_0x55d884[_0x35cb40]=_0x55d884[_0x35cb40][_0xe0b0('0x25')](_0x41a7e2,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 3273d1b..1345787 100644 --- a/server/utils/safe-template.js +++ b/server/utils/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['exports','{\x20{\x20','\x20}\x20}','string','isArray','map','isPlainObject','keys','reduce'];(function(_0x46d3c2,_0x1b7a82){var _0x58cde6=function(_0x3dcd72){while(--_0x3dcd72){_0x46d3c2['push'](_0x46d3c2['shift']());}};_0x58cde6(++_0x1b7a82);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x286ac2){return _0x286ac2==='{{'?_0x0baf('0x0'):_0x0baf('0x1');}function safeTemplate(_0x263f79){var _0x1688bc=_0x263f79;if(typeof _0x263f79===_0x0baf('0x2')){_0x1688bc=_0x263f79['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x0baf('0x3')](_0x263f79)){_0x1688bc=_0x263f79[_0x0baf('0x4')](function(_0x2d3fa5){return safeTemplate(_0x2d3fa5);});}else if(_[_0x0baf('0x5')](_0x263f79)){_0x1688bc=Object[_0x0baf('0x6')](_0x263f79)[_0x0baf('0x7')](function(_0x1a10b1,_0x2dcaac){_0x1a10b1[_0x2dcaac]=safeTemplate(_0x263f79[_0x2dcaac]);return _0x1a10b1;},{});}return _0x1688bc;}module[_0x0baf('0x8')]['safeTemplate']=safeTemplate; \ No newline at end of file +var _0x9c00=['isPlainObject','exports','safeTemplate','lodash','replace','isArray','map'];(function(_0x4d1ee9,_0x394a78){var _0x9a5456=function(_0x224f3b){while(--_0x224f3b){_0x4d1ee9['push'](_0x4d1ee9['shift']());}};_0x9a5456(++_0x394a78);}(_0x9c00,0x1a0));var _0x09c0=function(_0x2980de,_0x1426a4){_0x2980de=_0x2980de-0x0;var _0x81a4ca=_0x9c00[_0x2980de];return _0x81a4ca;};var _=require(_0x09c0('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x170d8b){return _0x170d8b==='{{'?'{\x20{\x20':'\x20}\x20}';}function safeTemplate(_0xe0d293){var _0x8c9907=_0xe0d293;if(typeof _0xe0d293==='string'){_0x8c9907=_0xe0d293[_0x09c0('0x1')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x09c0('0x2')](_0xe0d293)){_0x8c9907=_0xe0d293[_0x09c0('0x3')](function(_0x2fd03e){return safeTemplate(_0x2fd03e);});}else if(_[_0x09c0('0x4')](_0xe0d293)){_0x8c9907=Object['keys'](_0xe0d293)['reduce'](function(_0x1f3d7e,_0x17d11f){_0x1f3d7e[_0x17d11f]=safeTemplate(_0xe0d293[_0x17d11f]);return _0x1f3d7e;},{});}return _0x8c9907;}module[_0x09c0('0x5')][_0x09c0('0x6')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index a4c2219..70152cd 100644 --- a/server/utils/update-app-config.js +++ b/server/utils/update-app-config.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3dcf=['name','motion2','env','NODE_PATH','string','then','readJSON','updated','info','Updating\x20app.json','writeJSON','exports','fs-extra','path','../config/environment','root','resolve','legacy-libs','isArray','apps','findIndex'];(function(_0x41a997,_0x46e8ca){var _0x5c1e01=function(_0x50ae1c){while(--_0x50ae1c){_0x41a997['push'](_0x41a997['shift']());}};_0x5c1e01(++_0x46e8ca);}(_0x3dcf,0x8a));var _0xf3dc=function(_0x3f5c6c,_0x3e2bea){_0x3f5c6c=_0x3f5c6c-0x0;var _0xe90d9d=_0x3dcf[_0x3f5c6c];return _0xe90d9d;};var fs=require(_0xf3dc('0x0'));var path=require(_0xf3dc('0x1'));var config=require(_0xf3dc('0x2'));var root=config[_0xf3dc('0x3')];var APP_JSON_PATH=path[_0xf3dc('0x4')](root,'server/app.json');var NODEPATH=path['resolve'](root,_0xf3dc('0x5'));function setLegacyLibsNodeEnvPath(_0x162dbf){let _0x255e56=![];if(Array[_0xf3dc('0x6')](_0x162dbf[_0xf3dc('0x7')])){var _0x4d0f31=_0x162dbf['apps'][_0xf3dc('0x8')](function(_0x3a039c){return _0x3a039c[_0xf3dc('0x9')]===_0xf3dc('0xa');});if(_0x4d0f31>-0x1){var _0x4c420c=_0x162dbf[_0xf3dc('0x7')][_0x4d0f31];if(typeof _0x4c420c[_0xf3dc('0xb')][_0xf3dc('0xc')]!==_0xf3dc('0xd')){_0x4c420c[_0xf3dc('0xb')][_0xf3dc('0xc')]=NODEPATH;_0x255e56=!![];}}return{'appConfig':_0x162dbf,'updated':_0x255e56};}}function updateAppConfig(_0x3aa704){return fs['pathExists'](APP_JSON_PATH)[_0xf3dc('0xe')](function(_0x58669c){if(_0x58669c){return fs[_0xf3dc('0xf')](APP_JSON_PATH)[_0xf3dc('0xe')](function(_0x22687f){var _0x4fd1c1=setLegacyLibsNodeEnvPath(_0x22687f);if(_0x4fd1c1[_0xf3dc('0x10')]){_0x3aa704[_0xf3dc('0x11')](_0xf3dc('0x12'));return fs[_0xf3dc('0x13')](APP_JSON_PATH,_0x22687f,{'spaces':0x2});}else{return Promise[_0xf3dc('0x4')]();}});}else{return Promise['resolve']();}});}module[_0xf3dc('0x14')]=updateAppConfig; \ No newline at end of file +var _0x5f59=['exports','path','root','resolve','legacy-libs','isArray','findIndex','motion2','env','NODE_PATH','string','pathExists','then','readJSON','info','Updating\x20app.json','writeJSON'];(function(_0x436ff6,_0x57beff){var _0x5e1fe9=function(_0x44a13f){while(--_0x44a13f){_0x436ff6['push'](_0x436ff6['shift']());}};_0x5e1fe9(++_0x57beff);}(_0x5f59,0x1dd));var _0x95f5=function(_0x4aada6,_0x7adb07){_0x4aada6=_0x4aada6-0x0;var _0x3c8986=_0x5f59[_0x4aada6];return _0x3c8986;};var fs=require('fs-extra');var path=require(_0x95f5('0x0'));var config=require('../config/environment');var root=config[_0x95f5('0x1')];var APP_JSON_PATH=path[_0x95f5('0x2')](root,'server/app.json');var NODEPATH=path[_0x95f5('0x2')](root,_0x95f5('0x3'));function setLegacyLibsNodeEnvPath(_0x2d5eb5){let _0x425e49=![];if(Array[_0x95f5('0x4')](_0x2d5eb5['apps'])){var _0x20d864=_0x2d5eb5['apps'][_0x95f5('0x5')](function(_0xca9a1b){return _0xca9a1b['name']===_0x95f5('0x6');});if(_0x20d864>-0x1){var _0x5bc339=_0x2d5eb5['apps'][_0x20d864];if(typeof _0x5bc339[_0x95f5('0x7')][_0x95f5('0x8')]!==_0x95f5('0x9')){_0x5bc339['env'][_0x95f5('0x8')]=NODEPATH;_0x425e49=!![];}}return{'appConfig':_0x2d5eb5,'updated':_0x425e49};}}function updateAppConfig(_0x228fb5){return fs[_0x95f5('0xa')](APP_JSON_PATH)[_0x95f5('0xb')](function(_0x15a7f7){if(_0x15a7f7){return fs[_0x95f5('0xc')](APP_JSON_PATH)[_0x95f5('0xb')](function(_0x54a92a){var _0x2d1241=setLegacyLibsNodeEnvPath(_0x54a92a);if(_0x2d1241['updated']){_0x228fb5[_0x95f5('0xd')](_0x95f5('0xe'));return fs[_0x95f5('0xf')](APP_JSON_PATH,_0x54a92a,{'spaces':0x2});}else{return Promise[_0x95f5('0x2')]();}});}else{return Promise[_0x95f5('0x2')]();}});}module[_0x95f5('0x10')]=updateAppConfig; \ No newline at end of file -- 1.7.1